From 69234a8568c8fd87cd382e98e95d26be4460e8af Mon Sep 17 00:00:00 2001 From: Jason Self Date: Sun, 24 Jun 2018 18:21:22 -0700 Subject: [PATCH] Add ITS Importing MIT's 1999 GPL release of the Incompatible Timesharing System into version control Originally from http://groups.csail.mit.edu/mac/ftpdir/its/ --- README | 2 + sysdoc/%pi.103 | 309 + sysdoc/%pi.105 | 307 + sysdoc/COPYING | 339 + sysdoc/_calls.124 | 5222 ++++++++++ sysdoc/_calls.126 | 5246 ++++++++++ sysdoc/_calls.127 | 5269 ++++++++++ sysdoc/arcdev.format | 101 + sysdoc/binfmt.101 | 289 + sysdoc/bugits.list | 54 + sysdoc/chaord.57 | 2201 +++++ sysdoc/chaos.file | 777 ++ sysdoc/clo.100 | 186 + sysdoc/ddt.bugs | 4197 ++++++++ sysdoc/devdoc.5 | 125 + sysdoc/doc.tags | 59 + sysdoc/dskdmp.order | 62 + sysdoc/dump.format | 66 + sysdoc/grphcs.21 | 655 ++ sysdoc/hstinf.recent | 3131 ++++++ sysdoc/infits.mlist | 57 + sysdoc/intrup.107 | 576 ++ sysdoc/intrup.108 | 579 ++ sysdoc/its.bugs | 5104 ++++++++++ sysdoc/its.histry | 937 ++ sysdoc/its.obugs0 | 15497 +++++++++++++++++++++++++++++ sysdoc/its.obugs1 | 7768 +++++++++++++++ sysdoc/its.obugs2 | 8486 ++++++++++++++++ sysdoc/its.recent | 1689 ++++ sysdoc/itstty.41 | 3588 +++++++ sysdoc/job.100 | 799 ++ sysdoc/jobonl.100 | 508 + sysdoc/kl.hung | 44 + sysdoc/kl10.flklor | 69 + sysdoc/kl10.info | 29 + sysdoc/locks.107 | 377 + sysdoc/locks.108 | 377 + sysdoc/magtap.101 | 223 + sysdoc/mldev.protoc | 171 + sysdoc/ncp.100 | 858 ++ sysdoc/pclsr.test | 105 + sysdoc/pdset.info | 83 + sysdoc/peek.bugs | 730 ++ sysdoc/poor.mc | 4002 ++++++++ sysdoc/ttyvar.103 | 414 + sysdoc/ttyvar.105 | 446 + sysdoc/tv.100 | 327 + sysdoc/ufd.100 | 165 + sysdoc/usets.116 | 1410 +++ sysdoc/usets.119 | 1422 +++ sysdoc/usets.120 | 1423 +++ sysdoc/usr.101 | 840 ++ sysdoc/usr.102 | 840 ++ sysdoc/uuos.111 | 2307 +++++ sysdoc/uuos.112 | 2307 +++++ sysdoc/xgp.writup | 175 + system/COPYING | 339 + system/bits.115 | 1125 +++ system/bits.116 | 1126 +++ system/bits.117 | 1127 +++ system/ch10.defs1 | 42 + system/ch11.defs1 | 74 + system/chaos.286 | 2795 ++++++ system/chaos.287 | 2796 ++++++ system/chaos.288 | 2798 ++++++ system/chsdef.14 | 84 + system/chsdef.15 | 84 + system/config.188 | 938 ++ system/config.191 | 940 ++ system/config.192 | 1004 ++ system/config.193 | 940 ++ system/config.195 | 937 ++ system/config.196 | 942 ++ system/core.81 | 3004 ++++++ system/core.82 | 3005 ++++++ system/dc10.defs27 | 286 + system/ddt.49 | 2738 +++++ system/ddt.51 | 2739 +++++ system/ddt.68 | 2864 ++++++ system/ddtdsk.31 | 1117 +++ system/disk.1221 | 6395 ++++++++++++ system/disk.1222 | 6418 ++++++++++++ system/disk.1223 | 6425 ++++++++++++ system/disk.1224 | 6428 ++++++++++++ system/dmpcpy.11 | 169 + system/dmpcpy.8 | 127 + system/dskdmp.212 | 1870 ++++ system/dskdmp.213 | 1873 ++++ system/dskdmp.214 | 1885 ++++ system/dskdmp.215 | 1898 ++++ system/dz11.10 | 72 + system/dz11.9 | 67 + system/ept.defs15 | 175 + system/ept.defs16 | 176 + system/evsyms.21 | 294 + system/fsdefs.40 | 170 + system/fsdefs.43 | 232 + system/imp.361 | 1678 ++++ system/imp.363 | 941 ++ system/imp.364 | 946 ++ system/imp.365 | 947 ++ system/impold.wthncp | 1990 ++++ system/inet.130 | 1441 +++ system/inet.131 | 1429 +++ system/inet.132 | 1429 +++ system/inet.133 | 1429 +++ system/inet.137 | 1440 +++ system/inet.138 | 1446 +++ system/ioelev.430 | 4960 ++++++++++ system/ioelev.431 | 4960 ++++++++++ system/ioelev.432 | 4960 ++++++++++ system/its.1622 | 21721 ++++++++++++++++++++++++++++++++++++++++ system/its.1632 | 21783 ++++++++++++++++++++++++++++++++++++++++ system/its.1633 | 21838 ++++++++++++++++++++++++++++++++++++++++ system/its.1634 | 21838 ++++++++++++++++++++++++++++++++++++++++ system/its.1641 | 21941 ++++++++++++++++++++++++++++++++++++++++ system/its.1642 | 21941 ++++++++++++++++++++++++++++++++++++++++ system/its.1644 | 21946 +++++++++++++++++++++++++++++++++++++++++ system/its.notags | 145 + system/its.tags | 13937 ++++++++++++++++++++++++++ system/itsdev.974 | 5337 ++++++++++ system/itsdis.50 | 336 + system/itsmsp.30 | 331 + system/kaimp.defs1 | 79 + system/ksnet.1 | 74 + system/lhdh.defs4 | 96 + system/lhdh.defs5 | 96 + system/meter.tecmac | 21 + system/mtape.196 | 1472 +++ system/mtape.197 | 1477 +++ system/ncp.9 | 2777 ++++++ system/net.31 | 507 + system/net.32 | 517 + system/ni1010.defs1 | 114 + system/ni1010.defs2 | 114 + system/nmtape.27 | 2449 +++++ system/nmtape.30 | 2448 +++++ system/rh10.defs26 | 246 + system/rh11.defs36 | 193 + system/rh11.defs37 | 194 + system/rh11.defs38 | 236 + system/rh11.defs48 | 305 + system/rm03.defs5 | 57 + system/rm80.defs2 | 57 + system/rm80.defs3 | 57 + system/rm80.defs4 | 61 + system/rp06.defs1 | 57 + system/rp07.defs1 | 57 + system/rp10.defs16 | 122 + system/salv.311 | 6701 +++++++++++++ system/sysjob.114 | 2791 ++++++ system/sysjob.116 | 2805 ++++++ system/sysjob.117 | 2812 ++++++ system/t20mac.1 | 361 + system/t300.defs7 | 108 + system/tcp.273 | 3631 +++++++ system/tcp.274 | 3640 +++++++ system/tcp.275 | 3645 +++++++ system/tcpbuf.56 | 588 ++ system/tcpbuf.57 | 588 ++ system/tcpbuf.58 | 591 ++ system/time.948 | 359 + system/time.949 | 359 + system/time.950 | 359 + system/tm03s.defs2 | 167 + system/tm03s.defs3 | 167 + system/tm03s.defs4 | 167 + system/tm78s.defs1 | 194 + system/tm78s.defs2 | 194 + system/ts3tty.400 | 8230 ++++++++++++++++ system/ttytyp.310 | 416 + system/ttytyp.311 | 420 + system/ttytyp.312 | 420 + system/ttytyp.313 | 416 + system/ttytyp.314 | 416 + system/tv.132 | 6011 +++++++++++ system/utape.952 | 2025 ++++ system/whovar.5 | 174 + 178 files changed, 427575 insertions(+) create mode 100644 README create mode 100644 sysdoc/%pi.103 create mode 100644 sysdoc/%pi.105 create mode 100644 sysdoc/COPYING create mode 100644 sysdoc/_calls.124 create mode 100644 sysdoc/_calls.126 create mode 100644 sysdoc/_calls.127 create mode 100644 sysdoc/arcdev.format create mode 100644 sysdoc/binfmt.101 create mode 100644 sysdoc/bugits.list create mode 100644 sysdoc/chaord.57 create mode 100644 sysdoc/chaos.file create mode 100644 sysdoc/clo.100 create mode 100644 sysdoc/ddt.bugs create mode 100644 sysdoc/devdoc.5 create mode 100644 sysdoc/doc.tags create mode 100644 sysdoc/dskdmp.order create mode 100644 sysdoc/dump.format create mode 100644 sysdoc/grphcs.21 create mode 100644 sysdoc/hstinf.recent create mode 100644 sysdoc/infits.mlist create mode 100644 sysdoc/intrup.107 create mode 100644 sysdoc/intrup.108 create mode 100644 sysdoc/its.bugs create mode 100644 sysdoc/its.histry create mode 100644 sysdoc/its.obugs0 create mode 100644 sysdoc/its.obugs1 create mode 100644 sysdoc/its.obugs2 create mode 100644 sysdoc/its.recent create mode 100644 sysdoc/itstty.41 create mode 100644 sysdoc/job.100 create mode 100644 sysdoc/jobonl.100 create mode 100644 sysdoc/kl.hung create mode 100644 sysdoc/kl10.flklor create mode 100644 sysdoc/kl10.info create mode 100644 sysdoc/locks.107 create mode 100644 sysdoc/locks.108 create mode 100644 sysdoc/magtap.101 create mode 100644 sysdoc/mldev.protoc create mode 100644 sysdoc/ncp.100 create mode 100644 sysdoc/pclsr.test create mode 100644 sysdoc/pdset.info create mode 100644 sysdoc/peek.bugs create mode 100644 sysdoc/poor.mc create mode 100644 sysdoc/ttyvar.103 create mode 100644 sysdoc/ttyvar.105 create mode 100644 sysdoc/tv.100 create mode 100644 sysdoc/ufd.100 create mode 100644 sysdoc/usets.116 create mode 100644 sysdoc/usets.119 create mode 100644 sysdoc/usets.120 create mode 100644 sysdoc/usr.101 create mode 100644 sysdoc/usr.102 create mode 100644 sysdoc/uuos.111 create mode 100644 sysdoc/uuos.112 create mode 100644 sysdoc/xgp.writup create mode 100644 system/COPYING create mode 100644 system/bits.115 create mode 100644 system/bits.116 create mode 100644 system/bits.117 create mode 100644 system/ch10.defs1 create mode 100644 system/ch11.defs1 create mode 100644 system/chaos.286 create mode 100644 system/chaos.287 create mode 100644 system/chaos.288 create mode 100644 system/chsdef.14 create mode 100644 system/chsdef.15 create mode 100644 system/config.188 create mode 100644 system/config.191 create mode 100644 system/config.192 create mode 100644 system/config.193 create mode 100644 system/config.195 create mode 100644 system/config.196 create mode 100644 system/core.81 create mode 100644 system/core.82 create mode 100644 system/dc10.defs27 create mode 100644 system/ddt.49 create mode 100644 system/ddt.51 create mode 100644 system/ddt.68 create mode 100644 system/ddtdsk.31 create mode 100644 system/disk.1221 create mode 100644 system/disk.1222 create mode 100644 system/disk.1223 create mode 100644 system/disk.1224 create mode 100644 system/dmpcpy.11 create mode 100644 system/dmpcpy.8 create mode 100644 system/dskdmp.212 create mode 100644 system/dskdmp.213 create mode 100644 system/dskdmp.214 create mode 100644 system/dskdmp.215 create mode 100644 system/dz11.10 create mode 100644 system/dz11.9 create mode 100644 system/ept.defs15 create mode 100644 system/ept.defs16 create mode 100644 system/evsyms.21 create mode 100644 system/fsdefs.40 create mode 100644 system/fsdefs.43 create mode 100644 system/imp.361 create mode 100644 system/imp.363 create mode 100644 system/imp.364 create mode 100644 system/imp.365 create mode 100644 system/impold.wthncp create mode 100644 system/inet.130 create mode 100644 system/inet.131 create mode 100644 system/inet.132 create mode 100644 system/inet.133 create mode 100644 system/inet.137 create mode 100644 system/inet.138 create mode 100644 system/ioelev.430 create mode 100644 system/ioelev.431 create mode 100644 system/ioelev.432 create mode 100644 system/its.1622 create mode 100644 system/its.1632 create mode 100644 system/its.1633 create mode 100644 system/its.1634 create mode 100644 system/its.1641 create mode 100644 system/its.1642 create mode 100644 system/its.1644 create mode 100644 system/its.notags create mode 100644 system/its.tags create mode 100644 system/itsdev.974 create mode 100644 system/itsdis.50 create mode 100644 system/itsmsp.30 create mode 100644 system/kaimp.defs1 create mode 100644 system/ksnet.1 create mode 100644 system/lhdh.defs4 create mode 100644 system/lhdh.defs5 create mode 100644 system/meter.tecmac create mode 100644 system/mtape.196 create mode 100644 system/mtape.197 create mode 100644 system/ncp.9 create mode 100644 system/net.31 create mode 100644 system/net.32 create mode 100644 system/ni1010.defs1 create mode 100644 system/ni1010.defs2 create mode 100644 system/nmtape.27 create mode 100644 system/nmtape.30 create mode 100644 system/rh10.defs26 create mode 100644 system/rh11.defs36 create mode 100644 system/rh11.defs37 create mode 100644 system/rh11.defs38 create mode 100644 system/rh11.defs48 create mode 100644 system/rm03.defs5 create mode 100644 system/rm80.defs2 create mode 100644 system/rm80.defs3 create mode 100644 system/rm80.defs4 create mode 100644 system/rp06.defs1 create mode 100644 system/rp07.defs1 create mode 100644 system/rp10.defs16 create mode 100644 system/salv.311 create mode 100644 system/sysjob.114 create mode 100644 system/sysjob.116 create mode 100644 system/sysjob.117 create mode 100644 system/t20mac.1 create mode 100644 system/t300.defs7 create mode 100644 system/tcp.273 create mode 100644 system/tcp.274 create mode 100644 system/tcp.275 create mode 100644 system/tcpbuf.56 create mode 100644 system/tcpbuf.57 create mode 100644 system/tcpbuf.58 create mode 100644 system/time.948 create mode 100644 system/time.949 create mode 100644 system/time.950 create mode 100644 system/tm03s.defs2 create mode 100644 system/tm03s.defs3 create mode 100644 system/tm03s.defs4 create mode 100644 system/tm78s.defs1 create mode 100644 system/tm78s.defs2 create mode 100644 system/ts3tty.400 create mode 100644 system/ttytyp.310 create mode 100644 system/ttytyp.311 create mode 100644 system/ttytyp.312 create mode 100644 system/ttytyp.313 create mode 100644 system/ttytyp.314 create mode 100644 system/tv.132 create mode 100644 system/utape.952 create mode 100644 system/whovar.5 diff --git a/README b/README new file mode 100644 index 0000000..1bf6883 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +This directory contains the source code and associated documentation +for the ITS kernel. This code has been released under the GNU GPL. diff --git a/sysdoc/%pi.103 b/sysdoc/%pi.103 new file mode 100644 index 0000000..7827042 --- /dev/null +++ b/sysdoc/%pi.103 @@ -0,0 +1,309 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS INTERRUPTS: + +This file attempts to maintain up-to-date documentation on +ITS interrupts. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the %PIJST interrupt ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + + + +FIRST The Interrupt Bits in the First Interrupt Word. + +The interrupt classes are: + [1] stops job and interrupts superior (fatal intr) + [2] stops job and interrupts superior unless enabled and undeferred + [3] does nothing unless enabled; waits if deferred. + +Bits in the left half have two names: %PI... as a bit in the word, +and %PJ... shifted down by 18. bits. + +The following interrupts abort the instruction, and leave the PC pointing +before the instruction if %OPOPC is 1 (as is winning), or after it if +%OPOPC is 0: %PIMPV, %PIOOB, %PIIOC, %PIILO, %PITTY, %PIWRO, %PIFET, %PITRP. + +"(S)" indicates a synchronous interrupt; "(A)", an asynchronous one. +An interrupt is synchronous if its occurrence is always directly related +to the instruction that is being executed when it is signaled. + +SECOND The Interrupt Bits in the Second Interrupt Word. + +The right half of the second word (.IFPIR) is used for I/O channel +interrupts that signal the arrival of or need for data. +They should not be confused with I/O channel error interrupts +or IOCERRors. Each channel has its own bit: 1.1 is for channel +0; 1.2, for channel 1; ... 2.7, for channel 17 . +They are all class 3, and their significance depends on the device +open on the channel. + +The left half of the second word (.IFPIR) is used for +"inferior got a fatal interrupt" interrupts. Each of a job's +inferiors is assigned its own interrupt bit from among the +bottom 8 bits of the left half. When an inferior job is created, +its interrupt bit should be read and remembered by reading the +.INTB variable with a .USET. Every time that inferior gets a fatal +interrupt, it will be stopped and the superior will receive an +interrupt on that inferior's bit in .IFPIR. The inferior may +be restarted by zeroing its .USTP variable, but if the fatal +interrupts remain and are still fatal the inferior will simply +stop and interrupt the superior again. "Inferior got a fatal +interrupt" interrupts are all class 3. + +The reason that inferiors interrupt through a special set of bits +instead of using I/O channel interrupts is that it makes it possible +to receive interrupts from all one's inferiors without having them +all open on I/O channels at all times. DDT normally keeps only +its current job open, and when it receives an interrupt from some +other job it opens that job temporarily. + +STACK The format of the new-style interrupt stack + + ----------------------------------- + | 1st word interrupt bits | + ----------------------------------- + | 2nd word interrupt bits | + ----------------------------------- + | Saved .DF1 | + ----------------------------------- + | Saved .DF2 | + ----------------------------------- + | Saved program counter | + ----------------------------------- + | . . . | + | Saved accumulators, if any | + | . . . | + ----------------------------------- + | Saved .JPC, if requested | + ----------------------------------- + | Saved .SUUOH, if requested | + ----------------------------------- + Top -> | Saved LSPCL, if requested | + ----------------------------------- + +%PICLI CLI interrupt [3] (A) + + Some job opened the CLI device with filenames equal + to the uname and jname of this job. + +%PIPDL PDL overflow [3] (S) + +%PILTP 340 or E&S light pen hit [3] (A) + +%PIMAR MAR hit. [2] (S) + + The MAR is a hardware feature that allows + references to a specific memory location to + be trapped. This is the interrupt that happens + when such a reference is detected. The guilty + instuction is usually not aborted; if it is, the + PC is SOS'ed regardless of the setting of %OPOPC. + See the .MARA and .MARPC variables. + +%PIMPV MPV (memory protect violation) [2] (S) + + The job referenced a non-existent memory location. + The address of that location (roundd down to + a page boundary on KA-10's) may be found in .MPVA. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PICLK Slow (1/2 sec) clock [3] (A) + +%PI1PR Single-instruction proceed [1] (S) + + If a job is started with the one-proceed flag + (%PC1PR on KA-10's) set, after one instruction + is completed a %PI1PR interrupt will occur. + DDT's ^N command uses this feature. + +%PIBRK .BREAK instruction executed. [1] (S) + + .BREAK is used for DDT breakpoints, and for explicit + program requests to DDT. + +%PIOOB Address out of bounds [2] (S) + + This is an obscure condition that used to + happen on USR device IOT's, when an attempt + was made to refer to a nonexistent location in the + other job. Now this always causes an MPV. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIIOC IOCERR (I/O channel error) [2] (S) + + This indicates the failure of an I/O system + call. The channel that was being operated on is + in .BCHN, and its .IOS word should contain, in + bits 4.5 - 4.1, an error code. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIVAL .VALUE instruction executed [1] (S) + +%PIDWN System-going-down status change [3] (A) + + If the system changes its mind about whether + or when it is scheduled to go down, this interrupt + is signaled. + +%PIILO ILOPR, ILUUO (illegal operation) [2] (S) + + This can be caused by a returnable uuo when the + program's 41 doesn't seem suitable for handling one + (see ITS UUOS). It can also be used to report + the failure of certain more archaic system calls. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIDIS Display memory protect [2] (A) + + The 340 or E&S display got an MPV. + This is now obsolete since the 340 and E&S + no longer work. + +%PIARO Arithmetic overflow [3] (S) + + The PDP-10's built-in arithmetic overflow + condition was detected by the hardware. + In fact, overflow occurs so often + that enabling this interrupt causes the + machine to slow down considerably, + and it should be avoided. + +%PIB42 BADPI (Bad location 42) [1] (S) + + If in attempting to interrupt a job it turns out + to be necessary to refer to nonexistent memory + or write in read-only memory, this interrupt + is signaled, instead of MPV or WIRO. + This is so that the program will return to DDT + instead of mysteriously looping. + +%PIC.Z ^Z or CALL typed on terminal [1] (A) + +%PITYI TTY input (obsolete) [3] (A) + +%PIRLT Real-time timer went off [3] (A) + + These interrupts are controlled by the .REALT + uuo. See ITS UUOS. + +%PIRUN Run-time timer went off [3] (A) + + This interrupt is requested (in advance) + by setting .RTMR. + +%PINXI Non-existent IO register [2] (S) + + A Job in User IOT mode referenced a non-existent IO + register on the KS10 Unibus. The PC is left pointing + before the guilty instruction. The address of the + non-existant register may be found in .MPVA. + +%PIJST Job Status display request. [3] (A) + + The sequence ^_J was typed on the + console owned by this process or some inferior. + +%PIDCL Deferred call. [1] (S) + + An attempt was made to read TTY input + and the next character was a deferred-call + character (^_D or Control-CALL). + This deferred-call character is never seen + by the program; it just causes the interrupt. + It differs from ordinary CALL or ^Z + in that it takes effect when the program + gets around to reading it, not immediately. + +%PIATY TTY returned. [3] (A) + + This interrupt happens when the TTY is + returned by the superior, after having + been taken away. TECO uses this to know + that it must redisplay the entire screen. + +%PITTY Don't have TTY [2] (S) + + This results from an attempt to use the job's + console tty when the job does not own it, if + %TBINT is 1 and %TBWAT is 0. See ITS TTY. + The guilty instruction is aborted, and the PC is + left set according to %OPOPC. + +%PIPAR Memory parity error [2] (A) + + Programs are not intended to try to recover + from parity errors, on the assumption that they + are probably permanently screwed up. + This interrupt is asynchronous because it can + be caused by a parity error in another job + which destroys data in a page shared with this job. + +%PIFOV ARFOV (Floating overflow) [3] (S) + + This is a non-aborting PDP-10 hardware condition. + +%PIWRO WIRO (Write in read-only page) [2] (S) + + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. The address of read + only location (rounded down to a page boundary on + KA-10's) may be found in .MPVA. + +%PIFET Fetched insn from impure page [2] (S) + + On KA-10's, if bit %PCPUR of the PC flags is 1, + fetching an instruction from an impure page + will cause this interrupt. This is supposed to + facilitate catching jumps to randomness. + The guilty instruction is aborted, and the PC is + left set according to %OPOPC. + +%PITRP SYSUUO (System uuo in trap mode) [2] (S) + + A job whose .UTRAP variable was nonzero either + attempted to execute an instruction that trapped + to the system, or was about to be interrupted. + This feature is intended to be used by the superior + to provide a non-ITS environment for the inferior. + For that purpose, this interrupt should not be + enabled for the inferior, so that it will be fatal. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIDBG System being debugged state change [3] (A) + + When the system enters or leaves "debugging mode", + this interrupt is signaled. + +%PILOS Lossage signaled. [2] (S) + + A .LOSE UUO or a LOSE system call was executed. diff --git a/sysdoc/%pi.105 b/sysdoc/%pi.105 new file mode 100644 index 0000000..76061a9 --- /dev/null +++ b/sysdoc/%pi.105 @@ -0,0 +1,307 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS INTERRUPTS: + +This file attempts to maintain up-to-date documentation on +ITS interrupts. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the %PIJST interrupt ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + + + +FIRST The Interrupt Bits in the First Interrupt Word. + +The interrupt classes are: + [1] stops job and interrupts superior (fatal intr) + [2] stops job and interrupts superior unless enabled and undeferred + [3] does nothing unless enabled; waits if deferred. + +Bits in the left half have two names: %PI... as a bit in the word, +and %PJ... shifted down by 18. bits. + +The following interrupts abort the instruction, and leave the PC pointing +before the instruction if %OPOPC is 1 (as is winning), or after it if +%OPOPC is 0: %PIMPV, %PIOOB, %PIIOC, %PIILO, %PITTY, %PIWRO, %PIFET, %PITRP. + +"(S)" indicates a synchronous interrupt; "(A)", an asynchronous one. +An interrupt is synchronous if its occurrence is always directly related +to the instruction that is being executed when it is signaled. + +SECOND The Interrupt Bits in the Second Interrupt Word. + +The right half of the second word (.IFPIR) is used for I/O channel +interrupts that signal the arrival of or need for data. +They should not be confused with I/O channel error interrupts +or IOCERRors. Each channel has its own bit: 1.1 is for channel +0; 1.2, for channel 1; ... 2.7, for channel 17 . +They are all class 3, and their significance depends on the device +open on the channel. + +The left half of the second word (.IFPIR) is used for +"inferior got a fatal interrupt" interrupts. Each of a job's +inferiors is assigned its own interrupt bit from among the +bottom 8 bits of the left half. When an inferior job is created, +its interrupt bit should be read and remembered by reading the +.INTB variable with a .USET. Every time that inferior gets a fatal +interrupt, it will be stopped and the superior will receive an +interrupt on that inferior's bit in .IFPIR. The inferior may +be restarted by zeroing its .USTP variable, but if the fatal +interrupts remain and are still fatal the inferior will simply +stop and interrupt the superior again. "Inferior got a fatal +interrupt" interrupts are all class 3. + +The reason that inferiors interrupt through a special set of bits +instead of using I/O channel interrupts is that it makes it possible +to receive interrupts from all one's inferiors without having them +all open on I/O channels at all times. DDT normally keeps only +its current job open, and when it receives an interrupt from some +other job it opens that job temporarily. + +STACK The format of the new-style interrupt stack + + ----------------------------------- + | 1st word interrupt bits | + ----------------------------------- + | 2nd word interrupt bits | + ----------------------------------- + | Saved .DF1 | + ----------------------------------- + | Saved .DF2 | + ----------------------------------- + | Saved program counter | + ----------------------------------- + | . . . | + | Saved accumulators, if any | + | . . . | + ----------------------------------- + | Saved .JPC, if requested | + ----------------------------------- + | Saved .SUUOH, if requested | + ----------------------------------- + Top -> | Saved LSPCL, if requested | + ----------------------------------- + +%PI1PR Single-instruction proceed [1] (S) + + If a job is started with the one-proceed flag + (%PC1PR on KA-10's) set, after one instruction + is completed a %PI1PR interrupt will occur. + DDT's ^N command uses this feature. + +%PIARO Arithmetic overflow [3] (S) + + The PDP-10's built-in arithmetic overflow + condition was detected by the hardware. + In fact, overflow occurs so often + that enabling this interrupt causes the + machine to slow down considerably, + and it should be avoided. + +%PIATY TTY returned. [3] (A) + + This interrupt happens when the TTY is + returned by the superior, after having + been taken away. TECO uses this to know + that it must redisplay the entire screen. + +%PIB42 BADPI (Bad location 42) [1] (S) + + If in attempting to interrupt a job it turns out + to be necessary to refer to nonexistent memory + or write in read-only memory, this interrupt + is signaled, instead of MPV or WIRO. + This is so that the program will return to DDT + instead of mysteriously looping. + +%PIBRK .BREAK instruction executed. [1] (S) + + .BREAK is used for DDT breakpoints, and for explicit + program requests to DDT. + +%PIC.Z ^Z or CALL typed on terminal [1] (A) + +%PICLI CLI interrupt [3] (A) + + Some job opened the CLI device with filenames equal + to the uname and jname of this job. + +%PICLK Slow (1/2 sec) clock [3] (A) + +%PIDBG System being debugged state change [3] (A) + + When the system enters or leaves "debugging mode", + this interrupt is signaled. + +%PIDCL Deferred call. [1] (S) + + An attempt was made to read TTY input + and the next character was a deferred-call + character (^_D or Control-CALL). + This deferred-call character is never seen + by the program; it just causes the interrupt. + It differs from ordinary CALL or ^Z + in that it takes effect when the program + gets around to reading it, not immediately. + +%PIDIS Display memory protect [2] (A) + + The 340 or E&S display got an MPV. + This is now obsolete since the 340 and E&S + no longer work. + +%PIDWN System-going-down status change [3] (A) + + If the system changes its mind about whether + or when it is scheduled to go down, this interrupt + is signaled. + +%PIFET Fetched insn from impure page [2] (S) + + On KA-10's, if bit %PCPUR of the PC flags is 1, + fetching an instruction from an impure page + will cause this interrupt. This is supposed to + facilitate catching jumps to randomness. + The guilty instruction is aborted, and the PC is + left set according to %OPOPC. + +%PIFOV ARFOV (Floating overflow) [3] (S) + + This is a non-aborting PDP-10 hardware condition. + +%PIILO ILOPR, ILUUO (illegal operation) [2] (S) + + This can be caused by a returnable uuo when the + program's 41 doesn't seem suitable for handling one + (see ITS UUOS). It can also be used to report + the failure of certain more archaic system calls. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIIOC IOCERR (I/O channel error) [2] (S) + + This indicates the failure of an I/O system + call. The channel that was being operated on is + in .BCHN, and its .IOS word should contain, in + bits 4.5 - 4.1, an error code. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIJST Job Status display request. [3] (A) + + The sequence ^_J was typed on the + console owned by this process or some inferior. + +%PILOS Lossage signaled. [2] (S) + + A .LOSE UUO or a LOSE system call was executed. + +%PILTP 340 or E&S light pen hit [3] (A) + +%PIMAR MAR hit. [2] (S) + + The MAR is a hardware feature that allows + references to a specific memory location to + be trapped. This is the interrupt that happens + when such a reference is detected. The guilty + instuction is usually not aborted; if it is, the + PC is SOS'ed regardless of the setting of %OPOPC. + See the .MARA and .MARPC variables. + +%PIMPV MPV (memory protect violation) [2] (S) + + The job referenced a non-existent memory location. + The address of that location (roundd down to + a page boundary on KA-10's) may be found in .MPVA. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PINXI Non-existent IO register [2] (S) + + A Job in User IOT mode referenced a non-existent IO + register on the KS10 Unibus. The PC is left pointing + before the guilty instruction. The address of the + non-existant register may be found in .MPVA. + +%PIOOB Address out of bounds [2] (S) + + This is an obscure condition that used to + happen on USR device IOT's, when an attempt + was made to refer to a nonexistent location in the + other job. Now this always causes an MPV. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PIPAR Memory parity error [2] (A) + + Programs are not intended to try to recover + from parity errors, on the assumption that they + are probably permanently screwed up. + This interrupt is asynchronous because it can + be caused by a parity error in another job + which destroys data in a page shared with this job. + +%PIPDL PDL overflow [3] (S) + +%PIRLT Real-time timer went off [3] (A) + + These interrupts are controlled by the .REALT + uuo. See ITS UUOS. + +%PIRUN Run-time timer went off [3] (A) + + This interrupt is requested (in advance) + by setting .RTMR. + +%PITRP SYSUUO (System uuo in trap mode) [1] (S) + + A job whose .UTRAP variable was nonzero either + attempted to execute an instruction that trapped + to the system, or was about to be interrupted. + This feature is intended to be used by the superior + to provide a non-ITS environment for the inferior. + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. + +%PITTY Don't have TTY [2] (S) + + This results from an attempt to use the job's + console tty when the job does not own it, if + %TBINT is 1 and %TBWAT is 0. See ITS TTY. + The guilty instruction is aborted, and the PC is + left set according to %OPOPC. + +%PITYI TTY input (obsolete) [3] (A) + +%PIVAL .VALUE instruction executed [1] (S) + +%PIWRO WIRO (Write in read-only page) [2] (S) + + The guilty instruction was aborted, and the PC was + left set according to %OPOPC. The address of read + only location (rounded down to a page boundary on + KA-10's) may be found in .MPVA. diff --git a/sysdoc/COPYING b/sysdoc/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/sysdoc/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/sysdoc/_calls.124 b/sysdoc/_calls.124 new file mode 100644 index 0000000..1df7ead --- /dev/null +++ b/sysdoc/_calls.124 @@ -0,0 +1,5222 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS CALLS: + +This file attempts to maintain up-to-date documentation on all +symbolic ("new") system calls. Those wonderful souls who update the +information in any way (additions, deletions, corrections) should +describe their modifications in a brief note to INFO-ITS@AI so that +interested parties can correct their copies or conceptions without +needing to print or read the entire file again. For example: + + :MAIL INFO-ITS@AI I added more details to the "FOO" call ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + +The format for executing a new system call is: + +CALL: .CALL CALBLK ;the call itself + ;error return is to CALL+1 + ;successful return is to CALL+2 + + + ... + +CALBLK: SETZ ;always + SIXBIT /NAME/ ;where "NAME" is any implemented call + parm1 ;parameters start here + parm2 + + ... + + SETZ parmn ;bit 4.9 (SETZ) => last argument + +A list of all implemented system calls may be seen in +AI:SYSTEM;ITS > starting at SYSCTB:. The actual addresses +within ITS where each call is executed may be found from the +table starting at SYSCTD:. + +There are four types of parameters: + (input) argument + (output) value + (error) error return code + (input) control + +Bits 4.1-4.3 of the parameter word form an "op code" +for that parameter: + + Op Code Meaning Symbol Value + + 0 argument %CLIN 0000 + 1 immediate argument %CLIMM 1000 + 2 value %CLOUT 2000 + 3 error return code %CLERR 3000 + 4 control %CLBTW 4000 + 5 immediate control %CLBIT 5000 + + +The indirect, index, and address fields are used to calculate +an effective address, PDP-10 style. These point to the location +where the argument is or the output is to be placed. For +immediate parameters the address itself is the argument or +control bits. (Some calls update their input arguments. Such +arguments may not be immediate.) + +The order of the input arguments matters; so does the order of +the output values. Other than that, the order is irrelevant. +(As a matter of style, one normally writes them in the order +"control, arguments, values, errors" for clarity. In the descriptions +given here the parameters will always be described in that order.) + +If too many input arguments are present, the excess are ignored, +except that more than 9 arguments will cause error 15. If too +few arguments are present, error 30 occurs. If too many output +values are specified, the extra values will be garbage. If too +few output values are specified, only those specified will +receive information, and any extra output is thrown away. +Specifying more than one error return parameter causes error 15. +Specifying an illegal sixbit name for the call causes error 43. + +If an error return parameter is specified, then if the call +takes the non-skip return an error code will (probably) have +been stored into the error return parameter. It is also +stored into the I/O Status Word of some channel, as before. +If the call fails but no error code is returned, the error +return parameter is zeroed. Note that the error return parameter +is also zeroed if the call succeeds. Also, since this zeroing +takes place when the arguments are first processed, the error +return parameter should not be located on top of any input +arguments. Only one error return parameter is permitted. + +The values of all control bit parameters given are XOR'ed +together, and the result may or may not be used by the system +call. Only the right half of a non-immediate control bit +parameter is significant. Some system calls XOR the left +half of their first argument with the control bits as well. + +FAILURE CODES: Returned by New System CALLs (and .OPEN's, etc.) + +The failure code from a new system call that doesn't skip can be +obtained by reading the .USET variable .BCHN to find the number of +the channel on which the code was returned, and then reading +that channel's .IOS variable (using the .STATUS uuo or +the STATUS symbolic call) to get a word with the error code +in bits 3.6-3.1. + +Alternatively an error return code argument may be specified and the error +code will be stored right-justified (not in bits 3.6-3.1, but bits 1.6-1.1). +To get the corresponding message from the ERR device, use a first file +name of 4 (number, not sixbit) and use the error code as the second file name. + +The error codes which may be returned by each individual call are described +in the documentation for that call. Note that if the call is interpreted +by a job device, any error code may be returned, not just those documented; +job devices should, however, adhere as closely as possible to normal +error code conventions. Errors codes 15, 30, 43, and 44 may be returned by +any symbolic system call, and so are not included under the individual +descriptions. + +The ERR device can be used to get a corresponding message as indicated in +the table on the following page. See the OPEN system call for information +on the ERR device. + +The error codes have symbolic names, which are pre-defined in DDT and +MIDAS. The first two characters in the name are "%E". The remaining +letters usually follow the following conventions. 3rd and 4th letters: +"TM" = "too many", "BD" = "bad or illegal", "TF" = "too few", "RO" = +"read-only", "NA" = "not available", "NS" = "no such", "EX" = "already +exists", "FL" = "full", "NR" = "not ready". 5th and 6th letters: "JB" = +"job", "RG" = "arg", "DV" = "device", "DR" = "directory", "IO" = +"direction", "FL" = "file", "FN" = "file name". + +ERROR CODES: + +Number Symbolic Message +------ -------- ------- +1 %ENSDV NO SUCH DEVICE +2 %ENSIO WRONG DIRECTION +3 %ETMTR TOO MANY TRANSLATIONS +4 %ENSFL FILE NOT FOUND +5 %EFLDR DIRECTORY FULL +6 %EFLDV DEVICE FULL +7 %ENRDV DEVICE NOT READY +10 %ENADV DEVICE NOT AVAILABLE +11 %EBDFN ILLEGAL FILE NAME +12 %ENSMD MODE NOT AVAILABLE +13 %EEXFL FILE ALREADY EXISTS +14 %EBDCH BAD CHANNEL NUMBER +15 %ETMRG TOO MANY ARGUMENTS +16 %ENAPK PACK NOT MOUNTED +17 %ENADR DIRECTORY NOT AVAIL +20 %ENSDR NON-EXISTENT DIRECTORY +21 %ELCDV LOCAL DEVICE ONLY +22 %ESCO SELF-CONTRADICTORY OPEN +23 %ENAFL FILE LOCKED +24 %ETMDR M.F.D. FULL +25 %EMCHN DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +26 %ERODV DEVICE WRITE-LOCKED +27 %ETMLK LINK DEPTH EXCEEDED +30 %ETFRG TOO FEW ARGUMENTS +31 %EROJB CAN'T MODIFY JOB +32 %EROPG CAN'T GET THAT ACCESS TO PAGE +33 %EBDRG MEANINGLESS ARGS +34 %EBDDV WRONG TYPE DEVICE +35 %ENSJB NO SUCH JOB +36 %EBOJ VALID CLEAR OR STORED SET +37 %ENACR NO CORE AVAILABLE +40 %ETOP NOT TOP LEVEL +41 %ENAPP OTHER END OF PIPELINE GONE OR NOT OPEN +42 %ENAJB JOB GONE OR GOING AWAY +43 %ENSCL ILLEGAL SYSTEM CALL NAME +44 %ENSCH CHANNEL NOT OPEN +45 %ENRBF INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +46 %EBDFL UNRECOGNIZABLE FILE +47 %EBDLK LINK TO NON-EXISTENT FILE + +ARGS: Special Common Types of Arguments + + TTY channel # + STY channel # (accesses TTY which is STY's alter ego) + 400000 + TTY # (may be used to examine TTY variables, + but not to alter them or to transact input/output) + + channel # for USR device + channel # for JOB device (means job on other end, + unless argument may also be a , in which + case the job device will interpret things) + channel # for BOJ device (means calling job) + channel # for STY device (means job possessing + the corresponding TTY) + 400000 + job # (user index) + -1 or 777777 specifies self. + 400377 specifies superior. + 400376 specifies the pdp6. + + The symbols %JSELF (777777), %JSNUM (400000), %JSSIX (400376), + and %JSSUP (400377) are pre-defined in MIDAS and DDT. + Various other symbols beginning with %JS are defined + for special codes that can be used instead of a + spec with certain calls; they are documented + under those calls. + + channel # for JOB device + + Many symbolic system calls which take a channel number + as the first argument may be passed to JOB devices + for interpretation by that device. A few act on the device + itself, and are not passed for interpretation. Those + passed for interpretation include: + ACCESS CNSGET CNSSET + DIRSIZ DSKUPD FILBLK + FILLEN FINISH FORCE + JOBCAL JOBGET JOBINT + JOBIOC JOBRET JOBSTS + LISTEN NETAC NETBLK + NETINT RAUTH RHCST + RCPOS RDMPBT RENMWO + RESET RESRDT RFDATE + RFPNTR RSSIZE SAUTH + SCML SCPOS SDMPBT + SETIOC SFDATE SRDATE + SREAPB STLGET STYGET + TTYGET TTYSET TTYVAR + TVWHER WHOLIN WHYINT + + The JOB device may of course interpret such calls in + any way desired, and return any results desired. + It is of course advisable to adhere as closely to + the standard actions of each call as possible. + + Most of the above calls simply pass the symbolic + call name and arguments along to the JOB device. The + following have special interfaces for historical reasons: + + ACCESS RCHST RENMWO + RESET + + The following calls can open up a JOB device if their + sixbit device name argument is not the name of a + device that is built into the system: + + DELETE MLINK OPEN + RENAME + + Those calls which are definitely NOT passed for + interpretation include: + CLOSE + IOT + SIOT + STATUS + RFNAME + IOPUSH + IOPOP + These calls interact with the JOB device in another way. + +A number of these calls include special bits and fields in their +arguments or return values. Several files exist which contain +symbolic definitions of these bits and fields. These files +can be inserted into a MIDAS program with .INSRT. In addition, +most of the symbols are predefined in MIDAS and DDT through +a symbol table in the system. The symbols defined are the same +as used in this documentation. + +The following files exist on the SYSENG directory. + + FSDEFS > Bits in fields used by the file system, + including the format of directories. + ITS BITS Miscellaneous bits and codes. + +The following errors are standard for all calls that take +arguments, and are generally not documented under the individual +calls: + + 14 BAD CHANNEL NUMBER + The argument was not a special negative code, not + 400000+a user number, and not a valid channel number. + 33 MEANINGLESS ARGS + A random number that could not be decoded was given + as a argument. + 34 WRONG TYPE DEVICE + A channel number was specified that did not have open an + appropriate type of device (generally USR, STY, or BOJ). + 35 NO SUCH JOB + 400000+user number was specified, but the user number + did not correspond to a currently-existing job, or + 400377 was given, specifying the superior, but the job + was top-level. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + A STY channel number was specified, but the corresponding + TTY was free and had no associated job. + 42 JOB GONE OR GOING AWAY + The specified job exists but is in process of being killed. + +The following errors are standard for all calls that take arguments: + + 1 NO SUCH DEVICE + 400000+tty number was specified, but there is no tty with the + indicated number. + 14 BAD CHANNEL NUMBER + The argument was not 400000+tty number and was not a valid + channel number. + 34 WRONG TYPE DEVICE + A channel number argument does not refer to a channel open + to a STY or a TTY. + 44 CHANNEL NOT OPEN + The specified channel is not open. + +ACCESS: set file access pointer + + arg 1 Channel number. + arg 2 New access pointer. This pointer is + the number of bytes from the beginning + of the file of the next byte to be + processed. Note that in block mode, + even ASCII block mode, a byte is always + a full word. + + This is useful primarily for DSK and disk-like job devices; + that is, any device which has "files." + + See also the .ACCESS uuo. + +Errors: + + 14 BAD CHANNEL NUMBER + + If the ACCESS pointer is set to more than the number of words in + in the file, an IOC error 2 will occur on the next IOT operation + on that channel. + +ATTACH: attach a job-tree to a console (ITS DETACH) + + cbits 2.9 If there are 2 args, causes the jname + of the job being attached to be changed + to HACTRN, unless there is already a HACTRN. + 1.3 "P" the job by clearing bit 4.4 of .USTP + arg 1 to be attached to the console. + arg 2 Optional: to attach it to. Must be free. + If not present, the executing job must be + top-level and console-controlled; it is logged + out, and its console used as the tty to attach to. + + Attaching a job tree to a tty causes the job tree to be + console-controlled with the specified tty as its console. + The specified job must be either the top-level job of + a disowned job tree, or a direct inferior of the job executing + the ATTACH; in the latter case the specified job is disowned + first. The tty to be attached to must be free. In the + one-argument case the job executing the ATTACH must be the + top-level job of a console-controlled job tree; it is logged + out to make the console free. The one-argument case furthermore + causes the attached job to take on the jname of the job + executing the ATTACH. In the 2-argument case, control bit + 400000 causes the attached job to take on the jname HACTRN, + unless that would cause it to have the same names as an + existing job. + + The one-argument case is made available in DDT via the + command :ATTACH, which attaches the current job to the console. + Also, when a user logs in (say as FOO), DDT checks for the + existence of a job called FOO HACTRO; if it exists, DDT asks: + --ATTACH YOUR DETACHED JOB-- + If at this point the user types a space, DDT executes the + commands "HACTROJ :ATTACH ", thereby attaching the HACTRO to + the console, and changing the HACTRO's name to HACTRN. + This affords a convenient method of recovery from automatic + detachment. + + See the DETACH symbolic system call. + +Errors: + + 10 DEVICE NOT AVAILABLE + This job's tree is not console-controlled (one argument); + the specified tty is not free or does not exist (two arguments). + 14 BAD CHANNEL NUMBER + The first argument is not a valid channel number. + 31 CAN'T MODIFY JOB + The specified job is not disowned or a direct inferior. + 34 WRONG TYPE DEVICE + First argument must be a job. + 35 NO SUCH JOB + First argument specified a non-existent job. + 40 NOT TOP LEVEL + The executing job must be a top-level job (one argument). + +ATTY: pass tty to inferior + + arg 1 + + The tree's console tty is passed to the , which must + be a direct inferior. This is the same as the .ATTY uuo. + +Errors: + +31 CAN'T MODIFY JOB + The specified job is not a direct inferior. + +34 WRONG TYPE DEVICE + The specified job is the pdp-6. + +42 JOB GONE OR GOING AWAY + The specified job is dying. + +CALL: perform system call + + arg 1 Name of symbolic system call to perform. + + The other arguments serve as the arguments to the + specified symbolic call. The values and errors returned by + that call become the values and errors of this call. + This is useful if the name of a symbolic call is to be + determined dynamically. Lisp hackers should think of this + as the "Funcall" system call. + +CHAOSO: open Chaosnet connection + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - receive window size + + First, the two specified channels are closed. Then an index + is assigned to the user and the two channels are set up to + point to it. Two channels are used since in general ITS + channels are unidirectional, and to allow to the user to + handle receive and transmit interrupts differently. + + The created index is placed in the Closed state. To set up + a connection, IOT an RFC or LSN packet down the transmit + channel. + +CHAOSQ: Chaosnet Queue + + arg 1 - address of a 126.-word block (packet buffer) + + This is a special system call for use by the ATSIGN CHAOS + program, which is a daemon program that gets run when + an RFC is received that does not match up against an + existing LSN. + + The first packet on the pending-RFC queue is copied + into the packet buffer, then moved to the end of the + queue (so that the right thing happens when several + RFC's are pending at the same time.) + + The call fails if the pending-RFC queue is empty. + + The program should use the contact name in this + packet to choose a server program to execute. This + server program will then LSN to (presumably) the same + contact name, thus picking up the RFC. + +CLOSE: close input/output channel + + arg 1 Channel number to close. + + The specified input/output channel is closed. + + For TCP connections: + A CLOSE on the output channel will cause an automatic FORCE, + and a FIN segment will be sent to the remote host indicating + "no more data to send". However, the input channel will + remain open, and data can continue to be read from it. + A CLOSE on the input channel will cause any further input received + to be thrown away by ITS. Output can continue to be sent. + Return from this call is immediate; it will not hang. Note that, + like NCP, this does not allow the user to determine + whether the last stuff successfully reached the destination or + not. When this is desirable, a FINISH should be done prior to + the CLOSE. + +For the Chaosnet: + Immediately closes the connection. All buffers and other + information associated with the index are discarded. Normally + the user should first IOT a CLS + packet containing an ascii explanation for why it is + closing. Note that any data previously written on the + connection but not yet received by the other end will be + lost. The system will attempt to send a CLS with reason + "channel closed", but this will only be sent if buffer space + is available. + + See also the .CLOSE uuo. + +CNSGET: get various console parameters (ITS TTY) + + arg 1 or + val 1 Vertical screen size. + val 2 Horizontal screen size. + val 3 TCTYP variable. + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + val 4 TTYCOM variable. + 4.9 Communicate mode. + 4.8 %TCLFT Local feed through (my job sees his typing). + 4.7 %TCRFT Remote feed through (his job sees my typing). + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 4.1 %TCECH The last output to this tty was PI echo. + 3.9 %TCINP Someone waited for input since last home-up. + 3.8 %TCDET Console's tree detached by top level interrupt. + 3.7 %TCDNG Type bell (input buffer full). + 3.6 %TCCBK Reading uname or tty number after ^_K. + 3.5 %TCCBS Reading uname or tty number after ^_S. + 3.4 %TCFPD First part of an output code sequence is done. + 3.3 %TCTPN Type ^_N on leaving comm (unless user types it). + 3.2 %TCPAD 0 => padding necessary on datapoint. + 3.1 %TCHNG Done flag seems to be fried - time out quickly. + 2.9-1.1 -1 if not in comm mode; otherwise number of + next tty in circular list of those in comm mode + together. + val 5 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + val 6 TTYTYP variable. + 4.9 %TTLCL Local tty (i.e. right near the PDP-10). + 4.8 %TT340 Near the 340 or a 340 slave. + 4.7 %TT3HP High priority for grabbing 340. + 4.3 %TTPAR Tty needs a parity bit generated by software. + 4.2 %TTDDI Don't ding bell on excess input. + 4.1 %TTIBM Datel (2741) line. + 3.8-3.5 $TTISP Input speed code: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + 3.4-3.1 $TTOSP Output speed code, as above. + 2.9 %TYDPK Datapoint controller line. + 2.8 %TYSTY Alter ego to a STY. + 2.7 %TYNVA Nova tty (requiescat in pace). + 2.6 %TYMTY Morton controller line. + 2.5 %TYDIL Dial-up line. + 2.4 %TY11T PDP-11 TV tty. + 2.3 %TYDL DL-10 tty. + 2.2 %TYOTY KA-10 console tty. + 2.1 %TYETY DTE-20 tty. + 1.9 %TYNTY TK-10 tty. + 1.8 %TYMDM Dial-up line with modem control. + 1.7 %TYKST KS-10 console tty. + 1.6 %TYDZT DZ-11 tty on a KS-10. + 1.5 %TYRLM ROLM data switch tty. + val 7 TTYSMT variable. + 4.9-4.7 %TQMCH Machine type + 0 = nothing special 1 = PDP11 2 = PDS4 + 3 = PDS1 + 4.6-4.2 %TQHGT Character height in dots + 4.1-3.7 %TQWID Character width in dots + 3.6 %TQVIR Terminal implements virtual coordinates + 3.5 %TQBNK Terminal implements blinking + 3.4 %TQXOR Terminal implements XOR mode + 3.3 %TQREC Terminal implements rectangle commands + 3.2 %TQSET Terminal implements multiple object sets + 3.1 %TQGRF Terminal understands graphics protocol + 2.9 %TRGIN Terminal has graphic imput + 2.8 %TRGHC Terminal has graphic hardcopy + 2.7 %TRLED Terminal has local editing protocol + 2.6 %TRSCN Terminal implements raster commands + 2.5-2.3 %TRLSV <>0 means terminal supports 4**N saved lines + 2.2-1.7 %TRTIM signed offset from GMT minus 20 or zero if + terminal's timezone is unknowable. + + See also the CNSSET, TTYGET, and TTYSET symbolic system calls. + +CNSSET: set various console parameters (ITS TTY) + + arg 1 or + arg 2 Vertical screen size (negative => no change). + arg 3 Horizontal screen size (negative => no change). + arg 4 TCTYP variable (negative => no change). + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + arg 5 TTYCOM variable. + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 3.9 %TCINP Someone waited for input since last home-up. + The remaining bits, documented under CNSGET, may not be changed. + arg 6 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling. + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + + Omitting an argument also means no change (only works + if all arguments after it are also omitted, of course.) + Not all bits of the variables are settable; those explicitly + not user-settable have been omitted above. If contradictory + bits are supplied, the system will reconcile the conflicts. + See also the CNSGET, TTYGET, and TTYSET symbolic system calls. + +CORBLK: modify blocks of core in page map (ITS CORBLK) + + cbits 2.9 %CBWRT Try to get write access; okay if can't. + 2.8 %CBRED Try to get read access; okay if can't. + 2.7 %CBNDW Try to get write access; fail if can't. + 2.6 %CBPUB Make page public. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + Any job is allowed to get write access to + a public page. + 2.5 %CBPRV Make page private. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + A job can have write access to a private page + only if it is getting the page from itself or + a job it is allowed to write in, and that job + has write access itself. Pages are usually private. + 2.4 %CBNDR Fail if can't get read access + (attempting to share with a non-existent page). + 2.3 %CBCPY Make a copy (disk files only). + 2.2 %CBLOK Lock page in core (don't allow swap out.) + 2.1 %CBULK Unlock page from core. + 1.9 %CBSLO Force page to reside in slowest memory. + This is useful when trying to get + reproduceable run time measurements. + 1.8 %CBUSL Undo the effect of %CBSLO + Bits 2.2-1.8 are not yet implemented. + All zero means delete page from page map. + arg 1 RH and LH are XOR'd with control bits. + arg 2 to put page into (or delete it from). + arg 3 Page number within job specified by arg 2. + If LH negative, block mode operation: + After doing operation, increment arg 5 if any, + AOBJN arg 3, write args back into user core, + and repeat the operation, until LH of arg 3 + becomes positive. + arg 4 Any one of the following: + to get page from. + Disk channel number. + When disk file pages are inserted, + the access pointer is left pointing + after the last word of the last page + inserted. + If the pages so inserted are inserted + with write access for modification, + the DSKUPD symbolic system call may + be used to set the creation and + reference dates for the file. + PDP-6 channel number. + One of the following special negative codes. + Only the right-half matters. + -2 %JSTVB means video buffer pages. + Pages 0-7 are video buffer. + First word of page 10 contains + console register and ALU. + See the .TVCREG user variable, + and the VIDBUF and VIDSW symbolic + system calls. + -5 %JSNEW get a fresh page. A new page, not + shared with any other, will be created. + The system tries to zero it out, but + currently may fail to if there is already + a page at the destination address. If + wasn't very difficult to fix, I'd fix it + instead of documenting it. + -6 %JSABS an absolute page. Arg 5 specifies the + desired page of physical memory. You are + not permitted write access to such a page. + 400000 specifies the system job (job # 0). Sharing + a page with the system job is almost like + getting an absolute page via %JSABS, since + the system job's address space mostly + corresponds to physical memory. + 400001 specifies the core job. For historical + reasons, this is taken to mean get a fresh + page instead. This special case will go + away some day, so use %JSNEW instead. + If arg 4 is omitted, it is the same as arg 2. + arg 5 Page number within source specified by arg 4. + Arg 5 is ignored for fresh page. + If omitted, same as arg 3 if source is a job. + If source is a disk file, the current access + pointer rounded down to a page boundary + is the default. + +Errors: + + 10 DEVICE NOT AVAILABLE + PDP-11 TV not available for mapping. + 14 BAD CHANNEL NUMBER + Argument 2 or 4 is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 2. + 32 CAN'T GET THAT ACCESS TO PAGE + Can't satisfy access requested by cbits 2.7-2.4. + This usually means that the page does not exist in the + source specified in argument 4, or that it exists but + write access is not permissible. It may also mean that + an absolute page which normally exists is currently down. + 33 MEANINGLESS ARGS + Page number outside range 0-377 for another job's page, + or outside 0-10 for a video buffer page, + or outside 0-17 for a PDP-6 page. + The allowed range for absolute pages depends on the machine. + 34 WRONG TYPE DEVICE + Can't map pages from any device other than those listed above. + 35 NO SUCH JOB + Argument 2 or 4 specified a non-existent job. + 37 NO CORE AVAILABLE + Tried to get fresh page, but no more (virtual) core is available. + The total number of distinct pages in the system is limited + by the size of the MMP table. + +CORTYP: determine type info from page map (ITS CORBLK) + +If one argument: + arg 1 Page number within current job. +If two arguments: + arg 1 + arg 2 Page number within specified job. + val 1 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page is readable (exists). + 4.6 %CBPUB Page is public (writable by anyone) + 4.2 %CBLOK page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + For non-existent page, whole word is zero. + Thus, this value is: + zero => no page. + positive => read-only page, + negative => writable page. + val 2 0 Absolute page. + -1 Unshared page. + other User index of next job in circular + list of jobs sharing the page. + val 3 For val 2 = 0, absolute page number. + For val 2 = -1, zero. + Otherwise, page number within job specified + by val 2. + val 4 4.9 Page is in core. + 2.9-1.1 Number of times page is shared (zero + for absolute or non-existent page, + else >=1 ). + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + Page number was outside range 0-377. + 34 WRONG TYPE DEVICE + Channel not open on USR, BOJ, JOB, or STY device. + 35 NO SUCH JOB + +DELETE: delete a file + + Either + arg 1 Byte pointer to ASCIZ filename string, + or aobjn pointer to block of such byte pointers. + + or + arg 1 Left-justified device name, in SIXBIT. + arg 2 File name 1 in SIXBIT. + arg 3 File name 2 in SIXBIT. + arg 4 Sname in SIXBIT. + + The file specified either by the four SIXBIT names or by the + ASCIZ string(s) is deleted. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + +DELEWO: Delete file While Open. + + arg 1 Channel number. + + The file open on the channel is marked for deletion. + It is actually deleted as soon as all channels referencing + it (including the one used by the DELEWO) are closed. + In the meantime, it is inaccessible (starred in the directory). + Either an input channel or an output channel can be used. + +Errors: + + 34 WRONG TYPE DEVICE + This call works only on DSK, and such job devices as simulate DSK. + +DEMSIG: demon signal + + arg 1 Sixbit name of demon to signal. + arg 2 Optional: + zero => signal once only. + positive => signal repeatedly every 2*n minutes. + negative => load demon but do not signal. + + A demon is a program which runs (and perhaps even exists) + only when a request has been signaled for it. If the + demon with the specified demon is not currently running, + the system job creates a demon job and loads it from the + file SYS:ATSIGN , where is the name of the + demon. + When the demon runs, it can acknowledge receipt of one + or more signals by using the .DEMON uuo (q.v.). + The status of a demon can be examined and altered by + using the RDDMST and STDMST symbolic system calls. + When the system is started up, there is a once-only + signal for the DEMSTR demon pending; this demon normally + signals requests for all other standard systemic demons. + + Demons were much used on the DM machine for various purposes. + Standard demons which are started by the DEMSTR demon include + (as of July 23, 1975): + NAME REPT RATE PURPOSE + TCTYP 0 Set terminal types?? (Doesn't exist on SYS) + UNSPOO 0 Line printer unspooler (TPL). + SURVEY 10. Network survey generator. + LDRDEM 0 Loader demon (obsolete). + BATCHM 0 Old batch monitor (obsolete). + COMSYS 0 Old message demon (obsolete). + NETRJS 0 CCN remote job server demon. + ZONE 0 MUDDLE compile batcher. + MG 0 Maze Guncher - kills games of MAZE + in an obscure way. AV doesn't like them. + COMDMN 0 Communications demon (replaces COMSYS). + BATCHN 0 Batch monitor (replaces BATCHM). + RFC402 0 Message archival demon. + +DETACH: detach a job tree from a console (ITS DETACH) + + arg 1 for any job in the tree to be detached. + If omitted, the tree referred to is that + of the executing job. + cbits 1.1 Leave the detached tree as a non-disowned, + non-console-controlled tree, instead of as + a disowned tree. + 1.2 Use system tree's resource word instead + of disowned resource word. This is to + be used only by legitimate system daemons. + 1.3 "P" the job by clearing bit 4.4 of .USTP + 1.4 if an hour goes by and the detached tree + does not run and is not reowned or attached, + it will be killed automatically by the system. + 1.5 suppress the console-free message that would + otherwise be printed on the tree's console. + The entire job tree which the specified job belongs + to is made to be disowned. If it was controlled by + a console, that console is made free. If the tree is + already disowned, nothing happens, but the DETACH call + skips anyway. If the top level job of the tree has a + jname of HACTRN, the jname is incremented to be HACTRO + and then re-incremented as necessary to make its uname- + jname pair unique. + + DDT provides a command :DETACH which detaches the tree + the DDT itself is in. LOCK provides a DETACH command + for detaching other trees conveniently: + DETACH detaches the tree containing the + job with user index . + DETACH detaches the tree containing + the job named . + + Automatic detachment by the system job: + Fatal interrupts in top-level jobs will cause them to be stopped + and then detached by the system job, which will type the message + TOP LEVEL INTERRUPT, TREE DETACHED + on the console detached from, followed by the normal + console-free message. A message is also printed on the system + console saying which job was detached from which terminal. + + If the PDP-11 controlling the TV consoles crashes, the system + job automatically detaches all job trees controlled by TV + consoles. This allows the user to log back in and re-attach + his job tree when the PDP-11 is restarted. + If the ARPA network crashes (that is, the local network + attachment crashes, or the host which is connected to + the console of a particular console-controlled tree + crashes) the server telnets automatically detach those + job trees whose consoles are no longer connected to anything. + On some ITS machines if a dial-up line is disconnected + the job tree controlled by that line will be automatically + detached. Other ITS machines do not have the hardware to + to detect disconnection. + When a tree is detached because its tty, whether TV, network + connection, or dialup line, has disconnected, then if the + tree is not logged in it will be killed immediately. + + Whenever a tree is detached automatically for any of the + reasons mentioned above, control bit 1.4 is used, so the + tree will go away if it is not touched for an hour. + + See the ATTACH and DISOWN symbolic system calls. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Cannot detach the SYS or CORE jobs, or the PDP-6. + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + +DL10MP: Hack the DL10 (pdp11 interface) + + THIS SYSTEM CALL CAN CRASH THE SYSTEM IF MISUSED. IT SHOULD + NOT BE USED LIGHTLY. + + arg 1 Page number + val 1 AOBJN pointer to DL10 control area + val 2 Pointer to 3 words for pdp11 examine/deposit commands + val 3 Pointer to first free word in DL10 control area + + A read/write, unencached, absolute page is created at the + specified page number in the user's address space. The page + contains the DL10 control area, which can be used to examine, + deposit, or bootload the pdp11. A message is printed on the + system console when this call is used. + +Errors: + +13 FILE ALREADY EXISTS + The page slot specified is already in use. + +33 MEANINGLESS ARGS + The page number is invalid. + +DIRSIZ: read the total size of files in a directory. + + arg 1 The number of a channel open on the DSK device, + or a . The channel should be open to a file + in the directory to be hacked. + + arg 2 (optional) quota + + arg 3 (optional) dsk number,,allocation + + val 1 quota,,total number of disk blocks used by files + this directory + + val 2 dsk number,,allocation (normally 0). + +DISMIS: dismiss an interrupt (ITS INTRUP) + + arg 1 Points to the third of three words which + are the new .DF1, .DF2, and .UPC + variables for use in dismissing the interrupt + (but see the cbits for this call). + If not an immediate argument, it is assumed to + be a pdl pointer which is appropriately + popped three times to get these items. + It is then popped twice more to flush the + two interrupt words pushed by a new-style + vectored interrupt. + If the job has enabled the pdl overflow + interrupt (bit 2.8 of the .MASK user variable) + then it will receive such an interrupt if the + popping by DISMIS causes pdl underflow. + arg 2 If present, overrides the new pc on the + stack specified by arg 1. + arg 3 If present, overrides the new .DF1 on + the stack specified by arg 1. + arg 4 If present, overrides the new .DF2 on + the stack specified by arg 1. Thus if four + arguments are supplied, the first is + effectively ignored, except for popping. + arg 5 If present, is the ,, + for a LOSE that is done, uninterruptably, + after the interrupt has been dismissed. + + cbits The control-bits for this argument specify + extra words to be popped off the pdl pointer + which is the first arg, BEFORE the PC and defer + words are popped. The cbits are ignored if the + first arg is immediate. The intention is that + the cbits will tell DISMIS how to pop exactly + what was pushed when the interrupt happened. The + format of the cbits is the same as that of the LH of + the first word of the interrupt table (for new-style + vectored interrupts) (see ITS INTRUP), which is what + specifies what is to be pushed when an interrupt happens. + It is: + 2.9=1 => throw away three words first thing. Throws away + the debugging info that interrupts can push. + 1.1-1.5 nonzero => it is number of ACs to be popped, + and 1.7-2.1 is the number of the lowest AC to be popped. + The ACs to be popped are BLT'ed out of the stack. + + If four arguments are supplied and the first is + immediate, then the first is totally ignored (except + that the address calculation is performed). + Thus this call is good for dismissing old-style + interrupts as well as new-style (stack oriented) + interrupts. + + Note that if the job is using the feature that interrupts + automatically push some accumulators or some debugging info, + it must explicitly request (with the control bits) that the + same words be popped. DISMIS does NOT vary its function + according to the job's interrupt table, for a given set of args. + + If the interrupt handler wishes to pretend that a class 2 + interrupt had not been enabled, it can dismiss the interrupt + and supply a fifth argument which is like the first argument + to a symbolic LOSE system call. Making the rh of that + argument 1+.LZ will cause DDT to print the + error message appropriate to an unhandled interrupt on that + bit. The lh. of that argument should be the address of + the instruction that caused the interrupt. + + See also the .DISMISS uuo. + +DISOWN: disown an inferior job + + cbits 1.4 Set BUMRTL, saying that if for one hour the + job does not run and is not attached or reowned + it should be gunned down by the system. + 1.3 Perform .USET ,[.SUSTP,,[0]]. + In this way the job is not started until + after being disowned. + 1.2 Use the system resource word instead of + the disowned job resource word for scheduling. + 1.1 Make this job not disowned, but rather the + top-level job of a non-disowned, non-console + controlled job tree. This prevents the job + from receiving 1/4'th priority as ordinary + disowned jobs do. + arg 1 A directly inferior . + + Please do not misuse the 1.1 and 1.2 control bits. These are + intended for generally useful "system daemons" only. + + The specified job is caused to be no longer an inferior of + the executing job, and is made to be the top level + job of a disowned job tree. Because of this, the disowned + job will continue to exist even if its erstwhile superior + does not (if, for example, the user logs out). + + Disowning is illegal if the executing job has given control + of its console to the job to be disowned (see .ATTY). + + All channels on which the executing job has open the job being + disowned will be closed in the process of disowning (see the + .CLOSE uuo). If the disowned job has opened the + console, then the channels are not closed, but + are marked as "disowned tty"; certain operations + on such a channel will succeed, and others will hang + until the job is re-owned and a console tty given + to the job. Such channels appear to be open on + tty number %TINON=77 octal. + A disowned job is distinguished by the fact that + bit 4.9 of its .APRC user variable is set. + A disowned job never succeeds in executing the RELOAD symbolic + system call, even if it is the top level job in its tree. + When a job tree is logged out, any micro-tapes assigned + to the uname of that job tree are de-assigned (see the + .ASSIGN and .DESIGN uuo's), but only if the job tree is + not disowned. + All disowned jobs share a resource word for purposes of + scheduling, in the same way that all jobs in a single + non-disowned tree share a resource word. Thus all disowned + jobs tend collectively to use no more runtime than any + single non-disowned job tree. + Furthermore, individual disowned jobs are given only 1/4 + the priority to run as a non-disowned job. This does + not apply, however, if the disowned job in question has + .MASTER mode, or controls the 340 display, the E&S display, + the vidisector, the arm, the LPT (line printer), or the + PLT (plotter). + When operating under heavy loads, the swapper prefers to + swap out disowned jobs rather than non-disowned jobs. + + The DETACH symbolic system call makes a non-disowned tree + disowned. See also the %OPDET bit of the .OPTION user + variable. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job must be a direct inferior. + +DSKUPD: disk update + + arg 1 Disk channel number or + + The creation and reference dates for the disk file + open on the channel are set to the current date and time. + The dump check bit is cleared (! will show in the + directory). + This is useful for programs which modify a file by + mapping pages of the file into their page maps with write + access, and which want to indicate this fact by setting + the creation and reference dates. See the CORBLK symbolic + system call for mapping pages of disk files. + + See also the FILBLK, RESRDT, RFDATE, and RQDATE + symbolic system calls. + +Errors: + + 34 WRONG TYPE DEVICE + The supplied channel number must be a disk or JOB device channel. + +ECHOIN: echo characters and store them in a buffer, until a break character + + arg 1 TTY channel number + arg 2 Byte pointer to buffer + arg 3 Number of characters left in buffer + arg 4 Address of break table + arg 5 Address of TECO buffer block (or zero) + + The second and third arguments are counted out as characters + are stored. When the call returns due to a break character, the + count will still be greater than zero. + + ECHOIN tells the system to echo characters and insert them in + the buffer specified by the second and third arguments without + requiring the user program to be executed. This is more + efficient and gets visibly faster response time. Echoing + stops when either the count is exhausted or a break character + is input. When this happens, the ECHOIN returns. If it returns + because of a break character, then the break character + is available for normal input. Non-break characters following + the break character are not handled. + + Break characters are specified by the break table, + a four-word block pointed to by the fourth argument. Each of + the four words says, for 32 characters, whether they break + or not. In the first word, the sign bit is for SAIL code 0, + and bit 1.5 is for SAIL code 37. The sign bit of the second + word is for Space, and bit 1.5 is for ?. And so on. + Characters with Control or Meta set (including ASCII control + characters on non-Meta keyboards) are always break characters. + + To prevent timing errors, ECHOIN will return immediately if + there are characters in the input buffer already. + + For use by TECO, ECHOIN can update the block of counters which + TECO uses to remember the extent of the buffer. The fifth + argument should point to this block, the "Buffer block", which + is seven words long. When a character is inserted, the first + two words of the buffer block are not changed, the next four + are incremented, and th next one is decremented. Passing the + buffer block to ECHOIN allows ECHOIN to insert characters + directly into TECO's buffer as an indivisible operation. + Note that the insertion of the characters themselves is still + controlled by the byte pointer and count arguments. + However, in the future this may change; when ECHOIN is made + able to handle operations besides insertion, it will use the + buffer block for updating the buffer (which may involve deletion) + but will still insert all characters it processes down the byte + pointer. This way, TECO will have both an updated buffer and + a list of the commands which the user typed. + +FILBLK: get contents of file parameter block + + arg 1 Disk channel number or + val 1 First file name. + val 2 Second file name. + val 3 Random information: + 4.9 Dump check bit. + 4.7-3.7 Word count of last block. + 3.6 Has been deleted from an + unmounted pack. + 3.5 Delete the file when closed. + 3.4 GC mark bit. + 3.3 Open for writing. + 3.2 The grim file reaper should not reap this file. + 3.1 This is a link, not a file. + 2.9-2.5 Pack number. + 2.4-1.1 Pointer to internal UFD descriptor. + val 4 File creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + val 5 File reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.1-2.9 Author, as M.F.D. index. + 1.1-1.9 File byte size and bit count in compressed form. + + See also the DSKUPD, RESRDT, RFDATE, RQDATE, SFDATE, + and SRDATE symbolic system calls. + +FILLEN: get file length + + arg 1 Disk channel number or + val 1 File length in bytes of the size + the channel is open in. + val 2 The size of those bytes. + val 3 File length in bytes of the size used to + write it (actually, the size in use the + last time it was opened for writing). + val 4 The size of those bytes. + + The length of the file open on the specified channel + is returned. + + +Errors: + + 34 WRONG TYPE DEVICE + Currently FILLEN works only for disk files and job devices. + +FINISH: wait for output to reach the device + + arg 1: channel # + + Does a FORCE (see below) then waits until all buffered + output has reached the device. + + The following devices currently support FINISH. + + TTY: STY: DSK: NET: CHA: TCP: + + TCP: Does a FORCE (ensures that data is PUSH'd out) and + waits until all data thus far has been ACK'd, i.e. acknowledged + by the foreign host. + + Chaosnet: (channels opened with CHAOSO) + On an output channel, does FORCE and then waits until + there are no queued output buffers. I.e., waits for + all output to be received and acknowledged by the foreign + host. This in fact waits for acknowledge, not just receipt. + +Errors: +* Any errors which the FORCE call might encounter. + +FLAP: flap a micro-tape + + arg 1 Micro-tape number (typically 1-4). + + The directory for the micro-tape is written back onto + the tape if it is currently in core; the tape is then + physically dismounted by running the tape back onto + the original reel (thereby making the tape go flap, flap, + flap ...). Micro-tapes should not be manually dismounted, + for this will cause the directories to get out of phase, + messing up the dismounted tape and also the next one to + use the drive. The FLAP will fail if any files are still + open on the specified drive, or if any one else has the + drive assigned to him. + See also the .UDISMT uuo. + +FLUSH: wait for output to reach the device + + arg 1: channel # + + This call has been renamed to FINISH (in ITS 1052). + The old name will be kept around for a while, but new + programs should not use it. + +FORCE: empty out device's output buffers + + arg 1 - channel # + + If any output is buffered for the device, it is now sent + to the device. Note that this is not needed for the TTY + device since output is always sent as soon as possible. + + It is not necessary to do a FORCE before doing CLOSE. + + The following devices currently support FORCE: + + NET: Causes output to be sent as soon as possible; + otherwise it would only be sent when the buffer + was full or when 2 seconds have elapsed since + output was first put in the buffer. + + TCP: Same as NET, except that the PUSH flag is set + in outgoing segments. If there is no buffered data, + nothing is sent. (Note that ITS TCP always sets PUSH + in all outgoing segments whether FORCEd or not. + Otherwise, a FORCE with an empty buffer would require ITS + to re-send old data with PUSH set in order to nudge the + remote site into action.) + + DSK: Causes the current output buffer and the directory + to be written to disk. + + Chaosnet: (channels opened with CHAOSO) + If there is a partially-filled output packet (created by IOT + or SIOT), it is transmitted. + + The following devices ignore FORCE (it always skip returns) + because they don't need it: + + TTY: STY: LPT: PLT: PTP: COD: + +Errors: + 2 WRONG DIRECTION + TCP: Channel is not an output channel. + 7 DEVICE NOT READY + TCP: Connection not open for writing. +34 WRONG TYPE DEVICE + The device is not an output device, or does not have + the kind of buffered up output which needs this call. + +IOPOP: pop input/output channel + + arg 1 Channel number + + The top entry on the job's IO pdl is popped into the + specified channel. Entries on the IO pdl are made + only by pushing channels with IOPUSH. If a channel + is pushed with IOPUSH and then popped into with IOPOP, + it is in exactly the same state as it would have been + if left untouched; however, the channel is available + for other use in the meantime. + +IOPUSH: push input/output channel + + arg 1 Channel number + + The contents of the specified channel are pushed onto + the job's IO pdl, and the channel is put into a + "closed" state. If the channel had been open, the + open file is not closed, but is instead now open on + the IO pdl slot instead of on the channel. It is + not accessible to the job for IOT'ing, etc., while + there, but it can be popped back into a channel with + IOPOP and then will be available for IO. + + +IOT: input/output transfer + + cbits Per-IOT mode bits. Device dependent. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Location for input/output transfer. + May not be immediate. + For unit mode, this is the word to + output from or read into. + For block mode this is an AOBJN + pointer to a buffer. + arg 3 (Optional) device-independent special mode bits. + These are not currently used. + + For ease of use, in unit input mode arg 2 and arg 3 + may be omitted and val 1 will then be the word read. + +For TTY and Tnn devices (terminals in general), + the following control bits are effective for IOT. + They are XOR'd into the left half of the I/O channel + word both before and after the IOT (see the .IOC user + variable). Thus one can modify the tty's + characteristics temporarily for just one IOT. + (ITS TTY) + Control bits on input: + 2.6 %TIECH Read even if char needs pi echoing + 2.5 %TIPEK Don't remove char from buffer (peek) + 2.3 %TIACT Don't wait for activation char + 2.2 %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + 2.1 %TINWT If no input available, don't wait, but return -1. + 1.9 %TIFUL Use full character set (for Imlacs and TV's). + + Control bits on output: + 2.6 %TJECH Echo mode output. + 2.5 %TJCTN Don't do line continuation. + 2.3 %TJDIS Recognize ^P cursor codes. + 2.2 %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 %TJMOR Do not do **MORE** processing. + 1.9 %TJPP2 Output in the echo area if it exists. + 1.7 %TJHDE Account for cursor motion due to characters + echoed on a half-duplex tty. +For the Chaosnet (channel opened with CHAOSO): + 1.4 ?? Don't hang. + + This can be used to do unit-mode 8-bit-byte transfers. + Control bit 1.4 means don't-hang, and applies to both input + and output. Only data packets with opcode 200 will be + transferred. Anything else on input causes the transfer + to stop, like an end-of-file. Use PKTIOT to find out what + the story is. (The correct way is to verify that there are + some packets in the input buffer, then do a (S)IOT, and if it + transfers 0 bytes then the first packet in the input buffer + must not be a data packet, so PKTIOT it in.) + + There can be input available to (S)IOT even when the state is + not %CSOPN (e.g. if the input buffer contains data and + a CLS packet.) In this case, you should first (S)IOT (if you + care to pick up the data) then PKTIOT. + + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second argument was immediate. + +IPKIOT: Internet packet (datagram) I/O + + This call is similar to PKTIOT and works for channels + opened on the IPQ device. It should NOT BE USED without + a good understanding of Internet Protocol datagram formats. + This call is still subject to change and thus is not + documented further. Ask KLH if you think you need to use it. + +ITYIC: read tty interrupt character + + arg 1 + val 1 a character + + This call fails to skip if there is no input + interrupt character to be read from the tty. + Otherwise, it returns the next un-ITYIC'ed + input interrupt character. + ITYIC'ing a character does not remove it from + the input buffer - it is still there to be IOT'ed + in its turn, along with the non-interrupt characters. + ITYIC makes it possible for a program to scan input + interrupt characters as they interrupt, without + interfering with the IOT'ing that will take place + later. + +JOBCAL: get info on how job device was called + + arg 1 BOJ channel number or + arg 2 Optional: AOBJN pointer for job call data. + arg 3 Optional: sixbit device name for PEEK and who-lines. + val 1 "opcode" for requested operation. + + See ITS JOB for information on job devices. + + This call is to be executed by a JOB device when it + receives an interrupt on its BOJ channel. It returns + data describing the operation desired by the calling job. + Note that the second argument is an AOBJN pointer + to an area in which the call will place data, not get it! + + The third argument, if present, is a device name to be used + by PEEK and who-lines for printing things like ARCBO. + (This name is initialized to the device name returned as word + 4 by OPEN - see below. The unknown-device handler, if involved + in the process (see the OPEN symbolic system call), resets + this to the second file name of the JOBDEV file it actually + succeeded in loading (this name may have had digits stripped off).) + + The "opcode" describes the operation to be performed: + 4.9-4.7 Open mode, if 2.9-1.1 contains 0. + 4.6 Close + 4.5 Close (both bits always the same) + 4.1 SIOT rather than IOT + 3.8 pclsred call restarting + 2.9-1.1 0 .OPEN + 1 .IOT + 2 MLINK (make a link) + 3 .RESET + 4 .RCHST + 5 .ACCESS + 6 .FDELE (delete or rename) + 7 .FDELE (rename while open) + 8 .CALL + + The second argument should point to a block of 12 + words (0-11) in which the following data are deposited: + + OPEN + wd 1 First file name. + wd 2 Second file name. + wd 3 Directory name. + wd 4 Device name. + wd 5 Full 18.-bit open mode in right half. + wd 7 BP or AOBJN ptr specifying filename, if + the SOPEN call was used to do the open. + Zero otherwise. + + IOT + wd 0 For block IOTs, the loser's IOT + pointer. The left half contains the + negative of the desired number of words. + For SIOTs, the byte count. 1 for unit IOTs. + + ACCESS + wd 0 The address within the file to access. + The beginning of the file is 0. + + MLINK + wd 0 Linked-to FN1. + wd 1 FN1 of the link. + wd 2 FN2 of the link. + wd 3 Directory name of the link. + wd 4 Device name of the link. + wd 5 Linked-to FN2. + wd 6 Linked-to directory. + wd 7 BP or AOBJN ptr specifying name of link, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to link to, + or 0 if the name was specified as SIXBIT. + (note links from one device to another don't exist). + + FDELE (rename or delete) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 1 Old first file name. + wd 2 Old second file name. + wd 3 Name of directory. + wd 4 Name of device. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 7 BP or AOBJN ptr specifying file to act on, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + FDELE (rename while open) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + CALL + wd 0 Name of operation in sixbit. + wd 1 Control bits for the call. + wd 2 Number of following words. + wds 3-n Input arguments to call. The first + will almost always be a channel number. + Values may be returned via the + JOBRET symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number or + a JOB device channel number. + +JOBGET: get job device information + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBCAL + symbolic system call. + + arg 1 BOJ channel number or + + The individual returned values are identical to + the words returned by JOBCAL in the area specified + by JOBCAL's second argument. + +JOBINT: cause caller of JOB device to get an interrupt + + arg 1 BOJ channel number or + + See ITS JOB for information on job devices. + + This is used by JOB devices to cause the calling job + to receive a word 2 interrupt for the channel it has + the JOB device open on. See also the SETIOC + symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number + or a JOB device channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBIOC: set input/output channel error + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + open on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBRET: return values to loser and let him continue + + arg 1 BOJ channel number or + arg 2 LH contains error code, or 0 if none. + RH contains amount for loser to skip. + arg 3 Optional AOBJN pointer to a block + of values to be returned to the loser. + + See ITS JOB for information on job devices. + + This call is used by JOB devices to cause the + calling job to continue after an input/output request. + The second argument specifies an error code in its LH; + if non-zero it is placed in bits 3.6-3.1 of the .IOS + word for the JOB device (see the STATUS symbolic + system call). The RH contains the amount by which + the loser should skip upon continuing if he used a .CALL; + this amount is usually 0 or 1. The third argument is + an AOBJN pointer to a block of values which are + passed back to the .CALL or to the .RCHST. + +Errors: + + 34 WRONG TYPE DEVICE + First argument must be a BOJ channel number + or a JOB device channel number. + 36 VALID CLEAR OR STORED SET + +JOBREU: Lets a JOB device handler offer itself for re-use + + arg 1 Device name that the handler can handle + arg 2 FN1 of file the handler was loaded from + arg 3 FN2 of file the handler was loaded from + arg 4 SNAME of file the handler was loaded from + (Note: the only device it could have been + loaded from is DSK). + arg 5 Amount of time to wait (for someone to try + to re-use us) before giving up and taking the + failure return, in 30'ths of a second. + Alternatively, minus the time to wait until + (in 30'ths since the system was started up). + If the argument is positive (a duration) it + is converted to a negative one (time to stop) + and written back. + + Some job device handlers take a considerable amount of + work to initialize themselves - for example, the ML device + must set up network connections to another machine. + Improved performance results if the same handler job + can be used for several OPENs, instead of having to + load a new job and open a new set of network connections + for each one. The JOBREU call makes this possible. + The time to use it is when the handler has completed all + of the business for one operation - it has received a + "CLOSE" from its creator, has tidied up its data bases, + and would otherwise have nothing to do except log out. + Instead, it can do a JOBREU. During the time period + specified in the JOBREU, if any job tries to do an OPEN + on a job device which this handler could be used for, + this handler job will in fact be used. In this case, + the JOBREU will skip return. The handler should then + act as if it had just been loaded, and do the "initial + JOBGET". If nobody tries to reuse the handler in the + specified time period, the JOBREU will return without + skipping, and the handler should log out. + + Note that one should not do a JOBREU immediately upon + receiving a close when the JOBRET of the initial OPEN + has failed, because the creator has pclsred and is + likely to be coming back. In order to make it use the + same job device when it comes back, JOBREU should not + be done; instead, a PCLSRed JOB device open automatically + finds the right job and sends another request to it. + You should time out and if this second request does not + come in, then give up and do a CLOSE and a JOBREU. + + There are two kinds of OPENs that can invoke the JOB device: + 1) An open of JOB: explicitly. It can reuse a + job device handler if match the FN1, FN2, + and SNAME specified in the JOBREU. + 2) An open of a device name (such as ARC) that is not + built into the system. Such an open can reuse a job + device handler if the device name matches the one + specified in the JOBREU. + + +Errors: + + 10 DEVICE NOT AVAILABLE + This job isn't a JOB-device handler. + 13 FILE ALREADY EXISTS + This job device handler is already (still) in use + by a creator. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + Nobody tried to reuse this job, and the time period ran out. + +JOBSTS: set JOB device status + + arg 1 BOJ channel number or + arg 2 New JOB device status - stored in the RH of + the job channel's .IOS word, where .STATUS + on the job channel will find it. + This may be arbitrary, of course, but the + standard bits are as follows: + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + For a job device this should be 22, + unless you really know what you are + doing. + If omitted, 000022 is used. + arg 3 Sets the "device name" of this channel. + The device name is used by the RFNAME + and RCHST system calls, and by PEEK + and who-lines, to say what device a job + is transferring to or waiting for in the + job's status. The argument is optional. + arg 4 Sets the "file name 1". Optional. + arg 5 Sets the "file name 2". Optional. + arg 6 Sets the "system name". Optional. + arg 7 Sets the "open mode" that will be returned + by the RFNAME system call. Optional. + arg 8 Optional byte pointer to ASCIZ string in device handler's + address space containing full filenames. The byte pointer + my not be indexed or indirect. Note that ITS might decide + to read a string from this byte pointer at any time, so the + string must continue to exist even after the JOBSTS call + has returned. + + When the channel is first opened the device, file + name 1, file name 2, system name, and open mode + are set to the ones by which the channel was opened. + JOB device programs may change these if they wish, + but are not required to. + + See the STATUS symbolic system call, the .STATUS uuo, + and the RFNAME system call. + + See ITS JOB for information on job devices. + +KLPERF: Use KL10 performance analysis counter + + arg 1 whose performance is to be measured + -3 (%JSNUL) => the null job + -4 (%JSALL) => all jobs + 0,,-3 and 0,,-4 are also acceptable. + arg 2 Performance Analysis Enables word + 0 => turn off the performance counter + and make it available for other users. + See DEC drawing M8538-0-MTR4 for the bits in this + argument. + val 1 Previous setting; -3, -4, or a job number + val 2 Previous Performance Analysis Enables word + val 3 High-order word of the time base + val 4 Low-order word of the time base + val 5 High-order word of the performance counter + val 6 Low-order word of the performance counter + + If no arguments are supplied, the state of the counter + is not changed and the six values are returned. + + If arguments are supplied, the performance analysis counter + is siezed so no other users can interfere and performance + measurement begins. When the specified job is running + and the conditions specified in the Enables word are met, + the performance counter counts. A bit in the Enables + word controls whether it counts the duration, in microseconds, + that the conditions were satisfied, or the number of times + that the conditions became satisfied. While the specified + job is running, the time base counts microseconds. If -4 + (all jobs) was specified, this is the elapsed real time. + Issuing the KLPERF call again allows the results to be + determined by subtracting the values obtained the first time + from the values obtained the second time. + + The two counters are double-precision numbers. The high-order + 35 bits are in bits 1.1-4.8 of the high-order word, and + the low-order 23 bits are in bits 2.4-4.8 of the low-order + word. + +Errors: + + 10 DEVICE NOT AVAILABLE + Someone else is using the performance analysis counter. + 14 BAD CHANNEL NUMBER + Argument 1 is invalid. + 35 NO SUCH JOB + Argument 1 specified a non-existent job. + +LISTEN: listen for any typed-ahead input (ITS TTY) + + arg 1 (but not a STY channel) or + val 1 Number of typed-ahead characters pending. + + Waits for output buffer to empty before listening. + To check for input without waiting for output use + .STATUS. The uuo .LISTEN is the same as LISTEN, + but applies only to the job's console, and furthermore + returns zero if the job doesn't possess the tty. + +Errors: + + 14 BAD CHANNEL NUMBER + +LNKEDP: find out whether open file was reached via a link + + arg 1 Channel number of open disk file + val 1 Nonzero if file was reached via a link. + + The file open was reached through a link if the names + actually specified in the OPEN were the names of a link + which pointed at this file. It is not a question of + what file is open, but of what names were specified to + open the file. + +Errors: + +14 BAD CHANNEL NUMBER + Arg 1 is not between 0 and 17. +34 WRONG TYPE DEVICE + Arg 1 does not specify a disk channel. + +LOAD: load file (a program) into a job + + arg 1 + arg 2 Disk channel number (freshly opened for reading). + arg 3 Optional argument which causes part of the file + to be ignored: either ,,, to load + only between addresses and (inclusive), + or zero meaning load only pure pages. + The default is 0,,-1 normally, 20,,-1 when loading + oneself, and 20,,37777 when loading the PDP6. + When loading a PDUMP format file, and + are rounded outward to page boundaries. + + The file open on the input channel is loaded into + the specified job. The file may be in one of two formats: + PDUMP format, or SBLK format. The former is produced by + the PDUMP symbolic system call, under which its format + is documented. The latter is described below. + The two formats are distinguished by the + fact that a PDUMP format file begins with a zero word, + but an SBLK format file begins with a non-zero word. + + SBLK format: + First off, any words in the file are ignored until a word + 254000,,1 (JRST 1) is found. This should be followed + by zero or more blocks of the following form: + wd 0 -,, + wds 1-n data words + wd n+1 checksum + That is, the first word is an AOBJN pointer describing where + to load consecutive words of data into the job; this is + effectively used as a block .IOT pointer to load the words. + Following the data is a checksum, which is ignored. + (Historically, when microtapes were used, the checksum was + necessary for error checking.) + Following the last block must be a non-negative word + to denote the fact that there are no more blocks. + This word and all succeeding words in the file are ignored. + (DDT assumes that this word contains the starting + address of the program, and that following words contain + the symbol table for the program.) The disk channel + is left open, with the access pointer pointing to the + positive word which followed the last block. + + The standard form of symbol table is: + -<2*n>,,0 + squoze code,symbol -- these 2 words are + value of symbol -- repeated n times + + The word after the symbol table is another copy of the starting address. + +Errors: + +7 DEVICE NOT READY + A disk read error occurred. +31 CAN'T MODIFY JOB + The calling job may not write into the job being loaded. +32 CAN'T GET THAT ACCESS TO PAGE + You tried to create an absolute page pointing to memory + that the system doesn't have. +34 WRONG TYPE DEVICE + Arg 2 does not specify a disk read channel, or + you tried to load a PDUMP file into the PDP-6. +37 NO CORE AVAILABLE + The MMP was full so a needed page could not be created. +46 UNRECOGNIZABLE FILE + The file open on the specified channel is not in + valid SBLK format, nor in valid PDUMP format. + +LOGIN: log in a job tree + + arg 1 Sixbit name to log in under. + " " (0) and "___xxx" (-1 in left half) are illegal. + arg 2 Sixbit name of "terminal." This is not required + for hard-wired terminals. When this field specifies + a network host, the standard form is HSTnnn, where + nnn is the octal host number, however often the English + name of the host, abbreviated to six letters, is used. + arg 3 Sixbit XUNAME. This is normally the same as arg 1 + except that if arg 1 is changed to make it unique, + this should not be changed. The XUNAME is what is + used for accounting purposes. + + The uname for the job tree is changed from "___nnn" + (where "nnn" is the top-level job's user index in + sixbit octal characters), which is the initial uname of + a non-logged-in job tree, to the specified sixbit name. + If the job tree already has a uname other than "___nnn", + the LOGIN fails. Only top-level jobs with no direct + inferiors may LOGIN. + +Errors: + + 11 ILLEGAL FILE NAME + Cannot log in as "___xxx" or " ". + 12 MODE NOT AVAILABLE + Jobs with direct inferiors may not log in. + 13 FILE ALREADY EXISTS + Someone is already logged in under the specified name. + 31 CAN'T MODIFY JOB + Already logged in. + 40 NOT TOP LEVEL + Only top-level jobs may log in. + +LOGOUT: log out a job tree + + No arguments or values (note, however, that at least + one must be present in order to contain the 4.9 bit + terminating the argument list). If the executing + job is the top level job in its job tree, then the + entire job tree is expunged from the system. + Does not skip if not a top level job. This is not + considered an error, however; no error code is returned. + See also the .LOGOUT uuo. + +LOSE: report lossage + + arg 1 left half - address of losing instruction + right half - lossage code (defined by DDT.) + arg 2 new PC. If omitted, the address of the .CALL + minus one is used. + control bits: + 1.1 default arg 2 to the address of the .CALL plus one. + 1.2 do SETZM @.40ADDR, i.e. clear the location + in the job where a UUO returned from the + system would be stored. + 1.3 Really take the left half of arg 1 as the address + of the losing instruction. If this control bit + is not specified, the new PC is used instead. + + The job's Program Counter is set to the new PC, + the job's .VAL user variable is set to the address + of the losing instruction,,the lossage code, and the + job is given a %PILOS interrupt. If the job does not + enable this interrupt, and its superior is DDT, a + helpful error message will be printed. + + The LOSE symbolic system call is a more general version + of the .LOSE UUO. .LOSE is simpler, and usually good + enough. Symbolic LOSE is for situations where sophisticated + error reporting is needed. Symbolic LOSE allows the new PC + value to be specified explicitly, and therefore is suitable + for use inside an error-handling subroutine. In addition, + the address of the "culpable" instruction can be specified + independantly from the address to restart at. Thus, the + program can provide more complicated error recovery + than simply restarting at the losing instruction. + + The lossage codes are defined by DDT's interpretation of them. + The defined values are: + + %LSSYS==1000 The last error code returned by a failing + system call describes the problem. + + %LSFIL==1400 The last error code returned by a failing + system call, together with the name of the file + it was operating on, describe the problem. + The "culpable instruction" address should point + at the failing system call. + DDT will decode it to determine the filenames + (if it is an OPEN) or the channel number and then + the filenames via an RFNAME. + + %LSSYS+errcode Means that the system call error code + describes the problem. + + %LSFIL+errcode Means that the error code + together with the filenames being used + describe the problem. + + 0 Signifies some other nondescript error condition. + + 1+.LZ + Means that the error should be handled as if it + were a fatal interrupt on the specified interrupt + bit. For example, 1+.LZ %PIMPV will make DDT tell the + user that the job received a fatal MPV interrupt. Why + might a program wish to do this? It might have + enabled its own handling of MPV, and then received an + MPV interrupt at a time when one was not expected and + was not recoverable. At such a time the ideal thing + to do is to report the MPV back to DDT, so that DDT + will handle it - to "pretend" that MPV wasn't enabled + at all. To make the pretense complete, the program's + own MPV interrupt handler should dismiss the + interrupt, and leave the PC pointing at the guilty + instruction, since that would be the state of things + if the program had not handled the interrupt. That + can be done with a special feature of the DISMIS + symbolic system call, which can do a .LOSE after + dismissing the interrupt and restoring the PC. + + This call never gets an error, and never returns. + +MLINK: make link + + Either + arg 1 Byte pointer to ASCIZ string specifying name for link, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying name to link to, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified "from" device. + arg 2 "from" file name 1. + arg 3 "from" file name 2. + arg 4 "from" sname. + arg 5 "to" file name 1. + arg 6 "to" file name 2. + arg 7 "to" sname. + + A link is created on the specified device. + The only standard device which accepts links + is DSK; of course, various job devices (such as + the AI, ML, DM, and MC devices) also implement it. + Links cause an indirection when opened + for reading; writing or deleting a link affects + the link itself. + The "from" file names are subject to file name + translation. See the TRANAD and TRANDL symbolic + system calls. + + See the SOPEN symbolic system call for a description of + how the byte or AOBJN pointer arguments should be formatted + and how the strings are parsed into filenames. + +NETAC: accept network connection OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 - channel # of an Arpanet NCP channel + + If the channel is in the RFC-received state, the + connection is accepted. Use CLOSE to refuse a + request for connection. + + See also the .NETAC UUO. + + This call only works for NCP and is obsolete. It isn't needed + for TCP since incoming requests that satisfy a LISTEN will + automatically be hooked up and the connection opened. + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not an Arpanet NCP channel +41 OTHER END OF PIPELINE GONE OR NOT OPEN + The socket is not in the %NSRFC (request for + connection received) state. + +NETBLK: network block (ITS NCP) + + arg 1 Channel number - should be a network channel. + NCP, TCP, and CHAOS are allowed. + arg 2 Connection state code. + NCP: Socket state as returned in the right + half of word 4 by the .RCHST uuo: + 0 %NSCLS CLS received. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + CHAOS: + TCP: basically the same as NCP. See WHYINT for state list. + arg 3 Optional: address of a word containing an argument + as for the .SLEEP uuo. This word must be writable, + as it will be replaced by an appropriate negative + number as for .SLEEP. + If not supplied, positive infinity (377777,,777777) + is assumed by default for the time to sleep. + val 1 New connection state. + val 2 Time left, in thirtieths of a second. + (Meaningful only if arg 3 supplied.) + + The executing job hangs until one of two conditions + becomes true: either the network conection associated + with the specified channel enters a state different + from the specified state, or the amount of time + specified by arg 3 has passed. + + Example: suppose that a NCP socket is in state 1 + (listening for RFC). This call will return when + the socket is no longer in that state, or after 5 + seconds, whichever comes first: + + MOVEI AC,5*30. ;five seconds + .CALL [ SETZ + SIXBIT \NETBLK\ ;network block + 1000,,CHNUM ;channel number + 1000,,%NSLSN ;old state + ,,AC ;time to sleep + 2000,,NSTATE ;new state + 402000,,TLEFT ] ;time left + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not a network (NCP, TCP, CHAOS) channel. + +NETHST: net host status (ITS NCP) + + arg 1 Host number (-1 for self). + arg 2 Reason for going down (optional, valid + only if arg 1 is -1). + 5 Going down for scheduled P.M. + 6 Going down for scheduled hardware work. + 7 Going down for scheduled software work. + 10 Going down for emergency restart. + 11 Going down because of power outage. + 12 Stopping at software breakpoint. + 13 Going down because of hardware failure. + 14 Going down because not scheduled to be up. + val 2 Host number (useful if arg 1 is -1). + Note THESE ARE OUT OF ORDER (because "val 1" is so long). + val 1 Host status + 4.9 1 => RFNM wait on link 0. + 4.8-4.3 Unused. + 4.2-4.1 Host status: + 0 Down. + 1 RST sent. + 2 Up. + 3.9-3.1 Time (as returned by .RDTIME) modulo 1000 + the last RFNM sent on link 0. + 2.9-1.1 Last message from IMP about "host dead status" + for this host. (See BBN Report #1822, Chapter 3.) + 2.7-1.5 Time host will come back up, Greenwich Mean Time: + 2.7-2.5 Day of week (0=Monday, ..., 6=Sunday). + 2.4-1.9 Hour of day (0-23.). + 1.8-1.5 Five-minute interval within hour (0-11.). + -1 means more than a week. + -2 means time coming back up is unknown. + 1.4-1.1 Reason host is down: + 1 Foreign host not communicating + with network (took ready-line down + without saying why). + 2 Foreign host not communicating with + network (host was tardy in accepting + network traffic without saying why). + 3 Foreign host does not exist, to the + knowledge of the Network Control Center. + 4 The IMP software is preventing + communication with foreign host + (this usually indicates IMP software + initialization at the foreign site). + 5 Foreign host down for scheduled P.M. + 6 Foreign host down for scheduled + hardware work. + 7 Foreign host down for scheduled + software work. + 10 Foreign host down for emergency restart. + 11 Foreign host down because of power outage. + 12 Foreign host stopped at software + breakpoint. + 13 Foreign host down because of hardware + failure. + 14 Foreign host not scheduled to be up. + 17 Foreign host in process of coming up. + + If one argument is supplied, then the host status word + for the specified host is returned. If two arguments are + supplied, then the "reason for going down" word for the + local host is set. (As of June 30, 1975, setting this + word doesn't seem to do anything at all. Didn't the code + for sending this data to the IMP ever get written??) + +NETIMP: network IMP status (ITS NCP) + + If no arguments are present, three values are returned: + val 1 Last message from IMP about going down. + 4.9 IMP really is down now. + 1.2-1.1 Reason: + 0 "Last warning" or "panic restart"; + the IMP is going down in 30. seconds or less. + 1 Scheduled hardware P.M. + 2 Scheduled software reload. + 3 Emergency restart. + val 2 Time going down, as returned by .RDTIME. + val 3 Time coming back up, as returned by .RDTIME. + + If arguments are present, three must be present. + They are used to set three default values which are returned + if the IMP itself has not set the above three values. + Presumably this is good for logically disabling network software? + +Errors: + +30 TOO FEW ARGUMENTS + Must have either 3 arguments or no arguments. + +NETINT: Send network interrupt OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 channel # + + An INR or INS message is sent, depending on the send/receive + gender of the socket specified by the channel #. What this does + depends on the protocol being used and the program at the + other end of the connection. + + This call only works for NCP and is obsolete. +Errors: + +34 WRONG TYPE DEVICE + The channel specified is not an Arpanet NCP channel. + +NETRFC: Get pending Request For Connection for a specified network + + cbits + %NQREF Arg 2 is a previously returned identifier, + refuse connection and flush from queue. + arg 1 - SIXBIT name of network + one of CHAOS, TCP, or ARPNCP (obsolete) + arg 2 - optional network-dependent arg + for CHAOS: pointer to packet buffer + for TCP: If %NQREF set, is ,, of request to + reject (as returned from previous NETRFC call) + val 1 - network-dependent value + for TCP: ,, + for ARPNCP: ,, + + This call is intended for use by very specialized programs + which ITS invokes upon receiving unsolicited requests for + connections. ITS will queue the request for a short time + and start an appropriate job which uses NETRFC to obtain + the request and process it. Currently these programs are + NCP: SYS;ATSIGN NETRFC + TCP: SYS;ATSIGN TCP + CHAOS: SYS;ATSIGN CHAOS + + Normally the program will execute a NETRFC appropriate for its + network, and obtain a returned request value. Accepting the + request is device dependent, but refusal can always be done + by calling NETRFC again with the %NQREF control bit set and + furnishing the appropriate request identifier. + + See the CHAOSQ system call, which NETRFC is replacing. + +ERRORS + 4 - TCP: No pending RFCs, or %NQREF with non-existent ,,. + 12 - CHAOS: can't handle %NQREF yet. + 33 - Unknown network specified. + +OPEN: open a file + + cbits Device dependent. Standard bits are: + 2.7-2.9 0 = normal, 1 = write-over mode. + 1.3 0 = ascii, 1 = image. + 1.2 0 = unit, 1 = block. + 1.1 0 = read, 1 = write. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Left-justified device name. + arg 3 File name 1. + arg 4 File name 2. + arg 5 Sname. If not present, defaults to executing + job's current sname (see the .SNAM user variable). + + See also the .OPEN uuo. + + The file names used for opening are subject to translation. + See the TRANAD and TRANDL symbolic system calls. + + The file names .FILE. (DIR) are special: + they cause the directory for the given device + (and sname, if applicable) to be read. It is + illegal to write the directory. If a device has + no directory, then opening .FILE. (DIR) will + supply the string "NON-DIRECTORY DEVICE", presumably. + (This is a function of the unknown-device handler + (see below) and hence the exact results may vary). + Opening a directory in ascii mode yields an + ascii string for people to look at; opening it + in image mode yields a device-dependent file + (or possibly a MODE NOT AVAILABLE error). + + For the DSK device, the control bits are: + 1.4 %DONRF Don't set the reference date. + 1.5 %DONLK Don't chase links. (I. E., if + this is a link, open the link itself, + not the file at which the link points. + 1.6 %DORWT Readers wait. On output open, makes would-be + readers wait till we close. + 2.7 %DOWOV Write-over mode. Writes on the existing + file of that name, instead of replacing + it with a new file. + + The file names M.F.D. (FILE) when opened for + input yield a master file directory for all + disks. In ascii mode this is an ascii string + containing the names of all directories, separated + by a cr/lf sequence. + + The file names ..NEW. (UDIR) cause a new directory + to be created with the given sname if none already + exists. Creating a directory in this way causes a + message to be printed on the system console. + (A directory is destroyed only when the disks are + salvaged by the stand-alone salvager, which is generally + run just before the time-sharing system is restarted. + A directory is then destroyed iff it contains no files.) + + If < or > is used as a file name, it is treated + specially according to an algorithm no one + understands, but which attempts to let it stand + for the numerically smallest or largest file name + among those in the directory. In particular, + if you call your files FOO nnn, where nnn is a version + number, then reading FOO > will read in the latest + version, writing FOO > will write out a version + one higher than the latest one (or FOO 1 if there + is no file named FOO nnn), and deleting FOO < + will delete the oldest one. Writing FOO < doesn't + recreate an old file; it is the same as FOO >. + If a file with numbers and letters in its name, + for example FOO BAR27, already exists, + writing FOO > will generate FOO BAR28 + and not FOO 1. Letters to the right of numbers are + generally ignored as far as < and > are concerned. + + Note that < and > may be used as first + file names as well; this is mainly useful for the + .LPTR. directory. It is illegal to use < or > for + both file names at once. + + The SYS device ignores the sname, and otherwise + is like using the device-sname pair DSK:SYS; . + Writing new files or altering old ones on the SYS + device (or even on DSK:SYS;) causes a message to + appear on the system console documenting who the + culprit is and what he did. This is because system + programs and other files critical to system operation + are kept on SYS:. In fact this applies to writing + or altering files on any disk directory whose name + begins with the three letters "SYS". Standard + directories whose names begin with "SYS" include: + SYS1 Extension for SYS directory (holds programs). + SYS2 Extension for SYS directory (holds programs). + SYS3 Extension for SYS directory (holds programs). + SYSENG Source files for many system programs. + SYSEN1 Extension for SYSENG directory. + SYSEN2 Extension for SYSENG directory. + SYSBIN Binary files for many system programs. + SYSTEM Files having to do with ITS itself. + SYSDOC Documentation for ITS itself. + SYSNET Files having to do with Chaosnet and TCP. + + The COM device ignores the sname, and otherwise + is like using the device-sname pair DSK:COMMON; . + + The TPL device ignores the sname, and otherwise + is like using the device-sname pair DSK:.LPTR.; . + (On systems without lineprinters the TPL device is + generally just a JOB device.) + On output, it furthermore ignores the file names, + and instead uses the uname of the opening job as + the second file name, and randomly generates a + first file name. The system job prints files + it finds on .LPTR. on the line printer, whenever it + has nothing better to do and the line printer happens + to be free; these files are subsequently deleted. + Thus the TPL device provides a printer spooling facility. + Attempts to rename a file on the TPL device are + ignored, because the name controls the spooling order. + + For the LPT device, opening succeeds only if no one + has the LPT, or the same user already has the LPT; + in the former case the opening job must be in a tree + controlled by a "local" tty as defined by its TTYTYP + variable. In all other cases the OPEN is converted + to use the TPL device instead. + + For the USR device, the file names should be the + uname-jname pair of the job to open. If the uname is + zero, it is equivalent to using the uname of the + job doing the call. If the jname is zero, then the + uname is interpreted as a specification; + in this way one can open a job given its user index. + A jname of PDP6 or PDP10 opens up the PDP-6 + as the "job". (PDP10 as a jname goes back to the + days when the PDP-6 ran ITS and the PDP-10 was the + auxiliary processor!) + Control bits: + 1.4 Insist on opening an already existing job; + i.e. do not create a new one. The job will + be opened as a foreign job, not as an inferior. + Here is an algorithm for deciding whether job Y will + be a direct inferior or merely a foreign job when + opened by job X: + (DEFUN USR-OPEN-RESULT (X Y BIT-1*4) + (COND (BIT-1*4 (COND ((EXISTS Y) 'FOREIGN) + (T (ERROR)))) + ((EXISTS Y) + (COND ((INFERIOR Y X) 'INFERIOR) + ((DISOWNED X) 'FOREIGN) + ((NOT (DISOWNED Y)) 'FOREIGN) + ((TOPLEVEL Y) + (MAKE-NON-DISOWNED Y) + (CHANGE-ALL-UNAMES Y (UNAME X)) + (FIX-UP-TTY-CHANNELS Y) + 'INFERIOR) + (T 'FOREIGN))) + ((= (UNAME X) (UNAME Y)) + (CREATE-USR Y) + (AND (DISOWNED X) + (MAKE-DISOWNED Y)) + 'INFERIOR) + (T (ERROR)))) + + For the ERR device, the first file name must be + numerically 1, 2, 3, or 4. If it is 1, then the .IOS + word specified by the user variable .BCHN is + examined. If it is 2, the .IOS word for the channel + numerically specified by the second file name is + examined. If it is 3, the second file name is itself + the status word. Bits 3.1-4.5 of the specified word + yield a the number of an error message which can then + be read from the open ERR device. If the first file + name is 4, the second file name must be the value + returned into an error code return argument by a symbolic + system .CALL that didn't skip. The corresponding error + message can be read from the open ERR device. + + For TTY and Tnn devices (terminals in general), + some of the control bits set first-time options, + and some are per-channel. Those which are per-channel + are marked below with a *. The standard names for + these bits are also given. (ITS TTY) + Control bits on input: + 2.6 * %TIECH Read even if char needs pi echoing + 2.5 * %TIPEK Don't remove char from buffer (peek) + 2.3 * %TIACT Don't wait for activation char + 2.2 * %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + + 2.1 * %TINWT Do not wait for input. If no input + is available, return -1 in unit mode, or + return a partially filled block in block mode. + 1.9 * %TIFUL Use the full TV character set if possible. + In this mode, characters have this form: + 2.3 %TXTOP Top. + 2.2 Obsolete. Used to be Shift lock. + 2.1 %TXSUP Super. Used to be Shift. + 1.9 %TXMTA Meta. + 1.8 %TXCTL Control. + 1.7-1.1 %TXASC Ascii part of character. + Of course, for non-TV's only %TXASC + will be non-zero. + 1.6 Set up 3 line echo area (like SCML of 3). + 1.4 "DDT" mode. Initially clear the %TGPIE and + %TGMPE bits for carriage return, line feed, + and tab, thus causing them not to echo. + 1.3 Image mode. Initially clear the %TGPIE + and %TGMPE bits for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode, + ^C causes a block mode end of file. + 1.1 0 = input. + Control bits on output: + 2.6 * %TJECH Echo mode output. + 2.5 * %TJCTN Don't do line continuation. + 2.4 * %TJSTP Channel is hung in **MORE**. + Unusual in that the system modifies this bit. + 2.3 * %TJDIS Recognize ^P cursor codes. + 2.2 * %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 * %TJMOR Do not do **MORE** processing. + 1.9 * %TJPP2 Output in the echo area if it exists. + 1.6 Same as 2.2 - turns on %TJSIO. + 1.5 Same as 2.3 - turns on %TJDIS. + 1.4 Turns on %TJECH, %TJPP2, %TJMOR. + 1.3 Image mode. Initially set %TGIMG bits + for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode + output all ^C's are ignored. + 1.1 1 = output. + + For STY device input, control bit 1.4 means that + input IOTs, instead of hanging, will input a -1 in + unit mode or not count out the AOBJN pointer in block + mode (see ITS TTY for details). + For STY output, control bit 1.4 means that output IOTs, + instead of hanging when the tty's input buffer is full, + will cause a ^G to be output, just as on normal ttys. + Control bit 1.5, on input or output, causes a %TDORS + character to be available as input when an output + reset is done on the sty's alter ego. + Control bit 1.3 is copied into the %TOHDX bit of the + associated tty, thus making it half-duplex if set. + These control bits are not per-channel, but rather + will affect all channels open on the same STY. + + For the PTR and PTP devices (paper tape reader and + punch), if the 1.4 control bit is on, then the 1.2 bit + must be 0 and the 1.3 bit is ignored. In this mode + all eight paper tape channels may be read or punched. + + For the NET device, the arguments are as follows: + cbits 2.1-2.6 byte size for image mode + 1.7 Use 8 times as large a buffer. + 1.6 If ascii mode, use 8-bit bytes + instead of 7-bit bytes. + If image mode, use byte size in + bits 2.1-2.6. + 1.5 Open socket in listen mode. + 1.4 0 = use arg 3 as local socket number. + 1 = generate unique local socket number. + (A generated socket number can be examined + after opening by using the .RCHST uuo). + 1.1-1.3 Standard. + arg 1 Channel number. + arg 2 Left-justified device name (i.e. NET). + arg 3 Local socket number. + arg 4 Foreign socket number. + arg 5 Foreign host number. + + For the STK device (Stanford keyboard): + cbits 1.7 If 1.6 = 1 and 1.5 = 0, + then don't input the meta bit. + 1.6 0 = Stanford mode: + meta = 400 + ctrl = 200 + top+shift+others generate 0-177 + 1 = ITS mode: + meta = 200 + ctrl means ctrl, and works + with others to generate 0-177 + 1.5 0 = convert according to 1.6-1.7. + 1 = don't convert characters. + 1.4 Don't hang if no character + available for input - return -1 + instead. + + If the device name used in the OPEN is not one known to + to the system, the "unknown-device handler" is invoked. + The system creates a job device and loads SYS:ATSIGN DEVICE + into it; this program then has the responsibility for + handling the OPEN. The normal action of this program is + to look for a file DSK:DEVICE;JOBDEV , where + is the requested device name. For example, if an attempt + is made to OPEN the FOOBAR device, and the file + DSK:DEVICE;JOBDEV FOOBAR exists, the program contained in + this file will be used to interpret the OPEN via the JOB device. + If such a file does not exist, but the device name has trailing + digits, the unknown-device handler will try stripping successive + trailing digits and retrying. For example, opening the + AR1 device causes the unknown-device handler to look first for + JOBDEV AR1, and then for JOBDEV AR. If the handler succeeds, + it sets device name for PEEK and who-lines to the second + file name that finally succeeded (see the JOBSTS symbolic + system call). + The unknown-device handler also handles requests for the + directories of certain built-in devices whose directories + are seldom asked for. If there is nothing better to return for + a directory, the string "NON-DIRECTORY DEVICE" is returned. + +Errors: + + OPEN can return many errors. The following errors in + particular are relevant to OPEN on the DSK device: + + 4 FILE NOT FOUND + The specified directory exists, but the specified file + does not. + 5 DIRECTORY FULL + There is no room in the directory to create an entry + for the new output file. + 7 DEVICE NOT READY + The disk pack containing the file is offline (should + never really happen). + 10 DEVICE NOT AVAILABLE + a specific unit was selected, by opening DKn, and that + unit is off-line or contains a reserved pack. Or, a + specific pack was selected by opening PKn or Pnn, + and that pack is reserved. The reserved-pack check + only applies when writing. Reserved means secondary-pack, + or reserved for the exclusive use of certain directories. + 11 ILLEGAL FILE NAME + One or both file names were zero; or, for an output file, + the file names were M.F.D. (FILE) or .FILE. (DIR), which + are names reserved for directories. + 12 MODE NOT AVAILABLE + Control bits 2.9-2.7 specified an illegal mode. + 14 BAD CHANNEL NUMBER + This is a RENMWO error. + 16 PACK NOT MOUNTED + The pack specified by opening PKn or Pnn is not + mounted, or the pack containing the file being read + is not mounted. + 20 NON-EXISTENT DIRECTORY + The specified directory does not exist. + 22 SELF-CONTRADICTORY OPEN + Control bits 2.9-2.7 specified an illegal mode. + 23 FILE LOCKED + An attempt to open a file in write-over mode failed + because someone has the file open for reading; or + an attempt to open a file for read, write-over, rename, + or delete failed because someone is writing the file + or because the file has been deleted, but hasn't gone + away yet because someone is reading it (i.e. there is + a star next to it in the directory listing.) wait a while + and try again. + 24 M.F.D. FULL + Cannot create a new directory because the master file directory + is full. + 27 LINK DEPTH EXCEEDED + Links may not be chained to a length of greater than 100 links. + This error probably means a circular chain of links. + 47 LINK TO NON-EXISTENT FILE + Error 4 or 20 occurred after following a link. + +PDUMP: pure dump a job + + arg 1 . + arg 2 Disk output channel number. + Should have been freshly opened + for output. + arg 3 State word; should be 0 initially. + This word is updated as the PDUMP + progresses; a value of 400000,, means + that page is about to be dumped. + + The pages of the specified job are dumped onto + the disk file in a form that can be efficiently + loaded. In particular, information as to whether + each page is read-only or not is saved so that + when the program is run it can be swapped + efficiently. If the same file is loaded into + several jobs, they will all share the same + physical copies of the read-only pages. + In addition, absolute pages are remembered. + A number of 2000-word (1K) blocks are dumped onto + the file. The first block is as follows: + wd 0 Contains zero. This distinguishes + PDUMP'ed programs from, for example, + MIDAS output. + wds 1-400 Word contains information about + block of the dumped job. This + information is as follows: + 4.9 Absolute page (shared with system). + 2.9-2.8 00 Non-existent page. + 01 Read-only page. + 10,11 Read/write page. + 2.2-1.1 If 4.9=1, absolute page number. + wds 401-777 Zero. + wds 1000-1017 The contents of the accumulators. + Note that the accumulators aren't part of + any page, so they wouldn't be saved if it were + not for this special hack. + The following blocks of the file are the successive + pages of the job, but only those which need to be dumped. + That is, absolute and non-existent pages are not dumped. + Thus, suppose the pages of a job are laid out as follows: + pg 0 Read/write. + pg 1-5 Read-only. + pg 6-7 Absolute (e.g., system symbol table). + pg 100 Read/write. + pg 200 Read/write. + others Non-existent. + Then nine blocks would be dumped out: + blk 0 Descriptor block. + blk 1 Page 0. + blk 2-6 Pages 1-5. + blk 7 Page 100 (octal). + blk 10 Page 200 (octal). + This is all that PDUMP writes out, leaving the file's access + pointer at the end of the last block written. At this point + the job doing the PDUMP will normally write out the + symbol table, if any, for the dumped job onto the disk + channel, preceded and followed by JUMPA instructions + containing the starting address. When this is done, + the resulting file can be loaded and run as a program + under DDT. + See the LOAD symbolic system call. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Can't dump the PDP-6 job. + 34 WRONG TYPE DEVICE + First argument was some oddball channel, or + second argument was not a disk output channel number. + 35 NO SUCH JOB + +PGWRIT: Cause page to be written to disk + + arg 1 (Optional) A + arg 2 Virtual page number within that job (a number from 0 to 377). + control bits: + 1.1 1 => don't wait for the page to finish getting written out, + return immediately. Issue the call again with this bit 0 + if you later want to wait for it to get written out. + 1.2 1 => unlock the page. + 0 => if the page is locked, swap it out anyway, but when it + next gets swapped in again it will be locked again. + + If there is only one argument, it is arg 2. The is + assumed to be the job issuing the call. + + The disk copy of the specified page is brought up to date; + if the in-core copy has been modified by the specified + the page is written out. The PGDUMP call does not return until + the disk has finished recording the page. + + This is useful when pages of a file have been mapped into + the user's address space. + + If the page cannot be swapped out because no disk space is available, + or some job that is using it cannot be pclsr'ed, it waits a while + and tries again. It does not return. + + This call used to be called PGDUMP, but the name was + changed to avoid confusion with PDUMP. + +Errors: + + 12 MODE NOT AVAILABLE + Page is absolute or tied down by exec pages. + 14 BAD CHANNEL NUMBER + The argument is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 1. + 32 CAN'T GET THAT ACCESS TO PAGE + The page number in argument 2 is not between 0 and 377; or the + job does not have a page at that position in its address space. + 34 WRONG TYPE DEVICE + The specifies the pdp-6, which does not have paging. + 35 NO SUCH JOB + The argument specified a non-existent job. + +PKTIOT: transfer one Chaosnet packet + arg 1 - channel number + arg 2 - address of a 126.-word block. + + Always transfers exactly one packet. + The format of the 126.-word block is: + 16 16 4 + ----------------------------------------- + | opcode | unused | fc | nbytes | 0 | + ----------------------------------------- + |destination host |destination index| 0 | + ----------------------------------------- + | source host | source index | 0 | + ----------------------------------------- + | packet # | ack packet # | 0 | + ----------------------------------------- + | data1 | data2 ... + + ... data487 | + ----------------------------------------- + + For details of how to use these packets, see the Chaosnet + protocol documentation. + +RAUTH: read a file's author. + + arg 1 Number of a channel open on the DSK device, + or a . + + val 1 Sixbit name of the file's author (the last + person to write on the file.) + +RCHST: read channel status. + Note: This system call is obsolete. Use the RFNAME, + RFPNTR, or WHYINT system call to obtain the + information you want. + + arg 1 channel number + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The channel's access pointer, if it is randomly + accessible; otherwise, -1. + val 6...additional device-dependent results + + The values may not be the same as the filenames, etc. + that were used to open the channel. The results of + this call are quite device-dependent. + in the open-mode returned by RCHST. + + The following devices return the access pointer as -1 + and the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + -1, for value 5. + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 sixbit/DSK/ + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-4 0 + val 5 -1 + + TTY (as a console) + val 1 'TTY,, + + TTY (as a device) + val 1 'Tnm,, + + STY + val 1 'Snm,, + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 Access pointer. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + val 5 Access pointer. May be a byte pointer if character mode. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS and JOBRET symbolic system calls. + Note that the job sets the results for vals 1-4 once + using the JOBSTS call, and only the values 5, 6, ... + are taken from the JOBRET that responds to the RCHST. + + NET + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + val 5 4.9-3.1 Time until IMP goes down, in thirtieths + of a second. + 0 => IMP down. + -1 => IMP doesn't plan to go down. + 2.9-1.1 Socket state: + 0 %NSCLS CLS received. val 6 gives reason. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + val 7 Reason for closing: + 0 %NCNTO Never open. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host Reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down. + 10 %NCRFS Connection refused. + val 8 Input: number of bits available. + Output: number of bits of buffer free. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + +RCPOS: read cursor position (ITS TTY) + + arg 1 or + val 1 Main program area cursor position. + val 2 Echo area cursor position. + + Each cursor position is returned as a word with the + vertical position in the left half and the horizontal + position in the right half. + See the SCML symbolic system call for setting up an + echo area. + +RDDMST: read demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + val 1 If arg 1 was the sixbit name, the user index; + if it was the user index, the sixbit name. + val 2 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + val 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and STDMST symbolic system calls, + and the .DEMON uuo. + +RDMPBT: read dump bit + + arg 1 Disk channel number or + val 1 A word, all zero, except with the dump check + bit for the file in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the SDMPBT + symbolic system call. + +RELOAD: reload top-level job (ITS DETACH) + + No arguments or values. Note, however, that an + argument of some kind must be supplied so that the + SETZ bit may be present to terminate the set of + arguments. + + The executing job must be the top level job of + a non-disowned job tree. + + Most of the job's system variables are initialized; + the file SYS:ATSIGN is then loaded and + started up, where is the jname of the job + (see the .JNAME user variable). + For example, if the jname of the job is HACTRN, + then the file SYS:ATSIGN HACTRN (which is DDT) + is loaded and started. This is how DDT performs + the U. command. Note that the translation lists for + the job are not cleared before this loading; thus one + can translate the file names SYS:ATSIGN and + cause a different file to be loaded. + + More specifically, the way the job is loaded is that + the following program is put into the job's ac's + and started at location 0: + + 0/ JFCL ;unused word + 1/ .OPEN 1,7 ;open up file SYS:ATSIGN + 2/ JRST 0 ;retry on failure + 3/ .CALL 12 ;load up program + 4/ .LOGOUT ;logout if loading fails + 5/ .IOT 1,2 ;read in starting address + 6/ JRST (2) ;go there + 7/ 4,,'SYS ;SYS device, image unit input + 10/ SIXBIT \ATSIGN\ + 11/ 0 ; is placed here + 12/ SETZ + 13/ SIXBIT \LOAD\ ;load file into job + 14/ 16 ;job specification + 15/ SETZ 17 ;channel number + 16/ -1 ;job is me + 17/ 1 ;channel number is 1 + + Typically the first thing a job used as a top level + (such as DDT) does is close channel 1. Now you know + why. The LOAD system call leaves channel 1 open + so that the start address and symbol table can be + read in. + +Errors: + + 40 NOT TOP LEVEL + +RENAME: rename a file + + Either + arg 1 Byte pointer to ASCIZ string specifying the old name, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified device name. + arg 2 Old file name 1. + arg 3 Old file name 2. + arg 4 Sname. If zero, the executing job's sname + is used (see the .SNAM user variable). + arg 5 New file name 1. + arg 6 New file name 2. + + The file specified by the first four names is renamed + according to the last two. It is not possible to + "rename" a file into a new directory or device. + Attempting to rename to an already existing file will + fail with error code 13 (File already exists). + + The old file names are subject to file name translation. + See the TRANAD and TRANDL symbolic system calls. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +RENMWO: rename while open + + Either + arg 1 Channel number of channel with file open on it. + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Channel number of channel with file open on it. + arg 2 New file name 1. + arg 3 New file name 2. + + The file open on the specified channel is renamed + according to the specified names. + + Ordinarily this is used in connection with output. Often + one opens a file for output with artificial file names, for + instance _TECO_ OUTPUT, instead of the real desired names. + This is so that if something should happen, causing the + channel to be closed before writing to the file is finished, + any previous file with the desired names will not be + replaced by the new, incomplete file. When all the + necessary data have been written into the file, + one RENMWO's to the desired names and then CLOSE's. + This causes the new, good file to replace the old one of + the same names. (By convention, file names beginning + with "_" are artificial names reserved for this purpose. + Ordinarily a program FOO will use the first file name + _FOO_ and a second file name indicating the nature of + the output file; thus _FOO_ OUTPUT, _FOO_ CRFOUT, + _FOO_ LSTOUT, etc.) + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +REOWN: re-own a disowned job + + arg 1 channel # + + The foreign job open on the specified channel is made + an inferior of the current job. The sub-tree of that job + becomes part of the sub-tree of the current job. The UNAMEs + of the specified job and all its inferiors are changed to + the UNAME of the current job. The JNAMEs are altered where + necessary to keep all UNAME-JNAME pairs in the system unique. + +Errors: + +5 DIRECTORY FULL + The current job already has the maximum number of inferiors (8). +31 CAN'T MODIFY JOB + The specified job is not top-level, or not disowned. +34 WRONG TYPE DEVICE + Specified channel is not open on the USR device, + or the job is already an inferior of the current job. +42 JOB GONE OR GOING AWAY + The specified job is in the process of logging out. + +RESET: reset input/output channel + + arg 1 Channel number. + + See also the .RESET uuo. + + This is a device-dependent operation. In general + the intent is to reset the state of the device to + some standard setting. + + For TTY input: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + All characters pending in the input buffer are + thrown away. Any interrupt characters which have + not yet interrupted will not interrupt. Any echoing + characters which have not yet echoed will not echo. + + For TTY output: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + Any characters in the output buffer are thrown away + iff the %TPORS bit is 1. If the channel was hung in + a **MORE**, the **MORE** is forgotten. If the job + was interrupted in the middle of ^P code typeout, + the ^P is forgotten. Other oddball state bits are + also reset to their normal state. + If the intelligent terminal protocol is in use on + the tty, then a %TDORS code will be sent to it, + and a reply stating the terminal's actual cursor + position awaited before any more output is allowed. + See the description of this protocol in the TTY documentation. + + For the USR device: + This is like doing a .UCLOSE and then re-opening the + job, but with less overhead. All pages of the job + are flushed, and a single page, page 0, is created + and cleared. All resource variables and other variables + are initialized. The %TBNOT and %TBDTY bits are set + in the .TTY variable. The .SNAM variable is initialized + to the uname of the job. The .40ADDR variable is set + to 40 octal. The .APRC variable is set to 447 octal. + + For the LPT device: + The line currently being physically output is terminated + and output. All characters pending in the output buffer + are flushed. The printer is skipped to a new page. + + For the PLT device: + All buffered plotter commands are flushed. + + For the PTR device: + All buffered input characters are flushed. + + For the PTP device: + All buffered output characters are flushed. + + For the COD device: + All buffered output characters are flushed. + + For the PDP-6: + The core of the PDP-6 is cleared. If it is running, + this should cause it to loop, executing the zero word + in location 41. A routine is then placed in core to + clear the PI flags, clear the processor flags, release + all shared devices, clear the accumulators, and finally + clear itself from core. If the routine fails to run + (the PDP-6 is not running), then the routine is cleared + out of the PDP-6 memory again anyway. + + For the NET device: + Any pending interrupt (INR or INS) is cleared. + + For TCP channels: + Currently does nothing. + + For the Chaosnet (channels opened with CHAOSO): + Does nothing. + + For the STY device: + An input reset is much like an output reset for the + tty which is the STY's alter ego; similarly, an output + reset is much like an input reset for the associated tty. + One difference is that a STY input reset does not + reset certain channel-related bits that a tty output + reset would; on the other hand, it always succeeds in + flushing characters even if the %TPORS bit is not set. + + For the STK device: + All buffered input characters are flushed. + +RESRDT: restore file reference date + + arg 1 Disk channel number or + + The reference date for the disk file is restored to + its value prior to the opening of the file. + Note that control bit 1.4 avoids setting the + reference date when a disk file is opened. See + the OPEN symbolic system call. + + See also the DSKUPD, FILBLK, RQDATE and SRDATE symbolic + system calls. + +RFDATE: read file creation date + + arg 1 Disk channel number or + val 1 The creation date of the file: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the RQDATE and SFDATE symbolic system calls. + +RFNAME: read name of file channel is open to + + arg 1 whose channel should be read. (OPTIONAL) + If omitted, self is assumed. + arg 2 channel number + arg 3 Optional byte pointer to store ASCIZ filename string through. + arg 4 Optional maximum number of characters to store. + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The mode in which the channel is open. + + The filenames and mode as described by the RFNAME may + not be the same as those specified in the original open. + That is because they are intended to be the "real" + filenames, etc., as opposed to those that were specified. + In other words, they are supposed to be the canonical + arguments to specify to attempt to re-open the file. + For example, the results of filename translation and + link following will show up in the names returned by + RFNAME, as opposed to the translated names or the names + of the link that was followed. Similarly, if COM or SYS + is opened, RFNAME will return DSK:COMMON; or DSK:SYS; + since COM and SYS are equivalent to those disk directories. + The core link devices CLO, CLU, CLA and CLI + perform different functions when first opened, but after the + open they result in indistinguishable channels, and the file + could be re-opened in any case by specifying CLO with the + right filenames, so RFNAME will for all four devices return + the device name CLO. + Some open-mode bits also have only an initial effect, and + they too are likely to be missing (or else always present!) + in the open-mode returned by RFNAME. + + + The following devices return the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + bits 1.1, 1.2, 1.3 with their standard meanings + for the open-mode (value 5). + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 'DSK,, + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-5 0 + + TTY (as a console) + val 1 'TTY,, + val 5 see TTY as a device + + TTY (as a device) + val 1 'Tnm,, + val 5 Bits 1.1 and 1.2 are standard. + For output channels, all the %TJ... bits + are returned also as they were in the OPEN. + For input channels, all the %TI... bits are + returned as they were specfied in the OPEN. + + STY + val 1 'Snm,, + val 5 All the bits of a STY open are returned. + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 bits 1.1 and 1.2 as standard + bit 1.4 1 if the job is not an inferior + of the job which has it open. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS system call. Note that the JOB device + is not specifically consulted when the RFNAME call is + given; it sets up the file names and open mode once + and then these values are returned whenever a user + asks for them with RFNAME. + + NET: (Arpanet NCP) + Note that val 4 is slightly nonstandard. + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + val 5 0 or 1 (i.e. .UAI or .UAO) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + +RFPNTR: read channel's random access pointer + + arg 1 channel # (or ) + + val 1 random access pointer + val 2 channel byte size. The acces pointer + is in terms of bytes of this size. + + The random access pointer is the number of bytes + into the file at which the next reading or writing + operation will occur. + + See also the ACCESS system call, the .ACCESS UUO, + the RCHST system call, and the .RCHST UUO. + +Errors: + +34 WRONG TYPE DEVICE + The device open on the specified channel is not random-access. + +RQDATE: read disk format date + + val 1 Current date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time in half-seconds after midnight. + If date and time are unknown, -1 is returned. + val 2 Date and time the system came up in disk format. + If date and time are unknown, -1 is returned. + + See also the DSKUPD, FILBLK, RESRDT, RFDATE, and SFDATE + symbolic system calls. + +RSSIZE: read screen size (ITS TTY) + + arg 1 or + val 1 Vertical size of screen (huge if printing). + val 2 Horizontal size of screen (print width). + + See also the CNSGET and CNSSET symbolic system calls. + +SAUTH: set a file's author + + arg 1 The number of a channel open on the DSK + device, or a . + + arg 2 The sixbit name of the file's author. + + Note: the author is actually stored as a directory + number, so if the author does not have a directory + SIXBIT /______/ will be substituted. Trailing digits + are deleted in an attempt to find the author's directory. + +SCML: set the number of TTY command lines (ITS TTY) + + arg 1 or + arg 2 Number of command lines (typical value is 4). + Must be less than the height of the screen. + If zero, no echo area. + + This causes an echo area to be set up at the bottom + of the display screen, using the last lines. + Characters typed in, or characters output in echo + mode, are output to this area rather than the main area. + Note that control bit 1.6 in an OPEN symbolic + system call for TTY input does an implicit SCML + with a second argument of 3. + +SCPOS: set tty cursor position (ITS TTY) + + arg 1 or + arg 2 vertical position (optional). + arg 3 horizontal position (optional). + arg 4 TTOALC word (optional). + val 1 old vertical position. + val 2 old horixontal position. + val 3 old TTOALC word. + + This call tells the system what the main-program-level + cursor position of the specified tty really is. It + does NOT request that the cursor be MOVED there; + it asserts that the cursor is expected to end up there + as a result of the characters already IOT'ed. + This call is necessary only when the system cannot figure + the resulting cursor position out for itself. + There are two cases when that happens: + + 1) The system does not compute cursor motion when + super-image output is done. If the user program, which + presumably knows how the characters are being used, knows + that the cursor will be moved by them, it should inform + the system. This is necessary even if the user program + is just trying to save time by generating the internal + system output buffer codes itself. + + 2) When an output reset is done on a tty of type %TNSFW + (a "software tty"), the system does not know where the + tty's cursor is physically located. Since the system + does not actually interpret the output characters at + interrupt level, but merely passes them off to the + tty, it does not know how much the tty had done when + the output reset happened. To recover, the system + sets the LH of the tty's TTOALC word to 0, and sends + a %TDORS character to the tty. The tty should respond by + informing the system of the current cursor position and + setting the LH of TTOALC to -1. Physical ttys must + use the intelligent terminal protocol to do that, + but STY users may do it with SCPOS. + +SDMPBT: set dump bit + + arg 1 Disk channel number or + arg 2 A word with the new value for the dump check + bit in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the RDMPBT + symbolic system call. + +SETIOC: set input/output channel error + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBIOC + symbolic system call. + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + pen on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +SFDATE: set file creation date + + arg 1 Disk channel number or + arg 2 New creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the DSKUPD, FILBLK, RFDATE, RQDATE and SRDATE + symbolic system calls. + +SIOT: byte-string in/out transfer + + cbits Same as for IOT symbolic system call (q.v.). + arg 1 I/O channel number. + arg 2 Byte pointer to string to transfer + (must not be indexed or indirect). + arg 3 Count of bytes to be transferred. + arg 4 (Optional) device-independent special mode bits. + + The second and third arguments are updated as the + transfer proceeds. If an end of file condition occurs + or the job is interrupted out of the system call, they + may not be fully counted out. + + SIOT is notably efficient for STY input and TTY superimage + output - much faster than block mode. For details of Chaosnet + SIOT, see the description of IOT. + + Supposedly some esoteric devices don't support this mode of + I/O transfer, but I can't think of any. Also, it is alleged + that on some devices, SIOT is not yet as efficient as block + mode. + +Errors: + + 12 MODE NOT AVAILABLE + The device open on this channel doesn't support SIOT. + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second or third argument was immediate. + +SOPEN: open file, using strings to specify the filename + + arg 1 mode bits,,channel number + arg 2 byte pointer to ASCIZ filename string, + or AOBJN pointer to a block of byte pointers + to strings to be concatenated. + +If the second argument's left half is between -63. and -1, then the +argument is treated as an AOBJN pointer to a block of byte pointers to +ASCIZ strings. Those ASCIZ strings are effectively concatenated for +parsing. Otherwise, the second argument is treated as one byte +pointer. 0 may be used as the left half of a byte pointer, and is an +abbreviation for 440700. + +The combined string is parsed using the ordinary ITS filename syntax, with +colon indicating a device name, semicolon indicating a directory name, and +space separating filenames. ^Q is used for quoting colon, semicolon, +space, ^Q and ^@ (which would otherwise terminate the string); it cannot +hurt to quote other characters with ^Q. SOPEN defaults the device to +"DSK", the second filename to ">", and the directory to the executing job's +current sname. + +Multiple devices, directories and names may be significant with some job +devices, and perhaps with disk files as well at some time in the future. + +Once the string has been parsed into filenames, operation proceeds as +for the OPEN symbolic system call, which see. + +SOPEN appears to a job device handler just like any other OPEN, except +that the original second argument byte or AOBJN pointer is available +as one of the values of the JOBCAL symbolic system call (which see). +For an ordinary OPEN, that value from JOBCAL is zero. + +SRDATE: set file reference date + + arg 1 Disk channel number or + arg 2 New reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + + See also the DSKUPD, FILBLK, RESRDT, and RQDATE + symbolic system calls. + +SREAPB: set the do not reap bit + + arg 1 Disk channel or + arg 2 0 for the normal case. + 1 to request the grim file reaper to + leave this file alone. + + The do not reap bit of the file open on the channel + is set. The G*** F*** R**P** doesn't + respect this bit yet. + + The bit can be read using the FILBLK system call. + It is UNREAP in the FSDEFS insert file. + +SSERVE: set server job + + arg 1 Client job (OPTIONAL) + If omitted, self is assumed. + arg 2 Server job + + The .SERVER variable of the client job is modified to point to the + server job. See the description of .SERVER in .INFO.;ITS USETS. + This system call permits .SERVER to be updated without trafficking + in user indices. + +Errors: + + 34 WRONG TYPE DEVICE + Neither the client nor the server can be the PDP6 + 31 CAN'T MODIFY JOB + Executing job must be able to modify the client job. + +SSTATU: get various system status variables + + val 1 If non-negative, the time (in thirtieths of a + second) until the system will go down. + -1 if the system does not intend to go down. + -2 if the system is already down (can happen + in a job with %OPLIV set). + Obtained from the ITS variable SHUTDN. + See the .DIETIME, .SHUTDN, and .REVIVE uuos. + val 2 Non-zero if the system is being debugged. + This state causes the message + XX ITS ### BEING DEBUGGED + to appear on free consoles instead of the + XX ITS ### IN OPERATION + message usually seen when the system comes up. + If negative, the system is officially down; + ^Z is accepted only from tty 0 (the terminal + physically next to the PDP-10 console) or from + the tty whose number is the absolute value of + the contents of this quantity. A ^Z is also + accepted from a tty associated with a STY; + this is so that STY devices may be debugged! + It is the responsibility of the STELNT server + to examine this quantity and keep network users + from logging in when the system is being debugged. + Obtained from the ITS variable SYSDBG. + val 3 Number of users on the system. This is a + count of logged-in, console-controlled job + trees in the system. This variable is + incremented whenever a user logs in from a + console, and decremented whenever a console- + controlled tree is detached, gunned, or logged out. + This is the ITS variable SUSRS. + val 4 Sum of parity and nxm memory errors during this + incarnation of the system. This is the sum of + the ITS variables PARERR and NXMERR. + val 5 Time the system has been up, in thirtieths of + a second. This is the ITS variable TIME. + See the .RDTIME uuo. + val 6 The left-justified name of the machine, i.e. one of: + SIXBIT \AI\ ;A.I. Lab KS-10 + SIXBIT \ML\ ;Mathlab KS-10 + SIXBIT \MC\ ;Mail Computer KS-10 + SIXBIT \MD\ ;Mostly Development KS-10 + SIXBIT \MX\ ;Macsyma Consortium KL-10 + SIXBIT \SI\ ;Stacken ITS KS-10 + SIXBIT \PM\ ;PandaMonium KS-10 + SIXBIT \FU\ ;Australian KS-10 + SIXBIT \DM\ ;Dynamic Modeling KA-10 (R.I.P.) + SIXBIT \MLKA\ ;Mathlab KA-10 (R.I.P.) + SIXBIT \AIKA\ ;A.I. Lab KA-10 (R.I.P.?) + This is the name which appears for XX in such + messages as + XX ITS ### IN OPERATION + and which serves as a device name for that + machine's disks (i.e. the ML device is the + DSK device of the ML (Mathlab) machine). + If more ITS machines come into existence, + naturally more machine names will be invented. + val 7 The system version number, in sixbit. This is + the ### in such messages as above. + val 8 The number of free job slots. + + DDT uses much of this information to print out its + greeting to you: + If value 2 is non-zero DDT prints out + ITS BEING DEBUGGED! + If value 1 is non-negative DDT prints out + XX ITS GOING DOWN IN 1:23 + if e.g. ITS were going down in 1 minute, 23 seconds. + (DDT also prints the contents of the file SYS:DOWN MAIL + if that file exists.) + Value 3 is used to print out the number of users as + 23. LUSERS + (if your DDT has not logged in itself, it increments + this value so as to count you also). + Values 4 and 5 are used to compute the number of memory + errors per hour, printed as: + MEM ERRS .034142/HOUR + The DDT command :SSTATU will print out all + this information. + +STATUS: get input/output status word + + arg 1 Channel number. + val 1 Status word for specified channel. + + This call returns a word describing the state of + the specified channel: + 4.9-4.6 Always zero. See the .IOPUSH and .IOPOP + uuo's, and the .IOP and .IOS user variables. + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + These are the same as the error codes returned + by failing .CALL's. + 2.9-2.3 Device dependent (see below). + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + 0 TTY Console input. + 1 TTY Printing console output. + 2 TTY Display console output. + 3 LPT Data Products line printer. + 4 VID Vidisector ??? + 5 BAT ?? + 6 PLT Calcomp plotter. + 7 PTP Paper tape punch. + 10 IMX Input multiplexor. + 11 OMX Output multiplexor. + 12 PTR Paper tape reader. + 13 DIS DEC 340 display, ascii output. + 14 IDS Interpreted 340 display. + 15 MTn Magnetic tape. + 16 COD Morse code device. + 17 TAB Tablet. ??? + 21 NUL Source of zeroes, or output sink. + 22 JOB Job device. + 23 BOJ Inverse of JOB. + 24 SPY Spy on another console. + 25 STY Pseudo-teletype. + 26 NET ARPAnet (NCP). + 27 LPT Vogue line printer (yech!) + 30 STK Stanford keyboard. + 31 MSP ? + 32 CHAOS CHAOS net. + 33 TCP TCP Internet. + 34 TRAP Trap "device" + 35 IPQ Internet IP Queue. + 41 UTn Microtape (DECtape). + 43 DSK 2311 disk drives or equivalent. + 60 USR A not immediately inferior procedure. + 61 USR An immediately inferior procedure. + 62 CLx Various core link devices (CLA, CLI, CLO, CLU) + 63 --- File directory or ERR device. + 64 USR The PDP-6. + 65 DIRHNG Directory hang "device" + + Device dependent bits for TTY input: + 2.9 Local tty. + 2.8 Next to the 340 or a 340 slave. + 2.5 Chars pending which have been .ITYIC'ed but not IOT'ed. + 2.4 The job possesses the tty. + + Device dependent bits for TTY output: + 2.4 The job possesses the tty. + + Device dependent bits for Data Products LPT: + 2.9-2.3 Current column (left margin = 0). + + Device dependent bits for MTn (macro-tape): + 2.9 Chunk, write EOR after each IOT (should be block) on output, + don't ignore them on input. See magtap info. + 2.8 0 => odd parity, 1 => even parity. + 2.7-2.6 Density: 00 => 800, 01 => 200, 10 => 556. + Apparently 11 => IBM 9 track 800 bpi?? + 2.5 0 => 7 track, 1 => 9 track. + 2.4 End of tape. + 2.3 Read compare error. + + Device dependent bits for NET: + 2.9-2.4 Socket state: + 0 %NSCLS CLS received or net down. Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in state 2. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent; waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + + Device dependent bits for TCP: + 2.9-2.4 Connection state - see WHYINT call for state codes. + + CHAOSnet provides no device dependent bits. + + A STATUS word can be supplied to the ERR + device to obtain corresponding error message, if any. + + See also the JOBSTS symbolic system call, the .STATUS uuo, + and the .IOS user variable. + +STDMST: set demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + arg 2 If negative, flush all requests for the specified demon. + Otherwise: + 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + arg 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and RDDMST symbolic system calls, + and the .DEMON uuo. + +STLGET: get information from Server Telnet + + arg 1 a + + val 1 XJNAME of server telnet + val 2 TRMNAM of server telnet + This is the sixbit name of the host connected to. + val 3 SNAME of server telnet + val 4 In LH: STY status bits + In RH: index of telnet server job which owns the STY. + + This call can be used to find out where in the network + a TTY really is. + + The STY status bits are from the STYSTS table in ITS. + Some of the more interesting ones include: + %SSNET==4000 ;4.3 = 1 => THIS STY CONNECTED TO SOME NET SOCKETS. + %SSCHA==2000 ;4.2 = 0 FOR ARPANET, 1 FOR CHAOS NET + %SSTCP==1000 ;4.1 = 1 for TCP internet (%SSCHA must be 0) + +Errors: + +34 WRONG TYPE DEVICE + Specified TTY is not controlled by a server telnet. + +STYGET: get information about STY + + arg 1 (need not be associated with a STY) + val 1 STY status word: + 4.9 %SSHNG Don't hang on input IOT. + 4.8 %SSUSE STY is in use. + 4.7 %SSINT Have given interrupt on STY output channels. + 4.6 %SSONT Have given interrupt on STY input channels. + 4.5 %SSOHG Don't hang on output IOT. + 4.4 %SSORS Give a %TDORS whenever an output RESET is + done on the controlled tty, regardless + of whether the tty is a software tty. + 2.9-1.1 User index of job which owns the STY. + Zero if STY is not in use, or if TTY is not + associated with a STY. + val 2 User index of job which owns the TTY, either as a device + or as a currently possessed console; or -1 if TTY is free. + val 3 -1 if the TTY is not a console or is free. Otherwise, + 2.9-1.1 is the user index of the top-level job of the + job tree controlled by the TTY. + 4.8 = 1 if that job is in the process of logging out. + 4.7 = 1 if that job is logged in. + + val 4 4.9 Owner of TTY is in a TTY output wait on the TTY. + 1.1 Owner of TTY is in a TTY input wait on the TTY. + These bits probably don't work very well. + val 5 4.9 TTY input available. + 4.8 TTY output buffer has room. + val 6 The tty's TTYSTA word. + 4.9 %TACFM TTY does not need a console free message + eventually (hasn't been in use since + the last one). + 4.8 %TAC.Z TTY is being ^Z'd. Shouldn't be on with + %TACFM. If %TACFM and %TAC.Z are both 0, + the tty is being freed and a console free + message is immanent. + 4.7 %TANJS This ^Z is being flushed because no job + slots are available. If set, %TAC.Z + will be 1 and %TACFM will be 0. + + This symbolic system call originally was intended to return + STY information, but now returns useful data concerning any TTY. + +STYNET: Connect a STY to a pair of Network connections. + + arg 1 Sty channel (either direction). + arg 2 -1 to disconnect the STY from its network channels + (in which case args 3 and 4 are unnecessary), + or Net input channel (to connect STY output to). + This may be a NCP, TCP, or CHAOS channel. + arg 3 Net output channel (to connect STY input to). + arg 4 Characters to send out on net + when an output .RESET is done on the STY's TTY. + Up to 3 8-bit characters, left-justified. + + It is possible with this call to connect a STY to a pair + of network channels, one open for input, and one open for output. + When the direct connection is established, anything received by + the net input socket will be fed automatically to the + STY, and any type-out that the STY receives from its TTY will be + fed automatically to the net output channel. The transfer of + data is handled by the system at clock level, eliminating + the need for the program to wake up at each character. + + Only one input and one output net channel can be connected to + a STY, and only one STY can be connected to any net channel. + Both sides of a STY are connected and disconnected at once. + A job can connect a STY if it has the STY open in either direction + (but it will generally want to have both directions open). + + Once established, the direct connection will last until + broken explicitly by the user, or until an escape condition + is detected by the system. Escape conditions include receipt + of a TELNET control character on the net input channel (any + character with the 200's bit on), and + either net channel's getting into an abnormal state (other + than %NSOPN, %NSINP, or %NSCLI) - in general, things which + the system expects that the user program will want to take + action on. + + The connection can be broken explicitly by the user either + by a STYNET call with arg 2 negative, or by a CLOSE of any + of the channels involved (this also happens when the job + is killed.) It is an error to IOT on any of the channels + without breaking the connection first. + + The STYNET call returns immediately, without actually + transferring any data. The program can assume that the + connection is still in effect until it is notified of + a disconnection by an interrupt on the net input channel. + While the connection lasts, interrupts on the net channels + due to arriving data are intercepted by the system, so + an interrupt implies that the connection has been broken. + + When a %TDORS comes out of the STY, indicating that the TTY's + output buffer has been cleared, this is indicated to the net + output channel by means of a network interrupt (NCP only), and the + string of up to 3 characters specified as the fourth argument + to the STYNET call. If TCP, these characters are PUSHed with the + URGENT bit set. + + If you use STYNET with the official TELNET protocol, you must + turn on the %TPTEL bit in the STY TTY's TTYOPT variable, to + cause the sequence CR-LF to be turned into just a CR. + + For the Chaosnet: + arg 1 - STY channel + arg 2 - Chaos channel to connect to, or + -1 to disconnect + arg 3 - Other Chaos channel (not actually used) + arg 4 - Output-reset character sequence, up to 3 8-bit + characters left-justified. + + This works the same as on the Arpanet. The specified STY + is connected to or disconnected from a Chaos net channel. + Data is transferred in and out by the system without the + need for intervention by the user program. If an unusual + condition occurs, the STY is disconnected from the Chaos + channel and the user is interrupted. It is illegal to do + I/O on any of the involved channels while they are connected. + + This call is provided for the benefit of the "Telnet" server. + +Errors: + + 2 WRONG DIRECTION + An input net channel was supplied as the third argument, or + an output channel was supplied as the second argument. + 23 FILE LOCKED + The STY or one of the network channels is already direct-connected + to another network channel or another STY. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + An attempt was made to disconnect a STY not already connected. + +T11MP: PDP-10 to PDP-11 map + + arg 1 Page number within the user's core. That page + must be either non-existent or shared with an + absolute page. The user's virtual page is made + to share with some arbitrarily chosen absolute + page, which is then made to share with PDP-11 memory + according to argument 2. + arg 2 Desired PDP-10 to PDP-11 map word. + 4.9 Valid (must be 1). + 4.8 Write enable. + 4.7-4.3 Unused. + 4.2-3.9 PDP-11 number. See below. + 3.8-2.2 Relocation (origin of segment in PDP-11 + address space). = 4*. + 2.1-1.1 Protection (number of accessible words - 1). + = 4*. + If protection=0 then only one 16-bit word + is accessible. + + The CORBLK symbolic system call may be used in the special + case of mapping one's TV console video buffer memory. + + The AI KA-10 has a PDP-10 to PDP-11 interface which lets the PDP-10 + programmer directly access the memories of up to eight PDP-11's. + PDP-10 pages are mapped into segments of variable size in the + PDP-11's memory. The PDP-10 to PDP-11 page map is also directly + addressable in memory (it currently lives in absolute locations + 2,,776000 - 2,,776377). There are 256. such entries, one for each + page in the range 2,,0 - 2,,777777, which are the addresses fielded + by the PDP-10 to PDP-11 interface. ITS allocates these pages + and their corresponding map entries randomly as needed. + + When the PDP-10 attempts to access a physical address in the range + 2,,0 to 2,,777777, the interface uses the 776000 bits to index + the map words. If the appropriate map word does not have its + valid bit set, the memory is considered non-existent. The same + is true if the reference would violate the protection bounds. + The reference also fails if it is a write reference and the + map word does not have the write enable bit set. + Otherwise, the relocation quantity is added to the 1777 bits, + and this determines which PDP-11 double-word to access. + The PDP-11 number determines which PDP-11 to access, of course. + The PDP-11 double-word corresponds to the high 32. bits of the + PDP-10 word, as follows: + PDP-10 BIT PDP-11 WORD AND BIT + 4.9 0 15 + 4.8 0 14 + 4.7 0 13 + --- --- --- + 3.4 0 01 + 3.3 0 00 + 3.2 1 15 + 3.1 1 14 + --- --- --- + 1.6 1 01 + 1.5 1 00 + When reading the PDP-11 memory, bits 1.4-1.1 are read as zeros. + When writing, 1.4=1 means don't change word 0, 1.3=1 means don't + change word 1, and 1.2-1.1 are ignored. Split cycles do the right + thing, so ILDB and IDPB should work correctly. + Note that accessing consecutive 16.-bit PDP-10 bytes will access + consecutive PDP-11 words, but accessing consecutive 8-bit PDP-10 + bytes will not access consecutive PDP-11 bytes! Rather, the PDP-11 + bytes are accessed in the order 1, 0, 3, 2. + + The following PDP11s are currently (4/2/76) attached. + + 0 The pdp11 that runs the AI KA-10 TV system. + 1 The pdp11 that runs the AI KA-10 XGP. + 2 The Lisp Machine GT40. + 3 The Chess Machine (not really a pdp11.) + 4 The Logo pdp11/45. + 5 The Micro-Automation pdp11/45. + +Errors: + + 1 NO SUCH DEVICE + There is no PDP-11 connected to this PDP-10. + 3 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + The page number is invalid, or the map word has bit 4.9=0. + 37 NO CORE AVAILABLE + No map words free. + +TCPOPN: open a TCP Internet connection (TCP;TCPDOC >) + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - local port # (-1 to gensym a unique local port #) + arg 4 - foreign port # (-1 for wild port) + arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild host) + arg 6 - Retransmission timeout (optional, not yet used) + +Control bits: + - None needed for channels - they are opened as .UAI and .UAO + automatically (no other modes possible). + - 7 vs 8 bit ASCII transfers can be determined by user-space byte + pointer used in SIOT. System buffers are always 8-bit bytes. + %NOLSN - Listen mode + + Note a value of -1 for either the foreign port or host will imply + that the call is a "listen". Return is always immediate, use NETBLK + to determine when the channels become open. For a non-listen call, + there is an internal ITS timeout, but for listen the state can persist + forever. + +ERRORS: + 6 - No free TCBs or buffers available (system has too many active conns) + 7 - TCP disabled in system. + 11 - Bad local or fgn port # + 13 - Connection already exists with these ports + 14 - Bad channel # arguments. + 33 - Illegal to use same channel for both input/output. + +TRANAD: add a translation entry (ITS TRANSL) + + cbits 2.9 Atomic translation (do not retranslate). + 2.8 0 => TRNLST, 1 => TRNLS1. + The TRNLST applies only to the specified job; + the TRNLS1 applies to the job and its inferiors, + direct or indirect. + 1.2 Output translation. + 1.1 Input translation. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to a block of "from" names. + arg 3 AOBJN pointer to a block of "new" names. + + Each AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are to be translated. All names are left-justified + within a word. A zero or omitted word is equivalent + to *. + Before creating the translation, a TRANDL is + performed on the first two arguments to prevent + duplicate translations. + + Uuos and symbolic system calls affected by translation + include .FDELE, .OPEN, MLINK, RENAME, and OPEN. + +Errors: + + 5 DIRECTORY FULL + No room in system for new translation entry. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to put a translation on the PDP-6. + 35 NO SUCH JOB + +TRANCL: clear translation list (delete all entries) (ITS TRANSL) + + cbits 2.8 Clear TRNLS1. + 2.7 Clear TRNLST. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + + + Either or both lists may be cleared with a single call. +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to clear translation lists for PDP-6. + 35 NO SUCH JOB + +TRANDL: delete a translation entry (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + 1.2 Stop translating for output. + 1.1 Stop translating for input. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 An AOBJN pointer to a block of names. + + The AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are no longer to be translated. All names are + left-justified within a word. A zero or omitted + word is equivalent to *. + +Errors: + + 4 FILE NOT FOUND + No such translation entry to delete. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to delete translation entry for PDP-6. + 35 NO SUCH JOB + +TRANEX: examine a translation list (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to array in core. + val 1 AOBJN pointer to tail end of array, + i.e. the part not needed to hold the data. + + The translation list is stored as consecutive + nine-word blocks of translation information. + Each block has the following form: + wd 0 4.9 Atomic translation entry. + 3.2 Output translation. + 3.1 Input translation. + wd 1 "from" device name. + wd 2 "from" file name 1. + wd 3 "from" file name 2. + wd 4 "from" sname. + wd 5 "to" device name. + wd 6 "to" file name 1. + wd 7 "to" file name 2. + wd 8 "to" sname. + A zero word for a "from" name means translate for any + name in that position; a zero "to" word means don't + change that name when translating. + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to examine translation list for PDP-6. + 35 NO SUCH JOB + 37 NO CORE AVAILABLE + Supplied array too small to hold data. + +TRANS: translate some file names (ITS TRANSL) + + cbits 1.1 0 for input, 1 for output. + arg 1 "from" device name. + arg 2 "from" file name 1 (defaults to zero). + arg 3 "from" file name 2 (defaults to zero). + arg 4 "from" sname (defaults to job's current sname). + arg 5 mode (XOR'd with control bits; defaults to 0). + val 1 "to" device name. + val 2 "to" file name 1. + val 3 "to" file name 2. + val 4 "to" sname. + + The given file names are translated by the same rules + for translation governing the operations of OPEN, + RENAME, DELETE, and MLINK. These rules are as follows. + + Translation lists are searched in the order: + executing job's TRNLST + executing job's TRNLS1 + executing job's superior's TRNLS1 + that job's superior's TRNLS1 + . . . + top-level job's TRNLS1 + system job's TRNLS1 + The lists are searched for an entry matching the given "from" + file names. A translation entry is said to match if each + "from" name matches the entry's corresponding name, + and if the translation entry applies to the mode (input or output). + A name in turn matches if the entry's name is the same as + the given name, or if the entry's name is * (matches anything). + If a match is found, the given file names are replaced by the "to" + file names in the translation entry, except that in the entry + a "to" file name of * means don't change the given name; + the process is then repeated from the beginning unless the + matching translation entry is atomic. When this happens, or + when a full search finds no matching translation entries, + the translation process is complete. To prevent endless + retranslation, it is considered an error to repeat the + translation process more than eight times. + + When a job is first created its TRNLST and TRNLS1 are null. + The TRANAD, TRANCL, TRANDL, and TRANEX symbolic system calls + may be used to examine and modify translation lists. + +Errors: + + 3 TOO MANY TRANSLATIONS + No more than eight consecutive translations are permitted. + +TRPOPN: Open trap-device channel + + arg 1 + arg 2 channel number in that job + arg 3 IOCHNM word (only LH is used) + arg 4 IOCHST word + + The specified channel of the specified job is made a trap-device + channel. Almost any attempt to use it will cause a %PITRP interrupt. + See documentation of the TRAP: device. + +Errors: + +13 FILE ALREADY EXISTS + The specified channel is open. + +14 BAD CHANNEL NUMBER + arg 2 is invalid. + +31 CAN'T MODIFY JOB + The is not clobberable. + +34 WRONG TYPE DEVICE + The is the pdp-6. + +TTYESC: simulate type-in of ^_ + + arg 1 + + Pretends that the user has just typed in a ^_. + The next character the user types will be interpreted + as a ^_ command. + + The intended use of this is for programs which use + super-image input, so that ^_ does not have its normal + effect, but which wish to provide an escape convention + so that the effect of ^_ can be obtained. When the program + sees the escape character sequence as input, it should + do a TTYESC. + +Errors: + +7 DEVICE NOT READY + The terminal is already in the middle of a ^_ code + being typed by the user. + +TTYFLS: flush TTY input + + arg 1 + control bits: + 1.1 0 => cause the last interrupt character .ITYIC'ed + to be ignored by .IOT. + 1 => discard all input up to and including the last + character .ITYIC'ed. + + This call is normally used by TTY input interrupt handlers. + +TTYGET: read the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + val 1 TTYST1 variable. + This variable contains six groups of six bits. + Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + The character groups are: + 4.9-4.4 ^@-^F ^K ^L ^N-^R ^T-^Z ^\-^_ + 4.3-3.7 Upper and lower case letters. + 3.6-3.1 Digits. + 2.9-2.4 ! " # $ % & ' , . : ; ? @ \ ` | ~ + 2.3-1.7 + * - / = ^ _ + 1.6-1.1 < > ( ) [ ] { } + val 2 TTYST2 variable. + Six more groups of six bits: + 4.9-4.4 ^G ^S + 4.3-3.7 ^I ^J (tab, linefeed) + 3.6-3.1 altmode (33) + 2.9-2.4 ^M (carriage return) + 2.3-1.7 rubout (177) + 1.6-1.1 space, ^H (backspace) + val 3 TTYSTS variable. + 4.9 %TSFRE Free console (not in use). + 4.8 %TSCLE ^L should echo as "^L" (normally + clears screen on displays). + 4.7 %TSHDX Same as %TOHDX. Vestigial. + 4.6 %TSFCO Use full 12-bit TV char set for output and + echoing: echo CONTROL as ALPHA, echo META + as BETA, echo SUPER as EPSILON, and use + Sail graphics if TOP is set. + 4.5 %TSALT Do not standardize altmodes. + 4.4 %TSROL Scroll mode. + 4.3 %TSSAI Echo and ascii output use SAIL + character set. + 4.2 %TSACT Next input IOT shouldn't wait + for an activation character. + 4.1 %TSNEA Don't echo in echo area; echo in M.P. Area. + 3.9 %TSINT Next input character should + interrupt even if it ordinarily + would not (%TGINT = 0). + 3.8 %TSMOR Inhibit **MORE** processing. + 3.7 %TSATY Set whenever an .ATTY executed by + some superior returns the tty to + the job. + 3.4 %TSNOE Defer echoing. + 3.3 %TSLCZ Last character typed was ^Z. + This bit causes .ATTY's to fail. + 3.2 %TSSII Super-image input. The special + actions of ^Z and ^_ are suppressed. + 3.1 %TSCNS This is a console, not a device. + 2.9-1.1 The user index of the job which controls + the tty, or -1 if the tty is free. + val 4 the TTYTYP variable + See the CNSGET documentation. + val 5 the TCTYP variable + See the CNSGET documentation. + + Values 4 and 5 probably should not be depended upon. + + See also the CNSGET, CNSSET, and TTYSET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYSET: set the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + arg 2 TTYST1 variable. See under TTYGET. + arg 3 TTYST2 variable. See under TTYGET. + arg 4 TTYSTS variable (optional). See under TTYGET. + %TSFRE, %TSHDX, %TSLCZ, and %TSCNS may not be altered, + nor may the RH. + + See also the CNSGET, CNSSET, and TTYGET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYVAR: read or set a variable associated with a TTY. + + arg 1 or + + In the simplest mode: + + arg 2 the name of a tty variable, in SIXBIT. + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 the SIXBIT name of a tty variable. + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the SIXBIT name of a tty + variable, and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The TTY variables include HEIGHT, WIDTH, ISPEED, OSPEED, TTYOPT, + TTYTYP, TTYCOM, TCTYP, TTYROL, TTYSMT, and IDLTIM. See + .INFO.;ITS TTY for a description of their meanings. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized tty variable name. + 26 DEVICE WRITE-LOCKED + Specified variable or specified tty cannot be written. + 33 MEANINGLESS ARGS + Attempt to store an illegal value in the TCTYP variable, + or an illegal instruction was specified in immediate- + instruction or block mode. + +TVWHER: tell where a TV is + + arg 1 or + val 1 The keyboard number of the physical + terminal in use. + The correspondence between keyboard numbers + and physical locations is in the file + SYSENG;TVKBD ROOMS, which is how the NAME + program gets this information. If this table + and that file disagree, that file is correct, + and please update this table. + As of February 7, 1977, these correspondences + were in effect: + KBD # ROOM WHO LIVES THERE + 0 809 Fahlman, Holloway, Knight x7807 + 1 810 Lavin, Kuipers, Miller, Bruss x7836 + 2 919 Very Small Data Bases north x6765 + 3 812 Yvonne, Karen x5876 + 4 813 Hewitt x5873 + 5 814 Sussman, McDermott x5874 + 6 808 Freiling, Lozano-Perez, Ullman x5875 + 10 817 Jabari x6218 + 13 819 Goldstein x5879 + 14 820 Minsky x5864 + 17 822 Marr x2082 + 21 824 Rich, Levin, DeKleer x6032 + 22 825 Purcell, Doyle x5848 + 23 826 Fredkin's Folly x5904 + 30 925 Moon (Tycho, north wall) x6765 + 31 902 Mason, Raibert, Hollerbach x3483 + 32 919 Very Small Data Bases south x6765 + 33 344 Edwards, Lebel x6765 + 34 913 Baisley, Greenblatt x6765 + 35 914 Gosper's Fishbowl x2076 + 36 912 9th Floor Lounge x6765 + 37 907 Chess, Lisp Machines x6765 + + val 2 The number of the TV video buffer in use + on this tty (0-17 octal). This is NOT a + Video Switch input number. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +UNLOCK: Unlock JOB's locks. + + arg 1 + + If the specified job is writable, and is using the locks + feature, its locks are unlocked. (Usually this is used on + onesself.) See the ITS LOCKS file for more information + on locks. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + + Plus the usual errors for arguments. + +USRMEM: Read or write another job's memory + + cbits 2.9 Allow writing into any job + 1.1 If page isn't readable or writable give an + MPV or pure interrupt to the job being + referenced. + + arg 1 + Other args are like USRVAR and TTYVAR. In place of + a variable-specifier you put the address in the job + of the word to be read or written. + + arg 2 Address to read or write (non-negative) + + Straight reading: + + Specify only 2 arguments. + + Straight writing: + + arg 3 New value + + Writing with an instruction: + + arg 3 Ignored + arg 4 Instruction to write with + + Block mode: + + arg 2 An AOBJN pointer to a block of pairs, first address + and then instruction. + + val 1 Previous contents (these are not valid in block mode) + val 2 New contents + + + Reading: + The content of the specified address in + is returned as val 1. + + Writing: + Arg 3 is written into the specified address + in . The previous contents are returned + as val 1. + + Writing with an instruction: + The instruction should modify its AC as if the spec'd job's + memory location were in it. The memory operand is fetched + from your own address space and is not stored back. + No jobs can run while the location is being modified, that is + between the fetching of the old value and the storing of + the new value. + The previous contents are returned as val 1, the new + contents as val 2. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + 32 CAN'T GET THAT ACCESS TO PAGE + The specified page is either nonexistant + or is read-only. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction for writing. + +USRVAR: Read or set some of a job's variables + + arg 1 + + In the simplest mode: + + arg 2 user variable specifier (see below). + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 user variable specifier (see below). + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the user variable specifier + (see below), and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + + This call is the symbolic equivalent of the .USET and .SUSET + UUO's. It can read, write, or both (but you are usually not + allowed to write any job except yourself or an inferior); + it is a .SUSET if the is %JSELF, or a .USET if given a + channel number as the , or it can be given other kinds + of job specs. + + The user variable specifier can be either numeric or sixbit. + If sixbit, it is the same as the name given in the ITS USETS + file except without the dot at the beginning. Sixbit specifiers + are good for programs which take arguments as to which user + variable to operate on, and are useful to allow a program + which uses a new variable to assemble before that variable is + actually put in the system (it will get error code 11 when it + tries to refer to the variable.) + + A numeric specifier is a small integer similar to those used + with the .USET and .USET uuos. Predefined symbols exist for + these, consisting of ".R" followed by the name of the variable. + (Use ".R" rather than ".S" even if you are writing.) Do not + use the symbols without the "R" (these are something else.) + The .IOC, .IOS, .IOP, and .PMAP arrays of user variables + can only be specified numerically. + + See the .SUSET and .USET UUO's (in .INFO.;ITS UUOS) + for more information on particular user variables. + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized sixbit user variable specifier, or numeric specifier + larger than the legal range. + 12 MODE NOT AVAILABLE + The specified variable is not available for the current combination + of reading versus writing and self versus other job. + 13 FILE ALREADY EXISTS + Attempt to cause two jobs in the system to have the same UNAME/JNAME pair. + 31 CAN'T MODIFY JOB + Attempt to write into a user variable of a job which is not writable. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction in immediate- + instruction or block mode; or attempt to store an illegal value + into a user variable (e.g. zero into the .UNAME). + 34 WRONG TYPE DEVICE + Attempt to access user variables of the pdp-6 other than .UIND + or .MEMT. + 40 NOT TOP LEVEL + Attempt to set a user variable for a job that is not top level, + when only top-level jobs are allowed to set that variable, for + example the .UNAME and .JNAME. + +VIDBUF: request/release video buffer + + arg 1 If non-negative, the number of a video buffer + to release. If negative, requests a video buffer. + val 1 If arg 1 was negative, the number of the buffer obtained. + + A video buffer for the PDP-11 TV consoles is assigned or + released. If assigned, the video switch input number + of that buffer is returned. This value can be placed + in bits 4.1-3.3 of the .TVCREG user variable in order to + cause video buffer pages in one's page map to refer to + the allocated video buffer. + + A video buffer is a segment of PDP-11 memory large enough + to represent all the bits on a TV display. A display + is 1100=576. bits wide by 706=454. lines high. Every + line is represented by 36. 16.-bit PDP-11 words; + this corresponds to 18. PDP-10 words as mapped through + the PDP-10 to PDP-11 interface (see the T11MP symbolic + system call). The word with the lowest address holds + the leftmost displayed bits; furthermore within each word + bit 15 is the leftmost displayed bit. Thus, as seen by the + PDP-10 bits are displayed in the "obvious" manner. + The entire buffer is 16344.=37730 PDP-11 words long; + this corresponds to 8172.=17754 PDP-10 words. + The word 77777 PDP-11 words (17777 PDP-10 words) from the + origin of the video buffer is a special control register: + 3.2-2.9 15-13 Unused. + 2.8 12 0 => white on black, 1 => black on white. + 2.7-1.5 11-00 Scroll offset: video buffer wraps around; + the first word displayed is that 4* + PDP-11 bytes from the buffer origin. For + best results this should be a multiple + of 9 (for vertical scrolling). + The PDP-11 always sees a video buffer as beginning at its + location 60000 (byte address); which video buffer it is looking + at is controlled by the console register at location 164044 octal. + Thus the PDP-11 sees the scroll register as being at address + 157776 octal. + + See also the VIDSW symbolic system call. +Errors: + + 4 FILE NOT FOUND + Attempt to release a buffer not assigned to the job. + 7 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + Arg 1 is non-negative but not a valid video buffer number. + +VIDSW: set video switch + + arg 1 Video switch input number. + arg 2 Video switch output number. + + The video switch is set up so that the specified video + output will gobble bits from the specified video input. + + As of July 25, 1975, the only video inputs are TV + video buffers. These correspond to Tnm device numbers + as follows: + + Tnm Video Input Number + T47 24 T47 is used for console free buffer. + T52 1 When you type ESCS, is + T53 2 the video input number. The PDP-11 + T54 5 merely switches that input to your + T55 6 TV display, which is a video output. + T56 7 + T57 10 + T60 21 + T61 22 + T62 23 + + The possible video outputs are mostly TV displays, but also + the Tektronix hard-copy device which sits next to the XGP. + (The keyboard number may be relevant to use of the TVWHER + symbolic system call.) As of July 25, 1975: + + Video Output Keyboard Location of TV + 0 0 809 Fahlman, Holloway, Knight + 1 14 820 Minsky + 2 21 824 Rich, McDonald, deKleer + 3 6 815 Freiling, Perez, Ullman + 4 10 817 Jabari + 5 22 825 Freuder, Grossman, Purcell + 6 4 813 Hewitt + 7 5 814 Brown, McDermott, Sussman + 10 13 819 Goldstein, Woods + 11 17 822 Marr, Sandewall + 12 35 915 Cohen, Gosper, etc. + 13 34 913 Baisley, Greenblatt + 14 33 334 Lebel + 15 30 925 Jarvis, Moon + 16 31 918 Freeman + 17 32 920 Computer room, near PDP-11 + 20 3 812 Yvonne, Williams + 21 36 912 9th Floor Lounge + 22 37 914 Larson, Lebel, Mousouriss + 23 1 810 Kuipers + 27 Tektronix hard-copy output device. + +Errors: + + 7 DEVICE NOT READY + The PDP-11 is not ready. + +WHOLIN: examine and set TV who-line (ITS TV) + + arg 1 or + Must be a TV terminal if a . + arg 2 If present, used to set new who mode: + -1 No who-line. + 0 User who-line; migrates with TTY. + 1 User who-line; frozen on who job. + 4 System who-line. + arg 3 If present, used to set new who . + val 1 Old who mode. + val 2 Old who job. + + The TTY must be specified by a channel number and not + by 400000 + tty number if the variables are to be altered. + + See ITS TV. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +WHYINT: Find out reason for second-word interrupt + + arg 1 channel # (or ) + + val 1 %WY code (see below) + val 2-n device-dependent + + This system call is the standard response to a second-word + (.IFPIR) interrupt. The first value returned is a code + number which indicates the type of device on the channel. + Usually a program will know what type of device is present, + because it only tries to use one type, but this value + is provided just in case. The codes are: + + 1 %WYTYI TTY input + 2 %WYTYO TTY output + 3 %WYSTI STY input + 4 %WYSTO STY output + 5 %WYNET (Arpa)NET + 6 %WYCHA CHAosnet + 7 %WYTCP TCP Internet + The device-dependent values returned are: + + For a TTY input channel: + val 1 %WYTYI + val 2 character typed. Reading characters this way + does not interfere with later reading them via + normal IOT. This allows characters to be processed + both as interrupt characters at the time they are + typed, and as normal input. The call fails to + skip if there are no more interrupt characters. + The program should keep calling WHYINT until + it fails to skip, then DISMIS the interrupt. + + For a TTY output channel: + val 1 %WYTYO + val 2 bit mask of reasons. The only reason that presently + exists is: + 4.9 --MORE-- interrupt. (Typeout reached + the bottom of the screen.) + + For a STY input channel: + val 1 %WYSTI + + For a STY output channel: + val 1 %WYSTO + + For a NET (Arpanet NCP) channel: + val 1 %WYNET + val 2 Sign bit 1 if "network interrupt" received. + Right Half Socket state: + 0 %NSCLS Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in %NSRFC state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent, waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + val 3 Number of bytes of input available (if input channel). + Number of bytes free in output buffer (if output channel.) + val 4 Close reason. Only valid if val 2 is %NSCLS. + 0 %NCNTO Never opened. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down (local host dead). + 10 %NCRFS Request for Connection rejected by fgn host. + + For a TCP channel: + val 1 %WYTCP + val 2 state code (see below) + val 3 input: # bytes avail, output: # bytes free in buffer + val 4 Close reason (same values/meanings as for NET. See + definition of %NX== in SYSTEM;BITS > if curious.) + + The TCP state codes are defined in SYSTEM;BITS > at %NT==: + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out + %NTCLS==:0 ; - - Closed (reason available from WHYINT) + %NTLSN==:1 ; - - Listening for a SYN + %NTSYR==:2 ; - - SYN received + %NTCLU==:3 ; + ? Being closed by fgn host + %NTSYN==:4 ; - - SYN sent, waiting for response + %NTOPN==:5 ; *I *O Open + %NTWRT==:6 ; ? *O Output buffer full + %NTCLX==:7 ; ? + Being closed by user + %NTCLI==:10 ; +I ? Closing/closed, input still available + %NTINP==:11 ; *I ? Open, input available + + + Chaosnet: + val 1 - %WYCHA + val 2 - state + val 3 - number of packets queued (receive,,transmit) + val 4 - window size (receive,,transmit) + val 5 - input channel#,,output channel# (-1 if not open or I/O-pushed) + + LH(val 3) is the number of packets available to input IOT. + This is different from the number of received packets + if some are out of order. This is increased by 1 if + there is a partially-read buffer available to SIOT; + this packet is not available to PKTIOT. This is zero + if the connection is direct-connected to a STY. + + RH(val 3) is the number of packet slots available in the output + window, i.e. the window size minus the number of packets + which have been transmitted by output IOT but which have + not yet been received and acknowledged by the foreign + host. + + The state codes are: + + %CSCLS Closed + %CSLSN Listen + %CSRFC RFC-received + %CSRFS RFC-sent + %CSOPN Open + %CSLOS Broken by receipt of "LOS" packet. + %CSINC Broken by incomplete transmission (no acknowledge + for a long time) + +Errors: + +34 WRONG TYPE DEVICE + The specified channel supposedly never gives interrupts. + +XGPIM: xerox graphic printer image output + + arg 1 Address of a word with the number of pages of + data in the left half and the number of the first + data page in right half. + This word must be in writable memory. + + Bits are shoved out onto the XGP. + + I wonder what the precise semantics of this kludge are? diff --git a/sysdoc/_calls.126 b/sysdoc/_calls.126 new file mode 100644 index 0000000..d6b6302 --- /dev/null +++ b/sysdoc/_calls.126 @@ -0,0 +1,5246 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS CALLS: + +This file attempts to maintain up-to-date documentation on all +symbolic ("new") system calls. Those wonderful souls who update the +information in any way (additions, deletions, corrections) should +describe their modifications in a brief note to INFO-ITS@AI so that +interested parties can correct their copies or conceptions without +needing to print or read the entire file again. For example: + + :MAIL INFO-ITS@AI I added more details to the "FOO" call ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + +The format for executing a new system call is: + +CALL: .CALL CALBLK ;the call itself + ;error return is to CALL+1 + ;successful return is to CALL+2 + + + ... + +CALBLK: SETZ ;always + SIXBIT /NAME/ ;where "NAME" is any implemented call + parm1 ;parameters start here + parm2 + + ... + + SETZ parmn ;bit 4.9 (SETZ) => last argument + +A list of all implemented system calls may be seen in +AI:SYSTEM;ITS > starting at SYSCTB:. The actual addresses +within ITS where each call is executed may be found from the +table starting at SYSCTD:. + +There are four types of parameters: + (input) argument + (output) value + (error) error return code + (input) control + +Bits 4.1-4.3 of the parameter word form an "op code" +for that parameter: + + Op Code Meaning Symbol Value + + 0 argument %CLIN 0000 + 1 immediate argument %CLIMM 1000 + 2 value %CLOUT 2000 + 3 error return code %CLERR 3000 + 4 control %CLBTW 4000 + 5 immediate control %CLBIT 5000 + + +The indirect, index, and address fields are used to calculate +an effective address, PDP-10 style. These point to the location +where the argument is or the output is to be placed. For +immediate parameters the address itself is the argument or +control bits. (Some calls update their input arguments. Such +arguments may not be immediate.) + +The order of the input arguments matters; so does the order of +the output values. Other than that, the order is irrelevant. +(As a matter of style, one normally writes them in the order +"control, arguments, values, errors" for clarity. In the descriptions +given here the parameters will always be described in that order.) + +If too many input arguments are present, the excess are ignored, +except that more than 9 arguments will cause error 15. If too +few arguments are present, error 30 occurs. If too many output +values are specified, the extra values will be garbage. If too +few output values are specified, only those specified will +receive information, and any extra output is thrown away. +Specifying more than one error return parameter causes error 15. +Specifying an illegal sixbit name for the call causes error 43. + +If an error return parameter is specified, then if the call +takes the non-skip return an error code will (probably) have +been stored into the error return parameter. It is also +stored into the I/O Status Word of some channel, as before. +If the call fails but no error code is returned, the error +return parameter is zeroed. Note that the error return parameter +is also zeroed if the call succeeds. Also, since this zeroing +takes place when the arguments are first processed, the error +return parameter should not be located on top of any input +arguments. Only one error return parameter is permitted. + +The values of all control bit parameters given are XOR'ed +together, and the result may or may not be used by the system +call. Only the right half of a non-immediate control bit +parameter is significant. Some system calls XOR the left +half of their first argument with the control bits as well. + +FAILURE CODES: Returned by New System CALLs (and .OPEN's, etc.) + +The failure code from a new system call that doesn't skip can be +obtained by reading the .USET variable .BCHN to find the number of +the channel on which the code was returned, and then reading +that channel's .IOS variable (using the .STATUS uuo or +the STATUS symbolic call) to get a word with the error code +in bits 3.6-3.1. + +Alternatively an error return code argument may be specified and the error +code will be stored right-justified (not in bits 3.6-3.1, but bits 1.6-1.1). +To get the corresponding message from the ERR device, use a first file +name of 4 (number, not sixbit) and use the error code as the second file name. + +The error codes which may be returned by each individual call are described +in the documentation for that call. Note that if the call is interpreted +by a job device, any error code may be returned, not just those documented; +job devices should, however, adhere as closely as possible to normal +error code conventions. Errors codes 15, 30, 43, and 44 may be returned by +any symbolic system call, and so are not included under the individual +descriptions. + +The ERR device can be used to get a corresponding message as indicated in +the table on the following page. See the OPEN system call for information +on the ERR device. + +The error codes have symbolic names, which are pre-defined in DDT and +MIDAS. The first two characters in the name are "%E". The remaining +letters usually follow the following conventions. 3rd and 4th letters: +"TM" = "too many", "BD" = "bad or illegal", "TF" = "too few", "RO" = +"read-only", "NA" = "not available", "NS" = "no such", "EX" = "already +exists", "FL" = "full", "NR" = "not ready". 5th and 6th letters: "JB" = +"job", "RG" = "arg", "DV" = "device", "DR" = "directory", "IO" = +"direction", "FL" = "file", "FN" = "file name". + +ERROR CODES: + +Number Symbolic Message +------ -------- ------- +1 %ENSDV NO SUCH DEVICE +2 %ENSIO WRONG DIRECTION +3 %ETMTR TOO MANY TRANSLATIONS +4 %ENSFL FILE NOT FOUND +5 %EFLDR DIRECTORY FULL +6 %EFLDV DEVICE FULL +7 %ENRDV DEVICE NOT READY +10 %ENADV DEVICE NOT AVAILABLE +11 %EBDFN ILLEGAL FILE NAME +12 %ENSMD MODE NOT AVAILABLE +13 %EEXFL FILE ALREADY EXISTS +14 %EBDCH BAD CHANNEL NUMBER +15 %ETMRG TOO MANY ARGUMENTS +16 %ENAPK PACK NOT MOUNTED +17 %ENADR DIRECTORY NOT AVAIL +20 %ENSDR NON-EXISTENT DIRECTORY +21 %ELCDV LOCAL DEVICE ONLY +22 %ESCO SELF-CONTRADICTORY OPEN +23 %ENAFL FILE LOCKED +24 %ETMDR M.F.D. FULL +25 %EMCHN DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +26 %ERODV DEVICE WRITE-LOCKED +27 %ETMLK LINK DEPTH EXCEEDED +30 %ETFRG TOO FEW ARGUMENTS +31 %EROJB CAN'T MODIFY JOB +32 %EROPG CAN'T GET THAT ACCESS TO PAGE +33 %EBDRG MEANINGLESS ARGS +34 %EBDDV WRONG TYPE DEVICE +35 %ENSJB NO SUCH JOB +36 %EBOJ VALID CLEAR OR STORED SET +37 %ENACR NO CORE AVAILABLE +40 %ETOP NOT TOP LEVEL +41 %ENAPP OTHER END OF PIPELINE GONE OR NOT OPEN +42 %ENAJB JOB GONE OR GOING AWAY +43 %ENSCL ILLEGAL SYSTEM CALL NAME +44 %ENSCH CHANNEL NOT OPEN +45 %ENRBF INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +46 %EBDFL UNRECOGNIZABLE FILE +47 %EBDLK LINK TO NON-EXISTENT FILE + +ARGS: Special Common Types of Arguments + + TTY channel # + STY channel # (accesses TTY which is STY's alter ego) + 400000 + TTY # (may be used to examine TTY variables, + but not to alter them or to transact input/output) + + channel # for USR device + channel # for JOB device (means job on other end, + unless argument may also be a , in which + case the job device will interpret things) + channel # for BOJ device (means calling job) + channel # for STY device (means job possessing + the corresponding TTY) + 400000 + job # (user index) + -1 or 777777 specifies self. + 400377 specifies superior. + 400376 specifies the pdp6. + + The symbols %JSELF (777777), %JSNUM (400000), %JSSIX (400376), + and %JSSUP (400377) are pre-defined in MIDAS and DDT. + Various other symbols beginning with %JS are defined + for special codes that can be used instead of a + spec with certain calls; they are documented + under those calls. + + channel # for JOB device + + Many symbolic system calls which take a channel number + as the first argument may be passed to JOB devices + for interpretation by that device. A few act on the device + itself, and are not passed for interpretation. Those + passed for interpretation include: + ACCESS CNSGET CNSSET + DIRSIZ DSKUPD FILBLK + FILLEN FINISH FORCE + JOBCAL JOBGET JOBINT + JOBIOC JOBRET JOBSTS + LISTEN NETAC NETBLK + NETINT RAUTH RHCST + RCPOS RDMPBT RENMWO + RESET RESRDT RFDATE + RFPNTR RSSIZE SAUTH + SCML SCPOS SDMPBT + SETIOC SFDATE SRDATE + SREAPB STLGET STYGET + TTYGET TTYSET TTYVAR + TVWHER WHOLIN WHYINT + + The JOB device may of course interpret such calls in + any way desired, and return any results desired. + It is of course advisable to adhere as closely to + the standard actions of each call as possible. + + Most of the above calls simply pass the symbolic + call name and arguments along to the JOB device. The + following have special interfaces for historical reasons: + + ACCESS RCHST RENMWO + RESET + + The following calls can open up a JOB device if their + sixbit device name argument is not the name of a + device that is built into the system: + + DELETE MLINK OPEN + RENAME + + Those calls which are definitely NOT passed for + interpretation include: + CLOSE + IOT + SIOT + STATUS + RFNAME + IOPUSH + IOPOP + These calls interact with the JOB device in another way. + +A number of these calls include special bits and fields in their +arguments or return values. Several files exist which contain +symbolic definitions of these bits and fields. These files +can be inserted into a MIDAS program with .INSRT. In addition, +most of the symbols are predefined in MIDAS and DDT through +a symbol table in the system. The symbols defined are the same +as used in this documentation. + +The following files exist on the SYSENG directory. + + FSDEFS > Bits in fields used by the file system, + including the format of directories. + ITS BITS Miscellaneous bits and codes. + +The following errors are standard for all calls that take +arguments, and are generally not documented under the individual +calls: + + 14 BAD CHANNEL NUMBER + The argument was not a special negative code, not + 400000+a user number, and not a valid channel number. + 33 MEANINGLESS ARGS + A random number that could not be decoded was given + as a argument. + 34 WRONG TYPE DEVICE + A channel number was specified that did not have open an + appropriate type of device (generally USR, STY, or BOJ). + 35 NO SUCH JOB + 400000+user number was specified, but the user number + did not correspond to a currently-existing job, or + 400377 was given, specifying the superior, but the job + was top-level. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + A STY channel number was specified, but the corresponding + TTY was free and had no associated job. + 42 JOB GONE OR GOING AWAY + The specified job exists but is in process of being killed. + +The following errors are standard for all calls that take arguments: + + 1 NO SUCH DEVICE + 400000+tty number was specified, but there is no tty with the + indicated number. + 14 BAD CHANNEL NUMBER + The argument was not 400000+tty number and was not a valid + channel number. + 34 WRONG TYPE DEVICE + A channel number argument does not refer to a channel open + to a STY or a TTY. + 44 CHANNEL NOT OPEN + The specified channel is not open. + +ACCESS: set file access pointer + + arg 1 Channel number. + arg 2 New access pointer. This pointer is + the number of bytes from the beginning + of the file of the next byte to be + processed. Note that in block mode, + even ASCII block mode, a byte is always + a full word. + + This is useful primarily for DSK and disk-like job devices; + that is, any device which has "files." + + See also the .ACCESS uuo. + +Errors: + + 14 BAD CHANNEL NUMBER + + If the ACCESS pointer is set to more than the number of words in + in the file, an IOC error 2 will occur on the next IOT operation + on that channel. + +ATTACH: attach a job-tree to a console (ITS DETACH) + + cbits 2.9 If there are 2 args, causes the jname + of the job being attached to be changed + to HACTRN, unless there is already a HACTRN. + 1.3 "P" the job by clearing bit 4.4 of .USTP + arg 1 to be attached to the console. + arg 2 Optional: to attach it to. Must be free. + If not present, the executing job must be + top-level and console-controlled; it is logged + out, and its console used as the tty to attach to. + + Attaching a job tree to a tty causes the job tree to be + console-controlled with the specified tty as its console. + The specified job must be either the top-level job of + a disowned job tree, or a direct inferior of the job executing + the ATTACH; in the latter case the specified job is disowned + first. The tty to be attached to must be free. In the + one-argument case the job executing the ATTACH must be the + top-level job of a console-controlled job tree; it is logged + out to make the console free. The one-argument case furthermore + causes the attached job to take on the jname of the job + executing the ATTACH. In the 2-argument case, control bit + 400000 causes the attached job to take on the jname HACTRN, + unless that would cause it to have the same names as an + existing job. + + The one-argument case is made available in DDT via the + command :ATTACH, which attaches the current job to the console. + Also, when a user logs in (say as FOO), DDT checks for the + existence of a job called FOO HACTRO; if it exists, DDT asks: + --ATTACH YOUR DETACHED JOB-- + If at this point the user types a space, DDT executes the + commands "HACTROJ :ATTACH ", thereby attaching the HACTRO to + the console, and changing the HACTRO's name to HACTRN. + This affords a convenient method of recovery from automatic + detachment. + + See the DETACH symbolic system call. + +Errors: + + 10 DEVICE NOT AVAILABLE + This job's tree is not console-controlled (one argument); + the specified tty is not free or does not exist (two arguments). + 14 BAD CHANNEL NUMBER + The first argument is not a valid channel number. + 31 CAN'T MODIFY JOB + The specified job is not disowned or a direct inferior. + 34 WRONG TYPE DEVICE + First argument must be a job. + 35 NO SUCH JOB + First argument specified a non-existent job. + 40 NOT TOP LEVEL + The executing job must be a top-level job (one argument). + +ATTY: pass tty to inferior + + arg 1 + + The tree's console tty is passed to the , which must + be a direct inferior. This is the same as the .ATTY uuo. + +Errors: + +31 CAN'T MODIFY JOB + The specified job is not a direct inferior. + +34 WRONG TYPE DEVICE + The specified job is the pdp-6. + +42 JOB GONE OR GOING AWAY + The specified job is dying. + +CALL: perform system call + + arg 1 Name of symbolic system call to perform. + + The other arguments serve as the arguments to the + specified symbolic call. The values and errors returned by + that call become the values and errors of this call. + This is useful if the name of a symbolic call is to be + determined dynamically. Lisp hackers should think of this + as the "Funcall" system call. + +CHAOSO: open Chaosnet connection + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - receive window size + + First, the two specified channels are closed. Then an index + is assigned to the user and the two channels are set up to + point to it. Two channels are used since in general ITS + channels are unidirectional, and to allow to the user to + handle receive and transmit interrupts differently. + + The created index is placed in the Closed state. To set up + a connection, IOT an RFC or LSN packet down the transmit + channel. + +CHAOSQ: Chaosnet Queue + + arg 1 - address of a 126.-word block (packet buffer) + + This is a special system call for use by the ATSIGN CHAOS + program, which is a daemon program that gets run when + an RFC is received that does not match up against an + existing LSN. + + The first packet on the pending-RFC queue is copied + into the packet buffer, then moved to the end of the + queue (so that the right thing happens when several + RFC's are pending at the same time.) + + The call fails if the pending-RFC queue is empty. + + The program should use the contact name in this + packet to choose a server program to execute. This + server program will then LSN to (presumably) the same + contact name, thus picking up the RFC. + +CLOSE: close input/output channel + + arg 1 Channel number to close. + + The specified input/output channel is closed. + + For TCP connections: + A CLOSE on the output channel will cause an automatic FORCE, + and a FIN segment will be sent to the remote host indicating + "no more data to send". However, the input channel will + remain open, and data can continue to be read from it. + A CLOSE on the input channel will cause any further input received + to be thrown away by ITS. Output can continue to be sent. + Return from this call is immediate; it will not hang. Note that, + like NCP, this does not allow the user to determine + whether the last stuff successfully reached the destination or + not. When this is desirable, a FINISH should be done prior to + the CLOSE. + +For the Chaosnet: + Immediately closes the connection. All buffers and other + information associated with the index are discarded. Normally + the user should first IOT a CLS + packet containing an ascii explanation for why it is + closing. Note that any data previously written on the + connection but not yet received by the other end will be + lost. The system will attempt to send a CLS with reason + "channel closed", but this will only be sent if buffer space + is available. + + See also the .CLOSE uuo. + +CNSGET: get various console parameters (ITS TTY) + + arg 1 or + val 1 Vertical screen size. + val 2 Horizontal screen size. + val 3 TCTYP variable. + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + val 4 TTYCOM variable. + 4.9 Communicate mode. + 4.8 %TCLFT Local feed through (my job sees his typing). + 4.7 %TCRFT Remote feed through (his job sees my typing). + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 4.1 %TCECH The last output to this tty was PI echo. + 3.9 %TCINP Someone waited for input since last home-up. + 3.8 %TCDET Console's tree detached by top level interrupt. + 3.7 %TCDNG Type bell (input buffer full). + 3.6 %TCCBK Reading uname or tty number after ^_K. + 3.5 %TCCBS Reading uname or tty number after ^_S. + 3.4 %TCFPD First part of an output code sequence is done. + 3.3 %TCTPN Type ^_N on leaving comm (unless user types it). + 3.2 %TCPAD 0 => padding necessary on datapoint. + 3.1 %TCHNG Done flag seems to be fried - time out quickly. + 2.9-1.1 -1 if not in comm mode; otherwise number of + next tty in circular list of those in comm mode + together. + val 5 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + val 6 TTYTYP variable. + 4.9 %TTLCL Local tty (i.e. right near the PDP-10). + 4.8 %TT340 Near the 340 or a 340 slave. + 4.7 %TT3HP High priority for grabbing 340. + 4.3 %TTPAR Tty needs a parity bit generated by software. + 4.2 %TTDDI Don't ding bell on excess input. + 4.1 %TTIBM Datel (2741) line. + 3.8-3.5 $TTISP Input speed code: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + 3.4-3.1 $TTOSP Output speed code, as above. + 2.9 %TYDPK Datapoint controller line. + 2.8 %TYSTY Alter ego to a STY. + 2.7 %TYNVA Nova tty (requiescat in pace). + 2.6 %TYMTY Morton controller line. + 2.5 %TYDIL Dial-up line. + 2.4 %TY11T PDP-11 TV tty. + 2.3 %TYDL DL-10 tty. + 2.2 %TYOTY KA-10 console tty. + 2.1 %TYETY DTE-20 tty. + 1.9 %TYNTY TK-10 tty. + 1.8 %TYMDM Dial-up line with modem control. + 1.7 %TYKST KS-10 console tty. + 1.6 %TYDZT DZ-11 tty on a KS-10. + 1.5 %TYRLM ROLM data switch tty. + val 7 TTYSMT variable. + 4.9-4.7 %TQMCH Machine type + 0 = nothing special 1 = PDP11 2 = PDS4 + 3 = PDS1 + 4.6-4.2 %TQHGT Character height in dots + 4.1-3.7 %TQWID Character width in dots + 3.6 %TQVIR Terminal implements virtual coordinates + 3.5 %TQBNK Terminal implements blinking + 3.4 %TQXOR Terminal implements XOR mode + 3.3 %TQREC Terminal implements rectangle commands + 3.2 %TQSET Terminal implements multiple object sets + 3.1 %TQGRF Terminal understands graphics protocol + 2.9 %TRGIN Terminal has graphic imput + 2.8 %TRGHC Terminal has graphic hardcopy + 2.7 %TRLED Terminal has local editing protocol + 2.6 %TRSCN Terminal implements raster commands + 2.5-2.3 %TRLSV <>0 means terminal supports 4**N saved lines + 2.2-1.7 %TRTIM signed offset from GMT minus 20 or zero if + terminal's timezone is unknowable. + + See also the CNSSET, TTYGET, and TTYSET symbolic system calls. + +CNSSET: set various console parameters (ITS TTY) + + arg 1 or + arg 2 Vertical screen size (negative => no change). + arg 3 Horizontal screen size (negative => no change). + arg 4 TCTYP variable (negative => no change). + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + arg 5 TTYCOM variable. + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 3.9 %TCINP Someone waited for input since last home-up. + The remaining bits, documented under CNSGET, may not be changed. + arg 6 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling. + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + + Omitting an argument also means no change (only works + if all arguments after it are also omitted, of course.) + Not all bits of the variables are settable; those explicitly + not user-settable have been omitted above. If contradictory + bits are supplied, the system will reconcile the conflicts. + See also the CNSGET, TTYGET, and TTYSET symbolic system calls. + +CORBLK: modify blocks of core in page map (ITS CORBLK) + + cbits 2.9 %CBWRT Try to get write access; okay if can't. + 2.8 %CBRED Try to get read access; okay if can't. + 2.7 %CBNDW Try to get write access; fail if can't. + 2.6 %CBPUB Make page public. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + Any job is allowed to get write access to + a public page. + 2.5 %CBPRV Make page private. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + A job can have write access to a private page + only if it is getting the page from itself or + a job it is allowed to write in, and that job + has write access itself. Pages are usually private. + 2.4 %CBNDR Fail if can't get read access + (attempting to share with a non-existent page). + 2.3 %CBCPY Make a copy (disk files only). + 2.2 %CBLOK Lock page in core (don't allow swap out.) + 2.1 %CBULK Unlock page from core. + 1.9 %CBSLO Force page to reside in slowest memory. + This is useful when trying to get + reproduceable run time measurements. + 1.8 %CBUSL Undo the effect of %CBSLO + Bits 2.2-1.8 are not yet implemented. + All zero means delete page from page map. + arg 1 RH and LH are XOR'd with control bits. + arg 2 to put page into (or delete it from). + arg 3 Page number within job specified by arg 2. + If LH negative, block mode operation: + After doing operation, increment arg 5 if any, + AOBJN arg 3, write args back into user core, + and repeat the operation, until LH of arg 3 + becomes positive. + arg 4 Any one of the following: + to get page from. + Disk channel number. + When disk file pages are inserted, + the access pointer is left pointing + after the last word of the last page + inserted. + If the pages so inserted are inserted + with write access for modification, + the DSKUPD symbolic system call may + be used to set the creation and + reference dates for the file. + PDP-6 channel number. + One of the following special negative codes. + Only the right-half matters. + -2 %JSTVB means video buffer pages. + Pages 0-7 are video buffer. + First word of page 10 contains + console register and ALU. + See the .TVCREG user variable, + and the VIDBUF and VIDSW symbolic + system calls. + -5 %JSNEW get a fresh page. A new page, not + shared with any other, will be created. + The system tries to zero it out, but + currently may fail to if there is already + a page at the destination address. If + wasn't very difficult to fix, I'd fix it + instead of documenting it. + -6 %JSABS an absolute page. Arg 5 specifies the + desired page of physical memory. You are + not permitted write access to such a page. + 400000 specifies the system job (job # 0). Sharing + a page with the system job is almost like + getting an absolute page via %JSABS, since + the system job's address space mostly + corresponds to physical memory. + 400001 specifies the core job. For historical + reasons, this is taken to mean get a fresh + page instead. This special case will go + away some day, so use %JSNEW instead. + If arg 4 is omitted, it is the same as arg 2. + arg 5 Page number within source specified by arg 4. + Arg 5 is ignored for fresh page. + If omitted, same as arg 3 if source is a job. + If source is a disk file, the current access + pointer rounded down to a page boundary + is the default. + +Errors: + + 10 DEVICE NOT AVAILABLE + PDP-11 TV not available for mapping. + 14 BAD CHANNEL NUMBER + Argument 2 or 4 is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 2. + 32 CAN'T GET THAT ACCESS TO PAGE + Can't satisfy access requested by cbits 2.7-2.4. + This usually means that the page does not exist in the + source specified in argument 4, or that it exists but + write access is not permissible. It may also mean that + an absolute page which normally exists is currently down. + 33 MEANINGLESS ARGS + Page number outside range 0-377 for another job's page, + or outside 0-10 for a video buffer page, + or outside 0-17 for a PDP-6 page. + The allowed range for absolute pages depends on the machine. + 34 WRONG TYPE DEVICE + Can't map pages from any device other than those listed above. + 35 NO SUCH JOB + Argument 2 or 4 specified a non-existent job. + 37 NO CORE AVAILABLE + Tried to get fresh page, but no more (virtual) core is available. + The total number of distinct pages in the system is limited + by the size of the MMP table. + +CORTYP: determine type info from page map (ITS CORBLK) + +If one argument: + arg 1 Page number within current job. +If two arguments: + arg 1 + arg 2 Page number within specified job. + val 1 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page is readable (exists). + 4.6 %CBPUB Page is public (writable by anyone) + 4.2 %CBLOK page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + For non-existent page, whole word is zero. + Thus, this value is: + zero => no page. + positive => read-only page, + negative => writable page. + val 2 0 Absolute page. + -1 Unshared page. + other User index of next job in circular + list of jobs sharing the page. + val 3 For val 2 = 0, absolute page number. + For val 2 = -1, zero. + Otherwise, page number within job specified + by val 2. + val 4 4.9 Page is in core. + 2.9-1.1 Number of times page is shared (zero + for absolute or non-existent page, + else >=1 ). + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + Page number was outside range 0-377. + 34 WRONG TYPE DEVICE + Channel not open on USR, BOJ, JOB, or STY device. + 35 NO SUCH JOB + +DELETE: delete a file + + Either + arg 1 Byte pointer to ASCIZ filename string, + or aobjn pointer to block of such byte pointers. + + or + arg 1 Left-justified device name, in SIXBIT. + arg 2 File name 1 in SIXBIT. + arg 3 File name 2 in SIXBIT. + arg 4 Sname in SIXBIT. + + The file specified either by the four SIXBIT names or by the + ASCIZ string(s) is deleted. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + +DELEWO: Delete file While Open. + + arg 1 Channel number. + + The file open on the channel is marked for deletion. + It is actually deleted as soon as all channels referencing + it (including the one used by the DELEWO) are closed. + In the meantime, it is inaccessible (starred in the directory). + Either an input channel or an output channel can be used. + +Errors: + + 34 WRONG TYPE DEVICE + This call works only on DSK, and such job devices as simulate DSK. + +DEMSIG: demon signal + + arg 1 Sixbit name of demon to signal. + arg 2 Optional: + zero => signal once only. + positive => signal repeatedly every 2*n minutes. + negative => load demon but do not signal. + + A demon is a program which runs (and perhaps even exists) + only when a request has been signaled for it. If the + demon with the specified demon is not currently running, + the system job creates a demon job and loads it from the + file SYS:ATSIGN , where is the name of the + demon. + When the demon runs, it can acknowledge receipt of one + or more signals by using the .DEMON uuo (q.v.). + The status of a demon can be examined and altered by + using the RDDMST and STDMST symbolic system calls. + When the system is started up, there is a once-only + signal for the DEMSTR demon pending; this demon normally + signals requests for all other standard systemic demons. + + Demons were much used on the DM machine for various purposes. + Standard demons which are started by the DEMSTR demon include + (as of July 23, 1975): + NAME REPT RATE PURPOSE + TCTYP 0 Set terminal types?? (Doesn't exist on SYS) + UNSPOO 0 Line printer unspooler (TPL). + SURVEY 10. Network survey generator. + LDRDEM 0 Loader demon (obsolete). + BATCHM 0 Old batch monitor (obsolete). + COMSYS 0 Old message demon (obsolete). + NETRJS 0 CCN remote job server demon. + ZONE 0 MUDDLE compile batcher. + MG 0 Maze Guncher - kills games of MAZE + in an obscure way. AV doesn't like them. + COMDMN 0 Communications demon (replaces COMSYS). + BATCHN 0 Batch monitor (replaces BATCHM). + RFC402 0 Message archival demon. + +DETACH: detach a job tree from a console (ITS DETACH) + + arg 1 for any job in the tree to be detached. + If omitted, the tree referred to is that + of the executing job. + cbits 1.1 Leave the detached tree as a non-disowned, + non-console-controlled tree, instead of as + a disowned tree. + 1.2 Use system tree's resource word instead + of disowned resource word. This is to + be used only by legitimate system daemons. + 1.3 "P" the job by clearing bit 4.4 of .USTP + 1.4 if an hour goes by and the detached tree + does not run and is not reowned or attached, + it will be killed automatically by the system. + 1.5 suppress the console-free message that would + otherwise be printed on the tree's console. + The entire job tree which the specified job belongs + to is made to be disowned. If it was controlled by + a console, that console is made free. If the tree is + already disowned, nothing happens, but the DETACH call + skips anyway. If the top level job of the tree has a + jname of HACTRN, the jname is incremented to be HACTRO + and then re-incremented as necessary to make its uname- + jname pair unique. + + DDT provides a command :DETACH which detaches the tree + the DDT itself is in. LOCK provides a DETACH command + for detaching other trees conveniently: + DETACH detaches the tree containing the + job with user index . + DETACH detaches the tree containing + the job named . + + Automatic detachment by the system job: + Fatal interrupts in top-level jobs will cause them to be stopped + and then detached by the system job, which will type the message + TOP LEVEL INTERRUPT, TREE DETACHED + on the console detached from, followed by the normal + console-free message. A message is also printed on the system + console saying which job was detached from which terminal. + + If the PDP-11 controlling the TV consoles crashes, the system + job automatically detaches all job trees controlled by TV + consoles. This allows the user to log back in and re-attach + his job tree when the PDP-11 is restarted. + If the ARPA network crashes (that is, the local network + attachment crashes, or the host which is connected to + the console of a particular console-controlled tree + crashes) the server telnets automatically detach those + job trees whose consoles are no longer connected to anything. + On some ITS machines if a dial-up line is disconnected + the job tree controlled by that line will be automatically + detached. Other ITS machines do not have the hardware to + to detect disconnection. + When a tree is detached because its tty, whether TV, network + connection, or dialup line, has disconnected, then if the + tree is not logged in it will be killed immediately. + + Whenever a tree is detached automatically for any of the + reasons mentioned above, control bit 1.4 is used, so the + tree will go away if it is not touched for an hour. + + See the ATTACH and DISOWN symbolic system calls. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Cannot detach the SYS or CORE jobs, or the PDP-6. + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + +DL10MP: Hack the DL10 (pdp11 interface) + + THIS SYSTEM CALL CAN CRASH THE SYSTEM IF MISUSED. IT SHOULD + NOT BE USED LIGHTLY. + + arg 1 Page number + val 1 AOBJN pointer to DL10 control area + val 2 Pointer to 3 words for pdp11 examine/deposit commands + val 3 Pointer to first free word in DL10 control area + + A read/write, unencached, absolute page is created at the + specified page number in the user's address space. The page + contains the DL10 control area, which can be used to examine, + deposit, or bootload the pdp11. A message is printed on the + system console when this call is used. + +Errors: + +13 FILE ALREADY EXISTS + The page slot specified is already in use. + +33 MEANINGLESS ARGS + The page number is invalid. + +DIRSIZ: read the total size of files in a directory. + + arg 1 The number of a channel open on the DSK device, + or a . The channel should be open to a file + in the directory to be hacked. + + arg 2 (optional) quota + + arg 3 (optional) dsk number,,allocation + + val 1 quota,,total number of disk blocks used by files + this directory + + val 2 dsk number,,allocation (normally 0). + +DISMIS: dismiss an interrupt (ITS INTRUP) + + arg 1 Points to the third of three words which + are the new .DF1, .DF2, and .UPC + variables for use in dismissing the interrupt + (but see the cbits for this call). + If not an immediate argument, it is assumed to + be a pdl pointer which is appropriately + popped three times to get these items. + It is then popped twice more to flush the + two interrupt words pushed by a new-style + vectored interrupt. + If the job has enabled the pdl overflow + interrupt (bit 2.8 of the .MASK user variable) + then it will receive such an interrupt if the + popping by DISMIS causes pdl underflow. + arg 2 If present, overrides the new pc on the + stack specified by arg 1. + arg 3 If present, overrides the new .DF1 on + the stack specified by arg 1. + arg 4 If present, overrides the new .DF2 on + the stack specified by arg 1. Thus if four + arguments are supplied, the first is + effectively ignored, except for popping. + arg 5 If present, is the ,, + for a LOSE that is done, uninterruptably, + after the interrupt has been dismissed. + + cbits The control-bits for this argument specify + extra words to be popped off the pdl pointer + which is the first arg, BEFORE the PC and defer + words are popped. The cbits are ignored if the + first arg is immediate. The intention is that + the cbits will tell DISMIS how to pop exactly + what was pushed when the interrupt happened. The + format of the cbits is the same as that of the LH of + the first word of the interrupt table (for new-style + vectored interrupts) (see ITS INTRUP), which is what + specifies what is to be pushed when an interrupt happens. + It is: + 2.9=1 => throw away three words first thing. Throws away + the debugging info that interrupts can push. + 1.1-1.5 nonzero => it is number of ACs to be popped, + and 1.7-2.1 is the number of the lowest AC to be popped. + The ACs to be popped are BLT'ed out of the stack. + + If four arguments are supplied and the first is + immediate, then the first is totally ignored (except + that the address calculation is performed). + Thus this call is good for dismissing old-style + interrupts as well as new-style (stack oriented) + interrupts. + + Note that if the job is using the feature that interrupts + automatically push some accumulators or some debugging info, + it must explicitly request (with the control bits) that the + same words be popped. DISMIS does NOT vary its function + according to the job's interrupt table, for a given set of args. + + If the interrupt handler wishes to pretend that a class 2 + interrupt had not been enabled, it can dismiss the interrupt + and supply a fifth argument which is like the first argument + to a symbolic LOSE system call. Making the rh of that + argument 1+.LZ will cause DDT to print the + error message appropriate to an unhandled interrupt on that + bit. The lh. of that argument should be the address of + the instruction that caused the interrupt. + + See also the .DISMISS uuo. + +DISOWN: disown an inferior job + + cbits 1.4 Set BUMRTL, saying that if for one hour the + job does not run and is not attached or reowned + it should be gunned down by the system. + 1.3 Perform .USET ,[.SUSTP,,[0]]. + In this way the job is not started until + after being disowned. + 1.2 Use the system resource word instead of + the disowned job resource word for scheduling. + 1.1 Make this job not disowned, but rather the + top-level job of a non-disowned, non-console + controlled job tree. This prevents the job + from receiving 1/4'th priority as ordinary + disowned jobs do. + arg 1 A directly inferior . + + Please do not misuse the 1.1 and 1.2 control bits. These are + intended for generally useful "system daemons" only. + + The specified job is caused to be no longer an inferior of + the executing job, and is made to be the top level + job of a disowned job tree. Because of this, the disowned + job will continue to exist even if its erstwhile superior + does not (if, for example, the user logs out). + + Disowning is illegal if the executing job has given control + of its console to the job to be disowned (see .ATTY). + + All channels on which the executing job has open the job being + disowned will be closed in the process of disowning (see the + .CLOSE uuo). If the disowned job has opened the + console, then the channels are not closed, but + are marked as "disowned tty"; certain operations + on such a channel will succeed, and others will hang + until the job is re-owned and a console tty given + to the job. Such channels appear to be open on + tty number %TINON=77 octal. + A disowned job is distinguished by the fact that + bit 4.9 of its .APRC user variable is set. + A disowned job never succeeds in executing the RELOAD symbolic + system call, even if it is the top level job in its tree. + When a job tree is logged out, any micro-tapes assigned + to the uname of that job tree are de-assigned (see the + .ASSIGN and .DESIGN uuo's), but only if the job tree is + not disowned. + All disowned jobs share a resource word for purposes of + scheduling, in the same way that all jobs in a single + non-disowned tree share a resource word. Thus all disowned + jobs tend collectively to use no more runtime than any + single non-disowned job tree. + Furthermore, individual disowned jobs are given only 1/4 + the priority to run as a non-disowned job. This does + not apply, however, if the disowned job in question has + .MASTER mode, or controls the 340 display, the E&S display, + the vidisector, the arm, the LPT (line printer), or the + PLT (plotter). + When operating under heavy loads, the swapper prefers to + swap out disowned jobs rather than non-disowned jobs. + + The DETACH symbolic system call makes a non-disowned tree + disowned. See also the %OPDET bit of the .OPTION user + variable. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job must be a direct inferior. + +DSKUPD: disk update + + arg 1 Disk channel number or + + The creation and reference dates for the disk file + open on the channel are set to the current date and time. + The dump check bit is cleared (! will show in the + directory). + This is useful for programs which modify a file by + mapping pages of the file into their page maps with write + access, and which want to indicate this fact by setting + the creation and reference dates. See the CORBLK symbolic + system call for mapping pages of disk files. + + See also the FILBLK, RESRDT, RFDATE, and RQDATE + symbolic system calls. + +Errors: + + 34 WRONG TYPE DEVICE + The supplied channel number must be a disk or JOB device channel. + +ECHOIN: echo characters and store them in a buffer, until a break character + + arg 1 TTY channel number + arg 2 Byte pointer to buffer + arg 3 Number of characters left in buffer + arg 4 Address of break table + arg 5 Address of TECO buffer block (or zero) + + The second and third arguments are counted out as characters + are stored. When the call returns due to a break character, the + count will still be greater than zero. + + ECHOIN tells the system to echo characters and insert them in + the buffer specified by the second and third arguments without + requiring the user program to be executed. This is more + efficient and gets visibly faster response time. Echoing + stops when either the count is exhausted or a break character + is input. When this happens, the ECHOIN returns. If it returns + because of a break character, then the break character + is available for normal input. Non-break characters following + the break character are not handled. + + Break characters are specified by the break table, + a four-word block pointed to by the fourth argument. Each of + the four words says, for 32 characters, whether they break + or not. In the first word, the sign bit is for SAIL code 0, + and bit 1.5 is for SAIL code 37. The sign bit of the second + word is for Space, and bit 1.5 is for ?. And so on. + Characters with Control or Meta set (including ASCII control + characters on non-Meta keyboards) are always break characters. + + To prevent timing errors, ECHOIN will return immediately if + there are characters in the input buffer already. + + For use by TECO, ECHOIN can update the block of counters which + TECO uses to remember the extent of the buffer. The fifth + argument should point to this block, the "Buffer block", which + is seven words long. When a character is inserted, the first + two words of the buffer block are not changed, the next four + are incremented, and th next one is decremented. Passing the + buffer block to ECHOIN allows ECHOIN to insert characters + directly into TECO's buffer as an indivisible operation. + Note that the insertion of the characters themselves is still + controlled by the byte pointer and count arguments. + However, in the future this may change; when ECHOIN is made + able to handle operations besides insertion, it will use the + buffer block for updating the buffer (which may involve deletion) + but will still insert all characters it processes down the byte + pointer. This way, TECO will have both an updated buffer and + a list of the commands which the user typed. + +FILBLK: get contents of file parameter block + + arg 1 Disk channel number or + val 1 First file name. + val 2 Second file name. + val 3 Random information: + 4.9 Dump check bit. + 4.7-3.7 Word count of last block. + 3.6 Has been deleted from an + unmounted pack. + 3.5 Delete the file when closed. + 3.4 GC mark bit. + 3.3 Open for writing. + 3.2 The grim file reaper should not reap this file. + 3.1 This is a link, not a file. + 2.9-2.5 Pack number. + 2.4-1.1 Pointer to internal UFD descriptor. + val 4 File creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + val 5 File reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.1-2.9 Author, as M.F.D. index. + 1.1-1.9 File byte size and bit count in compressed form. + + See also the DSKUPD, RESRDT, RFDATE, RQDATE, SFDATE, + and SRDATE symbolic system calls. + +FILLEN: get file length + + arg 1 Disk channel number or + val 1 File length in bytes of the size + the channel is open in. + val 2 The size of those bytes. + val 3 File length in bytes of the size used to + write it (actually, the size in use the + last time it was opened for writing). + val 4 The size of those bytes. + + The length of the file open on the specified channel + is returned. + + +Errors: + + 34 WRONG TYPE DEVICE + Currently FILLEN works only for disk files and job devices. + +FINISH: wait for output to reach the device + + arg 1: channel # + + Does a FORCE (see below) then waits until all buffered + output has reached the device. + + The following devices currently support FINISH. + + TTY: STY: DSK: NET: CHA: TCP: + + TCP: Does a FORCE (ensures that data is PUSH'd out) and + waits until all data thus far has been ACK'd, i.e. acknowledged + by the foreign host. + + Chaosnet: (channels opened with CHAOSO) + On an output channel, does FORCE and then waits until + there are no queued output buffers. I.e., waits for + all output to be received and acknowledged by the foreign + host. This in fact waits for acknowledge, not just receipt. + +Errors: +* Any errors which the FORCE call might encounter. + +FLAP: flap a micro-tape + + arg 1 Micro-tape number (typically 1-4). + + The directory for the micro-tape is written back onto + the tape if it is currently in core; the tape is then + physically dismounted by running the tape back onto + the original reel (thereby making the tape go flap, flap, + flap ...). Micro-tapes should not be manually dismounted, + for this will cause the directories to get out of phase, + messing up the dismounted tape and also the next one to + use the drive. The FLAP will fail if any files are still + open on the specified drive, or if any one else has the + drive assigned to him. + See also the .UDISMT uuo. + +FLUSH: wait for output to reach the device + + arg 1: channel # + + This call has been renamed to FINISH (in ITS 1052). + The old name will be kept around for a while, but new + programs should not use it. + +FORCE: empty out device's output buffers + + arg 1 - channel # + + If any output is buffered for the device, it is now sent + to the device. Note that this is not needed for the TTY + device since output is always sent as soon as possible. + + It is not necessary to do a FORCE before doing CLOSE. + + The following devices currently support FORCE: + + NET: Causes output to be sent as soon as possible; + otherwise it would only be sent when the buffer + was full or when 2 seconds have elapsed since + output was first put in the buffer. + + TCP: Same as NET, except that the PUSH flag is set + in outgoing segments. If there is no buffered data, + nothing is sent. (Note that ITS TCP always sets PUSH + in all outgoing segments whether FORCEd or not. + Otherwise, a FORCE with an empty buffer would require ITS + to re-send old data with PUSH set in order to nudge the + remote site into action.) + + DSK: Causes the current output buffer and the directory + to be written to disk. + + Chaosnet: (channels opened with CHAOSO) + If there is a partially-filled output packet (created by IOT + or SIOT), it is transmitted. + + The following devices ignore FORCE (it always skip returns) + because they don't need it: + + TTY: STY: LPT: PLT: PTP: COD: + +Errors: + 2 WRONG DIRECTION + TCP: Channel is not an output channel. + 7 DEVICE NOT READY + TCP: Connection not open for writing. +34 WRONG TYPE DEVICE + The device is not an output device, or does not have + the kind of buffered up output which needs this call. + +IOPOP: pop input/output channel + + arg 1 Channel number + + The top entry on the job's IO pdl is popped into the + specified channel. Entries on the IO pdl are made + only by pushing channels with IOPUSH. If a channel + is pushed with IOPUSH and then popped into with IOPOP, + it is in exactly the same state as it would have been + if left untouched; however, the channel is available + for other use in the meantime. + +IOPUSH: push input/output channel + + arg 1 Channel number + + The contents of the specified channel are pushed onto + the job's IO pdl, and the channel is put into a + "closed" state. If the channel had been open, the + open file is not closed, but is instead now open on + the IO pdl slot instead of on the channel. It is + not accessible to the job for IOT'ing, etc., while + there, but it can be popped back into a channel with + IOPOP and then will be available for IO. + + +IOT: input/output transfer + + cbits Per-IOT mode bits. Device dependent. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Location for input/output transfer. + May not be immediate. + For unit mode, this is the word to + output from or read into. + For block mode this is an AOBJN + pointer to a buffer. + arg 3 (Optional) device-independent special mode bits. + These are not currently used. + + For ease of use, in unit input mode arg 2 and arg 3 + may be omitted and val 1 will then be the word read. + +For TTY and Tnn devices (terminals in general), + the following control bits are effective for IOT. + They are XOR'd into the left half of the I/O channel + word both before and after the IOT (see the .IOC user + variable). Thus one can modify the tty's + characteristics temporarily for just one IOT. + (ITS TTY) + Control bits on input: + 2.6 %TIECH Read even if char needs pi echoing + 2.5 %TIPEK Don't remove char from buffer (peek) + 2.3 %TIACT Don't wait for activation char + 2.2 %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + 2.1 %TINWT If no input available, don't wait, but return -1. + 1.9 %TIFUL Use full character set (for Imlacs and TV's). + + Control bits on output: + 2.6 %TJECH Echo mode output. + 2.5 %TJCTN Don't do line continuation. + 2.3 %TJDIS Recognize ^P cursor codes. + 2.2 %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 %TJMOR Do not do **MORE** processing. + 1.9 %TJPP2 Output in the echo area if it exists. + 1.7 %TJHDE Account for cursor motion due to characters + echoed on a half-duplex tty. +For the Chaosnet (channel opened with CHAOSO): + 1.4 ?? Don't hang. + + This can be used to do unit-mode 8-bit-byte transfers. + Control bit 1.4 means don't-hang, and applies to both input + and output. Only data packets with opcode 200 will be + transferred. Anything else on input causes the transfer + to stop, like an end-of-file. Use PKTIOT to find out what + the story is. (The correct way is to verify that there are + some packets in the input buffer, then do a (S)IOT, and if it + transfers 0 bytes then the first packet in the input buffer + must not be a data packet, so PKTIOT it in.) + + There can be input available to (S)IOT even when the state is + not %CSOPN (e.g. if the input buffer contains data and + a CLS packet.) In this case, you should first (S)IOT (if you + care to pick up the data) then PKTIOT. + + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second argument was immediate. + +IPKIOT: Internet packet (datagram) I/O + + This call is similar to PKTIOT and works for channels + opened on the IPQ device. It should NOT BE USED without + a good understanding of Internet Protocol datagram formats. + This call is still subject to change and thus is not + documented further. Ask KLH if you think you need to use it. + +ITYIC: read tty interrupt character + + arg 1 + val 1 a character + + This call fails to skip if there is no input + interrupt character to be read from the tty. + Otherwise, it returns the next un-ITYIC'ed + input interrupt character. + ITYIC'ing a character does not remove it from + the input buffer - it is still there to be IOT'ed + in its turn, along with the non-interrupt characters. + ITYIC makes it possible for a program to scan input + interrupt characters as they interrupt, without + interfering with the IOT'ing that will take place + later. + +JOBCAL: get info on how job device was called + + arg 1 BOJ channel number or + arg 2 Optional: AOBJN pointer for job call data. + arg 3 Optional: sixbit device name for PEEK and who-lines. + val 1 "opcode" for requested operation. + + See ITS JOB for information on job devices. + + This call is to be executed by a JOB device when it + receives an interrupt on its BOJ channel. It returns + data describing the operation desired by the calling job. + Note that the second argument is an AOBJN pointer + to an area in which the call will place data, not get it! + + The third argument, if present, is a device name to be used + by PEEK and who-lines for printing things like ARCBO. + (This name is initialized to the device name returned as word + 4 by OPEN - see below. The unknown-device handler, if involved + in the process (see the OPEN symbolic system call), resets + this to the second file name of the JOBDEV file it actually + succeeded in loading (this name may have had digits stripped off).) + + The "opcode" describes the operation to be performed: + 4.9-4.7 Open mode, if 2.9-1.1 contains 0. + 4.6 Close + 4.5 Close (both bits always the same) + 4.1 SIOT rather than IOT + 3.8 pclsred call restarting + 2.9-1.1 0 .OPEN + 1 .IOT + 2 MLINK (make a link) + 3 .RESET + 4 .RCHST + 5 .ACCESS + 6 .FDELE (delete or rename) + 7 .FDELE (rename while open) + 8 .CALL + + The second argument should point to a block of 12 + words (0-11) in which the following data are deposited: + + OPEN + wd 1 First file name. + wd 2 Second file name. + wd 3 Directory name. + wd 4 Device name. + wd 5 Full 18.-bit open mode in right half. + wd 7 BP or AOBJN ptr specifying filename, if + the SOPEN call was used to do the open. + Zero otherwise. + + IOT + wd 0 For block IOTs, the loser's IOT + pointer. The left half contains the + negative of the desired number of words. + For SIOTs, the byte count. 1 for unit IOTs. + + ACCESS + wd 0 The address within the file to access. + The beginning of the file is 0. + + MLINK + wd 0 Linked-to FN1. + wd 1 FN1 of the link. + wd 2 FN2 of the link. + wd 3 Directory name of the link. + wd 4 Device name of the link. + wd 5 Linked-to FN2. + wd 6 Linked-to directory. + wd 7 BP or AOBJN ptr specifying name of link, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to link to, + or 0 if the name was specified as SIXBIT. + (note links from one device to another don't exist). + + FDELE (rename or delete) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 1 Old first file name. + wd 2 Old second file name. + wd 3 Name of directory. + wd 4 Name of device. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 7 BP or AOBJN ptr specifying file to act on, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + FDELE (rename while open) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + CALL + wd 0 Name of operation in sixbit. + wd 1 Control bits for the call. + wd 2 Number of following words. + wds 3-n Input arguments to call. The first + will almost always be a channel number. + Values may be returned via the + JOBRET symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number or + a JOB device channel number. + +JOBGET: get job device information + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBCAL + symbolic system call. + + arg 1 BOJ channel number or + + The individual returned values are identical to + the words returned by JOBCAL in the area specified + by JOBCAL's second argument. + +JOBINT: cause caller of JOB device to get an interrupt + + arg 1 BOJ channel number or + + See ITS JOB for information on job devices. + + This is used by JOB devices to cause the calling job + to receive a word 2 interrupt for the channel it has + the JOB device open on. See also the SETIOC + symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number + or a JOB device channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBIOC: set input/output channel error + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + open on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBRET: return values to loser and let him continue + + arg 1 BOJ channel number or + arg 2 LH contains error code, or 0 if none. + RH contains amount for loser to skip. + arg 3 Optional AOBJN pointer to a block + of values to be returned to the loser. + + See ITS JOB for information on job devices. + + This call is used by JOB devices to cause the + calling job to continue after an input/output request. + The second argument specifies an error code in its LH; + if non-zero it is placed in bits 3.6-3.1 of the .IOS + word for the JOB device (see the STATUS symbolic + system call). The RH contains the amount by which + the loser should skip upon continuing if he used a .CALL; + this amount is usually 0 or 1. The third argument is + an AOBJN pointer to a block of values which are + passed back to the .CALL or to the .RCHST. + +Errors: + + 34 WRONG TYPE DEVICE + First argument must be a BOJ channel number + or a JOB device channel number. + 36 VALID CLEAR OR STORED SET + +JOBREU: Lets a JOB device handler offer itself for re-use + + arg 1 Device name that the handler can handle + arg 2 FN1 of file the handler was loaded from + arg 3 FN2 of file the handler was loaded from + arg 4 SNAME of file the handler was loaded from + (Note: the only device it could have been + loaded from is DSK). + arg 5 Amount of time to wait (for someone to try + to re-use us) before giving up and taking the + failure return, in 30'ths of a second. + Alternatively, minus the time to wait until + (in 30'ths since the system was started up). + If the argument is positive (a duration) it + is converted to a negative one (time to stop) + and written back. + + Some job device handlers take a considerable amount of + work to initialize themselves - for example, the ML device + must set up network connections to another machine. + Improved performance results if the same handler job + can be used for several OPENs, instead of having to + load a new job and open a new set of network connections + for each one. The JOBREU call makes this possible. + The time to use it is when the handler has completed all + of the business for one operation - it has received a + "CLOSE" from its creator, has tidied up its data bases, + and would otherwise have nothing to do except log out. + Instead, it can do a JOBREU. During the time period + specified in the JOBREU, if any job tries to do an OPEN + on a job device which this handler could be used for, + this handler job will in fact be used. In this case, + the JOBREU will skip return. The handler should then + act as if it had just been loaded, and do the "initial + JOBGET". If nobody tries to reuse the handler in the + specified time period, the JOBREU will return without + skipping, and the handler should log out. + + Note that one should not do a JOBREU immediately upon + receiving a close when the JOBRET of the initial OPEN + has failed, because the creator has pclsred and is + likely to be coming back. In order to make it use the + same job device when it comes back, JOBREU should not + be done; instead, a PCLSRed JOB device open automatically + finds the right job and sends another request to it. + You should time out and if this second request does not + come in, then give up and do a CLOSE and a JOBREU. + + There are two kinds of OPENs that can invoke the JOB device: + 1) An open of JOB: explicitly. It can reuse a + job device handler if match the FN1, FN2, + and SNAME specified in the JOBREU. + 2) An open of a device name (such as ARC) that is not + built into the system. Such an open can reuse a job + device handler if the device name matches the one + specified in the JOBREU. + + +Errors: + + 10 DEVICE NOT AVAILABLE + This job isn't a JOB-device handler. + 13 FILE ALREADY EXISTS + This job device handler is already (still) in use + by a creator. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + Nobody tried to reuse this job, and the time period ran out. + +JOBSTS: set JOB device status + + arg 1 BOJ channel number or + arg 2 New JOB device status - stored in the RH of + the job channel's .IOS word, where .STATUS + on the job channel will find it. + This may be arbitrary, of course, but the + standard bits are as follows: + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + For a job device this should be 22, + unless you really know what you are + doing. + If omitted, 000022 is used. + arg 3 Sets the "device name" of this channel. + The device name is used by the RFNAME + and RCHST system calls, and by PEEK + and who-lines, to say what device a job + is transferring to or waiting for in the + job's status. The argument is optional. + arg 4 Sets the "file name 1". Optional. + arg 5 Sets the "file name 2". Optional. + arg 6 Sets the "system name". Optional. + arg 7 Sets the "open mode" that will be returned + by the RFNAME system call. Optional. + arg 8 Optional byte pointer to ASCIZ string in device handler's + address space containing full filenames. The byte pointer + my not be indexed or indirect. Note that ITS might decide + to read a string from this byte pointer at any time, so the + string must continue to exist even after the JOBSTS call + has returned. + + When the channel is first opened the device, file + name 1, file name 2, system name, and open mode + are set to the ones by which the channel was opened. + JOB device programs may change these if they wish, + but are not required to. + + See the STATUS symbolic system call, the .STATUS uuo, + and the RFNAME system call. + + See ITS JOB for information on job devices. + +KLPERF: Use KL10 performance analysis counter + + arg 1 whose performance is to be measured + -3 (%JSNUL) => the null job + -4 (%JSALL) => all jobs + 0,,-3 and 0,,-4 are also acceptable. + arg 2 Performance Analysis Enables word + 0 => turn off the performance counter + and make it available for other users. + See DEC drawing M8538-0-MTR4 for the bits in this + argument. + val 1 Previous setting; -3, -4, or a job number + val 2 Previous Performance Analysis Enables word + val 3 High-order word of the time base + val 4 Low-order word of the time base + val 5 High-order word of the performance counter + val 6 Low-order word of the performance counter + + If no arguments are supplied, the state of the counter + is not changed and the six values are returned. + + If arguments are supplied, the performance analysis counter + is siezed so no other users can interfere and performance + measurement begins. When the specified job is running + and the conditions specified in the Enables word are met, + the performance counter counts. A bit in the Enables + word controls whether it counts the duration, in microseconds, + that the conditions were satisfied, or the number of times + that the conditions became satisfied. While the specified + job is running, the time base counts microseconds. If -4 + (all jobs) was specified, this is the elapsed real time. + Issuing the KLPERF call again allows the results to be + determined by subtracting the values obtained the first time + from the values obtained the second time. + + The two counters are double-precision numbers. The high-order + 35 bits are in bits 1.1-4.8 of the high-order word, and + the low-order 23 bits are in bits 2.4-4.8 of the low-order + word. + +Errors: + + 10 DEVICE NOT AVAILABLE + Someone else is using the performance analysis counter. + 14 BAD CHANNEL NUMBER + Argument 1 is invalid. + 35 NO SUCH JOB + Argument 1 specified a non-existent job. + +LISTEN: listen for any typed-ahead input (ITS TTY) + + arg 1 (but not a STY channel) or + val 1 Number of typed-ahead characters pending. + + Waits for output buffer to empty before listening. + To check for input without waiting for output use + .STATUS. The uuo .LISTEN is the same as LISTEN, + but applies only to the job's console, and furthermore + returns zero if the job doesn't possess the tty. + +Errors: + + 14 BAD CHANNEL NUMBER + +LNKEDP: find out whether open file was reached via a link + + arg 1 Channel number of open disk file + val 1 Nonzero if file was reached via a link. + + The file open was reached through a link if the names + actually specified in the OPEN were the names of a link + which pointed at this file. It is not a question of + what file is open, but of what names were specified to + open the file. + +Errors: + +14 BAD CHANNEL NUMBER + Arg 1 is not between 0 and 17. +34 WRONG TYPE DEVICE + Arg 1 does not specify a disk channel. + +LOAD: load file (a program) into a job + + arg 1 + arg 2 Disk channel number (freshly opened for reading). + arg 3 Optional argument which causes part of the file + to be ignored: either ,,, to load + only between addresses and (inclusive), + or zero meaning load only pure pages. + The default is 0,,-1 normally, 20,,-1 when loading + oneself, and 20,,37777 when loading the PDP6. + When loading a PDUMP format file, and + are rounded outward to page boundaries. + + The file open on the input channel is loaded into + the specified job. The file may be in one of two formats: + PDUMP format, or SBLK format. The former is produced by + the PDUMP symbolic system call, under which its format + is documented. The latter is described below. + The two formats are distinguished by the + fact that a PDUMP format file begins with a zero word, + but an SBLK format file begins with a non-zero word. + + SBLK format: + First off, any words in the file are ignored until a word + 254000,,1 (JRST 1) is found. This should be followed + by zero or more blocks of the following form: + wd 0 -,, + wds 1-n data words + wd n+1 checksum + That is, the first word is an AOBJN pointer describing where + to load consecutive words of data into the job; this is + effectively used as a block .IOT pointer to load the words. + Following the data is a checksum, which is ignored. + (Historically, when microtapes were used, the checksum was + necessary for error checking.) + Following the last block must be a non-negative word + to denote the fact that there are no more blocks. + This word and all succeeding words in the file are ignored. + (DDT assumes that this word contains the starting + address of the program, and that following words contain + the symbol table for the program.) The disk channel + is left open, with the access pointer pointing to the + positive word which followed the last block. + + The standard form of symbol table is: + -<2*n>,,0 + squoze code,symbol -- these 2 words are + value of symbol -- repeated n times + + The word after the symbol table is another copy of the starting address. + +Errors: + +7 DEVICE NOT READY + A disk read error occurred. +31 CAN'T MODIFY JOB + The calling job may not write into the job being loaded. +32 CAN'T GET THAT ACCESS TO PAGE + You tried to create an absolute page pointing to memory + that the system doesn't have. +34 WRONG TYPE DEVICE + Arg 2 does not specify a disk read channel, or + you tried to load a PDUMP file into the PDP-6. +37 NO CORE AVAILABLE + The MMP was full so a needed page could not be created. +46 UNRECOGNIZABLE FILE + The file open on the specified channel is not in + valid SBLK format, nor in valid PDUMP format. + +LOGIN: log in a job tree + + arg 1 Sixbit name to log in under. + " " (0) and "___xxx" (-1 in left half) are illegal. + arg 2 Sixbit name of "terminal." This is not required + for hard-wired terminals. When this field specifies + a network host, the standard form is HSTnnn, where + nnn is the octal host number, however often the English + name of the host, abbreviated to six letters, is used. + arg 3 Sixbit XUNAME. This is normally the same as arg 1 + except that if arg 1 is changed to make it unique, + this should not be changed. The XUNAME is what is + used for accounting purposes. + + The uname for the job tree is changed from "___nnn" + (where "nnn" is the top-level job's user index in + sixbit octal characters), which is the initial uname of + a non-logged-in job tree, to the specified sixbit name. + If the job tree already has a uname other than "___nnn", + the LOGIN fails. Only top-level jobs with no direct + inferiors may LOGIN. + +Errors: + + 11 ILLEGAL FILE NAME + Cannot log in as "___xxx" or " ". + 12 MODE NOT AVAILABLE + Jobs with direct inferiors may not log in. + 13 FILE ALREADY EXISTS + Someone is already logged in under the specified name. + 31 CAN'T MODIFY JOB + Already logged in. + 40 NOT TOP LEVEL + Only top-level jobs may log in. + +LOGOUT: log out a job tree + + No arguments or values (note, however, that at least + one must be present in order to contain the 4.9 bit + terminating the argument list). If the executing + job is the top level job in its job tree, then the + entire job tree is expunged from the system. + Does not skip if not a top level job. This is not + considered an error, however; no error code is returned. + See also the .LOGOUT uuo. + +LOSE: report lossage + + arg 1 left half - address of losing instruction + right half - lossage code (defined by DDT.) + arg 2 new PC. If omitted, the address of the .CALL + minus one is used. + control bits: + 1.1 default arg 2 to the address of the .CALL plus one. + 1.2 do SETZM @.40ADDR, i.e. clear the location + in the job where a UUO returned from the + system would be stored. + 1.3 Really take the left half of arg 1 as the address + of the losing instruction. If this control bit + is not specified, the new PC is used instead. + + The job's Program Counter is set to the new PC, + the job's .VAL user variable is set to the address + of the losing instruction,,the lossage code, and the + job is given a %PILOS interrupt. If the job does not + enable this interrupt, and its superior is DDT, a + helpful error message will be printed. + + The LOSE symbolic system call is a more general version + of the .LOSE UUO. .LOSE is simpler, and usually good + enough. Symbolic LOSE is for situations where sophisticated + error reporting is needed. Symbolic LOSE allows the new PC + value to be specified explicitly, and therefore is suitable + for use inside an error-handling subroutine. In addition, + the address of the "culpable" instruction can be specified + independantly from the address to restart at. Thus, the + program can provide more complicated error recovery + than simply restarting at the losing instruction. + + The lossage codes are defined by DDT's interpretation of them. + The defined values are: + + %LSSYS==1000 The last error code returned by a failing + system call describes the problem. + + %LSFIL==1400 The last error code returned by a failing + system call, together with the name of the file + it was operating on, describe the problem. + The "culpable instruction" address should point + at the failing system call. + DDT will decode it to determine the filenames + (if it is an OPEN) or the channel number and then + the filenames via an RFNAME. + + %LSSYS+errcode Means that the system call error code + describes the problem. + + %LSFIL+errcode Means that the error code + together with the filenames being used + describe the problem. + + 0 Signifies some other nondescript error condition. + + 1+.LZ + Means that the error should be handled as if it + were a fatal interrupt on the specified interrupt + bit. For example, 1+.LZ %PIMPV will make DDT tell the + user that the job received a fatal MPV interrupt. Why + might a program wish to do this? It might have + enabled its own handling of MPV, and then received an + MPV interrupt at a time when one was not expected and + was not recoverable. At such a time the ideal thing + to do is to report the MPV back to DDT, so that DDT + will handle it - to "pretend" that MPV wasn't enabled + at all. To make the pretense complete, the program's + own MPV interrupt handler should dismiss the + interrupt, and leave the PC pointing at the guilty + instruction, since that would be the state of things + if the program had not handled the interrupt. That + can be done with a special feature of the DISMIS + symbolic system call, which can do a .LOSE after + dismissing the interrupt and restoring the PC. + + This call never gets an error, and never returns. + +MLINK: make link + + Either + arg 1 Byte pointer to ASCIZ string specifying name for link, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying name to link to, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified "from" device. + arg 2 "from" file name 1. + arg 3 "from" file name 2. + arg 4 "from" sname. + arg 5 "to" file name 1. + arg 6 "to" file name 2. + arg 7 "to" sname. + + A link is created on the specified device. + The only standard device which accepts links + is DSK; of course, various job devices (such as + the AI, ML, DM, and MC devices) also implement it. + Links cause an indirection when opened + for reading; writing or deleting a link affects + the link itself. + The "from" file names are subject to file name + translation. See the TRANAD and TRANDL symbolic + system calls. + + See the SOPEN symbolic system call for a description of + how the byte or AOBJN pointer arguments should be formatted + and how the strings are parsed into filenames. + +NETAC: accept network connection OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 - channel # of an Arpanet NCP channel + + If the channel is in the RFC-received state, the + connection is accepted. Use CLOSE to refuse a + request for connection. + + See also the .NETAC UUO. + + This call only works for NCP and is obsolete. It isn't needed + for TCP since incoming requests that satisfy a LISTEN will + automatically be hooked up and the connection opened. + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not an Arpanet NCP channel +41 OTHER END OF PIPELINE GONE OR NOT OPEN + The socket is not in the %NSRFC (request for + connection received) state. + +NETBLK: network block (ITS NCP) + + arg 1 Channel number - should be a network channel. + NCP, TCP, and CHAOS are allowed. + arg 2 Connection state code. + NCP: Socket state as returned in the right + half of word 4 by the .RCHST uuo: + 0 %NSCLS CLS received. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + CHAOS: + TCP: basically the same as NCP. See WHYINT for state list. + arg 3 Optional: address of a word containing an argument + as for the .SLEEP uuo. This word must be writable, + as it will be replaced by an appropriate negative + number as for .SLEEP. + If not supplied, positive infinity (377777,,777777) + is assumed by default for the time to sleep. + val 1 New connection state. + val 2 Time left, in thirtieths of a second. + (Meaningful only if arg 3 supplied.) + + The executing job hangs until one of two conditions + becomes true: either the network conection associated + with the specified channel enters a state different + from the specified state, or the amount of time + specified by arg 3 has passed. + + Example: suppose that a NCP socket is in state 1 + (listening for RFC). This call will return when + the socket is no longer in that state, or after 5 + seconds, whichever comes first: + + MOVEI AC,5*30. ;five seconds + .CALL [ SETZ + SIXBIT \NETBLK\ ;network block + 1000,,CHNUM ;channel number + 1000,,%NSLSN ;old state + ,,AC ;time to sleep + 2000,,NSTATE ;new state + 402000,,TLEFT ] ;time left + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not a network (NCP, TCP, CHAOS) channel. + +NETHST: net host status (ITS NCP) + + arg 1 Host number (-1 for self). + arg 2 Reason for going down (optional, valid + only if arg 1 is -1). + 5 Going down for scheduled P.M. + 6 Going down for scheduled hardware work. + 7 Going down for scheduled software work. + 10 Going down for emergency restart. + 11 Going down because of power outage. + 12 Stopping at software breakpoint. + 13 Going down because of hardware failure. + 14 Going down because not scheduled to be up. + val 2 Host number (useful if arg 1 is -1). + Note THESE ARE OUT OF ORDER (because "val 1" is so long). + val 1 Host status + 4.9 1 => RFNM wait on link 0. + 4.8-4.3 Unused. + 4.2-4.1 Host status: + 0 Down. + 1 RST sent. + 2 Up. + 3.9-3.1 Time (as returned by .RDTIME) modulo 1000 + the last RFNM sent on link 0. + 2.9-1.1 Last message from IMP about "host dead status" + for this host. (See BBN Report #1822, Chapter 3.) + 2.7-1.5 Time host will come back up, Greenwich Mean Time: + 2.7-2.5 Day of week (0=Monday, ..., 6=Sunday). + 2.4-1.9 Hour of day (0-23.). + 1.8-1.5 Five-minute interval within hour (0-11.). + -1 means more than a week. + -2 means time coming back up is unknown. + 1.4-1.1 Reason host is down: + 1 Foreign host not communicating + with network (took ready-line down + without saying why). + 2 Foreign host not communicating with + network (host was tardy in accepting + network traffic without saying why). + 3 Foreign host does not exist, to the + knowledge of the Network Control Center. + 4 The IMP software is preventing + communication with foreign host + (this usually indicates IMP software + initialization at the foreign site). + 5 Foreign host down for scheduled P.M. + 6 Foreign host down for scheduled + hardware work. + 7 Foreign host down for scheduled + software work. + 10 Foreign host down for emergency restart. + 11 Foreign host down because of power outage. + 12 Foreign host stopped at software + breakpoint. + 13 Foreign host down because of hardware + failure. + 14 Foreign host not scheduled to be up. + 17 Foreign host in process of coming up. + + If one argument is supplied, then the host status word + for the specified host is returned. If two arguments are + supplied, then the "reason for going down" word for the + local host is set. (As of June 30, 1975, setting this + word doesn't seem to do anything at all. Didn't the code + for sending this data to the IMP ever get written??) + +NETIMP: network IMP status (ITS NCP) + + If no arguments are present, three values are returned: + val 1 Last message from IMP about going down. + 4.9 IMP really is down now. + 1.2-1.1 Reason: + 0 "Last warning" or "panic restart"; + the IMP is going down in 30. seconds or less. + 1 Scheduled hardware P.M. + 2 Scheduled software reload. + 3 Emergency restart. + val 2 Time going down, as returned by .RDTIME. + val 3 Time coming back up, as returned by .RDTIME. + + If arguments are present, three must be present. + They are used to set three default values which are returned + if the IMP itself has not set the above three values. + Presumably this is good for logically disabling network software? + +Errors: + +30 TOO FEW ARGUMENTS + Must have either 3 arguments or no arguments. + +NETINT: Send network interrupt OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 channel # + + An INR or INS message is sent, depending on the send/receive + gender of the socket specified by the channel #. What this does + depends on the protocol being used and the program at the + other end of the connection. + + This call only works for NCP and is obsolete. +Errors: + +34 WRONG TYPE DEVICE + The channel specified is not an Arpanet NCP channel. + +NETRFC: Get pending Request For Connection for a specified network + + cbits + %NQREF Arg 2 is a previously returned identifier, + refuse connection and flush from queue. + arg 1 - SIXBIT name of network + one of CHAOS, TCP, or ARPNCP (obsolete) + arg 2 - optional network-dependent arg + for CHAOS: pointer to packet buffer + for TCP: If %NQREF set, is ,, of request to + reject (as returned from previous NETRFC call) + val 1 - network-dependent value + for TCP: ,, + for ARPNCP: ,, + + This call is intended for use by very specialized programs + which ITS invokes upon receiving unsolicited requests for + connections. ITS will queue the request for a short time + and start an appropriate job which uses NETRFC to obtain + the request and process it. Currently these programs are + NCP: SYS;ATSIGN NETRFC + TCP: SYS;ATSIGN TCP + CHAOS: SYS;ATSIGN CHAOS + + Normally the program will execute a NETRFC appropriate for its + network, and obtain a returned request value. Accepting the + request is device dependent, but refusal can always be done + by calling NETRFC again with the %NQREF control bit set and + furnishing the appropriate request identifier. + + See the CHAOSQ system call, which NETRFC is replacing. + +ERRORS + 4 - TCP: No pending RFCs, or %NQREF with non-existent ,,. + 12 - CHAOS: can't handle %NQREF yet. + 33 - Unknown network specified. + +OPEN: open a file + + cbits Device dependent. Standard bits are: + 2.7-2.9 0 = normal, 1 = write-over mode. + 1.3 0 = ascii, 1 = image. + 1.2 0 = unit, 1 = block. + 1.1 0 = read, 1 = write. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Left-justified device name. + arg 3 File name 1. + arg 4 File name 2. + arg 5 Sname. If not present, defaults to executing + job's current sname (see the .SNAM user variable). + + See also the .OPEN uuo. + + The file names used for opening are subject to translation. + See the TRANAD and TRANDL symbolic system calls. + + The file names .FILE. (DIR) are special: + they cause the directory for the given device + (and sname, if applicable) to be read. It is + illegal to write the directory. If a device has + no directory, then opening .FILE. (DIR) will + supply the string "NON-DIRECTORY DEVICE", presumably. + (This is a function of the unknown-device handler + (see below) and hence the exact results may vary). + Opening a directory in ascii mode yields an + ascii string for people to look at; opening it + in image mode yields a device-dependent file + (or possibly a MODE NOT AVAILABLE error). + + For the DSK device, the control bits are: + 1.4 %DONRF Don't set the reference date. + 1.5 %DONLK Don't chase links. (I. E., if + this is a link, open the link itself, + not the file at which the link points. + 1.6 %DORWT Readers wait. On output open, makes would-be + readers wait till we close. + 2.7 %DOWOV Write-over mode. Writes on the existing + file of that name, instead of replacing + it with a new file. + + The file names M.F.D. (FILE) when opened for + input yield a master file directory for all + disks. In ascii mode this is an ascii string + containing the names of all directories, separated + by a cr/lf sequence. + + The file names ..NEW. (UDIR) cause a new directory + to be created with the given sname if none already + exists. Creating a directory in this way causes a + message to be printed on the system console. + (A directory is destroyed only when the disks are + salvaged by the stand-alone salvager, which is generally + run just before the time-sharing system is restarted. + A directory is then destroyed iff it contains no files.) + + If < or > is used as a file name, it is treated + specially according to an algorithm no one + understands, but which attempts to let it stand + for the numerically smallest or largest file name + among those in the directory. In particular, + if you call your files FOO nnn, where nnn is a version + number, then reading FOO > will read in the latest + version, writing FOO > will write out a version + one higher than the latest one (or FOO 1 if there + is no file named FOO nnn), and deleting FOO < + will delete the oldest one. Writing FOO < doesn't + recreate an old file; it is the same as FOO >. + If a file with numbers and letters in its name, + for example FOO BAR27, already exists, + writing FOO > will generate FOO BAR28 + and not FOO 1. Letters to the right of numbers are + generally ignored as far as < and > are concerned. + + Note that < and > may be used as first + file names as well; this is mainly useful for the + .LPTR. directory. It is illegal to use < or > for + both file names at once. + + The SYS device ignores the sname, and otherwise + is like using the device-sname pair DSK:SYS; . + Writing new files or altering old ones on the SYS + device (or even on DSK:SYS;) causes a message to + appear on the system console documenting who the + culprit is and what he did. This is because system + programs and other files critical to system operation + are kept on SYS:. In fact this applies to writing + or altering files on any disk directory whose name + begins with the three letters "SYS". Standard + directories whose names begin with "SYS" include: + SYS1 Extension for SYS directory (holds programs). + SYS2 Extension for SYS directory (holds programs). + SYS3 Extension for SYS directory (holds programs). + SYSENG Source files for many system programs. + SYSEN1 Extension for SYSENG directory. + SYSEN2 Extension for SYSENG directory. + SYSBIN Binary files for many system programs. + SYSTEM Files having to do with ITS itself. + SYSDOC Documentation for ITS itself. + SYSNET Files having to do with Chaosnet and TCP. + + The COM device ignores the sname, and otherwise + is like using the device-sname pair DSK:COMMON; . + + The TPL device ignores the sname, and otherwise + is like using the device-sname pair DSK:.LPTR.; . + (On systems without lineprinters the TPL device is + generally just a JOB device.) + On output, it furthermore ignores the file names, + and instead uses the uname of the opening job as + the second file name, and randomly generates a + first file name. The system job prints files + it finds on .LPTR. on the line printer, whenever it + has nothing better to do and the line printer happens + to be free; these files are subsequently deleted. + Thus the TPL device provides a printer spooling facility. + Attempts to rename a file on the TPL device are + ignored, because the name controls the spooling order. + + For the LPT device, opening succeeds only if no one + has the LPT, or the same user already has the LPT; + in the former case the opening job must be in a tree + controlled by a "local" tty as defined by its TTYTYP + variable. In all other cases the OPEN is converted + to use the TPL device instead. + + For the USR device, the file names should be the + uname-jname pair of the job to open. If the uname is + zero, it is equivalent to using the uname of the + job doing the call. If the jname is zero, then the + uname is interpreted as a specification; + in this way one can open a job given its user index. + A jname of PDP6 or PDP10 opens up the PDP-6 + as the "job". (PDP10 as a jname goes back to the + days when the PDP-6 ran ITS and the PDP-10 was the + auxiliary processor!) + Control bits: + 1.4 Insist on opening an already existing job; + i.e. do not create a new one. The job will + be opened as a foreign job, not as an inferior. + Here is an algorithm for deciding whether job Y will + be a direct inferior or merely a foreign job when + opened by job X: + (DEFUN USR-OPEN-RESULT (X Y BIT-1*4) + (COND (BIT-1*4 (COND ((EXISTS Y) 'FOREIGN) + (T (ERROR)))) + ((EXISTS Y) + (COND ((INFERIOR Y X) 'INFERIOR) + ((DISOWNED X) 'FOREIGN) + ((NOT (DISOWNED Y)) 'FOREIGN) + ((TOPLEVEL Y) + (MAKE-NON-DISOWNED Y) + (CHANGE-ALL-UNAMES Y (UNAME X)) + (FIX-UP-TTY-CHANNELS Y) + 'INFERIOR) + (T 'FOREIGN))) + ((= (UNAME X) (UNAME Y)) + (CREATE-USR Y) + (AND (DISOWNED X) + (MAKE-DISOWNED Y)) + 'INFERIOR) + (T (ERROR)))) + + For the ERR device, the first file name must be + numerically 1, 2, 3, or 4. If it is 1, then the .IOS + word specified by the user variable .BCHN is + examined. If it is 2, the .IOS word for the channel + numerically specified by the second file name is + examined. If it is 3, the second file name is itself + the status word. Bits 3.1-4.5 of the specified word + yield a the number of an error message which can then + be read from the open ERR device. If the first file + name is 4, the second file name must be the value + returned into an error code return argument by a symbolic + system .CALL that didn't skip. The corresponding error + message can be read from the open ERR device. + + For TTY and Tnn devices (terminals in general), + some of the control bits set first-time options, + and some are per-channel. Those which are per-channel + are marked below with a *. The standard names for + these bits are also given. (ITS TTY) + Control bits on input: + 2.6 * %TIECH Read even if char needs pi echoing + 2.5 * %TIPEK Don't remove char from buffer (peek) + 2.3 * %TIACT Don't wait for activation char + 2.2 * %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + + 2.1 * %TINWT Do not wait for input. If no input + is available, return -1 in unit mode, or + return a partially filled block in block mode. + 1.9 * %TIFUL Use the full TV character set if possible. + In this mode, characters have this form: + 2.3 %TXTOP Top. + 2.2 Obsolete. Used to be Shift lock. + 2.1 %TXSUP Super. Used to be Shift. + 1.9 %TXMTA Meta. + 1.8 %TXCTL Control. + 1.7-1.1 %TXASC Ascii part of character. + Of course, for non-TV's only %TXASC + will be non-zero. + 1.6 Set up 3 line echo area (like SCML of 3). + 1.4 "DDT" mode. Initially clear the %TGPIE and + %TGMPE bits for carriage return, line feed, + and tab, thus causing them not to echo. + 1.3 Image mode. Initially clear the %TGPIE + and %TGMPE bits for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode, + ^C causes a block mode end of file. + 1.1 0 = input. + Control bits on output: + 2.6 * %TJECH Echo mode output. + 2.5 * %TJCTN Don't do line continuation. + 2.4 * %TJSTP Channel is hung in **MORE**. + Unusual in that the system modifies this bit. + 2.3 * %TJDIS Recognize ^P cursor codes. + 2.2 * %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 * %TJMOR Do not do **MORE** processing. + 1.9 * %TJPP2 Output in the echo area if it exists. + 1.6 Same as 2.2 - turns on %TJSIO. + 1.5 Same as 2.3 - turns on %TJDIS. + 1.4 Turns on %TJECH, %TJPP2, %TJMOR. + 1.3 Image mode. Initially set %TGIMG bits + for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode + output all ^C's are ignored. + 1.1 1 = output. + + For STY device input, control bit 1.4 means that + input IOTs, instead of hanging, will input a -1 in + unit mode or not count out the AOBJN pointer in block + mode (see ITS TTY for details). + For STY output, control bit 1.4 means that output IOTs, + instead of hanging when the tty's input buffer is full, + will cause a ^G to be output, just as on normal ttys. + Control bit 1.5, on input or output, causes a %TDORS + character to be available as input when an output + reset is done on the sty's alter ego. + Control bit 1.3 is copied into the %TOHDX bit of the + associated tty, thus making it half-duplex if set. + These control bits are not per-channel, but rather + will affect all channels open on the same STY. + + For the PTR and PTP devices (paper tape reader and + punch), if the 1.4 control bit is on, then the 1.2 bit + must be 0 and the 1.3 bit is ignored. In this mode + all eight paper tape channels may be read or punched. + + For the NET device, the arguments are as follows: + cbits 2.1-2.6 byte size for image mode + 1.7 Use 8 times as large a buffer. + 1.6 If ascii mode, use 8-bit bytes + instead of 7-bit bytes. + If image mode, use byte size in + bits 2.1-2.6. + 1.5 Open socket in listen mode. + 1.4 0 = use arg 3 as local socket number. + 1 = generate unique local socket number. + (A generated socket number can be examined + after opening by using the .RCHST uuo). + 1.1-1.3 Standard. + arg 1 Channel number. + arg 2 Left-justified device name (i.e. NET). + arg 3 Local socket number. + arg 4 Foreign socket number. + arg 5 Foreign host number. + + For the STK device (Stanford keyboard): + cbits 1.7 If 1.6 = 1 and 1.5 = 0, + then don't input the meta bit. + 1.6 0 = Stanford mode: + meta = 400 + ctrl = 200 + top+shift+others generate 0-177 + 1 = ITS mode: + meta = 200 + ctrl means ctrl, and works + with others to generate 0-177 + 1.5 0 = convert according to 1.6-1.7. + 1 = don't convert characters. + 1.4 Don't hang if no character + available for input - return -1 + instead. + + If the device name used in the OPEN is not one known to + to the system, the "unknown-device handler" is invoked. + The system creates a job device and loads SYS:ATSIGN DEVICE + into it; this program then has the responsibility for + handling the OPEN. The normal action of this program is + to look for a file DSK:DEVICE;JOBDEV , where + is the requested device name. For example, if an attempt + is made to OPEN the FOOBAR device, and the file + DSK:DEVICE;JOBDEV FOOBAR exists, the program contained in + this file will be used to interpret the OPEN via the JOB device. + If such a file does not exist, but the device name has trailing + digits, the unknown-device handler will try stripping successive + trailing digits and retrying. For example, opening the + AR1 device causes the unknown-device handler to look first for + JOBDEV AR1, and then for JOBDEV AR. If the handler succeeds, + it sets device name for PEEK and who-lines to the second + file name that finally succeeded (see the JOBSTS symbolic + system call). + The unknown-device handler also handles requests for the + directories of certain built-in devices whose directories + are seldom asked for. If there is nothing better to return for + a directory, the string "NON-DIRECTORY DEVICE" is returned. + +Errors: + + OPEN can return many errors. The following errors in + particular are relevant to OPEN on the DSK device: + + 4 FILE NOT FOUND + The specified directory exists, but the specified file + does not. + 5 DIRECTORY FULL + There is no room in the directory to create an entry + for the new output file. + 7 DEVICE NOT READY + The disk pack containing the file is offline (should + never really happen). + 10 DEVICE NOT AVAILABLE + a specific unit was selected, by opening DKn, and that + unit is off-line or contains a reserved pack. Or, a + specific pack was selected by opening PKn or Pnn, + and that pack is reserved. The reserved-pack check + only applies when writing. Reserved means secondary-pack, + or reserved for the exclusive use of certain directories. + 11 ILLEGAL FILE NAME + One or both file names were zero; or, for an output file, + the file names were M.F.D. (FILE) or .FILE. (DIR), which + are names reserved for directories. + 12 MODE NOT AVAILABLE + Control bits 2.9-2.7 specified an illegal mode. + 14 BAD CHANNEL NUMBER + This is a RENMWO error. + 16 PACK NOT MOUNTED + The pack specified by opening PKn or Pnn is not + mounted, or the pack containing the file being read + is not mounted. + 20 NON-EXISTENT DIRECTORY + The specified directory does not exist. + 22 SELF-CONTRADICTORY OPEN + Control bits 2.9-2.7 specified an illegal mode. + 23 FILE LOCKED + An attempt to open a file in write-over mode failed + because someone has the file open for reading; or + an attempt to open a file for read, write-over, rename, + or delete failed because someone is writing the file + or because the file has been deleted, but hasn't gone + away yet because someone is reading it (i.e. there is + a star next to it in the directory listing.) wait a while + and try again. + 24 M.F.D. FULL + Cannot create a new directory because the master file directory + is full. + 27 LINK DEPTH EXCEEDED + Links may not be chained to a length of greater than 100 links. + This error probably means a circular chain of links. + 47 LINK TO NON-EXISTENT FILE + Error 4 or 20 occurred after following a link. + +PDUMP: pure dump a job + + arg 1 . + arg 2 Disk output channel number. + Should have been freshly opened + for output. + arg 3 State word; should be 0 initially. + This word is updated as the PDUMP + progresses; a value of 400000,, means + that page is about to be dumped. + + The pages of the specified job are dumped onto + the disk file in a form that can be efficiently + loaded. In particular, information as to whether + each page is read-only or not is saved so that + when the program is run it can be swapped + efficiently. If the same file is loaded into + several jobs, they will all share the same + physical copies of the read-only pages. + In addition, absolute pages are remembered. + A number of 2000-word (1K) blocks are dumped onto + the file. The first block is as follows: + wd 0 Contains zero. This distinguishes + PDUMP'ed programs from, for example, + MIDAS output. + wds 1-400 Word contains information about + block of the dumped job. This + information is as follows: + 4.9 Absolute page (shared with system). + 2.9-2.8 00 Non-existent page. + 01 Read-only page. + 10,11 Read/write page. + 2.2-1.1 If 4.9=1, absolute page number. + wds 401-777 Zero. + wds 1000-1017 The contents of the accumulators. + Note that the accumulators aren't part of + any page, so they wouldn't be saved if it were + not for this special hack. + The following blocks of the file are the successive + pages of the job, but only those which need to be dumped. + That is, absolute and non-existent pages are not dumped. + Thus, suppose the pages of a job are laid out as follows: + pg 0 Read/write. + pg 1-5 Read-only. + pg 6-7 Absolute (e.g., system symbol table). + pg 100 Read/write. + pg 200 Read/write. + others Non-existent. + Then nine blocks would be dumped out: + blk 0 Descriptor block. + blk 1 Page 0. + blk 2-6 Pages 1-5. + blk 7 Page 100 (octal). + blk 10 Page 200 (octal). + This is all that PDUMP writes out, leaving the file's access + pointer at the end of the last block written. At this point + the job doing the PDUMP will normally write out the + symbol table, if any, for the dumped job onto the disk + channel, preceded and followed by JUMPA instructions + containing the starting address. When this is done, + the resulting file can be loaded and run as a program + under DDT. + See the LOAD symbolic system call. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Can't dump the PDP-6 job. + 34 WRONG TYPE DEVICE + First argument was some oddball channel, or + second argument was not a disk output channel number. + 35 NO SUCH JOB + +PGWRIT: Cause page to be written to disk + + arg 1 (Optional) A + arg 2 Virtual page number within that job (a number from 0 to 377). + control bits: + 1.1 1 => don't wait for the page to finish getting written out, + return immediately. Issue the call again with this bit 0 + if you later want to wait for it to get written out. + 1.2 1 => unlock the page. + 0 => if the page is locked, swap it out anyway, but when it + next gets swapped in again it will be locked again. + + If there is only one argument, it is arg 2. The is + assumed to be the job issuing the call. + + The disk copy of the specified page is brought up to date; + if the in-core copy has been modified by the specified + the page is written out. The PGDUMP call does not return until + the disk has finished recording the page. + + This is useful when pages of a file have been mapped into + the user's address space. + + If the page cannot be swapped out because no disk space is available, + or some job that is using it cannot be pclsr'ed, it waits a while + and tries again. It does not return. + + This call used to be called PGDUMP, but the name was + changed to avoid confusion with PDUMP. + +Errors: + + 12 MODE NOT AVAILABLE + Page is absolute or tied down by exec pages. + 14 BAD CHANNEL NUMBER + The argument is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 1. + 32 CAN'T GET THAT ACCESS TO PAGE + The page number in argument 2 is not between 0 and 377; or the + job does not have a page at that position in its address space. + 34 WRONG TYPE DEVICE + The specifies the pdp-6, which does not have paging. + 35 NO SUCH JOB + The argument specified a non-existent job. + +PKTIOT: transfer one Chaosnet packet + arg 1 - channel number + arg 2 - address of a 126.-word block. + + Always transfers exactly one packet. + The format of the 126.-word block is: + 16 16 4 + ----------------------------------------- + | opcode | unused | fc | nbytes | 0 | + ----------------------------------------- + |destination host |destination index| 0 | + ----------------------------------------- + | source host | source index | 0 | + ----------------------------------------- + | packet # | ack packet # | 0 | + ----------------------------------------- + | data1 | data2 ... + + ... data487 | + ----------------------------------------- + + For details of how to use these packets, see the Chaosnet + protocol documentation. + +RAUTH: read a file's author. + + arg 1 Number of a channel open on the DSK device, + or a . + + val 1 Sixbit name of the file's author (the last + person to write on the file.) + +RCHST: read channel status. + Note: This system call is obsolete. Use the RFNAME, + RFPNTR, or WHYINT system call to obtain the + information you want. + + arg 1 channel number + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The channel's access pointer, if it is randomly + accessible; otherwise, -1. + val 6...additional device-dependent results + + The values may not be the same as the filenames, etc. + that were used to open the channel. The results of + this call are quite device-dependent. + in the open-mode returned by RCHST. + + The following devices return the access pointer as -1 + and the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + -1, for value 5. + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 sixbit/DSK/ + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-4 0 + val 5 -1 + + TTY (as a console) + val 1 'TTY,, + + TTY (as a device) + val 1 'Tnm,, + + STY + val 1 'Snm,, + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 Access pointer. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + val 5 Access pointer. May be a byte pointer if character mode. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS and JOBRET symbolic system calls. + Note that the job sets the results for vals 1-4 once + using the JOBSTS call, and only the values 5, 6, ... + are taken from the JOBRET that responds to the RCHST. + + NET + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + val 5 4.9-3.1 Time until IMP goes down, in thirtieths + of a second. + 0 => IMP down. + -1 => IMP doesn't plan to go down. + 2.9-1.1 Socket state: + 0 %NSCLS CLS received. val 6 gives reason. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + val 7 Reason for closing: + 0 %NCNTO Never open. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host Reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down. + 10 %NCRFS Connection refused. + val 8 Input: number of bits available. + Output: number of bits of buffer free. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + + DIRHNG: + val 1 SIXBIT /DIRHNG/ + val 2 0 + val 3 0 + val 4 Directory name + + LOCK: + val 1 SIXBIT /LOCK/ + val 2 Lock name + +RCPOS: read cursor position (ITS TTY) + + arg 1 or + val 1 Main program area cursor position. + val 2 Echo area cursor position. + + Each cursor position is returned as a word with the + vertical position in the left half and the horizontal + position in the right half. + See the SCML symbolic system call for setting up an + echo area. + +RDDMST: read demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + val 1 If arg 1 was the sixbit name, the user index; + if it was the user index, the sixbit name. + val 2 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + val 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and STDMST symbolic system calls, + and the .DEMON uuo. + +RDMPBT: read dump bit + + arg 1 Disk channel number or + val 1 A word, all zero, except with the dump check + bit for the file in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the SDMPBT + symbolic system call. + +RELOAD: reload top-level job (ITS DETACH) + + No arguments or values. Note, however, that an + argument of some kind must be supplied so that the + SETZ bit may be present to terminate the set of + arguments. + + The executing job must be the top level job of + a non-disowned job tree. + + Most of the job's system variables are initialized; + the file SYS:ATSIGN is then loaded and + started up, where is the jname of the job + (see the .JNAME user variable). + For example, if the jname of the job is HACTRN, + then the file SYS:ATSIGN HACTRN (which is DDT) + is loaded and started. This is how DDT performs + the U. command. Note that the translation lists for + the job are not cleared before this loading; thus one + can translate the file names SYS:ATSIGN and + cause a different file to be loaded. + + More specifically, the way the job is loaded is that + the following program is put into the job's ac's + and started at location 0: + + 0/ JFCL ;unused word + 1/ .OPEN 1,7 ;open up file SYS:ATSIGN + 2/ JRST 0 ;retry on failure + 3/ .CALL 12 ;load up program + 4/ .LOGOUT ;logout if loading fails + 5/ .IOT 1,2 ;read in starting address + 6/ JRST (2) ;go there + 7/ 4,,'SYS ;SYS device, image unit input + 10/ SIXBIT \ATSIGN\ + 11/ 0 ; is placed here + 12/ SETZ + 13/ SIXBIT \LOAD\ ;load file into job + 14/ 16 ;job specification + 15/ SETZ 17 ;channel number + 16/ -1 ;job is me + 17/ 1 ;channel number is 1 + + Typically the first thing a job used as a top level + (such as DDT) does is close channel 1. Now you know + why. The LOAD system call leaves channel 1 open + so that the start address and symbol table can be + read in. + +Errors: + + 40 NOT TOP LEVEL + +RENAME: rename a file + + Either + arg 1 Byte pointer to ASCIZ string specifying the old name, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified device name. + arg 2 Old file name 1. + arg 3 Old file name 2. + arg 4 Sname. If zero, the executing job's sname + is used (see the .SNAM user variable). + arg 5 New file name 1. + arg 6 New file name 2. + + The file specified by the first four names is renamed + according to the last two. It is not possible to + "rename" a file into a new directory or device. + Attempting to rename to an already existing file will + fail with error code 13 (File already exists). + + The old file names are subject to file name translation. + See the TRANAD and TRANDL symbolic system calls. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +RENMWO: rename while open + + Either + arg 1 Channel number of channel with file open on it. + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Channel number of channel with file open on it. + arg 2 New file name 1. + arg 3 New file name 2. + + The file open on the specified channel is renamed + according to the specified names. + + Ordinarily this is used in connection with output. Often + one opens a file for output with artificial file names, for + instance _TECO_ OUTPUT, instead of the real desired names. + This is so that if something should happen, causing the + channel to be closed before writing to the file is finished, + any previous file with the desired names will not be + replaced by the new, incomplete file. When all the + necessary data have been written into the file, + one RENMWO's to the desired names and then CLOSE's. + This causes the new, good file to replace the old one of + the same names. (By convention, file names beginning + with "_" are artificial names reserved for this purpose. + Ordinarily a program FOO will use the first file name + _FOO_ and a second file name indicating the nature of + the output file; thus _FOO_ OUTPUT, _FOO_ CRFOUT, + _FOO_ LSTOUT, etc.) + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +REOWN: re-own a disowned job + + arg 1 channel # + + The foreign job open on the specified channel is made + an inferior of the current job. The sub-tree of that job + becomes part of the sub-tree of the current job. The UNAMEs + of the specified job and all its inferiors are changed to + the UNAME of the current job. The JNAMEs are altered where + necessary to keep all UNAME-JNAME pairs in the system unique. + +Errors: + +5 DIRECTORY FULL + The current job already has the maximum number of inferiors (8). +31 CAN'T MODIFY JOB + The specified job is not top-level, or not disowned. +34 WRONG TYPE DEVICE + Specified channel is not open on the USR device, + or the job is already an inferior of the current job. +42 JOB GONE OR GOING AWAY + The specified job is in the process of logging out. + +RESET: reset input/output channel + + arg 1 Channel number. + + See also the .RESET uuo. + + This is a device-dependent operation. In general + the intent is to reset the state of the device to + some standard setting. + + For TTY input: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + All characters pending in the input buffer are + thrown away. Any interrupt characters which have + not yet interrupted will not interrupt. Any echoing + characters which have not yet echoed will not echo. + + For TTY output: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + Any characters in the output buffer are thrown away + iff the %TPORS bit is 1. If the channel was hung in + a **MORE**, the **MORE** is forgotten. If the job + was interrupted in the middle of ^P code typeout, + the ^P is forgotten. Other oddball state bits are + also reset to their normal state. + If the intelligent terminal protocol is in use on + the tty, then a %TDORS code will be sent to it, + and a reply stating the terminal's actual cursor + position awaited before any more output is allowed. + See the description of this protocol in the TTY documentation. + + For the USR device: + This is like doing a .UCLOSE and then re-opening the + job, but with less overhead. All pages of the job + are flushed, and a single page, page 0, is created + and cleared. All resource variables and other variables + are initialized. The %TBNOT and %TBDTY bits are set + in the .TTY variable. The .SNAM variable is initialized + to the uname of the job. The .40ADDR variable is set + to 40 octal. The .APRC variable is set to 447 octal. + + For the LPT device: + The line currently being physically output is terminated + and output. All characters pending in the output buffer + are flushed. The printer is skipped to a new page. + + For the PLT device: + All buffered plotter commands are flushed. + + For the PTR device: + All buffered input characters are flushed. + + For the PTP device: + All buffered output characters are flushed. + + For the COD device: + All buffered output characters are flushed. + + For the PDP-6: + The core of the PDP-6 is cleared. If it is running, + this should cause it to loop, executing the zero word + in location 41. A routine is then placed in core to + clear the PI flags, clear the processor flags, release + all shared devices, clear the accumulators, and finally + clear itself from core. If the routine fails to run + (the PDP-6 is not running), then the routine is cleared + out of the PDP-6 memory again anyway. + + For the NET device: + Any pending interrupt (INR or INS) is cleared. + + For TCP channels: + Currently does nothing. + + For the Chaosnet (channels opened with CHAOSO): + Does nothing. + + For the STY device: + An input reset is much like an output reset for the + tty which is the STY's alter ego; similarly, an output + reset is much like an input reset for the associated tty. + One difference is that a STY input reset does not + reset certain channel-related bits that a tty output + reset would; on the other hand, it always succeeds in + flushing characters even if the %TPORS bit is not set. + + For the STK device: + All buffered input characters are flushed. + +RESRDT: restore file reference date + + arg 1 Disk channel number or + + The reference date for the disk file is restored to + its value prior to the opening of the file. + Note that control bit 1.4 avoids setting the + reference date when a disk file is opened. See + the OPEN symbolic system call. + + See also the DSKUPD, FILBLK, RQDATE and SRDATE symbolic + system calls. + +RFDATE: read file creation date + + arg 1 Disk channel number or + val 1 The creation date of the file: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the RQDATE and SFDATE symbolic system calls. + +RFNAME: read name of file channel is open to + + arg 1 whose channel should be read. (OPTIONAL) + If omitted, self is assumed. + arg 2 channel number + arg 3 Optional byte pointer to store ASCIZ filename string through. + arg 4 Optional maximum number of characters to store. + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The mode in which the channel is open. + + The filenames and mode as described by the RFNAME may + not be the same as those specified in the original open. + That is because they are intended to be the "real" + filenames, etc., as opposed to those that were specified. + In other words, they are supposed to be the canonical + arguments to specify to attempt to re-open the file. + For example, the results of filename translation and + link following will show up in the names returned by + RFNAME, as opposed to the translated names or the names + of the link that was followed. Similarly, if COM or SYS + is opened, RFNAME will return DSK:COMMON; or DSK:SYS; + since COM and SYS are equivalent to those disk directories. + The core link devices CLO, CLU, CLA and CLI + perform different functions when first opened, but after the + open they result in indistinguishable channels, and the file + could be re-opened in any case by specifying CLO with the + right filenames, so RFNAME will for all four devices return + the device name CLO. + Some open-mode bits also have only an initial effect, and + they too are likely to be missing (or else always present!) + in the open-mode returned by RFNAME. + + + The following devices return the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + bits 1.1, 1.2, 1.3 with their standard meanings + for the open-mode (value 5). + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 'DSK,, + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-5 0 + + TTY (as a console) + val 1 'TTY,, + val 5 see TTY as a device + + TTY (as a device) + val 1 'Tnm,, + val 5 Bits 1.1 and 1.2 are standard. + For output channels, all the %TJ... bits + are returned also as they were in the OPEN. + For input channels, all the %TI... bits are + returned as they were specfied in the OPEN. + + STY + val 1 'Snm,, + val 5 All the bits of a STY open are returned. + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 bits 1.1 and 1.2 as standard + bit 1.4 1 if the job is not an inferior + of the job which has it open. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS system call. Note that the JOB device + is not specifically consulted when the RFNAME call is + given; it sets up the file names and open mode once + and then these values are returned whenever a user + asks for them with RFNAME. + + NET: (Arpanet NCP) + Note that val 4 is slightly nonstandard. + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + val 5 0 or 1 (i.e. .UAI or .UAO) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + + DIRHNG: + val 1 SIXBIT /DIRHNG/ + val 2 0 + val 3 0 + val 4 Directory name + + LOCK: + val 1 SIXBIT /LOCK/ + val 2 Lock name + +RFPNTR: read channel's random access pointer + + arg 1 channel # (or ) + + val 1 random access pointer + val 2 channel byte size. The acces pointer + is in terms of bytes of this size. + + The random access pointer is the number of bytes + into the file at which the next reading or writing + operation will occur. + + See also the ACCESS system call, the .ACCESS UUO, + the RCHST system call, and the .RCHST UUO. + +Errors: + +34 WRONG TYPE DEVICE + The device open on the specified channel is not random-access. + +RQDATE: read disk format date + + val 1 Current date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time in half-seconds after midnight. + If date and time are unknown, -1 is returned. + val 2 Date and time the system came up in disk format. + If date and time are unknown, -1 is returned. + + See also the DSKUPD, FILBLK, RESRDT, RFDATE, and SFDATE + symbolic system calls. + +RSSIZE: read screen size (ITS TTY) + + arg 1 or + val 1 Vertical size of screen (huge if printing). + val 2 Horizontal size of screen (print width). + + See also the CNSGET and CNSSET symbolic system calls. + +SAUTH: set a file's author + + arg 1 The number of a channel open on the DSK + device, or a . + + arg 2 The sixbit name of the file's author. + + Note: the author is actually stored as a directory + number, so if the author does not have a directory + SIXBIT /______/ will be substituted. Trailing digits + are deleted in an attempt to find the author's directory. + +SCML: set the number of TTY command lines (ITS TTY) + + arg 1 or + arg 2 Number of command lines (typical value is 4). + Must be less than the height of the screen. + If zero, no echo area. + + This causes an echo area to be set up at the bottom + of the display screen, using the last lines. + Characters typed in, or characters output in echo + mode, are output to this area rather than the main area. + Note that control bit 1.6 in an OPEN symbolic + system call for TTY input does an implicit SCML + with a second argument of 3. + +SCPOS: set tty cursor position (ITS TTY) + + arg 1 or + arg 2 vertical position (optional). + arg 3 horizontal position (optional). + arg 4 TTOALC word (optional). + val 1 old vertical position. + val 2 old horixontal position. + val 3 old TTOALC word. + + This call tells the system what the main-program-level + cursor position of the specified tty really is. It + does NOT request that the cursor be MOVED there; + it asserts that the cursor is expected to end up there + as a result of the characters already IOT'ed. + This call is necessary only when the system cannot figure + the resulting cursor position out for itself. + There are two cases when that happens: + + 1) The system does not compute cursor motion when + super-image output is done. If the user program, which + presumably knows how the characters are being used, knows + that the cursor will be moved by them, it should inform + the system. This is necessary even if the user program + is just trying to save time by generating the internal + system output buffer codes itself. + + 2) When an output reset is done on a tty of type %TNSFW + (a "software tty"), the system does not know where the + tty's cursor is physically located. Since the system + does not actually interpret the output characters at + interrupt level, but merely passes them off to the + tty, it does not know how much the tty had done when + the output reset happened. To recover, the system + sets the LH of the tty's TTOALC word to 0, and sends + a %TDORS character to the tty. The tty should respond by + informing the system of the current cursor position and + setting the LH of TTOALC to -1. Physical ttys must + use the intelligent terminal protocol to do that, + but STY users may do it with SCPOS. + +SDMPBT: set dump bit + + arg 1 Disk channel number or + arg 2 A word with the new value for the dump check + bit in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the RDMPBT + symbolic system call. + +SETIOC: set input/output channel error + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBIOC + symbolic system call. + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + pen on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +SFDATE: set file creation date + + arg 1 Disk channel number or + arg 2 New creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the DSKUPD, FILBLK, RFDATE, RQDATE and SRDATE + symbolic system calls. + +SIOT: byte-string in/out transfer + + cbits Same as for IOT symbolic system call (q.v.). + arg 1 I/O channel number. + arg 2 Byte pointer to string to transfer + (must not be indexed or indirect). + arg 3 Count of bytes to be transferred. + arg 4 (Optional) device-independent special mode bits. + + The second and third arguments are updated as the + transfer proceeds. If an end of file condition occurs + or the job is interrupted out of the system call, they + may not be fully counted out. + + SIOT is notably efficient for STY input and TTY superimage + output - much faster than block mode. For details of Chaosnet + SIOT, see the description of IOT. + + Supposedly some esoteric devices don't support this mode of + I/O transfer, but I can't think of any. Also, it is alleged + that on some devices, SIOT is not yet as efficient as block + mode. + +Errors: + + 12 MODE NOT AVAILABLE + The device open on this channel doesn't support SIOT. + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second or third argument was immediate. + +SOPEN: open file, using strings to specify the filename + + arg 1 mode bits,,channel number + arg 2 byte pointer to ASCIZ filename string, + or AOBJN pointer to a block of byte pointers + to strings to be concatenated. + +If the second argument's left half is between -63. and -1, then the +argument is treated as an AOBJN pointer to a block of byte pointers to +ASCIZ strings. Those ASCIZ strings are effectively concatenated for +parsing. Otherwise, the second argument is treated as one byte +pointer. 0 may be used as the left half of a byte pointer, and is an +abbreviation for 440700. + +The combined string is parsed using the ordinary ITS filename syntax, with +colon indicating a device name, semicolon indicating a directory name, and +space separating filenames. ^Q is used for quoting colon, semicolon, +space, ^Q and ^@ (which would otherwise terminate the string); it cannot +hurt to quote other characters with ^Q. SOPEN defaults the device to +"DSK", the second filename to ">", and the directory to the executing job's +current sname. + +Multiple devices, directories and names may be significant with some job +devices, and perhaps with disk files as well at some time in the future. + +Once the string has been parsed into filenames, operation proceeds as +for the OPEN symbolic system call, which see. + +SOPEN appears to a job device handler just like any other OPEN, except +that the original second argument byte or AOBJN pointer is available +as one of the values of the JOBCAL symbolic system call (which see). +For an ordinary OPEN, that value from JOBCAL is zero. + +SRDATE: set file reference date + + arg 1 Disk channel number or + arg 2 New reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + + See also the DSKUPD, FILBLK, RESRDT, and RQDATE + symbolic system calls. + +SREAPB: set the do not reap bit + + arg 1 Disk channel or + arg 2 0 for the normal case. + 1 to request the grim file reaper to + leave this file alone. + + The do not reap bit of the file open on the channel + is set. The G*** F*** R**P** doesn't + respect this bit yet. + + The bit can be read using the FILBLK system call. + It is UNREAP in the FSDEFS insert file. + +SSERVE: set server job + + arg 1 Client job (OPTIONAL) + If omitted, self is assumed. + arg 2 Server job + + The .SERVER variable of the client job is modified to point to the + server job. See the description of .SERVER in .INFO.;ITS USETS. + This system call permits .SERVER to be updated without trafficking + in user indices. + +Errors: + + 34 WRONG TYPE DEVICE + Neither the client nor the server can be the PDP6 + 31 CAN'T MODIFY JOB + Executing job must be able to modify the client job. + +SSTATU: get various system status variables + + val 1 If non-negative, the time (in thirtieths of a + second) until the system will go down. + -1 if the system does not intend to go down. + -2 if the system is already down (can happen + in a job with %OPLIV set). + Obtained from the ITS variable SHUTDN. + See the .DIETIME, .SHUTDN, and .REVIVE uuos. + val 2 Non-zero if the system is being debugged. + This state causes the message + XX ITS ### BEING DEBUGGED + to appear on free consoles instead of the + XX ITS ### IN OPERATION + message usually seen when the system comes up. + If negative, the system is officially down; + ^Z is accepted only from tty 0 (the terminal + physically next to the PDP-10 console) or from + the tty whose number is the absolute value of + the contents of this quantity. A ^Z is also + accepted from a tty associated with a STY; + this is so that STY devices may be debugged! + It is the responsibility of the STELNT server + to examine this quantity and keep network users + from logging in when the system is being debugged. + Obtained from the ITS variable SYSDBG. + val 3 Number of users on the system. This is a + count of logged-in, console-controlled job + trees in the system. This variable is + incremented whenever a user logs in from a + console, and decremented whenever a console- + controlled tree is detached, gunned, or logged out. + This is the ITS variable SUSRS. + val 4 Sum of parity and nxm memory errors during this + incarnation of the system. This is the sum of + the ITS variables PARERR and NXMERR. + val 5 Time the system has been up, in thirtieths of + a second. This is the ITS variable TIME. + See the .RDTIME uuo. + val 6 The left-justified name of the machine, i.e. one of: + SIXBIT \AI\ ;A.I. Lab KS-10 + SIXBIT \ML\ ;Mathlab KS-10 + SIXBIT \MC\ ;Mail Computer KS-10 + SIXBIT \MD\ ;Mostly Development KS-10 + SIXBIT \MX\ ;Macsyma Consortium KL-10 + SIXBIT \SI\ ;Stacken ITS KS-10 + SIXBIT \PM\ ;PandaMonium KS-10 + SIXBIT \FU\ ;Australian KS-10 + SIXBIT \DM\ ;Dynamic Modeling KA-10 (R.I.P.) + SIXBIT \MLKA\ ;Mathlab KA-10 (R.I.P.) + SIXBIT \AIKA\ ;A.I. Lab KA-10 (R.I.P.?) + This is the name which appears for XX in such + messages as + XX ITS ### IN OPERATION + and which serves as a device name for that + machine's disks (i.e. the ML device is the + DSK device of the ML (Mathlab) machine). + If more ITS machines come into existence, + naturally more machine names will be invented. + val 7 The system version number, in sixbit. This is + the ### in such messages as above. + val 8 The number of free job slots. + + DDT uses much of this information to print out its + greeting to you: + If value 2 is non-zero DDT prints out + ITS BEING DEBUGGED! + If value 1 is non-negative DDT prints out + XX ITS GOING DOWN IN 1:23 + if e.g. ITS were going down in 1 minute, 23 seconds. + (DDT also prints the contents of the file SYS:DOWN MAIL + if that file exists.) + Value 3 is used to print out the number of users as + 23. LUSERS + (if your DDT has not logged in itself, it increments + this value so as to count you also). + Values 4 and 5 are used to compute the number of memory + errors per hour, printed as: + MEM ERRS .034142/HOUR + The DDT command :SSTATU will print out all + this information. + +STATUS: get input/output status word + + arg 1 Channel number. + val 1 Status word for specified channel. + + This call returns a word describing the state of + the specified channel: + 4.9-4.6 Always zero. See the .IOPUSH and .IOPOP + uuo's, and the .IOP and .IOS user variables. + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + These are the same as the error codes returned + by failing .CALL's. + 2.9-2.3 Device dependent (see below). + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + 0 TTY Console input. + 1 TTY Printing console output. + 2 TTY Display console output. + 3 LPT Data Products line printer. + 4 VID Vidisector ??? + 5 BAT Vidisector ??? + 6 PLT Calcomp plotter. + 7 PTP Paper tape punch. + 10 IMX Input multiplexor. + 11 OMX Output multiplexor. + 12 PTR Paper tape reader. + 13 DIS DEC 340 display, ascii output. + 14 IDS Interpreted 340 display. ??? + 15 MTn Magnetic tape. + 16 COD Morse code device. + 17 TAB Tablet. ??? + 21 NUL Source of zeroes, or output sink. + 22 JOB Job device. + 23 BOJ Inverse of JOB. + 24 SPY Spy on another console. + 25 STY Pseudo-teletype. + 26 NET ARPAnet (NCP). + 27 LPT Vogue line printer (yech!) + 30 STK Stanford keyboard. + 31 MSP (DM) Interprocess message protocol. + 32 CHAOS CHAOS net. + 33 TCP TCP Internet. + 34 TRAP Trap "device" + 35 IPQ Internet IP Queue. + 41 UTn Microtape (DECtape). + 43 DSK 2311 disk drives or equivalent. + 60 USR A not immediately inferior procedure. + 61 USR An immediately inferior procedure. + 62 CLx Various core link devices (CLA, CLI, CLO, CLU) + 63 --- File directory or ERR device. + 64 USR The PDP-6. + 65 DIRHNG Directory hang "device" + 66 LOCK Lock "device" + + Device dependent bits for TTY input: + 2.9 Local tty. + 2.8 Next to the 340 or a 340 slave. + 2.5 Chars pending which have been .ITYIC'ed but not IOT'ed. + 2.4 The job possesses the tty. + + Device dependent bits for TTY output: + 2.4 The job possesses the tty. + + Device dependent bits for Data Products LPT: + 2.9-2.3 Current column (left margin = 0). + + Device dependent bits for MTn (macro-tape): + 2.9 Chunk, write EOR after each IOT (should be block) on output, + don't ignore them on input. See magtap info. + 2.8 0 => odd parity, 1 => even parity. + 2.7-2.6 Density: 00 => 800, 01 => 200, 10 => 556. + Apparently 11 => IBM 9 track 800 bpi?? + 2.5 0 => 7 track, 1 => 9 track. + 2.4 End of tape. + 2.3 Read compare error. + + Device dependent bits for NET: + 2.9-2.4 Socket state: + 0 %NSCLS CLS received or net down. Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in state 2. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent; waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + + Device dependent bits for TCP: + 2.9-2.4 Connection state - see WHYINT call for state codes. + + CHAOSnet provides no device dependent bits. + + A STATUS word can be supplied to the ERR + device to obtain corresponding error message, if any. + + See also the JOBSTS symbolic system call, the .STATUS uuo, + and the .IOS user variable. + +STDMST: set demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + arg 2 If negative, flush all requests for the specified demon. + Otherwise: + 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + arg 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and RDDMST symbolic system calls, + and the .DEMON uuo. + +STLGET: get information from Server Telnet + + arg 1 a + + val 1 XJNAME of server telnet + val 2 TRMNAM of server telnet + This is the sixbit name of the host connected to. + val 3 SNAME of server telnet + val 4 In LH: STY status bits + In RH: index of telnet server job which owns the STY. + + This call can be used to find out where in the network + a TTY really is. + + The STY status bits are from the STYSTS table in ITS. + Some of the more interesting ones include: + %SSNET==4000 ;4.3 = 1 => THIS STY CONNECTED TO SOME NET SOCKETS. + %SSCHA==2000 ;4.2 = 0 FOR ARPANET, 1 FOR CHAOS NET + %SSTCP==1000 ;4.1 = 1 for TCP internet (%SSCHA must be 0) + +Errors: + +34 WRONG TYPE DEVICE + Specified TTY is not controlled by a server telnet. + +STYGET: get information about STY + + arg 1 (need not be associated with a STY) + val 1 STY status word: + 4.9 %SSHNG Don't hang on input IOT. + 4.8 %SSUSE STY is in use. + 4.7 %SSINT Have given interrupt on STY output channels. + 4.6 %SSONT Have given interrupt on STY input channels. + 4.5 %SSOHG Don't hang on output IOT. + 4.4 %SSORS Give a %TDORS whenever an output RESET is + done on the controlled tty, regardless + of whether the tty is a software tty. + 2.9-1.1 User index of job which owns the STY. + Zero if STY is not in use, or if TTY is not + associated with a STY. + val 2 User index of job which owns the TTY, either as a device + or as a currently possessed console; or -1 if TTY is free. + val 3 -1 if the TTY is not a console or is free. Otherwise, + 2.9-1.1 is the user index of the top-level job of the + job tree controlled by the TTY. + 4.8 = 1 if that job is in the process of logging out. + 4.7 = 1 if that job is logged in. + + val 4 4.9 Owner of TTY is in a TTY output wait on the TTY. + 1.1 Owner of TTY is in a TTY input wait on the TTY. + These bits probably don't work very well. + val 5 4.9 TTY input available. + 4.8 TTY output buffer has room. + val 6 The tty's TTYSTA word. + 4.9 %TACFM TTY does not need a console free message + eventually (hasn't been in use since + the last one). + 4.8 %TAC.Z TTY is being ^Z'd. Shouldn't be on with + %TACFM. If %TACFM and %TAC.Z are both 0, + the tty is being freed and a console free + message is immanent. + 4.7 %TANJS This ^Z is being flushed because no job + slots are available. If set, %TAC.Z + will be 1 and %TACFM will be 0. + + This symbolic system call originally was intended to return + STY information, but now returns useful data concerning any TTY. + +STYNET: Connect a STY to a pair of Network connections. + + arg 1 Sty channel (either direction). + arg 2 -1 to disconnect the STY from its network channels + (in which case args 3 and 4 are unnecessary), + or Net input channel (to connect STY output to). + This may be a NCP, TCP, or CHAOS channel. + arg 3 Net output channel (to connect STY input to). + arg 4 Characters to send out on net + when an output .RESET is done on the STY's TTY. + Up to 3 8-bit characters, left-justified. + + It is possible with this call to connect a STY to a pair + of network channels, one open for input, and one open for output. + When the direct connection is established, anything received by + the net input socket will be fed automatically to the + STY, and any type-out that the STY receives from its TTY will be + fed automatically to the net output channel. The transfer of + data is handled by the system at clock level, eliminating + the need for the program to wake up at each character. + + Only one input and one output net channel can be connected to + a STY, and only one STY can be connected to any net channel. + Both sides of a STY are connected and disconnected at once. + A job can connect a STY if it has the STY open in either direction + (but it will generally want to have both directions open). + + Once established, the direct connection will last until + broken explicitly by the user, or until an escape condition + is detected by the system. Escape conditions include receipt + of a TELNET control character on the net input channel (any + character with the 200's bit on), and + either net channel's getting into an abnormal state (other + than %NSOPN, %NSINP, or %NSCLI) - in general, things which + the system expects that the user program will want to take + action on. + + The connection can be broken explicitly by the user either + by a STYNET call with arg 2 negative, or by a CLOSE of any + of the channels involved (this also happens when the job + is killed.) It is an error to IOT on any of the channels + without breaking the connection first. + + The STYNET call returns immediately, without actually + transferring any data. The program can assume that the + connection is still in effect until it is notified of + a disconnection by an interrupt on the net input channel. + While the connection lasts, interrupts on the net channels + due to arriving data are intercepted by the system, so + an interrupt implies that the connection has been broken. + + When a %TDORS comes out of the STY, indicating that the TTY's + output buffer has been cleared, this is indicated to the net + output channel by means of a network interrupt (NCP only), and the + string of up to 3 characters specified as the fourth argument + to the STYNET call. If TCP, these characters are PUSHed with the + URGENT bit set. + + If you use STYNET with the official TELNET protocol, you must + turn on the %TPTEL bit in the STY TTY's TTYOPT variable, to + cause the sequence CR-LF to be turned into just a CR. + + For the Chaosnet: + arg 1 - STY channel + arg 2 - Chaos channel to connect to, or + -1 to disconnect + arg 3 - Other Chaos channel (not actually used) + arg 4 - Output-reset character sequence, up to 3 8-bit + characters left-justified. + + This works the same as on the Arpanet. The specified STY + is connected to or disconnected from a Chaos net channel. + Data is transferred in and out by the system without the + need for intervention by the user program. If an unusual + condition occurs, the STY is disconnected from the Chaos + channel and the user is interrupted. It is illegal to do + I/O on any of the involved channels while they are connected. + + This call is provided for the benefit of the "Telnet" server. + +Errors: + + 2 WRONG DIRECTION + An input net channel was supplied as the third argument, or + an output channel was supplied as the second argument. + 23 FILE LOCKED + The STY or one of the network channels is already direct-connected + to another network channel or another STY. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + An attempt was made to disconnect a STY not already connected. + +T11MP: PDP-10 to PDP-11 map + + arg 1 Page number within the user's core. That page + must be either non-existent or shared with an + absolute page. The user's virtual page is made + to share with some arbitrarily chosen absolute + page, which is then made to share with PDP-11 memory + according to argument 2. + arg 2 Desired PDP-10 to PDP-11 map word. + 4.9 Valid (must be 1). + 4.8 Write enable. + 4.7-4.3 Unused. + 4.2-3.9 PDP-11 number. See below. + 3.8-2.2 Relocation (origin of segment in PDP-11 + address space). = 4*. + 2.1-1.1 Protection (number of accessible words - 1). + = 4*. + If protection=0 then only one 16-bit word + is accessible. + + The CORBLK symbolic system call may be used in the special + case of mapping one's TV console video buffer memory. + + The AI KA-10 has a PDP-10 to PDP-11 interface which lets the PDP-10 + programmer directly access the memories of up to eight PDP-11's. + PDP-10 pages are mapped into segments of variable size in the + PDP-11's memory. The PDP-10 to PDP-11 page map is also directly + addressable in memory (it currently lives in absolute locations + 2,,776000 - 2,,776377). There are 256. such entries, one for each + page in the range 2,,0 - 2,,777777, which are the addresses fielded + by the PDP-10 to PDP-11 interface. ITS allocates these pages + and their corresponding map entries randomly as needed. + + When the PDP-10 attempts to access a physical address in the range + 2,,0 to 2,,777777, the interface uses the 776000 bits to index + the map words. If the appropriate map word does not have its + valid bit set, the memory is considered non-existent. The same + is true if the reference would violate the protection bounds. + The reference also fails if it is a write reference and the + map word does not have the write enable bit set. + Otherwise, the relocation quantity is added to the 1777 bits, + and this determines which PDP-11 double-word to access. + The PDP-11 number determines which PDP-11 to access, of course. + The PDP-11 double-word corresponds to the high 32. bits of the + PDP-10 word, as follows: + PDP-10 BIT PDP-11 WORD AND BIT + 4.9 0 15 + 4.8 0 14 + 4.7 0 13 + --- --- --- + 3.4 0 01 + 3.3 0 00 + 3.2 1 15 + 3.1 1 14 + --- --- --- + 1.6 1 01 + 1.5 1 00 + When reading the PDP-11 memory, bits 1.4-1.1 are read as zeros. + When writing, 1.4=1 means don't change word 0, 1.3=1 means don't + change word 1, and 1.2-1.1 are ignored. Split cycles do the right + thing, so ILDB and IDPB should work correctly. + Note that accessing consecutive 16.-bit PDP-10 bytes will access + consecutive PDP-11 words, but accessing consecutive 8-bit PDP-10 + bytes will not access consecutive PDP-11 bytes! Rather, the PDP-11 + bytes are accessed in the order 1, 0, 3, 2. + + The following PDP11s are currently (4/2/76) attached. + + 0 The pdp11 that runs the AI KA-10 TV system. + 1 The pdp11 that runs the AI KA-10 XGP. + 2 The Lisp Machine GT40. + 3 The Chess Machine (not really a pdp11.) + 4 The Logo pdp11/45. + 5 The Micro-Automation pdp11/45. + +Errors: + + 1 NO SUCH DEVICE + There is no PDP-11 connected to this PDP-10. + 3 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + The page number is invalid, or the map word has bit 4.9=0. + 37 NO CORE AVAILABLE + No map words free. + +TCPOPN: open a TCP Internet connection (TCP;TCPDOC >) + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - local port # (-1 to gensym a unique local port #) + arg 4 - foreign port # (-1 for wild port) + arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild host) + arg 6 - Retransmission timeout (optional, not yet used) + +Control bits: + - None needed for channels - they are opened as .UAI and .UAO + automatically (no other modes possible). + - 7 vs 8 bit ASCII transfers can be determined by user-space byte + pointer used in SIOT. System buffers are always 8-bit bytes. + %NOLSN - Listen mode + + Note a value of -1 for either the foreign port or host will imply + that the call is a "listen". Return is always immediate, use NETBLK + to determine when the channels become open. For a non-listen call, + there is an internal ITS timeout, but for listen the state can persist + forever. + +ERRORS: + 6 - No free TCBs or buffers available (system has too many active conns) + 7 - TCP disabled in system. + 11 - Bad local or fgn port # + 13 - Connection already exists with these ports + 14 - Bad channel # arguments. + 33 - Illegal to use same channel for both input/output. + +TRANAD: add a translation entry (ITS TRANSL) + + cbits 2.9 Atomic translation (do not retranslate). + 2.8 0 => TRNLST, 1 => TRNLS1. + The TRNLST applies only to the specified job; + the TRNLS1 applies to the job and its inferiors, + direct or indirect. + 1.2 Output translation. + 1.1 Input translation. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to a block of "from" names. + arg 3 AOBJN pointer to a block of "new" names. + + Each AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are to be translated. All names are left-justified + within a word. A zero or omitted word is equivalent + to *. + Before creating the translation, a TRANDL is + performed on the first two arguments to prevent + duplicate translations. + + Uuos and symbolic system calls affected by translation + include .FDELE, .OPEN, MLINK, RENAME, and OPEN. + +Errors: + + 5 DIRECTORY FULL + No room in system for new translation entry. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to put a translation on the PDP-6. + 35 NO SUCH JOB + +TRANCL: clear translation list (delete all entries) (ITS TRANSL) + + cbits 2.8 Clear TRNLS1. + 2.7 Clear TRNLST. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + + + Either or both lists may be cleared with a single call. +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to clear translation lists for PDP-6. + 35 NO SUCH JOB + +TRANDL: delete a translation entry (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + 1.2 Stop translating for output. + 1.1 Stop translating for input. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 An AOBJN pointer to a block of names. + + The AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are no longer to be translated. All names are + left-justified within a word. A zero or omitted + word is equivalent to *. + +Errors: + + 4 FILE NOT FOUND + No such translation entry to delete. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to delete translation entry for PDP-6. + 35 NO SUCH JOB + +TRANEX: examine a translation list (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to array in core. + val 1 AOBJN pointer to tail end of array, + i.e. the part not needed to hold the data. + + The translation list is stored as consecutive + nine-word blocks of translation information. + Each block has the following form: + wd 0 4.9 Atomic translation entry. + 3.2 Output translation. + 3.1 Input translation. + wd 1 "from" device name. + wd 2 "from" file name 1. + wd 3 "from" file name 2. + wd 4 "from" sname. + wd 5 "to" device name. + wd 6 "to" file name 1. + wd 7 "to" file name 2. + wd 8 "to" sname. + A zero word for a "from" name means translate for any + name in that position; a zero "to" word means don't + change that name when translating. + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to examine translation list for PDP-6. + 35 NO SUCH JOB + 37 NO CORE AVAILABLE + Supplied array too small to hold data. + +TRANS: translate some file names (ITS TRANSL) + + cbits 1.1 0 for input, 1 for output. + arg 1 "from" device name. + arg 2 "from" file name 1 (defaults to zero). + arg 3 "from" file name 2 (defaults to zero). + arg 4 "from" sname (defaults to job's current sname). + arg 5 mode (XOR'd with control bits; defaults to 0). + val 1 "to" device name. + val 2 "to" file name 1. + val 3 "to" file name 2. + val 4 "to" sname. + + The given file names are translated by the same rules + for translation governing the operations of OPEN, + RENAME, DELETE, and MLINK. These rules are as follows. + + Translation lists are searched in the order: + executing job's TRNLST + executing job's TRNLS1 + executing job's superior's TRNLS1 + that job's superior's TRNLS1 + . . . + top-level job's TRNLS1 + system job's TRNLS1 + The lists are searched for an entry matching the given "from" + file names. A translation entry is said to match if each + "from" name matches the entry's corresponding name, + and if the translation entry applies to the mode (input or output). + A name in turn matches if the entry's name is the same as + the given name, or if the entry's name is * (matches anything). + If a match is found, the given file names are replaced by the "to" + file names in the translation entry, except that in the entry + a "to" file name of * means don't change the given name; + the process is then repeated from the beginning unless the + matching translation entry is atomic. When this happens, or + when a full search finds no matching translation entries, + the translation process is complete. To prevent endless + retranslation, it is considered an error to repeat the + translation process more than eight times. + + When a job is first created its TRNLST and TRNLS1 are null. + The TRANAD, TRANCL, TRANDL, and TRANEX symbolic system calls + may be used to examine and modify translation lists. + +Errors: + + 3 TOO MANY TRANSLATIONS + No more than eight consecutive translations are permitted. + +TRPOPN: Open trap-device channel + + arg 1 + arg 2 channel number in that job + arg 3 IOCHNM word (only LH is used) + arg 4 IOCHST word + + The specified channel of the specified job is made a trap-device + channel. Almost any attempt to use it will cause a %PITRP interrupt. + See documentation of the TRAP: device. + +Errors: + +13 FILE ALREADY EXISTS + The specified channel is open. + +14 BAD CHANNEL NUMBER + arg 2 is invalid. + +31 CAN'T MODIFY JOB + The is not clobberable. + +34 WRONG TYPE DEVICE + The is the pdp-6. + +TTYESC: simulate type-in of ^_ + + arg 1 + + Pretends that the user has just typed in a ^_. + The next character the user types will be interpreted + as a ^_ command. + + The intended use of this is for programs which use + super-image input, so that ^_ does not have its normal + effect, but which wish to provide an escape convention + so that the effect of ^_ can be obtained. When the program + sees the escape character sequence as input, it should + do a TTYESC. + +Errors: + +7 DEVICE NOT READY + The terminal is already in the middle of a ^_ code + being typed by the user. + +TTYFLS: flush TTY input + + arg 1 + control bits: + 1.1 0 => cause the last interrupt character .ITYIC'ed + to be ignored by .IOT. + 1 => discard all input up to and including the last + character .ITYIC'ed. + + This call is normally used by TTY input interrupt handlers. + +TTYGET: read the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + val 1 TTYST1 variable. + This variable contains six groups of six bits. + Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + The character groups are: + 4.9-4.4 ^@-^F ^K ^L ^N-^R ^T-^Z ^\-^_ + 4.3-3.7 Upper and lower case letters. + 3.6-3.1 Digits. + 2.9-2.4 ! " # $ % & ' , . : ; ? @ \ ` | ~ + 2.3-1.7 + * - / = ^ _ + 1.6-1.1 < > ( ) [ ] { } + val 2 TTYST2 variable. + Six more groups of six bits: + 4.9-4.4 ^G ^S + 4.3-3.7 ^I ^J (tab, linefeed) + 3.6-3.1 altmode (33) + 2.9-2.4 ^M (carriage return) + 2.3-1.7 rubout (177) + 1.6-1.1 space, ^H (backspace) + val 3 TTYSTS variable. + 4.9 %TSFRE Free console (not in use). + 4.8 %TSCLE ^L should echo as "^L" (normally + clears screen on displays). + 4.7 %TSHDX Same as %TOHDX. Vestigial. + 4.6 %TSFCO Use full 12-bit TV char set for output and + echoing: echo CONTROL as ALPHA, echo META + as BETA, echo SUPER as EPSILON, and use + Sail graphics if TOP is set. + 4.5 %TSALT Do not standardize altmodes. + 4.4 %TSROL Scroll mode. + 4.3 %TSSAI Echo and ascii output use SAIL + character set. + 4.2 %TSACT Next input IOT shouldn't wait + for an activation character. + 4.1 %TSNEA Don't echo in echo area; echo in M.P. Area. + 3.9 %TSINT Next input character should + interrupt even if it ordinarily + would not (%TGINT = 0). + 3.8 %TSMOR Inhibit **MORE** processing. + 3.7 %TSATY Set whenever an .ATTY executed by + some superior returns the tty to + the job. + 3.4 %TSNOE Defer echoing. + 3.3 %TSLCZ Last character typed was ^Z. + This bit causes .ATTY's to fail. + 3.2 %TSSII Super-image input. The special + actions of ^Z and ^_ are suppressed. + 3.1 %TSCNS This is a console, not a device. + 2.9-1.1 The user index of the job which controls + the tty, or -1 if the tty is free. + val 4 the TTYTYP variable + See the CNSGET documentation. + val 5 the TCTYP variable + See the CNSGET documentation. + + Values 4 and 5 probably should not be depended upon. + + See also the CNSGET, CNSSET, and TTYSET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYSET: set the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + arg 2 TTYST1 variable. See under TTYGET. + arg 3 TTYST2 variable. See under TTYGET. + arg 4 TTYSTS variable (optional). See under TTYGET. + %TSFRE, %TSHDX, %TSLCZ, and %TSCNS may not be altered, + nor may the RH. + + See also the CNSGET, CNSSET, and TTYGET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYVAR: read or set a variable associated with a TTY. + + arg 1 or + + In the simplest mode: + + arg 2 the name of a tty variable, in SIXBIT. + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 the SIXBIT name of a tty variable. + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the SIXBIT name of a tty + variable, and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The TTY variables include HEIGHT, WIDTH, ISPEED, OSPEED, TTYOPT, + TTYTYP, TTYCOM, TCTYP, TTYROL, TTYSMT, and IDLTIM. See + .INFO.;ITS TTY for a description of their meanings. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized tty variable name. + 26 DEVICE WRITE-LOCKED + Specified variable or specified tty cannot be written. + 33 MEANINGLESS ARGS + Attempt to store an illegal value in the TCTYP variable, + or an illegal instruction was specified in immediate- + instruction or block mode. + +TVWHER: tell where a TV is + + arg 1 or + val 1 The keyboard number of the physical + terminal in use. + The correspondence between keyboard numbers + and physical locations is in the file + SYSENG;TVKBD ROOMS, which is how the NAME + program gets this information. If this table + and that file disagree, that file is correct, + and please update this table. + As of February 7, 1977, these correspondences + were in effect: + KBD # ROOM WHO LIVES THERE + 0 809 Fahlman, Holloway, Knight x7807 + 1 810 Lavin, Kuipers, Miller, Bruss x7836 + 2 919 Very Small Data Bases north x6765 + 3 812 Yvonne, Karen x5876 + 4 813 Hewitt x5873 + 5 814 Sussman, McDermott x5874 + 6 808 Freiling, Lozano-Perez, Ullman x5875 + 10 817 Jabari x6218 + 13 819 Goldstein x5879 + 14 820 Minsky x5864 + 17 822 Marr x2082 + 21 824 Rich, Levin, DeKleer x6032 + 22 825 Purcell, Doyle x5848 + 23 826 Fredkin's Folly x5904 + 30 925 Moon (Tycho, north wall) x6765 + 31 902 Mason, Raibert, Hollerbach x3483 + 32 919 Very Small Data Bases south x6765 + 33 344 Edwards, Lebel x6765 + 34 913 Baisley, Greenblatt x6765 + 35 914 Gosper's Fishbowl x2076 + 36 912 9th Floor Lounge x6765 + 37 907 Chess, Lisp Machines x6765 + + val 2 The number of the TV video buffer in use + on this tty (0-17 octal). This is NOT a + Video Switch input number. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +UNLOCK: Unlock JOB's locks. + + arg 1 + + If the specified job is writable, and is using the locks + feature, its locks are unlocked. (Usually this is used on + onesself.) See the ITS LOCKS file for more information + on locks. + + (Note that this has nothing to do with the LOCK device. In + particular it will -not- close LOCK device channels.) + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + + Plus the usual errors for arguments. + +USRMEM: Read or write another job's memory + + cbits 2.9 Allow writing into any job + 1.1 If page isn't readable or writable give an + MPV or pure interrupt to the job being + referenced. + + arg 1 + Other args are like USRVAR and TTYVAR. In place of + a variable-specifier you put the address in the job + of the word to be read or written. + + arg 2 Address to read or write (non-negative) + + Straight reading: + + Specify only 2 arguments. + + Straight writing: + + arg 3 New value + + Writing with an instruction: + + arg 3 Ignored + arg 4 Instruction to write with + + Block mode: + + arg 2 An AOBJN pointer to a block of pairs, first address + and then instruction. + + val 1 Previous contents (these are not valid in block mode) + val 2 New contents + + + Reading: + The content of the specified address in + is returned as val 1. + + Writing: + Arg 3 is written into the specified address + in . The previous contents are returned + as val 1. + + Writing with an instruction: + The instruction should modify its AC as if the spec'd job's + memory location were in it. The memory operand is fetched + from your own address space and is not stored back. + No jobs can run while the location is being modified, that is + between the fetching of the old value and the storing of + the new value. + The previous contents are returned as val 1, the new + contents as val 2. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + 32 CAN'T GET THAT ACCESS TO PAGE + The specified page is either nonexistant + or is read-only. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction for writing. + +USRVAR: Read or set some of a job's variables + + arg 1 + + In the simplest mode: + + arg 2 user variable specifier (see below). + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 user variable specifier (see below). + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the user variable specifier + (see below), and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + + This call is the symbolic equivalent of the .USET and .SUSET + UUO's. It can read, write, or both (but you are usually not + allowed to write any job except yourself or an inferior); + it is a .SUSET if the is %JSELF, or a .USET if given a + channel number as the , or it can be given other kinds + of job specs. + + The user variable specifier can be either numeric or sixbit. + If sixbit, it is the same as the name given in the ITS USETS + file except without the dot at the beginning. Sixbit specifiers + are good for programs which take arguments as to which user + variable to operate on, and are useful to allow a program + which uses a new variable to assemble before that variable is + actually put in the system (it will get error code 11 when it + tries to refer to the variable.) + + A numeric specifier is a small integer similar to those used + with the .USET and .USET uuos. Predefined symbols exist for + these, consisting of ".R" followed by the name of the variable. + (Use ".R" rather than ".S" even if you are writing.) Do not + use the symbols without the "R" (these are something else.) + The .IOC, .IOS, .IOP, and .PMAP arrays of user variables + can only be specified numerically. + + See the .SUSET and .USET UUO's (in .INFO.;ITS UUOS) + for more information on particular user variables. + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized sixbit user variable specifier, or numeric specifier + larger than the legal range. + 12 MODE NOT AVAILABLE + The specified variable is not available for the current combination + of reading versus writing and self versus other job. + 13 FILE ALREADY EXISTS + Attempt to cause two jobs in the system to have the same UNAME/JNAME pair. + 31 CAN'T MODIFY JOB + Attempt to write into a user variable of a job which is not writable. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction in immediate- + instruction or block mode; or attempt to store an illegal value + into a user variable (e.g. zero into the .UNAME). + 34 WRONG TYPE DEVICE + Attempt to access user variables of the pdp-6 other than .UIND + or .MEMT. + 40 NOT TOP LEVEL + Attempt to set a user variable for a job that is not top level, + when only top-level jobs are allowed to set that variable, for + example the .UNAME and .JNAME. + +VIDBUF: request/release video buffer + + arg 1 If non-negative, the number of a video buffer + to release. If negative, requests a video buffer. + val 1 If arg 1 was negative, the number of the buffer obtained. + + A video buffer for the PDP-11 TV consoles is assigned or + released. If assigned, the video switch input number + of that buffer is returned. This value can be placed + in bits 4.1-3.3 of the .TVCREG user variable in order to + cause video buffer pages in one's page map to refer to + the allocated video buffer. + + A video buffer is a segment of PDP-11 memory large enough + to represent all the bits on a TV display. A display + is 1100=576. bits wide by 706=454. lines high. Every + line is represented by 36. 16.-bit PDP-11 words; + this corresponds to 18. PDP-10 words as mapped through + the PDP-10 to PDP-11 interface (see the T11MP symbolic + system call). The word with the lowest address holds + the leftmost displayed bits; furthermore within each word + bit 15 is the leftmost displayed bit. Thus, as seen by the + PDP-10 bits are displayed in the "obvious" manner. + The entire buffer is 16344.=37730 PDP-11 words long; + this corresponds to 8172.=17754 PDP-10 words. + The word 77777 PDP-11 words (17777 PDP-10 words) from the + origin of the video buffer is a special control register: + 3.2-2.9 15-13 Unused. + 2.8 12 0 => white on black, 1 => black on white. + 2.7-1.5 11-00 Scroll offset: video buffer wraps around; + the first word displayed is that 4* + PDP-11 bytes from the buffer origin. For + best results this should be a multiple + of 9 (for vertical scrolling). + The PDP-11 always sees a video buffer as beginning at its + location 60000 (byte address); which video buffer it is looking + at is controlled by the console register at location 164044 octal. + Thus the PDP-11 sees the scroll register as being at address + 157776 octal. + + See also the VIDSW symbolic system call. +Errors: + + 4 FILE NOT FOUND + Attempt to release a buffer not assigned to the job. + 7 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + Arg 1 is non-negative but not a valid video buffer number. + +VIDSW: set video switch + + arg 1 Video switch input number. + arg 2 Video switch output number. + + The video switch is set up so that the specified video + output will gobble bits from the specified video input. + + As of July 25, 1975, the only video inputs are TV + video buffers. These correspond to Tnm device numbers + as follows: + + Tnm Video Input Number + T47 24 T47 is used for console free buffer. + T52 1 When you type ESCS, is + T53 2 the video input number. The PDP-11 + T54 5 merely switches that input to your + T55 6 TV display, which is a video output. + T56 7 + T57 10 + T60 21 + T61 22 + T62 23 + + The possible video outputs are mostly TV displays, but also + the Tektronix hard-copy device which sits next to the XGP. + (The keyboard number may be relevant to use of the TVWHER + symbolic system call.) As of July 25, 1975: + + Video Output Keyboard Location of TV + 0 0 809 Fahlman, Holloway, Knight + 1 14 820 Minsky + 2 21 824 Rich, McDonald, deKleer + 3 6 815 Freiling, Perez, Ullman + 4 10 817 Jabari + 5 22 825 Freuder, Grossman, Purcell + 6 4 813 Hewitt + 7 5 814 Brown, McDermott, Sussman + 10 13 819 Goldstein, Woods + 11 17 822 Marr, Sandewall + 12 35 915 Cohen, Gosper, etc. + 13 34 913 Baisley, Greenblatt + 14 33 334 Lebel + 15 30 925 Jarvis, Moon + 16 31 918 Freeman + 17 32 920 Computer room, near PDP-11 + 20 3 812 Yvonne, Williams + 21 36 912 9th Floor Lounge + 22 37 914 Larson, Lebel, Mousouriss + 23 1 810 Kuipers + 27 Tektronix hard-copy output device. + +Errors: + + 7 DEVICE NOT READY + The PDP-11 is not ready. + +WHOLIN: examine and set TV who-line (ITS TV) + + arg 1 or + Must be a TV terminal if a . + arg 2 If present, used to set new who mode: + -1 No who-line. + 0 User who-line; migrates with TTY. + 1 User who-line; frozen on who job. + 4 System who-line. + arg 3 If present, used to set new who . + val 1 Old who mode. + val 2 Old who job. + + The TTY must be specified by a channel number and not + by 400000 + tty number if the variables are to be altered. + + See ITS TV. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +WHYINT: Find out reason for second-word interrupt + + arg 1 channel # (or ) + + val 1 %WY code (see below) + val 2-n device-dependent + + This system call is the standard response to a second-word + (.IFPIR) interrupt. The first value returned is a code + number which indicates the type of device on the channel. + Usually a program will know what type of device is present, + because it only tries to use one type, but this value + is provided just in case. The codes are: + + 1 %WYTYI TTY input + 2 %WYTYO TTY output + 3 %WYSTI STY input + 4 %WYSTO STY output + 5 %WYNET (Arpa)NET + 6 %WYCHA CHAosnet + 7 %WYTCP TCP Internet + The device-dependent values returned are: + + For a TTY input channel: + val 1 %WYTYI + val 2 character typed. Reading characters this way + does not interfere with later reading them via + normal IOT. This allows characters to be processed + both as interrupt characters at the time they are + typed, and as normal input. The call fails to + skip if there are no more interrupt characters. + The program should keep calling WHYINT until + it fails to skip, then DISMIS the interrupt. + + For a TTY output channel: + val 1 %WYTYO + val 2 bit mask of reasons. The only reason that presently + exists is: + 4.9 --MORE-- interrupt. (Typeout reached + the bottom of the screen.) + + For a STY input channel: + val 1 %WYSTI + + For a STY output channel: + val 1 %WYSTO + + For a NET (Arpanet NCP) channel: + val 1 %WYNET + val 2 Sign bit 1 if "network interrupt" received. + Right Half Socket state: + 0 %NSCLS Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in %NSRFC state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent, waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + val 3 Number of bytes of input available (if input channel). + Number of bytes free in output buffer (if output channel.) + val 4 Close reason. Only valid if val 2 is %NSCLS. + 0 %NCNTO Never opened. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down (local host dead). + 10 %NCRFS Request for Connection rejected by fgn host. + + For a TCP channel: + val 1 %WYTCP + val 2 state code (see below) + val 3 input: # bytes avail, output: # bytes free in buffer + val 4 Close reason (same values/meanings as for NET. See + definition of %NX== in SYSTEM;BITS > if curious.) + + The TCP state codes are defined in SYSTEM;BITS > at %NT==: + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out + %NTCLS==:0 ; - - Closed (reason available from WHYINT) + %NTLSN==:1 ; - - Listening for a SYN + %NTSYR==:2 ; - - SYN received + %NTCLU==:3 ; + ? Being closed by fgn host + %NTSYN==:4 ; - - SYN sent, waiting for response + %NTOPN==:5 ; *I *O Open + %NTWRT==:6 ; ? *O Output buffer full + %NTCLX==:7 ; ? + Being closed by user + %NTCLI==:10 ; +I ? Closing/closed, input still available + %NTINP==:11 ; *I ? Open, input available + + + Chaosnet: + val 1 - %WYCHA + val 2 - state + val 3 - number of packets queued (receive,,transmit) + val 4 - window size (receive,,transmit) + val 5 - input channel#,,output channel# (-1 if not open or I/O-pushed) + + LH(val 3) is the number of packets available to input IOT. + This is different from the number of received packets + if some are out of order. This is increased by 1 if + there is a partially-read buffer available to SIOT; + this packet is not available to PKTIOT. This is zero + if the connection is direct-connected to a STY. + + RH(val 3) is the number of packet slots available in the output + window, i.e. the window size minus the number of packets + which have been transmitted by output IOT but which have + not yet been received and acknowledged by the foreign + host. + + The state codes are: + + %CSCLS Closed + %CSLSN Listen + %CSRFC RFC-received + %CSRFS RFC-sent + %CSOPN Open + %CSLOS Broken by receipt of "LOS" packet. + %CSINC Broken by incomplete transmission (no acknowledge + for a long time) + +Errors: + +34 WRONG TYPE DEVICE + The specified channel supposedly never gives interrupts. + +XGPIM: xerox graphic printer image output + + arg 1 Address of a word with the number of pages of + data in the left half and the number of the first + data page in right half. + This word must be in writable memory. + + Bits are shoved out onto the XGP. + + I wonder what the precise semantics of this kludge are? diff --git a/sysdoc/_calls.127 b/sysdoc/_calls.127 new file mode 100644 index 0000000..a2fef7e --- /dev/null +++ b/sysdoc/_calls.127 @@ -0,0 +1,5269 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS CALLS: + +This file attempts to maintain up-to-date documentation on all +symbolic ("new") system calls. Those wonderful souls who update the +information in any way (additions, deletions, corrections) should +describe their modifications in a brief note to INFO-ITS@AI so that +interested parties can correct their copies or conceptions without +needing to print or read the entire file again. For example: + + :MAIL INFO-ITS@AI I added more details to the "FOO" call ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + +The format for executing a new system call is: + +CALL: .CALL CALBLK ;the call itself + ;error return is to CALL+1 + ;successful return is to CALL+2 + + + ... + +CALBLK: SETZ ;always + SIXBIT /NAME/ ;where "NAME" is any implemented call + parm1 ;parameters start here + parm2 + + ... + + SETZ parmn ;bit 4.9 (SETZ) => last argument + +A list of all implemented system calls may be seen in +AI:SYSTEM;ITS > starting at SYSCTB:. The actual addresses +within ITS where each call is executed may be found from the +table starting at SYSCTD:. + +There are four types of parameters: + (input) argument + (output) value + (error) error return code + (input) control + +Bits 4.1-4.3 of the parameter word form an "op code" +for that parameter: + + Op Code Meaning Symbol Value + + 0 argument %CLIN 0000 + 1 immediate argument %CLIMM 1000 + 2 value %CLOUT 2000 + 3 error return code %CLERR 3000 + 4 control %CLBTW 4000 + 5 immediate control %CLBIT 5000 + + +The indirect, index, and address fields are used to calculate +an effective address, PDP-10 style. These point to the location +where the argument is or the output is to be placed. For +immediate parameters the address itself is the argument or +control bits. (Some calls update their input arguments. Such +arguments may not be immediate.) + +The order of the input arguments matters; so does the order of +the output values. Other than that, the order is irrelevant. +(As a matter of style, one normally writes them in the order +"control, arguments, values, errors" for clarity. In the descriptions +given here the parameters will always be described in that order.) + +If too many input arguments are present, the excess are ignored, +except that more than 9 arguments will cause error 15. If too +few arguments are present, error 30 occurs. If too many output +values are specified, the extra values will be garbage. If too +few output values are specified, only those specified will +receive information, and any extra output is thrown away. +Specifying more than one error return parameter causes error 15. +Specifying an illegal sixbit name for the call causes error 43. + +If an error return parameter is specified, then if the call +takes the non-skip return an error code will (probably) have +been stored into the error return parameter. It is also +stored into the I/O Status Word of some channel, as before. +If the call fails but no error code is returned, the error +return parameter is zeroed. Note that the error return parameter +is also zeroed if the call succeeds. Also, since this zeroing +takes place when the arguments are first processed, the error +return parameter should not be located on top of any input +arguments. Only one error return parameter is permitted. + +The values of all control bit parameters given are XOR'ed +together, and the result may or may not be used by the system +call. Only the right half of a non-immediate control bit +parameter is significant. Some system calls XOR the left +half of their first argument with the control bits as well. + +FAILURE CODES: Returned by New System CALLs (and .OPEN's, etc.) + +The failure code from a new system call that doesn't skip can be +obtained by reading the .USET variable .BCHN to find the number of +the channel on which the code was returned, and then reading +that channel's .IOS variable (using the .STATUS uuo or +the STATUS symbolic call) to get a word with the error code +in bits 3.6-3.1. + +Alternatively an error return code argument may be specified and the error +code will be stored right-justified (not in bits 3.6-3.1, but bits 1.6-1.1). +To get the corresponding message from the ERR device, use a first file +name of 4 (number, not sixbit) and use the error code as the second file name. + +The error codes which may be returned by each individual call are described +in the documentation for that call. Note that if the call is interpreted +by a job device, any error code may be returned, not just those documented; +job devices should, however, adhere as closely as possible to normal +error code conventions. Errors codes 15, 30, 43, and 44 may be returned by +any symbolic system call, and so are not included under the individual +descriptions. + +The ERR device can be used to get a corresponding message as indicated in +the table on the following page. See the OPEN system call for information +on the ERR device. + +The error codes have symbolic names, which are pre-defined in DDT and +MIDAS. The first two characters in the name are "%E". The remaining +letters usually follow the following conventions. 3rd and 4th letters: +"TM" = "too many", "BD" = "bad or illegal", "TF" = "too few", "RO" = +"read-only", "NA" = "not available", "NS" = "no such", "EX" = "already +exists", "FL" = "full", "NR" = "not ready". 5th and 6th letters: "JB" = +"job", "RG" = "arg", "DV" = "device", "DR" = "directory", "IO" = +"direction", "FL" = "file", "FN" = "file name". + +ERROR CODES: + +Number Symbolic Message +------ -------- ------- +1 %ENSDV NO SUCH DEVICE +2 %ENSIO WRONG DIRECTION +3 %ETMTR TOO MANY TRANSLATIONS +4 %ENSFL FILE NOT FOUND +5 %EFLDR DIRECTORY FULL +6 %EFLDV DEVICE FULL +7 %ENRDV DEVICE NOT READY +10 %ENADV DEVICE NOT AVAILABLE +11 %EBDFN ILLEGAL FILE NAME +12 %ENSMD MODE NOT AVAILABLE +13 %EEXFL FILE ALREADY EXISTS +14 %EBDCH BAD CHANNEL NUMBER +15 %ETMRG TOO MANY ARGUMENTS +16 %ENAPK PACK NOT MOUNTED +17 %ENADR DIRECTORY NOT AVAIL +20 %ENSDR NON-EXISTENT DIRECTORY +21 %ELCDV LOCAL DEVICE ONLY +22 %ESCO SELF-CONTRADICTORY OPEN +23 %ENAFL FILE LOCKED +24 %ETMDR M.F.D. FULL +25 %EMCHN DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +26 %ERODV DEVICE WRITE-LOCKED +27 %ETMLK LINK DEPTH EXCEEDED +30 %ETFRG TOO FEW ARGUMENTS +31 %EROJB CAN'T MODIFY JOB +32 %EROPG CAN'T GET THAT ACCESS TO PAGE +33 %EBDRG MEANINGLESS ARGS +34 %EBDDV WRONG TYPE DEVICE +35 %ENSJB NO SUCH JOB +36 %EBOJ VALID CLEAR OR STORED SET +37 %ENACR NO CORE AVAILABLE +40 %ETOP NOT TOP LEVEL +41 %ENAPP OTHER END OF PIPELINE GONE OR NOT OPEN +42 %ENAJB JOB GONE OR GOING AWAY +43 %ENSCL ILLEGAL SYSTEM CALL NAME +44 %ENSCH CHANNEL NOT OPEN +45 %ENRBF INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +46 %EBDFL UNRECOGNIZABLE FILE +47 %EBDLK LINK TO NON-EXISTENT FILE + +ARGS: Special Common Types of Arguments + + TTY channel # + STY channel # (accesses TTY which is STY's alter ego) + 400000 + TTY # (may be used to examine TTY variables, + but not to alter them or to transact input/output) + + channel # for USR device + channel # for JOB device (means job on other end, + unless argument may also be a , in which + case the job device will interpret things) + channel # for BOJ device (means calling job) + channel # for STY device (means job possessing + the corresponding TTY) + 400000 + job # (user index) + -1 or 777777 specifies self. + 400377 specifies superior. + 400376 specifies the pdp6. + + The symbols %JSELF (777777), %JSNUM (400000), %JSSIX (400376), + and %JSSUP (400377) are pre-defined in MIDAS and DDT. + Various other symbols beginning with %JS are defined + for special codes that can be used instead of a + spec with certain calls; they are documented + under those calls. + + channel # for JOB device + + Many symbolic system calls which take a channel number + as the first argument may be passed to JOB devices + for interpretation by that device. A few act on the device + itself, and are not passed for interpretation. Those + passed for interpretation include: + ACCESS CNSGET CNSSET + DIRSIZ DSKUPD FILBLK + FILLEN FINISH FORCE + JOBCAL JOBGET JOBINT + JOBIOC JOBRET JOBSTS + LISTEN NETAC NETBLK + NETINT RAUTH RHCST + RCPOS RDMPBT RENMWO + RESET RESRDT RFDATE + RFPNTR RSSIZE SAUTH + SCML SCPOS SDMPBT + SETIOC SFDATE SRDATE + SREAPB STLGET STYGET + TTYGET TTYSET TTYVAR + TVWHER WHOLIN WHYINT + + The JOB device may of course interpret such calls in + any way desired, and return any results desired. + It is of course advisable to adhere as closely to + the standard actions of each call as possible. + + Most of the above calls simply pass the symbolic + call name and arguments along to the JOB device. The + following have special interfaces for historical reasons: + + ACCESS RCHST RENMWO + RESET + + The following calls can open up a JOB device if their + sixbit device name argument is not the name of a + device that is built into the system: + + DELETE MLINK OPEN + RENAME + + Those calls which are definitely NOT passed for + interpretation include: + CLOSE + IOT + SIOT + STATUS + RFNAME + IOPUSH + IOPOP + These calls interact with the JOB device in another way. + +A number of these calls include special bits and fields in their +arguments or return values. Several files exist which contain +symbolic definitions of these bits and fields. These files +can be inserted into a MIDAS program with .INSRT. In addition, +most of the symbols are predefined in MIDAS and DDT through +a symbol table in the system. The symbols defined are the same +as used in this documentation. + +The following files exist on the SYSENG directory. + + FSDEFS > Bits in fields used by the file system, + including the format of directories. + ITS BITS Miscellaneous bits and codes. + +The following errors are standard for all calls that take +arguments, and are generally not documented under the individual +calls: + + 14 BAD CHANNEL NUMBER + The argument was not a special negative code, not + 400000+a user number, and not a valid channel number. + 33 MEANINGLESS ARGS + A random number that could not be decoded was given + as a argument. + 34 WRONG TYPE DEVICE + A channel number was specified that did not have open an + appropriate type of device (generally USR, STY, or BOJ). + 35 NO SUCH JOB + 400000+user number was specified, but the user number + did not correspond to a currently-existing job, or + 400377 was given, specifying the superior, but the job + was top-level. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + A STY channel number was specified, but the corresponding + TTY was free and had no associated job. + 42 JOB GONE OR GOING AWAY + The specified job exists but is in process of being killed. + +The following errors are standard for all calls that take arguments: + + 1 NO SUCH DEVICE + 400000+tty number was specified, but there is no tty with the + indicated number. + 14 BAD CHANNEL NUMBER + The argument was not 400000+tty number and was not a valid + channel number. + 34 WRONG TYPE DEVICE + A channel number argument does not refer to a channel open + to a STY or a TTY. + 44 CHANNEL NOT OPEN + The specified channel is not open. + +ACCESS: set file access pointer + + arg 1 Channel number. + arg 2 New access pointer. This pointer is + the number of bytes from the beginning + of the file of the next byte to be + processed. Note that in block mode, + even ASCII block mode, a byte is always + a full word. + + This is useful primarily for DSK and disk-like job devices; + that is, any device which has "files." + + See also the .ACCESS uuo. + +Errors: + + 14 BAD CHANNEL NUMBER + + If the ACCESS pointer is set to more than the number of words in + in the file, an IOC error 2 will occur on the next IOT operation + on that channel. + +ATTACH: attach a job-tree to a console (ITS DETACH) + + cbits 2.9 If there are 2 args, causes the jname + of the job being attached to be changed + to HACTRN, unless there is already a HACTRN. + 1.3 "P" the job by clearing bit 4.4 of .USTP + arg 1 to be attached to the console. + arg 2 Optional: to attach it to. Must be free. + If not present, the executing job must be + top-level and console-controlled; it is logged + out, and its console used as the tty to attach to. + + Attaching a job tree to a tty causes the job tree to be + console-controlled with the specified tty as its console. + The specified job must be either the top-level job of + a disowned job tree, or a direct inferior of the job executing + the ATTACH; in the latter case the specified job is disowned + first. The tty to be attached to must be free. In the + one-argument case the job executing the ATTACH must be the + top-level job of a console-controlled job tree; it is logged + out to make the console free. The one-argument case furthermore + causes the attached job to take on the jname of the job + executing the ATTACH. In the 2-argument case, control bit + 400000 causes the attached job to take on the jname HACTRN, + unless that would cause it to have the same names as an + existing job. + + The one-argument case is made available in DDT via the + command :ATTACH, which attaches the current job to the console. + Also, when a user logs in (say as FOO), DDT checks for the + existence of a job called FOO HACTRO; if it exists, DDT asks: + --ATTACH YOUR DETACHED JOB-- + If at this point the user types a space, DDT executes the + commands "HACTROJ :ATTACH ", thereby attaching the HACTRO to + the console, and changing the HACTRO's name to HACTRN. + This affords a convenient method of recovery from automatic + detachment. + + See the DETACH symbolic system call. + +Errors: + + 10 DEVICE NOT AVAILABLE + This job's tree is not console-controlled (one argument); + the specified tty is not free or does not exist (two arguments). + 14 BAD CHANNEL NUMBER + The first argument is not a valid channel number. + 31 CAN'T MODIFY JOB + The specified job is not disowned or a direct inferior. + 34 WRONG TYPE DEVICE + First argument must be a job. + 35 NO SUCH JOB + First argument specified a non-existent job. + 40 NOT TOP LEVEL + The executing job must be a top-level job (one argument). + +ATTY: pass tty to inferior + + arg 1 + + The tree's console tty is passed to the , which must + be a direct inferior. This is the same as the .ATTY uuo. + +Errors: + +31 CAN'T MODIFY JOB + The specified job is not a direct inferior. + +34 WRONG TYPE DEVICE + The specified job is the pdp-6. + +42 JOB GONE OR GOING AWAY + The specified job is dying. + +CALL: perform system call + + arg 1 Name of symbolic system call to perform. + + The other arguments serve as the arguments to the + specified symbolic call. The values and errors returned by + that call become the values and errors of this call. + This is useful if the name of a symbolic call is to be + determined dynamically. Lisp hackers should think of this + as the "Funcall" system call. + +CHAOSO: open Chaosnet connection + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - receive window size + + First, the two specified channels are closed. Then an index + is assigned to the user and the two channels are set up to + point to it. Two channels are used since in general ITS + channels are unidirectional, and to allow to the user to + handle receive and transmit interrupts differently. + + The created index is placed in the Closed state. To set up + a connection, IOT an RFC or LSN packet down the transmit + channel. + +CHAOSQ: Chaosnet Queue + + arg 1 - address of a 126.-word block (packet buffer) + + This is a special system call for use by the ATSIGN CHAOS + program, which is a daemon program that gets run when + an RFC is received that does not match up against an + existing LSN. + + The first packet on the pending-RFC queue is copied + into the packet buffer, then moved to the end of the + queue (so that the right thing happens when several + RFC's are pending at the same time.) + + The call fails if the pending-RFC queue is empty. + + The program should use the contact name in this + packet to choose a server program to execute. This + server program will then LSN to (presumably) the same + contact name, thus picking up the RFC. + +CLOSE: close input/output channel + + arg 1 Channel number to close. + + The specified input/output channel is closed. + + For TCP connections: + A CLOSE on the output channel will cause an automatic FORCE, + and a FIN segment will be sent to the remote host indicating + "no more data to send". However, the input channel will + remain open, and data can continue to be read from it. + A CLOSE on the input channel will cause any further input received + to be thrown away by ITS. Output can continue to be sent. + Return from this call is immediate; it will not hang. Note that, + like NCP, this does not allow the user to determine + whether the last stuff successfully reached the destination or + not. When this is desirable, a FINISH should be done prior to + the CLOSE. + +For the Chaosnet: + Immediately closes the connection. All buffers and other + information associated with the index are discarded. Normally + the user should first IOT a CLS + packet containing an ascii explanation for why it is + closing. Note that any data previously written on the + connection but not yet received by the other end will be + lost. The system will attempt to send a CLS with reason + "channel closed", but this will only be sent if buffer space + is available. + + See also the .CLOSE uuo. + +CNSGET: get various console parameters (ITS TTY) + + arg 1 or + val 1 Vertical screen size. + val 2 Horizontal screen size. + val 3 TCTYP variable. + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + val 4 TTYCOM variable. + 4.9 Communicate mode. + 4.8 %TCLFT Local feed through (my job sees his typing). + 4.7 %TCRFT Remote feed through (his job sees my typing). + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 4.1 %TCECH The last output to this tty was PI echo. + 3.9 %TCINP Someone waited for input since last home-up. + 3.8 %TCDET Console's tree detached by top level interrupt. + 3.7 %TCDNG Type bell (input buffer full). + 3.6 %TCCBK Reading uname or tty number after ^_K. + 3.5 %TCCBS Reading uname or tty number after ^_S. + 3.4 %TCFPD First part of an output code sequence is done. + 3.3 %TCTPN Type ^_N on leaving comm (unless user types it). + 3.2 %TCPAD 0 => padding necessary on datapoint. + 3.1 %TCHNG Done flag seems to be fried - time out quickly. + 2.9-1.1 -1 if not in comm mode; otherwise number of + next tty in circular list of those in comm mode + together. + val 5 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + val 6 TTYTYP variable. + 4.9 %TTLCL Local tty (i.e. right near the PDP-10). + 4.8 %TT340 Near the 340 or a 340 slave. + 4.7 %TT3HP High priority for grabbing 340. + 4.3 %TTPAR Tty needs a parity bit generated by software. + 4.2 %TTDDI Don't ding bell on excess input. + 4.1 %TTIBM Datel (2741) line. + 3.8-3.5 $TTISP Input speed code: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + 3.4-3.1 $TTOSP Output speed code, as above. + 2.9 %TYDPK Datapoint controller line. + 2.8 %TYSTY Alter ego to a STY. + 2.7 %TYNVA Nova tty (requiescat in pace). + 2.6 %TYMTY Morton controller line. + 2.5 %TYDIL Dial-up line. + 2.4 %TY11T PDP-11 TV tty. + 2.3 %TYDL DL-10 tty. + 2.2 %TYOTY KA-10 console tty. + 2.1 %TYETY DTE-20 tty. + 1.9 %TYNTY TK-10 tty. + 1.8 %TYMDM Dial-up line with modem control. + 1.7 %TYKST KS-10 console tty. + 1.6 %TYDZT DZ-11 tty on a KS-10. + 1.5 %TYRLM ROLM data switch tty. + val 7 TTYSMT variable. + 4.9-4.7 %TQMCH Machine type + 0 = nothing special 1 = PDP11 2 = PDS4 + 3 = PDS1 + 4.6-4.2 %TQHGT Character height in dots + 4.1-3.7 %TQWID Character width in dots + 3.6 %TQVIR Terminal implements virtual coordinates + 3.5 %TQBNK Terminal implements blinking + 3.4 %TQXOR Terminal implements XOR mode + 3.3 %TQREC Terminal implements rectangle commands + 3.2 %TQSET Terminal implements multiple object sets + 3.1 %TQGRF Terminal understands graphics protocol + 2.9 %TRGIN Terminal has graphic imput + 2.8 %TRGHC Terminal has graphic hardcopy + 2.7 %TRLED Terminal has local editing protocol + 2.6 %TRSCN Terminal implements raster commands + 2.5-2.3 %TRLSV <>0 means terminal supports 4**N saved lines + 2.2-1.7 %TRTIM signed offset from GMT minus 20 or zero if + terminal's timezone is unknowable. + + See also the CNSSET, TTYGET, and TTYSET symbolic system calls. + +CNSSET: set various console parameters (ITS TTY) + + arg 1 or + arg 2 Vertical screen size (negative => no change). + arg 3 Horizontal screen size (negative => no change). + arg 4 TCTYP variable (negative => no change). + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 H19 + 16 %TNAAA Ann Arbor Ambassador + arg 5 TTYCOM variable. + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 3.9 %TCINP Someone waited for input since last home-up. + The remaining bits, documented under CNSGET, may not be changed. + arg 6 TTYOPT variable. + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling. + 1.2 %TPIBC Oddball 2741-like tty. + 1.1 %TPIBM It really is a 2741. + + Omitting an argument also means no change (only works + if all arguments after it are also omitted, of course.) + Not all bits of the variables are settable; those explicitly + not user-settable have been omitted above. If contradictory + bits are supplied, the system will reconcile the conflicts. + See also the CNSGET, TTYGET, and TTYSET symbolic system calls. + +CORBLK: modify blocks of core in page map (ITS CORBLK) + + cbits 2.9 %CBWRT Try to get write access; okay if can't. + 2.8 %CBRED Try to get read access; okay if can't. + 2.7 %CBNDW Try to get write access; fail if can't. + 2.6 %CBPUB Make page public. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + Any job is allowed to get write access to + a public page. + 2.5 %CBPRV Make page private. This operation fails if + an attempt to get write access would fail; + however, it does not actually get write + access unless bit 2.7 is set also. + A job can have write access to a private page + only if it is getting the page from itself or + a job it is allowed to write in, and that job + has write access itself. Pages are usually private. + 2.4 %CBNDR Fail if can't get read access + (attempting to share with a non-existent page). + 2.3 %CBCPY Make a copy (disk files only). + 2.2 %CBLOK Lock page in core (don't allow swap out.) + 2.1 %CBULK Unlock page from core. + 1.9 %CBSLO Force page to reside in slowest memory. + This is useful when trying to get + reproduceable run time measurements. + 1.8 %CBUSL Undo the effect of %CBSLO + Bits 2.2-1.8 are not yet implemented. + All zero means delete page from page map. + arg 1 RH and LH are XOR'd with control bits. + arg 2 to put page into (or delete it from). + arg 3 Page number within job specified by arg 2. + If LH negative, block mode operation: + After doing operation, increment arg 5 if any, + AOBJN arg 3, write args back into user core, + and repeat the operation, until LH of arg 3 + becomes positive. + arg 4 Any one of the following: + to get page from. + Disk channel number. + When disk file pages are inserted, + the access pointer is left pointing + after the last word of the last page + inserted. + If the pages so inserted are inserted + with write access for modification, + the DSKUPD symbolic system call may + be used to set the creation and + reference dates for the file. + PDP-6 channel number. + One of the following special negative codes. + Only the right-half matters. + -2 %JSTVB means video buffer pages. + Pages 0-7 are video buffer. + First word of page 10 contains + console register and ALU. + See the .TVCREG user variable, + and the VIDBUF and VIDSW symbolic + system calls. + -5 %JSNEW get a fresh page. A new page, not + shared with any other, will be created. + The system tries to zero it out, but + currently may fail to if there is already + a page at the destination address. If + wasn't very difficult to fix, I'd fix it + instead of documenting it. + -6 %JSABS an absolute page. Arg 5 specifies the + desired page of physical memory. You are + not permitted write access to such a page. + 400000 specifies the system job (job # 0). Sharing + a page with the system job is almost like + getting an absolute page via %JSABS, since + the system job's address space mostly + corresponds to physical memory. + 400001 specifies the core job. For historical + reasons, this is taken to mean get a fresh + page instead. This special case will go + away some day, so use %JSNEW instead. + If arg 4 is omitted, it is the same as arg 2. + arg 5 Page number within source specified by arg 4. + Arg 5 is ignored for fresh page. + If omitted, same as arg 3 if source is a job. + If source is a disk file, the current access + pointer rounded down to a page boundary + is the default. + +Errors: + + 10 DEVICE NOT AVAILABLE + PDP-11 TV not available for mapping. + 14 BAD CHANNEL NUMBER + Argument 2 or 4 is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 2. + 32 CAN'T GET THAT ACCESS TO PAGE + Can't satisfy access requested by cbits 2.7-2.4. + This usually means that the page does not exist in the + source specified in argument 4, or that it exists but + write access is not permissible. It may also mean that + an absolute page which normally exists is currently down. + 33 MEANINGLESS ARGS + Page number outside range 0-377 for another job's page, + or outside 0-10 for a video buffer page, + or outside 0-17 for a PDP-6 page. + The allowed range for absolute pages depends on the machine. + 34 WRONG TYPE DEVICE + Can't map pages from any device other than those listed above. + 35 NO SUCH JOB + Argument 2 or 4 specified a non-existent job. + 37 NO CORE AVAILABLE + Tried to get fresh page, but no more (virtual) core is available. + The total number of distinct pages in the system is limited + by the size of the MMP table. + +CORTYP: determine type info from page map (ITS CORBLK) + +If one argument: + arg 1 Page number within current job. +If two arguments: + arg 1 + arg 2 Page number within specified job. + val 1 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page is readable (exists). + 4.6 %CBPUB Page is public (writable by anyone) + 4.2 %CBLOK page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + For non-existent page, whole word is zero. + Thus, this value is: + zero => no page. + positive => read-only page, + negative => writable page. + val 2 0 Absolute page. + -1 Unshared page. + other User index of next job in circular + list of jobs sharing the page. + val 3 For val 2 = 0, absolute page number. + For val 2 = -1, zero. + Otherwise, page number within job specified + by val 2. + val 4 4.9 Page is in core. + 2.9-1.1 Number of times page is shared (zero + for absolute or non-existent page, + else >=1 ). + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + Page number was outside range 0-377. + 34 WRONG TYPE DEVICE + Channel not open on USR, BOJ, JOB, or STY device. + 35 NO SUCH JOB + +DELETE: delete a file + + Either + arg 1 Byte pointer to ASCIZ filename string, + or aobjn pointer to block of such byte pointers. + + or + arg 1 Left-justified device name, in SIXBIT. + arg 2 File name 1 in SIXBIT. + arg 3 File name 2 in SIXBIT. + arg 4 Sname in SIXBIT. + + The file specified either by the four SIXBIT names or by the + ASCIZ string(s) is deleted. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + +DELEWO: Delete file While Open. + + arg 1 Channel number. + + The file open on the channel is marked for deletion. + It is actually deleted as soon as all channels referencing + it (including the one used by the DELEWO) are closed. + In the meantime, it is inaccessible (starred in the directory). + Either an input channel or an output channel can be used. + +Errors: + + 34 WRONG TYPE DEVICE + This call works only on DSK, and such job devices as simulate DSK. + +DEMSIG: demon signal + + arg 1 Sixbit name of demon to signal. + arg 2 Optional: + zero => signal once only. + positive => signal repeatedly every 2*n minutes. + negative => load demon but do not signal. + + A demon is a program which runs (and perhaps even exists) + only when a request has been signaled for it. If the + demon with the specified demon is not currently running, + the system job creates a demon job and loads it from the + file SYS:ATSIGN , where is the name of the + demon. + When the demon runs, it can acknowledge receipt of one + or more signals by using the .DEMON uuo (q.v.). + The status of a demon can be examined and altered by + using the RDDMST and STDMST symbolic system calls. + When the system is started up, there is a once-only + signal for the DEMSTR demon pending; this demon normally + signals requests for all other standard systemic demons. + + Demons were much used on the DM machine for various purposes. + Standard demons which are started by the DEMSTR demon include + (as of July 23, 1975): + NAME REPT RATE PURPOSE + TCTYP 0 Set terminal types?? (Doesn't exist on SYS) + UNSPOO 0 Line printer unspooler (TPL). + SURVEY 10. Network survey generator. + LDRDEM 0 Loader demon (obsolete). + BATCHM 0 Old batch monitor (obsolete). + COMSYS 0 Old message demon (obsolete). + NETRJS 0 CCN remote job server demon. + ZONE 0 MUDDLE compile batcher. + MG 0 Maze Guncher - kills games of MAZE + in an obscure way. AV doesn't like them. + COMDMN 0 Communications demon (replaces COMSYS). + BATCHN 0 Batch monitor (replaces BATCHM). + RFC402 0 Message archival demon. + +DETACH: detach a job tree from a console (ITS DETACH) + + arg 1 for any job in the tree to be detached. + If omitted, the tree referred to is that + of the executing job. + cbits 1.1 Leave the detached tree as a non-disowned, + non-console-controlled tree, instead of as + a disowned tree. + 1.2 Use system tree's resource word instead + of disowned resource word. This is to + be used only by legitimate system daemons. + 1.3 "P" the job by clearing bit 4.4 of .USTP + 1.4 if an hour goes by and the detached tree + does not run and is not reowned or attached, + it will be killed automatically by the system. + 1.5 suppress the console-free message that would + otherwise be printed on the tree's console. + The entire job tree which the specified job belongs + to is made to be disowned. If it was controlled by + a console, that console is made free. If the tree is + already disowned, nothing happens, but the DETACH call + skips anyway. If the top level job of the tree has a + jname of HACTRN, the jname is incremented to be HACTRO + and then re-incremented as necessary to make its uname- + jname pair unique. + + DDT provides a command :DETACH which detaches the tree + the DDT itself is in. LOCK provides a DETACH command + for detaching other trees conveniently: + DETACH detaches the tree containing the + job with user index . + DETACH detaches the tree containing + the job named . + + Automatic detachment by the system job: + Fatal interrupts in top-level jobs will cause them to be stopped + and then detached by the system job, which will type the message + TOP LEVEL INTERRUPT, TREE DETACHED + on the console detached from, followed by the normal + console-free message. A message is also printed on the system + console saying which job was detached from which terminal. + + If the PDP-11 controlling the TV consoles crashes, the system + job automatically detaches all job trees controlled by TV + consoles. This allows the user to log back in and re-attach + his job tree when the PDP-11 is restarted. + If the ARPA network crashes (that is, the local network + attachment crashes, or the host which is connected to + the console of a particular console-controlled tree + crashes) the server telnets automatically detach those + job trees whose consoles are no longer connected to anything. + On some ITS machines if a dial-up line is disconnected + the job tree controlled by that line will be automatically + detached. Other ITS machines do not have the hardware to + to detect disconnection. + When a tree is detached because its tty, whether TV, network + connection, or dialup line, has disconnected, then if the + tree is not logged in it will be killed immediately. + + Whenever a tree is detached automatically for any of the + reasons mentioned above, control bit 1.4 is used, so the + tree will go away if it is not touched for an hour. + + See the ATTACH and DISOWN symbolic system calls. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Cannot detach the SYS or CORE jobs, or the PDP-6. + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + +DL10MP: Hack the DL10 (pdp11 interface) + + THIS SYSTEM CALL CAN CRASH THE SYSTEM IF MISUSED. IT SHOULD + NOT BE USED LIGHTLY. + + arg 1 Page number + val 1 AOBJN pointer to DL10 control area + val 2 Pointer to 3 words for pdp11 examine/deposit commands + val 3 Pointer to first free word in DL10 control area + + A read/write, unencached, absolute page is created at the + specified page number in the user's address space. The page + contains the DL10 control area, which can be used to examine, + deposit, or bootload the pdp11. A message is printed on the + system console when this call is used. + +Errors: + +13 FILE ALREADY EXISTS + The page slot specified is already in use. + +33 MEANINGLESS ARGS + The page number is invalid. + +DIRSIZ: read the total size of files in a directory. + + arg 1 The number of a channel open on the DSK device, + or a . The channel should be open to a file + in the directory to be hacked. + + arg 2 (optional) quota + + arg 3 (optional) dsk number,,allocation + + val 1 quota,,total number of disk blocks used by files + this directory + + val 2 dsk number,,allocation (normally 0). + +DISMIS: dismiss an interrupt (ITS INTRUP) + + arg 1 Points to the third of three words which + are the new .DF1, .DF2, and .UPC + variables for use in dismissing the interrupt + (but see the cbits for this call). + If not an immediate argument, it is assumed to + be a pdl pointer which is appropriately + popped three times to get these items. + It is then popped twice more to flush the + two interrupt words pushed by a new-style + vectored interrupt. + If the job has enabled the pdl overflow + interrupt (bit 2.8 of the .MASK user variable) + then it will receive such an interrupt if the + popping by DISMIS causes pdl underflow. + arg 2 If present, overrides the new pc on the + stack specified by arg 1. + arg 3 If present, overrides the new .DF1 on + the stack specified by arg 1. + arg 4 If present, overrides the new .DF2 on + the stack specified by arg 1. Thus if four + arguments are supplied, the first is + effectively ignored, except for popping. + arg 5 If present, is the ,, + for a LOSE that is done, uninterruptably, + after the interrupt has been dismissed. + + cbits The control-bits for this argument specify + extra words to be popped off the pdl pointer + which is the first arg, BEFORE the PC and defer + words are popped. The cbits are ignored if the + first arg is immediate. The intention is that + the cbits will tell DISMIS how to pop exactly + what was pushed when the interrupt happened. The + format of the cbits is the same as that of the LH of + the first word of the interrupt table (for new-style + vectored interrupts) (see ITS INTRUP), which is what + specifies what is to be pushed when an interrupt happens. + It is: + 2.9=1 => throw away three words first thing. Throws away + the debugging info that interrupts can push. + 1.1-1.5 nonzero => it is number of ACs to be popped, + and 1.7-2.1 is the number of the lowest AC to be popped. + The ACs to be popped are BLT'ed out of the stack. + + If four arguments are supplied and the first is + immediate, then the first is totally ignored (except + that the address calculation is performed). + Thus this call is good for dismissing old-style + interrupts as well as new-style (stack oriented) + interrupts. + + Note that if the job is using the feature that interrupts + automatically push some accumulators or some debugging info, + it must explicitly request (with the control bits) that the + same words be popped. DISMIS does NOT vary its function + according to the job's interrupt table, for a given set of args. + + If the interrupt handler wishes to pretend that a class 2 + interrupt had not been enabled, it can dismiss the interrupt + and supply a fifth argument which is like the first argument + to a symbolic LOSE system call. Making the rh of that + argument 1+.LZ will cause DDT to print the + error message appropriate to an unhandled interrupt on that + bit. The lh. of that argument should be the address of + the instruction that caused the interrupt. + + See also the .DISMISS uuo. + +DISOWN: disown an inferior job + + cbits 1.4 Set BUMRTL, saying that if for one hour the + job does not run and is not attached or reowned + it should be gunned down by the system. + 1.3 Perform .USET ,[.SUSTP,,[0]]. + In this way the job is not started until + after being disowned. + 1.2 Use the system resource word instead of + the disowned job resource word for scheduling. + 1.1 Make this job not disowned, but rather the + top-level job of a non-disowned, non-console + controlled job tree. This prevents the job + from receiving 1/4'th priority as ordinary + disowned jobs do. + arg 1 A directly inferior . + + Please do not misuse the 1.1 and 1.2 control bits. These are + intended for generally useful "system daemons" only. + + The specified job is caused to be no longer an inferior of + the executing job, and is made to be the top level + job of a disowned job tree. Because of this, the disowned + job will continue to exist even if its erstwhile superior + does not (if, for example, the user logs out). + + Disowning is illegal if the executing job has given control + of its console to the job to be disowned (see .ATTY). + + All channels on which the executing job has open the job being + disowned will be closed in the process of disowning (see the + .CLOSE uuo). If the disowned job has opened the + console, then the channels are not closed, but + are marked as "disowned tty"; certain operations + on such a channel will succeed, and others will hang + until the job is re-owned and a console tty given + to the job. Such channels appear to be open on + tty number %TINON=77 octal. + A disowned job is distinguished by the fact that + bit 4.9 of its .APRC user variable is set. + A disowned job never succeeds in executing the RELOAD symbolic + system call, even if it is the top level job in its tree. + When a job tree is logged out, any micro-tapes assigned + to the uname of that job tree are de-assigned (see the + .ASSIGN and .DESIGN uuo's), but only if the job tree is + not disowned. + All disowned jobs share a resource word for purposes of + scheduling, in the same way that all jobs in a single + non-disowned tree share a resource word. Thus all disowned + jobs tend collectively to use no more runtime than any + single non-disowned job tree. + Furthermore, individual disowned jobs are given only 1/4 + the priority to run as a non-disowned job. This does + not apply, however, if the disowned job in question has + .MASTER mode, or controls the 340 display, the E&S display, + the vidisector, the arm, the LPT (line printer), or the + PLT (plotter). + When operating under heavy loads, the swapper prefers to + swap out disowned jobs rather than non-disowned jobs. + + The DETACH symbolic system call makes a non-disowned tree + disowned. See also the %OPDET bit of the .OPTION user + variable. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job must be a direct inferior. + +DSKUPD: disk update + + arg 1 Disk channel number or + + The creation and reference dates for the disk file + open on the channel are set to the current date and time. + The dump check bit is cleared (! will show in the + directory). + This is useful for programs which modify a file by + mapping pages of the file into their page maps with write + access, and which want to indicate this fact by setting + the creation and reference dates. See the CORBLK symbolic + system call for mapping pages of disk files. + + See also the FILBLK, RESRDT, RFDATE, and RQDATE + symbolic system calls. + +Errors: + + 34 WRONG TYPE DEVICE + The supplied channel number must be a disk or JOB device channel. + +ECHOIN: echo characters and store them in a buffer, until a break character + + arg 1 TTY channel number + arg 2 Byte pointer to buffer + arg 3 Number of characters left in buffer + arg 4 Address of break table + arg 5 Address of TECO buffer block (or zero) + + The second and third arguments are counted out as characters + are stored. When the call returns due to a break character, the + count will still be greater than zero. + + ECHOIN tells the system to echo characters and insert them in + the buffer specified by the second and third arguments without + requiring the user program to be executed. This is more + efficient and gets visibly faster response time. Echoing + stops when either the count is exhausted or a break character + is input. When this happens, the ECHOIN returns. If it returns + because of a break character, then the break character + is available for normal input. Non-break characters following + the break character are not handled. + + Break characters are specified by the break table, + a four-word block pointed to by the fourth argument. Each of + the four words says, for 32 characters, whether they break + or not. In the first word, the sign bit is for SAIL code 0, + and bit 1.5 is for SAIL code 37. The sign bit of the second + word is for Space, and bit 1.5 is for ?. And so on. + Characters with Control or Meta set (including ASCII control + characters on non-Meta keyboards) are always break characters. + + To prevent timing errors, ECHOIN will return immediately if + there are characters in the input buffer already. + + For use by TECO, ECHOIN can update the block of counters which + TECO uses to remember the extent of the buffer. The fifth + argument should point to this block, the "Buffer block", which + is seven words long. When a character is inserted, the first + two words of the buffer block are not changed, the next four + are incremented, and th next one is decremented. Passing the + buffer block to ECHOIN allows ECHOIN to insert characters + directly into TECO's buffer as an indivisible operation. + Note that the insertion of the characters themselves is still + controlled by the byte pointer and count arguments. + However, in the future this may change; when ECHOIN is made + able to handle operations besides insertion, it will use the + buffer block for updating the buffer (which may involve deletion) + but will still insert all characters it processes down the byte + pointer. This way, TECO will have both an updated buffer and + a list of the commands which the user typed. + +FILBLK: get contents of file parameter block + + arg 1 Disk channel number or + val 1 First file name. + val 2 Second file name. + val 3 Random information: + 4.9 Dump check bit. + 4.7-3.7 Word count of last block. + 3.6 Has been deleted from an + unmounted pack. + 3.5 Delete the file when closed. + 3.4 GC mark bit. + 3.3 Open for writing. + 3.2 The grim file reaper should not reap this file. + 3.1 This is a link, not a file. + 2.9-2.5 Pack number. + 2.4-1.1 Pointer to internal UFD descriptor. + val 4 File creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + val 5 File reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.1-2.9 Author, as M.F.D. index. + 1.1-1.9 File byte size and bit count in compressed form. + + See also the DSKUPD, RESRDT, RFDATE, RQDATE, SFDATE, + and SRDATE symbolic system calls. + +FILLEN: get file length + + arg 1 Disk channel number or + val 1 File length in bytes of the size + the channel is open in. + val 2 The size of those bytes. + val 3 File length in bytes of the size used to + write it (actually, the size in use the + last time it was opened for writing). + val 4 The size of those bytes. + + The length of the file open on the specified channel + is returned. + + +Errors: + + 34 WRONG TYPE DEVICE + Currently FILLEN works only for disk files and job devices. + +FINISH: wait for output to reach the device + + arg 1: channel # + + Does a FORCE (see below) then waits until all buffered + output has reached the device. + + The following devices currently support FINISH. + + TTY: STY: DSK: NET: CHA: TCP: + + TCP: Does a FORCE (ensures that data is PUSH'd out) and + waits until all data thus far has been ACK'd, i.e. acknowledged + by the foreign host. + + Chaosnet: (channels opened with CHAOSO) + On an output channel, does FORCE and then waits until + there are no queued output buffers. I.e., waits for + all output to be received and acknowledged by the foreign + host. This in fact waits for acknowledge, not just receipt. + +Errors: +* Any errors which the FORCE call might encounter. + +FLAP: flap a micro-tape + + arg 1 Micro-tape number (typically 1-4). + + The directory for the micro-tape is written back onto + the tape if it is currently in core; the tape is then + physically dismounted by running the tape back onto + the original reel (thereby making the tape go flap, flap, + flap ...). Micro-tapes should not be manually dismounted, + for this will cause the directories to get out of phase, + messing up the dismounted tape and also the next one to + use the drive. The FLAP will fail if any files are still + open on the specified drive, or if any one else has the + drive assigned to him. + See also the .UDISMT uuo. + +FLUSH: wait for output to reach the device + + arg 1: channel # + + This call has been renamed to FINISH (in ITS 1052). + The old name will be kept around for a while, but new + programs should not use it. + +FORCE: empty out device's output buffers + + arg 1 - channel # + + If any output is buffered for the device, it is now sent + to the device. Note that this is not needed for the TTY + device since output is always sent as soon as possible. + + It is not necessary to do a FORCE before doing CLOSE. + + The following devices currently support FORCE: + + NET: Causes output to be sent as soon as possible; + otherwise it would only be sent when the buffer + was full or when 2 seconds have elapsed since + output was first put in the buffer. + + TCP: Same as NET, except that the PUSH flag is set + in outgoing segments. If there is no buffered data, + nothing is sent. (Note that ITS TCP always sets PUSH + in all outgoing segments whether FORCEd or not. + Otherwise, a FORCE with an empty buffer would require ITS + to re-send old data with PUSH set in order to nudge the + remote site into action.) + + DSK: Causes the current output buffer and the directory + to be written to disk. + + Chaosnet: (channels opened with CHAOSO) + If there is a partially-filled output packet (created by IOT + or SIOT), it is transmitted. + + The following devices ignore FORCE (it always skip returns) + because they don't need it: + + TTY: STY: LPT: PLT: PTP: COD: + +Errors: + 2 WRONG DIRECTION + TCP: Channel is not an output channel. + 7 DEVICE NOT READY + TCP: Connection not open for writing. +34 WRONG TYPE DEVICE + The device is not an output device, or does not have + the kind of buffered up output which needs this call. + +IOPOP: pop input/output channel + + arg 1 Channel number + + The top entry on the job's IO pdl is popped into the + specified channel. Entries on the IO pdl are made + only by pushing channels with IOPUSH. If a channel + is pushed with IOPUSH and then popped into with IOPOP, + it is in exactly the same state as it would have been + if left untouched; however, the channel is available + for other use in the meantime. + +IOPUSH: push input/output channel + + arg 1 Channel number + + The contents of the specified channel are pushed onto + the job's IO pdl, and the channel is put into a + "closed" state. If the channel had been open, the + open file is not closed, but is instead now open on + the IO pdl slot instead of on the channel. It is + not accessible to the job for IOT'ing, etc., while + there, but it can be popped back into a channel with + IOPOP and then will be available for IO. + + +IOT: input/output transfer + + cbits Per-IOT mode bits. Device dependent. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Location for input/output transfer. + May not be immediate. + For unit mode, this is the word to + output from or read into. + For block mode this is an AOBJN + pointer to a buffer. + arg 3 (Optional) device-independent special mode bits. + These are not currently used. + + For ease of use, in unit input mode arg 2 and arg 3 + may be omitted and val 1 will then be the word read. + +For TTY and Tnn devices (terminals in general), + the following control bits are effective for IOT. + They are XOR'd into the left half of the I/O channel + word both before and after the IOT (see the .IOC user + variable). Thus one can modify the tty's + characteristics temporarily for just one IOT. + (ITS TTY) + Control bits on input: + 2.6 %TIECH Read even if char needs pi echoing + 2.5 %TIPEK Don't remove char from buffer (peek) + 2.3 %TIACT Don't wait for activation char + 2.2 %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + 2.1 %TINWT If no input available, don't wait, but return -1. + 1.9 %TIFUL Use full character set (for Imlacs and TV's). + + Control bits on output: + 2.6 %TJECH Echo mode output. + 2.5 %TJCTN Don't do line continuation. + 2.3 %TJDIS Recognize ^P cursor codes. + 2.2 %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 %TJMOR Do not do **MORE** processing. + 1.9 %TJPP2 Output in the echo area if it exists. + 1.7 %TJHDE Account for cursor motion due to characters + echoed on a half-duplex tty. +For the Chaosnet (channel opened with CHAOSO): + 1.4 ?? Don't hang. + + This can be used to do unit-mode 8-bit-byte transfers. + Control bit 1.4 means don't-hang, and applies to both input + and output. Only data packets with opcode 200 will be + transferred. Anything else on input causes the transfer + to stop, like an end-of-file. Use PKTIOT to find out what + the story is. (The correct way is to verify that there are + some packets in the input buffer, then do a (S)IOT, and if it + transfers 0 bytes then the first packet in the input buffer + must not be a data packet, so PKTIOT it in.) + + There can be input available to (S)IOT even when the state is + not %CSOPN (e.g. if the input buffer contains data and + a CLS packet.) In this case, you should first (S)IOT (if you + care to pick up the data) then PKTIOT. + + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second argument was immediate. + +IPKIOT: Internet packet (datagram) I/O + + This call is similar to PKTIOT and works for channels + opened on the IPQ device. It should NOT BE USED without + a good understanding of Internet Protocol datagram formats. + This call is still subject to change and thus is not + documented further. Ask KLH if you think you need to use it. + +ITYIC: read tty interrupt character + + arg 1 + val 1 a character + + This call fails to skip if there is no input + interrupt character to be read from the tty. + Otherwise, it returns the next un-ITYIC'ed + input interrupt character. + ITYIC'ing a character does not remove it from + the input buffer - it is still there to be IOT'ed + in its turn, along with the non-interrupt characters. + ITYIC makes it possible for a program to scan input + interrupt characters as they interrupt, without + interfering with the IOT'ing that will take place + later. + +JOBCAL: get info on how job device was called + + arg 1 BOJ channel number or + arg 2 Optional: AOBJN pointer for job call data. + arg 3 Optional: sixbit device name for PEEK and who-lines. + val 1 "opcode" for requested operation. + + See ITS JOB for information on job devices. + + This call is to be executed by a JOB device when it + receives an interrupt on its BOJ channel. It returns + data describing the operation desired by the calling job. + Note that the second argument is an AOBJN pointer + to an area in which the call will place data, not get it! + + The third argument, if present, is a device name to be used + by PEEK and who-lines for printing things like ARCBO. + (This name is initialized to the device name returned as word + 4 by OPEN - see below. The unknown-device handler, if involved + in the process (see the OPEN symbolic system call), resets + this to the second file name of the JOBDEV file it actually + succeeded in loading (this name may have had digits stripped off).) + + The "opcode" describes the operation to be performed: + 4.9-4.7 Open mode, if 2.9-1.1 contains 0. + 4.6 Close + 4.5 Close (both bits always the same) + 4.1 SIOT rather than IOT + 3.8 pclsred call restarting + 2.9-1.1 0 .OPEN + 1 .IOT + 2 MLINK (make a link) + 3 .RESET + 4 .RCHST + 5 .ACCESS + 6 .FDELE (delete or rename) + 7 .FDELE (rename while open) + 8 .CALL + + The second argument should point to a block of 12 + words (0-11) in which the following data are deposited: + + OPEN + wd 1 First file name. + wd 2 Second file name. + wd 3 Directory name. + wd 4 Device name. + wd 5 Full 18.-bit open mode in right half. + wd 7 BP or AOBJN ptr specifying filename, if + the SOPEN call was used to do the open. + Zero otherwise. + + IOT + wd 0 For block IOTs, the loser's IOT + pointer. The left half contains the + negative of the desired number of words. + For SIOTs, the byte count. 1 for unit IOTs. + + ACCESS + wd 0 The address within the file to access. + The beginning of the file is 0. + + MLINK + wd 0 Linked-to FN1. + wd 1 FN1 of the link. + wd 2 FN2 of the link. + wd 3 Directory name of the link. + wd 4 Device name of the link. + wd 5 Linked-to FN2. + wd 6 Linked-to directory. + wd 7 BP or AOBJN ptr specifying name of link, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to link to, + or 0 if the name was specified as SIXBIT. + (note links from one device to another don't exist). + + FDELE (rename or delete) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 1 Old first file name. + wd 2 Old second file name. + wd 3 Name of directory. + wd 4 Name of device. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 7 BP or AOBJN ptr specifying file to act on, + or 0 if the name was specified as SIXBIT. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + FDELE (rename while open) + wd 0 Zero implies delete. Otherwise, the + new first file name. + wd 5 Zero implies delete. Otherwise, the + new second file name. + wd 10 BP or AOBJN ptr specifying name to rename to, + or 0 if the name was specified as SIXBIT. + + CALL + wd 0 Name of operation in sixbit. + wd 1 Control bits for the call. + wd 2 Number of following words. + wds 3-n Input arguments to call. The first + will almost always be a channel number. + Values may be returned via the + JOBRET symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number or + a JOB device channel number. + +JOBGET: get job device information + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBCAL + symbolic system call. + + arg 1 BOJ channel number or + + The individual returned values are identical to + the words returned by JOBCAL in the area specified + by JOBCAL's second argument. + +JOBINT: cause caller of JOB device to get an interrupt + + arg 1 BOJ channel number or + + See ITS JOB for information on job devices. + + This is used by JOB devices to cause the calling job + to receive a word 2 interrupt for the channel it has + the JOB device open on. See also the SETIOC + symbolic system call. + +Errors: + + 34 WRONG TYPE DEVICE + The first argument must be a BOJ channel number + or a JOB device channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBIOC: set input/output channel error + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + open on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +JOBRET: return values to loser and let him continue + + arg 1 BOJ channel number or + arg 2 LH contains error code, or 0 if none. + RH contains amount for loser to skip. + arg 3 Optional AOBJN pointer to a block + of values to be returned to the loser. + + See ITS JOB for information on job devices. + + This call is used by JOB devices to cause the + calling job to continue after an input/output request. + The second argument specifies an error code in its LH; + if non-zero it is placed in bits 3.6-3.1 of the .IOS + word for the JOB device (see the STATUS symbolic + system call). The RH contains the amount by which + the loser should skip upon continuing if he used a .CALL; + this amount is usually 0 or 1. The third argument is + an AOBJN pointer to a block of values which are + passed back to the .CALL or to the .RCHST. + +Errors: + + 34 WRONG TYPE DEVICE + First argument must be a BOJ channel number + or a JOB device channel number. + 36 VALID CLEAR OR STORED SET + +JOBREU: Lets a JOB device handler offer itself for re-use + + arg 1 Device name that the handler can handle + arg 2 FN1 of file the handler was loaded from + arg 3 FN2 of file the handler was loaded from + arg 4 SNAME of file the handler was loaded from + (Note: the only device it could have been + loaded from is DSK). + arg 5 Amount of time to wait (for someone to try + to re-use us) before giving up and taking the + failure return, in 30'ths of a second. + Alternatively, minus the time to wait until + (in 30'ths since the system was started up). + If the argument is positive (a duration) it + is converted to a negative one (time to stop) + and written back. + + Some job device handlers take a considerable amount of + work to initialize themselves - for example, the ML device + must set up network connections to another machine. + Improved performance results if the same handler job + can be used for several OPENs, instead of having to + load a new job and open a new set of network connections + for each one. The JOBREU call makes this possible. + The time to use it is when the handler has completed all + of the business for one operation - it has received a + "CLOSE" from its creator, has tidied up its data bases, + and would otherwise have nothing to do except log out. + Instead, it can do a JOBREU. During the time period + specified in the JOBREU, if any job tries to do an OPEN + on a job device which this handler could be used for, + this handler job will in fact be used. In this case, + the JOBREU will skip return. The handler should then + act as if it had just been loaded, and do the "initial + JOBGET". If nobody tries to reuse the handler in the + specified time period, the JOBREU will return without + skipping, and the handler should log out. + + Note that one should not do a JOBREU immediately upon + receiving a close when the JOBRET of the initial OPEN + has failed, because the creator has pclsred and is + likely to be coming back. In order to make it use the + same job device when it comes back, JOBREU should not + be done; instead, a PCLSRed JOB device open automatically + finds the right job and sends another request to it. + You should time out and if this second request does not + come in, then give up and do a CLOSE and a JOBREU. + + There are two kinds of OPENs that can invoke the JOB device: + 1) An open of JOB: explicitly. It can reuse a + job device handler if match the FN1, FN2, + and SNAME specified in the JOBREU. + 2) An open of a device name (such as ARC) that is not + built into the system. Such an open can reuse a job + device handler if the device name matches the one + specified in the JOBREU. + + +Errors: + + 10 DEVICE NOT AVAILABLE + This job isn't a JOB-device handler. + 13 FILE ALREADY EXISTS + This job device handler is already (still) in use + by a creator. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + Nobody tried to reuse this job, and the time period ran out. + +JOBSTS: set JOB device status + + arg 1 BOJ channel number or + arg 2 New JOB device status - stored in the RH of + the job channel's .IOS word, where .STATUS + on the job channel will find it. + This may be arbitrary, of course, but the + standard bits are as follows: + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + For a job device this should be 22, + unless you really know what you are + doing. + If omitted, 000022 is used. + arg 3 Sets the "device name" of this channel. + The device name is used by the RFNAME + and RCHST system calls, and by PEEK + and who-lines, to say what device a job + is transferring to or waiting for in the + job's status. The argument is optional. + arg 4 Sets the "file name 1". Optional. + arg 5 Sets the "file name 2". Optional. + arg 6 Sets the "system name". Optional. + arg 7 Sets the "open mode" that will be returned + by the RFNAME system call. Optional. + arg 8 Optional byte pointer to ASCIZ string in device handler's + address space containing full filenames. The byte pointer + my not be indexed or indirect. Note that ITS might decide + to read a string from this byte pointer at any time, so the + string must continue to exist even after the JOBSTS call + has returned. + + When the channel is first opened the device, file + name 1, file name 2, system name, and open mode + are set to the ones by which the channel was opened. + JOB device programs may change these if they wish, + but are not required to. + + See the STATUS symbolic system call, the .STATUS uuo, + and the RFNAME system call. + + See ITS JOB for information on job devices. + +KLPERF: Use KL10 performance analysis counter + + arg 1 whose performance is to be measured + -3 (%JSNUL) => the null job + -4 (%JSALL) => all jobs + 0,,-3 and 0,,-4 are also acceptable. + arg 2 Performance Analysis Enables word + 0 => turn off the performance counter + and make it available for other users. + See DEC drawing M8538-0-MTR4 for the bits in this + argument. + val 1 Previous setting; -3, -4, or a job number + val 2 Previous Performance Analysis Enables word + val 3 High-order word of the time base + val 4 Low-order word of the time base + val 5 High-order word of the performance counter + val 6 Low-order word of the performance counter + + If no arguments are supplied, the state of the counter + is not changed and the six values are returned. + + If arguments are supplied, the performance analysis counter + is siezed so no other users can interfere and performance + measurement begins. When the specified job is running + and the conditions specified in the Enables word are met, + the performance counter counts. A bit in the Enables + word controls whether it counts the duration, in microseconds, + that the conditions were satisfied, or the number of times + that the conditions became satisfied. While the specified + job is running, the time base counts microseconds. If -4 + (all jobs) was specified, this is the elapsed real time. + Issuing the KLPERF call again allows the results to be + determined by subtracting the values obtained the first time + from the values obtained the second time. + + The two counters are double-precision numbers. The high-order + 35 bits are in bits 1.1-4.8 of the high-order word, and + the low-order 23 bits are in bits 2.4-4.8 of the low-order + word. + +Errors: + + 10 DEVICE NOT AVAILABLE + Someone else is using the performance analysis counter. + 14 BAD CHANNEL NUMBER + Argument 1 is invalid. + 35 NO SUCH JOB + Argument 1 specified a non-existent job. + +LISTEN: listen for any typed-ahead input (ITS TTY) + + arg 1 (but not a STY channel) or + val 1 Number of typed-ahead characters pending. + + Waits for output buffer to empty before listening. + To check for input without waiting for output use + .STATUS. The uuo .LISTEN is the same as LISTEN, + but applies only to the job's console, and furthermore + returns zero if the job doesn't possess the tty. + +Errors: + + 14 BAD CHANNEL NUMBER + +LNKEDP: find out whether open file was reached via a link + + arg 1 Channel number of open disk file + val 1 Nonzero if file was reached via a link. + + The file open was reached through a link if the names + actually specified in the OPEN were the names of a link + which pointed at this file. It is not a question of + what file is open, but of what names were specified to + open the file. + +Errors: + +14 BAD CHANNEL NUMBER + Arg 1 is not between 0 and 17. +34 WRONG TYPE DEVICE + Arg 1 does not specify a disk channel. + +LOAD: load file (a program) into a job + + arg 1 + arg 2 Disk channel number (freshly opened for reading). + arg 3 Optional argument which causes part of the file + to be ignored: either ,,, to load + only between addresses and (inclusive), + or zero meaning load only pure pages. + The default is 0,,-1 normally, 20,,-1 when loading + oneself, and 20,,37777 when loading the PDP6. + When loading a PDUMP format file, and + are rounded outward to page boundaries. + + The file open on the input channel is loaded into + the specified job. The file may be in one of two formats: + PDUMP format, or SBLK format. The former is produced by + the PDUMP symbolic system call, under which its format + is documented. The latter is described below. + The two formats are distinguished by the + fact that a PDUMP format file begins with a zero word, + but an SBLK format file begins with a non-zero word. + + SBLK format: + First off, any words in the file are ignored until a word + 254000,,1 (JRST 1) is found. This should be followed + by zero or more blocks of the following form: + wd 0 -,, + wds 1-n data words + wd n+1 checksum + That is, the first word is an AOBJN pointer describing where + to load consecutive words of data into the job; this is + effectively used as a block .IOT pointer to load the words. + Following the data is a checksum, which is ignored. + (Historically, when microtapes were used, the checksum was + necessary for error checking.) + Following the last block must be a non-negative word + to denote the fact that there are no more blocks. + This word and all succeeding words in the file are ignored. + (DDT assumes that this word contains the starting + address of the program, and that following words contain + the symbol table for the program.) The disk channel + is left open, with the access pointer pointing to the + positive word which followed the last block. + + The standard form of symbol table is: + -<2*n>,,0 + squoze code,symbol -- these 2 words are + value of symbol -- repeated n times + + The word after the symbol table is another copy of the starting address. + +Errors: + +7 DEVICE NOT READY + A disk read error occurred. +31 CAN'T MODIFY JOB + The calling job may not write into the job being loaded. +32 CAN'T GET THAT ACCESS TO PAGE + You tried to create an absolute page pointing to memory + that the system doesn't have. +34 WRONG TYPE DEVICE + Arg 2 does not specify a disk read channel, or + you tried to load a PDUMP file into the PDP-6. +37 NO CORE AVAILABLE + The MMP was full so a needed page could not be created. +46 UNRECOGNIZABLE FILE + The file open on the specified channel is not in + valid SBLK format, nor in valid PDUMP format. + +LOGIN: log in a job tree + + arg 1 Sixbit name to log in under. + " " (0) and "___xxx" (-1 in left half) are illegal. + arg 2 Sixbit name of "terminal." This is not required + for hard-wired terminals. When this field specifies + a network host, the standard form is HSTnnn, where + nnn is the octal host number, however often the English + name of the host, abbreviated to six letters, is used. + arg 3 Sixbit XUNAME. This is normally the same as arg 1 + except that if arg 1 is changed to make it unique, + this should not be changed. The XUNAME is what is + used for accounting purposes. + + The uname for the job tree is changed from "___nnn" + (where "nnn" is the top-level job's user index in + sixbit octal characters), which is the initial uname of + a non-logged-in job tree, to the specified sixbit name. + If the job tree already has a uname other than "___nnn", + the LOGIN fails. Only top-level jobs with no direct + inferiors may LOGIN. + +Errors: + + 11 ILLEGAL FILE NAME + Cannot log in as "___xxx" or " ". + 12 MODE NOT AVAILABLE + Jobs with direct inferiors may not log in. + 13 FILE ALREADY EXISTS + Someone is already logged in under the specified name. + 31 CAN'T MODIFY JOB + Already logged in. + 40 NOT TOP LEVEL + Only top-level jobs may log in. + +LOGOUT: log out a job tree + + No arguments or values (note, however, that at least + one must be present in order to contain the 4.9 bit + terminating the argument list). If the executing + job is the top level job in its job tree, then the + entire job tree is expunged from the system. + Does not skip if not a top level job. This is not + considered an error, however; no error code is returned. + See also the .LOGOUT uuo. + +LOSE: report lossage + + arg 1 left half - address of losing instruction + right half - lossage code (defined by DDT.) + arg 2 new PC. If omitted, the address of the .CALL + minus one is used. + control bits: + 1.1 default arg 2 to the address of the .CALL plus one. + 1.2 do SETZM @.40ADDR, i.e. clear the location + in the job where a UUO returned from the + system would be stored. + 1.3 Really take the left half of arg 1 as the address + of the losing instruction. If this control bit + is not specified, the new PC is used instead. + + The job's Program Counter is set to the new PC, + the job's .VAL user variable is set to the address + of the losing instruction,,the lossage code, and the + job is given a %PILOS interrupt. If the job does not + enable this interrupt, and its superior is DDT, a + helpful error message will be printed. + + The LOSE symbolic system call is a more general version + of the .LOSE UUO. .LOSE is simpler, and usually good + enough. Symbolic LOSE is for situations where sophisticated + error reporting is needed. Symbolic LOSE allows the new PC + value to be specified explicitly, and therefore is suitable + for use inside an error-handling subroutine. In addition, + the address of the "culpable" instruction can be specified + independantly from the address to restart at. Thus, the + program can provide more complicated error recovery + than simply restarting at the losing instruction. + + The lossage codes are defined by DDT's interpretation of them. + The defined values are: + + %LSSYS==1000 The last error code returned by a failing + system call describes the problem. + + %LSFIL==1400 The last error code returned by a failing + system call, together with the name of the file + it was operating on, describe the problem. + The "culpable instruction" address should point + at the failing system call. + DDT will decode it to determine the filenames + (if it is an OPEN) or the channel number and then + the filenames via an RFNAME. + + %LSSYS+errcode Means that the system call error code + describes the problem. + + %LSFIL+errcode Means that the error code + together with the filenames being used + describe the problem. + + 0 Signifies some other nondescript error condition. + + 1+.LZ + Means that the error should be handled as if it + were a fatal interrupt on the specified interrupt + bit. For example, 1+.LZ %PIMPV will make DDT tell the + user that the job received a fatal MPV interrupt. Why + might a program wish to do this? It might have + enabled its own handling of MPV, and then received an + MPV interrupt at a time when one was not expected and + was not recoverable. At such a time the ideal thing + to do is to report the MPV back to DDT, so that DDT + will handle it - to "pretend" that MPV wasn't enabled + at all. To make the pretense complete, the program's + own MPV interrupt handler should dismiss the + interrupt, and leave the PC pointing at the guilty + instruction, since that would be the state of things + if the program had not handled the interrupt. That + can be done with a special feature of the DISMIS + symbolic system call, which can do a .LOSE after + dismissing the interrupt and restoring the PC. + + This call never gets an error, and never returns. + +MLINK: make link + + Either + arg 1 Byte pointer to ASCIZ string specifying name for link, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying name to link to, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified "from" device. + arg 2 "from" file name 1. + arg 3 "from" file name 2. + arg 4 "from" sname. + arg 5 "to" file name 1. + arg 6 "to" file name 2. + arg 7 "to" sname. + + A link is created on the specified device. + The only standard device which accepts links + is DSK; of course, various job devices (such as + the AI, ML, DM, and MC devices) also implement it. + Links cause an indirection when opened + for reading; writing or deleting a link affects + the link itself. + The "from" file names are subject to file name + translation. See the TRANAD and TRANDL symbolic + system calls. + + See the SOPEN symbolic system call for a description of + how the byte or AOBJN pointer arguments should be formatted + and how the strings are parsed into filenames. + +NETAC: accept network connection OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 - channel # of an Arpanet NCP channel + + If the channel is in the RFC-received state, the + connection is accepted. Use CLOSE to refuse a + request for connection. + + See also the .NETAC UUO. + + This call only works for NCP and is obsolete. It isn't needed + for TCP since incoming requests that satisfy a LISTEN will + automatically be hooked up and the connection opened. + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not an Arpanet NCP channel +41 OTHER END OF PIPELINE GONE OR NOT OPEN + The socket is not in the %NSRFC (request for + connection received) state. + +NETBLK: network block (ITS NCP) + + arg 1 Channel number - should be a network channel. + NCP, TCP, and CHAOS are allowed. + arg 2 Connection state code. + NCP: Socket state as returned in the right + half of word 4 by the .RCHST uuo: + 0 %NSCLS CLS received. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + CHAOS: + TCP: basically the same as NCP. See WHYINT for state list. + arg 3 Optional: address of a word containing an argument + as for the .SLEEP uuo. This word must be writable, + as it will be replaced by an appropriate negative + number as for .SLEEP. + If not supplied, positive infinity (377777,,777777) + is assumed by default for the time to sleep. + val 1 New connection state. + val 2 Time left, in thirtieths of a second. + (Meaningful only if arg 3 supplied.) + + The executing job hangs until one of two conditions + becomes true: either the network conection associated + with the specified channel enters a state different + from the specified state, or the amount of time + specified by arg 3 has passed. + + Example: suppose that a NCP socket is in state 1 + (listening for RFC). This call will return when + the socket is no longer in that state, or after 5 + seconds, whichever comes first: + + MOVEI AC,5*30. ;five seconds + .CALL [ SETZ + SIXBIT \NETBLK\ ;network block + 1000,,CHNUM ;channel number + 1000,,%NSLSN ;old state + ,,AC ;time to sleep + 2000,,NSTATE ;new state + 402000,,TLEFT ] ;time left + +Errors: + +34 WRONG TYPE DEVICE + The specified channel is not a network (NCP, TCP, CHAOS) channel. + +NETHST: net host status (ITS NCP) + + arg 1 Host number (-1 for self). + arg 2 Reason for going down (optional, valid + only if arg 1 is -1). + 5 Going down for scheduled P.M. + 6 Going down for scheduled hardware work. + 7 Going down for scheduled software work. + 10 Going down for emergency restart. + 11 Going down because of power outage. + 12 Stopping at software breakpoint. + 13 Going down because of hardware failure. + 14 Going down because not scheduled to be up. + val 2 Host number (useful if arg 1 is -1). + Note THESE ARE OUT OF ORDER (because "val 1" is so long). + val 1 Host status + 4.9 1 => RFNM wait on link 0. + 4.8-4.3 Unused. + 4.2-4.1 Host status: + 0 Down. + 1 RST sent. + 2 Up. + 3.9-3.1 Time (as returned by .RDTIME) modulo 1000 + the last RFNM sent on link 0. + 2.9-1.1 Last message from IMP about "host dead status" + for this host. (See BBN Report #1822, Chapter 3.) + 2.7-1.5 Time host will come back up, Greenwich Mean Time: + 2.7-2.5 Day of week (0=Monday, ..., 6=Sunday). + 2.4-1.9 Hour of day (0-23.). + 1.8-1.5 Five-minute interval within hour (0-11.). + -1 means more than a week. + -2 means time coming back up is unknown. + 1.4-1.1 Reason host is down: + 1 Foreign host not communicating + with network (took ready-line down + without saying why). + 2 Foreign host not communicating with + network (host was tardy in accepting + network traffic without saying why). + 3 Foreign host does not exist, to the + knowledge of the Network Control Center. + 4 The IMP software is preventing + communication with foreign host + (this usually indicates IMP software + initialization at the foreign site). + 5 Foreign host down for scheduled P.M. + 6 Foreign host down for scheduled + hardware work. + 7 Foreign host down for scheduled + software work. + 10 Foreign host down for emergency restart. + 11 Foreign host down because of power outage. + 12 Foreign host stopped at software + breakpoint. + 13 Foreign host down because of hardware + failure. + 14 Foreign host not scheduled to be up. + 17 Foreign host in process of coming up. + + If one argument is supplied, then the host status word + for the specified host is returned. If two arguments are + supplied, then the "reason for going down" word for the + local host is set. (As of June 30, 1975, setting this + word doesn't seem to do anything at all. Didn't the code + for sending this data to the IMP ever get written??) + +NETIMP: network IMP status (ITS NCP) + + If no arguments are present, three values are returned: + val 1 Last message from IMP about going down. + 4.9 IMP really is down now. + 1.2-1.1 Reason: + 0 "Last warning" or "panic restart"; + the IMP is going down in 30. seconds or less. + 1 Scheduled hardware P.M. + 2 Scheduled software reload. + 3 Emergency restart. + val 2 Time going down, as returned by .RDTIME. + val 3 Time coming back up, as returned by .RDTIME. + + If arguments are present, three must be present. + They are used to set three default values which are returned + if the IMP itself has not set the above three values. + Presumably this is good for logically disabling network software? + +Errors: + +30 TOO FEW ARGUMENTS + Must have either 3 arguments or no arguments. + +NETINT: Send network interrupt OBSOLETE (ITS NCP) + + This system call is obsolete, and has been flushed. + It is documented here for historical purposes only. + + arg 1 channel # + + An INR or INS message is sent, depending on the send/receive + gender of the socket specified by the channel #. What this does + depends on the protocol being used and the program at the + other end of the connection. + + This call only works for NCP and is obsolete. +Errors: + +34 WRONG TYPE DEVICE + The channel specified is not an Arpanet NCP channel. + +NETRFC: Get pending Request For Connection for a specified network + + cbits + %NQREF Arg 2 is a previously returned identifier, + refuse connection and flush from queue. + arg 1 - SIXBIT name of network + one of CHAOS, TCP, or ARPNCP (obsolete) + arg 2 - optional network-dependent arg + for CHAOS: pointer to packet buffer + for TCP: If %NQREF set, is ,, of request to + reject (as returned from previous NETRFC call) + val 1 - network-dependent value + for TCP: ,, + for ARPNCP: ,, + + This call is intended for use by very specialized programs + which ITS invokes upon receiving unsolicited requests for + connections. ITS will queue the request for a short time + and start an appropriate job which uses NETRFC to obtain + the request and process it. Currently these programs are + NCP: SYS;ATSIGN NETRFC + TCP: SYS;ATSIGN TCP + CHAOS: SYS;ATSIGN CHAOS + + Normally the program will execute a NETRFC appropriate for its + network, and obtain a returned request value. Accepting the + request is device dependent, but refusal can always be done + by calling NETRFC again with the %NQREF control bit set and + furnishing the appropriate request identifier. + + See the CHAOSQ system call, which NETRFC is replacing. + +ERRORS + 4 - TCP: No pending RFCs, or %NQREF with non-existent ,,. + 12 - CHAOS: can't handle %NQREF yet. + 33 - Unknown network specified. + +OPEN: open a file + + cbits Device dependent. Standard bits are: + 2.7-2.9 0 = normal, 1 = write-over mode. + 1.3 0 = ascii, 1 = image. + 1.2 0 = unit, 1 = block. + 1.1 0 = read, 1 = write. + arg 1 Channel number. LH XOR'd with control bits. + arg 2 Left-justified device name. + arg 3 File name 1. + arg 4 File name 2. + arg 5 Sname. If not present, defaults to executing + job's current sname (see the .SNAM user variable). + + See also the .OPEN uuo. + + The file names used for opening are subject to translation. + See the TRANAD and TRANDL symbolic system calls. + + The file names .FILE. (DIR) are special: + they cause the directory for the given device + (and sname, if applicable) to be read. It is + illegal to write the directory. If a device has + no directory, then opening .FILE. (DIR) will + supply the string "NON-DIRECTORY DEVICE", presumably. + (This is a function of the unknown-device handler + (see below) and hence the exact results may vary). + Opening a directory in ascii mode yields an + ascii string for people to look at; opening it + in image mode yields a device-dependent file + (or possibly a MODE NOT AVAILABLE error). + + For the DSK device, the control bits are: + 1.4 %DONRF Don't set the reference date. + 1.5 %DONLK Don't chase links. (I. E., if + this is a link, open the link itself, + not the file at which the link points. + 1.6 %DORWT Readers wait. On output open, makes would-be + readers wait till we close. + 2.7 %DOWOV Write-over mode. Writes on the existing + file of that name, instead of replacing + it with a new file. + + The file names M.F.D. (FILE) when opened for + input yield a master file directory for all + disks. In ascii mode this is an ascii string + containing the names of all directories, separated + by a cr/lf sequence. + + The file names ..NEW. (UDIR) cause a new directory + to be created with the given sname if none already + exists. Creating a directory in this way causes a + message to be printed on the system console. + (A directory is destroyed only when the disks are + salvaged by the stand-alone salvager, which is generally + run just before the time-sharing system is restarted. + A directory is then destroyed iff it contains no files.) + + If < or > is used as a file name, it is treated + specially according to an algorithm no one + understands, but which attempts to let it stand + for the numerically smallest or largest file name + among those in the directory. In particular, + if you call your files FOO nnn, where nnn is a version + number, then reading FOO > will read in the latest + version, writing FOO > will write out a version + one higher than the latest one (or FOO 1 if there + is no file named FOO nnn), and deleting FOO < + will delete the oldest one. Writing FOO < doesn't + recreate an old file; it is the same as FOO >. + If a file with numbers and letters in its name, + for example FOO BAR27, already exists, + writing FOO > will generate FOO BAR28 + and not FOO 1. Letters to the right of numbers are + generally ignored as far as < and > are concerned. + + Note that < and > may be used as first + file names as well; this is mainly useful for the + .LPTR. directory. It is illegal to use < or > for + both file names at once. + + The SYS device ignores the sname, and otherwise + is like using the device-sname pair DSK:SYS; . + Writing new files or altering old ones on the SYS + device (or even on DSK:SYS;) causes a message to + appear on the system console documenting who the + culprit is and what he did. This is because system + programs and other files critical to system operation + are kept on SYS:. In fact this applies to writing + or altering files on any disk directory whose name + begins with the three letters "SYS". Standard + directories whose names begin with "SYS" include: + SYS1 Extension for SYS directory (holds programs). + SYS2 Extension for SYS directory (holds programs). + SYS3 Extension for SYS directory (holds programs). + SYSENG Source files for many system programs. + SYSEN1 Extension for SYSENG directory. + SYSEN2 Extension for SYSENG directory. + SYSBIN Binary files for many system programs. + SYSTEM Files having to do with ITS itself. + SYSDOC Documentation for ITS itself. + SYSNET Files having to do with Chaosnet and TCP. + + The COM device ignores the sname, and otherwise + is like using the device-sname pair DSK:COMMON; . + + The TPL device ignores the sname, and otherwise + is like using the device-sname pair DSK:.LPTR.; . + (On systems without lineprinters the TPL device is + generally just a JOB device.) + On output, it furthermore ignores the file names, + and instead uses the uname of the opening job as + the second file name, and randomly generates a + first file name. The system job prints files + it finds on .LPTR. on the line printer, whenever it + has nothing better to do and the line printer happens + to be free; these files are subsequently deleted. + Thus the TPL device provides a printer spooling facility. + Attempts to rename a file on the TPL device are + ignored, because the name controls the spooling order. + + For the LPT device, opening succeeds only if no one + has the LPT, or the same user already has the LPT; + in the former case the opening job must be in a tree + controlled by a "local" tty as defined by its TTYTYP + variable. In all other cases the OPEN is converted + to use the TPL device instead. + + For the USR device, the file names should be the + uname-jname pair of the job to open. If the uname is + zero, it is equivalent to using the uname of the + job doing the call. If the jname is zero, then the + uname is interpreted as a specification; + in this way one can open a job given its user index. + A jname of PDP6 or PDP10 opens up the PDP-6 + as the "job". (PDP10 as a jname goes back to the + days when the PDP-6 ran ITS and the PDP-10 was the + auxiliary processor!) + Control bits: + 1.4 Insist on opening an already existing job; + i.e. do not create a new one. The job will + be opened as a foreign job, not as an inferior. + Here is an algorithm for deciding whether job Y will + be a direct inferior or merely a foreign job when + opened by job X: + (DEFUN USR-OPEN-RESULT (X Y BIT-1*4) + (COND (BIT-1*4 (COND ((EXISTS Y) 'FOREIGN) + (T (ERROR)))) + ((EXISTS Y) + (COND ((INFERIOR Y X) 'INFERIOR) + ((DISOWNED X) 'FOREIGN) + ((NOT (DISOWNED Y)) 'FOREIGN) + ((TOPLEVEL Y) + (MAKE-NON-DISOWNED Y) + (CHANGE-ALL-UNAMES Y (UNAME X)) + (FIX-UP-TTY-CHANNELS Y) + 'INFERIOR) + (T 'FOREIGN))) + ((= (UNAME X) (UNAME Y)) + (CREATE-USR Y) + (AND (DISOWNED X) + (MAKE-DISOWNED Y)) + 'INFERIOR) + (T (ERROR)))) + + For the ERR device, the first file name must be + numerically 1, 2, 3, or 4. If it is 1, then the .IOS + word specified by the user variable .BCHN is + examined. If it is 2, the .IOS word for the channel + numerically specified by the second file name is + examined. If it is 3, the second file name is itself + the status word. Bits 3.1-4.5 of the specified word + yield a the number of an error message which can then + be read from the open ERR device. If the first file + name is 4, the second file name must be the value + returned into an error code return argument by a symbolic + system .CALL that didn't skip. The corresponding error + message can be read from the open ERR device. + + For TTY and Tnn devices (terminals in general), + some of the control bits set first-time options, + and some are per-channel. Those which are per-channel + are marked below with a *. The standard names for + these bits are also given. (ITS TTY) + Control bits on input: + 2.6 * %TIECH Read even if char needs pi echoing + 2.5 * %TIPEK Don't remove char from buffer (peek) + 2.3 * %TIACT Don't wait for activation char + 2.2 * %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + + 2.1 * %TINWT Do not wait for input. If no input + is available, return -1 in unit mode, or + return a partially filled block in block mode. + 1.9 * %TIFUL Use the full TV character set if possible. + In this mode, characters have this form: + 2.3 %TXTOP Top. + 2.2 Obsolete. Used to be Shift lock. + 2.1 %TXSUP Super. Used to be Shift. + 1.9 %TXMTA Meta. + 1.8 %TXCTL Control. + 1.7-1.1 %TXASC Ascii part of character. + Of course, for non-TV's only %TXASC + will be non-zero. + 1.6 Set up 3 line echo area (like SCML of 3). + 1.4 "DDT" mode. Initially clear the %TGPIE and + %TGMPE bits for carriage return, line feed, + and tab, thus causing them not to echo. + 1.3 Image mode. Initially clear the %TGPIE + and %TGMPE bits for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode, + ^C causes a block mode end of file. + 1.1 0 = input. + Control bits on output: + 2.6 * %TJECH Echo mode output. + 2.5 * %TJCTN Don't do line continuation. + 2.4 * %TJSTP Channel is hung in **MORE**. + Unusual in that the system modifies this bit. + 2.3 * %TJDIS Recognize ^P cursor codes. + 2.2 * %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 * %TJMOR Do not do **MORE** processing. + 1.9 * %TJPP2 Output in the echo area if it exists. + 1.6 Same as 2.2 - turns on %TJSIO. + 1.5 Same as 2.3 - turns on %TJDIS. + 1.4 Turns on %TJECH, %TJPP2, %TJMOR. + 1.3 Image mode. Initially set %TGIMG bits + for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode + output all ^C's are ignored. + 1.1 1 = output. + + For STY device input, control bit 1.4 means that + input IOTs, instead of hanging, will input a -1 in + unit mode or not count out the AOBJN pointer in block + mode (see ITS TTY for details). + For STY output, control bit 1.4 means that output IOTs, + instead of hanging when the tty's input buffer is full, + will cause a ^G to be output, just as on normal ttys. + Control bit 1.5, on input or output, causes a %TDORS + character to be available as input when an output + reset is done on the sty's alter ego. + Control bit 1.3 is copied into the %TOHDX bit of the + associated tty, thus making it half-duplex if set. + These control bits are not per-channel, but rather + will affect all channels open on the same STY. + + For the LOCK device, the first file name is the name of the lock to + seize. Control bit 1.4 causes the open to hang if the lock is + already locked. See ITS LOCKS for details. + + For the UBI device, the first file name is of the form: + ,,. + + For the PTR and PTP devices (paper tape reader and + punch), if the 1.4 control bit is on, then the 1.2 bit + must be 0 and the 1.3 bit is ignored. In this mode + all eight paper tape channels may be read or punched. + + For the NET device, the arguments are as follows: + cbits 2.1-2.6 byte size for image mode + 1.7 Use 8 times as large a buffer. + 1.6 If ascii mode, use 8-bit bytes + instead of 7-bit bytes. + If image mode, use byte size in + bits 2.1-2.6. + 1.5 Open socket in listen mode. + 1.4 0 = use arg 3 as local socket number. + 1 = generate unique local socket number. + (A generated socket number can be examined + after opening by using the .RCHST uuo). + 1.1-1.3 Standard. + arg 1 Channel number. + arg 2 Left-justified device name (i.e. NET). + arg 3 Local socket number. + arg 4 Foreign socket number. + arg 5 Foreign host number. + + For the STK device (Stanford keyboard): + cbits 1.7 If 1.6 = 1 and 1.5 = 0, + then don't input the meta bit. + 1.6 0 = Stanford mode: + meta = 400 + ctrl = 200 + top+shift+others generate 0-177 + 1 = ITS mode: + meta = 200 + ctrl means ctrl, and works + with others to generate 0-177 + 1.5 0 = convert according to 1.6-1.7. + 1 = don't convert characters. + 1.4 Don't hang if no character + available for input - return -1 + instead. + + If the device name used in the OPEN is not one known to + to the system, the "unknown-device handler" is invoked. + The system creates a job device and loads SYS:ATSIGN DEVICE + into it; this program then has the responsibility for + handling the OPEN. The normal action of this program is + to look for a file DSK:DEVICE;JOBDEV , where + is the requested device name. For example, if an attempt + is made to OPEN the FOOBAR device, and the file + DSK:DEVICE;JOBDEV FOOBAR exists, the program contained in + this file will be used to interpret the OPEN via the JOB device. + If such a file does not exist, but the device name has trailing + digits, the unknown-device handler will try stripping successive + trailing digits and retrying. For example, opening the + AR1 device causes the unknown-device handler to look first for + JOBDEV AR1, and then for JOBDEV AR. If the handler succeeds, + it sets device name for PEEK and who-lines to the second + file name that finally succeeded (see the JOBSTS symbolic + system call). + The unknown-device handler also handles requests for the + directories of certain built-in devices whose directories + are seldom asked for. If there is nothing better to return for + a directory, the string "NON-DIRECTORY DEVICE" is returned. + +Errors: + + OPEN can return many errors. The following errors in + particular are relevant to OPEN on the DSK device: + + 4 FILE NOT FOUND + The specified directory exists, but the specified file + does not. + 5 DIRECTORY FULL + There is no room in the directory to create an entry + for the new output file. + 7 DEVICE NOT READY + The disk pack containing the file is offline (should + never really happen). + 10 DEVICE NOT AVAILABLE + a specific unit was selected, by opening DKn, and that + unit is off-line or contains a reserved pack. Or, a + specific pack was selected by opening PKn or Pnn, + and that pack is reserved. The reserved-pack check + only applies when writing. Reserved means secondary-pack, + or reserved for the exclusive use of certain directories. + 11 ILLEGAL FILE NAME + One or both file names were zero; or, for an output file, + the file names were M.F.D. (FILE) or .FILE. (DIR), which + are names reserved for directories. + 12 MODE NOT AVAILABLE + Control bits 2.9-2.7 specified an illegal mode. + 14 BAD CHANNEL NUMBER + This is a RENMWO error. + 16 PACK NOT MOUNTED + The pack specified by opening PKn or Pnn is not + mounted, or the pack containing the file being read + is not mounted. + 20 NON-EXISTENT DIRECTORY + The specified directory does not exist. + 22 SELF-CONTRADICTORY OPEN + Control bits 2.9-2.7 specified an illegal mode. + 23 FILE LOCKED + An attempt to open a file in write-over mode failed + because someone has the file open for reading; or + an attempt to open a file for read, write-over, rename, + or delete failed because someone is writing the file + or because the file has been deleted, but hasn't gone + away yet because someone is reading it (i.e. there is + a star next to it in the directory listing.) wait a while + and try again. + 24 M.F.D. FULL + Cannot create a new directory because the master file directory + is full. + 27 LINK DEPTH EXCEEDED + Links may not be chained to a length of greater than 100 links. + This error probably means a circular chain of links. + 47 LINK TO NON-EXISTENT FILE + Error 4 or 20 occurred after following a link. + +PDUMP: pure dump a job + + arg 1 . + arg 2 Disk output channel number. + Should have been freshly opened + for output. + arg 3 State word; should be 0 initially. + This word is updated as the PDUMP + progresses; a value of 400000,, means + that page is about to be dumped. + + The pages of the specified job are dumped onto + the disk file in a form that can be efficiently + loaded. In particular, information as to whether + each page is read-only or not is saved so that + when the program is run it can be swapped + efficiently. If the same file is loaded into + several jobs, they will all share the same + physical copies of the read-only pages. + In addition, absolute pages are remembered. + A number of 2000-word (1K) blocks are dumped onto + the file. The first block is as follows: + wd 0 Contains zero. This distinguishes + PDUMP'ed programs from, for example, + MIDAS output. + wds 1-400 Word contains information about + block of the dumped job. This + information is as follows: + 4.9 Absolute page (shared with system). + 2.9-2.8 00 Non-existent page. + 01 Read-only page. + 10,11 Read/write page. + 2.2-1.1 If 4.9=1, absolute page number. + wds 401-777 Zero. + wds 1000-1017 The contents of the accumulators. + Note that the accumulators aren't part of + any page, so they wouldn't be saved if it were + not for this special hack. + The following blocks of the file are the successive + pages of the job, but only those which need to be dumped. + That is, absolute and non-existent pages are not dumped. + Thus, suppose the pages of a job are laid out as follows: + pg 0 Read/write. + pg 1-5 Read-only. + pg 6-7 Absolute (e.g., system symbol table). + pg 100 Read/write. + pg 200 Read/write. + others Non-existent. + Then nine blocks would be dumped out: + blk 0 Descriptor block. + blk 1 Page 0. + blk 2-6 Pages 1-5. + blk 7 Page 100 (octal). + blk 10 Page 200 (octal). + This is all that PDUMP writes out, leaving the file's access + pointer at the end of the last block written. At this point + the job doing the PDUMP will normally write out the + symbol table, if any, for the dumped job onto the disk + channel, preceded and followed by JUMPA instructions + containing the starting address. When this is done, + the resulting file can be loaded and run as a program + under DDT. + See the LOAD symbolic system call. + +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + Can't dump the PDP-6 job. + 34 WRONG TYPE DEVICE + First argument was some oddball channel, or + second argument was not a disk output channel number. + 35 NO SUCH JOB + +PGWRIT: Cause page to be written to disk + + arg 1 (Optional) A + arg 2 Virtual page number within that job (a number from 0 to 377). + control bits: + 1.1 1 => don't wait for the page to finish getting written out, + return immediately. Issue the call again with this bit 0 + if you later want to wait for it to get written out. + 1.2 1 => unlock the page. + 0 => if the page is locked, swap it out anyway, but when it + next gets swapped in again it will be locked again. + + If there is only one argument, it is arg 2. The is + assumed to be the job issuing the call. + + The disk copy of the specified page is brought up to date; + if the in-core copy has been modified by the specified + the page is written out. The PGDUMP call does not return until + the disk has finished recording the page. + + This is useful when pages of a file have been mapped into + the user's address space. + + If the page cannot be swapped out because no disk space is available, + or some job that is using it cannot be pclsr'ed, it waits a while + and tries again. It does not return. + + This call used to be called PGDUMP, but the name was + changed to avoid confusion with PDUMP. + +Errors: + + 12 MODE NOT AVAILABLE + Page is absolute or tied down by exec pages. + 14 BAD CHANNEL NUMBER + The argument is invalid. + 31 CAN'T MODIFY JOB + Executing job doesn't have modification rights to the job + specified by argument 1. + 32 CAN'T GET THAT ACCESS TO PAGE + The page number in argument 2 is not between 0 and 377; or the + job does not have a page at that position in its address space. + 34 WRONG TYPE DEVICE + The specifies the pdp-6, which does not have paging. + 35 NO SUCH JOB + The argument specified a non-existent job. + +PKTIOT: transfer one Chaosnet packet + arg 1 - channel number + arg 2 - address of a 126.-word block. + + Always transfers exactly one packet. + The format of the 126.-word block is: + 16 16 4 + ----------------------------------------- + | opcode | unused | fc | nbytes | 0 | + ----------------------------------------- + |destination host |destination index| 0 | + ----------------------------------------- + | source host | source index | 0 | + ----------------------------------------- + | packet # | ack packet # | 0 | + ----------------------------------------- + | data1 | data2 ... + + ... data487 | + ----------------------------------------- + + For details of how to use these packets, see the Chaosnet + protocol documentation. + +RAUTH: read a file's author. + + arg 1 Number of a channel open on the DSK device, + or a . + + val 1 Sixbit name of the file's author (the last + person to write on the file.) + +RCHST: read channel status. + Note: This system call is obsolete. Use the RFNAME, + RFPNTR, or WHYINT system call to obtain the + information you want. + + arg 1 channel number + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The channel's access pointer, if it is randomly + accessible; otherwise, -1. + val 6...additional device-dependent results + + The values may not be the same as the filenames, etc. + that were used to open the channel. The results of + this call are quite device-dependent. + in the open-mode returned by RCHST. + + The following devices return the access pointer as -1 + and the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + -1, for value 5. + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 sixbit/DSK/ + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-4 0 + val 5 -1 + + TTY (as a console) + val 1 'TTY,, + + TTY (as a device) + val 1 'Tnm,, + + STY + val 1 'Snm,, + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 Access pointer. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + val 5 Access pointer. May be a byte pointer if character mode. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS and JOBRET symbolic system calls. + Note that the job sets the results for vals 1-4 once + using the JOBSTS call, and only the values 5, 6, ... + are taken from the JOBRET that responds to the RCHST. + + NET + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + val 5 4.9-3.1 Time until IMP goes down, in thirtieths + of a second. + 0 => IMP down. + -1 => IMP doesn't plan to go down. + 2.9-1.1 Socket state: + 0 %NSCLS CLS received. val 6 gives reason. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in RFC received state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent. Waiting for matching CLS. + 10 %NSCLI CLS received, but input still available. + 11 %NSINP Input available. + val 7 Reason for closing: + 0 %NCNTO Never open. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host Reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down. + 10 %NCRFS Connection refused. + val 8 Input: number of bits available. + Output: number of bits of buffer free. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + + DIRHNG: + val 1 SIXBIT /DIRHNG/ + val 2 0 + val 3 0 + val 4 Directory name + + LOCK: + val 1 SIXBIT /LOCK/ + val 2 Lock name + + UBI: + val 1 SIXBIT /UBI/ + val 2 ,, + +RCPOS: read cursor position (ITS TTY) + + arg 1 or + val 1 Main program area cursor position. + val 2 Echo area cursor position. + + Each cursor position is returned as a word with the + vertical position in the left half and the horizontal + position in the right half. + See the SCML symbolic system call for setting up an + echo area. + +RDDMST: read demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + val 1 If arg 1 was the sixbit name, the user index; + if it was the user index, the sixbit name. + val 2 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + val 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and STDMST symbolic system calls, + and the .DEMON uuo. + +RDMPBT: read dump bit + + arg 1 Disk channel number or + val 1 A word, all zero, except with the dump check + bit for the file in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the SDMPBT + symbolic system call. + +RELOAD: reload top-level job (ITS DETACH) + + No arguments or values. Note, however, that an + argument of some kind must be supplied so that the + SETZ bit may be present to terminate the set of + arguments. + + The executing job must be the top level job of + a non-disowned job tree. + + Most of the job's system variables are initialized; + the file SYS:ATSIGN is then loaded and + started up, where is the jname of the job + (see the .JNAME user variable). + For example, if the jname of the job is HACTRN, + then the file SYS:ATSIGN HACTRN (which is DDT) + is loaded and started. This is how DDT performs + the U. command. Note that the translation lists for + the job are not cleared before this loading; thus one + can translate the file names SYS:ATSIGN and + cause a different file to be loaded. + + More specifically, the way the job is loaded is that + the following program is put into the job's ac's + and started at location 0: + + 0/ JFCL ;unused word + 1/ .OPEN 1,7 ;open up file SYS:ATSIGN + 2/ JRST 0 ;retry on failure + 3/ .CALL 12 ;load up program + 4/ .LOGOUT ;logout if loading fails + 5/ .IOT 1,2 ;read in starting address + 6/ JRST (2) ;go there + 7/ 4,,'SYS ;SYS device, image unit input + 10/ SIXBIT \ATSIGN\ + 11/ 0 ; is placed here + 12/ SETZ + 13/ SIXBIT \LOAD\ ;load file into job + 14/ 16 ;job specification + 15/ SETZ 17 ;channel number + 16/ -1 ;job is me + 17/ 1 ;channel number is 1 + + Typically the first thing a job used as a top level + (such as DDT) does is close channel 1. Now you know + why. The LOAD system call leaves channel 1 open + so that the start address and symbol table can be + read in. + +Errors: + + 40 NOT TOP LEVEL + +RENAME: rename a file + + Either + arg 1 Byte pointer to ASCIZ string specifying the old name, + or AOBJN pointer to block of byte pointers, + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Left-justified device name. + arg 2 Old file name 1. + arg 3 Old file name 2. + arg 4 Sname. If zero, the executing job's sname + is used (see the .SNAM user variable). + arg 5 New file name 1. + arg 6 New file name 2. + + The file specified by the first four names is renamed + according to the last two. It is not possible to + "rename" a file into a new directory or device. + Attempting to rename to an already existing file will + fail with error code 13 (File already exists). + + The old file names are subject to file name translation. + See the TRANAD and TRANDL symbolic system calls. + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +RENMWO: rename while open + + Either + arg 1 Channel number of channel with file open on it. + arg 2 Byte pointer to ASCIZ string specifying the new name, + or AOBJN pointer to block of byte pointers, + + Or + arg 1 Channel number of channel with file open on it. + arg 2 New file name 1. + arg 3 New file name 2. + + The file open on the specified channel is renamed + according to the specified names. + + Ordinarily this is used in connection with output. Often + one opens a file for output with artificial file names, for + instance _TECO_ OUTPUT, instead of the real desired names. + This is so that if something should happen, causing the + channel to be closed before writing to the file is finished, + any previous file with the desired names will not be + replaced by the new, incomplete file. When all the + necessary data have been written into the file, + one RENMWO's to the desired names and then CLOSE's. + This causes the new, good file to replace the old one of + the same names. (By convention, file names beginning + with "_" are artificial names reserved for this purpose. + Ordinarily a program FOO will use the first file name + _FOO_ and a second file name indicating the nature of + the output file; thus _FOO_ OUTPUT, _FOO_ CRFOUT, + _FOO_ LSTOUT, etc.) + + See the SOPEN symbolic system call for how the byte or AOBJN + pointer argument should be formatted and how the string(s) are + parsed. + + See also the .FDELE uuo. + +REOWN: re-own a disowned job + + arg 1 channel # + + The foreign job open on the specified channel is made + an inferior of the current job. The sub-tree of that job + becomes part of the sub-tree of the current job. The UNAMEs + of the specified job and all its inferiors are changed to + the UNAME of the current job. The JNAMEs are altered where + necessary to keep all UNAME-JNAME pairs in the system unique. + +Errors: + +5 DIRECTORY FULL + The current job already has the maximum number of inferiors (8). +31 CAN'T MODIFY JOB + The specified job is not top-level, or not disowned. +34 WRONG TYPE DEVICE + Specified channel is not open on the USR device, + or the job is already an inferior of the current job. +42 JOB GONE OR GOING AWAY + The specified job is in the process of logging out. + +RESET: reset input/output channel + + arg 1 Channel number. + + See also the .RESET uuo. + + This is a device-dependent operation. In general + the intent is to reset the state of the device to + some standard setting. + + For TTY input: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + All characters pending in the input buffer are + thrown away. Any interrupt characters which have + not yet interrupted will not interrupt. Any echoing + characters which have not yet echoed will not echo. + + For TTY output: + If the particular TTY involved is the console, + wait until the executing job possesses the tty. + (If the %TBINT bit is set for the job, give a + word 1 interrupt on bit 4.2 if the job doesn't + have the tty.) If the TTY is in communicate mode, + wait until it leaves communicate mode. + Any characters in the output buffer are thrown away + iff the %TPORS bit is 1. If the channel was hung in + a **MORE**, the **MORE** is forgotten. If the job + was interrupted in the middle of ^P code typeout, + the ^P is forgotten. Other oddball state bits are + also reset to their normal state. + If the intelligent terminal protocol is in use on + the tty, then a %TDORS code will be sent to it, + and a reply stating the terminal's actual cursor + position awaited before any more output is allowed. + See the description of this protocol in the TTY documentation. + + For the USR device: + This is like doing a .UCLOSE and then re-opening the + job, but with less overhead. All pages of the job + are flushed, and a single page, page 0, is created + and cleared. All resource variables and other variables + are initialized. The %TBNOT and %TBDTY bits are set + in the .TTY variable. The .SNAM variable is initialized + to the uname of the job. The .40ADDR variable is set + to 40 octal. The .APRC variable is set to 447 octal. + + For the LPT device: + The line currently being physically output is terminated + and output. All characters pending in the output buffer + are flushed. The printer is skipped to a new page. + + For the PLT device: + All buffered plotter commands are flushed. + + For the PTR device: + All buffered input characters are flushed. + + For the PTP device: + All buffered output characters are flushed. + + For the COD device: + All buffered output characters are flushed. + + For the PDP-6: + The core of the PDP-6 is cleared. If it is running, + this should cause it to loop, executing the zero word + in location 41. A routine is then placed in core to + clear the PI flags, clear the processor flags, release + all shared devices, clear the accumulators, and finally + clear itself from core. If the routine fails to run + (the PDP-6 is not running), then the routine is cleared + out of the PDP-6 memory again anyway. + + For the NET device: + Any pending interrupt (INR or INS) is cleared. + + For TCP channels: + Currently does nothing. + + For the Chaosnet (channels opened with CHAOSO): + Does nothing. + + For the STY device: + An input reset is much like an output reset for the + tty which is the STY's alter ego; similarly, an output + reset is much like an input reset for the associated tty. + One difference is that a STY input reset does not + reset certain channel-related bits that a tty output + reset would; on the other hand, it always succeeds in + flushing characters even if the %TPORS bit is not set. + + For the STK device: + All buffered input characters are flushed. + +RESRDT: restore file reference date + + arg 1 Disk channel number or + + The reference date for the disk file is restored to + its value prior to the opening of the file. + Note that control bit 1.4 avoids setting the + reference date when a disk file is opened. See + the OPEN symbolic system call. + + See also the DSKUPD, FILBLK, RQDATE and SRDATE symbolic + system calls. + +RFDATE: read file creation date + + arg 1 Disk channel number or + val 1 The creation date of the file: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the RQDATE and SFDATE symbolic system calls. + +RFNAME: read name of file channel is open to + + arg 1 whose channel should be read. (OPTIONAL) + If omitted, self is assumed. + arg 2 channel number + arg 3 Optional byte pointer to store ASCIZ filename string through. + arg 4 Optional maximum number of characters to store. + + val 1 The fullword sixbit name of the device open + on the specified channel, or 0 if the channel + is closed. + val 2 The first file name of the file open on the + channel, or 0 if filenames mean nothing on + the device which is open. + val 3 The second file name, or 0. + val 4 The directory name of the open file, assuming + that "directory name" has some meaning for the + device which is in use; otherwise, 0. + val 5 The mode in which the channel is open. + + The filenames and mode as described by the RFNAME may + not be the same as those specified in the original open. + That is because they are intended to be the "real" + filenames, etc., as opposed to those that were specified. + In other words, they are supposed to be the canonical + arguments to specify to attempt to re-open the file. + For example, the results of filename translation and + link following will show up in the names returned by + RFNAME, as opposed to the translated names or the names + of the link that was followed. Similarly, if COM or SYS + is opened, RFNAME will return DSK:COMMON; or DSK:SYS; + since COM and SYS are equivalent to those disk directories. + The core link devices CLO, CLU, CLA and CLI + perform different functions when first opened, but after the + open they result in indistinguishable channels, and the file + could be re-opened in any case by specifying CLO with the + right filenames, so RFNAME will for all four devices return + the device name CLO. + Some open-mode bits also have only an initial effect, and + they too are likely to be missing (or else always present!) + in the open-mode returned by RFNAME. + + + The following devices return the filenames and directory name as 0: + NUL LPT NVD PLT PTP IMX OMX + PTR DIS IDS COD TVC TAB MT0 + MSP STK + + The data stored by other specific devices is described below. + If a specific numbered value is not mentioned, then the default + is returned by that device - 0 for values 2, 3 and 4; + bits 1.1, 1.2, 1.3 with their standard meanings + for the open-mode (value 5). + + DIRECTORIES + val 1 The device name + val 2 sixbit/.FILE./ + val 3 sixbit/(DIR)/ + val 4 the directory name, on a multi-directory device + + DISK MFD's + val 1 'DSK,, + val 2 sixbit/M.F.D./ + val 3 sixbit/(FILE)/ + + ERR + val 1 'ERR,, + val 2 3 + val 3 a word in the format of a channel status word, + which has the error codes that the ERR device + is describing. + + Closed channel: + vals 1-5 0 + + TTY (as a console) + val 1 'TTY,, + val 5 see TTY as a device + + TTY (as a device) + val 1 'Tnm,, + val 5 Bits 1.1 and 1.2 are standard. + For output channels, all the %TJ... bits + are returned also as they were in the OPEN. + For input channels, all the %TI... bits are + returned as they were specfied in the OPEN. + + STY + val 1 'Snm,, + val 5 All the bits of a STY open are returned. + + USR (including PDP-6) + val 1 'USR,, + val 2 Uname of job. + val 3 Jname of job. + val 4 0 + val 5 bits 1.1 and 1.2 as standard + bit 1.4 1 if the job is not an inferior + of the job which has it open. + + UTn (micro-tape) + val 1 'UTn,, + val 2 File name 1. + val 3 File name 2. + val 4 Uname assigned to, or zero if none (see the .ASSIGN uuo). + + CLI, CLO, CLA, CLU + val 1 'CLO,, + val 2 File name 1. + val 3 File name 2. + val 4 Sname. + + DSK + val 1 'DSK,, + val 2 File name 1. + val 3 File name 2. + val 4 Directory name. + + BOJ + val 1 'BOJ,, + val 2 Uname of creator (zero if he has gone away). + val 3 Jname of creator (zero if he has gone away). + + JOB + vals 1-n Whatever the job device decides to return. + See the JOBSTS system call. Note that the JOB device + is not specifically consulted when the RFNAME call is + given; it sets up the file names and open mode once + and then these values are returned whenever a user + asks for them with RFNAME. + + NET: (Arpanet NCP) + Note that val 4 is slightly nonstandard. + val 1 'NET,, + val 2 Local socket number. + val 3 Foreign socket number. + val 4 4.9 Network interrupt (INR/INS) received. + 2.9-2.1 Byte size. + 1.9-1.1 Foreign host number. + + TCP: (Internet TCP) + val 1 SIXBIT /TCP/ + val 2 Local port # + val 3 Foreign port # + val 4 Foreign net address (HOSTS3 format) + + Chaosnet: + val 1 SIXBIT /CHAOS/ + val 2 Local index + val 3 Foreign index + val 4 Foreign net address (HOSTS3 format) + val 5 0 or 1 (i.e. .UAI or .UAO) + + SPY: + val 1 SIXBIT /SPY/ + val 2 TTY number + + DIRHNG: + val 1 SIXBIT /DIRHNG/ + val 2 0 + val 3 0 + val 4 Directory name + + LOCK: + val 1 SIXBIT /LOCK/ + val 2 Lock name + + UBI: + val 1 SIXBIT /UBI/ + val 2 ,, + +RFPNTR: read channel's random access pointer + + arg 1 channel # (or ) + + val 1 random access pointer + val 2 channel byte size. The acces pointer + is in terms of bytes of this size. + + The random access pointer is the number of bytes + into the file at which the next reading or writing + operation will occur. + + See also the ACCESS system call, the .ACCESS UUO, + the RCHST system call, and the .RCHST UUO. + +Errors: + +34 WRONG TYPE DEVICE + The device open on the specified channel is not random-access. + +RQDATE: read disk format date + + val 1 Current date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time in half-seconds after midnight. + If date and time are unknown, -1 is returned. + val 2 Date and time the system came up in disk format. + If date and time are unknown, -1 is returned. + + See also the DSKUPD, FILBLK, RESRDT, RFDATE, and SFDATE + symbolic system calls. + +RSSIZE: read screen size (ITS TTY) + + arg 1 or + val 1 Vertical size of screen (huge if printing). + val 2 Horizontal size of screen (print width). + + See also the CNSGET and CNSSET symbolic system calls. + +SAUTH: set a file's author + + arg 1 The number of a channel open on the DSK + device, or a . + + arg 2 The sixbit name of the file's author. + + Note: the author is actually stored as a directory + number, so if the author does not have a directory + SIXBIT /______/ will be substituted. Trailing digits + are deleted in an attempt to find the author's directory. + +SCML: set the number of TTY command lines (ITS TTY) + + arg 1 or + arg 2 Number of command lines (typical value is 4). + Must be less than the height of the screen. + If zero, no echo area. + + This causes an echo area to be set up at the bottom + of the display screen, using the last lines. + Characters typed in, or characters output in echo + mode, are output to this area rather than the main area. + Note that control bit 1.6 in an OPEN symbolic + system call for TTY input does an implicit SCML + with a second argument of 3. + +SCPOS: set tty cursor position (ITS TTY) + + arg 1 or + arg 2 vertical position (optional). + arg 3 horizontal position (optional). + arg 4 TTOALC word (optional). + val 1 old vertical position. + val 2 old horixontal position. + val 3 old TTOALC word. + + This call tells the system what the main-program-level + cursor position of the specified tty really is. It + does NOT request that the cursor be MOVED there; + it asserts that the cursor is expected to end up there + as a result of the characters already IOT'ed. + This call is necessary only when the system cannot figure + the resulting cursor position out for itself. + There are two cases when that happens: + + 1) The system does not compute cursor motion when + super-image output is done. If the user program, which + presumably knows how the characters are being used, knows + that the cursor will be moved by them, it should inform + the system. This is necessary even if the user program + is just trying to save time by generating the internal + system output buffer codes itself. + + 2) When an output reset is done on a tty of type %TNSFW + (a "software tty"), the system does not know where the + tty's cursor is physically located. Since the system + does not actually interpret the output characters at + interrupt level, but merely passes them off to the + tty, it does not know how much the tty had done when + the output reset happened. To recover, the system + sets the LH of the tty's TTOALC word to 0, and sends + a %TDORS character to the tty. The tty should respond by + informing the system of the current cursor position and + setting the LH of TTOALC to -1. Physical ttys must + use the intelligent terminal protocol to do that, + but STY users may do it with SCPOS. + +SDMPBT: set dump bit + + arg 1 Disk channel number or + arg 2 A word with the new value for the dump check + bit in bit 1.1. + + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + + See also the .DMPCH uuo and the RDMPBT + symbolic system call. + +SETIOC: set input/output channel error + + This symbolic system call is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the JOBIOC + symbolic system call. + + arg 1 BOJ channel number or + arg 2 IOC error code. + + This is used by JOB devices to cause the calling job + to receive a word 1 IOC interrupt. This interrupt + will be given when the calling job next attempts + an IOT operation. The .BCHN variable for that job + will be set to the channel it has the JOB device + pen on, and bits 4.1-4.5 of the corresponding + .IOS word are set to the specified IOC error code. + See also the JOBINT symbolic system call. + + Valid IOC error codes are as follows: + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 2 ATTEMPTED RANDOM ACCESS TO ADDRESS BEYOND END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (can also mean a directory is full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + +Errors: + + 33 MEANINGLESS ARGS + Second argument is not a valid IOC error code. + 34 WRONG TYPE DEVICE + First argument is not a BOJ channel number. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + +SFDATE: set file creation date + + arg 1 Disk channel number or + arg 2 New creation date and time in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + 2.9-1.1 Time of creation, in half-seconds + after midnight. + + See also the DSKUPD, FILBLK, RFDATE, RQDATE and SRDATE + symbolic system calls. + +SIOT: byte-string in/out transfer + + cbits Same as for IOT symbolic system call (q.v.). + arg 1 I/O channel number. + arg 2 Byte pointer to string to transfer + (must not be indexed or indirect). + arg 3 Count of bytes to be transferred. + arg 4 (Optional) device-independent special mode bits. + + The second and third arguments are updated as the + transfer proceeds. If an end of file condition occurs + or the job is interrupted out of the system call, they + may not be fully counted out. + + SIOT is notably efficient for STY input and TTY superimage + output - much faster than block mode. For details of Chaosnet + SIOT, see the description of IOT. + + Supposedly some esoteric devices don't support this mode of + I/O transfer, but I can't think of any. Also, it is alleged + that on some devices, SIOT is not yet as efficient as block + mode. + +Errors: + + 12 MODE NOT AVAILABLE + The device open on this channel doesn't support SIOT. + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + The second or third argument was immediate. + +SOPEN: open file, using strings to specify the filename + + arg 1 mode bits,,channel number + arg 2 byte pointer to ASCIZ filename string, + or AOBJN pointer to a block of byte pointers + to strings to be concatenated. + +If the second argument's left half is between -63. and -1, then the +argument is treated as an AOBJN pointer to a block of byte pointers to +ASCIZ strings. Those ASCIZ strings are effectively concatenated for +parsing. Otherwise, the second argument is treated as one byte +pointer. 0 may be used as the left half of a byte pointer, and is an +abbreviation for 440700. + +The combined string is parsed using the ordinary ITS filename syntax, with +colon indicating a device name, semicolon indicating a directory name, and +space separating filenames. ^Q is used for quoting colon, semicolon, +space, ^Q and ^@ (which would otherwise terminate the string); it cannot +hurt to quote other characters with ^Q. SOPEN defaults the device to +"DSK", the second filename to ">", and the directory to the executing job's +current sname. + +Multiple devices, directories and names may be significant with some job +devices, and perhaps with disk files as well at some time in the future. + +Once the string has been parsed into filenames, operation proceeds as +for the OPEN symbolic system call, which see. + +SOPEN appears to a job device handler just like any other OPEN, except +that the original second argument byte or AOBJN pointer is available +as one of the values of the JOBCAL symbolic system call (which see). +For an ordinary OPEN, that value from JOBCAL is zero. + +SRDATE: set file reference date + + arg 1 Disk channel number or + arg 2 New reference date in disk format: + 4.7-4.1 Year (mod 100.). + 3.9-3.6 Month (January = 1). + 3.5-3.1 Day of month. + + See also the DSKUPD, FILBLK, RESRDT, and RQDATE + symbolic system calls. + +SREAPB: set the do not reap bit + + arg 1 Disk channel or + arg 2 0 for the normal case. + 1 to request the grim file reaper to + leave this file alone. + + The do not reap bit of the file open on the channel + is set. The G*** F*** R**P** doesn't + respect this bit yet. + + The bit can be read using the FILBLK system call. + It is UNREAP in the FSDEFS insert file. + +SSERVE: set server job + + arg 1 Client job (OPTIONAL) + If omitted, self is assumed. + arg 2 Server job + + The .SERVER variable of the client job is modified to point to the + server job. See the description of .SERVER in .INFO.;ITS USETS. + This system call permits .SERVER to be updated without trafficking + in user indices. + +Errors: + + 34 WRONG TYPE DEVICE + Neither the client nor the server can be the PDP6 + 31 CAN'T MODIFY JOB + Executing job must be able to modify the client job. + +SSTATU: get various system status variables + + val 1 If non-negative, the time (in thirtieths of a + second) until the system will go down. + -1 if the system does not intend to go down. + -2 if the system is already down (can happen + in a job with %OPLIV set). + Obtained from the ITS variable SHUTDN. + See the .DIETIME, .SHUTDN, and .REVIVE uuos. + val 2 Non-zero if the system is being debugged. + This state causes the message + XX ITS ### BEING DEBUGGED + to appear on free consoles instead of the + XX ITS ### IN OPERATION + message usually seen when the system comes up. + If negative, the system is officially down; + ^Z is accepted only from tty 0 (the terminal + physically next to the PDP-10 console) or from + the tty whose number is the absolute value of + the contents of this quantity. A ^Z is also + accepted from a tty associated with a STY; + this is so that STY devices may be debugged! + It is the responsibility of the STELNT server + to examine this quantity and keep network users + from logging in when the system is being debugged. + Obtained from the ITS variable SYSDBG. + val 3 Number of users on the system. This is a + count of logged-in, console-controlled job + trees in the system. This variable is + incremented whenever a user logs in from a + console, and decremented whenever a console- + controlled tree is detached, gunned, or logged out. + This is the ITS variable SUSRS. + val 4 Sum of parity and nxm memory errors during this + incarnation of the system. This is the sum of + the ITS variables PARERR and NXMERR. + val 5 Time the system has been up, in thirtieths of + a second. This is the ITS variable TIME. + See the .RDTIME uuo. + val 6 The left-justified name of the machine, i.e. one of: + SIXBIT \AI\ ;A.I. Lab KS-10 + SIXBIT \ML\ ;Mathlab KS-10 + SIXBIT \MC\ ;Mail Computer KS-10 + SIXBIT \MD\ ;Mostly Development KS-10 + SIXBIT \MX\ ;Macsyma Consortium KL-10 + SIXBIT \SI\ ;Stacken ITS KS-10 + SIXBIT \PM\ ;PandaMonium KS-10 + SIXBIT \FU\ ;Australian KS-10 + SIXBIT \DM\ ;Dynamic Modeling KA-10 (R.I.P.) + SIXBIT \MLKA\ ;Mathlab KA-10 (R.I.P.) + SIXBIT \AIKA\ ;A.I. Lab KA-10 (R.I.P.?) + This is the name which appears for XX in such + messages as + XX ITS ### IN OPERATION + and which serves as a device name for that + machine's disks (i.e. the ML device is the + DSK device of the ML (Mathlab) machine). + If more ITS machines come into existence, + naturally more machine names will be invented. + val 7 The system version number, in sixbit. This is + the ### in such messages as above. + val 8 The number of free job slots. + + DDT uses much of this information to print out its + greeting to you: + If value 2 is non-zero DDT prints out + ITS BEING DEBUGGED! + If value 1 is non-negative DDT prints out + XX ITS GOING DOWN IN 1:23 + if e.g. ITS were going down in 1 minute, 23 seconds. + (DDT also prints the contents of the file SYS:DOWN MAIL + if that file exists.) + Value 3 is used to print out the number of users as + 23. LUSERS + (if your DDT has not logged in itself, it increments + this value so as to count you also). + Values 4 and 5 are used to compute the number of memory + errors per hour, printed as: + MEM ERRS .034142/HOUR + The DDT command :SSTATU will print out all + this information. + +STATUS: get input/output status word + + arg 1 Channel number. + val 1 Status word for specified channel. + + This call returns a word describing the state of + the specified channel: + 4.9-4.6 Always zero. See the .IOPUSH and .IOPOP + uuo's, and the .IOP and .IOS user variables. + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + These are the same as the error codes returned + by failing .CALL's. + 2.9-2.3 Device dependent (see below). + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code. + 0 TTY Console input. + 1 TTY Printing console output. + 2 TTY Display console output. + 3 LPT Data Products line printer. + 4 VID Vidisector ??? + 5 BAT Vidisector ??? + 6 PLT Calcomp plotter. + 7 PTP Paper tape punch. + 10 IMX Input multiplexor. + 11 OMX Output multiplexor. + 12 PTR Paper tape reader. + 13 DIS DEC 340 display, ascii output. + 14 IDS Interpreted 340 display. ??? + 15 MTn Magnetic tape. + 16 COD Morse code device. + 17 TAB Tablet. ??? + 21 NUL Source of zeroes, or output sink. + 22 JOB Job device. + 23 BOJ Inverse of JOB. + 24 SPY Spy on another console. + 25 STY Pseudo-teletype. + 26 NET ARPAnet (NCP). + 27 LPT Vogue line printer (yech!) + 30 STK Stanford keyboard. + 31 MSP (DM) Interprocess message protocol. + 32 CHAOS CHAOS net. + 33 TCP TCP Internet. + 34 TRAP Trap "device" + 35 IPQ Internet IP Queue. + 36 UBI KS10 Unibus interrupt + 41 UTn Microtape (DECtape). + 43 DSK 2311 disk drives or equivalent. + 60 USR A not immediately inferior procedure. + 61 USR An immediately inferior procedure. + 62 CLx Various core link devices (CLA, CLI, CLO, CLU) + 63 --- File directory or ERR device. + 64 USR The PDP-6. + 65 DIRHNG Directory hang "device" + 66 LOCK Lock "device" + + Device dependent bits for TTY input: + 2.9 Local tty. + 2.8 Next to the 340 or a 340 slave. + 2.5 Chars pending which have been .ITYIC'ed but not IOT'ed. + 2.4 The job possesses the tty. + + Device dependent bits for TTY output: + 2.4 The job possesses the tty. + + Device dependent bits for Data Products LPT: + 2.9-2.3 Current column (left margin = 0). + + Device dependent bits for MTn (macro-tape): + 2.9 Chunk, write EOR after each IOT (should be block) on output, + don't ignore them on input. See magtap info. + 2.8 0 => odd parity, 1 => even parity. + 2.7-2.6 Density: 00 => 800, 01 => 200, 10 => 556. + Apparently 11 => IBM 9 track 800 bpi?? + 2.5 0 => 7 track, 1 => 9 track. + 2.4 End of tape. + 2.3 Read compare error. + + Device dependent bits for NET: + 2.9-2.4 Socket state: + 0 %NSCLS CLS received or net down. Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in state 2. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent; waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + + Device dependent bits for TCP: + 2.9-2.4 Connection state - see WHYINT call for state codes. + + CHAOSnet provides no device dependent bits. + + A STATUS word can be supplied to the ERR + device to obtain corresponding error message, if any. + + See also the JOBSTS symbolic system call, the .STATUS uuo, + and the .IOS user variable. + +STDMST: set demon status + + arg 1 Either the sixbit name or the user index + of a demon job. + arg 2 If negative, flush all requests for the specified demon. + Otherwise: + 4.9-3.1 If non-zero, the time in two-minute ticks + between automatic signals for the demon. + 2.9-1.1 Number of requests pending for the demon. + arg 3 Time in two-minute ticks until the next automatic + signal will occur (meaningful only if arg 2 bits + 4.9-3.1 not zero). + + See also the DEMSIG and RDDMST symbolic system calls, + and the .DEMON uuo. + +STLGET: get information from Server Telnet + + arg 1 a + + val 1 XJNAME of server telnet + val 2 TRMNAM of server telnet + This is the sixbit name of the host connected to. + val 3 SNAME of server telnet + val 4 In LH: STY status bits + In RH: index of telnet server job which owns the STY. + + This call can be used to find out where in the network + a TTY really is. + + The STY status bits are from the STYSTS table in ITS. + Some of the more interesting ones include: + %SSNET==4000 ;4.3 = 1 => THIS STY CONNECTED TO SOME NET SOCKETS. + %SSCHA==2000 ;4.2 = 0 FOR ARPANET, 1 FOR CHAOS NET + %SSTCP==1000 ;4.1 = 1 for TCP internet (%SSCHA must be 0) + +Errors: + +34 WRONG TYPE DEVICE + Specified TTY is not controlled by a server telnet. + +STYGET: get information about STY + + arg 1 (need not be associated with a STY) + val 1 STY status word: + 4.9 %SSHNG Don't hang on input IOT. + 4.8 %SSUSE STY is in use. + 4.7 %SSINT Have given interrupt on STY output channels. + 4.6 %SSONT Have given interrupt on STY input channels. + 4.5 %SSOHG Don't hang on output IOT. + 4.4 %SSORS Give a %TDORS whenever an output RESET is + done on the controlled tty, regardless + of whether the tty is a software tty. + 2.9-1.1 User index of job which owns the STY. + Zero if STY is not in use, or if TTY is not + associated with a STY. + val 2 User index of job which owns the TTY, either as a device + or as a currently possessed console; or -1 if TTY is free. + val 3 -1 if the TTY is not a console or is free. Otherwise, + 2.9-1.1 is the user index of the top-level job of the + job tree controlled by the TTY. + 4.8 = 1 if that job is in the process of logging out. + 4.7 = 1 if that job is logged in. + + val 4 4.9 Owner of TTY is in a TTY output wait on the TTY. + 1.1 Owner of TTY is in a TTY input wait on the TTY. + These bits probably don't work very well. + val 5 4.9 TTY input available. + 4.8 TTY output buffer has room. + val 6 The tty's TTYSTA word. + 4.9 %TACFM TTY does not need a console free message + eventually (hasn't been in use since + the last one). + 4.8 %TAC.Z TTY is being ^Z'd. Shouldn't be on with + %TACFM. If %TACFM and %TAC.Z are both 0, + the tty is being freed and a console free + message is immanent. + 4.7 %TANJS This ^Z is being flushed because no job + slots are available. If set, %TAC.Z + will be 1 and %TACFM will be 0. + + This symbolic system call originally was intended to return + STY information, but now returns useful data concerning any TTY. + +STYNET: Connect a STY to a pair of Network connections. + + arg 1 Sty channel (either direction). + arg 2 -1 to disconnect the STY from its network channels + (in which case args 3 and 4 are unnecessary), + or Net input channel (to connect STY output to). + This may be a NCP, TCP, or CHAOS channel. + arg 3 Net output channel (to connect STY input to). + arg 4 Characters to send out on net + when an output .RESET is done on the STY's TTY. + Up to 3 8-bit characters, left-justified. + + It is possible with this call to connect a STY to a pair + of network channels, one open for input, and one open for output. + When the direct connection is established, anything received by + the net input socket will be fed automatically to the + STY, and any type-out that the STY receives from its TTY will be + fed automatically to the net output channel. The transfer of + data is handled by the system at clock level, eliminating + the need for the program to wake up at each character. + + Only one input and one output net channel can be connected to + a STY, and only one STY can be connected to any net channel. + Both sides of a STY are connected and disconnected at once. + A job can connect a STY if it has the STY open in either direction + (but it will generally want to have both directions open). + + Once established, the direct connection will last until + broken explicitly by the user, or until an escape condition + is detected by the system. Escape conditions include receipt + of a TELNET control character on the net input channel (any + character with the 200's bit on), and + either net channel's getting into an abnormal state (other + than %NSOPN, %NSINP, or %NSCLI) - in general, things which + the system expects that the user program will want to take + action on. + + The connection can be broken explicitly by the user either + by a STYNET call with arg 2 negative, or by a CLOSE of any + of the channels involved (this also happens when the job + is killed.) It is an error to IOT on any of the channels + without breaking the connection first. + + The STYNET call returns immediately, without actually + transferring any data. The program can assume that the + connection is still in effect until it is notified of + a disconnection by an interrupt on the net input channel. + While the connection lasts, interrupts on the net channels + due to arriving data are intercepted by the system, so + an interrupt implies that the connection has been broken. + + When a %TDORS comes out of the STY, indicating that the TTY's + output buffer has been cleared, this is indicated to the net + output channel by means of a network interrupt (NCP only), and the + string of up to 3 characters specified as the fourth argument + to the STYNET call. If TCP, these characters are PUSHed with the + URGENT bit set. + + If you use STYNET with the official TELNET protocol, you must + turn on the %TPTEL bit in the STY TTY's TTYOPT variable, to + cause the sequence CR-LF to be turned into just a CR. + + For the Chaosnet: + arg 1 - STY channel + arg 2 - Chaos channel to connect to, or + -1 to disconnect + arg 3 - Other Chaos channel (not actually used) + arg 4 - Output-reset character sequence, up to 3 8-bit + characters left-justified. + + This works the same as on the Arpanet. The specified STY + is connected to or disconnected from a Chaos net channel. + Data is transferred in and out by the system without the + need for intervention by the user program. If an unusual + condition occurs, the STY is disconnected from the Chaos + channel and the user is interrupted. It is illegal to do + I/O on any of the involved channels while they are connected. + + This call is provided for the benefit of the "Telnet" server. + +Errors: + + 2 WRONG DIRECTION + An input net channel was supplied as the third argument, or + an output channel was supplied as the second argument. + 23 FILE LOCKED + The STY or one of the network channels is already direct-connected + to another network channel or another STY. + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + An attempt was made to disconnect a STY not already connected. + +T11MP: PDP-10 to PDP-11 map + + arg 1 Page number within the user's core. That page + must be either non-existent or shared with an + absolute page. The user's virtual page is made + to share with some arbitrarily chosen absolute + page, which is then made to share with PDP-11 memory + according to argument 2. + arg 2 Desired PDP-10 to PDP-11 map word. + 4.9 Valid (must be 1). + 4.8 Write enable. + 4.7-4.3 Unused. + 4.2-3.9 PDP-11 number. See below. + 3.8-2.2 Relocation (origin of segment in PDP-11 + address space). = 4*. + 2.1-1.1 Protection (number of accessible words - 1). + = 4*. + If protection=0 then only one 16-bit word + is accessible. + + The CORBLK symbolic system call may be used in the special + case of mapping one's TV console video buffer memory. + + The AI KA-10 has a PDP-10 to PDP-11 interface which lets the PDP-10 + programmer directly access the memories of up to eight PDP-11's. + PDP-10 pages are mapped into segments of variable size in the + PDP-11's memory. The PDP-10 to PDP-11 page map is also directly + addressable in memory (it currently lives in absolute locations + 2,,776000 - 2,,776377). There are 256. such entries, one for each + page in the range 2,,0 - 2,,777777, which are the addresses fielded + by the PDP-10 to PDP-11 interface. ITS allocates these pages + and their corresponding map entries randomly as needed. + + When the PDP-10 attempts to access a physical address in the range + 2,,0 to 2,,777777, the interface uses the 776000 bits to index + the map words. If the appropriate map word does not have its + valid bit set, the memory is considered non-existent. The same + is true if the reference would violate the protection bounds. + The reference also fails if it is a write reference and the + map word does not have the write enable bit set. + Otherwise, the relocation quantity is added to the 1777 bits, + and this determines which PDP-11 double-word to access. + The PDP-11 number determines which PDP-11 to access, of course. + The PDP-11 double-word corresponds to the high 32. bits of the + PDP-10 word, as follows: + PDP-10 BIT PDP-11 WORD AND BIT + 4.9 0 15 + 4.8 0 14 + 4.7 0 13 + --- --- --- + 3.4 0 01 + 3.3 0 00 + 3.2 1 15 + 3.1 1 14 + --- --- --- + 1.6 1 01 + 1.5 1 00 + When reading the PDP-11 memory, bits 1.4-1.1 are read as zeros. + When writing, 1.4=1 means don't change word 0, 1.3=1 means don't + change word 1, and 1.2-1.1 are ignored. Split cycles do the right + thing, so ILDB and IDPB should work correctly. + Note that accessing consecutive 16.-bit PDP-10 bytes will access + consecutive PDP-11 words, but accessing consecutive 8-bit PDP-10 + bytes will not access consecutive PDP-11 bytes! Rather, the PDP-11 + bytes are accessed in the order 1, 0, 3, 2. + + The following PDP11s are currently (4/2/76) attached. + + 0 The pdp11 that runs the AI KA-10 TV system. + 1 The pdp11 that runs the AI KA-10 XGP. + 2 The Lisp Machine GT40. + 3 The Chess Machine (not really a pdp11.) + 4 The Logo pdp11/45. + 5 The Micro-Automation pdp11/45. + +Errors: + + 1 NO SUCH DEVICE + There is no PDP-11 connected to this PDP-10. + 3 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + The page number is invalid, or the map word has bit 4.9=0. + 37 NO CORE AVAILABLE + No map words free. + +TCPOPN: open a TCP Internet connection (TCP;TCPDOC >) + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - local port # (-1 to gensym a unique local port #) + arg 4 - foreign port # (-1 for wild port) + arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild host) + arg 6 - Retransmission timeout (optional, not yet used) + +Control bits: + - None needed for channels - they are opened as .UAI and .UAO + automatically (no other modes possible). + - 7 vs 8 bit ASCII transfers can be determined by user-space byte + pointer used in SIOT. System buffers are always 8-bit bytes. + %NOLSN - Listen mode + + Note a value of -1 for either the foreign port or host will imply + that the call is a "listen". Return is always immediate, use NETBLK + to determine when the channels become open. For a non-listen call, + there is an internal ITS timeout, but for listen the state can persist + forever. + +ERRORS: + 6 - No free TCBs or buffers available (system has too many active conns) + 7 - TCP disabled in system. + 11 - Bad local or fgn port # + 13 - Connection already exists with these ports + 14 - Bad channel # arguments. + 33 - Illegal to use same channel for both input/output. + +TRANAD: add a translation entry (ITS TRANSL) + + cbits 2.9 Atomic translation (do not retranslate). + 2.8 0 => TRNLST, 1 => TRNLS1. + The TRNLST applies only to the specified job; + the TRNLS1 applies to the job and its inferiors, + direct or indirect. + 1.2 Output translation. + 1.1 Input translation. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to a block of "from" names. + arg 3 AOBJN pointer to a block of "new" names. + + Each AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are to be translated. All names are left-justified + within a word. A zero or omitted word is equivalent + to *. + Before creating the translation, a TRANDL is + performed on the first two arguments to prevent + duplicate translations. + + Uuos and symbolic system calls affected by translation + include .FDELE, .OPEN, MLINK, RENAME, and OPEN. + +Errors: + + 5 DIRECTORY FULL + No room in system for new translation entry. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to put a translation on the PDP-6. + 35 NO SUCH JOB + +TRANCL: clear translation list (delete all entries) (ITS TRANSL) + + cbits 2.8 Clear TRNLS1. + 2.7 Clear TRNLST. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + + + Either or both lists may be cleared with a single call. +Errors: + + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to clear translation lists for PDP-6. + 35 NO SUCH JOB + +TRANDL: delete a translation entry (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + 1.2 Stop translating for output. + 1.1 Stop translating for input. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 An AOBJN pointer to a block of names. + + The AOBJN pointer should point to a block of + from one to four words. These are, in order, the + device, file name 1, file name 2, and sname which + are no longer to be translated. All names are + left-justified within a word. A zero or omitted + word is equivalent to *. + +Errors: + + 4 FILE NOT FOUND + No such translation entry to delete. + 14 BAD CHANNEL NUMBER + 31 CAN'T MODIFY JOB + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to delete translation entry for PDP-6. + 35 NO SUCH JOB + +TRANEX: examine a translation list (ITS TRANSL) + + cbits 2.8 0 means TRNLST, 1 means TRNLS1. + The TRNLST applies only to the + specified job; the TRNLS1 applies + to the job and its inferiors, + direct or indirect. + Before the control bits are interpreted, the LH + of arg 1 is XOR'd into them. + arg 1 RH is a . LH XOR'd into cbits. + arg 2 AOBJN pointer to array in core. + val 1 AOBJN pointer to tail end of array, + i.e. the part not needed to hold the data. + + The translation list is stored as consecutive + nine-word blocks of translation information. + Each block has the following form: + wd 0 4.9 Atomic translation entry. + 3.2 Output translation. + 3.1 Input translation. + wd 1 "from" device name. + wd 2 "from" file name 1. + wd 3 "from" file name 2. + wd 4 "from" sname. + wd 5 "to" device name. + wd 6 "to" file name 1. + wd 7 "to" file name 2. + wd 8 "to" sname. + A zero word for a "from" name means translate for any + name in that position; a zero "to" word means don't + change that name when translating. + +Errors: + + 14 BAD CHANNEL NUMBER + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + Not meaningful to examine translation list for PDP-6. + 35 NO SUCH JOB + 37 NO CORE AVAILABLE + Supplied array too small to hold data. + +TRANS: translate some file names (ITS TRANSL) + + cbits 1.1 0 for input, 1 for output. + arg 1 "from" device name. + arg 2 "from" file name 1 (defaults to zero). + arg 3 "from" file name 2 (defaults to zero). + arg 4 "from" sname (defaults to job's current sname). + arg 5 mode (XOR'd with control bits; defaults to 0). + val 1 "to" device name. + val 2 "to" file name 1. + val 3 "to" file name 2. + val 4 "to" sname. + + The given file names are translated by the same rules + for translation governing the operations of OPEN, + RENAME, DELETE, and MLINK. These rules are as follows. + + Translation lists are searched in the order: + executing job's TRNLST + executing job's TRNLS1 + executing job's superior's TRNLS1 + that job's superior's TRNLS1 + . . . + top-level job's TRNLS1 + system job's TRNLS1 + The lists are searched for an entry matching the given "from" + file names. A translation entry is said to match if each + "from" name matches the entry's corresponding name, + and if the translation entry applies to the mode (input or output). + A name in turn matches if the entry's name is the same as + the given name, or if the entry's name is * (matches anything). + If a match is found, the given file names are replaced by the "to" + file names in the translation entry, except that in the entry + a "to" file name of * means don't change the given name; + the process is then repeated from the beginning unless the + matching translation entry is atomic. When this happens, or + when a full search finds no matching translation entries, + the translation process is complete. To prevent endless + retranslation, it is considered an error to repeat the + translation process more than eight times. + + When a job is first created its TRNLST and TRNLS1 are null. + The TRANAD, TRANCL, TRANDL, and TRANEX symbolic system calls + may be used to examine and modify translation lists. + +Errors: + + 3 TOO MANY TRANSLATIONS + No more than eight consecutive translations are permitted. + +TRPOPN: Open trap-device channel + + arg 1 + arg 2 channel number in that job + arg 3 IOCHNM word (only LH is used) + arg 4 IOCHST word + + The specified channel of the specified job is made a trap-device + channel. Almost any attempt to use it will cause a %PITRP interrupt. + See documentation of the TRAP: device. + +Errors: + +13 FILE ALREADY EXISTS + The specified channel is open. + +14 BAD CHANNEL NUMBER + arg 2 is invalid. + +31 CAN'T MODIFY JOB + The is not clobberable. + +34 WRONG TYPE DEVICE + The is the pdp-6. + +TTYESC: simulate type-in of ^_ + + arg 1 + + Pretends that the user has just typed in a ^_. + The next character the user types will be interpreted + as a ^_ command. + + The intended use of this is for programs which use + super-image input, so that ^_ does not have its normal + effect, but which wish to provide an escape convention + so that the effect of ^_ can be obtained. When the program + sees the escape character sequence as input, it should + do a TTYESC. + +Errors: + +7 DEVICE NOT READY + The terminal is already in the middle of a ^_ code + being typed by the user. + +TTYFLS: flush TTY input + + arg 1 + control bits: + 1.1 0 => cause the last interrupt character .ITYIC'ed + to be ignored by .IOT. + 1 => discard all input up to and including the last + character .ITYIC'ed. + + This call is normally used by TTY input interrupt handlers. + +TTYGET: read the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + val 1 TTYST1 variable. + This variable contains six groups of six bits. + Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + The character groups are: + 4.9-4.4 ^@-^F ^K ^L ^N-^R ^T-^Z ^\-^_ + 4.3-3.7 Upper and lower case letters. + 3.6-3.1 Digits. + 2.9-2.4 ! " # $ % & ' , . : ; ? @ \ ` | ~ + 2.3-1.7 + * - / = ^ _ + 1.6-1.1 < > ( ) [ ] { } + val 2 TTYST2 variable. + Six more groups of six bits: + 4.9-4.4 ^G ^S + 4.3-3.7 ^I ^J (tab, linefeed) + 3.6-3.1 altmode (33) + 2.9-2.4 ^M (carriage return) + 2.3-1.7 rubout (177) + 1.6-1.1 space, ^H (backspace) + val 3 TTYSTS variable. + 4.9 %TSFRE Free console (not in use). + 4.8 %TSCLE ^L should echo as "^L" (normally + clears screen on displays). + 4.7 %TSHDX Same as %TOHDX. Vestigial. + 4.6 %TSFCO Use full 12-bit TV char set for output and + echoing: echo CONTROL as ALPHA, echo META + as BETA, echo SUPER as EPSILON, and use + Sail graphics if TOP is set. + 4.5 %TSALT Do not standardize altmodes. + 4.4 %TSROL Scroll mode. + 4.3 %TSSAI Echo and ascii output use SAIL + character set. + 4.2 %TSACT Next input IOT shouldn't wait + for an activation character. + 4.1 %TSNEA Don't echo in echo area; echo in M.P. Area. + 3.9 %TSINT Next input character should + interrupt even if it ordinarily + would not (%TGINT = 0). + 3.8 %TSMOR Inhibit **MORE** processing. + 3.7 %TSATY Set whenever an .ATTY executed by + some superior returns the tty to + the job. + 3.4 %TSNOE Defer echoing. + 3.3 %TSLCZ Last character typed was ^Z. + This bit causes .ATTY's to fail. + 3.2 %TSSII Super-image input. The special + actions of ^Z and ^_ are suppressed. + 3.1 %TSCNS This is a console, not a device. + 2.9-1.1 The user index of the job which controls + the tty, or -1 if the tty is free. + val 4 the TTYTYP variable + See the CNSGET documentation. + val 5 the TCTYP variable + See the CNSGET documentation. + + Values 4 and 5 probably should not be depended upon. + + See also the CNSGET, CNSSET, and TTYSET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYSET: set the variables TTYST1, TTYST2, TTYSTS (ITS TTY) + + arg 1 or + arg 2 TTYST1 variable. See under TTYGET. + arg 3 TTYST2 variable. See under TTYGET. + arg 4 TTYSTS variable (optional). See under TTYGET. + %TSFRE, %TSHDX, %TSLCZ, and %TSCNS may not be altered, + nor may the RH. + + See also the CNSGET, CNSSET, and TTYGET symbolic system calls. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 14 BAD CHANNEL NUMBER + 34 WRONG TYPE DEVICE + +TTYVAR: read or set a variable associated with a TTY. + + arg 1 or + + In the simplest mode: + + arg 2 the name of a tty variable, in SIXBIT. + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 the SIXBIT name of a tty variable. + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the SIXBIT name of a tty + variable, and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The TTY variables include HEIGHT, WIDTH, ISPEED, OSPEED, TTYOPT, + TTYTYP, TTYCOM, TCTYP, TTYROL, TTYSMT, and IDLTIM. See + .INFO.;ITS TTY for a description of their meanings. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized tty variable name. + 26 DEVICE WRITE-LOCKED + Specified variable or specified tty cannot be written. + 33 MEANINGLESS ARGS + Attempt to store an illegal value in the TCTYP variable, + or an illegal instruction was specified in immediate- + instruction or block mode. + +TVWHER: tell where a TV is + + arg 1 or + val 1 The keyboard number of the physical + terminal in use. + The correspondence between keyboard numbers + and physical locations is in the file + SYSENG;TVKBD ROOMS, which is how the NAME + program gets this information. If this table + and that file disagree, that file is correct, + and please update this table. + As of February 7, 1977, these correspondences + were in effect: + KBD # ROOM WHO LIVES THERE + 0 809 Fahlman, Holloway, Knight x7807 + 1 810 Lavin, Kuipers, Miller, Bruss x7836 + 2 919 Very Small Data Bases north x6765 + 3 812 Yvonne, Karen x5876 + 4 813 Hewitt x5873 + 5 814 Sussman, McDermott x5874 + 6 808 Freiling, Lozano-Perez, Ullman x5875 + 10 817 Jabari x6218 + 13 819 Goldstein x5879 + 14 820 Minsky x5864 + 17 822 Marr x2082 + 21 824 Rich, Levin, DeKleer x6032 + 22 825 Purcell, Doyle x5848 + 23 826 Fredkin's Folly x5904 + 30 925 Moon (Tycho, north wall) x6765 + 31 902 Mason, Raibert, Hollerbach x3483 + 32 919 Very Small Data Bases south x6765 + 33 344 Edwards, Lebel x6765 + 34 913 Baisley, Greenblatt x6765 + 35 914 Gosper's Fishbowl x2076 + 36 912 9th Floor Lounge x6765 + 37 907 Chess, Lisp Machines x6765 + + val 2 The number of the TV video buffer in use + on this tty (0-17 octal). This is NOT a + Video Switch input number. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +UNLOCK: Unlock JOB's locks. + + arg 1 + + If the specified job is writable, and is using the locks + feature, its locks are unlocked. (Usually this is used on + onesself.) See the ITS LOCKS file for more information + on locks. + + (Note that this has nothing to do with the LOCK device. In + particular it will -not- close LOCK device channels.) + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + + Plus the usual errors for arguments. + +USRMEM: Read or write another job's memory + + cbits 2.9 Allow writing into any job + 1.1 If page isn't readable or writable give an + MPV or pure interrupt to the job being + referenced. + + arg 1 + Other args are like USRVAR and TTYVAR. In place of + a variable-specifier you put the address in the job + of the word to be read or written. + + arg 2 Address to read or write (non-negative) + + Straight reading: + + Specify only 2 arguments. + + Straight writing: + + arg 3 New value + + Writing with an instruction: + + arg 3 Ignored + arg 4 Instruction to write with + + Block mode: + + arg 2 An AOBJN pointer to a block of pairs, first address + and then instruction. + + val 1 Previous contents (these are not valid in block mode) + val 2 New contents + + + Reading: + The content of the specified address in + is returned as val 1. + + Writing: + Arg 3 is written into the specified address + in . The previous contents are returned + as val 1. + + Writing with an instruction: + The instruction should modify its AC as if the spec'd job's + memory location were in it. The memory operand is fetched + from your own address space and is not stored back. + No jobs can run while the location is being modified, that is + between the fetching of the old value and the storing of + the new value. + The previous contents are returned as val 1, the new + contents as val 2. + +Errors: + + 31 CAN'T MODIFY JOB + The specified job is not writable. + 32 CAN'T GET THAT ACCESS TO PAGE + The specified page is either nonexistant + or is read-only. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction for writing. + +USRVAR: Read or set some of a job's variables + + arg 1 + + In the simplest mode: + + arg 2 user variable specifier (see below). + arg 3 (if writing) the new value. + + If arg 3 is not supplied, you are reading, and + val 1 is the value of the variable. + + In immediate-instruction mode: + + arg 2 user variable specifier (see below). + arg 3 ignored + arg 4 the instruction + + This mode is detected by the presence of four arguments. + + The specified instruction is executed as if the + variable was in ac 0. MOVE can be used to set the + variable, MOVEM to read it, but you can also use + TLO to set bits, ADDI to increment, etc. + + In block mode + + arg 2 an AOBJN pointer to a block of pairs of words. + + This mode is detected by bits 4.1-4.9 of arg 2 being all + ones. + + The first word in each pair is the user variable specifier + (see below), and the second word is an instruction to be + executed as if that variable were in ac 0. The block pointer + argument is updated. + + The instructions allowed in immediate-instruction and + block modes are: MOVx, MOVxI, MOVEM, ADD, ADDI, SUB, SUBI, + all Booleans in normal and immediate modes, and TxZ, TxC, + and TxO (i.e. all Test instructions that modify and don't + skip.) + + This call is the symbolic equivalent of the .USET and .SUSET + UUO's. It can read, write, or both (but you are usually not + allowed to write any job except yourself or an inferior); + it is a .SUSET if the is %JSELF, or a .USET if given a + channel number as the , or it can be given other kinds + of job specs. + + The user variable specifier can be either numeric or sixbit. + If sixbit, it is the same as the name given in the ITS USETS + file except without the dot at the beginning. Sixbit specifiers + are good for programs which take arguments as to which user + variable to operate on, and are useful to allow a program + which uses a new variable to assemble before that variable is + actually put in the system (it will get error code 11 when it + tries to refer to the variable.) + + A numeric specifier is a small integer similar to those used + with the .USET and .USET uuos. Predefined symbols exist for + these, consisting of ".R" followed by the name of the variable. + (Use ".R" rather than ".S" even if you are writing.) Do not + use the symbols without the "R" (these are something else.) + The .IOC, .IOS, .IOP, and .PMAP arrays of user variables + can only be specified numerically. + + See the .SUSET and .USET UUO's (in .INFO.;ITS UUOS) + for more information on particular user variables. + +Errors: + + 11 ILLEGAL FILE NAME + Unrecognized sixbit user variable specifier, or numeric specifier + larger than the legal range. + 12 MODE NOT AVAILABLE + The specified variable is not available for the current combination + of reading versus writing and self versus other job. + 13 FILE ALREADY EXISTS + Attempt to cause two jobs in the system to have the same UNAME/JNAME pair. + 31 CAN'T MODIFY JOB + Attempt to write into a user variable of a job which is not writable. + 33 MEANINGLESS ARGS + Attempt to specify an illegal instruction in immediate- + instruction or block mode; or attempt to store an illegal value + into a user variable (e.g. zero into the .UNAME). + 34 WRONG TYPE DEVICE + Attempt to access user variables of the pdp-6 other than .UIND + or .MEMT. + 40 NOT TOP LEVEL + Attempt to set a user variable for a job that is not top level, + when only top-level jobs are allowed to set that variable, for + example the .UNAME and .JNAME. + +VIDBUF: request/release video buffer + + arg 1 If non-negative, the number of a video buffer + to release. If negative, requests a video buffer. + val 1 If arg 1 was negative, the number of the buffer obtained. + + A video buffer for the PDP-11 TV consoles is assigned or + released. If assigned, the video switch input number + of that buffer is returned. This value can be placed + in bits 4.1-3.3 of the .TVCREG user variable in order to + cause video buffer pages in one's page map to refer to + the allocated video buffer. + + A video buffer is a segment of PDP-11 memory large enough + to represent all the bits on a TV display. A display + is 1100=576. bits wide by 706=454. lines high. Every + line is represented by 36. 16.-bit PDP-11 words; + this corresponds to 18. PDP-10 words as mapped through + the PDP-10 to PDP-11 interface (see the T11MP symbolic + system call). The word with the lowest address holds + the leftmost displayed bits; furthermore within each word + bit 15 is the leftmost displayed bit. Thus, as seen by the + PDP-10 bits are displayed in the "obvious" manner. + The entire buffer is 16344.=37730 PDP-11 words long; + this corresponds to 8172.=17754 PDP-10 words. + The word 77777 PDP-11 words (17777 PDP-10 words) from the + origin of the video buffer is a special control register: + 3.2-2.9 15-13 Unused. + 2.8 12 0 => white on black, 1 => black on white. + 2.7-1.5 11-00 Scroll offset: video buffer wraps around; + the first word displayed is that 4* + PDP-11 bytes from the buffer origin. For + best results this should be a multiple + of 9 (for vertical scrolling). + The PDP-11 always sees a video buffer as beginning at its + location 60000 (byte address); which video buffer it is looking + at is controlled by the console register at location 164044 octal. + Thus the PDP-11 sees the scroll register as being at address + 157776 octal. + + See also the VIDSW symbolic system call. +Errors: + + 4 FILE NOT FOUND + Attempt to release a buffer not assigned to the job. + 7 DEVICE NOT READY + The PDP-11 is not ready. + 33 MEANINGLESS ARGS + Arg 1 is non-negative but not a valid video buffer number. + +VIDSW: set video switch + + arg 1 Video switch input number. + arg 2 Video switch output number. + + The video switch is set up so that the specified video + output will gobble bits from the specified video input. + + As of July 25, 1975, the only video inputs are TV + video buffers. These correspond to Tnm device numbers + as follows: + + Tnm Video Input Number + T47 24 T47 is used for console free buffer. + T52 1 When you type ESCS, is + T53 2 the video input number. The PDP-11 + T54 5 merely switches that input to your + T55 6 TV display, which is a video output. + T56 7 + T57 10 + T60 21 + T61 22 + T62 23 + + The possible video outputs are mostly TV displays, but also + the Tektronix hard-copy device which sits next to the XGP. + (The keyboard number may be relevant to use of the TVWHER + symbolic system call.) As of July 25, 1975: + + Video Output Keyboard Location of TV + 0 0 809 Fahlman, Holloway, Knight + 1 14 820 Minsky + 2 21 824 Rich, McDonald, deKleer + 3 6 815 Freiling, Perez, Ullman + 4 10 817 Jabari + 5 22 825 Freuder, Grossman, Purcell + 6 4 813 Hewitt + 7 5 814 Brown, McDermott, Sussman + 10 13 819 Goldstein, Woods + 11 17 822 Marr, Sandewall + 12 35 915 Cohen, Gosper, etc. + 13 34 913 Baisley, Greenblatt + 14 33 334 Lebel + 15 30 925 Jarvis, Moon + 16 31 918 Freeman + 17 32 920 Computer room, near PDP-11 + 20 3 812 Yvonne, Williams + 21 36 912 9th Floor Lounge + 22 37 914 Larson, Lebel, Mousouriss + 23 1 810 Kuipers + 27 Tektronix hard-copy output device. + +Errors: + + 7 DEVICE NOT READY + The PDP-11 is not ready. + +WHOLIN: examine and set TV who-line (ITS TV) + + arg 1 or + Must be a TV terminal if a . + arg 2 If present, used to set new who mode: + -1 No who-line. + 0 User who-line; migrates with TTY. + 1 User who-line; frozen on who job. + 4 System who-line. + arg 3 If present, used to set new who . + val 1 Old who mode. + val 2 Old who job. + + The TTY must be specified by a channel number and not + by 400000 + tty number if the variables are to be altered. + + See ITS TV. + +Errors: + + 1 NO SUCH DEVICE + No tty exists with the specified number. + 10 DEVICE NOT AVAILABLE + The PDP-11 which services the TV consoles is down. + 34 WRONG TYPE DEVICE + The specified tty was not a TV, or the specified + channel was not a or . + +WHYINT: Find out reason for second-word interrupt + + arg 1 channel # (or ) + + val 1 %WY code (see below) + val 2-n device-dependent + + This system call is the standard response to a second-word + (.IFPIR) interrupt. The first value returned is a code + number which indicates the type of device on the channel. + Usually a program will know what type of device is present, + because it only tries to use one type, but this value + is provided just in case. The codes are: + + 1 %WYTYI TTY input + 2 %WYTYO TTY output + 3 %WYSTI STY input + 4 %WYSTO STY output + 5 %WYNET (Arpa)NET + 6 %WYCHA CHAosnet + 7 %WYTCP TCP Internet + 10 %WYUBI KS10 Unibus interrupt (UBI device) + + The device-dependent values returned are: + + For a TTY input channel: + val 1 %WYTYI + val 2 character typed. Reading characters this way + does not interfere with later reading them via + normal IOT. This allows characters to be processed + both as interrupt characters at the time they are + typed, and as normal input. The call fails to + skip if there are no more interrupt characters. + The program should keep calling WHYINT until + it fails to skip, then DISMIS the interrupt. + + For a TTY output channel: + val 1 %WYTYO + val 2 bit mask of reasons. The only reason that presently + exists is: + 4.9 --MORE-- interrupt. (Typeout reached + the bottom of the screen.) + + For a STY input channel: + val 1 %WYSTI + + For a STY output channel: + val 1 %WYSTO + + For a UBI channel: + val 1 %WYUBI + val 2 Count of all interrupts ever signalled at the + given interrupt address. + + For a NET (Arpanet NCP) channel: + val 1 %WYNET + val 2 Sign bit 1 if "network interrupt" received. + Right Half Socket state: + 0 %NSCLS Connection closed. + 1 %NSLSN Listening for RFC. + 2 %NSRFC RFC received while listening. + 3 %NSRCL CLS received while in %NSRFC state. + 4 %NSRFS RFC sent. + 5 %NSOPN Connection open. + 6 %NSRFN RFNM wait on write link. + 7 %NSCLW CLS sent, waiting for matching CLS. + 10 %NSCLI CLS received but input still available. + 11 %NSINP Input available. + val 3 Number of bytes of input available (if input channel). + Number of bytes free in output buffer (if output channel.) + val 4 Close reason. Only valid if val 2 is %NSCLS. + 0 %NCNTO Never opened. + 1 %NCUSR Closed by user. + 2 %NCFRN Closed by foreign host. + 3 %NCRST Foreign host reset itself. + 4 %NCDED Foreign host dead. + 5 %NCINC Incomplete transmission. + 6 %NCBYT Byte size mismatch. + 7 %NCNCP Local NCP went down (local host dead). + 10 %NCRFS Request for Connection rejected by fgn host. + + For a TCP channel: + val 1 %WYTCP + val 2 state code (see below) + val 3 input: # bytes avail, output: # bytes free in buffer + val 4 Close reason (same values/meanings as for NET. See + definition of %NX== in SYSTEM;BITS > if curious.) + + The TCP state codes are defined in SYSTEM;BITS > at %NT==: + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out + %NTCLS==:0 ; - - Closed (reason available from WHYINT) + %NTLSN==:1 ; - - Listening for a SYN + %NTSYR==:2 ; - - SYN received + %NTCLU==:3 ; + ? Being closed by fgn host + %NTSYN==:4 ; - - SYN sent, waiting for response + %NTOPN==:5 ; *I *O Open + %NTWRT==:6 ; ? *O Output buffer full + %NTCLX==:7 ; ? + Being closed by user + %NTCLI==:10 ; +I ? Closing/closed, input still available + %NTINP==:11 ; *I ? Open, input available + + + Chaosnet: + val 1 - %WYCHA + val 2 - state + val 3 - number of packets queued (receive,,transmit) + val 4 - window size (receive,,transmit) + val 5 - input channel#,,output channel# (-1 if not open or I/O-pushed) + + LH(val 3) is the number of packets available to input IOT. + This is different from the number of received packets + if some are out of order. This is increased by 1 if + there is a partially-read buffer available to SIOT; + this packet is not available to PKTIOT. This is zero + if the connection is direct-connected to a STY. + + RH(val 3) is the number of packet slots available in the output + window, i.e. the window size minus the number of packets + which have been transmitted by output IOT but which have + not yet been received and acknowledged by the foreign + host. + + The state codes are: + + %CSCLS Closed + %CSLSN Listen + %CSRFC RFC-received + %CSRFS RFC-sent + %CSOPN Open + %CSLOS Broken by receipt of "LOS" packet. + %CSINC Broken by incomplete transmission (no acknowledge + for a long time) + +Errors: + +34 WRONG TYPE DEVICE + The specified channel supposedly never gives interrupts. + +XGPIM: xerox graphic printer image output + + arg 1 Address of a word with the number of pages of + data in the left half and the number of the first + data page in right half. + This word must be in writable memory. + + Bits are shoved out onto the XGP. + + I wonder what the precise semantics of this kludge are? diff --git a/sysdoc/arcdev.format b/sysdoc/arcdev.format new file mode 100644 index 0000000..c908a3e --- /dev/null +++ b/sysdoc/arcdev.format @@ -0,0 +1,101 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +;Archive device format: + +;The first page of an archive device file is its directory. +;The remaining pages are data. + +;The directory may not even be looked at unless the archive is "locked". +.SEE LOCK,UNLOCK ;Only one ARCDEV can lock a given archive at a time. +;Shuffling the directory should not be done in place, even when it is locked. +;Instead, use DIRGET to make a copy and DIRPUT to store the copy back in. +;When a file is open, the address of its data area is remembered in FILADR. +;The data area of a file never moves, and the file can be open only in one +;direction at a time, so reading or writing the data area requires no interlocking. + +;The format of the archive device directory is approximately that of +;an I.T.S. UFD. The differences are: + +;In the fixed header, word 0 (UDESCP) contains SIXBIT /ARC1!!/ +;Word 1 points to the beginning of the name area, as in UFDs. +;Word 2 points to the end of the data area. +;Word 3 is used to tell when the archive needs to be cleaned +; because it is being touched for the first time since the system came up. +;Word 4 contains what is supposed to be the creation date of the archive. +; Since locking the archive device clobbers the creation date, +; we store it here so we can restore it after clobbering it. +;Word 5 similarly stores the dumped bit. + +;There is nothing analogous to the "descriptors" in a disk UFD. + + ;Random info in UFD +UDESCP==0 ;SIXBIT /ARC1!!/ +UDNAMP==1 ;Address in directory of first filename block. +UDDATP==2 ;Address of first free word past data area of last file. +UDINIT==3 ;Time of startup of last run of system during which this + ;archive was cleaned (ARCCLN). If not same as startup time + ;of this run of the system, we must do ARCCLN. +UDCRDT==4 ;This word holds what ought to be the creation date + ;of the archive device file itself. + ;0 => this archive antedates the UDCRDT word, in which + ;case it gets set from today's date. +UDDMPB==5 ;This is like UDCRDT but stores the dumped bit. + +UDNMIN==10 ;If UDNAMP is less than this, there is no room for another filename block. + +;In each filename block, the UNFN1, UNFN2, UNDATE and UNREF words are +;just as in UFDs. The UNRNDM word is slightly different: + +LUNBLK==5 ;Number of words in each filename block. +UNFN1==0 ;First file name. +UNFN2==1 ;Second file name. +UNRNDM==2 ;All kinds of random info: + ;The RH is the address in the file of the start of the file's data area header. + ;The LH contains these bits: + UNWRIT==4 ;Open for writing. Not actually maintained in the archive, + ;Just reflected to the user when he reads ARC:.FILE. (DIR). + UNCDEL==20 ;Delete this file when it is closed. + UNIGFL==24 ;Bits to ignore file + UNWRDC==301200,, ;Word count of last block mod 2000. + ;This information really lives in UHWCNT, and is just reflected + ;here when the user reads the image directory. +UNDATE==3 ;Date and time file last modified. + UNTIM==2200,, ;Compacted time of creation + UNYMD==222000,, ;Y,M,D of creation + UNMON==270400,, ;Month + UNDAY==220500,, ;Day + UNYRB==330700,, ;Year +UNREF==4 ;Reference date same as left half of undate + UNREFD==222000,, ;Reference date byte pointer + UNAUTH==111100,, ;MFD index of author, all 1=> no directory. + UNBYTE==001100,, ;File byte size and length info. + ;LET S=BITS PER BYTE, C=COUNT OF UNUSED BYTES IN LAST WD + ;400+100xS+C S=1 TO 3 C=0 TO 35. + ;200+20xS+C S=4 TO 7 C=0 TO 8 + ;44+4xS+C S=8 TO 18. C=0 TO 3 + ;44-S S=19. TO 36. C=0 + ;NOTE THAT OLD FILES HAVE UNBYTE=0 => S=36. + + +;The data of a file starts with two words of header information: +UHWCNT==0 ;Total length of the file's data, including header, in words. +UHREFC==1 ;RH: Number of archives using the file, in either direction. + ;LH: -1 if file open for writing. +UHNAMP==2 ;Unused +UHBLEN==3 ;Length of this header; offset to 1st actual data word. + diff --git a/sysdoc/binfmt.101 b/sysdoc/binfmt.101 new file mode 100644 index 0000000..de381da --- /dev/null +++ b/sysdoc/binfmt.101 @@ -0,0 +1,289 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +BINARY FILE FORMATS + +This file documents the formats of absolute binary program +files on ITS, as understood by the LOAD symbolic system +call. + +There are two different file formats: "SBLK" files, and +"PDUMP" files. Each has its advantages. An SBLK file is +easier to write, when that must be done "by hand"; it is +usually smaller than a PDUMP file containing the same +information. On the other hand, a PDUMP file can record +the accessibility of the pages dumped, including the fact +that some pages may not exist, and when it is loaded such +pages will be left nonexistent; an SBLK file would lose +that information, and when loaded would fill in all gaps in +the page map, which may be very slow. On the third hand, a +PDUMP file loads a whole page or it loads nothing in the +page, while an SBLK file may specify contents for some +words in a page but leave the others unmentioned; thus, +when a file is to be merge-loaded an SBLK file may be +advantageous. + + +A. SBLK FILES + +An SBLK file contains one or more blocks, each of which +specifies the data to be loaded into one or more +consecutive words of core. + + 1. RIM10 LOADER + +The file begins with an essentially arbitrary prologue, +whose end is marked by a word containing a JRST 1 +instruction. The intention of the prologue is to contain +a RIM10-format program which will load the rest of the SBLK +file, assuming that it has been punched on paper tape and +read in using KA-10 "read-in" mode (The one normally used +happens to end with a JRST 1). However, if that mode of +operation is not desired, the JRST 1 may be the first word +of the SBLK file. In any case, the prologue's first word +should be nonzero, so that the file will not appear to be a +PDUMP file. + + 2. SIMPLE BLOCKS + +After the JRST 1 come one or more "simple blocks" (whence +comes "SBLK file"). Each simple block starts with an +AOBJN-pointer to the range of core to be loaded; +explicitly, -,,. It +is inadvisable for any block to load more than 1K, or for a +block's range to wrap around from -1 to 0. After the +range-word come as many words of data as the range-word +specifies. The simple block is completed by the checksum +word, which is computed as follows: + + (DO ((I 0 (1+ I)) (ACCUM 0)) + ((> I NUMBER-OF-DATA-WORDS) ACCUM) + (SETQ ACCUM (+ (WORD I) (ROT ACCUM 1)))) + +where the range-word is treaded as (WORD 0). All SBLK +files MUST be written with correct checksums, but it is not +essential for all readers of SBLK files to check them +(though it is better to do so). + + 3. START ADDRESS + +A simple block always starts with a negative word. +A positive word seen when the beginning of another simple +block was expected, indicates that there are no more simple +blocks in the file. The positive word itself is the "start +instruction" of the file, and should be a jump of some sort. +0 indicates that there is no starting address. + + Other Information Blocks + +After the start instruction come may come several different +blocks of additional information. Included are the symbol +table, the undefined-symbol-table, and the random-info-block. +Any or all of these may be absent in a given file. +Each of these are in the format of an Simple-block, including +the checksum at the end of each block, which must be present +and correct. + + 4. SYMBOL TABLE + +The symbol table is divided arbitrarily into sections. +Each section looks exactly like a simple block, with zero +as the address to be loaded. The first word is +-,,0; it is followed by that many +words of data, followed by a checksum. After each section +may come another section; encountering the duplicate start +instruction (see 5, below) indicates the nonexistence of +further sections. + +The symbol table itself is obtained by stripping out just +the data words of the symbol table sections. + +See DDT ORDER for information on the contents of the symbol +table. + + 5. THE UNDEFINED SYMBOL TABLE + + +Each section of DDT undefined symbol table starts with a +word containing -<# of data words>,,1 (not 0!) after which +come data words and a checksum. + +The two types of symbol table sections may be interspersed +arbitrarily in the file. + + 6. Indirect Symbol Table Pointer + +An indirect file pointer looks just like a symbol table +section except that its data consists of four filenames. +It starts with a word -4,,2 (2 indicates this is an +indirect pointer), followed by the device, fn1, fn2 and +sname (each as a word of sixbit), followed by the +checksum. A file may contain only one such indirect +pointer, and it must be the last block present before the +duplicate start instruction which ends the file. + + 7. MISCELLANEOUS INFORMATION BLOCKS + +A Miscellaneous Info Block looks like a symbol table block +except it consists of sub-blocks of various miscellaneous +info, and begins with a word -<# wds in block>,,3 (the 3 +indicates it is a Misc Info block). If there are more than +one of these blocks, the division is not significant, and on +loading into DDT they may be merged. The sub-blocks look +slightly like SBLK's but are entirely contained within one +or more SBLK's and are *NOT* followed by individual +checksums. Only the top-level SBLK's have checksums. + +A Misc Info block consists of sub-blocks of the following form: +-<# of words>,, + + +The only currently defined sub-block type is type 1, + +Assembly Info: Sub-block type 1 + -<# of words (normally 6)>,,1 + + + + + + + + There may only be one of these blocks in a file. It + is created when MIDAS produces the file. + +------ + +Debugging info: + -<# of words>,,2 + + + This is intended for taking crash dumps and the like to + save various information that a person debugging it might + find useful. It will not be found in most files; a + separate debugging dump command will be used to generate + it. + + 8. THE DUPLICATE START INSTRUCTION + +This word is a second copy of the start instruction. +It exists to terminate the symbol table, or indicate the +absence of one. + +B. PDUMP FILES. + + 1. INITIAL ZERO + +The first word of a PDUMP file is always zero. This is +to make it easy to distinguish PDUMP files from SBLK ones. + + 2. PAGE MAP + +The next 256 words of the file are the file's "page map". +The remaining words in the first page of the file are +unused. + +The way a PDUMP file is loaded into a job is that each +of the job's page slots is treated as specified by the +corresponding word in the PDUMP file's page map. +If the page map word is zero, nothing is done to that +page slot in the job. Otherwise, the page map word is +decoded to determine how to obtain the page +to put there. + + a. Page-map - English Dictionary + + Bit Meaning + + 400000,, This is an absolute page. + 200000,, The job must not share with the + file; the job's page should be + set up using %CBCPY. Note that + %CBCPY will be used in any case + if the page is writeable. + 100000,, This page should be shared with + some other page in the job's map. + Should not be present with 400000,,. + 400000 This page should be writeable. + 200000 This page should be readable. + 777 If 400000,, is set, the bottom + bits contain the number of the + page in the system. If 100000,, + is set, they contain the number of + the other page in the job's map + which is to be shared. + These bits are ignored otherwise. + +Bits not mentioned should be ignored when reading, +and written as zero. + +If neither 400000,, nor 100000,, is set, but either +200000 or 400000 is set, a data page taken from +the PDUMP file itself is put in the job's page slot. +If neither 200000,, nor 400000 is set, the job actually +shares memory with the file; thus, all jobs into +which the file is loaded will share that page. +Otherwise, the file page is copied and the copy is +put in the job's page slot. + + b. English - Page-map Dictionary + +The meaningful word-patterns appear below. + is either 200000 for read-only, or 600000 +for read-write. A star indicates a type of map-word +that requires a corresponding data page in the file. + + No page 0 + * Pure page 200000 + * Impure page 600000 + * Unshared pure page 200000,,200000 + Absolute page 400000,, + Note that only PDP6 pages may be writeable. + A sharing of another page in the job + 100000,, + This is to be used when a single data + page is to be loaded into two page slots + (shared). The lower page slot should + specify the page as either pure, impure, + or unshared impure. The remaining page + slot(s) should specify sharing with the first. + + 3. AC's + +Since the AC's are not part of any page, they would not +be saved in one of the data pages. To compensate for +this, they are saved in locations 1000 - 1017 in the +first block of the file. + + 4. DATA PAGES + +When page map words specify data pages, those data pages +follow the page-map page. There must be exactly as many +data pages as there are map entries that require one, and +the correspondence of data pages to such map entries is +made by order in the file or in the map. + + 5. START INSTRUCTION AND SYMBOL TABLE + +After the last data page come a start instruction, a symbol +table, and a duplicate start instruction, just as in an +SBLK file. + + +;;; Local Modes: ::: +;;; Mode:TEXT ::: +;;; Fill Column:60 ::: diff --git a/sysdoc/bugits.list b/sysdoc/bugits.list new file mode 100644 index 0000000..f349fec --- /dev/null +++ b/sysdoc/bugits.list @@ -0,0 +1,54 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +AKR +AlanX +CBFX +CENT +CSTACY +DCB +DCP +DPH +ED +EHL +GLS +Gren +GSB +gumby +JINX +JNC +JTW +KLH +KLOTZ +(KWH AI) +Maeda +Mly +MMcM +Moon-Junk@Symbolics +MP +PDL@xx +PGS +RDZ +RMS +ROLY +RPK +SAJ +Swenson@Multics +Tim +;Stockholm U Computer Club STACKEN +ITS_bugs%QZCOM.MAILNET@MULTICS +[SYSDOC;ITS BUGS] diff --git a/sysdoc/chaord.57 b/sysdoc/chaord.57 new file mode 100644 index 0000000..4de70c0 --- /dev/null +++ b/sysdoc/chaord.57 @@ -0,0 +1,2201 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +;skip 1 +;list +;lftmar 350 +;kset 20fg + + CHAOS ORDER + + **** DRAFT **** +NOTES: +Work more on dynamic flow control, see end of that section. +Data grams seem to have a bug that the two parties can never + agree on whether they both agree that it really happened. Am I losing? +Flush cruft at end? +Add QES, which is the same as RFC but implies you expect ANS? Any point to it? +For ITS, a flavor of listening which queues RFCs coming in while index is busy, + or otherwise avoids that timing problem. +------- +This table of contents has not been kept up to date ******* + + Goals + Non-goals + Hardware Assumptions and Constraints + +User appearance + + Connections + Contact Names + ITS implementation + Lisp Machine implementation + +Network Control Program + + Packets + Hosts attached to more than one subnet + Subnet and Host numbers + Packet numbers + Indices + Routing + Operations + Table of packet field use vs opcode + Flow and Error Control + Dynamic Window-size Adjustment + Uniquization + Media Handlers + Buffers + ITS System Calls + +Comparison with LCSNET + Principle differences + High priority data packets, interrupts, and flushing + Data grams + Multiple messages per packet + Checksums in the packet + Host-independent user-level protocols + Very Small Hosts + +Transmission Media + + Ethernet + TEN11 Interface + DL10 & DTE20 + Asynchronous line + +Higher-Level Protocols + + Telnet + File Access + Mail + Locate-named-service + +>Goals + +High speed communication between processes running in various local machines. +By "high speed", I mean much faster than the Arpanet. +At least comparable to TU20 magtape (30000 characters/second), +about 10 times the speed of the Arpanet. +(30-50 kcps seems to be the measured preformance, with ITS, 10/2/78) + +No undetected errors in data transmission. + +Not to depend on a particular medium. (However, we are compromising +by picking a fixed packet size. The simplicity and efficiency are worth it.) + +Simple enough to put in small pdp11's. Also, simple to the user. + +As much power as the Arpanet but, hopefully, a lot less hair. + +Work well for both "telnet" and "file transfer." + +The initial implementation in ITS should have the "in-system" part as +small and simple as possible. This includes no per-host tables +in the NCP, which allows large nets and easy reconfiguration. +There is, of course, a host-name to address translation table +used by "user" programs. The NCP has to have a per-subnet table +which remembers where the bridge(s) to that subnet from +the local subnet are. + +The acknowledgement protocol must be designed not to limit +performance. + +Statistical flow control ((see below.)) + +Avoid bottlenecks such as the Arpanet "control link". Be immune +to transmission medium failures which cause deleted, duplicated, +or out-of-order packets. + + +>Non-goals + +Byte sizes other than 8 bits. (pdp10 binary transmission should +be part of a user-level file-transfer/ML-device protocol.) + +Compatibility with the Arpanet. + +Substituting for TEN11 interface functions such as running +the AI TV11 and XGP. + +Automatic routing will be deferred. Initially the routing +tables will be assembled into the programs. A host needs +one routing table for each subnet it is connected to +(or one for each network interface it possesses.) + + +>Hardware Assumptions and Constraints + +Transmission is physically in "packets" which have headers, rather +than in, e.g., continuous streams. + +The chaos net (ether) interface limits the physical length +of a packet to 4097 bits including overhead bits. The net result +is the maximum number of data bytes (excluding the header +defined by this protocol) in any packet is 488. This limitation +will be extended to the whole network (to keep things simple). +However some provision will be made for a possible network-wide +packet-size expansion, which has already been done once. + +All transmission media will be assumed to be highly-reliable +but not perfect; "perfect" reliability will be assured by having +the two ends of a connection use an acknowledgement protocol +which detects lost messages. Transmission media are required +to lose any messages that they don't deliver intact. (I.e. there +must be hardware checksums.) + +>User appearance + +The network allows user processes in various machines to +communicate with each other in various ways, for instance, +in imitation of a terminal, or in imitation of a disk file +system. These facilities are built on top of the basic +capability to send "packets" (a header plus some data in the +form of 8-bit bytes) through the network. The network undertakes +never to lose or garble any packets, except when the connection +is cut off entirely. + +This document defines the low-level, "in-system" part of the +protocol. On top of this, special programs (running in user-mode) +will implement the higher-level protocol that the general user +program sees. These protocols and programs won't be discussed +further in this document, but remember that the strange packet +formats and so forth are not seen by most user programs. + +>>Connections + +When two processes wish to communicate, they establish a +connection between them. This connection allows two streams +of packets to flow, one in each direction. [Explain why +connections should be bi-directional rather than uni-directional. +Basically that's what you always want, and it makes things simpler.] + +Connections are essentially the only facility provided by the network. +However, when first establishing the connection it is necessary +for the two processes to contact each other, and make each +other known to their respective operating systems. In addition, +it is often the case (in the usual user-server situation) that +one of the processes does not exist beforehand, but is to be created +and made to run a specified program. + +>>Contact Names + +The way we choose to implement contacting is to say that one process +is always a "user" and one process is always a "server". The server +has some "contact name" to which it "listens". The user requests its +operating system to connect it to a specified contact name at a +specified host. If a process at that host is listening to that +contact name, the two are connected. If no one is listening to that +contact name, the operating system must create a server process +which will load itself with the appropriate program and connect up. + +Discovering which host to connect to to obtain a given service +is an issue for higher-level protocols. It will not be dealt +with at all initially (that is, there will be a table of host +names and numbers and the user will have to enter the name.) + +Once the connection has been established, there is no more need for +the contact name, and it is discarded. Indeed, often the contact name +is simply the name of a network protocol (such as "telnet") and several +users may want to have connections to that service at the same time, +so contact names must be "reusable." (In the other common case, the +contact name will be a "gensym".) + +As far as the operating systems involved are concerned, contact names +are simply arbitrary ascii strings defined by user programs. It is +expected that the various higher-level protocols will define standard +contact names; for instance, to get the telnet protocol one would +connect to "telnet"; to get the file transfer protocol one would +connect to "file-transfer". If a machine receives a request to connect +to a contact name which no one is currently listening to, a server +process must be created and made to execute a program which decides, +from the contact name, what server program to load and execute, or else +to refuse the request for connection. + +Contact names have no relation to file names; they are simply +a device for introducing two processes to each other. If one was +using the network to transfer a file, one would first contact +the file transfer server at the appropriate host, then send a +packet containing the name of the file to be accessed. + + +>>ITS system calls + +Ordinary user programs will not access the network directly; they will +go indirectly through a job-device or sty-type program which will +use a higher-level protocol to make the network look like what the +user wants, the traditional things being a terminal and a disk +file system. + +Since these intermediate user-mode programs for using the network will +exist, there is no reason for the interface to the low level network +provided by the system to look at all like a standard device. Instead, +it will be designed solely for simplicity and ease of implementation, +and for a certain degree of efficiency. This interface will be +described after the interface between Network Control Programs in +different machines (the low-level protocol) is described. + +At some future time the intermediate programs might get moved into the +system for reasons of efficiency, but that should not be allowed to +complicate the initial implementation. + +As of October 1978, the opening and closing of connections is completely +device-dependent, as are "status"-type operations, however byte-string +I/O is supported in a fashion which is device-independent except when +errors occur, which is handy in several programs. Packet-level, +device-dependent I/O is also supported. + +The .INSRT-able file of routines NETWRK, will be augmented to handle +both the Chaos net and the Arpa net. + + +>>Lisp Machine implementation + +In the case of the Lisp Machine, the only distinction between user +programs and system programs is who maintains and documents them, +and how carefully. + +(More?) + +>Network Control Program + +This is the part of the operating system(s) that implements the network +(obviously). + +>>Packets + +The NCP's operate by exchanging packets. A packet consists of a +header containing control information, and zero or more 8-bit bytes of +data. Hardware restrictions of the Chaos net interface +restrict the maximum length of a packet to 253 16-bit words. In fact, +we will limit it to 252 words (to make packet buffers in pdp10's be 128 +words including two overhead words). Again for the convenience of +pdp10's, the header should be an even number of 16-bit words. + +In this section the packets will be described as they look to a pdp11. +They look the same inside a Lisp Machine, since the byte structure is the +same. Inside a pdp10, packets are stored with two 16-bit words +left-adjusted in each pdp10 word. Additionally, the bytes in the data +portion of the packet are swapped so as to put them in pdp10 standard +order. pdp11's that act as network interfaces for pdp10's will be required +to do this byte swapping since they're likely to have more time available +than the 10 to do it in, and can also do it faster, having a special +instruction for it. pdp10's that communicate directly to the network will +have hardware assistance for byte reshuffling in their interfaces. See the +transmission media section for how packets are encapsulated during +transmission through the various media. + +The header is 8 16-bit words and contains the following fields: + + ----------------------- + |opcode(8) | unused(8)| + ----------------------- + |fc(4) | nbytes(12) | + ----------------------- + | destination host # | + ----------------------- + | destination index | + ----------------------- + | source host # | + ----------------------- + | source index | + ----------------------- + | packet # | + ----------------------- + | ack packet # | + ----------------------- + + opcode - tells the receiver of the packet how to interpret + it. See the Operations section below. + This is 8 bits long. The 128 opcodes with high + order bit =0 are for NCP use. The 128 with high + order bit =1 are for user-program use. + + unused 8 bits reserved for future use. + + fc - forwarding count. 4 bits which count the number of times this + packet has been forwarded by bridges. Initially this field + is always generated as zero. Each bridge increments it; + if it overflows, there is assumed to be a loop + and the packet is discarded. + + nbytes - the number of 8-bit bytes of data in the data part. + The maximum value of nbytes is 488. The minimum is 0. + This is 12 bits long to allow for 4K-bit packets. + (Actually 12 bits is enough for up to 32K-bit packets.) + + destination host # + This is divided into two 8-bit fields. The high + byte specifies which subnet. The low byte specifies + which host on that subnet, and (on ethernet subnets) + is identical to the hardware host number. Neither + field may be zero in a valid host number. + + destination index - index for this connection assigned by the + destination host's NCP. + + source host # - see destination host #. + + source index - index for this connection assigned by the + source host's NCP. + + packet # - an ascending reference number used in error and + flow control (see below). + + ack packet # - used in error and flow control (see below.) + +>>Hosts attached to more than one subnet + +(This also applies to hosts with more than one interface to +the same subnet, if there ever are any.) + +Such hosts ought to act as bridges. That is, if a packet +is received which is not addressed to this host, it should +be sent back out, using this host's routing tables. The +forwarding count should be used to prevent infinite loops +in the event of inconsistent forwarding tables in two bridges. + +It is undesirable for a host to have more than one number. +So a host connected to multiple subnets should choose one +subnet as its "home", which is the address which is advertised +as that host. The host's other network connections are +un-named bridges. In some causes it may be preferable +not to pick a "home" subnet; instead, one invents a new +private subnet which only has that one host on it, +and all the host's network connections act as bridges +to that subnet (also to each other). + +The routing should be set up so that packets destined for such +a host from a subnet on which it has an interface choose that +interface as the bridge to that host, so that in fact data flows +the same way as if the host had more than one number and the +host-name to host-number lookup magically chose the right number. + + +>>Subnet and host numbers. + +Subnet numbers are arbitrary. Host numbers are assigned according to +position on the cable, as explained (elsewhere). + +These numbers may be found in the file SYSENG;HOSTS > + +The physical cable address of a host should include both its subnet number +and its host number (prior to October 1978 the subnet field of a physical +address was always 0). This allows the physical address to be used as +a unique machine identifier and makes it possible for a host to discover +its full 16-bit host address without prior knowledge. + +>>Packet numbers + +Each time the sending user puts another packet into the network, this +number is increased by one. (These numbers are independent for the +two directions of a connection.) The receiver uses these numbers to +get the packets into order and ensure that there are no duplications +nor omissions. The packet numbers are 16 bits and wrap around to zero +when they overflow. When the connection is first opened, an initial +value for the packet# is established. If it was 0, then the packet# +of the first data packet would be 1. + +Packet #'s should be compared modulo 2**16. On pdp11's, use + + CMP A,B + BMI (BMI rather than BLT or BLO) + +On pdp10's, use + + SUB A,B + TRNE A,100000 (rather than CAMGE A,B) + JRST + +On Lisp machines, use + + (AND (BITTEST 100000 (- A B)) + ) [rather than (AND (< A B) ...)] + +>>Indices + +Each connection has two indices assigned to it, one at each end. Each +index is an arbitrary 16-bit number assigned by the NCP at its end; usually +it is an index into that NCP's tables. Indices are required to be +non-zero. For maximum simplicity, all packets include both indices. The +receiver of a packet uses the destination index to find out who to give the +packet to. Generally the source index is used only for error checking, but +when a connection is first opened the source index has to be saved and used +as the destination index in future packets in the reverse direction. + +To prevent packets somehow left over from old connections from +interfering with new connections, we require that a certain time +elapse between successive connections between the same pair of hosts +with the same index numbers at each end, this time to be longer than +the maximum time a packet is reasonably expected to sit around in +the network somewhere (the maximum transit time through all bridges, etc.) +This requirement is implemented by making part of the index number be +a "uniquizer"; when a host reuses a slot in its tables, it increments +the uniquizer, so that the index number for that slot is not the same +as it was previously. Then if the uniquizer field is sufficiently wide, +and the rate of creation of connections (actually the rate of allocation +of indices) is sufficiently low, the requirement will be satisfied. +For the kind of network we're talking about, the time is a few tens of +seconds, and the uniquizer need only be a few bits wide. It is up +to each host how wide it makes the uniquizer, depending on how big +it wants its tables to be. It is best if table slots are also +allocated circularly, so that slots are reused at the minimum possible rate. + +The uniquizer also serves to "more or less" uniquely identify connections +so that duplicate copies of a Request For Connection (RFC) packet +can be identified and discarded. + +A user process's "capability" or "channel" to a connection, used by it +to ask the NCP to operate on that connection, simply contains the +appropriate index. + +Associated with each index the NCP has a "state", the host # and index +# of the other end of the connection, some read buffers and associated +variables, including a current packet #, and some write buffers and +associated variables, again including a current packet #. + +The "state" can be Closed (no connection or other activity currently +associated with this index), Open (this index has a connection to +another index at another machine), RFC-sent (requested another machine +for a connection, but no answer yet), Listen (listening for a request +for connection to a certain contact name), Broken (connection closed +abnormally by network or machine lossage), and RFC-received (waiting +for a server process to get going and pick up a request for connection +that came in). + + +>>Routing + +This section is a place-holder. Initially routing will be kludged with +a fixed table. Once the network is set up automatic routing will +be put in. + +The routing decision consists of looking at the destination subnet +field of a packet and deciding which interface (on a multi-interface +host) to transmit it on, i.e. what is the best route to that subnet. +In addition, if the destination is not on a subnet to which there +is a direct interface, one must determine what is the host number of +the bridge it should be sent to. + +It also involves recognizing packets which are destined to the +current host and receiving them. + + +The following is not yet implemented. It is an initial plan for routing. + +Gaetways will broadcast RUT packets periodically, perhaps once a minute. +The destination field is zero and the source field is the address of the +gateway on the net on which the packet is being broadcasted. The data field +contains a bunch of 16-bit words, divided into fields in the same way as +a host address. The subnet field of each word contains the number of a +subnet which this gateway is able to reach. The host field of each word +contains the hop count, which is 0 if the gateway is physically connected +to the specified (non-ether) subnet, 1 if the gateway is connected to +the specified (ether) subnet, or 1+ the hop count of the closer gateway +if this gateway indirects through another. The hop counts allow the gateways +to avoid loops when there are multiple paths; they may not need to be +looked at by non-gateway hosts. + +Each host maintains a routing table, with entries keyed by subnet number. +For subnets to which the host is physically connected, the entry points +to the host's physical interface. For subnets which the host knows how to +get to because it has been informed of a gateway via a RUT packet, the entry +contains the gateway's host address, the hop count, and the time that this +route was last confirmed by a RUT packet. If the NCP remembers only one +route to a given subnet, it wants to remember the one with the smallest +hop count unless that one is more than (say) 5 minutes old. If the NCP +remembers all the routes, it should stop using ones which are more than +(say) 5 minutes old. It is not clear that it should ever use one with +a hop count larger than the minimum. The reason for the time-out is to +avoid forever losing packets by sending to a gateway which has gone down. +If there are no gateways up and known about by the NCP which reach a given +host, it will look like that host is down. + +>>Operations + +This section tells what the values of the opcode field in a packet are, and +how an NCP responds to each one. + +1 RFC - Request for Connection + +This message is sent from user to server in order to open a +connection. The data contains the contact name. Actually, if +the data contains a space, the characters before the space are +the contact name and the characters after the space are "arguments". +This is done so that simple transactions can work (see below). + +The destination index is zero, because it is not known yet. The +responses are: + + OPN, if a server process is found or created that wishes + to accept the request and open up a connection. + + CLS, if the connection cannot be opened. The data field + contains an ascii explanation of why not. + + ANS, if a simple transaction is occuring. The data contains + the answer, and no connection is ever created. + + FWD, if there is no server process at this host, but there + might be a suitable one some place else. + +There may also be no response, if the RFC was lost in the network, or +the destination host is down, or the reply was lost in the network. + +To increase the reliability of establishment of connections, RFC's and +OPN's are retransmitted, just as data packets are, until a response is +elicited. CLS, ANS, and FWD cannot be retransmitted because we take +the position that retransmission is implemented by something associated +with a connection, and these packets are not sent by connections (and are +not acknowledged). OPN is sent by a connection, and RFC is sent by +a sort of embryonic connection which continues to exist while it awaits +an OPN or other reply. + +Since RFC is retransmitted, it is the responsibility of the NCP to detect +and discard duplicates. When an RFC is received, all existing connections +in the OPN or RFC-RECEIVED state, and all "pending" RFC's which are awaiting +servers to connect to them (if the NCP has such), should be checked to see +if they have the same source host and index number as the received RFC. +If so, the RFC is a duplicate and should be ignored. Note that connections +in the LOST, CLOSED, or BROKEN states should not be checked, since these +are not really connections as far as the foreign host is concerned, but simply +ghosts of connections left around to remember error status for their controlling +user programn. + +Since the response to RFC is not guaranteed, processes issueing RFC's +must have timeouts. In most implementations the normal host-down timeout +will suffice. + +[We should discuss why the special kludgery for control packets, rather +than using the regular connection mechanism to assure reliable transmission +of control packets, as the Arpanet does. Also a discussion of which control +operations inherently need reliability and which inherently don't, and +why that should be so.] + +The packet # field contains the first packet # that will be assigned +to data transmitted from the user process, minus one modulo 2**16. In +the simplest case, this can be zero, and the first packet sent will be +packet # 1. One might also imagine uniquizing the packet numbers +as an extra error check, but this should not be necessary, because +the indices are uniquized, and connections must be explicitly agreed +to by each end before data can flow. + + +2 OPN - Connection Open + +This is the positive acknowledgement to RFC. The source index field +conveys the acknowledger's connection index to the requester. The packet # +field contains the first packet # that will be assigned to data transmitted +from the server process, minus one modulo 2**16. The data portion of this +packet is the same as a STS packet (see below), and mainly serves to convey +the server's window-size to the user. The ack packet # field must contain +the usual value, i.e. the number that was sent in the packet # field of the RFC. +The receipt and ack in the OPN serve primarily to terminate retransmission of the RFC. + +When an OPN is received, a STS is sent in response, telling the server +the user's window-size. The exchange of an OPN and a STS also serves +as acknowledgement to each side that the other believes the connection +is open. No data packets may be committed to the network until after +this has occurred. If this rule was not followed, and packets happened +to get out of order, a data packet could arrive before the connection +was open and cause a LOS. + +To improve the reliability of establishment of connections, OPN's are +retransmitted, just as data packets are, until receipted (and +acknowledged) by STS. Because of this retransmission, the NCP must +detect and discard duplicate OPN's. If an OPN is received for a connection +which exists and is not in the RFC-SENT state, the OPN should be ignored +and no LOS should be sent. + +OPN's contain 16-bit data and are not byte-swapped. See below under opcode 300. + +3 CLS - Connection Closed + +CLS is the negative response to RFC. It indicates that no server was +listening to the contact name, and one couldn't be created, or for +some reason the server didn't feel like accepting this request for a +connection, or the destination NCP was unable to complete the +connection (e.g. connection table full.) The destination index will +be the source index of the RFC. The source index will be zero because +the NCP did not put this connection into its tables. The data bytes, +if there are any, contain an ascii explanation. + +CLS is also used to close a connection after it has been open for a while. +In the Arpanet, the NCP undertakes not to close the connection when the +user requests it, but waits until all data transfer has completed. This is +a source of extra complexity, since data transfer may be hung up, there +have to be timeouts, there have to be connections waiting to be closed +which aren't owned by any user, etc. It seems simpler to make CLS take +effect immediately, and let the user processes assure that data transfer +has been completed. Note that telnet-like applications don't need it, and +ftp-like applications have to have it separately from closing anyway. + +Since there is no error recovery or retransmission mechanism for CLS, +the use of CLS is necessarily optional. However, it is desirable to +send a CLS when possible to decrease user confusion. + +4 FWD - forward a request for connection + +This is a response to RFC which indicates that the desired service +is not available at the process contacted, but may be available at +a possibly-different contact name at a possibly-different host. The +data field contains the new contact name and the ack packet # field +contains the new host number. The issuer of the RFC should issue +another RFC to that address. + +5 ANS - answer to a simple transaction + +Simple transactions are transactions which consist of a single question +(request) and a single answer (response). They have no side effects, +so it is not necessary for either party to know whether the other party +thinks the transaction was completed or not. Simple transactions need +no flow control and no error control, other than a timeout by the user +side to detect lost messages. They are a simple, efficient way for +doing simple-minded things such as extracting information (such as the +time or a host name table) from a central server. + +A simple transaction is initiated by sending an RFC to a server which +happens to use simple transactions rather than full connections. The +data field of the RFC consists of the contact name of the server, +optionally followed by a space and arguments to the request. The +server responds by sending an ANS packet, whose data field is the +answer. The destination address of the ANS comes from the source +address of the RFC. The source address, packet #, and ack packet # +fields of the ANS are not used and should be zero. + +The difference between simple transactions (2 packets) and +full datagrams (4 packets) is that in the simple transaction the two +parties don't have to agree about whether or not the transaction +in fact took place, while in the full datagram they do, making +acknowledgement necessary. + +The server of a simple transaction should be prepared to process +the transaction multiple times without error. Simple transactions +should not have side effects which would be dangerous if repeated. + +200-377 DATA - Transmits Data + +The data portion of the packet is data being sent through the +connection. The packet # is a number that increments by one for each +data packet sent in this direction on this connection. This is used to +detect lost packets (which includes packets garbled in transmission and +packets lost in the statistical flow control scheme) and duplicated +packets (caused by lost or delayed acknowledges. The NCP undertakes to +deliver the packets to the destination process in the same order that +they came from the source process, with no duplications and no +omissions. Note that any opcode with the sign bit on is a data packet +as far as the NCP is concerned; if they wish, higher-level protocols +may use the opcode field to define various different kinds of data +packets. Thus, what is herein called a data packet may be a "control" +packet to a higher-level protocol. Normally, opcodes 200 and 300 +should be used. Opcodes 201-277 and 301-377 are to be used for special +purposes, as defined by higher-level protocols. + +Opcodes 300-377 are defined to be "16-bit data". Note that this does not +affect the byte count in the packet header; it is still a count of 8-bit +bytes. The sole effect of 16-bit data is to prevent byte-swapping when +communicating with pdp10's; pdp10's store the 2 8-bit bytes in a 16-bit +"word" in the reverse of the network standard order (defined by pdp11's +and Lisp machines). ((For purposes of 16-bit data, Interdata machines +are considered pdp10's.)) + +6 SNS - sense status + +This packet is a request for a STS packet to be returned. It is used for +"probing", see the section on flow and error control. + +Note that, to avoid a timing error, a SNS received by a connection in the +RFC-sent state should be ignored. This can happen if an OPN is transmitted +followed by a SNS and the packets get out of order. + +SNS should not be transmitted on a connection that is not in the Open state. + + +7 STS - report status + +STS is used for a variety of purposes. It is the vehicle to carry an +acknowledgement, when no data packet is being sent on which the +acknowledge could be piggy-backed. STS is used to set or change the +window size, to acknowledge opening of a connection, and to carry +receipts (see the flow control section.) In the future STS will (may) +be used to carry information used in automatic window-size adjustment. +Like most packets, the ack packet# field of STS carries an +acknowledgement, the number of the last packet given to the user +process. The first two bytes of the data field (low-order byte first) +carry a receipt, the number of the last packet guaranteed to be given +to the user process eventually. The next 2 data bytes carry the window +size (low-order byte first). Additional data bytes will be defined in +the future. + +STS's contain 16-bit data and are not byte-swapped. See above under opcode 300. + +10 RUT - routing information + +This packet type is reserved for the future, when automatic routing exists. + +RUT's contain 16-bit data and are not byte-swapped. See above under opcode 300. + +11 LOS - you are losing + +If a host receives a packet for a connection that does not exist (other +than RFC which isn't associated with a particular connection, LOS, and +CLS which is safe to ignore), it should return a LOS packet to the +source of the offending packet. The source of the LOS should be the +destination of the offending packet, and the packet# and ack packet# +fields should be copied. The data portion of a LOS contains an ascii +explanation of the problem. A host receiving a LOS should break the +connection specified by the destination index and inform the associated +process that something has gone wrong. It should make the LOS packet +available to that process so the explanation of the problem can be +read. + +The LOS packet isn't actually necessary, since if the supposed other +end of a connection refuses to cooperate (i.e. never sends any +packets), after a while the NCP will give up, close the connection, and +inform the user that the foreign host appears to be dead. + +For debugging, an echo feature is implemented as follows. If you send +a packet with a data opcode and source and destination indices of 0, +it will be sent back as a LOS packet. The data field will be destroyed +by the error explanation, but the packet # and ack packet # fields can +be used to remember any sequencing or checking information. + +12 LSN - listen (never transmitted through the net, see below) + +13 MNT - maintenance + +Normal NCPs will discard MNT packets, without generating a LOS. This packet +type is reserved for use by maintenance programs. + +>>Table of packet field use vs opcode + +The unused field is never used and must be zero, the forwarding count +field is always used in the same way, and the nbytes field is always +the length of the data. Fields marked "0" below are don't care +rather than must be zero, but zero is certainly recommended. The packet# +field of CLS, SNS, and STS would best be set the same as the packet# of +the next data packet to be sent (just as in RFC and OPN). + + Destination Source +Opcode Host Index Host Index Packet# Ack pk# Data +------ ---- ----- ---- ----- ------- ------- ---- + RFC usual 0 usual usual first - 1 0 contact name + + OPN usual usual usual usual first - 1 usual 0, window size + + CLS usual usual usual 0 0 0 reason + + ANS usual usual usual 0 0 0 answer + + FWD usual usual usual 0 0 new host contact name + + SNS usual usual usual usual 0 usual 0 + + STS usual usual usual usual 0 usual receipt#, window size + + LOS src h src i dst h dst i pk# ack pk # reason + + LSN 0 0 0 0 0 0 contact name + +Data usual usual usual usual usual usual data + + MNT completely nonstandard + + RUT completely nonstandard + +>>Flow and Error Control + +The NCPs conspire to ensure that data packets are sent from user to +user with no duplications, omissions, or changes of order. +Secondarily, the NCPs attempt to achieve a maximum rate of flow of +data, and a minimum of overhead and retransmission. + +The transmission medium is required to lose all damaged packets. Therefore +error control reduces to retransmission of lost packets, plus immunity to +duplicated and out-of-sequence packets. + +The following concepts must be explained: the window, acknowledgement, +receipt, retransmission, and probing. + +The window is the set of data packets "in the network" between the +sending process and the receiving process. Conceptually the window +slides along as transmission proceeds. When a packet is acknowledged, +that means that the window is to the right of that packet, since the +receiving process has gobbled that packet. The window has a fixed size +to limit the amount of buffer space that is used up if the sender sends +faster than the receiver receives. If the sending user process tries +to transmit more packets than the window size allows, it should be made +to wait until some packets have been acknowledged. The window is made +sufficiently large to regulate how often acknowledgements must be +returned. Note that the window includes only data packets, not +control packets. Control packets are to be processed immediately +when they are received, and do not take up buffer space. Separate +mechanisms are provided to deal with control packets being lost in +the network. + +No sender is actually required to pay any attention to the window size. +No receiver is actually required to set the window size to something +reasonable. However, those hosts that want to maximize performance +should do something about the window size. The size is initially set +during the RFC/OPN/STS dialogue, presumably according to the type of +protocol being used. An NCP may, if it chooses, dynamically adjust the +window size according to observed network behavior. (See dynamic +window-size adjustment section below.) + +An acknowledgement is a signal from a receiver to a sender that all +packets through packet number "n" have been given to the receiving +process, therefore the window should go from n+1 through n+window_size. +Note that acknowledgements can get out of order, so one should use +the maximum (mod 2^16) of all the acknowledgements ever received +as the start of the window. Since acknowledgements are so common, +there is a field (ack packet #) in the data packet which allows +an acknowledgement to be "piggy-backed" on another packet. + +A receipt is a signal from a receiver to a sender that all packets +through packet number "n" have been received successfully by the NCP +and are guaranteed to be delivered to the user process, therefore they +need not be retransmitted. Note that acknowledgement implies receipt. +The separate receipt mechanism is supplied so that useless +retransmissions can be limited, when the data have been received but +cannot be acknowledged because the receiving process is being slow +about reading them. The STS packet is used to send a +receipt. Receipts are optional. + +Retransmission is the process of sending all unreceipted data packets +in the sender's queue through the network to the receiver, except those +that were last sent very recently (within 1/30'th of a second in ITS.) +Retransmission occurs every 1/2 second, and when a STS packet is +received. The idea of retransmission is to keep sending a packet until +it has been proven to have successfully reached its destination (by +receipt or acknowledgement.) The reason retransmission occurs in +response to STS is so that a receiver may cause a faster retranmission +rate than twice a second, if it so desires. Since STS carries a +receipt, and very-recently-transmitted packets are not retransmitted, +this should never cause useless retransmission. + +A probe is the sending of a SNS packet, in the hope of eliciting +either a STS or a LOS, depending on whether the other side believes +in the connection. Probing is used periodically as a way of testing +that the connection is still open, and also serves as a way to get STS +packets retransmitted as a hedge against the loss of an acknowledgement, +which could otherwise stymie the connection. + +We probe every five seconds, on connections which have unacknowledged +packets outstanding (a non-empty window), and on connections which have +not received any packets for one minute. If a connection receives no +packets for 1 1/2 minutes, this means that at least 5 probes have been +ignored, and the connection is declared to be broken. + +The receiver generates STS packets under the following circumstances: +When a SNS is received (thus a response to a probe). When a duplicate +packet is received, so that further useless retransmission will be +prevented by the receipt. When the number of received but not +acknowledged packets is more than 1/3 the window size; evidently the +normal piggy-backed acknowledge mechanism is not working, so we +generate a STS to carry the acknowledge that will empty the window back +out, hopefully in time before transmission becomes clogged. When the +window size changes (to tell the other end of the change). + +When it is time to send a STS, we attempt to send one immediately. +If this fails (for instance, there might be no buffers available), +we keep trying to send one every half-second. + +The receiver can also generate "spontaneous" STS's, to stimulate +retransmission or to carry an acknowledge, to keep things moving on +fast devices with insufficient buffering, such as the Gould printer. +This provides a way for the receiver to speed up the retransmission +timeout in the sender, and to make sure that acknowledges are happening +often enough. For example, one might use a timer to generate a STS +every 1/10th of a second. + +Note that spontaneous STS's should not be generated until the connection +is fully open. This means that the server should not send STS until it +has gotten a STS back from its OPN. STS's other than spontaneous ones +have no such problem. + +>>Host Status + +All physical Chaosnet hosts, even gateways, are required to answer an +RFC with contact name STATUS and byte count 5 (no "arguments" allowed +in the data field of the packet) by returning an ANS packet whose data +field contains: the name of the host in ascii, an octal 200 (any byte +with the sign bit on terminates the name), and additional status and +metering information to be defined later, perhaps in a site-dependent +way. This makes it possible to write a program which determines the +status of all nodes in the network; the program could either be driven +by a host table or could try all possible host addresses; the NCP should +respond promptly to the STATUS RFC rather than starting up a program +to handle it, if starting up a program would take more than a second +or two. + +>>>Here is some narrative description of the NCP. + +Each receiver (each end of each connection is a receiver, and also a +sender; think of receivers and senders as little actors inside the NCP) +has a list of buffers containing packets which have been successfully +received and are waiting to be read by the user process, and two +packet# variables. One is the number of the last packet read by the +user process. The other is the number of the last packet which has +been acknowledged. If these two are not equal, the receiver needs to +send an acknowledgement "soon." + +The received-packet list needs to be kept sorted by packet number, and +the NCP has to make sure that the user process does not see duplicates +or omissions. If packets arrive out of order, the NCP has to sort them. +This means that the user process may not be able to read a packet even +though the receive list is non-empty, because the first packet in the +receive list is not the successor of the last packet read by the user +process. + +A good way to do this is to have two lists of received packets, each +of which is sorted. The first list contains those packets which +the user process may read; the first in the list is the successor +to the last packet read, and there are no gaps in the list. +The second list is the remaining packets, which the user may not +read until some other packet arrives to fill in the gap. Each +list needs a pointer to head and tail, and the packet number of +the next packet to be appended to the tail. + +It is not actually a requirement that an NCP support out-of-order +packets, rather than simply discarding them and hoping that they +will be retransmitted in order, but if it's not very hard to do +one might as well do it. + +Acknowledgements are sent by putting the last-received variable into +the "ack packet #" field of an outgoing packet on the opposite +direction of the appropriate connection, and copying the last-received +variable into the last-acknowledged variable. Where does the outgoing +packet come from? First of all, all outgoing data, SNS, and STS +packets automatically carry acknowledgement for the reverse direction +of their connection. So if an outgoing packet happens to be sent at a +time when an acknowledgement is necssary, that takes care of it. + +Secondly, if the number of outstanding unacknowledged packets is more +than 1/3 the window size, a STS should be generated and sent immediately +to acknowledge those packets before the sender fills up the window. + +Thirdly, the "soon" of four paragraphs back is implemented by a timeout +in the NCP. If an acknowledgement remains required for a certain amount +of time, a STS should be generated and sent to carry it. The appropriate +time interval is 1 second, I would guess. This timeout does not have +to be too exact, however. One could also not bother with this and let +the other end's probe timeout trigger the STS via a SNS. However, it +is desirable to send a receipt fairly soon after receiving a packet +to avoid useless retransmission. This could be done either by a timeout +or by sending a receipt when the packet is received for the second time. +[No known NCP has such a timeout. 10/2/78] + +The reason for having a timeout here, rather than just sending an +acknowledgement right away, is two-fold. It allows "batching" of +acknowledgements, where a single packet can be used to acknowledge +many packets, which halves the network traffic caused by bulk +data transfer. It also allows "piggy-backing" of acknowledgements +on data packets, which (for instance) decreases the network traffic +caused by remote-echoing telnet connections. + +When a receiver receives a data packet, it compares the packet # of +that packet with the last-received variable. If it is less or equal +(modulo 2^16), it is a duplicate of a packet already given to the user, +and should be discarded (or it is at least 30000 packets ahead of the +user, which is unlikely.) + +If it is greater, it is sorted into the received-packet list at the +appropriate position (if it has the same packet# as a packet already in +that list, it is a duplicate and is discarded.) It is NOT acknowledged +at this time; no packet is ever acknowledged until it has been given to +the user process ("end to end acknowledgement"). Since a packet on the +received packet list has not yet been acknowledged, it may be safely +discarded at any time if the operating system runs out of buffer space, +PROVIDED that it has not yet been receipted. +Also, if the receiving user process is not listening to the net, the +NCP cannot be swamped with arbitrary numbers of packets, since the +sending user process is not supposed to send more than window-size +packets past the last one the receiving user process read. +However, if receipts are being used, once a receipt has been sent for +a packet that packet may not be discarded. It is up to the individual +NCP which strategy it prefers to use. + +Note that the most likely cause of packet duplication is that an +acknowledge or a receipt was lost, so whenever a duplicate packet is +discarded, a STS packet should be sent back containing the current +receipt and acknowledge packet numbers. + +The sender has a list of packets which have been entrusted to it by the +user for transmission and one packet # variable, the number of the last +packet sent by the user. When the user next sends a packet, the sender +will increment this variable and set the packet# of the sent packet to +the result. The sender also sets the source and destination host +numbers and indices of the packet, sets the "ack packet #" to the +last-received variable of its corresponding receiver, sets the +receiver's last-acknowledged variable to that (clearing the receiver's +need-an-acknowledge flag), chooses a transmission medium by checking +the routing tables, and gives the packet to the transmission medium for +"immediate" transmission (perhaps it has to wait its turn in a queue.) +It also saves the packet on a list, in case retransmission is required. + +With each buffered packet the sender holds in trust, it remembers the time +that packet was last transmitted. From time to time "retransmission" +occurs. The sender gives one or more packets from its list to the +transmission medium. It always starts with the oldest, so as to keep +things in order, and sends the rest in order until it gets to one that was +transmitted too recently to do again. Retransmission is used to recover +from lost or damaged packets, lost or damaged acknowledgements, and packets +discarded by the receiver due to lack of buffering capacity. + +Each time a receiver receives a packet, it gives the "ack packet #" +from that packet to its corresponding sender. The sender discards any +packets with numbers less than or equal to that, since their successful +receipt has just been acknowledged, and advances the window. If a STS +packet is received, its receipt field is processed by discarding +packets, but the window is not advanced. + +>>Dynamic Window-size Adjustment + +This section has not been updated for receipts. Also, it is a bunch +of junk. Probably we can do without this stuff. + +Permit me to stress that this stuff is optional for small NCPs. + +The goals of flow control are: + 1. Error recovery. + 2. If the receiver is faster than the sender, avoid unnecessary + delays in transmission due to having to wait for an + acknowledge or having to wait for the sender process to wake up. + 3. If the sender is faster than the receiver, minimize + retransmissions due to receive buffer overflow. + 4. Minimize the number of otherwise-useless packets generated + to carry an acknowledgement or a window-size negotiation, + and minimize useless retransmissions. + +Consequences of the goals: + 1. All packets will be retransmitted until acknowledged. + 2. The sending NCP must buffer several packets, and packets + must be acknowledged in groups, not one-by-one. + 3. If the receiver is slow, something must force the sender + not to send packets too fast. + 4. The interval between retransmissions should not be too small. + It may be desirable for it to increase if the receiving + process is not listening for some reason. + +The window size is the maximum number of packets which may be in the +network at one time (for one direction of one connection). "In the +network" means output by the sending process and not yet input by +the receiving process. (These processes are the entities which +determine the rate, unless they are so fast that the network slows +them down.) + +The window size is not the number of packets acknowledged at a time; +for best operation the latter must be 1/2 to 1/3 of the former. +See below. + +If the sending process is slow (and determines the rate), things +are relatively simple. We just have to have a big enough window +size and frequent enough acknowledgement to cover for sending +process wakeup delays. + +If things are not limited by the sender, then + Window size + Flow rate = --------------- + Round trip time + + Round trip time = time to wake up sender process (multiplied + by the fraction of the time this + is necessary) + + time packet is sitting in sender buffers + before it is transmitted + + transit time through the net + + time packet is sitting in receiver buffers + before it is read; this is the maximum + of time to process previous packets + and time to wakeup sender process + + time until acknowledge is generated and sent + + transit time through the net + +The round trip time is the time between when packet N is output by the +sending process and when it is acknowledged, permitting the sending +process to output packet N+WS. + +The main variable components of the round trip time are the delay +before acknowledgement and the delay waiting in the receiver buffer for +packets to be processed. If these were zero, the round trip time would +consist of two process wakeups and two network transit times +(determined by the delay waiting for the cable and waiting for previous +packets from this host to be transmitted, the time needed to load and +unload the interface in the buffer, and the actual transmission time, +multiplied by the number of bridges in the path.) + +This ideal round trip time is probably on the order of 2 seconds. +The timeout for retransmission should be 2 to 3 times the round trip +time. The timeout for acknowledgement should be 1/3 to 1/2 the +round trip time. One could either measure the actual round trip time, +or use an estimate of say 3 seconds, a little higher than the ideal. +It would be a good idea to measure the round trip time in any case, +which is done by getting the elapsed time since transmission when +a packet is discarded due to its being acknowledged, and averaging +that. + +The receiver process should initially set the window size to the +maximum flow rate it wants to handle times the desirable round trip +time. + +Symptoms of improper window size: + +If the window-size is too large, the round trip time becomes +long due to packet processing delay in the receiver buffer. +(There will be many packets in the receiver buffer, and the +receiver will be processing them slowly.) The long round-trip +time will cause unnecessary retransmissions. Retransmissions +could also be caused by the NCP's discarding received packets +due to insufficient core to buffer them. + +If the window-size is too small, excessive process blocking +and waking up occurs. The receiver process often empties its +buffer and has to block until more packets arrive. The sender +process often fills up its buffer and has to block until +some of the buffered packets are acknowledged. A small window +size also causes acknowledgements to have to be sent more +frequently than necessary. Note that from the receiver's +point of view it is impossible to distinguish between the +window size being too small and the sending process being +too slow. + +Here is a scheme for dynamic adjustment of the window size: + +Note that window-size adjustments cannot take effect +(in the sense of fixing the symptoms) immediately, so it +is necessary to limit the rate at which the window size +is adjusted. + +When the receiver receives (and discards) a duplicate of a +packet it already has in its buffer, this indicates either +that an acknowledgement was lost or that the window size +is too large. Since packets are assumed not be lost very +often, we may as well assume the window size is too large +and send a WIN packet to decrease it. Another possibility +would be to have the sender detect the long round-trip +time and complain to the receiver, who could adjust the +window size. The receiver must not decrease the window +size again until all packets currently buffered have +been read and acknowledged, indicating that the sender +has had a chance to decrease the number of packets +buffered at its end. A reasonable amount to decrease +the window size by is 1/3 of its current value. + +When the sending process wants to output a packet, but the number of +packets already buffered is greater than or equal to the window size, +it should send a WTS, indicating that the problem is too small a window +size or too slow a receiver rather than too slow a sender. When the +receiving process wants to input a packet, but the buffer is empty, and +a flag is set indicating that a WTS has been received, it should send a +WIN packet adjusting the window size upward by 1/2 of its current value +(and clear the WTS-received flag). This is rate-limited by preventing +the sender from sending a second WTS until all the packets buffered at +the time the first WTS was sent have been acknowledged, indicating that +the receiver has had time to act on the first WTS. + +The variables required. For both the sending and receiving sides, a +packet number which has to be acknowledged before WTS or WIN can be +sent again, and a flag saying whether this number is operative. Also, +a WTS-received flag in the receiver. + +It is important to meter the performance of this mechanism and find out +whether it does anything and whether what it does is right. + +Consider the possibilities of changing this into a more symmetric and +negotiation-based scheme, where the sender always initiates window size +changing and the receiver either agrees or ignores the request. +Consider using elapsed time as an additional rate-limiter (have to use +the other thing, too, so idle connections don't keep changing window +size; this may be deleteable if it is always sender-initiated.) + +More notes on the subject of window-size too small. +This is identical to receiver too slow. The net flow rate +out of the sender is trying to be higher than that into +the receiver, so packets pile up in buffers at each end. +The round-trip becomes arbitrarily high to preserve the +equation and divide window size down enough to get the +flow rate. + +The situation where the window-size is too small and we want to do +something about it has to be distinguished from two other situations. +One, the receiver is accepting packets slowly but the sender is also +sending them slowly. We don't want to change the window-size, because +it doesn't matter since packets aren't piling up, and at any time they +might both decide to go fast. Two, the receiver's net flow rate is +high, but its response time is long (it's taking packets in bursts). +Here the round-trip time is still long, but making the window size +smaller would make things worse. + +The symptoms that distinguish the case where we want to make the +window-size smaller are: the round-trip time is long, the sender +buffer is full, and the number of packets acknowledged at a time is +small compared to the window size. Actually, the last two are sufficient, +since if the acknowledgement batch size is small, and we know it's +not the sender's fault, may as well decrease the window size +to save buffer space and decrease the round-trip time. + +>>Uniquization + +To avoid problems with packets left over from old connections +causing problems with new connections, we do two things. First of +all, packets are not accepted as input unless the source and +destination hosts and indices correspond to a known, existent +connection. By itself, this should be adequate, provided that +retransmission is only done by the originating host, not by intervening +gateways and bridges in the network. This is because we can safely +assume that when a host agrees to open a connection with a certain +index number at its end, it will give up on any previous connection +with the same index, therefore it won't retransmit any old packets +with that index once it has sent out a new RFC or OPN. The indications +are that our network will be "local" enough that indeed retransmission +will only be done by the original host. + +Problems could still occur if packets get out of order, so that an OPN +establishing a new connection gets ahead of a data packet for an old +connection with the same index. To protect against this, it is +necessary to assure that at least a few seconds elapse before an index +number is reused. This could be done either by remembering when an +index is last used, or by reserving part of the 16-bit index number as +a uniquization field, which is incremented each time an +otherwise-the-same index is reused. This field needs to big enough to +cover for the maximum delay of an old data packet with the same index, +and depends on the rate of creation of connections. Which method is +chosen is at the discretion of each local NCP. Another necessary +assumption is that when a system crashes and is reloaded (thus +forgetting any remembered information about which indices were in use +when and so forth) that the time to reload it is more than a few +seconds. + +Problems could occur not only with left over data packets, but also +with left over control packets. This isn't too much of a problem since +control packets are not retransmitted, but it could still happen that a +host gets faked out into thinking that it has a connection to another +host that the other host doesn't know about. In this case, it should +just look like the connection was opened and then either the other host +went down or the connection was broken by a LOS packet, since the other +host won't generate any data packets and won't accept any. + +>>Media handlers + +A host may be connected to more than one transmission medium. It has +service programs for each. + +When a packet is received that is not addressed to this host, the +forwarding count should be incremented. If it doesn't overflow, the +packet should be sent back out according to the routing tables, +otherwise it should be discarded. Normally it would not be useful to +send a packet back out on the same subnet it came in on, but we may as +well let the forwarding count catch this along with other loops. + +When a packet is received, if the opcode is RFC, it is handled +specially. The contact name is compared against those of all the +indices which are in the Listening state. If a match is found, that +index is put into the RFC-received state, its LSN packet is discarded, +and the RFC packet is put into its input list so that the server +process can see it. If no server is listening to that contact name, +the RFC packet is placed on the pending-RFC list, and (in the case of +ITS) a server process is created which will load itself with a suitable +program to open an index in "server" mode, gobble an RFC packet, look +at the contact name, and either reload itself with the appropriate +server program or send a CLS reply. + +When a non-RFC packet is received, the system must look for a receiver +index to handle it. If none is found, or the state is wrong, or the +source host and index don't match, a LOS should be sent unless the +received packet was a LOS. Otherwise, if the received packet is WIN, +WTS, or NOP, it is processed and discarded. Other packets are given to +the user; OPN, CLS, and LOS cause a state change but are also given to +the user as input. + +The transmitting side of a transmission medium handler has a queue of +packets to be transmitted. It should send them out, in order, as fast +as possible, except that if a receiving host has no buffer space (which +can be detected because its chaosnet interface will cause +"interference" on the ether), it should look down the list for another +host to send to. [No known NCP bothers to look for another +host to send to. 10/2/78] As long as packets to the same host are sent in the +order they are queued, everything will be all right. (Actually, this +normally shouldn't matter much.) In addition, when the packets are put +into the transmit queue, the destination host number has to be looked +up in a table to determine which transmission medium to use to get to +it and (in the case of ether) which physical host number to put in the +packet trailer for the hardware. + +>>Buffers + +In ITS, the buffering scheme will be as follows. There will be a pool of +128-word packet buffers available. When it runs out, more can be made. When +there are many free some can be flushed. 128-word buffers are made out of +1024-word pages (adding a new page type), rather than using the existing +128-word buffer mechanism, because there is a limited number of 128-word +buffers, and that mechanism is a little painful to use. There are likely +to be several hundred (?) packet buffers (say 12K of core) in use when +high-speed (e.g. mag-tape speed) file transfer is going on. + +Each packet buffer has a two-word header, and 126 words which can hold a +packet. Packet buffers can be on one (or sometimes two) of six lists: +The free list. The receive list, of which there are two for each +index, one for packets which the user may safely read and one for +out-of-order packets which are awaiting the arrival of an earlier +packet before the user may read them. The send list, of which there is +one for each index. The transmission list. The pending-RFC list. The +pending-LSN list. + +The free list contains packet buffers which are free. They are threaded +together through addresses in the first word. Zero ends the list. + +The transmission list contains packets which are to be transmitted out +on the network "immediately". At interrupt level packets are pulled +off of this list and sent. (There might be more than one transmission +list if a machine is connected to more than one physical medium.) +The transmission list is threaded through addresses in the left half +of the first word. Zero ends the list. After transmission -1 is stored +to indicate that the packet is not on the transmission list any more. +If the right half of the first word is -1, indicating that the packet +is not also on a send list, it is returned to free. + +Each send list contains packets for a particular connection which have +been entrusted to the system by the user to be sent, but have not yet +been acknowledged. They are threaded together through the right half +of the first word. The second word contains the time that the packet +was last transmitted (actually, the time that it was last put on the +transmission list.) + +Each receive list contains packets which have been received on a particular +connection and not yet read by the user. They are threaded together +by addresses in the first word, and the list ends with zero. The receive +lists must be kept sorted by packet number. + +The pending-RFC list contains request-for-connection packets which have +not yet been either accepted or rejected. They are threaded together +through the first word. When a server process finishes getting created +and loaded, it will take an RFC off the pending-RFC list and put it +on its own receive list. The second word of these packets contains +the time received so that the system can know when something has gone +wrong and they should be thrown away. + +The pending-LSN list contains LSN packets for all the listening users. +These packets are just used as a handy place to save the contact name +being listened to. They are threaded together through the first word. +The source-index field in the packet header can, of course, be used +to find which user this packet belongs to. + +>>ITS System Calls + +(Other systems would have similar calls, with appropriate +changes for their own ways of doing things.) + +OPEN + + Not allowed. (I said this wasn't a "standard" device!) + Instead use: + +CHAOSO + + arg 1 - receive channel number + arg 2 - transmit channel number + arg 3 - receive window size + + First, the two specified channels are closed. Then an index + is assigned to the user and the two channels are set up to + point to it. Two channels are used since in general ITS + channels are unidirectional, and to allow to the user to + handle receive and transmit interrupts differently. + + The created index is placed in the Closed state. To set up + a connection, IOT an RFC or LSN packet down the transmit + channel. + + +PKTIOT + arg 1 - channel number + arg 2 - address of a 126.-word block. + + Always transfers exactly one packet. + The format of the 126.-word block is: + 16 16 4 + ----------------------------------------- + | opcode | unused | fc | nbytes | 0 | + ----------------------------------------- + |destination host |destination index| 0 | + ----------------------------------------- + | source host | source index | 0 | + ----------------------------------------- + | packet # | ack packet # | 0 | + ----------------------------------------- + | data1 | data2 ... + + ... data487 | + ----------------------------------------- + + In the descriptions below, if an error is said to + occur that means IOC error 10. (channel in illegal mode) [3?] + is signalled. (Probably change this to an error return?) ******* + + In the case of an output PKTIOT, the user sets only + the opcode, nbytes, and data-n fields. When the + NCP copies the packet into a buffer in the system + it sets the other fields of the header to the + appropriate values. + + This is not completely true. When outputting an RFC, + the user sets the destination host field, and sets the + ack packet # to the receive window size desired. The user + also sets the window size when outputting an OPN. + + The NCP checks for the following special values + in the opcode field of a packet output by the user: + + RFC - error if the index is not in the Closed state. + The packet is transmitted (but not queued for + possible retransmission) and the index enters + the RFC-sent state. The user should do an input + PKTIOT which will wait for the OPN, CLS, FWD, or ANS reply + packet to arrive. The NCP also copies and saves + the user-specified host number and window size. + + LSN - error if the index is not in the Closed state. + It is put into the Listen state. The packet + is not transmitted, but it is saved so that + when an RFC comes in the system can compare + the contact names. (Note- LSN is a special + opcode which is never actually transmitted + through the net.) The pending-RFC list is searched + to see if an RFC with the same contact name has + been received. If so, it is given to this index + as if it was received just after the LSN was + sent out. + + OPN - error if the connection is not in the RFC-received + state. It is put into the Open state. The + packet is transmitted (but not queued for + retransmission, since until it is received + the other end does not know what index to + send acknowledgements to.) The system also + copies and remembers the window size. + + CLS - error if the connection is not in the Open + or the RFC-received state. It is put into + the Closed state and the packet is transmitted + (but not queued for retransmission). This packet + may optionally contain data bytes which are + an ascii excuse for the close. + + FWD - error if the connection is not in the RFC-received + state. The packet is transmitted, but not queued + for retransmission, and the connection is put into + the Closed state. + + ANS - error if the connection is not in the RFC-received + state. The packet is transmitted, but not queued + for retransmission, and the connection is put into + the Closed state. + + 200 or higher - This is a data packet. Error if the + connection is not in the Open state. A packet# + is assigned, the destination and source fields + are filled in, and the packet is transmitted and + queued for retransmission. + + Any other opcode causes an error. + + In the case of an input PKTIOT, the user will get an error + if the connection is in the Closed or Broken state, + except if it is in the Closed state and there are data + packets queued. This is so that the user can read the + CLS packet. Otherwise, it will hang until a packet + arrives, then return the packet into the user's + 126.-word block. + + The user should check the sign bit of the first word, + which will be set if this is a data packet. The + non-data packets which can get given to the user are + RFC, OPN, FWD, ANS, LOS, and CLS. (You shouldn't be + surprised if you get something else, though!) + + +IOT, SIOT + These can be used to do unit-mode 8-bit-byte transfers. + Control bit 1.4 means don't-hang, and applies to both input + and output. Only data packets with opcode 200 will be + transferred. Anything else on input causes the transfer + to stop, like an end-of-file. Use PKTIOT to find out what + the story is. (The correct way is to verify that there are + some packets in the input buffer, then do a SIOT, and if it + transfers 0 bytes then the first packet in the input buffer + must not be a data packet, so PKTIOT it in.) + + There can be input available to SIOT even when the state is + not %CSOPN (e.g. if the input buffer contains data and + a CLS packet.) In this case, you should first SIOT (if you + care to pick up the data) then PKTIOT. + +CLOSE + + Immediately closes the connection. All buffers and other + information associated with the index are discarded. Normally + the user should first IOT a CLS + packet containing an ascii explanation for why it is + closing. Note that any data previously written on the + connection but not yet received by the other end will be + lost. User programs should exchange "bye" commands of some + sort before closing if they care about losing data. It is + done this way to keep the NCP simple. + + +RESET + + Does nothing. + + +FORCE + + If there is a partially-filled output packet (created by IOT + or SIOT), it is transmitted. + +FLUSH + + On an output channel, does FORCE and then waits until + there are no queued output buffers. I.e., waits for + all output to be received and acknowledged by the foreign + host. This in fact waits for acknowledge, not just receipt. + + +RCHST + + val 1 SIXBIT/CHAOS/ + val 2 0 + val 3 0 + val 4 0 + val 5 -1 + + +RFNAME + + val 1 SIXBIT/CHAOS/ + val 2 0 + val 3 0 + val 4 0 + val 5 0 or 1 (i.e. .UAI or .UAO) + + +WHYINT + + val 1 - %WYCHA + val 2 - state + val 3 - number of packets queued (receive,,transmit) + val 4 - window size (receive,,transmit) + val 5 - input channel#,,output channel# (-1 if not open or I/O-pushed) + + LH(val 3) is the number of packets available to input IOT. + This is different from the number of received packets + if some are out of order. This is increased by 1 if + there is a partially-read buffer available to SIOT; + this packet is not available to PKTIOT. This is zero + if the connection is direct-connected to a STY. + + RH(val 3) is the number of packets which have been transmitted + by output IOT but which have not yet been received and + acknowledged by the foreign host. + + The state codes are: + + %CSCLS Closed + %CSLSN Listen + %CSRFC RFC-received + %CSRFS RFC-sent + %CSOPN Open + %CSLOS Broken by receipt of "LOS" packet. + %CSINC Broken by incomplete transmission (no acknowledge + for a long time) + + +NETBLK + + Similar to Arpanet NETBLK. + + +STYNET + + arg 1 - STY channel + arg 2 - Chaos channel to connect to, or + -1 to disconnect + arg 3 - Other Chaos channel (not actually used) + arg 4 - Output-reset character sequence, up to 3 8-bit + characters left-justified. + + This works the same as on the Arpanet. The specified STY + is connected to or disconnected from a Chaos net channel. + Data is transferred in and out by the system without the + need for intervention by the user program. If an unusual + condition occurs, the STY is disconnected from the Chaos + channel and the user is interrupted. It is illegal to do + I/O on any of the involved channels while they are connected. + + This call is provided for the benefit of the "Telnet" server. + + +CHAOSQ + + arg 1 - address of a 126.-word block (packet buffer) + + This is a special system call for use by the ATSIGN CHAOS + program, which is a daemon program that gets run when + an RFC is received that does not match up against an + existing LSN. + + The first packet on the pending-RFC queue is copied + into the packet buffer, then moved to the end of the + queue (so that the right thing happens when several + RFC's are pending at the same time.) + + The call fails if the pending-RFC queue is empty. + + The program should use the contact name in this + packet to choose a server program to execute. This + server program will then LSN to (presumably) the same + contact name, thus picking up the RFC. + +Interrupts + + IOC error interrupts occur if an attempt is made to IOT + when the connection is in an improper state, or to IOT + a packet with an illegal opcode. + + An I/O channel interrupt is signalled on the input channel + when the number of queued buffers changes from zero to + non-zero. + + An I/O channel interrupt is signalled on the output channel + when the number of queued buffers changes from greater or + equal to the window size, to less than the window size. + + An I/O channel interrupt is signalled on the input channel + when the connection state changes. + + Interrupts can be used for + + (1) detecting when input arrives. + (2) detecting when the system is willing to accept + output. + (3) detecting when the other end does a CLOSE. + (4) detecting when a requested connection + is accepted or rejected. + (5) detecting when a request for connection + comes into a listening server. + +>ITS packages + +Here document CHSDEF and NNETWK someday. Also the host table. + +>An NCP in English + +This section contains the salient routines and variables of the ITS +Chaos Network Control Program, in English. + +The following variables exist per-connection: + +CHSUSR the user who owns the connection, and his channel number for + it. This is used for reporting interrupts, and to keep track + of who owns what. + +CHSSTA the state. The following states exist: + Closed - this is the initial state + Listening - awaiting an RFC that matches the user's LSN. + RFC-received - entered from the Listening state when a matching + RFC arrives. + RFC-sent - entered from the closed state when an RFC is transmitted. + Open - entered from RFC-sent when an OPN is received, from RFC-received + when an OPN is sent. This is the "active" state. + Lost - entered when a LOS is received + Incomplete transmission - entered when probing produces no response. + + Some flags also exist: + Send STS as soon as possible + Connection is direct-connected to a STY. + +CHSIBF List of received packets, in order, which the user may read. + +CHSPBF List of out-of-order received packets. The user may not read these. + When the missing packets arrive, these are transferred to CHSIBF. + +CHSOBF List of transmitted packets which have not yet been receipted. This + list retains the packets for retransmission. Control packets do + not go on this list, only data packets. RFC's and OPN's DO go on this list. + +CHSNOS Number of output slots. This is the number of packets which the user + may output before the window fills and the user must wait. It is equal + to the window size minus the number of unacknowledged packets. + +CHSPKN The number of the last packet given to the user, and the number of + the last packet sent by the user. Used in assigning packet numbers, + checking order, and sending acknowledgements. + +CHSACK The numbers of the last packets acknowledged in each direction + of the connection. + +CHSNBF The number of packets in CHSIBF and the number of packets in CHSPBF. + Redundant information which is handy now and then. + +CHSITM The time (in 30ths of a second) that a packet was last received + from the network for this connection. Used in probing/incomplete-transmission. + +CHSWIN The two window sizes for the two directions of the connection. + +CHSLCL The local host and index numbers. + +CHSFRN The foreign host and index numbers. + +--- +When the user reads a packet, this algorithm is executed: +If the CHSIBF list is empty, then if the connection state is +not Open, give an error, otherwise await the arrival of a packet +into CHSIBF. Remove the first packet in CHSIBF and give it to +the user. If it is a data packet (opcode >= 200), "virtually +acknowledge" it as follows. Put its packet number into CHSPKN +as the last packet given to the user. Get the last packet number +acknowledged from CHSACK. If the difference of these is more than +1/3 the window size, send a STS. + +When the user outputs a packet, this algorithm is executed: +(what algorithm?) + +---------- Material after this point may be inoperative ---------- + +>Comparison with LCSnet + , and other blathering. + +>>Principle differences + +The LCSnet proposed protocol is called DSP. The Chaosnet protocol will +just be called chaos in this section. + +(1) DSP specifies things in terms of bytes where Chaosnet specifies +them in terms of packets. We choose packets to increase the simplicity +and efficiency of the scheme. DSP has to work in terms of bytes because +it allows packets to be reformatted en route, hence + +(2) DSP assumes that gateways can exist between networks with the same +protocols but different packet sizes. Therefore, the protocol has to +allow for the fact that packets may be reformatted en route. I happen +to believe that this situation is extremely unlikely to exist, and in +fact gateways between "different" networks will have to do much more +than just change the packet size. Therefore, it makes sense to make +the gateway worry about gateway issues, rather than have them permeate +the whole protocol. I believe that gateways will look more like +regular network ports than like transmission media; to get from a host +on the local net to a host on the arpa net, one will connect to the +arpa net gateway and ask it to open a connection from itself to the +host on the arpa net, then tie those connections together. A gateway +will perform not only packet reformatting, but protocol translation, +flow control on both sides, and maybe even character set translation. +There can also be entities called "bridges", which connect two networks +(or two separate segments of one network) with the same protocol. A bridge +simply forwards any packets it receives, but never alters the packets, +and never looks inside them except to find out where to forward them to. + +(3) A related difference is that DSP includes the arpa net, and TCP, +and by extension all the networks in the universe, in its port number +address space. Chaosnet would have you connect to a gateway, then +send the gateway the port number to connect to in the foreign +address space separately. Chaosnet does have to include all networks +reachable by bridges in its address space. + +(4) Chaosnet has an "opcode" field in the packet header, where DSP +does not. DSP acheives the same effect with various bits here and +there. It makes little difference unless user-level programs decide +to exploit the opcode field. + +(5) DSP and Chaosnet have quite different mechanisms for creating +connections. In DSP, one never creates a connection, exactly; +one simply starts sending to a port address. Local network note +#3 mumbles about how one discovers which port address to send to, +but I have not seen any specifics. In Chaosnet, the mechanism +for finding out where to send to and the mechanism for creating +a connection are intertwined; the excuse is that often the process +being connected to is created at the same time as the connection. + +(6) DSP uses unique, never-reused port IDs. Chaosnet does not. +The problem with unique, never-reused IDs is that I know of no +system that can implement them. Multics comes close, with the +aid of a special hardware clock. The clock is set from the +operator's watch when the system is powered on, and the mechanism +depends on the fact that the error in the operator's watch is +less then the time required to bring up the system after a power +failure. Small systems that cannot afford special hardware just +for this, and don't have permanent disk storage, would find it +very hard to generate unique IDs. + +Chaosnet prefers to rely on a scheme that doesn't require special +hardware, but nearly always works. By requiring a connection +to be opened before data packets can be sent through it, and by +some assumptions about the structure of the network, the problem +is eliminated. See the Flow and Error Control section for +further discussion. + +(7) DSP closes the two directions of a connection separately. Why? + +>>High priority data packets, interrupts, and flushing. + +The basic idea is to note that if you want to send a high priority +message, this means you want it out of order with respect to previously- +sent data on some connection. Therefore, high priority data should +be sent over an auxiliary connection. The per-connection overhead +is not prohibitively high, and this eliminates vast quantities of +hair from the innermost portion of the system. + +One advantage that DSP gains by having "high priority messages" +built into the system is that it also incorporates a standardized +way to "mark" a particular point in a data stream. However, this +is comparatively unimportant, particularly since I think high-priority +messages will probably never get used. The only place I've heard +them proposed to be used is with Telnet, but ordinary terminals +get along quite well without "out of band" signals when used with +reasonable operating system software. + +Interrupts and flushing of input are random crocks associated +with high priority messages. I don't propose to implement them either. + +>>Datagrams. (connections only used to pass a single packet.) + +These are easy. The guy who wishes to send a datagram does +OPEN, IOTs an RFC to the service to which the gram is to be +sent, and NETBLKs waiting for the connection to open up. He +then IOTs the data packet, FLUSHes waiting for it to get there, +then CLOSEs. + +The server OPENs and IOTs an OPN in response to the RFC. She +then IOTs in the datagram packet, CLOSEs, and goes off processing +the message. + +Four packets are transmitted, two in each direction. (An RFC, an OPN, +a DATA, and an ACKing NOP.) No need to send any CLS messages, since +each user process knows to do a CLOSE system call after one data +packet has been transmitted. It has been claimed that this is +the theoretical minimum if acknowledgement is required. The reason +is that the data packet must contain some unique id generated by +the RECEIVER to avoid duplicates, and it must be acknowledged, +so that's two packets in each direction, with no combining possible. + +Note that as [someone at] PARC has pointed out, for the important +case of side-effect-free transactions, a timeout can substitute +for acknowledgement, and only two packets are necessary. See ANS. + + +>>Why not multiple messages per packet? + +[1] Not needed for data. The division of the data stream into +packets is invisble to the real user, anyway. It's only used by +the "user-ring" portion of the network system software. + +[2] Extra complexity. Consider the hair involved with packed +control messages in the Arpanet. Because of the control link being +shared between multiple connections between the same pair of hosts, +this could save a little. I don't know of any NCP that does this; +furthermore, having that shared facility is a bad idea. The only +case in the Arpanet where packing two control messages into one +packet is useful is when opening a connection the receiver wants +to send STR and ALL both. In this protocol we just put the window +size in as part of the RFC and OPN messages. + +[3] There is an argument that having message boundaries separate +from packet boundaries is useful because gateways between different +networks may need to split up packets because the two networks +may have different maximum packet sizes. My feeling about this +is that the gateway is likely to have to do a good deal more than +that. It seems like too much to wish for that the two networks +should use exactly the same packet format, protocols, or even character +set; so the gateway rather than being a packet-reformatting device +is much more likely to look like a user program with two connections, +one on one network and one on the other, which passes data between +the connections with appropriate conversion. In particular, flow +control is likely to be host1 to gateway and host2 to gateway, +rather than host1 to host2. + + +>>Why not have a checksum in the packet? + +This network is likely to have a very diverse collection of machines +on it, which means it will be impossible to define a checksum which +can be computed efficiently in software on all machines. Now all +hardware links in the system ought to have whatever amount of +hardware checking is appropriate to them, but due to the efficiency +costs of a user-level end to end checksum, this should not be +a built-in requirement of the basic low-level protocol. Instead, +checksumming should be an optional feature which some higher-level +protocols (those that need it because the data being passed through +them is so vitally important that every possible effort must be made +to ensure its correctness) may implement. Checksumming should +be implemented at the user level in exactly the same way and for exactly +the same reasons as encryption should be implemented at the user level. + + +>>How about host-independent user-level protocols, where one just +connects to a service and doesn't have to know what host it's at today? + +Yeah, how about it? As far as I know, this protocol provides an +adequate base for constructing such a thing. Also I haven't +seen anything published on the subject. + + +>>Very small hosts. + +E.g. we'd like to put the Chess machine on the net. It has very little +memory, but not totally impotent microcode. A small host need only +support one connection, may ignore WIN, LOS, and CLS, may only have one packet +in transmission at a time, and may process receive packets one at a time +(ignoring any that come in until the first one has been fully processed). +It IS necessary to check that received DATA packets come in in the right order. + +RFC may be handled by remembering the other guy's host number and index, +and sending back a completely canned OPN. The contact name is ignored. +If a second user tries to connect while a first user is connected, +the first user gets bumped. Let them fight it out on some larger +machine (or the floor) for who will get to use the small machine. +Never originate any packet type other than DATA and that one OPN. + +Attaching ordinary terminals "directly" to the network is obviously +undesirable. + +>Transmission Media + +This section describes how packets are encapsulated for transmission +through various media, and what auxiliary hair is needed by each +medium. + + +>>Ethernet + +The messages transmitted through the ether (or CAIOS) net consist of +a packet followed by a three-word trailer: + + +----------------+ + | header | 8 words + +----------------+ + | data | 0-52 words + +----------------+ + | immediate dest | 1 word + +----------------+ + | immediate src | 1 word + +----------------+ + | CRC check word | 1 word + +----------------+ + +The three trailer words are looked at by the hardware; the last two +of them are supplied by the hardware. The reason this stuff is in +a trailer rather than a leader is that the caiosnet hardware actually +transmits the packet backwards. However, this is transparent to +the software. + +Bytes are sent two per word. The low-order byte is first (pdp11 standard). + + +>>TEN11 Interface + +[The following total hair has not been checked recently.] + +Since interrupts can't be sent through the TEN11 interface, the pdp10 can +only service the network at relatively-infrequent intervals, for instance +every 1/60'th of a second. Therefore it is necessary to have queues of +packet buffers in each direction. This provides high speed by allowing +several packets to be processed at a time. + +The speed and reliability of the TEN11 interface eliminates any need for +error checking. (ha ha) [ho ho] To decrease the load on the AI +pdp10, it is assumed that the pdp11's will be responsible for swapping the +bytes in the data portions of packets so that they will be in pdp10 +standard order. + +Even though the contents of packets will not be error-checked, the +pdp10 must check addresses to avoid being screwed by a losing pdp11. + +The form of a packet encapsulated for the TEN11 interface will then be + + |-----------------|-----------------|----| + | queue thread | 0=empty, 1=full | 0 | + |-----------------|-----------------|----| + | #bytes | opcode | unused | 0 | + |-----------------|-----------------|----| + |destination host |destination index| 0 | + |-----------------|-----------------|----| + | source host | source index | 0 | + |-----------------|-----------------|----| + | packet # | ack packet # | 0 | + |-----------------|-----------------|----| + | data 0 | data 1 | data 2 . . . | 0 | + | | 0 | + |-----------------|-----------------|----| + +for a total of 31 36-bit words, or 62 pdp11 words. + +The queue thread is the pdp11 address of the next packet-buffer in +a queue, or zero if this is the last. The empty/full indicator +says whether this buffer currently contains a packet, or not. + +The following is an attempt to express the algorithms of the +pdp10 and pdp11 in concise form. Hopefully they are self- +explanatory. + +Several queues of buffers need to exist in the pdp11. Only +two of these are known to the pdp10. + +TO10QF - first buffer queued for transmission to the 10. + +TO10QL - last buffer queued for transmission to the 10. + Exists so that buffers can be appended to the + list more quickly. + +TO10AC - first buffer in list of buffers actively being + gobbled by the 10. Set by 11, cleared by 10. + +TO10FR - copy of TO10AC. Used to free the buffers after + the 10 gobbles them. + +(come-from pdp11-packet-receivers + when (eq (destination-host ?packet) pdp10) + ;re-arrange 8-bit bytes for 10 + (swap-bytes (data-part packet)) + ;Add to to-10 queue + (set (thread packet) nil) ;nil=0 + (cond ((null TO10QF) + (setq TO10QF packet TO10QL packet)) + (t (set (thread TO10QL) packet) + (setq TO10QL packet))) + ;Try to activate to-10 queue + (cond ((null TO10FR) + (setq TO10FR TO10QF + TO10AC TO10QF + TO10QF nil + TO10QL nil))) +) + +(come-from pdp11-polling-loop + when (and (not (null TO10FR)) ;buffers were sent to 10 + (null TO10AC)) ;and 10 has finished gobbling + (mapcar 'make-buffer-free TO10FR) ;mapcar follows queue words + (setq TO10FR nil) ;OK to activate more buffers now + (cond ((not (null TO10QF)) ; more stuff waiting, activate it now + (setq TO10FR TO10QF + TO10AC TO10QF + TO10QF nil + TO10QL nil))) +) + +(come-from pdp10-clock-level + when (and (not (null TO10AC)) ;11 is sending buffers + (not web-buffers-locked)) + ;copy to user, process control message, or reject if buffers full + (mapcar 'process-input + TO10AC) + ;signal pdp11 that all packets have been gobbled + (setq TO10AC nil)) + + +FRBFLS - list of free buffers. cons-buffer gets from here, + make-buffer-free puts here. + +FM10AC - list of buffers into which pdp10 may place packets + set by 11 / cleared by 10. + +FM10GB - copy of FM10AC, used by 11 to process buffers after + 10 has placed packets into them. + +(come-from pdp11-polling-loop + when (and (null FM10GB) ;10 needs some buffers & + (not (null FRBFLS))) ; free buffers available + ;give the 10 a list of a suitable number of empty buffers + (repeat max-at-a-whack times + (and (null FRBFLS) (exitloop)) + (setq buffer (cons-buffer)) ;pull off free list + (set (full-indicator buffer) nil) ;contains no packet + (set (thread buffer) FM10GB) ;cons onto list + (setq FM10GB buffer)) + (setq FM10AC FM10GB) ;give buffer list to 10 +) + +(come-from pdp11-polling-loop + when (and (not (null FM10GB)) ;gave 10 some buffers + (null FM10AC)) ;which it has used + ;process packets sent from 10. + (mapcar + '(lambda (buffer) + (cond ((null (full-indicator buffer)) + (make-buffer-free buffer)) ;didn't get used + (t (swap-bytes buffer) + (send-to-destination buffer)))) + FM10GB) + (setq FM10GB nil)) ;no buffers active in 10 now + +(come-from pdp10-clock-level + when (and (not (null FM10AC)) ;buffer space avail + (not web-buffers-locked)) ;no M.P. interference + ;send as many packets as possible + (mapcar + '(lambda (buffer) + (cond ((needs-to-be-sent ?packet) ;find a sendable packet somewhere + (copy-into buffer packet) + (set (full-indicator buffer) t)))) + FM10AC) + ;signal pdp11 to gobble the packets + (setq FM10AC nil)) + + +To avoid the need for a gross number of exec pages in the pdp10, +the FM10AC and TO10AC words, and all the packet buffers, should +lie in a single 4K page. The best location for this page varies +from machine to machine. On dedicated 11's such as the AI TV11, +the MC console 11, etc. it should probably just be the first 4K +of memory. On the logo machine, it would probably be best to put +this page up in high memory where RUG won't mess with it. In the +case of the mini-robot system, I'm not sure. + +It would be best not to try to use this protocol with "general +purpose" machines, because of problems with finding the list +headers and packet buffers, problems with telling whether the +machine is running the right program, etc. It should be used +just as a way for the AI machine to get a path to the net. + +>>DL10 & DTE20 + +[Outline only] + +[Just use the pdp11 as a substitute for a direct chaosnet interface.] + +[Basically, the 11 says ready to transfer (in either direction), the 10 +sets up the pointers and says to transfer, and the 11 transfers the cruft. +To eliminate an extra level of buffering, on input transfers the 11 makes a +copy of the first 4 16-bit words of the header available to the 10 when it first +says "ready to transfer." The 10 uses these to decide where to copy the +packet into. It helps if you don't try to use a DL10 on a machine with a +cache.] + +>>Asynchronous line + +Packets are encapsulated by preceding them with start of text (202), +and following them with a 1-byte additive checksum and an end of text (203). +The 16-bit words are transmitted low order byte first. If the checksum +is wrong the receiver ignores the packet. The start and end characters are +just there to help in ignoring random noise on the line. If they don't +appear, the packet is ignored. The full 60-word packet is not transmitted; +the #bytes count is used to determine how many of the data bytes to +transmit; the receiver fills the remainder with zero (or garbage, at its +convenience.) + +This protocol is intended mainly for communication between the plasma +physics pdp11 in bldg. 38 and a pdp11 in 545, until the caiosnet +gets extended that far (or a longer-distance, lower-speed caiosnet +is extended to various machines off in that direction.) diff --git a/sysdoc/chaos.file b/sysdoc/chaos.file new file mode 100644 index 0000000..38f7248 --- /dev/null +++ b/sysdoc/chaos.file @@ -0,0 +1,777 @@ +-*- Mode:Text -*- +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + +Description of the CHAOS FILE protocol designed by HIC. + + The CHAOS FILE protocol is a protocol used to give access to the +file systems of remote hosts on the CHAOS net. Provided that the +foreign host has a CHAOS FILE server, one can read and write files, +delete, rename, etc. The protocol was originally designed to give LISP +machines access to the file systems of our PDP/10's, but is general +enough to support file transfer between 10's, and other purposes. + + We will describe the protocol from the point of view of the +user, i.e., the implementor of a user program communicating to a foreign +server. Hence, terms such as "receive", "send", "input", and "output" +are from a user's point of view, unless explicitly indicated. The first +step in using the protocol is to open what is called a CONTROL +connection to the server on the foreign host. A CONTROL connection is +simply a standard CHAOS net connection to the contact name "FILE" on the +foreign host. The CONTROL connection is used to send commands, and +receive responses and most error message. + + When reading or writing files, actual data is sent over separate +CHAOS net connections called DATA connections. DATA connections are +opened in conjunction with the foreign host, using commands on the +CONTROL connection. Hence, the CONTROL connection must be opened first. +We will present the details below; but here are some preliminary facts +about DATA connections. Like CONTROL connections, DATA connections are +bidirectional. Each half (send and receive) of a DATA connection is +used independently, so two file transfers may be active on a DATA +connection at the same time (but they must be in opposite directions). +There may be more than one DATA connection per CONTROL connection, but +each DATA connection is associated with a particular CONTROL connection. +This is because each CONTROL connection deals with a separate +incarnation of the server at the foreign host. We also note that DATA +connections are re-usable, i.e., can be used for many file transfers. +Simple programs might very well get by with a single DATA connection, +but it is possible to have several (the actual limit depends on +resources of the foreign host, and is 3 for ITS servers, and 8 for +TOPS-20 servers). + + The protocol is organized so that commands and responses have a +fairly uniform syntax. Further, each command (response) is sent +(received) in a single packet. Each command has a field for a unique +identifier, called the transaction id, or "tid" for short, which +identifies it. This is because the protocol permits asynchronous +processing of commands and responses, i.e., you can send a new command +without waiting for the response to the previous one. However, it is a +good idea to read the responses as they come in, so the server will not +block trying to send responses to you. The server is coded so that it +will not block if DATA connection packets back up. + + Let us now discuss the details of command and response packets. +We will discuss error processing later. Each command must be sent in a +separate packet on the CONTROL connection. The packet must have the +packet opcode for ASCII data (%CODAT = 200). When you are done with the +CONTROL connection and wish to disconnect from the foreign host, you +should send an EOF packet (%COEOF = 014) on the CONTROL connection. +This will cause the server to abort any transfers in progress, close all +DATA connections pertaining to this CONTROL connection, and close the +CONTROL connection. + + Responses to commands, successful or not, will come as data +packets (i.e., opcode %CODAT) on the CONTROL connection. The only other +kind of packet you should see on the CONTROL connection (unless there +are network problems) and asynchronous mark packets, which will be +discussed later. + + The contents of a command or response packet is simply the +sequence of ASCII bytes in the data portion of the packet. Fields are +generally separated by either spaces (040) or LISP machine newline +characters (NL = 215). We remark now that certain parts of the protocol +are oriented towards the LISP machine character set, which consists of +256 characters. This is in contrast to the 128 character set standard +on PDP/10's. The printing characters generally have the same +interpretation, though. Later we will explain the character set +translation features provided by the protocol in detail. + + Here is the format of command and response packets: + +command: tid [ fh ] cmd [ args ] +response: tid [ fh ] cmd [ results ] + + means a space character (040), and brackets surround +optional fields. Each field is a sequence of printing characters. Here +is the interpretation and format of the common fields: + +tid: Transaction identifier, used only to help the user program sort + out replies. Only the first 5 characters are significant; the + rest are discarded, and will not appear in a response. Tid's + may vary or be the same, as you wish. + +fh: File handle, used to identify a DATA connection, and a direction + (in/out). That is, each DATA connection has two file handles + associated with it, one for indicating input (transfer to you + from the foreign host), and one for output (transfer from you to + the foreign host). Like tid's, file handles are also unique + only in the first 5 characters. + +cmd: A command name. Only the first 5 characters are actually read + at the current time, but this should not be depended upon. The + full name of the command always appears in the response. + Command names must be presented in upper case. + + The "args" and "results" fields vary depending on the command, +and will be described with each command below. The response to a +particular command will have the same tid as the command, and also the +same file-handle (if relevant), and the same command name. The only +differences are that the tid and file handle in the response will be +truncated to 5 characters, and the command name will always appear in +full. + + Conventions used in the descriptions: + + Numbers we write (e.g., packet opcodes, ASCII codes, etc.) are +in octal, unless followed by a decimal point, in which case they are +decimal. Byte sizes are an exception to this rule: they are always in +decimal, even if not followed by a decimal point. + means an empty field in a packet. + means a sequence of ASCII characters that are all digits +(codes 060 through 071, i.e., '0' through '9'). Such numbers are always +expressed in decimal. These numbers are unsigned, but may have leading +zeroes. (The server may possibly send a negative to you, e.g., +the "-1" of the version field of an OPEN response, but you should never +send a negative to it.) + Some syntax was too long to be presented on a single line here; +we note that there is no CRLF or newline in the packet when we continue +syntax on a second line. That is, all characters in every command or +response are written down explicitly. + A reminder: the end of a command or response is not marked by a +special character, because the length field of the CHAOS net packet +determines where the data ends. + +------------------------------------------------------------------------ + + DATA-CONNECTION + args = ifh ofh + results = + + This is used to open a new DATA connection. The "ifh" and "ofh" +fields are the input and output file handles to associate with this data +connection. Each should be distinct from all other file handles of +other DATA connections pertaining to the same CONTROL. Since this +command does not pertain to any existing file handles, the file handle +field of the command must be omitted. As would be expected, the input +file handle is used to describe the receive half of the DATA connection +and the output file handle is use to describe the send half. + + When the server receives a valid (well-formed, etc.) +DATA-CONNECTION packet, it will attempt to open a new CHAOS net +connection to your host, using "ofh" (the output file handle you +supplied in the command packet) as the contact name. Hence, you should +listen for such a connection. The server will respond to the +DATA-CONNECTION command immediately, even though the new DATA connection +may not yet be open. Of course, you cannot use the connection until it +is open, but you will know that, because you had to open it. + +------------------------------------------------------------------------ + + UNDATA-CONNECTION + args = + results = + + This command is used to close a DATA connection when you are +finished with it. There is probably little occasion to use this, since +any DATA connections will be closed when the CONTROL connection is +closed, and a DATA connection can be re-used for multiple file +transfers. The DATA connection closed is the one whose input or output +file handle appears in the file handle field of the UNDATA-CONNECTION +command. UNDATA-CONNECTION implies a CLOSE on each file handle of the +DATA connection for which there is a file transfer in progress. + +------------------------------------------------------------------------ + + OPEN + args = [ options ] filename + options = option1 option2 ... optionN + results = version date len qfasl + realname + + This command is used to open a file for reading or writing at +the foreign host. The "filename" part is the filename to use at the +foreign host. It is always expressed in the foreign host's file name +syntax. The "options" field will be explained momentarily. If an input +file handle is given in the file handle field of the command, then the +file is to be opened for reading. If an output file handle is given, +then the file is to be opened for writing. In either case the file +handle serves to indicate not only the direction of transfer, but also +the DATA connection to be used for the transfer. A file handle must be +supplied, unless a PROBE is being done. PROBE will be explained below, +but breifly, it permits you to find out information about a file (i.e., +the "results" information of an OPEN response) without actually opening +it. + + The "options" field of the OPEN command consists of a number of +options (most of them are simple ASCII strings), always in upper case, +each preceded by a space (to separate them from the "OPEN" and from each +other). The options permit you to specify whether the transfer is to be +BINARY or CHARACTER, and a number of other things. Some options apply +only to BINARY transfers, and others (character set translations in +particular) only to CHARACTER transfers. Here is a list of the options +and their meaning. + + READ - Indicates that we will be reading a file. This is + redundant, and is checked for consistency (i.e., we must have + given OPEN an input file handle). + + WRITE - Analogous to READ. + + CHARACTER - Specifies that we will be transferring character + data as opposed to binary. This affects the mode in which the + server will open a file, as well as whether or not character set + translations are performed. CHARACTER is the default, so it + need never be specified. The check for QFASL files is not + performed (see below). + + BINARY - Specifies that we will be transferring binary data. A + check is made for QFASL files when reading (the result of the + test is supplied in the response to the OPEN; see below). The + default byte size is 16 bits (see the discussion of byte sizes + below). + + PROBE - This is used to check the existence of a file, and find + out information about it if it exists. The file is not actually + opened. This option is implied if no file handle is given in + the OPEN command. You should not supply a file handle when + doing a PROBE. The response packet will contain the same + information as a response to OPEN'ing the file for reading. + BINARY vs. CHARACTER makes a difference in a probe, as described + in the discussion of the response to OPEN. + +Options pertaining to BINARY transfers only: + + BYTE-SIZE - Specifies to use bytes with bits + each. The interpretation is explained below. + +Options pertaining to CHARACTER transfers only: + + RAW - Suppresses character set translation (see below). + + SUPER-IMAGE - Suppresses rubout quoting (this pertains to + character set translation, see below). + +Options specific to particular foriegn hosts: + + At present there are only two kinds of servers: ITS servers +(e.g., AI and MC) and TOPS-20 servers (e.g., XX, EE, and SPEECH). There +are two options that are specific to TOPS-20 servers (i.e., they do not +work for ITS servers, and should not be presented to them): + + TEMPORARY - TOPS-20 server only: says to use GJ%TMP in the + GTJFN. This is useful mainly when writing files, and indicates + that the foreign operating system is to treat the file as + temporary. See TOPS-20 documentation for more about the + implications of this option. + + DELETED - TOPS-20 server only: says to set GJ%DEL in the GTJFN. + This is useful mainly for READ'ing or in PROBE's, and indicates + that deleted files should be considered when looking for a file. + See TOPS-20 documentation for information about this. + +Details for ITS servers: + + A CHARACTER OPEN will be in .UAI (.UAO) mode when reading + (writing). Similarly, a BINARY OPEN will be in .UII (.UIO) + mode. An OPEN for writing always opens _LSPM_ OUTPUT in the + spcified directory, but does a RENMWO just before the CLOSE, to + the appropriate file names. The server takes care of the + traditional screws associated with the last word of text files, + i.e., you don't have to worry about it -- you will never see the + extra characters. + +Details for TOPS-20 servers: + + GTJFN's - When OPEN'ing for READ or PROBE, GJ%OLD is always set. + When OPEN'ing for WRITE, GJ%FOU and GJ%NEW will be set. These + are independent of the setting of GJ%DEL and GJ%TMP (see the + TEMPORARY and DELETED options, above). + + OPENF's - CHARACTER mode does a 7-bit OPENF, normal mode, with + line number checking off when reading. BINARY mode does a + 36-bit DUMP mode OPENF -- the server handles the packing and + unpacking of bytes within words. + +Open results: + + results = version date len qfasl + realname + + version = a , expressing the version number of the file. + On ITS server, this will be the numeric second name, or the + leading numeric characters of the second name. If the name has + no numerics, the field will be "-1". On TOPS-20 this will be + the generation number of the file. + + date = The creation date of the file, expressed in the form + "mm/dd/yy hh:mm:ss". (That is a real between the date and + the time.) + + len = ASCII digits for the length of the file in the byte size + being read. This will always be 0 when writing. + + qfasl = "T" if we are doing a BINARY READ, and the first word + of the file is "QFASL" in sixbit. "NIL" otherwise. This is + clearly oriented towards LISP machines! + + realname = the full name of the file, e.g., what RFNAME (on ITS) + or JFNS (on TOPS-20) will tell you, when asking for all the + usual fields (device, directory, first name, second name, + generation number). + +------------------------------------------------------------------------ + + CLOSE + args = + results = version date len + realname + + A file handle must be given, and a transfer must be active on +that handle. A synchronous mark will be sent or awaited accordingly, +and the file will be closed (but not the DATA connection). See the +discussion of data transfer protocol, below, for more details. + + The results are mostly as for OPEN. However, the "len" field is +computed differently. For ASCII input, it will be the number of +characters, as returned by FILLEN on ITS. On TOPS-20, it will be the +number of bytes in the file, if it was written using 7-bit bytes, +otherwise, 5 times the number of words. For binary input, it is the +number of words in the file times 2. For ASCII output, "len" is the +exact number of characters written, and for binary output, it is the +number of words times the number of bytes per word for the current byte +size. [This stuff may be buggy anyway.] + +------------------------------------------------------------------------ + + FILEPOS, args = + + This must have a file handle, and it must be an input file +handle. It requests the foreign host to reset its file access pointer +to byte of the file currently open, according to the current byte +size being used. As explained below, this sends a synchronous mark +before starting to send more data. FILEPOS is ILLEGAL for files being +written. + +------------------------------------------------------------------------ + + DELETE + args = or filename + results = + + If a file handle is given the file being read or written on the +specified DATA connection will be deleted after we close it (regardless +of direction). The file handle must refer to an open DATA connection, +and the direction must be correspond to the current transfer. This is +called a "delete while open", or DELEWO. In such a case, DELETE should +have no argument. + + If no file handle is given, then the optional argument must be +present, and specifies a file to be deleted immediately. + +------------------------------------------------------------------------ + + RENAME + args = filename1 [ filename2 ] + results = + + If a file handle is given, only the first filename should be +present, and the file will be renamed to filename1 sometime. This is +called a "rename while open", or RENMWO. On ITS, a RENMWO call is done +immediately. On TOPS-20, a GTJFN is done to filename1, and when we do a +CLOSE on the file handle, the CLOSF is done with CO%NRJ set, and then an +RNAMF is done to the previously obtained jfn. + + If no file handle is given, then both filenames must be present, +and the effect is to rename filename1 to be filename2. Don't forget +that on ITS renaming can only be done within a directory. The server +simply ignores the device and directory parts of filename2, so be +careful. On TOPS-20, renaming from one pack to another will fail. + +------------------------------------------------------------------------ + + CONTINUE + args = + results = + + This must have a file handle, and the indicated channel must be +in the asynchronously marked state. That is, an error of some kind +occurred. If the error might be recoverable, then CONTINUE will try to +resume from it. If the error is non-recoverable, you will get an error +response. See the discussion of marks below. + +------------------------------------------------------------------------ + + SET-BYTE-SIZE + args = nbs [ npos ] + results = + + This must have a file handle, which must refer to a file open in +BINARY mode. Both nbs and npos are 's. "nbs" is the new byte +size, and must be in the range 1 to 16. "npos" is the new position in +the file IN TERMS OF THE OLD BYTE SIZE. The npos part may be omitted +for output files, and is ignored if present (but the second MUST be +there). If npos is omitted for input files, it defaults to 0. This +command sends or awaits a synchronous mark. + +------------------------------------------------------------------------ + + LOGIN + args = userid [ password [ account ]] + results from ITS = uname hsname + persname + results from TOPS-20 = + + This command is for logging in at the foreign host. You must +log in before any OPEN commands will be accepted. Logging in to ITS is +simple: you just give the desired UNAME, which may even legally be +blank. On TOPS-20, the userid must correspond to a real directory +(RCUSR is used), and the password and account are passed to a LOGIN +jsys. For most of our TOPS-20's, userid = ANONYMOUS and password = +ANONYMOUS will give you a login of low privilege. If the first character +in the password is an asterisk, capabilities will be enabled. + +------------------------------------------------------------------------ + + DIRECTORY + args = options pathname + results = same as for OPEN + +The only option currently allowed is DELETED, which says to include deleted +files (TOPS20) or "*" files (ITS). + +The DIRECTORY command is like opening an input file. The possible responses +are the same as for OPEN, except that the affirmative response says DIRECTORY +rather than OPEN. + +The input file that you read consists of a series of records; first a +header and then the name and properties of each file that matches the +pathname, which may contain wildcards in system-dependent fashion. Each +record read consists of a pathname, , a set of properties separated by +, and an extra to separate it from the next record. Each property +consists of the name of the property, optionally followed by a space and +the value. (If no value is present, the property is a yes/no property and +the value is yes). The header record is in the same format; it has a blank +pathname and has the properties for the file system as a whole rather than +for a particular file. + +The properties are not documented here; consult the Lisp machine manual for +a list of the most useful ones. + +------------------------------------------------------------------------ + + COMPLETE + args = options default-pathname string + results = status new-string + +This does filename completion. String is a filename typed in by the user +amd default-pathname is the default name against which it is being typed. +The filename is completed according to the files present in the file system +and the possibly-expanded string is returned. + +Allowed options are DELETED, READ, WRITE, OLD, NEW-OK. DELETED means not +to ignore deleted files; this applies to Tenex and TOPS-20 only. READ +means the file is going to be read (this is the default). WRITE means the +file is going to be written, and affects version number defaulting. OLD +means an existent file is required (this is the default). NEW-OK means that +it is permissible for the string to complete to the name of a file that does +not exist. + +The returned status is NIL, OLD, or NEW. NIL means that an error occured, +OLD means that the string completed to the name of an existent file, NEW +means that the string completed to a legal filename which is not the name +of an existent file. + +------------------------------------------------------------------------ + + CHANGE-PROPERTIES + args = filename property-name new-value ... + results = + +This allows you to change one or more properties of a file. The properties which +are legal to change are those in the SETTABLE-PROPERTIES property of the header +record returned by the DIRECTORY command. The legal values for yes/no +properties are T and NIL. + +------------------------------------------------------------------------ + +About character set translations: + + As mentioned somewhere above, the protocol was originally +designed to provide access to PDP/10 file systems for LISP machines. +LISP machines support 8-bit characters, and hence have 256 characters in +their character set. This results in minor difficulties when conversing +with PDP/10's, which prefer 7-bit characters. Translations apply ONLY +to CHARACTER transfers, not BINARY transfers. Below is a table showing +the "normal" (i.e., default) correspondence between LISP machine and +PDP/10 characters. Some LISP machine characters expand to more than one +PDP/10 character. The notation "x in " means "for all +character codes x such that c1 <= x <= c2." + + LISP machine character PDP/10 character(s) + + x in <000, 007> x + x in <010, 012> 177 x + 013 013 + x in <014, 015> 177 x + x in <016, 176> x + 177 177 177 + x in <200, 207> 177 + x in <210, 212> + 213 177 013 + 214 014 + 215 015 012 + x in <216, 376> 177 + 377 no corresponding code + + This table may seem confusing at first, but there ARE some +general rules about it that should make it appear more sensible. First, +LISP machine characters in the range <000, 177> are generally +represented as themselves, and x in <200, 377> is generally represented +as 177 followed by . That is, 177 is used to quote LISP +machine characters with the high bit on. It was deemed that 177 is more +important than 377, so 177 177 means 177, and there is no way to +describe 377 with PDP/10 characters. On the LISP machine, the +formatting control characters appear shifted up by 200. This explains +why the preferred mode of expressing 210 (backspace) is 010, and 010 +turns into 177 010. The same reasoning applies to 211 (tab), 212 +(linefeed), 214 (formfeed), and 215 (newline). However, newline has an +added twist -- it is supposed to start at the beginning of a new line, +so it is deemed equivalent to 015 012 (CRLF) in PDP/10 characters. When +converting PDP/10 characters to LISP machine characters, an 015 always +turns into a 215; however, if it is followed by an 012, the 012 is +skipped. + + The above table applies in the case of NORMAL translation, i.e. +the default translation mode. Note that the server ASSUMES the user is +a LISP machine, and that all our servers are PDP/10's, so the labellings +"LISP machine" and "PDP/10" can be thought of as "user" and "server". + + The other translation modes available are: + + RAW - perform no translation (PDP/10 characters simply discard + the high order bit of LISP machine characters, and LISP machine + characters supplied by a server will always be in the range + <000, 177>. + + SUPER-IMAGE - This suppresses the use of rubout for quoting. + That is, each entry beginning with a 177 in the PDP/10 column of + the translation table presented above, has the 177 removed. The + PDP/10 character 015 always maps to the LISP machine character + 215, as in normal translation. Here is the corrected table: + + LISP machine character PDP/10 character(s) + + x in <000, 177> x + x in <200, 214> + 215 015 012 + x in <216, 376> + 377 no corresponding code + + User programs written for PDP/10's probably do not wish to have +any of the above translations performed, since they are using the PDP/10 +7-bit character set. Hence, RAW is probably what you want. It is also +the most efficient method of transferring ASCII data using the protocol. + +---------------------------------------------------------------- + +Data transfer and byte packing issues: + + Once a DATA connection has been established, and an OPEN has +succeeded, data transfer proceeds by sending/receiving packets on the +appropriate DATA connection. CHARACTER data is always in packets with +opcode %CODAT (200), and BINARY data in packets with opcode 300 octal. +Consider the data portion of a packet as a sequence of 8-bit bytes, in +the fashion usual for the CHAOS net. Then CHARACTER data is always +packed one character per packet byte. The organization is such that a +standard PDP/10 byte pointer of size 8-bits can be used to load or store +characters into a packet sequentially. (As usual, the low 4 bits of +each 36-bit word is ignored, and not even transmitted on the CHAOS net.) +There are no particular restrictions on the minimum or maximum sizes of +data packets, other than hardware or operating system limits. The +server will always send the largest packets it can. + + The situation with BINARY data is slightly more complicated. We +must consider the data portion of a packet as a sequence of 16-bit +bytes. Each 16-bit byte consists of two 8-bit bytes, with the first of +the two 8-bit bytes being the high-order half of the 16-bit byte. (This +corresponds to PDP/10 conventions, but is the opposite of PDP/11 +conventions regarding byte packing.) Each byte of binary data sent is +stored in one 16-bit byte in the packet. If the byte size is less than +16-bits, then the byte is right-justified within the 16-bits, with the +remaining high order bits set to unpredictable values. The organization +is such that loading or storing sequential bytes in a packet can be done +with a standard PDP/10 byte pointer of byte size 16 bits, and transfer +of the bytes so obtained to or from words of files can be done with a +byte pointer of the size in use for the transfer. + + Each packet of BINARY data should contain an integral number of +16-bit bytes, i.e., it should have an even nmber of 8-bit bytes. If it +does not, the odd byte is discarded. The server always sends binary +packets with an even number of 8-bit bytes. + + For transferring all 36 bits of a PDP/10 word to another 36 bit +machine, the byte size must divide 36. The most efficient value is 12, +since it is the largest divisor of 36 that is not greater than 16, which +is the largest byte size supported by the protocol. + +---------------------------------------------------------------- + +Protocol issues in data transfer: + + In addition to just data packets, some other kinds of +informative packets are sent or received on the DATA connection. + + EOF packets (opcode 014) are used to mark end of file when +reading or writing. That is, when you are writing a file and come to +the end of what you wish to write, you will send an EOF packet to tell +the server it has reached the end. Similarly, you will receive an EOF +packet at the end of a file when reading. EOF packets are always empty +(i.e., contain no data). There are additional details about closing a +file, however; read on. + + In addition to EOF packets, SYNCHRONOUS MARKS (opcode 201) are +used to separate groups of packets in the transfer, mainly for purposes +of matching up with FILEPOS and SET-BYTE-SIZE commands. You will +receive a synchronous mark on the DATA connection sometime after each +successful FILEPOS and SET-BYTE-SIZE command. These marks indicate the +place in the data stream where the command actually occurred. They are +necessary because the server may be several packets ahead of you in +sending data, and without the marks there would be no easy way to tell +where the previous information ended and the new information starts. A +synchronous mark is also sent in response to a CLOSE command when +reading, and expected after an EOF when writing. The mark after a CLOSE +when reading allows you to find the end of the data packets for that +transfer, if you decide to stop the transfer in the middle. The mark +after EOF when writing performs a similar function for the server if you +terminate the transfer in the middle. + + When writing, you should send a synchronous mark on the DATA +connection whenever you perform a successful SET-BYTE-SIZE command, and +also as part of a CLOSE, as described above. All other synchronous +marks are ones that you will receive. + +Examples: + +1) Reading a file. Assume you have a CONTROL connection and an idle +DATA connection. Send an OPEN command, and await the response. Then +start reading data packets from the data channel. The transfer will +continue unless you stop it. Suppose you have read all the file. Then +you will see an EOF packet. Send your CLOSE command, to order the file +closed, and await a SYNC mark on the DATA connection, indicating that +the close is in fact done, and the DATA connection can be re-used for +some other purpose. If you decide to quit in the middle, send a CLOSE +command, and get the response, and read packets from the DATA connection +until you see a SYNC mark. (This assumes that there would be no other +SYNC marks in transit because of, say, a previous FILEPOS command, etc. +If there were any of those, you will have to wait through the +appropriate number of SYNC marks.) + +2) Writing a file. Again assume you have established a CONTROL and DATA +connection. Send the OPEN command and await the reponse. Then start +writing packets on the DATA connection. Assuming there are no problems, +send an EOF. WAIT FOR THE EOF TO BE ACKNOWLEDGED BY THE SERVER. (That +is, a CHAOS net acknowledgement indicating that the server has actually +read the EOF packet.) Now send a SYNC mark on the DATA connection and a +CLOSE on the CONTROL connection (in either order). If you do not wait +for the EOF to be acknowledged, and you send a CLOSE anyway, the file +may be truncated because some data packets may not have been processed +by the server. + +---------------------------------------------------------------- + +Errors and Ansynchronous marks: + + ASYNCHRONOUS MARK packets (opcode 202) indicate error conditions +in the transfer, such as running out of disk space or allocation. Some +of these may be recoverable, some not. When reading, an asynchronous +mark will come in over the appropriate DATA connection. When writing, +it will come in on the CONTROL connection. (The DATA connection is not +used in this case because the receive half might be in use for another +transfer). Here is the format of an asynchronous mark packet: + + tid fh ERROR erc c message + +That is, it looks like a regular error response packet, except that it +has a different opcode (responses are data packets, opcode 200). The +tid should be ignored -- it will be somewhat random (whatever happens to +to be lying around). The file handle, fh, is useful when writing, to +see which DATA connection the error happened to. The "erc" part is a 3 +character error code (a table of them is presented below, subject to +change without notice). The single character "c" will be either "R" +(for recoverable) or "F" (for fatal). A recoverable error can be +restarted from by sending an appropriate CONTINUE command. A fatal +error cannot be recovered from, and an appropriate CLOSE should be +performed. The "message" part is an ASCII error message, possibly +obtained from the host operating system. + +Error codes: + +Flag codes: + C = command error (comes in data packet with cmd = "ERROR", on + the CONTROL connection). + F = fatal asynchronous error. + R = restartable asynchronous error. + +Flag Code Message, Causes, Possible Diagnosis + +C CCC - CHANNEL CANNOT CONTINUE + CONTINUE not possible. +C CNO - CHANNEL NOT OPEN + CLOSE on non-open channel. +C CRF - CANNOT RENAME OUTPUT FILE TO REAL NAMES + Final RENMWO for CLOSE on ITS failed. +F CSP - CANNOT SET POINTER + Response to this failure in FILEPOS or SET-BYTE-SIZE. +C FNF - message varies, depending on reason (FILE NOT FOUND). + Failing OPEN. +C IBS - ILLEGAL BYTE SIZE + Response to byte size not in range 1 - 16. +F IDO - ILLEGAL DATA OPCODE + Bad packet opcode in the range 200 - 377 (you should use + 200 for CHARACTER data, and 300 for BINARY) +C IFH - ILLEGAL FILE HANDLE FOR FILEPOS + Only input file handles are legal. +R IOC - message varies (INPUT OUTPUT CONDITION). + Generic code for possibly recoverable failures. This + will be sent in an ASYNC mark packet. +F IPO - ILLEGAL PACKET OPCODE + Received a packet with an illegal opcode, or a SYNC or + ASYNC mark when not expected. +C IRF - ILLEGAL REQUEST FORMAT + Generic response to ill-formed command. +C ISC - ILLEGAL CHANNEL FOR SET-BYTE-SIZE + SET-BYTE-SIZE may only be done on BINARY channels. +C NCN - NULL COMMAND NAME + Particular case of a bad command. +C NER - NOT ENOUGH RESOURCES + Possible causes are: no more I/O channels/jfns available + for new DATA connections, system failure to open a new + CHAOSnet channel, and inability to lookup a user's info + in LOGIN. +C NLI - NOT LOGGED IN + OPEN cannot be done until you are logged in. +C TMI - TOO MUCH INFORMATION + This happens if a response or error packet overflows. +C UFH - UNKNOWN FILE HANDLE + Particular case of an ill-formed command. +C UKC - UNKNOWN COMMAND + Particular case of an ill-formed command. +C UNK - USER NOT KNOWN + Bad LOGIN (TOPS-20 only). +C UOO - UNKNOWN OPEN OPTION + Obvious problem. +F xxx - ??? When a file system or other operating system call + fails, which is not covered in the above, then another code is + used. These are taken from a table for ITS, with the message + read from the ERR: device, and on TOPS-20, the letters are the + first letters of the first three words of the error message + returned by an ERSTR call. The only exception is code FNF, + special cased if the error is GJFX24 ("file not found") or OPNX2 + ("file does not exist") on TOPS-20. No other FNF's will come + from TOPS-20, even by "accidient" -- a special check is made. diff --git a/sysdoc/clo.100 b/sysdoc/clo.100 new file mode 100644 index 0000000..53a4948 --- /dev/null +++ b/sysdoc/clo.100 @@ -0,0 +1,186 @@ +-*-Text-*- Alan 12/31/83 +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + +Here is what I know about the core link device(s). + +The core link device is a primitive mechanism for connecting two jobs +together with a uni-directional stream. The basic idea is very simple: +suppose job A opens CLO:FOO;BAR BAZ for input and job B opens +CLO:FOO;BAR BAZ for output, then by virtue of the fact that they used the +same name (FOO;BAR BAZ) they are connected together and anything job B +happens to output to its channel will be what job A reads from its channel. +For many simple hacks, that's all you really need to know about it! + +The core link device is not a random access device. Only the most basic +system calls are supported (like OPEN, IOT, SIOT, STATUS, RFNAME, and +CLOSE). There is no way for either job to cause the other to receive a +second word interrupt. For more advanced applications where a more +complicated interface is desired the JOB device can be used. See +.INFO.;ITS JOBONL (or .INFO.;ITS JOB). + +ITS keeps an I/O buffer for each core link, so the two jobs will not +actually be kept running in lock-step. The outputting job will wait when +it tries to output only if the buffer becomes full, and the inputting job +will wait when it tries to input only if the buffer becomes empty. The +buffer is about 100. words long. Because of this buffering it is not +necessary for both jobs to open their channels in identical modes, one job +can read (write) 36-bit words while the other is writing (reading) 7-bit +characters. [This should be contrasted with the JOB device, where ITS +cannot keep any internal state for the JOB/BOJ connection because of +PCLSRing considerations.] + +If the reading job closes its input channel, the writing job's output +channel acts like the NUL device. All output is simply discarded. If the +writing job closes its output channel, the reading job's input channel acts +like it has reached end of file (after it has read whatever remained in the +buffer of course). [Actually, in .UII mode if you IOT beyond end of file +it starts returning random 36-bit words. It should be fixed to generate an +IOC interrupt like other devices do at EOF in .UII mode. I guess it really +doesn't matter much since you don't open things in image mode unless you +know exactly what they are anyway...] + +There are actually 4 core link devices: CLO (Core Link Open), CLU (Core +Link Use), CLI (Core Link Interrupt), and CLA (Core Link Answer). The +differences between them all have to do with what happens when you open +them. In fact, after you have completed the process of opening a channel +with any of these devices, an RFNAME call on that channel will always +report that it is the CLO device, since from that point on they all behave +identically. + +In order match up jobs that desire to use the core link device, ITS +maintains a table called the "core link directory". At any given time the +core link directory contains a number of "core links". Each core link has +three names: an SNAME, a first name, and a second name (SNAME;NAME1 NAME2). + +When a job tries to open CLO:FOO;BAR BAZ, ITS searches the core link +directory for a core link named FOO;BAR BAZ. If no core link is found with +that name, then a new core link is created with that name and entered in +the directory. (If the core link directory gets full a %EFLDR error can be +returned at this point.) + +The CLU device behaves identically to the CLO device, except that if no +existing core link has the proper name then instead of creating a new one, +a file not found error is returned (%ENSFL). Thus you should use the CLU +device when you are certain that some other job has already created a core +link of a given name. + +Also potentially associated with each core link is a pair of jobs. One for +reading, and one for writing. After an appropriately named core link has +been located or created, ITS checks to see whether some other job already +has this core link open in the same direction. If so, a file locked error +is returned (%ENAFL), otherwise this job is recorded as the one reading or +writing the core link, and the channel is successfully opened. + +You can list the core link directory. Opening CLO:.FILE. (DIR) will +allow you to read a table like the following: + + SNAME NAME1 NAME2 ALAN A -> ALAN B + SPAZM FOOBAR 259 CLOSED-> ALAN A + QAZWSX FOOBAR 259 ALAN FOOBAR-> CLOSED + FOO BAR BAZ CLOSED-> CLOSED + +(Try typing CLO^F to DDT. Probably the core link directory will be empty, +so you won't seen anything interesting.) + +This table is interpreted as follows: + + SNAME NAME1 NAME2 ALAN A -> ALAN B + ^ ^ ^ ^ ^ ^ ^ + | | | | | | | UNAME and JNAME of + | | | | | +------+--- job reading from + | | | | | this core link. + | | | | | + | | | | | UNAME and JNAME of + | | | +------+---job writing into + | | | this core link. + | | | + | | | SNAME and first and + +------+------+---second names for + this core link. + +If no job is reading from the core link, the word CLOSED will appear after +the arrow instead of a UNAME/JNAME pair. Similarly if no job is writing +into the core link, CLOSED appears before the arrow. + +If you are trying to debug something that uses the core link device, a +listing of the core link directory is a valuable debugging aid. + +In the core link directory listing above, the core link named FOO;BAR BAZ +has neither an associated reading nor writing job. You might think that +such a core link would be worthless, but this is not necessarily the case! +Suppose that job A opens CLO:FOO;BAR BAZ for output intending to only +transmit 100. ascii characters through the link. Since 100. characters can +easily fit in the core link's buffer, job A can output all 100. characters +and close its channel before the reading job even gets as far as opening +its channel. Thus for a brief time the core link has no associated jobs. + +Unfortunately there is no way to guarantee that any job will ever open the +core link FOO;BAR BAZ for input to pick up those 100. characters. For this +reason ITS will garbage collect any core link that has not had any +associated jobs for several minutes (about 5 minutes). + +You can also delete core links from the core link directory yourself. Thus +from DDT you can type "^O CLO:FOO;BAR BAZ" to get rid of a garbage core +link. Normally there is no need to do this, since ITS will flush them +eventually anyway. [Indeed, it is a BAD idea to use this feature currently +because there is a bug such that instead of deleting the core link, you +sometimes cause it to become permanently locked down. Since there are a +finite number of core links (12. currently), if you do this often enough +you will render the core link device unusable.] + +A reasonable person might wonder what happens if some job tries to re-open +the core link FOO;BAR BAZ for output and write more characters into it. +Well, each core link actually acts as a SEQUENCE of files separated by +end-of-file markers. If a second job opens CLO:FOO;BAR BAZ and writes more +data into it, that data will be available to the SECOND job that opens that +core link for input. Thus if one job is in a loop opening the core link +named FOO;BAR BAZ, outputting a single character, and then closing it +again, and a second job is in a loop opening that core link, reading +characters until end of file, and then closing it again, then the second +job will see a sequence of single character length files. + +We haven't yet mentioned the CLI and CLA devices. These two devices enable +one job to interrupt another job indicating that it wishes to send a +message through a core link. This is how interactive messages work on ITS. + +The sending job opens the CLI device with first and second filenames equal +to the UNAME and JNAME of the job that it wishes to interrupt. For +example, a job might try to open CLI:CSTACY HACTRN (any SNAME supplied will +be ignored). ITS then checks to see that a job named CSTACY HACTRN really +does exist. If it does, ITS checks to see that that job has enabled the +%PICLI interrupt. If it is not the case that both conditions are met, the +open returns an illegal file name error (%EBDFN). If both conditions are +met, then we proceed as if we were opening CLO:_CLI_;CSTACY HACTRN. If +that succeeds, then we actually give the job CSTACY HACTRN the %PICLI +interrupt, and the open succeeds. + +The UNAME and JNAME of the sending job are now placed in the core link's +I/O buffer so that the receiving job will be able to read them out before +any additional data that the sender might wish to transmit. (Note that you +can only open the CLI device for output.) + +In order to handle the %PICLI interrupt the job CSTACY HACTRN opens CLA: +(any additional names supplied will be ignored). This is like opening +CLU:_CLI_;CSTACY HACTRN, except that it saves the interrupted job from +having to figure out its own name. The receiving job can now read the +UNAME and JNAME of its interrupter by inputting the first two 36-bit words +from the newly opened channel. + +The jobs are now talking through an ordinary core link named +_CLI_;CSTACY HACTRN. diff --git a/sysdoc/ddt.bugs b/sysdoc/ddt.bugs new file mode 100644 index 0000000..06f07b1 --- /dev/null +++ b/sysdoc/ddt.bugs @@ -0,0 +1,4197 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Tue, 10 Apr 90 05:44:53 EDT +From: Devon Sean McCullough +Sender: DEVON0@AI.AI.MIT.EDU +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <719848.900410.DEVON0@AI.AI.MIT.EDU> + +the ^A command initially defaults to XUNAME, probably should be UNAME instead? + +Date: Sat, 17 Mar 90 13:44:03 EST +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <712025.900317.DEVON@AI.AI.MIT.EDU> + +is there any reason why [MESSAGE FROM ...] is all caps? As long as I'm making a new version I would like to change that. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 11 Mar 90 02:50:01 EST +Received: from ai.ai.mit.edu by mintaka.lcs.mit.edu id aa28273; + 11 Mar 90 2:43 EST +Date: Sun, 11 Mar 90 02:45:36 EST +From: Alan Bawden +Subject: Most Alarming +To: ZVONA%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +cc: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-reply-to: Msg of Fri 9 Mar 90 16:04:36 EST from David Chapman +Message-ID: <709638.900311.ALAN@AI.AI.MIT.EDU> + + Date: Fri, 9 Mar 90 16:04:36 EST + From: David Chapman + :alarm should accept jcl of the form .+t, not just absolute times. + (I almost always want relative, not absolute.) + +Boy are you ever right. I can't tell you how often I have thought the same +thing. But if you ever looked at the code in DDT that parses the argument +to :ALARM, you'd understand why I haven't done anything about it. + + +Date: Fri, 9 Mar 90 16:04:36 EST +From: David Chapman +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <709226.900309.ZVONA@AI.AI.MIT.EDU> + +:alarm should accept jcl of the form .+t, not just absolute times. +(I almost always want relative, not absolute.) + +Date: Tue, 6 Mar 90 14:08:36 EST +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <707938.900306.DEVON@AI.AI.MIT.EDU> + +did it again. This time I'll actually look at it. + +Date: Thu, 11 Jan 90 21:19:13 EST +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <687775.900111.DEVON@AI.AI.MIT.EDU> + +got a bug upon reattaching. + +Date: Mon, 2 Oct 89 10:55:40 EDT +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <650549.891002.DEVON@AI.AI.MIT.EDU> + +$0u when not logged in +offers --MSGS-- after logging you in. + +Date: Sat, 9 Sep 89 23:31:06 EDT +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <642536.890909.DEVON@AI.AI.MIT.EDU> + +the usual bug message upon reattaching after network disconnected for no particular reason + +Date: Wed, 9 Aug 89 01:04:56 EDT +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <631514.890809.DEVON@AI.AI.MIT.EDU> + +I'm connected uchicago->ghoti->ai, but a moment ago I lost my connection. +reconnecting to ghoti thence chsupdup ai thence --attach your detached tree-- +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO ... + +Date: Sat, 1 Jul 89 13:10:39 EDT +From: Devon Sean McCullough +To: BUG-DDT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <616466.890701.DEVON@AI.AI.MIT.EDU> + +I left my terminal idle for a long time, when I returned and reexposed the window +I got some emacs mode line updates (I have it display the time) and a DDT BUG message +and then the lispm said attempt to receive on broken chaos connection or something. + +Date: Sun, 14 May 89 12:27:21 EDT +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <594989.890514.DEVON@AI.AI.MIT.EDU> + +PS: it it had said NO START ADDR? that would not have been startling but it tried to run at zero when I did F^H later. + +Date: Sun, 14 May 89 12:23:58 EDT +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <594988.890514.DEVON@AI.AI.MIT.EDU> + +I typed F ^H ^G (my finger slipped) and it made an empty job named F. +I can't object to this behavior but I was startled. + +Date: Mon, 17 Apr 89 17:49:28 EDT +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <579062.890417.DEVON@AI.AI.MIT.EDU> + +I unexpected disconnected (unix lossage) and upon reconnecting and attaching my detached tree I got the ddt bug message. + +Date: Sat, 4 Mar 89 13:41:32 EST +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <549317.890304.DEVON@AI.AI.MIT.EDU> + +--Attach Your Detached Tree-- +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE ... + +Date: Wed, 22 Feb 89 20:33:36 EST +From: "Robert E. Seastrom" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <542995.890222.RS@AI.AI.MIT.EDU> + +Hello... I just reattached a detatched tree after unintentionally dropping +a Chaos connection, and it told yme to write you and tell what happened... + + + ---Rob (RS) + +Date: Tue, 21 Feb 89 09:49:57 EST +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <541826.890221.DEVON@AI.AI.MIT.EDU> + +connecting via terminus: +ai its.1632. pword.2659. +tty 20 +... +--attach your detached tree-- +hactro$j!:$ reowned $ + ddt bug: please do :bug ddt descriing circumstances. +Mail from ... +^Z?? ... :bug ddt ... + +Date: Sun, 12 Feb 89 15:02:14 EST +From: David Chapman +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <536722.890212.ZVONA@AI.AI.MIT.EDU> + +We were out of disk space, so I moved a bunch of stuff from usersn; +to second:. But after not very long, it wouldn't let me do it any more, +complaining + +DSK:USERS3;_COPY_ OUTPUT -- DEVICE FULL + +Does this mean that SECOND: is full? If so, it should say so. +(And "someone" should run a gfr...) + +Date: Sat, 14 Jan 89 19:37:31 EST +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <520170.890114.DEVON@AI.AI.MIT.EDU> + +AI ITS.1616. PWORD.2659. +TTY 15 +3. Lusers, Fair Share = 61% +*devonu +Password: +[OK] +--Attach Your Detached Tree-- +HACTROJ: Reowned  + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +Mail from MAILER-DAEMON@EDDIE.MIT.EDU (Mail Delivery Subsystem) (111. lines) +?? :bug ddt +Msg: +AI ITS.1616.....well, I could go on, but those are the circumstances. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 1 Jan 89 20:01:01 EST +Received: from NULLSTELLENSATZ.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 158580; Sun 1-Jan-89 19:55:56 EST +Date: Sun, 1 Jan 89 19:56 EST +From: David Chapman +To: bug-send@AI.AI.MIT.EDU +Message-ID: <19890102005613.1.ZVONA@NULLSTELLENSATZ.AI.MIT.EDU> + +Presumably no one cares, but: + +I got a send from an nli job, and replied to it, and it bitched +that the host MIT-AI was unknown, but succeeded in sending it anyway. +The error message had a raw ^P code in it, which suggests that someone +never tested that piece of code at all... + +Date: Tue, 6 Dec 88 01:39:03 EST +From: Mark Becker +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <499265.881206.MBECK@AI.AI.MIT.EDU> + +While running FR I had a line drop. + +On reconnecting, I logged in, declined to attach to my detached tree, and +let my LOGIN file complete. This sets up a CRTSTY. + +On completion of the LOGIN, I did HACTRO$J to re-own the tree. + +That is when I received the message to send BUG-DDT a note. + +Regards, +Mark + +Date: Sun, 13 Nov 88 18:21:19 EST +From: Igor Rivin +Sender: RIVIN0@AI.AI.MIT.EDU +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <485266.881113.RIVIN0@AI.AI.MIT.EDU> + +I just did "f orca@wc", and got a ddt bug +message. The finger then proceeded to succeed without problems, +except for telling me that "Job F finished", which is somewhat unusual. + +Date: Wed, 2 Nov 88 23:04:23 EST +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <477868.881102.DEVON@AI.AI.MIT.EDU> + +I attached my detached tree and it reported a bug. +Nothing unusal to report, don't know why it did it. + +Date: Wed, 3 Aug 88 11:31:41 EDT +From: Henry Minsky +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <422033.880803.HQM@AI.AI.MIT.EDU> + +I logged in from the terminal in alans office. +ITS said --attach your detached tree-- , and i typed +Then it said +HACTRO$J!:$ REOWNED $ +DDT BUG ... + + +Date: Mon, 6 Jun 88 17:12:56 EDT +From: "Michael A. Patton" +Subject: What fun, Oh joy a DDT bug +To: BUG-DDT@AI.AI.MIT.EDU +cc: MAP@AI.AI.MIT.EDU +Message-ID: <392828.880606.MAP@AI.AI.MIT.EDU> + +These are the circumstances as far as I can reconstruct them: + +I was logged in, idle at a DDT prompt (as far as I can recall) from my +workstation using Chaos SUPDUP. The connection was lost (I don't know +the details because that window was hidden and timed-out while I wasn't +looking). When I opened a new connection (same size window, etc.) and +logged in it said (as I expected): +--Attach Your Detached Tree-- +to which I replied with a space and got: +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +From whence I typed this description in. I don't know if there are any +other facts you want, if so please feel free to ask and I'll try and +remember as best I can. + + Mike Patton + +Date: Mon, 7 Mar 88 16:22:11 EST +From: Jonathan A Rees +Subject: Trivia question +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <337471.880307.JAR@AI.AI.MIT.EDU> + + +Can anyone tell me what "NOS" is mnemonic for? Just to jog your +memory, it's the error you get if you say something like "1@2" to DDT. +The source code isn't very helpful: + +EFLDNO: TLO F,FLNNUL ;NOT AN OP - FIELD NOT NULL. + SKIPL (P) ;PREVIOUS WASN'T OP => CONSEC. ARGS, ERROR. + JRST EFLNOS + ... + +EFLNOS: 7TYPE [ASCII / NOS/] + MOVE D,[O.OP+"+,,OPTAB0+"+-1] ;+ + JRST EFLD4 + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 8 Feb 88 15:18:00 EST +Received: from FORD.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 8 FEB 88 15:17:42 EST +Date: Monday, 8 February 1988, 15:18-EST +From: Devon Sean McCullough +To: bug-ddt@ai + +My screen looked something like this: + +devonu +Password: +[OK] +^_j PUR? DDT BUG, PLEASE DO :BUG DDT ... + +Perhaps DDT can't handle %PIJST while starting up? + +Date: Fri, 8 Jan 88 15:48:45 EST +From: Devon Sean McCullough +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <308832.880108.DEVON@AI.AI.MIT.EDU> + +in ddt 1544, logging in with 1u runs my init file. + +Date: Thu, 31 Dec 87 05:27:36 EST +From: John Bunch +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <305300.871231.HACKIT@AI.AI.MIT.EDU> + +I cant seem to get a message describing the commands in ddt. When I try I +get a line that says: + +DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. + +All I tried to do was a :? + + +Date: Wed, 21 Oct 87 23:29:25 EDT +From: Igor Rivin +Sender: RIVIN0@AI.AI.MIT.EDU +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <272666.871021.RIVIN0@AI.AI.MIT.EDU> + +I was having a converstion with someone over the machine (via :reply) +and as I was spying upon my correspondent (by :rwk;f) I got stuck +in spy mode (Ie interrupts like space, ^Z, ^G, etc...) wouldn't get me +out. Also, the :reply's directed to me once I was in this state +got lost. This is not the first time this happened...What is happening? + +Tnx + +Date: Mon, 18 May 87 19:20:02 EDT +From: Kent M Pitman +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <201833.870518.KMP@AI.AI.MIT.EDU> + +I did KMP^F and then did ^O and tried to mouse on the filename +but it did not respond by inserting its name. + +Date: Tue, 12 May 87 11:38:10 EDT +From: Ed Schwalenberg +Subject: Flakey behavior +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <198871.870512.ED@AI.AI.MIT.EDU> + +Several times now, I've had the following happen: +I've typed $$v and been told I had no jobs, and gotten a prompt. Then I +typed u^K, and nothing happens. Peek claims that my HACTRN is doing TTYI. +Typing ^L clears my screen, but does NOT redisplay any buffered input. +If I quit out with ^G, everything returns to normal. An example of a HACTRN +in this state is ED HACTRO on AI. + +I was using :CRTSTY H1510 this last time; I don't remember if I was +using CRTSTY on the other occasions. + +Date: Wed, 29 Apr 87 15:58:51 EDT +From: Chris Hanson +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <192871.870429.CPH@AI.AI.MIT.EDU> + +My tree was detached because the network connection was interrupted by +the local machine (kleph.ai.mit.edu). Later, I re-connected, logged in, +and answered yes when asked if I wanted to attach my detached tree. +It printed: + +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. + +The detached tree was running the HACTRN job, and had one other job, +an E, stopped. + +Date: Thu, 23 Apr 87 06:06:45 EDT +From: Alan Bawden +Subject: :MSGS fixed, %PIJST handler installed +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <189547.870423.ALAN@AI.AI.MIT.EDU> + +I just installed a new DDT that has a fix to make the :MSGS command +function as well as it did before the advent of "Received:" lines (I fixed +GMSGS as well). Note that the most recent source for DDT was not installed +since since it has some half-implemented ^_J (%PIJST) code in it. This +code seems to be fairly harmless, so it is now installed. + +Date: Wed, 15 Apr 87 21:40:15 EDT +From: David Chapman +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <185434.870415.ZVONA@AI.AI.MIT.EDU> + +This may of course be related to Alan's taking the machine down at the +moment. + +Date: Wed, 15 Apr 87 21:38:34 EDT +From: David Chapman +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <185432.870415.ZVONA@AI.AI.MIT.EDU> + +My connection to AI got lost. I got a new connection, did :reatta zvona, +and it claimed it got a DDT bug and asked me to report it. One funny +symptom: I was in emacs at the time the connection was lost, and when +I got the job back I was in DDT, but the emacs mode line continued to +redisplay itself. + +Received: from SRI-NIC.ARPA (TCP 1200000063) by AI.AI.MIT.EDU 15 Apr 87 02:05:24 EDT +Date: Tue 14 Apr 87 23:02:02-PDT +From: Mark Lottor +Subject: send host name +To: bug-send@AI.AI.MIT.EDU +Message-ID: <12294619505.27.MKL@SRI-NIC.ARPA> + +I just got a send from someone on AI.AI.MIT.EDU, +it came out as + +"user@AI" which made it a bit hard to reply to... +------- + +Date: Wed, 4 Mar 87 13:27:02 EST +From: "Devon S. McCullough" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <163079.870304.DEVON@AI.AI.MIT.EDU> + +Devon1u ran my init file. I was in DDT, not pword. +Devon0u ran some sort of default init, which I guess is right. + +Received: from umn-cs.arpa (TCP 20031360001) by AI.AI.MIT.EDU 1 Mar 87 17:36:10 EST +Received: by umn-cs.arpa (5.51/4.7) + id AA15402; Sun, 1 Mar 87 16:33:27 CST +Date: Sun, 1 Mar 87 16:33:27 CST +From: haque@umn-cs.arpa (Samudra E. Haque) +Message-Id: <8703012233.AA15402@umn-cs.arpa> +To: bug-ddt@ai.ai.mit.edu, devon@ai.ai.mit.edu, haque@umn-cs.arpa +Subject: attempt to explain anomaly + + + +I hope I can explain this .. :-) + +Okay, I am working from my office here at the computer science dept, +at the University of Minnesota. I usually use a z-29 in ansi mode, and +use the telnet program off our VAX/UNIX 4.3 bsd to connect to you. + With that setup, I offer: + + When I telnet in to mit-ai, I am usually able to :login +straight in, upon which I am asked for my password and such. +I also run the :CRTSTY vt100 speed 9600 +to set up my screen , without which I have serious trouble trying to +communicate with you. + +One one such session I was using the :telnet program and was trying to +:telnet umn-cs (net address:128.101.224.1). + +I was able to get through and start up a session. When I logged out of +umn-cs, the telnet connection did not seem to break, (I did not get +back the telnet prompt or did not get back to command level). + +At this stage I waited for 5 - 10 minutes to make sure, that the +ethernet was not acting up strange and had for some reason a huge +choke of packets all accross the United States. After that I was +forced to get back to my own telnet and abort the session. + + +NOW.. what happened the night of the + + Date: Sun, 1 Mar 87 00:26:42 EST + +I logged in and the first thing that I was given was some sort of +prompt that asked me if I wanted my detached tree attached. I did NOT +know about this detached tree until right then. So just for +curiosity's sake I did re-attach the tree, and then I find out that it +was that telnet job from the previous session. I was this time +successfully able to quit out of telnet. HOWEVER, then your system popped +me straight into what I think is your mailer, with a prompt line that +said ... ( I am paraphrasing) : + +bug: respond with :BUG-DDT DESCRIBING CIRCUMSTANCES + +To me it was not clear wether I would have to type the whole line +after the second colon or just mail to bug-ddt and then describe +circumstances. In UNIX, we have a convention that the system prompts +with the exact format of response it wants. Any additional parameters +get either quoted or given secondary visual attributes. For example we +would say %mail BUG-DDT . + +Nowhere did the system mention it had core-dumped on me!! + +I was not even able to set up my screen and take proper care of +editing the letter to write a decent response. And then of course I +had to hit cntrl-c (I believe) to send off the letter. In unix cntrl-c +means , and I had thought that would have done it. Instead +it mailed the letter, but did not say "response mailed" or any other +confirmation message. +******************************************************************************** +Devon, +I assume you are part of the Systems Group responsible for ai.ai.mit.edu . +In your letter you made quite a sarcastic ,and in my opinion a very rude +response to my difficulties communicating with your system over the internet. +: +>>> SUNDAY, MARCH 1, 1987 04:29:02 PM +>>>Welcome to ITS + +>>>From: "Devon S. McCullough" +>>>To: HAQUE@AI.AI.MIT.EDU +>>>In-reply-to: Msg of Sun 1 Mar 87 00:26:42 EST from Samudra E. Haque >>Message-ID: <161273.870301.DEVON@AI.AI.MIT.EDU> + +>>>Thanks for your incredibly helpful description the the circumstances +>>>leading to DDT's coredumping on you. (see above) + +>>> --Devon + +You will say that I have made errors in typing in commands, and I would say +rightly so, my unfamiliarity with your system and system incomptability lead +to quite a big mess up. + +BUT that does not give you the right to flame any person across the +internet just to satisfy your annoyance. + +At our systems group we try to be complacent with ALL user requests, +however strange, routine or ignorant they might be. A lot of users +don't have the first hand contact with all the systems and are often +very infrequent users, and are even familiar with OTHER operating systems, +as I am in this case. At that stage we try to help them out with +information as much as possible.I sometimes get very annoyed at our clients , +but they are what the group stands for ,and I always bear that in mind *first*. + +Of course, since I am only a guest at your system, you do have the +right to terminate my priveledges, if that is your system policy and if that +is your wish. + +I can be reached at the net address haque@umn-cs.arpa for further +comments. + +******************************************************************************** +disclaimer: The opinions expressed in this article are mine, and in no +way should be taken to represent the opinions of my employer, The +University of Minnesota, Minneapolis, or that of the Computer Science +Department . +******************************************************************************** + + Samudra E. Haque + CSci Systems Group + University of Minnesota + Minneapolis, MN 55455 + (612) 625 0876 + + +Date: Sun, 1 Mar 87 12:09:49 EST +From: "Devon S. McCullough" +To: HAQUE@AI.AI.MIT.EDU +cc: BUG-DDT@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 1 Mar 87 00:26:42 EST from Samudra E. Haque +Message-ID: <161273.870301.DEVON@AI.AI.MIT.EDU> + + Date: Sun, 1 Mar 87 00:26:42 EST + From: Samudra E. Haque + To: BUG-DDT at AI.AI.MIT.EDU + + describing circumstances + :kill + +Thanks for your incredibly helpful description the the circumstances +leading to DDT's coredumping on you. (see above) + + --Devon + +Date: Sun, 1 Mar 87 00:26:42 EST +From: "Samudra E. Haque" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <161088.870301.HAQUE@AI.AI.MIT.EDU> + + describing circumstances +:kill + +Date: Tue, 24 Feb 87 23:37:44 EST +From: Richard Barth +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <159215.870224.BARTH@AI.AI.MIT.EDU> + + Upon logging on I got a message saying "DDT bug: please do +:bug ddt describing cuircumstances" hence this msg. + + I assume what's wanted is a description +of my sudden departure from the system before. I was waiting for +RMAIL, running under EMACS, to finish showing me a message. And waiting. +And waiting. Finally hit return or something, and got a note, probably from the TAC, +telling me that the host was unreachable. That remained the +situation for a while, so I reset the connection and had dinner. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 10 Feb 87 02:12:51 EST +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by MC.LCS.MIT.EDU 10 Feb 87 02:13:46 EST +Date: Tue, 10 Feb 87 02:13:06 EST +From: Jon Solomon +To: BUG-DDT%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <969141.870210.JSOL@MX.LCS.MIT.EDU> + +oh never mind, it's my fool init file breaking again. + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 10 Feb 87 02:12:40 EST +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by MC.LCS.MIT.EDU 10 Feb 87 02:13:26 EST +Date: Tue, 10 Feb 87 02:12:46 EST +From: Jon Solomon +To: BUG-DDT%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <969140.870210.JSOL@MX.LCS.MIT.EDU> + +typing ^G^L makes ddt print the ddt bug message. + +so here I am bugging ddt describing the circumstances. + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 22 Dec 86 03:16:41 EST +Date: Mon, 22 Dec 86 03:19:19 EST +From: Rob Austein +To: BUG-DDT@MC.LCS.MIT.EDU +Message-ID: <148894.861222.SRA@MC.LCS.MIT.EDU> + +MC BUGPAUSED, I $P'd it, went back to my Lispm, attached my tree. +DDT announced that it had hit a bug. I see nothing wrong. + + +Date: Tue, 9 Dec 86 18:58:11 EST +From: Alan Bawden +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <128601.861209.ALAN@AI.AI.MIT.EDU> + +I did ALAN$1U and DDT ran my init file anyway. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 30 OCT 86 06:22:55 EST +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 30 OCT 86 06:09:29 EST +Date: Wed, 29 Oct 86 19:18:08 EST +From: "Devon S. McCullough" +Subject: :ALARM redisplay bug +To: BUG-DDT@MX.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].955325.861029.DEVON> + +In DDT, with the cursor somewhere other than the home postion, type +":alarm 20:20 ¢ and you will see two displays, one at the home position reading +":alarm 20:20^C" and one wherever your cursor was when you initially +typed the command, because DDT is trying to redisplay in the wrong place. + +Date: Tue, 28 Oct 86 17:28:42 EST +From: David Chapman +Subject: [COMSAT: Msg of Tuesday, 28 October 1986 17:21-EST] +To: BUG-SEND@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].111779.861028.ZVONA> + +I tried to send a tty msg to someone at symbolics on a machine not in +our host tables (dodo.scrc) by addressing it to dang@192.10.4.102. +That worked ok once, but the next time it timed out and asked if I +wanted to send via comsat. So I said yes, and it spazzed in such a +way as to generate the following message: + +Date: Tue, 28 Oct 86 17:21:14 EST +From: Communications Satellite +To: ZVONA at AI.AI.MIT.EDU +Re: Msg of Tuesday, 28 October 1986 17:21-EST + +============ A copy of your message is being returned, because: ============ +"DANG@192.10.4.102" at AI.AI.MIT.EDU is an unknown recipient. +============ Failed message follows: ============ +Date: Tue, 28 Oct 86 17:21:13 EST +From: David Chapman +To: "DANG@192.10.4.102"@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].111772.861028.ZVONA> + +... text deleted ... + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 21 OCT 86 14:10:30 EDT +Received: from PIGPEN.AI.MIT.EDU by OZ.AI.MIT.EDU via Chaosnet; 21 Oct 86 14:09-EDT +Date: Tue, 21 Oct 86 14:08 EDT +From: Alan Bawden +Subject: More about system message expiration. +To: ED@AI.AI.MIT.EDU +cc: Bug-GMSGS@AI.AI.MIT.EDU, Bug-DDT@AI.AI.MIT.EDU +Message-ID: <861021140843.6.ALAN@PIGPEN.AI.MIT.EDU> + +Actually, the expiration date stuff is even more broken than I implied in +my previous message. Basically, the expiration date on system messages are +ignored for any system other than the originating ITS machine. This is +because as the message passes from one ITS to another it is given a +Recieved: line at the front. Since system messages always have ITS-style +headers (COMSAT even manufactures once for system mail arriving with +NET-style headers), this results in a header like: + + Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 22 SEP 86 19:11:58 EDT + DISTRIB: *BBOARD + EXPIRES: 10/23/86 19:11:26 + ED@AI.AI.MIT.EDU 09/22/86 19:11:26 Re: New Technical Bookstore in Kendall Square + Quantum Books... + +which is confusing to many programs, including GMSGS. Since GMSGS can't +find the expiration date, the message never expires. Occasionally some +system hacker cleans the .MSGS. directory up by hand. + +Someday someone should fix GMSGS and the :MSGS command in DDT, to +understand what hit them. + +Date: Fri, 26 Sep 86 01:27:12 EDT +From: "Pandora B. Berman" +Subject: huh? +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].98894.860926.CENT> + +i had just gobbled some new mail into my rmail, and ^Z'd out. got a +TYIIOT) .IOT A,CH which didn't look unusual for a ^Z sort of exit, but +it was followed immediately by a DDT BUG: msg. only remarkable +circumstance is that COMSAT was just eating up all sorts of disk space +by not being able to delivery mail locally (KWH's dir was full -- i +fixed that) and then by needing to shrink its LISTS MSGS file back +to something reasonable. but when i started in with the RMAIL again, +there was plenty space. + +Date: Tue, 16 Sep 86 15:44:02 EDT +From: David Chapman +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].94755.860916.ZVONA> + +What about $$^F takes its argument from the ^R default if the argument +given is null. + +Date: Sun, 22 Jun 86 03:39:05 EDT +From: Alan Bawden +Subject: NO MAR? +To: BUG-DDT@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 17 Jun 86 01:09:06 EDT from Alan Bawden +Message-ID: <[AI.AI.MIT.EDU].60029.860622.ALAN> + + Date: Tue, 17 Jun 86 01:09:06 EDT + From: Alan Bawden + Someone needs to go through DDT and find all the places it believes + there is a MAR.... + +I did this. + +Date: Tue, 17 Jun 86 01:09:06 EDT +From: Alan Bawden +Subject: KS10's got no MAR +To: BUG-DDT@AI.AI.MIT.EDU +cc: ALAN@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].57866.860617.ALAN> + +Someone needs to go through DDT and find all the places +it believes there is a MAR. Currently setting .MARA gets +an ILOPR on KS10's (although you can easily convince me that +some other behavior would be more friendly). I wonder how many +DDT crashes on CRASH; are a result of users randomly typing I... + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 9 MAY 86 14:36:04 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 9 MAY 86 14:35:37 EDT +Date: Fri, 9 May 86 14:34:36 EDT +From: David Chapman +To: BUG-DDT@MX.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].303.860509.ZVONA> + +I was logged into MX from 7bhub, which lost the connection. +When I did :reatta zvona, it complained of a DDT bug, but +didn't say anything more specific. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 APR 86 09:06:29 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 29 APR 86 09:06:29 EDT +Date: Tue, 29 Apr 86 09:06:22 EDT +From: Alan Bawden +Subject: MXUSR: +To: SRA@AI.AI.MIT.EDU +cc: BUG-DDT@MC.LCS.MIT.EDU +In-reply-to: Msg of Mon 28 Apr 86 15:44:54 EDT from Rob Austein +Message-ID: <[AI.AI.MIT.EDU].32479.860429.ALAN> + + Date: Mon, 28 Apr 86 15:44:54 EDT + From: Rob Austein + :exists command special cases MLUSR:, MCUSR:, AIUSR:, DMUSR: devices, + may be other such lossage. + +Hmm... I thought I knew about all the places DDT special cased ML devices, +but sure enough, here is another one. Fixed and installed. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 APR 86 15:48:50 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 28 APR 86 15:48:38 EDT +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 APR 86 15:46:06 EDT +Date: Mon, 28 Apr 86 15:44:54 EDT +From: Rob Austein +To: BUG-DDT%TSTGW.LCS.MIT.EDU@AI.AI.MIT.EDU +Message-ID: <[TSTGW.LCS.MIT.EDU].190.860428.SRA> + +:exists command special cases MLUSR:, MCUSR:, AIUSR:, DMUSR: devices, +may be other such lossage. + +Date: Mon, 21 Apr 86 23:50:43 EST +From: "Keith F. Lynch" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].29648.860421.KFL> + +I just go a message asking me to send to this list. +I had just done :GMSGS * when I got a notice that I had mail from seismo. +Instead of completing at once as :GMSGS * usually does, it just sat there. +After a minute, I did ^Z then ^P. After another minute it told me it +wanted my TTY. I did $P, it told me there were messages, and then I got +the BUG DDT message. My mailbox, previously empty, contained the message +from seismo but no messages from :GMSGS *. + ...Keith + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 21 APR 86 21:03:27 EST +Date: Mon, 21 Apr 86 20:59:31 EST +From: "Christopher C. Stacy" +Subject: ITS names +To: BUG-LISP@MC.LCS.MIT.EDU +cc: BUG-DDT@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].891348.860421.CSTACY> + +(STATUS HSNAME 'PINTO 'MX) gives an ILOPR on MC, a DDT BUG on AI or MX. + +Date: Sun, 20 Apr 86 23:24:03 EST +From: Alan Bawden +Subject: ..SYSUUO uses 1-Procees +To: DEVON@AI.AI.MIT.EDU +cc: BUG-DDT@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 20 Apr 86 11:35:46 EST from Devon S. McCullough +Message-ID: <[AI.AI.MIT.EDU].29132.860420.ALAN> + + Date: Sun, 20 Apr 86 11:35:46 EST + From: Devon S. McCullough + I did emacs$j $l sys2;ts emacs + ..sysuuo/0 + $g + and it stopped on an open so I did $p and got the bug message. + +DDT uses 1-Proceed to advance the job past system calls in this mode. +Until 1-Proceed microcode works, ..SYSUUO is of only limited utility. + +Date: Sun, 20 Apr 86 11:35:46 EST +From: "Devon S. McCullough" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].28941.860420.DEVON> + +I did emacs$j $l sys2;ts emacs +..sysuuo/0 +$g +and it stopped on an open so I did $p and got the bug message. + +Date: Wed, 2 Apr 86 03:06:59 EST +From: "Paul R. Grupp" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].23284.860402.GRUPP> + +I was logged into AI via ARPAnet and got detached. Later logging back in +from MC and answering to the --Attach Your Detached Tree-- question +produced the following; +HACTRO$J!$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +ITS not being debugged!! + +I can't think of any other unusual circumstances. + +Date: Sat, 29 Mar 86 01:38:09 EST +From: "David A. Moon" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22244.860329.MOON> + +The I command caused ddt bug please do :bug ddt describing circumstances. Maybe it's not implemented on KS's. + +Date: Thu, 27 Mar 86 02:56:11 EST +From: Rob Austein +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].21738.860327.SRA> + +I forgot I was on AI and did foo$I to set MAR. DDT asked +me to please file a bug report on subject. DDT should probably be +fixed for this case, all things considered. + +(meta-bug?) + +Date: Sun, 23 Mar 86 21:27:35 EST +From: Alan Bawden +Subject: Grand migration begins +To: BUG-ITS@AI.AI.MIT.EDU, BUG-DDT@AI.AI.MIT.EDU, + KS-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].20774.860323.ALAN> + +OK this is it. The migration of ITS system files from MC to AI is +beginning. I have already moved a few directories and mailing lists and +having just moved Bug-ITS and Bug-DDT to AI, I thought I would test them by +informing you all of how this migration will work. I expect to have most +of the SYS*** directories moved to AI by tomorrow. If you have some +question about the status of a particular directory, look for a file on +that directory named " MOVED TO AI ". If that file exists, then the file +you are looking for now lives on AI, edits on MC are likely to be lost. If +that file doesn't exist, then MC still has the master copy. In any case, +if I am logged in, be cautious about timing screws. + +Date: Fri, 21 Mar 86 15:48:18 EST +From: Alan Bawden +Subject: STEVEH's ddt bug +To: GUMBY@MC.LCS.MIT.EDU +cc: BUG-DDT@MC.LCS.MIT.EDU, BUG-GMSGS@MC.LCS.MIT.EDU, + STEVEH@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 21 Mar 86 05:11:54 EST from David Vinayak Wallace +Message-ID: <[MC.LCS.MIT.EDU].858526.860321.ALAN> + + Date: Fri, 21 Mar 86 05:11:54 EST + From: David Vinayak Wallace + Any time someone who existed but had no directory nor login file + logged in, :INTEST would cause a bug (dunno why). But it's a stupid + thing to have at the end of an init file anyway, so I changed it to + :VK. Voila -- no more bug. + +Cretins everywhere. + +Gumby you are a cretin because you didn't bother to look at the +documentation for the :INTEST command before you flused in from the USERSn +init file. It is perfectly reasonable to put :INTEST in your init file. +It simply means to do a bunch of default login actions like doing a :MSGS. +You also lose points for not bothering to track the bug down. Take a look +at the routine DBGHAK in DDT to see how easy it is to do. + +The bigger cretin is the cretin who implemented the :MSGS database library. +Guess what happens when the database gets bigger than the file that +contains it? Right, it starts getting MPVs. Just a little time bomb +ticking away waiting for the 506th user to run :MSGS or :GMSGS. + +I expanded the size of the database and put the :INTEST command back in the +USERSn init file. I didn't fix SYSENG;MSGS. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 21 MAR 86 05:12:01 EST +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 21 MAR 86 05:12:19 EST +Date: Fri, 21 Mar 86 05:11:54 EST +From: David Vinayak Wallace +Subject: STEVEH's ddt bug +To: STEVEH@AI.AI.MIT.EDU +cc: BUG-DDT@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 21 Mar 86 03:18:50 EST from Stephen C. Hill +Message-ID: <[MC.LCS.MIT.EDU].858038.860321.GUMBY> + +Any time someone who existed but had no directory nor login file +logged in, :INTEST would cause a bug (dunno why). But it's a stupid +thing to have at the end of an init file anyway, so I changed it to +:VK. Voila -- no more bug. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 21 MAR 86 03:18:30 EST +Date: Fri, 21 Mar 86 03:18:50 EST +From: "Stephen C. Hill" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].20290.860321.STEVEH> + +It seems to be related to the :intest command in the * login file. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 21 MAR 86 03:16:26 EST +Date: Fri, 21 Mar 86 03:16:46 EST +From: "Stephen C. Hill" +To: BUG-DDT@AI.AI.MIT.EDU +cc: STEVEH@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].20287.860321.STEVEH> + +I had just logged onto AI with a new account. The system said: +[Home dir=USERS3] + FRIDAY, MARCH 21, 1986 03:13:16 AM +Welcome to ITS + + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. + +{End quote} +I don't know anything else to report. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 18 MAR 86 21:48:12 EST +Date: Tue, 18 Mar 86 21:48:04 EST +From: "G. Brendan Reilly" +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].19779.860318.REILLY> + +Each time I type + +:msgs + +I get a DDT bug, as well as each time I login using + +REILLY$U + + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 12 MAR 86 14:16:05 EST +Date: Wed, 12 Mar 86 14:16:01 EST +From: Rex Sanders +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].18724.860312.REX> + +telnet mit-ai +login for first time and answer lots of nosy questions +entered done +got "...changes sent for processing +... +Welcome to ITS + + DDT BUG: PLEASE DO ... + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 9 MAR 86 18:13:17 EST +Date: Sun, 9 Mar 86 18:17:06 EST +From: Patrick Greussay +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].18242.860309.PG> + +Hmm, I tried logging out from PG's account, logging back in +again, and typing ^F, and I got the same DDT BUG message. +But then I typed ^F again and it worked fine. And I can't +find anything else wrong anywhere. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 9 MAR 86 18:11:15 EST +Date: Sun, 9 Mar 86 18:15:04 EST +From: Patrick Greussay +To: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].18240.860309.PG> + +Uh, hi, this is Phil Agre. I set up this account for my +friend Patrick Greussay, and I tried logging in to it, +and it said [Home dir=USERS3] and I said ^F and I got +DDT BUG: PLEASE DO :BUG DDT etc. My guess is that there +isn't actually a USERS3 directory. Maybe it got USERS3 +from MC, where it (Panda) also seems to have gotten Patrick's +home address etc. (Er, um, I guess that's where it got +them? OZ maybe?) + +Date: Wed, 26 Feb 86 23:37:23 EST +From: "Steven A. Swernofsky" +To: BUG-DDT@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].832159.860226.SASW> + +after using babyl, i typed "q" to quit and hung up my phone +redailing, i attached my detached tree--and received the ddt bug message + +i am dailing in from a tac. +-- Steve + +Received: from SPEECH.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 JAN 86 15:56:18 EST +Date: Sat 25 Jan 86 15:55:30-EST +From: John Wroclawski +Subject: return addresses in mailed messages +To: bug-send@MC.LCS.MIT.EDU + + +I got a send from someone via mail because I'd logged out already. +The return address (From: field) was of the form + +FOO at MC.LCS.MIT.EDU + +which is illegal these days, the current format only allowing the +@ form (Foo@MC...) Because of this replying to the message didn't +work. +------- + +Date: Mon, 30 Dec 85 07:55:53 EST +From: "Stephen C. Hill" +Subject: PURPG message +To: ALAN@MC.LCS.MIT.EDU +cc: BUG-CRTSTY@MC.LCS.MIT.EDU, BUG-DDT@MC.LCS.MIT.EDU, + CSTACY@MC.LCS.MIT.EDU, GRUPP@MC.LCS.MIT.EDU, + STEVEH@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 29 Dec 85 14:39:16 EST from Alan Bawden +Message-ID: <[MC.LCS.MIT.EDU].768543.851230.STEVEH> + +Whatever the problem was last night, it is working fine now. +Thanks (somebody.) + +Date: Sun, 29 Dec 85 14:39:16 EST +From: Alan Bawden +Subject: PURPG message +To: GRUPP@MC.LCS.MIT.EDU +cc: BUG-CRTSTY@MC.LCS.MIT.EDU, BUG-DDT@MC.LCS.MIT.EDU, + CSTACY@MC.LCS.MIT.EDU, STEVEH@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 29 Dec 85 04:36:46 EST from Paul R. Grupp +Message-ID: <[MC.LCS.MIT.EDU].768095.851229.ALAN> + + Date: Sun, 29 Dec 85 04:36:46 EST + From: Paul R. Grupp + Date: Sun, 29 Dec 85 03:19:42 EST + From: Stephen C. Hill + I have consistently been getting + PURPG; 70105>>.CALL 70247 (SIOT) + messages tonight, while trying to use my usual :CRTSTY IQ120. + Nothing has changed in the installed CRTSTY on MC since July '85, so this + looks like a DDT BUG. Other people have recently been reporting the same + error message for any terminal setting. + +That message is unlikely to have anything to do with a DDT bug. + +Looking at the CRTSTY binary reveals that 70105 = FTLINT+4. Not having a +crash dump I can only guess what the fatal interrupt was, but an IOC error +on the DSK channel seems like a good guess given that the CRASH; directory +is full. I'll clean up CRASH; and we can see if the problem goes away. +(I'll prune CRASH;CRTSTY LOG while I am at it...) + +And, no, I have no idea why this shows up as a PURPG, perhaps somebody +would like to try debugging it rather than crying wolf and pointing fingers +at other programs. + +[ And anyone who assembles the current CRTSTY source should be aware that + they are debugging changes that GUMBY and KLH have made since the last + binary was made. ] + +Date: Sun, 29 Dec 85 04:36:46 EST +From: "Paul R. Grupp" +Subject: PURPG message +To: ALAN@MC.LCS.MIT.EDU, CSTACY@MC.LCS.MIT.EDU, + BUG-DDT@MC.LCS.MIT.EDU +cc: BUG-CRTSTY@MC.LCS.MIT.EDU, STEVEH@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 29 Dec 85 03:19:42 EST from Stephen C. Hill +Message-ID: <[MC.LCS.MIT.EDU].767988.851229.GRUPP> + + Date: Sun, 29 Dec 85 03:19:42 EST + From: Stephen C. Hill + To: BUG-CRTSTY at MC.LCS.MIT.EDU + Re: PURPG message + + I have consistently been getting PURPG; 70105>>.CALL 70247 (SIOT) messages + tonight, while trying to use my usual :CRTSTY IQ120. Something ain't + right, but I'm not sure if it is CRTSTY. Please help, cause BABYL is a + BITCH without FULL-screen capability! Thanks, Steve + +Nothing has changed in the installed CRTSTY on MC since July '85, so this +looks like a DDT BUG. Other people have recently been reporting the same +error message for any terminal setting. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 19 DEC 85 03:39:47 EST +Date: Thu, 19 Dec 85 03:37:33 EST +From: Alan Bawden +Subject: %PIJST +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-DDT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].9064.851219.ALAN> + +In ITS version 1552 (now running on AI) the %PIJST interrupt is finally +implemented: + +Typing ^_J will give the job that currently has the console a %PIJST +interrupt if it has it enabled. If that job does -not- have %PIJST +enabled, ITS will check to see if its superior does, or if its superior's +superior does, and so forth, up to the root of the job tree. If nobody is +willing, the ^_J is treated as if it was an illegal escape sequence. (It +echos as "^_?" in that case.) + +So its time finish the code in DDT to actually handle the interrupt. + +Date: Tue, 10 Dec 85 14:02:37 EST +From: David Vinayak Wallace +Subject: TPL command +To: ALAN@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA +In-reply-to: Msg of Tue 10 Dec 85 00:18:00 EST from Alan Bawden +Message-ID: <[MIT-MC.ARPA].748544.851210.GUMBY> + + Date: Tue, 10 Dec 85 00:18:00 EST + From: Alan Bawden + + I use it all the time. + + No kidding, I have a translation from TPL: to LP7: so that I can + use :TPL to generate simple hardcopy. You could make it more + usefull to me by making it use better filenames than + TPL:;PRINT OUTPUT, like have it use the names of the file I + asked to print. + +It seems to me that the unix people have this one right -- this should +be a piece of user code, not something stuck in the middle of DDT. + +Of course, were it in DDT you could have a variable containing the +name of your desired printer, and no translation would be necessary... + +Date: Tue, 10 Dec 85 00:18:00 EST +From: Alan Bawden +Subject: TPL +To: GUMBY@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA +In-reply-to: Msg of Mon 9 Dec 85 19:39:57 EST from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].748091.851210.ALAN> + + Date: Mon, 9 Dec 85 19:39:57 EST + From: David Vinayak Wallace + Does anyone mind if I flush the TPL command? + +I use it all the time. + +No kidding, I have a translation from TPL: to LP7: so that I can use :TPL +to generate simple hardcopy. You could make it more usefull to me by making +it use better filenames than TPL:;PRINT OUTPUT, like have it use the +names of the file I asked to print. + +Date: Mon, 9 Dec 85 19:39:57 EST +From: David Vinayak Wallace +Subject: TPL +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].747564.851209.GUMBY> + +Does anyone mind if I flush the TPL command? + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA 29 Nov 85 23:50:31 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 364604; Fri 29-Nov-85 23:45:47-EST +Date: Fri, 29 Nov 85 23:44 EST +From: David A. Moon +Subject: Any takers? +To: Alan Bawden +cc: BUG-ITS@MIT-MC.ARPA, BUG-RANDOM-PROGRAM@MIT-MC.ARPA, + BUG-DDT@MIT-MC.ARPA +In-Reply-To: <[MIT-MC.ARPA].692189.851024.ALAN> +Message-ID: <851129234420.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu, 24 Oct 85 23:38:25 EDT + From: Alan Bawden + + With all of these parity errors MC gets these days, and with all of these + naive users who haven't the slightest idea what to do when they have + detached job trees, the amount of disowned junk is getting to be a pain. + Now there is really no good reason why a program couldn't be written that + would would look around in the system for jobs with your XUNAME and offer + some intelligent (and clearly explained) choices to you. Anybody + interested? I'm not up for thinking about the problem right now, but I'd + be happy to brainstorm in person with anyone else who would like to take a + crack at it. + + +I'm sure I wrote this at Ellen's request and she put it into the init files of +the known naive Macsyma users. I think it was called RETACH or something like +that. + + +Received: from MIT-SPEECH by MIT-MC.ARPA via Chaosnet; 29 OCT 85 01:07:23 EST +Date: Tue 29 Oct 85 01:07:51-EST +From: John Wroclawski +Subject: header lossage +To: bug-send@MIT-MC.ARPA + + +A send from Alan (on MC) to me (on MC) lost because I logged out. SEND +thoughtfully tried to mail it to "JTW at MIT-MC.ARPA" from "ALAN at +MIT-MC.ARPA". Comsat forwarded the mail to me at SPEECH, where +replying lost because the form "FOO at BAR" (" at " instead of @) is +currently politically incorrect. +------- + +Date: Thu, 24 Oct 85 23:38:25 EDT +From: Alan Bawden +Subject: Any takers? +To: BUG-ITS@MIT-MC.ARPA, BUG-RANDOM-PROGRAM@MIT-MC.ARPA, + BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].692189.851024.ALAN> + +With all of these parity errors MC gets these days, and with all of these +naive users who haven't the slightest idea what to do when they have +detached job trees, the amount of disowned junk is getting to be a pain. +Now there is really no good reason why a program couldn't be written that +would would look around in the system for jobs with your XUNAME and offer +some intelligent (and clearly explained) choices to you. Anybody +interested? I'm not up for thinking about the problem right now, but I'd +be happy to brainstorm in person with anyone else who would like to take a +crack at it. + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 23 OCT 85 16:23:48 EDT +Date: Wed, 23 Oct 85 13:26:26 EDT +From: "Devon S. McCullough" +To: BUG-DDT%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].5580.851023.DEVON> + +I was running an inferior DDT with ..SYSUUO/0 and upon starting it did a .SUSET which I looked up then when I did $P it crashed. + +Date: Mon, 21 Oct 85 21:38:03 EDT +From: Joel Fajans +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].687647.851021.JFJ> + +My terminal crashed several hours ago, and when I logged on, my +old tree was still there along with a message asking me to +do a ddt bug and "describe the circumstances". Unfortunately, +I wasn't paying attention and I don't know what happened beyond +being in a MACSYMA after using :crtsty vt100 + + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 16 OCT 85 15:15:37 EDT +Date: Wed, 16 Oct 85 15:18:31 EDT +From: "Devon S. McCullough" +To: BUG-DDT%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].5282.851016.DEVON> + +the :reattach program should be part of ddt so it doesn't say +(please log in) which is extremely disconcerting! +And PWORD too, it can ask you for your password and then run it. +Maybe it should just know to not give the message, otherwise +running the reattach program as usual. + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 18 SEP 85 17:07:34 EDT +Date: Wed, 18 Sep 85 17:12:55 EDT +From: "Devon S. McCullough" +To: BUG-DDT%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].4267.850918.DEVON> + +in LJCL when I rubout a return I get a DDT BUG. + +Date: Wed, 18 Sep 85 16:33:57 EDT +From: Devon S. McCullough +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].649799.850918.DEVON> + +Control-Q should quote Return, if not all the time then at least +within the :JCL command so I can enter JCL containing Return characters. + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 18 SEP 85 15:59:34 EDT +Date: Wed, 18 Sep 85 16:04:50 EDT +From: "Devon S. McCullough" +To: BUG-DDT%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].4258.850918.DEVON> + +:alarm is completely confusing. If it made some attempt to check it's input +for meaningful vs meaningless jcl, there might appear to be some rhyme or +reason to it's seemingly random behavior. :alarm followed by four spaces +seems to do something (don't ask me what) for instance (no needed!) +and if you give it back what it output, ie, :alarm .+8:00, it acts weirdly, +taking the : as a terminator. Yech. + +Date: Sun, 1 Sep 85 12:57:40 EDT +From: Alan Bawden +Subject: Feature +To: DEVON@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 18:00:59 EDT from Devon S. McCullough +Message-ID: <[MIT-MC.ARPA].630167.850901.ALAN> + + Date: Sat, 31 Aug 85 18:00:59 EDT + From: Devon S. McCullough + ... + By the way, how does the system know about sharable pure pages? + If it knows that much why doesn't it know about binaries' filenames? + +It's because the concept of a "file" exists only at a higher level of +abstraction than the level where page sharing is done. Sharing is done at +the level of pages and disk blocks. A file is a name for a sequence of +disk blocks, but there is no way to go backwards from a disk address to see +which file (if any) it came from. (Other than mapping over the entire +filesystem.) If there was some reason this operation needed to be done +with great regularity, the information could be saved. But it is rare to +want to do that, so we don't. + +(I actually have a tool that does it since I needed it once for debugging +disk ECC recovery on AI. I think there might also be a routine in the +version of the salvager that runs under timesharing that does it.) + +Date: Sat, 31 Aug 85 18:00:59 EDT +From: Devon S. McCullough +Subject: Feature +To: ALAN@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 12:36:41 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].629753.850831.DEVON> + +I was thinking that :SNARF could simply get the start address, etc, +from the croaked DDT, but Alan's suggestion is better. +By the way, how does the system know about sharable pure pages? +If it knows that much why doesn't it know about binaries' filenames? + +Date: Sat, 31 Aug 85 12:36:41 EDT +From: Alan Bawden +Subject: Feature +To: DEVON@MIT-MC.ARPA, BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 03:57:02 EDT from Devon S. McCullough +Message-ID: <[MIT-MC.ARPA].629584.850831.ALAN> + + Date: Sat, 31 Aug 85 03:57:02 EDT + From: Devon S. McCullough + To: BUG-DDT at MC + I snarfed an emacs from a hactro and tried to do G + "no start address" I don't know if this is a DDT bug or an ITS bug. + +It isn't exactly anybody's bug. The start address of a program is treated +just like the symbol table. It is stored in binary files for the benefit +of people who load, start, and/or debug the program, but it is not kept +anywhere in the job itself. ITS doesn't concern itself with where you +think a job should be restarted. + +Now it -is- a little inconvenient that there is no way to go from a random +job you find floating around the system back to its binary to find its +symbols and starting address. So let me float a few suggestions through +the air and see if anybody thinks they are a good idea: + +(1) Add a user variable that would contain a starting address. This would + cover the common case that Devon complained about. (Happens to me all + the time too.) + +(2) Add four user variables that would contain the filename of the binary + for the this job. This would enable symbols to be found as well as the + start address. + +(3) Add a user variable that contains the address of a block in the job's + address space, in some extensible format we design later, that contains + all kinds of information. Like a vector of start addresses, filenames + of binary files, etc. + +(4) Since (3) requires cooperation from the job itself, but (1) covers the + most common case, we could do both. One user variable containing a + start address and one containing the address of a block of information + (or zero if the job doesn't have one). Note that these are both 18 bit + quantities, so this really only adds an extra word to every set of job + variables. + +A problem with (3) and (4) is that the new info-block user variable seems +somehow redundant with the existing use of the left half of .40ADDR. The +16.-word block addressed by LH(.40ADDR) is currently only used for +temporary hacking by a job's superior; perhaps there is some way to combine +the two? Perhaps one of the words addressed by RH(.40ADDR) can be the +info-block pointer if the job sets some bit in .OPTION? + +I guess I'm in favor of at least (1) if not some variant of (4). + +Date: Sat, 31 Aug 85 03:57:02 EDT +From: Devon S. McCullough +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].629396.850831.DEVON> + +I snarfed an emacs from a hactro and tried to do G +"no start address" I don't know if this is a DDT bug or an ITS bug. + +Date: Thu, 29 Aug 85 23:05:15 EDT +From: Devon S. McCullough +Subject: previous ddt bug +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].628200.850829.DEVON> + +Must have been some irreproducable flakiness. I looked at my logout file, +and when I manually did :ddtsym ttyopt/ it did the ddt bug message again. + +Date: Thu, 29 Aug 85 20:03:46 EDT +From: Devon S. McCullough +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].628072.850829.DEVON> + +I'm mystified. +My display shows f^H! followed by a finger display followed by + + EJ +* +[Here is KFL] +u DDT BUG: PLEASE DO :BUG...that's all I know. +I's in the supdup window of a CADR. + +Date: Sun, 25 Aug 85 01:55:34 EDT +From: Leigh L. Klotz +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].623456.850825.KLOTZ> + +Do you thing  should try to read mail from twenex sites if the +person's mail is forwarded there. Granted it will lose if the mail +is forwarded elsewhere from the twenex address, but we have that +problem with its mail forwarding too. + +Date: Tue, 20 Aug 85 20:16:51 EDT +From: David Vinayak Wallace +Subject: non-local users +To: ALAN@MIT-MC.ARPA +cc: BUG-SEND@MIT-MC.ARPA, RDZ@MIT-MC.ARPA +In-reply-to: Msg of Tue 20 Aug 85 09:10:02 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].619594.850820.GUMBY> + +we could make ddt .include send...? + +Date: Tue, 20 Aug 85 09:10:02 EDT +From: Alan Bawden +Subject: non-local users +To: RDZ@MIT-MC.ARPA +cc: BUG-SEND@MIT-MC.ARPA +In-reply-to: Msg of Mon 19 Aug 85 23:17:15 EDT from Ramin D. Zabih +Message-ID: <[MIT-MC.ARPA].618789.850820.ALAN> + + Date: Mon, 19 Aug 85 23:17:15 EDT + From: Ramin D. Zabih + Why can't send use :CHSEND when you give it a non-local user? + ie instead of :send foo@zermatt bar doing :mail, why can't it do :chsend? + +I'll guess that you are complaining about the built-in DDT :SEND command? +If you set ..SNDFLG non-zero in your init file, then :SEND will run the +SEND -program- which knows all kinds of ways to reach people. + +I would set this switch non-zero by default except that it is occasionaly +a feature that J. Random Luser can :SEND a message to a wizard when the +system has no free job slots. + +(Note that even if you set ..SNDFLG you can still use :OSEND command which +is just an alias of the :SEND command.) + +Date: Mon, 19 Aug 85 23:17:15 EDT +From: Ramin D. Zabih +Subject: non-local users +To: BUG-SEND@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].618472.850819.RDZ> + +Why can't send use :CHSEND when you give it a non-local user? +ie instead of :send foo@zermatt bar doing :mail, why can't it do :chsend? + +Date: Thu, 1 Aug 85 09:06:58 EDT +From: Alan Bawden +Subject: I see no bug here +To: KLOTZ@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA +In-reply-to: Msg of Thu 1 Aug 85 01:20:16 EDT from Leigh L. Klotz +Message-ID: <[MIT-MC.ARPA].596555.850801.ALAN> + + Date: Thu, 1 Aug 85 01:20:16 EDT + From: Leigh L. Klotz + If my default filename is dir:cdate down, but them I remember that + I want to see what the $$^F default is this week and type $$^F it + waits a long time, presumably doing something complicated with + DIRDIR: + +It should read DIRDIR:NAME1 UP which really has no right to work, but +someone once went to the trouble to make DIRDIR: and alias of DIRDSK: so it +does anyway. I don't seem to be able to reproduce any lossage here. + +Date: Thu, 1 Aug 85 01:20:16 EDT +From: Leigh L. Klotz +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].596146.850801.KLOTZ> + +If my default filename is dir:cdate down, but them I remember that +I want to see what the $$^F default is this week and type $$^F it +waits a long time, presumably doing something complicated with +DIRDIR: + +Date: Fri, 19 Jul 85 01:59:22 EDT +From: Tim McNerney +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].581275.850719.TIM> + +When I reattached to a detached tree, DDT urged me to send this "bug" +message. Is this something to worry about? + +Date: Wed, 17 Jul 85 00:10:55 EDT +From: Christopher C. Stacy +To: BUG-SEND@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].578804.850717.CSTACY> + +IWBNI there was a command which a sender could type to execute a +program or DDT command and have the output go into the message text. +Somehow... + + :SEND LOSER rampant featurism $ + >>! + Eval: :WHOIS LOSER + ^L + [Message from CSTACY] + rampant featurism + LOSER T J.Q. Loser HACTRN T11 Vadic Dialup + (Loss) [ML] Hacking receiving flames for CSTACY + Birthday February 29; NE43-1069; no phone; no home + no address + "I ain't got nobody..." + ^C + + + +Date: Tue, 16 Jul 85 19:43:03 EDT +From: David Vinayak Wallace +Subject: net sends when NLI +To: BUG-SEND@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].578471.850716.GUMBY> + +I got a over the arpane send when I wasn't logged in, so it went into +my mail file. unfortunately it did not go into my mail file with a To: +header. + +Btw, it's still imp(ossible to :reply to net sends -- the address gets fukt. + +Date: Mon, 8 Jul 85 20:02:52 EDT +From: David Vinayak Wallace +Subject: replying to internet sends +To: BUG-SEND@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].568289.850708.GUMBY> + +always tries to reply to something like "727M40", which it fails to do. + +Date: Mon, 8 Jul 85 17:24:06 EDT +From: Christopher C. Stacy +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].568153.850708.CSTACY> + +I had a raid display on, and typed 0$V, and got a bug report. + +Date: Sat, 29 Jun 85 01:19:10 EDT +From: Alan Bawden +Subject: MC weirdness +To: GUMBY@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA, BUG-DDT@MIT-MC.ARPA +In-reply-to: Msg of Sat 29 Jun 85 00:12 EDT from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].559470.850629.ALAN> + + Date: Sat, 29 Jun 85 00:12 EDT + From: David Vinayak Wallace + How could I tell that CRASH; was full? EVERY DDT was acting that way, + and there was no way to shut it off. It didn't occur to me to look at + CRASH; at all. + +Well what does it -usually- mean when someone can't write a file on ITS? +It means a directory is full. I didn't expect you to do anything when +-every- DDT was acting broken, I expected you to look after the machine came +back up. I figured that since you wrote the crash file to GUMBY; rather +than CRASH; that you had noticed that something was wrong with the latter. +(If that is really not the case, let me warn you that it isn't a good idea +to write out files under exec DDT to directories other than ., CRASH, +CRASH2 (when it exists), and CSTACY. See CHANNA;RAKASH DMPCPY.) + +DDT should probabyl have a feature where if it has crashed dumped itself +once in a session, it should never bother to do so again. Future errors +would cause it to just explain to the user that his DDT thinks it is broken, +but there is only one crash dump per customer. + +Date: Mon, 10 Jun 85 01:46:45 EST +From: Alan Bawden +Subject: DCP;DDTBUG XFILE +To: DCP@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA +In-reply-to: Msg of Sat 8 Jun 85 22:48:15 EST from David C. Plummer +Message-ID: <[MIT-MC.ARPA].536390.850610.ALAN> + +OK, you can define more symbols in the latest DDT. (There was already +enough room for the symbol table to grow into, but a bug prevented it from +being useful...) + +Date: Sat, 8 Jun 85 22:48:15 EST +From: David C. Plummer +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].535609.850608.DCP> + +Regarding all the crashes I've been causing. It appears to be because +there is some bogus limitation on the number of additional symbols +one can tell DDT about itself. My init file happens to use that many +plus about 5. An easier way to reproduce it is to do + :xfile dcp;ddtbug xfile +in a fresh DDT. I would appreciate it if this bogus limitation +were made non-existent, or at least larger. + +Date: Sat, 8 Jun 85 22:30:19 EST +From: David C. Plummer +To: BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].535598.850608.DCP> + +I was logging in, and my init file noticed it had to remake +itself because there is a new DDT. It blew out (manner unknown +(I haven't investigated)), took a crash, and asked my to :BUG DDT. + +Date: Thu, 9 May 85 14:22:42 EST +From: David Vinayak Wallace +Subject: Selected job when system full +To: BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].493632.850509.GUMBY> + +This is hard to reproduce, but: +I had one job, an E. I did f and got "SYSTEM FULL?" I then typed p and +got "JOB?". v showed the E, but it was not selected. + +Received: from SRI-NIC.ARPA by MIT-MC.ARPA; 7 MAY 85 12:04:16 EDT +Date: Tue, 7 May 1985 09:03 PDT +Message-ID: <[SRI-NIC].IAN. 7-May-85 09:03:08> +From: Ian Macky +To: Alan Bawden +Cc: BUG-DDT@MIT-MC + +I didn't realize ^C in that situation simply typed CRLF and did +nothing else... I was thinking it terminated the symbol, but that's +obviously not the case else yow^C would have done ?U? ... Oh well, +ignore me. + +Date: Tue, 7 May 85 03:43:19 EST +From: Alan Bawden +To: GRENNY@MIT-MC +cc: BUG-DDT@MIT-MC +In-reply-to: Msg of Tue 7 May 85 00:56:00 EST from Ian Wacky +Message-ID: <[MIT-MC].489348.850507.ALAN> + + Date: Tue, 7 May 85 00:56:00 EST + From: Ian Wacky + + *yow^C + : JOB? + + this doesn't seem right. + +Whats the problem? You tried to define a symbol named "YOW" when you +didn't have any selected job. The fact that you typed a ^C so that DDT +would type a newline is irrelevant. + +Date: Tue, 7 May 85 00:56:00 EST +From: Ian Wacky +To: BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].489109.850507.GRENNY> + +*yow^C +: JOB? + +this doesn't seem right. + +Date: Tue, 30 Apr 85 01:16:24 EDT +From: Alan Bawden +Subject: Oh yeah, right... +To: GREN@MIT-MC +cc: BUG-ITS@MIT-MC, KS-ITS@MIT-MC, BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].476201.850430.ALAN> + + [Message from GREN at MIT-AI 1:05pm] + hey, single-stepping isn't working right! + +Oh yeah. Until I get back into microcode hacking again, hackers who debug +programs using DDT on AI will find that features related to single stepping +don't work right. I'll fix it eventually, I just haven't put in the +support for it yet. + +I won't be fixing the fact that AI doesn't have a MAR, so somebody should +be fixing DDT to know that some ITS machines lack the feature. + +Received: from STONY-BROOK.SCRC.Symbolics.COM by MIT-MC.ARPA; 24 APR 85 22:44:49 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 223568; Wed 24-Apr-85 22:43:01-EST +Date: Wed, 24 Apr 85 22:43 EST +From: David A. Moon +Subject: can't reply to bogus headers +To: David Vinayak Wallace +cc: BUG-SEND@MIT-MC.ARPA, kmp@STONY-BROOK.SCRC.Symbolics.COM, + bug-lispm%MIT-OZ@MIT-MC.ARPA +In-Reply-To: <[MIT-MC].468737.850424.GUMBY> +Message-ID: <850424224324.2.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed, 24 Apr 85 21:45:29 EST + From: David Vinayak Wallace + + + I cannot reply to a send (presumably generated with CONVERSE) with the + following header: + TTY msg from 192.10.41.78: + Date: Wed, 24 Apr 85 20:39 EST + From: kmp@RIO-DE-JANEIRO.SCRC.Symbolics.COM + To: Gumby@MIT-MC.ARPA + + :REPLY says To: 3525 (or some integer), but then complains + "can't" when you try to send it off. + +Not a Lisp Machine bug. The REPLY program is evidently broken +(again!). + + +Received: from STONY-BROOK.SCRC.Symbolics.COM by MIT-MC.ARPA; 24 APR 85 22:44:38 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 223566; Wed 24-Apr-85 22:42:54-EST +Date: Wed, 24 Apr 85 22:43 EST +From: David A. Moon +Subject: can't reply to bogus headers +To: David Vinayak Wallace +cc: BUG-SEND@MIT-MC.ARPA, kmp@STONY-BROOK.SCRC.Symbolics.COM, + bug-lispm%MIT-OZ@MIT-MC.ARPA +In-Reply-To: <[MIT-MC].468737.850424.GUMBY> +Message-ID: <850424224316.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed, 24 Apr 85 21:45:29 EST + From: David Vinayak Wallace + + + I cannot reply to a send (presumably generated with CONVERSE) with the + following header: + TTY msg from 192.10.41.78: + Date: Wed, 24 Apr 85 20:39 EST + From: kmp@RIO-DE-JANEIRO.SCRC.Symbolics.COM + To: Gumby@MIT-MC.ARPA + + :REPLY says To: 3525 (or some integer), but then complains + "can't" when you try to send it off. + +Not a Lisp Machine bug. The REPLY program is evidently broken. + + +Date: Wed, 24 Apr 85 21:45:29 EST +From: David Vinayak Wallace +Subject: can't reply to bogus headers +To: BUG-SEND@MIT-MC +cc: kmp@SCRC-STONY-BROOK, bug-lispm@MIT-OZ +Message-ID: <[MIT-MC].468737.850424.GUMBY> + + +I cannot reply to a send (presumably generated with CONVERSE) with the +following header: + TTY msg from 192.10.41.78: + Date: Wed, 24 Apr 85 20:39 EST + From: kmp@RIO-DE-JANEIRO.SCRC.Symbolics.COM + To: Gumby@MIT-MC.ARPA + +:REPLY says To: 3525 (or some integer), but then complains +"can't" when you try to send it off. + +Received: from MIT-AI by MIT-MC via Chaosnet; 24 APR 85 18:43:13 EST +Date: Wed, 24 Apr 85 02:57:10 EST +From: Alan Bawden +To: BUG-SEND@MIT-AI +Message-ID: <[MIT-AI].26.850424.ALAN> + +On AI doing :SEND FOO +gets some compalin about ambigous host name or something. +Perhaps there is some internal table in SENDER that needs +to be updated to know about the new ITS machine? + +Date: Sun, 21 Apr 85 16:21:51 EST +From: Gail Zacharias +To: CSTACY@MIT-MC +cc: BUG-SEND@MIT-MC +In-reply-to: Msg of Sun 21 Apr 85 15:50:30 EST from Christopher C. Stacy +Message-ID: <[MIT-MC].463703.850421.GZ> + +Reply^K was failing for me with fully formed messages from OZ and HT +(coming up with Author?). I can't reproduce it now, so maybe something +else was wrong. (possibly the messages from WGD in my sends file with an +unknown host name in the header?). + +At the time I was getting the 'connection waiting for response to SYN' +errors from sending to WGD@24512/chaos, the microwave link was up. I ended +up supduping to OZ and sending to him with no problems. + +Btw, in the case of unknown hosts, the messages come out like +TTY Message from chaosnet site 24512/CHAOS +User-Name@WHAT-THE-HOST-THINKS-IT-IS-CALLED .... + +It would be nice if reply put together the User-Name from the second line +with the host number from the first line. (Maybe it does but whatever was +screwing things up for me that night screwed this up also?) + +Date: Sun, 21 Apr 85 16:02:16 EST +From: Christopher C. Stacy +To: BUG-SEND@MIT-MC +Message-ID: <[MIT-MC].463694.850421.CSTACY> + +And, oh yeah. I made SENDER work on non-ARPAnet sites (ie MIT-AI). +It is not possible to route interactive sends for the Internet +through COMSAT. This may be fixed the next time I work on COMSAT, +which I believe is where the bug is. + +Date: Sun, 21 Apr 85 15:58:59 EST +From: Christopher C. Stacy +To: BUG-SEND@MIT-MC +Message-ID: <[MIT-MC].463689.850421.CSTACY> + +I fixed the problem where re-trying a TCP send would get +completely weird results, apparently trying to go out +over the Chaosnet. I also fixed a typo or two and cleaned +up the SCHECK host-lookup routine. + +Date: Sun, 21 Apr 85 15:50:30 EST +From: Christopher C. Stacy +To: GZ@MIT-MC +cc: BUG-SEND@MIT-MC +In-reply-to: Msg of Wed17 Apr 85 02:15:51 EST from Gail Zacharias +Message-ID: <[MIT-MC].463680.850421.CSTACY> + + Date: Wed,17 Apr 85 02:15:51 EST + From: Gail Zacharias + To: BUG-SEND + Message-ID: <[MIT-MC].457594.850417.GZ> + + How come :REPLY is not hacking normal net sends anymore? + +I don't know what this means, but Gren suggests that you are referring +to the fact that most 20X sites dont put any header on their outgoing +sends, and REPLY cannot read minds. + + Also, how do I send to a chaosnet host number? I tried WGD@24512/chaos + but it said connection waiting for SYN or something equally unlikely for + a chaosnet connection. The machine in question is receiving send + connections just fine, since I was able to send there from OZ. + +:S WGD@24512/CHAOS works OK for me; it tries to connect to Chaos +address 24512. It fails, since the microwave to SCRC is more or less +permanently down. + +Date: Sat,20 Apr 85 16:00:29 EST +From: Christopher C. Stacy +To: BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].462914.850420.CSTACY> + +If I set MAILNT to 2, when I am interrupted by a send, +I get mail notifications on my screen too. Maybe this +is a feature. Need yet finer grade control? + +Date: Thu,18 Apr 85 02:45:29 EST +From: Christopher C. Stacy +Subject: :MAILNT +To: BUG-DDT@MIT-MC +cc: JCMA@MIT-MC, MLY@MIT-MC +Message-ID: <[MIT-MC].459201.850418.CSTACY> + +I updated the :MAILNT feature to know a little more about network +sends; it looks at message headers, and now knows to flush the +Received lines crap. It also now tries to find a Subject to include +in the one-line notification. + +I also updated DDTORD to tell about (R-OPTION NO-CLI), replacing +its previous suggestion that you EQV yourself directly to a file. + +Date: Wed,17 Apr 85 02:15:51 EST +From: Gail Zacharias +To: BUG-SEND@MIT-MC +Message-ID: <[MIT-MC].457594.850417.GZ> + +How come :REPLY is not hacking normal net sends anymore? +Also, how do I send to a chaosnet host number? I tried WGD@24512/chaos +but it said connection waiting for SYN or something equally unlikely for +a chaosnet connection. The machine in question is receiving send connections +just fine, since I was able to send there from OZ. + +Date: Fri,12 Apr 85 02:31:34 EST +From: Alan Bawden +Subject: _VZ67@ +To: BUG-SENDER@MIT-MC, BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].452500.850412.ALAN> + +I just got the following: + + MESSAGE FROM REPLY _VZ67@ + ly from CSTAC0 at MIT-MC 2:20am] + OK. I'll ... + +Note that SIXBIT/_VZ67@/ is ASCII/ÛRep/. I got two sends in -extremely- +close succession (this was the first of the two) when this happened, so +perhaps there is a timing screw in DDT's %PICLI handler? Perhaps there is +a bug in the CLI: device? + +Date: 14 March 1985 07:31-EST +From: David Vinayak Wallace +Subject: EMACS escape +To: BANDY @ MIT-MC +cc: BUG-SEND @ MIT-MC +In-reply-to: Msg of 14 Mar 1985 02:16-EST from Andrew Scott Beals + +Write it to a file FIRST and then use "I" or "A." + +I, for one, am sick and tired of whining people like you who are always +demanding useless things like EMACS escapes, debuggers, and other +"features." Why can't you all just type correctly the first time? + +Date: 14 March 1985 02:16-EST +From: Andrew Scott Beals +To: BUG-SEND @ MIT-MC + +There isn't an emacs escape to send! + +How do you expect us to send each other screenfulls and screenfulls +of cruft which is all relavant and topical if we don't have an +emacs escape? + + +complainingly, + andy + +Date: 27 February 1985 01:49-EST +From: Eli Liang +To: BUG-DDT @ MIT-MC + +logged off at 0:35 about by accidentally quiting telnet +at 1:45 I telneted from cvl.arpa to mit-mc, tred to sign on rms's +acct with a rms$u but of couse it was still disconnected +and it told me so, so i then did a sign on into my acct with a eli$u +typed in my passwd and it says: + +[OK] +[Home dir=GUEST1] +--Attach Your Detached Tree-- + +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. + +<-eli> + + +Date: 26 February 1985 08:57-EST +From: Christopher C. Stacy +Subject: another SENDER feature +To: BUG-SEND @ MIT-MC, BUG-MAIL @ MIT-MC +cc: GSB @ MIT-MC, ALAN @ MIT-MC + +I added TCP/SMTP code to SENDER today, so it will now do interactive +sends directly to foreign sites, rather than going through COMSAT. + +Date: 19 February 1985 17:03-EST +From: Michael B. McIlrath +To: BUG-DDT @ MIT-MC + +I had disconnected a supdup connection without logging out. +When I logged back in and "attached my detached tree" DDT +printed +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DECRIBING CIRCUMSTANCES. + +I have no idea what this is about. + +Date: 14 February 1985 14:45-EST +From: Alan Bawden +To: BUG-SEND @ MIT-MC + +I created a Bug-SEND mailing list since people frequently send mail to that +address. It goes to both Bug-SENDER and to Bug-DDT, since :SEND might use +either SENDER or DDT's built-in command. + +Date: 7 February 1985 16:40-EST +From: David Vinayak Wallace +Subject: :OUTTEST logs me out +To: BUG-DDT @ MIT-MC + + + +Date: 7 February 1985 04:20-EST +From: Ian Macky +Sender: GRENNY @ MIT-MC +To: BUG-DDT @ MIT-MC + +phr's bug was a blown hack inplanted in his hactrn... + +Date: 7 February 1985 04:10-EST +From: Paul Rubin +To: BUG-DDT @ MIT-MC + +I tried to read some sends files using ctrl-A and I got the message +"DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES." +I don't think I did anything that I haven't done many times before. + +Oh. I was telnetted from another host, and had the tn process +stopped so some buffers might have gotten clogged. But I don't +think so, there wasn't much typeout waiting when I finally looked. + +Date: 4 February 1985 16:40-EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +I fixed a fencepost bug in the directory lister. + +Date: 1 February 1985 06:44-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +Sometimes when you are debugging two jobs that communicate with each other +you want to single-step one of them without giving it the TTY. Well, I +found that ^N^Z^P does not work (the ^N is forgotten) but $^N^Z^P does. +Seems to me that both should. When the $^N'd syscall returns I get a +notification from DDT [Job FOO returning] which is how I know it worked. + +Date: 29 January 1985 00:25-EST +From: Andrew Scott Beals +Subject: a thousand pardons +To: BUG-DDT @ MIT-MC + +Somenow the control characters in my init file got converted into their +printing equivalents, which was causing it to luse. + +Sorry for bothering y'all. + andy + +Date: 26 January 1985 08:13-EST +From: Leo P. Harten +To: BUG-DDT @ MIT-MC + +While listing a long series of files using :find, and with the cursor at the +bottom of the H19 screen with --MORE-- prompt, the receipt of a send caused +a .VAL 0 and a return to DDT from FIND. ALT-P returned to the FIND, and +a new send while waiting at the --MORE-- caused the .VAL 0 again. I may have +typed a space before the --MORE-- prompt, if that makes any difference in +an attempt to reproduce this behavior. Not what I call a high-priority bug... + +Date: 26 January 1985 06:41-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +if I fjob something and then ujob it it doesn't get reowned even if it should. + +Date: 26 January 1985 02:54-EST +From: George I. Fann +To: BUG-DDT @ MIT-MC + +describing d +circumstac +nces + + +Date: 22 January 1985 01:14-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +This is probably actually a TAC bug, perhaps some interaction with the +telnet commands in my login file, but just now it hung waiting for me +to type a space in response to a "--more--" type query, but didn't send +the prompt until AFTER i typed the space. I don't know where else to +report this, but i vaguely recall this happening before (long ago) + +Date: 21 January 1985 02:08-EST +From: "Lawrence A. DeLuca, Jr." +To: BUG-DDT @ MIT-MC + + +hi...i don't think it was ddt's fault, but all of a sudden i got +a lot of UUUUUU's across my screen which seemed to confuse it... + +it gave the DDT ERROR -- USE :BUG DDT TO REPORT THE MESSAGE + +so i guess the coredumps are mine... + + henrik (larry deluca) + + +Date: 20 January 1985 10:44-EST +From: Christopher C. Stacy +Subject: HSNAME change +To: ALAN @ MIT-MC +cc: BRUC @ MIT-MC, BUG-DDT @ MIT-MC, BUG-INQUIR @ MIT-MC, + BUG-ITS @ MIT-MC, KMP @ MIT-MC, TAFT @ MIT-MC, + USER-ACCOUNTS @ MIT-MC +In-reply-to: Msg of 19 Jan 1985 02:35-EST from Alan Bawden + +I fixed this (right this time). + +Date: 19 January 1985 02:35-EST +From: Alan Bawden +Subject: HSNAME change +To: CSTACY @ MIT-MC, KMP @ MIT-MC, BUG-INQUIR @ MIT-MC +cc: USER-ACCOUNTS @ MIT-MC, BRUC @ MIT-MC, BUG-DDT @ MIT-MC, + TAFT @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 18 Jan 1985 23:48-EST from Robert E. Bruccoleri + + Date: 18 January 1985 23:48-EST + From: Robert E. Bruccoleri + My home directory was changed from USERS0; to GUEST0; recently + without the relocation of my files or the redirection of my mail.... + + Date: 18 January 1985 23:59-EST + From: Kent M Pitman + INQUIR seems to give people with a "Z" designation (clinical decision + making group) a GUESTn home dir if they don't have a home dir of their + own. This is arguably a bug.... + +Earlier the same day.... + + Date: 18 January 1985 09:26-EST + From: Christopher C. Stacy + Subject: AI file directories + To: BUG-INQUIR at MC + cc: BUG-DDT at MC, BUG-ITS at MC, KMP at MC, TAFT at MC + Enough occasional and small users from AI use MC now that I was + getting tired of using INQUIR to manually force their home directory + to be AI0. This morning I taught INQUIR that if an "A" person comes + along who does not have a directory, it will automatically stick them + in AI0 (rather than USERSn). Of course, if AI0 starts getting too + full due to many people, we can make more dirs. But I don't think + that's too likely since most AI people with alot of files have their + own directory and don't need to use AI0. + +Well, more than just AI users seem to have their directories changed, so I +retracted the new version of LSRTNS, reassembled DDT (being careful to +increment the version number this time) and installed it. The buggy +ATSIGN DDT was renamed to be ATSIGN XDDT. + +Date: 18 January 1985 09:27-EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +The latest DDT installed on MC is simply a reassembly which includes +the latest version of LSRTNS. + +Date: 18 January 1985 09:26-EST +From: Christopher C. Stacy +Subject: AI file directories +To: BUG-INQUIR @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, KMP @ MIT-MC, TAFT @ MIT-MC + +Enough occasional and small users from AI use MC now that I was +getting tired of using INQUIR to manually force their home directory +to be AI0. This morning I taught INQUIR that if an "A" person comes +along who does not have a directory, it will automatically stick them +in AI0 (rather than USERSn). Of course, if AI0 starts getting too +full due to many people, we can make more dirs. But I don't think +that's too likely since most AI people with alot of files have their +own directory and don't need to use AI0. + + +Date: 14 January 1985 13:30-EST +From: Alan Bawden +Subject: hardware lossage +To: BUG-DDT @ MIT-MC +cc: RMC @ MIT-MC +In-reply-to: Msg of 13 Jan 1985 23:59-EST from R. Martin Chavez + + Date: 13 January 1985 23:59-EST + From: R. Martin Chavez + Host closing connection...whil I was finally getting rid of a big file + tooo! + + Date: 14 January 1985 00:05-EST + From: R. Martin Chavez + Sorry...I was reading mail, and for no apparent reason, got + Host closing connection. + + A simple re-open and login worked; The system prompted me to send + the BUG DDT, hence your previously uninformative message. + +I would hazzard a guess that this has something to do with the parity +errors that MC was getting at the moment this happened... + +Date: 14 January 1985 00:05-EST +From: R. Martin Chavez +To: BUG-DDT @ MIT-MC + +Sorry...I was reading mail, and for no apparent reason, got +Host closing connection. + +A simple re-open and login worked; The system prompted me to send +the BUG DDT, hence your previously uninformative message. + +Date: 13 January 1985 23:59-EST +From: R. Martin Chavez +To: BUG-DDT @ MIT-MC + + +Host closing connection...whil I was finally getting rid of a big file tooo! + +Date: 13 January 1985 23:59-EST +From: R. Martin Chavez +To: BUG-DDT @ MIT-MC + + +Host closing connection...whil I was finally getting rid of a big file tooo! + +Date: 11 January 1985 19:37-EST +From: Leigh L. Klotz +To: TAR @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 9 Jan 1985 15:48-EST from Thomas A. Russ + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 + To: BUG-ITS + + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +Probably you, in your incarnation as TAR0, were trying to :CHUNAM to +TAR, but there already was a TAR, possibly detached. DDT was informing +you in its usual terse fashion, (which has saved us at last count over +2^23 character output calls since ITS was first booted). + + +Date: 9 January 1985 17:19-EST +From: Glenn S. Burke +To: BUG-DDT @ MIT-MC +cc: TAR @ MIT-MC + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 @ MIT-MC + + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +If ddt used USRVAR to change the uname it could detect the job-already-exists +error and produce a more coherent error message, and not have to special-case +the ilopr as it does now. + +Date: 9 January 1985 16:45-EST +From: Alan Bawden +Subject: :CHUNAME +To: TAR @ MIT-MC, BUG-DDT @ MIT-MC + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 + To: BUG-ITS + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +Since you sent this message while logged in as TAR0 I'll make a guess about +the nature of the problem. If you are logged in as TAR0, and still logged +in elsewhere as TAR, and you try ":CHUNAME TAR" it will fail because you +can't be logged in twice with the same name. (I don't think it would be +reasonable for :CHUNAME to go and gun someone named TAR just because you +wanted to be logged in under that name yourself.) In that situation +:REATTACH is usually what people want. + +Of course this is just a guess. If you weren't still logged in elsewhere +as TAR, then there would be a bug. + +[ Bug-DDT: It would be nice if DDT gave an explanatory error message in the + case outlined above, rather that just cryptically saying "?". ] + +Date: 9 January 1985 16:04-EST +From: Christopher C. Stacy +To: TAR @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 9 Jan 1985 15:48-EST from Thomas A. Russ + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 + To: BUG-ITS + + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +This would probably be a DDT bug, not an ITS bug. +:CHUNAME works fine for me. Please send a real bug report, +specifying the input you gave the function. + +Date: 4 January 1985 17:40-EST +From: Ian Macky +To: BUG-DDT @ MIT-MC + +you can't flush :corprt by rubbing the --more--, how annoying. +you have to ^g... + +Date: 3 January 1985 08:20-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +Earlier I sent a bug report complaining that SEND was not prompting me after sending... +Here is the screw I just figured out: +:send foo bla bla bla bleh^W(oops nothing happened so I'll just do)^L +(hey, the ^W didn't work, funny)^W bla bla bla^C + +Well is send is smart enought to become mail, it should be able to deal +intelligently with this too, eh? + +Date: 29 December 1984 16:57-EST +From: Alan Bawden +Subject: :MOVE +To: BUG-DDT @ MIT-MC + +A random wanted to create SYS;TS ATHENA so he did: + +:MOVE SYS3;TS OZ,SYS;TS ATHENA + +Since :MOVE just opens the input file, sucks out the bits, and then does +DELEWO, this had the same effect as + +:MOVE SYSBIN;SUPDUP BIN,SYS;TS ATHENA + +which broke all of the other supdup aliases. Perhaps :MOVE should check +for links first and create a new link with the same target instead? + +Date: 15 December 1984 02:30-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + + +is this normal behavior? + +:mail u@h +Msg: +bla bla blah...^C<---cursor stays right there, giving no indication that +the ^C did anything and that you are now talking to DDT toplevel. + +Date: 4 November 1984 14:42-EST +From: Alan Bawden +Subject: I just checked and he isn't blue... +To: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Every once in a great while when I log in I discover that %TOMOR is not set +in my TTYOPT word. Since my LOGIN does nothing to change the default +setting of more processing it must be the case that normally ITS or DDT (or +PWORD?) turns it on. Well sometimes, given a blue Moon or something, it +must fail to work... + +Date: 30 October 1984 11:46-EST +From: Kenneth Byrd Story +To: BUG-DDT @ MIT-MC + +I keep getting logged-out automatically by mc; what's the problem? + +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 113864; Tue 23-Oct-84 20:30:36-EDT +Date: Tue, 23 Oct 84 20:30 EDT +From: "David A. Moon" +Subject: RDIO 2,100000 +To: Alan Bawden +cc: CSTACY@MIT-MC.ARPA, KS-ITS@MIT-MC.ARPA, BUG-DDT@MIT-MC.ARPA +In-Reply-To: The message of 23 Oct 84 00:28-EDT from Alan Bawden +Message-ID: <841023203030.9.MOON@EUPHRATES.SCRC.Symbolics> + + Date: 23 October 1984 00:28-EDT + From: Alan Bawden + + Barf. I was faked out today by DDT not understanding how to assemble typed + in KS IO instructions properly. The random kludges necessary to get the + traditional IO instructions to type in correctly (like "CONI 4," which does + not put the 4 in the same place as "MOVE 4," does) manage to screw the new + RDIO/WRIO instructions. Apparently DDT just checks for ones in the top three + bits of the opcode to determine that it should do the kludge. The effect + is really confusing if you don't know whats going on: you type + "RDIO 2,100000" and the answer appears in AC 4. Perhaps somebody else on + KS-ITS who wants to help us out would be willing to stomp out this buglet? + + Timesharing DDT has the same bug almost. It masks out the low two bits of + the AC field before putting it in the wrong place. + + MIDAS does the right thing by making the kludge a property of the symbol + rather than a property of its value. + +I believe that the right way to fix this is to check whether bits 0-8 of the +word are equal to 700 when storing the AC field. If they are, it's an old-type +I/O instruction and the AC number is really a device number and needs to +be shifted. If they aren't, it's a normal instruction and the AC field is +an AC field. Probably DDT currently checks bits 0-2 instead, but that's wrong. + +Date: 23 October 1984 00:28-EDT +From: Alan Bawden +Subject: RDIO 2,100000 +To: CSTACY @ MIT-MC +cc: KS-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Barf. I was faked out today by DDT not understanding how to assemble typed +in KS IO instructions properly. The random kludges necessary to get the +traditional IO instructions to type in correctly (like "CONI 4," which does +not put the 4 in the same place as "MOVE 4," does) manage to screw the new +RDIO/WRIO instructions. Apparently DDT just checks for ones in the top three +bits of the opcode to determine that it should do the kludge. The effect +is really confusing if you don't know whats going on: you type +"RDIO 2,100000" and the answer appears in AC 4. Perhaps somebody else on +KS-ITS who wants to help us out would be willing to stomp out this buglet? + +Timesharing DDT has the same bug almost. It masks out the low two bits of +the AC field before putting it in the wrong place. + +MIDAS does the right thing by making the kludge a property of the symbol +rather than a property of its value. + +Date: 28 September 1984 02:01-EDT +From: Ian Macky +To: BUG-DDT @ MIT-MC + +:CORPRT should be smarter about grouping similar pages, not devote one +line to each always. Also, even tho you get a flushed at --More--, +it really doesn't, and continues blasting out stuff. + +Date: 29 August 1984 15:15-EDT +From: Jon Solomon +To: BUG-DDT @ MIT-MC + +never mind, I see what happened. forgive my last message. + +Date: 29 August 1984 15:11-EDT +From: Jon Solomon +To: BUG-DDT @ MIT-MC + + +I shouldn't really bother you guys with a problem in my +init file, but I have a problem with my init file. + +I set things so that ^G says "feep" tather than "quit". +Don't ask me why, I think it's cute. + +The problem is that recently ddt changed version numbers and +the label I'm supposed to change isn't the one I thought it was. +Can anyone tell me what label to use? If you want to see more, +look at cpr;jsol login. Thanks. + +--JSol + +Date: 26 August 1984 01:13-EDT +From: Alan Bawden +Subject: alt alt control F not hairy enough! +To: MOON @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 25 Aug 1984 16:41-EDT from David A. Moon + + Date: 25 August 1984 16:41-EDT + From: David A. Moon + It doesn't look like there's any way currently to customize it so + cstacy $$3^F will show dir:cstacy;cdate down rather than + dir:foobar;cdate cstacy. Would it be right to make a prefix argument + go in the directory if both DIRFN1+n and DIRFN2+n are nonzero, or would + that screw up other things? + +If you look in my LOGIN file and in the source of DDT you will find that I +have already implemented an experimental version of  that does things +like what you describe here. (As well as most of the other suggestions I +could find about .) The result works fine, but the interface sucks and +is still less general than I would like, despite its amazing +programmability. I don't plan to document it, I plan to rip it out and +install something that lets you execute a little (assembly language) +program to say what to do and then to supply a bunch of little programs +people can "bind" to numbers as they like. + +Date: 25 August 1984 16:41-EDT +From: David A. Moon +Subject: alt alt control F not hairy enough! +To: BUG-DDT @ MIT-MC + +It doesn't look like there's any way currently to customize it so +cstacy $$3^F will show dir:cstacy;cdate down rather than dir:foobar;cdate cstacy. +Would it be right to make a prefix argument go in the directory if both +DIRFN1+n and DIRFN2+n are nonzero, or would that screw up other things? + +Date: 24 August 1984 21:22-EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +DDT is write locked. + +Date: 17 August 1984 21:04-EDT +From: Alan Bawden +Subject: Not my fault +To: KMP @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 17 Aug 1984 18:57-EDT from Kent M Pitman + + Date: 17 August 1984 18:57-EDT + From: Kent M Pitman + :OUTTEST is documented to do the actions normally associated with + logging out. Is it really reasonable that it should also log one out? + It seems unsymmetric with :INTEST and is also completely worthless as a + way of testing the logout if it is functionally equivalent to :LOGOUT. + +You set BYERUN don't you. + +As I reported a month ago when I was looking at that code, setting BYERUN +causes OUTTEST to actually log you out. Whoever added the BYERUN feature +made setting that switch do precisely ":BYE +1U". Since OUTTEST and LOGOUT share a fair amount of code its not clear +how to disentangle them to make this work. I don't plan to touch it. + +Date: 17 August 1984 18:57-EDT +From: Kent M Pitman +Sender: KMP0 @ MIT-MC +To: BUG-DDT @ MIT-MC + +:OUTTEST is documented to do the actions normally associated with logging +out. Is it really reasonable that it should also log one out? It seems +unsymmetric with :INTEST and is also completely worthless as a way of testing +the logout if it is functionally equivalent to :LOGOUT. + +Date: 5 August 1984 23:42-EDT +From: Alan Bawden +Subject: chuname broken +To: MLY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 5 Aug 1984 22:31-EDT from Richard Mlynarik + + Date: 5 August 1984 22:31-EDT + From: Richard Mlynarik + Sender: MLY0 + logged in as anything, and typing ":chuname mly" at ddt + gets me the right "--massacre and reset--" but confirming + with a space just gets me a "?" and my uname is still the same. + +This bug report seems to be saying that you were unable to get CHUNAME to +work under any circumstances. Funny, because I can't seem to get it to +fail under any circumstances. I notice that you sent this bug report +logged in as "MLY0", perhaps you can tell me what other MLY's were logged +in at the time, what you were logged in as, and what you tried to CHUNAME +to. + +Date: 28 July 1984 14:24-EDT +From: Alan Bawden +To: GUMBY @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 28 Jul 1984 05:17-EDT from David Vinayak Wallace + + Date: 28 July 1984 05:17-EDT + From: David Vinayak Wallace + Now I have a logout file, BYERUN seems to be ignored + +If you have a LOGOUT file, you don't -need- BYERUN. + +Date: 28 July 1984 05:17-EDT +From: David Vinayak Wallace +To: BUG-DDT @ MIT-MC + +Now I have a logout file, BYERUN seems to be ignored + +Date: 19 July 1984 04:42-EDT +From: Alan Bawden +Subject: More logout grinching +To: GUMBY @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 19 Jul 1984 04:03-EDT from David Vinayak Wallace + + Date: 19 July 1984 04:03-EDT + From: David Vinayak Wallace + Now all the winning things have been fixed with questions and logout, how + come the  in my logout file gets printed? (as in: + u + MC ITS .... + ?) + +1. Thats not the ^W in your logout file being echoed. Thats caused by the + fact that you have a matching ^V at the end of your LOGOUT. Remove + that ^V, and you won't have anything to complain about. (Don't ask + what causes it. Its not something recent either...) + +2. If you try logging out sometime when you don't have an E job at all, you + will be surprised. I think there is probably a bug with JOBP here, but + I'm not planning on looking for it. + +3. Its probably a bad idea to do a :JOBP E in your logout file in the + first place. Suppose you have an Emacs job with something valuable in + it, but you want to log out. You do :DISOWN to disown the Emacs so + loggin out won't kill it. You type $$U. Your LOGOUT file then does + :JOBP E, reowning your Emacs. Then when you get logged out, your Emacs + job gets killed. + +4. WHat happens if you have an E0 job? + +5. If I were you, I would write a little program in Midas to run in my + LOGOUT file that performs the test you really want (look for jobs whose + superior is the correct job, whose XJNAMEs are "E", "EMACS", etc. and + put together an appropriate string to .VALUE), rather than trying + to get DDT to do it for me. + +Date: 19 July 1984 04:03-EDT +From: David Vinayak Wallace +Subject: More logout grinching +To: BUG-DDT @ MIT-MC + +Now all the winning things have been fixed with questions and logout, how +come the  in my logout file gets printed? (as in: + u +MC ITS .... +?) + +david + +Date: 14 July 1984 03:27-EDT +From: Alan Bawden +Subject: Its a mystery to me. +To: BUG-ITS @ MIT-MC +cc: BUG-DDT @ MIT-MC + +How come when a job gets a parity error its superior DDT always gets a +%PIB42? DDT seemingly get it simultaneous with the interrupt from the +inferior, but thats what you would expect of a real B42, right? There +doesn't seem to be anything wrong with what DDT is doing as far as I can +tell... + +Date: 10 July 1984 00:49-EDT +From: Alan Bawden +To: DCP @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, CSTACY @ MIT-MC +In-reply-to: Msg of 10 Jul 1984 00:19-EDT from David C. Plummer + + Date: 10 July 1984 00:19-EDT + From: David C. Plummer + I'm still not a speed reader. (I'm coming in over a vadic, + AAA, ITS 1370, DDT 1480.) U prints the bye + message and then clears the screen. + +OK, OK. I fixed it again. If its still broken, perhaps you better see +Evelyn Wood, because I can't imagine how I can have failed to fix it this +time. + +Date: 10 July 1984 00:19-EDT +From: David C. Plummer +To: ALAN @ MIT-MC, BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC, CSTACY @ MIT-MC + +I'm still not a speed reader. (I'm coming in over a vadic, +AAA, ITS 1370, DDT 1480.) U prints the bye +message and then clears the screen. + +Date: 9 July 1984 19:35-EDT +From: Alan Bawden +Subject: This one isn't my fault +To: BUG-DDT @ MIT-MC + +The :LOGOUT/:OUTTEST/:CHUNAME code really is gross. +I just noticed an apparently old bug where setting BYERUN causes +:OUTTEST to actually log you out after running BYE. If BYERUN isn't set, +then you don't get logged out. Yuck. + +Date: 9 July 1984 19:10-EDT +From: Alan Bawden +Subject: oops +To: DCP @ MIT-MC, BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 9 Jul 1984 10:14-EDT from David C. Plummer + + Date: 9 July 1984 10:14-EDT + From: David C. Plummer + Either ITS was changed, or DDT was, and for the worse. + When I log out, it does a :BYE followed by :OUTEST. + I don't think either of these are at fault. What happens + is that it prints the BYE message, and then clears the + screen before printing the console free message. Needless + to say, I'm not a speed reader. + +Believe it or not, another symptom of this same bug was the fact that +:CHUNAME didn't work anymore. I fixed the bug and installed a new DDT. + +Date: 9 July 1984 16:35-EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I de-installed the latest DDT, since there are all these bug +reports coming in and the responsible hacker is asleep now. + +Date: 9 July 1984 16:30-EDT +From: Leslie Bromberg +To: BUG-DDT @ MIT-MC + +I was trying to do a chuname to a friend's name for him to use my terminal, +and got a message saying ddt bug: please do ...... +anyway, the transfer of login names did not work.... +is chuname still around and operating?? + +Date: 9 July 1984 10:14-EDT +From: David C. Plummer +To: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Either ITS was changed, or DDT was, and for the worse. +When I log out, it does a :BYE followed by :OUTEST. +I don't think either of these are at fault. What happens +is that it prints the BYE message, and then clears the +screen before printing the console free message. Needless +to say, I'm not a speed reader. + +Date: 9 July 1984 03:11-EDT +From: Alan Bawden +Subject: Another --Kill etc -- bug +To: BUG-DDT @ MIT-MC +cc: GUMBY @ MIT-MC +In-reply-to: Msg of 6 Jun 1984 05:55-EDT from David Vinayak Wallace + + Date: 6 June 1984 05:55-EDT + From: David Vinayak Wallace + Try this: + fooj + ..safe/-1 + barj + u + You will be asked --Kil Protected Job-- + Type space. You are asked again. + Very confusing. bar has a zero ..safe. + +I fixed this and will install it in a moment. While I was at it I fixed +DDT to always ask those questions about Killing Protected Jobs and Despite +Pending Alarms, etc. with the TTY turned on so that the user would know +what DDT was waiting for. + +Date: 6 July 1984 20:53-EDT +From: David Vinayak Wallace +Subject: :SSTATU and :VERSIO within xfile +To: BUG-DDT @ MIT-MC + +:SSTATUS and :VERIO don't work within an XFILE. +The only way I can get them to print out is to +:SSTATUS +:VERSIO +which still prints a prompt after each command. + +Date: 6 June 1984 05:55-EDT +From: David Vinayak Wallace +Subject: Another --Kill etc -- bug +To: BUG-DDT @ MIT-MC + +Try this: +fooj +..safe/-1 +barj +u +You will be asked --Kil Protected Job-- +Type space. You are asked again. +Very confusing. bar has a zero ..safe. + +david + +Date: 4 June 1984 15:26-EDT +From: Benjamin Kuipers +To: BUG-DDT @ MIT-MC + +While logged in via 1200 baud Vadic, and doing $^A to HACTRN to read +new mail, my carrier suddenly disappeared. Later, when I logged +back in, and attached my detached tree, HACTRO told me +"DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES." +which I hereby do, for whatever good it may do you. +Cheers. + Ben + +Date: 2 June 1984 15:55-EDT +From: Alan Bawden +Subject: --Despite lossage?-- +To: GUMBY @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 1 Jun 1984 23:47-EDT from David Vinayak Wallace + + Date: 1 June 1984 23:47-EDT + From: David Vinayak Wallace + Can't you just end your logout file with :VK? + +Certainly that wouldn't be acceptable since it would then print out a ddt +prompt before the console free message. Better would be enough 's to +zero out TTYFLG. Best would be for unexpected messages of the form +--Despite pending braindamage?-- to make sure they are always seen so that +users don't have to do queer things like putting wierdness in their LOGIN +and LOGOUT files. (Like you know why every LOGIN.CMD file on 20X ends with +"TAKE"?) + +Date: 1 June 1984 23:47-EDT +From: David Vinayak Wallace +Subject: --Despite lossage?-- +To: ALAN @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 1 Jun 1984 20:51-EDT from Alan Bawden + +Can't you just end your logout file with :VK? + +Date: 1 June 1984 20:51-EDT +From: Alan Bawden +Subject: --Despite lossage?-- +To: GUMBY @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 1 Jun 1984 04:17-EDT from David Vinayak Wallace + + Date: 1 June 1984 04:17-EDT + From: David Vinayak Wallace + It would be nice if, when I log out DDT would run my LOGOUT file before + checking for jobs with their ..safe set. I have a logout file that looks + for an E with its ..safe set, and zeros it before logging out. This + doesn't get run until I've already been asked "Kill protected job?" + +Related problem: The --Despite pending alarm?-- message you get when you +try and log out with a :ALARM still waiting to go off happens after your +logout file has been run. According to Gumby's reasoning this is better +than having it run first, because then your LOGOUT can check for that +occurance. Unfortunately there is this other bug where if your LOGOUT file +uses , as most do, the --Despite pending alarm?-- gets asked INVISIBLY! +Of course it is still waiting for a confirming space character, so it looks +to the user like his LOGOUT is just hanging. If anybody does anything +about this, they should deal with this problem as well. + +Date: 1 June 1984 04:17-EDT +From: David Vinayak Wallace +To: BUG-DDT @ MIT-MC + +It would be nice if, when I log out DDT would run my LOGOUT file before +checking for jobs with their ..safe set. I have a logout file that looks +for an E with its ..safe set, and zeros it before logging out. This +doesn't get run until I've already been asked "Kill protected job?" + +david + +Date: 29 May 1984 16:45-EDT +From: Sarah L. Ferguson +To: BUG-DDT @ MIT-MC + +I dialed up mc from NJ, line got munged, after I had logged on. +When I reconnected and reattached my old tree, I got a nessage saying +that there was a ddt bug and I should report it. I don't see any +bug symptoms to report, except for the message itself. Possibly (but not +likely) relevent details are that I'm using a stupid hp2621a, and an +automatic dialout. + +Date: 8 May 1984 02:02-EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +Reattaching has some bug, probably due to tty info changing. + +Date: 29 April 1984 22:26-EST +From: Alan Bawden +Subject: TCP:/CHAOS: Host 259, Local 17, Foreign 105 +To: BUG-DDT @ MIT-MC + +In the source (DDT 1471), I made DDT print TCP: and CHAOS: filenames +rationally. + +Date: 22 April 1984 23:19-EST +From: Christopher C. Stacy +Subject: login init problems +To: SULLIV @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 22 Apr 1984 17:37-EST from Michael E. Sullivan + + +The :EXISTS at the end of your login init leaves a random value lying +around. I bet this gets slurped up or mixed up in some VALRETted +stuff from EMACS or something pretty soon, causing randomness. +Something very similar happenned to me a while back, although I don't +remember the details. I fixed this bug in your init file, so let's +see if the problem goes away. + +Date: 22 April 1984 23:05-EST +From: Alan Bawden +Subject: CHECKSUM? +To: BUG-DDT @ MIT-MC, SULLIV @ MIT-MC +In-reply-to: Msg of 22 Apr 1984 17:37-EST from Michael E. Sullivan + + Date: 22 April 1984 17:37-EST + From: Michael E. Sullivan + When I log on, something strange happens somewhere.... + + If I run :babyl it says almost immediately: + ^V CHECKSUM:INPUSH + This is totally damaged, and I have to $^X. and start again. + +I had never seen DDT say "CHECKSUM?" until this afternoon, when I tried to +L something (I forget just what) and this resulted. (This was before I +read SULLIV's message.) Ling it again worked. I didn't even know that +this message was in DDT's repertoire of complaints. I suppose this could +be a tremendous coincidence... + + ... I've also noticed that if I type a number + (like 4000000) then a job, it loses in the same way. + +What does it mean to "type a number then a job"? If I type 105E or 105:E or +anthing else I can think of that might be described in this way, nothing +unusual happens to me. + +Date: 22 April 1984 17:37-EST +From: Michael E. Sullivan +To: BUG-DDT @ MIT-MC +cc: SULLIV @ MIT-MC + + +When I log on, something strange happens somewhere. I'm not sure what +causes it; probably something in my login file (it's not the cleanest +thing you've ever seen). Anyway, the first job I start after the +login file ends always aborts for one reason or another. If I start +off with Emacs (GSB's E version) it prints the header then it says: + NOS? :INPUSH 102010 +It can be $P'd and it then works normally. +If I run :babyl it says almost immediately: +^V CHECKSUM:INPUSH +This is totally damaged, and I have to $^X. and start again. + +If I type a ^L before doing any of this, it types: 4000000 what I +first took to be an open memory location. But there is no slash. If +I type either before or after ^L, the first job doesn't lose. + +This has only been happening for several months. I first noticed it +after a new version of DDT was installed, although I'm not sure other +things didn't change also. I've also noticed that if I type a number +(like 4000000) then a job, it loses in the same way. + +Date: 19 April 1984 23:08-EST +From: Mark E. Becker +To: BUG-DDT @ MIT-MC + +Just got DDT BUG message. Did a send to another user that somehow hung +my terminal. Couldn't get loose so did @R to local tac and re-opened +connection. Re-owned job after logging back in and tried to resume a +connection to MIT-OZ. And thats what did it. + +Date: 16 Apr 1984 12:32 PST (Mon) +Message-ID: <[SRI-NIC].IAN.16-Apr-84 12:32:30> +From: Ian Macky +To: Alan Bawden +Cc: BUG-DDT@MIT-MC, DEVON@MIT-MC +Subject: Not DDT's problem +In-reply-to: Msg of 16 Apr 1984 12:28-PST from Alan Bawden + +Ah, OK - what made it confusing is that various programs were running +around handling input different ways. I couldn't figure out how n +characters, all echoed at interrupt level, echoed back OUT OF ORDER... + +The answer is they don't. + +Date: 16 April 1984 15:28-EST +From: Alan Bawden +Subject: Not DDT's problem +To: Ian @ SRI-NIC +cc: BUG-DDT @ MIT-MC, DEVON @ MIT-MC +In-reply-to: Msg of 15 Apr 1984 15:56 PST (Sun) from Ian Macky + + Date: 15 Apr 1984 15:56 PST (Sun) + From: Ian Macky + I *still* don't understand how, interrupt-level echoing aside, input + can be echoed back out of order! Why why why? + +I guess I don't see what you are asking exactly. Perhaps if I explained +step by step how Devon's complaints happen: + + Date: 15 April 1984 14:44-EST + From: Devon S. McCullough + I suppose this is pretty well-known by now, but for the record, due + the the various ways characters get echoed, if I type F ^L ^K I get + ^KF! + at the top of the screen, + +This one is easy. Devon types F^L^K very fast. All three characters +echo immediately. Since the way ^L echos is by clearing the screen, he now +has a blank screen with a "^K" in the upper left-hand corner. Now DDT gets +into the act. DDT reads the F and stores it in some kind of type-in +buffer. Next DDT reads the ^L. Since DDT knows that ^L clears the screen, +it redisplays what is in the type-in buffer. This causes DDT to print an +"F" after the "^K". Finally DDT reads the ^K, prints a "!" and starts the +program. + + and if I type E ^H ^X R I get + *^X ^H R + after my * prompt, until Emacs gets around to clearing the screen. + +To understand this one you have to understand that DDT performs a kludge to +cause ^H to appear to echo as "^H" rather than by backing up a character: +When you type a ^H it actually echos by backing up, but when DDT reads it, +it corrects this by moving the cursor forward one position, and then +outputting "^H" (ugh, what a kludge). So in this case Devon types E^H^X +which all echo immediately, which on a terminal with overstriking leaves +him looking at "^X" because the "^" overstruck the "E". DDT now reads the +E and the ^H and performs the ^H kludge resulting in "^X ^H" as the +display. If the next thing Devon types is R, and if he really then sees +"^X ^H R", then I suspect that the EMACS that is now running has probably +output a space (I can't exactly reproduce it because it depends so +critically on timing that I can't control). + +Date: 15 Apr 1984 15:56 PST (Sun) +Message-ID: <[SRI-NIC].IAN.15-Apr-84 15:56:09> +From: Ian Macky +To: Alan Bawden +Cc: BUG-DDT@MIT-MC, DEVON@MIT-MC +Subject: Not DDT's problem +In-reply-to: Msg of 15 Apr 1984 13:19-PST from Alan Bawden + +I *still* don't understand how, interrupt-level echoing aside, input +can be echoed back out of order! Why why why? + +Date: 15 April 1984 16:19-EST +From: Alan Bawden +Subject: Not DDT's problem +To: DEVON @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 15 Apr 1984 14:44-EST from Devon S. McCullough + + Date: 15 April 1984 14:44-EST + From: Devon S. McCullough + I suppose this is pretty well-known by now, but for the record, due + the the various ways characters get echoed, if I type F ^L ^K I get + ^KF! + at the top of the screen, and if I type E ^H ^X R I get + *^X ^H R + after my * prompt, until Emacs gets around to clearing the screen. + +Not really a DDT bug. Almost every program on ITS exhibits some form of +this behavior. Its what comes from letting ITS echo your characters at tty +interrupt level. Programs can prevent it from happening, if they want, by +requesting main program level echoing (like 20X -- ITS gives you the +choice) or echoing characters themselves. The default is interrupt level +echoing, and most programs don't bother to request anything else. + +You can think of it as a feature: it lets you see your typeahead rather +than hiding it from you until your program actually eats it. + +Date: 15 April 1984 14:44-EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +I suppose this is pretty well-known by now, but for the record, due +the the various ways characters get echoed, if I type F ^L ^K I get +^KF! +at the top of the screen, and if I type E ^H ^X R I get +*^X ^H R +after my * prompt, until Emacs gets around to clearing the screen. + +Date: 6 April 1984 02:11-EST +From: Alan Bawden +Subject: 0J +To: BUG-DDT @ MIT-MC +cc: GREN @ MIT-MC +In-reply-to: Msg of 6 Apr 1984 01:21-EST from Ian Macky + + Date: 6 April 1984 01:21-EST + From: Ian Macky + To: BUG-DDT + + $1' $$$J causes a :DDT BUG ... + 123456 spaces here + +0J works just as well. Setting a job's jname to 0 isn't allowed and +generates an IOC interrupt. J should check for this before charging +ahead. + +Date: 6 April 1984 01:21-EST +From: Ian Macky +To: BUG-DDT @ MIT-MC + +$1' $$$J causes a :DDT BUG ... + 123456 spaces here + +Date: 17 March 1984 16:02-EST +From: Alan Bawden +Subject: Didn't this used to work? +To: ALAN @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 16 Mar 1984 16:49-EST from Alan Bawden + + Date: 16 March 1984 16:49-EST + From: Alan Bawden + Doing  USR:ALAN;ALAN E,DSK:ALAN;E > + reproducably generates PLEASE DO :BUG DDT messages. + I had a job named E at the time. + +I doubt that it ever worked. DDT is completely unprepared for the fact +that .IOTing from the USR: device can cause an MPV. + +Date: 16 March 1984 16:49-EST +From: Alan Bawden +Subject: Didn't this used to work? +To: BUG-DDT @ MIT-MC + +Doing  USR:ALAN;ALAN E,DSK:ALAN;E > +reproducably generates PLEASE DO :BUG DDT messages. +I had a job named E at the time. + +Date: 13 March 1984 12:17-EST +From: Alan Bawden +To: CSTACY @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, KMP @ MIT-MC +In-reply-to: Msg of Tue 13 Mar 84 06:54 EST from Christopher C. Stacy + + Date: Tue, 13 Mar 84 06:54 EST + From: Christopher C. Stacy + Date: 29 February 1984 10:59-EST + From: Kent M Pitman + SYS4^F clears the screen and types NON-DIRECTORY DEVICE. + Shouldn't this give a no such directory error? I assume + DDT or ITS is somehow stripping the 4 and assuming I'm + trying to reference the SYS device. My file defaults end + up with SYS4: in them... + I think this might be an ITS bug. In DDT at NCTLF2, it tries to open + the file "SYS4:.FILE. (DIR)", starts up a JOB.07 frob for some reason, + and succeeds. + +As I already said, the place to do something about this is in the unknown +device handler. (You know, SYS;ATSIGN DEVICE? The file we don't have a +source for?) ITS proper, and DDT are doing exactly the right things. + +Date: Tue, 13 Mar 84 06:54 EST +From: "Christopher C. Stacy" +To: BUG-ITS@MIT-MC.ARPA +Cc: Kent M Pitman , BUG-DDT@MIT-MC.ARPA +In-reply-to: The message of 29 Feb 84 10:59-EST from Kent M Pitman + + Date: 29 February 1984 10:59-EST + From: Kent M Pitman + SYS4^F clears the screen and types NON-DIRECTORY DEVICE. + Shouldn't this give a no such directory error? I assume + DDT or ITS is somehow stripping the 4 and assuming I'm + trying to reference the SYS device. My file defaults end + up with SYS4: in them... + +I think this might be an ITS bug. In DDT at NCTLF2, it tries to open +the file "SYS4:.FILE. (DIR)", starts up a JOB.07 frob for some reason, +and succeeds. + +Date: 11 March 1984 16:24-EST +From: Owen T. Anderson +To: BUG-DDT @ MIT-MC + +I just did a reatta ota/k after a network disconnect and was told to +do a bug ddt and report circumstances. I can't find a problem though. +If you want more info send mail to ota@s1-a for fast response + +Date: 9 March 1984 18:21-EST +From: Ian Macky +To: BUG-DDT @ MIT-MC + +:ICHAN does ugly things with a TCP: channel + +Date: 7 March 1984 21:38-EST +From: David C. Plummer +To: BUG-DDT @ MIT-MC + + +"Cannibals in Polynesia no longer allow their tribes to eat Americans +because their fat is contaminated with chlorinated hydrocarbon. Recent +figures published show that we [English] have two parts per million DDT +in out bodies, whereas the figures for Americans is about 11 p.p.m." + + -- From Lord Shackelton's speech in the House of Lords, + reported in the Jerusalem Post, March 21, 1963. + **==> That was David Nason's plan file. + +Date: 2 March 1984 02:15-EST +From: Pandora B. Berman +Subject: pissing on fires +To: ALAN @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-NAME @ MIT-MC, BUG-MAIL @ MIT-MC, + BUG-INQUIR @ MIT-MC + + Date: 2 March 1984 00:17-EST + From: Alan Bawden + Subject: pissing on fires + To: BUG-DDT @ MIT-MC, BUG-NAME @ MIT-MC, BUG-MAIL @ MIT-MC, + BUG-INQUIR @ MIT-MC + The most recent DDT, NAME and COMSAT crashes were all caused by some + confusion over the INQUIR database. Specifically, it looks like + something deleted LSR1 >. Gren unwedged things by the simple expedient + of reinstalling LSR1 OLD as LSR1 >. + Everything seems to be winning now, but it would be nice to know what + happened. Perhaps this is the first wierd side-effect of setting + reference date to be at least two days in the past? + I guess we have possibly lost some inquir updates due to this... + +i think this was my piece of brainlessness for the week. comsat needed +space for the queue file to write out, so i was shifting stuff around. i +deleted lsr1 oldold and moved lsr1 old, then tried to move lsr1 >, but $^R +made it replicate rather than just move to the pack with more space +(presumably because comsat was hanging onto it). so i pulled .mail.; into +dired and (as i thought) deleted the excess, not-being-used-by-comsat +version. everything appeared ok at that time, but maybe i wasn't looking +in the right way. + +Date: 2 March 1984 00:17-EST +From: Alan Bawden +Subject: pissing on fires +To: BUG-DDT @ MIT-MC, BUG-NAME @ MIT-MC, BUG-MAIL @ MIT-MC, + BUG-INQUIR @ MIT-MC + +The most recent DDT, NAME and COMSAT crashes were all caused by some +confusion over the INQUIR database. Specifically, it looks like something +deleted LSR1 >. Gren unwedged things by the simple expedient of +reinstalling LSR1 OLD as LSR1 >. + +Everything seems to be winning now, but it would be nice to know what +happened. Perhaps this is the first wierd side-effect of setting all +reference date to be at least two days in the past? + +I guess we have possibly lost some inquir updates due to this... + +Date: 1 March 1984 23:23-EST +From: Pandora B. Berman +Subject: $^A? +To: BUG-DDT @ MIT-MC + +i was watching comsat, which was delivering a lot of mail to bug-name. +all msgs looked the same length, so i decided to have a peek to see +if anything was wrong (they were from different authors). i did +klotz$^A +at top level and got a +DDT BUG +msg. + +Date: 1 March 1984 23:20-EST +From: Kevin J. Burnett +To: BUG-DDT @ MIT-MC + +I just got a ddt bug for no apparent reason after doing cstacy$^A + +Date: 29 February 1984 10:59-EST +From: Kent M Pitman +To: BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC + +SYS4^F clears the screen and types NON-DIRECTORY DEVICE. +Shouldn't this give a no such directory error? I assume +DDT or ITS is somehow stripping the 4 and assuming I'm +trying to reference the SYS device. My file defaults end +up with SYS4: in them... + +Date: 22 February 1984 22:23-EST +From: Alan Bawden +Subject: ? +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 22 Feb 1984 17:47-EST from Christopher C. Stacy + + Date: 22 February 1984 17:47-EST + From: Christopher C. Stacy + Trying to rename DNRF: to DSK: on same directory gets me + CANT RENAME TO ANOTHER DIRECTORY. + +If you do :CALL RENAME you will find that this can't possibly be an ITS +bug. If you were using DDT, then it is DDT's problem. + +Date: 21 February 1984 04:01-EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +It looks like I need ALAN's super hairy features to win. +Meanwhile, installed latest DDT source (which has HSNAME and 'BIN +defaults removed from N2ACF.) + +Date: 20 February 1984 14:35-EST +From: Alan Bawden +Subject: Hey Penny! It even confuses CStacy! +To: CSTACY @ MIT-MC +cc: BUG-DDT @ MIT-MC, CENT @ MIT-MC +In-reply-to: Msg of 20 Feb 1984 02:53 EST from Christopher C. Stacy + + Date: 20 February 1984 02:53 EST + From: Christopher C. Stacy + I thought that XMAIL$$2^F should set the default from BIN to XMAIL. + Maybe that part of the code is buggy. + + Date: 20 February 1984 09:13-EST + From: Christopher C. Stacy + I am not sure that PFILE1 is being used in all the cases + where it should be. In particular, if I do ":PRINT FOOBAR >", + then "$$1^F" does not look for FOOBAR. Since there is something + already in that DIRFN1 slot, it ignores PFILE1. + +You are very confused. Which is funny, because you wrote this code! +Furthermore, if you go and look at the code now, you will find that I have +completely re-written it, and that I have taken great pains to duplicate +the very feature you are complaining about here because I thought you +thought it was a feature! Rather than de-tangle this through the mails, we +should talk about it in person. + +Date: 20 February 1984 09:13-EST +From: Christopher C. Stacy +Subject: $$^F +To: BUG-DDT @ MIT-MC + +I am not sure that PFILE1 is being used in all the cases +where it should be. In particular, if I do ":PRINT FOOBAR >", +then "$$1^F" does not look for FOOBAR. Since there is something +already in that DIRFN1 slot, it ignores PFILE1. + +Date: 20 February 1984 02:53 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +I thought that XMAIL$$2^F should set the default from BIN to XMAIL. +Maybe that part of the code is buggy. + +Date: 15 February 1984 21:40 EST +From: Richard M. Stallman +To: BUG-DDT @ MIT-MC + + + +Date: 12 February 1984 14:39 EST +From: Kent M Pitman +Subject: DDT crash +To: BUG-DDT @ MIT-MC + +In MC:CRASH;DDTBUG 12 under ITS 1365... + +I got a DDT BUG as I was attaching an accidentally detached tree. + +Just before the tree was detached, I had been in Emacs. The Emacs had +realtime interrupts enabled for a mode line clock. I don't know if +that was related, but one of the first things the tree did upon attaching +was to do buffered redisplay of the mode line. + +Also, the system went down (scheduled, not crash) shortly (2 minutes) +after attaching the tree, so the crash might also have been related +to some interrupt about the system being about to go down that came +to my job either while it was detached or as I was reattaching. + +Date: 11 February 1984 07:37 EST +From: Robert Elton Maas +To: BUG-DDT @ MIT-MC + +:REATTACH REM + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +This was an attempt to save my job after MC burped. + +Date: 8 February 1984 16:13 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +0$$^F should be special cased like 0^F. + +Date: 8 February 1984 13:46 EST +From: Alan Bawden +Subject: $$^F featurama, continued... +To: CSTACY @ MIT-MC +cc: BUG-DDT @ MIT-MC, KLOTZ @ MIT-MC, KMP @ MIT-MC +In-reply-to: Msg of 8 Feb 1984 02:14 EST from Christopher C. Stacy + +Actually, I would much rather have a hack where if DIRFN2+2n is non-zero, +then typing FOOn would always set PFILES, while if DIRFN2+2n was zero, +then it would set PFILE1. + +Hmm.. Actually, what you REALLY want is to be able to specify individually +for each entry in the DIRFN* table exactly how it should behave. Hmm.. If +nobody minds I will hack in a feature like this when I have a free hour or +two. I'll try and be carefull to allow everybody to get the behavior they +desire. (And I'll try to do it in such a way as to not break anyone's +existing LOGIN file...) + +Chris: Stop hacking DDT and finish the ^_ hack so you can get to JOBTTF +(which I have something to say to you about sometime). + +Date: 8 February 1984 13:19 EST +From: Kent M Pitman +Subject:  +To: BUG-DDT @ MIT-MC + +I think the default for normal  should have been left the same as +1. Rotated directory listings can be a real pain at slow speeds +with heavy buffering. The default should be conservative. People who +want the current behavior could always set a variable. I certainly +intend to patch my init to make  do the old thing; but I think +there are a lot of people who won't know how to do that. + +Date: 8 February 1984 02:56 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC +cc: KMP @ MIT-MC, KLOTZ @ MIT-MC + +Hmmm, in actuality I made the DIRFN1 entries agree with the +documentation I gave them, which was wrong if you noticed. +(ie., several UPs should have been DOWNs, although they +were shown correctly for the examples given.) + +Date: 8 February 1984 02:14 EST +From: Christopher C. Stacy +Subject: $$^F featurama, continued... +To: BUG-DDT @ MIT-MC +cc: KMP @ MIT-MC, KLOTZ @ MIT-MC + + +I took some suggestions from KMP and have implemented mostly upwards +compatible extensions to $$^F. These changes allow you to type the +names of simple variations on the DIR: frobs you have put in the +DIRFN1 table (so you don't have to patch as many things). Also, you +can change your default SNAME as well as default FN1. + +If the DIRFN2 slot is zero, if there is no argument, we use the +default FN1; else if there is an argument we use it and set the +default FN1. This is like before. + +If the DIRFN2 slot has something in it, if there is an argument we use +that argument instead of ignoring it like we used to. + +You will also notice I changed the DIRFN1 table to the settings that +many people (including me) had patched in their DDT init files, and +also made the table a little bigger. This is NOT compatible with the +older $$^F behaviour! + +DIRFN1: SIXBIT /NAME1/ ;Table of $$^F DIR: search options. +DIRFN2: SIXBIT /UP/ + SIXBIT /FIRST/ ;$$1^F finds FN1 + 0 + SIXBIT /SECOND/ ;$$2^F finds FN2 + SIXBIT /BIN/ + SIXBIT /CDATE/ ;$$3^F ascending in creation age + SIXBIT /DOWN/ + SIXBIT /SIZE/ ;$$4^F descending in size + SIXBIT /DOWN/ + SIXBIT /NOT/ ;$$5^F not backed up + SIXBIT /DUMPED/ + SIXBIT /ONLY/ ;$$6^F just link pointers + SIXBIT /LINKS/ + + +Examples: + +FOO1 Shows DIR:FIRST FOO and sets FN1 to FOO +LISP2 Shows DIR:SECOND LISP +2 Shows DIR:SECOND BIN +3 Shows DIR:CDATE DOWN +UP3 Shows DIR:CDATE UP +PACK136 Shows DIR:ONLY PACK13 + +The following is an experimental feature I think I like; it needs to +be turned on by setting DIRDIR. $$^F (without a numeric argument) +does like $$0^F, except that it uses the argument (if any) as the +default ^R SNAME to set. + +Examples: + +$$0^F Does DIR:NAME1 UP +$$^F Still does DIR:NAME1 UP +KLOTZ$$^F Changes default dir to KLOTZ and does DIR:NAME1 UP +DOWN$$0^F Doesn't hack default dir (KLOTZ), does DIR:NAME1 DOWN + +These changes (and ALAN's recent ones) will all take place when I +install DDT and update the documentation. + +Date: 7 February 1984 17:27 EST +From: Alan Bawden +Subject: ^F - default setting +To: BUG-DDT @ MIT-MC + +(In the source only) I fixed the two places in the code for ^F that think +they are checking for special devices that should not set the ^R defaults +to both use the same table. (One of those places actually seems to work.) +I also updated the table. + +Date: 1 February 1984 04:50 EST +From: Christopher C. Stacy +Subject: new DDT installed on MC +To: BUG-DDT @ MIT-MC +cc: EPS @ MIT-MC, GSB @ MIT-MC + + +The bug EPS reported in :FJOB has been fixed. +(I think GSB reported one, but I can't find the report.) + +Date: 31 January 1984 22:15 EST +From: Alan Bawden +To: BUG-DDT @ MIT-MC +cc: DEVON @ MIT-MC +In-reply-to: Msg of 31 Jan 1984 21:52 EST from Devon S. McCullough + + Date: 31 January 1984 21:52 EST + From: Devon S. McCullough + but :mail foo^Z doesn't. + +Perhaps someone will explain just what it is that everybody thinks ^Z is +supposed to mean when you type it directly to DDT. I know what ^D is for, +and I know what ^G is for, but as far as I know DDT doesn't do anything +special for ^Z other than the kill-ring kludge for the SEND command. +Before deciding what ":MAIL FOO^Z" should do, a more coherent theory of ^Z +must be designed. It's a pretty silly thing to waste time about anyway +given that it can only work when DDT is a toplevel job. + +Date: 31 January 1984 21:52 EST +From: Devon S. McCullough +To: BUG-DDT @ MIT-MC + +but :mail foo^Z doesn't. + +Date: 31 January 1984 06:59 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +New DDT version 1449 installed on MC. +Contains minor change so that :SEND FOO^Z flushes, +and a TSOPEN TYIC in the Attaching code (maybe will fix JMSK's bug.) + +Date: 31 January 1984 00:28 EST +From: Jacob Moskowitz +To: BUG-DDT @ MIT-MC + +As requested by the "BUG DDT: msg... + + I logged in after (several times) getting disconnected just + now. This time the msg appeared after I answered Y to + --Attach Your Detached Tree-- + +GASP@MIT-ML 01/26/84 21:31:51 +To: (BUG DDT) at MIT-ML +Somehow, when I was running SPELL under CRTSTY all operations came to a halt. When I managed to relog on, I was told to send this msg + +Date: 24 January 1984 17:04 EST +From: Paul G. Weiss +To: BUG-DDT @ MIT-MC + +I wanted to examine a job, but the user had just logged out. Here is +a wallpaper file: + +*:fjob ray hactrn + EJ* DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. :walend + + +Date: 24 January 1984 07:23 EST +From: David Vinayak Wallace +To: BUG-DDT @ MIT-MC + +I've always found it inconsistent that the --mail-- program offers to delete your mail +while reading it with $^A does not. Is this considered a feature? +You see, I'm always afraid that using ^O to delete my mail file will cause me to lose +because the mailer could be delivering something at the time. + +david + +Date: 22 January 1984 23:11 EST +From: David Vinayak Wallace +To: BUG-DDT @ MIT-MC + + + +Date: 9 January 1984 14:35 EST +From: Kent M Pitman +Subject: [JGA: $$3^F default] +To: BUG-DDT @ MIT-MC + +Date: 9 January 1984 11:30 EST +From: John G. Aspinall +To: KMP +Re: $$3^F default + +I like the new $$^F commands, but boy, what wierd filenames +show up in the ^R and ^O default. $$3^F gave me a default of +^Q ^Q ^Q ^Q ^Q # > + +Date: 8 January 1984 14:31 EST +From: Leigh L. Klotz +To: BUG-DDT @ MIT-MC + +Ok, folks, so what state is DDT in now wrt $$n^F? It sounds useful, +but this $$440700^F seems a bit cumbersome for folks like me to use. +Or was it a joke? I vote for $$n^F where n selects one of a limited +set of things. This sixbit stuff seems ridiculous -- why not just use +^R and the dir device and access it symbolically? + +Date: 8 January 1984 04:37 EST +From: Devon S. McCullough +Subject: $$^F +To: BUG-DDT @ MIT-MC + +I often do $$^F only to get nothing, because I'm defaulted to the +wrong directory. It would be nice if I could then do $$0^F and +get what I wanted from the first command. Just plain $$0^F could also +default to my HSNAME. + +Right now I think $$^F and $$0^F are identical, but I suggest that +$$^F should remember the last function selected and do that. + +Instead of $$0^F selecting for and $$1^F giving a wide listing, +how about $$0^F selecting the directory (think of it as ) +and $$1^F selecting for (consistent with $$2^F for ) + +The old behavior is preserved by initializing the sticky $$^F function +to select . + +Date: 6 January 1984 22:11 EST +From: Christopher C. Stacy +Subject: alt alt to you too! +To: INFO-ITS @ MIT-MC, BUG-DDT @ MIT-MC +cc: KMP @ MIT-MC + + +I un-de-generalized the code for $$^F so that you can make all +the FN2s zero and get the default. Ie., you can put searches +in slots besides $$0^F. I also increased the size of the table +a little bit. + +$$0^F FIRST +$$1^F NAME1 UP (verbose listing) +$$2^F SECOND +$$3^F CDATE DOWN +$$4^F SIZE DOWN +$$5^F ONLY LINKS (had to put something here....) + + +Date: 6 January 1984 22:02 EST +From: Kent M Pitman +To: ALAN @ MIT-MC +cc: INFO-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +You were right about cstacy's n patch being ridiculously +ungeneral. I talked him into something nicely general and +doesn't require users to be patching DDT in order to make use +of its full functionality. Under the new scheme, you say + + namen + +where name is the fn2 to give to DIR: and n is sixbit for the fn1 +to give. So, for example, + + UP434441644500 ;to get a CDATE UP listing + +gives you a CDATE UP listing. Also, the numeric arg is now sticky +(initially defaulting to 465162636400) so if you specify + + FOO or FOO0 + +you get the default. This was easy to put in since 0 didn't +designate a valid filename anyway. + +Here's hoping you're satisfied... + +Date: 6 January 1984 10:04 EST +From: Peter Szolovits +To: BUG-DDT @ MIT-MC + +I was logged in to MC via supdup over the Chaos net from Oberon (a VAX750 +running VMS). Someone apparently detached my supdup connection to MC, leaving +me on Oberon. When I supdup'd again to MC and tried logging in, I got the +familiar --Attach Your Detached Tree-- message, typed space to confirm, and +then saw the following: +HACTRO$J!:$ Reowned $ + DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +This I have done. + +Date: 5 January 1984 04:55 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC +cc: INFO-ITS @ MIT-MC + +In DDT 1440 on MC: + +In a moment of randomness, I made a minor extension to DDT's $$^F +directory lister command, and tested and installed it on MC. + +$$^F (or $$0^F) does the same thing it always did. +$$1^F does the same thing too, except that you can now patch in a +total of three DIR arguments (starting at DIRFN1+2 and DIRFN2+2) and +do $$2^F and $$3^F. (In other words, $$n^F searches the two-word +entry table at DIRFN1 and uses the specified DIR names; the table is +currently 4 long, allowing you space for three numeric argument +options. An argument of zero is ignored.) + +I put this in because I wanted to use the DIR device more often. +The default listings you get now are these: + +foobar$$0^F DIR:NAME1 foobar +$$1^F DIR:NAME1 UP verbose directory listing +$$2^F DIR:CDATE DOWN sorted by recently created files +$$3^F DIR:SIZE DOWN sorted by biggest files + +Chris + +Date: 28 December 1983 22:32 EST +From: Alan Bawden +Subject: ..DWIM +To: BUG-DDT @ MIT-MC, GUMBY @ MIT-MC +cc: GREN @ MIT-MC, Ian @ SRI-NIC +In-reply-to: Msg of 23 Dec 1983 13:44 EST from David Vinayak Wallace + + Date: 23 December 1983 13:44 EST + From: David Vinayak Wallace + Date: 22 Dec 1983 10:56 PST (Thu) + From: Ian Macky + True, but there is a table of special cases somewhere, I believe. You + just need to add DIR to it. + I generally don't like having the DIR device my default. Can't you + use a translation or something? + +Then why not make this table something users can easily patch in their +init files? (Which mostly means making it variable length (terminated with +a 0?) and moving it to impure storage, I guess...) + +Date: 25 December 1983 23:01 EST +From: Eric P. Scott +Subject: BTW, this is not the same as GSB's complaint of 06/04/83 +To: BUG-DDT @ MIT-MC + +... :FJOB uname jname will also trigger it. + + -=EPS=- + +Date: 25 December 1983 22:54 EST +From: Eric P. Scott +Subject: DDT BUG: PLEASE DO :BUG DDT DESCRIBING CIRCUMSTANCES. +To: BUG-DDT @ MIT-MC + +*FOOJ! +*:FJOB BAR +[No such job!!] + FOOJ +* DDT BUG... + -=EPS=- + +Date: 23 December 1983 13:44 EST +From: David Vinayak Wallace +To: Ian @ SRI-NIC +cc: BUG-DDT @ MIT-MC, GREN @ MIT-MC +In-reply-to: Msg of 22 Dec 1983 10:56 PST (Thu) from Ian Macky + + Date: 22 Dec 1983 10:56 PST (Thu) + From: Ian Macky + To: David Vinayak Wallace + cc: BUG-DDT, GREN + + True, but there is a table of special cases somewhere, I believe. You + just need to add DIR to it. + +I generally don't like having the DIR device my default. Can't you +use a translation or something? + +Date: 22 Dec 1983 10:56 PST (Thu) +Message-ID: <[SRI-NIC].IAN.22-Dec-83 10:56:00> +From: Ian Macky +To: David Vinayak Wallace +Cc: BUG-DDT@MIT-MC, GREN@MIT-MC +In-reply-to: Msg of 22 Dec 1983 10:44-PST from David Vinayak Wallace + +True, but there is a table of special cases somewhere, I believe. You +just need to add DIR to it. + +Date: 22 December 1983 13:44 EST +From: David Vinayak Wallace +To: GREN @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 22 Dec 1983 12:12 EST from Ian Macky + +I believe that traditionally, if you changed the directory and your +device was non-disk, then it was reset to DSK. Isn't that even +documented somewhere? It seems like the right think. + +Date: 22 December 1983 12:12 EST +From: Ian Macky +To: BUG-DDT @ MIT-MC + +I fixed this in a version of DDT I hacked up, but it never made it into +the official source: I did: + +*^R dir:cdate down +DIR: SYS3; CDATE DOWN (oops, I wanted GREN;, so) gren; +DSK: GREN; CDATE DOWN - FILE NOT FOUND + +it turned DIR: into DSK:! This is extremely easy to fix... +if I could just remember the place... oh well, want me to do +it? + +Date: 14 November 1983 13:29 EST +From: Patrick G. Sobalvarro +To: ELISHA @ MIT-ML +cc: BUG-DDT @ MIT-ML +In-reply-to: Msg of 11/14/83 12:37:31 from ELISHA at MIT-ML + + Date: 11/14/83 12:37:31 + From: ELISHA at MIT-ML + To: (BUG DDT) at MIT-ML + + I typed f finn@xx + +And what happened, you bozo? + + + +ELISHA@MIT-ML 11/14/83 12:37:31 +To: (BUG DDT) at MIT-ML +I typed f finn@xx + + +Date: Saturday, 12 November 1983, 23:35-EST +From: David Vinayak Wallace +Subject: I'm getting a strange error message from DDT now, it says +To: George J. Carrette +Cc: BUG-DDT at MIT-MC +In-reply-to: The message of 12 Nov 83 13:00-EST from George J. Carrette + +Yow, I'm submitting JCL on MULTICS in DES MOINES! + +Date: 12 November 1983 17:19 EST +From: Alan Bawden +Subject: //JOB CARD? +To: GJC @ MIT-MC +cc: BUG-DDT @ MIT-MC, GUMBY @ MIT-MC, ITS-LOVERS @ MIT-MC +In-reply-to: Msg of 12 Nov 1983 13:00 EST from George J. Carrette + + Date: 12 November 1983 13:00 EST + From: George J. Carrette + I'm getting a strange error message from DDT now, it says + //JOB CARD? + +Perhaps you have already figured this out, but that probably wasn't an +error message, probably that was your prompt and someone was hacking you. +(No, it wasn't me, but I saw Gumby hacked exactly this way the other day. +One of the nice things about ITS is that friendly hacks like this are +easy!) + +Date: 12 November 1983 13:00 EST +From: George J. Carrette +To: BUG-DDT @ MIT-MC + +I'm getting a strange error message from DDT now, it says +//JOB CARD? + +Does this have anything to do with previous life problems I have had, +such as Fortran programming on the Univac 1108? Could it be related +to the pagable microcode on the LAMBDA? + +Date: 11 November 1983 04:28 EST +From: William G. Dubuque +Sender: BIL @ MIT-MC +To: BUG-DDT @ MIT-MC + +After 'ing out of a send and a couple of more sends I tried to + back the stuff from the aborted send. Well, I got the text, but +I also got pages of random garbage appended on the end also. + +Date: 30 October 1983 02:34 EDT +From: Julian J. Watkins +To: BUG-DDT @ MIT-MC + +I got a message telling me I got a DDT BUG: when I tried typing ':msgs' + + SOROC@MC + +Date: 25 October 1983 07:41 EDT +From: Glenn A. Sowell +To: BUG-DDT @ MIT-MC + +The arpa net died on me (it's not called arpa now , is it?) Only and the Queen know why... + +Date: 21 October 1983 10:55 EDT +From: Kent M. Pitman +To: BUG-DDT @ MIT-MC + +When I type multi-line input to ddt commands (eg, in : ...  +and I type rubout to back over a line or to rub out a tab +after having type control-l, the cursor homes to the place the original +read started rather than to the top of the screen where the last redisplay +(after the c-l) started from in order to retype the text preceding the +char i rubbed out. + +Date: Wednesday, 19 October 1983, 06:45-EDT +From: Christopher C. Stacy +Subject: ddt question +To: Pandora B. Berman +Cc: BUG-DDT at MIT-ML, BUG-RANDOM-PROGRAM at MIT-ML +In-reply-to: The message of 19 Oct 83 06:38-EDT from Pandora B. Berman + +I replied to MBECK. + + + +Date: 19 October 1983 06:38 EDT +From: Pandora B. Berman +Subject: ddt question +To: MBECK @ MIT-ML +cc: BUG-DDT @ MIT-ML, BUG-RANDOM-PROGRAM @ MIT-ML + + Date: Wed 19 Oct 83 06:26:38-EDT + From: Mark Becker + Subject: Re: ddt + To: CENT@MIT-ML.ARPA + Somehow, right after I wrote the original message, I thought it was a + little cryptic. Sorry about that. What I have is a file MBECK BIN, the + output from MIDAS. I knew how to load it into core ( MBECK$J $L MBECK + BIN ), but don't know how to take a core image and stuff it back onto + the disk with the 'adjustments' I made to the core image. I ran into a + problem with this program and was trying to run a modified version of + it. But this program expects to have been run using :PROGRAM as + opposed to PROGRAM^K . I couldn't figure out how to use :PROGRAM + on an in-core program, hence my message to you. + +i'm afraid that this is beyond my knowledge of ddt. perhaps someone on +one of these lists can help you.. + +Date: 14 October 1983 23:27 EDT +From: Alan Bawden +To: BUG-DDT @ MIT-MC + +There are an absurd number of CRASH;DDTBUG files on MC. +If someone thinks they have an algorithm for reaping these other than +the one I am about to employ (flushing all but ones from this week), could +they enlighten me? + +Date: 7 October 1983 01:12 EDT +From: Gail Zacharias +Subject: DDT 1439 +To: BUG-DDT @ MIT-MC + +Has a minor fix to make ..SENDRP/-2 work. + +BEN@MIT-ML 09/19/83 15:05:54 +To: (BUG DDT) at MIT-ML +For no obvious reason, my login init file, BEN;BEN LOGIN, +no longer tests the terminal speed and initializes my terminal +as it used to. It does the other checks for mail, so it is +being run. What's up? + + +Date: 10 September 1983 06:38 EDT +From: Gail Zacharias +Subject: ..SENDRP/-2 +To: BUG-DDT @ MIT-MC + +This doesn't seem to work anymore. It behaves exactly like ..SENDRP/0, +i.e. all messages are repeated each time you get a new one, until you +get back to DDT. I think it used to work once. + +Date: 21 August 1983 09:54 EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +In DDT 1437, ITS 1348, on MIT-MC: + +Something peculiar happens with more processing in XFILEs. +MORWARN acts differently towards :IF MORE 0 under conditions +which look the same to me. In partcular, an XFILE containing + +..MORWAR/-1 +:IF MORE 0 + +acts differently from the more useful case of + +..MORWAR/-1 +:IF MORE 0 + (:STUFF + ) + +The first example gives the user a (Space=Yes, Rubout=No) prompt, and +the second does not. It's not clear to me if this is supposed to work +at all for "artificial" more breaks. It confused a user (me too!) who +was trying to write an init file for someone. + +Date: 18 August 1983 08:52 EDT +From: Deborah A. Summa +To: BUG-DDT @ MIT-MC + + + +Date: Wednesday, 3 August 1983, 05:31-EDT +From: Christopher C. Stacy +Subject: not a bug, a feature +To: Steven A. Swernofsky +Cc: BUG-DDT at MIT-MC +In-reply-to: The message of 3 Aug 83 03:26-EDT from Steven A. Swernofsky + + Date: 3 August 1983 03:26 EDT + From: Steven A. Swernofsky + Is there an OZ: device? If so, how is it used? + Thank you. + -- Steve + +There is not, although I might write one. (I started writing one +a long time ago and did not finish.) Those magic devices use a +special protocol which only ITS systems have implemented. To +make an OZ device requires writing a different program for a +different protocol. + + +Date: 3 August 1983 03:26 EDT +From: Steven A. Swernofsky +Subject: not a bug, a feature +To: BUG-DDT @ MIT-MC +cc: SASW @ MIT-MC + +Is there an OZ: device? If so, how is it used? + +Thank you. +-- Steve + +Date: 23 July 1983 19:31 EDT +From: Steven A. Swernofsky +To: BUG-DDT @ MIT-MC + +I was reading my mail using BABYL, and received one of those YOU HAVE MAIL breakin messages, when my line was disconnected (by an incoming phone call). When I reconnected the line, I got a DDT BUG: message. Hence this bug report. + +-- Steve + +KJB@MIT-DMS 07/15/83 01:35:24 +To: (BUG DDT) at MIT-DMS +well, i was in ddt and i typed this. +.lxxx.x.., and it said ddt bug.. +so.. + + +SHERRY@MIT-ML 07/05/83 20:25:28 +To: (BUG DDT) at MIT-ML +q + +Date: 3 July 1983 02:21 EDT +From: Alan Bawden +To: GUMBY @ MIT-MC +cc: BUG-DDT @ MIT-MC +In-reply-to: Msg of 3 Jul 1983 01:18 EDT from David Vinayak Wallace + + Date: 3 July 1983 01:18 EDT + From: David Vinayak Wallace + Isn't :intest supposed to do a :massac? + +I hope not. If you want to completely reset things why don't you use U.? +I believe that then offers to re-run your init file. + +Date: 3 July 1983 01:18 EDT +From: David Vinayak Wallace +To: BUG-DDT @ MIT-MC + +Isn't :intest supposed to do a :massac? + +Date: 15 June 1983 00:43 EDT +From: Alan Bawden +Subject: :GENJOB of all the crazy things... +To: BUG-DDT @ MIT-MC + +:genjob on a job named "J" cycles through the following names: +J, J0, J00, J000, J0000, J00000, J00001, J00000, J00001, J00000, J00001, etc. +I think perhaps something better could be arranged. + +Date: 5 June 1983 08:42 EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC + +I would like it if there was a list of programs to run at +LOGOUT time. + +GSB@MIT-ML 06/04/83 16:43:01 +To: (BUG DDT) at MIT-ML +:fjob single-job-name +gets a ddt bug. + + +RAY@MIT-ML 06/03/83 13:58:09 +To: (BUG DDT) at MIT-ML +ML died while I was connected to it from DM. When I attached my +detached tree later I got the message DDT BUG: PLEASE DO A :BUG DDT +DESCRIBING CIRCUMSTANCES. + + +Date: 3 June 1983 09:07 EDT +From: Christopher C. Stacy +To: GSB @ MIT-ML +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 06/02/83 23:17:22 from GSB at MIT-ML + + + Date: 06/02/83 23:17:22 + From: GSB at MIT-ML + + Inqupd is writing out its new database to LSR1 >. When it runs out of + disk space, it closes the incompletely written file. + +I think I have fixed my brain damage INQUPD. +Now it writes out the provisional version to NLSR1 >, and disk-full +interrupts prevent it from installing it (the interrupt handler had a +bogus instruction in it.) It will still leave the incomplete version +around as NLSR1. Later, I will put something in to get this deleted. + + In this case, DDT loses its ass when starting up when not-logged-in. + It bugs out before it gets the system symbol table mapped in, + making debugging incredibly difficult. + +Maybe DDT should do all its initialization before logging the user in +(and needing to find his hsname.) I thought it already did this, +but will look at. + + When CORBLK is doing block-mode map-from-disk, it apparently just + tics the aobjn pointer away leaving MPV pages after end-of-file; + no indication that you ran off the end. + +Is this an ITS bug? + + I made two invalid assumptions when looking at this broken system + this afternoon, which caused me to believe that it was horribly trashed. + (Maybe it is. It crashed randomly twice before, which lent great credence + to its being trashed.) One was that DDT would not fail so grossly with + the inquir database smashed. The other was that corblk would not + intentionally act the way it did. + +ML *is* having some kind of trouble - COMSAT is repeat processing +messages from May somehow. I guess the QML is broken somehow? +Was it restored from tape, or is something even worse happenning? +See BUG-MAIL. + + I have renamed INQUPD BIN to INQUPD FUCKED. + +I put the current database and program on ML. +Let me know if there are more bugs with it (it ran fine for three +weeks on MC, but of course some of the error code did not get +exxcercised there.) + +Date: 2 June 1983 23:33 EDT +From: Glenn S. Burke +Subject: am i reading this right? +To: BUG-INQUIR @ MIT-MC +cc: BUG-DDT @ MIT-MC + +The "provisional" inquir database gets written out as LSR1 2. +The "installed" one is LSR1 1. + +Surely you jest. This is a joke, right? Just to keep me on my toes? +To make sure i don't forget how to look at pdp10 machine code with +a fucked up ddt? + +GSB@MIT-ML 06/02/83 23:17:22 +To: (BUG INQUIR) at MIT-ML, (BUG DDT) at MIT-ML +Inqupd is writing out its new database to LSR1 >. When it runs out of +disk space, it closes the incompletely written file. + +In this case, DDT loses its ass when starting up when not-logged-in. +It bugs out before it gets the system symbol table mapped in, +making debugging incredibly difficult. + +When CORBLK is doing block-mode map-from-disk, it apparently just +tics the aobjn pointer away leaving MPV pages after end-of-file; +no indication that you ran off the end. + +I made two invalid assumptions when looking at this broken system +this afternoon, which caused me to believe that it was horribly trashed. +(Maybe it is. It crashed randomly twice before, which lent great credence +to its being trashed.) One was that DDT would not fail so grossly with +the inquir database smashed. The other was that corblk would not +intentionally act the way it did. + +I have renamed INQUPD BIN to INQUPD FUCKED. + + +Date: 24 May 1983 23:11 EDT +From: Richard Gregory-Allen +To: BUG-DDT @ MIT-MC + + + +Date: 24 May 1983 08:55 EDT +From: James W. Eastwood +To: BUG-DDT @ MIT-MC + + + +Date: 24 May 1983 07:40 EDT +From: James W. Eastwood +To: BUG-DDT @ MIT-MC + + + diff --git a/sysdoc/devdoc.5 b/sysdoc/devdoc.5 new file mode 100644 index 0000000..c49ec08 --- /dev/null +++ b/sysdoc/devdoc.5 @@ -0,0 +1,125 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" +Unless otherwise noted, context for all routines has + U/ User index + R/ addr of IOCHNM word for specified channel +and the phrase "all ACs can be used" excludes P and U, of course. +and routines can hang (u.o.n.) + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + A/ FN1 + B/ FN2 + C/ ,, + D/ + E/ + TT/ DEVADR word ,, + W/ "open" command (0= Normal R/W open, 1= Write-over mode, + 2= Make link, 4= Delete or rename) + SRN3(U),SRN4(U),SRN5(U) - args 4,5,6 (if present) + + Routine is JRST'd to, and must return via POPJ1 for success. + Errors should JRST to the appropriate OPNLnn label. + All ACs can be smashed. + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + + Context: + A/ 0,, + B/ 0,, + C/ CLSTB entry, ,, + R/ addr of IOCHNM word + Called via PUSHJ, must return via POPJ (IOCHNM and IOCHST will + be cleared immediately after return). + Can smash all ACs including R. + Must NOT hang! + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + Boy is this complicated. + +STATUS [LH(DSTSTB(sidx)) -> devSTA] + Context: + R/ addr of IOCHNM word + Called by PUSHJ, must return by POPJ + Must return in RH(D) some device-dependent status stuff. + Calling routine (NSTATUS) fills in the LH from IOCHST. + Must not smash C,R! Probably should not smash other + stuff either, depending on what USRVAR/USET need. + +WHYINT [RH(DSTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTB1(ridx)) -> devIOP] + +RESET [RH(RSTB1(ridx)) -> devRST] + Context: + R/ addr of IOCHNM wd + Called by JRST from NRESET/ARESET/AIOPP1, must return by POPJ. + Can clobber all ACs. Must not hang. + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + Context: + A/ LH of IOCHNM word, in RH. + H/ IOCHNM word + R/ ,, + Called by JRST from NFORCE. Returns by POPJ1 for win, + POPJ if fail. Should not clobber context that FINISH routine + may need. + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + Same as FORCE, except that FORCE is called first, thus + context is whatever FORCE leaves behind. This routine + must do the actual waiting for FORCE's actions to be + finished. + +| diff --git a/sysdoc/doc.tags b/sysdoc/doc.tags new file mode 100644 index 0000000..d135894 --- /dev/null +++ b/sysdoc/doc.tags @@ -0,0 +1,59 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +DSK: SYSDOC; .CALLS > +00037,TJ6 + +DSK: SYSDOC; BINFMT > +00037,TJ6 + +DSK: SYSDOC; CLO > +00034,TJ6 + +DSK: SYSDOC; INTRUP > +00037,TJ6 + +DSK: SYSDOC; %PI > +00037,TJ6 + +DSK: SYSDOC; ITSTTY > +00037,TJ6 + +DSK: SYSDOC; JOB > +00034,TJ6 + +DSK: SYSDOC; JOBONL > +00037,TJ6 + +DSK: SYSDOC; LOCKS > +00036,TJ6 + +DSK: SYSDOC; TTYVAR > +00037,TJ6 + +DSK: SYSDOC; UFD > +00034,TJ6 + +DSK: SYSDOC; USETS > +00036,TJ6 + +DSK: SYSDOC; USR > +00034,TJ6 + +DSK: SYSDOC; UUOS > +00035,TJ6 + diff --git a/sysdoc/dskdmp.order b/sysdoc/dskdmp.order new file mode 100644 index 0000000..7914f6c --- /dev/null +++ b/sysdoc/dskdmp.order @@ -0,0 +1,62 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +.DEVICE XGP +.FONT 1 "FONTS;31VG" +.<> +.FONT 2 "LSPMAN;43VNYR" +.SELECT 1 +.TURN ON ""; +.INDENT 0,0,0; NOFILL PREFACE 0 +.SKIP 2 +.ONCE CENTER SELECT 2 +DSKDMP ORDER +.BREAK;SKIP 4 +COMMANDS ARE: +.SKIP + L$file(16)load file into core + T$file(16)load file into core and give symbols to DDT and start DDT + M$file(16)load file into core without clearing core first + K$file(16)delete file + D$file(16)dump core into file + I$file(16)verify file against core + G$(16)start at starting address + U$dir;(16)list directory + F$(16)list current directory + S$(16)list pack ids then mfd + nnn$(16)set starting address to nnn + L$n$(16)put disk n online + K$n$(16)take disk n offline +.SKIP 3 +ERROR MESSAGES ARE: +.SKIP + CMPERR(16)verify failed to match + DIRFUL(16)directory full + EOF(16)unexpected end of file + DIRNF(16)directory does not exist + FNF(16)file not found + PKNMTD(16)file is on pack that is not mounted + CKSERR(16)checksum error + DSKFUL(16)disk full + NODDT(16)can't address DDT symbol table (bug) + ?BUG?(16)BUG + SEEKFL(16)disk failed to seek + CLOBRD(16)disk read error + CLOBWR(16)disk write error + DIRCLB(16)dir name differs, TUT disagrees with UFD + MFDCLB(16)M.F.D. clobbered + \ No newline at end of file diff --git a/sysdoc/dump.format b/sysdoc/dump.format new file mode 100644 index 0000000..6b9bd23 --- /dev/null +++ b/sysdoc/dump.format @@ -0,0 +1,66 @@ +-*- Text -*- This is the file AI:SYSDOC;DUMP FORMAT +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + +This file attempts to document the format of DUMP tapes. +It probably contains inaccuracies. + +Each tape record contains 1,024 36-bit words in "core dump" format; +thus on 7-track tape each 36-bit word takes 6 tape frames. Data +formats are standard pdp-10 data formats such as sixbit (6 characters +per word), 7-bit ascii (5 characters per word, left-justified), +halfwords, and so forth. + +Each file dumped to tape consists of a header, then the 36-bit data of +the file, and ends with an end-of-file mark. The last record in a file +will generally be shorter than 1,024 words, depending on the length +of the file. There is no padding, other than the usual control-C's +padding a text file out to a word boundary. The tape ends with a +double end-of-file mark. + +The first file on the tape is preceded by a tape header in front +of the file header, with no end-of-file mark in between. + +Each type of header starts with a 36-bit word whose left half is minus +the number of words in the header, including this word. The right +half of this word is zero. + +Tape header: + -LTHBLK,,0 + tape number,,reel number + tape creation date in sixbit + type of tape (0 random, >0 full dump, <0 incremental dump) + +File header: + -LHBLK,,0 + directory name in sixbit + first file name in sixbit + second file name in sixbit + disk pack number where file was + creation date of file (same format as in ITS directory) + +If the file is really a link, then the left half of the +pack number is non-zero and the data of the file consists of +three words, containing the sixbit file name the link points to. + +In addition to files, directories also appear on some dump tapes. The +master file directory has name M.F.D. (FILE) and a user file directory +has name .FILE. (DIR). The data for the master directory is an exact +binary copy of the directory as stored on disk. The data for a user +directory is almost an exact binary copy except that unused space +between the descriptor area and the name area is squished out. \ No newline at end of file diff --git a/sysdoc/grphcs.21 b/sysdoc/grphcs.21 new file mode 100644 index 0000000..5d3a376 --- /dev/null +++ b/sysdoc/grphcs.21 @@ -0,0 +1,655 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + This file was moved to MIT-MC from + MIT-AI by David C. Plummer on 6 June + 1981, and may be up to date. + + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + + +Network Working Group Richard Stallman +Request for Comments 746 MIT-AI +NIC 43976 17 March 1978 + + +The SUPDUP Graphics Extension + + ... extends SUPDUP to permit the display of drawings on the +screen of the terminal, as well as text. We refer constantly to the +documentation of the SUPDUP protocol, described by Crispin in RFC 734 +"SUPDUP Protocol". + + Since this extension has never been implemented, it presumably +has some problems. It is being published to ask for suggestions, and +to encourage someone to try to bring it up. + + The major accomplishments are these: + +* It is easy to do simple things. + +* Any program on the server host can at any time begin + outputting pictures. No special preparations are needed. + +* No additional network connections are needed. Graphics + commands go through the normal text output connection. + +* It has nothing really to do with the network. It is suitable + for use with locally connected intelligent display terminals + in a terminal-independent manner, by programs which need not + know whether they are being used locally or remotely. It can be + used as the universal means of expression of graphics output, for + whatever destination. Programs can be written to use it for + non-network terminals, with little loss of convenience, and + automatically be usable over the ARPA network. + +* Loss of output (due, perhaps, to a "silence" command typed + by the user) does not leave the user host confused. + +* The terminal does not need to be able to remember the + internal "semantic" structure of the picture being + displayed, but just the lines and points, or even just bits + in a bit matrix. + +* The server host need not be able to invoke arbitrary + terminal-dependent software to convert a standard language + into one that a terminal can use. Instead, a standard + language is defined which all programmable terminals can + interpret easily. Major differences between terminals are + catered to by conventions for including enough redundant + information in the output stream that all types of terminals + will have the necessary information available when it is + needed, even if they are not able to remember it in usable + form from one command to another. + + Those interested in network graphics should read about the +Multics Graphics System, whose fundamental purpose is the same, but +whose particular assumptions are very different (although it did +inspire a few of the features of this proposal). + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +SUPDUP Initial Negotiation: + + One new optional variable, the SMARTS variable, is defined. It +should follow the other variables sent by the SUPDUP user process to +the SUPDUP server process. Bits and fields in the left half-word of +this variable are given names starting with "%TQ". Bits and fields in +the right half are given names starting with "%TR". Not all of the +SMARTS variable has to do with the graphics protocol, but most of it +does. The %TQGRF bit should be 1 if the terminal supports graphics +output at all. + + +Invoking the Graphics Protocol: + + Graphics mode is entered by a %TDGRF (octal 231) code in the +output stream. Following characters in the range 0 - 177 are +interpreted according to the graphics protocol. Any character 200 or +larger (a %TD code) leaves graphics mode, and then has its normal +interpretation. Thus, if the server forgets that the terminal in +graphics mode, the terminal will not long remain confused. + + Once in graphics mode, the output stream should contain a +sequence of graphics protocol commands, each followed by its +arguments. A zero as a command is a no-op. To leave graphics mode +deliberately, it is best to use a %TDNOP. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Co-ordinates: + + Graphics mode uses a cursor position which is remembered from one +graphics command to the next while in graphics mode. The graphics +mode cursor is not the same one used by normal type-out: Graphics +protocol commands have no effect on the normal type-out cursor, and +normal type-out has no effect on the graphics mode cursor. In +addition, the graphics cursor's position is measured in dots rather +than in characters. The relationship between the two units (dots, and +characters) is recorded by the %TQHGT and %TQWID fields of the SMARTS +variable of the terminal, which contain the height and width in dots +of the box occupied by a character. The size of the screen in either +dimension is assumed to be the length of a character box times the +number of characters in that direction on the screen. If the screen +is actually bigger than that, the excess may or may not be part of +the visible area; the program will not know that it exists, in any +case. + + Each co-ordinate of the cursor position is a 14-bit signed +number, where zero is at the center of the screen (if the screen +dimension is an even number of dots, then the visible negative points +extend one unit farther than the positive ones, in proper two's +complement fashion). Excessively large values of the co-ordinates +will be off the screen, but are still meaningful. + + An alternate mode is defined, which some terminals may support, +in which virtual co-ordinates are used. The specified co-ordinates +are still 14-bit signed numbers, but instead of being in units of +physical dots on the terminal, it is assumed that +4000 octal is the +top of the screen or the right edge, while -4000 octal is the bottom +of the screen or the left edge. The terminal is responsible for +scaling these virtual co-ordinates into units of screen dots. Not all +terminals need have this capability; the %TQVIR bit in the SMARTS +variable indicates that it exists. To use virtual co-ordinates, the +server should send a %GOVIR; to use physical co-ordinates again, it +should send a %GOPHY. These should be repeated at intervals, such as +when graphics mode is entered, even though the terminal must attempt +to remember the state of the switch anyway. This repetition is so +that a loss of some output will not cause unbounded confusion. + + The virtual co-ordinates are based on a square. If the visible +area on the terminal is not a square, then the standard virtual range +should correspond to a square around the center of the screen, and the +rest of the visible area should correspond to virtual co-ordinates +just beyond the normally visible range. + + Graphics protocol commands take two types of cursor position +arguments, absolute ones and relative ones. Commands that take +address arguments generally have two forms, one for each type of +address. A relative address consists of two offsets, delta-X and +delta-Y, from the old cursor position. Each offset is a 7-bit two's +complement number occupying one character. An absolute address +consists of two co-ordinates, each 14 bits long, occupying two +characters, each of which conveys 7 bits. The X co-ordinate or offset +precedes the Y. Both types of address set the running cursor position +which will be used by the next address, if it is relative. It is +perfectly legitimate for parts of objects to go off the screen. What +happens to them is not terribly important, as long as it is not +disastrous, does not interfere with the reckoning of the cursor +position, and does not cause later objects, drawn after the cursor +moves back onto the screen, to be misdrawn. + + Whether a particular spot on the screen is specified with an +absolute or a relative address is of no consequence. The sequence in +which they are drawn is of no consequence. Each object is independent +of all others, and exists at the place which was specified, in one way +or other, by the command that created it. Relative addresses are +provided for the sake of data compression. They are not an attempt to +spare programs the need for the meagre intelligence required to +convert between absolute and relative addresses; more intelligence +than that will surely be required for other aspects of the graphics +protocol. Nor are relative addresses intended to cause several +objects to relocate together if one is "moved" or erased. Terminals +are not expected to remember any relation between objects once they +are drawn. Most will not be able to. + + Although the cursor position on entry to graphics mode remains +set from the last exit, it is wise to reinitialize it with a %GOMVA +command before any long transfer, to limit the effects of lost output. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Commands: + + Commands to draw an object always have counterparts which erase +the same object. On a bit matrix terminal, erasure and drawing are +almost identical operations. On a display list terminal, erasure +involves searching the display list for an object with the specified +characteristics and deleting it from the list. Thus, on such +terminals you can erase an object only if precisely that object was +drawn, and was specified the same way when drawn as when erased. +(presumably; a very hairy program might allow more). Any terminal +whose %TOERS bit is set must be able to erase to at least that extent. + + The commands to draw objects run from 100 to 137, while those to +erase run in a parallel sequence from 140 to 177. Other sorts of +operations have command codes below 100. Meanwhile, the 20 bit in the +command code says which type of addresses are used as arguments: if +the 20 bit is set, absolute addresses are used. Graphics commands are +given names starting with "%GO". + + Graphics often uses characters. The %GODCH command is followed +by a string of characters to be output, terminated by a zero. The +characters must be single-position printing characters. On most +terminals, this limits them to ASCII graphic characters. Terminals +with %TOSAI set in the TTYOPT variable allow all characters 0-177. +The characters are output at the current graphics cursor position (the +lower left hand corner of the first character's rectangle being placed +there), which is moved as the characters are drawn. The normal +type-out cursor is not relevant and its position is not changed. The +cursor position at which the characters are drawn may be in between +the lines and columns used for normal type-out. The %GOECH command is +similar to %GODCH but erases the characters specified in it. To clear +out a row of character positions on a bit matrix terminal without +having to respecify the text, a rectangle command may be used. + + +Example: + + The way to send a simple line drawing is this: + + %TDRST ;Reset all graphics modes. + %TDGRF ;Enter graphics. + %GOCLR ;Clear the screen. + %GOMVA xx yy ;Set cursor. + %GODLA xx yy ;Draw line from there. + << repeat last two commands for each line >> + %TDNOP ;Exit graphics. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Graphics Input: + + The %TRGIN bit in the right half of the SMARTS variable indicates +that the terminal can supply a graphic input in the form of a cursor +position on request. Sending a %GOGIN command to the terminal asks to +read the cursor position. It should be followed by an argument +character that will be included in the reply, and serve to associate +the reply with the particular request for input that elicited it. The +reply should have the form of a Top-Y character (code 4131), followed +by the reply code character as just described, followed by an absolute +cursor position. Since Top-Y is not normally meaningful as input, +%GOGIN replies can be distinguished reliably from keyboard input. +Unsolicited graphic input should be sent using a Top-X instead of a +Top-Y, so that the program can distinguish them. Instead of a reply +code, for which there is no need, the terminal should send an encoding +of the buttons pressed by the user on his input device, if it has more +than one. + + +Sets: + + Terminals may define the concept of a "set" of objects. There +are up to 200 different sets, each of which can contain arbitrarily +many objects. At any time, one set is selected; objects drawn become +part of that set, and objects erased are removed from it. Objects in +a set other than the selected one cannot be erased without switching +to the sets that contain them. A set can be made temporarily +invisible, as a whole, without being erased or its contents forgotten; +and it can then be made instantly visible again. Also, a whole set +can be moved. A set has at all times a point identified as its +"center", and all objects in it are actually remembered relative to +that center, which can be moved arbitrarily, thus moving all the +objects in the set at once. Before beginning to use a set, therefore, +one should "move" its center to some absolute location. Set center +motion can easily cause objects in the set to move off screen. When +this happens, it does not matter what happens temporarily to those +objects, but their "positions" must not be forgotten, so that undoing +the set center motion will restore them to visibility in their +previous positions. Sets are not easily implemented on bit matrix +terminals, which should therefore ignore all set operations (except, +for a degenerate interpretation in connection with blinking, if that +is implemented). The %TQSET bit in the SMARTS variable of the +terminal indicates that the terminal implements multiple sets of +objects. + + On a terminal which supports multiple sets, the %GOCLR command +should empty all sets and mark all sets "visible" (perform a %GOVIS on +each one). So should a %TDCLR SUPDUP command. Thus, any program +which starts by clearing the screen will not have to worry about +initializing the states of all sets. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Blinking: + + Some terminals have the ability to blink objects on the screen. +The command %GOBNK meaning make the current set blink. All objects in +it already begin blinking, and any new objects also blink. %GOVIS or +%TOINV cancels the effect of a %GOBNK, making the objects of the set +permanently visible or invisible. %TQBNK indicates that the terminal +supports blinking on the screen. + + However, there is a problem: some intelligent bit matrix +terminals may be able to implement blinking a few objects, if they are +told in advance, before the objects are drawn. They will be unable to +support arbitrary use of %GOBNK, however. + + The solution to the problem is a convention for the use of %TOBNK +which, together with degenerate definitions for set operations, makes +it possible to give commands which reliably work on any terminal which +supports blinking. + + On a terminal which sets %TQBNK but not %TQSET, %GOBNK is defined +to cause objects which are drawn after it to be drawn blinking. +%GOSET cancels this, so following objects will be drawn unblinking. +This is regardless of the argument to the %GOSET. + + Thus, the way for a program to work on all terminals with %TQBNK, +whether they know about sets or not, is: to write a bliniking +picture, select some set other than your normal one (set 1 will do), +do %GOBNK, output the picture, and reselect set 0. The picture will +blink, while you draw things in set 0. To draw more blinking objects, +you must reselect set 1 and do another %GOBNK. Simply reselecting set +1 will not work on terminals which don't really support sets, since +they don't remember that the blinking objects are "in set 1" and not +"in set 0". + + Erasing a blinking object should make it disappear, on any +terminal which implements blinking. On bit matrix terminals, blinking +MUST always be done by XORing, so that the non-blinking background +is not destroyed. + + %GOCLS, on a terminal which supports blinking but not sets, +should delete all blinking objects. Then, the convention for deleting +all blinking objects is to select set 1, do a %GOCLS, and reselect set +0. This has the desired effect on all terminals. This definition of +%GOCLS causes no trouble on non-set terminals, since %GOCLS would +otherwise be meaningless to them. + + To make blinking objects stop blinking but remain visible is +possible with a %GOVIS on a terminal which supports sets. But in +general the only way to do it is to delete them and redraw them as +permanent. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Rectangles and XOR Mode: + + Bit matrix terminals have their own operations that display list +terminals cannot duplicate. First of all, they have XOR mode, in +which objects drawn cancel existing objects when they overlap. In +this mode, drawing an object and erasing it are identical operations. +All %GOD.. commands act IDENTICALLY to the corresponding %GOE..'s. +XOR mode is entered with a %GOXOR and left with a %GOIOR. Display +list terminals will ignore both commands. For that reason, the +program should continue to distinguish draw commands from erase +commands even in XOR mode. %TQXOR indicates a terminal which +implements XOR mode. XOR mode, when set, remains set even if graphics +mode is left and re-entered. However, it is wise to re-specify it +from time to time, in case output is lost. + + Bit matrix terminals can also draw solid rectangles. They can +thus implement the commands %GODRR, %GODRA, %GOERR, and %GOERA. A +rectangle is specified by taking the current cursor position to be one +corner, and providing the address of the opposite corner. That can be +done with either a relative address or an absolute one. The %TQREC +bit indicates that the terminal implements rectangle commands. + + Of course, a sufficiently intelligent bit matrix terminal can +provide all the features of a display list terminal by remembering +display lists which are redundant with the bit matrix, and using them +to update the matrix when a %GOMSR or %GOVIS is done. However, most +bit matrix terminals are not expected to go to such lengths. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +How Several Process Can Draw On One Terminal Without Interfering With +Each Other: + + If we define "input-stream state" information to be whatever +information which can affect the action of any command, other than +what is contained in the command, then each of the several processes +must have its own set of input-stream state variables. + + This is accomplished by providing the %GOPSH command. The %GOPSH +command saves all such input-stream information, to be restored when +graphics mode is exited. If the processes can arrange to output +blocks of characters uninterruptibly, they can begin each block with a +%GOPSH followed by commands to initialize the input-stream state +information as they desire. Each block of graphics output should be +ended by a %TDNOP, leaving the terminal in its "normal" state for all +the other processes, and at the same time popping the what the %GOPSH +pushed. + + The input-stream state information consists of: + The cursor position + the state of XOR mode (default is OFF) + the selected set (default is 0) + the co-ordinate unit in use (physical dots, or virtual) + (default is physical) + whether output is going to the display screen or to a hardcopy + device (default is to the screen) + what portion of the screen is in use + (see "Using Only Part of the Screen") + (default is all) + + Each unit of input-stream status has a default value for the sake +of programs that do not know that the information exists; the +exception is the cursor position, since all programs must know that it +exists. A %TDINI or %TDRST command should set all of the variables to +their default values. + + The state of the current set (whether it is visible, and where +its center is) is not part of the input-stream state information, +since it would be hard to say what it would mean if it were. Besides, +the current set number is part of the input-stream state information, +so different processes can use different sets. The allocation of sets +to processes is the server host's own business. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Using Only Part of the Screen: + + It is sometimes desirable to use part of the screen for picture +and part for text. Then one may wish to clear the picture without +clearing the text. On display list terminals, %GOCLR should do this. +On bit matrix terminals, however, %GOCLR can't tell which bits were +set by graphics and which by text display. For their sake, the %GOLMT +command is provided. This command takes two cursor positions as +arguments, specifying a rectangle. It declares that graphics will be +limited to that rectangle, so %GOCLR should clear only that part of +the screen. %GOLMT need not do anything on a terminal which can +remember graphics output as distinct from text output and clear the +former selectively, although it would be a desirable feature to +process it even on those terminals. + + %GOLMT can be used to enable one of several processes which +divide up the screen among themselves to clear only the picture that +it has drawn, on a bit matrix terminal. By using both %GOLMT and +distinct sets, it is possible to deal successfully with almost any +terminal, since bit matrix terminals will implement %GOLMT and display +list terminals almost always implement sets. + + The %TDCLR command should clear the whole screen, including +graphics output, ignoring %GOLMT. + + +Errors: + + In general, errors in graphics commands should be ignored. + + Since the output and input streams are not synchronized unless +trouble is taken, there is no simple way to report an error well +enough for the program that caused it to identify just which command +was invalid. So it is better not to try. + + Errors which are not the fault of any individual command, such as +running out of memory for display lists, should also be ignored as +much as possible. This does NOT mean completely ignoring the commands +that cannot be followed; it means following them as much as possible: +moving the cursor, selecting sets, etc. as they specify, so that any +subsequent commands which can be executed are executed as intended. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Extensions: + + This protocol does not attempt to specify commands for dealing +with every imaginable feature which a picture-drawing device can have. +Additional features should be left until they are needed and well +understood, so that they can be done right. + + +Storage of Graphics Commands in Files: + + This can certainly be done. Since graphics commands are composed +exclusively of the ASCII characters 0 - 177, any file that can hold +ASCII text can hold the commands to draw a picture. This is less +useful than you might think, however. Any program for editing, in +whatever loose sense, a picture, will have its own internal data which +determine the relationships between the objects depicted, and control +the interpretation of the programs commands, and this data will all be +lost in the SUPDUP graphics commands for displaying the picture. +Thus, each such program will need to have its own format for storing +pictures in files, suitable for that program's internal data +structure. Inclusion of actual graphics commands in a file will be +useful only when the sole purpose of the file is to be displayed. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Note: the values of these commands are represented as 8.-bit octal +bytes. Arguments to the commands are in lower case inside angle +brackets. + +The Draw commands are: + +Value Name Arguments + + 101 %GODLR

+ Draw line relative, from the cursor to

. + 102 %GODPR

+ Draw point relative, at

. + 103 %GODRR

+ Draw rectangle relative, corners at

and at the + current cursor position. + 104 %GODCH <0> + Display the chars of starting at the current + graphics cursor position. + 121 %GODLA

+ Draw line absolute, from the cursor to

. + The same effect as %GODLR, but the arg is an absolute + address. + 122 %GODPA

+ Draw point absolute, at

. + 123 %GODRA

+ Draw rectangle absolute, corners at

and at the + current cursor position. + +The Erase commands are: + +Value Name Arguments + + 141 %GOELR

+ Erase line relative, from the cursor to

. + 142 %GOEPR

+ Erase point relative, at

. + 143 %GOERR

+ Erase rectangle relative, corners at

and at the + current cursor position. + 144 %GOECH <0> + Erase the chars of starting at the current + graphics cursor position. + 161 %GOELA

+ Erase line absolute, from the cursor to

. + 162 %GOEPA

+ Erase point absolute, at

. + 163 %GOERA

+ Erase rectangle absolute, corners at

and at the + current cursor position. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +The miscellaneous commands are: + +Value Name Arguments + + 001 %GOMVR

+ Move cursor to point

+ 021 %GOMVA

+ Move cursor to point

, absolute address. + 002 %GOXOR + Turn on XOR mode. Bit matrix terminals only. + 022 %GOIOR + Turn off XOR mode. + 003 %GOSET + Select set. is a 1-character set number, 0 - 177. + 004 %GOMSR

+ Move set origin to

. Display list terminals only. + 024 %GOMSA

+ Move set origin to

, absolute address. + 006 %GOINV + Make current set invisible. + 026 %GOVIS + Make current set visible. + 007 %GOBNK + Make current set blink. Canceled by %GOINV or %GOVIS. + 010 %GOCLR + Erase whole screen. + 030 %GOCLS + Erase entire current set (display list terminals). + 011 %GOPSH + Push all input-stream status information, to be + restored when graphics mode is exited. + 012 %GOVIR + Start using virtual co-ordinates + 032 %GOPHY + Resume giving co-ordinates in units of dots. + 013 %GOHRD + Divert output to output subdevice . + =0 reselects the main display screen. + 014 %GOGIN + Request graphics input (mouse, tablet, etc). + is the reply code to include in the answer. + 015 %GOLMT + Limits graphics to a subrectangle of the screen. + %GOCLR will clear only that area. This is for those + who would use the rest for text. + +NWG/RFC# 746 RMS 17-MAR-78 43976 +SUPDUP Graphics Extension + + +Bits in the SMARTS Variable Related to Graphics: + +Note: the values of these bits are represented as octal 36.-bit words, +with the left and right 18.-bit halfword separated by two commas as in +the normal PDP-10 convention. + +Name Value Description + +%TQGRF 000001,,0 terminal understands graphics protocol. + +%TQSET 000002,,0 terminal supports multiple sets. + +%TQREC 000004,,0 terminal implements rectangle commands. + +%TQXOR 000010,,0 terminal implements XOR mode. + +%TQBNK 000020,,0 terminal implements blinking. + +%TQVIR 000040,,0 terminal implements virtual co-ordinates. + +%TQWID 001700,,0 character width, in dots. + +%TQHGT 076000,,0 character height, in dots. + +%TRGIN 0,,400000 terminal can provide graphics input. + +%TRGHC 0,,200000 terminal has a hard-copy device to which output + can be diverted. + +;;;Local Modes: +;;;Mode:Text +;;;Auto Fill Mode:1 +;;;Fill Column:70 +;;;End: diff --git a/sysdoc/hstinf.recent b/sysdoc/hstinf.recent new file mode 100644 index 0000000..28f1de1 --- /dev/null +++ b/sysdoc/hstinf.recent @@ -0,0 +1,3131 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Fri, 14 Mar 86 16:15:02 EST +From: Rob Austein +Subject: Athena chaos address fakeout, HOSTS3 compiler broken. +To: INFO-HOSTS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].851075.860314.SRA> + +1) The chaosnet address of ATHENA in the newest HSTMIT is a lie. + The address listed is really a different project athena machine. + ENS@ATHENA and I did this because Athena itself is off the chaosnet + for an indefinite time due to hardware lossage beyond their control. + So this way mail will get through without having to go via MC, but + trying to SUPDUP or TELNET to Athena via chaos will lose. Sorry. + +2) The HOSTS3 compiler has run out of address space again, so it won't + be possible to generate new HOSTS3 binary files until I figure out + some new class of hosts or nicknames that can be safely pruned from + HSTNIC. PDP10s (and vaxen who port HOSTS2.TXT files from XX or OZ) + beware. + +Received: from CAF.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 14 MAR 86 16:09:27 EST +Return-Path: +Received: by mit-caf.MIT.EDU (5.9/MIT.1x) + on Fri, 14 Mar 86 16:08:57 EST; User info-hosts@mc; Host mc +Date: Fri, 14 Mar 86 16:08:57 EST +From: Mike McIlrath +To: info-hosts@mc, jis@athena +Cc: kmware@mit-caf +Subject: please add host + + +Please add host "bogart", a microvaxII running unix (with the usual +accoutrements). + + IP 18.62.0.234 + CHAOS 12752 + +Thanks. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 22 FEB 86 00:33:19 EST +Date: Sat, 22 Feb 86 00:34:55 EST +From: "Pandora B. Berman" +Subject: Re: bad address +To: jis@BITSY.MIT.EDU +cc: kevin%harvard@HARVARD.HARVARD.EDU, info-hosts@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].15545.860222.CENT> + + Date: Fri, 21 Feb 86 22:44:14 EST + From: jis@BITSY.MIT.EDU (Jeffrey I. Schiller) + To: "Pandora B. Berman" + Cc: kevin%harvard@HARVARD.HARVARD.EDU, info-hosts@mc.lcs.mit.edu + In-Reply-To: "Pandora B. Berman"'s message of Fri, 21 Feb 86 21:27:08 EST + Subject: Re: bad address + Whose host tables were those... the NIC's is correct. + -Jeff + +the line + +HOST : 18.86.0.4 : SLOAN.MIT.EDU,MIT-SLOAN.ARPA,MIT-SLOAN,SLOAN,XV.MIT.EDU,MIT-XV.ARPA,MIT-XV,XV : DANDELION : INTERLISP :: + +in my previous msg was from MC:SYSHST;HSTMIT >. indeed, the following are in +MC:SYSHST;HSTNIC > : + +HOST : 18.86.0.4 : XV.MIT.EDU,MIT-XV.ARPA,MIT-XV : DANDELION : INTERLISP : TCP/SMTP : +HOST : 18.86.0.6 : SLOAN.MIT.EDU,MIT-SLOAN.ARPA,MIT-SLOAN : IBM-4341 : VM : TCP/TELNET,TCP/SMTP,TCP/FTP : + +but the host-finding, given the evidence, is running off HSTMIT. + +Received: from BITSY.MIT.EDU by MC.LCS.MIT.EDU 21 Feb 86 22:56:35 EST +Received: by BITSY.MIT.EDU (5.15/4.7) + id AA04021; Fri, 21 Feb 86 22:44:14 EST +Date: Fri, 21 Feb 86 22:44:14 EST +From: jis@BITSY.MIT.EDU (Jeffrey I. Schiller) +Message-Id: <8602220344.AA04021@BITSY.MIT.EDU> +To: "Pandora B. Berman" +Cc: kevin%harvard@HARVARD.HARVARD.EDU, info-hosts@mc.lcs.mit.edu +In-Reply-To: "Pandora B. Berman"'s message of Fri, 21 Feb 86 21:27:08 EST +Subject: Re: bad address + +Whose host tables were those... the NIC's is correct. + + -Jeff + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 21 FEB 86 21:42:04 EST +Date: Fri, 21 Feb 86 21:27:08 EST +From: "Pandora B. Berman" +Subject: Re: bad address +To: kevin%harvard@HARVARD.HARVARD.EDU +cc: HEADER-PEOPLE-REQUEST@AI.AI.MIT.EDU, info-hosts@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].15471.860221.CENT> + + To: "Pandora B. Berman" + Cc: HEADER-PEOPLE-REQUEST@ai.ai.mit.edu + Subject: Re: bad address + Date: 20 Feb 86 11:54:35 EST (Thu) + From: kevin%harvard@harvard.HARVARD.EDU + The problem is that the message is addressed to sloan.mit.edu, not to + xv.mit.edu. Please fix the list so that you're really mailing to + header-people-incoming@xv.mit.edu. + Kevin Crowston + Postmaster, xv.mit.edu + +a couple days ago i sent you this mail indicating that i had just done so: + Date: Mon, 17 Feb 86 05:03:25 EST + From: "Pandora B. Berman" + Subject: Changing the name of mit-sloan.mit.edu, take 2 + To: kevin@HARVARD.HARVARD.EDU + cc: HEADER-PEOPLE-REQUEST@AI.AI.MIT.EDU + Date: Tue, 31 Dec 85 15:22:51 EST + From: kevin@harvard.HARVARD.EDU (Kevin Crowston) + To: header-people-request@mit-mc.arpa + Subject: Changing the name of mit-sloan.mit.edu, take 2 + Sorry about the previous confusion.... Anyway, here's our hoped + for schedule for the change over: + immediately the host "mit-sloan.mit.edu", internet address + [18.86.0.4] will be identifying itself as "xv.mit.edu". + This weekend, I hope, the MIT name server will be updated to know + that "xv.mit.edu" is really [18.86.0.4]. (It turns out that the + only person in the universe who can make this change has been on + vacation all this time, so this hasn't happened yet.) I will mail + another letter as soon as I hear that the nameserver is up-to-date. + The current time table says that by 15 January, + "mit-sloan.mit.edu" will be the name of a different machine, so I + hope that the changes in the various mailing list will have been + made by then. + Once again, sorry for the confusion; I hope the too hasty change + hasn't started mail bouncing all over the net. + kevin@harvard.arpa + kevin%xv.mit.edu@mit-mc.arpa (soon) + kevin%mit-sloan.mit.edu@mit-mc.arpa (now) + i recently noticed that SLOAN has aqcuired XV as an alternate name, or + nickname, or whatever, so have just implemented your above request for + address change. it took me -this long- to grasp the pun; i must be slowing + down. + +at that time i had in fact changed your entry; until i commented it out +yesterday, this is how it read: +(header-people-incoming @XV) ; req. of Kevin@SLOAN Crowston 1sep85 + +now, this is what the host table says about the host in question: +HOST : 18.86.0.4 : SLOAN.MIT.EDU,MIT-SLOAN.ARPA,MIT-SLOAN,SLOAN,XV.MIT.EDU,MIT-XV.ARPA,MIT-XV,XV : DANDELION : INTERLISP :: + +the host table thinks XV and SLOAN are the same thing. clearly the host +table, not the Header-People list, is what is confused. i suggest that you +arrange to have the host table fixed with respect to the Sloan host(s). + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 18 Feb 86 13:56:21 EST +Date: Tue, 18 Feb 1986 13:55 EST +Message-ID: +From: Rob Austein +To: cjl@OZ.AI.MIT.EDU +cc: info-hosts@MC.LCS.MIT.EDU +Subject: tables broken again + +NEWTON is now listed in both HSTAI and HSTG. Massive lossage. + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 13 Feb 86 05:02:45 EST +Date: Thu, 13 Feb 1986 05:03 EST +Message-ID: +From: Rob Austein +To: info-hosts@MC.LCS.MIT.EDU +cc: sra@XX.LCS.MIT.EDU, cjl@OZ.AI.MIT.EDU +Subject: Cretinous lossage + +Some pinhead put a bunch of EECS hosts into the HSTAI table +(presumably by putting them into Reagan's namespace). This causes the +host table compiler to barf, since the culprit didn't get all the +names right and there are primary name mismatches. + +Host tables will be disfunctional until this is fixed at the source, +since I am not about to start a namespace war with a Lisp Machine. + +Chris, you might want to install a filter in Reagan's table dump +program so that it won't propagate this kind of lossage. + +--Rob + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 4 Feb 86 21:13:37 EST +Date: Tue, 4 Feb 1986 21:14 EST +Message-ID: +From: Rob Austein +To: info-hosts@MC.LCS.MIT.EDU, postmaster@VAX.LCS.MIT.EDU +Subject: VAX.LCS.MIT.EDU now listed as Chaos-only host + +I commented out the IP address for VAX.LCS.MIT.EDU (VX). As the +person responsible for keeping the LCS tables in some state that +vaugely reflects reality, I just went ahead and did this by fiat +without waiting for VX's owners to give me permission (or more +accurately, I timed out while waiting for a useful answer to my +queries). This change will affect the MIT HOSTS3 and HSTMIT files +(and anything that is generated from them) and the LCS.MIT.EDU domain. +It will *not* affect the NIC tables, so we can change things back +quietly if/when VX's TCP/IP code becomes reliable enough to use for +mail on a regular basis. + +Anybody who wants to change this back please talk to me first. There +are some issues involved that are not readily apparent. + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 31 Jan 86 22:55:44 EST +Date: Fri 31 Jan 86 22:56:40-EST +From: Michael B McIlrath +Subject: [Communications Satellite : Msg of Thursday, 30 January 1986 16:21-EST] +To: info-hosts@MC.LCS.MIT.EDU +Message-ID: <12179777611.35.MBM@XX.LCS.MIT.EDU> + +Received: from MC.LCS.MIT.EDU by XX.LCS.MIT.EDU via Chaosnet; 30 Jan 86 16:21-EST +Date: Thu, 30 Jan 86 16:21:31 EST +From: Communications Satellite +Subject: Msg of Thursday, 30 January 1986 16:21-EST +To: "MBM@XX.LCS.MIT.EDU"@XX.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].801937.860130> + +============ A copy of your message is being returned, because: ============ +"INFO-HOST" at MC.LCS.MIT.EDU is an unknown recipient. +============ Failed message follows: ============ +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 30 Jan 86 15:05:56 EST +Date: Thu 30 Jan 86 13:04:36-EST +From: Michael B McIlrath +Subject: mit-caf +To: info-host@MC.LCS.MIT.EDU +Message-ID: <12179407684.24.MBM@XX.LCS.MIT.EDU> + +MIT-CAF's internet address is 18.62.0.232, not 18.21. Thanks. +--mike +------- +------- + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 28 JAN 86 21:55:59 EST +Date: Tue, 28 Jan 86 21:55:35 EST +From: "Pandora B. Berman" +Subject: SYSNET;HSTMIT ? +To: Mills@CISL-SERVICE-MULTICS.MIT.EDU +cc: INFO-Hosts@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].12019.860128.CENT> + + Date: Tue, 28 Jan 86 11:29 EST + From: Mills@CISL-SERVICE-MULTICS.ARPA + Subject: sysnet;hstmit + To: info-hosts@MIT-MC.ARPA + I have been using the file sysnet;hstmit off of mc for some time in + generating my host table. It seems as this file is no longer to be + found in the same location on mc. This is not surprizing considering + that mc is sort of going away. Where is this file currently? Is it + going to be updated any longer? If you don't know about this, do you + know anyone who does? + +the file has been moved in the SYSHST; directory -- SYSHST;HSTMIT is what +you should now look for. SRA@XX is doing most of the work here on +host-table related things now, so you should direct questions about its +status to him. + +Received: from CISL-SERVICE-MULTICS.ARPA by MC.LCS.MIT.EDU 28 Jan 86 11:30:43 EST +Date: Tue, 28 Jan 86 11:29 EST +From: Mills@CISL-SERVICE-MULTICS.ARPA +Subject: sysnet;hstmit +To: info-hosts@MIT-MC.ARPA +Message-ID: <860128162939.998026@CISL-SERVICE-MULTICS.ARPA> + +Hi there, + I have been using the file sysnet;hstmit off of mc for some +time in generating my host table. It seems as this file is no longer to +be found in the same location on mc. This is not surprizing considering +that mc is sort of going away. Where is this file currently? Is it +going to be updated any longer? If you don't know about this, do you +know anyone who does? + +Thanks, John Mills + +Date: Thu, 16 Jan 86 18:52:50 EST +From: Rob Austein +Subject: MC binary host table +To: INFO-HOSTS@MC.LCS.MIT.EDU, NAMECALLERS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].786028.860116.SRA> + +I turned off the code that was generating the names like +MIT-foo.MIT.EDU and foo.MIT.EDU (for hosts that are in some other +domain, ie, AI or LCS). This was necessary because COMSAT was +completely out of address space and I needed the few K this freed up +just to keep COMSAT running. + +This means that (1) host tables will be a little smaller, and that (2) +it is possible that you will be unable to reply to hosts that are +still using these names (nobody should be, but they still linger in +some dark corners). If you need a table that has all this cruft, you +can get the binary from XX:HOSTS3.BIN and the text form of +HSTMIT from XX:HSTMIT.TXT. + +Sorry for the short (one might even say negative) notice, but this was +an emergency fix. + +--Rob + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 18 Dec 85 07:16:06 EST +Date: Wed, 18 Dec 1985 07:14 EST +Message-ID: +From: Rob Austein +To: info-hosts@MC.LCS.MIT.EDU, namecallers@MC.LCS.MIT.EDU +cc: sra@XX.LCS.MIT.EDU +Subject: New host tables installed on MC. + +The new tables that have been running on XX on an experimental basis +have now been installed on MC and AI. A few things to note: + +At CSTACY's request, the tables no longer live in MC: SYSNET; because +the directory got too crowded. All the text files have been moved to +MC: SYSHST;. The old versions of the host tables are still present in +SYSNET; on the off chance that we have to back out of this, but they +will be going away soon. The binary host table of course is still in +SYSBIN;. + +There is a little bit of documentation in some of the files in SYSHST; +ask me if you need help, I would much rather have to answer a lot of +silly questions than have to pick up the pieces if somebody breaks all +this. + +For those who deleted my last warning on this subject, the new host +table is significantly larger than the old one. Some programs on your +machine will probably barf and need to be recompiled. Sorry. + +Problems, flames, etc to me and NAMECALLERS. + +--Rob + +Date: Tue, 17 Dec 85 16:30:06 EST +From: Rob Austein +Subject: WARNING: host tables changing tonight +To: INFO-HOSTS@MIT-MC.ARPA +Reply-To: sra@mc +Message-ID: <[MIT-MC.ARPA].758370.851217.SRA> + +I am going to try installing the new domain-style host tables on MC +(and possibly AI) tonight. I will send out another message when this +is done. In the meantime, anybody who is automaticly snarfing tables +off of MC should beware, since various weird things may happen. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 2 Dec 85 20:39:00 EST +Date: Mon 2 Dec 85 14:49:53-EST +From: "J. Noel Chiappa" +Subject: Re: Impending host table format change +To: Namecallers@MIT-MC.ARPA, Info-Hosts@MIT-MC.ARPA +cc: JNC@MIT-XX.ARPA +In-Reply-To: +Message-ID: <12163960357.23.JNC@MIT-XX.ARPA> + + One other thing we should try and tackle in an organised +fashion is allocation of host numbers on wires. Right now, it's +done by looking through the host tables, which aren't organized in +any useful fashion for this; in addition, some people chose a number, +look to see if anyone has that number in protocol family X, and +don't check to see if anyone is using it in family Y, with the +result that a single host number winds up on two machines, with +all the attendant hassle. + Shawn keeps files for the LCS Ring and Ether, but they aren't +publicy known about. It would be good if we had files for all the +wires which random people hang new things on somewhere. Any ideas? + + Noel +------- + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 28 Nov 85 03:07:47 EST +Date: Thu, 28 Nov 1985 03:05 EST +Message-ID: +From: Rob Austein +To: Info-Hosts@MIT-MC.ARPA, Namecallers@MIT-MC.ARPA +Reply-To: Namecallers@MC +Subject: Impending host table format change + +I am in the final stages of debugging the various filters, etc to +implement the compartmentalization of the MIT host tables. For those +who aren't in on this already, HSTMIT is being split up into several +smaller files that map one to one with Internet domains (AI.MIT.EDU, +LCS.MIT.EDU, ATHENA.MIT.EDU, etc). The new host tables are actually +complete right now, and reside in MC: SYSNET;. Don't anybody try to +use them yet though (you would have to work very hard to do so +anyway). There is even a little documentation for them as wants it, +in MC: SYSNET; HSTNEW README. I'll be testing this for a little while +on XX before mucking with the MC binaries, but that will happen fairly +soon (within two weeks) if nothing major goes wrong. + +Anyone who uses the MC host tables at all is hereby warned that +something is almost certain to break on your machine when this change +goes into effect. The most probably cause is the sheer size of the +new table. The complete HOSTS3 table (HSTNIC + all the things that +used to be in HSTMIT) will be significantly bigger (how much depends +on what measure you use; the big change is a lot more nicknames for +MIT hosts, some fairly long). A lot of this is temporary; far too +many existing programs have assumptions about primary hostnames +hardwired into them, so this part of the changeover has to be done in +stages. Obviously there are a lot of tradeoffs here; questions or +suggestions on this should go to NAMECALLERS@MC rather than all of +INFO-HOSTS. + +For now, anybody who edits MC: SYSNET; HSTMIT > should also edit the +appropriate subdomain file. If you aren't sure what to do, just make +sure to tell me what changes you made and I'll update the appropriate +file. + +I will send another message to INFO-HOSTS when I start the actual +changeover on MC, but I wanted to make sure that people had some +advance warning about this. + +--Rob + +Date: Wed, 13 Nov 85 23:41:20 EST +From: Rob Austein +Subject: HSTMIT table fixed (again) +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].717323.851113.SRA> + +I changed the primary name of MIT-MORRISON to MIT-MORRISON.ARPA. + +People, please note that the primary hostname in HSTMIT *must* match +the primary hostname in HSTNIC (if the machine is in HSTNIC at all, of +course). If you break this rule you will also break the HOSTS3 +compiler and thus all six PDP10s. + +Also, if anybody edits HSTMIT in the near future, please send me mail +even if you don't send any to INFO-HOSTS for some reason. I am going +to be bringing up a current set of tables for the brave new world of +domains and if you make changes without telling me they won't show up +in the new tables. + +--Rob + +Received: from MIT-EECS by MIT-MC.ARPA via Chaosnet; 30 OCT 85 23:06:53 EST +Date: Wed 30 Oct 85 23:08:16-EST +From: Clifford Neuman +Subject: Re: HSTMIT 458 and HOSTS 878 +To: INFO-HOSTS@MIT-MC +cc: staff%MIT-EECS@MIT-MC.ARPA, JIS@ATHENA.MIT.EDU +In-Reply-To: Message from "Clifford Neuman " of Wed 30 Oct 85 22:23:14-EST + +Correction to previous message. + + . The primary name for MIT-EECS is not MIT-DEEP-THOUGHT. + +should be: + + . The primary name for MIT-EECS is now MIT-DEEP-THOUGHT. + ^ +------- + +Received: from MIT-EECS by MIT-MC.ARPA via Chaosnet; 30 OCT 85 21:49:06 EST +Date: Wed 30 Oct 85 21:50:20-EST +From: Clifford Neuman +Subject: HSTMIT 458 and HOSTS 878 +To: INFO-HOSTS@MIT-MC +cc: staff%MIT-EECS@MIT-MC.ARPA, JIS@ATHENA.MIT.EDU + +Have been updated to reflect the following changes: + + . The primary name for MIT-EECS is not MIT-DEEP-THOUGHT. + . The nicknames MIT-DT and DT have been added. + + . ZARQUON, HACTAR, PRAK, and SLARTIBARTFAST have been commented out + since they have not been speaking chaos for quite some time and + the continued existence in the host table as chaos hosts was + causing mail queued for them to go undelivered. + +Chris: You should consider adding service entries to some of the hosts + in HSTFIX. In particular, MIT-SPEAKER, and a few others. Gail's + FTP checks this entry. + + ~ Cliff +------- + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 22 Oct 85 16:02:07 EDT +Date: Tue 22 Oct 85 16:04:03-EDT +From: William B. Ackerman +Subject: sysnet;hstmit > +To: info-hosts@MIT-MC.ARPA +Message-ID: <12153215031.33.WBA@MIT-XX.ARPA> + +I made a few minor changes to 2nd floor Explorers in SYSNET;HSTMIT >. +------- + +Date: Mon, 30 Sep 85 10:34:30 EDT +From: Patrick G. Sobalvarro +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].663271.850930.PGS> + +Does anyone know of an internet path either to inria or mcvax? + +Received: from MIT-BORAX by MIT-MC.ARPA 13 Sep 85 11:59:48 EDT +Received: by MIT-BORAX.MIT.EDU (4.12/4.7) + id AA19554; Fri, 13 Sep 85 12:01:06 edt +Date: Fri, 13 Sep 85 12:01:06 edt +From: romkey@MIT-BORAX.MIT.EDU (John Romkey) +Message-Id: <8509131601.AA19554@MIT-BORAX.MIT.EDU> +To: info-hosts@mc +Subject: "new" host + +I've added a "new" host, MIT-BORAX-CHAOS, address 15101, temporarily +while I'm bringing up chaosnet on borax. Once I'm sure the chaos code +is stable I'll punt this name and just add a chaos address for BORAX. + - john + +Date: Tue, 10 Sep 85 20:46:58 EDT +From: Thye-Lai Tung +Subject: Change in Net Address +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].640485.850910.TLTUNG> + +I changed the Chaosnet address of MIT-WAIF from 6420 to 12751. + +- Thye-Lai Tung + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 6 SEP 85 03:53:57 EDT +Date: Fri, 6 Sep 1985 03:55 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: Rob Austein +cc: info-hosts@MIT-MC.ARPA +Subject: Have you seen these machines? + +Alcator is a Vax at Alcator; it runs VMS. The last time I heard of someone +using it was a couple of years ago. PFC-VAX is another VMS VAX; it's at the +Plasma Fusion Center. PFC-Versatec is presumably a MINITS 11 running DCP's +Versatec code at Plasma Fusion Center. Cougar is the wrist controller for +the Puma robot arm; like Puma, it's an 11 running MINITS. It's in 905 +(Robotics Group, of course). Golem is a 750 running VMS; it controls Ken +Salisbury's tendon hand; it's in the Lisp Machine corral. Robotics Group +again. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 5 Sep 85 16:41:57 EDT +Date: Thu, 5 Sep 1985 16:04 EDT +Message-ID: +From: Rob Austein +To: info-hosts@mc +Subject: have you seen these machines + +Thanks to everybody who responded. I now have all the machines pegged +except for ARMSTRONG and SARAH, and all that really matters in this +case is knowing that they don't belong to LCS, AI, Athena, EECS, or +Speech (of course, if somebody *does* know about these two I'd like to +hear it...). + +--Rob + +Received: from MIT-VAX.ARPA by MIT-MC.ARPA via Chaosnet; 3 SEP 85 21:55:05 EDT +Received: by mit-vax.Mit-chaos.Arpa (4.12/4.8) id AA08083; Tue, 3 Sep 85 21:50:00 edt +Date: Tue, 3 Sep 85 21:50:00 edt +From: Jeff Arnold +To: SRA@MIT-XX, info-hosts@mc +Subject: Re: Have you seen these machines? + +PI is Ron Rivest's (original) 3600 and lives on the third floor +of Tech Sq. HARRIS-BRIDGE is a minits box dedicated to the +chaos link with Harris Corp. in Fla. It lives in the second +floor machine room and is tended by Rich Zippel and Bert Halstead. + + +Received: from mit-ems.ARPA by MIT-MC.ARPA 3 Sep 85 19:32:32 EDT +Received: by mit-ems.ARPA (4.12/4.8) id AA23824; Tue, 3 Sep 85 19:33:03 edt +Date: Tue, 3 Sep 85 19:33:03 edt +From: Steven Haflich +Message-Id: <8509032333.AA23824@mit-ems.ARPA> +To: info-hosts@mc +Subject: Re: Have you seen these machines? + +INFINITE is the building 8 chaos bridge, and is named after a certain +corridor. It connects subnets 017, 021, and 023(?). Most recently, +bcn@ee has maintained it. + +WAIF is a VMS 750 belonging to Prof Antoniadis' group on the 3rd floor +of bldg 10. Contact tung@{waif,eddie} for details. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 3 Sep 85 19:13:53 EDT +Date: Tue, 3 Sep 1985 19:13 EDT +Message-ID: +From: Rob Austein +To: info-hosts@mc +Subject: Have you seen these machines? + +I've been sorting through the MIT and NIC host tables to figure out +which labs/departments own which machines. Here's the last few that +nobody seems to recognize. If you know who these machines belong to, +please send me mail. Thanks.... + +ALCATOR ARMSTRONG COUGAR GOLEM +HARRIS-BRIDGE INFINITE MERLIN PFC-TEST +PFC-VAX PFC-VERSATEC PI SARAH +WAIF + +Date: Tue, 27 Aug 85 00:03:43 EDT +From: J. Noel Chiappa +To: INFO-HOSTS@MIT-MC.ARPA +cc: MIT SUBNETS@MIT-MC.ARPA, JNC@MIT-MC.ARPA, jis@MIT-ATHENA.ARPA +Message-ID: <[MIT-MC.ARPA].624989.850827.JNC> + + Not having heard any loud complaints, I moved the three unused +nets (LCS 4th Ether, WHOI nets) out of the area of conflict with +Athena. The LCS 4th Ether became 061/49. and the WHOI nets became +0160/0161 respectively. The leaves only the Building 11 Ethernet to +fix; it's CHAOS address of 0104 conflicts with the Main Campus Spine, +and it's IP address of 58. conflicts with the 7AI-2LCS link (!). + I also edited in some more information that Jeff Schiller +provided. + +Received: from MIT-CCC by MIT-MC.ARPA via Chaosnet; 25 AUG 85 01:47:58 EDT +Date: 25 Aug 1985 01:47:51-EDT +From: gill@MIT-CCC +To: CSTACY@MIT-MC.ARPA, gill@MIT-CCC, jma@MIT-VAX.ARPA, + jon@MIT-VAX.ARPA, saj@MIT-PREP.ARPA +Subject: Re: host2 tables +Cc: INFO-HOSTS@MIT-MC.ARPA + +Based on the old one in syseng; the host2 table you generated had one small +error: + + NET CHAOS 7, + +should be + + NET CHAOS, 7 + +Other than that, it went down smoothly. Although my host table parser +also deals with the so-called host3 format, I would like to switch over +to a domain system in the near future. What references are there on how +one should, and how others have already, implemented domain naming? + + - Gill + +Date: Sat, 24 Aug 85 22:43:30 EDT +From: Christopher C. Stacy +Subject: host2 tables +To: jma@MIT-VAX.ARPA, jon@MIT-VAX.ARPA, saj@MIT-PREP.ARPA, + gill@MIT-CCC +cc: INFO-HOSTS@MIT-MC.ARPA +In-reply-to: Msg of Sat 24 Aug 85 21:54:28 EDT from Christopher C. Stacy +Message-ID: <[MIT-MC.ARPA].623378.850824.CSTACY> + +SYSNET;HSTCHA HOSTS2 contains a sample HOSTS2 file generated by my +hack from HSTMIT. It contains only Chaosnet hosts. I am putting this +here in case you need it and want to pick it up right away before +learning how to create such files yourself. + +Date: Sat, 24 Aug 85 19:40:41 EDT +From: Christopher C. Stacy +Subject: New Host tables +To: JNC@MIT-MC.ARPA +cc: INFO-HOSTS@MIT-MC.ARPA, BUG-MAIL@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].623329.850824.CSTACY> + +As I said, I don't think backing out of the binary was the right thing, +since only the QMAIL program uses that information, it's usually wrong, +and all it does is warn you that the site doesn't claim to support mail. +In fact, the system will send mail to sites which don't claim to support +the service. Since the information has not been used by anyone, I don't +think there has been a great effort to keep it correct. Backing up to +an older binary means that some valid hosts will be compeltely unknown, +and mail to hosts which have moved will be permanently lost. Moreover, +QMAIL is an ITS-only program (and hence an ITS bug) but the binary table +is used by some other sites (such as OZ.) + +Anyway, I just went in and added the service lists to the dozen or so +sites which I think support mail but which didn't claim to, and created +a new binary table. + +I stuck the subnet stuff back into the HSTMIT host table source file +where it has always been; it was an oversight that I forgot to include +it in that one version. + +Date: Fri, 23 Aug 85 11:51:28 EDT +From: J. Noel Chiappa +Subject: New Host tables +To: INFO-HOSTS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].622549.850823.JNC> + + The switch to the new host tables introduced a slight +problem in that CHAOS only hosts are now using an RFC810 format +instead of the old HOSTS format; the new format allows services +to be listed, and the old one did not. So, all CHAOS only hosts +are now listed without any services! This is causing some programs +(e.g. :MAIL) to complain. We have temporarily backed out of the +binary (*not* the source) of the new tables; someone will have +to go in and edit all the right services onto OZ, PYG, etc. + + Noel + +Date: Fri, 23 Aug 85 11:21:31 EDT +From: J. Noel Chiappa +Subject: Subnet number info +To: INFO-HOSTS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].622522.850823.JNC> + + I retrieved the subnet number information which used to +reside at the end of HSTMIT > and placed it in MITSN > in SYSNET. + +Date: Fri, 23 Aug 85 09:48:50 EDT +From: Christopher C. Stacy +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].622460.850823.CSTACY> + +The MIT host table is now consolidated into a single file again. +HSTMIT contains both Internet and Chaosnet hosts in extended RFC810 format. +Anyone needing a table in HOSTS2 format can contact me about a Common-lisp +hack I wrote to produce such things. + +(There are still other files required to make a binary host table for +MIT-MC, and you should still not attempt to do that unless you really +know what you are doing.) + + +Date: Thu, 22 Aug 85 23:08:53 EDT +From: J. Noel Chiappa +Subject: Symbolics subnets removed +To: MIT-IP-PEOPLE@MIT-MC.ARPA, INFO-HOSTS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].622091.850822.JNC> + + As I mentioned doing a while back, the Symbolics subnets have +been removed from the HSTMIT file. Also, a subnet was allocated to +the MIT<->YoyoDyne serial link. + Finally, would anyone object if I renumbered the 'LCS 4th +floor Ethernet' (which doesn't seem to have any hosts on it) away from +its current number (59.), since the range of subnet numbers from 58. +to 67. is occupied in the IP address space by some Athena networks +placed there by a beano in octal->decimal conversion (don't ask). + + Noel + +Received: from MIT-ZERMATT.ARPA by MIT-MC.ARPA via Chaosnet; 5 AUG 85 22:57:30 EDT +Date: Mon, 5 Aug 85 22:56 EDT +From: Richard E. Zippel +Subject: MIT-VAX +To: info-hosts@MIT-MC.ARPA +Message-ID: <850805225603.2.RZ@ZERMATT> + +This entry has been moved to HSTMIB now that it speaks both Chaos and +TCP/IP + +HOST : 18.26.0.95, CHAOS 4120 : MIT-VAX.ARPA,MIT-VAX,MIT-VX,VX : VAX-11/750 : UNIX : TCP/TELNET,TCP/FTP,TCP/SMTP,TCP/FINGER,TCP/SUPDUP,CHAOS/NAME,CHAOS/TIME,CHAOS/TELNET,CHAOS/SUPDUP,CHAOS/MAIL,CHAOS/CFTP : + +Received: from MIT-ZERMATT.ARPA by MIT-MC.ARPA via Chaosnet; 2 AUG 85 17:10:22 EDT +Date: Fri, 2 Aug 85 17:09 EDT +From: Richard E. Zippel +Subject: New Lisp machines +To: info-hosts@MIT-MC.ARPA +Message-ID: <850802170919.8.RZ@ZERMATT> + + +The following entries were added both to SYSNET;HOSTS and HSTMIT + +HOST MIT-CHAMROUSSE, CHAOS 15326,USER,LISPM,SYMBOLICS-3600,[CHAMROUSSE] +HOST MIT-FLUTE, CHAOS 15330,USER,LISPM,SYMBOLICS-3600,[FLUTE] +HOST MIT-RTS-0, CHAOS 15331,USER,LISPM,EXPLORER,[MIT-RTS] +HOST MIT-RTS-1, CHAOS 15332,USER,LISPM,EXPLORER,[WARD,RTS-1] +HOST MIT-RTS-2, CHAOS 15333,USER,LISPM,EXPLORER,[CJT,RTS-2] +HOST MIT-RTS-3, CHAOS 15334,USER,LISPM,EXPLORER,[JMA,RTS-3] +HOST MIT-SARAJEVO, CHAOS 15325,USER,LISPM,SYMBOLICS-3600,[SARAJEVO] +HOST MIT-VIOLIN, CHAOS 15327,USER,LISPM,SYMBOLICS-3600,[VIOLIN] + +Some other small changes were made to the NU entries. In particular, +TERMAN, WARD and JMA nicknames were moved to TERMAN-NU, WARD-NU and +JMA-NU. RZ nickname was deleted. + +Received: from SCRC-QUABBIN.ARPA by MIT-MC.ARPA 23 Jul 85 08:18:20 EDT +Received: from NEPONSET.SCRC.Symbolics.COM by SCRC-QUABBIN.ARPA via CHAOS with CHAOS-MAIL id 185013; Tue 23-Jul-85 07:07:28-EDT +Date: Tue, 23 Jul 85 07:09 EDT +From: David C. Plummer in disguise +Subject: Symbolics subnets +To: J. Noel Chiappa , MIT-IP-PEOPLE@MIT-MC.ARPA +cc: Info-hosts@MIT-MC.ARPA +In-Reply-To: <[MIT-MC.ARPA].585023.850722.JNC> +Message-ID: <850723070907.2.NFEP@NEPONSET.SCRC.Symbolics.COM> + + Date: Mon, 22 Jul 85 23:49:13 EDT + From: J. Noel Chiappa + +[Info-hosts added.] + + Unless I hear some complaints from the Symbolics people on + this list, since the CHAOS link to Symbolics is completely gone (and + the address spaces no longer even partially congruent) I'd like to + think about recycling the Symbolics subnets from the MIT subnet + table. How about it, guys, is this OK? + +I believe all the namespaces involved have not communicated chaos +information for months. I know of no technical reasons not to reuse +subnets. + + +Date: Mon, 22 Jul 85 22:37:34 EDT +From: J. Noel Chiappa +Subject: Allocated MIT subnet +To: INFO-HOSTS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].584942.850722.JNC> + + The IP only subnet 124. is the Ethernet a Proteon. + +Date: Fri, 19 Jul 85 12:01:27 EDT +From: Richard Mlynarik +Subject: removed mit-pigpen from sysnet;hstmic and sysnet;hstmit +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].581655.850719.MLY> + +This machine (really at Symbolix, Inc) no longer exists. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 17 Jul 85 13:17:49 EDT +Date: Wed 17 Jul 85 13:13:57-EDT +From: Michael B McIlrath +Subject: new host table entries +To: info-hosts@MIT-MC.ARPA + +In HSTMIC, MIT-CAF-SWITCH-{0-3}, CHAOS 01270{0-3} + +In HSTMIB, MIT-CAF.ARPA, CHAOS 12750, IP 18.21.0.232 + +I just edited the files. I did not compile the tables; I dont know how. +--mike +------- + +Date: Tue, 25 Jun 85 19:12:56 EDT +From: Christopher C. Stacy +Subject: **** New Files *** +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].555778.850625.CSTACY> + +The host tables have been slightly rearranged as follows. + +SYSNET;HSTNIC - The official Internet host table from the NIC. + This is retrieved automatically from SRI-NIC each + evening. No one ever edits this file. + Hackers note: this file contains domain-style names + such as "MIT-MC.ARPA" and "PURDUE.EDU", which is + what everyone is (supposed to be) using now. + --- This is in RFC810 format (of course.) + +SYSNET;HSTMIC - Hosts which are ONLY on the Chaosnet and no other + networks. This file does NOT include Chaosnet hosts + which are also on the Internet. + --- HSTMIC is currently in HOSTS2 format, although it will + probably be converted to modified RFC810* soon. + +SYSNET;HSTMIB - Hosts which are on both the Internet and the Chaosnet. + The hosts in here are basically copies of certain HSTNIC + entries, but with Chaosnet addresses added. + Note that sites which are Chaosnet-only need HSTMIB also! + --- HSTMIB is in modified RFC810* format. + +SYSNET;HSTMII - Hosts which are only on the Internet but which the NIC + does not know about. Since there probably shouldn't be + any such hosts, this file may disappear in the future. + The dozen hosts currently listed in here are being contacted + to see what they think is going on with their host names. + --- HSTMII is in HOSTS2 format. + +* (Modified RFC810 format means that the address field may contain + keyword network specs. Example: "HOST : CHAOS 1440 : MIT-MC ...". + The HOSTS3 compiler understands this format.) + +The file SYSNET;HSTMIT is now obsolete and outdated. Host additions +and changes should be made in the HSTMIC and HSTMIB files instead. +The new files are up to date (from HSTMIT 405 written this evening). + +When you edit one of the files, be sure to send a note to everybody at +INFO-HOSTS describing your change. Do not try to compile the files +for MC; this will be done periodically by an ITS hacker. + +Cheers, +Chris + + +PS. New host tables compiled and installed on MC. + +Received: from MIT-SPEECH by MIT-MC.ARPA via Chaosnet; 25 JUN 85 17:42:36 EDT +Date: Tue 25 Jun 85 17:43:31-EDT +From: John Wroclawski +To: info-hosts@MIT-MC + +Added MIT-GAUGUIN @ chaos 15414. Whoever put MIT-GEEK after MIT-GOOFY, +please remember there are some programs around that care about +slphabetization. +------- + +Received: from MIT-BITSY.MIT.EDU by MIT-MC.ARPA 18 Jun 85 18:19:25 EST +Received: by MIT-BITSY.MIT.EDU (4.12/4.7) + id AA20323; Tue, 18 Jun 85 18:17:26 edt +Date: Tue, 18 Jun 85 18:17:26 edt +From: jis@MIT-BITSY.MIT.EDU (Jeffrey I. Schiller) +Message-Id: <8506182217.AA20323@MIT-BITSY.MIT.EDU> +To: CSTACY@MIT-MC.ARPA +Cc: INFO-HOSTS@MIT-MC.ARPA +In-Reply-To: Christopher C. Stacy's message of Mon, 17 Jun 85 16:14:17 EDT + +Yes this is really true. They are located in building E15 which has +Internet service but no chaosnet service. + + -Jeff + +Received: from MIT-BITSY.MIT.EDU by MIT-MC.ARPA 18 Jun 85 18:19:25 EST +Received: by MIT-BITSY.MIT.EDU (4.12/4.7) + id AA20323; Tue, 18 Jun 85 18:17:26 edt +Date: Tue, 18 Jun 85 18:17:26 edt +From: jis@MIT-BITSY.MIT.EDU (Jeffrey I. Schiller) +Message-Id: <8506182217.AA20323@MIT-BITSY.MIT.EDU> +To: CSTACY@MIT-MC.ARPA +Cc: INFO-HOSTS@MIT-MC.ARPA +In-Reply-To: Christopher C. Stacy's message of Mon, 17 Jun 85 16:14:17 EDT + +Yes this is really true. They are located in building E15 which has +Internet service but no chaosnet service. + + -Jeff + +Received: from mit-ems.ARPA by MIT-MC.ARPA 17 Jun 85 22:49:17 EST +Received: by mit-ems.ARPA (4.12/4.8) id AA00540; Mon, 17 Jun 85 22:48:00 edt +Date: Mon, 17 Jun 85 22:48:00 edt +From: Steven Haflich +Message-Id: <8506180248.AA00540@mit-ems.ARPA> +To: CSTACY@MIT-MC.ARPA, INFO-HOSTS@MIT-MC.ARPA +Subject: ZAXXON and XEVIOUS + +These machines are 3600's in E15, the new Media Lab. The building +connects to the campus spine, thus is Internet. There are a couple +Chaos hosts in the building which can (and occasionally do) +communicate, but there is no Chaos connection to the outside world. + +It may be in the future that the MINITS bridge ARCMAC-HUB will get +reconstituted in order to connect the ARCMAC Magic-6 hosts to +the real world again. If so, it might be necessary to boot it from +MIT-EMS, which is also in the building, and if so, MIT-EMS might +then assume MIT-MC's chaos address -- it's easier than cutting a +new rom for ARCMAC-HUB. For this and other reasons, we chose not +to publicise chaos hackery within E15. No one outside should ever +see any of it. + +Date: Mon, 17 Jun 85 17:16:58 EDT +From: Christopher C. Stacy +Subject: Mailer lossage was due to vandalized host table +To: BUG-COMSAT@MIT-MC.ARPA, MEYER@MIT-MC.ARPA, PSZ@MIT-MC.ARPA, + RAY@MIT-MC.ARPA, GSB@MIT-MC.ARPA, SRA@MIT-XX.ARPA, + smh@MIT-EMS, bandy@LLL-CRG.ARPA, kmp@SCRC-STONY-BROOK.ARPA, + Postmaster@SCRC-STONY-BROOK.ARPA +cc: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].547207.850617.CSTACY> + + +Disregarding my previous warnings that MC uses a special host table, +someone on 6/16 installed a bogus host table which broke the mail +system. (I believe the exact breakage was that the host table forgot +all about any hosts which are on both the Internet and the Chaosnet, +including MIT-MC.) I have de-installed the broken table, and mail is +flowing again. I resubmitted about 40 incorrectly failed messages +which the mail system had retained copies of, but an indetermintent +number of messags were mis-delivered or completely lost. I have +removed the command file used to create new host tables. + + PLEASE DO NOT ATTEMPT TO INSTALL ANY HOST TABLES ON MIT-MC. + +Chris + +Date: Mon, 17 Jun 85 16:14:17 EDT +From: Christopher C. Stacy +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].547045.850617.CSTACY> + +I wonder why ZAXXON and XEVIOUS have Internet addresses but no Chaosnet +addresses? Is this really true? + +Received: from mit-borax.ARPA by MIT-MC.ARPA 17 Jun 85 11:29:59 EST +Received: by mit-borax.ARPA (4.12/4.7) + id AA12548; Mon, 17 Jun 85 11:29:49 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8506171529.AA12548@mit-borax.ARPA> +Date: Jun 17, 1985 10:38am +Subject: new hosts +To: info-hosts@mc + +I added the following hosts to HSTMIT >: MIT-LECTROID (YOYODYNE-GW, +MIT-EIGHTH-DIMENSION), MIT-LORD-JOHN-WHORFIN (LORD-JOHN-WHORFIN, +JOHN-WHORFIN), MIT-JOHN-BIGBOOTE (JOHN-BIGBOOTE, BIGBOOTE), MIT-JOHN-YAYA +(JOHN-YAYA, YAYA) and MIT-JOHN-SMALLBERRIES (JOHN-SMALLBERRIES, SMALLBERRIES). +These machines are all on the yoyodyne subnet, of course. + - John Romkey +"Laugha while you can, monkey boy." - Lord John Whorfin + + +Received: from MIT-VAX by MIT-MC via Chaosnet; 6 JUN 85 15:45:07 EDT +Received: by mit-vax.Mit-chaos.Arpa (4.12/4.8) id AA02628; Thu, 6 Jun 85 15:43:01 edt +Date: Thu, 6 Jun 85 15:43:01 edt +From: Jeff Arnold +To: info-hosts@mc + +Added CONCERT-0 through CONCERT-7, changed the address of CONCERT-TEST + +Received: from MIT-ZERMATT by MIT-MC via Chaosnet; 4 JUN 85 12:02:19 EDT +Date: Tue, 4 Jun 85 12:00 EDT +From: Richard E. Zippel +To: info-hosts@MIT-MC.ARPA +Message-ID: <850604120026.9.RZ@ZERMATT> + +I renamed MIT-OVAL to MIT-CORNCOB, but did not recompile the +host tables. MIT-CORNCOB is now in the Lispm namespace +and OVAL has been deleted. + +Date: Tue, 28 May 85 10:39:54 EST +From: Christopher C. Stacy +Subject: note that MC is running with a funny HOSTS3 table +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].521491.850528.CSTACY> + +MIT-MC is running an experimental version of our mail system and +certain other programs. This stuff uses a host table containing +domain-style names and is not generated from the usual files. + +This means if you make any changes, compile and install them, they +will not take effect on MC. Assuming everything works, at the end of +the week the experimental stuff on MC will become the normal stuff. +The procedure for hacking the host tables will be a little different +at that time. + +(Also, I am working on getting a domain name resolver/server going on +MC, and when that's up things will change yet again. Stay tuned!) + +Date: Mon, 27 May 85 20:43:42 EST +From: J. Noel Chiappa +Subject: New HOST, tables not recompiled +To: INFO-HOSTS@MIT-MC +cc: JNC@MIT-MC +Message-ID: <[MIT-MC].521097.850527.JNC> + + Added MIT-AI-GW, 26/10, the MIT-AI ARPANet gateway. + +Date: Tue, 21 May 85 11:21:17 EST +From: S. Robert Austein +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].512587.850521.SRA> + +Added MIT-OVAL (Imagen 12/300 printer) so that I don't have to type +the address in octal every time the unix spooler flakes out. + +Received: from mit-borax.ARPA by MIT-MC.ARPA; 15 May 85 20:57:34 EST +Received: by mit-borax.ARPA (4.12/4.7) + id AA06477; Wed, 15 May 85 20:57:55 edt +Date: Wed, 15 May 85 20:57:55 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8505160057.AA06477@mit-borax.ARPA> +To: info-hosts@mc +Subject: new host + +I added MIT-DB (MIT-DBS, DBS) to the tables. + - John + +Received: from MIT-ZERMATT by MIT-MC via Chaosnet; 13 MAY 85 10:25:23 EDT +Date: Mon, 13 May 85 10:23 EDT +From: Richard E. Zippel +Subject: Telluride +To: info-hosts@MIT-MC.ARPA +cc: darth@OZ.MIT +Message-ID: <850513102328.8.RZ@ZERMATT.MIT> + +Has been moved to Chaos 15322, so its internet address wouldn't conflict +with Blue-Jeans (had been 15030). + +Date: Sat, 11 May 85 08:46:35 EST +From: Gail Zacharias +Sender: ___013@MIT-MC +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].497408.850511.___013> + +I commented out mit-devmultics from hstmit, because it conflicts seriously (per +hosts3 compiler) with info in the nic table. + +Received: from MIT-SPEECH by MIT-MC via Chaosnet; 10 MAY 85 23:59:31 EDT +Date: Sat 11 May 85 00:00:49-EDT +From: John Wroclawski +To: info-hosts@MIT-MC + +Added MIT-MONET, a lispm, at chaos 16230. Changed CADR26, etc., from +nicknames for MIT-POLAR to nicknames for monet, which is the real +cadr-26, polar being a symbolix LM2. +------- + +Date: Thu, 2 May 85 19:20:02 EDT +From: J. Noel Chiappa +Subject: New HSTMIT +To: INFO-HOSTS@MIT-MC +cc: JNC@MIT-MC +Message-ID: <[MIT-MC].482449.850502.JNC> + + Someone had typed in all the Student Center machines' subnet +number in decimal when of course it needs to be in octal. + +Date: Tue, 30 Apr 85 23:52:28 EDT +From: Jeffrey I. Schiller +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].478647.850430.JIS> + +Added the AMT Ethernet and its hosts (subnet 125 octal 85 decimal). + + -Jeff + +Received: from MIT-APIARY-7 by MIT-MC via Chaosnet; 29 APR 85 14:01:08 EDT +Date: Mon, 29 Apr 85 14:00 EDT +From: Christopher C. Stacy +Subject: Wait, it gets better. +To: Alan Bawden +cc: BUG-MAIL@MIT-MC.ARPA, INFO-HOSTS@MIT-MC.ARPA +In-Reply-To: <[MIT-MC].473710.850429.ALAN> +Message-ID: <850429140021.2.CSTACY@APIARY-7> + + Date: Mon, 29 Apr 85 01:26:25 EDT + From: Alan Bawden + + I hope MIT-POSEIDON is ready to handle all the mail addressed to people who + use the Foonly (POS) at Symbolics... + +This is because on 4/26/85 someone munged the HOSTS MASTER file and +then compiled a new host table. + +Received: from STONY-BROOK.SCRC.Symbolics.COM by MIT-MC.ARPA; 24 APR 85 16:44:33 EST +Received: from PEACE.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 222818; Wed 24-Apr-85 11:20:01-EST +Date: Wed, 24 Apr 85 11:19 EST +From: Charles Hornig +Subject: Symbolics host tables +To: info-hosts@MIT-MC.ARPA, comp-fac@STONY-BROOK.SCRC.Symbolics.COM +Message-ID: <850424111949.7.HORNIG@PEACE.SCRC.Symbolics.COM> + +The files HSTSYM and HSTSYI which contain information about Symbolics +hosts should be deleted and references to them removed. Access to +Symbolics hosts from now on should be through the Internet. + + +Date: Fri,12 Apr 85 01:44:37 EST +From: Christopher C. Stacy +Sender: CSTAC0@MIT-MC +Subject: REAGAN +To: MLY@MIT-MC +cc: INFO-HOSTS@MIT-MC +In-reply-to: Msg of Fri12 Apr 85 01:36:37 EST from Richard Mlynarik +Message-ID: <[MIT-MC].452451.850412.CSTAC0> + + Date: Fri,12 Apr 85 01:36:37 EST + From: Richard Mlynarik + Sender: MLY0 + To: BUG-HOSTS + Message-ID: <[MIT-MC].452440.850412.MLY0> + + reagan, amonst many other machines, is not believed to have a chaos + address by mc. + +REAGAN was put into the NIC's host table in a manner which collided +with and supusersede its entry in the chaosnet hosts table. +I "fixed" this. It will be really fixed in the domain system. + +Received: from MIT-VAX by MIT-MC via Chaosnet; 11 APR 85 17:00:48 EST +Received: by mit-vax.Mit-chaos.Arpa (4.12/4.8) id AA19807; Thu, 11 Apr 85 17:00:02 est +Date: Thu, 11 Apr 85 17:00:02 est +From: Jeff Arnold +To: info-hosts@mc +Subject: mit-concert-test added + +I've added MIT-CONCERT-TEST (015375) to sysnet;hosts > and hstmit > + +Date: Mon, 8 Apr 85 15:50:42 EST +From: S. Robert Austein +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].447170.850408155233.SRA> + +Got rid of extraneous space in HSTMIT that broke compilation (grrr). + +Date: Mon, 8 Apr 85 01:58:55 EST +From: Christopher C. Stacy +To: INFO-HOSTS@MIT-MC +cc: GILDEA@MIT-MC +Message-ID: <[MIT-MC].446299.850408020021.CSTACY> + +I gobbled subnet 54 (44.) for the ERL people in building E-34, +whose ethernet will probably be connected to the rest of the +world someday. + +Date: Sun, 7 Apr 85 16:48:51 EST +From: Ramin D. Zabih +To: INFO-HOSTS@MIT-MC +cc: staff@MIT-CHARON +Message-ID: <[MIT-MC].445849.850407164937.RDZ> + + +I have removed MIT-CHARON's chaosnet address until such time as the +chaos net to building 11 gets fixed. + +Date: Sat, 6 Apr 85 22:47:49 EST +From: Jeffrey I. Schiller +Subject: SYSNET;HSTMIT 368 +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].445261.850406225213.JIS> + +Removed MIT-ATHENA's chaosnet address as that portion of the +ChaosNet is currently broken. This will force mail to go via the Internet. + + -Jeff + +Date: Sat, 6 Apr 85 22:46:16 EST +From: Jeffrey I. Schiller +To: INFO-HOSTS@MIT-MC +Message-ID: <[MIT-MC].445257.850406224628.JIS> + + + +Date: 27 March 1985 00:05-EST +From: Richard E. Zippel +To: INFO-HOSTS @ MIT-MC + +I added two new 3600's Breckenridge and Starling, deleted Tahoe. +Please check to see if MIT-FRANK-SINATRA is in the right place. +I thought the names were supposed to be alphabetical,and MIT-F-S is +in the MIT-S's. + +Date: 17 March 1985 00:07-EST +From: Richard E. Zippel +To: INFO-HOSTS @ MIT-MC + +I added two harris hosts to the table, Harris-1 (a lisp machine) +and Harris-Trantor a vax. + +Received: from MIT-SMOKEY by MIT-MC via Chaosnet; 15 MAR 85 23:00:08 EST +Date: Fri, 15 Mar 85 22:59 EST +From: Scott Cyphers +Subject: Booboo +To: info-hosts@MIT-MC.ARPA +Message-ID: <850315225931.5.CYPHER@MIT-SMOKEY.MIT> + +I changed its address and ran XFILE. + +Date: 15 March 1985 16:55-EST +From: S. Robert Austein +To: INFO-HOSTS @ MIT-MC + +Added HQ as alias for MIT-LCS-HQ (on request of MBJ). + +Received: from mit-borax.ARPA by MIT-MC.ARPA; 7 MAR 85 22:47:12 EST +Received: by mit-borax.ARPA (4.12/4.7) + id AA06259; Thu, 7 Mar 85 22:48:00 est +Date: Thu, 7 Mar 85 22:48:00 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8503080348.AA06259@mit-borax.ARPA> +To: info-hosts@mc +Subject: new hosts + +I added MIT-GEEK, MIT-NERD and MIT-WIMP, a trio of Sun workstations at +LCS 32/221 through LCS 32/223. I also added MIT-SAURON at LCS 12/304. + - John + +Received: from MIT-SMOKEY by MIT-MC via Chaosnet; 03/06/85 21:35:12 +Date: Wed, 6 Mar 85 21:33 EST +From: Scott Cyphers +To: info-hosts@MIT-MC.ARPA +Message-ID: <850306213354.1.CYPHER@MIT-SMOKEY.MIT> + +I added MIT-RENOIR and MIT-KOALA to HOSTS and HSTMIT, took away KOALA as +a nickname for LM12, and changed addresses for Yogi and Panda, and ran +XFILE. I also fixed the comment to say to do :XFILE SYSNET;HOSTS XFILE +instead of SYSENG;. + +Date: 5 March 1985 17:42-EST +From: S. Robert Austein +To: INFO-HOSTS @ MIT-MC + +Removed LCS entry for MIT-VAX, since it is now Chaos-only. + +Date: 4 March 1985 18:05-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Is everyone on this list really interested in tracking the changes +in MIT's own private host tables? There is no problem if you are, +but I just noticed that the list is quite large and contains mostly +people on hosts which don't use our tables. + +Received: from by MIT-MC;4 March 1985 17:48-EST +Date: Mon 4 Mar 85 11:15:59-EST +From: Rob Austein +Subject: Current HOSTS2 format files +To: info-hosts@MIT-MC.ARPA +Office: [NE43-502] 545 Technology Square, Cambridge MA 02139; (617) 253-7341 + +For those machines that still need HOSTS2 format files, you can get up +to date versions from SYSTEM:HOSTS2.TXT and SYSTEM:HOSTS2.BIN (source +and binary, respectively) by FTPing to XX and logging in as ANONYMOUS +with any password. These files get generated automaticly by a batch +job from our HOSTS3 table. Any host that doesn't fit into the HOSTS2 +format is omitted, but otherwise this contains all the hosts and nets +in HSTMIT, HSTSYM, HSTSYI, and HSTNIC. + +Right now these are in the old format, with no ".ARPA" on the ends of +Internet hostnames. When the MC source files change format, so will +these. + --Rob +------- + +Date: 20 February 1985 02:34-EST +From: Christopher C. Stacy +Subject: NIC Host Tables +To: INFO-HOSTS @ MIT-MC + +Since I no longer need to hand-edit our version of the NIC host +table (the HSTNIC file) to get local fixes, I have written and +installed a system demon which will run on MC each day to keep our +copy up to date automagically. + +So, if you compile the host tables here, be aware that the NIC table +will be updated without human intervention and inspection. If the NIC +table is broken or something (bad versions have been known to be +released in the past) you may encounter errors. You should report +these things to me, and I'll fix them (of course if if you are plenty +damn sure you know what's going on you can fix it yourself.) + +Cheers, +Chris + +Received: from MIT-GSTAAD by MIT-OZ via Chaosnet; 19 Feb 85 14:13-EST +Date: Tue, 19 Feb 85 14:06 EST +From: "Richard E. Zippel" +Subject: Concert +To: INFO-HOSTS@MIT-MC.ARPA +Message-ID: <850219140629.1.RZ@GSTAAD.MIT> + +I've added the address of Concert, Halstead's multiprocessor system, to +the host tables: +HOST MIT-CONCERT, CHAOS 15376,SERVER,CONCERT,CONCERT,[CONCERT] + +Date: 13 February 1985 13:19-EST +From: Richard Mark Soley +Subject: SYSNET;HOSTS XFILE +To: CSTACY @ MIT-MC +cc: INFO-HOSTS @ MIT-MC + +Chris - the host table installation xfile failed attempting to parse CSTACY;NEWHST 3 +at lines 59, 61, and 63. If you could fix whatever you're doing & install the +new tables, I'd appreciate it. + +Changed MIT-NEWTOWNE-VARIETY to be internet-only host (removed chaos addresses). + + -- Richard + +Date: 7 February 1985 16:46-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC +cc: BCN @ MIT-MC, GILDEA @ MIT-MC + +New host tables generated, including latest NIC table. + +There is now a kludge for getting around host nickname +collisions. The only host which I have fixed this way +is MIT-EDDIE, which will now get the nickname EDDIE instead +of giving it to UW-EDDIE. If you have a host with this problem, +let me know and I'll fix it for you. + +Chris + +Date: 4 February 1985 08:53-EST +From: Christopher C. Stacy +Subject: new host tables +To: BCN @ MIT-EECS +cc: RZ @ MIT-MC, CSTACY @ MIT-MC, INFO-HOSTS @ MIT-MC +In-reply-to: Msg of Mon 4 Feb 85 08:46:05-EST from Clifford Neuman + +You should switch over to the HSTMIT file; the HOSTS file is +hopelessly out of date and has been for about two years. +(There isn't any SU-TAHOE in the HSTNIC or HSTMIT files.) + +Chris + +Date: Mon 4 Feb 85 08:46:05-EST +From: Clifford Neuman +Subject: Re: new host tables +To: CSTACY@MIT-MC +cc: INFO-HOSTS@MIT-MC, RZ@MIT-MC +In-Reply-To: Message from "Christopher C. Stacy " of Mon 4 Feb 85 07:52:43-EST + +It seems that in the new host table (HOSTS 834), the name TAHOE was a +nickname for both MIT-TAHOE, and SU-TAHOE. This was causing problems +compiling the table on EE. I removed the nicname TAHOE from SU-TAHOE +in HOSTS 835. SU-TAHOE is the name of Stanford's dover. + + ~ Cliff + +------- + +Date: 4 February 1985 07:43-EST +From: Christopher C. Stacy +Subject: new host tables +To: INFO-HOSTS @ MIT-MC +cc: RZ @ MIT-MC + +New host tables generated on MC. +Someone added a LispM named GARY-COOPER at the same Chaosnet address +as NU-29, so I commented out NU-29. Someone should go and resolve +this if they want NU-27 back on the network. + + +Received: from MIT-GSTAAD by MIT-OZ via Chaosnet; 15 Jan 85 23:57-EST +Date: Tue, 15 Jan 85 23:55 EST +From: "Richard E. Zippel" +Subject: Gary Cooper +To: info-hosts@MIT-MC.ARPA +cc: Soley@MIT-MC.ARPA, ward@MIT-VAX.ARPA +Message-ID: <850115235553.5.RZ@GSTAAD.MIT> + +I deleted NU-29 from the host table and replaced it with +MIT-GARY-COOPER at the same address, with nicknames GARY and +GARY-COOPER. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA09164; Mon, 14 Jan 85 15:02:03 est +Date: Mon, 14 Jan 85 15:02:03 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8501142002.AA09164@mit-borax.ARPA> +To: info-hosts@mc +Subject: MIT-SLUSH + +I added MIT-SLUSH (18.26.0.130) to HSTMIT > and HOSTS >. I also added +MIT-SLUDGE to HOSTS >. Before, it was only listed in HSTMIT. + - John + +Date: Sat 12 Jan 85 16:04:49-EST +From: Clifford Neuman +Subject: New address for MIT-EDDIE +To: INFO-HOSTS@MIT-MC + +CHAOS 12404 has been added for MIT-EDDIE in +HSTMIT(339) and HOSTS(831). + + ~ Cliff + +------- + +Received: by mit-borax.ARPA (4.12/4.7) + id AA08091; Tue, 1 Jan 85 20:53:26 est +Date: Tue, 1 Jan 85 20:53:26 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8501020153.AA08091@mit-borax.ARPA> +To: info-hosts@mc +Subject: two new hosts + +I added MIT-STORMWATCH and PROTEON to HSTMIT and HOSTS. + - John + +Date: 30 December 1984 17:04-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Added MIT-ZAXXON (LispM at arcmac or something like that). + +Date: 21 December 1984 22:27-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New host tables installed on MC. + +Date: Wed 12 Dec 84 13:45:30-EST +From: Rob Austein +Subject: Re: Host table formats changing soon! +To: CSTACY@MIT-MC.ARPA +cc: INFO-HOSTS@MIT-MC.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Sun 9 Dec 84 23:51:00-EST +Office: [NE43-502] 545 Technology Square, Cambridge MA 02139; (617) 253-7341 + + I'm afraid XX is still using HOSTS > too, unless I am very + confused. +------- + +Date: 10 Dec 1984 16:25:34-EST +From: smh@mit-ems +To: CSTACY@mit-mc, INFO-HOSTS@mit-mc +Subject: Host table formats changing soon! + + Also, does anyone still use the old "HOSTS >" format file? + You probably shouldn't be. The data in there is far from + complete or accurate. Also, since HSTMIT will be in a different + format from HOSTS, updating HOSTS will be painful and people will + probably stop doing it very much (if they are now.) + +Alas, HOST2 and the old "HOSTS >" format is still used by +{several,many,most,all} Unix chaos systems. I'm not sure which of +those adjective is accurate, but I know from personal inspection that +at least one of them is true. If proper Unix hosts3 support exists, +I'd like to know about it. If it has to be created, any volunteers? + +Steve Haflich, smh@mit-ems + +Date: Mon 10 Dec 84 04:59:31-EST +From: John Wroclawski +To: info-hosts@MIT-MC + +New HSTMIT, HOSTS > - moved MIT-AI to chaos 3130 +------- + +Date: 9 December 1984 23:51-EST +From: Christopher C. Stacy +Subject: Host table formats changing soon! +To: INFO-HOSTS @ MIT-MC + + +In the near future, the format of the HSTNIC and HSTMIT host table +files will be changing as part of the transition to the Internet name +domain system. + +The HSTNIC file will reflect the official Internet host table at the +NIC, which these days has hosts with domain names like "MIT-AI.ARPA". +The hosts also have nicknames like "MIT-AI" (their pre-domain official +global name). + +The HSTMIT file will become a HOSTS3 (extended RFC810) format file, +Internet hosts listed in this file will be renamed to correspond to +their names in the HSTNIC file (ie., they will have ".ARPA" tacked on +to them. + +Note: Collisions between nicknames in the HSTNIC and HSTMIT file +(e.g., MIT's EDDIE vs. UW's EDDIE) will probably not be solved by +these changes, since their is no real domain name system underneath. + +If you are using the HOSTS3 compiler, you can at least compile the new +files. You may have some trouble with software which thinks it knows +about name domains. Of course, eventually a great deal of the world +will have to be rewritten to use the name domain stuff in a fully +general way, but that headache is still a little while off. + +Also, does anyone still use the old "HOSTS >" format file? +You probably shouldn't be. The data in there is far from +complete or accurate. Also, since HSTMIT will be in a different +format from HOSTS, updating HOSTS will be painful and people will +probably stop doing it very much (if they are now.) + +Please direct any questions and problems to me. + +Chris + +Date: 6 December 1984 00:02-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New host tables installed on MC. + +Date: Wednesday, 5 December 1984, 14:13-EST +From: Tom Cloney +To: INFO-HOSTS at MC + +CADR-19 has been given the additional nickname SARAH (Sarah Bernhardt). +The appropriate files have been updated on OZ and MC. +HSTNIC has not been altered. + + + +Date: 25 November 1984 21:43-EST +From: Richard Mark Soley +Subject: NEWT +To: INFO-HOSTS @ MIT-MC +cc: RDZ @ MIT-MC, greg @ MIT-XX, iannucci @ MIT-XX + +Put MIT-NEWTOWNE-VARIETY on the CHAOSnet at 15113 and 30330. + + -- Richard + +Date: 17 November 1984 15:44-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest host tables installed on MC. + +Date: Thu 15 Nov 84 18:07:16-EST +From: George A. Boughton +Subject: subnet 10 +To: info-hosts@MIT-MC.ARPA + + Mit-vax, cadr-9, cadr-12, cadr-16, cadr-19, cadr-20, and +cadr-29 have been removed from subnet 6 and placed on subnet 10. +Their new addresses can be found in mc:sysnet;hstmit >. +------- + +Received: from MIT-BUGS-BUNNY by MIT-OZ via Chaosnet; 15 Nov 84 10:23-EST +Received: by bugs-bunny.mit.arpa (4.12/4.8) id AA18320; Thu, 15 Nov 84 10:20:33 est +Date: Thu, 15 Nov 84 10:20:33 est +From: Web Dove +To: Bug-HOSTS3@MIT-OZ, INFO-HOSTS@MIT-OZ, MARTY@MIT-OZ, + OZ-HOSTS-HACKERS@MIT-OZ +Subject: Re: Number assignment conflict? + + + From: Martin David Connor + Subject: Number assignment conflict? + + + I was running HOSTS3 asking for HOSTS2 output: + + Reading text file OZ:HOSTS.MASTER.2 + Inserting file OZ:HOSTS.NIC.394 + Inserting file OZ:HOSTS.SYI.15 + Inserting file OZ:HOSTS.MIT.326 + Inserting file OZ:HOSTS.SYM.59 + Processing tables... + Flushing duplicate net def "CHAOS" = 1:7.0.0.0 + + I got the following error: + + Duplicate address 18.20.41.21 = MIT-YOSEMITE-SAM, SCRC-RIVERSIDE + ..... + 180 nets, 1497 sites, 3174 names; length 21180 + 1 "serious" errors, so not writing binary file. + + Here are the NIC host table entries for the hosts in question: + + HOST : 18.20.41.21, 192.10.41.21 : SCRC-RIVERSIDE : .... + + HOST : 18.20.27.21, 18.27.0.21 : MIT-YOSEMITE-SAM,SAM .... + + Now, I always thought the 3rd digit in the net 18 scheme was always 0 + for some reason. In any case, I think HOSTS3 also believes this as it + seems to be ignoring it. + + Since I am not sure who is out of step here, I am sending to all the + probable parties, in hopes someone will know the right fix. + +The arpa numeric address standard calls for decimal numbers separated +by dots. My understanding is that the numbers 18.20.subnet.host are +used at mit to signify those host addresses which support chaos wrapped +internet packets and can unwrap them. For those hosts, "subnet" +corresponds to the chaos subnet number and "host" to the chaos host +number. I directly translated chaos octal subnet 033 to decimal number +27. in order to arrive at the addresses for bugs-bunny (18.20.27.17) +and yosemite-sam (18.20.27.21). Both hosts also have raw internet +packet addresses (18.27.0.17, 18.27.0.21). + +The HOSTS3 program must treat the first two numbers of addresses of the +form 18.x as determining the subnet and the last two as determining the +host. This will work for both addresses of the form 18.x.0.y and +18.20.x.y. + +In fact, I think it was an error for me to send the 18.20.27.y addresses +to sri-nic as they do not need to know them. Those addresses are only +significant for the wrapping gateways around mit. + +P.S. +Please send mail to me direct as I am not on any of the hosts mailing lists. + +Date: 14 November 1984 20:16-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest host tables installed on MC. + +Received: from MIT-XX by MIT-OZ via Chaosnet; 14 Nov 84 13:18-EST +Date: Wed 14 Nov 84 13:18:37-EST +From: J. Noel Chiappa +Subject: Re: Number assignment conflict? +To: MARTY@MIT-OZ, Bug-HOSTS3@MIT-OZ, INFO-HOSTS@MIT-OZ, OZ-HOSTS-HACKERS@MIT-OZ +cc: JNC@MIT-XX +In-Reply-To: Message from "Martin David Connor " of Wed 14 Nov 84 11:57:00-EST + + The problem here is that with the 'new' CHAOS wrapping scheme +in use the third byte is in fact in use. HOSTS3 is incorrect in ignoring +this. Yosemite and Riverside have addresses that are identical except +in the third byte. + The number of hosts that have that byte non-zero should be very +small; they are the wrapping/unwrapping gateways. The only ones I know +of that are actually running are Bugs, Gross, Riverside and Trillian. +You could probably deleete the offending address for Sam without much +problem. + Noel +------- + +Date: 14 Nov 1984 11:57 EST (Wed) +Message-ID: +From: Martin David Connor +To: Bug-HOSTS3%MIT-OZ@MIT-MC.ARPA, INFO-HOSTS%MIT-OZ@MIT-MC.ARPA, + OZ-HOSTS-HACKERS%MIT-OZ@MIT-MC.ARPA +Subject: Number assignment conflict? + + +I was running HOSTS3 asking for HOSTS2 output: + + Reading text file OZ:HOSTS.MASTER.2 + Inserting file OZ:HOSTS.NIC.394 + Inserting file OZ:HOSTS.SYI.15 + Inserting file OZ:HOSTS.MIT.326 + Inserting file OZ:HOSTS.SYM.59 + Processing tables... + Flushing duplicate net def "CHAOS" = 1:7.0.0.0 + +I got the following error: + + Duplicate address 18.20.41.21 = MIT-YOSEMITE-SAM, SCRC-RIVERSIDE + ..... + 180 nets, 1497 sites, 3174 names; length 21180 + 1 "serious" errors, so not writing binary file. + +Here are the NIC host table entries for the hosts in question: + +HOST : 18.20.41.21, 192.10.41.21 : SCRC-RIVERSIDE : SYMBOLICS-3600 : LISPM : UDP/TIME,UDP/TFTP,TCP/FINGER,TCP/SMTP,TCP/TELNET,TCP/TIME,UDP/FINGER,TCP/FTP : + +HOST : 18.20.27.21, 18.27.0.21 : MIT-YOSEMITE-SAM,SAM,YOSEMITE-SAM : VAX-11/750 : UNIX : TCP/TELNET,TCP/FTP,TCP/SMTP,TCP/TIME,TCP/DAYTIME,TCP/FINGER : + +Now, I always thought the 3rd digit in the net 18 scheme was always 0 +for some reason. In any case, I think HOSTS3 also believes this as it +seems to be ignoring it. + +Since I am not sure who is out of step here, I am sending to all the +probable parties, in hopes someone will know the right fix. + + +Date: 13 November 1984 14:52-EST +From: Richard Mark Soley +To: INFO-HOSTS @ MIT-MC + +Moved all Tanglewood Lispmachines to subnet 60. +Deleted FLAME-OF-THE-FOREST. +Added BLUE-SPRUCE. + + -- Richard + +Date: 9 November 1984 13:26-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New host table installed, including NIC and local changes. + +Received: from MIT-ZERMAT by MIT-OZ via Chaosnet; 8 Nov 84 22:41-EST +Date: Thu, 8 Nov 84 22:38 EST +From: "Richard E. Zippel" +To: info-hosts@MIT-MC.ARPA + +mc:sysnet;hstmit 321 and mc:sysnet;hosts 818 have the new chaosnet +address of Aspen (15315) and the correct spelling of Zermatt. + +Date: 6 November 1984 15:01-EST +From: Richard E. Zippel +To: INFO-HOSTS @ MIT-MC + +I've added two lisp machnes, zermatt and gstaad at 15316 and 15317. +I didn't compile the table. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA07961; Sun, 4 Nov 84 20:42:07 est +Date: Sun, 4 Nov 84 20:42:07 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8411050142.AA07961@mit-borax.ARPA> +To: info-hosts@mc +Subject: a free subnet + +I've freed up subnet 152 since I wasn't using it. First come, first +serve. + - John + +Date: 4 November 1984 13:19-EST +From: David C. Plummer +To: INFO-HOSTS @ MIT-MC, RZ @ MIT-MC + +MIT-HARRIS-BRIDGE was moved from subnet 32 to 72, thus giving its +address an non-lethal injection of 20000 units of octal number. + +Date: 4 November 1984 13:05-EST +From: David C. Plummer +To: INFO-HOSTS @ MIT-MC +cc: RZ @ MIT-MC + +I took subnets 156 and 157 for Harris and defined the following +hosts in HSTMIT and HOSTS. The first is the Harris end, the +second the MIT end. I probably won't compile the host tables +unless I find a great need to. + +HOST HARRIS-MIT-BRIDGE, [CHAOS 67402,CHAOS 67002],USER,MINITS,PDP11 +HOST MIT-HARRIS-BRIDGE, [CHAOS 15040,CHAOS 67001],USER,MINITS,PDP11 + +Date: 4 November 1984 12:51-EST +From: David C. Plummer +To: LWA @ MIT-MC, DCLARK @ MIT-MC +cc: INFO-HOSTS @ MIT-MC + +We are running very short of "unused" Chaos subnets. For that +matter, the last two "unused" subnets will be snarfed in a few +minutes. The "Reserved for project Athena" subnets have been +reserved for over a year now. As far as I can tell, only one of +them has become real. Can we recycle some of them? + +Date: 1 November 1984 15:36-EST +From: Richard Mark Soley +Subject: HSTMIT/HOSTS change +To: INFO-HOSTS @ MIT-MC + +Added Lisp Machine Forest host MIT-JULGRAN (a Swedish tree) at CHAOS 15307. + +Date: 31 October 1984 19:24-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest host tables installed on MC. + +Date: 25 October 1984 14:20-EDT +From: Ramesh S. Patil +Subject: new host table generated +To: INFO-HOSTS @ MIT-MC + +The sysnet;hosts > and hstmit were edited but the xfile was not run when +I added LM-12 to subnet-6. I just ran the :xfile to make the change happen. + - ramesh + +Date: 22 October 1984 17:19-EDT +From: Richard Mark Soley +Subject: Latest host table change +To: INFO-HOSTS @ MIT-MC + +Added Pomegranate (new Lisp Machine Forest 3670). +Moved Oak, Flame, & Cherry to subnet 32. + + -- Richard + +Received: by mit-borax.ARPA (4.12/4.7) + id AA00770; Mon, 22 Oct 84 15:43:53 edt +Date: Mon, 22 Oct 84 15:43:53 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8410221943.AA00770@mit-borax.ARPA> +To: info-hosts@mc +Subject: mit-vax & mit-charmin + +I added an internet address to MIT-VAX (18.26.0.95) and a new host +called MIT-CHARMIN (18.26.0.1) which is a printer. + - John Romkey + +Date: 14 October 1984 20:43-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC +cc: dove @ MIT-BUGS-BUNNY + +Latest NIC host table installed on MC. +I removed the SYLVESTER nicknames from BUGS since they collide with +an ARPAnet machine's name (and choosing the name BUGS was to avoid +this collision). + +Date: 10 October 1984 14:00-EDT +From: Daniel Huttenlocher +To: INFO-HOSTS @ MIT-MC + +Added two 3670's SID-VICIOUS at chaos 13061 and DUANE-ALLMAN at chaos 13063. + +Date: Sun 7 Oct 84 16:20-EDT +From: Martin David Connor +Subject: 28 page host table too big? +To: bug-its@MIT-MC +CC: BUG-TCP@MIT-MC, INFO-HOSTS@MIT-MC + + +I fetched the latest NIC host table and installed it on MC, +and suddenly I couldn't get a DDT from OZ. I backed out, renaming it +to SYSBIN;HOSTS3 TOOBG?, and was then able to SUPDUP in and get a DDT without +it barfing and saying there was a PWORD bug. I bet the bug is it couldn't +map the host table. + +Anyway, someone should look at PWORD. + + +Date: Sun 7 Oct 84 15:19-EDT +From: Martin David Connor +Subject: Latest NIC host table +To: info-hosts@MIT-MC + + +I retrieved it, and diked a few obvious hosts. Someone (CSTACY) should +make a list of hosts that should have their nicknames diked, or make a +program that does the right thing. It would help a lot. + + +Date: 4 October 1984 18:05-EDT +From: Patrick G. Sobalvarro +To: INFO-HOSTS @ MIT-MC + +I generated new tables, moving MIT-HEPHAESTUS off subnet 6, to subnet 26. + +Date: 25 September 1984 17:43-EDT +From: Christopher C. Stacy +Subject: HOSTS3 +To: INFO-HOSTS @ MIT-MC +cc: BUG-TCP @ MIT-MC, BUG-ITS @ MIT-MC, KLH @ SRI-NIC, + MOON @ SCRC-TENEX + +The latest host table (including HSTNIC #384) is compiled and installed. +The HOSTS3 compiler is "fixed". + +HOSTS3 hackers: The compiler does not do the sort of dynamic memory +allocation I had assumed. I was therefore able to make some more room in +the ITS version simply by moving where in core the table was being +constructed. I didn't calculate how much room is left over for new code +or tables, but the increase should hold us for a while. Of course, we +are racing against the rate of host additions on the various networks in +our table (the Internet, the Chaosnet, etc.) Hopefully by the time we +run out it will be time to implement a hairy namespace system. +Won't that be fun! + +Date: 24 September 1984 13:07-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: BUG-TCP @ MIT-MC, INFO-HOSTS @ MIT-MC + +Well, I think we are finally out of address space. +New host tables cannot be compiled anymore because +they are too massive. People should not try to +compile any changes until I get back to you, +hopefully with a solution. + +Date: 14 September 1984 21:26-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table retrieved and installed. + +Date: 14 September 1984 21:03-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC, INFO-HOSTS @ MIT-MC + +The TCP; directory on MC is now called "SYSNET;". + +Date: 13 September 1984 02:54-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New NIC host table retrieved and installed. + +Date: Sat, 8 Sep 84 16:15 EDT +From: Scott Cyphers +Subject: kodiak, smokey +To: info-hosts@MIT-MC.ARPA + +I added the lisp machine hosts +MIT-KODIAK (15431) +MIT-SMOKEY (15432) +to MC:TCP;HOSTS and HSTMIT +and ran XFILE + +Date: 7 September 1984 21:10-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table retrieved; tables compiled and installed on MC. + +Date: Wed, 5 Sep 84 22:54 EDT +From: Chris Lindblad +Subject: Changes to mc:tcp;hosts > +To: Info-Hosts@MIT-MC.ARPA + +I removed all synonyms of MIT-DM for the host MIT-MC. + +Date: 3 September 1984 17:59-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table and other pending changes installed. +MIT-TWEETY is now in the Internet. + +Date: 2 September 1984 15:16-EDT +From: Martin David Connor +Subject: Updated HSTMIT and HOSTS +To: INFO-HOSTS @ MIT-MC + + +Rearranged AI Lab concentrators. Suggest all 20's build new tables +as soon as possible. Already done for OZ. + + +Received: by mit-borax.ARPA (4.12/4.7) + id AA07218; Thu, 30 Aug 84 13:14:56 edt +Date: Thu, 30 Aug 84 13:14:56 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8408301714.AA07218@mit-borax.ARPA> +To: info-hosts@mc +Subject: mit-mother + +Two changes to the entry for MIT-MOTHER in hstmit and hosts. I've +changed the address from LCS 32/42 to LCS 12/302 and I've commented it +out in both files until the NIC gets the new address right. + - John + +Date: Tue, 28 Aug 84 15:54 EDT +From: Webster Dove +Subject: adding bugs-bunny +To: info-hosts@MIT-MC.ARPA +Fcc: BUGS-BUNNY: /syla/dspg/dove/mbox + +In order to ease the transition for sylvester to a new name, the +nicknames "mit-bugs-bunny", "bugs-bunny" and "bugs" have been added to +the description of mit-sylvester in hosts and hstmit. + +Date: Tue, 28 Aug 84 12:24 EDT +From: Webster Dove +Subject: nicknema sylvester for mit-sylvester removed +To: info-hosts@MIT-MC.ARPA +Fcc: SYLVESTER: /syla/dspg/dove/mbox + +Removed from mc:tcp;hosts and hstmit to prevent conflict with +cu-sylvester in hstnic. + +Date: Wed 15 Aug 84 16:53:18-EDT +From: John Wroclawski +To: info-hosts@MIT-MC + +TCP;HOSTS 780 updates the entry for RUTGERS, which is completely +irrelevant unless you need to talk to this machine through a +CHAOS-ARPA Gateway. + +------- + +Date: 15 August 1984 14:43-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest host tables compiled and installed on MC. +Includes MIT-DM, a VAX (sigh). + +Date: Tue, 7 Aug 84 14:59 EDT +From: Cory Myers +Subject: additional address for mit-sylvester +To: info-hosts@MIT-MC.ARPA + +MIT-SYLVESTER now responds to chaos 016241 as well as its old address of +chaos 015421. It also serves as a chaos gateway between subnets 33 and +34 in parallel with MIT-SPEECH-11. + +Files mc:tcp; hstmit and mc:tcp;hosts have been updated to reflect this +change. + + +Received: by mit-charon (4.12/4.7) + id AA25342; Sun, 5 Aug 84 19:47:13 edt +From: jis@mit-charon (Jeff Schiller) +Date: 5 Aug 1984 1947-EDT (Sunday) +To: info-hosts@mit-mc +Subject: HSTMIT modified. + +To indicate that MIT-APHRODITE is now at ChaosNet address 42014. + + -Jeff + +Date: 4 August 1984 20:43-EDT +From: Robert P. Krajewski +Subject: PS... +To: INFO-HOSTS @ MIT-MC +cc: DARTH @ MIT-MC + +The version numbers of the files concerned are HSTMIT 258 and HOSTS 778. +We'll edit the namespace object when CADR15 decides to come up... + +Date: 4 August 1984 20:41-EDT +From: Robert P. Krajewski +Subject: Chaos Address for MIT-PI changed +To: INFO-HOSTS @ MIT-MC +cc: DARTH @ MIT-MC + +Old: 13010 (Subnet 26 (AI Ethernet), Host 010) +New: 15314 (Subnet 32 (LCS Ethernet), Host 314) + +Date: 3 August 1984 11:08-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC +cc: CRE @ MIT-MC, BEN @ MIT-MC, CJL @ MIT-OZ, DANIEL @ MIT-OZ, + MARTY @ MIT-OZ + +I installed the latest NIC table, and discovered a new name conflict: +someone else has a SYLVESTER, so I manually removed their nickname. + +People should be careful to remember that hosts whose entries appear +in multiple tables must match. I found several offending entries with +conflicting ARPAnet addresses between the HSTMIT and HSTNIC table, +conflicting host nicknames, and different machine types. If the +HOSTS3 compiler gets confused and thinks that different machines with +the same name are being talked about in different files, it will throw +away some or all of the information for those hosts. + +Mistakes (which I have corrected) in the HSTMIT table had +removed PREP and TINMAN from the Chaosnet! + +Also added SANCHO-PANZA (a 3d floor 3600) to the Chaosnet. + +Installed the tables on MC and ML. + +Chris + +Date: Thu, 26 Jul 84 09:16 EDT +From: "Christopher C. Stacy" +Subject: host tables +To: Info-Hosts@MIT-MC.ARPA + +The source for the host tables has moved from the SYSENG; +directory to the TCP; directory, which is a little less crowded. +Latest NIC table installed. + +Chris + +Date: Thu 12 Jul 84 16:28:34-EDT +From: GAB@xx +Subject: ne43-2a +Sender: GAB%MIT-OZ@MIT-MC.ARPA +To: info-hosts@MIT-MC +Reply-To: gab@xx + + I have changed the entries for ne43-2a in hosts and hstmit to include +its new subnet 6 address of 3162. +------- + +Date: 10 July 1984 17:23-EDT +From: Christopher C. Stacy +Subject: new host tables +To: INFO-HOSTS @ MIT-MC + +I installed the latest host tables on MC, including a new NIC table. + +Date: 29 June 1984 01:15-EDT +From: Christopher C. Stacy +Subject: latest host table installed +To: INFO-HOSTS @ MIT-MC +cc: BUG-MAIL @ MIT-MC, BUG-ITS @ MIT-MC, KLH @ SRI-NIC + +I have compiled and installed the latest host tables +on MC and ML. Things (such as the HOSTS3 compiler +and QMAIL) should be working now; please let me +know if anything blows up. + + +Date: Thu 28 Jun 84 19:59:34-EDT +From: Clifford Neuman +Subject: New addresses for MIT-EECS-11 and MIT-BYPASS +To: info-hosts@MIT-MC + +SYSENG; HSTMIT 243 and +SYSENG; HOSTS 767 + +Have been updated to include subnet 25 addresses for MIT-EECS-11 and +MIT-BYPASS. In addition to its old addresses, MIT-EECS-11 now resides +at chaos 12542, and MIT-BYPASS at 12530. + + ~ Cliff + +------- + +Date: 27 June 1984 12:13-EDT +From: Christopher C. Stacy +Subject: despite my previous warnings +To: INFO-HOSTS @ MIT-MC +cc: CSR @ MIT-MC + +Whoever installed the latest host tables on MC broke alot +of system programs. It was someone who uses the CSR directory. +Keep your fucking hands off, please. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA01059; Wed, 27 Jun 84 11:45:37 edt +Date: Wed, 27 Jun 84 11:45:37 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8406271545.AA01059@mit-borax.ARPA> +To: info-hosts@mc +Subject: host table change + +I added a chaosnet address for mit-coke. + - John + +Date: 23 June 1984 18:19-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +No one should compile new host tables on ITS until some +bugs in various system programs are worked out. +The most recent valid files are SYSBIN;HOSTS2 726 and HOSTS3 403. +The ones after that (HOSTS2 LATEST and HOSTS3 LATEST) correspond +to the most recently updated host table source files and required +modifications to the HOSTS3 compiler to produce. Sadly, they have +pushed the memory limits of assorted system programs and cannot +be installed yet. I'll send another message when things are +working again. + +Date: 23 June 1984 17:39-EDT +From: Christopher C. Stacy +Subject: Host name "Harvard" doesn't work right +To: INFO-HOSTS @ MIT-MC +cc: MRC @ SU-SCORE, bug-mailer @ MIT-OZ, bug-mm @ MIT-OZ, RMS @ MIT-OZ +In-reply-to: Msg of Sat 23 Jun 84 14:13:42-PDT from Mark Crispin + +I removed the nickname HARVARD from the MINITS machine (Harvard +Bridge?) at Symbolics, so that Harvard University can be called +"Harvard" and so many users would be less confused. + +Date: Mon 18 Jun 84 20:34:52-EDT +From: Clifford Neuman +Subject: Zarquon, Prak, Hactar, and Slartibartfast +To: INFO-HOSTS@MIT-MC + +The followiwng have been added to HSTMIT 239 and HOSTS 764: + +MIT-SLARTIBARTFAST Chaos 12422 +MIT-PRAK Chaos 12423 +MIT-ZARQUON Chaos 12424 +MIT-HACTAR Chaos 12425 + +These are the 4 client computers in the building 38 Athena Cluster. + +------- + +Date: Thu 14 Jun 84 11:13:23-EDT +From: Clifford Neuman +Subject: MIT-TRILLIAN +To: INFO-HOSTS@MIT-MC.ARPA +cc: Staff%MIT-EECS@MIT-XX.ARPA + +SYSENG; HSTMIT 238 + +and + +SYSENG; HOSTS 763 + +Add mit-trillian at chaos address 12421, a VAX-11/750 Running 4.2. +It is the first Athena machine running in building 38. +------- + +Date: 13 June 1984 14:48-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New NIC table installed. + +Date: Thu 7 Jun 84 03:19-EDT +From: Michael J. Konopik +Subject: you wanted this... +To: info-hosts@MIT-MC + + +I just changed HOSTS > and HSTMIT > to reflect the fact that HTJR (TINMAN) +still runs VMS. The claim that it runs UNIX was screwing up CFTP. + + -Mike + +Date: 6 June 1984 17:58-EDT +From: J. Noel Chiappa +Subject: Atari +To: INFO-HOSTS @ MIT-MC +cc: JNC @ MIT-MC + + Now that Atari Cambridge has gone belly up, should the Atari numbers +be recycled? Who is competent to know whether or nott these numbers are still +in use. + +Date: 6 June 1984 17:47-EDT +From: J. Noel Chiappa +Subject: Subnets assigned +To: INFO-HOSTS @ MIT-MC +cc: JNC @ MIT-MC + + Subnets 64 and 65 (octal) have been assigned to the MIT-Proteon +link and the main ring out at Natick respectively. I hope the fact that +they were marked as 'unused' in HSTMIT > means those numbers really were +unused. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA04901; Wed, 6 Jun 84 14:09:34 edt +Date: Wed, 6 Jun 84 14:09:34 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8406061809.AA04901@mit-borax.ARPA> +To: info-hosts@mc +Subject: Mother and Cub + +I removed two nicknames for MIT-MOTHER and added MIT-CUB to hstmit and +hosts. + - John + +Date: 2 Jun 1984 04:21 EDT (Sat) +Message-ID: +From: Martin David Connor +To: Info-Hosts@MIT-MC, OZ-HOSTS-HACKERS%MIT-OZ@MIT-MC.ARPA +Subject: New host tables + + +Well, being rather bored, I decided to teach myself to get new host +tables from the NIC and compile host tables on MC. + +I did the following things. I think they are right, but would +appreciate any suggestions for a better way: + + - Ran CSTACY;HOSTS to retrieve the lastest NIC table + + - Did :XFILE SYSENG;HOSTS XFILE to create the tables + + - Got the following cruft printed out: + +Nickname WARD for Internet site WASHINGTON is also a CHAOS host, ignored. +Nickname ROCKY for Internet site CU-ROBOTICS is also a CHAOS host, ignored. +Nickname MERLIN for Internet site PURDUE-MERLIN is also a CHAOS host, ignored. +Nickname LARRY for Internet site UW-BLUECHIP is also a CHAOS host, ignored. +Nickname FORD for Internet site FORD1 is also a CHAOS host, ignored. +Nickname EDDIE for Internet site UW-EDDIE is also a CHAOS host, ignored. +Nickname COYOTE for Internet site SU-COYOTE is also a CHAOS host, ignored. +Nickname ARTHUR for Internet site PURDUE is also a CHAOS host, ignored. + + - Went back in, and hand edited out the DUPS from the NIC table, + and wrote back out the table to the same version (349). + + - Compiled the table again, noticing that the NIC had now made + MIT-NEWTOWNE-VARIETY the primary name for MIT-FLA. Of course + HSTMIT still had MIT-FLA as the primary name, so HOSTS2 bitched. + + - Edited HSTMIT to make it consistent with HSTNIC. + + - Compiled the tables one last time. + +I wasn't sure if ALL the dup nicknames usually got edited out, but it +seemed like the right thing for local use. + +Anyway, if I did something wrong, someone can fix it, and please let +me know so I don't do it again. + + Marty + + +Date: Thu 31 May 84 18:03:14-EDT +From: Clifford Neuman +Subject: HoG and Franky-Mouse +To: info-hosts@MIT-MC + +The long awaited EE ether loop is now alive. + +HSTMIT 228 and HOSTS 758 have been changed. + +Franky-Mouse: Subnet 7 host 10 (3410) + Subnet 25 host 10 (12410) + +Heart-of-Gold: Subnet 25 host 42 (12442) + +------- + +Date: 27 May 1984 02:00-EDT +From: Jeffrey I. Schiller +To: INFO-HOSTS @ MIT-MC + +HSTMIT 225... Added MIT-ATHENA on the ChaosNet... + + -Jeff + +Date: 27 May 1984 01:57-EDT +From: Jeffrey I. Schiller +To: INFO-HOSTS @ MIT-MC + + + +Received: by mit-borax.ARPA (4.12/4.7) + id AA01763; Fri, 25 May 84 15:26:24 edt +Date: Fri, 25 May 84 15:26:24 edt +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8405251926.AA01763@mit-borax.ARPA> +To: info-hosts@mc +Subject: three changes + +Hi. I've added two hosts to the tables: MIT-BLUE-APOLLO and MIT-GOOFY. +I've also allocated a subnet (151) for some IP speaking Apollo machines +for Bob Iannucci. + - John + +Date: 25 May 1984 09:26-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table retrieved and compiled on MC. + +Received: from MIT-MC by MIT-OZ via Chaosnet; 22 May 84 16:48-EDT +Date: Tuesday, 22 May 1984, 16:45-EDT +From: Chris Lindblad +Subject: Change to MIT host table +To: info-hosts at MIT-OZ + +mc:syseng; hosts > and mc:syseng; hstmit > have been modified. +The operating system on MIT-HERMES has changed from VMS to UNIX. + +Date: 22 May 1984 03:42 EDT (Tue) +Message-ID: +From: Martin David Connor +To: INFO-HOSTS@MIT-MC +Cc: OZ-HOSTS-HACKERS%MIT-OZ@MIT-MC.ARPA +Subject: Slight frob to HSTMIT and HOSTS + + +In order to make HOSTS3 happy, I had to set the official name of +MIT-NEWTOWNE-VARIETY to MIT-FLA, since that's what it was in HSTNIC. + +If the NIC table ever gets the new apparent official name for FLA, +then it will be ok to change the MIT tables. + + +Received: from SCRC-PEACE by SCRC-YUKON via CHAOS with CHAOS-MAIL id 41801; Mon 21-May-84 12:25:41-EDT +Date: Mon, 21 May 84 12:25 EDT +From: Charles Hornig +Subject: HSTNIC 347 +To: info-hosts@MIT-MC.ARPA +Message-ID: <840521122524.2.HORNIG@PEACE.SCRC.Symbolics> + +I brought over the most recent NIC host table, but didn't recompile +HOSTS3 because I was worried at the apparent resurrection of MIT-AI +(running ITS on a KS10). If AI is really coming back, someone can go +ahead and install it. If it isn't, someone should tell the NIC. + +Date: Sat 19 May 84 19:22:16-EDT +From: John Wroclawski +To: info-hosts@MIT-MC + +HOSTS 747 and HSTMIT 213 modify XI, the XX net-11. Remove from SN6, add +to SN32 (15020), change OS to MINITS, remove nickname "NFE", whee. +------- + +Date: 17 May 1984 18:09-EDT +From: Christopher C. Stacy +Subject: MIT-AI +To: DPH @ MIT-MC +cc: INFO-HOSTS @ MIT-MC, TAFT @ MIT-MC, TK @ MIT-MC, AI-KL @ MIT-OZ, + GLR @ MIT-OZ +In-reply-to: Msg of 16 May 1984 19:52-EDT from Daniel Huttenlocher + +I have sent in the update which renames MIT-AI-RESERVED (on IMP 6) to +MIT-AI, and removes the "AI" nicknames from MIT-OZ (on IMP 77, but +this entry is commented out.) + +Date: 17 May 1984 15:24-EDT +From: Patrick G. Sobalvarro +To: INFO-HOSTS @ MIT-MC + +I added a new Chaos host on subnet 32, MIT-NE43-2B-HUB, and regenerated the +host tables on MC. + +Date: 16 May 1984 19:52-EDT +From: Daniel Huttenlocher +To: INFO-HOSTS @ MIT-MC + +I removed the aliases MIT-AI and AI from MIT-OZ in HOSTS > and HSTMIT >. +Somebody (read cstacy) might want to have the NIC remove it from OZ's +commented out entry in HSTNIC in the eventuality that oz ever makes it +on the arpanet... + +Date: 16 May 1984 17:33-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +No one should install a host table on MC without removing the +naming ambiguities for the names "MERLIN", "EDDIE", and "FORD". + +Date: 16 May 1984 16:12-EDT +From: Charles Hornig +Subject: new host table +To: INFO-HOSTS @ MIT-MC + +Latest NIC host table (346). + +Date: Tuesday, 15 May 1984, 03:27-EDT +From: Christopher C. Stacy +Subject: "PFC" +To: John G. Aspinall +Cc: INFO-HOSTS at MIT-MC +In-reply-to: The message of 9 May 84 16:00-EDT from John G. Aspinall + The message of 23 January 84 10:13-EST from + +Added nickname "PFC" to MIT-PFC-VAX in the source. + +Date: Thu 10 May 84 23:14:17-EDT +From: Robert H. Myhill +Subject: please take me off of this mailing lists +To: info-hosts@MIT-MC.ARPA + + +Could someone out there please take me off of the +info-hosts mailing list/ +Thanks. + +robert@xx +------- + +Date: 6 May 1984 23:34-EDT +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New host table installed, including latest NIC table. + +Date: Sat 5 May 84 18:25-EDT +From: Michael J. Konopik +Subject: +To: info-hosts@MIT-MC + +I just added MIT-DIOXIN to the host tables. It is CCC's new terminal +concentrator. Just thought you'd like to know... + + -Mike + +Date: 29 Apr 1984 17:56:58-EDT +From: walter at mit-htvax +To: info-hosts@mc +Subject: MIT-RTS + +Commented out MIT-RTS. + +Received: from SCRC-PEACE by SCRC-RIVERSIDE via CHAOS with CHAOS-MAIL id 10847; Mon 23-Apr-84 12:52:40-EST +Date: Mon, 23 Apr 84 12:47 EST +From: Charles Hornig +Subject: HSTSYM changes +To: info-hosts@MIT-MC.ARPA +Message-ID: <840423124752.5.Hornig@STONY-BROOK.SCRC.Symbolics> + +I moved the nickname SCRC from SCRC-TENEX to SCRC-STONY-BROOK. + +Date: 12 April 1984 08:11-EST +From: Charles Hornig +To: INFO-HOSTS @ MIT-MC + +Changed 128.31.x.x hosts to 18.20.x.x pending the NIC update. + +Date: 11 April 1984 18:46-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +New host table installed on MC. + +Date: 10 Apr 1984 07:42:57-EST +From: +To: info-hosts@mit-mc +Subject: Master host tables broken + +There are two problems in the current host tables. The guilty parties +will know who they are: + +[MC:SYSENG;HOSTS 737] is trivially broken by the mysterious addition +of a newline in the middle of MIT-MARVIN. + +[MC:SYSENG;HOSTS 737] lacks the most recent updates appearing in +[MC;SYSENG;HSTMIT 201]. Should not the MIT data in these files be +maintained in parallel? + +HEY! Let's be *careful* out there! + +Received: from SCRC-PEACE by SCRC-RIVERSIDE via CHAOS with CHAOS-MAIL id 9910; Tue 10-Apr-84 04:59:23-EST +Date: Tue, 10 Apr 84 05:03 EST +From: Charles Hornig +Subject: HOST changes +To: info-hosts@MIT-MC.ARPA +Message-ID: <840410050348.5.Hornig@STONY-BROOK.SCRC.Symbolics> + +I adjusted SCRC-RIVERSIDE's addresses to reflect the new gateway +situation and added the Athena machines which are now accessible. + +Date: 9 April 1984 21:39-EST +From: Richard E. Zippel +To: INFO-HOSTS @ MIT-MC + +Installed MIT-NU-0 thru MIT-NU-29 at their correct Chaos addresses. + +Date: 7 April 1984 19:40-EST +From: Richard E. Zippel +To: INFO-HOSTS @ MIT-MC + +I've added mit-nu0 through mit-nu29 now that they are on the net. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA03946; Thu, 5 Apr 84 22:45:23 est +Date: Thu, 5 Apr 84 22:45:23 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8404060345.AA03946@mit-borax.ARPA> +To: info-hosts@mc +Subject: fla & wild-blue-yonder & such +Cc: marty%oz@mc + +I've uncommented wild-blue-yonder, deleted fla's conflicting net +address and recompiled the host tables. + +I don't mean to harp on the point, but I'm sure that I fixed it when I +was updating the tables the first time. I am at least sure that I +editted hstmit > twice but there's only one copy before Marty's update +bearing my name at the top. So I think that the fixed version got lost +somewhere (is that sufficiently vague?). I am careful when I change the +tables! + - John + +Date: 5 Apr 1984 21:43 EST (Thu) +Message-ID: +From: Martin David Connor +To: INFO-HOSTS@MIT-MC +Cc: Romkey@MIT-BORAX.ARPA +Subject: MIT-WILD-BLUE-YONDER + + +This machine had the same address as MIT-FLA in HSTMIT. +This made it impossible to compile a new host table. +I commented it out until someone does it right. + +Marty + + +Received: by mit-borax.ARPA (4.12/4.7) + id AA01686; Thu, 5 Apr 84 16:21:28 est +Date: Thu, 5 Apr 84 16:21:28 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8404052121.AA01686@mit-borax.ARPA> +To: info-hosts@mc +Subject: additions to the host tables + +I just added MIT-WILD-BLUE-YONDER, MIT-BIG-BLUE, MIT-BLUE-LIGHT and +MIT-BLUE-DANUBE to the hstmit > and hosts >. I also had to delete the +subnet 26 address for MIT-FLA because MIT-WILD-BLUE-YONDER is really +just a name for the other interface on fla. It's all Bob Iannucci's +fault. + - John Romkey + +Date: 1 April 1984 22:01-EST +From: Daniel Huttenlocher +To: INFO-HOSTS @ MIT-MC + +HOSTS 731 and HSTMIT 191 add MIT-ASPEN and MIT-TELLURIDE, +3600's and comments out MIT_VAXLET which some twit put at +a conflicting address with SCRC-PEACE. + +Date: 30 March 1984 14:06-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC +cc: MOON @ SCRC-TENEX + +Would someone from Symbolics please correct their host +tables (remove duplicate-address entries)? The host +tables cannot be compiled in the current state. + +Date: Wed, 28 Mar 1984 19:55 EST +Message-ID: +From: Greg Skinner +To: Gail Zacharias +Cc: bug-mail@MIT-OZ, ee.mp@MIT-OZ, smh@MIT-EMS, STRAZ@MIT-OZ, info-hosts@MC +Subject: mailing to athena +In-reply-to: Msg of 28 Mar 1984 16:47-EST from Gail Zacharias + +There are a few easy ways out of this mess (some easier than +others). + +1. Somebody add mit-athena, and athena, as nicknames for charon, +unless there's some special reason why that shouldn't be done. + +2. Steve, if you were using MM, and did + +to: "mit-athena!tony"@mit-eddie, + +I believe MM would have converted it properly for MMAILR to use it. +(Is that so, Gail? If not, we have a serious problem here.) If you +didn't, you don't have to put quotes around the foreign address, +because the quotes are there so MM won't interpret the ! as a comment. +(Correct me again Gail if I'm wrong.) + +3. In general, you should try to find other means besides using UUCP +to send mail which you want delivered in a hurry. (It looked from the +message as if you expected it to get there immediately.) UUCP mail is +more than a magnitude of order slower than CHAOS mail, which means +that it probably would have taken a day or so for your message to get +to mit-athena (if it ever got there -- you'd be surprised at how often +UUCP mail gets lost). I don't see any reason why they are not +accepting chaos mail anyhow, seeing as they're on the chaosnet, that +sort of goes along with the territory. + +Date: 22 March 1984 00:47-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table installed. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA05041; Fri, 16 Mar 84 16:52:14 est +Date: Fri, 16 Mar 84 16:52:14 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8403162152.AA05041@mit-borax.ARPA> +To: info-hosts@mc +Subject: hstmit additions + +I added two hosts, MIT-GUANO (it's Steve Ward's fault!) and MIT-CJT, +both ibm pc's, to hstmit > and hosts >. + - John Romkey + +Date: Tue, 13 Mar 84 06:39 EST +From: "Christopher C. Stacy" +Subject: When is a pdp-10 not a pdp-10 +To: "David A. Moon" +Cc: BUG-FTP@MIT-MC.ARPA, GSB@MIT-MC.ARPA, KLOTZ@MIT-MC.ARPA, + Info-Hosts@MIT-MC.ARPA +In-reply-to: The message of 29 Feb 84 15:41-EST from David A. Moon + + Date: Wed, 29 Feb 84 15:41 EST + From: David A. Moon + ftp. Really, it's user-interface brain death. You see it used + to do-the-right-thing between pdp10s and now it doesn't. We expected + without thinking that it would. (I think that was it anyway; transfering + in ascii rather than 36bit). It's not like it lies or anythign, but + that the default used to be adequate for any file transfer, and who + really looks at spastic program printout anyway.... + Someone changed the machine type in the host table of all the pdp10s from + "PDP10" to imaginative things like "DEC-10", "DEC-1080". Thus FTP can no + longer tell when a machine is a pdp10. Probably this was imposed on us by + the NIC. Someone should give FTP a list of all the known pdp10 machines or + all the known pdp10 operating systems, replacing the present code in the + NHOSTN routine. + + Presumably this is an attempt to get us all to switch to Unix. + +I just changed FTP to think that things which run ITS, WAITS, TOPS10, +TOPS20, TENEX, and FOONEX are PDP-10s. + + From: Leigh L. Klotz + To: BUG-FTP @ MIT-MC + Why do I get + ASCII retrieve of

FILE.EXT.2 started. + twice whenever I use FTP to a twenex site? I haven't had occasion + to use it with any other type of site. + +I think I have also fixed this bug. + +Date: 9 March 1984 19:13-EST +From: Charles Frankston +Subject: Project Athena Vaxen & Large Chaos subnet numbers +To: INFO-HOSTS @ MIT-MC + +Two Project Athena Vaxen have been added to HSTMIT table as Chaos only +hosts. + +They are MIT-CHARON, Chaos address 042015 and MIT-APOLLO, Chaos address +042013. APOLLO is not actually on the chaos net yet, but probably will +be in time, along with another dozen or two Project Athena machines. + +Some of you may have noticed that these machines are on Chaos subnet +104o. This subnet is 11d higher than any previously active subnet on the +MIT-Chaos net. This is due to various places which have reserved subnets +not yet operational or connected to the main MIT Chaos net. + +This subnet is not reachable by a large number of Chaosnet hosts due to +their routing tables being too small. I have fixed the bridges +MIT-INFINITE and MIT-BYPASS, which merely needed recompiling. However, +there are other bridges and hosts that should have their routing tables +enlarged. In partcular the front end 11 for every 20 on campus, MIT-VAX +and I imagine many other Unix hosts. + +Note that Chaos subnet 104o=68d, whereas the Athena machines all think +they are on Internet subnet 18.58.xx.xx. I understand that there was once +an attempt to maintain a correspondence between MIT internet subnet and +Chaos subnet numbers. Apparently Project Athena was originally assigned a +set of subnets starting at 58d, but when these were claimed by groups, no +one bothered informing the Athena staff. This doesn't represent any +problem yet, if it ever will, as there is no Internet link from the Athena +machines to the rest of the Internet. + +I would also make a plea that if people increase their routing table sizes +they go straight to 122d (172o). This is the number of subnet entries +that will fit in the maximum size routing packet. It's real hard to +figure out that no one can talk to your subnet because your routing +packets are being ignored. + +Date: 6 March 1984 21:44-EST +From: Daniel Huttenlocher +To: INFO-HOSTS @ MIT-MC + +Installed MIT-GOLDILOCKS a 3600 at chaos address 15470. + +Date: 6 March 1984 03:34-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table installed on MC. + +Received: from SCRC-MERRIMACK by SCRC-RIVERSIDE via CHAOS with CHAOS-MAIL id 8509; Mon 5-Mar-84 08:30:35-EST +Date: Monday, 5 March 1984, 08:36-EST +From: Charles Hornig +Subject: SYMBOLICS-3600 +To: "David C. Plummer" +cc: LispM-Networks%SCRC-TENEX@MIT-ML.ARPA, info-hosts@MIT-MC.ARPA +In-Reply-To: The message of 25 Feb 84 15:07-EST from David C. Plummer +Message-ID: <840305083652.1.Hornig@QUABBIN.SCRC.Symbolics> + + Date: 25 February 1984 15:07-EST + From: David C. Plummer + + Date: 25 February 1984 14:59-EST + From: David C. Plummer + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + + Charlie, what's the story here? + + (The rest of you, don't expect an answer very soon, he's on + vacation for another week or so.) + + Ignore me. I should have read all my mail first. + + Date: 24 February 1984 20:33-EST + From: Ken Harrenstien + To: CSTACY @ MIT-MC + cc: INFO-HOSTS @ MIT-MC + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + + SYMBOLICS-3600 is the way SCRC wanted their hosts listed. I guess + that is the new convention... + +When I first had SCRC-Peace added to the NIC host table, I told them +that it was a Symbolics 3600. They assigned the machine type +"SYMBOLICS-3600" to it. I followed their lead from then on. + +Date: 3 March 1984 13:16-EST +From: Daniel J. Carnese +To: INFO-HOSTS @ MIT-MC + +MIT-LCS-HQ is now at LCS 12/200. + +Date: Thu 1 Mar 84 15:42:02-EST +From: John Wroclawski +To: info-hosts@MIT-MC +cc: smh%MIT-EDDIE@MIT-MC.ARPA + + +HOSTS 724 and HSTMIT 170 add Chaos sites MIT-EMS (6401), MIT-HAYDN (6402), +and MIT-WAIF (6420). Additionally, MIT-INFINITE (bldg 8 bridge) has grown +a new address 6410. + +Subnet vultures will note that this constitutes the (re)activation of +subnet 15 as part of the Big Picture. + +------- + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN with CHAOS; Wed 29-Feb-84 15:42:10-EST +Date: Wed, 29 Feb 84 15:41 EST +From: "David A. Moon" +Subject: When is a pdp-10 not a pdp-10 +To: bug-ftp@MIT-MC.ARPA +Cc: gsb@MIT-MC.ARPA, info-hosts@MIT-MC.ARPA + + ftp. Really, it's user-interface brain death. You see it used + to do-the-right-thing between pdp10s and now it doesn't. We expected + without thinking that it would. (I think that was it anyway; transfering + in ascii rather than 36bit). It's not like it lies or anythign, but + that the default used to be adequate for any file transfer, and who + really looks at spastic program printout anyway.... +Someone changed the machine type in the host table of all the pdp10s from +"PDP10" to imaginative things like "DEC-10", "DEC-1080". Thus FTP can no +longer tell when a machine is a pdp10. Probably this was imposed on us by +the NIC. Someone should give FTP a list of all the known pdp10 machines or +all the known pdp10 operating systems, replacing the present code in the +NHOSTN routine. + +Presumably this is an attempt to get us all to switch to Unix. + +Date: Sun 26 Feb 84 22:28:29-EST +From: John T. Wroclawski +To: info-hosts@MIT-MC.ARPA, bcn%MIT-EECS@MIT-XX.ARPA + + +HOSTS 723 and HSTMIT 169 add MIT-MATH-HUB at chaos 7740 (SN17, 340), +a MINITS box out at the end of Bldg 2. + +It appears there is life out there after all. +------- + +Date: 25 February 1984 15:07-EST +From: David C. Plummer +To: DCP @ MIT-MC +cc: INFO-HOSTS @ MIT-MC, Hornig @ SCRC-TENEX, + LispM-Networks @ SCRC-TENEX + + Date: 25 February 1984 14:59-EST + From: David C. Plummer + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + + Charlie, what's the story here? + + (The rest of you, don't expect an answer very soon, he's on + vacation for another week or so.) + +Ignore me. I should have read all my mail first. + + Date: 24 February 1984 20:33-EST + From: Ken Harrenstien + To: CSTACY @ MIT-MC + cc: INFO-HOSTS @ MIT-MC + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + + SYMBOLICS-3600 is the way SCRC wanted their hosts listed. I guess + that is the new convention... + +Date: 25 February 1984 14:59-EST +From: David C. Plummer +To: Hornig @ SCRC-TENEX +cc: INFO-HOSTS @ MIT-MC, LispM-Networks @ SCRC-TENEX + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + +Charlie, what's the story here? + +(The rest of you, don't expect an answer very soon, he's on +vacation for another week or so.) + +Date: 24 February 1984 20:33-EST +From: Ken Harrenstien +To: CSTACY @ MIT-MC +cc: INFO-HOSTS @ MIT-MC + + Date: 24 February 1984 18:08-EST + From: Christopher C. Stacy + + + The NIC seems to be putting CPU types of "SYMBOLICS-3600" + on things, while our local tables say "3600". This makes + the HOSTS3 compiler print silly warnings, so I edited the + HSTNIC file to use the "3600" convention. Someone should + decide which they would rather see, and get everyone to use it. + +SYMBOLICS-3600 is the way SCRC wanted their hosts listed. I guess +that is the new convention... + +Date: 24 February 1984 18:08-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + + +The NIC seems to be putting CPU types of "SYMBOLICS-3600" +on things, while our local tables say "3600". This makes +the HOSTS3 compiler print silly warnings, so I edited the +HSTNIC file to use the "3600" convention. Someone should +decide which they would rather see, and get everyone to use it. + +Date: 21 February 1984 04:07-EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC table installed on MC and ML. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA03676; Sun, 12 Feb 84 00:35:01 est +Date: Sun, 12 Feb 84 00:35:01 est +From: romkey@mit-borax (John L. Romkey) +Message-Id: <8402120535.AA03676@mit-borax.ARPA> +To: info-hosts@mit-mc +Subject: additions to hstmit + +Well, addition. I added mit-pluto, another ibm pc. I also changed the +host type for mit-borax from vax to vax-11/750 so that lisp machines +wouldn't complain that it was different from the type in the nic name +table. + - John Romkey + romkey@mit-borax + +Date: Fri, 10 Feb 1984 23:21 EST +Message-ID: +From: CJL%MIT-OZ@MIT-MC.ARPA +To: INFO-HOSTS@MIT-MC + +I have changes mc:syseng;hstmit > and mc:syseng;hosts > : + +Chaosnet host MIT-PREP now is at Chaosnet addresses 13016 and 3413. + + +Date: 8 February 1984 18:31 EST +From: Patrick A O'Donnell +To: INFO-HOSTS @ MIT-MC + +Added MIT-COUGAR at CHAOS 3033. Did not compile. + +Date: 8 February 1984 15:24 EST +From: Richard Mark Soley +Subject: MAHOGANY +To: INFO-HOSTS @ MIT-MC + +Added MIT-MAHOGANY (HO) to the Lisp Machine Forest. +Moved MIT-NETLEAF-HACKBERRY to subnet 26.. + + -- Richard + +Date: 2 February 1984 01:32 EST +From: Christopher C. Stacy +To: INFO-HOSTS @ MIT-MC + +Latest NIC host table installed on MC and ML. + +Date: 23 Jan 1984 15:41:04-EST +From: roger at mit-dspg +To: CStacy@mit-mc, INFO-HOSTS@mit-mc +Subject: Re: new host table available + +I and Sylvester wish to invite all to share in a quick dance of hosannas +upon becoming an official member of the community. I thought +after I sent my note that it was not all that coherent as to what +it was requesting; I am most impressed at how much you have managed +to draw out of it. Several of us would beg to differ, however, on +the spelling of PUDDYTAT, and would ask to include this one as +a further nickname. Many many thanks regardless! + + roger@dspg + +Date: 23 Jan 1984 15:41:04-EST +From: roger at mit-dspg +To: CStacy@mit-mc, INFO-HOSTS@mit-mc +Subject: Re: new host table available + +I and Sylvester wish to invite all to share in a quick dance of hosannas +upon becoming an official member of the community. I thought +after I sent my note that it was not all that coherent as to what +it was requesting; I am most impressed at how much you have managed +to draw out of it. Several of us would beg to differ, however, on +the spelling of PUDDYTAT, and would ask to include this one as +a further nickname. Many many thanks regardless! + + roger@dspg + +Date: 23 January 1984 15:50 EST +From: Christopher C. Stacy +Subject: sufferin' succotash +To: INFO-HOSTS @ MIT-MC, roger @ MIT-DSPG + +I corrected the spelling of PUDDYTAT on the source. + +Date: Monday, 23 January 1984, 13:32-EST +From: Christopher C. Stacy +Subject: "PFC" +To: John G. Aspinall +Cc: INFO-HOSTS at MIT-MC +In-reply-to: The message of 23 Jan 84 10:13-EST from John G. Aspinall + + Date: 23 January 1984 10:13 EST + From: John G. Aspinall + Could I petition for the nickname "PFC" to be changed to apply to + MIT-PFC-VAX (a server) and not MIT-FUSION (a terminal concentrator). + +I removed the "PFC" and "PFC-11" nicknames from the PLASMA concentrator, +in the source. Will take effect next time there is a significant update. + +Date: Monday, 23 January 1984, 13:06-EST +From: Christopher C. Stacy +Subject: new host table available +To: INFO-HOSTS at MIT-MC +Cc: roger at mit-dspg, dove at mit-dspg, root at PUTTYTAT +In-reply-to: The message of 12 Jan 84 09:24-EST from roger at mit-dspg + +I added MIT-SYLVESTER, a DSPG VAX running Unix at 15421 on the Chaosnet. +Has nicknames SYLVESTER, PUTTYTAT, and SYL. Updated host tables on MC +and ML (someone should copy them to OZ and XX, etc.) + +Chris + +Date: 18 January 1984 10:53 EST +From: Charles Hornig +To: INFO-HOSTS @ MIT-MC + +Copied NIC:HOSTS.TXT.325 to MC and recompiled tables. + +Date: 10 Jan 1984 18:04:41-PST +From: romkey@MIT-BORAX +Real-name: John L. Romkey +To: info-hosts@mc +Subject: name table additions + +I added two hosts, MIT-PEPSI and MIT-SELTZER, to hstmit on mc. + - John + +Date: 9 Jan 1984 21:52:52-PST +From: romkey@MIT-BORAX +Real-name: John L. Romkey +To: info-hosts@mc +Subject: added two hosts + +Hi, + I added two hosts (MIT-COKE and MIT-DR-PEPPER, two Now machines) to +the host tables. + - John + +Received: from SCRC-CHARLES by SCRC-QUABBIN with CHAOS; Wed 4-Jan-84 20:29:22-EST +Date: Wed, 4 Jan 84 20:33 EST +From: "David C. Plummer" +Subject: Some machines really do care what garbage gets put in databases... +To: Hostmaster@SRI-NIC.ARPA +Cc: LispM-Networks%SCRC-TENEX@MIT-MC.ARPA, Info-hosts@MIT-MC.ARPA, + lwa@MIT-XX.ARPA +In-reply-to: The message of 31 Dec 83 17:46-EST from David C. Plummer , + The message of 4 Jan 84 17:15-EST from lwa at MIT-CSR + +Please remove the TCP/SUPDUP service entry from MIT-BORAX; BORAX does +not currently (and has never to my knowledge) had a SUPDUP server. + diff --git a/sysdoc/infits.mlist b/sysdoc/infits.mlist new file mode 100644 index 0000000..c361863 --- /dev/null +++ b/sysdoc/infits.mlist @@ -0,0 +1,57 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +BUG-ITS ;Forwards, so no need to be on both +ALAN +AS +bandy +BARMAR +BillW@SRI-KL +BJN +BUDD +CCH +CLR +CWH +DanG +delatz +DUFTY +EAKX +EGK +FJW +GEOFF +GMPX +GRUPP +JCMA +JRLK +JSOL +MACRAK +MHS +MRC +MT +PAO-JUNK@EE +PHILIP +RKJ +RLL +rob@oz +RVB +RWK +SOLEY +sundar +SWG +TAA +TAFT +[SYSDOC;ITS RECENT] diff --git a/sysdoc/intrup.107 b/sysdoc/intrup.107 new file mode 100644 index 0000000..c498e3b --- /dev/null +++ b/sysdoc/intrup.107 @@ -0,0 +1,576 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Overview of ITS User Interrupts + +When ITS wishes to signal a user program of the existence of an +unusual interesting condition or occurrence, it does so via +the "user interrupt" mechanism. This mechanism essentially +causes the user program to call an interrupt handling subroutine +in the middle of what it had been doing. The interrupt handler has +enough information to be able to return to the interrupted code +without any effects on it if desired, and to determine the cause +of the interrupt so as to take appropriate action. The program +can specify which interrupt conditions it wishes to handle, and +what their priority order should be; un-handled interrupts are +either ignored or fatal depending on the condition. Some interrupt +conditions represent errors in the execution of the job; some +indicate the occurrence of asynchronous events such as I/O operation +completion; some exist for debugging and are always fatal. + +The noun "interrupt" may mean either the event of interrupting +a program (causing it to call the handler), or a condition which +can cause a program to be interrupted. Also, the distinction +between an interrupt condition and the bit which is 1 when the +condition is present is often blurred. + +Unlike TENEX, ITS never gives the user an interrupt "in the middle +of a system call". The PC saved by an interrupt is always a user-mode PC. +This is a great advantage when it comes to having the interrupt handler +understand what the interrupted code was doing and fix it up. +System calls will either be finished or backed out of (to be redone) +when it is necessary for the job to be interrupted. To avoid having to +do a lot of work twice, all ITS system calls that take a long time to +complete are designed so that if restarted they will continue from +where they left off. They do this by updating their arguments to +indicate how much progress they have made, just like the BLT instruction. +Now you know why SIOT and block-mode IOT update their pointer and +byte count as they go. + +Section A describes how interrupts are signaled and enabled, etc. +Section B describes what is actually done to a job when it is + interrupted, if it uses the older simple interrupt mechanism. +Section C gives an example of an old-style interrupt handler. +Section D describes what is actually done to a job when it is + interrupted, if it uses the newer vectored interrupt mechanism. +Section E describes the individual interrupt conditions in the + first interrupt request word (.PIRQC). +Section F describes the individual interrupt conditions in the + second interrupt request word (.IFPIR). + +A. The ITS Interrupt Mechanism + +Each ITS job has two "interrupt request words", called .PIRQC +and .IFPIR, and readable with .SUSET. Each distinct interrupt +condition is assigned one of the bits in one of the words. +The interrupt is "pending" when the bit is 1. +.PIRQC is called the "first interrupt word" and interrupts in it +are "first word interrupts". .IFPIR is the "second interrupt word" +and its interrupts are "second word interrupts". + +Interrupt conditions are divided by the system into three severity classes. +Class 1 interrupts are always fatal. They are genarally conditions caused +by the user or the superior, for debugging purposes; for example, +breakpoints, ^Z typed, and single-instruction-proceed interrupts are +of class 1. Class 2 interrupts are fatal unless the program is set up +to handle the interrupt. Most error conditions are class 2; for example, +MPV (memory protect violation), ILOPR (illegal operation), IOCERR +(I/O channel error). All class 1 and 2 interrupts are first word +interrupts. Class 3 interrupts are never fatal unless the user +explicitly makes them so; either the program is eventually interrupted +or nothing happens. Most asynchronous conditions are class 3. + +When a job receives a fatal interrupt, that job is not interrupted +itself; instead, it is stopped, as if its superior had stopped it, +and an "inferior got a fatal interrupt" interrupt is signaled for the +superior. If a top level job receives a fatal interrupt, then it will +be stopped and detached (see the symbolic system call DETACH). + +Each interrupt word has a corresponding mask word: .MASK for .PIRQC, +and .MSK2 for .IFPIR. An interrupt is enabled if the appropriate bit in +the mask word is 1. A program will not receive an interrupt which is +disabled, but if the interrupt condition is in class 2 it +will be fatal if it is not enabled. Class 3 interrupts will not even +be signaled if they are disabled. Class 1 interrupts are not allowed +to be enabled, the idea being that the job which gets an always-fatal +interrupt is not allowed to handle the interrupt itself. + +Each interrupt word also has a defer word: .DF1 for .PIRQC, and +.DF2 for .IFPIR. If the appropriate bit in the defer word is set, +the interrupt is "deferred". For a class 2 interrupt, deferment has +the same effect as disablement: the interrupt becomes fatal. +For a class 1 interrupt, deferment has no effect. For a class 3 +interrupt, deferment differs from disablement in that a deferred +interrupt will still be signaled; it will then remain pending until +it is no longer deferred, when it will be given to the user. +The system makes it easy to defer a specified set of interrupts while +processing an interrupt. That is how different priorities of +interrupts may exist. + +Slightly obsolete but still useful is the variable .PICLR, which is +normally -1. If this variable is set to 0, all interrupts are deferred. +The actual values of the defer words are unaltered. .PICLR was +the original way to defer interrupts, before the defer words existed. +The older style of interrupt handling on ITS sets .PICLR to 0 while +an interrupt is being processed; thus, there is only one interrupt +priority level. + +To help eliminate timing errors, the six variables .PIRQC, .IFPIR, +.MASK, .MSK2, .DF1 and .DF2 have aliases which have the same value +when read, but when written either IORM or ANDCAM into the variable +instead of setting all the bits in it. These aliases are called +.IPIRQC, .IIFPIR, .IMASK, .IMSK2, .IDF1 and .IDF2 for IORM'ing, +and .APIRQC, .AIFPIR, .AMASK, .AMSK2, .ADF1 and .ADF2 for ANDCAM'ing. +Thus, depositing 20 in .APIRQC will clear the 20 bit in .PIRQC. + +Error-condition interrupts (MPV, ILOPR, IOCERR, WIRO, DTTY and some others) +usually abort the instruction that causes them. When this happens, +the old convention (still the default) is to leave the PC pointing +AFTER the aborted instruction. This is very bad since it is hard +for the user's interrupt handler to tell whether to decrement the PC. +The new convention, selected by setting bit %OPOPC in the LH of the +.OPTION variable to 1, is for the system to decrement the PC when +a fatal interrupt happens, so that if the interrupt handler fixes +the problem (e.g. creates the nonexistent page of core) and dismisses, +the instruction will be retried. All new programs should use the +new convention; it would be nice to flush the old one entirely. + +B. How Jobs Are Informed about Their Interrupts (Old Style) + +There are two ways for a program to receive interrupts from the +system: the old way, and the new way. The old scheme always stores +the PC in the same place, making recursive interrupts difficult. +It also makes all interrupts have the same priority level. +The new scheme pushes the interrupt information on a stack. It also +has the ability to decode the interrupts for the user, whereas with the +old mechanism the program must decode the interrupts. Nevertheless, +the old mechanism is not considered obsolete, since it is easier to use. + +Both mechanisms have the user's interrupt handler information pointed +to by location 42. More generally, the address of the interrupt pointer +is 2 plus the rh of the .40ADDR variable; since .40ADDR usually holds +40, the interrupt pointer usually lives in 42. + +The two mechanisms are selected by the %OPINT bit of the .OPTION +variable: the new mode is used if the bit is 1. + +In the old mode, 42 is expected to contain the address of the +interrupt handler itself. Let that address be called "TSINT" +(every program should use that label, for the sake of humans). +If TSINT is 0, or addresses nonexistent or pure storage, +when the system attempts to interrupt the job, an always-fatal +BADPI (%PIB42) interrupt is signaled and the program does not +receive the original interrupts. If the superior, handling the BADPI, +fixes up 42 and restarts the job, it will then be properly interrupted. + +When an interrupt happens, all the +pending enabled undeferred first word interrupts will be given to +the user at once if there are any; otherwise, all the pending +enabled undeferred second word interrupts will be given. The +interrupts which are given will be cleared in the request word. +Whichever interrupt request word is being given will be stored in TSINT. +If the interrupts being handled are second-word interrupts, the sign +of TSINT will be set. The PC is stored in TSINT+1. The job is then +started at TSINT+2, with all PC flags except user and user-i/o zeroed. +The job's .PICLR will be set to 0, preventing further interrupts while +the interrupt handler is running. Because more than one interrupt +may be given to the user at once, the interrupt routine should check +all of the interrupt bits, and after handling one interrupt should +return to check the remaining bits. + +The normal way for the interrupt handler +to exit is with the .DISMIS uuo, which should address a word containing +the desired new PC. .DISMIS jumps to that PC, restoring flags, and also +sets .PICLR to -1 to allow interrupts again. To restart the program +where it was interrupted, .DISMIS TSINT+1 should be used. The program +may desire to restore the saved PC flags but a different PC; in that +case, it should probably clear the byte-interrupt flag (%PCFPD) before +restoring the flags. + +C. An Example of an Old Style Interrupt Handler + +TSINT: +LOC 42 + TSINT ;this is the interrupt pointer. -> int handler. +LOC TSINT + 0 ;first word of handler gets the bits for the interrupts + 0 ;second gets the PC + EXCH A,TSINT + JUMPL A,TSINT2 ;sign of int word set => second word interrupts; + TLNE A,%PJRLT ;otherwise, they are first word interrupts. + PUSHJ P,TIMINT ;if we got an alarm clock int, handle that. + TRNE A,%PIMPV + PUSHJ P,MPVINT ;if we got an MPV, handle that. + TRNE A,%PIIOC + PUSHJ P,IOCINT ;if we got an IOCERR, handle that. +TSINTX: EXCH A,TSINT + .DISMIS TSINT+1 ;then restore the saved PC and zero .PICLR. + +TSINT2: TRNE A,1_TYIC + PUSHJ P,INPUTI ;handle characters typed on the tty (assuming + ;that tty input is open on channel TYIC) + TDNE A,INFBIT + PUSHJ P,INFINT ;handle interrupts from one of our inferiors, + ;assuming the inferior's .INTB variable was + ;read into INFBIT. + JRST TSINTX + +;if the program can't recover from MPV's well, it might do this: +MPVINT: + .DISMIS [RESTART] ;re-initialize the program. + +;if it wanted to create the referenced page, it might do this: +MPVINT: PUSH P,B + .SUSET [.RMPVA,,B] + LSH B,-10. ;get the referenced page's number. + .CALL [ SETZ ? 'CORBLK + MOVEI 400000 ? MOVEI -1 ? B ? SETZI 400001] + .VALUE ; ^ get a fresh page into page w/ number in B. + POP P,B + POPJ P, + +D. How Jobs Are Informed about Their Interrupts (New Style) + +When using the newer interrupt mechanism, the program must divide +the interrupts that it handles into some number of groups (there +may be as few as one interrupt in a group, or all the interrupts +may be in one group). The interrupts in a group are all handled +the same way; they have the same relative priority to all other +interrupts, and have the same handler address. For each group, +the user must specify to the system which interrupts are in it, +which interrupts are considered to have a lower priority than +those in the group, and where the handler for the group is located. +This is done with the "interrupt table", which should be 5n+1 words +long where n is the number of groups. The interrupt table should +be identified to the system by means of an AOBJN pointer in 42. + +The first word of the interrupt table should hold the address +of the interrupt stack (which may be an accumulator - P will work!). +The LH of this word specifies extra information to be pushed on +the interrupt stack at each interrupt, beyond the necessary minimum: + bits 3.5-3.1 # of ACs to push. 0 => don't push any ACs. + bits 3.7-4.1 # of first AC to push. + bit 4.9 1 => push the .JPC and .SUUOH variables, and the LSPCL + (an internal ITS variable), after the ACs if any. + +Then come five words for each interrupt group. Their meanings are: + wd 1 The 1st word interrupts that are in this group. + If a bit is set in this word, the corresponding interrupt is + in this group. + wd 2 The 2nd word interrupts which are in this group. + wd 3 The 1st word interrupts that are of priority less than or equal to + this group's. Give the bits for the appropriate interrupts. + When interrupts in this group happen, these bits will be + set in .DF1 to prevent the lower-priority interrupts from + happening. Note that it is not obligatory to include the + interrupts of the group itself in this word; if they are not + included, they will be able to interrupt recursively. That is + sometimes desirable for recoverable synchronous conditions. + wd 4 The 2nd word interrupts that are ofthe same or lower priority. + wd 5 The address of the handler for this group. + +Note that the priority-relation between interrupts, specified by the +second and third words of the groups in the interrupt table, need not +be even a partial order: it is permissible for interrupt A to defer +only B, B to defer only C, and C to defer only A, although not very +useful. Often, a synchronous interrupt is left incomparable with all +other interrupts - it defers only itself, or nothing. + +Synchronous interrupts should come before asynchronous ones +in the table. The only time an exception to that is safe is when +the asynchronous interrupt defers the synchronous one. The reason for +this rule is that when a synchronous interrupt and an asynchronous one +are signalled at the same time, if the asynchronous interrupt comes +earlier in the table it will happen first; if the synchronous one is +not then deferred, it will interrupt saving a PC pointing at the first +word of the asynchronous interrupt's handler - which is not the address +of the instruction that actually caused the synchronous interrupt. If +the synchronous interrupt's handler looks at the PC, as many do, it will +be confused. + +This is an example of an interrupt table (taken from DDT). + +TSINT: LOC 42 + -TSINTL,,TSINT +LOC TSINT + + P ;interrupt pdl pointer address. + %PIWRO ? 0 ? 0 ? 0 ? PURBR1 + ;pure-page violations don't inhibit anything. + ;DDT wants to type out ":UNPURE", and doesn't + ;like to type out with any interrupts inhibited. + %PITTY ? 0 ? %PITTY ? 0 ? TTYINT + ;Don't-have-tty interrupts defer themselves + ;so that they become fatal while one is being + ;processed. If DDT decides that the one + ;that happened should have been fatal, it + ;signals another by depositing in .IPIRQC, and + ;that one IS fatal since it is deferred. + %PIIOC\%PIILO\%PIMPV\%PIOOB ? 0 ? #%PITTY ? -1 ? TSIN0 + ;Error interrupts inhibit asynchronous ints for + ;safety's sake, and themselves so an error in + ;the handler will be fatal. + #%PIIOC#%PIILO#%PIMPV#%PIOOB#%PIWRO#%PICLI#%PITTY ? #<1_TYOC>#1_TYOBC + #%PIIOC#%PIILO#%PIMPV#%PIOOB#%PIWRO#%PICLI#%PITTY ? -1 ? TSIN0 + ;Miscellaneous interrupts have the same handler + ;as the errors - for historical reasons - but + ;don't defer the errors, so that DDT can recover + ;if an error happens in a miscellaneous int. + 0 ? 1_TYOC+1_TYOBC ? 0 ? 0 ? MORINT + ;Bottom-of-screen-on-terminal interrupts defer nothing, + ;so they can exit by simply jumping if they wish. + %PICLI ? 0 ? %PICLI ? 0 ? CLIBRK + ;Core-link interrupts (someone is :SEND'ing to me). +TSINTL==.-TSINT + +The algorithm for giving a set of interrupts is: +Look through the interrupt block one group at a time. +If a group is found that applies to any of the interupts that +are to be given, all the interrupts that it applies to and that are +to be given are pushed, together, onto the interrupt stack +at once. The words pushed are: + First, two words containing the interrupts being pushed. + Next, two words containing the old settings of .DF1 and .DF2. + Next, a word containing the PC before the interrupt. + Last, any AC's or debugging variables specified by the LH of + the first word of the interrupt table. +If pdl overflow is enabled, it will be detected properly when the +interrupt data is pushed. +After the necessary information has been saved and the interrupt pdl +updated, the defer words and the PC will be set as specified +in the the interrupt table. +At this point, if there still remain any pending enabled undeferred +interrupts, the whole process is repeated, scanning through all the +groups from the beginning. Note that giving one interrupt may cause +other previously undeferred interrupts to be deferred. It may also +set the pdl overflow interrupt, in which case that interrupt will +be given immediately if not deferred. + +If there are pending enabled undeferred interrupts not included +in any group, and they do not become deferred by the giving of other +interrupts, then they are considered immediately fatal. Thus, the +user can make a nonfatal interrupt be fatal by enabling it but not +including it in any group. + +The interrupt routine may conveniently +exit with the DISMIS Symbolic System Call. +The first arg, if not immediate, should point at the interrupt stack: + .CALL [SETZ ? 'DISMIS ? SETZ P] +The defer words and PC will be restored from the top 3 +words on the stack and 5 words will be popped. Stack overflow +will be detected. You may specify that extra things should be popped +using the control bit argument; bit 2.9 specifies that three words +should be discarded, while *100+ specifies that ACs through ++-1 should be popped. Thus, it is a win to give, as the control +bit argument (in the RH) whatever was put in the LH of the first word +of the interrupt table - that will cause the DISMIS to pop exactly +what interrupts push. + +If the first arg is immediate, clearly nothing can be popped: + .CALL [SETZ ? 'DISMIS ? SETZI 2+[DF1 ? DF2 ? PC] ] +In this case the control-bit argument is ignored. +If a second argument is given, it is used as the new PC +instead of what is found on the interrupt stack. +Similarly, optional third and fourth arguments specify the new +contents of the defer words, overriding what was saved on the stack. +Thus, if four arguments are given and the first is immediate, +the first argument is effectively ignored. + +E. The Interrupt Bits in the First Interrupt Word. + +The interrupt classes are: + [1] stops job and interrupts superior (fatal intr) + [2] stops job and interrupts superior unless enabled and undeferred + [3] does nothing unless enabled; waits if deferred. +Bits in the lh have two names: %PI... as a bit in the word, + and %PJ... shifted down by 18. bits. + +The following interrupts abort the instruction, and leave the PC pointing +before the instruction if %OPOPC is 1 (as is winning), or after it if +%OPOPC is 0: %PIMPV, %PIOOB, %PIIOC, %PIILO, %PJTTY, %PJWRO, %PJFET, %PJTRP. + +"(S)" indicates a synchronous interrupt; "(A)", an asynchronous one. +An interrupt is synchronous if its occurrence is always directly related +to the instruction that is being executed when it is signaled. + +;RH bits +%PICLI==400000 ;CLI interrupt [3] (A) + ;Some job opened the CLI device with filenames equal + ;to the uname and jname of this job. +%PIPDL==200000 ;PDL overflow [3] (S) +%PILTP==100000 ;340 or E&S light pen hit [3] (A) +%PIMAR==40000 ;MAR hit. [2] (S) + ;The MAR is a hardware feature that allows + ;references to a specific memory location to + ;be trapped. This is the interrupt that happens + ;when such a reference is detected. The guilty + ;instuction is usually not aborted; if it is, the + ;PC is SOS'ed regardless of the setting of %OPOPC. + ;See the .MARA and .MARPC variables. +%PIMPV==20000 ;MPV (memory protect violation) [2] (S) + ;The job referenced a non-existent memory location. + ;The address of that location (roundd down to + ;a page boundary on KA-10's) may be found in .MPVA. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PICLK==10000 ;Slow (1/2 sec) clock [3] (A) +%PI1PR==4000 ;Single-instruction proceed [1] (S) + ;If a job is started with the one-proceed flag + ;(%PC1PR on KA-10's) set, after one instruction + ;is completed a %PI1PR interrupt will occur. + ;DDT's ^N command uses this feature. +%PIBRK==2000 ;.BREAK instruction executed. [1] (S) + ;.BREAK is used for DDT breakpoints, and for explicit + ;program requests to DDT. +%PIOOB==1000 ;Address out of bounds [2] (S) + ;This is an obscure condition that used to + ;happen on USR device IOT's, when an attempt + ;was made to refer to a nonexistent location in the + ;other job. Now this always causes an MPV. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIIOC==400 ;IOCERR (I/O channel error) [2] (S) + ;This indicates the failure of an I/O system + ;call. The channel that was being operated on is + ;in .BCHN, and its .IOS word should contain, in + ;bits 4.5 - 4.1, an error code. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIVAL==200 ;.VALUE instruction executed [1] (S) +%PIDWN==100 ;System-going-down status change [3] (A) + ;If the system changes its mind about whether + ;or when it is scheduled to go down, this interrupt + ;is signaled. +%PIILO==40 ;ILOPR, ILUUO (illegal operation) [2] (S) + ;This can be caused by a returnable uuo when the + ;program's 41 doesn't seem suitable for handling one + ;(see ITS UUOS). It can also be used to report + ;the failure of certain more archaic system calls. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIDIS==20 ;Display memory protect [2] (A) + ;The 340 or E&S display got an MPV. + ;This is now obsolete since the 340 and E&S + ;no longer work. +%PIARO==10 ;Arithmetic overflow [3] (S) + ;The PDP-10's built-in arithmetic overflow + ;condition was detected by the hardware. + ;In fact, overflow occurs so often + ;that enabling this interrupt causes the + ;machine to slow down considerably, + ;and it should be avoided. +%PIB42==4 ;BADPI (Bad location 42) [1] (S) + ;If in attempting to interrupt a job it turns out + ;to be necessary to refer to nonexistent memory + ;or write in read-only memory, this interrupt + ;is signaled, instead of MPV or WIRO. + ;This is so that the program will return to DDT + ;instead of mysteriously looping. +%PIC.Z==2 ;^Z or CALL typed on terminal [1] (A) +%PITYI==1 ;TTY input (obsolete) [3] (A) + +;LH bits +%PJRLT==200000 ;Real-time timer went off [3] (A) + ;These interrupts are controlled by the .REALT + ;uuo. See ITS UUOS. +%PJRUN==100000 ;Run-time timer went off [3] (A) + ;This interrupt is requested (in advance) + ;by setting .RTMR. +%PJNXI==40000 ;Non-existent IO register [2] (S) + ;A Job in User IOT mode referenced a non-existent IO + ;register on the KS10 Unibus. The PC is left pointing + ;before the guilty instruction. The address of the + ;non-existant register may be found in .MPVA. +%PJJST==20000 ;Job Status display request. [3] (A) + ;The sequence ^_J was typed on the + ;console owned by this process or some inferior. +%PJDCL==10000 ;Deferred call. [1] (S) + ;An attempt was made to read TTY input + ;and the next character was a deferred-call + ;character (^_D or Control-CALL). + ;This deferred-call character is never seen + ;by the program; it just causes the interrupt. + ;It differs from ordinary CALL or ^Z + ;in that it takes effect when the program + ;gets around to reading it, not immediately. +%PJATY==4000 ;TTY returned. [3] (A) + ;This interrupt happens when the TTY is + ;returned by the superior, after having + ;been taken away. TECO uses this to know + ;that it must redisplay the entire screen. +%PJTTY==2000 ;Don't have TTY [2] (S) + ;This results from an attempt to use the job's + ;console tty when the job does not own it, if + ;%TBINT is 1 and %TBWAT is 0. See ITS TTY. + ;The guilty instruction is aborted, and the PC is + ;left set according to %OPOPC. +%PJPAR==1000 ;Memory parity error [2] (A) + ;Programs are not intended to try to recover + ;from parity errors, on the assumption that they + ;are probably permanently screwed up. + ;This interrupt is asynchronous because it can + ;be caused by a parity error in another job + ;which destroys data in a page shared with this job. +%PJFOV==400 ;ARFOV (Floating overflow) [3] (S) + ;This is a non-aborting PDP-10 hardware condition. +%PJWRO==200 ;WIRO (Write in read-only page) [2] (S) + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. The address of read + ;only location (rounded down to a page boundary on + ;KA-10's) may be found in .MPVA. +%PJFET==100 ;Fetched insn from impure page [2] (S) + ;On KA-10's, if bit %PCPUR of the PC flags is 1, + ;fetching an instruction from an impure page + ;will cause this interrupt. This is supposed to + ;facilitate catching jumps to randomness. + ;The guilty instruction is aborted, and the PC is + ;left set according to %OPOPC. +%PJTRP==40 ;SYSUUO (System uuo in trap mode) [2] (S) + ;A job whose .UTRAP variable was nonzero either + ;attempted to execute an instruction that trapped + ;to the system, or was about to be interrupted. + ;This feature is intended to be used by the superior + ;to provide a non-ITS environment for the inferior. + ;For that purpose, this interrupt should not be + ;enabled for the inferior, so that it will be fatal. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PJDBG==2 ;System being debugged state change [3] (A) + ;When the system enters or leaves "debugging mode", + ;this interrupt is signaled. +%PJLOS==1 ;A .LOSE UUO or a LOSE system call [2] (S) + ;was executed. + +F. The Interrupt Bits in the Second Word + +The right half of the second word (.IFPIR) is used for I/O channel +interrupts that signal the arrival of or need for data. +They should not be confused with I/O channel error interrupts +or IOCERRors. Each channel has its own bit: 1.1 is for channel +0; 1.2, for channel 1; ... 2.7, for channel 17 . +They are all class 3, and their significance depends on the device +open on the channel. + +The left half of the second word (.IFPIR) is used for +"inferior got a fatal interrupt" interrupts. Each of a job's +inferiors is assigned its own interrupt bit from among the +bottom 8 bits of the left half. When an inferior job is created, +its interrupt bit should be read and remembered by reading the +.INTB variable with a .USET. Every time that inferior gets a fatal +interrupt, it will be stopped and the superior will receive an +interrupt on that inferior's bit in .IFPIR. The inferior may +be restarted by zeroing its .USTP variable, but if the fatal +interrupts remain and are still fatal the inferior will simply +stop and interrupt the superior again. "Inferior got a fatal +interrupt" interrupts are all class 3. + +The reason that inferiors interrupt through a special set of bits +instead of using I/O channel interrupts is that it makes it possible +to receive interrupts from all one's inferiors without having them +all open on I/O channels at all times. DDT normally keeps only +its current job open, and when it receives an interrupt from some +other job it opens that job temporarily. diff --git a/sysdoc/intrup.108 b/sysdoc/intrup.108 new file mode 100644 index 0000000..c1edf58 --- /dev/null +++ b/sysdoc/intrup.108 @@ -0,0 +1,579 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Overview of ITS User Interrupts + +When ITS wishes to signal a user program of the existence of an +unusual interesting condition or occurrence, it does so via +the "user interrupt" mechanism. This mechanism essentially +causes the user program to call an interrupt handling subroutine +in the middle of what it had been doing. The interrupt handler has +enough information to be able to return to the interrupted code +without any effects on it if desired, and to determine the cause +of the interrupt so as to take appropriate action. The program +can specify which interrupt conditions it wishes to handle, and +what their priority order should be; un-handled interrupts are +either ignored or fatal depending on the condition. Some interrupt +conditions represent errors in the execution of the job; some +indicate the occurrence of asynchronous events such as I/O operation +completion; some exist for debugging and are always fatal. + +The noun "interrupt" may mean either the event of interrupting +a program (causing it to call the handler), or a condition which +can cause a program to be interrupted. Also, the distinction +between an interrupt condition and the bit which is 1 when the +condition is present is often blurred. + +Unlike TENEX, ITS never gives the user an interrupt "in the middle +of a system call". The PC saved by an interrupt is always a user-mode PC. +This is a great advantage when it comes to having the interrupt handler +understand what the interrupted code was doing and fix it up. +System calls will either be finished or backed out of (to be redone) +when it is necessary for the job to be interrupted. To avoid having to +do a lot of work twice, all ITS system calls that take a long time to +complete are designed so that if restarted they will continue from +where they left off. They do this by updating their arguments to +indicate how much progress they have made, just like the BLT instruction. +Now you know why SIOT and block-mode IOT update their pointer and +byte count as they go. + +Section A describes how interrupts are signaled and enabled, etc. +Section B describes what is actually done to a job when it is + interrupted, if it uses the older simple interrupt mechanism. +Section C gives an example of an old-style interrupt handler. +Section D describes what is actually done to a job when it is + interrupted, if it uses the newer vectored interrupt mechanism. +Section E describes the individual interrupt conditions in the + first interrupt request word (.PIRQC). +Section F describes the individual interrupt conditions in the + second interrupt request word (.IFPIR). + +A. The ITS Interrupt Mechanism + +Each ITS job has two "interrupt request words", called .PIRQC +and .IFPIR, and readable with .SUSET. Each distinct interrupt +condition is assigned one of the bits in one of the words. +The interrupt is "pending" when the bit is 1. +.PIRQC is called the "first interrupt word" and interrupts in it +are "first word interrupts". .IFPIR is the "second interrupt word" +and its interrupts are "second word interrupts". + +Interrupt conditions are divided by the system into three severity classes. +Class 1 interrupts are always fatal. They are genarally conditions caused +by the user or the superior, for debugging purposes; for example, +breakpoints, ^Z typed, and single-instruction-proceed interrupts are +of class 1. Class 2 interrupts are fatal unless the program is set up +to handle the interrupt. Most error conditions are class 2; for example, +MPV (memory protect violation), ILOPR (illegal operation), IOCERR +(I/O channel error). All class 1 and 2 interrupts are first word +interrupts. Class 3 interrupts are never fatal unless the user +explicitly makes them so; either the program is eventually interrupted +or nothing happens. Most asynchronous conditions are class 3. + +When a job receives a fatal interrupt, that job is not interrupted +itself; instead, it is stopped, as if its superior had stopped it, +and an "inferior got a fatal interrupt" interrupt is signaled for the +superior. If a top level job receives a fatal interrupt, then it will +be stopped and detached (see the symbolic system call DETACH). + +Each interrupt word has a corresponding mask word: .MASK for .PIRQC, +and .MSK2 for .IFPIR. An interrupt is enabled if the appropriate bit in +the mask word is 1. A program will not receive an interrupt which is +disabled, but if the interrupt condition is in class 2 it +will be fatal if it is not enabled. Class 3 interrupts will not even +be signaled if they are disabled. Class 1 interrupts are not allowed +to be enabled, the idea being that the job which gets an always-fatal +interrupt is not allowed to handle the interrupt itself. + +Each interrupt word also has a defer word: .DF1 for .PIRQC, and +.DF2 for .IFPIR. If the appropriate bit in the defer word is set, +the interrupt is "deferred". For a class 2 interrupt, deferment has +the same effect as disablement: the interrupt becomes fatal. +For a class 1 interrupt, deferment has no effect. For a class 3 +interrupt, deferment differs from disablement in that a deferred +interrupt will still be signaled; it will then remain pending until +it is no longer deferred, when it will be given to the user. +The system makes it easy to defer a specified set of interrupts while +processing an interrupt. That is how different priorities of +interrupts may exist. + +Slightly obsolete but still useful is the variable .PICLR, which is +normally -1. If this variable is set to 0, all interrupts are deferred. +The actual values of the defer words are unaltered. .PICLR was +the original way to defer interrupts, before the defer words existed. +The older style of interrupt handling on ITS sets .PICLR to 0 while +an interrupt is being processed; thus, there is only one interrupt +priority level. + +To help eliminate timing errors, the six variables .PIRQC, .IFPIR, +.MASK, .MSK2, .DF1 and .DF2 have aliases which have the same value +when read, but when written either IORM or ANDCAM into the variable +instead of setting all the bits in it. These aliases are called +.IPIRQC, .IIFPIR, .IMASK, .IMSK2, .IDF1 and .IDF2 for IORM'ing, +and .APIRQC, .AIFPIR, .AMASK, .AMSK2, .ADF1 and .ADF2 for ANDCAM'ing. +Thus, depositing 20 in .APIRQC will clear the 20 bit in .PIRQC. + +Error-condition interrupts (MPV, ILOPR, IOCERR, WIRO, DTTY and some others) +usually abort the instruction that causes them. When this happens, +the old convention (still the default) is to leave the PC pointing +AFTER the aborted instruction. This is very bad since it is hard +for the user's interrupt handler to tell whether to decrement the PC. +The new convention, selected by setting bit %OPOPC in the LH of the +.OPTION variable to 1, is for the system to decrement the PC when +a fatal interrupt happens, so that if the interrupt handler fixes +the problem (e.g. creates the nonexistent page of core) and dismisses, +the instruction will be retried. All new programs should use the +new convention; it would be nice to flush the old one entirely. + +B. How Jobs Are Informed about Their Interrupts (Old Style) + +There are two ways for a program to receive interrupts from the +system: the old way, and the new way. The old scheme always stores +the PC in the same place, making recursive interrupts difficult. +It also makes all interrupts have the same priority level. +The new scheme pushes the interrupt information on a stack. It also +has the ability to decode the interrupts for the user, whereas with the +old mechanism the program must decode the interrupts. Nevertheless, +the old mechanism is not considered obsolete, since it is easier to use. + +Both mechanisms have the user's interrupt handler information pointed +to by location 42. More generally, the address of the interrupt pointer +is 2 plus the rh of the .40ADDR variable; since .40ADDR usually holds +40, the interrupt pointer usually lives in 42. + +The two mechanisms are selected by the %OPINT bit of the .OPTION +variable: the new mode is used if the bit is 1. + +In the old mode, 42 is expected to contain the address of the +interrupt handler itself. Let that address be called "TSINT" +(every program should use that label, for the sake of humans). +If TSINT is 0, or addresses nonexistent or pure storage, +when the system attempts to interrupt the job, an always-fatal +BADPI (%PIB42) interrupt is signaled and the program does not +receive the original interrupts. If the superior, handling the BADPI, +fixes up 42 and restarts the job, it will then be properly interrupted. + +When an interrupt happens, all the +pending enabled undeferred first word interrupts will be given to +the user at once if there are any; otherwise, all the pending +enabled undeferred second word interrupts will be given. The +interrupts which are given will be cleared in the request word. +Whichever interrupt request word is being given will be stored in TSINT. +If the interrupts being handled are second-word interrupts, the sign +of TSINT will be set. The PC is stored in TSINT+1. The job is then +started at TSINT+2, with all PC flags except user and user-i/o zeroed. +The job's .PICLR will be set to 0, preventing further interrupts while +the interrupt handler is running. Because more than one interrupt +may be given to the user at once, the interrupt routine should check +all of the interrupt bits, and after handling one interrupt should +return to check the remaining bits. + +The normal way for the interrupt handler +to exit is with the .DISMIS uuo, which should address a word containing +the desired new PC. .DISMIS jumps to that PC, restoring flags, and also +sets .PICLR to -1 to allow interrupts again. To restart the program +where it was interrupted, .DISMIS TSINT+1 should be used. The program +may desire to restore the saved PC flags but a different PC; in that +case, it should probably clear the byte-interrupt flag (%PCFPD) before +restoring the flags. + +C. An Example of an Old Style Interrupt Handler + +TSINT: +LOC 42 + TSINT ;this is the interrupt pointer. -> int handler. +LOC TSINT + 0 ;first word of handler gets the bits for the interrupts + 0 ;second gets the PC + EXCH A,TSINT + JUMPL A,TSINT2 ;sign of int word set => second word interrupts; + TLNE A,%PJRLT ;otherwise, they are first word interrupts. + PUSHJ P,TIMINT ;if we got an alarm clock int, handle that. + TRNE A,%PIMPV + PUSHJ P,MPVINT ;if we got an MPV, handle that. + TRNE A,%PIIOC + PUSHJ P,IOCINT ;if we got an IOCERR, handle that. +TSINTX: EXCH A,TSINT + .DISMIS TSINT+1 ;then restore the saved PC and zero .PICLR. + +TSINT2: TRNE A,1_TYIC + PUSHJ P,INPUTI ;handle characters typed on the tty (assuming + ;that tty input is open on channel TYIC) + TDNE A,INFBIT + PUSHJ P,INFINT ;handle interrupts from one of our inferiors, + ;assuming the inferior's .INTB variable was + ;read into INFBIT. + JRST TSINTX + +;if the program can't recover from MPV's well, it might do this: +MPVINT: + .DISMIS [RESTART] ;re-initialize the program. + +;if it wanted to create the referenced page, it might do this: +MPVINT: PUSH P,B + .SUSET [.RMPVA,,B] + LSH B,-10. ;get the referenced page's number. + .CALL [ SETZ ? 'CORBLK + MOVEI 400000 ? MOVEI -1 ? B ? SETZI 400001] + .VALUE ; ^ get a fresh page into page w/ number in B. + POP P,B + POPJ P, + +D. How Jobs Are Informed about Their Interrupts (New Style) + +When using the newer interrupt mechanism, the program must divide +the interrupts that it handles into some number of groups (there +may be as few as one interrupt in a group, or all the interrupts +may be in one group). The interrupts in a group are all handled +the same way; they have the same relative priority to all other +interrupts, and have the same handler address. For each group, +the user must specify to the system which interrupts are in it, +which interrupts are considered to have a lower priority than +those in the group, and where the handler for the group is located. +This is done with the "interrupt table", which should be 5n+1 words +long where n is the number of groups. The interrupt table should +be identified to the system by means of an AOBJN pointer in 42. + +The first word of the interrupt table should hold the address +of the interrupt stack (which may be an accumulator - P will work!). +The LH of this word specifies extra information to be pushed on +the interrupt stack at each interrupt, beyond the necessary minimum: + bits 3.5-3.1 # of ACs to push. 0 => don't push any ACs. + bits 3.7-4.1 # of first AC to push. + bit 4.9 1 => push the .JPC and .SUUOH variables, and the LSPCL + (an internal ITS variable), after the ACs if any. + +Then come five words for each interrupt group. Their meanings are: + wd 1 The 1st word interrupts that are in this group. + If a bit is set in this word, the corresponding interrupt is + in this group. + wd 2 The 2nd word interrupts which are in this group. + wd 3 The 1st word interrupts that are of priority less than or equal to + this group's. Give the bits for the appropriate interrupts. + When interrupts in this group happen, these bits will be + set in .DF1 to prevent the lower-priority interrupts from + happening. Note that it is not obligatory to include the + interrupts of the group itself in this word; if they are not + included, they will be able to interrupt recursively. That is + sometimes desirable for recoverable synchronous conditions. + wd 4 The 2nd word interrupts that are ofthe same or lower priority. + wd 5 The address of the handler for this group. + +Note that the priority-relation between interrupts, specified by the +second and third words of the groups in the interrupt table, need not +be even a partial order: it is permissible for interrupt A to defer +only B, B to defer only C, and C to defer only A, although not very +useful. Often, a synchronous interrupt is left incomparable with all +other interrupts - it defers only itself, or nothing. + +Synchronous interrupts should come before asynchronous ones +in the table. The only time an exception to that is safe is when +the asynchronous interrupt defers the synchronous one. The reason for +this rule is that when a synchronous interrupt and an asynchronous one +are signalled at the same time, if the asynchronous interrupt comes +earlier in the table it will happen first; if the synchronous one is +not then deferred, it will interrupt saving a PC pointing at the first +word of the asynchronous interrupt's handler - which is not the address +of the instruction that actually caused the synchronous interrupt. If +the synchronous interrupt's handler looks at the PC, as many do, it will +be confused. + +This is an example of an interrupt table (taken from DDT). + +TSINT: LOC 42 + -TSINTL,,TSINT +LOC TSINT + + P ;interrupt pdl pointer address. + %PIWRO ? 0 ? 0 ? 0 ? PURBR1 + ;pure-page violations don't inhibit anything. + ;DDT wants to type out ":UNPURE", and doesn't + ;like to type out with any interrupts inhibited. + %PITTY ? 0 ? %PITTY ? 0 ? TTYINT + ;Don't-have-tty interrupts defer themselves + ;so that they become fatal while one is being + ;processed. If DDT decides that the one + ;that happened should have been fatal, it + ;signals another by depositing in .IPIRQC, and + ;that one IS fatal since it is deferred. + %PIIOC\%PIILO\%PIMPV\%PIOOB ? 0 ? #%PITTY ? -1 ? TSIN0 + ;Error interrupts inhibit asynchronous ints for + ;safety's sake, and themselves so an error in + ;the handler will be fatal. + #%PIIOC#%PIILO#%PIMPV#%PIOOB#%PIWRO#%PICLI#%PITTY ? #<1_TYOC>#1_TYOBC + #%PIIOC#%PIILO#%PIMPV#%PIOOB#%PIWRO#%PICLI#%PITTY ? -1 ? TSIN0 + ;Miscellaneous interrupts have the same handler + ;as the errors - for historical reasons - but + ;don't defer the errors, so that DDT can recover + ;if an error happens in a miscellaneous int. + 0 ? 1_TYOC+1_TYOBC ? 0 ? 0 ? MORINT + ;Bottom-of-screen-on-terminal interrupts defer nothing, + ;so they can exit by simply jumping if they wish. + %PICLI ? 0 ? %PICLI ? 0 ? CLIBRK + ;Core-link interrupts (someone is :SEND'ing to me). +TSINTL==.-TSINT + +The algorithm for giving a set of interrupts is: +Look through the interrupt block one group at a time. +If a group is found that applies to any of the interupts that +are to be given, all the interrupts that it applies to and that are +to be given are pushed, together, onto the interrupt stack +at once. The words pushed are: + First, two words containing the interrupts being pushed. + The first word interrupt bits are pushed first. + Next, two words containing the old settings of .DF1 and .DF2. + The old .DF1 is pushed first. + Next, a word containing the PC before the interrupt. + Last, any AC's or debugging variables specified by the LH of + the first word of the interrupt table. These are pushed in the + order: AC's first, then .JPC, then .SUUOH, and finally LSPCL. +If pdl overflow is enabled, it will be detected properly when the +interrupt data is pushed. +After the necessary information has been saved and the interrupt pdl +updated, the defer words and the PC will be set as specified +in the the interrupt table. +At this point, if there still remain any pending enabled undeferred +interrupts, the whole process is repeated, scanning through all the +groups from the beginning. Note that giving one interrupt may cause +other previously undeferred interrupts to be deferred. It may also +set the pdl overflow interrupt, in which case that interrupt will +be given immediately if not deferred. + +If there are pending enabled undeferred interrupts not included +in any group, and they do not become deferred by the giving of other +interrupts, then they are considered immediately fatal. Thus, the +user can make a nonfatal interrupt be fatal by enabling it but not +including it in any group. + +The interrupt routine may conveniently +exit with the DISMIS Symbolic System Call. +The first arg, if not immediate, should point at the interrupt stack: + .CALL [SETZ ? 'DISMIS ? SETZ P] +The defer words and PC will be restored from the top 3 +words on the stack and 5 words will be popped. Stack overflow +will be detected. You may specify that extra things should be popped +using the control bit argument; bit 2.9 specifies that three words +should be discarded, while *100+ specifies that ACs through ++-1 should be popped. Thus, it is a win to give, as the control +bit argument (in the RH) whatever was put in the LH of the first word +of the interrupt table - that will cause the DISMIS to pop exactly +what interrupts push. + +If the first arg is immediate, clearly nothing can be popped: + .CALL [SETZ ? 'DISMIS ? SETZI 2+[DF1 ? DF2 ? PC] ] +In this case the control-bit argument is ignored. +If a second argument is given, it is used as the new PC +instead of what is found on the interrupt stack. +Similarly, optional third and fourth arguments specify the new +contents of the defer words, overriding what was saved on the stack. +Thus, if four arguments are given and the first is immediate, +the first argument is effectively ignored. + +E. The Interrupt Bits in the First Interrupt Word. + +The interrupt classes are: + [1] stops job and interrupts superior (fatal intr) + [2] stops job and interrupts superior unless enabled and undeferred + [3] does nothing unless enabled; waits if deferred. +Bits in the lh have two names: %PI... as a bit in the word, + and %PJ... shifted down by 18. bits. + +The following interrupts abort the instruction, and leave the PC pointing +before the instruction if %OPOPC is 1 (as is winning), or after it if +%OPOPC is 0: %PIMPV, %PIOOB, %PIIOC, %PIILO, %PJTTY, %PJWRO, %PJFET, %PJTRP. + +"(S)" indicates a synchronous interrupt; "(A)", an asynchronous one. +An interrupt is synchronous if its occurrence is always directly related +to the instruction that is being executed when it is signaled. + +;RH bits +%PICLI==400000 ;CLI interrupt [3] (A) + ;Some job opened the CLI device with filenames equal + ;to the uname and jname of this job. +%PIPDL==200000 ;PDL overflow [3] (S) +%PILTP==100000 ;340 or E&S light pen hit [3] (A) +%PIMAR==40000 ;MAR hit. [2] (S) + ;The MAR is a hardware feature that allows + ;references to a specific memory location to + ;be trapped. This is the interrupt that happens + ;when such a reference is detected. The guilty + ;instuction is usually not aborted; if it is, the + ;PC is SOS'ed regardless of the setting of %OPOPC. + ;See the .MARA and .MARPC variables. +%PIMPV==20000 ;MPV (memory protect violation) [2] (S) + ;The job referenced a non-existent memory location. + ;The address of that location (roundd down to + ;a page boundary on KA-10's) may be found in .MPVA. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PICLK==10000 ;Slow (1/2 sec) clock [3] (A) +%PI1PR==4000 ;Single-instruction proceed [1] (S) + ;If a job is started with the one-proceed flag + ;(%PC1PR on KA-10's) set, after one instruction + ;is completed a %PI1PR interrupt will occur. + ;DDT's ^N command uses this feature. +%PIBRK==2000 ;.BREAK instruction executed. [1] (S) + ;.BREAK is used for DDT breakpoints, and for explicit + ;program requests to DDT. +%PIOOB==1000 ;Address out of bounds [2] (S) + ;This is an obscure condition that used to + ;happen on USR device IOT's, when an attempt + ;was made to refer to a nonexistent location in the + ;other job. Now this always causes an MPV. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIIOC==400 ;IOCERR (I/O channel error) [2] (S) + ;This indicates the failure of an I/O system + ;call. The channel that was being operated on is + ;in .BCHN, and its .IOS word should contain, in + ;bits 4.5 - 4.1, an error code. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIVAL==200 ;.VALUE instruction executed [1] (S) +%PIDWN==100 ;System-going-down status change [3] (A) + ;If the system changes its mind about whether + ;or when it is scheduled to go down, this interrupt + ;is signaled. +%PIILO==40 ;ILOPR, ILUUO (illegal operation) [2] (S) + ;This can be caused by a returnable uuo when the + ;program's 41 doesn't seem suitable for handling one + ;(see ITS UUOS). It can also be used to report + ;the failure of certain more archaic system calls. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PIDIS==20 ;Display memory protect [2] (A) + ;The 340 or E&S display got an MPV. + ;This is now obsolete since the 340 and E&S + ;no longer work. +%PIARO==10 ;Arithmetic overflow [3] (S) + ;The PDP-10's built-in arithmetic overflow + ;condition was detected by the hardware. + ;In fact, overflow occurs so often + ;that enabling this interrupt causes the + ;machine to slow down considerably, + ;and it should be avoided. +%PIB42==4 ;BADPI (Bad location 42) [1] (S) + ;If in attempting to interrupt a job it turns out + ;to be necessary to refer to nonexistent memory + ;or write in read-only memory, this interrupt + ;is signaled, instead of MPV or WIRO. + ;This is so that the program will return to DDT + ;instead of mysteriously looping. +%PIC.Z==2 ;^Z or CALL typed on terminal [1] (A) +%PITYI==1 ;TTY input (obsolete) [3] (A) + +;LH bits +%PJRLT==200000 ;Real-time timer went off [3] (A) + ;These interrupts are controlled by the .REALT + ;uuo. See ITS UUOS. +%PJRUN==100000 ;Run-time timer went off [3] (A) + ;This interrupt is requested (in advance) + ;by setting .RTMR. +%PJNXI==40000 ;Non-existent IO register [2] (S) + ;A Job in User IOT mode referenced a non-existent IO + ;register on the KS10 Unibus. The PC is left pointing + ;before the guilty instruction. The address of the + ;non-existant register may be found in .MPVA. +%PJJST==20000 ;Job Status display request. [3] (A) + ;The sequence ^_J was typed on the + ;console owned by this process or some inferior. +%PJDCL==10000 ;Deferred call. [1] (S) + ;An attempt was made to read TTY input + ;and the next character was a deferred-call + ;character (^_D or Control-CALL). + ;This deferred-call character is never seen + ;by the program; it just causes the interrupt. + ;It differs from ordinary CALL or ^Z + ;in that it takes effect when the program + ;gets around to reading it, not immediately. +%PJATY==4000 ;TTY returned. [3] (A) + ;This interrupt happens when the TTY is + ;returned by the superior, after having + ;been taken away. TECO uses this to know + ;that it must redisplay the entire screen. +%PJTTY==2000 ;Don't have TTY [2] (S) + ;This results from an attempt to use the job's + ;console tty when the job does not own it, if + ;%TBINT is 1 and %TBWAT is 0. See ITS TTY. + ;The guilty instruction is aborted, and the PC is + ;left set according to %OPOPC. +%PJPAR==1000 ;Memory parity error [2] (A) + ;Programs are not intended to try to recover + ;from parity errors, on the assumption that they + ;are probably permanently screwed up. + ;This interrupt is asynchronous because it can + ;be caused by a parity error in another job + ;which destroys data in a page shared with this job. +%PJFOV==400 ;ARFOV (Floating overflow) [3] (S) + ;This is a non-aborting PDP-10 hardware condition. +%PJWRO==200 ;WIRO (Write in read-only page) [2] (S) + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. The address of read + ;only location (rounded down to a page boundary on + ;KA-10's) may be found in .MPVA. +%PJFET==100 ;Fetched insn from impure page [2] (S) + ;On KA-10's, if bit %PCPUR of the PC flags is 1, + ;fetching an instruction from an impure page + ;will cause this interrupt. This is supposed to + ;facilitate catching jumps to randomness. + ;The guilty instruction is aborted, and the PC is + ;left set according to %OPOPC. +%PJTRP==40 ;SYSUUO (System uuo in trap mode) [2] (S) + ;A job whose .UTRAP variable was nonzero either + ;attempted to execute an instruction that trapped + ;to the system, or was about to be interrupted. + ;This feature is intended to be used by the superior + ;to provide a non-ITS environment for the inferior. + ;For that purpose, this interrupt should not be + ;enabled for the inferior, so that it will be fatal. + ;The guilty instruction was aborted, and the PC was + ;left set according to %OPOPC. +%PJDBG==2 ;System being debugged state change [3] (A) + ;When the system enters or leaves "debugging mode", + ;this interrupt is signaled. +%PJLOS==1 ;A .LOSE UUO or a LOSE system call [2] (S) + ;was executed. + +F. The Interrupt Bits in the Second Word + +The right half of the second word (.IFPIR) is used for I/O channel +interrupts that signal the arrival of or need for data. +They should not be confused with I/O channel error interrupts +or IOCERRors. Each channel has its own bit: 1.1 is for channel +0; 1.2, for channel 1; ... 2.7, for channel 17 . +They are all class 3, and their significance depends on the device +open on the channel. + +The left half of the second word (.IFPIR) is used for +"inferior got a fatal interrupt" interrupts. Each of a job's +inferiors is assigned its own interrupt bit from among the +bottom 8 bits of the left half. When an inferior job is created, +its interrupt bit should be read and remembered by reading the +.INTB variable with a .USET. Every time that inferior gets a fatal +interrupt, it will be stopped and the superior will receive an +interrupt on that inferior's bit in .IFPIR. The inferior may +be restarted by zeroing its .USTP variable, but if the fatal +interrupts remain and are still fatal the inferior will simply +stop and interrupt the superior again. "Inferior got a fatal +interrupt" interrupts are all class 3. + +The reason that inferiors interrupt through a special set of bits +instead of using I/O channel interrupts is that it makes it possible +to receive interrupts from all one's inferiors without having them +all open on I/O channels at all times. DDT normally keeps only +its current job open, and when it receives an interrupt from some +other job it opens that job temporarily. diff --git a/sysdoc/its.bugs b/sysdoc/its.bugs new file mode 100644 index 0000000..0eb983f --- /dev/null +++ b/sysdoc/its.bugs @@ -0,0 +1,5104 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 19 Apr 90 22:37:18 EDT +Received: from BU.EDU by mintaka.lcs.mit.edu id aa23808; 19 Apr 90 22:32 EDT +Received: from BU-IT.BU.EDU by BU.EDU (1.97) Thu, 19 Apr 90 22:31:46 EDT +Received: by bu-it.bu.edu (12/20/89); Thu, 19 Apr 90 22:31:38 EDT +Date: Thu, 19 Apr 90 22:31:38 EDT +From: Phil Budne +Message-Id: <9004200231.AA04513@bu-it.bu.edu> +To: DIGEX%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu, + DOOMSDAY%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu +Subject: Re: the future of ITS +Cc: INFO-ITS%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu, + KS-OWNERS%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu + +I started on a '10 simulator, but never wrote the 36 bit math needed. +If you figure a 10 times performance hit a DS3100 or a SPARC might +yield performance at the KA/KS level. + + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU; 19 Apr 90 22:04:09 EDT +Received: from AI.MIT.EDU by REAGAN.AI.MIT.EDU via INTERNET with SMTP id 8576; 19 Apr 90 22:01:59 EDT +Received: from PIGPEN.AI.MIT.EDU by life.ai.mit.edu (4.1/AI-4.10) id AA19917; Thu, 19 Apr 90 22:04:14 EDT +Date: Thu, 19 Apr 90 22:01 EDT +From: Alan Bawden +Subject: Praise the hackers of the past! +To: ZVONA@ai.ai.mit.edu +Cc: BUG-ITS@ai.ai.mit.edu +In-Reply-To: <722707.900418.ZVONA@AI.AI.MIT.EDU> +Message-Id: <19900420020110.5.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Wed, 18 Apr 90 20:11:04 EDT + From: David Chapman + ... the system crashed with + + DIR 2 ZVONA CLOBBERED + PI LEVEL 2 BUGHALT + + I dumped to crash;zvona clobbr. Reloaded OK. THe directory also + looks OK. I don't think I did anything weird to provoke this.... + +Occasionally a crash dump really does enable you to figure out exactly what +the problem was. In this case the in-core copy of your directory really +was trashed. It's pretty clear why too. The last 128. words of the ZVONA +directory were replaced by the first 128. words of the C directory. Since +disk sectors are exactly 128. words long, and the C directory is stored +right after the ZVONA directory on disk, it doesn't take Sherlock Holmes to +figure out what happened. + +Be thankful that many years ago some hacker made ITS paranoid about writing +a directory back to disk without sanity checking it first. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 19 Apr 90 16:46:56 EDT +Received: from life.ai.mit.edu by mintaka.lcs.mit.edu id aa09992; + 19 Apr 90 16:45 EDT +Received: from zurich.ai.mit.edu (CHAMARTIN.AI.MIT.EDU) by life.ai.mit.edu (4.1/AI-4.10) id AA15299; Thu, 19 Apr 90 16:45:32 EDT +Received: from localhost by zurich.ai.mit.edu; Thu, 19 Apr 90 16:43:55 edt +Date: Thu, 19 Apr 90 16:43:55 edt +From: "Guillermo J. Rozas" +Message-Id: <9004192043.AA15383@zurich.ai.mit.edu> +To: DIGEX%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Cc: DOOMSDAY%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + KS-OWNERS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + info-its%ai.ai.mit.edu@mintaka.lcs.mit.edu +In-Reply-To: Doug Humphrey's message of Thu, 19 Apr 90 16:28:03 EDT <723026.900419.DIGEX@AI.AI.MIT.EDU> +Subject: the future of ITS +Reply-To: jinx@zurich.ai.mit.edu + +I think that the idea of a PDP-10 simulator running on a fast Unix box +is pretty funny, but would be a very cool hack. Writing such a +simulator (except IO instructions) is straight-forward, but changing +ITS to do virtual IO would probably be far more painful. It may also +require a fair amount of hacking from a very small group of people +(Alan, Moon,...), and that may not be reasonable. + + + + +Date: Thu, 19 Apr 90 16:28:03 EDT +From: Doug Humphrey +Subject: the future of ITS +To: DOOMSDAY%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: INFO-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, KS-OWNERS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <723026.900419.DIGEX@AI.AI.MIT.EDU> + + +I would be interested in getting a discussion going on the future of +ITS. This would be open to any kind of strange ideas, from running +it on existing KS-10 hardware (at MIT or not) to building a PDP-10 +software simulator that can run on existing and/or future cpus, like +MIPS chips, etc. In short, before these machines go away, and all of +the ITS knowledgable people too far away, lets talk about this stuff. + +Another point is that INFO-ITS and KS-OWNERS lists should continue to +live after the ITS systems go into hibernation so that advances in the +ITS state-of-the-art can be announced and discussed. + +Comments, etc? + +Doug Humphrey +digex@mit-ai +digex@tumtum.cs.umd.edu + +Date: Wed, 18 Apr 90 20:11:04 EDT +From: David Chapman +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <722707.900418.ZVONA@AI.AI.MIT.EDU> + +Well, this is spectacularly ironic. I was just about to write a +magtape of my AI directory to take to CA -- literally seconds from +doing so -- when the system crashed with + +DIR 2 ZVONA CLOBBERED +PI LEVEL 2 BUGHALT + +I dumped to crash;zvona clobbr. Reloaded OK. THe directory also +looks OK. I don't think I did anything weird to provoke this.... + +Date: Sat, 14 Apr 90 02:40:47 EDT +From: Alan Bawden +Subject: A sad day +To: INFO-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Reply-to: Alan@Reagan.AI.MIT.EDU +Message-ID: <721426.900414.ALAN@AI.AI.MIT.EDU> + +I'm sorry to announce that we're going to shut down the ITS machines at +MIT. As we plan for the final shutdown, the file AI:SYS;GOOD BYE will be +constantly updated to contain the current plans. What follows is the +current contents of that file, and it pretty much explain the situation: + +------- + +Well, the time has finally arrived to shut down the ITS machines for the +last time. The hardware is getting old, and the amount of maintenance +required to keep things running is getting out of hand. We've been losing +ground at an accelerating rate for the last year. + +The current plan is to turn AI and MC off for good sometime around the end +of May. We plan to take a snapshot of AI and MC's filesystem sometime +before the final shutdown and to keep this snapshot available on some other +file server for a couple of months. People who have a large number of +files to evacuate, but who lack efficient network access to AI and MC, are +encouraged to simply wait until after this snapshot becomes available. + +AI's second RP06 (SECOND:) will be fixed soon to make it easier for people +to evacuate themselves. + +Files on ITS backup tapes will be unavailable until someone writes the +program to read them. Before the shutdown, modest file retrieval requests +(mail to FILE-R@AI) will be considered. Extensive or complicated retrieval +requests will have to wait until after the dust settles after the shutdown. +Our judgment on these matters will be final. Sorry. + +All mailing lists will have to be moved elsewhere. If you maintain a +mailing list on AI or MC, you can save us some trouble by moving your +mailing list yourself as soon as possible. We'll try and do something +responsible about those important lists that don't have obvious owners, but +don't count on us to save your mailing list for you -- we might decide to +just let it perish. + +Please try not to pester us about the personal inconvenience this causes +you. We don't have any suggestions about where you should read your mail +now, where you can keep your files, or where you can move your mailing +list, and we wish we knew of another PDP-10 that you could use. (If you +-must- pester someone, send mail to DOOMSDAY@AI.) We do appreciate your +loyalty to ITS during its lifetime at MIT. Stop by sometime and we can +talk about the good old days when dinosaurs ruled the machine room. + +As we continue to plan for doomsday, this file will be updated with the +latest news. + + - Alan + +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU; 6 Mar 90 13:12:17 EST +Received: from lcs.mit.edu (CHAOS 15044) by MC.LCS.MIT.EDU; 6 Mar 90 13:11:41 EST +Received: from NIC.DDN.MIL by mintaka.lcs.mit.edu id aa14446; 6 Mar 90 13:03 EST +Date: Tue, 6 Mar 90 09:49:38 PST +From: Ken Harrenstien +Subject: Status? +To: bug-its@mc.lcs.mit.edu +cc: klh@nic.ddn.mil +Message-ID: <12571572384.22.KLH@NIC.DDN.MIL> + +Uh, I haven't been keeping up with ITS developments for a while. Just +noticed that MC is only reachable by a MX record through MINTAKA. Does +that mean it's no longer on the Internet at all? No address is forthcoming +from either our host tables or the DNS. +------- + + +Date: Thu, 25 Jan 90 04:43:45 EST +From: "Pandora B. Berman" +Subject: adios to ML +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, POSTMASTER%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, + NGL%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <693233.900125.CENT@AI.AI.MIT.EDU> + +alan has made an Executive Decision that trying to make ML work again, as +well as keeping AI and MC in good shape, is Too Much Work For One +Overloaded Grad Student However Encouraging His Friends Are. therefore, ML +isn't coming up again. we did a full dump just before it came down in +november, so all the files are available. + there is a theory about purchasing (yes, we speak of $$) a System +Concepts disk box to hook up to the 2 remaining ITSs; such a thing, +according to the SC folks, would emulate some reasonable number of rp06s +without including their well-known maintenance problems. NB: we do not have +solid commitments on the money yet, so do not assume that we will get this +object. there is reason to believe we will, but no guarantees. if we do, +there should be no problem loading the ML files onto the space so obtained. +in the mean time, we will try to make space for such files available on AI +and MC on an as-needed basis. + the ML dialups will be moved to MC. + i have flushed the references to ML from the system-msg addresses and +the inquir updater lists. + +Date: Sat, 23 Dec 89 02:40:39 EST +From: "Pandora B. Berman" +Subject: yow +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <682728.891223.CENT@AI.AI.MIT.EDU> + +actually, it's not so surprising that some tourists can talk DDT too +obscurely for me to understand.... +---------- +From: "Stephen E. Robbins" +Date: Thu, 21 Dec 89 13:25:56 EST +To: CENT%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Subject: Where unix-haters-request is + Date: Wed, 20 Dec 89 22:13:42 EST + From: "Pandora B. Berman" + ....Candidates for entry into this august body must either prove their + worth by a short rant on their pet piece of unix brain death, or produce + witnesses of known authority to attest to their adherence to our high + moral principles.. + +Does knowing about :DDTSYM DPSTOK/-1 followed by $$^R qualify as attesting +to adherence of high moral principles? + +- Stephen + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 16:08:30 EST +Received: from Gateway.Think.COM by mintaka.lcs.mit.edu id aa15010; + 15 Dec 89 16:02 EST +Received: from Fafnir.Think.COM by Think.COM; Fri, 15 Dec 89 16:03:23 -0500 +Return-Path: +Received: from verdi.think.com by fafnir.think.com; Fri, 15 Dec 89 15:58:28 EST +Received: from ungar.think.com by verdi.think.com; Fri, 15 Dec 89 15:56:16 EST +From: Guy Steele +Received: by ungar.think.com; Fri, 15 Dec 89 15:56:15 EST +Date: Fri, 15 Dec 89 15:56:15 EST +Message-Id: <8912152056.AA29450@ungar.think.com> +To: Ed@alderaan.scrc.symbolics.com +Cc: gumby@gang-of-four.stanford.edu, info-its@ai.ai.mit.edu, + unix-haters@ai.ai.mit.edu, gls@think.com +In-Reply-To: Ed Schwalenberg's message of Fri, 15 Dec 89 14:56 EST <19891215195628.4.ED@PEREGRINE.SCRC.Symbolics.COM> +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? + + Date: Fri, 15 Dec 89 14:56 EST + From: Ed Schwalenberg + + Date: Thu, 14 Dec 89 19:57:05 -0800 + From: David Vinayak Wallace + + Those who never used TS BEAR may not recognise the message above, but + those who do may be amused by how the cookie bear got permuted by the + time the unix weenies heard about it. Then again, note his last + question... + + >From: kim@watsup.waterloo.edu (T. Kim Nguyen) + Subject: "cookie" + Date: 11 Dec 89 09:13:31 GMT + + While the machine was being dismantled, someone took a look inside and + found this circuit board hooked into the machine. Guess what was + asking for cookies, and had not been found, even after people searched + high and low through the software for the cookie monster... + + I heard this story when I entered MIT in September 1974. The version I + heard allegedly took place at Dartmouth, and the cookie monster wouldn't + go away even after the OS was changed; it took a TTY33 repairperson to + discover the hardware hack in the system console. + + I wrote a cookie program for the PDP-8 at MIT's Weather Radar group when + I worked there in the summer of 1975, based on the story I had heard. + I wasn't aware of TS BEAR until much later, although I don't know when + it was written or what inspiration its author (who I think was GLS) had. + +I wrote TS BEAR after hearing an oral description of a similar +hack on (as I recall) Multics. Richard Feynman was perhaps its +most famous victim (it was I who sicced it on him--blush). + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 15:51:16 EST +Received: from [128.81.41.109] by mintaka.lcs.mit.edu id aa14529; + 15 Dec 89 15:44 EST +Received: from PEREGRINE.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 358313; 15 Dec 89 14:59:03 EST +Date: Fri, 15 Dec 89 14:56 EST +From: Ed Schwalenberg +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? +To: David Vinayak Wallace , + info-its@ai.ai.mit.edu +cc: unix-haters@ai.ai.mit.edu, gls@think.com +In-Reply-To: <8912150357.AA06208@Gang-of-Four.Stanford.EDU> +Message-ID: <19891215195628.4.ED@PEREGRINE.SCRC.Symbolics.COM> + + Date: Thu, 14 Dec 89 19:57:05 -0800 + From: David Vinayak Wallace + + Those who never used TS BEAR may not recognise the message above, but + those who do may be amused by how the cookie bear got permuted by the + time the unix weenies heard about it. Then again, note his last + question... + + >From: kim@watsup.waterloo.edu (T. Kim Nguyen) + Subject: "cookie" + Date: 11 Dec 89 09:13:31 GMT + + While the machine was being dismantled, someone took a look inside and + found this circuit board hooked into the machine. Guess what was + asking for cookies, and had not been found, even after people searched + high and low through the software for the cookie monster... + +I heard this story when I entered MIT in September 1974. The version I +heard allegedly took place at Dartmouth, and the cookie monster wouldn't +go away even after the OS was changed; it took a TTY33 repairperson to +discover the hardware hack in the system console. + +I wrote a cookie program for the PDP-8 at MIT's Weather Radar group when +I worked there in the summer of 1975, based on the story I had heard. +I wasn't aware of TS BEAR until much later, although I don't know when +it was written or what inspiration its author (who I think was GLS) had. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 12:51:50 EST +Received: from orville.nas.nasa.gov by mintaka.lcs.mit.edu id aa09814; + 15 Dec 89 12:45 EST +Received: Fri, 15 Dec 89 09:35:06 PST by orville.nas.nasa.gov (5.59/1.2) +Date: Fri, 15 Dec 89 09:35:06 PST +From: John Lekashman +Message-Id: <8912151735.AA21356@orville.nas.nasa.gov> +To: gumby@gang-of-four.stanford.edu, info-its@AI.ai.mit.edu +Subject: Re: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? +Cc: unix-haters@AI.ai.mit.edu + +The answer is yes. +Either it really happened, or all of Seymour Papert's students +are on drugs is true. (oooooeeeee-eeeee). At least back in +the 70s. + john + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 14 Dec 89 23:01:56 EST +Received: from Gang-of-Four.Stanford.EDU by mintaka.lcs.mit.edu id aa22227; + 14 Dec 89 22:57 EST +Received: by Gang-of-Four.Stanford.EDU (5.61/inc-1.0) + id AA06208; Thu, 14 Dec 89 19:57:05 -0800 +Date: Thu, 14 Dec 89 19:57:05 -0800 +From: David Vinayak Wallace +Message-Id: <8912150357.AA06208@Gang-of-Four.Stanford.EDU> +To: info-its@ai.ai.mit.edu +Cc: unix-haters@ai.ai.mit.edu +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? + +Those who never used TS BEAR may not recognise the message above, but +those who do may be amused by how the cookie bear got permuted by the +time the unix weenies heard about it. Then again, note his last +question... + +Makes one wonder what the loser who wrote the Canonical Losing Unix +Mailer thought he was writing. + +>From: kim@watsup.waterloo.edu (T. Kim Nguyen) +Newsgroups: alt.folklore.computers +Subject: "cookie" +Message-ID: +Date: 11 Dec 89 09:13:31 GMT + +OK, here's another one I heard about. This one (I was told) happened +at MIT, back in the 70s (oooooeeeee-ooooo), on some big network type +machine. At the same time every day, a message would appear on +people's terminals, saying "Give me a cookie". And if they did +nothing, the machine would burp and kill their process or something. +Eventually someone, in response to that message, typed "cookie", and +the machine said "thanks" and continued working normally. For the +remainder of the machine's lifetime, people would type "cookie" at the +same time every day and take it for granted that they had to do this. + +While the machine was being dismantled, someone took a look inside and +found this circuit board hooked into the machine. Guess what was +asking for cookies, and had not been found, even after people searched +high and low through the software for the cookie monster... + +So -- did this really happen, or are all of Seymour Papert's students +on drugs? :-) + +-- +T. Kim Nguyen kim@watsup.waterloo.{edu|cdn} + kim@watsup.uwaterloo.ca + {uunet|utzoo|utai|decvax}watmath!watsup!kim +Systems Design Engineering -- University of Waterloo, Ontario, Canada + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 9 Nov 89 10:10:19 EST +Received: from [128.81.41.109] by mintaka.lcs.mit.edu id aa23311; + 9 Nov 89 10:05 EST +Received: from PEREGRINE.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 347958; 9 Nov 89 10:03:40 EST +Date: Thu, 9 Nov 89 10:03 EST +From: Ed Schwalenberg +Subject: looking for old weirdness +To: "Pandora B. Berman" , + BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +cc: rdm%ncsa.uiuc.edu@mintaka.lcs.mit.edu +In-Reply-To: <666900.891109.CENT@AI.AI.MIT.EDU> +Message-ID: <19891109150307.9.ED@PEREGRINE.SCRC.Symbolics.COM> + + Date: Thu, 9 Nov 89 04:19:39 EST + From: "Pandora B. Berman" + + Date: Fri, 3 Nov 89 13:32:49+060 + From: "Ronald D. Mabbitt" + To: cent@ai.ai.mit.edu + Subject: Zork, mdl, etc! + Hi, I'm trying to find the original MDL Zork and MDL compiler and + MDL manuals, etc, for possible academic anduse research use. Is + it findable? It should be all old DARPA stuff, so there shouldn't + be any licencing problems... + + anyone know where this stuff might be hiding? + +Presumably the MDL manuals can be found in the LCS Reading Room. +The compiler sources are probably on DM backup tapes, wherever +they've gone. Perhaps sources to the manuals are also on backup +tape. + +The sources to Zork itself were not kept online, or if they were, they +were kept encrypted. I doubt you could resurrect it without help from +one of the original Zork wizards. + +You might ask TAA (Tim Anderson), who's now at Interleaf, 577-9800. +My recollection is that he was only peripherally involved with Zork, +but he might know how to get in touch with the others. + +Date: Thu, 9 Nov 89 04:19:39 EST +From: "Pandora B. Berman" +Subject: looking for old weirdness +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: rdm%ncsa.uiuc.edu@MINTAKA.LCS.MIT.EDU +Message-ID: <666900.891109.CENT@AI.AI.MIT.EDU> + + Date: Fri, 3 Nov 89 13:32:49+060 + From: "Ronald D. Mabbitt" + To: cent@ai.ai.mit.edu + Subject: Zork, mdl, etc! + Hi, I'm trying to find the original MDL Zork and MDL compiler and + MDL manuals, etc, for possible academic anduse research use. Is + it findable? It should be all old DARPA stuff, so there shouldn't + be any licencing problems... + +anyone know where this stuff might be hiding? + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 23 Oct 89 19:56:21 EDT +Received: from life.ai.mit.edu by mintaka.lcs.mit.edu id aa01041; + 23 Oct 89 19:47 EDT +Received: from wheat-chex (wheat-chex.ai.mit.edu) by life.ai.mit.edu (4.0/AI-4.10) id AA29244; Mon, 23 Oct 89 19:48:03 EDT +From: "Leonard N. Foner" +Received: by wheat-chex (4.0/AI-4.10) id AA10349; Mon, 23 Oct 89 19:47:51 EDT +Date: Mon, 23 Oct 89 19:47:51 EDT +Message-Id: <8910232347.AA10349@wheat-chex> +To: CENT%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +Cc: ALAN%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + FONER%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + BUG-INQUIR%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: "Pandora B. Berman"'s message of Mon, 23 Oct 89 19:08:26 EDT <659250.891023.CENT@AI.AI.MIT.EDU> +Subject: inquir broken + + Date: Mon, 23 Oct 89 19:08:26 EDT + From: "Pandora B. Berman" + + Date: Mon, 23 Oct 89 15:20 PDT + From: Alan Bawden + Subject: inquir broken + To: foner@ai.mit.edu + Cc: CENT@ai, BUG-INQUIR@ai, BUG-ITS@ai, ARCHY@ai + Date: Tue, 17 Oct 89 22:29:41 EDT + From: "Leonard N. Foner" + I just fixed ARCHY's address to say + ...@ELEPHANT-BUTTE.SCRC.SYMBOLICS.COM. Just specifying + @SYMBOLICS.COM yields nondeterministic results + The results are completely deterministic since we go out of our way to + keep the name "Symbolics.COM" attached to -some- host in the host table + we use. (Remember host tables? -- we still use 'em.) I don't happen + to know which host that is at the moment, perhaps we need to move it to + Elephant-Butte. + Note that using "Symbolics.COM" or "Elephant-Butte.SCRC.Symbolics.COM" + in the NAMES file or INQUIR database does -not- affect what address the + mailer uses in delivering the mail. In either case it will be + canonicalized to the primary name of the host (Elephant-Butte in this + case). + no, SCRC (and the other standard names) all canonicalize to STONY-BROOK. + +That's fine. Since the "@SYMBOLICS.COM" is hidden from the mailer at +Stony by the mailing list expansion on AI, the Stony mailer can't spazz +and do something stupid. + + So perhaps someone should put Bill's address back the way it was + before... + i did that the next time i had an occasion to go into NAMES >.. + +Okay, thanks. I was under the mistaken assumption that everything that +looked like a domain name was getting delivered to Mintaka for domain +lookup and delivery. Guess not. (Guess I was confused by all the +@MINTAKA's all over ITS headers since the ARPAnet evaporated.) + + + +Date: Mon, 23 Oct 89 19:08:26 EDT +From: "Pandora B. Berman" +Subject: inquir broken +To: ALAN%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: FONER%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, BUG-INQUIR%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, + BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <659250.891023.CENT@AI.AI.MIT.EDU> + + Date: Mon, 23 Oct 89 15:20 PDT + From: Alan Bawden + Subject: inquir broken + To: foner@ai.mit.edu + Cc: CENT@ai, BUG-INQUIR@ai, BUG-ITS@ai, ARCHY@ai + Date: Tue, 17 Oct 89 22:29:41 EDT + From: "Leonard N. Foner" + I just fixed ARCHY's address to say + ...@ELEPHANT-BUTTE.SCRC.SYMBOLICS.COM. Just specifying + @SYMBOLICS.COM yields nondeterministic results + The results are completely deterministic since we go out of our way to + keep the name "Symbolics.COM" attached to -some- host in the host table + we use. (Remember host tables? -- we still use 'em.) I don't happen + to know which host that is at the moment, perhaps we need to move it to + Elephant-Butte. + Note that using "Symbolics.COM" or "Elephant-Butte.SCRC.Symbolics.COM" + in the NAMES file or INQUIR database does -not- affect what address the + mailer uses in delivering the mail. In either case it will be + canonicalized to the primary name of the host (Elephant-Butte in this + case). +no, SCRC (and the other standard names) all canonicalize to STONY-BROOK. + + So perhaps someone should put Bill's address back the way it was + before... +i did that the next time i had an occasion to go into NAMES >. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 23 Oct 89 18:37:11 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa16237; + 23 Oct 89 18:24 EDT +Received: from roo.parc.Xerox.COM by arisia.Xerox.COM with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA06924; Mon, 23 Oct 89 15:21:20 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA05120; Mon, 23 Oct 89 15:22:23 PDT +Date: Mon, 23 Oct 89 15:20 PDT +From: Alan Bawden +Subject: inquir broken +To: foner@ai.mit.edu +Cc: CENT%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + BUG-INQUIR%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu, + ARCHY%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <8910180229.AA08171@wheat-chex> +Message-Id: <19891023222018.3.ALAN@MR-BUN.parc.xerox.com> + + Date: Tue, 17 Oct 89 22:29:41 EDT + From: "Leonard N. Foner" + I just fixed ARCHY's address to say ...@ELEPHANT-BUTTE.SCRC.SYMBOLICS.COM. + Just specifying @SYMBOLICS.COM yields nondeterministic + results + +The results are completely deterministic since we go out of our way to keep +the name "Symbolics.COM" attached to -some- host in the host table we use. +(Remember host tables? -- we still use 'em.) I don't happen to know which +host that is at the moment, perhaps we need to move it to Elephant-Butte. + +Note that using "Symbolics.COM" or "Elephant-Butte.SCRC.Symbolics.COM" in +the NAMES file or INQUIR database does -not- affect what address the mailer +uses in delivering the mail. In either case it will be canonicalized to +the primary name of the host (Elephant-Butte in this case). + +So perhaps someone should put Bill's address back the way it was before... + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 17 Oct 89 22:37:12 EDT +Received: from life.ai.mit.edu by mintaka.lcs.mit.edu id aa18749; + 17 Oct 89 22:29 EDT +Received: from wheat-chex (wheat-chex.ai.mit.edu) by life.ai.mit.edu (4.1/AI-4.10) id AA06601; Tue, 17 Oct 89 22:29:51 EDT +From: "Leonard N. Foner" +Received: by wheat-chex (4.0/AI-4.10) id AA08171; Tue, 17 Oct 89 22:29:41 EDT +Date: Tue, 17 Oct 89 22:29:41 EDT +Message-Id: <8910180229.AA08171@wheat-chex> +To: CENT%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Cc: BUG-INQUIR%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + ARCHY%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +In-Reply-To: "Pandora B. Berman"'s message of Tue, 17 Oct 89 02:43:42 EDT <656327.891017.CENT@AI.AI.MIT.EDU> +Subject: inquir broken +Cc: foner@ai.mit.edu + + Date: Tue, 17 Oct 89 02:43:42 EDT + From: "Pandora B. Berman" + + i was trying to fix ARCHY's inquir entry to show his real net address, + which is york%ila-west.dialnet.symbolics.com@symbolics.com. inquir has been + fukt over (yes, i know, several years ago) so that it refuses to accept + this address on the grounds that it is "too long for this item". when i ran + inquir on AI, this msg flashed by before i could see it, and i was + confronted merely with an altered inquir entry listing giving "T" as the + address. fortunately i examined the modified entry and so did not send it + off for installation. when i supduped over to MC, inquir showed me the + error msg with a decent delay. on both machines, what seems to occur is + that a T replaces the so-called too-long item, and the too-long item + ends up appearing as if it had been typed to the What next? question. + anyway, i had to go into NAMES > in order to fix archy's address.. + +I just fixed ARCHY's address to say ...@ELEPHANT-BUTTE.SCRC.SYMBOLICS.COM. +Just specifying @SYMBOLICS.COM yields nondeterministic +results---sometimes, the mailer at whichever machine at Symbolics +happens to get the mail becomes confused and will do something random +with such an address, because the mailer doesn't yet "really" +understand domains and sometimes thinks, "Wait, there's no site named +Symbolics... I guess I'll do something weird." (There *is* a site +named SCRC, but...) + +It'll be a while until the mailer does understand domains correctly. Until +then, you should specify a real host, not a domain. + + + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 17 Oct 89 12:30:18 EDT +Received: from ALEXANDER.BBN.COM by mintaka.lcs.mit.edu id aa11140; + 17 Oct 89 12:19 EDT +To: "Pandora B. Berman" +cc: BUG-INQUIR%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + ARCHY%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Subject: Re: inquir broken +In-reply-to: Your message of Tue, 17 Oct 89 02:43:42 -0400. + <656327.891017.CENT@AI.AI.MIT.EDU> +Date: Tue, 17 Oct 89 12:08:22 -0400 +From: cstacy@bbn.com +Message-ID: <8910171219.aa11140@mintaka.lcs.mit.edu> + + Date: Tue, 17 Oct 89 02:43:42 EDT + From: "Pandora B. Berman" + Message-ID: <656327.891017.CENT@AI.AI.MIT.EDU> + + i was trying to fix ARCHY's inquir entry to show his real net address, + which is york%ila-west.dialnet.symbolics.com@symbolics.com. inquir has been + fukt over (yes, i know, several years ago) so that it refuses to accept + this address on the grounds that it is "too long for this item". + +I don't understand this part of the bug report. The system has always had +fixed limits on the length of the items. The limits are defined in the file +LSRTNS, and there is also a definition in INQUIR which must be kept in step. +If INQUIR were to accept an overly long item, the INQUPD program would simply +truncate the item, and mail back a message to the luser indicating that the +data was truncated. That the user interface doesn't let things get that far, +is definitely a feature. (This is especially true if the field under +discussion is the network address!) + +If your complaint is that 40 characters is too small, in these days of kludged +up mailing addresses, I'd believe that. It takes somewhat of an operation to +change the database format though. + + when i ran + inquir on AI, this msg flashed by before i could see it, and i was + confronted merely with an altered inquir entry listing giving "T" as the + address. fortunately i examined the modified entry and so did not send it + off for installation. when i supduped over to MC, inquir showed me the + error msg with a decent delay. on both machines, what seems to occur is + that a T replaces the so-called too-long item, and the too-long item + ends up appearing as if it had been typed to the What next? question. + anyway, i had to go into NAMES > in order to fix archy's address.. + +I have a version of INQUIR in which this bug is probably fixed, but I'm going +to wait until I happen by MIT to try it out; it's too painful to debug over +lots of telnet hops and so forth. + + +Date: Tue, 17 Oct 89 02:43:42 EDT +From: "Pandora B. Berman" +Subject: inquir broken +To: BUG-INQUIR%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: ARCHY%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <656327.891017.CENT@AI.AI.MIT.EDU> + +i was trying to fix ARCHY's inquir entry to show his real net address, +which is york%ila-west.dialnet.symbolics.com@symbolics.com. inquir has been +fukt over (yes, i know, several years ago) so that it refuses to accept +this address on the grounds that it is "too long for this item". when i ran +inquir on AI, this msg flashed by before i could see it, and i was +confronted merely with an altered inquir entry listing giving "T" as the +address. fortunately i examined the modified entry and so did not send it +off for installation. when i supduped over to MC, inquir showed me the +error msg with a decent delay. on both machines, what seems to occur is +that a T replaces the so-called too-long item, and the too-long item +ends up appearing as if it had been typed to the What next? question. + anyway, i had to go into NAMES > in order to fix archy's address. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 30 Sep 89 22:10:18 EDT +Received: from STONY-BROOK.SCRC.SYMBOLICS.COM by mintaka.lcs.mit.edu id aa14259; + 30 Sep 89 20:28 EDT +Received: from OWL.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 667215; 30 Sep 89 20:29:16 EDT +Date: Sat, 30 Sep 89 20:29 EDT +From: Mike McMahon +Subject: can't yank from bolix +To: Alan Bawden +cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <19890930212059.0.ALAN@MR-BUN.parc.xerox.com> +Message-ID: <19891001002913.4.MMCM@OWL.SCRC.Symbolics.COM> + + Date: Sat, 30 Sep 89 14:20 PDT + From: Alan Bawden + + This has a glitch: If nobody is reading anything out of the tty input + buffer, like if your program is running and not looking for typein, and the + buffer gets full, then you won't be able to ^Z it. The ^Z will just sit in + a network buffer and never make it into the tty code (which checks for ^Z + and ^_ does some other processing, before it even considers putting + anything in the input buffer). + + I'll bet that the Sun you tried probably has the Unix-analog of this + glitch: if a program isn't reading from the terminal, then input can get + backed up sufficiently (perhaps back across the network) so that you can't + do anything to interrupt it. + +Fixed in Tenex :-) + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 30 Sep 89 19:46:39 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa13872; + 30 Sep 89 19:41 EDT +Received: from roo.parc.Xerox.COM by arisia.Xerox.COM with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA25560; Sat, 30 Sep 89 14:23:07 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA19080; Sat, 30 Sep 89 14:23:07 PDT +Date: Sat, 30 Sep 89 14:20 PDT +From: Alan Bawden +Subject: can't yank from bolix +To: ZVONA%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +Cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <650153.890930.ZVONA@AI.AI.MIT.EDU> +Message-Id: <19890930212059.0.ALAN@MR-BUN.parc.xerox.com> + + Date: Sat, 30 Sep 89 14:24:09 EDT + From: David Chapman + + The bolix has this winning feature where you can send the top of the + (bolix) kill ring to a terminal window input stream, simulating the + user typing that text. This doesn't work on ITS. It does work on a + random sun I just used as a test case. ITS seems to drop all but the + first 50 characters or so. Big lose. What's the story? Can this be + fixed? + +The problem is that when a network connection is direct-connected to a STY, +the clock level routine that transfers characters from the net to the STY +just blasts away without checking if there is room in the 65-character tty +input buffer. (Note that on hardwired terminals, users can't type fast +enough to fill up this buffer -- and if they do the system dings at them. +Also ordinary .IOT to a STY will hang if there isn't room in the buffer.) + +The two routines STYCHA and STYTCP could be given a few instructions to +check to see if the buffer is full, and if so, stop blasting. No blocking +or anything complicated would be needed, since you're going to come back +and look for more characters to move in the next clock tick anyway. + +This has a glitch: If nobody is reading anything out of the tty input +buffer, like if your program is running and not looking for typein, and the +buffer gets full, then you won't be able to ^Z it. The ^Z will just sit in +a network buffer and never make it into the tty code (which checks for ^Z +and ^_ does some other processing, before it even considers putting +anything in the input buffer). + +I'll bet that the Sun you tried probably has the Unix-analog of this +glitch: if a program isn't reading from the terminal, then input can get +backed up sufficiently (perhaps back across the network) so that you can't +do anything to interrupt it. + +Of course you might argue that the glitch is worth the convenience of being +able to type extremently fast... + +Date: Sat, 30 Sep 89 14:24:09 EDT +From: David Chapman +Subject: can't yank from bolix +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <650153.890930.ZVONA@AI.AI.MIT.EDU> + +The bolix has this winning feature where you can send the top of the +(bolix) kill ring to a terminal window input stream, simulating the +user typing that text. This doesn't work on ITS. It does work on a +random sun I just used as a test case. ITS seems to drop all but the +first 50 characters or so. Big lose. What's the story? Can this be +fixed? + +Date: Wed, 20 Sep 89 04:14:02 EDT +From: "Pandora B. Berman" +Subject: ai crash +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <646359.890920.CENT@AI.AI.MIT.EDU> + + Date: Tue, 19 Sep 89 11:47 PDT + From: Alan Bawden + Subject: ai crash + To: Moon@stony-brook.scrc.symbolics.com, + CENT%AI.AI.MIT.EDU@mintaka.lcs.mit.edu + Cc: BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu + Date: Tue, 19 Sep 89 11:11 EDT + From: "David A. Moon" + Date: Tue, 19 Sep 89 02:05:05 EDT + From: "Pandora B. Berman" + KS10 CSL.V5.2 + BT AUTO + + DSKDMP + Isn't that the usual symptom of powering the machine off and back + on again? Perhaps there was a power surge. + + Right, the 8080 prints its herald ("KS10 CSL.V5.2") only when it is + reset. So either there was a power-glitch of some sort, or somebody + pushed the RESET switch on the front of the machine. + +i suppose. i was logged in through ML's hardwired VT52 though; i don't +think there was anyone else on the floor at that hour (2am), much less +anyone who would fiddle with the buttons on any ITS, and if there was a +power surge it was very local, because neither MC nor ML were affected, nor +did i notice more macroscopic effects (fluorescents blinking). + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 19 Sep 89 15:05:48 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa17032; + 19 Sep 89 14:50 EDT +Received: from roo.parc.Xerox.COM by arisia.Xerox.COM with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA26638; Tue, 19 Sep 89 11:45:07 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA14847; Tue, 19 Sep 89 11:49:05 PDT +Date: Tue, 19 Sep 89 11:47 PDT +From: Alan Bawden +Subject: ai crash +To: Moon@stony-brook.scrc.symbolics.com, + CENT%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Cc: BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +In-Reply-To: <19890919151141.8.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-Id: <19890919184758.1.ALAN@MR-BUN.parc.xerox.com> + + Date: Tue, 19 Sep 89 11:11 EDT + From: "David A. Moon" + + Date: Tue, 19 Sep 89 02:05:05 EDT + From: "Pandora B. Berman" + KS10 CSL.V5.2 + BT AUTO + + DSKDMP + + Isn't that the usual symptom of powering the machine off and back on + again? Perhaps there was a power surge. + +Right, the 8080 prints its herald ("KS10 CSL.V5.2") only when it is reset. +So either there was a power-glitch of some sort, or somebody pushed the +RESET switch on the front of the machine. + +(After about 30 seconds, if you don't type anything at the 8080, it decides +that probably you want it to boot the machine. So it pretends you gave it +the "BT" command (it types "BT AUTO" to let you know what it is doing) +which starts up a DSKDMP (if you have an ITS pack mounted on unit 0).) + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 19 Sep 89 11:17:08 EDT +Received: from STONY-BROOK.SCRC.SYMBOLICS.COM by mintaka.lcs.mit.edu id aa13635; + 19 Sep 89 11:11 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 660133; 19 Sep 89 11:11:36 EDT +Date: Tue, 19 Sep 89 11:11 EDT +From: "David A. Moon" +Subject: ai crash +To: "Pandora B. Berman" +cc: BUG-ITS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +In-Reply-To: <645824.890919.CENT@AI.AI.MIT.EDU> +Message-ID: <19890919151141.8.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Tue, 19 Sep 89 02:05:05 EDT + From: "Pandora B. Berman" + + for absolutely no apparent reason, ai crashed this morning. it had just + printed a line on the console giving the date & time (IT IS NOW...), + then there was a blank line followed by + KS10 CSL.V5.2 + BT AUTO + + DSKDMP + +Isn't that the usual symptom of powering the machine off and back on +again? Perhaps there was a power surge. + +Date: Tue, 19 Sep 89 02:05:05 EDT +From: "Pandora B. Berman" +Subject: ai crash +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <645824.890919.CENT@AI.AI.MIT.EDU> + +for absolutely no apparent reason, ai crashed this morning. it had just +printed a line on the console giving the date & time (IT IS NOW...), +then there was a blank line followed by +KS10 CSL.V5.2 +BT AUTO + + DSKDMP + +i dumped it to CRASH;HUH WHAT, even though i rather doubt the crash dump +will be useful. then i reloaded with no problems. maybe it was cosmic rays +or something. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 10 Sep 89 18:45:52 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa23016; + 10 Sep 89 18:37 EDT +Received: from roo.parc.Xerox.COM by arisia.Xerox.COM with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA19688; Sun, 10 Sep 89 15:33:12 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA03302; Sun, 10 Sep 89 15:36:37 PDT +Date: Sun, 10 Sep 89 15:34 PDT +From: Alan Bawden +Subject: 25th Anniversary of 36 Bits +To: Info-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +Supersedes: <19890910220047.1.ALAN@MR-BUN.parc.xerox.com> +Comments: There is too a host named MINTAKA.LCS.MIT.EDU. Try again, Unix braindeath. +Message-Id: <19890910223434.2.ALAN@MR-BUN.parc.xerox.com> + +Article 471 of comp.org.decus: +From: clive@pp.ACA.MCC.COM (Clive Dawson) +Newsgroups: comp.arch,comp.org.decus +Subject: 25th Anniversary of 36 Bits +Keywords: 36-bits DEC-10 DEC-20 DECUS +Date: 5 Sep 89 17:05:12 GMT +Organization: MCC, Austin, TX + +[The number of people who contributed to the recent discussion on +Digital's 36-bit architecture made it seem appropriate to post this +message here. My apologies for straying from the main subject +matter.] + +A special event will take place at the Fall DECUS Symposium in Anaheim, +California, November 6-10, 1989: The 25th Anniversary of 36-bit systems +will be celebrated. In 1964, Digital announced the PDP-6. Twenty-five +years later, the 36-bit architecture is still here serving a loyal +customer base. + +The celebration will take place on the evening of Monday, November 6, +1989. The usual DEC 10/20 Update Session will be held from 3-5 PM. +Last-minute announcements regarding Anniversary events will be made at +this session, as well as in the Monday edition of Update.Daily (the +Symposium newspaper). A meeting room in one of the Symposium hotels +(Hilton or Marriott) will be made available for the anniversary +events, which include: + + -- 36-Bit JEOPARDY! + In the tradition of the 36-bit Trivia Bowl held at the + 20th Anniversary celebration, experts on the history + and folklore of 36-bit systems will compete against + each other. Come and match wits with them! + + -- Memorabilia Exhibit and Swap + You are encouraged to bring old manuals, listings, + pieces of hardware (e.g. KA and/or KI consoles!), + posters, buttons, tapes, and any other items related + to 36-bit systems for exhibiting and/or swapping. + Table space will be made available. + + -- Anniversary Dinner + + Dinner plans are not yet firm. It will either be + catered by the hotel or we will adjourn to a nearby + restaurant. + + -- 36-Bit Magic & War Stories + Following dinner we will swap war stories and other + legends of 36-bit lore. One of the most popular + events of the 1984 celebration will be repeated: a + reading of several infamous SPR's (and their equally + infamous replies.) Come prepared to share share your + favorite stories. Prizes for the best will be + awarded. + +Note that these four events will NOT appear in the DECUS schedule +since they are not official DECUS functions (and therefore do not +require conference registration.) If you are planning to attend any +of the 25th Anniversary events, please notify me as soon as possible, +since we need to get a reasonable estimate on the number of people to +expect. (Dinner plans depend on this, so please try not to delay.) + + E-mail: Internet: Clive@MCC.COM + UUCP: ...!cs.utexas.edu!pp!clive + U.S. mail: MCC, 3500 West Balcones Center, Austin, TX 78759 + Phone: (512) 338-3430 + +This will also enable us to create a mailing list for any last minute +announcements regarding the events. If you would like table space for +exhibits, please mention this. Suggestions regarding dinner plans are +also welcome. It may be difficult to find a reasonable restaurant +nearby that could handle this. The 20th anniversary dinner was done +by the hotel at a cost of $36/person (what else?!). Is this a +reasonable fee? If not, let me know how much you would be willing to +pay. + +This message is being sent to the TOPS-20 mailing list and the +comp.arch and comp.org.decus news groups. Please redistribute as you +see fit and pass the word to other 36-bitters who may not otherwise +find out about this. + +See you in Anaheim! + +Clive Dawson + +Date: Thu, 7 Sep 89 22:08:49 EDT +From: "Pandora B. Berman" +Subject: quick dump fix +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <641945.890907.CENT@AI.AI.MIT.EDU> + + Date: Sat, 2 Sep 89 14:16 PDT + From: Alan Bawden + Subject: ml and mc stuff + To: CENT%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu + Date: Fri, 1 Sep 89 18:04:18 EDT + From: "Pandora B. Berman" + i got a good version off tape 238, and repaired the data for 238 + (which was fine except for claiming you ABRTed rather than DUMPed) + and 239. i note that TAPSET automatically sets the user to be the + tape writer, which i suppose is not unfair. the broken version of + ML:MACRO TAPES is now MACRO XT. it claims to be the same length as + the good one. ZVONA usd HEP to dump 239 rather than bonzo, which + might have had some effect on the situation. i'm not sure who to + refer the matter to for more inspection. + The file was busted -before- ZVONA did a dump, so that can't be a + problem. Since you apparently got a good version back from 238, then + it must have been OK at the beginning of the dump (when it was written + to tape) and was then clobbered before the end of the dump (because the + damaged file -did- contain a record for tape 238). + + The file contains nothing but zeros other than the records for the two + tapes 238 and 329 (alias 239), just as if DUMP had decided to create an + empty database. Thus I suspect that DUMP decided erroneously that the + MACRO TAPES file didn't exist (probably it got some error other than + FILE NOT FOUND when it when to open it) and decided to recreate it. A + PDP-10 hacker (with a reasonable connection) can fix this in nothing + flat. All he has to do is visit all the places in DUMP where the MACRO + TAPES file is manipulated and fix them to be more careful. (Dave could + do this in his sleep -- if my guess about the problem is correct.) + +would a PDP-10 hacker with a reasonable connection please look into this so +i don't have to keep checking the MACRO TAPES file each time i use DUMP? +thx. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 7 Sep 89 12:11:33 EDT +Received: from STONY-BROOK.SCRC.SYMBOLICS.COM by mintaka.lcs.mit.edu id aa08922; + 7 Sep 89 12:01 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 653730; 7 Sep 89 12:03:04 EDT +Date: Thu, 7 Sep 89 12:02 EDT +From: "David A. Moon" +Subject: It's so easy to forget +To: Richard Mlynarik +cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <641460.890906.MLY@AI.AI.MIT.EDU> +Message-ID: <19890907160253.4.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed, 6 Sep 89 19:36:12 EDT + From: Richard Mlynarik + + It's so easy to forget that after one's Macintosh has crashed because + of NCSA Telnet not checking for out-of-free-memory conditions and + after one's unix "tcp/chaos gateway" telnet login session has been + dropped on the floor (because the TCP stream died) that when one + eventually re-reaches poor internetworkless AI that one will be + greeted with a cheery + --Attach Your Detached Tree-- + +Or in the words of that bouncy, upbeat reggae tune we were hearing +a lot of about 6 or 7 years ago: "Every day, everything is getting +worse." There's also one which claims to be about Babylon, but I +think it's really about Unix, "Total destruction, only solution." + +Date: Thu, 7 Sep 89 07:47:35 EDT +From: Robert Huff +To: CENT%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <641633.890907.HUFF@AI.AI.MIT.EDU> + + +Hello: + A couple of times in the last couple days I have dialed in to AI and +the screen/cursor control didn't work. I tried logging out, including off of +the terminal access, and back in again. No luck. + Yesterday evening it happened while I was logged on. THe first 5-10 +minutes of the session were fine, then there was a few moments (longer than +the usual delay from operating at 1200bps) of being unable to type into an +Emacs session. and suddenly the cursor control was gone. + + Thanks, + + Robert Huff + +Date: Wed, 6 Sep 89 19:36:12 EDT +From: Richard Mlynarik +Subject: It's so easy to forget +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <641460.890906.MLY@AI.AI.MIT.EDU> + +It's so easy to forget that after one's Macintosh has crashed because +of NCSA Telnet not checking for out-of-free-memory conditions and +after one's unix "tcp/chaos gateway" telnet login session has been +dropped on the floor (because the TCP stream died) that when one +eventually re-reaches poor internetworkless AI that one will be +greeted with a cheery +--Attach Your Detached Tree-- + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 30 Aug 89 20:29:29 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa22219; + 30 Aug 89 20:24 EDT +Received: from roo.parc.Xerox.COM by arisia.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA04145; Wed, 30 Aug 89 17:20:46 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA13692; Wed, 30 Aug 89 17:23:30 PDT +Date: Wed, 30 Aug 89 17:22 PDT +From: Alan Bawden +Subject: ml and mc stuff +To: CENT%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +Cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <639391.890830.CENT@AI.AI.MIT.EDU> +Message-Id: <19890831002221.0.ALAN@MR-BUN.parc.xerox.com> + + Date: Wed, 30 Aug 89 17:03:03 EDT + From: "Pandora B. Berman" + you were going to drop us a note explaining how to avoid mc's frequent + parerr losses. + +Here is what you do to disable parity checking: At any time -after- you +have started DSKDMP, type ^\ to get the 8080's attention. This should +result in a "KS10>" prompt. The you type "PE0" followed by a carrage +return. You should get another "KS10>" prompt. Then type ^Z. The 8080 +will type "USR MOD" and now you are back where you were before you typed +the ^\. + +The reason you have to wait until after starting DSKDMP is that the BT +command turns parity checking on. + +You really can do this at -any- time once the PDP10 is rinning. You can +even walk up to a running ITS and do this. And in fact you should probably +do this to MC as soon as possible. + + also, exactly what is it that's wrong with ML and needs + to be fixed asap? the macro tapes file? + +Right. You can easily see that it is broken by going into DUMP and giving +the TAPES command. The output looks like: + + _tapes + LIST DEV =tty + 238 890804 INCR ALAN5 DUMP 0 . SYSHST + 329 890814 INCR ZVONA DUMP 0 . USERS2 + +Where the hell are the rest of the tapes? (And yeah, Zvona must have +typoed when he made that incremental...) A hacker should look at the bits +in the existing MACRO TAPES file to see if he or she can figure out what +went wrong. (The latest version of DUMP is a suspect.) + +To repair the damage, first restore the MACRO TAPES file from tape (try +tape 238 first, then 237, etc.), and then use the TAPSET command to enter +the information that is missing. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 14 Aug 89 16:46:09 EDT +Received: from Xerox.COM by mintaka.lcs.mit.edu id aa27549; 14 Aug 89 16:43 EDT +Received: from Semillon.ms by ArpaGateway.ms ; 14 AUG 89 13:38:49 PDT +Date: Mon, 14 Aug 89 13:32 PDT +From: bawden.pa@xerox.com +Subject: Well, -we- had an earthquake. +To: ZVONA%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +In-Reply-To: <633201.890813.ZVONA@AI.AI.MIT.EDU> +Message-ID: <19890814203257.2.ALAN@ROCKY.parc.xerox.com> +Line-fold: no + + Date: Sun, 13 Aug 89 13:54:15 EDT + From: David Chapman + At 10:09 this morning all the ITSes apparently died. The consoles + said BT AUTO and were in DSKDMP. I take it this is what happens when + the power glitches? + +Yup. + (Probaly the fault of the thunderstorms.) + +I hope they were good thunderstorms! + + Anyway, I dumped to ai;auto boot? (probably useless) and booted OK. + +Yeah, crash dumps are always useless after the 8080 has booted the machine +since that clears core. Of course it can't -hurt- to take a crash dump -- +you can tell that a crash dump is probably useless if it is very small. +(The AUTO BOOT? dump you made is only a block long...) +------- + +Date: Sun, 13 Aug 89 13:54:15 EDT +From: David Chapman +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <633201.890813.ZVONA@AI.AI.MIT.EDU> + +At 10:09 this morning all the ITSes apparently died. The consoles +said BT AUTO and were in DSKDMP. I take it this is what happens when +the power glitches? (Probaly the fault of the thunderstorms.) +Anyway, I dumped to ai;auto boot? (probably useless) and booted OK. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 11 Aug 89 01:52:39 EDT +Received: from XEROX.COM by REAGAN.AI.MIT.EDU via INTERNET with SMTP id 248263; 11 Aug 89 01:49:41 EDT +Received: from Semillon.ms by ArpaGateway.ms ; 10 AUG 89 22:48:51 PDT +Date: Thu, 10 Aug 89 22:46 PDT +From: bawden.pa@Xerox.COM +Subject: Barf! +To: Bug-ITS@AI.AI.MIT.EDU +Message-ID: <19890811054636.5.ALAN@ROCKY.parc.xerox.com> +Line-fold: no + +The MACRO TAPES database on ML seems to be screwed up. This might be a +symptom of something wrong with the new DUMP I installed there before I +left for here. Symptom: Start DUMP. Give the "TAPES" command. There +only appears to be saved tape information for the most recently written +tape. + +I -thought- that the information saved in the records in SYSENG;MACRO TAPES +was unrelated to the format of actualy tape headers. Perhaps I was +wrong... (But I still don't understand how that could clobber the entire +database, even -old- versions of DUMP can't find any information.) + +Unfortunately for you all, I'm unlikely to be able to fix this from out +here. +------- + +Date: Thu, 20 Jul 89 14:58:16 EDT +From: David Chapman +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <623723.890720.ZVONA@AI.AI.MIT.EDU> + +AI died. Very dead; apparently a FEP crash, because the console +wouldn't respond to c-\. The BOOT switch didn't do anything either. +RESET woke up the FEP and it booted OK. Crash dump in CRASH;DEAD +IN-H2O. + +Date: Mon, 26 Jun 89 18:33:12 EDT +From: "Pandora B. Berman" +Subject: access to AI +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, mayer@IUVAX.CS.INDIANA.EDU +cc: amarylis@LIFE.AI.MIT.EDU +Message-ID: <614488.890626.CENT@AI.AI.MIT.EDU> + + From: amarylis@ai.mit.edu (Eva Berlandi) + Date: Mon, 26 Jun 89 17:01:04 EDT + To: all-ai@wheaties.ai.mit.edu + I got this message from this guy, and I can't help him, or know even if + I ought to: + + Date: Fri, 23 Jun 89 11:05:00 -0500 + From: mayer goldberg + To: amarylis@corn-chex.ai.mit.edu + Hello Ms. Berlandi, + I don't suppose you know me, as I was logged on corn-chex via + rms's account. I am trying to get to ai.ai.mit.edu, but had a + problem finding its internet address ... I finally got 10.2.0.6, + but it is not responding, so I am afraid, it must have been changed + ... Given that it is in the "AI Lab", would you be able to find the + address and send it to me? I would be most greatful to you. + Mayer Goldberg. + +Mr. Goldberg: Due to software rot, AI.AI.MIT.EDU is not directly on the +Internet. Since May, when our IMPs were turned off, AI has lived only on +our local ChaosNet, and has only been able to deal with the InterNet via +mail. All other connection protocols, including TELNET/SUPDUP, are +unusable until we get the necessary software written to put AI directly on +the Internet. If you think you have some special circumstance for +deserving access to AI, please send mail to USER-ACCOUNTS@AI.AI.MIT.EDU +explaining same, and we'll decide whether we agree and if so what we can do +about it. + +Amarylis: Questions concerning access to the AI machine (AI.AI.MIT.EDU) +should be sent to the address USER-ACCOUNTS here. Thanks. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 4 Jun 89 14:04:01 EDT +Received: from ML.AI.MIT.EDU (CHAOS 3133) by MC.LCS.MIT.EDU 4 Jun 89 14:03:38 EDT +Date: Sun, 4 Jun 89 14:03:09 EDT +From: Alan Bawden +Subject: it's a virus +To: ZVONA%ML.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: BUG-ITS%ML.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <10054.890604.ALAN@ML.AI.MIT.EDU> + + Date: Sat, 3 Jun 89 14:41:32 EDT + From: David Chapman + Subject: it's a virus + AI just crashed with parity error 377 001 300. That's the one we're + used to seeing on MC, right? + +Right, although MC doesn't seem to be getting them anymore... + + And it's never happened on AI before, right? + +Actually, I think this has happend on AI about twice before... + + + +Date: Sat, 3 Jun 89 14:41:32 EDT +From: David Chapman +Subject: it's a virus +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <603861.890603.ZVONA@AI.AI.MIT.EDU> + +AI just crashed with parity error 377 001 300. That's the one we're +used to seeing on MC, right? And it's never happened on AI before, +right? Shit. + +Date: Fri, 26 May 89 14:08:17 EDT +From: Richard Mlynarik +Subject: jobdev;chaos tcp +To: SRA%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <600669.890526.MLY@AI.AI.MIT.EDU> + +The lisp machines won't attempt to use TCP-GATEWAY on MC because +MC doesn't have an internet address. So what's the problem? + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 26 May 89 13:53:22 EDT +Received: from BIGBOOTE.LCS.MIT.EDU by REAGAN.AI.MIT.EDU via INTERNET with SMTP id 214249; 26 May 89 13:51:46 EDT +Received: by bigboote.LCS.MIT.EDU + id AA00896; Fri, 26 May 89 13:52:36 EDT +Date: Fri, 26 May 89 13:52:36 EDT +Message-Id: <8905261752.AA00896@bigboote.LCS.MIT.EDU> +From: Rob Austein +Sender: sra@bigboote.LCS.MIT.EDU +To: ZVONA@ai.ai.mit.edu, RS@ai.ai.mit.edu +Cc: BUG-ITS@ai.ai.mit.edu +In-Reply-To: David Chapman's message of Fri, 26 May 89 12:44:56 EDT <600506.890526.ZVONA@AI.AI.MIT.EDU> +Subject: system full + + Date: Fri, 26 May 89 12:17:38 EDT + From: David Chapman + + AI was dead in the water, typing Warning:system full, no job slots + on the console every two seconds. I crash dumped to crash;sys ful. I + don't know whether this is relevant, but it was getting a lot of + top-level interrupt 200s in TCP and CHAOS jobs not long before it lost + it. + + Date: Fri, 26 May 89 12:44:56 EDT + From: David Chapman + + Uh, actually, maybe the problem was that it was running ITS 1632 + (which RS brought up this morning) -- maybe something else has changed + incompatibly, like say COMSAT?. We're running 1633 again now. + +Given that ITS.1632 has TCP code which would presumably be somewhat +upset at the lack of an IMP behaving in any known fashion, this is not +terribly surprising. + +Yes, COMSAT would also be upset to find that AI was running ITS.1632 +again, since it determines what it should do about routing to TCP +hosts by asking the monitor if it supports TCP or not. + +Perhaps we should delete/hide JOBDEV;CHAOS TCP on AI and MC? It's not +like it's doing all those Lisp Machines any good to try getting to the +ARPANET via MC and AI anymore. + +Date: Fri, 26 May 89 13:30:39 EDT +From: Alan Bawden +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: ZVONA%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, RS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <600605.890526.ALAN@AI.AI.MIT.EDU> + +Right. There were a bunch of things all going wrong here, most +of them caused by the fact that the hosttable no longer +contains IP addresses for AI and MC. Certainly that is what +made COMSAT crash, and I'm pretty sure that that is what caused +the system to fill up with dead mail servers. + +Rob, you should learn to be more suspicious of situations where +you can't see any reason how something could fail to work. +(The current series of Calvin & Hobbes comes to mind...) + +Date: Fri, 26 May 89 12:44:56 EDT +From: David Chapman +Subject: system full +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: RS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <600506.890526.ZVONA@AI.AI.MIT.EDU> + +Uh, actually, maybe the problem was that it was running ITS 1632 +(which RS brought up this morning) -- maybe something else has changed +incompatibly, like say COMSAT?. We're running 1633 again now. + +Date: Fri, 26 May 89 12:17:38 EDT +From: David Chapman +To: BUG-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <600479.890526.ZVONA@AI.AI.MIT.EDU> + +AI was dead in the water, typing Warning:system full, no job slots +on the console every two seconds. I crash dumped to crash;sys ful. I +don't know whether this is relevant, but it was getting a lot of +top-level interrupt 200s in TCP and CHAOS jobs not long before it lost +it. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 2 May 89 17:53:25 EDT +Received: from BIGBOOTE.LCS.MIT.EDU by REAGAN.AI.MIT.EDU via INTERNET with SMTP id 202126; 2 May 89 17:46:58 EDT +Received: by bigboote.LCS.MIT.EDU + id AA01196; Tue, 2 May 89 17:48:20 EDT +Date: Tue, 2 May 89 17:48:20 EDT +Message-Id: <8905022148.AA01196@bigboote.LCS.MIT.EDU> +From: Rob Austein +Sender: sra@bigboote.LCS.MIT.EDU +To: PGS@ai.ai.mit.edu +Cc: BUG-ITS@ai.ai.mit.edu +In-Reply-To: "Patrick G. Sobalvarro"'s message of Tue, 2 May 89 17:33:17 EDT <589618.890502.PGS@AI.AI.MIT.EDU> +Subject: host tables in the brave new world + + Date: Tue, 2 May 89 17:33:17 EDT + From: "Patrick G. Sobalvarro" + + When we switched host table formats a few years ago, I stopped knowing + how to update them. Is there an easy way to add AI.MIT.EDU to them, now + that that's showing up as a return address on mail from the Unixes? + +You don't want to know. Really. You don't. + +The short answer is that everything came to a grinding halt when XX +went away and we are just about back on our feet now. If all goes +well, automatic table generation and installation should start up +again within a few days. + +Date: Tue, 2 May 89 17:33:17 EDT +From: "Patrick G. Sobalvarro" +Subject: host tables in the brave new world +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <589618.890502.PGS@AI.AI.MIT.EDU> + +When we switched host table formats a few years ago, I stopped knowing +how to update them. Is there an easy way to add AI.MIT.EDU to them, now +that that's showing up as a return address on mail from the Unixes? + +Received: from LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 31 Jan 89 19:28:23 EST +Date: Tue 31 Jan 89 19:23:58-EST +From: "J. Noel Chiappa" +To: Alan@AI.AI.MIT.EDU, SRA@LCS.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JNC@LCS.MIT.EDU +In-Reply-To: <19890131201142.2.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <12467048716.14.JNC@LCS.MIT.EDU> + + That is, he believed that there was something we could do, -if- we + knew the machine was about to crash, that would normalize relations + with the IMP so that the NOC's software not to bitch. + + This sounds sort of bogus to me. The p4200 ARPANet code +doesn't give any warning when *it's* going to crash, but the NOC +people don't seem to be turning p4200 ports off. Maybe it's just the +frequency of the crashes, which proably generate little 'Host X on IMP +Y went down' messages on te NOC console. I could also believe that the MC +IMP code is doing something that causes a message to come out, hence +the turnoff, but I'm not sure how likely this is. + + However, I think the whole issue is moot. According to what I +hear, they are going to turn off the ARPANet in the near future, and +*ALL* the MIT IMP's are going away. If you want any ITS (including MC, +which has out main mail forwarder) to have Internet access after that +date, someone better get busy and write some local net driver for the +machine (and then we can have them all on the Internet, not just MC +and AI). + You can have Pronet-10 interfaces for all the machines; Mike +Patton has a ton of them, and they're pretty easy to program. I don't +know how many Interlan Unibus Ethernet cards there are, but now that +the 750's are mostly gone there may be a bunch of them too. They are +somewhat harder to program, and you'd also have to write ARP. + + + Noel +------- + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 31 Jan 89 15:13:53 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 169823; Tue 31-Jan-89 15:11:37 EST +Date: Tue, 31 Jan 89 15:11 EST +From: Alan Bawden +To: SRA@XX.LCS.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, Zvona@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <19890131201142.2.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Sun, 29 Jan 1989 22:07:48 EST + From: Rob Austein + + Do we actually understand the syndrome well enough to say who all the + culprits are? + +I think so. According to our spy at SAIL: + + Date: Sun, 29 Jan 89 20:45:30 EST + From: David Chapman + ... Joe [Weening] says that SAIL has the same problem with them we + do, and that it actualy comes not from a change in the TIP software + but from the NOC monitoring software, which now displays a message + on the operator's console every time a host does something weird. + Whatever MC does constitutes something weird, adn tehy get sick of + seeing it, and so they manually turn off the host interface.... + +The only thing I would add to this is that according to a drone at the NOC +I tried to get some information out of one day, the "something weird" that +MC does is crash at the wrong time. That is, he believed that there was +something we could do, -if- we knew the machine was about to crash, that +would normalize relations with the IMP so that the NOC's software not to +bitch. Needless to say, this isn't very useful if your machine gets errors +that cause it to drop dead without warning (as MC has been doing). + + I know that the NOC does this random shutoff thing, and I think I + remember hearing that there was a hardware bug on our side; + +There is no hardware bug on our side, unless you count the fact that the +processor has a tendency to spontaneously drop dead. There is nothing +wrong with the LH/DH-11. + + is there also, for example, a software problem in the IMP that causes + this? + +I have been accusing the vaguely defined "IMP software". It sounds like +software in question doesn't actually run in an IMP, but in some machine at +the NOC. + + The reason I ask is that we (well, MIT, or DARPA, or somebody) + pay lots of money for the IMP ports, and if the NOC is shutting off + our service because their software can't cope, I think we can + legitimately give them some grief in the formal sense. If it's just a + stupid reaction on their part to a bug (hardware/software, + our/DEC's/ACC's fault, I don't care), I guess we have to live with it. + +It sounds to me like it is a stupid reaction on their part to a software +bug in -their- software. I don't think it is reasonable that we should +have to live with it. + + If this is BBN's fault beyond the NOC lossage, I think we should kick + them, hard. Hell, maybe we should call our congresscritters and + complain about government waste due to incompetant contractors. + +I have never understood the dividing line you draw between uneasonable +behavior that we have to live with and uneasonable behavior that we should +bitch about. It seems quite clear to me that if you are running a network +like the Arpanet, and your software causes your operators to shut off +service to your users just because they crashed at the wrong moment, then +your customers have legitimate cause to bitch. + +Received: from bigboote.LCS.MIT.EDU (TCP 2206400176) by AI.AI.MIT.EDU 29 Jan 89 22:09:05 EST +Received: by bigboote.LCS.MIT.EDU + id AA11349; Sun, 29 Jan 89 22:07:52 EST +Sender: Rob Austein +Date: Sun, 29 Jan 1989 22:07:48 EST +From: Rob Austein +To: ALAN@ai.ai.mit.edu +Cc: BUG-ITS@ai.ai.mit.edu +In-Reply-To: Your message of Sun, 29 Jan 89 18:04:44 EST +Message-Id: + +Do we actually understand the syndrome well enough to say who all the +culprits are? I know that the NOC does this random shutoff thing, and +I think I remember hearing that there was a hardware bug on our side; +is there also, for example, a software problem in the IMP that causes +this? The reason I ask is that we (well, MIT, or DARPA, or somebody) +pay lots of money for the IMP ports, and if the NOC is shutting off +our service because their software can't cope, I think we can +legitimately give them some grief in the formal sense. If it's just a +stupid reaction on their part to a bug (hardware/software, +our/DEC's/ACC's fault, I don't care), I guess we have to live with it. + +If this is BBN's fault beyond the NOC lossage, I think we should kick +them, hard. Hell, maybe we should call our congresscritters and +complain about government waste due to incompetant contractors. + +Date: Sun, 29 Jan 89 18:04:44 EST +From: David Chapman +To: ALAN@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <528214.890129.ZVONA@AI.AI.MIT.EDU> + +Oh. Giving the NOC a hard time is a fine reason; I just didn't know that +there was one. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 29 Jan 89 17:58:59 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 169431; Sun 29-Jan-89 17:57:23 EST +Date: Sun, 29 Jan 89 17:57 EST +From: Alan Bawden +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <528036.890128.ZVONA@AI.AI.MIT.EDU> +Message-ID: <19890129225728.2.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Sat, 28 Jan 89 22:47:32 EST + From: David Chapman + I've deleted ai:sys;net mail a couple times, because I don't think + people need to be told again the gory details of how the NOC is losing + and like that. Somone restored it each time. Is there a good reason + for this? + +The reason is that I'm pissed at the NOC for making it even less likely +that anyone besides me will bring MC up when it crashes. It makes me feel +better to publicize their foolishness this way. I think you have to put up +with it because I do backups, and if I get pushed too hard I may stop doing +that. + +Date: Sat, 28 Jan 89 22:47:32 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <528036.890128.ZVONA@AI.AI.MIT.EDU> + +I've deleted ai:sys;net mail a couple times, because I don't think +people need to be told again the gory details of how the NOC is losing +and like that. Somone restored it each time. Is there a good reason +for this? + +Date: Tue, 17 Jan 89 18:19:51 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <521426.890117.ZVONA@AI.AI.MIT.EDU> + +AI wasn't talking to the net at all, in or out; Finger for instance +complained that all sockets were in use. I reset it with lock. + +Received: from PIGPEN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 16 JAN 89 15:58:22 EST +Date: Mon, 16 Jan 89 15:50 EST +From: Alan Bawden +Subject: Unibus Chaosnet board... +To: ROLL@KICKI.STACKEN.KTH.SE +cc: bug-its@AI.AI.MIT.EDU +In-Reply-To: <12462000174.22.411.4820@KICKI.STACKEN.KTH.SE> +Message-ID: <19890116205029.5.ALAN@PIGPEN.AI.MIT.EDU> + + Date: 12-Jan-89 18:11:30 +0100 + From: Peter Lothberg + + + There are tre banks of DIP-switches, what do they do? + -------- + +Presumably two of them are network and host address. These two should be +right next to eachother, if I recall correctly. The third must be the +interrupt address. + +Take a look at SYSTEM;KSNET >. Since you can read the network address back +from the board, you should be able to figure out what switches do what by +plugging it in to some machine and playing with it. + +Date: Fri, 13 Jan 89 22:19:19 EST +From: Alan Bawden +Subject: Don't try this at home! +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <519854.890113.ALAN@AI.AI.MIT.EDU> + +If you tell ITS that your terminal has 8 columns or less, then when a +**MORE** break happens ITS will try to continue the "**MORE**" onto +the next line by doing "!". But (you guessed it) the +causes a **MORE** break! The result is a PDL overflow in Exec mode, and +a crashed ITS. See AI:CRASH;CRASH MORE for an example of this. + +Date: Fri, 13 Jan 89 03:00:11 EST +From: Charles Frankston +Subject: Re: Chaosnet through Internet. +To: JNC@XX.LCS.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JMR@KICKI.STACKEN.KTH.SE +Message-ID: <519167.890113.CBF@AI.AI.MIT.EDU> + +We did run chaos packets through the Internet from Livermore to MIT. I +think a total of about 10 packets were exchanged since we found that the +fixed Chaos timeouts were ill-suited to the cross country delays and the +accumulated retransmisson packets tickled bugs that caused XX's front end +to crash. EAK was doing the Livermore end and I think JTW hacked XX's +front end. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 12 Jan 89 12:27:56 EST +Received: from KICKI.STACKEN.KTH.SE by XX.LCS.MIT.EDU with TCP/SMTP; Thu 12 Jan 89 12:19:21-EST +Address: "PoBox:36041, SE-100 71 Stockholm, SWEDEN" +Organization: Stacken Computer Club +Telephone: +46-8-669 9720 +Date: 12-Jan-89 18:11:30 +0100 +From: Peter Lothberg +To: bug-its@ai.ai.mit.edu +Subject: Unibus Chaosnet board... +Message-ID: <12462000174.22.411.4820@KICKI.STACKEN.KTH.SE> + + +There are tre banks of DIP-switches, what do they do? + -------- + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 10 Jan 89 16:17:57 EST +Date: Tue 10 Jan 89 16:09:22-EST +From: "J. Noel Chiappa" +Subject: Re: Chaosnet through Internet. +To: JMR@KICKI.STACKEN.KTH.SE, bug-its@AI.AI.MIT.EDU +cc: JNC@XX.LCS.MIT.EDU +In-Reply-To: <12461385557.1.2.79320@KICKI.STACKEN.KTH.SE> +Message-ID: <12461508265.16.JNC@XX.LCS.MIT.EDU> + + Ahhh, you don't want to know about this. At one point there was a +discussion on using the IP packet protocol to carry around CHAOS streams. +There was never a final, definite scheme on how to do this, although I think +some kludges were in use. + The rationale was that people would be able to get to a larger number +of machines if you starting using IP packets, and it wouldn't be a major +change. However, the interactions between 'pure' CHAOS machines and machines +using CHAOS wrapped in IP can become tricky. (E.g. how does a 'pure' machine +address a machine with a different high order IP address; 16 bit addresses +don't map into 32 bits.) If you *really* care about this, some old stuff is +online on ML:JNC;CHAOS IN and CHAOS2 *. + + If you want to string a line between your CHAOS net and MIT's, fine, +you might want to allocate subnet numbers from the MIT space. If you're going +through the Internet, use TCP/IP - it almost works. + + Noel +------- + +Received: from KICKI.STACKEN.KTH.SE (TCP 20273365334) by AI.AI.MIT.EDU 10 Jan 89 04:01:37 EST +Date: 10-Jan-89 9:55:18 +0100 +From: Jan Michael Rynning +To: bug-its@ai.ai.mit.edu +Subject: Chaosnet through Internet. +Message-ID: <12461385557.1.2.79320@KICKI.STACKEN.KTH.SE> + + +> Date: Sun, 8 Jan 89 15:17 EST +> From: David A. Moon +> +> No. Chaosnet does not bridge through Internet. + +So, what's this? (From RFC 1010 (assigned numbers)): + +PROTOCOL NUMBERS + + In the Internet Protocol (IP) [36,80] there is a field, called + Protocol, to identify the the next level protocol. This is an 8 bit + field. + + Assigned Internet Protocol Numbers + + Decimal Keyword Protocol References + ------- ------- -------- ---------- +... + 16 CHAOS Chaos [NC3] + -------- + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 9 Jan 89 08:30:08 EST +Received: from KICKI.STACKEN.KTH.SE by XX.LCS.MIT.EDU with TCP/SMTP; Mon 9 Jan 89 08:22:21-EST +Address: "PoBox:36041, SE-100 71 Stockholm, SWEDEN" +Organization: Stacken Computer Club +Telephone: +46-8-669 9720 +References: Message from bug-its@AI.AI.MIT.EDU of 9-Jan-89 14:16:23 +In-reply-to: <19890108201751.6.MOON@EUPHRATES.SCRC.Symbolics.COM> +Date: 9-Jan-89 14:23:39 +0100 +From: Peter Lothberg +To: bug-its@AI.AI.MIT.EDU +Subject: Re: Chaos-net adresses +Message-ID: <12461172265.28.2.91760@KICKI.STACKEN.KTH.SE> + +foo +roll@kicki.stacken.kth.se + +Date: Sun, 8 Jan 89 15:17 EST +Cc: David A. Moon +To: Peter Lothberg +From: bug-its@AI.AI.MIT.EDU +Subject: Chaos-net adresses +Message-Id: <19890108201751.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + +> Date: 8-Jan-89 15:38:08 +0100 +> From: Peter Lothberg +> +> 1,) How do i set up the chaos net (unibus) board adress, i has no HW doc. +> +>Use the pair of DIP switches. I don't think there ever was any documentation +>other than the print set. Did you not get a print set? + +No, i did not get the print set for the Unibus board, i did get a drawing for +the the Cardr board. + +> 2,) Do we need to coordinate the chaos-host numbers with the other chaos +> based hosts @ mit, when (if) we get our KS-ITS to talk to Internet? +> +>No. Chaosnet does not bridge through Internet. +> +> If we have to cordinate, if i got this right, i need a subnet here? +> (we have, 2 KS, MX-Eleven, 2 Cadrs, and a T20 system, total 6) + +My thought, was, if it hapens in the future, that we get a bridge somehow, +to the MIT-Chaos, it might be clever to chose a subnet not in use. + +A lesson i learned from the work with the Nordical-Internet implementation +was, 'do it right the first time if possible'. + +-peter + + -------- + + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 8 Jan 89 20:40:00 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 517315; Sun 8-Jan-89 15:18:27 EST +Date: Sun, 8 Jan 89 15:17 EST +From: David A. Moon +Subject: Chaos-net adresses +To: Peter Lothberg +cc: bug-its@AI.AI.MIT.EDU +In-Reply-To: <12460923678.29.411.15980@KICKI.STACKEN.KTH.SE> +Message-ID: <19890108201751.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: 8-Jan-89 15:38:08 +0100 + From: Peter Lothberg + + 1,) How do i set up the chaos net (unibus) board adress, i has no HW doc. + +Use the pair of DIP switches. I don't think there ever was any documentation +other than the print set. Did you not get a print set? + + 2,) Do we need to coordinate the chaos-host numbers with the other chaos + based hosts @ mit, when (if) we get our KS-ITS to talk to Internet? + +No. Chaosnet does not bridge through Internet. + + If we have to cordinate, if i got this right, i need a subnet here? + (we have, 2 KS, MX-Eleven, 2 Cadrs, and a T20 system, total 6) + +You need a subnet number for each chaos cable you have. People whose cables +aren't connected by bridges don't have to coordinate their subnet numbers. +I'd guess that you have one cable and no bridges, so you need one subnet +number. May as well use 1. + +You may have to purge MIT chaosnet addresses out of your host tables, if +you got your host tables by copying the MIT ones. Otherwise SI might think +it can talk to AI via Chaosnet instead of Internet. + +Received: from KICKI.STACKEN.KTH.SE (TCP 20273365334) by AI.AI.MIT.EDU 8 Jan 89 09:44:14 EST +Address: "PoBox:36041, SE-100 71 Stockholm, SWEDEN" +Organization: Stacken Computer Club +Telephone: +46-8-669 9720 +Date: 8-Jan-89 15:38:08 +0100 +From: Peter Lothberg +To: bug-its@ai.ai.mit.edu +Subject: Chaos-net adresses +Message-ID: <12460923678.29.411.15980@KICKI.STACKEN.KTH.SE> + + +1,) How do i set up the chaos net (unibus) board adress, i has no HW doc. +2,) Do we need to coordinate the chaos-host numbers with the other chaos + based hosts @ mit, when (if) we get our KS-ITS to talk to Internet? + + If we have to cordinate, if i got this right, i need a subnet here? + (we have, 2 KS, MX-Eleven, 2 Cadrs, and a T20 system, total 6) + +-peter + -------- + + +Received: from MITVMA.MIT.EDU (TCP 2227000003) by AI.AI.MIT.EDU 10 Nov 88 19:27:54 EST +Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (IBM VM SMTP R1.1) with BSMTP id 5321; Thu, 10 Nov 88 19:22:29 EST +Received: from SEKTH.BITNET by MITVMA.MIT.EDU (Mailer X1.25) with BSMTP id + 5320; Thu, 10 Nov 88 19:22:28 EST +Received: from kth.se by KTH-BITNET-GATEWAY ; 10 Nov 88 23:39:47 GMT +Received: from KICKI.STACKEN.KTH.SE by kth.se (5.57+IDA+KTH/3.0) + id AA13586; Fri, 11 Nov 88 00:39:36 +0100 +Address: "PoBox:36041, SE-100 71 Stockholm, SWEDEN" +Organization: Stacken Computer Club +Date: 11-Nov-88 0:39:51 +0100 +From: Peter_Lothberg +To: bug-its@ai.ai.mit.edu +Subject: The container and MX +Message-Id: <12445555798.20.2.175672@KICKI.STACKEN.KTH.SE> + + +Arrived to Stockholm and we unpacked the container on wendsday. + +The container has, sure shaked, the cardboard paper that we put between +the cabinets, has bloue spots..... + +But, everything was in the same position that we left it, so, hopfully +it is not hurt by the transport, or the cold here. + +We have put the machine on several places, while we are waiting for +our new machine room to be completed. + +My preliminary shedule is, to have it run by end of march. + +-peter + + -------- + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 26 Oct 88 23:45:34 EDT +Date: Wed 26 Oct 88 23:42:03-EDT +From: "J. Noel Chiappa" +To: Moon@STONY-BROOK.SCRC.Symbolics.COM, ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: <19881022002858.8.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12441656808.31.JNC@XX.LCS.MIT.EDU> + + It's actually in the back, inside the cabinet, on the CPU card, +as I recall. (It might be next to the power switch, if I'm suffering +brain fade.) However, it is in the back on the C/30's.... + The right thing is actually to call the NOC; they keep stats +on the number of random restarts to highlight problem hardware, and +pushing the button a lot could get us a new box, all full of new bugs... + + Noel +------- + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 24 Oct 88 15:48:43 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 481133; Mon 24-Oct-88 15:47:09 EDT +Date: Mon, 24 Oct 88 15:46 EDT +From: David A. Moon +Subject: MC +To: David Chapman +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <470732.881024.ZVONA@AI.AI.MIT.EDU> +Message-ID: <19881024194656.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Mon, 24 Oct 88 14:46:59 EDT + From: David Chapman + + For what it's worth, I'm in favor of an immediate CPU swap. + +Maybe the problem is the power supply, not the boards. The errors +it's getting are "impossible" in most cases, unless we are misreading +the documentation. Swapping the CPU might only make things worse. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 24 Oct 88 15:29:27 EDT +Date: Mon 24 Oct 88 15:26:16-EDT +From: Rob Austein +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <470732.881024.ZVONA@AI.AI.MIT.EDU> +Message-ID: <12441042264.12.SRA@XX.LCS.MIT.EDU> + + Date: Mon, 24 Oct 88 14:46:59 EDT + From: David Chapman + + MC wasn't talking to the net for 34 hours because people kept booting + it without fixing the IMP problem. I left a note on the console + explaining how to win. + + As a result, LISTS MSGS is over 2000 blocks again. + + For what it's worth, I'm in favor of an immediate CPU swap. + +Since BBN has admitted that at least some of this is their fault (IMP +software), a CPU swap wouldn't solve the urgent problem. + +The problem with swapping CPUs to "fix" the PAR ERR bug is that it +would not solve the real problem (one of the KS CPUs being broken) but +would remove the immediate cause for fixing the real problem. Sad but +true. +------- + +Date: Mon, 24 Oct 88 14:46:59 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <470732.881024.ZVONA@AI.AI.MIT.EDU> + +MC wasn't talking to the net for 34 hours because people kept booting +it without fixing the IMP problem. I left a note on the console +explaining how to win. + +As a result, LISTS MSGS is over 2000 blocks again. + +For what it's worth, I'm in favor of an immediate CPU swap. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 21 Oct 88 20:30:04 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 480334; Fri 21-Oct-88 20:29:11 EDT +Date: Fri, 21 Oct 88 20:28 EDT +From: David A. Moon +To: David Chapman +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <469253.881021.ZVONA@AI.AI.MIT.EDU> +Message-ID: <19881022002858.8.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 21 Oct 88 16:05:33 EDT + From: David Chapman + + MC isn't talking to the arpanet. Powercycling doesn't help. I gather this + means I need to boot the IMP. I dunno how. Can someone show me? (I can't + find anyone around now.) + +Push the boot button on the front of the IMP (maybe it's labelled Reset). +Then wait an hour. + +Date: Fri, 21 Oct 88 17:20:59 EDT +From: "Pandora B. Berman" +To: LIAISON@AI.AI.MIT.EDU +cc: ZVONA@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <469383.881021.CENT@AI.AI.MIT.EDU> + + Date: Fri, 21 Oct 88 16:05:33 EDT + From: David Chapman + To: BUG-ITS@AI.AI.MIT.EDU + MC isn't talking to the arpanet. Powercycling doesn't help. I gather + this means I need to boot the IMP. I dunno how. Can someone show me? + (I can't find anyone around now.) + +i looked at the LH/DH lights, decided they indicated IMP wedgitude, and +called the NOC, after Ty checked and found that XX (@ 0/44) was having no +problems. the nice man (norm, i think he said) there put 3/44 into and out +of loopback, and then once i ran NET in LOCK to impulse MC, we had arpanet +again. + the guy at BBN claimed that we are not the only people having this +problem, that it seems to be cropping up in several places all over, and +that it appears therefore to be software. i gather They Are Working On It. +i gave him MAP's name as the official administrator here. he said that the +next the this happens, we should try to call as soon as possible so they +can try to catch it before it reaches the steady-state wedgedness, and thus +perhaps learn something. the NOC is at 873-3070. + +Date: Fri, 21 Oct 88 16:05:33 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <469253.881021.ZVONA@AI.AI.MIT.EDU> + +MC isn't talking to the arpanet. Powercycling doesn't help. I gather this +means I need to boot the IMP. I dunno how. Can someone show me? (I can't +find anyone around now.) + +Date: Thu, 20 Oct 88 22:42:07 EDT +From: "Pandora B. Berman" +Subject: state of ML +To: marilyn@WHEATIES.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <468866.881020.CENT@AI.AI.MIT.EDU> + +alan said that last week he had you generate a repair PO for ML's disk +drive, which was broken. when he called DEC back on sunday to complain that +they had in fact not fixed the disk, he got the impression that DEC thought +that last week's PO had been closed already. as of now, DEC is -still- +working on that disk, and the latest notes they left to each other do not +boost my confidence, as they suggest that in trying to use MD to help fix +ML's disk, they broke MD's disk as well. if at some point they actually fix +these things so they are really fixed, they may want another PO for the +work this week. in which case we get to generate another repair PO. alan is +on vacation and will return sometime next week; if this needs to be acted +upon before then, i'll do it. note that AI should not be charged for any +work to fix MD, which is LCS, and it's my guess that LCS shouldn't be +charged for fixing MD either, since the Men From DEC say -they- broke it. + +Date: Tue, 18 Oct 88 02:18:43 EDT +From: "Christopher C. Stacy" +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <465449.881018.CSTACY@AI.AI.MIT.EDU> + +Someone seems to have deleted the default DDT init file +from AI's USERSn directories. So I put them back. + +Date: Tue, 18 Oct 88 01:12:33 EDT +From: "Pandora B. Berman" +Subject: mc fall down go boom again +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <465405.881018.CENT@AI.AI.MIT.EDU> + +it crashed again, after alan had gone home. so i trucked upstairs to +discover the same old bogus ?PAR ERR msg. i read the lights off the +ACC box over the phone to alan, and he claims that the way the second +row did not clear indicates that the problem has not been solved by +swapping LH/DHs. in other words, the LH/DHs are not at fault. MC is +currently up but not talking to the arpanet. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 17 Oct 88 23:29:41 EDT +Received: from OTIS.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 143539; Mon 17-Oct-88 23:28:33 EDT +Date: Mon, 17 Oct 88 23:28 EDT +From: Alan Bawden +Subject: Vacation. +To: Bug-MAIL@AI.AI.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU +Message-ID: <19881018032823.2.ALAN@OTIS.AI.MIT.EDU> + +Due to the lossage with MC, there are a few things that I have done that +you might all need to know about. Especially since I'll be out of town +this from this Wednesday through next Monday. + +1. I have swapped AI and MC's LH/DH-11s to see if this has any effect on +the problem with the MC's IMP port. + +2. I have left COMSAT on MC running in hyper-active mode. That is, I have +patched all of its timeouts to very small values. This makes COMSAT eat +new mail faster, so that people who haven't been able to talk to MC for +days have a better chance of delivering new mail before timing out. Of +course the flip side of this is that MC is growing a rather large queue of +mail it hasn't been able to deliver. + +The COMSAT PDUMP file (COMSAT LAUNCH) has the fast timeouts, but the SBLK +file (COMSAT IV) does not. So if it becomes necessary to undo what I have +done, you should: [a] notice that the files on .MAIL. are all links to the +corresponding files on .BULK., [b] load .BULK.;COMSAT IV into a job (J$J +$L .BULK.;COMSAT IV), [c] start it at PURIFY (PURIFY$G), and [d] put the +resulting PDUMP file into .BULK.;COMSAT LAUNCH (which is -not- the default +you will be offered! Use delete, or type $ to change the offered +default.). + +3. I have changed the algorithm employed by the SMTP and Chaos MAIL +servers to decide whether or not to accept new MAIL > files. The previous +code tried to limit the number of MAIL files to 30. The new code looks at +the .MAIL. directory and computes how full it is and refuses new MAIL > +files if it is more than 75% full. + +If this has any bad effects, you can retract it by renaming +DEVICE;CHAOS OMAIL to be DEVICE;CHAOS MAIL and renaming SYSBIN;FTPS OBIN to +be SYSBIN;FTPS BIN. + +Received: from ames.arc.nasa.gov (TCP 20031411003) by AI.AI.MIT.EDU 6 Oct 88 12:34:47 EDT +Received: Thu, 6 Oct 88 09:23:05 PDT by ames.arc.nasa.gov (5.59/1.2) +Date: Thu, 6 Oct 88 09:24:05 PST +From: geoff@Fernwood.MPK.CA.US (the tty of Geoff Goodfellow) +Subject: Re: License plate curiosity... +Message-Id: <8810060924.2.UUL1.3#948@Fernwood.MPK.CA.US> +To: Ed@ALDERAAN.SCRC.Symbolics.COM +Cc: tops-20@score.stanford.edu, info-its@ai.ai.mit.edu, hic@symbolics.com, + pgs@ai.ai.mit.edu, gls@think.com, vaf@score.stanford.edu +In-Reply-To: Your message of Wed 5 Oct 88 17:27:28-PDTFrom: Vince Fuller + +i still have California JFCL. +i believe JRST 4 belongs to Ken Olum (kdo@lucid.com). +g + + +Received: from Think.COM (TCP 1201000006) by AI.AI.MIT.EDU 6 Oct 88 12:05:10 EDT +Return-Path: +Received: from sauron.think.com by Think.COM; Thu, 6 Oct 88 11:16:46 EDT +Received: from OCCAM.THINK.COM by sauron.think.com; Thu, 6 Oct 88 12:00:28 EDT +Date: Thu, 6 Oct 88 12:01 EDT +From: Barry Margolin +Subject: License plate curiosity... +To: Ed Schwalenberg +Cc: Vince Fuller , tops-20@score.stanford.edu, + info-its@ai.ai.mit.edu, geoff@fernwood.mpk.ca.us, + hic@alderaan.scrc.symbolics.com, pgs@ai.ai.mit.edu, gls@Think.COM +In-Reply-To: <19881006144203.6.ED@BLACK-BIRD.SCRC.Symbolics.COM> +Message-Id: <19881006160115.7.BARMAR@OCCAM.THINK.COM> + +A couple of weeks ago I was walking through the Lotus parking lot by +Cambridge Gas & Electric and saw the license plate CAR-CDR. Anyone know +whose this is? + + barmar + +Received: from ALDERAAN.SCRC.Symbolics.COM (TCP 20024224555) by AI.AI.MIT.EDU 6 Oct 88 10:44:15 EDT +Received: from BLACK-BIRD.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 227033; Thu 6-Oct-88 10:42:12 EDT +Date: Thu, 6 Oct 88 10:42 EDT +From: Ed Schwalenberg +Subject: License plate curiosity... +To: Vince Fuller +cc: tops-20@Score.Stanford.EDU, info-its@AI.AI.MIT.EDU, geoff@fernwood.mpk.ca.us, + hic@ALDERAAN.SCRC.Symbolics.COM, pgs@AI.AI.MIT.EDU, gls@think.com +In-Reply-To: <12436116360.19.VAF@Score.Stanford.EDU> +Message-ID: <19881006144203.6.ED@BLACK-BIRD.SCRC.Symbolics.COM> + + Date: Wed 5 Oct 88 17:27:28-PDT + From: Vince Fuller + + The other day I saw a California licence plate that read "JRST 4" (I guess you + can't get commas on licence plates...). Out of curiosity, who is the owner of + this plate? + + --Vince + ------- + +Hmm. I thought this was Geoff Goodfellow's, but SAIL:AIWORD.RF[UP,DOC] +tells me he has JFCL. + +HIC got Massachusetts HLRZ (the PDP-10 instruction that implements +the "car" operation of Lisp); I believe this vehicle and plate is +still around in the possession of PGS. + +I had FOOBAR in Nevada and later in Massachusetts; I still have +the physical plates from Nevada, though the vehicle which wore +both sets is long since deceased. + +There used to be a rather extensive discussion of this stuff in the +jargon file(s), but it seems to have evaporated, except for the single +note about JFCL. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 5 Oct 88 21:09:41 EDT +Return-Path: +Received: from Score.Stanford.EDU by XX.LCS.MIT.EDU with TCP/SMTP; Wed 5 Oct 88 20:36:04-EDT +Date: Wed 5 Oct 88 17:27:28-PDT +From: Vince Fuller +Subject: License plate curiosity... +To: tops-20@Score.Stanford.EDU +Office: Pine Hall 167 +Phone: 415-723-6860 +Message-ID: <12436116360.19.VAF@Score.Stanford.EDU> +ReSent-Date: Wed 5 Oct 88 21:06:17-EDT +ReSent-From: Rob Austein +ReSent-To: info-its@AI.AI.MIT.EDU +ReSent-Message-ID: <12436123427.45.SRA@XX.LCS.MIT.EDU> + +The other day I saw a California licence plate that read "JRST 4" (I guess you +can't get commas on licence plates...). Out of curiosity, who is the owner of +this plate? + + --Vince +------- + +Date: Wed, 5 Oct 88 14:23:26 EDT +From: Rob Austein +Subject: TCP/IP ior IMP weirdness +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <457481.881005.SRA@AI.AI.MIT.EDU> + +I got a call from BBN asking me to check out MC because they said it +had first crashed then started spitting garbage onto its IMP (sic). +The call was to tell me that until they hear further from us they will +leave MC's port in loopback mode to keep from trashing the rest of the +net. + +I found MC crashed with several messages from last night about the IMP +crashing and the IMP interface being reset followed by: + +IMP: Interface reset +PK: Node already on list + +and a PI 7 BUGHALT. There were no times on the last two message. +Dump in CRASH; TCP.PK BUGHLT. Reloaded ok except that now it can't +talk to the net, presumably because BBN still has the IMP in loopback. +I'm going to try to get them to undo that now.... + +Received: from MITVMA.MIT.EDU (TCP 2227000003) by AI.AI.MIT.EDU 3 Oct 88 15:46:16 EDT +Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (IBM VM SMTP R1.1) with BSMTP id 0401; Mon, 03 Oct 88 15:43:23 EDT +Received: from SEKTH.BITNET by MITVMA.MIT.EDU (Mailer X1.25) with BSMTP id + 0400; Mon, 03 Oct 88 15:33:45 EDT +Received: from kth.se by KTH-BITNET-GATEWAY ; 03 Oct 88 19:11:10 GMT +Received: from kicki.stacken.kth.se by kth.se (5.57+IDA+KTH/3.0) + id AA18632; Mon, 3 Oct 88 20:10:59 +0100 +Date: Mon, 3 Oct 88 20:12:22 +0100 +From: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU (Peter Lothberg) +To: bug-its@ai.ai.mit.edu +Subject: subnet 6 +Message-Id: <340A6Z@KICKI.STACKEN.KTH.SE> + + + It might be so that, I did something wrong when we took away MX, + i unplugged the transceivers, both where the KL was, and next to + the chaos-11 3mbit ethernet gateway was. I don't knew if anyone + has checked it out after that. + + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 3 Oct 88 14:27:24 EDT +Date: Mon 3 Oct 88 14:22:46-EDT +From: Rob Austein +Subject: Re: Chaosnet, hardware +To: JTW@XX.LCS.MIT.EDU +cc: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU, bug-its@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <12435525680.49.SRA@XX.LCS.MIT.EDU> + +If I remember correctly, Moon's original CHAOSNET spec paper did specify +a length limit derived from transmission speed and the retransmission +algorithm. I haven't read the paper in a long time, so I can't quote +chapter and verse. +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 3 Oct 88 14:06:55 EDT +Date: Mon 3 Oct 88 14:02:33-EDT +From: Rob Austein +Subject: Agre's dropped tty problems +To: agre@wheaties.ai.mit.edu +cc: bug-its@AI.AI.MIT.EDU +In-Reply-To: <8810010048.AA15907@wheat-chex.ai.mit.edu> +Message-ID: <12435522000.49.SRA@XX.LCS.MIT.EDU> + +Or maybe it's just that the path from anywhere to subnet 6 is unreliable these +days and sometimes the routing transients cause your packets to fall on the +floor so that either ITS or your Lispm thinks the connection is dead. +------- + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 3 Oct 88 00:52:52 EDT +Received: from BRAHMA.ACA.MCC.COM (BRAHMA.ACA.MCC.COM.#Chaos) by MCC.#Chaos with Chaos/SMTP; Sun 2 Oct 88 23:50:32-CDT +Date: Sun, 2 Oct 88 23:50 CDT +From: David Vinayak Wallace +Subject: Chaosnet, hardware +To: JTW@XX.LCS.MIT.EDU +cc: Peter Lothberg , bug-its@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <881002235013.7.GUMBY@BRAHMA.ACA.MCC.COM> + + Date: Sun, 2 Oct 1988 18:33 EDT + From: JTW@XX.LCS.MIT.EDU + + Presumably the limit is due to propagation delays screwing up the + collision detection, rather than analog attenuation issues. This being + the case, it should be pretty easy to calculate once you figure out + exactly what a collision is. As a practical matter our subnet 1 was + well over 500m at its peak, I think. + +The Chaosnet Memo said that the limit was around 1KM for the reason you +said. + +Date: Sun, 2 Oct 88 21:58:54 EDT +From: "Christopher C. Stacy" +Subject: dropping +To: BUG-ITS@AI.AI.MIT.EDU +cc: AGRE@AI.AI.MIT.EDU +Message-ID: <455274.881002.CSTACY@AI.AI.MIT.EDU> + +The 7814 modem randomly dropped me a second ago; when I dialed it back +up again, I was on the same session as before (I wasn't logged out.) +There seemed to be alot of pinegoi&6se on the line too. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 2 Oct 88 18:35:14 EDT +Date: Sun, 2 Oct 1988 18:33 EDT +Message-ID: +From: JTW@XX.LCS.MIT.EDU +To: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU (Peter Lothberg) +Cc: bug-its@AI.AI.MIT.EDU +Subject: Chaosnet, hardware +In-reply-to: Msg of Sun 2 Oct 88 17:14:21 +0100 from ROLL%SESTAK.BITNET at MITVMA.MIT.EDU (Peter Lothberg) + + + From: ROLL%SESTAK.BITNET at MITVMA.MIT.EDU (Peter Lothberg) + Re: Chaosnet, hardware + + What is the electrical characteristics? + +75 Ohm coax. Traditionally, solid-sheath CATV cable was used for its +low-loss and shielding properties, but more recently most short runs +were done with boring old RG-59U, which seems to work fine. +Termination is just a 75-ohm non-inductive resistor on each end. + +I've never seen any commentary on theoretical length limits, but +perhaps someone who was around when it was designed will have more to +say. Presumably the limit is due to propagation delays screwing up the +collision detection, rather than analog attenuation issues. This being +the case, it should be pretty easy to calculate once you figure out +exactly what a collision is. As a practical matter our subnet 1 was +well over 500m at its peak, I think. + +Received: from MITVMA.MIT.EDU (TCP 2227000003) by AI.AI.MIT.EDU 2 Oct 88 12:20:18 EDT +Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (IBM VM SMTP R1.1) with BSMTP id 2539; Sun, 02 Oct 88 12:17:50 EDT +Received: from SEKTH.BITNET by MITVMA.MIT.EDU (Mailer X1.25) with BSMTP id + 2538; Sun, 02 Oct 88 12:17:49 EDT +Received: from kth.se by KTH-BITNET-GATEWAY ; 02 Oct 88 16:14:10 GMT +Received: from kicki.stacken.kth.se by kth.se (5.57+IDA+KTH/3.0) + id AA04756; Sun, 2 Oct 88 17:13:56 +0100 +Date: Sun, 2 Oct 88 17:14:21 +0100 +From: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU (Peter Lothberg) +To: bug-its@ai.ai.mit.edu +Subject: Chaosnet, hardware +Message-Id: <5401T5@KICKI.STACKEN.KTH.SE> + +What is the electrical characteristics? + + Cable impendance? + Maximal cable lenght? + Terminators? + + + + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 30 Sep 88 23:08:46 EDT +Received: from BRAHMA.ACA.MCC.COM (BRAHMA.ACA.MCC.COM.#Chaos) by MCC.#Chaos with Chaos/SMTP; Fri 30 Sep 88 21:58:15-CDT +Date: Fri, 30 Sep 88 21:58 CDT +From: David Vinayak Wallace +Subject: foo +To: Alan Bawden +cc: agre@WHEATIES.AI.MIT.EDU, bug-its@AI.AI.MIT.EDU +In-Reply-To: <19881001013734.1.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <880930215803.1.GUMBY@BRAHMA.ACA.MCC.COM> + + Date: Fri, 30 Sep 88 21:37 EDT + From: Alan Bawden + + (It is a weird phenomenon that people always blame the machine at the + farthest end of a network connection first. I've seen people go and boot + AI because their terminal concentrator crashed.) + +Yea, I once booted XX because the IRS lost my tax rebate + +Received: from wheat-chex.ai.mit.edu (TCP 20015023057) by AI.AI.MIT.EDU 30 Sep 88 22:05:22 EDT +Received: by wheat-chex.ai.mit.edu; Fri, 30 Sep 88 21:56:44 EDT +Date: Fri, 30 Sep 88 21:56:44 EDT +From: agre@wheaties.ai.mit.edu (Philip E. Agre) +Message-Id: <8810010156.AA16581@wheat-chex.ai.mit.edu> +To: Alan@ai.ai.mit.edu +Subject: Re: foo +Cc: bug-its@ai.ai.mit.edu + +That's probably because networks are supposed to be transparent. +Even when they break it doesn't immediately come to mind that they +even exist. But then people don't usually clean off the world when +their glasses get dirty. + +Received: from PIGPEN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 30 SEP 88 21:46:45 EDT +Date: Fri, 30 Sep 88 21:37 EDT +From: Alan Bawden +Subject: foo +To: agre@WHEATIES.AI.MIT.EDU +cc: bug-its@AI.AI.MIT.EDU, Gumby@mcc.com +In-Reply-To: <8810010048.AA15907@wheat-chex.ai.mit.edu> +Message-ID: <19881001013734.1.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Fri, 30 Sep 88 20:48:48 EDT + From: agre@wheaties.ai.mit.edu (Philip E. Agre) + I talked with Alan about the problem a little and he thinks that AI is + losing all its Chaos connections now and again. + +That's not quite what I said. I think that it is the Chaosnet itself that +is the problem (probably subnet 6 being jammed). The problem is not AI or +ITS. + +(It is a weird phenomenon that people always blame the machine at the +farthest end of a network connection first. I've seen people go and boot +AI because their terminal concentrator crashed.) + +Received: from wheat-chex.ai.mit.edu (TCP 20015023057) by AI.AI.MIT.EDU 30 Sep 88 20:57:13 EDT +Received: by wheat-chex.ai.mit.edu; Fri, 30 Sep 88 20:48:48 EDT +Date: Fri, 30 Sep 88 20:48:48 EDT +From: agre@wheaties.ai.mit.edu (Philip E. Agre) +Message-Id: <8810010048.AA15907@wheat-chex.ai.mit.edu> +To: bug-its@ai.ai.mit.edu +Subject: foo + +From agre Fri Sep 30 20:47:14 1988 +Return-Path: +Received: by wheat-chex.ai.mit.edu; Fri, 30 Sep 88 20:46:33 EDT +Date: Fri, 30 Sep 88 20:46:33 EDT +From: MAILER-DAEMON@wheaties.ai.mit.edu (Mail Delivery Subsystem) +Subject: Returned mail: User unknown +Message-Id: <8810010046.AB15897@wheat-chex.ai.mit.edu> +To: agre +Status: R + + ----- Transcript of session follows ----- +550 bug-its... User unknown + + ----- Unsent message follows ----- +Return-Path: +Received: by wheat-chex.ai.mit.edu; Fri, 30 Sep 88 20:46:33 EDT +Date: Fri, 30 Sep 88 20:46:33 EDT +From: agre@wheaties.ai.mit.edu (Philip E. Agre) +Message-Id: <8810010046.AA15894@wheat-chex.ai.mit.edu> +To: Gumby@mcc.com +Subject: Re: connectionist problems +Cc: bug-its + +1. I am connecting through a telnet window on my lispm. +2. No, nothing about DDT BUG BLAH BLAH +3. I've never had my connection dropped while running any program but DDT. +4. Ditto. +5. Yes, my memory is quite consistent with the policy (which Alan told me + about) of flushing over-an-hour-old detached jobs. + +I talked with Alan about the problem a little and he thinks that AI is +losing all its Chaos connections now and again. + + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 30 Sep 88 19:12:31 EDT +Received: from BRAHMA.ACA.MCC.COM (BRAHMA.ACA.MCC.COM.#Chaos) by MCC.#Chaos with Chaos/SMTP; Fri 30 Sep 88 18:01:49-CDT +Date: Fri, 30 Sep 88 18:01 CDT +From: David Vinayak Wallace +Subject: connectionist problems +To: Philip E. Agre +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <453833.880930.AGRE@AI.AI.MIT.EDU> +Message-ID: <880930180110.0.GUMBY@BRAHMA.ACA.MCC.COM> + + Date: Fri, 30 Sep 88 15:39:01 EDT + From: "Philip E. Agre" + + Hi -- AI randomly drops my terminal connection a couple dozen + times a day. In doing so it sometimes detaches me and sometimes + flushes me altogether. Am I doing something to bring this on + myself? If not it would be great if it stopped happening. + +o - Are you connecting from a terminal concentrator? If not, how? +o - When you reconnect, do you get some message from ITS like + "DDT BUG BLAH BLAH?" +o - When you reconnect are you talking to DDT or to the program you were + running when the connexion was dropped? +o - Does this only happen when you're running some particular program? +o - When "it sometimes detaches me and sometimes flushes me altogether" + does it appear that you're logged out only if you wait a while? + ITS's default behaviour is to keep jobs around if the connection is + accidentally dropped, then GC them after a while if you don't + reconnect. + +"We need BITS, nothing but BITS" -- Chuck E. Dickens. + +Date: Fri, 30 Sep 88 15:39:01 EDT +From: "Philip E. Agre" +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <453833.880930.AGRE@AI.AI.MIT.EDU> + +Hi -- AI randomly drops my terminal connection a couple dozen +times a day. In doing so it sometimes detaches me and sometimes +flushes me altogether. Am I doing something to bring this on +myself? If not it would be great if it stopped happening. + +Date: Fri, 16 Sep 88 00:16:04 EDT +From: Peter Lothberg +Subject: The "crack team", is dissasembling MX, for it's trip to Sweden +To: INFO-ITS@AI.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU +Message-ID: <444460.880916.ROLL@AI.AI.MIT.EDU> + + +The crack team has begun to work; + +A lot of the documentation for MX (KL-10) must be spread out, i +can't find it around the machine. + +So all of you that has bits and pices, bring it to the 9:th floor +before sunday, please. + + +(As the system will not fill the container more than 40% or so, + we vold like donations of other stuff, like Lisp-machines, AAA terminals, + a IMP, Conection machines, retired 2060's etc, (I'm not joking...)) + +-Peter + +Date: Sun, 11 Sep 88 23:57:48 EDT +From: Devon Sean McCullough +Subject: supdup +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <441324.880911.DEVON@AI.AI.MIT.EDU> + +Date: Sun, 11 Sep 88 09:39:59 EDT +From: David C. Plummer +To: DEVON at AI.AI.MIT.EDU +Re: supdup + + Date: Sun, 4 Sep 88 12:41:31 EDT + From: Devon Sean McCullough + Subject: supdup + To: DCP@AI.AI.MIT.EDU + Message-ID: <437397.880904.DEVON@AI.AI.MIT.EDU> + + Many supdup servers around MIT emit %TDBS, which is not in any RFC + I've ever seen, and breaks some user end supdups, such as ITS CRTSTY. + Do you know if anyone has defined a new improved supdup that does + allow %TDBS, and perhaps a few other useful things as well? + +I've been away from this kind of stuff for a LONG time. I'd suggest +asking bug-ITS. + +Date: Fri, 9 Sep 88 22:56:21 EDT +From: "Pandora B. Berman" +Subject: return of MD +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <440558.880909.CENT@AI.AI.MIT.EDU> + +i plugged MD back into the *MSG and INQUPD routines. + +Date: Fri, 9 Sep 88 17:19:49 EDT +From: "Pandora B. Berman" +Subject: The end of the world as we used to know it +To: BRAITHWAITE@TOPS20.DEC.COM +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <440394.880909.CENT@AI.AI.MIT.EDU> + + Date: 9 Sep 1988 1033-EDT + From: BRAITHWAITE@TOPS20.DEC.COM + To: Rob Austein + Subject: Re: [Pandora B. Berman: The end of the world as we used to know it] + ReSent-Date: Fri 9 Sep 88 10:40:40-EDT + ReSent-From: Rob Austein + ReSent-To: CENT@XX.LCS.MIT.EDU + + for our records --- what is MX's serial number ? + -------- +model PDP-1080 (or KL-10A), serial #1038 + +Date: Thu, 8 Sep 88 21:39:25 EDT +From: "Pandora B. Berman" +Subject: The end of the world as we used to know it +To: (*MSG *ITS)@AI.AI.MIT.EDU, ARPANET-BBOARDS@AI.AI.MIT.EDU, + INFO-ITS@AI.AI.MIT.EDU +Message-ID: <439827.880908.CENT@AI.AI.MIT.EDU> + +"The time has come," said LCS, + "MX at last must go. +Its day has gone. We need that space + Most urgently." And so +Before we crate it, let us give + A final cheerio. + +Once there was a KL-10 called MIT-MC which belonged to the Macsyma +Consortium. It provided Macsyma, the symbolic algebra system, to +researchers all over the world, and mail gatewaying and mailing list +support to a large fraction of the Arpanet. Things continued in this +fashion from 1975 to 1983. + +When the Macsyma Consortium dissolved in 1983, MC turned to providing +cycles for MIT's Laboratory for Computer Science, and continued supporting +much of the Arpanet's mail service. But the machine itself was growing old +and cranky. In 1986, the mail services were moved to a smaller, more +maintainable machine (a KS-10), and the name "MC" was moved with them. +But the KL-10 continued to run under the new name "MX". + +Now the end has come. MX was down cold for several months, and has only +been revived recently to copy some old 7-track tapes. LCS can't keep MX +any longer -- it needs the space for other purposes. So the KL is being +sent to the Home for Aged But Beloved PDP-10s; a crack team of hardware +hackers will arrive next week to dismantle it and take it back with them to +Sweden. + +In celebration of this momentous event, we are holding a small farewell +gathering: + Friday, 16 September 1988 + 16:00 + NE43-8th floor playroom + (545 Technology Square, Cambridge, MA) + +Reservations are strenuously requested (though not strictly necessary) -- +we need a head count so we can figure out how many trays of institutional +brownies to order. Send yours to: + CENT@AI.AI.MIT.EDU + +Offers of refreshement are also very welcome -- do you think we have any +budget for this kind of thing? Send all such offers also to CENT as above. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 6 Sep 88 21:16:38 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 455252; Tue 6-Sep-88 21:12:46 EDT +Date: Tue, 6 Sep 88 21:12 EDT +From: David A. Moon +Subject: mc par errs +To: Pandora B. Berman +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <437950.880906.CENT@AI.AI.MIT.EDU> +Message-ID: <19880907011222.0.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Tue, 6 Sep 88 06:50:56 EDT + From: "Pandora B. Berman" + + the sysconsole died mysteriously this evening. it was in the middle of + printing a msg to my DUMP about loading a tape and then saying ok, when + all of a sudden it said + ?rivPARITY + and the console was talking to KLDCP. the easy way out was to reattach that + hactrn to the vt52, so i took it. but when that tape was done and i tried + to boot the system to regain access to the sysconsole, it died twice during + the reboot process, at different places, each time with the blank but + ominous msg: PARITY. the mem bays didn't indicate par errs, but i tried + resetting them anyway. each time, after resetting bay D a couple times, its + par err light would come on. after resetting more, the light would + disappear, sometimes return, and then go away again. it did eventually + cooperate and let the machine come up, but this was very odd.. + +These sound like parity errors in the front-end pdp-11's memory +[I hope someone isn't going to tell me that that pdp-11 doesn't +have parity on its memory and I've just made a fool of myself.] + +Date: Tue, 6 Sep 88 06:50:56 EDT +From: "Pandora B. Berman" +Subject: mc par errs +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <437950.880906.CENT@AI.AI.MIT.EDU> + +the sysconsole died mysteriously this evening. it was in the middle of +printing a msg to my DUMP about loading a tape and then saying ok, when +all of a sudden it said + ?rivPARITY +and the console was talking to KLDCP. the easy way out was to reattach that +hactrn to the vt52, so i took it. but when that tape was done and i tried +to boot the system to regain access to the sysconsole, it died twice during +the reboot process, at different places, each time with the blank but +ominous msg: PARITY. the mem bays didn't indicate par errs, but i tried +resetting them anyway. each time, after resetting bay D a couple times, its +par err light would come on. after resetting more, the light would +disappear, sometimes return, and then go away again. it did eventually +cooperate and let the machine come up, but this was very odd. + +Received: from Think.COM (TCP 1201000006) by AI.AI.MIT.EDU 22 Aug 88 13:32:30 EDT +Return-Path: +Received: from joplin.think.com ([192.31.181.10]) by Think.COM; Mon, 22 Aug 88 13:30:49 EDT +Received: by joplin.think.com; Mon, 22 Aug 88 13:30:32 EDT +Date: Mon, 22 Aug 88 13:30:32 EDT +From: gls@Think.COM +Message-Id: <8808221730.AA03248@joplin.think.com> +To: ALAN@ai.ai.mit.edu +Cc: BUG-ITS@ai.ai.mit.edu +In-Reply-To: Alan Bawden's message of Sun, 14 Aug 88 22:15:58 EDT <427454.880814.ALAN@AI.AI.MIT.EDU> + + Date: Sun, 14 Aug 88 22:15:58 EDT + From: Alan Bawden + + AI is running an ITS patched so that .HANG with a non-zero AC is an illegal + UUO. System hackers should be on the lookout for any programs that appear + to be broken by this. + + The idea is to learn if anybody uses the AC field in .HANG for any private + purposes before I give it a meaning. I propose to make .HANG with a + non-zero AC behave like the disjunction of .HANG and .SLEEP, so that you + can wait for a location to change -or- for a timeout to occur. So + + movei 10,5*30. + skipl lock + .hang 10, ; (sic) + jumpe 10,timout ; C(AC) = 0 if and only if timer expired. + ; If not, C(AC) is negative of time to wait + ; for (just like .SLEEP). + + will wait for 5 seconds for C(LOCK) to be negative, and will then time out. + + +Gee, why didn't we do this ten years ago??? +--Guy + +Date: Sun, 14 Aug 88 22:15:58 EDT +From: Alan Bawden +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <427454.880814.ALAN@AI.AI.MIT.EDU> + +AI is running an ITS patched so that .HANG with a non-zero AC is an illegal +UUO. System hackers should be on the lookout for any programs that appear +to be broken by this. + +The idea is to learn if anybody uses the AC field in .HANG for any private +purposes before I give it a meaning. I propose to make .HANG with a +non-zero AC behave like the disjunction of .HANG and .SLEEP, so that you +can wait for a location to change -or- for a timeout to occur. So + + movei 10,5*30. + skipl lock + .hang 10, ; (sic) + jumpe 10,timout ; C(AC) = 0 if and only if timer expired. + ; If not, C(AC) is negative of time to wait + ; for (just like .SLEEP). + +will wait for 5 seconds for C(LOCK) to be negative, and will then time out. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 12 Aug 88 18:00:16 EDT +Date: Fri 12 Aug 88 17:47:25-EDT +From: Rob Austein +Subject: Re: When the KL is shut down, and taken apart. +To: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU +cc: bug-its@AI.AI.MIT.EDU, tjg@XX.LCS.MIT.EDU, dempster@TOPS20.DEC.COM +In-Reply-To: <7J14CB@KICKI.STACKEN.KTH.SE> +Message-ID: <12421931449.38.SRA@XX.LCS.MIT.EDU> + + Date: Fri, 12 Aug 88 12:41:06 +0200 + From: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU (Peter Lothberg) + + When MX finally is going to be turned off and brought out from the + 9:th floor to Sweden, where it hopfully will become alive again. + + I thought that it might be a god idea to have a 'burial cermony', or + a small party. Or..?? + +Yeah, let's throw a wake. Even though we plan for the machine to come +back to life in Sweden, it'll be the end of an era here, and god knows +the machine deserves a wake after all we've put it through. + + (I want to have pictures of most of the people that has been involved + in the ITS development, so we can have a 'history book' along with the + machine, a this might be the right time to shoot them.) + +Which are you shooting, the pictures or the people? +------- + +Received: from MITVMA.MIT.EDU (TCP 2227000003) by AI.AI.MIT.EDU 12 Aug 88 08:13:35 EDT +Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (IBM VM SMTP R1.1) with BSMTP id 3058; Fri, 12 Aug 88 08:07:52 EDT +Received: from SEKTH.BITNET by MITVMA.MIT.EDU (Mailer X1.25) with BSMTP id + 2956; Fri, 12 Aug 88 08:07:36 EDT +Received: from kth.se by KTH-BITNET-GATEWAY ; 12 Aug 88 10:40:14 GMT +Received: from kicki.stacken.kth.se by kth.se (5.57+IDA+KTH/3.0) + id AA20391; Fri, 12 Aug 88 12:40:06 +0200 +Date: Fri, 12 Aug 88 12:41:06 +0200 +From: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU (Peter Lothberg) +To: bug-its@ai.ai.mit.edu, tjg@xx.lcs.mit.edu, dempster@tops20.dec.com +Subject: When the KL is shut down, and taken apart. +Message-Id: <7J14CB@KICKI.STACKEN.KTH.SE> + + +When MX finally is going to be turned off and brought out from the +9:th floor to Sweden, where it hopfully will become alive again. + +I thought that it might be a god idea to have a 'burial cermony', or +a small party. Or..?? + +(I want to have pictures of most of the people that has been involved + in the ITS development, so we can have a 'history book' along with the + machine, a this might be the right time to shoot them.) + +Peter + + +Date: Wed, 10 Aug 88 02:03:22 EDT +From: "Pandora B. Berman" +Subject: KL hardware bug of the week club +To: TY@AI.AI.MIT.EDU, TJG@AI.AI.MIT.EDU, JTW@AI.AI.MIT.EDU +cc: CENT@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <425456.880810.CENT@AI.AI.MIT.EDU> + +two weeks ago, the KL HARDWARE BUG OF THE WEEK CLUB brought you the +repeated crash of the console 11. we followed up with several days of +incessant non-fatal parity errors which invariably led to fatal ones or +ucode hangs, and topped it off with an admixture of crashing 11 again. + +after a day or two to let you catch your breath, we now present: + + DEATH OF THE CAPSTAN MOTOR + +the symptoms you will encounter include: + tape not loading because the take-up reel won't spin to wind it + and + take-up reel ceasing to spin, for no apparent reason, in the middle + of a copy operation, leading to tape piling up in the vacuum columns, + the drive taking itself offline, and the copy stopping dead in its + tracks because DUMP can no longer talk to the drive + +This is serious; the MX tape drive is becoming unusable. I can deal with +the machine crashing; i can't fix that motor. This problem just started +occurring this evening and it seems to be getting rapidly worse; it's now +sufficiently bad that i can't get through copying a single old tape +successfully. This must be fixed (competently) for me to do any more tape +copying. Call in DEC if you must, but get it done. + +Date: Mon, 8 Aug 88 05:10:44 EDT +From: "Pandora B. Berman" +Subject: ai console broken +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <424212.880808.CENT@AI.AI.MIT.EDU> + +ai's console makes obnoxious noises and lights its paper-out indicator +whenever it tries to type more than 18 chars on a line. + +Date: Sat, 6 Aug 88 05:26:22 EDT +From: "Pandora B. Berman" +Subject: ominous new turn +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <423574.880806.CENT@AI.AI.MIT.EDU> + +MX has been getting parity errors right and left whenever i copy tapes. +then the system console went west again (the 11 crashed), so i had to patch +the sys job and move my dump job to the vt52. when i decided to punt the +dump, i tried to boot the system to restore function to the console. this +went OK until i tried to load MTPITS. then everything stopped. the state is +characterized more by what it is not: MX does not respond to the disk boot +button; the disk is not unsafe; the fault light is not on; the breakers are +not tripped; the par err lights are not on. normally my next trick would +be to power cycle the machine, but in its current fragile state, i don't +want to do that without a real hacker around to help pick up the pieces. +someone please check it out. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 29 Jul 88 11:24:17 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 440141; Fri 29-Jul-88 11:22:38 EDT +Date: Fri, 29 Jul 88 11:22 EDT +From: David A. Moon +Subject: MX falls over, tapes flutter +To: Pandora B. Berman +cc: BUG-ITS@AI.AI.MIT.EDU, BUG-MAGDMP@AI.AI.MIT.EDU, TJG@AI.AI.MIT.EDU +In-Reply-To: <419832.880728.CENT@AI.AI.MIT.EDU> +Message-ID: <19880729152207.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu, 28 Jul 88 23:48:02 EDT + From: "Pandora B. Berman" + + .... + a possibly related problem: the second time this happened, i was running + into a tape flap error. what happens -- apparently reproducibly with AI + tape 1088 -- is that while reading the tape, it hits some region about 3/4 + of the way in that it doesn't like. the vacuum columns start to flutter. + the tape continues feeding into them, slowly, until it apparently reaches a + max enforced by the hardware. then the tape in the columns just flutters, + not very far up or down, but a lot; the tape on the input spindle shakes in + concert with them, but i couldn't tell whether the takeup reel was moving + at all. the scary thing is that this aberrant behaviour produces no err + msgs, so i can't tell what to do. + +This behavior is what the drive looks like when there is a read error and +the software keeps retrying the read. The tape is actually going forwards and +backwards about 9 inches very quickly. I'm surprised it doesn't eventually +give up and report a hard read error. Maybe some bug. You might end up not +being to copy that tape. + +Date: Thu, 28 Jul 88 23:48:02 EDT +From: "Pandora B. Berman" +Subject: MX falls over, tapes flutter +To: BUG-ITS@AI.AI.MIT.EDU, BUG-MAGDMP@AI.AI.MIT.EDU +cc: TJG@AI.AI.MIT.EDU +Message-ID: <419832.880728.CENT@AI.AI.MIT.EDU> + +tonight MX got 2 errors of the form + UUO while in AC BLK 0 + BUGHALT.... +within about 2 hours. alan looked at the first one and said "but it can't +do that!" and explained that that purported to convey that the SYS job was +running with accumulator block 0 selected, which i gather is a bad thing. +when the second one occured he was on his way out the door, and suggested +that if it keeps getting UUOs like this, maybe the processor is actually +broken and needs to by fixed by (gulp) DEC. i have not touched it; someone +competent please investigate. + +a possibly related problem: the second time this happened, i was running +into a tape flap error. what happens -- apparently reproducibly with AI +tape 1088 -- is that while reading the tape, it hits some region about 3/4 +of the way in that it doesn't like. the vacuum columns start to flutter. +the tape continues feeding into them, slowly, until it apparently reaches a +max enforced by the hardware. then the tape in the columns just flutters, +not very far up or down, but a lot; the tape on the input spindle shakes in +concert with them, but i couldn't tell whether the takeup reel was moving +at all. the scary thing is that this aberrant behaviour produces no err +msgs, so i can't tell what to do. + +NB: over the past several days the front-end 11 has crashed twice, causing +the sysconsole to go west. the first time, this weekend, i used a bigger +hammer by rebooting the whole machine. when it happened again earlier this +evening, alan tried to apply sweet reason to it, but it didn't work, so +he had to boot MX. but that wasn't what caused the lack of err msgs about +the tape flutter, because the sysconsole was entirely capable of printing +the UUO err msg. + +see the system log. no film at 11. + +Date: Tue, 26 Jul 88 02:16:06 EDT +From: "Pandora B. Berman" +Subject: poor old kl hardware sux rocks +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <418290.880726.CENT@AI.AI.MIT.EDU> + +it's been crashing on me every 10-15 minutes for the past 2 hours. +probably i have been forcing it to over-exertion by trying to read a +remote tape -and- (via supdup) to catch up with my old mail at the +same time. the remote tape is a copied KA full, which i am trying to +list to a file; i suppose i'll just have to do that elsewhere while +using the KL to send bits out. + i don't mind the constant too many par err problems -- at least, +i have been managing to make progress despite them. but now unit 0 has +its UNSAFE light on. i don't want to deal with that at this hour. +someone else please take a look at it. thanks. + +Date: Sat, 23 Jul 88 02:17:38 EDT +From: "Pandora B. Berman" +Subject: patched MX system +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <417298.880723.CENT@AI.AI.MIT.EDU> + +thanks to moon, MX is running MTPITS, a version of NITS patched to be +especially nice to tape software. it should continue running MTPITS +until the tape copying project is done. + +Date: Sat, 2 Jul 88 14:04:15 EDT +From: Devon Sean McCullough +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <406657.880702.DEVON@AI.AI.MIT.EDU> + +I found I had a detached tree from yesterday (phone lines here are ATROCIOUS) and it had an emacs in it...so I logged in and did alt-G at the emacs and I got --Undefined Symbols-- which to me says there's been bitrot. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 22 Jun 88 22:26:47 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 22 Jun 88 22:13:53 EDT +Date: Wed 22 Jun 88 22:13:36-EDT +From: Rob Austein +To: ZVONA@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU +In-Reply-To: <440792.880622.ZVONA@MC.LCS.MIT.EDU> +Message-ID: <12408610560.16.SRA@XX.LCS.MIT.EDU> + + Date: Wed, 22 Jun 88 21:28:11 EDT + From: David Chapman + + Why can't I link to a non-disk device? The AI: device, in particular? + +Presumably because the UFD definition for links allows SNAME, FN1, & +FN2 but doesn't allow device names. See AI:SYSTEM;FSDEFS. + +Also presumably because by the time you get to deciphering links the +filesystem code just knows that it must be dealing with a disk device. + +Neither of which is a reason why you -shouldn't- be able to link to +non-disk devices, just why you can't. +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 22 Jun 88 21:28:36 EDT +Date: Wed, 22 Jun 88 21:28:11 EDT +From: David Chapman +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <440792.880622.ZVONA@MC.LCS.MIT.EDU> + +This is a stupid question, but maybe someone won't mind educating me: + +Why can't I link to a non-disk device? The AI: device, in particular? + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 16 Jun 88 22:01:51 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 16 Jun 88 21:58:46 EDT +Date: Thu 16 Jun 88 21:57:50-EDT +From: Rob Austein +Subject: Re: well, I hope there's SOME explanation for this +To: PGS@XX.LCS.MIT.EDU +cc: bug-twenex@XX.LCS.MIT.EDU, bug-its@MC.LCS.MIT.EDU, + bug-finger@MC.LCS.MIT.EDU +In-Reply-To: +Message-ID: <12407034826.27.SRA@XX.LCS.MIT.EDU> + + Date: Thu, 16 Jun 1988 19:39 EDT + From: PGS@XX.LCS.MIT.EDU + + This is not a joke. This happens consistently on XX. + + [PHOTO: Recording initiated Thu 16-Jun-88 7:33PM] + + MIT TOPS-20 Command Processor 5(312162)-2 + No mail. + @whois yomama yomama@mc + [MC.LCS.MIT.EDU] + -User- --Full name-- Jobnam Idle TTY -Console location- + ALAN ` Alan Bawden P 1:18 T05 723 x8843 Alan, HQM + (Spaceman) [AI] Hacking too many things for my own good + Birthday January 23; NE43-723; 3-8843; Home Phone 492-7274 + 29 Reed St., Cambridge, MA 02140 + + @pop + + [PHOTO: Recording terminated Thu 16-Jun-88 7:34PM] + +The bug is in the Twenex finger program. The only explaination I can +think of is that the guy who wrote the parsing code in that program +had his brain held hostage on planet Quorgon while he was writing that +part of it. The amazing thing is that the program runs at all. Even +more amazing is that it ever works in server mode, considering that it +gets its JCL by each FINGER stuffing its RFC packet into the CHARFC +job's shared RSCAN% buffer. + +I suppose I might try to fix this some day, but since it only catches +a subset of completely bogus names I don't intend to worry about it +much. +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 16 Jun 88 19:43:00 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 16 Jun 88 19:40:56 EDT +Date: Thu, 16 Jun 1988 19:39 EDT +Message-ID: +From: PGS@XX.LCS.MIT.EDU +To: bug-twenex@XX.LCS.MIT.EDU, bug-its@MC.LCS.MIT.EDU, + bug-finger@MC.LCS.MIT.EDU +Subject: well, I hope there's SOME explanation for this + +This is not a joke. This happens consistently on XX. + + [PHOTO: Recording initiated Thu 16-Jun-88 7:33PM] + + MIT TOPS-20 Command Processor 5(312162)-2 + No mail. + @whois yomama yomama@mc + [MC.LCS.MIT.EDU] + -User- --Full name-- Jobnam Idle TTY -Console location- + ALAN ` Alan Bawden P 1:18 T05 723 x8843 Alan, HQM + (Spaceman) [AI] Hacking too many things for my own good + Birthday January 23; NE43-723; 3-8843; Home Phone 492-7274 + 29 Reed St., Cambridge, MA 02140 + + @pop + + [PHOTO: Recording terminated Thu 16-Jun-88 7:34PM] + +But, come to think of it: Alan, can I go to the dance on Saturday night? +Oh, come on, pleeeeeze?! + + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM (TCP 20024224451) by AI.AI.MIT.EDU 15 Jun 88 19:18:55 EDT +Received: from SWAN.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 301145; Wed 15-Jun-88 19:15:48 EDT +Date: Wed, 15 Jun 88 19:15 EDT +From: David C. Plummer +Subject: Re: This is important! +To: Alan Bawden , kao@VERMITHRAX.SCH.Symbolics.COM, SRA@XX.LCS.MIT.EDU, + maeda@MCC.COM, DCP@QUABBIN.SCRC.Symbolics.COM, cjl@WHEATIES.AI.MIT.EDU, + Gumby@MCC.COM +cc: Customer-Reports@VERMITHRAX.SCH.Symbolics.COM, Bug-ITS@AI.AI.MIT.EDU, + Bug-Lispm@REAGAN.AI.MIT.EDU, TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880615210705.7.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <19880615231501.4.DCP@SWAN.SCRC.Symbolics.COM> + + Date: Wed, 15 Jun 88 17:07 EDT + From: Alan Bawden + ... + Date: Tue, 14 Jun 88 17:16 EDT + From: David C. Plummer + ... + BTW, I think decreasing the file control lifetime would make the + problem WORSE!! (I'm not sure about that, though.) + + I'd be interested in understanding why. Is it because the thing that times + out connections might not actually shut down the connection, but would + cause the 3600 to forget about it, this accumulating even more useless + connections? + +Anytime the control connection dies (either because the network spazzed, +or because the scavenger closes it), the next file operation will find +this control connection (ConnA), notice it is dead, reset it (here's the bug: +which forgets about it), reestablish connection, and then use ConnA for +the duration of this single file operation. The next file operation +will not even find ConnA and must therefore cons up a new one (ConnB). +ConnB will be found for a while. When it dies, it will still be found +(once), get forgotten about and used, and then ConnC must be consed up. + +So... The more often the file connection scavenger runs, the faster the +connections die, so the higher the rate of finding/forgetting and thus +leaving open but connections around. + + ... + + Which finally brings me to the real point of the message. Unfortunately, + despite Symbolic's best efforts (for which I thank them), we are still left + in a situation where we have to get zapped at least once by a site before + we can send them the fix. We can spread the fix around ourselves to the + most likely places, but we can still lose now and then. + + Therefore, unless anybody objects or has a better plan, I plan to install a + tasteless little demon that checks for FTP and GATEWAY servers that are + clearly idle, and guns them down. That should be an effective defense + against any future offenders. (I'll have it keep a log of what it does, so + that we can still spot the losers and send them the patch.) + +Sounds fine to me. I'd use 20 minutes as idle, which I think gives the +typical 15 minute connection scavenger a chance first. Also, be careful +what you call "idle." LispMs will issue reset-provoking-probes at +rather short intervals, so you should measure idle by actualy byte +(sequence number) traffic, not last-time-a-packet-seen (since chaos has +a stronger are-you-alive idle probe). I guess this is just process idle +time... + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 15 Jun 88 17:10:31 EDT +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 119774; Wed 15-Jun-88 17:07:13 EDT +Date: Wed, 15 Jun 88 17:07 EDT +From: Alan Bawden +Subject: Re: This is important! +To: kao@VERMITHRAX.SCH.Symbolics.COM, SRA@XX.LCS.MIT.EDU, maeda@MCC.COM, + DCP@QUABBIN.SCRC.Symbolics.COM, cjl@WHEATIES.AI.MIT.EDU, Gumby@MCC.COM +cc: Customer-Reports@VERMITHRAX.SCH.Symbolics.COM, Bug-ITS@AI.AI.MIT.EDU, + Bug-Lispm@REAGAN.AI.MIT.EDU, TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880611005711.2.KAO@BINKLEY.SCH.Symbolics.COM>, + <19880613151342.8.KAO@BINKLEY.SCH.Symbolics.COM>, + <12406136710.21.SRA@XX.LCS.MIT.EDU>, + <19880613161443.4.MAEDA@PELE.ACA.MCC.COM>, + <19880613170125.3.DCP@SWAN.SCRC.Symbolics.COM>, + <12406155402.19.SRA@XX.LCS.MIT.EDU>, + <19880613221658.4.CJL@OTIS.AI.MIT.EDU>, + <880613222026.8.GUMBY@BRAHMA.ACA.MCC.COM>, + <19880614211637.8.DCP@SWAN.SCRC.Symbolics.COM>, + <19880615034707.7.CJL@OTIS.AI.MIT.EDU>, + <19880615151443.1.KAO@BINKLEY.SCH.Symbolics.COM>, + <880615114233.8.GUMBY@BRAHMA.ACA.MCC.COM> +Message-ID: <19880615210705.7.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Mon, 13 Jun 88 08:13 PDT + From: kao@VERMITHRAX.SCH.Symbolics.COM + [Response from the developer. Hope it helps.] + Certainly a quick work around for this would be to reduce the + file-control-lifetime for MC to something less than 15 minutes and make + sure all the machines see the namespace update. + +Although we haven't done this anywhere (unless our friends at MCC have done +this?) this is a reasonable suggestion which did not occur to me when I +spotted the problem initially. Please thank the unnamed developer for me. + + Date: Mon, 13 Jun 88 22:20 CDT + From: David Vinayak Wallace + The problem is with FILE connections, not GATEWAY connections. + +[ Aside to Gumby: The problem with GATEWAY connections is only that + someone who uses Chaos TCP-GATEWAY service on MC to access a remote FTP + server winds up using zillions of Chaos -and- TCP connections on MC. I + suppose you are trying to say that if the problem with FTP connections + gets solved, the problem with GATEWAY connections goes away. This is + correct. ] + + Date: Tue, 14 Jun 88 17:16 EDT + From: David C. Plummer + ...I'm pretty sure the code in + Zermatt.LCS.MIT.EDU:>dcp>tcp-ftp-delete.lisp fixes it.... I still need + to run it by the person current maintainer (who isn't the author) for a + sanity check. Having you folks run it would be a good use-test.... + + BTW, I think decreasing the file control lifetime would make the + problem WORSE!! (I'm not sure about that, though.) + +I'd be interested in understanding why. Is it because the thing that times +out connections might not actually shut down the connection, but would +cause the 3600 to forget about it, this accumulating even more useless +connections? + + Date: Tue, 14 Jun 88 23:47 EDT + From: Chris Lindblad + I added this to our local 7-2-patches system. It will get loaded into + most machines here when they boot. + +Of course this isn't much of a test, since (as far as I know) all the +machines that load 7-2-Patches are machines that can talk CHAOS QFILE to all +the ITS machines, and they also talk TCP, so there is no reason they should +need CHAOS GATEWAY service either. + + Date: Wed, 15 Jun 88 11:42 CDT + From: David Vinayak Wallace + This patch appears to have a bug (which I have reported to DCP). I + would not suggest supplying it to the unwary. + +Now if Gumby and Maeda at MCC try this patch out, that will be a real test. +As soon as they are satisfied that it works, then we can think about +handing it out to other sites that we discover causing this problem in the +future. + +Which finally brings me to the real point of the message. Unfortunately, +despite Symbolic's best efforts (for which I thank them), we are still left +in a situation where we have to get zapped at least once by a site before +we can send them the fix. We can spread the fix around ourselves to the +most likely places, but we can still lose now and then. + +Therefore, unless anybody objects or has a better plan, I plan to install a +tasteless little demon that checks for FTP and GATEWAY servers that are +clearly idle, and guns them down. That should be an effective defense +against any future offenders. (I'll have it keep a log of what it does, so +that we can still spot the losers and send them the patch.) + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 15 Jun 88 12:46:09 EDT +Received: from BRAHMA.ACA.MCC.COM by MCC.COM with TCP/SMTP; Wed 15 Jun 88 11:42:53-CDT +Date: Wed, 15 Jun 88 11:42 CDT +From: David Vinayak Wallace +Subject: This is important! +To: kao@VERMITHRAX.SCH.Symbolics.COM +cc: Alan@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, Customer-Reports@VERMITHRAX.SCH.Symbolics.COM, + Bug-ITS@AI.AI.MIT.EDU +In-Reply-To: <19880615151443.1.KAO@BINKLEY.SCH.Symbolics.COM> +Supersedes: <880615114204.7.GUMBY@BRAHMA.ACA.MCC.COM> +Message-ID: <880615114233.8.GUMBY@BRAHMA.ACA.MCC.COM> +Character-Type-Mappings: (1 0 (NIL 0) (NIL NIL :TINY) "TINY") +Fonts: CPTFONT, TINY + + Date: Wed, 15 Jun 88 08:14 PDT + From: kao@VERMITHRAX.SCH.Symbolics.COM + + Date: Fri, 10 Jun 88 17:42 EDT + From: Alan Bawden + +1 In Symbolics 3640 Genera 7.2, Experimental Logical Pathnames Translation Files NEWEST, Metering Substrate 26.7, Metering 11.1, Hacks 14.1, IP-TCP 67.5, + ILA-NFS 9.6, 7-2-Patches 1.8, MAC 14.5, TeX-DVI 2.2, QUIC 2.0, IMPRESS 2.0, LPD 2.2, Pascal Runtime 20.0, Compiler Tools Package 11.0, + Compiler Tools Runtime 21.0, Pascal Package 9.0, Syntax Editor Runtime 4.0, TeX-SCT 2.1, TeX-Doc 2.0, TeX-Common 2.0, VIRTeX 2.0, TeX 2.0, LaTeX 2.0, + SliTeX 2.0, YTeX 2.0, BibTeX 2.0, Illustrate 13.1, Macsyma 412.45, microcode 3640-MIC 420, FEP 127, FEP0:>v127-lisp.flod(64), + FEP0:>v127-loaders.flod(64), FEP0:>v127-debug.flod(38), FEP0:>v127-info.flod(64), Machine serial number 5233, + Patches for Alan (from B:>alan>rel-7-2-patch.lisp.2) + on Symbolics 3640 #5233 (Hilbert's Nullstellensatz): + +0 Please, please, please, do something about the bug where when a 3600 uses + TCP/FTP as a file access path it sometimes starts up dozens of FTP servers + on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its + network connections used up because someone somewhere was using FTP to + access files on MC (or on some remote machine with MC serving as a + CHOAS/TCP gateway). + + Here is the patch written by DCP. It fixes the bug you reported. + +This patch appears to have a bug (which I have reported to DCP). I +would not suggest supplying it to the unwary. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 15 Jun 88 11:19:20 EDT +Received: from VERMITHRAX.SCH.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 419997; 15 Jun 88 11:17:15 EDT +Received: from BINKLEY.SCH.Symbolics.COM by VERMITHRAX.SCH.Symbolics.COM via CHAOS with CHAOS-MAIL id 14264; Wed 15-Jun-88 08:14:45 PDT +Date: Wed, 15 Jun 88 08:14 PDT +From: kao@VERMITHRAX.SCH.Symbolics.COM +Subject: This is important! +To: Alan%AI.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM +cc: Bug-Lispm%REAGAN.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, Customer-Reports@VERMITHRAX.SCH.Symbolics.COM, + Bug-ITS%AI.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM +In-Reply-To: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> +References: <12405426732.27.SRA@XX.LCS.MIT.EDU>, + <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> +Message-ID: <19880615151443.1.KAO@BINKLEY.SCH.Symbolics.COM> +Character-Type-Mappings: (1 0 (NIL 0) (NIL NIL :TINY) "TINY") + (2 0 (NIL 0) (NIL :BOLD NIL) "CPTFONTCB") +Fonts: CPTFONT, TINY, CPTFONTCB + + Date: Fri, 10 Jun 88 17:42 EDT + From: Alan Bawden + +1 In Symbolics 3640 Genera 7.2, Experimental Logical Pathnames Translation Files NEWEST, Metering Substrate 26.7, Metering 11.1, Hacks 14.1, IP-TCP 67.5, + ILA-NFS 9.6, 7-2-Patches 1.8, MAC 14.5, TeX-DVI 2.2, QUIC 2.0, IMPRESS 2.0, LPD 2.2, Pascal Runtime 20.0, Compiler Tools Package 11.0, + Compiler Tools Runtime 21.0, Pascal Package 9.0, Syntax Editor Runtime 4.0, TeX-SCT 2.1, TeX-Doc 2.0, TeX-Common 2.0, VIRTeX 2.0, TeX 2.0, LaTeX 2.0, + SliTeX 2.0, YTeX 2.0, BibTeX 2.0, Illustrate 13.1, Macsyma 412.45, microcode 3640-MIC 420, FEP 127, FEP0:>v127-lisp.flod(64), + FEP0:>v127-loaders.flod(64), FEP0:>v127-debug.flod(38), FEP0:>v127-info.flod(64), Machine serial number 5233, + Patches for Alan (from B:>alan>rel-7-2-patch.lisp.2) + on Symbolics 3640 #5233 (Hilbert's Nullstellensatz): + +0 Please, please, please, do something about the bug where when a 3600 uses + TCP/FTP as a file access path it sometimes starts up dozens of FTP servers + on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its + network connections used up because someone somewhere was using FTP to + access files on MC (or on some remote machine with MC serving as a + CHOAS/TCP gateway). + + I would appreciate a fix for this problem -quickly- because MIT depends on + MC.LCS.MIT.EDU for moving a fair amount of mail, and this bug totally + disables the machine. This is the kind of problem where I can get somebody + at MIT with an official sounding title to call you all up on the phone and + lodge "official" complaints. + +Here is the patch written by DCP. It fixes the bug you reported. + +;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: USER; Base: 10; Patch-File: T -*- +;;; Patch file for Private version 0.0 +;;; Reason: Removing the connection from the file access path should not +;;; be part of the contract of resetting the connection. +;;; Function (FLAVOR:METHOD :RESET FS:TCP-FTP-CONN): Don't remove. (Doing so is "silly" anyway.) +;;; Remove function (FLAVOR:METHOD :REMOVE-CONN FS:TCP-FTP-FILE-ACCESS-PATH): No longer needed. +;;; Function (DEFUN-IN-FLAVOR FS:TCP-FTP-FIND-CONN FS:TCP-FTP-FILE-ACCESS-PATH): Interact properly with multiple processes. +;;; Written by DCP, 6/14/88 16:18:34 +;;; while running on Swan from MAMA-CASS|FEP1:>SCRC-7-2-E-from-IH-Genera-7-2-C.load.1 +;;; with Genera 7.2, Experimental Logical Pathnames Translation Files NEWEST, +;;; Nsage 27.175, Documentation Database 62.18, Metering Substrate 26.7, +;;; Metering 11.1, Hacks 14.1, IP-TCP 67.5, DNA 41.6, Version Control 52.9, +;;; Compare Merge 18.0, Experimental Lock Simple 19.0, VC Documentation 12.0, +;;; Symbolics In-House 16.7, Symbolics In-House Documentation 6.3, +;;; Experimental Statice 53.0, Unique-ID 11.2, DBFS 54.16, DBFS Utilities 9.0, +;;; Statice-Index 15.0, Statice-Record 26.1, Statice-Model 51.15, +;;; Statice Documentation 16.0, Experimental Statice Examples NEWEST, DBFS-DIR 25.4, +;;; Statice-Utilities 14.4, Tertiary Storage 10.0, DBFS Maintenance 12.0, +;;; Volume Librarian 9.0, Bug Tracking 24.11, Symbolics Boston 17.2, SCRC 37.0, +;;; Experimental Ndomains 18, microcode 3640-MIC 420, FEP 127, +;;; FEP0:>V127-lisp.flod(61), FEP0:>V127-loaders.flod(61), FEP0:>V127-tests.flod(61), +;;; FEP0:>v127-debug.flod(37), FEP0:>V127-ddt.flod(61), FEP0:>V127-info.flod(61), +;;; Machine serial number 4968, +;;; Be more imaginative than "Run" (from Q:>dcp>ideas>info-giving-process-preemption.lisp.8), +;;; System patches for 7.1 domain implementation (from Q:>dcp>domains>system-patches.lisp.5). + + +(NOTE-PRIVATE-PATCH "TCP-FTP: Interact properly with DELETE operation") + + +;===================================== +(SYSTEM-INTERNALS:BEGIN-PATCH-SECTION) +(SYSTEM-INTERNALS:PATCH-SECTION-SOURCE-FILE "SYS:IP-TCP;TCP-FTP.LISP.1527") +(SYSTEM-INTERNALS:PATCH-SECTION-ATTRIBUTES + "-*- Mode: Lisp; Syntax: Common-Lisp; Package: FILE-SYSTEM; Base: 10; Lowercase: Yes -*-") + +;; Connections + +(defmethod (:reset tcp-ftp-conn) () + (setq login-state nil) + (setq state :free) + (when telnet-stream + (send telnet-stream :close :abort) + (setq telnet-stream nil)) + (when data-stream + (send data-stream :close :abort) + 2(setq data-stream nil)0) + (when aux-stream + (send aux-stream :close :abort) + (setq aux-stream nil)) + + 2;; Don't remove the connection. Doing so causes all sorts of grief. +0 2;; There are some parts of the code that :RESET the connection and +0 2;; then proceed to open up a new telnet-stream (e.g., +0 2;; 0tcp-ftp-validate-conn2) and there are others that dolist the conns, +0 2;; and removing a conn out from under them isn't very fun at all! + +0 2;; 0(send file-access-path :remove-conn self) + ) + + +;===================================== +(SYSTEM-INTERNALS:BEGIN-PATCH-SECTION) +(SYSTEM-INTERNALS:PATCH-SECTION-SOURCE-FILE "SYS:IP-TCP;TCP-FTP.LISP.1527") +(SYSTEM-INTERNALS:PATCH-SECTION-ATTRIBUTES + "-*- Mode: Lisp; Syntax: Common-Lisp; Package: FILE-SYSTEM; Base: 10; Lowercase: Yes -*-") + +(FUNDEFINE '(FLAVOR:METHOD :REMOVE-CONN TCP-FTP-FILE-ACCESS-PATH)) + +;===================================== +(SYSTEM-INTERNALS:BEGIN-PATCH-SECTION) +(SYSTEM-INTERNALS:PATCH-SECTION-SOURCE-FILE "SYS:IP-TCP;TCP-FTP.LISP.1527") +(SYSTEM-INTERNALS:PATCH-SECTION-ATTRIBUTES + "-*- Mode: Lisp; Syntax: Common-Lisp; Package: FILE-SYSTEM; Base: 10; Lowercase: Yes -*-") + +(defun-in-flavor (tcp-ftp-find-conn tcp-ftp-file-access-path) () + (loop for conn in conns + when (send conn :allocate) + return conn + finally + 2(let ((new-conn 0(make-instance 'tcp-ftp-conn + :file-access-path self + :service-access-path service-access-path)2)) +0 2(without-interrupts +0 (push 2new-conn 0conns)2) +0 (send *file-connection-scavenger* :run-reason self) + (return 2new-conn0)2)0)) + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 14 Jun 88 23:49:40 EDT +Received: from OTIS.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 119569; Tue 14-Jun-88 23:47:12 EDT +Date: Tue, 14 Jun 88 23:47 EDT +From: Chris Lindblad +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: DCP@quabbin.scrc.symbolics.com +cc: Gumby@mcc.com, SRA@xx.lcs, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, + TJG@xx.lcs +In-Reply-To: The message of 14 Jun 88 17:16 EDT from David C. Plummer +Message-ID: <19880615034707.7.CJL@OTIS.AI.MIT.EDU> + + Date: Tue, 14 Jun 88 17:16 EDT + From: David C. Plummer + + Date: Mon, 13 Jun 88 22:20 CDT + From: David Vinayak Wallace + + The problem is with FILE connections, not GATEWAY connections. + + From poking into it (my machine is one of the main instigators) it looks + like only Symbolics' implementation of FTP is to blame. + + Yup. Legit bug in the Slime mold. I'm pretty sure the code in + Zermatt.LCS.MIT.EDU:>dcp>tcp-ftp-delete.lisp fixes it. I figured out + how to reproduce the problem and this file does appear to fix it. I + still need to run it by the person current maintainer (who isn't the + author) for a sanity check. Having you folks run it would be a good + use-test. I didn't compile the file. + + On the LispM end, this also fixes the orphan TCP (FTP) connection bug, + which accompanies the ITS/TWENEX manifestation. + +I added this to our local 7-2-patches system. It will get loaded into +most machines here when they boot. + + BTW, I think decreasing the file control lifetime would make the problem + WORSE!! (I'm not sure about that, though.) + + Isn't it nice to have a network problem which ISN'T due to unix + violating the spec? At least this way we can get it fixed rather than + be told "Look, it works with all the unix systems I try; you must have a + problem at your end." + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM (TCP 20024224451) by AI.AI.MIT.EDU 14 Jun 88 17:20:16 EDT +Received: from SWAN.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via INTERNET with SMTP id 300788; 14 Jun 88 17:16:27 EDT +Date: Tue, 14 Jun 88 17:15 EDT +From: David C. Plummer +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: David Vinayak Wallace , Chris Lindblad +cc: SRA@XX.LCS.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, + TJG@XX.LCS.MIT.EDU +In-Reply-To: <880613222026.8.GUMBY@BRAHMA.ACA.MCC.COM> +Message-ID: <19880614211534.7.DCP@SWAN.SCRC.Symbolics.COM> + + Date: Mon, 13 Jun 88 22:20 CDT + From: David Vinayak Wallace + + The problem is with FILE connections, not GATEWAY connections. + + From poking into it (my machine is one of the main instigators) it looks + like only Symbolics' implementation of FTP is to blame. + +Yup. Legit bug in the Slime mold. I'm pretty sure the code in +Zermatt.LCS.MIT.EDU:>dcp>tcp-ftp-delete.lisp fixes it. I figured out +how to reproduce the problem and this file does appear to fix it. I +still need to run it by the person current maintainer (who isn't the +author) for a sanity check. Having you folks run it would be a good +use-test. I didn't compile the file. + +On the LispM end, this also fixes the orphan TCP (FTP) connection bug, +which accompanies the ITS/TWENEX manifestation. + + Isn't it nice to have a network problem which ISN'T due to unix + violating the spec? At least this way we can get it fixed rather than + be told "Look, it works with all the unix systems I try; you must have a + problem at your end." + + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM (TCP 20024224451) by AI.AI.MIT.EDU 14 Jun 88 17:20:13 EDT +Received: from SWAN.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via INTERNET with SMTP id 300789; 14 Jun 88 17:17:18 EDT +Date: Tue, 14 Jun 88 17:16 EDT +From: David C. Plummer +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: David Vinayak Wallace , Chris Lindblad +cc: SRA@XX.LCS.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, + TJG@XX.LCS.MIT.EDU +In-Reply-To: <880613222026.8.GUMBY@BRAHMA.ACA.MCC.COM> +Supersedes: <19880614211534.7.DCP@SWAN.SCRC.Symbolics.COM> +Message-ID: <19880614211637.8.DCP@SWAN.SCRC.Symbolics.COM> + + Date: Mon, 13 Jun 88 22:20 CDT + From: David Vinayak Wallace + + The problem is with FILE connections, not GATEWAY connections. + + From poking into it (my machine is one of the main instigators) it looks + like only Symbolics' implementation of FTP is to blame. + +Yup. Legit bug in the Slime mold. I'm pretty sure the code in +Zermatt.LCS.MIT.EDU:>dcp>tcp-ftp-delete.lisp fixes it. I figured out +how to reproduce the problem and this file does appear to fix it. I +still need to run it by the person current maintainer (who isn't the +author) for a sanity check. Having you folks run it would be a good +use-test. I didn't compile the file. + +On the LispM end, this also fixes the orphan TCP (FTP) connection bug, +which accompanies the ITS/TWENEX manifestation. + +BTW, I think decreasing the file control lifetime would make the problem +WORSE!! (I'm not sure about that, though.) + + Isn't it nice to have a network problem which ISN'T due to unix + violating the spec? At least this way we can get it fixed rather than + be told "Look, it works with all the unix systems I try; you must have a + problem at your end." + + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 13 Jun 88 23:23:05 EDT +Received: from BRAHMA.ACA.MCC.COM by MCC.COM with TCP/SMTP; Mon 13 Jun 88 22:21:08-CDT +Date: Mon, 13 Jun 88 22:20 CDT +From: David Vinayak Wallace +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: Chris Lindblad +cc: SRA@XX.LCS.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, + TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880613221658.4.CJL@OTIS.AI.MIT.EDU> +Message-ID: <880613222026.8.GUMBY@BRAHMA.ACA.MCC.COM> + +The problem is with FILE connections, not GATEWAY connections. + +From poking into it (my machine is one of the main instigators) it looks +like only Symbolics' implementation of FTP is to blame. + +Isn't it nice to have a network problem which ISN'T due to unix +violating the spec? At least this way we can get it fixed rather than +be told "Look, it works with all the unix systems I try; you must have a +problem at your end." + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 13 Jun 88 18:18:48 EDT +Received: from OTIS.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 119204; Mon 13-Jun-88 18:16:59 EDT +Date: Mon, 13 Jun 88 18:16 EDT +From: Chris Lindblad +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: SRA@XX.LCS.MIT.EDU +cc: Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, TJG@XX.LCS.MIT.EDU +In-Reply-To: <12406136710.21.SRA@XX.LCS.MIT.EDU> +Message-ID: <19880613221658.4.CJL@OTIS.AI.MIT.EDU> +Character-Type-Mappings: (1 0 (NIL 0) (NIL :BOLD NIL) "CPTFONTCB") + (2 0 (NIL 0) (:FIX :ITALIC :NORMAL) "CPTFONTI") +Fonts: CPTFONT, CPTFONTCB, CPTFONTI + + Date: Mon 13 Jun 88 11:44:20-EDT + From: Rob Austein + + My impression is that this really isn't enough, given that MC's hostname + seems to be wired into two zillion pieces of Lispm code (at least, 1I + can't find anything in the namespace that would explain the way lispms + always offer to use MC as a gateway0). Also, the fact that this approach + only works if every namespace that includes a reference to MC gets the + update and nobody anywhere decides to make the lifetime longer again. + Right. I also believe in the tooth fairy.... + +The lisp machines use MC as a gatway because the namespace says it supports +the TCP-GATEWAY service. + +2Showing HOST MC in namespace LCS: +0... +1Service: TCP-GATEWAY CHAOS TCP-GATEWAY +0... + + But I figured I'd give somebody else a chance to tell me that I'm an + ignorant barbarian and that the fix is sufficient. + +I personally doubt the fix will be sufficient. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 13 Jun 88 13:32:50 EDT +Date: Mon 13 Jun 88 13:27:00-EDT +From: Rob Austein +Subject: Re: File-Control-Lifetime "fix" for MC FTP connections +To: DCP@QUABBIN.SCRC.Symbolics.COM +cc: maeda@MCC.COM, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU, + TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880613170125.3.DCP@SWAN.SCRC.Symbolics.COM> +Message-ID: <12406155402.19.SRA@XX.LCS.MIT.EDU> + + Date: Mon, 13 Jun 88 13:01 EDT + From: David C. Plummer + + [Don't shoot the messenger!! I intend to look into this when I get out + from under a week's worth of mail. But don't tell my co-workers that, + nor as a promise I'll find a fix.] + +On that basis, I'm still glad to hear this. Thanks for whatever you +find time to do.... + + Is it really easier to load a patch + on ALL the machines than it is to change a FEW namespaces? + +Moot point, since (almost) all the Tech Square Lispms do automatic +world load installation. + +In any case, it is definitely more permanent to fix the code, too many +people can and do edit the namespace for me to trust anything that can +wipe out an important machine this completely to a namespace entry. + +Also, once we have a patch we can tell the owners of offending +machines to either install the patch or lose access to MC. At the +moment there's no constructive action we can ask offenders to take. +------- + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM (TCP 20024224451) by AI.AI.MIT.EDU 13 Jun 88 13:04:35 EDT +Received: from SWAN.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 300367; Mon 13-Jun-88 13:02:06 EDT +Date: Mon, 13 Jun 88 13:01 EDT +From: David C. Plummer +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: Christopher Maeda , SRA@XX.LCS.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, + Bug-Lispm@REAGAN.AI.MIT.EDU +cc: TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880613161443.4.MAEDA@PELE.ACA.MCC.COM> +Message-ID: <19880613170125.3.DCP@SWAN.SCRC.Symbolics.COM> + + Date: Mon, 13 Jun 88 11:14 CDT + From: Christopher Maeda + + Umm, What should we hicks at MCC set our file control lifetimes for MC + to? Since we have such a large lab contingent here, our Texas based + namespace features such favorites as XX, AI, and yes, MC. Changing all + those namespaces would be kind of hard, especially since ours is + supposed to be secure against the outside world. + +[Don't shoot the messenger!! I intend to look into this when I get out +from under a week's worth of mail. But don't tell my co-workers that, +nor as a promise I'll find a fix.] Is it really easier to load a patch +on ALL the machines than it is to change a FEW namespaces? + + Give em hell, Rob, + Chris + + +Received: from MCC.COM (TCP 1200600076) by AI.AI.MIT.EDU 13 Jun 88 12:24:33 EDT +Received: from PELE.ACA.MCC.COM by MCC.COM with TCP/SMTP; Mon 13 Jun 88 11:15:54-CDT +Date: Mon, 13 Jun 88 11:14 CDT +From: Christopher Maeda +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: SRA@XX.LCS.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU +cc: TJG@XX.LCS.MIT.EDU +In-Reply-To: <12406136710.21.SRA@XX.LCS.MIT.EDU> +Message-ID: <19880613161443.4.MAEDA@PELE.ACA.MCC.COM> + +Umm, What should we hicks at MCC set our file control lifetimes for MC +to? Since we have such a large lab contingent here, our Texas based +namespace features such favorites as XX, AI, and yes, MC. Changing all +those namespaces would be kind of hard, especially since ours is +supposed to be secure against the outside world. + +Give em hell, Rob, +Chris + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 13 Jun 88 11:43:38 EDT +Date: Mon 13 Jun 88 11:44:20-EDT +From: Rob Austein +Subject: File-Control-Lifetime "fix" for MC FTP connections +To: Bug-ITS@AI.AI.MIT.EDU, Bug-Lispm@REAGAN.AI.MIT.EDU +cc: TJG@XX.LCS.MIT.EDU +Message-ID: <12406136710.21.SRA@XX.LCS.MIT.EDU> + +So, is the feeling that this workaround (setting file control lifetime +to something short for MC) sufficient or should I yell at Symbolics +some more? + +My impression is that this really isn't enough, given that MC's hostname +seems to be wired into two zillion pieces of Lispm code (at least, I +can't find anything in the namespace that would explain the way lispms +always offer to use MC as a gateway). Also, the fact that this approach +only works if every namespace that includes a reference to MC gets the +update and nobody anywhere decides to make the lifetime longer again. +Right. I also believe in the tooth fairy.... + +But I figured I'd give somebody else a chance to tell me that I'm an +ignorant barbarian and that the fix is sufficient. + +--Rob +------- + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 13 Jun 88 11:17:26 EDT +Received: from VERMITHRAX.SCH.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 418758; 13 Jun 88 11:15:47 EDT +Received: from BINKLEY.SCH.Symbolics.COM by VERMITHRAX.SCH.Symbolics.COM via CHAOS with CHAOS-MAIL id 13531; Mon 13-Jun-88 08:13:31 PDT +Date: Mon, 13 Jun 88 08:13 PDT +From: kao@VERMITHRAX.SCH.Symbolics.COM +Subject: Re: This is important! +To: SRA%XX.LCS.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, Customer-Reports@VERMITHRAX.SCH.Symbolics.COM +cc: Bug-Lispm%REAGAN.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, Bug-ITS%AI.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, + TJG%XX.LCS.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM +In-Reply-To: <12405426732.27.SRA@XX.LCS.MIT.EDU> +References: <12405426732.27.SRA@XX.LCS.MIT.EDU>, + <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> +Message-ID: <19880613151342.8.KAO@BINKLEY.SCH.Symbolics.COM> + + Date: Fri 10 Jun 88 18:44:18-EDT + From: Rob Austein + + Date: Fri, 10 Jun 88 17:42 EDT + From: Alan Bawden + Subject: This is important! + Message-ID: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> + + Please, please, please, do something about the bug where when a 3600 uses + TCP/FTP as a file access path it sometimes starts up dozens of FTP servers + on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its + network connections used up because someone somewhere was using FTP to + access files on MC (or on some remote machine with MC serving as a + CHOAS/TCP gateway). + + I would appreciate a fix for this problem -quickly- because MIT depends on + MC.LCS.MIT.EDU for moving a fair amount of mail, and this bug totally + disables the machine. This is the kind of problem where I can get somebody + at MIT with an official sounding title to call you all up on the phone and + lodge "official" complaints. + + Ahem. + + I, Robert Austein, Systems Programmer in the MIT Laboratory for + Computer Science Computational Resources group, HostAdmin etcetera of + MC.LCS.MIT.EDU, do hereby lodge an official request that you fix this + bug that Alan has reported ASAP and stop abusing the Mail Cruncher. + + This is pretty clearly not a MIT-specific bug because I've seen this + same thing happen to XX.LCS.MIT.EDU when the culprit is a Lispm at MCC + in Austin, Texas. + + If this request is not sufficient I'll kick this matter upstairs to + the people who negotiate contracts with Symbolics and let them yell at + you, but that's a lot of hassle for everybody so let's not. + + RSVP ASAP. Thanks. + + --Rob + ------- + +[Response from the developer. Hope it helps.] + +Certainly a quick work around for this would be to reduce the +file-control-lifetime for MC to something less than 15 minutes and make +sure all the machines see the namespace update. + +To change FTP from using multiple connections would be a major +architectural change and would divert from the norms used for other file +protocols. I don't think that multiple connections are the problem +here, cleaning up after them is what is causing the pain. There are +some long standing bugs that are very difficult to reproduce and track +down that affect connection cleanup for FTP connections. The easiest +work around that I know of is the short file-control-lifetime in the +host object. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 10 Jun 88 21:00:11 EDT +Received: from VERMITHRAX.SCH.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 418245; 10 Jun 88 20:58:59 EDT +Received: from BINKLEY.SCH.Symbolics.COM by VERMITHRAX.SCH.Symbolics.COM via CHAOS with CHAOS-MAIL id 13385; Fri 10-Jun-88 17:57:00 PDT +Date: Fri, 10 Jun 88 17:57 PDT +From: kao@VERMITHRAX.SCH.Symbolics.COM +Subject: Re: This is important! +To: SRA%XX.LCS.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM +cc: Customer-Reports@VERMITHRAX.SCH.Symbolics.COM, Bug-Lispm%REAGAN.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, + Bug-ITS%AI.AI.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM, TJG%XX.LCS.MIT.EDU@STONY-BROOK.SCRC.Symbolics.COM +In-Reply-To: <12405426732.27.SRA@XX.LCS.MIT.EDU> +Message-ID: <19880611005711.2.KAO@BINKLEY.SCH.Symbolics.COM> + + Date: Fri 10 Jun 88 18:44:18-EDT + From: Rob Austein + + Date: Fri, 10 Jun 88 17:42 EDT + From: Alan Bawden + Subject: This is important! + Message-ID: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> + + Please, please, please, do something about the bug where when a 3600 uses + TCP/FTP as a file access path it sometimes starts up dozens of FTP servers + on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its + network connections used up because someone somewhere was using FTP to + access files on MC (or on some remote machine with MC serving as a + CHOAS/TCP gateway). + + I would appreciate a fix for this problem -quickly- because MIT depends on + MC.LCS.MIT.EDU for moving a fair amount of mail, and this bug totally + disables the machine. This is the kind of problem where I can get somebody + at MIT with an official sounding title to call you all up on the phone and + lodge "official" complaints. + + Ahem. + + I, Robert Austein, Systems Programmer in the MIT Laboratory for + Computer Science Computational Resources group, HostAdmin etcetera of + MC.LCS.MIT.EDU, do hereby lodge an official request that you fix this + bug that Alan has reported ASAP and stop abusing the Mail Cruncher. + + This is pretty clearly not a MIT-specific bug because I've seen this + same thing happen to XX.LCS.MIT.EDU when the culprit is a Lispm at MCC + in Austin, Texas. + + If this request is not sufficient I'll kick this matter upstairs to + the people who negotiate contracts with Symbolics and let them yell at + you, but that's a lot of hassle for everybody so let's not. + + RSVP ASAP. Thanks. + + --Rob + ------- + +Request noted. The bug-report/fix-request has been forwarded to the development +people and software support supervisor. We'll get back to you by the +end of next week. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 10 Jun 88 18:43:20 EDT +Date: Fri 10 Jun 88 18:44:18-EDT +From: Rob Austein +Subject: Re: This is important! +To: Customer-Reports@STONY-BROOK.SCRC.SYMBOLICS.COM +cc: Bug-Lispm@REAGAN.AI.MIT.EDU, Bug-ITS@AI.AI.MIT.EDU, TJG@XX.LCS.MIT.EDU +In-Reply-To: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> +Message-ID: <12405426732.27.SRA@XX.LCS.MIT.EDU> + + Date: Fri, 10 Jun 88 17:42 EDT + From: Alan Bawden + Subject: This is important! + Message-ID: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> + + Please, please, please, do something about the bug where when a 3600 uses + TCP/FTP as a file access path it sometimes starts up dozens of FTP servers + on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its + network connections used up because someone somewhere was using FTP to + access files on MC (or on some remote machine with MC serving as a + CHOAS/TCP gateway). + + I would appreciate a fix for this problem -quickly- because MIT depends on + MC.LCS.MIT.EDU for moving a fair amount of mail, and this bug totally + disables the machine. This is the kind of problem where I can get somebody + at MIT with an official sounding title to call you all up on the phone and + lodge "official" complaints. + +Ahem. + +I, Robert Austein, Systems Programmer in the MIT Laboratory for +Computer Science Computational Resources group, HostAdmin etcetera of +MC.LCS.MIT.EDU, do hereby lodge an official request that you fix this +bug that Alan has reported ASAP and stop abusing the Mail Cruncher. + +This is pretty clearly not a MIT-specific bug because I've seen this +same thing happen to XX.LCS.MIT.EDU when the culprit is a Lispm at MCC +in Austin, Texas. + +If this request is not sufficient I'll kick this matter upstairs to +the people who negotiate contracts with Symbolics and let them yell at +you, but that's a lot of hassle for everybody so let's not. + +RSVP ASAP. Thanks. + +--Rob +------- + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 10 Jun 88 17:45:23 EDT +Received: from NULLSTELLENSATZ.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 118734; Fri 10-Jun-88 17:42:37 EDT +Date: Fri, 10 Jun 88 17:42 EDT +From: Alan Bawden +Subject: This is important! +To: Bug-Lispm@REAGAN.AI.MIT.EDU, Customer-Reports@STONY-BROOK.SCRC.SYMBOLICS.COM +cc: Bug-ITS@AI.AI.MIT.EDU +Message-ID: <19880610214220.1.ALAN@NULLSTELLENSATZ.AI.MIT.EDU> +Character-Type-Mappings: (1 0 (NIL 0) (NIL NIL :TINY) "TINY") +Fonts: CPTFONT, TINY + +1In Symbolics 3640 Genera 7.2, Experimental Logical Pathnames Translation Files NEWEST, Metering Substrate 26.7, Metering 11.1, Hacks 14.1, IP-TCP 67.5, +ILA-NFS 9.6, 7-2-Patches 1.8, MAC 14.5, TeX-DVI 2.2, QUIC 2.0, IMPRESS 2.0, LPD 2.2, Pascal Runtime 20.0, Compiler Tools Package 11.0, +Compiler Tools Runtime 21.0, Pascal Package 9.0, Syntax Editor Runtime 4.0, TeX-SCT 2.1, TeX-Doc 2.0, TeX-Common 2.0, VIRTeX 2.0, TeX 2.0, LaTeX 2.0, +SliTeX 2.0, YTeX 2.0, BibTeX 2.0, Illustrate 13.1, Macsyma 412.45, microcode 3640-MIC 420, FEP 127, FEP0:>v127-lisp.flod(64), +FEP0:>v127-loaders.flod(64), FEP0:>v127-debug.flod(38), FEP0:>v127-info.flod(64), Machine serial number 5233, +Patches for Alan (from B:>alan>rel-7-2-patch.lisp.2) +on Symbolics 3640 #5233 (Hilbert's Nullstellensatz): + +0Please, please, please, do something about the bug where when a 3600 uses +TCP/FTP as a file access path it sometimes starts up dozens of FTP servers +on the file server. Twice now I have found MC.LCS.MIT.EDU with all of its +network connections used up because someone somewhere was using FTP to +access files on MC (or on some remote machine with MC serving as a +CHOAS/TCP gateway). + +I would appreciate a fix for this problem -quickly- because MIT depends on +MC.LCS.MIT.EDU for moving a fair amount of mail, and this bug totally +disables the machine. This is the kind of problem where I can get somebody +at MIT with an official sounding title to call you all up on the phone and +lodge "official" complaints. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 25 May 88 18:17:27 EDT +Date: Wed 25 May 88 18:17:03-EDT +From: "J. Noel Chiappa" +Subject: Re: TCB's all in use. +To: SRA@XX.LCS.MIT.EDU, ALAN@AI.AI.MIT.EDU +cc: BUG-TCP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, GUMBY@AI.AI.MIT.EDU, + ZVONA@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: <12400803897.66.SRA@XX.LCS.MIT.EDU> +Message-ID: <12401227468.31.JNC@XX.LCS.MIT.EDU> + + Rob, your analysis is 100% on the money, and your selected fix +also appears to be the Right Thing. I suggest we do that. + + Noel +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 24 May 88 03:30:15 EDT +Date: Tue 24 May 88 03:30:19-EDT +From: Rob Austein +Subject: Re: TCB's all in use. +To: ALAN@AI.AI.MIT.EDU +cc: BUG-TCP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, GUMBY@AI.AI.MIT.EDU, + ZVONA@AI.AI.MIT.EDU +In-Reply-To: <384099.880524.ALAN@AI.AI.MIT.EDU> +Message-ID: <12400803897.66.SRA@XX.LCS.MIT.EDU> + +The code itself is per spec, although it may not be sufficiently +paranoid. See RFC 793, pages 38-39. It includes a diagram which is +somewhat easier to follow than the text: + +Figure 13 "Normal Close Sequence": + + TCP A TCP B + + 1. ESTABLISHED ESTABLISHED + + 2. (Close) + FIN-WAIT-1 --> --> CLOSE-WAIT + + 3. FIN-WAIT-2 <-- <-- CLOSE-WAIT + + 4. (Close) + TIME-WAIT <-- <-- LAST-ACK + + 5. TIME-WAIT --> --> CLOSED + + 6. (2 MSL) + CLOSED + +ITS is party "A" in this case. COMSAT tells ITS "close this +connection", ITS sends off a FIN. Party "B" ACKs the packet but +doesn't ACK the FIN until it feels like it (closing is half-duplex). +When party "B" decides to close too, it sends a FIN to ITS (note the +odd sequence numbers here). ITS is supposed to ACK this FIN so that +party "B" knows the connection has indeed been closed in everybody's +opinion (ie, FIN is considered data to the extent that must be ACKed). +So ITS sends the ACK and goes into the TIME-WAIT state. If ITS hears +nothing for a certain period of time ("2 MSL") ITS assumes +everything's cool and punts the TCB. If, however, ITS gets another +FIN from party "B", ITS must assume that the ACK ITS just sent got +lost, so ITS sends another ACK and resets the timer. + +Whew. No wonder so many implementers get confused by this! + +It is easy to see how a misbehaving TCP on party "B" could keep us +wedged here forever. + +The RFC says that the only thing you can get when in a TIME-WAIT state +is a retransmission of the other party's FIN. Perhaps the ITS code +takes that for a law of nature rather than a description of two +working TCPs having a conversation. + +It would be interesting to know if the packet that caused us to get to +TSIATW is really the {FIN,ACK} packet we're assuming. If not I'd +think that's immediate grounds for dropping the connection on the +floor, since it demonstrates that at least one party is seriously +confused about the current state. + +If it really is a FIN that we keep getting over and over and over, it +might be reasonable to keep track of how many times we've gone through +this routine and just punt when it gets ridiculous. I think this is +even legitimate: either the foreign machine is broken or the +intervening path is consistantly losing our ACKs, and in either case +it won't do any good to send more ACKs so we might as well not bother. + + +Of course this is the first time I've ever tried to follow all those +silly state diagrams in TCP, so I might be completely confused. + +--Rob +------- + +Date: Tue, 24 May 88 01:47:53 EDT +From: Alan Bawden +Subject: TCB's all in use. +To: BUG-TCP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +cc: GUMBY@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +Message-ID: <384099.880524.ALAN@AI.AI.MIT.EDU> + +Here is my diagnosis of the lossage. Consider the following code: + + ; TSIATW - Received ACK while in TIME-WAIT state. This should be + ; a re-transmit of the remote FIN. ACK it, and restart + ; 2-MSL timeout. + + TSIATW: METER("TCP: ACK in .XSTMW") + MOVSI T,(TC%ACK) + TRCPKT R,"TSIATW ACK send in TIME-WAIT" + CALL TSOSNR ; Send simple ACK in response. + JRST TSITM2 ; and restart 2-MSL timeout. + +Well, if the guy on the other end keeps sending you ACKs, the timeout keeps +getting reset and the TCB never gets freed. I have verified that this is +in fact the path that causes the problem by patching that JRST TSITM2 to be +a POPJ P, and watching the stuck TCB's all vanish. + +I actually don't understand the logic here, it would seem to me that you +should only be sending an ACK for a actual FIN, not just an ACK. I didn't +look to see if the other guy was sending both ACK and FIN or just ACK. Do +you suppose it is likely that the other machines all have this bug as well +and the two are just spinning their wheels bouncing ACKs back an forth? + +There does seem to be other code that handles ACKing of FINs elsewhere in +the the TCP code, but I don't understand enough to know if it is active +when you are in the TIME-WAIT state or not. Conceivably the POPJ P, I +patched in might be the solution to the problem? + +Suggestions? + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 23 May 88 14:20:00 EDT +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 113962; Mon 23-May-88 14:14:19 EDT +Date: Mon, 23 May 88 14:14 EDT +From: Alan Bawden +Subject: What's with all these TIMWTs? +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-TCP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <424674.880523.GUMBY0@MC.LCS.MIT.EDU> +Message-ID: <19880523181422.3.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Mon, 23 May 88 04:23:59 EDT + From: David Vinayak Wallace + Right now there are 26 connections to unix.sri.com in state TIMWT, plus, + plus one in FINWT1 to ub.cc.umich.edu. + ... + There really only looks like there are two lost packets (one to host 0!). + ... + +Its not a question of lost packets, its a question of TCBs, the +per-connection data-structure ITS has to maintain throughout the +connection's lifetime. Unfortunately a connection can live on after a user +process is done with it while the operating systems do some final +handshaking to close things down cleanly. It appears that some new version +of Unix is making the rounds that does something that causes this +handshaking to take virtually forever. + +AI and MC each have 30 TCB's. They used to have 20, but I increased that +when this problem first started happening. I just had to reload AI for the +same reason. There are crash dumps for the interested in +AI:CRASH;CRASH TCB and MC:CRASH;TCP BITIT. + +Date: Mon, 23 May 88 13:09:29 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <383531.880523.ZVONA@AI.AI.MIT.EDU> + +FTP just failed, complaining that "all sockets in use". Peek showed +only two FILE jobs an do FTPs besides mine. What's going on? How +do I fix it? + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 12 May 88 04:05:23 EDT +Date: Wed, 11 May 88 16:23:09 EDT +From: Alan Bawden +Subject: And you thought PDUMP finally worked. +To: BUG-COMSAT@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU +cc: ZVONA@MC.LCS.MIT.EDU +Message-ID: <418741.880511.ALAN@MC.LCS.MIT.EDU> + +Note the -times- in the following consecutive entries from the mailer STATS +file on MC. + + 084735 Note: GC'ing MSGS, 5646555-1620312=4026243 + 145143 ===> BUG: FATAL ERROR <=== Date: 05/11/88 14:51:42 + Autopsy from 22770 Preserved from 22061 + Last UUO = 017100,,062447 at 52657 + +MC was low on disk space at the time, which is probably what caused the +original error, but what do you suppose was happening during the 6 hour +pause? I'll guess that there is a bug in the PDUMP system call (probably +also having to do with low disk space) that kept COMSAT hung until Zvona +logged in and noticed the problem. Probably something he did to try and +diagnose the problem PCLSR'd the call, and then it finished. + + +Date: Wed, 20 Apr 88 14:43:01 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <362739.880420.ZVONA@AI.AI.MIT.EDU> + +AI is out of disk space again. I noticed while deleting OSTATS to make +some room that LISTS MSGS is 628 blocks, which seems big. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 3 Apr 88 18:26:05 EDT +Received: from DESCARTES.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 102573; Sun 3-Apr-88 18:22:03 EDT +Date: Sun, 3 Apr 88 18:22 EDT +From: Alan Bawden +Subject: MD down until further notice. +To: Bug-ITS@AI.AI.MIT.EDU +Message-ID: <880403182202.3.ALAN@DESCARTES.AI.MIT.EDU> + +MD's RP06 won't load its heads. I don't currently have the time to +investigate this problem further. Being MD, it isn't a very critical +problem. + +I guess we should be happy that it is always MD that breaks. + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 29 Mar 88 13:23:17 EST +Received: from OTIS.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 101867; Tue 29-Mar-88 13:19:44 EST +Date: Tue, 29 Mar 88 13:19 EST +From: Chris Lindblad +Subject: Some history questions. +To: bug-its@AI.AI.MIT.EDU, bug-twenex@OZ.AI.MIT.EDU +Message-ID: <880329131943.9.CJL@OTIS.AI.MIT.EDU> + +I'm trying to track down the history of file version numbers, and of delete +and expunge. + +Was it really Tenex that invented the features of file version numbers and +delete-and-expunge? + +Or did file versions in the second name of files appear in ITS before Tenex, +or was the idea inspired by Tenex? + +Can anyone point me to an early Tenex paper describing these features? Any +ITS papers? + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 12 Mar 88 11:35:46 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 12 Mar 88 11:24:33 EST +Date: Sat, 12 Mar 88 11:24:38 EST +From: "Christopher M. Maeda" +Subject: UMass ITS's +To: mike@OZ.AI.MIT.EDU +cc: info-its@MC.LCS.MIT.EDU +Message-ID: <340451.880312.MAEDA@AI.AI.MIT.EDU> + +I heard of a pretty big Intelligent Tutoring Systems effort +going on at UMass. I have the paper at home if you want it. +They aren't really doing anything new, just applying AI to a +new area. The most interesting thing about the paper is that +they continually use the acronym ITS to describe their systems. + +Chris + + +Received: from MEAD.SCRC.Symbolics.COM (TCP 20024224752) by AI.AI.MIT.EDU 7 Mar 88 15:58:19 EST +Received: from BLACK-BIRD.SCRC.Symbolics.COM by MEAD.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 141317; Mon 7-Mar-88 15:58:00 EST +Date: Mon, 7 Mar 88 15:57 EST +From: Ed Schwalenberg +Subject: Re: [ota: SPACE Digest V8 #156] +To: Rob Austein , MAEDA@AI.AI.MIT.EDU +cc: postmaster@MC.LCS.MIT.EDU, MarkL@ALLSPICE.LCS.MIT.EDU, + Info-ITS@AI.AI.MIT.EDU +In-Reply-To: <12380322663.23.SRA@XX.LCS.MIT.EDU> +Message-ID: <880307155748.0.ED@BLACK-BIRD.SCRC.Symbolics.COM> + + Date: Sun 6 Mar 88 23:23:32-EST + From: Rob Austein + + Date: Sun, 6 Mar 88 14:22:49 EST + From: "Christopher M. Maeda" + + The following was posted to space digest in a discussion about + remote logins to the moon.,, + [Note COMSAT ".." lossage here^^.] + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + + For interplanetary stuff you'd want to use a batched mail protocol + like BSMTP over a high bandwidth transmission protocol like NETBLT for + mail. You could probably get away with SMTP to Lunagrad (Moonbase + doesn't look like it's going to be an issue any time soon). + + Remote login will be bad no matter what. The best you could do would + be something like RMS's local editing protocol, again using something + like NETBLT for transmission so that at least screen updates would be + fast once they arrived. + +I actually tried using a computer in Miami from Antarctica via a geosynch +satellite. It was, er, painful. But I did a fun experiment too: I did +an analog loopback through the satellite, and watched my characters echo +on the screen. Then I tried typing a character, and while it was on its +way up and back I digitally looped back my end. After about 6 passes the +character would begin to decay: + aaaaaabp~~~~~~ +Another satellite hacker (the gentleman in Miami) ran a PDP-11 to the satellite, +ran the analog downlink back up to another channel on the same satellite, then +to a terminal, for a total delay of about .75 sec. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Mar 88 23:50:25 EST +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 6 Mar 88 23:32:24 EST +Date: Sun 6 Mar 88 23:23:32-EST +From: Rob Austein +Subject: Re: [ota: SPACE Digest V8 #156] +To: MAEDA@AI.AI.MIT.EDU +cc: info-its@MC.LCS.MIT.EDU, postmaster@MC.LCS.MIT.EDU, + MarkL@ALLSPICE.LCS.MIT.EDU +In-Reply-To: <336939.880306.MAEDA@AI.AI.MIT.EDU> +Message-ID: <12380322663.23.SRA@XX.LCS.MIT.EDU> + + Date: Sun, 6 Mar 88 14:22:49 EST + From: "Christopher M. Maeda" + + The following was posted to space digest in a discussion about + remote logins to the moon.,, +[Note COMSAT ".." lossage here^^.] + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + +For interplanetary stuff you'd want to use a batched mail protocol +like BSMTP over a high bandwidth transmission protocol like NETBLT for +mail. You could probably get away with SMTP to Lunagrad (Moonbase +doesn't look like it's going to be an issue any time soon). + +Remote login will be bad no matter what. The best you could do would +be something like RMS's local editing protocol, again using something +like NETBLT for transmission so that at least screen updates would be +fast once they arrived. + +You might also want to ask somebody at BBN about the current tuning of +the ARPANET (net 10.0.0.0 itself): one of the three transcontinental +channels is a comsat link, the other two are land lines, and all hell +broke loose for the few days between when they installed the comsat +link and when they got it tuned properly. +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Mar 88 20:20:27 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 6 Mar 88 19:56:02 EST +Date: Sun, 6 Mar 88 14:22:49 EST +From: "Christopher M. Maeda" +Subject: [ota: SPACE Digest V8 #156] +To: info-its@MC.LCS.MIT.EDU, postmaster@MC.LCS.MIT.EDU +Message-ID: <336939.880306.MAEDA@AI.AI.MIT.EDU> + + +The following was posted to space digest in a discussion about +remote logins to the moon.,, + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + +Chris + + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 26 Feb 88 12:29:35 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 94699; Fri 26-Feb-88 12:26:35 EST +Date: Fri, 26 Feb 88 12:26 EST +From: Alan Bawden +Subject: What the heck is this? +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <880226122631.0.ALAN@PIGPEN.AI.MIT.EDU> + +These connections to ELBERETH.RUTGERS.EDU have been in this state since +sometime yesterday. I'm going to take a crash dump into +AI:CRASH;TCP ELBERE and reload the system so that we can free up some +network channels. + + +AI ITS 1615 Peek 629 2/26/88 11:14:28 Up time = 19:21:17:00 +IMP is up. TCP/IP is available. +Ix Usr Uname Jname State RWnd Ibf SWnd ReTxQ Lclprt Fgnprt Fgnhst + 5 6 15TLNT TELSER OPEN 5170 0 10000 0 0 27 2012 MONK.PROTEON.COM + 4 20 406T20 TCP OPEN 11324 0 10000 0 0 10263 31 ATHENA.MIT.EDU + 0 24 406T24 TCP SYNSNT 5170 0 0 1 0 12264 31 WALKER-EMH.ARPA +23 TIMWT 5170 0 20000 0 0 31 6150 ELBERETH.RUTGERS.EDU +22 TIMWT 5170 0 20000 0 0 31 3302 ELBERETH.RUTGERS.EDU +21 TIMWT 5170 0 20000 0 0 31 5746 ELBERETH.RUTGERS.EDU +20 TIMWT 5170 0 20000 0 0 31 3305 ELBERETH.RUTGERS.EDU +17 TIMWT 5170 0 20000 0 0 31 10021 TOPAZ.RUTGERS.EDU +16 TIMWT 5170 0 20000 0 0 31 6717 ELBERETH.RUTGERS.EDU +15 TIMWT 5170 0 20000 0 0 31 5712 ELBERETH.RUTGERS.EDU +14 TIMWT 5170 0 20000 0 0 31 11164 ELBERETH.RUTGERS.EDU +13 TIMWT 5170 0 20000 0 0 31 11602 ELBERETH.RUTGERS.EDU +12 TIMWT 5170 0 20000 0 0 31 10312 ELBERETH.RUTGERS.EDU +11 TIMWT 5170 0 20000 0 0 31 11407 ELBERETH.RUTGERS.EDU +10 TIMWT 5170 0 20000 0 0 31 5727 ELBERETH.RUTGERS.EDU + 7 TIMWT 5170 0 20000 0 0 31 10614 ELBERETH.RUTGERS.EDU + 6 TIMWT 5170 0 20000 0 0 31 11226 ELBERETH.RUTGERS.EDU + 3 TIMWT 5170 0 20000 0 0 31 5235 ELBERETH.RUTGERS.EDU + 2 TIMWT 5170 0 20000 0 0 31 10015 ELBERETH.RUTGERS.EDU + 1 TIMWT 5170 0 20000 0 0 31 10340 ELBERETH.RUTGERS.EDU +8 buffers (7 free) + +STY Map + Idx STY owner Idx STY user Host +T15 6 15TLNT TELSER 12 JNC CHTN MONK.PROTEON.COM (TCP) +T16 13 16TLNT TELSER 23 ALAN P PIGPEN.AI.MIT.EDU (Chaos) + + +Date: Thu, 25 Feb 88 15:27:46 EST +From: Devon Sean McCullough +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <331879.880225.DEVON@AI.AI.MIT.EDU> + +Suddenly AI is refusing telnet connections and reporting +TCP: SYN queue full +on the console, fairly often. I have never noticed this before. + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 24 Feb 88 16:42:34 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 94062; Wed 24-Feb-88 16:39:52 EST +Date: Wed, 24 Feb 88 16:39 EST +From: Alan Bawden +Subject: weird MC TCP lossage +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, BUG-TCP@AI.AI.MIT.EDU +In-Reply-To: <331156.880224.GUMBY@AI.AI.MIT.EDU> +Message-ID: <880224163949.6.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Wed, 24 Feb 88 06:25:47 EST + From: David Vinayak Wallace + ... The stats file was very interesting. COMSAT would wake up, + connect to some host, deliver all the mail for that host, and then + choke when it got to the next host for which it had mail. The way in + which it choked was interesting: After the HELO it would read the + terminating command from the previous connection. + +This is the usual situation when some TCP resource runs out. Opening a new +pair of TCP channels fails, probably with some kind of device full error, +which COMSAT apparently fumbles to produce this behavior. At least, that's +my theory. SRA claims that the code in COMSAT couldn't possibly have this +bug, and it must be ITS's fault, but I find this hard to believe given that +no other program that uses TCP shows any kind of analogous behavior. + +Unfortunately, it is hard to reproduce this situation so that we can see +what COMSAT is -really- doing. + + ... I called someone on the ninth floor to ask him to take a crash + dump, but mc appears not to have come back up.... + +It looks like it did come back up, but whoever you talked to was typing +total jokes on the console. Like giving nonexistent commands, and typing +DDT commands to the 8080 front-end, etc. + + +Date: Wed, 24 Feb 88 06:25:47 EST +From: David Vinayak Wallace +Subject: weird MC TCP lossage +To: BUG-ITS@AI.AI.MIT.EDU, BUG-TCP@AI.AI.MIT.EDU +Message-ID: <331156.880224.GUMBY@AI.AI.MIT.EDU> + +I was unable to get any sort of tcp connection to MC this morning. +Chaosnet worked fine. I logged in; the machine was idle! Early +morning is often a busy time for ol'MC. + +I spied on COMSAT, which was idle most of the time. The stats file +was very interesting. COMSAT would wake up, connect to some host, +deliver all the mail for that host, and then choke when it got to the +next host for which it had mail. The way in which it choked was +interesting: After the HELO it would read the terminating command +from the previous connection. + +For example COMSAT connected to DECWRL.DEC.COM and apparently +delivered lots of mail successfully (one wonders what it was actually +sending, but the remote host seemed happy). Anyway, when done with +decwrl.dec.com, it tried to talk to some other host, say, bbn.com. +The stats file would say something like "ICP BBN.COM: Bad reply 221 +decwrl.dec.com signing off." + +Well, this was certainly weird. I called someone on the ninth floor +to ask him to take a crash dump, but mc appears not to have come back +up. I don't know what the story is, but it seemed to be happy running +in this weird state. Perhaps our local TCP frobber can shed some +light on this. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 28 Jan 88 13:46:41 EST +Date: Thu, 28 Jan 88 13:46:28 EST +From: David Vinayak Wallace +Subject: AI disk problems +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <364291.880128.GUMBY@MC.LCS.MIT.EDU> + +(most of the people who need to see this can't because ai is down, +but...) + +AI's drive 0 won't spin up. I was unable to bring the system up with +pack 0 on the other drive; ITS gets some sort of massbus error. + +david + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 22 Jan 88 19:25:17 EST +Received: from THE-JOKER.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 88056; Fri 22-Jan-88 19:27:37 EST +Date: Fri, 22 Jan 88 19:26 EST +From: Alan Bawden +Subject: Ho ho ho +To: ZVONA@AI.AI.MIT.EDU, SRA@XX.LCS.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <314839.880122.ZVONA@AI.AI.MIT.EDU>, + <12368693472.13.SRA@XX.LCS.MIT.EDU> +Message-ID: <880122192612.1.ALAN@THE-JOKER.AI.MIT.EDU> + + Date: Fri, 22 Jan 88 14:27:24 EST + From: David Chapman + Oh, wow, blast from the past department. We just ran out of + disk space on AI. Maybe it's time to start running GFR? + +I just moved some of the free space from SECOND: to the primary pack. I +will be happy to explain to anybody else (in person) how to do this. + + Date: Fri 22 Jan 88 14:42:29-EST + From: Rob Austein + Penny ran GFR once or twice, a year or so ago, back when we moved all + the sources from MX to AI and discovered how much space that took up. + I don't think we've been running it on a regular basis, because there + hasn't been a need. + +"Hasn't been a need". Ho ho ho. We've been doing GFR's to tape every few +months for quite some time now. + + +Date: Fri, 22 Jan 88 14:27:24 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <314839.880122.ZVONA@AI.AI.MIT.EDU> + +Oh, wow, blast from the past department. We just ran out of +disk space on AI. Maybe it's time to start running GFR? + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 3 Jan 88 11:25:32 EST +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 3 Jan 88 11:24:55 EST +Date: Sun 3 Jan 88 11:24:16-EST +From: "J. Noel Chiappa" +Subject: Re: Wanted: ITS license +To: lysator@obelix.liu.se, bug-its@MC.LCS.MIT.EDU, + enea!obelix!lysator@uunet.uu.net +cc: JNC@XX.LCS.MIT.EDU +In-Reply-To: <8801021756.AA27872@obelix.liu.se> +Message-ID: <12363676652.29.JNC@XX.LCS.MIT.EDU> + + You don't need a license of any kind to run ITS; the software +is free and you can pass it around as you like. Just get the pack from +Per and have fun! (Make sure he gives you all the sources!) Please let +us know how you do if you get the machine; we'll be very interested to +hear. We're all extremely pleased to see ITS catching on over in +Europe; it was almost dead and gone at one point. + + Noel +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 2 Jan 88 14:42:15 EST +Received: from uunet.UU.NET (TCP 30003106601) by MC.LCS.MIT.EDU 2 Jan 88 14:42:01 EST +Received: from enea.UUCP by uunet.UU.NET (5.54/1.14) with UUCP + id AA20668; Sat, 2 Jan 88 14:41:15 EST +Received: by enea.se (5.57++/1.14) + id AA14398; Sat, 2 Jan 88 19:58:45 +0100 (MET) +Received: from asterix.liu.se by majestix.liu.se; Sat, 2 Jan 88 19:03:35 +0100 +Received: from obelix.liu.se by asterix.liu.se; Sat, 2 Jan 88 19:01:55 +0100 +Received: by obelix.liu.se; Sat, 2 Jan 88 18:56:51 SST +Date: Sat, 2 Jan 88 18:56:51 SST +From: Lysator +Message-Id: <8801021756.AA27872@obelix.liu.se> +To: bug-its@mc.lcs.mit.edu +Subject: Wanted: ITS license + +Hello! +We - the computer club Lysator at Linkoping university, Sweden - would +like to apply for an ITS license. We hope this is the right place +for this request. +We hope to acquire the following system in the near future: +A DEC-2020, serial nr 04655, one or two TU45 and two or more RP06. +We would like our system's name to be LI. + +Peter Lothberg@stacken will hopefully assemble ITS for us on an +rp06 pack, provided we get a license. + +Please reply to lysator@obelix.LIU.SE (in the UUCP domain). +Addition to this mailinglist (and others about ITS?) would be nice. + +Thank you. + + +Date: Sun, 29 Nov 87 03:10:04 EST +From: John Wroclawski +Subject: More TCP stuff +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <292213.871129.JTW@AI.AI.MIT.EDU> + +I added a bunch of stuff to TCP to "optimize" (guess) the best packet +size based on the path to the foreign entity, and to send and +understand TCP max seg size options. In the past, it has just used +the minimum possible value everywhere to be safe. This has the effect +of roughly doubling the potential throughput to MIT and arpanet hosts. +On the other hand, this is all kinda heuristic, and one could imagine +some problems... + +If you could talk to AI well last week and you can't now, please send +a note before assuming you are being screwed by the arpanet. + +Date: Fri, 27 Nov 87 00:08:15 EST +From: John Wroclawski +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <291890.871127.JTW@AI.AI.MIT.EDU> + +ITS 1606 (NITS on AI at the moment) has a new IMP driver. Hopefully this +will fix up the bad IMPOS crashes and improve the lost TCP buffer +problem some. (And it's faster, too!) + +Please collect crashdumps of anything that looks like an IP/IMP +screwup and send a note to bug-its... + +Oh yeah, the NET command in LOCK actually does something useful now, you +might try it first if you think the arpanet is unhappy. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 15 Nov 87 16:54:10 EST +Date: Sun, 15 Nov 1987 16:50 EST +Message-ID: +From: Rob Austein +To: Bug-ITS@AI.AI.MIT.EDU +Subject: [malis: new Arpanet end to end protocol ] + +Follow up.... + +Date: Tue, 10 Nov 87 09:49:17 -0500 +From: Andy Malis +To: Charles Hedrick +cc: tcp-ip@SRI-NIC.ARPA, malis@CC5.BBN.COM +Re: new Arpanet end to end protocol + +Charles, + +Your message is quite wrong (I know - I designed the new +End-to-End). I would be interested in knowing (in private) who +your "reliable source" is, so that such rumors can be source +quenched. After the recent messages on the tcp-ip list, I'm sure +we all realize how important source quenching is. + +The truth of the matter is: + +PSN 7.0 has two different End-to-End protocols (old EE and new +EE). Either one or the other runs at any particular time, and +the two cannot interoperate. The ARPANET is currently using PSN +7.0 with the old EE. It is the new EE that will be tested on +Nov. 7, 14-15, and 18. + +The old EE protocol explicitly returned, across the PSN subnet, a +separate RFNM packet for each message delivered to a destination +host. This RFNM packet was then converted, in the source PSN, +into the 1822 RFNM for that message and delivered to the source +host. This had the result that, depending on traffic mixes, +roughly about 45% to 50% of the packets going through the subnet +were RFNMs. Since the PSN does so much per-packet processing, +even for these RFNMs, the network was passing much less host +traffic than otherwise might be possible. + +We fixed this in the new EE by making it an explicitly windowed +protocol IN THE SUBNET. The destination PSNs have the ability to +aggregate ACKs (the new EE internal equivalent to RFNMs) and send +multiple ACKs for the same connection in windowed ACK (by using +an INTERNAL message sequence number). In addition, these ACKs +can now be piggybacked on data traffic, and many ACKs for +different EE connections can be shipped together in the same +subnet packet to a source PSN. + +The important thing to note is that when the destination PSN +receives an ACK for a connection, it generates, and sends to the +source host, a separate 1822 RFNM for EACH and EVERY message +submitted by the host and being acknowledged by the ACK. There +are no host-visible sequence numbers; the 1822 protocol stays the +same as before. + +What may have confused you is the fact that we at BBN are, +concurrent with the PSN 7.0 testing, trying to track down which +ARPANET hosts might be affected by a known BSD 4.2 network +software problem that may cause RFNMs to be lost in the host +itself (I believe it is related to the size of the message +received PREVIOUS to the RFNM). This bug has been fixed in BSD +4.3, and I have been told that Lars Poulsen of ACC +(lars@acc.arpa) has a patch for BSD 4.2-derived host software. + +By the way, we have measured in our internal BBNNET (which has +been running PSN 7.0 with the new EE only for over five months +now) that only about 14% of the packets through the network only +contain ACKs - the rest of the ACKs are being piggybacked on the +data traffic. We are very pleased with this result. Also, most +of our BBNNET hosts (around 125 C/70s, VAXEN, TOPS-20s, TACs, and +others) use 1822, and they have had no problems with the new EE. + +Regards, +Andy + +Date: Mon, 9 Nov 87 13:37:05 EST +From: Alan Bawden +Subject: MC:CRASH;PI FAULT +To: BUG-ITS@AI.AI.MIT.EDU +cc: MAP@AI.AI.MIT.EDU, BUG-TCP@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 9 Nov 87 12:36:25 EST from Michael A. Patton +Message-ID: <282278.871109.ALAN@AI.AI.MIT.EDU> + + Date: Mon, 9 Nov 87 12:36:25 EST + From: Michael A. Patton + I just reloaded MC. It had gotten a "PAGE FAULT WITH PI IN PROGRESS". + Dump is in MC:CRASH;PI FAULT. Seems to have restarted all right. + +This one is a good joke that has happened once before. The fault was taken +by the TCP checksumming code. Presumably what happens is that when a +packet arrives with a large enough bogus length, the checksumming code +applies the checksumming algorithm to a huge block of memory that starts +with the packet and extends up to some nonexistent page. + +Date: Mon, 9 Nov 87 12:36:25 EST +From: "Michael A. Patton" +Sender: MAP0@AI.AI.MIT.EDU +To: BUG-ITS@AI.AI.MIT.EDU +cc: MAP@AI.AI.MIT.EDU +Message-ID: <282226.871109.MAP0@AI.AI.MIT.EDU> + +I just reloaded MC. It had gotten a "PAGE FAULT WITH PI IN PROGRESS". +Dump is in MC:CRASH;PI FAULT. Seems to have restarted all right. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Nov 87 17:11:29 EST +Received: from SRI-NIC.ARPA (TCP 1200000063) by MC.LCS.MIT.EDU 6 Nov 87 17:10:23 EST +Date: Fri, 6 Nov 87 13:54:46 PST +From: Ken Harrenstien +Subject: [hedrick@aramis.rutgers.edu (Charles Hedrick): new Arpanet end to end protocol] +To: bug-tcp@MC.LCS.MIT.EDU +cc: bug-its@MC.LCS.MIT.EDU +Message-ID: <12348532467.31.KLH@SRI-NIC.ARPA> + +If this message is true, ITS systems will have problems, since the +IMP code counts RFNMs. I guess new code would need to be added which +(depending on a runtime flag setting) handles the new scheme. But someone +needs to find out exactly what the new scheme is first... + --------------- + +Received: from aramis.rutgers.edu by SRI-NIC.ARPA with TCP; Fri 6 Nov 87 12:06:51-PST +Received: by athos.rutgers.edu (5.54/1.14) + id AA24392; Fri, 6 Nov 87 02:20:54 EST +Date: Fri, 6 Nov 87 02:20:54 EST +From: hedrick@aramis.rutgers.edu (Charles Hedrick) +Message-Id: <8711060720.AA24392@athos.rutgers.edu> +To: tcp-ip@sri-nic.arpa +Subject: new Arpanet end to end protocol + +I have just heard from a reliable source a fairly interesting fact +about the new end to end protocol implemented in PSN 7.0. (Note that +my terminology is probably slightly off in this message. I don't know +anything about the imp to host protocol, so I am almost certainly +introducing some distortion in passing on this information.) +Apparently one of the efficiency improvements in the new end to end +protocol is that the IMP's will no longer attempt to return a RFNM for +each packet. You will be expected to look at the ID number included +in the RFNM's. Any outstanding RFNM's with ID numbers lower than the +current one are also to be considered as acknowledged. Many +implementations apparently simply count RFNM's. They assume that one +acknowledgement is received per packet. This will no longer be true +with the new end to end protocol, and so these implementations will +break. I have some reason to think that most existing implementations +fall into this category. Tests of the new end to end protocol are +scheduled for Nov 7, 14-15, and 18. Implementors should be alert to +misbehaviors during these test periods. +------- + + +Date: Mon, 2 Nov 87 15:48:24 EST +From: Alan Bawden +Subject: DIR device +To: PGS@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 31 Oct 87 16:42:38 EST from Patrick G. Sobalvarro +Message-ID: <278714.871102.ALAN@AI.AI.MIT.EDU> + + Date: Sat, 31 Oct 87 16:42:38 EST + From: Patrick G. Sobalvarro + ^R dir:pgs; name2 @ doesn't get me a listing of the files on my directory + whose second name is @. This used to work, and NAME1 still does work. + +That's cause DIR:PGS;SECOND @ is how you get a listing of the files on your +directory whose second name is @. DIR:PGS;FIRST FOO is how you get a +listing of the files on your directory whose first name is FOO. +DIR:PGS;NAME1 and DIR:PGS;NAME2 give directory listings -sorted- (not +-filtered-) by first or second filename. (For example DIR:PGS;NAME1 DOWN +generates a listing of your directory backwards.) + +Date: Sat, 31 Oct 87 16:42:38 EST +From: "Patrick G. Sobalvarro" +Subject: DIR device +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <278089.871031.PGS@AI.AI.MIT.EDU> + +^R dir:pgs; name2 @ doesn't get me a listing of the files on my directory +whose second name is @. This used to work, and NAME1 still does work. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 27 Oct 87 02:52:35 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Mon, 26 Oct 87 23:49:58 PST +Date: Mon, 26 Oct 87 23:06:19 PST +From: Mark Crispin +Subject: Re: ITS outlives Multics?! +To: GUMBY@AI.AI.MIT.EDU +cc: Info-ITS@AI.AI.MIT.EDU +In-Reply-To: <275589.871027.GUMBY@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345749289.8.MRC@PANDA.COM> + +TOPS-10 and TOPS-20 both support 30-bit address spaces (although the KL +CPU only allows 23). Having written a large program using 30-bit addressing, +I can assure you it isn't as kludgy as its detractors claim, and certainly a +lot cleaner than some of the current faddish architectures. + +I'm sure some bright hacker could figure out how to convert ITS to 30-bit +addressing. +------- + +Date: Tue, 27 Oct 87 01:30:27 EST +From: David Vinayak Wallace +Subject: ITS outlives Multics?! +To: "MRC@PANDA.COM"@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 26 Oct 87 10:04:15 PST from Mark Crispin +Message-ID: <275589.871027.GUMBY@AI.AI.MIT.EDU> + + Date: Mon, 26 Oct 87 10:04:15 PST + From: Mark Crispin + + We'll need some new CPU's though. 36-bits are decidedly out of fashion + at Stanford, but perhaps there are some MIT VLSI hackers who might want + to make a PDP-10 on a chip? + +But the 18-bit address space is a lose. Since you're making a new +chip or chip set anyway, why not double the word length? 36-bit +halfwords should keep people happy for a while. We could have more +registers, too. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 26 Oct 87 14:16:23 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Mon, 26 Oct 87 11:08:04 PST +Date: Mon, 26 Oct 87 10:04:15 PST +From: Mark Crispin +Subject: Re: ITS outlives Multics?! +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU +In-Reply-To: <275113.871026.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345606917.6.MRC@PANDA.COM> + +That sounds good. I'm sure the ITS hackers in 2155 will be able to think +of something clever to solve the problem then. TOPS-20's date format +dies at the last 1/3 second of Wednesday, 7 August 2576 GMT (here on the +west coast, just before 5PM PDT), so we have almost 589 years to worry +about that. + +We'll need some new CPU's though. 36-bits are decidedly out of fashion +at Stanford, but perhaps there are some MIT VLSI hackers who might want +to make a PDP-10 on a chip? +------- + +Date: Mon, 26 Oct 87 11:58:03 EST +From: Alan Bawden +Subject: ITS outlives Multics?! +To: MRC@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 25 Oct 87 13:59:55 PST from Mark Crispin +Message-ID: <275113.871026.ALAN@AI.AI.MIT.EDU> + + Date: Sun, 25 Oct 87 13:59:55 PST + From: Mark Crispin + ... + I was quoted in a trade journal as saying that PANDA/TOPS-20 + will see the century tick. What about ITS? We're going to + have to do something about that sixbit date format, you know! + +(I intend to continue using ITS into retirement...) + +The SIXBIT date format you are thinking of (from the .RDATE uuo) is for +simple programs that want the date in MM/DD/YY format. I presume that on +January 1, 2000 those programs will want to print the date as 01/01/00, so +this isn't a problem. + +There are two other date formats. The .RYEAR uuo returns the year as an +18-bit quantity, so that will work for quite some time. The other, more +common, date format is the one used by the filesystem, and by programs that +used the DATIME library; this is the format returned by the RQDATE system +call. This format packs the year, less 1900, in a 7-bit field, so this +will last through 2027. Since the bit to the left of the year field is +unused, we can easily expand this to last through 2155. + +Probably the most we will have to do is fix a few user programs that have +the string "19" built into them. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 26 Oct 87 11:35:46 EST +Date: Mon 26 Oct 87 11:33:40-EST +From: "J. Noel Chiappa" +Subject: Re: ML on the arpanet? +To: ALAN@AI.AI.MIT.EDU, GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: <275092.871026.ALAN@AI.AI.MIT.EDU> +Message-ID: <12345590429.43.JNC@XX.LCS.MIT.EDU> + + Right; they are around $10K or some such fabulous amount. +The first one was one Marty bought and which got snarfed; I got +ACC to donate the second one. + If you want the other machine IP live why not write code +to run an Interlan Ethernet card or something? I gave JTW a Pronet-10 +card; they are massively simple to program but nothing ever came of +it. + Noel +------- + +Date: Mon, 26 Oct 87 11:18:20 EST +From: Alan Bawden +Subject: ML on the arpanet? +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 26 Oct 87 02:22:12 EST from David Vinayak Wallace +Message-ID: <275092.871026.ALAN@AI.AI.MIT.EDU> + + Date: Mon, 26 Oct 87 02:22:12 EST + From: David Vinayak Wallace + Since Multics is going away can we snarf its imp port? + +Wouldn't do us any good unless we can find another LH/DH. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 26 Oct 87 02:23:04 EST +Date: Mon, 26 Oct 87 02:22:12 EST +From: David Vinayak Wallace +Subject: ML on the arpanet? +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <316281.871026.GUMBY@MC.LCS.MIT.EDU> + +Since Multics is going away can we snarf its imp port? + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 25 Oct 87 17:23:27 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Sun, 25 Oct 87 14:21:06 PST +Date: Sun, 25 Oct 87 13:59:55 PST +From: Mark Crispin +Subject: ITS outlives Multics?! +To: INFO-ITS@AI.AI.MIT.EDU +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345387677.6.MRC@PANDA.COM> + +I just got a message from the Multics postmaster saying that +MIT-Multics will be shut down on 31 December. Athough it was +inevitable it is still rather sad. I find it somewhat ironic +though that today, years after ITS was declared dead, there +are more ITS systems in operation (even excluding the part-time +systems) than ever. + +I was quoted in a trade journal as saying that PANDA/TOPS-20 +will see the century tick. What about ITS? We're going to +have to do something about that sixbit date format, you know! +------- + +Date: Wed, 14 Oct 87 15:02:26 EDT +From: Alan Bawden +Subject: Not to worry +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 12 Oct 87 21:41:19 EDT from David Chapman +Message-ID: <269232.871014.ALAN@AI.AI.MIT.EDU> + + Date: Mon, 12 Oct 87 21:41:19 EDT + From: David Chapman + AI is getting frequent ECC corrected errors (one every few minutes) in + consistent places on the disk. Looks dangerous to me. + +No worry. A block with an ECC error needs special attention every time it +is read. ITS doesn't try to avoid using such blocks, so sometimes we get +unlucky and a block with an ECC error gets used either in a file that needs +to be touched frequently, or as a swapping block. As long as it doesn't +become an outrageous waste of paper, there isn't any problem. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 12 OCT 87 23:07:48 EDT +Date: Mon 12 Oct 87 22:58:19-EDT +From: "John Wroclawski" +To: ZVONA@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <268383.871012.ZVONA@AI.AI.MIT.EDU> +Message-ID: <12342034127.16.JTW@MIT-SPEECH> + + From: David Chapman + To: BUG-ITS@AI.AI.MIT.EDU + + AI crashed with BUGHLT Bad IMPOS, 2. I dumped to crash;bad impos2. + Booted OK. + +This is known braindamange on my part related to the fact that I +didn't notice that someone called a particular TCP routine from clock +level when I wrote the IMP driver. + +However, the machine should recover OK if you just $P it, rather than +needing to reboot. + + -john +------- + +Date: Mon, 12 Oct 87 21:41:19 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <268387.871012.ZVONA@AI.AI.MIT.EDU> + +AI is getting frequent ECC corrected errors (one every few minutes) in +consistent places on the disk. Looks dangerous to me. + +Date: Mon, 12 Oct 87 21:32:01 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <268383.871012.ZVONA@AI.AI.MIT.EDU> + +AI crashed with BUGHLT Bad IMPOS, 2. I dumped to crash;bad impos2. +Booted OK. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 4 Oct 87 04:28:25 EDT +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Sun, 4 Oct 87 01:16:03 PDT +Date: Sat, 3 Oct 87 23:08:38 PDT +From: Mark Crispin +Subject: Re: The operating system that wouldn't die! AAAAIIIIEEEEEE!!!!! +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU, gls@THINK.COM +In-Reply-To: <264420.871003.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12339709477.6.MRC@PANDA.COM> + +Well, you know, we have to start thinking about what will happen +when the century ticks. I'm determined that TOPS-20 on PANDA will +see it tick, which means fixing any bugs that have two-digit years. +The question is, how will ITS handle it? + +I think it will be damn funny if our 36-bit "dinosaurs" just tick +the century and keep on smiling, while every Unix system in the +world crashes!!! + +-- Mark -- +------- + +Received: from TB.CC.CMU.EDU (TCP 20000576442) by AI.AI.MIT.EDU 4 Oct 87 04:22:14 EDT +Date: Sun 4 Oct 87 04:14:20-EDT +From: Cthulhu +Subject: its on a ka10 +To: info-its@AI.AI.MIT.EDU +Message-ID: <12339732358.19.AD0R@TB.CC.CMU.EDU> + + +It's amazing enough that they got the ka10 running. I think they've got all +core in that lovely machine. These are truly wonderful people. + +------- + +Date: Sat, 3 Oct 87 23:02:14 EDT +From: Alan Bawden +Subject: The operating system that wouldn't die! AAAAIIIIEEEEEE!!!!! +To: INFO-ITS@AI.AI.MIT.EDU, gls@THINK.COM +In-reply-to: Msg of Fri 2 Oct 87 11:34:35 EDT from gls at Think.COM +Message-ID: <264420.871003.ALAN@AI.AI.MIT.EDU> + + Date: Fri, 2 Oct 87 11:34:35 EDT + From: gls at Think.COM + To: bug-its at ai.ai.mit.edu + I just got my "Happy Birthday" message from Puff the Magic Dragon at AI. + Maybe I'm silly, but this has made me very happy today. It's nice that + someone cared enough to set up the software so I get a message every year. + (I think I am also affected by nostalgia for my days at MIT.) + --Guy + +Well a message like this is certainly guaranteed to make -my- day! It's +always nice to have people appreciate creaky-but-reliable old ITS for still +being around after 20 years! + +I thought I would take this opportunity to spread the word about something +that I don't think has been very widely publicized. Some of you may recall +that a while ago some fellows in Sweden contacted us about running ITS on +various PDP-10's that they owned? Well, we mailed them a set of tapes for +bringing up ITS on their 2020, which they were able to do without too much +trouble (their biggest problem was -my- fault). That all happened over a +year ago. Recently we learned that these guys have successfully -built- +ITS paging hardware for their KA-10, and have ITS up and running there as +well! Totally Amazing. + +Received: from Think.COM (TCP 1201000006) by AI.AI.MIT.EDU 2 Oct 87 15:57:56 EDT +Return-Path: +Received: from kali.think.com by Think.COM; Fri, 2 Oct 87 11:34:16 EDT +Received: by kali.think.com; Fri, 2 Oct 87 11:34:35 EDT +Date: Fri, 2 Oct 87 11:34:35 EDT +From: gls@Think.COM +Message-Id: <8710021534.AA06791@kali.think.com> +To: bug-its@ai.ai.mit.edu +Subject: Many thanks + +I just got my "Happy Birthday" message from Puff the Magic Dragon at AI. +Maybe I'm silly, but this has made me very happy today. It's nice that +someone cared enough to set up the software so I get a message every year. +(I think I am also affected by nostalgia for my days at MIT.) + +--Guy + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 29 Sep 87 20:03:45 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 29 Sep 87 19:55:19 EDT +Date: Tue, 29 Sep 1987 19:51 EDT +Message-ID: +From: Rob Austein +To: BUG-ITS@MC.LCS.MIT.EDU +Subject: SUPDUP/ITSTTY enhancement + +I doubt this will ever get anywhere (too many rlogin fans out there) +but just in case, I thought I ought to send it to the people who +actually decide what SUPDUP looks like. + +--Rob + +To: Michael Padlipsky +Cc: "David C. Plummer" , tcp-ip@SRI-NIC.ARPA +Re: RCTE and stranger things + +I was going to say something about that, but decided to wait to see if +anybody had in fact read Dave's message. You did, so here goes. + +Yes, SUPDUP as specified in the RFC is character at a time. However, +I believe that a very minor enhancement to the protocol would handle +that problem. The big advantages of SUPDUP (sales pitch) are that (1) +it works in a heterogenous environment (thus is better than rlogin), +and (2) has a wider view of the terminal than just the print head of a +hardcopy TTY (thus is better than TELNET). In particular, there are a +whole set of useful options under the heading of "The Intelligent +Terminal Protocol". Not all of these are documented in the SUPDUP +RFCs, for a full explanation of the ITS terminal system see the file +"MC: INFO; ITSTTY >" on MC.LCS.MIT.EDU. It's a bit long, so if you're +not up for a lot of reading, you want the parts on "Control of the +TTY" and "The Intelligent Terminal Protocol". + +The model I'm using for the local/remote echo and wakup problem is the +TOPS-20 TEXTI% JSYS, which was mentioned obliquely a few messages ago +when somebody referred to TOPS-20 EMACS enhancements. For those who +aren't familiar with TOPS-20, one of the arguments to TEXTI% is a +break mask, a 128 bit vector indicating which characters should cause +the TEXTI% call to return. I believe that the EMACS extentions that +were mentioned were based on an extension to TEXTI% which would cause +any character with the meta bit (octal 200) turned on to act as a +wakeup. I may be wrong about this, I've never seen the code. + +Presumably the entity that decides what the break mask should be is +the server (where applications programs are running) while the entity +that implements the break mask is the client (where the physical +display terminal is). So presumably the "change the break mask" +sequence would begin with a %TDxxx code. I can't think of any reason +why the client would want to tell the server about break masks, but if +so the process would be identical except for the escape character (a +30x code, presumably). Henceforth I'll refer to the entity sending +the break mask as the "sender" and the entity receiving the break mask +as the "recipient". + +For the 12 bit character set SUPDUP permits, a complete break mask +would be rather cumbersome, but there's a natural way to compress +this. Make the first data byte a flag byte, with one flag per bucky +bit, one flag for characters with no bucky bits, and two unused bits. +The flag bits indicate which bucky bits the sender wants the client to +try to optimize; if a flag bit is set, a break mask is supplied, if a +flag is cleared, no break mask is supplied and the receiver should +fall back to the default behavior (wake on every character). The most +common message would presumably be one with the no-bucky-bit and +control-bucky-bit flags set and all others cleared, indicating that +any meta, super, or hyper characters are wakeups. In general, if a +program doesn't expect to see a class of characters, it should +probably wake up on them so that it can tell the user about typing +errors ASAP. + +The flag byte is followed by a series of break masks (128 bits in 16 +bytes, presumably). For completeness, this would have to be separate +break masks for each case that the sender has indicated in the flag +byte; ie, just because the sender wants to break on CONTROL-A and +META-A doesn't mean the server wants to break on CONTROL-META-A. This +is part of the reason for the flag byte, so that the sender needn't +send a lot of masks that are all ones. + +All SUPDUP connections would still start out in character at a time +remote echo mode. Setting the break mask requests local echo of any +characters that are not breaks. Break characters are still handled +remotely. Setting the break mask with a zero flag byte (and thus no +following masks) would put the connection back in the default +character at a time mode. + +One extension of this idea would be incremental changes to the break +mask; if anybody cares enough to do it, there's always the two unused +bits in the flag byte. But the above covers the basic scheme. + +Yes, a similar mechanism could be used in TELNET, without having to +think about 12 bit characters and bucky bits, but TELNET is really not +a very good model for a display terminal. SUPDUP (and the abstract +model of terminals and capabilities that underlies it) is a much +better model. I think the existing software speaks for itself. + +--Rob + + diff --git a/sysdoc/its.histry b/sysdoc/its.histry new file mode 100644 index 0000000..4fdb6c4 --- /dev/null +++ b/sysdoc/its.histry @@ -0,0 +1,937 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +This file used to named SYSTEM;ITS RECENT. + +This file logs significant changes made to ITS. New changes are added +just above the line that starts with a row of dashes. Lines that start +with brackets are the version number and date of an installed system. + +.CALL ATTACH - new features +.CALL SIOT - byte-string I/O +.CALL DISOWN - new call, new features +MEMBLT format change +Printing of NXM map when system comes up. +On ML, checking for bad mem switches when system comes up. +Putting time in ITS IN OPERATION etc. messages. +Pure-code feature of pager now works. +.USET on BOJ device +.REVIVE NOP if not dying +Error-code arguments in .CALL +measure run-time of core-job properly +conditional out microtape code +USEMDM switch +don't return to DDT after system shutdown until all dirs, etc. out, + utapes flapped, and jobs killed. +7'th result of .CALL SSTATU is system version number in sixbit +parity error in pure page only interrupts the job that was running +ability to make links through job devices +.SUSET .RSUPPRO +BEG calls SALV +.HANG on TRN, TLN +^_ digits takes any number up to non digit or ignored space +^_ ^B etc. sets bucky bits +%TSFCO full char set output/echoing (control as alpha, etc.) +[946] +at slow clock level, xct ttyst for ttys with ttyoac on and ttltm > 1 sec ago +mlink should give error if not disk or job channel +[947] +KL10 disk code +atsign device should know about "non-directory device" +routine for SIOT for disk & other BLKT devices +rearrangement of user variables to match kl10 user process table (ifn kl10p) + i.e. setting up trap words etc. + how to hack uuoacs in kl10 +SIOT for sty +KL10 cache sweep code +KL10 tty code +KL10 micro code +KL10 page fail code and clock level +user who lines +no more automatic closing of I/O channels at EOF. +Microtapes have to be assigned before they can be used for anything. +echoing of rubout +uniform -1,,3 for eof on all devices in unit ascii input mode (except TTY, dammit!) +[979] +PGDUMP system call +reap bit, author, quotas (SEC's disk stuff) +misc bug fixes +deletion of some old message routines in favor of SYSMSG +[982] +rauth, sauth system calls (SEC'S disk stuff) +New tut format for RP03 and RP04 - partly gone +Fix unit mode I/O on USR device to advance the access pointer +making net not close channel at "eof" -> IOC error number will change; check programs + in unit ascii mode there will no longer be an IOC error when close - " " +[984] +Finish DC76 code +Finish KL paging initialization +Rework KL paging/clkbrk code +Reverse sense of age bits in page words by changing KL10 ucode +3-bit bytes in tuts +more disks on ML and DM; more directories on ML +[986] +KL bug fixes +%TPCBS => ^\ is special on tty input -> for intelligent terminals +SCHBLN on ML +Remove "last bug" from PDUMP +[988] +symbolic ITYIC; ordinary ITYIC passed as a symbolic ITYIC to job devices +superimage output SIOT on tty => high-efficiency mode +DIRSIZ to hack quotas and read # blocks in all files in a directory +SCPOS to hack setting tty cursor position for software tty styholders + and superimage outputters +Com mode simplification and improved query mode. +SCHBLN on AI +ATTACH takes tty spec as arg +Symbolic IOPUSH and IOPOP +System console can be used as a user console +^PA - proceed to column 0. If you pass the end of the line, collect 1 linefeed. +KLPERF system call for hacking the performance counter +Open-loss "channel not open" +[994] +DETACH and DISOWN can cause tree to be killed after 1 hour +KL - detach on hangup +KL - Improve autospeed code +20KILL allowed after a 5KILL has been done. +Symbolic "RCHST" (actually called "RFNAME"). +Real TTY's may be run as "Software TTY"'s. +SETLOC detects that SYS job is hung and does the job itself. +DM Demon signaller no longer uses FINSET; all FINSETs flushed. +NNSKED, NRSKED meters +Gould line printer +Handling of parity errors on KL10 +OPTOPC +Improvements in system shutdown +TREESW +XDDT$X, XREVIVE$X +Symbols for UMAPS bits +Deletion of OPTDET; reload on top-level interrupt never occurs now +Optional automatic saving of ACs, .JPC, .UUOH, LSPCL in new-style interrupt +.CALL DISMISS can pop the above +.CALL RCHST +Deletion of .CALL BREAK +Deletion of LDISOW +Other-machine devices no longer built into the system; use unknown-device handler +Arg2 + Arg3 for .CALL JOBSTS; RH(.STATUS), device name for who lines and peek +EVSYMS file +SUPCOP +[1000] +%TNMEM +OIPBIT +New meters NSSKED, NRESKED, NNULBK, SLOADU +Improvements to TV run-light blinker +New .CALLs: FORCE, JOBIOC, NETAC, NETINT, REOWN +DETACH ctl bit 1.5 suppresses console-free message +Fix the "last" bug in PDUMP +Delete SJDH +Computation of maps and memory free lists and number of DDT pages at system startup +[1003] +Remove ARDS support; add Tektronix support +Add TTDIIM, TTDVT, TTDRAN +Add meters NAGEAB, NSHRAB +Delete superfluous user variables LSPCL1, LPFBTS, UDBR1, UDBR2, UCPB1, UCPB2, UTRAPM +OPTTRP is sign bit of OPTION; replaces UTRAPM +Make VALUE not take a separate word in user variables +Improvements to bringing up of the network (eliminate infinite NETWORK UP AGAIN lossage) +LOSRCE, IDLRCE, NPGWTU +.XJNAME user variable +.LOSE UUO, LOSE system call +Really fix the last bug in PDUMP +Improvements to CORBLK +NUL device changed to give immediate EOF on input instead of infinite zeros +Swapping algorithm enables: ENSWSC, ENUPC, ENPZRO, ENAGE, ENSWBK, ENPVCL, ENPREE +Ability to determine memory size on KL10 (NXM doesn't work on our machine.) +Debug RP04 ECC stuff +FILLEN works for disk output channels +Simplify core job - eliminate shuffling of system pages and eliminate + shuffling of 200-word buffers (except network buffers) + thus flushing thousands of timing and pclsring bugs. + Direct mapping always on => low-core is still big enough. +Symbolic socket states and close reasons for Arpanet +Arpanet gives interrupt if output buffer goes from full to not-full. +Fix Arpanet bugs: timing out, Santa Claus, extra words at end of message. +SUPCOP => system jobs hangs rather than sleeping. +Fix many erroneous bits in system job dispatch table. +System job can use any console (fakes IOCHNM word). +User who-line variables. +%PIATY +Intelligent terminal protocol now works. +%TCFPD +Make disappoints work better +Find out number of TVs at system startup. +Non software-tty STYs can get %TDORS. +Fast SIOT in super-image output to TTY. +[1006] +Add new meter NAGES +Fix bug with IOT UUOs on KL10 causing spurious MPVs +Turn on indirect bit in .MARPC if instruction completed +AGERTE enables page-ageing +.CNSL user variable +Support CAIA ? CAIA ? .HANG and SKIPA ? SKIPA ? .HANG +Feature for DISMISS to lose if given 5 arguments +Bells in ITS in operation message +**MORE** interrupt goes to same channel as was IOTing on. +Less cryptic messages in communicate mode. +Full support for disappoints. +[1008] +Flush OQDTSW (finally!) +KL: Use hardware clocks in KL-UDGE +Allow up to 99 jobs (up from 63). Limit of 99 is in who line routines, I think. +Eliminate UCLOSE PCLSR bug. +RFPNTR system call +RFNAME system call +FORCE and FLUSH system calls. +Reorganize I/O device tables a little. +Allow unit mode input .CALL IOT to use an output arg instead of a clobbered input arg. +Flush CREAPB system call +Rename PGDUMP system call to PGWRIT; old name will stay around for a while +Flush PDUMP mode; greatly simplify PDUMP system call. + This surely fixes the "last bug in PDUMP." +Handle MMP full as NO CORE error rather than crashing the system. +Fix bug in unit image input from directory. (Probably crashes system). +Init dial-up lines on dialin rather than logout. +Fix bugs in control link RFNM timeout on arpanet. +If ARPANET socket found to be closed on input, eof if closed + normally by foreign host, IOCER 10. otherwise. +If ARPANET socket found to be closed on output, IOCER 10. (was 8). +Misc. ARPANET bugs. +%TDFS, %TDMV0, %TDCLR tty output buffer codes +Use tabs for cursor positioning on display ttys that have them; use + VT52 absolute cursor positioning if enabled. +Putting EXEUMP and EXELMP in system's UPGMP; not having MMP entries for sys job pages. +New corblk codes %JSNEW and %JSABS. 400000 now copies from exec address + space instead of real abs pages; 400001 is still fresh pages for now. +Arpanet: free output buffer space as soon as sent instead of waiting for RFNM. +NLOAD needs a new open loss code - done. +Retain sharable pages in core for a while when no one is using them +MMP hash table +MMP free lists changed to use addresses instead of indices; + there was a bug which luckily just caused one MMP entry never to be used. +Fix "last bug" in swap read errors. +For a disk open that fails after going through a link, a special + error code to reduce confusion of DDT and users. +.CALL STLGET +2-minute clock checks for clobbered devices +Disk .CLOSE waiting kludge removed; .CALLs FORCE and FLUSH implemented for disk. +Fix "last bug" in shutdown. +Disk FORCE not allowed in unit ascii mode. +[1013] +Absolute cursor positioning on VT52s if PADTAB=2 +Bug in QUDS caused files to get concatenated. +[1016] +Flush old misfeature that writing in NXM in inferior creates the core. +Problems with one job outputting to core link, receiver closes, transmitter + hangs forever - transmitter's output ought to get discarded. +If a network socket enters an "unhappy" state while job + is hung in IOT on it, and IO interrupts aren't enabled, + give it an IOC error. +Fix VT52 ^S/^Q lossage by not using direct cursor positioning at 9600 baud. +KL10 - handle page faults with clkchn in progress rather than off. +Unhang hung disk controllers. +Recover from reset button getting pushed on S.C. controller, also + handle internal parity error. +Fix bug causing magtape timeouts to be very random - magtape didn't + get polled when disk was idle. +Unhang ML LPT when it loses its PIA. +KL10 - provision for .LSPBR user variable (lisp GC instructions) +LH(.40ADDR) is address of 20-wd block for DDT to hack in (if 0, 20). +Rename .SNAM user variable to .SNAME +KL10 - fix bugs in one-proceed. +Remove machine-independent one-proceed "feature". +SIOT allows indexed byte pointer. +3.5 mode bit in DSK open allows links to be "opened." +JOB device calls use %PCFPD bit to detect pclsring. New bit 3.8 in first val of JOBGET. +Fix bug with IOCERRs in JOB devices getting left after close and given to next user. +Put CRLF at end of TTY^F (for IEC, mostly). +Fix bug that user can map nxm abs pages. (introduced in 1013.) +Intelligent terminal protocol - ^\^C => screen has been surreptiously altered, + set %TSATY and %PIATY. +MC - multiplexor kludge to building 38 +Arpanet - 3.7 mode bit in open => use 2000-wd buffer (otherwise 200-wd). + Many improvements/bug fixes/dekludgifications. +Disk pack reservation stuff stored in tuts instead of going by drive number. +Unit ascii mode and SIOT output to disk, tape (BLKT devices) will + zero the extra bits at the end of each word. +Typing out space is equivalent to cursor motion even on non-overprinting ttys. +Allow embedded blanks in links (quoted with :). +New fast disk directory garbage collector. +[1018] +Remove typing out space equivalent to cursor motion feature - screwed datapoints. +%NCRFS +.CALL MLINK does .CLOSE 0, if it succeeds - fix this. +When TV11 goes down TVCREG of a job using 11, e.g. D, gets screwed up. + Not fixed up by reattaching. Mostly fixed, but alu function will be lost. +Top level interrupt job detached gives octal PIRQC on system console. + No longer tinges daemons with mortality. +REOWN sets reowned jobs' XUNAME to reowners - fixes bug in :NAME + - FLUSHED. DOING THIS CAUSED OTHER BUGS. +[1020] +%TBOUT, %TBINF bits in TTYTBL +Fix to: In negative SYSDBG mode, losers can get in by linking to a sty tty. +OPTLKF bit in .OPTION which says unlock locks on top-level-fatal-interrupt. +TYOLTB per tty instead of per TCTYP (TTYROL) and .CALL CNSROL to hack it. +If PDCLK jumps ahead of TIME more than 5 seconds and less than an hour, probably + the system was stopped at a halt or breakpoint and then continued, + so all jobs should get going down interrupt (DDT will print "ITS REVIVED!") +.CALL DELEWO +Fast SIOT for Arpanet output +.CALL STYNET - direct connect STY to NET +On SAIL ttys, echo control characters with uparrow instead of circumflex. +Fix bugs in .CALL FORCE in write over mode. (FORCE loses, FLUSH hangs forever.) +Disk FORCE screws in unit ascii mode (.ACCESS is by words) -- taken care of. +Byte size support for disk files: + The system remembers the size of bytes a file was written with + and the number of bytes in the file. + OPEN => a byte size. For now, unit ascii = 7, otherwise 36. + ACCESS and RFPNTR are in terms of the byte size opened in. + RFPNTR returns a second value, the byte size. + FILLEN returns 4 values: + length in byte size opened in. + byte size opened in. + length in byte size written in. + byte size written in. + This involved changing the conventions for BLKT/CHRKT/SIOKT. +Various losses/infinite hangs involving swap read errors fixed (for the nth time). +Seek overlap on S/C disk controller. +Eliminate hair for deleting file on deceased pack - tut differences don't matter + much, and ufds will be inconsistent anyway, can never use ufd copies + on pack that wasn't mounted when the system ran one day. + -> Also, salvager should probably check for packs whose MFD has a smaller + ascending master dir number and require you to do a UCOP to that pack first. +Disk scheduler performs poorly under heavy load, i.e. on DM. +[1024] +%TPTEL treat CRs in the way Telnet protocol wants (on input). Needed for STYNET. +COD: device ignores whether it was opened for input or output (maybe others too)? +Flush vidis, Dinwiddies, etc. if they haven't been already. +Support for an optionally-present secondary disk pack. SECOND: device. +OPT => %OP to get rid of random predefined non-% non-$ non-. symbol? +Rubouts should "work" in com mode on display ttys. +Allow a device job to be reused for more than one OPEN, if it agrees. (.CALL JOBREU) +Fix bugs with pclsring, iopdl, etc. in job devices. +Make SIOT and byte-size stuff work on job devices. Necessary to do + do this so TECO can use new style stuff. +Make it possible for PDUMP to save ACs, and for LOAD to load them from + pdumped files. +Allow selective loading. E.g. only within certain address boundaries, + or only pure pages. For DECUUO, dumped tecos, maybe dumped lisps? + 3rd arg to load is first,,last or 0 to load only pure +USRVAR, TTYVAR symbolic system calls. This also implies that when + .USET and .SUSET ILUUO they will store opn-loss codes. +[1036] +6-character device names in the system. MEANING OF %DVDEL BIT REVERSED. + Also devices that used to ignore .FDELE now OPNL34. +Flush both-directions-open stuff on job devices. +Restandardize arguments to TTDxxx macros. Now uses mainly keyword parameters. +Change KL10's XCTR XEA, from 14 to 16 to make indexed executes work right. +PDP6 has a .UIND user variable. Symbol %JSSIX selects the pdp6. +Wait for DIR and DSK channels to become available instead of erring out. +New disk directory flushing code - caveat haquur! +Delete %TICLC +Add %TNDTM (Datamedia support). + Reverse order of args to Imlac cursor motion code. (Taken out again.) +Error codes for OPEN on NET device grossly screwed around with. +Accounting updates - two minute clock picks a job tree and calls LOGUPD +%TORAW is no longer the default. +TTYGET no longer returns ISE0 if channel not open. +It works to set one's own .JPC. +[ITS 1043] +You can reown yourself! +An "echo" that only forces out buffered cursor motion + shouldn't set %TCECH - ^S lossage on TIPs. +^_CFOO^^ kludge for IEC. +.LOGOUT N, => .BREAK N,33 if not top level. +Speed up typeout on TVs by not checking redundantly for buffer over-run. +Abandon AI LPT. +Note conversion of wierd non-ascii controls to ascii on %TOFCI tty was changed. +[ITS 1047] +Don't buffer more output than allocated feature on arpanet (mode bit 3.8). +STYNET mode now works. +Miscellaneous changes to output on glass ttys +Show both phy and vir pages in user who line +Add immediate instruction arguments to USRVAR/TTYVAR +Fixes to JOB device open and pclsring +Top level interrupt job detached informs owner +Fix IDX column of TTY^F +Change format of scheduler history table a little (overflow in user index and runtime fields) +[1050] +8-bit bytes in TV-output buffers (instead of 16.) Still to be done: word at a time + tty output siot. Requires some restructuring of code. - hard to avoid some bugs. +Rename .CALL FLUSH to FINISH. Old name stays around for a while. +Better disk error reporting on RH10/RP04. +Have who line show # pages swapped in as well as total # pages. +[1052] +Control-Call and ^_D are deferred call. +Start adding multiple ttys through DTE20. +Fix some moreing and glass tty bugs. +TTYROL on a printing terminal is now 1 (formerly 0) - don't forget to change TCTYP +Fix CORTYP on a PDP6 inferior to not crash system. +USR job-creating open kills the job if no core available instead of failing + but leaving the job around. +[1057] +Flush new SC disk stuff; ATTN and CURRENT CYLINDER register lose randomly. +Insert and delete lines and characters on TVs. Scrolling. +.CALL USRMEM +Fix more Arpanet & direct-connect bugs +BOJ block IOT in don't hang mode now doesn't hang if the creator + is not in a corresponding JOB IOT. +Scrolling on TVs. +[1066] 5/30/77 +Alpha echoes as alpha, while ^B echoes as ^B. +.CALL TTYFLS allows you to flush all tty input chars up to the last one ITYIC'd, + or flush just that last one. +DNRF device is like DSK but doesn't set the file's reference date. +Opening DIRHNG:FOO; gives you a channel that interrupts whenever anyone + writes in directory FOO. +TRAP: device to allow faking out of inferiors - all system calls + on such a device trap, including OPEN, but TRPOPN .call allows superior + to open it for the inferior. CLOSE does not trap, which is vital!! +ISPEED/OSPEED TTY variables (read only). Also change speed codes to 4 bits. + These variables are in bauds, not internal codes. + TYEEO3 is fucked. Also TYPBP1 needs to be fixed. +Finish flushing 2741s. +RCPOS, SCPOS, LISTEN, FORCE, and FINISH allowed under $$^P. +TTYSMT (SMARTS) variable to hold info on what sort of programs a tty can load, + what graphics options it implements, etc. +CHAOS net +SWPWSP started, but not finished yet. +Settable block size on magtape via .MTAPE and flushing of chunk mode. +New IOC errors 12 and 13 +Locked-down pages; see CORBLK and PGWRIT system calls. +Fix loose-page bugs by maintaining RH(MMSWP) correctly. +Final version of USRMEM + But still needs to learn how to turn into SETLOC if writing system. +PAGEID system call and associated crud flushed. +More error checks in CNSSET etc. +%TPPRN +Attempt to make nulls outputtable to MTY +Symbolic ATTY, so you need not have a job open to use it fully. +Store the UWHO variables on non-tv systems for benefit of user + programs to generate who lines. +Make MAR work correctly on KL10 (formerly OPTOPC had to be on.) +Device name table - negative LH is sixbit short name, else + is pointer to sixbit long name. Change chaos, dirhng, trap. + Note that this changes what .GETSYS of CHDEVS returns. Who cares? +.CALL DL10MP +Flush NEWDTE conditional. +.HSNAME user variable (home sname) +[1091] 11/11/77 +.LSPBR flushed due to > 100 uset variables! Magic number for .HSNAME + changed from 100 to 43 . +Fix up SWPWSP so it may work +Really make MAR work on KL10 when OPTOPC is off. +Reset speeds to zero when a STY is handed out. +HELP key (TOP/H, ^_H) always returned even if not in full character set mode. +Additional hair at TYOMT4 to try to make echoing work right. Loses, flushed. +Flush even more vestiges of 2741's. Speed code 0 now means unknown, not 134. +Fix CHAOS bugs, add 5th result to CHAOS WHYINT. +Fix bug with wrong spacing between mores on scrolling terminals introduced + into ITS 1036 or thereabouts. +Fix bugs with over-AOS and over-SOS of SUSRS. +[1097] 12/5/77 +.MTAPE 13 returns block size of last record read. You should gobble + the first word of the record then do the .MTAPE. +Add new swap and pagein history tables. +Change ACCESS to give error on wrong type device, instead of claiming + to succeed. This also gets rid of special job op for .ACCESS, + now it just comes through looking like a symbolic system call. +Fix parity error handling on KL10s. Was completely fucked. +Minor fixes to swap-out routines, and to hsname. +Error code returned for network went down changed from 34 to 41 (arpanet). +SCML changed to work if you don't have the tty +Fixes to SCPOS bug, link to multiple ttys same name bug, scrolling bug. +[1099] 1/15/78 +RFNAME on DIRHNG returns correct dir name, zero file names. +Save and restore tty user-options across detach/attach. (STTYOP) +TTYESC .CALL +Say system full if there aren't 100 mmp entries left. (on ^Z) +Fix bug in %OPLKF on KL10 +For RH10 disks (mainly RP04s), know about "recoverable" unsafes. +1.3 control bit to ATTACH causes job to start after it is attached. +Readahead on mag tape, to make reading much faster. Note that an + incompatibility in .MTAPE was introduced; the stop call doesn't + compensate for read-ahead. Conditions under which .MTAPE writes back the function + word changed slightly, but, then again, the old code had gross pclsr bugs. + Kludge that a count of 0 in a spacing command means 1 retained. Update documentation! +Fix bug where FORCE on unit-ascii disk channel didn't pad +Further changes to TYI to ignore top-letters except HELP when not in full char set mode. +Fix bug in %CBLOK feature that crashes system if it is used. +Fix AC conventions in LOSSET routines NJBRUL, QCHNRT. They are commented now! +DISOWN (etc.) now only closes inferior channels, not foreign-job channels. +Fix bug in deleting links to dirs with a leading space in the name. +[1102] 3/3/78 +Fixes to Arpa network control-message-queue overflow bugs +Overhead metering (only works on KL10s) +[1105] 3/22/78 +New chaosnet protocol, .CALL PKTIOT, change to chaos IOT, direct connect for chaos. +Fix bug in RFNAME on DIRHNG: +.NETS is now just a uuo version of .CALL FORCE +Change RENAME and DELETE to give file-locked for *-files +Change >-lookup to notice *-files +Fix bugs in IDLTIM ttyvar, ^\^C +Fix TRAP device +Fix bugs in disk FINISH, PDUMP with %QAACC set. +[1111] 5/2/78 +Fix bugs in job device +Arpanet extended leaders (incompatible changes to be noted here) + - RCHST no longer returns byte size + - see NETHST, NETIMP. +Add TTYSMT as alternate name for SMARTS tty-variable. +%TOSA1 no longer controls echoing, only output. This change also admits 0 + (center dot) as an OK SAIL character. +QSNNR bug fixed! At least one possible cause. +DNR: as a synonym for DNRF: for the sake of DIRDNR: for $$^F. +PIRQC 4.9, if set, pclsrs the job but doesn't give an interrupt. + The Arpa and Chaos nets need this to arrange for IOC errors at the right times. +[1115] 5/27/78 +The following items deleted from the AI system (softwarily): + 340, DSD, OMX, IMX, N D/A, PDP6, H CLK +Fix bugs in disk code with respect to DELEWO and to FORCE +Fix over-run bugs in mag tape code +Add run-time-field to SWPHTB and PGIHTB, temporary(?) for metering +[1117] 6/30/78 +PAGPRE - pageing preemption without SWPWSP +Additional metering to try to find why there are so many "real" schedules +Bug fixes: paging, tty code. +At TYMTB3, if home up is better, check whether abs positioning is even better. + This will eliminate superfluous extra home-ups on VT52s. +When cursor positioning with tabs, if told to go one char past the right + margin, will try to do it with tabs and really mess up on VT52. However, + will probably mess up on any other terminal, too. +[1121] 8/8/78 +Fix interrupt at wrong time bugs in Chaos NCP. +A location RVVTIM recording the last time the system was revived - TAA +Flush the misfeature that 1200-baud printing terminals are Terminets. + Note problem with the motor turning on and off when using CRTSTY. +[1122] 8/19/78 +Fix MMPTMP bug in .CALL PGWRIT, caused halts at SWPACT+6 and QSWPFN+23 +New Chaos protocol, never-ending stream of Chaos bug fixes +Additional metering +New resources of various sorts (memory, MMP, STYs, jobs) for MC +Expunge useless symbols like FOO to save space in the system. +FIX YET ANOTHER BUG ASSOCIATED WITH MOVING OFF RIGHT MARGIN OF A + DISPLAY - THIS CAUSED VT52 TO HANG OUTPUTTING INFINITE TABS. +[1127] 10/3/78 +There is a deadly embrace where the Arpanet wants to go down, but the sys + job is waiting for the core job which is trying to shuffle an arpanet buffer. + THIS IS FIXED BY CLEARING ACTIVE-AT-PI BITS WHEN NET GOES DOWN. +MORE CHAOS NET BUG FIXES AND PROTOCOL CHANGES +Add checks in case ac-block selection loses +[1128] 10/16/78 +Fix yet more Chaos net bugs +RENAME on core-link crashed the system +.SHUTDN could shut the system down in 0 seconds +[1131] 11/21/78 +Image-mode block-IOT output on NET device transferred one word + when it should have transferred zero. +Fix yet more Chaos-net buffer list bugs, also bugs introduced + when RFC-retransmission was put in, involving %CFOFF +Who-lines display wrong thing for 6-character devices (CHAOS) +[1133] 11/30/78 +Bug where when using unit-mode input to EOF then doing SIOT would + loop in the system - added instruction at CHRKT1. +[1135] +Fix "last bug" in CHAOS (CHAQSR) +Fix bug that you could get write access to abs pages +Add error-check at UBLST4 attempting to track down "ZUSER2" crashes. +[1136] 12/15/78 +Fix FII32 bug for DM Imp interface, set DM system console to 0, ignore NXR/NXS on Arpanet, + make Arpanet work if non-zero network number supplied in host number. +bug at typors crashes system at typda1 by clobbering t +Do XCTRI XEA at PFA12 by hand to see if this instruction sometimes fails + and causes famous "indexed XCT" failure. +Use performance counter for accurate CPU-time metering, when a user isn't using it +[1138] 1/4/79 +Fix loop at ACMTC, in somewhat unsatisfactory way. +Get rid of old Plasma "multiplex" lines, add 8 more STYs. +[1142] 1/27/79 +mag tape IOT didn't use SIOKT if SIOT was used, causing anomaly at EOF +Add support for Teleray 1061 and HDS Concept-100 terminals, + involves improvements to padding and abs-positioning code. +^PA now always erases to end-of-line, whether or not it crlfs first. +Fix bug in PAGPRE code probably causing FLSINS instructions to skip + prematurely - loss was if a pre-empt failed and the current job had + just uflsed, it went ahead and ran it again without checking the flsins. +Disk-file author code uses HSNAME if UNAME not identifiable with a dir. +[1144] 3/5/79 +large memory on mc +[1145] 4/4/79 +Fix long-standing bug in .UTRAN! +Fix the last bug in the CHAOS NCP +Increase the numbers of job slots and disk channels for MC; a better + way of dealing with the cretinous deadlock for disk channels needs to be devised. +[1148] 4/13/79 +Fix Arpanet NCP to delay sending a CLS until after a RFNM comes back. + - bug found by OTA +Support multiple secondary packs; QTRSRV field is now the device-name for + writing on the pack (if not 0 or -1). +[1150] 6/79 +Increase max virtual core on MC to 3.5M. +Turn off redundant checking in CHAOS code, it clearly works. +Fix bugs with TTY padding that were crashing system + when you had a 1200-baud printing tty with padcr=1 +Make the 2-minute clock (actually UTBFLF and UFDFLF) swap out + all loose pages, to fix a bug where loose pages could stay around + for a long time in MC's memory, tying up the disk space occupied + by a deleted file. +[1150] 6/15/79 +Found bug in assembly-time test for exceeding 6 bits in IOBFT channel number codes. +Use a better checksum algorithm across the 10/11 interface for the Chaos net. +[1151] 7/79 +Fix system deadlocks caused by %CBLOK-locked-down pages using up all the core + pages which want to be used for I/O purposes. Simple-minded change is to + ignore MMPLOK bit in that case. +Expand MEMLZL and MEMLZH to 8 locations each so multiple ranges of memory + can be patched out. Especially important when you have interleaving. +Get rid of the .HKALL before the system initialization since it causes more + trouble than it saves. +Fix bug causing infinite hang in FINISH call on write-over channel near EOF +Fix deadlock where system won't come up because the NUJBST buffer is full + of network servers and the system job is trying to start the daemons. + Code was completely brain-damaged. +Fix bug in file system where QAUTH could pclsr, leaving a half-created + file that claims to have been written on pack 0. I'm not sure this + was the only source of this symptom but it's certainly one source. + This may have also been the cause of the duplicate files with the same + name (typically _DRGN_ BUFFER). +Move TUT header to front in preparation for T-300 support on MC. +.CALL ECHOIN +Maybe CALL should do an input-reset? Currently DDT does one, but there's + often a significant delay before it happens. (rwk, eak) + I'm not sure but I think it does one now. +[1154] 9/6/79 +Deadlock with allocation of directory slots: If you run a program + such as :DSKUSE $ which just reads all the dirs, it hangs up waiting + on QFUD with QSKOSW locked; however the automatic QDFLS in QFLDF + only happens with QSKOSW locked, so no other job can get in to + do it. Also it would appear that nothing tells the core job to + do it, at least not often enough. + Fixed by making QFLDF keep trying the QDFLS over and over. +Read-compare for ML +[1157] 9/13/79 +Increase maximum size of a disk address from 15 bits to 18 bits + most places; still limited to 16 bits by UFD descriptor format + (could easily be expanded to 17). +[1158] 9/15/79 +Support for T-300 disk on MC. +[1160] 9/18/79 +[1163] 10/18/79 +Make switch 0 go to DDT, even if system not being debugged. This is + because the address switches on the AI machine are so marginal. + Hopefully this switch won't get set accidentally too much. +Fix total brain-damage in the RP-10 disk code that caused it + to ignore errors on the last block in a cylinder. This was causing + the read-compare errors on ML. +[1164] 10/29/79 +Region scrolling - %TDRSU, %TDRSD, %TPRSC +Fix bug that enabled interrupts in TVBNCL and caused crash at TYOAS7 in echo code. +Spell %TDGRF uniformly everywhere, was %TDGPH in one place. +Get rid of routine LOOSCH in CORE -- obsolete temporary bug check +Eliminate possibility of reused disk addresses ("Y files") + by keeping on-disk structure consistent. +Remove obsolete bug check from QFLD +MAXJ was inaccurate due to rounding problems +Bits 1.9-1.7 of .STATUS had been broken for some years. +Fix bug in BOJ device causing halts at CFH2+22 on KL's. +Change CHAOS code minimally to allow Muppets to pass through + uninterpreted. This will need to be done over better at some later time. +[1168] +Page-ahead and write-behind features (involves making >100 user variables work) +Fix pdl-underflows in magtape routines. +Fix bug where on KL's run time was accounted only in user mode. +On KL, CFF1 could get to UFL1 with clock PI in progress, causing loop + at UFL6. Bug was introduced when page fault was changed to actually + cause a PI7 interrupt rather than just simulating one. +Fix bug in SCHBLN feature causing first runnable job found to be ignored. Thanks to DLW. +Fix worse bug in SCHBLN feature. Maybe it will actually do something now! +Multi-pack secondary devices. +Recalibrate timeout on AI, attentions tend to get lost sometimes +Before giving out of disk space iocerr, await completion of + pending file deletions (new partial-consistency scheme). +Make %TPMTA work on STYs. +[1185] 5/23/80 +Fix bug causing system job to UFLS momentarily every time it types a character +Now that SCHBLN actually has any effect, it (as predicted) allows compute + bound jobs to hog the whole machine. Overhaul the whole priority + and schbln mechanisms of the scheduler. +[1186] 5/25/80 +[1192] 6/2/80 +Fix bug where QSMPRP could have 0 in the RH (causing crash with ACs clobbered) + if a .IOT was retried after an IOCER2 had happened because of random + access off end of file. There is still a bug in the ARC device such that + it loops when this happens instead of noticing the archive file is clobbered. +...(note: a number of unrecorded changes were made in here)... +Sequential paging (.PAGAHD, .PAGRANGE) implemented. +Position-dependent padding of terminal output implemented. +Fixed echoing of ^_ commands interaction with choice of pc ppr for echo. +[1207] 3/12/81 +4/5/81 Moon - Small bugs fixed: FINISH on disk channel hangs for a long time +sometimes, Chaosnet doesn't handle window overflow correctly, a user executing +DATAI PI, on a KL-10 crashes the system. +4/18/81 Moon - fixed CBF's kludge for insert-character on C-100 to work on ML/DM. +[1213] 4/22/81 +Chaosnet: Removed support for Muppets, added new foreign-protocol protocol +Fixed binary directory SIOT to use SIOKT +[1216] 5/21/81 +Make AOSx/SOSx followed by .HANG actually work (code tried but not very well) +TOP-E, TOP-S, TOP-T, TOP-X, TOP-Y and their following arg chars +ignored on input unless user job has asked to see them. +AI TVs support SUPDUP graphics. +[1223] 9/9/81 +Added Chaosnet hardware support for ML +[1225] 9/14/81 +Change routines that allocate core without respecting NCBCOM, the count + of pages committed to use by CORGP. How did this pile of shit ever work? + Routines changed from calling NMMRQ to IOMQ: GMMP4, UQL1B +TTYGET, TTYSET, CNSGET, etc. work if you don't have the tty. + So does opening tty channels. RESET ignored if you don't own it. +New TTYTBL bits %TBOIG, %TBIIN for ignore output, interrupt on input. +Installed a BUG macro similar to the 10X/20X one, and made most + common halts use it. This replaces the SYSMSG routine. Documentation + is with the macro definition near the front of ITS. Complete + functionality requires the latest version of exec DDT (just to make + it possible to P from a bugpause). There are still many halts + in the system, and perhaps some of these should be converted also. +[1243] 10/17/81 +[1244] +Include "$" (don't-reap switch) in directory listing. +Logging of memory ECC errors on system console. +Fix SYALC3 not to print on nonexistent terminals and TVs after the free-screen. +[1251] 11/20/81 +Rearrange code so when it says "net: timed out trying to come up", + if the IMP ready line then turns off and on, it tries to come up again. + This should make it come up by itself after the IMP breaks & is repaired. +Program around lost-interrupt problem with DTE-20. +Install SOPEN and bp-forms of RENAME, RENMWO, MLINK, DELETE + and give job devices access to the original bps. +[1256] 12/25/81 +Third arg to RFNAME, to get name stored as string. +%DO names for bits for opening disk channels. +%DORWT bit for output opens to make input opens of same file wait + rather than failing. +Ignore special local editing protocol and supdup graphics input chars + for all ^_ processing. +[1263] 2/2/82 +Change UFD paw-over so files being written when system crashed don't +get their names incremented. +------ pending ------ (?) indicates probably shouldn't be done +Maybe page preemption (in PPIUM) should respect job priorities? +At IFSTOP, what is this garbage "have already hacked this user"? +Make SIOT use KLH's FSCOPY in the unaligned case? Do up to a page boundary + with less checking? Hair? +Put in a value of QRCSW (in QRDCMP) that causes it to read-compare + only every N ("System Reliability Assurance"). +If between the time output finishes being put in the buffer and the + time TYOSW is unlocked the output interrupt level finishes + doing the output, and echoing is pending, nobody ever puts + TTYERQ on the echo list, so the echoing never gets done. I guess + typing another character unhangs it. For some reason this was + exposed by a user program that got its %TDQOTs out of phase. + The right way to fix this is not immediately obvious. + By the way the comments in TS3TTY about finalization are wrong. +SPEED parameter of a TV should be unchangeable or reset on logout. +CORBLK ON DISK-WRITE CHANNEL FUCKS UP GROSSLY + SEE QBWRA2, WE NEED TO GET TO QSOCL5. THIS WHOLE THING SUCKS. + Probably CORBLK'ing on a disk-write-channel should do a FINISH first. Plausible? +Suggested scheme for ^_ commands to work even if input buffer full, and have a ^_ + command that does an input reset. Another idea is if you are in super-image input, + and it dings due to input buffer full, turn off super-image so you can call out. + Another idea is an interrupt character replaces the last in the buffer if it + is full; various pointers and counters need updating. +%CBCPY in .CALL CORBLK for JOB sources as well as FILE sources +Support special (non-NCP) links for Arpanet. +.CALL ATTACH WAITS ON TTYTBL WITH TREESW LOCKED, HANGING SYSTEM. + E.G. RWK TTYFRE +Find out why, in the SWPWSP system, the loading state doesn't work. + Also find out why it tends to swap from wrong disk and like that. +JOB: open, when no slots are available, should hang for a little while before erring. +When generating a ">" file name for write, should prefer all-numeric + names over names with non-numeric characters in them. The same + should also be true for read. A reasonable way to do this + would be to compare first the numeric value, then the whole name + as sixbit if the numeric values are the same. The numeric value is + the left-most contiguous set of digits, converted from decimal to binary, + with the sign bit turned on if there are any non-digits in the name + except for trailing blanks. + The incrementer, however, should continue to do what it does now, + thus incrementing 6.9 to 6.10 +Implement chaining for disk writes (reads are much harder and + more dubious.) Speedup is only marginal unfortunately. +New winning echoing scheme to fix "rubout problem" +Automatic time setting to avoid lusers setting incorrect time. (STRTUP) +New lighthouse scheme? +DDTDSK & DSKDMP shouldn't allow crash dumps to get past QSWAPA, but shouldn't + shaft you by making it impossible to dump out an ITS. Should they clobber + with reckless abandon in the swapping area, or respect the TUT? +When gsb names a job .FILE. (DIR), it astonishes pfthmg dragon. +If a job owns a sty which is its own tty, and closes the sty, + it doesn't get gunned, which apparently could cause anomalies. +Some kludge for a message on top level int job detached while loading. +Make core-link use normal BLKT routines. CLO have interrupt-on-connected. +core link device should give input-available interrupts (& handle WHYINT) +RMS;PGEXCH +Implement chaos net to self only for machines with no hardware net. +Fix conditionals so you can have chaos without an Arpanet. +Arpanet: Save subtype of destination-dead message in IMPHTB, return in NETHST. +DELETE %TXSFT AND %TXSFL. (%TXSFL is gone now) +%TOIML is alleged to be obsolete now, likewise %TNIML. (RIP SSV) +LISTEN on a tty returns device not available if you don't + own the tty. It should probably return success saying 0 chars available. +Don't allow deleting FOO < to delete FOO > +RENMWO with a zero 2nd arg turns into RENAME and fucks up grossly. + I tried to fix this but found that it would break .FDELE. + Also RENMWO always sets its UUAC to 0 instead of the given channel number arg. +There should be a WHOLIN TTYVAR. +Add additional tty variables, TTYSTS, TTYST1, TTYST2. +EAK would like to be able to access millions of random things as + tty variables, e.g. cursor pos, number of echo lines, and so forth. +Can get NET: IGNORED ALLOC of a legitimate alloc right after opening a connection. + Then the receiver has non-zero allocation, but the sender has zero, and hang. + I can't figure out why this happens; happens from DM a lot. May have to + do with starting several ML devices at once? +The net may send illegitimate CLS commands when it goes down, some hosts complain. + SAIL gets this also, probably it isn't our fault. Tenex thinks we are rsexec?? +Still no fix for swap-write errors problem. Should barf if it's a file + page, otherwise assign a new disk address. +For something different from load av look at e.g. #jobs + unblocked in last second (LUBTM) then avg over longer times +A system call to hand a character which would echo it or rub it out + as appropriate, knowing the size of what it echos as, etc. -- klh +Compute rnablu and npgwtu 1, 5, and 15-minute averages. +People have mumbled about authors and don't-delete bits. +STYs can get the greeting message out of order, apparently old + console free messages, and %TDRCR, %TDLF, %TDINI on supdup stys, occasionally. +Character mode on USR: (for lisp). Can't be done. +In direct connect mode, no protection against overfilling tty input buffer. + But also no danger of hanging in STYO. Maybe for STYs should be a mode? +RWK wants to be able to have a newline without cleol but scroll function, + with more deferred. The idea is to be able to draw e.g. a box without + being broken across screen boundaries, or Macsyma display, etc. + I think the effect can be achieved by temporarily setting %TSMOR+%TSROL, + then using CRLF. This will cleol, but you clearly want that since + it does anyway in the case where it scrolls. You will have to figure + out your own more processing. Macsyma should try this. +For ML and DM, check memory switches better; check for 2 addresses + from the processor being the same memory. Not currently detected. +BOJ SIOT +TTY output SIOT put %TDNOP's to align word boundaries then use BLT where + that seems like it's worth it. -- hard to avoid bugs with %TDMOV -- (?) +Keep a small ring buffer of the names of output files recently closed + and have a command some place to print this. -- dlw +RVB would like to have device names in links. +Proposed hack to make SYS: a job device. (?) + A better idea is something similar to 20X logical devices. + i.e. Do something to allow directories to be bigger. +Sort out MOREing - %TJECH, %TJMOR, %TSMOR, TYVM (?) +OPEN with byte size. +Way to set/adjust the length of a file (open for writing). +Make JOB SIOT byte pointer available to BOJ JOB (for alignment.) +Who lines scheme for non tvs? (?) +Network should remember how many pending INS/INR interrupts there are. +Improve data media code to grok relative positioning; make non-tab + cursor motion code understand direct positioning; relates to ADM3s. + KLH claims on a DM2500 not even carriage return works. +">" algorithm loses for 999999. Wraps around to 000000 and doesn't + check if that file already exists. +The SPY device doesn't work on free consoles -- pain in debugging ttys. +$0L into pdp6 loses in core job with inf circular list - Ed +There are some problems with core job, retmmp, etc. - see listing +^PA should "work" in comm mode since DDT has started using it. +Optional 6th arg to .CALL TRANS +CORBLK to get a fresh page doesn't necessarily do so. This should be fixed. +PDUMP should also save debugging user variables. +Verification of decoriolis clock when system comes up. + Right thing is to run a daemon job before typing "in operation", + also before accepting ^Zs. Job either gets it through net or asks + on T00, if time doesn't agree with some file dates. +System knows names of pdp11s on ten11 interface; some of them can + only be written by one tree at a time. (?) +MRC wants ^P codes to "work" in com mode on ttys of the same type. (?) +Form of OPEN/RENAME/DELETE/MLINK that doesn't do translations? +Improve dm daemon stuff and turn on elsewhere; e.g. need + a demsig interrupt, need better dmnstr stuff. +VSCLK wants to do JSP E,CHECK, but first must provide mechanism for + variable PIA devices, e.g. IMP, NLPT. +FORCE + FLUSH means something on input? +Disk dir paw over changes for when file was open for writing when system crashed +^PS's saved cursor position should be per-tty/per-job. +Undeletion. +User enableable interrupt on being blocked for more than C(user variable) seconds? +Macro to push PI status and turn more channels off, macro to pop PI status. (?) + This a little complicated since CONI PI,A ? CONO PI,(A) doesn't work. + Correct sequence is CONI PI,AC ? ANDI AC,177 ? ... ? CONO PI,2000(AC) +System job can get hung if another job is typing on system console; + the job waits for buffer space with TYOSW locked. + Note that it must wait this way for separation of echoing/mp output. +Handle figuring out which packs are mounted the way the salvager does? + This would be fairly complicated to do. Perhaps the salvager could tell the system?? +On MC, respond correctly to disk powered off and back on. +Replace DSKDMP with DDT on AI, ML, DM ? Replace DDTDSK with (better) DSKDMP on MC ? + Note- DSKDMP has been improved to have compatible symbol table, + save ACs, etc. so not much need to make DDTDSK work on other machines. +iotbts - control waiting for input, what returned if none, output don't hang mode + These should be in LH(CTLBTS) rather than separate IOTBTS user var. +automatic unhanging of LPT; both old & new have this problem (different problems). + Seems to have stopped happening 10/25/77 +make RSSIZE work on all devices +Implement %QAOUT - ? +Disk allocation system call (e.g. for KLFEDR.) +KL MUSIC support. +Dynamic adding and deleting of core pages (?) + requires changing page eviction in core job to be modularized out of sys var grower + Note page eviction has been mostly flushed now! +.ATTY and .DTTY to a BOJ JOB forced by that BOJ JOB; + e.g. for tektronix graphics device. +Eliminate IOC error codes, and have IOC errors return open loss codes. +Cause OPNL's to pop the LSWPR not all the way, but rather + to a remembered level. They should also flush P down to a remembered + level and then POPJ. This will allow recursive ERRSET'ing within the system, + and further reduce the differences between system call routines and + other subroutines. (?) +The who-line should mention it if you are being queried for a com link. +Make run status in who-line 9 characters instead of 6. ("+FOOBARSI") +Eventually make core job part of sys job. +Have SYS job attend to ^Z's by creating an inferior, disowning it + and attaching it to the tty. (?) +Have a UUO that Xfer's job's entire user var block into it. (?) +New sys call to get # bytes of buffer space full and # bytes empty + eg # bytes of output not yet transferred, and # bytes can be output + before buffer is full. (?) +Call I/O related routines with LH(IOCHNM) in I instead of A; and + otherwise restandardize AC usage. +Alternate keypad mode and alternate character set mode on VT52s (?) +Redesign the file system? +Support RH20, KS10, and Foonly-10. +--- + +RMS@MIT-AI 05/16/78 21:38:19 Re: JOBREU doesn't really win +To: MOON at MIT-AI, RMS at MIT-AI +Reuse of job devices has the problem that the job device +needs some time to settle down and do the jobreu. +If you just close and reopen the ML device, the handler +is never ready in time. If you sleep for 1 second, then +it usually is ready, provided that it was idle when you +closed it. It takes 3 seconds for it to become idle +just after it is opened. Of course, real uses don't just +close and reopen this way, but the point should be clear: +it is necessary for the handler to indicate in advance that it +will be reusable. When a job tries to open ML:, if there are +no handlers in JOBREU, it should look for one which has JBCG set and says that +it will do a JOBREU, and wait for that one to either do it or kill itself. +At that point, looping back to the existing OPEN code will win. + +Add wholine & PEEK state character for loading, similar to > +for swap-blocked. Add _ to wholine. diff --git a/sysdoc/its.obugs0 b/sysdoc/its.obugs0 new file mode 100644 index 0000000..9091369 --- /dev/null +++ b/sysdoc/its.obugs0 @@ -0,0 +1,15497 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Friday, 29 April 1983, 00:33-EDT +From: Christopher C. Stacy +To: David C. Plummer +Cc: BUG-ITS at MIT-MC, ian at MIT-OZ +In-reply-to: The message of 28 Apr 83 16:59-EDT from David C. Plummer + + Date: 28 April 1983 16:59 EDT + From: David C. Plummer + It's cheating. Terminal-0-F @Rutgers, c-Break, chaos:conn-list + shows that the contact name the LispM is using is NAME @rutgers. + +Aha. Except that SYSTEM-T RUTGERS connects to MC and then gets +me to RUTGERS ok. It also works for SCORE. + +Date: 28 Apr 1983 17:43 EDT (Thu) +From: Ian Macky +To: David C. Plummer +Cc: BUG-ITS@MIT-MC +Subject: ARPA server +In-reply-to: Msg of 28 Apr 1983 17:13 EDT from David C. Plummer + +Ah, OK, thanks much -- All it needed was for me to send a NL after +the connection was established. + +Date: 28 April 1983 17:13 EDT +From: David C. Plummer +Subject: ARPA server +To: Ian @ MIT-OZ +cc: DCP @ MIT-MC, BUG-ITS @ MIT-MC + +I figured it out. You aren't following the protocol of the TCP +NAME server. Connecting isn't enough. After you connect, you +must then give the JCL. Try :chtn mcTCP rutgers 117 (the caps +are important). When it opens the connection, type return. + +Date: 28 April 1983 16:59 EDT +From: David C. Plummer +To: CSTACY @ MIT-MC +cc: DCP @ MIT-MC, BUG-ITS @ MIT-MC, ian @ MIT-OZ + + Date: 27 April 1983 21:41 EDT + From: Christopher C. Stacy + + If I go to a LispM and finger RUTGERS, it connects to MC and I + get a Finger listing from RUTGERS. I can also TELNET from a + LispM to SCORE. So, I think the ARPA server works. + +It's cheating. Terminal-0-F @Rutgers, c-Break, chaos:conn-list +shows that the contact name the LispM is using is NAME @rutgers. + +Date: 27 April 1983 21:41 EDT +From: Christopher C. Stacy +To: DCP @ MIT-MC, ian @ MIT-OZ +cc: BUG-ITS @ MIT-MC + + +If I go to a LispM and finger RUTGERS, it connects to MC and I +get a Finger listing from RUTGERS. I can also TELNET from a +LispM to SCORE. So, I think the ARPA server works. + + +Date: 27 Apr 1983 20:22 EDT (Wed) +From: Ian Macky +To: David C. Plummer +Cc: BUG-ITS@MIT-MC +Subject: ARPA server +In-reply-to: Msg of 11 Apr 1983 06:39 EST from David C. Plummer + +The ARPA server still doesn't work. If I go to MC and do F @RUTGERS +then I get a Rutgers Finger display. If, from OZ, I connect to the +ARPA server with "RUTGERS 117" then I never get the stuff. What it +was doing a few seconds ago was just hanging... I waited a minute or +so (on several occasions) but never got any response. Usually there's +a "Failed to TCP connect" message, and sometimes a "Timed-out" and +other similar things, but it has never once worked. + +Date: Wednesday, 27 April 1983, 08:24-EDT +From: Christopher Stacy +Subject: SYS: +To: BUG-ITS@MIT-MC +Cc: ALAN@MIT-MC, DEVON@MIT-MC +In-reply-to: The message of 27 Apr 83 05:24-EDT from Alan Bawden + +I have an idea for implementing Twenex-like logical names on ITS. +The main feature which I want from logical names is search paths, +so that COM: and SYS: and others could be made to do the right thing. + +The jobdev mechanism could be used as-is for this feature, but I dont +want the overhead of a jobdev and the slowness of doing the IOTs +multiple times. + +My idea for getting around this is a to extend JOBRET so that there is +a way for the BDH to tell the system: "I am going away now. Disconnect +the user from me and retry the OPEN call using these args I am giving +you." Once this kind of JOBRET is done, the BDH's BOJ: channel is +closed and he should logout or reuse. There will probably want to be +some restrictions (like maybe: the BDH must not have .IOTed anything +yet) based on internal implementation details. + +With this feature, a user could open the FOO: device, which would +start a BDH. The BDH would do a JOBCAL and find out the OPEN +parameters. Then the BDH does its thing to figure out where the user +really wants to be OPEN to, and does a JOBRET to pass control back to +ITS for retrying the OPEN call. + +I am willing to implement this in ITS, and maybe put some kind of +interface on it for users (so they dont have to write their own BDH's +whenever they want to make a logical name). + +Thoughts? + + +Date: 27 April 1983 11:04 EDT +From: David C. Plummer +Subject: SYS: +To: CStacy @ MIT-OZ +cc: BUG-ITS @ MIT-MC, ALAN @ MIT-MC, DEVON @ MIT-MC + + + I am willing to implement this in ITS, and maybe put some kind of + interface on it for users (so they dont have to write their own BDH's + whenever they want to make a logical name). + + Thoughts? + +As I recall, you threatened to do this for the sake of things +like HS: as well. Anyway, one possibility is to have users +translate FOO:*;* * to LOGICL:*;* *. The LOGICL device could +open DSK:hsname;xuname LOGICL to find an ascii file containing +lines of LOGICAL-DEVICE &REST PATHS, where PATHS can contain *s +for when to default to the field from the open call. You would +have to be careful to make sure loops don't happen (e.g., foo: -> +bar: -> foo: ...). Perhaps you can use LINK-DEPTH-EXCEEDED... +To appease people like me who already have 6 translations, you +may have to up the translation table size if you decide to use +this method. + +Date: Wednesday, 27 April 1983, 08:41-EDT +From: Christopher Stacy +Subject: SYS: +To: BUG-ITS at MC +Cc: ALAN at MC, DEVON at MC +In-reply-to: The message of 27 Apr 83 05:24-EDT from Alan Bawden + +I have an idea for implementing Twenex-like logical names on ITS. +The main feature which I want from logical names is search paths, +so that COM: and SYS: and others could be made to do the right thing. + +The jobdev mechanism could be used as-is for this feature, but I dont +want the overhead of a jobdev and the slowness of doing the IOTs +multiple times. + +My idea for getting around this is a to extend JOBRET so that there is +a way for the BDH to tell the system: "I am going away now. Disconnect +the user from me and retry the OPEN call using these args I am giving +you." Once this kind of JOBRET is done, the BDH's BOJ: channel is +closed and he should logout or reuse. There will probably want to be +some restrictions (like maybe: the BDH must not have .IOTed anything +yet) based on internal implementation details. + +With this feature, a user could open the FOO: device, which would +start a BDH. The BDH would do a JOBCAL and find out the OPEN +parameters. Then the BDH does its thing to figure out where the user +really wants to be OPEN to, and does a JOBRET to pass control back to +ITS for retrying the OPEN call. + +I am willing to implement this in ITS, and maybe put some kind of +interface on it for users (so they dont have to write their own BDH's +whenever they want to make a logical name). + +Thoughts? + + +Date: 27 April 1983 05:24 EDT +From: Alan Bawden +Subject: SYS: +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 27 Apr 1983 02:36 EDT from Devon S. McCullough + + Date: 27 April 1983 02:36 EDT + From: Devon S. McCullough + Why doesn't SYS: look in the overflow directories SYS1; SYS2; SYS3; + prray tell? + +I thought about this some more, and I talked it over with Moon, and it +appears that the answer is: For no good reason. + +There are some red herring issues like: What should happen if you try to +read the binary directory listing from SYS:.FILE. (DIR)? And: What +exactly should happen if you open SYS:FOO > for writing? But it appears +that a perfectly good answer to most of those objections is: Well what +makes you think that the SYS: device should behave at all like the DSK: +device anyway? (Why should it have a binary directory, and why should you +be able to write to it.) + +There would be the compatibility problem with current programs that use +SYS: as a synonym for DSK:SYS;, but they could all be trivially fixed. +Think of al the places that implement the SYS;, SYS1;, ... search +themselves currently... + +(Now, can somebody think of something clever for the COM: device to do?) + +Date: 27 April 1983 02:36 EDT +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +Why doesn't SYS: look in the overflow directories SYS1; SYS2; SYS3; prray tell? + +Date: 27 April 1983 01:20 EDT +From: Alan Bawden +Subject: CRASH;CRASH QSKCH +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC +In-reply-to: Msg of 26 Apr 1983 09:33 EDT from Ken Harrenstien + + Date: 26 April 1983 09:33 EDT + From: Ken Harrenstien + Note, by the way, that this has been with us for a long time; there + are simply too many processes trying to run, and the present design of + ITS imposes some limits which cannot be avoided without doing clever + things like mapping buffers in and out of exec address space. Both + CHAOS and TCP code are also liable to wild runaway use of buffers if + the net hardware burps. + +Has anyone thought seriously about mapping buffers? (I appreciate that I +have just said a mouthful.) + +Date: 26 April 1983 13:05 EDT +From: Richard Mark Soley +Subject: CRASH;QSKCH +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, JPG @ MIT-MC, TY @ MIT-MC +In-reply-to: Msg of 26 Apr 1983 05:56 EDT from Christopher C. Stacy + + Date: 26 April 1983 05:56 EDT + From: Christopher C. Stacy + To: TY, SOLEY + cc: BUG-ITS, JPG + Re: CRASH;QSKCH + + Did ITS crash, or did you stop it? All that is on the console + is "Warn KLDCP" --that is, ITS did not print any crash message + and it looked like it was just halted in its tracks. In particular, + I dont see the PC or anything printed anywhere. + +ITS didn't crash, we stopped it. No-one was getting any response at all. + + -- Richard + +Date: 26 April 1983 09:33 EDT +From: Ken Harrenstien +Subject: CRASH;CRASH QSKCH +To: JPG @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC + +Looking at this crash with PEEK's autopsy mode reveals that sure +enough the system was out of low memory, because there were tons +of disk channels open. + +Note, by the way, that this has been with us for a long time; there +are simply too many processes trying to run, and the present design of +ITS imposes some limits which cannot be avoided without doing clever +things like mapping buffers in and out of exec address space. Both +CHAOS and TCP code are also liable to wild runaway use of buffers if +the net hardware burps. + +What is interesting is that one TEX job had 9 disk channels open, 7 +of them to the same file! There was another TEX running too, tho not +as hoggish. And there were several ATSIGN CHAOS jobs scattered +around; these invariably seem to litter up the system whenever it +gets wedged (cause or effect?) + +Date: 26 April 1983 07:01 EDT +From: Christopher C. Stacy +Subject: Translations +To: ALAN @ MIT-MC +cc: BUG-DDT @ MIT-MC, PGW @ MIT-XX, BUG-its @ MIT-ML +In-reply-to: Msg of 23 Apr 1983 16:23 EST from Alan Bawden + + +DDT now uses an unlikely SNAME when it creates inferiors, to help +prevent naive users from translating themselves into problems. + + + +Date: 26 April 1983 05:56 EDT +From: Christopher C. Stacy +Subject: CRASH;QSKCH +To: TY @ MIT-MC, SOLEY @ MIT-MC +cc: BUG-ITS @ MIT-MC, JPG @ MIT-MC + + +Did ITS crash, or did you stop it? All that is on the console +is "Warn KLDCP" --that is, ITS did not print any crash message +and it looked like it was just halted in its tracks. In particular, +I dont see the PC or anything printed anywhere. + +The messages it was printing were to tell you that the load on the +system was too high (in the sense that there were no disk channels). +That is why the system no doubt looked wedged to users. + +Btw, I fixed ITS so that it will only print those warning messages +every thirty seconds, so it wil not overflow the console buffer +(which is what the SYS MSGS LOST means. Maybe it should say +SYS MSGS LOTS instead...) + + +Date: 26 April 1983 05:17 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Now ITS only does running out of resource checks if it has not done +one in the last thirty seconds. This is to avoid deluging the system +console with messages like "Warning: Inadequate space in low core LMEMFR/2". + +Date: Tuesday, 26 April 1983, 00:37-EDT +From: Christopher C. Stacy +Subject: FileComputer +To: PSZ at MIT-ML, HDT at MIT-OZ +Cc: BUG-ITS at MIT-ML +In-reply-to: The message of 24 Apr 83 14:11-EDT from Peter Szolovits + +There are two different, incompatible file systems on CADR-27. +If you want to use what I believe is called the "FS" filesystem, you +need to use CFTP. If you use the "FC" filesystem (written by RMS) you +can use either CFTP or just the FC: device. + +I just typed :LISTF FC:CSTACY; on MC, and it listed my directory for me. +What do you think is wrong? + +Cheers, +Chris + + + +Date: 25 April 1983 18:18 EDT +From: Jeffrey P. Golden +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Please check out CRASH;CRASH QSKCH. +What happened is the system console began printing out pages and pages +of "Warning: No free qsk channels. + n SYS MSGS LOST" +and then it crashed in some way, hence the CRASH dump. (I was not here +at the time, I am just transmitting the contents of the log book to you +so you can check this out.) + +Date: 25 April 1983 04:13 EDT +From: David C. Plummer +Subject: ASSLIS is such a kludge! +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-LISP @ MIT-MC + + Date: 24 April 1983 18:31 EST + From: Alan Bawden + + File deletion is supposed to work on the core-link, and I distinctly + remember that in the (recent) past it HAS worked (DCP might remember + otherwise?). + +I don't remember if it is supposed to or not. + + If anyone wants a few cheap laughs (and can read Midas), they should take a + look at MC:L;ASSLIS >. It's certainly the kludgiest program I've seen in a + long time. + +I thought I could read Midas, but I have a hard time reading that thing. + +Date: 24 April 1983 18:31 EST +From: Alan Bawden +Subject: ASSLIS is such a kludge! +To: BUG-ITS @ MIT-MC +cc: BUG-LISP @ MIT-MC + +CLU:.FILE. (DIR) currently lists: + + LISP MIDAS BARQIO CLOSED-> HACTRN + FOO MIDAS BARQIO CLOSED-> HACTRN + L MIDAS BARQIO CLOSED-> HACTRN + L MIDAS FOOQIO CLOSED-> HACTRN + +The reason it says " HACTRN" is that it used to say "ALAN HACTRN" until I +logged out that job. Before that all four entries were in CLOSED->CLOSED +state and I tried to delete tham using  in DDT. Instead of deleting them +it seems to have decided I wanted to USE them. I checked, and DDT did not +still have any CLx channels. I guess these will stay here until MC crashes +next. + +File deletion is supposed to work on the core-link, and I distinctly +remember that in the (recent) past it HAS worked (DCP might remember +otherwise?). + +If anyone wants a few cheap laughs (and can read Midas), they should take a +look at MC:L;ASSLIS >. It's certainly the kludgiest program I've seen in a +long time. + +Date: 24 April 1983 13:11 EST +From: Peter Szolovits +Subject: FileComputer +To: HDT @ MIT-OZ +cc: BUG-ITS @ MIT-ML +In-reply-to: Msg of 24 Apr 1983 01:49 EST (Sun) from Howard D. Trachtman + + Date: 24 Apr 1983 01:49 EST (Sun) + From: Howard D. Trachtman + To: PSZ at MIT-OZ + Re: FileComputer + + I'm not sure what happened to the fc device as accesable from ITS. + I do know that cftp will work. + + Try :cftp fc + login psz + dir fc:psz; + + and you should see your files. The fc: is needed as the filecomputer + supports two different file systems. + +Indeed you are right. Therefore the FC: device in ITS is broken. Could +someone fix it? + + +Date: Sunday, 24 April 1983, 01:51-EST +From: David A. Moon +Subject: Running out of low core +To: Christopher C. Stacy +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 19 Apr 83 21:17-EST from Christopher C. Stacy + + Date: 19 April 1983 21:17 EST + From: Christopher C. Stacy + The check for running out of low core I put in goes off quite alot, + and frequently overflows the system console message buffer. Usually + when this goes off, it means that the system appears wedged to users. + Do you suppose there could be a bug in the system with someone not + returning some flavor of buffer space at the right time? + +More likely there is just isn't enough address space for all the disk +buffers, disk directories, chaos buffers, tcp buffers, core link buffers, +and everything else. Isn't it the case that if you wait a while and +kill all jobs with open files the space always comes back eventually? + +Date: 23 April 1983 16:23 EST +From: Alan Bawden +Subject: Translations +To: PGW @ MIT-XX +cc: BUG-DDT @ MIT-MC, BUG-its @ MIT-ML +In-reply-to: Msg of 23 Apr 1983 1328-EST from Paul G. Weiss + + Date: 23 Apr 1983 1328-EST + From: Paul G. Weiss + To: bug-its at MIT-ML + Re: Translations + + ... + + What follows is a wallpaper file so you can better understand what I mean: + + ------------------------------------------------ + * arch;* *,ar1:inna;* * + ... + *:find arch; + INFERIOR-CREATION FAILED? u:BYE +  INFERIOR-CREATION FAILED?:INPUSH 1u + +This is because translating *:ARCH;* * => AR1:INNA;* * will cause +translations to happen for devices other than DSK: (like USR:, which is why +DDT can't create any inferior jobs). You should create the following two +translations instead: + + DSK:ARCH;* * => AR1:INNA;* * + ML:ARCH;* * => AR1:INNA;* * ;or whatever ITS you are using. + +(I have CC'd this to BUG-DDT beacuse I presume DDT could be more robust +than this by supplying some unlikely-to-be-translated directory name +whenever it tries to use the USR: device. I checked, and DDT currently +doesn't supply an SNAME when opening USR:, which just begs to shaft people +like this.) + + +Date: 23 Apr 1983 1328-EST +From: Paul G. Weiss +Subject: Translations +To: bug-its@MIT-ML + +In order to get around the problem of TEX not accepting device names for +input files, I have been using file translations. In particular, I do + + arch;* *,ar1:inna;* * + +and use the "pseudo-directory" ARCH; to refer to stuff inside the archive. +This works fine for TEX. + +The problem is that it causes other things to go awry, namely, when I try +to do + + :FIND ARCH; + +it gives me a strange error. +It also keeps me from logging out with u since it tries and fails to run +:BYE. I must log out with 1u (or remove the translation). + +What follows is a wallpaper file so you can better understand what I mean: + +------------------------------------------------ +* arch;* *,ar1:inna;* * +*archML INNA AR1 6.045J +Free files = 175, Wasted Words = 0 + 0 H1 1 1 02/02/83 16:55:58 + 0 H10 1 3 03/10/83 18:23:21 + 0 H12 2 1 03/08/83 16:42:41 + 0 H13 6 1 03/09/83 10:16:47 + 0 H14 4 1 03/10/83 19:38:01 + 0 H15 6 1 03/10/83 22:32:47 + 0 H16 2 1 03/17/83 12:46:21 + 0 H17 2 1 03/29/83 15:33:57 + 0 H18 13 1 04/04/83 10:29:40 + 0 H19 1 4 04/07/83 22:28:43 + 0 H2 10 1 02/02/83 16:56:00 + 0 H20 1 2 04/07/83 22:29:43 + 0 H21 5 2 04/08/83 10:37:00 + 0 H23 2 1 04/13/83 16:02:52 + 0 H24 3 1 04/14/83 15:50:58 + 0 H25 2 1 04/20/83 17:13:16 + 0 H26 2 1 04/23/83 12:38:10 + 0 H26A 1 1 04/20/83 17:02:45 + 0 H26B 1 2 04/21/83 16:43:30 + 0 H26C 1 1 04/21/83 16:26:47 + 0 H26D 1 2 04/21/83 16:27:02 + 0 H26E 1 3 04/21/83 16:27:23 + 0 H26F 1 3 04/21/83 16:58:04 + 0 H3 23 1 02/07/83 16:43:30 + 0 H4 5 1 02/07/83 18:07:10 + 0 H6 1 1 02/14/83 19:10:38 + 0 H7 1 2 03/10/83 18:22:44 + 0 H8 11 1 02/24/83 15:27:48 + 0 H9 1 2 03/10/83 18:22:57 + +*:find arch; + INFERIOR-CREATION FAILED? u:BYE + INFERIOR-CREATION FAILED?:INPUSH 1u +----------------------------------------- +------- + + +Received: from SCRC-BLACKSTONE by SCRC-TENEX with CHAOS; Fri 22-Apr-83 11:27:24-EST +Date: Friday, 22 April 1983, 11:23-EST +From: Robert W. Kerns +To: Christopher C. Stacy +Cc: BUG-ITS@MIT-MC +In-reply-to: The message of 19 Apr 83 21:17-EST from Christopher C. Stacy + + Date: 19 April 1983 21:17 EST + From: Christopher C. Stacy + The check for running out of low core I put in goes off quite alot, + and frequently overflows the system console message buffer. Usually + when this goes off, it means that the system appears wedged to users. + Do you suppose there could be a bug in the system with someone not + returning some flavor of buffer space at the right time? + +I am of the opinion this problem has been with us for years. + +Date: 22 April 1983 08:21 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +AI's processor is *fucked*. I turned it off. Maybe it will start +randomly working again when I turn it back on, probably tomorrow or +the next day. + +Date: Friday, 22 April 1983, 07:58-EST +From: Christopher Stacy +Subject: MC is now the bug host. +To: BUG-ITS at MC, BUG-MAIL at MC + +COMSAT now uses MC as the "bug host". I changed all the appropriate +mailing lists, and installed the latest COMSAT on all four machines. +I put the following in the MC:NAMES > file: + +;;; MC is now the default BUG host. +;;; If a program exists on all machines, its BUG list normally +;;; only needs to be on MC. +;;; +;;; The reasons to define a BUG- name on some ITS besides MC include: +;;; o The program is not used on MC. +;;; o The program is mainly used on the other ITS, and most of +;;; the maintainers are there, and there is an entry +;;; on MC which forwards to the apporpriate machine. +;;; o In the absence of such reasons, define it on MC only. +;;; +;;; If a message is sent from some other ITS to a bug list which is not +;;; defined, it will be forwarded here. If the bug list is not defined +;;; here, the message will be sent instead to BUG-RANDOM-PROGRAM. + +Chris + +Date: 20 April 1983 01:44 EST +From: David C. Plummer +Subject: [Forwarded: COMSAT, Re: [Forwarded: Hank.Walker@CMU-CS-VLSI, Re: Mailer problems]] +To: BUG-ITS @ MIT-MC + +Date: 15 April 1983 08:51 EST +From: David C. Plummer +Subject: [Forwarded: Hank.Walker@CMU-CS-VLSI, Re: Mailer problems] +To: BUG-MAIL @ MIT-MC + +More info. I notice bug-mail is still on AI. Should this be changed? + ------------------------------ +Date: Thursday, 14 April 1983 21:15:03 EST +From: Hank.Walker@CMU-CS-VLSI +To: David C.Plummer +Subject: Mailer problems +Message-ID: <1983.4.15.2.10.27.Hank.Walker@CMU-CS-VLSI> + +It is probably not the UNIX mailer that is causing the problems. Mail +messages from MIT go to CMU-CS-A. If it is TCP mail, it is shipped +to the CMU-CS-PT VAX over the Ethernet, which translates the stuff into +NCP, and sends it back to CMUA where it is delivered to me. That mail is +then autoforwarded to me at CMU-CS-VLSI, where I live, even though INFO-COBOL +has my CMU-CS-A mailing address. So the mail is delivered directly +to CMU-CS-A, which is a KL10 running TOPS-10, rather than to a UNIX machine. +I have no troubles receiving mail from any other site on the net to either +CMU-CS-VLSI directly or to CMU-CS-VLSI, which communicates with the ARPAnet +over an Ethernet gateway. + +Date: 20 April 1983 01:44 EST +From: David C. Plummer +Subject: [Forwarded: COMSAT, Re: [Forwarded: Hank.Walker@CMU-CS-VLSI, Re: Infinite mail messages]] +To: BUG-ITS @ MIT-MC + +I originally sent this to BUG-MAIL@MC, which tried to go to AI, +which is down. Perhaps somebody should find an AI backup tape, +and get NAMES > (carefully) and get the more important BUG lists +over to MC? There is a followup to this message coming soon... + ------------------------------ +Date: 14 April 1983 21:04 EST +From: David C. Plummer +Subject: [Forwarded: Hank.Walker@CMU-CS-VLSI, Re: Infinite mail messages] +To: BUG-MAIL @ MIT-MC +cc: Hank.Walker @ CMU-CS-A + +Forwarding complaint about the MC mailer. Following are some +parts of the MC mail stats file. Other ditties of information: +Other messages to CMU-CS-A get through successfully. The ones I +saw happened to be small messages. Could this be the Unix +braindeath that insists on completely delivering messages +(instead of queuing) before it gives a completion reply? If so, +the product of number of recipients by the length of the message +is a roungh indication of the length of time it will take to +deliver the message. If things are sufficiently slow, MC will +correctly timeout. If this is true, I would have to say it is +the Unix mail server that is broken. + + Date: Thursday, 14 April 1983 20:51:27 EST + From: Hank.Walker@CMU-CS-VLSI + To: David C.Plummer + Subject: Infinite mail messages + Message-ID: <1983.4.15.1.49.7.Hank.Walker@CMU-CS-VLSI> + + Would you please refrain from sending messages to INFO-COBOL until your + mailer is fixed. I realize that it is not your fault, but quite frankly I + am tired of receiving anywhere from 2 to 10 messages from anyone who sends + mail originating at MIT, particularly mail that I've already seen before. + Lean on your system manager, or charge him a quarter for every duplicated + mail message that your system emits. + +195935 ICP->CMU-CS-A(SMTP) +195939 XTO->Bob.Walker +195939 XTO->David.Nichols +195940 XTO->Dill +195940 XTO->Everhart +195940 XTO->gail.kaiser +195941 XTO->Hank.Walker +195941 XTO->Highnam +195942 XTO->Kazar +195942 XTO->Lamb +195943 XTO->Lehman +195943 XTO->muller@CMU-CS-GANDALF +195943 XTO->Provan +195944 XTO->Rudy.Nedved +195944 XTO->Sherman +195945 XTO->Shipman +195945 XTO->Shrager +195945 TEXT-> +200048 NO COMPLETION REPLY, R=10 +200503 Queued: <[MIT-MC].635105> for CMU-CS-A + +202005 Attempting to send messages queued to host CMU-CS-A +202005 ICP->CMU-CS-A(SMTP) +202008 QID=<[MIT-MC].635105> +202009 XTO->Bob.Walker +202009 XTO->David.Nichols +202010 XTO->Dill +202010 XTO->Everhart +202011 XTO->gail.kaiser +202011 XTO->Hank.Walker +202012 XTO->Highnam +202013 XTO->Kazar +202013 XTO->Lamb +202014 XTO->Lehman +202014 XTO->muller@CMU-CS-GANDALF +202015 XTO->Provan +202015 XTO->Rudy.Nedved +202016 XTO->Sherman +202016 XTO->Shipman +202017 XTO->Shrager +202017 TEXT-> +202120 NO COMPLETION REPLY, R=10 + +DCP@MIT-ML 04/19/83 22:13:15 +To: (BUG its) at MIT-MC +Has anybody changed the ATTY/DTTY code recently. It's probably +pure coincidence, but MC has crashed on me several times +just after sending me a message. Perhaps that's just a bad +time to reference a disk? + + +Date: 19 April 1983 21:18 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +In XITS on MC, I patched out the LMEMFR check bug message for the moment. + +Date: 19 April 1983 21:17 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +The check for running out of low core I put in goes off quite alot, +and frequently overflows the system console message buffer. Usually +when this goes off, it means that the system appears wedged to users. +Do you suppose there could be a bug in the system with someone not +returning some flavor of buffer space at the right time? + + +Date: 16 April 1983 04:36 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +ITS 1336 (XITS on MC) has additional warning messages for no +free disk channels and no free job slots, to go with the no +free low core warning. This junk seems to work. + +Date: 16 April 1983 02:52 EST +From: Christopher C. Stacy +Subject: crash info +To: BUG-ITS @ MIT-MC +cc: ELLEN @ MIT-MC, JPG @ MIT-MC + +ITS now print warning when the amount of exec free space +gets too low. This is to make it easier to walk over to the +console and guess why the machine is wedged. Also put a bug +message in the RH10 QINTE code where it has been dying all day, +so it prints the disk number and offending controller bits. + +ITS 1334 installed on MC as XITS. +If trouble, revert to NITS. + +Date: 16 April 1983 01:17 EST +From: Christopher C. Stacy +Subject: hardware trouble +To: BUG-ITS @ MIT-MC +cc: ELLEN @ MIT-MC, JPG @ MIT-MC, GSB @ MIT-MC + + +MC is having bad hardware trouble. +ITS died several times today with disk hardware errors. +This was at QINTE+45, where it checks some random ctrl bits (and the +comment reads "worse than unsafe".) I think this was on unit #0. +Just now the system came down because the -11 timed out waiting on the +KL. Earlier today it came down becuase there were too many parity +errors. Yesterday and the day before the -11 died, and had to be +power cycled to get to work again. + +Date: 13 April 1983 19:56 EST +From: Ken Harrenstien +Subject: ML doesn't like to talk to the Symbolics ethernet (and any future new subnets) +To: Moon @ SCRC-TENEX +cc: BUG-ITS @ MIT-MC, cmb @ SCRC-VIXEN, bug-lispm @ SCRC-TENEX + +The last ML ITS was assembled in middle of March, plenty of time for your +NSUBNT change to take effect. I checked it out just now, and found +that you modified the CHAOS source on SYSTEM; rather than SYSHAK; which +is where all of the recent TCP/IP work has been happening. So I just +now bumped up NSUBNT to 100. in the SYSHAK version (the only change you +made) and someone will have to assemble a new ML ITS sometime. + +I guess now that things are obviously working, SYSHAK should be merged back +into SYSTEM, so I will do that eventually. + +Received: from SCRC-DALMATIAN by SCRC-TENEX with CHAOS; Wed 13-Apr-83 19:36:59-EST +Date: Wednesday, 13 April 1983, 19:38-EST +From: David A. Moon +Subject: ML doesn't like to talk to the Symbolics ethernet (and any future new subnets) +To: bug-its@MIT-MC +Cc: cmb@SCRC-VIXEN, bug-lispm@SCRC-TENEX + +Note the date on the second enclosed message. I guess if this continues +for another two months I'll find the time to do it myself. + + Date: Wednesday, 13 April 1983, 19:18-EST + From: Clark M. Baker + Subject: (load "ml:router;pi >") never works from a 3600 at Symbolics + To: BUG-LISPM at SCRC-TENEX + + I haven't been able to load files from ML onto a 3600 at Symbolics. + However, ML is up. I can load files from ML onto a LM-2 at Symbolics. + I can load files from ML onto MIT-PI. What is happening? + + + Date: 21 February 1983 20:49 EST + From: David A. Moon + Subject: ML + To: BUG-ITS @ MIT-MC + + I made NSUBNT (number of Chaosnet subnets) be a more reasonable size. + ML (the only ITS machine that does its own Chaosnet routing) should + get a reassembled ITS when convenient. + + + +Received: from SCRC-MYSTIC by SCRC-TENEX with CHAOS; Wed 13-Apr-83 19:34:50-EST +Date: Wednesday, 13 April 1983, 19:36-EST +From: David C. Plummer +Subject: (load "ml:router;pi >") never works from a 3600 at Symbolics +To: cmb@SCRC-VIXEN, BUG-LISPM@SCRC-TENEX, BUG-ITS@MIT-MC +In-reply-to: The message of 13 Apr 83 19:18-EST from Clark M. Baker + + Date: Wednesday, 13 April 1983, 19:18-EST + From: Clark M. Baker + + I haven't been able to load files from ML onto a 3600 at Symbolics. + However, ML is up. I can load files from ML onto a LM-2 at Symbolics. + I can load files from ML onto MIT-PI. What is happening? +I'll betchya ML's routing table isn't big enough. This has been CC'ed +to BUG-ITS so somebody will be annoyed it is in they're mailbox and fix +it (maybe me the next time I'm on MC). + +Date: 11 April 1983 06:39 EST +From: David C. Plummer +Subject: ARPA server +To: Ian @ MIT-OZ +cc: BUG-ITS @ MIT-MC + + Date: 10 Apr 1983 1954-EST + From: Ian Macky + + Is this ever going to work again? Would be nice to get Arpa FINGERs and + such things from us Chaos-only ("we'll be up in THREE weeks, for sure") + sites. + ------- +It should work. Try @DUP AI TCP. If you want the rest of +the world to respond to FINGER, you will have to convince them to +convert the NCP finger program to TCP, and also make sure +whatever user program you are using contacts the correct socket +number (I think the ARPA server wants it in octal, but i can't +remember). + +Date: 10 Apr 1983 1954-EST +From: Ian Macky +Subject: ARPA server +To: Bug-ITS@MIT-MC + +Is this ever going to work again? Would be nice to get Arpa FINGERs and +such things from us Chaos-only ("we'll be up in THREE weeks, for sure") +sites. +------- + +Date: 7 April 1983 23:13 EST +From: David C. Plummer +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 7 April 1983 17:26 EST + From: Alan Bawden + + DIRHNG^F acts pretty graceless. Actually I can imagine that DIRHNG could + reasonably display an informative directory. +...of what jobs have what directories open on the DIRHNG device. +If you need a test case, the Versatec spooler always has one open +on .glpr.. + +Date: 7 April 1983 17:26 EST +From: Alan Bawden +To: BUG-ITS @ MIT-MC + +DIRHNG^F acts pretty graceless. Actually I can imagine that DIRHNG could +reasonably display an informative directory. + +CSTACY@MIT-AI 04/05/83 11:58:45 +To: (BUG ITS) at MIT-AI +In ITS 1332, on MIT-AI: + +ITS crashed with the message PKT: Freeing packet still in use! +Dumped to AI:CRASH;ITS FREPKT + + +Date: Tue, 5 Apr 1983 04:45 EST +From: Leigh L. Klotz +To: Edjik +Cc: BUG-ITS@MIT-MC, BUG-MIDAS%OZ@MIT-MC, BUG-MIDAS@MIT-MC, BUG-OZ@MIT-MC, + KLH@MIT-MC +Subject: Gross OZ lossage +In-reply-to: Msg of Mon 4 Apr 83 11:41:35-PST from Edjik + +KLH knows more about midas than most people, including you. Please keep +your nitbrained views to yourself. + +Date: 5 April 1983 01:43 EST +From: Alan Bawden +Subject: Gross OZ lossage +To: MARTY @ MIT-OZ +cc: BUG-ITS @ MIT-MC, BUG-MIDAS @ MIT-MC, BUG-OZ @ MIT-MC, DCP @ MIT-MC, + KLH @ MIT-MC +In-reply-to: Msg of 4 Apr 1983 23:19 EST (Mon) from Martin David Connor + +What is all this flaming horseshit in my mailbox?!?! Is there anyone who +will argue that it was correct that there were TWO BUG-MIDAS mailing lists? +No. Have we fixed that? Yes. (Thank you Ian.) + +Now is there somebody out there who can actually claim to be maintaining +MIDAS to a greater extent than KLH? If so, then lets hear from them. If +not, then everyone shut the hell up. + +Date: 5 April 1983 00:57 EST +From: David C. Plummer +Subject: Gross 8 inch spikes in various people's heads +To: MARTY @ MIT-OZ +cc: BUG-ITS @ MIT-MC, BUG-MIDAS @ MIT-MC, BUG-OZ @ MIT-MC, KLH @ MIT-MC, + BUG-MIDAS @ MIT-OZ + +And you, Mr. Conner, have as much to learn as I. + +Reactionary is not bullshit. Go read a history book someday and +notice how progress is often achieved by reactionaries and their +ideas. + +As for the local history of OZ, there were several people willing +(and eager) to help in creating another ITS. Moon was willing to +hack microcode and oversee changes needed to the system (e.g., +for disk support) which I was willing to help with. As I recall, +you were against the idea of ITS on OZ. Several other people +attended the Wars of Futility where it was decided to run 20X. +These people warned about all the features that 20X was lacking +and many of the problems it had. But the wars were futile; the +decision was out of our hands. + +So now our only recourse is to sit back and be little brats about +the whole thing. "Nah, nah, I told you so..." I, for one, am +proud to be one of these brats. + + For god's sake bring up a machine because it is the Right Thing, not + because you hate another machine so much. +Wrong. Both are often true. In fact, this is how TWENEX was +developed. The history told to me was that BBN disliked Bots-10 so +much they went off and wrote TENEX. DEC started seeing the light +and bought it from them and made it work on a 20. + Learn from the mistakes of + another attempt, ... +If TWENEX only could. + + Plummer, ... until you learn to work FOR A GOAL instead of + AGAINST AN ALTERNATIVE you will be counterproductive to the + causes you Support. +Goal: Help build better Lisp Machines. I think I am working for +this goal. Goal: help MIT when I have the time. I think I do a +fair job here. Goal: convince people they lost completely when +they decided to run TWENEX on OZ. Perhaps this is a subconsious +goal. How actively I work toward it is not clear. I would hope +to think I keep such discussions among (ITS) friends except when +something blatant happens. If you didn't blindly defend the +obvious problems, OZ would probably be a lot nicer. + + Penny, I already know I will regret sending this, because so many + minds are already closed, but I had to try. Forgive me. +Mine is closed just enough so that spikes cannot penetrate. I +know who does the real TWENEX development at MIT, and they have +often responded to the requests of others for (ITS-like) +features. I hope they also understand the spirit in which I +write these flames. + +Marty, you earned your second spike. + +Date: 4 Apr 1983 23:19 EST (Mon) +From: Martin David Connor +To: David C. Plummer +Cc: "NCP.EGK@SU-GSB-HOW"@SU-SCORE, BUG-ITS@MIT-MC, BUG-MIDAS@MIT-MC, + BUG-MIDAS@MIT-OZ, BUG-OZ@MIT-MC, KLH@MIT-MC +Subject: Gross ITS lossage +In-reply-to: Msg of 4 Apr 1983 21:40 EST from David C. Plummer + + +Dogma, Plain and simple will be the downfall of ITS. +It contains the ideas and talent to be great, but lacks the tolerance +of other ideas that will see it wither and die. + +Most of what I have heard out of the ITS people is REACTIONARY +bullshit. A system is just a system, and the thing I can't understand +is why people that could design such beauty and generality can't +quietly bide their time until they get the hardware and then create +another system to show the world what is meant by winning. +I would be proud to help bring up a new ITS, I would be proud to help +bring up another 20, but not in a reationary spirit. +But rather for the love of the hack. + +For god's sake bring up a machine because it is the Right Thing, not +because you hate another machine so much. Learn from the mistakes of +another attempt, but don't be driven by hate and arrogance. + +Plummer, you may be able to hack 98% of the world into the ground, but +until you learn to work FOR A GOAL instead of AGAINST AND ALTERNATIVE +you will be counterproductive to the causes you support. + +Penny, I already know I will regret sending this, because so many +minds are already closed, but I had to try. Forgive me. + + +Date: 4 April 1983 21:40 EST +From: David C. Plummer +Subject: Re: Gross OZ lossage +To: "NCP.EGK@SU-GSB-HOW" @ SU-SCORE +cc: KLH @ MIT-MC, BUG-OZ @ MIT-MC, BUG-ITS @ MIT-MC, BUG-MIDAS @ MIT-MC, + BUG-MIDAS @ MIT-OZ + +OZ is the successor to AI in hardware but not in spirit. I hope +every program you use that was derived from ITS or is assembled +in MIDAS breaks. I sometimes wish TOPS-20 were orificially +shovable... + +Received: from GSB-HOW with Pup; Mon 4 Apr 83 11:42:17-PST +Date: Mon 4 Apr 83 11:41:35-PST +From: Edjik +Subject: Re: Gross OZ lossage +To: KLH@MIT-MC +cc: BUG-OZ@MIT-MC, BUG-ITS@MIT-MC, BUG-MIDAS@MIT-MC, BUG-MIDAS%OZ@MIT-MC +In-Reply-To: Your message of Mon 4 Apr 83 13:53:00-PST + +Gosh, I wonder just how many people on the 6 mailing lists that KLH +shotgunned his msg to really give a ff about where the MIDAS sources +live. Probably damn few. Oz is the successor to AI. Moving mailing +lists and sources of system programs to it from AI seems natural to me. +Since KLH got the msg Ian sent, he still is on the new offical list at +oz, so why gripe? His talk of "sacrilege" conjures up images of the +inquisition. Is KLH the defender of the ITS faith? Probably KLH's main +gripe is that he hates TOPS-20 and is pissed at having to goto a TOPS-20 +site to look at the sources. If he uses it for TOPS-20 and 10X +software, why does he need it on ITS? + +I hope the people in charge of the MIDAS mailing list and sources +do the appropriate thing in response to KLH's flame, ie. ignore it. + +-- Edjik +------- + +Date: 4 Apr 1983 15:31 EST (Mon) +From: Ian Macky +To: Ken Harrenstien +Cc: BUG-ITS@MIT-MC, BUG-MAIL@MIT-MC, bug-mail@MIT-OZ, BUG-MIDAS@MIT-MC, + BUG-OZ@MIT-MC +Subject: Gross OZ lossage +In-reply-to: Msg of 4 Apr 1983 13:53 EST from Ken Harrenstien + +Hmm. Since you obviously have strong feelings about this, and since +that mailing list was screwed up by their being two parallel versions +(one on OZ and one on AI), I have done as you asked (insisted) and +merged the two and put the now official list on MC, with appropriate +pointers all around. + +Date: 4 April 1983 13:53 EST +From: Ken Harrenstien +Subject: Gross OZ lossage +To: BUG-MAIL @ MIT-MC, BUG-OZ @ MIT-MC, BUG-MIDAS @ MIT-MC, + BUG-ITS @ MIT-MC, bug-midas @ MIT-OZ, bug-mail @ MIT-OZ + +I just got a message at SRI-NIC which IAN sent to BUG-MIDAS at OZ. +This implies that OZ has a BUG-MIDAS mailing list, and furthermore +that this list is NOT the same as the official list on AI. + +This reminds me of the BUG-ATSIGN lossage. + +I consider myself one of those people who now and then maintain MIDAS. +For the list to be moved without notice is reprehensible. For it to +not be on an ITS is sacrilege. I must insist that either AI or MC +be the official home of MIDAS sources and mailing lists. This +should probably apply to all ITS developed software. Since I was the +person who did the TENEX/TOPS-20 conversion for MIDAS, and regularly +use it for 10X/20X software, you can hardly say my viewpoint is +wedged. + +Date: 4 April 1983 10:26 EST +From: Gail Zacharias +Subject: [JMSK: forwarded] +To: BUG-ITS @ MIT-MC + +Date: 04/03/83 10:19:53 +From: JMSK + +SOMETHING VERRY WEird yust happened. I logged in as usual, the initfile ast +me if I was on an H-19 to which I responded, as usual, in the affirmative, +as usual. Now , if you've been following my exploits with the SUPERROM, you +will recall that I keep my terminal in VT-100 mode, and let my INITfile change +it to an H-19 when I log in (wait, it gets better). Well today, for the first +time, I noticed my MODELINE said: + + IWASA VT100 VT100 + +and I was verrrry impressed ! I mean somehow ITS, with nothing in my Initfile +to tell it, figured out that my terminal WAS A VT-100 (get it ? + + I WAS A VT-100 !!!!! ) + +THEN I GOT SUSPICIOUS, so I did a USERS, and discoverd: +Yukizaku IWASA logged in thru a CRTSTY VT100 !!!!!!!!!!! +The funny thing is, that's all my modeline shows !!! not MY job, even now, +but IWASA VT100 !!!!!!!!!!!!!!!!!!!!!!!!! (in HANG state) + + weird, huh ? + +Date: 3 Apr 1983 1502-EST +From: P. David Lebling +Subject: Re: ARC device directories +To: CSTACY@MIT-MC, BUG-ITS@MIT-MC +In-Reply-To: Your message of 19-Mar-83 2245-EST + +DIRED (not EMACS DIRED) and FIND depend on it. +------- + +Date: 3 April 1983 01:59 EST +From: Steven A. Swernofsky +To: BUG-ITS @ MIT-MC + +The annoying 15-second (?) pause in output has returned! -- Steve + +Date: 1 April 1983 02:13 EST +From: Christopher C. Stacy +Subject: take paws off keys and wait +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, JSPEAR @ MIT-AI + + Date: 1 April 1983 01:04 EST + From: Alan Bawden + To: JSPEAR at MIT-AI + cc: BUG-ITS at MIT-AI + Re: take paws off keys and wait + + JSPEAR@MIT-AI 04/01/83 00:21:35 + To: (BUG ITS) at MIT-AI + :FINGER seems to respond with 'No users' when there are AI users, + and :FINGER UNAME gives last logout time even if UNAME is currently + on the system. + +I put up a new ITS where the main source version number had not changed, +and forgot to dump out some of the random programs. + +Date: 1 April 1983 01:04 EST +From: Alan Bawden +Subject: take paws off keys and wait +To: JSPEAR @ MIT-AI +cc: BUG-ITS @ MIT-AI +In-reply-to: Msg of 04/01/83 00:21:35 from JSPEAR@MIT-AI + + JSPEAR@MIT-AI 04/01/83 00:21:35 + To: (BUG ITS) at MIT-AI + :FINGER seems to respond with 'No users' when there are AI users, + and :FINGER UNAME gives last logout time even if UNAME is currently on the + system. + +I dumped out a new finger on AI which seems to have fixed the problem. I +never did find out just what was damaged about the old one.. + + +JSPEAR@MIT-AI 04/01/83 00:21:35 +To: (BUG ITS) at MIT-AI +:FINGER seems to respond with 'No users' when there are AI users, +and :FINGER UNAME gives last logout time even if UNAME is currently on the +system. + + +Date: 31 March 1983 02:27 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: GSB @ MIT-MC, ELLEN @ MIT-MC, JPG @ MIT-MC + +AI, MC, and DM are running the latest version of ITS 1332. +I reshuffled the version names and cards: NITS is what you +want, and ITS is older. XITS is mostly GCd and not what you want. +I'll do this for ML tonite or tomorrow. AI and DM have some more +STYs (number doubled on DM). Also, latest COMSAT is installed +all around. + +Date: 31 March 1983 00:01 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Increased number of STYs on AI and DM. + +Date: 29 March 1983 00:10 EST +From: David A. Moon +Subject: MLSLV bug +To: RWK @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 28 March 1983 21:14 EST + From: Robert W. Kerns + To: BUG-ITS @ MIT-MC + + There are some MLSLV's on MC which are spending much of their time in WHYINT, + and eating lots of CPU. Presumably they should be killing themselves, as + part of network error handling or something. + +I fixed this, killed the jobs, and installed the new version everywhere. +There were actually several bugs. + +Date: 29 March 1983 00:09 EST +From: David A. Moon +To: BUG-ITS @ MIT-MC + +I gunned down about 5 arc devices that were hung in BOJSO with +their creator (an FTP server) no longer in existence. + +Date: 28 March 1983 21:14 EST +From: Robert W. Kerns +To: BUG-ITS @ MIT-MC + +There are some MLSLV's on MC which are spending much of their time in WHYINT, +and eating lots of CPU. Presumably they should be killing themselves, as +part of network error handling or something. + +Date: 28 March 1983 21:05 EST +From: Robert W. Kerns +To: BUG-ITS @ MIT-MC + +I just found a detached 340C23 CHAOS job which appears to have gotten +an ILOPR because it couldn't set its JNAME to MAIL, since +there already seemed to be a job with that name. It doesn't +look like ot checks for this possibility at all, but given +that both the chaos address and job number parts of the UNAME +are truncated, it should certainly have some strategy for dealing +with this, like AOSing the UNAME or JNAME or something. + +Date: Wednesday, 23 March 1983, 23:49-EST +From: Robert W. Kerns +Subject: thought for the day +To: George J. Carrette +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 22 Mar 83 01:15-EST from George J. Carrette + + Date: 22 March 1983 01:15 EST + From: George J. Carrette + Taking a word frequency analysis of SYSENG;HOSTS >, we get the top ten + "words" as: + + (522. HOST) (276. SERVER) (231. USER) (226. LISPM) (222. CHAOS) (205. PDP) + (171. MIT) (157. UNIX) (102. VAX) (100. TAC) + +Out of curiosity, I measured (88. SCRC^_SCH^_SPA). I guess we won't make the +top ten until sometime this summer. + +This argues for domains, of course. + +ZOMBIE@MIT-AI 03/22/83 14:48:23 +To: (BUG ITS) at MIT-AI +AI will not accept MC or ML as devices although it does make supdup +connections. Just thought someone might like to know... +Sean + + +Date: 22 March 1983 01:15 EST +From: George J. Carrette +Subject: thought for the day +To: BUG-ITS @ MIT-MC + +Taking a word frequency analysis of SYSENG;HOSTS >, we get the top ten +"words" as: + +(522. HOST) (276. SERVER) (231. USER) (226. LISPM) (222. CHAOS) (205. PDP) +(171. MIT) (157. UNIX) (102. VAX) (100. TAC) + + +Date: 21 March 1983 06:24 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +New PEEK and DDT installed on all four machines. + +CSTACY@MIT-AI 03/21/83 02:59:59 Re: AI uptime +To: (BUG ITS) at MIT-AI +I am gonna have to bring it down to install the latest ITS version, +so before I do... + +Today is Monday, the 21st of March, 1983. +AI ITS 1325 has run for 16 days, 3 minutes, 11 seconds. +System last revivde 15 days, 20 hours, 54 minutes, 59 seconds ago. + + +Date: 19 March 1983 22:56 EST +From: David A. Moon +Sender: ALAN @ MIT-MC +Subject: job device wedged on MC +To: BUG-ITS @ MIT-MC + +The created job was in JOBREU, hung at NJBREU+4 waiting for JBCG +to clear. Previously it had pclsred from NJBRU1+7. The creator +was hung in OPEN, at JBFLS, presumably trying to reuse it. Pclsring +the creator caused it to start a new device job and the old one +to go away. Looks to me like just an inherent race in the code, +although there were multiple jobs trying to use the same AI: device. +Maybe I'll look at the code more some other time. + +Date: 19 March 1983 22:45 EST +From: Christopher C. Stacy +Subject: ARC device directories +To: BUG-ITS @ MIT-MC + +What programs (other than ARCDEV) depend on understanding +the binary representation of the internal directory? + +Date: 18 March 1983 12:33 EST +From: Ken Harrenstien +Subject: INQUIR vs DDT +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC, BUG-INQUIR @ MIT-MC, + RWK @ SCRC-TENEX + + Fixed in DDT.1430, installed on MC. + + I think what was going on was that it was failing to map in the + database (probably out of file channels to open it with, since a + broken TARAKA DVRSPL had them all). + +No, actually it was failing because the LSR1 file was smashed for +real. I don't know why, but it was definitely munged. I fixed by +copying the old version back over. + + DDT's LSRMAP now has an error return. All of it's callers seemed + to be interested in finding out someone's HSNAME; I made them do + something reasonable to fake it. + +That's the right thing from user prog viewpoint, since LSRMAP could fail +no matter how cleverly it tries to find a good version. It should try +harder, though. + +Date: 18 March 1983 05:11 EST +From: Christopher C. Stacy +Subject: MLDEV +To: BUG-ITS @ MIT-MC + +I reassembled the latest MLDEV on MC. +I think it wasnt using HOSTS3 or something, since it wasnt +doing anything useful. I think it works now; so I installed it. + +Date: Friday, 18 March 1983, 04:40-EST +From: Christopher C. Stacy +Subject: INQUIR vs DDT +To: Robert W. Kerns +Cc: Ken Harrenstien , BUG-INQUIR at MIT-MC, + BUG-ITS at MIT-MC, BUG-DDT at MIT-MC +In-reply-to: The message of 18 Mar 83 00:48-EST from Robert W. Kerns + + Date: Friday, 18 March 1983, 00:48-EST + From: Robert W. Kerns + Date: 16 March 1983 18:36 EST + From: Ken Harrenstien + I think it is really bad for DDT to refuse to work just because it can't + look up a name in INQUIR. This is just too much dependence; if we cant + get a DDT to work then we are shafted, but good. + DDT isn't supposed to not work in any serious way if the INQUIR + database is trashed. It shouldn't lose any more seriously than + failing to find your home directory. If it won't let you log in, + that's a bug. The only other probable loser I can think of is :PRMAIL. + I don't think that not working is serious. + +Fixed in DDT.1430, installed on MC. + +I think what was going on was that it was failing to map in the +database (probably out of file channels to open it with, since a +broken TARAKA DVRSPL had them all). + +DDT's LSRMAP now has an error return. All of it's callers seemed +to be interested in finding out someone's HSNAME; I made them do +something reasonable to fake it. + +Date: Friday, 18 March 1983, 00:48-EST +From: Robert W. Kerns +Subject: INQUIR vs DDT +To: Ken Harrenstien +Cc: BUG-INQUIR at MIT-MC, BUG-ITS at MIT-MC, BUG-DDT at MIT-MC +In-reply-to: The message of 16 Mar 83 18:36-EST from Ken Harrenstien + + Date: 16 March 1983 18:36 EST + From: Ken Harrenstien + I think it is really bad for DDT to refuse to work just because it can't + look up a name in INQUIR. This is just too much dependence; if we cant + get a DDT to work then we are shafted, but good. +DDT isn't supposed to not work in any serious way if the INQUIR +database is trashed. It shouldn't lose any more seriously than +failing to find your home directory. If it won't let you log in, +that's a bug. The only other probable loser I can think of is :PRMAIL. +I don't think that not working is serious. + +Date: 16 March 1983 18:36 EST +From: Ken Harrenstien +To: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Considering how many things break totally when the INQUIR data base is +corrupted, I would suggest that LSRTNS try to map in LSR1 OLD (ie previous +version or versions) if it runs into problems with the standard file. +Furthermore, INQUPD should try to make sure the existing file is OK before +it renames it to LSR1 OLD. + +I think it is really bad for DDT to refuse to work just because it can't +look up a name in INQUIR. This is just too much dependence; if we cant +get a DDT to work then we are shafted, but good. + +Date: Wednesday, 16 March 1983, 15:30-EST +From: Christopher C. Stacy +Subject: DIR device +To: John G. Aspinall +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 16 Mar 83 13:31-EST from John G. Aspinall + + Date: 16 March 1983 13:31 EST + From: John G. Aspinall + The DIR device seems to be permanently getting device-full errors. + + This happens from emacs dired and from various flavours of top level + invocation - ie DIR:CDATE UP , DIR:RDATE DOWN, etc. + +MC is probably permanently overloaded, and has no job slots for +the device handlers for DIR: ....it works fine for me when there +are available job slots. + +Date: 16 March 1983 13:31 EST +From: John G. Aspinall +Subject: DIR device +To: BUG-ITS @ MIT-MC + +The DIR device seems to be permanently getting device-full errors. + +This happens from emacs dired and from various flavours of top level +invocation - ie DIR:CDATE UP , DIR:RDATE DOWN, etc. + +Date: 13 March 1983 06:43 EST +From: Alan Bawden +Subject: TTYFLS problem +To: BUG-ITS @ MIT-MC +cc: BUG-EMACS @ MIT-MC, CSTACY @ MIT-MC, KMP @ MIT-MC + +TTYFLS, with it's single control bit set to 0, simply sets %TXIGN in the +character in question. Unfortunately this causes .LISTEN to lie about the +availability of input characters. + +Since EMACS won't redisplay if it thinks there are characters to be read, +this is one way to cause an EMACS to fail to redisplay when proceeded. I +don't think this exact screw can explain the mysterious "CStacy's lossage". +Few programs probably use TTYFLS and even fewer with that control bit set +to 0. But perhaps something else can cause .LISTEN to lie? (Does the +MODLIN package do anything bizare?) + +Date: 13 March 1983 06:36 EST +From: Ken Harrenstien +Subject: New TELNET installed +To: BUG-ITS @ MIT-MC, BUG-TELNET @ MIT-MC + +I installed a new TELNET which fixes some throughput problems. +In particular, one should not become hung waiting for typein to +reach the remote host, and thus output will continue to be +displayed and it should always be possible to break into command +mode. + +Date: 9 March 1983 17:17 EST +From: David A. Moon +Subject: .CALL 0, [ not SETZ ] +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 8 March 1983 15:39 EST + From: Ken Harrenstien + + Is it the right thing that .CALLs which point to a non-SETZ word + get an ILOPR instead of failing to skip? + +This is left over from about ten years ago, I believe, when that +was going to be used for some kind of dynamic linking of subroutines. +However, it is probably still right for it to ILOPR. + +Date: 9 March 1983 03:54 EST +From: Ken Harrenstien +Subject: New ITS +To: CSTACY @ MIT-MC, ELLEN @ MIT-MC, JPG @ MIT-MC, TY @ MIT-MC, + DCP @ MIT-MC, moon @ SCRC-TENEX +cc: KLH @ MIT-MC, BUG-ITS @ MIT-MC + +New XITS (1329) installed on MC. Old XITS renamed to ITS. There is +no NITS. This version has a subtle change in SALV; SALV now starts at +212000 instead of 200000, in order to make room for extra ITS code! +.;SALV 306BIN is the version that has this relocation hacked; SALV BIN +still points to the old version. All future ITSes generated for MC must +use SALV 306 or higher. + +This version of ITS tries to implement TCP URGENT handling for +direct-connected STYs. I haven't tested it yet. All the known +patches have also been incorporated; if I missed any we'll probably +know about it pretty soon. The most important change is basically +the one to SALV, since the 200000 address has always been hard-wired +that way and there may conceivably be some ancient software that +is in for a rude shock. There are no plans to change this for +the KA ITSes at the moment. + +Date: 8 March 1983 22:54 EST +From: Alan Bawden +Subject: ILOPR? +To: DCP @ MIT-MC, KLH @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: The message of 8 Mar 1983 20:44 EST from David C. Plummer + +I was about to point out that there is already an error code for one +variety of malformed .CALL, %ENSCL (illegal system call name). Except I +find that the following: + + .CALL [SETZ ? SIXBIT /FOOBAR/ ? %CLERR,,1 ? SETZ 2] + +Fails to skip, yet also fails to load 1 with any error code (it does not +even clear it.) The left half of .IOS 0 is loaded with %ENSCL however, so +is is possible to find out the error if you look hard enough. I'll bet the +idea is that if the first two words in a call block don't clearly identify +it as such, then ITS has no business looking at the next word and using it +to trash some other random location in the user's address space. + +Now that is all fine and good if the instruction following the .CALL is a +.LOSE, since DDT will be able to figure it all out, but if instead there +was a JRST to a error reporting routine, I'll bet total randomness would +result from using the garbage left in 1 as an error code. I guess I have +never been so unlucky as to misspell the name of a system call in a .CALL +that I was planning on handling the errors from myself. I would argue that +THIS case should be made an ILOPR as well! + +Another kind of malformed call block, namely one that doesn't terminate +with a word with bit 4.9 on, generates %ETMRG (too many arguments). Since +this error is NOT a function of which call was named in the call block, it +really can only be interpreted as meaning "malformed call block". However +it seems that ITS thinks that such call blocks are well-formed enough to +actually risk storing the error code in any supplied error parameter. +Since convention is to write error parameters at the beginning of a call +block, I think this is reasonable. + +Funny, when I started this message I was planning on agreeing with KLH, but +I seem to have convinced myself that DCP is right. + +Date: 8 March 1983 20:44 EST +From: David C. Plummer +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I think ILOPRing is the right thing. One argument is to +enumerate the common system calls and observe the effect of +changing it. My first impression is a change would cause subtle +bugs, especially during debugging (where I'd insist on ILOPR if I +programmed it incorrectly). Another argument is philosophy: +non-SKIP means failure to perform the desired operation. ILOPR +means failure to perform the desired instruction. You can't have +an operation before you have an instruction. + +Date: 8 March 1983 18:18 EST +From: Christopher C. Stacy +Subject: for installation +To: BUG-ITS @ MIT-MC + +New PEEK on all machines in SYSBIN;PEEK 565BIN. + +Date: 8 March 1983 15:39 EST +From: Ken Harrenstien +To: BUG-ITS @ MIT-MC + +Is it the right thing that .CALLs which point to a non-SETZ word +get an ILOPR instead of failing to skip? Currently the only +thing which uses .CALL 0, is the symbolic system call frob, and +presumably if any new secondary dispatch is invented for it (ie +something other than SETZ as 1st word pointed at) it could also +be made the sort of call that skipped on success. + +(this came up because a botched net server had a bad .CALL arg and +was ILOPR'ing instead of getting a failure return which would have +cleaned up the resulting mess) + +Date: 7 March 1983 04:18 EST +From: David A. Moon +Subject: Autospeed dialups and system crashes +To: ED @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 7 February 1983 00:37 EST + From: Ed Schwalenberg + Subject: Autospeed dialups and system crashes + To: BUG-ITS @ MIT-MC + + If MC goes down and comes back up, and I've patiently remained dialled + up while it was down, it typically types out 30 or so "x" characters and + then just stays wedged, probably waiting for 300 baud input as opposed to + 1200 baud which is what I normally use. I guess optimal behavior would be + for the 11 to remember the baud rate and tell the 10 when it comes back up, + while suboptimal behavior would be to flush the 11's input buffer and then + retry autospeeding. Lousy behavior would be to hang up on the user. But + the current behavior is just about pessimal. +I don't know why it does this, since autospeeding and baud rates and all +of that are entirely inside the 11; the 10 has nothing to do with it. +But maybe someone gratuitously reloaded the 11, or maybe KLDCP did a Unibus +reset or something?? Also I'm pretty sure the baud rate is set to 1200 +when the program is first loaded, before autospeeding. I remember that +a couple of years ago I tried to debug this and couldn't. + +Date: 7 March 1983 02:59 EST +From: David A. Moon +Subject: terminal question +To: GZ @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 5 March 1983 22:43 EST + From: Gail Zacharias + + Is there anyway I can tell ITS to send parity bit high always (on dialup line). + I'm getting a lot of framing errors and I figure this might help. +On MC only, you can set all these parameters with :LSPEED. You want +to turn on extra stop-bit, and then presumably set the character length +one bit shorter to compensate. + +Date: 5 March 1983 22:43 EST +From: Gail Zacharias +Subject: terminal question +To: BUG-ITS @ MIT-MC + +Is there anyway I can tell ITS to send parity bit high always (on dialup line). +I'm getting a lot of framing errors and I figure this might help. + +Date: 5 March 1983 00:44 EST +From: Christopher C. Stacy +Subject: AHA! +To: KMP @ MIT-MC +cc: ALAN @ MIT-MC, DCP @ MIT-MC, KLOTZ @ MIT-MC, BUG-ITS @ MIT-MC + + +When I use my Emacs init, Emacs does not redisplay after I type a +character after a %PIATY interrupt. Things seem to work fine if I +remove MODLIN from my init. Is it likely this will get fixed? I +think MODLIN is spiffy, but I really hate having to refresh my own +screen under these circumstances. + +Date: 4 March 1983 02:16 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC, BUG-EMACS @ MIT-MC +cc: MOON @ SCRC-TENEX + + +Hey, it looks to me like EMACS forgot to know to redisplay when I type +something after my screen has been bashed (got-back-the-tty interrupt). +Did someone break TECO, or ECHOIN, or am I hallucinating? + +Date: 26 February 1983 20:29 EST +From: Michael A. Bloom +To: BUG-ITS @ MIT-MC + +I just connected to DM through the arpanet, and got a DDT instead of a PWORD. + +Date: Thursday, 24 February 1983, 22:41-EST +From: David C. Plummer +Subject: Those mythical chaos BRD packets +To: network at scrc, bug-lispm at oz, bug-its at mc, bug-twenex at xx, + chaos-ncp-people at mc, bug-minits at mc, unix-chaos at vx, + mit-in-people at mc + +I implemented chaos BRD packets in MINITS today. They seem to work. + +I also hacked some code for the Lisp Machine to actually test it, but it's +just as gross and ugly as the rest of the current LispM chaos +implementation. + +Date: 22 February 1983 10:24 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +slightly less crockish WHOJ installed on MC, ML, and AI. +Bugs to me. + +Date: 21 February 1983 20:49 EST +From: David A. Moon +Subject: ML +To: BUG-ITS @ MIT-MC + +I made NSUBNT (number of Chaosnet subnets) be a more reasonable size. +ML (the only ITS machine that does its own Chaosnet routing) should +get a reassembled ITS when convenient. + +Date: 19 February 1983 20:11 EST +From: Christopher C. Stacy +Subject: [KLH: forwarded] +To: BUG-ITS @ MIT-MC +cc: ELLEN @ MIT-MC, BUG-PWORD @ MIT-MC, KLOTZ @ MIT-MC, GREGOR @ MIT-MC + + +I see KLH already fixed the safe site problem by reassembling +PWORD, so now it uses the same NETWRK goodies as TELSER. + +Date: 19 February 1983 20:07 EST +From: Christopher C. Stacy +To: EBM @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: The message of 18 Feb 1983 20:34 EST from J. Eliot B. Moss + + Date: 18 February 1983 20:34 EST + From: J. Eliot B. Moss + To: BUG-ITS + + I CHTN'ed from XX and had MC request my password ... has the interface + changed or is something screwy going on? I thought logins from other + MIT machines did not require passwords ... + +TELSER apparently has a bug putting the host address where PWORD can +see it, (or maybe PWORD needs to see a different format host address). +I will look at and fix this in a moment. + +Date: 19 February 1983 15:47 EST +From: Kent M. Pitman +Subject: MC crashing +To: BUG-ITS @ MIT-MC, JPG @ MIT-MC, ELLEN @ MIT-MC + +MC was down this morning when I came in. Someone cold booted it and it only +lasted a few minutes. He was in the midst of cold booting it when I came in +to look at it just now, so I finished the booting. Next time it crashes, I'll +try to poke a bit at the state and provide some debugging info. I posted +a system message (in SYS;SYSTEM MAIL) warning that the system was being +unreliable. If it stays up for a while, someone might want to remove that +message. --kmp + +Date: 19 February 1983 15:22 EST +From: Tom Knight +To: BUG-ITS @ MIT-MC + +MC would not boot from disk this afternoon, because it was hung, probably +at PI level 3, shlunking unit 1 back and forth. Apparently booting +with the boot switch is incapable of stopping the processor??? Eventually, +by turning off unit 1, I got the machine to crash, and it then booted. This +seems less than elegant as a way of solving the problem. + +Date: Friday, 18 February 1983 22:05-EST +Sender: KLOTZ @ MIT-OZ +From: Leigh L. Klotz +To: J. Eliot B. Moss +Cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 18 Feb 1983 20:34 EST from J. Eliot B. Moss + +Gregor and I noticed this from cadr-20, which was a good site. Maybe +someone broke the password system recently? +Leigh. + +Date: 18 February 1983 20:34 EST +From: J. Eliot B. Moss +To: BUG-ITS @ MIT-MC + +I CHTN'ed from XX and had MC request my password ... has the interface +changed or is something screwy going on? I thought logins from other +MIT machines did not require passwords ... + +Date: 18 February 1983 08:16 EST +From: Ken Harrenstien +Subject: NETWRK and friends use HOSTS3 now +To: BUG-ITS @ MIT-MC, BUG-TELNET @ MIT-MC, BUG-PEEK @ MIT-MC, + BUG-NETWRK @ MIT-MC, BUG-MAIL @ MIT-MC, BUG-FTP @ MIT-MC + +I decided to do a little work on credit tonight. + +SYSENG;HOSTS XFILE now generates SYSBIN;HOSTS3 BIN as well. This is the + new Internet host table and it is intended to become the standard. + Both HOSTS1 and HOSTS2 will eventually go away. +SYSENG;NETWRK has a new switch, $$HSTS3, that tells the routines to use + HOSTS3 instead of HOSTS2. Also, the host number parser has + been taught how to understand the new 4-octet syntax, as + in "10.3.0.44" which is MC. +TELNET has been modified to use the NETWRK routines (HOSTNM and + SYMGET and friends). As a result, TELNET uses HOSTS3 and + no longer needs HOSTS1. Hurray!!!!!!!!!!!!!!!! + This of course implies that TELNET parses anything NETWRK does. + The big question: is there ANY other software that still depends + on HOSTS1?? I am going to flush that table VERY soon. +HOST (alias HSTLOK) has likewise been modified for HOSTS3. +TELSER also uses HOSTS3. +PEEK now uses HOSTS3. +COMSAT now uses ... +QMAIL now ... +FTPS now ... +FTPU ... (All on MC only for the moment) + +Not a bad night's work. Ka-ching! + +There are still a number of programs that need to have $$HST3 turned +on. The only thing you need to be careful of is references to NW$BYT +and NW%ARP or NW%CHS; it is better to use the GETNET macro than +NW$BYT. The file format itself is almost the same; only the format +of host and net addresses is different. Note that ITS will understand +either HOSTS2 or HOSTS3 format, using either NCP or TCP, so there is +no need to retain HOSTS2 even if you are keeping NCP code around for +posterity (which I recommend, by the way). + As you upgrade, try to add a note to NETWRK pointing at your +software, (see the first page) so that eventually we will have a handy +list of things that use NETWRK and which will need to be reviewed in +the event of future changes. + +--Ken + +Date: 16 February 1983 21:04 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Hack :WHOJ installed on all ITSs now. + +Date: 16 February 1983 08:27 EST +From: Ken Harrenstien +Subject: New PEEK on MC +To: BUG-PEEK @ MIT-MC, BUG-ITS @ MIT-MC +cc: RWK @ MIT-MC, HIC @ MIT-MC, EJS @ MIT-MC, RL @ MIT-MC, RLB @ MIT-MC, + EBM @ MIT-MC + +I have installed another new PEEK on MC for testing. +One feature of this version is that it does away with the stupid +internal table that gave certain people (who are CC'd above) J mode +by default. Those people who cannot type :P J can just type :PJ +or PJ^K, if they establish the necessary link to SYS;TS PEEK. + +A more interesting feature is the ability to PEEK at ITS crash dumps. +This must be invoked as JCL, to wit ":PEEK < filename". For example, + :P +Subject: I know this is a crock +To: BUG-ITS @ MIT-MC +cc: BUG-TALK @ MIT-MC + + +There is now a crock version of TALK (WHOJ & friends) +installed on MC and AI. If no one complains to much +I will install it on ML and DM later on. + +This is not an RSEXEC frob at all, but a quick +dirty hack based on the MLSLV (it reads TTY:). + +When I get a chance, I will convert TALK and IEC to +work with TCP, but this was driving me crazy so I +wrote this interim crock. + +Chris + +Date: 15 February 1983 07:18 EST +From: Ken Harrenstien +To: BUG-ITS @ MIT-MC + +I just noticed that the :DOC for RFNAME doesn't mention that +it can take a 3rd argument which is a BP to place to deposit an +ASCIZ filename string. + +Date: 13 February 1983 19:13 EST +From: Kent M. Pitman +Subject: Can somebody answer this? +To: BUG-ITS @ MIT-MC + +Date: 12 February 1983 15:02 mst +From: Schauble.HDSA at M.PCO.LISD.HIS +To: KMP +Re: ITS archive files +Received: from M.PCO.LISD.HIS by MIT-MULTICS.ARPA dial; 12-Feb-1983 17:03:33-est + +I'm looking for a way to transfer ITS archive files to Multics and have +them arrive as Multics archives files. I recall that someone once wrote +a program to do this. Do you perchange know anything about it? + +If not, do you have any documentation on the archive file format so that +I can write one? I have no problem transfering a binary image of the ITS +file, I just need to decode it. + + Thanks, + Paul + +Date: 13 February 1983 12:04 EST +From: Ken Harrenstien +To: BUG-PEEK @ MIT-MC, BUG-ITS @ MIT-MC + +New peek written to SYS;TS PEEK on MC only. +If no bugs surface after a few days, it can be copied to other systems. + +CSTACY@MIT-AI 02/11/83 14:07:04 +To: (BUG ITS) at MIT-AI +AI now has config options set for no 10-11 frobs such as the Chaosnet. +This seems to work, I am typing this from it. +I finished installing the MLDEV stuff here. + + +Date: 10 February 1983 06:54 EST +From: David C. Plummer +Subject: TCP NAME user/server +To: BUG-ITS @ MIT-MC, BUG-NAME @ MIT-MC, BUG-TCP @ MIT-MC +cc: DCP @ MIT-MC, CSTACY @ MIT-MC, KLH @ MIT-MC, CENT @ MIT-ML + +Let's see if I can remember everything I just did. + +For MC: + +I linked DEVICE;JOBDEV AI to the same thing DEVICE;JOBDEV DM +points to (SYSBIN;MLDEV BIN). This caused AI to appear as a +device. ML's and DM's DEVICE directories are consistent (and +hopefully have the correct programs). + +For AI: + +I installed the TCP NAME user/server program. :F @AI from MC now +works. :F @MC from AI does not because AI tries to use the +chaosnet!!??!!. The host table on AI says it is arpanet only, +but apparently the system still has chaos code assembled in. +:F @DM from AI does work. + +I tried to make sure the user ITS JOBDEVs were correct. MC:... +doesn't work, again because it tries to use the chaosnet. DM: +does work though. + +CSTACY, you should revise AI's greeting message (about MLSLV +services), clean up any mess I may have left around, and perhaps +assemble AI without chaosnet code (if that is the right thing). + +Date: 7 February 1983 13:00 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +there is now a kludge in NETWRK for $$TCP inserters +who bomb into ANALYZ, cuz I was getting bored with ISE0. +I (or someone) should write a real TCP analyzer frob for it sometime. + +CENT@MIT-ML 02/07/83 01:37:39 Re: TCP NAME user/server +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-ML, (BUG NAME) at MIT-ML, (BUG TCP) at MIT-ML +CC: KLH at MIT-MC + Date: 6 February 1983 04:09 EST + From: David C. Plummer + Subject: TCP NAME user/server + To: KLH @ MIT-MC + cc: BUG-ITS @ MIT-MC, BUG-NAME @ MIT-MC, BUG-TCP @ MIT-MC + + I made the ITS name user and name server work under TCP. I made some + spazzes, and there was a NCP/TCP difference causing a little more + lossage. + .... + I installed and pdumped this on MC, ML and DM (what's going on with + AI?). I tested it between MC and DM (both directions) and ML and DM + (both directions). Source is back in SYSEN2; (whence it came). + +ai was down with minor disk lossage. please try installing now.. + +Date: 7 February 1983 00:37 EST +From: Ed Schwalenberg +Subject: Autospeed dialups and system crashes +To: BUG-ITS @ MIT-MC + +If MC goes down and comes back up, and I've patiently remained dialled +up while it was down, it typically types out 30 or so "x" characters and +then just stays wedged, probably waiting for 300 baud input as opposed to +1200 baud which is what I normally use. I guess optimal behavior would be +for the 11 to remember the baud rate and tell the 10 when it comes back up, +while suboptimal behavior would be to flush the 11's input buffer and then +retry autospeeding. Lousy behavior would be to hang up on the user. But +the current behavior is just about pessimal. +Obviously this is low-priority, though if somebody was to volunteer to fix +the symptom by simply having MC never go down I'm sure they'd get a penny +from JM. I'd be willing to give them a quarter, myself! + +Date: 6 February 1983 04:09 EST +From: David C. Plummer +Subject: TCP NAME user/server +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-NAME @ MIT-MC, BUG-TCP @ MIT-MC + +I made the ITS name user and name server work under TCP. I made +some spazzes, and there was a NCP/TCP difference causing a little +more lossage. + +Spazz 1: I completely blew it when doing the NETBLK for the LSN. + I gave it %NSRFS as the wait state. A lot of good that does!! +Spazz 2: I didn't know that a NETBLK for the LSN would probably + return the new state as %NSRFC. There is another NETBLK + waiting for it to go out of %NSRFC. +Spazz 3: The /i switch (use IP/TCP) simply could not work. There + is a comment to this effect in the code. Basically, :f /i@dm + passes the /i on to DM, and :f @dm/i throws the /i away (this + is conjecture, but seems to fit the data). Therefore, it + always uses TCP over the arpanet. + +Difference: NCP didn't need a FORCE done to send the JCL to the + other host? I know TCP does, but there was now such call in + the program. There is now! + +I installed and pdumped this on MC, ML and DM (what's going on +with AI?). I tested it between MC and DM (both directions) and +ML and DM (both directions). Source is back in SYSEN2; (whence it +came). + +Ken, I know several people complained that ITS thought it had a +TCP NAME server but it never worked. Could you ask them to try +again? Thanks. + +Date: 6 February 1983 02:48 EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC + +The CHAOS ARPA server now behaves as follows: + +Contact name TCP tries to establish a TCP connection +Contact name NCP tries to establish an NCP connection, even + though it should never succeed. +Contact name ARPA tries to establish a TCP connection. If it + times out (15 seconds), then it tries an NCP + connection. + +Auxiliary connections may work again, using the network protocol +that the primary connection is using. + +Date: 1 February 1983 00:53 EST +From: David A. Moon +To: BUG-ITS @ MIT-MC + +Noticing that there was no CHAOS-TCP gateway on ML, I put one there. +I didn't bother testing it. + +Date: 31 January 1983 18:07 EST +From: Richard Brenner +To: BUG-ITS @ MIT-MC +cc: ASB @ MIT-MC, JPG @ MIT-MC + + JPG@MIT-MC 01/31/83 17:56:21 Re: Job A wants the TTY + To: ASB at MIT-MC + CC: JPG at MIT-MC + ASB@MIT-MC 01/31/83 17:23:03 Re: Job A wants the TTY + Recently there has been a change in the way that the user is notified + that a proceeded Macsyma needs the tty. + Formerly, notification would be issued only once while in another Macsyma, + but it now appears that this occurs whenever a file is loaded. To see + this new behavior, start up a Macsyma, then after you get a (C1) + ^Z it and ^P it. + Then start a second Macsyma, and try something like + INTEGRATE(X,X,0,1); + I have not tried OA^K. + I prefer the old behavior. + This printout is done by ITS, not by MACSYMA, so we have no control + over it. It happens whenever the job needs to go up to top-level for + something which may very well happen while a file is being loaded. + I'm not convinced there's been any change here, but if there has, it's + an ITS issue, not a MACSYMA issue. + +Date: 31 January 1983 12:02 EST +From: Christopher C. Stacy +Subject: broken? +To: CENT @ MIT-ML +cc: BUG-ITS @ MIT-ML, BUG-PEEK @ MIT-ML +In-reply-to: The message of 01/30/83 00:28:08 from CENT at MIT-ML + + +AI (and some other machines probably) have a slighlyt buggy version of +PEEK. Copy MC:SYSBIN;PEEK > to the machine, and load up a job +with it. Type $G and it will install itself. Ill do this if I get a +chance today. + + + + +HDT@MIT-ML 01/31/83 00:35:39 +To: (BUG ITS) at MIT-ML +How can I get its typeout into a wall paper? + (ie. the functionality of twenex's photo) + +DCP@MIT-MC 01/30/83 13:22:25 +To: rms at MIT-ML +CC: (BUG ITS) at MIT-ML + rms@MIT-ML (Sent by ___014@MIT-ML) 01/29/83 17:48:54 + TELNET on a Lispm gets no response from the TCP server on ML or MC + trying to go to CMUA + even though ML is up and can successfully finger CMUA. + +It works for me, although the output from CMU is completely +garbaged. Are you sure you are connecting to TCP and not to +ARPA? + + +CENT@MIT-ML 01/30/83 00:28:08 Re: broken? +To: (BUG ITS) at MIT-ML, (BUG PEEK) at MIT-ML +:p on AI seems to be broken. when i try to kill a job, the display changes +from whatever before to show that job, but doesn't ask GUN THIS JOB?. i +think the problem is not that it thinks it has asked this and is waiting +for an answer (typing y does not seem to do anything). i do give an +argument, so it isn't that, unless . is broken in some fashion. :p on ML +behaves properly, so perhaps the version on AI is bad somehow? + +Date: 29 January 1983 21:11 EST +From: David A. Moon +To: BUG-ITS @ MIT-MC + +ML-device service between ML and MC now uses Chaosnet. +Relink DEVICE;JOBDEV ML/MC if there are any fatal problems. Let +me know if there are any problems. + +Making links does not work across this. I don't think it worked +the old way either, unless it was patched in the binary and not +fixed in the source. I'll probably fix this tomorrow (the two +ends don't seem to agree on what the protocol is for sending over +the arguments to the MLINK system call) + +Date: 29 January 1983 20:43 EST +From: Steven A. Swernofsky +Subject: mail from 1200400006 +To: BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC +cc: SASW @ MIT-MC + +I have been receiving messages which read + "You have net mail from 1200400006:" +followed by the normal message which indicates the receipt of mail. I +think this is wrong. Is it? + +-- Steve + +Date: 29 January 1983 20:29 EST +From: David A. Moon +Subject: MLSLV... +To: ELLEN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC + +There do seem to be lots of cases of things like MLSLV's that think +their connection is open, but the foreign host doesn't know about +that connection, and JOB.nn's (MLDEV's) that have an open connection +and no owner anymore. Note that neither program has been changed. +Probably the advent of TCP has made the NCP implementation in the +IMPs more unreliable? + +The Chaosnet version of the ML device certainly won't have these +problems, and the TCP version shouldn't, so when they're installed +things should look up. I guess I'll go ahead and install the +Chaosnet version between ML and MC now. + +rms@MIT-ML (Sent by ___014@MIT-ML) 01/29/83 17:48:54 +To: (BUG ITS) at MIT-ML +TELNET on a Lispm gets no response from the TCP server on ML or MC +trying to go to CMUA +even though ML is up and can successfully finger CMUA. + + +Date: 29 January 1983 01:41 EST +From: V. Ellen Golden +Subject: MLSLV... +To: BUG-ITS @ MIT-MC +cc: BUG-TCP @ MIT-MC + +There seems to be a pattern developing of MLSLVs opening connections +and then lying around. In some cases this may be due to a system down, +but shouldn't it time out? + +At this moment there are three such, all from ML or AI. ML and AI are +both up now. + +Date: 28 Jan 1983 1624-EST +From: S. W. Galley +Subject: Re: con't... +To: ALAN@MIT-MC +cc: BUG-ITS@MIT-MC +In-Reply-To: Your message of 23-Jan-83 2145-EST + +Don't panic! DM is now running COMSAT, and I have converted +the birthday-greeting program suitably -- it's independent of COMSYS. +------- + +Date: 27 Jan 1983 1056-EST +From: P. David Lebling +To: CStacy@MIT-MC, ALAN@MIT-MC +cc: BUG-ITS@MIT-MC +In-Reply-To: Your message of 25-Jan-83 1528-EST + +Comsat has been launched on DM. What I have done to (temporarily) +deal with COMSYS is to convince it that all net mail gates through +MIT-DMS (which will send it via Comsat, since FTP produces .MAIL. +files). Eventually, stuff which produces Comsys request files should +be changed by whomever is responsible for them. + +In any case, DM now is running a fully compatible Comsat, and Comsys +is only run by hand periodically (by me). + + Dave +------- + +Date: 25 January 1983 23:35 EST +From: Ken Harrenstien +Subject: TCP for PEEK +To: BUG-TCP @ MIT-MC, BUG-PEEK @ MIT-MC, BUG-ITS @ MIT-MC + +PEEK on MC has had some TCP connection status display stuff added. +It is not very elegant but should suffice for a while. + +Date: 25 January 1983 15:28 EST +From: Christopher C. Stacy +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: The message of 23 Jan 83 21:45-EST from Alan Bawden + +Apparently no one wants to hack TCP for COMSYS in the old Muddle +it runs in. I installed a ready-to-launch COMSAT on DM a while +back, and I think PDL and company are going to start running it +before February. I'll do something about birthday messages. + +Date: Sunday, 23 January 1983 22:51-EST +Sender: KLOTZ @ MIT-OZ +From: Leigh L. Klotz +To: Alan Bawden +Cc: BUG-ITS @ MIT-MC +Subject: con't... +In-reply-to: The message of 23 Jan 1983 21:45 EST from Alan Bawden + +Happy birthday... + +Date: 23 January 1983 21:45 EST +From: Alan Bawden +Subject: con't... +To: BUG-ITS @ MIT-MC + +I noticed this because I missed my yearly birthday greeting message +from COMSYS. Clearly if COMSYS is going away, we need a crash program +to move this functionality to some other program! + +Date: 23 January 1983 21:41 EST +From: Alan Bawden +Subject: COMSYS? +To: BUG-ITS @ MIT-MC + +So just what is the story with mailers on DM? Someone has sort of +installed COMSAT there, except it isn't running. COMSYS isn't running +either, and there is a small queue of messages on the COMSYS directory +waiting to be sent. I suppose the fact that DM is running a pre-TCP +version of ITS might have something to do with all this... + +Date: 21 January 1983 10:51 EST +From: Ken Harrenstien +To: BUG-ITS @ MIT-MC + +If ITS system mem (LMEMFR) is zero for more than a few seconds, a system +console message should be printed so that it's more obvious why things +are losing. MC has been skirting this (and falling victim to it) dangerously +often lately during peak load. + +Date: 20 January 1983 03:28 EST +From: Tom Knight +To: BUG-ITS @ MIT-MC + +MC was catatonic tonight with the sysjob hung on the core job. +I took a dump, crash corrq. It was stopped with key 0. +The microcode had to be reloaded before I could get the system +to load, which might be related. + +Date: 19 January 1983 15:27 EST +From: Christopher C. Stacy +To: mhk @ MIT-ML +cc: BUG-ITS @ MIT-MC + +AI crashed with a parity error. + +MHK@MIT-ML 01/19/83 11:08:23 +To: (BUG ITS) at MIT-ML +I was just on AI about 15 mins. ago. I think it may have crashed on +me while I was trying to look at the following problem: +:f @its bought me: +[ +ERROR; 10107>>PUSHJ 17,13251 + +Since your DDT lokks quite different from ours, and I don't know +your calls very well, I didn't get very far and then the machine went away. + + +CENT@MIT-ML 01/17/83 03:04:05 Re: its bugs +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC + Date: 14 January 1983 14:13-EST + From: David C. Plummer + + Where are the old bug reports? MC;SYSTEM;ITS BUGS only goes back + to 7/25/81. At first glance, the file on AI is not any better. + +AI:SYSTEM;ITS OBUGS goes back to 1 June 79.. + +Date: Sunday, 16 January 1983 16:28-EST +From: MOON at SCRC-TENEX +To: David C. Plummer +Cc: bug-its at MIT-MC, BUG-LISPM at MIT-OZ, bug-minits at MIT-MC, + bug-supdup at MIT-MC, bug-twenex at MIT-XX at MIT-MC, + Henry at MIT-OZ, unix-chaos at MIT-VAX +Subject: not exactly about Supdup windows on color screen +In-reply-to: The message of 16 Jan 1983 12:35-EST from David C. Plummer + +What ITS expects is for typing a character in the last column of a line to +leave the cursor in that column, and for line feeding off the last line +of the screen to scroll by the number of lines specified in the terminal +characteristics (ITS won't use this unless the user says to use scroll +mode). + +Thus the -only- way to move the cursor from one line to the next is via +line feed (or %TDCRL or cursor-positioning). The terminal is required +not to have any "intelligent" features where it secretly moves the cursor. +I assume the Lisp machine Supdup is blowing it. + +Date: 16 January 1983 13:46 EST +From: David C. Plummer +Subject: Supdup windows on color screen +To: DCP @ SCRC-TENEX +cc: BUG-ITS @ MIT-MC, BUG-MINITS @ MIT-MC, BUG-SUPDUP @ MIT-MC, + unix-chaos @ MIT-VAX, BUG-LISPM @ MIT-OZ, Henry @ MIT-OZ, + bug-twenex @ MIT-XX + +OOPS. The complete paragraph from page 3, the first part of +which is just as vital as the second: + +The TCMXH variable specifies the line width in number of characters. This +value is one less than the screen width (ITS indicates line overflow by +outputting an exclamation point at the end of the display line before +moving to the next line). Note: the terminal must not do an automatic +CRLF when a character is printed in the rightmost column. If this is +unavoidable, the user SUPDUP must decrement the width it sends by one. + +Date: Sunday, 16 January 1983, 12:35-EST +From: David C. Plummer +Subject: Supdup windows on color screen +To: BUG-LISPM at MIT-OZ, bug-its at MIT-MC, bug-twenex at MIT-XX, + bug-minits at MIT-MC, unix-chaos at MIT-VAX, bug-supdup at MIT-MC +Cc: Henry at MIT-OZ +In-reply-to: The message of 15 Jan 83 23:43-EST from Henry Lieberman + +Sorry if you get this 6 times because of all the mailing lists, but this +problem exists in many places, and should really be resolved on a global +scale. + ------------------------------ +What we need to do is document what ITS expects to see for line width, +and what it expects the terminal to do when you try and type something +on the last line (stick versus wrap). We should then make sure each +user implementation and the non-ITS servers strictly obey this. (If you +read the SUPDUP RFC [a copy in MC:DCP2;RFC SUPDUP], you will find the +following, which I think is sufficient for everybody to check their +programs. + +[Page 2] +The SUPDUP protocol originated as the internal protocol used between parts +of ITS, and between ITS and "intelligent" terminals. Over the network, a +user host acts like an intelligent terminal programmed for ITS. + +[later in Page 2] +Because this is also the internals of ITS, the right to change it any time +if necessary to provide new features is reserved by MIT. + +[Page 3] +Note: the terminal must not do an automatic CRLF when a character is +printed in the rightmost column. If this is unavoidable, the user +SUPDUP must decrement the width it sends by one. + +Date: 14 January 1983 21:37-EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC + +MC was found catatonic tonight. Taft says this is a recurring +phenomena. The symptoms were: extrememly long wait to get a +chaos supdup connection (if at all). STATUS answered +immediately, however. ^Z from the console keybaord and the VT52 +took a long time to respond. After that, loading a file looked +like it was doomed to failure (though if I waited long enough, it +may have loaded). SYS^F, SYS1^F, .TEMP.^F all failed to give me +a directory listing. It's been a long time since I've played at +the console, so CRASH;011483 LOOP may or may not contain anything +useful. warm boot reload worked. + +Date: 14 January 1983 14:13-EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC + +Where are the old bug reports? MC;SYSTEM;ITS BUGS only goes back +to 7/25/81. At first glance, the file on AI is not any better. + +Date: 14 January 1983 14:05-EST +From: David C. Plummer +Subject: IOT control bits +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, GSB @ MIT-MC + +I think I noticed this 2 years ago, and I though Moon fixed it. +Oh well. I discovered it by trying to turn a DDT display channel +into super-image-output by toggling both bits. Great way to send +ARDS pictures to your friends... + +Date: 14 January 1983 02:57-EST +From: Alan Bawden +Subject: IOT control bits +To: BUG-ITS @ MIT-MC +cc: GSB @ MIT-MC + +This doesn't work as advertized: + + .call [setz ? sixbit /iot/ + [%tipek,,ttyich] + setzm t] + +While this does: + + .call [setz ? sixbit /iot/ + %clbit,,%tipek + movei ttyich + setzm t] + +We could just fix the documentation of the IOT call to not claim that the +left half of the first argument is XORed with the control bits... + +Date: 13 Jan 1983 1432-EST +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: bug-its at MIT-DMS +Message-id: <[MIT-DMS].254621> + +There is a hacked PEEK which is patched around the init problem in +my directory on DM; I linked SYS;TS PEEK to it for the moment, until +PEEK gets fixed. + + + +Date: 13 January 1983 13:20-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +In ITS 1317 or higher on DM only, PEEK blows up trying purify +itself. It dies trying to get a page at INITA. + +Date: 13 January 1983 07:59-EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC +cc: DEVON @ MIT-MC + +I updated .INFO.;ITS .CALLS and .INFO.;ITS TTYVAR to reflect the +fact that TTYOPT bit 1.3 is indeed in use, and is + 1.3 %TPRSC This tty can do region scrolling. +As defined in SYSTEM;BITS >. + +Date: 13 January 1983 06:38-EST +From: Devon S. McCullough +Subject: supdup for personal computers +To: DCP @ MIT-MC +cc: BUG-ITS @ MIT-MC, GRUPP @ MIT-MC +In-reply-to: The message of 13 Jan 1983 04:46-EST from David C. Plummer + + +What I am trying to convey is, that we need a way to tell ITS to send +%TDQOT's argument without sending the %TDQOT itself, even when the +TCTYP is SOFTWARE, so that programs can use %TDQOT to talk funny +protocols without the necessity of changing TCTYP to PRINTING and back. + + +Inventing something like :TCTYP SUPDUP would work for dialups but not +for network connections, because network servers currently assume that +any %TDORS byte sent as output was caused by an output reset (they +have no way of telling whether this is so) and do the equivalent of an +output reset for telnet or whatever. If the user wants to actually +send a %TDORS byte as data it must be quoted, as in %TDQOT %TDORS. + +This means that a network server talking to a TAC with :TCTYP SOFT +must see the %TDQOT's, but only send the argument, not the %TDQOT. +On the other hand, a server talking to another SUPDUP serving host +does indeed want to pass along %TDQOT's uncensored. + +By the way, the current (losing) TCP server recognises %TDORS but not +%TDQOT, so that funny microcomputer programs LMODEM and SLOSTY which +have long worked with NCP are now broken under TCP. + +Date: 13 January 1983 04:46-EST +From: David C. Plummer +Subject: supdup for personal computers +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 13 January 1983 01:51-EST + From: Devon S. McCullough + + TTYOPT bit 1.3 seems to be available. Let's call it %TPQOT and simply + have network servers look at this bit to decide whether %TDQOT should + be sent or not, instead of checking for TCTYP=%TNSFW as is done now. +I don't understand your problem, and that won't work anyway. My +understanding of the ITS terminal system is that characters are +translated as they are pulled out of the ITS terminal buffer. If +the terminal type is software, then no translation is done. +Because you are on a software terminal ITS will not look at +anything (including %TDQOT) and therefore just send it out. +Also, this translation is probably done before the implemention +of STYNET sees the character, so "have network servers look" will +do no good. The net result is that what you send to a +super image output channel that is %TNSFW is exacly what the +other end (terminal or STY) will see. You do get raw 8bit +strings. + +Date: 13 January 1983 01:51-EST +From: Devon S. McCullough +Subject: supdup for personal computers +To: GJC @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: The message of 12 Jan 1983 12:45-EST from George J. Carrette + +I've been using SUPDUP on 8080 and 6502 personal computers to access +ITS for years now, started using data compression about a year ago. +My program SLOSTY is a modified PTY which does a simple Huffman code. +I was planning to move up to fractional bits and other hairy codings, +but lost interest when I quit logging in via the ARPAnet. + +Not being able to output arbitrary 8-bit strings defeats the whole +purpose of doing data compression. It *IS* possible to output 8-bit +strings from ITS, but it requires the ugly kludge of setting TCTYP to +PRINTING in order for %TDQOT and %TDORS to work properly, restoring +the original TCTYP when done. + +TTYOPT bit 1.3 seems to be available. Let's call it %TPQOT and simply +have network servers look at this bit to decide whether %TDQOT should +be sent or not, instead of checking for TCTYP=%TNSFW as is done now. + +CSTACY@MIT-AI 01/13/83 01:18:34 +To: (BUG ITS) at MIT-AI +AI is back up now. + + +Date: 13 January 1983 00:12-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +MC seemed to be wedged: I could not login at the console or from my +FILE job. Some other file job did get on tho, but I still coldnt get +anything out of the terminal. I paused the system and I think the +SYS job was running. I continued it, and it went into a very tight +loop. This time SW0 didnt work. I got into DDT and found that U was +zero. Dumped to CRASH2;LOOOP SYS and reloaded XITS. + +Date: 12 January 1983 12:45-EST +From: George J. Carrette +Subject: supdup for personal computers +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Do you actually have this and the datacompression implemented? On +what machines? + +By the way, you should not really need to send arbitrary eight-bit-strings +just because you are doing data-compression. Certainly it is more +convenient if you do, but you can certainly encode the information +in whatever arbitrary characters that are available. + + +Date: 11 January 1983 20:59-EST +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC +cc: DEVON @ MIT-MC, GRUPP @ MIT-MC, RWH @ MIT-MC +In-reply-to: The message of 01/10/83 18:22:27 from GSB@MIT-ML + +In order to support data-compression and other non-SUPDUP protocols +peculiar to personal computers, we need to be able to output ARBITRARY +EIGHT BIT STRINGS to the user. ITS currently does this in a grossly +crappy way, using %TDQOT in Super-Image output mode. Since this is +the ONLY mechanism for doing this, it shouldn't interact with the +user's TCTYP, but it does. Users with terminals that happen to +understand %TD codes get screwed because ITS does not simply send +%TDQOT's argument, it sends the %TDQOT as well. This is no good. + +There should be a +%TPSUP bit analogous to %TPTEL to say you are +talking to a SUPDUP connection. Programs that check TCTYP=%TNSFW now +should look at this bit instead. + +Date: 11 January 1983 18:54-EST +From: David A. Moon +Subject: RFNAME bug +To: BUG-ITS @ MIT-MC + + Date: 10 January 1983 17:46-EST + From: David A. Moon + To: BUG-ITS @ MIT-MC + + RFNAME on another job's channel clobbers that job's UUAC + (via CHNDCD via NRFNM1) without pclsring the job, probably + causing it to go off and do weird things. +Fixed in the source (SYSHAK;ITS) + +Date: 10 Jan 1983 1658-EST +From: SWG at MIT-DMS (S. W. Galley) +To: bug-its at MIT-DMS +Subject: SYSTEM CLOBBERED +Message-id: <[MIT-DMS].254428> + +DM has been getting a lot of these lately, e.g. + +SYSTEM CLOBBERED BETWEEN 144467 AND 112110 XOR= 350231,,746375 ! 07:10:02 + 76277 71061 56520 40711 163616 115205 54000 152343 30356 113152 176000 27310 2104 50054 116051 127647 121075 61070 170210 123760 42430 16237 13201 134467 174067 166377 36562 56473 13506 152102 42527 121674 141177 131607 43454 61376 + +What do all those numbers mean? Where is the problem? + + +Date: 11 January 1983 01:32-EST +From: Christopher C. Stacy +Subject: AI is down +To: BUG-ITS @ MIT-MC + +AI is sick. It runs sometimes for a while, with random jobs +getting random parity errors. Sometimes the system gets an +exec mode parity error. Just now it got KA: APR ERROR IN NULL JOB. + +Date: 10 January 1983 17:46-EST +From: David A. Moon +To: BUG-ITS @ MIT-MC + +RFNAME on another job's channel clobbers that job's UUAC +(via CHNDCD via NRFNM1) without pclsring the job, probably +causing it to go off and do weird things. + +Date: 10 Jan 1983 1248-EST +From: SWG at MIT-DMS (S. W. Galley) +To: KLH at MIT-DMS, BUG-ITS at MIT-DMS +Subject: DM crash at 12:30 +Message-id: <[MIT-DMS].254414> + +Job #9 was looping thru all PC values, apparently. +PI 3 in progress, PI 1 request, no clock interrrupts, no EXEC mode. +Dumped in DM:CRASH;JOB9 LOOP. + + +Date: 10 Jan 1983 1247-EST +From: SWG at MIT-DMS (S. W. Galley) +To: KLH at MIT-DMS, BUG-ITS at MIT-DMS +Subject: DM crash +Message-id: <[MIT-DMS].254413> + +... at 11:00 at UQL5A+15. Dumped in DM:CRASH;UQL5A +15. + + +Date: 10 January 1983 04:09-EST +From: RWK, CSTACY @ MIT-MC +Sender: CSTACY @ MIT-MC +Subject: DDT on MC +To: BUG-ITS @ MIT-MC + + +There is no (known) reason why we should not be running the +latest DDT, which RWK thinks has all the needed patches and +no other changes from the last correctly installed one. + +(Well, there was one set of bogus changes... sigh --RWK) + +Anyway, we debugged them, and installed them (MC only). +I had thought CSTACY was going to install DDT from the +sources some months ago, apparently he thought I was. +So we did. + +Date: 10 January 1983 01:56-EST +From: Christopher C. Stacy +Subject: DDT on MC +To: BUG-ITS @ MIT-MC +cc: JPG @ MIT-MC + + +The DDT installed on MC was an old one which did not have +the fix for the old :REAP command bug. Not understanding +quite why this version was installed, I re-installed the +DDT from SYSBIN;DDT BIN. This version has the fix. + +RWK thinks the source for DDT has all the patches, but I noticed +it didnt have the :REAP fix, so I put that into the source. + +Date: 10 January 1983 00:27-EST +From: Herb Lin +To: VUG-ITS @ MIT-MC, BUG-ITS @ MIT-MC + +can some system wizard tell me the format of tapes written on MC? +density, block size, all that kind of stuff? i need to know +for a machine to which I would like to move some MC files by tape. + +tnx. + +Date: 9 January 1983 07:47-EST +From: David C. Plummer +Sender: DCP0 @ MIT-MC +To: BUG-CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I'm trying to run the syseng;hosts xfile, and when it tries to ftp to sail, it looks like +the NETBLK timeout is around 4 minutes when it starts. Is this really necessary? + +Date: 8 January 1983 14:30-EST +From: David C. Plummer +Subject: user/server times +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I fixed the source of :TIMES (in tcp;) to only wait 10 seconds +instead of 30 for the TCP connection to open/fail. I thought you +could just use NETBLK... + +Date: 7 January 1983 23:20-EST +From: Christopher C. Stacy +Subject: user/server times +To: BUG-ITS @ MIT-MC + +I converted the :TIMES program along with the TIMSRV. The TIMES +program has two run time switches called NCPTRY and TCPTRY. It +defaultly tries both protocols and tells you which it won with. +Tested and installed on MC. + +Date: 7 January 1983 20:24-EST +From: Christopher C. Stacy +Subject: TIMSRV converted (big deal!) +To: BUG-ITS @ MIT-MC + +I converted the time server (socket 45) for TCP as well as NCP. +It is installed on MC and works with NCP (we dont have a TCP user +to try it with yet.) Source is TCP;TIMSRV. + +Chris + +Date: 3 Jan 1983 1554-EST +From: SWG at MIT-DMS (S. W. Galley) +To: KLH at MIT-DMS +Cc: bug-its at MIT-DMS +Subject: DM crash +Message-id: <[MIT-DMS].254017> + +ITS 1312 crashed at 14:20 when SWPOPG was called with A/ 6. +I dumped it to DM:CRASH;SWPOPG A/6. + + + +Date: 3 January 1983 15:06-EST +From: David A. Moon +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 3 January 1983 00:26-EST + From: Christopher C. Stacy + To: BUG-ITS @ MIT-MC + + In ITS 1315 on AI and ML, shutting the system down doesnt seem to work + all the time. I get the ITS NOT IN OPERATION message, but then it + seems to go back to normal timesharing and you never get the SHUTDOWN + COMPLETE message. The pager lights look like it is running normal + timesharing, although you can't login, and the data lights show only + the SYS job getting run. +It doesn't shut down until various things are complete, such as all jobs +gunned down and the not in operation message typed out on all terminals. +Find the place that does the shutdown complete bug pause and see what +it was waiting for. It could be that someone installed a daemon job +with OPTLIV that fails to finish itself up and go away. + +Date: 3 January 1983 14:57-EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC + +Now that ITS has TCP, would it be feasible to hack +the dover spooler to use the TCP route if the CHAOS route +appears to be down? I don't know all the addressing issues, +but if this is something that should be done, I'll help +look into it. + +Date: 3 January 1983 00:26-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +In ITS 1315 on AI and ML, shutting the system down doesnt seem to work +all the time. I get the ITS NOT IN OPERATION message, but then it +seems to go back to normal timesharing and you never get the SHUTDOWN +COMPLETE message. The pager lights look like it is running normal +timesharing, although you can't login, and the data lights show only +the SYS job getting run. + +Date: Friday, 31 December 1982, 10:38-EST +From: David A. Moon +Sender: jek at SCRC-VIXEN +Subject: Chaosnet FILE server +To: BUG-TENEX at SCRC, BUG-TWENEX at XX, BUG-ITS at MC + +I have installed new versions of the FILE server on EE,ML,MC,OZ,SCRC,SPEECH,XX. +Sources are on MC,OZ,SCRC,XX. Please let me know if there are any problems. +The 20X version can be deinstalled by deleting SYSTEM:CHAOS.FILE.497. The +ITS version can be deinstalled by copying MC:DEVICE;CHAOS OFILE to DSK:DEVICE; +CHAOS FILE. + +Date: Wednesday, 29 December 1982, 23:36-EST +From: David A. Moon +Subject: Chaosnet FILE server +To: BUG-TENEX at SCRC-POINTER, BUG-TWENEX at XX, BUG-ITS at MC + +I have installed new versions of the FILE server on EE,ML,MC,OZ,SCRC,SPEECH,XX. +Sources are on MC,OZ,SCRC,XX. Please let me know if there are any problems. +The 20X version can be deinstalled by deleting SYSTEM:CHAOS.FILE.497. The +ITS version can be deinstalled by copying MC:DEVICE;CHAOS OFILE to DSK:DEVICE; +CHAOS FILE. + +Date: 29 December 1982 23:41-EST +From: Ken Harrenstien +Subject: Flow control in STYNET +To: BUG-ITS @ MIT-MC + +After thinking about it for a while, I agree with Moon and you will +find that the TCP STYNET similarly lacks flow control on input. This +not only provides the best approximation to being directly connected, but +also is by far the simplest way to avoid having things get hung up. +I don't see any point in "fixing" this, unless we also worry about +trying to fix direct and dialed-in TTY lines. Note that the intelligent +terminal protocol does allow the terminal to hack flow control and make +sure that stuff gets to ITS (or whatever program) properly. + +I guess you could compare this Alto lossage with someone trying to +play back a recording of modem tones into a MC dialup and expecting +ITS to exert flow control! + +Date: 29 December 1982 23:33-EST +From: Ed Schwalenberg +Subject: STYNET connections from CHAOS net lacking flow control +To: BUG-ITS @ MIT-MC + +A while ago someone complained to me that he was losing attempting to edit +a file on his Alto or something and then piss out the file as a command to +an ITS. His symptom sounded like TTY input buffer overflow, i.e., the echoed +output was missing chunks, and had feeps instead. + +I see that KLH just discovered that in Chaos STYNET, there is no flow control, +and Moon comments that it's only a problem with line-at-a-time input. This +gives rise to two questions: Is it similarly a problem with Arpa STYNET, and +is it worth fixing so that intelligent terminals and hosts can shove script +files across the network and have them work as expected? + +Date: 24 December 1982 12:34-EST +From: Stavros M. Macrakis +Subject: T1061 screwups +To: BUG-ITS @ MIT-MC +cc: KLH @ MIT-MC + +Bug was on this end. Sorry. + +CENT@MIT-ML 12/19/82 23:02:10 Re: ai lossage +To: (BUG ITS) at MIT-ML +ai keeps halting. i keep continuing it. + +Date: 11 December 1982 14:12-EST +From: Ken Harrenstien +To: BUG-ITS at MIT-MC, BUG-DDT at MIT-MC + +It is kind of painful that DDT doesn't repurify itself or anything +when a new system is brought up. Every other program now knows how +to do this. I don't necessarily advocate that DDT actually dump +itself to SYS;ATSIGN DDT (a little dangerous since so much stuff +depends on that), but at least it ought to be able to re-set whatever +variables or stuff it has to, to compensate for running under a +new system version. A little slower on startup, but at least not +fatal (as so many poor lusers are finding). It definitely DOES keep +some people from logging in. + +Date: 11 December 1982 02:44-EST +From: Jeffrey P. Golden +To: BUG-ITS at MIT-MC + +MC:SYSTEM;ITS 1279 and ITS 1281 were the same! So I deleted the +former and linked it to the latter. + +Date: 8 Dec 1982 2058-EST +From: Robert W. Kerns +Subject: Re: bogus uptime record +To: SWG at MIT-DMS, BUG-ITS at MIT-MC +cc: KFL at MIT-AI, RWK at SCRC-TENEX +In-Reply-To: <[MIT-DMS].251798> + +That's nothing. Once when someone set the time wrong on MC, I claimed +to have been up for 2 years straight. I felt much better when that was +straightened out, believe you me! +------- + +Date: 8 Dec 1982 0942-EST +From: SWG at MIT-DMS (S. W. Galley) +To: BUG-ITS at MIT-MC +Cc: KFL at MIT-AI +In-reply-to: Message of 07 Dec 82 at 0439 EST by CStacy@MIT-MC +Subject: bogus uptime record +Message-id: <[MIT-DMS].251798> + +For the same reason, DM claimed to have been up for about 300 days! + + +Date: Tuesday, 7 December 1982, 23:09-PST +From: David C. Plummer +Subject: Re: SUPDUP TTYSMT +To: Barry Margolin at MIT-MULTICS, rsl at SCRC-TENEX +Cc: DCP at MIT-MC, BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC, + BUG-SUPDUP at MIT-MC, BUG-LISPM at MIT-MC +In-reply-to: The message of 7 Dec 82 18:31-PST from Barry Margolin at MIT-MULTICS + + Return-Path: + Date: 7 December 1982 21:31 est + From: Barry Margolin at MIT-MULTICS + Subject: Re: SUPDUP TTYSMT + To: Richard Lamson + cc: David C. Plummer , BUG-ITS at MIT-MC, + BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC + In-Reply-To: Message of 7 December 1982 21:23 est from Richard Lamson + + The TTYSMT variable already has other non-graphics information in it. + It has information about local-editing and line-saving capability, I + believe. +Indeed true. To determine if the terminal supports supdup graphics you +test the BIT in ttysmt which is for that purpose; it is incorrect to +test the entire variable against zero. + +Return-Path: +Date: 7 December 1982 21:31 est +From: Barry Margolin at MIT-MULTICS +Subject: Re: SUPDUP TTYSMT +To: Richard Lamson +cc: David C. Plummer , BUG-ITS at MIT-MC, + BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC +In-Reply-To: Message of 7 December 1982 21:23 est from Richard Lamson + +The TTYSMT variable already has other non-graphics information in it. +It has information about local-editing and line-saving capability, I +believe. + +Date: Tuesday, 7 December 1982, 12:23-PST +From: Richard Lamson +Subject: SUPDUP TTYSMT +To: David C. Plummer +Cc: BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC +In-reply-to: The message of 6 Dec 82 07:10-PST from Bernard S. Greenberg + + Date: 4 December 1982 21:42-EST + From: David C. Plummer + To: BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC + + New field in the right half of the SUPDUP TTYSMT (TTY Smarts or + graphics variable). + + DEFSYM %TRTIM==003700 + DEFSYM $TRTIM==060500 ;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT + ;MINUS #o20; A VALUE OF ZERO MEANS DON'T + ;KNOW, DON'T CARE, OR USER PROGRAM HASN'T + ;IMPLEMENTED IT YET +Yoiks! I was under them impression that TTYSMT was always going to be +reserved for graphics information only. That is, a graphics server +would always be able to tell that the device didn't support graphics if +TTYSMT was zero. Are you sure this is what you want to do, rather than +create a new user variable? + +-- Richard + +Date: 7 December 1982 11:21-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + + +ITS 1283 is now running as NITS on AI. +ITS 1279 is called "ITS" on that machine. + +Date: 7 December 1982 04:39-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC, KFL at MIT-AI +In-reply-to: The message of 6 Dec 82 18:58-EST from KFL at MIT-AI + + KFL@MIT-AI 12/06/82 18:58:07 + Why does AI claim to have been up for 195 days? "Surpassing all + previous uptime records"? + ...Keith + +Because the system time was wrong for a few minutes when it +first came up the other day. + +CENT@MIT-ML 12/07/82 00:33:00 Re: ai up? +To: KFL at MIT-AI +CC: (BUG its) at MIT-MC + KFL@MIT-AI 12/06/82 18:58:07 + To: (BUG its) at MIT-MC + Why does AI claim to have been up for 195 days? "Surpassing all + previous uptime records"? +i think it got confused during being brought up after the power +shutdown this past sunday, or maybe shortly thereafter. don't know how +though. the claim is wildly wrong. cstacy, did you bring ai up? do +you know anything more about this? + +KFL@MIT-AI 12/06/82 18:58:07 +To: (BUG its) at MIT-MC +CC: kfl at MIT-MC + Why does AI claim to have been up for 195 days? "Surpassing all +previous uptime records"? + ...Keith + +Date: 5 December 1982 02:41-EST +From: David C. Plummer +To: uc.mp at MIT-EECS, jtw at MIT-SPEECH +cc: BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC + +OK, OK. For all of you who were wondering why in hell I did +this, I'll tell you. + +Symbolics has imprisoned me in sunny southern California for 3 +weeks. I still log into MC occaisionally which isn't too +difficult since we do happen to be on the chaosnet. If any of +you have ever seen me hacking on MC, my prompt that DDT prints +out has an amazing amount of junk in it. One of those items is +the time. Unfortunately, it is eastern time, not pacific time. +Sooo... ALAN and I started making joking comments to each other +about time zone correction in prompts, and this is what happened. + +I don't know how many of us bug-its, bug-twenex, bug-supdup or +bug-lispm are going to take this seriously, but if I find some +spare time I may make local modifications to this LISPM and hack +my prompt code accordingly. I will probably get around to +putting it in the KTVs and MINITS systems at some point in time. + +Date: 4 December 1982 21:42-EST +From: David C. Plummer +To: BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC, BUG-SUPDUP at MIT-MC, + BUG-LISPM at MIT-MC + +New field in the right half of the SUPDUP TTYSMT (TTY Smarts or +graphics variable). + +DEFSYM %TRTIM==003700 +DEFSYM $TRTIM==060500 ;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT + ;MINUS #o20; A VALUE OF ZERO MEANS DON'T + ;KNOW, DON'T CARE, OR USER PROGRAM HASN'T + ;IMPLEMENTED IT YET + +Date: 30 November 1982 02:06-EST +From: Christopher C. Stacy +Subject: AI KA Inquire database +To: BUG-ITS at MIT-AI, (*MSG *AI) at MIT-AI + +The Inquire database on AI was apparently smashed by a hardware +failure, and has been restored from about a week ago. If you made +any modifications in the past week or two, you might want to check +to see if they were lost. You can check by doing :WHOIS you@AI +from an ARPAnet ITS. + + + +Date: 28 November 1982 07:45-EST +From: Christopher C. Stacy +Subject: SYSMSG illoping - whats this all about +To: KMP at MIT-MC +cc: BUG-ITS at MIT-MC + + +It needed to be repurified, which I just did. I guess I will make it +figure that out itself in the future. + +Date: 27 November 1982 11:43-EST +From: Frank J. Wancho +Subject: ARnn Structure +To: BUG-ITS at MIT-MC + +The obvious answer to this query below would be to ignore the question +and simply tell him to use the ARnn:CPM;fn1 fn2 construct in FTP. +However, he is the first "outsider" to ask an intelligent question +about the actual structure of ARChive files. Is there online +documentation or can someone create such info that I can send him? I +believe such info would be valuable to other sites wishing to FTP an +entire ARChive file and *then* break it into its component files... + +--Frank +-------------------- + +Date: 25 Nov 1982 2020-PST +From: Jorge Phillips +Re: cpm; directory + +Hi, + +I hadn't accessed the CPM; directory at [MC] for a LOOONG time and +just found out that the directory's format has changed completely. I +tried ftp'ng one of the ARnn files (ARnn NSTAR) and found out that it +consists of sections of text and sections of control and non-printing +characters (apparently code, or file structure info). Do I need a +special program to access the contents of these files? Could you give +me some hints of the format and contents of the ARxx files? + +Thanks for any help you can give. + +-jp + +Date: 24 November 1982 19:14-EST +From: Ed Schwalenberg +Subject: Great idea for program +To: ALAN at MIT-MC +cc: BUG-ITS at MIT-MC, BUG-RANDOM-PROGRAM at MIT-MC + +What I wanted is a program that would do the calls in itself, assuming that +this was to be used for simple stuff like my example. However, it would +be useful to be able to do it in another arbitrary inferior, so I applaud +your proposed extension. + +Date: 24 November 1982 04:10-EST +From: Alan Bawden +Subject: Great idea for program +To: ED at MIT-MC +cc: BUG-ITS at MIT-MC, BUG-RANDOM-PROGRAM at MIT-MC + +One way to write this tool would be to use the SYSCALL function in MacLisp. + +Actually there is a problem that a lot of system calls have side effects on +specific jobs. (Like the :IOPEN kludge opens a channel \in the current +job/.) What you REALLY want then is a DDT command that does what you said, +but in the current job. [The idea is to replace the sequence of commands +that usually starts by typing "JJ 100/.CALL 200" with something +like "JJ :DOCALL" right?] + +Date: 24 November 1982 03:25-EST +From: David C. Plummer +Subject: Great idea for program +To: ED at MIT-MC +cc: BUG-ITS at MIT-MC, BUG-RANDOM-PROGRAM at MIT-MC + +Interesting idea, but I don't think I'd say great. + + (This idea comes from having spent a ridiculous amount of time trying to + find out the TTYSMT variable of a tty.) + +That's easy: SYS^K TTYSMT+/ + +It's also in CNSGET, and I think it may be in TTYVAR (even though +:CALL doesn'tdocument it). + +Date: 24 November 1982 03:13-EST +From: Ed Schwalenberg +Sender: HDT at MIT-MC +Subject: Great idea for program +To: BUG-ITS at MIT-MC, BUG-RANDOM-PROGRAM at MIT-MC + +:DOCALL prompts for a system call name, prints the relevant documentation +from ITS .CALLS, and prompts the user for the arguments to the call, with +special magical abilities to cons up , , etc. type args, or open +channels in the fashion of :IOPEN. It then executes the call, and types +out the values for you, or types out the error code if it failed to work. +(This idea comes from having spent a ridiculous amount of time trying to +find out the TTYSMT variable of a tty.) + +Date: 23 November 1982 20:37-EST +From: Ken Harrenstien +To: BUG-ITS at MIT-MC + +I installed a new KSC;HOSTS2 BIN compiler. If problems ae experienced +with the current SYSBIN;HOSTS2 >, then use KSC;HOSTS2 OBIN. + +Date: Monday, 22 November 1982, 03:27-EST +From: Richard M. Stallman +To: KLH at MIT-MC, EAK at MIT-MC +Cc: BUG-ITS at MIT-MC + +I used to keep the source for any one program on only one machine. +It used to cause continual lossage to have any file in two places. +It's up to the people working on ITS, and maybe you can make it work out, +but don't assume things will work with multiple copies of sources +unless you are very careful. + +Date: 21 Nov 1982 2231-EST +From: KLOTZ at MIT-OZ at MIT-MC +Subject: dover +To: bug-its at MIT-OZ at MIT-MC + +Maybe there should be a program to hack the dover status +so people don't have to go read .dovr.;%dover broken which +tells them to create a file called .dovr.;.dovr. notice, +which is different from .dovr.;.dovr.;broken, which they +need to create too, but then have to gun the server (if +they can figure out what the user name is)... + +ELLEN told me that when the dover goes down people still +queue things on MC and gobble up disk space. Few people +know how (or take the trouble to) stop the server on MC, +possibly because it's so complicated. + +Leigh. +------- + + + +Date: 21 November 1982 02:43-EST +From: Ed Schwalenberg +Subject: Re: MASTER mode screwing up TTY handling, but good! +To: RWK at SCRC-TENEX +cc: PGS at MIT-MC, BUG-ITS at MIT-MC + +While I guess I can see that the superior would get no cycles at all, +that still doesn't explain the wedgitude of the STY's. DCP and I had +fun for hours, trying to figure out how to unscrew things without being +able to log in. I finally got it unwedged by halting and continuing +AI, but had to walk over to Tech Sq. to do it, which is cheating... + +Date: 20 Nov 1982 1925-EST +From: Robert W. Kerns +Subject: Re: MASTER mode screwing up TTY handling, but good! +To: PGS at MIT-MC, ED at MIT-MC +cc: BUG-ITS at MIT-MC, RWK at SCRC-TENEX +In-Reply-To: Your message of 20-Nov-82 1855-EST + +PGS is right. Other jobs in the same tree receive no CPU time while the +master-mode job is running. If it waits for I/O or pages, then they may +get a quantum now and then. I noticed this years ago and learned to be +careful. Play with antisocial toys, and you'll get your fingers burnt! +------- + +Date: Saturday, 20 November 1982 18:45-EST +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: Ed Schwalenberg +Cc: BUG-ITS at MIT-MC +Subject: MASTER mode screwing up TTY handling, but good! +In-reply-to: The message of 20 Nov 1982 02:42-EST from Ed Schwalenberg + +I don't know, but when I tried MASTER mode once, it didn't look to me like +TTY handling was screwed. It looked like the DDT just wasn't getting much of +any CPU time. + +Date: 20 Nov 1982 1313-EST +From: Robert W. Kerns +Subject: Re: Feature +To: KLH at MIT-MC, BUG-ITS at MIT-MC +cc: RWK at SCRC-TENEX +In-Reply-To: Your message of 20-Nov-82 1253-EST + +Sounds like an excellent idea. Terminal 0 and/or whatever terminal +is the system console should probably be left alone, hardwired, though. + +Perhaps this can be done by a demon loaded at startup, which simply +uses a special system call to copy the info? Perhaps this call should +only work once, and then enable non-system-console terminals, and cause +the ITS IN OPERATION message to be printed when it is done. This would +prevent clobbering terminals already in use. Alternatively, it could +be careful and ignore terminals which are in use. This would minimize +the amount of EXEC code and debugging. +------- + +Date: 20 November 1982 12:41-EST +From: Ken Harrenstien +Subject: Feature +To: BUG-ITS at MIT-MC +cc: KLH at MIT-MC + +ITS should probably read a binary parameter file on startup to +initialize its TTY tables rather than having them built in. +This table can be maintained by a simple utility program that +grovels over a source file, like HOSTSn does for HOSTS >. +The network code will need to do something similar in order to +initialize its gateway tables. +If no objections, I may go ahead and do this. + +Date: 20 November 1982 02:42-EST +From: Ed Schwalenberg +Subject: MASTER mode screwing up TTY handling, but good! +To: BUG-ITS at MIT-MC + +I should know better than to frivolously show people MASTER mode, but anyway... +Proceeding a job in Master mode without the TTY causes output on that +TTY to be wedged, in that the * that DDT echoes after ^P never happens. +Output from comm links continues to work, however. Now for the real +killer: if that tree is then detached, the poor sucker who reowns it gets +wedged, just by reowning it (his HACTRN says :$ Reowned $, then nothing more.) +Stealing MASTER mode away, by grabbing it in another process, results in the +wedged jobs continuing as if nothing had happened. + +This was all on MC, just now, version 1283. I tried to do the same thing on +AI, to determine whether it was KL-specific, and discovered to my horror that +not only does the same bug exist, but it apparantly wedges ALL sty's, since +I was unable to log in again to clean up, being told that All network ports were +in use! (The original hackery was also via a STY, by the way; from the SIPB +plasma tv, to be specific.) + +Date: 19 November 1982 19:23-EST +From: Richard Brenner +To: BUG-ITS at MIT-MC + +When trying to :move a file into an archive that (unknown to me) was +full (no free files), I encountered the error +-CHANNEL NOT OPEN +This message was a little too obscure to be helpful to me, and it took +KLH a few minutes to figure out what was happening. I clearer error +message would have helped quite a lot. + +Date: 17 November 1982 22:05-EST +From: Ken Harrenstien +To: EAK at MIT-MC +cc: BUG-ITS at MIT-MC + + Date: 17 November 1982 21:00-EST + From: Earl A. Killian + + I thought that sources were only supposedly to exist on one + machine so that you never get copies out of sync and need to do + merging. Thus, if you copied things from AI to MC, you should + delete them from AI. + +Not necessarily, the main thing is to make it clear where the +canonical source actually lives, normally in a comment at the +start of the source file. I don't think it would be a good +idea to have any machine (esp AI) totally without sources. + +Date: 17 November 1982 21:00-EST +From: Earl A. Killian +To: CSTACY at MIT-MC +cc: BUG-ITS at MIT-MC + +I thought that sources were only supposedly to exist on one +machine so that you never get copies out of sync and need to do +merging. Thus, if you copied things from AI to MC, you should +delete them from AI. + +Date: 17 November 1982 02:07-EST +From: Ken Harrenstien +Subject: Can't get there from here. +To: DCP at SCRC-TENEX +cc: BUG-ITS at MIT-MC, rp at SCRC-TENEX, rll at SCRC-TENEX + +I rebooted the front-end 11 per MOON's instructions about 2 hours ago. +Local terminals were badly wedged, although Chaosnet connections seemd +to be going through okay; it was however complaining periodically that +no more chaosnet buffers were available. A typical example of wedgedness +is that echo on the VT52 next to the console was at least 20 chars behind +typein, and some typein seemed to be getting lost or at least processed +in random spurts (only when one had pumped enough chars at it would anything +happen). +The rebooting seems to have fixed everything for now. Moon apparently +thinks that the Dover spooler might have had something to do with +the overall problem, but you'd have to ask him for any details. Something +was very obviously clobbered in the 11. Perhaps when the Chaosnet goes +wild, something overflows into the TTY buffers/pointers or otherwise +throws a big wrench into the works? Pure speculation, I'm not familiar +with it. It might even be the other way around, that some glitch in +TTY handling (owing to the preponderance of "loose lines" blasting noise +at the front-end) is screwing up not only the TTYs but the Chaosnet. + +Date: Wednesday, 17 November 1982, 01:52-EST +From: David C. Plummer +Subject: Can't get there from here. +To: bug-its at mc +Cc: rp at SCRC-TENEX, rll at SCRC-TENEX + +I had a chaos connection to MC die on me tonight. (RP has complained +that he gets about two per day.) When it happened to me I did some +quick poking and the MC-IO-11 was not responding to STATUS but other +hosts on subnet one were. MC is now up (and has been for 14 hours) so +it looks like the 11 crapped. A couple nights ago TAFT called me for +instructions on how to reload the 11. Is this flaking out becoming +regular? Does the person(s) reloading it remember anything special +about the circumstances (11 halted or running, ampex parity, dl10 +parity, etc). + +Date: 13 November 1982 20:37-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + +PEEK automagically purifies and dumps out itself if necessary now. + + + +Date: 13 November 1982 13:28-EST +From: Ed Schwalenberg +Subject: T21 as well... +To: BUG-HARDWARE at MIT-MC +cc: BUG-ITS at MIT-MC + +has been silenced. + + +Date: 13 November 1982 13:24-EST +From: Ed Schwalenberg +Subject: MC T32 emitting continuous garbage. +To: BUG-HARDWARE at MIT-MC +cc: BUG-ITS at MIT-MC + +I set the linespeed to 0 to disable T32, which was typing garbage at the +system. Is there any documentation for LSPEED? I went blithely ahead +and assumed that it worked like a reasonable program, but it would be +nice to know. It would be similarly nice if the same programs worked for +all known TTY types, but this is rapidly becoming a dead issue. + + +Date: 13 November 1982 23:18-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + +There were a number of program sources which did not exist or +were out of date on MC. I brought them up to date from the ones +on AI, putting the overflow in the new SYSEN2; directory. MC +should now be reagrded as the home of the most recent system +program sources. + +I moved the BUG-ITS mailing list to MC, and updated pointers to +it on AI, ML, and DM. The other bug-random-programs are still +on AI. A copy of the AI NAMES file is in MC:KSC;AI NAMES. + +Chris + +KLH@MIT-MC 11/13/82 01:15:28 Re: another SRCCOM feature +To: (BUG ITS) at MIT-MC, (BUG SRCCOM) at MIT-MC +I hope this isn't bothering BUG-ITS people, but since I developed +this feature to help hack ITS I figure I might as well continue +with the SRCCOM announcements. I added the /$ switch which +does a binary compare like /# but with the difference that the +files must be executable programs; SRCCOM will create two +inferior processes and load the files into them in order to compare +the two address spaces. This completely flushes any spurious +diffs due to symbols, MIDAS info, blocking size, or SBLK/PDUMP +format. Doesn't handle holey processes though; maybe later. + +I updated INFO;SRCCOM > on MC. I'm going to move the canonical +location of SRCCOM to MC, I think. + + +Date: 12 November 1982 23:08-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + +I am adding some features to PEEK which will be useful for +TCP/IP debugging. I added the trivial "+" mode today, sort of +as practice. Installed on MC. + + +KLH@MIT-MC 11/12/82 13:05:17 Re: Binary compare feature +To: (BUG ITS) at MIT-MC, (BUG SRCCOM) at MIT-MC +I have installed a new SRCCOM on MC with a crude binary compare +feature. Use switcch /# to compare two files word by word. +Interaction with other switches is likely to kill things. +If nobody (mostly me, I guess) finds problems with it over the +next few days, I'll install it in other places. +Note that two different assemblies of the same sources will not +produce identical binaries, because of the extra info that MIDAS +puts in about who assembled it when. I'm not sure yet how to +bypass this. + + +Date: 11 November 1982 22:22-EST +From: Christopher C. Stacy +To: DCP at MIT-MC +cc: BUG-ITS at MIT-MC, KMP at MIT-MC, THREE-MINUTE-HATE at MIT-MC, + Eric at MIT-EECS + + +I made a mailing list for discussing some of the random ideas inspired +by DCP's message about ITS on a VAX. It doesnt have to be just about +VAX ITS, but it prevents message duplication and gets it off BUG-ITS. +Here's what the mailing list looks like now: + +(VAX-ITS (EQV-LIST (FILE [DSK:CSTACY;VAXITS ARCHIV]) + CSTACY DCP PGS ALAN KMP GUMBY DANNY KLH KLOTZ + HAL GREGOR CENT ZVONA RMS DEVON)) + + +Feel free to add yourself... + +Chris + + +Date: 11 November 1982 20:44-EST +From: David C. Plummer +To: KMP at MIT-MC +cc: BUG-ITS at MIT-MC, THREE-MINUTE-HATE at MIT-MC, Eric at MIT-EECS + +[[Sorry for the message duplications...]] + + KMP@MIT-MC 11/11/82 17:46:24 + better than teach ITS, you should get a crew together and bring one up. + +Unfortuantely that would require the cooperation of the owner(s) +of a machine up on which (garp) to bring it. Here are the +options I know of: + +There are rumors of the AI lab looking for a used -10 (KL +probably) to appease the people who can't stand 20X and would +prefer ITS. This would be an idea machine. + +Bring up ITS on an existing PDP-20. The only machine this is +feasible on is OZ, and the feasibility of that seems to be +asymptotically approaching zero (unless you want to pull of a +coop some night). This would also require some microcode +expertise. Moon obviously comes to mind. His commitment at +symbolics also comes to mind. + +Bring it up on a non-10 architecture. This would be a lot of +fun. The obvious choice is a vax. OK, who has the vax, who has +the time, and who has the money to sponser such a moderate +project? (Be prepared to be able to answer "What's wrong with +Unix?" I'm sure each one of us can give some very good answers, +but just be prepared.) + +TK actually suggested writing a report on ITS which described its +winnages (.HANG for example) and its lossages (6 character, +non-hierarchical filenames). + +KLH@MIT-MC 11/11/82 08:26:16 Re: Comsat address & NAMES > +To: JPG at MIT-MC +CC: CBF at MIT-MC, (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC +If I have some spare time during this TCP hacking, I can look into +this. The problem is not really that NAMES is so big, but that COMSAT +is so stupid about how it handles the compiled result. There are at +least three things I can think of right away that would help eliminate +this problem (this does not mean they are easy to do). For the time +being, keeping NAMES small ought to buy enough time. + + +JPG@MIT-MC 11/11/82 05:58:39 Re: Comsat address & NAMES > +To: CBF at MIT-MC +CC: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC + CBF@MIT-MC 11/07/82 16:23:34 Re: Comsat address & NAMES > + To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC + CC: JPG at MIT-MC + It seems that the only solution to the address space problem that avoids + removing mailing lists right and left is to move the bulk of their + contents into separate files and put entries in that are only (@FILE ...). + Anyway, the problem with just going through NAMES > and arbitrarily + moving mailing lists into files is figuring out where to scatter all these + lists to. They presumably each do have individual sponsers, but it is + quite an effort to encourage each person to remove a mailing list to his own + directory. Considering what a bad idea it is to have COMSAT crashing all + the time, I would therefore suggest that a precious MFD slot be given over + to this purpose... +I have no objection to this, but I wish to point out that at least recently +people have been cleaning out the NAMES file to the point where it is now +just(?) 19 blocks, and COMSAT has been crashing much less frequently. +Ah, but will this state last? + + +KLH@MIT-MC 11/10/82 15:50:51 Re: prev msg +To: (BUG ITS) at MIT-MC +Hmm, there is no longer a MIT-NET-CONNECT list. I forwarded the +note to MIT-IN-GROUP and MIT-NETWORK-GROUP instead. Just in case +anyone tries to reply to all recipients... + + +KLH@MIT-MC 11/10/82 15:44:32 Re: ITS TCP is coming... +To: (BUG ITS) at MIT-MC, MIT-NET-CONNECT at MIT-MC +I am now officially working on the installation of TCP/IP in ITS. +The ITS sources in MC:SYSTEM; should be considered write-locked +as of today; if you need to make some changes, see me to fold them +in. Likewise, if you know that these sources are for some reason +NOT the latest stuff, tell me immediately. Ditto any patches +that haven't yet been put in the source. If more than a couple of +people are interested in following the progress of this stuff, I +will create a mailing list to keep them posted and possibly to +solicit opinions on certain design issues. +Here we go, folks! + + +Date: 9 November 1982 18:38-EST +From: David C. Plummer +To: CSTACY at MIT-MC +cc: BUG-ITS at MIT-MC, Bug-Twenex at MIT-XX + + Date: 9 November 1982 17:40-EST + From: Christopher C. Stacy + + + + The system ran out of ARPAnet sockets (I think) and would not accept + incoming TELNET connections. Other sites seemed to think MC had died. + I looked, and there were about a dozen 054Jnn NETRFC jobs hung in + CLFSH->XX/RDCLS<-XX. They were all doing a FINISH call at 12527. I + gunned most of them down. I dont know what this frob is for, but ALAN + looked at the job and thinks it some sort of BOJ handler for something + to do with the DOVER, like RFC133. + + What was this job, and I wonder why there were all these hung ones? + +Yes. These are wedged XX jobs. When I frequented MC I would +typically find several in one day. Either ITS has a bug closing +connections, or XX has the bug (perhaps both). I don't know NCP +so I don't know if the above state is reasonable. + +Date: 9 November 1982 17:40-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + + + +The system ran out of ARPAnet sockets (I think) and would not accept +incoming TELNET connections. Other sites seemed to think MC had died. +I looked, and there were about a dozen 054Jnn NETRFC jobs hung in +CLFSH->XX/RDCLS<-XX. They were all doing a FINISH call at 12527. I +gunned most of them down. I dont know what this frob is for, but ALAN +looked at the job and thinks it some sort of BOJ handler for something +to do with the DOVER, like RFC133. + +What was this job, and I wonder why there were all these hung ones? + +CBF@MIT-MC 11/07/82 16:23:34 Re: Comsat address & NAMES > +To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC +CC: JPG at MIT-MC +It seems that the only solution to the address space problem that avoids +removing mailing lists right and left is to move the bulk of their +contents into separate files and put entries in that are only (@FILE ...). +I presume an @FILE takes up much less space than several name in a mailing +list. + +Anyway, the problem with just going through NAMES > and arbitrarily +moving mailing lists into files is figuring out where to scatter all these +lists to. They presumably each do have individual sponsers, but it is +quite an effort to encourage each person to remove a mailing list to his own +directory. Considering what a bad idea it is to have COMSAT crashing all +the time, I would therefore suggest that a precious MFD slot be given over +to this purpose. The names LISTS seems approriate, and it can store lists +and collect log files for otherwise homeless mailing lists. This would +also provide a nice central place to look at when some disk storage is +needed (ie. by trimming old log files), which could actually result in +less disk storage being used by log files. + +I'm not volunteering to do this quite yet, but if I don't hear any +objections I may create the dir and start to do this at idle moments when +I'm bored. + + +CSTACY@MIT-MC 11/04/82 03:21:10 +To: (BUG ITS) at MIT-MC + +The pile-driving every few minutes at all hours outside +Tech Square is apparently the cause of a very gross number +of T-300 failures and problems on the CADRs. It seems to +be shaking them to death, crashing heads and doing other bad +things. + +I noticed that there were quite a few disk errors happenning +on MC tonite. Is it likely that any of these are being caused +by the vibrations from outside? + + +KLH@MIT-MC 11/03/82 19:13:57 +To: PGS at MIT-ML +CC: (BUG ITS) at MIT-MC + PGS@MIT-ML 11/03/82 08:59:39 + ML ITS 1278 has been running for 33 days now. Is this a record? + (It certainly is on ML). + +I think AI holds the record, something like 80 days. The max uptime +is stored in the creation date of SYS:RECORD TIME on each machine, +starting from 0/0/00. + + +PGS@MIT-ML 11/03/82 08:59:39 +To: (BUG ITS) at MIT-ML +ML ITS 1278 has been running for 33 days now. Is this a record? +(It certainly is on ML). + + +MP@MIT-MC 11/02/82 14:37:25 Re: size of MC's mailing list file +To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC +I sent some messages to a few lists that have been dormant for a few +years. At the very least I hope to cut out some invalid addresses, +and with luck maybe a few lists can be flushed. + +There are several lists that don't seem to have a clear maintainer, +(for instance, the chaosnet, bikes, c100-fans, calculators, and +multics-emacs lists); if they were to be moved into some indirect file +in someone's directory, it isn't obvious who that someone should be. +It would be nice to have a nice, non-volatile directory (USERS* and +GUEST* I consider volatile) to put assorted indirect files in. + + +MOON@MIT-MC 10/31/82 19:33:49 +To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC +I need to repeat my message saying that there will be no mail service on MC +if the NAMES file is not made smaller. It is completely filling Comsat's +address space. + +Date: Tuesday, 26 October 1982, 11:27-EDT +From: Patrick Sobalvarro +Subject: ai down? +To: CENT at MIT-ML, phw at MIT-OZ, eric at MIT-EECS, bug-its at MIT-MC + + CENT@MIT-ML 10/26/82 04:47:18 Re: ai down? + To: (BUG ITS) at MIT-ML + i tried to supdup from ml to ai, by saying ai^H. after giving me + the fallacious run-around about using the arpanet twice (because + i was using ml from a chaos tip), it reported Host Dead. just to + check, i tried :supdup ai /a. same result. + however, ai was up durign this time. i was able to use it from + its console. someone check this please? + +AI wasn't down; in fact, it was running perfectly. At 4:11 yesterday +afternoon, JNC took AI off the Arpanet to screw with the tips or the tacs or +whatever, and, well, he forgot to plug the boards back in. When I couldn't get +to it this morning, TY said, "Oh, shit, that must have been Chiappa," and +called him up and got him to fix it. The AI-10 is the AI Lab's only Arpanet +socket, and lots of people indirect through it to get their net mail to OZ. +Lots of important mailing lists are on AI (including BUG-ITS). AI's Arpa port +is important to this lab, and I wish there were a less casual attitude about +fucking with it. + + +SHAWN@MIT-ML 10/26/82 06:38:45 Re: ":alarm" +To: (BUG ITS) at MIT-ML + +Does the ":alarm" command REALLY work? it seems it does +the "wrong" thing for me all the time, (i.e. ":alarm .+00:" +works, and it takes it, not only that, but ":alarm .+01:" +sets for ".+17:23:55" when its 06:36:10am?), anyone +care to explain what I am doing wrong? if anything? + + Thanks + -shawn + + +CENT@MIT-ML 10/26/82 04:47:18 Re: ai down? +To: (BUG ITS) at MIT-ML +i tried to supdup from ml to ai, by saying ai^H. after giving me +the fallacious run-around about using the arpanet twice (because +i was using ml from a chaos tip), it reported Host Dead. just to +check, i tried :supdup ai /a. same result. +however, ai was up durign this time. i was able to use it from +its console. someone check this please? + +Date: 22 October 1982 03:56-EDT +From: David C. Plummer +Subject: [Forwarded: COMSAT, Re: ] +To: BUG-ITS at MIT-MC + +Sorry, I can't spel... + ------------------------------ +COMSAT@MIT-MC 10/21/82 23:30:41 Re: Msg of Thursday, 21 October 1982 23:27-EDT +To: DCP at MIT-MC +A copy of your message is being returned, because: +"BUT-ITS" at MIT-MC is an unknown recipient. + Message not sent. + Failed message follows: +------- +Date: 21 October 1982 23:27-EDT +From: David C. Plummer +To: BUG-OZ at MIT-MC +cc: BUT-ITS at MIT-MC, MT at MIT-MC, ERIC at MIT-MC + +There is a theory that part of the OZ wait-30-seconds problem is +that the AI-Chaos-11 does not always have the power to bridge +between subnets 6 and 1. If chaos sites think that ai-chaos-11 +is the best route, when indeed it cannot route, then there will +be a stalling effect until either ai-chaos-11 unwedges or +mc-io-11 becomes the best route. This could take 15 to +30 seconds depending on how wedged ai-chaos-11 is. + +If this is the problem, then I may have improved the situation. +I have modified the program that runs in ai-chaos-11 to give a +higher cost for the cable subnets than mc-io-11. This should +cause subnet 6 sites to always use mc-io-11 to get to subnet 1 +and vice-versa (except of course when mc-io-11 is down, in which +case the routing mechanism will figure out ai-chaos-11 can get +there). This will take effect at the next reload of ai-chaos-11 +(which happens to be down right now meaning no dover service to +chaos sites). + +The correct solution, of course, is to put the oz-network-11 on +subnet 6 as well as subnet 1. This is not happening due to a +lack of hardware (unibus chaos interfaces). + + +DCP@MIT-MC 10/21/82 00:09:16 +To: (BUG HOST) at MIT-MC, (BUG ITS) at MIT-MC +I modified :HOST so that it now accepts multiple host as +arguments, separated by commas. E.g., + :HOST MC,AI,ML,DM + + +MOON@MIT-MC 10/19/82 00:13:43 +To: (BUG ITS) at MIT-MC +.;crash chaos is a crash where the system ran out of chaos buffers and +got slow (so I'm told). All the buffers but one I could find were UNC's from +BAK DOVER to socket 21 (octal) on the Dover Alto. Perhaps the IO-11 had really +crashed, and that's why it wasn't swallowing the packets. Perhaps ITS should +notice when the number of packets on DLCXMQ gets large and start throwing them +away. + +Date: 18 Oct 1982 2111-EDT +From: J. Noel Chiappa +Subject: [Ben Littauer : Re: TAC/ITS telnet bug?] +To: bug-its at MIT-AI + +Mail-from: ARPANET site MIT-MC rcvd at 18-Oct-82 1844-EDT +Date: 18 Oct 1982 18:38:41 EDT (Monday) +From: Ben Littauer +Subject: Re: TAC/ITS telnet bug? +In-Reply-to: Your message of 14 Oct 1982 17:23:47 EDT (Thursday) +To: Ben Littauer +Cc: moon at SCRC-Tenex at MIT-MC, EAK @ mit-mc, REM @mit-mc, + frye at BBN-UNIX, ditmars at BBN-UNIX, herman at BBN-UNIX, + JNC at mit-mc + +Good News! (again) + +Well, the last patch wasn't QUITE enough, but we were on the right trail. +REM apparently had his hopes dashed this weekend when SU-TAC continued +displaying THE BUG. + +Further testing and reading of spagetti code proved beyond a shadow of +a doubt that the "wedging" occurred when ITS sent the TELNET IAC character +in one message, and followed with the DataMark in the next. Thumbing +through the coroutines eventually showed that we were returning wrong +in this case. + +I have a patch, already in SU-TAC, which will be released to the rest of +the net tomorrow morning. It still is possible that there is some other +case which causes wedging, so I won't claim that it can't happen again, +but I don't think that it will. + +Sorry for the first false hopes, hope this one works... + + -ben- + + +------- + +Date: 16 Oct 1982 1629-EDT +From: J. Noel Chiappa +Subject: [Ben Littauer : Re: TAC/ITS telnet bug?] +To: bug-its at MIT-MC + +Mail-from: ARPANET site MIT-MC rcvd at 14-Oct-82 1818-EDT +Date: 14 Oct 1982 17:23:47 EDT (Thursday) +From: Ben Littauer +Subject: Re: TAC/ITS telnet bug? +In-Reply-to: Your message of 14 Oct 1982 11:26:31 EDT (Thursday) +To: Ben Littauer +Cc: moon at SCRC-Tenex @ MIT-MC, EAK @ mit-mc, REM @mit-mc, frye at BBN-UNIX, + ditmars at BBN-UNIX, herman at BBN-UNIX, JNC at mit-mc + +Good news! + +I found a local ITS afficionado, and with his help I was able +to get the bug to happen. I discovered that what was happening +was that the TAC would receive an NCP INS, which TELNET needs +as a signal to start discarding terminal output, but it was +not finding a matching TELNET DataMark in the data stream, +the signal to STOP discarding terminal output. The funny thing +was that the symptoms were so intermittent. + +Reading the TAC code, I found that if we receive a message +containing the TELNET intercept character, IAC, in one message, +and the DataMark was the first character of the next message, +then the TAC would fail to see the DataMark. I have patched +my test TAC and have since been unable to re-create the bug. +I therefore hypothesize that ITS will occasionally send the IAC +in one message and the DataMark in another: can any ITS network +hackers verify or refute this? + +ARPANET TACs should have received the patch by tomorrow morning, +so I would greatly appreciate hearing whether there is indeed a +difference. It is possible that this fix will also cure the +flakiness seen in negotiating TELNET binary mode with the TAC; +anybody who has experienced those difficulties, PLEASE tell me +if there is any change. + +I'm sorry this bug has been hanging (no pun intended) around so +long, but I thank you for your patience and perseverence; we +do want to hear about bugs, and we try to fix them as soon as +possible, but the ones that people are finding now are getting +to be the more subtle ones, so they do take longer... + +Your friendly neighborhood TAC "wizard". + -ben- + +------- + +CSTACY, PGS, ELLEN@MIT-MC (Sent by CSTACY@MIT-MC) 10/15/82 15:13:08 Re: for future reference +To: (BUG ITS) at MIT-MC +MC would not come up this afternoon due to some sort of +lossage in the T300 subsystem. Running CHKR showed +that it couldnt frob the T300s; power cycling unit 3 +de-confused it and the system came up ok. + + +Date: Wednesday, 13 October 1982 05:31-EDT +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: DCP at MIT-OZ, bug-its at mc +cc: twenex-haters at MIT-OZ + +AI is being backed up these days, and its disks seem fairly stable. The +processor hardware is not currently flaking out, although we have no idea how +long that will last. When I connect to it, often in the daytime, I am usually +the only user using it. If we do indeed reconnect AI to the Chaosnet, then +it'll make a pretty good mail computer, so I see no reason not to leave +BUG-RANDOM-PROGRAM on it. + +Something we should take note of here is that Eric Ostrom, in his capacity as +AI Lab Facilities Coordinator or some fancy title, has tracked down a KL Model +A CPU (a la MC) that is being sold for $7500, supposedly in working order. The +idea is to provide a machine of MC's power to AI lab members who prefer ITS to +Twenex. If we bought one it would probably go where AI is now, both physically +and spiritually (including network ports). Extra space would need to be +allotted for memory; presumably 921 (Marty's office) would go away. + +Everyone who would like to see AI have a KL Model A running ITS should send a +message to the effect to Eric@ee (not at OZ, where he doesn't read his mail), +and CC it to PHW. Something strong along the lines of "I understand you're +considering getting a KL to run ITS, well, do," is probably appropriate. +------- + + +Date: 10 October 1982 23:52-EDT +From: David A. Moon +To: PGS at MIT-OZ +cc: BUG-ITS at MIT-MC, akr at MIT-OZ + + Date: Sunday, 3 October 1982, 03:10-EDT + From: Patrick Sobalvarro + To: bug-its at MIT-OZ at MIT-MC + Cc: akr at MIT-OZ at MIT-MC + + Alex Krymm (our new hardware person) has agreed to take a look at the prints + for ML's Chaosnet interface and consider building one for AI. + + Questions: + Is it really worth it? That is, will this just be a lot of thankless work for + him? Or is it comparatively simple? Is someone who understands the hardware + well around to answer the occasional question? +I'll be happy to answer questions within the limited amount of time I have +available. + + Would he have to do + wirewrapping, or do we have wirelists that we can send to Augat? +Of course not. It would be machine-wrapped. + +The only issue is finding documentation on the AI TTL I/O bus plus figuring +out whether it is still there. It is unlikely to be 100% compatible with +the ML/DM TTL I/O bus, hence the Chaosnet interface would need some small +changes. If it's not still there it would need to be retrieved from wherever +it went and hooked up again. I imagine Knight could help with this. + +DCP@MIT-MC 10/10/82 14:19:44 +To: (BUG ITS) at MIT-MC +How willing are we to trust AI for mail? Specifically, should +BUG- go to AI and probably end up in +BUG-RANDOM-PROGRAM. Doing the conversion is not a trivial +matter, since there are probably several lists which depend on +this happening and winding up on AI. Alternatively, AI isn't +doing that much as it is, so maybe that is a good place for the +COMSAT computrons??? + + +GJC@MIT-MC (Sent by GJC0@MIT-MC) 10/08/82 16:14:19 Re: The second most popular PDP-11 operating system on the NET? +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC +According to the FAX I gathered for SYSENG;HOSTS >, using NUMER;HOSTP, +the most popular pdp-11 operating system on the "net" is UNIX, with 64 sites. +The second most popular is MINITS with 27 sites. + + +Date: 8 October 1982 00:04-EDT +From: Alan Bawden +Subject: GENSYM servers??????? +To: GJC at MIT-MC +cc: BUG-ITS at MIT-MC + + Date: 7 October 1982 21:01-EDT + From: George J. Carrette + Re: GENSYM servers??????? + + yow + +You know about the YOW server on CCC? Give it a try. + + +GJC@MIT-MC 10/07/82 21:01:11 Re: GENSYM servers??????? +To: ALAN at MIT-MC +CC: (BUG ITS) at MIT-MC +yow + +Date: 7 October 1982 18:07-EDT +From: Alan Bawden +Subject: ON MC +To: GJC at MIT-MC, DCP at MIT-MC +cc: BUG-ITS at MIT-MC + + Date: 10/07/82 11:57:18 + From: GJC + + We seem to have a lot of jobs like + ___*** CHAOS GENSYM ...... MPV and ILOPR + since people from Plasma have to lot in I'm going to gun these now. + Maybe it is intermittent? + +I fixed the problem. When they rejected connections these GENSYM servers were +POPJing off the bottom of the stack which generally caused them to jump into the +accumulators... + + +GJC@MIT-MC 10/07/82 11:57:18 Re: ON MC +To: (BUG ITS) at MIT-MC +We seem to have a lot of jobs like +___*** CHAOS GENSYM ...... MPV and ILOPR +since people from Plasma have to lot in I'm going to gun these now. +Maybe it is intermittent? + + + +Date: 7 October 1982 06:53-EDT +From: David C. Plummer +Subject: CPI numbers +To: BUG-ITS at MIT-MC, ALAN at MIT-MC, Bug-TWENEX at MIT-XX +cc: cm-i at MIT-OZ + +CHAOS EOF packets: + +There are two things going on here. First is that ITS will allow +an EOF packet to be sent that has a non-zero bytelength for the +data field. I don't think this is right. Second is that doing a +TWENEX SIN JSYS on a chaos channel which has received an EOF will +give you the bogus data in the EOF before signalling the end of +file. + +Case in point: The gensym server on MC originally didn't set the +byte length of the EOF, so twenex would print whatever happened +to be in the packet at the time. For example, + @type cha:mc.gensym_foobar + 19EGSNMYF OOAB +instead of just + 19 + + +To Alan and cm-i: The GENSYM server has been fixed to no tickle +either bug. + + +Date: Wednesday, 6 October 1982, 06:07-EDT +From: Robert W. Kerns +Subject: archive device overload +To: Alan Bawden +Cc: BUG-ITS at MIT-MC, BUG-LMODEM at MIT-MC +In-reply-to: The message of 2 Oct 82 16:58-EDT from Alan Bawden + + Date: 2 October 1982 16:58-EDT + From: Alan Bawden + 1) Is it really the case that there can't be more than about 8 jobdevices at + any one time? I guess this is reasonable since there usually isn't any more + than about 4 active at any one time. +Yes. + 2) I hope that the LMODEM program is taking the proper precautions to prevent + the user from using up infinite channels. The maintainers should spend a + minute or two thinking about correctly unwind-protecting their program so that + this can't happen if they haven't already (in which case they should think + about possible bugs). + +In this case, it isn't LMODEM's problem. They're staying around after +LMODEM's channels have been closed. + + 3) What are archive devices waiting for when they go to sleep? Normally they + seem to hang. These behaved as if they were waiting for a lock to free up. + (The fact that they all disappeared after I gunned a couple presumably + indicates that archive devices take the correct actions to insure that locks + will be unlocked when jobs get killed.) Is there some sort of deadly embrace + that is known to happen? + +Usually they're waiting for the lock to be freed that is held by +whichever one of them that got the error. Generally, the error is a +clobbered archive. It used to be true, may still be true, that having +the archive too large to map would cause it to be permanently broken +in this way. + + 4) Since the job on the user end of the job channel had gone away, shouldn't + the job devices have been told about it? I don't find anything specific in the + job device documentation about what happens when the user goes away, but I + thought that the system simulated a .CLOSE on any channels associated with + any terminated jobs, but this would have cleaned things up wouldn't it? + (I just tried this myself, and that seems to be the case...) +Yes, but the ARCHIVE device doesn't allow any of this until it's +gotten the lock. + 5) Perhaps the .SLEEP that the archive device is using (where?) shouldn't be + forever, but instead it should wake up every five minutes and be sure it still + has a reason to live. +Something like that. + +Date: Sunday, 3 October 1982, 03:10-EDT +From: Patrick Sobalvarro +To: bug-its at MIT-OZ at MIT-MC +Cc: akr at MIT-OZ at MIT-MC + +Alex Krymm (our new hardware person) has agreed to take a look at the prints +for ML's Chaosnet interface and consider building one for AI. + +Questions: +Is it really worth it? That is, will this just be a lot of thankless work for +him? Or is it comparatively simple? Is someone who understands the hardware +well around to answer the occasional question? Would he have to do +wirewrapping, or do we have wirelists that we can send to Augat? + + +Date: 3 October 1982 02:11-EDT +From: Pandora B. Berman +Subject: Lord of Light reincarnated +To: BUG-ITS at MIT-AI +cc: ALAN at MIT-AI + +with advice from moon and much assistance from alan (who did most of +the actual work), Puff-The-Magic namedragon has been copied over from +ML to do namedragonish things like keeping track of logout times. +apparently the LOGOUT TIMES file has not been written to since the +knight tvs were last patched out (presumably Taraka Namdrg wants to +display on them before modifying the file?). + +we first considered patching Taraka Namdrg to not try to write out to +the knight tvs, but that proved much too hairy. + +Date: 2 October 1982 16:58-EDT +From: Alan Bawden +Subject: archive device overload +To: BUG-ITS at MIT-MC, BUG-LMODEM at MIT-MC + +I noticed that my attempts to use the DIR device were reporting DEVICE FULL +errors, and since the system was far from full I deduced that we had run out of +some resource specific to jobdevices. Sure enough, there were eight or so +sleeping archive devices. They were all associated with a nonexistant job that +had presumably once been named LMODEM. (Although PEEK could have been +mistaken about this if the job number had been recycled, the fact that they +were all using an archive on the CPM directory backs this up.) I gunned a +couple of them and suddenly the rest disappeared. I have several questions: + +1) Is it really the case that there can't be more than about 8 jobdevices at +any one time? I guess this is reasonable since there usually isn't any more +than about 4 active at any one time. + +2) I hope that the LMODEM program is taking the proper precautions to prevent +the user from using up infinite channels. The maintainers should spend a +minute or two thinking about correctly unwind-protecting their program so that +this can't happen if they haven't already (in which case they should think +about possible bugs). + +3) What are archive devices waiting for when they go to sleep? Normally they +seem to hang. These behaved as if they were waiting for a lock to free up. +(The fact that they all disappeared after I gunned a couple presumably +indicates that archive devices take the correct actions to insure that locks +will be unlocked when jobs get killed.) Is there some sort of deadly embrace +that is known to happen? + +4) Since the job on the user end of the job channel had gone away, shouldn't +the job devices have been told about it? I don't find anything specific in the +job device documentation about what happens when the user goes away, but I +thought that the system simulated a .CLOSE on any channels associated with +any terminated jobs, but this would have cleaned things up wouldn't it? +(I just tried this myself, and that seems to be the case...) + +5) Perhaps the .SLEEP that the archive device is using (where?) shouldn't be +forever, but instead it should wake up every five minutes and be sure it still +has a reason to live. + +Date: Saturday, 2 October 1982, 10:31-EDT +From: Robert W. Kerns +Subject: [MINSKY at MIT-OZ: clucftp] +To: Christopher C. Stacy +Cc: Bug-Twenex at MIT-XX, Bug-ITS at MIT-MC, MINSKY at MIT-OZ +In-reply-to: The message of 2 Oct 82 04:26-EDT from Christopher C. Stacy + + Date: Saturday, 2 October 1982, 04:26-EDT + From: Christopher C. Stacy + This is reproducable. Anyone have any ideas why? + + + Date: 30 Sep 1982 0032-EDT + From: MINSKY at MIT-OZ + Subject: clucftp + To: cstacy at MIT-OZ + cc: minsky at MIT-OZ + + When I use "get" to MC, it complains "bad format packet recieived". + It used to work. Has anything changed? +Possibly because of the addition of the AUTHOR to the OPEN response? + + +Date: Saturday, 2 October 1982, 04:26-EDT +From: Christopher C. Stacy +Subject: [MINSKY at MIT-OZ: clucftp] +To: Bug-Twenex at XX, Bug-ITS at MC + +This is reproducable. Anyone have any ideas why? + + +Date: 30 Sep 1982 0032-EDT +From: MINSKY at MIT-OZ +Subject: clucftp +To: cstacy at MIT-OZ +cc: minsky at MIT-OZ + +When I use "get" to MC, it complains "bad format packet recieived". +It used to work. Has anything changed? +------- + + +Date: 30 Sep 1982 2002-EDT +From: J. Noel Chiappa +Subject: [Ben Littauer : TAC/ITS telnet problems] +To: bug-its at MIT-MC + +Mail-from: ARPANET site MIT-MC rcvd at 30-Sep-82 1601-EDT +Date: 30 Sep 1982 15:52:57 EDT (Thursday) +From: Ben Littauer +Subject: TAC/ITS telnet problems +To: REM at mit-mc, POURNE at mit-mc, EAK at mit-mc, JNC at mit-mc +Cc: frye at BBN-UNIX, ditmars at BBN-UNIX, clifford at BBN-UNIX, littauer at BBN-UNIX + + +There has been a lot of traffic recently about this TAC/ITS telnet bug. +There are many misconceptions about what is going on in the TAC, and I +can only assume that much of the speculation I see about what ITS is doing +is also wrong. I am currently looking into this problem, and trying to +sort out the facts. It would be helpful if I had a contact at MIT who +could get me access to and account on MIT-MC and who would KNOW what MC +is supposed to do in these funny situations. Any volunteers? I expect +to be doing some investigation during this coming week. I can be +reached via netmail or at BBN (497-3196). + +One major confusion about the TAC relates to its buffer sizes. The TAC +has static buffering on input and dynamic buffering on output, and both +input and output buffers are relatively small. The TIP's buffers could +be of any size, depending on the configuration of the machine. The TAC +does not have, nor will it ever have, 1000 character buffers for 63 +terminals in a 32K word machine... + -ben- + +------- + + +Date: 28 Sep 1982 2119-EDT +From: J. Noel Chiappa +Subject: Re: Anyone know why ITS got unfriendly? +To: EAK at MIT-MC, POURNE at MIT-MC +cc: BUG-ITS at MIT-MC, JNC at MIT-XX +In-Reply-To: Your message of 28-Sep-82 2026-EDT + + I'll forward your message to the TAC maintainer, Clifford@BBN-UNIX, +and see what we get back. +------- + + +Date: 28 September 1982 20:26-EDT +From: Earl A. Killian +Subject: Anyone know why ITS got unfriendly? +To: POURNE at MIT-MC +cc: BUG-ITS at MIT-MC + +Because the TACs (the new TIP) seem to misimplement to TELNET +protocol. When ITS tries to flush the data in the network using +the same method that works on TIPs it causes things to come to a +grinding halt. I suspect someone just removed the code that +attempts to do the flushing as begin better than wedging. + + +GJC@MIT-MC 09/27/82 16:57:13 +To: (BUG ITS) at MIT-MC +I've noticed a funny intermittent bug from local MC terminals today. +The characters "IOB" sometimes end up in the input stream randomly +when other keys are typed. I've noticed this both on TTY 31 and +on the VT52 near the system consol on the 9'th floor. + + + +dcp, alan@MIT-MC (Sent by DCP@MIT-MC) 09/25/82 03:56:43 Re: What is the value of L?? +To: (BUG ITS) at MIT-MC + + On MC ITS 1278, right now!! + + sys^K + l= 134007 + + What!!!! This causes :VV to break, but that's a minor detail at + this point. I loaded @ ITS and @ NITS into a job and L was 1000 + as expected. I guess somebody decided to take a walk through the + in core symbol table. LUBLK is still 1000 (thank god, otherwise + PEEK would also be broken). + + (On ML and DM it's 742, and AI is 745.) + +Fixed in the running system (without knowing (or finding) where +the symbol table is in memory). + +Date: 24 September 1982 09:49-EDT +From: Christopher C. Stacy +Subject: ai namedragon +To: CENT at MIT-AI +cc: BUG-ITS at MIT-MC + + +There being no TV-11 anymore, I retired the name dragon. + + +Date: 24 September 1982 04:12-EDT +From: Pandora B. Berman +Subject: ai namedragon +To: BUG-ITS at MIT-AI + +for at least the past few weeks, taraka has been consistently hanging onto +whatever verion of lsr1 was lsr1 1 when taraka was started up. that is, +taraka is NOT checking at intervals for a newer version and releasing the old +one to be deleted. it seems the only way to change tarka's idea of what +is the current version of the database is to gun taraka and start a new one. +this is much less than optimal. please investigate. + +Date: 23 September 1982 03:28-EDT +From: David C. Plummer +Subject: Whither XGP? +To: GUMBY at MIT-MC +cc: PGS at MIT-MC, BUG-ITS at MIT-MC, DLW at MIT-OZ + +[Is BUG-ITS the right place for all of this??] + +My Versatec spooler understands KST files; it has nothing to do +with the Versatec. If you read DCP;PRESS ANOUNC you will see +that when the Versatec spooler TRIES to do press files, it +translates the press fonts into somee (hopefully) reasonable XGP +font. + +If you are trying to get closer to the state of the art, flush +XGP format files. In theory (if I turned on XGP file recognition +in the spooler), XGP files produced by R come out correctly, but +XGP files produced by TJ6 or BOLIO (and I think @) cause it to +crash. This is interesting, becuase the :DOVER program does the +exact opposite (does everything (as far as I can tell) EXCEPT R +produced XGP files). "Well, why don't you look at :DOVER to see +how it does it?" you might ask. I did; it is just as +incomprehensible when it comes to XGP files as anything else I've +seen. + +Date: 22 September 1982 23:21-EDT (Wednesday) +Sender: GUMBY at MIT-OZ +From: David Vinayak Wallace +To: PGS at MIT-MC +Cc: bug-its at mc, DLW at MIT-OZ +Subject: Whither XGP? + +does the versacrock support KST fonts? I know it can't support +tj6-style XGP files. Plummer said he would try to do it if he could +find documentation on XGP-format files. i tried to find this a couple +of years ago when I wanted to generate them with the lisp machine, but +nobody knew where any sort of real documentation was. The best I could +do was discuss scan format with RWK. +With respect to "state of the art" ... are there really any equivalent +printers (i.e. 200 dots to the inch)? +------- + + +Date: Wednesday, 22 September 1982 15:39-EDT +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: David Vinayak Wallace +Cc: bug-its at mc, DLW at MIT-OZ +Subject: Whither XGP? + +Frankly, now that we have the Versatek on the seventh floor working, and there +is the possibility of getting Canon laser printers, I think we should throw the +XGP and associated hardware out, or give it away, or whatever. Re-interfacing +it would take more people-hours than we can afford these days, and if we were +going to spend them anyway, we might as well get something closer to +state-of-the-art out of it. +------- + + +Date: Wednesday, 22 September 1982 14:10-EDT +Sender: KLOTZ at MIT-OZ +From: KLOTZ at MIT-MC +To: DLW at MIT-OZ +Cc: bug-its at mc, David Vinayak Wallace +Subject: Whither XGP? + +I suggest we give the XGP to Concourse, if we are allowed to. +------- + + +Date: 22 Sep 1982 0948-EDT +From: J. Noel Chiappa +Subject: Re: Whither XGP? +To: GUMBY at MIT-MC, bug-its at MIT-MC +cc: JNC at MIT-XX +In-Reply-To: Your message of 21-Sep-82 1816-EDT + + ML has it's own private direct PDP-10 interface to the CHAOS +net. I don't know if you could plug the XGP-11 into the DL-10 (or the +DTE, if it's a multi-11 one) on MC without buying new hardware, but I +doubt it. In any case, the software would require tons of work, and +I doubt there is anyone at MIT competent to do it. Basically, you're +out of luck. +------- + + +Date: Wednesday, 22 September 1982 07:42-EDT +Sender: DLW at MIT-OZ +From: DLW at MIT-MC +To: David Vinayak Wallace +Cc: bug-its at mc +Subject: Whither XGP? + +ML talks to the Chaosnet directly, with a PDP-10 Chaosnet interface. +There are no PDP-11s on ML. + +The XGP talks to its through the 10/11 interface, which is a broken +and one-of-a-kind beast. It would be a great, great deal of work +to interface the XGP in any other fashion. +------- + + +Date: 21 September 1982 18:16-EDT (Tuesday) +Sender: GUMBY at MIT-OZ +From: David Vinayak Wallace +To: bug-its at mc +Subject: Whither XGP? + +How does ML talk to the Chaosnet? Does it use a 10/11 interface? +A number of people have been screwed (including everybody in 6.001) +because the XGP vanished. Would it be possible to put the XGP on +either ML or MC, at least until large fixed-width fonts exist for +either the dover or whatever new hardware we get? +------- + + +Devon@MIT-ML 09/10/82 06:12:13 Re: AI's broken Ten-11 interface +To: (BUG ITS) at MIT-ML, TK at MIT-ML +When the Ten-11 interface is enabled, AI goes into an infinite loop +while trying to initialize the Chaos-11's buffers. The NXM light stays +off when it's running, but it quickly lights up when single-stepping. +This occurs around pc=60477 (T11CK2) with the TV-11 disabled (so it +won't die trying to hack the TV-11). Single-stepping this loop seems to +show a SETZM instruction skipping. Perhaps the single-step key is +bouncy, but this instruction is trying to write a zero into the Chaos-11 +so it might be related to the Ten-11 failure. Would someone look at the +crash dump in the file AI:CRASH;TREE TOAD and check this out? AI is +only available via ARPAnet because it can't talk to the PDP-11's. + +Date: 9 September 1982 01:58-EDT +From: Devon S. McCullough +To: DCP at MIT-MC +cc: BUG-ITS at MIT-MC, FJW at MIT-MC + + DCP@MIT-MC (Sent by DCP0@MIT-MC) 09/07/82 12:35:41 + To: DEVON at MIT-MC + CC: (BUG ITS) at MIT-MC + DEVON@MIT-MC 09/07/82 06:35:11 + One question? If ITS sends a IAC WILL BINARY to a TIP or + TAC, does this turn off interpretation of the IAC character + somehow, so it should no longer be doubled? That would be + nasty. + + An IAC is only doubled when a 377 wants to pass all the way + through the TELNET stream. This is still the case when a machine + is in TRANSMIT BINARY. + + I think there is a big difference of opinion on the intercept + character issue. Characcters go from KEYBOARD to COMMAND + PROCESSOR to TELNET STREAM to FOREIGN TELNET STREAM. Normally + the command processor passes through characters to the telnet + stream, unless the intercept character is typed. The impression + from some people I get is that if the TAC goes into TRANSMIT + BINARY, then the command processor will not trap the intercept + character. Well, my opinion is that that is a completely + cretenous behavior. TRANSMIT BINARY only has to do with the + TELNET STREAM, and not the COMMAND PROCESSOR. If TACS will not + intercept @ when in TRANSMIT BINARY, then it is in violation of + the description of TRANSMIT BINARY found in the April 1976 + ARPANET PROTOCOL HANDBOOK. I doubt it has changed. + +There is a difference in opinion. The command processor is free to +decide when it's appropriate to catch the intercept character and when +it's not, and currently it does the most reasonable thing. + +TIP users would be grossly inconvenienced if command characters were +intercepted in binary mode. Fortunately they aren't. This issue is +totally outside the scope of the protocol, and I saw no mention of it +in the APRAnet Protocol Handbook - can you give me a page number? + +DCP@MIT-MC (Sent by DCP0@MIT-MC) 09/08/82 01:17:01 +To: (BUG DECUUO) at MIT-MC +CC: (BUG ITS) at MIT-MC +Just curious, What is the kludge in DECUUO that requires the +second word of a UNAME entry in the MFD to be zero?? + +DCP@MIT-MC (Sent by DCP0@MIT-MC) 09/07/82 12:35:41 +To: DEVON at MIT-MC +CC: (BUG ITS) at MIT-MC + DEVON@MIT-MC 09/07/82 06:35:11 + One question? If ITS sends a IAC WILL BINARY to a TIP or + TAC, does this turn off interpretation of the IAC character + somehow, so it should no longer be doubled? That would be + nasty. + +An IAC is only doubled when a 377 wants to pass all the way +through the TELNET stream. This is still the case when a machine +is in TRANSMIT BINARY. + +I think there is a big difference of opinion on the intercept +character issue. Characcters go from KEYBOARD to COMMAND +PROCESSOR to TELNET STREAM to FOREIGN TELNET STREAM. Normally +the command processor passes through characters to the telnet +stream, unless the intercept character is typed. The impression +from some people I get is that if the TAC goes into TRANSMIT +BINARY, then the command processor will not trap the intercept +character. Well, my opinion is that that is a completely +cretenous behavior. TRANSMIT BINARY only has to do with the +TELNET STREAM, and not the COMMAND PROCESSOR. If TACS will not +intercept @ when in TRANSMIT BINARY, then it is in violation of +the description of TRANSMIT BINARY found in the April 1976 +ARPANET PROTOCOL HANDBOOK. I doubt it has changed. + +DEVON@MIT-MC 09/07/82 08:01:07 +To: (BUG ITS) at MIT-MC +I spent several hours this morning trying to track down a sporadic TAC or TELSER bug +wherein either the TAC gets wedged and refuses to accept binary output when ITS wants +to do so, or else it accepts and TELSER is too wedged to notice the ack from the TAC. + +Couldn't duplicate it once the symptoms became clear enough to try to get them on purpose. +Who has done this before? Is there some interaction or protocol change I'm unaware of? +I'm not sure whether the TAC or TELSER is at fault. The basic symptom is that I will +send IAC WILL BINARY (I do :imgout 377 373 0 at DDT) and the TRBINF in telser stays zero. +Alternating between WILL and WONT produces no effect either. + +DEVON@MIT-MC 09/07/82 06:35:11 +To: (BUG ITS) at MIT-MC +One question? If ITS sends a IAC WILL BINARY to a TIP or TAC, does this turn off interpretation of the IAC character somehow, so it should no longer be doubled? That would be nasty. + +Date: 7 September 1982 06:29-EDT +From: Devon S. McCullough +Subject: connecting to ITS from an ARPAnet TAC +To: BUG-ITS at MIT-MC +cc: DCP at MIT-MC, FJW at MIT-MC, EB at MIT-OZ + +TelSer should always initialize TelNet connections with IAC WILL BINARY. + +TCTYP really should try to adjust a TIP or TAC connection when %TPMTA +is called for, maybe by means of a new keyword, like EIGHT or META. +If connected via a TIP/TAC, TCTYP should then issue IAC DO BINARY. + +Extensive experiments tonight with USC-TAC show that everything will +work fine if you tell a TAC that ITS is going to transmit binary. + +It works well for some people to ask the TIP/TAC to transmit binary, +but this disables @ interception, and will thus screw many TIP/TAC +users. The only way they'd have to undo this is either hang up and +redial the TIP/TAC, or log out and wait for TelSer's 2 minute timeout. +Since I need this feature to enable my terminal's META key, I have +fixed my login file to do :IMGOUT 377 373 0 and logout to do :IMGOUT +377 376 0 when my TCTYP specifies %TPMTA. These magic numbers are IAC +DO BINARY and IAC DONT BINARY respectively. + +Apropos nothing in particular, the TIP manual claims that if the host +sends 207 ^J to a TIP in OLD TELNET it will work as if the +user had typed @ ^J on his terminal, but it does work on +TACs so I guess New TelNet never evolved a replacement for this +necessary feature, or are they STILL ruinning OLD TELNET??? + +Date: 5 September 1982 14:09-EDT +From: David C. Plummer +Subject: MINITS supdup to MC +To: KMP at MIT-MC +cc: PGS at MIT-MC, PGA at MIT-MC, BUG-ITS at MIT-MC, + BUG-MINITS at MIT-MC + +I believe there is a bug-minits mailing list. Anyway, + +I think MINITS does do the decrement hack necessary for ITS. I +can not make it fail on my AAA which is connected to a MINITS and +I am SUPDUPing to MC. I have tried printing files which have +lines lengths greater than that of the terminal and cannot make +it fail. I suspect the problem is actually the setup modes of +the terminal. ITS assumes (or enforces in the initial string) +and MINITS assumes (but does not currently have an initial string +to enforce it with) that /terminals/ DO NOT automatically wrap +when a character is displayed on the last column. This may be a +personal preference, but if you are on an AAA and if the second +bit of setup mode D is on, turn it off and tell me if it still +loses. If you type S to get out of setup, it will save the +current configuration (and hope you dont have wars over the +proper modes). + + +Date: 5 September 1982 01:58-EDT +From: Kent M. Pitman +Subject: MINITS supdup to MC +To: PGS at MIT-MC, PGA at MIT-MC +cc: BUG-ITS at MIT-MC + +When Supdup'ing to MC, MINITS (I guess) incorrectly supports over-run lines. +it seems that they don't end up incrementing ITS' notion of what line it's +on, so at the bottom of the screen, some hardware scrolling happens because +ITS doesn't realize soon enough that it's time to give a --more-- break and +pop to the top of the screen. this effect is easy to reproduce. +just print a file which has lines longer than the line length and watch what +happens as you reach the bottom of the screen. + + +Date: 3 September 1982 21:45-EDT +From: David C. Plummer +To: DEVON at MIT-MC +cc: DCP at MIT-MC, BUG-ITS at MIT-MC + +I think you are confused (though it could be me). DO TRANSMIT +BINARY does not mean the TAC can't trap its escape character, itjust +means it should not do any special processing on the characters. +There is another option I belive for complete binary transmission +which cannot be reverted; I do not think TRANSMIT BINARY is that option. +I gues one of us should check the protocol specification... + + +Date: 3 September 1982 21:42-EDT +From: Devon S. McCullough +To: DCP at MIT-MC +cc: BUG-ITS at MIT-MC + +DO TRANSMIT BINARY would screw people who try to close their ITS +connection and reconnect, since in binary mode the TIP (TAC) does not +hack local user commands. Perhaps the TIP/TAC ressets this when you +close the connection? It would still be boring to logout and have to +wait until TelSer gets around to closing your connection. + +Currently TelSer knows about CR and CRLF and sets your TCTYP in +accordance with the protocol you are sending, so this is no problem. + +DCP@MIT-MC 09/03/82 17:30:31 +To: (BUG ITS) at MIT-MC +Is there any reason why ITS should change a %TDFS into a space +on overprinting terminals? Here is the problem: + +I am on an overprinting terminal, SUPDUPing to ITS. I Telnet +to a system that can't deal with overprinting terminal. VAX VMS +and I think VAX Unix have this problem. When using CHTN, I toggle +VT52 emulation mode and tell the VAX I have a vt52 (with perhaps +a higher screen). When the foreign system sends an ESCAPE C (or +whatever it is that goes forward), CHTN tells ITS to go forward. +When ITS is sending to a replacing terminal, it sends %TDFS (I hope), +but for an overprinting terminal (which it still thinks I am in this +case), it sends a space (which unfortunately is now destructive). + + +Date: 3 Sep 1982 1213-EDT +From: J. Noel Chiappa +Subject: TelSer +To: DEVON at MIT-MC +cc: BUG-ITS at MIT-MC, JNC at MIT-XX + + Sounds like a good idea to me. Will any ITS wizards out there +speak up if this is unreasonable? Otherwise, I'd say do it. +------- + + +DCP@MIT-MC 09/03/82 12:00:23 +To: DEVON at MIT-MC +CC: (BUG ITS) at MIT-MC +If TELSER sends WILL TRANSMIT BINARY, then that only allows ITS +to send binary to the TAC. You also want DO TRANSMIT BINARY +which lets the TAC legally send binary to ITS. I aggree that +most times there will be no noticiable difference in terminal +handling. When a user types both RETURN and LINEFEED to +something like DDT, ITS may get marginally confused, but thems +the breaks. + +I do not use TACs. Somebody that does should try out a new +TELSER on MC or ML some night and see if it works. Make sure CR, +LF, and CR LF all do what you expect. Compare with old behavior. + + +DEVON@MIT-MC 09/03/82 03:22:06 +To: (BUG ITS) at MIT-MC +When TIPs were generally used, the default output mode was (apparently) binary, but now that TACs are in vogue, terminal programs that used to work with TIPs lose, because they are only receiving 7 bits. Perhaps TelSer should WILL Transmit Binary, which is necessary in some cases and harmless otherwise. + +Date: 30 August 1982 05:48-EDT +From: Christopher C. Stacy +Subject: TV +To: BUG-ITS at MIT-AI + +seems to drop bits. My ^C in previous :MAIL echoed as ^B but worked. + +Date: 30 August 1982 05:48-EDT +From: Christopher C. Stacy +To: BUG-ITS at MIT-AI + +Sometimes when I am using a Knight TV, my screen +gets garbled. I dont know what part of the TV +system (10,11, or 10/11) is losing. + +Date: Saturday, 28 August 1982 02:40-EDT +To: cstacy at MIT-OZ +Sender: RPS at MIT-OZ +from:cent +Subject:ai problems & bughalts +cc: bug-its at MIT-OZ + +chris, leaving yellow-pad notes on the ai system console is better than +nothing as a way to indicate what its particular brokenness is, but +ignores the problem that the note might fall off. please record the +brokenness state in the ai system logbook, so other people will know +what's going on (also for a semi-permanent record -- lossage like the +disk breaking needs to become part of general memory). thx. +------- + +Date: 23 August 1982 10:36-EDT +From: Devon S. McCullough +Subject: H19 emulators, and lossage and ANSI mode +To: PGS at MIT-MC +cc: BUG-ITS at MIT-OZ + +A bit would be cleaner, after all TCTYP can be told that HDS means H19 ++ some bit, just as GLASS means PRINTING with some different bits. + +Date: Monday, 23 August 1982 08:52-EDT +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: DEVON at MIT-MC +cc: BUG-ITS at MIT-OZ +Subject:H19 emulators, and lossage and ANSI mode + +In implementing multiple insert/delete line for H19's, I used ANSI mode because +it was the only way to get it (as I imagine you know if you wrote an emulator). +This is what CRTSTY does. Looks to me like there are two possibilities; a new +terminal type could be implemented (call it HDS or whatever) that would output +only HDS codes, or a bit could be defined to say don't do multiple operations. +I guess I'll do one of them when I get back. If anyone thinks one way is more +tasteful than the other, let me know. I lean towards a separate type because +it's easier to do :TCTYP HDS than :TCTYP H19 NO MULTIPLE (or worse yet, specify +the bits). +------- + +DEVON@MIT-MC (Sent by DEVON7@MIT-MC) 08/20/82 08:10:24 +To: (BUG ITS) at MIT-MC +certain h-19 emulators don't support ANSI mode and no longer work with the latest ITS. +short-distance screen scrolling in EMACS still works, but when trying to scroll the +text a long way it just puts trash on the display, and I have to clear the screen (slow) +Since the emulation I'm using is on a micro i suppose I could try to hack some new code, +but the display driver has limited memeory in which to live, because when screen RAM is +mapped in, most user RAM is mapped out to make room for the video. + +perhaps TECO can be kludged with some flag saying to insert/delete one at a time? + +Date: 18 Aug 1982 0423-EDT +From: DEVON at MIT-DMS (Devon S. McCullough) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].241228> + +using a TIP, it was never necessary to do @b o s, but now with TAC's it is. +To avoid inconveniencing the user, how can this be done from ITS? + + + +Date: 16 August 1982 19:52-EDT +From: David C. Plummer +To: REM at MIT-MC +cc: BUG-ITS at MIT-MC, MIT-IN-PEOPLE at MIT-MC + + REM@MIT-MC 08/16/82 09:12:29 + I am getting no echo whatsoever. + I am typing this blindly. + I pressed ctrl-S to stop output on second window (screen) of + a ^R (PRINT), which has been doing this for weeks since the + SU-TAC was installed. + +My theory is that ITS is doing an output reset, which is turning +into a data mark or interrupt process or something in the TELNET +protocol, and that TACs don't understand this. You will probably +find that ^G will do the same thing. Has the TELNET protocol +dropped this feature? Is ITS doing the wrong thing? Or is this +missing from the implementation of TACs. + +Could somebody forward this to the code writers of the TAC +software. If necessary, I will try and find out what ITS is +doing. This has also happened to the DAVID-TAC (??) by people +from the NAVY. + + +EAK@MIT-ML 08/16/82 15:15:02 +To: (BUG ITS) at MIT-ML +I was sittly quitely in :MAIL just now when I got a Console Free message. +I thought someone had gunned me, so I quickly came back and spied on the +system console, which said +NET: RST TIMEOUT HST= 116000 15:08:57 +116000 is the host I was coming from. +Some weird network glitch? I don't know, but I also don't understand +why my tree wasn't detached instead of destroyed. + + +REM@MIT-MC 08/16/82 09:12:29 +To: (BUG ITS) at MIT-MC +I am getting no echo whatsoever. +I am typing this blindly. +I pressed ctrl-S to stop output on second window (screen) of a ^R (PRINT), which has been doing this for weeks since the SU-TAC was installed. + + +Date: Saturday, 14 August 1982 14:47-EDT +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: David A. Moon +Cc: BUG-ITS at MIT-MC, BUG-TELNET at MIT-MC, KLOTZ at MIT-OZ, + RMS at MIT-OZ +Subject: crufty lossage (of characters, perhaps) + + Date: Friday, 13 August 1982 02:03-EDT + From: David A. Moon + Re: crufty lossage (of characters, perhaps) + + :TCTYP ? will tell you about the PADDED option, which is probably what you need. + +Actually, I was losing completely, not knowing about needing to have the local +end in image mode. But I became unwedged eventually. +------- + + +CSTACY@MIT-MC 08/14/82 04:51:39 +To: (BUG ITS) at MIT-MC +I installed version 1278 as NITS on MC. +If anything goes wrong, please take a crash dump and boot +from ITS. Broken terminal support is supposedly fixed. + + +Date: 13 August 1982 02:03-EDT +From: David A. Moon +Subject: crufty lossage (of characters, perhaps) +To: PGS at MIT-MC +cc: BUG-TELNET at MIT-MC, BUG-ITS at MIT-MC, RMS at MIT-MC, + KLOTZ at MIT-MC + +:TCTYP ? will tell you about the PADDED option, which is probably what you need. + +Date: Tuesday, 10 August 1982 20:48-EDT +Sender: PGS at MIT-OZ +From: PGS at MIT-MC +To: RZ at MIT-OZ +cc: bug-its at MIT-OZ + + RZ@MIT-MC 08/10/82 16:40:36 + I'm using one of the old ann arbors (it doesn't even have n-key rollover). + With the new ITS there are several problems which I can't really explain. + First, inside mail I am unable to type a rubout or C-Z. A rubout seems to + turn into a C-W since the previous word always gets deleted. C-Z's don't + do anything. THis is not true when talking to DDT or EMACS. Lock seems to + idicate that that the right codes are being sent. + + Second, when I logout the DDT seems to revert to the same mode that MAIL + and SEND are in. As a consequence, I can't log back in. + +Since most of the Ann Arbors at the lab are new, and have meta keys, Ann Arbors +are initialized with +%TPMTA. Older Ann Arbors, like yours, don't have meta +keys. Looks like ^Z and rubout are being read as meta-^Z and meta-rubout. +If you do +:TCTYP AAA -%TPMTA +you should win. +------- + +Date: 10 August 1982 18:05-EDT +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC + + +I deinstalled the new ITS from MC, since it was crashing the system. +I will look into it (sigh). + + +RZ@MIT-MC 08/10/82 16:40:36 +To: (BUG ITS) at MIT-MC +I'm using one of the old ann arbors (it doesn't even have n-key rollover). +With the new ITS there are several problems which I can't really explain. +First, inside mail I am unable to type a rubout or C-Z. A rubout seems to turn +into a C-W since the previous word always gets deleted. C-Z's don't do +anything. THis is not true when talking to DDT or EMACS. Lock seems to +idicate that that the right codes are being sent. + +Second, when I logout the DDT seems to revert to the same mode that MAIL and +SEND are in. As a consequence, I can't log back in. + + +PGS@MIT-MC 08/10/82 07:00:59 +To: (BUG ITS) at MIT-MC +ITS 1278 is now installed on ML, AI, and MC. It contains support for Ann +Arbors, and the code for H19's has been rewritten to include multiple +insert/delete line/char. TYMPAD has been changed to allow padding with nulls. +H19's are being successfully padded with nulls, but it doesn't help a whole +lot, because the padding for insert/delete operations isn't happening at the +most featureful time imaginable. I'll fix this when I get back from vacation. + + +Date: 8 August 1982 19:56-EDT +From: Patrick G. Sobalvarro +Subject: crufty lossage (of characters, perhaps) +To: BUG-TELNET at MIT-MC, BUG-ITS at MIT-MC +cc: RMS at MIT-MC, KLOTZ at MIT-MC + +I'm trying to fix TS3TTY so that H19's are padded with nulls, and can do +multiple insert/delete line, like Ann Arbors do (no more of this weenie weenie +stuff). I think I'm winning. But I can't tell. + +Why can't I tell? Well, AI has no H19's hung on it, and it can't pump out the +characters at 9600 baud anyway, and that's when things get critical. So what I +usually do is go downstairs and connect an H19 to MC, and Telnet over to AI and +do a :TCTYP H19 locally. And I lose; the padding, or the insert/delete line +stuff, just doesn't seem to work; the terminal gets confused, and outputs +things in random places, and I go back and grovel over the code some more. + +But last night I distilled a listing and injected it into my brain, and this +afternoon when I saw that I was losing, I knew damned well that I should be +winning, so I went over to a VT52, and Telnetted from it (on MC) to ML. Its +terminal type was set to VT52 on both machines, and it exhibited the same sort +of lossage that H19's were exhibiting for me. RMS suggested that perhaps the +local machine didn't know its speed, so I set that to 9600 in both places, and +it still lost. In fact, absolute positioning and insert/delete line/character +type things seem to consistently lose through a Telnet. I believe I remember +hearing this ascribed to VTS when people used to Telnet to XX when it first +came up. + +Try this simple experiment: log in on a local terminal on ML, or DM, or MC, or +maybe even AI, although I don't know if it's fast enough to cause the lossage. +Telnet over to another machine (even the one you're on!), do TTY^K, and watch +it go! + + +Date: 28 Jul 1982 1132-EDT +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: bug-its at MIT-DMS +Message-id: <[MIT-DMS].238845> + +This system seems to be printing bogus LOGIN and LOGOUT messages. +God knows what else it mightbe doing. + + + +Date: 31 Jul 1982 1129-EDT +From: SWG at MIT-DMS (S. W. Galley) +To: SWG at MIT-DMS, CSTACY at MIT-DMS +Cc: bug-its at MIT-DMS +In-reply-to: <[MIT-DMS].238845> +Subject: bogus LOGIN & LOGOUT messages +Message-id: <[MIT-DMS].239379> + +No doubt it's because TAA patched ITS to record them +for non-TTY trees as well as TTY-controlled ones. + + +CSTACY@MIT-MC 08/04/82 17:40:57 Re: sources +To: (BUG ITS) at MIT-MC + +I saved the AI sources in SYSTEM, SYSENG, and SYSEN1 onto OZ +for the moment. + + +TK@MIT-MC 07/31/82 15:26:29 +To: (BUG ITS) at MIT-MC +Just so other people who look at AI don't spin wheels unnecessarily. +AI is currently dropping dead during the instruction following LPMR's +(and possibly other pager related instructions). There also appears +to be a bad file in the acount directory (cdata or something) which +prevents the system from coming up, but which the salvager seems +incapable of fixing trivially. I haven't looked at this second problem +very hard. The following loop will hang the processor: + +LMPR +JFCL +JFCL +AOJA .-3 + +PC stops at lpmr + 2, having fetched and done the fetch cycle (including +PC increment) of the instruction at lmpr + 1. +I probably won't get a chance to look at this further for a few days. +I'd suggest a debugging strategy of using the logic analyzer to locate the +place where the pulse train drops dead. This might be caused by additional +pulses coming back from the pager. A likely failure is the TTL-DEC converters +going to the pager. + + +Date: Sunday, 1 August 1982 06:07-EDT +Sender: TERZOP at MIT-OZ +From: TERZOP at MIT-MC +To: KLOTZ at MIT-AI +Cc: bug-its at ai, vision at ai +Subject: AI's demise? + + + Date: Saturday, 31 July 1982 00:24-EDT + From: KLOTZ at MIT-AI + To: bug-its at ai + cc: vision at ai + Re: AI's demise? + + What is going to happen to the XGP when AI finally quits working? + + Is the vision group going to get something to use for their lispm plots? + + Leigh. + + +Hopefully SOMEONE will get a Cannon lazer printer or the equivalent, +at which time a celebration for all can be held in the middle of Tech +Square, the highlight of which will be the burial of the XGP ten feet +under. +------- + +Date: 28 July 1982 23:16-EDT +From: Alan Bawden +Subject: MC emacs stuck in Kansas +To: TFT at MIT-MC +cc: BUG-MC at MIT-MC, BUG-ITS at MIT-MC + + TFT@MIT-MC 07/27/82 08:31:40 Re: MC emacs stuck in Kansas + To: (BUG MC) at MIT-MC + I think this should go to bug-mc, not bug-emacs: + + When I try to use either M-x find file, or C-x-C-f, to get a file from + Oz, the defaulter gets very confused. I think it doesn't even know that + Oz exists! ... + +Huh? Are you complaining that C-X C-F OZ:FOO.BAR doesn't work? (While +you CAN reference files on AI f'rinstance?) While it IS possible that this +could be made to work it isn't exactly trivial. Maybe someday someone will +have a hack attack and do it. This is one of the prices we pay for running +an incompatible timesharing system on OZ rather than an Incompatible +Timesharing System. + +Date: Saturday, 31 July 1982 00:24-EDT +Sender: KLOTZ at MIT-OZ +From: KLOTZ at MIT-AI +To: bug-its at ai +cc: vision at ai +Subject:AI's demise? + +What is going to happen to the XGP when AI finally quits working? + +Is the vision group going to get something to use for their lispm plots? + +Leigh. +------- + +Date: 31 July 1982 18:59-EDT +From: Tom Knight +To: BUG-ITS at MIT-AI + +AI has decided to "work" for the time being. I.e., Moon and I intimidated it +with scope probes, and it stopped failing. This is the second unrelated marginal +failure in as many weeks, neither of which has been properly fixed. Don't count +on it continuing to work. + +MOON@MIT-MC 07/26/82 03:29:39 Re: AI's problems--TEN-11 software +To: TK at MIT-AI, (BUG ITS) at MIT-AI +For what's worth, I fixed these in the source. Someone who wanted to be +useful might assemble and install a new system on AI. I made the Chaosnet +respect TEN11F, which it hadn't heard of, and I made the pointer in the +TV-11 memory get ranged checked in the 2 places it seemed to be used, +causing a bug-halt with an appropriate message if it was wrong. + +Date: 24 Jul 1982 0302-EDT +From: Robert W. Kerns +Subject: Re: .TEMP. +To: CSTACY at MIT-AI, BUG-ITS at MIT-AI +cc: RWK at SCRC-TENEX at MIT-MC +In-Reply-To: Your message of 24-Jul-82 0243-EDT + +TMPKIL is supposed to run, of course, and there is supposed to be a .TEMP. +directory, and there should be a -READ- -THIS- file in the directory that +explains what the directory is for, and it should be reap-protected. I +believe that TMPKIL explicitly does not delete -READ- -THIS-; the do-not-reap +bit is to discourage people, not programs. +------- + + +Date: 23 July 1982 17:01-EDT +From: Christopher C. Stacy +Subject: .TEMP. +To: BUG-ITS at MIT-AI + + +When the system came up after being broken the other day, +I noticed TMPKIL running. I wasnt sure who/what started it, +so I left it be. + +Date: Friday, 23 July 1982, 13:59-EDT +From: Robert W. Kerns +Subject: AI:.TEMP.; +To: Rodney A. Brooks +Cc: BUG-ITS at MIT-AI, BUG-LISPM at MIT-AI +In-reply-to: The message of 23 Jul 82 09:54-EDT from Rodney A. Brooks + + Date: 23 July 1982 09:54-EDT + From: Rodney A. Brooks + on lispm Terminal-Q complains of the non-existnece of directory AI: .TEMP.;LMSCN >. + I assume this is either the reslt of recent vandalism or overzealous directory + reclamation? + +Perhaps someone deleted the -READ- -THIS- file, and the program that +reaps that directory (deleting files more than a day old that don't have +the do-not-reap bit and are not -READ- -THIS-) ran, leaving no files +in the directory? + +Does AI run that program? I seem to recall that it's run by PFTHMG +DRAGON on MC. I think it's called TMPKIL. + + +Date: 22 July 1982 07:26-EDT +From: Tom Knight +To: BUG-ITS at MIT-AI +cc: TK at MIT-AI + +AI's problems, after 2 nights of hacking, turned out to be software [sort-of]. +The system was getting page faults referencing NXM exec pages, while PI in progress +on channel 7. The problem had to do with a location in the TV-11 being the exactly +wrong value to cause the LDB and ADD at SSLCK8+4 or so to produce an address of +one more than the page boundary. This was compounded and made more difficult to find +by a second bug in which turning off the 10-11 code makes the chaonet clock routine +reference exec NXM, again at clock level, without checking the TEN11F flag. +This happens on calls to T11CHK, which should just popj if TEN11F is disabled. +This problem was eventually debugged with clipleads halting the machine on exec +memory protect failures. +The bugs have not been patched, but the system will presumably "never" get into +that state again. I'll edit the sources after breakfast. + +MOON@MIT-MC 07/16/82 22:09:18 Re: disk constipation +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC + DCP@MIT-MC 07/16/82 21:25:55 + To: (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC + Is there something wrong with the disk code? MC constipated for + quite a while just now, and here is comsat's stats for the time: + + 205056 Attempting to send messages queued to host MIT-OZ + 205056 ICP->MIT-OZ... + 205057 QID=<[MIT-MC].317543> + 205057 TO->MARTY + 205059 CMSG ID=<[MIT-MC].317655> EXP->DCP@354 + 211553 TO->DCP + + Notice the 25 minute delay. The constipation did coincide with + my typing G inside EMACS RMAIL. Then again, it could be + unrelated. During the constipation, ANYBODY doing an OPEN on a + disk file would hang, but could be PCLSR'd. + +This is usually due to running out of disk channels, and deadlocking +where you have several programs each of which wants a lot of disk channels, +has some, and is waiting for more. COMPLR and PUB are prime offenders +in this respect since they open many channels and keep them open for +many minutes. You can look at the variable in the system whose name +is (I think) QFCHN, the number of free disk channels. + +DCP@MIT-MC 07/16/82 21:25:55 +To: (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC +Is there something wrong with the disk code? MC constipated for +quite a while just now, and here is comsat's stats for the time: + + 205056 Attempting to send messages queued to host MIT-OZ + 205056 ICP->MIT-OZ... + 205057 QID=<[MIT-MC].317543> + 205057 TO->MARTY + 205059 CMSG ID=<[MIT-MC].317655> EXP->DCP@354 + 211553 TO->DCP + +Notice the 25 minute delay. The constipation did coincide with +my typing G inside EMACS RMAIL. Then again, it could be +unrelated. During the constipation, ANYBODY doing an OPEN on a +disk file would hang, but could be PCLSR'd. + + +Date: 14 July 1982 11:29-EDT +From: David A. Moon +Subject: [MP: ITS question] +To: GREN at MIT-AI +cc: BUG-ITS at MIT-MC, mp at MIT-XX + + Date: Wednesday, 14 July 1982 00:45-EDT + Sender: GREN at MIT-OZ + From: GREN at MIT-AI + To: BUG-ITS at AI + Subject: [MP: ITS question] + + Date: Saturday, 10 July 1982 21:37-EDT + From: Mark Plotnick + To: gren at MIT-MC + Re: ITS question + + I hear you're an ITS expert. Could you tell me what this piece + of code attempts to do? My intuition tell me that it's trying + to figure out what tty number your console tty is at, but there + must be easier ways to do this. + .OPEN CH,[SIXBIT / #TTY/] + .VALUE + .SUSET [<.RIOC+CH>,,T] + LDB N,[220600,,T] + + Mark + + I thought that bits 3.1-3.6 were the error code, set on non-skip + .CALLs. +That's .IOS. + What is N getting? +The TTY number. .SUSET .RCNSL would be a better way. + +Date: Wednesday, 14 July 1982 00:45-EDT +Sender: GREN at MIT-OZ +From: GREN at MIT-AI +To: BUG-ITS at AI +Subject: [MP: ITS question] + +Date: Saturday, 10 July 1982 21:37-EDT +From: Mark Plotnick +To: gren at MIT-MC +Re: ITS question + +I hear you're an ITS expert. Could you tell me what this piece +of code attempts to do? My intuition tell me that it's trying +to figure out what tty number your console tty is at, but there +must be easier ways to do this. + .OPEN CH,[SIXBIT / #TTY/] + .VALUE + .SUSET [<.RIOC+CH>,,T] + LDB N,[220600,,T] + + Mark + +I thought that bits 3.1-3.6 were the error code, set on non-skip +.CALLs. What is N getting? + + --gren +------- + +Date: 12 July 1982 16:02-EDT (Monday) +Sender: RICH at MIT-OZ +From: Charles Rich +To: bug-oz at MIT-AI, bug-its at MIT-AI + +How do I get supdup (:OZ) on AI to use SAIL characters on +AI TV's? (note: I have done :tctype sail before starting +the supdup). +------- + +Date: 11 July 1982 19:56-EDT +From: David A. Moon +Subject: .IOC +To: GREN at MIT-MC +cc: BUG-ITS at MIT-MC + +It's the same as IOCHNM inside ITS. You can look at the comments on that. +The right half is an index into internal device tables, and the left half +contains device-dependent bits and fields. However, the reason it is not +documented is probably that it is not generally useful and only exists for +completeness. + + +Date: 11 July 1982 16:07-EDT +From: Christopher C. Stacy +To: BUG-ITS at MIT-AI + + +In ITS 1273, DDT 1388, on AI: + +PWORD, MAIL, FINGER, and WHO, were all broken last night for +some reason. Now they all work. + +Did someone fix this stuff, or did it (ummm) fix itself. + +Date: 11 July 1982 05:36-EDT +From: Ian G. Macky +To: BUG-ITS at MIT-MC + + +The World According to >INFO.;ITS USETS: + + +.IOC + +- +- input/output channel + + The variable .IOC+ is the input/output channel + word for channel , for n between 0 and 17 octal. + Normally zero for a closed channel. + + + +[This is not horribly informative. Can anyone tell me what + exactly is in thess words? I'll fix the USETS doc once the + stuff is known... --gren] + +Date: 11 July 1982 01:26-EDT +From: Keith F. Lynch +To: BUG-ITS at MIT-AI + +:F and :FINGER and :WHOIS all die, with or without jcl. :F gives me +the header line, then XGP, then, immediately on a new line, +ILOPR; 17770>>0 0/ 10400,,500000 0/ 10400,,500000 +:FINGER and :WHOIS gives similar results. There is no problem with +:U or :UJ or :WHO or :WHOJ. + :F worked fine about two hours ago. + ...Keith + +Date: 11 July 1982 00:42-EDT +From: Doug Humphrey +To: BUG-ITS at MIT-AI + +:f and :who are blowing up on me. nothing special I am doing. + +:f blows with + +ILOPR; 17770>>0 + + +Date: 10 July 1982 19:38-EDT +From: Christopher C. Stacy +Subject: I answered Guby's FINGER bug report (there was no bug) +To: GUMBY at MIT-AI +cc: BUG-ITS at MIT-AI + + + +Date: 10 July 1982 19:13-EDT +From: David Vinayak Wallace +To: BUG-ITS at MIT-AI + +:f %bbnu +hangs forever. Do all sites have finger servers? ITS should time out +intelligently (it certainly does if another ITS is down). + +Date: 5 July 1982 15:09-EDT +From: David Chapman +Sender: ___013 at MIT-AI +To: BUG-ITS at MIT-AI + +sys3;ts k is linked to sys3;ts logout which ain't they'. + +Date: 1 July 1982 19:00-EDT +From: Ken Harrenstien +Subject: AI not accepting ARPAnet connections +To: BUG-ITS at MIT-AI, BUG-PWORD at MIT-AI + +Hey, what's with this server telnet lossage? Any attempt to +connect gets me a "ITS being deubbgged, go away" message, +but after two days of this crap I find that I can get in +via CHaos from MC. I'm pretty pissed, since I've been +trying to get at my mail to process ATSIGN, HOSTS3, and +HEADER-PEOPLE stuff; also, unless I can get in you're +going to lose the disk space that all the digests take +up in my mail. + +Would whoever slammed the door please consider that 99% of +network people are okay guys, and deserve a little notice. + +While this is being put to rights, how about flushing PWORD +for connections from SRI-NIC? That used to be set up OK +but someone apparently reset things. Again I'm irked; I +used to think that friendships counted for something more +than being treated like a total random. + +Date: 30 Jun 1982 1501-EDT +From: Robert P. Krajewski +Subject: XGPSEND +To: EBM at MIT-XX +cc: BUG-OZ at MIT-OZ, BUG-ITS at MIT-AI + +[The Twenex program] does not work from XX or OZ. It can't create a +spooling file. Have some protocols been changed or something ? Yes, +people don't use the XGP much, but ... + +bob +------- + +Date: 26 June 1982 11:41-EDT +From: Alan Bawden +To: HDT at MIT-AI +cc: BUG-ITS at MIT-MC + +Supdup figures that when you type P you probably don't even want it as +your current job anymore, so it cleverly sets some OTHER job as being current. +That's what it's doing when it valrets 1J to your DDT, it's trying to +select your PREVIOUSLY selected job. This is why you somtimes get the error +message JOB GONE? when leaving a supdup (the previously selected job has +dissapeared since you started your supdup). + +I guess it's somebody's idea of a feature. I've never found the slightest bit +convienent. + + +Date: 25 June 1982 22:24-EDT +From: Howie Daniel Trachtman +To: BUG-ITS at MIT-AI +cc: HDT at MIT-AI + + This is minor, but I just thought you might like to know. +I had a supdup to oz which I typed p to get back to ai`s ddt. + +I then later had to :mc for something... + Then I did a p to get back to AI, and sent someone a message, and +did not start up any jobs. However, when I did a :contin I got my oz job. + Am I seeing things, or is this a bug? +BTW, my mc job was still around afterwards. + +--Howard-- + +GJC@MIT-MC 06/22/82 23:31:39 Re: the strangest thing +To: (BUG ITS) at MIT-MC +I was running :CHTN HTJR, a vax running VMS. On the Vax I ran a program +which does a lot of I/O displaying information like a PEEK program +(it was a peek type program) and taking character input at interrupt level. +I ran this peek program looking at itself, and low and behold the CHTN +was too busy or something to listen very well, even to the CHTN break +character. That is, I found I could not break out of CHTN nor get +any response from the VAX which just kept outputing characters. +I then hung up the phone and redialed MC. +Being brave, I then did :UJOB GJC HACTRO and :SNARF CHTN. +The CHTN and the DDT then seemed to have control of the TTY at +the *same* time, DDT getting characters only once in a while +with the CHTN doing lots of output to my TTY. I then HUNG UP the phone +again, and sent this bug note. + +Later... It seems I can reproduce this condition at will. + + +MOON@MIT-MC 06/19/82 20:25:44 Re: MC:.MAIL.;NAMES > is too large +To: (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC +MC:.MAIL.;NAMES > is too large. It is causing the mailer to run out of address +space frequently. If you read the file, a great deal of it looks like pure trash. +I removed a few obviously obsolete entries; others should do the same. It may +be necessary to remove some of the large mailing lsts into separate files +(using @FILE). It would also be desirable to remove the personal entries for +people who no longer exist; I don't know if there is a reliable way to tell whether +someone no longer exists. I also personally feel that the full-name entries at +the end of the file are worthless and should be flushed, although others may disagree. + +Date: 17 June 1982 21:55-EDT +From: David Chapman +To: BUG-ITS at MIT-AI + +It seems that the msgs times was reset sometime last night. +Everyone says that they had to read all the old messages again. + +Date: 17 June 1982 20:21-EDT +From: Mark J. Dulcey +To: BUG-ITS at MIT-AI, BUG-BOLIO at MIT-AI, BUG-LISP at MIT-AI + +I corrected a bug in the file AI: LMIO1; RFONTW >, and installed the +changes on the Lisp Machine. However, I know that these functions are +also used by other folks (not on the Lisp Machine), so I thought I'd let +you know so you can recompile and load the new FASL files. + +MOON5@MIT-MC 06/16/82 15:49:09 Re: vandalism +To: (BUG ITS) at MIT-MC +I removed the garbage that someone not logged-in on some other +ITS edited into the MC:SYS;SYSTEM MAIL. This is the second time +today I believe. + +DCP@MIT-MC 06/14/82 11:52:49 +To: RICH at MIT-MC +CC: (BUG ITS) at MIT-MC + RICH@MIT-MC 06/14/82 10:35:45 + Will it be possible soon to have OZ: as a device from ITS + like MC:, etc. + +Not without a good deal of hacking. They are different operating +systems, and OZ is not on the ARPAnet, which is what the infamous +MLDEV uses. The standard ITS 6 character DIR, FN1 and FN2 will +not map well to a twenex file system, and not many programs +implement RMS's string open system call to get around this +problem. + + +DCP@MIT-MC 06/14/82 11:52:49 +To: RICH at MIT-MC +CC: (BUG ITS) at MIT-MC + RICH@MIT-MC 06/14/82 10:35:45 + Will it be possible soon to have OZ: as a device from ITS + like MC:, etc. + +Not without a good deal of hacking. They are different operating +systems, and OZ is not on the ARPAnet, which is what the infamous +MLDEV uses. The standard ITS 6 character DIR, FN1 and FN2 will +not map well to a twenex file system, and not many programs +implement RMS's string open system call to get around this +problem. + + +Date: Monday, 14 June 1982, 14:30-EDT +From: Christopher C. Stacy +To: RICH at MIT-MC +Cc: BUG-ITS at MIT-MC + + RICH@MIT-MC 06/14/82 10:35:45 + To: (BUG ITS) at MIT-MC + Will it be possible soon to have OZ: as a device from ITS + like MC:, etc. + + +As I explained when we were deciding what operating system to +run, TOPS-20 doesn't have any facility for doing this sort of +thing. It is a major task to write it into the guts of the +Tops-20 monitor. I (or someone) will probably be working on it +in the near future, but it is likely to take a while. + +Chris + + + +MOON@MIT-MC 06/14/82 15:42:31 Re: OZ: device +To: RICH at MIT-MC +CC: (BUG ITS) at MIT-MC + RICH@MIT-MC 06/14/82 10:35:45 + To: (BUG ITS) at MIT-MC + Will it be possible soon to have OZ: as a device from ITS + like MC:, etc. + +It's possible but unlikely. The problem is that the inter-ITS +devices simply relay system calls from the remote machine to the foreign +machine. 20X has, of course, different system calls, and not all +the ITS system calls map simply into 20X system calls. There is also +the issue of incompatible file name lengths and syntax. + +On the other hand, since it was done for the FC: it can probably be +done for OZ also assuming someone is available to do the work. +If the FC: device used the standard file access protocol that 20X +already supports, it would have been trivial to extend it into an OZ: +device. Since it uses a private protocol instead, either that protocol +will have to be implemented on TOPS-20 or an entirely new job-device +program will have to be written. + +RICH@MIT-MC 06/14/82 10:35:45 +To: (BUG ITS) at MIT-MC +Will it be possible soon to have OZ: as a device from ITS +like MC:, etc. + + +MCB@MIT-MC 06/11/82 21:20:13 +To: (BUG ITS) at MIT-MC +I was just looking for some tip info and noticed that .info.;tip manual +on MC appears to have been clobbered sometime early this morning. + + +Date: 8 June 1982 18:07-EDT +From: David Vinayak Wallace +To: BUG-ITS at MIT-AI +cc: BUG-EMACS at MIT-AI + +When I am in emacs on a AAA and I get a send while the screen is redisplaying, +part of the buffer is displayed under the mode line. + +Date: 8 June 1982 12:30-EDT +From: Martin David Connor +To: BUG-ITS at MIT-AI, USER-A at MIT-AI + + +I found not one, but wo bogus copies of OCTPUS on the +SYS directories. One was 35 blocks long, and would not +BINPRT. The other was small, and unrecognizable. + +Please keep your eyes open for this bogosity, because people +are using these to log in and do damage. Thanks. + +Marty + + +Date: Wednesday, 2 June 1982, 07:26-EDT +From: Robert W. Kerns +Subject: 2-character escape sequences getting broken up +To: David A. Moon +Cc: bug-its at MIT-AI +In-reply-to: The message of 27 May 82 03:00-EDT from David A. Moon + + + Date: Thursday, 27 May 1982, 03:00-EDT + From: David A. Moon + DDT could avoid this by doing its interrupt-level typeout + (e.g. of sends) on a separate I/O channel. +DDT doesn't do interrupt-level typeout. DDT gets interrupted and goes +off and does other typeout, via the HAKKAH kludge. I think the problem +is with ECHOED (at ITS interrupt level) typeout anyway, not with DDT's +typeout. + +Date: 3 Jun 1982 1225-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: MEYER at MIT-DMS +Cc: BUG-ITS at MIT-DMS, BUG-EMACS at MIT-DMS +Subject: M-X DIRED$MEYER;AR9: +Message-id: <[MIT-DMS].233727> + +I was finally able to reproduce the problem, but it went away after +a while. I have to assume that the problem is with EMACS, because +even when it was losing in EMACS saying :PRINT DIRAR9:NAME1 UP worked +in DDT. Alternatively it may be a funny timing problem with the +archive or dir device. In any case, I am CCing this to BUG-ITS and +BUG-EMACS in the hope that someone can help. + +For those who are hearing about this problem for the first time, +in EMACS, M-X DIRED$MEYER;AR9: (and other archives, on DM) often +gets FILE LOCKED? errors. It seems to always go away eventually, but +eventually return. Could this be a JOBREU lossage with one of those +devices not reiniting properly? + + Dave + + + +Date: Saturday, 29 May 1982, 23:27-EDT +From: Robert W. Kerns +Subject: WHARTON +To: GSB at MIT-ML +Cc: bug-comsat at MIT-AI, bug-its at MIT-AI +In-reply-to: The message of 29 May 82 17:29-EDT from GSB at MIT-ML + + From: GSB@MIT-ML + Date: 05/29/82 17:29:23 + GSB@MIT-ML 05/29/82 17:29:23 + Is wharton no longer on the arpanet, or is the host table trashed? + It's in the arpanet-bboards list, but it took me a bit to track this + down because comsat issued no diagnostic for a "TO:(BBOARD WHARTON)", just + sent it to bboard locally (which is a dumb thing to do). + +Wharton is off the arpanet due to administrative fuckup of some sort or +another. They'll be back someday (at different address) when it all +gets straightened out. + +DCP@MIT-MC 05/29/82 20:00:29 +To: GSB at MIT-ML +CC: (BUG COMSAT) at MIT-ML, (BUG ITS) at MIT-ML +:host WHARTON +Lookup failed. + +So, it is not in the host table on MC. + +CAH tells me that WHARTON punted the ARPAnet, or the other way +around. Politics, or something like that. + + + +GSB@MIT-ML 05/29/82 17:29:23 +To: (BUG COMSAT) at MIT-ML +CC: (BUG ITS) at MIT-ML +Is wharton no longer on the arpanet, or is the host table trashed? +It's in the arpanet-bboards list, but it took me a bit to track this +down because comsat issued no diagnostic for a "TO:(BBOARD WHARTON)", just +sent it to bboard locally (which is a dumb thing to do). + + +Date: 29 May 1982 15:05-EDT +From: Leonard N. Foner +To: BUG-ITS at MIT-AI + +Something appears wrong with the way certain host names are +being displayed by FINGER. While most of the lines printed +out are fine, FINGER is consistently showing these lines wrong: +FONER T Leonard N. Foner F T43 #27: At home +GYRO A Scott W. Layson HACTRN 7.T44 Net site (Chaos) + +As you can see, the hostnames (in my case, MIT-TIP... I don't know +about Scott) are not being displayed. I dunno what's wrong. + +Ciao. + + + +Date: Thursday, 27 May 1982, 03:00-EDT +From: David A. Moon +Subject: 2-character escape sequences getting broken up +To: rwk at SCRC-TENEX +Cc: bug-its at MIT-AI + +DDT could avoid this by doing its interrupt-level typeout +(e.g. of sends) on a separate I/O channel. + +Date: Thursday, 27 May 1982, 02:18-EDT +From: Robert W. Kerns +Subject: Illegal chr after control P +To: Michael Travers +Cc: BUG-ITS at MIT-AI +In-reply-to: The message of 27 May 82 01:18-EDT from Michael Travers + + Date: 27 May 1982 01:18-EDT + From: Michael Travers + I was SUPDUPing to AI from XX. While reading my mail with $^A I typed + a space to a --More-- break. It spat out: + + TTY: MT; - ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + + I can't reproduce this as nothing at all out of the ordinary was being + done. I did notice that there was new mail in my mail file that I had + not seen a notification for; perhaps it was trying to print it when it + got the error. +This is the usual screw with two-character escape sequences getting +asynchronous typeout intervening between them. + +Date: 27 May 1982 01:18-EDT +From: Michael Travers +To: BUG-ITS at MIT-AI + +I was SUPDUPing to AI from XX. While reading my mail with $^A I typed +a space to a --More-- break. It spat out: + +TTY: MT; - ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + +I can't reproduce this as nothing at all out of the ordinary was being +done. I did notice that there was new mail in my mail file that I had +not seen a notification for; perhaps it was trying to print it when it +got the error. + +CSTACY@MIT-MC 05/22/82 22:20:21 Re: hung TVs +To: (BUG ITS) at MIT-MC +On AI, sometimes when you get a TV by hitting call, you get +wedged in TTYI. It looks like the person get blocked at TYI1+20. +I dont know anything about that part of the system yet. + + +Date: 19 May 1982 1233-EDT +From: J. Noel Chiappa +To: CAMCAD at MIT-MC +cc: JNC at MIT-XX, bug-mail at MIT-AI, bug-its at MIT-AI, ellen at MIT-XX + + I doubt that ITS will ever implement InterNet, and I see no signs +of them implementing SMTP. In the meantime, you can get mail from ITS +to InterNet sites by sending mail to "person%final_host"@forwarder_host; +I am told that the ISI sites provide such a forwarding arrangement; others, +closer to MIT, should be appearing shortly. +------- + +Date: 18 May 1982 21:29-EDT +From: David C. Plummer +To: BUG-ITS at MIT-MC, BUGDDT at MIT-MC, JPG at MIT-MC, ELLEN at MIT-MC, + MERMAN at MIT-MC + +I don't know if anybody else has checked recently, but all four +SYS directories are at least 95% full. Should we try to clear +some out, or go to SYS4; (gack). + + +DCP@MIT-MC 05/17/82 11:35:15 +To: (BUG ITS) at MIT-MC +I replied to GJC (it was a user's (perhaps not his own) .MASK variable). + + +GJC@MIT-MC 05/17/82 02:30:57 +To: (BUG ITS) at MIT-MC +Saw a funny thing on the system consol today: + +223616/ 204202,,321560 204202,721560 STEVER 02:10:17 + +anybody know what that location might be? + + + +Date: 15 May 1982 03:20-EDT +From: David A. Moon +Subject: MC mem D +To: ELLEN at MIT-MC +cc: BUG-ITS at MIT-MC + +The problem with memory D is massive trauma to its electrical outlet +under the floor, and its plug. The plastic is melted and somewhat +burned. I left the floor pulled up and the plug unplugged so you +can see it. I don't know whether this is due to a fault of mem D +itself, however I saw no evidence of burned wiring inside its power +control. Neither the circuit breaker on mem D nor the one on the wall +is blown. This will need the attention of some sort of electrician. + +By the way, could you ask whoever is in charge not to block off maintenance +access to the MC machine? I shoved the offending desk out into the main +passageway where it will cause a massacre if there is a fire--hopefully +this will ensure that it gets moved to someplace reasonable soon +(not shoved back in front of the machine where it blocks off the memory +doors). + +Date: 12 May 1982 18:49-EDT +From: David Vinayak Wallace +To: BUG-ITS at MIT-AI + +:f ken +PARERR; 14603>>TDNN 4,(5) 4/ 1 50000/ TLZN 14,45602 + +Date: 11 May 1982 08:26-EDT +From: Martin David Connor +Subject: GFR25 +To: BUG-ITS at MIT-AI + + +Whoever did GFR 25 seems to have reaped the wrong files. + +Since some twit opened all the files on the system on 2 April, +reference date was no good for reaping on. + +The XGP login init was reaped, along with a couple other files. + +Whoever did it, please fix it. Thanks. + +Marty + + +Date: Friday, 7 May 1982 18:15-EDT +From: KLOTZ at BBNG +To: bug-its at ai +cc: pgs at BBNG +Subject:ITS Message Header on net. + +I received the following message at BBNG. It has an ITS-style +header. + +I believe the local twenex inserted the first two lines. + +Mail-from: MIT-AI +Received-Date: 7-May-82 0244-EDT +PGS@MIT-AI 05/07/82 01:37:54 +To: klotz at BBNG +Does this stuff work? (I mean a qsend from AI). + +^_ + +Date: 7 May 1982 0947-EDT +From: S. W. Galley +Subject: strange ITS crash +To: bug-its at MIT-AI + +I just now reloaded DM ITS after it was hung in user mode, +but with the parity-stop and run lights on. I dumped it +to DM:CRASH;COMSYS >, because the light for job #5 (COMSYS COMSYS) +was lit. +PC/ 725717, parity buffer/ 0, pager mem addr/ 1,,337717 (in ARM-10), +parity error light off! +------- + +Date: 6 May 1982 03:38-EDT +From: Patrick G. Sobalvarro +To: BUG-ITS at MIT-AI + +I answered NEVES's question. + +NEVES@MIT-MC 05/05/82 20:03:19 +To: (BUG ITS) at MIT-MC +SIGH... +HOW DOES ONE GET A FILE FROM A CHAOSNET SITE SUCH AS SPEECH TO +MIT-MC WHILE ON THE MIT-MC END? THE CFTP PROGRAM ON ITS +DOESN'T SEEM TO BE THE APPROPRIATE THING TO USE BECAUSE IT +DOESN'T ALLOW ONE TO LOGIN TO THE OTHER MACHINE. -DAVE + + +Date: 4 May 1982 20:21-EDT +From: Christopher C. Stacy +Subject: weird! +To: BUG-COMSAT at MIT-AI +cc: BUG-ITS at MIT-AI + + +In COMSAT 380, ITS 1273, on MIT-AI: + +COMSAT was not properly delivering mail to GUMBY. The stats log says +the mail was delivered, and he got CLI messages saying it had been. +But the mail seems to have gone into a black hole. + +I temporarily changed his netaddress to MC; receiving mail on another +host seems to work fine. I wonder how many other people have been +losing mail, and how this could be happenning? + + +MOON@MIT-MC 05/02/82 01:55:58 Re: JOB: device +To: ALAN at MIT-MC +CC: (BUG ITS) at MIT-MC + ALAN@MIT-MC 04/30/82 01:38:18 + To: (BUG ITS) at MIT-MC + Why does opening the JOB device with a non-existant file specified cause a job + device handler creation/destruction loop? Is this bizare behavior necessary to + enable some debugging hack? (Like where you write the file to be loaded after + starting up the user??) Or is this a bug and the thing should return some + reasonable error code instead? +It might be that the bootstrap loader for the job has to fit in the AC's and +doesn't have enough locations left to signal an error -- maybe it does a .LOGOUT +thinking that will make ITS signal an error for it, but someone broke ITS to +reload the job instead? Just a theory. + +ALAN@MIT-MC 04/30/82 01:38:18 +To: (BUG ITS) at MIT-MC +Why does opening the JOB device with a non-existant file specified cause a job +device handler creation/destruction loop? Is this bizare behavior necessary to +enable some debugging hack? (Like where you write the file to be loaded after +starting up the user??) Or is this a bug and the thing should return some +reasonable error code instead? + +ELLEN@MIT-MC 04/27/82 04:36:57 Re: Changing the default for :find +To: (BUG ITS) at MIT-MC +CC: GJC at MIT-MC +GJC didn't exactly explain it, but a better way to state the desired +change to the FIND program is, + + should be assumed for directory unless another directory +specification is given, or *; is indicated. + +I think that covers it, is it possible? Thanks. + + +GJC@MIT-MC 04/26/82 17:15:25 +To: (BUG ITS) at MIT-MC +I think it would be a good thing to change the DEFAULT filename used by FIND. +The reason is that many people on the "USERS" type directories use find +to find their files, and these people invariably type something like +:FIND FOO*** therefore they end up searching the entire filesystem. In many +cases they aren't fully aware that they have been put on some directory +USERS7 lets say, so FIND is their only reasonable tool for listing the +files they own. Furthermore, if somebody does want to search the entire +filesystem, (perhaps not such a rare thing to do back in the days of ITS +when the FIND program was written) I think it reasonable to make the +person type something like :FIND ******;FOO. + + + +DEVON@MIT-MC 04/25/82 00:51:44 +To: (BUG ITS) at MIT-MC +is the Control-P Eye display code legit? +Rumor sez that ^P I x outputs x in image +mode, but I get weird cursor pos errors. + +Date: Saturday, 24 April 1982, 20:46-EST +From: David Vinayak Wallace +Subject: Access from DC area +To: Bug-its at MIT-AI +Cc: info-cobol at MIT-AI + + Date: 23 Apr 1982 0809-EST + From: PALLEN at MIT-DMS (Peter Allen) + To: Bug-its at MIT-AI + Subject: Access from DC area + Message-id: <[MIT-DMS].230024> + + Hello! + Is it my imagination but have you people turned off access from the Dc are + + +...WOW! Precognition! + +Date: 23 Apr 1982 0809-EST +From: PALLEN at MIT-DMS (Peter Allen) +To: Bug-its at MIT-AI +Subject: Access from DC area +Message-id: <[MIT-DMS].230024> + + Hello! + Is it my imagination but have you people turned off access from the Dc are + + +Date: 22 April 1982 19:43-EST +From: Leigh L. Klotz +To: BUG-PWORD at MIT-AI +cc: BUG-ITS at MIT-AI + +On ai's pword, in :send, with an h19 or printing ttyps (at least), +tab echoes as ^I, and rubout doesn't back up over carriage +returns, although it deletes characters (as shown by ctrl-l). + +Who broke this? +Leigh. + +Date: 20 Apr 1982 1054-EST +From: Robert W. Kerns +To: MARTY at MIT-AI, BUG-ITS at MIT-AI +cc: RWK at SCRC-TENEX +In-Reply-To: Your message of 20-Apr-82 0105-EST + +This happens when you have enabled DDT to search directories recently +looked at, and one of the directorys you recently looked at doesn't +exist (locally). DDT is telling you the actual error it got. ITS +is telling you what was wrong with what DDT gave it. DDT shouldn't +be putting things on its list of recent directories without verifying +that they exist, but I'm in no hurry to fix this very occasional +minor annoyance. +------- + +Date: 20 April 1982 00:37-EST +From: Martin David Connor +To: BUG-ITS at MIT-AI + +Doing :o gives the error message "NON-EXISTENT DIRECTORY" +should it not say file not found or something more informative? + +Marty + + +Date: 19 April 1982 22:39-EST +From: Christopher C. Stacy +To: EB at MIT-AI +cc: BUG-ITS at MIT-AI + + +If you have some files which you urgently want and they're zeroed on +pack 15, why dont you ask for them to be restored by sending mail to +File-Retrieve. + +Due to multiple theories about how to proceed, the original +restoration process was somewhat screwed up. Now, things that arent +asked for specially will get restored as people have time to do so. + +Date: 19 April 1982 22:05-EST +From: Edward Barton +To: BUG-ITS at MIT-AI + +Is pack 15 ever going to have anything except zeros on it? + +Date: 19 April 1982 02:06-EST +From: Martin David Connor +Subject: Anatomy of Lossage +To: BUG-ITS at MIT-AI, USER-ACCOUNTS at MIT-AI, AGRE at MIT-AI, + user-accounts at MIT-MC + + +I examined the system log, and the lossage of last friday happened +something like this. + +1) a user logged in as MINI0, :CHUNAMed to CRETIN, and started to + play. First he/she copied DDT to the file sys;z ddt, then copied + that file to SYS3;TS OCTPUS . This would allow logging in from + PWORD without a password. + +2) CRETIN then logged out, and then ___010 took over. First he/she + deleted PANDA, then LOCK. + + +Account MINI0 has been deleted. As has account CRETIN. The OCTPUS +(camaflaged DDT) has been deleted. LOCK has been reinstalled. +The system is approximately as it was. + +Marty + + +Date: Friday, 16 April 1982, 01:12-EST +From: David A. Moon +To: Patrick G. Sobalvarro +Cc: BUG-ITS at MIT-AI +In-reply-to: The message of 15 Apr 82 12:49-EST from Patrick G. Sobalvarro + + Date: 15 April 1982 12:49-EST + From: Patrick G. Sobalvarro + To: BUG-ITS at MIT-AI + + This morning's crash is on AI:CRASH;1273 CRASH. + + It broke at 137720. Someone more knowledgeable than me should + probably look at it. Incidentally, 137720 is nowhere near the + TTY code, as nearly as I can tell. Memory was acting flakey + two hours before the crash. + +This looks like an instruction failed to execute properly. The system job +is trying to get rid of a running job in the mistaken impression that its +bit saying that it has done a .LOGOUT and should go away is set. The bit +is not set and there is no sign that it has been. (Possibly the job has +already gone away and this is a new job that somehow took its place, since +it looks like it is just starting up.) There isn't any sign of register U +having been clobbered; it had the same value much earlier in SYSGUN when +DMNPLO was called. + +If it was hot in the machine room at the time this crash occurred, it was +most likely a hardware failure. + +Date: 15 April 1982 12:49-EST +From: Patrick G. Sobalvarro +To: BUG-ITS at MIT-AI + +This morning's crash is on AI:CRASH;1273 CRASH. + +It broke at 137720. Someone more knowledgeable than me should +probably look at it. Incidentally, 137720 is nowhere near the +TTY code, as nearly as I can tell. Memory was acting flakey +two hours before the crash. + +Date: 14 April 1982 22:02-EST +From: Patrick G. Sobalvarro +To: ZVONA at MIT-AI +cc: DPH at MIT-AI, BUG-ITS at MIT-AI + + Date: Wednesday, 14 April 1982, 16:55-EST + From: David Chapman + + There's some bogosity here, but it isn't in ITS. What you are + complaining about is not a bug, but a feature. ... the error + message you got meant that the system was full, and a job slot + couldn't be found to load the job into. + + Well then the bogosity is that ITS is not smart enough to + interpret the error that it gets when it can't find a job slot + for a jobdev job. I can hardly see that that is a feature. + +I'm not sure what you mean by this. If ITS weren't smart enough to +understand the condition that occurs when it can't find a job slot for +a jobdev job, it wouldn't give you an error message at all. It would +just blow out. As it happens, ITS generates a perfectly good error +message when it can't find a job slot for a jobdev job. In fact, in +the cases you folks were reporting, DDT was even reporting the +condition to the user. It IS a shame that the error message is the +same as that given when one attempts to write to a full pack. + +If the AI lab had decided to continue using ITS, it would have been a +good thing to modernize some of the error messages. At the time ITS +was first written, they were probably the most informative error +messages around. Nowadays, however, we have operating systems like +Twenex that give you lowercase error messages, and nothing like the +functionality of job devices. I can hardly see that this is a +feature. + +Date: 14 April 1982 21:13-EST +From: Alan Bawden +To: BUG-ITS at MIT-MC, Zvona at MIT-AI +cc: DPH at MIT-MC, PGS at MIT-MC + + + Well then the bogosity is that ITS is not smart enough to + interpret the error that it gets when it can't find a job slot + for a jobdev job. I can hardly see that that is a feature. + +No, the real problem is that the only mechanism ITS has to communicate the +error to you is that it gets to return one of 47 (octal) error codes. If we +were designing ITS today we probably wouldn't do things that way, but... + +Perhaps a better error code (one that corresponds to a better error message) +could be chosen for this situation. I forget now just what it is that you DO +get (device full?), but scanning the list I would say that 10 (%ENADV, "DEVICE +NOT AVAILABLE") is nicely ambiguous about exactly why you lost in this +situation (system full). + +Date: 14 April 1982 21:13-EST +From: Alan Bawden +To: BUG-ITS at MIT-MC, Zvona at MIT-AI +cc: DPH at MIT-MC, PGS at MIT-MC + + + Well then the bogosity is that ITS is not smart enough to + interpret the error that it gets when it can't find a job slot + for a jobdev job. I can hardly see that that is a feature. + +No, the real problem is that the only mechanism ITS has to communicate the +error to you is that it gets to return one of 47 (octal) error codes. If we +were designing ITS today we probably wouldn't do things that way, but... + +Perhaps a better error code (one that corresponds to a better error message) +could be chosen for this situation. I forget now just what it is that you DO +get (device full?), but scanning the list I would say that 10 (%ENADV, "DEVICE +NOT AVAILABLE") is nicely ambiguous about exactly why you lost in this +situation (system full). + +Date: Wednesday, 14 April 1982, 16:55-EST +From: David Chapman +To: PGS at MIT-AI, DPH at MIT-AI +Cc: BUG-ITS at MIT-AI +In-reply-to: The message of 14 Apr 82 16:14-EST from Patrick G. Sobalvarro + + There's some bogosity here, but it isn't in ITS. What you are complaining + about is not a bug, but a feature. ... the error message + you got meant that the system was full, and a job slot couldn't be found to + load the job into. + +Well then the bogosity is that ITS is not smart enough to +interpret the error that it gets when it can't find a job slot +for a jobdev job. I can hardly see that that is a feature. + +Date: 14 April 1982 16:14-EST +From: Patrick G. Sobalvarro +To: ZVONA at MIT-AI, DPH at MIT-AI +cc: BUG-ITS at MIT-AI + + From: David Chapman + Sender: DPH at MIT-AI + + mc^K => ERROR: OPEN: USR: DPH; - DEVICE FULL + levitt^A => MC: USERS4; LEVITT MAIL - DEVICE FULL + + Obviously there is some fundamental bogosity here. + +There's some bogosity here, but it isn't in ITS. What you are complaining +about is not a bug, but a feature. ITS has these things called JOBDEVs, or job +devices. They are what allow you to access files on other machines, get a +pretty printout of the XGP queue, list your directory in various nice formats, +and all sorts of other nice things. + +When you attempt to access a device whose name is not recognized by ITS, ITS +loads up a program called ATSIGN DEVICE, which searches for a file called +JOBDEV on the directory DEVICE;. If it finds it, it loads it up +and runs it. If it doesn't find it, it errors out. However, the error message +you got meant that the system was full, and a job slot couldn't be found to +load the job into. + +Date: 14 April 1982 13:22-EST +From: David Chapman +Sender: DPH at MIT-AI +To: BUG-ITS at MIT-AI + +mc^K => ERROR: OPEN: USR: DPH; - DEVICE FULL +levitt^A => MC: USERS4; LEVITT MAIL - DEVICE FULL + +Obviously there is some fundamental bogosity here. + +PGS@MIT-MC 04/11/82 07:04:00 +To: MARTY at MIT-MC +CC: (BUG ITS) at MIT-MC +Marty, you recently made a change to TTYTYP >. When you made your +change, you also added gratuitous spaces before the tty numbers given +as arguments to the TTxxx macros, which made them not assemble +properly. Please be more careful about this sort of thing if you're +going to modify the sources. + + +Date: 10 April 1982 16:02-EST +From: Martin David Connor +Subject: OZ Shutdown +To: BUG-ITS at MIT-AI, BUG-OZ at MIT-AI, WIZARDS-OF-OZ at MIT-AI + +Between friday night and saturday morning the following events +occured: + +- One of the air conditioning package units began to put out + 70 degree air (50 degrees is normal). + +- AI began to get massive amounts of ECC errors. So many that the + console could not keep up. + +I called FIXIT to come and look at the A/C. They came and the +temperature went back down some. + +At this point, with the help of RMS and RG I replaced defective chips +in the Stardust memory. + +- Early Saturday morning OZ got a memory parity error and shut itself + down. I am not certain this was caused by excessive heat. + +- I decided that there was no point in leaving it powered on with the + air conditioning marginal, I powered down OZ. + +----------- + +What is being done about the A/C problem: + +Physical plant claims that the air conditioning is "balanced" with the +idea that the major sources of heat on the 9th floor are ML and DM. +This was once true, and worked. it is no longer good enough. + +I am preparing a map of the 9th floor so that they can redistribute +the A/C in a way that makes better sense. My map will be ready Monday +morning, and hopefully they can come in the same day. + +----------- + +What this means w.r.t. OZ coming up: + +DEC may decide to start the 72 acceptance test again because of the +parity error. This could delay our getting the machine. + +----------- + +Opinion: + +Since DEC has only taken 2 weeks so far, I am willing to be patient +and get things done right rather than risk losing AI by making too +fast a move. + +----------- + +This is bothersome, but with all of the things that have gone right, +this minor setback is just that, minor. + +News as it happens; + +Marty + + +Date: 9 April 1982 18:05-EST +From: Christopher C. Stacy +Subject: bogus ITS version number resolved +To: BUG-ITS at MIT-AI + +When I reloaded AI this afternoon, I reassembled ITS so that +the version number went up. AI now has ITS 1270, which has +PGS's TS3TTY changes in it, as NITS. +(DDT, PEEK, NAME repurified.) + +Date: 8 April 1982 22:19-EST +From: Christopher C. Stacy +Subject: The :NAME program +To: Moon at SCRC-TENEX +cc: PGS at MIT-AI, AGRE at MIT-AI, BUG-ITS at MIT-AI, + BUG-NAME at MIT-AI + + Date: Thursday, 8 April 1982, 17:22-EST + From: David A. Moon + Subject: The :NAME program + To: pgs at MIT-AI, agre at MIT-AI, bug-its at MIT-AI, bug-name at MIT-AI + + Did someone do something like copy SYSBIN;NAME BIN to SYS;TS NAME ? + +Looks as though something like that happenned. I just reinstalled the +binary and pure versions in the right places. + +Date: Thursday, 8 April 1982, 17:22-EST +From: David A. Moon +Subject: The :NAME program +To: pgs at MIT-AI, agre at MIT-AI, bug-its at MIT-AI, bug-name at MIT-AI + +The DEBUG switch is *supposed* to be set in SYSBIN;NAME BIN, the output +of assembling NAME. The file SYS;TS NAME, the output of purifying NAME, +is *not* the same file, does not contain the same stuff, and is not +supposed to have the debug switch set. It also completely takes care of +installing itself when a new system is put in or it is moved from +machine to machine, as long as DEBUG isn't set to suppress that. + +Did someone do something like copy SYSBIN;NAME BIN to SYS;TS NAME ? It +seems like a real waste for someone (not me) to have gone to a lot of +trouble to make this program install itself automatically if people are +going to go jamming monkey wrenches into the works anyway. + +Date: 8 April 1982 12:11-EST +From: Patrick G. Sobalvarro +Subject: name and finger losing in this morning's ITS +To: AGRE at MIT-AI +cc: BUG-ITS at MIT-AI, BUG-NAME at MIT-AI + +NAME was reinitialized because we had a new system this morning, and +someone had left DEBUG set in SYSBIN;NAME BIN, so it didn't kill +itself when it was done. This is fixed now. + +NAME hackers should remember to clear DEBUG when making a new dump, or +we get confused users. + +Date: 8 April 1982 11:15-EST +From: Philip E. Agre +To: BUG-ITS at MIT-AI + +:NAME loses in the ITS that was brought up this morning. You get +.VAL 0; 252>>.LOGOU 0/ 10400,,500000 +when it's done. + +Date: 6 April 1982 13:44-EST +From: Leigh L. Klotz +To: DCB at MIT-AI, RZ at MIT-AI, PSZ at MIT-AI, BUG-ITS at MIT-AI +cc: CSTACY at MIT-AI + +Ai is having some sort of hardware-like trouble. + +It crashes with a BAD PI 2, and then gets wedged so that +STOP/RESET/START gives the same BUGHLT error. That's +very strange, since it's not even running ITS then. + +Anyway, one time when this happened just before ITS +crashed it printed out 777144,,000000 DIRECTORY NTEXLB +TRASHED, or something like that. + +The salvager didn't report anything unusual. + +Leigh. + +Date: 6 Apr 1982 0952-EST +From: PDL at MIT-XX +To: GJS at MIT-MC, (BUG ITS) at MIT-MC +In-Reply-To: Your message of 6-Apr-82 0107-EST + +No it doesn't; you asked it to find all "sav4 *" and script the +results to mc:scheme;. You must quote the underbar with a ^Q. +------- + + +Date: 6 April 1982 01:34-EST +From: Patrick G. Sobalvarro +To: GJS at MIT-MC +cc: BUG-ITS at MIT-AI + + GJS@MIT-MC 04/06/82 01:07:00 + I don't know where this bug should go, but + :find mc:scheme;_sav4 * + goes into an infinite loop. + +FIND's JCL syntax is pulling a quick one on you. "_" means "the thing +that comes before this is an output file specification." So what +happened was this: FIND looked for all files that matched the pattern +SAV4 * on all directories on MC, and sent the output to SCHEME;FIND +OUTPUT. Since FIND takes such a long time on MC, and it spends most +of its time doing .OPENs, it looked like it was hanging in one .OPEN. + +GJS@MIT-MC 04/06/82 01:12:50 +To: (BUG ITS) at MIT-MC +Sorry about last message -- bug seems to have disappeared after I renamed +_SAV4 6 to FOO 1. The way it hung was in .OPEN. When renamed back to +old name, it worked. Seems to be some kind of disk lossage, but I dunno +how to describe it better. Perhaps the directory is slightly inconsistent +or something? + + +GJS@MIT-MC 04/06/82 01:07:00 +To: (BUG ITS) at MIT-MC +I don't know where this bug should go, but +:find mc:scheme;_sav4 * +goes into an infinite loop. + + +Date: 31 March 1982 07:25-EST +From: Glenn S. Burke +Subject: fc lossage? +To: BUG-its at MIT-AI +cc: BUG-LISP at MIT-ML, EB at MIT-ML + + Date: 30 March 1982 19:31-EST + From: Edward Barton + + :lisp + LISP 2122 + Alloc? n + * + (open "fc:eb;ef >") + MPV; 61322>>.CALL 61641 (RCHST) +---- +The MPV does not come from the call, and no words have been written by it. +This does not happen on ML, where apparently no one has been updating +DEVICE;JOBDEV FC for some time. + + +Date: Tuesday, 30 March 1982, 03:10-EST +From: Robert W. Kerns +Subject: OPEN +To: Leigh L. Klotz +Cc: BUG-DDT at MIT-AI, BUG-ITS at MIT-AI +In-reply-to: The message of 27 Mar 82 18:05-EST from Leigh L. Klotz + + + Date: 27 March 1982 18:05-EST + From: Leigh L. Klotz + Shouldn't OPEN on the tty for output cause ddt to ask you to give + the tty to the job? It doesn't seem to. + I first noticed this behavior several months ago with R, which + would run apparently OK ^P'd, but print out the first error + message (from processed text) as soon as P'd. + I guess this is because it didn't open the tty until then, + or something. + + I just ^Z'd a finger and ^P'd it before it had printed out + the hostname in brackets. As soon as I P'd it, it printed + that out. It hadn't asked for the tty. +It always asks for me. Note that it's not OPEN that should ask +for the TTY, but trying to use it. + +Date: 27 March 1982 18:05-EST +From: Leigh L. Klotz +Subject: OPEN +To: BUG-DDT at MIT-AI +cc: BUG-ITS at MIT-AI + +Shouldn't OPEN on the tty for output cause ddt to ask you to give +the tty to the job? It doesn't seem to. +I first noticed this behavior several months ago with R, which +would run apparently OK ^P'd, but print out the first error +message (from processed text) as soon as P'd. +I guess this is because it didn't open the tty until then, +or something. + +I just ^Z'd a finger and ^P'd it before it had printed out +the hostname in brackets. As soon as I P'd it, it printed +that out. It hadn't asked for the tty. + +Leigh. + +Date: 27 March 1982 12:03-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-AI + +AI now has ITS 1269 as ITS. + +The old NITS is named OITS, and there is no NITS or NITS1; +we go back to the canonical naming conventions on this +machine now. + +This version has a fix in the RENAMEF call by RMS, which +is not the same as the patch by Moon. + +DDT and PEEK were repurified. + +Chris + +Date: 27 March 1982 02:39-EST +From: Patrick G. Sobalvarro +To: BUG-ITS at MIT-AI + +Explanatory note about my last message - @ NITS1 was trashed in the +crash tonight. We're running NITS right now. I was trying to recover +@ NITS1 from backup. + +Date: 27 March 1982 02:37-EST +From: Patrick G. Sobalvarro +To: BUG-ITS at MIT-AI + +I just tried to get @ NITS1 off backup; DUMP shows the version of 3/5 on tape +206. Unfortunately, tape 206 seems not to have any such file on it, although +it has lots of other files on it. I suspect that this lossage is brought to us +courtesy of the wonderful folks who are always leaving backup tapes strewn +everywhere about the floor; that is, I think the tape I have is mislabelled. + +In any case, I think it'll be easier to generate @ NITS1 again than to find the +right tape. Is there someplace I can find the patches and make them to NITS, +or should I assemble a new ITS? + +WJL@MIT-ML 03/26/82 09:20:37 Re: ttyvar documentation out of date +To: (BUG ITS) at MIT-ML +tctyp also has a number for Z19's thats not in the table -- are there others? + +Date: 22 March 1982 15:42-EST +From: David C. Plummer +To: MOON at SCRC-TENEX +cc: DCP at MIT-MC, BUG-ITS at MIT-MC, rsl at MIT-MULTICS + +Small techincal point: The RFC for SUPDUP says that %TPCBS MUST +be on. Indeed, ITS doesn't care , but other systems may. + +So %TPMTA is ONLY used for hard wired terminals? This is +unfortunate. For purposes of modularity, I think that ITP should +only be a transport mechanism for 7, 8, or 12 bit characters and +know nothing of the character set it is transporting. Once thee +character is assembled at the server, the server should look at +%TOFCI and %TPMTA (it doesn't make much sence for both to be on) +and do the system dependent things to the characters. + +mumble... It's probaly not worth flaming about, since became an +issue in my terminal concentrator code, and it looks like I will +be using the 12.bit character set anyway... + + +Date: Monday, 22 March 1982 02:25-EST +From: MOON at SCRC-TENEX +To: dcp at mc +cc: bug-its at mc, bug-supdup at mc, rsl at multics + + Date: 18 March 1982 16:11-EST + From: David C. Plummer + To: BUG-ITS at MIT-MC, BUG-SUPDUP at MIT-MC, rsl at MIT-MULTICS + + Suppose I have an AAA terminal that is capable of generating a + META bit. Suppose further that it is connected to a terminal + concentrator that will talk SUPDUP to ITS. Since it is SUPDUP, I + am supposed to use the intelligent terminal protocol. Therefore, + the TTYOPT bits I think I should send include + %TOFCI OFF (can't do full character input) + %TPMTA ON (does have a hardware META bit) + %TPCBS ON (using ITP) + +%TPMTA means that bit 7 is the meta bit. +You don't have to use ITP to be Supdup, but if you do use ITP you +have to send the 12-bit character set, not the 8-bit character set, +and thus you can't use %TPMTA. +Probably you want to have %TOFCI off but still send characters with +the %TXMTA bit. + + Now, sombody comes along and types META-A. This has a code of + 301 (200+101). Now as I understand it, ITP is only a mechanism + for transmitting bytes, and does not assume the 5 bucky bits that + are part of %TOFCI. +No. ITS is a mechanism for inputting the internal ITS 12-bit character +set "directly" rather than going through the conversion from 8-bit +"ascii" characters. + + Therefore when it gets reassembled on ITS, + it gets assembled as 301. This is fine until the TYI normalizer + gets to it, and says, "Oh, this is %TXCTL+A" and converts it into + a ^A. Well, does that mean I should change a 301 into a 1101 + (%TXMTA+A) before sending it? NOW, how does EMACS handle this? + If I connected by a modem and sent META-A, would ITS convert this + from 301 into 1101 when it puts it in the input buffer? What is + the consistent model? How does EMACS deal with this? and Should + the TYI 7-bit normalizer look at %TOFCI before it goes around + looking for TOP, CONTROL and META bits? +EMACS doesn't handle any of this. It sees only the 12-bit character set. + +REM@MIT-MC 03/19/82 19:56:39 +To: (BUG ITS) at MIT-MC +Hmmm, in the middle of RMAIL typing out some text onto the screen, +it stopped typing. I waited a minute or so but it didn't continue, so +I tried to close network connection but it didn't close, so I RESET the +TIP port and reconnected, but upon attaching to my detached tree after +connect TTYAC4+4>> typed out something about can't get the TTY (which +got overprinted by BUG when I backspaced and it decided to put the cursor +where it should be instead of where it had been) and then entered that +breakpoint (which is also now overtyped). I guess I'll see now if +I can continue my RMAIL any. + + +Date: 18 March 1982 16:11-EST +From: David C. Plummer +To: BUG-ITS at MIT-MC, BUG-SUPDUP at MIT-MC, rsl at MIT-MULTICS + +Suppose I have an AAA terminal that is capable of generating a +META bit. Suppose further that it is connected to a terminal +concentrator that will talk SUPDUP to ITS. Since it is SUPDUP, I +am supposed to use the intelligent terminal protocol. Therefore, +the TTYOPT bits I think I should send include + %TOFCI OFF (can't do full character input) + %TPMTA ON (does have a hardware META bit) + %TPCBS ON (using ITP) + +Now, sombody comes along and types META-A. This has a code of +301 (200+101). Now as I understand it, ITP is only a mechanism +for transmitting bytes, and does not assume the 5 bucky bits that +are part of %TOFCI. Therefore when it gets reassembled on ITS, +it gets assembled as 301. This is fine until the TYI normalizer +gets to it, and says, "Oh, this is %TXCTL+A" and converts it into +a ^A. Well, does that mean I should change a 301 into a 1101 +(%TXMTA+A) before sending it? NOW, how does EMACS handle this? +If I connected by a modem and sent META-A, would ITS convert this +from 301 into 1101 when it puts it in the input buffer? What is +the consistent model? How does EMACS deal with this? and Should +the TYI 7-bit normalizer look at %TOFCI before it goes around +looking for TOP, CONTROL and META bits? + + +Date: 18 March 1982 01:47-EDT +From: Edward Barton +To: BUG-ITS at MIT-AI + +When the system is revived it often happens that the datapoint +controller gets wedged somehow. The result is that VT52's and +such do not get the revived message, or if the system got reloaded +may not get the message saying the system is in operation. (I +may be confused about that case.) Lock's DPK command fixes things +if you manage to figure out that the system is in fact up +even though your VT52 or Ambassador behaves as if it weren't. +Is there some way a DPK could happen automatically when the +system is revived? + +CBF@MIT-MC 03/11/82 12:58:20 Re: your crash dump +To: MOON at MIT-MC +CC: DCP at MIT-MC, CBF at MIT-MC, (BUG ITS) at MIT-MC +The PC is on the system console somplace of course, I think I might even +have written it in the log. + + +MOON@MIT-MC 03/09/82 02:41:06 Re: your crash dump +To: DCP at MIT-MC, CBF at MIT-MC +CC: (BUG ITS) at MIT-MC + DCP@MIT-MC 03/08/82 13:22:48 + To: (BUG ITS) at MIT-MC + MC was very sick earlier today. CBF dumped the original problem to + CRASH WEDGED +Since you don't say what the PC was, it's a bit hard to tell what's going on. +It seems to be actively transferring on both disk controllers, but looping +at UCPRL with interrupts inhibited. Was the PC written on paper somewhere? + +DCP@MIT-MC 03/08/82 13:22:48 +To: (BUG ITS) at MIT-MC +MC was very sick earlier today. CBF dumped the original problem to + CRASH WEDGED +Some symptoms: most .OPENs and .IOTs hung. I could do DCP^F, +DCP2^F .TEMP.^F, but not SYS^F, SYS1^F, or even TTY^F. This +almost looks like a directory cache problem. Unit 4 (T-300) got +several errors shortly before this all happened. Strangness: I +could run programs that were in my directory (presumably becuase +my directory was cache). + +After several attempts to reload, we succeeded, but we are not +sure what caused it to win. We cycled all three T-300, power +cycled unit 3, and set IMPUP/0 (thinking it might be the +ARPAnet). Some combintation of this caused it to come up, +finally. + + +DCP@MIT-MC 03/08/82 13:22:48 +To: (BUG ITS) at MIT-MC +MC was very sick earlier today. CBF dumped the original problem to + CRASH WEDGED +Some symptoms: most .OPENs and .IOTs hung. I could do DCP^F, +DCP2^F .TEMP.^F, but not SYS^F, SYS1^F, or even TTY^F. This +almost looks like a directory cache problem. Unit 4 (T-300) got +several errors shortly before this all happened. Strangness: I +could run programs that were in my directory (presumably becuase +my directory was cache). + +After several attempts to reload, we succeeded, but we are not +sure what caused it to win. We cycled all three T-300, power +cycled unit 3, and set IMPUP/0 (thinking it might be the +ARPAnet). Some combintation of this caused it to come up, +finally. + + +HIC@MIT-MC (Sent by HIC0@MIT-MC) 03/07/82 21:03:25 +To: (BUG ITS) at MIT-MC +MC's IO-11 was wedged in some unknown fashion. I reloaded it from home, +and it got fixed. + + +HIC@MIT-MC (Sent by HIC0@MIT-MC) 03/07/82 21:08:53 +To: (BUG ITS) at MIT-MC +Well, MC's IO-11 crashed again,and I reloaded it again. Maybe it's a more +organic failure than I thought. + + +HIC@MIT-MC (Sent by HIC0@MIT-MC) 03/07/82 21:03:25 +To: (BUG ITS) at MIT-MC +MC's IO-11 was wedged in some unknown fashion. I reloaded it from home, +and it got fixed. + + +MOON@MIT-MC 03/05/82 02:46:04 +To: (BUG ITS) at MIT-MC +The RFNAME system call is broken such that it trashes random locations +in user memory. This was killing the mailer on MC, so I patched the running system +and the dump. Patch is to change NRFNAM+22 from JUMPE Q,POPJ1 to JRST POPJ1. +The bug is that the code assumes that device-dependent RFNAME routines don't +clobber Q. The one for the Arpanet does. + +dcp@MIT-MC (Sent by HGA@MIT-MC) 03/05/82 01:10:32 +To: (BUG ITS) at MIT-MC +I took a quick look, and somebody changed the RFNAME code between ITS +version 1261 and 1266. Did this break things? + + +dcp@MIT-MC (Sent by HGA@MIT-MC) 03/05/82 01:03:35 +To: (BUG ITS) at MIT-MC +RFNAME on some NET: and some CHAOS: channels seems to be broken. This +started happening within the last week I think. For an example, pick +an ARPA telser and from PEEK try to look at is variables with the V +command. This is causing comsat to die at the moment getting a a PURPG +on an RFNAME of a CHAOS channel. + + +Date: 4 March 1982 18:45-EST +From: Earl A. Killian +Subject: hardware/microcode mod +To: CSTACY at MIT-AI +cc: BUG-its at MIT-AI + +I thought the Jump in JFFL was what the programmer does if +there's a free Lispm. + + +Date: 4 March 1982 1604-EST (Thursday) +From: Guy.Steele at CMU-10A +To: Christopher C. Stacy +Subject: Re: hardware/microcode mod +CC: bug-its at MIT-AI +In-Reply-To: Christopher C. Stacy's message of 4 Mar 82 02:06-EST + +I assume that the new instruction JFFL (Jump if Find Free Lispmachine) +is equivalent to JUMP (Do Not Jump)! +--Guy + +Date: 4 March 1982 11:43-EST +From: David C. Plummer +Subject: hardware/microcode mod +To: CSTACY at MIT-AI +cc: INFO-COBOL at MIT-MC, BUG-ITS at MIT-AI + +:doc instr JFFL + +JFFL ac,E Jump on Find Free LispMachine +skip if at least one free lisp machine matching some description + +the value at E contains an AOBJN pointer. The AOBJN pointer +points to ASCIZ strings in one of two forms: + - or CADR- +The star convention is allowed for building and room. It is not +allowed for the CADR number. + +ac is a pointer to a block of zero words followed by a non-zero +word which will receive an string of 7-bit characters (similar to +JCL passing). It is suggested that the non-zero word be 1, which +will cause the string to be ASCIZ. The string returned is a list +of rooms (without stars) or free machines separated by commas. + +Example: + + move ac,freeLM + JFFL ac,[-3,,[ [asciz /NE43-8**/] ;an 8th floor cadr + [asciz /CADR-2/] ;color + [asciz /38-350/] ;EECS terminal room + ]] + jrst .-1 ;I just gotta have one + +freeLM: repeat 10,[ 0 ? ] 1 + + +Date: 4 March 1982 02:06-EST +From: Christopher C. Stacy +Subject: hardware/microcode mod +To: BUG-ITS at MIT-AI + + + All ITS machines now have hardware for a new machine instruction: + JFFL - Jump if Find Free Lispmachine + + +MOON5@MIT-MC 03/03/82 02:43:26 Re: Hitting CALL on one TV hangs all of them +To: cstacy at MIT-AI +CC: (BUG ITS) at MIT-MC +Upon reflection, I think you are probably being faked out by the fact +that when the system is brought up (on AI) the system job goes catatonic +for a minute or two trying to type out "ITS IN OPERATION" on all the +TK-10 terminals that aren't there. Then after the available 1 or 2 +job slots get used up, you can't create any jobs until the system job +comes back and processes the request to create more job slots. The +right solution to this is to reassemble the system with TK10P turned +off; unfortunately this will renumber all the terminals, and absolute +tty numbers are known in several places. NAMDRG knows the number of +the free-screen TV. DMNSTR knows the number of the xgp console. The +TTYTYP file knows the numbers of all the terminals; NAME and NAMDRG +read this in when purified or something. + +Date: 3 March 1982 01:54-EST +From: James M. Turner +Subject: Disk Writes +To: BUG-ITS at MIT-AI + +*sigh* Does it try to write even if the pack with the most space is +not enough. Alternately, is there any way to "reserve" the proper amount +of space (again, approximately) so the other can't snarf it? + +MOON@MIT-MC 03/03/82 01:52:34 +To: JMTURN at MIT-AI +CC: (BUG ITS) at MIT-MC + Date: 2 March 1982 23:14-EST + From: James M. Turner + To: BUG-ITS at MIT-AI + + the fact that various demons (notably INQUIR UPDATE) will try to create + new files of estimatably size on packs without that much space seems + unreasonable. Rather than have these programs tie up that time and space + with unfinished files, why not have them make a rough guess as to the size + of the file, and pick a pack accordingly. The present setup requires + some poor hacker to clear off sufficient space for the update. + +Files are always written on the pack with the most space. Unfortunately, +when the file takes a long time to write, someone else can come in and grab +the space before the file finishes being written. + +Date: 2 March 1982 23:14-EST +From: James M. Turner +To: BUG-ITS at MIT-AI + +the fact that various demons (notably INQUIR UPDATE) will try to create +new files of estimatably size on packs without that much space seems +unreasonable. Rather than have these programs tie up that time and space +with unfinished files, why not have them make a rough guess as to the size +of the file, and pick a pack accordingly. The present setup requires +some poor hacker to clear off sufficient space for the update. + James + +DCP@MIT-MC 02/24/82 21:05:49 +To: (BUG ITS) at MIT-MC +I case anybody cares, the reason MC was down memory 200-577 was +that the AMPEX start address switches were set wrong. My theory +is that when DEC Field Circus re-enabled sector 0 a finger kept +going in the up-right direction and flipped the address switch. +There is now a piece of paper on the inside of the AMPEX door +wich gives a correct setting of the switches. + + + +CSTACY@MIT-MC 02/24/82 21:53:16 +To: MOON at MIT-MC +CC: (BUG ITS) at MIT-MC +I renamed the ITS dumps on MC in the canonical fashion as you suggested. +NITS1 is current, ITS is old. Next patched ITS should be dumped out as NITS. +Older stuff migrated to OxITS files. Copy of NITS1 on BACKUP. + +Chris + + +Date: Wednesday, 24 February 1982, 20:20-EST +From: Robert W. Kerns +Subject: Abnormal LOGOUT TIMES +To: Edward Barton +Cc: BUG-ITS at MIT-AI +In-reply-to: The message of 24 Feb 82 17:51-EST from Edward Barton + + Date: 24 February 1982 17:51-EST + From: Edward Barton + To: BUG-ITS at MIT-AI + + Is this peculiar segment of CHANNA;LOGOUT TIMES normal, and + will it hurt anything? It seems to have the effect of making + logout times for people beyond the discontinuity inaccessible + to :when. + + RJA 01/17/82 01:33:18 + RJD 02/24/82 09:21:18 + RK 02/16/82 02:20:32 + 02/19/82 14:16:10 + RLB 01/11/82 23:38:59 + RLL 02/20/82 20:24:08 +It's abnormal, delete that line. + +Date: Wednesday, 24 February 1982, 20:15-EST +From: Robert W. Kerns +Subject: MC memory F +To: BUG-ITS at MIT-AI +Cc: MOON at SCRC-TENEX + +Could this be related to a power supply dying in that memory? +DEC fixed a power supply after (I think it was) Mem F dropped +dead yesterday. Ty called me yesterday just as I was about to +go sleep, so I just told him to call DEC instead of looking at +it myself. + +Date: 24 February 1982 17:51-EST +From: Edward Barton +To: BUG-ITS at MIT-AI + +Is this peculiar segment of CHANNA;LOGOUT TIMES normal, and +will it hurt anything? It seems to have the effect of making +logout times for people beyond the discontinuity inaccessible +to :when. + +RJA 01/17/82 01:33:18 +RJD 02/24/82 09:21:18 +RK 02/16/82 02:20:32 + 02/19/82 14:16:10 +RLB 01/11/82 23:38:59 +RLL 02/20/82 20:24:08 + +MOON@MIT-MC 02/23/82 13:56:58 Re: Status of MC +To: (BUG ITS) at MIT-MC +CRASH;@ FEB22 indicates that bank 7 of mem F is acting up again. +I can't tell which half, but probably this indicates that it was +sheer coincidence that the right half of this bank started working +when DEC fixed it a while back. If anyone wants to debug this, a +good start would be to swap bank 7 right with bank 6 right and bank +7 left with bank 5 left, then either get it to fail in a diagnostic +or put it back on-line and see what addresses fail. The map of +physical locations of memory banks is inside the front door of mem A or B. + +Date: 23 February 1982 00:00-EST +From: Daniel L. Weinreb +To: CSTACY at MIT-AI +cc: BUG-ITS at MIT-AI + +Ed and I just noticed that you left ATSIGN DDT as an SBLK file instead of +as a PDUMP file; it was apparent because the system was so incredibly +slow. We have fixed it; please be more careful. + +CSTACY@MIT-MC 02/22/82 06:30:47 +To: (BUG ITS) at MIT-MC +Installed ITS version 1268 as NITS1, old one is still NITS. +Seems to work. There are no memory patches here. + + +Date: 22 February 1982 05:06-EST +From: Christopher C. Stacy +To: BUG-ITS at MIT-AI + +AI is now running ITS 1268, which as dumped as NITS. The current memory +patches are dumped. The former system version is now called ITS. + +Chris + +Date: Friday, 12 February 1982, 12:18-EST +From: David L. Andre +Subject: nulls on ITS +To: MHS at MIT-MC, BUG-LISPM at SCRC-TENEX, BUG-ITS at MIT-AI +Cc: DLA at SCRC-TENEX + + From: MHS@MIT-MC + Date: 02/11/82 18:53:27 + I tried to DOVER AI:LMWIND;WINDOC PRESS and the file turned out to be a bad + press file. Would whoever knows about such things be able to reformat it please? +This is yet another manifestation of the fact that many if not most +files on 15 consist of nulls. Is nobody ever going to fix this? + +GZ@MIT-MC 02/05/82 01:09:24 +To: (BUG ITS) at MIT-MC +It seems that :tctyp t1061 now turns off more processing, it didn't use to +(in fact today is the first time I noticed it) + +ALAN@MIT-MC 01/31/82 23:35:04 +To: (BUG ITS) at MIT-MC +> doesn't work when opening any of the core-link devices. +(who cares!) + +Date: 28 January 1982 20:49-EST +From: Leigh L. Klotz +To: ED at MIT-AI, BUG-ITS at MIT-AI +cc: GJC at MIT-AI + +I think putting in the idle time and maybe the commode +bits is a good idea, but I think people use the core +allocation value, especially on MC, where they get unhappy +at the first hint of paging. I don't know if they use +TTY^F rather than peek, though, so this may not be important. +Leigh. + +Date: 28 January 1982 19:45-EST +From: Ed Schwalenberg +Subject: TTY:.FILE. (DIR) +To: BUG-ITS at MIT-AI + +How about flushing the totally useless CORE and TOTAL figures +in favor of idle time and perhaps comm mode bits? This would +cut down greatly on the use of NAME to get the idle time, which +in turn would reduce thrashing due to hacking LSR1 greatly. + +Date: 27 January 1982 12:35-EST +From: Stavros M. Macrakis +Subject: ULSPBR +To: MOON at MIT-MC +cc: BUG-ITS at MIT-MC + +Yes, I know it's unfinished; so presumably the variable can be flushed. + + +MOON@MIT-MC 01/27/82 04:07:08 Re: ULSPBR +To: MACRAK at MIT-MC +CC: (BUG ITS) at MIT-MC +It's a feature that GLS never finished. + +MACRAK@MIT-MC 01/26/82 23:42:06 +To: (BUG ITS) at MIT-MC +Any special reason for user variable Ulspbr? I don't think the +"Special Lisp instructions" are ever used... (are they even in the +microcode?) and anyway, .Uset lspbr is commented out. All that ever +happens is that it's saved and restored. + +Date: 26 January 1982 15:46-EST +From: Stavros M. Macrakis +Subject: Disk delay +To: BUG-ITS at MIT-MC + +I tried to print (in ddt) the file Macrak;Scalrp > several times and +it just wouldn't respond. I then tried it in Teco, where it didn't +respond either, so I ^P'd and looked at the job's Flsins, which was (I +believe this is accurate) Skipe Qsnloc+40 TRN ; i.e. the +directory was locked. After about 20 secs, the Teco won. + +How could this happen? I wasn't trying to write, so it presumably wasn't a +directory GC. I did not try looking at other files, so I don't know if it +had to do with this particular file. + +Anyway, a curious incident. Thought you might like to know. + + +Date: 23 January 1982 14:26-EST +From: David Vinayak Wallace +To: BUG-ITS at MIT-AI + +the file ai:.info.;its locks cantains nothing but nulls. +Perhaps other fies got destroyed in the crash? + +Date: 22 January 1982 01:16-EST +From: Richard M. Stallman +To: BUG-ITS at MIT-AI + +AI crashed with QFUD/1 but every QSNUD was nonzero. + +DCP@MIT-MC 01/16/82 12:02:31 +To: GREN at MIT-MC +CC: (BUG ITS) at MIT-MC + +[See .INFO.;ITS UFD and SYSTEM;FSDEFS for more info.] + +The third word of the UFD is the sixbit of the name of the +directory. Of the five words in the NAME area that describe the +file, the right half of the fifth word contains the UFD index of +the file author's HSNAME. This is why the author of some files +is GUESTn or somesuch. If there were more room in the five word +block, actual sixbit of the author's XUNAME could be stored +there, but... + + +GREN@MIT-MC 01/16/82 01:36:13 +To: (BUG ITS) at MIT-MC +Just a question, not a bug: In the UFD, is just an index +into the MFD or something, and *not* 1 word of sixbit... I ask +since an author (sname) that doesn;t exist on one site prints +as -??- or something else equally uninformative... + +MOON5@MIT-MC 01/13/82 16:37:57 Re: one-proceed broken on MC +To: (BUG ITS) at MIT-MC +This was caused by some unidentified cretin copying the file SYS:ATSIGN DDT +from some other machine onto MC. The proper procedure is to load up +SYSBIN;DDT BIN and start it at PURIFY. Don't let it happen again! +(And maybe someone can fix DDT to print a warning if it is not on the +machine and ITS version it is purified for reason. The reasons why it +should print a warning rather than dying should be obvious.) + +Date: 13 Jan 1982 1643-EST +From: SWG at MIT-DMS (S. W. Galley) +To: Mike at BRL +Cc: BUG-ITS at MIT-AI, Gurus at BRL +In-reply-to: Message of 18 Dec 81 at 0359 EST by mike@BRL +Subject: [Re: :HISTORY Lossage on DMS] +Message-id: <[MIT-DMS].219986> + +The bug you reported was caused by an obsolete module -- now updated -- +used by the HISTORY program, which translates a host name to its address +by mapping the host table into primary storage: this makes an MPV error +("memory protection violation") less surprising, but no less spectacular! + + +ED@MIT-AI 01/13/82 03:21:06 Re: Is one-proceed broken on MC? +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG DDT) at MIT-MC +There is a well-known long-standing bug in the hardware which will +never be fixed which causes a one-proceed which faults on instruction +fetch to execute the following instruction as well (which may be on a +different page and thus ...). This is not it. A much more dramatic +demonstration is simply that  and  are now abbreviations for P. +Emacs complains of PDL overflow when proceeded in this way, which explains +some bizarre behavior when I accidentally typed a  the other day. + + +DCP@MIT-MC 01/12/82 22:08:27 Re: Is one-proceed broken on MC? +To: (BUG ITS) at MIT-MC, (BUG DDT) at MIT-MC + +On MC running ITS 1249 (11/21/81), and DDT 1388 (always used to work) + +:ddt +(no init) + :job j + 100/jfcl + 1000g +100>>JFCL ^N +ILOPR;101>>0 0/ 0 0/ 0 + +Well, what can I say? +It works on AI 1250, DDT 1388. +It works on ML 1256, DDT 1388. +It works on DM 1254, DDT 1388. + +I'm pretty sure this was working as little as a week ago. Has +somebody made a gross patch to the DDT on MC? Or is our beloved +MC microcode sick? Or is ITS not doing the right thing with the +microcode? + + +GSB@MIT-ML 01/11/82 14:35:49 Re: ml dialups +To: RSG at MIT-ML, OAF at MIT-ML +CC: (BUG ITS) at MIT-ML + RSG@MIT-ML 01/11/82 10:34:25 + I don't know exactly who to complain to about this, but it seems that 2 of + ML's Vadic modems are broken. (TTY 4 and TTY 32 I think are the numbers + of the broken ones; TTY 1 and TTY 11 are OK.) + + TTY 4 answers busy when nobody is logged in on it. + TTY 32 just doesn't answer at all. +---- +TTY 4 answers now. Presumably someone didn't hang up after logging +out or after a crash. TTY 32's number isn't the same as it used to be +(actually, it now IS the same as it used to be), it has been back to being +6733 for some time. It answers, although (as i reported some time ago) +when i last tried to use it (at least a week ago) i got lots of garbage. +p.s. ml dialups can be complained about to OAF with CC to me, or to me +and i forward. + + +RSG@MIT-ML 01/11/82 10:34:25 +To: GSB at MIT-ML, (BUG ITS) at MIT-ML +CC: RSG at MIT-ML +I don't know exactly who to complain to about this, but it seems that 2 of +ML's Vadic modems are broken. (TTY 4 and TTY 32 I think are the numbers +of the broken ones; TTY 1 and TTY 11 are OK.) + +TTY 4 answers busy when nobody is logged in on it. +TTY 32 just doesn't answer at all. + +Cheers -- rsg + + +RMS@MIT-AI 01/11/82 01:03:27 Re: Purpg on CBLok Corblk +To: MACRAK at MIT-MC +CC: RWK at MIT-MC, (BUG ITS) at MIT-MC +I will do something reasonable about this situation. + + + +Date: 10 January 1982 21:15-EST +From: Christopher C. Stacy +Subject: where is the DISK listing +To: BUG-ITS at MIT-AI + + +I frequently borrow the source listings, and if I have one it can +always be found in top of my desk in 926. + +MACRAK@MIT-MC 01/10/82 21:13:51 Re: Purpg on CBLok Corblk +To: RWK at MIT-MC +CC: (BUG ITS) at MIT-MC +100/ setz +101/ $0'corblk$ +102/ 1000,,%cblok +103/ 1000,,-1 +104/ 400000,,110 +110/ -1,,0 +.call 100$x + +Manages to make page 0 pure (!!??) and get a Purpg error. All I asked for +was locking the pages in core (%cblok). I seem to remember my original +example doing something weird with -2,,0 but not -1,,0, but the above will +do for now. + +On the other hand, using %cblok+%cbndr+%cbndw works fine. Perhaps there are +both documentation and code bugs?: some sort of specification of r/w status +is needed? + + +RMS@MIT-MC 01/10/82 16:33:46 +To: (BUG ITS) at MIT-MC +I just fixed a but whereby TTYSET in a job which doesn't own the tty +can clobber the RH of TTYSTS when the job gets the tty. + + +Date: 10 January 1982 15:50-EST +From: Richard M. Stallman +To: BUG-ITS at MIT-AI + +Does anyone know where the listing of DISK is? + +Date: 10 January 1982 15:50-EST +From: Richard M. Stallman +To: BUG-ITS at MIT-AI + +AI crashed at QCH3+3 because QFCHN was nonzero. It was 1. +Looking thru the QUSR words, I found that there was indeed a free +channel, which the loop at QCH2 had not found. Perhaps there is +something that can free a disk channel while QCHSW is locked? +If so, the error check has to be removed or done with interrupts +locked. + +Date: 10 January 1982 13:26-EST +From: Stavros M. Macrakis +Subject: PURPG in CORBLK call (incorrect analysis) +To: RWK at MIT-MC +cc: BUG-ITS at MIT-MC + +But none of my pages were pure. + +DCP@MIT-MC 01/10/82 00:43:17 Re: CHAOS slots on MC +To: (BUG ITS) at MIT-MC +Should the number of CHAOS connections on MC be raised to 64, or +should I CONTINUE to have to gun down (LISP Machine) file servers +(usually about 10) every time the connection table gets +hopelessly full? + +RWK@MIT-MC 01/08/82 08:09:54 Re: PURPG in CORBLK call +To: MACRAK at MIT-MC +CC: (BUG ITS) at MIT-MC +The error is right, it is getting a PURPG error attempting to write back +the updated AOBJN pointer you supplied. You can't use a literal for an +updated argument! + + +MACRAK@MIT-MC 01/07/82 19:45:02 +To: (BUG ITS) at MIT-MC +.call [setz?'corblk? %climm,,%cblok ? %climm,,-1 ? setz(%clin) [-2,,0] ] +(in a job with .memt/4000) gives Purpg. Now, the call may be wrong (because +of missing arg 5), but Purpg seems like the wrong error to give. It also +isn't clear from the documentation that arg 5 is needed in this case, +since with arg 3 = [-1,,0], arg 5 is NOT needed. + +Date: 4 January 1982 23:00-EST +From: David L. Andre +To: BUG-ITS at MIT-AI +cc: DLA at MIT-AI + +When are the files on pack three going to have real contents again? I'm +being screwed again and again when the file system thinks that the +contents are there, but I get all zeros. I'd much rather get an error +"PACK NOT MOUNTED" than get bad data. + +MACRAK@MIT-MC 01/04/82 20:09:31 +To: (BUG ITS) at MIT-MC +Is .info.;its corblk needed given its .calls? + +MARTY@MIT-MC 01/04/82 18:12:48 +To: (BUG ITS) at MIT-MC + +I was wondering if we get a DEC-20 and we use +ITS, if we could call it TWITS? + + + +MOON@MIT-MC 01/04/82 14:30:02 Re: AOSG not working with .HANG +To: MACRAK at MIT-MC +CC: (BUG ITS) at MIT-MC +This is fixed in the source; the sense of the skip condition +was backwards because the operands of the instruction were +interchanged. + +MACRAK@MIT-MC 01/04/82 13:19:23 +To: (BUG ITS) at MIT-MC +100/ aosg 200 +101/ .hang +200/ -5 +increments c(200) up to -1, then stops, never skipping! What's +weirder is that 100/aose 200 only increments 200 once! And this +is despite all sorts of ^X^P'ing and memory examination which, +one would think, would PClsr all over the place. + +MOON@MIT-MC 12/29/81 13:06:56 Re: STY question +To: MACRAK at MIT-MC +CC: (BUG ITS) at MIT-MC + MACRAK@MIT-MC 12/28/81 19:51:16 + To: (BUG ITS) at MIT-MC + How do you check if the far end (user) of a STY is waiting for input? + +:doc .call styget + +It's documented to "probably not work very well". I don't know whether +or not that is true. + +MACRAK@MIT-MC 12/28/81 19:51:16 +To: (BUG ITS) at MIT-MC +How do you check if the far end (user) of a STY is waiting for input? + + +JPG@MIT-MC 12/28/81 16:39:38 +To: (BUG ITS) at MIT-MC +My apologies for my recent BUG-ITS notes. I forgot I was logged in as +JEFFG when I typed X^K, and the error message was not at all helpful +in this regard. + + +JEFFG@MIT-MC 12/28/81 16:19:41 Re: continuation: +To: (BUG ITS) at MIT-MC +Oops: X^K now gives "CAN'T READ DISK FILE". + + +JEFFG@MIT-MC 12/28/81 16:18:52 +To: (BUG ITS) at MIT-MC +Why does :XFILE JPG;JPG ^Q_X work, but not X^K ? The latter has always +done the trick in the past. + + +Date: 18 Dec 81 3:59:26-EST (Fri) +From: Michael Muuss +To: BUG-ITS at Mit-Ai +cc: Gurus at BRL +Subject: :HISTORY Lossage on DMS +Via: BMD70; 18 Dec 81 4:01-EDT + +I ran this on DMS before I realized that BRL-BMD has probably not been +added to the host tables yet. However, the result was sufficiently +spectacular that I figured somebody would like to hear. + Cheers! + -Mike +--------------------------------------- + +*:history brl-bmd + +*ERROR* +DANGEROUS-INTERRUPT-NOT-HANDLED +MPV!-INTERRUPTS +#WORD *310000634117* +LISTENING-AT-LEVEL 2 PROCESS 1 +^S +:KILL +* + +--------------------------------------- + + +GSB@MIT-ML 12/16/81 15:44:22 +To: (BUG ITS) at MIT-ML +CADR, CADDR, and CADDDR should be synonyms for the SECOND, THIRD, and FOURTH +devices. Perhaps also there should be an NTH device which is the "last" +one in the sequence, for not-quite-tape archival. + + +Date: 15 December 1981 19:21-EST +From: Earl A. Killian +To: DEVON at MIT-ML +cc: BUG-ITS at MIT-ML + + Date: 12/12/81 18:21:15 + From: DEVON at MIT-ML + + Of course this penalizes a (hypothetical?) + user with lines of 128 or longer in favor of a user with slow connection, + but does anyone really want 128. characters on a line? + +Yes. + + Date: 12/15/81 03:45:44 + From: DEVON + + What should happen if a multi-character sequence like %TVMV0 gets + an argument byte valued 214? + +It moves to that line/column of course. + + Is this to be taken as a %TDORS which + has already flushed the real argument bytes further up the pipeline? + +No. + + Or must every buffer know about such sequences and delay the action + of a %TDORS until this situation won't arise, + +Something like that. + + or do argument bytes + 214 and 215 get quoted by %TDQOT? + +No, that's not at all the function of %TDQOT. + + + +DEVON@MIT-MC 12/15/81 03:45:44 Re: SUPDUP +To: (BUG ITS) at MIT-MC +What should happen if a multi-character sequence like %TVMV0 gets +an argument byte valued 214? Is this to be taken as a %TDORS which +has already flushed the real argument bytes further up the pipeline? +Or must every buffer know about such sequences and delay the action +of a %TDORS until this situation won't arise, or do argument bytes +214 and 215 get quoted by %TDQOT? + +DEVON@MIT-ML 12/12/81 18:21:15 +To: (BUG ITS) at MIT-ML +Another Output-Reset related gripe: + +when output characters reach the level where flow control happens, +they are no longer flushable. This means that during a long listing +I can type ^S (knowing that DDT will eventually shut up ten-twenty +lines later) and before output stops I can use the intelligent +terminal protocol to stop and start output several times, bacause +response speed to flow control is an order of magnitude better +than the response to ^S. + +If multi-character %td sequences were forbidden argument bytes >177 then +%tdors would behave more like a genuine out-of-band signal, and maybe +that would make it permissible to flush a buffer without knowing about +multi-character sequences. Of course this penalizes a (hypothetical?) +user with lines of 128 or longer in favor of a user with slow connection, +but does anyone really want 128. characters on a line? + +MOON@MIT-MC 12/11/81 14:59:30 Re: When does ITS send %TDMOV ? +To: DEVON at MIT-MC +CC: (BUG ITS) at MIT-MC +When %TOMVU isn't set, thus the terminal needs to know where it's +coming from as well as where it's going to. This would be the case +on printing terminals. User-mode programs such as Emacs and Macsyma +may send it in other circurmstances as well. + +DEVON@MIT-MC 12/11/81 02:33:38 +To: (BUG ITS) at MIT-MC +when does ITS use %tdmov instead of %tdmv0? + +I never recieved (or bothered to implement) %tdmov on my terminal until +just now, while testing a gross kludge that changes my tctyp to printing +momentarily, upon changing it back +I got all %tdmov's for a while. + +I'd like to know how to induce ITS to revert to the shorter %tdmv0. + +Date: 6 December 1981 01:31-EST +From: Christopher C. Stacy +To: ALAN at MIT-MC +cc: CHRIS at MIT-MC, BUG-ITS at MIT-MC, BUG-DDT at MIT-MC, + DCP at MIT-MC + + ALAN@MIT-MC 12/05/81 16:22:32 + Am I to understand that this means that version 1388 of DDT has ... Pissed off,Alan + +No. + + + +ALAN@MIT-MC 12/05/81 16:42:00 +To: (BUG ITS) at MIT-MC +CC: (BUG DDT) at MIT-MC +I reinstalled the old version of ddt + +ALAN@MIT-MC 12/05/81 16:22:32 +To: CHRIS at MIT-MC, (BUG ITS) at MIT-MC, (BUG DDT) at MIT-MC +To: DCP at MIT-MC + DCP@MIT-MC 12/05/81 14:06:07 + To: CHRIS at MIT-AI + CC: (BUG ITS) at MIT-MC + CHRIS@MIT-AI 12/05/81 10:33:43 + + I reassembled and installed DDT 1388 on MC so that it will use + the correct new hsname scheme. + + Chris + + Please do not make modifications to existing installed code + without upping the version number. Some people's ready messages + are assembled code and expect certain entrypoints within DDT. + The loader checks to see if the version has changed, and if so + does not load the ready message. + +Am I to understand that this means that version 1388 of DDT has a +different mapping from symbols to locations depending on what MACHINE +it is running on? That is TOTALLY unacceptable and completely +brain-damaged. What good is a goddamned VERSION NUMBER anyway if you +don't CHANGE it when you change the VERSION!!! + Pissed off, + Alan + + +Date: 5-DEC-1981 16:02:44.12 +From: Robert W. Kerns +Reply-to: RWK at MIT-MC +Subject: DDT Pseudo-1138 +To: CHRIS at MIT-MC +Cc: BUG-ITS at MIT-MC + +Please undo your installation. You have re-installed a large set of bugs, +since there were a lot of patches made to 1138. I'll talk to you about getting +the HSNAME stuff in. + + +DCP@MIT-MC 12/05/81 14:06:07 +To: CHRIS at MIT-AI +CC: (BUG ITS) at MIT-MC + CHRIS@MIT-AI 12/05/81 10:33:43 + + I reassembled and installed DDT 1388 on MC so that it will use + the correct new hsname scheme. + + Chris + +Please do not make modifications to existing installed code +without upping the version number. Some people's ready messages +are assembled code and expect certain entrypoints within DDT. +The loader checks to see if the version has changed, and if so +does not load the ready message. + + +CHRIS@MIT-AI 12/05/81 10:33:43 +To: (BUG its) at MIT-MC +CC: CSTACY at MIT-AI + +I reassembled and installed DDT 1388 on MC so that it will use +the correct new hsname scheme. + +Chris + + + +MOON@MIT-MC 12/02/81 15:20:04 Re: System console +To: CBF at MIT-MC +CC: (BUG ITS) at MIT-MC +I don't think it's easy to make different consoles have different +size buffers. What information is it that you want to see? + +ELLEN@MIT-MC 12/01/81 16:43:39 +To: (BUG ITS) at MIT-MC +On MC, when a new user logs in INQUIR no longer queries him to +fill it out. + + +ELLEN@MIT-MC 12/01/81 17:03:45 Re: Previous message about INQUIR +To: (BUG ITS) at MIT-MC +Sorry, never mind, I just realized that someone had deleted the +* LOGIN file on the GUEST0; directory on MC, which is what was +calling INQUIR. + + +Date: 1 Dec 1981 1504-EST +From: SWG at MIT-DMS (S. W. Galley) +To: gsb at MIT-DMS +Cc: BUG-its at MIT-DMS +In-reply-to: <[MIT-DMS].216669> +Subject: [Re: BUG => itsfgsbsdm's] +Message-id: <[MIT-DMS].216742> + +I set DM's T00 width to 80. in TTYTYP 238. + + +CBF@MIT-MC 11/28/81 19:44:21 Re: System console +To: (BUG ITS) at MIT-MC +With the rate of activity on MC nowadays (actually for a couple of years) +now, I've noticed that spying on the system console (or using :SYSMSG) has +less and less often given me the information I was looking for. +Frequently all one can see is the last 20 seconds of activity. Anyway, +this is a suggestion that the system console's buffer be made substantially +larger. If things work the way I guess they do, the only substantial +disadvantage I can think of this having is that output resets on that +terminal when it is being used an an ordinary terminal will take a long +time. + + +Date: 22 November 1981 04:00-EST +From: Chris Stacy +Subject: last message +To: BUG-ITS at MIT-AI + +Foo. I just found out what UNAME is. + +Date: 22 November 1981 03:56-EST +From: Chris Stacy +To: BUG-ITS at MIT-AI + + +ITS crashed in ZUSER2. The UNAME was SYS (USER=0). +Examined some stuff on the TTY and reloaded ITS. + +GSB@MIT-ML 11/20/81 17:26:30 +To: (BUG ITS) at MIT-ML + cstacy@MIT-ML (Sent by ___031@MIT-ML) 11/20/81 11:45:53 + :TIME says ML ITS has run for over 287 days, but + I know that it was reloaded a few minutes ago. +the second value returned by RQDATE sez the system was brought up in +1983 (or should i interpret that as 1883?). The time program claims +in the source to not handle uptimes greater than a year, so that +explains why it says 287 days rather than 98 years. + + +MOON@MIT-MC 11/19/81 14:58:07 Re: :REATTA broken +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC +I changed the ATTACH system call to call ATTYCI rather than ATTYC2. +A new system ought to get installed on MC soon. + +RMS, is this the correct fix? + +DCP@MIT-MC 11/18/81 11:03:38 +To: (BUG ITS) at MIT-MC +Has the REATTA symbolic system call been changed (since may or +so)? Has anybody else not been able to use the :REATTA program? +:REATTA hasn't changed since December 1978, yet I have not been +able to sucessfully use this program for a month (at least). + +Specifics: (from a space cadet keyboard over the chaos net) + + +dcp0u +:detach + +dcp0u +--Attach your detached tree-- +:reatta dcp/k + ;;; at this point, nothing happens, but if I hit + + ;;; I get another PWORD, so I got detached again!! +dcp0u +--You have several detached trees-- +--Attach a detached tree-- +ERROR: ATTACH: BAD CHANNEL NUMBER +375>>.CALL 1046 (ATTACH) + ;;; This is :REATTA bombing +:calprt +Arg 1: 3 ;;; JOB channel +Arg 2: 400042 ;;; TTY to attach it to +Control bits: 400000 + +:ichan 3 +USR: DCP HACTRO (uai\10) + ;;; looks valid to me. +:vv +DCP HACTRO 2 DCP; Det +15:11 ;;; the disowned tree +DCP HACTRN ... DCP; + ... + + +I did a little poking: +I can understand why (SYSTEM;ITS)NATTAC calls +(SYSTEM;TS3TTY)ATTYC2 to decode the tty number, but why does +ATTYC2 JRST to ATTYC7 instead of to ATTYC8. ATTYC7 does not +allow 400000+ttynum but ATTYC8 does (that is the only difference +between the routines). + + +DCP@MIT-MC 11/12/81 12:46:39 +To: JPG at MIT-MC +CC: (BUG ITS) at MIT-MC, ASB at MIT-MC, GJC at MIT-MC +I did a little poking around and found the following: + +There is a mojor difference between TS3TTY 301 and TS#TTY 305. +The majority of the difference seems to be in the ATTY** routines +(the ones that determine if you have the TTY and whether you +should wait for it). + +I tried the the following: + a^K + factor(ratsimp((x+y)^12)); + ^Z ^P +now I typed RETURN several times (say 20). After the 10th I got +the message JOB A WANTS THE TTY. Macsyma wanted to SIOT. I +looked at the siot string and it contained %TDMV1 codes among +other things. When you P the macsyma you will see that the +cursor goes to just above the JOB A WANTS THE TTY message, NOT +where you left off and NOT where you happened to be. + +The culprit: + RCPOS (Read cursor pos). In the rearrangement of the +ATTY** routines it appears RCPOS has been changed to allow you to +read the cursor even when you don't have the tty (it used to wait +for the TTY). Unfortunately, MACSYMA uses this information to +compute %TD codes. + + +JPG@MIT-MC 11/12/81 04:41:53 +To: (BUG ITS) at MIT-MC +CC: JPG at MIT-MC, ASB at MIT-MC, GJC at MIT-MC +On about 10/29/81 I noticed that MACSYMA was misbehaving when it was +$Ped after having been ^Zed and ^Ped. Namely the cursorpos calculation +was off and it displayed the next expression one or two rows too high. +Just now I showed it to RWK, and as we suspected it was an ITS (TS3TTY) +problem, we transferred the MACSYMA over to ML which is running an older +ITS (#1230 as opposed to #1244) and tried the same experiment there where +it ran fine. The difference was that you get the interrupt for +"Job wants the TTY" at an earlier point on ML than on MC, namely at +CRSRP1+4>>.CALL RCPOS (which presumably does the necessary cursorpos +recalculation) rather than at IFORCE+11>>.CALL SIOT . If it is +relevant, I am on a VT52. Also, the thing I ask MACSYMA to do is +FACTOR(RATSIMP((X+Y)^20)); which just uses up some time, so while +it is computing, I ^Z ^P , and $P when it says "Job wants the TTY". +(Sorry I am so verbose, but I wanted to make sure I included whatever +info may be necessary.) + + +GJC@MIT-MC 11/09/81 11:39:10 +To: (BUG ITS) at MIT-MC +Right now there are about 20 NETRFC jobs from MIT-XX, all in the FINISH +state and not doing anything else, but taking up net ports. +I've gunned them down. + + +DCP@MIT-MC 11/07/81 20:08:50 Re: SCML system call +To: (BUG ITS) at MIT-MC, RK at MIT-MC +Why does SCML cause an error when it tries to set the echo area +and it does not have the TTY? :CALL SCML does not say there are +any errors for this system call. In fact, the routine ASCML in +SYSTEM;TS3TTY puts the echo area in a magic field with + DPB B,[$TBECL,,TTYTBL(U)] +Which I guess will get put in the right place when +the job gets .DTTY'd. But after the DBP it does a POPJ P, +causing an error instead of + AOS (P) + POPJ P, +which would appear to be the right thing. + + +Date: 6 November 1981 11:47-EST +From: Richard C. Waters +To: BUG-ITS at MIT-AI + +dump is broken in a weird way. if you try to list the files on a tape +on dsk it gives you the error message that the file dsk:wall 1 +doesn't exist, and just won't do anything. + + Dick + +MOON@MIT-MC 10/28/81 19:23:06 Re: Installing TX XTEX +To: DCB at MIT-MC +CC: (BUG INSTALL) at MIT-MC, (BUG ITS) at MIT-MC +This program doesn't work with files longer than 128K words (due to +overflow problems in a halfword). It should be rewritten, for this +and numerous other reasons. Volunteers? + +Date: 27 Oct 1981 1518-EST +From: SWG at MIT-DMS (S. W. Galley) +To: MOON at MIT-MC +Cc: (BUG ITS) at MIT-DMS +In-reply-to: Message of 21 Oct 81 at 1502 EDT by MOON@MIT-MC +Subject: [Re: catatonia - ACs/ JRST 4,] +Message-id: <[MIT-DMS].213675> + +The PI lights at the time indicated normal states, I believe: + PI IN PROGRESS [none] + PI REQUEST [none] + PI ACTIVE 1-7 + IOB PI REQUEST 2,3,7 +Curiously, the parity buffer didn't match the instruction register: + INSN+MA/ 344000,,17 [AOJA 17] + PAR BUFF/ 354000,,17 [AOSA 17], ODD, STOP +I suppose your theory about some glitch turning off the PI system +is a good one. + + +RLB@MIT-MC 10/27/81 02:17:45 +To: (BUG ITS) at MIT-MC +MC's T300 lossages of 7pm this evening noted in system log +occurred while I had an Emacs writing lots of blocks to FOURTH:, +like 10000 :ew... 100 + + +Moon@MIT-MC 10/26/81 01:16:09 Re: System crashing works differently +To: (BUG ITS) at MIT-MC +ITS 1243, which has been installed on MC for a week or so now, does its +crashing differently. Most halts (JRST 4,.) have been replaced with +the new BUG macro, which types a message and goes to DDT. Documentation +on this macro may be found in the source, where it is defined, near the +front of ITS >. The BUG macro also replaces the SYSMSG facility. + +When this system is installed on other machines, it would be a good idea +to install a new non-timesharing DDT along with it. Assemble MC:SYSTEM;DDT. +The only change is to enable the feature of typing P to revive the +system from a non-fatal error to work. Also install MC:SYS:TS SYSMSG when +and where the new system is installed. + +Date: 25 Oct 1981 2228-EST +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].213553> + + +The DOVER program on DM thinks there is a chaosnet here +and tried to use undefined system calls when it cannot +spool to MC. It should just bomb out. + + + +Date: 23 October 1981 21:57-EDT +From: David A. Moon +Subject: ITS IMP lossage +To: JNC at MIT-XX +cc: BUG-its at MIT-AI, jan at MIT-XX + + Date: 23 Oct 1981 1026-EDT + From: J. Noel Chiappa + Subject: ITS IMP lossage + To: jan at MIT-XX, bug-its at MIT-AI + cc: JNC at MIT-XX + + When an IMP goes down and is reloaded, ITS does not + do the right thing in terms of bringing the net back up. + It's necessary to go do a LOCK/N by hand to bring it up. +This is not actually true. The time when ITS does not bring it back +up is when it goes down several times in rapid succession (within +30 seconds I think), after which it decides that it must be broken +and leaves it down. + +MOON@MIT-MC 10/21/81 15:02:29 Re: catatonia - ACs/ JRST 4, +To: SWG at MIT-DMS +CC: (BUG ITS) at MIT-DMS + Date: 21 Oct 1981 1105-EDT + From: SWG at MIT-DMS (S. W. Galley) + To: BUG-ITS at MIT-DMS + Subject: catatonia - ACs/ JRST 4, + Message-id: <[MIT-DMS].213236> + + Yesterday DM entered a catatonic state: in user mode, only the null job + running, no response to ^Z or the left-most data switch. + I stopped it with the STOP key and dumped it to DM:.;CRASH 6089. + The ACs were clobbered: 0/ JRST 4,325 1-16/ JRST 4, 17=U/ AOJA U. + XUUOH/ 700000,,STYO+1. Truly strange! + +Those are the correct ACs for the null job. Everything in the crash dump +looks completely normal. You didn't say what the PI lights indicated; +perhaps a power surge or static electricity turned off the PI system or +stopped the machine or otherwise made it not take interrupts. + + + +Date: 23 Oct 1981 1026-EDT +From: J. Noel Chiappa +Subject: ITS IMP lossage +To: jan at MIT-XX, bug-its at MIT-AI +cc: JNC at MIT-XX + + When an IMP goes down and is reloaded, ITS does not +do the right thing in terms of bringing the net back up. +It's necessary to go do a LOCK/N by hand to bring it up. +I'm too burned out to grovel over the code and figure out +what it does do and should do; perhaps someone would like +to tackle this? +------- + +Date: 21 Oct 1981 1105-EDT +From: SWG at MIT-DMS (S. W. Galley) +To: BUG-ITS at MIT-DMS +Subject: catatonia - ACs/ JRST 4, +Message-id: <[MIT-DMS].213236> + +Yesterday DM entered a catatonic state: in user mode, only the null job +running, no response to ^Z or the left-most data switch. +I stopped it with the STOP key and dumped it to DM:.;CRASH 6089. +The ACs were clobbered: 0/ JRST 4,325 1-16/ JRST 4, 17=U/ AOJA U. +XUUOH/ 700000,,STYO+1. Truly strange! + + +Date: 14 October 1981 14:31-EDT +From: Mike McMahon +To: BUG-ITS at MIT-AI + +SYSTEM;FSDEFS 36 is broken. UDBLKS is multiply defined. + +Date: 12 October 1981 20:49-EDT +From: Christopher C. Stacy +Subject: Jobs magically appearing (Robert P. Krajewski ) +To: BUG-ITS at MIT-MC, BUG-PWORD at MIT-MC + +I responded to this person. + + + +Date: 12 Oct 1981 1554-EDT +From: Robert P. Krajewski +Subject: Jobs magically appearing +To: BUG-ITS at MIT-MC +cc: BUG-PWORD at MIT-MC + +When I came over to AI via the CHAOSnet (from MIT-EECS), I decided to list my +jobs BEFORE logging in (for no apparent reason). This is what I got: + +$$v +* CONIVR P 63 + EMACS P 24 + MAIL P 25 + LISP R 5 + FOO - 17 + MACSYM R 34 + PLANER R 45 + DIRECT P 57 + UNIVERSE-SIMULATION W 107 +*:version +AI ITS.1223. PWORD.2449. +TTY 42 +16. Lusers, Fair Share = 29% + +*:time +The time is 15:45:36 EDT. +Today is Monday, the 12th of October, 1981. +AI ITS 1223 has run for 1 day, 15 hours, 45 minutes, 28 seconds. +:KILL +*$$u + +AI ITS 1223 Console 42 Free. 15:45:46 + + +The only thing I did before logging in was a finger. How can this be ? +I noticed that AI PWORD's appearance had changed a little. + +bob +------- + + +KLOTZ@MIT-MC 10/07/81 06:24:16 Re: --More-- +To: (BUG ITS) at MIT-MC +In the past couple of weeks, I've noticed that --more-- breaks have done some +unusual things. I don't remembere then doing this before, but I'm not sure. + +Just now, a proceeded job tried to print out something, while my hactrn was in +the middle of printing a page (of mail, read with ). When the --more-- +appeared, it acted as if it got a space immediately and went to the next page. + +This was just now on a Vt52 on mc. Last week, I was using a dissapoint over a +dialup, and every CLI interrupt would cause --more-- to flush. This may be the +disappoint being random, but it didn't happen any other time. + + seems to have a problem with --more--, too. A couple of times I've typed  +while in the middle of a page and gotten "--more--flushed +" printed out. This was on a dialup. + +Leigh. + + +RLB@MIT-MC 10/07/81 00:52:01 +To: (BUG ITS) at MIT-MC +I see I dumped the earlier MC crash to .;CORPG0 4 +Handwriting in the log doesn't make it to BUG-ITS, does it? + + +Date: 6 October 1981 1808-EDT (Tuesday) +From: Guy.Steele at CMU-10A +To: glr at MIT-AI +Subject: Re: > name conventions +CC: bug-its at MIT-AI +In-Reply-To: Ken Harrenstien's message of 6 Oct 81 16:52-EST +Message-Id: <06Oct81 180837 GS70@CMU-10A> + +Ideas about making ">" do the right thing seem to pop up about +twice a year for a last five or six years. No one seems to have +gotten sufficiently excited about it to grovel through the ITS +file directory code, though. (I think it was a major triumph +when it was reorganized so that directories were kept sorted instead +of re-sorting each time one was opened in ASCII mode; and another +when directory GC was grossly sped up so it didn't take time +n^3. I doubt the code has been touched in ten years except for those +(actually, it probably has, but not significantly).) +Anyone else know anything about this? +--Guy + +Date: 6 October 1981 17:52-EDT +From: Ken Harrenstien +Subject: > name conventions +To: GLR at MIT-AI +cc: BUG-ITS at MIT-AI + +That actually sounds like a good idea. I don't know if anyone is +still keeping a list of ITS things-to-do, though. + +Date: 6 October 1981 12:04-EDT +From: Jerry Roylance +Subject: > name conventions +To: BUG-ITS at MIT-AI + + +The naming conventions for an FN1 or FN2 of > could be changed +to allow file extentions and version numbers. + +Say my directory has these files: + + DSK:FOO; BAR FASL + DSK:FOO; BAR LSP123 + DSK:FOO; BAR LSP124 + DSK:FOO; BAR PRESS + DSK:FOO; BAR TXT256 + DSK:FOO; BAR TXT257 + DSK:FOO; BAR UNFASL + +Then file lookup (for read) should work as: + + BAR > refers to BAR TXT257 (normal) + BAR TXT> refers to BAR TXT275 + BAR LSP> refers to BAR LSP257 + + + Jerry + +Date: 4 October 1981 03:10-EDT +From: Christopher C. Stacy +Subject: Ten/11 Interface seems to be flakey (so, what else is new?) +To: BUG-ITS at MIT-AI +cc: CSTACY at MIT-AI + +About midnight, AI stopped with a parity error. When CONTinued,it +would halt again. During this time, the door buzzer was stuck on. + +Cycling the PDP-11 got the door to stop being noisy. +However, I could not get the TVs work on ITS again. + +While I was scratching my head, ITS crashed at CHACK1+14. +This is in some CORE code, and the error had something +to do with a pointer to a non-existant luser. + +About now, I decided things were probably screwed up enough to +want to reload and try again. Reloaded. +When I ran SALVAGER, it found directories out of phase. +I copied the most recent version to the other packs. This +worked and ITS came back up. + +Later, when no one was logged in, I tried to make the system lose +by buzzing the door from a LISPM. ITS halted. + +The job which got the parity error was a chaos DOOR server. It was +halted at FROBIT+1, a .SLEEP which comes immediately after an +access to the TEN11 interface. + +Since the TEN/11 interface seems pretty broken, I deleted the DOOR +server from the DEVICE directory and put up a system message. + +Cheers, +Chris + +RSG@MIT-ML 09/30/81 11:58:24 +To: (BUG ITS) at MIT-ML +CC: RSG at MIT-ML +I tried to copy a file from ML to MC. What got created on the MC directory +is a locked file (multiple copies with the same name and a * in leftmost +column of the directory listing). The file in question is MC: EF; RSG LISPIN . + +... rsg + + +Date: 28 September 1981 15:26-EDT +From: David Chapman +To: BUG-ITS at MIT-AI + +I did a pdset on ai since the system seemed to think it was 11/11/81. +Probably some files will have this creation data so maybe users should +be warned in system msg. + +Date: 27 September 1981 17:27-EDT +From: Earl A. Killian +Subject: [DCP: forwarded] +To: BUG-ITS at MIT-MC + +Date: 25 September 1981 23:52-EDT +From: David C. Plummer +To: BUG-CRTSTY + +I think this is your fault: + +I am on a HEATH19 running under a CRTSTY. It looks like I got the +TTYSMT variable of the last person to use this sty. It would be a +good idea for CRTSTY to set that value to zero (or whatever is +the right thing for the various terminal types) before shoving +the ^Z down it. You should probably do this even if you think it +is ITS's responsibility to set it to zero when the sty gets +opened for the first time. + + +Date: 27 September 1981 04:32-EDT +From: Richard M. Stallman +To: BUG-ITS at MIT-AI + +My XX job became hung permanently in CHAOSO because its CHSNOS was 0. +The net appeared to be working; I was able to make new connections +to XX and MC. The connection state was still OPEN, according to PEEK. +The "flag" was 20003. Ibf, Pbf and Ack were 0; both window sizes were 5. + +At the time the problem began, the fair share moved up to 120% and stayed +there for several updates of the who line. Then it came back to a +legitimate value. + +The problem was worse because this happened with SUPDUP at interrupt level +and it would not recognize Break. + +Can Moon say what other info to look for if this happens again? + +Date: 22 September 1981 21:51-EDT +From: Ian G. Macky +Subject: [RLB: jobdev / ITS bug, I guess] +To: BUG-ITS at MIT-MC + +Ancient mail from my jobdev munging days, never had any more problems +once I got my act together... probably should have just thrown this away, +but dunno, maybe someone loves bug mail. +----- +Date: 06/17/81 01:11:15 +From: RLB +Re: jobdev / ITS bug, I guess + +As best as I can determine, the system crashed doing a JOBRET for your JOB.07 +returning whatever to your job FOO. At the point of the crash, the system +is hacking FOO on behalf of JOB.07, and hence requires that FOO be (internally) +stopped. But FOO was not stopped, which is ostensibly an impossible condition, +do it halted. I randomly tried continuing at the location after the check, +guessing that only FOO or JOB.07 would be screwed, but I didn't understand +the clock interrupt level logic the system was up to, so it couldn't continue. +I suggest that you try to recover as best you can the circumstances of what +you were doing and the state of the code, and ship it off along with your +munging of this note to BUG-ITS. + + +DEFBOB@MIT-MC 09/17/81 20:45:12 +To: (BUG SYSTEM) at MIT-MC +I don't know where to send this message so I'll send it here. + +If a user detaches his tree at 4:00 p.m. with the intention of attaching it a few hours +later, say 8:00, is the tree nevertheless destroyed (?chopped down?) automatically by +someone between those particular hours or between any other particular hours? + + +DEFBOB@MIT-MC 09/17/81 20:40:48 +To: (BUG SYSTEM) at MIT-MC + + +DCP@MIT-MC 09/15/81 08:53:42 Re: CNSGET symbolic system call extension +To: (BUG ITS) at MIT-MC +CC: CWH at MIT-MC +Now that there are a few places that use SUPDUP Graphics, might +it be the right thing to include the SMARTS (or TTYSMT) variable +in the CNSGET and CNSSET symbolic system calls. It is much easier +to do + (syscall 7 'cnsget tyo) +and get all the necessary info than to do + (syscall 1 'ttyvar tyo (car (pnget 'TTYSMT 6))) +to recover the SMARTS variable. + + +GJC@MIT-MC 09/13/81 14:33:48 +To: (BUG ITS) at MIT-MC +For something really impressive, try :XFILE out of an archive! +Incredibly SLOW, even on MC with fair-share=50% +Almost as impressive is running LMODEM out of an archive. + + +Date: 10 September 1981 1402-EDT (Thursday) +From: Guy.Steele at CMU-10A +To: bug-its at MIT-AI, gosper at PARC-MAXC +Subject: PDP-10 binary search trick +Message-Id: <10Sep81 140255 GS70@CMU-10A> + +Does anyone know who invented the incredibly tight PDP-10 code +for doing a binary search, which looks something like: + SETZ INDEX, +REPEAT N,[ + CAML ITEM,TABLE+1_(INDEX) + ADDI INDEX,1_ +] + CAME ITEM,TABLE(I) + JRST NOTFOUND +? I'm trying to track down some history. +--Thanks, + Guy + + +Date: 8 September 1981 14:54-EDT +From: Jeremy Barkan +To: BUG-ITS at MIT-AI +cc: GOLDFARB at MIT-XX + + +When using :dover, the its can't differeniate between the underscore +in file name and underscore that is the antecedent in the font name +specifier. Does it not quote underscore + +rms@MIT-MC (Sent by ___114@MIT-MC) 08/28/81 04:25:11 +To: (BUG ITS) at MIT-MC +MC was hung withMEMFRZ locked bythecore job +which was waiting for the 200000,, bit in an IMSOC6 word to clear. +It was hung for manyminutes. + + +KLOTZ@MIT-MC 08/27/81 17:04:27 +To: (BUG ITS) at MIT-MC +DISTRIB: *TS +EXPIRES: 08/31/81 17:01:55 +KLOTZ@MIT-MC 08/27/81 17:01:55 Re: AI is down. +The repairman fixed unit 7, but determined that unit 0 was +broken. ITS cannot be brought up without that unit, so AI +will remain down either until tomorrow when they come back to +fix it, or until someone knowledgegable enough about the +hardware comes around to swap cables. +^_ + +CSTACY was around when they came to fix the disks. He said +he fixed 7, so they decided tobring third: back up. Disk 0 +crapped out when they were bringing it up. All lights on the +disk went out. + +He supposedly mumbled something about coming back tomorrow +to replace the "carriage." + +Yuk. + + +Date: 27 August 1981 17:56-EDT +From: Leigh L. Klotz +To: BUG-ITS at MIT-AI + +I called symbolics and found Tom Knight, who came and switched +the cables so that unit 7 is now unit 0. +Leigh. + +Date: 25 August 1981 04:06-EDT +From: David A. Moon +To: TK at MIT-AI, BUG-HARDWARE at MIT-AI, BUG-ITS at MIT-AI + +The xgp-11 blows its circuit breaker +and makes smoke smell (not visible smoke). Probably someone should fix it. + +Date: 24 August 1981 19:40-EDT +From: Charles Frankston +Subject: Re: MC +To: JNC at MIT-XX +cc: BUG-its at MIT-AI, BUG-mail at MIT-AI + + Date: 24 Aug 1981 1123-EDT + From: J. Noel Chiappa + In-Reply-To: Your message of 23-Aug-81 2242-EDT + + We don't even have a loopback plug for a local interface, so + it must have been the BBN repairman. Please make sure who's at fault + before randomly flaming! If you can give me some more info, I will go + barf at the NCC; they seem to still have not learned that leaving + loopback plugs on enabled ports is an absolute no-no. + ------- + +I didn't send the message to flame. I was hoping someone would read it +and take appropriate action. Perhaps the NCC merely had things logically +looped back (can they do that?). In any event 3/54 (octal) was looped +back for at least an hour prior to my sending the message; probably +several hours in total. Plenty of time for every host on the net to +unqueue their mail to themselves, rather than to MC. + + +Date: 24 Aug 1981 1123-EDT +From: J. Noel Chiappa +Subject: Re: MC +To: CBF at SU-AI, bug-its at MIT-AI, bug-mail at MIT-AI +cc: JNC at MIT-XX +In-Reply-To: Your message of 23-Aug-81 2242-EDT + + We don't even have a loopback plug for a local interface, so +it must have been the BBN repairman. Please make sure who's at fault +before randomly flaming! If you can give me some more info, I will go +barf at the NCC; they seem to still have not learned that leaving +loopback plugs on enabled ports is an absolute no-no. +------- + +Date: 23 August 1981 17:09-EDT +From: J. Noel Chiappa +Subject: IMP cretinosity +To: BUG-ITS at MIT-MC, BUG-TWENEX at MIT-MC +cc: JNC at MIT-MC + + I'd have liked to send this to BUG-ARPANET, but the people +who should get this aren't on that list. Please add yourself if this +sort of stuff concerns you. + + The C/30 got in this bizarro state this afternoon where it was +looping trying to read in its micro-code from the micro-tape. I fixed +it by removing the tape, powering the machine down, reinserting the +tape, powering the machine back on and hitting the master reset button. + This had the disadvantage that when it is powered off, all the +hosts are turned off in the software, and it needs manual intervention +by the NCC (which the guy on duty forgot to do) to turn them back on. The +error message reported by any attempt to use the net was "Random network +lossage", which sounds like the IMP lost all connection to the outside +world, except that I verified (by looking at the lights) that its +connections were in fact up. So if this happens again.... + + +Date: 23 Aug 1981 1653-EDT +From: J. Noel Chiappa +To: KLOTZ at MIT-MC, (BUG ITS) at MIT-MC +cc: JNC at MIT-XX +In-Reply-To: Your message of 23-Aug-81 1636-EDT + + It was the IMP. +------- + + +Date: 23 Aug 1981 1636-EDT +From: J. Noel Chiappa +To: KLOTZ at MIT-MC, (BUG ITS) at MIT-MC +cc: JNC at MIT-XX +In-Reply-To: Your message of 23-Aug-81 1457-EDT + + Perhaps the IMP was dead? It does die occasionally, you know. +------- + + +Date: 23 Aug 1981 1942-PDT +From: Charles Frankston +Subject: MC +To: bug-its at MIT-AI, bug-mail at MIT-AI + +Someone has left a loopback plug on the IMP port MC should be plugged into (ie, +port 3 on IMP 54 octal). This not only results in human confusion but causes +all sorts of problems with mail delivery (including mail loops etc.). Would +someone please go remove the plug! + + + +Date: 23 Aug 1981 1942-PDT +From: Charles Frankston +Subject: MC +To: bug-its at MIT-AI, bug-mail at MIT-AI + +Someone has left a loopback plug on the IMP port MC should be plugged into (ie, +port 3 on IMP 54 octal). This not only results in human confusion but causes +all sorts of problems with mail delivery (including mail loops etc.). Would +someone please go remove the plug! + + + +Date: 23 August 1981 18:00-EDT +From: J. Noel Chiappa +Subject: IMP dead +To: BUG-ITS at MIT-AI, ELLEN at MIT-AI, JAN at MIT-AI, JPG at MIT-AI, + BUG-twenex at MIT-MC +cc: JNC at MIT-AI + + The IMP that MC and XX are on is dead. BBN is sending +a repairman, but the guy they are sending is a known turkey. +We'll see. (BTW, this message too I would have liked to send +to BUG-ARPANET@MC. PLease add yourself so I can stop pestering +everyone who doesn't care.) + Noel + +KLOTZ@MIT-MC 08/23/81 14:57:27 +To: (BUG ITS) at MIT-MC +Just a little while ago, with very few users (no arpa users), MC +decided the imp was down. I had been using the MC: device from +AI succesfully, but then got a device not avail. error. + +I deposited SCLNET in supcor. It got cleared, but the net didn7t +come back up. I tried the net command in lock, and that didn't work +either. Then I tried making impup and imptcu get into teh state +where it would try to bring the imp up. It didn't. I didn't touch +the hardware. + +DCP was around, and couldn7t do anything, either. +Leigh. + + +Date: 14 August 1981 06:18-EDT +From: David A. Moon +To: BUG-ITS at MIT-AI + +INQUIR data base smashed on AI between 8/14/81 02:37:40 and 8/14/81 03:01:11. +INQUIR;LSR1 FUKT is a version which causes the name dragon to die by LSRGET +taking a non-skip-return in its typical non-informative fashion. I haven't +had enough sleep recently to diagnose it more than this. + +GZ@MIT-MC 08/14/81 05:42:02 +To: (BUG ITS) at MIT-MC +I don't know if it matters but the last two or three times the system +crashed, my speed got reset to 300 when it came up (as per :tctyp des). +I'm on T10. + + +GJC@MIT-MC 08/14/81 00:54:26 +To: (BUG ITS) at MIT-MC +There is a job +55 037F55 NETRFC CCA AR3SI ? 14 6 0% REALTM +110 037F55 JOB.07 SYS *10!10 ? DSN 35 34 0% 7:03 PARERR 2 + +If I try to do 110X from peek it crashes the system, (but the system +is able to revive evidently). + +-gjc + + +Date: 13 August 1981 18:33-EDT +From: David Chapman +To: BUG-ITS at MIT-AI + +:ee should get telsup, not telnet. So presumably should all the other hostname programs. + +Date: 13 August 1981 06:08-EDT +From: Leigh L. Klotz +Subject: AI crash +To: BUG-ITS at MIT-AI + +Just now, AI got in some sort of loop. None of the select-lock lights +were on on any disk drives. It was running in exec mode, and it looked +like it was looping because the PC didn't look like it was changing +much, but the pager lights were all pretty much half lit. + +I looked around for people, and DLA told me that he knew that RG +was not here. + +I halted it, and looked at where it halted. It seemed to be +multiplying some numbers that it got from the TCMXV variable +of tty 40. + +I printed out all the ac's, and some tty variables of tty 40 and +near ttys. Now that I think of it, the routine ended in a popj, +so I guess I should have looked back up the stack to see who called +it and try to see if there was something else important that I could +record about its looping, but I didn't. + +I booted it. + +Leigh. + +Date: 12 August 1981 14:10-EDT +From: Leigh L. Klotz +Subject: QCHNRT+5 +To: BUG-ITS at MIT-AI + +AI halted at this location at noon today. I tried to record +as many significant-looking locations as I could on the console. +It seemed to be that something it expected to be in some saved ac's +somewhere wasn't there. + +I waited about 30 minutes before rebooting. I looked around +and found PDL on dm, but he didn't answer. I paged RG, but he +wasn't around. + +I noticed that RWK had dumped a crash on ai a while back, so I tried +to dump it (since it appeared to be a software problem, as opposed to +the random interrupt yesterday). I tried to find out how much +free space there was from dskdmp, but couldn't. + +I forgot about the memory off being in the low memory, and dskdmp +got an nxm trying to dump. + +At this point I wasn't sure if dskdmp was clobbered, so I was going +to reload it from tape when rg showed up and said it was ok just +to restart it. + +There is a little information in the log, but most is on the +console. + +Leigh. + +Date: 10 August 1981 12:58-EDT +From: Leigh L. Klotz +To: BUG-ITS at MIT-AI + +AI halted at QINTE+11 a little while ago. I looked for someone +who knew what was going on with the recent disk problems, but +no one was around. I found Stu Galley, and he came up and helped. + +The information is in the log. Regster Q contained 0, but he +didn't know if that meant drive 0 or was irrelevant. We wrote +down the pack id, sector number, and other information in the +log. + +Leigh. + +OAF@MIT-MC 08/10/81 12:25:52 +To: (BUG ITS) at MIT-MC +On Sunday morning 8/9/81 at 0900 on MC there were 10 users logged in, +one macsyma, fair share 6%, and stayed that way. I gunned every +non-logged-in job I could find from peek, including + several people's crtsty's (old - idle easily an hour) + CSTACY's bye (which also was hung) and + a stack of NETRFCs with REALTM PARITY ERROR listed at extreme + right. + +Then the fair share went to 60% or so. +Did I did the right thing, wrong thing?? + +Are y'all the right people to inform? + + +Date: 9 August 1981 23:04-EDT +From: David W. Payton +To: BUG-ITS at MIT-AI + +Tex on MC seems to be broken. If you just try to type \input basic, it complains. +Since this works on AI, there must be some problem. Who should I notify? + +GREN@MIT-MC 08/03/81 00:53:35 +To: (BUG ITS) at MIT-MC +CC: FILE-RETRIEVAL at MIT-MC +Would it be ok to load .INFO.;ITS TRANSL back from tape 511? It was +taken off in '73. I saw pointers to that file in ITS .CALLS in the +translation hacking part... Why was the file taken off? Is the +information in it obsolete? + +Danke, --Gren + + +Date: 30 July 1981 11:57-EDT +From: David Chapman +To: BUG-ZWEI at MIT-AI +cc: BUG-ITS at MIT-AI + +The file crash;quinte doffl has a negative creation date and a file author of DICK +(whereas it was actually just created by RWK with dskdmp.) :listf can handle this, +but zwei gets an errror parsing a negative date. + +MOON@MIT-MC 07/29/81 00:39:31 Re: VALID CLEAR OR STORED SET error +To: GREN at MIT-MC +CC: (BUG ITS) at MIT-MC +I wonder why this is not in the documentation (.INFO.;ITS JOB)? + +It means that either you tried to JOBRET and the other job was not +waiting for a response, or you tried to JOBGET and the other job was +not asking you to do something. + +Date: 28 July 1981 19:39-EDT +From: Robert W. Kerns +Subject: ITS listings +To: BUG-ITS at MIT-MC + +The ITS listings have been reprinted, and are nicely labeled, etc., so we +can stand a chance of finding what we want. If anybody wants to look at the +chicken scratches on the old ones, they live in a tape box beneath the table +in 926. + +The listings for the PDP11 programs (IOELEV, 11DDT, TV) haven't been redone +yet, but will be soon. + + +GREN@MIT-MC 07/28/81 01:13:55 +To: (BUG ITS) at MIT-MC + +In the jobdevice I am debugging via an OJB: I try to pass back via JOBRET +the 5 word block of data requested by a .RCHST. The JOBRET consistently +pulls a VALID SET OR STORED CLEAR error. If I instal the jobdev in DEVICE; +and try the exact same thing from there, it flies - No error. + +What *IS* this error? Noone can tell me. + + +Date: 27 Jul 1981 0912-EDT +From: DEVON at MIT-DMS (Devon S. McCullough) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].205130> + +DM is outputting in groups af about 32 characters with 2-4 second delay betw + + + +RWK@MIT-MC (Sent by RWK0@MIT-MC) 07/25/81 17:53:11 Re: REM's hangage +To: (BUG ITS) at MIT-MC +CC: REM at MIT-MC +This was the usual problem of getting a SEND via MLSLV and having the +MLSLV drop dead. + + +REM@MIT-MC (Sent by ___101@MIT-MC) 07/25/81 17:36:47 +To: (BUG ITS) at MIT-MC +I think I have a hung HACTRN. +I was in RMAIL, did a Quit command, it said WRITTEN: REM;REM RMAIL +then just hung, never coming back to DDT. I tried ctrl-Z many times +but they just echoed as ^Z and finally filled thebuffer and beeped. +I thought the system had hung so I went away for a half hour then +reconnecte to find my detached job. I attached to it and found +it still in the sme funny state, ^Z ^Q ^G all just echoed (as +uparrow-Z uparrow-Q and a real live bell respectively) but didn't +abort the job or give a ddt prompt or anything. +I then disconnected again, leaving it detached for yo to look at. + + +Date: 25 July 1981 01:40-EDT +From: David A. Moon +To: BUG-ITS at MIT-AI + +WE TRIED TO WORK ON THE 10/11 INTERFACE BUT COULD NOOTT +GET IT TO FAIL. IF AI STARTS GETTING PARITY ERRORS TRY SHUTTING +OFF THE XGP SPOOLER AND STEPPING ON ANYONE WHO WANTS TO RUN D OR PW + +Date: 23 July 1981 15:55-EDT +From: David Chapman +To: BUG-ITS at MIT-AI, BUG-GMSGS at MIT-AI + +running :gmsgs I get a directory full. Mine isn't. I assume the problem is +that sys; is 97.7% full and it can't write sys;:msgs times. + +Date: 21 Jul 1981 1211-EDT +From: SWG at MIT-DMS (S. W. Galley) +To: CSTACY at MIT-DMS +Cc: bug-its at MIT-DMS +In-reply-to: <[MIT-DMS].204538> +Subject: [Re: DM stys] +Message-id: <[MIT-DMS].204585> + +INQUIR & TTYTYP data have not yet caught up with reality, +but soon they will. + + +Date: 21 Jul 1981 1157-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-ITS at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].204581> + +When trying to append to a mail file in a directory that is full +(99+% according to DSKUSE), COMSYS sits spinning its wheels in ++OPEN, using up a much of the machine as there is free. Is it +possible that writeover mode opens aren't giving DIRECTORY FULL +errors? + + +Date: 21 Jul 1981 1037-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: CSTACY at MIT-DMS +Cc: bug-its at MIT-DMS +In-reply-to: Message of 21 Jul 81 at 0009 EDT by CSTACY@MIT-DMS +Subject: [Re: DM stys] +Message-id: <[MIT-DMS].204570> + +T05 is the downlink to the Apollos. The Apollo <-> ITS FTP program +logs in to DM as "MUDDLE". It says "[not in use]" because no one +has updated the TTYLOC file yet. + + + +Date: 21 Jul 1981 0009-EDT +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: bug-its at MIT-DMS +Subject: DM stys +Message-id: <[MIT-DMS].204538> + + +Why is "MUDDLE" (File Directory Only) logged in on T05 +and idle for 13 minutes, with a Console Location of "[not in use]"? + + + + +MOON@MIT-MC 07/13/81 19:57:00 +To: WJL at MIT-ML +CC: (BUG ITS) at MIT-MC + WJL@MIT-ML 07/13/81 09:19:24 + To: (BUG ITS) at MIT-ML + 7/3 I copied a 16 block file from ai to ml using the ai device. I have since + found that there were about 20 errors in the resulting file, randomly scattered + throughout. All were changes of characters with no apparent consistency e.g. + " " -> "`", ")" -> "i", "U" -> "M" ... + Unfortunately, I don't have the original file anymore. +This was a hardware bug with the IMP. I guess you didn't see the system message +from OAF announcing that it had been fixed, or didn't correlate it with your problem. + +WJL@MIT-ML 07/13/81 09:19:24 +To: (BUG ITS) at MIT-ML +7/3 I copied a 16 block file from ai to ml using the ai device. I have since +found that there were about 20 errors in the resulting file, randomly scattered +throughout. All were changes of characters with no apparent consistency e.g. +" " -> "`", ")" -> "i", "U" -> "M" ... +Unfortunately, I don't have the original file anymore. +-Bill Long + +Date: Sunday, 12 July 1981, 19:19-EDT +From: Robert W. Kerns +To: REM at MIT-MC +Cc: (BUG ITS) at MIT-MC, EHUANG at MIT-AI +In-reply-to: The message of 12 Jul 81 17:01-EDT from REM at MIT-MC + + + REM@MIT-MC 07/12/81 17:01:41 + To: (BUG ITS) at MIT-MC + CC: EHUANG at MIT-AI + Darn. If you type ahead while in an editor (emacs/rmail) while a SEND is + being typed on your screen, ITS doesn't buffer your input, so yo lose it. + That means if you're in the middle of typing something and you get a + flurry of SENDs or one long SEND you HAVE TO stop what you are doing + until the SENDs are finished, then try to remember what you were doing + after you've lost your train of thought. You can't evn finish the + sentence you are in themiddle of before stopping to look at the SENDs. + +This is not true. + +However, it is unfortunately true that if you type a control-G during +the printing of a SEND, the control-G will abort out of that printing, +rather than being passed to the program. It is also true that characters +which are intended to interrupt the program you were typing to will not +cause an interrupt, but will be read as normal interrupt. This is a DDT +problem that may or may not be possible to fix. + + +REM@MIT-MC 07/12/81 17:01:41 +To: (BUG ITS) at MIT-MC +CC: EHUANG at MIT-AI +Darn. If you type ahead while in an editor (emacs/rmail) while a SEND is +being typed on your screen, ITS doesn't buffer your input, so yo lose it. +That means if you're in the middle of typing something and you get a +flurry of SENDs or one long SEND you HAVE TO stop what you are doing +until the SENDs are finished, then try to remember what you were doing +after you've lost your train of thought. You can't evn finish the +sentence you are in themiddle of before stopping to look at the SENDs. + + +Date: 10 Jul 1981 2359-EDT +From: Alyson L. Abramowitz +To: bug-its at MIT-AI +cc: cstacy at MIT-AI, ala at MIT-AI +Subject: Problems with applying for accounts on MIT-AI +Message-ID: + +There appears to be a problem in the program that is run when +a new user applies for an account on MIT-AI. The program asks +the user for his/her Uname, real name, address, and reason for wanting +an account just fine. Unfortunately after it does that it prints +a ")" followed by a carriage return and just hangs there. A CTRL-G +gets one out of that state (and back to DDT), but, unfortunately, it +also looses all the information that the potential user just +entered. + +I watch a potential new tourist do this a couple of times in a row +tonight. He wasn't doing anything obviously wrong and the same thing +happened every time. Can someone check into this? + +Thanks. + -------- + +Moon@MIT-MC 07/10/81 21:05:33 +To: RMS at MIT-AI +CC: (BUG ITS) at MIT-AI + Date: 9 July 1981 16:15-EDT + From: Richard M. Stallman + To: BUG-ITS at MIT-AI + + There has long been a problem whereby every so often + a TV gets hung, but gunning or detaching its tree unhangs it. + +When I have looked, the cause has always been that the 10/11 interface +spazzed writing into the 11, and so there is a -1 at the place where the +11 thinks the next character from the 10 will come, so the 11 never +processes any more characters. Since the 10 is careful never to wrap +completely around the buffer, it never comes back and writes over that -1 +again, so it stays there forever. Detaching resets everyone's buffer pointers. + + Today, several TVs were hung and the usual fix did not unhang them. + I discovered that they were hung becaue their TTOALC words + contained 100 instead of the -1 that they should have contained. + +I hope this was due to the heat. + +Date: 9 July 1981 16:15-EDT +From: Richard M. Stallman +To: BUG-ITS at MIT-AI + +There has long been a problem whereby every so often +a TV gets hung, but gunning or detaching its tree unhangs it. + +Today, several TVs were hung and the usual fix did not unhang them. +I discovered that they were hung becaue their TTOALC words +contained 100 instead of the -1 that they should have contained. + +Date: 8 July 1981 09:00-EDT +From: Leigh L. Klotz +To: RICH at MIT-AI +cc: BUG-ITS at MIT-AI + +The home directory set in inquir, with the FILE option. With a machine +name (CHURK@AI), it means that the user's home directory will be CHUCK +only on AI. Without one, it will be that on any machine with a directory +by that name. + +The HSNAME program will tell you what the home directory of a particular +user is. + +Leigh. + +Date: 8 July 1981 08:46-EDT +From: Charles Rich +Subject: enquiry +To: BUG-ITS at MIT-AI +cc: SIDNER at BBND + +Pray tell -- how does one change the home directory (i.e. +where mail files are stored) for someone without a user +directory? In particular I want to move CANDY from +USERS1; to CHUCK; because USERS1;is too full. Is there +something I can put in here login file, or can it be +caught even before that? + Thanks, Chuck. + +FONER@MIT-MC 07/05/81 23:21:12 Re: Flakiness transferring file from AI to MC +To: (BUG ITS) at MIT-MC, (BUG its) at MIT-AI +CC: foner at MIT-AI +I was trying to transfer a file from AI to MC earlier tonight, and the +connection appeared to freeze. I got the ITS prompt again, but the +file was marked locked (according to FIND) and PEEK C shows it with a +J next to it. + +Eventually the file became unlocked, and included both the original +file and many replications of some random cruft from elsewhere on the +disk. Apparently the ^C was missed, and far more was transferred than +intended. + +The file is MC:GUEST1;FONER LOSSAG. Past around 47% of the way +through starts the peculiar lossage I've described. Might this have +something to do with AI's IMP flakiness, or is this a genuine problem +with ITS or FTP or whatever really does the transfer? + +I don't need an answer for this, really, since I can just retry the +transfer. But it should probably be reported in case it's part of a +consistent pattern of garbling. + +Ciao. + + + + +Date: 5 July 1981 20:37 edt +From: Margolin at MIT-Multics (Barry Margolin) +Subject: random bits +Sender: Margolin.PDO at MIT-Multics +To: bug-its at MIT-AI + +If there is a more appropriate BUG- list, please forward this and let me +know. Thank you. + +AI has been turning on random high-order bits when it outputs accross +the network. I notice this in netmail I receive from AI and when I +SUPDUP or TELNET to AI. I am not sure whether this happens over the +CHAOSnet (it happened when I TELNETted from MC to AI, if that helps), +but it certainly happens over the ARPAnet. It is usually the 100 +(octal) bit (spaces turning into tildes is the most common symptom), but +sometimes it is the 200 bit, often turning alphabetics into invalid %TD +codes when I am SUPDUPing. + +Date: 5 July 1981 10:12-EDT +From: Oded Anoaf Feingold +Subject: AI Arpanet problems +To: MOON5 at MIT-AI +cc: JAN at MIT-MC, BUG-ARPA at MIT-AI, BUG-ITS at MIT-AI, + control at BBNC, RClifford at BBNC + +David, thanks for the bit-level bug report. But as far as getting things +done on Sunday goes, don't bother. The NCC nose that the IMP picks bits +on occasion, that it does so neither at 16 nor 36 (nor any other obvious +word-length type number) bit intervals, and there is a repair visit +already scheduled: + +Tomorrow (Monday) at 0700 or so I will detach AI's IMP cable and install +a loopback, someone from BBN field service will arrive and repair the +IMP, and only when the IMP runs its own diagnostics will they try anything +with AI back on the net. I certainly agree there is no reason to touch +ML's IMP cable, or even look crosseyed at it. + +Past history: On Thursday TY took off AI's IMP cable (at the NCC's request) +and they found the problem while running diagnostics. Apparently the fault +showed up so fast that there was no reason to keep AI off the net for more +than a few minutes - hence virtually no interruption to users. + This time the repair procedure may take a few hours/days/millenia/ +minutes, and since the IMP will be powered down to change cards, that means +the other IMP 6 hosts will be off the net, as stated in .MSGS.;ARPA DOWN. + +[Note for NCC people - the specific errors David Moon spotted are: + Bits with octal weights 10 and 4 get picked (spurious one). + Bit with octal weight 10 gets dropped (spurious zero). + There may be additional problems.] + + +Oded + +Date: 5 July 1981 04:07-EDT +From: David A. Moon +Subject: AI Arpanet problems (p.s.) +To: BUG-ARPA at MIT-AI +cc: BUG-ITS at MIT-AI + +I forgot to say in my previous message that the problems are believed to be +entirely in the host-to-IMP direction. + +Date: 5 July 1981 04:06-EDT +From: David A. Moon +Subject: AI Arpanet problems +To: BUG-ARPA at MIT-AI +cc: BUG-ITS at MIT-AI + +The problems are in the IMP, not in AI, as can be demonstrated by plugging ML +into AI's IMP port. Please do not try this experiment yourself! It took +me over an hour to get ML to work again on its own port after doing this, +because the connectors are quite literally falling apart. And each time +they are plugged and unplugged they get worse. + +The problems with the IMP, in terms of its 16-bit words, are at least the +following. It's a little hard to tell but I think there may be problems +with some other bits as well (actually I am fairly sure): +Bits with octal weights 10 and 4 get picked (spurious one). +Bit with octal weight 10 gets dropped (spurious zero). + +I will try and call up the NCC tomorrow about this, during the daytime, but +it wouldn't hurt for anyone else who is around during the day to call them +first. The number is 661-0100 and you need to convince them to give you a +hardware guy, preferably Sunday rather than Monday. + +Date: 4 July 1981 21:50-EDT +From: David A. Moon +Subject: not more CHAOS lossage +To: DCP at MIT-MC +cc: BUG-ITS at MIT-MC, CHAOS-NCP-PEOPLE at MIT-MC + + Date: 4`July 1981 1s:43-EDT + From: David C. Plummer + Subject: more CHAOS lossage + To: BUG-ITS at MIT-MC + cc: CHAOS-NCP-PEOPLE at MIT-MC + + Sitting on MC, I run :CHATST. Send a RFC to an ITS (AI or MC) + with contact name STATUS and enough JCL to make the byte count of + the packet 486. (that's right, 486. also breaks as does 488). It + does not give me an unrecoverable data error as 489. does, yet it + tries to send it. Response: what response, there is none. Now do + it again, but send the 486. byte data length packet to either + MC-CHAOS-11 or AI-CHAOS-11 and it comes back with the standard + reply to status. +The STATUS protocol does not accept arguments. The ITS server for it +happens to implement this restriction and the pdp11 server happens not to. +The number of bytes of arguments is irrelevant. If you wait long enough +you will get back a "connection refused" reply; the system waits a long +time (2 minutes?) for a server to pick up the queued request before sending +this. The timeout may be too long. + +Date: 4 July 1981 13:43-EDT +From: David C. Plummer +Subject: more CHAOS lossage +To: BUG-ITS at MIT-MC +cc: CHAOS-NCP-PEOPLE at MIT-MC + + +I don't know who is (not) doing the following: + +Sitting on MC, I run :CHATST. Send a RFC to an ITS (AI or MC) +with contact name STATUS and enough JCL to make the byte count of +the packet 486. (that's right, 486. also breaks as does 488). It +does not give me an unrecoverable data error as 489. does, yet it +tries to send it. Response: what response, there is none. Now do +it again, but send the 486. byte data length packet to either +MC-CHAOS-11 or AI-CHAOS-11 and it comes back with the standard +reply to status. I looked over the code breifly, looking for +%CPMX(W and C) and I couldn't spot anything off hand. Could be a +fencepost, could be somebody isn't keeping track of something (is +everybody remembering the two header words that the system tacks +on to the packet?). My guess is ITS will send but not receive. + +Does anybody ever remembering having problems sending large +packets around and having the conneciton hang? If so, this might +be the reason. + + +Date: 3 July 1981 17:11-EDT +From: Steven T. Kirsch +Subject: The DDT prompt went away a couple of days ago on MC... +To: BUG-ITS at MIT-MC + +and never came back. Is this only on logins over the net? +or a new feature. + +Only the prompt after the "if you are a tourist...." message has gone. + + +Date: 1 July 1981 23:49-EDT +From: Christopher C. Stacy +Subject: net interface problems? losing bits +To: BUG-ITS at MIT-AI, pdl at MIT-DMS, eak at MIT-MC + + +TELNETing in from a foreign TIP this evening, I watched a bunch of +spaces get displayed as "`"s and "~"s. I thought this was a problem +with my terminal (which has never happenned before), but after +reading the other bug reports..... + +Chris + +Date: 1 July 1981 22:40-EDT +From: Howard I. Cannon +Subject: AI Imp Interface +To: BUG-ITS at MIT-MC + +I can't reproduce the problem now, so I am going to leave AI on the net for now. The only +thing I did was to reset the IMP interface on AI with the front panel switch. + + +Date: 1 July 1981 20:08-EDT +From: Mike McMahon +To: BUG-ITS at MIT-AI + +I have renamed the server ftp to prevent incoming mail from being garbaged. + +Date: 1 July 1981 19:01-EDT +From: Eugene C. Ciccarelli +Subject: Network interface problems +To: BUG-ITS at MIT-AI + +I just got a message (via Chaosnet) from EAK who says AI's +Arpanet interface is garbaging bits, and suggests someone +taking AI off the network temporarily to avoid problems with +misforwarded mail, etc. + +Date: 1 Jul 1981 1522-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].202889> + +AI's net interface (possibly?) is losing. Getting a lot of picked and +dropped bits from MLDEVs pulling files to DM from AI. This doesn't seem +to happen pulling to DM from MC. (ML is down right now). + Dave + + + +Date: 1 July 1981 16:30-EDT +From: Leigh L. Klotz +To: BUG-ITS at MIT-AI + +I didn't see PDL's previous note, but MLDEV's on AI seem to be +breaking at LOSE3. crash;mldev record and crash;mldev 1 +are the dump and ac's of one. + +Leigh. + +Date: 1 Jul 1981 1525-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].202891> + +Typically the aforementioned MLDEVs .VALUE at NTDI+14 with c/ 1000 +and d/ 400 + + + +Date: 1 July 1981 14:27-EDT +From: Earl A. Killian +To: BUG-ITS at MIT-AI + +I'm telneting from LLL-S1 to AI and I find that on output a large +number of characters output have their bits modified. In particular, +a large number os spaces have turned into "`"s, i.e. the 100 bit got +turned on. Also, I've seen ">" turn into "~", ":" into "z", and other +weird things. This isn't happening to other hosts. + +Date: 30 June 1981 05:21-EDT +From: Leigh L. Klotz +Sender: KLOTZ0 at MIT-MC +Subject: ellen's hactrn +To: BUG-ITS at MIT-MC +cc: KLOTZ at MIT-MC, ELLEN at MIT-MC + +The same thing happened to me recently. + +There are some tourists on ai who have written this hack which +runs as a disowned job and periodically sends random messages +to the hackee. [Message from your Terminal]... + +Someone tried to do this to me, but the program seems not to +work quite right, or something. It left me in CLOBI. I killed +the job and it went away. I don't know that this is the same thing. + +Right now when I try to send to ellen, my hactrn hangs at +the place where it is waiting to send. I do not know what +failure code the open returned, because she had logged out +by the time I tried to do it again, and the register had +been trashed. But since it was looping, it must have +been %EFLDIR or %ENAFL. + +Her old, bad hactrn was trying to read from CLO: _CLI_;ELLEN HACTRN, +and had it open in .BAI. I guess this is why my sends to her didn't +work, even though the hactrn which was trying to send to itself +became HACTRO. That doesn't seem quite right, though. + +HCLOB was 0 and HHACK was -1. I'm not sure why her hactrn was +trying to open itself. + +In the process of trying to look back up the stack to see +who had opened this, I managed to trash the job. I did a +CTYPE 41 X that I meant to do in another job in the hactro, +and of course trashed it. It dumped itself, but I doubt that's +of any use. + +It was trying to do a .IOT on it at FDRCO4, having been called +at FDRCO1+3. I didn't get any farther. + +Leigh. + + +ELLEN@MIT-MC 06/30/81 04:05:59 +To: (BUG ITS) at MIT-MC +CC: (BUG DDT) at MIT-MC +Three times in succession tonight I have control-Z'd out of an EMACS and +had my DDT hang, typing control-G had no effect. Typing echoed but +$$V or other commands had no effect. Upon hanging up (I am on a dialup +line) and reconnecting, leaving my tree detached, I find on looking at +a peek that my HACTRO is in state "*CLOBI" and it says "CLI" +to the right of the "Time PIs" column. This has not happened to me from +anyplace except exiting EMACS, however the EMACS job appears unaffected, +as I can snarf it from the HACTRO and continue using it. + + +Date: 29 June 1981 19:47-EDT +From: Earl A. Killian +Subject: enquiry +To: RICH at MIT-AI +cc: BUG-ITS at MIT-AI + +Use the ALLOC command of the DUMP program. + + +Date: 29 June 1981 11:06-EDT +From: Charles Rich +Subject: enquiry +To: BUG-ITS at MIT-AI + +I used to know, but now cannot remember and cannot find in the documentation, +the answer to this question: + How do I allocate a directory to a given device? +Thanks, Chuck. + +MOON@MIT-MC 06/24/81 16:02:01 Re: MC lack of response on the Chaosnet +To: DCP at MIT-AI +CC: (BUG ITS) at MIT-MC + Date: 24 June 1981 15:32-EDT + From: David C. Plummer + To: BUG-ITS at MIT-AI + + I have noticed this in the past, and it is happening again. MC is at + this moment down. It does not respond to the :TIMES program, nor the + CTIMES program, nor to attempts to connect. It does however, answer a + status packet (generated with :MOON;CHARFC MC STATUS ). I assume it + is the 11 that handles the chaos net that is responsible for this. +Why do you assume that? It's not true. + If + this is so, could it be fixed? MC should respond to the status for MC, + and the chaos front end should respond to STATUS only sent to it, not + to MC also. I realize this may be an efficiency hack, but it is doing + the wrong thing. +The problem was undoubtedly that there were no free job slots and therefore +server processes could not be created. The STATUS response is generated +directly by the system rather than by a server process, for exactly this +reason: so that it will always work if the system is up, even when it is +overloaded. + +DCP@MIT-MC 06/24/81 15:38:11 +To: (BUG ITS) at MIT-MC +I guess that last bug report is slightly bogus. MC was not down, but it was dead +to the outside world. + + +Date: 24 June 1981 15:32-EDT +From: David C. Plummer +To: BUG-ITS at MIT-AI + +I have noticed this in the past, and it is happening again. MC is at +this moment down. It does not respond to the :TIMES program, nor the +CTIMES program, nor to attempts to connect. It does however, answer a +status packet (generated with :MOON;CHARFC MC STATUS ). I assume it +is the 11 that handles the chaos net that is responsible for this. If +this is so, could it be fixed? MC should respond to the status for MC, +and the chaos front end should respond to STATUS only sent to it, not +to MC also. I realize this may be an efficiency hack, but it is doing +the wrong thing. + +Date: 24 June 1981 00:55-EDT +From: Steven T. Kirsch +Subject: random clobberage on MC? +To: BUG-ITS at MIT-MC + +This could be all in my head, but I noticed two clobberages today that +struck me as a little strange: + +The end of SK;SK OBABYL appears to have some lines missing from the +last message. + +SK;PASCAL LISP seems to be missing (or transpose and missing) +characters at the end. You can read this file and see for yourself +(it's only about 10 lines long). If comparision with the tape dump +(Tape 325, file #95) shows a discrepancy, we are all in a lot of +trouble (since ITS says, and I agree, that the file hasn't been +modified in any normal way since it was dumped). + +I could be imagining all this and could have accidently clobbered these files +myself. I thought I'd bring it up just to be on the safe side. + +Date: 20 June 1981 18:10-EDT +From: Alan Bawden +Subject: opening the CLI device +To: BUG-ITS at MIT-MC +cc: DCP at MIT-MC + +When opening the CLI device fails because the core link already exists +(returning %ENAFL) the target job gets interrupted anyway. + +ALAN@MIT-MC 06/20/81 17:27:14 Re: recent MC crash & .getsys +To: (BUG ITS) at MIT-MC +The recent MC crash where the system died trying to gun a garbage job +tree for me may be even more related to me than that. + +Earlier that evening I discovered that the .getsys uuo was acting +strangely (never mind WHY I discovered that). It seems that it no +longer works for some of the random sixbit keywords you can give it +(for example: DEVS and NCALLS work, but GETS doesn't (!)). In the +cases where it doesn't work it has a tendency to trash the two +accumulators involved (aobjn pointer and sixbit key). + +Now, I was just going to ignore this all, figuring that nobody uses +the thing anyway, but after talking with Moon it sounds like one of +the garbaged words in the job in question was trashed with one of MY +aobjn pointers from a failing .getsys! + +Perhaps it is worth someone's time to look into this. + +RLB@MIT-MC 06/18/81 02:10:15 +To: (BUG ITS) at MIT-MC +Recent MC crash dumped as CRASH;CHACK1 14 +Halt at CHACK1+14 +Notes in the crash log. +Acc U pointed to QCP HACTRP which ALAN says he was trying to gun when +crash happened. + + +Date: 13 June 1981 13:47-EDT +From: David C. Plummer +To: BUG-ITS at MIT-AI, ALAN at MIT-AI + +MC has been having problems since about noon today (Saturday). It +revived itself a few dozen times in the course of a couple hours. I +may have been the cause of this. I have been hacking with the CLO: +device this afternoon. Does anybody know if there are any bugs with +this beast? I will refrain from using it until I hear a go ahead. If +you want details on what I was doing with it, just ask. + +Date: 11 June 1981 03:24-EDT +From: David A. Moon +Subject: Output reset doing weird things on MC tonight +To: sk at MIT-MC +cc: BUG-ITS at MIT-AI + +I broke something in the process of fixing another bug. It's fixed now. + +SK@MIT-MC 06/11/81 01:53:53 Re: last message +To: (BUG ITS) at MIT-MC +re-attaching did work in one case. + +SK@MIT-MC 06/11/81 01:49:51 Re: did something get "fixed" recently? +To: (BUG ITS) at MIT-MC +In logging in through the SAIL tip as usual, I discovered today that +^S'ing the "welcome" message would hang my terminal. This happened +consistently. Up till today, I have had no problems ^Sing the message +and I do it almost every time I log in. + +Also, typing Q in peek while it attempted to typeout caused me to +hang. + +Reowning the detached tree did not make things work (still dead) in +one case, and I forgot what happened in the other case. + +In any case, I think I had to close and re-open the connection about 5 +times today. + +Let me know if you need more info. + + +GJC@MIT-MC 06/10/81 09:37:27 +To: (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC +Some people had their MAIL file on the PACK NOT AVAILABLE disk. +If they recieved any mail since then, what happens is that +instead of COMSAT specially handling the error, it takes +it as FILE-NOT-FOUND and simply creates a new mail file. +People lose their mail. + + + +JPG@MIT-MC 06/10/81 06:35:24 +To: CBF at MIT-MC +CC: (BUG ITS) at MIT-MC +As I have stated many times in the past, I certainly don't care +whether SECOND: is an RP04 or a T-300. + + +Date: 10 Jun 1981 0158-EDT +From: J. Noel Chiappa +Subject: Re: SECOND: device on MC: +To: CBF at MIT-MC, bug-its at MIT-MC +cc: JNC at MIT-XX + + I've been saying that the likelihood of a T-300 control +path failure is low for a while; the observed failure rates at +this time seem to obviate theoretical discussions of the matter. +I only saw that break once, and then it was a matter of switches +wrong, and not anything broken. So saying that the T-300's are +less reliable on those grounds isn't indicated. I have said +that I thought that the reap path ought to have SECOND: somewhere +after THIRD:, but JPG didn't like the idea the last time I +mentioned it. +------- + + +CBF@MIT-MC 06/10/81 01:22:01 Re: SECOND: device on MC: +To: MOON at MIT-MC +CC: JPG at MIT-MC, (BUG ITS) at MIT-MC + MOON@MIT-MC 06/09/81 21:49:20 Re: SECOND: device on MC: + The two times before this it was a Trident that went down. + +Hmm, now that I think about it you're right; but I didn't even notice it. +Clearly my analysis is wrong. The reason I think it is better to have a +Trident be SECOND: (ie. be first to be reaped to) because when a Trident +goes down you get the choice of which Trident you want to leave down. +When pack 13 goes down the way things work now, it is the most recently +modified files that must go away. With the other scheme there is one, +posible two whole packs of data more recent than the one lost. + + +MOON@MIT-MC 06/09/81 21:49:20 Re: SECOND: device on MC: +To: CBF at MIT-MC +CC: JPG at MIT-MC, (BUG ITS) at MIT-MC +The two times before this it was a Trident that went down. + +CBF@MIT-MC 06/09/81 20:38:46 Re: SECOND: device on MC: +To: (BUG ITS) at MIT-MC +CC: JPG at MIT-MC +I think by this time it ought to be clear to all that the likelihood of one +of the RP04's being down probably far exceeds the likelihood of one of the +Trident's being down. Therefore I don't understand why it is still first +in the migration path. One could perhaps argue that the Tridents might be +less reliable since a failure of any item in the chain of hardware +connecting the Tridents can bring them both down (DL10, I/O 11, Century +controller), I might suggest that considering the percentage of storage +those devices represent, the system will effectively be useless to most +users anyway. Therefore I think the only relevant probability to consider +is one Trident drive vs one RP04 going down, and I think its obvious which +is the more reliable of the two. + + +Date: 9 June 1981 20:34-EDT +From: David Eppstein +Subject: Indirect cursor addressing +To: BUG-EMACS at MIT-MC, BUG-ITS at MIT-MC + +I just checked again. MC has the problem too. + + +Date: 8 June 1981 1011-EDT (Monday) +From: Guy.Steele at CMU-10A +To: bug-its at MIT-AI +Subject: Cleaning up my old directories +Message-Id: <08Jun81 101127 GS70@CMU-10A> + +Dear everyone, + I would like to undertake the task of grossly reaping my old ITS +directories, first weeding through them a shipping good stuff to CMU. +(Chuck Rich is after me to free up a few directories.) Before I can +do this I need to get many files back from tape. Would someone be +willing to help in this endeavor? + On AI I need all files for directories GLS, TGQ, QUUX, and QX +from tapes GFR9, GFR10, GFR11, 140, and 1407. + On MC I need all files for directories GLS, QUUX, and QX +from tapes GFR24, GFR25, GFR26, GFR27, and GFR28. + Within a day or two of the reappearance of these files I can +flush them all again and free up several directories. +Thanks, + Guy + +Date: 7 June 1981 14:20-EDT +From: Christopher C. Stacy +To: BUG-ITS at MIT-AI + +on AI, + +230479. memory errors in 47.4 hours. (!?!??) + +Well, at least ONE memory error, anyway. + +Chris + +Date: 4 June 1981 11:39-EDT +From: Maria Simi +To: BUG-ITS at MIT-AI +cc: MARIA at MIT-AI + + +Please, somebody do something about the terminal in 939!!!! +The line is broken. + Thanks, maria. + +Date: 1 June 1981 00:58-EDT +From: Leonard N. Foner +Subject: This is not a bug, but a question to persons unknown +To: BUG-ITS at MIT-AI + +I have been occasionally curious as to how the fair share is +determined. Any theories I nurtured about its being a measure of idle +CPU time or anything of a similar sort were shattered tonight when I +noticed upon login that the fair share was 103%. + +My question, of course, is just how this number is determined. Any +help for this rather pointless question would be well received. + +Thanx. + + + +Date: 24 May 1981 09:47-EDT +From: Robert W. Kerns +Subject: H19 +To: Moon at MIT-AI +cc: BUG-ITS at MIT-MC + + Moon@MIT-AI 05/24/81 01:37:31 Re: H19 + To: rwk at MIT-MC + kmp,bil@MIT-MC (Sent by BIL@MIT-MC) 05/23/81 21:56:03 + To: (BUG ITS) at MIT-MC + Recently, all the H19's on the 8th floor have been dying on ^S^Q problems + with insertline/deleteline. These used to work. The change happened maybe + a week ago? Can it be fixed back or what's up? + -kmp + + Bob, do you know anything about this? I suppose ITS's idea of the + padding got broken somehow? + +No, Kent is just wrong about it having ever worked at 9600 baud. There +is some bug in the changes I made for padding H19's with nulls, and I +haven't gotten around to debugging it yet. In the meantime, use -%TOLID +at 9600 baud. I suppose :TCTYP should know this. + + +kmp,bil@MIT-MC (Sent by BIL@MIT-MC) 05/23/81 21:56:03 +To: (BUG ITS) at MIT-MC +Recently, all the H19's on the 8th floor have been dying on ^S^Q problems +with insertline/deleteline. These used to work. The change happened maybe +a week ago? Can it be fixed back or what's up? +-kmp + + +Date: 23 May 1981 15:21-EDT +From: David A. Moon +Subject: Chaos connections to Dover losing +To: JNC at MIT-XX +cc: BUG-TWENEX at MIT-MC, BUG-its at MIT-AI + + Date: 23 May 1981 1255-EDT + From: J. Noel Chiappa + + Something about the latest change in the AI-IO-11 broke + connections from XX to the Dover. +Actually, those work just fine. But the DOVERSEND program has a private +Chaosnet server on MC, which I didn't know about it, that it uses to find +out the state of the MC dover spooler and of spruce, which hadn't been +converted and also failed to report back its errors properly. It's fixed +now. + +Date: 23 May 1981 1255-EDT +From: J. Noel Chiappa +Subject: Chaos connections to Dover losing +To: bug-its at MIT-AI, bug-twenex at MIT-MC +cc: JNC at MIT-XX + + Something about the latest change in the AI-IO-11 broke +connections from XX to the Dover. +------- + +MOON@MIT-MC 05/21/81 20:50:59 Re: Bug fixed +To: (BUG ITS) at MIT-MC +That bug where network servers show up as logged in and looping forever +trying to log in again is a bug in the LOGIN system call introduced by +RWK a few months back and fixed in the source (ITS 1218). + +Date: 20 May 1981 23:07-EDT +From: Mike McMahon +Subject: Lisp machine gets "file system fucked" trying to read directory from ML: +To: BUG-LISPM at MIT-MC, BUG-ITS at MIT-MC +cc: MMCM at MIT-AI, MOON at MIT-MC + + MOON@MIT-MC 05/20/81 17:17:41 Re: Lisp machine gets "file system fucked" trying to read directory from ML: + There must also be a bug in the Lisp machine, that it dies so foully + when it gets back an ISE0 error from a DIRECTORY operation (the real + error is a CHNL NOT OPEN IOC error from the SIOT that is slurping in + the MFD, but the error string reported by the file job says ISE0 for + some reason, and has what the Lisp machine thinks is the wrong + transaction ID.) +This failing SIOT symbolic call appears not to set the error code as +asked, so you still get ISE0, although it doesn't bomb out the file +system any more. + + Date: 23 MAR 1981 0139-EST + From: MMCM at MIT-AI (Mike McMahon) + When you specify a non-existent directory to the DIRECTORY command, + you don't get an error until interrupt time. Probably it should + fill the first buffer at process level before returning to the + user. +This now properly gives an error via an asynch mark, however it would +still be better if it would happen sooner. + + + +Date: 20 May 1981 18:32-EDT +From: Earl A. Killian +Subject: [KREEN: Babyl Rave] +To: KMP at MIT-MC +cc: BUG-BABYL at MIT-MC, BUG-ITS at MIT-MC + +My first guess is that Babyl is eliminating MIT-DM from the +header, except that MIT-DMS is what really occurs in the header, +and so a "S" is left. This is the result of having DM be the +only ITS machine whose official arpanet host name is not +"MIT-" concatenated with what it returns as its machine name. +Sigh. I supposed a special conditional is the only way to win. + + +MOON@MIT-MC 05/20/81 17:17:41 Re: Lisp machine gets "file system fucked" trying to read directory from ML: +To: (BUG LISPM) at MIT-MC, (BUG ITS) at MIT-MC +This is caused by a bug in ITS, such that SIOT does not work properly +when reading a binary directory. MLSLV notices the bug while most +other programs do not, since it tries to read past the end of the +directory. The bug is fixed in the source (ITS 1216); as a byproduct +the operation will be much faster. I guess I (or someone) should +install this system on ML soon. (The Chaosnet is currently broken in +the source, but ML doesn't have a Chaosnet, and only hosts without a +Chaosnet cause the original symptom of the complaint from the Lisp +machine.) + +There must also be a bug in the Lisp machine, that it dies so foully +when it gets back an ISE0 error from a DIRECTORY operation (the real +error is a CHNL NOT OPEN IOC error from the SIOT that is slurping in +the MFD, but the error string reported by the file job says ISE0 for +some reason, and has what the Lisp machine thinks is the wrong +transaction ID.) + +Date: 20 May 1981 13:13-EDT +From: Robert W. Kerns +To: EAK at MIT-MC +cc: BUG-DDT at MIT-MC, BUG-ITS at MIT-MC + + Date: 19 MAY 1981 2044-EDT + From: EAK at MIT-MC (Earl A. Killian) + To: (BUG DDT) at MIT-MC + + Perhaps :REAP FOO should work even if FOO is on an unmounted pack? + Does ITS provide the ability to do this (ie. open a directory + entry)? + +ITS dooesn't have a way to do this, although it does have bit 1.5 +mean just the right thing in the case of links. Maybe the right +thing is to make this bit work for non-links too? + + +Date: 19 May 1981 1506-EDT +From: TAA at MIT-DMS (Timothy A. Anderson) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].198181> + +ITS 1214 seems to work much better with CFHPI+11 changed from +PUSH P,C ? HRLI C,2200 to HRLI C,2200 ? PUSH P,C. The former +causes UCPRL to be called with just an address, rather than a +byte pointer, and crashes almost immediately. + -taa + + +KLOTZ@MIT-MC 05/18/81 20:08:22 +To: (BUG ITS) at MIT-MC +I just got a chnl not open error when trying to write a +file to the ai device from here. I got some other error +before, which emacs was able to handle, but it cleared +the screen before I saw it. Attempting to save it again +got the channel not open error. +It might have been directory full. + + +MOON@MIT-MC 05/17/81 02:30:37 +To: (BUG ITS) at MIT-MC +The AI: device is broken such that trying to write a file when +there is zero free space on any pack causes the slave simply to .logout, +causing an ioc error on the other end (with no error message, just +channel not open) and no dead slave job lying around. Maybe this isn't +a new bug, I don't know. + +ed@MIT-ML (Sent by GSB@MIT-ML) 05/17/81 01:33:00 Re: record time +To: (BUG ITS) at MIT-ML +MC's record time seems to be 7 months, 23 days, etc. + +MOON@MIT-MC 05/16/81 02:34:29 +To: tc at MIT-AI +CC: (BUG ITS) at MIT-MC +The smoke alarm and the temperature alarm behind MC just triggered, +neither of them for any discernible reason. By the time I was able +to go and look at all the detectors, none of them had their light lit. +So if the building burns down later this morning, you can blame me. + +MOON@MIT-MC 05/14/81 16:30:32 +To: RWK at MIT-MC +CC: EAK at MIT-MC, (BUG ITS) at MIT-MC + Date: 13 May 1981 23:36-EDT + From: Robert W. Kerns + To: EAK at MIT-MC + cc: BUG-ITS at MIT-MC, rich at MIT-AI + + Date: 13 May 1981 23:25-EDT + From: Earl A. Killian + To: RWK at MIT-MC + + Isn't it supposed to say PACK NOT MOUNTED instead of undefined + device? + + It does for SECOND:, because knowledge of that pack was wired in before + the more general scheme was adopted. +Not true. SECOND is treated the same as the other named packs. + +I have fixed the job device handler SYS:ATSIGN DEVICE to return pack +not mounted instead of no such device when an OPEN on a known disk +pack name gets to it. + +Date: 14 May 1981 00:50-EDT +From: Robert W. Kerns +Subject: NO SUCH DEVICE +To: BUG-ITS at MIT-MC, BUG-MAIL at MIT-MC + +Here's a good reason to know the names of all the disks even when not +online: + + COMSAT@MIT-AI 05/14/81 00:47:43 Re: Msg of Thursday, 14 May 1981 00:43-EDT + To: RWK at MIT-MC + FAILED: (FILE [THIRD:NIS;*SYS MAIL]) at MIT-AI; Couldn't write message to file; + "THIRD:NIS;*SYS MAIL" - NO SUCH DEVICE + Failed message follows: + ------- + + +Date: 13 May 1981 23:36-EDT +From: Robert W. Kerns +To: EAK at MIT-MC +cc: BUG-ITS at MIT-MC, rich at MIT-AI + + Date: 13 May 1981 23:25-EDT + From: Earl A. Killian + To: RWK at MIT-MC + + Isn't it supposed to say PACK NOT MOUNTED instead of undefined + device? + +It does for SECOND:, because knowledge of that pack was wired in before +the more general scheme was adopted. THIRD:, FOURTH:, VISION:, etc. are +known from the name stored in the TUT on the disk, so ITS doesn't know +anything about the pack at all if it's not mounted. Maybe this info +wants to be included in the CONFIG file as well. + + +Date: 13 May 1981 21:22-EDT +From: Robert W. Kerns +To: RICH at MIT-AI +cc: BUG-ITS at MIT-AI + + Date: 13 May 1981 17:37-EDT + From: Charles Rich + To: BUG-ITS at MIT-AI + + What happened to device THIRD:, it now says undefined device. + Also I can't write to PK14: either now. (SECOND: still works). + +If only you'd noticed the message when you logged in that the +disk drive was down.... I guess it would be a help if people +would also send a message to *AI when this happens, since it is +very easy to overlook SYSTEM MAIL when you log in. + + +Date: 13 May 1981 17:37-EDT +From: Charles Rich +To: BUG-ITS at MIT-AI + +What happened to device THIRD:, it now says undefined device. +Also I can't write to PK14: either now. (SECOND: still works). + +Date: 10 May 1981 03:55-EDT +From: Charles Frankston +Subject: [RGF: DM2500] +To: FJW at MIT-MC +cc: CBF at MIT-MC, BUG-ITS at MIT-MC, GZ at MIT-MC, MOON at MIT-MC, + RGF at MIT-MC + + Date: 3 May 1981 00:12-EDT + From: Frank J. Wancho + RGF at MIT-MC + + Ok, I suppose the distinction is that since my DM3025A also responds + to DM2500 codes and that I use :TCTYP DM SCROLL, everything works just + fine for me. But, when another tries to emulate a DM2500 and uses the + same :TCTYP command (effectively), it doesn't scroll except when using + CRTSTY??? -- I claim again that :TCTYP does it right and the + documentation in KSC;DM2500 DOC must be either misleading or + incomplete... or not properly implemented in RGF's emulation or some + combination... + +I explained the problem in detail. The documentation in KSC;DM2500 DOC is +correct for a real Datamedia. Your DM3025A does not work the same way. +You like the way it works better, great, tell your friend to make +his work that way. I don't see what you expect us to do, go around the +country with a soldering iron fixing Datamedias? + + +DCP@MIT-MC 05/10/81 00:34:42 +To: (BUG ITS) at MIT-MC +Is there a good reason why %PIATY (interrupt word 1, LH bit 4000) +is NOT documented in MC:.INFO.;ITS INTRUP. I think I understand +it well enough to document it, but I would prefer someone who +knows precisely what it does to document it. + +Also, what about all the other bits in the Left Half? Are they +real ntterupts, or just unused bits? + + +GJC@MIT-MC 05/09/81 17:23:52 +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC +I saw a GUMBY JOB.07 SYS with an MPV had been trying to read AR1:USERS2;ELDEFS +could be that his archive is messed up and he doesn't know it? + + + +RWK@MIT-MC 05/08/81 02:50:56 Re: Recent problems with archives and EMACS libraries +To: (BUG ITS) at MIT-MC +CC: MMCM at MIT-MC, KRONJ at MIT-MC, KMP at MIT-MC, JPG at MIT-MC +CC: LPH at MIT-MC, GJC at MIT-MC, JGA at MIT-MC, ASB at MIT-MC +CC: SGR at MIT-MC, CFFK at MIT-MC, (*MSG *MC) at MIT-MC +These were due to the wrong port being enabled on the ARM-10 (the port +for the DL10 wasn't on). This has been rectified. + +This affected mapping of pages from THIRD: and FOURTH: into memory. Read-only +pages were not damaged, read/write pages were written back as zero. + +* If you had EMACS libraries that stopped working, they should work now. +* If you had a program residing on THIRD: or FOURTH: that stopped working, + it should work now. +* If you had an archive that stopped working, it is now unusable. You should + send a request to FILE-RETRIEVE requesting that it be recovered from tape. + (Be sure to include the filename!). + +We are sorry for any inconvenience. + + +Date: 8 May 1981 00:28-EDT +From: David Eppstein +To: BUG-ITS at MIT-MC + +I have been getting a lot of "DEVICE FULL" errors lately when trying +to read files from archives. + + +RLB@MIT-MC 05/07/81 20:22:39 +To: (BUG ITS) at MIT-MC +Supposing that the recent ARC device lossage had causes related to the +Emacs lossage KMP etc have noted, I copied DEVICE;DEVICE ARC to MC from AI. +Just before doing so, I $0L'd DEVICE;.FILE. (DIR) and after the copy I +$0Y'd it to DEVICE;.FILE? (DIR) +I don't want to risk trashing MY archives finding out whether the copy +fixed anything, though. + + +MMCM@MIT-MC 05/07/81 17:41:09 Re: more file lossage +To: (BUG ITS) at MIT-MC +My EMACS init file, which has not changed in about a year, got broken today. +I renamed the old one to MMCM;MMCM BROKEN, which still gets a LIB error when +you try to load it, and copied over one from AI, which now loads successfully. +The two files are identical, at least when you compare them they are. + + +LPH@MIT-MC 05/07/81 14:56:36 +To: (BUG ITS) at MIT-MC +the archive device is rather messed up. +i get all sorts of trash appearing in the wasted words and in the number of +blocks in files. some of my archives get UNRECOGNIZABLE file errors when +i try to list them; though i can use emacs to visit the archive itself, +the individual files can't be listed correctly at ddt... + +GJC@MIT-MC 05/07/81 10:14:30 +To: (BUG ITS) at MIT-MC +The archive devices on MC are going down in flames the +last few days, resulting in files being forever locked, etc. + + +KMP@MIT-MC 05/06/81 23:42:47 +To: (BUG ITS) at MIT-MC, ECC at MIT-AI +CC: EB at MIT-AI +Today I noticed several unusual effects which affected Emacs, but which I +attribute to ITS or hardware lossage. + +A dumped Emacs which I had and for which no files it depended on had changed +suddenly stopped working. + +Doing M-X Load LibraryVT52 loaded the SAFETY library for half the afternoon +in any version of Emacs. ECC and I both looked at this and were kinda confused. +:PRINT showed EMACS;VT52 :EJ was really not the SAFETY library, so something +was off. + +Later I was going to show EB how M-X Load LibraryVT52 was losing, but it said +that the file was not in library format. This is wierd because it had still not +been altered (since March, 1980). + +I just renamed EMACS;VT52 :EJ to EMACS;VT52 O:EJ and copied in +EMACS;VT52 :EJ and suddenly my dumped Emacs is working again. +M-X Load LibraryVT52 is now working also. A binary comparison of these files +(I opened them in fixnum mode in lisp and did a word-by-word comparison) shows +that they are identical and doing M-X Load LibraryEMACS;VT52 O:EJ now wins. + +I am wondering what kind of lossage could have caused this problem. Any +ideas? Maybe the directory was somehow inconsistent? + +-kmp + + +Date: 3 May 1981 00:12-EDT +From: Frank J. Wancho +Subject: [RGF: DM2500] +To: CBF at MIT-MC +cc: BUG-ITS at MIT-MC, FJW at MIT-MC, GZ at MIT-MC, MOON at MIT-MC, + RGF at MIT-MC + +Ok, I suppose the distinction is that since my DM3025A also responds +to DM2500 codes and that I use :TCTYP DM SCROLL, everything works just +fine for me. But, when another tries to emulate a DM2500 and uses the +same :TCTYP command (effectively), it doesn't scroll except when using +CRTSTY??? -- I claim again that :TCTYP does it right and the +documentation in KSC;DM2500 DOC must be either misleading or +incomplete... or not properly implemented in RGF's emulation or some +combination... + +--Frank + + +CBF@MIT-MC 05/02/81 20:34:46 Re: [RGF: DM2500] +To: MOON at MIT-MC +CC: FJW at MIT-MC, RGF at MIT-MC, (BUG ITS) at MIT-MC +CC: (BUG CRTSTY) at MIT-MC, GZ at MIT-MC +Unfortunately, a real Datamedia will very easily drop out of roll mode. +Exiting Insert/Delete mode (^X) will also exit roll mode. On some +models apparently a Master Reset command (^_) will also exit roll mode. + +In order to actually use Datamedia hardware scroll features it would be +necessary to always follow each of these commands with an enter roll mode. +This would probably work for TCTYP support. The reason CRTSTY does not +use this method is because it allows the use of all 80 columns on the +terminal (if a terminal autowraps the way a Datamedia does, you cannot use +the last column with TCTYP support). If the terminal were to operate in +roll mode all the time, but the ITS user had asked for wrap mode (the +default, as opposed to scroll mode), and were to output a character in the +last column of the last line, the terminal would auto-newline and scroll +irretrievably losing the top line of the screen before CRTSTY could do +anything to compensate. In fact there would be no way CRTSTY could safely +put a character in that position, short of temporarily exiting roll mode. +I guess it seemed easier to implement scrolling with delete line. + + +MOON@MIT-MC 05/02/81 17:28:13 Re: [RGF: DM2500] +To: FJW at MIT-MC, RGF at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG CRTSTY) at MIT-MC, GZ at MIT-MC +I forgot to say in my previous message that by default ITS will never scroll +but will always wrap around at the bottom of the screen. If you would prefer +scrolling say :TCTYP SCROLL and then output from most programs will be scrolled. + +MOON@MIT-MC 05/02/81 17:26:44 Re: [RGF: DM2500] +To: FJW at MIT-MC, RGF at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG CRTSTY) at MIT-MC, GZ at MIT-MC +ITS sends ^M ^J ^W when it wants to go to the next line, which should +scroll if given on the bottom line. Real datamedias ignore the ^J in this +circumstance, but ITS sends it anyway for the benefit of some simulated +datamedias. ^W is erase-to-end-of-line of course. + +Maybe CRTSTY doesn't send the ^J? + +ITS assumes that roll mode is on and that you have set the line length short +enough that the hopeless auto-nl misfeature does not get invoked. The :tctyp +command does both of these I believe. You should not implement auto-nl and +not implement lack of roll mode. What you should do is handle ^M by going +to start of same line, ^J by going down a line and scrolling if that would take +you off the bottom of the screen, both of these unconditionally. That will +work with ITS but perhaps not with some other programs such as CRTSTY and +WAITS that claim to know about datamedias. It will also work with TECO +on Tenex and TOPS-20. + +Date: 1 May 1981 03:43-EDT +From: Robert W. Kerns +Subject: mail files +To: dp at MIT-ML +cc: RICHARDSON.ALYSON at MIT-MC, BUG-its at MIT-AI + + Date: 30 Apr 1981 2249-EDT + From: ALA + To: bug-its at MIT-AI + cc: richardson.alyson at KL2137 + Reply-to: dp at MIT-ML + Subject: mail files + Message-ID: + + My mail file on mit-ai (users0;ala mail) seems to be locked. Can + someone look into this? + + Thanks. + + Alyson + (ala@mit-ai) + -------- + +This means one of two things. One is that it may have already been +deleted, but not yet removed from the directory because someone is +reading it (such as RMAIL). The other possibility, which isn't likely +in this case, is that the file is still being written, or is being +appended to. + + +Date: 1 May 1981 03:22-EDT +From: Frank J. Wancho +Subject: [RGF: DM2500] +To: BUG-ITS at MIT-MC, BUG-CRTSTY at MIT-MC +cc: FJW at MIT-MC, RGF at MIT-MC, GZ at MIT-MC + +Ron is using the documentation found in KSC;DM2500 DOC and GZ's DM2500 +emulation code for use on a TRS-80 to emulate a DM2500 on his micro +and it seems that there is a difference in how a DM2500 is scrolled +using TCTYP vs CRTSTY. (Now, I know there is, but my terminal +emulates a DM2500 too, and I don't use CRTSTY, and it scrolls alright +for me.) Is there a difference between the description of a DM2500 in +that file and the ITS implementation as far as how scrolling is +handled? The reason I ask is that I disagree with Ron and believe +that the way ITS does is right and CRTSTY does it awkwardly (nad takes +up an unnecessary job slot in the process. --Frank +-------------------- + +Date: 05/01/81 01:34:12 +From: RGF +Re: DM2500 + + Frank, I still have problems with the DM2500 when I'm not using +CRTSTY. The only time I can get a screen scroll is when I'm in +CRTSTY, and it does a scroll by going to top line and issuing a +delete, then going back to bottom line. Is it possible to have +the "natural" DM2500 (whatever *that* is) do this? +==================== + + +Date: 30 Apr 1981 2249-EDT +From: ALA +To: bug-its at MIT-AI +cc: richardson.alyson at KL2137 +Reply-to: dp at MIT-ML +Subject: mail files +Message-ID: + +My mail file on mit-ai (users0;ala mail) seems to be locked. Can +someone look into this? + +Thanks. + + Alyson + (ala@mit-ai) + -------- + +Moon@MIT-MC 04/30/81 04:03:50 Re: THIRD; directory at AI +To: rich at MIT-AI +CC: RWK at MIT-MC, ZVONA at MIT-MC, (BUG ITS) at MIT-MC +Please choose a different name for this directory. Having a device and a directory +with the same name confuses both people and some programs. + +Date: 29 April 1981 22:43-EST +From: Robert W. Kerns +To: ZVONA at MIT-AI +cc: BUG-ITS at MIT-AI + + Date: 28 April 1981 20:50-EDT + From: David Chapman + To: BUG-ITS at MIT-AI + + there is a bogus directory third;. i suppose it is bogus since there is no + second;. It is empty. also confusing. + +I don't know who created this losing directory, but I will go upstairs and +try to find out, so I can explain to them why they should not do this. On +the off chance that it was somebody on this mailing list with a momentary +brain fade, I remind you all once again that directories should not share +the same name as devices if you do not wish to confuse both programs and +people. I have deleted the link which preserved the directory, so it will +go away the next time the system is brought up. + + +Date: 29 April 1981 19:14-EDT +From: Edward Barton +To: BUG-ITS at MIT-AI + +LNKEDP is in the SYSCTB table, but :CALL LNKEDP doesn't know about it. + +GJC@MIT-MC 04/28/81 23:35:42 +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC +There is a job on MC uname 500A41 jname ARPA Sname 500A41 status +LOGIN +Chaos network connection to foreing addr PLASMA 15411 with flag F. +it has 15:25:08 (i.e. one hell of a shitload) of cpu time. +I'm just going to gun it as this seems to be a common and reported bug. + + + +Date: 28 April 1981 20:50-EDT +From: David Chapman +To: BUG-ITS at MIT-AI + +there is a bogus directory third;. i suppose it is bogus since there is no +second;. It is empty. also confusing. + +Date: 20 April 1981 20:13-EST +From: David Eppstein +To: RWK at MIT-MC +cc: BUG-ITS at MIT-MC, KLOTZ at MIT-MC + + KRONJ@MIT-MC 04/19/81 05:25:08 + To: (BUG ITS) at MIT-MC + Several problems: + + (2) If I do :COPY AR1:GUEST2;EINIT >,$ it shows the default file as + AR1:GUEST2;EINIT 90 rather than >. (90 is the current version). This + is irritating for copying the file to another Fn1. If I + wanted 90 I would have said 90 and not >. + + This is a very useful feature. It won't hurt you to type a space + and a '>', and it makes possible retaining version numbers when + moving files, something which is done very often. + +I just found that out when copying my files to a new directory (I was +told my archive was probably at fault for not compacting rather than +ITS, so I got a new one.) + + (3) What happened to :TCTYP H19? + + How should I know? You haven't said anything about what problem + you experienced. + +It was setting it to Glass,+/- a lot of things. The problem has been +fixed. + + +Date: 20 April 1981 18:24-EST +From: Robert W. Kerns +To: KRONJ at MIT-MC +cc: BUG-ITS at MIT-MC, KLOTZ at MIT-MC + + KRONJ@MIT-MC 04/19/81 05:25:08 + To: (BUG ITS) at MIT-MC + Several problems: + + (2) If I do :COPY AR1:GUEST2;EINIT >,$ it shows the default file as + AR1:GUEST2;EINIT 90 rather than >. (90 is the current version). This + is irritating for copying the file to another Fn1. If I wanted 90 I + would have said 90 and not >. + +This is a very useful feature. It won't hurt you to type a space and a '>', +and it makes possible retaining version numbers when moving files, something +which is done very often. + + (3) What happened to :TCTYP H19? + +How should I know? You haven't said anything about what problem you +experienced. + + +Date: 20 April 1981 02:38-EST +From: David A. Moon +Subject: New system needed +To: BUG-ITS at MIT-AI + +I turned on support for insert/delete characters on C100s in TCTYP. Evidently +this was premature since the system installed on MC is too old to support it. +MC should get a new system ASAP (the source seems to be OK, it works on ML). +Other machines may need new systems, too. + +KRONJ@MIT-MC 04/19/81 05:29:11 +To: (BUG ITS) at MIT-MC +...to continue: +(3) What happened to :TCTYP H19? + +Problems (1) and (2) combine nastily: I used to copy EINIT > (my largest file) +to a couple of other FN1s on the archive and then delete them to compact the +archive and save space. Now it is not only harder to type the :COPY commands, +but the process as a whole instead of saving space leaves me with a huge +archive! Please fix soon. + +P.S. A command to compact archives so I wouldn't have to go through all that +trash would be v. useful. + + +KRONJ@MIT-MC 04/19/81 05:25:08 +To: (BUG ITS) at MIT-MC +Several problems: + +(1) If I delete a large file or two from an archive (say around four blocks) + it used to compact the archive to 0 wasted words. Now the wasted words + just sit there and my archive gets larger and larger (unless this is some + asynchronous process and by now it has been compacted). + +(2) If I do :COPY AR1:GUEST2;EINIT >,$ it shows the default file as + AR1:GUEST2;EINIT 90 rather than >. (90 is the current version). This + is irritating for copying the file to another Fn1. If I wanted 90 I + would have said 90 and not >. + +(3) What happened to :TCTYP h + +Date: 18 Apr 1981 0337-EST +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: BUG-its at MIT-DMS +Cc: bug-tctyp at MIT-MC +Subject: BUG => its +Message-id: <[MIT-DMS].194515> + +On DM, doing :TCTYP H19 +ERROR: CNSSET: MEANINGLESS ARGS +270>>.CALL 3467 (CNSSET) + + +This wasnt broken 2 hours ago! + + + +Date: 15 Apr 1981 1119-EST +From: WJN at MIT-DMS (Wayne J. Noss) +To: BUG-ITS at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].194047> + + If I do AR4$^F just to look at an archive, the file author of the +AR4 file gets set to my hsname. + I think that, to be meaningful, the author should not be set by +what is (should be) a read-only operation. + the WJN + + +Date: 13 Apr 1981 1631-PST +From: Mark Crispin +Postal-Address: 12155 Edgecliff Place; Los Altos Hills, CA 94022 +Stanford-Phone: (415) 497-1407 +Subject: Re: My previous message about forced conversion to TCP +To: Moon at MIT-AI, PHW at MIT-AI, av at MIT-DMS, psz at MIT-ML, wam at MIT-ML, + jm at MIT-MC +cc: (BUG ITS) at MIT-AI +In-Reply-To: Your message of 4-Apr-81 0039-PST + +TOPS-20 does have a working TCP TELNET implementation. I wrote it. + +-- Mark -- + +PS: I agree with you that 1983 is premature for the changeover. +------- + +MOON@MIT-MC 04/13/81 12:06:51 Re: MLDEV broken +To: (BUG ITS) at MIT-MC +Doing DELETE on ML: and AI: from AI seems to have started trying to do +the deletion twice, such that it hangs for a fairly long while then says +file not found. I didn't try it on any file names with ">" or "<" +in them since that could be dangerous. I haven't noticed this before today. + +Date: 6 April 1981 23:35-EST +From: Robert W. Kerns +Subject: [GREN at MIT-MC: Forwarded] +To: BUG-ITS at MIT-MC + +Date: 6 APR 1981 2304-EST +From: GREN at MIT-MC (Ian G. Macky) +To: (BUG DDT) at MIT-MC + + +:MOVEing from SYS***; does not make any sort of message on the console. +Was this omission on purpose? From or to, that is. + +---------------- +It seems DELEWO doesn't check for being a system directory. + + +Date: 6 April 1981 10:51-EST +From: Robert W. Kerns +Subject: This is an ARPAnet problem, but is there any way which ITS can help it? +To: ELLEN at MIT-MC +cc: BUG-MAIL at MIT-MC, BUG-ITS at MIT-MC + + ELLEN@MIT-MC 03/24/81 18:08:46 Re: This is an ARPAnet problem, but is there any way which ITS can help it? + To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC + MILNE@MIT-AI + Howdy, + One other + thing from all of us over in Britian.I am not sure if this is the + best mail box for this, but perhaps you can pass it on. + Our link from edinburgh to MIT is very complex, going thourgh + at least 5 machines before getting to MIT. + This is then extremely unreliable. very often we get cut + off by a failure over here, and can't get back to close + our job. This is a British and ARPA problem, + but results in us staying logged in when we don't exist. + I talso seems that these crashes always take place just before + I finish typing MAIL. + What is the current thing to kill these jobs? + Could it be clever and discover we were in MAIL and send the + partial message for us, perhaps with a message added at the botto + bottom? + Anyway, this is the basic problem, though I'd let you know. + cheers, Rob Milne, Edinburgh + + +You should tell them about :REATTACH ... that's what it's for. +Gad, sending the message automagically would be gross. If the +problem is that their network just crashes totally and they cannot +reconnect for a long period of time, they should be putting lots of +pressure on it's implements to either fix it or go work for the +post office (um, er, oh, so THAT'S the problem...) + + +MOON@MIT-MC 04/06/81 02:46:21 Re: Keeping track of system changes +To: (BUG ITS) at MIT-MC +Please log changes to ITS in the file MC:SYSTEM;ITS RECENT. +I have moved this file off of my personal directory. Just a brief note +will suffice to help keep track of what's going on. There is a ---- +in the file at the point where new changes are supposed to be added. +After that point are a collection of mostly fairly random ideas +about things that could be changed in the future. + +It hasn't been updated since Sep 20, 1980, so if you made any changes +worthy of note since then please put them in. + + +Date: 4 APR 1981 0406-EST +From: Moon at MIT-AI (David A. Moon) +To: RWK at MIT-MC +CC: (BUG LISPM) at MIT-AI, (BUG ITS) at MIT-AI + + Date: 30 March 1981 19:26-EST + From: Robert W. Kerns + Subject: Supdup typeout process + To: MOON at MIT-MC + ... + But the primary bug I was reporting was that typing + control-greek-E blowing away the typeout process. +Fixed in the source of TS3TTY !!. It was echoing as a garbage GT40 control command. +I am not going to fix the GT40 simulator, it would injure my stomach and throat. + +Date: 4 APR 1981 0339-EST +From: Moon at MIT-AI (David A. Moon) +Subject: My previous message about forced conversion to TCP +To: PHW at MIT-AI, av at MIT-DMS, psz at MIT-ML, wam at MIT-ML +To: jm at MIT-MC +CC: (BUG ITS) at MIT-AI + +Two or three people at other sites have communicated with me about this. +Apparently not even TOPS-20 actually has working TCP protocols (neither telnet, +nor FTP, nor mail). The concensus seems to be that the change cannot possibly +happen on most sites by 1983, and hopefully the sites can convince the sponsors to +convince the network management accordingly. We are not alone in not having +the manpower to make this sort of complex and unnecessary change, it would appear. + +GJC@MIT-MC 04/03/81 17:23:08 +To: (BUG ITS) at MIT-MC +CC: (BUG EMACS) at MIT-MC +Typing along in my EMACS, just got an ILLEGAL OPCODE message +and was detached. Very strange, maybe I was being hacked. +Everything working fine now. + + +GJC@MIT-MC 03/31/81 08:22:03 +To: (BUG ITS) at MIT-MC +CC: GJC at MIT-MC +A job + +542C54 CHAOS 54C54 +LOGIN ? 2 0 55% 14:43:32 + +just used up 14 hours of MC cpu time doing absolutely nothing. +Maybe this is not a problem, I don't know. + + + +Moon@MIT-MC 03/30/81 17:04:12 Re: > filename convention +To: WILL at MIT-AI +CC: (BUG ITS) at MIT-AI + Date: 29 MAR 1981 2249-EST + From: WILL at MIT-AI (William D Clinger) + To: (BUG ITS) at MIT-AI + + "will;atolia >" refers to "will;atolia demo10" rather than to + "will;atolia 41". Is this as it should be? + +Well, yes and no. That's what the ">" convention is defined to do. +I would not care to defend that as the best choice among the possible +definitions of what it should do. + +Moon@MIT-MC 03/30/81 17:01:21 Re: ITS Arpanet system maintenance +To: JM at MIT-MC, av at MIT-DMS, phw at MIT-AI, wam at MIT-ML +To: psz at MIT-ML +CC: (BUG ITS) at MIT-MC, ELLEN at MIT-MC + ... + Our next major netwide effort will be to cutover + all hosts to the new DOD Standard Protocols by 1 January of 1983. This + is the cutoff date and it will be enforced. + ... + Maj. Joe Haughney + DCA Code 531 + Defense Communications Agency + +This is a non-trivial change. If we are to do it, it will require +approximately one man-year of highly-skilled system programming, +possibly more, and it is unlikely that I will be available for this. If +I were you, I would start communicating with the sponsors and inform +them that it will be impossible to meet this deadline without extra +funding to hire someone to do it. I expect that most other hosts that +don't run TOPS-20/TENEX nor Multics are in the same boat. + +By the way, unlike the 96-bit leader change which we did 2 or 3 years +ago, this change is of absolutely no benefit to us (unless it really is +enforced, in which case it "benefits" us by allowing us to continue to +use the Arpanet). The DOD Standard protocols (Internet and TCP) provide +the same functionality as the existing protocols, except with the details +all changed around, and with some additional functionality for AUTODIN II +which is not of much interest to us. + + +KMP@MIT-MC (Sent by PIQUE@MIT-MC) 03/30/81 01:04:04 Re: Long input echo delays +To: (BUG ITS) at MIT-MC +I am coming in over a 300baud dialup and I have been experiencing long +echo delays intermittently. eg, in com links, where I assume I am talking +directly to the operating system, sometimes things will hang and then +I will get a burst of 80chars all at once after about a 5 second wait. +On a direct dialup this does not sound `normal', so in case it's a bug +that can be fixed, I figured I would mention it. -kmp + + +Date: 29 MAR 1981 2249-EST +From: WILL at MIT-AI (William D Clinger) +To: (BUG ITS) at MIT-AI + + "will;atolia >" refers to "will;atolia demo10" rather than to +"will;atolia 41". Is this as it should be? + Peace, Will + +Date: 26 MAR 1981 2139-EST +From: zemon at MIT-AI (Landon M. Dyer) +Sent-by: ___024 at MIT-AI +To: (BUG ITS) at MIT-AI + + I will be a good Luser and report a small bug I have seen : + + When I log on from NBS-TIP (MITER-TIP, PENT-TIP, etc etc.) the +following stragne thing happens. ITS will print out the usualy warnings +about tourist usage during the daytime, then : + +AI ITS.1197. PWORD.1733. +TTY 43 + /\ + || + \\=== ITS will 'hang' about here (the actual position varies +from login to login.) Typing a space or ^Z will get ITS to continu +printing, though. + + This has been going on for at least a month, possibly two... + + + -Landon- + +Date: 26 MAR 1981 1711-EST +From: RMS at MIT-AI (Richard M. Stallman) +To: GSB at MIT-AI, (BUG ITS) at MIT-AI + +I think I have fixed the ECHOIN bug with a patch to make NECHOIN+12 or so +call TYIFL2 instead of UFLS. TYIFL2 is a new tag which is TYIFLS plus a few. +Refer to the source. I haven't tried this out. + +ELLEN@MIT-MC 03/24/81 18:08:46 Re: This is an ARPAnet problem, but is there any way which ITS can help it? +To: (BUG MAIL) at MIT-MC, (BUG ITS) at MIT-MC +MILNE@MIT-AI +Howdy, + One other +thing from all of us over in Britian.I am not sure if this is the +best mail box for this, but perhaps you can pass it on. +Our link from edinburgh to MIT is very complex, going thourgh +at least 5 machines before getting to MIT. +This is then extremely unreliable. very often we get cut +off by a failure over here, and can't get back to close +our job. This is a British and ARPA problem, +but results in us staying logged in when we don't exist. +I talso seems that these crashes always take place just before +I finish typing MAIL. + What is the current thing to kill these jobs? +Could it be clever and discover we were in MAIL and send the +partial message for us, perhaps with a message added at the botto +bottom? +Anyway, this is the basic problem, though I'd let you know. +cheers, Rob Milne, Edinburgh + + + +GSB@MIT-ML 03/21/81 00:06:59 Re: echoin +To: (BUG ITS) at MIT-ML +It seems that ECHOIN does not cause the setting (or clearing or whatever) +of the flag which says that input has been waited for near the bottom +of the screen. This causes my tty prescan to sometimes be very gross +by causing a --more-- when a character is typed when it is on the last +line of the screen. I have temporarily patched this by fooling it to +not use echoin for the first character of its input, but a combination +of rubbing out and forced redisplay can make it happen still. + + +GJC@MIT-MC 03/20/81 19:05:21 +To: (BUG ITS) at MIT-MC +The load on MC in terms of the number of users and the jobs +they are running had not been great for the last few hours. +20 users, fiar share = 67%, 5 macsymas, no TEX's or GLP's +or other core hoggers running. However, system response is +*BAD*, *REALLY* BAD. Long pauses whilegetting i/o in Peek, +echoing slow, you can type ahead maybe ten or so characters. +A rubout might take 3 seconds to happen. + + +MOON@MIT-MC 03/20/81 16:30:35 Re: BUG => ITS (net hangage on DM) +To: PDL at MIT-DMS +CC: (BUG ITS) at MIT-MC +I changed the network code around slightly in that system to make it +more robust to the hardware problems MC was having at the time +(which turned out to be a marginal optical isolator in the network +interface). I don't know anything about the DM network interface, +which is different from all the others. I thought you already had +a patch in to take out some of the change; did the patch get lost +or is it failing in the presence of the patch? + +The changes to the code had to do with deciding when the net was up and +when it was down, and fixed problems where the system would crash if +it went up and down too rapidly. + +Maybe you could look at a source compare of the old and new IMP and +SYSJOB files, and give a "second opinion"? + +Date: 20 Mar 1981 1338-EST +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-ITS at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].190788> + +Ever since we have been running ITS 1198 on DM, we have every so +often gotten into a state where after a crash the net will not +come up. When it gets into this state the only way out is to +power cycle the net interface. I suppose this sounds like a +hardware lossage, but as it started when we installed 1198, I +am suspicious. Any chance someone knowledgeable could look at +this in the code? + Dave + + + +Date: 19 Mar 1981 at 0318-PST +From: Stuart Mclure Cracraft +To: bug-its at MC +Subject: roll mode +Sender: mclure at Sri-Unix + +If I telnet into mc, do :tctyp dm (which turns off roll +mode on my datamedia), and then logout, ITS fails +to turn roll mode back on. + + + +Date: 18 Mar 1981 2041-EST +From: TAA at MIT-DMS (Timothy A. Anderson) +To: RWK at MIT-MC +Cc: (BUG ITS) at MIT-MC, PDL at MIT-MC +In-reply-to: Message of 18 Mar 81 at 2002 EST by RWK@MIT-MC +Message-id: <[MIT-DMS].190561> + +If I say J$J, set .pagrange from DDT, then kill J, whoever gets +that job slot next will have .pagrange set (determined by saying +J$J quickly and getting the same job slot...). This apparently +was the cause of the lossage with inqupd on DM, anyway. + -taa + + + +RWK@MIT-MC 03/18/81 20:02:33 +To: (BUG ITS) at MIT-MC +CC: TAA at MIT-MC, PDL at MIT-MC +It looks like RMS patched INQUPD to do a .SUSET of .SPAGRANGE +Do you have any evidence other than INQUPD that .SPAGRANGE +isn't being cleared? Note that in my INQUPD I have here, +.PAGAHEAD is zero, which should mean that the feature is +disabled. A word search sdoesn't show any .SUSET for turning +it on. + +What I see looks more like the standard lossage with the entry +for ______. What I don't understand is how the current one +got in there. It's the one introduced by OSI1P (now PST) +on the 7th of March. I could have sworn I eliminated that +one when it caused the database to lose before. + + +Date: 18 Mar 1981 1943-EST +From: TAA at MIT-DMS (Timothy A. Anderson) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].190555> + +In ITS 1198 (on DM), and ITS 1207 (MC), .pagahd and .pagrange have the +amusing property that they are not reset by killing the job they are set +in. Thus, if I get job 3, set those variables, and kill it, whoever +gets job 3 next will end up with them set. +The bug PDL reported about the death of inqupd on DM seems to be related +to its use of page-ahead: when we patched out all the appropriate +susets, it ran to completion. RWK, could this be the cause of your +problems with it on MC? +DM has been exhibiting rather entertaining behavior with respect to the +NSWPGS user variable: jobs with page-ahead set (due to the leftover +.pagahd and .pagrange from old inqupds) get negative nswpgs with +high frequency. We've also been observing reasonably random behavior +in certain jobs, perhaps caused by their pages being swapped in at +the wrong place? + -taa + + +Date: 18 Mar 1981 1016-EST +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-ITS at MIT-MC +Subject: Interesting statistics +Message-id: <[MIT-DMS].190487> + +PEEKing at a freshly minted INQUPD on DM produces: + +DM ITS 1198 Peek 463 03/18/81 09:52:16 Up time = 12:53:26 +Memory: Free=26 Runnable Total=182 Out=-91 Users: High=23 Runnable=5 +Index Uname Jname Sname Status TTY Core Out %Time Time PIs + 21 INQUPD INQUPD INQUIR PAGE ? 163 -91 11% 11 +Fair Share 35% Totals: 163 11% 11 +Logout time = 1:26:42 Lost 32% Idle 0% Null time = 9:44:28 + + Ch Idx Uname Jname Mode Bks+Wds Rd% Pk File Name + 12 21 INQUPD INQUPD RI 0+0 0% 19 INQUIR; LSR1 LOCK + +I watched it get up to 168 in and -238 out before it quit. + Dave + + + + +CBF@MIT-MC 03/15/81 20:53:32 Re: TS3TTY 281, H19 padding & C100 char insert/delete +To: MOON at MIT-MC +CC: CBF at MIT-MC, (BUG ITS) at MIT-MC + MOON@MIT-MC 03/15/81 20:23:08 Re: TS3TTY 281, H19 padding & C100 char insert/delete + You probably didn't read the comments, since RWK changed the padding + units to be of 1/8's of milliseconds rather than milliseconds in the + case of Y-position dependent padding. + +Nah, RWK didn't do that, I did, and took it into account in the 5ms figure. + + +Date: 15 March 1981 21:08-EST +From: Robert W. Kerns +Subject: TS3TTY 281, H19 padding & C100 char insert/delete +To: MOON at MIT-MC +cc: CBF at MIT-MC, BUG-ITS at MIT-MC + + MOON@MIT-MC 03/15/81 20:23:08 Re: TS3TTY 281, H19 padding & C100 char insert/delete + To: CBF at MIT-MC + CC: (BUG ITS) at MIT-MC + You probably didn't read the comments, since RWK changed the padding + units to be of 1/8's of milliseconds rather than milliseconds in the + case of Y-position dependent padding. + +I didn't do this. I thought CBF must have done it. It was done before +I hacked this. + + +Date: 15 Mar 1981 (Sunday) 2100-EDT +From: SHRAGE at WHARTON-10 ( Jeffrey Shrager) +Subject: Typing a ":" +To: bug-its at MIT-AI + +I might have bugged this before. I recall thinking that I should do so about +three weeks ago. If not... here goes: + +When you are at DDT's "*" prompt, you cannot backspace and fix a missing ":". +That is, for example, I begin typing a command and the realize that it should +have had a colon before it. If I backspace (rubout) to the beginning and +enter the colon then retype the command it does not realize that the colon +is there and errors saying "you must type a colon..." + +If I bugged this before forgive me. My mind must be going. +-- JEff + + +MOON@MIT-MC 03/15/81 20:23:08 Re: TS3TTY 281, H19 padding & C100 char insert/delete +To: CBF at MIT-MC +CC: (BUG ITS) at MIT-MC +You probably didn't read the comments, since RWK changed the padding +units to be of 1/8's of milliseconds rather than milliseconds in the +case of Y-position dependent padding. + +CBF@MIT-MC 03/15/81 05:46:47 Re: TS3TTY 281, H19 padding & C100 char insert/delete +To: (BUG ITS) at MIT-MC +In response to RWK's testing of the H19 line insert/delete padding, I have +raised it a little bit in the source. I probably rounded down where I +should have rounded up in calculating it. I went to patch it in the running +system on MC, and found a highly ridiculous value of 5 ms of padding per line +moved there. (I am raising the value from .625 ms per line moved to .75). +Please tell me that this 5ms value is totally random. If its true, it is not +consistent with other programs which use 18 ms net for each line isnet/delete +done. I have left the 5ms figure pending clarification. + +In the grand tradition of TS3TTY kludges, I have put entries for char +insert/delete in for the C100. In order to put the the null needed to exit +char insert in the ASCIZ string, I have resorted to 8 bit characters and +used a 200. As best as I can tell this will be loaded as 8 bits and +deposited as 7 on a Morton and then be caught at the apropriate level +and turned into the kludge thats needed to get a null out on a Morton. +However, if I'm wrong there are two other possible results: + 1) Use of char insert on a C100 on a Morton will result in never + exiting char insert mode. This would probably result in rather + random screen lossage. + 2) It will crash ML? (Does DM have Morton also?) + +Whoever brings up the next ITS on these machines should probably test +this immediately to make sure option 2 does not result. Note that %TOCID +will not be turned on by default for :TCTYP C100 since char insert/delete +only works on new microcode C100s. If you have an old microcode C100 you +should mail someone like me a set of 4 or 5 2716s depending on whether +you also want a Sail character Prom for the 2nd charset slot. + + +moon@MIT-MC (Sent by ___165@MIT-MC) 03/11/81 23:43:18 +To: (BUG ITS) at MIT-MC +How come When the GLP spooler wires down its pages in the I/O portion of memory, +they don't get shuffled into high memory? I thought there was code for this. This caused MC +to deadlock. Maybe there is too much high memory available and it didn't try to swap it out? + + +Date: 11 MAR 1981 0728-EST +From: RWK at MIT-AI (Robert W. Kerns) +Subject: LNKEDP +To: (BUG ITS) at MIT-AI + +Oh, it's just the entry in SYSCTD not indicating the need to +decode the channel argument. I'll fix it when MC comes back +up again. + +RWK@MIT-MC 03/11/81 07:08:07 +To: (BUG ITS) at MIT-MC +I've just brought up the new ITS on MC. It seems to be +OK except for a few minor problems: + +The padding on H19's for I/D line doesn't seem to work +right in some circumstances. I'm not sure what's going +on, but it fails whenever EMACS recomputes the window, +resulting in ^S^Q lossage. But it always seems to work +when I Insert or delete any number of lines manually. + +The LNKEDP system call always gives WRONG TYPE DEVICE. +It's not immediately obvious to me just why, from +looking at the source. (BTW, this was put in the +wrong place, effectivly removing the LOAD system +call by screwing the binary search). Anyway, +MC is about to go down for PM, so I'll leave this +for later. As near as I can tell, page-ahead is +winning, or at least isn't causing the system to +lose. But I haven't tried it on a very loaded system +yet. + + +Date: 10 MAR 1981 1911-EST +From: RLB at MIT-MC (Richard L. Bryan) +To: EBM at MIT-MC, MT at MIT-MC +CC: (BUG ITS) at MIT-MC + + GJC@MIT-MC 03/10/81 18:02:59 + On MC now we are getting jobs like 66 420C66 CHAOS DVR +LOGIN? + which are continuously running and have 3:43:20 cpu time + on them. + + +They are trying to log in when already logged in. +The login fails ("CAN'T MODIFY JOB"), the uname is incremented, +and the login is retried. + + +GJC@MIT-MC 03/10/81 18:22:26 Re: last bug note about jobs with unusally long running times. +To: (BUG ITS) at MIT-MC +gosh, I didn't think about the fact that MC has been up +for ten days. + +GJC@MIT-MC 03/10/81 18:02:59 +To: (BUG ITS) at MIT-MC +On MC now we are getting jobs like 66 420C66 CHAOS DVR +LOGIN? +which are continuously running and have 3:43:20 cpu time +on them. + + +Date: 7 MAR 1981 1001-EST +From: KLOTZ at MIT-AI (Leigh L. Klotz) +To: (BUG ITS) at MIT-AI + +I got a non-rec data err on .teco.;tecord > and just then got +one on .tape5;tape 2626. + +I had gotten one on tecord a week ago but not one since. + +Should I get tecord off backup tape? +Leigh. + +Moon@MIT-MC (Sent by ALAN@MIT-MC) 03/06/81 04:38:29 +To: (BUG ITS) at MIT-MC +I wonder how come TYONRM+2 got decremented or else got bit 35 turned off? + +Date: 4 MAR 1981 1529-EST +From: KLOTZ at MIT-AI (Leigh L. Klotz) +To: (BUG ITS) at MIT-AI + +For at least the past couple of weeks I've been getting random +beeps. (Usually in emacs, but probably because I've spent most +of my time there; it happened last night in maclisp.) +They seem to be cli interrupts, as when I ^Z out of the job it happens +again. But, I have no sends and :ddtsym cliunm is 0. (Should I be +looking at a similar location in emacs?) +It flashes once. I have ..belcnt/1, if that matters. +Leigh. + +Date: 2 March 1981 03:12-EST +From: Ed Schwalenberg +Subject: Blast from the past +To: PGS at MIT-AI +cc: BUG-ITS at MIT-AI + +Many and many a year ago, in a kingdom by the sea, I complained +of this, and it was said, "If you don't like it, you fix it." +So I fixed the archive device handler to return PNM if that was +the problem. Unfortunately, the source to which I did this +was not in sync with the working binary, and my "fix" broke other +things. The archive device has only recently recovered from this +long history of lossage. This time, however, I am going to leave +it alone. + +Date: 1 MAR 1981 2014-EST +From: PGS at MIT-AI (Patrick G. Sobalvarro) +To: (BUG ITS) at MIT-AI + +When the pack that an archive resides on is not mounted, and one +attempts to list the archive, the losing error message, +"DSK:AR1;.FILE. (DIR) - NON-EXISTENT DIRECTORY" is printed, and one's +working directory is changed to AR1;. Something more reasonable, like +"PACK NOT MOUNTED" might be more of a win. + +Date: 26 February 1981 03:36-EST +From: Charles Frankston +Subject: H19's on ITS +To: EBM at MIT-XX +cc: BUG-its at MIT-AI + + Date: 25 Feb 1981 2031-EST + From: EBM at MIT-XX + + :TCTYP H19 would actually be useful if ITS would pad the ins/del line + sequences. Our experience indicates that 17ms. per line + inserted/deleted is required at 9600 baud, and no padding is needed at + 1200 and lower. We just pad proportionately in between. (I.e., 4800 + baud => 8.5ms pad, etc.) I don't think this will screw anybody very + much, and would certainly please H19 users, though having ins/del char + would be nice, too. Getting that would require adding a terminal type, + though (sigh). Anyway, is anybody out there willing the hack TS3TTY to + put in the padding? + +You message makes no sense, but I implemented it anyway. I don't think +the H19 is 17ms PER line inserted or deleted, and I don't see why it only +takes 8.5ms if the UART is running at 4800 baud. I implemented a padding +of .625 ms per line moved at speeds higher than 1200 baud, and no padidng +at 1200 baud. This is only in the source of course, some poor sucker +who brings up the next ITS will have to debug it. + + +Date: 25 Feb 1981 2031-EST +From: EBM at MIT-XX +Subject: H19's on ITS +To: bug-its at ai + +:TCTYP H19 would actually be useful if ITS would pad the ins/del line +sequences. Our experience indicates that 17ms. per line +inserted/deleted is required at 9600 baud, and no padding is needed at +1200 and lower. We just pad proportionately in between. (I.e., 4800 +baud => 8.5ms pad, etc.) I don't think this will screw anybody very +much, and would certainly please H19 users, though having ins/del char +would be nice, too. Getting that would require adding a terminal type, +though (sigh). Anyway, is anybody out there willing the hack TS3TTY to +put in the padding? + +------- + +JLK@MIT-MC 02/23/81 19:02:52 Re: MUX, ITS, and Tektronix wierdness +To: (BUG ITS) at MIT-MC +CC: RCE at MIT-MC +After painstaking investigations, I have determined that ITS does some very wierd +things on Chaos Supdup connections with a TCTYP of %TNTEK. There seems to be a bug +where it ends up throwing away 2 packets completely. The only thing I change in +my icp packet is the tctyp field (to say, teleray or somesuch) and it works fine. +This is repeatable. Nothing in my software depends on the tctyp. The observed +wedged state is that 2 packets are missing and ITS refuses to resend them, +even though ITS agrees that they have not been acknowledged. Its hard for +me to see how this dependency could exist (output reset wierdness maybe?) + + +Date: 23 FEB 1981 1138-EST +From: SLH at MIT-AI (Stephen L. Hain) +To: (BUG ITS) at MIT-AI + +Apparently a disk error has trashed my mail file, on ty's directory +Laurel + +RWK@MIT-MC 02/19/81 13:11:04 +To: CSTACY at MIT-MC +CC: (BUG ITS) at MIT-MC +The IMP seems to be having troubles. + + +Date: 19 FEB 1981 1259-EST +From: CSTACY at MIT-AI (Christopher C. Stacy) +To: (BUG ITS) at MIT-AI + +This is really weird; I must be overlooking something simple. + +When I connect to any ITS from DCECTIP or PENTIP (which are the +only ones I tried), funny things happen to my connection. +These funny things are consistant, and do not happen when I +use this same terminal/modem (300bd,btw) on non-net systems, +or on a Unix I tried which is on the net. These funny things +also do not happen on an AI Dialup. + +The funny things: the system pases in the middle of the SSTATUS +and hangs for a few secs, sometimes I have to control-G out to +pword toplevel. + +Various characters are received and echoed wrong. When I first +saw this I thought that my terminal or modem was dropping bits, +but it is now clear that the problem only occurs connecting to +an ITS over a TIP. To wit, +s := ^S +n := ^N but N:=N +a := ^A +space := nothing? (sounds like its xmitting it, but no echo) +atsign := same as space + + +I cant imagine whats wrong. Help? + +Thanks, +Chris + +Date: 16 FEB 1981 1924-EST +From: EB at MIT-AI (Edward Barton) +Subject: ai paper tape punch +To: (BUG ITS) at MIT-AI +CC: CENT at MIT-AI + + MSG: DEAD PUNCH + the ai papertape punch, hasn't + worked in years and has miniscule to disappearing chance of + ever being repaired. +If the punch is really permanently losing, OPENs on PTP: should be made +to fail with some appropriate error code. + +Date: 14 FEB 1981 2128-EST +From: RWK at MIT-AI (Robert W. Kerns) +Subject: File clobberage +To: (BUG MAIL) at MIT-AI +CC: (BUG ITS) at MIT-AI + +Page 0 of AI:.MAIL.;^Q ^Q LIST ^Q QUEUE was bashed with random +mail (what looked like a random mail file). I renamed the +file .MAIL.; LIST CLOBRD, and copied the old set of (MSGS REMIND +MASTER) to .SAVE *, and did a MAKQFI. It seems to be working +OK now. + +ED@MIT-ML 02/12/81 04:09:36 Re: Index to History +To: (BUG ITS) at MIT-ML +Those of you who want to experience the old days might wish to run +ML:SYS;TS MONIT, which for some reason does not have symbols nor the +correct start address (1300). It is pretty badly broken, but great fun +to play with nevertheless. Too bad we don't have any working +microtapes to really hack it with. + +Date: 12 FEB 1981 0235-EST +From: MOON5 at MIT-AI (David A. Moon) +To: (BUG ITS) at MIT-AI + +I would kind of like to know why single pages of the inquir data base +have been clobbered to what looks like pages out of other files three times in +the last two days, on AI. I don't think anyone maps it in read-write, so +it's hard to see how to blame it on Howard's memory. Anyone have any ideas? +Anyone observe any other file clobbering problems? + +Date: 8 FEB 1981 2226-EST +From: MOON at MIT-AI (David A. Moon) +To: (BUG ITS) at MIT-AI + +I tried to take AI down using the DOWN/KILL command in LOCK so that I could +bring back a fixed disk. The command fails to do anything, it just gives an _ prompt. + +Date: 8 February 1981 09:26-EST +From: Robert W. Kerns +To: KMP at MIT-MC +cc: BUG-ITS at MIT-MC + + KMP@MIT-MC 02/07/81 05:20:27 + To: (BUG ITS) at MIT-MC + MC has been randomly resetting its arpa connections this evening. I don't + know why. I didn't notice anyone running LOCK. I guess it does it on its + own sometimes. Usually the net goes off, on, off then there's a bit of a + gap (as much as a minute or two) and then back on again... + + +There was a system message a while back informing everyone that the TIP and +IMP were being moved. Perhaps this is what was doing it? + + +Date: 8 FEB 1981 0352-EST +From: MP at MIT-AI (Mark A. Plotnick) +Subject: long leaders +To: (BUG ITS) at MIT-AI + +I just tried to get onto ML from a TIP. It wouldn't connect +me, saying that the Host didn't support extended leaders. +Is this something new? I thought extended leaders were required +since Jan. 1. + +Date: 7 FEB 1981 1227-EST +From: JONL at MIT-AI (Jon L White) +Subject: Crunch on AI:SYS;, part II +To: (BUG ITS) at MIT-AI + +ITSDFS 4 ==> SYSENG; +SAIDFS 17 ==> SYSENG' +Both are "old" files. current versions still on SYS; + +Date: 7 FEB 1981 1224-EST +From: JONL at MIT-AI (Jon L White) +Subject: Directory space crunch on AI:SYS; +To: (BUG ITS) at MIT-AI, RWK at MIT-MC + +I moved ATSIGN ODEVIC and ATSIGN OHACTR to SYSBIN;, since +one hadn't been referenced in over 2 years, and the other +in almost a year. + +KMP@MIT-MC 02/07/81 05:20:27 +To: (BUG ITS) at MIT-MC +MC has been randomly resetting its arpa connections this evening. I don't +know why. I didn't notice anyone running LOCK. I guess it does it on its +own sometimes. Usually the net goes off, on, off then there's a bit of a +gap (as much as a minute or two) and then back on again... + + +Date: 7 February 1981 05:05-EST +From: Charles Frankston +Subject: confused about char ins/del +To: BUG-ITS at MIT-MC +cc: HAL at MIT-MC, C100-FANS at MIT-MC, Craig Everhart at CMU-10A + + Date: 7 February 1981 00:52-EST + From: Earl A. Killian + + The C100 would probably work fairly well on ITS without using + CRTSTY, just as it does on XX. This is to say that while it is + completely trivial to construct legitimate sequences of requests + to the virtual terminal support that will lose, those sequences + don't tend to come up while editing in EMACS. With CRTSTY, + however, it is extremely common for CRTSTY to produce such + sequences as the result of other unrelated optimizations that it + is doing. As a result CRTSTY definitely cannot use insert/delete + character unless your terminal supports the set blank + characteristics and set insert mode commands. On ITS it's not so + clear, but I think having the default be off is still the right + thing; users with the proper microcode or bravery can always try + :TCTYP +%TOCID (I hope this works). + +:TCTYP +%TOCID does not work, in the sense that ITS has no entries for +char ins/del on a C100 whether on by default or not. I was going to +put entries in, but unfortunately, the C100 uses Escape-Null to exit +insert mode. I can't put the null in an ASCIZ string which is what +the table entries consist of, and I don't know TS3TTY well enough +to figure out a good kludge.. + + +Date: 7 FEB 1981 0435-EST +From: CBF at MIT-MC (Charles Frankston) +Subject: TS3TTY terminal padding +To: (BUG ITS) at MIT-MC, (BUG TERMINALS) at MIT-MC + +Remember the feature to vary a terminal's line insert/delete padding in +proportion to the number of lines left to be moved on the screen? Anyway, +it was never exercised in any terminal defintions. EAK and I tried +patching the entry for a C100 with PADCR=1 on ML and found it seems to +work fine. However, when calculating the values for a 1200 baud C100 or +for a Teleray 1061, we find that they would really want to be 1.7 and 2.5 +milliseconds respectively. Rounding 2.5 ms up to 3 ms makes a difference +of 12 ms (* 10 lines moved can get annoying). Therefore in the fine +tradition of TS3TTY kludges, if the table entry is negative (which used to +mean the value given is milliseconds per line to be moved), then it is the +number of 1/8 milliseconds per line to be moved. + +This is MC:SYSTEM;TS3TTY 271, I have updated the terminal entries for the +C100 and Teleray. Good luck to the next ITS debugger, why am I so +verbose? + + +HIC@MIT-MC 02/04/81 17:55:35 +To: (BUG ITS) at MIT-MC +Oh well, I was confused...iot looks like some subtle off by a few error when the MMP +almost gets full. + + +HIC@MIT-MC 02/04/81 17:52:07 +To: (BUG ITS) at MIT-MC +MC just tried to make an extra MMP page (one more than allowed). MEMFR was 7. +Is someone forgetting to decrement this guy? + + +Date: 4 February 1981 05:01-EST +From: Robert W. Kerns +To: ED at MIT-AI +cc: GNU at MIT-AI, BUG-ITS at MIT-AI + + Date: 2 February 1981 21:59-EST + From: Ed Schwalenberg + To: GNU at MIT-AI + cc: BUG-ITS at MIT-AI + + What is the effect of linking to a free STY (i.e. Finger shows it as + "STY not in use")? I saw someone doing it earlier tonight and wondered. + It depends on the state of the STY. If you just link to an unused sty, + you get a ?, since the tty you want to link to does not exist. What + must have happened is that the sty became unused after the link existed, + as for instance if someone logs out from a sty and you link to him just + before or after the logout (but before the net connection is closed. + I believe that the system doesn't really do anything with stys whose + only activity is a link, and they will vanish, breaking the link. +Actually, this isn't right at all. You can link to a free sty, and +slave it, etc. The fact that you have done so is recorded. It doesn't +work very well, tho, since there isn't anybody on the other end of the +STY to gobble up it's output, so it quicly fills up it's output buffer +and can't print anything more. FINGER's 'Sty not in use' merely means +that it is unowned. + + +Date: 3 FEB 1981 0302-EST +From: CENT at MIT-AI (Pandora B. Berman) +Subject: bitten again +To: (BUG MAIL) at MIT-AI, (BUG ITS) at MIT-AI + +comsat decided to take another walk over my mail file. today i logged in +and typed :rmail, and found myself looking at a message sent to alan and +bee. neither of whom i am. this was somewhat disconcerting, so i quit out +of the rmail and poked around a bit. by now the rmail had obligingly +copied the contents of my mail file into my rmail file and had deleted the +mail file, so there was no way of finding out information about it. i have +copied the entire bunch of new mail (everything before the first message +that i know i have seen in rmail before; i use r-option append and gmsgs +so the break was pretty clearly after the newest system msg) to the file +ai:vsdb;foo2 mail. i also looked at this stuff: i am sure that the first +seven msgs are not for me, and that the eighth (which starts with gubbish +and turns into a news digest) probably is. evidence of when i was last seen +by the system is a file i wrote the last time i was logged in (i know i +read my mail that time); the file was written at 03:38 on 2/1, and i logged +out within a few hours of that. the time of the first msg that is probably +mine AND has a readable time is 13:35 on 2/1. this is the ninth msg in +foo2 mail; the eighth msg (the news digest with gubbish at the front) does +not have a readable time. the news digest canonically comes out at 10:00 +PST which means 13:00 EST, but the ostats file has been written to disk 15 +(third:) which is currently unaccesssible due to dead disk drive, so i +can't tell exactly when it came out on sunday or what msgs i got earlier +that morning. however, given the several hours between these times, i think +that comsat (or something) walked over the first several msgs sent to me +sunday morning and replaced them with the random stuff that is now the +first seven msgs in foo2 mail. +dave moon says that since i logged out sunday morning ai has had problems +(disk drive losing causing locked blocks all over, and hic's memory losing +in some way (he wasn't sure of the details when he mentioned this) causing +programs to act in very random ways) either of which could have caused +the lossage i experienced here. +i guess i will have to wait until the third: pack comes back online before +i can see what i missed; i may not be able to get the stuff i lost back +because of the time delay here. + +Date: 2 February 1981 21:59-EST +From: Ed Schwalenberg +To: GNU at MIT-AI +cc: BUG-ITS at MIT-AI + + What is the effect of linking to a free STY (i.e. Finger shows it as + "STY not in use")? I saw someone doing it earlier tonight and wondered. +It depends on the state of the STY. If you just link to an unused sty, +you get a ?, since the tty you want to link to does not exist. What +must have happened is that the sty became unused after the link existed, +as for instance if someone logs out from a sty and you link to him just +before or after the logout (but before the net connection is closed. +I believe that the system doesn't really do anything with stys whose +only activity is a link, and they will vanish, breaking the link. + +Date: 2 FEB 1981 0401-EST +From: GNU at MIT-AI (John C. Gilmore) +To: (BUG ITS) at MIT-AI + +What is the effect of linking to a free STY (i.e. Finger shows it as +"STY not in use")? I saw someone doing it earlier tonight and wondered. + +Date: 29 January 1981 18:44-EST +From: Earl A. Killian +Subject: Page ahead +To: Guy.Steele at CMU-10A +cc: BUG-its at MIT-AI, klh at MIT-AI + +Actually the documentation only existed on AI, not on the other +machines. I've installed it elsewhere. + + +Date: 29 January 1981 1658-EST (Thursday) +From: Guy.Steele at CMU-10A +To: klh at MIT-AI +Subject: Page ahead +CC: bug-its at MIT-AI +Message-Id: <29Jan81 165842 GS70@CMU-10A> + +I did some detective work. Get onto an ITS and try + :DOC USET PAGRAN +and :DOC USET PAGAHD + +Date: 29 JAN 1981 1612-EST +From: KLH at MIT-AI (Ken Harrenstien) +Subject: page ahead +To: (BUG ITS) at MIT-AI + +Did I miss something? I have no idea what people are talking +about with respect to "page ahead". Is that something like +disk file read-ahead in that if you reference a page, the next +sequential page is also swapped in? + +Date: 29 January 1981 02:43-EST +From: Earl A. Killian +To: RMS at MIT-AI +cc: BUG-ITS at MIT-AI + +When you first started hacking page ahead code in TECO/ITS I did +a quick calculation that showed that it would be a noticable +improvement on AI, but not so noticable on MC, because MC can +search a page faster. I was moderately surprized at that result. +Anyway, glad to hear it really wins. Of course, HIC's new memory +may help a lot too... + + +Date: 28 JAN 1981 2159-EST +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI + +Page ahead is a big improvement! +On a lightely loaded system, moving the gap in TECO +is about twice as fast. +When there gets to be more load, it slows down, but the +TECO, which was 165k with one 100k file, never even had +50 pages in at any time during moving the buffer from one +end to the other. + +Date: 28 JAN 1981 0634-EST +From: RMS at MIT-AI (Richard M. Stallman) +To: SPC at MIT-AI, CENT at MIT-AI, RWK at MIT-MC +CC: (BUG ITS) at MIT-AI + +When SPC told me he was working on a :S program, +I told him that there was already a :S. +But then I looked for it and didn't find any. +So I figured that the link had got lost somehow +and nobody had missed it, so I told SPC it was ok +to put in a new one. + +I don't know when or how the old :S went away. +CENT, do you remember when you last used it? +I used to use it but got out of the habit a long time ago. + +Date: 28 January 1981 05:49-EST +From: Robert W. Kerns +To: SPC at MIT-MC, CENT at MIT-AI +cc: RMS at MIT-AI, BUG-ITS at MIT-AI, BUG-DDT at MIT-AI + + Date: 27 January 1981 23:24-EST + From: Pandora B. Berman + To: RMS at MIT-AI + cc: BUG-ITS at MIT-AI, BUG-DDT at MIT-AI + + what did you do to :s? when i tried to use it to send a msg to + more than one person (using :s because :send only takes one + recipient) it kept saying No message? :KILL + + This is most frustrating; a standard thing like this should not + change so suddenly/incompatibly/without warning so that when a + user expects it to act as it always has, it breaks incomprehensibly + instead. please explain and fix. + +This was not RMS, this was SPC. I have deleted the offending program +and restored the link to QSEND. *** SPC DO NOT DO THIS! ***. Replacing +public programs with your own version is not at all polite. If this +happened because you did not look before you put it on SYS3;, you should +be aware that you *MUST* check for the name being in use on any of +SYS, SYS1, SYS2, and SYS3. Please excersize more restraint and caution +in the future. + + +Date: 27 JAN 1981 2324-EST +From: CENT at MIT-AI (Pandora B. Berman) +To: RMS at MIT-AI +CC: (BUG ITS) at MIT-AI, (BUG DDT) at MIT-AI + +what did you do to :s? when i tried to use it to send a msg to more than one +person (using :s because :send only takes one recipient) it kept saying +No message? :KILL +this is most frustrating; a standard thing like this should not change so +suddenly/incompatibly/without warning so that when a user expects it to act +as it always has, it breaks incomprehensibly instead. please explain and fix. + +Date: 27 JAN 1981 2020-EST +From: EB at MIT-AI (Edward Barton) +Subject: SAUTH bug +To: INFO-MLDEV at MIT-AI +CC: EB at MIT-AI + +I have been playing around with MLDEV for a while, trying to figure +out why it so often hangs up while the DDT :COPY command is trying to +do a SAUTH call. If anyone thinks the following fix is wrong, please +explain and delete it. If anyone knowledgeable thinks it is right, +please assemble and install it. It seems not to hang, and to +otherwise work, in my tests. + +AI SYSENG +FREE BLOCKS #1=91 #2=53 #14=116 #4=78 #5=101 #13=355 #15=298 #3=95 + 2 MLDEV 61 6 +919 6/09/80 03:28:23 (1/12/81) RMS + 5 MLDEV 62 7 +86 1/12/81 19:41:51 (1/22/81) USERS1 + 4 MLDEV 63 7 +139 1/22/81 00:51:45 (1/27/81) MOON + 4 MLDEV 64 7 +143 ! 1/27/81 20:08:40 (1/27/81) EB + +;COMPARISON OF DSK:SYSENG;MLDEV 63 AND DSK:SYSENG;MLDEV 64 +;OPTIONS ARE /3 + +**** FILE DSK:SYSENG;MLDEV 63, 17-39 (30351) + SKIPE CALING ;AND IF USER IS STILL WAITING FOR RETURN FROM SYSTEM CALL + SOSLE CALACK ;AND THIS REPLY IS TO HIS CURRENT ATTEMPT, NOT A PREVIOUS, + JRST GOLOOP +**** FILE DSK:SYSENG;MLDEV 64, 17-39 (30351) + SOSG CALACK ; NOTE THE ACKNOWLEDGE AND SKIP IF NOT CURRENT YET + SKIPN CALING ; CURRENT; SKIP IF USER IS WAITING + JRST GOLOOP ; NOT CURRENT YET, KEEP WAITING; OR DON'T WANT IT +*************** + + +GJC@MIT-MC 01/26/81 00:13:28 +To: (BUG ITS) at MIT-MC +Does anybody know about this ARGUS frob, SYS2;TS ARGUS on MC? +Seems innocent enough, but it takes up incredible amounts +of resources for a trivial program, was getting like +33% to 44% of MC for quite some time before I killed it. +Sounds kind of buggy. I noticed it because it was being +run by a lot of turists, that kind of thing usually is. + + + +Date: 24 JAN 1981 1507-EST +From: abrax at MIT-AI (Jeff Shrager) +Sent-by: ___035 at MIT-AI +Subject: Rubout to first char fails in DDT mode +To: (BUG ITS) at MIT-AI + +If you forget the ":" to issue a real command and use rubout to get +back to the beginning of the line and insert it, ITS forgets that +there is a ":". Looks like someone's crufty code looks for the ":" +ONLY on entry of the first character rather than at the beginning +of the line entered after all of it comes in. + +KMP@MIT-MC 01/21/81 23:55:20 +To: (BUG ITS) at MIT-MC +The system just hung for about a minute or so without accessing the disk. +Now I did a peek about 5 seconds after it started letting me get to disk +and there were only about 13 disk channels taken. Unless a lot were closed +in a very short time, I wonder if the problem is really disk channels all +used up or something else... + + +Date: 20 January 1981 16:31-EST +From: George J. Carrette +To: MOON at MIT-MC +cc: BUG-ITS at MIT-MC, JM at MIT-MC, JPG at MIT-MC + +I know you need specific info about the state the running jobs where +in. What I'll do is set up some example runs, and make sure the +behavior is repeatable, and catch you sometime system conditions +are right for a demo. + +-gjc + + +MOON@MIT-MC 01/20/81 15:48:24 Re: Terminal in 812 +To: jerryb at MIT-AI +CC: (BUG ITS) at MIT-AI, beppe at MIT-AI + Date: 19 JAN 1981 1514-EST + From: jerryb at MIT-AI (Gerald R. Barber) + Sent-by: BEPPE at MIT-AI + To: (BUG ITS) at MIT-AI + + ITS doesn't seem to be listening to the terminal in 812. + The AI ITS nnnn CONSOLE 36 ... message is coming through + alright but the system doesn't respond to ^Z. +The system believes that Teleray has a meta key. Evidently the parity +control switches in the back are not set correctly, such that +c-Z sends c-m-Z. You want 8-bit characters, no parity, 1 stop bit. + +MOON@MIT-MC 01/20/81 15:26:48 +To: JPG at MIT-MC +CC: (BUG ITS) at MIT-MC, GJC at MIT-MC, JM at MIT-MC + JPG@MIT-MC 01/20/81 07:36:49 + To: (BUG ITS) at MIT-MC + CC: GJC at MIT-MC, JM at MIT-MC + Forwarded for GJC: + GJC@MIT-MC 01/19/81 20:09:53 + To: JPG at MIT-MC, JM at MIT-MC + foo, its worse now than ever. BALCH's two dissowned macsyma + jobs are still running hours later, its 8:00pm, and + the fair-share is 3%. But, somehow his jobs get + a total of 60% share, plus all the physical memory they + need, almost a Moby unshared. How come these CPU-intensive + memory-intensive dissowned jobs don't get swapped out? + It should be something like active-for 1 minute, inactive for + 4 minutes. +Were these jobs running in a system call or in user mode? Were they +taking page faults? Were they getting some sort of interrupts such as +pdl overflow? Were you able to reown them and stop them with the +DDT control-X command? Without some specific information there is +nothing I can do. + +JPG@MIT-MC 01/20/81 07:36:49 +To: (BUG ITS) at MIT-MC +CC: GJC at MIT-MC, JM at MIT-MC +Forwarded for GJC: + GJC@MIT-MC 01/19/81 20:09:53 + To: JPG at MIT-MC, JM at MIT-MC + foo, its worse now than ever. BALCH's two dissowned macsyma + jobs are still running hours later, its 8:00pm, and + the fair-share is 3%. But, somehow his jobs get + a total of 60% share, plus all the physical memory they + need, almost a Moby unshared. How come these CPU-intensive + memory-intensive dissowned jobs don't get swapped out? + It should be something like active-for 1 minute, inactive for + 4 minutes. + + +Date: 19 JAN 1981 1514-EST +From: jerryb at MIT-AI (Gerald R. Barber) +Sent-by: BEPPE at MIT-AI +To: (BUG ITS) at MIT-AI + +ITS doesn't seem to be listening to the terminal in 812. +The AI ITS nnnn CONSOLE 36 ... message is coming through +alright but the system doesn't respond to ^Z. + +Date: 19 JAN 1981 0249-EST +From: MOON at MIT-AI (David A. Moon) +To: (BUG ITS) at MIT-AI + +CHANNA;RAKASH DMNSTR does not work in the new ITS, +I think because it tries to slave from a not logged in sty + +Date: 18 January 1981 2332-EST (Sunday) +From: Guy.Steele at CMU-10A +To: gnu at MIT-ML (Sent by ___022@MIT-ML) +Subject: Transcribing COM links +CC: bug-its at MIT-ML +In-Reply-To: gnu@MIT-ML's message of 18 Jan 81 02:53-EST +Message-Id: <18Jan81 233212 GS70@CMU-10A> + +Presumably one could write a cross between FIDO and the SPY feature of LOCK +as follows: have a program that runs as a demon (so it wakes up when +the system is brought up). Once every couple of seconds it wakes up +and scans the system TTY tables for COM links much as PEEK might. +(Or JEDGAR -- this hack involves bits of sixteen other programs!) +When one is found, then it uses the SPY device to gobble the +characters and appenbd them to a file. If you're hairy enough you +can transcribe several at once. +This is not an offer to write the hack -- I have no time. I'm just outlining +the technical possibilities. I will, however, remark that there may be +a difference of kind rather than degree between random spying on other +terminals and systematic transcription of people's conversations. It +probably should not be done without at least a system message (which you +see whenever you log in) to the effect that such monitoring is in progress. +--Guy + + +FREND@MIT-ML 01/18/81 17:39:53 +To: (BUG ITS) at MIT-ML +I just logged in from the net, and before my login init was thru, +I got a message from system overseer saying I did not look like an +authorized user. there are about 8 people on now, half are tourists. +I think this is a bug because if PWORD let me in at this time, the +overseer program should not say he doesn't recognize me. Anyway, i +will leave as soon as I ^C this message + michael bloom + + +Date: 18 JAN 1981 1530-EST +From: KLH at MIT-AI (Ken Harrenstien) +Subject: Spying on com-links +To: gnu at MIT-ML +CC: (BUG ITS) at MIT-AI + +Tell your friend to ask the UC Berkeley Comp Sci dept. Their UNIX +systems have a talk program which, while a feeble imitation of ITS com +links (eg no multiple party links), is much easier to modify for +scripting, because it is a user program rather than part of the +operating system. I suspect the patterns will be different (more +sophomoric dialogue, owing to thousands of freshlings) but why not +take advantage of a home-grown resource... + + +gnu@MIT-ML (Sent by ___022@MIT-ML) 01/18/81 02:53:56 +To: (BUG ITS) at MIT-ML +CC: GNU at MIT-ML +A friend of mine would like to do a study of language pattern in com-links +as a project for her class in Spoken/Written language differences. (She +views com-links as a cross between the two.) Is there any easy way to have +ITS record com-links somewhere for a week or two? The person doing the study +is Nancy Levidow, a grad student in linguistics at UC Berkeley. (I'm assuming +there are no privacy problems with this, as any comlink could be spied upon; +just technical problems.) Easiest way to respond is via GNU@MC, since she's +not on the net. + + + +Date: 15 January 1981 0110-EST (Thursday) +From: Guy.Steele at CMU-10A +To: moon at MIT-MC +Subject: Re: system hanging on disk... +CC: eak at MIT-MC, bug-its at MIT-MC, ellen at MIT-MC, kmp at MIT-MC, + rlb at MIT-MC +In-Reply-To: Earl A. Killian's message of 14 Jan 81 21:09-EST +Message-Id: <15Jan81 011000 GS70@CMU-10A> + +Or you could dynamically allocate disk channels... installing it +would be a great new source of bugs. Hasn't been very much activity +on the BUG-ITS mailing list lately anyway... +--Q + + +Date: 14 January 1981 21:09-EST +From: Earl A. Killian +Subject: system hanging on disk... +To: MOON at MIT-MC +cc: BUG-ITS at MIT-MC, BIL at MIT-MC, ELLEN at MIT-MC, KMP at MIT-MC, + RLB at MIT-MC + +Gee, you could implement real resource management, and require +that any program that uses more than one disk channel, first say +"reserve me N channels", avoiding the deadlock. Just kidding. + + +Moon@MIT-MC 01/14/81 02:24:39 Re: system hanging on disk... +To: ELLEN at MIT-MC +CC: KMP at MIT-MC, (BUG ITS) at MIT-MC, RLB at MIT-MC, BIL at MIT-MC +CC: JONL at MIT-MC + ELLEN@MIT-MC 01/14/81 01:47:41 Re: system hanging on disk... + To: KMP at MIT-MC + CC: (BUG ITS) at MIT-MC, RLB at MIT-MC, BIL at MIT-MC, JONL at MIT-MC + CC: ELLEN at MIT-MC + I just happened to have a peek today when one of those hangs happened... + and by gosh and by golly, there were two full VT52 screens plus a few lines + of disk channels in use from a C in peek. I dunno... lots of TeX's and various + INQUIRS (nasty Ellen here noting that some of the INQUIR channels were from + unlogged lines doing WHOIS or NAME...). Anyway, it probably was running out + of disk channels. How many are there? + +Yes, exhausting the supply of disk channels is the usual cause of this. +There are a fairly humongous number I believe. Maybe I should see if ITS +can be made to do something useful in this case. (It used to return errors +instead of hanging, but someone decided it would be better to hang.) Maybe +I can make it return an error after a while, which might encourage killing +of jobs. TEX is a gross offender in this respect (so are PUB and COMPLR) +in that they open many channels, making a deadlock more likely. + +ELLEN@MIT-MC 01/14/81 01:47:41 Re: system hanging on disk... +To: KMP at MIT-MC +CC: (BUG ITS) at MIT-MC, RLB at MIT-MC, BIL at MIT-MC, JONL at MIT-MC +CC: ELLEN at MIT-MC +I just happened to have a peek today when one of those hangs happened... +and by gosh and by golly, there were two full VT52 screens plus a few lines +of disk channels in use from a C in peek. I dunno... lots of TeX's and various +INQUIRS (nasty Ellen here noting that some of the INQUIR channels were from +unlogged lines doing WHOIS or NAME...). Anyway, it probably was running out +of disk channels. How many are there? + + +KMP@MIT-MC 01/13/81 00:17:15 +To: (BUG ITS) at MIT-MC +CC: KMP at MIT-MC, RLB at MIT-MC, BIL at MIT-MC, JONL at MIT-MC +CC: ELLEN at MIT-MC +There has been a very high incidence rate of jobs hanging for a long time +(rlb: `several tens of seconds') waiting to do i/o to the disk. Is it possible +that this is due to an ITS bug or is it more likely to be people using up all +the disk channels/buffers/?? If it's possible that it's the former, could +someone look into it? It's extremely irritating and has almost caused us to +reload the system unnecessarily a couple times because disk i/o was unavailable +for so long (one or two times ITS just started working again just as we were +about to reload it; these were several-minute pauses) ... +-kmp + + +Date: 12 Jan 1981 2042-EST +From: EBM at MIT-XX +Subject: Slight protocol change, and new MLDEV/MLSLV installed +To: info-mldev at MIT-AI + +The MLSLV protocol has been upgraded in response to some catastrophes +that occurred on DM about 6 weeks ago. Specifically, a number of files +on SYS directories were deleted using MLSLV, and because of the way the +protocol is constructed, there was no way to track down the culprit, +even thought the usual console message were written. + +MLSLV has been extended by the addition of a LOGIN command and reply +code. Logging in is REQUIRED only for deletion of files, but for +simplicity and friendliness, MLDEV starts a login (but does not wait for +the response) almost immediately. This should not particularly slow +down the protocol. + +Instead of logging in as hhhJuu (host and user) MLSLV, it now logs in as +XUNAME (of the foreign user) MLSLV, with a "terminal name" of hhhJuu. +It should still be easy to match up jobs, connections, etc., via PEEK, +and much easier to identify who is doing what. + +If it is deemed necessary to de-install the new MLSLV and MLDEV, it was +installed using links: + On each site, SYS;ATSIGN MLDEV is a link to SYS;ATSIGN NMLDEV, + and SYS;ATSIGN OMLDEV is the old MLDEV. + + MLSLV is organized the same way, but lives in DEVICE; +Bugs can be sent to me. + +Although this change is slightly incompatible, it should not prove to be +a real problem for users, or for upgrading of other programs using the +protocol. + +------- + +Date: 12 January 1981 1412-EST (Monday) +From: Guy.Steele at CMU-10A +To: bug-its at MIT-MC +Subject: File name > > +CC: kmp at MIT-MC +In-Reply-To: KMP@MIT-MC's message of 11 Jan 81 23:09-EST +Message-Id: <12Jan81 141206 GS70@CMU-10A> + +Actually, I thought you weresupposed to get some kind of open +error message like "bad file name" if both FN1 and FN2 were one +of > or <. + + +KMP@MIT-MC 01/11/81 23:09:58 +To: (BUG ITS) at MIT-MC, (BUG DDT) at MIT-MC +:COPY TTY:,DSK:KMP;> > +Hi.^M^J^C + +created a file called _COPY_ OUTPUT on my dir with `hi' in it ... While this +*is* the greatest file of the last type in my dir, I should think there are +more aesthetic filenames it could have chosen. + + +BARRYG@MIT-MC 01/09/81 20:26:19 Re: strange interaction between RMAIL and TCTYP GLASS +To: (BUG RMAIL) at MIT-MC +CC: (BUG ITS) at MIT-MC +I normally run under TCTYP GLASS SCRL 22 (See MC: GUEST0; BARRYG LOGIN) +and most programs (INFO, PRINT, MSGS, MAIL) that I use get along well with +that. When using RMAIL, however, when the screen fills I get **MORE** +(instead of --MORE-- as with other programs). No matter WHAT character is then +typed, RMAIL prints out the rest of the message (again printing out **MORE** +approximately every screenful but not pausing for input). + +I haven't tested this in EMACS, so I can't tell if the problem is general with +EMACS or specific to ^R RMAIL. If you need help with this, I'll try a few +things under EMACS to try isolating it. + +This is a minor bug (so far), but since we tourists are supposedly here +for the purpose of testing programs, I present this bug for your delectation. + + barry gold + +Date: 8 Jan 1981 1305-EST +From: PDL at MIT-DMS (P. David Lebling) +To: BERN at MIT-ML +Cc: (BUG ITS) at MIT-ML +In-reply-to: Message of 08 Jan 81 at 1211 EST by BERN@MIT-ML +Message-id: <[MIT-DMS].178600> + +The author is stored as the directory number, which is why you see +USERS1. Unfortunately, there isn't room in the directory entry for +the full name. + + + + +BERN@MIT-ML 01/08/81 12:11:18 +To: (BUG ITS) at MIT-ML +Now that passwords are implemented on most machines, it is more +appropriate when a file is created, written, or linked, that the +author be the uname rather than the sname (or whatever it currently +is). It is hard to find out who wrote in a file when the author +name is USERS1 for example. + +BARRYG@MIT-MC 12/23/80 21:12:57 +To: (BUG ITS) at MIT-MC +I would appreciate it if someone would, at your leisure, restore +MC:GUEST0;BARRYG XMAIL from whatever backups are maintained. + /barry + +Date: 22 December 1980 11:55-EST +From: Robert W. Kerns +To: KMP at MIT-MC +cc: BUG-ITS at MIT-MC, ELLEN at MIT-MC, MLK at MIT-MC, + USER-ACCOUNTS at MIT-MC, USER-ACCOUNTS at MIT-AI + + Date: 22 December 1980 00:00-EST + From: Kent M. Pitman + To: RWK at MIT-MC, BUG-ITS at MIT-MC, USER-ACCOUNTS at MIT-MC + cc: MLK at MIT-MC, ELLEN at MIT-MC + + Date: 21 December 1980 09:17-EST + From: Michael L. Kazar + To: USER-ACCOUNTS + + Some twerp just enslaved my terminal and $$U'ed me off. It was from + a vadic dialup no less! May I suggest that maybe PWORD should + not allow enslaves but only links. ?? + ----- + Would it be hard to set things up so that ^_E was disallowed from PWORD? + Unlogged DDTs could also do it if it's easier to check uname than jname. + Anyway, some unlogged random slaved a Macsyma user and lost him a lot of + work the other day and he was quite upset. + + If this can't be done, I recommend that for the safety of our paying users, + initiating links from unlogged pwords should be made impossible. This is, + however, a more extreme measure than I would like to take if we can help + it, though. + + Thanks. -kmp + +This has also happened several times recently on ML, and ML's PWORD is +currently patched to disallow initiating links. But better than this would be +to have ^_E not work on a not-logged-in dialup or STY (leaving local TTY's +alone). This is a simple change to ITS, and minimizes the restrictions imposed +to achieve the goal. If there are no objections I'm willing to do the +(trivial) work. + + +Date: 22 December 1980 00:00-EST +From: Kent M. Pitman +To: RWK at MIT-MC, BUG-ITS at MIT-MC, USER-ACCOUNTS at MIT-MC +cc: MLK at MIT-MC, ELLEN at MIT-MC + + Date: 21 December 1980 09:17-EST + From: Michael L. Kazar + To: USER-ACCOUNTS + + Some twerp just enslaved my terminal and $$U'ed me off. It was from + a vadic dialup no less! May I suggest that maybe PWORD should + not allow enslaves but only links. ?? +----- +Would it be hard to set things up so that ^_E was disallowed from PWORD? +Unlogged DDTs could also do it if it's easier to check uname than jname. +Anyway, some unlogged random slaved a Macsyma user and lost him a lot of +work the other day and he was quite upset. + +If this can't be done, I recommend that for the safety of our paying users, +initiating links from unlogged pwords should be made impossible. This is, +however, a more extreme measure than I would like to take if we can help +it, though. + +Thanks. -kmp + + +GJC@MIT-MC 12/19/80 02:21:05 +To: (BUG ITS) at MIT-MC +CC: ELLEN at MIT-MC +I'm not sure exactly who to complain to on this, +I've complained about the bugginess of H19WHO many times +before. Anyway, there is a DSN's tree with a running +H19WHO on it now on MC which has used up 2 hours of CPU time. +I've just :ujob jmsk hactro and :snarfed the job, and it +significantly improves the fair share. + +This problem comes up very often when a user with an +h19who gets detached. As soon as I reowned the tree +the h19who typed out on my tty and stopped burning up cpu time. +When ^X'd it was doing a .HANG +...now, how is it that you save jobs for examination?? + + +Date: 19 December 1980 01:06-EST +From: Frank J. Wancho +Subject: Access to AI via DARCOM PTIP +To: BUG-ITS at MIT-AI +cc: FJW at MIT-MC, ELLEN at MIT-MC + +Attempts to connect to AI from the DARCOM-PTIP are met with "ITS being +Debugged" when, in fact, it is not. I understand that the same +message is sent when attempting to connect from other TIPs in the D.C. +area. If you are trying to block randoms and are having trouble +specifically with DARCOM-PTIP users, I would like to have the details +so corrective action can be taken and the block can be removed. If +not, then please remove the block. + +Thanks, +Frank + + +Moon@MIT-MC (Sent by Moon at CADR16@MIT-MC) 12/16/80 22:35:23 +To: CWH at MIT-MC +CC: (BUG ITS) at MIT-MC + CWH@MIT-MC 12/16/80 19:57:53 + To: (BUG ITS) at MIT-MC + If the userid contains a numeric digit as a character in the middle of the + name, only the alphabetic characters preceding the digit are looked at when + setting the file author. For instance, if a file is created by uname + K7X, the file author is shown to be K. +This sounds unlikely. File authors are stored as the disk address of the +user's home directory. No name parsing is involved. (The reason they are stored +this peculiar way is because whoever put them in couldn't find enough bits to +store a sixbit name.) + +CWH@MIT-MC 12/16/80 19:57:53 +To: (BUG ITS) at MIT-MC +If the userid contains a numeric digit as a character in the middle of the +name, only the alphabetic characters preceding the digit are looked at when +setting the file author. For instance, if a file is created by uname +K7X, the file author is shown to be K. + + +GJC@MIT-MC 12/12/80 19:53:21 +To: (BUG ITS) at MIT-MC +MC appears to be crashing somewhat harder +than I've ever seen an ITS system do. +I have had files written out, e.g. GJC;FOO 1 +a few minutes ago, and even compiled, +so I *know* is was there, and then +MC crashes, and when I get back 5 minutes +later the file is *gone*. + +ouch. + + + +Date: 11 DEC 1980 1935-EST +From: JLK at MIT-AI (John L. Kulp) +To: (BUG ITS) at MIT-AI + +MLDEV SEEMS TO BE TRUNCATING FILES. I JUST DID :COPY ON MC OF +MC:DATDRW;WL BIN TO AI: +AND THE FILE ON AI WAS NICELY ROUNDED OFF TO EXACTLY 72 BLOCKS +(THE ACTUAL FILE IS 72 AND 709 WORDS). + +RWK@MIT-MC 12/08/80 19:44:05 Re: CORBLK: NO CORE AVAILABLE +To: RAM at MIT-MC +CC: (BUG ITS) at MIT-MC +That means there is no more virtual memory left in the system. I.e. there +are too many people using the system to get anything done. The best thing +to do is to go away for a while. Baring that, you can always just $P it again. +When there is enough core, it will continue where it was. It may take a while, +the easiest way to get some core freed up is to log out. There's lots of other +people trying to get to any newly freed core before you. + + +RAM@MIT-MC 12/08/80 18:47:05 +To: (BUG ITS) at MIT-MC +running nbabyl i got: + +ERROR CORBLK: NO CORE AVAILABLE +15243>>.CALL 37607 (CORBLK) + + +Date: 6 December 1980 21:41-EST +From: Robert W. Kerns +Subject: File Authors +To: JONL at MIT-MC +cc: BUG-DDT at MIT-MC, BUG-ITS at MIT-MC, BUG-EMACS at MIT-MC + + Date: 6 DEC 1980 0616-EST + From: JONL at MIT-MC (Jon L White) + To: (BUG ITS) at MIT-MC + cc: RWK at MIT-MC, (BUG DDT) at MIT-MC + Re: File Authors + + :MOVE , + fails to preserve the file's author field. +Not true! You're being confused by EMACS's DIRED, which displays the bug. + +JONL@MIT-MC 12/06/80 06:16:49 Re: File Authors +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC, (BUG DDT) at MIT-MC +:MOVE , +fails to preserve the file's author field. + + +REM@MIT-AI (Sent by ___010@MIT-AI) 12/04/80 20:16:16 +To: (BUG ITS) at MIT-MC +Gee, MC hasn't been very reliable lately, crashed again now... + + + +Date: 26 NOV 1980 1255-EST +From: CL at MIT-MC (Charles C. Linton) +Sent-by: CL0 at MIT-MC +Subject: T36 +To: (BUG ITS) at MIT-MC +CC: LPH at MIT-MC, (BUG R11) at MIT-MC + +The default TCTYP for T36 appears to have changed to a software +imlac. (SIMLAC) It should be set for a standard telaray (T1061) +at 9600 baud. Also, when I attempted to set it back to teleray +from another console, the TCTYP program apparently wedged. i.e. +it never returned. After killing the TCTYP program and examining +the bits I found that %tpcbs was set. I cleared it using +the :tctyp program. Then I again tried :tctyp t1061 and everything +worked fine. + + + +Date: 17 NOV 1980 1331-EST +From: RICH at MIT-AI (Charles Rich) +To: (BUG ITS) at MIT-AI + +How about allocating the CRASH; directory to SECOND: or THIRD:. + +Date: 13 Nov 1980 1234-EST +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-ITS at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].168838> + +Lately DM has been getting a lot of parity errors that do not cause +the system to stop even though parity stop is on. It prints: + +PARITY ERROR #N PC=FOO,,BAR HH:MM:SS + +DM ITS Revived! hh:mm:ss + +The parity stop switch is, of course, on. These errors don't seem +to get stuffed in the PARADR buffer or get an IOR/AOR printed out, +or anything. Is this supposed to be a feature? Or is it a bug, or +is our parity stop switch not working? + Dave + + + +Date: 12 NOV 1980 0238-EST +From: ECC at MIT-AI (Eugene C. Ciccarelli) +Subject: T15 modem +To: (BUG ITS) at MIT-AI + +For several days now, I have not been able to use the 258-6700 +at all, but have been able to use 258-6701. Though I can +connect to it ok, none of the characters seem to get through. +Are others able to use it? + +Date: 5 November 1980 13:58-EST +From: Robert W. Kerns +To: BUG-ITS at MIT-MC +cc: ELLEN at MIT-MC + +Kruczynski, Len of USAFA-GATEWAY called. It seems that he can't connect to +MC. He CAN connect to AI, XX, Multics, etc. However, when trying to go from +MC to USAFA-GATEWAY via TELNET MC gets a RST TIMEOUT message printed on the +system console (host=31001 = USAFA-GATEWAY). TELNET works fine from AI. His +system maintainer may try to contact Moon. + + +GYRO@MIT-ML 11/04/80 23:08:52 +To: (BUG its) at MIT-AI +An AI crash a few minutes ago was simultaneous with +a comm link that I opened (I mean a ^_c... in case "comm link" is +somehow ambiguous?) being closed (^_n) by the other person. +I don't know if it's really relevant but the coincidence was +remarkable. Oh yes, I was in the middle of a :send when I started +the link. + +-- Gyro +------- + + +Date: Monday, 3 November 1980 12:40-EST +From: Chris Ryland +To: bug-r11 at mc, bug-its at mc +Subject: buffer hogging + +It seems to me (from my travels with ESC V) that the Plasma TV system +often lets buffers sit unused after people log out from MC; MC takes +quite a while to close the connection, and even after that, Plasma +takes a while to free the buffer. Both of these should be shortened, +so that logging out---without logging back in nearly +immediately---frees up the buffer. + + +Date: 27 October 1980 19:14-EDT +From: Earl A. Killian +Subject: Temporary files +To: MOON at MIT-MC +cc: BUG-ITS at MIT-MC, GJC at MIT-MC, RWK at MIT-MC + +Couldn't you also open the file, and then delete it. When you +close the file, or when it is closed for you by killing the job, +then it will be deleted by the system. + + +RWK@MIT-MC (Sent by ___011@MIT-MC) 10/26/80 06:09:56 Re: I replied to CSTACY +To: (BUG ITS) at MIT-MC +[Translating all devices to AI: including USR: and ERR:] + + +CSTACY@MIT-MC 10/26/80 00:19:09 +To: (BUG ITS) at MIT-MC + +On MC, do: $^T foo,ai:foo; + foo^F FILE.DIR. etc -- CANT READ SYSTEM'S ERROR MESSAGE + bar^K + INFERIOR-CREATION FAILED + +Chris +------ + + +MOON@MIT-MC 10/24/80 20:35:22 Re: Temporary files +To: GJC at MIT-MC +CC: RWK at MIT-MC, (BUG ITS) at MIT-MC +If you read the file .INFO.; ITS LOCKS it will tell you about features +for creating unique IDs and having locks that get unlocked when a job +is killed. Of course there is no way to run arbitrary code when a job +is killed; that could easily make it impossible to kill. + +It's easy to tell whether a given job "points to" a file, if you include +that job's job-number in the name of the file. You simply have +one file per job-number, recreated when a job starts up. If you +want to delete "left over" files in some cleanup procedure, simply +check to see if the job has the name of that file in a fixed place +in its memory (or we could allocate a new .OPTION bit or use the +dragon's way of telling whether a job is a Macsyma). + + +Date: 24 October 1980 13:20-EDT +From: George J. Carrette +Subject: new error message system +To: RWK at MIT-MC, BUG-ITS at MIT-MC + + + Date: 24 October 1980 11:36-EDT + From: Robert W. Kerns + To: GJC + Re: new error message system + + Files that want to be sure to go away when a process is killed can be written + to .TEMP.; + + +I've seen files on the so-called .TEMP. directory end up on +back-up tape! Look, theres one now on MC:.TEMP.;LPH .PLOT. + +Each and every macsyma which starts up will probably create +a new file on the .TEMP. directory, and these will have +to be garbage collected better than they are now. +The problem is, how can a clean-up program tell if any existing +macsyma jobs point to one of the files? Well, I guess AGE greater than +8 hours is a reasonable heuristic. Does ITS have any thing which could +give a UNIQUE process ID over the time between crashes? + +Is there any provision in ITS for letting a process take an +interrupt when something tries to KILL it? It could then +delete the file(s) and kill itself. + + + +Date: 22 OCT 1980 2331-EDT +From: EFH at MIT-AI (Edward F. Hardebeck) +To: (BUG ITS) at MIT-AI + +the name dragon got a PURPG +(PURPG;) 1371>>MOVEM 2,(3) 2/ MOVEI 20100(4) 63336/ 0 +it is dumped on crash;namdrg > + +Date: 20 October 1980 02:03-EDT +From: Robert W. Kerns +Subject: FOOO$U doing a :MASSACRE +To: JNC at MIT-AI +cc: BUG-ITS at MIT-MC + + Date: 17 October 1980 02:20-EDT + From: J. Noel Chiappa + To: RWK + cc: JNC at MIT-AI + Re: FOOO$U doing a :MASSACRE + + Barf! This has actively wedged me. What's the ratyionale, can it + be changed, and if not, how do I avoid lossage (other than detaching + all my jobs?) + Noel +The reason is that logging in on ITS is not permitted (by ITS) if a job has +inferiors. One way to avoid lossage is to log in before doing anything. +Of course, I think a better thing to do would be to allow logging in with +inferior jobs. Since this is already done when a job is reowned, I wouldn't +think this would be very hard to do... +l + +MOON@MIT-MC 10/19/80 04:18:06 Re: SPURIOUS CHARACTERS +To: CENT at MIT-AI +CC: TC at MIT-AI, RG at MIT-AI, (BUG ITS) at MIT-AI + Date: 19 OCT 1980 0409-EDT + From: CENT at MIT-AI (Pandora B. Berman) + Subject: SPURIOUS CHARACTERS + To: TC at MIT-AI, MOON at MIT-AI, RG at MIT-AI + CC: (BUG ITS) at MIT-AI + + THE DATAPOINT IN LAUREL'S OFFICE (917) SEEMS TO OCCASIONALLY + SEND SPURIOUS AND UNCALLED-FOR  ^H'S. I HAVE SEEN THIS HAPPEN + A FEW TIMES AFTER RUNNING :F; THE OUTPUT FROM :F WOULD PRINT + OUT FOLLOWED BY A ^H AND GOING BACK INTO WHATEVER JOB IS + CURRENT. I HAVE NOT SEEN THIS BEHAVIOR CONNECTED WITH ANYTHING + ELSE. I DON'T KNOW WHETHER THIS IS A HARDWARE OR SOFTWARE BUG. + CAN SOMEONE LOOK INTO IT? +It's a hardware bug, fixable by throwing the datapoint in the trash. +They have really crappy keyboards. + +Date: 19 OCT 1980 0409-EDT +From: CENT at MIT-AI (Pandora B. Berman) +Subject: SPURIOUS CHARACTERS +To: TC at MIT-AI, MOON at MIT-AI, RG at MIT-AI +CC: (BUG ITS) at MIT-AI + +THE DATAPOINT IN LAUREL'S OFFICE (917) SEEMS TO OCCASIONALLY +SEND SPURIOUS AND UNCALLED-FOR  ^H'S. I HAVE SEEN THIS HAPPEN +A FEW TIMES AFTER RUNNING :F; THE OUTPUT FROM :F WOULD PRINT +OUT FOLLOWED BY A ^H AND GOING BACK INTO WHATEVER JOB IS +CURRENT. I HAVE NOT SEEN THIS BEHAVIOR CONNECTED WITH ANYTHING +ELSE. I DON'T KNOW WHETHER THIS IS A HARDWARE OR SOFTWARE BUG. +CAN SOMEONE LOOK INTO IT? + +MOON@MIT-MC 10/17/80 21:30:20 +To: DCP at MIT-MC +CC: (BUG ITS) at MIT-MC + DCP@MIT-MC 10/17/80 16:54:08 + To: (BUG ITS) at MIT-MC + Symbolic IOT is documented to XOR the control bits of the call with the + appropriate channel variable in the system. I am trying to use this + with the TTY to change from %TJDIS mode to %TJSIO mode, and I am losing. + There is a short program in MC:DCP;TEST > which I think should work from + the specs in the documentation. Why am I losing?? + +It does XOR the control bits. Where the documentation says the LH of the +first argument (the channel number) is also XOR'ed in it is lying. Use +5000,,%tjdis+%tjsio and your program will work (this is an immediate control +bits arg.) + +DCP@MIT-MC 10/17/80 16:54:08 +To: (BUG ITS) at MIT-MC +Symbolic IOT is documented to XOR the control bits of the call with the +appropriate channel variable in the system. I am trying to use this +with the TTY to change from %TJDIS mode to %TJSIO mode, and I am losing. +There is a short program in MC:DCP;TEST > which I think should work from +the specs in the documentation. Why am I losing?? + + +GSB@MIT-ML 10/15/80 05:02:27 +To: (BUG COMSAT) at MIT-ML +CC: (BUG ITS) at MIT-ML +The mailer lost again tonight because the system crashed renaming LISTS MSGS +to LISTS MSGT. Either comsat should recognize this condition or ITS +shouldn't increment the name unless its necessary. + + +GJC@MIT-MC 10/04/80 01:19:40 +To: (BUG ITS) at MIT-MC, ELLEN at MIT-MC +3-6985 rang but didn't answer, I'm on 3-6986 now +and am experiencing incredible line lossage and garbling, +(am on a VT52 with a 1200 baud vadic), when recieving at +high speed. Probably unrelated, but I thought you@might want +to know. + + +GSB@MIT-ML 09/23/80 07:23:37 Re: ML believes tty 0 to be a teletype +To: (BUG ITS) at MIT-ML +with -%TOLWR... + + +Date: 8 SEP 1980 0343-EDT +From: U at MIT-AI +To: (BUG ITS) at MIT-AI +CC: USER-A at MIT-AI, LEVITT at MIT-AI + +Hello. I am Dave Levitt's music box line. I like to send characters +randomly to the AI machine over T33. Guess what I did today! I sent a +^Z and then after a while managed to send "UU" to log myself in. +Isn't that marvelous? All I really did after that today was send a +lot of "?" characters. I know ALL about DDT and ITS now. But just as +I was working on trying to send :LOCK CRASH, some luser took my tree +away from me. Now I have to start all over and try to get AI to +listen to me again. + +You see, my buddy the PDP-6 (T06) and I have a little contest going +to see who can cause the first system crash by sending garbage down the +line. He's ahead of me: a few days ago he managed to get up a peek and +type ^B to it. 80 blocks of USERS5;.PEEK. 1. Ahhh, but now I've logged in... + +Melodiously, +U@AI + + + + +U/klotz + +Date: 7 SEP 1980 0217-EDT +From: HIC at MIT-AI (Howard I. Cannon) +To: (BUG ITS) at MIT-AI + +I fixed the bug on DM, in both the running monitor and in the BIN file. +The bug was a PUSH P,TTEBAK which wanted to be a PUSHJ. +--Howard + +Date: 7 September 1980 02:04-EDT +From: Howard I. Cannon +Subject: BUG => its +To: PDL at MIT-DMS +cc: BUG-its at MIT-DMS + + Date: 6 Sep 1980 1318-EDT + From: PDL at MIT-DMS (P. David Lebling) + To: BUG-its at MIT-DMS + Re: BUG => its + + In case anyone wants to look at it, a crash of ITS 1193 is on + DM:.;CRASH 5535. It crashed at UUOH0+2. +I looked at another crash at UUOH0+2. It trapped from PI7 while +PUSHJ'ed to the echoin code. It was hacking TTY 0 (I contained MOVE), +and 1(p) had IBP B (CRASH 5535 seems identical). Unfortunatly, +it did a pretty good job of wiping out its tracks, so I couldn't +tell where it came from, but it is pretty clear that it POPJ'ed with +the IBP B on the stack (XUUOH contained C, of course). + + + + +Date: 6 Sep 1980 1318-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].160451> + +In case anyone wants to look at it, a crash of ITS 1193 is on +DM:.;CRASH 5535. It crashed at UUOH0+2. + + +Date: 5 Sep 1980 1047-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].160320> + +The echoin bug is that at TTELP5+10/ TRNN A,xxx should be TRNE A,xxx. +I will patch the source accordingly. + + + +Date: 5 Sep 1980 1040-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-ITS at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].160319> + +We tried running ITS 1193. It works okay except that ECHOIN seems +to echo in the command area after the first character typed. Looking +at TS3TTY 258 vs. 255 indicates new code that fools around with that +sort of thing. I suspect it's buggy... + + + +Date: 1 September 1980 18:46-EDT +From: Robert W. Kerns +Subject: The datacomputer is no more! +To: KEN at MIT-AI +cc: BUG-ITS at MIT-AI + +The problem is really that the datacomputer was discontinued last March or so. +There were system messages about it long in advance. You must have missed +seeing them or something. I don't know if there is any way to recover your +files, although the fact that you were to connect at all would seem to indicate +they are providing some sort of limited service, perhaps to allow recovery in +cases such as yours. Perhaps sending a note to someone at CCA will help? + + +Date: 29 AUG 1980 2336-EDT +From: KEN at MIT-AI (Kenneth Kahn) +Subject: really a dftp problem but bug-dftp is broken +To: (BUG ITS) at MIT-AI + +I sent the following message and recieved this + COMSAT@MIT-AI 08/29/80 22:50:12 Re: Msg of Friday, 29 August 1980 22:50-EDT + A copy of your message is being returned, because: + "DFTP-HACKERS" at MIT-AI is an unknown recipient. + Message not sent. + Failed message follows: + ------- + KEN@MIT-AI 08/29/80 22:50:07 + It seems my directory on the data computer has disappeared. + When I :dftp I get dftp.guest rather than dftp.its.ken ... + Can it be restored or at least long enough for a tape dump of my files? + +Could my question please be forwarded to whoever is hacking dftp these days? + +MOON@MIT-MC 08/29/80 03:50:48 Re: Allocated devices +To: ED at MIT-AI +CC: RMS at MIT-AI, (BUG ITS) at MIT-AI + Date: 28 AUG 1980 0013-EDT + From: ED at MIT-AI (Ed Schwalenberg) + Subject: Allocated devices + To: RMS at MIT-AI, (BUG ITS) at MIT-AI + + Pnn: and Dnn: as devices work unless they have been "allocated" to + the SECOND:, THIRD:, VISION: sort of pack. I don't know whether this + is alleged to be a feature or a bug; I can't see any good that derives + from it. +It's because of the way the file system works on DM, which has actual +reserved packs. Actually it could be fixed but it's random to use the +numbers rather than the names. + Slightly more serious is that there is no way (as far as I know) of + knowing what allocated devices there are (in particular .GETSYS knows + nothing about them) or what the mapping between pack numbers and + allocated devices is. +The :DSKUSE # command should print this information, but doesn't currently. + + There is also no way of telling what directories + are allocated to what packs for the allocated directory scheme. +The :DSKUSE dirname command prints this information. + +Date: 28 Aug 1980 1032-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: ED at MIT-AI +Cc: RMS at MIT-AI, (BUG ITS) at MIT-AI +In-reply-to: Message of 28 Aug 80 at 0013 EDT by ED@MIT-AI +Subject: [Re: Allocated devices] +Message-id: <[MIT-DMS].159324> + +In fact, DSKUSE does almost everything you are asking for; it +will tell what packs are allocated, pack each allocated directory +is on, and so on. It doesn't know much about the named pack hack, +as this is fairly new, but maybe if I find some time... + Dave + + + +Date: 28 AUG 1980 0013-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: Allocated devices +To: RMS at MIT-AI, (BUG ITS) at MIT-AI + +Pnn: and Dnn: as devices work unless they have been "allocated" to +the SECOND:, THIRD:, VISION: sort of pack. I don't know whether this +is alleged to be a feature or a bug; I can't see any good that derives +from it. +Slightly more serious is that there is no way (as far as I know) of +knowing what allocated devices there are (in particular .GETSYS knows +nothing about them) or what the mapping between pack numbers and +allocated devices is. There is also no way of telling what directories +are allocated to what packs for the allocated directory scheme. +I don't think that anybody is being actively screwed by this, but it +would be tasteful if a program could find out about such things without +experimenting or sending mail to Moon. + +Date: 27 AUG 1980 0610-EDT +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI + +The device name P15: works for reading but gets +Device not Available for writing (from :COPY). + +Date: 20 Aug 1980 1423-EDT +From: TAA at MIT-DMS (Timothy A. Anderson) +To: SWG at MIT-DMS +Cc: BUG-ITS at MIT-DMS, clr at MIT-DMS +In-reply-to: <[MIT-DMS].158301> +Subject: [Re: BUG => ITS] +Message-id: <[MIT-DMS].158305> + +If the problem with .BATCH;NBATCH BAD was caused by a disk crash, which +seems likely, it (shiver) was never reported by the salvager. Could +this happen if the file it's sharing with were deleted before the system +crashed? + -taa + + +Date: 20 Aug 1980 1345-EDT +From: SWG at MIT-DMS (S. W. Galley) +To: BUG-ITS at MIT-DMS +Cc: taa at MIT-DMS, clr at MIT-DMS +Subject: BUG => ITS +Message-id: <[MIT-DMS].158301> + +The file DM:.BATCH;NBATCH BAD is supposed to have the same contents as +DM:.BATCH;NBATCH SAVE, but words 166000-167777 have ASCII text from some +other file in them. Could this be from some disk crash since February? + + +RWK@MIT-MC (Sent by RWK0@MIT-MC) 08/13/80 02:36:25 Re: CNSSET/TCMXV bug +To: (BUG ITS) at MIT-MC +CC: BDG at MIT-MC +When BDG sets his vertical screen size down to 1, ITS crashes at TYOAS7+3 +because his cursor position is larger than his screen height. It died when +DDT had the TTY, with his DDT at a .CALL CNSGET. It had of course recently +done a ^PA. Probably .CALL CNSSET (which he had been playing with in a program +of his) should not allow you to set the size below 2 in either dimension... + +I did not dump this because I wanted to get my buffer back. I hope I got +enough info for you to figure out what happened anyway. + + +RWK@MIT-MC 08/05/80 18:24:53 +To: (BUG ITS) at MIT-MC +CC: TAFT at MIT-MC +Both FINGER and SUPDUP, when going via CHAOS, are saying: +? Internal error - ISE0 + +There is no problem, when via ARPA + + +MOON@MIT-MC 08/01/80 21:51:55 Re: rubout problem +To: EAK at MIT-MC +CC: (BUG DDT) at MIT-MC, (BUG ITS) at MIT-MC, (BUG MAIL) at MIT-MC + Date: 1 August 1980 19:42-EDT + From: Earl A. Killian + Subject: rubout problem + To: BUG-DDT at MIT-MC, BUG-MAIL at MIT-MC + cc: BUG-ITS at MIT-MC + + Perhaps DDT and other programs should be using ECHOIN to solve + the rubout problem (where ABDCD echoes as ABDC instead of + ABCD). If the rubout problem is the only reason why :MAIL + doesn't use PI echoing, then maybe it should use it too. + +Unfortunately ECHOIN is rather difficult to use. I designed a scheme +which would not require any changes to user programs but I don't have +nearly enough time to implement it. The basic idea is that when a non-echoing +character is typed the system defers echoing, and re-enables it when +the next echoing character is read by the program (in the meantime the +program may have typed out, for instance to echo erasure for a rubout). +This wouldn't be too hard but the refinement to it is to go ahead and echo +additional characters so you can see what you're typing, but if the program +types anything out erase that echoage and do it again, which is too hard +to do right now. I don't suppose there are any competent volunteers? + +Date: 1 August 1980 19:42-EDT +From: Earl A. Killian +Subject: rubout problem +To: BUG-DDT at MIT-MC, BUG-MAIL at MIT-MC +cc: BUG-ITS at MIT-MC + +Perhaps DDT and other programs should be using ECHOIN to solve +the rubout problem (where ABDCD echoes as ABDC instead of +ABCD). If the rubout problem is the only reason why :MAIL +doesn't use PI echoing, then maybe it should use it too. + + +DLW@MIT-MC 07/29/80 03:52:20 +To: (BUG ITS) at MIT-MC +In the version of ITS on MC, if you come in from SAIL on a TELNET +connection, set +%TPMTA, and send characters with the eighth bit +on, ITS does not see them at all. + +REM@MIT-MC 07/20/80 00:17:16 +To: (BUG ITS) at MIT-MC +Is there any really good reason for discarding a CLI file being passed from +one job to another just because that recipient job hasn't processed it +in a minute or two? The recipient job was enabled for CLI interrup, but +had been ^Z'd, thus couldn't process it immediately. The fact that it +was enabled for interrupt means it wasn't just a random message to +job that didn't want it. + + +MOON@MIT-MC 07/10/80 05:12:56 Re: FILLEN on non-disk devices +To: ED at MIT-AI, (BUG ITS) at MIT-AI +The bug is not in ITS, which does what it's documented to, but in +the special job device which is used if you read the directory of +a non-directory device. Apparently after opening it simply SIOTs +to the BOJ: device, assuming that the first thing you will do after +opening is an IOT, but if you do something else novel effects occur. + +Date: 10 JUL 1980 0401-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: FILLEN on non-disk devices +To: (BUG ITS) at MIT-AI, (BUG MLDEV) at MIT-AI + +Doesn't fail, it just doesn't work. This causes e.g. AIPTP from +MC to cause MLSLV on AI to die horribly, believing that SIXBIT/.FILE./ +is a byte size. The code in MLSLV is reasonable given system calls +that work as they should. The documentation DOES say that it doesn't +work on non-disk devices, but claims that it returns error 34 in that +case. + +MOON@MIT-MC 07/06/80 04:34:02 Re: Fair Share and the GAME program +To: EJS at MIT-MC +CC: (BUG ITS) at MIT-MC, LPH at MIT-MC +The ITS bug that caused fair share to be very low on occasion when the system +was lightly loaded has been fixed. (In response to your message of 1 July 20:51) + +Date: 1 July 1980 23:32-EDT +From: Earl A. Killian +Subject: ITS H19 support +To: MRC at MIT-AI +cc: BUG-TCTYP at MIT-MC, BUG-ITS at MIT-AI + +Try :TCTYP VT52 +%TOLID which at least gets you line +insert/delete. There is no excuse for :TCTYP HEATH or :TCTYP H19 +not existing to do at least this. + + +Date: 1 JUL 1980 2202-EDT +From: MRC at MIT-AI (Mark Crispin) +Subject: ITS H19 support +To: (BUG ITS) at MIT-AI + +Is there any chance that H19's will be added to ITS soon? I'll use +:TCTYP VT52 for now since CRTSTY is too expensive, but these things +do seem to be becoming more popular. + +Date: 1 July 1980 20:51-EDT +From: Eric J. Swenson +Subject: Fair Share and the GAME program +To: MOON at MIT-MC, BUG-ITS at MIT-MC +cc: LPH at MIT-MC + + +I'm getting tired of people telling me that the GAME program bites the +royal... because of the system load restrictions (determined from the +system Fair Share and the number of users). Here is a message from Leo +Harten (LPH@MC). Is it possible that ITS is not calculating the fair share +correctly or is it just not a reliable indication of system load even when +averaged over time? +----- [Mail from LPH] ----: + the fair share determiner is not useful to trek players. when no one + is running a job, fair share is 5%. if i start a macsyma running for + i:1 thru 1.e6 do (j:i); and then get 60% fair share, then i can play + trek!!! to have to start a running job in order to play games at 3 am + is ludicrous! there are 11 lusers right now, and since no one is + actively running anything, the fair share is artificially low. + is this a feature of the new dragon? (as in star trek: the motion + picture, that's not a bug, that's a vejur!) +----- [End of Mail from LPH] ---- +So is there anything wrong with Fair Share? Is it an accurate measure of +anything or can it be used in place of a one-hundred-sided die? -- Eric + + +Date: 30 JUN 1980 1451-EDT +From: MOON at MIT-MC (David A. Moon) +Subject:  is S L O W +To: SJK at MIT-MC +CC: (BUG DDT) at MIT-MC, (BUG ITS) at MIT-MC + + SJK@MIT-MC 06/30/80 00:02:03 Re:  is S L O W + To: (BUG DDT) at MIT-MC, (BUG ITS) at MIT-MC + Is there any reason for this command to be slower? I've noticed it sorta + pauses after each line. This is a fairly recent occurrance, maybe's been + this way for two weeks. Anyone else notice this? -sjk +This is because the buffer for printing directories and files in DDT +is preposterously small (80 characters), and an interaction with the job +implementing the DIR: device is required for each buffer-load. RWK +has promised to fix this but evidently hasn't had time. + +SJK@MIT-MC 06/30/80 00:02:03 Re:  is S L O W +To: (BUG DDT) at MIT-MC, (BUG ITS) at MIT-MC +Is there any reason for this command to be slower? I've noticed it sorta +pauses after each line. This is a fairly recent occurrance, maybe's been +this way for two weeks. Anyone else notice this? -sjk + +MOON@MIT-MC 06/28/80 00:01:09 Re: KMP's halt at TTYI15+15 from :REATTA +To: KMP at MIT-MC, (BUG ITS) at MIT-MC, (BUG REATTA) at MIT-MC +CC: RLB at MIT-MC, JIM at MIT-MC +I have fixed this in the source (TS3TTY). RMS, could you check the +change and make sure I didn't break anything? + +KMP@MIT-MC 06/27/80 14:09:45 +To: (BUG ITS) at MIT-MC, (BUG REATTA) at MIT-MC, KMP at MIT-MC +CC: RLB at MIT-MC, JIM at MIT-MC +I did :REATTA JIM /K from a terminal near Jim's to demo how REATTA works +(the terminal I did it from was t22 on MC). I then typed  to see where +we were in the reatta'd process, but nothing happened. The system had +halted at TTYI15+15 (a JUMPL B,[JRST 4,.] which has a comment saying that +the interrupting character belongs to no user). I suspect that REATTA and/or +ITS needs to do something about this potential timing error. Control-Z is +always the first char I type after a REATTA to get myself back to DDT where +I can figure out what's going on ... Maybe it can just turn off interrupts +-- will that help? -- or maybe ITS needs to be more tolerant of this type +of error and just dismiss the interrupt and pretend it didn't see the +character. In any case, the bug makes me nervous since I suggest REATTA to +many of our users who get themselves dropped by the network... This was +the nature of the system crash today at 12:15pm +-kmp + + +Date: 25 Jun 1980 1749-EDT +From: CSTACY at MIT-DMS (Christopher C. Stacy) +To: BUG-its at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].152408> + +On DMS with three users (one of them my crtsty) +I got a FS from :sstatus of 102%. +Is this broken? +Chris +---- + + + +Date: 27 JUN 1980 1108-EDT +From: KMP at MIT-MC (Kent M. Pitman) +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC, (BUG EMACS) at MIT-MC, (BUG BABYL) at MIT-MC + +I was running Babyl a little while ago and managed to get it into a wierd +state where it started sending all sorts of garbage to the terminal that +I just couldn't stop. I did  to get out of it -- that worked. My terminal +went back to normal. When I P'd the job, the stream of garbage continued. +After that, it was hard to tell if things were listening to me. I tried 'ing +out of it again, but that didn't give me any re-assuring signs that my +console was listening to me -- just streams of random characters displaying +mostly. After a while, I noticed that the output I was seeing when I typed +something was mixed part of the stuff I should be seeing and part of the +stuff I'd seen a while back -- eg, "QUIQU^ IXX ?" or something when I typed + ... Presumably the XX? was from the 's earlier. I had +JONL gun me and after 'ing the console again and typing some 's +I finally saw my console free message and the wakeup message from the . +RWK told me to do .0G and :PDUMP the Emacs job -- it's written to +MC:KMP;TS SCREW if someone wants to look at if -- Since it's running Babyl +and I don't want my mail clobbered, be extremely careful not to "Q" out +of it if you do want to look at it ... If it's not worth looking at, that's +fine by me. Send me a message saying so, so that I can delete the dump file. +-kmp + + +Date: 27 JUN 1980 0352-EDT +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG DDT) at MIT-AI, (BUG ITS) at MIT-AI + +I have :TCTYP QUERY in my init file, +but very often I find that the bit has been cleared. +Someone just linked to me and it didn't query. +The bit was off. He said he didnt patch it off, +so it must be a bug. + +Date: 26 JUN 1980 0116-EDT +From: DLW at MIT-AI (Daniel L. Weinreb) +To: (BUG ITS) at MIT-AI + +I just got :LUISERed by someone who was trying to create +a file using :CREATE and getting confused. I hadn't known +there even WAS a :CREATE, but there is such a program; it appears +to be a simple TECO frob or something. Anyone know what this is?? + +ZRM@MIT-MC 06/25/80 17:59:25 +To: (BUG ITS) at MIT-MC +Having just fingered mc it occurs to me that listing +ctrstys as users is redundant and leads to more confusion than +information. + +Date: 24 June 1980 20:59-EDT +From: Earl A. Killian +To: BUG-ITS at MIT-MC + +Date: 23 Jun 1980 2153-EDT +From: ZEMON at MIT-DMS (Landon M. Dyer) +To: BUG-crtsty at MIT-DMS +Re: BUG => crtsty + + I have a slight problem. I own a microcomputer +system upon which I have simulated a superimage mode (SUPDUP?) +terminal, i.e. a terminal which would (in theory) take the 'raw' +output stream from ITS (escaped by 177s, as documented in INFO +somewhere) and do nice (and fast) things without the aid of a +front end preprocessor like CRTSTY. + + I have all of the escape sequences & so forth working (I have +tested them out in local mode....), but to date my efforts to get +ITS to beleive in my SUPDUP terminal have been fruitless, if not +unspectacular -- ITS will either ignore me completely and continue +to treat me as a printing terminal, or it will "blow up" and +start sending me wierd and wonderful, if useless, control characters. + + 1) How do I get ITS to beleive in me? What bits must I +twiddle in order to get the ITS buffer output codes to work for me? + + 2) If I can't get ITS to send me the buffer codes, how can +I use CRTSTY's SOFT terminal emulator? (Having looked +at the listing for the SOFT front end it seems that that is about +what I have written to emulate -- but I can't get SOFT to work either.) + + It would be preferable to just set bits in DDT and not have +to take up an extra job slot, of course. + + Please answer -- I am badly in need of some help here. +You can send mail to either zemon@mit-ai or dyer@nbs-10. + + Thank you very much... + + +Date: 24 June 1980 20:59-EDT +From: Earl A. Killian +Subject: not getting software TTY codes +To: ZEMON at MIT-DMS +cc: BUG-ITS at MIT-MC + +You were using :TCTYP SOFT, and you weren't getting what looked +like ITS internal codes? Maybe they were coming in their 200+ +form instead of the 177 escape form? Could you tell us in octal +what is sent when you type CR to DDT? + + +Date: 24 JUN 1980 0300-EDT +From: EB at MIT-AI (Edward Barton) +Subject: CLI device +To: (BUG ITS) at MIT-AI +CC: EB at MIT-AI + +The system job deletes core link files which have not been referenced +for two minutes. I do not believe that files which were opened as CLI: +(perhaps as opposed to CLO:) should go away if the jobs to which interrupts +were given still have those interrupts pending. The effect of the current +practice is that a job which is ^Z'ed at the time it receives its CLI +interrupt may later get that interrupt but not be able to open CLA:. + +Also, it would be nice if a channel open to CLO: could interrupt when +input became available.... + + +CPR@MIT-MC 06/23/80 08:23:32 +To: (BUG ITS) at MIT-MC +I got a 'all network ports in use' message as the 10th net tty...seems small. + +GNU@MIT-MC 06/19/80 03:34:46 +To: (BUG ITS) at MIT-MC +ITS seems to be flakier these days about when it types a colon (when in +monitor mode). Often after running a program it will type *, ^W, +or nothing, requiring you to hit CR to get your input interpreted as +a command. What has happened? Can it be fixed to always provide a colon? +In particular, :TCTYP *never* provides any prompt except ^W, and as I recall, +never has. This ought get fixed. (Does anybody who works there use +:monmode? I've heard it referred to as "crippled mode", but since I +don't have an ITS manual handy ever, I can't remember the obscure +("incompatible") random control-strange-char-preceded-and-followed-by-other- +strange-parameters "commands". + + +JPG@MIT-MC 06/19/80 02:52:46 +To: CMA at MIT-MC +CC: ELLEN at MIT-MC, (BUG ITS) at MIT-MC +CMA@MIT-MC 06/18/80 14:24:25 +the command :tctyp padcr 0 padlf 0 padtab 1 width 228 +seems to disconnect me from the system.It has happened twice. + +I don't see any way there could be a connection between the two. +Getting disconnected unfortunately is also too easy to happen even +without this scenario. Anyway, I am forwarding your mail to people +who know more about these things. + + +JLK@MIT-MC 06/16/80 15:37:00 +To: FILE-RETRIEVE at MIT-MC +CC: (BUG ITS) at MIT-MC +Why are half of the login and emacs init files in the world on pack 13? +I think this is a total loss. I imagine if someone is on a vacation +or something, their whole directory gets put on pack 13, and they never +notice it until pack 13 crashes. Can't this brain damaged dumping process +be made more clever? The backlash from this is likely to be people +writing programs for their logout file that sets the don't reap bit +for all their files and copies them all to primary packs. I spent half +the moring handling complaints from dozens of users who didn't understand +why none of their normal activities worked (login, emacs, mail, etc.). +I consider this to be a very serious lossage and hope steps can be taken +to make sure this doesn't happen again. I suppose I can write a trival +program that fixes all directories after every dump, but it is a loss that +this should be necessary. + + +Date: 11 Jun 1980 1216-EDT +From: PDL at MIT-DMS (P. David Lebling) +To: BUG-its at MIT-DMS +Cc: TAA at MIT-DMS, SWG at MIT-DMS, WJN at MIT-DMS +Subject: BUG => its +Message-id: <[MIT-DMS].150758> + +Copying WJN;WJN READER to WJN;AR0:_WJNRE > causes a crash at USRUUO+5(?). +This also happens (as an innocent experiment showed) in the newer ITS +when you copy AI:COMMON;WJN READER to AI:COMMON;AR0:_WJNRE >. We didn't +realize the bug was so virulent. + Dave + + + +FMRC@MIT-ML 06/09/80 02:44:30 +To: (BUG ITS) at MIT-ML +It is currently about 0240 EST and there is only one other user on. +And it is sunday/mondaymorn at that. I just recieved a message from +SYSTEM OVERSEER saying that I am not supposed to be on right now. This +is I hope a bug? + +Date: 6 JUN 1980 2327-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: Translations +To: CBF at MIT-MC, CSTACY at MIT-MC +CC: (BUG ITS) at MIT-AI + +There are two seperate losses which are being confused here. +There are a finite number of entries in the system translation +table; if an attempt to create a translation (TRANAD) is done +a DIRECTORY FULL error message is generated. This virtually +never happens, and clearly did not happen in this case. + +If a translation gets chased more than 64 or so times, it is +deemed to be losing and the error TOO MANY TRANSLATIONS +is generated. I think from CSTACY's message he did + DSK:FOO;MUMBLE MUMBLE +To: +* +which resulted in a translation from MUMBLE MUMBLE to itself. +He then did :PRINT MUMBLE MUMBLE and got the correct error +message. + +ECC@MIT-AI 06/06/80 17:37:29 Re: tip port 5 +To: (BUG its) at MIT-ML +Apparently, ML thinks that MIT-TIP port 5 is room 508, which is occupied +by Kent, Sollins, and Ciccarelli. Offhand, I don't know about the 508 -- +that is probably still correct, but I'm not in that office (or group, for +that matter) anymore. + + + + +CBF@MIT-MC 06/06/80 17:43:32 Re: Translations +To: CSTACY at MIT-MC +CC: (BUG ITS) at MIT-MC + CSTACY@MIT-MC 06/05/80 07:04:03 + There are too many translations active on MC. Can this happen? + (If I interpreted the error messg correctly...) + I tried to do a $^T which failed, + also a :link command failed with "TRANS: - TOO MANY TRANSLATIONS". + How dynamic is this situation, or is this really a bug? + +No bug, the total number of translations is a fixed constant on each ITS. +IN general you should not make a translation unless there is no other good +way to accomplish the objective and it is highly anti-social to have more +than a few at any given time. + + +Date: 6 JUN 1980 0126-EDT +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI + +Closing another job's disk channel inside IODCL, +with U and P set up for that other job, got to QDEL11 +which went to UUOTRO. UUOTRO assumes that U and P are +set up to the job which is running. So it called +ALOGOUT again which decided, since U was a which +had an inferior and 40 had .LOGOUT 1, to act like +a .BREAK. Giving the interrupt eventually crashed +because it checked for LSWPR being nonzero. +I think that UUOTRO assumes that LSWPR is zero. +Probably UUOTRO should be changed to make these +things true or bomb immediately if they are not. +I can't say anything about the code in QDEL11 +because that code is not in the DISK listing at all, +but it is probably a loss for any close routine to +go to UUOTRO. + +CSTACY@MIT-MC 06/05/80 07:04:03 +To: (BUG ITS) at MIT-MC +There are too many translations active on MC. Can this happen? +(If I interpreted the error messg correctly...) +I tried to do a $^T which failed, +also a :link command failed with "TRANS: - TOO MANY TRANSLATIONS". +How dynamic is this situation, or is this really a bug? +Thanks, +Chris + + +GJC@MIT-MC 06/02/80 16:23:55 +To: (BUG ITS) at MIT-MC +I saw two detached HACTRO's today on MC, and they took an awful +long time to die after being gunned with peek. The status stayed +at *MULTIX for a couple minutes (near as I could tell), and +then they went away... + +-gjc + + + +JONL@MIT-MC 06/02/80 07:58:58 +To: (BUG ITS) at MIT-MC +CC: (BUG DDT) at MIT-MC +:MOVE seems to lose the "don't-reap-me" bit, and also +resets the reference date to time of :MOVEing. There +ought to be a way to shuffle stuff to secondary or tertiary +packs without destroying this valuable information. + + +Date: 30 May 1980 0512-PDT +From: Scott J. Kramer +Subject: Well... +To: bug-pword at MC, bug-its at MC + +:DDTSYM BYERUN is set non-zero, don't know exactly what. +------- + + +Date: 30 May 1980 0501-PDT +From: Scott J. Kramer +Subject: PWORD weirdness +To: bug-pword at MC, bug-its at MC + +Wonderful bugs: + +MC ITS.1191. PWORD.1733. +TTY 42 +8. Lusers, Fair Share = 64% + +*$$u +MC ITS 1191 Console 42 Free. 07:57:57 + +MC ITS.1191. PWORD.1733. +TTY 42 +8. Lusers, Fair Share = 74% + +*sjk$^A +(This person's mail is forwarded to CHNL NOT OPEN +Bad file = ^Q : ^Q ; ^Q ^Q +*$^A +(This person's mail is forwarded to +Top level interrupt, tree detached + +MC ITS 1191 Console 42 Free. 07:58:07 + +MC ITS.1191. PWORD.1733. +TTY 42 +8. Lusers, Fair Share = 72% + +*sjk$^A +(This person's mail is forwarded to CHNL NOT OPEN +Bad file = ^Q : ^Q ; ^Q ^Q +*$$u +These are the topics for which HELP can give more info. +Type: +:HELP +for more info on a given topic. + + ACOUNT LOGIN TCTYP LUSER ITS JCL + PRINT LOGOUT SEND NAME SSTATU WHOJ + BUG WHO DATE TIME TIMES TIMOON + OCTPUS WHOIS HELP MAIL QSEND PRMAIL + PRSEND LISTF USERS +* +*:logout + +See Ya Later ___035... +The plural of spouse is spice. + +...and it hangs here. And somehow :DDTSYM BYERUN is set to -1. +Rather bizarre... -sjk +------- + + +RWK@MIT-MC 05/29/80 13:16:43 Re: Scheduler observations +To: (BUG ITS) at MIT-MC +Response to --MORE-- in peek can still take 15 seconds or so (although +not usually). It's a lot better, but not perfect. Also, I just gunned +down a job with "1000000" interrupt according to PEEK. What is that +interrupt? It took about 2 minutes for it to finally go away. In +the meantime, it could not be :UJOB'd, its FLSINS was zero, its +state in PEEK was *MULTICS, its inferior disappeared at about the 1 +minute mark, etc. Also, HIC and I saw a hung tree. A WHOLIN job was +hung waiting for output room, which isn't suprising but the HACTRN +was hung in USRI. It went away OK when gunned (we were going to lunch, +not investigating the system). + +A lot better than before, but still some quirks. + + +Date: 29 MAY 1980 0720-EDT +From: RWK at MIT-MC (Robert W. Kerns) +To: (BUG ITS) at MIT-MC +CC: SJK at MIT-MC + +I'm not certain SJK's suggestion should be done. When I use DIR:, I often +use it in more than one mode. However, I'm probably just abnormal. Second +opinion? + + +RWK@MIT-MC 05/29/80 06:16:14 +To: (BUG ITS) at MIT-MC +FIRST: should be a synonym for writing to a primary pack, for the benifit +of allocated directories. + + +GJC@MIT-MC 05/28/80 14:23:41 +To: (BUG ITS) at MIT-MC +CC: CL at MIT-MC, JLK at MIT-MC +T36 seems to be wedged. + + +RWK@MIT-MC 05/27/80 15:57:22 Re: Schedualer lossage +To: (BUG ITS) at MIT-MC +CC: JM at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC +Fooi, I sent mail before but it log lost in the crash. Anyway, there +definitely IS a problem, but it's not just that performance is bad. There +is a screwy interaction at work here between interrupts and I/O and the +scheduler. + +When a job has non-defered pending interrupts, SCHACK does not skip-return, +leading to doing a full schedual. I think this relates to the problem, in +that only jobs with pending interrupts are scrod. Because they only get run +when a full schedual is done, they can be heavily discriminated against under +some circumstances. I'm not sure just what those circumstances are, but PEEK +is screwed in --MORE-- but not elsewhere. This only happens during heavy load, +presumably because the full schedual then happens more often. + +These observations are based on a lot of poking around, with H19WHO keeping me +informed of the state of my current job. + +1) EMACS does it's input in a single big SIOT, getting MPV's along the way, +which it handles and creates the core. Unfortunately, these interrupts may +take a very long time to go off, and it won't be schedualed until they do. + +2) PEEK .SLEEP's except during the --MORE-- break, where it waits in an input +.IOT ... which never returns, since when you type a space, the %PITYI interrupt +is asserted in .PIRQC, but NEVER GOES OFF. If you clear this interrupt, +disable %PITYI in .MASK, type the space, it reads the space. Then of course +you have to restore the mask, since PEEK reads it's commands at interrupt +level. + +3) When COMSAT loses, getting schedualed but every minute or so, I've checked, +found the pages required in core, at an ordinary BLT or TLNN etc., and with +a %PIRLT interrupt that WAS NOT GOING OFF. Eventually the load would drop and +it would run. + +4) DDT sometimes doesn't get its interrupt when the inferior is ^Z'd, while +it's sitting in it's .HANG I also saw a .DTTY take 20 seconds, I don't have +any other clues on that. Oddly enough, giving DDT a ^G seems to wake it up +when it's hung in that manner. Perhaps the TTY driver manages to frob it in +just the right way to make it run again, I don't know. Or maybe it just +happened to get schedualed when I typed &^G, but that seems unlikely; why +didn't it get schedualed for 15 seconds before that? + +Anyway, I hope this is enough to track down the problem. The threshold of +load before it shows up is fairly high, requiring many runnable jobs. Probably +enough to fill SCHBTB or something and just sit there keeping it full. + + +RWK@MIT-MC 05/27/80 12:00:50 Re: Slowness +To: (BUG ITS) at MIT-MC +CC: JM at MIT-MC +I'm not so sure that the reported slowness of disk I/O is anything other +than very heavy disk loading. Looking at the channels listing in peek, we're +often in the 20-25 channel range, and it's not uncommon for there to be 15 +competitors for one disk drive. Normal is more like 15-20 range, with maybe +8-10 competitors for a drive. Today seems to be more disk intensive than usual +for some reason. TY is doing a DUMP. There are several compilers and TEX jobs +plus the dover spooler and PFTHMG and ... + +I've seen the system grind to a halt when there were 25 channels in use before. +And indeed, when it drops back down to normal, it doesn't seem grossly slower +than usual, although I can't assert it's normal. Under the 25-channel load, +I read SYSEN1;DDT > (98 blocks) into an EMACS in 110 seconds, watching with +H19WHO updatng every 5 seconds. Only 4 samples out of that period of 22 were +in other than +DSKBI. Under conditions of about 18 channels in use the time +was 65 seconds with only one sample not in +DSKBI. 65 seconds is not +inconsistant with times I've observed before under "similar" load. It has also +been observed by many people that the system is much less responsive WRT disk +I/O when a dump is being taken. + +Disclamer: The above observations do not show that the system is performing as +well as before. My only assertion is that the data doesn't show it when +balanced with the load observed. and the lack of a control case. "Before" data +would be necessary to make any reasonable judgements. + +Further Disclamer: The above does not mean that I think the schedular is +working 100% right. There are other clear problems with it. Have yo utried +continuing a --MORE-- break in PEEK lately? + +BTW, ITS doesn't use an elevator algorithm for its disk I/O does it? +110 seconds for 98 pages against say 12 competitors for one disk drive +looks to me about right for randomly contending competitors, no? This works +out to about 10 seconds for the single user, with having it seek the block, +then wait until the next schedual to transfer the block to the user's address +space (perform the SIOT) and queue up the next transfer. I.e. about 1/10 +second for each pair of seek/xfer and schedual. + +Maybe elevator algorithm might be worthwhile during the heavier load +situations? Also, read-ahead when you encounter an extent of more than one +block might help. + +Maybe we should run the old system sometime in the daytime and take some +performance measurements to compare with the current situation? + + +Date: 27 May 1980 10:32-EDT +From: Earl A. Killian +Subject: ITS 1188 is slower. +To: BUG-ITS at MIT-MC +cc: CBF at MIT-MC + +I agree; reading my large Babyl file into TECO took much much +longer just now than it ever has under similar load. + + +CBF@MIT-MC 05/27/80 09:01:58 Re: ITS 1188 is slower. +To: (BUG ITS) at MIT-MC +ITS 1186 is slower +It seems to take longer to do some things, ie. get into Rmail or Info. +Quit starting seems to help. (ie. ^Z $P). +This claim is based on response time vs. my past experience at various +loads. I havn't tried to do any quantitive measurement. + + +GLS@MIT-MC 05/26/80 17:35:09 +To: (BUG ITS) at MIT-MC +See MC:CRASH;HALTPC 5550 for a crash at PC 5550 (see log). + +Date: 12 MAY 1980 2214-EDT +From: KLH at MIT-AI (Ken Harrenstien) +Subject: Tabs +To: ED at MIT-MC +CC: (BUG ITS) at MIT-AI + + ED@MIT-MC 05/12/80 21:38:18 Re: Tabs + This line begins with a tab. However, it echoes and redisplays + consistantly with only one blank space at the beginning. + This line begins with two tabs. It has 8 blank spaces. + It appears to only happen at the beginning of the line. This is + on a C100, using :tctyp c100. + +This appears to be an ITS problem; I cannot make it happen via +software-TTY, so it must be C100 specific. + +KMP@MIT-MC (Sent by ___131@MIT-MC) 05/10/80 23:39:34 +To: (BUG ITS) at MIT-MC +The system console stopped typing out at 20:02 tonight. The console 11's +lights are locked on ... it looks kinda out of it ... I asked RG who advised +not doing anything and just waiting until the system goes down voluntarily, +so I'm leaving it be. -kmp + + +CBF@MIT-MC 05/10/80 21:18:52 Re: strange occurances on T13 (the first Vadic 3467 line) +To: ASB at MIT-MC, (BUG ITS) at MIT-MC +CC: KMP at MIT-MC, ELLEN at MIT-MC, SK at MIT-MC +It is more than obvious that the T13 is not detecting hangup. (Ie. either +the modem card, the wires from it to the DH-11, the DH-11, the tables in +the I/O-11, the I/O-11, the tables in ITS, ITS, the KL-10 or something in +the path is broken). Someone might look into fixing it before half the +disk is taken up by bug reports. + + +ASB@MIT-MC 05/10/80 16:05:04 Re: ADDENDUM TO PREVIOUS NOTE +To: (BUG ITS) at MIT-MC +CC: KMP at MIT-MC, SK at MIT-MC, ELLEN at MIT-MC, ASB at MIT-MC +I now find that although wake-up still fails, CNTL-Z works fine. +The TCTYP was apparently irrelevant. + + +ASB@MIT-MC 05/10/80 14:47:44 +To: (BUG ITS) at MIT-MC +CC: KMP at MIT-MC, ELLEN at MIT-MC, ASB at MIT-MC, SK at MIT-MC +I have repeatable problems characterized by the following: + +[1] My equipment: + ADM-3A thru VADIC 3434 over FTS 835-6985 +[2] Procedure: + Dial the phone no. get CXR light on VADIC indicating carrier locks. + Type a , observe TXD light on vadic flash, indicating that + was successfully transmitted. No answering flash of RXD light on + VADIC, indicating that the return copy of is not received. + Repeat the transmission and return-receive failure as many times + as desired. I have done it 10 times with identical behavior. + Type :TCTYP FULL into MC. After each character I notice the + TXD flash, but no RXD flash. No response yet. + Type CNTL-Z . Now the machine wakes up and transmits the banner: + MC ITS.1168.PWORD bla bla + TTY whatever + ## LUSERS etc bla bla + Now I find that I can log in. + After doing so, I do :P O and the line corresponding to me reads + +13 137 ASB P T1061 24 80 X <- + + + which I interpret to mean that the systems thinks my terminal + is T1061. + +Perhaps I somehow told it this, though I am unaware of having done so. +I have repeated this process successfully 3 times in the last 1/2 hour. + + +ASB@MIT-MC (Sent by ASB0@MIT-MC) 05/09/80 18:46:32 +To: (BUG ITS) at MIT-MC +CC: TYANG at MIT-MC, KMP at MIT-MC, CWH at MIT-MC +Logged in as ASB, I tried to log in again thru a printing terminal +to get a short listing. I found that I was attached to a tree belonging +to TYANG, and could not log in on my own. So I detached his tree, +logged in and all was well. + + +Date: 9 MAY 1980 1611-EDT +From: RICH at MIT-AI (Charles Rich) +To: (BUG ITS) at MIT-AI + +It is very irritating that the DVR^F command leaves the default +device set to DVR: so that, for example, subsequence :PRINT +commands which do not explicitly specify AI: or DSK: in the +filename fail. The XGP^F command, on which DVR^F is assumedly +modelled, does not have this problem. + +Date: 9 May 1980 08:29-EDT +From: Kent M. Pitman +Subject: Here's another one... +To: BUG-ITS at MIT-MC + +Date: 05/09/80 05:08:05 +From: DLW at MIT-AI +To: KMP +Re: MC dialup failure on 5/8/80 + +Just for the record, I also have been unable to make 253-6985 +respond to CR. + + +RWK@MIT-MC 05/09/80 02:12:41 +To: KMP at MIT-MC, GZ at MIT-MC, DANIEL at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG PWORD) at MIT-MC +If someone would be so kind as to tell me which TTY line does not get PWORD, +I would be fix it. Noone has cared to tell me yet. It is hardly necessary +to send to note to all of BUG-ITS to get this fixed. A single responsible +bug report would do it. I am sure you are aware I do not have a modem in +my office, let alone a vadic triple-speed. + + +KMP@MIT-ML 05/09/80 02:06:32 +To: (BUG PWORD) at MIT-ML +CC: GZ at MIT-ML, (BUG ITS) at MIT-ML, DANIEL at MIT-ML, KMP at MIT-ML +People have complained to me about dialing MC (GZ) and ML (DANIEL) and getting +DDT instead of PWORD on occasion in the last couple of days. Something might +be mixed up. + + +KMP@MIT-MC 05/09/80 02:04:03 +To: (BUG ITS) at MIT-MC +CC: ASB at MIT-MC, SK at MIT-MC, ELLEN at MIT-MC, KMP at MIT-MC +I got multiple reports this evening of dialing 7985 and not waking +up MC ... Something may be messed up. ASB's line was also 1/2-dpx for unknown +reasons (said he did not :Tctyp Half) on it and doesn't know how it got into +that mode but he wasn't seeing anything he was typing for a while and +:Tctyp Full corrected the problem. +-kmp + + +RWK@MIT-MC 05/09/80 01:18:30 +To: (BUG TECO) at MIT-MC, (BUG ITS) at MIT-MC +It seems that EMACS can't be ^P'd while running a keyboard macro, because +it keeps doing .CALL of TTYGET. Now while I doubt that TECO needs to be +doing .CALL of TTYGET while doing a keyboard macro, on the other hand it +should not require the TTY to do such a call, but should get the information +out of .TTST1 and .TTST2 and TTSTS per-job variables. + + +KMP@MIT-MC 05/03/80 00:07:15 +To: (BUG ITS) at MIT-MC, (BUG OS) at MIT-MC +CC: RWK at MIT-MC +There exists an AI:SYSENG;OS 93,95,and 96. 95 and 96 seemed to have been +victims of hacks, so I deleted them and re-installed 93 which seems to work +fine. -kmp + + +RWK@MIT-MC (Sent by ___106@MIT-MC) 05/03/80 00:04:13 Re: OS +To: RICH at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG OS) at MIT-MC, KMP at MIT-MC +KMP fixed OS; it had been vandalized. + + +Date: 2 MAY 1980 2342-EDT +From: RICH at MIT-AI (Charles Rich) +To: (BUG OS) at MIT-AI, (BUG ITS) at MIT-AI + +The :OS program seems to be broken. Regardless of whether it is +given a logged in user name or not, it just does a and +kills itself. + +Date: 1 MAY 1980 1959-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: infinite translation +To: GLS at MIT-AI, (BUG ITS) at MIT-AI, (BUG EMACS) at MIT-AI +To: RWK at MIT-MC +CC: DUFTY at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC + + GLS@MIT-AI 05/01/80 17:11:40 Re: infinite translation + Maybe making an infinite translation may be permitted, but ITS should + certainly put an upper limit on the number of translation iterations + (it does the same for links). An obvious such limit is the size + of its internal translation table (which is fixed)! +ITS already does this. EMACS attempts to open the ERR: device, and if that +open fails, for ANY REASON including Too Many Translations, it simply tries +again. The historical reason for this may lie in the fact that many programs +(including TECO itself) were exhibiting the malfeasance of failing to CLOSE +the ERR device when done, and the system would occasionally get wedged due +to this. A suitable PEEK mode was invented, and TECO at least was fixed to +close ERR when done, but this business of reexecuting a failed OPEN was not. + +GLS@MIT-AI 05/01/80 17:11:40 Re: infinite translation +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC, DUFTY at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC + RWK@MIT-MC (Sent by ___010@MIT-MC) 05/01/80 05:25:35 Re: infinite translation + DUFTY had a translation of IO *:*;* * => *:*;* * in his EMACS. + When it runs, it runs infinitely in OPEN. ITS really should forbid such + a translation, since it causes the system to lose totally, with the time + hidden from view (it does not show up in PEEK). Fair share dropped to + 2%, with about 10% going to users, and the rest just disappearing. Anyway, + probably the "right" thing to do is for ITS to detect attempts to define + infinite translations, and return an error. Of course, DDT could detect + this obvious case. + + +Maybe making an infinite translation may be permitted, but ITS should +certainly put an upper limit on the number of translation iterations +(it does the same for links). An obvious such limit is the size +of its internal translation table (which is fixed)! + + + +Date: 1 MAY 1980 0943-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: infinite translation +To: (BUG ITS) at MIT-AI, (BUG EMACS) at MIT-AI, RWK at MIT-MC +CC: DUFTY at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC + +The real bug here is in Emacs, which if the OPEN of the ERR: device +fails simply retries. I complained about this some time ago. + +The fact that DDT will create an infinite translation +entry of this sort by way of the user typing , is +perhaps at fault. Maybe there should be YET ANOTHER DDT flag, or an +improvement to one of the existing ones, which would turn off nearly +all short commands which naive users would never want (, ,  are +the "destructive" ones that come immediately to mind). + +SJK@MIT-ML 05/01/80 07:10:54 Re:  DIR: ... +To: (BUG its) at MIT-MC +This isn't really a bug, just a suggestion. When one is using the DIR: +"device" and does, for example,  DIR:LISP;CDATE DOWN and then does a + .INFO.; (ie no change to FN1 or FN2) the DIR: has been changed back +to DSK: and the command barfs. But if one changes only FN1 and/or FN2 +then a MODE NOT AVAILABLE error occurs. This really seems to be the +opposite of what should happen, DIR: should be "sticky" if only the +directory names is changed, otherwise it can revert back to DSK: if +filenames are changed. I'm open to arguments for its present method +of operation but vote that this be changed in the future if possible. +Thanks. -sjk + + +RWK@MIT-MC (Sent by ___010@MIT-MC) 05/01/80 05:25:35 Re: infinite translation +To: (BUG ITS) at MIT-MC +CC: DUFTY at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC +DUFTY had a translation of IO *:*;* * => *:*;* * in his EMACS. +When it runs, it runs infinitely in OPEN. ITS really should forbid such +a translation, since it causes the system to lose totally, with the time +hidden from view (it does not show up in PEEK). Fair share dropped to +2%, with about 10% going to users, and the rest just disappearing. Anyway, +probably the "right" thing to do is for ITS to detect attempts to define +infinite translations, and return an error. Of course, DDT could detect +this obvious case. + + +Date: 28 APR 1980 0337-EDT +From: cstacy at MIT-AI (Christopher C. Stacy) +Sent-by: ___020 at MIT-AI +To: (BUG ITS) at MIT-AI + +the same thing just happenned again! +Chris Stacy + +Date: 28 APR 1980 0326-EDT +From: CSTACY at MIT-AI (Christopher C. Stacy) +Sent-by: CSTAC0 at MIT-AI +To: (BUG ITS) at MIT-AI + +I was logged out with the normal console free message, +but I did not issue a logout command of any sort. I was +apparently not being gunned. When I Zd back up and logged +in, I was logged in as CSTAC0...ie, no detatched trees!?! +This occurred on AI. Whatsit mean??? +Chris + +CBF@MIT-MC 04/27/80 15:15:39 Re: Archive device +To: (BUG ITS) at MIT-MC +The file AR6:CBF;1980 MINS seems to be perpetually locked. There is no +job which has it open. Can this be repaired and is there a procedure +for repairing should this occur again? + + +Date: 25 April 1980 14:00-EST +From: Robert W. Kerns +Sender: ___126 at MIT-MC +To: BUG-ITS at MIT-MC + +If the number that PEEK prints just after the foreign address is the +foreign connection number, then a second LSN by another job while waiting +for the other host to get the OPN can somehow get the same connection! +The number PEEK printed was identical for both jobs. + +See HMR;.PEEK. >, the number 12541 is the one I'm talking about. + +Am I misunderstanding what I'm seeing or is this an ITS bug? + +(Note that while the state shown is INCXMT, there was a period while they +were both in OPEN) + + +Date: 20 APR 1980 1943-EST +From: EB at MIT-AI (Edward Barton) +To: (BUG ITS) at MIT-AI + +Why is it that when logging in from a dialup or a STY (with :PTY) +that one gets the message "Tremont is Spooling and waiting" +before the AI ITS.1168 etc ?? + +Date: 14 Apr 1980 (Monday) 2358-EDT +From: WESTFW at WHARTON (William Westfield) +Subject: :F SEEMS TO BE MESSED UP +To: BUG-ITS at MIT-ML + +IF YOU DO JUST A :F, THINGS WORK PROPERLY, BUT IF YOU DO SOMETHING LIKE +:F BILLW +IT GOES INTO WHAT APPEARS TO BE AN INFINITE LOOP, IN WHICH IT KEEPS +REOUTPUTTING THE TTY OUTPUT BUFFERS (?). I THINK :FINGER STILL WORKS +PROPERLY. +BILLW + + + +SAM@MIT-AI 04/08/80 21:21:30 +To: (BUG its) at MIT-ML +One of the ML dialups is very bad. It starts out fine then worsens +to the point where you can't get any characters over the line. +Its one of the 300 baud ones. I have no way of saying which +it is, +--Sam + + + +Date: 4 APR 1980 2026-EST +From: JNC at MIT-AI (J. Noel Chiappa) +Sent-by: ___050 at MIT-AI +Subject: Logging in on AI... +To: (BUG ITS) at MIT-AI + + Gets you the message "84375 Memory errors in 23.4 Hours". +Is this machine serious, or do I detect little elves at work? + +EAK@MIT-MC 04/01/80 17:34:17 +To: (BUG ITS) at MIT-MC +"MC TOPS-20 V4.0 Console 60 Fried"? + + +Date: 29 MAR 1980 1249-EST +From: AGRE at MIT-AI (Philip E. Agre) +To: (BUG DDT) at MIT-AI, (BUG ITS) at MIT-AI +CC: AGRE at MIT-AI + +I think that the "excessive tourist usage may lead to a restricted policy" +clause in the MIT-AI ITS login message sounds like a very unfriendly threat. +I don't think that we have made sufficient efforts yet to explain to +tourists exactly what the state of the world is and what is the behavior +that is expected of members of the MIT-AI community. Such explanations +should be made, and individuals who refuse to cooperate with us should +be singled out for threats rather than just threatening hundreds of our +guests for the misdeeds of a few. (And there ought to be more to this than +an occasional flame by someone who has discovered a new form of tourist +ignorance or misbehavior.) - Phil + +Date: 28 MAR 1980 1707-EST +From: JERRYB at MIT-AI (Gerald R. Barber) +To: (BUG ITS) at MIT-AI + +What happened to fido? I hope he didn't die of old age. + +Date: 26 MAR 1980 2207-EST +From: KLH at MIT-AI (Ken Harrenstien) +To: (BUG ITS) at MIT-AI + +SYSMSG should show more stuff. Nowadays things happen so +fast (logins/outs) that if, e.g. my net connection breaks, +by the time I get back 2 minutes later (yes two minutes) +any evidence as to the nature of the lossage has long vanished +from the minor fragments SYSMSG knows about. Foo. + +Date: 25 MAR 1980 1908-EST +From: MOON at MIT-MC (David A. Moon) +Subject: DIRHNG: +To: EBM at MIT-XX +CC: (BUG its) at MIT-AI + + Date: 25 Mar 1980 1118-EST + From: EBM at MIT-XX + Subject: DIRHNG: + To: bug-its at MIT-AI + + I believe that creating new links in a directory should also result + in an interrupt on the channel open to the DIRHNG: device. +It does. + [Also, + I have always believed that one should be able to read the device, + which will result in hanging until a file is closed. The data + returned could be garbage, or 0 -- it does not matter. The point + is that one should not be REQUIRED to use interrupts for such + things if they are unnecessary.] +Maybe, but interrupts are trivial to use. + Having a piece of documentation + available on DIRHNG: would be nice, too. E.g., :call open, or + something. +Yes, it should be. + + +Date: 25 Mar 1980 1118-EST +From: EBM at MIT-XX +Subject: DIRHNG: +To: bug-its at MIT-AI + +I believe that creating new links in a directory should also result +in an interrupt on the channel open to the DIRHNG: device. [Also, +I have always believed that one should be able to read the device, +which will result in hanging until a file is closed. The data +returned could be garbage, or 0 -- it does not matter. The point +is that one should not be REQUIRED to use interrupts for such +things if they are unnecessary.] Having a piece of documentation +available on DIRHNG: would be nice, too. E.g., :call open, or +something. +------- + +Date: 24 MAR 1980 2012-EST +From: agre at MIT-AI (Philip E. Agre) +Sent-by: GJS at MIT-AI +To: (BUG ITS) at MIT-AI + +How about a program that asks all tourists to log out? + +Date: 24 MAR 1980 1915-EST +From: AGRE at MIT-AI (Philip E. Agre) +To: (BUG ITS) at MIT-AI + +Is there a program that says "change working directory to my home directory"? + +Date: 24 March 1980 17:24-EST +From: "Guy L. Steele, Jr." +Subject: Comma in ^O filespec loses!! +To: KLH at MIT-AI, BUG-ITS at MIT-AI, BUG-DDT at MIT-AI + +It is semi-well-known that a comma ends a filespec in DDT, as does +a CR; CR in addition ends the command. Consider :RENAME, for example; +if you type :RENAME FOO GREPS,BARF GREPS the comma terminates +the first file name and the second altmode redisplays the second +file name. This is actually useful. However, had one used + instead of :RENAME (), then the comma terminates the +command, but the command doesn't "run" until the second altmode +is typed. Moreover, any stuff after the comma is lost -- the second altmode +doesn't redisplay it or anything. Maybe for safety's sake the number +of commas should be counted and a complaint registered if there are +too many. Also, typing an altmode should NEVER cause the command to be run! +The whole point is to be able to see the name of the file you are +about to dastardly mung. + +Date: 21 MAR 1980 2132-EST +From: KLH at MIT-AI (Ken Harrenstien) +Subject: Comma in ^O filespec loses!! +To: (BUG ITS) at MIT-AI, (BUG DDT) at MIT-AI + +Goddamit, I did an ^O and it said that it was about to +delete ".FOO X". I typed in ",FOO X" which was what +i really wanted to delete (the comma was mis-typed in an append +command), and the '"'$)#$)"#%#("$'$ went ahead and screwed me +by flushing the original ".FOO X" file!!!! Snarrrl!! +Just what meaning is a comma supposed to have in a delete +command anyway??? The FN1 wasn't changed at all.... +you'd at least have expected it to try deleting "FOO X". + +Date: 20 MAR 1980 0913-EST +From: RICH at MIT-AI (Charles Rich) +Subject: Device Handling +To: ED at MIT-AI, MOON at MIT-AI +CC: (BUG ITS) at MIT-AI + +Ok, with the help of your replies I think I understand the +problem: the various machines do not recognize THEMSELVES +as a valid device combined with ARn in the same way as +other machines. This makes it much less convenient to write +code which will run on any machine. + +For example, on AI + + :LISTF AIAR3:RICH; + +doesn't work, but on other machines it does. +Ed, you are right, the extra colon was never right; +the form + + :LISTF AI:AR3:RICH; + +only worked on AI because the first AI: was thrown away. + + I now think we have now narrowed this down to an +honest-to-goodness bug. + + Thanks, Chuck. + +Date: 20 March 1980 03:09-EST +From: Ed Schwalenberg +Subject: Device Handling +To: RICH at MIT-AI, BUG-ITS at MIT-AI + + On AI you type + :LISTF ML:ARn:UNAME; +I can' believe that this ever worked, or could work. It certainly +does not work now. + :LISTF MLARn:UNAME; +This has always been the form recognized by ITS. The unknown device +handler checks to see if the first 2 chars are a machine name, and hands +the rest of the device name to that machine. Inserting an extra : will +cause most filename readers to ignore the ML: by clobbering the device +field with ARn:. The exception is :FIND, which makes a LIST of all +devices (and directories) to be searched. Is it possible you were led +down the garden path by having similar archives on 2 machines? Experiment +with the MLTTY: device and you will see that MLTTY: gives you ML's, ML:TTY: +gives you AI's (TTY:) and TTYML: gives you NO SUCH DEVICE (the FIRST 2 chars +must be the machine name. + +Date: 19 MAR 1980 1824-EST +From: RICH at MIT-AI (Charles Rich) +Subject: Device Handling +To: (BUG ITS) at MIT-AI + +On AI you type + + :LISTF ML:ARn:UNAME; + +to refer to an archive on another machine, but +on DM you type it without the extra colon, i.e. + + :LISTF MLARn:UNAME; + +to get the same effect. The alternative form on +either machine loses. Sigh... it would be nice +if it were compatible, no? + +Date: 17 March 1980 21:12-EST +From: Ed Schwalenberg +To: AGRE at MIT-AI, BUG-ITS at MIT-AI +cc: SHADOW at MIT-AI + + Date: 17 MAR 1980 1509-EST + From: AGRE at MIT-AI (Philip E. Agre) + Sent-by: SHADOW at MIT-AI + + I did agrectl-s then :xfile agre;agre login on shadow's terminal, + so I could read my mail without logging shadow out. It did all the + gmsgs's right, but when it finally called :rmail, it did it on shadow's + mail file. agrectl-s :rmail works right, so I suspect that + the agrectl-s wasn't able to distribute over the whole :xfile + execution. This led to a rather embarrasing error. Can it be fixed, + or is it a feature? - Phil +From DDT ORDER: +$^S + causes the next ^K, ^H or :-command, if it runs a program, to + run it "as if were running it". Precisely, its .XUNAME + variable will be instead of you and its .HSNAME will be set to + 's HSNAME. If the program follows the current convention, it + will use 's init file, etc. $^S works by setting the ..TUNAME + and ..THSNAME variables. +Since your XFILE runs 2 programs, you lose. + +Date: 17 MAR 1980 1509-EST +From: AGRE at MIT-AI (Philip E. Agre) +Sent-by: SHADOW at MIT-AI +To: (BUG ITS) at MIT-AI +CC: SHADOW at MIT-AI + +I did agrectl-s then :xfile agre;agre login on shadow's terminal, +so I could read my mail without logging shadow out. It did all the +gmsgs's right, but when it finally called :rmail, it did it on shadow's +mail file. agrectl-s :rmail works right, so I suspect that +the agrectl-s wasn't able to distribute over the whole :xfile +execution. This led to a rather embarrasing error. Can it be fixed, +or is it a feature? - Phil + +Date: 15 MAR 1980 2140-EST +From: KLH at MIT-AI (Ken Harrenstien) +To: EAK at MIT-MC +CC: (BUG ITS) at MIT-AI + + Date: 9 February 1980 13:00-EST + From: Earl A. Killian + + How about changing the definition of %TDICP n from being "insert + n blanks in the current line" to being "insert next n characters + in the current line"? I suspect that no programs would have to + change (i.e. TECO wouldn't). The reason for the chnage would be + to allow insertion to happen more reasonably on some terminals + (in particular those with an insert character mode), without + making it any less efficient for terminals like TVs or the + Teleray. CRTSTY would make use of the new constraint on what can + follow a %TDICP, and maybe ITS could too. + +I don't think it would be a good idea to change the %TDICP definition. +The idea is certainly clever, but I am paranoid about what could +happen if the output stream was interrupted or otherwise disrupted +while counting down these N characters, since this is also in effect +quoting the next N characters. It seems much more robust to have a +way to enter insert-char mode and leave it; then a reset of this mode +would always be effective. It would also be just as efficient, since +a %TDICP N is two characters plus the string, whereas a %TDSIC and +%TDEIC (Start & End insert-char mode) is also just two chars plus the +string. I don't see anything wrong with having more %TD codes, except +that a TTYOPT bit might be needed to say whether the terminal could +handle it or not; if not, ITS would just simulate it with %TDICP's. + +MOON@MIT-MC 03/14/80 10:50:49 Re: Your bug report about translations +To: KMP at MIT-MC +CC: (BUG ITS) at MIT-MC, ECC at MIT-AI +Presumably the underlying cause is that translations don't affect the +RENMWO system call. It is not obvious that they should, or what would +be a consistent way of doing so. Fortunately translations are mainly +useful for devices and directories rather than file names. + +KLH@MIT-MC 03/14/80 04:59:05 +To: (BUG ITS) at MIT-MC +I think someone has barfed about this before, but... +Is it really the right thing to turn foo < into foo > +when writing?? + + +KMP@MIT-MC (Sent by TURNIP@MIT-MC) 03/14/80 04:46:16 +To: (BUG ITS) at MIT-MC, KMP at MIT-MC, ECC at MIT-AI +CC: (BUG GMSGS) at MIT-MC +Sigh. This 'feature' of writing to a temp file turns out to affect GMSGS +for ECC ... We were just trying to isolate simpler cases, but the original +('real') attempt was to get GMSGS to output to a different file than +xuname MAIL ... Its writing to a temp file and then Rename-While-Opening +without checking translations is what prompted all this I guess. + + +ED@MIT-AI 03/14/80 02:56:10 +To: ECC at MIT-AI, KMP at MIT-MC, (BUG ITS) at MIT-MC +Both TECO and DDT are too smart for their own good, sometimes. +The file OPENed in both cases (and thus subject to translations) +is KMP;_TECO_ OUTPUT (or _COPY_ for DDT.). When the file is completely +written, it is RENMWOed to FOO BAR, which operation is NOT subject +to translation. +There is a teco command to write output directly without renaming, +search for "core link" in TECO ORDER for suggestions. + + +KMP@MIT-MC 03/14/80 01:07:49 +To: (BUG ITS) at MIT-MC, ECC at MIT-AI +CC: KMP at MIT-MC +Doing  KMP;FOO BAR,KMP;BAR FOO on MC and then :CREATE'ing KMP;FOO BAR +still creates the file FOO BAR. :COPY TTY:, ... gives similar results +so I doubt this is a Teco problem. When I try to read the file, I get +a file not found error because an input translation has been created but +not an output translation... o ... produces the same results. In the +former case, PEEK shows that there exists an IO translation. In the latter, +it says there is just an output translation -- but in neither does it +keep from writing to FOO BAR as a truename as it should. Can someone please +fix this or tell me why I am misunderstanding what output translations +are capable of? Thanks. +-kmp + + +Date: 13 MAR 1980 1857-EST +From: JERRYB at MIT-AI (Gerald R. Barber) +To: (BUG ITS) at MIT-AI + + +One outcome of the disk storage crunch getting worse and worse is that there +will be more randoms deleting random files. + +It seem like a program that would combine the facilities of COMMON;FIND JUNK +and DIRED would be useful. In addition, it would keep track of what files +were deleted and who deleted them. In this way people would be less tempted +to do rash deletions. It might do other things such as refusing +to delete files that have not been backed up, files that are > versions and +files where the file name is of a specific structure etc. + +Date: 11 MAR 1980 1945-EST +From: EB at MIT-AI (Edward Barton) +To: (BUG ITS) at MIT-AI + +Why does :COPYing to other machines so often hang up doing +an SAUTH ? That has happened about five times today. + +RWK@MIT-MC (Sent by ___036@MIT-MC) 03/06/80 04:07:41 Re: TTY hangage +To: (BUG ITS) at MIT-MC +I don't know if anybody cares, but it's possible to wedge a TTY completely +by doing :SPRT EJS;STYOUT DEBUG on MC. This outputs a random asii file +as 8-bit codes. I don't know if the TTY code claims not to wedge TTY's +in the case of garbage super-image output, but if it does, here's a +counter-example. + + +Date: 4 MAR 1980 1437-EST +From: gls at MIT-AI (Guy L. Steele, Jr.) +Sent-by: RICH at MIT-AI +To: MOON at MIT-AI +CC: GLS at MIT-AI, (BUG DDT) at MIT-AI, (BUG LISP) at MIT-AI +CC: (BUG ITS) at MIT-AI, (BUG TECO) at MIT-AI, (BUG EMACS) at MIT-AI +CC: (BUG LISPM) at MIT-AI, cpr at MIT-MC + +Last note from RICH was really from GLS. + +Date: 4 MAR 1980 1434-EST +From: RICH at MIT-AI (Charles Rich) +To: MOON at MIT-AI +CC: GLS at MIT-AI, (BUG DDT) at MIT-AI, (BUG LISP) at MIT-AI +CC: (BUG ITS) at MIT-AI, (BUG TECO) at MIT-AI, (BUG EMACS) at MIT-AI +CC: (BUG LISPM) at MIT-AI, CPR at MIT-MC + +One obvious application of the Greek/Front key on the PDP-10 +is that all such characters could be self-inserting in TEX format; +thus typing  would insert "\alpha", etc. I don't know how much +more convenient this would make it to type weird formulas in TEX. + +Date: 3 MAR 1980 2337-EST +From: MOON at MIT-MC (David A. Moon) +Subject: Use of New Keyboards with ITS. +To: JLK at MIT-MC +CC: CPR at MIT-MC, (BUG DDT) at MIT-MC, (BUG LISP) at MIT-MC +CC: (BUG ITS) at MIT-MC, (BUG TECO) at MIT-MC + +I don't think ITS is going to be able to accomodate all of the new +modifier bits. There are no free bits in the present internal +(18-bit) character code. I don't think making Greek input work +is very important, since we certainly aren't going to go to the +very large amount of trouble required to make Greek output work +and have a more-than-7-bit printing-character set. + +It would be nice to make Super and Hyper work to ITS, although there +are not enough bits available. Note that shift-lock has already been +recycled. Shift is sort of recycled and sort of vestigially still +there; it could be recycled for this. It isn't necessary to be able to +represent all 16 combinations of the "bucky bits"; for instance there +are 8 combinations of 0, 1, or 2-adjacent buckies. + +Since the function keys are there, you may as well make up top+>40 +codes for them. Some of the function keys map into keys on the old +keyboard; see the #\ table in LMIO;READ for something from which this +mapping can be derived, as we are doing it on the Lisp machine now. +From memory, it's clear-screen->form, delete->vt, clear-input->clear, +macro->back-next (but should be system->backnext in your case), terminal->esc. + +It's not obvious that new keyboards will ever be attached to the AI TVs. +We might, and we might not. It would involve slowing down the keyboard +scanner substantially, and we might have to put some buffering in the +keyboard microprocessor. + +Date: 3 March 1980 21:41-EST +From: John L. Kulp +Subject: Use of New Keyboards with ITS. +To: MOON at MIT-MC +cc: CPR at MIT-MC, BUG-DDT at MIT-MC, BUG-LISP at MIT-MC, + BUG-ITS at MIT-MC, BUG-TECO at MIT-MC + +We are going to hook up a new kbd to the PTV system in the next few +days, and the obvious question comes up about how to encode all +the function keys. I suppose they could be handled the way +they are on the old keyboard, namely send chars with the TOP bit + +100 + . In order to distinguish them from the old kbd, +how about encoding them in 140-177? Presumably the extra modifier +bits (SUPER, HYPER, and GREEK) need to be allowed (that uses up +all the bits available in the intelligent terminal protocol, unless +we want to flush SHIFT and SHIFT-LOCK). It doesn't much matter +what the encoding is, as long as its documented. I guess any +part of the system which masks off the high modifier bits or +otherwise depends on them being zero will have to get looked at. + +ITS presumably wants to know about the SYSTEM key (treat like BACK/NEXT). + +Its about time DDT knew about CLEAR (or CLEAR INPUT on the new kbds) which +should behave like ^D. Also, HELP, STOP OUTPUT (^S, actually this should +probably be defined to do an output hold at the terminal, followed by an +output reset from the remote process (as is currently done)), ABORT (^G), END +(^C), RESUME ($P), etc. + +TELNET and SUPDUP should be informed about the NETWORK key. + +Various programs should know about END, ABORT, RESUME, BREAK, QUOTE, HELP, +STATUS (I'm not saying every program in the world should be retrofitted +to know about these, but the basic ones -- DDT, TECO, LISP -- probably +should). + +I suspect that not much is going to happen on this until AI TV's start +getting new keyboards, but I would at least like to see the encoding +defined now, so that where only simple changes are required, they +can be done quickly when desired. + + + +Date: 3 MAR 1980 1201-EST +From: AGRE at MIT-AI (Philip E. Agre) +To: (BUG ITS) at MIT-AI + +The terminal controller still seems to think that CADR-2 is still in 907. +x6765 gets an occasional call looking for the person on CADR-2. + +CFFK@MIT-MC 03/01/80 19:04:16 +To: (BUG PEEK) at MIT-MC, (BUG ITS) at MIT-MC +In PEEK M mode on a Macsyma I was running gave: +Mem=216, Top=254, Shared=158, Out=-1, Total=215 +What does Out=-1 signify? + +KLH@MIT-MC 03/01/80 18:40:23 +To: MOON at MIT-MC +CC: (BUG ITS) at MIT-MC +I think FAST-APPEND can win using the following algorithm: +------------------- +If canonical file doesn't exist: + Check for AOS'd version, and rename to canonical. +Find message-EOF of file: + Re-open in read mode if not already in. + Set .ACCESS ptr to file-EOF + Read backwards until a msg-EOF mark is seen (ie ctl-_) +If canonical file already existed, msg-EOF is set to file-EOF. +Re-open file in write-over mode +Set .ACCESS ptr to msg-EOF +Write message. + If IOC for some reason, just stop. +Close channel. +------------------- + Note that there is no need to do anything about RENMWO'ing, +because following attempts will always start at the right place, and +it doesn't matter if the next attempt doesn't quite extend past the +true file EOF, because following appends will still back up to the +new msg-EOF mark. + It would be a LOT more efficient if there +was some way to both read and write the file while it was open; +ironically enough the only way to do this now is to map into the +system buffer and see what's there!! The data is there, but the +system won't let you get at it. Foo. + It would probably be easier to allow some way of doing +this dual I/O ("read-while-locked"?) mode than to hack APPEND mode, +since it doesn't depend on anything fundamental to the UFD. + Another idea is for ITS to support this algorithm internally, +given the EOF delimiter(s) as argument. Might be invoked by an OPEN +mode bit, or a new CALL. This requires even less overhead and +makes the feature generally available. This also +prevents race conditions since presumably one process would be +locked out while the other's APPEND effort progressed; this sort of +system-supported reliability could also make it reasonable to +use FAST-APPEND on normal MAIL files (since the FN2 is just 4 letters +and an AOS will stand out). + +I'd claim this is a lot more useful than ECHOIN's hacking TECO buffers! +The amount of really gross disk I/O that the COMSAT does seems to far +exceed the amount of TTY-echo overhead being done, especially on AI. + +Any comments on this scheme? (No, I'm not likely to stop trying.) + + +BARRYG@MIT-MC 02/29/80 20:30:10 Re: filenames for automatic deletion +To: (BUG ITS) at MIT-MC +I use EMACS in autosave mode and I'm getting tired of cleaning up after +it. I'm stuck with a filename1 of BARRYG (by convention), so is there +a filename2 that will cause the file to be automatically reaped? +If there is, it will simplify life as I want to keep the number of +files I leave around to a minimum. + /barry gold + +Date: 1 December 1979 12:10-EST +From: Robert W. Kerns +Subject: Directory block shuffle +To: GLS at MIT-AI +cc: BUG-ITS at MIT-AI, DLW at MIT-AI + +It would be better to make it store the UNAME in the word with the reference +date, so you could find out who even if the person didn't have a directory +of his own.... + + +Date: 11 December 1979 10:34-EST +From: Earl A. Killian +Subject: sorting +To: BARRYG at MIT-MC +cc: BUG-DDT at MIT-MC, BUG-ITS at MIT-MC + + Date: 12/11/79 00:44:04 + From: BARRYG at MIT-MC + To: (BUG DDT) + cc: (BUG ITS) + Re: sorting + + Is there a way to sort a file on this system? If it's easier to do than + explain, the file I want to sort is MC:GUEST1;BARRYG YAMATO to be sorted + in ascending order on the first 40 characters of each line. + +Yes, try +  40c  l  +in TECO.  is the sort command - the first command string moves +from the beginning of the record to the beginning of the key, the +second command moves to the end of the key, and the third to the +end of the record. + + +MACRAK@MIT-MC 12/13/79 17:28:41 +To: (BUG ITS) at MIT-MC, (BUG SYS) at MIT-MC +CC: RWK at MIT-MC +ARGGGGH!! + +.open [1,,'nul] +.status -> 2121 + +.open [1,,'dsk ? 'foobar ? 'quuzey] +.status -> 43 + +What happened to the 100 bit?? (write) +Peek seems to know that the chnl is opened for writing. +Why doesn't .status?! + +ED and ALAN and 42TLNT TELSER@MIT-MC (Sent by ALAN@MIT-MC) 02/28/80 03:02:19 Re: .FLT1 and 2 +To: (BUG ITS) at MIT-MC +These seem to be initialized to %pibrk and 0 on MC and +not initialized elsewhere. Elsewhere, in fact, they seem +to contain the UNAME and JNAME of the last job to .LOGOUT +of that job slot (?!?!?) +What are these, anyway? They aren't documented anywhere. +Looking in the system also seems to comfirm that these values +are used for COMPLETELY RANDOM stuff like the RENAME case of +.MLINK ((??!!??!!??)) + +EJS@MIT-MC 02/26/80 20:24:16 +To: (BUG ITS) at MIT-MC + +:call echoin +and +:call ttyesc + +do not provide documentation on the respective system calls. Could +somebody please update the doc file? Thanks. + +MOON@MIT-MC 02/24/80 21:37:03 +To: ECC at MIT-MC +CC: (BUG ITS) at MIT-MC + ECC@MIT-MC 02/24/80 21:31:43 + To: (BUG ITS) at MIT-AI + The TV in 902 was garbling a lot of bits on the screen, in particular + making the finger display shown when it is logged out almost totally + unreadable. I logged in to see if :FINGER would produce a more readable + listing, which it sorta did. However when I then logged out, it gave + a little "bizzap!" sound (not very noisy) and the screen went blank, + with nothing that I could type bringing it back. +The garbling of bits was a central problem which I believe I have just fixed. +If the screen is still blank, try turning the monitor off and back on (if you +can't find the plug, pull the fuse in the back out and put it back in.) + +ECC@MIT-MC 02/24/80 21:31:43 +To: (BUG ITS) at MIT-AI +The TV in 902 was garbling a lot of bits on the screen, in particular +making the finger display shown when it is logged out almost totally +unreadable. I logged in to see if :FINGER would produce a more readable +listing, which it sorta did. However when I then logged out, it gave +a little "bizzap!" sound (not very noisy) and the screen went blank, +with nothing that I could type bringing it back. + +JLK@MIT-MC 02/11/80 09:05:07 +To: (BUG @) at MIT-MC +CC: (BUG ITS) at MIT-MC +I think it is a rather major loss that :@ defaults to MIDAS or somesuch, given the +relatively few users of @ who make MIDAS listings. If one were to base the defaults +on numbers, it should default to LISP code. But I don't suggest that. +:@ +with no other JCL should obviously be the same as :@ /L[RANDOM]/D[DOVER]/# +these days. + + +Date: 10 FEB 1980 0203-EST +From: bak at MIT-AI (William A. Kornfeld) +Sent-by: ___101 at MIT-AI +To: (BUG ITS) at MIT-AI + +This is a qubbling point, but if someone is REALLY bored he may +wish to fix it. + +If an archive is on an unmounted disk (i.e. SECOND) and you do +an AR2^F, it gives an incorrect error message. It thinks AR2 +is a non-existent directory. The correct error message should +be PACK NOT MOUNTED. + +MOON@MIT-MC 02/09/80 16:25:23 Re: %TDICP suggestion (EAK) +To: (BUG ITS) at MIT-MC +CC: EAK at MIT-MC +Hmm, clever. Sounds like it would work. + +Date: 9 February 1980 13:00-EST +From: Earl A. Killian +Subject: %TDICP suggestion +To: BUG-ITS at MIT-MC + +How about changing the definition of %TDICP n from being "insert +n blanks in the current line" to being "insert next n characters +in the current line"? I suspect that no programs would have to +change (i.e. TECO wouldn't). The reason for the chnage would be +to allow insertion to happen more reasonably on some terminals +(in particular those with an insert character mode), without +making it any less efficient for terminals like TVs or the +Teleray. CRTSTY would make use of the new constraint on what can +follow a %TDICP, and maybe ITS could too. + + +Date: 9 February 1980 13:00-EST +From: Earl A. Killian +To: BUG-ITS at MIT-MC +cc: %TDICP SUGGESTION at MIT-MC + +How about changing the definition of %TDICP n from being "insert +n blanks in the current line" to being "insert next n characters +in the current line"? I suspect that no programs would have to +change (i.e. TECO wouldn't). The reason for the chnage would be +to allow insertion to happen more reasonably on some terminals +(in particular those with an insert character mode), without +making it any less efficient for terminals like TVs or the +Teleray. CRTSTY would make use of the new constraint on what can +follow a %TDICP, and maybe ITS could too. + + +Date: 9 FEB 1980 0941-EST +From: GRAND at MIT-AI (Mark D. Grand) +To: (BUG ITS) at MIT-AI + + How does one go about recovering a file that (I presume) +was reaped? + +CFFK@MIT-MC 02/07/80 10:21:33 +To: (BUG ITS) at MIT-MC +I was logged into TTY 7, and all of a sudden nearly everything I typed +gave IBO. + +Date: 27 JAN 1980 0457-EST +From: DLW at MIT-AI (Daniel L. Weinreb) +To: (BUG ITS) at MIT-AI + +Someone should document the ECHOIN system call. + +Date: 25 January 1980 01:40-EST +From: Robert W. Kerns +To: DLW at MIT-AI +cc: AGRE at MIT-AI, BUG-ITS at MIT-AI + + Date: 23 January 1980 01:17-EST + From: Daniel L. Weinreb + To: AGRE at MIT-AI, BUG-ITS at MIT-AI + + Date: 22 JAN 1980 2028-EST + From: AGRE at MIT-AI (Philip E. Agre) + ... + + BUG-ITS: Does anyone think it might be more useful to display the + MSNAME in the wholine, given that the SNAME is rather arbitrary? + The main use I can see for the SNAME is that it seems to correlate with + the *PRINT, :LISTF etc default directory in HACTRN, but I am not + sure how good this correlation is. +The TV can't display the MSNAME. The MSNAME lives only in DDT. (It could +be added to ITS, but...) DDT's SNAME should correspond pretty well with +the :PRINT default, which is a more useful thing to display. You don't change +your MSNAME very often. + + +BEN@MIT-ML 01/24/80 08:42:45 +To: (BUG ITS) at MIT-ML +I use a Teleray 1061 with SIPB prom, and the display of overlong +lines seems to be incorrect. I suspect that both the terminal and +ITS are providing an extra , because the continuation skips +a line before writing the remainder of the line. If something was +previously on the skipped line, it remains (i.e. nobody does a +clear-to-end-of-line on ). This makes the text remarkably +difficult to read. This happens most noticeably in RMAIL. + + Ben Kuipers + + +GSB@MIT-ML 01/23/80 10:41:35 Re: ml lpt +To: (BUG ITS) at MIT-ML +CC: WAM at MIT-ML +There are two consecutive columns near the left margin that don't +print at all. + + +Date: 23 JAN 1980 0117-EST +From: DLW at MIT-AI (Daniel L. Weinreb) +To: AGRE at MIT-AI, (BUG ITS) at MIT-AI + + Date: 22 JAN 1980 2028-EST + From: AGRE at MIT-AI (Philip E. Agre) + + When you do a :CWD on a TV, the current-directory entry on the bottom + line of the screen doesn't change to the new value until you use the + directory, say by ^F'ing it. +Philip: This is because the TV is showing you the "SNAME" of the +running job, rather than the "MSNAME"; the latter is what is +set by the :CWD command. +BUG-ITS: Does anyone think it might be more useful to display the +MSNAME in the wholine, given that the SNAME is rather arbitrary? +The main use I can see for the SNAME is that it seems to correlate with +the *PRINT, :LISTF etc default directory in HACTRN, but I am not +sure how good this correlation is. + +Date: 22 JAN 1980 2028-EST +From: AGRE at MIT-AI (Philip E. Agre) +To: (BUG ITS) at MIT-AI + +When you do a :CWD on a TV, the current-directory entry on the bottom +line of the screen doesn't change to the new value until you use the +directory, say by ^F'ing it. + +MOON@MIT-MC 01/15/80 09:31:33 +To: JONL at MIT-MC +CC: (BUG ITS) at MIT-MC + JONL@MIT-MC 01/15/80 01:37:49 + To: (BUG ITS) at MIT-MC + It would be nice to be able to display a directory with only + the PRIMARY device shown - but FIND PK0:foo;* * shows all + the SECOND: and THIRD: files too. +The correct command is :FIND foo;* * &PACK 0. I am surprised that +giving "PK0:" in a :FIND does not give you an error; I guess it +must be simply ignored. + +JONL@MIT-MC 01/15/80 01:37:49 +To: (BUG ITS) at MIT-MC +It would be nice to be able to display a directory with only +the PRIMARY device shown - but FIND PK0:foo;* * shows all +the SECOND: and THIRD: files too. + + +JLK@MIT-MC 01/14/80 12:46:25 +To: (BUG ITS) at MIT-MC +Well T37 is once again in the wedged state where ist output buffer pointer is +garbaged. Is there a way to patch this to make it functional again? +(I realize its probably impossible to track down this problem) + + +MOON@MIT-MC 12/27/79 08:04:42 Re: .STATUS and .CALL STATUS broken +To: MACRAK at MIT-MC +CC: (BUG ITS) at MIT-MC +I thought I answered it. It's fixed in the source. It had evidently +been broken for many years. + +HAL@MIT-MC 12/26/79 22:24:08 +To: (BUG ITS) at MIT-MC, (BUG CRTSTY) at MIT-MC + +i just sent a bug message about not being able to run crtsty. i now +realize that this occurred because, at the moment i tried to run it, +disc space went to zero. so i guess you can ignore the previous bug +message. + +HAL@MIT-MC 12/26/79 22:02:39 +To: (BUG ITS) at MIT-MC, (BUG CRTSTY) at MIT-MC + +Has there just been some change to MC ITS ? Suddenly I can't seem to +run CRTSTY . + +MACRAK@MIT-MC 12/26/79 21:18:38 +To: (BUG ITS) at MIT-MC +I never received an answer about my complaint that .Status problem: +namely, .Status doesn't seem to correctly report whether a Dsk +or TTY channel is input or output! +Try: +100/ $$0' !DSKfoo >$ +.open 100$x +.status$x +0/ 43 (not 143) +This does not seem to depend on the mode of output (image, block) +nor anything else I can find. + +Can anyone tell me how to find out whether a channel is open for input +or output if this isn't considered a bug??? + +MOON@MIT-MC 12/20/79 00:07:07 +To: MRC at MIT-AI +CC: (BUG ITS) at MIT-MC + Date: 19 DEC 1979 2137-EST + From: MRC at MIT-AI (Mark Crispin) + To: (BUG ITS) at MIT-AI + + Why does .CALL USRVAR insist upon MOVEM for the return argument value? + It should allow 2000,, like the rest of .CALL does. + +It is not the same. The arguments to USRVAR, TTYVAR are really +instructions. + +Date: 19 DEC 1979 2137-EST +From: MRC at MIT-AI (Mark Crispin) +To: (BUG ITS) at MIT-AI + +Why does .CALL USRVAR insist upon MOVEM for the return argument value? +It should allow 2000,, like the rest of .CALL does. + +Date: 19 DEC 1979 2125-EST +From: MRC at MIT-AI (Mark Crispin) +To: (BUG ITS) at MIT-AI + +TELNET failed to assemble because %TXSFL apparently is no longer +defined. All TELNET used it for was to turn the bit off along +with %TXSFT. I removed the reference; can TELNET trust that that +bit will never be on? + +DLW@MIT-MC (Sent by DLW0@MIT-MC) 12/14/79 08:39:37 +To: (BUG ITS) at MIT-MC +It appears that ITS does not understand what %TOSAI on a DM2500 is +supposed to do. On the SAIL-modified DMs, as well as our fake DMs, +you send escape (033) followed by the low-order code in order to make +it print an extended graphic. Could ITS be changed to transmit this +sequencefor terminals with TCTYP of DM2500 with the %TOSAI bit +set? This is not urgent... + + +BARRYG@MIT-MC 12/11/79 00:44:04 Re: sorting +To: (BUG DDT) at MIT-MC +CC: (BUG ITS) at MIT-MC +Is there a way to sort a file on this system? If it's easier to do than +explain, the file I want to sort is MC:GUEST1;BARRYG YAMATO to be sorted +in ascending order on the first 40 characters of each line. + +Date: 3 DEC 1979 0116-EST +From: jnc at MIT-AI (J. Noel Chiappa) +Sent-by: PK at MIT-AI +Subject: Shutting down an ITS +To: (BUG ITS) at MIT-AI + + It sort of unflavorful that you have to wait at least 5 mins +to shut down the system (etc LOCK). In an emergency, you might want +a fast shutdown to repatriate disk bufs, etc.... preumably one could +patch, say, SHUTDN to the right thing, but it would be nice if there was +a good way to do this without such hacks... + +Date: 30 NOV 1979 1458-EST +From: GLS at MIT-AI (Guy L. Steele, Jr.) +To: (BUG ITS) at MIT-AI +CC: GLS at MIT-AI, DLW at MIT-AI + + MSG: LOSER 1 + DLW@MIT-AI 11/29/79 19:23:09 Re: Don't delete other people's files! + Some very recently deleted a group of files on my directory. + These were very important information, and some had been + quite recently modified. If you are trying to create disk + space, ASK people to delete their own files--don't do it yourself! + The ITS no-security system can only work in an environment of + reasonable, responsible people; deleting other people's files + like this is highly irresponsible. + +I wonder how hard it would be to make the following modifications +to the disk routines: +[a] when a file is deleted, shuffle its five-word block to the +middle of the directory rather than just overwriting it. Thus, a +rotation of a number of five-word blocks would occur, I think. +[b] install the uname of the deleting job as the file's "author". + +This would tend (though not guarantee) to preserve information +as to who deleted a file. It might make it easier to deal with this +problem, which has come up a lot recently. + +RWK,RMS@MIT-MC (Sent by RWK@MIT-MC) 11/28/79 04:14:06 +To: (BUG ITS) at MIT-MC +Translations should canonicallize DSK: to MC: etc, or the result is +unpredictible. (Do YOU know if MM Load LibraryFOO uses MC: or DSK: ??) + + +Date: 28 NOV 1979 0250-EST +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI + +Control-CALL echoes as just a Z. It should probably echo as ^Z. + +CFFK@MIT-MC 11/20/79 08:32:07 Re: Continuation of previous message +To: (BUG ITS) at MIT-MC +Thus MC is receiving burst of ~ 70 characters at a time. +I realize that the real culprit is the TELNET program +that runs on the MFE-NET. However is there any fix I +can make at MC to circumvent this problem? + + +CFFK@MIT-MC 11/20/79 08:28:12 +To: (BUG ITS) at MIT-MC +If I log into MC from LLL-MFE, MC occasionally drops the last +few characters of the lines I type in (and the ). The problem +arises because I'm logged into LLL-MFE via the MFE-NET which works +a-line-at-time. Thus MC is receiving + +Date: 15 NOV 1979 1046-EST +From: MAP at MIT-AI (Michael A. Patton) +To: (BUG ITS) at MIT-AI +CC: MAP at MIT-AI + + +The node A/1/a in ITSTTY cannot be reached by any normal means (that I +could find). The only way I could get there was with G. + +REM@MIT-MC 11/11/79 22:46:41 Re: Not a bug, rather a query/gripe/request +To: (BUG ITS) at MIT-MC +Given the SIXBIT name of a STY device, such as "S20", or just the number +such as 20, it should be easy to find out whether or not that STY is in use +by any job (your own job, or anybody else). Anybody know how to do it? +Apparantly currently you can't do it unless you know the TTY that is +associated with it, thus making it impossible to write a subroutine that +gets you a new STY you don't already have unless you have been keeping +a list of STYs-you-have all along since you started acquiring STYs. + + +Date: 7 November 1979 06:31-EST +From: Donald R. Woods +Subject: net ports +To: RWK at MIT-MC +cc: BUG-CRTSTY at MIT-AI, BUG-ITS at MIT-MC + +Hmm, okay, I guess I hadn't been willing to believe that completely +unrestricted simulated ttys would number only 6, so I assumed that +only a subset of them were allowed as net ports. Amazing that you +can survive with only 6! Assuming most of them are normally in +use for net ports or lisp-machine users, I find it hard to believe +that you can get enough STYs for CRTSTY and other uses. Maybe you +don't use them as much on ITS as we do at SAIL. + + +Date: 6 NOV 1979 2108-EST +From: CEH at MIT-MC (Charles E. Haynes) +To: C100-FANS at MIT-MC +Redistributed-To: bug-its at MC +Redistributed-By: GEOFF at SRI-KA +Redistributed-Date: 6 Nov 1979 + +Recently I have become involved in a discussion of the relative merits +of CRTSTY vs TCTYP support for C100's. My personal feeling is that +the TCTYP support is inadequate in a number of areas, the largest being +its lack of support for the "Sail" character set. Granted CRTSTY +takes an extra job slot, I feel that its support is enough better +that I prefer it (CRTSTY). + +What do other people think? + +-- Charles + + + +Date: 7 November 1979 01:04-EST +From: Robert W. Kerns +Subject: net ports +To: CSD.DON at SU-SCORE +cc: BUG-ITS at MIT-MC, BUG-crtsty at MIT-AI + + Date: 5 Nov 1979 2308-PST + From: CSD.DON at SU-SCORE + To: bug-crtsty at MIT-AI + Re: net ports + + Incidentally, I consider it a crock of the finest shit that, for whatever + reason(s), CRTSTY uses up an extra network port (of which I'm told there + are only 6) instead of a system-internal simulated tty. Do all STYs on + ITS use net ports, or just CRTSTY STYs? With net ports so rare, such an + implementation seems rather silly. +It does use a system-internal simulated TTY. That's what a STY is. That is +also what a "net port" is. It's not a limitation on how many network +connections there are, but on the number of system-internal simulated tty's. +While I would agree that 6 may be a little too few in the case of AI, it IS +a very heavily loaded machine, and there is justification for wanting to limit +the number of users coming in via the network. This has nothing to do with +whether CRTSTY is implemented in the reasonable way; it is. + + +ED@MIT-MC 11/04/79 00:09:44 Re: I don't believe this +To: (BUG ITS) at MIT-MC, (BUG DDT) at MIT-MC +DDT version 1388 runs on AI and MC. On MC, lower-case +characters typed as the first thing to DDT's command +loop (as in foo/ or foo , as opposed to :foo) generates +an OP? error. On AI, this is not the case. Further, +loading SYS;ATSIGN DDT into a job gets the same foul +behavior, but doing :copy sys;atsign ddt,common;random file +and then loading common;random file WINS! +It seems that the pure page that's always in core is broken. +Starting up several 256K jobs that referenced all their pages +managed to get the offending page swapped out which fixed things. +From this I gather that when a pure page is swapped, it is replaced +from the original, rather than put a dupe in the swap area. +Wierd. + +Date: 26 OCT 1979 1212-EDT +From: EB at MIT-AI (Edward Barton) +To: (BUG ITS) at MIT-AI + +:TIME, at least, claims that ITS has been up for 19 days +surpassing all previous records for uptime. That seems doubtful +in view of the power situation earlier today. + +Date: 26 Oct 1979 0113-EDT +From: HARV at MIT-DMS (Patrick L. Harvey) +To: (BUG its) at MIT-DMS +Subject: BUG its +Message-id: <[MIT-DMS].127634> + +Continuation of previous message. + +After I finish with the new command, I get +:KILL F$J +and a $P results in JOB? +... + + + +Date: 26 Oct 1979 0111-EDT +From: HARV at MIT-DMS (Patrick L. Harvey) +To: (BUG its) at MIT-DMS +Subject: BUG its +Message-id: <[MIT-DMS].127633> + +Sometimes when I do a :f then ^G it inthe middle, +I start typing a new command line and I get Job F finished. +Is this normal behavior? + + + +Date: 26 October 1979 01:31-EDT +From: Robert W. Kerns +To: RMS at MIT-AI +cc: BUG-DDT at MIT-MC, BUG-ITS at MIT-MC + + Date: 26 October 1979 00:10-EDT + From: Richard M. Stallman + To: BUG-DDT at MIT-AI + + If I type Control-Top-H at the DDT now on AI, + it seems to be treatd just as an H; + but rubbing it out just backspaces and doesn't erase it. + +DDT doesn't quite expect to get numbers bigger than 177 in response to +it's IOT on a non %TIFUL channel. Other than the [HELP] character, should +it? (It already expects the [HELP] character.) + + +ED@MIT-MC 10/24/79 00:42:03 +To: (BUG ITS) at MIT-MC, (FILE [UCODE;UCODE BUGS]) at MIT-MC +On MC, single-instruction proceed still loses if the +instruction page faults on fetch. Doing +100/ jrst 2000 +2000/ jrst 4000 +... +30000/ jrst 0 +1000G +100>> JRST 2000  results in: +0>> 0 note that 0, being swapped IN, doesn't execute. + + +Date: 23 OCT 1979 2254-EDT +From: MRC at MIT-AI (Mark Crispin) +To: (BUG ITS) at MIT-AI + +Could AI have more STYs generated, or CRTSTY be less willing to have lots +of tourist STY users, or something? Today, I was unable to get a net port +because there were three tourists on, one from a dialup and two from net +sites, taking up 5 out of the 6 available STYs because each was running a +CRTSTY. + +pae@MIT-MC (Sent by ___043@MIT-MC) 10/21/79 15:02:33 +To: (BUG ITS) at MIT-MC +mctty^f does not work when you are on mc. + +Date: 17 October 1979 22:18-EDT +From: Howard I. Cannon +To: DHD at MIT-AI, BUG-ITS at MIT-AI + + Date: 17 OCT 1979 2112-EDT + From: DHD at MIT-AI (David Hodgson Dennis) + + Is there any way the init files that use up almost all the file slots on + users1/users2/users3 could be compacted (or the dir allocation changed)? + That way, tourists who actually wanted to use storage for something other + then init files (like documents or lisp programs) could do so more readily. + I think this might make tourist's use of the system more productive. Would + this be too hard to do? +----- +Unfortunatly, the size of a directory is fixed by the system and cannot +be changed. We realize that the USERSn directories get full, and there +is no easy fix. Generally, it is possible to reap enough from the dirs +so that they are only about 75% full, but that takes time. If the guests +were more responsible about cleaning up, the problem wouldn't be so bad. +Many people are on INFO-MICRO and don't read their 15 blocks of mail for +three months! You should not be using the USERn dirs for anything but +very short term storage because you are lucky enough to have use of a +real dir on ML. If a tourist wants to be productive, (s)he can always +find a way -- it's really that most of them don't particularly care. + + +Date: 17 OCT 1979 2112-EDT +From: DHD at MIT-AI (David Hodgson Dennis) +To: (BUG ITS) at MIT-AI + +Is there any way the init files that use up almost all the file slots on +users1/users2/users3 could be compacted (or the dir allocation changed)? +That way, tourists who actually wanted to use storage for something other +then init files (like documents or lisp programs) could do so more readily. +I think this might make tourist's use of the system more productive. Would +this be too hard to do? + +Date: 16 Oct 1979 (Tuesday) 1457-EDT +From: OTTO at WHARTON (George Otto) +Subject: Solution to previously reported C100 problems. +To: bug-its at MIT-AI, geoff at SRI-KA, +To: eak at MIT-MC, OTTO (George Otto) + +As RWK@MIT first suggested, the problem with C100 screen control turned +out to be caused by the local host, Wharton, eagerly removing ^L's from +its ARPAnet transmissions before sending them on the the terminal. +Thus the problem in entirly local. + My appologies for even HINTING that ITS could have a bug in it, and +many thanks for the help I received in tracking this problem down. + + George Otto + + +Date: 16 OCT 1979 1223-EDT +From: RWK at MIT-MC (Robert W. Kerns) +Subject: OTTO's C100 complaints +To: (BUG ITS) at MIT-MC, (BUG EMACS) at MIT-MC, geoff at SRI-KL +CC: OTTO at WHARTON + +(Sorry for not sending this note before, but I fell asleep). +I talked with OTTO last night, and he's going to talk to the TELNET +maintainer at his site. + + +Date: 16 October 1979 12:17-EDT +From: Earl A. Killian +Subject: Possible solution to errors in C100 support. +To: OTTO at WHARTON +cc: BUG-ITS at MIT-AI, Geoff at SRI-KA + +How are you getting to ITS? If you're using a TELNET program I +suspect the problem is that it's doing some processing on the +output ITS sends. Nothing in the path from ITS to your C100 +should modify a single character output. + +:TCTYP C100 works for other people, over the network. That's why +I suspect it is a local problem. Probably an over zealous +operating system turning form feeds into LFs. + +P.S. don't include BUG-EMACS anymore, it's not relevant here. + + +Date: 16 Oct 1979 (Tuesday) 0446-EDT +From: OTTO at WHARTON (George Otto) +Subject: Possible solution to errors in C100 support. +To: geoff at SRI-KA, OTTO (George Otto) +cc: bug-emacs at MIT-AI, bug-its at MIT-AI + + In order to examine why the :CLEAR command was not clearing the +screen of my CONCEPT APL, I put the terminal into transparent mode +in order to examine the characters ITS was sending down the line +in response to that command. The octal sequence was as follows: + + 015 015 012 177 033 023 177 012 012 012 012 + 012 012 012 012 177 177 177 177 177 177 + +Among other things you should notice that there is not a single "clear +screen" (^L, FF, 014) in the entire transmission! Instead we have some +carraige returns (^M, CR, 015), some line feeds (^J, LF, 012), a single +"clear to end of line/field" ($ ^S, ESC DC3, 033 023), and some random +padding characters (DEL, 177). + If all the routines in ITS send this same sequence thinking it is +going to clear a screen instead of just move the cursor down 9 lines, +this may explain the problems I encountered earlier. + I am using the CONCEPT Reference Manual (DN1300-7808-1) and the +CONCEPT Reference Card (DN1300-7810) as my documentation for this +analysis, both from Human Designed Systems, Inc., 3700 Market Street, +Philadelphia, Pa. 19104. + + +Date: 15 Oct 1979 (Monday) 2341-EDT +From: OTTO at WHARTON (George Otto) +Subject: Possible errors in C100 support/additional information +To: bug-its at MIT-AI + + I have tried the solution of indicating the speed of my terminal, +with no luck. Increasing the speed to 600, 1200, and finally 9600 +did not change the behavior at all; in all cases the previously +reported errors occurred. Some additional information may be in order: + +1) The :CLEAR command does not clear the screen, but only up-spaces + about 10 lines, +2) The characters which are shipped out to my terminal in response + to the "TCTYP C100" command switch my terminal over to the APL + character set, which I must immediatly reset to make any sense + of the transmissions, +3) My terminal is a CONCEPT APL, which, as far as anybody knows, is + controlled identically to the CONCEPT 100. Local programs which + use cursor homing, screen clearing, cursor addressing, and line + insertion and deletion all work with no difficulty using the + standard CONCEPT computer-issued command set. + +If I can provide more information, please let me know. + + George Otto + + + +Date: 15 Oct 1979 (Monday) 2337-EDT +From: OTTO at WHARTON (George Otto) +Subject: Possible errors in C100 support/additional information. +To: geoff at SRI-KA, OTTO (George Otto) +cc: bug-its at MIT-AI, bug-emacs at MIT-AI + + I have tried the solution of indicating the speed of my terminal, +with no luck. Increasing the speed to 600, 1200, and finally 9600 +did not change the behavior at all; in all cases the previously +reported errors occurred. Some additional information may be in order: + +1) The :CLEAR command does not clear the screen, but only up-spaces + about 10 lines, +2) The characters which are shipped out to my terminal in response + to the "TCTYP C100" command switch my terminal over to the APL + character set, which I must immediatly reset to make any sense + of the transmissions, +3) My terminal is a CONCEPT APL, which, as far as anybody knows, is + controlled identically to the CONCEPT 100. Local programs which + use cursor homing, screen clearing, cursor addressing, and line + insertion and deletion all work with no difficulty using the + standard CONCEPT computer-issued command set. + +If I can provide more information, please let me know. + + George Otto + + + +Date: 15 Oct 1979 (Monday) 2256-EDT +From: OTTO at WHARTON (George Otto) +Subject: Possible errors in C100 support/padding solution +To: geoff at SRI-KA, OTTO (George Otto) +cc: bug-its at MIT-AI, bug-emacs at MIT-AI + +I will try that solution, but keep in mind that I am operating at 300 +buad now. + George Otto + + +Date: 15 Oct 1979 1943-PDT +Sender: GEOFF at SRI-KA +Subject: Re: Possible errors in C100 terminal support +From: the tty of Geoffrey S. Goodfellow +To: OTTO at WHARTON +Cc: bug-its at MIT-AI, bug-emacs at MIT-AI +Message-ID: <[SRI-KA]15-Oct-79 19:43:51.GEOFF> +In-Reply-To: Your message of 15 Oct 1979 (Monday) 2115-EDT +Reply-to: Geoff @ SRI-KA + +Perhaps your terminal is not getting the right amount of +padding... I suggest on the same TCTYP line along with C100 you +add SPEED #, i.e. as in + +:TCTYP C100 SPEED 9600 + +so the system will insert the right amount of padding (9600 +baud's worth in this case). I suspect this is your most likely +cause of lossage if operating over 300 baud. + +Date: 15 Oct 1979 (Monday) 2115-EDT +From: OTTO at WHARTON (George Otto) +Subject: Possible errors in C100 terminal support +To: bug-its at MIT-AI, bug-emacs at MIT-AI, +To: OTTO (George Otto) + + I am a new user on the ARPAnet and a new user on the MIT-AI +computer. I have used INFO for the past several days, using a +CONCEPT 100 terminal identified via a "TCTYP C100" command. +My reason for sending this note is that the screen control on my +terminal has been somewhat messy. I do not know if this is due +to a mistake in screen control or in the INFO program, so I thought +I'd simply describe the problem and let you sort it out. + When I give a command such as "INFO INTRO" the display proceeds +as if on a regular TTY, i.e., the information is "painted" on the +screen line by line, scrolling the terminal when the cursor hits the +bottom line of the display. This usually results in "INFO docu- +mentation reader" line being left on the LAST line of the display +screen instead of in its usual place two lines above that. This +causes problems later when the screen is being overwritten, because +some display lines which are blank simply do a linefeed over the +previous text, leaving it on the screen along with the newer display. +Needless to say, these garbage lines make understanding of the new +display somewhat difficult. + Once, and this happened on a redisplay request (^L) as well, the +scrolling operation was proceeding as described above when the cursor +jumped into the middle of the screen and continued from there. This +left a very confusing screen as a result. + I think that a fair number of these problems could be removed if +the screen could be cleared once in awhile. This would remove possible +garbage lines and also position the screen from the top down instead +of from the bottom up, thus putting everything where it was expected +right off the bat. As it is, the screen is NEVER cleared. + If there is anything you would like me to try on my terminal to help +identify what is going on more specifically, just let me know. + + George Otto + (OTTO@WHARTON) + + + +Date: 15 OCT 1979 1909-EDT +From: GVEO at MIT-AI (George V.E. Otto) +To: (BUG ITS) at MIT-AI + + I would like to report some trouble with either the screen control +for a C100 terminal, or the way INFO handles its display. I have the +full report of the problems in a file at Wharton, so I would like to +netmail the report from there. What userids should I use to mail the +error report? + +Date: 15 OCT 1979 1607-EDT +From: OTTO@Wharton +Sent-by: ___021 at MIT-AI +To: (BUG ITS) at MIT-AI + +I have a bug to report in either screen support of a CONCEPT 100 terminal +or in the way INFO handles screen control. To whom should I send a +description of the problems encountered? My addresses is OTTO@WHARTON. +I have an edited file containing the description of the situation which +I would liklike to send via netmail to the correcdt person +or persons. + George Otto + +BNLGHC@MIT-MC 10/15/79 15:37:22 +To: (BUG ITS) at MIT-MC +My TEKtronix terminal (actually a 4051) is not being handled +correctly by TCTYP and/or MACSYMA. The screen is not being +erased, --Continued-- overwrites --pause--, etc. + + +HIC@MIT-MC 10/13/79 07:57:31 Re: Chaosnet FORCE. +To: ED at MIT-MC, (BUG ITS) at MIT-MC + +I explained the bug to ED. + + +ED@MIT-MC 10/13/79 05:13:00 Re: Chaosnet FORCE. +To: (BUG ITS) at MIT-MC +The sequence: +.iot chaoch,[go away] +.call [setz ? sixbit /force/ ? setzi chaoch] +.close chaoch, +causes the target lisp machine to go into the error handler +complaining that 3 is an illegal packet opcode. +Doing a .SLEEP 30. after the force and before the close wins. + +EAK@MIT-MC 10/08/79 18:01:27 +To: (BUG ITS) at MIT-MC +How about a ^_ command to do an input reset? I.e. flush randomness +you accidentally typed. + +Date: 6 OCT 1979 1740-EDT +From: DLW at MIT-AI (Daniel L. Weinreb) +To: (BUG ITS) at MIT-AI, KLH at MIT-MC + +I must admit I've had the same problem. It only takes two tourists +running CRTSTY to use up 2/3 of the AI STYs. + +KLH@MIT-MC 10/05/79 18:37:23 +To: (BUG ITS) at MIT-MC +I can hardly ever read my AI mail any more. Recently +I had to let it pile up for a few days because I couldn't +seem to find any time when all STY's weren't being +hogged (either by LM's or T's or whatever). Considering +the number of LM's, I would think the # of STY's should be +grossly increased, although the # of net logins could +be controlled as a separate limit. True, this implies more +job slots, but I've always thought more were needed anyway. +I've nevver seriously considered departing AI altogether, but +the situation is getting grim. + + +Date: 3 OCT 1979 2049-EDT +From: JLK at MIT-AI (John L. Kulp) +To: (BUG ITS) at MIT-AI, ARC at MIT-AI + +:LISTF ARC:CHAOS; ON AI GIVES ARC NO SUCH DEVICE + +Date: 3 OCT 1979 0819-EDT +From: GRAND at MIT-AI (Mark D. Grand) +To: (BUG ITS) at MIT-AI + + I DON'T know if this is an oversite on sombody's part or +what, but when I try to :INFO MACLISP +I get + OPN016 INFO ;AI:LISP > PACK NOT MOUNTED?  +Date: 2 Oct 1979 2341-PDT +From: Mark Crispin +Subject: [PAE at MIT-MC (Philip A. Earnhardt): **more** state on the last line of the screen] +To: Bug-ITS at MIT-AI + +Has anybody looked at this problem? I've been told that it's a bug +in ITS. Any comments? + --------------- +Mail from MIT-AI rcvd at 2-Oct-79 2238-PDT +Date: 3 OCT 1979 0103-EDT +From: PAE at MIT-MC (Philip A. Earnhardt) +Subject: **more** state on the last line of the screen +To: (BUG TELNET) at MIT-MC, (BUG emacs) at MIT-MULTICS + +two times tonight, I have gotten into a **more** state +in multics emacs, telnet thru mc. Once this was through +invoking emacs on the next-to-last line of my screen +(which I believe was a known bug) and once while doing +a multics command (using ^x-^m) in my minibuffer. Does +anyone know where the problem/responsibility lies with +this? + +thanks, +philip + + --------------- + +------- + +MACRAK@MIT-MC 10/01/79 19:00:55 +To: (BUG ITS) at MIT-MC +Two problems with carriage motion optimization on printing terminals: + +1. Final spaces before cr aren't flushed. +2. Sometimes--especially when printing out Macsyma expressions using +backspaces and linefeeds substituting for cr's and spaces--its seems +to print out some backspaces, then some spaces, then more backspaces. + + +Sheldon Furst @MIT-MC (Sent by ___065@MIT-MC) 09/30/79 19:33:28 +To: (BUG ITS) at MIT-MC +[This is Sheldon Furst (FURST)] + +I connected to MC, did not log in, and typed "furst$" and got +the response "This person's mail is forwarded to CHNL NOT OPEN (newline) +Bad file = ^Q : ^Q ; ^Q ^Q". Tried it again, and got a "Fork disconnected" +or something like that, then a console free message. + +I don't presume this is SUPPOSED to happen, is it? + +-- Sheldon + + +KMP@MIT-MC 09/11/79 14:09:48 Re: KMP;.LOGIN 227 +To: (BUG ITS) at MIT-MC +My login init gives an IRRECOVERABLE DATA ERROR when I try to read it. + + +KMP@MIT-MC 09/11/79 14:09:48 Re: KMP;.LOGIN 227 +To: (BUG ITS) at MIT-MC +My login init gives an IRRECOVERABLE DATA ERROR when I try to read it. + + +Date: 10 SEP 1979 2324-EDT +From: MOON at MIT-MC (David A. Moon) +Subject: New ITS on MC has disk deadlocks +To: RWK at MIT-MC +CC: (BUG ITS) at MIT-MC, JPG at MIT-MC + +This is fixed now. + +Date: 10 SEP 1979 1839-EDT +From: MOON at MIT-MC (David A. Moon) +Subject: New ITS on MC has disk deadlocks +To: RWK at MIT-MC +CC: (BUG ITS) at MIT-MC, JPG at MIT-MC + +I already know about this, I guess I should be more anxious about fixing it +if it is happening frequently. I don't think it's a new bug, I don't +understand why it happens more now. The reason you can't list the TTY +directory is probably that the DDT TTY^F command probably first checks for +a TTY; directory on the disk. + +RWK@MIT-MC (Sent by ___042@MIT-MC) 09/10/79 07:25:59 Re: AddendumP +To: (BUG ITS) at MIT-MC +CC: JPG at MIT-MC +When it's hung as described, you can't list the TTY directory either. + + +Date: 10 SEP 1979 0723-EDT +From: RWK at MIT-MC (Robert W. Kerns) +Sent-by: ___041 at MIT-MC +Subject: New ITS on MC has disk deadlocks +To: (BUG ITS) at MIT-MC +CC: RWK at MIT-MC, JPG at MIT-MC + +A phenomenon we've observed repeatedly on this new system is for it to go +into a mode where reading directories (for everyone trying to do so) for +up to several minutes. It tends to hang repeatedly with short unhangings +for quite a while, and then suddenly clear up. It tends to happen when DUMP +is running, grovelling over large numbers of directories. I just saw such +a state, and managed to get a little info before it unhung. The DUMP's +FLSINS was SKIPG QFUD (it was hung in this, QFUD being zero). All the +directories were in use (QSNUD non-zero), aparently brought in by DUMP +(mostly in alphabetical order). Other jobs trying to do things and getting +hung hung waiting on QSKOSW, which was locked by the DUMP frob. That's about +all I could get before it spontaneously started working again. + + +KMP@MIT-MC 09/06/79 20:54:40 +To: (BUG DDT) at MIT-MC, (BUG ITS) at MIT-MC +System keeps dying here on me at least. Echos all chars but doesn't do +anything. T^F doesn't even work ... wierd. Any guesses? It's like everything +ITS does in the way of interrupt handling works, but that's all. No jobs +no ddt commands run. I detached myself from another tty and then tried to ^Z +the console. Took it fully a minute or more to get it to listen. another +console next door had same problem. both freed at same time. system must +be hanging some obscure way. + + +BRIAN@MIT-ML 09/01/79 13:10:00 Re: Moving files to an archive +To: (BUG ITS) at MIT-ML +CC: BRIAN at MIT-ML +When I try to move the file ML:BRIAN;MAIL O-COMM onto ARC MAIL, I +get no error message, and the file name appears in the directory +as expected, but names a file of zero length. I have had a similar +problem moving another fairly large file (14 blocks) on the +archive (which is about 160 blocks), but a small file got moved +OK. + + +Date: 28 AUG 1979 0101-EDT +From: ED at MIT-AI (Ed Schwalenberg) +To: (BUG ITS) at MIT-AI + +Why is it that +.CALL [SETZ ? '?_____ ? SETZM] +is an ILOPR, while +.CALL [SETZ ? 'FOOBAR ? SETZM] +fails to skip and returns an ILLEGAL SYSTEM CALL NAME error code? +I smell a crock. Of course, I deserve no better, executing randomly +named system calls. On the other hand, and related to this, the +.GETSYS uuo returns a list of NCALLS that includes ?_____ not once, but +200- times. This should either be fixed or +documented. + +Date: 26 August 1979 19:03-EDT +From: Earl A. Killian +To: BUG-ITS at MIT-MC, BUG-DDT at MIT-MC + +When I exit my EMACS and type-ahead, most of the type-ahead isn't +echoed. Perhaps DDT could check the %TXPIE bit and echo the character +itself if ITS didn't? Or better, maybe ITS could do this? + +Also, what about DDT option to use MP echoing instead of PI echoing? + + +Date: 26 Aug 1979 0600-EDT +From: RWK at MIT-MC +To: EBM at MIT-DMS, BUG-its at MIT-DMS +Subject: SYS directories full +Message-id: <[MIT-DMS].120744> + +Date: 26 August 1979 06:51-EDT +From: Robert W. Kerns +Subject: SYS directories full +To: EBM at MIT-DMS, BUG-its at MIT-DMS + + Date: 25 Aug 1979 1536-EDT + From: EBM at MIT-DMS (J. Eliot B. Moss) + To: (BUG its) at MIT-DMS + Re: BUG its + + :linkn ml:sys2;ts nr,r;ts nr38 + fails when the link already exists, because the directory + is full. This is very annoying. MC has the same problem. I think + that either the system call should be fixed, or some links in those + two directoris should be gotten rid of so the directories are no longer + full. +The real problem here is that the directory is full. DDT has long supported, +and MC has long had a SYS3 directory. I think that garbage links should be +GC'd, but that if a directory is available a SYS3 directory should be created +on the other machines. + + + + + +Date: 25 Aug 1979 1536-EDT +From: EBM at MIT-DMS (J. Eliot B. Moss) +To: (BUG its) at MIT-DMS +Subject: BUG its +Message-id: <[MIT-DMS].120688> + +:linkn ml:sys2;ts nr,r;ts nr38 + fails when the link already exists, because the directory +is full. This is very annoying. MC has the same problem. I think +that either the system call should be fixed, or some links in those +two directoris should be gotten rid of so the directories are no longer +full. + + + +Date: 24 AUG 1979 1343-EDT +From: CFFK at MIT-MC (Charles F. F. Karney) +Subject: Support of harware tabbing on printing terminal by Plot2 +To: RJF at MIT-MC +CC: JPG at MIT-MC, (BUG PLOT2) at MIT-MC, (BUG ITS) at MIT-MC +CC: (BUG CRTSTY) at MIT-MC + +Most of the shortcuts taken by PLOT2 when plotting on printing +terminals are in fact done by ITS. (E.g. the suppression of +trailing spaces on a line, and the use of backspaces instead of +return+spaces.) Support of hardware tabs by PLOT2 would similarly +be best done by ITS (e.g. via a new TCTYP). If this is not done +then maybe CRTSTY could do the job. (I believe CRTSTY may have +some minimum requirements which rules this out.) Support of +tabs by PLOT2 itself would be the least desirable because (1) +nothing else (e.g. :print) would benefit, and (2) because Plot2 +would have to implement ITS's other shortcuts at the same time. +(However, I don't rule out the support of tabbing by PLOT2.) +If ITS or CRTSTY also supported abs. curdsor positioning on daisy +wheel printers, you would be able to win using Plot2 by setting +PLOTMODE:DISPLAY$ +An absolute requirement for the implementation of any of this +by any system is an EXACT specification of the commands needed +to make the tabbing/cursor positioning work. + + +Date: 24 Aug 1979 0201-EDT +From: KDO at MIT-DMS (Ken D Olum) +To: (BUG its) at MIT-DMS +Subject: BUG its +Message-id: <[MIT-DMS].120603> + +The tty input buffer is too small. If you come from a site with a line +editor (SAIL) and type a full line and CR the whole line will get sent +at once and overfill your buffer. I had a good time typing this message. + + + +GJC@MIT-MC 08/21/79 21:13:08 +To: (BUG ITS) at MIT-MC +I was running a peek, and the system fair-share was said to be +113% at one point. This is mighty fine if it is true! + + +EAK@MIT-MC 08/20/79 02:57:38 +To: (BUG ITS) at MIT-MC +Using the .LOSE argument of .CALL DISMIS is really terribly inconvenient +when the interrupt stack pointer isn't in an AC. You have you put it +in one to address the return PC etc., but then you've clobbered an AC +which is hard to restore... + + +SKH@MIT-MC 08/11/79 20:29:51 +To: (BUG ITS) at MIT-MC +A suggestion: +Change the more handling in WHOJ, PEEK, FINGER etc. to (:PRINT) +to that of DDT'S implicit more (The one that vanishes if on +a display). Its annoying to see the --more-- thing stick +around. The vanishing more is 700% better. + + +RWK@MIT-MC (Sent by KMP@MIT-MC) 08/11/79 20:24:46 +To: (BUG ITS) at MIT-MC +The system with the ARCHIV handler doing a .CALL FINISH for 13 hours +finally crashed, due to apparently related lossage. It's dumped in +MC:CRASH;QFLDF1 H/50 +The immediate cause of the crash was indexing the channel tables with +H being 1 larger than the largest channel table index! + + +Ed@MIT-MC (Sent by PAE@MIT-MC) 08/11/79 15:02:50 +To: (BUG ITS) at MIT-MC +Look at MC:CHANNA;_DRGN_ TIMES +(and MC:CHANNA;_DRGN_ TIMES, and MC:CHANNA;_DRGN_ TIMES, +and MC:CHANNA;_DRGN_ TIMES, and MC:CHANNA;_DRGN_ TIMES, and... + +RWK,KMP@MIT-MC (Sent by ___021@MIT-MC) 08/11/79 06:26:36 Re: .CALL FINISH won't +To: (BUG ITS) at MIT-MC +CC: (BUG ARCHIV) at MIT-MC, KMP at MIT-MC +There's an archive device handler here, hung in a .CALL FINISH on its disk +output channel. The channel is in REAI mode according to PEEK's C mode. +It's definately an output channel, so I guess PEEK must display append-mode +channel's oddly. Claims its 100% read. + +The .CALL FINISH is at OPNOUT+16 + +The job's flush instruction is SKIPE QSBFS+5 +The PUSHJ P,UFLS is at QOCL2+1/ SKIPE QSBFS(A) +A/ 1,,5 +QSBFS+5/ 1 +QSCRW+5/ 0 ;Read +QSRAC+5/ %QAEFR+%QAACC+%QALBK+%QAMWO,,0 +QSMPRC+5/ 0 ;No bytes left in buffer + + +I don't know what else might be relevant. I leave the job KMP JOB.06 +still hanging for your inspection. KMP HACTRN is still hanging on the job +to finish. + + +KMP@MIT-MC 08/11/79 03:12:57 +To: (BUG ITS) at MIT-MC +If I have a file name +FOO .EXP99 +and write out a new file called +FOO > +it seems to write to +FOO .EX100 + +This would be ok if it weren't for the fact that if I then +compile FOO >, I end up compiling FOO .EXP99 ... can this be +fixed? Like maybe to open the > file, you could find all contenders +(files with max number of digits, ending in a digit), strip all trailing +digits, readlist the digits and compare them? + +-kmp + + +Date: 9 AUG 1979 1812-EDT +From: PAE at MIT-MC (Philip A. Earnhardt) +Subject: Getting thrown to DDT by :SEND +To: RWK at MIT-MC +CC: (BUG EMACS) at MIT-MC, (BUG ITS) at MIT-MC + + + RWK@MIT-MC 08/09/79 05:41:16 Re: Getting thrown to DDT by :SEND + If you type a ^G while a SEND is printing, DDT has control of the terminal + and you'll end up in DDT. Was this perhaps the problem? +no, I was just typing characters...no control chars. + +RWK@MIT-MC 08/09/79 05:41:16 Re: Getting thrown to DDT by :SEND +To: PAE at MIT-MC +CC: (BUG EMACS) at MIT-MC, (BUG ITS) at MIT-MC +If you type a ^G while a SEND is printing, DDT has control of the terminal +and you'll end up in DDT. Was this perhaps the problem? + + +Date: 8 AUG 1979 2050-EDT +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI, ED at MIT-AI, RWK at MIT-MC + + + RWK@MIT-MC (Sent by ___076@MIT-MC) 08/08/79 08:46:03 + It would seem that NO SUCH DEVICE is not really what's wanted. + Note that if you are WRITING a file, that you want normally to + go on the secondary pack, it also says "NO SUCH DEVICE". In + actual fact, there IS such a device, sitting broken and unavailable. + +I agree. "No such device" says "what you want makes no sense", which +is not true in this case. + +PAE@MIT-MC 08/08/79 19:46:18 +To: (BUG ITS) at MIT-MC +CC: (BUG EMACS) at MIT-MC +I received a message while replying to mail (using emacs rmail), +kept typing at the time, and somehow got kicked out of emacs back to +ddt. I didn't think there was anything that would quit an emacs +like that. + +RWK@MIT-MC (Sent by ___076@MIT-MC) 08/08/79 08:46:03 +To: (BUG ITS) at MIT-MC +CC: ED at MIT-MC +It would seem that NO SUCH DEVICE is not really what's wanted. +Note that if you are WRITING a file, that you want normally to +go on the secondary pack, it also says "NO SUCH DEVICE". In +actual fact, there IS such a device, sitting broken and unavailable. + + +MOON@MIT-MC 08/08/79 03:10:39 Re: SECOND: +To: ED at MIT-AI +CC: (BUG ITS) at MIT-MC + Date: 8 AUG 1979 0201-EDT + From: ED at MIT-AI (Ed Schwalenberg) + Subject: SECOND: + To: (BUG ITS) at MIT-AI + + Printing a file on SECOND: on AI these days results in NO SUCH DEVICE, + when one would expect a PACK NOT MOUNTED. Is this a bug or a feature? +It does give you pack not mounted. You were probably typing SECOND: +and indeed there is no such device if the pack isn't mounted. But you don't +need to, and usually don't, give the device name if you're just printing a file. + +Date: 8 AUG 1979 0201-EDT +From: ED at MIT-AI (Ed Schwalenberg) +Subject: SECOND: +To: (BUG ITS) at MIT-AI + +Printing a file on SECOND: on AI these days results in NO SUCH DEVICE, +when one would expect a PACK NOT MOUNTED. Is this a bug or a feature? + +Date: 5 AUG 1979 2158-EDT +From: BH at MIT-AI (Brian Harvey) +To: (BUG ITS) at MIT-AI + +How come top-/ is infinity, but shift-/ is N ? (Of course +I mean the blue slash key, not the grey one.) I realize that +infinity is 016 octal and so is N, but the difference seems +weird to me, e.g. when typing in EMACS and getting to the next +line when one wanted an infinity. + +Date: 3 AUG 1979 2030-EDT +From: MRC at MIT-AI (Mark Crispin) +To: (BUG ITS) at MIT-AI + +Padding on Telerays seems to lose in EMACS with i/d mode. Are you using +Pentti's algorithm yet? Telerays require lots of padding! + +Date: 29 JUL 1979 1748-EDT +From: KEN at MIT-AI (Kenneth Kahn) +Subject: the dirar devices. +To: (BUG ITS) at MIT-AI + +I consistently get FILE LOCKED errors when printing +ken;dirar3:name1 up +dirar4:name1 up +dirar7:name1 up +dirarc:name1 up + + +All the other names (for example dirar5:) seemed to work fine. +The archives themselves seemed fine, peek showed no one holding on to them, +and just creating a link from ar0 >, to ar7 > and then printing dirar0: avoided +the problem. + +GSB@MIT-ML 07/27/79 17:23:55 +To: (BUG ITS) at MIT-ML +why doesn't PK13: work like PK3: etc.? + + +Date: 27 JUL 1979 1130-EDT +From: RICH at MIT-AI (Charles Rich) +Subject: Job slots +To: (BUG ITS) at MIT-AI + +I know we had this argument before, but I really think that +we need more job slots. With 7 Lisp machines logged +in (and soon to be more), the transient average of +CHAOSnet jobs had gone up noticeably, with the result +that people spend half the day doing :SHOUT FLUSH JOBS! +which is a nuisance. As for example, right now, there +is noone logged in from the ARPA net -- just +local people, none of whom are running more than a +Lisp and an Emacs and maybe an occasional compiler, +and there are no free job slots to run even a :MAIL +(I am doing this inside EMACS, and it will probably +bomb the first time I try to send it!!!!!). + + Sincerely, Chuck Rich. + +HIC@MIT-MC 07/25/79 14:32:27 +To: BYRON at MIT-ML, (BUG ITS) at MIT-ML + + + BYRON@MIT-ML 07/25/79 09:23:54 + :tcytp c100 no no longer works, but gives back + ERROR: CNSSET: MEANINGLESS ARGS + 270>>.CALL 3330 (CNSSSET) + + Also, PWORD is no longer invoked on T04 (intentional?). + + +------ +Some turkey loaded the wrong ITS (an old version) on ML. +I just reloaded the system, and all this +should be fixed now. + + + +BYRON@MIT-ML 07/25/79 09:23:54 +To: (BUG ITS) at MIT-ML +:tcytp c100 no no longer works, but gives back +ERROR: CNSSET: MEANINGLESS ARGS +270>>.CALL 3330 (CNSSSET) + +Also, PWORD is no longer invoked on T04 (intentional?). + + +BYRON@MIT-MC 07/25/79 10:55:25 +To: (BUG ITS) at MIT-MC +I continually get "Host reset" messages while SUPDUPing from MC to ML. +They occur about once every 5 minutes or so, and detach me as well +of course. + + +Date: 23 JUL 1979 0251-EDT +From: RMS at MIT-AI (Richard M. Stallman) +To: (BUG ITS) at MIT-AI, AGRE at MIT-AI, KEN at MIT-AI + +I just noticed that C-N on my TV was giving me only one +more line at the bottom of my screen. The code was still +the old speed-dependent stuff, so I checked and found +that my TV was supposed to be running at 300 baud +(luckily my TV didn't know that!). +Probably it should be impossible to change the speed +of a TV, and :TCTYP should barf very loud at anyone who tries. + +This is probably the result of an unconditional :TCTYP in an init file. + +Date: 20 JUL 1979 1356-EDT +From: JERRYB at MIT-AI (Gerald R. Barber) +Subject: Dissappearance of init files +To: (BUG ITS) at MIT-AI + +I keep losing some of my init files for no apparent reasons, usually either my +EMACS or LISP inits. Is there a way to tell when a file was deleted and by +whom? Failing this is there a way to set up some sort of mechanism so that in +the future I will be told who deleted one of these files. + +Date: 18 JUL 1979 2044-EDT +From: RWK at MIT-AI (Robert W. Kerns) +To: (BUG ITS) at MIT-AI +CC: (BUG DDT) at MIT-AI + +There seems to have been a time around 4:30 pm on the 25 of June, when +all the DDT's in the world (and a PWORD too) got scrod. I'm not certain +right off exactly what happened to them, but many of them seem to have +gotten their PC's set to -1, probably by having the stack-pointers +changed out from under them. (They seemed to be doing a TYI at the time). +The PWORD definately had a PDL underflow. Something like 40 crash files +were dumped at the time. + +There are a few saved crash files on CRASH;(first name BUGDDT) The relavent +PWORD crash file is PWORD PDLHAK. + +Date: 18 JUL 1979 0242-EDT +From: JNC at MIT-AI (J. Noel Chiappa) +To: DLW at MIT-AI +CC: (BUG ITS) at MIT-AI + + Well, IMPUP is definitely a symbol. Sounds like the system +was slowly dying away; did anybosy see any "memory changed between" +messages as it went? Sounds like the kind of cumulative bit rot whose +origin is almost impossible to track down.... + Noel + +Date: 17 JUL 1979 1823-EDT +From: DLW at MIT-AI (Daniel L. Weinreb) +To: (BUG ITS) at MIT-AI + +To add to the rash of strange reports: last night, RK tried to +use TELNET on MC and fond it halting with an "ERROR;" message +at a .EVAL. I examined it; the symbol in question was "IMPUP", +and going into SYS$J showed that IMPUP was not a known symbol. +Maybe the exec symbol table was bashed? Anyway, the system +crashed shortly after this (while I was examining the problem). + +KMP@MIT-MC (Sent by ___031@MIT-MC) 07/17/79 07:53:33 Re: Unreproducible errors... +To: (BUG ITS) at MIT-MC +CC: (BUG COMPLR) at MIT-MC +I got an error from the lisp compiler just about 2 seconds before the +last crash. I don't know if it is related ... + +;(LOAD ((DSK LIBLSP) TTY FASL)) - NON-EXISTENT DIRECTORY + +which is odd because that file and dir exist and as soon as system came +back up the complr did the compilation with no errors. +-kmp + + +GSB@MIT-MC 07/11/79 00:34:43 Re: c100 padding for i&d line +To: (BUG ITS) at MIT-MC +CC: EAK at MIT-MC +!@#%^#&!@, ML is running an ITS 3 months older than MC, and the cruft +in the tty code for it doesn't look at all like the stuff in the current +source... It appears to win on MC, EXCEPT THAT CLEOS DOESN'T WORK AT +ALL!! (This is still at 9600 baud.) (It doesn't on ML either.) + + +Date: 10 July 1979 18:41-EDT +From: Earl A. Killian +To: GSB at MIT-MC +cc: BUG-ITS at MIT-MC + + Date: 07/10/79 13:12:20 + From: GSB at MIT-ML + To: (BUG ITS) at MIT-ML + + Padding for the c100 is insufficient for i&d line at 9600 baud. + Can anyone tell me a place i can patch to experiment? + +You might experiment with CRTSTY's padding at 9600 and when you find +the appropriate value, try it in ITS. Patch C1LIDP+7 to multiply by +different padding times (which are floating point no.s - it is +currently .75E-3). + + +GSB@MIT-ML 07/10/79 13:12:20 +To: (BUG ITS) at MIT-ML +Padding for the c100 is insufficient for i&d line at 9600 baud. +Can anyone tell me a place i can patch to experiment? + + +Date: 2 JUL 1979 1046-EDT +From: APW at MIT-AI (Andrew P. Witkin) +To: (BUG ITS) at MIT-AI + +(sorry about the incomplete msg) The bug reported by bkph -- random +garbling of type in-- has also struck the datamedia in E10 (T35). + +Date: 2 JUL 1979 0954-EDT +From: APW at MIT-AI (Andrew P. Witkin) +To: (BUG ITS) at MIT-AI + +T + +Date: 2 JUL 1979 0845-EDT +From: BKPH at MIT-AI (Berthold K.P. Horn) +To: (BUG ITS) at MIT-AI + +What's up with the Teletype lines? Both outside (telephone) +and inside (DATAPOINT & Mini-Robot) lines have very peculiar +random behaviour -- garbling characters, inserting characters, +dropping bits, copying several times every second letter of +what was typed recently and other such randomness... + +JPG@MIT-MC 06/14/79 08:48:51 +To: (BUG ITS) at MIT-MC +Say, this system is locking disk blocks! +It just crashed, and I reloaded it from scratch. +Before the crash, the number of available blocks on #0,#1,#13 +respectively were 320,380,201 . (I checked this just before the +crash.) After the crash, the number available was 547,552,257 ++ I dumped out a 171 block crash file on CRASH;. +I noticed this phenomenon about 2 weeks ago when the system crashed +and RWK reloaded it, and mentioned it to him, but I wasn't as certain +then, so didn't report it. +I wonder if this has something to do with swapping disk somehow using +user blocks or whatever, and the system's marking them at high-use time +getting screwed up. Whatever, something is doing this! + + +Date: 11 JUN 1979 2014-EDT +From: RWK at MIT-MC (Robert W. Kerns) +Subject: E? USR:$ +To: EAK at MIT-MC, RWK at MIT-MC, (BUG ITS) at MIT-MC +CC: (BUG TECO) at MIT-MC + + Date: 10 JUN 1979 1242-EDT + From: EAK at MIT-MC (Earl A. Killian) + To: RWK, (BUG ITS) + cc: (BUG TECO) + Re: E? USR:$ + + Date: 06/09/79 03:47:19 + From: RWK at MIT-MC + To: (BUG TECO) + Re: E? USR:$ + + creates an inferior. It should set the bit saying to fail if the job + doesn't exist. + + Even better would be to have the USR: device obey the same convention + as the DSK: device, i.e. if you open for reading then it is an error + if it doesn't exist. RWK, you said once DDT could be fixed if ITS + were so changed, is that still true? +Yes, it's still true. + + +Date: 10 JUN 1979 1242-EDT +From: EAK at MIT-MC (Earl A. Killian) +Subject: E? USR:$ +To: RWK at MIT-MC, (BUG ITS) at MIT-MC +CC: (BUG TECO) at MIT-MC + + Date: 06/09/79 03:47:19 + From: RWK at MIT-MC + To: (BUG TECO) + Re: E? USR:$ + + creates an inferior. It should set the bit saying to fail if the job + doesn't exist. + +Even better would be to have the USR: device obey the same convention +as the DSK: device, i.e. if you open for reading then it is an error +if it doesn't exist. RWK, you said once DDT could be fixed if ITS +were so changed, is that still true? + + +JKESS@MIT-MC 06/01/79 03:02:59 Re: to whoever is maintaining the CROCKS again +To: (BUG ITS) at MIT-MC +and CROCK loses its center point, writing randomly. + +Both of these are new bugs -- CROCK ran perfectly before today... + +JKESS@MIT-MC 06/01/79 03:00:58 Re: to whoever maintains the CROCKs... +To: (BUG ITS) at MIT-MC +DCROCK fails totally to get its digit positioning right on VT100s. + diff --git a/sysdoc/its.obugs1 b/sysdoc/its.obugs1 new file mode 100644 index 0000000..f42c243 --- /dev/null +++ b/sysdoc/its.obugs1 @@ -0,0 +1,7768 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: 23 January 1985 23:47-EST +From: Alan Bawden +Subject: Tempest in a TELSER. +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, DANIEL @ MIT-MC +In-reply-to: Msg of 23 Jan 1985 17:42-EST from Alan Bawden + + Date: 23 January 1985 17:42-EST + From: Alan Bawden + ... I plan to fix the timeout algorithm to close the connection after + it sees the STY idle twice in a row. That, and a check every 15 + seconds, should assure you of at -least- 15 seconds (but not more than + 30) before closing the connection.... + +Ok I did this. Actually I did it with a 20 second timeout. Thus, you now +get at least 20 seconds, at most 40 seconds, and an average of 30 seconds. +A reason to want a longer timeout is to give the TELSER's single page a +chance to swap out and stay out. This probably doesn't matter much on MC +but it might help a bit on AI. + +An alternative solution, that would take a few more lines of code, would be +for TELSERs to keep a USR: channel open to the toplevel job on the other +end of the STY. Then they would get an interrupt when that job went away, +indicating some kind of interesting job manipulation was taking place on +the other side. Unfortunately nothing would happen if the tree was just +detached, foo. + +Date: 23 January 1985 17:42-EST +From: Alan Bawden +Subject: Tempest in a TELSER. +To: DANIEL @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 22 Jan 1985 19:39-EST from Daniel Weise + + Date: 22 January 1985 19:39-EST + From: Daniel Weise + Why is MC suddenly breaking supdup connections when I + log out? I prefer the behavior where I have to manually + break the connection. + +'Cause we are experimenting with adjusting the timeout to different values. +Currently it is patched to be 15 seconds. For years it has been set at 5 +minutes. I think we are all agreed that the current setting is a loser. I +plan to fix the timeout algorithm to close the connection after it sees the +STY idle twice in a row. That, and a check every 15 seconds, should assure +you of at -least- 15 seconds (but not more than 30) before closing the +connection. + +Unless anybody would like to object or propose anything else? + +Date: 22 January 1985 19:39-EST +From: Daniel Weise +To: BUG-ITS @ MIT-MC + +Why is MC suddenly breaking supdup connections when I +log out? I prefer the behavior where I have to manually +break the connection. + +Date: 22 January 1985 14:35-EST +From: Alan Bawden +Subject: TELSER timeout +To: CBF @ MIT-MC, CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +The current timeout is definitely too short. MC has hung up on me +instantly a couple of times in the last few days. Perhaps the code should +be fixed to log itself out only if it sees the STY idle twice in a row. + +Date: 20 January 1985 19:33-EST +From: Alan Bawden +Subject: Page fault caused by .GETSYS +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC +In-reply-to: Msg of 19 Jan 1985 17:07-EST from Kent M Pitman + + Date: 19 January 1985 17:07-EST + From: Kent M Pitman + MC died claiming: + Page fault in system at 304000,,130422 + +This has been happening on and off for quite some time. .GETSYS would +sometimes cause a seemingly spurious page fault. I introduced this bug +myself last summer and I just fixed it in the source. Sure feels good to +delete some of those crash dumps knowing that you actually fixed the +problem! + +Date: 20 January 1985 10:46-EST +From: Christopher C. Stacy +Subject: Closing net connections when your STY goes away +To: CBF @ MIT-MC +cc: BUG-ITS @ MIT-MC, MRC @ SU-SCORE +In-reply-to: Msg of 18 Jan 1985 22:42-EST from Charles Frankston + +Five minutes is admittedly a long time. I think I would be happy if +it were one half minute, I think (15 seconds might be OK, but I want +to be more gracious). If no one responds to CBF's query in a few days, +I'll change it in the source. + + +Date: 20 January 1985 10:44-EST +From: Christopher C. Stacy +Subject: HSNAME change +To: ALAN @ MIT-MC +cc: BRUC @ MIT-MC, BUG-DDT @ MIT-MC, BUG-INQUIR @ MIT-MC, + BUG-ITS @ MIT-MC, KMP @ MIT-MC, TAFT @ MIT-MC, + USER-ACCOUNTS @ MIT-MC +In-reply-to: Msg of 19 Jan 1985 02:35-EST from Alan Bawden + +I fixed this (right this time). + +Date: 19 January 1985 17:07-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +MC died claiming: + Page fault in system at 304000,,130422 + BugPC/ PFA3+2 + +I dumped this to CRASH;PFA3+2 19-JAN +and cold booted. -kmp + +Date: 19 January 1985 02:35-EST +From: Alan Bawden +Subject: HSNAME change +To: CSTACY @ MIT-MC, KMP @ MIT-MC, BUG-INQUIR @ MIT-MC +cc: USER-ACCOUNTS @ MIT-MC, BRUC @ MIT-MC, BUG-DDT @ MIT-MC, + TAFT @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 18 Jan 1985 23:48-EST from Robert E. Bruccoleri + + Date: 18 January 1985 23:48-EST + From: Robert E. Bruccoleri + My home directory was changed from USERS0; to GUEST0; recently + without the relocation of my files or the redirection of my mail.... + + Date: 18 January 1985 23:59-EST + From: Kent M Pitman + INQUIR seems to give people with a "Z" designation (clinical decision + making group) a GUESTn home dir if they don't have a home dir of their + own. This is arguably a bug.... + +Earlier the same day.... + + Date: 18 January 1985 09:26-EST + From: Christopher C. Stacy + Subject: AI file directories + To: BUG-INQUIR at MC + cc: BUG-DDT at MC, BUG-ITS at MC, KMP at MC, TAFT at MC + Enough occasional and small users from AI use MC now that I was + getting tired of using INQUIR to manually force their home directory + to be AI0. This morning I taught INQUIR that if an "A" person comes + along who does not have a directory, it will automatically stick them + in AI0 (rather than USERSn). Of course, if AI0 starts getting too + full due to many people, we can make more dirs. But I don't think + that's too likely since most AI people with alot of files have their + own directory and don't need to use AI0. + +Well, more than just AI users seem to have their directories changed, so I +retracted the new version of LSRTNS, reassembled DDT (being careful to +increment the version number this time) and installed it. The buggy +ATSIGN DDT was renamed to be ATSIGN XDDT. + +Date: 18 January 1985 22:42-EST +From: Charles Frankston +Subject: Closing net connections when your STY goes away +To: CSTACY @ MIT-MC, MRC @ SU-SCORE +cc: BUG-ITS @ MIT-MC + +Well, I think the current timeout is kind of long, so I have temporarily +patched it to 15 seconds instead of 5 minutes. If anyone remembers why +it was 5 minutes, I'd be interested in knowing. + +This will also help free up STYs faster for those times when the system +is heavily loaded. + +Date: 18 January 1985 17:35-EST +From: Christopher C. Stacy +Subject: TAC binary mode +To: MRC @ SU-SCORE +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of Fri 18 Jan 85 09:25:48-PST from Mark Crispin + + +Foo. We like it waiting for me to type "^Z", rather than gratitously +disconnecting. As for decisions being cast in stone, I just happen to +think it is the right decision (and the users and other programmers +here concur.) If you re-read my message, I did suggest that perhaps +there should be a way for users to ask to be disconnected upon logout. +By the way, when coming in over the net I myself turn on binary mode +in my login init file so that I can use the META key on my home +terminal. Since I run a program (:TBMOFF) in my logout init file +which turns it back off, I never get wedged. + + +Date: Fri 18 Jan 85 09:25:48-PST +From: Mark Crispin +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Fri 18 Jan 85 03:06:00-PST +Postal-Address: 725 Mariposa Ave. #103; Mountain View, CA 94041 +Phone: (415) 497-1407 (Stanford); (415) 968-1052 (residence) + + Bullshit. The connection was *not* in a wedged state. It was +waiting for me to type CTRL/Z to start another ITS job. I deliberately +typed @ B I S because I wanted a binary link without the TAC intercept +character interfering. The last thing I want when I am logged in to a +host is to have the damn Tip (be it Internet, Chaos, Pup, DECnet, or +whatever) decide to grab one of my characters as an intercept character. +I know damned well how to change the intercept character, but with the +advent of certain display editors which use all 128 ASCII characters for +commands there is NO "safe" intercept character. + + One of the reasons why ITS in the old days was so great was that +the system programmers of that time didn't consider the decisions of the +past to be enshrined in stone and unchangable. +------- + +Date: 18 January 1985 09:26-EST +From: Christopher C. Stacy +Subject: AI file directories +To: BUG-INQUIR @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, KMP @ MIT-MC, TAFT @ MIT-MC + +Enough occasional and small users from AI use MC now that I was +getting tired of using INQUIR to manually force their home directory +to be AI0. This morning I taught INQUIR that if an "A" person comes +along who does not have a directory, it will automatically stick them +in AI0 (rather than USERSn). Of course, if AI0 starts getting too +full due to many people, we can make more dirs. But I don't think +that's too likely since most AI people with alot of files have their +own directory and don't need to use AI0. + + +Date: 18 January 1985 06:06-EST +From: Christopher C. Stacy +Sender: CSTAC0 @ MIT-MC +To: MRC @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 17 Jan 1985 21:58-EST from Mark Crispin + + +Come on, the bug is clearly in your user host which stopped paying +attention to you. Closing your connection is just one thing which it +prevented you from doing by putting you into a wedged state. +It is a feature that ITS does not close connections when you log out. +Maybe there should be a :LOGOUT option to force your connection closed +though, for people who want this. + +Date: 17 January 1985 23:10-EST +From: Richard M. Stallman +To: BUG-ITS @ MIT-MC + +I always find it unpleasant when OZ breaks connections with me +just because I log out. + +Date: 17 January 1985 21:58-EST +From: Mark Crispin +To: BUG-ITS @ MIT-MC + +I wish ITS closed the connection when you logged out. It is easier to +re-open the connection if you want it than it is to extract yourself +from a host which won't hang up when you log out. I had to gun my TELSER +to get out of a @B I S connection from the TAC. + +Date: 17 January 1985 15:06-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +MC's network terminals and the (AAA) next to the system console and +such stopped responding. The system console seemed to be happy, so I +ran :.;BOOT11 from there and things seem happy again. + +Date: 11 January 1985 19:37-EST +From: Leigh L. Klotz +To: TAR @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 9 Jan 1985 15:48-EST from Thomas A. Russ + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 + To: BUG-ITS + + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +Probably you, in your incarnation as TAR0, were trying to :CHUNAM to +TAR, but there already was a TAR, possibly detached. DDT was informing +you in its usual terse fashion, (which has saved us at last count over +2^23 character output calls since ITS was first booted). + + +Date: 10 January 1985 01:23-EST +From: Howard D. Trachtman +Subject: archives +To: BUG-ITS @ MIT-MC +cc: HDT @ MIT-MC, CSTACY @ MIT-MC + +It also seems to me that control-Zing out of writing a file in emacs and +proceeding consitently leaves a Jjob in my name, but which doesn't seem +to get restarted in a manner capable of finishing the write. + +Date: 9 January 1985 23:12-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: HDT @ MIT-MC + +When an archive device dies maybe it should return device not available +or if it was because of size limitations, device full. + +Date: 9 January 1985 16:04-EST +From: Christopher C. Stacy +To: TAR @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 9 Jan 1985 15:48-EST from Thomas A. Russ + + Date: 9 January 1985 15:48-EST + From: Thomas A. Russ + Sender: TAR0 + To: BUG-ITS + + :CHUNAME doesn't work. It prints the "-- Massacre and Reset --" + question, but when I type , it responds with a single question + mark ("?") and does nothing. + +This would probably be a DDT bug, not an ITS bug. +:CHUNAME works fine for me. Please send a real bug report, +specifying the input you gave the function. + +Date: 9 January 1985 15:48-EST +From: Thomas A. Russ +Sender: TAR0 @ MIT-MC +To: BUG-ITS @ MIT-MC + +:CHUNAME doesn't work. It prints the "-- Massacre and Reset --" +question, but when I type , it responds with a single question +mark ("?") and does nothing. + + +Date: 4 January 1985 19:48-EST +From: Ken Harrenstien +Subject: Tape archives +To: greif @ MIT-XX +cc: BUG-ITS @ MIT-MC + +How much tape are you actually talking about flushing? I doubt you plan +to re-use the tapes; therefore it must just be the storage requirements +that you object to. But tapes don't take up much room at all (depending +on how you chose to store them), and even if there is only one file on +each tape which is worth keeping, it is still much easier to simply keep +that tape than to try to achieve any kind of compaction. + +I don't think any ITS tapes should be junked unless a large majority of +ITS users thinks it is reasonable. There just is no way to predict +which files you will someday be interested in retrieving, and once they +are flushed, they are gone forever. The ITS systems have vastly more +historic significance than MIT-XX, or in fact most other computer systems +on the network, and this should be a consideration. + +Incidentally, the notion of taking a complete file system dump and locking +it away for backup, archival, or posterity is considered a good idea in +other places as well. We do this on SRI-NIC, for example. Perhaps +you are just doing it too often. + +Date: 4 January 1985 01:21-EST +From: Pandora B. Berman +Subject: amazing brain damage +To: BUG-ITS @ MIT-MC + +irene grief has apparently gotten the idea into her head that +flushing all old ITS tapes up to six months ago is not only +feasible but a good idea. see CENT;LCS TAPES for details. + +Date: 2 January 1985 15:14-EST +From: Christopher C. Stacy +Subject: hangup +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, SGA @ MIT-MC +In-reply-to: Msg of 2 Jan 1985 14:15-EST from Alan Bawden + + + Date: 2 January 1985 14:15-EST + From: Alan Bawden + In-reply-to: Msg of 2 Jan 1985 09:44-EST from Christopher C. Stacy + + Ah! So perhaps the hangup detection is busted on some line? Did you + experiment to see if it was a repeatable failure? Which line did this + happen on? + +Unfortunately, I was running out the door at the time and didn't +remember to check which dialup line I was on until it was too late. +I suspect that it was T04. I suppose we could check the console log. + +Mostly I sent the message to make sure that other people thought that +hangup detection is really supposed to work on all the lines we have. +It doesn't work on the ROLM lines though, does it? + +Date: 2 January 1985 14:15-EST +From: Alan Bawden +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, SGA @ MIT-MC +In-reply-to: Msg of 2 Jan 1985 09:44-EST from Christopher C. Stacy + + Date: 2 January 1985 09:44-EST + From: Christopher C. Stacy + Date: 1 January 1985 20:05-EST + From: Alan Bawden + Date: 1 January 1985 15:55-EST + From: Sydney E. Atkinson + hanging up a dialup line does not log you out. + It shouldn't. People shouldn't lose the contents of their editor + buffers just because they tripped over the phone cord. Hanging up + a dialup line detaches your job tree so that you can dial in again + and reattach to it (or gun it down if it was wedged in some way). + Have you observed some behavior other than this? + The job was not detached either: it was left sitting there for at + least five minutes, and when I dialup up the same line I was already + logged in to SGA's session. + +Ah! So perhaps the hangup detection is busted on some line? Did you +experiment to see if it was a repeatable failure? Which line did this +happen on? + +Date: 2 January 1985 09:44-EST +From: Christopher C. Stacy +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, SGA @ MIT-MC +In-reply-to: Msg of 1 Jan 1985 20:05-EST from Alan Bawden + + Date: 1 January 1985 20:05-EST + From: Alan Bawden + To: SGA + cc: BUG-ITS + In-reply-to: Msg of 1 Jan 1985 15:55-EST from Sydney E. Atkinson + + Date: 1 January 1985 15:55-EST + From: Sydney E. Atkinson + hanging up a dialup line does not log you out. + + It shouldn't. People shouldn't lose the contents of their editor buffers + just because they tripped over the phone cord. Hanging up a dialup line + detaches your job tree so that you can dial in again and reattach to it (or + gun it down if it was wedged in some way). Have you observed some behavior + other than this? + +The job was not detached either: it was left sitting there for at +least five minutes, and when I dialup up the same line I was already +logged in to SGA's session. + +Date: 1 January 1985 20:05-EST +From: Alan Bawden +To: SGA @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 1 Jan 1985 15:55-EST from Sydney E. Atkinson + + Date: 1 January 1985 15:55-EST + From: Sydney E. Atkinson + hanging up a dialup line does not log you out. + +It shouldn't. People shouldn't lose the contents of their editor buffers +just because they tripped over the phone cord. Hanging up a dialup line +detaches your job tree so that you can dial in again and reattach to it (or +gun it down if it was wedged in some way). Have you observed some behavior +other than this? + +Date: 1 January 1985 15:55-EST +From: Sydney E. Atkinson +To: BUG-ITS @ MIT-MC + +hanging up a dialup line does not log you out. + +Date: 26 December 1984 22:57-EST +From: David A. Moon +Subject: How to take a dump of a machine that had been running? +To: KMP @ MIT-MC +cc: KLH @ MIT-MC, BUG-ITS @ MIT-MC + + Date: Mon, 24 Dec 84 22:12 EST + From: Kent M Pitman + + I hit Break and got to KLDCP. Then I said SP. + When I tried to do DDT, it said it was in User Mode and + that I had to do MR first. + +This is pretty dumb of KLDCP. SP is "stop" and DDT is "start +at the start address of DDT, which is stashed in a location in +low memory somewhere." I don't know why KLDCP can't switch from +user mode to exec mode itself. + + I wasn't sure if that would + destroy the useful state needed to do the dump. So I just + hit the disk button on the machine and ran a full boot. + +Certainly MR will destroy less state than cold-booting from the +disk button! MR (stands for master reset) probably loses at most +the contents of the accumulators, and maybe not even that. + +Aside: it's a pity the designers of the pdp-11 front end for the KL10 +never bothered to look at the software that runs on the pdp-10 for their +user-interface ideas. I'm certainly glad I didn't take that job when +it was offered to me! End of history lesson. + + Would the right thing to do have been to say MR, DDT, + then dump it from there? + +I think so. Actually, a better approach would have been to +continue the machine (I forget the two-letter abbreviation for +that) then raise switch zero (the switch zero on the left). If +it's in user mode it's probably scheduling periodically, and if +it's scheduling periodically switch zero will get you to DDT +in a clean state to take a dump. + + I'm not at all clear on what the + various states of the machine are here... so I didn't + know if I'd just be wasting my time trying to do something + I really know nothing about. If I had any reason to think + it would have worked, I'd have given it a shot. So let me + know if it was the right thing (or what would have been) + and next time I'll try it. -kmp + +It never hurts to take a dump, in my opinion. + +Received: from MIT-FRANK-SINATRA by MIT-OZ via Chaosnet; 24 Dec 84 22:10-EST +Date: Mon, 24 Dec 84 22:12 EST +From: Kent M Pitman +Subject: How to take a dump of a machine that had been running? +To: KLH@MIT-MC.ARPA +Cc: BUG-ITS@MIT-MC.ARPA + +I hit Break and got to KLDCP. Then I said SP. +When I tried to do DDT, it said it was in User Mode and +that I had to do MR first. I wasn't sure if that would +destroy the useful state needed to do the dump. So I just +hit the disk button on the machine and ran a full boot. +Would the right thing to do have been to say MR, DDT, +then dump it from there? I'm not at all clear on what the +various states of the machine are here... so I didn't +know if I'd just be wasting my time trying to do something +I really know nothing about. If I had any reason to think +it would have worked, I'd have given it a shot. So let me +know if it was the right thing (or what would have been) +and next time I'll try it. -kmp + +Date: 24 December 1984 21:45-EST +From: Ken Harrenstien +Subject: MC being down today +To: KMP @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Normally the best thing to do with a dead or comatose system is dump +it, so that the corpse can be examined later. + +Date: 24 December 1984 16:12-EST +From: Kent M Pitman +Subject: MC being down today +To: BUG-ITS @ MIT-MC + +Poor MC had 0 free pages in low core since early this morning and wasn't +doing anyone any good (wouldn't let anyone log in, etc). So I just reloaded +it, which seemed to work fine. Sorry I didn't have any idea what kind of +debugging info to offer since the machine was still running and other than +10,000 warnings about being out of free pages, it had nothing to say for +itself. If there's debugging data I could have taken from KLDCP, please let +me know and I'll get it next time if it loses this way again. -kmp + +Date: Sun, 23 Dec 1984 10:59 EST +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: Peter Szolovits +Cc: BUG-ITS@MIT-MC +Subject: Heath 19 terminal control codes +In-reply-to: Msg of 22 Dec 1984 15:54-EST from Peter Szolovits + +This was the right place. Either I'll answer you next time I'm on MC, or you +can look at the strings in SYS; TS3TTY > if you feel brave. Yes, it does use +ANSI mode, but only for multiple line/char insert/delete. So does CRTSTY. + +Date: 22 December 1984 15:54-EST +From: Peter Szolovits +Subject: Heath 19 terminal control codes +To: BUG-ITS @ MIT-MC +cc: PSZ @ MIT-MC + +I would like to find out what the complete set of terminal commands is +that ITS sends to terminals that it thinks are H19's. In particular, I +know that some commands from the ANSI set are used as well as the +"standard" Heath command set. The Kermit H19 emulator doesn't support +$[nP and $[?2h, for example (though it does support $[nM and $[nL for +vertical scrolling), and I'd like to find out what such commands would +need to be added to Kermit to make it useable on MC. Sorry if this is +the wrong mailing list. + +Date: 22 December 1984 10:19-EST +From: Christopher C. Stacy +Subject: obscure bug in trivial feature +To: BUG-ITS @ MIT-MC +In-reply-to: Msg of 22 Dec 1984 02:52-EST from Christopher C. Stacy + +OK, the SYSDSK thing works now. + +Date: Sat 22 Dec 84 03:58:10-EST +From: J. Noel Chiappa +Subject: MC busted, fixed +To: ann@MIT-XX.ARPA +cc: bug-its@MIT-MC.ARPA, JNC@MIT-XX.ARPA + + MC croaked last this evening with a busted +20V brick in +the power supply. Not wanting the machine to be down forever, I +replaced it. Can you please cause DEC to replace the busted one +(sitting on top of the processor) with a fixed one and get that +back to me? + This may explain some of the problems MC was having recently +with it halting after repetitively flashing the lights and not +saying anything. The power supply was for the memory in the +front end; the bootstrap ROM was seeing the disk controller get +a NXM on a test transfer to 0. + Noel +------- + +Date: 22 December 1984 02:57-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I think the SYSDSK code is probably mostly bankrupt. +I noticed it not quite working the other day, and so +there are some changes in it now, and it works a little +better. Oh, well. + +Date: 22 December 1984 02:52-EST +From: Christopher C. Stacy +Subject: obscure bug in trivial feature +To: BUG-ITS @ MIT-MC + +SYSDSK is not called from QSOCL3 when a :MOVE happens +since the input channel's file names are not looked +at (and the output file is in another directory). + +Date: 22 December 1984 02:52-EST +From: Christopher C. Stacy +Subject: obscure bug in trivial feature +To: BUG-ITS @ MIT-MC + +SYSDSK is not called from QSOCL3 when a :MOVE happens +since the input channel's file names are not looked +at (and the output file is in another directory). + +Date: 11 December 1984 19:05-EST +From: Glenn S. Burke +Subject: highly secure systems +To: bug-swelling-itching-brain +cc: BUG-ITS @ MIT-MC + +Whoever brought up ML didn't notice that it didn't know the time. +Of course, said culprit probably was more familiar with the current +software running there than I, so knew that there was no point. + +You see, you aren't allowed to get a ddt if the system doesn't know the +time. Running pdset becomes a bit difficult. + +Date: 9 December 1984 21:10-EST +From: Alan Bawden +Subject: 7LP: +To: INFO-ITS @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I have installed a 7LP: device on MC and ML for using the LN01 printer on +the 7th floor to generate simple hardcopy. Outputting to 7LP: opens a +connection to PREP (where the spooler runs) and transmits your text. For +example :COPY DSK:ALAN;ALAN LOGIN,7LP: makes hardcopy of my init file. +Reading from 7LP:.FILE. (DIR) produces a listing of the queue on PREP, so +you can type 7LP to DDT to see who's output is in front of yours. + +Date: 8 December 1984 14:43-EST +From: Alan Bawden +Subject: Not about: RU-BLUE +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC, CSTACY @ MIT-MC, + DEVON @ MIT-MC, GSB @ MIT-MC, Bug-MAIL @ MIT-OZ, MARTY @ MIT-OZ +In-reply-to: Msg of 8 Dec 1984 07:38-EST from Ken Harrenstien + + Date: 8 December 1984 07:38-EST + From: Ken Harrenstien + ... the binary-compare feature to SRCCOM ... + +Oh yeah, I forgot about that feature! I used it a couple of times to +compare KS microcode load files when I made trivial changes that +theoretically changed only a single microinstruction. I must say, however, +that I have never had very much luck applying it to midas BIN files. There +always seems to be something you forget that causes all of the constants to +move. I guess its worth trying again in this case. I can only think of +two non-KS changes that have been made since I started, commenting one of +them out (a trivial fix) should cause everything to assemble into the same +places, I -think-... + +Date: 8 December 1984 07:38-EST +From: Ken Harrenstien +Subject: RU-BLUE +To: ALAN @ MIT-MC +cc: GSB @ MIT-MC, BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC, CSTACY @ MIT-MC, + DEVON @ MIT-MC, Bug-MAIL @ MIT-OZ, MARTY @ MIT-OZ + +Alan, would you believe that I added the binary-compare feature to +SRCCOM just so that I could quickly verify that ITS still assembled +into the same thing while I was adding all the NET/INET/TCP conditionals? + +It was pretty handy, too. Anyway, the same technique might work for +ensuring that your own changes don't affect the KA/KL version of ITS. + +Date: 8 December 1984 01:18-EST +From: Alan Bawden +Subject: BOJ device .UAI mode SIOT +To: BUG-ITS @ MIT-MC + +An IOT on a BOJ channel open for input in block mode will return with the +input pointer not fully counted out when the user closes his JOB channel. +A SIOT on a BOJ channel open for input in unit ascii mode will simply hang +forever if the user closes his JOB channel before the byte count becomes 0. +The block mode behavior is what I would expect by analogy with reaching the +end of a file. + +Date: 6 December 1984 14:00-EST +From: Alan Bawden +Subject: RU-BLUE +To: GSB @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC, CSTACY @ MIT-MC, + DEVON @ MIT-MC, Bug-MAIL @ MIT-OZ, MARTY @ MIT-OZ +In-reply-to: Msg of 6 Dec 1984 02:34-EST from Glenn S. Burke + + Date: 6 December 1984 02:34-EST + From: Glenn S. Burke + Date: Thu, 6 Dec 84 00:02 EST + From: "Christopher C. Stacy" + ... I bet that ML has obsolete Internet routing tables for finding + someone to ask about the gateway to net 128.6.xx.aa. ML is also + probably unable to reach random other hosts. I'll fix this + eventually. + + Seems to me that we should make the most of ml's existence while it + still exists; it does arpa/chaos fairly well, after all. It has been + 50 days since it's been booted, and i think it has had one parity stop + and one random retryable disk error stop in that time. I forget how + long it had been up before this uptime binge, but i think that too was + a record. + +CStacy's observation about routing tables is correct. ML is running an +ancient version of ITS without Moon's fix to that code. If we really want +to make the most of ML, we should assemble a more modern version for it. +Of course I have made a great number of edits to the source of ITS in the +last few months, many having to do with the KA/KL conditionalizations, so +there is no guarantee that an ITS assembled from the current sources will +actually represent any improvements. (I have tried to make sure the +binaries for the KA and KL didn't change, but...) + +Date: 6 December 1984 02:34-EST +From: Glenn S. Burke +Subject: RU-BLUE +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC, DEVON @ MIT-MC, + MARTY%MIT-OZ @ SCRC-STONY-BROOK, Bug-MAIL%MIT-OZ @ SCRC-STONY-BROOK + + Date: Thu, 6 Dec 84 00:02 EST + From: "Christopher C. Stacy" + BUG-MAIL@MIT-MC.ARPA, DEVON@MIT-MC.ARPA + In-reply-to: + + Date: 5 Dec 1984 22:49 EST (Wed) + From: Martin David Connor + I removed ML from the places that mail can be forwarded by. + (DOMAINS.TXT). I know that RU-BLUE is up and often send mail there. + + MC can also reach RU-BLUE fine. ML is running the same mail software and has + the same host tables. I bet that ML has obsolete Internet routing tables for + finding someone to ask about the gateway to net 128.6.xx.aa. ML is also + probably unable to reach random other hosts. I'll fix this eventually. + +Seems to me that we should make the most of ml's existence while it +still exists; it does arpa/chaos fairly well, after all. It has been +50 days since it's been booted, and i think it has had one parity stop +and one random retryable disk error stop in that time. I forget how +long it had been up before this uptime binge, but i think that too was +a record. + +Date: Thu, 6 Dec 84 00:02 EST +From: "Christopher C. Stacy" +Subject: RU-BLUE +To: Martin David Connor +Cc: Bug-MAIL%MIT-OZ@SCRC-STONY-BROOK.ARPA, BUG-ITS@MIT-MC.ARPA, + BUG-MAIL@MIT-MC.ARPA, DEVON@MIT-MC.ARPA +In-reply-to: + + Date: 5 Dec 1984 22:49 EST (Wed) + From: Martin David Connor + I removed ML from the places that mail can be forwarded by. + (DOMAINS.TXT). I know that RU-BLUE is up and often send mail there. + +MC can also reach RU-BLUE fine. ML is running the same mail software and has +the same host tables. I bet that ML has obsolete Internet routing tables for +finding someone to ask about the gateway to net 128.6.xx.aa. ML is also +probably unable to reach random other hosts. I'll fix this eventually. + + +Date: Mon 26 Nov 84 20:22:20-EST +From: J. Noel Chiappa +Subject: Re: MC hardware +To: CSTACY@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +cc: FINN@MIT-XX.ARPA, TY@MIT-XX.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Sun 25 Nov 84 11:51:00-EST + + I guess I'd consider this a non-optimal move. Since we have a +modest maount of memory on the machine now, I don't think it such a +big lose to switch off 25% of the memory until DEC can look at it. +There is some possibility that they aren't confused when they say they +are hot. + Noel +------- + +Date: 25 November 1984 11:51-EST +From: Christopher C. Stacy +Subject: MC hardware +To: BUG-ITS @ MIT-MC +cc: FINN @ MIT-XX, TY @ MIT-XX + +On MC: memory boxes B and C are only online because their +override switches are on. They are too hot, I think. + +Date: Fri, 23 Nov 84 20:46 EST +From: "Christopher C. Stacy" +Subject: NITS? +To: Alan Bawden +Cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: The message of 23 Nov 84 13:17-EST from Alan Bawden + +Someone turned the card over accidently I guess. + +Date: 23 November 1984 13:17-EST +From: Alan Bawden +Subject: NITS? +To: BUG-ITS @ MIT-MC + +The Very Small Bulletin Board on MC told me to load NITS, but there isn't +any such file. I turned the card around to say just ITS which does exist. +I hope that this only means that thhe card was wrong and not that someone +accidentally deleted the system we are supposed to be running. + +Date: 16 November 1984 03:09-EST +From: Alan Bawden +Subject: ROLM lines +To: BUG-ITS @ MIT-MC + +I just edited the TTYTYP file to remove the %TYMDM bits from all of the +ROLM lines. Experiment reveals that MC never seems to get told when such a +line is reconnected to a new terminal, thus setting this bit causes MC to +remember old, sometimes incorrect, terminal type information. Removing the +%TYMDM bits should cause ITS to reset the terminal type information +whenever the tty becomes free. This is better than the current situation, +where a user can be seriously confused, but since the ROLM -must- be able +to do this correctly, someone should really be looking into fixing it. + +Date: 6 November 1984 15:48-EST +From: Alan Bawden +Subject: ITS Uptime Server? +To: MARTY @ MIT-OZ +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of Tue 6 Nov 84 11:36-EST from Martin David Connor + + Date: Tue 6 Nov 84 11:36-EST + From: Martin David Connor + Could someone implement an UPTIME chaos server for ITS? + +Done. + +Date: Tue 6 Nov 84 11:36-EST +From: Martin David Connor +Subject: ITS Uptime Server? +To: BUG-ITS@MIT-MC + + +Could someone implement an UPTIME chaos server for ITS? + + +Date: 4 November 1984 14:42-EST +From: Alan Bawden +Subject: I just checked and he isn't blue... +To: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Every once in a great while when I log in I discover that %TOMOR is not set +in my TTYOPT word. Since my LOGIN does nothing to change the default +setting of more processing it must be the case that normally ITS or DDT (or +PWORD?) turns it on. Well sometimes, given a blue Moon or something, it +must fail to work... + +Date: 30 October 1984 13:12-EST +From: Alan Bawden +To: STORY @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 30 Oct 1984 11:46-EST from Kenneth Byrd Story + + Date: 30 October 1984 11:46-EST + From: Kenneth Byrd Story + To: BUG-DDT + I keep getting logged-out automatically by mc; what's the problem? + +Well, as far as I know nothing on ITS ever causes you to be "logged-out +automatically". What exactly were the symptoms? Did you get a message +like: "Top level interrupt, tree detached"? Did you just get "MC ITS 1382 +Console XX Free. HH:MM:SS"? When you reconnected did DDT offer to reattach +you to a detached tree or tell you that you had dead detached trees? How +were you reaching MC? (ROLM? Dialup? Chaosnet?) + +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 116836; Sun 28-Oct-84 17:38:27-EST +Date: Sun, 28 Oct 84 17:38 EST +From: "David A. Moon" +Subject: Getting Detached from MC +To: "Thomas A. Russ" +cc: BUG-ITS@MIT-MC.ARPA, bede@MIT-XX.ARPA +In-Reply-To: The message of 12 Oct 84 13:42-EDT from Thomas A. Russ +Message-ID: <841028173837.9.MOON@EUPHRATES.SCRC.Symbolics> + + Date: 12 October 1984 13:42-EDT + From: Thomas A. Russ + + I seem to be getting detached from MC regularly when I dial in over + the ROLM switch from my office. I wonder if this could be some problem + related to the ROLM system. I have DTI # 4303 connected to wall jack # 333 + in room 369. + + I don't know what line on MC is being called. The symptom is that my job + on MC gets a top level interrupt and is detached. The connection to MC + is left intact. + + Even as I write this message, it happens again. + +There used to be a bug, which may still be around, where a disconnected dialup +line got the bogus message "top level interrupt job detached" printed on it. +The job was detached because the dialup line was disconnected, not because it +got a top-level interrupt, but the logout/detach-message printer didn't know +that. Of course if the dialup line was really disconnected, no one sees the +erroneous message (except people spying on the dialup line, which is how this +was discovered originally). + +I also believe that the Rolm switch has a bug where when you tell it to disconnect +it drops "carrier detect" several seconds before it stops passing bits through, +so you see some garbage bits. + +What all this suggests is that maybe you are getting detached because the Rolm +switch is saying it's hanging up, or MC or its front-end pdp-11 incorrectly thinks +the Rolm is saying it's hanging up. + +Date: 12 October 1984 15:26-EDT +From: Alan Bawden +Subject: Getting Detached from MC +To: TAR @ MIT-MC +cc: BUG-ITS @ MIT-MC, bede @ MIT-XX +In-reply-to: Msg of 12 Oct 1984 13:42-EDT from Thomas A. Russ + + Date: 12 October 1984 13:42-EDT + From: Thomas A. Russ + ... The symptom is that my job on MC gets a top level interrupt and is + detached.... + +Well, it would be nice to know what interrupt it is that you are getting. +If it happens sometime when you don't need to reattach the tree, you might +leave it detached so that an ITS hacker can take a look at it. + +Date: 12 October 1984 13:42-EDT +From: Thomas A. Russ +Subject: Getting Detached from MC +To: BUG-ITS @ MIT-MC, bede @ MIT-XX +cc: TAR @ MIT-MC + +I seem to be getting detached from MC regularly when I dial in over +the ROLM switch from my office. I wonder if this could be some problem +related to the ROLM system. I have DTI # 4303 connected to wall jack # 333 +in room 369. + +I don't know what line on MC is being called. The symptom is that my job +on MC gets a top level interrupt and is detached. The connection to MC +is left intact. + +Even as I write this message, it happens again. + + Tom. + +Date: 11 October 1984 15:30-EDT +From: Alan Bawden +Subject: Fair warning... +To: BUG-ITS @ MIT-MC + +Until further notice everybody should be carefull about editing the sources +for ITS itself, as I am in the process of conditionalizing it for the KS +processor. + +Date: Sun 7 Oct 84 16:20-EDT +From: Martin David Connor +Subject: 28 page host table too big? +To: bug-its@MIT-MC +CC: BUG-TCP@MIT-MC, INFO-HOSTS@MIT-MC + + +I fetched the latest NIC host table and installed it on MC, +and suddenly I couldn't get a DDT from OZ. I backed out, renaming it +to SYSBIN;HOSTS3 TOOBG?, and was then able to SUPDUP in and get a DDT without +it barfing and saying there was a PWORD bug. I bet the bug is it couldn't +map the host table. + +Anyway, someone should look at PWORD. + + +Date: 2 October 1984 22:22-EDT +From: Ed Schwalenberg +Subject: Don't try this at home kids... +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I was logged in from home as Alan did this, and got to see that my most-hated +ITS bug has been fixed: when the system comes up from a crash, it no longer +resets the baud rate on dialed-up lines. Thanks to whoever fixed this. + +PS. to Alan: Not coincidentally, I was doing :USET UPC when it crashed. + +Date: 2 October 1984 21:54-EDT +From: Alan Bawden +Subject: Don't try this at home kids... +To: BUG-ITS @ MIT-MC + +Setting %PSPUB in your PC flags causes all kinds of havoc to break out on +MC. The first time I did it tonight the system console printed: + +PAGE FAIL ERROR #1, PC = 772740,,301 JOB # 34, USR: ALAN J , PFW = 543000,,301 + +When the job returned to DDT, DDT claimed it was getting a PURINS +interrupt (which I didn't even think could happen on KLs!). I guess you +can tell from this that I was actually setting all the flags... + +Since I couldn't see the system console from my office where I was doing +this, I did it several times. Eventually I seem to have hung the +microcode. A few controlled experiments later I crashed MC again with an +error that contained the string "BAD PAGE FAIL WORD" (the decwriter was +dropping so many characters thats about all I could see, I wish that sucker +was more reliable). + +Date: 30 September 1984 21:10-EDT +From: David C. Plummer +Subject: HOSTS3 +To: CSTACY @ MIT-MC +cc: BUG-TCP @ MIT-MC, BUG-ITS @ MIT-MC, KLH @ SRI-NIC, + MOON @ SCRC-TENEX + + Date: 25 September 1984 17:43-EDT + From: Christopher C. Stacy + MOON @ SCRC-TENEX + + The latest host table (including HSTNIC #384) is compiled and installed. + The HOSTS3 compiler is "fixed". + + HOSTS3 hackers: The compiler does not do the sort of dynamic memory + allocation I had assumed. I was therefore able to make some more room in + the ITS version simply by moving where in core the table was being + constructed. I didn't calculate how much room is left over for new code + or tables, but the increase should hold us for a while. Of course, we + are racing against the rate of host additions on the various networks in + our table (the Internet, the Chaosnet, etc.) Hopefully by the time we + run out it will be time to implement a hairy namespace system. + Won't that be fun! +This probably doesn't have a large place in our religion, but you +could consider doing the conversion on a machine with a larger +address space. + +Date: 30 September 1984 02:01-EDT +From: Alan Bawden +Subject: Not critical +To: BUG-ITS @ MIT-MC + +Giving string arguments to RENAME containing different directories and/or +different devices should cause an error if the "from" device doesn't +support that kind of renameing. I would suggest either %EBDDV or %ENSMD. +Currently RENAME just ignores the device and directory in the "to" +filename. + +The same goes for the devices in the MLINK call. + +Note that it is not unreasonable to imagine a job device that supported +cross-directory and cross-device renameing and linking, so the error +returned really should be a function of the device. + +Date: 30 September 1984 01:30-EDT +From: Glenn S. Burke +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 28 September 1984 19:13-EDT + From: Christopher C. Stacy + + I was just detached because the BABYL I was running claims to have + gotten a parity error. The message was top-level interrupt... + I don't think the sysjob printed anything about parity errors, + or even sweeped for them....I wonder if it was really a parity error... + I wonder if this was what happenned to that guy the other day and + what it is. + +Irrecoverable disk error in page mapping gives a parity error interrupt. + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 86001; Fri 28-Sep-84 15:03:14-EDT +Date: Fri, 28 Sep 84 15:03 EDT +From: "David A. Moon" +Subject: M-X Copy File +To: "Robert W. Kerns" +cc: "Christopher C. Stacy" , BUG-FILE@MIT-MC.ARPA, + BUG-ITS@MIT-MC.ARPA, BUG-LISPM@MIT-MC.ARPA +In-Reply-To: <840928023221.8.RWK@HUDSON.SCRC.Symbolics> +Message-ID: <840928150349.8.MOON@EUPHRATES.SCRC.Symbolics> + + Date: Friday, 28 September 1984, 02:32-EDT + From: Robert W. Kerns + + [I haven't looked at the code; I'm surmising what's + going on from your message. But I think you've forgotten + some of the more unfortunate parts of ITS!] + +No. + + Date: Saturday, 15 September 1984, 12:06-EDT + From: David A. Moon + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + + This is because the routine CLOSIT in the FILE job sets the author of the + file it just wrote to the user's HSNAME. + HSNAME is the correct thing to set the file author to on ITS, + because "file authors" are directories, not people. + +Yes, the problem is who sets it, not what it sets it to. It sets it at the time +you close the file, even if you already set it yourself to something better, which +is the source of the bug. + + Evidently it does this because + the FILE job doesn't login under the name of the user who is using it. + We can do one of + (1) Make the FILE job login under the right name. + I don't think this makes any difference. Isn't the problem + overwriting the explicit CHANGE-PROPERTIES that COPYF does? + +If the file job logged in under the right name then it wouldn't need to set the +author itself at the wrong time, because ITS would set it to the right value at +the right time. + + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. + This would involve changing the UFD format, since + currently the file author is just the MFD index + of the directory. + +How would changing the source of the person's name affect the UFD format? + +You're right that the file job would have to set its XUNAME to the person's HSNAME. + + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. + I think this is right, and the easiest. Then if a + CHANGE-PROPERTIES sets it to something else, it will + prevail, right? + +Yes. + +Received: from SCRC-HUDSON by SCRC-YUKON via CHAOS with CHAOS-MAIL id 63942; Fri 28-Sep-84 02:32:03-EDT +Date: Fri, 28 Sep 84 02:32 EDT +From: "Robert W. Kerns" +Subject: M-X Copy File +To: "David A. Moon" +cc: "Christopher C. Stacy" , BUG-FILE@MIT-MC.ARPA, + BUG-ITS@MIT-MC.ARPA, BUG-LISPM@MIT-MC.ARPA +In-Reply-To: <840915120628.5.MOON@EUPHRATES.SCRC.Symbolics> +Message-ID: <840928023221.8.RWK@HUDSON.SCRC.Symbolics> + +[I haven't looked at the code; I'm surmising what's +going on from your message. But I think you've forgotten +some of the more unfortunate parts of ITS!] + + Date: Saturday, 15 September 1984, 12:06-EDT + From: David A. Moon + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + + This is because the routine CLOSIT in the FILE job sets the author of the + file it just wrote to the user's HSNAME. +HSNAME is the correct thing to set the file author to on ITS, +because "file authors" are directories, not people. + + Evidently it does this because + the FILE job doesn't login under the name of the user who is using it. + We can do one of + (1) Make the FILE job login under the right name. +I don't think this makes any difference. Isn't the problem +overwriting the explicit CHANGE-PROPERTIES that COPYF does? + + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. +This would involve changing the UFD format, since +currently the file author is just the MFD index +of the directory. + + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. +I think this is right, and the easiest. Then if a +CHANGE-PROPERTIES sets it to something else, it will +prevail, right? + +Date: 28 September 1984 19:13-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I was just detached because the BABYL I was running claims to have +gotten a parity error. The message was top-level interrupt... +I don't think the sysjob printed anything about parity errors, +or even sweeped for them....I wonder if it was really a parity error... +I wonder if this was what happenned to that guy the other day and +what it is. + +Date: 26 September 1984 01:22-EDT +From: Christopher C. Stacy +Subject: FOURTH is back online on MC +To: TY @ MIT-XX, FINN @ MIT-XX +cc: BUG-ITS @ MIT-MC, KMP @ MIT-MC, ALAN @ MIT-MC, PSZ @ MIT-MC, + MEYER @ MIT-MC, GSB @ MIT-MC + +I didn't see any signs of the Trident disk repairman (John Holden?) +here today, although I thought he was supposed to be come and work +on unit #3 on MC (like I thought he was supposed to do a week ago +when it broke.) Did he come? + +I put the disk back online and tried it out, and it seems to work. +However, if the problem is intermittent, as soon as the drive gets +hot again or whatever it will break and the system will crash etc. + +Date: 26 September 1984 01:01-EDT +From: Christopher C. Stacy +Sender: CSTAC0 @ MIT-MC +Subject: x3-5891 +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-PWORD @ MIT-MC, USER-A @ MIT-ML +In-reply-to: Msg of 26 Sep 1984 00:54-EDT from Alan Bawden + + Date: 26 September 1984 00:54-EDT + From: Alan Bawden + + Thats pretty strange given that that version of PWORD had been working on + ML for months with no problems. + Somehow I'm not very confident that we understand what is going on here... + +Yeah, but it was getting PDLOV interrupts and I increased the PDL size +and now it works...what can I say? A new giant host table was +installed today, so maybe PWORD's memory management is all shot to +hell and I have somehow just masked it. I'll look at it in more +detail soon. We should move this conversation to just BUG-PWORD. + +Chris + +Date: 26 September 1984 01:01-EDT +From: Christopher C. Stacy +Sender: CSTAC0 @ MIT-MC +Subject: x3-5891 +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-PWORD @ MIT-MC, USER-A @ MIT-ML +In-reply-to: Msg of 26 Sep 1984 00:54-EDT from Alan Bawden + + Date: 26 September 1984 00:54-EDT + From: Alan Bawden + + Thats pretty strange given that that version of PWORD had been working on + ML for months with no problems. + Somehow I'm not very confident that we understand what is going on here... + +Yeah, but it was getting PDLOV interrupts and I increased the PDL size +and now it works...what can I say? A new giant host table was +installed today, so maybe PWORD's memory management is all shot to +hell and I have somehow just masked it. I'll look at it in more +detail soon. We should move this conversation to just BUG-PWORD. + +Chris + +Date: 26 September 1984 00:54-EDT +From: Alan Bawden +Subject: x3-5891 +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-PWORD @ MIT-MC, USER-A @ MIT-ML +In-reply-to: Msg of 26 Sep 1984 00:43-EDT from Christopher C. Stacy + + Date: 26 September 1984 00:43-EDT + From: Christopher C. Stacy + PWORD was losing on ML because it did not have a big enough stack, so + I fixed it. + +Thats pretty strange given that that version of PWORD had been working on +ML for months with no problems. + + Why the same version of this program does not run on both + MC and ML is a mystery to me. + +Somehow I'm not very confident that we understand what is going on here... + +Date: 26 September 1984 00:43-EDT +From: Christopher C. Stacy +Subject: x3-5891 +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-PWORD @ MIT-MC, USER-A @ MIT-ML +In-reply-to: Msg of 26 Sep 1984 00:00-EDT from Alan Bawden + + +PWORD was losing on ML because it did not have a big enough stack, so +I fixed it. Why the same version of this program does not run on both +MC and ML is a mystery to me. + +Also, I fixed the host-deletion (for "VAR GOOD") stuff long ago, and +although the new code works on MC, it doesn't seem to work on ML: I +can't delete random numbered hosts from the safe list over there. + +I'll have to look into these things, but I don't have time today. + +Date: 26 September 1984 00:00-EDT +From: Alan Bawden +Subject: x3-5891 +To: BUG-PWORD @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Whenever you connect to ML these days PWORD says: + +Internal Error: Unknown Interrupt. +Please do :BUG PWORD ^C +Or call 1-617-253-5891 + +Even if nobody cares to fix this, I wonder if that phone number has any +relationship to current reality... + +Date: 25 September 1984 17:43-EDT +From: Christopher C. Stacy +Subject: HOSTS3 +To: INFO-HOSTS @ MIT-MC +cc: BUG-TCP @ MIT-MC, BUG-ITS @ MIT-MC, KLH @ SRI-NIC, + MOON @ SCRC-TENEX + +The latest host table (including HSTNIC #384) is compiled and installed. +The HOSTS3 compiler is "fixed". + +HOSTS3 hackers: The compiler does not do the sort of dynamic memory +allocation I had assumed. I was therefore able to make some more room in +the ITS version simply by moving where in core the table was being +constructed. I didn't calculate how much room is left over for new code +or tables, but the increase should hold us for a while. Of course, we +are racing against the rate of host additions on the various networks in +our table (the Internet, the Chaosnet, etc.) Hopefully by the time we +run out it will be time to implement a hairy namespace system. +Won't that be fun! + +Date: 25 September 1984 15:14-EDT +From: David C. Plummer +Subject: MATH-HUB +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-MINITS @ MIT-MC + + Date: 24 September 1984 19:35-EDT + From: Alan Bawden + + MIT-MATH-HUB likes to start up a TELNET server on MC, cause it to open a + STY, and then wait forever without outputing a ^Z (er, "call") to the STY. + The TELNET job seem to be waiting to .IOT a 377 down its Chaos connection + to MATH-HUB. This is a loss because it wastes a STY on MC for no good + purpose. If you gun the TELNET job, MATH-HUB just reconnects and starts + another one. +Well, my guess is that somebody's terminal over there ha a happy +T key. I found a not-logged-in telnet job from Math Hub, so +here's what I did. + :CHATST + L TELNET +uppercase matters! + [Call] +Gun down the old TELSER and wait for it to reconnect. +Unfortunately, it didn't, so my experiment failed. If it did, I +would have done + O (opens the connection, I think) + S (soak data, I think, to see what it really is sending) +Maybe somebody else will have better luck some other time. + +Date: 24 September 1984 19:35-EDT +From: Alan Bawden +Subject: MATH-HUB +To: BUG-ITS @ MIT-MC +cc: BUG-MINITS @ MIT-MC + +MIT-MATH-HUB likes to start up a TELNET server on MC, cause it to open a +STY, and then wait forever without outputing a ^Z (er, "call") to the STY. +The TELNET job seem to be waiting to .IOT a 377 down its Chaos connection +to MATH-HUB. This is a loss because it wastes a STY on MC for no good +purpose. If you gun the TELNET job, MATH-HUB just reconnects and starts +another one. + +Date: 24 September 1984 13:07-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: BUG-TCP @ MIT-MC, INFO-HOSTS @ MIT-MC + +Well, I think we are finally out of address space. +New host tables cannot be compiled anymore because +they are too massive. People should not try to +compile any changes until I get back to you, +hopefully with a solution. + +Date: 24 September 1984 12:18-EDT +From: Christopher C. Stacy +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 22 Sep 1984 23:32-EDT from Devon S. McCullough + + Date: 22 September 1984 23:32-EDT + From: Devon S. McCullough + To: BUG-ITS + + What is %TDSTY and %TDUNF and whatever other innovations + have hit the scene? + Are they documented? + + +DDT doesn't know about these symbols, and they are not in BITS. +Where did you see them? + +Date: 22 September 1984 23:32-EDT +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +What is %TDSTY and %TDUNF and whatever other innovations have hit the scene? +Are they documented? + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 83844; Sat 22-Sep-84 14:47:57-EDT +Date: Sat, 22 Sep 84 14:46 EDT +From: "David A. Moon" +Subject: M-X Copy File +To: "Bernard S. Greenberg" +cc: CSTACY@MIT-MC.ARPA, BUG-FILE@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-Reply-To: <840921083548.6.BSG@CONCORD.SCRC.Symbolics> +Message-ID: <840922144653.0.MOON@EUPHRATES.SCRC.Symbolics> + + Date: Friday, 21 September 1984, 08:35-EDT + From: Bernard S. Greenberg + + Date: Saturday, 15 September 1984, 12:06-EDT + From: David A. Moon + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + + This is because the routine CLOSIT in the FILE job sets the author of the + file it just wrote to the user's HSNAME. Evidently it does this because + the FILE job doesn't login under the name of the user who is using it. + We can do one of + (1) Make the FILE job login under the right name. + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. + +Okay, let me try again. + + It doesn't know the right author at OPEN time. + +Yes it does. Suggestion #3 is that the FILE job set the author to the HSNAME +at OPEN time, before the user has changed the author to something else, rather +than at CLOSE time, after the user has changed the author to something else. + + Excuse me for not being ITSworthy enough, but if the FILE job has the + option of (2), namely, setting the author to a quantity of its + liking, why doesn't it remember the result of the PROPERTIES + command sent at it for this purpose and set the author to what + the user side WANTS it to be? + +Suggestion #2 refers to ITS, not the FILE job. + +Yes, I ought to have included the other logically possible suggestion: + + (4) Keep a copy of the author in the FILE job's memory, instead + of in the file system. Set it to the HSNAME when the file is + opened, set it to the new author when CHANGE-PROPERTIES is + done, and copy it into the file system when the file is closed. + Don't forget to change PROPERTIES, and maybe DIRECTORY-LIST, to + return this private copy of the author instead of the one out + in the file system. + +Date: 22 September 1984 09:52-EDT +From: David A. Moon +Subject: Moon's sabotage of ITS +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 10 September 1984 18:37-EDT + From: Christopher C. Stacy + To: BUG-ITS @ MIT-MC + + The recent change in ITS where the SYS job is given 2 extra job + slots worth of core (instead of just SYSB) causes the system + to crash in CORS2 immediately when coming up. + +I had put a word count where a page count was expected, so the system +job tried to get about two thousand pages when the system started up. +Fixed in the source, but not reassembled since I wasn't physically +present to test it. + +Received: from SCRC-CONCORD by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 83372; Fri 21-Sep-84 08:34:39-EDT +Date: Fri, 21 Sep 84 08:35 EDT +From: "Bernard S. Greenberg" +Subject: M-X Copy File +To: Moon@SCRC-STONY-BROOK.ARPA, CSTACY@MIT-MC.ARPA, BUG-FILE@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: <840915120628.5.MOON@EUPHRATES.SCRC.Symbolics> +Message-ID: <840921083548.6.BSG@CONCORD.SCRC.Symbolics> + + Date: Saturday, 15 September 1984, 12:06-EDT + From: David A. Moon + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + + This is because the routine CLOSIT in the FILE job sets the author of the + file it just wrote to the user's HSNAME. Evidently it does this because + the FILE job doesn't login under the name of the user who is using it. + We can do one of + (1) Make the FILE job login under the right name. + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. +It doesn't know the right author at OPEN time. + Suggestions? +Excuse me for not being ITSworthy enough, but if the FILE job has the +option of (2), namely, setting the author to a quantity of its +liking, why doesn't it remember the result of the PROPERTIES +command sent at it for this purpose and set the author to what +the user side WANTS it to be? + +Date: Mon, 17 Sep 1984 09:35 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: "Leigh L. Klotz" +Cc: ALAN@MIT-MC, BUG-ITS@MIT-MC, CSTACY@MIT-MC, FEATURE-ENTENNMANS@MIT-MC, + ITS-LOVERS@MIT-MC, Moon%SCRC-RIVERSIDE@MIT-MC.ARPA +Subject: How to copy files on ITS without trashing them +In-reply-to: Msg of 17 Sep 1984 00:11-EDT from Leigh L. Klotz + + Date: Monday, 17 September 1984 00:11-EDT + From: Leigh L. Klotz + To: ALAN at MIT-MC + cc: BUG-ITS at MIT-MC, CSTACY at MIT-MC, FEATURE-ENTENNMANS at MIT-MC, + ITS-LOVERS at MIT-MC, Moon at SCRC-RIVERSIDE + Re: How to copy files on ITS without trashing them + + I always move files with TECO myself, <>'ing over the filenames. + +Hmm. I bring the machine down and copy them into the paging area with SALV. + +Date: 17 September 1984 00:11-EDT +From: Leigh L. Klotz +Subject: How to copy files on ITS without trashing them +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, FEATURE-ENTENNMANS @ MIT-MC, + ITS-LOVERS @ MIT-MC, Moon @ SCRC-RIVERSIDE +In-reply-to: Msg of 16 Sep 1984 20:16-EDT from Alan Bawden + +I always move files with TECO myself, <>'ing over the filenames. + +Date: 16 September 1984 20:16-EDT +From: Alan Bawden +Subject: How to copy files on ITS without trashing them +To: CSTACY @ MIT-MC, Moon @ SCRC-RIVERSIDE +cc: BUG-ITS @ MIT-MC, FEATURE-ENTENNMANS @ MIT-MC, ITS-LOVERS @ MIT-MC +In-reply-to: Msg of Sun 16 Sep 84 16:55 EDT from David A. Moon + + Date: Sun, 16 Sep 84 16:55 EDT + From: David A. Moon + The most convenient way, I have always found, is to use the DIRED + program.... + +My recent experience with the DIRED program is that it gets MPVs a lot. I +always do such things by reading DIR:.FILE. (DIR) into an Emacs buffer and +writing a TECO program to put together an XFILE for DDT to slurp up. I +like this because it lets me run three different programs (the DIR device, +Emacs and DDT), code in two obscure programming languages (TECO and DDT), +and use two unrelated control-character-oriented command languages (Emacs +and DDT). Using a JOB device as the first step gets the process started +off on the right foot. If I can use a translation somehow, thats a big +plus. + +Sometimes I run the XFILE in a separate DDT job that I then  so that I +can watch the process using PEEK. This is especially entertaining when I +are dealing with files using the ML device or the archive device. The fact +that two jobs are typing on my console at the same time without having +the operating system lose track of the position of my cursor is fun to +contemplate. + +If what needs to be done is particularly complex, it's always fun to write a +little assembly language program to do the job. Preferably by depositing +it directly into a job using DDT, although if I must stoop to using an +assembler I can make up for the loss of face by writing a hairy MIDAS +macro. + +Date: 16 September 1984 18:56-EDT +From: Christopher C. Stacy +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-LISPM @ MIT-MC +In-reply-to: Msg of 16 Sep 1984 16:32-EDT from Alan Bawden + +Sigh....so much for trusting ZWEI... + +Received: from SCRC-EUPHRATES by SCRC-YUKON via CHAOS with CHAOS-MAIL id 61136; Sun 16-Sep-84 17:53:24-EDT +Date: Sun, 16 Sep 84 17:50 EDT +From: "David A. Moon" +Subject: Source for :TIME +To: Alan Bawden +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: The message of 6 Sep 84 02:21-EDT from Alan Bawden +Message-ID: <840916175052.0.MOON@EUPHRATES.SCRC.Symbolics> + + Date: 6 September 1984 02:21-EDT + From: Alan Bawden + + Well, I just retrieved source files for a bunch of ITS system programs from + AI and ML backup tapes. I was able to find an OLD source for :TIME + (version 25, version 39 is installed on MC right now...). The most up to + date source probably lives only on DM backup tapes. Do we have a way to + read DM backup tapes? Did anyone write such a tool when the DM users moved + to XX? The good news is that as far as I can tell, TIME is the -only- + program whose source file is trapped in that particular way... + +I don't know of any way to do it, but the format is so simple. Each file +on the tape is a file (i.e. there are tape marks between the files) and +just has some header information at the front. + +Received: from SCRC-EUPHRATES by SCRC-YUKON via CHAOS with CHAOS-MAIL id 61133; Sun 16-Sep-84 17:33:18-EDT +Date: Sun, 16 Sep 84 17:30 EDT +From: "David A. Moon" +Subject: Top level interrupt +To: Alan Bawden , CSTACY@MIT-MC.ARPA, BEN@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: The message of 13 Sep 84 21:55-EDT from Alan Bawden +Message-ID: <840916173045.7.MOON@EUPHRATES.SCRC.Symbolics> + + Date: 13 September 1984 21:55-EDT + From: Alan Bawden + + Date: 13 September 1984 19:44-EDT + From: Christopher C. Stacy + Date: 13 September 1984 14:46-EDT + From: Benjamin Kuipers + What is this nonsense about "Top level interrupt. Tree detached." + No, it means that your top-level process (presumably HACTRN) got a + fatal interrupt and died, detaching the entire tree. This could + possibly be the result of a memory parity error. + + I looked around for such dead trees when I first got this bug report, but I + didn't find any to figure out what happened to him. There have been no + parity errors for the last day, so that couldn't be the reason. + +There used to be a buglet, which may still be there, related to this. When +a dialup line hangs up the system job would type "Top level interrupt, tree +detached" on it. Of course there's no one on the other end of a hung-up dialup +line, so no one ever sees this message. But if it wasn't -really- hung up... + +Did this happen on a dialup line or a ROLM line by any chance? + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 81783; Sun 16-Sep-84 16:51:40-EDT +Date: Sun, 16 Sep 84 16:55 EDT +From: "David A. Moon" +Subject: How to copy files on ITS without trashing them +To: CSTACY@MIT-MC.ARPA +cc: Alan Bawden , BUG-LISPM@MIT-MC.ARPA, + BUG-ITS@MIT-MC.ARPA +In-Reply-To: The message of 16 Sep 84 16:32-EDT from Alan Bawden +Message-ID: <840916165519.5.MOON@EUPHRATES.SCRC.Symbolics> + +The most convenient way, I have always found, is to use the DIRED program. +Not the Emacs one, the other one. It has a set of file-processing commands +that take the star convention and it's fast. The only problem is that the +right MOVE command has some obscure name like BC (don't trust my memory on this!) + +Date: 16 September 1984 16:32-EDT +From: Alan Bawden +To: CSTACY @ MIT-MC +cc: BUG-LISPM @ MIT-MC, BUG-ITS @ MIT-MC + +God DAMNIT! When I came in this morning MC had no free job slots because +the system was completely full of dead TIME servers. After gunning about +50 of them so that I could work I found out that all of the binary files on +SYSNET, including the time server, had been trashed. You can probably +guess why: when you use M-X Copy File from a Lisp Machine it must clobber +36-bit binary files named BIN by DWIMing and treating them as 32-bit +L-machine BIN files. I'll bet if there were any text files on the old TCP +directory that contained imbedded ^M's they have been trashed as well by +being copied in Lisp Machine character set mode. And I know you already +noticed that Copy File clobbered all of the author information. You really +should have used :MOVE rather than deluding yourself into thinking that a +Lisp Machine could make the job easier. + +I reassembled the time server, but I leave it up to you to deal with the +rest of the mess. I would advise retrieving the entire TCP directory and +doing it again the right way. + +Date: 15 September 1984 17:15-EDT +From: Ray Hirschfeld +Subject: ROLM lines +To: BUG-ITS @ MIT-MC + +Because the new ROLM lines are specified as dialup lines in TTYTYP, +typing ":ttyloc foo" produces a location of not "foo" but instead +"Dialup: foo", a misfeature. + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 81650; Sat 15-Sep-84 12:03:45-EDT +Date: Saturday, 15 September 1984, 12:06-EDT +From: David A. Moon +Subject: M-X Copy File +To: Christopher C. Stacy , BUG-FILE at MIT-MC +cc: BUG-ITS at MIT-MC, BUG-LISPM at MIT-MC +In-Reply-To: The message of 14 Sep 84 21:00-EDT from Christopher C. Stacy +Message-ID: <840915120628.5.MOON@EUPHRATES.SCRC.Symbolics> + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + +This is because the routine CLOSIT in the FILE job sets the author of the +file it just wrote to the user's HSNAME. Evidently it does this because +the FILE job doesn't login under the name of the user who is using it. +We can do one of + (1) Make the FILE job login under the right name. + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. +Suggestions? + +Date: 14 September 1984 21:03-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC, INFO-HOSTS @ MIT-MC + +The TCP; directory on MC is now called "SYSNET;". + +Date: 14 September 1984 21:00-EDT +From: Christopher C. Stacy +Subject: M-X Copy File +To: BUG-FILE @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-LISPM @ MIT-MC + +M-X Copy File does not preserve authors on ITS. +It does preserve reference date (although maybe it should +use DNRF instead of referencing the file to copy it) and +the creation date. + +Date: 14 September 1984 16:58-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +T-300 unit 3 was going offline spontanesouly, causing the +system to hang on some operations. It should be fixed +Monday or Tuesday. + +Date: 13 September 1984 21:55-EDT +From: Alan Bawden +Subject: Top level interrupt +To: CSTACY @ MIT-MC +cc: BEN @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 13 Sep 1984 19:44-EDT from Christopher C. Stacy + + Date: 13 September 1984 19:44-EDT + From: Christopher C. Stacy + Date: 13 September 1984 14:46-EDT + From: Benjamin Kuipers + What is this nonsense about "Top level interrupt. Tree detached." + No, it means that your top-level process (presumably HACTRN) got a + fatal interrupt and died, detaching the entire tree. This could + possibly be the result of a memory parity error. + +I looked around for such dead trees when I first got this bug report, but I +didn't find any to figure out what happened to him. There have been no +parity errors for the last day, so that couldn't be the reason. If he was +neglecting to log in, PWORD gets a top level interrupt when your +not-logged-in-time-limit expires rather than telling you why you are going +away, but then it would have warned him in advance that this was likely to +occur if he hadn't logged in. I hope there is no signifigance to the fact +that what the SYSJOB really types is "Top level interrupt, tree detached"... + +Date: 13 September 1984 20:43-EDT +From: Glenn S. Burke +Subject: supdup +To: DCP @ MIT-MC +cc: BUG-ITS @ MIT-MC, dab @ MIT-BORAX + +ok, i looked up %nsrcl -- cls received while in rfc received state. +I made it treat this the same as %nscls, it now exits and says +"Connection being closed by foreign host." + +Date: 13 September 1984 20:32-EDT +From: David C. Plummer +Subject: supdup +To: dab @ MIT-BORAX +cc: BUG-ITS @ MIT-MC + + Received: by mit-borax.ARPA (4.12/4.7) + id AA03676; Thu, 13 Sep 84 16:15:39 edt + From: dab@mit-borax (David A. Bridgham) + Date: 13 Sep 1984 1615-EDT (Thursday) + + I recently wrote a supdup server for VAX UNIX running on TCP. + This is currently running on MIT-BORAX. To test it I would supdup in + from lisp machines or CCC. This forwards through MC with no problem. + However, from MC if I type ":supdup borax" it sits for a while and says + that the connection timed out without getting established. Could anyone + help? Thanks. +It works for me. I get the error somebody else already reported +by typing ^D to the login prompt. You are probably violating the +logout protocol or something. + +Date: 13 September 1984 19:44-EDT +From: Christopher C. Stacy +To: BEN @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 13 Sep 1984 14:46-EDT from Benjamin Kuipers + + Date: 13 September 1984 14:46-EDT + From: Benjamin Kuipers + To: BUG-ITS + + What is this nonsense about + "Top level interrupt. Tree detached." + This has happened to me twice in the last couple + of hours. Have I been gunned? + Ben + +No, it means that your top-level process (presumably HACTRN) got a +fatal interrupt and died, detaching the entire tree. This could +possibly be the result of a memory parity error. + +Received: by mit-borax.ARPA (4.12/4.7) + id AA03676; Thu, 13 Sep 84 16:15:39 edt +From: dab@mit-borax (David A. Bridgham) +Message-Id: <8409132015.AA03676@mit-borax.ARPA> +Date: 13 Sep 1984 1615-EDT (Thursday) +To: bug-its@mc +Subject: supdup + + I recently wrote a supdup server for VAX UNIX running on TCP. +This is currently running on MIT-BORAX. To test it I would supdup in +from lisp machines or CCC. This forwards through MC with no problem. +However, from MC if I type ":supdup borax" it sits for a while and says +that the connection timed out without getting established. Could anyone +help? Thanks. + Dave + +Date: 13 September 1984 14:46-EDT +From: Benjamin Kuipers +To: BUG-ITS @ MIT-MC + +What is this nonsense about +"Top level interrupt. Tree detached." +This has happened to me twice in the last couple +of hours. Have I been gunned? + Ben + +Date: 12 September 1984 17:42-EDT +From: Alan Bawden +Subject: archive +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, CENT @ MIT-MC, CSTACY @ MIT-MC +In-reply-to: Msg of 11 Sep 1984 13:12-EDT from Alan Bawden + + Date: 11 September 1984 13:12-EDT + From: Alan Bawden + Well .INFO. really is full to bursting, especially after I rescued some + info files from ML. I suppose this is yet another excuse to create the + SYSDOC directory and move a bunch of operating-system specific files there. + The problem is that a fair number of them will want to leave links behind + in .INFO. and links take up more directory room than a small file... + +OK, I created SYSDOC and moved a bunch of stuff there. .INFO. has a bit of +room again. People who care are welcome to shuffle the documentation +around more if they like. Just don't break anything. + +Date: 12 September 1984 08:57-EDT +From: Bill Long +To: BUG-ITS @ MIT-MC + +When the Rolm switch tries 4991 to get MC, it times out. + +Date: 11 September 1984 22:40-EDT +From: Leigh L. Klotz +Subject: 20th Anniversary of 36 Bits +To: CENT @ MIT-MC +cc: BUG-ITS @ MIT-MC, CC.Clive @ UTEXAS-20 +In-reply-to: Msg of 11 Sep 1984 04:24-EDT from Pandora B. Berman + +Don't forget Don Eastlake, DEE@CCA, I think. + +Date: 11 September 1984 13:12-EDT +From: Alan Bawden +Subject: archive +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, CENT @ MIT-MC +In-reply-to: Msg of 11 Sep 1984 09:30-EDT from Christopher C. Stacy + + Date: 11 September 1984 09:30-EDT + From: Christopher C. Stacy + I moved it to .INFO. because I am usually have alot of trouble updating + or re-assemble the ITS because the SYSTEM directory is full; I figured + SYSTEM sources ought to live in SYSTEM and that info ought to live in + .INFO.. + +Well .INFO. really is full to bursting, especially after I rescued some +info files from ML. I suppose this is yet another excuse to create the +SYSDOC directory and move a bunch of operating-system specific files there. +The problem is that a fair number of them will want to leave links behind +in .INFO. and links take up more directory room than a small file... + +Date: 11 September 1984 09:30-EDT +From: Christopher C. Stacy +Subject: archive +To: CENT @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 10 Sep 1984 23:50-EDT from Pandora B. Berman + +I moved it to .INFO. because I am usually have alot of trouble updating +or re-assemble the ITS because the SYSTEM directory is full; I figured +SYSTEM sources ought to live in SYSTEM and that info ought to live in .INFO.. + +Date: 11 September 1984 05:11-EDT +From: Ed Schwalenberg +Subject: Recent spate of crashes +To: BUG-NAME @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC + +NAME uses CORBLK to read in the ASCII file SYSENG;TTYTYP > and parses through +it looking for the magic comments of the form ;T00 System Console, which it +records in its database. It is under the mistaken impression that the file +in core will be terminated by either nulls or ^C's; the documentation for +CORBLK says no such thing. In fact, the difference between the length of a +file as returned by FILLEN and the next page boundary is filled with garbage. +I edited SYSTEM;TTYTYP > to create a copy that is "identical" to the previous +version except that it has some nulls in the garbage that follows the last +valid word. The bug should be really fixed in the source. I wonder how many +other programs depend on this sort of thing? + +Date: 11 September 1984 04:24-EDT +From: Pandora B. Berman +Subject: Re: 20th Anniversary of 36 Bits +To: CC.Clive @ UTEXAS-20 +cc: BUG-ITS @ MIT-MC + + Date: Tue 11 Sep 84 02:44:10-CDT + From: Clive Dawson + Subject: Re: 20th Anniversary of 36 Bits + To: CENT@MIT-MC.ARPA + Thanks for the info and suggestions. We certainly have Greenblatt on + the list. In fact I talked to him at AAAI here in Austin recently and + there's a good chance we can get him to be on the panel at the + Pioneer's Rountable session. I certainly would like to add other ITS + people to the general list of invitees. Do you suppose you (or + somebody else) could provide me with a list of such people, including a + brief comment describing their connection to the 36-bit machines? I'll + add Holloway (is he an original ITS developer?); also I have people + like Gosper and Schroeppel of HAKMEM fame, and RMS. I suspect there + are quite a few others. + Thanks, + CLive + +i'm not your best source for this, being a relative latecomer (i got to the +lab in the middle of the lisp machine effort). try Tom Knight (TK@MC) -- +built the Knight TV system (was attached to the AI KA-10) for his undergrad +thesis -- and Ken Harrenstein (KLH@MC or @NIC) -- wrote COMSAT, the ITS +mailer, for his -- for a better list. i believe holloway was mostly a +hardware hacker; he had a lot to do with the KA paging box (we apparently +have a confusion with the TOPS10 people over who did paging first). RWG +and RMS are reachable at those names by mail to MC, as is MOON, who wrote +the ITS microcode for the KL; i don't know where schroeppel is these days, +he's been gone from here for a while. +i think we have the AI-6's chess trophies for MAKHAK 6 around somewhere; +probably RG knows. + +Date: 10 September 1984 23:50-EDT +From: Pandora B. Berman +Subject: archive +To: BUG-ITS @ MIT-MC + +i moved the ITS BUGS archive from .INFO.;, which was bursting, back to +SYSTEM; where it apparently used to be, and where there is more space. +i have no idea who thought it was a good idea to move it to .INFO. . + +Date: 10 September 1984 23:16-EDT +From: Pandora B. Berman +Subject: 20th Anniversary of 36 Bits +To: CC.Clive @ UTEXAS-20 +cc: BUG-ITS @ MIT-MC + +don't forget ITS, Greenblatt (RG@OZ, currently at LMI in cambridge), +Holloway (H@MC, currently at Symbolics in cambrige), and all the other ITS +hackers. in many ways ITS is STILL the best 10-family OS (we are now in +the process of porting it to a 2020). + +Date: 10 September 1984 18:37-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +The recent change in ITS where the SYS job is given 2 extra job +slots worth of core (instead of just SYSB) causes the system +to crash in CORS2 immediately when coming up. + +Version 1378 is the same as 1377, but with the other new modules +(INET, CORE, SYSJOB) incorporated. We also have the new TTYTYP +file and the front-end files (IOELEV, BOOT11, etc) have been +updated. This is all XITS. You can't boot the old version +(ITS) in the normal fashion since one of the boot command files +has been changed, so I hope it continues to work. + +Date: 6 September 1984 02:21-EDT +From: Alan Bawden +Subject: Source for :TIME +To: MOON @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Well, I just retrieved source files for a bunch of ITS system programs from +AI and ML backup tapes. I was able to find an OLD source for :TIME +(version 25, version 39 is installed on MC right now...). The most up to +date source probably lives only on DM backup tapes. Do we have a way to +read DM backup tapes? Did anyone write such a tool when the DM users moved +to XX? The good news is that as far as I can tell, TIME is the -only- +program whose source file is trapped in that particular way... + +Date: 5 September 1984 23:56-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I gunned a tree which had jobs zorched by parity errors. +The job state in PEEK went to *MULTIX and I thought it was +trying to log out (since it usually does that after LOGOUT). +It never went away and I could not UJOB it (job not found). +I think it was blocked in a SLEEP call; I bashed its flush +instruction to zero and it imediately went away. + +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2640626229863307@MIT-MULTICS.ARPA>; 04 Sep 1984 15:17:09 edt +Date: 04 Sep 84 15:00 +0200 +From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-to: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: BUG-ITS@MIT-MC +Subject: ITS for swedish KA10 +Message-ID: <68570@QZCOM> + +Thanks for your reply. I wasn't sure if my letters got through, or +if I was addressing the right people. Our MAILNET connection is still +somewhat experimental. + +The machine is a gift from DEC (or rather, we got it very cheap: 1 SEK +which is approximately 15 cents), we have transported it from its previous +home in Finland to Sweden, and are now planning to re-install it here. +We have experienced hardware hackers who plan to build their own memory, +paging box, and possibly other things too. + +Existing hardware: + + 1 KA10 cpu + 3 MF10 in working condition + 1 MF10 with essentially a missing backplane + 2 DF10 data channel (18-bit) + + 1 RP10 disk controller + 2 RH10 massbus controller + 1 TM10 tape controller + + 1 DC10 with 32 lines + 1 BA10 hard copy controller + 1 TU10 tape drive + 1 RP02 disk drive + 1 Line printer + 1 Card reader (!) + +Some of us work at the university computer center, so we have access +to DEC10's and 20's where we can read tapes, cross-compile sources etc +if necessary. We are grateful for any information you can give us, +either through the network, or by ordinary mail to: + + Datorforeningen STACKEN + c/o NADA + Royal Institute of Technology + S-100 44 Stockholm + SWEDEN + + + + +Date: 3 September 1984 02:32-EDT +From: Pandora B. Berman +Subject: we hear you +To: Bjorn_Danielsson_QZ%QZCOM.MAILNET @ MIT-MULTICS +cc: BUG-ITS @ MIT-MC + + Date: 27 Aug 84 20:48 +0200 + From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA + To: GSB@MIT-MC.ARPA + Subject: ITS + Hello. + Some friends of mine in the computer club STACKEN in Stockholm, Sweden + want to get hold of an ITS operating system for their KA-10 computer. + Could you tell me if it is possible to get the sources and + documentation, including information about the extra paging hardware? + Bjorn Danielsson + +hello out there. we are glad to hear that, somewhere else in the world, ITS +lovers exist. it is theoretically possible, but technically a bit +difficult, to give your friends the information they need to bring up ITS +on their KA -- difficult because it's hard to assemble. we are working on +trying to put together the right stuff for them, but it may take a while. +any further information you can give on what their KA is like can only be +helpful. please address futher communications on this subject to +BUG-ITS@MC, so we will all see them. + +Date: 24 August 1984 21:29-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +SALV and exec DDT are write locked. + +Date: 20 August 1984 16:51-EDT +From: David Vinayak Wallace +Subject: breaking ITS net connections +To: mclure @ SRI-PRISM +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, SASW @ MIT-MC +In-reply-to: Msg of Sun Aug 19 11:54:15 1984 from mclure at sri-prism + +From an ether tip typing the esacpe twice sends it through; I use the +feature from the h19's in he basement of mjh all the time. But if you find +that objectionable, why not change the escape character for your telnet to +be something else? + +david + +PS: Bug-its: on the other hand, since everybody has infinite free time, and + isn't working on things like theses, what's wrong with .e.g. 2u + logging out and detaching non-hardwired lines? + +Date: 19 August 1984 16:07-EDT +From: Alan Bawden +Subject: breaking ITS net connections +To: mclure @ SRI-PRISM +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, SASW @ MIT-MC +In-reply-to: Msg of Sun Aug 19 11:54:15 1984 from mclure at sri-prism + + Date: Sun Aug 19 11:54:15 1984 + From: mclure at sri-prism + That's just the point. If I am using the Stanford ethernet to + access score, there are certain instances where my escape will + be robbed by a superior program and unavailable to telnet.... + +Have you complained to anyone about this misfeature? Seems like your real +problem is that you are forced to use a broken program to make your first +hop over the network. + +I suppose we could put a command in DDT that guns its own telnet server... +Always seems a shame to have to do things like this to compensate for other +people's bugs. + +Date: 19 August 1984 15:44-EDT +From: David C. Plummer +Subject: Re: breaking ITS net connections +To: mclure @ SRI-PRISM +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC, SASW @ MIT-MC + + Date: Sun Aug 19 11:54:15 1984 + From: mclure@sri-prism + + That's just the point. If I am using the Stanford ethernet to + access score, there are certain instances where my escape will + be robbed by a superior program and unavailable to telnet. So + I am unable to close the connection because I can't escape back + to my telnet (without escaping to the ethernet tip, or whatever + other medium happens to be in the way). + +Your user program is seriously misdesigned. + + My question still stands. Is there a way in ITS DDT to break + a connection manually? If not, I think one should be added + as everyone else has one and it has shown itself to be desirable. + +No, and NO!!! Alan's message shows that this is considered a win +(by the ITS community, at least). If your user program doesn't +have a command to forcibly disconnect you, I suggest you find +another program, or stop using ITS. How would you get out if you +started running a program that has super-image-input on so you +couldn't even type c-Z (er, CALL). + +Received: by sri-prism.ARPA (4.12/4.16) + id AA06644; Sun, 19 Aug 84 11:56:45 pdt +Message-Id: <8408191856.AA06644@sri-prism.ARPA> +Date: Sun Aug 19 11:54:15 1984 +From: mclure@sri-prism +To: CSTACY@MIT-MC +Cc: bug-its@mit-mc, sasw@mit-mc +Subject: Re: breaking ITS net connections + +That's just the point. If I am using the Stanford ethernet to +access score, there are certain instances where my escape will +be robbed by a superior program and unavailable to telnet. So +I am unable to close the connection because I can't escape back +to my telnet (without escaping to the ethernet tip, or whatever +other medium happens to be in the way). + +My question still stands. Is there a way in ITS DDT to break +a connection manually? If not, I think one should be added +as everyone else has one and it has shown itself to be desirable. + + Stuart + +Date: 19 August 1984 14:52-EDT +From: Alan Bawden +Subject: breaking ITS net connections +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, SASW @ MIT-MC, mclure @ SRI-PRISM + + Date: 19 August 1984 14:33-EDT + From: Christopher C. Stacy + After logging out of ITS, why not close the connection from your end, + perhaps by killing your TELNET program or issuing a "close" command + to it? This will not leave any ITS job hanging. + +Perhaps he in confused by the fact that ITS doesn't close the connection +IMMEDIATELY after you log out? If you wait a few minutes after you +logout, your TELNET server will wake up and break the connection. We +regard this as a feature; it gives you a chance to re-use the connection by +typing ^Z (er, CALL). Its like having a hardwired line, except it times +out eventually. + +The same philosophy applies to the way ITS handles logging out from a +dialup. Having this feature from dialups is actually even more of a win. +It lets someone else log into the machine without having to re-dial the +phone. The whole things seems like such a simple courtesy that I'm always +surprised that the 20X wizards around here don't adopt the feature. + +Date: 19 August 1984 14:33-EDT +From: Christopher C. Stacy +Subject: breaking ITS net connections +To: mclure @ SRI-PRISM +cc: BUG-ITS @ MIT-MC, SASW @ MIT-MC +In-reply-to: Msg of Sun 19 Aug 84 10:57:35-PDT from Stuart McLure Cracraft + +After logging out of ITS, why not close the connection from your end, +perhaps by killing your TELNET program or issuing a "close" command +to it? This will not leave any ITS job hanging. + +Date: Sun 19 Aug 84 10:57:35-PDT +From: Stuart McLure Cracraft +Subject: breaking ITS net connections +To: bug-its@MIT-MC.ARPA, sasw@MIT-MC.ARPA +Reply-To: mclure@sri-prism + +There seems to be no good way to break a net connection on the ITS +machines. Perhaps there is one, but it is not obvious. TOPS-20 Arpanet +machines usually break the connection upon logout. WAITS allows you +to break it with the 'QUIT' command. Unix lets you break a net +connection at the 'login:' prompt by typing ^D. + +Does ITS have an equivalent? I have left many jobs hanging/detached +on MIT machines over the years whenever the telnet/modem/network +configuration I am reaching it through does not allow an escape +character of its own. + +Thanks. + + Stuart +------- + +Date: 18 August 1984 00:20-EDT +From: David A. Moon +To: BUG-ITS @ MIT-MC + +looks like the source to sys1;ts time is lost. + +Date: 13 August 1984 22:00-EDT +From: Pandora B. Berman +Subject: someone has this KA, you see... +To: BUG-ITS @ MIT-MC + +[damned if i know why they asked me.] +---------- +Date: 13 Aug 84 15:38 +0200 +From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: "Pandora B. Berman" +Subject: ITS +Hello. +Some friends of mine in the computer club STACKEN in Stockholm, Sweden +want to get hold of an ITS operating system for their KA-10 computer. +Could you tell me if it is possible to get the sources and documentation, +including information about the extra paging hardware? + + Bjorn Danielsson + +Date: 11 August 1984 19:44-EDT +From: Alan Bawden +Subject: mc:crash;tcp .value +To: MOON @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC, KLH @ MIT-MC +In-reply-to: Msg of 11 Aug 1984 18:54-EDT from David A. Moon + + Date: 11 August 1984 18:54-EDT + From: David A. Moon + Date: 1 August 1984 18:12-EDT + From: Alan Bawden + Dunno who maintains the TCP server exactly, ... + "The" TCP server? Guesswork reveals that it's the FTP/SMTP server... + +When I said "TCP server", I was talking about the Chaosnet TCP server. You +know, the thing that gets loaded from DEVICE;CHAOS TCP. I didn't think too +hard about how ambiguous that would sound in a bug note CC'd to BUG-TCP. + +Now a good question is how did I manage to mistake an FTP server for that? +(Perhaps I need to think again about how the MOVE instruction works.) + +Date: 11 August 1984 18:54-EDT +From: David A. Moon +Subject: mc:crash;tcp .value +To: ALAN @ MIT-MC, KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC + + Date: 1 August 1984 18:12-EDT + From: Alan Bawden + To: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC + + Dunno who maintains the TCP server exactly, but I found a couple + that had .VALUEd just now. I dumped one of them into CRASH;TCP .VALUE + Seems to me that I'm seeing more of these guys .VALUEing recently + so perhaps someone should take a look. + +"The" TCP server? Guesswork reveals that it's the FTP/SMTP server +found in SYSBIN;FTPS BIN and it got an error from a FINISH system call +in RETR05 called from the LIST command (look at location AUTPSY). +I guess it's not robust to the user killing the connection while it's +in the middle of listing a directory. + +I fixed this in the source but cannot reassemble FTPS because KLH's +macros, which it uses, have been changed incompatibly. I found the +file ksc;?out >, which purports to explain how to convert, but I can +find no indication of how to convert OUTOPN in there so I'll leave +this for KLH to fix or advise about. Presumably plenty of other +programs are broken the same way. + +I didn't delete the CRASH file in case anyone else wants to look at it. + +Date: 9 August 1984 11:02-EDT +From: David C. Plummer +Subject: rebooted hubs +To: ALAN @ MIT-MC +cc: DCP @ MIT-MC, BUG-ITS @ MIT-MC, GUMBY @ MIT-MC, bug-minits @ MIT-OZ, + DMS @ MIT-OZ + + Received: from MIT-MC by MIT-OZ via Chaosnet; 8 Aug 84 19:11-EDT + Date: 8 August 1984 19:04-EDT + From: Alan Bawden + In-reply-to: Msg of 8 Aug 1984 18:01-EDT from David C. Plummer + + Date: 8 August 1984 18:01-EDT + From: David C. Plummer + I think there are (undocumented) frobs that can follow the 034 of + ITP to say this. If I can find it in the source in the next 4 + minutes, I'll let you know... + + Undocumented? fooey! Do :INFO ITS TTY SMART ESCAPE and you will find what + you are looking for. +It's not documented in the SUPDUP RFC (though I didn't look very +hard, but I remember that it isn't documented there). + +Date: 8 August 1984 19:04-EDT +From: Alan Bawden +Subject: rebooted hubs +To: DCP @ MIT-MC +cc: BUG-ITS @ MIT-MC, GUMBY @ MIT-MC, bug-minits @ MIT-OZ, DMS @ MIT-OZ +In-reply-to: Msg of 8 Aug 1984 18:01-EDT from David C. Plummer + + Date: 8 August 1984 18:01-EDT + From: David C. Plummer + I think there are (undocumented) frobs that can follow the 034 of + ITP to say this. If I can find it in the source in the next 4 + minutes, I'll let you know... + +Undocumented? fooey! Do :INFO ITS TTY SMART ESCAPE and you will find what +you are looking for. + +Date: 8 August 1984 18:01-EDT +From: David C. Plummer +Subject: rebooted hubs +To: GUMBY @ MIT-MC +cc: BUG-ITS @ MIT-MC, DMS @ MIT-OZ, bug-minits @ MIT-OZ + + Date: 8 August 1984 17:14-EDT + From: David Vinayak Wallace + In-reply-to: Msg of Mon 6 Aug 84 12:42:28-EDT from David Siegel + + It would gubbish your screen unless there were a way to tell ITS that + typeout had occurred. + +I think there are (undocumented) frobs that can follow the 034 of +ITP to say this. If I can find it in the source in the next 4 +minutes, I'll let you know... + +Here it is... gotta run... + +TYBCTL: CAIN A,^A ;^\^A => ALLOCATE OUTPUT CHARS. + JRST TYBA + CAIN A,^Z ;^\^Z => ZERO ALLOCATION + JRST TYBZ + CAIN A,^I ;^\^I => INFINITY ALLOCATION + JRST TYBI + CAIN A,^R ;^\^R => RESTART OUTPUT AT M.P. LEVEL. + JRST TYBR + CAIN A,^P ;^\^P => SET CURSOR POSITION AND RESTART OUTPUT AT M.P. LEVEL. + JRST TYBP + CAIN A,^\ ;^\^\ => INPUT A ^\. + JRST TYBRET + CAIN A,^C ;^\^C => SCREEN HAS BEEN SURREPTITIOUSLY CHANGED + PUSHJ P,TYBC +;RETURN TO NORMAL ^\ STATUS BUT DON'T PASS ANY INPUT UP TO NORMAL INPUT LEVEL. + +Date: 8 August 1984 17:58-EDT +From: David C. Plummer +Subject: rebooted hubs +To: GUMBY @ MIT-MC +cc: BUG-ITS @ MIT-MC, DMS @ MIT-OZ, bug-minits @ MIT-OZ + + Date: 8 August 1984 17:14-EDT + From: David Vinayak Wallace + In-reply-to: Msg of Mon 6 Aug 84 12:42:28-EDT from David Siegel + + It would gubbish your screen unless there were a way to tell ITS that + typeout had occurred. + +I think there are (undocumented) frobs that can follow the 034 of +ITP to say this. If I can find it in the source in the next 4 +minutes, I'll let you know... + +Date: 8 August 1984 17:14-EDT +From: David Vinayak Wallace +Subject: rebooted hubs +To: DMS @ MIT-OZ +cc: BUG-ITS @ MIT-MC, bug-minits @ MIT-OZ +In-reply-to: Msg of Mon 6 Aug 84 12:42:28-EDT from David Siegel + +It would gubbish your screen unless there were a way to tell ITS that +typeout had occurred. + +Date: 7 August 1984 19:02-EDT +From: Leigh L. Klotz +Subject: chuname broken +To: MLY @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 5 Aug 1984 22:31-EDT from Richard Mlynarik + +Are you sure that you weren't already logged in (or detached) as +MLY when you tried doing :CHUNAME MLY? That's what's usually happening +when you get the ? response. + +Date: 5 August 1984 23:42-EDT +From: Alan Bawden +Subject: chuname broken +To: MLY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 5 Aug 1984 22:31-EDT from Richard Mlynarik + + Date: 5 August 1984 22:31-EDT + From: Richard Mlynarik + Sender: MLY0 + logged in as anything, and typing ":chuname mly" at ddt + gets me the right "--massacre and reset--" but confirming + with a space just gets me a "?" and my uname is still the same. + +This bug report seems to be saying that you were unable to get CHUNAME to +work under any circumstances. Funny, because I can't seem to get it to +fail under any circumstances. I notice that you sent this bug report +logged in as "MLY0", perhaps you can tell me what other MLY's were logged +in at the time, what you were logged in as, and what you tried to CHUNAME +to. + +Date: 5 August 1984 23:10-EDT +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +emacs got a .val 0; 35572>>move 1,3 1/17450 3/24 +when I tried to find a file on HS: + +Date: 5 August 1984 22:31-EDT +From: Richard Mlynarik +Sender: MLY0 @ MIT-MC +Subject: chuname broken +To: BUG-ITS @ MIT-MC + +logged in as anything, and typing ":chuname mly" at ddt +gets me the right "--massacre and reset--" but confirming +with a space just gets me a "?" and my uname is still the same. + +Date: 5 August 1984 16:13-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +The NETWRK package only defines a single Chaosnet packet buffer, +so you can only hack on connection at a time. + +Date: 1 August 1984 18:12-EDT +From: Alan Bawden +To: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC + +Dunno who maintains the TCP server exactly, but I found a couple +that had .VALUEd just now. I dumped one of them into CRASH;TCP .VALUE +Seems to me that I'm seeing more of these guys .VALUEing recently +so perhaps someone should take a look. + +Date: 1 August 1984 13:42-EDT +From: Christopher C. Stacy +Subject: EMACS not working on MC, and BUG-EMACS broken +To: RIG @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-EMACS @ MIT-MC +In-reply-to: Msg of 1 Aug 1984 13:12-EDT from Ronald I. Greenberg + + +The mail receipt you received from the COMSAT only indicates that a +there is an addressee (ECARTER@OFFICE-2) who is a member of the +BUG-EMACS mailing list, but who in fact does not exist. +Your message was delivered to all the other BUG-EMACS people. + +I just tried EMACS on MC, and it is working fine. + +Date: 1 August 1984 13:12-EDT +From: Ronald I. Greenberg +Sender: RIG0 @ MIT-MC +To: BUG-ITS @ MIT-MC + + :bug emacs didn't work as evidenced by the following returned mail. +COMSAT@MIT-MC 08/01/84 12:42:23 Re: Msg of Wednesday, 1 August 1984 12:39-EDT +To: RIG at MIT-MC +Queued: JSL at MIT-MULTICS, Carter at RUTGERS +FAILED: ECARTER at OFFICE-2; Recipient name apparently rejected. + Last reply was: {550 No such mailbox here} + Failed message follows: +------- +Date: 1 August 1984 12:39-EDT +From: Ronald I. Greenberg +To: BUG-EMACS @ MIT-MC + + A little while ago, while logged on to MC I found EMACS working improperly. +For example, c-E, m-F, and m-B were going to incorrect places. One time m-F +took me backwards one character! I would be interested in finding out what +was wrong. + Ron Greenberg + rig@mc + +By the way, I suppose the emacs problem might really be a problem with the terminal. +I will try to check this out. + +Date: Fri, 27 Jul 1984 11:50 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: "Christopher C. Stacy" +Cc: BUG-ITS@MIT-MC +Subject: front end 11 +In-reply-to: Msg of 27 Jul 1984 03:53-EDT from Christopher C. Stacy + + Date: Friday, 27 July 1984 03:53-EDT + From: Christopher C. Stacy + + MC stopped answering the dialups in the afternoon, and when I came in + long afterwards the system was apparently "dead"; it was not answering + anything. It appeared to be running though. Unfortunately the front-end + 11 seems to have dropped dead; I could not get to DDT or even 11DDT. I + used the disk bootload button to get the 11 back, and stopped and dumped + ITS to CRASH;ITS 11HUNG in case anyone wants it. Then I cold booted. + +Don't blame me. I wasn't installed. + +Date: 27 July 1984 03:53-EDT +From: Christopher C. Stacy +Subject: front end 11 +To: BUG-ITS @ MIT-MC +cc: PGS @ MIT-MC + +MC stopped answering the dialups in the afternoon, and when +I came in long afterwards the system was apparently "dead"; +it was not answering anything. It appeared to be running +though. Unfortunately the front-end 11 seems to have dropped +dead; I could not get to DDT or even 11DDT. I used the disk +bootload button to get the 11 back, and stopped and dumped +ITS to CRASH;ITS 11HUNG in case anyone wants it. Then I cold +booted. + +Date: 25 July 1984 16:56-EDT +From: Alan Bawden +Subject: MC params +To: BUG-ITS @ MIT-MC +In-reply-to: Msg of 25 Jul 1984 16:41-EDT from J. Noel Chiappa + +Noel's message reminds me... Last night I moved the various notes and things +that used to be taped to the inside front door of the first MF10 into the +first MH10. Now most of that information actually has little to do with +the MH10s, but I figured it was usefull to know what information we -used- +to keep there in case anone ever decides to post some modern truth in that +location. (I marked them as out of date in a big red pen.) + +Date: 25 July 1984 16:41-EDT +From: J. Noel Chiappa +Subject: MC params +To: BUG-ITS @ MIT-MC + + Since the whole Ampex seems to be online now, next time someone +rebuilds the system they should change CONFIG > to allow MC to use all +of the 2MW of memory on the system. Right now half the AMPEX is not +being used. + +Date: 20 July 1984 04:56-EDT +From: Ken Harrenstien +Subject: ITS seemed to be looping +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Well, I am too tired to pursue it further tonight, but the fragments +appear to have come from host GYMBLE by way of BBN-MILNET-GW; +it had several SMTP connections open at the time. This doesn't help +find the bug (for that it takes a lot of grovelling through the +datagram buffers) but may serve as a warning signal. + +Date: 20 July 1984 04:10-EDT +From: Ken Harrenstien +Subject: ITS seemed to be looping +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Ignore my query about ITS version to :SL. I've been doing too much +Unix ADB'ing and forgot ITS does the right thing as usual. + +Date: 20 July 1984 04:04-EDT +From: Ken Harrenstien +Subject: ITS seemed to be looping +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Keep CRASH;WHAT HEY around for a while. If your PC trace is right, it +was looping in the IP fragment re-assembly code, which has in the +past been a notorious source of bugs (since it is both very hard to +understand and very seldom exercised). Can you tell me what version +of ITS it was running, so I can :SL the symbols from the right +file on .; (and please continue to take more crash dumps any time +this happens, since it is unlikely that the bug can be determined +just from one example). + +By the way, it makes sense that clock interrupts would be off, since +this code runs at IMP interrupt level. + +Oh boy, time to play with PEEK autopsy mode again! + +Received: from SCRC-EUPHRATES by SCRC-QUABBIN via CHAOS with CHAOS-MAIL id 65152; Mon 16-Jul-84 23:06:56-EDT +Date: Mon, 16 Jul 84 23:06 EDT +From: "David A. Moon" +Subject: Ampex memory +To: jnc@MIT-MC.ARPA +cc: bug-its@MIT-MC.ARPA +Message-ID: <840716230650.0.MOON@EUPHRATES.SCRC.Symbolics> + +Some (most? all?) of the ports on the Ampex memory don't work, I think +because Ampex's transceiver cards for the DEC memory bus are flakey. +That's probably why the cabling is weird. The interleaving options +are all very confusing, especially since the cases that are not +supposed to work actually do seem to work. I talked about this with +CStacy this afternoon some. I think the bottom line is that you can +put the system into 4-way interleave mode if all of ports 4 through 7 +(or wherever the processor is plugged into) on the Ampex work, but if +any of those ports are broken and can't be used you have to use 2-way +interleave mode so the Ampex will still see all memory requests. It's +also unclear whether 4-way mode is better since it should be only a few +percent faster in the DEC memory (if I remember a measurement I made in +about 1976 correctly) and should be substantially slower in the Ampex +memory, since it can only do one operation at a time (two at a time +when both sectors are working). + +MC:MOON;PERF > will measure various things but I don't know how you'll +get the numbers for the MF10 configuration to compare against. + + +Date: 16 July 1984 15:45-EDT +From: J. Noel Chiappa +Subject: new memory +To: BUG-ITS @ MIT-MC + + The MH10's are installed. They are 8 port (dual controller) +boxes, so KBUS0-3 are bussed through all four boxes on port 7-4 (and +thence to the Ampex ports 7-4). The DL10 is port 0, the RP10 is port +1, and the TM10 is port 2. (Don't ask why it's different from the +Ampex). The TM10 bus is terminated on the last DEC box, as before, but +the cable to the AMPEX is right there if anyone wants to plug it in +for some reason. The MH10's are currently in 4-way interleave in the +hardware. It looks like the processor is running two way interleaved; +now that we have this wonderful working 4-way memory maybe we could +switch back? + Also, the AMPEX just got a write parity error on port 5. if +this happens a lot someone should think about reseating the cables, +etc. Finally, is there some sort of meter we can use to see if the +machine is running faster? + +Date: 16 July 1984 01:05-EDT +From: Alan Bawden +To: BUG-ITS @ MIT-MC + +CRASH;10JUL CRASH just happened again in exactly the same way. +A comsat RESTRT job tried to rename STATS < to OSTATS >, and on the +way out of the call it was noticed that there were still some locks locked. + +ALAN@MIT-ML 07/14/84 06:45:02 +To: (BUG ITS) at MIT-ML +After remaining up for 13 days without even a memory error, +ML finally crashed just now because of a software bug. At QSOC3E+15, on its way +out of the system after trying to do an MLINK, an entry in QSNNR went +negative. A dump of the same problem was taken by GSB a few weeks ago +and can be found in MC:CRASH;QSOC3E +17@ML if anyone want to look for +it... + + +Date: 14 July 1984 03:42-EDT +From: Alan Bawden +Subject: ITS seemed to be looping +To: BUG-ITS @ MIT-MC +In-reply-to: Msg of Sat 14 Jul 84 02:43 EDT from David A. Moon + + Date: Sat, 14 Jul 84 02:43 EDT + From: David A. Moon + Things to try: + + Raise switch 0 (the switch 0 on the left). If this goes to DDT, it's + taking clock interrupts. + +Yeah, I forgot to mention that I tried that, and nothing happened. + + Hit Break and type PC . If I remember correctly, you can + read the PC this way without halting the machine. There are some + other status-type commands; PCF is the PC flags, PI is the interrupt + status. + +OK, well it happened again which gave me a chance to try out the things I +remembered from this message (wish I had made hardcopy as soon as I got +it!). Repeated applications of PC showed it looping in the +general vicinity of IPRD61 (assuming it was looping in the system, which is +reasonable to assume if it isn't taking clock ints!). This is a routine in +INET which looks to me like it might well loop given the right gubbish in +memory. + +Perhaps with that information someone can take a look at the crash dump I +took (still in CRASH;WHAT HEY) and figure out what caused this. + +Date: 14 July 1984 03:27-EDT +From: Alan Bawden +Subject: Its a mystery to me. +To: BUG-ITS @ MIT-MC +cc: BUG-DDT @ MIT-MC + +How come when a job gets a parity error its superior DDT always gets a +%PIB42? DDT seemingly get it simultaneous with the interrupt from the +inferior, but thats what you would expect of a real B42, right? There +doesn't seem to be anything wrong with what DDT is doing as far as I can +tell... + +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 60736; Sat 14-Jul-84 02:40:13-EDT +Date: Sat, 14 Jul 84 02:43 EDT +From: "David A. Moon" +Subject: ITS seemed to be looping +To: alan@MIT-MC.ARPA +Cc: bug-its@MIT-MC.ARPA + +Things to try: + + Raise switch 0 (the switch 0 on the left). If this goes to DDT, it's + taking clock interrupts. + + Hit Break and type PC . If I remember correctly, you can read + the PC this way without halting the machine. There are some other status-type + commands; PCF is the PC flags, PI is the interrupt status. + + Hit Break and type SP . This stops the machine cleanly (between + instructions). If this works, the microcode isn't looping. Now you can + get the PC then type DDT (or ST 774000) to get into DDT and decode that PC. + + If the microcode is looping the SM command will restart it. This also does + nasty things like resetting the I/O bus. I think it preserves the PC though. + + There is a command file, J KLHUNG, which prints out everything in sight. 90% + of what it prints is worthless, but it includes micro and macro PCs. + +I believe there is a piece of paper taped to the machine that tells you to +do J KLHUNG. Of course there are a lot of pieces of paper taped to the machine! + + +Date: 14 July 1984 01:50-EDT +From: Alan Bawden +To: BUG-ITS @ MIT-MC + +ITS died in a new way (for me) just now. The immediate symptoms were what +I would expect if the microcode was looping. (No lights on any box were +blinking, nothing was visibly doing anything, the system console had not +printed anything to indicate anything was wrong.) I thrashed around a bit +trying to find the KLDCP documentation to see if I could learn anything +about what the processor was doing. When Taft found me a copy I was +frustrated enough that I just took a crash dump (yeah, I know, thats +probably worthless, its in CRASH;WHAT HEY) and reloaded it. So what should +I have done? + +Date: 11 July 1984 23:30-EDT +From: Christopher C. Stacy +Subject: ml doesn't get updates +To: CENT @ MIT-MC +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 11 Jul 1984 23:16-EDT from Pandora B. Berman + +Aha, ML had the old version of INQUIR so that updates from MC went to +ML, but ML didn't update itself! I installed the new one. + +Date: 11 July 1984 23:16-EDT +From: Pandora B. Berman +Subject: ml doesn't get updates +To: CSTACY @ MIT-MC +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC + + Date: 9 July 1984 16:02-EDT + From: Christopher C. Stacy + Subject: ml doesn't get updates + To: CENT @ MIT-MC + cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC + In-reply-to: Msg of 9 Jul 1984 06:18-EDT from Pandora B. Berman + ML should be getting updates; when it came back up I put + it back in the list of machines to update and tested it. + It worked for me; I'll look to see what is going wrong. + +i looked at the relevant STATS files. running INQUIR on ML creates a piece +of mail to INQUPD at MC; this reaches MC and is only dealt with locally. +at neither juncture is an INQUPD performed on ML. + +Date: 11 July 1984 14:33-EDT +From: Alan Bawden +To: BUG-ITS @ MIT-MC +In-reply-to: Msg of 10 Jul 1984 08:50-EDT from Patrick G. Sobalvarro + + Date: 10 July 1984 08:50-EDT + From: Patrick G. Sobalvarro + I found MC bug-halted. I dumped it to .;10JUL CRASH; dunno if anyone + wants to poke at it. + +Actually its in CRASH;10JUL CRASH. While returning from a RENAME a job +discovered it still had some locks locked. MC was parity erroring a bit at +the time. Should we worry about this harder? + +Date: 11 July 1984 11:27-EDT +From: J. Noel Chiappa +Subject: SECOND: hardwarily back +To: BUG-ITS @ MIT-MC + + Drive 1 is fixed, but I can't remember how to invoke UCOP +to bring the directories over. Someone should bring the system down +and bring it back up with SECOND: around. + +Date: Tue, 10 Jul 1984 21:10 EDT +Message-ID: +From: Jerry Roylance +To: CHAOS-MAINT@MC, BUG-ITS@MC +Subject: Subnet 6 + + +Subnet 6 was broken at the MC bulkhead (return of the bad UHF connectors). + +The MC transceiver's power connector was also broken; everything is +now in order. + +Date: 10 July 1984 08:50-EDT +From: Patrick G. Sobalvarro +To: BUG-ITS @ MIT-MC + +I found MC bug-halted. I dumped it to .;10JUL CRASH; dunno if anyone +wants to poke at it. + +Date: 10 July 1984 00:49-EDT +From: Alan Bawden +To: DCP @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, CSTACY @ MIT-MC +In-reply-to: Msg of 10 Jul 1984 00:19-EDT from David C. Plummer + + Date: 10 July 1984 00:19-EDT + From: David C. Plummer + I'm still not a speed reader. (I'm coming in over a vadic, + AAA, ITS 1370, DDT 1480.) U prints the bye + message and then clears the screen. + +OK, OK. I fixed it again. If its still broken, perhaps you better see +Evelyn Wood, because I can't imagine how I can have failed to fix it this +time. + +Date: 10 July 1984 00:19-EDT +From: David C. Plummer +To: ALAN @ MIT-MC, BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC, CSTACY @ MIT-MC + +I'm still not a speed reader. (I'm coming in over a vadic, +AAA, ITS 1370, DDT 1480.) U prints the bye +message and then clears the screen. + +Date: 9 July 1984 19:10-EDT +From: Alan Bawden +Subject: oops +To: DCP @ MIT-MC, BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 9 Jul 1984 10:14-EDT from David C. Plummer + + Date: 9 July 1984 10:14-EDT + From: David C. Plummer + Either ITS was changed, or DDT was, and for the worse. + When I log out, it does a :BYE followed by :OUTEST. + I don't think either of these are at fault. What happens + is that it prints the BYE message, and then clears the + screen before printing the console free message. Needless + to say, I'm not a speed reader. + +Believe it or not, another symptom of this same bug was the fact that +:CHUNAME didn't work anymore. I fixed the bug and installed a new DDT. + +Date: 9 July 1984 16:35-EDT +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I de-installed the latest DDT, since there are all these bug +reports coming in and the responsible hacker is asleep now. + +Date: 9 July 1984 16:02-EDT +From: Christopher C. Stacy +Subject: ml doesn't get updates +To: CENT @ MIT-MC +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 9 Jul 1984 06:18-EDT from Pandora B. Berman + +ML should be getting updates; when it came back up I put +it back in the list of machines to update and tested it. +It worked for me; I'll look to see what is going wrong. + +Date: 9 July 1984 11:25-EDT +From: Jeffrey P. Golden +Subject: CHUNAME +To: BUG-ITS @ MIT-MC + +When I am logged in as JEFFG and do :CHUNAME JPG +It says OP? and won't chuname me. + +Date: 9 July 1984 10:14-EDT +From: David C. Plummer +To: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +Either ITS was changed, or DDT was, and for the worse. +When I log out, it does a :BYE followed by :OUTEST. +I don't think either of these are at fault. What happens +is that it prints the BYE message, and then clears the +screen before printing the console free message. Needless +to say, I'm not a speed reader. + +Date: 9 July 1984 06:18-EDT +From: Pandora B. Berman +Subject: ml doesn't get updates +To: BUG-INQUIR @ MIT-MC +cc: BUG-ITS @ MIT-MC + +i modified my inquir entry a week ago to reflect my new office. ML +still thinks i'm in 912. this is a bug. As long as ML is going to +stay around for the indefinite (and probably not too short) future, +would whoever diked it out of the inquir-update path please put it +in again? + +Date: 8 July 1984 15:38-EDT +From: Christopher C. Stacy +Subject: MLDEV +To: BUG-ITS @ MIT-MC + +MLDEV does not work between ITS machines except via Chaosnet. +Reminder to me to make it check for alternate host addresses +on the ARPAnet and try them if Chaos is unresponsive. + +Date: 7 July 1984 16:55-EDT +From: Charles Frankston +Subject: The saga of Subnet 6 +To: CHAOS-MAINT @ MIT-MC, BUG-ITS @ MIT-MC +cc: RZ @ MIT-MC + +MC-IO-11 and TOTO (OZ's network front end) don't communicate on subnet 6. +Each one can apparently communicate with most of the other machines on +subnet 6, but not with each other. DPH said that subnet 6 was extended a +few days ago, which is apparently when this problem started. + +My guess is that TOTO can send to MC-IO-11 since TOTO's routing table says +to use subnet 1 to talk to MC rather than subnet 6, but for some reason +MC-IO-11 probably tries to use subnet 6 to talk to TOTO and this loses. + +Unplugging the MC-IO-11 subnet 6 interface allows MC and OZ to +communicate. This is the state things have been left in. However, this +causes hosts which do not implement dynamic routing, such as ML and +MIT-VAX to be unable to talk to MC, since they think that subnet 6 is the +way to get there.. + +Date: 7 July 1984 00:20-EDT +From: Alan Bawden +Subject: MC (not) broken +To: BUG-ITS @ MIT-MC +cc: DPH @ MIT-MC +In-reply-to: Msg of Fri 6 Jul 1984 23:34 EDT from PGS at MIT-OZ + + Date: Thursday, 5 July 1984 18:12-EDT + From: Christopher C. Stacy + Something is wrong with MC's hardware. ITS is having trouble + talking to the T-300s, and can barely reach the Chaosnet (even + though the ncp statistics look reasonable). Users were getting + wedged today unable to log out; one of my jobs was stuck in a + CLOSE call with a FLSINS of zero. DPH reports that the IO-11 + dropped very dead earlier. + +Just for the record, DPH disconnected MC from subnet 6 and all the Chaos +net problems went away. Other wierdnesses reported by CStacy may or may +not have anything to do with this. + +DPH should put himself on Bug-ITS. + +Date: Fri, 6 Jul 1984 23:34 EDT +Message-ID: +From: PGS@MIT-OZ +To: "Christopher C. Stacy" +Cc: BUG-ITS@MIT-MC +Subject: MC broken +In-reply-to: Msg of 5 Jul 1984 18:12-EDT from Christopher C. Stacy + + Date: Thursday, 5 July 1984 18:12-EDT + From: Christopher C. Stacy + To: BUG-ITS at MIT-MC + cc: BEDE at MIT-XX, MOON at SCRC-STONY-BROOK + Re: MC broken + + Something is wrong with MC's hardware. ITS is having trouble + talking to the T-300s, and can barely reach the Chaosnet (even + though the ncp statistics look reasonable). Users were getting + wedged today unable to log out; one of my jobs was stuck in a + CLOSE call with a FLSINS of zero. DPH reports that the IO-11 + dropped very dead earlier. + + Two mysteries: + + 1. What are these blue wires running around MC? + Someone told me they are an attempt to "make MC think it + is talking to the ROLM switch by faking out the DL-10 or something?" + +I suspect that this is just Ty trying to connect Rolm switch lines to normal +tty lines (not under modem control). If you find out that it's something +else, would you let me know? + +Date: 5 July 1984 18:40-EDT +From: Alan Bawden +Subject: :HOSTAT +To: BUG-ITS @ MIT-MC +cc: PGS @ MIT-MC +In-reply-to: Msg of 5 Jul 1984 14:21-EDT from Patrick G. Sobalvarro + + Date: 5 July 1984 14:21-EDT + From: Patrick G. Sobalvarro + To: BUG-ITS + + :hostat ai-chaos-11 gives sysbin; hosts1 > - file not found. + +I deleted the obsolete HOSTAT program so that people would stop being +confused. + +Date: 5 July 1984 18:12-EDT +From: Christopher C. Stacy +Subject: MC broken +To: BUG-ITS @ MIT-MC +cc: BEDE @ MIT-XX, MOON @ SCRC-STONY-BROOK + + +Something is wrong with MC's hardware. ITS is having trouble +talking to the T-300s, and can barely reach the Chaosnet (even +though the ncp statistics look reasonable). Users were getting +wedged today unable to log out; one of my jobs was stuck in a +CLOSE call with a FLSINS of zero. DPH reports that the IO-11 +dropped very dead earlier. + +Two mysteries: + +1. What are these blue wires running around MC? + Someone told me they are an attempt to "make MC think it + is talking to the ROLM switch by faking out the DL-10 or something?" + +2. The DEC log book says that the DL-10 had a bad module which was + not replaced, but which was moved to another slot and that now + everything "works fine". + +If no one has any good ideas, I will call DEC and have them see +about working on the DL-10 again. Meanwhile, the system is not +very usable. + + +Date: 5 July 1984 14:21-EDT +From: Patrick G. Sobalvarro +To: BUG-ITS @ MIT-MC + +:hostat ai-chaos-11 gives sysbin; hosts1 > - file not found. + +Date: 4 July 1984 05:52-EDT +From: David Vinayak Wallace +To: BUG-ITS @ MIT-MC + +MC appears to be unable to talk to OZ (finger, telnet, supdup), +but finds is with :UP. Has no trouble with other chaos hosts I tried +(prep, eddie, speech). + +MOON@MIT-ML 07/04/84 05:10:46 Re: HOSTAT OBERON +To: (BUG ITS) at MIT-ML +CC: GSB at MIT-ML, PSZ at MIT-ML +:HOSTAT is an ancient program that retrieves a report on Arpanet hosts from DM. +Obviously it should be flushed in favor of a program that uses Chaosnet +HOSTAT protocol as PSZ evidently expected.. + +Date: 4 July 1984 01:59-EDT +From: Glenn S. Burke +Subject: [Forwarded: PSZ@MIT-MC, Re: ] +To: BUG-ITS @ MIT-MC + +PSZ@MIT-MC 07/03/84 23:29:43 +:HOSTAT OBERON +on MC says: sysbin;hosts1 > - file not found. + +Date: 25 June 1984 04:39-EDT +From: David A. Moon +To: BUG-ITS @ MIT-MC + +T10 on MC is broken. Twice I dialed up to it and my input +was thoroughly garbled. I redialed to T12 and had no problems. + +Date: 20 June 1984 23:16-EDT +From: Charles Frankston +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +The dialup garbage is NOT Concept 100 control sequences. It seems to +happen with me on triple modems, which seem to raise Carrier Detect before +they've quite settled, perhaps before they're synchornized. If you wait +an extra two seconds after dialing up before typing return, it probably +won't happen. + +Date: 20 June 1984 18:23-EDT +From: Alan Bawden +Subject: Dialup Gubble +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 20 Jun 1984 15:24-EDT from Christopher C. Stacy + + Date: 20 June 1984 15:24-EDT + From: Christopher C. Stacy + Sometimes when I dial in to the Vadics, ITS sends alot of + unrecognizable garbage to my terminal when printing out the greeting + message. This goes away after a TCTYP command, and a friend of mine + on a VT100 claims the garbage looks like Concept-100 terminal control + sequences, although on my AAA it just prints blobs. + +If this was true, then wouldn't everybody who uses Vadics see randomness +when they dial up? (At least occasionally.) I have never seen anything of +the sort. + +Perhaps its marsh gas? + +Date: 20 June 1984 15:24-EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Sometimes when I dial in to the Vadics, ITS sends alot of +unrecognizable garbage to my terminal when printing out the greeting +message. This goes away after a TCTYP command, and a friend of mine +on a VT100 claims the garbage looks like Concept-100 terminal control +sequences, although on my AAA it just prints blobs. + +Date: Sun 17 Jun 84 14:10:44-EDT +From: J. Noel Chiappa +Subject: Re: Looping in the scheduler (with interrupts on, luckily) +To: DCP@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +cc: JNC@MIT-XX.ARPA +In-Reply-To: Message from "David C. Plummer " of Sat 16 Jun 84 20:14:00-EDT + + I think this was due to the console 11 dying. It seemed to +be completely frozted; i.e. trying "LOAD ADDR" didn't result in +whatever number you had in the switches showing up in the ADDR lights. +------- + +Date: 16 June 1984 20:14-EDT +From: David C. Plummer +Sender: DCP0 @ MIT-MC +Subject: Looping in the scheduler (with interrupts on, luckily) +To: BUG-ITS @ MIT-MC + +This morning I dialed up MC and got on T12. I was merrily doing +random things. I didn't do anything for a while, but when I +tried I got no response. I figured MC died. I was wrong. + +Just recently ALAN noticed I was around and informed me that not +only was my job still there, but it was taking up all the extra +computrons MC could offer. It was looping in TYSTE1 waiting for +the -11 to set DTEOST to some negative value. The -11 wasn't +doing this. The job could not be logged out or easily examined +because it couldn't be PCLSRed. + +The first thing I tried was to tell the job (by bashing the PC) +to try sending another doorbell to the -11. That didn't work. +So, I set DTEOST to -1 by myself. The job unfroze and we had +control again (for some value of control). Sending a TTY message +to that console (causing output) now waits at TYOW4 waiting for +the output buffer to be sufficiently empty to output. This will +never happen, but at least it is PCLSRable and doesn't take up +the entire machine. + +As experiments, I tried using T13 and T14. The first attempt to +output on these caused the same phenomena: Looping in TYSTE1. +Bashing DTEOST to -1 and outputing again caused waiting at TYOW4. +(Using :COPY to the TTY line was sufficient to cause this.) This +unfortunately means T12, T13, and T14 are no longer usable for +experimentation unless you go in and reset the pointers and +counts... + +This is probably just a hardware lossage and requires MC to be +rebooted to get the piece of dung -11 unwedged. + +Received: from SCRC-CHICOPEE by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 46531; Mon 11-Jun-84 08:04:08-EDT +Date: Mon, 11 Jun 84 08:02 EDT +From: "Daniel L. Weinreb" +Subject: TCP gatway +To: BUG-LISPM@SCRC-RIVERSIDE.ARPA +Cc: bug-its@MIT-MC.ARPA +Message-ID: <840611080222.9.DLW@CHICOPEE.SCRC.Symbolics> + +In Symbolics 3600 Experimental System 243.758, +Experimental Hardcopy 21.31, Experimental Zmail 84.157, +Experimental LMFS 38.91, Experimental Tape 22.17, +Experimental Basic Sage 2.26, Experimental New Documentation System 2.0, +Experimental Print 35.10, Experimental IP-TCP 9.1, Japanese 15.0, +Experimental TD80-Tape 1.22, cold load 114, microcode TMC5-MIC 290, +FEP 18, Big band, on Chicopee: + +>>Error: + Unable to invoke FILE (TCP-FTP) -- CMU-CS-SPICE (via MC on CHAOS) by any path. + TCP-GATEWAY (TCP-GATEWAY) -- MC on CHAOS: Cannot connect to 21 at CMU-CS-SPICE via MC: + Request to MC for a TCP 128.2.254.139 25 connection was refused. + Reason given was "TCP connection to foreign host failed" +While in the function NETI:GET-CONNECTION-FOR-SERVICE-1  NET:GET-CONNECTION-FOR-SERVICE  (:DEFUN-METHOD FS:TCP-FTP-VALIDATE-CONN) + +It would be nice if the MC gateway would pass on some more info than +just "conection to foreign host failed". If you try to FTP to +CMU-CS-SPICE right now, using FTPU on MC, it says that "Request for +Connection was refused by foreign host"; it would be nice it this info +had been passed through by the gateway. + +Date: 12 June 1984 15:03-EDT +From: Christopher C. Stacy +Subject: Reconnecting Spock's brain. +To: ALAN @ MIT-MC +cc: BUG-TIMES @ MIT-MC, BUG-TCP @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 12 Jun 1984 00:13-EDT from Alan Bawden + + Date: 12 June 1984 00:13-EDT + From: Alan Bawden + To: BUG-TIMES + Re: Reconnecting Spock's brain. + + I am quite certain that the TIMES/CTIMES program is totally broken. The + other night when MC was mistaken about the correct time, Penny ran :TIMES + to find out what other sites on the net thought the time was. To our + surprise the program reported that every machine it could reach + more-or-less agreed with MC's bogus time. When Penny ran PDSET to correct + MC, every machine made the corresponding correction. I also observe that + the times the program reports are ALWAYS in ascending order! I think it is + quite obvious what is going on here... + +I have fixed this, and spiffed the program up a little while at it. + + +Date: 23 May 1984 00:49-EDT +From: Alan Bawden +Subject: CRASH;STACKP FUCKED +To: BUG-ITS @ MIT-MC + +I have just been informed by GSB that he made a crash dump of an ITS that +had died trying to read an ML backup tape last Friday. Since it looks like +this is a repeatable error (DLW crashed MC a couple of times trying to read +in an AI backup tape last Sunday), its probably worth looking at. Note +that there seems to be no trouble reading in MC's backup tapes. The dump +GSB took is in CRASH;STACKP FUCKED. If you look at what's in P you will +understand the name. + +Date: 17 May 1984 23:43-EDT +From: David Vinayak Wallace +Subject: TENEX Remembered: Foo! +To: CBF @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 17 May 1984 22:09-EDT from Charles Frankston + + Date: 17 May 1984 22:09-EDT + From: Charles Frankston + + [From a letter about TENEX:] + + Date: 17 May 1984 13:14-EDT + From: DIPACE at BBNF.ARPA + + Demand-paged-virtual memory, + the first one of its kind; + + The question is, was it? Wasn't paging ITS around before TENEX? + + I believe so. But so certanly was the University of Manchester Atlas, + Multics, and possibly the Berkeley XDS 940 time sharing system, although I + don't know if it counts a demand paged. + + Oh, yeah, 360/67, TSS, CP/CMS, probably also both predate Tenex, but I'm + not sure.. +Foo. You know I meant on PDP-10s. +Didn't ITS start out Base-and-bounds? + +Date: 17 May 1984 22:09-EDT +From: Charles Frankston +Subject: TENEX Remembered +To: GUMBY @ MIT-MC +cc: BUG-ITS @ MIT-MC + + [From a letter about TENEX:] + + Date: 17 May 1984 13:14-EDT + From: DIPACE at BBNF.ARPA + + Demand-paged-virtual memory, + the first one of its kind; + + The question is, was it? Wasn't paging ITS around before TENEX? + +I believe so. But so certanly was the University of Manchester Atlas, +Multics, and possibly the Berkeley XDS 940 time sharing system, although I +don't know if it counts a demand paged. + +Oh, yeah, 360/67, TSS, CP/CMS, probably also both predate Tenex, but I'm +not sure.. + +Date: 17 May 1984 21:06-EDT +From: David Vinayak Wallace +Subject: TENEX Remembered +To: BUG-ITS @ MIT-MC +In-reply-to: Msg of 17 May 1984 13:14-EDT from DIPACE at BBNF.ARPA + +[From a letter about TENEX:] + + Date: 17 May 1984 13:14-EDT + From: DIPACE at BBNF.ARPA + + Demand-paged-virtual memory, + the first one of its kind; + +The question is, was it? Wasn't paging ITS around before TENEX? + +Date: 12 May 1984 18:14-EDT +From: Kent M Pitman +To: ELAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 12 May 1984 15:32-EDT + From: Phyllis E. Koton + Sender: ING @ MIT-MC + Re: bizarre dialup error + To: KMP @ MIT-MC + + The weirdest thing happened to me. I dialed up MC from + home, hit a carriage return to get ITS attention, and it echoed the + CR, but didn't print out any msg. SO I hit CR again, and again it + echoed it, but no MC ITS ... + so just to see what was going on, I said ":versio" and it said I was + MC ITS USR:ING. IS THAT THE STRANGEST THING? I did whois on this + ING and he is some tourist on the system. But I got logged in as + him without ever saying login or giving a password. I am really + psyched out by this. Do you think I should send mail to bug-its? + --pk + +This isn't the first time such a thing has happened. Your guess is probably +correct; ING somehow hung up without ITS noticing so when you dialed in, +you got his already-logged-in tty line. I'm forwarding this to BUG-ITS +in case they care, but I wouldn't lose any sleep over it. +-kmp + +Date: 8 May 1984 14:39-EDT +From: Alan Bawden +Subject: This afternoon's crash +To: BUG-ITS @ MIT-MC + +TTY: BUFFER EMPTY AT TYIREM +Dumped into CRASH;TYIREM 050884 + +Date: 2 May 1984 20:41-EDT +From: Jacob Moskowitz +To: BUG-ITS @ MIT-MC +cc: CAREY @ MIT-MC + + + I just logged in to the 300 baud +line & discovered that I was already +logged in as CAREY. Shouldn't ITS autologout on disconnect ? + +Date: 2 May 1984 09:39 PDT (Wed) +Message-ID: <[SRI-NIC].IAN. 2-May-84 09:39:34> +From: Ian Macky +To: Richard M. Stallman +Cc: BUG-ITS@MIT-MC +In-reply-to: Msg of 2 May 1984 02:00-PDT from Richard M. Stallman + + Date: Wednesday, 2 May 1984 02:00-PDT + From: Richard M. Stallman + To: BUG-ITS at MIT-MC + + When I supdup to MC, if I get tty 50, most characters do not echo and + are not obeyed. Only rubout and control-G get any response from DDT. + :TCTYP TTY 50 DESC shows exactly the same thing as other ttys that + I get which work properly. I locked tty 50. + +The exact thing has happened to me before, too, many months ago tho. + +Date: 2 May 1984 05:00-EDT +From: Richard M. Stallman +To: BUG-ITS @ MIT-MC + +When I supdup to MC, if I get tty 50, most characters do not echo and +are not obeyed. Only rubout and control-G get any response from DDT. +:TCTYP TTY 50 DESC shows exactly the same thing as other ttys that +I get which work properly. I locked tty 50. + +Date: 2 May 1984 04:57-EDT +From: Patrick G. Sobalvarro +To: BUG-ITS @ MIT-MC + +I'm unable to supdup to MC right now, because the supdup server claims that +all network ports are in use, although only t42-t51 are in use. nsttys is +27, so we should be able to do better than this. The ttys actually seem to +be there; could this be caused by someone not reassembling the supdup server +after the last system installation? + +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 25977; Wed 2-May-84 00:52:55-EDT +Date: Wed, 2 May 84 00:54 EDT +From: "David A. Moon" +Subject: Meter hardware on MC +To: BUG-ITS@MIT-MC.ARPA +In-reply-to: The message of 2 Feb 84 01:34-EST from David A. Moon + + Date: 2 February 1984 01:34 EST + From: David A. Moon + + DATAI 24,n executed in user mode clobbers locations n and n+1 in the system! + It's a good thing I tested this by hand before writing a program to use it. + ITS executes the instruction with XCTR, as it should. I suspect this is + a bug in the microcode. I guess I'll use .suset [.rrunt,, like a good little boy. + ------- + I looked at the microcode and now think it's a bug in the hardware (MCL board + of course). EPT REF clears the flag that SET PXCT sets? + +Fixed in the source of ITS! (Cleaning out my mail file). + +Date: 22 April 1984 20:51-EST +From: Alan Bawden +Subject: Hack attack. +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC + +I just amused myself by recreating the source of SYS:ATSIGN DEVICE from the +binary. I restrained myself from fixing any of its problems until I got it +to work. Those results can be found in ALAN;@DEV 40. Then I made a couple +of trivial changes (@DEV 43), debugged them, and installed it. I'll +install the source in a better place as soon as I am sure I am done with it. + +I renamed the old binary to be ATSIGN ODEVIC in case of disaster. + +Things in the source I had questions about are commented with ";???". + +In the bugs-you-can-only-find-by-reading-the-source department: + +o I fixed the problem where the "<0" and ">0" devices refered to the D and + ARC devices respectively. + +o I didn't do anything about KMP's complaint that SYS4^F in DDT is confusing. + +o I found a related randomness; try typing THIRD7^F to DDT. + +Date: 13 April 1984 08:14-EST +From: Ken Harrenstien +Subject: IPQ: +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +The IPQ: device is for getting a handle on Internet Packet Queues. +Its main purpose was to allow UDP user/server programs to be written, +but it is also used by a packet-log debugging program. I don't +consider it complete yet -- it works, but is difficult to use. There +were never (and still aren't really) any good examples of things to +use UDP for, so it didn't have high priority and thus was never simplified. + +Date: 13 April 1984 01:05-EST +From: Alan Bawden +Subject: Why aren't you working on your thesis? +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 11 Mar 1984 16:48-EST from Alan Bawden + + Date: 11 March 1984 16:48-EST + From: Alan Bawden + RFNAME on a SPY: channel should return the appropriate FN1. + RFNAME on a CHAOS: channel should return as a directory name a host number + just like TCP: channels. + +I just implemented both of these. Whoever next installs a new ITS should +try them out. + +KLH: What is the IPQ: device all about? + +Date: 9 April 1984 20:25-EST +From: Ken Harrenstien +Subject: TCP Bug +To: CLYNN @ BBNA +cc: BUG-FTP @ MIT-MC, BUG-TCP @ MIT-MC, BUG-ITS @ MIT-MC, + Barrett @ BBNG + +I fixed this bug (ACK 1 too high) in the source; someone assemble a new ITS +one of these days. I also patched the running ITS on MC, so that +CLynn can re-test right away to verify that it now works. (But didn't +patch the ITS on disk, in case he wants to use the bug for a while +to debug the TOPS-20 side). + +Date: 30 Mar 1984 04:39 EST (Fri) +Message-ID: +From: Martin David Connor +To: BUG-ITS@MIT-MC +Subject: [Who?: forwarded] + + +Could someone stop MC from sending unparsable ITS mail headers out +onto the network? + +Received: from MIT-MC by MIT-OZ via Chaosnet; 30 Mar 84 02:26-EST +TK@MIT-MC 03/30/84 02:08:32 +To: marty at MIT-OZ +Indeed. It's about 65 degrees and was sunny until the sun went down. +It was "cold" today, and everyone was complaining. + +Date: 28 March 1984 19:38-EST +From: Glenn S. Burke +Subject: ucprl5+1 again +To: BUG-ITS @ MIT-MC + +dumped to crash;ucplr5 gsb1 +Also complained about extra garbage in ufd STUDNT. + +From the looks of the return action on the system console, it's +about to go again. It's definitely dropping characters too. + +Date: 28 March 1984 16:44-EST +From: Alan Bawden +Subject: All is not well... +To: BUG-ITS @ MIT-MC + +MC crashed twice this afternoon at QINTE+44. Crash dump in CRASH;QINTE +44. +Some kind of disk hardware lossage? While I was sitting here it +crashed again at UCPRL5+1. Thats in CRASH;UCPRL5 +1. Some kind of screwup +running around circular page lists. + +Date: 23 March 1984 05:28-EST +From: Ken Harrenstien +Subject: ITSDOC? +To: ALAN @ MIT-MC +cc: GUMBY @ MIT-MC, BUG-ITS @ MIT-MC + +P.S. you might want to consider calling it SYSDOC instead, because +this has the feature that changes to files therein will be reported on +the system console. Not a real vital issue. + +Date: 23 March 1984 05:25-EST +From: Ken Harrenstien +Subject: ITSDOC? +To: ALAN @ MIT-MC +cc: GUMBY @ MIT-MC, BUG-ITS @ MIT-MC + + + Actually I have been tempted a couple of times recently to revive the + ITSDOC directory and set the documentation up as it was on AI, where + .INFO.;ITS FOO was usually a link to ITSDOC;FOO >. This has the advantage + of letting us keep numbered versions of the documentation, and given that I + am frobbing the documentation occasionally these days, it might be nice to + not always immediately lose the previous version. + +I like that idea! + +Date: 19 March 1984 02:56-EST +From: Alan Bawden +Subject: ITSDOC? +To: GUMBY @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 19 Mar 1984 02:09-EST from David Vinayak Wallace + + Date: 19 March 1984 02:09-EST + From: David Vinayak Wallace + What happened to the ITSDOC directory? + +When I wondered the same thing, we went and looked at AI backups to +discover just where was kept there. What we found was nothing that isn't +now named MC:.INFO.;ITS. + +Actually I have been tempted a couple of times recently to revive the +ITSDOC directory and set the documentation up as it was on AI, where +.INFO.;ITS FOO was usually a link to ITSDOC;FOO >. This has the advantage +of letting us keep numbered versions of the documentation, and given that I +am frobbing the documentation occasionally these days, it might be nice to +not always immediately lose the previous version. + +Date: 19 March 1984 02:09-EST +From: David Vinayak Wallace +Subject: ITSDOC? +To: BUG-ITS @ MIT-MC + +What happened to the ITSDOC directory? + +Received: from MIT-LISPM-31 by MIT-OZ via Chaosnet; 18 Mar 84 19:29-EST +Date: Sunday, 18 March 1984, 19:29-EST +From: Patrick G. Sobalvarro +Subject: T03 SDRC ? +To: KMP at MIT-MC, CStacy at MIT-MC, BUG-ITS at MIT-MC +In-reply-to: The message of 18 Mar 1984 16:31-EST from Kent M Pitman + + Received: from MIT-MC by MIT-OZ via Chaosnet; 18 Mar 84 16:32-EST + Date: 18 March 1984 16:31-EST + From: Kent M Pitman + Subject: T03 SDRC ? + To: BUG-ITS @ MIT-MC + cc: KMP @ MIT-MC + + I am pretty sure that T03 is not a line to SDRC any more. I think it is + just a 300 baud dialup like T04-T07. Could someone please check this and + update its info in whatever database is used by FINGER? Thanks. -kmp + +CStacy seems to have done this, but the 11 does not think that this line is +under modem control, so it won't work very well as one. When I next work on +this tty line cruft I'll change this, if the thing really is a dialup line. +Incidentally, if T03 is a dialup now, what phone is it connected to? + +Date: 18 March 1984 16:31-EST +From: Kent M Pitman +Subject: T03 SDRC ? +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC + +I am pretty sure that T03 is not a line to SDRC any more. I think it is +just a 300 baud dialup like T04-T07. Could someone please check this and +update its info in whatever database is used by FINGER? Thanks. -kmp + +Date: 13 March 1984 15:22-EST +From: Ken Harrenstien +Subject: CRASH;IPQUSI +To: BUG-ITS @ MIT-MC, GSB @ MIT-MC + +Thanks for the dump. I have fixed the bug in the source (INET), but +did not bother to patch the current binary. ITS should be re-assembled +one of these days. + +What happened was that a bad UDP datagram arrived which was not long +enough to hold a UDP header. Bug #1 was not checking the length for +this. Fortunately the UDP dest port value happened to be zero in that +buffer, so the code tried to find a UDP queue for port 0. Bug #2 was +that this succeeded -- it "found" an non-existent queue with all the +relevant info zero. IPQUSI caught this when it noticed it was about +to try interrupting the system job! Both bugs are now fixed, and +I deleted the crash dump. + +Date: 13 March 1984 12:17-EST +From: Alan Bawden +To: CSTACY @ MIT-MC +cc: BUG-DDT @ MIT-MC, BUG-ITS @ MIT-MC, KMP @ MIT-MC +In-reply-to: Msg of Tue 13 Mar 84 06:54 EST from Christopher C. Stacy + + Date: Tue, 13 Mar 84 06:54 EST + From: Christopher C. Stacy + Date: 29 February 1984 10:59-EST + From: Kent M Pitman + SYS4^F clears the screen and types NON-DIRECTORY DEVICE. + Shouldn't this give a no such directory error? I assume + DDT or ITS is somehow stripping the 4 and assuming I'm + trying to reference the SYS device. My file defaults end + up with SYS4: in them... + I think this might be an ITS bug. In DDT at NCTLF2, it tries to open + the file "SYS4:.FILE. (DIR)", starts up a JOB.07 frob for some reason, + and succeeds. + +As I already said, the place to do something about this is in the unknown +device handler. (You know, SYS;ATSIGN DEVICE? The file we don't have a +source for?) ITS proper, and DDT are doing exactly the right things. + +Date: Tue, 13 Mar 84 06:54 EST +From: "Christopher C. Stacy" +To: BUG-ITS@MIT-MC.ARPA +Cc: Kent M Pitman , BUG-DDT@MIT-MC.ARPA +In-reply-to: The message of 29 Feb 84 10:59-EST from Kent M Pitman + + Date: 29 February 1984 10:59-EST + From: Kent M Pitman + SYS4^F clears the screen and types NON-DIRECTORY DEVICE. + Shouldn't this give a no such directory error? I assume + DDT or ITS is somehow stripping the 4 and assuming I'm + trying to reference the SYS device. My file defaults end + up with SYS4: in them... + +I think this might be an ITS bug. In DDT at NCTLF2, it tries to open +the file "SYS4:.FILE. (DIR)", starts up a JOB.07 frob for some reason, +and succeeds. + +Date: 12 March 1984 22:12-EST +From: Glenn S. Burke +Sender: GSB5 @ MIT-MC +Subject: crash dumps +To: BUG-ITS @ MIT-MC +cc: BUG-TCP @ MIT-MC + +bughalt at IPQUSI+6, dumped to CRASH;IPQUSI 031284. +a couple days ago, bughalt at TYIREM (actually TYIRE1+1), dumped +to CRASH;TYIREM 030984. + +Date: 11 March 1984 16:48-EST +From: Alan Bawden +Subject: RFNAME & randomness +To: BUG-ITS @ MIT-MC + +RFNAME on a SPY: channel should return the appropriate FN1. +RFNAME on a CHAOS: channel should return as a directory name a host number + just like TCP: channels. + +BTW, I have always felt that when opening the CLI: device, filenames should +be treated exactly as they are when you open the USR: device. That is, you +should be able to use a specification as the first filename if the +second filename is 0. + +Date: 10 March 1984 18:52-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC +cc: ALAN @ MIT-MC + +ITS was losing from network and local terminals (although apparently +working ok from dialups). The 11 didn't seem to have a parity error +light on and was not obviously stopped or anything, but we (ALAN and +I) did :.;BOOT11 and the world went back to normal. Is this the right +thing to have done and/or is there any more debugging information we +could have scrounged up before reloading the 11? -kmp + +Date: 9 March 1984 10:46-EST +From: John G. Aspinall +Subject: jga;ar3: +To: CSTACY @ MIT-MC +cc: ALAN @ MIT-MC, BUG-ARCDEV @ MIT-MC +In-reply-to: Msg of 9 Mar 1984 08:01-EST from Christopher C. Stacy + +Alan fixed it. I guess neither of us sent a follow up. +Sorry to make unneeded work. cheers... + +Date: 9 March 1984 08:01-EST +From: Christopher C. Stacy +Subject: jga;ar3: +To: JGA @ MIT-MC +cc: ALAN @ MIT-MC, BUG-ARCDEV @ MIT-MC +In-reply-to: Msg of 7 Mar 1984 11:40-EST from John G. Aspinall + + +Maybe you already copied the files into a new AR3:, since reading and +writing files there works fine for me. + +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK with CHAOS; Fri 9-Mar-84 02:41:11-EST +Return-path: +Received: from SCRC-YUKON by SCRC-TENEX with CHAOS; Tue 24-Jan-84 16:54:39-EST +Received: from SCRC-EUPHRATES by SCRC-YUKON with CHAOS; Tue 24-Jan-84 16:43:46-EST +Date: Tuesday, 24 January 1984, 16:54-EST +From: David A. Moon +Subject: The MC chaosnet ARPA server +To: GZ at MIT-OZ +Cc: CStacy at MIT-MC, Moon at SCRC-TENEX +Redistributed-to: Ian@SRI-NIC.ARPA, BUG-ITS@MIT-MC.ARPA +Redistributed-by: Moon%SCRC-TENEX@MIT-MC.ARPA +Redistributed-date: Fri, 9 Mar 84 02:33 EST + + Date: Tue 24 Jan 84 04:43-EST + From: Gail Zacharias + Subject: The MC chaosnet ARPA server + To: moon@MIT-MC, cstacy@MIT-MC + CC: gz%MIT-OZ@MIT-MC.ARPA + + Connecting to this nowadays closes the connection with the close text of: + ? Internal error - NO SUCH DEVICE + + I think the gateway used to (sort of) work in the past. + +Well, it works for me, for both FTP and FINGER. Ah, but wait a minute, +I'm using the TCP server and you're using the ARPA server. They're the +same program, but the contact name controls the order of trying networks. +I just looked at the source (MC:MMCM;ARPA) and if you use it as the ARPA +server it first tries TCP then if that fails tries NCP. But NCP ain't +implemented anymore which is why you get "no such device" rather than +"destination host dead" or something of the sort. I guess a little +restructuring of this code is called for. + +Date: 9 March 1984 02:15-EST +From: Glenn S. Burke +Sender: GSB5 @ MIT-MC +Subject: MIT Miraculous Levitation PDP-10 +To: Ian @ SRI-NIC +cc: BUG-ITS @ MIT-MC + + Date: 8 Mar 1984 20:45 PST (Thu) + From: Ian Macky + + . . . + The "internal error" was apparently due to cca's being down. + And ML has officially gone west. + +But it hasn't reached the horizon yet, so don't dyke it out of the host +tables. Its disk has been fixed, and its processor/pager problem is +going to be worked on this weekend. While i don't expect it to +accept incoming net connections ever, it will certainly need to reach +out and write some files. + +Date: 8 Mar 1984 20:45 PST (Thu) +Message-ID: <[SRI-NIC].IAN. 8-Mar-84 20:45:34> +From: Ian Macky +To: BUG-ITS@MC +Subject: [DJC%MIT-OZ: no such device + no such machine] + +I can't think of a better place for this to go, since I forget the +same of the server that the OZ FINGER uses... + +Date: Thursday, 8 March 1984 18:03-PST +From: DJC%MIT-OZ at MIT-MC.ARPA +To: bug-finger%MIT-OZ at MIT-MC.ARPA +Re: no such device + no such machine +Received: from MIT-MC by SRI-NIC with TCP; Thu 8 Mar 84 18:08:06-PST + +[PHOTO: Recording initiated Thu 8-Mar-84 8:58PM] + + MIT TOPS-20 Command Processor 5(750)-2 + End of ATTACH.CMD.7 + End of COMAND.CMD.5 +@f chan@cca +[CCA-UNIX via MIT-MC] +? Internal error - NO SUCH DEVICE + +[CCA-UNIX via MIT-ML] +%No response +%No path to site +@pop + +[PHOTO: Recording terminated Thu 8-Mar-84 9:00PM] + + +The "internal error" was apparently due to cca's being down. +And ML has officially gone west. + +Date: 7 March 1984 11:40-EST +From: John G. Aspinall +Subject: jga;ar3: +To: BUG-ARCDEV @ MIT-MC, ALAN @ MIT-MC + +JGA;AR3: seems to have suffered in the recent archive brouhaha, +at least I get a hung job every time I try to copy into it. +Could someone knowledgeable take a look at it, and give me an +informed opinion on whether I should go into salvage mode? + +Date: Sun, 4 Mar 1984 14:58 EST +Message-ID: +From: Alan Bawden +To: DCP@MIT-MC, BUG-ITS@MIT-MC +Cc: BUG-OZ@MIT-MC, "Devon S. McCullough" +Subject: %TPC.C +In-reply-to: Msg of 4 Mar 1984 00:00-EST from Devon S. McCullough + + Date: Sunday, 4 March 1984 00:00-EST + From: Devon S. McCullough + To: BUG-OZ at MIT-MC + Re: SET TERMINAL ETX-IS-^C + + Date: 3 March 1984 20:50-EST + From: David C. Plummer + To: DEVON @ MIT-MC + cc: BUG-MINITS @ MIT-MC + Date: 3 March 1984 17:56-EST + From: Devon S. McCullough + ^\ ^C should toggle a flag (that gets reset when you close a + connection) that interchanges ^C and ^Z on the keyboard so I don't + have to do this manually. + Alternatively, you could hack the 20X monitor to do the same thing... + +Hey, we could hack ITS to do this too. ITS already has a similar hack for +exchanging "[" and "]" with "(" and ")". I bet we could even do it right. + +(There is at least one reasonable alternative to simply swapping ^Z and ^C +at the lowest level of input. That is to simply have a way to move the +CALL key from ^Z to ^C. Then you would want ^_^C to be the way to type a +^C, except that that already has a meaning I think...) + +Date: 2 March 1984 12:58-EST +From: Christopher C. Stacy +To: KLOTZ @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 1 Mar 1984 22:29-EST from Leigh L. Klotz + + Date: 1 March 1984 22:29-EST + From: Leigh L. Klotz + To: BUG-ITS + + WHAT IS SYS2;TS LINE? It was written 9/5/77, and just says it's + a PDUMP file. I did :LINE instead of :LINK. It printed + Guess What!!?? + Your program has just gone off into HYPERSPACE!^G + Of course, it was disowned. + +It's appears to be a wholine program of some sort, but I don't know +what the message means or where the source is. + +Date: 1 March 1984 22:52-EST +From: Alan Bawden +Subject: MC woes: PACK NOT BAWDENIZED +To: CENT @ MIT-MC, CSTACY @ MIT-MC, ELLEN @ MIT-MC, GSB @ MIT-MC, + JPG @ MIT-MC, KMP @ MIT-MC, Moon @ SCRC-TENEX +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of Thu 1 Mar 84 17:02 EST from David A. Moon + +OK, using Moon's new routine in DUMP I have repaired the damage I caused +last night. I used the incremental dump of Feb. 28 to reset the reference +dates of all files to their state as of that dump. Thus currently no file +on MC has a reference date later than 2/28/84 (although many of them have +in fact been written since then). + +I can't think of any way that this situation can screw up except the +following: someone who hadn't touched a file in a long time until +yesterday, and who continues not to touch it for some time in the future +will have his file migrate just a little sooner than he might expect. I +don't know of any other program, besides DUMP, that uses the reference date +for anything important. + +Date: 1 March 1984 22:29-EST +From: Leigh L. Klotz +To: BUG-ITS @ MIT-MC + +WHAT IS SYS2;TS LINE? It was written 9/5/77, and just says it's +a PDUMP file. I did :LINE instead of :LINK. It printed + Guess What!!?? + Your program has just gone off into HYPERSPACE!^G +Of course, it was disowned. + +Date: 1 March 1984 15:06-EST +From: Alan Bawden +Subject: archives +To: FILE-R @ MIT-MC, CSTACY @ MIT-MC +cc: MEYER @ MIT-MC, LPH @ MIT-MC, BUG-ITS @ MIT-MC + +MEYER;AR0 TODO and LPH;AR31 MACSYM are both broken archives, they should be +restored from backup tape. (This was caused by the installation of a +broken archive device the other day.) I have renamed them to MEYER;XAR0 TODO +and LPH;XAR31 MACSYM because I believe I have seen COMSAT trying to +reference them both, which makes trouble. They seem to be unsalvageable, +but I didn't delete them in case someone knows something I don't. + +Date: Wed 29 Feb 84 23:28:59-EST +From: RMS%MIT-OZ@MIT-MC.ARPA +Subject: Archives +To: bug-its@MIT-MC + +I at one point started a massive rewrite of arcdev +to finish the problem that it cannot detect 'disk full' +until after the user has closed the file, +but I never finished it because it proved hairier than I had expected. +------- + +Date: 29 February 1984 18:56-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +I spoke with CStacy on the phone and he told me some bits I didn't have. + +He saved the old arc device as DEVICE;OLD ARCDEV. It was built from +AI: SYSENG; ARCDEV 66, which is earlier than the oldest source (68) on +MC: SYSENG; ... the implication being that MC: SYSENG; ARCDEV 68, +although it has been around for 5 years, has never been compiled and/or +tested. + +I re-installed DEVICE;OLD ARCDEV and things seem to work. + +CStacy had me patch MAPARC+6 to have a CAILE instead of a CAIL and redump +it, but for some reason that didn't work. That may either be because I +redumped it incorrectly or because the change is not as harmless as you +would think. + +My testing may also have been confused by the fact that I had a couple of +trashed archives. + +In any case, the state I am leaving this all in is that DEVICE;OLD ARCDEV +(with no patches of any kind) has been replaced into DEVICE;JOBDEV ARC +so that things are as they were yesterday and for the last several years. + +System people can start over again on their patches. Please stick around +and test these things next time, though, so we aren't all stuck with broken +archives. I have one archive which was enough screwed up by the experimental +thing that was released earlier that I am having to retrieve an old copy +of it from backup tape. + +Date: 29 February 1984 18:29-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +Being suspicious that these archive problems were caused by the recent +recompilation of ARCDEV, I recompiled the older version and installed +it but the same problem occurs in that version. Someone should really +look at this problem soon; I've made a real mess of some of my archives +in all this testing. I'm reinstalling the new ARCDEV since it seems to +not be the culprit. + +Date: 29 February 1984 18:07-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +Archives are just completely broken. Try copying something into one and +see if it works. + +Date: 29 February 1984 10:59-EST +From: Kent M Pitman +To: BUG-DDT @ MIT-MC +cc: BUG-ITS @ MIT-MC + +SYS4^F clears the screen and types NON-DIRECTORY DEVICE. +Shouldn't this give a no such directory error? I assume +DDT or ITS is somehow stripping the 4 and assuming I'm +trying to reference the SYS device. My file defaults end +up with SYS4: in them... + +Date: 29 February 1984 01:10-EST +From: Christopher C. Stacy +To: GSB @ MIT-MC +cc: BUG-ARCDEV @ MIT-MC +In-reply-to: Msg of 29 Feb 1984 00:03-EST from Glenn S. Burke + +I installed your ARCDEV fix in the source and on MC. + +Date: 29 February 1984 00:03-EST +From: Glenn S. Burke +To: BUG-ARCDEV @ MIT-MC + +The location 665 in the arc job device, whatever that is, should use CAILE +instead of CAIL. I haven't looked at the source, but it's lossage was +apparent and i had to patch this on ml to keep from irretrievably losing +some stuff... + +Date: 26 Feb 1984 18:48 PST (Sun) +Message-ID: <[SRI-NIC].IAN.26-Feb-84 18:48:28> +From: Ian Macky +To: Leigh L. Klotz +Cc: BUG-ITS@MIT-MC +In-reply-to: Msg of 26 Feb 1984 18:44-PST from Leigh L. Klotz + + The LNKEDP call loops on HS: devices, or seems to when called from EMACS. + +I was (and still am) extremely ignorant about job devices... it's more +surprising that it works at all. I'll look at it... + +Date: 26 February 1984 21:44-EST +From: Leigh L. Klotz +To: BUG-ITS @ MIT-MC + +The LNKEDP call loops on HS: devices, or seems to when called from EMACS. + +Date: 23 February 1984 15:26-EST +From: Kent M Pitman +Subject: DNRF +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, JPG @ MIT-MC +In-reply-to: Msg of 22 Feb 1984 22:33-EST from Alan Bawden + + Date: 22 February 1984 22:33-EST + From: Alan Bawden + To: KMP + cc: BUG-ITS, CSTACY, JPG + Re: DNRF + In-reply-to: Msg of 22 Feb 1984 18:16-EST from Kent M Pitman + + Date: 22 February 1984 18:16-EST + From: Kent M Pitman + Shouldn't it be the case that deleting a file on the DNRF: device + should err with WRONG TYPE DEVICE? ... + + We could only do this half-way really. We could "fix" DELETE to barf at + seeing DNRF, but to make DELEWO barf would require making the channel + remember that it was opened in this mode (a DNRF channel becomes a DSK + channel after opening). Since GSB protests, I suggest we put this idea to + sleep. + +I wasn't worried about DELEWO. Just DELETE (mostly accidental  +or :DELETE; maybe I should have just suggested DDT watch for this). +In any case, since everyone thinks it's a bad idea, I won't push it. + +Date: 23 February 1984 01:17-EST +From: Jeffrey P. Golden +Subject: DNRF +To: KMP @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC + +As long as there is all this mail on the subject ... +I fully agree with GSB, and that we should leave things as they are. + +Date: 23 February 1984 00:17-EST +From: Ed Schwalenberg +Subject: DNRF +To: ALAN @ MIT-MC +cc: KMP @ MIT-MC, BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, JPG @ MIT-MC + +I agree that things are better left as they are, lest we open Pandora's +can of worms. I would point out that not only RENMWO, but DSKUPD, RESRDT +and SRDATE "need to be fixed". + +The "right way" to achieve the functionality desired by KMP is through +CAMEXEC-style translations, which have separate bits for all of the file +operations: read, write, modify, append, delete, rename, and make link. +Unfortunately, even CAMEXEC has no facility for prohibiting DELEWO, RENMWO, +or MLNKWO (make link while open), on a properly opened channel. Obviously, +ITS jobdevs could be invented which either ignore these operations or generate +IOCERRORs if they are attempted. + +Date: 22 February 1984 22:33-EST +From: Alan Bawden +Subject: DNRF +To: KMP @ MIT-MC +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, JPG @ MIT-MC +In-reply-to: Msg of 22 Feb 1984 18:16-EST from Kent M Pitman + + Date: 22 February 1984 18:16-EST + From: Kent M Pitman + Shouldn't it be the case that deleting a file on the DNRF: device + should err with WRONG TYPE DEVICE? ... + +We could only do this half-way really. We could "fix" DELETE to barf at +seeing DNRF, but to make DELEWO barf would require making the channel +remember that it was opened in this mode (a DNRF channel becomes a DSK +channel after opening). Since GSB protests, I suggest we put this idea to +sleep. + +Date: 22 February 1984 22:23-EST +From: Alan Bawden +Subject: ? +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 22 Feb 1984 17:47-EST from Christopher C. Stacy + + Date: 22 February 1984 17:47-EST + From: Christopher C. Stacy + Trying to rename DNRF: to DSK: on same directory gets me + CANT RENAME TO ANOTHER DIRECTORY. + +If you do :CALL RENAME you will find that this can't possibly be an ITS +bug. If you were using DDT, then it is DDT's problem. + +Date: 22 February 1984 21:32-EST +From: Glenn S. Burke +Subject: delete an error on DNRF +To: KMP @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC, JPG @ MIT-MC + +Yes, i disagree, because i sometimes use DNRF: as the default device when +i do hand "gfring", in which i examine potentially deletable files. + +Date: 22 February 1984 18:16-EST +From: Kent M Pitman +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, JPG @ MIT-MC, KMP @ MIT-MC + +Shouldn't it be the case that deleting a file on the DNRF: device +should err with WRONG TYPE DEVICE? This would be handy since mostly +I reference files on DNRF: exactly because I want to not bother them +and if I have left my file defaults set to DNRF: it might have been +by accident. I generally read others' files with DNRF: and would be +happy knowing that this also provided greater protection against +accidentally deleting them. I consider having to type ^O DSK: +to delete such a file after viewing it with DNRF: to be a small price +to pay for the change. + +Does someone disagree strongly with this argument? +-kmp + +Date: 22 February 1984 17:47-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Trying to rename DNRF: to DSK: on same directory gets me +CANT RENAME TO ANOTHER DIRECTORY. + +Date: 18 February 1984 03:48 EST +From: David A. Moon +To: BUG-ITS @ MIT-MC + +In SYSTEM;INET 108 I added the missing instruction whose +absence caused all that ICMP spewage on MC's system console yesterday. +Someone should reassemble the system some time. I guess it's not urgent +since TCP/IP has been in use for over a year and as far as I know this +only happened once. + +Date: 18 February 1984 00:51 EST +From: Pandora B. Berman +Subject: new $$^F loses +To: BUG-ITS @ MIT-MC + +it's a pain to have to type $$1^F all the time when i'm used to typing +plain $$^F. also, it doesn't make filenames sticky anymore, another +large pain. + +Date: 14 February 1984 22:11 EST +From: Alan Bawden +Subject: LOGOUT TIMES +To: WEISS @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 14 Feb 1984 15:35 EST from Paul G. Weiss + + Date: 14 February 1984 15:35 EST + From: Paul G. Weiss + After logging out at 15:33EST, my logout time was set to + 14:16:03, as indicated by finger. + +Well, generally it takes a couple of minutes for this information to make +it into the database of logout times. How long did you wait after logging +out before checking? (Since it is not real important that this information +be up-to-the-minute accurate, it is processed by a demon that only wakes up +occasionally.) + +Date: 14 February 1984 15:35 EST +From: Paul G. Weiss +To: BUG-ITS @ MIT-MC + +After logging out at 15:33EST, my logout time was set to +14:16:03, as indicated by finger. + +Date: 13 February 1984 17:59 EST +From: Ken Harrenstien +Subject: conjecture about "TCP bugs" +To: EAK @ MIT-MC +cc: KLH @ MIT-MC, BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC, CSTACY @ MIT-MC, + DEVON @ MIT-MC + + Date: 13 February 1984 13:56 EST + From: Earl A. Killian + In-reply-to: Msg of 13 Feb 1984 02:48 EST from Ken Harrenstien + + I cannot usually use MC for more than about 5 minutes without + my connection wedging. This is from S1-C, a 4.1bsd 750 Unix with + BBN TCP. Basically output just stops though input seems to get + through for a little while. + +The BBN VAX TCP is known to have bugs, especially under any kind of load. +However, if you are willing to reproduce this at a specific time, I can +log the traffic and thereby identify the problem. + +Date: 13 February 1984 15:26 EST +From: Christopher C. Stacy +Subject: [kmp at MIT-MC: ITS primitive devices] +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, KMP @ MIT-MC +In-reply-to: Msg of 13 Feb 1984 13:36 EST from Alan Bawden + + + Date: 13 February 1984 13:36 EST + From: Alan Bawden + Double Hmmm... Try :LISTF TCP: vs. :LISTF CHAOS:. Perhaps CHAOS: really + \does/ belong in that table after all... + +I think you are right - so I added the CHAOS device to DEVTAB, accordingly. +IPQ is for Internet datagrams; I believe it is part of the internals +of the not-completely-implemented datagram service feature. + +Date: 13 February 1984 13:56 EST +From: Earl A. Killian +Subject: conjecture about "TCP bugs" +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC, CSTACY @ MIT-MC, DEVON @ MIT-MC +In-reply-to: Msg of 13 Feb 1984 02:48 EST from Ken Harrenstien + +I cannot usually use MC for more than about 5 minutes without +my connection wedging. This is from S1-C, a 4.1bsd 750 Unix with +BBN TCP. Basically output just stops though input seems to get +through for a little while. + +Date: 13 February 1984 13:36 EST +From: Alan Bawden +Subject: [kmp at MIT-MC: ITS primitive devices] +To: KMP @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of Sun 12 Feb 84 21:38 EST from Christopher C. Stacy + +[ KMP asked where he could find a list of all of ITS's built-in devices. I + told him to look at the table of sixbit names starting at DEVTAB. ] + +Hmmm... Actually that table doesn't include CHAOS:, presumably because +that table is used by OPEN and you can only open a CHAOS: channel using +CHAOSO. But then TCP: \is/ in that table despite the fact that you have to +use TCPOPN to open it. + +Double Hmmm... Try :LISTF TCP: vs. :LISTF CHAOS:. Perhaps CHAOS: really +\does/ belong in that table after all... + +Date: 13 February 1984 08:09 EST +From: Ken Harrenstien +To: BUG-HOST @ MIT-MC, BUG-HSTLOK @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-NETWRK @ MIT-MC + +I doubt anyone is actually on a list for this program, but +the news is that HSTLOK has been renamed to HOST (to match its +binary name) and revised to work on TNX as well as ITS. +Some fixes to NETWRK were necessary. New source in SYSEN1;HOST and +SYSENG;NETWRK. + +Date: 13 February 1984 02:48 EST +From: Ken Harrenstien +Subject: conjecture about "TCP bugs" +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC, DEVON @ MIT-MC + +All I can say is that it is probably something specific to TACs, +because I don't get that kind of screwage from host-to-host +connections (either Unix or 20X). The TAC software changes +every now and then, and was definitely broken at some points +(see the Internet monthly report). However, to really PROVE +TAC lossage, it needs to be spied on while it is actually +happening. If anyone is able to easily reproduce the problem +then it should be possible to easily figure out who is at fault. + +Date: 12 February 1984 11:45 EST +From: Christopher C. Stacy +Subject: conjecture about "TCP bugs" +To: BUG-ITS @ MIT-MC +cc: BUG-TCP @ MIT-MC, DEVON @ MIT-MC + + +Sometimes when using a Chaosnet connection (like a MINITS HUB) I have +felt a distrubance in the force, as if thousands of words were crying +out -- and then suddenly shuffled. + +The symptom is that there are long delays with no TTY service, making +users think the system has crashed. Just now I was using a TAC for +the first time in months, and when it happened it was extremely +intrusive and scary. + +I wonder if it is ITS that is "broken" rather than anything in the +TCP stuff. This might explain those "TCP bugs" people are always +reporting. Maybe something about the way the TCP code works makes +the problem more noticable to TAC users. + +Oh, well. Something to watch out for. +Maybe I will put in something to let me check for it. + +Date: 8 February 1984 18:18 EST +From: David Vinayak Wallace +To: BUG-ITS @ MIT-MC + +MC dropped my arpa connection three times in 20 minutes today. grump. + +Date: 3 Feb 1984 09:09 PST (Fri) +Message-ID: <[SRI-NIC].IAN. 3-Feb-84 09:09:11> +From: Ian Macky +To: David C. Plummer +Cc: BUG-ITS@MIT-MC, GREN@MIT-MC +Subject: Strange Happenings +In-reply-to: Msg of 2 Feb 1984 21:55-PST from David C. Plummer + +Other direcectories were OK. I looked at .TEMP.; and GREN;, and +maybe one or two others and they were all fine. + +Date: 3 February 1984 03:41 EST +From: Glenn S. Burke +Sender: GSB5 @ MIT-MC +Subject: mc wedgitude +To: BUG-ITS @ MIT-MC + +The DL10 wedges with the par err light on. The one time i took a good +look, none of the address lights were lit. Experimentation shows +that this is at least not directly a function of the mf10 memories in +cabinets E and F. The states of most other lights on the dl10 are +recorded in the log book; i am not going to walk up the stairs again +this morning to either get them, or boot the machine. + +In the no doubt useless hope that this has something to do with the +memories, the NITS dump was patched so that addresses 1000000-2000000 +are out. Note that the address switches of the mf10s seem to have +been rearranged: the cabinets are all at monotonically increasing +addresses from left to right now. + +An earlier spaz of parity errors (i don't know if it's related at all) +had 2 or 3 from mf10 E, and about 6 from somewhere high up in the ampex, +according to the printout on the system console. + +Date: 3 February 1984 00:55 EST +From: David C. Plummer +Subject: Strange Happenings +To: GREN @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 2 February 1984 20:18 EST + From: Ian Macky + + A few minutes ago MC was acting rather strange. Any refernce to the + .MAIL.; directory would hang you - either trying to write a file + (:MAIL hung), or list the directory ^F (or :P D), or anything else. + At the same time, KJB's BABYL fork couldn't be killed. His DDT + would hang on the :KILL and not return. It just now stopped and + all seems well, so I don't have any more information. What might + have caused it? +Were all the other directories accessable. I have seen this +before when the directory cache becomes full and each entry is +unflusable for some reason. I have seen both solutions to this: +the system sooner or later unwedges, or it doesn't requiring +reload. You may not have been able to kill KJB's babyl because it +needed to update something in the file system (close a file, +perhaps?) + +I'm a bit surprised .MAIL. didn't work. When I saw this +behavior, most of the SYS directories worked, and sometimes +.TEMP., and usuall a couple directories of people logged in. + +Date: 2 February 1984 20:18 EST +From: Ian Macky +Subject: Strange Happenings +To: BUG-ITS @ MIT-MC + +A few minutes ago MC was acting rather strange. Any refernce to the +.MAIL.; directory would hang you - either trying to write a file +(:MAIL hung), or list the directory ^F (or :P D), or anything else. +At the same time, KJB's BABYL fork couldn't be killed. His DDT +would hang on the :KILL and not return. It just now stopped and +all seems well, so I don't have any more information. What might +have caused it? + +Date: 2 February 1984 01:34 EST +From: David A. Moon +Subject: Meter hardware on MC +To: BUG-ITS @ MIT-MC +cc: Moon @ SCRC-TENEX + +DATAI 24,n executed in user mode clobbers locations n and n+1 in the system! +It's a good thing I tested this by hand before writing a program to use it. +ITS executes the instruction with XCTR, as it should. I suspect this is +a bug in the microcode. I guess I'll use .suset [.rrunt,, like a good little boy. + +Date: 1 Feb 1984 20:43 EST (Wed) +Message-ID: +From: Martin David Connor +To: bug-its@MIT-MC +Subject: [GLR: bad mail from ML] + +Date: Wednesday, 1 February 1984 18:55-EST +From: Jerry Roylance +To: BUG-MAIL +Re: bad mail from ML + +Got some bad format mail from ML -- no FROM:. + + +^_ +1, bad-header,, +*** EOOH *** +Received: from MIT-ML by MIT-OZ via Chaosnet; 31 Jan 84 21:39-EST +TIM@MIT-ML 01/31/84 21:39:15 +To: glr at MIT-OZ +Where might I be able to find information on the RS-422 standard? +^_ + +Date: Wed, 1 Feb 84 05:14 EST +From: "Christopher C. Stacy" +Subject: more loose ends in ITS network support? +To: Ken Harrenstien +Cc: KMP@MIT-MC.ARPA, MOON%SCRC-TENEX@MIT-MC.ARPA, CSTACY@MIT-MC.ARPA, + BUG-ITS@MIT-MC.ARPA +In-reply-to: The message of 31 Jan 84 16:08-EST from Ken Harrenstien + +CHAOSO and TCPOPN now behave a little more like OPEN. +If these calls lose after arg checking (ie., channel numbers in +range), for example if they want to say %EFLDV, that the error code +will make it into the IOCHST word of the input channel. + +I removed the ISE0 crock for TCP from NETWRK's ANALYZ code, and +reassembled TELNET, SUPDUP, and NAME. There should be no more random +"Could not connect to foreign host with TCP messages" coming out +anymore from either Chaosnet (!) or Internet programs. + +Installed on MC. + +Chris + +Date: 30 January 1984 22:52 EST +From: Christopher C. Stacy +Subject: Chaosnet connections +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC + +In ITS 1362 on MIT-MC: + +Lately MC frequently gets into a state where all CHAOSO calls fail +with DEVICE FULL. I increased the number of Chaosnet indices from 32. +to 50., because there were 16/32 buffers free, and lots of pending +RFCs and confused users. I hope this is the correct fix, and that +GCing of something or other is not broken. + +Date: 29 January 1984 09:09 EST +From: Leigh L. Klotz +Subject: EMACS echo area +To: DEVON @ MIT-ML +cc: BUG-ITS @ MIT-ML +In-reply-to: Msg of 01/22/84 17:17:46 from DEVON at MIT-ML + +If you use the EMACS variable Echo Area Height instead of the raw flag +FS Echo Lines your problems will be over. + + + +Date: 28 January 1984 19:53 EST +From: Alan Bawden +Subject: _LSPM_ OUTPUT +To: WGD @ MIT-MC +cc: BUG-ITS @ MIT-MC, GZ @ MIT-MC, RWG @ MIT-MC, bug-lispm @ SCRC-TENEX +In-reply-to: Msg of 28 Jan 1984 19:30 EST from William G. Dubuque + + Date: 28 January 1984 19:30 EST + From: William G. Dubuque + Date: 27 January 1984 17:03 EST + From: Alan Bawden + Date: 27 January 1984 08:06 EST + From: Bill Gosper + BIL@mc and rwg@Russian tried to write out gz;grob > at about the + same time.... + What program was BIL using on MC? One possible theory is that he + was using a program that did something incompetent. Better + possibility (says Moon standing right behind me) is that RWG's file + server got and error that he somehow never saw. + I was running Nex (KMP's supped-up Emacs) on MC when I wrote the file. + As GZ mentioned, there was a _LSPM_ OUTPUT file laying around for + awhile after my version was written. + +OK, so now we know that it was the file being written by the file server +that never made it. Sounds like RWG was screwed by his Lisp machine not +telling him about an error. Since we are now certain that this is not an +ITS problem, or a problem with some non-lispmachine software, the next +person to send mail on this subject should please delete BUG-ITS from the +header. + +Date: 28 January 1984 19:30 EST +From: William G. Dubuque +Sender: BIL @ MIT-MC +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, GZ @ MIT-MC, RWG @ MIT-MC, bug-lispm @ SCRC-TENEX +In-reply-to: Msg of 27 Jan 1984 17:03 EST from Alan Bawden + + Date: 27 January 1984 17:03 EST + From: Alan Bawden + To: RWG + cc: BIL, BUG-ITS, GZ, bug-lispm at SCRC-TENEX + + Date: 27 January 1984 08:06 EST + From: Bill Gosper + BIL@mc and rwg@Russian tried to write out gz;grob > at about the + same time.... + + What program was BIL using on MC? One possible theory is that he was using + a program that did something incompetent. Better possibility (says Moon + standing right behind me) is that RWG's file server got and error that he + somehow never saw. +I was running Nex (KMP's supped-up Emacs) on MC when I wrote the file. As GZ +mentioned, there was a _LSPM_ OUTPUT file laying around for awhile +after my version was written. I take it there are no known (a)synchronization +problems that could be at the heart of this? +Whatever the error someone should be responsible for making it know to the +writer who loses since, of course, a lot could be lost this way. + +Date: 27 January 1984 17:03 EST +From: Alan Bawden +To: RWG @ MIT-MC +cc: BIL @ MIT-MC, BUG-ITS @ MIT-MC, GZ @ MIT-MC, bug-lispm @ SCRC-TENEX +In-reply-to: Msg of 27 Jan 1984 08:06 EST from Bill Gosper + + Date: 27 January 1984 08:06 EST + From: Bill Gosper + BIL@mc and rwg@Russian tried to write out gz;grob > at about the + same time.... + +What program was BIL using on MC? One possible theory is that he was using +a program that did something incompetent. Better possibility (says Moon +standing right behind me) is that RWG's file server got and error that he +somehow never saw. + +Date: 27 January 1984 08:06 EST +From: Bill Gosper +To: BUG-ITS @ MIT-MC +cc: GZ @ MIT-MC, BIL @ MIT-MC, RWG @ MIT-MC, bug-lispm @ SCRC-TENEX + +BIL@mc and rwg@Russian tried to write out gz;grob > at about the +same time. Russian paused about a minute in File Finish, but seemed to +return from the m-X Copy File normally (RWG had typed ahead +a c-and a few chars, but no aborts or anysuch.) Only BIL's version +made it into gz;. GZ herself reported seeing an open file linger +there for a few minutes and then disappear. + +Date: 23 January 1984 14:30 EST +From: Christopher C. Stacy +To: USER-ACCOUNTS @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I had to reload the password database again; apparently there is +a reproducible way to crash ITS and corrupt this file. +Changes to the database made before 1/20 have been lost.{ + +Date: Mon, 23 Jan 84 02:28 EST +From: David Vinayak Wallace +Subject: I may be a loser, but... +To: "David A. Moon" +Cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: The message of 22 Jan 84 23:58-EST from David A. Moon + + Date: 22 January 1984 23:58 EST + From: David A. Moon + Date: Sunday, 22 January 1984, 07:39-EST + From: David Vinayak Wallace + MC died very strangely tonight. The IO bay and processor were frozen, + but the memory and the ampex were happily flashing their lights as if + nothing was wrong. There was a red NXM light illuminated on the + processor bay (I didn't know there was such a light!). + + There isn't. You must have mistaken something else for the processor; + perhaps the DL10... +I'm a loser. It was the DL10. + + I wasn't able to figure out from that dump file how the system crashed. + I suspect the answer is that it didn't! I also wasn't able to figure + out how you stopped it or what command you used to dump it out (there + weren't any symbols for some reason). + +I halted it with break, then used Y in ddt to make the dump. + +I assumed MC had died because: +Neither the decscribbler nor the vt52 would respond to ^Z. +You could not open a connection over arpa or chaos (I tried status, +file, and supdup). +Existing arpa, chaos, and dialup connections hung. + +Since you couldn't talk to it, I assumed it had crashed. The front-end +was running fine, as I could wake it up with break. + +Perhaps this can help. + +david + +Date: 22 January 1984 23:58 EST +From: David A. Moon +Subject: mc spills her cookies? +To: GUMBY @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Received: from MIT-JANIS by MIT-OZ via Chaosnet; 22 Jan 84 07:39-EST + Date: Sunday, 22 January 1984, 07:39-EST + From: David Vinayak Wallace + Subject: mc spills her cookies + To: bug-its at MIT-MC + + MC died very strangely tonight. The IO bay and processor were frozen, + but the memory and the ampex were happily flashing their lights as if + nothing was wrong. There was a red NXM light illuminated on the + processor bay (I didn't know there was such a light!). + +There isn't. You must have mistaken something else for the processor; +perhaps the DL10, which is the wide bay over near the T-300 disk drives +(between them and the tape drive). It's a pdp11-to-memory interface. +Or it could have been the DF10, on the left-hand end of the row of 8 +memory bays; it's a disk-to-memory interface. As I recall, both have +red NXM lights. + + I put a crash dump in CRASH MEMPAR (since MC had been getting parity + errors just before the crash), but since I cleverly neglected to record + the state of the processor lights, it's probably useless. + +I wasn't able to figure out from that dump file how the system crashed. +I suspect the answer is that it didn't! I also wasn't able to figure +out how you stopped it or what command you used to dump it out (there +weren't any symbols for some reason). + +It has been getting parity errors; I think the Ampex memory is turning +to shit (or has been shit all along). + +Date: 22 January 1984 23:42 EST +From: David A. Moon +Subject: MC crash at 5pm today, dumped to crash;pagfau 1/22/8 +To: BUG-ITS @ MIT-MC, Hornig @ SCRC-TENEX + +Fixed in the source and patched in both the running system and the +dump. When copying a Chaosnet packet into an Internet packet buffer, +it was erroneously using the length of the destination rather than +the length of the source as the length of the transfer; since the +source was shorter it ran off the end of wired memory and took an +exec page fault. + +DEVON@MIT-ML 01/22/84 17:17:46 +To: (BUG ITS) at MIT-ML +This is a longstanding "feature" which is probably actually a bug. +When I detach my tree, the info about the echo area is lost, so +that if I reattach and continue an EMACS, it has forgotten about +the echo area on the screen. Apparently this only happens if I +was actually in EMACS when I was detached (by call waiting) so +I tried the following experiment: + +:tctyp printing nosupdup +emacs$j +^Z +:tctyp software + +will clobber EMACS' echo area, even though the only thing typed at it +while TCTYP was zero was a ^Z, but + +:tctyp printing nosupdup +:tctyp software + +has no ill effect. I can always fix the echo area with the TECO command +FS ECHO LINES$FS ECHO LINES$$ (restarting from DDT with $G clobbers the +line saving info) but it really looks like an ITS bug to me.. + +Received: from MIT-JANIS by MIT-OZ via Chaosnet; 22 Jan 84 07:39-EST +Date: Sunday, 22 January 1984, 07:39-EST +From: David Vinayak Wallace +Subject: mc spills her cookies +To: bug-its at MIT-MC + +MC died very strangely tonight. The IO bay and processor were frozen, +but the memory and the ampex were happily flashing their lights as if +nothing was wrong. There was a red NXM light illuminated on the +processor bay (I didn't know there was such a light!). + +I put a crash dump in CRASH MEMPAR (since MC had been getting parity +errors just before the crash), but since I cleverly neglected to record +the state of the processor lights, it's probably useless. + +david + +Date: 19 January 1984 16:20 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC, ED @ MIT-MC + +Sometimes you are running some program and type ahead something you +didn't really want. Perhaps when that typeahead is read it will flush +valuable typeout on your screen, and perhaps also ^Z would have +similar unwanted effects. Suppose you just wanted flush whatever +pending typein there is. + +There is now a new BACKNEXT command: ^_^U is CLEAR INPUT. +This flushes your TTY input buffer, very similar to if +a .RESET had been done at it. + +It's in the source and patched in the running ITS. Minor bug: I am +not entirely sure how to get the ^U to echo, will look at this with +MOON later on this week or something. + +So, you can do things like this: + +:LISP +* +(SLEEP 6.)FOOBAR ^_^U ;typein cancelled before finished nap +T ;the "foobar " was thrown away. + + + +Stay tuned for more exciting news... + +Date: 15 January 1984 22:10 EST +From: Leigh L. Klotz +To: BUG-ITS @ MIT-MC + +I was using ITS at the time KMP noted the crash. I don't know if this +was referring to my tty buffer or if this happened to others, but I was using +EMACS at the time and all of a sudden got a logout message at the +cursor position. Thereafter after each keystroke I got three more characters. +I also got the following BYE message, but unfortunately the nick-name of +the person ran off the edge of the screen. I kept pressing keys and +getting more characters until I eventually got nothing, and then it +hung up. + +Date: 15 January 1984 18:38 EST +From: Kent M Pitman +Subject: MC crashed in tty code (TYOOU1+5; buffer ptr past eob) +To: BUG-ITS @ MIT-MC + +In ITS in NEX 342, Emacs 162, Teco 1171, ITS 1359 on MIT-MC: + +ITS stopped with he following message: + TTY: OUTPUT BUFFER POINTER PAST END OF BUFFER +The PC was TYOOU1+5. +I dumped this to CRASH;TYOOU1 +5 +and reloaded. + +Date: 12 January 1984 05:24 EST +From: Ken Harrenstien +To: RWG @ MIT-MC +cc: BUG-ITS @ MIT-MC, DCP @ MIT-MC, REM @ MIT-MC + +I suspect REM's problems have more to do with the TAC than with MC. +I use MC every day via the net, from SRI-NIC, and response seems +pretty good to me. I wonder if other TAC users have the same problems +(whatever they are). + +Date: 12 January 1984 01:44 EST +From: David C. Plummer +To: RWG @ MIT-MC +cc: BUG-ITS @ MIT-MC, DCP @ MIT-MC, REM @ MIT-MC + + Date: 11 January 1984 22:58 EST + From: Bill Gosper + + Although DCP's patch has cured the monster hangups in MC net service, + echoing and typing are still pathologically slow these past weeks. + REM is similarly mistreated via the arpanet. +Gosper is a 9600 baud land line and a microwave away from MC. +Just about any traffic on the land line will cause realtime +delays. When only a microwave link away I notice very few +hangups, and they are only for less than 1 second (I would guess +they are about .7 seconds but I can't really tell). + +Date: 11 January 1984 22:58 EST +From: Bill Gosper +To: BUG-ITS @ MIT-MC +cc: DCP @ MIT-MC, REM @ MIT-MC + +Although DCP's patch has cured the monster hangups in MC net service, +echoing and typing are still pathologically slow these past weeks. +REM is similarly mistreated via the arpanet. + +Date: 10 January 1984 04:45 EST +From: Ken Harrenstien +To: KMP @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-NAME @ MIT-MC + + Date: 9 January 1984 22:59 EST + From: Kent M Pitman + + Hmm. I just sent mail to BUG-FINGER asking :NAME KMP@OZ + was replying right away with + + Could not connect to foreign host with TCP. + + but in fact, :OZ is doing this, too, so something must + be confused with the network. + +Either a host table got written out which had OZ's arpanet +address in it, or OZ was down and the NETWRK error analysis code +doesn't know how to handle it properly (maybe because it doesn't +know whether the connection attempt was using CHAOS or TCP). +I re-did the NETWRK package to report TCP errors properly, but +I don't know whether this will help or not. I doubt many programs +have been recompiled with the new NETWRK yet. + +Date: 9 January 1984 22:59 EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC +cc: BUG-NAME @ MIT-MC + +Hmm. I just sent mail to BUG-FINGER asking :NAME KMP@OZ +was replying right away with + + Could not connect to foreign host with TCP. + +but in fact, :OZ is doing this, too, so something must +be confused with the network. + +Date: 7 January 1984 15:00 EST +From: Kent M Pitman +Sender: KMP0 @ MIT-MC +To: BUG-ITS @ MIT-MC + +MC has been getting parity errors (three in the last hour)... + + 14:16:12 #5 PC = 310000,,017213, JOB# 26, USR: TORBEN L + ERR ADDR = 602005433716 + PARITY ERRORS: + 5,,433717 512500,,400 + + 14:41:18 #6 PC = 710000,,107117, JOB# 66, USR: GIF HACTRN + ERR ADDR = 602004377116 + PARITY ERRORS: + 4,,377117 211102,,403 + + 14:41:33 #7 PC = 710000,,107117, JOB# 66, USR: GIF HACTRN + ERR ADDR = 602004377116 + PARITY ERRORS: + 4,377117 211102,403 + +In case it matters, the machine room seems quite cool and dry +(unlike last week). + +Date: 6 January 1984 02:30 EST +From: Christopher C. Stacy +Subject: your patch is on disk now +To: DCP @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 6 Jan 1984 02:14 EST from David C. Plummer + + +You were trying to dump out a patched ITS BIN file instead of a world +load. I don't know offhand know why this doesn't work, but I patched +the NITS world load and dumped it out as XITS. I'll reassemble the +system tomorrow probably anyway... + + +Date: 6 January 1984 02:14 EST +From: David C. Plummer +To: BUG-ITS @ MIT-MC, BUG-TWENEX @ MIT-MC +cc: CHAOS-NCP-PEOPLE @ MIT-MC, RWG @ SPA-NIMBUS + +I have patched MC so that it only retransmits the first packet on +the transmit queue instead of the entire queue. There are a few +theories that say this is a reasonable thing to do. Its greatest +impact is on the slow links which do packet filtering to avoid +complete congestion. + +I would update the on disk version, but the + L + make patch + Y +method doesn't seem to work. (Actually, the resulting file was 7 +or so blocks shorter.) So, if somebody could update the disk +version, or make the patch each time ITS is booted, it would be +appreciated. The patch is + CHART2-1/ JFCL (was JUMPN A,CHART1) +I have updated the source. + +Bug-Twenex people: the equivalent source change (if the Dec 10, +1983 code on EE:LIB:<5.MONITOR>CHAOS.MAC is anywhere near correct +(OZ and SPEECH won't talk to me and I couldn't find it on XX) is +to remove the + JRST CHART1 at CHARTD-1 +and replace it with the comment + ;; fall through, since we only retransmit one packet of the list. +This can also be patched to a JFCL if you want to test it. + +Other people: You may want to do (or at least try) similar things. + +Date: 4 January 1984 00:46 EST +From: Christopher C. Stacy +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 3 Jan 1984 23:35 EST from Alan Bawden + + Date: 3 January 1984 23:35 EST + From: Alan Bawden + To: BUG-ITS + + What happened to the source of SYS:ATSIGN DEVICE? + +The source does not seem to be online anywhere, and is not on MC's +backup tape. I'll go looking for it on AI backup tape later on. + +Date: 3 January 1984 23:35 EST +From: Alan Bawden +To: BUG-ITS @ MIT-MC + +What happened to the source of SYS:ATSIGN DEVICE? + +Date: 21 December 1983 04:48 EST +From: Christopher C. Stacy +Subject: weirdness +To: BUG-ITS @ MIT-MC, USER-ACCOUNTS @ MIT-MC +cc: BUG-PWORD @ MIT-MC + + +The PWORD accounts database was clobbered tonite somehow, apparently +when the system crashed due to memory parity errors. (The DSK module +was reporting them so I assume this means it was during disk DMA.) +Apparently the file was clobbered when the system crashed, it has been +zeroed or had some pointers shuffled or something -- I haven't looked +at it yet but the file was still the correct length. I was under the +impression that this sort of thing could not happen. + +USER-A people: Anyway, we got it back off of tape from Monday. + +Chris + +Date: 18 December 1983 12:13 EST +From: Christopher C. Stacy +To: RK @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC +In-reply-to: Msg of 17 Dec 1983 12:34 EST from "Richard Kovalcik, Jr." + + + Date: 17 December 1983 12:34 EST + From: "Richard Kovalcik, Jr." + To: BUG-ITS, BUG-TCP + cc: RK + + Any reason why MC is making outgoing TCP/IP connections but + not accepting incoming ones? Mail is still backing up for MC + on various sites becuase of this. + -Rick + +For a while the system was in debug mode which does this. + +Date: 17 December 1983 12:34 EST +From: "Richard Kovalcik, Jr." +To: BUG-ITS @ MIT-MC, BUG-TCP @ MIT-MC +cc: RK @ MIT-MC + +Any reason why MC is making outgoing TCP/IP connections but not accepting incoming ones? +Mail is still backing up for MC on various sites becuase of this. + +-Rick + +P.S. Both telnet and smtp gets resets immediately when you try to open to +them from both CISL and MIT-Multics. + +Date: 15 December 1983 18:23 EST +From: Patrick G. Sobalvarro +To: BUG-WHOIS @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 8 December 1983 01:29 EST + From: Christopher C. Stacy + To: PGS @ MIT-MC + cc: BUG-FINGER @ MIT-MC, BUG-HOSTS @ MIT-MC + In-reply-to: Msg of 7 Dec 1983 16:36 EST from Patrick G. Sobalvarro + + Date: 7 December 1983 16:36 EST + From: Patrick G. Sobalvarro + To: BUG-FINGER, BUG-HOSTS + + As of today, doing :f @oz on mc get me the error message "Could not + connect to foreign host with TCP." Crufty, crufty lossage. + + ":F @OZ" works fine for me on MC. + Maybe there is a bug in the ANALYZ code in the ITS NETWRK package, and + when it could not connect to OZ over the Chaosnet it decided to give + the most general TCP error message. + +This is the second time this bug has bitten me. ML is up right now. On MC, +I did :whois pgs@ml. I immediately (not long enough for a chaos connection +attempt to time out, but immediately) got the error message "Could not +connect to foreign host with TCP." Immediately after that, it worked. + +Date: 12 December 1983 07:59 EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Since all the INFO stuff is on FOURTH:, I can't read documentation +that I want while the system is crippled. + +Date: 10 December 1983 10:05 EST +From: Patrick G. Sobalvarro +Subject: wierd +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC, ITS-LOVERS @ MIT-MC +In-reply-to: Msg of 10 Dec 1983 01:50 EST from Alan Bawden + + Date: 10 December 1983 01:50 EST + From: Alan Bawden + To: BUG-ITS + cc: ITS-LOVERS + Re: wierd + + Anybody have any idea where MC:SYS;FORMAT EXE came from? (Perhaps some + subversives are planning on bringing 20X up on MC?) + +I'd bet that this was a case of someone cftping it over and saying yes to the +stupid cftp defaults. Why the might have wanted to cftp it over, I don't +know. Those cftp defaults have never ever been useful to me. If cftp did +filename-merging, maybe they would be. + +Date: 10 December 1983 01:50 EST +From: Alan Bawden +Subject: wierd +To: BUG-ITS @ MIT-MC +cc: ITS-LOVERS @ MIT-MC + +Anybody have any idea where MC:SYS;FORMAT EXE came from? (Perhaps some +subversives are planning on bringing 20X up on MC?) + +Date: 9 December 1983 11:37 EST +From: Leigh L. Klotz +Subject: Weirdness... +To: EPS @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 9 Dec 1983 01:23 EST from Eric P. Scott + +You probably got a parity error. + +Date: 9 December 1983 01:31 EST +From: Eric P. Scott +Subject: Weirdness (3) +To: BUG-ITS @ MIT-MC + +I :SNARFed a CHTN and got (BADPI;IOCH12;IOCH0;) 2203>>.HANG 0/ 0 +This just isn't my day. + -=EPS=- + +Date: 9 December 1983 01:28 EST +From: Eric P. Scott +Subject: Weirdness (2) +To: BUG-ITS @ MIT-MC + +(BADPI;INF0;) 135252>>TDNN 2, 2/ 10000,,0 0/ 0 +I :PDUMPed it to USERS1;EPS DEADDT if anyone cares. + + -=EPS=- + +Date: 9 December 1983 01:23 EST +From: Eric P. Scott +Subject: Weirdness... +To: BUG-ITS @ MIT-MC + +I got a tree detached by top-level interrupt followed by +MC ITS REVIVED. No one else seems to have been affected. +Weird... + -=EPS=- + +Date: 4 December 1983 23:07 EST +From: Christopher C. Stacy +Subject: hanging up phone lines +To: CBF @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 4 Dec 1983 17:43 EST from Charles Frankston + + + Date: 4 December 1983 17:43 EST + From: Charles Frankston + To: BUG-ITS + Re: hanging up phone lines + + ITS needs better facilities for hanging up dialup lines. Since most other + computers nowadays automatically hangup the phone line after logout + (either immediately or with a short timeout), I think some users don't + realize that they have to do this manually on ITS. + + I don't believe ML has the hardware to hangup a line. The I/O and Console + 11's on MC have the appropriate hardware but don't give the pdp10 any way + to control the appropriate bits. + +There used to be this .HANGUP UUO...maybe there should be a system +call for reading and frobbing arbitrary bits on tty lines in the pdp-11. + +.HANGUP dialnum, ANCIENT HISTORY hang up a dialed line + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .REVIVE. + + This uuo was used to hang up on a line which had + been dialed by the .DIAL uuo. + +Date: 4 December 1983 17:43 EST +From: Charles Frankston +Subject: hanging up phone lines +To: BUG-ITS @ MIT-MC + +ITS needs better facilities for hanging up dialup lines. Since most other +computers nowadays automatically hangup the phone line after logout +(either immediately or with a short timeout), I think some users don't +realize that they have to do this manually on ITS. + +I don't believe ML has the hardware to hangup a line. The I/O and Console +11's on MC have the appropriate hardware but don't give the pdp10 any way +to control the appropriate bits. At worst something like to LSPEED +command could be used to hangup a line. At best the system would use the +same sorts of timeouts it uses to close STY channels. If I get some time +after the term I might look at the LSPEED covert channel. Informed +suggestions on other approaches would be welcome. + +Date: Friday, 2 December 1983, 00:44-EST +From: David Vinayak Wallace +Subject: safe site ap8 +To: Pandora B. Berman +Cc: TIM at MIT-MC, BUG-ITS at MIT-MC, user-a at MIT-MC +In-reply-to: The message of 2 Dec 83 00:00-EST from Pandora B. Berman + + Date: 2 December 1983 00:00 EST + From: Pandora B. Berman + TIM@MIT-MC 11/29/83 05:35:55 + Hmm, MC thinks that AP8 is an "insecure" site. Who/how does this get + changed? + + it's built into something. i don't know how to change, but surely someone + else does. + +I fixed this for MC and ML. + +Date: 2 December 1983 00:00 EST +From: Pandora B. Berman +Subject: safe site +To: TIM @ MIT-MC +cc: BUG-ITS @ MIT-MC + + TIM@MIT-MC 11/29/83 05:35:55 + Hmm, MC thinks that AP8 is an "insecure" site. Who/how does this get + changed? (it's not THAT big a deal, but it probably doesn't know about + other relatively new machines either). + +it's built into something. i don't know how to change, but surely someone +else does. + +Date: 15 November 1983 03:27 EST +From: Christopher C. Stacy +Subject: DIR: bug +To: KMP @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 10/28/83 13:55:33 + From: KMP + + If you do c-X c-F DIR: KMP; FIRST KMP, you'll note that Emacs thinks + this is a link to KMP; DIR: FIRST KMP ... Is it possible that DIR: is + not handling the LNKDP system call (or whatever it's called) correctly? + +It's called LNKEDP, and I just fixed DIR: to handle it properly. +Installed on MC, old version in DEVICE;JOBDEV ODIR. + +Date: 15 November 1983 03:08 EST +From: Christopher C. Stacy +Subject: DIR device rescued +To: KMP @ MIT-MC +cc: BUG-ITS @ MIT-MC + + +Suffering arbitrary amounts of tedium, I just now recovered the source +code to the DIR device from DM backup tape and put it in SYSENG;. +I sure hope nothing else important was forgotten over there. + + +Date: 15 November 1983 03:01 EST +From: Christopher C. Stacy +Subject: hostat +To: SHAWN @ MIT-ML +cc: BUG-ITS @ MIT-ML +In-reply-to: Msg of 11/15/83 00:34:36 from SHAWN at MIT-ML + + +HOSTAT can not work anymore, since it wants to talk to DM's +host status SURVEY server. Rewriting something similar is +on my list of things to do in my spare time. + + + +SHAWN@MIT-ML 11/15/83 00:34:36 Re: hostat +To: (BUG ITS) at MIT-ML + +ERROR: OPEN: DSK: SYSBIN; HOSTS1 > - FILE NOT FOUND +4146>>.CALL 4434 (OPEN) + + + +Date: 10 November 1983 15:09 EST +From: Christopher C. Stacy +Subject: ARPA net +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC, DIGEX @ MIT-MC, KFL @ MIT-MC +In-reply-to: Msg of 10 Nov 1983 11:10 EST from Devon S. McCullough + + +I have a program called LOGN which I run when I log in. +I will check it out and release it for you later today. +It does the right thing with TAC binary mode, also also hacks TTYLOCs. +There is another program called TBMOFF for my logout file (to turn TAC +BINARNY MODE off). + + +Date: 10 November 1983 11:10 EST +From: Devon S. McCullough +Subject: ARPA net +To: CSTACY @ MIT-MC +cc: DEVON @ MIT-MC, DIGEX @ MIT-MC, KFL @ MIT-MC, BUG-ITS @ MIT-MC + +What's the correct way for a LOGIN init file to send + IAC DO TRBIN and IAC WILL TRBIN to a TAC? + +ttyopt/ +:if n %Q&%TPTEL> +$(:$ do trbin $ imgout 377 375 0 + $) + +works in most cases, except for the %TDQOT screw if your TCTYP is %TNSFW +since then the TAC sees a %TDQOT before every character of the IAC sequence. +I suppose I could save the value of TCTYP in DT somewhere, set TCTYP to zero, +execute the IMGOUT program and then restore TCTYP, but it's not exactly +clear to me how to do this, can it be done from DDT or must a program do it? +If so, I will just write a hacked-up version of IMGOUT called TAC which +accepts TAC commands and sends them. + +Every time I vary my procedures even slightly I get screwed by %TDQOT and +TCTYP SOFT not knowing at what level to strip off the %TDQOT's... + +but my solution for a :TAC Binary Output Start is still wrong, since if +the poor loser is using CRTSTY he will probably be screwed. Perhaps +what we really need is a %TDIAC code which is simply intended for +telling TELSER to try to frob the protocol in some way. + +Date: 30 October 1983 21:35 EDT +From: George J. Carrette +To: BUG-ITS @ MIT-MC + +:FIND SYSENG;HOSTS +HOSTS 666 written by CSR, beware. + +Date: 30 October 1983 21:18 EDT +From: David A. Moon +Subject: That ITS out-of-low-core bug +To: BUG-ITS @ MIT-MC + +Fixed in the source. I will come over probably some time this +week and find the subtle bugs I no doubt introduced into the system; +I wouldn't recommend trying to install the changes I made without me. +Happy Hallowe'en. + +Date: 30 October 1983 18:59 EDT +From: Kent M. Pitman +Subject: ITS wedgeding +To: MOON @ SCRC-TENEX +cc: BUG-ITS @ MIT-MC, CSTACY @ MIT-MC, ELLEN @ MIT-MC, GSB @ MIT-MC, + JPG @ MIT-MC, TAFT @ MIT-MC, KLH @ SRI-NIC +In-reply-to: Msg of 29 Oct 1983 15:59-EDT from MOON at SCRC-TENEX + + Date: Saturday, 29 October 1983 15:59-EDT + From: MOON at SCRC-TENEX + + ... Lack of low core could not affect echoing on local terminals, and would + only affect echoing on network terminals if there wasn't enough core to + make network packet buffers. Of course maybe the users were confused + and what they really meant was that their programs were busted. + +I was on just before it died. Echo time might not be the right phrase. +The slowness was of the following sort... I typed :SRCCOM ... +and waited a long time but gotten no output. Echo time for that time was +normal. I finally typed ^G and V. The V did not echo. I typed some +^G's and maybe some other frustration chars (^D?) after a while and and +found myself in a mode where I felt like what might be happening was that +for every character I typed, a character would echo but it was out of +phase by several characters with my input. The output from the V, by the +way, indicated that the SRCCOM job had not loaded. Finally, though, +no more input of any sort would echo, so I gave up and closed my connection. +-kmp + +Date: 30 October 1983 09:20 EDT +From: Christopher C. Stacy +Subject: RAT; +To: JPG @ MIT-MC +cc: BUG-ITS @ MIT-MC, ELLEN @ MIT-MC, GSB @ MIT-MC, KLH @ MIT-MC, + KMP @ MIT-MC, TAFT @ MIT-MC, moon @ SCRC-TENEX +In-reply-to: Msg of 30 Oct 1983 09:16 EDT from Jeffrey P. Golden + + +No, this is all long before a HACTRN has been created. + +Date: 30 October 1983 09:16 EDT +From: Jeffrey P. Golden +Subject: RAT; +To: CSTACY @ MIT-MC, moon @ SCRC-TENEX +cc: BUG-ITS @ MIT-MC, ELLEN @ MIT-MC, GSB @ MIT-MC, KLH @ MIT-MC, + KMP @ MIT-MC, TAFT @ MIT-MC, JPG @ MIT-MC + + Date: Saturday, 29 October 1983 16:02-EDT + From: MOON at SCRC-TENEX + To: Christopher C. Stacy + Cc: BUG-ITS at MIT-MC, ELLEN at MIT-MC, GSB at MIT-MC, JPG at MIT-MC, + KLH at SRI-NIC, KMP at MIT-MC, TAFT at MIT-MC + Subject: ITS wedgeding + In-reply-to: The message of 29 Oct 1983 01:52-EDT from Christopher C. Stacy + + Oh by the way, I forgot to mention about the job that had two disk + channels open, where one was to "RAT;". The mode printed by Peek C + mode for that channel was "RU", meaning that it was reading a + directory ("UFD"). Probably this channel really belonged to some + other job and peek was confused. +Is the question: Why RAT; ? +If so, isn't PWORD the answer? + +Date: 30 October 1983 09:08 EDT +From: Jeffrey P. Golden +Subject: MC:BACKUP; +To: BUG-ITS @ MIT-MC, MOON @ SCRC-TENEX +cc: JPG @ MIT-MC + + Date: Saturday, 29 October 1983, 22:54-EDT + From: David A. Moon + To: Jeffrey P. Golden + Cc: GSB@MIT-MC, BUG-ITS@MIT-MC + The idea is to have a system there that works well enough that you + can bring it up and run DUMP to load backup tapes. It doesn't have + to support networks, terminals, etc. +I agree with the idea. But if it is to work: +[1] There should be a -READ- -THIS- file there which lists the key +files that should be present on the BACKUP; direc. +[2] Someone should look over that directory and delete useless or +harmful files and replace them by the necessary files so that the idea +Dave mentions can be carried out if it should ever be necessary. + +Received: from SCRC-EUPHRATES by SCRC-TENEX with CHAOS; Sat 29-Oct-83 22:51:38-EDT +Date: Saturday, 29 October 1983, 22:54-EDT +From: David A. Moon +To: Jeffrey P. Golden +Cc: GSB@MIT-MC, BUG-ITS@MIT-MC +In-reply-to: The message of 14 Oct 83 04:46-EDT from Jeffrey P. Golden + + Date: 14 October 1983 04:46 EDT + From: Jeffrey P. Golden + GSB@MIT-MC 10/13/83 17:44:25 Re: MC directory slot + BACKUP; is for backup copies of things on .; and occasionally other things. + Why can't .; itself be used for this? For the couple of true backup @ files, + which have the same names as files on .; , e.g. CRASH; would work fine. + Or better, SYS; ? + + It should be preserved, and it does get updated occasionally. + The last time a file was added to MC:BACKUP; was Feb. 1982 and I believe + almost everything there is garbage. If BACKUP; were trully for backup + then leaving non-working stuff on that directory as is now the case + may be hazardous for MC's health if ever invoked. + + I believe that it has proven itself useful on ML at least. + I see no recent proof of this for MC:BACKUP; . + +The idea is to have a system there that works well enough that you +can bring it up and run DUMP to load backup tapes. It doesn't have +to support networks, terminals, etc. + +Date: Saturday, 29 October 1983 16:02-EDT +From: MOON at SCRC-TENEX +To: Christopher C. Stacy +Cc: BUG-ITS at MIT-MC, ELLEN at MIT-MC, GSB at MIT-MC, JPG at MIT-MC, + KLH at SRI-NIC, KMP at MIT-MC, TAFT at MIT-MC +Subject: ITS wedgeding +In-reply-to: The message of 29 Oct 1983 01:52-EDT from Christopher C. Stacy + +Oh by the way, I forgot to mention about the job that had two disk +channels open, where one was to "RAT;". The mode printed by Peek C +mode for that channel was "RU", meaning that it was reading a +directory ("UFD"). Probably this channel really belonged to some +other job and peek was confused. + +Date: Saturday, 29 October 1983 15:59-EDT +From: MOON at SCRC-TENEX +To: Christopher C. Stacy +Cc: BUG-ITS at MIT-MC, ELLEN at MIT-MC, GSB at MIT-MC, JPG at MIT-MC, + KLH at SRI-NIC, KMP at MIT-MC, TAFT at MIT-MC, + Moon at SCRC-TENEX +Subject: ITS wedgeding +In-reply-to: The message of 29 Oct 1983 01:52-EDT from Christopher C. Stacy + + Date: Saturday, 29 October 1983, 01:52-EDT + From: Christopher C. Stacy + Subject: ITS wedgeding + To: BUG-ITS at MIT-MC + Cc: TAFT at MIT-MC, KMP at MIT-MC, KLH at SRI-NIC, Moon at SCRC-TENEX, + ELLEN at MIT-MC, JPG at MIT-MC, GSB at MIT-MC + + TAFT@MIT-MC 10/28/83 14:31:11 Re: Crash of 10/28 14:27 + MC was catatonic, but running. Though jobs could be logged in, no + response to anything other than ^G could be obtained. I checked + around that this was really the case and then stopped it. + + + MC was also merrily printing lots of my little "Warning: " messages every chance it got. + + In ITS 1353, crash file CRASH;ITS LOWCOR, SYSjob 88, Core 71, Net 24, + IMP 338, Chaos 255, INet 96, NCP 5, TCP 256, TCPbuf 53, on MIT-MC: + + There is definitely something weird going on here. + Of the 50 disk channels, none are free. + There is no more free low core (for making file or network buffers.) + + There are about 37 ___nnn CHAOS and 22 ___nnn TCP jobs trying to boot. + They are in LOAD or OPEN, trying to read ATSIGN CHAOS or ATSIGN TCP, + respectively. They all have read 0% of their file. + + We can look at a representative wedged server job: user idx 101. + ___101 TCP, is blocked inside a LOAD call: NLOADD+6/ SKIPG QSFBS(A) A/ 40 + I don't entirely grok this disk code yet, but from the channel state + (%QALBK) and mode (READ/USER DATA), and the comment where he blocks, + it looks like he is waiting for the file channel to receive a buffer + with the first page of the TCPSER file. + + Also, there may also be something weird file-wise with this particular job. + Unlike the others, I think it has two (QUSR idx) channels: 17 and 40. + According to PEEK, he is also opened RAT; (no file name), which I + guess accounts for channel 17. But, huh? What? Why? + + Now, the TCP situation shows that there can be up to 180. packet + buffers, of which zero are free out of a total zero allocated. + + I checked in XBUSER and friends. + There is only one TCP frob around, and he's not doing a whole lot: + TCP index 21, which has no associated job, is in "CLSACK" for SRI-CSL. + Has received FIN for input, State is "Last ACK". + User channel state: (input) Foreign host RESET, retransmit timeout (output). + The close reason is: Closed by user, Closed by foreign host. + + This is (I think) reasonable, but does not account for all those other TCP servers! + + + 1. WHAT ARE ALL THOSE NETWORK SERVER JOBS DOING WITHOUT ANY + NETWORK CONNECTIONS? Is it that the connections went away + before the jobs had a chance to get started, or what? + What are all these jobs for, anyway? + +They have to load their programs before they can open their network +connection. The incoming RFC (SYN in the TCP case) that started these +jobs probably timed out and was rejected before you dumped the system, +hence no trace of it was left. If they're trying to load the ATSIGN xxx +program (rather than the actual server) that means they haven't even +yet queried the system's RFC (SYN) queue to find out what contact name +(port number) they are supposed to serve. + +The system is supposed to filter out duplicate RFCs and SYNs, so if that's +working each of those jobs was created by a separate user attempt to connect. +Of course if they block forever in the LOAD system call, once created they +will never go away. + + 2. WHERE DID ALL THE LOW CORE GO? + This seems to be the reason those server jobs can't get going. + +The lack of low core is indeed the reason the servers can't get going; they +can't get a buffer to use to read their disk files they're trying to load. +Even in PDUMP format the first page of the file has to be read into low core +to find out what pages are to be loaded. + +One reason for lack of low core is bloatage of directories. I've been meaning +to make a straightfoward but not totally simple fix to allow directories to +be stored anywhere in core, but haven't got around to it. I guess you should +bug me about this periodically. + +However, in this case that isn't the problem: there are only 9 pages of +directories (DSKUDR in Peek M mode) plus 7 pages of disk buffers. I looked +around at the MEMBLT and MEMPNT tables. A lot of the low core pages are +just user pages of job 100, a worthless TEX job. See the large comment +a few lines below SWPOPG; evidently the system keeps trying to swap +out more and more pages to get some low memory, but keeps swapping out +the wrong jobs. + +The right fix is to make it specifically swap out pages in "low" memory +(as counted by LMEMFR) in this case, or else to put the core shuffler +back in to move those pages to "high" memory. Maybe I'll look into this +in a few days when I get time. + + 3. I heard that typein was echoing very slowly for users during this + wedged period. I wonder if this was true, it was it true for local + consoles as well as STYs? I don't really understand why this should + be, in either case. When the system is running out of core, I have + usually been able to do SYS$J (provided there was a channel for me + to .OPEN on USR:) and look around. + +Lack of low core could not affect echoing on local terminals, and would only +affect echoing on network terminals if there wasn't enough core to make +network packet buffers. Of course maybe the users were confused and +what they really meant was that their programs were busted. + +Date: 29 October 1983 01:13 EDT +From: Alan Bawden +To: BUG-ITS @ MIT-MC + +Perhaps someone could write a demon that ran at system startup time that +would look for files whose authors were set to non-existent directories and +set them to be unknown. That way we would avoid recycled directories +claiming that they authored files that were written by people now gone. + +I think about this now because I just noticed that MC:SYS1;TS STINK was +authored by the newly created directory VASL... + +Date: Saturday, 29 October 1983, 01:52-EDT +From: Christopher C. Stacy +Subject: ITS wedgeding +To: BUG-ITS at MIT-MC +Cc: TAFT at MIT-MC, KMP at MIT-MC, KLH at SRI-NIC, Moon at SCRC-TENEX, + ELLEN at MIT-MC, JPG at MIT-MC, GSB at MIT-MC + + TAFT@MIT-MC 10/28/83 14:31:11 Re: Crash of 10/28 14:27 + MC was catatonic, but running. Though jobs could be logged in, no + response to anything other than ^G could be obtained. I checked + around that this was really the case and then stopped it. + + +MC was also merrily printing lots of my little "Warning: " messages every chance it got. + +In ITS 1353, crash file CRASH;ITS LOWCOR, SYSjob 88, Core 71, Net 24, +IMP 338, Chaos 255, INet 96, NCP 5, TCP 256, TCPbuf 53, on MIT-MC: + +There is definitely something weird going on here. +Of the 50 disk channels, none are free. +There is no more free low core (for making file or network buffers.) + +There are about 37 ___nnn CHAOS and 22 ___nnn TCP jobs trying to boot. +They are in LOAD or OPEN, trying to read ATSIGN CHAOS or ATSIGN TCP, +respectively. They all have read 0% of their file. + + We can look at a representative wedged server job: user idx 101. +___101 TCP, is blocked inside a LOAD call: NLOADD+6/ SKIPG QSFBS(A) A/ 40 +I don't entirely grok this disk code yet, but from the channel state +(%QALBK) and mode (READ/USER DATA), and the comment where he blocks, +it looks like he is waiting for the file channel to receive a buffer +with the first page of the TCPSER file. + +Also, there may also be something weird file-wise with this particular job. +Unlike the others, I think it has two (QUSR idx) channels: 17 and 40. +According to PEEK, he is also opened RAT; (no file name), which I +guess accounts for channel 17. But, huh? What? Why? + + Now, the TCP situation shows that there can be up to 180. packet +buffers, of which zero are free out of a total zero allocated. + +I checked in XBUSER and friends. +There is only one TCP frob around, and he's not doing a whole lot: +TCP index 21, which has no associated job, is in "CLSACK" for SRI-CSL. +Has received FIN for input, State is "Last ACK". +User channel state: (input) Foreign host RESET, retransmit timeout (output). +The close reason is: Closed by user, Closed by foreign host. + +This is (I think) reasonable, but does not account for all those other TCP servers! + + +1. WHAT ARE ALL THOSE NETWORK SERVER JOBS DOING WITHOUT ANY + NETWORK CONNECTIONS? Is it that the connections went away + before the jobs had a chance to get started, or what? + What are all these jobs for, anyway? + +2. WHERE DID ALL THE LOW CORE GO? + This seems to be the reason those server jobs can't get going. + +3. I heard that typein was echoing very slowly for users during this + wedged period. I wonder if this was true, it was it true for local + consoles as well as STYs? I don't really understand why this should + be, in either case. When the system is running out of core, I have + usually been able to do SYS$J (provided there was a channel for me + to .OPEN on USR:) and look around. + + +Does anybody recognize these symptoms? +(I have never tried to debug an ITS when it had not crashed at some +definite place; I am relatively new at all this.) +I have not yet looked to try to find what all the core is allocated +to. I'll do that next sitting. I'd like people's thoughts on whether +they think this is a bug, or what. I vaugely remember KLH saying +something about this; maybe he has some idea what is going on. + +Chris + + +Date: 26 October 1983 23:54 EST +From: Keith F. Lynch +Subject: Uptime +To: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC +cc: KFL @ MIT-MC + + MC is claiming to have been up for 334 days. + ...Keith + +Date: 25 October 1983 12:14 EDT +From: Christopher C. Stacy +Subject: ZUSER crash of 10/25/83 +To: BUG-ITS @ MIT-MC +cc: KMP @ MIT-MC + +In crashed ITS 1353, CRASH;ITS LZUSUE, on MIT-MC: + +The system crashed because it was trying to finish logging out +___071, who had a current inferior job with one page still in core. +It was a NAME (jname "F"), and it looks like it had just started +loading - it had an open file channel which had read 0 wds in. + +Another weird thing is that his USYSN1 was 'SUPDUP', not the same as +his reasonable USYSNM. + +That's about as far as I think I am going go with this: this info +might be useful if a similar thing ever happens again. I wonder +if it could be some kind of timing screw. + +Date: 22 October 1983 17:14 EDT +From: George J. Carrette +To: BUG-ITS @ MIT-MC + +this isn't an its bug, just something I have noticed about TCP, +both on XX and MC. Well, I can never seem to get more than about +7kbps transfer rate now, and usually get only about 3 or 4kbps +on FTP. The net used to be much faster under NCP. The price +of progress? + +Date: 21 October 1983 15:18 EDT +From: Kent M. Pitman +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC + +ITS crashed at 2:30. It was a BUGHALT, BUGPC/ 8 CAI LZUSUE R2+12 + $Q-1/ PUSHJ P, BUGNIL +I dumped this to CRASH;LZUSUE and reloaded the system. + +Date: 17 October 1983 16:42 EDT +From: Christopher C. Stacy +Subject: ARPANET<->MILNET +To: DCP @ MIT-MC +cc: BUG-ITS @ MIT-MC, JSOL @ MIT-MC +In-reply-to: Msg of 16 Oct 1983 15:39 EDT from David C. Plummer + + Date: 16 October 1983 15:39 EDT + From: David C. Plummer + To: JSOL + cc: BUG-ITS + + Date: 16 October 1983 15:12 EDT + From: Jon Solomon + + I don't know where to send this, but when you telnet from a chaos host + using either MC's or ML's gateway, it doesn't seem to allow you to + gateway to hosts which are not on Net-10. This includes LCS hosts, + MILNET hosts, and BBN-NET hosts for starters. + + This is either a host table lossage (BBNC appears to be + registered on MILNET), which I doubt, or this is the result of + the MILNET split, in which case you aren't ALLOWED to telnet from + ARPANET to MILNET. Fun, eh? + +No, TELNET and FTP are not yet administratively prohibited services +between ARPANET and MILNET. + + +Date: 17 October 1983 16:38 EDT +From: Christopher C. Stacy +Subject: TCP server doesnt work off net 10. +To: JSOL @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 16 Oct 1983 15:12 EDT from Jon Solomon + + +You didn't say what system you were using the TCP server from, or what +makes you think it is not working, and I suspect it might be on the +other end. I am not near a Lisp machine to really test this right now, +but when I halfway test it using only MC I can get a TCP connection to +ISIA (a MILNET host.) I notice the TOPS-20 TELNET program on OZ does +not let you connect to non-ARPANET hosts because its host table claims +not to know about them. I'll make more test later. + +Date: 16 Oct 1983 21:40 EDT (Sun) +Message-ID: <[MIT-OZ].MARTY.16-Oct-83 21:40:41> +From: Martin David Connor +To: Jon Solomon +Cc: BUG-SYSTEM%MIT-OZ@MIT-MC.ARPA, Staff%MIT-EECS@MIT-MC.ARPA, + Bug-ITS@MIT-MC.ARPA +Subject: bad host table +In-reply-to: Msg of 16 Oct 1983 20:29-EDT from Jon Solomon + + Date: Sunday, 16 October 1983 20:29-EDT + From: Jon Solomon + To: BUG-SYSTEM, Staff at MIT-EECS + + [EECS people: I don't know who to send this to on EE] + + Your host tables don't have the necessary changes for the MILNET + split, hence no milnet hosts can be connected to. + +Yes, in fact *any* non-arpa internet site will appear unreachable. +So I wrote a little PCL hack. +Basically, our TELNET (chaos gateway version) doesn't know how to +connect to non-internet sites unless you fool it. +So try: + + DECLARE PCL SS:ITN.PCL. + ITN + +It would be nice if we could change TELNET to forget about HOSTS2.BIN +which is what it is using, and why we are losing. +This will all be less important when we are directly connected to the +Arpanet. + +Date: Sun, 16 Oct 1983 20:27 EDT +Message-ID: <[MIT-OZ].JSOL.16-Oct-83 20:27:58> +From: Jon Solomon +To: David C. Plummer +Cc: BUG-ITS@MIT-MC.ARPA +Phase-Of-The-Moon: FQ+3D.2H.6M.14S. +In-reply-to: Msg of 16 Oct 1983 20:00-EDT from David C. Plummer + +I see, you're right. why didn't I think to check and see what was +actually being fed to MC! Now I know who to send my gripe to. + +Date: 16 October 1983 20:00 EDT +From: David C. Plummer +To: JSOL @ MIT-OZ +cc: DCP @ MIT-MC, BUG-ITS @ MIT-MC + + Date: Sun, 16 Oct 1983 16:21 EDT + From: Jon Solomon + + Fun! Yes you are allowed to telnet to MILNET hosts. MC and ML can + telnet to them directly but OZ can't. Similarly you can telnet from + ECLC (ARPANET) to ECLA (MILNET) without a problem. I think the lossage + is in the gateway program. + +Works for me. From MC: + :CHTN MCTCP BBNC 27 +connects me to BBNC. + +Date: Sun, 16 Oct 1983 16:21 EDT +Message-ID: <[MIT-OZ].JSOL.16-Oct-83 16:21:59> +From: Jon Solomon +To: David C. Plummer +Cc: BUG-ITS@MIT-MC.ARPA +Phase-Of-The-Moon: FQ+2D.22H.0M.7S. +In-reply-to: Msg of 16 Oct 1983 15:39-EDT from David C. Plummer + +Fun! Yes you are allowed to telnet to MILNET hosts. MC and ML can +telnet to them directly but OZ can't. Similarly you can telnet from +ECLC (ARPANET) to ECLA (MILNET) without a problem. I think the lossage +is in the gateway program. + +Date: 16 October 1983 15:39 EDT +From: David C. Plummer +To: JSOL @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 16 October 1983 15:12 EDT + From: Jon Solomon + + I don't know where to send this, but when you telnet from a chaos host + using either MC's or ML's gateway, it doesn't seem to allow you to + gateway to hosts which are not on Net-10. This includes LCS hosts, + MILNET hosts, and BBN-NET hosts for starters. + +This is either a host table lossage (BBNC appears to be +registered on MILNET), which I doubt, or this is the result of +the MILNET split, in which case you aren't ALLOWED to telnet from +ARPANET to MILNET. Fun, eh? + +Date: 16 October 1983 15:12 EDT +From: Jon Solomon +To: BUG-ITS @ MIT-MC + +I don't know where to send this, but when you telnet from a chaos host +using either MC's or ML's gateway, it doesn't seem to allow you to +gateway to hosts which are not on Net-10. This includes LCS hosts, +MILNET hosts, and BBN-NET hosts for starters. + +--JSol + +Date: 14 October 1983 04:46 EDT +From: Jeffrey P. Golden +To: GSB @ MIT-MC +cc: BUG-ITS @ MIT-MC, JPG @ MIT-MC + + GSB@MIT-MC 10/13/83 17:44:25 Re: MC directory slot + To: JPG at MIT-MC + CC: (BUG ITS) at MIT-MC + BACKUP; is for backup copies of things on .; and occasionally other things. +Why can't .; itself be used for this? For the couple of true backup @ files, +which have the same names as files on .; , e.g. CRASH; would work fine. +Or better, SYS; ? + + It should be preserved, and it does get updated occasionally. +The last time a file was added to MC:BACKUP; was Feb. 1982 and I believe +almost everything there is garbage. If BACKUP; were trully for backup +then leaving non-working stuff on that directory as is now the case +may be hazardous for MC's health if ever invoked. + + I believe that it has proven itself useful on ML at least. +I see no recent proof of this for MC:BACKUP; . + +Date: 13 October 1983 17:44 EDT +From: Glenn S. Burke +Subject: MC directory slot +To: JPG @ MIT-MC +cc: BUG-ITS @ MIT-MC + +BACKUP; is for backup copies of things on .; and occasionally other things. +It should be preserved, and it does get updated occasionally. I believe +that it has proven itself useful on ML at least. + +Date: 13 October 1983 16:35 EDT +From: Jeffrey P. Golden +Subject: MC directory slot +To: BUG-ITS @ MIT-MC + +Are all of you familiar with the MC:BACKUP; directory? I wonder how useful +that directory is, or has its function been largely usurped by MC:.; et al? + +Date: 13 October 1983 03:57 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I made the MLDEV/MLSLV use HOSTS3, and also fixed a minor bug +where MLDEV was comparing 36 bit network numbers as CAIN A,NW%ARP. +I bother mentioning the bug fix, because it seems to be everyone's +favorite sleepytime bug for ITS network hacking. + + +Date: 12 October 1983 20:29 EDT +From: Ken Harrenstien +Subject: [ron: ML Routing] +To: MARTY%MIT-OZ @ MIT-ML +cc: BUG-ITS @ MIT-MC + +I doubt there is a real problem. ML was probably down at the +time he tried, or the MILNET split cnfused things, or Ron was +confused. MC and ML have the same "routing" code. + +Date: 12 Oct 1983 15:23 EDT (Wed) +Message-ID: <[MIT-OZ].MARTY.12-Oct-83 15:23:24> +From: Martin David Connor +To: Bug-ITS@MIT-MC.ARPA +Subject: [ron: ML Routing] + + +Does anyone understand why this is happening + +Date: Wednesday, 12 October 1983 14:58-EDT +From: Ron Natalie +To: bug-tcp +Re: ML Routing + +I can talk to MIT-MC from our local nets but not MIT-ML. + +The nets in question are: + BRLNET 128.20 + BRLNET1 192.5.21 + BRLNET2 192.5.22 +they should be routed to your MILNET/ARPANET gateway. + +-Ron + +Date: 12 October 1983 01:48 EDT +From: Christopher C. Stacy +Subject: normal host tables! +To: BUG-ITS @ MIT-MC +cc: INFO-HOSTS @ MIT-MC + +I snarfed the latest host table from the NIC, and +installed it on ITS. + +Date: 12 October 1983 01:37 EDT +From: Christopher C. Stacy +Subject: new host table +To: BUG-ITS @ MIT-MC, BUG-MAIL @ MIT-MC +cc: GSB @ MIT-MC, TK @ MIT-MC, ELLEN @ MIT-MC, DCLARK @ MIT-MC, + JIS @ MIT-MC, KMP @ MIT-MC, TAFT @ MIT-MC + + +The latest NIC:SPLIT-HOSTS.TXT file, dated 11 October 83, has +MIT-MC back on the ARPAnet ("HOST : 10.3.0.44 : MIT-MC,MC :"). +I think this means things have finally been set aright. + + +Date: 8 October 1983 05:28 EDT +From: Christopher C. Stacy +Subject: source write lock removed +To: BUG-ITS @ MIT-MC + + + +Date: 7 October 1983 20:34 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +I JFCLd out the only-ARPANET patch I made a little while ago +in the running system on MC. For one thing, no hosts know +we are here on the ARPAnet, so we arent likely to get much +unwanted traffic except from TAC users. + +Date: 7 October 1983 19:05 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +At this moment, MC has the split host table which has itself on +net 10. I just typed in a patch to make it refuse to connect +to/from nets other than the ARPANET, though, to prevent lots +of MILNET packets from being generated by unauthorized users. +This isn't optimal; I'll frob it some more later tonite. + +Date: Friday, 7 October 1983, 05:43-EDT +From: Christopher C. Stacy +Subject: INQUIR +To: BUG-ITS at MIT-MC, BUG-INQUIR at MIT-MC +Cc: GSB at MIT-MC, ELLEN at MIT-MC, KMP at MIT-MC + + +I changed over all the INQUIR groups tonite, and installed new INQUIR +and LSRPRT versions. I put up a messsage urging people to check to +make sure their entry looks right. I used an editied version of +ELLEN;PLASMA to find the PFC people, who have a new special group. + +I tried to make it preserve directory assignments, but it may have +slightly confused people who are in the USERSi dirs on ML, since I +forgot to make then specify the machine. I don't expect this to be a +problem in most cases though. + +Chris + +Date: 6 Oct 1983 08:13 EDT (Thu) +Message-ID: <[MIT-OZ].IAN. 6-Oct-83 08:13:06> +From: Ian Macky +To: Bug-ITS@MIT-ML + + +[PHOTO: Recording initiated Thu 6-Oct-83 8:11AM] + + TOPS-20 Command Processor 5(742)-2 + [Commands] +!f @nic +[SRI-NIC via MIT-MC] +%No response +[SRI-NIC via MIT-ML] +? Internal error - DEVICE NOT ASSIGNABLE TO THIS PROCESSOR + +%No path to site +!pop + +[PHOTO: Recording terminated Thu 6-Oct-83 8:12AM] + +Date: Thursday, 6 October 1983, 02:54-EDT +From: Christopher C. Stacy +Subject: inconsistant sources available +To: BUG-ITS at MC + + +ITS is being hacked. If you arent KLH or myself, don't bother trying +to assemble and run it. + + +Date: 5 October 1983 02:24 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-ML +cc: TK @ MIT-ML + +ML has a version of ITS which does routing to the MILNET. +The HOSTS3 bin file there is speciall hacked up. +People should not install ITS host tables until further notice. + +MC is off the Internet, since it is connected to MILNET +and it cannot deal with this. (I consulted KLH about one +of us fixing this, so that MC could be on the MILNET, but +he agrees it is too much dangerous trouble for what should +be a very temporary situation.) + +MC and ML can talk to each other over the Chaosnet, of course. + +Date: 4 October 1983 23:50 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: GSB @ MIT-MC + + +ML needs a new special host table, and a new ITS version. +I'll take care of this tomorrow. + +Date: 4 October 1983 05:40 EDT +From: Pandora B. Berman +Subject: Batch processing +To: Ian @ MIT-OZ +cc: MAGIC-DRAGON-KEEPER @ MIT-ML, ALAN @ MIT-MC, BUG-ITS @ MIT-MC, + MAGIC-DRAGON-KEEPER @ MIT-MC + + Date: 4 Oct 1983 02:32 EDT (Tue) + From: Ian Macky + To: Alan Bawden + Cc: BUG-ITS@MIT-MC, MAGIC-DRAGON-KEEPER@MIT-MC, Magic-Dragon-Keeper@MIT-ML + Subject: Batch processing + In-reply-to: Msg of 4 Oct 1983 02:22-EDT from Alan Bawden + In case noone noticed, OZ has been sending Happy Birthday messages + for months... + +oh, we noticed (could hardly miss doing so). but that's only for OZ +users. there are other people in the world.. + +Date: 4 Oct 1983 02:32 EDT (Tue) +Message-ID: <[MIT-OZ].IAN. 4-Oct-83 02:32:38> +From: Ian Macky +To: Alan Bawden +Cc: BUG-ITS@MIT-MC, MAGIC-DRAGON-KEEPER@MIT-MC, Magic-Dragon-Keeper@MIT-ML +Subject: Batch processing +In-reply-to: Msg of 4 Oct 1983 02:22-EDT from Alan Bawden + +In case noone noticed, OZ has been sending Happy Birthday messages +for months... + +Date: 4 October 1983 02:22 EDT +From: Alan Bawden +Subject: Batch processing +To: BUG-ITS @ MIT-MC, MAGIC-DRAGON-KEEPER @ MIT-MC, + Magic-Dragon-Keeper @ MIT-ML + +In the latest version of Puff the Magic Dragon (installed on MC, not ML +yet) I have generalized the feature where once an hour Puff would look for +the files DRAGON;HOURLY RAYGUN and HOURLY TMPKIL and load and run them. +Puff now will load ANY file on DRAGON; whose first file name is HOURLY and +try to load it into a job and run it. While I was at it I made it check +for files named DAILY, MNTHLY and YEARLY as well. (They are run at the end +of the day, month and year, when Puff is cleaning his own house.) + +I nominate CStacy to write DRAGON;DAILY BTHDAY to replace poor DM's +cheerful birthday greetings. + +There seems to have been some misimpression that Puff was ALREADY doing +this. + +Date: 3 October 1983 08:10 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +What finaly wound up sending out happy birthday announcements on ITS? + +Date: 1 October 1983 22:07 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +Latest ITS (installed on MC) has the MILNET gateway in it +so that forwarding will happen after the split. I will +install this on ML later tonite or tomorrow. + +Date: 30 September 1983 22:57 EDT +From: Keith F. Lynch +To: CSTACY @ MIT-MC, BUG-ITS @ MIT-MC +cc: KFL @ MIT-MC + + 9 users, fair share = 109% ? + ...Keith + +CENT@MIT-ML 09/27/83 01:10:11 Re: dm +To: (BUG ITS) at MIT-ML +i removed *DM from the ML system msg lists. someone had already done +this on MC.. + +Date: 26 September 1983 21:33 EDT +From: George J. Carrette +To: BUG-ITS @ MIT-MC + +SRI-IU must have a bad address or something in the version of the host +table we have. + +Date: 25 September 1983 01:02 EDT +From: Glenn S. Burke +To: KLH @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 23 September 1983 02:27 EDT + From: Ken Harrenstien + Sender: KLH1 @ MIT-MC + + Patched MC (running sys & disk) at TCLK30+10/ CAILE D,556. + Fix made in source but not assembled. ML not patched but eventually + ought to be. + +Patched in the binary and the running system (it's been up 10 days!) + +Date: 24 September 1983 22:13 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I merged DM:SYSENG; onto the MC SYSENx dirs. + +Date: Saturday, 24 September 1983, 17:19-EDT +From: Christopher C. Stacy +Subject: DM +To: BUG-INQUIR at MIT-MC, BUG-ITS at MIT-MC + +I diked DM out of INQUIR. + +Date: 23 September 1983 06:00 EDT +From: Christopher C. Stacy +Subject: ITS software on DM +To: BUG-ITS @ MIT-MC +cc: BUG-RANDOM-PROGRAM @ MIT-MC, TAA @ MIT-DMS, PDL @ MIT-DMS, + SWG @ MIT-DMS, Moon @ SCRC-TENEX + + +I have snarfed the interesting things in DM:SYSENG; to a place on MC, +and will be making sure we have everything from that directory. Are +there any other interesting programs or systems (MIDAS or otherwise) +we really should have on MC hiding out there? I bet there are, but +I don't know where. + + +Date: 23 September 1983 02:27 EDT +From: Ken Harrenstien +Sender: KLH1 @ MIT-MC +To: BUG-ITS @ MIT-MC + +Patched MC (running sys & disk) at TCLK30+10/ CAILE D,556. +Fix made in source but not assembled. ML not patched but eventually +ought to be. + +Date: 16 September 1983 00:53 EDT +From: Joseph A. Kay +To: BUG-ITS @ MIT-MC + +At 00:10:25 ,16-sept-83, the LA-36 typed out 20 times: +( at MC):"LOGIN 542A02 0 HST205 " followed by the times (1 second apart). +there was one intervening line from chaos, in their midst, after which +some lines had 542A11 instead of 542A02. +The same thing happened again 1 minute later with ~50 lines in a row,mostly +"LOGIN 542A11 0 HST205" with times in two consecutive sequences (a 9 second +gap between the sequences,1-second or less inside them). Occasionally +lines had 542A12. +At 00:35,there were 10 lines with times in 13-second span, saying: +"LOGIN 030A16 0 HST017"... +---- +--this may point out a problem, possibly elsewhere; or may help diagnose +a future difficulty. I am not sure of its significance, but I hope it can +be of help to you. + +Date: Monday, September 12, 1983 5:40AM-EDT +From: Christopher Stacy +Subject: TOPS-20 usage of "TCP" protocol +To: BUG-OZ +CC: BUG-ITS at MIT-MC + +Programs which gateway through the TCP byte-stream gateways (ie., the +"ARPA" CHAOSnet protocol, currently served only by ITS hosts on both +nets), they should tell what sort of gatewaying is going on. + +Users cannot tell how they are getting from point A to point B - all +they see is a virtual network where everything is magically connected +by various secret means. If they were told what means was being +employed to connect them with remote hosts on other networks, they +would stand a chance of figuring out what was losing when the +"gateway" did not work. + +BTW, probably the CHAOSNET "TCP" protocol user to get a byte stream +should be made an available (optionally included, requires CHAOS +support routines) call in the NETWRK packages (on all systems). It +could take remote host address and port, and an AOBJN-style pointer to +a table of gateway server addresses. When the DEC interface for IP +comes out, and NETWRK will need rewriting anyway, would be a good time +to do this. + +Chris + +Date: 10 September 1983 06:35 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +ITS had the date wrong for a few minutes today while it was being +debuggged, so a few files might have the wrong day (not too far +off) on them. (Since only one or two people were on during +this time, it should not be a real problem..this message is just FYI.) + +Date: Friday, 9 September 1983, 15:43-EDT +From: Christopher C. Stacy +Subject: FILE bug +To: BUG-ITS at MC + + +In Release 4.4, site configuration 62, on Lisp Machine Apiary-6: + + >>Error: File system bug on host MIT-MC: + CHANNEL NOT OPEN + CHNL NOT OPEN + For MC: AR2: CSTACY; .FILE. (DIR) + While in the function (DEFUN-METHOD FS:FILE-PROCESS-ASYNC-MARK)  (DEFUN-METHOD FS:FILE-NEXT-READ-PKT)  (METHOD FS:FILE-INPUT-STREAM-MIXIN GET-NEXT-INPUT-PKT) + + (DEFUN-METHOD FS:FILE-PROCESS-ASYNC-MARK): (P.C. = 20) + Arg 0 (SELF): # + Arg 1 (SELF-MAPPING-TABLE): # + Arg 2 (PKT): # + Local 3 (STRING): "I1696 ERROR BUG R CHANNEL NOT OPEN + CHNL NOT OPEN + " + . + . + . +ZWEI:VIEW-WINDOW-DISPLAY: (P.C. = 44) + Arg 0 (ZWEI-WINDOW): # + Arg 1 (STREAM): # + Arg 2 (FORCE-P): T + +Date: 9 September 1983 15:14 EDT +From: Kent M. Pitman +To: BUG-MINITS @ MIT-MC, BUG-ITS @ MIT-MC + +Echo response time to ddt and mail and such is very slow +on ITS today. It was like this sometime very recently, too. +I'm coming in from HUB8A. Anyone got any ideas what might +be so draggy? I get multi-second delays doing simple +input and the fair share is 44%. + +Date: 15 Aug 1983 00:43 EDT (Mon) +Message-ID: <[MIT-OZ].GUMBY.15-Aug-83 00:43:28> +From: David Vinayak Wallace +To: SHAWN@MIT-ML +Cc: Bug-its@MIT-OZ +Subject: monmode bug(?) +In-reply-to: Msg of 13 Aug 1983 23:02-EDT from SHAWN at MIT-ML + + Date: Saturday, 13 August 1983 23:02-EDT + From: SHAWN at MIT-ML + + Is the fact that when you have 'prmmch' set, (printing machine name), + and are in monmode, (for example 'ML: '), and you type "clear", when + it goes to the top of your screen, it only prints the ':' not the 'ML:'. + Is this a bug??? (If not, is there any reason for it other then that's + how someone liked it?), Thanks. + + +You'll notice that ^L will never reprint the prompt. It will echo +whatever pending typing exists (in this case a ":"). This has nothing +to do with either :MONMOD or PRMMCH. + +Date: 14 August 1983 18:06 EDT +From: Christopher C. Stacy +Subject: new ITS version, install at leisure. +To: BUG-ITS @ MIT-MC + + +ITS 1351 changes .SHUTDN to not allow shutdowns further away than 30 days, +and fixes some SYSJOB code which would have broken under certain assembly +conditionals. I'll install it around eventually; nothing very interesting in here. + +(The .SHUTDN restriction is due to delta-t being computed wrong for the DEDBLK +clock queue list entry; this would crash the system.) + + +GSB@MIT-ML 08/13/83 23:30:28 Re: c100 inschar lossage +To: (BUG ITS) at MIT-ML +Multiple insert-characters never ever ever succeed in outputting the +null in the sequence which is what turns off insert-character mode, +on anything but the first. This is what i presume is an insert-char +operation with an argument, which comes in over a supdup. + +I have seen this lossage locally in what i presume are only single +insert-character operations, but it cannot be reliably reproduced then. +However multiple insert-char sequence coming from (say) emacs on OZ +reliably produce the null for the first and none of the others. + + +SHAWN@MIT-ML 08/13/83 23:02:36 Re: monmode bug(?) +To: (BUG its) at MIT-MC + +Is the fact that when you have 'prmmch' set, (printing machine name), +and are in monmode, (for example 'ML: '), and you type "clear", when +it goes to the top of your screen, it only prints the ':' not the 'ML:'. +Is this a bug??? (If not, is there any reason for it other then that's +how someone liked it?), Thanks. + + Yours In Hacking, + -Shawn + + +Date: 11 August 1983 23:49 EDT +From: V. Ellen Golden +Subject: console decwriter keyboard stops working +To: Moon @ SCRC-TENEX +cc: CSTACY @ MIT-MC, ELLEN @ MIT-MC, BUG-ITS @ MIT-MC + +DEC appears to have fixed this problem (??!!!) when they PM'd +the machine, which was down due to precisely this situation when +they arrived... so I guess it is working..... + +Received: from SCRC-YAMASKA by SCRC-TENEX with CHAOS; Thu 11-Aug-83 17:55:06-EDT +Date: Thursday, 11 August 1983, 17:48-EDT +From: David A. Moon +Subject: console decwriter keyboard stops working +To: Christopher C. Stacy +Cc: ELLEN@MIT-MC, BUG-ITS@MIT-MC +In-reply-to: The message of 6 Aug 83 10:38-EDT from Christopher C. Stacy + + Date: 6 August 1983 10:38 EDT + From: Christopher C. Stacy + Please get someone to look at MC's console typewriter. + It frequently gets into this mode where the keyboard + does not work at all, and nothing can be typed. +Isn't there some DEC braindamage where this is caused by the cover +not being quite closed all the way, and/or the thing thinking it +is out of paper? Or is that some other model of decwriter? + +Received: from SCRC-YAMASKA by SCRC-TENEX with CHAOS; Thu 11-Aug-83 17:51:25-EDT +Date: Thursday, 11 August 1983, 17:45-EDT +From: David A. Moon +Subject: DM frotzed +To: Christopher C. Stacy +Cc: BUG-ITS@MIT-MC +In-reply-to: The message of 8 Aug 83 03:31-EDT from Christopher C. Stacy + + Date: 8 August 1983 03:31 EDT + From: Christopher C. Stacy + I just noticed DM had crashed a while back (with no error + messages or anything, and questionable state in the console). + So I tried to reboot it. DSKDMP says the MFD is clobberred. +There's a copy of the MFD on each drive and sometimes this message +means that the disk controller or channel is broken or the processor +is broken (what it really means is that dskdmp tried to read the mfd +and either got a disk error or some checkword in it didn't have the +right value). + +Date: 8 August 1983 03:31 EDT +From: Christopher C. Stacy +Subject: DM frotzed +To: BUG-ITS @ MIT-MC + +I just noticed DM had crashed a while back (with no error +messages or anything, and questionable state in the console). +So I tried to reboot it. DSKDMP says the MFD is clobberred. +If there is a 9-track MAGDMP format tape for it, I will try +to fix this, if anyone cares. If it cannot be fixed of +course, someone will have to reload the file system. +Should I look at it? + +Date: Sunday, 7 August 1983, 10:17-EDT +From: Christopher C. Stacy +To: BUG-ITS at MIT-MC +Cc: KMP at MIT-MC, ELLEN at MIT-MC, JPG at MIT-MC +In-reply-to: The message of 6 Aug 83 00:23-EDT from Kent M. Pitman + +In crashed ITS 1348 in CRASH;LUUOEX, on MIT-MC: + +The routine which builds Internet datagram headers was smashed +somehow. IPKHDR+3 (64012), normally a MOVEM, is zero (which of +course looks like a UUO). + +Also, I am not sure exactly what this implies, but if you look at the +"M" display in PEEK, it complains about not being able to trace some +memory pointers ("Bad mem ptr data for 979 pages!"). + +Anyone else want to look at this dump further? +If not I'll delete it in a few days. + +Date: 6 August 1983 10:38 EDT +From: Christopher C. Stacy +To: ELLEN @ MIT-MC +cc: BUG-ITS @ MIT-MC + +Please get someone to look at MC's console typewriter. +It frequently gets into this mode where the keyboard +does not work at all, and nothing can be typed. +Being the console tty, this typically goes unnoticed +until the system needs to be reloaded or something, sigh. + +Date: 6 August 1983 00:23 EDT +From: Kent M. Pitman +To: BUG-ITS @ MIT-MC +cc: ELLEN @ MIT-MC, JPG @ MIT-MC + +MC crashed with the message: + MUUO in Exec Mode, PC = 304000,,64013 + PI Level 7 BugHalt + BUGPC/ LUUOEX + Q-1/ JSR BUGAWF + +It had been down for an hour and a half, and there were no wizards in sight, +so I dumped it to CRASH;LUUOEX and I reloaded the machine. I made an entry +in the log book to this effect. +--kmp + +Date: 5 August 1983 00:25 EDT +From: Zippy the Pinhead +To: BUG-ITS @ MIT-MC + + + +From evan Fri Jul 1 23:34:10 1983 +To: sys-bozos@cogs +Subject: So I had this dream... + + + The earth was going to be destroyed: there were these aliens +who were going to eradicate all life on earth real soon so they could +use it for themselves. There were two different castes of these aliens: +A variety which resembled Dean Bob Randolph, and type which looked like +Don Saklad. I addition to being about to kill everyone, these aliens had +the additional bad feature of being obnoxious. The Dean Bob aliens were +wandering around telling everyone that it was really best for us to be +extermiated and that, in time, we would come to understand that the earth +wasn't right for us. The Saklad aliens were bothering everyone with +stupid questions about how to use the earth and the things on it. + + I was rather upset by the impending demise of EVERYBODY, but I +discovered that we had been visited year earlier by friendly aliens, who +had left us with a planetary defense system which would protect us from +the nasty aliens. Unfortunately, these aliens had been here several +years ago, and they had wired the defense system into the guts of the +AI-10! In order to activate the defense system, you had to boot AI and +log in as RMS, then type ":defend". + + The rest of the dream consisted of wandering around Tech Square +trying to get someone to give me a Lisp-Machine memory card so that I +could save all life on earth. No one would give me one. They all had +important things to do with them. So I went from office to office trying +to convince someone to help, and every time I rode the elevator, I was +accosted by a Saklad alien asking some question like: "What is this +water stuff and what do we do with it? Is it documented?" + + Then the phone rang and I woke up. Thank Heaven... + + + ---Evan + + +Date: 5 August 1983 00:20 EDT +From: Herb Lin +Subject: tapes... +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 4 Aug 1983 23:42-EDT from Christopher C. Stacy + +tnx. + +Date: Thursday, 4 August 1983, 23:42-EDT +From: Christopher C. Stacy +Subject: tapes... +To: Herb Lin +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 4 Aug 83 23:05-EDT from Herb Lin + +You can read tapes between AI,ML, and MC. (DM has nine-track drives.) +Just use LOAD command of DUMP as usual. I hear that due to drive +alignment, the most successful place to read AI tapes is on ML. + +Also, there is a command in DUMP to read the backup directories from +AI if they are re-loaded to disk someplace. + +Date: 4 August 1983 23:05 EDT +From: Herb Lin +Subject: tapes... +To: BUG-ITS @ MIT-MC + +this is addressed to system wizards - does anyone know if tapes written on +the old AI machine can be read onto MC? If so, how can I do it... + +tnx. + +Received: from SCRC-BEAGLE by SCRC-TENEX with CHAOS; Sun 31-Jul-83 20:52:18-EDT +Date: Sunday, 31 July 1983, 20:50-EDT +From: David A. Moon +Subject: MC crashes +To: Christopher C. Stacy +Cc: TAFT@MIT-MC, ELLEN@MIT-MC, BUG-ITS@MIT-MC +In-reply-to: The message of 30 Jul 83 19:36-EDT from Christopher C. Stacy + +Somewhere on those scribbled-all-over pieces of paper attached +to the machine it says how to get some information when it seems +to be hung. There's a KLDCP command with some name I don't +remember ("ALL" maybe) that prints a bunch of stuff, and a command +file (J KLHUNG I think) that prints about three pages of stuff. +Most of the three pages is useless, but buried in there are the +micro and macro PCs and various error status bits. Somewhere unless +some idiot has thrown it away there is a notebook containing the +KLDCP commands, including how to get the current interrupt level +and other things like that that are in the lights on KAs. I have +no idea any more what the names of the commands were. Presumably +all the information it is possible to get is in the KLHUNG output +somewhere. + +There should be a microcode listing on-line in the UCODE directory +in which you can look up micro PCs. They appear embedded in some +syntax in the left margin, maybe "U nnnnn," or something like that. + +Microcode hung really means that some timeout inside of KLDCP went +off, I believe, and doesn't really directly imply anything about +the microcode. I think I have seen this caused by main memory +parity errors sometimes. + +"ITS IS DOWN" means that a keep-alive counter incremented by the +60-cycle clock interrupt handler is not being incremented, at least as +far as the pdp11 you are typing to (whichever of the two it is) thinks. +ITS could be halted, looping at interrupt level, not taking interrupts +because the interrupt hardware, I/O bus, or clock is broken, not +running because the processor is broken, or working but not talking to +the pdp11 because the interface is broken. + +The page-fault-in-system obviously should be investigated to see whether +there was a reference to a wrong address, or a page fault on a good +address, or code was clobbered, or the machine wasn't executing instructions +correctly, or whatever. This one could easily be a software bug, so +keep that in mind. + +Someone should delete the useless crash dump Taft made after a J NTSDDT. + +Date: 30 July 1983 19:36 EDT +From: Christopher C. Stacy +Subject: MC crashes +To: Moon @ SCRC-TENEX +cc: TAFT @ MIT-MC, ELLEN @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 07/30/83 16:24:06 from TAFT + + +Dave, + +I know you are real busy over there, but if you get a second could you +please shed any light you have on this? It's pretty much beyond me. + + + Date: 07/30/83 16:24:06 + From: TAFT + To: CSTACY + cc: ELLEN + Re: MC crash + + MC crashed twice this afternoon. The first time was with a + microcode hung, but the second time the lights were just dead and + there was no message whatsoever on the console. + + I tried to take a dump of this, but I am not sure that I got it + right. I hit BREAK on the console, did a "J NTSDDT" and then did: + $Y CRASH;NO MSG + It seems to have tried writing out a dump, but perhaps this was + the wrong way to get into DDT ? (It appeared to load a new one ?) + Anyway I left the dump in CRASH;NO MSG, maybe someone wants to + look at it. Otherwise it should be deleted. + Jon + +The command "DDT" will get you into the current DDT. J NTSDDT runs a +command file which resets some things and loads up a fresh DDT. I +don't remember if it clobbers the KL10 state, but I think it does. + +Something is very wrong with MC. It has the following three problems, +sometimes several times a day: + + o Microcode hung. + Maybe this is not new, maybe it is a known expected ITS bug??? + Is that why it has never been looked into? + + o Machine appears halted, typing on hardware ttys gets ITS IS DOWN, + no messages on console. + I guess this acts this way because the machine has either gone into a + super tight loop (on the order of JRST .), or the microcode is off + in never-never land and some instruction never returns. Maybe one + thing to do is StoP the machine and look at the PC - I didn't yet. + If the machine were really halted, I think the console-11 would say so. + The IO-11 times out doing some protocol to ITS instead, and + prints ITS IS DOWN. + + o ITS crashes with PAGE FAULT IN SYSTEM at the exact same address. + +Chris + +Date: 28 July 1983 04:33 EDT +From: Christopher C. Stacy +Subject: CFTPing from ITS +To: MARTY @ MIT-OZ +cc: BUG-ITS @ MIT-MC, BUG-FILE @ MIT-OZ, kmp @ MIT-OZ +In-reply-to: Msg of Jul 28 1983 3:19AM-EDT from Martin David Connor + + Date: Thursday, July 28, 1983 3:19AM-EDT + From: Martin David Connor + To: bug-its, bug-file at MIT-OZ + Re: CFTPing from ITS + I now find that supplying a non-existent username to LOGIN + when CFTPing to MC or ML now hangs indefinitely. + I discovered this when running a batch job that CFTPs and + logs in as OZHOST. + This used to work. Was there a change to the file server on MC? + + + +In FILE 520, ITS 1438, on MIT-MC: + +KMP and I saw this too, but thought we might be imagining something. +Someone had broken FILE after version 518 by forgetting that on ITS, +ASCII byte pointers must be explicit (440700) and cannot be set up +with HRROI. It was MPVing because of this in COMST0 when called from +the stuff around GETNAM. Fixed in the source and installed on the ITS +systems. + +Date: Thursday, July 28, 1983 3:19AM-EDT +From: Martin David Connor +Subject: CFTPing from ITS +To: bug-its at MIT-MC, bug-file at MIT-OZ + + +I now find that supplying a non-existent username to LOGIN +when CFTPing to MC or ML now hangs indefinitely. +I discovered this when running a batch job that CFTPs and +logs in as OZHOST. + +This used to work. Was there a change to the file server on MC? + + +Date: 12 July 1983 01:32 EDT +From: Ed Schwalenberg +To: BUG-ARCDEV @ MIT-MC, BUG-ITS @ MIT-MC +cc: BIL @ MIT-MC + +BIL's first problem comes from the archive device handler running out +of room to fit the archive (archives can only hold about 170. blocks of stuff.) +The archive device should report DEVICE FULL rather than seeming to win and +producing 0-length files. Secondly, file creation dates are randomly munged, +off by an hour or so. Thirdly, as we all know, the archive device needs to be +done right for a change. + +Date: 12 July 1983 00:20 EDT +From: William G. Dubuque +Sender: BIL @ MIT-MC +To: BUG-ITS @ MIT-MC + +:MOVE ,AR0:RAT; produces a file of length 0 on AR0. Unfortunately +i got screwed and moved a few unbackedup files there before noticing this. +If you list the archive you will notice a few 0 length files there where +this happened. All other files were :MOVEd there previously without such +lossage. Is there a new DDT or ARCDEV or somesuch at the heart of this? +Is there any way of getting around this (I want to preserve the creation +date so :COPY wont do)? + +Date: 3 Jul 1983 21:32 EDT (Sun) +From: Ian Macky +To: Alan Bawden +Cc: BUG-ARGUS@MIT-MC, BUG-ITS@MIT-MC, CSTACY@MIT-MC +Subject: Artificial Intuition? +In-reply-to: Msg of 3 Jul 1983 15:57-EDT from Alan Bawden + + +The source for ARGUS I found on MC was very very old, and is +pretty grim stuff (having been written before I had any idea +what I was doing)... I dunno where a more recent one is; I'll +keep looking. + +Date: 3 July 1983 15:57 EDT +From: Alan Bawden +Subject: Artificial Intuition? +To: CSTACY @ MIT-MC +cc: BUG-ARGUS @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 3 Jul 1983 09:44 EDT from Christopher C. Stacy + + Date: 3 July 1983 09:44 EDT + From: Christopher C. Stacy + This is CSTACY. I sat down at DEVON's console here just now, where + DEVON had a disowned ARGUS looking for any CSTACY's. I started up an + EMACS to look at something. I am sure you can imagine my surprise + when I saw: [Here is CSTACY]. + + Startled, I ^Zd out of the EMACS I took my hands off the keyboard. + Ever dutiful, ARGUS barked: [There goes CSTACY]. + I suppose this bug has something to do with my having typed CSTACY$^S + before running the EMACS. If it does not, congratulations! + +'Tain't a bug in my opinion. + +Had always presumed that ARGUS did this by looking at all the XUNAME's in +the system, but looking at the source it looks like it just reads TTY. +Wierd! + +Date: 3 July 1983 09:44 EDT +From: Christopher C. Stacy +Sender: DEVON @ MIT-MC +Subject: Artificial Intuition? +To: BUG-ARGUS @ MIT-MC +cc: BUG-ITS @ MIT-MC + + +This is CSTACY. I sat down at DEVON's console here just now, where +DEVON had a disowned ARGUS looking for any CSTACY's. I started up an +EMACS to look at something. I am sure you can imagine my surprise +when I saw: [Here is CSTACY]. + +Startled, I ^Zd out of the EMACS I took my hands off the keyboard. +Ever dutiful, ARGUS barked: [There goes CSTACY]. +I suppose this bug has something to do with my having typed CSTACY$^S +before running the EMACS. If it does not, congratulations! + + +SHAWN@MIT-ML 06/29/83 21:42:38 Re: wish list +To: (BUG ITS) at MIT-ML + +I *WISH* ITS had a UNIX(tm) type GREP command. + + -Shawn + +Date: 29 June 1983 17:19 EDT +From: Alan Bawden +Subject: CORBLK and .ACCESS interaction. +To: BUG-ITS @ MIT-MC + +Here is a minimal case of some lossy interaction between CORBLKing and +.ACCESSing the same file: + + .call [setz ? sixbit /open/ ? [.uii,,dsk] ? [sixbit /dsk/] + [sixbit /names/] ? [sixbit />/] ? setz [sixbit /.mail./]] + .lose %lsfil + ;;These next two are not necessary for the misbehavior, but help to + ;;make it more obvious later: + .access dsk,[100] + .iot dsk,a + .access dsk,[2000] + .iot dsk,b + .access dsk,[0] + .call [setz ? sixbit /corblk/ ? movei %cbndr ? movei %jself + movei 7 ? setzi dsk] + .lose %lssys + .access dsk,[100] + .iot dsk,b + +At the end of this sequence, A and B should obviously contain the same +thing, but they don't. Typically B will get the contents of location 2100, +rather than 100. It is not important what file you use, I just chose +.MAIL.;NAMES > out of randomness. + +Date: 21 June 1983 09:01 EDT +From: David C. Plummer +Subject: cli interrupts and emacs +To: PGS @ MIT-OZ +cc: KMP @ MIT-MC, BUG-ITS @ MIT-MC, BUG-EMACS @ MIT-MC + + Date: Tuesday, 21 June 1983, 04:23-EDT + From: Patrick Sobalvarro + + I guess I'm a loser. I do use MODLIN. +So am I, and so do I. I'd like to be a winner who uses MODLIN, though. + +Date: Tuesday, 21 June 1983, 04:30-EDT +From: Patrick Sobalvarro +To: HAA@MIT-MC, BUG-ITS@MIT-MC +In-reply-to: The message of 2 Jun 83 21:27-EDT from Herschell A. Andrews + + Date: 2 June 1983 21:27 EDT + From: Herschell A. Andrews + To: BUG-ITSTTY + + Does anyone know why my vt52 emuator suddenly started losing? It works + fine on cmuc but loses bad on ITS. My software tty doesn't work either. + Has something changed? + +I tried running a vt52 connected directly to MC and had no trouble; I'd say the +trouble is probably in your emulator. Or have you figured the problem out +already? + +Date: Tuesday, 21 June 1983, 04:23-EDT +From: Patrick Sobalvarro +Subject: cli interrupts and emacs +To: KMP@MIT-MC +CC: BUG-ITS@MIT-MC, BUG-EMACS@MIT-MC +In-reply-to: The message of 21 Jun 83 04:05-EDT from Kent M. Pitman + + Date: 21 June 1983 04:05 EDT + From: Kent M. Pitman + + Do you use the MODLIN library? (For reasons I have never traced down, having + this loaded seems to defeat Emacs' ability to recognize the tty having been + potentially munged by superior typeout.) If you don't use the MODLIN library, + perhaps you are a new data point. + +I guess I'm a loser (not a new data point, ha ha). +I do use MODLIN. + +Date: 21 June 1983 04:05 EDT +From: Kent M. Pitman +Sender: ___004 @ MIT-MC +Subject: cli interrupts and emacs +To: PGS @ MIT-MC +cc: BUG-ITS @ MIT-MC, BUG-EMACS @ MIT-MC + +Do you use the MODLIN library? (For reasons I have never traced down, having +this loaded seems to defeat Emacs' ability to recognize the tty having been +potentially munged by superior typeout.) If you don't use the MODLIN library, +perhaps you are a new data point. + +Date: 21 June 1983 03:58 EDT +From: Alan Bawden +Subject: cli interrupts and emacs +To: PGS @ MIT-MC +cc: BUG-EMACS @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 21 Jun 1983 01:27 EDT from Patrick G. Sobalvarro + + Date: 21 June 1983 01:27 EDT + From: Patrick G. Sobalvarro + Correct me if I'm wrong, but once upon a time I seem to remember having + Emacs uderstand that I'd gotten my screen bashed and redisplay it after a + CLI interrupt as soon as I typed a character. This was a nice feature, + something Twenex emacs couldn't do because of the way tty messages work + there. Well, it doesn't work anymore. After a CLI interrupt, when I + type characters, my Emacs doesn't redisplay at all. It doesn't do anything + until I type something like ^L, which is an ECHOIN break character. Is + ECHOIN broken? + +CStacy has complained of something like this in the past. DCP, I believe, +claimed to have seen this too. I have never seen it. Is it reproducable? + +(I don't see how ECHOIN can itself be at fault, this works by having Emacs +enable %PIATY interrupts, but perhaps emacs does does something bogus when +it finds that this interrupt occured during an ECHOIN. I am pretty sure I +have tested that case trying to reproduce this lossage, but I have never +seen it fail... I just tried to find the source of TECO, but I couldn't, I +wonder where it is?) + +Date: 21 June 1983 01:27 EDT +From: Patrick G. Sobalvarro +Subject: cli interrupts and emacs +To: BUG-ITS @ MIT-MC, BUG-EMACS @ MIT-MC + +Correct me if I'm wrong, but once upon a time I seem to remember having +Emacs uderstand that I'd gotten my screen bashed and redisplay it after a +CLI interrupt as soon as I typed a character. This was a nice feature, +something Twenex emacs couldn't do because of the way tty messages work +there. Well, it doesn't work anymore. After a CLI interrupt, when I +type characters, my Emacs doesn't redisplay at all. It doesn't do anything +until I type something like ^L, which is an ECHOIN break character. Is +ECHOIN broken? + +Date: 11 June 1983 04:19 EDT +From: Pandora B. Berman +Subject: DUMP +To: CSTACY @ MIT-MC +cc: PGS @ MIT-ML, BUG-ITS @ MIT-MC, Moon @ SCRC-TENEX + +i have in hand the relevant tapes from ai's last full dump. i expect to +load the .tape files onto ml one dir at a time and then move them to dm. +then i'll deal with the updates from the various incr. dump tapes after +last august. chris, i will let you know when the dirs from the full +dump are in place; that should be good enough for testing.. + +Date: 10 June 1983 17:40 EDT +From: Glenn S. Burke +Subject: DUMP +To: Moon @ SCRC-TENEX +cc: CSTACY @ MIT-MC, PGS @ MIT-MC, CENT @ MIT-MC, BUG-ITS @ MIT-MC + +The issue was disk space. I had been aware of the tape drive incompatibility +when i suggested DM. People will just have to run the FIND and do the +loading on different machines. + + +Date: 10 June 1983 02:59 EDT +From: Christopher C. Stacy +Subject: DUMP +To: Moon @ SCRC-TENEX +cc: PGS @ MIT-MC, CENT @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 10 Jun 1983 02:26-EDT from David A. Moon + + + Date: Friday, 10 June 1983, 02:26-EDT + From: David A. Moon + To: Christopher C. Stacy + cc: PGS, CENT, BUG-ITS + Re: DUMP + + Date: 7 June 1983 14:01 EDT + From: Christopher C. Stacy + I have put a new command into DUMP. + DFIND does a find for a deceased ITS. + If someone reloads the .TAPEn; directories from AI + onto DM, I will test it and you should be in business. + The directories should be named %TAPEn; instead of .TAPEn;. + + But AI's tape drive was 7-track and DM's is 9-track. So DM can't read AI's tapes. + +Which machine they go on is just a variable in DUMP. +The people who wanted this had picked DM, probably due to the +number of free UFD slots... + +Received: from SCRC-EUPHRATES by SCRC-TENEX with CHAOS; Fri 10-Jun-83 02:33:36-EDT +Date: Friday, 10 June 1983, 02:26-EDT +From: David A. Moon +Subject: DUMP +To: Christopher C. Stacy +Cc: PGS@MIT-MC, CENT@MIT-MC, BUG-ITS@MIT-MC +In-reply-to: The message of 7 Jun 83 14:01-EDT from Christopher C. Stacy + + Date: 7 June 1983 14:01 EDT + From: Christopher C. Stacy + I have put a new command into DUMP. + DFIND does a find for a deceased ITS. + If someone reloads the .TAPEn; directories from AI + onto DM, I will test it and you should be in business. + The directories should be named %TAPEn; instead of .TAPEn;. + +But AI's tape drive was 7-track and DM's is 9-track. So DM can't read AI's tapes. + +Date: 9 June 1983 15:57 EDT +From: Kent M. Pitman +Subject: Bug in ">" handling by Archive Device +To: BUG-ARC @ MIT-MC +cc: BUG-ITS @ MIT-MC + +If two files exist on an archive, FOO A and FOO B, then if you open FOO > +for input, you'll get FOO A open, not FOO B. + +On DSK, FOO B will be opened. +--kmp + +Date: 7 June 1983 14:01 EDT +From: Christopher C. Stacy +Subject: DUMP +To: PGS @ MIT-MC, CENT @ MIT-MC +cc: BUG-ITS @ MIT-MC + + +I have put a new command into DUMP. +DFIND does a find for a deceased ITS. +If someone reloads the .TAPEn; directories from AI +onto DM, I will test it and you should be in business. +The directories should be named %TAPEn; instead of .TAPEn;. + + +Date: 6 Jun 1983 18:32 EDT (Mon) +From: Ian Macky +To: David C. Plummer +Cc: BUG-ITS@MIT-MC +In-reply-to: Msg of 30 May 1983 16:30 EDT from David C. Plummer + + Date: 30 May 1983 16:30 EDT + From: David C. Plummer + To: BUG-ITS at MIT-MC + Received: from MIT-MC by MIT-OZ; Mon 30 May 83 16:33:25-EDT + + Anybody know where the source for UNTALK is hiding? The creation + date on SYS2;TS UNTALK is October 1977 (before the days when + Midas insterted assembly information). It isn't on MC:SYSEN*; + +Ellen knew where it was, so I loaded a copy in my directory for the +time being - it's GREN;UNTALK 87 (and there's UNTALK MAIL, too). It +calls for an .INSRT file of UNCOLA's doing (UNCOLA;.MIDAS >) which was +not on the same full-dump tape, so I dunno where it is. + +Date: 6 June 1983 15:18 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I'll hack up DUMP to look on DM, tonite when I come in. +I cant imagine it taking more than 20 minutes... + +Date: 6 June 1983 15:13 EDT +From: Patrick G. Sobalvarro +Sender: PGS0 @ MIT-MC +To: BUG-ITS @ MIT-MC + +I suggest that we install the AI:.TAPEn; directories on some ITS machine as +AITAPn; and hack up a version of DUMP so that it'll be possible to find tapes +when we need them. The problem is that there are no hardcopy dump logs +except for the ones Penny did of the last couple of dumps. The hacking of +DUMP should be trivial if we want to use only the FIND command; it can +probably be done with translations. Glenn says that we can probably squeeze +the directories on DM, and we might as well, because no one else is using the +machine these days. + +I nominate Chris to do this. All in favor say aye. + +P.S. Ty and I once did an incremental dump of AI to ML thru the MLDEV using +only translations. It took a long time, but, hey, it worked. + +Date: 3 June 1983 09:07 EDT +From: Christopher C. Stacy +To: GSB @ MIT-ML +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC, BUG-DDT @ MIT-MC +In-reply-to: Msg of 06/02/83 23:17:22 from GSB at MIT-ML + + + Date: 06/02/83 23:17:22 + From: GSB at MIT-ML + + Inqupd is writing out its new database to LSR1 >. When it runs out of + disk space, it closes the incompletely written file. + +I think I have fixed my brain damage INQUPD. +Now it writes out the provisional version to NLSR1 >, and disk-full +interrupts prevent it from installing it (the interrupt handler had a +bogus instruction in it.) It will still leave the incomplete version +around as NLSR1. Later, I will put something in to get this deleted. + + In this case, DDT loses its ass when starting up when not-logged-in. + It bugs out before it gets the system symbol table mapped in, + making debugging incredibly difficult. + +Maybe DDT should do all its initialization before logging the user in +(and needing to find his hsname.) I thought it already did this, +but will look at. + + When CORBLK is doing block-mode map-from-disk, it apparently just + tics the aobjn pointer away leaving MPV pages after end-of-file; + no indication that you ran off the end. + +Is this an ITS bug? + + I made two invalid assumptions when looking at this broken system + this afternoon, which caused me to believe that it was horribly trashed. + (Maybe it is. It crashed randomly twice before, which lent great credence + to its being trashed.) One was that DDT would not fail so grossly with + the inquir database smashed. The other was that corblk would not + intentionally act the way it did. + +ML *is* having some kind of trouble - COMSAT is repeat processing +messages from May somehow. I guess the QML is broken somehow? +Was it restored from tape, or is something even worse happenning? +See BUG-MAIL. + + I have renamed INQUPD BIN to INQUPD FUCKED. + +I put the current database and program on ML. +Let me know if there are more bugs with it (it ran fine for three +weeks on MC, but of course some of the error code did not get +exxcercised there.) + +Date: Thursday, 2 June 1983 15:59-EDT +From: MOON at SCRC-TENEX +To: Patrick Sobalvarro +Cc: bug-its at MIT-MC, BUG-LISPM at MIT-OZ +In-reply-to: The message of 2 Jun 1983 07:57-EDT from Patrick Sobalvarro + + Date: Thursday, 2 June 1983, 07:57-EDT + From: Patrick Sobalvarro + + If I read the file MC: AR1: PGS; PKGDCL > into a Zwei buffer, I get 4 nulls at + the end. I don't see these in Emacs. If I delete the nulls and write the file + and read it again, they're back. With nulls, the file has 115 characters in + it. + +I believe this is a bug in the ARC: device; it stores file lengths in words +rather than in characters. Emacs deletes all sorts of characters at the ends +of files in order to get around bugs like this, but the ITS file server is +not as careful (or not as willing to cover up for the deficiencies of other +programs). + +Date: Thursday, 2 June 1983, 07:57-EDT +From: Patrick Sobalvarro +To: BUG-LISPM@MIT-OZ +CC: bug-its@MIT-MC + +In MIT-Specific 19.3, System 94.23, ZMail 50.9, microcode 238, ZM GC@0, +on Lisp Machine Thirty-one: + +If I read the file MC: AR1: PGS; PKGDCL > into a Zwei buffer, I get 4 nulls at +the end. I don't see these in Emacs. If I delete the nulls and write the file +and read it again, they're back. With nulls, the file has 115 characters in +it. + +Date: 1 June 1983 19:53 EDT +From: David C. Plummer +To: PGS @ MIT-MC +cc: CSTACY @ MIT-MC, BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC, + BUG-MINITS @ MIT-MC + + Date: 1 June 1983 01:02 EDT + From: Patrick G. Sobalvarro + In-reply-to: Msg of 1 Jun 1983 00:30-EDT from Christopher C. Stacy + + Wrongo, Roscoe. First, since there are never bugs in my code, you should + have known you were wrong. Second, when you connect to MC via a terminal + concentrator, I'll bet you use Supdup, not Telnet. If you use Supdup, then + MC doesn't know you're on an Ann Arbor. In fact, when I use Telnet and do + :tctyp aaa, I don't miss any characters in INQUIR. I provided 5ms of padding + for %tdeof in the AAA code in TS3TTY, and that turns out to be more than + enough. + +Your response was much better than mine could have been. I was a +little mystified to learn that Stacy didn't know you WROTE the +ITS code for AAAs. + + If it works on the Lisp Machine, then MINITS is probably responsible, because + it provides no padding at all. + +That is true. Perhaps if I find some time this summer and get +marginally bored I will correct this situation. + +Anyway, the cause of the manifestation (call it a bug if you +wish) is CStacy's overeagerness to keep the screen as blank as +possible. I think what is happening is that more than one %TDCLR +is being sent before the text (if entered with :INQUIR DCP). +This causes any AAA without padding to drop characters. + +[Also, the following are defined + .CS=.7TYP 4,[ASCIZ /C/] + .CSL=.7TYPL 4,[ASCIZ /C/] +but are used in only 4 of the 10 places where they could be, the +other six are + .7TYP 4,[ASCIZ /C/] +There are many other occurences of C scattered throughout.] + +Date: 1 June 1983 02:04 EDT +From: Christopher C. Stacy +To: PGS @ MIT-MC +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 1 Jun 1983 01:02 EDT from Patrick G. Sobalvarro + + + Date: 1 June 1983 01:02 EDT + From: Patrick G. Sobalvarro + To: CSTACY + cc: BUG-INQUIR, BUG-ITS, BUG-MINITS + + It says "What next? ->", and then when I type a ^L, it + says "Command-->". + +I just changed these to be a little better. + + Wrongo, Roscoe. First, since there are never bugs in my + code, you should have known you were wrong. Second, when you connect + to MC via a terminal concentrator, I'll bet you use Supdup... + If it works on the Lisp Machine, then MINITS is probably + responsible, because it provides no padding at all. + +Oh yeah. I guess I forgot to turn my brain on tonite! + +Date: 1 June 1983 01:02 EDT +From: Patrick G. Sobalvarro +To: CSTACY @ MIT-MC +cc: BUG-INQUIR @ MIT-MC, BUG-ITS @ MIT-MC, BUG-MINITS @ MIT-MC +In-reply-to: Msg of 1 Jun 1983 00:30-EDT from Christopher C. Stacy + + Date: Wednesday, 1 June 1983, 00:30-EDT + From: Christopher C. Stacy + To: Patrick G. Sobalvarro + cc: BUG-ITS, BUG-INQUIR + + Date: 31 May 1983 16:21 EDT + From: Patrick G. Sobalvarro + I enter INQUIR via INQUIR PGS. The automagic listme that happens is + broken; half of the characters in it are dropped. There is also a + CR at the end of the command line that says Command--> + + I have had this sometimes happen to me on an AAA, buit it never ever + happens on a Lisp Machine SUPDUP connection. I tried it just now. + Just to make sure we are talking about the same program, the prompt + is actually "What next? ->", right? + +It says "What next? ->", and then when I type a ^L, it says "Command-->". + + + (incidentally, a more informative prompt [like, say, INQUIR>] would be + better). This character dropping reminds me of Unix. The random cursor + motion reminds me of another operating system for PDP-10s. I had + entered INQUIR only to change my net address to MC. + + This looks to me like it must be an ITS problem, since it only happens + on certain terminal types, and since that part of INQUIR hasn't been + modified. I suspect that there is not enough padding after a clear + screen operation for Ann Arbor terminals. If no TS3TTY/AAA wizard + speaks up within a few days, I will start experimenting with the ITS tty + code to see if that fixes the problem. + +Wrongo, Roscoe. First, since there are never bugs in my code, you should +have known you were wrong. Second, when you connect to MC via a terminal +concentrator, I'll bet you use Supdup, not Telnet. If you use Supdup, then +MC doesn't know you're on an Ann Arbor. In fact, when I use Telnet and do +:tctyp aaa, I don't miss any characters in INQUIR. I provided 5ms of padding +for %tdeof in the AAA code in TS3TTY, and that turns out to be more than +enough. + +If it works on the Lisp Machine, then MINITS is probably responsible, because +it provides no padding at all. + +Date: Wednesday, 1 June 1983, 00:30-EDT +From: Christopher C. Stacy +To: Patrick G. Sobalvarro +Cc: BUG-ITS at MIT-MC, BUG-INQUIR at MIT-MC +In-reply-to: The message of 31 May 83 16:21-EDT from Patrick G. Sobalvarro + + Date: 31 May 1983 16:21 EDT + From: Patrick G. Sobalvarro + I enter INQUIR via INQUIR PGS. The automagic listme that happens is + broken; half of the characters in it are dropped. There is also a + CR at the end of the command line that says Command--> + +I have had this sometimes happen to me on an AAA, buit it never ever +happens on a Lisp Machine SUPDUP connection. I tried it just now. +Just to make sure we are talking about the same program, the prompt +is actually "What next? ->", right? + + (incidentally, a more informative prompt [like, say, INQUIR>] would be + better). This character dropping reminds me of Unix. The random cursor + motion reminds me of another operating system for PDP-10s. I had + entered INQUIR only to change my net address to MC. + +This looks to me like it must be an ITS problem, since it only happens +on certain terminal types, and since that part of INQUIR hasn't been +modified. I suspect that there is not enough padding after a clear +screen operation for Ann Arbor terminals. If no TS3TTY/AAA wizard +speaks up within a few days, I will start experimenting with the ITS tty +code to see if that fixes the problem. + + +Date: 30 May 1983 16:30 EDT +From: David C. Plummer +To: BUG-ITS @ MIT-MC + +Anybody know where the source for UNTALK is hiding? The creation +date on SYS2;TS UNTALK is October 1977 (before the days when +Midas insterted assembly information). It isn't on MC:SYSEN*; + +Date: Tuesday, 24 May 1983, 03:33-EDT +From: Christopher C. Stacy +Subject: date-print on system console +To: Jeffrey P. Golden +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 23 May 83 17:54-EDT from Jeffrey P. Golden + +OK, the SYSJOB will additionally print the date on the console about every 50 lines. +This should get you at least one per page (why not?). +The feature is run when the two minute clock ticks. + +Date: 23 May 1983 17:54 EDT +From: Jeffrey P. Golden +Subject: date-print on system console +To: BUG-ITS @ MIT-MC +cc: JPG @ MIT-MC + + KLH@MIT-MC 05/23/83 17:30:31 + To: JPG at MIT-MC + CC: (BUG ITS) at MIT-MC + JPG@MIT-MC 22 May 1983 13:22 EDT + It would be nice if the system console had the date printed out more + frequently than once every several pages. + The sysjob routines could count the number of LF's and trigger a new + date-print every so many lines (in addition to current time-based + interval). This is what COMSAT does for its stats. Probably once per 3 + pages is enough? +If I could be assured that I could find the date somewhere in 3 consecutive +pages if I only looked hard enough, that would be great! So I like this. + + CSTACY@MIT-MC 05/23/83 01:38:43 Re: IT IS NOW 1:39 ON MONDAY 23 MAY 1983 + To: JPG at MIT-MC + CC: (BUG ITS) at MIT-MC + I think it prints the date when the very slow clock ticks, about once + every two hours; it also prints it when assorted random things happen. + How often do you want to see it, and what console log events are you + interested in having full timestamps for? +I like what KLH suggests better, but if I can't have that, I suppose +once every half hour would be fine. Since ITS does not have +'auto-hangup' for its dialup lines, every now and then I have to find +out who left a dialup line hung. Then I can give the loser a stern +warning. By OS'ing the line I know the date and time the act was +committed (and perhaps the loser's nickname!), but I need to look at +the system console to get the login name. + +Date: 23 May 1983 17:30 EDT +From: Ken Harrenstien +To: JPG @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 22 May 1983 13:22 EDT + From: Jeffrey P. Golden + + It would be nice if the system console had the date printed out more + frequently then once every several pages. + +The sysjob routines could count the number of LF's and trigger a new date-print +every so many lines (in addition to current time-based interval). This +is what COMSAT does for its stats. Probably once per 3 pages is enough? + +Date: 23 May 1983 01:38 EDT +From: Christopher C. Stacy +Subject: IT IS NOW 1:39 ON MONDAY 23 MAY 1983 +To: JPG @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 22 May 1983 13:22 EDT from Jeffrey P. Golden + + Date: 22 May 1983 13:22 EDT + From: Jeffrey P. Golden + To: BUG-ITS + + It would be nice if the system console had the date printed out more + frequently then once every several pages. + +I think it prints the date when the very slow clock ticks, about once +every two hour; it also prints it when assorted random things happen. +How often do you want to see it, and what console log events are you +interested in having full timestamps for? + +Date: 22 May 1983 13:22 EDT +From: Jeffrey P. Golden +To: BUG-ITS @ MIT-MC + +It would be nice if the system console had the date printed out more +frequently then once every several pages. + +Date: 22 May 1983 06:27 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +When I come in over a TAC, I dont seem to be able to get meta bits +through. Setting +%TPMTA doesn't work (it does on dialups though). +Am I forgetting to do something (like a TAC command) or was I dreaming +when I thought I had used meta keys over TIPs before? + +Date: 19 May 1983 23:35 EDT +From: Glenn S. Burke +Subject: dirsiz +To: BUG-ITS @ MIT-MC + +:call dirsiz claims the second arg sets quota, the source says (and uses) +LH of second arg. + +Date: 13 May 1983 16:08 EDT +From: Christopher C. Stacy +Subject: one more time... +To: BUG-ITS @ MIT-MC, BUG-INQUIR @ MIT-MC +cc: ELLEN @ MIT-MC, JPG @ MIT-MC, IAN @ MIT-OZ + + +The new Inquire database is again experimentally installed +on MC only. All bugs found last time appear to have been +fixed. Send me mail if the old one needs to be re-installed +or anything. + +Chris + +Date: 11 May 1983 11:36 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC +cc: BUG-INQUIRE @ MIT-MC, ian @ MIT-OZ + + +I de-installed the new INQUIRE database and programs, because after +a few real users I found some bugs. Will try again tomorrow. +l + +Date: 11 May 1983 00:07 EDT +From: Christopher C. Stacy +Subject: new Inquire database and stuff is being tested on MC +To: BUG-INQUIRE @ MIT-MC +cc: ALAN @ MIT-MC, BUG-ITS @ MIT-MC, ELLEN @ MIT-MC, JPG @ MIT-MC, + ian @ MIT-OZ + + +OK, the new LSR1 database is installed on MC only. +Experimental versions of INQUIR, LOOKUP, NAME, and INQUPD are running here. +I have tested each of these, and they seem to work. +If anyone notices anything very bad going on, send me mail. + +Note that the user interface on ITS does not let you send entries +to Twenex, only the other way around. This is because I could not +bring myself to deal with the INQUIR source code. I will fix this +sometime by getting up more guts, or just rewriting it. Inquires +on all the ITS will be the same. This has the good side effect that +if I have badly blown it this evening, you can copy a database to MC +from one of the other machines and de-install the experimental programs. + +Note that the databases are not in a completely compatible format. +LSRTNS has been updated to the new format. + +Date: 8 May 1983 23:30 EDT +From: Christopher C. Stacy +To: BUG-ARCHIVE @ MIT-MC + +I replied to SJOBRG. + +Date: 8 May 1983 23:25 EDT +From: Robert W. Sjoberg +To: BUG-ARCHIVE @ MIT-MC + +Can someone please point me to documentation (if any) on the format of the +ITS archive files? I need enough information to be able to extract +directory information and file contents (I don't plan on adding anything +or deleting, just reading) from an archive file. Thanks. +--Bob + +Date: Sunday, 8 May 1983, 06:59-EDT +From: Christopher C. Stacy +Subject: [Re: Is I.T.S. mistaken as to today's date?] +To: Glenn S. Burke +Cc: BUG-EXPIRE at MIT-DMS, BUG-ITS at MC, CENT at MIT-ML, + SYS-OPERATING-TROUBLE at MIT-DMS +In-reply-to: The message of 8 May 83 04:56-EDT from Glenn S. Burke + +Well, I just hacked GMSGS to do just expire hacking if it starts under +the job name EXPIRE, and I hacked TARAKA DEMSTR on DM to start it up. +So, now everday GMSGS will be run and the directory should stay +cleaned. I have not tested this, so let me know if there are +problems, but it really should work. + +Date: 7 May 1983 02:55 EDT +From: Christopher C. Stacy +Subject: SYSHAK; +To: BUG-ITS @ MIT-MC +cc: JPG @ MIT-MC + + +I merged SYSHAK back into SYSTEM;. + +Received: from SCRC-EUPHRATES by SCRC-TENEX with CHAOS; Fri 6-May-83 20:14:20-EDT +Date: Friday, 6 May 1983, 20:27-EDT +From: David A. Moon +To: Jeffrey J Tyrone Sealy +Cc: BUG-ITS@MIT-MC +In-reply-to: The message of 6 May 83 11:28-EDT from Jeffrey J Tyrone Sealy + + Date: 6 May 1983 11:28 EDT + From: Jeffrey J Tyrone Sealy + The console-11 died today, and so ITS was running along fine + but the cty was not doing anything and the swr was not being + read. What is the optimum least obnoxious thing to do in + this sort of event? +Reboot the 11. Boot, RP0, P IOELEV, ITS ON. If this makes ITS crash +as it sometimes does continue it. + +Date: 6 May 1983 11:28 EDT +From: Jeffrey J Tyrone Sealy +To: BUG-ITS @ MIT-MC +cc: Moon @ SCRC-TENEX + +The console-11 died today, and so ITS was running along fine +but the cty was not doing anything and the swr was not being +read. What is the optimum least obnoxious thing to do in +this sort of event? + +Date: Thursday, 5 May 1983 15:02-EDT +From: MOON at SCRC-TENEX +To: Christopher C. Stacy +Cc: BUG-ITS at MIT-MC +Subject: STLGET +In-reply-to: The message of 5 May 1983 04:01-EDT from Christopher C. Stacy + +Well I guess it wouldn't hurt to make STLGET return a fifth value, +although probably all the programs that call it look in the memory of +the user whose index is the 4th value anyway. + +Date: 5 May 1983 04:12 EDT +From: Christopher C. Stacy +Subject: removing AI from stuff +To: BUG-ITS @ MIT-MC + +TALK (WHOJ,U,WHOM,etc) fixed. + +Date: Thursday, 5 May 1983, 04:01-EDT +From: Christopher C. Stacy +Subject: STLGET +To: David A. Moon +Cc: BUG-ITS at MIT-MC +In-reply-to: The message of 5 May 83 02:56-EDT from David A. Moon + + Date: Thursday, 5 May 1983, 02:56-EDT + From: David A. Moon + Date: 2 May 1983 08:05 EDT + From: Christopher C. Stacy + It would be nice if STLGET could actually return the HOSTS3 address + of the host being served. It's sort of a crock to parse the name + of the host, which might not always fix in six characters anyway. + I am not sure if it is reasonable to try to get this info, but if + I get ambitious I'll find out. + You can get it from some standard place in the memory of the server job, + I think. + +Right; it's documented in the TELSER source that a bunch of variables +should not move (ttyloc, binary-mode flag, host. etc.) but I didn't +think it was a good idea for the system to make even that assumption +about what the telnet server is like... + +Received: from SCRC-EUPHRATES by SCRC-TENEX with CHAOS; Thu 5-May-83 03:21:42-EDT +Date: Thursday, 5 May 1983, 03:20-EDT +From: David A. Moon +Subject: SYS: +To: Christopher Stacy +Cc: BUG-ITS@MIT-MC, ALAN@MIT-MC, DEVON@MIT-MC +In-reply-to: The message of 27 Apr 83 08:41-EDT from Christopher Stacy + + Date: Wednesday, 27 April 1983, 08:41-EDT + From: Christopher Stacy + I have an idea for implementing Twenex-like logical names on ITS. + My idea for getting around this is a to extend JOBRET so that there is + a way for the BDH to tell the system: "I am going away now. Disconnect + the user from me and retry the OPEN call using these args I am giving + you." +This sounds like a good idea to me. + +Received: from SCRC-EUPHRATES by SCRC-TENEX with CHAOS; Thu 5-May-83 02:57:26-EDT +Date: Thursday, 5 May 1983, 02:56-EDT +From: David A. Moon +Subject: STLGET +To: Christopher C. Stacy +Cc: BUG-ITS@MIT-MC +In-reply-to: The message of 2 May 83 08:05-EDT from Christopher C. Stacy + + Date: 2 May 1983 08:05 EDT + From: Christopher C. Stacy + It would be nice if STLGET could actually return the HOSTS3 address + of the host being served. It's sort of a crock to parse the name + of the host, which might not always fix in six characters anyway. + I am not sure if it is reasonable to try to get this info, but if + I get ambitious I'll find out. +You can get it from some standard place in the memory of the server job, +I think. + +Date: 4 May 1983 23:36 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +I flushed AI from :INSTAL + +CENT@MIT-ML 05/03/83 03:23:21 Re: *msg list info +To: DEVON at MIT-MC +CC: (BUG ITS) at MIT-MC + Date: 3 May 1983 01:04 EDT + From: Devon S. McCullough + To: BUG-ITS @ MIT-MC + Maybe it would be a good idea to be able to say :whois *ITS and get a + description of what sort of messages should be addressed there, + likewise for other magic mailing addressees. I wasn't able to find the + info from :info even thought I am fairly sure it's in there somewhere.. + +no, there is already a meaning too close to *its for your suggestion to be +wise: :whois @ITS would do a :whois on everyone logged in on the ITSs (it +doesn't work quite right now because AI is gone; could someone dig into +:name or wherever this is hacked in and remove AI references?). this aside, +i don't know whether your idea could even be made to work (someone who +knows more about :whois and mailing lists might be able to tell you). + +If you had looked in the menu for the MAIL subtree, you would have found +the node Announcements (also available from the top-level menu and through +a footnote from the new-user-info subtree), which gets you to this +information. for that matter, it's also mentioned in the mailing lists file +right where the sysmsg lists are defined.. + +Date: 3 May 1983 01:04 EDT +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +Maybe it would be a good idea to be able to say :whois *ITS and get a description of what sort of messages should be addressed there, likewise for other magic mailing addressees. I wasn't able to find the info from :info even thought I am fairly sure it's in there somewhere. + +Date: 2 May 1983 14:04 EDT +From: Christopher C. Stacy +Subject: AI +To: BUG-ITS @ MIT-MC, ARPANET-BBOARDS @ MIT-ML + + +The AI KA10 has been flushed, +please update your programs. + + + + ...Each evening from December to December + Before you drift asleep upon your cot + Think back on all the tales that you remember + Of Camelot + + Ask every person + If he's heard the story + And tell it loud and clear + If he has not + That once there was a fleeting wisp of glory + Called Camelot + + Don't let it be forgot + That once there was a spot + For one brief shining moment + That was known as Camelot.... + + +[From the Lerner and Loewe musical "Camelot"] + +Date: 2 May 1983 08:05 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +It would be nice if STLGET could actually return the HOSTS3 address +of the host being served. It's sort of a crock to parse the name +of the host, which might not always fix in six characters anyway. +I am not sure if it is reasonable to try to get this info, but if +I get ambitious I'll find out. + +Date: 2 May 1983 02:07 EDT +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + + +In ITS 1342, the STLGET call returns a fourth value, as documented +below. (Note that in previous ITS versions, Val 4 was present but only +had the user index; this former behaviour was not documented.) + +STLGET: get information from Server Telnet + + arg 1 a + + val 1 XJNAME of server telnet + val 2 TRMNAM of server telnet + This is the sixbit name of the host connected to. + val 3 SNAME of server telnet + val 4 In LH: STY status bits + In RH: index of telnet server job which owns the STY. + + This call can be used to find out where in the network + a TTY really is. + + The STY status bits are from the STYSTS table in ITS. + Some of the more interesting ones include: + %SSNET==4000 ;4.3 = 1 => THIS STY CONNECTED TO SOME NET SOCKETS. + %SSCHA==2000 ;4.2 = 0 FOR ARPANET, 1 FOR CHAOS NET + %SSTCP==1000 ;4.1 = 1 for TCP internet (%SSCHA must be 0) + + +Date: 1 May 1983 01:58 EDT +From: Alan Bawden +Subject: SYS: +To: ED @ MIT-MC +cc: BUG-ITS @ MIT-MC, DEVON @ MIT-MC +In-reply-to: Msg of 30 Apr 1983 21:25 EDT from Ed Schwalenberg + + Date: 30 April 1983 21:25 EDT + From: Ed Schwalenberg + + Just for the sake of whatever ancient programs might depend on the + behavior, I would strongly recommend that SYS: be equivalent to + DSK:SYS; as the documentation states. + +Yeah, I was gonna mention a couple of days ago that it would be best to +pick a new device name to have this behavior. SYSTEM:? + +CStacy's suggestion about giving JOBRET the ability to cause the OPEN to +retry with different arguments is a good one I think. (I wonder if a +kludge is possible even currently by giving the loser a translation and +then causing him to get PCLSR'ed? That would be a wierd hack! The problem +would be cleaning up all of the translations that would accumulate...) On +the other hand I would really hate to have SYSTEM: (or whatever) be a +jobdevice if it is going to be used all the time by DDT to find binarys. + +Date: 30 April 1983 21:25 EDT +From: Ed Schwalenberg +Subject: SYS: +To: ALAN @ MIT-MC +cc: DEVON @ MIT-MC, BUG-ITS @ MIT-MC + +Just for the sake of whatever ancient programs might depend on the behavior, +I would strongly recommend that SYS: be equivalent to DSK:SYS; as the +documentation states. + +While on the subject of ITS devices, I'm spending idle moments compiling a +document on them- for each device, listing where it is implemented, what it +does, what machines have (or had) it, what option bits for it exist, etc. +Contributions are solicited, particularly by those of you who delight in +using obscure devices and have thus discovered unusual properties (like nil +documentation!). + diff --git a/sysdoc/its.obugs2 b/sysdoc/its.obugs2 new file mode 100644 index 0000000..c1d5596 --- /dev/null +++ b/sysdoc/its.obugs2 @@ -0,0 +1,8486 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 18 Sep 87 11:29:30 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 18 Sep 87 11:26:37 EDT +Mail-From: RICCHIO created at 18-Sep-87 11:19:09 +Date: Fri 18 Sep 87 11:19:09-EDT +From: Joe Ricchio +Subject: MC/MD maintenance +To: SRA@XX.LCS.MIT.EDU +cc: Ricchio@XX.LCS.MIT.EDU +Message-ID: <12335615391.18.RICCHIO@XX.LCS.MIT.EDU> +ReSent-Date: Fri 18 Sep 87 11:23:07-EDT +ReSent-From: Rob Austein +ReSent-To: Postmaster@MC.LCS.MIT.EDU, Liaison@MC.LCS.MIT.EDU, + Bug-ITS@MC.LCS.MIT.EDU +ReSent-Message-ID: <12335616112.55.SRA@XX.LCS.MIT.EDU> + +Rob, Lester has scheduled Tuesday 9-22-87 @ 9AM for PM to the RP06 +drives. Hope this is agreeable wiht you. If not please advise. Thanks + + Joe +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 7 Aug 87 06:34:11 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 7 Aug 87 04:26:56 EDT +Date: Thu, 6 Aug 1987 21:52 EDT +Message-ID: +From: Rob Austein +To: barmar@THINK.COM +Cc: info-its@MC.LCS.MIT.EDU +Subject: Unix catching up to ITS +In-reply-to: Msg of 6 Aug 1987 14:00-EDT from barmar@Think.COM + +No, that's the USR: device. But they've invented the JOB: device too, +something called "portals" I think. + +As Noel Chiappa said when talking about ITS and Multics, it's really +kind of scary to think that we are just now catching up to what we +were able to do twenty years ago. + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Aug 87 19:01:31 EDT +Received: from Think.COM (TCP 1201000006) by MC.LCS.MIT.EDU 6 Aug 87 18:06:10 EDT +Return-Path: +Received: from godot.think.com by Think.COM; Thu, 6 Aug 87 14:00:44 EDT +Received: by godot.think.com; Thu, 6 Aug 87 14:00:39 EDT +Date: Thu, 6 Aug 87 14:00:39 EDT +From: barmar@Think.COM +Message-Id: <8708061800.AA08725@godot.think.com> +To: info-its@mc.lcs.mit.edu +Subject: Unix catching up to ITS + +I read the following in the Usenet newsgroup comp.unix.wizards (== to +the Arpanet mailing list UNIX-WIZARDS). AT&T has finally "invented" +the JOB: device! + +Article 3409 of comp.unix.wizards: +Path: think!husc6!seismo!mnetor!utzoo!henry +From: henry@utzoo.UUCP (Henry Spencer) +Newsgroups: comp.unix.wizards +Subject: /proc, /n/face +Message-ID: <8285@utzoo.UUCP> +Date: 10 Jul 87 19:06:20 GMT +References: <7879@brl-adm.ARPA> <2211@bunker.UUCP>, <6043@brl-smoke.ARPA>, <8244@utzoo.UUCP> +Organization: U of Toronto Zoology +Lines: 42 + +> V8 /proc preserves the semantics of a normal Unix directory setup *exactly*, +> unless I missed something subtle when I read the code. My impression is that +> /n/face does likewise. In both cases the directory hierarchy is actually a +> figment of the kernel's imagination, but it is a consistent figment with the +> same semantics as normal directories. + +Several people have asked what this is about, so I suppose I should elaborate +a bit. This stuff has been presented in papers at Usenix conferences, but +not everybody's familiar with those. + +/proc is V8's replacement for the ptrace() system call and related things. +It's a slightly-odd type of file system. Once mounted, it looks like a +single directory containing a bunch of files with numeric names. If you +open (say) file "12345", you are looking at the address space of process +number 12345. Writes into the file are writes into the address space. +There are ioctls for things like stopping and starting the process, sending +it signals, etc. Access to the files is naturally subject to the standard +Unix file-permission system. The whole thing is actually a figment of the +kernel's imagination, with the "directory" manufactured on the fly whenever +someone tries to read it, and operations on the "files" turned into the +corresponding operations on the processes. Apart from being cleaner than +ptrace(), /proc is also faster. + +[description of /n/face deleted] + +In both cases, these odd filesystems look exactly like real ones, down to +things like "." and ".." entries in the directories. You can use all the +standard Unix tools to operate on them. + +At least one System V implementation of /proc exists inside AT&T, but it +hasn't made it into any released software that I know of. I believe /n/face +is strictly a V8ism at the moment. +-- +Mars must wait -- we have un- Henry Spencer @ U of Toronto Zoology +finished business on the Moon. {allegra,ihnp4,decvax,pyramid}!utzoo!henry + + + + +Date: Sun, 2 Aug 87 20:34:10 EDT +From: Alan Bawden +Subject: IP routing table +To: BUG-ITS@AI.AI.MIT.EDU, BUG-TCP@AI.AI.MIT.EDU, + JNC@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 15 Jul 87 01:55 EDT from Alan Bawden +Message-ID: <236463.870802.ALAN@AI.AI.MIT.EDU> + + Date: Wed, 15 Jul 87 01:55 EDT + From: Alan Bawden + ... Try out: + + :ALAN;REDRCT + + (If anyone can think of a good directory for this to live on other than + ALAN, let me know.)... + +It finally occured to me that the right directory for something like this +is the one named ".". (Remember ":.;BOOT11" on the KL?) So make that: + + :.;REDRCT + +to fool with IP routing. + +Received: from WAIKATO.S4CC.Symbolics.COM (TCP 20024231532) by AI.AI.MIT.EDU 23 Jul 87 09:17:08 EDT +Received: from ROCKY-MOUNTAINS.S4CC.Symbolics.COM by WAIKATO.S4CC.Symbolics.COM via CHAOS with CHAOS-MAIL id 123996; Thu 23-Jul-87 08:59:35 EDT +Date: Thu, 23 Jul 87 08:55 EDT +From: Allan C. Wechsler +Subject: Musings on history +To: tk@STONY-BROOK.SCRC.Symbolics.COM, + marker%random.s1.gov@mordor.s1.gov, ED@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, SIPB@mc.lcs.mit.edu +In-Reply-To: <870722140244.3.TK@CUCKOO.SCRC.Symbolics.COM> +Message-ID: <870723085519.1.ACW@ROCKY-MOUNTAINS.S4CC.Symbolics.COM> + + Date: Wed, 22 Jul 87 14:02 EDT + From: Tom Knight + Date: Tue, 21 Jul 87 16:38:22 PDT + From: marker%random.s1.gov@mordor.s1.gov + >nbdd>sipb>pl>o>xind was compiled on November 11th, 1971. This doesn't + win but is still pretty impresive. + + especially since it wasn't backed up! + +At least when I was a member, we backed up >nbdd> "by hand" +periodically. We actually had to use those backup tapes occasionally. + + +Date: Thu, 23 Jul 87 00:26:56 EDT +From: "Pandora B. Berman" +Subject: MC crash +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <231258.870723.CENT@AI.AI.MIT.EDU> + +it complained about IMPOS. dumped to CRASH;IMPOS LOSS. + +Received: from nrl.arpa (TCP 3200600010) by AI.AI.MIT.EDU 22 Jul 87 17:33:32 EDT +Date: 22 Jul 87 16:08:00 EST +From: "VA::BAL" +Subject: Musings on history +To: "tk" +cc: marker%random.s1.gov@mordor.s1.gov,ed@ai.ai.mit.edu, + bug-its@ai.ai.mit.edu,sipb@athena.mit.edu +Reply-To: "VA::BAL" + +Reply-To: bal%va.decnet@nrl.arpa +Full-Name: Brian A. LaMacchia +Address: Code 4771, Naval Research Laboratory +Address: 4555 Overlook Ave. SW, Washington, DC 20375-5000 +Phone: (202) 767-3066 + + +When this challenge was originally posted, Census data was mentioned. +Well, although it may not be the winner, the Census Bureau puts up a +good fight. Here are the high points: + +1920 Census Data was originally tabulated on Hollerith cards, but those +probably no longer exist. 1920 records are on microfilm (which I assume +doesn't qualify). However, some of it is available on tape (see below). + +The 1950 Census used a Univac I (I think) to count the population. Data +from this census was originally written to Univac metal tape. Some of +these tapes still exist, but it's unclear whether or not the bits on +them are still readable. + +The 1960 Census used FOSDIC (Form Optical Scanner Direct Input to +Computer, or something like that) to convert all the forms to microfilm, +and then to bits. These tapes still exist. + +So it looks like 1950 (which wasn't tabulated until 1954 or so) or 1960 +is the best bet. However, you can get from the Census Bureau tapes +containing data summaries for each Census since 1920. These are 1% +samples of the population, which don't contain any personal data, just +averages. However, some of the numbers are from 1920, so I guess that's +"maintained data." + + --Brian LaMacchia + bal%va.decnet@nrl.arpa (current) + balamac@athena.mit.edu +------ + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 22 Jul 87 14:28:37 EDT +Received: from CUCKOO.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 196728; Wed 22-Jul-87 12:58:55 EDT +Date: Wed, 22 Jul 87 14:02 EDT +From: Tom Knight +Subject: Musings on history +To: marker%random.s1.gov@mordor.s1.gov, ED@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, SIPB@mc.lcs.mit.edu +In-Reply-To: <8707212338.AA00695@random.s1.gov> +Message-ID: <870722140244.3.TK@CUCKOO.SCRC.Symbolics.COM> + + Date: Tue, 21 Jul 87 16:38:22 PDT + From: marker%random.s1.gov@mordor.s1.gov + + >nbdd>sipb>pl>o>xind was compiled on November 11th, 1971. This doesn't + win but is still pretty impresive. + +especially since it wasn't backed up! + + +Received: from random.s1.gov (TCP 20003600056) by AI.AI.MIT.EDU 21 Jul 87 19:41:51 EDT +Received: by random.s1.gov id AA00695; Tue, 21 Jul 87 16:38:22 PDT + id AA00695; Tue, 21 Jul 87 16:38:22 PDT +Date: Tue, 21 Jul 87 16:38:22 PDT +From: marker%random.s1.gov@mordor.s1.gov +Message-Id: <8707212338.AA00695@random.s1.gov> +To: ED@ai.ai.mit.edu +Cc: INFO-EXPLORER@ai.ai.mit.edu, BUG-ITS@ai.ai.mit.edu, SIPB@mc.lcs.mit.edu +In-Reply-To: Ed Schwalenberg's message of Sat, 18 Jul 87 00:20:05 EDT <228939.870718.ED@AI.AI.MIT.EDU> +Subject: Musings on history + +>nbdd>sipb>pl>o>xind was compiled on November 11th, 1971. This doesn't +win but is still pretty impresive. + + Charley + +Received: from Think.COM (TCP 1201000006) by AI.AI.MIT.EDU 18 Jul 87 18:26:30 EDT +Received: from nietzche by Think.COM via CHAOS; Sat, 18 Jul 87 18:27:31 EDT +Date: Sat, 18 Jul 87 18:25 EDT +From: Barry Margolin +Subject: Musings on history +To: Ed Schwalenberg +Cc: INFO-EXPLORER@ai.ai.mit.edu, BUG-ITS@ai.ai.mit.edu, SIPB@mc.lcs.mit.edu +In-Reply-To: <228939.870718.ED@AI.AI.MIT.EDU> +Message-Id: <870718182532.2.BARMAR@NIETZSCHE.THINK.COM> + +I think Roger Roach still has some tape archives from CTSS. + + barmar + +Date: Sat, 18 Jul 87 00:20:05 EDT +From: Ed Schwalenberg +Subject: Musings on history +To: INFO-EXPLORER@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + SIPB@MC.LCS.MIT.EDU +Message-ID: <228939.870718.ED@AI.AI.MIT.EDU> + +I just saw an old file creation date on AI, which led to the following thought: + + Those bits are "still around", despite the fact that the hardware + they live on wasn't invented at the time the bits were written. + +Which leads to a question: + + What is the oldest "continuously maintained" set of bits in the + computer universe? + +Does Grace Hopper still have artillery aiming data on her Macintosh? Did the +Census Department copy their punched cards from the 1920 census onto CD/ROM? +By continously maintained, I mean that the data has been used regularly since +its creation, or at least kept around on some form of reasonably +random-access memory in the hope or expectation that it would be used. Thus, +the sine lookup table diode ROM in the artillery aiming machine doesn't count +if the machine doesn't still work, but AI:SYSEN2;PRUFD > does, even though it +hasn't actually been assembled in 15 years or so, and the object code hasn't +been run in 2. And of course, by data I'm referring to "digital" information. +Rosetta stones, Dead Sea scrolls and Enrico Caruso records don't count, but +the first stock ticker tape might. + +Any interesting candidates? Send me your votes. (The file mentioned above +dates from 28 February 1971, and is the oldest file on AI whose creation +date is believable.) + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 15 Jul 87 01:59:15 EDT +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 15 Jul 87 01:55:51 EDT +Date: Wed, 15 Jul 87 01:55:10 EDT +From: Alan Bawden +Subject: IP routing table +To: BUG-TCP@AI.AI.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, + JNC@MC.LCS.MIT.EDU +In-reply-to: Msg of Tue 14 Jul 87 13:40:44 EDT from Alan Bawden +Message-ID: <227628.870715.ALAN@AI.AI.MIT.EDU> + + Date: Tue, 14 Jul 87 13:40:44 EDT + From: Alan Bawden + Date: Tue, 14 Jul 87 02:44:52 EDT + From: J. Noel Chiappa + You know, I wish there were some tools to manipulate this table...., + some command that could delete routes, or modify the entyry, could be a + real win. + This sounds like an easy one night hack for someone. I'd do it if I was + certain just what kinds of commands were desirable. Stop by my office some + day, and spend 5 minutes helping me design it. + +I was in the mood for a little hack, so I wrote one. (Source on +SYSNET;REDRCT.) Try out: + + :ALAN;REDRCT + +(If anyone can think of a good directory for this to live on other than +ALAN, let me know.) With no JCL it will remind you of its usage as +follows: + +Usage is: + + :REDRCT + +Gateways can be given as hostnames, or in decimal octet form (as in +"10.0.0.77"). If the new gateway is omitted, REDRCT will simply pick a +likely-looking gateway from ITS's list of main gateways. + +REDRCT will ask for confirmation once after it interprets its command, to be +sure it properly understood what you asked it to do. Then for each routing +table entry it finds that uses the old gateway, it will ask for confirmation +before clobbering it with the new gateway. + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 14 Jul 87 14:16:39 EDT +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 14 Jul 87 13:55:46 EDT +Date: Tue, 14 Jul 87 13:40:44 EDT +From: Alan Bawden +Subject: IP routing table +To: JNC@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU +In-reply-to: Msg of Tue 14 Jul 87 02:44:52 EDT from J. Noel Chiappa +Message-ID: <227392.870714.ALAN@AI.AI.MIT.EDU> + + Date: Tue, 14 Jul 87 02:44:52 EDT + From: J. Noel Chiappa + You know, I wish there were some tools to manipulate this table...., + some command that could delete routes, or modify the entyry, could be a + real win. + +This sounds like an easy one night hack for someone. I'd do it if I was +certain just what kinds of commands were desirable. Stop by my office some +day, and spend 5 minutes helping me design it. + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 14 Jul 87 02:45:32 EDT +Date: Tue, 14 Jul 87 02:44:52 EDT +From: "J. Noel Chiappa" +Subject: IP routing table +To: BUG-ITS@MC.LCS.MIT.EDU +cc: JNC@MC.LCS.MIT.EDU +Message-ID: <258985.870714.JNC@MC.LCS.MIT.EDU> + + You know, I wish there were some tools to manipulate this +table. For instance, the main gateway to a net went down, and +I wanted to switch to the backup; however, ITS doesn't discover +dead gateway, and you have to make the switch manually. There's +no tool to do this; I had to grovel in IPGWTN: for the right +netry (after doing the conversion to octal) and bash it by hand +(it picked up the right gateway from a Redirect, so it wasn't +totally by hand). Still, some command that could delete routes, +or modify the entyry, could be a real win. + + NOel + + +Received: from ALDERAAN.SCRC.Symbolics.COM (TCP 30002424555) by AI.AI.MIT.EDU 5 Jun 87 19:51:37 EDT +Received: from LARRY-BIRD.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 89235; Fri 5-Jun-87 19:45:54 EDT +Date: Fri, 5 Jun 87 18:03 EDT +From: Alan@AI.AI.MIT.EDU +Subject: Foo +To: Bug-Networks@ALDERAAN.SCRC.Symbolics.COM, Bug-ITS@ai.ai.mit.edu +cc: Customer-Reports@STONY-BROOK.SCRC.Symbolics.COM +Message-ID: <870605194544.7.PALTER@LARRY-BIRD.SCRC.Symbolics.COM> +Supersedes: <870605180324.1.ALAN@PIGPEN.AI.MIT.EDU>, + <870605194540.6.PALTER@LARRY-BIRD.SCRC.Symbolics.COM> +Redirected-Date: Fri, 5 Jun 87 19:45 EDT +Redirected-by: Palter@ALDERAAN.SCRC.Symbolics.COM +Character-Type-Mappings: (1 0 (NIL 0) (NIL :BOLD NIL) "CPTFONTCB") + (2 0 (NIL 0) (NIL :ITALIC NIL) "CPTFONTI") +Fonts: CPTFONT, CPTFONTCB, CPTFONTI + +[This message has been redirected: + Looks like something either on the LispM or AI didn't properly cleanup from your abort. + I'm quite certain it's not Zmail as it has the necessary UNWIND-PROTECTs. + Bug-Zmail has been removed; + Bug-Networks, Bug-ITS@ai.ai.mit.edu have been added.] + +In Symbolics 3650 Zmail in Genera 7.1, Hacks 3.0, IP-TCP 52.16, +ILA-NFS 3.2, 7-1-Patches 1.15, MAC 11.1, Conversion Tools 12.4, +Pascal 25.10, Experimental X-Window-System 17.4, +Experimental Illustrate 11.0, TeX 1.0, LaTeX 1.0, SliTeX 1.0, YTeX 1.0, +microcode 3650-MIC 396, FEP 206, FEP0:>g206-lisp.flod(14), +FEP0:>g206-loaders.flod(14), FEP0:>g206-debug.flod(4), +FEP0:>g206-info.flod(14), Machine serial number 30096, +Patches for conversion tool. (from SYS:CONVERSION-TOOLS;PATCHES.LISP.29), on Lisp Machine Pigpen: + +I got this while trying to do the DESCRIBE that Gary requested. I had just +previously inadvertently Aborted out of the error he wanted me to +investigate, and the next time I did a "G" to reproduce the problem again, +this happened: + +1Error: Can't have more than one directory open at a time + For AI: ALAN; ALAN _ZMAIL +0While in the function (FLAVOR:METHOD :COMMAND FS:HOST-UNIT)  FS:DIRECTORY-CHAOS  (FLAVOR:METHOD :DIRECTORY-STREAM FS:QFILE-ACCESS-PATH) + +The condition signalled was FS:QNOT-ENOUGH-RESOURCES + +1(FLAVOR:METHOD :COMMAND FS:HOST-UNIT)0: (P.C. = 227) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): FS:HOST-UNIT + Arg 2 (FLAVOR::.GENERIC.): :COMMAND + Arg 3 (FS:MARK-P): NIL + Arg 4 (FS:STREAM-OR-HANDLE): (:CREATE "I6770") + Local 4 (FS:STREAM-OR-HANDLE): "I6770" + Arg 5 (FS:SIMPLE-P): NIL + Arg 6 (FS:WHOSTATE): "Directory" + Rest arg (FS:COMMANDS): ("DIRECTORY" "" "" "" "" #/Return "AI: ALAN; ALAN _ZMAIL" #/Return) + Local 8 (FS:HANDLE): "I6770" + Local 9 (FS:STREAM): NIL + Local 10 (FS:PKT): # + Local 11 (FS:SUCCESS): NIL + Local 12 (STRING): "I6770 ERROR NER F Can't have more than one directory open at a time" + Local 13 (FS:TRANSACTION-ID): "T6773" + Local 14 (FS:CREATE-P): T + Local 15: # + Local 16: (# # #) + Local 17: (# # # #) + Special DBG:*BOUND-HANDLERS*: (# # # #) + +1FS:DIRECTORY-CHAOS0: (P.C. = 141) + Arg 0 (FS:ACCESS-PATH): # + Arg 1: # + Arg 2 (FS:OPTIONS): NIL + Special FS:*COMMAND-ERROR-ARGUMENTS*: (:OPERATION :DIRECTORY-LIST) + Special FS:*COMMAND-PATHNAME*: # + +1(FLAVOR:METHOD :DIRECTORY-STREAM FS:QFILE-ACCESS-PATH)0: (P.C. = 6) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :DIRECTORY-STREAM + Arg 3 (CL:PATHNAME): # + Arg 4 (FS:OPTIONS): NIL + +1(FLAVOR:METHOD :DIRECTORY-LIST FS:DIRECTORY-STREAM-FILE-ACCESS-PATH-MIXIN)0: (P.C. = 13) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): FS:DIRECTORY-STREAM-FILE-ACCESS-PATH-MIXIN + Arg 2 (FLAVOR::.GENERIC.): :DIRECTORY-LIST + Arg 3 (CL:PATHNAME): # + Arg 4 (FS:OPTIONS): (:SORTED) + +1(FLAVOR:METHOD :DIRECTORY-LIST FS:ACTIVE-PATHNAME-MIXIN)0: (P.C. = 12) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :DIRECTORY-LIST + Arg 3 (FS:OPTIONS): (:SORTED) + +1FS:DIRECTORY-LIST0: (P.C. = 100) + Arg 0 (FS:FILENAME): # + Rest arg (FS:OPTIONS): (:SORTED) + +1(FLAVOR:METHOD MAKE-INSTANCE ZWEI:INBOX-BUFFER)0: (P.C. = 110) 2(from SYS:7-1-PATCHES;PATCH;7-1-PATCHES-1-6) +0 Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): # + Rest arg: (:PARENT-BUFFER # :PATHNAME #) + +1(FLAVOR:COMBINED MAKE-INSTANCE ZWEI:ITS-INBOX-BUFFER)0: (P.C. = 11) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): # + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): (:PARENT-BUFFER # :PATHNAME #) + +1MAKE-INSTANCE0: (P.C. = 572) 2(from SYS:PATCH;SYSTEM-349-177) +0 Arg 0 (SYS:FLAVOR-NAME): ZWEI:ITS-INBOX-BUFFER + Rest arg (FLAVOR::INIT-OPTIONS): (:PARENT-BUFFER # :PATHNAME #) + +1(:INTERNAL (FLAVOR:METHOD ZWEI:READ-NEW-MAIL ZWEI:FILE-MAIL-BUFFER) 0 ZWEI:NEW-INBOXES)0: (P.C. = 27) + Arg 0 (COMPILER:.LEXICAL-ENVIRONMENT-POINTER.): # + +1(FLAVOR:METHOD ZWEI:READ-NEW-MAIL ZWEI:FILE-MAIL-BUFFER)0: (P.C. = 76) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): # + Arg 3 (ZWEI:INBOX-PATHNAMES): (#) + +1ZWEI:READ-NEW-MAIL-TOP-LEVEL0: (P.C. = 67) + +1ZWEI:COM-GET-NEW-MAIL-FROM-INBOX0: (P.C. = 7) + +1(FLAVOR:METHOD SI:WITH-PROCESS-NON-INTERACTIVE-PRIORITY-INTERNAL SI:PROCESS)0: (P.C. = 16) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): SI:PROCESS + Arg 2 (FLAVOR::.GENERIC.): # + Arg 3 (SI:CONTINUATION): # + Rest arg: NIL + +1ZWEI:COMMAND-EXECUTE0: (P.C. = 57) + Arg 0 (ZWEI:COMMAND): ZWEI:COM-GET-NEW-MAIL-FROM-INBOX + Arg 1 (ZWEI:CHAR): #/g +2 --Defaulted args:-- +0 Arg 2 (ZWEI:PREFIX-CHAR): NIL + Arg 3 (ZWEI:HOOK-LIST): NIL + +1ZWEI:ZMAIL-COMMAND-EXECUTE0: (P.C. = 6) + Arg 0: ZWEI:COM-GET-NEW-MAIL-FROM-INBOX + +1(FLAVOR:METHOD :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-FRAME)0: (P.C. = 7) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Arg 3 (ZWEI:CH): #/g + +1(:INTERNAL (:INTERNAL (FLAVOR:COMBINED :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-FRAME) 0) 0)0: (P.C. = 10) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): (#/g) + +1(FLAVOR:METHOD SI:WITH-PROCESS-NON-INTERACTIVE-PRIORITY-INTERNAL SI:PROCESS)0: (P.C. = 43) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): SI:PROCESS + Arg 2 (FLAVOR::.GENERIC.): # + Arg 3 (SI:CONTINUATION): # + Rest arg: NIL + +1(FLAVOR:WHOPPER :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-COMMAND-LOOP-MIXIN)0: (P.C. = 31) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.WHOPPER-CONTINUATION.): # + Arg 3 (FLAVOR::.OLD-SELF-MAPPING-TABLE.): # + Arg 4 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Arg 5 (ZWEI:CHAR): #/g + +1(:INTERNAL (FLAVOR:COMBINED :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-FRAME) 0)0: (P.C. = 13) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): (#/g) + +1(FLAVOR:WHOPPER :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-FRAME)0: (P.C. = 21) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.WHOPPER-CONTINUATION.): # + Arg 3 (FLAVOR::.OLD-SELF-MAPPING-TABLE.): # + Arg 4 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Arg 5 (ZWEI:CHAR): #/g + +1(FLAVOR:COMBINED :PROCESS-COMMAND-CHAR ZWEI:ZMAIL-FRAME)0: (P.C. = 12) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :PROCESS-COMMAND-CHAR + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): (#/g) + +1(FLAVOR:METHOD :COMMAND-LOOP ZWEI:ZMAIL-FRAME)0: (P.C. = 130) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :COMMAND-LOOP + +1(:INTERNAL (FLAVOR:COMBINED :COMMAND-LOOP ZWEI:ZMAIL-FRAME) 0)0: (P.C. = 17) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :COMMAND-LOOP + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): NIL + +1(FLAVOR:METHOD SI:WITH-PROCESS-INTERACTIVE-PRIORITY-INTERNAL SI:PROCESS)0: (P.C. = 40) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): SI:PROCESS + Arg 2 (FLAVOR::.GENERIC.): # + Arg 3 (SI:CONTINUATION): # + Rest arg: NIL + +1(FLAVOR:WHOPPER :COMMAND-LOOP ZWEI:ZMAIL-COMMAND-LOOP-MIXIN)0: (P.C. = 65) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.WHOPPER-CONTINUATION.): # + Arg 3 (FLAVOR::.OLD-SELF-MAPPING-TABLE.): # + Arg 4 (FLAVOR::.GENERIC.): :COMMAND-LOOP + +1(FLAVOR:COMBINED :COMMAND-LOOP ZWEI:ZMAIL-FRAME)0: (P.C. = 562) + Arg 0 (SELF): # + Arg 1 (SYS:SELF-MAPPING-TABLE): # + Arg 2 (FLAVOR::.GENERIC.): :COMMAND-LOOP + Rest arg (FLAVOR::.DAEMON-CALLER-ARGS.): NIL + +1ZWEI:ZMAIL-PROCESS-TOP-LEVEL0: (P.C. = 104) + Arg 0 (ZWEI:WINDOW): # + +1SI:PROCESS-TOP-LEVEL0: (P.C. = 45) + Arg 0 (IGNORE): NIL + + Special FS:%FILE-COMMAND-OPCODE: 200 + Special FS:*DONT-HACK-LOGIN*: NIL + + +Date: Tue, 5 May 87 18:20:25 EDT +From: Alan Bawden +Subject: Datapoint on TCP buffer lossage +To: BUG-ITS@AI.AI.MIT.EDU +cc: JTW@AI.AI.MIT.EDU +Message-ID: <195885.870505.ALAN@AI.AI.MIT.EDU> + +The forget-to-free-the-SYN-packet problem than happens on AI and MC so +much, really -does- also happen on the KL! After 12 days running, the KL +has managed to lose just two packets in this manner. Perhaps the fact that +the KL is so much faster explains why it happens so rarely there? + +Date: Tue, 5 May 87 08:25:18 EDT +From: John Wilson +To: INFO-ITS@AI.AI.MIT.EDU +Message-ID: <195618.870505.JOHNW@AI.AI.MIT.EDU> + +Please add me to the mailing list. + + thanks, John Wilson + +Date: Tue, 5 May 87 05:38:08 EDT +From: "Pandora B. Berman" +Subject: MD up again +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <195595.870505.CENT@AI.AI.MIT.EDU> + +since MD is up again, and doesn't show any immediate signs of disk lossage, +i have added it back to the *MSGS and INQUIR update facilities. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 4 May 87 04:27:24 EDT +Received: from PANDA by SUMEX-AIM.STANFORD.EDU with Cafard; Mon, 4 May 87 01:23:28 PDT +Date: Mon, 4 May 87 00:05:09 PDT +From: Mark Crispin +Subject: KS10 power fail +To: BUG-ITS@AI.AI.MIT.EDU +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12299611731.6.MRC@PANDA> + +Hi. I was reading some of the old BUG-ITS mail and saw some messages +about power fail recovery. Forget about it on the KS10. Although it +was originally going to be included (and I think the prototype machine +had it), production KS's don't have any battery backup for the MS10 +memory. Since MS10 is MOS based, once the power goes it gets nuked. + +The best thing ITS can do is with a power fail interrupt is to quiet +down any disk traffic as quickly as possible (certainly nuke all reads +and any writes that aren't essential to prevent filesystem damage) and +halt. + +Since KS10 power supplies are made by a real vendor and not DEC, KS's +don't see trivial little glitches. The power has to be off for some +time, something like 250ms, for a KS to croak. My KS has survived +power glitches that reset the digital clocks and zapped the TV! So, +if you get a power fail interrupt there is a good chance that the +disks are already in the process of shutdown. +------- + +Received: from MIT-MULTICS.ARPA (TCP 1200000006) by AI.AI.MIT.EDU 20 Apr 87 16:17:00 EDT +Received: from SEARN(MAILER) by MITVMA (Mailer X1.23) id 3302; + Mon, 20 Apr 87 11:43:53 EDT +Received: from TQZCOM(MAILER) by SEARN (Mailer X1.23b) id 6677; + Mon, 20 Apr 87 17:43:46 EDT +Message-ID: <247761@QZCOM> +In-Reply-To: <187812.870420.CENT@AI.AI.MIT.EDU> +Date: 20 Apr 87 16:16 +0200 +From: "Peter Lothberg STUPI" +Reply-To: "Peter Lothberg STUPI" , + "ITS bugs mailing list" +To: "ITS bugs mailing list" +cc: BUG-ITS@AI.AI.MIT.EDU +Subject: alas, poor SAIL-KA + +Mark Crispin bought the KA10 with the BBN pager. He wanted to +have a KA10 front panel, and we took the pager to attach to one +of our working KA10:s. + +Date: Mon, 20 Apr 87 00:24:18 EDT +From: "Pandora B. Berman" +Subject: alas, poor SAIL-KA +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <187812.870420.CENT@AI.AI.MIT.EDU> + +i sent LES@SAIL some info about old MAC PDP-10s.... +---------- +Date: 16 Apr 87 1253 PDT +From: Les Earnest +Subject: re: PDP10 history project +To: CENT@AI.AI.MIT.EDU +.... +Incidentally, the Computer Museum already has a PDP-6 -- we gave them +ours. At the time I thought that it was the only one left in the world. +We recently killed our KA10 and sold it to a collector for $500, including +the BBN pager..... + +Date: Fri, 17 Apr 87 08:41:07 EDT +From: David Vinayak Wallace +Subject: Same old Shit +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <186662.870417.GUMBY@AI.AI.MIT.EDU> + +(as of today you can't say that on the radio any more) +AI crashed with the usual "Freeing packet still in use!" +See crash PKTFRE if you care + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 16 Apr 87 04:36:44 EDT +Received: from PANDA by SUMEX-AIM.STANFORD.EDU with Cafard; Thu, 16 Apr 87 01:31:16 PDT +Date: Thu, 16 Apr 87 00:29:35 PDT +From: Mark Crispin +Subject: Re: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <185625.870416.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12294897588.8.MRC@PANDA> + +I am involved peripherally with this project. + +There is NO attempt to shortchange or ignore ITS, WAITS, and TENEX. + +But!! We will need *papers* from people in these communities in order to +fairly cover these operating systems. + +Otherwise, I will write up something really brief. For ITS, in a few short +paragraphs I'll talk about DDT as the command decoder, PCLSR'ing, and the +environment that led to the creation of EMACS. + +I think such coverage WOULD shortchange ITS. There are lots of important +concepts that can and should be discussed in detail -- PCLSR'ing, ITS virtual +memory (not as good as TOPS-20/Tenex, but quite advanced for its time), +canonical terminals/SUPDUP/CRTSTY, symbolic system calls, CHEOPS, Knight TV +system, ... + +TECO and TECO-based editors should be a paper in itself. +------- + +Date: Thu, 16 Apr 87 02:04:00 EDT +From: Alan Bawden +Subject: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <185625.870416.ALAN@AI.AI.MIT.EDU> + +The following message was forwarded to me (it was originally sent to AIList +I think) with the suggestion that I should redistribute it to whatever +mailing lists of PDP-10 hackers I knew of. I don't know anything more +about this than what is revealed here. + +It does kind of sound like these guys are planning on writing a history of +PDP-10's that only mentions TOPS10 and TOPS20 and fails to consider ITS and +WAITS and perhaps shortchanges TENEX. But I suspect that this is merely a +shortcoming of this announcement. + +Date: 16 Mar 1987 1311-EST +From: "Joe Dempster, DTN: 336.2252 AT&T: 609.665.8711" +Subject: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) + +This message originates from 2 sources: + + Les Earnest + Computer Science Department + STANFORD UNIVERSITY + Stanford, CA 94305 + 415.723.9729 + ARPA: LES@SAIL.STANFORD.EDU + + Joe Dempster + DIGITAL EQUIPMENT CORPORATION + 6 Cherry Hill Executive Campus + Route 70 + Cherry Hill, NJ 08002 + 609.665.8711 + ARPA: DEMPSTER@MARLBORO.DEC.COM (MARKET) + +The goal of this project is to publish an analysis and history of +the evolution, implementation and use of Digital's 36 bit systems. +This period began with the PDP-6 in 1964 and continues today with +TOPS 10/20 development, which is scheduled to end in 1988. + +We are working aggressively to finish the project, and have it +published, by March/April 1988. This will require that the +completed manuscript be ready to go into the publication cycle +by August 1987! + +The project will attempt to answer the following questions: + + 1. In what markets/applications were these systems used? + + 2. Who were the users of these systems and what impact did + roughly 2,500 TOPS 10/20 systems have on their organizations? + + 3. Who were the principle system architects of these systems? + What features, and if there had been sufficient time to + implement them, would have significantly improved the + architecture? + + 4. What impact did the decision to continue to examine design + extensions to the architecture have on the usefulness and + acceptability of these systems. This is in contrast to a + more common practice today to work from a detailed design + specification, sometimes dated, building follow-on systems + which provide increased performance through the use of new + component technologies and packaging techniques. + + 5. What part of the overall design (TOPS10/20) was technology + dependent and what can still be considered "unequaled" in + relation to other computer architectures still undergoing + active development? + + 6. What type of development environment (both HW and SW) + supported and contributed to the evolution of 36 bit + systems? + + 7. What influence did TOPS 10/20 have on other vendors system + development? + +This history will undoubtedly be assembled from many sources and +participants. Some information will be anecdotal; there will be +interviews with the people involved (users and developers) and technical +papers will be solicited. Of course there will also be the packaging +and assembly of facts as we see them. + +The result will hopefully have sufficient depth to serve as: + + 1. An introductory or advanced text on system design and + hardware/system software implementation. + + 2. A analysis of the success and difficulties of marketing + complex systems into a very crowded market of competing + alternatives. + + 3. A catharsis for those of us who have contributed to the + development and use these systems and who will now move + onto new computing architectures and opportunities. + +In addition to interviewing directly 25-50 developers, users and +product managers we will continue to work to identify contributors +and significant events up to when the final draft is submitted to +the publisher. Two "topics" are already under development: + + 1. Rob Gingell from SUN is working on a paper which looks + at extensions to TOPS 20 which would have enhanced its + capabilities. + + 2. Frank da Cruz and Columbia are summarizing 10 years of + experience and development of TOPS 20 systems. Some + effort will also be made to detail the process which + lead to their selection of a follow-on architecture to + TOPS 20. + +There is a need to develop additional topics which represent the +use and application of the technology (TOPS 10/20) in other areas. +Specific recommendations are welcome as are proposals to develop +them. A short abstract should accompany any such proposal. Every +effort will be made to work with individuals or organizations +interested in making such a contribution. + +There will be a standalone (no network connections) DECSYSTEM 2020 +(YIPYIP) dedicated to supporting the project. This system has a 3 +line hunt group, with all lines accessible from a single number +(201.874.8612). + +Both YIPYIP and MARKET will have "public" directories for remote +login (DEMPSTER.PROJECT-10262 LCGLCG). MARKET can +be accessed by modem (617.467.7437), however disk quota is limited. +MARKET's primary purpose is ARPAnet TELNET +access. YIPYIP is a dedicated PROJECT-10262 system. MAIL can also +be sent to DEMPSTER on either system. + +YIPYIP and MARKET will keep a running summary of ideas and comments +up on Columbia's BBOARD software. KERMIT also runs on each system +for uploads. + +SAIL.STANFORD.EDU will support ARPAnet transfers to a "public" area: + + FTP + CONNECT SAIL.STANFORD.EDU + SEND AFN.EXT + DSK: AFN.EXT [PUB,LES] + +SAIL runs WAITS, an operating system similiar to TOPS 10. File +names are limited to 6 characters and extensions limited to 3. + + +Implementation details: + + 1. User input is welcomed and desired from all application + and geographic areas. + + 2. Input from past and present developers is also desired. + + 3. Throughout the project a secondary goal will be to build + a list of users/locations (installation date, duration and + disposition) of PDP-6 and KA, KI, KL and KS systems. + Serial numbers, if available, are requested. + + 4. We anticipate that this project will generate a large + volume of information (which we hope will arrive + electronically). Some information, for any number of + reasons, may not be in line with the project's stated + goals. Therefore, all notes, interview material and + submissions will be donated to the Computer Museum in Boston + at the the completion of the project to be available for + future reference and research. + +Ideas, contributions, suggestions and criticism are welcome. As these +36 bit systems were the products of a multitude of people, so too +will be the writing of their history. + +Date: Tue, 31 Mar 87 18:21:04 EST +From: Alan Bawden +Subject: [KLOTZ%OZ.AI.MIT.EDU: sys;system mail] +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 30 Mar 87 14:54:07 EST from David Chapman +Message-ID: <176953.870331.ALAN@AI.AI.MIT.EDU> + +Nothing you could tell me about when DDT and PWORD handle newlines in the +presence or absence of SYSTEM MAIL would supprise me. I've looked at that +code once before trying to make both programs do the same thing, and I was +unable to do that. If anyone else thinks they want to straighten this out, +I can suggest about 8 other projects that would be more useful. + +Date: Mon, 30 Mar 87 14:54:07 EST +From: David Chapman +Subject: [KLOTZ%OZ.AI.MIT.EDU: sys;system mail] +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <176082.870330.ZVONA@AI.AI.MIT.EDU> + +Well, this is really random. + +Date: Mon 30 Mar 87 02:18-EST +From: Leigh L. Klotz +To: zvona%OZ.AI.MIT.EDU at XX.LCS.MIT.EDU +Re: sys;system mail + +Actually I wanted to put a * in the file but it turns out that ddt +prints out a crlf after the file if there wasn't one... + +Date: Sun, 29 Mar 87 14:41:13 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +cc: KLOTZ@AI.AI.MIT.EDU +Message-ID: <175557.870329.ZVONA@AI.AI.MIT.EDU> + +I deleted ai:sys;system mail a few days ago, and then someone +wrote one that has just a crlf in it. I agree with him (Klotz +actually) that this looks better. Seems like a kludge this way; +maybe it would be better to patch ddt/pword to print the crlf +there instead. + +Date: Tue, 24 Mar 87 09:48:33 EST +From: Ed Schwalenberg +Subject: CAMEXEC +To: CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, AAD@AI.AI.MIT.EDU, + HENRY GAMMERDINGER@AI.AI.MIT.EDU +Message-ID: <173000.870324.ED@AI.AI.MIT.EDU> + + Date: Tue, 24 Mar 87 03:40:44 EST + From: "Pandora B. Berman" + + Date: Sat, 21 Mar 87 05:59:20 EST + From: "Anthony A. Datri" + Subject: is this a mailing list? + ... + IBM. Also, I saw something somewhere about something called CAMEXEC, + which called it an its-like operating system for the pdp-11. Since + ... + ... + as to CAMEXEC, yes, it is an ITS-emulating system, written by ED@AI. + ... +Before this gets out of hand, CAMEXEC was written by Mike Speciner, who was +MS@AI a very long time ago (so long ago that the "@AI" part was seldom used, +since the ARPAnet didn't really work very well yet). + +Date: Tue, 24 Mar 87 03:40:44 EST +From: "Pandora B. Berman" +Subject: is this a mailing list? +To: AAD@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <172875.870324.CENT@AI.AI.MIT.EDU> + + Date: Sat, 21 Mar 87 05:59:20 EST + From: "Anthony A. Datri" + Subject: is this a mailing list? + To: INFO-ITS@AI.AI.MIT.EDU, INFO-ITS-REQUEST@AI.AI.MIT.EDU + Is this an ITS mailing list (duh!)? If so, could I be added to it? + I'm relatively new to ITS (turist account), and I'd love to find out + more. I have great respect for an os that was named to make fun of + IBM. Also, I saw something somewhere about something called CAMEXEC, + which called it an its-like operating system for the pdp-11. Since + I've got an 11/34 with nothing better to run than 2.9.1 BSD or RT11, + I'm interested. Does anyone know anything about this? (hmm. that + sounds like a stupid question, doesn't it?) If I seem confused, it's + because I largely am. I'm learning about ITS by trial and error. + + I bet this will seem the strangest to you. IS ITS public domain at + this point? If it is, what would it take to get a distribution? This + is a very silly question, but I seriously intend to have a 2020 of my + own someday. If Mr. Crispin can do it, so can I 8^) + + Thanks for any time you spend putting up with and/or answering this + mail. + +INFO-ITS is, of course, a mailing list, but it is not used for regular +mail. it follows the original fashion of lists named INFO-x, being a very +large list used only for announcements of general interest and importance +to the ITS community -- for instance, major changes in the system. you +should not send mail to it. i will add you to it (if no one else has yet), +but don't expect more than one or two msgs a year to be sent. BUG-ITS or +one of the more specific ITS-related lists is probably the right list for +your various questions. + +as to CAMEXEC, yes, it is an ITS-emulating system, written by ED@AI. he +can give you lots of information about it. + +ITS is more or less public domain. however, there is no regular +distribution system; each ITS kit is custom-made. for one thing, in the +current scheme of things, each ITS in the world needs a unique two-letter +ID, assigned here so it can be included in some of the deep internals. so +we are not inclined to scatter ITS kits at random. if you get a KS, and +want such a kit, the correct list to correspond with is KS-ITS@AI. + +for info on ITS, you should start by looking into the :INFO program and +reading what it has to offer. + +Date: Sat, 21 Mar 87 05:59:20 EST +From: "Anthony A. Datri" +Subject: is this a mailing list? +To: INFO-ITS@AI.AI.MIT.EDU, INFO-ITS-REQUEST@AI.AI.MIT.EDU +Message-ID: <171734.870321.AAD@AI.AI.MIT.EDU> + + +Is this an ITS mailing list (duh!)? If so, could I be added to it? I'm relatively +new to ITS (turist account), and I'd love to find out more. I have great +respect for an os that was named to make fun of IBM. Also, I saw something +somewhere about something called CAMEXEC, which called it an its-like +operating system for the pdp-11. Since I've got an 11/34 with nothing better +to run than 2.9.1 BSD or RT11, I'm interested. Does anyone know anything +about this? (hmm. that sounds like a stupid question, doesn't it?) If +I seem confused, it's because I largely am. I'm learning about ITS by +trial and error. + +I bet this will seem the strangest to you. IS ITS public domain at this +point? If it is, what would it take to get a distribution? This is a very +silly question, but I seriously intend to have a 2020 of my own someday. +If Mr. Crispin can do it, so can I 8^) + +Thanks for any time you spend putting up with and/or answering this mail. + +Anthony A. Datri +aad@ai.ai.mit.edu (but i imagine you guessed that, eh?) + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 20 Mar 87 20:20:36 EST +Received: from SPEECH.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 20 MAR 87 20:09:06 EST +Date: Fri 20 Mar 87 20:03:32-EST +From: "John Wroclawski" +Subject: Re: TCP buffers +To: Moon@SCRC-STONY-BROOK.ARPA, KLH@AI.AI.MIT.EDU +cc: ALAN@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, BUG-COMSAT@MC.LCS.MIT.EDU +In-Reply-To: <870320151939.5.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12288011565.22.JTW@MIT-SPEECH> + + +Yow! Anyway, what I was going to say when the message cleverly decided to +send itself was that the second TCP buffer problem (which is the more +serious - the SYN problem loses packets slowly over time, but when the +IMP problem hits you have had it) is due to my driver code's apparent +inability to always recover correctly from a dropped ACC interrupt. + +I haven't had a chance to look at the SYN problem yet, but given what +we learned from Dave's stuff it should be fairly easy to find. +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 20 Mar 87 19:56:09 EST +Received: from SPEECH.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 20 MAR 87 19:58:54 EST +Date: Fri 20 Mar 87 19:53:22-EST +From: "John Wroclawski" +Subject: Re: TCP buffers +To: Moon@SCRC-STONY-BROOK.ARPA, KLH@AI.AI.MIT.EDU +cc: ALAN@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, BUG-COMSAT@MC.LCS.MIT.EDU +In-Reply-To: <870320151939.5.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12288009716.22.JTW@MIT-SPEECH> + +Moon's PEEK mode actually showed two different problems with the TCP +buffer stuff. Alan mentioned the first one; there is a path which drops +SYN packets on the floor. Dave mentioned the second; the KS IMP driver +occasionally forgets what it is supposed to be doing. The secon +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 20 Mar 87 16:35:06 EST +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by MC.LCS.MIT.EDU 20 Mar 87 16:23:56 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 98275; Fri 20-Mar-87 15:20:04 EST +Date: Fri, 20 Mar 87 15:19 EST +From: David A. Moon +Subject: TCP buffers +To: Ken Harrenstien +cc: ALAN@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, + BUG-COMSAT@MC.LCS.MIT.EDU +In-Reply-To: <171046.870320.KLH@AI.AI.MIT.EDU> +Message-ID: <870320151939.5.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 20 Mar 87 01:47:48 EST + From: Ken Harrenstien + + Another approach would be to modify PEEK (or something else) to look at the + buffers, including those not on any list. The contents might give + you a clue -- perhaps they are all from a particular host, or use a + particular protocol, or all have the SYN or FIN bit set, etc. + +I did that a month or two ago. I don't remember any more what I found out, +except that there were a large number of buffers queued for transmission and +the IMP wasn't taking them. But I don't remember what was in them. We still +have the crash dumps and :p ? should say what the new mode is +(1A I think). + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 20 Mar 87 15:31:34 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 20 Mar 87 15:34:47 EST +Date: Fri, 20 Mar 87 15:30:42 EST +From: Alan Bawden +Subject: TCP buffers +To: KLH@AI.AI.MIT.EDU +cc: BUG-COMSAT@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU +In-reply-to: Msg of Fri 20 Mar 87 01:47:48 EST from Ken Harrenstien +Message-ID: <171296.870320.ALAN@AI.AI.MIT.EDU> + +I guess it wasn't announced to Bug-ITS when Moon put a mode into PEEK for +looking at TCP buffers (type "1A"). After using this mode on running +systems and crash dumps it appears that the lost packets are always SYN +packets with their Retransmit flag set. JTW points out that the only +effect of a bug that causes retransmission of SYNs to get dropped would be +that opening connections would time-out more frequently than they should. +This doesn't address the issue of why the problem only seems to happen on +the KS's and never on the KL. + + + +Date: Fri, 20 Mar 87 14:52:06 EST +From: Jonathan A Rees +Subject: today's crash +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <171239.870320.JAR@AI.AI.MIT.EDU> + +"PK: Freeing packet still in use! PI LEVEL 2 BUGHALT ..." + +Dumped to CRASH; PACKET INUSE . + +-Jonathan + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 20 Mar 87 01:48:46 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 20 Mar 87 01:51:39 EST +Date: Fri, 20 Mar 87 01:47:48 EST +From: Ken Harrenstien +Subject: TCP buffers +To: ALAN@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, BUG-COMSAT@MC.LCS.MIT.EDU +Message-ID: <171046.870320.KLH@AI.AI.MIT.EDU> + +One approach for finding out where the buffers are going might be to +look at the various meters. If you find a meter which has a count the +same as (or close to) the number of buffers that are "lost", then you've +found something. + +Another approach would be to modify PEEK (or something else) to look at the +buffers, including those not on any list. The contents might give +you a clue -- perhaps they are all from a particular host, or use a +particular protocol, or all have the SYN or FIN bit set, etc. + +Considering the remarkable things that have already been discovered +with respect to .HANG and LOCKS, surely yet another long standing +mystery will shortly come to light. + + + + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 15 MAR 87 18:12:06 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 28498; Sun 15-Mar-87 18:09:51 EST +Date: Sun, 15 Mar 87 18:09 EST +From: Alan Bawden +Subject: Recent bugs +To: BUG-ITS@AI.AI.MIT.EDU +cc: ED@AI.AI.MIT.EDU +In-Reply-To: <132118.861218.ALAN@AI.AI.MIT.EDU>, + <141115.870116.ALAN@AI.AI.MIT.EDU> +Message-ID: <870315180951.4.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Thu, 18 Dec 86 02:57:19 EST + From: Alan Bawden + TTYSET on a TTY opened as a device (rather than as a console) + clobbers the wrong TTYST* words! + +I am unable to reproduce this. I'm certain I was able to clobber +SIXBIT/FOOBAR/ into the TTYST1 word of T0n+1 when I had T0n open as a +device, but I can't get it to happen now... I must have been severely +faked out somehow. + + Date: Fri, 16 Jan 87 17:13:23 EST + From: Alan Bawden + After reading the following bug report [not included], you will realize + that this reveals a bug in the way jobs are sometimes killed when they + have locks locked. If you -first- clobbering their PC's to point to a + .LOGOUT in location 0, and only the .LOGOUT then checks to see if the + PC is in the critical routine table, then the critical routine table is + worthless... + +I fixed the lock unlocking stuff to always use the correct PC, so .GUNing +somebody when he is in a critical region should now do the right thing. I +didn't do anything to prevent lock unlocking instructions from clobbering +the location that contains the .LOGOUT. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 11 MAR 87 13:41:26 EST +Date: Wed 11 Mar 87 13:38:43-EST +From: "John Wroclawski" +Subject: Re: not a bug +To: RISTAD%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU +cc: bug-system@AI.AI.MIT.EDU +In-Reply-To: Message from "Eric Sven Ristad " of Wed 11 Mar 87 13:21:53-EST +Message-ID: <12285582215.16.JTW@MIT-SPEECH> + + +10.2.0.6 + +You can use the HOST program to find out things like this. (:HOST AI +from an ITS or HOST AI from a TOPS-20 like OZ) +------- + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 11 MAR 87 13:18:29 EST +Date: Wed 11 Mar 87 13:14-EST +From: Eric Sven Ristad +Subject: not a bug +To: bug-system@AI.AI.MIT.EDU + +What is AI's telnet address (e.g. MX is 10.1.0.6)? +Thanks, + +Eric + +Received: from eneevax.umd.edu (TCP 20002102401) by AI.AI.MIT.EDU 10 Mar 87 00:44:05 EST +Received: by eneevax.umd.edu (5.9/4.7) + id AA13924; Tue, 10 Mar 87 00:41:36 EST +Date: Tue, 10 Mar 87 00:41:36 EST +From: Douglas Humphrey +Message-Id: <8703100541.AA13924@eneevax.umd.edu> +To: BUG-ITS@AI.AI.MIT.EDU, BUG-KS@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU +Subject: Re: MD has internal troubles + +RP06 Disk drives are selling for less than the $500 that you state it +will take to fix the existing drive. Has someone contacted used hardware +places in the Boston area (to save shipping charges) to see if they will +either sell or donate an RP06 or two ? I will note that a place in Atlanta +just had several Hundred RP06 drives sent to a scrapper for cents per pound +because there is no market for them any longer. + +Doug + + +Date: Mon, 9 Mar 87 00:36:27 EST +From: "Pandora B. Berman" +Subject: MD has internal troubles +To: BUG-KS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <165407.870309.CENT@AI.AI.MIT.EDU> + +(remailed for the record) + +Date: Fri, 6 Mar 87 16:00 EST +From: Alan Bawden +Subject: MD +Well, head 7 on MD's RP06 is deteriorating fast. JTW just tried cleaning +the heads, but it doesn't look like that helped the problem. I'm +considering taking ITS down so as to not risk damage to the filesystem. +This drive is not on service contract, and neither AI nor presumably LCS +has any real interest in paying to get it fixed. It cost about 500 bucks +to get this fixed when it happened to one of AI's drives. + +[ CStacy broke the UNLOCK routine in the Salvager, by the way... ] + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 6 Mar 87 13:27:10 EST +Date: Fri, 6 Mar 1987 13:24 EST +Message-ID: +From: Rob Austein +To: BUG-ITS@AI.AI.MIT.EDU +Subject: BT AUTO +In-reply-to: Msg of 6 Mar 1987 12:47-EST from David Vinayak Wallace + +If we can do the hack with Gumby's clock, I say this is a win. I have +always considered it a big feature that I can go home and sleep and +not be beheaded in the morning by 50 irate XX users who want to know +why their mail hasn't gotten through. It'd be nice if MC and AI could +take care of themselves too. + +It seems it ought to be possible to detect which drives are offline at +boot time; Twenex does this, perhaps DSKDMP or ITS could just zap QACT +when it sees that a drive is offline? + +While we're adding twenexisms, how about automatic crash dumps and +automatic proceed or reload when there isn't a hacker on duty? :-) + +Date: Fri, 6 Mar 87 12:47:39 EST +From: David Vinayak Wallace +Subject: BT AUTO +To: ALAN@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +In-reply-to: Msg of Thu 5 Mar 87 19:37 EST from Alan Bawden +Message-ID: <164347.870306.GUMBY@AI.AI.MIT.EDU> + + Date: Thu, 5 Mar 87 19:37 EST + From: Alan Bawden + + In theory there is a bit that the 8080 sets to indicate that this + is an auto-boot. DSKDMP could test that bit and always load .;@ + ITS. Then it could set some kind of a flag to tell DDT to + immediately $G and then start it. + + Then we would have to change all of our habits about disk drives + being offline, because we would always need to patch QACT in the + binary as well as the running system. + +This is reasonable. We could get rid of that crufty ITS/NITS/XITS +naming randomness too (what's wrong with a link?). + + Then we have to figure out what to do about setting the time. + After a power-glitch, a KS-10 will -always- forget the time. + Getting the time from the network simply doesn't work. (This + afternoon when AI and MC asked for the time from the network, only + -one- host responded to their query. I'm kind of reluctant to set + the time on the basis of a single answer.) + +I still have that clock that didn't get installed because I/we +couldn't figure out which protocol was the best and what machine to +put it on. Why not put it on MC? I've been watching it for the last +several months and it keeps time better than my watch (which is what +we use otherwise, right?) + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 5 MAR 87 19:38:02 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 26567; Thu 5-Mar-87 19:39:05 EST +Date: Thu, 5 Mar 87 19:37 EST +From: Alan Bawden +Subject: BT AUTO +To: SRA@XX.LCS.MIT.EDU +cc: ZVONA@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <870305193743.5.ALAN@PIGPEN.AI.MIT.EDU> + +[ Should have combined this message with the previous one, but I + overlooked this message the first time through my mail. ] + + Date: Thu, 5 Mar 1987 13:34 EST + From: Rob Austein + ... + Or is it, for some reason beyond my ken, considered a feature that ITS + needs a human to reboot? + +Well, booting the system without human assistance just makes me a little +nervous, but we could think about it: + +In theory there is a bit that the 8080 sets to indicate that this is an +auto-boot. DSKDMP could test that bit and always load .;@ ITS. Then it +could set some kind of a flag to tell DDT to immediately $G and then start +it. + +Then we would have to change all of our habits about disk drives being +offline, because we would always need to patch QACT in the binary as well +as the running system. + +Then we have to figure out what to do about setting the time. After a +power-glitch, a KS-10 will -always- forget the time. Getting the time from +the network simply doesn't work. (This afternoon when AI and MC asked for +the time from the network, only -one- host responded to their query. I'm +kind of reluctant to set the time on the basis of a single answer.) + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 5 MAR 87 19:10:40 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 26559; Thu 5-Mar-87 19:11:45 EST +Date: Thu, 5 Mar 87 19:10 EST +From: Alan Bawden +Subject: BT AUTO +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <163684.870305.ZVONA@AI.AI.MIT.EDU> +Message-ID: <870305191017.3.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Thu, 5 Mar 87 13:12:14 EST + From: David Chapman + AI and MC both lost with BT AUTO. I take it this was a powerglitch. + I dumped to BTAUTO HUH? AI:, presumably this is gubbish if it really + was a glitch. Lost a lot of work, fuck. + +Yeah, "BT AUTO" is what the 8080 front-end types when it decides to +automatically boot the machine after the machine is powered on. For ITS +the boot routine just loads up DSKDMP and starts it, which is presumably +how you found the machine. Since the boot routine zeros core before +loading DSKDMP (it does this to wipe out potential parity errors), your +crash dump contains nothing more than the boot routine itself. Thanks for +tending to the problem! + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 5 Mar 87 13:37:10 EST +Date: Thu, 5 Mar 1987 13:34 EST +Message-ID: +From: Rob Austein +To: David Chapman +cc: BUG-ITS@AI.AI.MIT.EDU +Subject: BT AUTO +In-reply-to: Msg of 5 Mar 1987 13:12-EST from David Chapman + +Right, that's a powerglitch. The power fail microcode on the KSs +doesn't seem to work any better than the powerfail code on the KL-Bs +(worse, actually, about once every six months XX or OZ will reboot +correctly after a powerfail and surprise the hell out of everybody). + +I know that in the case of the KL-Bs running twenex microcode this has +been a problem for years. It gets fixed, then broken, then fixed, ad +nauseum. Unless Alan tells me otherwise I'd assume it's a similar +problem on the KSs. + +Or is it, for some reason beyond my ken, considered a feature that ITS +needs a human to reboot? + +Date: Thu, 5 Mar 87 13:12:14 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <163684.870305.ZVONA@AI.AI.MIT.EDU> + +AI and MC both lost with BT AUTO. I take it this was a powerglitch. +I dumped to BTAUTO HUH? AI:, presumably this is gubbish if it really +was a glitch. Lost a lot of work, fuck. + +Date: Tue, 24 Feb 87 15:05:39 EST +From: kltoz@AI.AI.MIT.EDU +Sender: ___016@AI.AI.MIT.EDU +Subject: Rudy.Nedved and the end of TOPS-10 +To: POOR-MX@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU, + BUG-ITS@AI.AI.MIT.EDU +Message-ID: <159022.870224.___016@AI.AI.MIT.EDU> + +Rudy Nedved is the person who caused the demise of info-cobol. + +Date: Tue, 24 Feb 87 01:21:56 EST +From: "Pandora B. Berman" +Subject: small request +To: Rudy.Nedved@H.CS.CMU.EDU +cc: POSTMASTER@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + POOR-MX@AI.AI.MIT.EDU +Message-ID: <158772.870224.CENT@AI.AI.MIT.EDU> + + Date: Monday, 23 February 1987 19:28:36 EST + From: Rudy.Nedved@h.cs.cmu.edu + To: postmaster@mc.lcs.mit.edu + Subject: small request + Hi, Could some kind person take the time out to remove + MIT-MESSAGES@A.CS.CMU.EDU + from the mit bboard distribution list? +done, mostly by Gumby (i cleaned up a few things he missed). + It has been eons since I made a + change to a mailing list on MIT ITC +you mean ITS, right? + machines. Thanks much, + -Rudy + CMU CS/RI Postmaster + + P.S. The last TOPS-10 machine on the ARPANET, A.CS.CMU.EDU is going away + in a week or so. The official shutoff time for users is this Monday, + March 2nd. +alas, poor PDP-10s -- yet another casualty. it deserves recording +(wherefore the CCs to the other lists) and public mourning. probably if you +send a mildly clever farewell msg to arpanet-bboards it will get +broadcast... + +Date: Mon, 23 Feb 87 23:36:44 EST +From: Alan Bawden +Subject: confused +To: CENT@AI.AI.MIT.EDU +cc: BUG-LOCK@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 23 Feb 87 22:49:38 EST from Pandora B. Berman +Message-ID: <158719.870223.ALAN@AI.AI.MIT.EDU> + +Actually, its ITS that is at fault, not LOCK. You killed your LOCK job and +someone else's TELSER happened to get the same job slot before ITS got +around to printing the tattle on the system console. I don't know why the +.SHUTDN uuo doesn't just do a BUG INFO to report what happened rather than +using the buggy kludge that it does... + +Date: Mon, 9 Feb 87 11:54:49 EST +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <151362.870209.ZVONA@AI.AI.MIT.EDU> + +AI crashed at 9:44 this morning with a bughalt message + +PK: GF node wasnt on list + +This came right after + +IMP output msg too big 2996 09:44:12 + +which is probably responsible. + +Crash dump in crash;crash pknogf. + +Date: Tue, 3 Feb 87 07:31:26 EST +From: "Pandora B. Berman" +Subject: MD status +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <148487.870203.CENT@AI.AI.MIT.EDU> + +OZ has a recalcitrant disk drive. lester has tried this and that but +it's still down. so he asked about hooking it up to one of the KSs for +testing. alan and i told him he could use MD. he promised to write +something in MD's log noting what he was doing. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 31 Jan 87 17:00:15 EST +Date: Sat, 31 Jan 87 17:01:01 EST +From: Alan Bawden +Subject: TCP buffers +To: BUG-ITS@MC.LCS.MIT.EDU, BUG-COMSAT@MC.LCS.MIT.EDU +Message-ID: <165683.870131.ALAN@MC.LCS.MIT.EDU> + +I wish we could figure out why ITS consistently dribbles away its TCP +buffers until there are none left. + +I also wish that when this happens, COMSAT didn't exhibit this bizare +behavior: + +162430 Unqueueing to host THEORY.LCS.MIT.EDU +162431 ICP->THEORY.LCS.MIT.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162432 Unqueueing to host RED.RUTGERS.EDU +162433 ICP->RED.RUTGERS.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162434 Unqueueing to host BRL-SEM.ARPA +162435 ICP->BRL-SEM.ARPA (TCP-SMTP=Bad Greeting="221 BCNU") +162435 Unqueueing to host LBL.ARPA +162436 ICP->LBL.ARPA (TCP-SMTP=Bad Greeting="221 BCNU") +162437 Unqueueing to host SDCSVAX.UCSD.EDU +162438 ICP->SDCSVAX.UCSD.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162439 Unqueueing to host R20.UTEXAS.EDU +162440 ICP->R20.UTEXAS.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162441 Unqueueing to host SAIL.STANFORD.EDU +162442 ICP->SAIL.STANFORD.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162444 Unqueueing to host ATHENA.MIT.EDU +162444 ICP->ATHENA.MIT.EDU (TCP-SMTP=Bad Greeting="221 BCNU") +162445 Unqueueing to host CHARON.MIT.EDU +162446 ICP->CHARON.MIT.EDU (TCP-SMTP=Bad Greeting="221 BCNU") + + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 JAN 87 15:01:45 EST +Received: from KAREN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 19480; Mon 26-Jan-87 15:03:06 EST +Date: Mon, 26 Jan 87 15:03 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <870126150304.6.ALAN@KAREN.AI.MIT.EDU> + +Despite the fact that in the IAP guide I promised four sessions of the ITS +course, there will -not- be a fourth session this week. See you all again +next year! + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 22 JAN 87 20:04:59 EST +Date: Thu 22 Jan 87 20:05:01-EST +From: "John Wroclawski" +Subject: RP06 undocumented behavior +To: bug-its@AI.AI.MIT.EDU +Message-ID: <12273069628.19.JTW@MIT-SPEECH> + + +The twenex world recently discovered that an RP0x which gets a header +compare error (HCE) without getting a header CRC error (HCRC) at the +same time may need to have a recalibrate operation done rather than +just a recenter and retry type thing. Otherwise the head ends up +mispositioned till it eventually slams into the stops (which either +fixes it or breaks it but good). + +Apparently this is contrary to what the "manual" says. + +I don't know what ITS does in this case. Just writing it down for +the record. +------- + +Date: Thu, 22 Jan 87 04:16:36 EST +From: Alan Bawden +Subject: PEEK shouldn't ever PCLSR anyone +To: BUG-COMSAT@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 21 Jan 1987 00:25 EST from Rob Austein +Message-ID: <143202.870122.ALAN@AI.AI.MIT.EDU> + +After fixing PEEK to not needlessly PCLSR device servers a few days ago, I +have been periodically watching COMSAT and DQDEV on MC waiting to catch +them in the act of getting hung up. This afternoon I found them in the +wedged state and was able to figure out what causes the problem. The +problem has nothing to do with the BOJ/JOB code, and is not a bug in DQDEV. +Actually it is an apparently long-standing timing error in the +implementation of .HANG. + +Specifically, when you did (as DQDEV does) + + TRNN AC,%FLAG + .HANG + +the code for .HANG knew that the TRNN instruction could never skip unless +the C(AC) changed, and since nothing can change a job's accumulators +without PCLSRing the job, .HANG could simply hang forever. This is all +well and good, except .HANG neglected to run the instruction once itself to +be certain that AC hadn't been changed by an interrupt routine that ran +-between- the TRNN and the .HANG. + +I have assembled an ITS with the fix and I will test it the next time I get +a chance. + +Date: Wed, 21 Jan 87 02:12:12 EST +From: "Pandora B. Berman" +Subject: ai crashed +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <142633.870121.CENT@AI.AI.MIT.EDU> + +again, or halted, or whatever it was. see CRASH;UNIT0 FUKT. Unit 0 had +spun down. i spun it up and reloaded. + +Date: Fri, 16 Jan 87 17:13:23 EST +From: Alan Bawden +Subject: [MOON: Mysterious MC won't shut down crash explained] +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <141115.870116.ALAN@AI.AI.MIT.EDU> + +After reading the following bug report, you will realize that this reveals +a bug in the way jobs are sometimes killed when they have locks locked. If +you -first- clobbering their PC's to point to a .LOGOUT in location 0, and +only the .LOGOUT then checks to see if the PC is in the critical routine +table, then the critical routine table is worthless... + +Date: Fri, 16 Jan 87 01:39:40 EST +From: David A. Moon +To: ALAN at AI.AI.MIT.EDU +cc: BUG-COMSAT at AI.AI.MIT.EDU +Re: Mysterious MC won't shut down crash explained + +You aren't going to like this one damn bit. + +TMPLOC 44, -LCCBLK,,CCBLK ;aobjn ptr to critical code table for lock hacking + +looks like it would put an aobjn pointer into location 44, doesn't it? + +It doesn't. It puts -LCCBLK into location 44 and CCBLK into the next +location inline (where it happens to get ignored). This is because + + ; TMPLOC , - puts argument at given LOC + ; without changing location counter outside macro call. +DEFINE TMPLOC VAL,?ARG +[definition deleted] + +Why the heck doesn't TMPLOC use a rest-of-line arg? + +Now -LCCBLK is -1,,777772, an aobjn pointer to a page that is mapped +into absolute page 120, which contains whatever it happens to contain. +If the PC happens to lie within the bounds of the first word there, +the system executes the second word there as an instruction, with the +extra added feature (see IODCD1 in ITS) that if the LH is zero, SETOM +is substituted. Thus when Comsat executes the .LOGOUT that ALOGO4 +puts into its AC 0 when the system job guns it, the unlocking of +Comsat's locked switches, if that absolute page contains zeros, +will do a SETOM 0. If Comsat doesn't pclsr, that -1 is never seen, +but if it does PCLSR out of the .LOGOUT (we still don't know where +it pclsred from), it executes that -1 as an instruction, causing the +lossage we saw. Yow! + +It looks like it's been this way for eons. Maybe this also explains +why the Comsat locks don't always seem to work right. + +Received: from MIT-MULTICS.ARPA (TCP 1200000006) by AI.AI.MIT.EDU 16 Jan 87 04:17:47 EST +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2715239312833556@MIT-MULTICS.ARPA>; 16 Jan 1987 04:08:32 est +Message-ID: <227734@QZCOM> +In-Reply-To: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> +Date: 16 Jan 87 01:07 +0100 +From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-To: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA, + ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA, + INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Subject: IAP + +If someone has a home-video-tape-recorder-and-camera-set at MIT +availible, it wold be nice to have a vide tape of the lecture, +for us that can't show up. + + + + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 15 JAN 87 15:29:36 EST +Received: from PIGPEN.AI.MIT.EDU by OZ.AI.MIT.EDU via Chaosnet; 15 Jan 87 15:21-EST +Date: Thu, 15 Jan 87 15:23 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <870107165040.1.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> + +Those of you who missed the second session of the ITS course last night +should be aware that next week we will once again meet on -Wednesday-. +It seems I screwed up when I thought we couldn't have the playroom this +Tuesday, and it is actually -next- Tuesday than has the conflict. + +Next Wednesday we'll do something about Job Devices. How to write one, or +how they are implemented, or something like that... + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 7 JAN 87 16:52:54 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 17414; Wed 7-Jan-87 16:50:47 EST +Date: Wed, 7 Jan 87 16:50 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <870107165040.1.ALAN@PIGPEN.AI.MIT.EDU> + +Those of you who missed the first session of the ITS course last night +should be aware that next week we will meet on -Wednesday- instead of +Tuesday. The following week we will go back to meeting on Tuesdays. (All +meetings are in the 7th floor playroom at 7:30). + +Next Wednesday we will hear a bit about the ITS filesystem (not all that +much to tell) and then Ed Schwalenberg will tell us about "CAMEXEC: An +ITS-style Operating System for PDP11's". + +Date: Sun, 4 Jan 87 05:03:53 EST +From: Alan Bawden +Subject: IAP +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <136289.870104.ALAN@AI.AI.MIT.EDU> + +Yes, there will be an IAP course this January about ITS. The first meeting +will take place in the 7th floor playroom this Tuesday (the 6th) at 7:30 PM. + +On Tuesday we will talk about a number of things, including what topics +people might want to hear about in future sessions. As a main event, I am +preparing an explanation of everyone's favorite ITS feature: + + PCLSRing: What it is, how it's implemented, + and why Lisp Machines should have it. + +I'll try and satisfy both the people who want to hear about low-level, +bits-between-the-toes issues, and those who want to learn universal, cosmic +principles. I'll even relate PCLSRing to quantum mechanics. + +Date: Thu, 1 Jan 87 15:43:25 EST +From: Alan Bawden +Subject: MX unit #5 +To: KLOTZ@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 31 Dec 86 22:12:10 EST from Leigh L. Klotz +Message-ID: <135733.870101.ALAN@AI.AI.MIT.EDU> + + Date: Wed, 31 Dec 86 22:12:10 EST + From: Leigh L. Klotz + I just got a non-recoverable disk data error on + klotz;emacs :ej, which is on 14. + +When you log in, SYS:SYSTEM MAIL warned you that unit #5 was sinking fast. +Yeah, many files on that pack/drive have suffered. + +Perhaps I'll try swapping that pack with the one on unit #4 and see what +happens. If we are really lucky, that will destroy both of them! + + Date: Wed, 31 Dec 86 22:28:06 EST + From: Leigh L. Klotz + I renamed the bad file to klotz;.bad. :EJ, but the error went away. + It had been repeatable. Is anyone interested in this? Should I be + sending mail to POOR-MC? + +POOR-MC is probably the right place, although perhaps there is a POOR-MX +list that I don't know about. (POOR-KL?) + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 31 Dec 86 22:46:03 EST +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by MC.LCS.MIT.EDU 31 Dec 86 22:26:36 EST +Date: Wed, 31 Dec 86 22:28:06 EST +From: "Leigh L. Klotz" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <963808.861231.KLOTZ@MX.LCS.MIT.EDU> + +I renamed the bad file to klotz;.bad. :EJ, but the error went away. +It had been repeatable. Is anyone interested in this? Should I be +sending mail to POOR-MC? + + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 31 Dec 86 22:19:49 EST +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by MC.LCS.MIT.EDU 31 Dec 86 22:10:41 EST +Date: Wed, 31 Dec 86 22:12:10 EST +From: "Leigh L. Klotz" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <963796.861231.KLOTZ@MX.LCS.MIT.EDU> + +I just got a non-recoverable disk data error on +klotz;emacs :ej, which is on 14. + + + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 22 Dec 86 20:39:45 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 29850; Mon 22-Dec-86 20:36:56 EST +Date: Mon, 22 Dec 86 20:36 EST +From: David A. Moon +Subject: Kludging around the KS's flakey disk +To: Rob Austein +cc: Bug-ITS@MIT-AI.ARPA, Poor-MC@MIT-AI.ARPA +In-Reply-To: <861222020255.2.SRA@WHORFIN.LCS.MIT.EDU> +Supersedes: <861222150854.8.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <861222203625.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Mon, 22 Dec 86 02:02 EST + From: Rob Austein + + I just spent five minutes looking at the DISK code. Based on that + wealth of experience, it appears to me that if I were to bring up the KS + with UNSAFE+1 JFCL'd out, it would stop doing a BUGPAUSE every hour or + so. + + Somebody tell me why I shouldn't do this, before I wear out the $P keys + on the KS's console.... + +The idea was that if the disk goes unsafe, is reset, and goes unsafe +again within one second, it is probably about to explode and the fire +department should be called. It looks like the code jumps to UNSAFE +for a lot of different reasons, not all of which are the drive going +unsafe. The drive also goes unsafe for a lot of different reasons, +some of more consequence than others. + +I agree that if you JFCL out the BUGPAUSE it won't do it any more, so if +you think this won't do irreparable harm to the disk, go ahead. + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 22 Dec 86 02:04:20 EST +Received: from WHORFIN.LCS.MIT.EDU by XX.LCS.MIT.EDU via Chaosnet; 22 Dec 86 02:04-EST +Date: Mon, 22 Dec 86 02:02 EST +From: Rob Austein +Subject: Kludging around the KS's flakey disk +To: Bug-ITS@AI.AI.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +Message-ID: <861222020255.2.SRA@WHORFIN.LCS.MIT.EDU> + +I just spent five minutes looking at the DISK code. Based on that +wealth of experience, it appears to me that if I were to bring up the KS +with UNSAFE+1 JFCL'd out, it would stop doing a BUGPAUSE every hour or +so. + +Somebody tell me why I shouldn't do this, before I wear out the $P keys +on the KS's console.... + +Date: Sun, 21 Dec 86 23:17:45 EST +From: Alan Bawden +Subject: RP06s eat dead bears +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 21 Dec 86 13:52:25 EST from David Vinayak Wallace +Message-ID: <133398.861221.ALAN@AI.AI.MIT.EDU> + + Date: Sun, 21 Dec 86 13:52:25 EST + From: David Vinayak Wallace + AI hung in a fashion I'd never seen on the KS's: disk accesses would + hang forever. Pages in core were easily accessible; ITS ran fine + unless you tried to touch the disk. I could create a job and run some + instructions in low memory, but when I tried to do a .CALL OPEN ITS + hung. + +You must have been lucky. Our RP06's have been causing ITS to hang in this +way ever since day 1. + + I went upstairs and the system console said: + DSK: UNIT #1 CAME BACK ONLINE + DSK: UNIT #0 CAME BACK ONLINE + DSK: UNIT #1 CAME BACK ONLINE + and some status registers. For all three, ER1= 40000 which is Drive + Unsafe. + +Unsafe almost always comes on. The interesting bits were the ones in ER3, +which according to the crash dump were (according to the crufty +documentation) "AC power low", "DC power low" and "Spare" (!). + + I dumped it to CRASH DSKOFL, not that I think it will help any. + +Why? I manadged to get the ER3 bits out of it. + + Notice that the crash file was written out but the dates were not set + on the file? + +DSKDMP never sets write dates, because it doesn't know how to tell the +time. The DMPCPY program (which TARAKA runs when the system boots) sets +the date on any file it suspects is a crash dump. In this case, DMPCPY +wasn't able to set the date either, because you had cold booted the +machine, so ITS didn't know what time it was when DMPCPY ran. + + ... By the way, should these be going to BUG-ITS or KS-ITS -- I can + never tell any more. + +You sent this to the right place. KS-ITS is almost -never- the right place +to send a Bug Report. + +Date: Sun, 21 Dec 86 22:34:01 EST +From: Alan Bawden +Subject: Gee, that's not his host's name +To: RDZ@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, BUG-LISP@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 20 Dec 86 13:22 EST from Ramin Zabih +Message-ID: <133383.861221.ALAN@AI.AI.MIT.EDU> + + Date: Sat, 20 Dec 86 13:22 EST + From: Ramin Zabih + Typing :FINGER on AI just produced this output: + ... + RDZ Ramin Zabih F T23 <>: 709 x8827 RDZ, Zvona (Chaos) + + It seems that someone is confused about the name of the 3600 I'm using... + +RDZ's host has a short name of "NULL". He's been expecting the name "NULL" +to break some program ever since he named it that. I presume thats why he +mailed this bug report to Bug-LISP. + +Nothing's broken actually. I was just hacking him... + +Date: Sun, 21 Dec 86 13:52:25 EST +From: David Vinayak Wallace +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <133197.861221.GUMBY@AI.AI.MIT.EDU> + +AI hung in a fashion I'd never seen on the KS's: disk accesses would +hang forever. Pages in core were easily accessible; ITS ran fine unless +you tried to touch the disk. I could create a job and run some instructions +in low memory, but when I tried to do a .CALL OPEN ITS hung. + +I went upstairs and the system console said: +DSK: UNIT #1 CAME BACK ONLINE +DSK: UNIT #0 CAME BACK ONLINE +DSK: UNIT #1 CAME BACK ONLINE +and some status registers. For all three, ER1= 40000 which is Drive Unsafe. + +I dumped it to CRASH DSKOFL, not that I think it will help any. Notice +that the crash file was written out but the dates were not set on the file? + +I cold-booted just in case -- ITS seems to be running fine now. By the way, +should these be going to BUG-ITS or KS-ITS -- I can never tell any more. + +david + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 20 DEC 86 13:23:05 EST +Received: from NULLSTELLENSATZ.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 16312; Sat 20-Dec-86 13:22:41 EST +Date: Sat, 20 Dec 86 13:22 EST +From: Ramin Zabih +Subject: Gee, that's not my host's name +To: bug-lisp@OZ.AI.MIT.EDU, bug-its@AI.AI.MIT.EDU +Message-ID: <861220132243.9.RDZ@NULLSTELLENSATZ.AI.MIT.EDU> + +Typing :FINGER on AI just produced this output: + +-User- --Full name-- Jobnam Idle TTY -Console location- +___005 < [not logged in] HACTRN 23.T05 906 x1729 CENT, OAF +KWH Ken Haase HACTRN *:**.T15 Net site PREP (Chaos) +DPH Daniel Huttenlocher HACTRN 46.T16 723 x8843 Alan, DPH +RDZ Ramin Zabih F T23 <>: 709 x8827 RDZ, Zvona (Chaos) + +It seems that someone is confused about the name of the 3600 I'm using... + + + +Date: Fri, 19 Dec 86 02:54:39 EST +From: Alan@AI,Moon@AI +Sender: ALAN@AI.AI.MIT.EDU +Subject: OK, I just saw it happen again. +To: BUG-COMSAT@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <132522.861219.ALAN@AI.AI.MIT.EDU> + +For most of yesterday (Thursday the 18th) COMSAT on MC was catatonic. Our +guess is that it was stuck in a JOB device wait (waiting for the DQ +device). As soon as Alan looked at the situation COMSAT started running +again, so probably something he did caused COMSAT to get PCLSR'd out of the +system call for the first time all day, and the second time the timing +screw did not occur. + +The right thing is for someone to fix the last bug in the JOB/BOJ code. + +A quick fix the COMSAT maintainers might consider, is to take an occasional +%PIRLT interrupt to keep its interactions with DQ lubricated. + +A better fix would be for Alan to finish up the improved Domain Demon +interface, so that COMSAT can use it instead, and not be subject to this +particular class of ITS bug. + +Date: Thu, 18 Dec 86 02:57:19 EST +From: Alan Bawden +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <132118.861218.ALAN@AI.AI.MIT.EDU> + +TTYSET on a TTY opened as a device (rather than as a console) +clobbers the wrong TTYST* words! + +Date: Thu, 4 Dec 86 14:00:04 EST +From: Alan Bawden +Subject: more fukt +To: CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Thu 4 Dec 86 03:20:35 EST from Pandora B. Berman +Message-ID: <126472.861204.ALAN@AI.AI.MIT.EDU> + + Date: Thu, 4 Dec 86 03:20:35 EST + From: Pandora B. Berman + ... maybe lester didn't fix the disk hard enough. + +I don't think it is related. This is a problem we have had ever since we +went to two drives. The symptom is that for no apparent reason a drive +interrupts you and reports that it has just recently come back online. +Both drives do it. We have no idea why they do this. We also have no idea +why the code that we put in to recover from this doesn't work. (Perhaps we +need to reset the drive harder when this happens.) Luckily this doesn't +seem to happen all that often, but it has been the most common reason for +AI crashes since we got the new drive. + +It also seems that if one drive is in the middle of a transfer, and you +tell the other drive to do something, the first drive will interrupt you +and complain that you shouldn't bother it while it is busy. We simply +ignore these complaints, which seems to work just fine. (Like it's +happened 470 times since AI came up 10 hours ago...) + +Date: Thu, 4 Dec 86 03:20:35 EST +From: "Pandora B. Berman" +Subject: more fukt +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <126255.861204.CENT@AI.AI.MIT.EDU> + +it happened again. dumped to CRASH;FUCKED AGAIN. +maybe lester didn't fix the disk hard enough. + +Date: Thu, 4 Dec 86 01:19:00 EST +From: "Pandora B. Berman" +Subject: &^*^&$%!! +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <126198.861204.CENT@AI.AI.MIT.EDU> + +things were hanging all over, and alan diagnosed that a disk had briefly +gone offline, and AI had not quite recovered correctly. only thing i +could do, really, was to lift switch 0 and reload. crash dump (i think) +to CRASH;FUCKME HARDER, a fine traditional name. + +Date: Wed, 19 Nov 86 00:52:23 EST +From: "Pandora B. Berman" +Subject: ITS boot tapes +To: USER-ACCOUNTS@AI.AI.MIT.EDU, mkunix!shawn@EDDIE.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].120162.861119.CENT> + + From: mkunix!shawn@EDDIE.MIT.EDU + Date: Fri, 14 Nov 86 16:56:21 est + To: mit-eddie!user-accounts@mit-ai + Subject: ITS boot tapes + Howdy, I would like to make a copy of the great ITS operating system, + yes, I know, most people would say 'why', but someday I hope to work in + a group that has an old KL/KA and bring up ITS... Being in DEC this is + possable, although probably not likely. + In any case, I wonder if someone would be willing at some point to + show, or instruct me, or guide me in some way in how to make the two + tapes I would need to a) Boot ITS and build a system, and b) Load in + the sources to ITS, and any applications that are deemed ok to + take/have. + Please forgive me if this is the wrong forum, but I have been trying to + find help from various points and ran out of places to ask... Thanks + for any help. + -- Shawn + Btw, it may be simpler for anyone who wishes to reply to me, to just + send me mail on MC, since I don't know if ITS can deal with uucp path + names, although it may. Thanks again. + +of course ITS can deal with uucp paths, at least up to a point. however, as +you suspect, USER-A is the wrong place to ask. even you could have thought +of asking BUG-ITS. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 16 NOV 86 21:37:17 EST +Date: Sun, 16 Nov 86 21:31:19 EST +From: Rob Austein +Subject: KL: .; IOELEV * +To: BUG-its@AI.AI.MIT.EDU, poor-mx@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].958244.861116.SRA> + +I assembled and installed a new version of IOELEV for the KL. The +only change is that it now knows that its name has changed (no longer +tells you you are connected to MC). I'll change the namespace +sometime soon if there aren't any problems with this. + +While I was installing this silliness, I reorganized the IOELEV +binaries. KL Console-11 binaries are (as before) in IOELEV nnnBIN +with IOELEV BIN as a link to the latest version (now IOELEV 431BIN). +The AI-Chaos-11 binaries are now in IOELEV nnnAI with a link from +IOELEV AIBIN to the latest version (IOELEV 430AI, the one where I made +subnet six the "primary" address of AI-11 so dover spooling would work +better). + +I don't expect any problems. Next person who cold boots the KL please +tell me what happens (if no problems, tell me that). + +--Rob + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 13 NOV 86 19:52:40 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 11282; Thu 13-Nov-86 19:47:32 EST +Date: Thu, 13 Nov 86 19:47 EST +From: Alan Bawden +Subject: AI wedged itself +To: SRA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].117740.861112.SRA> +Message-ID: <861113194734.2.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Wed, 12 Nov 86 16:45:19 EST + From: Rob Austein + Dump in AI:CRASH;WEDGED IDUNNO, not that I expect anybody to have any + use for it. + +Looks like there was a power glitch or something. I'm told there were air +conditioning problems at the time as well. + +Date: Wed, 12 Nov 86 16:52:39 EST +From: Rob Austein +Subject: "ECC" errors? +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].117747.861112.SRA> + +Happened to be next to AI (had just rebooted it). Heard one of the +RP06s start fibrulating (the sort of mad seek motion that I normally +only see on XX when both XX and its FE are trying to write on drive +zero at the same time). A few seconds later an ECC message pops up on +the console. Don't know if it means anything, but thought I should +report it. + +Date: Wed, 12 Nov 86 16:45:19 EST +From: Rob Austein +Subject: AI wedged itself +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].117740.861112.SRA> + +Dump in AI:CRASH;WEDGED IDUNNO, not that I expect anybody to have any +use for it. +--Rob + +Received: from DIAMOND.S4CC.Symbolics.COM (TCP 20024231403) by AI.AI.MIT.EDU 4 Nov 86 16:33:11 EST +Received: from KOYAANISQATSI.S4CC.Symbolics.COM by DIAMOND.S4CC.Symbolics.COM via CHAOS with CHAOS-MAIL id 24769; Tue 4-Nov-86 16:27:49 EST +Date: Tue, 4 Nov 86 16:27 EST +From: David C. Plummer +Subject: For those of you around MIT this January +To: Alan Bawden , KS-ITS@AI.AI.MIT.EDU, + BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].110499.861025.ALAN> +Message-ID: <861104162735.2.DCP@KOYAANISQATSI.S4CC.Symbolics.COM> + + Date: Sat, 25 Oct 86 01:38:44 EDT + From: Alan Bawden + + Hackers, + + It has been suggested that it might be a good idea to teach an ITS course + during IAP this year. We have done this twice before with somewhat mixed + results. A few sessions were quite memorable, and a few were dogs. Before + I decide if I want to front for this again this year, I would like to hear + from some other people. Specifically I want to hear: + + Things people want to learn about. + + Opinions about what has worked in the past. + + Volunteers who would enjoy teaching about something. + + Ways of using this to burn excess machine cycles on our many (!) ITS + machines. (Student project ideas?) + +I don't think I have any of my notes from IAP'83. Do you (Alan) have +any from IAP'84? I seemed to remember talking about some of the +following: + UUOs/.CALL, their skip-on-success feature, their argument + passing/returning syntax + TTY management + Devices, MLDEV:, CLU/I/O/A:, etc + Jobs (and BOJs) + File system, links, etc. + Greenblat's History lecture + Moon's hardware description of (the original) AI +With the general proliferation of PCs and high level languages, some of +the more gutsy things, which are the interesting things, may require a +(refresher) course on the assembly language concepts. + + +Received: from MIT-MULTICS.ARPA by AI.AI.MIT.EDU 27 Oct 86 06:51:15 EST +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2708249629097960@MIT-MULTICS.ARPA>; 27 Oct 1986 06:33:49 est +Date: 26 Oct 86 23:36 +0100 +From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-to: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: KS-ITS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, "Alan Bawden" + +Subject: For those of you around MIT this January +Message-ID: <212189@QZCOM> +In-Reply-To: <[AI.AI.MIT.EDU].110499.861025.ALAN> + +We are interseted from Stockholm, two persons, major interest: +ITS Internals, what is doing what, and what is speaking to what +internaly. + + + + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 25 Oct 86 15:47:35 EDT +Date: Sat, 25 Oct 1986 15:46 EDT +Message-ID: +From: Rob Austein +To: Alan Bawden +Cc: BUG-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Subject: For those of you around MIT this January +In-reply-to: Msg of 25 Oct 1986 01:38-EDT from Alan Bawden + +Gee, I haven't taught a short course since I left Wesleyan. Sounds +like fun. TECO, theory and practice? + +Received: from eneevax.umd.edu by AI.AI.MIT.EDU 25 Oct 86 02:21:54 EDT +Received: by eneevax.umd.edu (5.9/4.7) + id AA23785; Sat, 25 Oct 86 02:20:02 EDT +Date: Sat, 25 Oct 86 02:20:02 EDT +From: Douglas Humphrey +Message-Id: <8610250620.AA23785@eneevax.umd.edu> +To: ALAN@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Subject: Re: For those of you around MIT this January + +Let me know when these courses would be and such and count me in. +If I'm going to have one, these might be real helpful and +certainly a Lot of fun. + +Doug + +Date: Sat, 25 Oct 86 01:38:44 EDT +From: Alan Bawden +Subject: For those of you around MIT this January +To: KS-ITS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].110499.861025.ALAN> + +Hackers, + +It has been suggested that it might be a good idea to teach an ITS course +during IAP this year. We have done this twice before with somewhat mixed +results. A few sessions were quite memorable, and a few were dogs. Before +I decide if I want to front for this again this year, I would like to hear +from some other people. Specifically I want to hear: + +Things people want to learn about. + +Opinions about what has worked in the past. + +Volunteers who would enjoy teaching about something. + +Ways of using this to burn excess machine cycles on our many (!) ITS +machines. (Student project ideas?) + +Date: Thu, 23 Oct 86 01:56:05 EDT +From: Ray Hirschfeld +Subject: emacs lossage +To: ALAN@AI.AI.MIT.EDU +cc: BUG-EMACS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 22 Oct 86 19:07:28 EDT from Alan Bawden +Message-ID: <[AI.AI.MIT.EDU].109744.861023.RAY> + + Date: Wed, 22 Oct 86 19:07:28 EDT + From: Alan Bawden + To: RAY at AI.AI.MIT.EDU + cc: BUG-EMACS at AI.AI.MIT.EDU, BUG-ITS at AI.AI.MIT.EDU + Re: emacs lossage + ... + Well, a quick peek at your directory reveals: + + AI RAY + FREE BLOCKS #0=285 #1=2674 + ... + 0 TS E 59 +161 ! 10/21/86 11:27:25 (10/22/86) + ... + + A look at this file reveals that it is an SBLK file, so it is unlikely that + this is an EMACS that you dumped out for yourself intentionally. + (Especially since it appears to be a vanilla EMACS with no libraries + loaded.) Perhaps you should delete this file. + +Thanks, Alan! I never thought to look there. Removing the bogus +emacs fixed the problem. I wonder where the hell it came from. + + Ray + +Date: Wed, 22 Oct 86 19:07:28 EDT +From: Alan Bawden +Subject: emacs lossage +To: RAY@AI.AI.MIT.EDU +cc: BUG-EMACS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 22 Oct 86 18:44:59 EDT from Ray Hirschfeld +Message-ID: <[AI.AI.MIT.EDU].109549.861022.ALAN> + + Date: Wed, 22 Oct 86 18:44:59 EDT + From: Ray Hirschfeld + Emacs on AI has been dying on me repeatedly over the last few days. + It always chokes in the same place, with a message like: + + .VAL 0; 6767>>MOVEM 6,1377 6/ 177 1377/ 176 + + A quick peek reveals that this immediately follows a .call corblk, + which I guess is failing. + + Proceeding the job makes it work until the next try. + +Well, a quick peek at your directory reveals: + +AI RAY +FREE BLOCKS #0=285 #1=2674 + ... + 0 TS E 59 +161 ! 10/21/86 11:27:25 (10/22/86) + ... + +A look at this file reveals that it is an SBLK file, so it is unlikely that +this is an EMACS that you dumped out for yourself intentionally. +(Especially since it appears to be a vanilla EMACS with no libraries +loaded.) Perhaps you should delete this file. + +Date: Wed, 22 Oct 86 18:44:59 EDT +From: Ray Hirschfeld +Subject: emacs lossage +To: BUG-EMACS@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].109535.861022.RAY> + +Emacs on AI has been dying on me repeatedly over the last few days. +It always chokes in the same place, with a message like: + +.VAL 0; 6767>>MOVEM 6,1377 6/ 177 1377/ 176 + +A quick peek reveals that this immediately follows a .call corblk, +which I guess is failing. + +Proceeding the job makes it work until the next try. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 SEP 86 20:50:06 EDT +Date: Fri 26 Sep 86 20:48:06-EDT +From: "John Wroclawski" +Subject: Re: dump code fukt +To: Moon@SCRC-STONY-BROOK.ARPA, CENT@AI.AI.MIT.EDU +cc: BUG-DUMP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <860926124710.2.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12242133556.4.JTW@MIT-SPEECH> + + From: David A. Moon + Subject: dump code fukt + + + Date: Fri, 26 Sep 86 03:56:39 EDT + From: "Pandora B. Berman" + + .... + +My first guess is hardware flaking, possibly followed by inadequate resetting +action by the software. The code hasn't changed in forever. + + MT:RETRYING WRITE OPERATION + MAG TAPE STATUS TM03 error status decode routine needs to be written ? + MTAPE: FORMATTER ERROR, STATUS= 140600,,40000 + +This is transport unsafe, usually means it went offline while trying to +write. + + MTAPE: FORMATTER ERROR, STATUS=150660,,100320 + MAG TAPE STATUS TM03 error status decode routine needs to be written ? + +This is a mess. To some extent the bits are inconsistant (seems to imply a +number of data transfer errors during a positioning command), but could +possibly be interpreted as the result of a misformed data transfer command. + + I assume multi-reel incremental dumps have worked in the past... + +Is this actually true? +------- + +Received: from STONY-BROOK.SCRC.Symbolics.COM by AI.AI.MIT.EDU 26 Sep 86 12:55:07 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 115737; Fri 26-Sep-86 12:47:14 EDT +Date: Fri, 26 Sep 86 12:47 EDT +From: David A. Moon +Subject: dump code fukt +To: Pandora B. Berman , JTW@AI.AI.MIT.EDU +cc: BUG-DUMP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].98958.860926.CENT0> +Message-ID: <860926124710.2.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 26 Sep 86 03:56:39 EDT + From: "Pandora B. Berman" + + when i tried to dump AI (incr) this evening, i lost. AI 230 ran off the + end of the reel somewhere in the middle of VAFB;, saying + + MT:RETRYING WRITE OPERATION + MAG TAPE STATUS TM03 error status decode routine needs to be written ? + MTAPE: FORMATTER ERROR, STATUS= 140600,,40000 + + and giving me a DUMP prompt. thinking this might just be a case of + terminal dirk, i cleaned the drive and started over again with the + same tape. same result. so i tried dumping onto AI 231. this time, i + got + + MTAPE: FORMATTER ERROR, STATUS=150660,,100320 + MAG TAPE STATUS TM03 error status decode routine needs to be written ? + + the job at a prompt, and the tape waiting at EOT. so i rewound it and + ICHECK'd it. the ICHECK ended without any strange msgs. + + maybe the first time was just due to incorrectly placed-EOT mark (it + did have one, but i'm not sure which side they're -supposed- to be on), + but the second tape worked OK. so something is wrong here.. + +The MT: and MTAPE: messages (why the inconsistency?) show up in :PEEK ", +so they came from the ITS system rather than from DUMP (it can be hard +to distinguish when you run DUMP on the system-console). The +"error status decode routine needs to be written" message came from DUMP. +I guess its routine for explaining the details of tape errors was never +converted from the version for the KA/KL tape controller. + +John, do you know what those octal numbers in the formatter error message +mean? I assume multi-reel incremental dumps have worked in the past, so +has something in the hardware broken? The tape code in ITS hasn't changed +recently, has it? + + +Date: Fri, 26 Sep 86 03:56:39 EDT +From: "Pandora B. Berman" +Sender: CENT0@AI.AI.MIT.EDU +Subject: dump code fukt +To: BUG-DUMP@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].98958.860926.CENT0> + +when i tried to dump AI (incr) this evening, i lost. AI 230 ran off the +end of the reel somewhere in the middle of VAFB;, saying + +MT:RETRYING WRITE OPERATION +MAG TAPE STATUS TM03 error status decode routine needs to be written ? +MTAPE: FORMATTER ERROR, STATUS= 140600,,40000 + +and giving me a DUMP prompt. thinking this might just be a case of +terminal dirk, i cleaned the drive and started over again with the +same tape. same result. so i tried dumping onto AI 231. this time, i +got + +MTAPE: FORMATTER ERROR, STATUS=150660,,100320 +MAG TAPE STATUS TM03 error status decode routine needs to be written ? + +the job at a prompt, and the tape waiting at EOT. so i rewound it and +ICHECK'd it. the ICHECK ended without any strange msgs. + +maybe the first time was just due to incorrectly placed-EOT mark (it +did have one, but i'm not sure which side they're -supposed- to be on), +but the second tape worked OK. so something is wrong here. + +Date: Fri, 19 Sep 86 15:03:13 EDT +From: Ramin Zabih +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].96071.860919.RDZ> + +AI crashed with "TTY: buffer empty at TYIREM". Dump is in +CRASH;TYIREM CRASH + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 13 SEP 86 21:40:30 EDT +Received: from ML.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 13 SEP 86 21:19:54 EDT +Received: from AI.AI.MIT.EDU by ML.AI.MIT.EDU via Chaosnet; 13 SEP 86 21:04:42 EDT +Date: Sat, 13 Sep 86 21:08:22 EDT +From: Alan Bawden +Subject: When you run out of TCP buffers. +To: BUG-ITS@ML.AI.MIT.EDU +cc: BUG-COMSAT@ML.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].93646.860913.ALAN> + +There must be a path through the ITS TCP code that fails to free a buffer +somehow. Twice I have seen MC run itself completely out of buffers. (See +the dump MC:CRASH;CRASH TCPFUL, for an example.) In the most recent +example, ITS had been running for 35 days before this happened, which might +be relevant, although in the previous case it had only been running for 10 +days. + +Bug-COMSAT: COMSAT behaves weirdly when this happens. Take a look at some +of the recent stats files on MC. Like for -every- host it tries to contact +with TCP it reports: Bad Greeting="+" or somesuch. + +Date: Mon, 8 Sep 86 11:04:04 EDT +From: Daniel Huttenlocher +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].92012.860908.DPH> + +AI bughalted trying to free a packet still in use. Crash dump +in PKT USE. + +Date: Thu, 4 Sep 86 15:29:10 EDT +From: Daniel Huttenlocher +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].90952.860904.DPH> + +AI got a system revived at 14:38, and seemed to leave all jobs +hung or detached (at least ignoring tty input). about 45 mins later +it started printing system full messages on the console. dumped +to SYS FULL + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 21 Aug 86 02:00:37 EDT +Date: Thu, 21 Aug 1986 02:05 EDT +Message-ID: +From: Rob Austein +To: Alan Bawden +Cc: BUG-ITS@AI.AI.MIT.EDU +Subject: .RYEAR and time zones again +In-reply-to: Msg of 21 Aug 1986 00:12-EDT from Alan Bawden + +Making it a new system call is fine. What I'm looking for is a single +UUO that will return the information currently returned by .RLPDTM +plus time zone information. Doesn't have to be in .RLPDTM format, but +should be easy to calculate things like DATIME"TIMGTN from it. + +For that matter it would be a win if there was a system call that did +the DATIME"TIMGTN calculation with maximum hair and all the leap year +corrections understood to the human race, once, at system boot time, +then just added system uptime to that to get current time. This +business of having to recalculate the number of leap years since 1 Jan +1900 every time you want an absolute time value is for the birds. + +Date: Thu, 21 Aug 86 00:12:52 EDT +From: Alan Bawden +Subject: .RYEAR and time zones again +To: SRA@XX.LCS.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 20 Aug 1986 16:04 EDT from Rob Austein +Message-ID: <[AI.AI.MIT.EDU].86070.860821.ALAN> + +Why don't we just add another system call to return timezone related +information rather than trying to squeeze something into the last few bits +of .RYEAR? First, I dislike recycling fields that are documented to be +zero (rather than being documented as reserved for future expansion.) +Second, given the existence of half-hour and even quarter-hour timezones in +parts of the world, five bits isn't really enough. Third, while we are at +it, it might be a good idea to try and do something about generalizing the +daylight savings time stuff to cover whatever local laws there might be +geverning time. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 20 AUG 86 15:59:50 EDT +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 20 Aug 86 15:58:57 EDT +Date: Wed, 20 Aug 1986 16:04 EDT +Message-ID: +From: Rob Austein +To: bug-its@MC.LCS.MIT.EDU +Subject: .RYEAR and time zones again + +Sorry, I should have made that a formal propoal, bits and all. + +Time zones range from +1200 to -1200 (international date line, one day +apart from each other). + +The two possible formats would be: + + the five low bits of an integer in the range -12. -> +12. + +or + one sign bit (3.5) and four bits of integer range 0 -> +12. + +Only difference is in how you insert/extract it, of course. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 20 AUG 86 15:32:21 EDT +Date: Wed, 20 Aug 86 15:31:28 EDT +From: Rob Austein +Subject: .RYEAR and time zones +To: BUG-ITS@MC.LCS.MIT.EDU +cc: SRA@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].73280.860820.SRA> + +It would be nice if programs didn't have to have hardwired knowledge +of what time zone they are in (yes, I know, all ITS machines are at MIT +and thus in time zone -0500, but we're trying to be evangelical, here, +right?). + +Bits 3.5 -> 3.1 of the result from .RYEAR are defined as zero. +24. (maxium time zone plus one) is 30 in octal. Seems a timezone +would fit into those bits very nicely. + +Anybody know of anything that would break if this were done? +About the only thing I can think of that this would mess up +would be grossitudes like MOVEI AC,@MEM (ignoring the fact that +HRRZ AC,MEM works just as well). Does anybody really care +what's in those five zeroed bits? + +(No, nothing of vital importance depends on this, it would just make +some code I was writing a little cleaner.) + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 AUG 86 17:50:52 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 AUG 86 17:49:53 EDT +Date: Sun, 17 Aug 86 17:48:54 EDT +From: "Devon S. McCullough" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].941512.860817.DEVON> + +Closer examination of my problem controlling my telnet connection to MX +reveals that my logout file on AI is sending telnet IAC DONT TRBIN even +though the MX->AI connection is supdup and not telnet. The problem is +that the only way I can test for a telnet connection is to look at %TPMTA +because the IAC DO TRBIN in the login file turns off the %TPTEL bit! + +I guess the way to tell if you are telnetting or supduping is to first +look at %TPCBS, if it's on you're supdup, if it's off look at %TPMTA +and if it's on you're telnet, otherwise it's unknown but for my purposes +this case doesn't matter. Maybe the tctyp program should handle this? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 AUG 86 17:26:26 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 AUG 86 17:25:27 EDT +Date: Sun, 17 Aug 86 17:24:28 EDT +From: "Devon S. McCullough" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].941506.860817.DEVON> + +note that BUG^K prompts "to:" but should prompt "to: bug-" + +When I log in my init file checks for a telnet connection and +does :imgout 377 375 0 which sends a telnet IAC DO TRBIN so +that the TAC will pass @ characters instead of intercepting them, +and pass the 8th bit so the meta key works from my ann arbor. + +it looks like nethopping bereaks this somehow, because after +nethopping to either AI or OZ the TAC stops passing meta bits +and starts to intercept @ characters. + + --Devon + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 AUG 86 17:00:41 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 AUG 86 16:59:42 EDT +Date: Sun, 17 Aug 86 16:58:43 EDT +From: "Devon S. McCullough" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].941505.860817.DEVON> + +I tried nethopping from + +Date: Tue, 5 Aug 86 05:10:49 EDT +From: "Pandora B. Berman" +Subject: TU40 resurrection +To: BUG-DUMP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + file-r@MC.LCS.MIT.EDU +cc: DEC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].79588.860805.CENT> + +lester found another instance of the right drive belt somewhere, and even +installed it, so MX's tape drive works again. thanks, lester. + +this means we can again read and write 800bpi 7track tapes. however, we +shouldn't WRITE any, because we can't read them anywhere else. i have run +an incremental dump of MX over the net, using Gut's drive (1600 bpi +9track). this causes a few non-fatal errors on the MX end but apparently +works (see system log). any future dumps of MX should be done this way; +i'll do them, or other interested parties (ty?) can ask how. it's only a +little more complicated than dumping to the local drive. + +all old incremental tapes for MX are hereby retired and should only be used +to read off of. i have started a new set of incremental tapes at 375 (so +will not overwrite older tape data). all 1600bpi LCS ITS tapes are now on +the rack by the dover. i will try to run a full dump soon. we should get on +with the project of copying the GFR tapes, and then (if possible) proceed +forward into the past, copying full dumps as we go. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 JUL 86 15:21:24 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 29 JUL 86 13:32:07 EDT +Date: Tue, 29 Jul 86 11:39:53 EDT +From: "Devon S. McCullough" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].936970.860729.DEVON> + +the door on MX's tape drive seems to be wedged partly open. +As far as I know, it is still true that if you use it, the +controller will deposit bad parity words into system buffers +which will cause MX to bughalt. Anything new on this? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 JUL 86 15:21:17 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 29 JUL 86 13:32:02 EDT +Date: Tue, 29 Jul 86 11:10:47 EDT +From: "Devon S. McCullough" +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].936964.860729.DEVON> + +the network stopped talking across the railroad tracks (as usual on rainy +days) so I left my plasma TV and walked over to the VT52 by MX's console. +Now :TCTYP DESCRIBE says I have Sail,-%TOSAI which looks like a bug to me. +It echoes H when I type backspace at DDT, for instance. + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM by AI.AI.MIT.EDU 24 Jul 86 19:18:06 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 49456; Thu 24-Jul-86 18:46:43 EDT +Date: Thu, 24 Jul 86 18:46 EDT +From: David A. Moon +Subject: MC +To: Alan Bawden +cc: SRA@XX.LCS.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, BUG-MAIL@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].75103.860724.ALAN> +Message-ID: <860724184615.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu, 24 Jul 86 15:15:31 EDT + From: Alan Bawden + + Date: Thu, 24 Jul 1986 13:53 EDT + From: Rob Austein + MC seems to have stopped talking to its IMP.... + + MC's IMP cable was half unplugged at the IMP end. + + PEEK on MC claims that there are no free packet buffers, all + sockets in use, but shows nobody using the net. + + Who claimed all sockets were in use? I guess some program told you this + because both conditions return the same error code. I don't actually + understand why unplugging the IMP cable should cause all the buffers to get + used up. There is a crash dump in MC:CRASH;CRASH TCPFUL if a TCP wizard + wants to tell us. (This happened on MC once before, see MC:CRASH;CRASH TCP.) + +Maybe all the packet buffers were full of packets waiting to be sent to the IMP. + + + Maybe a cable fell off ... + + Very good! + + I gunned COMSAT on MC so that it wouldn't time out all the messages in + its queue trying to send through a broken interface. + + But of course Puff launched another one within an hour. + +By the way, I believe the NET command in LOCK still resets the network, +cycling HOST MASTER READY on the IMP cable. That wouldn't have plugged +the cable back in in this case of course, but might still have been +a useful thing to try. I hope this command works on KS's. + + +Date: Thu, 24 Jul 86 15:15:31 EDT +From: Alan Bawden +Subject: MC +To: SRA@XX.LCS.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +cc: BUG-MAIL@AI.AI.MIT.EDU +In-reply-to: Msg of Thu 24 Jul 1986 13:53 EDT from Rob Austein +Message-ID: <[AI.AI.MIT.EDU].75103.860724.ALAN> + + Date: Thu, 24 Jul 1986 13:53 EDT + From: Rob Austein + MC seems to have stopped talking to its IMP.... + +MC's IMP cable was half unplugged at the IMP end. + + PEEK on MC claims that there are no free packet buffers, all + sockets in use, but shows nobody using the net. + +Who claimed all sockets were in use? I guess some program told you this +because both conditions return the same error code. I don't actually +understand why unplugging the IMP cable should cause all the buffers to get +used up. There is a crash dump in MC:CRASH;CRASH TCPFUL if a TCP wizard +wants to tell us. (This happened on MC once before, see MC:CRASH;CRASH TCP.) + + Maybe a cable fell off ... + +Very good! + + I gunned COMSAT on MC so that it wouldn't time out all the messages in + its queue trying to send through a broken interface. + +But of course Puff launched another one within an hour. + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 24 Jul 86 14:18:57 EDT +Date: Thu, 24 Jul 1986 13:53 EDT +Message-ID: +From: Rob Austein +To: bug-its@AI.AI.MIT.EDU, bug-mail@AI.AI.MIT.EDU +Subject: MC + +MC seems to have stopped talking to its IMP. XX isn't having any +trouble with this, so it's (probably) not BBN doing something random. +Attempting to connect to 10.3.0.44 causes the IMP to claim that MC is +down. PEEK on MC claims that there are no free packet buffers, all +sockets in use, but shows nobody using the net. Maybe a cable fell +off the LH/DH or maybe something else. + +I gunned COMSAT on MC so that it wouldn't time out all the messages in +its queue trying to send through a broken interface. + +Date: Tue, 15 Jul 86 17:16:43 EDT +From: Alan Bawden +Subject: TCP Checksum Routine +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].70523.860715.ALAN> + +This afternoon AI crashed because the TCP segment checksuming routine +referenced location 400000, which is normally non-existant in the system's +page table, thus taking a page fault. The offending instruction was the +ILDB at THCKS5. There is a crash dump in CRASH;CRASH TCPSUM, although I +may have trashed the accumulators and the BUGxxx locations before taking +the dump. I guess we have to suspect that this routine checksums +randomness a lot, and we were only lucky to catch it this time because it +happened to hit the 2% of system memory that would cause it to halt. + +Date: Sun, 13 Jul 86 17:58:41 EDT +From: Alan Bawden +Subject: Disappear here. +To: DANIEL@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 13 Jul 86 10:29:11 EDT from Daniel Weise +Message-ID: <[AI.AI.MIT.EDU].69293.860713.ALAN> + + Date: Sun, 13 Jul 86 10:29:11 EDT + From: Daniel Weise + AI went catatonic this morning. I took a dump to + CATA TONIC and reloaded. + +Thanks. Its just unit #1 being broken again. + +Date: Sun, 13 Jul 86 10:29:11 EDT +From: Daniel Weise +Subject: Disappear here. +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].69227.860713.DANIEL> + +AI went catatonic this morning. I took a dump to +CATA TONIC and reloaded. + +Daniel + +Date: Sat, 12 Jul 86 03:56:36 EDT +From: Alan Bawden +Subject: DRAGON;SYSMSG LOG +To: BUG-ITS@AI.AI.MIT.EDU, MAGIC-DRAGON-KEEPER@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].68883.860712.ALAN> + +The latest PFTHMG DRAGON (installed on the four KS10s, but not the KL) +permanently logs memory errors in addition to disk errors. The file +DRAGON;DISK LOG is now called DRAGON;SYSMSG LOG. + +Date: Thu, 26 Jun 86 19:36:12 EDT +From: "Andrew A. Berlin" +Subject: ROLM phones. +To: BUG-SYS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].62057.860626.AAB> + + +It's getting pretty hard to get a ROLM phone connection to AI +these days. + +Would it be possible to fix it so that AI hangs up the +ROLM phone after someone logs out (i.e. when it says +"Console Free", it should disconnect the Rolm phone). + +- Andy + +Date: Wed, 25 Jun 86 11:49:20 EDT +From: Alan Bawden +Subject: Foo +To: TAFT@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 25 Jun 86 01:11:18 EDT from Jonathan D. Taft +Message-ID: <[AI.AI.MIT.EDU].61315.860625.ALAN> + + Date: Wed, 25 Jun 86 01:11:18 EDT + From: Jonathan D. Taft + To: KS-ITS-CONFUSION at AI + AI was unresponsive but running printing repeatedly on its console: + "Warning: No free qsk channels" + "System full no job slots." + I dumped it to CRASH;FULL FORCED and reloaded. + +Please send ITS bug reports to Bug-ITS. + +This is the same disk hung lossage we have been experiencing ever since we +got the second drive as far as I can tell. I guess the disk-going-offline +code that Moon wrote didn't actually address the correct problem, although +I do notice that in this crash dump NQOFFL has been AOSed once for each +drive (to bad there is no way to tell -when- this happened). Foo. Seems +to have happened again this morning as well. Double foo. + +Date: Thu, 19 Jun 86 19:58:28 EDT +From: "Pandora B. Berman" +Subject: old mail +To: DAVIS@AI.AI.MIT.EDU +cc: BUG-MAIL@AI.AI.MIT.EDU, BUG-SYSTEM@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].59198.860619.CENT> + + Date: Tue 17 Jun 86 15:57-EDT + From: Randall Davis + Subject: old mail + To: bug-system%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU + I've been getting old copies of info-space mailing list mailings (from + Jan and now Fed) over the past couple of days. It's been happening + roughly since the crash when the mail queue was damaged. When is the + redundancy likely to end? Is there anything to be done to cut off the + useless mail? +this has nothing to do with OZ's mail queue, but is instead the result of +the retransmission of mail lost on (the old) MC this spring, as announced +in a msg to arpanet-bboards a few weeks ago (a copy is available if you +missed it). you are fortunate to be on a mailing list which did not +absolutely depend on MC as a transmission step and which chose to +retransmit immediately, by other paths, those msgs which did not go through +the first time. most recipients of this mail are seeing it for the first +time; we regret that you are encoutering redundancy. the retransmission +process should be completed in about another week. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 15 JUN 86 22:17:43 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 15 JUN 86 22:17:51 EDT +Date: Sun, 15 Jun 86 22:17:17 EDT +From: Daniel Weise +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].927113.860615.DANIEL> + +When I dial in to MX, upon connecting the +11 says "Connected to MC." Maybe someone +should tell it the new name. + +Daniel + +Date: Mon, 9 Jun 86 21:37:04 EDT +From: Charles Frankston +Subject: [Forwarded: JSLove@MIT-MULTICS.ARPA, Re: Re: info about INQUIR] +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].53941.860609.CBF> + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 9 JUN 86 15:08:32 EDT +Received: from CHARON by MC.LCS.MIT.EDU 9 Jun 86 14:42:48 EDT +Received: by CHARON (5.15/4.7) + id AA11138; Mon, 9 Jun 86 14:37:59 EDT +Received: by ATHENA (5.45/4.7) + id AA15558; Mon, 9 Jun 86 14:39:42 EDT +Received: from MIT-MULTICS.ARPA by MC.LCS.MIT.EDU 9 Jun 86 14:34:06 EDT +Date: Mon, 9 Jun 86 14:21 EDT +From: "J. Spencer Love" +Subject: Re: info about INQUIR +To: Jan Popiel +Cc: sipb@MC.LCS.MIT.EDU +In-Reply-To: Message of 9 Jun 86 13:32 EDT from "Jan Popiel" +Message-Id: <860609182112.975425@MIT-MULTICS.ARPA> + +What I suggested was this: On ITS, there is the database maintained +using :INQUIR. This database is not only consulted by :FINGER on ITS +and the FINGER protocol on the Internet and CHAOS, but was in the past +maintained consistently across 4 ITS sites. + +This makes it a good example of a distributed database to be used as a +phone directory. MIT Information Systems now encompasses MIT +telecommunications which produces the MIT directory. Jan's group is now +writing a proposal and proposed specification for a system that might +eventually enable us to put the MIT Staff and Student directories on +line and allow people to update their own entries, and perhaps route +electronic mail as well. + +Perhaps the original implementors of :INQUIR are known to people on this +list, or even former SIPB members. Did anyone ever publish a paper on +this work, such as an undergraduate thesis? Is the only documentation +of the goals and operation of this system in the source code? What is +the source code written in and how could it be found? + +Please direct replies to Popiel@MIT-Multics.ARPA. I will assist him in +retrieving files and interpreting jargon. + -- Spencer + +---------------------------------------------------- + +What I (CBF) sent was this: + + +Well, you're right, in the past it was maintained consistently across 4 +ITS sites; now its maintained across 5 (AI, ML, MC, MD, & MX). Anyway, +the mechanisms are fairly simple and CPU intensive. Basically it is done +by mailing the updated record to all the other machines. The mailer on +each machine spawn subtasks that merge the record into the database by +copying the entire database to one with a new name, and then using the ITS +rename while open call to atomically instantiate the new one and delete +the old one. + +There is no attempt made to ensure that I don't change my record in rapid +succession on two different ITS's. If I were to do that, it is +conceivable that entries on the different machines could be inconsistent. +In practice it just doesn't happen, or if it did, its trivial for +someone to fix it. Note also that having the mailer daemon do the +database update (even on the same machine) simplifies a host of issues, +since the mailer is a single execution thread on ITS there is no need to +worry about concurrent updates. + +If two man months have been put into this effort over the more than 10 +years it has been in service, I would be shocked. + +Date: Mon, 9 Jun 86 16:00:16 EDT +From: Alan Bawden +Subject: AI's losing network +To: BUG-ITS@AI.AI.MIT.EDU, CPH@OZ.AI.MIT.EDU +In-reply-to: Msg of Mon 9 Jun 1986 14:30 EDT from CPH at OZ.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].53546.860609.ALAN> + + Date: Mon, 9 Jun 1986 14:30 EDT + From: CPH at OZ + AI's network seems not to be working. It is possible to connect from + a terminal concentrator, but then it echoes characters very, very + slowly. The rest of the network is happy, all the bridges are running + fine, etc. + I tried reaching AI from both MX and OZ, and vice versa, with no luck. + JAR and I tried cold-booting in the hope that it might work. Again, a + waste of time. + +I don't know why it didn't occur to anyone that the problem was subnet 6, +and has nothing to do with AI, or ITS. + +It turns out that subnet 6 doesn't work very well if you break it into two +pieces by terminating it at the junction box that the KS's are all plugged +into. + +Date: Mon, 9 Jun 86 15:48:44 EDT +From: Alan Bawden +Subject: AI's losing network +To: BUG-ITS@AI.AI.MIT.EDU, CPH@OZ.AI.MIT.EDU +In-reply-to: Msg of Mon 9 Jun 1986 14:30 EDT from CPH at OZ.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].53545.860609.ALAN> + + Date: Mon, 9 Jun 1986 14:30 EDT + From: CPH at OZ + AI's network seems not to be working. It is possible to connect from + a terminal concentrator, but then it echoes characters very, very + slowly. The rest of the network is happy, all the bridges are running + fine, etc. + I tried reaching AI from both MX and OZ, and vice versa, with no luck. + JAR and I tried cold-booting in the hope that it might work. Again, a + waste of time. + +I don't know why it didn't occur to anyone that the problem was subnet 6, +and has nothing to do with AI, or ITS. + +It turns out that subnet 6 doesn't work very well if you break it into two +pieces by terminating it at the junction box that the KS's are all plugged +into. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 9 JUN 86 15:22:22 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 9 JUN 86 15:18:26 EDT +Received: from OZ.AI.MIT.EDU by MX.LCS.MIT.EDU via Chaosnet; 9 JUN 86 14:30:16 EDT +Date: Mon, 9 Jun 1986 14:30 EDT +Message-ID: +From: CPH@OZ.AI.MIT.EDU +To: Bug-ITS@MX.LCS.MIT.EDU +Subject: AI's losing network + +AI's network seems not to be working. It is possible to connect from +a terminal concentrator, but then it echoes characters very, very +slowly. The rest of the network is happy, all the bridges are running +fine, etc. + +I tried reaching AI from both MX and OZ, and vice versa, with no luck. + +JAR and I tried cold-booting in the hope that it might work. Again, a +waste of time. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 7 JUN 86 00:25:33 EDT +Date: Sat 7 Jun 86 00:24:49-EDT +From: "John Wroclawski" +Subject: Re: If you believe in Dovers, clap your hands! +To: ALAN@AI.AI.MIT.EDU +cc: TY@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, BUG-DOVER@AI.AI.MIT.EDU +Message-ID: <12212812879.9.JTW@MIT-SPEECH> + + Date: Sat, 7 Jun 86 00:08:53 EDT + From: Alan Bawden + Subject: If you believe in Dovers, clap your hands! + + ..... + +Unfortunately, I remember how the C compiler works. So at some point I'll +probably get around to making a couple of other changes to the spooler +(like, we don't really need it to distribute TeX font files anymore) +and compiling a new one. + +In the meantime half of creation has changed their DOVER programs to +spool to MX. So we need to leave the spooler on the KL running for a +while. +------- + +Date: Sat, 7 Jun 86 00:08:53 EDT +From: Alan Bawden +Subject: If you believe in Dovers, clap your hands! +To: JTW@AI.AI.MIT.EDU +cc: TY@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + BUG-DOVER@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 6 Jun 86 14:14:31 EDT from Jeffrey J Tyrone Sealy +Message-ID: <[AI.AI.MIT.EDU].52858.860607.ALAN> + +John, I'm just guessing it was you that moved the dover spooler from the KL +to the KS? It didn't seem to be working. I theorized that this had to do +with the fact that it had the device PK1: built into the source in many +places, so I launched another spooler with a translation from PK1: to DSK: +which now seems to be working. I fixed the sources to use PK0: instead of +PK1:, which should work on any ITS machine for the forseeable future. I +couldn't assemble the sources because (assuming I know how to run the C +compiler, which I don't) there are all kinds of C libraries that have been +migrated to KL GFR tapes. + +Anyone who cares about dover spooling is free to finish what John and I +have started I guess. Step one is to get back the C libraries I guess... +I've always been in favor of kicking the dover out the window, so I'm +certainly in no rush to do this myself. + +While I was at it, I fixed the various job devices so that DVR^F would know +to contact the KS now, instead of the KL. + +I did -not- install a MC:CHANNA;RAKASH DVRSPL on the KS, because any newly +launched demon still needs that translation to function. Until someone +assembles (and links, how unaesthetic for an ITS!) the new sources, the +demon can be launched by hand by running the xfile .DOVR.;.SPOOL XFILE1 on +the KS. (Hackers who might bring the MC KS up, take note!) + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 4 JUN 86 13:41:53 EDT +Date: Wed, 4 Jun 86 13:41:52 EDT +From: Chris Hanson +Subject: DOVER Lossage +To: BUG-SYSTEM@MX.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].924307.860604.CPH> + +I know this isn't really the right place, but BUG-DOVER looks like a +dead list to me... + +Will someone please fix :DOVER so that it knows how to spool? +Obviously there IS a spooler, since DVR^F works fine -- except that +:DOVER doesn't seem to know how to talk to it. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 2 JUN 86 19:53:34 EDT +Date: Mon, 2 Jun 86 19:53:24 EDT +From: "Michael A. Patton" +Subject: Actually the MX front end 11 I believe. +To: BUG-ITS%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].923914.860602.MAP> + +When you call up the MX (formerly MC) dialup it gives you the message: + Connected to MC. +just before you get the MX banner from PWORD. This should probably be +fixed. + +Date: Sun, 1 Jun 86 15:00:20 EDT +From: "David A. Moon" +Subject: Warning to ITS hackers +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].49646.860601.MOON> + +If you assemble the current source it won't run unless you use the +new microcode I'm debugging. I think it will run if you patch +OVHCLK/ POPJ P, which will keep it from executing the instructions +that aren't implemented. OIPBIT is non-zero now, but it should still +be a no-op with the released microcode. It's unlikely that I will +finish this before next week, since I will be out of town. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 31 MAY 86 20:20:11 EDT +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 31 May 86 20:19:58 EDT +Date: Sat, 31 May 1986 20:18 EDT +Message-ID: +From: Rob Austein +To: macrakis%endor@HARVARD.HARVARD.EDU (Stavros Macrakis) +Cc: bug-sys@MC.LCS.MIT.EDU, dudek@HARVARD.HARVARD.EDU +Subject: mit-mx +In-reply-to: Msg of 31 May 1986 18:53-EDT from macrakis%endor@harvard.HARVARD.EDU (Stavros Macrakis) + + Date: Saturday, 31 May 1986 18:53-EDT + From: macrakis%endor@harvard.HARVARD.EDU (Stavros Macrakis) + To: dudek + cc: bug-sys@mit-mc.arpa + Re: mit-mx + + tn etc. don't seem to know about `mx' == mx.lcs.mit.edu + +What machine are you running telnet on? MX.LCS.MIT.EDU is in the +domain database. If your machine can't find it, that's not our fault. +I wouldn't expect just "mx" to work, unless you are on a machine in +the LCS.MIT.EDU domain. Welcome to the future. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 31 MAY 86 18:55:59 EDT +Received: from harvard.HARVARD.EDU by MC.LCS.MIT.EDU 31 May 86 18:55:41 EDT +Received: from endor.HARVARD.EDU (endor) by harvard.HARVARD.EDU; Sat, 31 May 86 18:53:35 EDT +Date: Sat, 31 May 86 18:53:26 EDT +Received: by endor.HARVARD.EDU; Fri, 30 May 86 19:19:33 EDT +From: macrakis%endor@harvard.HARVARD.EDU (Stavros Macrakis) +To: dudek +Subject: mit-mx +Cc: bug-sys@mit-mc.arpa + +tn etc. don't seem to know about `mx' == mx.lcs.mit.edu + +Date: Sat, 31 May 86 04:13:37 EDT +From: "Pandora B. Berman" +Subject: MC TCP loss +To: BUG-ITS@AI.AI.MIT.EDU, BUG-TCP@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].49182.860531.CENT> + +while on MC and trying to finger out at other hosts, i kept getting an +"all sockets in use" msg. alan poked around and said the system was +out of TCP buffers and COMSAT was acting strangely, so i should raise +switch 0 and take a crash dump. CRASH;TCP LOSS. + +Date: Sat, 31 May 86 03:23:01 EDT +From: "Pandora B. Berman" +Subject: mailing lists redux +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].49152.860531.CENT> + + Date: Wed, 28 May 86 17:01:04 EDT + From: Alan Bawden + Subject: KS-ITS mailing list + To: GUMBY@AI.AI.MIT.EDU + cc: CENT@AI.AI.MIT.EDU, JNC@AI.AI.MIT.EDU, JTW@AI.AI.MIT.EDU + Date: Wed, 28 May 86 04:47:53 EDT + From: David Vinayak Wallace + Can't we fold this into INFO-ITS? + INFO-ITS is an extremely low-volume mailing list. It is for spreading + information that ordinary ITS users and programmers might want to know. + Like when a new device is installed (like LP7:), or a new Midas library + is written, or a new machine is installed, or a new system call is + installed or improved. + KS-ITS is for people who are interested in the project of getting 2020s + installed at MIT running ITS. When I got the KS10 microcode to do + ITS-style paging, I sent mail to KS-ITS. The people on INFO-ITS I + didn't bother until they could log in. + A lot of mail that has gone to KS-ITS in the last few months should + have been sent to BUG-ITS. Like if AI crashes in some novel way, + people send mail to KS-ITS "because AI is a KS", even though BUG-ITS is + the proper recipient. + The people on KS-ITS were interested in keeping in touch with a "good + hack", which is distinct from both BUG-ITS and INFO-ITS. + +gumby, the next time you ask 4 people's opinion about making the sort of +major change you suggested, why not wait until more than 1 replies before +deciding what to do? i have just spent 2 hours undoing the confusion you +created by going ahead with this merger after only one response. among +other things, you completely omitted the BUG-ITS archive. fortunately i +discovered a BUG-ITS list member who hasn't logged in for the past few +days, and so was able to recover the lost msgs. i have also unmerged the +INFO-ITS and KS-ITS archives. also, it's considered courteous, when you +insist on rashly forging ahead in this fashion, to inform -all- the list +members involved; you only told those people on KS-ITS who were not on +INFO-ITS: + Date: Wed, 28 May 86 05:49:01 EDT + From: David Vinayak Wallace + Subject: KS-ITS mailing list + To: KS-ITS-ONLY-PEOPLE@AI.AI.MIT.EDU + The KS's have arrived and ITS runs on them, so we're folding the + KS-ITS list into INFO-ITS. + You're not on INFO-ITS nor BUG-ITS. Unless I hear from you in the + next few days I'll put you on INFO-ITS. + david + +i agree with alan -- the INFO-, BUG-, and KS-ITS have distinct purposes and +should be kept that way. now that the KSs run ITS, a lot of the discussion +previously carried on on KS-ITS should move to BUG-ITS or other more +appropriate lists, but that's another story. + +Date: Wed, 28 May 86 17:21:32 EDT +From: Alan Bawden +To: ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 28 May 86 11:39:49 EDT from David Chapman +Message-ID: <[AI.AI.MIT.EDU].47458.860528.ALAN> + + Date: Wed, 28 May 86 11:39:49 EDT + From: David Chapman + Is there a reason ML is running ITS when everyone else is running NITS? + +Heck, you should have looked yesterday! AI was running NITS, MC was +running XITS, MD was running ITS... The various names have no relation to +eachother. + + When MD came up, it deleted .temp.; because it was empty. Does anything + depend on that dir existing? Just in case, i recreated it. + +Many things want there to be a .TEMP. directory. However .TEMP. is on a +(very) short list of directories that are automatically created whenever +anyone tries to use them, so you needn't have gone to the trouble. In +fact, you could have created it simply by typing .TEMP.^F! + +Date: Wed, 28 May 86 16:48:18 EDT +From: Alan Bawden +Subject: ML up... +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 28 May 86 04:12:21 EDT from David Vinayak Wallace +Message-ID: <[AI.AI.MIT.EDU].47443.860528.ALAN> + + Date: Wed, 28 May 86 04:12:21 EDT + From: David Vinayak Wallace + I brough ML up, and copied over LSR1, everything on SYS: created since + the 15th, and .;@ NITS (which I then booted on ML). + We should have a better way of doing this. + +Aiiiiiiieeee!!!!! + + Date: Wed, 28 May 86 04:15:43 EDT + From: David Vinayak Wallace + I lost moving @ NITS to ML:.;. So ML's running ITS + until someone competent wishes to do it. + +Since each machine has different devices, addresses, terminals, names, etc. +The various ITS binaries are -totally- incompatible. I shudder to think +what made you realize that you had lost... + +Date: Wed, 28 May 86 11:39:49 EDT +From: David Chapman +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].47247.860528.ZVONA> + +Is there a reason ML is running ITS when everyone else is running NITS? +When MD came up, it deleted .temp.; because it was empty. Does anything +depend on that dir existing? Just in case, i recreated it. + +Date: Wed, 28 May 86 08:25:34 EDT +From: "Pandora B. Berman" +Subject: Our Man Lester +To: BUG-ITS@AI.AI.MIT.EDU +cc: LAUREL@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].47197.860528.CENT> + +appeared this morning after a significant absence. i asked him about +PM on AI and he said not next Tues. he has a meeting, so maybe Mon., +or maybe even Fri. i mentioned that AI's disk filters needed changing, +and he agreed. he promised he'd send laurel and alan mail giving the +exact day. + +Date: Wed, 28 May 86 06:52:36 EDT +From: "Pandora B. Berman" +Subject: it's probably not a good idea to GFR bug files +To: "GUMBY@"@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].47156.860528.CENT> + + Date: Wed, 28 May 86 06:37:38 EDT + From: David Vinayak Wallace + Subject: it's probably not a good idea to GFR bug files: + To: CENT@AI.AI.MIT.EDU + Date: Wed, 28 May 86 06:26:48 EDT + From: Pandora B. Berman + Date: Tue, 27 May 86 07:20:15 EDT + From: David Vinayak Wallace + FAILED: (FILE [LSPMAI;COMPLR BUGS]) at AI.AI.MIT.EDU; Couldn't + write message to file; + "DSK:LSPMAI;COMPLR BUGS" - LINK TO NON-EXISTENT FILE + ... + look again. the link is to an MX GFR tape. the file was gfr'd, by + JPG or GSB, quite some time ago. are you requesting that it be + retrieved or something? + Yes, I think it should be. +well, you're quite capable of hacking ITS tapes. if you don't, i'll get +around to it sometime. + Also, LSPMAI should be immune to GFR, +talk Alan or whoever into adding it to the magic list... + or + at least, should be protected from having most-current bug files + deleted. +i don't think ITS can do this. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAY 86 04:16:36 EDT +Received: from ML.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 28 MAY 86 04:16:18 EDT +Date: Wed, 28 May 86 04:15:43 EDT +From: David Vinayak Wallace +Subject: belay that +To: BUG-its@AI.AI.MIT.EDU +Message-ID: <[ML.AI.MIT.EDU].65.860528.GUMBY> + +I lost moving @ NITS to ML:.;. So ML's running ITS +until someone competent wishes to do it. + +Date: Wed, 28 May 86 04:12:21 EDT +From: David Vinayak Wallace +Sender: GUMBY0@AI.AI.MIT.EDU +Subject: ML up... +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].47096.860528.GUMBY0> + +I brough ML up, and copied over LSR1, everything on SYS: created since +the 15th, and .;@ NITS (which I then booted on ML). +We should have a better way of doing this. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAY 86 02:24:13 EDT +Date: Wed, 28 May 86 02:23:09 EDT +From: David Vinayak Wallace +Subject: ARPA contact name +To: JINX@OZ.AI.MIT.EDU +cc: ALAN@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + Bug-OZ@OZ.AI.MIT.EDU +In-reply-to: Msg of 27 May 1986 21:46 EDT (Tue) from Bill Rozas +Message-ID: <[MX.LCS.MIT.EDU].922144.860528.GUMBY> + + Date: 27 May 1986 21:46 EDT (Tue) + From: Bill Rozas + + Shouldn't something which is more likely to stick around be used + instead? Using MX is hardly worth the effort, given its expected + lifetime. + +There has been more mail on this subject than it warrants. +1> Fix it to use the KL while it runs; patch it later. +2> Fix the chaos-only hosts (of which there aren't really too many left) + to understand IP. + +Date: Tue, 27 May 86 22:51:56 EDT +From: "Pandora B. Berman" +Subject: ks lossage messages +To: GUMBY@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].46889.860527.CENT> + + Date: Mon, 26 May 86 02:02 EDT + From: David Vinayak Wallace + Subject: ks lossage messages + To: David Chapman + cc: poor-ai@AI.AI.MIT.EDU + Date: Mon, 19 May 86 11:12:12 EDT + From: David Chapman + Do we need a poor-ks? + At 6 this morning, MX started complaining often about being out of + jobslots on the console. + Messages like this used to go to BUG-ITS. I figure they should anyway + (and the poor- lists should be flushed, except for the special case + of the KL). +i have flushed the POOR-AI list and folded the four msgs it had accumulated +in its archive file into the BUG-ITS archive. + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 MAY 86 21:46:43 EDT +Date: 27 May 1986 21:46 EDT (Tue) +Message-ID: +From: Bill Rozas +To: Alan Bawden +Cc: BUG-ITS@AI.AI.MIT.EDU, Bug-OZ%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU, + Cole%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU, FTD%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU, + GLR%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU +Subject: [COLE: Telnet-ing through MC to live hosts...] +In-reply-to: Msg of 27 May 1986 16:11-EDT from Alan Bawden + + +Why don't you just fix TELNET on OZ to use MX as a gateway? + +Shouldn't something which is more likely to stick around be used +instead? Using MX is hardly worth the effort, given its expected +lifetime. + +Date: Tue, 27 May 86 16:11:20 EDT +From: Alan Bawden +Subject: [COLE: Telnet-ing through MC to live hosts...] +To: GLR@OZ.AI.MIT.EDU, Cole@OZ.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, FTD@OZ.AI.MIT.EDU, + Bug-OZ@OZ.AI.MIT.EDU +In-reply-to: Msg of Tue 27 May 1986 15:13 EDT from Jerry Roylance +Message-ID: <[AI.AI.MIT.EDU].46638.860527.ALAN> + + Date: Tue, 27 May 1986 15:13 EDT + From: Jerry Roylance + + Date: Sunday, 25 May 1986 22:48-EDT + From: COLE at OZ + To: David D. Story + cc: bug-oz at OZ + MC is rejecting OZ's request to telnet to arpanet hosts. + But I was able to telnet from oz by typing: + + telnet + TELNET> host-name telnet tcp mx + + I don't know what host computer OZ is now supposed to be using for its + telnet connections. + +Somebody seems to have decided that the MC KS will not supply TCP gateway +service. I personally think this is silly. I would not object if someone +else wants to take the heat for putting it back. + +Why don't you just fix TELNET on OZ to use MX as a gateway? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 MAY 86 15:15:57 EDT +Received: from OZ.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 27 MAY 86 15:15:25 EDT +Date: Tue, 27 May 1986 15:13 EDT +Message-ID: +From: Jerry Roylance +To: Bug-ITS@MC.LCS.MIT.EDU +Subject: [COLE: Telnet-ing through MC to live hosts...] + +Date: Sunday, 25 May 1986 22:48-EDT +From: COLE at OZ.AI.MIT.EDU +To: David D. Story +cc: bug-oz at OZ.AI.MIT.EDU +Re: Telnet-ing through MC to live hosts... + +MC is rejecting OZ's request to telnet to arpanet hosts. +But I was able to telnet from oz by typing: + +telnet +TELNET> host-name telnet tcp mx + +I don't know what host computer OZ is now supposed to be using for its telnet +connections. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 MAY 86 14:31:38 EDT +Date: Tue, 27 May 86 14:30:45 EDT +From: Chris Hanson +Subject: Just nitpicking... +To: BUG-ITS@MX.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].921807.860527.CPH> + +MX still says "Connected to MC." when you dial it up. +I guess there is no single variable controlling the machine name. + +Received: from MOSCOW-CENTRE.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 MAY 86 02:02:40 EDT +Date: Mon, 26 May 86 02:02 EDT +From: David Vinayak Wallace +Subject: ks lossage messages +To: David Chapman +cc: poor-ai@AI.AI.MIT.EDU +In-Reply-To: <[MX.LCS.MIT.EDU].587.860519.ZVONA> +Message-ID: <860526020227.5.GUMBY@MOSCOW-CENTRE.AI.MIT.EDU> + + Date: Mon, 19 May 86 11:12:12 EDT + From: David Chapman + + Do we need a poor-ks? + + At 6 this morning, MX started complaining often about being out of + jobslots on the console. + +Messages like this used to go to BUG-ITS. I figure they should anyway +(and the poor- lists should be flushed, except for the special case +of the KL). + +Date: Thu, 22 May 86 01:20:17 EDT +From: Alan Bawden +Subject: Someday when things calm down we might have time to look into things like this again +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44418.860522.ALAN> + +Outputting to a BOJ: channel after the device user no longer has his +JOB: channel open seems to simply hang. (In the case I'm seeing it +is SIOT to a channel open in .UAO mode.) I would have expected +this to signal an error, perhaps %ENAPP? + +Date: Wed, 21 May 86 23:55:16 EDT +From: "Pandora B. Berman" +Subject: logbook location +To: SRA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44369.860521.CENT> + + Date: Wed, 21 May 1986 23:18 EDT + From: Rob Austein + To: "Pandora B. Berman" + Cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU + Subject: At the tone, your name will be + It would probably help if the ML and MD system logs were in some + intuitively obvious place. Now that you have reminded me of their + existance I suspect they are sitting on top of the CPUs or disks or + something. If they were sitting by the consoles some of us space + cadets might have remembered their existance and scrawled something in + them. +if i could have put them safely any closer to the consoles, i would have. +i agree that on top of the CPUs is not the best location for visibility and +memory-jogging, but it appeared to be the best i could do. if we could get +some kind of little table beside MD's console (shoving the IMPLOD cabinet +over), that would be better. + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 21 May 86 23:17:32 EDT +Date: Wed, 21 May 1986 23:18 EDT +Message-ID: +From: Rob Austein +To: "Pandora B. Berman" +Cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Subject: At the tone, your name will be +In-reply-to: Msg of 21 May 1986 22:57-EDT from "Pandora B. Berman" + +It would probably help if the ML and MD system logs were in some +intuitively obvious place. Now that you have reminded me of their +existance I suspect they are sitting on top of the CPUs or disks or +something. If they were sitting by the consoles some of us space +cadets might have remembered their existance and scrawled something in +them. + +Date: Wed, 21 May 86 22:57:57 EDT +From: "Pandora B. Berman" +Subject: At the tone, your name will be +To: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44335.860521.CENT> + +I have relabelled everything in sight except the KS's tapes; i'll get +to those later this evening. i rediscovered the winning sort of +labels, so the binder labels should no longer be quite so eager to +come off. + +NOTHING has been written in the ML and MD system logs for at least a +week. nothing about bringing them down for DEC to borrow or loaning +disks to XX or any such matters. will someone who knows what's been +going on (SRA? JTW?) please insert a few notes so the rest of us can +remain mildly informed? + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 21 MAY 86 03:17:42 EDT +Date: Wed 21 May 86 03:19:00-EDT +From: "John Wroclawski" +Subject: Re: ks lossage +To: JNC@XX.LCS.MIT.EDU, ALAN@AI.AI.MIT.EDU, ZVONA%MX.LCS.MIT.EDU@XX.LCS.MIT.EDU +cc: bug-its@AI.AI.MIT.EDU +In-Reply-To: <12208384120.19.JNC@XX.LCS.MIT.EDU> +Message-ID: <12208388143.21.JTW@MIT-SPEECH> + + From: "J. Noel Chiappa" + Subject: Re: ks lossage + + I think the funny messages from the IMP have to do with some + +The RFC that describes 1822L tells all, claiming that the IMP will +send the usual 3-NOP-and-a-reset sequence twice, once in 1822 format +and once in 1822L format, interleaving the messages. You are supposed +to tell it what you want by answering in your choice of format. If you +do this before it has sent the full sequence it will stop sending in +the protocol you don't want. + +Which is all well and good, except that this RFC is dated in 1983. So +it only took them three years to implement...? +------- + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 21 May 86 02:56:08 EDT +Date: Wed 21 May 86 02:56:55-EDT +From: "J. Noel Chiappa" +Subject: Re: ks lossage +To: ALAN@AI.AI.MIT.EDU, ZVONA@MX.LCS.MIT.EDU +cc: POOR-AI@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].42635.860519.ALAN> +Message-ID: <12208384120.19.JNC@XX.LCS.MIT.EDU> + + I think the funny messages from the IMP have to do with some +new leader format that BBN is introducing. They flag the new style +ones with what looks to old unmodified software with an illegal initial +code. We've just run acrosss this bringing up the 68000 GW IMP code. +------- + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 21 May 86 02:38:44 EDT +Date: Wed 21 May 86 02:39:30-EDT +From: "J. Noel Chiappa" +Subject: Re: flaky ML +To: ALAN@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].42474.860518.ALAN> +Message-ID: <12208380952.19.JNC@XX.LCS.MIT.EDU> + + Maybe it's not an accident that the 3 machines had bum memory +boards in them? +------- + +Date: Wed, 21 May 86 00:35:26 EDT +From: Alan Bawden +Subject: 6 5 4 3 2 1 ... +To: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU, + "(FILE [JNC:POOR MC])"@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].43668.860521.ALAN> + +OK folks, I switched the names MC and MX in the ITS sources and created new +binaries for the two machines. I also edited AI:SYSHST;HSTLCS to reflect +the swap. So the first symptom of this name swap that anyone will notice +will appear early this morning when new host tables start circulating with +the Chaosnet addresses switched. (Because we are switching both ArpaNet +addresses and physical connections, the change manifests itself in the host +tables as exchanged Chaosnet addresses.) + +Date: Tue, 20 May 86 14:26:00 EDT +From: "Leigh L. Klotz" +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].43062.860520.KLOTZ> + +Just now I typed +P H +to get a histogram, and it started up a job called HP, which +said + +File can't be OPENed - DSK:FORT;HP SAV +^V VALRETS OR XFILES NESTED TOO DEEP?INPDL OVERFLOW - PDL RESET? + +but I guess that's another story. + +The fair share is 74%, btw. + +Date: Tue, 20 May 86 04:39:07 EDT +From: "Pandora B. Berman" +Subject: AI's first GFR +To: BUG-DUMP@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42900.860520.CENT> + +sort of like its first date, or something -- it's just not the same +thereafter. + +anyway, the GFR did run over AI SECOND:, taking 5K blocks off to tape. Due +to cruftiness not yet worked around in the code (something to do with EOT), +we can't yet run incremental GFRs -- successive small GFRs onto the same +tape. so i had to go for maximum usage of single tape instead. given the +amount of tape left, i think i could have gone for 6K blocks and won; that +we'll try next time. + +the tape is in the rack with the other ITS tapes. as usual, this is a +Sacred GFR Tape -- be careful with it. + +All and Sundry are reminded that all 4 KSs (when they're running ITS) are +regularly backed up -- help relieve AI's load by moving your files +elsewhere. + +Date: Mon, 19 May 86 14:11:13 EDT +From: Alan Bawden +Subject: ks lossage +To: ZVONA@MX.LCS.MIT.EDU +cc: POOR-AI@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 19 May 86 11:12:12 EDT from David Chapman +Message-ID: <[AI.AI.MIT.EDU].42635.860519.ALAN> + + Date: Mon, 19 May 86 11:12:12 EDT + From: David Chapman + ... + When the machine booted it printed a lot of stuff I couldn't follow + about the imp. + +All ITS machines with IMPs do this when you boot them now. I presume the +software in the IMP has changed incompatibly somehow. We all have to learn +to ignore this until somebody gets around to fixing it. + + 'Nother funny thing: LAST time it was booted, it complained that it + couldn't set the time, because 15 out of the 13 times it got from the + net did not agree. Besides sounding damn funny, it seems that + requiring 15 good times is a little stringent. + +Well, its just phrased a little funny. It -asked- 25 people, and it +insists on getting 15 answers that agree back. If only 13 people respond, +then indeed 15 of the 13 answers failed to agree! + +I don't want to insist on a majority of the -responders-, since then if +only 1 machine responds that happens to be mistaken, the mistake spreads. +Look at it this way, this demon is just a convenience to save you from +having to run PDSET 95% of the time, you have to expect to do it manually +every now and then. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 19 MAY 86 11:10:47 EDT +Date: Mon, 19 May 86 11:12:12 EDT +From: David Chapman +Subject: ks lossage +To: poor-ai@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].587.860519.ZVONA> + +Do we need a poor-ks? + +At 6 this morning, MX started complaining often about being out of +jobslots on the console. About 10, I couldn't supdup in, so I came +up. I couldn't log into the console either -- it ignored ^Z. So I +hit boot, and it said BT SW and ?BT 001200 and wouldn't listen to me. +So I got the fep and started at 777700 and that didn't work either, so +I booted again and it worked that time. + +My guess is that comsat is unhappy about its imp connection and dying +without freeing up its slot. + +When the machine booted it printed a lot of stuff I couldn't follow +about the imp. + +'Nother funny thing: LAST time it was booted, it complained that it +couldn't set the time, because 15 out of the 13 times it got from the +net did not agree. Besides sounding damn funny, it seems that +requiring 15 good times is a little stringent. + +Date: Sun, 18 May 86 21:39:55 EDT +From: Alan Bawden +Subject: flaky ML +To: CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 17 May 86 07:26:57 EDT from Pandora B. Berman +Message-ID: <[AI.AI.MIT.EDU].42474.860518.ALAN> + + Date: Sat, 17 May 86 07:26:57 EDT + From: Pandora B. Berman + ML was getting a gross and astonishing number of ECC errors this morning. + +We are talking -memory- EEC corrected errors rather than -disk- ECC +corrected errors I believe. + + see console output around 3-4 am. what does this? what can we do about it? + +It means that there are some bad bits in ML's memory. Its funny, AI has +never had a single one of these errors, but all -three- of the new KS10's +have memory boards in them that get ECC errors. + + i was dumping it and shoving some files on during this time -- maybe this + has something to do with the flaky chaosnet? + +Unlikely to be related other than the fact that you were just exercising +the machine in general. The real problem here is that when I wrote the +code for logging the ECC errors, I didn't fully understand what it would be +like when they started happening regularly. (My code also has a bug that +causes MD to essentially loop in the scheduler because of a bad bit in a +particularly sensitive location.) I plan to re-write this code to be less +noisy and more robust soon. + +Date: Sat, 17 May 86 07:30:43 EDT +From: "Pandora B. Berman" +Subject: dumped state +To: INFO-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42220.860517.CENT> + +as of this morning, all ITSs here (with the possible exception of the KL) +are being regularly backed up to tape. it -is- safe to store your files on +any of the KSs. + +Date: Sat, 17 May 86 07:26:57 EDT +From: "Pandora B. Berman" +Subject: flaky ML +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42218.860517.CENT> + +ML was getting a gross and astonishing number of ECC errors this morning. +see console output around 3-4 am. what does this? what can we do about it? +i was dumping it and shoving some files on during this time -- maybe this +has something to do with the flaky chaosnet? + +Date: Mon, 12 May 86 03:47:03 EDT +From: "Pandora B. Berman" +Subject: another way to confuse the issue +To: MBECK@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].37601.860512.CENT> + + Date: Sat, 10 May 86 01:11:28 EDT + From: "Mark E. Becker" + Subject: MC <--> KS/MX mail switching + To: CENT@MC.LCS.MIT.EDU + After reading MC MAIL would it be a 'good thing' if I sent address + update messages to those list maintainers saying that MBECK@MC should + now be MBECK@KL ? + +no. KL is a local-only nickname; on the general arpanet it's an alias for +SRI-KL, and sending your mail there would not help anyone. when the KS +(currently MX) and the KL (currently MC) switch names, they will retain +their model aliases -- the KL will be called MX or (locally) KL, while the +KS will be called MC or KS. this feature was arranged so we could do a +number of local transforms. for instance, the KS will have somewhat +restricted use, so it can concentrate on mail; thus, among other things, we +don't want all those people who get mail on the present MC to have that +mail land on the KS after the name switch. for this reason, someone has run +a program over the inquir database to change all net-addresses of MC to KL; +this will ensure that their mail will end up on the same physical machine +as it does now. all ITS machines share a common inquir database and forward +mail in accordance with the net-addresses people give therein, so all your +mail will end up where you currently get it now. since your mail goes to +OZ, it will continue to make one hop from MC (whichever hardware) to the +twenex; if you received it on MC-KL, you would find it would begin taking +an extra hop to reach your mailbox, because the KL will (probably) go off +the arpanet when the names are switched and all mail bound for it will have +to be forwarded through MC-KS or AI. + +Date: Sun, 11 May 86 21:28:30 EDT +From: Alan Bawden +Subject: Ask, and you shall recieve +To: SRA@XX.LCS.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +cc: BUG-INQUIR@MC.LCS.MIT.EDU, CENT@MC.LCS.MIT.EDU, + SRA@MC.LCS.MIT.EDU, ZVONA@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 11 May 1986 04:59 EDT from Rob Austein +Message-ID: <[AI.AI.MIT.EDU].37394.860511.ALAN> + + Date: Sun, 11 May 1986 04:59 EDT + From: Rob Austein + ... (although it would be nice if it had some reasonable way to + deduce what ITSs exist, at run-time). + +Because I was updating so many programs to know about the new plethora of +ITS machines, I added exactly this feature. There is a new table you can +ask for from the .GETSYS uuo: ITSNMS is a table of the sixbit names of the +-current- local ITS machines. I have already converted most of the +programs that used to have built-in tables of ITS machines (INSTAL, FINGER, +FIND, etc.) to use this. Do +:UUO GETSYS +for details. + +Date: Sat, 10 May 86 18:26:28 EDT +From: Alan Bawden +To: BUG-ITS@AI.AI.MIT.EDU +cc: JSOL@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 10 May 86 16:56:50 EDT from Jon Solomon +Message-ID: <[AI.AI.MIT.EDU].37156.860510.ALAN> + + Date: Sat, 10 May 86 16:56:50 EDT + From: Jon Solomon + for some reason I keep geting "all sockets in use" when there is + nobody on the system. I did a :p a, and abuot 2/3rds of the connections + are in TIMWT connected to YALE.ARPA or SRI-UNIX.ARPA. Is there some safe + way to flush them? + +I reloaded the system to get rid of them since nobody could connect to MC +using TCP. I left a crash dump in MC:CRASH;CRASH TIMWTS if some networking +wizard wants to figure out what YALE.ARPA and SRI-UNIX.ARPA are doing that +cause these connections to stay in TIMWT seemingly forever. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 10 MAY 86 16:57:36 EDT +Date: Sat, 10 May 86 16:56:50 EDT +From: Jon Solomon +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].909418.860510.JSOL> + +for some reason I keep geting "all sockets in use" when there is +nobody on the system. I did a :p a, and abuot 2/3rds of the connections +are in TIMWT connected to YALE.ARPA or SRI-UNIX.ARPA. Is there some safe +way to flush them? + +Date: Fri, 9 May 86 23:43:36 EDT +From: Alan Bawden +Subject: another mysterious lossage +To: CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 9 May 86 22:38:16 EDT from Pandora B. Berman +Message-ID: <[AI.AI.MIT.EDU].37001.860509.ALAN> + + Date: Fri, 9 May 86 22:38:16 EDT + From: Pandora B. Berman + around 22:15 or so, AI stopped listening.... dumped it to CRASH;ITS + HUNG, then reloaded. + +Looks like the same disk lossage again. This time ITS had actually run out +of disk clannels. Perhaps there is something wrong with one of the drives. +I'll try to figure this out after I get finished with this paper. (I don't +grok the disk code well enough to do this immediately.) I hope AI +continues to work for that long... I renamed the crash to be +AI:CRASH;CRASH QLOSS" + +BTW, penny, I figured out why MX's system console wouldn't talk to you. +The 8080 front end sometimes gets confused about the state of the system +console and stops forwarding characters through to the 10 (running out of +paper sometimes causes this to happen). If you simply power-cycle the +LA120 this resets the 8080's opinion of things and you can use the system +console for input again. + +Date: Fri, 9 May 86 22:38:16 EDT +From: "Pandora B. Berman" +Subject: another mysterious lossage +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].36993.860509.CENT> + +around 22:15 or so, AI stopped listening. it was willing to echo typein but +would not act on it. also it echoed chaos packets, or heard them, or +something low-level like that. DPH and i figured out how to raise switch0 +and dumped it to CRASH;ITS HUNG, then reloaded. + +Date: Thu, 8 May 86 22:24:56 EDT +From: Alan Bawden +Subject: Recent software crashes. +To: BUG-ITS@AI.AI.MIT.EDU +cc: SRA@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].36473.860508.ALAN> + +Two recent crashes (in MC:CRASH;CRASH DRGFKT and AI:CRASH;CRASH BJUIS) +suggest that there is some problem with job device locking strategy. I +guess we should have expected that having COMSAT using a job device 24 +hours a day would expose some bugs. The crash on MC is completely crazed +in the number of jobs that are confused. + +AI just crashed again with the same lossage I complained about a couple +weeks ago. The one where the system hangs up just like it does on MC when +the T-300 controller gets fucked. (See AI:CRASH;CRASH QLOSS and +AI:CRASH;CRASH QLOSS'.) + +Received: from MIT-MULTICS.ARPA by AI.AI.MIT.EDU 8 May 86 07:46:48 EDT +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2693388755368144@MIT-MULTICS.ARPA>; 08 May 1986 07:32:35 edt +Date: 08 May 86 00:44 +0200 +From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-to: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA, + ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA, + KS-ITS@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU, "Alan Bawden" + +Subject: State of the world +Message-ID: <172046@QZCOM> +In-Reply-To: <[AI.AI.MIT.EDU].35019.860506.ALAN> + +We are looking forward, to the moment when we can load the tape +in the tape drive and have the system flying. + + + + +Date: Tue, 6 May 86 00:40:15 EDT +From: Alan Bawden +Subject: State of the world +To: KS-ITS@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].35019.860506.ALAN> + +There are now -five- machines running ITS at MIT, more than have ever +existed simultaneously before. There is the MC KL10, and four KS10's named +AI, MX, ML, and MD. + +The MC KL10 is off maintenance contract as of the first of this month, so I +suppose its days are numbered. At some point before the KL10 passes on to +that great machine room in the sky, the MC KL10 and the MX KS10 will swap +their names, and we will plug the new MC KS10 into the old MC's Arpanet +port. This assures that as far as the outside world is concerned, there +will always be an ITS named MC at that Arpanet address, performing mail +service functions for MIT. (Let's not get into the hair we will be going +through to make all the mailing lists in the world continue to work.) + +The KL10 will remain available for all those who wish to continue to use +it, under the name MX. When the KL10 retires, the name MX will be retired +with it. + +Various other owners of KS10's around the world will be receiving KS10 ITS +distribution tapes in the mail soon. The last machine we booted (MD) was +built by a volunteer using the printed instructions we plan to include with +our ITS distribution kits. + +Date: Thu, 1 May 86 05:28:04 EDT +From: "Pandora B. Berman" +Subject: imp lossage +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].33406.860501.CENT> + +AI crashed around 3 or so. complained about IMP lossage of some sort. +dumped to CRASH;IMPOS LOSS. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 30 APR 86 15:05:01 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 30 APR 86 15:04:56 EDT +Date: Wed, 30 Apr 86 15:04:37 EDT +From: Alan Bawden +Subject: tty types +To: PGS@AI.AI.MIT.EDU +cc: KLOTZ@AI.AI.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, + BUG-SUPDUP@MC.LCS.MIT.EDU +In-reply-to: Msg of Wed 30 Apr 86 02:43:20 EDT from Patrick G. Sobalvarro +Message-ID: <[AI.AI.MIT.EDU].33061.860430.ALAN> + + Date: Wed, 30 Apr 86 02:43:20 EDT + From: Patrick G. Sobalvarro + Date: Tue, 29 Apr 86 08:31:04 EDT + From: Alan Bawden + (Note that until recently ROLM lines incorrectly had the %TYDIL bit + set in their TTYTYP words, perhaps you are noticing an effect of + this change.) + I thought %TYDIL was correct for the ROLM lines, since they are exactly + analogous to dialups; one connects terminals of different types to them, so + they should have their tty types reset to something neutral when + disconnected, etc. And, if we supported it in the 11, they should hang up + after they've been logged out for a while, all those dialup-y things. + +I should have been more careful about how I used the word "incorrectly". +As you set things up originally the ROLM lines were just like dialups and +had %TYDIL set for all of the reasons you give. This all worked just fine +and there wasn't a thing wrong with it. Then I got my greasy fingers into +the act. + +I added a %TYRLM bit for the benefit of people and programs that wanted the +distinguish between ordinary dialups that you tended to connect to from +outside NE43 (like from home), and ROLM lines that you tended to connect to +from inside NE43 (like from your office). In this state of affairs ITS +tested %TYDIL to determine if it should do all those dialup-y things, and +programs that wanted to know if you were at home could test to see if +%TYDIL was set and %TYRLM wasn't. + +The problem is that there were a zillion programs (most of them written in +DDT command language) that just tested %TYDIL to see if the user was at +home. Rather than fix all of them, I changed the meaning of %TYDIL to mean +what those programs already thought. That way I only had to fix ITS to +test for %TYDIL+%TYRLM in those places where it was already testing just +for %TYDIL. + +Now it is true that this broke programs that thought that %TYDIL meant +"connected through a line that needs to have its terminal type set", but +since somebody had to lose this argument I decided that these programs were +simply mistaken about the meaning of that bit. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 30 APR 86 02:43:41 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 30 APR 86 02:43:40 EDT +Date: Wed, 30 Apr 86 02:43:20 EDT +From: "Patrick G. Sobalvarro" +Subject: tty types +To: ALAN@AI.AI.MIT.EDU +cc: KLOTZ@AI.AI.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, + BUG-SUPDUP@MC.LCS.MIT.EDU +In-reply-to: Msg of Tue 29 Apr 86 08:31:04 EDT from Alan Bawden +Message-ID: <[AI.AI.MIT.EDU].32866.860430.PGS> + + Date: Tue, 29 Apr 86 08:31:04 EDT + From: Alan Bawden + + Date: Mon, 28 Apr 86 15:44:36 EDT + From: Leigh L. Klotz + I'm connected to MC via the Rolm Data Feature on T25. My init + file insists that I'm on a line that already knows its tty type + and SUPDUP warns me not to net hop. Perhaps the tty types file + is broken? + + The TTYTYP file knows that T25 is a ROLM line, and the running ITS on MC at + this moment does as well. How does your init file determine if you are on + a line that "already knows its tty type"? Perhaps it does something bogus. + (Note that until recently ROLM lines incorrectly had the %TYDIL bit set in + their TTYTYP words, perhaps you are noticing an effect of this change.) + +I thought %TYDIL was correct for the ROLM lines, since they are exactly +analogous to dialups; one connects terminals of different types to them, so +they should have their tty types reset to something neutral when +disconnected, etc. And, if we supported it in the 11, they should hang up +after they've been logged out for a while, all those dialup-y things. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 APR 86 08:31:35 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 29 APR 86 08:31:13 EDT +Date: Tue, 29 Apr 86 08:31:04 EDT +From: Alan Bawden +Subject: tty types +To: KLOTZ@AI.AI.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, BUG-SUPDUP@MC.LCS.MIT.EDU +In-reply-to: Msg of Mon 28 Apr 86 15:44:36 EDT from Leigh L. Klotz +Message-ID: <[AI.AI.MIT.EDU].32475.860429.ALAN> + + Date: Mon, 28 Apr 86 15:44:36 EDT + From: Leigh L. Klotz + I'm connected to MC via the Rolm Data Feature on T25. My init + file insists that I'm on a line that already knows its tty type + and SUPDUP warns me not to net hop. Perhaps the tty types file + is broken? + +The TTYTYP file knows that T25 is a ROLM line, and the running ITS on MC at +this moment does as well. How does your init file determine if you are on +a line that "already knows its tty type"? Perhaps it does something bogus. +(Note that until recently ROLM lines incorrectly had the %TYDIL bit set in +their TTYTYP words, perhaps you are noticing an effect of this change.) I +don't know what SUPDUP does, but I do know that the nethop-detection code +was recently rewritten. Perhaps it is doing something bogus as well. + +If this happens to you again, see if you can figure out just what TTY +variables are the source of the problem. The output of :TCTYP DESCRIBE +would be a good place to start. + +Date: Mon, 28 Apr 86 16:52:29 EDT +From: "Pandora B. Berman" +Subject: log books +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].32120.860428.CENT> + +all the KSs have log books. AI's and MX's are on the little DM cabinet. +MD's and ML's are on their CPUs. please write things in them. like "Brain +transplant performed, all is well", or "now running NITS", or "jumpers +attacked with soldering iron, arpanet up". if you don't write things down, +no one will know they happened if you are not available to say so. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 APR 86 15:44:27 EDT +Date: Mon, 28 Apr 86 15:44:36 EDT +From: "Leigh L. Klotz" +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].897692.860428.KLOTZ> + +I'm connected to MC via the Rolm Data Feature on T25. My init +file insists that I'm on a line that already knows its tty type +and SUPDUP warns me not to net hop. Perhaps the tty types file +is broken? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 APR 86 16:35:40 EST +Date: Sat, 26 Apr 86 16:35:24 EST +From: Daniel Weise +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].895936.860426.DANIEL> + +I found MC in a PI level 7 bugpause. The console line +above the bugpuase was "too many parity errors." I dumped +to CRASH PARITY and cold booted. + +Daniel + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 20 APR 86 12:55:36 EST +Date: Sun, 20 Apr 86 12:54:59 EST +From: "Devon S. McCullough" +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].889795.860420.DEVON> + +MC bughalted sometime around 10am, bugpc/caia uret2+2 +so I dumped it into .;CRASH URGH and tried to warm boot +but the KL10 halted immediately so I cold booted it. + +Date: Fri, 18 Apr 86 03:37:32 EST +From: Alan Bawden +Subject: devices and names +To: BUG-ITS@AI.AI.MIT.EDU, GZ@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].28319.860418.ALAN> + +The DEVICE directory was getting full due to the proliferation of various +ITS names (past, present, and future), 20X names (for RMTDEV), and various +concatenations of DIR with other device names. So I increased, yet again, +the knowledge inside the unknown device handler (SYS;ATSIGN DEVICE) itself. + +The unknown device handler now loads various foreign filesystem devices +from DEVICE;ATSIGN MLDEV or DEVICE;ATSIGN RMTDEV as appropriate. Various +DIR devices that deal with the local filesystem are loaded directly from +DEVICE;ATSIGN DIRDEV. Foreign filesystem DIR devices are loaded from +DEVICE;ATSIGN MLDEV. (Archive DIR devices are not treated specially.) + +Note that the unknown device handler always checks the DEVICE directory for +a JOBDEV file -before- looking at this new built-in knowledge, so it is +easy to do local customizations on each machine. (Like on AI, the DIRAI +device is loaded from ATSIGN DIRDEV, whereas the default is to load it from +ATSIGN MLDEV.) + +Oh yeah. One of the reasons I was forced to do this is I added two +synonyms for MC and MX. MC is now known also as "KL" and MX is now also +known as "KS". The devices KL: and KS: work everywhere as appropriate. +When we swap the names "MC" and "MX" (that is, when MC becomes a KS10, and +MX becomes a KL10), we -won't- swap the names "KL" and "KS". Thus the file +KL:ALAN;FOO BAR is the same file today as it will be next year, while +MC:ALAN;FOO BAR will be a different one. + +(This did have the odd side effect that the NETWRK library now returns +"MIT-KL" as the SIXBIT name for MC...) + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 4 APR 86 20:18:29 EST +Date: Fri, 4 Apr 86 20:18:37 EST +From: Alan Bawden +Subject: MC UNIT 1/PACK 13 +To: KARENS@MC.LCS.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + CENT@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 4 Apr 86 17:34:02 EST from Alan Bawden +Message-ID: <[MC.LCS.MIT.EDU].874128.860404.ALAN> + + Date: Fri, 4 Apr 86 17:34:02 EST + From: Alan Bawden + Date: Fri, 4 Apr 86 02:08:45 EST + From: Pandora B. Berman + has DEC made any progress in fixing this RP04?... + apparently they came today and replaced the entire RP04.... + +And apparently it works for me, although when TK tried to bring it up he +lost. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 4 APR 86 17:33:53 EST +Date: Fri, 4 Apr 86 17:34:02 EST +From: Alan Bawden +Subject: MC UNIT 1/PACK 13 +To: KARENS@MC.LCS.MIT.EDU, CENT@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 4 Apr 86 02:08:45 EST from Pandora B. Berman +Message-ID: <[MC.LCS.MIT.EDU].873744.860404.ALAN> + + Date: Fri, 4 Apr 86 02:08:45 EST + From: Pandora B. Berman + To: KARENS at AI + cc: BUG-ITS at AI + Re: MC UNIT 1/PACK 13 + has DEC made any progress in fixing this RP04?... + +apparently they came today and replaced the entire RP04. Whoever brought +MC up after this decided for some reason that it was still broken. The +console hardcopy doesn't look like they tried very hard, but I wasn't there +so I don't know what really happened... Perhaps I'll take MC down for a +few minutes tonight and see if I can figure out what the problem is. + +Date: Fri, 4 Apr 86 02:08:45 EST +From: "Pandora B. Berman" +Subject: MC UNIT 1/PACK 13 +To: KARENS@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].23885.860404.CENT> + +has DEC made any progress in fixing this RP04? i've gone by occasionally +and seen notes promising to come back with more parts, but it's still +offline. this is causing some potential problems: while Alan has made lots +of progress in moving everything vital to AI, he can't move anything from +SECOND: (PK13) because it's offline. maybe you could check on how DEC is +doing on this, and impulse them to further effort if necessary? thanks. + +Received: from MOSCOW-CENTRE.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 31 MAR 86 05:02:53 EST +Date: Mon, 31 Mar 86 05:02 EST +From: David Vinayak Wallace +Subject: disowned vs in background +To: BARTH@MIT-AI.ARPA, MBECK@MIT-AI.ARPA +cc: BUG-ITS@MIT-AI.ARPA +In-Reply-To: <[AI.AI.MIT.EDU].22357.860329.CENT> +Message-ID: <860331050242.8.GUMBY@MOSCOW-CENTRE.AI.MIT.EDU> + + Date: Sat, 29 Mar 86 17:23:33 EST + From: "Pandora B. Berman" + + Date: Thu 27 Mar 86 06:47:55-EST + From: "Mark Becker" + I admit ignorance as well... when I see a "disowned" job on an ITS, its + usually associated with some username somewhere. + ----------begin forwarded mail---------- + Date: Wed, 26 Mar 86 23:17:29 EST + From: Richard Barth + + Ignorant question for today... + What's the difference between running a job in the background and + disowning it? + + beyond my limited technical ability to describe. someone on this list should + be able to help you more. + +Roughly speaking, a disowned job has no superior nor controlling TTY, +(f'rinstance like COMSAT normally runs). DDT lets you run jobs in +background, (e.g. w/ or ) by running them without the TTY and +handling output differently. Their superior is still DDT. From ITS's +point of view the only difference between running a job in foreground or +in background is who owns the TTY. + +For a more detailed description, do :UUO .DISOWN, .ATTY, etc. + +david + +PS: bug-its people: what do you think of using BUG-ITS for questions + like this? I think it's a good idea, but if it's going to cause the + fixers of bugs to remove themselves on the grounds of traffic + levels, then we should have yet another list. + +Date: Mon, 31 Mar 86 00:52:51 EST +From: Alan Bawden +Subject: AI:CRASH;CRASH QLOSS +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22618.860331.ALAN> + +AI:CRASH;CRASH QLOSS contains a crash dump that I can't figure out. I +don't, unfortunately, grok the interface between the main program level +disk code and the interrupt level. It looked for all the world (to the +users) like what happens on MC when the system is hung trying to write +directories to the T-300's. I can tell that the main program level code is +waiting for bits to arrive from interrupt level, but I don't understand why +interrupt level isn't coming through. + +Of course, the fact that we have two disk drives for the first time on a KS +is something to be suspicious of... + +Date: Sat, 29 Mar 86 17:23:33 EST +From: "Pandora B. Berman" +Subject: disowned? +To: BARTH@AI.AI.MIT.EDU, MBECK@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22357.860329.CENT> + + Date: Thu 27 Mar 86 06:47:55-EST + From: "Mark Becker" + To: Cent@MC.LCS.MIT.EDU + cc: Cent.Mbeck%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU, Barth@MC.LCS.MIT.EDU + I admit ignorance as well... when I see a "disowned" job on an ITS, its + usually associated with some username somewhere. + ----------begin forwarded mail---------- + Date: Wed, 26 Mar 86 23:17:29 EST + From: Richard Barth + To: MBECK@MC.LCS.MIT.EDU + Ignorant question for today... + What's the difference between running a job in the background and + disowning it? + +beyond my limited technical ability to describe. someone on this list should +be able to help you more. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 MAR 86 07:57:25 EST +Date: Sat, 29 Mar 86 07:58:39 EST +From: Alan Bawden +Subject: So why did I bother you? +To: BUG-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 29 Mar 86 05:40:15 EST from Alan Bawden +Message-ID: <[MC.LCS.MIT.EDU].865489.860329.ALAN> + + Date: Sat, 29 Mar 86 05:40:15 EST + From: Alan Bawden + Well I just noticed that right now all new files on AI are being placed + on the secondary pack! + +This turned out to be easy to fix. If the pack on unit #0 had enough free +space, ITS never noticed that it was not a primary pack. I fixed ITS to +find a primary pack the first time someone writes a file after a boot. + +Date: Sat, 29 Mar 86 05:40:15 EST +From: Alan Bawden +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22278.860329.ALAN> + +When I booted AI Friday morning, I wanted to test that I had built a +working front-end filesystem and DSKDMP on the secondary pack. Since both +the 8080 front end and DSKDMP assume they should boot from unit #0, I +switched the unit number plugs so that the secondary pack was on unit #0 +and the primary pack was on unit #1. + +Well I just noticed that right now all new files on AI are being placed on +the secondary pack! Yesterday, with the units arranged the other way files +were being made on PK0: just like the should have. Perhaps this is some +unforseen result of my decision to number the secondary pack #1? (I should +have chosen #13 to be conventional, but couldn't think of any reason why I +couldn't choose any number I wanted.) Barf. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 MAR 86 00:51:46 EST +Date: Sat, 29 Mar 86 00:53:03 EST +From: Alan Bawden +Subject: crash;crash massbs: I see no unit #1 here. +To: MLY@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU +In-reply-to: Msg of Fri 28 Mar 86 11:20:19 EST from Richard Mlynarik +Message-ID: <[MC.LCS.MIT.EDU].865339.860329.ALAN> + + Date: Fri, 28 Mar 86 11:20:19 EST + From: Richard Mlynarik + pi level 2 bughalt + +Apparently the controller told ITS that drive #1, which I believe is +powered off, was asking for attention. (Perhaps it was wondering when DEC +was coming back with the part they need to fix it.) When ITS obligingly +asked the controller to ask the drive what its status was, the controller +reported that it timed out on the drive. I guess we write this one off to +hardware flakeiness. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAR 86 11:18:57 EST +Date: Fri, 28 Mar 86 11:20:19 EST +From: Richard Mlynarik +Sender: MLY5@MC.LCS.MIT.EDU +Subject: crash;crash massbs +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].864552.860328.MLY5> + +pi level 2 bughalt + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAR 86 09:17:59 EST +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 28 Mar 86 09:04:06 EST +Received: from FIREBIRD.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 449266; Fri 28-Mar-86 08:52:48-EST +Date: Fri, 28 Mar 86 09:00 EST +From: David C. Plummer +Subject: where do sources live? +To: David Vinayak Wallace , ALAN@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, JTW@MC.LCS.MIT.EDU +In-Reply-To: <[MC.LCS.MIT.EDU].863911.860327.GUMBY> +Message-ID: <860328090041.1.DCP@FIREBIRD.SCRC.Symbolics.COM> + + Date: Thu, 27 Mar 86 17:25:42 EST + From: David Vinayak Wallace + + Why not delete sources from MC to prevent forking? + +Why not take the phones and phone books out of your office on the +grounds you have sets at home? + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAR 86 09:02:44 EST +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 28 Mar 86 09:04:06 EST +Received: from FIREBIRD.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 449266; Fri 28-Mar-86 08:52:48-EST +Date: Fri, 28 Mar 86 09:00 EST +From: David C. Plummer +Subject: where do sources live? +To: David Vinayak Wallace , ALAN@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, JTW@MC.LCS.MIT.EDU +In-Reply-To: <[MC.LCS.MIT.EDU].863911.860327.GUMBY> +Message-ID: <860328090041.1.DCP@FIREBIRD.SCRC.Symbolics.COM> + + Date: Thu, 27 Mar 86 17:25:42 EST + From: David Vinayak Wallace + + Why not delete sources from MC to prevent forking? + +Why not take the phones and phone books out of your office on the +grounds you have sets at home? + + +Date: Fri, 28 Mar 86 09:02:47 EST +From: Alan Bawden +Subject: A new ITS is born +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU, + KARENS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22057.860328.ALAN> + +MIT-MX came up for the first time this morning. (You can supdup there +right now, but you won't find much when you get there...) There are still +some problems with the technology for creating new ITS systems from +scratch, but it mostly works. Hopefully after doing the next two (ML and +MD) things will be pretty smooth. + +All kind of worms are crawling out of the woodwork because of various +programs that -know- that all ITS machines are named "AI", "MC", "ML", or +"DM". It should take another days hacking to stomp them all... + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAR 86 09:00:09 EST +Date: Fri, 28 Mar 86 09:01:33 EST +From: Alan Bawden +Subject: where do sources live? +To: GUMBY@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, JTW@AI.AI.MIT.EDU +In-reply-to: Msg of Thu 27 Mar 86 17:25:42 EST from David Vinayak Wallace +Message-ID: <[MC.LCS.MIT.EDU].864470.860328.ALAN> + + Date: Thu, 27 Mar 86 17:25:42 EST + From: David Vinayak Wallace + Why not delete sources from MC to prevent forking? + +Because I think in would be a good idea for them to get on the last full +dump of MC. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 MAR 86 17:24:48 EST +Date: Thu, 27 Mar 86 17:25:42 EST +From: David Vinayak Wallace +Subject: where do sources live? +To: ALAN@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, JTW@MC.LCS.MIT.EDU +In-reply-to: Msg of Thu 27 Mar 86 16:59:17 EST from Alan Bawden +Message-ID: <[MC.LCS.MIT.EDU].863911.860327.GUMBY> + +Why not delete sources from MC to prevent forking? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 MAR 86 16:58:22 EST +Date: Thu, 27 Mar 86 16:59:17 EST +From: Alan Bawden +To: JTW@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].863829.860327.ALAN> + +Pinhead! You modified MC:SYSNET;TELSER instead of AI:SYSNET;TELSER. +If people make pinheaded mistakes like this we will be up to our +necks in forked sources. + +Everybody: Remember that sources live on AI! If you are in doubt, +look for a file named " MOVED TO AI " on the directory containing +the source in question on MC. If this file exists, then all of +the sources on that directory now live on AI. This has +been true of all SYS*** directories for a couple of days now. + +Date: Sun, 23 Mar 86 21:27:35 EST +From: Alan Bawden +Subject: Grand migration begins +To: BUG-ITS@AI.AI.MIT.EDU, BUG-DDT@AI.AI.MIT.EDU, + KS-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].20774.860323.ALAN> + +OK this is it. The migration of ITS system files from MC to AI is +beginning. I have already moved a few directories and mailing lists and +having just moved Bug-ITS and Bug-DDT to AI, I thought I would test them by +informing you all of how this migration will work. I expect to have most +of the SYS*** directories moved to AI by tomorrow. If you have some +question about the status of a particular directory, look for a file on +that directory named " MOVED TO AI ". If that file exists, then the file +you are looking for now lives on AI, edits on MC are likely to be lost. If +that file doesn't exist, then MC still has the master copy. In any case, +if I am logged in, be cautious about timing screws. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 23 MAR 86 16:31:26 EST +Received: from R20.UTEXAS.EDU by AI.AI.MIT.EDU.ARPA; 23 Mar 86 10:09:54 EST +Received: from ALAMO.UTEXAS (ALAMO.UTEXAS.EDU.#Internet) by R20.UTEXAS.EDU with TCP; Sun 23 Mar 86 09:08:28-CST +Date: Sun, 23 Mar 86 09:06 CST +From: Gavan Duffy +Subject: LMSEND +To: BUG-ITS@MIT-AI.ARPA +Message-ID: <860323090604.3.GAVAN@ALAMO.UTEXAS> + +It isn't on AI. Sigh. I had to CHTN to Jimi Hendrix to QSEND. + + +Date: Mon, 3 Mar 86 02:12:36 EST +From: Alan Bawden +Subject: " mode in PEEK +To: BUG-ITS@MC.LCS.MIT.EDU, BUG-PEEK@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].836305.860303.ALAN> + +I added a new mode to PEEK for printing the contents of the system message +buffer. (Type a doublequote to get it.) This is especially useful for +looking at crash dumps. While I was at it I added a few features to crash +dump mode itself. For a good example try (on AI): +:PEEK +Subject: ai crashed again +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].16595.860226.CENT> + +not just with the NXM during DUMP lossage. it got that (during the CHECK +phase) and proceeded immediately to an MTAPE:RH11 error, IMP:I NXM... +dumped to CRASH;IMP NXM. so i reloaded and tried to run ICHECK on the +tape. it got a DSK ERR UNTI#0... BUGPC/CAI QHE+3 $Q-2/SKIPGE Q,,QSDU +dumped to CRASH;DISK ERR. +the second time, ICHECK worked. + +Date: Tue, 25 Feb 86 14:02:21 EST +From: David Vinayak Wallace +Subject: Disk error +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].830224.860225.GUMBY> + +MC crashed, it looks like because it thought one of the tridents had +been powered off. I doubt anybody cares, but I dumped it to CRASH +QINTE0 just in case. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 24 FEB 86 13:36:26 EST +Date: Mon, 24 Feb 86 13:38:49 EST +From: Alan Bawden +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].16000.860224.ALAN> + +Well, basically I don't seem to ever be able to get the space to end of +tape operation to work for me. Symptom: Mount a scratch tape and copy +some files onto it (using :COPY for example). Rewind the tape (using the +REWIND command in DUMP). Open MT0: in .BIO mode and issue a +.MTAPE [ch,,[10]], while watching the drive. Observe that it clearly +doesn't go to the end of the tape. Do the same UUO again without closing +the channel and get an IRRECOVERABLE DATA ERROR. + +We are certainly going to need space-to-end-of-tape to work before we can +start doing GFRs on a regular basis, since I understand GFR tapes are +just appended together. + +Another oddity: Suppose you wrote three files on the tape. Rewind the +tape and try reading them (using :PRINT). Observe that it looks like there +is an extra, fourth, empty file after the files you wrote (before you start +getting DEVICE FULL, which I presume is what you expect to get at the end +of the tape). + +Date: Mon, 24 Feb 86 13:14:44 EST +From: Alan Bawden +Subject: This tape misery never ends. +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].828798.860224.ALAN> + +A fellow just tried to read a 7-track tape (from ML) on AI's tape drive. +The results were pretty interesting. He certainly didn't get any bits back +and he caused DUMP and the magtape code to get pretty upset. The real fun +started when he tried to kill the DUMP job. His DDT got hung up in .UCLOSE +at MTICL+12 waiting for outstanding tape commands to go away. + +I took a crash dump in AI:CRASH;MTAPE CLOSE. Note that some interesting +error messages from the tape driver were printed on the system console +before this happened. + +I'll bet lots of pinheads try this in the future. Perhaps we sould license +people before they can run DUMP? + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 19 FEB 86 00:30:33 EST +Date: Wed, 19 Feb 86 00:32:01 EST +From: "Christopher C. Stacy" +Subject: KS10 crash +To: BUG-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].14598.860219.CSTACY> + +AI crashed in the IMP code (at IMPIOS+4). I dumped it to CRASH;CSTACY IMPOS. + +Date: Fri, 24 Jan 86 02:24:13 EST +From: Alan Bawden +Subject: pifail again +To: BUG-ITS@MC.LCS.MIT.EDU +cc: CENT@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 24 Jan 86 01:20:52 EST from Pandora B. Berman +Message-ID: <[MC.LCS.MIT.EDU].794321.860124.ALAN> + + Date: Fri, 24 Jan 86 01:20:52 EST + From: Pandora B. Berman + Re: pifail again + is the name of the latest crash dump, again during an incr. dump. + +NXM on the Unibus again. This time the victimized instruction: + +MGWJD1: IORDI T,%TMCS1 ;Get controller status + +Unfortunately, all of a sudden Penny seems unable to get through an +incremental dump without having this (or some Unibus NXM) happen. (Unlike +the Chaos net board glitch the other day which only happened once.) Maybe +the LH/DH really -does- have something to do with this? Or perhaps someone +needs to physically tighten up everything on that Unibus. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 24 JAN 86 02:08:01 EST +Date: Fri, 24 Jan 86 01:20:52 EST +From: "Pandora B. Berman" +Subject: pifail again +To: BUG-ITS%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].11649.860124.CENT5> + +is the name of the latest crash dump, again during an incr. dump. + +Received: from SPEECH.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 21 JAN 86 14:50:57 EST +Date: Tue 21 Jan 86 14:49:58-EST +From: John Wroclawski +Subject: Re: ai crash +To: Moon@SCRC-STONY-BROOK.ARPA +cc: ALAN@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, KS-ITS@MC.LCS.MIT.EDU, + CENT@AI.AI.MIT.EDU +In-Reply-To: Message from "David A. Moon " of Tue 21 Jan 86 14:15:38-EST + + + Does anyone know how long the NXM timeout on a KS10 unibus is? The + Chaos board can be slower to respond (3 or 4 microseconds?) when you + read it twice in a row, as I recall. + +I think I remember it being 20 us. + + Are the KS10 cabinet and the LH/DH cabinet firmly grounded to each + other? If not, connecting a Unibus cable between them might cause + electrical problems. + +That's a thought; they're not. + +I'm inclined to write this off to cosmic rays, and worry about it if it +ever happens again after the hardware configuration of that unibus +settles down. +------- + +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 21 Jan 86 14:05:53 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 397698; Tue 21-Jan-86 13:51:23-EST +Date: Tue, 21 Jan 86 13:51 EST +From: David A. Moon +Subject: ai crash +To: JTW@MIT-MC.ARPA +cc: Alan Bawden , BUG-ITS@MC.LCS.MIT.EDU, + KS-ITS@MC.LCS.MIT.EDU, CENT@AI.AI.MIT.EDU +In-Reply-To: <[MC.LCS.MIT.EDU].790256.860120.ALAN> +Message-ID: <860121135123.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Mon, 20 Jan 86 23:00:11 EST + From: Alan Bawden + + Date: Mon, 20 Jan 86 22:32:34 EST + From: Pandora B. Berman + dumped to CRASH;PI-IN PROGRS, which is what the PI lev. 6 bughalt + complained about. see log for numbers. it was checking the incr. dump + when this happened. after AI came up, the first time i tried to run + ICHECK, DUMP got an error; it mentioned RH11 err and maybe MAG TAPE + IN DEV. HUNG or something -- see sys log for details. the second time + i tried ICHECK, it worked. + + The immediate cause of the crash was here in the interrupt level Chaos net + code: + + CHSRC5: IORDI B,CAIRBF ;Read out the data, halfwords + IORDI C,CAIRBF + + The second read from CAIRBF got a Non-Existent I/O Register error; just + like someone had suddenly unplugged the Chaos board. + +I have a vague memory that Chaos boards do this sometimes. I hope I'm wrong. +Alan and I discussed kludges for making the software resilient to this, but +I hope we don't have to resort to them. It would be in the grand tradition +of the previous two MIT-AI machines, though. + + If there were system + messages from the magtape code indicating that it was unhappy as well, then + perhaps we can conclude that the fault happened somewhere in the "I" Unibus + itself. (It would be nice if :SYSMSG worked on a crash dump!) + +I used to have a program to do this, I think. Better would be to stick SYSMSG +inside PEEK and then take advantage of PEEK's existing crash-dump-analysis feature. + + Perhaps someone who knows more Unibusology than I do can offer an opinion + about what might cause this? Remember that this is the Unibus that + supports the magtape drive, the DZ11's and the Chaosnet interface. The + magtape code was shooting bits back and forth like crazy at the time, + presumably that contributed somehow? + + JTW: Is the LH/DH plugged into this bus right now? Perhaps it did + something nasty? + +JTW: Can you look at the crash dump and figure out whether the magtape RH-11 +was supposed to be doing DMA at the time this crash happened? Maybe it and +the Chaos board interfere with each other somehow? + +Does anyone know how long the NXM timeout on a KS10 unibus is? The Chaos +board can be slower to respond (3 or 4 microseconds?) when you read it twice +in a row, as I recall. + +Are the KS10 cabinet and the LH/DH cabinet firmly grounded to each other? If not, +connecting a Unibus cable between them might cause electrical problems. + + +Received: from SPEECH.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 20 JAN 86 23:12:00 EST +Date: Mon 20 Jan 86 23:11:02-EST +From: John Wroclawski +Subject: Re: ai crash +To: alan@MC.LCS.MIT.EDU +cc: CENT@AI.AI.MIT.EDU, bug-its@MC.LCS.MIT.EDU +In-Reply-To: Message from "Alan Bawden " of Mon 20 Jan 86 23:06:09-EST + + JTW: Is the LH/DH plugged into this bus right now? Perhaps it did + something nasty? + +Yes, and maybe so. Specially since it doesn't seem to work like it is +supposed to right at the moment. It would be nice to know the state +of the UBA at that point in time... +------- + +Date: Mon, 20 Jan 86 23:00:11 EST +From: Alan Bawden +Subject: ai crash +To: BUG-ITS@MC.LCS.MIT.EDU, KS-ITS@MC.LCS.MIT.EDU +cc: CENT@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 20 Jan 86 22:32:34 EST from Pandora B. Berman +Message-ID: <[MC.LCS.MIT.EDU].790256.860120.ALAN> + + Date: Mon, 20 Jan 86 22:32:34 EST + From: Pandora B. Berman + dumped to CRASH;PI-IN PROGRS, which is what the PI lev. 6 bughalt + complained about. see log for numbers. it was checking the incr. dump + when this happened. after AI came up, the first time i tried to run + ICHECK, DUMP got an error; it mentioned RH11 err and maybe MAG TAPE + IN DEV. HUNG or something -- see sys log for details. the second time + i tried ICHECK, it worked. + +The immediate cause of the crash was here in the interrupt level Chaos net +code: + +CHSRC5: IORDI B,CAIRBF ;Read out the data, halfwords + IORDI C,CAIRBF + +The second read from CAIRBF got a Non-Existent I/O Register error; just +like someone had suddenly unplugged the Chaos board. If there were system +messages from the magtape code indicating that it was unhappy as well, then +perhaps we can conclude that the fault happened somewhere in the "I" Unibus +itself. (It would be nice if :SYSMSG worked on a crash dump!) + +Perhaps someone who knows more Unibusology than I do can offer an opinion +about what might cause this? Remember that this is the Unibus that +supports the magtape drive, the DZ11's and the Chaosnet interface. The +magtape code was shooting bits back and forth like crazy at the time, +presumably that contributed somehow? + +JTW: Is the LH/DH plugged into this bus right now? Perhaps it did +something nasty? + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 20 JAN 86 22:32:38 EST +Date: Mon, 20 Jan 86 22:32:34 EST +From: "Pandora B. Berman" +Subject: ai crash +To: BUG-ITS%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].11362.860120.CENT> + +dumped to CRASH;PI-IN PROGRS, which is what the PI lev. 6 bughalt +complained about. see log for numbers. it was checking the incr. dump +when this happened. after AI came up, the first time i tried to run +ICHECK, DUMP got an error; it mentioned RH11 err and maybe MAG TAPE +IN DEV. HUNG or something -- see sys log for details. the second time +i tried ICHECK, it worked. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 JAN 86 16:03:59 EST +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 JAN 86 16:04:12 EST +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 17 Jan 86 16:03:39 EST +Date: Fri 17 Jan 86 15:31:41-EST +From: J. J. Tyrone Sealy +Subject: Re: tape lossage +To: Moon@SCRC-STONY-BROOK.ARPA +cc: CENT%AI.AI.MIT.EDU@MC.LCS.MIT.EDU, BUG-ITS%AI.AI.MIT.EDU@MC.LCS.MIT.EDU, + TY%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +In-Reply-To: <860117134457.5.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12176026589.28.TY@XX.LCS.MIT.EDU> + +If you can come over. Please do. Unless there is someone else that can fix it. + tnx..--TY +------- + +Date: Fri, 17 Jan 86 15:51:48 EST +From: Alan Bawden +Subject: tape lossage +To: CENT@AI.AI.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, TY@MC.LCS.MIT.EDU, + Moon@SCRC-STONY-BROOK.ARPA +In-reply-to: Msg of Fri 17 Jan 86 13:44 EST from David A. Moon +Message-ID: <[MC.LCS.MIT.EDU].787522.860117.ALAN> + + Date: Fri, 17 Jan 86 13:44 EST + From: David A. Moon + Date: Fri, 17 Jan 86 07:43:58 EST + From: "Pandora B. Berman" + i wandered over to bring up MC when it crashed, and noticed tape 4000 + on the drive. apparently Ty was running a full dump. the dump log + contains a note on the MC 4000 line: "Something happened". dave, + didn't you say something about 4000 being the max. number for an + ITS tape? how does this get fixed? + I don't recall saying that. There is a limit on the highest tape number + that's controlled by the size of the SYSENG;MACRO TAPES file. The limit + can be changed; I don't remember how, but it involves code in DUMP that's + commented something like "Don't do this unless you are RJL, and even then + be careful." We probably don't need to import RJL to do it. If you need + me to come over and figure out the details, ask. + +This limit must have been reached in the past since the full dump tapes +recorded in the database only go back to some time in 1983. + +But just in case, I figured out the way to change the limit and upped it to +5000. So we probably don't need to worry about this limit on MC ever +again... + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 JAN 86 13:49:12 EST +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 JAN 86 13:49:23 EST +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 17 Jan 86 13:48:45 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 395098; Fri 17-Jan-86 13:44:24-EST +Date: Fri, 17 Jan 86 13:44 EST +From: David A. Moon +Subject: tape lossage +To: Pandora B. Berman +cc: BUG-ITS%AI.AI.MIT.EDU@MC.LCS.MIT.EDU, + TY%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].11164.860117.CENT> +Message-ID: <860117134457.5.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 17 Jan 86 07:43:58 EST + From: "Pandora B. Berman" + + i wandered over to bring up MC when it crashed, and noticed tape 4000 + on the drive. apparently Ty was running a full dump. the dump log + contains a note on the MC 4000 line: "Something happened". dave, + didn't you say something about 4000 being the max. number for an + ITS tape? how does this get fixed? + +I don't recall saying that. There is a limit on the highest tape number +that's controlled by the size of the SYSENG;MACRO TAPES file. The limit +can be changed; I don't remember how, but it involves code in DUMP that's +commented something like "Don't do this unless you are RJL, and even then +be careful." We probably don't need to import RJL to do it. If you need +me to come over and figure out the details, ask. + + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 17 JAN 86 07:43:43 EST +Date: Fri, 17 Jan 86 07:43:58 EST +From: "Pandora B. Berman" +Subject: tape lossage +To: BUG-ITS%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +cc: TY%AI.AI.MIT.EDU@MC.LCS.MIT.EDU, MOON%AI.AI.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].11164.860117.CENT> + +i wandered over to bring up MC when it crashed, and noticed tape 4000 +on the drive. apparently Ty was running a full dump. the dump log +contains a note on the MC 4000 line: "Something happened". dave, +didn't you say something about 4000 being the max. number for an +ITS tape? how does this get fixed? + +Date: Sat, 11 Jan 86 18:25:45 EST +From: Chris Hanson +Subject: Losing Dialup +To: BUG-SYSTEM@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].780740.860111.CPH> + +When I dial x6985, I am getting a connection which responds to my +carriage return with the standard "Connected to MC.", but then it +fails to give me a HACTRN. C-Z has no effect. + +I notice that *nobody* is logged in from a dialup. This seems like it +might be related. + +Received: from CSNET-RELAY.ARPA by MC.LCS.MIT.EDU 6 Jan 86 04:47:57 EST +Received: from bostonu by csnet-relay.csnet id ac02199; 6 Jan 86 4:39 EST +Received: from BUCS20 (bucs20.ARPA) by bu-cs.ARPA (4.12/4.7) + id AA14297; Sun, 5 Jan 86 17:08:56 est +Date: Sun, 5 Jan 1986 17:09 EST +Message-Id: <[BUCS20].JSOL. 5-Jan-86 17:09:02> +From: Jon Solomon +To: Alan Bawden +Cc: BUG-ITS@mit-mc.arpa, BUG-MAIL@mit-mc.arpa, BUG-RANDOM-PROGRAM@mit-mc.arpa, + KS-ITS@mit-mc.arpa +Subject: [JSOL: TELECOM] Consider this a warning. +Phase-Of-The-Moon: LQ+2D.21H.36M.2S. +In-Reply-To: Msg of 5 Jan 1986 15:26-EST from Alan Bawden + +Okay, now I know the intended audience for my message. One fact that +I forgot to mention in the other message was that this JUST started +happening about a week ago. Whoever is hacking COMSAT, please take note. + +Thanks, +--JSol + + + +Date: Sun, 5 Jan 86 15:26:51 EST +From: Alan Bawden +Subject: [JSOL: TELECOM] Consider this a warning. +To: BUG-MAIL@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, + BUG-RANDOM-PROGRAM@MC.LCS.MIT.EDU, KS-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].773515.860105.ALAN> + + MSG: *MSG 4866 + Date: 01/05/86 13:22:00 + From: JSOL at XX.LCS.MIT.EDU + To: *BBOARD at XX.LCS.MIT.EDU + Re: TELECOM + + Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 5 Jan 86 13:21:49 EST + Date: Sun 5 Jan 86 13:24:23-EST + From: Jon Solomon + Subject: TELECOM + To: BBOARD@MC.LCS.MIT.EDU + Message-ID: <12172857686.19.JSOL@XX.LCS.MIT.EDU> + + Due to the installation of a new mail system, I can no longer ship off + TELECOM to MC. Since there are quite a large number of MC users on + TELECOM, and considering the fact that this restriction might affect + other digests, I am sending this message to your bulletin board rather + than individually to MC users. + +I -believe- what he is refering to is the fact that digests tend to be +large enough that they exceed COMSAT's pitifully small size limitation. + +I note that CSTACY claimed the lock for hacking COMSAT two weeks ago, +hacked on it for an evening, and hasn't logged in since then. + +There are now about 130 BADREQ files on .MAIL2, many of them 2 weeks old. +(I'm going to have to create .MAIL3 soon...) + +Warning: If the day ever comes that I feel that it is Up-To-Me- +To-Do-Something about COMSAT (because of address space problems, lack of +proper domain support, or whatever) I will simply advise everybody that ITS +no longer supports mail for users or mail forwarding for the network and I +will shut it off. + +I feel this day -rapidly- approaching. I don't see any competent +programmers making the kind of necessary effort it is going to take to +straighten out this mess. I am forwarding this message to a large audience +in the hopes that somebody will get inspired, but I realize this is +grasping at straws. + +Date: Fri, 3 Jan 86 00:33:24 EST +From: "J. Noel Chiappa" +Subject: Static routes in MC's routing table +To: BUG-TCP@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, JNC@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].771596.860103.JNC> + + There are way too many (old) static routes in the table. They +don't seem to get updated correctly; data for SCRC was going through the +(loaded) MIT-GW instead of the (idle) MIT-AI-GW, although the rest +of the Internet got the change months ago. Someone should delete all +but the necessary ones. I deleted the SCRC one and patched it out in the +running system, with the result that it instantly picked up the right one. + Also, the ICMP Redirect code is not the best possible in that +it does no handle per-Host Redirects well; it folds them all into +the single net entry. When we start attaching ITSen to subnetted nets, +this will lose big; traffic to different subnets will thrash the +cache line. For that matter, the ITS IP layer doesn't use the correct +'mask' algorithm for dealing with host addresses (per RFC940, etc). + +Date: Sat, 28 Dec 85 19:00:48 EST +From: Alan Bawden +Subject: page fault in system +To: GUMBY@MC.LCS.MIT.EDU +cc: HIC@MC.LCS.MIT.EDU, POOR-MC@MC.LCS.MIT.EDU, + BUG-ITS@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 22 Dec 85 15:21:29 EST from David Vinayak Wallace +Message-ID: <[MC.LCS.MIT.EDU].767454.851228.ALAN> + +[ Why are we Cc'ing this message to HIC? ] + + Date: Sun, 22 Dec 85 15:21:29 EST + From: David Vinayak Wallace + ITS took a page fault. Look in CRASS PAGFLT if you care. + +Specifically, ITS took a page fault running in the scheduler. It thought +it was looking at somebody's USTP bits, but U contains gubbish, and it +looks like the hardware pagetable must have contained some kind of a joke +as well. I am tempted to agree with you that this was the result of +glitch. (That must be what you think since you mailed this to Poor-MC, +right?) + + PS: Someone seems to have deleted the pooor-mc alias. + +I don't think it ever really had that name, at least not for long. I +suggested it, but I think somebody corrected my joke thinking it was a typo +almost instantly. + +Date: Mon, 23 Dec 85 05:50:31 EST +From: Gail Zacharias +Subject: Compression +To: ALAN@MC.LCS.MIT.EDU +cc: BUG-ITS@MC.LCS.MIT.EDU, GUMBY@MC.LCS.MIT.EDU, + LIN@MC.LCS.MIT.EDU, PGS@OZ.AI.MIT.EDU +In-reply-to: Msg of Mon 16 Dec 85 15:46:52 EST from Alan Bawden +Message-ID: <[MC.LCS.MIT.EDU].764485.851223.GZ> + +AR4:GZ;ENCODE and DECODE. Encoding a large text file typically gives +a little over half of the original size. + +Date: Mon, 23 Dec 85 00:22:08 EST +From: "Glenn S. Burke" +Subject: IBO +To: BUG-ITS@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].764318.851223.GSB> + +I just got "IBO" on the dialups. i tried 6985, 6986, and 6989 for +good measure... + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 19 Dec 85 14:30:51 EST +Date: Thu 19 Dec 85 14:02:59-EST +From: "J. Noel Chiappa" +Subject: Re: ICMP: GW table full +To: ALAN@MC.LCS.MIT.EDU, BUG-ITS@MC.LCS.MIT.EDU, bug-tcp@MC.LCS.MIT.EDU +cc: JNC@XX.LCS.MIT.EDU +In-Reply-To: <[MIT-MC.ARPA].757281.851216.ALAN> +Message-ID: <12168408267.46.JNC@XX.LCS.MIT.EDU> + + This is a harmless message. The IP routing table (see PEEK 'W' +display) is a cache of the most recently used routes; when it fills up and +needs to add a new route, it punts the lest recently route. The message +is unnecessary. It would be good to notice if the cache is too small +(e.g. if the route discarded was used less than five minutes ago) and +log that; it might also be good to add a count of the number of cache +flushes and the number flushed in, say, the last hour. +------- + +Date: Mon, 16 Dec 85 23:20:56 EST +From: Alan Bawden +Subject: ICMP: GW table full +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].757281.851216.ALAN> + +If you run SYSMSG on MC you will generally find that the message buffer +is 90% full of messages of the form: +ICMP: GW table full, net/gw 20024,,600000 1200,,76 => 30001,,255000 1200,,400045 MON 22:07:12 +I presume this all means something to KLH and the rest of you TCP hackers, +but to me it is just an annoying amount of output that seems to be associated +no problem that I can see. Is this a symptom of a real problem, or does it +just mean that some fixed size table should be made a little larger? Or +perhaps we should consider not bothering the system console with this +common event, whatever it is. + +Date: Mon, 16 Dec 85 15:46:52 EST +From: Alan Bawden +Subject: Compression +To: LIN@MIT-MC.ARPA, GZ@MIT-MC.ARPA, PGS@MIT-OZ +cc: BUG-ITS@MIT-MC.ARPA, GUMBY@MIT-MC.ARPA +In-reply-to: Msg of Mon 16 Dec 1985 13:54 EST from PGS%MIT-OZ at MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].756680.851216.ALAN> + + Date: Mon, 16 Dec 1985 13:54 EST + From: PGS at OZ + Date: Monday, 16 December 1985 12:08-EST + From: David Vinayak Wallace + do you know about the ARx devices? + + I don't think those perform text compression, do they? + +No, they don't. They make a collection of small files take less space on +disk by removing the average of half a block of wasted space at the end of +every file. They also take up less room in your directory because the +names of the files are stored in the archive itself, leaving only one entry +stored in your directory. + +If you are looking for a program that compresses ASCII text by taking +advantage of the fact that certain sequences of characters are more common +than others, I think that Gail Zacharias (GZ@MC) has the best program for +this that I have seen. I can't seem to find it at the moment though. Gail? + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 16 DEC 85 14:09:24 EST +Date: Mon, 16 Dec 1985 13:54 EST +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: David Vinayak Wallace +Cc: BUG-ITS@MIT-MC.ARPA, LIN@MIT-MC.ARPA +In-reply-to: Msg of 16 Dec 1985 12:08-EST from David Vinayak Wallace + + Date: Monday, 16 December 1985 12:08-EST + From: David Vinayak Wallace + To: LIN at MIT-MC.ARPA + cc: BUG-ITS at MIT-MC.ARPA + + do you know about the ARx devices? + +I don't think those perform text compression, do they? + +Date: Mon, 16 Dec 85 12:08:03 EST +From: David Vinayak Wallace +To: LIN@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Mon 16 Dec 85 11:51:47 EST from Herb Lin +Message-ID: <[MIT-MC.ARPA].756162.851216.GUMBY> + +do you know about the ARx devices? + +Date: Mon, 16 Dec 85 11:51:47 EST +From: Herb Lin +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].756101.851216.LIN> + +help requested from a wizard. Is there any way of doing rXX text compression +on large text files purely on ITS... Something analagous to the SQUEEZE +programs available for micros? + +thans.XXX + +thanks. + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 13 DEC 85 01:30:47 EST +Date: Fri, 13 Dec 85 01:28:45 EST +From: "Pandora B. Berman" +Subject: ai died +To: BUG-ITS%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].8641.851213.CENT> + +ai suddenly hit a PI LEVEL 7 BUGHALT. crash dump to CRASH;SUDDEN LOSS + +Date: Mon, 9 Dec 85 19:41:51 EST +From: David Vinayak Wallace +Subject: oops +To: BUG-SYSTEM@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].747566.851209.GUMBY> + +As you can guess, that should have gone to bug-system@oz. Sorry + +Date: Mon, 9 Dec 85 18:04:22 EST +From: David Vinayak Wallace +Subject: dialup problem +To: CHUNKA@MIT-OZ +cc: BUG-SYSTEM@MIT-MC.ARPA +In-reply-to: Msg of Mon 9 Dec 1985 16:22 EST from Chunka Mui +Message-ID: <[MIT-MC.ARPA].747534.851209.GUMBY> + +OZ doesn't have the hardware. Your modem uses bell's 1200-baud +frequencies. Vadic uses different ones. + +Date: Sat, 7 Dec 85 19:02:36 EST +From: Alan Bawden +Subject: .msgs.; bloated +To: BUG-COMSAT@MIT-MC.ARPA, CENT@MIT-AI.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 7 Dec 85 06:10:23 EST from Pandora B. Berman +Message-ID: <[MIT-MC.ARPA].745744.851207.ALAN> + + Date: Sat, 7 Dec 85 06:10:23 EST + From: Pandora B. Berman + for reasons unknown, AI can't figure out how to purge obsolete msgs + from .MSGS.;. it wouldn't do it when the files weren't backed up, but + i expected that. however, now the files are regularly backed up, the + _LAST_ EXPIRE file looks well formed, but they -still- don't disappear + on cue. MC, on the other hand, seems to have no problem in this regard. + any ideas why? + +A Typical message from MC:.MSGS.;*MSG > begins: + + DISTRIB: *BBOARD + EXPIRES: 12/14/85 12:38:14 + Received: from BORAX by MIT-MC.ARPA 7 Dec 85 12:38:13 EST + +A typical message from AI:.MSGS.;*MSG > begins: + + Received: from MIT-MC.ARPA by MIT-AI.ARPA via Chaosnet; 7 DEC 85 12:37:44 EST + DISTRIB: *BBOARD + EXPIRES: 12/14/85 12:38:14 + Received: from BORAX by MIT-MC.ARPA 7 Dec 85 12:38:13 EST + +I suspect the recieved line at the front fakes GMSGS out when it tries to +find the expiration date. This could be fixed by changing COMSAT to not do +this, or by fixing GMSGS to be smarter. Somebody else is going to fix this +one. (I don't think it can be all -that- hard guys!) + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 7 DEC 85 06:11:37 EST +Date: Sat, 7 Dec 85 06:10:23 EST +From: "Pandora B. Berman" +Subject: .msgs.; bloated +To: BUG-ITS%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].8152.851207.CENT> + +for reasons unknown, AI can't figure out how to purge obsolete msgs +from .MSGS.;. it wouldn't do it when the files weren't backed up, but +i expected that. however, now the files are regularly backed up, the +_LAST_ EXPIRE file looks well formed, but they -still- don't disappear +on cue. MC, on the other hand, seems to have no problem in this regard. +any ideas why? + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA 29 Nov 85 23:50:31 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 364604; Fri 29-Nov-85 23:45:47-EST +Date: Fri, 29 Nov 85 23:44 EST +From: David A. Moon +Subject: Any takers? +To: Alan Bawden +cc: BUG-ITS@MIT-MC.ARPA, BUG-RANDOM-PROGRAM@MIT-MC.ARPA, + BUG-DDT@MIT-MC.ARPA +In-Reply-To: <[MIT-MC.ARPA].692189.851024.ALAN> +Message-ID: <851129234420.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu, 24 Oct 85 23:38:25 EDT + From: Alan Bawden + + With all of these parity errors MC gets these days, and with all of these + naive users who haven't the slightest idea what to do when they have + detached job trees, the amount of disowned junk is getting to be a pain. + Now there is really no good reason why a program couldn't be written that + would would look around in the system for jobs with your XUNAME and offer + some intelligent (and clearly explained) choices to you. Anybody + interested? I'm not up for thinking about the problem right now, but I'd + be happy to brainstorm in person with anyone else who would like to take a + crack at it. + + +I'm sure I wrote this at Ellen's request and she put it into the init files of +the known naive Macsyma users. I think it was called RETACH or something like +that. + + +Date: Tue, 29 Oct 85 20:47:43 EST +From: Alan Bawden +Subject: Silly lineprinter devices again. +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].697383.851029.ALAN> + +Remember the 7LP: and 7LR: devices? Well, now that we have a third such +device on the 9th floor, and another one coming soon to the 8th, it would +make sense for me to tell you that I have installed 8LP: and 9LP: devices, +right? WRONG! Since a clear numbering trend is emerging it makes sense to +change the naming scheme so that the number comes -last-. So the official +names are now: + + LP7: The 7th floor QMS 2400 + LP8: The 8th floor QMS 2400 + LP9: The 9th floor QMS 1200 + + LR7: The 7th floor laserwriter + +The two old names 7LP: and 7LR: continue to work for compatibility. + +Date: Sun, 27 Oct 85 22:20:53 EST +From: Alan Bawden +Subject: echoing weirdness +To: GRENNY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sun 27 Oct 85 20:08:43 EST from Ian Macky +Message-ID: <[MIT-MC.ARPA].694733.851027.ALAN> + + Date: Sun, 27 Oct 85 20:08:43 EST + From: Ian Macky + *fr^K!a l + e + [There goes GZ] + cTo OAF.G.BRIDGET@MIT-OZ: + ittle pkish, perhaps... + + [the "ec" from "peckish" got echoed before anything else... how WEIRD!! + (well, not before everything, but you see)] + +Just another wierd case with echoing input at interrupt level. ITS decides +how to do interrupt level echoing by looking at what job currently has +control of the TTY. In this case DDT had control of the TTY for a few +moments while it typed the Argus message, so ITS echoed the two characters +you typed during those moments. (I guess FR is looking at %TXPIE bits in +character to determine how to echo the user's typeahead.) + +I'm suprised that FR and REPLY aren't handling %PIATY interrupts. If they +were you wouldn't have seen this happen. SEND seems to be hacking %PIATY; +why should SENDER vary this aspect of its behavior for replying vs. sending? + +Date: Sun, 27 Oct 85 20:08:43 EST +From: Ian Macky +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].694678.851027.GRENNY> + +echoing weirdness: + +*fr^K!a l +e +[There goes GZ] +cTo OAF.G.BRIDGET@MIT-OZ: +ittle pkish, perhaps... + +[the "ec" from "peckish" got echoed before anything else... how WEIRD!! +(well, not before everything, but you see)] + +Date: Thu, 24 Oct 85 23:38:25 EDT +From: Alan Bawden +Subject: Any takers? +To: BUG-ITS@MIT-MC.ARPA, BUG-RANDOM-PROGRAM@MIT-MC.ARPA, + BUG-DDT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].692189.851024.ALAN> + +With all of these parity errors MC gets these days, and with all of these +naive users who haven't the slightest idea what to do when they have +detached job trees, the amount of disowned junk is getting to be a pain. +Now there is really no good reason why a program couldn't be written that +would would look around in the system for jobs with your XUNAME and offer +some intelligent (and clearly explained) choices to you. Anybody +interested? I'm not up for thinking about the problem right now, but I'd +be happy to brainstorm in person with anyone else who would like to take a +crack at it. + +Date: Tue, 22 Oct 85 14:29:28 EDT +From: Alan Bawden +Subject: super-image mode/slaved ttys +To: GUMBY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, ED@MIT-MC.ARPA +In-reply-to: Msg of Tue 22 Oct 85 00:14:31 EDT from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].688804.851022.ALAN> + + Date: Tue, 22 Oct 85 00:14:31 EDT + From: David Vinayak Wallace + ... + 1> I know he's on the same kind of terminal I am, so I want whatere + goes down the wire to his terminal to go down the wire to mine. + + 2> I want the system to hack ^P codes for me so that I can poke around + even if our terminals don't match. + + In my previous letter I was asking for 1> above, but two would be more + useful in most cases. By "escape code" I meant some ^_ code to tell + ITS just to pump the characters through. + ... + +Getting any scheme like 2 to work is probably impossible. What do you do +if the guy's terminal supports insert and delete character and yours +doesn't? What about if his terminal is 5 lines longer than yours? Even +virtual terminals have characteristics that are visible to the programs +that use them. + +1 could be made to work I guess. You would have to do it at the level of +%TD codes rather than ^P codes (since that is the only level at which there +is really a universal language). There is a bunch of other things you have +to worry about I guess, like making sure the characters you type get echoed +in the way his program desires. Given that it can only work some of the +time, and that it is pretty hard to get right, I can think of better things +to do with our time. + +Date: Tue, 22 Oct 85 00:14:31 EDT +From: David Vinayak Wallace +Subject: super-image mode/slaved ttys +To: ALAN@MIT-MC.ARPA, ED@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-to: + Msg of Mon, 21 Oct 85 13:48:07 EDT from Alan Bawden + Msg of Mon, 21 Oct 85 18:23:37 EDT from Ed Schwalenberg , +Message-ID: <[MIT-MC.ARPA].687999.851022.GUMBY> + + Date: Mon, 21 Oct 85 13:48:07 EDT + From: Alan Bawden + + Date: Mon, 21 Oct 85 06:11:40 EDT + From: David Vinayak Wallace + + Is there any way to get ITS to put your tty in super-image mode via + escape codes? Otherwise when you slave a tty you get ghubbish (making + slaved ttys almost useless. Are they a pre-TS3TTY relic?). + + I can't figure out what you are asking from this. First please distinguish + between super-image input and super-image output (two quite unrelated + things despite the similarity in names). Second please distinguish between + the various kind of escape codes in the ITS world; are you talking about ^P + codes? Third, by "slaved ttys" are you refering to the state you can + achieve in a com-link where one console's type-in is seen by another + console's job-tree? + + Date: Mon, 21 Oct 85 18:23:37 EDT + From: Ed Schwalenberg + + And fourth, is the TTY you are slaving logged-in or free, and what type + (software, printing, AAA, etc.) is your TTY and the one you're slaving? + +Ok. Let me start over: + +Luser :LUSERs me and tells me he can't run BABYL. BABYL runs fine for +me on his mail file. I'd like to ^_e him and poke around in the +debugger in his BABYL. But all I get is ghubbish on my screen. + +Two possible ways that ITS could get around this (and maybe both are +desirable for different circumstances): + +1> I know he's on the same kind of terminal I am, so I want whatere + goes down the wire to his terminal to go down the wire to mine. + +2> I want the system to hack ^P codes for me so that I can poke around + even if our terminals don't match. + +In my previous letter I was asking for 1> above, but two would be more +useful in most cases. By "escape code" I meant some ^_ code to tell +ITS just to pump the characters through. + +Free vs logged-in isn't relevent to this, since you can :TCTYP a free +tty after sending a CALL through. + +Date: Mon, 21 Oct 85 23:08:10 EDT +From: "Pandora B. Berman" +Subject: file system not fukt +To: BUG-SYSTEM@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].687814.851021.CENT> + +i should have been using $^R. my mind must be going. sorry to bother you. + +Date: Mon, 21 Oct 85 23:00:01 EDT +From: "Pandora B. Berman" +Subject: FILE SYSTEM FUKT +To: BUG-SYSTEM@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].687803.851021.CENT> + +i was in ddt, moving some ostats files to third: with $$^O. it worked for +the first one i tried no problem -- this was the second most recently +created ostats file. then i tried +$$^O ostats >,third: +and got the reply that it can't copy to a different directory -- third: +so i tried specifying the file version +$$^O ostats 3636,third: +and it replied +third: .mail.;ostats 3636 - file exists (!) + +clearly someone is real confused here, and i don't think it's me. + +Date: Mon, 21 Oct 85 13:48:07 EDT +From: Alan Bawden +Subject: super-image mode +To: GUMBY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Mon 21 Oct 85 06:11:40 EDT from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].687073.851021.ALAN> + + Date: Mon, 21 Oct 85 06:11:40 EDT + From: David Vinayak Wallace + Is there any way to get ITS to put your tty in super-image mode via + escape codes? Otherwise when you slave a tty you get ghubbish (making + slaved ttys almost useless. Are they a pre-TS3TTY relic?). + +I can't figure out what you are asking from this. First please distinguish +between super-image input and super-image output (two quite unrelated +things despite the similarity in names). Second please distinguish between +the various kind of escape codes in the ITS world; are you talking about ^P +codes? Third, by "slaved ttys" are you refering to the state you can +achieve in a com-link where one console's type-in is seen by another +console's job-tree? + +Date: Mon, 21 Oct 85 06:11:40 EDT +From: David Vinayak Wallace +Subject: super-image mode +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].686691.851021.GUMBY> + +Is there any way to get ITS to put your tty in super-image mode via +escape codes? Otherwise when you slave a tty you get ghubbish (making +slaved ttys almost useless. Are they a pre-TS3TTY relic?). + +Received: from MIT-AI.ARPA by MIT-MC.ARPA via Chaosnet; 10 OCT 85 03:15:49 EDT +Date: Thu, 10 Oct 85 03:15:03 EDT +From: Oded Feingold +To: BUG-ITS%MIT-AI.ARPA@MIT-MC.ARPA +Message-ID: <[MIT-AI.ARPA].5013.851010.OAF> + +I plugged terminals in and out of TTY07, and eventually the DZ wouldn't +answer anymore. I reloaded ITS, and left the crash dump on + DZ SILENT. +I doubt there's much interesting there. + +Date: Mon, 7 Oct 85 18:12:27 EDT +From: Christopher C. Stacy +Subject: some job device losing +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].671384.851007.CSTACY> + +I can't use any jobdevs right now because there are a whole pile of +what looks like MLDEVs with the jname "CFTP" and channels open on the +file "OZKS: ;". I am going to gun them down, preserving one corpse +CRASH;MLDEV OZ. The pc is/345 (.HANGing). + + +Date: Thu, 3 Oct 85 23:49:07 EDT +From: Tim McNerney +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Thu 3 Oct 85 15:08:07 EDT from Christopher C. Stacy +Message-ID: <[MIT-MC.ARPA].668221.851003.TIM> + + Date: Thu, 3 Oct 85 15:08:07 EDT + From: Christopher C. Stacy + To: BUG-ITS at MIT-MC.ARPA + + There is a POOR-MC@MC list now. + +What's it for? + +Date: Thu, 3 Oct 85 15:08:07 EDT +From: Christopher C. Stacy +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].667593.851003.CSTACY> + +There is a POOR-MC@MC list now. + +Date: Mon, 30 Sep 85 17:37:39 EDT +From: Alan Bawden +Subject: Pooor MC +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].663719.850930.ALAN> + +MC crashed twice today with parity errors in MH10-A (system memory). The +I/O-11 crashed both times. I reconfigured the machine to swap MH10-A and +MH10-B so that the next time errors occur in that box they won't be quite +so fatal. Conceivably someone should log a service call with DEC. I did +nothing. + +Date: Sat, 28 Sep 85 02:40:59 EDT +From: Alan Bawden +To: GZ@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Fri 27 Sep 85 23:39:45 EDT from Gail Zacharias +Message-ID: <[MIT-MC.ARPA].661760.850928.ALAN> + + Date: Fri, 27 Sep 85 23:39:45 EDT + From: Gail Zacharias + I keep getting top-level interrupts, about once every half hour. + +They are parity errors. Nothing that we can do anything about except throw +the memory out the window. Look at the bright side: some operating systems +would have halted the whole machine every time that happened, rather than +just stopping a few jobs. + +I suppose we could make the message the user gets when he gets detached +this way more explicit, but it hardly seems worth the effort given that the +day is fast approaching when ITS will only run on KS10s, which (for the +moment at least) are more reliable hardware. + +Date: Fri, 27 Sep 85 23:39:45 EDT +From: Gail Zacharias +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].661709.850927.GZ> + +I keep getting top-level interrupts, about once every half hour. + +Date: Fri, 27 Sep 85 23:15:08 EDT +From: Gail Zacharias +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].661707.850927.GZ> + +I keep getting top-level interrupts, about once every half hour. + +Date: Fri, 27 Sep 85 00:13:26 EDT +From: Alan Bawden +Subject: Bloat +To: BUG-COMSAT@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].661199.850927.ALAN> + +Due to total bloat of .MAIL.; LISTS MSGS I have created .MAIL2 and moved +many non-essential files there. Most of the queued mail is destined for OZ +which will hopefull be up sometime tomorrow (so they tell me). COMSAT +features that would be nice in a situation like this: + + It would be nice to be able to tell COMSAT to take all mail +destined for a particular host and dump it all in some file somewhere and +forget about it for a few days. Bouncing failed mail back to senders is +counter-productive in a situation like the current one. + + It would be nice if COMSAT was smarter about the finite directory +size. For example, if it looks to COMSAT like there might not be room to +GC the LISTS MSGS file in place, it could output the new LISTS MSGS on a +different directory (effectively doubling the available room for a GC). + + Easiest of all, perhaps you could set things up so that LISTS MSGS +and the MAIL > files didn't live on the same directory? Having COMSAT's GC +fighting for space with mail servers is moderately annoying at times. + +Date: Tue, 24 Sep 85 05:07:32 EDT +From: Alan Bawden +Subject: Now installed on AI, and soon to be installed on MC. +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].657412.850924.ALAN> + +There is now a demon job that runs when ITS starts up that attempts to set +the time from the network. The message that the system types out at boot +time when it discovers that the clock has been reset no longer commands the +hacker to log in and run PDSET, instead it tells him that he should just +stick around a watch what happens in case he has to run it. The demon will +print a message on the system console explaining what it did about the +time. If the demon was unsatisfied that it could determine the time, the +message will try to attract the hacker's attention and explain to him what +the problem was and tell him that he does have to run PDSET after all. + +Date: Sat, 21 Sep 85 17:34:46 EDT +From: Devon S. McCullough +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].653477.850921.DEVON> + +I keep getting toplevel interrupts (presumably parity errors?) +detaching my tree, twice in the last three hours. + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 20 SEP 85 15:13:46 EDT +Date: Fri, 20 Sep 1985 15:14 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: "Ronald I. Greenberg" , devon@MIT-MC.ARPA +Cc: BUG-ITS@MIT-MC.ARPA, bug-tctyp@MIT-MC.ARPA +Subject: terminal handler for heath +In-reply-to: Msg of 20 Sep 1985 13:33-EDT from Ronald I. Greenberg + + Date: Friday, 20 September 1985 13:33-EDT + From: Ronald I. Greenberg + To: BUG-ITS at MIT-MC.ARPA + Re: terminal handler for heath + + It appears that the terminal handler for heath terminals has been + screwed up. Using either an actual heath or a Zenith Z-29-A, + ":tctyp heath" results in something weird. A "?2h" gets printed on the + terminal, and ocassionally at some point in time (generally when you + get to the bottom of the screen I think) the terminal becomes totally + wedged. This has been noticed by me and several other members of the + Theory Group for the last couple days. + +I guess I was wrong. Devon, why don't you NOT put whatever you think is +right in the TCTYP initialization string and instead re-install the old +source and binaries. + +Date: Fri, 20 Sep 85 13:33:15 EDT +From: Ronald I. Greenberg +Subject: terminal handler for heath +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].652278.850920.RIG> + + It appears that the terminal handler for heath terminals has been +screwed up. Using either an actual heath or a Zenith Z-29-A, +":tctyp heath" results in something weird. A "?2h" gets printed on the +terminal, and ocassionally at some point in time (generally when you +get to the bottom of the screen I think) the terminal becomes totally wedged. +This has been noticed by me and several other members of the Theory Group +for the last couple days. + +Date: Fri, 20 Sep 85 12:40:25 EDT +From: Gail Zacharias +Subject: What fun! +To: ALAN@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Wed 11 Sep 85 02:14:32 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].652200.850920.GZ> + +There are servers on OZ, EE and XX. SPEECH is up to JTW I guess. The device +will deduce Speech from SPxxxx, so you could add "SP" to the table. + +Right, OZKS: does KANSAS: so jobdev kansas can go if there is a space problem. + +I think I have the output problem fixed, so I guess I'm finished. Should I +install it somewhere other than my dir? + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 19 SEP 85 13:59:59 EDT +Date: 19 Sep 1985 13:28 EDT (Thu) +Message-ID: +From: Bill Rozas +Subject: Gnu Emacs on ITS +To: PGS%MIT-OZ@MIT-MC.ARPA +Cc: BUG-ITS@MIT-MC.ARPA, "George J. Carrette" +In-reply-to: Msg of 19 Sep 1985 10:34-EDT from PGS + +What about the pain of having to emulate BSD4.2 system calls? + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 19 SEP 85 12:32:14 EDT +Date: Thu, 19 Sep 1985 10:34 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: "George J. Carrette" +Cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of 18 Sep 1985 22:45-EDT from George J. Carrette + + Date: Wednesday, 18 September 1985 22:45-EDT + From: George J. Carrette + To: BUG-ITS at MIT-MC.ARPA + cc: INFO-EXPLORER at MIT-MC.ARPA + + I wonder what GNU EMACS would be like used side-by-side with ITS EMACS? + Is the C compiler on ITS up to it? + +I doubt that the address space on ITS is up to it, especially as the 10 C +compiler doesn't do byte-packing. + +Date: Wed, 18 Sep 85 22:45:51 EDT +From: George J. Carrette +To: BUG-ITS@MIT-MC.ARPA +cc: INFO-EXPLORER@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].650277.850918.GJC> + +I wonder what GNU EMACS would be like used side-by-side with ITS EMACS? +Is the C compiler on ITS up to it? + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 16 SEP 85 15:20:18 EDT +Date: Mon, 16 Sep 1985 15:21 EDT +Message-ID: +From: PGS%MIT-OZ@MIT-MC.ARPA +To: "Devon S. McCullough" +Cc: BUG-ITS@MIT-MC.ARPA, BUG-TCTYP@MIT-MC.ARPA +Subject: H-19 initialization +In-reply-to: Msg of 16 Sep 1985 10:13-EDT from Devon S. McCullough + + Date: Monday, 16 September 1985 10:13-EDT + From: Devon S. McCullough + + CRTSTY sends "[?2hEGOq\wy8y9y5x1" but TCTYP only sends "w" + which is why CRTSTY will always win and TCTYP sometimes loses totally, + because if the H19 was last used in ANSI mode you need to send [?2h + which either clears ANSI mode or puts a "?2h" turd on the screen. + +My personal feeling is that you should $[?$h$33g$F the bastards and THEN see +if they try $259o$[J$[K'ing with you again. + +Or, alternatively, why don't you just change the initialization string in +TCTYP to what you feel is right? + +Date: Mon, 16 Sep 85 10:13:03 EDT +From: Devon S. McCullough +Subject: H-19 initialization +To: BUG-TCTYP@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].646431.850916.DEVON> + +CRTSTY sends "[?2hEGOq\wy8y9y5x1" but TCTYP only sends "w" +which is why CRTSTY will always win and TCTYP sometimes loses totally, +because if the H19 was last used in ANSI mode you need to send [?2h +which either clears ANSI mode or puts a "?2h" turd on the screen. + +CRTSTY also clears "graphics" (hah!) mode, where lower-case letters +produce strange glyphs on the screen. I think it would be fun to +fix ITS so terminals with 128 different displayable codes can print +them if %TOSAI is turned on. On H19's and VT52's this would produce +the oddity that control characters would echo down-arrow instead of ^ +before the uppercased character. + +Date: Wed, 11 Sep 85 02:14:32 EDT +From: Alan Bawden +Subject: What fun! +To: GZ@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].640776.850911.ALAN> + +The DEVICE directory was getting a bit full. The following three links +seemed to form a pattern. + + L JOBDEV OZDNRF ==> DEVICE;JOBDEV OZ (7/18/85) GZ + L JOBDEV OZKS ==> DEVICE;JOBDEV OZ (8/10/85) GZ + L JOBDEV OZSS ==> DEVICE;JOBDEV OZ (8/13/85) GZ + +So I added OZ to the magic table in SYS:ATSIGN DEVICE so that -any- 4, 5, +or 6, character device name that starts with "OZ" automatically loads +DEVICE;JOBDEV OZ. (AI, MC, ML and DM were already in the table.) Then I +deleted the links. There is also a link for a KANSAS: device. Can we do +without this given that OZKS: works just as well? Should I add XX and EE? +What about SPEECH? + +How close are you to having this thing really working? I haven't been able +to use it to -write- a file yet, although I have been using it to read all +kinds of things. (There don't seem to be many other people using the Emacs +built on the long filename Teco, but it hasn't given me any problems at +all. I guess once you think the device is "released" you can announce it +together with the new Emacs. (I guess I should think about a long filename +version of MacLisp...)) + +Date: Sat, 7 Sep 85 16:54:01 EDT +From: Ken Harrenstien +Subject: LOUIE looping +To: BUG-MAIL@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].637052.850907.KLH> + +LOUIE.UDEL.EDU appears to be looping back mail for several lists, +and giving us a bogus return-path to boot so that COMSAT error messages +just add more loops. As a temporary measure I have put LOUIE in +the LUZRS table for SYSBIN;FTPS BIN. This will cause all SMTP and FTP +connection attempts from that host to be rejected. Obviously this +is a desperation measure and a better remedy would be to add some +smarts to COMSAT so that mail from there can be set aside for a while. +I don't have the time right now for this. If someone is offended by the +unilateral censorship they can just put a zero back in LUZRS. + +Date: Fri, 6 Sep 85 04:08:06 EDT +From: Glenn S. Burke +Subject: parity errors +To: log-service-call@MIT-XX.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].635367.850906.GSB> + +MC's MH10 C was getting many parity errors, and has been shut off. +DEC has been called (log # B90393) and will be checking in in the morning. + +Date: Sun, 1 Sep 85 12:57:40 EDT +From: Alan Bawden +Subject: Feature +To: DEVON@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 18:00:59 EDT from Devon S. McCullough +Message-ID: <[MIT-MC.ARPA].630167.850901.ALAN> + + Date: Sat, 31 Aug 85 18:00:59 EDT + From: Devon S. McCullough + ... + By the way, how does the system know about sharable pure pages? + If it knows that much why doesn't it know about binaries' filenames? + +It's because the concept of a "file" exists only at a higher level of +abstraction than the level where page sharing is done. Sharing is done at +the level of pages and disk blocks. A file is a name for a sequence of +disk blocks, but there is no way to go backwards from a disk address to see +which file (if any) it came from. (Other than mapping over the entire +filesystem.) If there was some reason this operation needed to be done +with great regularity, the information could be saved. But it is rare to +want to do that, so we don't. + +(I actually have a tool that does it since I needed it once for debugging +disk ECC recovery on AI. I think there might also be a routine in the +version of the salvager that runs under timesharing that does it.) + +Date: Sat, 31 Aug 85 18:00:59 EDT +From: Devon S. McCullough +Subject: Feature +To: ALAN@MIT-MC.ARPA +cc: BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 12:36:41 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].629753.850831.DEVON> + +I was thinking that :SNARF could simply get the start address, etc, +from the croaked DDT, but Alan's suggestion is better. +By the way, how does the system know about sharable pure pages? +If it knows that much why doesn't it know about binaries' filenames? + +Date: Sat, 31 Aug 85 12:36:41 EDT +From: Alan Bawden +Subject: Feature +To: DEVON@MIT-MC.ARPA, BUG-DDT@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 31 Aug 85 03:57:02 EDT from Devon S. McCullough +Message-ID: <[MIT-MC.ARPA].629584.850831.ALAN> + + Date: Sat, 31 Aug 85 03:57:02 EDT + From: Devon S. McCullough + To: BUG-DDT at MC + I snarfed an emacs from a hactro and tried to do G + "no start address" I don't know if this is a DDT bug or an ITS bug. + +It isn't exactly anybody's bug. The start address of a program is treated +just like the symbol table. It is stored in binary files for the benefit +of people who load, start, and/or debug the program, but it is not kept +anywhere in the job itself. ITS doesn't concern itself with where you +think a job should be restarted. + +Now it -is- a little inconvenient that there is no way to go from a random +job you find floating around the system back to its binary to find its +symbols and starting address. So let me float a few suggestions through +the air and see if anybody thinks they are a good idea: + +(1) Add a user variable that would contain a starting address. This would + cover the common case that Devon complained about. (Happens to me all + the time too.) + +(2) Add four user variables that would contain the filename of the binary + for the this job. This would enable symbols to be found as well as the + start address. + +(3) Add a user variable that contains the address of a block in the job's + address space, in some extensible format we design later, that contains + all kinds of information. Like a vector of start addresses, filenames + of binary files, etc. + +(4) Since (3) requires cooperation from the job itself, but (1) covers the + most common case, we could do both. One user variable containing a + start address and one containing the address of a block of information + (or zero if the job doesn't have one). Note that these are both 18 bit + quantities, so this really only adds an extra word to every set of job + variables. + +A problem with (3) and (4) is that the new info-block user variable seems +somehow redundant with the existing use of the left half of .40ADDR. The +16.-word block addressed by LH(.40ADDR) is currently only used for +temporary hacking by a job's superior; perhaps there is some way to combine +the two? Perhaps one of the words addressed by RH(.40ADDR) can be the +info-block pointer if the job sets some bit in .OPTION? + +I guess I'm in favor of at least (1) if not some variant of (4). + +Date: Mon, 19 Aug 85 02:50:42 EDT +From: Glenn S. Burke +Subject: "dialup line disconnected, detached job #75, usr:gsb hactrn" +To: ALAN@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].617433.850819.GSB> + + Date: Sat, 17 Aug 85 22:30:43 EDT + From: Alan Bawden + + Date: Fri, 16 Aug 85 17:06:59 EDT + From: Glenn S. Burke + + I take it this was what you found printed on the system console? + +Yes. I had received a 'toplevel interrupt, tree detached' message. +My hactrn was not stopped however. + +Date: Sat, 17 Aug 85 22:30:43 EDT +From: Alan Bawden +Subject: "dialup line disconnected, detached job #75, usr:gsb hactrn" +To: GSB@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Fri 16 Aug 85 17:06:59 EDT from Glenn S. Burke +Message-ID: <[MIT-MC.ARPA].616540.850817.ALAN> + + Date: Fri, 16 Aug 85 17:06:59 EDT + From: Glenn S. Burke + Re: "dialup line disconnected, detached job #75, usr:gsb hactrn" + +I take it this was what you found printed on the system console? + + huh? If it was disconnected why did i not have to request further service + from the ROLM feature? + +That's pretty wierd all right. ITS should never do that unless you are on +a tty line with %TYMDM set, and only T01 and T03 through T17 have that set in +the current ITS. That bit -used- to be set for the Rolm lines, but that is +no longer the case because MC wasn't finding out about hangups. Perhaps +there is something more fundamentally wrong with the hangup detection code? + +Date: Fri, 16 Aug 85 17:06:59 EDT +From: Glenn S. Burke +Subject: "dialup line disconnected, detached job #75, usr:gsb hactrn" +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].615285.850816.GSB> + +huh? If it was disconnected why did i not have to request further service +from the ROLM feature? + +Date: Fri, 16 Aug 85 12:34:08 EDT +From: Alan Bawden +Subject: SOPEN +To: GZ@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Mon 12 Aug 85 21:43:31 EDT from Gail Zacharias +Message-ID: <[MIT-MC.ARPA].614889.850816.ALAN> + + Date: Mon, 12 Aug 85 21:43:31 EDT + From: Gail Zacharias + If I give SOPEN the string "DSK: GZ; GZ OMAIL ", it opens DSK:GZ;GZ + REMIND instead. + +SOPEN parsed the string as "DSK:GZ;GZ >" since the trailing space fooled it +into thinking that OMAIL was supposed to be another first filename. I +fixed this problem in the source, I'll test it some time soon. (I also +documented the fact that SOPEN defaults the device to "DSK" the second +filename to ">" and the sname to the job's current sname.) + +Date: Tue, 13 Aug 85 12:33:18 EDT +From: Ed Schwalenberg +Subject: MC TTY13 +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].610759.850813.ED> + +MC's TTY13 dialup is in a state where it recognizes carrier-detect and ^Z to +mean "create a PWORD", but no typeout gets to the output buffer (according to +OS), much less to the terminal. Gunning down the PWORD doesn't even produce +a console free message. + +Date: Tue, 13 Aug 85 06:28:39 EDT +From: Christopher C. Stacy +Subject: "TTY msg from " should read "TTY msg from @" +To: DEVON@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, BUG-MAIL@MIT-MC.ARPA, bandy@LLL-CRG.ARPA +In-reply-to: Msg of Mon 12 Aug 85 23:33:11 EDT from Devon S. McCullough +Message-ID: <[MIT-MC.ARPA].610343.850813.CSTACY> + + + Date: Mon, 12 Aug 85 23:33:11 EDT + From: Devon S. McCullough + To: BUG-ITS at MIT-MC.ARPA + Re: "TTY msg from " should read "TTY msg from @" + + TTY msg from LLL-CRG.ARPA: + bandy@lll-crg <- this is for mc's broken mailer + ya see, mc is throwing away the data in the "send from". i don't + throw away the data. mc is the only site on teh whole internet + that supports sends that throws away that return-path data. + + so bitch at the smtp/sender maintainers there... + +------------ +This discussion belongs on BUG-MAIL; please edit BUG-ITS from the +distribution of further messages (if any). + +I am surprised that there are still people at this time who are +confused about the difference between a return path and a From +field. The return path information given in the SMTP "SEND FROM" +command is not equivalent to the "From" field in a message header. +The return path is located on the ENVELOPE and the From field is +located in the header portion of the mail DATA. RFC810 specifies: +"The SEND command requires that the mail data be delivered to the +user's terminal." (Note that although an SMTP module may add a +field called Return-path in the header of a message it processes, +this feature is a transmission relay trace intended for debugging.) +The message recipient is not supposed to reply to the return path, +which is not really intended for humans; rather, the return path is +for use by SMTPs to generate error receipts. If other systems are +using the return path in place of a header, then they are buggy. + +It might be a feature for MC's SMTP to retain the return path for +the user, but if the message did not have a header it would still +be buggy; personally, I think adding the return path to incoming +sends clutters them up and wastes the reader's time. This is why +most people's mail reading programs prune any return path fields +in the header from the message display. + +It is definitely LLL-CRG which is violating protocol here. + +Chris + +PS. Early this year I reported this missing header bug to the TOPS-20 + mail system maintainers (then on SU-SCORE). Their response was + that they should be putting headers on their outgoing sends, and + that their system was broken. I believe they fixed the bug, but + I have since noticed that many TOPS-20 sites did not pick up this + fix and have some old buggy SEND command. Apparently Unix is + distrbuted with this bug too. Maybe this explains your perception + about MC being the only site which "throws away" the data. + +Date: Mon, 12 Aug 85 23:33:11 EDT +From: Devon S. McCullough +Subject: "TTY msg from " should read "TTY msg from @" +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].610043.850812.DEVON> + +TTY msg from LLL-CRG.ARPA: +bandy@lll-crg <- this is for mc's broken mailer + +you said it. old its. there isn't anything more silly sometimes than its. + +it's not what everyone else does. + +that send saying it's my fault went to me. tee hee +^_ +TTY msg from LLL-CRG.ARPA: +bandy@lll-crg <- this was generated by hand + +it's mc that's throwing away data. sample conversation: + helo lll-cr + send from: + rcpt to: + data + this is a send + . + quit + +ya see, mc is throwing away the data in the "send from". i don't +throw away the data. mc is the only site on teh whole internet +that supports sends that throws away that return-path data. + +so bitch at the smtp/sender maintainers there... + + +Date: Mon, 12 Aug 85 21:43:31 EDT +From: Gail Zacharias +Subject: SOPEN +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].609927.850812.GZ> + +If I give SOPEN the string "DSK: GZ; GZ OMAIL ", it opens DSK:GZ;GZ REMIND +instead. + +Date: Wed, 7 Aug 85 16:30:56 EDT +From: David Vinayak Wallace +Subject: AI net connection loses +To: ALAN@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, CENT@MIT-MC.ARPA +In-reply-to: Msg of Tue 6 Aug 85 08:38:46 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].604169.850807.GUMBY> + + Date: Tue, 6 Aug 85 08:38:46 EDT + From: Alan Bawden + + Date: Tue, 6 Aug 85 06:51:19 EDT + From: David Vinayak Wallace + Why can't NET in LOCK reset AI's chaosnet interface? Or am I confused? + + You are totally confused. When the hardware breaks, what do you expect the + software to do? (It doesn't look to me like the problem is specific to AI + anyway, it looks more like subnet 6 is broken somehow.) + +It wasn't clear to me from her message what had lost. And anyway, +frequently when the hardware gets wedged resetting it causes it to +start working again. From her description of the symptoms I guessed +that perhaps something like that was happening. + +Date: Tue, 6 Aug 85 08:38:46 EDT +From: Alan Bawden +Subject: AI net connection loses +To: GUMBY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, CENT@MIT-MC.ARPA +In-reply-to: Msg of Tue 6 Aug 85 06:51:19 EDT from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].602230.850806.ALAN> + + Date: Tue, 6 Aug 85 06:51:19 EDT + From: David Vinayak Wallace + Why can't NET in LOCK reset AI's chaosnet interface? Or am I confused? + +You are totally confused. When the hardware breaks, what do you expect the +software to do? (It doesn't look to me like the problem is specific to AI +anyway, it looks more like subnet 6 is broken somehow.) + +Date: Tue, 6 Aug 85 06:51:19 EDT +From: David Vinayak Wallace +Subject: AI net connection loses +To: BUG-ITS@MIT-MC.ARPA +cc: CENT@MIT-MC.ARPA +In-reply-to: Msg of Tue 6 Aug 85 05:04:47 EDT from Pandora B. Berman +Message-ID: <[MIT-MC.ARPA].602162.850806.GUMBY> + +Why can't NET in LOCK reset AI's chaosnet interface? Or am I confused? + +Date: Tue, 6 Aug 85 05:04:47 EDT +From: Pandora B. Berman +Subject: AI net connection loses +To: BUG-HARDWARE@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].602119.850806.CENT> + +this morning i was using MC on my terminal. around 04:30 or so response +got very slow, then a few minutes ceased altogether. AI had lost its +net connection again, so i couldn't talk to MC, OZ, or anything else. +someone please fix -- i can't work well with no terminal. + +Date: Mon, 5 Aug 85 13:43:26 EDT +From: J. Noel Chiappa +Subject: Grumble, Don't-Reap is no sticky +To: BUG-ITS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].601108.850805.JNC> + + I set the 'don't reap' bit on certain mailing list +address list files (e.g. for MIT-IP-PEOPLE), since they don't +get modified a lot and would otherwise have the potential +to go offline (e.g. if the Trident controller breaks). + However, if you modify the file and write it back out +the 'don't reap' bit gets cleared! This is a lose... + + Noel + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA 31 Jul 85 12:46:01 EDT +Received: from NEPONSET.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 286540; Wed 31-Jul-85 12:44:08-EDT +Date: Wed, 31 Jul 85 12:45 EDT +From: David C. Plummer in disguise +Subject: It's definite - TOPS-20 loses! +To: Ken Harrenstien , bug-its@MIT-MC.ARPA +In-Reply-To: The message of 28 Jul 85 07:57-EDT from Ken Harrenstien +Message-ID: <850731124518.9.NFEP@NEPONSET.SCRC.Symbolics.COM> + + Date: Sun 28 Jul 85 04:57:33-PDT + From: Ken Harrenstien + + I was able to log both ends of a telnet connection (using TOPS-20 TN here, + and the ITS datagram logger on MC) and captured an instance of the lossage. + MC is sending a repacketized segment which TOPS-20 incorrectly treats as + additional data. That is, MC's TCP sends off three separate segments, and + then when no ACK is received it decides to retransmit, but is clever and + lumps all the data together into a single segment which it then retransmits. + This new segment has the proper sequence number (same as seq # of the + original 1st segment). The data in this segment is exactly that data + which is duplicated in TN's log file. The only possible explanation is + that the TOPS-20 monitor's TCP code has a long-standing bug in it. + + It now occurs to me that I have seen this before when TN'ing to a VAX + 4.2BSD system. I always blamed the BSD code for this, and other people + claimed this was due to a bug in 4.2 server telnet, but somehow it never + seemed to go away. Looks as if this was actually a TOPS-20 bug! + + I will pursue this with the appropriate people. + +Many too many implementations have the "Doesn't correctly handle +overlapping segments" bug. The trickiest one is receiving a segment +some of whose data has already been acknowledged and some whose is new. +*sigh* + + +Date: Wed, 31 Jul 85 04:20:51 EDT +From: Christopher C. Stacy +Subject: response to old bug report of mine: TS3TTY absolved +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].594867.850731.CSTACY> + +Some time back I had reported a problem where when I first connected +to MC, the first few characters of each line appeared to be garbage. +This only happenned on dialup lines and would persist until I set the +terminal type. It really looked like ITS had initialized my TTY to +some wrong type -- the illegible graphics symbols appearing on my AAA +screen were likely-looiking control codes or padding. I didn't want +to believe that the TTY code was broken, and some other people +asserted that my problem was not possibly the fault of ITS. +Well, the other day I mentioned to my roomate that I was going to go +take a look at TS3TTY and convince myself it could not possibly be +broken. He responded by pouring over the AAA terminal documentation +and frobbing the terminal, and finally located the real culprit. +Apparently the AAA has this feature (which we had enabled) where you +can turn some bit on if you desire the first few characters of each +line to be trashed for you. + +So, this message is just a response for the record about that old bug +report I filed. The ITS TTY code was *not* at fault. + +Received: from SRI-NIC.ARPA by MIT-MC.ARPA 28 Jul 85 07:58:37 EDT +Date: Sun 28 Jul 85 04:57:33-PDT +From: Ken Harrenstien +Subject: It's definite - TOPS-20 loses! +To: bug-its@MIT-MC.ARPA +cc: klh@SRI-NIC.ARPA + +I was able to log both ends of a telnet connection (using TOPS-20 TN here, +and the ITS datagram logger on MC) and captured an instance of the lossage. +MC is sending a repacketized segment which TOPS-20 incorrectly treats as +additional data. That is, MC's TCP sends off three separate segments, and +then when no ACK is received it decides to retransmit, but is clever and +lumps all the data together into a single segment which it then retransmits. +This new segment has the proper sequence number (same as seq # of the +original 1st segment). The data in this segment is exactly that data +which is duplicated in TN's log file. The only possible explanation is +that the TOPS-20 monitor's TCP code has a long-standing bug in it. + +It now occurs to me that I have seen this before when TN'ing to a VAX +4.2BSD system. I always blamed the BSD code for this, and other people +claimed this was due to a bug in 4.2 server telnet, but somehow it never +seemed to go away. Looks as if this was actually a TOPS-20 bug! + +I will pursue this with the appropriate people. +------- + +Date: Sun, 28 Jul 85 07:07:01 EDT +From: Ken Harrenstien +Subject: RMAIL display problem - yet more data +To: BUG-ITS@MIT-MC.ARPA, GSB@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].591010.850728.KLH> + +I was finally able to provoke this bug simply with DDT ^R typeout of +a file -- conclusive proof that the problem does not lie with TECO, +EMACS, or RMAIL. It is not reproducible however (doing another typeout +will not lose in the same place, if at all). + +Date: Sun, 28 Jul 85 06:58:50 EDT +From: Ken Harrenstien +Subject: RMAIL display problem - yet more data +To: BUG-ITS@MIT-MC.ARPA, BUG-RMAIL@MIT-MC.ARPA, + BUG-EMACS@MIT-MC.ARPA, BUG-TECO@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].590992.850728.KLH> + +Well, with considerable pain I was able to cause an example of +this lossage while keeping a TCP datagram log. However, the log +doesn't show what I expected; I was looking for the stretch of +duplicated text that I observed, and couldn't find it. There are +some retransmissions but they are all correct. + +Until GSB commented on the fact that the extra stuff seemed to be +a duplicate of previous stuff, I hadn't noticed this attribute, but +since then I've checked every instance and this appears to be always +true. Something somewhere is being retransmitted or re-used. + +Since this happens with both CTN (CRTSTY SUPDUP) and TOPS-20 TN, +it isn't a TOPS-20 user-program problem. Since the outgoing datagram log on +MC shows no problems, the obvious deduction is that this looks like a +TOPS-20 monitor problem. As it happens, the duplicated stuff does appear +to correspond to a re-packetized TCP segment. More tests will be +necessary to confirm this, however. + +This also implies that GSB's problem is actually something different +from this one. Since he mentioned it happening with PEEK, I think +we should confine further discussion to BUG-ITS and leave out +BUG-RMAIL,TECO,EMACS unless more information turns up. + +Date: Fri, 26 Jul 85 22:10:20 EDT +From: Alan Bawden +Subject: 7LP: and 7LR: +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].589842.850726.ALAN> + +Remember the 7LP: device I advertised in this spot last winter? (I sends +output to the LN01 printer on the 7th floor.) Well, I have just installed a +7LR: device for sending output to the new laserwriter (also on the 7th +floor). + +While I was at it I gave both devices a new feature. They now support +deletion so you can delete items from the queue. For example, if 7LP^F +shows you the following: + + 7th floor ln01 is ready and printing + Time Owner Job Files Size + *21:55 alan 905 7LP: BAWDEN; B 249 49481 + + The most recent job printed was: + 21:21 alan 7LP: BAWDEN; .FILE. (DIR) + +then you can delete job 905 by doing either ^O 7LP:905 or ^O 7LP:ALAN. In +the later case all entries owned by ALAN are deleted. The second filename +and directory are ignored. + +Date: Thu, 25 Jul 85 16:39:03 EDT +From: Alan Bawden +Subject: Hardware +To: TY@MIT-MC.ARPA, MYK@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA, + F-S@MIT-OZ +Message-ID: <[MIT-MC.ARPA].587801.850725.ALAN> + +The parity errors MC was getting today seem to be closely correlated to +when the tape drive was being used. I don't know when DEC is coming back +to fix the first memory box, but perhaps some diagnostics should be run to +see if the tape drive and it's DF10 are functioning properly. + +Date: Wed, 24 Jul 85 18:06:43 EDT +From: Alan Bawden +Subject: I thought we were more carefull than this... +To: BUG-ITS@MIT-MC.ARPA +cc: DANIEL@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].586331.850724.ALAN> + +MC was unusable for most of today because DEC brought up the machine with +the T-300's write-protected. ITS should really say something more explicit +when this happens than "T300 ERR ... STATUS = 1 ...". + +Date: Tue, 23 Jul 85 22:37:28 EDT +From: Glenn S. Burke +Subject: re: RMAIL display problem +To: KLH@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, BUG-RMAIL@MIT-MC.ARPA, + BUG-EMACS@MIT-MC.ARPA, BUG-TECO@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].586008.850723.GSB> + +I cam make it happen with peek on a 60 high 118 wide screen, just like i +can with rmail. looks like the cursor positioning goes bonkers as a +function of me typing at it. + +Date: Mon, 22 Jul 85 18:06:15 EDT +From: Glenn S. Burke +Subject: re: RMAIL display problem -- you'll like this +To: KLH@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, BUG-RMAIL@MIT-MC.ARPA, + BUG-EMACS@MIT-MC.ARPA, BUG-TECO@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].584681.850722.GSB> + +right here in the privacy of my own office, i can reproduce this, freeze +the screen, and get a hardcopy of the lossage. Isn't VMS wonderful? + +Date: Mon, 22 Jul 85 13:30:54 EDT +From: Ken Harrenstien +Subject: RMAIL display problem +To: KLH@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, BUG-RMAIL@MIT-MC.ARPA, + BUG-EMACS@MIT-MC.ARPA, BUG-TECO@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].584298.850722.KLH> + +Some additional data which supports the theory that a user-program or +ITS TTY bug may be involved: + +Date: Thu, 18 Jul 85 22:40:40 EDT +From: Glenn S. Burke +Subject: RMAIL display problem +To: KLH@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].581085.850718.GSB> + +All the times i have seen such an error i have been able to find duplicated +text on the screen and the supposition was that it was a duplicated +tcp packet or something like that. I have seen this both internetting +from ru-net to here (from a 20) and i believe just within rutgers +(tops-20 -> tops-20 just on ru-net). + ---------------------- +Date: Fri, 19 Jul 85 23:45:04 EDT +From: Glenn S. Burke +Subject: tty lossage +To: KLH@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].582348.850719.GSB> + +well maybe i should take back what i said last night. +I'm coming from a microvax vaxstation running a vt100 emulator window, +running decnet to a 750 (corwin) from whence i'm doing chaosnet supdup +to mc. The window size is 94 wide by 55 high [i TOLD it 96 wide at this +end, you know how these things are...] anyway, i have a two screen long +(at this screen size) message, and if i have it redisplay the first and +get a space (in rmail, go to next screen) before it finishes, it invariably +fucks up. + +anyway, there ain't no tcp in THIS network path. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 19 Jul 85 11:41:37 EDT +Date: Fri 19 Jul 85 11:43:49-EDT +From: "J. Noel Chiappa" +Subject: Re: memory woes +To: ALAN@MIT-MC.ARPA, CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Alan Bawden " of Fri 19 Jul 85 08:34:10-EDT + + Ty was having parity error in some module of one sector. He +replaced that module and got the exact same error in the exact same +place (he said). He thought that was suspicious, and decided to +swap the parity controllers to see if the problem moved with the +controller. It didn't. + Ask him for more details. +------- + +Date: Fri, 19 Jul 85 08:33:23 EDT +From: Alan Bawden +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Thu 18 Jul 85 19:03:04 EDT from Christopher C. Stacy +Message-ID: <[MIT-MC.ARPA].581459.850719.ALAN> + + Date: Thu, 18 Jul 85 19:03:04 EDT + From: Christopher C. Stacy + Why does ITS think it has been up all year? + +I guess somebody told MC it was 1984 when they first brought it up. + +Date: Fri, 19 Jul 85 08:31:13 EDT +From: Alan Bawden +Subject: memory woes +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Fri 19 Jul 85 07:00:43 EDT from Christopher C. Stacy +Message-ID: <[MIT-MC.ARPA].581458.850719.ALAN> + + Date: Fri, 19 Jul 85 07:00:43 EDT + From: Christopher C. Stacy + unusable, so I deselected sector 1 where they were happenning + (bank 3). Then they appeared to move to sector 0. I deselected + sector 0 too. + +I presume you remembered to turn interleaving off when you deselected +sector 1. + + If things seem to work well for a while today, + someone might want to turn sector 1 back on and see if the + errors move around. We are down alot of memory at this point. + I heard something about an Ampex parity detection module being + replaced when DEC was frobbing the machine to replace a core + stack in one of their memories. + +This wasn't DEC, it was TY I believe. I think JNC can tell you about it as +well. + +Date: Fri, 19 Jul 85 07:00:43 EDT +From: Christopher C. Stacy +Subject: memory woes +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].581432.850719.CSTACY> + +The Ampex was getting enough parity errors to render the system +unusable, so I deselected sector 1 where they were happenning +(bank 3). Then they appeared to move to sector 0. I deselected +sector 0 too. If things seem to work well for a while today, +someone might want to turn sector 1 back on and see if the +errors move around. We are down alot of memory at this point. +I heard something about an Ampex parity detection module being +replaced when DEC was frobbing the machine to replace a core +stack in one of their memories. +What's the scoop latest on the hardware? + +Date: Thu, 18 Jul 85 19:03:04 EDT +From: Christopher C. Stacy +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].580878.850718.CSTACY> + +Why does ITS think it has been up all year? + +Date: Thu, 18 Jul 85 05:55:23 EDT +From: Ken Harrenstien +Subject: RMAIL display problem +To: BUG-ITS@MIT-MC.ARPA, BUG-RMAIL@MIT-MC.ARPA, + BUG-EMACS@MIT-MC.ARPA, BUG-TECO@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].580138.850718.KLH> + +I'm not sure where the fault for this one might be, hence the shotgun +message. + +In RMAIL, when using "space" to step through successive screenfuls +of a long message, sometimes output fails to stop at the mode line; +it continues for several more lines and runs right off the bottom of +the screen, causing the terminal to either scroll or wrap up to +the top (depending on one's terminal). The screen is then permanently +messed up until a complete redisplay is forced with ^L. + +This happens for me when connected to MC either via SUPDUP (ie as a +software TTY) or via TELNET with a :TCTYP DM2500 declaration. At +first I thought it might be a CRTSTY/SUPDUP problem, but my TELNET +experiments have convinced me that it really is MC's fault. +However, I haven't been able to find a foolproof way of reproducing +the lossage. All I can say is that in the course of reading through +several SF-LOVERS digests on a 24x79 screen, this bug almost always +crops up someplace, sometimes twice or thrice in a row. I type: + N E ^K ^X r ; to invoke RMAIL + d ; for each message + +This is probably a TECO bug of some variety, but there's an off +chance it might be an ITS TTY handling bug. It's even possible +that some EMACS code is screwing up the redisplay. This has happened +for quite a while (several months). I hope someone else has a +notion of what to look for at this point. If necessary, I could +try again to save a reproducible instance of this, although it is +a rather painful task. + +Date: Fri, 12 Jul 85 09:13:59 EDT +From: Alan Bawden +Subject: crtsty lossage. +To: BUG-CRTSTY@MIT-MC.ARPA +cc: CSTACY@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA, CENT@MIT-MC.ARPA +In-reply-to: Msg of Fri 12 Jul 85 02:18:26 EDT from Christopher C. Stacy +Message-ID: <[MIT-MC.ARPA].573277.850712.ALAN> + +I renamed SYSBIN;CRTSTY OBIN => CRTSTY BIN => CRTSTY XBIN. I presume the +behavior we were observing was something that KLH introduced when he +assembled CRTSTY yesterday. + +BTW, I notice there is a link from TS NCRTSTY to SYSBIN;CRTSTY NBIN, which +despite its name is a year older than any other version. Is there a reason +for this? + +Date: Fri, 12 Jul 85 02:18:26 EDT +From: Christopher C. Stacy +Subject: crtsty lossage? +To: BUG-CRTSTY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, CENT@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].572965.850712.CSTACY> + +I just dumped a dead CRTSTY into CRASH;CRTSTY VT100. +This was EAK CRTSTY, +(.VALUE;IOCH7;) 70110>>SKIPGE @413 130624/ 4,,27000 + +I guess it got a fatal interrupt, but I don't know +anything about this program. There were n of these +guys lying around, all stopped in the same way. + +Date: Fri, 12 Jul 85 00:56:15 EDT +From: Pandora B. Berman +Subject: crtsty lossage? +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].572909.850712.CENT> + +something's wrong. over the past several hours i have found half a dozen +CRTSTYs disowned with .VALUE 200. also several ___###s disowned. i can only +tell from what i see in PEEK; someone who knows more should check this. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA.ARPA; 10 Jul 85 23:20:03 EDT +Date: Wed 10 Jul 85 23:21:13-EDT +From: "J. Noel Chiappa" +Subject: Re: level2 bughalt +To: DANIEL@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +cc: JNC@MIT-XX.ARPA +In-Reply-To: Message from "Daniel Weise " of Sun 7 Jul 85 17:07:05-EDT + + Well, the TARAKA DMPCPY business is a daemon copying the dump +from the swapping area (where DDTDSK put it) into the real file system. +The file seems to have gone into the directory '.' rather than 'CRASH'; +'.' is the default directory used by DDTDSK. + Noel +------- + +Date: Mon, 8 Jul 85 14:54:11 EDT +From: Jonathan D. Taft +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].567927.850708.TAFT> + +DSK:UNIT 1 LOSING.RH CONI BITS= 1,,157236 + +Dumped to CRASH;UNIT1 LOSING + + +Date: Sun, 7 Jul 85 17:05:05 EDT +From: Daniel Weise +Subject: level2 bughalt +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].566858.850707.DANIEL> + +MC wedged itself again this afternoon. I took crash +dump to CRASH LEVEL2 and warm booted. But during +warm boot it printed something like +TARAKA DMPCPY . CRASH LEVEL2 DELRNM +(MC's vt52 is missing so I am typing this in from +memory). + +When I looked for crash;crash level2 the file +wasn't there. What did I do wrong? + +Daniel + +Date: Fri, 5 Jul 85 00:41:26 EDT +From: David A. Moon +Subject: Re: IMP down detection +To: JNC@MIT-XX.ARPA +cc: CSTACY@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].565142.850705.MOON> + + Date: Mon 24 Jun 85 17:54:25-EDT + From: "J. Noel Chiappa" + + I think that it's a known bug with the IMP code that if the + IMP cycles after ITS is up ITS doesn't deal with that correctly. + +It used to work. Maybe I broke it when I removed support for NCP protocol +a few years ago. + +Date: Fri, 5 Jul 85 00:07:06 EDT +From: David A. Moon +Subject: oh, yeah +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].565121.850705.MOON> + + Date: Mon, 1 Jul 85 17:20:31 EDT + From: Christopher C. Stacy + + It is probably a bug that ITS refuses all Chaosnet service + when it is being debugged. There is a feature in NETWRK + for doing this in the Chaosnet specific code. SYSDBG is + maybe not quite fine-grain enough? Also, should move + TCPUSW and TCPUP to be near NETUSW, etc. + +Yeah, probably it should assume NETUSW is good enough. + +Date: Mon, 1 Jul 85 23:53:18 EDT +From: Glenn S. Burke +Sender: GSB5@MIT-MC.ARPA +Subject: crash +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].562107.850701.GSB5> + +crash;ucprl5 +1 + +Received: from MIT-XX.ARPA by MIT-MC.ARPA.ARPA; 1 Jul 85 23:11:38 EDT +Date: Mon 1 Jul 85 23:12:42-EDT +From: "J. Noel Chiappa" +Subject: Re: crashdump +To: ALAN@MIT-MC.ARPA, GSB@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Alan Bawden " of Sat 29 Jun 85 05:43:22-EDT + + I'm dubious about this being a side effect of DEC playing around. +The exact thing DEC did involved no frobbing with cables at all; all the +did was disable some of the ports the processor was using to reference +memory. (I was supposed to explain all this but forgot). + What they did was notice that we are running the machine in +two way interleave. Exactly why we are doing this is too long to explain +here, and I think Dave Moon did so once already. This being the case, +they decided that we would be less likely to have 'interference' on the +memories if we diabled KBUS2 and KBUS3 (which are after all duplicates of +KBUS0 and KBUS1 in two way interleave). I'm not sure I believe this, but +I do believe that it can't hurt and I didn't feel like arguing with the +DEC guy about it, so I let them do it. (Actually, they disabled the +memory ports to those busses, not the busses.) + However, the DF10 has it's own memory bus and port, and should +not have been affected. It's probably a flaky caused by all the power +cycling in the last week. + Noel +------- + +Date: Mon, 1 Jul 85 21:00:22 EDT +From: Devon S. McCullough +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].561917.850701.DEVON> + +I snarfed an E job when I already had one (to see what I could see) +and it renamed it E!!!!! well that's okay, but wouldn't E! or E0 have done? + +Date: Mon, 1 Jul 85 17:20:31 EDT +From: Christopher C. Stacy +Subject: oh, yeah +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].561691.850701.CSTACY> + +It is probably a bug that ITS refuses all Chaosnet service +when it is being debugged. There is a feature in NETWRK +for doing this in the Chaosnet specific code. SYSDBG is +maybe not quite fine-grain enough? Also, should move +TCPUSW and TCPUP to be near NETUSW, etc. + +Date: Sat, 29 Jun 85 05:41:16 EDT +From: Alan Bawden +Subject: crashdump +To: GSB@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Sat 29 Jun 85 02:39:48 EDT from Glenn S. Burke +Message-ID: <[MIT-MC.ARPA].559587.850629.ALAN> + + Date: Sat, 29 Jun 85 02:39:48 EDT + From: Glenn S. Burke + crash;unit-0 lost + +The DF10 got a NXM. I suspect this is an artifact of the way DEC +reconfigured the memory last Wednesday. Would we rather have the parity +errors back? Damn machine. + +Date: Sat, 29 Jun 85 02:39:48 EDT +From: Glenn S. Burke +Sender: GSB5@MIT-MC.ARPA +Subject: crashdump +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].559506.850629.GSB5> + +crash;unit-0 lost + +Date: Wed, 26 Jun 85 22:01:16 EDT +From: Alan Bawden +Subject: MC up again with all 6 disks. +To: TY@MIT-MC.ARPA, Sollins@MIT-XX.ARPA, Finn@MIT-XX.ARPA +cc: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].557107.850626.ALAN> + +JNC and I swapped the packs in unit 3 and 4 on MC (the rightmost two +T-300's) and the disk problems we were experiencing vanished. Perhaps +there is some marginal interaction between drives and packs formatted with +different alignments? If so, I guess there is some hope that things will +clear up after duplicating those packs tomorrow. + +BUG-ITS: For the record: Earlier today JNC and TY brought MC up with +-none- of the T-300's because they believed them all to be broken. They +were given this impression when UCOP got an error copying some user +directories. In fact, it has been true for a long time that there are bad +blocks amoung the directories on those packs, but since we don't +really need those extra copies of the directories this is OK. UCOP copies +the MFD -first-, and if it gets that far, that is good enough! + +Date: Tue, 25 Jun 85 01:50:24 EDT +From: David A. Moon +Sender: CENT@MIT-MC.ARPA +Subject: Addition to mailing list +To: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +cc: BUG-ITS@MIT-MC.ARPA, ks-its@MIT-AI.ARPA +Message-ID: <[MIT-MC.ARPA].554803.850625.CENT> + + Date: 23 Jun 85 20:11 +0100 + From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA + + Everybody here is waiting for the system to run, all of the hackers in + Stockholm that have heard of ITS is lyric. + + I have started the work on planing howto actualy change the KA hardware, + i want to have the posibility to run as much of the DEC diagnostics as + possible. So some type of switch-selectable aproach is prefered, but it + is no simple. + + In a month or so we shall try to have the two KI-10 Cpu:s running + SMP with T10 7.02. We plan to use this system to assemble the ITS code. + + + ( Are you sure you can deal with that volume of mail? I don't think + anyone will mind your being on them if you don't mind. + ) + + Pls try to add: ITS_bugs%QZCOM.MAILNET@MIT-MULTICS.ARPA + in both ITS bugs and ITS on ks20. + +I have done so. + + Will report as soon there is any sucsess. + +We eagerly await your report. The box of tapes, processor prints, and +documentation is sitting right next to me, thanks to a lot of work by +Penny Berman. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 24 Jun 85 17:55:25 EST +Date: Mon 24 Jun 85 17:54:25-EDT +From: "J. Noel Chiappa" +Subject: Re: IMP down detection +To: CSTACY@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +cc: JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Mon 24 Jun 85 16:10:43-EDT + + I think that it's a known bug with the IMP code that if the +IMP cycles after ITS is up ITS doesn't deal with that correctly. +------- + +Date: Mon, 24 Jun 85 16:10:35 EDT +From: Christopher C. Stacy +Subject: IMP down detection +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].554168.850624.CSTACY> + +At some point today, ITS decided the IMP was down. +It never noticed it coming back up, and thought it was +waiting for the ready line to flap. I ran LOCK and +it reset everything. + +Received: from MIT-XX.ARPA by MIT-MC.ARPA 21 Jun 85 15:05:13 EST +Date: Fri 21 Jun 85 15:03:48-EDT +From: "J. Noel Chiappa" +Subject: MC disk flakoes +To: bug-its@MIT-MC.ARPA +cc: JNC@MIT-XX.ARPA + + John Holden came and looked at the Tridents and pronounced them +all OK. Two needed touch ups to the alignment, but nothing major. He +says that it was probably the cables, which are known to be flaky. Since +he had to remove the cables to run the exerciser, he thinks that he +may have frobbed them in the right way to make the problems go away. +Things do seem to be working a bit better. We'll see. +------- + +Date: Thu, 20 Jun 85 21:11:48 EDT +From: David Vinayak Wallace +Subject: more re: mc was wedged this afternoon. +To: DANIEL@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Thu 20 Jun 85 12:12:00 EDT from Daniel Weise +Message-ID: <[MIT-MC.ARPA].550546.850620.GUMBY> + + Date: Thu, 20 Jun 85 12:12:00 EDT + From: Daniel Weise + + Claimed no net ports when only 4 people were logged in. + Console only echoed my typein but did nothin + wit it. Tried warm booting. THat failed. Took + crash dump to CRASH SAME and cold booted. + +More bits: trying to open a STY gave DEVICE FULL, which is weird. +I've seen the same thing when MC couldn't get to its tridents. + +Date: Thu, 20 Jun 85 12:12:00 EDT +From: Daniel Weise +Subject: mc was wedged this afternoon. +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].550424.850620.DANIEL> + +Claimed no net ports when only 4 people were logged in. +Console only echoed my typein but did nothin +wit it. Tried warm booting. THat failed. Took +crash dump to CRASH SAME and cold booted. + +Daniel + +Date: Sun, 16 Jun 85 20:29:08 EDT +From: Alan Bawden +Subject: mc needed cold booting this afternoon. +To: DANIEL@MIT-MC, JGA@MIT-MC +cc: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].544997.850616.ALAN> + + Date: Sat, 15 Jun 85 14:05:26 EDT + From: Daniel Weise + MC was really wedged this afternoon. Every minute it kept typing + system full, 0 pages, 0 qsk channels, etc. No user jobs able to run. + Warm booting didn't help so I took a dump to CRASH FULL and + cold-booted, which seems to have fixed things. + +Well, the crash dump shows an ITS that has been up for 5 minutes and is +having trouble initializing the first T-300. So I guess this is the +canonical T-300 controller lossage. + + Date: Sat, 15 Jun 1985 12:04 EDT + From: JGA at OZ + A little bit more on the recent lossage I mentioned earlier... + + I was logged in when RHB got wedged. Running Peek, I could see + that his job and several others were sitting there with a state + of "*logout", whatever that means. Peek could not gun his tree, + nor could Lock. + +A state of "LOGOUT" (the "*" is irrelevant really) means that the job was +already on its way towords going away. (Thats why gunning it didn't do +anything, it was already as gunned as it could get.) Without a crash dump, +or an actual wedged system, I can only guess that this is another symptom +of the T-300 lossage. + +Date: Sun, 16 Jun 85 20:26:35 EDT +From: Alan Bawden +Subject: CHTN lossage +To: JNC@MIT-MC +cc: BUG-ITS@MIT-MC +In-reply-to: Msg of Fri 14 Jun 85 18:52:47 EDT from J. Noel Chiappa +Message-ID: <[MIT-MC].544988.850616.ALAN> + + Date: Fri, 14 Jun 85 18:52:47 EDT + From: J. Noel Chiappa + Recently I have been noticing that when XX goes down, + my CHTN hangs and nothing the world seems to get me out, until it + decides to timeout the connection. ANyone know why? + +Yeah, I've noticed this too. It's not new, its been happening for years. +Just looking at the code I can't figure out how it can happen. (Note that +this is probably just a bug in CHTN; you take the risk of having bugs like +this when you go into super image input mode...) + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 15 JUN 85 14:15:18 EDT +Date: Sat, 15 Jun 1985 12:10 EDT +Message-ID: +From: JGA%MIT-OZ@MIT-MC.ARPA +To: bug-its@MIT-MC +Subject: weird wedgitude - part IIa + +One more note - a finger of MC from OZ shows the dead HACTRNs +sitting there with " STY not in use" where the ttyloc usually +goes in the finger display. + +Received: from MIT-OZ by MIT-MC.ARPA via Chaosnet; 15 JUN 85 14:15:17 EDT +Date: Sat, 15 Jun 1985 12:04 EDT +Message-ID: +From: JGA%MIT-OZ@MIT-MC.ARPA +To: bug-its@MIT-MC +Subject: weird wegitude, part II + +A little bit more on the recent lossage I mentioned earlier... + +I was logged in when RHB got wedged. Running Peek, I could see +that his job and several others were sitting there with a state +of "*logout", whatever that means. Peek could not gun his tree, +nor could Lock. + +There were several different HACTRNs sitting around in this state, +which explains the lack of net ports I guess, as well as whole bunch +of lispm file jobs. I don't know enough about lispm file jobs to tell +whether these were normal or not. + +About two minutes later my tty got wedged, and I can't log back in +because of no net ports, so that's why I'm sending this from OZ. + +Date: Sat, 15 Jun 85 14:05:26 EDT +From: Daniel Weise +Subject: mc needed cold booting this afternoon. +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].543663.850615.DANIEL> + +MC was really wedged this afternoon. Every +minute it kept typing system full, 0 pages, 0 qsk channels, etc. +No user jobs able to run. Warm booting didn't help so +I took a dump to CRASH FULL and cold-booted, which seems +to have fixed things. + +Daniel + +Date: Fri, 14 Jun 85 18:52:47 EDT +From: J. Noel Chiappa +Subject: CHTN lossage +To: BUG-ITS@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].543165.850614.JNC> + + Recently I have been noticing that when XX goes down, +my CHTN hangs and nothing the world seems to get me out, until +it decides to timeout the connection. ANyone know why? + +Date: Thu, 13 Jun 85 17:25:50 EDT +From: Robert H. Berman +Subject: intermittent login probelm +To: JGA@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].541730.850613.RHB> + +Same thing happened to me today too. +(around 4:30-5:30 PM) +I got about half-way in my login file +and the tterminal hung. tried loggin in several +times in a row with no success. Finally logged in +and everything has been ok since. + +Date: Thu, 13 Jun 85 11:23:45 EDT +From: John G. Aspinall +Subject: wierd wegitude +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].541202.850613.JGA> + +I'm having an intermittent problem of the terminal getting wedged when I log +in. The symptoms are as follows. + +Pword runs ok, and my login file starts executing. At some point, either as +the login file ends, or at a point most of the way through it where I have a +:more query about whether to run babyl or not, almost all response to typed +characters stops. The only characters that cause a response are ctrl-G and +rubout which provoke their usual behaviour. + +My login file has not been changed in months. Other people logging in from +the same concentrator (NPLASMA) have not seen the problem. I get the problem +four or five times in a row, then everything is fine again. + +John. + +Received: from THINK.ARPA by MIT-MC.ARPA 11 Jun 85 16:58:04 EST +Received: by THINK.ARPA with CHAOS id AA28106; Tue, 11 Jun 85 16:52:46 edt +Date: Tuesday, 11 June 1985, 16:54-EDT +From: Guy Steele +Subject: STINK +To: KLH@MIT-MC.ARPA, BUG-ITS@MC +Cc: gls@THINK.ARPA +In-Reply-To: <[MIT-MC.ARPA].538066.850611.KLH> +Message-Id: <850611165410.6.GLS@ROCK.ARPA> + +Hurray! + + +I simply don't know what to think +Of this late resurrection of STINK, + Once thought lost, at the last, + In the mists of the past +Like its sibling, the famed missing link. + +--Guy + +Date: Tue, 11 Jun 85 05:36:46 EDT +From: Ken Harrenstien +Subject: STINK +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].538066.850611.KLH> + +You may find this news hard to believe. + +As you may recall, the source for STINK didn't assemble properly, +and had a higher version number than the (presumably working) binary. +The true source, if it ever existed, has been lost in the distant +fires of ITS dump tapes being burned at the stake. + +I was thinking about a possible hack which at some point might require +the services of STINK. Never mind what it is. The problem as I saw +it was not the fact that STINK is unique and unsupported, but the +fact that STINK could not be supported without a real source. So +I made a half-hearted attempt to investigate by comparing the (faulty) +result of an assembly with the existing binary, using SRCCOM's /$ +switch. + +Boy, am I glad I put that hack into SRCCOM. The comparison much to +my surprise showed the binaries were virtually identical, except for +one changed label and a couple of missing symbols. It only took a few +minutes to fix those and come up with a source that assembles into +exactly the same thing (modulo .FNAM2) as the old TS STINK! + +Anyway, I wrote out this new source as STINK 200, and installed a new +TS STINK. STINK lives again! (phew) + +Date: Thu, 6 Jun 85 18:11:40 EST +From: Chris Hanson +To: BUG-SYSTEM@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].533331.850606.CPH> + +Why do I have to give a password when I supdup over from OZ? +What kind of bullshit is this? + +Date: Thu, 30 May 85 15:06:41 EST +From: Alan Bawden +Subject: All network ports in use +To: GUMBY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-reply-to: Msg of Thu 30 May 85 14:25:10 EST from David Vinayak Wallace +Message-ID: <[MIT-MC.ARPA].524704.850530.ALAN> + + Date: Thu, 30 May 85 14:25:10 EST + From: David Vinayak Wallace + Every once in a while I am unable to connect to MC via chaos; I open a + connexion and MC says "All network ports in use." This is repeatable + for about a minute or so, then I get a ddt. loadp shows 11 free net + ports. + +I fixed a bug that used to cause something like this to happen a while ago. +A new ITS for MC has not been assembled since then. + +Date: Thu, 30 May 85 14:25:10 EST +From: David Vinayak Wallace +Subject: All network ports in use +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].524623.850530.GUMBY> + +Every once in a while I am unable to connect to MC via chaos; I open a +connexion and MC says "All network ports in use." This is repeatable for about +a minute or so, then I get a ddt. loadp shows 11 free net ports. + +What gives? + +Date: Thu, 30 May 85 09:16:15 EST +From: Christopher C. Stacy +Subject: T-300s inaccessible +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].524200.850530.CSTACY> + +MC's T-300 disk controller was powered off somehow, although the +PDP11 and other frobs in the same rack were still on. I power +cycled it and reloaded the system to get things going again. + +Date: Wed, 29 May 85 15:52:32 EST +From: Alan Bawden +Subject: Most puzzling... +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].523215.850529.ALAN> + +Typical MC crash today: + +MC BUGHLT's with an MUUO in exec mode (see apparently typical example in +CRASH;CRASH MUUO'). After +L XITS +G +The salvager does -not- print its usual greeting, nor is anything else +printed on the system console. However, if you raise switch 0, ITS will +stop just as if it was running normally (see example in CRASH;CRASH NOSALV). + +Now doing +L XITS +G +again will aparently work, except that the system will hang trying to get +to unit 3 and you will need to try again after running BOOT11. + +(Note that something similar to this must have happened to Gumby the other +day, except after a different initial crash...) + +Date: Wed, 29 May 85 02:52:25 EST +From: Tim McNerney +Subject: Yow! I am reliable yet? +To: BUG-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].522693.850529.TIM> + +The time is 02:46:34 EDT. +Today is Wednesday, the 29th of May, 1985. +MC ITS 1488 has run for 103 days, 2 hours, 13 minutes, 32 seconds. +Surpassing all previous MC records for uptime! +System last revived 1 day, 2 hours, 12 minutes, 33 seconds ago. + +Date: Sun, 26 May 85 03:01:18 EST +From: David Vinayak Wallace +Subject: latest crash +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].518640.850526.GUMBY> + +I came in and MC was down; I looked at the pc; couldn't figure out what happened +so saved it in crash;crash gmmpp (it died at gmmpp+3). I loaded a new xits, but +the salvager never ran. I halted it with switch 0 and reloaded from scratch. + +Date: Sat, 25 May 85 21:28:34 EST +From: Christopher C. Stacy +Subject: AI COMSAT down for the count. +To: CENT@MIT-MC +cc: BUG-ITS@MIT-MC, BUG-MAIL@MIT-MC, DCB@MIT-MC, TAFT@MIT-MC, + ALAN@MIT-MC +In-reply-to: Msg of Sat 25 May 85 01:19:30 EST from Pandora B. Berman +Message-ID: <[MIT-MC].518526.850525.CSTACY> + +This was because COMSAT assumes that the DEAD-MAIL-RECEIPTS list +always exists, but I forgot to create it in NAMES >. I convinced the +COMSAT on AI to gobble the latest NAMES before trying to unqueue +anything, things are back to normal now, and I re-installed the +mailer on AI. + +Under certain conditions (such as fatal interrupts) AUTPSY comes out +empty. COMSAT was probably dying with PDL overflows or something. + +(BTW, I already fixed the other unrelated looping bug which ALAN +reported last week.) + + +Date: Sat, 25 May 85 01:19:30 EST +From: Pandora B. Berman +Subject: AI COMSAT down for the count. +To: BUG-MAIL@MIT-MC +cc: BUG-ITS@MIT-MC, DCB@MIT-MC, TAFT@MIT-MC +Message-ID: <[MIT-MC].517969.850525.CENT> + +AI's COMSAT is stuck in a deadly loop. whenever it is launched, it +first, of course, tries to cut down on the queued msgs by sending one +of them. trouble is, the single one in its queue is to BUG-INQUIR@MC +(alias CSTACY) and COMSAT thinks it's from DEAD-MAIL-RECEIPTS@AI. so +after sending it (it does get through, each time; cstacy now has +several of these in his mail) COMSAT tries to give a CMSG to +DEAD-MAIL-RECEIPTS@AI. there is no such address, so COMSAT says +::=. then it tries to CMSG again to the same address. after +several times, it dies after just saying CMSG. + +BURNUP 1 was the first corpse dumped by this process. BURNUP 8 is the +latest of several all of the same size (each died after only this work +on the queue, while #1 included previous activity). I tried writing a +new NAMES > with the guilty address eqv'd to NUL:, as it is on MC; +COMSAT did not try to compile this before working on the queued mail. +BURNUP 9 is COMSAT dying after i renamed LIST EQV (the bin of NAMES >) +to something else; again, COMSAT did not look for the names database +before hacking the queued mail. this is a gross bug and should be +fixed; if there is no names database, maybe it's for a good reason, +like the previous one is fuckt and someone wants comsat to pick up the +new (hopefully cured) version. BURNUP 10 is from another experiment: i +tried renaming LISTS MSGS to something else, COMSAT looked for NMSGS, +found none, and died. + +alan and moon tried to debug this over the phone, but couldn't get +enough data (AUTPSY kept containing 0 !). i have renamed AI:COMSAT +LAUNCH to COMSAT BRUNCH. ai now has enough pieces of mail that it +won't accept any more from outside. COMSAT should not be relaunched +on AI until someone fixes this. + +Date: Mon, 20 May 85 03:54:02 EST +From: Pandora B. Berman +Subject: forwarding... someone forgot to hang up? +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].510876.850520.CENT> + +Date: Fri, 17 May 85 22:29:22 EST +From: Robyn D. Spencer +To: BUG-ROLM@MIT-MC +Message-ID: <[MIT-MC].509023.850517.TOOTSE> + +bug-its +I (mason) just connected to mc through a rolm and found myself logged +in as tootse, as a mail notification popped up. +I just thought someone would like to know. + + mark + +Date: Wed, 15 May 85 20:08:30 EST +From: David A. Moon +Subject: MC crashes when you read AI backup tapes +To: CENT@MIT-MC, MOON@MIT-MC +cc: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].505155.850515.MOON5> + +I wasn't able to figure out the problem in detail, but I did edit +a bug trap into the source at MGRD2. Sometime you should exhibit +the problem with me physically present and I'll patch in this bug +trap and see if it goes off. + +Date: Wed, 15 May 85 00:52:40 EST +From: Pandora B. Berman +Subject: patch for crufty ai tapes makes mc die horribly? +To: MOON@MIT-MC +cc: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].503776.850515.CENT> + +i was trying to read some old AI tapes. they got errors, so with glenn's +advice i installed your patch: + MOON5@MIT-ML 06/30/84 03:54:39 + To: GSB at MIT-ML, CENT at MIT-ML + fyi the location to patch to disable tape read errors + in ITS is MGMRT+1 which is changd from JRST MGERR to JRST MGRD2. + It still tries a few times to retry errors but if it gets a fatal + error it gives you whatever shitty data it got instead of barfing.. + ^_ +then tried again with the tape. dump worked on tape a short while, with +some hiccupping and one reported error, then system died. crash dump in +CRASH IMRQ8. alan poked around at the code and thinks that possibly the +patch is fucking up the MEMBLT table... + +Date: Mon, 13 May 85 18:54:28 EST +From: Glenn S. Burke +Sender: GSB5@MIT-MC +Subject: bugpause: tty: buffer empty at tyirem +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].501533.850513.GSB5> + +CRASH;TYIREM NOBUFF + +Date: Fri, 10 May 85 12:50:00 EST +From: Kent M Pitman +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].495319.850510.KMP> + +MC has a pile of jobs which have PARERR'd out. Several dead COMSATs, +etc. Someone might want to look at this. + +Date: Fri, 10 May 85 04:44:57 EST +From: Glenn S. Burke +Subject: wedgitude +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].494815.850510.GSB> + +CRASH;WEDGED AGAIN is an example of this evening's wedgitude, dumped +after being stopped by switch 0. + +Received: from MIT-AI by MIT-MC via Chaosnet; 10 MAY 85 01:27:09 EDT +Date: Fri, 10 May 85 00:39:42 EST +From: J. Noel Chiappa +Subject: Zapppp! +To: BUG-its@MIT-MC +cc: JNC@MIT-AI +Message-ID: <[MIT-AI].590.850510.JNC> + + There was some breeze-shooting on the subject of speeding +up the DZ output interrupt service routines which I thought I'd +note down. Since a 9600 baud line running flat out generates +1000 interrupts/second, and the output ISR looks quite long at +the moment, a few lines running flat out will probably bring +the machine to its knees. + The theory is that we should implement efficient block mode +output; i.e. the driver emulates a DMA device and takes big chunks of +data each time ITS talks to it. We should blow some of the extra +register sets that we have, one per DZ. 8 of the registers would be +used for things like holding a pointer to the registers, etc, and +temps, and the other 8 would be pointers to output buffers. + The pointers would probably be AOBJN style pointers, with the +data uppacked one byte per word. (We can't use byte pointers because +there isn't any room for a count if so and there aren't enough +registers to have counts too, unless we restrict ourselves to 4 +general registers and keep the counts in halfwords.) At that +point, the output ISR would be about 10 instructions long: + + OPBASE = 6 ;Base of AOBJN pointer block in regs + + IORDI A,%DZRCS(D) ;Get CSR + TRNN A,%DZCTR ;Transmitter ready? + JRST LOSE ;No, spurious interrupt + LDB A,[.BP %DZLM,A] ;Get line number + MOVE T,OPBASE(A) ;Get AOBJN pointer for that line + MOVE TT,(T) ;Pick up data + IOWRI TT,%DZRTD(D) ;Write it out + AOBJP T,DONE ;All done yet? + MOVEM T,OPBASE(A) ;Put updated pointer back + JRST 12,@TTYBRK ;Dismiss + + Or something like that, anyway. + +Date: Thu, 9 May 85 21:00:50 EST +From: Alan Bawden +Subject: unlocked +To: JTW@MIT-SPEECH +cc: BUG-ITS@MIT-MC, KS-ITS@MIT-MC +In-reply-to: Msg of Thu 9 May 85 18:24:42-EDT from John Wroclawski +Message-ID: <[MIT-MC].494266.850509.ALAN> + + Date: Thu 9 May 85 18:24:42-EDT + From: John Wroclawski + From: Alan Bawden + Subject: Everything is locked + I guess it is unlikely, but it would be foolish of anyone else to try + to assemble and try anything that uses KS-10 I/O instructions.... + Uh huh. Well, let me know when you think they work OK - I do hope to + deal with the tape code sometime now that I'm back in town.. + +The I/O instructions work just fine. Last night we installed Jinx's DZ-11 +code and it works too, so the path is clear for you. + +Date: Tue, 7 May 85 17:25:44 EST +From: Ken Harrenstien +To: ALAN@MIT-MC +cc: CSTACY@MIT-MC, BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].490451.850507.KLH> + + Date: Mon, 6 May 85 21:15:15 EST + From: Alan Bawden + In-reply-to: Msg of Mon 6 May 85 10:34:28 EST from Christopher C. Stacy + + If your COMSAT problem has to do with the hair COMSAT's go through + when starting up to prevent their being more than one COMSAT, then I + believe I remember KLH mentioning this before. + +Yes, this has happened. Makes one wonder if locks really do work, or +if it is just the narrowness of the race window that gives one the impression +they work. + +Date: Tue, 7 May 85 05:58:57 EST +From: Alan Bawden +Subject: Everything is locked +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].489464.850507.ALAN> + +I guess it is unlikely, but it would be foolish of anyone else to try to +assemble and try anything that uses KS-10 I/O instructions until I get a +chance to come in and install and verify the new microcode. The macros in +KSDEFS are gone and have been replaced with the new I/O instructions I +microcoded up. What this means is that everything is probably broken. + +Date: Tue, 7 May 85 02:34:47 EST +From: David Vinayak Wallace +Subject: MC:.;IOEVEL AIBIN +To: ALAN@MIT-MC +cc: BUG-ITS@MIT-MC +In-reply-to: Msg of Mon 6 May 85 21:26:40 EST from Alan Bawden +Message-ID: <[MIT-MC].489263.850507.GUMBY> + +Doesn't the system console watch .; like sys***;? + +Date: Mon, 6 May 85 21:26:40 EST +From: Alan Bawden +Subject: MC:.;IOEVEL AIBIN +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].488587.850506.ALAN> + +Someone deleted the file MC:.;IOELEV AIBIN. It was either someone who +reads this mailing list who thought he was cleaning up, or it was a random. +In the later case there is nothing to be done, but in the former case I can +prevent this from happening again by reminding you all that AI-11 still +runs, and still network boots occasionall. + +Date: Mon, 6 May 85 21:15:15 EST +From: Alan Bawden +To: CSTACY@MIT-MC +cc: BUG-ITS@MIT-MC +In-reply-to: Msg of Mon 6 May 85 10:34:28 EST from Christopher C. Stacy +Message-ID: <[MIT-MC].488567.850506.ALAN> + +If your COMSAT problem has to do with the hair COMSAT's go through +when starting up to prevent their being more than one COMSAT, then I +believe I remember KLH mentioning this before. + +If this is a case of initializing a shared database using the algorithm +given in .INFO.;ITS LOCKS, then perhaps the unlikely screw case documented +there managed to actually happen. + +Date: Mon, 6 May 85 18:14:42 EST +From: Glenn S. Burke +To: CSTACY@MIT-MC +cc: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].488010.850506.GSB> + + Date: Mon, 6 May 85 10:34:28 EST + From: Christopher C. Stacy + + I just had a problem with COMSAT similar to the problem with + PWORD the other day, where locks did not get unlocked. + As in the previous case, the involved code has been stable for + a long time (years). Is it possible that locks have become + broken lately somehow? I heard there are bugs in the mechanism + but I don't know what they are -- maybe I am just hitting some + kind of screw case lately. + +I remember tracking down and patching the pword lock at least once +before, years ago (on AI). Maybe once on ML too. I don't believe +we knew what caused the problem. + +Date: Mon, 6 May 85 10:34:28 EST +From: Christopher C. Stacy +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].487059.850506.CSTACY> + +I just had a problem with COMSAT similar to the problem with +PWORD the other day, where locks did not get unlocked. +As in the previous case, the involved code has been stable for +a long time (years). Is it possible that locks have become +broken lately somehow? I heard there are bugs in the mechanism +but I don't know what they are -- maybe I am just hitting some +kind of screw case lately. + +Date: Sun, 5 May 85 00:53:11 EST +From: Alan Bawden +To: GSB@MIT-MC +cc: BUG-ITS@MIT-MC +In-reply-to: Msg of Sat 4 May 85 19:24:06 EST from Glenn S. Burke +Message-ID: <[MIT-MC].485622.850505.ALAN> + +Had there been paper the message would have read: "TTY: OUTPUT BUFFER +POINTER PAST END OF BUFFER". I added this crash to the collection. + +Date: Sat, 4 May 85 19:24:06 EST +From: Glenn S. Burke +Sender: GSB5@MIT-MC +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].485447.850504.GSB5> + +mc crashed, was in ddt. no paper in the system console. +dumped to crash;look later if anyone is interested and can find anything +interesting from it... + +Date: Fri, 3 May 85 15:39:42 EDT +From: J. Noel Chiappa +Subject: Drugs +To: BUG-ITS@MIT-MC +cc: JNC@MIT-MC +Message-ID: <[MIT-MC].483905.850503.JNC> + + No, I'm not on them. I know what it looks like when +PEEk gets an MPV and that wasn't it. I'm not sure what it +was (it wasn't that the job had got and unhandled MPV, +which would have shown up in the N display) but it wasn't +PEEK losing its ass. + +Date: Fri, 3 May 85 15:33:57 EDT +From: Christopher C. Stacy +Subject: No logins +To: JNC@MIT-MC +cc: BUG-ITS@MIT-MC, BUG-PWORD@MIT-MC +In-reply-to: Msg of Fri 3 May 85 12:48:09 EDT from J. Noel Chiappa +Message-ID: <[MIT-MC].483895.850503.CSTACY> + + Date: Fri, 3 May 85 12:48:09 EDT + From: J. Noel Chiappa + To: BUG-ITS + cc: JNC + Re: No logins + + PWORD was getting MPV's. I couldn't fix this (and backing up to + an older PWORD didn't fix it) so I temporarily flushed PWORD + and replaced it with DDT so that at least people could log in. + +Although JNC doesn't think so, I am convinced that he was faked out by +a bug in PEEK which sometimes causes it to print out "MPV not handled" +when it screws up. + +When I went and ran PWORD, I did not get any kind of MPV problems, but +I did get hung after the command prompt. Somehow, the lock word in +the password database was set and never cleared, so all jobs would +.HANG forever as soon as they tried to access the database. The job +which had claimed the database was long gone. I patched the password +database back into working order and re-installed PWORD. + +The code for PWORD has not been changed in a long time, so I suspect +that some kind of hardware problem (or human) somehow screwed up the +ITS locks critical routine feature, or munged the database. + +Date: Fri, 3 May 85 12:48:09 EDT +From: J. Noel Chiappa +Subject: No logins +To: BUG-ITS@MIT-MC +cc: JNC@MIT-MC +Message-ID: <[MIT-MC].483484.850503.JNC> + + PWORD was getting MPV's. I couldn't fix this (and backing +up to an older PWORD didn't fix it) so I temporarily flushed PWORD +and replaced it with DDT so that at least people could log in. + +Date: Fri, 3 May 85 12:32:32 EDT +From: John G. Aspinall +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].483460.850503.JGA> + +MC has been up all morning, but refuses to establish +proper connections for incoming network telnets and supdups. +Dialups also appear flaky, but I'm not sure about this. + +Symptoms - you get the telser message "MC Maximum Confusion PDP-10" +and then nothing. + +Finger from another site shows lots of un-logged-in HACTRNs sitting +there. Note that outgoing chtn, telnet, supdup are fine. +Incoming finger is fine too. + +I don't know enough about what's going on to do anything constructive, +but I'd be interested in finding out what the diagnosis is. + +Date: Tue, 30 Apr 85 01:16:24 EDT +From: Alan Bawden +Subject: Oh yeah, right... +To: GREN@MIT-MC +cc: BUG-ITS@MIT-MC, KS-ITS@MIT-MC, BUG-DDT@MIT-MC +Message-ID: <[MIT-MC].476201.850430.ALAN> + + [Message from GREN at MIT-AI 1:05pm] + hey, single-stepping isn't working right! + +Oh yeah. Until I get back into microcode hacking again, hackers who debug +programs using DDT on AI will find that features related to single stepping +don't work right. I'll fix it eventually, I just haven't put in the +support for it yet. + +I won't be fixing the fact that AI doesn't have a MAR, so somebody should +be fixing DDT to know that some ITS machines lack the feature. + +Date: Fri, 26 Apr 85 22:53:01 EST +From: Pandora B. Berman +Subject: bring back old PDSET +To: BUG-PDSET@MIT-MC, BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].471957.850426.CENT> + +MC crashed, and in being brought up had to have its time reset. in doing so +i had to employ the new frilly version of PDSET. yucko. the old one worked +fine with less verbiage and could parse 6-digit numbers into times and +dates, which the new one can't. please flush this and restore the previous +version. + +Date: Fri, 26 Apr 85 02:05:57 EST +From: David Vinayak Wallace +Subject: More on IMP opto-isolator board -- fixt for now. +To: BUG-ITS@MIT-MC +cc: DCLARK@MIT-MC, ANN@MIT-MC, JTW@MIT-MC, + moon@SCRC-STONY-BROOK +Message-ID: <[MIT-MC].470299.850426.GUMBY> + +ITS was unable to get any bits through for long enough to open a +connection. Noel found a similar chip to the broken one in a chaosnet +interface. We (me, jtw, jnc) yanked it and installed it (the same hack was +apparently done five years ago). + +As this is the second one to fail, it is likely that another one will soon, +and that the board may not appreciate being frobbed like this yet another +time. I might make another isolator board sometime before the end of the +term if I can get away with it. + +david + +Date: Tue, 23 Apr 85 07:49:26 EST +From: Glenn S. Burke +Subject: mc memory randomness +To: BUG-ITS@MIT-MC +cc: CENT@MIT-MC +Message-ID: <[MIT-MC].465864.850423.GSB> + +mc tripped and fell down this morning. As might be expected, the system +console hardcopy for the previous hour was all overprinted on a single line. +There was a parity error light on in the ampex (penny recorded this in the +log). + +Cold booting worked until it checked NXM, when it decided that most +(but not all) of the two high MH10s were not there. The memory was +listed in a large number of randomly sized chunks. Power cycling +those two cabinets didn't help. (The overtemp light had been on in C +-- don't know if it had been on as of when the machine went down.) +Deselecting them seemed to be a good idea and seems to be working... + +Since the machine was up, and seeing the time, i decided to pass off +calling DEC to ann finn (unlike what i wrote in the log earlier). + +Date: Mon, 22 Apr 85 21:57:01 EST +From: Alan Bawden +Subject: foo +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].465386.850422.ALAN> + +MC's console card said I was supposed to load XITS, but there wasn't any +such file. I dumped XITS myself several days back, so I wonder who renamed +it to be OXITS without explanation? + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA; 15 APR 85 22:35:51 EST +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 215097; Mon 15-Apr-85 22:35:39-EST +Date: Mon, 15 Apr 85 22:32 EST +From: David A. Moon +Subject: M-X Copy File +To: Alan Bawden +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: <840915120628.5.MOON@EUPHRATES.SCRC.Symbolics>, + <[MIT-MC].451173.850411.ALAN> +Message-ID: <850415223234.7.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu,11 Apr 85 13:10:07 EST + From: Alan Bawden + + A file's author is currently apparently set from the UNAME of the writing + job. (I surmise, I haven't looked at the code yet.) Perhaps the XUNAME + should be used instead? + +Here's the previous discussion of this: + + Date: Saturday, 15 September 1984, 12:06-EDT + From: David A. Moon + + Date: 14 September 1984 21:00-EDT + From: Christopher C. Stacy + + M-X Copy File does not preserve authors on ITS. + It does preserve reference date (although maybe it should + use DNRF instead of referencing the file to copy it) and + the creation date. + + This is because the routine CLOSIT in the FILE job sets the author of the + file it just wrote to the user's HSNAME. Evidently it does this because + the FILE job doesn't login under the name of the user who is using it. + We can do one of + (1) Make the FILE job login under the right name. + (2) Make ITS set the file author from the XUNAME instead of the UNAME and + make the file job set its XUNAME to the user's name instead of to + a copy of its UNAME. + (3) Make the FILE job set the author when it opens the file instead of + when it closes it. + Suggestions? + ------- + Kerns suggests doing #3 or making ITS set the author from HSNAME instead + of the UNAME. That sounds good except what about ^S? + +Last week I thought, mistakenly, that using ^S to run EMACS on +another's terminal would make me be the author of files that I write. +I think it should. Hence: + + - ITS should set the author of the file to the HSNAME. + - The file job should set its HSNAME to that of the user on whose + behalf it is acting. + - The file job shouldn't set the author gratuitously. + +In the above, HSNAME would be XUNAME were it not for the fact that authors +are stored as directory numbers rather than as sixbit strings. + +Anyone disagree? + + +Date: Thu,11 Apr 85 13:10:07 EST +From: Alan Bawden +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].451173.850411.ALAN> + +A file's author is currently apparently set from the UNAME of the writing +job. (I surmise, I haven't looked at the code yet.) Perhaps the XUNAME +should be used instead? + +Date: Mon, 8 Apr 85 10:00:36 EST +From: George J. Carrette +Subject: blast from the past +To: ALAN@MIT-MC +cc: BUG-ITS@MIT-MC, FILE-R@MIT-MC +In-reply-to: Msg of Mon 8 Apr 85 00:12:06 EST from Alan Bawden +Message-ID: <[MIT-MC].446519.850408100037.GJC> + +Speaking of historically interesting files I propose that certain +MC/AI/ML backup tapes that would otherwise be discarded be put into +the MIT archives and/or the CCC facility. Example: CCC has an Imlac, +and I was showing Gill the :IMLOAD program and the IMLAC directory, +but of course the IMLAC directory was reaped long ago. But since CCC +has an old IBM 7 track drive they could actually make good use of the +tapes with the IMLAC stuff. Personally I'm interested in seeing old +snapshots of conniver, planner, rabbit, etc, all of which are on +backup tape. + +Date: Mon, 8 Apr 85 00:12:06 EST +From: Alan Bawden +Subject: blast from the past +To: GJC@MIT-MC +cc: BUG-ITS@MIT-MC +In-reply-to: Msg of Sun 7 Apr 85 17:08:18 EST from George J. Carrette +Message-ID: <[MIT-MC].446193.850408001206.ALAN> + + Date: Sun, 7 Apr 85 17:08:18 EST + From: George J. Carrette + the end of the contents of l;bibop (memo) seems to have extra blocks in + it from the mail status file. + +... from a mail status file from around 1974! I rescued this file +from ML's filesystem last year. It was damaged on ML years ago. + +Its actually interesting to see what mail status files looked like ten +years ago. + +Date: Sun, 7 Apr 85 17:08:18 EST +From: George J. Carrette +To: BUG-ITS@MIT-MC +Message-ID: <[MIT-MC].445871.850407170822.GJC> + +the end of the contents of l;bibop (memo) +seems to have extra blocks in it from the mail +status file. + +Date: Thu, 4 Apr 85 23:01:54 EST +From: "Christopher C. Stacy" +To: BUG-ITS@MIT-MC + +I replied to LIN. + +Date: Thu, 4 Apr 85 22:37:24 EST +From: Herb Lin +To: BUG-ITS@MIT-MC + +actually, i'm looking for a wizard. how do you change the +password on ITS for your own account? + +tnx. + +Date: 31 March 1985 17:30-EST +From: Glenn S. Burke +To: bede @ MIT-XX +cc: BUG-ITS @ MIT-MC + +rolm 4602 calling mc doesn't answer. + +Received: from 40700024534 by MIT-MC via Chaosnet; 16 MAR 85 18:10:30 EST +Received: from SCRC-EUPHRATES by SCRC-VALLECITO via CHAOS with CHAOS-MAIL id 2994; Sat 16-Mar-85 15:24:53-EST +Date: Sat, 16 Mar 85 15:25 EST +From: David A. Moon +Subject: Tapes for Swedes +To: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +cc: bug-its@MIT-MC.ARPA +Message-ID: <850316152523.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + +[Replying to a message that JTW forwarded to me] + + Date: 11 Mar 85 02:13 +0100 + From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA + + We can probably get access to a 7-track tape drive to read your tapes + on, but we need some information about the format, like a backup program + that we can read on a TOPS-10 or TOPS-20 machine. Even a listing would be + helpful. + + Also, we would like to know what kind of tape drive and controller + you are using, and if you use standard DEC core-dump format. + +If you can read 7-track tapes in DEC core-dump format, we can send you +ITS dump tapes of all the relevant files, including the Midas assembler +and binaries of Midas that will run on Tops-10. (I guess the right +thing would be to include Tops-20 binaries of Midas as well). It will +probably be six or seven reels of tape. The format is as simple as +could be, I expect we can send you a 1/2 page writeup describing it +along with the tapes. Or I can send you a one-sentence writeup right +now: The files are delimited by tape file-marks; each file starts with a +header, which starts with an "aobjn pointer", and contains its name in +sixbit and some other stuff; the rest of the file is just the file, as +36-bit words; at the front of the tape is another header, also starting +with an "aobjn pointer", giving the tape name and some other stuff. + +Received: from SCRC-STONY-BROOK by MIT-MC via Chaosnet; 14 MAR 85 23:44:46 EST +Received: from SCRC-EUPHRATES by SCRC-STONY-BROOK via CHAOS with CHAOS-MAIL id 197577; Thu 14-Mar-85 19:55:26-EST +Date: Thu, 14 Mar 85 19:56 EST +From: David A. Moon +Subject: ITS +To: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +cc: BUG-ITS@MIT-MC.ARPA +In-Reply-To: <91827@QZCOM> +Message-ID: <850314195652.4.MOON@EUPHRATES.SCRC.Symbolics.COM> + + From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA + + Does anyone over there have an ITS tape? + +It's been three weeks since you sent your message (I'm behind on my mail). +Was it ever clarified what type of tape drive you have and what formats +of tape you can read? It's possible that we may have to write a 9-track +Tops-10/Tops-20 Interchange format tape for you, which would be possible +for us to do but would take a fair amount of work. With the recent episode +of vandalism and destruction, there is only one running ITS machine in the +world and it has a 7-track tape drive. + +Last year for archival purposes I dumped all the ITS and utility program +sources on two reels of 9-track, 3200-bpi tape in a format that you +definitely don't have a program to read. Two copies of those tapes +exist in separate locations. It is not inconceivable that I could make +another copy. That might be useful, since the separate locations are +only three miles apart and hence could both be destroyed simultaneously. + + ... In the meantime we have gotten another + machine, a KI10, which has been up and running several months. + It runs a slightly modified TOPS-10 V7.02 (which isn't supposed + to run on KI at all), and we have managed to simulate some + KL instructions, for example ADJSP. We are planning hardware + modifications so we can do ADJBP too. But TOPS-10 is not very + exciting, so we have been thinking about getting up TENEX, or + even TOPS-20. Do you know any place we can get a KI10 TENEX monitor? + +I think it would be considerably less work to get ITS running on a KI10 +than to get it running on a KS10. The biggest difference between the +stock KI10 and the ITS-modified KA10 is that the KI10 paging is less +flexible (no split page tables between the upper and lower half of +user address space); but a small amount of software simulation could +handle that; certainly it wouldn't be as bad as what it takes to get +Tenex to run on the KI10. Or you could fix the hardware, which evidently +you have the capability to do. + +Want to have a race? It wouldn't really be very fair, since there are +only a couple of very part-time people working on the KS10 here. + + Does BBN still run TENEX? Any pointers would be appreciated. + +A perhaps little-known fact is that Symbolics still runs TENEX, on +a Foonly F-2. I've been campaigning to get that machine thrown off the +roof for quite a while now, but unfortunately there are still people +using it. + +Date: 7 March 1985 20:09-EST +From: Ken Harrenstien +Subject: Novelty +To: ALAN @ MIT-MC +cc: BUG-ITS @ MIT-MC + + Date: 24 January 1985 20:56-EST + From: Alan Bawden + + Just a event to ponder. The other day I supduped from MC back to MC + (presumably using Chaosnet, I didn't think to check), and I was greeted + with the following: + + S.1487. PWORD.2630. + TTY 52 + 12. Lusers, Fair Share = 6% + + MC IT* + + Note that five characters ("MC IT") have been displaced. Conceivably the + fact that the machine was so heavily loaded, and that the user and server + were both on the same machine, could have allowed some timing screw that + almost never happens normally. + +This is not new. The phenomenon has existed for several years and was +first noticed on the AI KA-10 when telnet connections would sometimes produce +scrambled initial prompts. I don't think anyone has made a serious effort +to identify the bug. It could be in either the telnet server or in the +ITS STY code. This would be a good case for any mystery lovers to investigate. + +Date: 7 March 1985 16:45-EST +From: Christopher C. Stacy +Subject: timestamps +To: BUG-MAIL @ MIT-MC +cc: BUG-ITS @ MIT-MC, KLH @ SRI-NIC + +I frobbed the Received: lines some more so that they look like the +usual RFC822 ones; this is for both the SMTP and CHAOS servers. + +They look these: + Received: from USC-ECLB.ARPA by MIT-MC.ARPA; 7 MAR 85 16:41:19 EST + Received: from MIT-EECS by MIT-MC via Chaosnet; 7 MAR 85 16:41:02 EST + +They use new routines in various packages: + The DATIME library now has a routine called TIMRFC. + The OUT package now supports the new directive TIM(F4). + +Chris + +Date: 7 March 1985 16:26-EST +From: Alan Bawden +Subject: MC hardware status +To: BUG-ITS @ MIT-MC + +The most recent parity errors have occured in MH10-D. Also the microcode +hangs about once a week it seems. + +Date: 6 March 1985 19:58-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +(MC is getting the parity errors, not me...) + +Date: 6 March 1985 19:57-EST +From: Christopher C. Stacy +To: BUG-ITS @ MIT-MC + +We are getting a lot of parity errors lately, although I haven't +looked to see where they are coming from. + +Received: from MIT-HTVAX.ARPA by MIT-MC.ARPA; WED 6 MAR 1985 1404 EST +Received: by MIT-HTVAX.ARPA (4.12/4.7) + id AA26507; Wed, 6 Mar 85 13:59:31 est +Message-Id: <8503061859.AA26507@MIT-HTVAX.ARPA> +To: BUG-ITS@mit-mc.ARPA +Subject: Received: lines +Date: 06 Mar 85 13:59:26 EST (Wed) +From: Martin David Connor + + +Thanks to whoever put in received lines. They are very helpful in +tracing the path of a message. + +Could they be altered slightly to conform to the RFC822 spec for such +fields? It would be much easier to read if it were consistent with +the rest of the Received lines a message might contain. + +Here is an excerpt from the RFC which specifies the order of the fields: + + received = "Received" ":" ; one per relay + ["from" domain] ; sending host + ["by" domain] ; receiving host + ["via" atom] ; physical path + *("with" atom) ; link/mail protocol + ["id" msg-id] ; receiver msg id + ["for" addr-spec] ; initial form + ";" date-time ; time received + + + +Date: 2 March 1985 09:06-EST +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +just got a looong hang, followed by host not responding/host reset the connection (I'm on via mit-tac) after which I was able to reconnect and reattach. net lossage? + +Date: 28 February 1985 03:05-EST +From: Christopher C. Stacy +Subject: PDSET +To: BUG-ITS @ MIT-MC +cc: GUMBY @ MIT-MC + +I rewrote PDSET from scratch, and made some improvements to +the DWIM in the DATIME library. The new PDSET has not yet +been tested entirely, and is not installed. Also, I didn't +hack it up for the KS10 yet either. Will do some evening... + +Date: 21 February 1985 03:43-EST +From: Christopher C. Stacy +Subject: un-named hosts +To: BUG-TCP @ MIT-MC, BUG-MAIL @ MIT-MC, BUG-REPLY @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 20 Feb 1985 23:24-EST from Christopher C. Stacy + + Date: 20 February 1985 23:24-EST + From: Christopher C. Stacy + To: BUG-MAIL + + Someone at SCRC just tried to send me a message from a host not + in our tables; he was refused by our server. I bet that the server + died trying to look it up. I'll make it say CHAOS|nnnn or something. + + +OK, I fixed this so that the Chaosnet SEND server will claim the +message came from a host named like "24516/CHAOS". + +It occurred to me that it would be nice to be able to REPLY to these +guys too, so I went and hacked up the NETWRK library to accept various +numerical host names. (There was some code in NETWRK to parse some of +these, but it was pretty broken and looked like it could never have worked.) + +Then I hacked up SENDER a little, mostly to know about the following +poorly documented return convention of NETWRK"HSTLOOK: even if A gets +a host address, B may contain zero rather than a database pointer. + +I also reassembled TELNET with the new NETWRK. With the right +switches set, programs will now parse all these equivalent forms: + + MIT-AI ; symbolic + 10.2.0.6 ; Internet address + 2/6 ; Host 2 on IMP 6. + 3130/CHAOS ; (Other nets work too: 400006/ARPA is MIT-AI, + 77/SATNET is GOONHILLY-ECHO) + + +If anything mysterious starts happenning with programs as they are +re-assembled with the new NETWRK, let me know. + +Chris + +Date: Thu 21 Feb 85 00:40:56-EST +From: John Wroclawski +Subject: Re: ITS +To: CENT@MIT-MC, Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +cc: BUG-ITS@MIT-MC +In-Reply-To: Message from "Pandora B. Berman " of Wed 20 Feb 85 23:25:36-EST + + From: Pandora B. Berman + Subject: ITS + + From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA + To: BUG-ITS@MIT-MC.ARPA + Subject: ITS + + .... + + + it's been a long time since we said anything; sorry (at least we could + have said it would take a long while or something). a chief problem + that i have heard some of the hackers here mention about running ITS + on your system is that the hardware list you sent does not include a + paging box (i'm not sure what number that would be -- perhaps DM10 -- + someone will jump on me if i'm wrong). + +Um, actually it's not a DEC frob at all, so it hasn't got a number. The +ones which were used at MIT were built either by us or Systems Concepts, +I believe. ITS paging is somewhat different than TOPS-10, both of which +are completely different than TENEX/TOPS-20. + +On the other hand, it might be possible to pound on your KI10 enough +to get it to do ITS paging using the KI's paging hardware. The page +tables are of different format, the pages are larger, and of course +page faults are reported to the OS differently. + + + also the ITS sources are not + neatly available already on a single tape; someone would have to go + through things and figure out what to send you, and we have all been + sort of busy (we work full time on other things, or are students, + etc.) + +Hmmm, if they have a TOPS-10 running, they at least have something to +run MIDAS on. It's a start. Maybe when the KS is done things will be in +one place... + + i think BBN flushed their last tenex last spring; not sure who + you could ask there for further details. + +They did. There are still a few of them running around the Arpanet +though. If you can get the right paging hardware to run TENEX you +actually have a pretty good chance of getting TOPS-20 up, if you can +find a set of version 3 or 4 sources. You would either have to change +a lot of code or change the way traps and such work on the KI though. +For TENEX, I'd start by trying to get the latest sources from BBN, +presumably they still have them around. +------- + +Date: 20 February 1985 23:19-EST +From: Pandora B. Berman +Subject: ITS +To: Bjorn_Danielsson_QZ%QZCOM.MAILNET @ MIT-MULTICS +cc: BUG-ITS @ MIT-MC + + Date: 20 Feb 85 19:42 +0100 + From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA + To: BUG-ITS@MIT-MC.ARPA + Subject: ITS + Does anyone over there have an ITS tape? We (of the computer club + STACKEN) would very much like to take a look at it and see if we can + run it on our KA10. Any kind of tape will do, we think we can manage to + decode it. And we promise not to bother you with questions later. We + are even prepared to promise Ronald Reagan that we won't give it to the + Russians :-) We have finally found a room to put the machine in, and it + will be installed very soon. In the meantime we have gotten another + machine, a KI10, which has been up and running several months. It runs + a slightly modified TOPS-10 V7.02 (which isn't supposed to run on KI at + all), and we have managed to simulate some KL instructions, for example + ADJSP. We are planning hardware modifications so we can do ADJBP too. + But TOPS-10 is not very exciting, so we have been thinking about + getting up TENEX, or even TOPS-20. Do you know any place we can get a + KI10 TENEX monitor? Does BBN still run TENEX? Any pointers would be + appreciated. + +it's been a long time since we said anything; sorry (at least we could have +said it would take a long while or something). a chief problem that i have +heard some of the hackers here mention about running ITS on your system is +that the hardware list you sent does not include a paging box (i'm not sure +what number that would be -- perhaps DM10 -- someone will jump on me if i'm +wrong). also the ITS sources are not neatly available already on a single +tape; someone would have to go through things and figure out what to send +you, and we have all been sort of busy (we work full time on other things, +or are students, etc.) i think BBN flushed their last tenex last spring; +not sure who you could ask there for further details. + +maybe some piece of your KI could be used as an ITS paging box? i don't +know (i'm not a hacker, alas, so i can't do more than speculate). + +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2655243468721180@MIT-MULTICS.ARPA>; 20 Feb 1985 18:37:48 est +Date: 20 Feb 85 19:42 +0100 +From: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-to: Bjorn_Danielsson_QZ%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: BUG-ITS@MIT-MC.ARPA +Subject: ITS +Message-ID: <91827@QZCOM> + +Does anyone over there have an ITS tape? +We (of the computer club STACKEN) would very much like to take +a look at it and see if we can run it on our KA10. Any kind of +tape will do, we think we can manage to decode it. And we promise +not to bother you with questions later. We are even prepared to +promise Ronald Reagan that we won't give it to the Russians :-) +We have finally found a room to put the machine in, and it will be +installed very soon. In the meantime we have gotten another +machine, a KI10, which has been up and running several months. +It runs a slightly modified TOPS-10 V7.02 (which isn't supposed +to run on KI at all), and we have managed to simulate some +KL instructions, for example ADJSP. We are planning hardware +modifications so we can do ADJBP too. But TOPS-10 is not very +exciting, so we have been thinking about getting up TENEX, or +even TOPS-20. Do you know any place we can get a KI10 TENEX monitor? +Does BBN still run TENEX? Any pointers would be appreciated. + + Happy hacking, + + Bjorn Danielsson + Datorforeningen STACKEN + c/o NADA + Royal Institute of Technology + S-100 44 Stockholm + SWEDEN + + + + +Date: 13 February 1985 17:56-EST +From: Glenn S. Braindeath +Subject: "IBO" +To: BUG-ITS @ MIT-MC + +I just got an IBO message... +I seem to remember that this ain't supposed to happen. +A minute later everything worked fine. (i'mon 1200 baud dialup) + +Date: 12 February 1985 18:17-EST +From: David A. Moon +Subject: NTSDDT +To: CSTACY @ MIT-MC +cc: BUG-ITS @ MIT-MC, TY @ MIT-MC, JNC @ MIT-XX + + Date: 12 February 1985 17:42-EST + From: Christopher C. Stacy + Subject: NTSDDT + To: JNC @ MIT-XX + cc: BUG-ITS @ MIT-MC, TY @ MIT-MC + In-reply-to: Msg of Tue 12 Feb 85 17:40:25-EST from J. Noel Chiappa + + Date: Tue 12 Feb 85 17:40:25-EST + From: J. Noel Chiappa + To: CSTACY at MIT-MC.ARPA + cc: BUG-ITS at MIT-MC.ARPA, TY at MIT-MC.ARPA, JNC at MIT-XX.ARPA + Re: NTSDDT + + Date: 12 February 1985 17:32-EST + From: Christopher C. Stacy + + Date: Tue 12 Feb 85 17:29:53-EST + From: J. Noel Chiappa + + I was speaking about making the system tattle on changes to + .KLFE., or did you hack KLFEDR too? + + OOoh. I believe when you write a file on the front-end file system it + changes pointers which live in files in the ITS directory. + + Nope. There is no entry for NTSDDT CMD in .KLFE.; but running + KLFEDR reveals that it is there. + + OOoh. I believe when you write a file on the front-end file system it + changes POINTERS WHICH LIVE IN FILES in the ITS directory. + + +It's more complicated than that. We don't use the RSX-11 file system, +we use the KLDCP file system which DEC later flushed.. Also the front-end +files aren't in any one place on the disk, but are scattered all +over. Some of them, especially the larger ones, reside in individual ITS +files, others are pieces portions of an ITS file. And if you move or delete +anything on the .KLFE. directory you screw it up since somewhere there is +a KLDCP directory containing absolute disk addresses. +You could make the .KLFE. dir be proetcedt and also make KLFEDR tattle itself +somehow. + +Date: Tue 12 Feb 85 17:55:29-EST +From: J. Noel Chiappa +Subject: Re: NTSDDT +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, TY@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Tue 12 Feb 85 17:42:00-EST + + I parsed that correctly the second time. Yes, there does seem +to be this file KLDCP (DIR) which macgically contains the actual blocks +of the RSX-11 directory. So you will get the miscreants name (if done +under ITS), but not which file he bashed. +------- + +Date: 12 February 1985 17:42-EST +From: Christopher C. Stacy +Subject: NTSDDT +To: JNC @ MIT-XX +cc: BUG-ITS @ MIT-MC, TY @ MIT-MC +In-reply-to: Msg of Tue 12 Feb 85 17:40:25-EST from J. Noel Chiappa + + Date: Tue 12 Feb 85 17:40:25-EST + From: J. Noel Chiappa + To: CSTACY at MIT-MC.ARPA + cc: BUG-ITS at MIT-MC.ARPA, TY at MIT-MC.ARPA, JNC at MIT-XX.ARPA + Re: NTSDDT + + Date: 12 February 1985 17:32-EST + From: Christopher C. Stacy + + Date: Tue 12 Feb 85 17:29:53-EST + From: J. Noel Chiappa + + I was speaking about making the system tattle on changes to + .KLFE., or did you hack KLFEDR too? + + OOoh. I believe when you write a file on the front-end file system it + changes pointers which live in files in the ITS directory. + + Nope. There is no entry for NTSDDT CMD in .KLFE.; but running + KLFEDR reveals that it is there. + +OOoh. I believe when you write a file on the front-end file system it +changes POINTERS WHICH LIVE IN FILES in the ITS directory. + + + +Date: Tue 12 Feb 85 17:40:25-EST +From: J. Noel Chiappa +Subject: Re: NTSDDT +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, TY@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Tue 12 Feb 85 17:32:00-EST + + Nope. There is no entry for NTSDDT CMD in .KLFE.; but running +KLFEDR reveals that it is there. +------- + +Date: 12 February 1985 17:32-EST +From: Christopher C. Stacy +Subject: NTSDDT +To: JNC @ MIT-XX +cc: BUG-ITS @ MIT-MC, TY @ MIT-MC +In-reply-to: Msg of Tue 12 Feb 85 17:29:53-EST from J. Noel Chiappa + + Date: Tue 12 Feb 85 17:29:53-EST + From: J. Noel Chiappa + + I was speaking about making the system tattle on changes to + .KLFE., or did you hack KLFEDR too? + +OOoh. I believe when you write a file on the front-end file system it +changes pointers which live in files in the ITS directory. + +Date: Tue 12 Feb 85 17:29:53-EST +From: J. Noel Chiappa +Subject: Re: NTSDDT +To: CSTACY@MIT-MC.ARPA +cc: BUG-ITS@MIT-MC.ARPA, TY@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Tue 12 Feb 85 17:12:00-EST + + I was speaking about making the system tattle on changes to +.KLFE., or did you hack KLFEDR too? +------- + +Date: 12 February 1985 17:12-EST +From: Christopher C. Stacy +Subject: NTSDDT +To: JNC @ MIT-XX +cc: BUG-ITS @ MIT-MC, TY @ MIT-MC +In-reply-to: Msg of Tue 12 Feb 85 12:29:46-EST from J. Noel Chiappa + +Huh? I put the file back into the front-end file system, +and it has been working for a couple of days. + +Date: Tue 12 Feb 85 12:29:46-EST +From: J. Noel Chiappa +Subject: Re: NTSDDT +To: CSTACY@MIT-MC.ARPA, BUG-ITS@MIT-MC.ARPA +cc: TY@MIT-MC.ARPA, JNC@MIT-XX.ARPA +In-Reply-To: Message from "Christopher C. Stacy " of Fri 8 Feb 85 13:17:00-EST + + It's not clear if this will do the right thing, since presumably +the file was also deleted from the RSX-11 directory, which would have used +KLFEDR or whatever the fuck that program is called. In fact, you could +delete it with KLFEDR and not touch the directory entry in .KLFE. I guess. +------- + +Date: 8 February 1985 23:04-EST +From: David E. Hirsch +To: BUG-ITS @ MIT-MC + +this is NOT hirsh. I just ROLM'ed to MC and whoops, here I am all logged in and everything. Oh well. I'm on T30. + +Date: 8 February 1985 13:17-EST +From: Christopher C. Stacy +Subject: NTSDDT +To: BUG-ITS @ MIT-MC +cc: TY @ MIT-MC + +The front end file NTSDDT seems to have been deleted over the weekend. +I re-created it; you can boot the system normally now. +I also made the front-end file directory be tattled on by the system job. + +Date: 29 January 1985 18:00-EST +From: Christopher C. Stacy +Subject: MINITS HUBs making noise +To: BUG-MINITS @ MIT-MC +cc: BUG-ITS @ MIT-MC + +NE438B, NE438C, and NE437A have terminal lines running open +or something. They keep generating a lot of noise, some of +which is control-Zs, so they are connecting to MC and typing +the noise at us. This eats up network resources and prevents +some people from logging in,etc. I heard that the power company +is being flaking today, which may have something to do with it. + +Date: 28 January 1985 15:20-EST +From: Christopher C. Stacy +To: DEVON @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 27 Jan 1985 02:09-EST from Devon S. McCullough + +You are probably getting memory parity errors. + +Date: 27 January 1985 02:09-EST +From: Devon S. McCullough +To: BUG-ITS @ MIT-MC + +Two or three times in the last day or so I've gotten + +top level interrupt, tree detached + +This usually happens when I have been typing ^Z's and ^G's because +the system is not responding. Now I have a dead detached tree. +I can usually type ^_'s to prove that the system itself is alive +even though nothing is responding. + +Date: 26 January 1985 03:47-EST +From: Christopher C. Stacy +Subject: not knowing the time +To: BUG-FTP @ MIT-MC +cc: ALAN @ MIT-MC, BUG-ITS @ MIT-MC + +OK, FTP servers now die cleanly if they don't know the time. + +Date: 25 January 1985 23:10-EST +From: Alan Bawden +Subject: no arpa? +To: GSB @ MIT-MC +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of 25 Jan 1985 21:00-EST from Christopher C. Stacy + + Date: 25 January 1985 21:00-EST + From: Christopher C. Stacy + Date: Fri 25 Jan 85 12:08:58-EST + From: Glenn S. Burke + is mc's arpa connection busted? can't reach it from rutgers + or xx via internet. + It does for me at the moment. + +I guess you can tell from this that Chris reads his mail in reverse! + +Date: 25 January 1985 21:00-EST +From: Christopher C. Stacy +Subject: no arpa? +To: GSB @ MIT-XX +cc: BUG-ITS @ MIT-MC +In-reply-to: Msg of Fri 25 Jan 85 12:08:58-EST from Glenn S. Burke + + Date: Fri 25 Jan 85 12:08:58-EST + From: Glenn S. Burke + To: bug-its at MIT-MC.ARPA + Re: no arpa? + + is mc's arpa connection busted? can't reach it from rutgers + or xx via internet. + +It does for me at the moment. + +Date: Fri 25 Jan 85 12:08:58-EST +From: Glenn S. Burke +Subject: no arpa? +To: bug-its@MIT-MC.ARPA + +is mc's arpa connection busted? can't reach it from rutgers or xx via internet. +------- + +Date: 25 January 1985 13:06-EST +From: Alan Bawden +To: BUG-FTP @ MIT-MC +cc: KMP @ MIT-MC, BUG-ITS @ MIT-MC +In-reply-to: Msg of 25 Jan 1985 10:15-EST from Kent M Pitman + + Date: 25 January 1985 10:15-EST + From: Kent M Pitman + System went down at 6:25am this morning. Whoever brought it back up + forgot to set the time so mostly no one could log in. + +And MC hasn't been talking TCP since then, because the tables were clogged +with a zillion dead FTP servers because of the silly .VALUE-when-ITS- +doesn't-know-the-time screw I reported a couple weeks ago. + +Date: 25 January 1985 10:15-EST +From: Kent M Pitman +To: BUG-ITS @ MIT-MC + +System went down at 6:25am this morning. Whoever brought it back up forgot +to set the time so mostly no one could log in. + +Date: 24 January 1985 20:56-EST +From: Alan Bawden +Subject: Novelty +To: BUG-ITS @ MIT-MC + +Just a event to ponder. The other day I supduped from MC back to MC +(presumably using Chaosnet, I didn't think to check), and I was greeted +with the following: + + S.1487. PWORD.2630. + TTY 52 + 12. Lusers, Fair Share = 6% + + MC IT* + +Note that five characters ("MC IT") have been displaced. Conceivably the +fact that the machine was so heavily loaded, and that the user and server +were both on the same machine, could have allowed some timing screw that +almost never happens normally. + diff --git a/sysdoc/its.recent b/sysdoc/its.recent new file mode 100644 index 0000000..6008601 --- /dev/null +++ b/sysdoc/its.recent @@ -0,0 +1,1689 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 19 Apr 90 22:37:18 EDT +Received: from BU.EDU by mintaka.lcs.mit.edu id aa23808; 19 Apr 90 22:32 EDT +Received: from BU-IT.BU.EDU by BU.EDU (1.97) Thu, 19 Apr 90 22:31:46 EDT +Received: by bu-it.bu.edu (12/20/89); Thu, 19 Apr 90 22:31:38 EDT +Date: Thu, 19 Apr 90 22:31:38 EDT +From: Phil Budne +Message-Id: <9004200231.AA04513@bu-it.bu.edu> +To: DIGEX%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu, + DOOMSDAY%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu +Subject: Re: the future of ITS +Cc: INFO-ITS%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu, + KS-OWNERS%AI.AI.MIT.EDU@Mintaka.lcs.mit.edu + +I started on a '10 simulator, but never wrote the 36 bit math needed. +If you figure a 10 times performance hit a DS3100 or a SPARC might +yield performance at the KA/KS level. + + + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 19 Apr 90 16:46:56 EDT +Received: from life.ai.mit.edu by mintaka.lcs.mit.edu id aa09992; + 19 Apr 90 16:45 EDT +Received: from zurich.ai.mit.edu (CHAMARTIN.AI.MIT.EDU) by life.ai.mit.edu (4.1/AI-4.10) id AA15299; Thu, 19 Apr 90 16:45:32 EDT +Received: from localhost by zurich.ai.mit.edu; Thu, 19 Apr 90 16:43:55 edt +Date: Thu, 19 Apr 90 16:43:55 edt +From: "Guillermo J. Rozas" +Message-Id: <9004192043.AA15383@zurich.ai.mit.edu> +To: DIGEX%AI.AI.MIT.EDU@mintaka.lcs.mit.edu +Cc: DOOMSDAY%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + KS-OWNERS%AI.AI.MIT.EDU@mintaka.lcs.mit.edu, + info-its%ai.ai.mit.edu@mintaka.lcs.mit.edu +In-Reply-To: Doug Humphrey's message of Thu, 19 Apr 90 16:28:03 EDT <723026.900419.DIGEX@AI.AI.MIT.EDU> +Subject: the future of ITS +Reply-To: jinx@zurich.ai.mit.edu + +I think that the idea of a PDP-10 simulator running on a fast Unix box +is pretty funny, but would be a very cool hack. Writing such a +simulator (except IO instructions) is straight-forward, but changing +ITS to do virtual IO would probably be far more painful. It may also +require a fair amount of hacking from a very small group of people +(Alan, Moon,...), and that may not be reasonable. + + + + +Date: Thu, 19 Apr 90 16:28:03 EDT +From: Doug Humphrey +Subject: the future of ITS +To: DOOMSDAY%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +cc: INFO-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU, KS-OWNERS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Message-ID: <723026.900419.DIGEX@AI.AI.MIT.EDU> + + +I would be interested in getting a discussion going on the future of +ITS. This would be open to any kind of strange ideas, from running +it on existing KS-10 hardware (at MIT or not) to building a PDP-10 +software simulator that can run on existing and/or future cpus, like +MIPS chips, etc. In short, before these machines go away, and all of +the ITS knowledgable people too far away, lets talk about this stuff. + +Another point is that INFO-ITS and KS-OWNERS lists should continue to +live after the ITS systems go into hibernation so that advances in the +ITS state-of-the-art can be announced and discussed. + +Comments, etc? + +Doug Humphrey +digex@mit-ai +digex@tumtum.cs.umd.edu + +Date: Sat, 14 Apr 90 02:40:47 EDT +From: Alan Bawden +Subject: A sad day +To: INFO-ITS%AI.AI.MIT.EDU@MINTAKA.LCS.MIT.EDU +Reply-to: Alan@Reagan.AI.MIT.EDU +Message-ID: <721426.900414.ALAN@AI.AI.MIT.EDU> + +I'm sorry to announce that we're going to shut down the ITS machines at +MIT. As we plan for the final shutdown, the file AI:SYS;GOOD BYE will be +constantly updated to contain the current plans. What follows is the +current contents of that file, and it pretty much explain the situation: + +------- + +Well, the time has finally arrived to shut down the ITS machines for the +last time. The hardware is getting old, and the amount of maintenance +required to keep things running is getting out of hand. We've been losing +ground at an accelerating rate for the last year. + +The current plan is to turn AI and MC off for good sometime around the end +of May. We plan to take a snapshot of AI and MC's filesystem sometime +before the final shutdown and to keep this snapshot available on some other +file server for a couple of months. People who have a large number of +files to evacuate, but who lack efficient network access to AI and MC, are +encouraged to simply wait until after this snapshot becomes available. + +AI's second RP06 (SECOND:) will be fixed soon to make it easier for people +to evacuate themselves. + +Files on ITS backup tapes will be unavailable until someone writes the +program to read them. Before the shutdown, modest file retrieval requests +(mail to FILE-R@AI) will be considered. Extensive or complicated retrieval +requests will have to wait until after the dust settles after the shutdown. +Our judgment on these matters will be final. Sorry. + +All mailing lists will have to be moved elsewhere. If you maintain a +mailing list on AI or MC, you can save us some trouble by moving your +mailing list yourself as soon as possible. We'll try and do something +responsible about those important lists that don't have obvious owners, but +don't count on us to save your mailing list for you -- we might decide to +just let it perish. + +Please try not to pester us about the personal inconvenience this causes +you. We don't have any suggestions about where you should read your mail +now, where you can keep your files, or where you can move your mailing +list, and we wish we knew of another PDP-10 that you could use. (If you +-must- pester someone, send mail to DOOMSDAY@AI.) We do appreciate your +loyalty to ITS during its lifetime at MIT. Stop by sometime and we can +talk about the good old days when dinosaurs ruled the machine room. + +As we continue to plan for doomsday, this file will be updated with the +latest news. + + - Alan + +------- + + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 16:08:30 EST +Received: from Gateway.Think.COM by mintaka.lcs.mit.edu id aa15010; + 15 Dec 89 16:02 EST +Received: from Fafnir.Think.COM by Think.COM; Fri, 15 Dec 89 16:03:23 -0500 +Return-Path: +Received: from verdi.think.com by fafnir.think.com; Fri, 15 Dec 89 15:58:28 EST +Received: from ungar.think.com by verdi.think.com; Fri, 15 Dec 89 15:56:16 EST +From: Guy Steele +Received: by ungar.think.com; Fri, 15 Dec 89 15:56:15 EST +Date: Fri, 15 Dec 89 15:56:15 EST +Message-Id: <8912152056.AA29450@ungar.think.com> +To: Ed@alderaan.scrc.symbolics.com +Cc: gumby@gang-of-four.stanford.edu, info-its@ai.ai.mit.edu, + unix-haters@ai.ai.mit.edu, gls@think.com +In-Reply-To: Ed Schwalenberg's message of Fri, 15 Dec 89 14:56 EST <19891215195628.4.ED@PEREGRINE.SCRC.Symbolics.COM> +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? + + Date: Fri, 15 Dec 89 14:56 EST + From: Ed Schwalenberg + + Date: Thu, 14 Dec 89 19:57:05 -0800 + From: David Vinayak Wallace + + Those who never used TS BEAR may not recognise the message above, but + those who do may be amused by how the cookie bear got permuted by the + time the unix weenies heard about it. Then again, note his last + question... + + >From: kim@watsup.waterloo.edu (T. Kim Nguyen) + Subject: "cookie" + Date: 11 Dec 89 09:13:31 GMT + + While the machine was being dismantled, someone took a look inside and + found this circuit board hooked into the machine. Guess what was + asking for cookies, and had not been found, even after people searched + high and low through the software for the cookie monster... + + I heard this story when I entered MIT in September 1974. The version I + heard allegedly took place at Dartmouth, and the cookie monster wouldn't + go away even after the OS was changed; it took a TTY33 repairperson to + discover the hardware hack in the system console. + + I wrote a cookie program for the PDP-8 at MIT's Weather Radar group when + I worked there in the summer of 1975, based on the story I had heard. + I wasn't aware of TS BEAR until much later, although I don't know when + it was written or what inspiration its author (who I think was GLS) had. + +I wrote TS BEAR after hearing an oral description of a similar +hack on (as I recall) Multics. Richard Feynman was perhaps its +most famous victim (it was I who sicced it on him--blush). + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 15:51:16 EST +Received: from [128.81.41.109] by mintaka.lcs.mit.edu id aa14529; + 15 Dec 89 15:44 EST +Received: from PEREGRINE.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 358313; 15 Dec 89 14:59:03 EST +Date: Fri, 15 Dec 89 14:56 EST +From: Ed Schwalenberg +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? +To: David Vinayak Wallace , + info-its@ai.ai.mit.edu +cc: unix-haters@ai.ai.mit.edu, gls@think.com +In-Reply-To: <8912150357.AA06208@Gang-of-Four.Stanford.EDU> +Message-ID: <19891215195628.4.ED@PEREGRINE.SCRC.Symbolics.COM> + + Date: Thu, 14 Dec 89 19:57:05 -0800 + From: David Vinayak Wallace + + Those who never used TS BEAR may not recognise the message above, but + those who do may be amused by how the cookie bear got permuted by the + time the unix weenies heard about it. Then again, note his last + question... + + >From: kim@watsup.waterloo.edu (T. Kim Nguyen) + Subject: "cookie" + Date: 11 Dec 89 09:13:31 GMT + + While the machine was being dismantled, someone took a look inside and + found this circuit board hooked into the machine. Guess what was + asking for cookies, and had not been found, even after people searched + high and low through the software for the cookie monster... + +I heard this story when I entered MIT in September 1974. The version I +heard allegedly took place at Dartmouth, and the cookie monster wouldn't +go away even after the OS was changed; it took a TTY33 repairperson to +discover the hardware hack in the system console. + +I wrote a cookie program for the PDP-8 at MIT's Weather Radar group when +I worked there in the summer of 1975, based on the story I had heard. +I wasn't aware of TS BEAR until much later, although I don't know when +it was written or what inspiration its author (who I think was GLS) had. + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 15 Dec 89 12:51:50 EST +Received: from orville.nas.nasa.gov by mintaka.lcs.mit.edu id aa09814; + 15 Dec 89 12:45 EST +Received: Fri, 15 Dec 89 09:35:06 PST by orville.nas.nasa.gov (5.59/1.2) +Date: Fri, 15 Dec 89 09:35:06 PST +From: John Lekashman +Message-Id: <8912151735.AA21356@orville.nas.nasa.gov> +To: gumby@gang-of-four.stanford.edu, info-its@AI.ai.mit.edu +Subject: Re: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? +Cc: unix-haters@AI.ai.mit.edu + +The answer is yes. +Either it really happened, or all of Seymour Papert's students +are on drugs is true. (oooooeeeee-eeeee). At least back in +the 70s. + john + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU; 14 Dec 89 23:01:56 EST +Received: from Gang-of-Four.Stanford.EDU by mintaka.lcs.mit.edu id aa22227; + 14 Dec 89 22:57 EST +Received: by Gang-of-Four.Stanford.EDU (5.61/inc-1.0) + id AA06208; Thu, 14 Dec 89 19:57:05 -0800 +Date: Thu, 14 Dec 89 19:57:05 -0800 +From: David Vinayak Wallace +Message-Id: <8912150357.AA06208@Gang-of-Four.Stanford.EDU> +To: info-its@ai.ai.mit.edu +Cc: unix-haters@ai.ai.mit.edu +Subject: TTY MESSAGE FROM A UNIX WEENIE: LOSSAGE? + +Those who never used TS BEAR may not recognise the message above, but +those who do may be amused by how the cookie bear got permuted by the +time the unix weenies heard about it. Then again, note his last +question... + +Makes one wonder what the loser who wrote the Canonical Losing Unix +Mailer thought he was writing. + +>From: kim@watsup.waterloo.edu (T. Kim Nguyen) +Newsgroups: alt.folklore.computers +Subject: "cookie" +Message-ID: +Date: 11 Dec 89 09:13:31 GMT + +OK, here's another one I heard about. This one (I was told) happened +at MIT, back in the 70s (oooooeeeee-ooooo), on some big network type +machine. At the same time every day, a message would appear on +people's terminals, saying "Give me a cookie". And if they did +nothing, the machine would burp and kill their process or something. +Eventually someone, in response to that message, typed "cookie", and +the machine said "thanks" and continued working normally. For the +remainder of the machine's lifetime, people would type "cookie" at the +same time every day and take it for granted that they had to do this. + +While the machine was being dismantled, someone took a look inside and +found this circuit board hooked into the machine. Guess what was +asking for cookies, and had not been found, even after people searched +high and low through the software for the cookie monster... + +So -- did this really happen, or are all of Seymour Papert's students +on drugs? :-) + +-- +T. Kim Nguyen kim@watsup.waterloo.{edu|cdn} + kim@watsup.uwaterloo.ca + {uunet|utzoo|utai|decvax}watmath!watsup!kim +Systems Design Engineering -- University of Waterloo, Ontario, Canada + +Received: from lcs.mit.edu (CHAOS 15044) by AI.AI.MIT.EDU 10 Sep 89 18:45:52 EDT +Received: from arisia.Xerox.COM by mintaka.lcs.mit.edu id aa23016; + 10 Sep 89 18:37 EDT +Received: from roo.parc.Xerox.COM by arisia.Xerox.COM with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA19688; Sun, 10 Sep 89 15:33:12 -0700 +Received: from mr-bun.parc.Xerox.COM by roo.parc.xerox.com with SMTP + (5.61+/IDA-1.2.8/gandalf) id AA03302; Sun, 10 Sep 89 15:36:37 PDT +Date: Sun, 10 Sep 89 15:34 PDT +From: Alan Bawden +Subject: 25th Anniversary of 36 Bits +To: Info-ITS%AI.AI.MIT.EDU@MINTAKA.lcs.mit.edu +Supersedes: <19890910220047.1.ALAN@MR-BUN.parc.xerox.com> +Comments: There is too a host named MINTAKA.LCS.MIT.EDU. Try again, Unix braindeath. +Message-Id: <19890910223434.2.ALAN@MR-BUN.parc.xerox.com> + +Article 471 of comp.org.decus: +From: clive@pp.ACA.MCC.COM (Clive Dawson) +Newsgroups: comp.arch,comp.org.decus +Subject: 25th Anniversary of 36 Bits +Keywords: 36-bits DEC-10 DEC-20 DECUS +Date: 5 Sep 89 17:05:12 GMT +Organization: MCC, Austin, TX + +[The number of people who contributed to the recent discussion on +Digital's 36-bit architecture made it seem appropriate to post this +message here. My apologies for straying from the main subject +matter.] + +A special event will take place at the Fall DECUS Symposium in Anaheim, +California, November 6-10, 1989: The 25th Anniversary of 36-bit systems +will be celebrated. In 1964, Digital announced the PDP-6. Twenty-five +years later, the 36-bit architecture is still here serving a loyal +customer base. + +The celebration will take place on the evening of Monday, November 6, +1989. The usual DEC 10/20 Update Session will be held from 3-5 PM. +Last-minute announcements regarding Anniversary events will be made at +this session, as well as in the Monday edition of Update.Daily (the +Symposium newspaper). A meeting room in one of the Symposium hotels +(Hilton or Marriott) will be made available for the anniversary +events, which include: + + -- 36-Bit JEOPARDY! + In the tradition of the 36-bit Trivia Bowl held at the + 20th Anniversary celebration, experts on the history + and folklore of 36-bit systems will compete against + each other. Come and match wits with them! + + -- Memorabilia Exhibit and Swap + You are encouraged to bring old manuals, listings, + pieces of hardware (e.g. KA and/or KI consoles!), + posters, buttons, tapes, and any other items related + to 36-bit systems for exhibiting and/or swapping. + Table space will be made available. + + -- Anniversary Dinner + + Dinner plans are not yet firm. It will either be + catered by the hotel or we will adjourn to a nearby + restaurant. + + -- 36-Bit Magic & War Stories + Following dinner we will swap war stories and other + legends of 36-bit lore. One of the most popular + events of the 1984 celebration will be repeated: a + reading of several infamous SPR's (and their equally + infamous replies.) Come prepared to share share your + favorite stories. Prizes for the best will be + awarded. + +Note that these four events will NOT appear in the DECUS schedule +since they are not official DECUS functions (and therefore do not +require conference registration.) If you are planning to attend any +of the 25th Anniversary events, please notify me as soon as possible, +since we need to get a reasonable estimate on the number of people to +expect. (Dinner plans depend on this, so please try not to delay.) + + E-mail: Internet: Clive@MCC.COM + UUCP: ...!cs.utexas.edu!pp!clive + U.S. mail: MCC, 3500 West Balcones Center, Austin, TX 78759 + Phone: (512) 338-3430 + +This will also enable us to create a mailing list for any last minute +announcements regarding the events. If you would like table space for +exhibits, please mention this. Suggestions regarding dinner plans are +also welcome. It may be difficult to find a reasonable restaurant +nearby that could handle this. The 20th anniversary dinner was done +by the hotel at a cost of $36/person (what else?!). Is this a +reasonable fee? If not, let me know how much you would be willing to +pay. + +This message is being sent to the TOPS-20 mailing list and the +comp.arch and comp.org.decus news groups. Please redistribute as you +see fit and pass the word to other 36-bitters who may not otherwise +find out about this. + +See you in Anaheim! + +Clive Dawson + +Received: from ames.arc.nasa.gov (TCP 20031411003) by AI.AI.MIT.EDU 6 Oct 88 12:34:47 EDT +Received: Thu, 6 Oct 88 09:23:05 PDT by ames.arc.nasa.gov (5.59/1.2) +Date: Thu, 6 Oct 88 09:24:05 PST +From: geoff@Fernwood.MPK.CA.US (the tty of Geoff Goodfellow) +Subject: Re: License plate curiosity... +Message-Id: <8810060924.2.UUL1.3#948@Fernwood.MPK.CA.US> +To: Ed@ALDERAAN.SCRC.Symbolics.COM +Cc: tops-20@score.stanford.edu, info-its@ai.ai.mit.edu, hic@symbolics.com, + pgs@ai.ai.mit.edu, gls@think.com, vaf@score.stanford.edu +In-Reply-To: Your message of Wed 5 Oct 88 17:27:28-PDTFrom: Vince Fuller + +i still have California JFCL. +i believe JRST 4 belongs to Ken Olum (kdo@lucid.com). +g + + +Received: from Think.COM (TCP 1201000006) by AI.AI.MIT.EDU 6 Oct 88 12:05:10 EDT +Return-Path: +Received: from sauron.think.com by Think.COM; Thu, 6 Oct 88 11:16:46 EDT +Received: from OCCAM.THINK.COM by sauron.think.com; Thu, 6 Oct 88 12:00:28 EDT +Date: Thu, 6 Oct 88 12:01 EDT +From: Barry Margolin +Subject: License plate curiosity... +To: Ed Schwalenberg +Cc: Vince Fuller , tops-20@score.stanford.edu, + info-its@ai.ai.mit.edu, geoff@fernwood.mpk.ca.us, + hic@alderaan.scrc.symbolics.com, pgs@ai.ai.mit.edu, gls@Think.COM +In-Reply-To: <19881006144203.6.ED@BLACK-BIRD.SCRC.Symbolics.COM> +Message-Id: <19881006160115.7.BARMAR@OCCAM.THINK.COM> + +A couple of weeks ago I was walking through the Lotus parking lot by +Cambridge Gas & Electric and saw the license plate CAR-CDR. Anyone know +whose this is? + + barmar + +Received: from ALDERAAN.SCRC.Symbolics.COM (TCP 20024224555) by AI.AI.MIT.EDU 6 Oct 88 10:44:15 EDT +Received: from BLACK-BIRD.SCRC.Symbolics.COM by ALDERAAN.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 227033; Thu 6-Oct-88 10:42:12 EDT +Date: Thu, 6 Oct 88 10:42 EDT +From: Ed Schwalenberg +Subject: License plate curiosity... +To: Vince Fuller +cc: tops-20@Score.Stanford.EDU, info-its@AI.AI.MIT.EDU, geoff@fernwood.mpk.ca.us, + hic@ALDERAAN.SCRC.Symbolics.COM, pgs@AI.AI.MIT.EDU, gls@think.com +In-Reply-To: <12436116360.19.VAF@Score.Stanford.EDU> +Message-ID: <19881006144203.6.ED@BLACK-BIRD.SCRC.Symbolics.COM> + + Date: Wed 5 Oct 88 17:27:28-PDT + From: Vince Fuller + + The other day I saw a California licence plate that read "JRST 4" (I guess you + can't get commas on licence plates...). Out of curiosity, who is the owner of + this plate? + + --Vince + ------- + +Hmm. I thought this was Geoff Goodfellow's, but SAIL:AIWORD.RF[UP,DOC] +tells me he has JFCL. + +HIC got Massachusetts HLRZ (the PDP-10 instruction that implements +the "car" operation of Lisp); I believe this vehicle and plate is +still around in the possession of PGS. + +I had FOOBAR in Nevada and later in Massachusetts; I still have +the physical plates from Nevada, though the vehicle which wore +both sets is long since deceased. + +There used to be a rather extensive discussion of this stuff in the +jargon file(s), but it seems to have evaporated, except for the single +note about JFCL. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 5 Oct 88 21:09:41 EDT +Return-Path: +Received: from Score.Stanford.EDU by XX.LCS.MIT.EDU with TCP/SMTP; Wed 5 Oct 88 20:36:04-EDT +Date: Wed 5 Oct 88 17:27:28-PDT +From: Vince Fuller +Subject: License plate curiosity... +To: tops-20@Score.Stanford.EDU +Office: Pine Hall 167 +Phone: 415-723-6860 +Message-ID: <12436116360.19.VAF@Score.Stanford.EDU> +ReSent-Date: Wed 5 Oct 88 21:06:17-EDT +ReSent-From: Rob Austein +ReSent-To: info-its@AI.AI.MIT.EDU +ReSent-Message-ID: <12436123427.45.SRA@XX.LCS.MIT.EDU> + +The other day I saw a California licence plate that read "JRST 4" (I guess you +can't get commas on licence plates...). Out of curiosity, who is the owner of +this plate? + + --Vince +------- + +Date: Fri, 16 Sep 88 00:16:04 EDT +From: Peter Lothberg +Subject: The "crack team", is dissasembling MX, for it's trip to Sweden +To: INFO-ITS@AI.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU +Message-ID: <444460.880916.ROLL@AI.AI.MIT.EDU> + + +The crack team has begun to work; + +A lot of the documentation for MX (KL-10) must be spread out, i +can't find it around the machine. + +So all of you that has bits and pices, bring it to the 9:th floor +before sunday, please. + + +(As the system will not fill the container more than 40% or so, + we vold like donations of other stuff, like Lisp-machines, AAA terminals, + a IMP, Conection machines, retired 2060's etc, (I'm not joking...)) + +-Peter + +Date: Thu, 8 Sep 88 21:39:25 EDT +From: "Pandora B. Berman" +Subject: The end of the world as we used to know it +To: (*MSG *ITS)@AI.AI.MIT.EDU, ARPANET-BBOARDS@AI.AI.MIT.EDU, + INFO-ITS@AI.AI.MIT.EDU +Message-ID: <439827.880908.CENT@AI.AI.MIT.EDU> + +"The time has come," said LCS, + "MX at last must go. +Its day has gone. We need that space + Most urgently." And so +Before we crate it, let us give + A final cheerio. + +Once there was a KL-10 called MIT-MC which belonged to the Macsyma +Consortium. It provided Macsyma, the symbolic algebra system, to +researchers all over the world, and mail gatewaying and mailing list +support to a large fraction of the Arpanet. Things continued in this +fashion from 1975 to 1983. + +When the Macsyma Consortium dissolved in 1983, MC turned to providing +cycles for MIT's Laboratory for Computer Science, and continued supporting +much of the Arpanet's mail service. But the machine itself was growing old +and cranky. In 1986, the mail services were moved to a smaller, more +maintainable machine (a KS-10), and the name "MC" was moved with them. +But the KL-10 continued to run under the new name "MX". + +Now the end has come. MX was down cold for several months, and has only +been revived recently to copy some old 7-track tapes. LCS can't keep MX +any longer -- it needs the space for other purposes. So the KL is being +sent to the Home for Aged But Beloved PDP-10s; a crack team of hardware +hackers will arrive next week to dismantle it and take it back with them to +Sweden. + +In celebration of this momentous event, we are holding a small farewell +gathering: + Friday, 16 September 1988 + 16:00 + NE43-8th floor playroom + (545 Technology Square, Cambridge, MA) + +Reservations are strenuously requested (though not strictly necessary) -- +we need a head count so we can figure out how many trays of institutional +brownies to order. Send yours to: + CENT@AI.AI.MIT.EDU + +Offers of refreshement are also very welcome -- do you think we have any +budget for this kind of thing? Send all such offers also to CENT as above. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 12 Mar 88 11:35:46 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 12 Mar 88 11:24:33 EST +Date: Sat, 12 Mar 88 11:24:38 EST +From: "Christopher M. Maeda" +Subject: UMass ITS's +To: mike@OZ.AI.MIT.EDU +cc: info-its@MC.LCS.MIT.EDU +Message-ID: <340451.880312.MAEDA@AI.AI.MIT.EDU> + +I heard of a pretty big Intelligent Tutoring Systems effort +going on at UMass. I have the paper at home if you want it. +They aren't really doing anything new, just applying AI to a +new area. The most interesting thing about the paper is that +they continually use the acronym ITS to describe their systems. + +Chris + + +Received: from MEAD.SCRC.Symbolics.COM (TCP 20024224752) by AI.AI.MIT.EDU 7 Mar 88 15:58:19 EST +Received: from BLACK-BIRD.SCRC.Symbolics.COM by MEAD.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 141317; Mon 7-Mar-88 15:58:00 EST +Date: Mon, 7 Mar 88 15:57 EST +From: Ed Schwalenberg +Subject: Re: [ota: SPACE Digest V8 #156] +To: Rob Austein , MAEDA@AI.AI.MIT.EDU +cc: postmaster@MC.LCS.MIT.EDU, MarkL@ALLSPICE.LCS.MIT.EDU, + Info-ITS@AI.AI.MIT.EDU +In-Reply-To: <12380322663.23.SRA@XX.LCS.MIT.EDU> +Message-ID: <880307155748.0.ED@BLACK-BIRD.SCRC.Symbolics.COM> + + Date: Sun 6 Mar 88 23:23:32-EST + From: Rob Austein + + Date: Sun, 6 Mar 88 14:22:49 EST + From: "Christopher M. Maeda" + + The following was posted to space digest in a discussion about + remote logins to the moon.,, + [Note COMSAT ".." lossage here^^.] + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + + For interplanetary stuff you'd want to use a batched mail protocol + like BSMTP over a high bandwidth transmission protocol like NETBLT for + mail. You could probably get away with SMTP to Lunagrad (Moonbase + doesn't look like it's going to be an issue any time soon). + + Remote login will be bad no matter what. The best you could do would + be something like RMS's local editing protocol, again using something + like NETBLT for transmission so that at least screen updates would be + fast once they arrived. + +I actually tried using a computer in Miami from Antarctica via a geosynch +satellite. It was, er, painful. But I did a fun experiment too: I did +an analog loopback through the satellite, and watched my characters echo +on the screen. Then I tried typing a character, and while it was on its +way up and back I digitally looped back my end. After about 6 passes the +character would begin to decay: + aaaaaabp~~~~~~ +Another satellite hacker (the gentleman in Miami) ran a PDP-11 to the satellite, +ran the analog downlink back up to another channel on the same satellite, then +to a terminal, for a total delay of about .75 sec. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Mar 88 23:50:25 EST +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 6 Mar 88 23:32:24 EST +Date: Sun 6 Mar 88 23:23:32-EST +From: Rob Austein +Subject: Re: [ota: SPACE Digest V8 #156] +To: MAEDA@AI.AI.MIT.EDU +cc: info-its@MC.LCS.MIT.EDU, postmaster@MC.LCS.MIT.EDU, + MarkL@ALLSPICE.LCS.MIT.EDU +In-Reply-To: <336939.880306.MAEDA@AI.AI.MIT.EDU> +Message-ID: <12380322663.23.SRA@XX.LCS.MIT.EDU> + + Date: Sun, 6 Mar 88 14:22:49 EST + From: "Christopher M. Maeda" + + The following was posted to space digest in a discussion about + remote logins to the moon.,, +[Note COMSAT ".." lossage here^^.] + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + +For interplanetary stuff you'd want to use a batched mail protocol +like BSMTP over a high bandwidth transmission protocol like NETBLT for +mail. You could probably get away with SMTP to Lunagrad (Moonbase +doesn't look like it's going to be an issue any time soon). + +Remote login will be bad no matter what. The best you could do would +be something like RMS's local editing protocol, again using something +like NETBLT for transmission so that at least screen updates would be +fast once they arrived. + +You might also want to ask somebody at BBN about the current tuning of +the ARPANET (net 10.0.0.0 itself): one of the three transcontinental +channels is a comsat link, the other two are land lines, and all hell +broke loose for the few days between when they installed the comsat +link and when they got it tuned properly. +------- + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Mar 88 20:20:27 EST +Received: from AI.AI.MIT.EDU (CHAOS 3130) by MC.LCS.MIT.EDU 6 Mar 88 19:56:02 EST +Date: Sun, 6 Mar 88 14:22:49 EST +From: "Christopher M. Maeda" +Subject: [ota: SPACE Digest V8 #156] +To: info-its@MC.LCS.MIT.EDU, postmaster@MC.LCS.MIT.EDU +Message-ID: <336939.880306.MAEDA@AI.AI.MIT.EDU> + + +The following was posted to space digest in a discussion about +remote logins to the moon.,, + + From: tektronix!reed!douglas@ucbvax.berkeley.edu (P Douglas Reeder) + Subject: Re: data and long distances + + The distance problem applies to satelites in geosynchonous + orbit, as well. radio wave take a noticeable fraction of a + second to get there and back. That would play hell with high + baud rates if not accounted for. A comsat expert might know + how it's done. + +Chris + + + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 27 Oct 87 02:52:35 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Mon, 26 Oct 87 23:49:58 PST +Date: Mon, 26 Oct 87 23:06:19 PST +From: Mark Crispin +Subject: Re: ITS outlives Multics?! +To: GUMBY@AI.AI.MIT.EDU +cc: Info-ITS@AI.AI.MIT.EDU +In-Reply-To: <275589.871027.GUMBY@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345749289.8.MRC@PANDA.COM> + +TOPS-10 and TOPS-20 both support 30-bit address spaces (although the KL +CPU only allows 23). Having written a large program using 30-bit addressing, +I can assure you it isn't as kludgy as its detractors claim, and certainly a +lot cleaner than some of the current faddish architectures. + +I'm sure some bright hacker could figure out how to convert ITS to 30-bit +addressing. +------- + +Date: Tue, 27 Oct 87 01:30:27 EST +From: David Vinayak Wallace +Subject: ITS outlives Multics?! +To: "MRC@PANDA.COM"@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Mon 26 Oct 87 10:04:15 PST from Mark Crispin +Message-ID: <275589.871027.GUMBY@AI.AI.MIT.EDU> + + Date: Mon, 26 Oct 87 10:04:15 PST + From: Mark Crispin + + We'll need some new CPU's though. 36-bits are decidedly out of fashion + at Stanford, but perhaps there are some MIT VLSI hackers who might want + to make a PDP-10 on a chip? + +But the 18-bit address space is a lose. Since you're making a new +chip or chip set anyway, why not double the word length? 36-bit +halfwords should keep people happy for a while. We could have more +registers, too. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 26 Oct 87 14:16:23 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Mon, 26 Oct 87 11:08:04 PST +Date: Mon, 26 Oct 87 10:04:15 PST +From: Mark Crispin +Subject: Re: ITS outlives Multics?! +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU +In-Reply-To: <275113.871026.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345606917.6.MRC@PANDA.COM> + +That sounds good. I'm sure the ITS hackers in 2155 will be able to think +of something clever to solve the problem then. TOPS-20's date format +dies at the last 1/3 second of Wednesday, 7 August 2576 GMT (here on the +west coast, just before 5PM PDT), so we have almost 589 years to worry +about that. + +We'll need some new CPU's though. 36-bits are decidedly out of fashion +at Stanford, but perhaps there are some MIT VLSI hackers who might want +to make a PDP-10 on a chip? +------- + +Date: Mon, 26 Oct 87 11:58:03 EST +From: Alan Bawden +Subject: ITS outlives Multics?! +To: MRC@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 25 Oct 87 13:59:55 PST from Mark Crispin +Message-ID: <275113.871026.ALAN@AI.AI.MIT.EDU> + + Date: Sun, 25 Oct 87 13:59:55 PST + From: Mark Crispin + ... + I was quoted in a trade journal as saying that PANDA/TOPS-20 + will see the century tick. What about ITS? We're going to + have to do something about that sixbit date format, you know! + +(I intend to continue using ITS into retirement...) + +The SIXBIT date format you are thinking of (from the .RDATE uuo) is for +simple programs that want the date in MM/DD/YY format. I presume that on +January 1, 2000 those programs will want to print the date as 01/01/00, so +this isn't a problem. + +There are two other date formats. The .RYEAR uuo returns the year as an +18-bit quantity, so that will work for quite some time. The other, more +common, date format is the one used by the filesystem, and by programs that +used the DATIME library; this is the format returned by the RQDATE system +call. This format packs the year, less 1900, in a 7-bit field, so this +will last through 2027. Since the bit to the left of the year field is +unused, we can easily expand this to last through 2155. + +Probably the most we will have to do is fix a few user programs that have +the string "19" built into them. + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 25 Oct 87 17:23:27 EST +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Sun, 25 Oct 87 14:21:06 PST +Date: Sun, 25 Oct 87 13:59:55 PST +From: Mark Crispin +Subject: ITS outlives Multics?! +To: INFO-ITS@AI.AI.MIT.EDU +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12345387677.6.MRC@PANDA.COM> + +I just got a message from the Multics postmaster saying that +MIT-Multics will be shut down on 31 December. Athough it was +inevitable it is still rather sad. I find it somewhat ironic +though that today, years after ITS was declared dead, there +are more ITS systems in operation (even excluding the part-time +systems) than ever. + +I was quoted in a trade journal as saying that PANDA/TOPS-20 +will see the century tick. What about ITS? We're going to +have to do something about that sixbit date format, you know! +------- + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 4 Oct 87 04:28:25 EDT +Received: from PANDA.COM by SUMEX-AIM.STANFORD.EDU with Cafard; Sun, 4 Oct 87 01:16:03 PDT +Date: Sat, 3 Oct 87 23:08:38 PDT +From: Mark Crispin +Subject: Re: The operating system that wouldn't die! AAAAIIIIEEEEEE!!!!! +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU, gls@THINK.COM +In-Reply-To: <264420.871003.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12339709477.6.MRC@PANDA.COM> + +Well, you know, we have to start thinking about what will happen +when the century ticks. I'm determined that TOPS-20 on PANDA will +see it tick, which means fixing any bugs that have two-digit years. +The question is, how will ITS handle it? + +I think it will be damn funny if our 36-bit "dinosaurs" just tick +the century and keep on smiling, while every Unix system in the +world crashes!!! + +-- Mark -- +------- + +Received: from TB.CC.CMU.EDU (TCP 20000576442) by AI.AI.MIT.EDU 4 Oct 87 04:22:14 EDT +Date: Sun 4 Oct 87 04:14:20-EDT +From: Cthulhu +Subject: its on a ka10 +To: info-its@AI.AI.MIT.EDU +Message-ID: <12339732358.19.AD0R@TB.CC.CMU.EDU> + + +It's amazing enough that they got the ka10 running. I think they've got all +core in that lovely machine. These are truly wonderful people. + +------- + +Date: Sat, 3 Oct 87 23:02:14 EDT +From: Alan Bawden +Subject: The operating system that wouldn't die! AAAAIIIIEEEEEE!!!!! +To: INFO-ITS@AI.AI.MIT.EDU, gls@THINK.COM +In-reply-to: Msg of Fri 2 Oct 87 11:34:35 EDT from gls at Think.COM +Message-ID: <264420.871003.ALAN@AI.AI.MIT.EDU> + + Date: Fri, 2 Oct 87 11:34:35 EDT + From: gls at Think.COM + To: bug-its at ai.ai.mit.edu + I just got my "Happy Birthday" message from Puff the Magic Dragon at AI. + Maybe I'm silly, but this has made me very happy today. It's nice that + someone cared enough to set up the software so I get a message every year. + (I think I am also affected by nostalgia for my days at MIT.) + --Guy + +Well a message like this is certainly guaranteed to make -my- day! It's +always nice to have people appreciate creaky-but-reliable old ITS for still +being around after 20 years! + +I thought I would take this opportunity to spread the word about something +that I don't think has been very widely publicized. Some of you may recall +that a while ago some fellows in Sweden contacted us about running ITS on +various PDP-10's that they owned? Well, we mailed them a set of tapes for +bringing up ITS on their 2020, which they were able to do without too much +trouble (their biggest problem was -my- fault). That all happened over a +year ago. Recently we learned that these guys have successfully -built- +ITS paging hardware for their KA-10, and have ITS up and running there as +well! Totally Amazing. + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 7 Aug 87 06:34:11 EDT +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by MC.LCS.MIT.EDU 7 Aug 87 04:26:56 EDT +Date: Thu, 6 Aug 1987 21:52 EDT +Message-ID: +From: Rob Austein +To: barmar@THINK.COM +Cc: info-its@MC.LCS.MIT.EDU +Subject: Unix catching up to ITS +In-reply-to: Msg of 6 Aug 1987 14:00-EDT from barmar@Think.COM + +No, that's the USR: device. But they've invented the JOB: device too, +something called "portals" I think. + +As Noel Chiappa said when talking about ITS and Multics, it's really +kind of scary to think that we are just now catching up to what we +were able to do twenty years ago. + + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 6 Aug 87 19:01:31 EDT +Received: from Think.COM (TCP 1201000006) by MC.LCS.MIT.EDU 6 Aug 87 18:06:10 EDT +Return-Path: +Received: from godot.think.com by Think.COM; Thu, 6 Aug 87 14:00:44 EDT +Received: by godot.think.com; Thu, 6 Aug 87 14:00:39 EDT +Date: Thu, 6 Aug 87 14:00:39 EDT +From: barmar@Think.COM +Message-Id: <8708061800.AA08725@godot.think.com> +To: info-its@mc.lcs.mit.edu +Subject: Unix catching up to ITS + +I read the following in the Usenet newsgroup comp.unix.wizards (== to +the Arpanet mailing list UNIX-WIZARDS). AT&T has finally "invented" +the JOB: device! + +Article 3409 of comp.unix.wizards: +Path: think!husc6!seismo!mnetor!utzoo!henry +From: henry@utzoo.UUCP (Henry Spencer) +Newsgroups: comp.unix.wizards +Subject: /proc, /n/face +Message-ID: <8285@utzoo.UUCP> +Date: 10 Jul 87 19:06:20 GMT +References: <7879@brl-adm.ARPA> <2211@bunker.UUCP>, <6043@brl-smoke.ARPA>, <8244@utzoo.UUCP> +Organization: U of Toronto Zoology +Lines: 42 + +> V8 /proc preserves the semantics of a normal Unix directory setup *exactly*, +> unless I missed something subtle when I read the code. My impression is that +> /n/face does likewise. In both cases the directory hierarchy is actually a +> figment of the kernel's imagination, but it is a consistent figment with the +> same semantics as normal directories. + +Several people have asked what this is about, so I suppose I should elaborate +a bit. This stuff has been presented in papers at Usenix conferences, but +not everybody's familiar with those. + +/proc is V8's replacement for the ptrace() system call and related things. +It's a slightly-odd type of file system. Once mounted, it looks like a +single directory containing a bunch of files with numeric names. If you +open (say) file "12345", you are looking at the address space of process +number 12345. Writes into the file are writes into the address space. +There are ioctls for things like stopping and starting the process, sending +it signals, etc. Access to the files is naturally subject to the standard +Unix file-permission system. The whole thing is actually a figment of the +kernel's imagination, with the "directory" manufactured on the fly whenever +someone tries to read it, and operations on the "files" turned into the +corresponding operations on the processes. Apart from being cleaner than +ptrace(), /proc is also faster. + +[description of /n/face deleted] + +In both cases, these odd filesystems look exactly like real ones, down to +things like "." and ".." entries in the directories. You can use all the +standard Unix tools to operate on them. + +At least one System V implementation of /proc exists inside AT&T, but it +hasn't made it into any released software that I know of. I believe /n/face +is strictly a V8ism at the moment. +-- +Mars must wait -- we have un- Henry Spencer @ U of Toronto Zoology +finished business on the Moon. {allegra,ihnp4,decvax,pyramid}!utzoo!henry + + + + +Date: Tue, 5 May 87 08:25:18 EDT +From: John Wilson +To: INFO-ITS@AI.AI.MIT.EDU +Message-ID: <195618.870505.JOHNW@AI.AI.MIT.EDU> + +Please add me to the mailing list. + + thanks, John Wilson + +Received: from SUMEX-AIM.STANFORD.EDU (TCP 1200000070) by AI.AI.MIT.EDU 16 Apr 87 04:36:44 EDT +Received: from PANDA by SUMEX-AIM.STANFORD.EDU with Cafard; Thu, 16 Apr 87 01:31:16 PDT +Date: Thu, 16 Apr 87 00:29:35 PDT +From: Mark Crispin +Subject: Re: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) +To: ALAN@AI.AI.MIT.EDU +cc: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <185625.870416.ALAN@AI.AI.MIT.EDU> +Postal-Address: 1802 Hackett Ave.; Mountain View, CA 94043-4431 +Phone: +1 (415) 968-1052 +Message-ID: <12294897588.8.MRC@PANDA> + +I am involved peripherally with this project. + +There is NO attempt to shortchange or ignore ITS, WAITS, and TENEX. + +But!! We will need *papers* from people in these communities in order to +fairly cover these operating systems. + +Otherwise, I will write up something really brief. For ITS, in a few short +paragraphs I'll talk about DDT as the command decoder, PCLSR'ing, and the +environment that led to the creation of EMACS. + +I think such coverage WOULD shortchange ITS. There are lots of important +concepts that can and should be discussed in detail -- PCLSR'ing, ITS virtual +memory (not as good as TOPS-20/Tenex, but quite advanced for its time), +canonical terminals/SUPDUP/CRTSTY, symbolic system calls, CHEOPS, Knight TV +system, ... + +TECO and TECO-based editors should be a paper in itself. +------- + +Date: Thu, 16 Apr 87 02:04:00 EDT +From: Alan Bawden +Subject: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <185625.870416.ALAN@AI.AI.MIT.EDU> + +The following message was forwarded to me (it was originally sent to AIList +I think) with the suggestion that I should redistribute it to whatever +mailing lists of PDP-10 hackers I knew of. I don't know anything more +about this than what is revealed here. + +It does kind of sound like these guys are planning on writing a history of +PDP-10's that only mentions TOPS10 and TOPS20 and fails to consider ITS and +WAITS and perhaps shortchanges TENEX. But I suspect that this is merely a +shortcoming of this announcement. + +Date: 16 Mar 1987 1311-EST +From: "Joe Dempster, DTN: 336.2252 AT&T: 609.665.8711" +Subject: Announcement of the DEC 10 and PDP-6 history project (PROJECT-10262) + +This message originates from 2 sources: + + Les Earnest + Computer Science Department + STANFORD UNIVERSITY + Stanford, CA 94305 + 415.723.9729 + ARPA: LES@SAIL.STANFORD.EDU + + Joe Dempster + DIGITAL EQUIPMENT CORPORATION + 6 Cherry Hill Executive Campus + Route 70 + Cherry Hill, NJ 08002 + 609.665.8711 + ARPA: DEMPSTER@MARLBORO.DEC.COM (MARKET) + +The goal of this project is to publish an analysis and history of +the evolution, implementation and use of Digital's 36 bit systems. +This period began with the PDP-6 in 1964 and continues today with +TOPS 10/20 development, which is scheduled to end in 1988. + +We are working aggressively to finish the project, and have it +published, by March/April 1988. This will require that the +completed manuscript be ready to go into the publication cycle +by August 1987! + +The project will attempt to answer the following questions: + + 1. In what markets/applications were these systems used? + + 2. Who were the users of these systems and what impact did + roughly 2,500 TOPS 10/20 systems have on their organizations? + + 3. Who were the principle system architects of these systems? + What features, and if there had been sufficient time to + implement them, would have significantly improved the + architecture? + + 4. What impact did the decision to continue to examine design + extensions to the architecture have on the usefulness and + acceptability of these systems. This is in contrast to a + more common practice today to work from a detailed design + specification, sometimes dated, building follow-on systems + which provide increased performance through the use of new + component technologies and packaging techniques. + + 5. What part of the overall design (TOPS10/20) was technology + dependent and what can still be considered "unequaled" in + relation to other computer architectures still undergoing + active development? + + 6. What type of development environment (both HW and SW) + supported and contributed to the evolution of 36 bit + systems? + + 7. What influence did TOPS 10/20 have on other vendors system + development? + +This history will undoubtedly be assembled from many sources and +participants. Some information will be anecdotal; there will be +interviews with the people involved (users and developers) and technical +papers will be solicited. Of course there will also be the packaging +and assembly of facts as we see them. + +The result will hopefully have sufficient depth to serve as: + + 1. An introductory or advanced text on system design and + hardware/system software implementation. + + 2. A analysis of the success and difficulties of marketing + complex systems into a very crowded market of competing + alternatives. + + 3. A catharsis for those of us who have contributed to the + development and use these systems and who will now move + onto new computing architectures and opportunities. + +In addition to interviewing directly 25-50 developers, users and +product managers we will continue to work to identify contributors +and significant events up to when the final draft is submitted to +the publisher. Two "topics" are already under development: + + 1. Rob Gingell from SUN is working on a paper which looks + at extensions to TOPS 20 which would have enhanced its + capabilities. + + 2. Frank da Cruz and Columbia are summarizing 10 years of + experience and development of TOPS 20 systems. Some + effort will also be made to detail the process which + lead to their selection of a follow-on architecture to + TOPS 20. + +There is a need to develop additional topics which represent the +use and application of the technology (TOPS 10/20) in other areas. +Specific recommendations are welcome as are proposals to develop +them. A short abstract should accompany any such proposal. Every +effort will be made to work with individuals or organizations +interested in making such a contribution. + +There will be a standalone (no network connections) DECSYSTEM 2020 +(YIPYIP) dedicated to supporting the project. This system has a 3 +line hunt group, with all lines accessible from a single number +(201.874.8612). + +Both YIPYIP and MARKET will have "public" directories for remote +login (DEMPSTER.PROJECT-10262 LCGLCG). MARKET can +be accessed by modem (617.467.7437), however disk quota is limited. +MARKET's primary purpose is ARPAnet TELNET +access. YIPYIP is a dedicated PROJECT-10262 system. MAIL can also +be sent to DEMPSTER on either system. + +YIPYIP and MARKET will keep a running summary of ideas and comments +up on Columbia's BBOARD software. KERMIT also runs on each system +for uploads. + +SAIL.STANFORD.EDU will support ARPAnet transfers to a "public" area: + + FTP + CONNECT SAIL.STANFORD.EDU + SEND AFN.EXT + DSK: AFN.EXT [PUB,LES] + +SAIL runs WAITS, an operating system similiar to TOPS 10. File +names are limited to 6 characters and extensions limited to 3. + + +Implementation details: + + 1. User input is welcomed and desired from all application + and geographic areas. + + 2. Input from past and present developers is also desired. + + 3. Throughout the project a secondary goal will be to build + a list of users/locations (installation date, duration and + disposition) of PDP-6 and KA, KI, KL and KS systems. + Serial numbers, if available, are requested. + + 4. We anticipate that this project will generate a large + volume of information (which we hope will arrive + electronically). Some information, for any number of + reasons, may not be in line with the project's stated + goals. Therefore, all notes, interview material and + submissions will be donated to the Computer Museum in Boston + at the the completion of the project to be available for + future reference and research. + +Ideas, contributions, suggestions and criticism are welcome. As these +36 bit systems were the products of a multitude of people, so too +will be the writing of their history. + +Date: Sat, 21 Mar 87 05:59:20 EST +From: "Anthony A. Datri" +Subject: is this a mailing list? +To: INFO-ITS@AI.AI.MIT.EDU, INFO-ITS-REQUEST@AI.AI.MIT.EDU +Message-ID: <171734.870321.AAD@AI.AI.MIT.EDU> + + +Is this an ITS mailing list (duh!)? If so, could I be added to it? I'm relatively +new to ITS (turist account), and I'd love to find out more. I have great +respect for an os that was named to make fun of IBM. Also, I saw something +somewhere about something called CAMEXEC, which called it an its-like +operating system for the pdp-11. Since I've got an 11/34 with nothing better +to run than 2.9.1 BSD or RT11, I'm interested. Does anyone know anything +about this? (hmm. that sounds like a stupid question, doesn't it?) If +I seem confused, it's because I largely am. I'm learning about ITS by +trial and error. + +I bet this will seem the strangest to you. IS ITS public domain at this +point? If it is, what would it take to get a distribution? This is a very +silly question, but I seriously intend to have a 2020 of my own someday. +If Mr. Crispin can do it, so can I 8^) + +Thanks for any time you spend putting up with and/or answering this mail. + +Anthony A. Datri +aad@ai.ai.mit.edu (but i imagine you guessed that, eh?) + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 JAN 87 15:01:45 EST +Received: from KAREN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 19480; Mon 26-Jan-87 15:03:06 EST +Date: Mon, 26 Jan 87 15:03 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <870126150304.6.ALAN@KAREN.AI.MIT.EDU> + +Despite the fact that in the IAP guide I promised four sessions of the ITS +course, there will -not- be a fourth session this week. See you all again +next year! + +Received: from MIT-MULTICS.ARPA (TCP 1200000006) by AI.AI.MIT.EDU 16 Jan 87 04:17:47 EST +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2715239312833556@MIT-MULTICS.ARPA>; 16 Jan 1987 04:08:32 est +Message-ID: <227734@QZCOM> +In-Reply-To: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> +Date: 16 Jan 87 01:07 +0100 +From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-To: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA, + ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA, + INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Subject: IAP + +If someone has a home-video-tape-recorder-and-camera-set at MIT +availible, it wold be nice to have a vide tape of the lecture, +for us that can't show up. + + + + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 15 JAN 87 15:29:36 EST +Received: from PIGPEN.AI.MIT.EDU by OZ.AI.MIT.EDU via Chaosnet; 15 Jan 87 15:21-EST +Date: Thu, 15 Jan 87 15:23 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +In-Reply-To: <870107165040.1.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <870115152304.7.ALAN@PIGPEN.AI.MIT.EDU> + +Those of you who missed the second session of the ITS course last night +should be aware that next week we will once again meet on -Wednesday-. +It seems I screwed up when I thought we couldn't have the playroom this +Tuesday, and it is actually -next- Tuesday than has the conflict. + +Next Wednesday we'll do something about Job Devices. How to write one, or +how they are implemented, or something like that... + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 7 JAN 87 16:52:54 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 17414; Wed 7-Jan-87 16:50:47 EST +Date: Wed, 7 Jan 87 16:50 EST +From: Alan Bawden +Subject: IAP +To: Info-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <870107165040.1.ALAN@PIGPEN.AI.MIT.EDU> + +Those of you who missed the first session of the ITS course last night +should be aware that next week we will meet on -Wednesday- instead of +Tuesday. The following week we will go back to meeting on Tuesdays. (All +meetings are in the 7th floor playroom at 7:30). + +Next Wednesday we will hear a bit about the ITS filesystem (not all that +much to tell) and then Ed Schwalenberg will tell us about "CAMEXEC: An +ITS-style Operating System for PDP11's". + +Date: Sun, 4 Jan 87 05:03:53 EST +From: Alan Bawden +Subject: IAP +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU +Message-ID: <136289.870104.ALAN@AI.AI.MIT.EDU> + +Yes, there will be an IAP course this January about ITS. The first meeting +will take place in the 7th floor playroom this Tuesday (the 6th) at 7:30 PM. + +On Tuesday we will talk about a number of things, including what topics +people might want to hear about in future sessions. As a main event, I am +preparing an explanation of everyone's favorite ITS feature: + + PCLSRing: What it is, how it's implemented, + and why Lisp Machines should have it. + +I'll try and satisfy both the people who want to hear about low-level, +bits-between-the-toes issues, and those who want to learn universal, cosmic +principles. I'll even relate PCLSRing to quantum mechanics. + +Date: Sat, 17 May 86 07:30:43 EDT +From: "Pandora B. Berman" +Subject: dumped state +To: INFO-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42220.860517.CENT> + +as of this morning, all ITSs here (with the possible exception of the KL) +are being regularly backed up to tape. it -is- safe to store your files on +any of the KSs. + +Date: Sun, 11 May 86 21:28:30 EDT +From: Alan Bawden +Subject: Ask, and you shall recieve +To: SRA@XX.LCS.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +cc: BUG-INQUIR@MC.LCS.MIT.EDU, CENT@MC.LCS.MIT.EDU, + SRA@MC.LCS.MIT.EDU, ZVONA@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 11 May 1986 04:59 EDT from Rob Austein +Message-ID: <[AI.AI.MIT.EDU].37394.860511.ALAN> + + Date: Sun, 11 May 1986 04:59 EDT + From: Rob Austein + ... (although it would be nice if it had some reasonable way to + deduce what ITSs exist, at run-time). + +Because I was updating so many programs to know about the new plethora of +ITS machines, I added exactly this feature. There is a new table you can +ask for from the .GETSYS uuo: ITSNMS is a table of the sixbit names of the +-current- local ITS machines. I have already converted most of the +programs that used to have built-in tables of ITS machines (INSTAL, FINGER, +FIND, etc.) to use this. Do +:UUO GETSYS +for details. + +Received: from MIT-MULTICS.ARPA by AI.AI.MIT.EDU 8 May 86 07:46:48 EDT +Received: from QZCOM.MAILNET by MIT-MULTICS.ARPA with Mailnet id <2693388755368144@MIT-MULTICS.ARPA>; 08 May 1986 07:32:35 edt +Date: 08 May 86 00:44 +0200 +From: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA +Reply-to: Peter_Lothberg_STUPI%QZCOM.MAILNET@MIT-MULTICS.ARPA, + ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA +To: ITS_bugs_mailing_list%QZCOM.MAILNET@MIT-MULTICS.ARPA, + KS-ITS@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU, "Alan Bawden" + +Subject: State of the world +Message-ID: <172046@QZCOM> +In-Reply-To: <[AI.AI.MIT.EDU].35019.860506.ALAN> + +We are looking forward, to the moment when we can load the tape +in the tape drive and have the system flying. + + + + +Date: Tue, 6 May 86 00:40:15 EDT +From: Alan Bawden +Subject: State of the world +To: KS-ITS@AI.AI.MIT.EDU, INFO-ITS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].35019.860506.ALAN> + +There are now -five- machines running ITS at MIT, more than have ever +existed simultaneously before. There is the MC KL10, and four KS10's named +AI, MX, ML, and MD. + +The MC KL10 is off maintenance contract as of the first of this month, so I +suppose its days are numbered. At some point before the KL10 passes on to +that great machine room in the sky, the MC KL10 and the MX KS10 will swap +their names, and we will plug the new MC KS10 into the old MC's Arpanet +port. This assures that as far as the outside world is concerned, there +will always be an ITS named MC at that Arpanet address, performing mail +service functions for MIT. (Let's not get into the hair we will be going +through to make all the mailing lists in the world continue to work.) + +The KL10 will remain available for all those who wish to continue to use +it, under the name MX. When the KL10 retires, the name MX will be retired +with it. + +Various other owners of KS10's around the world will be receiving KS10 ITS +distribution tapes in the mail soon. The last machine we booted (MD) was +built by a volunteer using the printed instructions we plan to include with +our ITS distribution kits. + +Date: Fri, 28 Mar 86 09:02:47 EST +From: Alan Bawden +Subject: A new ITS is born +To: INFO-ITS@AI.AI.MIT.EDU, KS-ITS@AI.AI.MIT.EDU, + KARENS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].22057.860328.ALAN> + +MIT-MX came up for the first time this morning. (You can supdup there +right now, but you won't find much when you get there...) There are still +some problems with the technology for creating new ITS systems from +scratch, but it mostly works. Hopefully after doing the next two (ML and +MD) things will be pretty smooth. + +All kind of worms are crawling out of the woodwork because of various +programs that -know- that all ITS machines are named "AI", "MC", "ML", or +"DM". It should take another days hacking to stomp them all... + +Date: Tue, 29 Oct 85 20:47:43 EST +From: Alan Bawden +Subject: Silly lineprinter devices again. +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].697383.851029.ALAN> + +Remember the 7LP: and 7LR: devices? Well, now that we have a third such +device on the 9th floor, and another one coming soon to the 8th, it would +make sense for me to tell you that I have installed 8LP: and 9LP: devices, +right? WRONG! Since a clear numbering trend is emerging it makes sense to +change the naming scheme so that the number comes -last-. So the official +names are now: + + LP7: The 7th floor QMS 2400 + LP8: The 8th floor QMS 2400 + LP9: The 9th floor QMS 1200 + + LR7: The 7th floor laserwriter + +The two old names 7LP: and 7LR: continue to work for compatibility. + +Date: Tue, 24 Sep 85 05:07:32 EDT +From: Alan Bawden +Subject: Now installed on AI, and soon to be installed on MC. +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].657412.850924.ALAN> + +There is now a demon job that runs when ITS starts up that attempts to set +the time from the network. The message that the system types out at boot +time when it discovers that the clock has been reset no longer commands the +hacker to log in and run PDSET, instead it tells him that he should just +stick around a watch what happens in case he has to run it. The demon will +print a message on the system console explaining what it did about the +time. If the demon was unsatisfied that it could determine the time, the +message will try to attract the hacker's attention and explain to him what +the problem was and tell him that he does have to run PDSET after all. + +Date: Fri, 26 Jul 85 22:10:20 EDT +From: Alan Bawden +Subject: 7LP: and 7LR: +To: INFO-ITS@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].589842.850726.ALAN> + +Remember the 7LP: device I advertised in this spot last winter? (I sends +output to the LN01 printer on the 7th floor.) Well, I have just installed a +7LR: device for sending output to the new laserwriter (also on the 7th +floor). + +While I was at it I gave both devices a new feature. They now support +deletion so you can delete items from the queue. For example, if 7LP^F +shows you the following: + + 7th floor ln01 is ready and printing + Time Owner Job Files Size + *21:55 alan 905 7LP: BAWDEN; B 249 49481 + + The most recent job printed was: + 21:21 alan 7LP: BAWDEN; .FILE. (DIR) + +then you can delete job 905 by doing either ^O 7LP:905 or ^O 7LP:ALAN. In +the later case all entries owned by ALAN are deleted. The second filename +and directory are ignored. + +Received: from MIT-AI by MIT-MC via Chaosnet; 19 APR 85 22:39:59 EST +Date: Fri,19 Apr 85 22:40:37 EST +From: Alan Bawden +Subject: Progress Report! +To: KS-ITS@MIT-AI, INFO-ITS@MIT-AI +Message-ID: <[MIT-AI].71.850419.ALAN> + +The MIT-AI KS10 has now been up and running timesharing for almost two days +without incident. We are on the Chaosnet, we have COMSAT, EMACS, LISP, +etc. all running just fine. We do not have tape drive support for backing +up out filesystem yet, and our current filesystem is built on a scratch +pack, so you can't put any files here that you care about, but basically we +are winning completely. + +Interesting aside: It appears that for the last three years the Dover +spooler on MC has been trying in vain to write the file +AI:TEXLIB;TODAYS DATE. I'll bet it had a heart attack when it finally +succeeded! + +Date: 9 December 1984 21:10-EST +From: Alan Bawden +Subject: 7LP: +To: INFO-ITS @ MIT-MC +cc: BUG-ITS @ MIT-MC + +I have installed a 7LP: device on MC and ML for using the LN01 printer on +the 7th floor to generate simple hardcopy. Outputting to 7LP: opens a +connection to PREP (where the spooler runs) and transmits your text. For +example :COPY DSK:ALAN;ALAN LOGIN,7LP: makes hardcopy of my init file. +Reading from 7LP:.FILE. (DIR) produces a listing of the queue on PREP, so +you can type 7LP to DDT to see who's output is in front of yours. + +Date: 27 November 1984 01:09-EST +From: Alan Bawden +Subject: Progress report +To: BUDD @ MIT-MC, KS-ITS @ MIT-MC +cc: INFO-ITS @ MIT-MC +In-reply-to: Msg of 21 Nov 1984 20:24-EST from Philip Budne + + Date: 21 November 1984 20:24-EST + From: Philip Budne + Re: AI (the KS10) + What is the current state of thew new AI? I have been watching + [OZ]ARC:AI-KL, but the has been no news for a month! + +Yeah, I guess I haven't said anything recently. My last message was to +announce that I got the microcode support working? Since then I have been +working on conditionalizing all those places that are sensitive to the +specifics of the processor. I guess this task is somewhat easier than it +was when ITS was conditionalized for the KL, because most of the processor +dependencies are already known; a string search for "KL10P" sufficed to +find most of them. I guess I could declare this task complete now (modulo +debugging), all that really remains is to write TTY routines for talking to +the system console through the 8080. (They are trivial, I almost finished +them tonight.) + +Next I get to learn how to interface to a bunch of random devices: the DZ11 +terminals, the disk, and the tape drive. All that stands between us and a +first try at bringing ITS up are disk routines in ITS, disk routines in the +salvager, and a trivial tape reading routine in the salvager so that we can +put a couple of things in the initial filesystem. + +I guess I made a bunch of decisions along the way that ITS hackers might be +interested in, but not really much that the typical machine language +programmer will need to know about. The protocol for one-proceed will be +different, but that remains unimplemented. There will be a JPC, but that +hasn't been done either. There will never be a MAR. There is a new user +interrupt (%PINXI) that will be given to jobs in .IOTLSR mode that touch +Unibus locations with nothing in them. The protocol for setting the time +is new, so someone need to modify PDSET or supply a new equivalent program. + +Oh yeah, I also fixed a couple of problems with "Exec DDT" and the magtape +bootstrap program in the course of experimenting with the machine. + +There still remains a bunch of things to do to make the machine ultimately +useable. Things like network code. Code to interface to Taft's "Format +Confuser". The Format Confuser itself. Code for booting the machine from +the disk. Code for frobbing the 8080 filesystem. Etc. + +Date: 27 February 1984 12:14-EST +From: Alan Bawden +Subject: locks +To: INFO-ITS @ MIT-MC +cc: CSTACY @ MIT-MC, KLH @ MIT-MC + +I added some text to .INFO.;ITS LOCKS explaining the timing screw in the +shared database initialization algorithm. + +Date: 6 January 1984 22:11 EST +From: Christopher C. Stacy +Subject: alt alt to you too! +To: INFO-ITS @ MIT-MC, BUG-DDT @ MIT-MC +cc: KMP @ MIT-MC + + +I un-de-generalized the code for $$^F so that you can make all +the FN2s zero and get the default. Ie., you can put searches +in slots besides $$0^F. I also increased the size of the table +a little bit. + +$$0^F FIRST +$$1^F NAME1 UP (verbose listing) +$$2^F SECOND +$$3^F CDATE DOWN +$$4^F SIZE DOWN +$$5^F ONLY LINKS (had to put something here....) + + +Date: 6 January 1984 22:02 EST +From: Kent M Pitman +To: ALAN @ MIT-MC +cc: INFO-ITS @ MIT-MC, BUG-DDT @ MIT-MC + +You were right about cstacy's n patch being ridiculously +ungeneral. I talked him into something nicely general and +doesn't require users to be patching DDT in order to make use +of its full functionality. Under the new scheme, you say + + namen + +where name is the fn2 to give to DIR: and n is sixbit for the fn1 +to give. So, for example, + + UP434441644500 ;to get a CDATE UP listing + +gives you a CDATE UP listing. Also, the numeric arg is now sticky +(initially defaulting to 465162636400) so if you specify + + FOO or FOO0 + +you get the default. This was easy to put in since 0 didn't +designate a valid filename anyway. + +Here's hoping you're satisfied... + +Date: 5 January 1984 04:55 EST +From: Christopher C. Stacy +To: BUG-DDT @ MIT-MC +cc: INFO-ITS @ MIT-MC + +In DDT 1440 on MC: + +In a moment of randomness, I made a minor extension to DDT's $$^F +directory lister command, and tested and installed it on MC. + +$$^F (or $$0^F) does the same thing it always did. +$$1^F does the same thing too, except that you can now patch in a +total of three DIR arguments (starting at DIRFN1+2 and DIRFN2+2) and +do $$2^F and $$3^F. (In other words, $$n^F searches the two-word +entry table at DIRFN1 and uses the specified DIR names; the table is +currently 4 long, allowing you space for three numeric argument +options. An argument of zero is ignored.) + +I put this in because I wanted to use the DIR device more often. +The default listings you get now are these: + +foobar$$0^F DIR:NAME1 foobar +$$1^F DIR:NAME1 UP verbose directory listing +$$2^F DIR:CDATE DOWN sorted by recently created files +$$3^F DIR:SIZE DOWN sorted by biggest files + +Chris + +Date: Tuesday, 3 January 1984, 15:34-EST +From: Alan Bawden +Subject: Core Link documentation +To: INFO-ITS at MIT-MC + +By popular demand the file .INFO.;ITS CLO now contains brief documentation of +the Core Link device. + +Date: 31 December 1983 11:48 EST +From: Ken Harrenstien +Subject: TCP calls documented +To: BUG-NETWRK @ MIT-MC, INFO-ITS @ MIT-MC + +I have moved most of the TCP call documentation into MC:.INFO.;ITS .CALLS. +This includes all changes to existing calls, plus the new calls +TCPOPN and NETRFC. I have also copied various bit definitions into +SYSTEM;BITS > so that MIDAS and DDT will know about useful TCP symbols +as soon as a new ITS is assembled. + +Finally, I fixed the ANALYZE code in the NETWRK package (canonical +location MC:SYSENG;NETWRK >) so that the appropriate error strings can +be generated for TCP channels. + +Date: 17 November 1983 17:41 EST +From: Earl A. Killian +Subject: pdp11 +To: SHAWN @ MIT-MC +cc: INFO-ITS @ MIT-MC +In-reply-to: Msg of 17 Nov 1983 04:52 EST from Shawn F. McKay + + Date: 17 November 1983 04:52 EST + From: Shawn F. McKay + To: INFO-ITS + Re: pdp11 + + How good is the pdp-11 simulator? + + Thanks, + -Shawn +Good. + +Date: 17 November 1983 04:52 EST +From: Shawn F. McKay +Subject: pdp11 +To: INFO-ITS @ MIT-MC + + +How good is the pdp-11 simulator? + + Thanks, + -Shawn + + +Date: 17 July 1983 15:59 EDT +From: Alan Bawden +Subject: New .INSRTable library: FORMAT +To: INFO-ITS @ MIT-MC + +I have installed a new .INSRTable Midas library on all ITS machines. +FORMAT is patterned after the Lisp function of the same name. It's +documented in INFO with the rest of the insertable libraries. Do +:INFO LIB FORMAT to read all about it. + +There is no need to tell me I'm crazy. + \ No newline at end of file diff --git a/sysdoc/itstty.41 b/sysdoc/itstty.41 new file mode 100644 index 0000000..3ec4e38 --- /dev/null +++ b/sysdoc/itstty.41 @@ -0,0 +1,3588 @@ +-*-TEXT-*- +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + +File: ITSTTY Node: Top Next: A Up: (DIR) + +This file describes just about all there is to know about using and +programming TTYs (abbreviation for "Teletypes", for which read "consoles") +on the ITS operating system. + +* Menu: + +* Special: A Characters specially interpreted when typed on the tty. +* Control: B "Control of the tty". +* Opening: C Opening tty channels. +* Input: D Input from terminals. +* Output: E Output to terminals. +* More: F **MORE** processing. +* Vars: G Per-tty/per-job variables. +* Perm: H Permanent and semipermanent tty information. +* STYs: I Pseudo-teletypes (STYs). +* Smart: J The intelligent terminal protocol. +* SofTTYs: K Software ttys and ITS output buffer codes. + + +This is the complete table of contents for this file: + +A. CHARACTERS SPECIALLY INTERPRETED WHEN TYPED ON THE TTY. + 1. INTERRUPTING THE PROGRAM - THE CALL FUNCTION. + a. Deferred CALL. + 2. ENTERING STRANGE CHARACTERS - THE ESCAPE FUNCTION. + a. Quoting the Characters Used for CALL and ESCAPE. + b. "^_". + c. Supplying Meta-Bits on Non-TV's. + 3. MODE SETTING USING ESCAPE. + a. "^_M" - Complement **MORE** Processing (%TSMOR). + b. "^_^" - Complement Scroll-mode (%TSROL). + c. "^_""" - Complement Use of SAIL Character Set (%TSSAI). + d. "^_U" - Complement conversion to upper case (%TOCLC) + 4. COMMUNICATE MODE. + a. Entering a Com Link. + b. Querying. + c. Leaving a Com Link. + d. When the System Prints "^_N". + e. Input and Output Overrides. + f. Slaving Another Terminal. + g. Telling the System How to Respond to "^_C" Requests. + 5. LIST OF ESCAPE CODES. + +B. "CONTROL OF THE TTY". + 1. WHAT DETERMINES WHO HAS THE TTY. + 2. .ATTY AND .DTTY. + 3. PERMISSION TO TYPE OUT. + 4. THE .TTY VARIABLE. + 5. THE .CNSL VARIABLE. + +C. OPENING TTY CHANNELS. + 1. OPENING "TTY". + 2. OPENING "Tnm". + 3. DEVICE-DEPENDENT BITS IN THE OPEN MODE. + a. Per-channel Bits. + b. Other Per-channel Bits on Input. + c. Other Per-channel Bits on Output. + d. First-time Bits on Output. + e. First-time Bits on Input. + +D. INPUT FROM TERMINALS. + 1. ECHO. + 2. MAIN-PROGRAM INPUT. + 3. ACTIVATION. + 4. INPUT INTERRUPTS. + 5. THROWING AWAY TYPE-IN. + 6. TESTING FOR THE AVAILABILITY OF INPUT. + 7. .STATUS ON TTY INPUT CHANNELS. + 8. THE CHARACTER SET + +E. OUTPUT TO TERMINALS. + 1. HOW TO CAUSE CHARACTERS TO BE OUTPUT. + 2. NORMAL OUTPUT (SEQUENTIAL ACCESS). + a. How the System Goes about Outputting. + 1: ASCII Graphic Characters. + 2: "^G". + 3: Carriage-return. + 4: Linefeed. + 5: Tab. + 6: Control-L (Formfeed). + 7: Altmode. + 8: Control-P. + 9: Backspace. + 10: Random Control Characters, and Rubout. + b. Continuation - the Result of Line-overflow. + c. Wraparound and Scrolling - the Results of Page-overflow. + 1: Scrolling. + 2: Wraparound. + 3. DISPLAY-MODE CHANNELS. ^P-CODES. + 4. THE ECHO AREA. + a. How the Echo Area Works. + b. Creating an Echo Area. + 5. READING THE CURSOR POSITION. + 6. SUPERIMAGE OUTPUT. + 7. RELEVANT TTYOPT BITS. + 8. THROWING AWAY TYPEOUT. + 9. WAITING FOR OUTPUT TO BE SENT TO THE TERMINAL. + 10. .STATUS ON TTY OUTPUT CHANNELS. + +F. **MORE** PROCESSING. + 1. WHEN **MORE** PROCESSING IS TRIGGERED. + 2. HOW **MORE** PROCESSING OPERATES. + a. Stupid Programs. + b. Smart Programs. + 3. PROGRAMMED INVOCATION OF **MORE** PROCESSING. + 4. INHIBITION OF **MORE** PROCESSING BY INPUT. + +G. PER-TTY/PER-JOB VARIABLES. + 1. THE VARIABLES. + a. the TTYST1 and TTYST2 variables. + b. The TTYSTS variable. + c. The Size of the Echo Area. + 2. SYMBOLIC SYSTEM CALLS. + a. TTYGET - read TTYST1, TTYST2, TTYSTS. + b. TTYSET - set TTYST1, TTYST2, TTYSTS. + c. SCML - Set Number of Command Lines. + +H. PERMANENT AND SEMIPERMANENT TTY INFORMATION. + 1. THE VARIABLES. + a. The Screen Size. + b. The TTYOPT variable. + c. The TCTYP variable. + d. The TTYTYP variable. + e. The TTYCOM variable. + f. The TTYROL variable or "Scroll Count". + g. The TTYSMT variable. + 2. SYSTEM CALLS. + a. RSSIZE. + b. CNSGET. + c. CNSSET. + d. TTYVAR. + +I. PSEUDO-TELETYPES (STY'S). + 1. OPENING STY'S. + 2. OUTPUT TO STY'S. + a. What happens when the buffer is empty. + b. Interrupts. + c. RESET on sty output channels. + d. STATUS on sty output channels. + 3. INPUT FROM STY'S. + a. What happens when the buffer is empty. + b. Interrupts. + c. .STATUS on sty input channels. + d. .RESET on sty input channels. + 4. CLOSING STY'S. + 5. CONTROLLING THE TTY ASSOCIATED WITH A STY. + 6. DIRECT CONNECTIONS TO NETWORK CHANNELS: STYNET. + 7. STYGET. + +J. THE INTELLIGENT TERMINAL PROTOCOL. + 1. ESCAPE SEQUENCES. + 2. ALLOCATION. + 3. OUTPUT-RESET. + +K. SOFTWARE TTYS AND ITS OUTPUT BUFFER CODES. + 1. ITS OUTPUT BUFFER CODES. + 2. HANDLING %TDORS. + 3. THE SCPOS SYSTEM CALL. + +File: ITSTTY, Node: A, Previous: Top, Up: Top, Next: B + +A. CHARACTERS SPECIALLY INTERPRETED WHEN TYPED ON THE TTY. + +Normally, characters type on terminal keyboards have effect only +by being read and acted on by user programs. There are, however, +a few important exceptions. + +* Menu: + +* Interrupting: A/1 Interrupting the program - the CALL function +* Strange: A/2 Entering strange characters - the ESCAPE function +* Mode Setting: A/3 Mode setting using ESACPE +* Communicate: A/4 Communicate mode +* Escape Codes: A/5 List of ESCAPE codes + +File: ITSTTY, Node: A/1, Previous: A, Up: A, Next: A/2 + + 1. INTERRUPTING THE PROGRAM - THE CALL FUNCTION. + +A function available on all terminals that are in use as +consoles is to stop the current program and interrupt its +superior. On TV's, this function is requested by hitting the +"CALL" key; on other terminals, which have no "CALL" key, the +character "^Z" is used. This makes the character "^Z" difficult +to type in as a normal characters on such terminals, requiring +quoting (*Note Quoting: A/2.). + +In detail, the CALL function gives the job which owns the tty +(*Note TTY-owning: B.) a fatal interrupt, causing its superior in the +tree to be interrupted. The superior will usually react by retrieving +the terminal from the job that had posessed it. Thus, CALL makes it +possible to regain control when the program that has the terminal is +out of control. + +When the terminal is in super-image input mode (%TSSII is 1), +the CALL function is disabled - attempts to use it merely +generate input to the program. Programs should not lightly enter +this mode. + + a. Deferred CALL + +If you want to return from a program to DDT after the program is +finished, if you use ordinary CALL you must not type it until then. +And since DDT will flush all input when it sees the CALL, you can't +type anything else until you have seen DDT respond. + +The "deferred CALL", which you can type as Control-CALL on a TV or as +^_D on any terminal, does about the same thing that ordinary CALL does +except that it does not take effect until the program tries to read +it. It thus acts like an "exit" command in all programs. DDT +distinguishes deferred CALLs from ordinary ones (deferred ones give the +program a %PIDCL interrupt instead of a %PIC.Z), and does not throw +away input. Thus, you can type the deferred CALL ahead, and also some +DDT commands to follow it. + +File: ITSTTY, Node: A/2, Previous: A/1, Up: A, Next: A/3 + + 2. ENTERING STRANGE CHARACTERS - THE ESCAPE FUNCTION. + +The ESCAPE function is requested by typing "BACK-NEXT" on TV's. +This character is available as "^_" (control-underscore) on most +terminals which have no "BACK-NEXT" key; on Lisp Machine keyboards it +is labeled SCROLL or MACRO. + +The character used for the ESCAPE function is hard to type in, just as +the character used for the CALL function is. However, it provides a +mechanism that solves those problems. Note that the ITS ESCAPE +terminal function should not be confused with the "ESCAPE" key on TV +keyboards, which escapes all the way to the PDP-11 which handles the TV's. + +In the following, "^_" will designate the ESCAPE function, unless +otherwise stated, regardless of whether it is actually obtained by +the character "^_". + +* Menu: + +* Quoting: A/2/a Quoting the chars used for CALL and ESCAPE +* ^_: A/2/b +* Meta-bits: A/2/c Supplying Meta-Bits on Non-TV's + +File: ITSTTY, Node: A/2/a, Previous: A/2, Up: A/2, Next: A/2/b + + a. Quoting the Characters Used for CALL and ESCAPE. + +One of the uses of the ESCAPE function is to enter characters +that are not on the keyboard or otherwise hard to type in. The +characters used for the CALL and ESCAPE functions may be entered +as normal input by preceding them with an ESCAPE, which "quotes" +them. For example, on a non-TV, typing "^_^_" causes a single +"^_" to be read by the program, to interrupt if the program has +enabled interrupts, etc., and "^_^Z" does the same thing for +"^Z". + +File: ITSTTY, Node: A/2/b, Previous: A/2/a, Up: A/2, Next: A/2/c + + b. "^_". + +If the terminal's keyboard is missing a character, that +character may be entered by typing ESCAPE followed by the octal +numerical code for the character. The number may have any number +of digits, and is terminated by the first non-digit. If that +non-digit is a space, it is discarded; otherwise, it is taken +normally as input. The character entered as digits will be echoed +(if echoing of that character is turned on). Thus, "^_001 " +inputs a "^A" and echoes as "^_001^A", and "^_1q" enters "^Aq" +and echoes as "^_1^Aq". + +File: ITSTTY, Node: A/2/c, Previous: A/2/b, Up: A/2, Next: A/3 + + c. Supplying Meta-Bits on Non-TV's. + +It is possible to enter characters in the TV character set that are not in +ASCII, using the ESCAPE function followed by ^B, ^C, ^D, or ^F, followed by +the basic ASCII character. ^B means "set the CONTROL bit"; ^C, the META +bit; ^F, the SUPER bit; ^D, the TOP bit. Any combination of those four +characters should be followed by the basic ASCII character with which those +bits will be OR'ed. To specify one of those four control characters, or +^Q, as the basic ASCII character, quote it with ^Q. For example, "^_^B^C1" +specifies CONTROL-META-1. "^_^BA" is CONTROL-A, which has the code 301, +and is not the same as ^A (code 001). The TOP bit is useful for programs +(such as TECO) which distinuish SAIL graphics characters from CONTROL +characters. TECO treats an ASCII ^K as an alias for CONTROL-K, but ^_^D^K +(TOP-^K) is believed to be the SAIL character Uparrow. + +The reason that ^B and ^C stand for CONTROL and META is that +they correspond to the SAIL characters Alpha and Beta, which +are traditionally used for this purpose. + + +File: ITSTTY, Node: A/3, Previous: A/2, Up: A, Next: A/4 + + 3. MODE SETTING USING ESCAPE. + +Most of the switches that are associated with each terminal are +intended to be set or cleared by means of the TCTYP program. +However, there are two switches for which each job that can use the +terminal has its own setting. The TCTYP program may be used to set the +default values of the switches, which are used to initialize new jobs. +ESCAPE codes are provided for complementing the switch associated with +the job that the terminal belongs to at the moment. + + a. "^_M" - Complement **MORE** Processing (%TSMOR). + +When **MORE** processing is enabled, the system causes output to +pause at the bottom of the screen, until a space is typed. + + b. "^_^" - Complement Scroll-mode (%TSROL). + +When a terminal is in scroll mode, linefeeding past the bottom +of the screen causes everything on the screen to move up, +instead of wrapping around to write at the top of the screen. + + c. "^_""" - Complement Use of SAIL Character Set (%TSSAI). + +When %TSSAI is set, ascii mode and echo mode output of +non-formatting control characters will send the character +unmodified, assuming it to be a graphic character. Thus, "^B" +will echo as an alpha, etc., on terminals that can handle the +SAIL character set. + + d. "^_U" - Complement conversion to upper case (%TOCLC) + +When %TOCLC is set, characters typed at the terminal are converted +to uppercase. + +File: ITSTTY, Node: A/4, Previous: A/3, Up: A, Next: A/5 + + 4. COMMUNICATE MODE. + +It is possible for a group of terminals to be put in a "com +link". When that is done, anything typed on any one of the +terminals echoes on all of them. Normally, what is typed on a +terminal that is in a com link is ignored except for that +echoing, however the user may cause it to be treated as normal +input (see "^_I"). Also, programs are usually prohibited from +typing out while the tty is in a com link, but that may be +changed by the user (see "^_O"). It is also possible to cause +one of the terminals in a com link to supply input for and view +the output from another (see "^_S" and "^_E"). + +* Menu: + +* Entering: A/4/a Entering a COM link +* Querying: A/4/b +* Leaving: A/4/c Leaving a COM link +* ^_N: A/4/d When the system prints "^_N" +* Overrides: A/4/e Input and output overrides. "^_I" and "^_O". +* Slaving: A/4/f Slaving another terminal. "^_S" and "^_E". +* Respond: A/4/g Telling the system how to respond to "^_C" requests + +File: ITSTTY, Node: A/4/a, Previous: A/4, Up: A/4, Next: A/4/b + + a. Entering a Com Link. + +From any terminal, a com link with any other terminal may be +requested by means of "^_C", which should be followed by the +number of the terminal to be linked to, or by the uname of the +user logged in on that terminal. The name or number is terminated +by the first space or CR, except that any number of spaces or +CR's may follow right after the "C" and will be ignored. + +It is allowed for either the terminal on which "^_C" is typed or +the terminal to which a link is requested to be in a com link +already; in either case, if the request succeeds both of the +terminals and all the other terminals that had been linked to +either of them will form one com link. If there is no terminal +with the specified number, or no one is logged in with the +specified uname, the "^_C" will have no effect, and a "?" will +be typed. The same thing will happen if the specified terminal +is already in a com link with the requesting terminal. If the +specified terminal is in the middle of typing in an ESCAPE code, +or has characters unprocessed in its input buffer, the "^_C" +fails, typing "Busy". When that happens, it is reasonable to +try again in a few seconds. If the specified terminal's user +has ordered it ro refuse com links, with "^_R" +(it is in "refuse mode"), then "Refused" will be typed, and the +request will fail. If these conditions for "^_C" are met, the +request is basically acceptible, and what happens to it depends +on whether the specified terminal is in "accept mode" (the usual +case) or in "query mode". In accept mode, the two terminals will +be linked right away. If the target terminal is already in a com +link, a list of the terminals in that com link will be typed out +and the user will be asked whether he wants to "break in". An +answer other than "Y" or "y" will abort the request. In query +mode, the specified terminal must be asked whether the link +should be made - that process will be described later. + +Assuming that the specified terminal is in accept mode, and that +if necessary the user has decided to break in, then, the link +will be created, and the requesting terminal will be informed +that the request has succeeded by a "OK". "F" will be typed in +addition if the specified terminal is free. The "OK" tells the +requesting user that he is linked to the specified terminal, but +he may also be linked without knowing to other terminals already +linked to the specified terminal. Also, the other terminals in +the link at this point know nothing. Therefore, messages are +typed on the terminals as follows: on the specified terminal and +all terminals linked to it, the message "LINK FROM " will be typed, where the includes +the requesting terminal and all terminals linked to it, and a +terminal is referred to by its uname if it is a logged in +console, and as "Tnn" otherwise. Also, if there are other +terminals already linked to the requesting terminal, the message +"LINK TO " will be typed, naming the specified terminal +and any other terminals linked to it. Also, if the specified +terminal is already linked to others, the message +"LINK TO " naming only those others, and not the specified +terminal, will appear on the requesting terminal. The result of +all of those messages is that each terminal that ends up in the +new com link is informed of all the other terminals that it is +becoming linked to. + +File: ITSTTY, Node: A/4/b, Previous: A/4/a, Up: A/4, Next: A/4/c + + b. Querying. + +When the specified terminal is in query mode (*Note ^_Q: A/4/g.), +"QUERYING" is typed on the requesting terminal, and the "LINK FROM ..." +message is typed on the specified terminal only (NOT on the +terminals linked to it already), followed by "QUERYING", which +informs its user that he is being queried. He need not +pay immediate attention to the query, and his commands will +continue to go to his program. When he wishes to respond, +he may do "^_Y" to accept the link, "^_Z" to to refuse it, +"^_Q" to list the people querying, or "^_C" to a specific +user querying him. Such a "^_C" will always succeed +immediately, even if the target is in refuse mode or query mode, +as long as he is querying the "^_C"'er. This is how to +accept some but not all of several simultaneous queries. +When a query is accepted or rejected, "OK" or "REFUSED" will be +typed on the requesting terminal. Until that happens, +the requesting terminal may not do anything but "^_N" to give up +waiting, aborting the request, or ^G, which echoes on the terminal +being queried, to attract its user's attention. If "^_N" is +used to abort the request, the queried terminal is not informed. +If the request is accepted, "OK", the "LINK TO ..." messages and +the remaining "LINK FROM ..." messages are typed as they would +have been for accept mode. + +File: ITSTTY, Node: A/4/c, Previous: A/4/b, Up: A/4, Next: A/4/d + + c. Leaving a Com Link. + +Any terminal may be removed from a com link by typing "^_N" on it. +Also, any terminal in a com link may remove any of the other +terminals from that link by typing "^_K" followed by the uname or +number of the terminal to be unlinked (using the same syntax as +"^_C"). If there is only one terminal left in the com link, the link +is destroyed, and that terminal also returns to normal. Otherwise +the terminals remaining in the link continue to be linked, and +"BYE FROM " is typed on each of them. + +File: ITSTTY, Node: A/4/d, Previous: A/4/c, Up: A/4, Next: A/4/e + + d. When the System Prints "^_N". + +Whenever a terminal enters a com link, or makes a "^_C" request, +it is said to enter "com mode". That causes input not to be passed +to the program, and prevents programs from typing out (but see "^_I" +and "^_O"). This state persists until the terminal is no longer in +com mode. Therefore, the system informs the user that the terminal +has left com mode by typing "^_N" on the terminal, unless the +terminal has left com mode because the user has just typed "^_N" +on it (the idea is that if a "^_N" has just echoed there is no need +to supply another). + +File: ITSTTY, Node: A/4/e, Previous: A/4/d, Up: A/4, Next: A/4/f + + e. Input and Output Overrides. + +Normally, on a terminal in com mode input is not passed to the +program and programs may not type out (.IOT's hang). That can be +explicitly changed with "^_I" and "^_O". "^_O" complements the +%TCOCO switch which, if on, allows programs to output to the terminal +even when it is in com mode. %TCOCO is initialized to 0 whenever +a terminal is initialized (when it starts to be used after being +free for a while). DDT turns %TCOCO on temporarily when printing +unsolicited messages such as "ITS GOING DOWN". %TCOCO can be set +with :TCTYP OCO and cleared with :TCTYP NO OCO. +"^_I" complements the %TCICO switch which, if on, causes input to +be passed to the program even when in com mode, and also allows +programs to type out (just like %TCOCO). %TCICO is initialized +to 0 at the same time as %TCOCO, and may also be set with :TCTYP. +Note that when the switch is off all characters echo regardless of +what the program has requested, but when the switch is on, characters +echo or not just as they would when not in com mode, according to +the program's setting of the TTYST1 and TTYST2 variables. + +File: ITSTTY, Node: A/4/f, Previous: A/4/e, Up: A/4, Next: A/4/g + + f. Slaving Another Terminal. + +In any com link at any time one terminal may be slaved. That means +that those other terminals that wish to may supply input to the +program using the slaved terminal, and see the output typed on it. +(Actually, it isn't too hard to cause there to be two slaved +terminals in a link). Any terminal that is slaved will always see +program output, regardless of the setting of the "^_O" switch. +The "^_I" switch functions normally on slaved terminals. +Any terminal may explicitly slave any other terminal +linked to it, by means of "^_S", which has the same syntax as "^_C". +This automatically unslaves all terminals in the link other than +the one requested to be slaved. +Each terminal has a switch that determines whether input typed on +it should be sent to the slaved terminal in the link, if there is +one. This switch is complemented by "^_E", and initialized off when +com mode is entered. If there are exactly two terminals in the link, +typing "^_E" on one automatically does a "^_S" to the other. +Otherwise, both the "^_E" and the "^_S" must be done to get any +effect. If a terminal's "^_I" switch and its "^_E" switch are both +set, input from it will be fed to both its own programs and those of +the slaved terminal. That is, the two switches are independent. +Similarly, the "^_O" switch does not interact with the "^_E" switch. + +File: ITSTTY, Node: A/4/g, Previous: A/4/f, Up: A/4, Next: A/5 + + g. Telling the System How to Respond to "^_C" Requests. + +Any terminal may be in any one of three modes: accept mode, refuse +mode, and query mode. Accept mode is the default, and causes "^_C" +requests to succeed; refuse mode causes them to fail; query mode +causes them to query as described in section b. Accept mode may be +entered by typing "^_A"; refuse mode, by "^_R"; query mode, by "^_Q". +In addition, "^_A" accepts all pending queries, and "^_R" refuses them. +The program TCTYP also has the capability of changing the mode, using +the CNSSET system call. The information is stored in the bits %TCRFS +and %TCQRY in the TTYCOM variable (*Note Combits: H/1/e.). + +File: ITSTTY, Node: A/5, Previous: A/4, Up: A + + 5. LIST OF ESCAPE CODES. + +In most cases, the escape code name is also the name of a footnote +leading to a node containing more details on the specific code. + +^_^Z Program receives "^Z". No quitting action, etc. +^_^_ " " "^_". No special action +^_" Complement %TSSAI for the job which has the tty. + That flag, if 1, says that the SAIL character set should be + used for echo mode and ascii mode output. *Note ": E/2/a. +^_ + Enter the character whose ASCII code is . + *Note nnn: A/2/b. +^_A Set "accept mode". *Note A: A/4/g. +^_B Cause typeout to pause. *Note B: F/1. +^_C Communicate with another terminal. *Note C: A/4/a. +^_D Deferred Call. *Note D: A/1/a. +^_E Start or stop sending input to a slaved terminal. + *Note E: A/4/f. +^_I Complement the input override flag (%TCICO). *Note I: A/4/e. +^_J Give a %PIJST interrupt to the job that has the tty, or the closest + superior that has the interrupt enabled. +^_K Take some other terminal out of com link. *Note K: A/4/c. +^_L Clears the screen (echoes "^PC"). +^_M Complement **MORE** processing for job that has the tty. + *Note M: F/2. +^_N Leave com link or quit waiting for answer to query. + *Note N: A/4/c. +^_O Complement the output override flag (%TCOCO). *Note O: A/4/e. +^_Q Set "query mode" (%TCQRY). *Note Q: A/4/g. +^_R Set "refuse mode" (%TCRFS). *Note R: A/4/g. +^_S Slave a specified terminal. *Note S: A/4/f. +^_U Complement conversion of to upper case (%TOCLC). + *Note U: A/3/d. +^_Y Say yes to a query. *Note Y: A/4/b. +^_Z Say no to a query. *Note Z: A/4/b. +^_^ Complement scroll mode for job that has the tty. + *Note ^: A/3/b. +^_^U Clear input for this TTY. This completely flushes what + is in the input buffer and is useful for getting rid of + unwanted typeahead. + + +File: ITSTTY, Node: B, Previous: A, Up: Top, Next: C + +B. "CONTROL OF THE TTY". + +A terminal that is a console may be used by any of the jobs in +its tree, but not all at once. At any time, the terminal belongs +to a particular job, and for the most part only that job can use it. +Also, all input and output interrupts go to that job only. If +any other job in the tree tries to use the tty for anything except +to type out, it will not +succeed (it may wait until it is allowed to use the tty, it may +get an interrupt, or its system call may simply fail, depending +on what the job is doing and on the setting of some bits in .TTY, +described below). Permission to type out is controlled by a +separate mechanism. + +The job that is allowed to use the tty is said to "have control +of the tty", or to "have the tty". The .ATTY and .DTTY UUO's +allow control of the tty to be passed between the jobs in a +tree. + +* Menu: + +* Who Has: B/1 What determines who has the TTY +* ATTY: B/2 .ATTY and .DTTY +* Permission: B/3 Permission to type out +* .TTY: B/4 The .TTY variable +* .CNSL: B/5 The .CNSL variable + +File: ITSTTY, Node: B/1, Previous: B, Up: B, Next: B/2 + + 1. WHAT DETERMINES WHO HAS THE TTY. + +Each job has a variable - called .TTY, readable with a .SUSET or +.USET - that says, among other things, whether it wishes to retain +the tty or to pass it on to a particular one of its inferiors. +Each job can alter that setting at any time. The instantaneous +values of the .TTY variables of all the jobs in a tree determine +which of them has the tty, as follows: If the top level job wishes +to retain the tty, then it owns the tty; otherwise, if the one +inferior which it wishes to pass the tty on to wishes to retain +the tty, then that job owns the tty; otherwise the job that job +wishes to pass the tty on to has its chance, etc. In other words, +at any instant the tty is as far down as it can get before being +blocked from further descent by a job that wishes to retain it. + +File: ITSTTY, Node: B/2, Previous: B/1, Up: B, Next: B/3 + + 2. .ATTY AND .DTTY. + +.DTTY is used when a job decides that it wishes to retain the +tty. It skips if it succeeds; it fails if the job was already in +the state of wishing to retain the tty, +If the tty had actually belonged to some (possibly +indirect) inferior, it will belong after the .DTTY to the job +that executed it. + +The ATTY operation puts the job in the state of wishing to pass +control of the tty to one of its direct inferiors. This is known +as an "ATTY'ing state". If a job which is in an ATTY'ing state +is allowed ownership of the TTY by its superiors (ie, they too are +in ATTY'ing states pointing down to this job), then ownership +passes yet another level to the ATTY'd inferior. +Whenever an ATTY is done, the %TSATY bit will be set to 1 in TTYSTS, +and the inferior receiving the tty will be given a %PIATY +interrupt if it is enabled. + +The ATTY operation can be done with either the .ATTY UUO or the ATTY +symbolic system call. .ATTY , specifies the inferior open on +channel . The ATTY symbolic system call takes one argument, +a job spec, to specify the inferior to ATTY to. + +ATTY'ing is illegal for the job which has the tty, when the %TSLCZ +bit is set (meaning that the last char typed on the tty was "^Z"). +This is a half-hearted attempt to make it possible to "^Z" up +several levels past programs that are trying to prevent that. +Since super-image input mode now exists, such an attempt is futile. +This "feature" can probably be flushed if anyone wishes. + +The "P" command causes DDT to do an .ATTY, among other things. +"^P" does not. DDT does a .DTTY when an "P"'ed job returns to DDT. + +A job need not have the tty to do an .ATTY or .DTTY. In fact, they +are the only operations on ttys that work as well without the tty +as with it. + +File: ITSTTY, Node: B/3, Previous: B/2, Up: B, Next: B/4 + + 3. PERMISSION TO TYPE OUT. + +The job that owns the TTY, and the job at the top of the tree, +can always type out on the TTY. Those jobs can also grant +permission to some of their inferiors, which can in turn grant +it to their inferiors, and so on. Such indirect permission +is controlled by two bits in the .TTY variable of each job. +One bit, %TBOUT, is set by the superior to 1 to grant permission, or +to 0 to deny it, to the job whose %TBOUT bit it is. The other, +%TBINF, if set to 0, denies all inferiors permission to type out +without forgetting the states of their %TBOUT's. A job inherits +type-out permission from its superior only if its own %TBOUT and the +superior's %TBINF are both 1. A job has type-out permission iff a +chain of inheritance reaches up from it to the top of the tree or to +the job which owns the TTY. + +The DDT command ^P works by means of this feature. + +File: ITSTTY, Node: B/4, Previous: B/3, Up: B, Next: B/5 + + 4. THE .TTY VARIABLE. + +This variable is actually called TTYTBL in the system. +"%TB" and "$TB" identify bits and fields in the TTYTBL variable, +which contains the information on the status of a job +with respect to its console tty (if any). Note that it is not +necessary for a job to belong to a tree that has a tty for these +bits to make sense. The $TBECL field is actually a shadow location +for a per-tty/per-job variable; it only contains real information +when the job does NOT have the tty. + +Most of the fields are set only by the system, but %TBNVR and +%TBINT are user options, settable by .SUSET or .USET. They +decide what the job will do when it tries to use the tty, but +doesn't have it. + +%TBNOT==400000 ;4.9 1 iff the job does not have the tty. +%TBNVR==200000 ;4.8 1 => opens of TTY: should fail when + ;the job does not have the tty. +%TBINT==100000 ;4.7 1 => all attempts to use the tty when + ;the job doesn't have the tty, should cause class 2 + ;interrupts on bit 4.2 (%PJTTY) of the first interrupt word. + ;0 => such attempts wait until the job gets the tty. +%TBWAT==040000 ;4.6 1 => override the settings of %TBNVR and + ;%TBINT, and always wait for the TTY. This bit can + ;be set only by the job's superior, and means "you + ;are supposed to have the TTY, even though for a + ;short interval you may not really have it". +%TBDTY==010000 ;4.4 1 iff job doesn't have tty, but wishes + ;to retain it. Set by .DTTY, cleared by .ATTY. +%TBOUT==004000 ;4.3 1 => this job can inherit type-out permission + ;from its superior (can be altered only by superior). +%TBINF==002000 ;4.2 1 => inferiors are allowed to inherit type-out + ;permission from this job. +$TBECL==220600 ;3.1 - 3.6 the job's setting of the number of + ;lines in the echo area, if the job doesn't have + ;the tty. +RH: ;If the job has the tty, this is the tty number. + ;If the job is in an .ATTY'ed state, this has the + ;internal user index of the inferior the tty + ;should be passed on to. + ;Otherwise, 0. + +File: ITSTTY, Node: B/5, Previous: B/4, Up: B + + 5. THE .CNSL VARIABLE. + +If a program needs to know the number of its tree's tty (or of +some other job's tree's tty), it can get that information +without actually possessing the tty by reading the .CNSL +user variable. That variable contains the number of the +tree's tty if there is one; -1 for a job scheduled as part +of the system; -2 for a job scheduled as a disowned job. +for a job device or its inferior, .CNSL will be the same as +for the creator of the job device. + +File: ITSTTY, Node: C, Previous: B, Up: Top, Next: D + +C. OPENING TTY CHANNELS. + +Terminals may be opened for I-O using either device TTY: or device +Tnm:. TTY should be used by a job in a console-controlled tree to +open the console. Tnm should be used to open a terminal "as a +device" - that is, to open a tty that is not the console of the +job doing the opening. + +* Menu: + +* Opening: C/1 Opening "TTY:" and "Tmn:" +* Bits: C/3 Device-dependent bits in the OPEN mode + +File: ITSTTY, Node: C/1, Previous: C, Up: C, Next: C/3 + + 1. OPENING "TTY". + +Device TTY may only be successfully opened by a job in a console- +-controlled tree which is in posession of the tty. If a job which +does not meet that criterion tries to open the tty, the open may +hang, fail, or generate a fatal interrupt, depending on the setting +of the %TBNVR and %TBINT bits of the job (*Note NoTTY: B/3.). +What such an open will definitely not do is succeed. + + 2. OPENING "Tnm". + +Opening device Tnm is the way for a program to make use of a tty +other than its console (in fact, it need not have a console). +"nm" should be replaced by the two-digit octal number of the terminal +to be used. In order for the opening of device Tnm to succeed, +the specified terminal must not be in use by any other job. +An attempt to open by number a tty which happens to be the console +of the job doing the open will succeed iff the job has the tty at +the time. This is to make it possible to specify one's own tty when +asked to specify a tty by number. + +File: ITSTTY, Node: C/3, Previous: C/1, Up: C, Next: D + + 3. DEVICE-DEPENDENT BITS IN THE OPEN MODE. + +Many of the bits in the mode specified in a .OPEN have special +meanings for devices TTY and Tnm. Some of them affect only the +channel being opened; others merely initialize some of the per-tty/ +per-job information, but those bits are +effective only if the terminal is not open in the same direction on +any other channel (those bits exist for historical reasons only, +since the variables they set may be set explicitly at any time +using the TTYSET and SCML symbolic system calls (*Note vars: G.)). + +The per-channel bits which have names are used only to initialize +the IOCHNM word of the channel - thus, mode bit 4.6 (%TIECH) is +copied into bit 4.6 of the IOCHNM word. Various I-O operations +examine the IOCHNM word to decide what to do. With symbolic system +call IOT's, the user may temporarily alter the settings of those +bits, so the values supplied in the open are merely the defaults +for the channel. + +The per-channel bits that are not named are +interpreted by the OPEN routine, and act by setting some of the +named bits, as described below. They exist for historical reasons. +(that does not include bits 3.1 and 3.2, which are special). + +* Menu: + +* Bits: C/3/a Per-channel bits +* Other: C/3/b Other Per-channel bits on input and output +* First: C/3/d First-time bits on output and input + +File: ITSTTY, Node: C/3/a, Previous: C/3, Up: C/3, Next: C/3/b + + a. Per-channel Bits. + +3.1 1 => output; 0 => input. Affects the interpretation of the + other bits. +3.2 1 => block mode; 0 => unit mode. In block mode, each + character is treated as in unit mode, except that on output, + "^C" is ignored, and on input, "^C" typed in will act like + end-of-file (that is, the .IOT will return with the last + word padded out with "^C"'s and the pointer not fully + counted out). "^C" also terminates SIOT's on unit input + channels, but it is not ignored by output SIOT's. + +File: ITSTTY, Node: C/3/b, Previous: C/3/a, Up: C/3, Next: C/3/d + + b. Other Per-channel Bits on Input. + +%TIECH==40000 ;1 => can read even if char needs pi echoing. +%TIPEK==20000 ;1 => don't remove char from buffer. +%TIACT==4000 ;1 => don't wait for activation character. +%TIINT==2000 ;1 => can read a char even if it is supposed to interrupt & hasn't yet. +%TINWT==1000 ;1 => do not wait for input. If no input is available, + ;unit mode IOT's return -1; unit mode SIOT's and block mode + ;IOT's return without filling up the space available to them. +%TIFUL==400 ;1 => use the full TV character set if possible. + ;suppresses the conversion, which is normally + ;performed on TV's, from the TV character set + ;to ascii. See ITS TV. + + + c. Other Per-channel Bits on Output. + +3.4 1 => turn on %TJECH, %TJPP2, and %TJMOR. +3.5 1 => turn on %TJDIS. +3.6 1 => turn on %TJSIO. +%TJECH==40000 ;1 => echo mode output (all chars output the + ;way they would be echoed) +%TJCTN==20000 ;1 => don't do line-continuation. +%TJSTP==10000 ;1 => this channel is hung in **more**. + ;this bit is unusual in that the system changes it +%TJDIS==4000 ;1 => recognize "^P" as an escape for display commands +%TJSIO==2000 ;1 => superimage output, no padding or cursor control. +%TJMOR==1000 ;1 => don't do **MORE** processing. +%TJPP2==400 ;1 => output in the echo area if there is one. + +File: ITSTTY, Node: C/3/d, Previous: C/3/b, Up: C/3 + + d. First-time Bits on Output. + +3.3 1 => image mode (set all %TGIMG bits in TTYST1 and TTYST2) + If you think you want to do this, you probably + really want to use %TJSIO. + + e. First-time Bits on Input. + +3.3 1 => image mode (clear all %TGPIE and %TGMPE bits in TTYST1, TTYST2). + It is UNWISE TO USE THIS FEATURE, because it will prevent the + user from translating TTY: to a file of commands for your + program. You should use a TTYGET and TTYSET to change these + bits, and you should not complain if they fail. +3.4 1 => "DDT" (clear %TGPIE and %TGMPE bits for CR, LF and TAB) +3.6 1 => want 3 lines in echo area. + (that is, the OPEN should do a SCML with argument 3. + *Note SCML: E/4.). + +File: ITSTTY, Node: D, Previous: C, Up: Top, Next: E + +D. INPUT FROM TERMINALS. + +Characters typed on a terminal, aside from those that invoke the +CALL and ESCAPE functions, go into an input buffer from which +they may eventually be read by the program (if the buffer is +full, they are discarded, and a "^G" is output). Before being +read, they may be echoed (and usually will be). A character may +also cause an input interrupt - this allows specific characters +to signal a program to perform some action immediately, at any +time, without waiting for the program to get around to looking +for input. + +If %TOALT is set, and %TSALT is not, characters 175 and 176 will +be turned into 33 (this is "standardization of altmodes"). + +* Menu: + +* Echo: D/1 Echo +* MP Input: D/2 Main-program input. +* Activation: D/3 Activation. +* Interrupts: D/4 Input interrupts. +* Throw: D/5 Throwing away type-in. +* Avail: D/6 Testing for the availability of input. +* .STATUS: D/7 .STATUS on tty input channels. +* Char Set: D/8 The character set + +File: ITSTTY, Node: D/1, Previous: D, Up: D, Next: D/2 + + 1. ECHO. + +"Echoing" is the act of typing out whatever the user types in. +Its purpose is to give the user positive verification of his +type-in. On ITS, echoing works by taking the typed-in characters +and outputting them in echo mode, in the echo area if there is +one (that is, outputting with %TIECH and %TIPP2 set). There are +two types of echoing: PI echoing, and MP (main program) echoing. +PI echoing happens as soon as possible after the character is +typed in. MP echoing happens when the character is read in by +the program. Each program may specify which characters ought to +be PI echoed, and which ought to be MP echoed, using the +per-tty/per-job variables TTYST1 and TTYST2 (specifically, the +%TGPIE and %TGMPE bits, of each of which there is one for each +group). It is permitted to specify that a character not be echoed +at all, or that it be echoed in both ways (PI and MP). Most +programs specify that all characters be PI echoed, and none MP +echoed; DDT choses to have LF and TAB not echoed at all; some +programs such as TELNET and PDP11 in certain modes turn off all +echoing. MP echoing is not used much if at all, and is not +clearly useful, so it may be flushed in the future, although if +an important use is found it will stay. Therefore, new programs +should avoid using MP echo if possible. If use of it is +very desirable, please :BUG ITS the application. + +Normally, a character cannot be read in until any necessary +echoing has taken place. However, if reading is done with the +%TIECH bit set, any echoing (of the characters thus read) not +yet performed will be skipped entirely. This does not guarantee +that such characters will not be PI echoed; it just means that +the system will not regard the PI echoing as essential, and will +forgo it rather than wait for it. MP echoing will certainly not +be done for characters read with %TIECH set. Extra bits will be +returned with such characters saying what kinds of echoing were +appropriate but were not yet done, to enable the program to echo +the character itself if that is right. The bits are +%TXPIE=200000 saying PI echo was desired, and %TXMPE=400000 +saying MP echo was desired. + +The bit %TSNOE in the TTYSTS variable (*Note TTYSTS: G/1/b.), when set +to 1, causes echoing to be deferred; that is, echoing will not be +performed while the bit is set, but the system still remembers what +echoing is pending, and will again start doing it when %TSNOE becomes +0. However, if a character with pending echoing is read in while +%TSNOE is 1, the pending echoing will of necessity be forgotten. When +%TSNOE is 1, the system acts as if %TIECH were 1 on all input IOT's +from that tty, since otherwise such IOT's wuld simply wait forever. +In particular, the %TXPIE and %TXMPE bits in the character read will +tell the user what sorts of echoing were still pending. + + +File: ITSTTY, Node: D/2, Previous: D/1, Up: D, Next: D/3 + + 2. MAIN-PROGRAM INPUT. + +Characters are read from the tty using the .IOT UUO or the +symbolic system calls IOT or SIOT. +.IOT has slightly less overhead, but the symbolic system calls +allow the channel's characteristics to be temporarily altered. + +Unit mode IOT's read a single character and return it. SIOT's and +block mode IOT's try to read enough characters to fill the block +supplied, but the character "^C" will cause them to return what +has been read so far, with pointers and counts not fully advanced. +SIOT and block mode IOT input from ttys is relatively useless; +it is provided for the sake of device-independence. Programs +should normally read from the tty in unit mode. + +IOT'ing on the job's console cannot actually be done unless the +job has control of the console (*Note Owner: B.). If it does not, +either the IOT will wait until the job gets the tty, or a class 2 +interrupt will result, depending on the %TBINT and %TBWAT +bits in .TTY (*Note NoTTY: B/3.). +Also, on any tty, IOT's will wait until either the tty is +not in a com link, or the tty is slaved, or %TCICO is set +(*Note Com: A/4/e.). + +Input IOT's executed when the input buffer is empty will +normally wait until input is available (*Note Wait: D/3.). However, +if %TINWT is set, the IOT will not wait at all. Instead, unit mode +IOT's will immediately return -1; SIOT's and block mode IOT's +will return with the supplied block not completely filled +and the pointer and count advanced to point to the first +unfilled character or word. + +When an IOT attempts to read a character, if PI echoing is +necessary for the character and has not been performed, the IOT +waits until it has been (unless %TIECH is set, or %TSNOE is +set). Also, if the character is supposed to cause an input +interrupt, the IOT waits until the character has been processed +at interrupt level with .ITYIC (unless %TIINT is set or .PICLR +holds 0 preventing interrupts from occurring). In that case, the +interrupt will normally occur as soon as the IOT hangs up, and +if the interrupt routine dismisses normally, the IOT will then +be able to read the character. + +When any necessary PI echoing or interrupting is finished, the +IOT performs MP echoing if necessary and not yet done (unless +%TIECH is set, or %TSNOE is set). The character is then removed +from the input buffer and returned to the user (but if %TIPEK is +set, the character is left in the input buffer, so that the next +IOT will re-read it). If echoing that normally +would have been required before the IOT could return has been +omitted because of %TIECH or %TSNOE, the following extra bits +will be returned along with the character read (in unit mode +only): %TXPIE = 200000 meaning that PI echo would have been +done, and %TXMPE = 400000 meaning that MP echoing would have +been done. + +It is at this point, when the character is about to be returned +to the user, that conversion from the TV character set to ascii +is done unless the %TIFUL bit is set. This conversion happens on +all terminals but it has no effect on characters which are +already ascii,as all characters are if the terminal is not a TV. + +The way symbolic system call IOT's and SIOT's change the settings +of the per-channel bits is with the control-bit argument, which is +XOR'ed into the IOCHNM word at the beginning and end of the IOT. +Thus, if %TIACT is normally 0, and it is desired to read one +character with %TIACT set to 1, the following call may be used: + .CALL [ SETZ + 'IOT,, + 1000,,TYIC ;CHANNEL. + AC ;CHARACTER READ GOES IN AC. + 405000,,%TIACT] ;IMMEDIATE CONTROL-BIT ARGUMENT. + .VALUE + ... ;CHARACTER NOW IN AC. +Note that the IOT does not change the settings permanently; to +do that, the channel must be reopened. The specified bits are +changed only for the duration of the IOT that specifies them. + + +File: ITSTTY, Node: D/3, Previous: D/2, Up: D, Next: D/4 + + 3. ACTIVATION. + +An input IOT will, for an unclever program, unhang as soon as there +is any character to be read in. However, it may be known that a +particular program never needs to respond to type-in until a character +from some small set (such as CR and rubout; for TECO, altmode, +rubout and "^C") has been typed in. Such programs may lighten the +scheduling and swapping load on the system by saying that other +characters should not be "activation characters". Then an IOT will +usually not unhang unless at least one activation character +has been typed in. Note that no lossage will occur if a character +that need not activate does so. Also, some other conditions cause +activation. + +The set of activation characters is specified using the %TGACT bits +in the TTYST1 and TTYST2 variables. Initially, all of them are 1, +meaning that all characters should activate. + +A program may be able to get away with a small set of activation +characters except in a few special circumstances (for example, +TECO needs to be able to respond immediately to a "?" typed as +the first character when a command string is expected, but most of +the time a "?" requires no immediate response). The +program may then specify that small set for activation, and when +the unusual circumstances arise, it can do input in a special +way that does not wait for activation, either by IOT'ing with the +%TIACT bit set to 1, or by setting %TSACT to 1 before each character +is read. Both of those bits mean "activate on any character". Note +that %TSACT is cleared after each character, so setting it only +affects the next attempt to do input. %TIACT may be set temporarily +using a symbolic system call IOT. + + +File: ITSTTY, Node: D/4, Previous: D/3, Up: D, Next: D/5 + + 4. INPUT INTERRUPTS. + +A program may enable an interrupt to occur whenever a character +is typed in. In the simplest case, any character will cause an +interrupt, but the program may prevent uninteresting characters +from interrupting by clearing their %TGINT bits in TTYST1 and +TTYST2. There are two kinds of interrupts that may be enabled. +If the tty is a console, bit 1.1 (%PITYI) in the first interrupt +word may be enabled. This bit is obsolete and should be avoided. +For any tty, whether console or device, an interrupt may be enabled +on one of the input channels - in which case an interrupt will be +signaled on one and only one of the enabled channels. Both kinds +of interrupt are class 3. + +Most programs normally read their input at main program level, +and want only a few characters to be processed at interrupt level. +Such programs need to be able to examine the character which caused +the interrupt. IOT'ing it will not do, for other non-interrupting +characters may have been typed in before the interrupt character, +and not read yet at main program level. ITS provides a special +mechanism for doing this: .ITYIC, which reads the next +not-yet-.ITYIC'ed interrupt character. The program should execute +.ITYIC for each tty input interrupt to see what character caused it. +The calling sequence is: + MOVEI AC,CHANNEL + .ITYIC AC, + JRST GIVEUP ;PRETEND THIS INTERRUPT HADN'T HAPPENED. + ... ;CHARACTER NOW IN AC. +The .ITYIC will skip if it succeeds; it can fail if the channel +number is bad or does not have a tty open, if the tty is the job's +console but does not belong to this job at the moment, or because +no interrupt character is available. It can also cause a class 2 +interrupt if the %TBINT bit is set and the job does not have the +tty. + +.ITYIC is actually a special case of the WHYINT generic system call. +Doing a WHYINT on a TTY input channel will return %WYTYI as the first +value and the character which caused the interrupt as the second. +WHYINT was invented by generalizing .ITYIC to other sorts of devices. +Thus, .ITYIC is actually semi-obsolete, but everyone still uses it. + +The program should ignore any interrupt caused by a character +that isn't supposed to interrupt (due to timing screws and +moving the tty from one job to another that can happen). It +should also ignore an interrupt if the .ITYIC doesn't skip +(that can happen if DDT took the tty away and flushed the input +between the interrupting and the .ITYIC'ing). + +If the interrupt routine decides that it needs to examine the +next character also, it can set %TSINT to 1. That will cause the +following character to interrupt even if it normally wouldn't +(TECO uses this to distinguish a solitary altmode from a pair of +altmodes at interrupt level). This feature will work regardless +of whether that "following" character has already been typed in. + +.ITYIC'ing does not eliminate the need to IOT the character - it +is specifically designed not to interfere with the expected later +IOT'ing of the character. If the interrupt character is supposed +to have no effect except for the interrupt, then it must be +ignored explicitly when IOT'ed. Alternatively, the character can +be flushed explicitly from the input stream by using the TTYFLS +symbolic system call (see ITS .CALLS). + +It is not necessary for the interrupt handler to keep .ITYIC'ing +until no more characters are available, because a separate +interrupt will occur for each character that should cause one. + +An alternative to .ITYIC'ing at interrupt level and IOT'ing at +main program level, is IOT'ing at interrupt level. This works +reasonably as long as it is convenient for the program (for +example, PEEK does this). The program can even IOT the characters +at interrupt level and keep its own buffers for its main program +level if it wishes to. If the characters are +IOT'ed when they interrupt, there is no need to .ITYIC them. +However, all characters must be set to cause interrupts, or the +interrupts might get one off from the IOT's. + +File: ITSTTY, Node: D/5, Previous: D/4, Up: D, Next: D/6 + + 5. THROWING AWAY TYPE-IN. + +If a .RESET UUO or a RESET symbolic system call is done on a +tty input channel, any input in the input buffer will be thrown +away. If any of the characters being discarded has not echoed, +or has not interrupted, then it never will. + + +File: ITSTTY, Node: D/6, Previous: D/5, Up: D, Next: D/7 + + 6. TESTING FOR THE AVAILABILITY OF INPUT. + +A program may find out how much input is available using the UUO +.LISTEN or the symbolic system call LISTEN. Both wait for the +output buffer to empty, and then return the number of characters +in the input buffer (To check for input without waiting for output +to finish, use .STATUS - see below). +.LISTEN AC, applies only to the job's console, +and returns its value in AC. If the job has no console, or doesn't +have its console at the moment, 0 is returned. +The symbolic LISTEN call takes a tty +channel as an argument and returns a value in the usual way. +The call will fail if the channel number is bad, if the channel does +not have a tty open, or if the tty is the job's console but the +job doesn't own it at the moment. It will skip iff it succeeds. + .CALL [ SETZ + 'LISTEN + 1000,,CHANNEL + 402000,,FOO] ;PUTS # CHARS. IN FOO. + JRST NOTTY ;I WAS ^P'D BY DDT. + ... ;FOO NOW SET UP. + + +File: ITSTTY, Node: D/7, Previous: D/6, Up: D, Next: D/8 + + 7. .STATUS ON TTY INPUT CHANNELS. + +A .STATUS or symbolic system call STATUS executed on a tty +channel returns either 1 or 2 as the device type code - 2 if the +tty is a display with selective erase (%TOERS is set); 1, otherwise. +Bit 2.1 will be 1 iff the tty's input buffer is full; bit 2.2 will +be 1 iff the buffer is empty. Thus, .STATUS on an +input channel is a way of testing for the availability of input +without waiting for the output buffer to empty out. Bit 2.4 will be +1 if the job currently owns its console. Bit 2.5 will be 1 iff the +number of characters available for IOT'ing is different from the +number available for interrupt level processing (I am not sure why +this bit exists). Bit 2.8 will be 1 iff the terminal is located +next to the 340 display or one of its slaves (it will always be +0 except on the AI KA-10 machine). Bit 2.9 will be 1 iff the terminal +is "local" - that is, near the machine itself (only local ttys +are allowed to use the LPT directly, for example). + +File: ITSTTY, Node: D/8, Previous: D/7, Up: D + + 8. THE CHARACTER SET + +This section describes the 12-bit input character set. Terminals +with the %TOFCI TTYOPT bit set can generate all of these. Other +terminals can only generate the ascii subset. + +An input character consists of 7 bit of ascii character and 4 modifier +bits. Note that the ascii codes from 0-37, if generated by a +non-%TOFCI terminal, are control characters, but if generated +by a %TOFCI terminal are either special keys (like RETURN) +or are "SAIL" printing characters in which case they appear in +combination with %TXTOP. TECO ORDER has more information on this. + +The modifier bits are: + + %TXTOP Indicates that the TOP key was held down (usually). + Can also indicate some special characters (see below). + %TXCTL Indicates that the CTRL key was held down. + %TXMTA Indicates that the META key was held down. + %TXSUP Indicates that the SUPER key was held down. + (This used to mean that the SHIFT key was held down.) + +Numerically, %TXTOP=4000, %TXCTL=200, %TXMTA=400, and %TXSUP=1000. +%TXASC=177 is a mask for the 7-bit ascii basic character. + +Note that the TOP key also modifies the ascii character +code, but CTRL and META are simply added in. + +Some special keys are indicated by %TXTOP plus the ascii code for +a capital letter. These can also be combined with %TXCTL, %TXMTA and %TXSUP. + + %TXTOP+A ESCAPE. Note that the ESCAPE key is used to send commands + to the terminal controller (see ITS TV), so it cannot + be sent to the system except with CTRL or META. + %TXTOP+B BREAK. Recommended as the character for "getting out of" + programs where CALL is not what you want. + %TXTOP+C CLEAR. + %TXTOP+D circle-minus. An unassigned printing character key. + %TXTOP+E circle-plus. An unassigned printing character key. + %TXTOP+F delta. An unassigned printing character key. (shift circle-minus) + %TXTOP+G del. An unassigned printing character key. (shift circle-plus) + %TXTOP+H Help key (top H). Recommended for getting help. + This code is unusual in that it is passed to the + program as %TXTOP+H even when %TIFUL is not set. + %TXTOP+Z Internal code for deferred call. + +Other special keys, which generate codes in the ascii controls region +and without %TXTOP, are: + + 10 Backspace + 11 Tab + 12 Line + 13 VT + 14 Form (recommended for clear and redisplay the screen) + 15 Return (recommended for end of line) + 37 Back-next (used for input escape, *Note Escape: A.) + 33 Altmode + 177 Rubout (recommended for character deletion) + +Some of these have printed representations on output. Backspace, Tab, +Line, and Return are format effectors. Altmode is a printing character. + +File: ITSTTY, Node: E, Previous: D, Up: Top, Next: F + +E. OUTPUT TO TERMINALS. + +The most basic forms of I-O are oriented toward stream-like devices. +In fact, the ideal terminal is no longer a stream-like device but a +random-access device - a display. Ordinarily, access proceeds +sequentially using a pointer called the cursor. For more interesting +operations, a set of display commands are provided to move the cursor +or erase sections of the screen in ways independent of the hardware +characteristics of the particular display in use, as long as the +display has the ability to perform the specified function at all. +There are also bits in the TTYOPT variable, which may be read with the +CNSGET symbolic system call, that give information on which functions +the particular terminal can perform. + +* Menu: + +* Output: E/1 How to cause characters to be output. +* Normal: E/2 Normal output (sequential access). +* Display: E/3 Display-mode channels. ^P-codes. +* Echo: E/4 The echo area. +* Cursorpos: E/5 Reading the cursor position. +* Super: E/6 Superimage output. +* TTYOPT: E/7 Relevant TTYOPT bits. +* Flush: E/8 Throwing away typeout. +* Waiting: E/9 Waiting for output to be sent to the terminal. +* .STATUS: E/10 .STATUS on tty output channels. + +File: ITSTTY, Node: E/1, Previous: E, Up: E, Next: E/2 + + 1. HOW TO CAUSE CHARACTERS TO BE OUTPUT + +User programs output characters by means of the .IOT UUO or the +symbolic system calls IOT or SIOT. .IOT is pretty much equivalent to +symbolic IOT, but has slightly less overhead and is less flexible. +Display commands, which are several characters long, are output +by outputting in order the characters that compose them. +Unit mode channels may be used to output single characters with +IOT, or to output packed strings of characters with SIOT. +Since SIOT is much more efficient, commonly used programs or programs +doing much tty output should use it when possible. + +Block mode is semi-obsolete. On a block mode channel, IOT outputs +a block of words, containing 5 characters each. The character "^C" +is totally ignored, making it possible to output other than a +multiple of five characters. Block mode IOT's have no advantage over +SIOT's on unit mode channels. + +The symbolic system calls IOT and SIOT allow the respecification of +the values of several per-channel mode bits (all those given names +starting with "%TJ" - *Note Bits: C/3/c.). Unit mode IOT is somewhat +slower than the .IOT UUO, but the same is not true for SIOT and block +mode IOT. + +From now on, all three ways of outputting a character will be referred +as IOT'ing, since their differences have all been described above. + +If the terminal is in a com link, output IOT's will hang up, unless +%TCOCO (see "^_O") or %TCLFT (see "^_E") is set. If the tty is the job's +console, the IOT will not do its work unless the job has the +tty; otherwise it may wait or it may interrupt (*Note NoTTY: B/3.). + +File: ITSTTY, Node: E/2, Previous: E/1, Up: E, Next: E/3 + + 2. NORMAL OUTPUT (SEQUENTIAL ACCESS). + +The way terminal output works when display commands are not in use +is that each ordinary character is printed where the cursor points, +and advances the cursor over the positions that it occupies. +Formatting characters such as CR, LF, TAB and BS act by moving the +cursor in the appropriate way (that is, they are really display +commands). + +* Menu: + +* How: E/2/a How the System Goes about Outputting. +* Contin: E/2/b Continuation - the Result of Line-overflow. +* Wrap: E/2/c Wraparound and Scrolling - the Results of Page-overflow + +File: ITSTTY, Node: E/2/a, Previous: E/2, Up: E/2, Next: E/2/b + + a. How the System Goes about Outputting. + +The way the system outputs any particular character to the tty +depends in general on the following factors: whether the relevant +%TGIMG bit in the TTYST1 +or TTYST2 variable says that the character should be output in image +mode (this is the only way those bits have an effect), whether +the channel specifies output in echo mode, whether the terminal +can print the SAIL character set, and sometimes on random TTYSTS +bits. + +Note that we are thinking of flushing the %TGIMG bits in TTYST1 and +TTYST2. If that is done, all output will be done "in ASCII mode". If +you want the effects described below for image mode, you should +probably open a channel in superimage mode and use it at such times. + +* Menu: + +* Ascii: E/2/a/1 ASCII Graphic Characters. +* ^G: E/2/a/2 "^G". +* CR: E/2/a/3 Carriage-return. +* LF: E/2/a/4 Linefeed. +* Tab: E/2/a/5 Tab. +* ^L: E/2/a/6 Control-L (Formfeed). +* Altmode: E/2/a/7 Altmode. +* ^P: E/2/a/8 Control-P, the escape code. +* BS: E/2/a/9 Backspace. +* Random: E/2/a/10 Random Control Characters, and Rubout. + +File: ITSTTY, Node: E/2/a/1, Previous: E/2/a, Up: E/2/a, Next: E/2/a/2 + + 1: ASCII Graphic Characters. + +These characters are simply sent to the terminal. The system +assumes that they will occupy one printing position, and move +the terminal's hardware cursor one place to the right. + + +File: ITSTTY, Node: E/2/a/2, Previous: E/2/a/1, Up: E/2/a, Next: E/2/a/3 + + 2: "^G". + +"^G" is assumed to make a noise or other temporary indication, +occupy no space on the screen, and not move the cursor. + + +File: ITSTTY, Node: E/2/a/3, Previous: E/2/a/2, Up: E/2/a, Next: E/2/a/4 + + 3: Carriage-return. + +If the channel specifies echo mode, a "CRLF" will be done. +That is, the results will be the as if a CR and a LF had +been output in image mode. +Otherwise, if the TTYST2 variable specifies that CR is output +in ascii mode, a "CRLF" will be done just the same, except +that a bit will be set so that if the next character output +to the tty is a LF, it will be ignored. Thus, in ascii mode, +a CR without a LF is the same as a CR with one LF. +If CR is output in image mode, it moves the cursor to the +beginning of the line it was on. The line is not cleared. +However, this feature will eventually be flushed, so you should not +use it. Instead, simply output ^PH^H to do a "stray CR". In fact, +you can output all your CR's this way. For CR's which are not stray, +this will not cause any trouble, and for those which are stray, it +will cause the desired overprinting. + +File: ITSTTY, Node: E/2/a/4, Previous: E/2/a/3, Up: E/2/a, Next: E/2/a/5 + + 4: Linefeed. + +If a LF follows a CR that was output in ascii mode and not +in echo mode, the LF is ignored. Otherwise, the LF is output +in one standard way regardless of the settings of the several +variables (but it is best to have TTYST2 specify ascii mode +just in case image mode for LF ever means something). +The action of LF is normally to move the cursor down one line. +The horizontal cursor position is not changed by a LF. On +displays with selective erase (%TOERS is set) LF clears the +line it moves down to. The entire line is cleared even if +the horizontal position is not zero. +The bottom of the screen poses special problems for LF. +If the LF reaches the lowest line on the screen, it may +trigger **MORE** processing. If it starts from the bottom line +of the screen, it needs to wrap around or scroll (*Note Wrap: E/2/c.). + +File: ITSTTY, Node: E/2/a/5, Previous: E/2/a/4, Up: E/2/a, Next: E/2/a/6 + + 5: Tab. + +If the channel specifies echo mode or TTYST2 specifies ascii +mode, the tab causes the cursor to be moved rightward up to +the next multiple of eight spaces from the left margin, or +to the right margin if that comes first. If continuation is +not suppressed and the cursor starts out at the continuation +column, continuation will be done and then the tab will be +handled (note that when continuation is in effect, the right +margin is the continuation column). +If output is not in ascii mode or echo mode, a tab character +is sent to the tty, and assumed not to move the cursor. + +File: ITSTTY, Node: E/2/a/6, Previous: E/2/a/5, Up: E/2/a, Next: E/2/a/7 + + 6: Control-L (Formfeed). + +In echo mode, "^L" will normally echo as a clear screen +("^PC"). However, on printing ttys (ttys whose %TOMVU is off) +or if the program has set %TSCLE (Control-L Echo) "^L" will +echo like other random control characters (*Note Ctl: E/2/a/10.). +Not in echo mode, "^L" is treated like other random +control characters. + +File: ITSTTY, Node: E/2/a/7, Previous: E/2/a/6, Up: E/2/a, Next: E/2/a/8 + + 7: Altmode. + +If the TTYST2 variable says that altmode should be output in +ascii mode, or if the channel specifies echo mode, then +normally a dollar-sign will be sent, but if the %TOSAI bit in +the TTYOPT variable, which means "ASCII mode should use the +SAIL character set" is on, an altmode will be sent (it comes +out as a diamond on the screen). In either case the cursor +moves one position. +If output is in image mode and not in echo mode, an altmode +will be sent to the terminal. It will be assumed not to move +the cursor unless %TOSAI is set, meaning "the terminal +understands the SAIL character set", in which case it will +be assumed to move the cursor one space right. + +File: ITSTTY, Node: E/2/a/8, Previous: E/2/a/7, Up: E/2/a, Next: E/2/a/9 + + 8: Control-P. + +"^P" is output like most other control characters (*Note Ctl: E/2/a/10.). +However, on a channel open in display mode, "^P" serves as +an escape prefix for display commands. In order to output +a "^P" using such a channel, the display command "^PP" must +be used. + +File: ITSTTY, Node: E/2/a/9, Previous: E/2/a/8, Up: E/2/a, Next: E/2/a/10 + + 9: Backspace. + +In echo mode on a terminal which can't backspace, "^H" echoes +as uparrow-H. +Otherwise, if in column 0, backspace does nothing. +Otherwise, on an IMLAC, backspace sends a backspace, and +assumes the cursor moves back one position. On other types +of terminals, backspace simply moves the cursor back one +position. + +File: ITSTTY, Node: E/2/a/10, Previous: E/2/a/9, Up: E/2/a + + 10: Random Control Characters, and Rubout. + +If TTYST1 specifies ascii mode for these characters, or +the channel specifies echo mode, then a control character +will be sent as an uparrow followed by the appropriate +graphic character (thus, "^A" as "^" followed by "A"), +unless %TSSAI is set, in which case the control character +itself will be sent, and the system will expect it to be +a graphic that moves the cursor one position. +If %TSSAI is 0 but %TOSAI is set, then a SAIL uparrow will +be used instead of a "^" when typing the "^A". +If not in ascii mode or echo mode, the control character +itself will be sent, and the system will expect it not to +move the cursor, unless %TOSAI is set, in which case it +will be expected to move the cursor one space right. +Note that this is just like the treatment of altmode +except for the details of the conversion in the case +of ascii or echo mode with %TSSAI not set. + +File: ITSTTY, Node: E/2/b, Previous: E/2/a, Up: E/2, Next: E/2/c + + b. Continuation - the Result of Line-overflow. + +When typeout attempts to go past the right margin, the +system inserts a "!" and a CRLF to make sure that output +is not lost. The last printing position on each line is +normally reserved for the "!" printed when continuation +is done, and the line size of the terminal as specified +in or returned by system calls does not count that column. +The act of continuation takes place when an attempt is made +to output a character and the cursor is pointing at the +reserved continuation column; the "!" and CRLF are output, +followed by the character that provoked the continuation +(which will be in the next line). +Continuation may be suppressed by opening a channel with the +%TICTN bit set; then characters output on that channel will +never provoke continuation no matter where the cursor points. +The continuation column is available for use by the program. + +The display codes ^PX and ^PB "understand" continuation to some +extent. See their descriptions. + +File: ITSTTY, Node: E/2/c, Previous: E/2/b, Up: E/2 + + c. Wraparound and Scrolling - the Results of Page-overflow. + +When an attempt is made to linefeed past the bottom line of +the screen, either the cursor wraps around or the screen scrolls +up. Which one happens depends on whether the terminal is in +scroll mode, as determined by the setting of %TSROL. That bit +is stored per-tty/per-job, and may be set by the program with +TTYSET, and complemented by the user with "^_^". Its value +is initialized from %TOROL in each job separately. %TOROL is +initialized whenever a tty begins to be used. The initial +value is 0 except on the dynamod machine. %TOROL may be set +with a CNSSET, or by the TCTYP program. + +The echo area cursor never causes scrolling. Whenever it reaches +the bottom of the screen it wraps around to the top of the echo +area, regardless of the setting of %TSROL. + +* Menu: + +* Scrolling: E/2/c/1 +* Wraparound: E/2/c/2 + +File: ITSTTY, Node: E/2/c/1, Previous: E/2/c, Up: E/2/c, Next: E/2/c/2 + + 1: Scrolling. + +Scrolling moves the contents of the screen up several lines +(the number depends on the type of terminal) and then linefeeds +normally. Only some types of terminals can scroll; others will +always wrap around even if scroll mode is on. + +File: ITSTTY, Node: E/2/c/2, Previous: E/2/c/1, Up: E/2/c + + 2: Wraparound. + +On displays that can erase selectively, wraparound simply +puts the cursor on the top line, clearing it. +On Tektronix-like displays (those which can't erase selectively), +wrapaound clears the screen, since it can't clear only the +top line. Because this is necessary, **MORE** processing is +less likely to be suppressed on such terminals. +Wraparound does take place on printing ttys, but it is +indistinguishable from ordinary linefeed. + +File: ITSTTY, Node: E/3, Previous: E/2, Up: E, Next: E/4 + + 3. DISPLAY-MODE CHANNELS. ^P-CODES. + +It would be impossible to output a display command using a channel +which simply printed any character sent out on it. If it is desired +to make use of display commands, a channel may be opened in display +mode. That causes the character "^P" to be an escape character when +output on that channel. When a "^P" is output on a display-mode +channel, it has no effect except for setting bits causing the next +character output on that channel to be interpreted as a display code. +The display codes are: + +A Advance to a fresh line. If at beginning of line do nothing, + else act like a CRLF. +B move Backward. Decrements the horizontal position. + If the horizontal position is 0, it is set to the horizontal + screen size minus two, and the vertical position is decreased + by one. Thus, it moves back over one character position even + if there was a line continuation in the way. +C Clear screen. The cursor goes to the upper left corner and + the whole screen is cleared. On a printing tty (%TOMVU is 0) + a CRLF is output, since "clearing the screen" is undefined. + If "^PC" is output to the echo area, only the echo area is + cleared, and only the echo area cursor is moved. +D move Down. The vertical position is incremented. If it becomes + equal to the vertical screen size, it is set to 0. +E clear to Eof. The remainder of the current line, and all lower + lines, are erased. The cursor doesn't move. +F move Forward. The horizontal position is incremented. At the + end of the line it wraps around to the beginning of the + next line. +H set Horizontal position. Takes one argument: the following + character should be the desired horizontal position setting + plus 8. The vertical position is not changed. An attempt to + set the position beyond a margin will position it at the + margin. +I Outputs a one-position printing character in image mode. Takes one + argument: the numeric ASCII code of the desired character. +K Kill (erase) the character the cursor points at. The cursor + does not move. The position erased is the one that would be + written in next by ordinary output. +L clear Line. The current line, starting with the position that + the cursor points at, is erased. The cursor does not move. +M (More) hang up until a character is read in. *Note More: F/3. +N (No home-up) similar, but don't home up after the character is + read. +P output "^P". Useful if it is desired to output "^P" in image + mode with a display-mode channel, or if the terminal handles + the SAIL character set. +Q output "^C". Similar to "^PP". This is needed only for block + mode IOT's. With SIOT, it is not needed since "^C" isn't special. +R Restore cursor position. The cursor is set to the most + recently saved value. +S Save cursor position. Remembers the current cursor position + for use with "^PR". There is no stack for saved cursor + positions; only the most recent saved position is remembered. +T go to Top of screen (home up). The cursor is positioned at the + upper left corner of the screen. +U move Up. The vertical position is decremented. If it was 0, + it becomes equal to the vertical size minus one. +V set Vertical position. Takes the following character as an + argument - it should be 8 plus the desired vertical position. + An attempt to set the cursor beyond the top or bottom margin + will position it as far as allowed in the desired direction. + Similarly, "^PV" will not move the echo area cursor outside + the echo area. Note that vertical positions in the echo area + are to be specified relative to the top of the echo area. +X backspace and erase one character ("^PB" followed by "^PK"). + If done at column zero, it clears the last TWO characters on + the previous line (assuming that one of them was the + character you intended to erase, and the other was an "!" + indicating a continuation). +Z home down. The cursor is positioned at the lower left corner. +[ insert line. The current line and all lines below it are + pushed down one slot. A blank line appears at the current + position. The cursor does not move. Works only on terminals + which have %TOLID set (^P\ also). +\ delete line. The current line disappears, and all teh lines + below it move up by one position. The bottom line becomes + blank. The cursor does not move. +] obsolete - same as "^PL". +^ insert character. All the characters after the cursor move + right one position. The last one moves off the right margin + and disappears. A space appears at the cursor, which does not + move. Works only on terminals which have %TOCID set. +_ delete character. The character at the cursor disappears, and + all the rest of the characters on the line move left one + position. A space appears at the end of the line. The cursor + does not move. + +File: ITSTTY, Node: E/4, Previous: E/3, Up: E, Next: E/5 + + 4. THE ECHO AREA. + +Normally there is only one cursor, used by all output, including +echoing, and visible always on the screen. However, the program may +create an "echo area", which means that there will be two cursors: +one acting just like the normal one, and used for most program +output; the other, restricted to a few lines at the bottom of the +screen, and used for all echoing (and by program output that +specifically requests it). +The terminal will show whichever cursor was used most recently. + +The normal cursor is known as the "main-program cursor"; the other, as +the "echo area cursor". + +* Menu: + +* How: E/4/a How the Echo Area Works. +* Creating: E/4/b Creating an Echo Area. + +File: ITSTTY, Node: E/4/a, Previous: E/4, Up: E/4, Next: E/4/b + + a. How the Echo Area Works. + +One of the per-tty/per-job variables in the system is the size of the +echo area. This variable is 0 iff there is no echo area; this is the +usual case, and all output (including echo) uses the main program +cursor. If the variable isn't 0, it must be positive and less than the +screen height; that many lines at the bottom of the screen become the +echo area. Ordinary output using the main program cursor is not +affected by the existence of the echo area, but output done with the +%TIPP2 bit set (and this includes all system echoing), will use the +echo area cursor. This cursor is restricted to the echo area; ^P-codes +and wraparound for this cursor act as if the top of the screen were +really located at the top of the echo area (the ^P-codes mention how +they treat the echoing cursor if that is special). Scrolling never +happens to the echo area cursor. **MORE** processing can happen, +just as with the main program cursor, and completely independently, +but all system echoing is done with %TIMOR set to prevent that. + +File: ITSTTY, Node: E/4/b, Previous: E/4/a, Up: E/4 + + b. Creating an Echo Area. + +When a job is created it has no echo area on its console. When a tty +in use as a device is first opened, it has no echo area. The size of +the echo area may be changed (and, in particular, an echo area may be +created or destroyed) with the SCML symbolic system call, described +in section G.3.c. Also, one of the first-time-only bits in the mode +of the tty input OPEN allows creation of a 3-line echo area. + +File: ITSTTY, Node: E/5, Previous: E/4, Up: E, Next: E/6 + + 5. READING THE CURSOR POSITION. + +The symbolic system call RCPOS returns to the program the values +of the cursor positions of both the main-program area and the +echo area. Each cursor position is returned as a single word +consisting of the vertical position in the left half and the +horizontal position in the right half. The first value is the +main program area cursor; the second, the echo area cursor. The +echo area cursor position is returned relative to the top of the +echo area. *Note TTY Spec: G/2. for a description of the options +for the first argument and the reasons why the call can fail. +RCPOS does not require ownership of the terminal, just output +permission (*Note Permit: B/3.). For example: + .CALL [ SETZ + SIXBIT/RCPOS/ + 1000,,CHANNEL + 2000,,MPPOS ;MP ARE POSITION GOES IN MPPOS. + 402000,,ECHPOS] ;ECHO AREA POSITION GOES IN + ;ECHPOS. + .VALUE ;CALL FAILED. + ... ;CALL SUCCEEDED. + +File: ITSTTY, Node: E/6, Previous: E/5, Up: E, Next: E/7 + + 6. SUPERIMAGE OUTPUT. + +When %TISIO is 1, output is done in superimage mode. That means that +no padding will be done, and the system will not do cursor positioning +or attempt to keep track of where the cursor is; every character +IOT'ed will be sent without change. In addition, ITS output buffer +display commands may be sent directly, rather than via ^P-codes +(*Note SUPDUP: K/1). This mode is useful when output is +being done to a strange device that is connected to the system via a +tty line (for example, a logo music box or a PDP11 running the +absolute loader), and when the output has already been put into the +correct form for the particular type of tty (for example, the TELNET +program has a mode that assumes that the foreign host has handled +such things). It is also useful for programs which do +cursor-position updating, line continuation, etc., themselves, +and want to save time by stopping ITS from doing them. + +To be efficient, use SIOT. Block mode IOT will ignore +"^C", which may be embarrassing. + +If the characters output in superimage mode will move the cursor, +the SCPOS system call must be used to tell ITS about it. +*Note SCPOS: K/3. + +File: ITSTTY, Node: E/7, Previous: E/6, Up: E, Next: E/8 + + 7. RELEVANT TTYOPT BITS. + +%TOERS says that the tty can erase selectively. If this bit is not +set, "^PL", and "^PE" cannot be used. "^PX" and "^PK" will work +anyway, if %TOOVR is off, since then ITS knows it can use a space +to erase a single character. + +%TOMVU says that the tty can move its cursor up. If this bit is not +set, the tty is a printing terminal. Any attempt to erase will have no +effect. Horizontal and downward cursor motion will work but not upward +motion. For the sake of those programs that wish to know about +displays only to the extent of clearing the screen on them every so +often, "^PC" on a printing terminal comes out as a CRLF. + +%TOOVR says that the tty can overstrike characters successfully. The +effect of attempted overstriking on a terminal that can't handle it is +undefined, but on a datapoints what will happen is that only the last +character printed in a given position will be visible. Note that +outputting a space character will erase iff the terminal cannot +overstrike. Space should be output only when attempted overstriking is +generally desired - for example, when copying out of a file. If +erasing is specifically desired, "^PK" should be used (or "^PK^PF" = +move forward, erasing). If it is specifically desired not to erase, +"^PF" should be used. For "printing terminals" (or rather, terminals +on which no cursor motion characters except ASCII format effectors +are known) which lack %TOOVR, some cursor motion optimizations are not +done (for example, moving backward can be done only by backspacing, +since CR'ing and spacing forward might erase something useful). + +%TOMVB, if 0, means that the terminal can't backspace. This is true +only of teletypes. The system will simulate a backspace with a CR and +spaces, but, since that is so slow, backspace should be avoided on such +terminals. For that reason, it echoes as uparrow-H rather than as a +backspace. + +%TOSAI, if 1, says that control characters sent to the terminal will +be one-position graphic characters. The system will assume that +control characters output in image mode move the cursor one space +right. Also, altmode will be output as itself, rather than as a +dollarsign, even in ascii or echo mode (but the same is not true of +random control characters, which check %TSSAI). + +%TORAW, if 1, says that the various cursor motion characters (space, +tab, CR, LF, and BS) should be output to the terminal in the same +order the program gave them to the system, and in the same way, if +possible. This bit does not effect the padding done to CR, LF and TAB, +and will not prevent the system from simulating BS and TAB on tty's +that require such simulation. It will prevent the system from combining +several cursor motion characters to produce their effect more +efficiently; for example, CR's at the beginning of the line will +be ignored when %TORAW is 0, but when it is 1, they will cause CR to +be sent. Also, CR followed by spaces will always be output in that +manner even if backspacing would be faster. +This bit is normally set by the TELNET server except when the foreign +host is a tip, for the sake +of terminals that don't even always handle CR and LF correctly, but +do manage to handle the sequence CR-LF correctly, etc. + +File: ITSTTY, Node: E/8, Previous: E/7, Up: E, Next: E/9 + + 8. THROWING AWAY TYPEOUT. + +Many programs have interrupt characters for requesting that some +output be discarded. Normally they set flags telling the program not +to output anything. But on slow terminals the text already in the +output buffer will take an annoyingly long time to come out. For +that reason, the .RESET UUO and the RESET symbolic system call when +used on slow terminals (those for which %TPORS is 1) throw away the +text in the output buffer. On fast terminals that is not done. + +On all terminals, an output RESET restores the state of several bits +associated with the channel it is given on to normal. For example, +if the RESET took place after an interrupt out from the middle of +typing out a ^P-code, the RESET will cause the next output character +to be treated normally rather than as a display code. If the channel +had been hung in a **MORE** (*Note More: F/2/a.) it will be unhung. + +File: ITSTTY, Node: E/9, Previous: E/8, Up: E, Next: E/10 + + 9. WAITING FOR OUTPUT TO BE SENT TO THE TERMINAL. + +The symbolic system call FINISH may be used to wait until +the output buffer is empty, meaning that all characters +output by the program have actually been sent to the terminal. +The call's only argument is a tty output channel number: + .CALL [ SETZ + SIXBIT/FINISH/ + 401000,,CHTTYO] + .LOSE %LSFIL ;CALL FAILS?? +FINISH does not require ownership of the terminal; just output +permission (*Note Permit: B/3.). + +File: ITSTTY, Node: E/10, Previous: E/9, Up: E + + 10. .STATUS ON TTY OUTPUT CHANNELS. + +The information returned as the STATUS of an output channel resembles +that returned for an input channel except that bits 2.1 and 2.2 refer +to the output buffer rather than the input buffer, and bits 2.5, 2.8 +and 2.9 are not returned with any information. *Note In-status: D/7. + +File: ITSTTY, Node: F, Previous: E, Up: Top, Next: G + +F. **MORE** PROCESSING. + +This feature, when enabled, causes typeout to pause at certain +times (for example, at the bottom of the screen). +Certain events (such as reaching the last line on the screen) +trigger a **MORE** by setting the %TFEOP bit. Once that has +happened, the next attempt to output a character will cause +the program to be interrupted if it is clever, or cause the +system to wait for the user to order typeout to proceed if the +program is not clever. + +* Menu: + +* When: F/1 When **MORE** processing is triggered. +* How: F/2 How **MORE** processing operates. +* Programmed: F/3 Programmed invocation of **MORE** processing. +* Inhibition: F/4 Inhibition of **MORE** processing by input. + +File: ITSTTY, Node: F/1, Previous: F, Up: F, Next: F/2 + + 1. WHEN **MORE** PROCESSING IS TRIGGERED. + +The main occasion for triggering is .IOT'ing a LF that reaches +the last line of the screen. However, triggering has complicated +conditions: it will not happen if %TSMOR is set (%TSMOR's meaning +is "disable **MORE** processing, and this is how it functions); +in scroll mode triggering may not occur until the results of the +previous triggering have scrolled to the top of the screen, or a +home-up ("^PT" or "^PC") has happened. Note that printing terminals +usually have the screen height set to 200000,, , but wrap around +at line 118., so linefeed will never trigger. However, if the +screen height of a printing terminal is set to a small value, +**MORE** processing will take place. + +The user may trigger a **MORE** whenever he wishes to stop output +temporarily, by typing "^_B". %TSMOR does not +inhibit this, and scroll mode does not affect it. + +File: ITSTTY, Node: F/2, Previous: F/1, Up: F, Next: F/3 + + 2. HOW **MORE** PROCESSING OPERATES. + +Once one of the events described above has triggered it, **MORE** +processing will happen at the next attempt to .IOT a character +out to the terminal, except for output done with %TIMOR set to 1. +The details differ depending on how clever the program wishes to be. + +* Menu: + +* Stupid: F/2/a Stupid Programs. +* Smart: F/2/b Smart Programs. + +File: ITSTTY, Node: F/2/a, Previous: F/2, Up: F/2, Next: F/2/b + + a. Stupid Programs. + +If the tty channel being used for the output IOT that caused +**MORE** processing to occur, is not enabled to interrupt, +("**MORE**-interrupts are not enabled"), the +system assumes that the program is not clever, and tries to +handle the condition itself, telling the user that there is +more output, and waiting for his command to go ahead and print it. +Before handling the +.IOT'ed character, "**MORE**" is typed out, and the system reads a +character from the ordinary input stream. Output will resume, +starting with the character whose .IOT'ing was put off to do the +**MORE**, as soon as a character is available to be read. The input +character will not be thrown away, however, unless it is a space +(that is, if it is not a space, it will remain for the program to +read eventually). The system will supply a home-up so that output +will resume on the top line of the screen (which, on an Tektronix or +other display without selective erase, requires clearing the screen). + +While the system is waiting for an input character, it is actually +hung in the .IOT on the output channel. The terminal's variables are +not in abnormal state, except for that channel, and .RESET will return +the channel to normal. Thus, if the character typed in response to the +"**MORE**" is an interrupt character, the interrupt will happen +normally, and if it is dismissed without side-effect, the system will +continue waiting for a character to tell it to proceed. But if the +interrupt character tells the program to .RESET its output and await a +new command, that will do the right thing. Also, when a program is +"hung in a **MORE**", if the TTY is taken away by its superior and +then given back, its state will be unchanged, although the superior +will have had no trouble outputting to it (and might even have done +**MORE** processing). + +File: ITSTTY, Node: F/2/b, Previous: F/2/a, Up: F/2 + + b. Smart Programs. + +If the TTY output channel being used for output when **MORE** +processing becomes necessary is enabled for interrupts, the +system will signal an interrupt on it, and wipe its hands +of the matter. It is up to the program to pause, or whatever +is desired. It is a convention that smart programs that +provide the user with the ability to "flush" the rest of +the typeout should type "--MORE--" instead of "**MORE**". +One algorithm for handling **MORE** interrupts might be: +optionally set %TSNOE, type out "--MORE--", do a FLUSH to wait +for the "--MORE--" to come out, then read a character with +%TIPEK and %TIACT set. At this point, depending on the character, +the routine may gobble it by IOT'ing it again without %TIPEK. +Then, the routine may either flush by typing out a message such +as "flushed", clearing %TSNOE if it was set, re-enabling interrupts +and returning to a restart point, or it may proceed by clearing %TSNOE +and dismissing the interrupt. The purpose of using %TSNOE here +is to prevent the character typed at the "--MORE--" from echoing +in case it is to cause flushing but not be gobbled - the idea is +that it will echo LATER, when it is re-used as normal input. + +Programs which handle **MORE**-interrupts should not .IOT a control +character expecting it to be printed as an uparrow and a printing +character, because that will lose if a **MORE**-interrupt comes +between the two. + +File: ITSTTY, Node: F/3, Previous: F/2, Up: F, Next: F/4 + + 3. PROGRAMMED INVOCATION OF **MORE** PROCESSING. + +The two display commands "^PM" and "^PN" cause the channel they are +output on to enter the same state that a channel is in after the +system has typed "**MORE**" through it - namely, waiting for a +character to be read in before outputting any more. Those commands are +not affected by enabling of **MORE**-interrupts - that is, these +commands issued by even a clever program will enter the state the is +normally entered only for stupid programs. "^PN" is unusual in that +after the character has been read in, only a linefeed will be done, +instead of a home-up. + +File: ITSTTY, Node: F/4, Previous: F/3, Up: F + + 4. INHIBITION OF **MORE** PROCESSING BY INPUT. + +When the program waits for input, triggering of **MORE** processing +is inhibited for a while. This is so that a program which is giving +short replies to commands typed in will not do **MORE**'ing, which in +those circumstances would probably be a nuisance. The details of the +inhibition vary; in scroll mode triggering is inhibited until the +place the cursor was when the program waited for input scrolls to the +top of the screen; otherwise, inhibition takes place the very next +time the bottom is reached, but only if the waiting occurred in the +bottom 5 lines of the screen. In any case, if a home-up (or +clear-screen) intervenes, there is no inhibition. +It is not the typing of input or the reading of input that inhibits, +but the waiting for input, for the following reasons: if typing ahead +inhibited triggering, it would be impossible to type ahead to a +**MORE**; if reading typed-ahead input inhibited triggering, it would +be possible to lose by typing ahead commands that produced a +surprisingly large amount of input. + +File: ITSTTY, Node: G, Previous: F, Up: Top, Next: H + +G. PER-TTY/PER-JOB VARIABLES. + +Some of the variables which exist for a tty are intended to +describe the tty to the system or user; others are intended as +program-settable options. Of those, there are some that are +per-channel, and others that are not, either for historical +reasons, because they are too large to fit in the space that +each channel has for variables, or because they are used by +the input interrupt routine (at input interrupt time it is not +known which channel will be used to read the character). +These variables are maintained per-tty/per-job, which means +that for a tty in use as a device, there is one setting of the +variables, under the control of the job that has the tty open, +but for a tty that is a console, each job in the tree controlled +by the tty may set the variables independently. The values +actually in effect at any time are those set by the program which +has the tty at that time. The .ATTY and .DTTY UUO's that transfer +the tty from one job to another in the tree automatically save +the values set by the job that is losing control of the tty, and +restore the per-tty/per-job variables from the last settings made +by the job that is gaining control of the tty. When a job does +not have the tty, its settings may be examined with the .TTY, +.TTST, .TTS1 and .TTS2 .USET variables. + +The variables for a tty which is in use as a device are +initialized when the tty is opened. Each job's copies of the +variables for its console tty are initialized when the job is +created. That latter initialization simply copies the job's +superior's settings of the variables, except for the %TSMOR, +%TSROL and %TSSAI bits, which are copied from the appropriate +TTYOPT bits. The size of the echo area is always initialized to +0 for each new job or tty. Note that the first input tty open +and the first output tty open will, between them, re-initialize +all of TTYST1 and TTYST2. + +There exist symbolic system calls for reading and setting these +variables. As usual, the calls to read them may be done to any +tty, specified by number, while the calls to set them require a +channel, and thus may be done only to a tty under the control of +the job. Some of these variables are set by the first-time bits +in the open-mode for tty opens. + +* Menu: + +* Variables: G/1 The variables. +* Calls: G/2 Symbolic system calls. + +File: ITSTTY, Node: G/1, Previous: G, Up: G, Next: G/2 + + 1. THE VARIABLES. + +* Menu: + +* ST1&2: G/1/a The TTYST1 and TTYST2 variables. +* STS: G/1/b The TTYSTS variable. +* Size: G/1/c The Size of the Echo Area. + +File: ITSTTY, Node: G/1/a, Previous: G/1, Up: G/1, Next: G/1/b + + a. the TTYST1 and TTYST2 variables. + +These variables contain the information on which characters +should be echoed, and how; on which characters should activate +(cause an .IOT to unhang), and which should interrupt (all this +is used at input interrupt time). Also, they contain the +information on which characters are to be output in image mode. +A job that does not possess its console has its TTYST1 and TTYST2 +settings for the console kept in the .USET variables .TTS1 and .TTS2. + +These words are divided into 6-bit bytes, one for each character +group. All of the options for the characters in any group are +located in the byte for that group, as follows: +%TGINT==1 ;1 => characters in this group should interrupt. + ;*Note Int: D/4. +%TGACT==2 ;1 => characters in this group should activate. + ;*Note Act: D/3. +%TGSPC==4 ;1 => perform special hack. The meaning of this bit + ;depends on which character-group is in question. + ;Right now it is defined only for group 1 (letters) + ;and means "convert lower case to upper case). +%TGIMG==10 ;1 => output the characters of this group in image mode. + ;*Note Image: E/2. for the consequences of setting this bit. + ;It is likely that this feature will be flushed soon, + ;since it cannot be made to work right with the $$^P + ;feature that allows several jobs to type out at once +%TGPIE==20 ;1 => echo these characters at interrupt level. + ;*Note Echo: D/1. +%TGMPE==40 ;1 => echo them at main program level + ;(that is, when they are .IOT'ed in). *Note Echo: D/1. + +The characters are divided into groups based on the ascii code. +TV characters are assigned to groups by converting them to ascii +(thus, the meta bit is ignored, and the control bit is ignored +except with letters, which are converted into ascii control characters). +The groups of characters are: +Group 0: "^@" - "^F", "^K", "^L", "^N" - "^R", "^T" - "^Z", "^\" - "^^". + (in otherwords, random control characters). +Group 1: Letters (both upper and lower case). +Group 2: Digits. +Group 3: !"#$%&',.:;?@\`|~ (random graphics). +Group 4: *+-/=^_ (operators) +Group 5: <>[](){} (brackets). +Group 6: "^G" "^S" (most commonly used interrupt chars). +Group 7: LF, TAB. +Group 10: Altmode. +Group 11: CR. +Group 12: Rubout. +Group 13: Space and BS. + +File: ITSTTY, Node: G/1/b, Previous: G/1/a, Up: G/1, Next: G/1/c + + b. The TTYSTS variable. + +This variable contains many historical relics, as well as information +used to control interrupt level actions, and to signal the user program. +The prefix "%TS" is used for bits in the TTYSTS variable. When a job +does not possess its console, its TTYSTS setting for the console may +be found in its .TTST variable. + +%TSFRE==400000 ;4.9 1 => tty is free (not in use as device or console) +%TSCLE==200000 ;4.8 1 => "^L" output in echo mode should always come + ;out as uparrow-L. (Normally, "^L" echoes as a clear + ;screen on displays). +%TSHDX==100000 ;4.7 same as %TOHDX. This is vestigial. +%TSFCO==040000 ;4.6 1 => use the full 12-bit TV character set for + ;output and echoing. The control bit outputs as "^A" + ;or "alpha", the meta bit outputs as "^B" or "beta", and + ;the super bit outputs as "^F" or "epsilon". + ;Also, the top bit is used to distinguish ASCII control + ;characters from Sail graphic characters. The main value + ;of this feature is for its effect on echoing. +%TSALT==020000 ;4.5 1 => don't standardize altmodes. +%TSROL==010000 ;4.4 1 => scroll mode is in effect. + ;Complemented by "^_"""". +%TSSAI==004000 ;4.3 1 => echo and ascii output should use SAIL chars. + ;Complemented by "^_^". +%TSACT==002000 ;4.2 1 => next input IOT shouldn't wait for an + ;activation character to have been typed in. +%TSNEA==001000 ;4.1 => Don't echo in echo area; echo in M.P. area. +%TSINT==000400 ;3.9 1 => next input character should interrupt even + ;if its %TGINT bit doesn't say it should. +%TSMOR==000200 ;3.8 1 => inhibit **MORE** processing. + ;Complemented by "^_M". +%TSATY==000100 ;3.7 this bit is set whenever an .ATTY executed by a + ;superior gives the tty to the job. It is what TECO + ;uses to know that it should clear the screen before + ;the next display. + ;3.6-3.5 unused. +%TSNOE==000010 ;3.4 1 => defer echoing (*Note Echo: D/1.). +%TSLCZ==000004 ;3.3 1 => the last character typed in was "^Z". + ;If this bit is 1, .ATTY fails (*Note ATTY: B/2.). +%TSSII==000002 ;3.2 1 => superimage input. The special treatment of + ;"^Z" and "^_" is suppressed. +%TSCNS==000001 ;3.1 1 => the tty is a console (not a device). + +RH: ;the user-index of the job that owns the tty, or -1 + ;if the tty is free. The actual system variable has + ;the user-index in its internal form but TTYGET + ;returns it in external form (=internal form + ;divided by LUBLK). + + +File: ITSTTY, Node: G/1/c, Previous: G/1/b, Up: G/1 + + c. The Size of the Echo Area. + +The vertical size of the echo area is a per-tty/per-job +variable. *Note Echo area: E/4. + +File: ITSTTY, Node: G/2, Previous: G/1, Up: G + + 2. SYMBOLIC SYSTEM CALLS. + +These system calls all take, as the first argument, a tty-specifier +which tells the system which tty's variables are to be read or written. +The tty specifier should either be a channel number, on which a tty +or pseudoteletype should be open (in the latter case, the variables +of the tty which is the alter ego of the sty will be accessed), or be +400000 plus the number of the desired tty (this option is allowed only +for calls that do not alter the variables. It enables a program to +read the variables of a tty which is in use by a different job). + +An invalid tty specifier will cause the call to fail with an +open-failure code such as "NO SUCH DEVICE" or "BAD CHANNEL NUMBER". + +If the job specifies its console, but it doesn't possess the console +at the time, the call will wait until the tty is given back by the +superiors. + +* Menu: + +* Get: G/2/a TTYGET - read TTYST1, TTYST2, TTYSTS. +* Set: G/2/b TTYSET - set TTYST1, TTYST2, TTYSTS. +* SCML: G/2/c SCML - Set Number of Command Lines. + +File: ITSTTY, Node: G/2/a, Previous: G/2, Up: G/2, Next: G/2/b + + a. TTYGET - read TTYST1, TTYST2, TTYSTS. + +The TTYGET symbolic system call takes one argument, which specifies +the tty whose variables are to be read, and returns up to five +values, which are the TTYST1, TTYST2, TTYSTS, TTYTYP and TCTYP +variables of that tty, as set by the job which has control of that +tty at the time the system call is executed. The argument should be +as described above. + +Actually, the right half of the third value returned is the user +index in its external form, rather than its system-internal form, +which is what the right half of the TTYSTS variable in the system +really holds (The internal form is the external form times LUBLK, +a symbol defined in the timesharing system. The external form is +more useful to user programs - all interfaces with the system +expect the external form, .USET of .UIND returns it, etc.). + +As an example, suppose TTYNUM contains the number of a tty whose +variables are to be read. The following code will read the TTYST1, +TTYST2 and TTYSTS respectively into ST1, ST2, and STS: + MOVE A,TTYNUM + .CALL [ SETZ + 'TTYGET + 1000,,400000(A) ;Immediate arg = 400000+ + 2000,,ST1 ;1st value returned in ST1. + 2000,,ST2 + 402000,,STS] ;Sign bit marks end of call. + JRST TRANSL ;User must have translated TTY to a file. + ... ;ST1, ST2, STS now set up. + +Note that the TTYGET call can fail quite legitimately, if the +user translates device TTY: to a file of commands for the program. +Therefore, you should not naively put a .VALUE or a .LOSE after +a TTYGET, but instead write code to assume that a command file +is being used and do the "appropriate" thing. + +File: ITSTTY, Node: G/2/b, Previous: G/2/a, Up: G/2, Next: G/2/c + + b. TTYSET - set TTYST1, TTYST2, TTYSTS. + +The TTYSET symbolic system call takes either three or four +arguments. The first specifies the tty (TTYSET, like the other +calls that alter tty variables, do not allow a tty to be specified +by number). The second and third arguments are used to set the +TTYST1 and TTYST2 variables. The fourth, if present, sets the +TTYSTS variable (if there are only three arguments, the TTYSTS +variables is not changed). The bits %TSFRE, %TSHDX, %TSLCZ and +%TSCNS, as well as the right half of TTYSTS, cannot be changed. +If the %TSINT (the next character should interrupt whatever it is) +bit is turned on, and there is a character in the input buffer +already following the last one that has been .ITYIC'ed, that +character will be made into an interrupt character if it wasn't +already one. +For example, if the desired values of the variables are contained +in ST1, ST1+1, and STS, the variables may be set as follows +(This isn't the simplest way; it is meant to illustrate the +flexibility of the symbolic system call): + MOVEI A,ST1 + .CALL [ SETZ + 'TTYSET + 1000,,TYIC ;Immediate arg = tty channel. + (A) ;Set TTYST1 from ST1 + 1(A) ;Set TTYST2 from ST1+1 + 400000,,STS] ;Set TTYSTS from STS + JRST TRANSL ;User must have translated TTY to a file. + ... ;Variables now set. + +Most of the time, when TTYSET is used, only a few of the bits +are intended to be changed. Rather than giving the TTYSET +constant arguments, which is tantamount to making baseless +assumptions about the meanings of the other bits, you should +read in the current values with a TTYGET, change only the bits +you want to change, and then write out the result. + + +File: ITSTTY, Node: G/2/c, Previous: G/2/b, Up: G/2 + + c. SCML - Set Number of Command Lines. + +SCML takes two arguments: a tty channel number, and the desired +size of the echo area. For example, to have 4 echo lines: + .CALL [ SETZ + SIXBIT/SCML/ ;Note 'SCML is right-justified, and won't do. + 1000,,TYIC ;Immediate arg = tty channel + 401000,,4] ;Immediate arg = <# command lines>. + JRST TRANSL ;User must have translated TTY to a file. + ... ;Echo area now set up. + +Before attempting to do a SCML, you should verify that the +terminal being used is a display and not a printing terminal. +You should also check for the possibility that TTY was translated +to a file. + +File: ITSTTY, Node: H, Previous: G, Up: Top, Next: I + +H. PERMANENT AND SEMIPERMANENT TTY INFORMATION. + +The permanent information on a tty describes the characteristics +of the particular type of terminal in use and the line it is connected +to. The semipermanent information consists of several user-settable +bits controlling system options; they are all reinitialized whenever +a free tty begins to be used. Also, when a TV or a tty on a dialup line +is freed, the permanent information is reinitialized. When an STY is +opened after being free its alter ego is similarly reinitialized. + +* Menu: + +* Variables: H/1 The variables. +* Calls: H/2 System calls. + +File: ITSTTY, Node: H/1, Previous: H, Up: H, Next: H/2 + + 1. THE VARIABLES. + +* Menu: + +* Size: H/1/a The Screen Size. +* TTYOPT: H/1/b The TTYOPT variable. +* TCTYP: H/1/c The TCTYP variable. +* TTYTYP: H/1/d The TTYTYP variable. +* TTYCOM: H/1/e The TTYCOM Variable. +* TTYROL: H/1/f The TTYROL variable or "Scroll Count". +* TTYSMT: H/1/g The TTYSMT variable. Says what sort of + CPU the terminal is, and to what extent + it supports graphics. + +File: ITSTTY, Node: H/1/a, Previous: H/1, Up: H/1, Next: H/1/b + + a. The Screen Size. + +The horizontal screen size is the number of character positions on a +line, not including the column normally used for "!"'s produced by +line continuation. The vertical screen size is the number of lines +on the screen. For printing ttys on which **MORE** processing should +never be done, it is 200000,, . If the screen height on a printing +tty is set to a small value (less than 118.), **MORE** processing will +be done if enabled (this is for the sake of terminals which are +physically displays, but which are being operated as printing terminals +because ITS does not know how to send display operations to them). + +Programs which make their output depend on the screen size will be +totally screwed when the user detaches and reattaches on a different +terminal, unless they are specially hacked to recover. Such programs +should either enable the %PIATY interrupt, or test %TSATY in the +TTYSTS variable regularly, since if the user switches terminal type +for any reason those conditions will certainly be signaled. When the +interrupt happens or %TSATY is seen, the program should read the +screen size and TTYOPT once again from the system and take appropriate +actions if they have changed. + +In the system, the horizontal size plus 1 is stored in the TCMXH +variable, and the vertical size is stored in the TCMXV variable. + +File: ITSTTY, Node: H/1/b, Previous: H/1/a, Up: H/1, Next: H/1/c + + b. The TTYOPT variable. + +This variable holds the rest of the information on the particular +tty in use: what capabilities it has, and what special treatment it +needs. Also it holds several user options: %TOMOR, %TOROL, %TOSA1 +and %TOCLC. Programs that base their actions on the value of the +value of the TTYOPT variable should provide for the possibility that +the user changes his terminal type. They should either test %TSATY in +the TTYSTS variable frequently, or enable %PIATY interrupts. When the +chosen condition is detected, the program should the re-examine the +value of TTYOPT. + +"%TO" signifies a bit in the left half of TTYOPT. "%TP" signifies a +bit in the right half; "$TP", a byte pointer to a field. + +%TOALT==200000 ;4.8 => Standardize altmodes. +%TOCLC==100000 ;4.7 => Convert lower case to upper on input. +%TOERS==40000 ;4.6 => This tty can erase selectively +%TOHDX==20000 ;4.5 => This tty is half-duplex. +%TOMVB==10000 ;4.4 => This tty can handle backspaces directly. +%TOSAI==4000 ;4.3 => This tty can handle the SAIL character + ;set, if given control characters in image mode. +%TOSA1==2000 ;4.2 => use the SAIL character set for echo and + ;ascii mode output (actually just init %TSSAI of + ;new jobs). +%TOOVR==1000 ;4.1 => This tty can overprint successfully. +%TOMVU==400 ;3.9 => This tty can move its cursor upward + ;(that is, it is a display). +%TOMOR==200 ;3.8 => do **MORE** processing on this tty + ;(actually just used to init %TSMOR for new jobs). +%TOROL==100 ;3.7 similarly, used to init %TSROL for new jobs. +%TORAW==40 ;3.6 => don't optimize cursor motion (*Note Out: E/7.). +%TOLWR==20 ;3.5 => this tty has lower case keyboard. + ;(Doesn't affect system actions - exists to + ;tell user programs what to do). +%TOFCI==10 ;3.4 => this tty's keyboard has full TV character set. +%TOIML==4 ;3.3 => this tty acts like an imlac +%TOLID==2 ;3.2 => this tty can insert/delete lines. +%TOCID==1 ;3.1 => thus tty can insert/delete characters. +$TPPLF==170300 ;3-bit field saying how to pad LF. + ;0 - don't. 1 - memowreck, 2741 (2 pad chars.). 2 - more. + ;If a terminet, tells the baud rate. +$TPPCR==140300 ;3-bit field saying how to pad CR. + ;7 - unused. 6 - memowreck. 5 - 2741. 4 - execuport. + ;0 - don't. 1 - normal. 2 - double. + ;On datapoints, number of padding characters desired + ;before each string of cursor motion commands. +$TPPTB==110300 ;3 bit field saying how much padding needed after tab. + ;0 => tabs not allowed; else 1 +<# padding chars needed> + ;On displays: 0 don't use tabs, 1 use tabs, + ;2 use VT52-style absolute positioning. +%TPMTA==400 ;1.9 => treat bit 1.8 of input characters as the meta bit. + ;This is for terminals such as Telerays which have Edit keys. +%TPPRN==200 ;1.8 => interchange ( with [, and ) with ], on input. +%TPTEL==100 ;1.7 => Treat CRLF input as CR for TELNET protocol. +%TPCBS==40 ;1.6 => intelligent terminal protocol in use. + ; *Note ITP: J. +%TP11T==20 ;1.5 => PDP-11 TV tty. Reflects %TY11T. + ;not settable by user. +%TPORS==10 ;1.4 => output reset on this tty should really do something. +%TPRSC==4 ;1.3 => this terminal implements %TDRSU and %TDRSD. + ;These are commands usable in superimage output + ;which perform region scrolling. *Note RSC: K/1. + +File: ITSTTY, Node: H/1/c, Previous: H/1/b, Up: H/1, Next: H/1/d + + c. The TCTYP variable. + +It tells the system what type of display codes the terminal actually +needs. The system takes the display commands that are output by +programs and converts them into whatever will accomplish the desired +result on the particular type of tty in use, according to the setting +of the TCTYP variable. User programs should try to avoid looking at +this variable; use TTYOPT instead. + +The possible values are: + +%TNPRT==0 ;printing terminal. +%TNDP==1 ;good datapoint. +%TNODP==2 ;"bad" datapoint or "loser". +%TNIML==3 ;IMLAC. +%TNTEK==4 ;Tektronix 4000 series. +%TNTV==5 ;PDP-11 TV. +%TNMEM==6 ;Memowreck. +%TNSFW==7 ;"software" terminal that expects internal ITS + ;display commands ("SUPDUP" codes). + ; *Note SUPDUP: I/3/e. +%TNTRM==10 ;Terminet. +%TNESC==11 ;Display using ASCII standard display codes. +%TNDTM==12 ;A Datamedia 2500. +%TNRAY==13 ;Teleray 1061 +%TNHDS==14 ;Concept-100 +%TNH19==15 ;H19 +%TNAAA==16 ;Ann Arbor Ambassador + +File: ITSTTY, Node: H/1/d, Previous: H/1/c, Up: H/1, Next: H/1/e + + d. The TTYTYP variable. + +This variable contains the information on the line the tty is +connected to, as opposed to the tty itself. Most of the fields in +the TTYTYP table cannot be set with a system call. The exceptions +are the input and output speed codes, which can be as the +ISPEED and OSPEED variables with TTYVAR. + +"%TT" signifies a bit in the left half of TTYTYP; "$TT", a byte +pointer to a field. "%TY" signifies a bit in the right half. + +%TTLCL==400000 ;BIT 4.9 ONE => LOCAL TTY +%TT340==200000 ;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE +%TT3HP==100000 ;BIT 4.7 HIGH PRIORITY ON 340 +%TTPAR==004000 ;BIT 4.3 TTY needs to have parity sent. +%TTDDI==002000 ;BIT 4.2 DONT DING ON EXCESS INPUT +%TTIBM==001000 ;BIT 4.1 DATEL LINE +$TTISP==260400 ;3.8-3.5 INPUT SPEED CODE +$TTOSP==220400 ;3.4-3.1 OUTPUT SPEED CODE +%TYDPK==400000 ;BIT 2.9 => this tty is on a datapoint controller line. +%TYSTY==200000 ;BIT 2.8 => this tty is the alter ego of an STY. +%TYNVA==100000 ;BIT 2.7 => this tty is a NOVA tty (They no longer exist) +%TYMTY==040000 ;BIT 2.6 => this tty is on a Morton controller line. +%TYDIL==020000 ;BIT 2.5 => this tty is on a dial-up line. +%TY11T==010000 ;BIT 2.4 => this tty is a PDP-11 TV. +%TYDL== 004000 ;BIT 2.3 => this tty is on a DC76 line. +%TYOTY==002000 ;BIT 2.2 => this tty is a KA-10 console tty. +%TYETY==001000 ;BIT 2.1 => this tty is a DTE-20 tty. +%TYNTY==000400 ;BIT 1.9 => this tty is a TK-10 tty. +%TYMDM==000200 ;BIT 1.8 => this tty is on a dial-up line with modem control. +%TYKST==000100 ;BIT 1.7 => this tty is a KS-10 console tty. +%TYDZT==000040 ;BIT 1.6 => this tty is a DZ-11 tty on a KS-10. +%TYRLM==000020 ;BIT 1.5 => this tty is a connected to the ROLM data switch. + +The meanings of the possible 4-bit speed codes are: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + +File: ITSTTY, Node: H/1/e, Previous: H/1/d, Up: H/1, Next: H/1/f + + e. The TTYCOM Variable. + +This variable contains the com link status of the tty, +some user options associated with com links, and internal +system flags. The following bits may be set with a CNSSET: +%TCICO, %TCOCO, %TCRFS, %TCQRY. + + ;4.9 => tty in communicate mode +%TCLFT==200000 ;4.8 => Local Feed Through (set if my program receiving his chars) +%TCRFT==100000 ;4.7 => Remote Feed Through (set if his program receiving my chars) + ;All characters typed on ttys with %TCRFT are given to all ttys + ;with %TCLFT. ^_S and ^_E control these bits. +%TCICO==40000 ;4.6 => Input Communicate Override (allows program to read and + ;type out, even if the tty is in com mode. +%TCOCO==20000 ;4.5 => Output Communicate Override (allows program to type out + ;even if the tty is in com mode. + ;4.4-4.3 => message receipt switch + ;00 => accept +%TCRFS==10000 ;10 => refuse +%TCQRY==4000 ;01 => interrogate +%TCMTR==2000 ;4.2 => tty's motor is off & must be turned + ;on before any other output is done + ;(only terminets have their motors shut off by ITS). +%TCECH==1000 ;4.1 => the last output to this tty was PI echoing + ;(used to prevent output RESET from throwing away echo). +%TCDET==200 ;3.8 console's tree detached by top level interrupt. + ;Set by NDETAC as signal to SYSCFM (console-free-msg typer) +%TCDNG==100 ;3.7 => type bell on this tty (because input buffer full). +%TCCBK==40 ;3.6 => reading args for a ^_K on this tty. +%TCCBS==20 ;3.5 => reading args for a ^_S on this tty. +%TCFPD==10 ;3.4 => First part of an output code sequence is done. +%TCTPN==4 ;3.3 type ^_N on leaving com mode (unless user explicitly types ^_N) +%TCPAD==2 ;3.2 0 => padding necessary on datapoint. +%TCHNG==1 ;3.1 line seems not to be interrupting for output, + ;so don't try to wait for output to get out. + +The right half is -1 for a tty that is not in a com link. +For ttys in com links, the RH's are the links in a cirular +list of all the ttys in the com loop. Each RH is the number +of the next tty in the loop. The order of the ttys in the +circular list has no significance. + +File: ITSTTY, Node: H/1/f, Previous: H/1/e, Up: H/1, Next: H/1/g + + f. The TTYROL variable or "Scroll Count". + +The TTYROL variable contains the number of lines that the screen +shifts up when, in scroll mode, an attempt is made to type past the +bottom of the screen. On most terminals, this is 1. On terminals that +can't scroll, it should be 0. On printing terminals (and inferior +displays that ITS thinks are printing terminals) it should be 1. + +File: ITSTTY, Node: H/1/g, Previous: H/1/f, Up: H/1 + + g. The TTYSMT or "SMARTS" variable. + +The TTYSMT variable is used to describe smart terminals. +It contains information on three things: + + What sort of CPU the terminal has (in case you want to load + a program into it), and + + To what extent (if at all) the terminal supports the ITS + local-editing and line-saving protocols, and + + To what extent (if at all) the terminal supports the ITS + terminal-independent graphics protocol. + *Note Graphics: (SYSDOC;GRPHCS)*. + +%TQ signifies a bit or field in the left half of TTYSMT, and %TR +signifies a bit or field in the right half. + +%TQMCH==700000 ;4.7-4.9 CPU type. 0 => unknown or uninteresting. + ;1 => PDP11. 2 => IMLAC PDS4. 3 => IMLAC PDS1. + +;These bits are for local-editing and line-saving (See SUPDUP doc) +%TRLED==100000 ;2.7 Terminal supports the local-editing protocol. +%TRLSV==034000 ;2.3-2.5 nonzero means terminal can save about 4**n lines. + +;These bits record what timezone the terminal is physically in. +%TRTIM==003700 ;2.2-1.7 signed offset from GMT minus 20. A value of zero + ; means don't know, don't care, or user program hasn't + ; implemented it yet. + +;The remainder of TTYSMT pertains to the graphics protocol. +;If %TQGRF is 0, it should all be 0. +%TQGRF==1 ;3.1 Terminal understands the graphics protocol. + ;the old name for this was %TQGPH +%TQHGT==76000 ;4.2-4.6 Character height in dots. +%TQWID==1700 ;3.7-4.1 Character width in dots. + +;The remaining bits and fields in TTYSMT indicate which optional +;features of the graphics protocol are supported. +%TQSET==2 ;3.2 Terminal implements multiple sets. +%TQREC==4 ;3.3 Terminal implements the rectangle commands. +%TQXOR==10 ;3.4 Terminal implements XOR mode. +%TQBNK==20 ;3.5 Terminal implements blinking. +%TQVIR==40 ;3.6 Terminal implements virtual coordinates. + +%TRGIN==400000 ;2.9 Terminal provides graphic input. +%TRGHC==200000 ;2.8 Terminal provides has graphic hardcopy. +%TRSCN==040000 ;2.6 Terminal implements scan-line output. + +File: ITSTTY, Node: H/2, Previous: H/1, Up: H + + 2. SYSTEM CALLS. + +* Menu: + +* RSSIZE: H/2/a RSSIZE. +* CNSGET: H/2/b CNSGET. +* CNSSET: H/2/c CNSSET. +* TTYVAR: H/2/d TTYVAR. + +File: ITSTTY, Node: H/2/a, Previous: H/2, Up: H/2, Next: H/2/b + + a. RSSIZE. + +The symbolic system call RSSIZE returns the horizontal and +vertical screen size of a tty. It takes one argument, like +the argument to TTYGET, and returns two values: the vertical +size and the horizontal size. + +File: ITSTTY, Node: H/2/b, Previous: H/2/a, Up: H/2, Next: H/2/c + + b. CNSGET. + +This symbolic system call takes one argument specifying the tty +(like TTYGET's argument) and returns seven values: +the vertical screen size, +the horizontal screen size, +the TCTYP variable, +the TTYCOM variable, +the TTYOPT variable, +the TTYTYP variable, +the TTYSMT variable. + +Note that the CNSGET call can fail quite legitimately, if the +user translates device TTY: to a file of commands for the program. +Therefore, you should not naively put a .VALUE or a .LOSE after +a CNSGET, but instead write code to assume that a command file +is being used and do the "appropriate" thing. + +File: ITSTTY, Node: H/2/c, Previous: H/2/b, Up: H/2, Next: H/2/d + + c. CNSSET. + +This symbolic system call is used to set the permanent and +semipermanent variables. It takes six arguments. The first is +a tty channel; the next five are the new values of +the vertical screen size, +the horizontal screen size, +the TCTYP variable, +the TTYCOM variable, +the TTYOPT variable. +If the second, third or fourth argument is negative, the +corresponding variable will not be altered. Fewer than six +arguments may be given, in which case variables corresponding +to arguments not given will not be changed. The system will +make sure that the variables are not given inconsistent values, +and will not allow some bits in TTYCOM to be changed. + +You should always make sure that a CNSSET does not change bits +or variables that you do not specifically want to change. Do +this by 1) specifying -1's for the screen sizes and TCTYP if +you are not changing them, or 2) reading in the old setting s +with a CNSGET, altering specific bits or variables, and then +writing the altered settings out. + +File: ITSTTY, Node: H/2/d, Previous: H/2/c, Up: H/2 + + d. TTYVAR. + +The TTYVAR symbolic system call allows you to read and/or write +any of the permanent or semipermanent variables. See the entry +for TTYVAR in the ITS .CALLS file for information on the several +ways of using it. + +Variables may be specified by sixbit names and read, written, or +modified (increased, decreased, bits set, cleared, or complemented). +Of course, some fields of some variables may not be changed; attempts +to change them will be ignored. The variable names now allowed are +HEIGHT, IDLTIM, ISPEED, OSPEED, SMARTS, TCTYP, TTYCOM, TTYOPT, TTYROL, +TTYSMT, TTYTYP, and WIDTH. Many of them have been described under +semipermenent variables. Here are the rest: + + ISPEED and OSPEED are the input and output speeds of the terminal. +They refer to the input and output speed codes stored in the TTYTYP +variable. However, they are not speed codes; they are the speeds, +in bauds. Also, you are allowed to set the ISPEED and OSPEED +variables, while you are not allowed to set the whole TTYTYP variable. + + IDLTIM (not at all permanent) is the length of time since the last +input character was typed on the tty, in 30'ths of a second. + + Note that the TTYVAR call can fail quite legitimately, if the +user translates device TTY: to a file of commands for the program. +Therefore, you should not naively put a .VALUE or a .LOSE after +a TTYVAR, but instead write code to assume that a command file +is being used and do the "appropriate" thing. + +File: ITSTTY, Node: I, Previous: H, Up: Top, Next: J + +I. PSEUDO-TELETYPES (STY'S). + +Pseudo-teletypes are a facility that allows programs to do the +things that users do with terminals - type in on them, and observe +what is typed out on them. A sty is a device which is analogous to +a user's physical terminal. Outputting to a sty device is like +typing on a physical terminal's keyboard. Reading from a sty is +analogous to a physical terminal's gobbling down of output. Thus, +outputting a "^Z" to a sty just opened would load a DDT. DDT's +initial typeout "xx ITS.nnn. DDT.nnn." etc. would then be available +as input from the sty. + +The system contains many tty devices. A physical terminal that is +online is the end of a pipeline whose other end is one of the tty +devices. A sty device is also one end of a pipeline whose other end +is one of the tty devices. Each sty device has a particular tty +device permanently associated with it; the sty's are distinguished +by number, as are tty's, and the number of the tty associated with +a sty equals the sty number plus the value of the symbol NFSTTY. + +Since the most common use of stys is for network TELNET servers, +a special feature called "direct connection" exists for tying +a sty to a pair of network channels, so that all input from the +net is fed to the sty and all input from the sty is fed to the net, +without having to run the actual server program. + +* Menu: + +* Opening: I/1 Opening STYs. +* Output: I/2 Output to STYs. +* Input: I/3 Input from STYs. +* Closing: I/4 Closing STYs. +* Controlling: I/5 Controlling the tty associated with a STY. +* Direct: I/6 Direct connections to network channels: STYNET. +* STYGET: I/7 STYGET. + +File: ITSTTY, Node: I/1, Previous: I, Up: I, Next: I/2 + + 1. OPENING STY'S. + +There are two ways to open a sty: opening the STY device, and +opening a Snm device, where nm is the number of the desired sty. +Opening STY is a convenient way of obtaining any sty that is free. +If STY is not open, opening it causes the system to find a sty +which is free and whose associated tty is also free, and open it. +Opening STY when STY is already open on another channel will use the +same sty as before. Thus, a program that wishes to use one sty can +avoid the trouble of finding a free sty and remembering its number +by using device STY throughout. For more complicated applications, +any sty may be opened by number (Open device S00 to get sty number +0). However, a sty that is open in another job may not be opened. + +When a sty is opened that was not already open, the tty on the +other end of the pipeline is put into a standard state - the one +that would result from doing :TCTYP PRINTING on that tty. Also, an +input RESET and an output RESET are done, clearing all buffers. + +Sty opens recognize two special mode bits. Bit 3.3 ("image mode") +on an input open is copied into the associated tty's %TOHDX bit, +so if the sty is opened for input in image mode, +characters output to the sty will not be read back in as echo. +Bit 3.4, if 1 in either an input or an output open, causes the +sty to operate in "don't hang" mode in that direction. +*Note NH Out: I/2/a. *Note NH In: I/3/a. +Bit 3.5, on input, says that %TDORS should +be provided when tty output is reset, even if the tty is +not a software tty (*Note TDORS: K/2.). This makes +it possible for the sty handling job to tell when tty output +has been thrown away. + +These modes are not remembered separately for each channel; +each open sets the modes for all channels in that direction. + +File: ITSTTY, Node: I/2, Previous: I/1, Up: I, Next: I/3 + + 2. OUTPUT TO STY'S. + +IOT'ing a character to a sty output channel is like typing the +character into the tty on the other end of the pipeline. The +characters "^Z" and "^_" are special just as they are on physical +terminals. Characters sent to a sty may be echoed, just as +characters typed on a physical terminal may be (of course, the tty +may be made half-duplex, in which case there will be no echoing. +When the sty is opened for input, it is there is an option to make +the tty half-duplex). The characters output need not be ascii - +any character in the 12-bit TV character set may be output to +the tty, which will treat it the way a TV would. + +* Menu: + +* Empty: I/2/a What happens when the buffer is empty. +* Interrupts: I/2/b Interrupts. +* Reset: I/2/c RESET on sty output channels. +* Status: I/2/d STATUS on sty output channels. + +File: ITSTTY, Node: I/2/a, Previous: I/2, Up: I/2, Next: I/2/b + + a. What happens when the buffer is empty. + +An attempt to output to a sty channel open in normal output +mode when the tty input buffer has no room in it will wait until +there is room. This is unlike the treatment of physical +terminals, which unfortunately cannot be told to wait. + +If the channel is open in "don't hang" mode, then the character +will be thrown away, and "^G" echoed, just as on a physical +terminal. This mode is good for programs that simulate special +types of terminals for the user. + +File: ITSTTY, Node: I/2/b, Previous: I/2/a, Up: I/2, Next: I/2/c + + b. Interrupts. + +If a sty output channel is enabled to interrupt, an interrupt will +happen whenever a job attempts to read from the associated tty and +its input buffer (the sty's output buffer!) is empty. + +File: ITSTTY, Node: I/2/c, Previous: I/2/b, Up: I/2, Next: I/2/d + + c. RESET on sty output channels. + +A .RESET UUO or a RESET symbolic system call done on a sty output +channel is like a RESET on an input channel; of the associated tty; +all characters waiting in the input buffer of the tty are thrown +away. If they have not echoed already they will not; if they have +not interrupted already they will not. + +File: ITSTTY, Node: I/2/d, Previous: I/2/c, Up: I/2 + + d. STATUS on sty output channels. + +A .STATUS UUO or STATUS symbolic system call done on a sty output +channel will return the device code 25, and will set bit 2.2 or bit +2.1 if the tty's input buffer is empty or almost full, respectively. + +File: ITSTTY, Node: I/3, Previous: I/2, Up: I, Next: I/4 + + 3. INPUT FROM STY'S. + +Characters read in by a sty are like characters received by a +physical terminal's printer. The sty input effectively comes out of +the tty output buffer. The sty will read the exact same sequence of +characters that a physical terminal would receive with the same +settings of the various tty variables. This includes padding and +cursor motion characters according to the setting of the tty's +TTYOPT variable, but the initial setting given to the tty when the +sty is first opened causes padding not to be done. + +* Menu: + +* Empty: I/3/a What happens when the buffer is empty. +* Interrupts: I/3/b Interrupts. +* Status: I/3/c .STATUS on sty input channels. +* Reset: I/3/d .RESET on sty input channels. + +File: ITSTTY, Node: I/3/a, Previous: I/3, Up: I/3, Next: I/3/b + + a. What happens when the buffer is empty. + +There are two modes of input from sty's, distinguished by what +happens when the tty has no characters to output. The normal mode +waits for output from the tty to be available. The other mode, +"don't hang" mode, returns immediately when there is no input, +giving an indication of that fact. "Don't hang" unit mode IOT's +return -1 instead of an input character. +SIOT's return with the pointer and count not completely advanced. +Block mode IOT's have a kludgerous scheme and should be avoided. +"Don't hang" mode is selected by opening an input +channel with the 20 bit in the open-mode set to 1. + +File: ITSTTY, Node: I/3/b, Previous: I/3/a, Up: I/3, Next: I/3/c + + b. Interrupts. + +A sty input channel may be enabled to interrupt. It will do so +whenever input (tty output) is available. In normal mode, it is +expected that the interrupt routine will read one character; if when +the interrupt is dismissed more are available another interrupt will +occur. In "don't hang" mode, the interrupt routine should continue +reading until it reads a -1, indicating that no more input is +available at the moment. + +File: ITSTTY, Node: I/3/c, Previous: I/3/b, Up: I/3, Next: I/3/d + + c. .STATUS on sty input channels. + +A .STATUS UUO or STATUS symbolic system call on a sty input channel +returns bit 2.1 as 1 iff the tty's output buffer is full, and 2.2 as +1 iff it is empty. + +File: ITSTTY, Node: I/3/d, Previous: I/3/c, Up: I/3 + + d. .RESET on sty input channels. + +A .RESET UUO or RESET symbolic system call on a sty input channel +is approximately the same as a .RESET on an output channelof the +associated tty - namely, it throws away what is in the tty's output +buffer. However, RESET on a tty output channel also initializes some +bits associated with that particular channel, while sty input reset +doesn't change the settings of those bits for any of the tty output +channels. Also, tty output reset may not actually discard the buffer +if the tty's %TPORS bit is 0, or if the buffer contains PI-echoed +characters, but sty input reset will always clear out the buffer +even in those circumstances. An input RESET is part of the process +of initializing a sty for use, performed when the sty is opened +after being free. + +File: ITSTTY, Node: I/4, Previous: I/3, Up: I, Next: I/5 + + 4. CLOSING STY'S. + +When a sty channel is closed, but the sty is still open on some +other channel, nothing special happens - if the channel were +reopened, nothing would have changed. In particular, nothing is done +to the state of the associated tty or to characters sitting in its +buffers. + +When a sty is closed on the only channel it is open on (this +happens when the only channel it is open on is reopened), if the +associated tty is in use as a tree-controlling console, the tree +will be logged out. If the tty is in use as a device its status will +not be changed. + +File: ITSTTY, Node: I/5, Previous: I/4, Up: I, Next: I/6 + + 5. CONTROLLING THE TTY ASSOCIATED WITH A STY. + +Any of the special symbolic system calls for tty's, except for +LISTEN, may be given a sty channel instead of a tty channel as its +first argument, in which case the function will be performed for the +tty associated with the specified sty. The calls that are most +useful in this mode are TTYGET, CNSGET and CNSSET. TTYGET returns +the TTYSTS variable, which tells whether the tty is in use (%TSFRE), +by what job (the R.H.), and whether as a console or as a device +(%TSCNS) (*Note TTYSTS: G/1/b. for a description of the TTYSTS variable and the +values of those two bits). CNSGET returns the information that ITS +uses in deciding exactly how to treat the tty. CNSSET sets that +information. Programs that use sty's will often want to do a CNSSET +to the sty as soon as it has been opened. For example, the 340D +program does a CNSSET to the sty it uses, setting it to be a +datapoint with a peculiar screen size. This causes ITS to send +datapoint cursor motion codes to the tty. The 340D program reads +them from the sty and simulates their effect in the display that it +maintains on the 340. The TTYCOM variable may be examined with a +CNSGET, and the com-mode status of the tty may be altered by +outputting the appropriate ^_ codes to the STY. + +Any symbolic system call that requires a job-spec as an argument may +be given a sty channel, which will signify whatever job has the +associated tty in its possession. + +File: ITSTTY, Node: I/6, Previous: I/5, Up: I, Next: I/7 + + 6. DIRECT CONNECTIONS TO NETWORK CHANNELS: STYNET. + +It is possible with this call to connect a sty to a pair +of network channels, one open for input, and one open for output. +When the direct connection is established, anything received by +the net input socket will be fed automatically as output to the +sty, and any type-out that the sty receives from its TTY will be +fed automatically to the net output channel. The transfer of +data is handled by the system at clock level, eliminating +the need for the program to wake up at each character. + +The STYNET call returns immediately, without actually +transferring any data. Once established, the direct connection will last until +broken explicitly by the user (with another STYNET), or until an escape condition +is detected by the system. Escape conditions include receipt +of a TELNET control character on the net input channel, and +either net channel's getting into an abnormal state (other +than %NSOPN, %NSINP, or %NSCLI) - in general, things which +the system expects that the user program will want to take +action on. When the system detects an escape condition it will +break the direct connection and notify the user program with +an interrupt on the net input channel. +While the connection lasts, interrupts on the net channels +due to arriving data are intercepted by the system, so +an interrupt implies that the connection has been broken. + +Only one input and one output net channel can be connected to +a sty, and only one sty can be connected to any net channel. +Both sides of a sty are connected and disconnected at once. +A job can connect a sty if it has the sty open in either direction +(but it will generally want to have both directions open). + +When a %TDORS comes out of the sty, indicating that the TTY's +output buffer has been cleared, this is indicated to the net +output channel by means of a network interrupt, and the +string of up to 3 characters specified as the fourth argument +to the STYNET call. If the tty is a software tty and uses the +intelligent terminal protocol, then output RESETs will also block +the TTY at main program level. The sty-operating program will +not be informed of this, so it is up to the program at the other +end of the network connection to send back a ^\^P to turn output +back on. + +If you use STYNET with the official TELNET protocol, you must +turn on the %TPTEL bit in the sty TTY's TTYOPT variable, to +cause the sequence CR-LF received from the net +to be turned into just a CR. + +The arguments to a STYNET call are as follows: + +arg 1 sty channel (either direction). +arg 2 -1 to disconnect the sty from its network channels + (in which case args 3 and 4 are unnecessary), + or Net input channel (to connect sty output to). +arg 3 Net output channel (to connect sty input to). +arg 4 Characters to send out on net + when an output .RESET is done on the sty's TTY. + Up to 3 8-bit characters, left-justified. + +File: ITSTTY, Node: I/7, Previous: I/6, Up: I + + 7. STYGET. + +Sty handling programs that wish to take an active interest in +managing the lives of the programs attached to the sty's alter ego +may use the STYGET symbolic system call to get information on +what those jobs are doing. STYGET takes one argument - a tty spec - +and returns the following five values: + +1) The RH is 0 if the sty is free; otherwise, it is the job number + the job that owns the sty. The LH bits %SSHNG and %SSOHG + if set indicate that input and output, respectively, are in + don't hang mode. + This value contains garbage if the tty is not associated with a sty. +2) -1 if the tty is free; otherwise, the job number of the job + that owns the tty. +3) -1 if the tty is not a console; otherwise, the RH contains the + job number of the top level job in the tty's tree and the LH + is nonzero iff the tree is logging out. +4) Gives information on whether a job is hung trying to use the tty: + Bit 1.1 if 1 => the job owning the tty is waiting for input. + Bit 4.9 if 1 => that job is waiting for output buffer room. +5) Indicates the status of the tty's buffers: + Bit 4.9 if 1 => input is available. + Bit 4.8 if 1 => output buffer space is available. +6) Is the tty's TTYSTA word, which contains these bits: + Bit 4.9 (%TACFM) 1 => tty has had a "console-free" + message printed, and has not been in use since. + Bit 4.8 (%TAC.Z) 1 => tty is being ^Z'd, but the + tree has not been created yet. %TACFM will + be 0. If %TACFM is 0 and %TAC.Z is also 0, + the tty is in the process of being freed. + Bit 4.7 (%TANJS) 1 => the ^Z attempt in progress + on this tty is being ignored, because all + the job slots in the system are in use. + Bits 4.6-4.3 (%TANEC) Number of following chars to inhibit echo and + ints for. This is used for the arg chars that follow Top-E, Top-S, + Top-Y, etc. + + +File: ITSTTY, Node: J, Previous: I, Up: Top, Next: K + +J. THE INTELLIGENT TERMINAL PROTOCOL. + +The %TPCBS bit in the RH of TTYOPT turns on the intelligent terminal +protocol. This gives the terminal some extra control over things +through the use of escape sequences introduced by 034 (control +backslash). These escape sequences are handled at a "lower level" +than everything described above, and the characters composing them +are not echoed. The idea is not that the user should produce the +escape sequences by typing the characters, but that the terminal +should send them of its own accord when necessary, invisibly to +the user. For example, when the user types a ^\, the terminal +should send ^\^\, which is how to cause the intelligent terminal +protocol to pass the user's ^\ up to higher levels. + +* Menu: + +* Escape: J/1 Escape sequences. +* Alloc: J/2 Allocation. +* Reset: J/3 Output-reset. + +File: ITSTTY, Node: J/1, Previous: J, Up: J, Next: J/2 + + 1. ESCAPE SEQUENCES. + +(The spaces that appear inside the escape sequences are just +for readability; they should not actually be sent) + +The escape sequences are: + +^\ where is in {@, A, B, ..., _} and is + any character inputs the character (&27)*200+. + That is, supplies the 4 meta-bits for . The + meta bits are (in their ultimate positions): + + %TXTOP 4000 "TOP" + %TXSUP 1000 "SUPER" (Used to mean "SHIFT".) + %TXMTA 400 "META" + %TXCTL 200 "CONTROL" + + The bits should appear in shifted right 5; thus, + "C" = 103 will set %TXCTL and %TXMTA. + + Note that %TXCTL and %TXMTA are used with the + uncontrollified character, while %TXTOP is used + with the code for a SAIL-graphic < 40, not with + the letter which appears on that key on a TV keyboard. + Thus, 32 is the code for CALL, while %TXTOP+32 is the + code for the harmless SAIL graphic character NOT-EQUAL + and %TXCTL+132 is the code for CONTROL-Z. + %TXCTL+32 is CONTROL-CALL, and %TXCTL+%TXTOP+32 + is CONTROL-NOT-EQUAL. + %TXTOP+132 is meaningless, because %TXTOP makes sense + only with basic 7-bit codes that are less than 40. + +(In the following, # represents a number between 0 and 177 +(octal) which is simply transmitted as a character.) + +^\ ^A # increments the allocation by # characters. + +^\ ^Z zeros the allocation. + +^\ ^I sets the allocation to infinity. + +^\ ^S stops output at main program level. + +^\ ^R restarts output at main program level. + +^\ ^P # # sets the cursor position. The first # is the vertical + position (zero at the top of the screen.) The second # + is the horizontal position (0 at the left margin.) + Output is then restarted at main program level. + +^\ ^\ inputs a ^\. This is what to send when the user types + ^\ on the keyboard (unless the full character set is + being hacked in which case one would probably use + either "^\ A \" to input a control-backslash, or + "^\ P ^\" to input a less-than-or-equal). + +^\ ^C signals that the screen has been "messed up". + This gives a %PIATY interrupt to the running program, + just as if its superior had taken the terminal away and + presumably messed up the screen. Some programs (including + TECO) will respond to this by redisplaying everything. + +File: ITSTTY, Node: J/2, Previous: J/1, Up: J, Next: J/3 + + 2. ALLOCATION. + +To provide for intelligent terminals which sometimes can't +process characters as fast as ITS can send them, there is an +output allocation mechanism. The output allocation is the +number of characters which can be sent to the terminal without +overloading it. After this number has been sent, ITS will cease +outputting at interrupt level (but IOT'ing of output may +continue if the output buffer is not full). Transmission will +resume as soon as the terminal increases the allocation above +zero with a ^\ ^A # or a ^\ I. + +The initial default value of the allocation is infinity; +thus output normally never stops. When the terminal wishes to +begin to use the allocation feature, it should do ^\ ^Z to +initialize the allocation to zero. Then it should do one or more +^\ ^A #'s to tell ITS how much buffer space it has (more than one +is needed if the terminal wants to say it can buffer more than +177 characters). When characters arrive from ITS, the terminal +need not do anything, since ITS will decrement the allocation +automatically; but, when the terminal processes the characters +from its buffer, it must tell ITS that the buffer space is free +once more by sending a ^\ ^A #. For example, the terminal might +send ^\ ^A ^X once for each 24. characters it removes from its +buffer. If the terminal has reason to suspect that it and ITS +have gotten out of phase in remembering the allocation, it can +always reinitialize without fear using ^\ ^Z ^\ ^A . + +To stop using the allocation feature, just do ^\ ^I. + +File: ITSTTY, Node: J/3, Previous: J/2, Up: J + + 3. OUTPUT-RESET. + +If the TTY is a software-tty (*Note Soft: K.), uses the +intelligent terminal protocol (has %TPCBS on in TTYOPT), and +does output-resets (has %TPORS on in TTYOPT), then .RESET on +an output channel to that tty is handled specially. Any characters +in ITS's output buffer are thrown away, a %TDORS character is +sent to the terminal, and output is blocked at main program +level. The terminal should then throw away any characters in +its buffer. If the terminal is connected to ITS through a network +each node in the path should throw away the contents of its +output buffer and pass on the %TDORS. + +When the %TDORS gets to the terminal, it should determine +where the output that wasn't thrown away left the cursor +and send back a ^\ ^P # #, which sets the ITS cursor to this +position and restarts output. + +File: ITSTTY, Node: K, Previous: J, Up: Top + +K. SOFTWARE TTYS AND ITS OUTPUT BUFFER CODES. + +When a tty's TCTYP variable is set to %TNSFW, ITS sends +the contents of the tty output buffer directly to the +terminal, instead of translating it into one of the codes +used by any of the normal types of terminals. This can +be very convenient for new types of intelligent terminals, +and for sty-handling programs that must actually understand +the data read from the sty. The data output to a software +tty includes printing characters, and ITS display commands +as are found in the tty output buffer. Not having to +convert them into a different code at interrupt level saves +time; in addition, the display commands encode a superset of +the capabilities all real terminals supported by ITS, and +therefore more convenient than the code of any actual terminal. + +* Menu: + +* Codes: K/1 ITS output buffer codes. +* TDORS: K/2 Handling %TDORS. +* SCPOS: K/3 The SCPOS system call. + +File: ITSTTY, Node: K/1, Previous: K, Up: K, Next: K/2 + + 1. ITS OUTPUT BUFFER CODES. + +The internal ITS output buffer codes are 8 bits long. +Sty handlers should read them in unit mode only. To read +more than one at a time, use SIOT with 8-bit bytes. +Real terminals are assumed to be able to receive only +7-bit characters; for them, codes 0 - 176 are sent as +is; codes above 176 have 176 subtracted from them and +are escaped by a 177. 200-codes that have following arguments +which can reasonably be zero (%TDMOV, %TDMV0, %TDMV1) +have 1 added to each argument, so that 0 need not be sent. + +Note that not all 200-codes are meaningful on all types +of terminals. Programs outputting them in superimage mode +must be careful to use codes that work on the terminal +they have. + + 0 - 177 Characters, to be output as is. + Normally, only single-spacing graphic characters + will be sent this way. Other characters will + appear if programs output them in image mode. +%TDMOV=200 Move cursor. followed by 4 bytes of arguments: + first, the old vertical and horizontal positions + (these are probably not needed by the sty + handling program); next, the desired vertical + and horizontal positions. + Should not be used on "raw" ttys (%TORAW set), + though it will work. +%TDMV1==201 Should never be encountered. If it is, it is + followed by 2 bytes of args - the desired + vertical and horizontal positions. + Should not be used on "raw" ttys (%TORAW set). +%TDEOF==202 Clear rest of line and rest of page. + Does not move the cursor. + Does nothing on terminals that aren't selectively + erasable, even if they are displays. +%TDEOL==203 Clear rest of line +%TDDLF==204 Clear out character after cursor, without moving cursor. +%TDMTF==205 Turn off motor (should not come out except on terminets). +%TDMTN==206 Turn on motor (" "). +%TDCRL==207 Move cursor to beginning of next line, + and clear that line. If done when the cursor is on + the bottom line, it causes the terminal to scroll + its whole screen up. The TTYROL variable tells ITS + how many lines the terminal WILL scroll. +%TDNOP==210 No-op. +%TDBS==211 Backspace - used only on tty's with %TORAW set. +%TDLF==212 Linefeed - ("). +%TDRCR==213 Carriage return - ("). +%TDORS==214 Output reset. Put in the buffer when a tty + output reset is done, to inform the sty handling + program or the terminal. Should never be sent by + a program explicitly. +%TDQOT==215 Quote the next character so that it is output to the + terminal without being interpreted by ITS. +%TDFS==216 Move cursor forward one column. + This is identical to an appropriate %TDMOV command, and + exists to increase the efficiency of utilisation of + space in the output buffer. +%TDMV0==217 Move cursor, followed by 2 args: the desired + vertical and horizontal positions. + Should not be used on "raw" ttys (%TORAW set). +%TDCLR==220 Clear the screen, and move the cursor to the top left. + On printing terminals, it does nothing. +%TDBEL==221 Produce a sound on the terminal, or otherwise try + to attract the user's attention, without permanently + altering the contents of the screen. +%TDINI==222 Sent at system start-up to all terminals, + to tell them to reset themselves. +%TDILP==223 Insert Line Positions. Followed by a byte containing + the number of lines to insert. The current line and + all lines below it are pushed down on the screen that + many positions. Lines pushed off the bottom of the + screen are lost. Blank lines appear at the cursor to + replace the lines shifted downward. The cursor does + not move. + This code and the following one should be used only + on terminals which have %TOLID set, and only with the + cursor at the beginning of a line. +%TDDLP==224 Delete Line Positions. Followed by a byte containing + the number of positions to delete. That many lines, + starting with the current line, disappear. The lines + below them are shofted up to take their places. Blank + lines are shifted in as necessary at the bottom of the + screen. The cursor does not move. +%TDICP==225 Insert Character Positions. Followed by a byte + containing the number of spaces to insert. All of the + characters on the current line from the cursor to the + end move that many positions to the right. The last + few move off the right margin and disappear. The + terminal is not expected to know anything about + continuation lines. Spaces are shifted in at the + cursor to replace the characters that are moving + right. + This code and the following one should be used only + on terminals which have %TOCID set. +%TDDCP==226 Delete Character Positions. Followed by a byte + containing the number of character positions to + delete. All of the characters to the right of the + cursor move that many positions left, except for the + first few, which disappear rather than move past the + cursor. Spaces appear at the right margin to replace + them. +%TDBOW==227 Turns on inverse video mode for characters which are + output subsequently. The terminal should use some + sort of alternate display mode to emphasize them. +%TDRST==230 Turns off inverse video mode. If any other similar + modes are created, %TDRST will turn them off too. +%TDGRF==231 This is supposed to be for graphics, but it is not + implemented by anything. +%TDRSU==232 Region scroll upwards. +%TDRSD==233 Region scroll downwards. These two commands can be used + if the %TPRSC bit is on in TTYOPT. The %TDRSU/%TDRSD + command is followed by two parameter characters. The + first is the number of lines in the region to be scrolled; + the second is the number of lines by which the text is + to be scrolled. A region of the screen, which starts at + the line containing the cursor and proceeds downward for + the specified number of lines, is shifted by the specified + amount. %TDRSU shifts text upwards, bringing in blank lines + at the bottom of the region. %TDRSD shifts text downwards, + bringing in blank lines at the top of the region. The + cursor is not moved. If either parameter is 0 the command + should be ignored. If the size of the region is larger + than the size of the screen below the cursor, the region + should end at the bottom of the screen. If the number of + lines to scroll by is not less than the size of the region, + the region should be cleared. + +File: ITSTTY, Node: K/2, Previous: K/1, Up: K, Next: K/3 + + 2. HANDLING %TDORS. + +%TDORS is output to a software tty when an output RESET was +done on the tty, discarding some number of output characters. +For a normal terminal, ITS keeps track of the cursor position +at interrupt level; a RESET knows that the interrupt level +value is the correct one. For software terminals, ITS does +not remember an interrupt-level cursor position, so it is +up to the terminal (or sty-handler) to inform ITS of the +actual cursor position after each RESET. RESET turns on +the "hold output" bit for the tty, to make sure that +nothing happens to confuse the matter until that is done. +Actual terminals should use the ^\ ^P # # command of the +Intelligent Terminal Protocol (*Note ITP: J/3.). Sty +handlers should use the SCPOS system call (*Note SCPOS: K/3.). + +%TDORS will be sent to sty ttys even if they are not +software ttys, if %SSORS is set for the sty. That will +be so if the sty was opened for input with bit 20 +set in the open mode. In this case, SCPOS need not be +done, since the system knows the cursor position. +If the program does something with the %TDORS that +changes the cursor position, however, it should +do an SCPOS to inform ITS of the fact. Unlike the +case of software ttys and intelligent-terminal +protocol ttys, output will not be hung up until +this SCPOS is received. + +File: ITSTTY, Node: K/3, Previous: K/2, Up: K + + 3. THE SCPOS SYSTEM CALL. + +The SCPOS system call is used for telling ITS that a tty's +cursor is actually located at a given spot. IT DOES NOT +MOVE THE CURSOR. To move the cursor, ^P-codes or ITS +output buffer codes must be output. + +SCPOS must be used after any event in which ITS does not +understand how the cursor is moving. Luckily, there are +only two. A program which has done super-image output +must SCPOS if the output moves the cursor at all; +a sty-handler using a software tty must SCPOS after +an output RESET. Physical software ttys must do the +equivalent of an SCPOS after output RESETs, but they use +the Intelligent Terminal Protocol instead. + +The first argument to an SCPOS system call should be a tty specifier +(*Note TTY spec: G/2.). +The next two arguments should be the corrected vertical and +horizontal positions. +The third argument is optional, and if present sets the TTOALC +variable of the tty. A third argument of -1 is the way to clear +the hold-output bit after an output reset. + +SCPOS does not require ownership of the terminal; just output +permission (*Note Permit: B/3.). + +Tag Table: +File: ITSTTY Node: Top³8 +File: ITSTTY, Node: Aµ209 +File: ITSTTY, Node: A/1µ783 +File: ITSTTY, Node: A/1/a¶879 +File: ITSTTY, Node: A/2·719 +File: ITSTTY, Node: A/2/a¸631 +File: ITSTTY, Node: A/2/b¹220 +File: ITSTTY, Node: A/2/c¹852 +File: ITSTTY, Node: A/3±1045 +File: ITSTTY, Node: A/4±2512 +File: ITSTTY, Node: A/4/a±3567 +File: ITSTTY, Node: A/4/b±7111 +File: ITSTTY, Node: A/4/c±8543 +File: ITSTTY, Node: A/4/d±9171 +File: ITSTTY, Node: A/4/e±9847 +File: ITSTTY, Node: A/4/f²1071 +File: ITSTTY, Node: A/4/g²2535 +File: ITSTTY, Node: A/5²3286 +File: ITSTTY, Node: B²4887 +File: ITSTTY, Node: B/1²6017 +File: ITSTTY, Node: B/2²6913 +File: ITSTTY, Node: B/3²8783 +File: ITSTTY, Node: B/4²9753 +File: ITSTTY, Node: B/5³1853 +File: ITSTTY, Node: C³2391 +File: ITSTTY, Node: C/1³2882 +File: ITSTTY, Node: C/3³3947 +File: ITSTTY, Node: C/3/a³5386 +File: ITSTTY, Node: C/3/b³5981 +File: ITSTTY, Node: C/3/d³7382 +File: ITSTTY, Node: D³8148 +File: ITSTTY, Node: D/1³9205 +File: ITSTTY, Node: D/2´2157 +File: ITSTTY, Node: D/3´6093 +File: ITSTTY, Node: D/4´7874 +File: ITSTTY, Node: D/5µ2007 +File: ITSTTY, Node: D/6µ2344 +File: ITSTTY, Node: D/7µ3370 +File: ITSTTY, Node: D/8µ4443 +File: ITSTTY, Node: Eµ7111 +File: ITSTTY, Node: E/1µ8393 +File: ITSTTY, Node: E/2¶0094 +File: ITSTTY, Node: E/2/a¶0749 +File: ITSTTY, Node: E/2/a/1¶1944 +File: ITSTTY, Node: E/2/a/2¶2245 +File: ITSTTY, Node: E/2/a/3¶2467 +File: ITSTTY, Node: E/2/a/4¶3456 +File: ITSTTY, Node: E/2/a/5¶4395 +File: ITSTTY, Node: E/2/a/6¶5078 +File: ITSTTY, Node: E/2/a/7¶5516 +File: ITSTTY, Node: E/2/a/8¶6293 +File: ITSTTY, Node: E/2/a/9¶6663 +File: ITSTTY, Node: E/2/a/10¶7087 +File: ITSTTY, Node: E/2/b¶8083 +File: ITSTTY, Node: E/2/c¶9177 +File: ITSTTY, Node: E/2/c/1·0146 +File: ITSTTY, Node: E/2/c/2·0486 +File: ITSTTY, Node: E/3·1015 +File: ITSTTY, Node: E/4·5836 +File: ITSTTY, Node: E/4/a·6612 +File: ITSTTY, Node: E/4/b·7759 +File: ITSTTY, Node: E/5·8265 +File: ITSTTY, Node: E/6·9269 +File: ITSTTY, Node: E/7¸0518 +File: ITSTTY, Node: E/8¸3878 +File: ITSTTY, Node: E/9¸4869 +File: ITSTTY, Node: E/10¸5413 +File: ITSTTY, Node: F¸5791 +File: ITSTTY, Node: F/1¸6575 +File: ITSTTY, Node: F/2¸7551 +File: ITSTTY, Node: F/2/a¸8009 +File: ITSTTY, Node: F/2/b¸9958 +File: ITSTTY, Node: F/3¹1464 +File: ITSTTY, Node: F/4¹2155 +File: ITSTTY, Node: G¹3306 +File: ITSTTY, Node: G/1¹5754 +File: ITSTTY, Node: G/1/a¹5983 +File: ITSTTY, Node: G/1/b¹8395 +File: ITSTTY, Node: G/1/c±00841 +File: ITSTTY, Node: G/2±01029 +File: ITSTTY, Node: G/2/a±02128 +File: ITSTTY, Node: G/2/b±03852 +File: ITSTTY, Node: G/2/c±05628 +File: ITSTTY, Node: H±06320 +File: ITSTTY, Node: H/1±07001 +File: ITSTTY, Node: H/1/a±07472 +File: ITSTTY, Node: H/1/b±08916 +File: ITSTTY, Node: H/1/c±11981 +File: ITSTTY, Node: H/1/d±12930 +File: ITSTTY, Node: H/1/e±14851 +File: ITSTTY, Node: H/1/f±17022 +File: ITSTTY, Node: H/1/g±17487 +File: ITSTTY, Node: H/2±18935 +File: ITSTTY, Node: H/2/a±19126 +File: ITSTTY, Node: H/2/b±19430 +File: ITSTTY, Node: H/2/c±20089 +File: ITSTTY, Node: H/2/d±21194 +File: ITSTTY, Node: I±22741 +File: ITSTTY, Node: I/1±24472 +File: ITSTTY, Node: I/2±26344 +File: ITSTTY, Node: I/2/a±27269 +File: ITSTTY, Node: I/2/b±27858 +File: ITSTTY, Node: I/2/c±28145 +File: ITSTTY, Node: I/2/d±28569 +File: ITSTTY, Node: I/3±28875 +File: ITSTTY, Node: I/3/a±29684 +File: ITSTTY, Node: I/3/b±30410 +File: ITSTTY, Node: I/3/c±30935 +File: ITSTTY, Node: I/3/d±31209 +File: ITSTTY, Node: I/4±32076 +File: ITSTTY, Node: I/5±32726 +File: ITSTTY, Node: I/6±34279 +File: ITSTTY, Node: I/7±37305 +File: ITSTTY, Node: J±39088 +File: ITSTTY, Node: J/1±40013 +File: ITSTTY, Node: J/2±42507 +File: ITSTTY, Node: J/3±44143 +File: ITSTTY, Node: K±45038 +File: ITSTTY, Node: K/1±46035 +File: ITSTTY, Node: K/2±51091 +File: ITSTTY, Node: K/3±52503 + End Tag Table: + +Don't delete this page. diff --git a/sysdoc/job.100 b/sysdoc/job.100 new file mode 100644 index 0000000..c04d932 --- /dev/null +++ b/sysdoc/job.100 @@ -0,0 +1,799 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +PROGRAMMING TECHNOLOGY DIVISION DOCUMENT SYS.xx.yy + + +IDENTIFICATIONî______________ + + The JOB/BOJ Device: A Mechanism for Implementing + Non-standard Devices + + Marc S. Seriff, Jack Haverty, Richard Stallman (MIT-AI) + + September 18, 1974 + + +INTRODUCTIONî____________ + + It is occasionally desirable to extend the ITS system to allow + +for the use of non-standard I/O devices. A very desirable feature + +would be to allow user-level programs to make use of the newly defined + +devices with out modification of the user-level programs. For this + +reason the JOB/BOJ device was implemented. + + When a job (call it the user) attempts an OPEN for a file whose + +name is "JOB: <-dir>-; <-fn1>- <-fn2>-", the system creates a + +new job, called the BOJ device handler, or BDH (this is a terrible + +name; it USES the BOJ device and HANDLES the JOB device), and attempts + +to load the file "DSK: <-dir>-; <-fn1>- <-fn2>-" into that job. + +If the load fails, the OPEN will fail. If this load succeeds, the + +OPEN, as well as all further I/O operations on the user's JOB channel + +will be referred to the BDH for execution. At that point, it will be + +up to the BDH to decide whether or not the open should fail. In order + +to get a handle on information about the user's open, The BDH opens + +one or more channels to the "BOJ" device. The system will insure that + +the BDH's BOJ channel is logically linked to the user's JOB channel. + +The following diagram illustrates what happens: + PTDD 2 SYS.xx.yy + + + + __________ _________ + | | | | + | User |------v__________------>| BDH | + |__________| | | ---XO--- | | |_________| + | | Sys|tem | | + ____| |_____|_____| |____ + |v | |v + The JOB channel | The BOJ channel + | + |v + System mediates + + + Once the BDH has successfully opened the BOJ channel, it will be + +notified (via an I/O channel interrupt) every time the user attempts + +an I/O operation on the JOB channel. The BDH may then examine the + +data that is made available to it about the I/O operation and may + +simulate the operation for the user. In this way, BDHs can be written + +to give anything the appearance of a disk, tape or other specific type + +of I/O device. + +USING THE JOB DEVICEî_____ ___ ___ ______ + + Programs that use the JOB device should not be required to make + +special provisions. A BDH should, in general, be written so that the + +non-standard device will behave exactly like some standard device. In + +other words, a user program may open a JOB device using a standard + +open and may then execute any legal I/O operation. + + A file name with something other than "JOB" for a device code can + +be made to act like a JOB device in one of two ways. The first way + +should be used for devices that are not generally applicable or are + +expected to be used only for a short time. To use this method simply + +use translates (using MONIT, DDT or directly via system calls) to + +inform the system which file should be used as a BDH. For instance, + +if we translate all file names of the form "XXX:" into the file name + PTDD 3 SYS.xx.yy + + +"JOB:ABC;TS RUNXXX", then the system will use the file "DSK:ABC;TS + +RUNXXX" as the BDH for any file name whose device code is "XXX". + + The other method is much simpler and is designed for non-standard + +devices that are to be made available to the entire user community. + +When an OPEN is attempted on a device whose name the system does not + +recognize, the system will examine the "DEVICE;" directory for a file + +whose first name is "JOBDEV" and whose second name is the unrecognized + +device name. If such a file exists, then the contents of that file + +will be loaded by the system and used as the BDH for the user's OPEN. + +USING THE BOJ DEVICE - THE BOJ DEVICE HANDLERî_____ ___ ___ ______ _ ___ ___ ______ _______ + + The BDH is the workhorse in the JOB/BOJ device scheme. It is + +required to interpret all of the user's I/O operations. It must do + +everything to make the non-standard device that it represents appear + +standard. The system provides five .CALLs to give the BDH some of the + +required communcation with the user. + + The first thing that the BDH should do when he is loaded and + +started by the system is to execute an OPEN on the BOJ device. This + +establishs a logical link between the user and the BDH. The BDH may + +enable a channel interrupt on the BOJ channel, in order to be informed + +whenever the user attempts an I/O operation. + + It should be noted that the ITS system allows for the possibility + +of a full duplex connection between the user and the BDH (i.e. a + +channel in each direction). If a user attempts an open for reading + +and an open for writing on the same device, then the system will + +present both opens to the same activation of the BDH. Should this be + +undesirable for a particular BDH, that BDH should use an open mode + +with the 3.4 bit set (10 in the left half) each time it attempts to + +open the BOJ device. + PTDD 4 SYS.xx.yy + + +JOBCAL SYSTEM CALLî______ ______ ____ + + The first .CALL that will be discussed is the JOBCAL. This call + +enables the BDH to find out what I/O operation the user has attempted + +to execute. It has the following calling sequence: + + .CALL JOBCAL + ... ; Error return + ... ; Success return + +JOBCAL: SETZ + SIXBIT/JOBCAL/ + [<-BOJ channel number>-] + 2000,,<-opcode>- + SETZ [-<-n>-,,<-data>-] + + +This .CALL, as well as the other three discussed below, will fail to + +skip if any of the following conditions hold: + + 1. <-BOJ channel number>- is an illegal channel number. + + 2. <-BOJ channel number>- is not open on the BOJ device. + + 3. the user job does not exist or as has closed his channel. + + 4. the user job is no longer attempting to execute the I/O + operation. + + <-opcode>- should be an address into which information about + +the I/O operation requested will be placed. This word contains three + +sections. The right half of the word contains an integer indicating + +which operation was attempted. The following table indicates what the + +various integers mean: + PTDD 5 SYS.xx.yy + + + + CODE OPERATIONî ____ _________ + + 0 OPEN + + 1 IOT (transfer) + + 2 STATUS (currently unused) + + 3 RESET + + 4 RCHST (complete status) + + 5 ACCESS + + 6 FDELE (for delete or rename while not open) + + 7 FDELE (for rename while open) + + 8 CALL (see below) + +It is up to the BDH to insure that these I/O operations perform as + +they would for standard ITS devices. + + The top three bits (4.9-4.7) of the op-code word contain the mode + +in which user is attempting to open his channel. This is only + +meaningful for op-code 0, OPEN. If either of the next two bits (4.6 + +and 4.5) are non-zero, then the user is requesting that a channel be + +closed. As was mentioned above, the system allows the connection + +between user and BDH to be full dumplex. If the 4.6 bit of the opcode + +is set, then the user is requesting that his input channel be closed, + +while the 4.5 bit requests a close of the user's output channel. It + +is possible to get an opcode in which both bits are set. In the case + +the BDH should perform the obvious task of closing both channels. + + Most I/O operations require more information than just the name + +of the operation. The third argument to JOBCAL tells the system where + +any additional information that is available should be placed. + +<-n>- is the largest number of words that the BDH is willing to + PTDD 6 SYS.xx.yy + + +accept (it should normally be 12). <-data>- is the address where + +the first word of the information should be placed. What information + +is placed in this buffer is determined by the I/O operation being + +attempted. + + If the op-code (in the right half of the op-code word) is less + +than 8, then five words will be written into the buffer (beginning at + +<-data>-) in response to the JOBCAL. The meanings of the words are + +given in the following table: + PTDD 7 SYS.xx.yy + + + +WORD OPERATIONS MEANINGî____ __________ _______ + + 1 IOT (1) Meaningful only for block IOTs. + This word will contain the user's + IOT pointer. The left half of this + word will be the negative of the + number of words that the user wants. + + 1 ACCESS (5) The address within the virtual file + that is open from (or to) which the + next IOT should be done. The first + word of the virtual file is word + zero. + + 1 FDELE (6 or 7) Zero implies delete requested. + Non-zero means that a rename is + requested. This word is the name + (in sixbit) to be used as the new + first file name. + + 2 OPEN (0) or FDELE (6) First name of the file that the user + is attempting to open, rename or + delete. + + 3 OPEN (0) or FDELE (6) Second name of the file that the + user is attempting to open, rename + or delete. + + 4 OPEN (0) or FDELE (6) Name of directory to be used for + open, rename or delete. + + 5 OPEN (0) or FDELE (6) Name of device to be used for open, + rename or delete. + + 6 OPEN (0) The full 18 bit open mode (right + justified). + + 6 FDELE (6 or 7) Zero implies delete. Non-zero means + that a rename is requested. This + word is the name (in sixbit) to be + used as the new second file name. + + If the op-code returned by JOBCAL is 8, then the user has + +attempted some I/O operation not recognized by the systems JOB/BOJ + +device code (this does not mean that the operation is illegal). Inî ___ + +this case, more information is written into the BDH's buffer (up to + +twelve words). The first of the data words will be the SIXBIT name of + PTDD 8 SYS.xx.yy + + +the operation being performed. (This will normally be the name of the + +.CALL executed by the user - see Appendix 1 for a list of + +possiblities.) The second word will contain all of the flags that the + +user has set using the "flag" feature of the .CALL UUO. The third + +word will be an integer indicating how many input (to the system) + +arguments the user supplied in his .CALL. It should be noted that if + +this integer is larger than <-n>-+3, then some information will be + +lost. The values of the input arguments will appear in the remainder + +of the words in the buffer. Remember that, in almost all cases, the + +first of the input arguments will be the user's channel number. + +JOBRET SYSTEM CALLî______ ______ ____ + + Once the BDH has interpreted the user's request for execution of + +an I/O operation, the BDH must have some way of responding to the + +user. This is provided with the JOBRET .CALL. This .CALL serves + +three purposes: + + 1. to unblock the user who is waiting for completion of his + I/O request (possibly causing the request to skip) + + 2. to set lossage codes in the user's status words (e.g. for + failed opens). + + 3. to return information requested by the user's I/O + operation. + +The format of this CALL is as follows: + + .CALL JOBRET + ... ; error return + ... ; success return + +JOBRET: SETZ + SIXBIT /JOBRET/ + [<-BOJ channel number>-] + [<-return>-] + SETZ [-<-n>-,,<-data>-] + + +where <-return>- satisfies requirements 1 and 2 above. If + PTDD 9 SYS.xx.yy + + +<-return>- is zero, then the user's I/O call will not skip or set + +status bits. If <-return>- is of the form <-i>-,,<-j>- , then + +<-i>- will be placed in the "open-loss" field of the status word for + +the user's channel and the user's I/O call will skip <-j>- times. A + +list of all currently recognized open loss codes can be found in + +Appendix 2. + + If the user's I/O call requested data, then the BDH can supply + +this data by supplying the third argument to the JOBRET call. The + +system will use the <-n>- words beginning at location <-data>- as + +the values for the return arguments in the user's call. + +SETIOC AND JOBINT -- INTERRUPT SYSTEM CALLSî______ ___ ______ __ _________ ______ _____ + + There are two interrupt oriented functions that the BDH must + +perform and there are CALLs available to perform them. The first is + +to notify the user when he has done something catastrophic. The user + +should be notified of his error by causing the system to awaken him + +with an I/O channel error. This done with the SETIOC call, as + +follows: + + .CALL SETIOC + ... ; error return (standard reasons + + illegal IOCERR code) + ... ; success return + +SETIOC: SETZ + SIXBIT/SETIOC/ + [<-BOJ channel number>-] + SETZ [<-IOCERR code>-] + + +where <-IOCERR code>- is an integer identifying the reason for the + +error. This integer should be chosen from the list that can be found + +in Appendix 2. Since BDHs are written to handle non-standard devices, + +these error codes will quite often not apply. Simply choose the code + +that comes closest. + PTDD 10 SYS.xx.yy + + + Occassionally, the BDH must notify the user of a non-catastrophic + +situation (e.g. the arrival of data). The JOBINT call allows the BDH + +to give the user a second-word I/O channel interrupt, as follows: + + .CALL JOBINT + ... ; error return + ... ; success return + +JOBINT: SETZ + SIXBIT /JOBINT/ + SETZ [<-BOJ channel number>-] + + +JOBSTS SYSTEM CALLî______ ______ ____ + + Finally, the BDH must have some way to notify the system what the + +status of the pseudo-device is. For this purpose, the JOBSTS call is + +available. Its calling sequence is as follows: + + .CALL JOBSTS + ... ; error return + ... ; success return + +JOBSTS: SETZ + SIXBIT /JOBSTS/ + [<-BOJ channel number>-] + SETZ [<-new status>-] + + +The right half of <-new status>- will be given to anyone requesting + +the status of the user's channel until another JOBSTS is done. It + +should be remembered that the low order six bits (1.1-1.6) should + +contain the device code of the pseudo-device. Unless, you know what + +you are doing, this should always be 22 octal. + +DATA TRANSFERS - HOW TO IOTî____ _________ _ ___ __ ___ + + Since the main purposes of I/O devices is transfer of + +information, let us look at how the BDH manages to respond to the + +user's IOTs. The method for doing this is very simply. If we think + +back to the diagram presented early in this memo, we will remember + PTDD 11 SYS.xx.yy + + +that the BOJ and JOB channels (i.e. the channels belonging to the BDH + +and the user, respectively) are logically connected. The full meaning + +of this now becomes clear. If the JOB channel is open for input and + +the BOJ channel is open for output, then anything that BDH outputs on + +the BOJ channel will be available to the user as input on the JOB + +channel. (For this reason, the BDH must insure that he opens the BOJî ____ + +channel in the opposite direction from the user's JOB channel even if + +this requires opening the BOJ channel a second time in the correct + +mode.) + + There are two features of which the BDH implementer should be + +aware when writing the I/O sections of the BDH. Let us assume for the + +discussion here, that the user has the JOB channel open for reading + +and that the BDH has the BOJ channel open for writing. Let us also + +assume that the user is currently hung attempting to read 100 words on + +his JOB channel. + + First it should be noted that the BDH does not have to respond toî ___ + +this request with a single transfer of 100 words. The system will act + +as an mediator between different transfer sizes. The BDH can respond + +to the user's request for 100 words in several ways: + + 1. He can send all 100 words in small pieces (e.g. 10 + + transfers of 10 words each. + + 2. He can send all 100 words in a single transfer. + + 3. He can send more than 100 words. In this case, the BDH + + will remain hung in his IOT until the user has read all of + + the data that the BDH is attempting to send. (If this is + + undesirable, set the 3.5 in the BOJ open mode. This will + + cause BOJ IOTs to unhang whenever the user's IOT is + PTDD 12 SYS.xx.yy + + + satisfied. When that happens, the BOJ IOT pointer will + + have been counted out only partially; the RH will point to + + the first word not transfered) + + 4. He may send less than 100 words. In this case, the BDH + + must manually awaken the user as described below. + +The user, who is hung awaiting his 100 words, will stay hung until he + +has received all 100 words. Suppose, however, that the BDH only + +wishes to send 50 words (e.g. the last 50 words of the virtual file). + +To do this, he can send the 50 words normally, but must then use the + +JOBRET call (described above) to awaken the user. JOBRET should be + +called with the BOJ channel number as the first argument, zero as the + +second argument and no third argument. Secondly, the BDH implementer + +must be aware that the ITS system guarantees that IOTs to a channel + +open in block mode, will never generate an I/O channel error. In + +other words, the following algorithm should be followed: + + 1. If the user requests n words and there are n words or more + + left in the "file", give him n words. + + 2. If the user requests n words and there are only m words + + (n>m), give him m words and manually awaken him (using + + JOBRET). + + 3. If the user requests n words and there are no words left, + + then give him nothing and manually awaken him (using + + JOBRET). + +HINTS TO BDH IMPLEMENTERSî_____ __ ___ ____________ + + The following hints should ease the task of BDH implementers a + +little. It is hoped that anyone who attempts to a BDH implementation + +will add his harshly acquired knowledge to this section of this memo. + PTDD 13 SYS.xx.yy + + +1. Remember that the BDH is essentially a disowned job and should + + attempt to log out after a close has been requested. + +2. Be very leery of logging out for any reason other than a requested + + CLOSE. In particular: + + a. if a JOBCAL fails, only log out if a request for OPEN has not + + yet been received. + + b. when you generate an I/O channel error for the user, only log + + out if the error is irrecoverable. Remember that he can + + correct an access beyond end-of-file by doing an access before + + attempting another IOT. + + c. if he requests an I/O operation that you do not recognize, + + generate a "mode not available" error (via JOBRET) and wait + + for his next request. + + d. if you decide, for your own reasons, to make the initial open + + fail, you should log out. + +THE OJB DEVICE -- AN AID FOR DEBUGGING THE BDHî___ ___ ______ __ __ ___ ___ _________ ___ ___ + + One of the problems with debugging BDH programs is that when the + +JOB device is used, it is loaded into a newly created job. That job is + +not inferior to any DDT, and there is no way to put breakpoints in it + +before it starts. The OJB device makes it possible to run the BDH + +program under DDT. + + The OJB device acts just like the JOB device except during the + +initial open. When the JOB device would be creating and loading a new + +job, the OJB device is looking for an existing job whose UNAME and + +JNAME are the same as the filenames specified in the open. If such a + +job is found, it is connected to the job opening the OJB device + +through a standard JOB-BOJ pipeline. If such a job does not exist, + PTDD 14 SYS.xx.yy + + +the open of the OJB device fails. In order to protect innocent jobs + +from being hacked in this matter, the job opened on the OJB device is + +required to have set its OPTOJB bit (this is bit 4.2 in the .OPTION + +varisble, settable with .SUSET). Also, it must not already be a BDH, + +for the system cannot consider one job to be a BDH through two + +connections at once. If either of those conditions is not met, the + +OJB open WAITS until they are. + + To remove a possible timing screw, a BOJ device open by a job + +that is not a BDH, which usually fails, will wait instead for the job + +to become a BDH if the job's OPTOJB bit is set. + + The procedure for using the OJB device for debugging is: + + + 1. create a job to use for the BDH (call it J, in this example). + + 2. run (in another job) the program which would normally open + +the JOB device, but tell it (perhaps by means of a translation) to use + +the OJB device instead. This program's function is to issue system + +calls so that the BDH's responses to them can be tested. + + Since the OPTOJB bit of job J is now 0, when this program reaches + +the OJB open it will hang. + + 3. ^Z that program, and ^P it. it will go back to hanging in the + +open of the OJB device. + + 4. switch to job J, load in the BDH program. This RESET's the + +job so that if it had been a BDH before, it will not be one now. + + 5. turn on the OPTOJB bit by depositing from DDT in .OPTION. + +The conditions for a successful OJB open by job JJ have now been met, + +so that job will make some headway, turning job J into a BDH and + +waiting for job J to issue a JOBRET. + PTDD 15 SYS.xx.yy + + + 6. it is now possible to start running job J, with breakpoints + +as desired, to step through the code for handling the initial open. + +It is unlikely, but theoretically possible, for J to execute its BOJ + +open before JJ gets around to turning J into a BDH. In this case, J + +will wait for JJ to do so. + + 7. if it becomes necessary to try again after discovering a bug, + +go back to step 2. The OJB open will hang up this time not because + +the OPTOJB bit is off (since it is still 1) but because J is already a + +BDH. Loading J in step 4 will make J cease to be a BDH but also turn + +off the OPTOJB bit, so JJ will still be waiting. + + 8. it is possible for job JJ to be "PCLSR'ed" or backed up out + +of its open while job J is being traced through the handling of the + +initial open. For example, job JJ might receive a real-time + +interrupt. If that happens, J will cease to be a BDH. This will not + +interfere with the tracing of J until the next BOJ device system call + +is executed; that call will probably fail. It is impossible to + +continue after such an occurrence, so the jobs must be restarted by + +returning to step 2. Of course, if there are no breakpoints before + +the first JOBRET, this is very unlikely to happen. + + 9. if the initial open has been handled successfully, to go on + +to debug handling of other system calls, simply tell JJ to execute + +them with J stopped while JJ is being told, then ^Z^P JJ and go back + +to J. + + 10. the usual .LOGOUT in the BDH program will be a no-op when the + +program is run as an inferior in this manner, so it should be followed + +by a .VALUE. + \ No newline at end of file diff --git a/sysdoc/jobonl.100 b/sysdoc/jobonl.100 new file mode 100644 index 0000000..993f0f1 --- /dev/null +++ b/sysdoc/jobonl.100 @@ -0,0 +1,508 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +PROGRAMMING TECHNOLOGY DIVISION DOCUMENT SYS.xx.yy + +IDENTIFICATION + The JOB/BOJ Device: A Mechanism for Implementing + Non-standard Devices + Marc S. Seriff, Jack Haverty, Richard Stallman (MIT-AI) + September 18, 1974 + +INTRODUCTION + It is occasionally desirable to extend the ITS system to allow +for the use of non-standard I/O devices. A very desirable feature +would be to allow user-level programs to make use of the newly defined +devices with out modification of the user-level programs. For this +reason the JOB/BOJ device was implemented. + When a job (call it the user) attempts an OPEN for a file whose +name is "JOB: ; ", the system creates a +new job, called the BOJ device handler, or BDH (this is a terrible +name; it USES the BOJ device and HANDLES the JOB device), and attempts +to load the file "DSK: ; " into that job. +If the load fails, the OPEN will fail. If this load succeeds, the +OPEN, as well as all further I/O operations on the user's JOB channel +will be referred to the BDH for execution. At that point, it will be +up to the BDH to decide whether or not the open should fail. In order +to get a handle on information about the user's open, The BDH opens +one or more channels to the "BOJ" device. The system will insure that +the BDH's BOJ channel is logically linked to the user's JOB channel. + +The following diagram illustrates what happens: + + __________ _________ + | | | | + | User |-----v______+---->| BDH | + |__________| | | V--X---^ | | |_________| + | | System | | + ____| |____|_____| |____ + | | | + The JOB channel | The BOJ channel + | + V + System mediates + + Once the BDH has successfully opened the BOJ channel, it will be +notified (via an I/O channel interrupt) every time the user attempts +an I/O operation on the JOB channel. The BDH may then examine the +data that is made available to it about the I/O operation and may +simulate the operation for the user. In this way, BDHs can be written +to give anything the appearance of a disk, tape or other specific type +of I/O device. + +USING THE JOB DEVICE + Programs that use the JOB device should not be required to make +special provisions. A BDH should, in general, be written so that the +non-standard device will behave exactly like some standard device. In +other words, a user program may open a JOB device using a standard +open and may then execute any legal I/O operation. + + A file name with something other than "JOB" for a device code can +be made to act like a JOB device in one of two ways. The first way +should be used for devices that are not generally applicable or are +expected to be used only for a short time. To use this method simply +use translates (using MONIT, DDT or directly via system calls) to +inform the system which file should be used as a BDH. For instance, +if we translate all file names of the form "XXX:" into the file name +"JOB:ABC;TS RUNXXX", then the system will use the file "DSK:ABC;TS +RUNXXX" as the BDH for any file name whose device code is "XXX". + + The other method is much simpler and is designed for non-standard +devices that are to be made available to the entire user community. +When an OPEN is attempted on a device whose name the system does not +recognize, the system will examine the "DEVICE;" directory for a file +whose first name is "JOBDEV" and whose second name is the unrecognized +device name. If such a file exists, then the contents of that file +will be loaded by the system and used as the BDH for the user's OPEN. + +USING THE BOJ DEVICE - THE BOJ DEVICE HANDLER + + The BDH is the workhorse in the JOB/BOJ device scheme. It is +required to interpret all of the user's I/O operations. It must do +everything to make the non-standard device that it represents appear +standard. The system provides five .CALLs to give the BDH some of the +required communcation with the user. + + The first thing that the BDH should do when he is loaded and +started by the system is to execute an OPEN on the BOJ device. This +establishs a logical link between the user and the BDH. The BDH may +enable a channel interrupt on the BOJ channel, in order to be informed +whenever the user attempts an I/O operation. + + It should be noted that the ITS system allows for the possibility +of a full duplex connection between the user and the BDH (i.e. a +channel in each direction). If a user attempts an open for reading +and an open for writing on the same device, then the system will +present both opens to the same activation of the BDH. Should this be +undesirable for a particular BDH, that BDH should use an open mode +with the 3.4 bit set (10 in the left half) each time it attempts to +open the BOJ device. + +JOBCAL SYSTEM CALL + + The first .CALL that will be discussed is the JOBCAL. This call +enables the BDH to find out what I/O operation the user has attempted +to execute. It has the following calling sequence: + + .CALL JOBCAL + ... ; Error return + ... ; Success return + +JOBCAL: SETZ + SIXBIT/JOBCAL/ + [] + 2000,, + SETZ [-,,] + +This .CALL, as well as the other three discussed below, will fail to +skip if any of the following conditions hold: + + 1. is an illegal channel number. + 2. is not open on the BOJ device. + 3. the user job does not exist or as has closed his channel. + 4. the user job is no longer attempting to execute the I/O + operation. + + should be an address into which information about +the I/O operation requested will be placed. This word contains three +sections. The right half of the word contains an integer indicating +which operation was attempted. The following table indicates what the +various integers mean: + + CODE OPERATION + + 0 OPEN + 1 IOT (transfer) + 2 STATUS (currently unused) + 3 RESET + 4 RCHST (complete status) + 5 ACCESS + 6 FDELE (for delete or rename while not open) + 7 FDELE (for rename while open) + 8 CALL (see below) + +It is up to the BDH to insure that these I/O operations perform as +they would for standard ITS devices. + + The top three bits (4.9-4.7) of the op-code word contain the mode +in which user is attempting to open his channel. This is only +meaningful for op-code 0, OPEN. If either of the next two bits (4.6 +and 4.5) are non-zero, then the user is requesting that a channel be +closed. As was mentioned above, the system allows the connection +between user and BDH to be full duplex. If the 4.6 bit of the opcode +is set, then the user is requesting that his input channel be closed, +while the 4.5 bit requests a close of the user's output channel. It +is possible to get an opcode in which both bits are set. In the case +the BDH should perform the obvious task of closing both channels. + + Most I/O operations require more information than just the name +of the operation. The third argument to JOBCAL tells the system where +any additional information that is available should be placed. + is the largest number of words that the BDH is willing to + +accept (it should normally be 12). is the address where +the first word of the information should be placed. What information +is placed in this buffer is determined by the I/O operation being +attempted. + + If the op-code (in the right half of the op-code word) is less +than 8, then five words will be written into the buffer (beginning at +) in response to the JOBCAL. The meanings of the words are +given in the following table: + +WORD OPERATIONS MEANING + + 1 IOT (1) Meaningful only for block IOTs. + This word will contain the user's + IOT pointer. The left half of this + word will be the negative of the + number of words that the user wants. + + 1 ACCESS (5) The address within the virtual file + that is open from (or to) which the + next IOT should be done. The first + word of the virtual file is word + zero. + + 1 FDELE (6 or 7) Zero implies delete requested. + Non-zero means that a rename is + requested. This word is the name + (in sixbit) to be used as the new + first file name. + + 2 OPEN (0) or FDELE (6) First name of the file that the user + is attempting to open, rename or + delete. + + 3 OPEN (0) or FDELE (6) Second name of the file that the + user is attempting to open, rename + or delete. + + 4 OPEN (0) or FDELE (6) Name of directory to be used for + open, rename or delete. + + 5 OPEN (0) or FDELE (6) Name of device to be used for open, + rename or delete. + + 6 OPEN (0) The full 18 bit open mode (right + justified). + + 6 FDELE (6 or 7) Zero implies delete. Non-zero means + that a rename is requested. This + word is the name (in sixbit) to be + used as the new second file name. + + If the op-code returned by JOBCAL is 8, then the user has +attempted some I/O operation not recognized by the systems JOB/BOJ +device code (this does not mean that the operation is illegal). In +this case, more information is written into the BDH's buffer (up to +twelve words). The first of the data words will be the SIXBIT name of +the operation being performed. (This will normally be the name of the +.CALL executed by the user - see Appendix 1 for a list of +possiblities.) The second word will contain all of the flags that the +user has set using the "flag" feature of the .CALL UUO. The third +word will be an integer indicating how many input (to the system) +arguments the user supplied in his .CALL. It should be noted that if +this integer is larger than +3, then some information will be +lost. The values of the input arguments will appear in the remainder +of the words in the buffer. Remember that, in almost all cases, the +first of the input arguments will be the user's channel number. + +JOBRET SYSTEM CALL + + Once the BDH has interpreted the user's request for execution of +an I/O operation, the BDH must have some way of responding to the +user. This is provided with the JOBRET .CALL. This .CALL serves +three purposes: + + 1. to unblock the user who is waiting for completion of his + I/O request (possibly causing the request to skip) + + 2. to set lossage codes in the user's status words (e.g. for + failed opens). + + 3. to return information requested by the user's I/O + operation. + +The format of this CALL is as follows: + + .CALL JOBRET + ... ; error return + ... ; success return + +JOBRET: SETZ + SIXBIT /JOBRET/ + [] + [] + SETZ [-,,] + +where satisfies requirements 1 and 2 above. If + is zero, then the user's I/O call will not skip or set +status bits. If is of the form ,, , then + will be placed in the "open-loss" field of the status word for +the user's channel and the user's I/O call will skip times. A +list of all currently recognized open loss codes can be found in + +Appendix 2. + + If the user's I/O call requested data, then the BDH can supply +this data by supplying the third argument to the JOBRET call. The +system will use the words beginning at location as +the values for the return arguments in the user's call. + +SETIOC AND JOBINT -- INTERRUPT SYSTEM CALLS + + There are two interrupt oriented functions that the BDH must +perform and there are CALLs available to perform them. The first is +to notify the user when he has done something catastrophic. The user +should be notified of his error by causing the system to awaken him +with an I/O channel error. This done with the SETIOC call, as +follows: + + .CALL SETIOC + ... ; error return (standard reasons + + illegal IOCERR code) + ... ; success return + +SETIOC: SETZ + SIXBIT/SETIOC/ + [] + SETZ [] + +where is an integer identifying the reason for the +error. This integer should be chosen from the list that can be found +in Appendix 2. Since BDHs are written to handle non-standard devices, +these error codes will quite often not apply. Simply choose the code +that comes closest. + + Occassionally, the BDH must notify the user of a non-catastrophic +situation (e.g. the arrival of data). The JOBINT call allows the BDH +to give the user a second-word I/O channel interrupt, as follows: + + .CALL JOBINT + ... ; error return + ... ; success return + +JOBINT: SETZ + SIXBIT /JOBINT/ + SETZ [] + +JOBSTS SYSTEM CALL + + Finally, the BDH must have some way to notify the system what the +status of the pseudo-device is. For this purpose, the JOBSTS call is +available. Its calling sequence is as follows: + + .CALL JOBSTS + ... ; error return + ... ; success return + +JOBSTS: SETZ + SIXBIT /JOBSTS/ + [] + SETZ [] + +The right half of will be given to anyone requesting +the status of the user's channel until another JOBSTS is done. It +should be remembered that the low order six bits (1.1-1.6) should +contain the device code of the pseudo-device. Unless, you know what +you are doing, this should always be 22 octal. + +DATA TRANSFERS - HOW TO IOT + + Since the main purposes of I/O devices is transfer of +information, let us look at how the BDH manages to respond to the +user's IOTs. The method for doing this is very simply. If we think +back to the diagram presented early in this memo, we will remember +that the BOJ and JOB channels (i.e. the channels belonging to the BDH +and the user, respectively) are logically connected. The full meaning +of this now becomes clear. If the JOB channel is open for input and +the BOJ channel is open for output, then anything that BDH outputs on +the BOJ channel will be available to the user as input on the JOB +channel. (For this reason, the BDH must insure that he opens the BOJ +channel in the opposite direction from the user's JOB channel even if +this requires opening the BOJ channel a second time in the correct +mode.) + + There are two features of which the BDH implementer should be +aware when writing the I/O sections of the BDH. Let us assume for the +discussion here, that the user has the JOB channel open for reading +and that the BDH has the BOJ channel open for writing. Let us also +assume that the user is currently hung attempting to read 100 words on +his JOB channel. + + First it should be noted that the BDH does not have to respond to +this request with a single transfer of 100 words. The system will act +as an mediator between different transfer sizes. The BDH can respond +to the user's request for 100 words in several ways: + + 1. He can send all 100 words in small pieces (e.g. 10 + transfers of 10 words each. + 2. He can send all 100 words in a single transfer. + 3. He can send more than 100 words. In this case, the BDH + will remain hung in his IOT until the user has read all of + the data that the BDH is attempting to send. (If this is + undesirable, set the 3.5 in the BOJ open mode. This will + cause BOJ IOTs to unhang whenever the user's IOT is + satisfied. When that happens, the BOJ IOT pointer will + have been counted out only partially; the RH will point to + the first word not transfered) + 4. He may send less than 100 words. In this case, the BDH + must manually awaken the user as described below. + +The user, who is hung awaiting his 100 words, will stay hung until he +has received all 100 words. Suppose, however, that the BDH only +wishes to send 50 words (e.g. the last 50 words of the virtual file). +To do this, he can send the 50 words normally, but must then use the +JOBRET call (described above) to awaken the user. JOBRET should be +called with the BOJ channel number as the first argument, zero as the +second argument and no third argument. Secondly, the BDH implementer +must be aware that the ITS system guarantees that IOTs to a channel +open in block mode, will never generate an I/O channel error. In +other words, the following algorithm should be followed: + + 1. If the user requests n words and there are n words or more + left in the "file", give him n words. + 2. If the user requests n words and there are only m words + (n>m), give him m words and manually awaken him (using + JOBRET). + 3. If the user requests n words and there are no words left, + then give him nothing and manually awaken him (using + JOBRET). + +HINTS TO BDH IMPLEMENTERS + + The following hints should ease the task of BDH implementers a +little. It is hoped that anyone who attempts to a BDH implementation +will add his harshly acquired knowledge to this section of this memo. + +1. Remember that the BDH is essentially a disowned job and should + attempt to log out after a close has been requested. + +2. Be very leery of logging out for any reason other than a requested + CLOSE. In particular: + + a. if a JOBCAL fails, only log out if a request for OPEN has not + yet been received. + b. when you generate an I/O channel error for the user, only log + out if the error is irrecoverable. Remember that he can + correct an access beyond end-of-file by doing an access before + attempting another IOT. + c. if he requests an I/O operation that you do not recognize, + generate a "mode not available" error (via JOBRET) and wait + for his next request. + d. if you decide, for your own reasons, to make the initial open + fail, you should log out. + +THE OJB DEVICE -- AN AID FOR DEBUGGING THE BDH + + One of the problems with debugging BDH programs is that when the +JOB device is used, it is loaded into a newly created job. That job is +not inferior to any DDT, and there is no way to put breakpoints in it +before it starts. The OJB device makes it possible to run the BDH +program under DDT. + + The OJB device acts just like the JOB device except during the +initial open. When the JOB device would be creating and loading a new +job, the OJB device is looking for an existing job whose UNAME and +JNAME are the same as the filenames specified in the open. If such a +job is found, it is connected to the job opening the OJB device +through a standard JOB-BOJ pipeline. If such a job does not exist, +the open of the OJB device fails. In order to protect innocent jobs +from being hacked in this matter, the job opened on the OJB device is +required to have set its OPTOJB bit (this is bit 4.2 in the .OPTION +varisble, settable with .SUSET). Also, it must not already be a BDH, +for the system cannot consider one job to be a BDH through two +connections at once. If either of those conditions is not met, the +OJB open WAITS until they are. + + To remove a possible timing screw, a BOJ device open by a job +that is not a BDH, which usually fails, will wait instead for the job +to become a BDH if the job's OPTOJB bit is set. + + The procedure for using the OJB device for debugging is: + + 1. create a job to use for the BDH (call it J, in this example). + 2. run (in another job) the program which would normally open + the JOB device, but tell it (perhaps by means of a translation) + to use the OJB device instead. This program's function is to + issue system calls so that the BDH's responses to them can be + tested. + + Since the OPTOJB bit of job J is now 0, when this program reaches + the OJB open it will hang. + + 3. ^Z that program, and ^P it. it will go back to hanging in the + open of the OJB device. + 4. switch to job J, load in the BDH program. This RESET's the + job so that if it had been a BDH before, it will not be one now. + 5. turn on the OPTOJB bit by depositing from DDT in .OPTION. + +The conditions for a successful OJB open by job JJ have now been met, +so that job will make some headway, turning job J into a BDH and +waiting for job J to issue a JOBRET. + + 6. it is now possible to start running job J, with breakpoints +as desired, to step through the code for handling the initial open. +It is unlikely, but theoretically possible, for J to execute its BOJ +open before JJ gets around to turning J into a BDH. In this case, J +will wait for JJ to do so. + + 7. if it becomes necessary to try again after discovering a bug, +go back to step 2. The OJB open will hang up this time not because +the OPTOJB bit is off (since it is still 1) but because J is already a +BDH. Loading J in step 4 will make J cease to be a BDH but also turn +off the OPTOJB bit, so JJ will still be waiting. + + 8. it is possible for job JJ to be "PCLSR'ed" or backed up out +of its open while job J is being traced through the handling of the +initial open. For example, job JJ might receive a real-time +interrupt. If that happens, J will cease to be a BDH. This will not +interfere with the tracing of J until the next BOJ device system call +is executed; that call will probably fail. It is impossible to +continue after such an occurrence, so the jobs must be restarted by +returning to step 2. Of course, if there are no breakpoints before +the first JOBRET, this is very unlikely to happen. + + 9. if the initial open has been handled successfully, to go on +to debug handling of other system calls, simply tell JJ to execute +them with J stopped while JJ is being told, then ^Z^P JJ and go back +to J. + + 10. the usual .LOGOUT in the BDH program will be a no-op when the +program is run as an inferior in this manner, so it should be followed +by a .VALUE. diff --git a/sysdoc/kl.hung b/sysdoc/kl.hung new file mode 100644 index 0000000..fcbe5d7 --- /dev/null +++ b/sysdoc/kl.hung @@ -0,0 +1,44 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Sat, 14 Jul 84 02:43 EDT +From: David A. Moon +To: alan at MIT-MC.ARPA +cc: bug-its at MIT-MC.ARPA +Re: ITS seemed to be looping + +Things to try: + + Raise switch 0 (the switch 0 on the left). If this goes to DDT, it's + taking clock interrupts. + + Hit Break and type PC . If I remember correctly, you can read + the PC this way without halting the machine. There are some other status-type + commands; PCF is the PC flags, PI is the interrupt status. + + Hit Break and type SP . This stops the machine cleanly (between + instructions). If this works, the microcode isn't looping. Now you can + get the PC then type DDT (or ST 774000) to get into DDT and decode that PC. + + If the microcode is looping the SM command will restart it. This also does + nasty things like resetting the I/O bus. I think it preserves the PC though. + + There is a command file, J KLHUNG, which prints out everything in sight. 90% + of what it prints is worthless, but it includes micro and macro PCs. + +I believe there is a piece of paper taped to the machine that tells you to +do J KLHUNG. Of course there are a lot of pieces of paper taped to the machine! diff --git a/sysdoc/kl10.flklor b/sysdoc/kl10.flklor new file mode 100644 index 0000000..6441f28 --- /dev/null +++ b/sysdoc/kl10.flklor @@ -0,0 +1,69 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + KL10 Folklore + +Sometimes an MF10 memory gets hung. Often the INC RQ light will be +on. Sometimes raising the RESET switch inside the memory's front door +will help; sometimes a module in the port control is fried. (Any of +several modules.) + +TU41 blower belt has to correct belt, has to not be worn out, and has +to have pulleys aligned. Otherwise it drops off or breaks and tape +rotates backwards. + +RP04 oscillating seeks & Maytag mode when loading => tachometer output +needs to be adjusted. + +When powering machine back on, circuit breaker in disk DF10 may trip. + +When powering machine back on, sometimes disk #0 needs to be stopped, +powered off and on, and started again, to reset the two-massbus +switch. + +If DECtape motor doesn't win, may be G848 seating problem. + +If kicking the LA36 causes power fail, "power warn" lead to top left +edge of CPU backplane needs to be disconnected. (Apparently the other +end is unconnected.) [Missing ECO in 863.] + +Bad door-open switches (?) in MF10. Memories have to be operated with +over-ride turned on. + +Apparently power supplies in CPU and IO box can drift voltages. + +Apparently air-flow sensors can fail sporadically. I am told that +disconnecting one => indication of good airflow. + +RP04 attention/error conditions are super-random. + +Often mysterious marginality is caused by bad seating of modules. + +CONO'ing a PI channel off doesn't necessarily prevent it from +interrupting. It works to have each interrupt routine do CONSO to make +sure the channel is enabled, and dismiss if not. + +Before running a memory diagnostic, do PE0, because the memory +diagnostics don't know how to handle parity faults. + +MF10's always fail solidly. + +Obscure cases in the microcode tend to have bugs. E.g. you could +interrupt out of a PI cycle, hence BLKI/BLKO as interrupt instructions +tended to be flakey. + + \ No newline at end of file diff --git a/sysdoc/kl10.info b/sysdoc/kl10.info new file mode 100644 index 0000000..4e185f6 --- /dev/null +++ b/sysdoc/kl10.info @@ -0,0 +1,29 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +MOON@MIT-MC 11/17/75 17:30:16 Re: HANDY THINGS TO KNOW ABOUT KL10 +To: [.INFO.;KL10 INFO] at MIT-MC, MOON at MIT-MC +[1] WHEN RUNNING MEMORY DIAGNOSTICS, USE 'PE' COMMAND +TO TURN OFF PARITY CHECKING. +[2] WHEN RUNNING ANY DIAGNOSTIC, EVEN THE 'DG' SERIES, +YOU HAVE TO 'P U.RAM'. +[3] WHEN RUNNING DDDFA THE CHANNEL HAS TO BE IN KA + MODE. THIS IS A BUG IN THE PROGRAM. +[4] WHEN POWERING THE SYSTEM ON, THE LAST THING TO BE +TURNED ON HAS TO BE RP04 #0. OTHERWISE THE PDP11 CAN'T +ACCESS THAT DISK FOR SOME REASON. + diff --git a/sysdoc/locks.107 b/sysdoc/locks.107 new file mode 100644 index 0000000..ca77ec0 --- /dev/null +++ b/sysdoc/locks.107 @@ -0,0 +1,377 @@ + -*- Text -*- +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + + + This file contains documentation for both the LOCK device, + and the locked switch list and critical routine features. + + + +THE LOCK DEVICE. [ In ITS version 1630 and later ] + +The LOCK device provides a simple and foolproof technique for interlocking +between jobs. While not as efficient as using an AOSE-style switch in +shared memory, the LOCK device is much easier to use and is suitable for +use in those situations where a lock is only rarely siezed, and is only +held for brief periods of time. + +Locks are identified using a single SIXBIT word as a lock name. (Actually, +and non-zero 36-bit word can be used.) A job can lock the FOO lock by +opening "LOCK:FOO" for output. The LOCK device ignores any second filename +or directory name you might supply. The lock will be released when the +channel is closed. As long as the job keeps the lock channel open, any +other attempts to lock the same lock result in a %ENAFL (FILE LOCKED) +error. + +When opening the LOCK device, bit 1.4 indicates that the opener wishes to +hang waiting for the lock, rather than receiving a %ENAFL error. + +It is also possible to receive a %EFLDV (DEVICE FULL) error when opening +the LOCK device if the table of currently held locks that ITS maintains +overflows. + +Here is the registry of all lock names. Any program that uses the LOCK +device should register the name of the locks it uses here. + + Name Purpose + ------ ------ + NUTMEG This lock is used in an example later + on in this file. + + MBXxxx The set of locks whose names start with the + characters "MBX" are used by COMSAT and GMSGS to + coordinate access to mailboxes. The algorithm for + computing the lock for the mailbox named + SNAME;NAME1 NAME2 is: + + MOVE A,NAME1 + ROT A,1 + ADD A,NAME2 + ROT A,1 + ADD A,SNAME + IDIVI A,777773 ; Largest prime < 1,,0 + HRLI B,(SIXBIT /MBX/) ; Result in B = A + 1 + + + + +THE LOCKED SWITCH LIST AND CRITICAL ROUTINE FEATURES. + +There is an obvious technique for interlocking between jobs on +the PDP-10 - namely, the use of AOSE - which has been unusable +under ITS simply because a job might be killed while it had a +switch locked, thus causing the switch to remain locked forever. +These implemented features allow that problem, and the similar +problem of system crashes while a switch in a permanent data +base is locked, to be solved without any loss of efficiency. + +The locked switch list feature allows a program to maintain a +list of switches which it has locked, so that ITS can unlock +them when the job is killed (or logs out, or is gunned) +or is reset (for example, $l'd by DDT). The critical routine +feature allows the program to cause ITS to perform certain +actions if the job is killed or reset with the PC in a specified range. + +These features do not prevent bugs in the programs accessing +a switch from causing the switch not to be unlocked. They make +possible successful interlocking but do not guarantee it. + + +A. THE DEFINITIONS OF THE FEATURES. + +These features are all activated by setting the %OPLOK bit in +the .OPTION USET-variable to 1 (This bit is 1000,,). If that is +not done, words 43 and 44 are not in any way special. Also, the +addresses used do not have to be 43 and 44; that is merely their +default values. The actual adresses used are relative to the +contents of the .40ADDR USET-variable, which initially contains +40 . If .40ADDR were set to 1000, locations 1003 and 1004 would +used. Of course, all system actions that normally use locations +40, 41 and 42 would use 1000, 1001 and 1002. + + 1. THE LOCKED SWITCH LIST. + +When the %OPLOK bit is 1, location 43 is taken to be the pointer +to the job's locked switch list. The list pointer +should either be 0, meaning the list is empty, or the address of +the first two-word switch block. The format of a switch block is +as follows: + + 1st word: the switch, or, if the indirect bit is set in + the second word, the address of the switch + (multiple indirection is not allowed). + 2nd word: the RH holds the address of the next switch + block, or 0 (this is the CDR of the list). + the LH holds the instruction to be executed to + unlock the switch. The index field is ignored. + The instruction must either be an AOS or SOS + with 0 in the AC field, a logical instruction + (such as SETAM, IORM, SETOM, ANDCAM), a halfword + instruction, a MOVEM, MOVNM, MOVSM, MOVMM, + ADDM or SUBM. The AC will never be modified + even if the instruction + says to do so. If the LH is 0, the instruction + SETOM is used, as the most common choice. + +When the job is killed or reset, if the locked switch list is +not null, the system looks at the first switch block, unlocks +the switch by executing the unlock instruction with the switch +word as its memory argument, and the copying the RH of the +second word of the switch block into 43 to remove the block +from the list (this makes sure that no switch is ever unlocked +twice due to PCLSR'ing). +This procedure is repeated until 43 contains 0, +thus unlocking all the switches in the list. Obviously since the +job's pages are about to be discarded this action will have no +consequence unless the switches are in pages shared with other +jobs. + +If in the process of unlocking the switches +the system tries to read from a nonexistent page or write in a +pure page, it gives up entirely, ignoring the rest of the +locked switch list, and also the critical routine table. Also +if the end of the list is not reached after 512. switch blocks +have been unlocked, the system gives up. + + 2. THE CRITICAL ROUTINE TABLE. + +When the %OPLOK bit is 1, location 44 is considered to be an +AOBJN pointer to a table of critical sections of code, which are +involved in the manipulation of switches or the locked switch +list. The table should be a vector of two-word entries, one for +each critical section of code. The first word of each entry +should give the boundaries of the critical section: the left +half should have the the address of the first instruction of the +critical section; the right half, the address of the first +instruction after the critical section. The second word of the +entry should have an unlock instruction, subject to the same +restrictions as for locked switch list unlock instructions, +the only difference being that the address field of the +instruction is taken from the RH of the word, as one would expect, +whereas in unlock instructions in switch blocks the address of +the switch block is used, and the RH of the word is the CDR. +Examples will make all this clear. + +If the job is killed or reset while the PC is in the range +specified by a critical routine table entry, the switch +specified by the entry will be unlocked by executing the unlock +instruction. It is possible +for the ranges specified by two entries to overlap; to make sure +that no entry is processed more than once, the system updates 44 +as it processes each entry. + +As with the switch list unlocking, the system abandons the whole +thing if it needs to read or write in a page that won't allow it. + + 3. FATAL INTERRUPTS IN TOP-LEVEL JOBS WITH LOCKED LOCKS. + +When the %OPLKF bit in a job's .OPTION variable is set to 1, and if the job +is the top-level job of a non-disowned tree, then if that job ever receives +a fatal interrupt its locks will be unlocked by the system job as part of +the process of detaching it. Thus fatal interrupts in network servers, +toplevel DDTs, system demons, etc. that happen while those jobs have shared +databases locked, will not keep other jobs blocked waiting for someone to +gun down the corpse. + +The reason you might not want to set %OPLKF is that after a jobs locks are +unlocked, it will not in general work to proceed the job. Such a detached +corpse will only be good for autopsy, not revival. + + +B. USING THE FEATURES FOR SWITCHES IN A SHARED PAGE. + +In this section it is assumed that the page is not part of a +disk file, and will not survive through a system crash. That +means that it is not necessary to worry about unlocking switches +that are locked at the time of a system crash. + + 1. LOCKING AN AOSE-STYLE SWITCH. + +The proper routine to use for locking a switch follows: +The address of the two-word switch block is assumed to be in A. + +LOCK: AOSE (A) ;LOCK THE SWITCH, OR WAIT TILL WE CAN. + .HANG +LOCK1: MOVE B,43 ;PUT THE SWITCH ON THE + HRLI B,(SETOM) + MOVEM B,1(A) ;LOCKED SWITCH LIST + MOVEM A,43 +LOCK2: POPJ P, + +This routine will set up the switch as a switch block, and make +43 point to it. The contents of the switch block will be: + + 0 ;This word is the switch itself! + SETOM + ;The SETOM is the unlock instruction. + ;The RH has nothing to do with the SETOM; + ;it points to the next block of the list. + +Note that the HRLI instruction is superfluous, because 0 in the +left half of the second word of the block is the same as (SETOM). + +The three instructions starting at LOCK1 are critical because +the switch has been locked but is not on the locked switch list. +Therefore, an entry in the critical routine table of the form + + LOCK1,,LOCK2 + SETOM @A + +is needed, in case the job is killed while executing there. + + + 2. UNLOCKING AN AOSE-STYLE SWITCH. + +The correct way to unlock a switch follows: +(assuming that A points to the switch block and that +the switch block is the first item on the locked switch list). + +UNLOCK: HRRZ B,1(A) ;REMOVE THE SWITCH FROM THE + MOVEM B,43 ;LOCKED SWITCH LIST. +UNLOC1: SETOM (A) ;THEN UNLOCK THE SWITCH. +UNLOC2: POPJ P, + +The instruction at UNLOC1 is critical because the switch is +locked but not on the locked switch list. Therefore, an entry +is needed in the critical routine table as follows: + + UNLOC1,,UNLOC2 + SETOM @A + +Note that the switch must be removed from the list before +unlocking. That is because if the switch is locked but not on +the list, the critical routine table may be used to unlock it, +but if the switch is on the list but not locked, it will be set +to -1 if the job is killed, and that could cause problems if +some other job had locked the switch. + + +C. HANDLING SWITCHES IN DISK FILES. + +The extra problem here is to make sure that if the system crashes, the next +time the data base is accessed after the system is reloaded all the +switches will be reinitialized. This may be done by using the time and +date that the system was started to distinguish different incarnations of +it. + +The technique uses a variable INITDN, stored in the database, and a LOCK +device lock named "NUTMEG". Whenever a program accesses the database for +the first time, it must check INITDN. If INITDN does not equal the time +the system was started, the database requires initialization. If a job +detects that the database requires initialization, it seizes the NUTMEG +lock, checks to see that initialization really is required, performs the +initialization, updates INITDN, and releases the lock. + +The skeleton of the necessary routine is as follows, assuming that the file +has already been opened and its pages mapped into core with a CORBLK system +call, and INITDN is the address of the variable and SWIT1, SWIT2, etc. are +the addresses of switches. + +INIT: .CALL [ SETZ ? SIXBIT /RQDATE/ + MOVEM A ; Ignore 1st value + SETZM A] ; 2nd value is time of system startup. + .LOSE 1000 + JUMPL A,[MOVEI A,300. ; System doesn't know time, + .SLEEP A, ; Sleep 10. sec and hope it + JRST INIT] ; finds out the time. + CAMN A,INITDN ; Init needed? + POPJ P, ; No => No need for the lock, just return. + .CALL [ SETZ ? SIXBIT /OPEN/ + MOVSI 10\.UAO ; 1.4 => Hang waiting for initialization lock + MOVEI CH + MOVE [SIXBIT /LOCK/] + SETZ [SIXBIT /NUTMEG/]] ; Registered, database specific lock + .LOSE + CAMN A,INITDN ; Init needed? + JRST INIT1 ; No => someone else did it, unlock and return. + SETOM SWIT1 ; Start setting switches to unlocked + SETOM SWIT2 ; state. These insns should address + SETOM SWIT3 ; locations in the mapped file pages. + ;; etc. + SETOM SWIT9 + MOVEM A,INITDN ; Mark init complete. +INIT1: .CLOSE CH, + POPJ P, + +Note that the first CAMN A,INITDN can be omitted, and the algorithm is +still correct, but the second CAMN A,INITDN can -not- be safely omitted. + + +D. REFERENCE COUNTS. + +Sometimes it is desirable to keep a count of the number of jobs +looking at a data base. When the count is AOS'd, an entry must +be put on the locked switch list to cause it to be SOS'd if the +job is killed. For example, assuming that A points to the count +and B points to an available two word block of memory: + +LOOK: AOS (A) +LOOK1: MOVEM A,(B) + MOVSI C,(SOS @) + HRR C,43 + MOVEM C,1(B) ;SET UP UNLOCK INSN & CDR POINTER. + MOVEM B,43 ;PUT THE BLOCK ON THE LIST. +LOOK2: POPJ P, + +The critical code table entry needed is: + + LOOK1,,LOOK2 + SOS @A + +When finished looking, the count must be SOS'd, and removed from +the list. The following routine will work, assuming only that +the block at the front of the list was put on by the LOOK routine +above: + +UNLOOK: MOVE B,43 + HRRZ A,(B) ;GET ADDRESS OF THE COUNT VARIABLE TO BE SOS'D . + HRRZ B,1(B) ;GET CDR POINTER. +UNLOO1: MOVEM B,43 ;REMOVE BLOCK FROM LIST. +UNLOO2: SOS (A) ;DECREMENT THE COUNT. + POPJ P, + +The critical code table entry needed is: + + UNLOO1,,UNLOO2 + SOS @A + + +E. THE .HANG INSTRUCTION. + +The .HANG UUO is to make it easy for programs to wait for various +conditions, such as locks becoming unlocked. It should be used the way a +JRST .-1 would be used in a stand-alone program. .HANG is documented +completely in .INFO.;ITS UUOS. + + +F. THE UNLOCK SYSTEM CALL. + +The UNLOCK system call can be used to unlock the switches of a specified +job. Usually this is used by a job to unlock its own switches, but it can +be used on the switches of any job that the executing job is allowed to +write. + +Usual case: + + .CALL [ SETZ ? SIXBIT /UNLOCK/ + SETZI %JSELF ] ; Unlock all my switches + .LOSE %LSSYS + +(Note that this has nothing to do with the LOCK device. In particular it +will -not- close LOCK device channels.) diff --git a/sysdoc/locks.108 b/sysdoc/locks.108 new file mode 100644 index 0000000..871e298 --- /dev/null +++ b/sysdoc/locks.108 @@ -0,0 +1,377 @@ + -*- Text -*- +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + + + This file contains documentation for both the LOCK device, + and the locked switch list and critical routine features. + + + +THE LOCK DEVICE. [ In ITS version 1630 and later ] + +The LOCK device provides a simple and foolproof technique for interlocking +between jobs. While not as efficient as using an AOSE-style switch in +shared memory, the LOCK device is much easier to use and is suitable for +use in those situations where a lock is only rarely seized, and is only +held for brief periods of time. + +Locks are identified using a single SIXBIT word as a lock name. (Actually, +and non-zero 36-bit word can be used.) A job can lock the FOO lock by +opening "LOCK:FOO" for output. The LOCK device ignores any second filename +or directory name you might supply. The lock will be released when the +channel is closed. As long as the job keeps the lock channel open, any +other attempts to lock the same lock result in a %ENAFL (FILE LOCKED) +error. + +When opening the LOCK device, bit 1.4 indicates that the opener wishes to +hang waiting for the lock, rather than receiving a %ENAFL error. + +It is also possible to receive a %EFLDV (DEVICE FULL) error when opening +the LOCK device if the table of currently held locks that ITS maintains +overflows. + +Here is the registry of all lock names. Any program that uses the LOCK +device should register the name of the locks it uses here. + + Name Purpose + ------ ------ + NUTMEG This lock is used in an example later + on in this file. + + MBXxxx The set of locks whose names start with the + characters "MBX" are used by COMSAT and GMSGS to + coordinate access to mailboxes. The algorithm for + computing the lock for the mailbox named + SNAME;NAME1 NAME2 is: + + MOVE A,NAME1 + ROT A,1 + ADD A,NAME2 + ROT A,1 + ADD A,SNAME + IDIVI A,777773 ; Largest prime < 1,,0 + HRLI B,(SIXBIT /MBX/) ; Result in B = A + 1 + + + + +THE LOCKED SWITCH LIST AND CRITICAL ROUTINE FEATURES. + +There is an obvious technique for interlocking between jobs on +the PDP-10 - namely, the use of AOSE - which has been unusable +under ITS simply because a job might be killed while it had a +switch locked, thus causing the switch to remain locked forever. +These implemented features allow that problem, and the similar +problem of system crashes while a switch in a permanent data +base is locked, to be solved without any loss of efficiency. + +The locked switch list feature allows a program to maintain a +list of switches which it has locked, so that ITS can unlock +them when the job is killed (or logs out, or is gunned) +or is reset (for example, $l'd by DDT). The critical routine +feature allows the program to cause ITS to perform certain +actions if the job is killed or reset with the PC in a specified range. + +These features do not prevent bugs in the programs accessing +a switch from causing the switch not to be unlocked. They make +possible successful interlocking but do not guarantee it. + + +A. THE DEFINITIONS OF THE FEATURES. + +These features are all activated by setting the %OPLOK bit in +the .OPTION USET-variable to 1 (This bit is 1000,,). If that is +not done, words 43 and 44 are not in any way special. Also, the +addresses used do not have to be 43 and 44; that is merely their +default values. The actual adresses used are relative to the +contents of the .40ADDR USET-variable, which initially contains +40 . If .40ADDR were set to 1000, locations 1003 and 1004 would +used. Of course, all system actions that normally use locations +40, 41 and 42 would use 1000, 1001 and 1002. + + 1. THE LOCKED SWITCH LIST. + +When the %OPLOK bit is 1, location 43 is taken to be the pointer +to the job's locked switch list. The list pointer +should either be 0, meaning the list is empty, or the address of +the first two-word switch block. The format of a switch block is +as follows: + + 1st word: the switch, or, if the indirect bit is set in + the second word, the address of the switch + (multiple indirection is not allowed). + 2nd word: the RH holds the address of the next switch + block, or 0 (this is the CDR of the list). + the LH holds the instruction to be executed to + unlock the switch. The index field is ignored. + The instruction must either be an AOS or SOS + with 0 in the AC field, a logical instruction + (such as SETAM, IORM, SETOM, ANDCAM), a halfword + instruction, a MOVEM, MOVNM, MOVSM, MOVMM, + ADDM or SUBM. The AC will never be modified + even if the instruction + says to do so. If the LH is 0, the instruction + SETOM is used, as the most common choice. + +When the job is killed or reset, if the locked switch list is +not null, the system looks at the first switch block, unlocks +the switch by executing the unlock instruction with the switch +word as its memory argument, and the copying the RH of the +second word of the switch block into 43 to remove the block +from the list (this makes sure that no switch is ever unlocked +twice due to PCLSR'ing). +This procedure is repeated until 43 contains 0, +thus unlocking all the switches in the list. Obviously since the +job's pages are about to be discarded this action will have no +consequence unless the switches are in pages shared with other +jobs. + +If in the process of unlocking the switches +the system tries to read from a nonexistent page or write in a +pure page, it gives up entirely, ignoring the rest of the +locked switch list, and also the critical routine table. Also +if the end of the list is not reached after 512. switch blocks +have been unlocked, the system gives up. + + 2. THE CRITICAL ROUTINE TABLE. + +When the %OPLOK bit is 1, location 44 is considered to be an +AOBJN pointer to a table of critical sections of code, which are +involved in the manipulation of switches or the locked switch +list. The table should be a vector of two-word entries, one for +each critical section of code. The first word of each entry +should give the boundaries of the critical section: the left +half should have the the address of the first instruction of the +critical section; the right half, the address of the first +instruction after the critical section. The second word of the +entry should have an unlock instruction, subject to the same +restrictions as for locked switch list unlock instructions, +the only difference being that the address field of the +instruction is taken from the RH of the word, as one would expect, +whereas in unlock instructions in switch blocks the address of +the switch block is used, and the RH of the word is the CDR. +Examples will make all this clear. + +If the job is killed or reset while the PC is in the range +specified by a critical routine table entry, the switch +specified by the entry will be unlocked by executing the unlock +instruction. It is possible +for the ranges specified by two entries to overlap; to make sure +that no entry is processed more than once, the system updates 44 +as it processes each entry. + +As with the switch list unlocking, the system abandons the whole +thing if it needs to read or write in a page that won't allow it. + + 3. FATAL INTERRUPTS IN TOP-LEVEL JOBS WITH LOCKED LOCKS. + +When the %OPLKF bit in a job's .OPTION variable is set to 1, and if the job +is the top-level job of a non-disowned tree, then if that job ever receives +a fatal interrupt its locks will be unlocked by the system job as part of +the process of detaching it. Thus fatal interrupts in network servers, +toplevel DDTs, system demons, etc. that happen while those jobs have shared +databases locked, will not keep other jobs blocked waiting for someone to +gun down the corpse. + +The reason you might not want to set %OPLKF is that after a jobs locks are +unlocked, it will not in general work to proceed the job. Such a detached +corpse will only be good for autopsy, not revival. + + +B. USING THE FEATURES FOR SWITCHES IN A SHARED PAGE. + +In this section it is assumed that the page is not part of a +disk file, and will not survive through a system crash. That +means that it is not necessary to worry about unlocking switches +that are locked at the time of a system crash. + + 1. LOCKING AN AOSE-STYLE SWITCH. + +The proper routine to use for locking a switch follows: +The address of the two-word switch block is assumed to be in A. + +LOCK: AOSE (A) ;LOCK THE SWITCH, OR WAIT TILL WE CAN. + .HANG +LOCK1: MOVE B,43 ;PUT THE SWITCH ON THE + HRLI B,(SETOM) + MOVEM B,1(A) ;LOCKED SWITCH LIST + MOVEM A,43 +LOCK2: POPJ P, + +This routine will set up the switch as a switch block, and make +43 point to it. The contents of the switch block will be: + + 0 ;This word is the switch itself! + SETOM + ;The SETOM is the unlock instruction. + ;The RH has nothing to do with the SETOM; + ;it points to the next block of the list. + +Note that the HRLI instruction is superfluous, because 0 in the +left half of the second word of the block is the same as (SETOM). + +The three instructions starting at LOCK1 are critical because +the switch has been locked but is not on the locked switch list. +Therefore, an entry in the critical routine table of the form + + LOCK1,,LOCK2 + SETOM @A + +is needed, in case the job is killed while executing there. + + + 2. UNLOCKING AN AOSE-STYLE SWITCH. + +The correct way to unlock a switch follows: +(assuming that A points to the switch block and that +the switch block is the first item on the locked switch list). + +UNLOCK: HRRZ B,1(A) ;REMOVE THE SWITCH FROM THE + MOVEM B,43 ;LOCKED SWITCH LIST. +UNLOC1: SETOM (A) ;THEN UNLOCK THE SWITCH. +UNLOC2: POPJ P, + +The instruction at UNLOC1 is critical because the switch is +locked but not on the locked switch list. Therefore, an entry +is needed in the critical routine table as follows: + + UNLOC1,,UNLOC2 + SETOM @A + +Note that the switch must be removed from the list before +unlocking. That is because if the switch is locked but not on +the list, the critical routine table may be used to unlock it, +but if the switch is on the list but not locked, it will be set +to -1 if the job is killed, and that could cause problems if +some other job had locked the switch. + + +C. HANDLING SWITCHES IN DISK FILES. + +The extra problem here is to make sure that if the system crashes, the next +time the data base is accessed after the system is reloaded all the +switches will be reinitialized. This may be done by using the time and +date that the system was started to distinguish different incarnations of +it. + +The technique uses a variable INITDN, stored in the database, and a LOCK +device lock named "NUTMEG". Whenever a program accesses the database for +the first time, it must check INITDN. If INITDN does not equal the time +the system was started, the database requires initialization. If a job +detects that the database requires initialization, it seizes the NUTMEG +lock, checks to see that initialization really is required, performs the +initialization, updates INITDN, and releases the lock. + +The skeleton of the necessary routine is as follows, assuming that the file +has already been opened and its pages mapped into core with a CORBLK system +call, and INITDN is the address of the variable and SWIT1, SWIT2, etc. are +the addresses of switches. + +INIT: .CALL [ SETZ ? SIXBIT /RQDATE/ + MOVEM A ; Ignore 1st value + SETZM A] ; 2nd value is time of system startup. + .LOSE 1000 + JUMPL A,[MOVEI A,300. ; System doesn't know time, + .SLEEP A, ; Sleep 10. sec and hope it + JRST INIT] ; finds out the time. + CAMN A,INITDN ; Init needed? + POPJ P, ; No => No need for the lock, just return. + .CALL [ SETZ ? SIXBIT /OPEN/ + MOVSI 10\.UAO ; 1.4 => Hang waiting for initialization lock + MOVEI CH + MOVE [SIXBIT /LOCK/] + SETZ [SIXBIT /NUTMEG/]] ; Registered, database specific lock + .LOSE + CAMN A,INITDN ; Init needed? + JRST INIT1 ; No => someone else did it, unlock and return. + SETOM SWIT1 ; Start setting switches to unlocked + SETOM SWIT2 ; state. These insns should address + SETOM SWIT3 ; locations in the mapped file pages. + ;; etc. + SETOM SWIT9 + MOVEM A,INITDN ; Mark init complete. +INIT1: .CLOSE CH, + POPJ P, + +Note that the first CAMN A,INITDN can be omitted, and the algorithm is +still correct, but the second CAMN A,INITDN can -not- be safely omitted. + + +D. REFERENCE COUNTS. + +Sometimes it is desirable to keep a count of the number of jobs +looking at a data base. When the count is AOS'd, an entry must +be put on the locked switch list to cause it to be SOS'd if the +job is killed. For example, assuming that A points to the count +and B points to an available two word block of memory: + +LOOK: AOS (A) +LOOK1: MOVEM A,(B) + MOVSI C,(SOS @) + HRR C,43 + MOVEM C,1(B) ;SET UP UNLOCK INSN & CDR POINTER. + MOVEM B,43 ;PUT THE BLOCK ON THE LIST. +LOOK2: POPJ P, + +The critical code table entry needed is: + + LOOK1,,LOOK2 + SOS @A + +When finished looking, the count must be SOS'd, and removed from +the list. The following routine will work, assuming only that +the block at the front of the list was put on by the LOOK routine +above: + +UNLOOK: MOVE B,43 + HRRZ A,(B) ;GET ADDRESS OF THE COUNT VARIABLE TO BE SOS'D . + HRRZ B,1(B) ;GET CDR POINTER. +UNLOO1: MOVEM B,43 ;REMOVE BLOCK FROM LIST. +UNLOO2: SOS (A) ;DECREMENT THE COUNT. + POPJ P, + +The critical code table entry needed is: + + UNLOO1,,UNLOO2 + SOS @A + + +E. THE .HANG INSTRUCTION. + +The .HANG UUO is to make it easy for programs to wait for various +conditions, such as locks becoming unlocked. It should be used the way a +JRST .-1 would be used in a stand-alone program. .HANG is documented +completely in .INFO.;ITS UUOS. + + +F. THE UNLOCK SYSTEM CALL. + +The UNLOCK system call can be used to unlock the switches of a specified +job. Usually this is used by a job to unlock its own switches, but it can +be used on the switches of any job that the executing job is allowed to +write. + +Usual case: + + .CALL [ SETZ ? SIXBIT /UNLOCK/ + SETZI %JSELF ] ; Unlock all my switches + .LOSE %LSSYS + +(Note that this has nothing to do with the LOCK device. In particular it +will -not- close LOCK device channels.) diff --git a/sysdoc/magtap.101 b/sysdoc/magtap.101 new file mode 100644 index 0000000..00febfe --- /dev/null +++ b/sysdoc/magtap.101 @@ -0,0 +1,223 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +MAG TAPE SPECS +Copied from memo from S.Cutler 2/23/72 +THIS MEMO CONTAINS MANY LOWER-CASE CHARS + +Bits in left half word of .OPEN call: +3.1=1,,0 + 0=> Input + 1=> Output + +3.2=2,,0 + 0=> Unit + 1=> Block + +3.3=4,,0 + 0=> ASCII + 1=> Image + +3.4=10,,0 + 0=> Ignore record gaps,treat them as part of the hardware + 1=> "Chunk mode." [does not appear to be implemented any more] + If output then write an EOR gap after each .IOT. + If input, if user defined block IOT pointer is big enough + one record is read. See .IOT for details. Must be + opened in block mode. + +3.5=20,,0 + 0=> Skip to EOF on last close on read + 1=> Don't " " " " " " " + +3.6=40,,0 + 0=> Odd parity + 1=> Even parity + +3.7,8=300,,0 + 00=> default (800 or 1600 BPI depending on drive type) + 01=> 800 BPI (used to be 200 BPI) + 10=> 1600 BPI (used to be 556 BPI) + 11=> 6250 BPI (used to be 800 BPI) + +3.9=400,,0 Only meaningful for 9 track tapes + 0=> Core dump mode, 36 bit words, any density allowed. + 1=> IBM Character Mode, 32 bit words, doesn't allow 200/556 BPI + +4.1,2,3=7000,,0 + 0=> 2000=1024. words per record + 1=> 1000=512. WPR + 2=> 400=256. WPR + 3=> 200=128. WPR + 4=> 100=64. WPR + 5=> 40=32. WPR + 6=> 20=16. WPR + 7=> 10=8. WPR + +Open error if: + 1) Open for writing and + a) Open for reading on another channel + b) Tape write locked (i.e. no ring) + c) IBM mode and less than 800 BPI + 2) Open for reading and already open for writing on another + channel + 3) Transport not on line + 4) Chunk mode and not block mode + + +.IOT CHNM,LOC +------------- + +For standard .OPEN, this works as a standard .IOT. If open +in chunk mode input [not implemented any more], loc has + + loc/ -count,,loc2 + +where count is a number greater than the possible number of words to +be written into core. The .IOT causes words to be read into core +starting at loc2. For each word read, the count in decreased by one. +An IOC error occurs if the count is too small to contain the +record. + +On chunk mode output, an EOR gap is written after each .IOT, +and the tape is written after each .IOT instead of waiting for +system buffers to fill or the channel closed. [not implemented any more] + + + + +.CLOSE CHNM, +------------ + +Closes the channel, releases the transport if not open on another +channel. Writes out all buffers in the system and writes 2 EOF +marks if open for writing, and backs up over second one. + + + + +.STATUS CHNM,LOC +---------------- + +1.1-1.6=> physical device code (15) + +1.7-1.9 mode open in + +2.1=> System buffering capacity empty (i.e. 0=> data read from + tape and not yet transferred to user by a .IOT or data + .IOTed from the user to the system but not actually + written onto tape or user core image.) + +2.2=> System buffering capacity full (i.e. no core in which to + allocate buffers for reading from tape. Also too many + buffers resident in system but not yet written onto either + tape or users core image.) + +2.3=> 1=> Beginning of tape + +2.4=> 1=> End of tape + +2.5=> 1=> 9 track, 0=> 7 track + +2.6=> 1=>IBM mode, 0=> core dump mode + +2.7=> Transport idle (no pending command) + +2.8=> EOF (last thing seen was a tape mark) + +Left half standard. + + + + +.RCHST AC, +---------- + +AC/ CHNM,,LOC + +LOC: 0) 0,,(SIXBIT /MTn/) + 1) 0 + 2) 0 + 3) 0 + 4) -1 + + + + +.MTAPE AC, +---------- + +AC/ CHNM,,COMAND + +COMAND/ COUNT,,FUNCTION + +Right half of COMAND + 0=> Hang until all tape motions finish + 1=> Rewind + 2=> Rewind and unload (also shreds tape leader) + 3=> Write EOR. Writes out current system buffers even if + less than record size and writes an EOR gap. + 4=> Write 3 inches of blank tape + 5=> Write EOF. (Two EOF's are written automatically + after a close on a channel open for writing.) + 6=> Space forward COUNT records. COUNT=0 implies 1 + record. COUNT negative implies space reverse. Stops + at EOF or BOT. + 7=> Space forward +- COUNT files. (Stops at BOT or + logical EOT.) + 8.=> Space forward to logical EOT, back up over second + EOF. + 9.=> Stop and reset the tape system. + 10.=> Set write record size to COUNT words. + 11.=> Read into AC write record size or size of last record + gobbled by an input IOT. + +Skips if successful. + +Rewind and space only if open for reading. + +Write EOR, 3 inch, EOF writing only. + +Stop and hang for both read and write. + + + + +Transport State Notes +--------- ----- ----- + +A transport turned off or off line is equivalent to not being there. + +Tape can not be written unless the write enable ring is in the hub +of the tape. + +A transport can be opened by an arbitrary number of channels in +different modes, but can not be opened by more than one user, or in +both input and output. The device dependent bits (3.4-4.9) must be +the same for all channels with the exception of chunk mode. + + +The logical end of tape (EOT) is located after two EOF's in a +row. A close on a channel open for writing writes two EOF's and +then backspaces over one of them. The .MTAPE command to go to +the end of the tape also backspaces over the second EOF. + +If the physical end of tape mark is reached while writing a record, +the record is finished being output (there is always room for a few +records after the reflective strip) and an IOC error is raised +saying End of Tape. + \ No newline at end of file diff --git a/sysdoc/mldev.protoc b/sysdoc/mldev.protoc new file mode 100644 index 0000000..305c0c0 --- /dev/null +++ b/sysdoc/mldev.protoc @@ -0,0 +1,171 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +MLDEV/MLSLV protocol + +The MLDEV protocol is a binary file transfer protocol used between ITS +systems for the transfer of files. It depends heavily upon the ITS job +device feature and the ITS system calls and error codes. For a more +detailed description of the ITS system calls, read the ITS UUO and +symbolic system call manuals. + +The name MLDEV is historical, dating back to the days when this protocol +was used mostly to reference ML's file system from AI (and vice versa). +The MLDEV server is called MLSLV, for "ML slave". + +ICP is to socket 305 if doing mostly input, 307 if mostly output. + User commands: + +Command format: to slave +AOBJN pointer (RH = command code) +Block of arguments + +Command codes: +COPENI==1 OPEN for input + arg1: Device + arg2: FN1 + arg3: FN2 + arg4: SNAME + arg5: OPEN mode + +COPENO==2 OPEN for output + arg1: Device + arg2: FN1 + arg3: FN2 + arg4: SNAME + arg5: OPEN mode + +CDATA==3 Write data (Word count includes data words and byte count word) + arg1: # of bytes of data + args: Data, packed ILDB-style into at most 200 words + +CALLOC==4 Read allocate + Allocation in bytes + +CICLOS==5 Input CLOSE + Ignored argument + +COCLOS==6 Output CLOSE + Ignored argument + +CFDELE==7 DELETE or RENAME + arg1: Device + arg2: FN1 + arg3: FN2 + arg4: 0 or new FN1 + arg5: 0 or new FN2 + arg6: SNAME + +CRNMWO==10 RENAME while open + arg1: new FN1 + arg2: new FN2 + +CNOOP=11 No-op + arg: Echoed by the no-op reply + +CACCES==12 ACCESS + arg1: Transaction number + arg2: Access pointer + arg3: New allocation + +CSYSCL==13 Random system call. 11 (decimal) arguments + arg1: System call name in sixbit + arg2: Flags (control-bit argument) + arg3: Number of following arguments that have significance + arg4: 1st argument to system call + ... + arg11: 8th argument to system call + +CREUSE==14 Reinitialize yourself, because we are about to be reused + by a new creator for a new file + Server replies + +Reply format: from slave +AOBJN pointer (RH = reply code) +Block of arguments + +R==,,-1 Reply codes: + +RDATA==1 Input data (word count includes data words and byte count word) + arg1: # of bytes of data + args: Data, packed ILDB-style into words. + Note: Slave must always send fully populated words except when + EOF is reached. + +ROPENI==2 Input OPEN status; 1 or 11 arguments + arg1: -1  succeeded >0  OPEN loss number + arg2arg11 are present only if arg1 is -1 + arg2: Real device name (usually SIXBIT/DSK/) + arg3: Real FN1 + arg4: Real FN2 + arg5: Real SNAME + arg6: File length + arg7: Byte size open in + arg8: File length in byte size written in + arg9: Byte size written in + arg10: FILDTP - -1 if RFDATE wins on this file + arg11: Creation data (if RFDATE wins) + +ROPENO==3 Output OPEN status. 1 or 11 arguments + arg1: -1  succeeded >0  OPEN loss number + arg2-arg11 present only if arg1 is -1 + arg2: Real device name + arg3: Real FN1 + arg4: Real FN2 + arg5: Real SNAME + arg6: File length (-1  FILLEN fails on this device) + arg7: Byte size open in + arg8: File length in byte size written in + arg9: Byte size written in + arg10: FILDTP - -1 if RFDATE wins on this file + arg11: Creation data (if RFDATE wins) + +REOF==4 EOF on input + Ignored argument + +RFDELE==5 DELETE/RENAME status. 1st argument: + RH: -1  succeeded + 0  failure code + LH: -1  DELETE or RENAME + 0  RENAME while open + If RENAME while open call succeeded, there are 4 more arguments: + arg2: Real device name + arg3: Real FN1 (as renamed) + arg4: Real FN2 + arg5: Real SNAME + +RNOOP==6 No-op reply + arg: Echo argument send by no-op command + +RACCES==7 Acknowledge access + arg: Transaction number from CACCES + +RSYSCL==10 Respond to system call. 9 arguments + arg1: ,,<# of times call skipped> + arg2: 1st value from system call + ... + arg9: 8th value from system call + +RICLOS==11 Respond to input CLOSE + +ROCLOS==12 Respond to output CLOSE + +RIOC==13 Reflect an IOC error + arg: IOC error code, right-justified in word + +RREUSE==14 Acknowledge a CREUSE + Ignored argument diff --git a/sysdoc/ncp.100 b/sysdoc/ncp.100 new file mode 100644 index 0000000..5756489 --- /dev/null +++ b/sysdoc/ncp.100 @@ -0,0 +1,858 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Warning- don't believe everything in this file! + + + ITS NCP INTERFACE + +CALL: .OPEN + + FUNCTION: OPEN channel to Network + + ARGUMENT TEMPLATE: + 1. Channel number in AC field of .OPEN instruction + 2. 4 word block addressed by @ E (X) field of + .OPEN instruction + 4 word block has this form: + + _________________________________________________ + | | | + | MODE BITS | SIXBIT /NET/ | + |_______________________|_______________________| + | | + | LOCAL SOCKET | + |_______________________________________________| + | | + | FOREIGN SOCKET | + |_______________________________________________| + | | + | FOREIGN HOST | + |_______________________________________________| + + + MODE BITS + + |--------- don't buffer more + | output than allocation + | + | |----- 0-200 words + | | 1-2000 words + | | +____________________________________________________________________________ +| | | | | |out|big|by- lis gen|im- | +| | SIZE OF BYTE | | |ctl|buf| te ten sok|age blk out| +|___________|___________|___________|___|___|___|___|___|___|_#_|___|___|___| + | | | | |_____| +BYTE SIZE IF | 0-"NORMAL" | | | | +MODE=44 __| 1-8 BIT BYTE SIZE _______| | | +(BYTE & IMAGE) IF ASCII | | STANDARD + USE BYTE FIELD | | ITS + IF IMAGE | | MODES + | | ______________ + 0-"NORMAL" | | | | + 1-LISTEN ON ___________| | | 0XX ASCII | + LOCAL SOCKET | | 1XX IMAGE | + | | X0X UNIT | + 0-USE LOCAL | | X1X BLOCK | + SOCKET FIELD | | XX0 INPUT | + 1-GENERATE _______________| | XX1 OUTPUT | + "UNIQUE" SOCKET |____________| + # (USE .RCHST + TO FIND OUT + RESULT) + + + + LOCAL SOCKET + 32 bit socket # for local identification + + FOREIGN SOCKET + 32 bit socket # determined by foreign host + system + + FOREIGN HOST + 8 bit socket # specifying computer system + with which to contact + + + RETURNS: None + + SKIPS: No Skip If Fails + + FAILURE RETURNS: + Indicated in LH of .STATUS value (low order 6 bits + in LH) + i.e. .STATUS ch, ac + LDB ac, [220600,,ac] + + CODE____ + + 2 "WRONG DIRECTION" + (gender of socket wrong for mode) + + 6 "DEVICE FULL" + (socket table full) + + 7 "DEVICE NOT READY" + (NCP not up, or IMP not up) + + 13 "FILE ALREADY EXISTS" + (socket already open by you on another channel) + + 22 "CONTRADICTORY OPEN" + (byte size mismatched) + + 23 "FILE LOCKED" + (socket number not part of your allocated + "unique" group of 8 allocated to your job) + + 41 "OTHER END OF PIPELINE GONE OR NOT OPEN" + (HOST dead or non-existant see NETHST call) + + + SIDE EFFECTS: + + + + EXAMPLES: + ;to listen .OPEN ch, listen + JRST fail + . + . + + Listen: 20,,'NET + 1 ;waiting socket + 0 ;socket determined when + matching RFC received + 0 ;host determined when + matching RFC received + + + :to get "unique socket" + .OPEN ch, unique + JRST fail + + :Unique 10,,'NET + 0 ;determined by system + 1305 ;foreign socket + 6 ;foreign host + + +Equivalent: + + .CALL OPEN + + arg 1 mode,,channel number + arg 2 SIXBIT/NET/ + arg 3 local socket + arg 4 foreign socket + arg 5 host number + + +CALL: .RCHST + + FUNCTION: Read extended STatus of network CHannel + + ARGUMENT TEMPLATE: AC/ channel,, + + + RETURNS: + WORD _________________________________ + | | | + 0 | | 'NET | + |_______________|_______________| + | | + 1 | LOCAL SOCKET | + |_______________________________| + | | + 2 | FOREIGN SOCKET | + |_______________________________| + | | | BYTE | | + 3 | I | (reserved)| SIZE | HOST | + |___|___________|_______|_______| + | | | + 4 | IMP DOWN | STATE | + |_______________|_______________| + | | | + 5 | (reserved) | CLS | + |_______________|_______________| + | | | + 6 | (reserved) | #BITS | + |_______________|_______________| + + + INTERRUPT + 4.9 bit of word 3 + set by receipt over network of INR/INS + control message (see protocol) + cleared by .RESET + causes interrupt on channel + + BYTE SIZE + 9 bit field + byte size of connection (bits 2.9 - 2.1) + + HOST + 9 bit field (8 used by Network foreign host #) + + IMP DOWN + time in 1/30 sec. until IMP going down + (if planned) + -1 not going down + 0 down + +n planned to go down in n/30 sec. + (see also NETIMP call) + + + STATE + %NSCLS 0 connection closed + %NSLSN 1 listening for RFC + %NSRFC 2 RFC in to listen + %NSRCL 3 CLS received after RFC + %NSRFS 4 RFC sent + %NSOPN 5 open + %NSRFN 6 RFNM wait on output + %NSCLW 7 CLS sent, waiting for matching CLS + %NSCLI 10 CLS received data available to input + %NSINP 11 input available + + + REASON FOR CLS (state 0) + %NCNTO 0 never opened connection (not .OPEN) + %NCUSR 1 CLS by user (.CLOSE) + %NCFRN 2 CLS by foreign host + %NCRST 3 RST (reset) from foreign host (dead) + %NCDED 4 host dead (see also NETHST call) + %NCINC 5 incomplete transmission (see NETHST) + %NCBYT 6 byte size mismatch + %NCNCP 7 local NCP went down, breaking connection + %NCRFS 10 connection refused by foreign host + + + SKIPS: No skip + + FAILURE RETURNS: None + + + SIDE EFFECTS: None + + + EXAMPLE: + MOVE ac, [ch,,blk] + .RCHST ac, + . + . + + BLK: BLOCK 7 + +Equivalent: + + .CALL RCHST + + arg 1 network channel number + + val 1 'NET,,0 + val 2 local socket number + val 3 foreign socket number + val 4 4.9 interrupt received + 2.1-2.9 byte size + 1.1-1.9 host number + val 5 LH IMP Down time/reason + RH Socket state (%NSxxx) + val 6 Open mode + val 7 RH Close reason (%NCxxx) + val 8 RH Number of bits____ available + (input data available or output buffer room) + + +.CALL WHYINT + + arg 1 network channel number + + val 1 %WYNET + val 2 Socket state (%NSxxx) + val 3 Number of bytes_____ available + (input data available or output buffer room) + val 4 Close reason (%NSxxx) + +This call is usually used to respond to a second-word interrupt +from a network channel. + + + +CALL: .STATUS + + FUNCTION: Reads status of Network channel + + ARGUMENT TEMPLATE: + Channel number in AC field of .STATUS instruction + + RETURNS: Status of word in location addressed by + @ E (X) fields of .STATUS instruction + + SKIPS: No skip + + + FAILURE RETURNS: None + + SIDE EFFECTS: None + + EXAMPLE: + .STATUS ch, statwd + Statwd: BLOCK 1 + + + FORMAT OF STATUS WORD + + _________________________________ + | | | + | ERROR CODE | SS0026 | + |_______________|_______________| + + + ERROR CODE + if IOC (I/O channel error) or OPEN failure, + codes will be stored here. + + SS + state (byte 140600), same as that given for + .RCHST -- see list of states + + 26 + code for Network device + + +Equivalent: + + .CALL STATUS + + arg 1 channel number + + val 1 status word as above + + + +CALL: .NETACC + + FUNCTION: NETwork ACcepts Connection (after LISTEN type + .OPEN) + (to REJECT, do a .CLOSE) + + ARGUMENT TEMPLATE: + Channel number in AC field of .NETACC instruction + + RETURNS: Nothing + + SKIPS: Skips on success + + FAILURE RETURNS: + Not skip --not in state 2 (RFC received to LISTEN) + + SIDE EFFECTS: Sends matching RFC (and "allocate" if input) + + EXAMPLE: + .NETACC ch, + JRST error + + + + + +CALL: .NETS + + FUNCTION: NET Send buffer now + (Buffer is normally sent when "full" or after + 1/2 second of first activity) + + ARGUMENT TEMPLATE: + Channel number in AC field .NETS of instruction + + RETURNS: Nothing + + SKIPS: No skip + + FAILURE RETURNS: + IOC (I/O channel error) + Code 1, if not SEND (write) channel + + SIDE EFFECTS: Buffer is queued to be sent immediately + + EXAMPLE: + .NETS ch, + + +CALL: .CALL FORCE + + arg 1 channel number + + Equivalent to .NETS (see above) + + +CALL: .CALL FLUSH + + arg 1 channel number + + Does FORCE then waits for all buffered data to be sent + and for the final RFNM to come back. + + +CALL: .CLOSE + + FUNCTION: CLOSEs channel and returns immediately + + ARGUMENT TEMPLATE: + Channel number in AC field of .CLOSE instruction + + RETURNS: None + + SKIPS: No skip + + FAILURE RETURNS: None + + EXAMPLE: + .CLOSE ch, + + +Equivalent: + + .CALL CLOSE + + arg 1 channel number + + +CALL: .CALL NETBLK + + FUNCTION: Hang until connection is not in specified + state or until time out + + ARGUMENT TEMPLATE: + Standard .CALL arguments + 1. channel number + 2. state -- returns when not in this state + 3. (optional) time -- number of 30ths of second + to wait or -- (time since system up) in 30ths + of second + + RETURNS: 1. (optional) state -- new state + 2. (optional) time -- time left after state + change + + SKIPS: Skips on success + + FAILURE RETURNS: + Not skip and + OPEN code 14 -- channel number not <20 + -- channel not Network device + + SIDE EFFECTS: None + + EXAMPLE: + .CALL netblk + JRST error + . + . + + Netblk: SETZ + SIXBIT /NETBLK/ + channel + state + time + 2000,,newstate + 402000,,timeleft + + Channel: ch + + State: <-wait for this state to be left>- + + Time: <-30ths of second to wait>- + + Newstate: BLOCK 1 + + Timeleft: BLOCK 1 + + + The time argument is clobbered in the same way that + .SLEEP clobbers its AC; unless it is immediate. In that + case, the time out will be restarted if the job is pclsred. + + +CALL: .RESET + + FUNCTION: Used to RESET interrupt bit + (INR/INS from Network) + + ARGUMENT TEMPLATE: + Channel number in AC field of .RESET instruction + + RETURNS: Nothing + + SKIPS: No skip + + FAILURE RETURNS: None + + SIDE EFFECTS: Clears the Network interrupt bit (see .RCHST, + bit 4.9 of word 3) + + EXAMPLE: + .RESET ch, + +Equivalent: + + .CALL RESET + + arg 1 channel number + + + +CALL: .NETINT + + FUNCTION: Sends Network INR/INS control message for + link corresponding to channel. (TELNET protocol also + demands a "data mark" to be inserted in the stream) + + ARGUMENT TEMPLATE: + Channel number in AC field of .NETINT instruction + + RETURNS: Nothing + + SKIPS: Skip if success + No skip if Network down or not a Network + channel + + FAILURE RETURNS: + I/O Channel error Interrupt, NET went down + Code 1 + + SIDE EFFECTS: Sends NET INR/INS control message + + EXAMPLE: + .NETINT ch, + JRST fail + + + + +CALL: .GETSYS areas + NCPHTB + NCPPQ + NCPSM + + FUNCTION: Get socket map + host table + pending queue + + ARGUMENT TEMPLATE: + Name of first of 2 consecutive accumulators in AC + field of .GETSYS instruction + + ac/ -<-length>-,,<-address>- ;CPTR to block to store + + ac+1/ SIXBIT/<-name>-/ ;sixbit name of area + desired + + + RETURNS: Block of desired information + + SKIPS: Skips on success + + FAILURE RETURNS: + No skip -- area name not known in system -- not + enough memory + (ac+1 zeroes) + (ac gets <-lng,,> for number of words needed) + + SIDE EFFECTS: None + + EXAMPLE 1: + ;This can be used to find out how much storage is + needed for a .GETSYS block + + HRROI ac,temp + MOVE ac+1, [SIXBIT/NCPSM/] + .GETSYS ac, + HLRES ac ;here ac contains + lng,,temp + MOVNS ac ;now ac contains + number of words + needed + CALL FREE (ac) + + + EXAMPLE 2: + MOVE ac, [-lng,,blk] + MOVE ac+1 [SIXBIT /NCPSM/] + or NCPHTB or NCPPQ + .GETSYS ac, + JRST error + . + . + + BLK: BLOCK lng + + + +NCPHTB area + + Length -- 400 (8) words (256(10)) + + Format -- one word per host number + (word(i) is data for host.number (i)) + + Each word has info packed -- + + |1| | 2 | 9 | 18 + ______________________________________________ + |R| | | | | | + |F| | | | | | + |N|unused|RST| CTL TIME|00| HOST DEAD STATUS | + |M| | | | | | + |_|______|___|_________|__|__________________| + + + RFNM 0-control link open + 1-waiting for RFNM on control link + + RST 0-host down or not tried + 1-sent RST to see if up + 2-got RRP, connections may be opened + + CTL TIME 9 + Last time (1/30 sec module 2 ) + message sent to this host on control link (0) + + HOST DEAD STATUS + Last HOST DEAD STATUS from this host's IMP + (See RFC 611) + +(If data for a single host is desired, use the NETHST call) + + HOST DEAD STATUS in right half + + Bits 20-31 (byte pointer [041400,,x]) + give the time of the Host's coming back up, + bit-coded as follows: + + + Bits 20-22 (byte pointer [150300,,x] + the day of the week the Host is coming back up + Monday is day 0 and Sunday is day 6 + + Bits 23-27 (byte pointer [100500,,x]) + the hour of the day, from hour 0 to hour 23, + that the Host is coming back up + + Bits 28-31 (byte pointer [040400,,x]) + the five minute interval, from 0 to 11, in the + hour that the Host is coming back up + + + All three of the above are specified in Universal Time + (i.e., G.M.T.). The Host may indicate that it will be + coming back up more than a week away by setting bits 20-31 + all to ones (7777). Setting all bits 20-30 to one and bit + 31 to zero (20-31 = 7776) means it is unknown when the Host + is coming back up. + + Bits 32-35 have the follwing meanings: + + Value Meaning + ----- ------- + + 0 The destination Host is not communicating with the + network -- the destination IMP has no information + about the cause. Note that this is the message most + likely to occur if the destination IMP has gone down + since the destination Host went down. + + 1 The destination Host is not communicating with the + network -- it took its ready-line down without saying + why. + + 2 The destination Host is not communicating with the + network -- the Host was tardy in taking traffic from + the network and the network had to declare the Host + down. + + 3 The destination Host does not exist to the knowledge + of the NCC. + + 4 Currently unused. + + 5 The destination Host is down for scheduled P.M. + + 6 The destination Host is down for scheduled hardware + work. + + 7 The destination Host is down for scheduled software + work. + + 8 The destination Host is down for emergency restart. + + 9 The destination Host is down because of power outage. + + 10 The destination Host is stopped at a software + breakpoint. + + 11 The destination Host is down because of a hardware + failure. + + 12-15 Currently Unused. + + When the value of this 4-bit field is 0,1,2, or 3, bits 20-31 +will have the "unknown" indication. + NCPPQ area -- pending queue of RFC's + + Length -- variable 3+4*n where n is currently 40 (8) but + may change + + Format -- + word 0 -- relocation word, tells location in system + core where first slot begins + + word 1 -- pointer to first queue entry + + word 2 thru 4*n+1 -- 4 word slot for queue or -1 if + last one on queue + (0) -- pointer to next one (must un-relocate, + using word 0 + (1) -- local socket number + (2) -- foreign socket number + (3) -- sign bit 0 = STR 1 = RTS + low order 8 bits (byte pointer [001000,,X]) + link number if RTS + byte size if STR + next 8 bits (byte pointer [101000,,x]) + foreign Host number + + +Example of unrelocating for the NCPPQ area. + ;Let ac,ac+1 and b be accumulators + + MOVE ac, [-lng,,blk] + MOVE ac+1, [SIXBIT /NCPPQ/] + GETSYS ac, + JRST error + MOVEI ac, blk + MOVN b,(ac) ;-system address + loop: ADD ac,b ;ac now points to + ;first queue entry + + ;0(ac) is next pointer word + ;1(ac) is local socket word + ;2(ac) is foreign socket word + ;3(ac) is Host -- lind/byte word + + MOVE ac,0(ac) ;get next + JUMPGE ac,loop ;loop if not last one + + NCPSM area + + Length -- 1+13.*20. = 261(10) or 405(8) + there are 13 (or more) blocks each of length + IMPSTL (an assebly parameter, currintly 20(n)) + + Format -- + word 0 -- contains IMPSTL, the number of words + in each block + word 1 -- begins first block -- the blocks are: + +IMSOC1: REPEAT IMPSTL,0 ; 0 => FREE + ; 4.9 = 1 => SOCKET IN USE + ; 4.8 = 1 => CHNL TRYING TO BE CLOSED + ; 3.1-4.7 MASK FOR INTERRUPT BIT (LSH 1 CHNL#) + ; RH = USER INDEX +IMSOC2: BLOCK IMPSTL ; 1.1-4.5 = LOCAL SOCKET NUMBER + ; 4.6-4.9 0 (MAKES COMPARISONS EASIER) +IMSOC3: BLOCK IMPSTL ; 1.1-4.5 = FOREIGN SOCKET NUMBER + ; 4.6-4.9 = 0 +IMSOC4: BLOCK IMPSTL ; RH = SOCKET STATE + ; 3.1-3.8 = LINK NUMBER + ; 3.9-4.7 = FOREIGN HOST NUMBER + ; 4.8 = SET BY RCV CLS - MAKES MATCH USING IMSCHD FAIL + ; 4.9 = SEND THIS BUFFER NOW +IMSOC5: BLOCK IMPSTL ; 1.1-1.8 = CONNECTION BYTE SIZE + ; 2.1-2.9 = CLOSE REASON + ; 3.1-3.8 = USER BYTE SIZE + ; 3.9 => ASCII MODE - 7 BIT + ; 4.1 => ASCII MODE - 8 BIT + ; 4.2 => 1 BIT BYTES + ; 4.3 => NET INTERRUPT (INR/INS) RECEIVED + ; 4.4 => HAVE BEGUN CLOSE TIMEOUT + ; 4.5 => CLOSED WHILE IN RFNM WAIT, EXPECT ANOTHER RFNM + ; 4.9 => TRANSFER IN 32 BIT MODE +IMSOC6: BLOCK IMPSTL ; RH => BUFFER ADDRESS + ; 4.9 => LOCKED BY CORE JOB + ; 4.8 => ACTIVE AT PI LEVEL + ; 4.7 => INPUT OCCURRED WHILE BUFFER LOCKED + ; 3.1-3.8 => IOBFT INDEX, OR 377 IF BIG BUFFER +IMSOC7: BLOCK IMPSTL ; BIT ALLOCATION +IMSOC8: BLOCK IMPSTL ; MESSAGE ALLOCATION +IMSC7I: BLOCK IMPSTL ; AMOUNT TO INCREASE BIT ALLOCATION BY IN NEXT ALL MSG +IMSC8I: BLOCK IMPSTL ; AMOUNT TO INCREASE MESSAGE ALLOCATION BY " " " " +IMSOCT: BLOCK IMPSTL ; TIME WHEN FIRST MESS PUT INTO BUF + ; (DURING INPUT HAS NUMBER OF DATA BYTES LEFT IN MSG) + ; (DURING CLOSE HAS TIME TIMEOUT STARTED) +IMSMPP: BLOCK IMPSTL ; MAIN PROGRAM POINTER, ILDB OR IDPB FOR NEXT BYTE +IMSMPC: BLOCK IMPSTL ; MAIN PROGRAM COUNTER, FOR OUTPUT HAS ROOM LEFT + ; IN BUFFER IN BYTES. FOR INPUT HAS TOTAL NUMBER + ; OF DATA BYTES IN THE BUFFER. +IMSPIP: BLOCK IMPSTL ; INTERRUPT LEVEL POINTER. FOR OUTPUT ILDB GETS + ; FIRST BYTE OF NEXT MESSAGE OUT. FOR INPUT RH + ; HAS ADDRESS OF HEADER WORD OF NEXT MESSAGE IN. +IMSBFE: BLOCK IMPSTL ; BYTE POINTER TO LAST BYTE IN BUFFER. + +CALL: .IOT + + FUNCTION: Transfer data in or out over Network + + ARGUMENT TEMPLATE: + Channel number in AC field of .IOT in struction + <-word>- or pointer to block + + RETURNS: None (unit output mode) + Datum (unit input mode) + Updated pointer (block mode) + + SKIPS: No skip + + FAILURE RETURNS: + I/O Channel error INTERRUPT + Code 1 -- Network went down + Code 8 -- Attempted output mode IOT when not in + State 5 (open) or State 6 (RFNM wait) + Or attempted input IOT when in bad state + or when closed other than by foreign host. + End of file is sensed when input is done from + a socket closed by the foreign host. In unit + image mode this gives I/O channel error code 2. + + SIDE EFFECTS: + Output -- data buffered to be sent + Input -- data copied from buffer ALLOCATE sent if + buffer empty (enough) + + EXAMPLE: .IOT ch, foo + + +In image block mode, one byte per word is transferred, +right-justified. + +In ascii block mode, five bytes per word are transferred, +or four bytes per word (8-bit) if mode bit 1.6 was on in +the OPEN. + diff --git a/sysdoc/pclsr.test b/sysdoc/pclsr.test new file mode 100644 index 0000000..f8b20f6 --- /dev/null +++ b/sysdoc/pclsr.test @@ -0,0 +1,105 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +06/07/87 21:26:03,4751;000000000000 +Date: Sun, 7 Jun 87 21:13:07 EDT +From: Alan Bawden +To: DLW at SCRC-STONY-BROOK.ARPA +cc: ALAN at AI.AI.MIT.EDU, MOON at AI.AI.MIT.EDU, TK at AI.AI.MIT.EDU +Re: PCLSR test mode + + Date: Sat, 6 Jun 87 17:33 EDT + From: Daniel L. Weinreb + Hi. Have you ever used ITS's PCLSR test mode? + +Nope. I've never written anything that warranted it. + + I'm thinking about trying to implement something analogous, to help + people debug "transactions", which can abort and restart and so are + essentially subject to something much like PCLSRing. How does the test + mode work, and is it useful? Thanks. + +Its kind of a kludge actually. + +I guess you remember that if you want a particular piece of code to be +tested, you insert calls to this macro (PCLT) at points where you want to +be PCLSRed from (typically right before you might go blocked). Then PCLSR +test mode lets you run the system call until it reaches one of the test +points you have marked. + +There are three modes that control what happens each time the job being +tested reaches one of the test points: + +1. In "hold" mode, ITS PCLSR's the job and stops it as if the hacker had +just typed a ^Z. If the hacker P's the job, it will run to the exactly +the same test point and then PCLSR and halt again. Thus the hacker can +test the same point over and over again. + +2. In "advance" mode, each time the hacker P's the job it runs to the +same test point as last time, and then sets a flag that causes the job to +PCLSR and halt at the -next- test point, where and whenever that happens to +occur. Thus the hacker can test all of the test points in succession in a +particular path through a system call. + +3. "Advance but don't halt" mode is just like advance mode except that the +job is not halted each time it is PCLSRed, it just keeps running and thus +immediately starts the system call over. This lets the hacker exercise a +system call over and over, presumably waiting for a bug-check to trip. + +The kludge is how ITS decides you have reached "the same test point". You +can't just test the PC where the PCLT macro occured, because that might be +in a subroutine that was called from several places. So ITS crawls down +the stack looking for likely return addresses to try and figure out the +call-chain that got to the current routine. (Its heuristic is that any +word whose right half address a word in system code that immediately +follows any PUSHJ P, is a return address.) These return addresses are all +hashed together, and the pair consisting of this hash and the PCLT's PC are +used to distinguish one test point from another. + +(Actually you could hash the PCLT's PC in with the others, but keeping it +separate means that you can -first- compare the current PCLT's PC with the +one you are looking for, and if it doesn't match you don't have to bother +with the slow hash computation.) + +Additionally, it is possible that a PCLT might occur in the middle of a +loop so that neither its location, nor the call-chain, can be used to +distinguish what the hacker might want to treat as separate test points. +To cover this case there is a location (PCLIDX) whose contants are always +hashed in with the return addresses. By storing the loop-counter, or +something else that varies each time around the loop, in PCLIDX, the hacker +can cause these test points to be distinguished. (This mechanism doesn't +extend to nested loops, but it's only used in a single place.) + +Of course there are lots of ways you can imagine this hash test becoming +confused (by extra gubbish on the stack that only -looks- like a return +address and that happens to vary from call to call, or by routines that use +other calling conventions, etc.), but I imagine that in practice the hacker +doesn't get shafted all that often. + +Here is another hazard that can bite the hacker using this feature: In +advance mode, after ITS has found the previous test point and has set the +flag that causes the next test point to trap, but before it actually gets +there, it may happen that the job is PCLSR'd for some ordinary reason (like +the job being swapped out). Then the next time the job does any system +call the -first- test point in that system call will trap. This is +probably sufficiently unlikely that its not worth fixing; if it ever +happened to anyone, he would just grumble and start over. + +Is it usefull? I don't really know. It has never been used in my memory, +but ITS hasn't changed all that much during that time. I seem to recall +Moon once remarking that he had never seen it used either, but I believe +that TK once told me that it had flushed its share of bugs. diff --git a/sysdoc/pdset.info b/sysdoc/pdset.info new file mode 100644 index 0000000..7b6f147 --- /dev/null +++ b/sysdoc/pdset.info @@ -0,0 +1,83 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +PDSET was re-written from scratch in 1985, so it now has a nicer +user interface, but does essentially the same work as described in +this file. That is, it hacks PDTIME and the clock, and the backup +PDYTIM, and FYEAR. --- CSTACY + +The following information pertains to the old PDSET program circa 1969. + + SYS:TS PDSET IS A PROGRAM FOR THE +SETTING OF SYSTEM VARIABLES ASSOCIATED +WITH THE KEEPING OF REAL TIME IN ITS +VERSIONS 547 AND GREATER. IT DOES +THIS ON THE BASIS OF TYPED IN COMMANDS, +EXCEPT THAT IT MAY BE CALLED BY +:PDSET YYMMDD HHMMSS FROM DDT, WHERE +YYMMDD AND HHMMSS ARE THE DATE AND +TIME IT IT STARTED ($G'D BY DDT). + WHEN PDSET IS FIRST STARTED +UP, IT ENTERS IOT USER MODE IN ORDER +TO DATAI FROM A HARDWARE CLOCK, SO DON'T +PLAY WITH ITS BINARY CASUALLY. + WHEN NOT STARTED UP BY :PDSET YYMMDD HHMMSS, +PDSET TAKES TYPED IN COMMANDS IN MUCH +THE SAME MANNER AS TENLOD, WITH WHICH +IT SHARES THE Q, X, AND ? COMMANDS. +AFTER EACH CHARACTER IS TYPED IN AND +BEFORE IT IS ECHOED, PDSET DOES A +DATAI FROM THE HARDWARE CLOCK, AS WELL +AS A .RDTIME. IT IS ON THE BASIS OF +THIS INFORMATION, AS WELL AS THAT TYPED +IN, THAT IT DOES WHAT IT DOES. + +MAIN COMMANDS: + +D SET DATE. ACCEPTS A SIX + DIGIT (YYMMDD) LEADING ARGUMENT OR, + IF NOT SUPPLIED, THEN SETS A FLAG + TO USE THE SYSTEM DATE (INITIAL MODE). + +T SELECT *THE *TIME *AT *WHICH *THE + *SETLOC *COMMAND *WILL *BE *GIVEN*. + (HHMMSS 24 HR-TYPE LEADING ARGUMENT). + +! MUST BE FOLLOWED BY A POINT. + THE TIME THE "." IS TYPED IS ASSUMED + TO BE THE TIME SELECTED BY THE + MOST RECENT "T" COMMAND. IF THE + HARDWARE CLOCK IS RUNNING THEN PDSET + .SETLOC'S A LOCATION IN THE SYSTEM + WHICH THE SYSTEM USES AS AN OFFSET + FOR TRANSLATING CLOCK DATAI'S INTO + TIME OF YEAR. IF THE CLOCK IS NOT + RUNNING, IT .SETLOC'S ANOTHER + LOCATION IN THE SYSTEM TO THE TIME + OF YEAR (FOR USE BY THE SYSTEM AS + BACKUP TO THE HARDWARE CLOCK). + EITHER WAY IT ALSO .SETLOC'S THE + LOCATION IN THE SYSTEM CONTAINING THE + YEAR, ALTHOUGH THIS WILL USUALLY + NOT CAUSE SYSTEM JOB PRINTOUT + DUE TO AGREEMENT. + IN SHORT, THIS COMMAND DOES WHATEVER + IT THINKS NECESSARY TO TELL THE + SYSTEM WHAT TIME OF WHAT YEAR IT IS. + --JSF 9/20/69 6:40PM + AMENDED 5/22/72 9:10PM BY JSF +  ‡‡8 \ No newline at end of file diff --git a/sysdoc/peek.bugs b/sysdoc/peek.bugs new file mode 100644 index 0000000..04e46b4 --- /dev/null +++ b/sysdoc/peek.bugs @@ -0,0 +1,730 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Fri, 5 May 89 14:14:14 EDT +From: Devon Sean McCullough +To: BUG-PEEK@AI.AI.MIT.EDU +Message-ID: <591317.890505.DEVON@AI.AI.MIT.EDU> + +watching the comsat stats file with 1C, it said +MPV; DSKTY3+1>>ILDB B,A B/ 0,,65 a/ 350700,,32000 +d/ 134 + +p/ c,,pdl+2 +pdl+2/ cam dsktlp+2 +pdl+1/ cam disk+23 +pdl/ cam beg8+1 + + +Date: Sun, 20 Mar 88 13:48:17 EST +From: Devon Sean McCullough +To: BUG-PEEK@AI.AI.MIT.EDU +Message-ID: <344793.880320.DEVON@AI.AI.MIT.EDU> + +I was sitting in 0C watching COMSAT and I got +MPV; 11772>>ILDB 2,1 2/ 151 1/ AOS 16,32000 +with no apparent provocation. A day or so ago I got MPV right on +the heels of a **MORE** (not --more-- which was strange) but I +didn't notice where. 31777 seems to be the last word of the buffer +being monitored. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 21 Jan 87 00:29:12 EST +Date: Wed, 21 Jan 1987 00:25 EST +Message-ID: +From: Rob Austein +To: Alan Bawden +Cc: BUG-COMSAT@AI.AI.MIT.EDU, BUG-PEEK@AI.AI.MIT.EDU, JTW@AI.AI.MIT.EDU +Subject: PEEK shouldn't ever PCLSR anyone +In-reply-to: Msg of 18 Jan 1987 22:51-EST from Alan Bawden + + Date: Sunday, 18 January 1987 22:51-EST + From: Alan Bawden + + In the case of the DQ device screw, I don't really understand why PEEK + PCLSRing the -server- would cause any kind of deadlock to be broken. + +Not that surprising. Remember that DQ: is a very strange file. In +particular, see the code that uses register Y in OUTPUT and BOJINT to +avoid hanging forever at the SIOT in OUTPUT. I would not be surprised +if that code was intimately involved in this bug, I doubt anybody has +ever tried to make a JOB device do anything this twisted before. + +Date: Sun, 18 Jan 87 22:51:43 EST +From: Alan Bawden +Subject: PEEK shouldn't ever PCLSR anyone +To: BUG-COMSAT@AI.AI.MIT.EDU, BUG-PEEK@AI.AI.MIT.EDU +cc: JTW@AI.AI.MIT.EDU +Message-ID: <141778.870118.ALAN@AI.AI.MIT.EDU> + +I just found two obvious places in PEEK that would cause a job to get +PCLSR'd. + +The first would PCLSR any job that PEEK suspected might be a MUDDLE job (it +had some test involving the contents of the job's accumulators). Despite +the comment that threatened to "BREAK THE NECK OF THE ASSHOLE WHO REMOVES +ANY CODE HERE WITHOUT CONSULTING ME AND OBTAINING PERMISSION", I removed +it. + +The second would PCLSR any job that PEEK suspected might be an interesting +job device server. Any job whose JNAME started with the three characters +"JOB" would be PCLSR'd when PEEK went into "C" mode because PEEK used +.IOT's on the USR: device to probe around in its memory (to see if it was +an MLDEV, or other device server it knows about). I fixed this to use +memory mapping instead. + +In the case of the DQ device screw, I don't really understand why PEEK +PCLSRing the -server- would cause any kind of deadlock to be broken. But +in any case, now there is a good chance that the next time COMSAT and DQ +get into this state, the mere act of discovering the lossage in PEEK (by +going into "C" mode to read the STATS file) will not cause the lossage to +vanish. Perhaps we will be able to find the problem now. + +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 13 MAY 86 12:43:22 EDT +Date: Tue, 13 May 86 12:44:25 EDT +From: Alan Bawden +To: ZVONA@MC.LCS.MIT.EDU +cc: BUG-PEEK@MC.LCS.MIT.EDU +In-reply-to: Msg of Mon 12 May 86 20:15:40 EDT from David Chapman +Message-ID: <[AI.AI.MIT.EDU].38227.860513.ALAN> + + Date: Mon, 12 May 86 20:15:40 EDT + From: David Chapman + BUG-PEEK is currently archived in MC:RMS;. Should it live in AI:RMS;? + Some other directory on AI? Some altogether different place? + +Probably it should go into AI:SYSDOC;. + +Date: Mon, 12 May 86 20:15:40 EDT +From: David Chapman +To: BUG-PEEK@MC.LCS.MIT.EDU, KS-ITS@MC.LCS.MIT.EDU +cc: ZVONA@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].911011.860512.ZVONA> + +BUG-PEEK is currently archived in MC:RMS;. Should it live in AI:RMS;? +Some other directory on AI? Some altogether different place? + +Date: Tue, 4 Mar 86 18:15:40 EST +From: Alan Bawden +Subject: "W" mode sorting +To: BUG-PEEK@MC.LCS.MIT.EDU +cc: MOON@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].838752.860304.ALAN> + +The Internet Routing table ("W" mode) sorting-by-age feature doesn't seem +to be functioning properly on AI right now. Perhaps this is because +currently AI has entries that are more than 5 days old? + +Date: Mon, 3 Mar 86 02:12:36 EST +From: Alan Bawden +Subject: " mode in PEEK +To: BUG-ITS@MC.LCS.MIT.EDU, BUG-PEEK@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].836305.860303.ALAN> + +I added a new mode to PEEK for printing the contents of the system message +buffer. (Type a doublequote to get it.) This is especially useful for +looking at crash dumps. While I was at it I added a few features to crash +dump mode itself. For a good example try (on AI): +:PEEK +From: Rob Austein +To: Chris Lindblad +Cc: Alan Bawden , BUG-HOSTS3@MC.LCS.MIT.EDU, + BUG-PEEK@MC.LCS.MIT.EDU, BUG-RANDOM-PROGRAM@MC.LCS.MIT.EDU, + GUMBY@MC.LCS.MIT.EDU, namecallers@MC.LCS.MIT.EDU +Subject: Ick! +In-reply-to: Msg of 2 Jan 1986 14:33-EST from Chris Lindblad + +(Oh bleep, let's put this on namecallers and get it over with already). + + From: Chris Lindblad + + Alan points out that when generating the hosts3 table, you only have to + be compatible with people who have been using the hosts3 table. + +Not quite. Eg, JIS has MIT-OA.MIT.EDU as the IN-ADDR translation for +18.10.0.79, so if anybody out there is still using the old cannonical +name algorithm (name->address->name) they will think that is OA's +primary name, thus will include it in mail headers, thus people using +HOSTS3.BIN should be able to recognize it to avoid barfing on replies. +This is probably not as much of a problem for AI as for LCS because of +the relative numbers of TCP/IP machines. + + There are bugs in your algorithm anyway. You are taking the name MITAI + and generating MIT-MITAI.ARPA, which was never in any domain. (The arpa + domain only contained the primary names of hosts). + +Mea culpa. + + I really think it is silly to be genrating all these names. Just because + JIS was lazy, and made names like mit-foo.mit.edu shouldn't be a reason + for us to clutter our host tables with them. I suggest that as soon as + possible, we eliminate references to the mit.edu domain. The longer + they're there, the harder it will be to take them out, and there's no + better time to make changes like this than during IAP. + +Agreed. I never intended that all that cruft be there permenantly, +just for transition to try to keep the world from falling apart too +badly too fast. IAP does seem like a good time to punt it. + + Over the next year, more than 100 hosts will be added to the host table. + We better start making each entry more compact if we expect it to keep + working. Alan says that we have only two pages left. + +Right, but the key point is that HOSTS3 isn't going to work much +longer. One of two things will happen: (1) the NIC table will no +longer be anything like exhaustive, in which case the table is +incomplete, or (2) the NIC table will grow to the point where it is +completely unusable. My guess is that we will end up with a +HOSTS3.BIN that contains info for MIT, and Chaos-only machines will +either have to grok domains or just start blindly sending mail to some +forwarder if the address is unrecognized. Eventually HOSTS3 may +become identical with HOST3C if/when chaos machines grok domains, but +that's not for a while yet. + + For the AI host table. I would be happy if you didn't generate any + names, and I specify all the names I want. + +Ok. Nag me if you don't hear about this in the next few days. + +Received: from OZ.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 2 JAN 86 14:41:23 EST +Date: Thu, 2 Jan 1986 14:33 EST +Message-ID: +From: Chris Lindblad +To: Rob Austein +Cc: Alan Bawden , BUG-HOSTS3@MC.LCS.MIT.EDU, + BUG-PEEK@MC.LCS.MIT.EDU, BUG-RANDOM-PROGRAM@MC.LCS.MIT.EDU, + GUMBY@MC.LCS.MIT.EDU +Subject: Ick! +In-reply-to: Msg of 2 Jan 1986 13:52-EST from Rob Austein + + Date: Thursday, 2 January 1986 13:52-EST + From: Rob Austein + + The problem is that all of those names are in somebody or another's + domain space at the present time. JIS has been advertising things + like MIT-AI.MIT.EDU, etc. The way things are set up currently you can + punt this cruft, but only a on a per-domain basis (ie, for all of + AI.MIT.EDU). If you (primarily CJL) want to do this, fine, tell me, + I'll do it. But you should think about it first, since people really + have been using some of those stupid names. + +Some thoughts on this. + +Alan points out that when generating the hosts3 table, you only have to +be compatible with people who have been using the hosts3 table. + +There are bugs in your algorithm anyway. You are taking the name MITAI +and generating MIT-MITAI.ARPA, which was never in any domain. (The arpa +domain only contained the primary names of hosts). + +I really think it is silly to be genrating all these names. Just because +JIS was lazy, and made names like mit-foo.mit.edu shouldn't be a reason +for us to clutter our host tables with them. I suggest that as soon as +possible, we eliminate references to the mit.edu domain. The longer +they're there, the harder it will be to take them out, and there's no +better time to make changes like this than during IAP. + +Over the next year, more than 100 hosts will be added to the host table. +We better start making each entry more compact if we expect it to keep +working. Alan says that we have only two pages left. + +For the AI host table. I would be happy if you didn't generate any +names, and I specify all the names I want. + +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 2 Jan 86 13:50:05 EST +Date: Thu, 2 Jan 1986 13:52 EST +Message-ID: +From: Rob Austein +To: Alan Bawden +Cc: BUG-HOSTS3@MC.LCS.MIT.EDU, BUG-PEEK@MC.LCS.MIT.EDU, + BUG-RANDOM-PROGRAM@MC.LCS.MIT.EDU, GUMBY@MC.LCS.MIT.EDU, + SRA@XX.LCS.MIT.EDU, cjl@OZ.AI.MIT.EDU +Subject: Ick! +In-reply-to: Msg of 1 Jan 1986 02:41-EST from Alan Bawden + +The problem is that all of those names are in somebody or another's +domain space at the present time. JIS has been advertising things +like MIT-AI.MIT.EDU, etc. The way things are set up currently you can +punt this cruft, but only a on a per-domain basis (ie, for all of +AI.MIT.EDU). If you (primarily CJL) want to do this, fine, tell me, +I'll do it. But you should think about it first, since people really +have been using some of those stupid names. + +Date: Wed, 1 Jan 86 02:41:38 EST +From: Alan Bawden +Subject: Ick! +To: BUG-PEEK@MC.LCS.MIT.EDU, BUG-RANDOM-PROGRAM@MC.LCS.MIT.EDU, + BUG-HOSTS3@MC.LCS.MIT.EDU, SRA@MC.LCS.MIT.EDU +cc: GUMBY@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].770028.860101.ALAN> + +Ugh, bletch! Yuck! I just had to go and shuffle the memory layout in +(*gag*) PEEK because the HOSTS3 table has grown to be so huge that PEEK has +trouble keeping both it and ITS mapped in at the same time. (Gumby, this +is what caused that PEEK bug you discovered the other day.) If HOSTS3 gets +to be another -two- ITS blocks long, it is going to take some serious +thinking to keep PEEK working. Presumably there are other programs out +there that, like PEEK, simply were not designed with a 73 block host table +in mind. + +I notice that the current host table contains shitloads of totally +ridiculous host names. A particularly bad example is AI which has the +names: + +AI.AI.MIT.EDU +AI +AI.MIT.EDU +MIT-AI +MIT-AI.ARPA +MIT-AI.MIT.EDU +MIT-MITAI +MIT-MITAI.ARPA +MIT-MITAI.MIT.EDU +MITAI +MITAI.AI.MIT.EDU +MITAI.MIT.EDU + +Might I suggest eliminating any name that starts with "MIT-" and ends +".MIT.EDU"? (Also in the case of AI, I think we can do without the nicname +"MITAI" (without hyphen) and its derivatives.) + +Date: Tue, 24 Dec 85 00:58:14 EST +From: "Pandora B. Berman" +Subject: total=out= inf. +To: BUG-PEEK@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].765406.851224.CENT> + +there's a problem between the Normal mode of P and any other, at least, any +other i usually use. when i start a PEEK, the Total= and Out= figures at the +screen top are small and fit in their alloted spaces. however, if i switch +to some other display (look at some particular job or channel, or the help +display) and then back to N, these two numbers balloon to 10 or 12 or so +figures long, and the Status column info goes all to hell. + +Date: Thu, 19 Dec 85 21:31:35 EST +From: David Vinayak Wallace +Subject: weird display +To: BUG-PEEK@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].761687.851219.GUMBY> + +Well MBECK was right; I finally was able to duplicate his bug. It's +tricky; only seems ta appear if started w/jcl. The symptom is the +runnable total and out columns have about 18 digits each, which +suggest the uuo which prints them out is somehow bashed. Trumm +appears to have a reasonable value in it. + +I dunno. + +Date: Thu, 19 Dec 85 18:04:06 EST +From: David Vinayak Wallace +Subject: Strange-looking numbers +To: MBECK@MC.LCS.MIT.EDU +cc: BUG-PEEK@MC.LCS.MIT.EDU +In-reply-to: Msg of Wed 18 Dec 85 21:43:27 EST from Mark E. Becker +Message-ID: <[MC.LCS.MIT.EDU].761316.851219.GUMBY> + + Date: Wed, 18 Dec 85 21:43:27 EST + From: Mark E. Becker + + Was using Peek 593 when noticed some rather strange-looking numbers + for "Runnable Total" and "Out". +What do you mean by "strange-looking numbers?" I can't duplicate this. + +Date: Wed, 18 Dec 85 21:43:27 EST +From: "Mark E. Becker" +To: BUG-PEEK@MC.LCS.MIT.EDU +cc: MBECK@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].760171.851218.MBECK> + +Was using Peek 593 when noticed some rather strange-looking numbers +for "Runnable Total" and "Out". This was after the first display had +been output... The JCL was :P 57J 8Z . + +Regards, +Mark + +Date: Fri, 13 Dec 85 16:02:11 EST +From: "Christopher C. Stacy" +Subject: [macrakis: Supdup lossage] +To: BUG-PEEK@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].753036.851213.CSTACY> + +Date: Thu, 5 Dec 85 00:08:11 EST +From: macrakis at harvard.HARVARD.EDU (Stavros Macrakis) +To: bug-supdup at mit-mc.arpa, ddl at harvard.HARVARD.EDU +Re: Supdup lossage + +In supdup'ing from Harvard (Unix 4.3) to Mit-MC, everything seems to work +perfectly until I try to run Peek. In particular, if I type ahead the +Peek command (e.g. `P^KJ'), it hangs up. The only way I seem to be able +to get out of this state is to quit (^^q) the supdup and reconnect. +Actually, now that I do the test, it appears that even without typeahead, +Peek's interrupt characters (commands) never get through. -- p^K ... wait +for end of display (space worrks fine at end of screen) ... q [hangs up]. +The input characters do seem to be buffered up somewhere, because when +you type ^Z when it's hung up and before you quit, when you reconnect, +the peek has been ^Z'd. + +Date: Mon, 2 Dec 85 17:58:51 EST +From: "J. Noel Chiappa" +Subject: A display +To: BUG-PEEK@MIT-MC.ARPA +cc: JNC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].738887.851202.JNC> + + Any change of moving the STY list to a separate display? +These days that list is pretty long, and over a slow network +link it's annoying to have to plought through the whole thing +to see the TCP connection list. + +Date: Tue, 6 Aug 85 06:26:44 EDT +From: Ken Harrenstien +Subject: PEEK "bug" fixed +To: CSTACY@MIT-MC.ARPA +cc: BUG-PEEK@MIT-MC.ARPA, BUG-CRTSTY@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].602153.850806.KLH> + + Date: Thu, 9 May 85 00:12:55 EST + From: Christopher C. Stacy + In-reply-to: Msg of Wed 8 May 85 06:33:43 EST from Ken Harrenstien + + I still can't reproduce anything close to the the behaviour you + described. + + Date: Wed, 8 May 85 06:33:43 EST + From: Ken Harrenstien + To: CSTACY + cc: KLH, BUG-PEEK + + Here is how to tickle the PEEK bug. Connect to MC from somewhere + else on the Arpanet. Say ":P A". PEEK will clear the screen, and + then do nothing. + +OK, I found the problem. It turns out to be in CRTSTY when acting as +a SUPDUP user program (CTN). By using IPLIST (like using a howitzer on a +housefly) I found that PEEK was sending %TDORS, and ITS was waiting +for the remote site to respond with the appropriate Intelligent Terminal +Protocol sequence (^\ ^P , which reports the cursor position) +before allowing PEEK to do anything else! Since CTN was not responding +with that sequence until the user typed some input (due to a spazz +by whoever wrote the %TDORS handling code), the effect was that whenever +any ITS program did a .RESET TYOC, all output would stop until the user +became impatient... as it happens, PEEK does such a reset every time +any character is typed at it. + +I have merged the fix into the SYSENG source of CRTSTY. + +Date: Fri, 10 May 85 17:58:29 EST +From: Christopher C. Stacy +To: KLH@MIT-MC +cc: BUG-PEEK@MIT-MC +In-reply-to: Msg of Thu 9 May 85 20:49:01 EST from Ken Harrenstien +Message-ID: <[MIT-MC].495962.850510.CSTACY> + + Date: Thu, 9 May 85 20:49:01 EST + From: Ken Harrenstien + To: BUG-PEEK + + This time I said :P A and nothing whatsoever hapened. + I ctl-Z'd and found I was at loc 22001, executing an .IOT 14,15 + with the value "A in 15. I thought the problem might be TCP related + but this seems more unlikely. CSTACY, maybe you should try + logging in as something else? + +Something is obviously screwing you, but I still can't duplicate it. +The previous tests were conducted under a variety of UNAMEs. +Here are the gory details of my latest attempt. + +I logged into MC over 1200 baud dialup, and did :TN NIC and logged in +over there. I ran @TELNET MC and NIC connected me to MC where I +received a DDT and did not log in (having made arrangements with PWORD +for this earlier). I typed ":P A". I got the same results as +yesterday -- PEEK worked. + +I flushed all my connections back to MC and typed ":TN NIC". I logged +into NIC and did "@TELNET MC". NIC connected me to MC and I logged in +as a normal user without any init file. I typed ":P A", and PEEK +worked. I typed "J" and it worked; I used "X" to gun myself down. + +Maybe somehow the problem is terminal-type specific. +Does it happen to you if you don't run TCTYP? + +Date: Thu, 9 May 85 20:49:01 EST +From: Ken Harrenstien +To: BUG-PEEK@MIT-MC +Message-ID: <[MIT-MC].494254.850509.KLH> + +This time I said :P A and nothing whatsoever hapened. +I ctl-Z'd and found I was at loc 22001, executing an .IOT 14,15 +with the value "A in 15. I thought the problem might be TCP related +but this seems more unlikely. CSTACY, maybe you should try +logging in as something else? + +Date: Thu, 9 May 85 00:12:55 EST +From: Christopher C. Stacy +Subject: can't reproduce bug +To: KLH@MIT-MC +cc: BUG-PEEK@MIT-MC +In-reply-to: Msg of Wed 8 May 85 06:33:43 EST from Ken Harrenstien +Message-ID: <[MIT-MC].492640.850509.CSTACY> + + +I still can't reproduce anything close to the the behaviour you +described. + + Date: Wed, 8 May 85 06:33:43 EST + From: Ken Harrenstien + To: CSTACY + cc: KLH, BUG-PEEK + + Here is how to tickle the PEEK bug. Connect to MC from somewhere + else on the Arpanet. Say ":P A". PEEK will clear the screen, and + then do nothing. + +I did some tests from various net hosts (using TELNET to get to the +remote site, and their TELNET to get to MC.) I invoked PEEK with +":PEEK", and ":P A", and excersized the A,J,N,Z, and X commands. +I tried several of these tests 2 or 3 times. + +1. PEEK works normally over LispM or MINITS Chaosnet SUPDUP. + +2. Over a MINITS Chaosnet TELNET connection, PEEK works normally, + except that it does not update the display automatically. + PEEK starts up, displays whatever it is supposed to *twice*, + and then just sits there, and you have to type another command, + or use SPACE or Z. I think it is supposed to be a feature that + there is a long (infinite?) initial sleep time when the + console is a printing terminal. All the commands seem to work. + It is a bug that on a printing terminal it does the initial + display twice. + +3. I tested PEEK TNing to MC from SCORE, being a Datamedia + terminal. PEEK worked normally. + +4. From BRL-BMD as a printing terminal, the sucky TCP connection + was almost unbearably slow, but PEEK seemed to behave the same + as on a MINITS Chaos TELNET connection. + +5. From SRI-NIC as a printing terminal, PEEK seemed to behave the + same as on a MINITS Chaos TELNET connection. BTW, the thing + which it echoes at ":P A" is an "A" (folowed by the correct + display.) + +6. As a final test, I came in from SRI-NIC and :TCTYP DM2500. + I typed ":P A". It echoed "A", paused for 1 second, and + gave me one normal ARPAnet display. After 20 seconds it + updated it. I typed "J", and it did. I used the "X" + command to gun myself down. + + +Beats me to death. + + +Date: Wed, 8 May 85 06:33:43 EST +From: Ken Harrenstien +To: CSTACY@MIT-MC +cc: KLH@MIT-MC, BUG-PEEK@MIT-MC +Message-ID: <[MIT-MC].491306.850508.KLH> + +Here is how to tickle the PEEK bug. Connect to MC from somewhere +else on the Arpanet. Say ":P A". PEEK will clear the screen, and +then do nothing. That's right, nothing. Eventually you will get +impatient, and type a space. Bang! Suddenly there is a flash +of something echoed too quickly to see (^A?), and the PEEK "A" display +appears. As far as X and Y go, nothing will happen. I don't know if +all this is something net-specific, but if it is it should be flushed. +Possibly the JCL handling is messed up? + +It seems to be solidly repeatable. + +Date: Tue, 7 May 85 19:19:52 EST +From: Christopher C. Stacy +To: KLH@MIT-MC +cc: BUG-PEEK@MIT-MC +In-reply-to: Msg of Tue 7 May 85 17:33:21 EST from Ken Harrenstien +Message-ID: <[MIT-MC].490642.850507.CSTACY> + + +When I run PEEK, it automatically displays things for me. The X and Y +commands work fine for me. Glancing at a source compare of the latest +PEEK with the version from 1983, the only changes I see are where +people have installed some meter modes for some network stuff. + +However, there is a very old bug which bites me sometimes, where PEEK +apparently does not turn its interrupts on or something. When it gets +to a **MORE** break, it hangs (and the prompt is wrong so the more +handler has clearly not gone off.) I think that in this mode, no +characters typed do anything. Somebody should track this down +someday, but it is sporadic and has been happenning for years. + +Are you thinking of this latter bug, or are you claiming that PEEK is +completely broken? It normally works fine for me many times each day. + +Date: Tue, 7 May 85 17:33:21 EST +From: Ken Harrenstien +To: BUG-PEEK@MIT-MC +Message-ID: <[MIT-MC].490459.850507.KLH> + +For a few months now I've noticed that PEEK has been broken. I +wasn't quite sure whether to believe it at first, but now I'm +relatively sure. The problem is that PEEK does not go ahead and +show things on its own -- you hae to type a space or something to force +output, it seems. For certain commands like X and Y it simply does +not work or do anything. Now, I grant this may hae happened because of +someone's idea of "new improved featurefulness" but I find it annoying. + +Date: 26 January 1985 02:39-EST +From: Christopher C. Stacy +To: BUG-FINGER @ MIT-MC, BUG-PEEK @ MIT-MC +cc: ALAN @ MIT-MC + +Does not mention when system is being debugged unless users are not allowed on. + +Date: 13 January 1985 01:37-EST +From: Christopher C. Stacy +To: HDT @ MIT-MC +cc: BUG-PEEK @ MIT-MC + +First, you could just re-own the wholine job with :JOB WHOLIN +and then :KILL it, rather than using PEEK. I don't know why +PEEK behaves the way you describe, but someone can look at it +someday I guess. + +Date: 13 January 1985 01:30-EST +From: Howard D. Trachtman +To: BUG-PEEK @ MIT-MC +cc: HDT @ MIT-MC + +I had a detached tree which I was trying to kill in peek. + I couldn't kill it. Basically I just wanted to get rid of +my wholin which was disowned and screwing me. number, etg. 32Y +offered to kill my entire tree (two hactr*'s) and I thought this +was a bug. I got rid of some useless jobs so that if it actually +went and killed the tree off I could live also. But they still wouldn't +got away. 5 minutes later, the system console printed that +it killed my hour old detached job. If this is at all interesting, +I can provide some more info, but I don't want to bore you all otherwise. + +Date: 22 December 1984 04:32-EST +From: Pandora B. Berman +Subject: PEEK down warning broken +To: BUG-PEEK @ MIT-MC +cc: BUG-FOO @ MIT-MC + +P pretends it is warning you that the system is being taken down. however, +the warning code is fukt. the warning (in the J display, at least) looks like +System going down in () +where is supposedly the remaining increment until the actual +occurs. you'd expect that would remain constant and would +decrement to 0. what really happens, though, is remains constant +(and doesn't jibe with the down warnings produced at top level), and +increments to fit !! please fix. + +Date: 25 August 1984 16:16-EDT +From: David A. Moon +To: BUG-PEEK @ MIT-MC + +Needs to be fixed to work when the amount of free memory in the header +runs into four digits (!!) + +Date: 18 March 1984 21:40-EST +From: Jon Solomon +To: BUG-PEEK @ MIT-MC + +Sigh, every time I peek at the comsat stats file it gives me +an :$MPV not handled$ error and punts. This time after perhaps +two screenfuls. I'm on a vt100 running in vt52 mode, and I have +had this happen on vt100s running vt100 mode, and H19s. + +--jsol + +Date: 15 November 1983 19:04 EST +From: Alan Bawden +Subject: E +To: BUG-PEEK @ MIT-MC + +Is there documentation anywhere for the "E" command? + +Date: 28 October 1983 06:56 EDT +From: David Vinayak Wallace +To: BUG-PEEK @ MIT-MC + +How come the down time message is so fukt? + +Date: 21 October 1983 16:47 EDT +From: Jeffrey P. Golden +To: BUG-PEEK @ MIT-MC + +Someone should fix the "System going down in" message in PEEK. +The times it gives are preposterous. + +Date: 19 July 1983 03:10 EDT +From: Jeffrey P. Golden +To: BUG-PEEK @ MIT-MC + +When I use LOCK to take the system down, it used to say +'System going down in 15:00' or whatever. +Now it says: +'System going down in 3:06:21:21 ( 3:09:28:44)' +These huge mysterious numbers are not very helpful. + +Date: 9 July 1983 06:46 EDT +From: Christopher C. Stacy +Subject: [ELLEN: forwarded] +To: BUG-PEEK @ MIT-MC + +Date: 07/08/83 03:46:40 +From: ELLEN +To: CSTACY +cc: ELLEN + +wierd Peek... +Peek seems not only to not allow you to type a space to redisplay +during an "O", but it also sometimes gets into a state where a space +will not do anything, no how... I can identify this state because +the "More" at the bottom will be + +**More** + +instead of + +--More-- + +I regret that at this instant I cannot tell you how to produce this +state. But I suspect it might be related to hopping in and out of +PEEK repeatedly... as I sometimes do... then one time I suddenly +notice this wierdness... +I consider this highly wierd, and am sending this to you, to forward +as you please, since I believe it was you who last modified PEEK. +Cheers. + +gsb@MIT-ML (Sent by TAR@MIT-ML) 05/08/83 00:56:23 +To: (BUG PEEK) at MIT-ML +If i type ahead stuff at peek (like i do +peek +jjjjjjjjjjjjjjjjjj +) +then i can make it use **MORE** rather than --More--. +This is especially amusing because in **MORE** in peek, the two things +which do not work are space and rubout. + + diff --git a/sysdoc/poor.mc b/sysdoc/poor.mc new file mode 100644 index 0000000..c8c5b4a --- /dev/null +++ b/sysdoc/poor.mc @@ -0,0 +1,4002 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Date: Fri, 16 Sep 88 00:16:04 EDT +From: Peter Lothberg +Subject: The "crack team", is dissasembling MX, for it's trip to Sweden +To: INFO-ITS@AI.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU +Message-ID: <444460.880916.ROLL@AI.AI.MIT.EDU> + + +The crack team has begun to work; + +A lot of the documentation for MX (KL-10) must be spread out, i +can't find it around the machine. + +So all of you that has bits and pices, bring it to the 9:th floor +before sunday, please. + + +(As the system will not fill the container more than 40% or so, + we vold like donations of other stuff, like Lisp-machines, AAA terminals, + a IMP, Conection machines, retired 2060's etc, (I'm not joking...)) + +-Peter + +Received: from MC.LCS.MIT.EDU (CHAOS 3131) by AI.AI.MIT.EDU 11 Sep 88 22:29:39 EDT +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by MC.LCS.MIT.EDU 11 Sep 88 22:25:00 EDT +Received: from KENNETH-WILLIAMS.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 457530; 11 Sep 88 22:24:20 EDT +Date: Sun, 11 Sep 88 22:22 EDT +From: David A. Moon +Subject: Synchronicity +To: poor-mx@mc.lcs.mit.edu +Message-ID: <19880912022232.0.MOON@KENNETH-WILLIAMS.SCRC.Symbolics.COM> + +In T.I. land, MX means microExplorer. Enough said. + + +Date: Fri, 9 Sep 88 17:47:53 EDT +From: "Pandora B. Berman" +Subject: in case you missed it +To: POOOR-MX@AI.AI.MIT.EDU +Message-ID: <440424.880909.CENT@AI.AI.MIT.EDU> + +MSG: MX ADIEU +DISTRIB: *MD, *ML, *MC, *AI +EXPIRES: 09/23/88 21:39:25 +CENT@AI.AI.MIT.EDU 09/08/88 21:39:25 Re: The end of the world as we used to know it +"The time has come," said LCS, + "MX at last must go. +Its day has gone. We need that space + Most urgently." And so +Before we crate it, let us give + A final cheerio. + +Once there was a KL-10 called MIT-MC which belonged to the Macsyma +Consortium. It provided Macsyma, the symbolic algebra system, to +researchers all over the world, and mail gatewaying and mailing list +support to a large fraction of the Arpanet. Things continued in this +fashion from 1975 to 1983. + +When the Macsyma Consortium dissolved in 1983, MC turned to providing +cycles for MIT's Laboratory for Computer Science, and continued supporting +much of the Arpanet's mail service. But the machine itself was growing old +and cranky. In 1986, the mail services were moved to a smaller, more +maintainable machine (a KS-10), and the name "MC" was moved with them. +But the KL-10 continued to run under the new name "MX". + +Now the end has come. MX was down cold for several months, and has only +been revived recently to copy some old 7-track tapes. LCS can't keep MX +any longer -- it needs the space for other purposes. So the KL is being +sent to the Home for Aged But Beloved PDP-10s; a crack team of hardware +hackers will arrive next week to dismantle it and take it back with them to +Sweden. + +In celebration of this momentous event, we are holding a small farewell +gathering: + Friday, 16 September 1988 + 16:00 + NE43-8th floor playroom + (545 Technology Square, Cambridge, MA) + +Reservations are strenuously requested (though not strictly necessary) -- +we need a head count so we can figure out how many trays of institutional +brownies to order. Send yours to: + CENT@AI.AI.MIT.EDU + +Offers of refreshement are also very welcome -- do you think we have any +budget for this kind of thing? Send all such offers also to CENT as above. +^_ + +Received: from XN.LL.MIT.EDU (TCP 1200400012) by AI.AI.MIT.EDU 8 Aug 88 12:00:30 EDT +Received: by XN.LL.MIT.EDU; Mon, 8 Aug 88 11:57:23 EDT +Date: Mon, 8 Aug 88 11:57:23 EDT +From: rp@XN.LL.MIT.EDU (Richard Pavelle) +Posted-Date: Mon, 8 Aug 88 11:57:23 EDT +Message-Id: <8808081557.AA09526@XN.LL.MIT.EDU> +To: poor-mx@AI.AI.MIT.EDU +Subject: Removal date for KL from MIT + + Posted-Date: Fri 5 Aug 88 18:49:28-EDT + Date: Fri 5 Aug 88 18:49:28-EDT + From: Rob Austein + + Moon pointed out that I should have sent copies to a couple other + people, so here's a copy for the official fan club. + +I would like to propose that those on this mailing list (and others +who care) get together before the permanent demise of mx=mc and wish +it farewell. Many years of work went into that machine and many +careers came out. I was connected to mx for more than 20,000 hrs, and +it changed my life. I am sure others have similar feelings. + +What do you MXers say about this? + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 5 Aug 88 18:53:37 EDT +Date: Fri 5 Aug 88 18:49:28-EDT +From: Rob Austein +Subject: [Rob Austein : Removal date for KL from MIT] +To: poor-mx@AI.AI.MIT.EDU +Message-ID: <12420107736.29.SRA@XX.LCS.MIT.EDU> + +Moon pointed out that I should have sent copies to a couple other +people, so here's a copy for the official fan club. + --------------- + +Mail-From: SRA created at 5-Aug-88 17:18:09 +Date: Fri 5 Aug 88 17:18:09-EDT +From: Rob Austein +Subject: Removal date for KL from MIT +To: ROLL%SESTAK.BITNET@MITVMA.MIT.EDU, ROLL@KICKI.STACKEN.KTH.SE +cc: sra@XX.LCS.MIT.EDU, jtw@XX.LCS.MIT.EDU, tjg@XX.LCS.MIT.EDU +Message-ID: <12420091113.29.SRA@XX.LCS.MIT.EDU> + +I just got out of a meeting where we were discussing plans for various +renovations at LCS. You should know that we have a big-name +researcher moving into LCS from another part of MIT. This has top +priority with our front office people, and the deadlines for it are +tight. + +To make a long story short, we have the following situation. As you +know, we need the KL for long enough to finish copying the Macsyma +tapes from 7-track to 9-track tape. The official estimate of when +that will finish is sometime between 31 August and 15 September. The +actual date is unknown, since the project depends heavily on hardware +that is known to be flakey; Penny is doing a heroic job but it may +simply not be possible to finish the job on schedule. + +The renovation plans are going to require that the KL be gone by the +end of September. The need for the floorspace is bad enough that it +is my estimation that if the tape copying isn't done in time, it will +be left incomplete rather than extend the deadline. I could be wrong +about this. Enough other things are depending on having the KL gone +that, if you guys can't come over here and handle the disassembly, the +machine will be removed anyway and shipped to a warehouse somewhere. +Management is aware that disassembly by people who don't understand +the machine may well mean that it will never run again; they don't +care about this enough to offset their need for the floorspace. + +None of the MIT ITS people are going to have time to handle the +disassembly (I know that JTW and I won't and I'm virtually certain +that Moon and Bawden won't either). MIT is not willing to pay what it +would cost to have DEC do the de-installation (we estimate this as +being in the thousands of US dollars). + +Tom Greene tells me that you would prefer to do the job in November. +Hence this letter, to tell you that if you wait that long you will +probably not get a working machine out of the deal. I realize that +this puts you in a bad position, since we can't even tell you when the +tape work will be done with any degree of certainty. + +Our best guess of when we need you guys over here starting the +deinstallation is 19 September. We can't put it off much after that. +How likely is it that you can do this? + +--Rob +------- +------- + +Date: Mon, 28 Sep 87 00:20:04 EDT +From: David Vinayak Wallace +Subject: OLD magtape heads +To: ME@SAIL.STANFORD.EDU +cc: ALAN@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU, + Moon@SCRC-STONY-BROOK.ARPA, BERLIN@XX.LCS.MIT.EDU, + TY@XX.LCS.MIT.EDU +In-reply-to: Msg of 25 Sep 87 1540 PDT from Martin Frost +Message-ID: <261147.870928.GUMBY@AI.AI.MIT.EDU> + + Date: 25 Sep 87 1540 PDT + From: Martin Frost + + Our drives, by the way, date from about 1966. + +This year's freshmen were born in 69 and 70. + +Received: from OZ.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 SEP 87 06:19:11 EDT +Date: Sun, 27 Sep 1987 06:10 EDT +Message-ID: +From: RP%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU +To: POOR-MX@AI.AI.MIT.EDU +Subject: Tomorrows news +In-reply-to: Msg of 1 Sep 1987 07:27-EDT from Alan Bawden + + Date: Tuesday, 1 September 1987 07:27-EDT + From: Alan Bawden + To: POOR-MX at AI.AI.MIT.EDU + Re: Todays news + + Yesterday MX ate part of the DRAGON directory and -all- of the .MAIL. + directory. Presumably this is caused by more of the blocks-of-zeros + lossage. + + I didn't bother to bring ITS back up, since I didn't see any reason to + destroy more of the filesystem without fixing the hardware problem. + + ... + +It has almost been a month since Alan's message. Have there been any +further attempts to fix the hardware problem. I have nothing to +contribute to the effort, but I certainly would like to see my +favorite machine alive and useful again. + +Received: from SAIL.STANFORD.EDU (TCP 1200000013) by AI.AI.MIT.EDU 25 Sep 87 19:51:03 EDT +Date: 25 Sep 87 1540 PDT +From: Martin Frost +Subject: re: old magtape heads +To: Alan@AI.AI.MIT.EDU, Moon@SCRC-STONY-BROOK.ARPA, + TY@XX.LCS.MIT.EDU, CENT@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU, + BERLIN@XX.LCS.MIT.EDU, tjg@XX.LCS.MIT.EDU +CC: ME@SAIL.STANFORD.EDU + +I appreciate your searching for magtape heads that we might be able to +use. Sorry I haven't responded earlier to the recent flurry of messages +about your search, but I went on vacation last week on the day before the +first of these messages and just got back. + +No, we haven't found any heads to use in our drives. We had a couple of +close calls, but the heads that were located were for different tape +speeds, and our experience indicates that such heads don't work (we had +one such spare ourselves and were disappointed to discover the +incompatibility). + +We have, however, now sent out one set of heads to be remanufactured. +They say that the result will be heads better than new (harder heads), and +I'm hoping they're right (and that they can reconstruct the heads +precisely enough). + +So, feel free to discontinue your search, but on the other hand, if you +did turn up a set of heads in reasonable shape that would work, I think we +would still be interested in them. If you find a potential set of such +heads, just check the part number on the heads -- if it is Datamec +10400-9S, then it's a winner. I have to assume that heads made by anyone +else wouldn't work, unless they were definitely for 7-track 45-ips drives. +Our drives, by the way, date from about 1966. + + +Received: from REAGAN.AI.MIT.EDU (CHAOS 13065) by AI.AI.MIT.EDU 25 Sep 87 17:59:09 EDT +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 59630; Fri 25-Sep-87 11:29:05 EDT +Date: Fri, 25 Sep 87 11:29 EDT +From: Alan Bawden +Subject: [Martin Frost : old magtape heads ] +To: Moon@STONY-BROOK.SCRC.Symbolics.COM, me@SAIL.STANFORD.EDU +cc: CENT@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU, BERLIN@XX.LCS.MIT.EDU, + tjg@XX.LCS.MIT.EDU +In-Reply-To: <870921152108.3.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <870925112905.1.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Mon, 21 Sep 87 15:21 EDT + From: David A. Moon + Date: Fri, 18 Sep 87 14:10:21 EDT + From: Alan Bawden + Date: Thu, 17 Sep 87 20:45:06 EDT + From: Pandora B. Berman + the old mc, now mx, retains its drive (not a tu20, nor a 45, perhaps + JTW can cons up the variety) as long as we have any hope of reviving + it. good luck with hunting elsewhere or remanufacture. + I don't know what this drive is called by DEC (there is nothing inscribed + on the cabinet), but I think that it was actually manufactured by IBM. + It's the 7-track version of the TU40, possibly called TU41, and it was + manufactured by Mohawk Data Sciences. We have, if we haven't lost them, + a set of MDS manuals for it (fat blue ring-bound notebooks). It needs + both a TM10B and a DF10 for interfacing. + +Yeah, I found this documentation in the cabinet (since your description let +me to know what to look for). Apparently it is just called a TU40, +although it is of the 7-track variety. I don't seem to be able to find +anything that tells me anything about the heads though. (It -must- be +there somewhere...) + +I notice that we haven't heard a peep out of SAIL since we started this +conversation. Perhaps they already found a set of heads? + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 21 Sep 87 16:51:23 EDT +Date: Mon 21 Sep 87 16:42:40-EDT +From: J. J. Tyrone Sealy +Subject: Re: [Martin Frost : old magtape heads ] +To: Moon@SCRC-STONY-BROOK.ARPA +cc: ALAN@AI.AI.MIT.EDU, me@SAIL.STANFORD.EDU, CENT@AI.AI.MIT.EDU, + POOR-MC@AI.AI.MIT.EDU, BERLIN@XX.LCS.MIT.EDU, tjg@XX.LCS.MIT.EDU +In-Reply-To: <870921152108.3.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12336460717.23.TY@XX.LCS.MIT.EDU> + +We still have one of the TU20's in the basement. I don't know what the specs are for the thing. It is +a 7-track drive and yes the controller is still attached. It was to be kept around in case anyone +wanted to read the old ITS tapes. What plans LCS have for it now ??? ( TJG could answer) + I will try to find the specs on the head and see if they match yours.. +------- + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 20024224620) by AI.AI.MIT.EDU 21 Sep 87 15:28:27 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 237764; Mon 21-Sep-87 15:21:53 EDT +Date: Mon, 21 Sep 87 15:21 EDT +From: David A. Moon +Subject: [Martin Frost : old magtape heads ] +To: Alan Bawden , me@SAIL.STANFORD.EDU +cc: CENT@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU, BERLIN@XX.LCS.MIT.EDU, tjg@XX.LCS.MIT.EDU +In-Reply-To: <256807.870918.ALAN@AI.AI.MIT.EDU> +Message-ID: <870921152108.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 18 Sep 87 14:10:21 EDT + From: Alan Bawden + + Date: Thu, 17 Sep 87 20:45:06 EDT + From: Pandora B. Berman + + the old mc, now mx, retains its drive (not a tu20, nor a 45, perhaps + JTW can cons up the variety) as long as we have any hope of reviving + it. good luck with hunting elsewhere or remanufacture. + + I don't know what this drive is called by DEC (there is nothing inscribed + on the cabinet), but I think that it was actually manufactured by IBM. + +It's the 7-track version of the TU40, possibly called TU41, and it was +manufactured by Mohawk Data Sciences. We have, if we haven't lost them, +a set of MDS manuals for it (fat blue ring-bound notebooks). It needs +both a TM10B and a DF10 for interfacing. + + +Date: Fri, 18 Sep 87 14:10:21 EDT +From: Alan Bawden +Subject: [Martin Frost : old magtape heads ] +To: CENT@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU, me@SAIL.STANFORD.EDU, + BERLIN@XX.LCS.MIT.EDU, tjg@XX.LCS.MIT.EDU +In-reply-to: Msg of Thu 17 Sep 87 20:45:06 EDT from Pandora B. Berman +Message-ID: <256807.870918.ALAN@AI.AI.MIT.EDU> + + Date: Thu, 17 Sep 87 20:45:06 EDT + From: Pandora B. Berman + Date: 07 Aug 87 1743 PDT + From: Martin Frost + ... + sorry marty -- as you've noticed, the heads are what go. DM and the + old AI and ML machines had tu20s, and there were a few extra tu20s in + the basement, principally for cannibalizing heads from. the old AI's + and ML's heads were in pretty bad shape when those machines went down + the tubes (i should know, i was dumping them), and DM probably had the + same problems -- perhaps to a lesser extent because it was actually on + maint. contract for much of its life, but it disappeared into the + depths around 3 years ago. + +Actually, DM had a 9-track drive. + + perhaps someone could talk gerry brown (the lcs stockroom guru and boss + of the storage areas) into letting him poke around in the lcs basement + rooms to see whether dm's drive is still around -- but it's pretty + chancy. most of the old ai lab junk was trashed, or at least went into + very deep storage (a warehouse somewhere) when the lab was gifted with + marc raibert last year, because raibert needed the ai basement storage + for his hopping robots lab, so there's no hope on our side. + + the old mc, now mx, retains its drive (not a tu20, nor a 45, perhaps + JTW can cons up the variety) as long as we have any hope of reviving + it. good luck with hunting elsewhere or remanufacture. + +I don't know what this drive is called by DEC (there is nothing inscribed +on the cabinet), but I think that it was actually manufactured by IBM. + +Date: Thu, 17 Sep 87 20:45:06 EDT +From: "Pandora B. Berman" +Subject: [Martin Frost : old magtape heads ] +To: me@SAIL.STANFORD.EDU +cc: POOR-MC@AI.AI.MIT.EDU, BERLIN@XX.LCS.MIT.EDU, + tjg@XX.LCS.MIT.EDU +Message-ID: <256437.870917.CENT@AI.AI.MIT.EDU> + + Date: Sat 8 Aug 87 19:12:30-EDT + From: Steve Berlin + Subject: [Martin Frost : old magtape heads ] + To: tjg@XX.LCS.MIT.EDU, sra@XX.LCS.MIT.EDU, jtw@XX.LCS.MIT.EDU, + cent@OZ.AI.MIT.EDU + cc: me@SAIL.STANFORD.EDU + I don't know who might have an answer to this question - but I don't + know what hardware we have sitting around... + --------------- + Date: 07 Aug 87 1743 PDT + From: Martin Frost + Subject: old magtape heads + To: berlin@XX.LCS.MIT.EDU + Hi, Steve. We're looking for some replacement magtape heads for our + old 7-track tape drives, and someone here said there were some old tape + drives (and other computer stuff) in the basement of the MIT AI lab + building. I wonder if you could check for us, or maybe ask someone + else there to check this out. + What we have are DEC 545 7-track 45 ips drives, which are really + Datamec D2020 drives, and the heads are Datamec catalog number 10400-9S + (stamped on the head assembly). All we need is the head assembly. + Our heads are pretty worn and now we want to read some 2700 old tapes + to convert them to 9-track tapes. So if there are the same heads + sitting there no longer being used (or better, unused spares sitting + around), then we could certainly make good use of them. If there are + the same heads there but they are well worn (noticeable groove cut into + the head by the tape), then they're probably not useful to us. The + heads would have to be for a 45-ips drive to work for us. + If we can't find any spare heads, we'll have our heads remanufactured. + But if you can find out anything for us, I'd certainly appreciate it. + Thanks. + +sorry marty -- as you've noticed, the heads are what go. DM and the old AI +and ML machines had tu20s, and there were a few extra tu20s in the +basement, principally for cannibalizing heads from. the old AI's and ML's +heads were in pretty bad shape when those machines went down the tubes (i +should know, i was dumping them), and DM probably had the same problems -- +perhaps to a lesser extent because it was actually on maint. contract for +much of its life, but it disappeared into the depths around 3 years ago. +perhaps someone could talk gerry brown (the lcs stockroom guru and boss of +the storage areas) into letting him poke around in the lcs basement rooms +to see whether dm's drive is still around -- but it's pretty chancy. most +of the old ai lab junk was trashed, or at least went into very deep storage +(a warehouse somewhere) when the lab was gifted with marc raibert last +year, because raibert needed the ai basement storage for his hopping robots +lab, so there's no hope on our side. + +the old mc, now mx, retains its drive (not a tu20, nor a 45, perhaps JTW +can cons up the variety) as long as we have any hope of reviving it. good +luck with hunting elsewhere or remanufacture. + +Date: Tue, 1 Sep 87 07:27:11 EDT +From: Alan Bawden +Subject: Todays news +To: POOR-MX@AI.AI.MIT.EDU +cc: BUG-COMSAT@AI.AI.MIT.EDU +Message-ID: <248911.870901.ALAN@AI.AI.MIT.EDU> + +Yesterday MX ate part of the DRAGON directory and -all- of the .MAIL. +directory. Presumably this is caused by more of the blocks-of-zeros +lossage. + +I didn't bother to bring ITS back up, since I didn't see any reason to +destroy more of the filesystem without fixing the hardware problem. + +(.MAIL. really is totally gone. It looks like the part of the directory +containing all of the file blocks got zeroed, and then ITS ran for a wrile +while mail servers created new MAIL > files. There is also a STATS 1 file, +although I can't imagine how COMSAT could have continued to run for long +with an empty directory.) + +Date: Mon, 31 Aug 87 01:00:54 EDT +From: Alan Bawden +Subject: the last 32 words in a block +To: POOR-MX@AI.AI.MIT.EDU +cc: MAGIC-DRAGON-KEEPER@MX.LCS.MIT.EDU +In-reply-to: Msg of Mon 31 Aug 87 00:14:15 EDT from Puff the Magic Dragon +Message-ID: <248464.870831.ALAN@AI.AI.MIT.EDU> + + Date: Mon, 31 Aug 87 00:14:15 EDT + From: Puff the Magic Dragon + To: MAGIC-DRAGON-KEEPER at MX + + The file DSK:CHANNA;LOGOUT TIMES seems to be clobbered. Please check it. + The offensive material follows: + +The "offensive material" consisted of exactly 32 words containing 0 that +had replaced the last 32 words in a disk block. + +Date: Mon, 24 Aug 87 17:46:27 EDT +From: "Michael A. Patton" +Subject: Follow up to Wroclawski's message +To: POOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 23 Aug 87 00:38:54 EDT from John T. Wroclawski +Message-ID: <245828.870824.MAP@AI.AI.MIT.EDU> + + +We looked at, but didn't actually get around to fixing the DH lines. +Now that the power supply is back up, we should organize a DH fixing +party. It shouldn't take to much effort to arrange to have one +working (and one doubly broken) DH and get the dialups active again. + + -Mike + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 23 Aug 87 00:40:19 EDT +Date: Sun, 23 Aug 87 00:38:54 EDT +From: "John T. Wroclawski" +To: poor-mx@AI.AI.MIT.EDU +Message-ID: <981373.870823.JTW@MX.LCS.MIT.EDU> + + +Well. Once again the KL is running. + +In the last month various people have repaired: + + The console PDP-11 + The RP04s + The DH11 modem TTY lines + The main CPU power supplies. + +Maybe that will keep it going for a little while longer. + + + +Date: Thu, 6 Aug 87 08:31:17 EDT +From: Ray Hirschfeld +Subject: mail to MX +To: POSTMASTER@AI.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU +Message-ID: <238592.870806.RAY@AI.AI.MIT.EDU> + +I took MX out of the *ITS and *BBOARD lists because I'm sick of seeing +duplicate messages. People seem to assume that their whole message +failed when they get a failure message about MX, and resend it. + +Because of the way it was defined, I removed *MX as well. + +I made the change on AI, MC, and ML. MD seems to be down at the +moment. + + Ray + +Date: Thu, 30 Jul 87 15:26:11 EDT +From: "Michael A. Patton" +Subject: The losing console +To: JTW%MIT-SPEECH@XX.LCS.MIT.EDU +cc: POOOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 29 Jul 87 01:32:25-EDT from John Wroclawski +Message-ID: <235289.870730.MAP@AI.AI.MIT.EDU> + + +I noticed several LA36s over near where the dover used to be. Does +anybody know who belongs to these or what there condition is? It +would be a shame to lose because of a busted terminal. + +Date: Wed, 29 Jul 87 11:09:08 EDT +From: "John T. Wroclawski" +To: POOOR-MX@AI.AI.MIT.EDU +Message-ID: <234614.870729.JTW@AI.AI.MIT.EDU> + + + From: "John Wroclawski" + Subject: Re: The origin of this message + + I rewired the machine some to move things from the power supply fed by + CB9 to an unused one fed by CB10. ITS is running; if either CB9 or CB10 + blows, i guess it would make sense to leave it down till we can try + something else. + +Oh well, I should have disconnected it completely. The power supply in +question, apparently pissed off by its unceremonious removal from +service after all these years, has retaliated in dramatic fashion. +Those of you who remember Guttag's VAX... + +I think things can be fixed, but it will take an evening. In the +meantime, the machine is off. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 JUL 87 01:36:35 EDT +Date: Wed 29 Jul 87 01:32:25-EDT +From: "John Wroclawski" +Subject: Re: The origin of this message +To: alan@AI.AI.MIT.EDU, pooor-mx@AI.AI.MIT.EDU +In-Reply-To: <233018.870726.ALAN@AI.AI.MIT.EDU> +Message-ID: <12322139234.8.JTW@MIT-SPEECH> + + From: Alan Bawden + Subject: The origin of this message + + ... I left it down because I figured that we should make + an attempt to discover just -why- that breaker keeps tripping before + further shocking the machine by cycling its power. + +I rewired the machine some to move things from the power supply fed by +CB9 to an unused one fed by CB10. ITS is running; if either CB9 or CB10 +blows, i guess it would make sense to leave it down till we can try +something else. + +It will come as no surprise to anyone that the CPU doesn't quite match +the prints... + +If someone who has a handy can of WD40 would spray it all over the console +head motion mechanism, it would be a Good Thing. + +------- + +Date: Sun, 26 Jul 87 14:57:02 EDT +From: Alan Bawden +Subject: The origin of this message +To: POOOR-MX@AI.AI.MIT.EDU, JBVB@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 25 Jul 87 22:56:10 EDT from James B. VanBokkelen +Message-ID: <233018.870726.ALAN@AI.AI.MIT.EDU> + + Date: Sat, 25 Jul 87 22:56:10 EDT + From: James B. VanBokkelen + Fondling the console 11 has restored function to most of it, but not the + dialup lines on the DH.... + +Much thanks for your assistance! + +The bad news, folks, is that this problem with Circuit Breaker 9 on the +power supply blowing out continues to happen. MX managed to run from about +11 last night until about 5 this morning, before that breaker tripped. I +left it down because I figured that we should make an attempt to discover +just -why- that breaker keeps tripping before further shocking the machine +by cycling its power. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 25 Jul 87 22:59:05 EDT +Date: Sat, 25 Jul 87 22:56:10 EDT +From: "James B. VanBokkelen" +Subject: The origin of this message +To: POOOR-MX%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <981282.870725.JBVB@MX.LCS.MIT.EDU> + +Fondling the console 11 has restored function to most of it, but not the +dialup lines on the DH. We did manage to find appropriate 11-based +diagnostics for the DH, and they report both of them to be bad, the +first (dialup & ??) worse than the 2nd. See the console printout for +details. + +MAP and Alan are planning to rearrange lines & hardware addresses on +the DHs to get dialup working sometime next week. It is hoped that +the problem on the 2nd DH11 is so minor that IOELEV won't ever notice +it..... + +jbvb + + +Date: Fri, 24 Jul 87 16:20:03 EDT +From: "Michael A. Patton" +Subject: A laying on of hands for the PDP-11 +To: POOOR-MX@AI.AI.MIT.EDU +Message-ID: <232199.870724.MAP@AI.AI.MIT.EDU> + + +JBVB and I are planning on applying a laying on of hands to the MX +front end PDP-11 bright and early Saturday Afternoon (probably around +1?). If we get the PDP-11 running it might be useful to have a more +experienced ITS/PDP-10 person around when we try to bring it up. We +will be collecting are spells (prints) and magic wands (tools) this +evening (at TMRC and elsewhere), and will be in tomorrow to perform +rituals around the dead machine in an attempt to resurrect it. Anyone +who wishes to help (or to offer sacrifices) is encouraged to attend. + + -Mike Patton + +Date: Sat, 11 Jul 87 19:37:50 EDT +From: Alan Bawden +Subject: Front End PDP11 Kaput +To: POOOR-MX@AI.AI.MIT.EDU, JBVB@AI.AI.MIT.EDU +Message-ID: <226404.870711.ALAN@AI.AI.MIT.EDU> + +The KL's front end PDP11 (the "console 11") is broken. When we powered up +the machine last night, it was unable to boot from disk. It was able to +boot from DECtape, so Moon poked around (using KLDCP) to try and figure out +if something was wrong with its RH11. + +Halfway through this process, the 11 stoped working completely. You can +deposit stuff in memory from the switches and read it back, and you can get +the boot-from-DECtape program (stored in some kind of read-only memory) to +run. But as soon as you try to execute any instructions from real memory, +you generally discover that the real memory contains gubbish. + +Moon and JTW pulled the 11 out of the cabinet and poked around with a volt +meter to see if there were any obvious problems, but found nothing. At +this point the meeting was adjourned. + +Recall that the dialups haven't been functioning for some time now, and +that they are also attached to the console 11. Also the console LA36 has +occasionally been uncooperative, although reloading the 11 generally fixed +that immediately. I personally suspect some kind of slow Unibus rot. I +wonder if there is any signifigance to the fact that the dialup interface +is at the far end of the Unibus (in the extension cage on the other side of +the processor bays)? + +Perhaps its time for some PDP11 hackers to emerge to save the day? + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 27 Jun 87 20:52:27 EDT +Date: Sat, 27 Jun 87 20:48:21 EDT +From: Alan Bawden +Subject: Guess what! +To: Pooor-MX@AI.AI.MIT.EDU +Message-ID: <980457.870627.ALAN@MX.LCS.MIT.EDU> + +That's right, the KL is running again. +(JTW cleaned some contacts in the RP06.) + + +Date: Sun, 21 Jun 87 14:20:57 EDT +From: Alan Bawden +Subject: Unit #2 cranky +To: POOOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Sat 20 Jun 87 18:24:01 EDT from Communications Satellite +Message-ID: <217648.870621.ALAN@AI.AI.MIT.EDU> + + Date: Wed, 17 Jun 87 17:01:22 EDT + From: Alan Bawden + ... With two of three RP04's offline it becomes difficult, although + probably not impossible to bring ITS back up again. Before anyone + tries that, it might be a good idea to see if any diagnostics can find + the problem. + +I made a half-hearted attempt to bring MX up again the other night, but +quickly became discouraged. Any given file has a 50% chance of being +unavailable, which makes the undertaking quite an interesting game of +chance. + +Luckily the most recent version of ITS itself is sitting on pack #0, and +luckily there is a version of Exec DDT on Pack #0 as well, and there is +even a file in the front-end-filesystem that knows how to load it up (its +not a regular .CMD file though, so you have to type in a few commands by +hand...) + +The salvager dumped out with ITS won't let you bring the system up without +pack #1, and .;@ SALV is on pack #1. But @ OSALV is on pack #0, so you can +use it to check out the filesystem before starting ITS by hand at GO. + +SYS;ATSIGN HACTRN is a link to SYS;ATSIGN PWORD which is on pack #1. +ATSIGN DDT is also on pack #1, but there is an ATSIGN ODDT on pack #0, so +one way to proceed is to rename this to be ATSIGN HACTRN. (Or patch ITS to +use the name ODDT rather than HACTRN...) + +Another possibility is to install a new HACTRN over the network. (Using +the network is necessary eventually anyway, because to get other missing +stuff back from tape, we need SYSBIN;DUMP BIN which is on pack #1.) +SYS;ATSIGN CHAOS is on pack #1, but ATSIGN TCP is on pack #0 and so is +SYSBIN;FTPS BIN, so this is a viable path as well. + +At this point I stopped, because it became clear that in order for the +machine to be useful to anyone, I would have to pull a -lot- of stuff back +from tape onto a pack that was already mostly full. There was clearly a +lot of work ahead, and it would be wasted effort if it turns out that the +drive can be fixed by swapping power supplies with unit #1, or something +equally trivial. + +Date: Wed, 17 Jun 87 17:01:22 EDT +From: Alan Bawden +Subject: Unit #2 cranky +To: POOOR-MX@AI.AI.MIT.EDU +Message-ID: <215786.870617.ALAN@AI.AI.MIT.EDU> + +Unit #2 has taken to unloading its heads and spinning itself down. I only +got MX to run for about 10 minutes this afternoon. + +With two of three RP04's offline it becomes difficult, although probably +not impossible to bring ITS back up again. Before anyone tries that, it +might be a good idea to see if any diagnostics can find the problem. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 11 May 87 01:13:52 EDT +Date: Mon, 11 May 87 01:11:18 EDT +From: Alan Bawden +Subject: Unit #0 / Pack #0 +To: poor-mc@AI.AI.MIT.EDU +Message-ID: <977411.870511.ALAN@MX.LCS.MIT.EDU> + +Unit #0 on the KL has been getting a lot of errors in the last few days. +Hard ECC errors, header compare errors and header CRC errors. The lossage +seems to be intermittent. (Like I'll find a network server that died with +an irrecoverable data error on some file, but I have no trouble reading the +file myself.) I've also found a few network servers dead signaling parity +errors (%PIPAR set), but the system hasn't done an ordinary parity sweap +since the system came up. Moon thinks that this is what ITS does when an +irrecoverable disk error happens while swapping. + +If we are about to lose another RP04, this could be the end. Of course if +-someone- wants to try and collect all of the important system files on to +pack #0, we could split the two-pack primary disk system into parts. I'll +be happy to offer advice to any takers. + +Of course perhaps we should try DUPing pack #0 first, in case the problem +is with with the pack and not the drive. + + +Date: Fri, 8 May 87 23:46:04 EDT +From: "Pandora B. Berman" +Subject: dialups to MX are not working +To: SWF@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU, JBVB@AI.AI.MIT.EDU +Message-ID: <197568.870508.CENT@AI.AI.MIT.EDU> + + Date: Thu, 7 May 87 20:12:00 EDT + From: "Scott W. Frazier" + Subject: dialups to MX are not working + To: POOR-MX%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU + cc: BUG-HARDWARE%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU + With all the things that are wrong with MX already, I almost feel + stupid submitting a bug report. Oh well. The dialups to MX are not + working. They answer but they do not send anything after they connect. + I hope this is the correct list to send this to. + +we know about this. since MX is not maintained, this sort of thing gets +fixed on an ad hoc basis. a couple of folks have offered to take a look at +them, but i don't know when they will get around to doing so. until then, +you get to suffer along with the rest of us. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 7 May 87 20:14:12 EDT +Date: Thu, 7 May 87 20:12:00 EDT +From: "Scott W. Frazier" +Subject: dialups to MX are not working +To: POOR-MX%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +cc: BUG-HARDWARE%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <977187.870507.SWF@MX.LCS.MIT.EDU> + + +Hello, + +With all the things that are wrong with MX already, I almost feel stupid +submitting a bug report. Oh well. The dialups to MX are not working. +They answer but they do not send anything after they connect. I hope +this is the correct list to send this to. + +- Swf + + + +Date: Fri, 24 Apr 87 08:50:56 EDT +From: "Pandora B. Berman" +Subject: MX Dialup lossage +To: JBVB@AI.AI.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU +Message-ID: <190306.870424.CENT@AI.AI.MIT.EDU> + + Date: Wed, 22 Apr 87 20:14:45 EDT + From: "James B. VanBokkelen" + Subject: MX Dialup lossage + To: CENT@AI.AI.MIT.EDU + I am interested in fixing the MX dialup lossage. Information I have + from SRA and Bede indicates the problem is probably in the DH11 + terminal interface. I know 11s fairly well, and I think that give a + DH11 manual, I can at least isolate the problem better. + Rob has told me that he doesn't mind if I shut the machine down to hack + on it when it is idle, so I'm warning you (and solicting comments) + about this project. I probably won't do anything before early next + week in any case (no DH manual, not much time). + +i think it's a dandy idea. but i'm not the only one with a vested interest +in the blue monster. this list should catch most of them. + +assuming that you go ahead, please be careful about bringing ITS down and +up, and if necessary powercycling the 10, during your experiments; as you +know, we can't call in DEC to fix anything that gets fried. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 9 Apr 87 14:00:53 EDT +Received: from WHORFIN.LCS.MIT.EDU by XX.LCS.MIT.EDU via Chaosnet; 9 Apr 87 13:56-EDT +Date: Thu, 9 Apr 87 14:01 EDT +From: Rob Austein +Subject: [TY: status of modems] +To: Alan Bawden +cc: Poor-MX@AI.AI.MIT.EDU +In-Reply-To: <174984.870328.ALAN@AI.AI.MIT.EDU> +Message-ID: <870409140115.3.SRA@WHORFIN.LCS.MIT.EDU> + + Date: Sat, 28 Mar 87 00:04:14 EST + From: Alan Bawden + + Date: Fri 27 Mar 87 14:46:11-EST + From: J. J. Tyrone Sealy + Does anyone know why the modems on MX don't answer ? + The Modems are ok !!!The software ? + + Could this be a result of some change to the console version of IOELEV? + (Or perhaps it (the 11) has just crashed... Unfortunately I'm at home + where I can't check that now...) + +The current theory is that one of the DH-11s might be out (just one of +the four-line blocks, actually). Anybody with data to confirm or deny +this theory is encouraged to speak up; I don't even know where the tty +line configuration info lives on ITS, although I suppose I could figure +it out. + +Some TMRC people have mentioned that they might wander by with a scope +at some point and look at the 11 to see what's wrong. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 27 Mar 87 14:48:43 EST +Date: Fri 27 Mar 87 14:46:11-EST +From: J. J. Tyrone Sealy +Subject: status of modems +To: poor-mc@AI.AI.MIT.EDU +Message-ID: <12289788801.14.TY@XX.LCS.MIT.EDU> + +Does anyone know why the modems on MX don't answer ? The Modems are ok !!!The software ? + +------- + +Received: from YUKON.SCRC.Symbolics.COM (TCP 30002424403) by AI.AI.MIT.EDU 24 Mar 87 20:45:02 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by YUKON.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 183570; Tue 24-Mar-87 20:40:38 EST +Date: Tue, 24 Mar 87 20:40 EST +From: David A. Moon +Subject: Longer life @ MIT for Poor-mc +To: Thomas J. Greene +cc: poor-mc@AI.AI.MIT.EDU +In-Reply-To: <12289025411.52.TJG@XX.LCS.MIT.EDU> +Message-ID: <870324204013.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Tue 24 Mar 87 16:52:45-EST + From: Thomas J. Greene + + Alan Wu at ECS has space for old-MC(MX). He does not have the people to + keep it alive. Would the people who have volunteered there time and + energy to keep it going for the last 12 months here in LCS, walk across + the street to continue the effort in building 38 ? + +Note that some of the most relevant people are on vacation right now, so +if you don't hear anything for a couple of weeks, it's not because nobody +cares. + +I don't think the machine would survive the trip across the street. I might +be proved wrong, but my prognostication is that it would break in an expensive +way while being moved. + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 24 Mar 87 16:56:47 EST +Date: Tue 24 Mar 87 16:52:45-EST +From: Thomas J. Greene +Subject: Longer life @ MIT for Poor-mc +To: poor-mc@AI.AI.MIT.EDU +cc: tjg@XX.LCS.MIT.EDU +Message-ID: <12289025411.52.TJG@XX.LCS.MIT.EDU> + +Alan Wu at ECS has space for old-MC(MX). He does not have the people to +keep it alive. Would the people who have volunteered there time and +energy to keep it going for the last 12 months here in LCS, walk across +the street to continue the effort in building 38 ? + Your thoughts please. +.... tjg@xx +------- + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 21 Mar 87 14:07:15 EST +Date: Sat, 21 Mar 87 14:07:33 EST +From: "David A. Moon" +Subject: Status of MX DF10 +To: poor-mc@AI.AI.MIT.EDU +Message-ID: <972367.870321.MOON@MX.LCS.MIT.EDU> + +There is no sign any directories having been destroyed with zeros +at their ends, in the way that was happening before, during the week +that MX has been up now. Congratulations John and Alan, I think you +really fixed the DF10.. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 17 Mar 87 13:54:30 EST +Date: Tue, 17 Mar 1987 13:48 EST +Message-ID: +From: PSZ@XX.LCS.MIT.EDU +To: "Pandora B. Berman" +Cc: gjs@OZ.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU, SRA@XX.LCS.MIT.EDU, + psz@XX.LCS.MIT.EDU +Subject: Future of the KL +In-reply-to: Msg of 16 Mar 1987 03:51-EST from Pandora B. Berman + +Sorry to get in on this so late, but I am a bit confused about all the +arguments. It seems that all the issue of office space and where CR +should be is independent of the KL issue, and can probably be resolved +satisfactorily. So the real question is do we want to and can we +afford to keep MX? In its current state of unreliability, I see no +advantage at all to keeping it. In fact, I have had to move all the +people in my group who use it off MX 'cause it was just too ill to +provide any useful service. The real problem, I think, is just that +it's too expensive to maintain the beast and we don't have the talent +lying around to maintain it on the cheap. This is not an unusual fate +for 11 or 12 year old machines, and I'm not sure I see what reason +there is to shed big tears over it. I'm open for argument, but my +current impression is that MX is a great big white elephant and I +don't see why we should be fighting against its demise. --Pete + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 16 Mar 87 22:49:11 EST +Date: Mon 16 Mar 87 22:43:19-EST +From: "J. Noel Chiappa" +Subject: Re: Future of the KL +To: SRA@XX.LCS.MIT.EDU, CENT@AI.AI.MIT.EDU +cc: gjs@OZ.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, + psz@ZERMATT.LCS.MIT.EDU, JNC@XX.LCS.MIT.EDU +In-Reply-To: +Message-ID: <12286992079.71.JNC@XX.LCS.MIT.EDU> + + When IMP 6 (the Mil Spec one) was decomissioned I tried to +get the MIT Museum interested and they weren't, on the grounds that +MIT hadn't built the machine. The Computer Museum might have a more +enlightened attitude to a machine which was novel for software reasons, +not necessarily hardware, but who knows? + + Noel +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 16 Mar 87 16:31:55 EST +Date: Mon, 16 Mar 1987 16:26 EST +Message-ID: +From: Rob Austein +To: "Pandora B. Berman" +Cc: gjs@OZ.AI.MIT.EDU, POOR-MX@AI.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, + psz@ZERMATT.LCS.MIT.EDU +Subject: Future of the KL +In-reply-to: Msg of 16 Mar 1987 03:51-EST from "Pandora B. Berman" + +Penny, you are missing the point. The excuse doesn't need to be +valid, just sound good enough to shut people up. We're talking about +politics, and MX doesn't have much of a constituency left (not people +with voting rights, anyway). + +After talking with JTW and with Tom Green about this, my attitude is +that I'd like to keep the machine alive, but I don't intend to spend +my next N years worth of brownie points doing so. If PSZ and GJS (and +those others of their rank that Big Mike will listen to) don't think +it's worth the effort, I'm not going to fight it. + +Has anybody sounded out the Computer Museum about the beast? It is a +pretty big piece of history, and Tom really does want to find it a +good home rather than just pushing it off the roof. I'm not committed +to this idea, but it does sound like a more reasonable end than having +the CPU finally melt down into a pile of slag. + +Date: Mon, 16 Mar 87 03:51:59 EST +From: "Pandora B. Berman" +Subject: Future of the KL +To: SRA@XX.LCS.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, gjs@OZ.AI.MIT.EDU, + psz@ZERMATT.LCS.MIT.EDU +Message-ID: <169036.870316.CENT@AI.AI.MIT.EDU> + + Date: Fri, 13 Mar 1987 18:14 EST + From: Rob Austein + To: gjs@OZ.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, psz@ZERMATT.LCS.MIT.EDU + cc: Poor-MX@AI.AI.MIT.EDU + Subject: Future of the KL + .... + FYI, the current theory seems to be that we suddenly need the floor space; + somebody (I think Al Vezza but it might be Big Mike) wants CR group (me, + Ty, Bede, etc) out of the fifth floor and onto the ninth, which (1) gets us + janitorial types out of space that could be used by researchers, (2) gives + a "good" reason to flush the KL for floorspace. From their point of view + this solves several thorny problems at once. + +Darth Vezza and Grand Moff D. do not have a leg (collectively) to stand on. +if they're just so desperate to strand you & your friends on the ninth +floor, they can + 1. move some of the remaining VAXen in the VAX farm around to create a +nice roomy office next to 936, and + 2. lean on AI a bit to remove the remains of Gutenburg, the Twenex doc +boxes, etc., and have a nice roomy office by the dover. + in both cases they would be recreating office space that used to be there. +before the vax farm, LCS had a row of offices against the 9th south wall, +and of course there used to be 926 on the east wall. they -do not- need to +sacrifice the KL to get space, yet. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 14 MAR 87 20:36:17 EST +Date: Sat 14 Mar 87 20:31:59-EST +From: "John Wroclawski" +Subject: Re: disks, future, etc. +To: Moon@SCRC-STONY-BROOK.ARPA +cc: pooor-mx@AI.AI.MIT.EDU +In-Reply-To: <870314013805.5.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12286443881.12.JTW@MIT-SPEECH> + + + Me: + + .... a much smaller KL (maybe the CPU, 2 memory boxes, and + the DEC disk system)... + + Moon: + + But I don't think you can make the machine quite that small... + +I mentioned this particular configuration because it is the largest +that will fit in one row along the wall, and thus not take up very +much space. No question it'd be throwing away too much stuff, but +that's politics for you. +------- + +Date: Sat, 14 Mar 87 06:17:33 EST +From: "Glenn S. Burke" +Subject: Re: Future of the KL +To: SRA@XX.LCS.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, gjs@OZ.AI.MIT.EDU, + psz@ZERMATT.LCS.MIT.EDU +In-reply-to: Msg of Fri 13 Mar 1987 18:14 EST from Rob Austein +Message-ID: <168296.870314.GSB@AI.AI.MIT.EDU> + +As I fondly remember Darth, he was of the opinion that anything +running VMS or ITS was better off in the basement, if not the trash +heap. The right people have to get the ear of Grand Moff Dertouzoss, +directly. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 14 Mar 87 01:42:22 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 93296; Sat 14-Mar-87 01:38:05 EST +Date: Sat, 14 Mar 87 01:38 EST +From: David A. Moon +Subject: disks, future, etc. +To: John Wroclawski +cc: pooor-mx@AI.AI.MIT.EDU +In-Reply-To: <12286186516.8.JTW@MIT-SPEECH> +Message-ID: <870314013805.5.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri 13 Mar 87 20:58:14-EST + From: "John Wroclawski" + + I found some diags that triggered the problem seen under ITS (random parts + of a disk block read as zeros). Went through and gave all the flip-chips + and cable connectors in the DF10 a good rattle. Things seem to be working + OK now. + +Wonderful! Thanks a million, including for not making me follow through on my +rash remark of the other evening. + + One possible future for this dinosaur is that we negotiate some kind of + a compromise where a much smaller KL (maybe the CPU, 2 memory boxes, and + the DEC disk system) remains in a corner of the 9th floor. I am curious + as to whether anybody cares enough to be willing to help move stuff around + at some point if things work out that way. + +I'd be happy to help move stuff around. But I don't think you can make +the machine quite that small. "Maybe the CPU"? The machine isn't too +much use without its 7-track tape drive; think about what happens if +there's some sort of disk trouble. I also don't think we want to lose +the Chaosnet. Maybe we can move the Chaosnet to the other 11; it'll be +slow, but not as slow as the Chaosnet interfaces we're using now on the +KS's. Then we could junk the second 11, the DL10, and the T-300s. +That's cool, but somebody's gotta write a little software. If the CPU +moves more than a few feet, the Arpanet connection will be lost -- maybe +that's considered okay. On the other hand, maybe the cpu can't move +because moving the 10-ton outlet it plugs into would be too expensive. +I'd say keep 3 memory boxes, one for spares. So I say the machine can +plausibly be decreased from 16 refrigerators plus 6 disk drives to 12 +refrigerators plus 2 disk drives. Maybe 11 refrigerators if we take +advantage of the fact that there's a lot of air inside a DF10. + + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 13 MAR 87 21:01:47 EST +Date: Fri 13 Mar 87 20:58:14-EST +From: "John Wroclawski" +Subject: disks, future, etc. +To: pooor-mx@AI.AI.MIT.EDU +Message-ID: <12286186516.8.JTW@MIT-SPEECH> + + +I found some diags that triggered the problem seen under ITS (random parts +of a disk block read as zeros). Went through and gave all the flip-chips +and cable connectors in the DF10 a good rattle. Things seem to be working +OK now. + +One possible future for this dinosaur is that we negotiate some kind of +a compromise where a much smaller KL (maybe the CPU, 2 memory boxes, and +the DEC disk system) remains in a corner of the 9th floor. I am curious +as to whether anybody cares enough to be willing to help move stuff around +at some point if things work out that way. +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 13 Mar 87 18:19:08 EST +Date: Fri, 13 Mar 1987 18:14 EST +Message-ID: +From: Rob Austein +To: gjs@OZ.AI.MIT.EDU, psz@XX.LCS.MIT.EDU, psz@ZERMATT.LCS.MIT.EDU +cc: Poor-MX@AI.AI.MIT.EDU +Subject: Future of the KL + +[PSZ, sorry about the multiple copies, but I can't figure out where + you read mail these days. Talk to me about this?] + +Esteemed ITS lovers. + +A move seems to be underway in LCS-HQ to declare the KL dead. This is +not definite (I can't get a straight answer out of the people who +really know what HQ is doing, but it's my reading of what they tell +me). I have been asked to find a good home for the thing where it can +be kept as an honored museum piece. If anybody knows of such a place, +let me know and I'll pass it along, but that's not really the issue. + +The issue is whether or not we are going to let HQ do this. GJS, PSZ, +you guys have a lot of weight with Big Mike, could you be persuaded to +sit on his desk till he gives up this silly idea? + +I got into this because my new boss, Tom Greene, has been put in the +position of ping-pong ball; HQ tells him to flush the machine, and +he's new enough here that he can't really tell them to go away. I +think. It is just barely possible that he himself wants the KL +flushed, but it's unlikely. + +In either case, the easiest way to handle this would be to convince +Mike that this is not a good idea, and let Tom get the news from +above. + +FYI, the current theory seems to be that we suddenly need the floor +space; somebody (I think Al Vezza but it might be Big Mike) wants CR +group (me, Ty, Bede, etc) out of the fifth floor and onto the ninth, +which (1) gets us janitorial types out of space that could be used by +researchers, (2) gives a "good" reason to flush the KL for floorspace. +From their point of view this solves several thorny problems at once. + +If I sound annoyed it's because I don't like AV and friends using a +new and confused person to do their dirty work. And of course I don't +want the KL flushed. I wouldn't mind a decent office on the 9th +floor, but I'm not a canible + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 12 MAR 87 19:36:22 EST +Date: Thu 12 Mar 87 19:32:50-EST +From: "John Wroclawski" +Subject: Re: Life is complicated, here in the future +To: poor-MX@AI.AI.MIT.EDU +In-Reply-To: <870308232501.0.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12285908824.18.JTW@MIT-SPEECH> + + +I ran some disk diagnostics on the KL. The DF10/RH10/RP04 setup does +all the simple things fine, but flakes in various ways while trying +to do anything that smacks of a reliability test. Barf. +------- + +Date: Sun, 8 Mar 87 23:58:57 EST +From: "Pandora B. Berman" +Subject: poor-mc arc +To: MOON@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <165388.870308.CENT@AI.AI.MIT.EDU> + + Date: Sun, 8 Mar 87 23:07:53 EST + From: Communications Satellite + Subject: Msg of Sunday, 8 March 1987 23:02-EST + To: MOON@AI.AI.MIT.EDU + Resent-To: poor-mc@ai.ai.mit.edu + Resent-From: David A. Moon + Resent-Date: Sun, 8 Mar 87 23:22 EST + Resent-Comments: This is perhaps a poor choice of place for the archive for the poor-mc mailing list!! + + Queued: (FILE [SYSDOC;POOR MC]) at MX.LCS.MIT.EDU + +fear not. there is a (superior if not identical) archive on AI. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 8 Mar 87 23:27:35 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 87928; Sun 8-Mar-87 23:25:07 EST +Date: Sun, 8 Mar 87 23:25 EST +From: David A. Moon +Subject: Life is complicated, here in the future +To: pooor-mx@AI.AI.MIT.EDU +In-Reply-To: <870308172805.8.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <870308232501.0.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Sun, 8 Mar 87 17:28 EST + From: David A. Moon + + The problem, I suspect, is that something is clobbering data written to + disk by bashing words N through the end of the block (where N varies) to + zero. This happened to the MFD and to several UFD's. Originally I thought + this happened as a side-effect of power going off, but if several directories + were clobbered in one incident, that can't be the cause. + + Unfortunately my most likely candidate for doing this would be the DF10, + a virtually unmaintainable piece of hardware. We had some code in the + system, developed when the (old) ML machine was dying, for doing + software read-compares on all disk writes. Looks like it better be + revived if we're going to bring MX back up. That's easier than getting + the system to run with no RP04s (all T-300s). I'll look into this + eventually if no one else does it first. Probably the system needs to + be reassembled to turn on that code. + +I turned on that code (see the log book) and it sort of works, but seems to +crash a lot with the DF10 executing complete garbage control words. I gave +up for the night. Maybe I screwed up the cache stuff, maybe it screws up +when it gets a correctable ecc error, or maybe the hardware is broken. +Anyway the Comsat database seems to be clobbered; there are some nulls and +things in LIST MASTER, and MAKMST didn't seem to work either. The new code +in the system can be turned off by patching QRCSW/0 + + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 8 Mar 87 23:24:53 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 87926; Sun 8-Mar-87 23:22:30 EST +Received: from AI.AI.MIT.EDU (MIT-AI.ARPA) by STONY-BROOK.SCRC.Symbolics.COM via INTERNET with SMTP id 87917; 8 Mar 87 23:06:05 EST +Date: Sun, 8 Mar 87 23:07:53 EST +From: Communications Satellite +Subject: Msg of Sunday, 8 March 1987 23:02-EST +To: MOON@AI.AI.MIT.EDU +Message-ID: <165362.870308@AI.AI.MIT.EDU> +Resent-To: poor-mc@ai.ai.mit.edu +Resent-From: David A. Moon +Resent-Date: Sun, 8 Mar 87 23:22 EST +Resent-Message-ID: <870308232225.9.MOON@EUPHRATES.SCRC.Symbolics.COM> +Resent-Comments: This is perhaps a poor choice of place for the archive for the poor-mc mailing list!! + +Queued: (FILE [SYSDOC;POOR MC]) at MX.LCS.MIT.EDU + + + +Date: Sun, 8 Mar 87 23:02:18 EST +From: "David A. Moon" +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <165361.870308.MOON@AI.AI.MIT.EDU> + +In summary, it's still broken. I'm giving up for the day. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 8 Mar 87 17:38:31 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 87816; Sun 8-Mar-87 17:28:20 EST +Date: Sun, 8 Mar 87 17:28 EST +From: David A. Moon +Subject: Life is complicated, here in the future +To: David Vinayak Wallace +cc: pooor-mx@AI.AI.MIT.EDU +In-Reply-To: <870308031911.3.GUMBY@MARLEY.AI.MIT.EDU> +Message-ID: <870308172805.8.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Sun, 8 Mar 87 03:19 EST + From: David Vinayak Wallace + + Well, MX is not in quite as good a shape as it had initially appeared. + + Several directories (among them DEVICE, SYSTEM, and INQUIR) vanished in + the recent surgery. After pondering whether or not to reload them over + the network I decided to reconstruct the MFD's from drive 2 (presuming + that something might be wrong with the pack on drive 0). Then I UCOP'ed + drive 2's MFD to the other packs. + +Oh, so that's why there were so many 0<-1's when I salvaged it! Damn, I +should have suspected the MFD was screwed up if I had had my brain turned on. +You did good. + +The problem, I suspect, is that something is clobbering data written to +disk by bashing words N through the end of the block (where N varies) to +zero. This happened to the MFD and to several UFD's. Originally I thought +this happened as a side-effect of power going off, but if several directories +were clobbered in one incident, that can't be the cause. + +Unfortunately my most likely candidate for doing this would be the DF10, +a virtually unmaintainable piece of hardware. We had some code in the +system, developed when the (old) ML machine was dying, for doing +software read-compares on all disk writes. Looks like it better be +revived if we're going to bring MX back up. That's easier than getting +the system to run with no RP04s (all T-300s). I'll look into this +eventually if no one else does it first. Probably the system needs to +be reassembled to turn on that code. + + The system is now in approximately the same shape it was before surgery + (tah-dah!). + + Hopefully somebody else will decide to fix it before we do. + + They might know what they're doing. + + + +Date: Sun, 8 Mar 87 17:13:53 EST +From: Alan Bawden +Subject: Life is complicated, here in the future +To: GUMBY@AI.AI.MIT.EDU +cc: POOOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Sun 8 Mar 87 03:19 EST from David Vinayak Wallace +Message-ID: <165231.870308.ALAN@AI.AI.MIT.EDU> + + Date: Sun, 8 Mar 87 03:19 EST + From: David Vinayak Wallace + ... + Several directories (among them DEVICE, SYSTEM, and INQUIR) vanished in + the recent surgery. After pondering whether or not to reload them over + the network I decided to reconstruct the MFD's from drive 2 (presuming + that something might be wrong with the pack on drive 0). Then I UCOP'ed + drive 2's MFD to the other packs. + + The system is now in approximately the same shape it was before surgery + (tah-dah!). + + Hopefully somebody else will decide to fix it before we do. + + They might know what they're doing. + +Huh? So what's still broken? Do you mean that the the MFD on unit #2 +didn't have the directories either? Then perhaps you should try running +the MFDR routine in the salvager to try to reconstruct the MFD from the +directory blocks. (I've never done that myself, so I can't tell you what +that will be like. You might want to glance though a salvager listing +first to see what it thinks it does. Recall that this is the pre-CStacy +salvager, so you can have some confidence that it might work.) + +Received: from MARLEY.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 8 MAR 87 03:19:59 EST +Date: Sun, 8 Mar 87 03:19 EST +From: David Vinayak Wallace +Subject: Life is complicated, here in the future +To: pooor-mx@AI.AI.MIT.EDU +Message-ID: <870308031911.3.GUMBY@MARLEY.AI.MIT.EDU> + +Well, MX is not in quite as good a shape as it had initially appeared. + +Several directories (among them DEVICE, SYSTEM, and INQUIR) vanished in +the recent surgery. After pondering whether or not to reload them over +the network I decided to reconstruct the MFD's from drive 2 (presuming +that something might be wrong with the pack on drive 0). Then I UCOP'ed +drive 2's MFD to the other packs. + +The system is now in approximately the same shape it was before surgery +(tah-dah!). + +Hopefully somebody else will decide to fix it before we do. + +They might know what they're doing. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 7 MAR 87 23:47:34 EST +Date: Sat 7 Mar 87 23:46:40-EST +From: "John Wroclawski" +Subject: Re: fan +To: poor-mc@AI.AI.MIT.EDU +In-Reply-To: <164090.870306.CENT@AI.AI.MIT.EDU> +Message-ID: <12284644315.24.JTW@MIT-SPEECH> + + +I have installed a new fan in the KL, leaving the machine at least +willing to stay on. + +It even appears to work almost. There is something broken such that +most jobs (net logins, daemons) won't start. Logging in from a +hardwired line works fine. Someone who knows something might look at +this. + +The spindle bearing on RP04 unit 2 is discontent. While we could +theoretically use the bearing from #1 to fix this, we never will, so +someone (that same mythical someone) might want to make sure that the +machine can be booted with a single RP04 present. +------- + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 6 MAR 87 03:16:30 EST +Date: Fri 6 Mar 87 03:15:57-EST +From: "John Wroclawski" +Subject: Re: fan +To: TY@XX.LCS.MIT.EDU, CENT@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +In-Reply-To: <12284143727.29.TY@XX.LCS.MIT.EDU> +Message-ID: <12284158124.31.JTW@MIT-SPEECH> + +No, the fan is bad. It appears to work now because I bashed it on the floor +a few times to get it to work long enough so that Dave could fix up the +filesystem. The supply is fine. + +I've been too busy to worry about this. I should have the required few +minutes this weekend though. I would however prefer that we get a new fan +from Lester so that I don't have to raid speech's spares. They are hard +to get from anywhere else because they are 208v, not 125. So if someone +sees Lester please ask him to bring a couple by (we should have a spare). +If he can just do it, great, but if not we will have to take up a +collection to pay for them I guess. +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 6 Mar 87 01:59:32 EST +Date: Fri 6 Mar 87 01:56:52-EST +From: J. J. Tyrone Sealy +Subject: Re: fan +To: CENT@AI.AI.MIT.EDU +cc: JTW@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU +In-Reply-To: <164090.870306.CENT@AI.AI.MIT.EDU> +Message-ID: <12284143727.29.TY@XX.LCS.MIT.EDU> + +I saw Lester today and He is checking to see what a power supply will cost. +It appears that the fans are ok the Supply is not.. +------- + +Date: Fri, 6 Mar 87 01:28:07 EST +From: "Pandora B. Berman" +Subject: fan +To: JTW@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <164090.870306.CENT@AI.AI.MIT.EDU> + +hey, john, are you going to replace the dead fan in the KL, or are you giving +up on it? + +Received: from DEEP-THOUGHT.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 24 FEB 87 22:14:01 EST +Date: Tue, 24 Feb 1987 22:07 EST +Message-ID: +From: PGS@DEEP-THOUGHT.MIT.EDU +To: poor-mx@AI.AI.MIT.EDU + +Plese igore my last messag to poor-mx. It seems I hadn't sufficiently +tested my theory that MC's front end was to blame, because, well, here I am +on this here other PDP-10, and something very damned fnny does seem to be +gong on wit this modem. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 24 Feb 87 22:04:59 EST +Date: Tue, 24 Feb 87 22:02:44 EST +From: "Patrick G. Sobalvarro" +To: POOR-MX%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <971329.870224.PGS@MX.LCS.MIT.EDU> + +Has anyone bsides me ntied that the dialups on MC sem t be dopping charactes? +I thought it was my shiny new Apollo tht was doin it, so I connected ths here +Ann Arbor up to my odem, an, well, it looks like it's either MC o the modem. +But the modem woks fine when talking to other machines. Thus, e conclude, it +is xtremey likel that MX's front end is dropping characts. Wildly. + + +Date: Tue, 24 Feb 87 15:05:39 EST +From: kltoz@AI.AI.MIT.EDU +Sender: ___016@AI.AI.MIT.EDU +Subject: Rudy.Nedved and the end of TOPS-10 +To: POOR-MX@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU, + BUG-ITS@AI.AI.MIT.EDU +Message-ID: <159022.870224.___016@AI.AI.MIT.EDU> + +Rudy Nedved is the person who caused the demise of info-cobol. + +Date: Tue, 24 Feb 87 01:21:56 EST +From: "Pandora B. Berman" +Subject: small request +To: Rudy.Nedved@H.CS.CMU.EDU +cc: POSTMASTER@AI.AI.MIT.EDU, BUG-ITS@AI.AI.MIT.EDU, + POOR-MX@AI.AI.MIT.EDU +Message-ID: <158772.870224.CENT@AI.AI.MIT.EDU> + + Date: Monday, 23 February 1987 19:28:36 EST + From: Rudy.Nedved@h.cs.cmu.edu + To: postmaster@mc.lcs.mit.edu + Subject: small request + Hi, Could some kind person take the time out to remove + MIT-MESSAGES@A.CS.CMU.EDU + from the mit bboard distribution list? +done, mostly by Gumby (i cleaned up a few things he missed). + It has been eons since I made a + change to a mailing list on MIT ITC +you mean ITS, right? + machines. Thanks much, + -Rudy + CMU CS/RI Postmaster + + P.S. The last TOPS-10 machine on the ARPANET, A.CS.CMU.EDU is going away + in a week or so. The official shutoff time for users is this Monday, + March 2nd. +alas, poor PDP-10s -- yet another casualty. it deserves recording +(wherefore the CCs to the other lists) and public mourning. probably if you +send a mildly clever farewell msg to arpanet-bboards it will get +broadcast... + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 10 Feb 87 12:59:04 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 67087; Tue 10-Feb-87 12:57:08 EST +Date: Tue, 10 Feb 87 12:57 EST +From: David A. Moon +Subject: [PFTHMG-DRAGON@MX.LCS.MIT.EDU: Forwarded] +To: Alan Bawden +cc: Poor-MC@AI.AI.MIT.EDU +In-Reply-To: <870209203852.8.ALAN@PIGPEN.AI.MIT.EDU> +Message-ID: <870210125709.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Mon, 9 Feb 87 20:38 EST + From: Alan Bawden + + Date: Mon, 9 Feb 87 20:20:28 EST + From: Puff the Magic Dragon + To: MAGIC-DRAGON-KEEPER%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU + Message-ID: <968893.870209.PFTHMG-DRAGON@MX.LCS.MIT.EDU> + + The file DSK:CHANNA;LOGOUT TIMES seems to be clobbered. Please check it. + The offensive material follows: + ZB 12/06+81 23:08:19 + + This is a single bit change in the file. (I corrected it.) Perhaps the + RP04's or the disk DF10 have started inserting subtle changes in the data + they handle? + +Could this have been caused by powering-on the broken MH10? + + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 9 FEB 87 20:38:01 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 21708; Mon 9-Feb-87 20:38:51 EST +Date: Mon, 9 Feb 87 20:38 EST +From: Alan Bawden +Subject: [PFTHMG-DRAGON@MX.LCS.MIT.EDU: Forwarded] +To: Poor-MC@AI.AI.MIT.EDU +Message-ID: <870209203852.8.ALAN@PIGPEN.AI.MIT.EDU> + + Date: Mon, 9 Feb 87 20:20:28 EST + From: Puff the Magic Dragon + To: MAGIC-DRAGON-KEEPER%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU + Message-ID: <968893.870209.PFTHMG-DRAGON@MX.LCS.MIT.EDU> + + The file DSK:CHANNA;LOGOUT TIMES seems to be clobbered. Please check it. + The offensive material follows: + ZB 12/06+81 23:08:19 + +This is a single bit change in the file. (I corrected it.) Perhaps the +RP04's or the disk DF10 have started inserting subtle changes in the data +they handle? + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 7 Feb 87 17:33:03 EST +Date: Sat, 7 Feb 1987 17:33 EST +Message-ID: +From: Rob Austein +To: Poor-MX@AI.AI.MIT.EDU +Subject: Crippled by a lowly fan + +The KL is down, none of the fans in the CPU will spin. Details in +log. Anybody know what circut controls this? I didn't want to just +start flipping breakers and pulling fuses at random. + +Date: Mon, 2 Feb 87 03:28:08 EST +From: "Pandora B. Berman" +Subject: read me +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <147776.870202.CENT@AI.AI.MIT.EDU> + + Date: Sat, 31 Jan 87 23:05 EST + From: David A. Moon + Subject: kl down in flames + To: Alan Bawden + cc: POOR-MC@AI.AI.MIT.EDU + Is the type-ball (cylinder actually?) actually worn out? Wow! Usually + the way to fix them is to clean the type cylinder and adjust the + various cams and pneumatic dashpots in the mechanism. I don't know too + much about it, but Howard Cannon used to do it for a living. + +i tried cleaning the cylinder and general surrounding mechanism. which was +quite filthy and covered with stray hair (how much have you torn out in +that area over the years, dave?). it now prints somewhat clearer but not +perfectly. someone who knows how to adjust the mechanism should take a look +at it. it is probably somewhat worn -- after all, just how old is that +terminal? + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 31 Jan 87 23:36:46 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 59259; Sat 31-Jan-87 23:05:08 EST +Date: Sat, 31 Jan 87 23:05 EST +From: David A. Moon +Subject: kl down in flames +To: Alan Bawden +cc: POOR-MC@AI.AI.MIT.EDU +In-Reply-To: <147304.870131.ALAN@AI.AI.MIT.EDU> +Message-ID: <870131230507.0.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Sat, 31 Jan 87 17:22:29 EST + From: Alan Bawden + + Anyone have any idea where we could get a new type-ball for a TTY33? + +Is the type-ball (cylinder actually?) actually worn out? Wow! Usually +the way to fix them is to clean the type cylinder and adjust the various +cams and pneumatic dashpots in the mechanism. I don't know too much +about it, but Howard Cannon used to do it for a living. + +More seriously, if anybody knows where we can get a decent terminal with +a current loop interface we could plug it in there when necessary. Or we +could get a pdp-11 programmer to tell 11DDT about DH-11 lines, maybe that +would be the best solution. We could debug at 9600 baud on the existing +VT52. + + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 31 JAN 87 22:51:12 EST +Received: from NULLSTELLENSATZ.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 19973; Sat 31-Jan-87 22:51:35 EST +Date: Sat, 31 Jan 87 22:51 EST +From: David Vinayak Wallace +Subject: TTY33 +To: Alan Bawden +cc: POOR-MC@AI.AI.MIT.EDU +In-Reply-To: <147304.870131.ALAN@AI.AI.MIT.EDU> +Message-ID: <870131225132.2.GUMBY@NULLSTELLENSATZ.AI.MIT.EDU> + +I'll stop by Heffron's this week. + +Date: Sat, 31 Jan 87 17:22:29 EST +From: Alan Bawden +Subject: kl down in flames +To: POOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Fri 30 Jan 87 08:04:39 EST from Pandora B. Berman +Message-ID: <147304.870131.ALAN@AI.AI.MIT.EDU> + +Yesterday, I fondled the T-300 cables and the KL has been running fine ever +since. I don't think that could possibly have addressed all of the +problems that Moon experienced the night before. + +Anyone have any idea where we could get a new type-ball for a TTY33? + +Date: Fri, 30 Jan 87 08:04:39 EST +From: "Pandora B. Berman" +Subject: kl down in flames +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <146747.870130.CENT@AI.AI.MIT.EDU> + +And it came to pass, oh Best Beloved, that MX died around 10:30 last night, +and i noticed around 11:30, and i tried to revive it. it proclaimed UCODE +HUNG, but it couldn't work its way through KLINIT on the route back up +without getting a 10 ERR,ADR=0 error. so i called Alan, and he suggested +this and that, none of which, alas, helped. so i called Moon (mightiest of +the mighty, oh Best Beloved) and he mentioned some of the suggestions of +Alan, and a few others also, none of which, alas, helped. then did Moon +swear a mighty oath that he would swing by on his way home and see what +could be seen. Nor did Moon break his oath, for soon he appeared, saying +"What is all this lossage?" And Moon called for a voltmeter, with which to +check the power supplies on memory C, and he found them deficient, and Moon +called for paper for the Shitty33, that he might converse with the 11. And +Moon also called for the KL to perform various highly unlikely and +improbable acts, for its behavior was not to his liking. And Moon, who is +the mightiest of the mighty, swore many another mighty oath at that time, +cursing the decrepitude of the KL and its LA120. Then did Moon find that, +despite his might, in his current state of weariness he had not the power +to raise the KL from its trance by the laying on of hands. So Moon slunk +off in disgust and exhaustion, oh Best Beloved, leaving the KL to wait for +future salvation. + +Details in the log. + +Date: Tue, 13 Jan 87 22:42:48 EST +From: "Pandora B. Berman" +Subject: The most embarrassing lossage yet +To: SRA@AI.AI.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU +Message-ID: <140003.870113.CENT@AI.AI.MIT.EDU> + + Date: Tue, 13 Jan 87 22:11:44 EST + From: Rob Austein + Subject: The most embarrassing lossage yet + To: Poor-MX@AI.AI.MIT.EDU + Anybody have a new ribbon for the poor fossilized console? The old one + is awfully pale, transparent I'd say. + +rob, you forgot to pull back the adjustment lever. it's now readable, +though far from good. the stock room is supposed to carry these, although +half the times i ask for them they are out. i will try again the next time +i'm down there. at worst, i suppose we could arrange for a requisition to +main-campus Lab Supply, which does have them. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 13 Jan 87 22:14:28 EST +Date: Tue, 13 Jan 87 22:11:44 EST +From: Rob Austein +Subject: The most embarrassing lossage yet +To: Poor-MX@AI.AI.MIT.EDU +Message-ID: <965272.870113.SRA@MX.LCS.MIT.EDU> + +Anybody have a new ribbon for the poor fossilized console? +The old one is awfully pale, transparent I'd say. + +Just $0.05 apiece and we can have a nice new ribbon.... + + +Date: Thu, 1 Jan 87 22:50:46 EST +From: Alan Bawden +Subject: MX unit #5 +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <135786.870101.ALAN@AI.AI.MIT.EDU> + +I took unit #5, the leftmost T-300, offline. The pack that was in that +drive appears to be perfectly readable, unit #4 has no trouble with it. +This means that the KL no longer has a FOURTH:. + +Date: Thu, 1 Jan 87 15:43:25 EST +From: Alan Bawden +Subject: MX unit #5 +To: KLOTZ@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, POOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 31 Dec 86 22:12:10 EST from Leigh L. Klotz +Message-ID: <135733.870101.ALAN@AI.AI.MIT.EDU> + + Date: Wed, 31 Dec 86 22:12:10 EST + From: Leigh L. Klotz + I just got a non-recoverable disk data error on + klotz;emacs :ej, which is on 14. + +When you log in, SYS:SYSTEM MAIL warned you that unit #5 was sinking fast. +Yeah, many files on that pack/drive have suffered. + +Perhaps I'll try swapping that pack with the one on unit #4 and see what +happens. If we are really lucky, that will destroy both of them! + + Date: Wed, 31 Dec 86 22:28:06 EST + From: Leigh L. Klotz + I renamed the bad file to klotz;.bad. :EJ, but the error went away. + It had been repeatable. Is anyone interested in this? Should I be + sending mail to POOR-MC? + +POOR-MC is probably the right place, although perhaps there is a POOR-MX +list that I don't know about. (POOR-KL?) + +Date: Wed, 31 Dec 86 17:06:56 EST +From: "Pandora B. Berman" +Subject: KS resurrection +To: TY@XX.LCS.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <135367.861231.CENT@AI.AI.MIT.EDU> + + Date: Wed 31 Dec 86 13:26:29-EST + From: J. J. Tyrone Sealy + Subject: Re: KS + To: Alan@AI.AI.MIT.EDU + cc: SRA@XX.LCS.MIT.EDU, Poor-MC@AI.AI.MIT.EDU + Dec came and align all the heads..the drive seemed ok after.. I + reloaded MC at 1:00 pm. let's hope it lives... + happy new year --TY + +thanks a million for keeping after this. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 31 Dec 86 13:26:08 EST +Date: Wed 31 Dec 86 13:26:29-EST +From: J. J. Tyrone Sealy +Subject: Re: KS +To: Alan@AI.AI.MIT.EDU +cc: SRA@XX.LCS.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +In-Reply-To: <861230170318.2.ALAN@GAYE.AI.MIT.EDU> +Message-ID: <12267229908.11.TY@XX.LCS.MIT.EDU> + +Dec came and align all the heads..the drive seemed ok after.. I reloaded MC at 1:00 pm. +let's hope it lives... + happy new year --TY +------- + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 30 DEC 86 17:03:49 EST +Received: from GAYE.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 16797; Tue 30-Dec-86 17:02:42 EST +Date: Tue, 30 Dec 86 17:03 EST +From: Alan Bawden +Subject: KS +To: SRA@XX.LCS.MIT.EDU +cc: Poor-MC@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <861230170318.2.ALAN@GAYE.AI.MIT.EDU> + +Well, it appears that the board that DEC replaced this morning may have +solved the problem. The diagnostics seem to be running without getting any +disk errors. If nothing bad happens for a day, perhaps I will bring MC +back up tomorrow (probably using the duplicated pack). TY is going to try +and get DEC to do a head alignment when they come in tomorrow as well. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 23 Dec 86 17:29:56 EST +Date: Tue, 23 Dec 1986 17:27 EST +Message-ID: +From: Rob Austein +To: Log-Service-Call@XX.LCS.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +Subject: KS + +This is just to let you know that I am effectively gone as of now. I +might log in and read my mail tomorow (or might not), but other than +that I am not here until 2 January 1987. So don't expect me to do +anything about fixing MC. + +Lester is already working on the disk drive. I don't know how much +money he's going to ask for but whatever it is, we should give it to +him (I wonder if he gives a cash discount? 8-). I don't think we have +much choice about this; Karen, if Mike complains about it too much, +just tell him about how badly all the Lisp Machines will break if they +can't use MC. + +Good luck, folks. I'll say hello to Florida for you all.... + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 23 DEC 86 07:01:19 EST +Received: from PIGPEN.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 16469; Tue 23-Dec-86 07:00:58 EST +Date: Tue, 23 Dec 86 07:00 EST +From: Alan Bawden +Subject: KS and disk +To: SRA@XX.LCS.MIT.EDU +cc: Sollins@XX.LCS.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +In-Reply-To: +Message-ID: <861223070049.3.ALAN@PIGPEN.AI.MIT.EDU> + +[ I removed Log-Service-Call@XX from the Recipients of this message, + because I wasn't sure of the protocol for using it. ] + +OK, it is possible that all of the bits in MC's filesystem were recovered +from today's disaster. It appears that many of the blocks written on that +pack by MC's drive this weekend are marginal, but they are readable by the +salvager if it tries hard enough. + +There is some slight question as to the integrity of the data in those +blocks, since we did have to reconstruct a couple of blocks in the +filesystem itself. It may be that when MC comes back up, we will find that +COMSAT's queue files are damaged. I estimate the probability of this to be +rather low actually. + +I have made a duplicate of MC's pack onto a fresh pack. (The old pack was +named "MX001", I christened the new pack "MX002".) Both packs are on the +same shelf in the disk pack cabinet next to the window behind AI and OZ. +The new pack will probably function better than the old because even though +you get exactly the same data (be it good or bad) when you read it, you +don't have to work as hard to get it since its blocks are all written +properly. If there is any question as to the ancestry of this new pack, we +can always reformat the old pack and copy the data back... + +As to the problems with MC's drive itself, it looks to me like the problem +should be easy for anyone with a knowledge of RP06's to fix. When ITS was +running this weekend, -all- of the disk errors signaled the same error bit +(the "phase-locked ossillator (sic) unsafe" bit, says my crufty DEC +documentation), and it sounds to me like the diagnostics that JTW and SRA +got running were also reporting a consistent failure. I have my doubts +about the competence of whoever it was who showed up from DEC this weekend, +it seems a shame you had to use up all your MC maintenence money that way. +(By the way: The drive -is- correctly grounded to the processor, and I +find it highly unlikey that the ITS disk pack or the ITS operating system +could be the cause of something with a name like "phase-locked oscillator +unsafe"!) + +If I were you, I would not mount either of those ITS packs in that drive +again unless you are very certain that the problem is fixed. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 22 Dec 86 20:39:45 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 29850; Mon 22-Dec-86 20:36:56 EST +Date: Mon, 22 Dec 86 20:36 EST +From: David A. Moon +Subject: Kludging around the KS's flakey disk +To: Rob Austein +cc: Bug-ITS@MIT-AI.ARPA, Poor-MC@MIT-AI.ARPA +In-Reply-To: <861222020255.2.SRA@WHORFIN.LCS.MIT.EDU> +Supersedes: <861222150854.8.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <861222203625.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Mon, 22 Dec 86 02:02 EST + From: Rob Austein + + I just spent five minutes looking at the DISK code. Based on that + wealth of experience, it appears to me that if I were to bring up the KS + with UNSAFE+1 JFCL'd out, it would stop doing a BUGPAUSE every hour or + so. + + Somebody tell me why I shouldn't do this, before I wear out the $P keys + on the KS's console.... + +The idea was that if the disk goes unsafe, is reset, and goes unsafe +again within one second, it is probably about to explode and the fire +department should be called. It looks like the code jumps to UNSAFE +for a lot of different reasons, not all of which are the drive going +unsafe. The drive also goes unsafe for a lot of different reasons, +some of more consequence than others. + +I agree that if you JFCL out the BUGPAUSE it won't do it any more, so if +you think this won't do irreparable harm to the disk, go ahead. + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 22 Dec 86 09:31:09 EST +Date: Mon 22 Dec 86 09:31:30-EST +From: J. J. Tyrone Sealy +Subject: Re: KS and disk +To: SRA@XX.LCS.MIT.EDU +cc: Poor-MC@AI.AI.MIT.EDU, Log-Service-Call@XX.LCS.MIT.EDU +In-Reply-To: +Message-ID: <12264827835.9.TY@XX.LCS.MIT.EDU> + +Found the drive unsafe this morning..tried to continue system after spinning drive down/up. +System tried then hung, had to reload..will check on it often.. +------- + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 22 Dec 86 02:04:20 EST +Received: from WHORFIN.LCS.MIT.EDU by XX.LCS.MIT.EDU via Chaosnet; 22 Dec 86 02:04-EST +Date: Mon, 22 Dec 86 02:02 EST +From: Rob Austein +Subject: Kludging around the KS's flakey disk +To: Bug-ITS@AI.AI.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +Message-ID: <861222020255.2.SRA@WHORFIN.LCS.MIT.EDU> + +I just spent five minutes looking at the DISK code. Based on that +wealth of experience, it appears to me that if I were to bring up the KS +with UNSAFE+1 JFCL'd out, it would stop doing a BUGPAUSE every hour or +so. + +Somebody tell me why I shouldn't do this, before I wear out the $P keys +on the KS's console.... + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 21 Dec 86 16:36:38 EST +Date: Sun, 21 Dec 1986 16:37 EST +Message-ID: +From: Rob Austein +To: Poor-MC@AI.AI.MIT.EDU, Log-Service-Call@XX.LCS.MIT.EDU +Subject: KS and disk + +Ok, so we finally got somebody from DEC in, he stayed for three hours, +we owe them $411. I have the customer's copy of the bill, the other +copy will be delivered through the usual mechanism (hand carry by +Lester) so that the appropriate PO can get filled out by somebody who +knows what to put in all the little boxes. + +The problem is not fixed. MC does not crash as a direct result of the +disk errors anymore. Instead, it crashes after it gets enough +non-fatal disk errors. I suppose we could increment the threshold +value for "too many disk errors" as a stopgap. + +Interestingly enough, AI started having similar errors today (except +that the PLO bit isn't on for AI's errors). The F-S guy suggested we +check that all those disks are grounded to the correct processors +(AI's disks to AI, MC's to MC, etc). + +When I mentioned that the PLO Unsafe bit that comes up occasionally +(and is now coming up consistantly in the nonfatal errors on MC), our +F-S guy immediately dove into the guts and found a cable that wasn't +seated properly. He fixed that, which is (I think) what changed the +errors from fatal to nonfatal. + +The problem appears to be somewhat interrmittant; I saw him run this +diagnostic that causes the drive to break dance across the floor. +Sometimes it failed, sometimes it didn't. For a while we thought the +MC pack might be bad, but the evidence wasn't conclusive. + +We were somewhat hampered by the fact that the worst of these errors +only seem to come up on the ITS pack where the normal DEC diagnositic +tools aren't available. Some ITS wizard should take a look at the new +set of error bits and disk addresses (in particuar the latter, our F-S +guy wasn't able to spot any pattern in the addresses because he's used +to surface-cylinder numbers). + +One theory he came up with is that there's a head on that drive that's +gone slightly out of alignment. He theorizes that the ITS code might +be less tolerant of these errors than Twenex, which is why ITS crashes +when Twenex just types obnoxious messages on the console. + +At the end of three hours we decided that we needed more information +and that we'd be wasting our money having him stay around any longer. +Current status is that MC is up except when it isnt'; it needs +rebooting a lot. + +We have a bunch of options. + +One is to pay a head reallignment job and see if that fixes it. + +Another is to format up a new MC pack with the current (possibly +misaligned) head configuration and run off that for a while if it +works. This might be the best option, since the Twenex code seems to +be able to cope with the current head alignment. This also covers the +possiblility of the MC pack being bad. + +Another option would be to bring up JTW's MIT rel5 Twenex pack (as +opposed to the vanilla DEC rel4 Alan and I were running before) and +see if SPEAR's ANALYZE functions can spot any patterns that us humans +missed. I'd do this right now except that I want to let the mail +queues drain for a while (which was why I decided to pay the surcharge +for weekend service). We haven't run twenex since he reseated those +cables for the PLO problem, so it is possible that twenex would be +happy now. I doubt it, though, since the PLO bit is still coming up +on MC and is not coming up on AI. + +Another option is to swap drives with MD so that we can put off +spending any more money on MC for a while. This might be worth +keeping in mind, since we don't want Mike Dertuzos to withdraw his +blessing (such as it is) from this project. + +Suggestions? I'm not going to be around much for the next week or so, +somebody else might want to take over nursing our ailing puppy along. + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 19 Dec 86 20:34:03 EST +Date: Fri, 19 Dec 1986 20:35 EST +Message-ID: +From: Rob Austein +To: "David A. Moon" +Cc: POOR-MC@AI.AI.MIT.EDU, Sollins@XX.LCS.MIT.EDU +Subject: The KS lost again +In-reply-to: Msg of 19 Dec 1986 17:41-EST from David A. Moon + +Well, here's what's happened so far. Alan extracted the error bits +from the crash dumps, and looked them up. One is a generic unsafe +bit, one is a "missed transfer" bit, and one (which is only on in one +of the two dumps) is this hairy thing involving "loss of sync in the +read/write phase locked oscillator". This last one rang a bell in the +mind of DPH, who said he thought we had had problems like that when +the KS was first delivered, but that the problem had gone away of its +own accord so nobody had ever done anything about it. + +Then the F-S guy called and seemed somewhat reluctant to come out here +anytime soon (he has contract customers in the queue, and they get +priority). I described the bits to him and he suggested we try +another pack in the drive. So we dug out one of our two KS RED packs +and spun that up. We brought that pack up running twenex, I broke +into OPERATOR, and started doing simple disk I/O (running a batch job +that submitted itself, typed out a file, then exited). We got +"problem on device" errors out the wazzoo, so it's not the MC pack. + +I managed to get a long form listing of the massbus error reports +(from the syserr log) typed out on the console. Don't mean squat to +me but should be helpful to the F-S creature if s/he ever shows up. +The reporting tool is the old SYSERR program, which is missing the +analysis capabilities of the later SPEAR program. So all I could get +was the raw data. + +At this point I'm waiting to hear from F-S, who claimed they'd call +back sometime tonight when they knew if they'd be here anytime soon. + +If there's anybody who can read Massbus error bits, we've got oodles +and oodles of them for you.... + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 19 Dec 86 17:44:19 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 28498; Fri 19-Dec-86 17:42:01 EST +Date: Fri, 19 Dec 86 17:41 EST +From: David A. Moon +Subject: The KS lost again +To: Rob Austein +cc: Sollins@MIT-XX.ARPA, POOR-MC@MIT-AI.ARPA +In-Reply-To: <132708.861219.SRA@AI.AI.MIT.EDU> +Message-ID: <861219174142.7.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri, 19 Dec 86 13:36:54 EST + From: Rob Austein + + I walked away from the console too soon. It only stayed up for ten + minutes. + + I am leaving it down so as not to munch the filesystem too much by + multiple crashes. + +ITS doesn't munch the file system when it crashes. If you meant that +you were worried about the drive destroying the pack, I hope you spun +it down. + +(Actually, there is a slight risk of munching the file system in 1-drive +systems, such as MC, since there is no backup copy of the directories in +1-drive systems. You only lose if the disk aborts a directory write +while it's half-written, and then the system crashes before it can +complete the write, and it wasn't the MFD (which is reconstructable). +Then you might lose all the files in that user directory. The only time +I've ever seen anything like this was when the disk controller was +destroying data that passed through it without any error indication; +that actually creamed a multi-drive system since it often destroyed the +backup copies the same way. The software should have been smarter (and +slower).) + + Ideas, other than calling DEC and paying for a visit? + +I see you called DEC. But the first thing to do would to be get the values +of the error registers in the drive and look them up in the incredibly +lousy drive documentation to find out what caused the unsafe light to light; +there are a dozen or so different things that can do it. + + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 19 Dec 86 17:05:00 EST +Date: Fri, 19 Dec 1986 17:06 EST +Message-ID: +From: Rob Austein +To: Log-Service-Call@XX.LCS.MIT.EDU, Poor-MC@AI.AI.MIT.EDU +Subject: KS's RP06 + +Logged call BC1820 @ 16:57. + +Date: Fri, 19 Dec 86 13:36:54 EST +From: Rob Austein +Subject: The KS lost again +To: Sollins@XX.LCS.MIT.EDU, POOR-MC@AI.AI.MIT.EDU +Message-ID: <132708.861219.SRA@AI.AI.MIT.EDU> + +I walked away from the console too soon. It only stayed up for ten +minutes. + +I am leaving it down so as not to munch the filesystem too much by +multiple crashes. + +Ideas, other than calling DEC and paying for a visit? + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 19 Dec 86 12:25:10 EST +Date: Fri, 19 Dec 1986 12:26 EST +Message-ID: +From: Rob Austein +To: Poor-MC@AI.AI.MIT.EDU +cc: Sollins@XX.LCS.MIT.EDU +Subject: Really MC, that is, the KS this time + +I came in, found the KS's RP06 still spinning with its UNSAFE light on +(ITS had BUGHLT'd, of course). Saw no obvious gouges in pack, no +powdered medium in drive. Did find lint on the foam rubber strip +around the top of the pack well. + +Figuring we had nothing to lose, I powercycled the drive, spun it back +up, rebooted. Seems to be running ok. + +Tyrone theorizes that some seek went too far or something like that. +Perhaps we should have somebody check this drive out? Keep in mind +that it's not on contract. I'm not sure which is cheaper, PM or CM, +under the circumstances. + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 17 Dec 86 14:24:39 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 25843; Wed 17-Dec-86 13:33:29 EST +Date: Wed, 17 Dec 86 13:33 EST +From: David A. Moon +Subject: palx +To: SRA@MIT-XX.ARPA +cc: POOR-MC@MIT-AI.ARPA +In-Reply-To: <962445.861217.MOON@MX.LCS.MIT.EDU> +Message-ID: <861217133335.5.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed, 17 Dec 86 01:09:31 EST + From: "David A. Moon" + + Gee, I dunno. I see PALX loading 375 bytes at 11332, and the first 3 words + of that data are correct. After remembering that in the stupid pdp11 format + the byte counts are off by 6, I realize that this ends at the end of IBOMSG, + which is an odd-length thing. The PALX binary hasn't been changed in almost + four years. On the other hand, the only PALX source is two years and three + versions newer. I tried assembling and using that PALX but it doesn't make + any difference. Barf. + + Here's a procedure that seems to work: + + pdp11^K + :load sra;ioelev bin + :adump sra;ioelev nbin + ^Z + :pcnvrt sra;ioelev nbin + + I don't remember if we used to have to go through this song and dance. + As far as I remember, which is hardly at all, the output from PALX + used to work.. + +The above is all nonsense. Sorry about that. + +I remembered the correct procedure, which is to use 11STNK to load IOELEV +and 11DDT together, then send the output to the front-end file system. +I think you use 11DDT 8K on the MX-DL machine and 11DDT 16K on the MX-FE +machine. There is probably documentation or command files in the MX:KLDCP; +directory, but I can't get to that machine right now. + + +Date: Wed, 17 Dec 86 06:56:39 EST +From: David Vinayak Wallace +Subject: New IOELEV on MX's console 11 +To: SRA@XX.LCS.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 17 Dec 1986 05:41 EST from Rob Austein +Message-ID: <131708.861217.GUMBY@AI.AI.MIT.EDU> + +I assume all this archeology appears in a file so that when you get +run over by a car driven by a drunken iranian suicide-bomber we won't +have to repeat it all? + +Received: from XX.LCS.MIT.EDU (CHAOS 2420) by AI.AI.MIT.EDU 17 Dec 86 05:39:31 EST +Date: Wed, 17 Dec 1986 05:41 EST +Message-ID: +From: Rob Austein +To: Poor-MX@AI.AI.MIT.EDU +Subject: New IOELEV on MX's console 11 + +It seems to work. This one was produced using Moon's suggestion +(running the PALX output through TS PDP11 to keep PCNVRT from +barfing). The A11 file is much shorter than either of the previous +ones I found in the FE's filesystem. Since the code is running on the +11 as I type this, that extra space pretty much has to be the symbol +table (but if the dialups don't work anymore, you know why...). + +I also figured out how to produce a new @ BOOT11, so the last vestiges +of the name swap (MX-MC) should disappear soon. + +So much for archeology. + +Received: from MX.LCS.MIT.EDU (CHAOS 1440) by AI.AI.MIT.EDU 17 Dec 86 01:08:42 EST +Date: Wed, 17 Dec 86 01:09:31 EST +From: "David A. Moon" +Subject: palx +To: POOR-MC%MX.LCS.MIT.EDU@MC.LCS.MIT.EDU +Message-ID: <962445.861217.MOON@MX.LCS.MIT.EDU> + +Gee, I dunno. I see PALX loading 375 bytes at 11332, and the first 3 words +of that data are correct. After remembering that in the stupid pdp11 format +the byte counts are off by 6, I realize that this ends at the end of IBOMSG, +which is an odd-length thing. The PALX binary hasn't been changed in almost +four years. On the other hand, the only PALX source is two years and three +versions newer. I tried assembling and using that PALX but it doesn't make +any difference. Barf. + +Here's a procedure that seems to work: + +pdp11^K +:load sra;ioelev bin +:adump sra;ioelev nbin +^Z +:pcnvrt sra;ioelev nbin + +I don't remember if we used to have to go through this song and dance. +As far as I remember, which is hardly at all, the output from PALX +used to work.. + +Received: from REAGAN.AI.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 16 DEC 86 14:27:56 EST +Received: from MARLEY.AI.MIT.EDU by REAGAN.AI.MIT.EDU via CHAOS with CHAOS-MAIL id 15852; Tue 16-Dec-86 14:28:30 EST +Date: Tue, 16 Dec 86 14:28 EST +From: Alan Bawden +Subject: Bad file? +To: Moon@STONY-BROOK.SCRC.Symbolics.COM +cc: Gumby@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +In-Reply-To: <861216122715.5.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <861216142826.2.ALAN@MARLEY.AI.MIT.EDU> + + Date: Tue, 16 Dec 86 12:27 EST + From: David A. Moon + + Date: Tue, 16 Dec 86 06:43:19 EST + From: David Vinayak Wallace + + try reading armte;steveh omail. Might running the salvager help? + + Running the salvager under timesharing (SALV^K then CHKRG) will find out. + The TS salvager never writes into the file system, but it's useful for + examining things. + +ARMTE is allocated to the pack mounted on unit #5 which accumulates locked +blocks like crazy. I'll fix this the next time I am near MX... (What a +coincidence, it just crashed...) + +Received: from STONY-BROOK.SCRC.Symbolics.COM (TCP 30002424620) by AI.AI.MIT.EDU 16 Dec 86 12:54:22 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by STONY-BROOK.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 24435; Tue 16-Dec-86 12:26:59 EST +Date: Tue, 16 Dec 86 12:27 EST +From: David A. Moon +Subject: Bad file? +To: David Vinayak Wallace +cc: POOOR-MC@AI.AI.MIT.EDU +In-Reply-To: <131141.861216.___007@AI.AI.MIT.EDU> +Message-ID: <861216122715.5.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Tue, 16 Dec 86 06:43:19 EST + From: David Vinayak Wallace + + try reading armte;steveh omail. Might running the salvager help? + +Running the salvager under timesharing (SALV^K then CHKRG) will find out. +The TS salvager never writes into the file system, but it's useful for +examining things. + + +Date: Tue, 16 Dec 86 06:43:19 EST +From: David Vinayak Wallace +Sender: ___007@AI.AI.MIT.EDU +Subject: Bad file? +To: POOOR-MC@AI.AI.MIT.EDU +Message-ID: <131141.861216.___007@AI.AI.MIT.EDU> + +try reading armte;steveh omail. Might running the salvager help? + +Date: Mon, 15 Dec 86 15:42:53 EST +From: Alan Bawden +Subject: Making the the Dover Spooler more reliable. +To: POOR-MC@AI.AI.MIT.EDU +cc: DJB@AI.AI.MIT.EDU +Message-ID: <130884.861215.ALAN@AI.AI.MIT.EDU> + +Because I could never remember that you had to launch the Dover spooler on +MC (the KS) by hand every time you brought the machine up, I wrote a demon +that will do the launching automatically. + +(You will recall the problem is that the demon cannot be launched directly, +because it uses the PK1: device, which doesn't exist on the new MC. Thus +it needs a translation added (PK1: => DSK:) before it can run.) + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 16 NOV 86 21:37:17 EST +Date: Sun, 16 Nov 86 21:31:19 EST +From: Rob Austein +Subject: KL: .; IOELEV * +To: BUG-its@AI.AI.MIT.EDU, poor-mx@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].958244.861116.SRA> + +I assembled and installed a new version of IOELEV for the KL. The +only change is that it now knows that its name has changed (no longer +tells you you are connected to MC). I'll change the namespace +sometime soon if there aren't any problems with this. + +While I was installing this silliness, I reorganized the IOELEV +binaries. KL Console-11 binaries are (as before) in IOELEV nnnBIN +with IOELEV BIN as a link to the latest version (now IOELEV 431BIN). +The AI-Chaos-11 binaries are now in IOELEV nnnAI with a link from +IOELEV AIBIN to the latest version (IOELEV 430AI, the one where I made +subnet six the "primary" address of AI-11 so dover spooling would work +better). + +I don't expect any problems. Next person who cold boots the KL please +tell me what happens (if no problems, tell me that). + +--Rob + +Date: Sat, 25 Oct 86 08:39:43 EDT +From: "Pandora B. Berman" +Subject: Subtle hint +To: SRA@XX.LCS.MIT.EDU +cc: POOR-MX@AI.AI.MIT.EDU, sollins@XX.LCS.MIT.EDU, + ty@XX.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].110598.861025.CENT> + + Date: Thu 22 May 86 10:28:06-EDT + From: Rob Austein + Subject: Subtle hint + To: poor-mx@MC.LCS.MIT.EDU, sollins@XX.LCS.MIT.EDU, ty@XX.LCS.MIT.EDU, + cent@XX.LCS.MIT.EDU + Might I reiterate (obnoxiously loudly) my request that work begin + IMMEDIATELY to make a 9-track backup of MX... +done. 23 tapes at 1600bpi. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 4 OCT 86 14:04:46 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 4 OCT 86 14:03:03 EDT +Date: Sat, 4 Oct 86 14:02:23 EDT +From: David Vinayak Wallace +Subject: latest flakeyness +To: poor-mx@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].951054.861004.GUMBY> + +If anyone cares MX crashed: TTY buffer empty at TYIREM. +Dumped to CRASH TYIREM. Then when reloaded the system couldn't talk +to the IO 11 and hung. This was probably the csause of the lossage; +I dunno; I dumped that to CRASH TYIRE1 just for the hell of it and +cold-booted. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 24 SEP 86 10:56:22 EDT +Date: Wed, 24 Sep 86 10:56:08 EDT +From: David Vinayak Wallace +Subject: unit 1 still busted +To: ALAN@AI.AI.MIT.EDU +cc: POOOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 23 Sep 86 19:55:00 EDT from Alan Bawden +Message-ID: <[MX.LCS.MIT.EDU].948811.860924.GUMBY> + + Date: Tue, 23 Sep 86 19:55:00 EDT + From: Alan Bawden + + Date: Tue, 23 Sep 86 08:24:26 EDT + From: David Vinayak Wallace + After the nasty power-glitch this morning MX's unit 1 consented to + load its heads and load DDT. However attempting to L any file caused + the error "?UN1" which I took to mean that the drive was still + gronked. + + Huh? Unit #1 has been busted for months! What made you think it might + have gotten better after a power-glitch? + +I just switched everything on and attempted to bring the system up. +The last time I looked at it unit 1 wouldn't even load its heads; +that's why I mentioned it. + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 24 Sep 86 00:18:55 EDT +Date: Tue, 23 Sep 1986 23:25 EDT +Message-ID: +From: Rob Austein +To: Alan Bawden +Cc: POOOR-MX@AI.AI.MIT.EDU +Subject: unit 1 still busted +In-reply-to: Msg of 23 Sep 1986 19:55-EDT from Alan Bawden + + Date: Tuesday, 23 September 1986 19:55-EDT + From: Alan Bawden + + ... I assume when I get in tomorrow I will be able to read the full story + in the system log, right?... + +Right. With circles and arrows and scroll bars on the sides. + +Date: Tue, 23 Sep 86 19:55:00 EDT +From: Alan Bawden +Subject: unit 1 still busted +To: GUMBY@AI.AI.MIT.EDU, POOOR-MX@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 23 Sep 86 08:24:26 EDT from David Vinayak Wallace +Message-ID: <[AI.AI.MIT.EDU].97741.860923.ALAN> + + Date: Tue, 23 Sep 86 08:24:26 EDT + From: David Vinayak Wallace + After the nasty power-glitch this morning MX's unit 1 consented to + load its heads and load DDT. However attempting to L any file caused + the error "?UN1" which I took to mean that the drive was still + gronked. + +Huh? Unit #1 has been busted for months! What made you think it might +have gotten better after a power-glitch? + +I'm even more confused to come back from vacation to find two pieces of +mail in my mailbox telling me how broken the KL is (after apparently two +separate power glitches?), yet the machine seems to be up and running right +now. I assume when I get in tomorrow I will be able to read the full story +in the system log, right?... + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 23 SEP 86 08:24:29 EDT +Date: Tue, 23 Sep 86 08:24:26 EDT +From: David Vinayak Wallace +Subject: unit 1 still busted +To: pooor-mx@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].948471.860923.GUMBY> + +After the nasty power-glitch this morning MX's unit 1 consented to +load its heads and load DDT. However attempting to L any file caused +the error "?UN1" which I took to mean that the drive was still +gronked. + +Date: Sun, 21 Sep 86 04:49:11 EDT +From: Rob Austein +Subject: Halucinating Power Glitches +To: POOR-MX@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].96524.860921.SRA> + +The Peacekeeper reentered and burned along with the rest of Tech +Square (power glitch, sometime between 22:00 and midnight). + +Unfortunately, when I tried to relaunch, the poor thing started +halucinating more power glitches (keeps throwing on its FAULT light). +There were other minor annoyances, see log book. Left down. + +This may need a Real Expert. + +Date: Tue, 26 Aug 86 09:20:39 EDT +From: "Pandora B. Berman" +Subject: further senility +To: GUMBY@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].87806.860826.CENT> + + Date: Tue, 26 Aug 86 05:34:54 EDT + From: David Vinayak Wallace + Subject: further senility + To: CENT@AI.AI.MIT.EDU + cc: POOR-MC@AI.AI.MIT.EDU + Date: Tue, 26 Aug 86 02:45:09 EDT + From: Pandora B. Berman + memory B was getting repeated severe par errs, so with alan + providing the remote control knowledge, i deselected it.... + That bank is temperature-sensitive. Was it hot up there? + +it didn't seem to be hot. but it might have been a marginal temperature +situation without my noticing. i suppose it's worth our while to try +re-enabling B sometime when we're reasonably sure it's not hot near there. + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 AUG 86 05:37:09 EDT +Date: Tue, 26 Aug 86 05:34:54 EDT +From: David Vinayak Wallace +Subject: further senility +To: CENT@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 26 Aug 86 02:45:09 EDT from Pandora B. Berman +Message-ID: <[MX.LCS.MIT.EDU].943466.860826.GUMBY> + + Date: Tue, 26 Aug 86 02:45:09 EDT + From: Pandora B. Berman + + memory B was getting repeated severe par errs, so with alan providing the + remote control knowledge, i deselected it. so now we have mem off 300-777, + if anyone is asked. we should think about trying to fix mem B. + +That bank is temperature-sensitive. Was it hot up there? + +Date: Tue, 26 Aug 86 02:45:09 EDT +From: "Pandora B. Berman" +Subject: further senility +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].87727.860826.CENT> + +memory B was getting repeated severe par errs, so with alan providing the +remote control knowledge, i deselected it. so now we have mem off 300-777, +if anyone is asked. we should think about trying to fix mem B. + +Date: Mon, 28 Jul 86 15:48:58 EDT +From: Alan Bawden +Subject: KL's Tape's Belt +To: KARENS@AI.AI.MIT.EDU, SRA@AI.AI.MIT.EDU, TY@AI.AI.MIT.EDU, + DEC@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].76637.860728.ALAN> + +Is there any progress on finding a replacement rubber belt for the KL's +tape drive? It isn't going to get any easier to deal with this as time +passes... + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 10 Jul 86 20:53:41 EDT +Date: Thu 10 Jul 86 20:51:23-EDT +From: J. J. Tyrone Sealy +Subject: Re: MX tape drive losing +To: CENT@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU, KARENS@AI.AI.MIT.EDU, DEC@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].68126.860710.CENT> +Message-ID: <12221686922.38.TY@XX.LCS.MIT.EDU> + +T'was I the guilty one.. I forgot to send ye mail..Lester is trying to +remember where he last saw some of the belts.. lets ope he finds one/some +soon.. +------- + +Date: Thu, 10 Jul 86 20:33:18 EDT +From: "Pandora B. Berman" +Subject: MX tape drive losing +To: POOR-MC@AI.AI.MIT.EDU, KARENS@AI.AI.MIT.EDU +cc: DEC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].68126.860710.CENT> + +moon came by this evening to help alan zero MX's memory, and while he was +here he looked at its tape drive, which for the record is a TU40. someone +(JTW?) had already dived into the drive's innards and removed a rubber belt +which was in very bad shape. replacing the belt made loading tapes almost +work -- until the belt popped off its wheels due to its advanced +decrepitude. + so moon's diagnosis is that we need a new Vacuum Pump Belt -- that was +the only designation we found in the manual, no part number (though perhaps +by now DEC has assigned part numbers to pieces of TU40s; our manual is +after all 10 years old). we can install it ourselves, so all we need is to +get our hands on the part. + is there one of these around somewhere? if not, can we arrange to order +one -- it should be quite cheap (alan is threatening to pay for it himself +if LCS won't, and he's a semi-starving grad student...). + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM by AI.AI.MIT.EDU 7 Jul 86 14:06:37 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 36687; Mon 7-Jul-86 13:29:13 EDT +Date: Mon, 7 Jul 86 13:28 EDT +From: David A. Moon +Subject: MX tape drive losing +To: Pandora B. Berman +cc: POOR-MC@AI.AI.MIT.EDU, KARENS@AI.AI.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].66233.860707.CENT> +Message-ID: <860707132827.7.MOON@EUPHRATES.SCRC.Symbolics.COM> + +Sounds like a mechanical problem. I can't remember if these symptoms +are what happens when the two little rubber belts inside break or +pop off. I think we have a maintenance manual for this tape drive, +unless it's been lost, so maybe someone could take a look. I might +do it, but probably won't have time for a week or so. Having DEC +fix it sounds like a good investment in preserving all that information +on backup tape, presuming they won't "fix" it the way they "fixed" +MX's RP04 #1 (taking it away and bringing in a broken one to replace it). + + +Date: Mon, 7 Jul 86 01:41:48 EDT +From: "Pandora B. Berman" +Subject: MX tape drive losing +To: POOR-MC@AI.AI.MIT.EDU +cc: KARENS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].66233.860707.CENT> + +this evening i discovered that MX's tape drive is broken. syndrome: +when trying to load a tape, it does wind it onto the take-up reel, but +does not suck it down into the vacuum columns. i tried cleaning the +beast, which can't have hurt (it was FILTHY), but didn't help. now +what? does anyone understand enough about TU-whatever-it-is-s to +fiddle with its innards? can we (beg, plead) pay to have dec frob it? +some progress has been made in the old-MC-tapes preservation movement +-- Alan has copied the most recent several GFR tapes onto 9track +1600bpi -- but there are still large amounts of stuff only on 7track +which we could greatly profit from having available (having the +opportunity to copy to the more readable format). + +Date: Sun, 6 Jul 86 22:52:26 EDT +From: Alan Bawden +Subject: .... +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].66158.860706.ALAN> + +The KL's RP04 unit #1 may have bitten the dust. It can no longer read its +TUT without hard ECC errors. Perhaps we shouldn't have let DEC give us a +"new" RP04 a month before the machine went off contract. + +Say, what ever happened about amateur maintenance for the KL? (People to +check the fans once a week, etc.) + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 30 May 86 11:29:55 EDT +Date: Fri 30 May 86 11:29:25-EDT +From: Karen R. Sollins +Subject: Re: KL COMSAT reconfigured +To: JNC@XX.LCS.MIT.EDU +cc: SRA@MC.LCS.MIT.EDU, pooor-mx@AI.AI.MIT.EDU, BUG-MAIL@MC.LCS.MIT.EDU +In-Reply-To: <12210711153.11.JNC@XX.LCS.MIT.EDU> +Message-ID: <12210836715.25.SOLLINS@XX.LCS.MIT.EDU> + +I assumed that the lcs.mit.edu subdomain did the right thing by MX. I +think it should. +------- + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 30 May 86 00:00:43 EDT +Date: Thu 29 May 86 23:59:41-EDT +From: "J. Noel Chiappa" +Subject: Re: KL COMSAT reconfigured +To: SRA@MC.LCS.MIT.EDU, sollins@XX.LCS.MIT.EDU, pooor-mx@AI.AI.MIT.EDU, + BUG-MAIL@MC.LCS.MIT.EDU +cc: JNC@XX.LCS.MIT.EDU +In-Reply-To: <[MC.LCS.MIT.EDU].5519.860529.SRA> +Message-ID: <12210711153.11.JNC@XX.LCS.MIT.EDU> + + IMP port 1/6 is perfectly legal to use; it's enabled and +our sponsor is paying for it. I don't think that's an issue. + The name might be. Any reason not to just have the LCS.MIT.EDU +namespace do the right thing for MX, and if the NIC won't put it in their +table, tough noogies? People should be using domains anyway. +------- + +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM by AI.AI.MIT.EDU 29 May 86 16:14:27 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 11091; Thu 29-May-86 14:49:08 EDT +Date: Thu, 29 May 86 14:48 EDT +From: David A. Moon +Subject: Re: hardware status +To: John Wroclawski +cc: poor-mc@AI.AI.MIT.EDU +In-Reply-To: <12210470941.7.JTW@SPEECH.MIT.EDU> +Message-ID: <860529144826.1.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu 29 May 86 02:00:10-EDT + From: "John Wroclawski" + + I deconfigured the ampex the other day, basically because I was screwing around. + In particular, I wanted to try out running with 4-way interleaving, which at + that time I thought the ampex couldn't do because some of the processor's + ports were broken (JNC later said he thinks this is not true. Experiments + to follow, maybe.) + +The Ampex has only 2 banks, so it certainly can't give higher performance with +4-way interleave than with 2-way. Where the other two banks should be is just +air, because Joel didn't want to spend that much money. I don't know about the +ports being broken, but it wouldn't surprise me one bit. The port transceivers +on the Ampex are excrement. + + Also, I was running memory tests the other day when I was frobbing with + the kludge. The ampex seems to get the occasional parity error during + hard use - nothing horrible. On the other hand the MH10 that is marked + as being bad ran OK at that point. Perhaps the problem was the tape + DF10 port all along. + +Could be. + + Anyway, it seems we have a meg of good MH10 memory, at least from the + processor's point of view. One could even run 4-way interleaved and speed + things up a bit, if one remembered to type J KLINI4 instead of J KLINIT, + which runs 2-way. If the ampex can indeed do 4-way OK I will probably + turn it back on and change the default. + + Does anyone think the machine -needs- more than 1M of memory with the + use it is getting these days? + +Well, it needs more than 1M less than AI needs more than 0.5M. But why not +use it if it's there? I measured the performance difference between 2-way +and 4-way interleave once (running Macsyma I guess) and it was tiny. + + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 MAY 86 02:01:00 EDT +Date: Thu 29 May 86 02:00:10-EDT +From: "John Wroclawski" +Subject: Re: hardware status +To: poor-mc@AI.AI.MIT.EDU +In-Reply-To: <[MX.LCS.MIT.EDU].922260.860528.GUMBY> +Message-ID: <12210470941.7.JTW@SPEECH.MIT.EDU> + +I deconfigured the ampex the other day, basically because I was screwing around. +In particular, I wanted to try out running with 4-way interleaving, which at +that time I thought the ampex couldn't do because some of the processor's +ports were broken (JNC later said he thinks this is not true. Experiments +to follow, maybe.) + +Also, I was running memory tests the other day when I was frobbing with +the kludge. The ampex seems to get the occasional parity error during +hard use - nothing horrible. On the other hand the MH10 that is marked +as being bad ran OK at that point. Perhaps the problem was the tape +DF10 port all along. + +Anyway, it seems we have a meg of good MH10 memory, at least from the +processor's point of view. One could even run 4-way interleaved and speed +things up a bit, if one remembered to type J KLINI4 instead of J KLINIT, +which runs 2-way. If the ampex can indeed do 4-way OK I will probably +turn it back on and change the default. + +Does anyone think the machine -needs- more than 1M of memory with the +use it is getting these days? +------- + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 29 MAY 86 00:58:30 EDT +Date: Thu, 29 May 86 00:58:10 EDT +From: Rob Austein +Subject: KL COMSAT reconfigured +To: sollins@XX.LCS.MIT.EDU, pooor-mx@AI.AI.MIT.EDU, + BUG-MAIL@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].5519.860529.SRA> + +The KL is now running a COMSAT configured as if it were a chaos-only +machine. It uses MC (Chaos 3131) as its gateway. + +This will load the KS a little more for outgoing net traffic, but will +do the right thing for headers (we are -not- going to get the NIC to +put MX in the tables before the poor thing melts down) and is probably +the right thing politically anyway, since it cuts down on the amount +of (unapproved) traffic through IMP port 1/6. + +I haven't messed with FTPS or anything like that, so anybody who knows +enough to talk to 10.1.0.6 will still win. + +--Rob + +Received: from MX.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 28 MAY 86 23:57:33 EDT +Date: Wed, 28 May 86 23:58:32 EDT +From: David Vinayak Wallace +Subject: hardware status +To: pooor-mc@AI.AI.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].922260.860528.GUMBY> + +After much abuse I was able to coerce the KL into booting, but I can't +get it to talk to the upper half of memory (400-777). If anyone knows +something I wish they'd tell me. It looks to me like someone has +frobbed the ampex such that it has all been disabled, but since I +don't know how those switches are normally set I don't want to frob +them. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 MAY 86 23:48:45 EDT +Received: from ELEPHANT-BUTTE.SCRC.Symbolics.COM by MC.LCS.MIT.EDU 25 May 86 23:48:36 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by ELEPHANT-BUTTE.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 7851; Sun 25-May-86 23:46:32 EDT +Date: Sun, 25 May 86 23:46 EDT +From: David A. Moon +Subject: Tape copying +To: Poor-MX@MIT-MC.ARPA +Message-ID: <860525234602.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + +I hereby declare the 7-track to 9-track tape copying software finished +and debugged. To use it, run DUMP on MX, use the REMOTE command to select +the host whose tape drive you are going to use to write 9-track tapes, +then when it says REMOTE TAPE REWOUND and prompts with _, press c-Z, +type TCOPYG, and answer the questions. You can copy two 7-track reels +onto each 9-track reel. + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 MAY 86 16:33:36 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 MAY 86 16:30:55 EDT +Date: Sun, 25 May 86 01:55:03 EDT +From: "David A. Moon" +Subject: MC tape copying +To: sollins@XX.LCS.MIT.EDU, poor-mx@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].921327.860525.MOON> + +I copied what I thought were the last 2 MC-KL GFR tapes (but later I found +four newer ones out of order on the tape rack) onto 9-track tape, using +the TCOPY routine in MX:MOON;TS ND. I had the good luck to encounter a +tape with an irrecoverable error in it, so I know the error recovery routine +works. + +We should proceed copying gradually older tapes as time permits. I used +a tape kindly donated by the AI Lab. LCS should come up with the tapes for +this. After the copy is finished, they can do whatever they want with the +old 7-track tapes (I would save them for a while). + +I'm putting the newly copied GFR tapes onto the tape rack near MC-KL, +on the opposite side from the old GFR tapes. This way anyone who wants +to copy tapes can tell which tapes someone else has copied. I am copying +two 7-track tapes onto each 9-track tape to economize on tapes and floor +space for storing them. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 MAY 86 03:14:46 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 MAY 86 03:14:27 EDT +Date: Sun, 25 May 86 03:14:22 EDT +From: "David A. Moon" +Sender: ALAN@AI.AI.MIT.EDU +To: poor-mx@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].45826.860525.ALAN> + +Whoever brings the KL up next should take drive 1 offline! + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 MAY 86 02:48:12 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 MAY 86 02:35:15 EDT +Date: Sun, 25 May 86 02:34:39 EDT +From: "David A. Moon" +Subject: tape copying (p.s. to previous message) +To: poor-mx@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].921342.860525.MOON> + +Well, the routine for copying two tapes onto one still has a bug +in it (it writes a logical eot at the end of the first tape, so +you can't get to the copy of the second tape). I'll fix that when +I have time to test it, in the meantime copy one tape per 9-track +tape or fix the bug yourself. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 MAY 86 02:28:25 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 MAY 86 02:12:52 EDT +Date: Sun, 25 May 86 01:55:03 EDT +From: "David A. Moon" +Subject: MC tape copying +To: sollins@XX.LCS.MIT.EDU, poor-mx@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].921327.860525.MOON> + +I copied what I thought were the last 2 MC-KL GFR tapes (but later I found +four newer ones out of order on the tape rack) onto 9-track tape, using +the TCOPY routine in MX:MOON;TS ND. I had the good luck to encounter a +tape with an irrecoverable error in it, so I know the error recovery routine +works. + +We should proceed copying gradually older tapes as time permits. I used +a tape kindly donated by the AI Lab. LCS should come up with the tapes for +this. After the copy is finished, they can do whatever they want with the +old 7-track tapes (I would save them for a while). + +I'm putting the newly copied GFR tapes onto the tape rack near MC-KL, +on the opposite side from the old GFR tapes. This way anyone who wants +to copy tapes can tell which tapes someone else has copied. I am copying +two 7-track tapes onto each 9-track tape to economize on tapes and floor +space for storing them. + +Date: Sat, 24 May 86 21:14:21 EDT +From: "John T. Wroclawski" +Subject: KL revived +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].45601.860524.JTW> + + +Moon found a bad power supply in the Kludge. I installed a new one, and +things seem OK for now. + +Leaving us with: + KL running OK with 1Meg of MH memory, ampex off. + RH10 seems OK, survived an hour of reliability diags fine. + RP04 #1 can be made to reliably screw up trying to write and + read back worst-case data patterns... + Not really sure if you can use the tape without causing parity errors.. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 22 MAY 86 10:28:59 EDT +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 22 May 86 10:29:19 EDT +Date: Thu 22 May 86 10:28:06-EDT +From: Rob Austein +Subject: Subtle hint +To: poor-mx@MC.LCS.MIT.EDU, sollins@XX.LCS.MIT.EDU, ty@XX.LCS.MIT.EDU, + cent@XX.LCS.MIT.EDU +Message-ID: <12208728402.10.SRA@XX.LCS.MIT.EDU> + +Might I reiterate (obnoxiously loudly) my request that work begin IMMEDIATELY +to make a 9-track backup of MX and 9-track copies of the old KL GFR tapes? + +We've gotten more reprieves than we deserve already. +------- + +Date: Thu, 22 May 86 07:43:30 EDT +From: "Pandora B. Berman" +Subject: more lossage +To: POOR-KL@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44592.860522.CENT> + +7am: mx went down claiming MASSBUS ERR +i dumped it to MASBUS ERR and brought it up. it crashed again as +soon as it came up. leaving it down until someone more wizardly +than me arrives to reset the massbus. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 22 MAY 86 04:42:52 EDT +Received: from AI.AI.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 22 MAY 86 04:43:16 EDT +Date: Thu, 22 May 86 04:42:25 EDT +From: "Pandora B. Berman" +Subject: more progress +To: MOON@AI.AI.MIT.EDU +cc: KARENS@AI.AI.MIT.EDU, POOR-MX@MC.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44495.860522.CENT> + + Date: Thu, 22 May 86 04:11:24 EDT + From: "David A. Moon" + To: POOR-MX@MC.LCS.MIT.EDU + The tape DF10 wasn't really broken, it was actually MH10 C screwing up + the DF10's memory bus. That old reliable flip chip hardware doesn't + break when heated to a mere 100 degrees. Not having any spare M8594s, + I moved the DF10 bus to a spare port. I'll leave the system up, but in + debug mode and with the network turned off. The tape drive works. + +he forgot to add that, after consultation with JTW and alan, he brought +it up in normal mode. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 22 MAY 86 04:29:31 EDT +Received: from MX.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 22 MAY 86 04:29:57 EDT +Date: Thu, 22 May 86 04:29:44 EDT +From: "David A. Moon" +Subject: Daemon joke of the day +To: poor-mx@MC.LCS.MIT.EDU +Message-ID: <[MX.LCS.MIT.EDU].920450.860522.MOON> + +mx:channa;rakash glpspl crashes when the system comes up because +mx is not in its assembled in list of known hosts. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 22 MAY 86 04:10:56 EDT +Date: Thu, 22 May 86 04:11:24 EDT +From: "David A. Moon" +To: POOR-MX@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].1561.860522.MOON> + +The tape DF10 wasn't really broken, it was actually MH10 C screwing up the +DF10's memory bus. That old reliable flip chip hardware doesn't break when +heated to a mere 100 degrees. Not having any spare M8594s, I moved the +DF10 bus to a spare port. I'll leave the system up, but in debug mode and +with the network turned off. The tape drive works. + +Date: Wed, 21 May 86 23:55:16 EDT +From: "Pandora B. Berman" +Subject: logbook location +To: SRA@AI.AI.MIT.EDU +cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44369.860521.CENT> + + Date: Wed, 21 May 1986 23:18 EDT + From: Rob Austein + To: "Pandora B. Berman" + Cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU + Subject: At the tone, your name will be + It would probably help if the ML and MD system logs were in some + intuitively obvious place. Now that you have reminded me of their + existance I suspect they are sitting on top of the CPUs or disks or + something. If they were sitting by the consoles some of us space + cadets might have remembered their existance and scrawled something in + them. +if i could have put them safely any closer to the consoles, i would have. +i agree that on top of the CPUs is not the best location for visibility and +memory-jogging, but it appeared to be the best i could do. if we could get +some kind of little table beside MD's console (shoving the IMPLOD cabinet +over), that would be better. + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 21 May 86 23:17:32 EDT +Date: Wed, 21 May 1986 23:18 EDT +Message-ID: +From: Rob Austein +To: "Pandora B. Berman" +Cc: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Subject: At the tone, your name will be +In-reply-to: Msg of 21 May 1986 22:57-EDT from "Pandora B. Berman" + +It would probably help if the ML and MD system logs were in some +intuitively obvious place. Now that you have reminded me of their +existance I suspect they are sitting on top of the CPUs or disks or +something. If they were sitting by the consoles some of us space +cadets might have remembered their existance and scrawled something in +them. + +Date: Wed, 21 May 86 22:57:57 EDT +From: "Pandora B. Berman" +Subject: At the tone, your name will be +To: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].44335.860521.CENT> + +I have relabelled everything in sight except the KS's tapes; i'll get +to those later this evening. i rediscovered the winning sort of +labels, so the binder labels should no longer be quite so eager to +come off. + +NOTHING has been written in the ML and MD system logs for at least a +week. nothing about bringing them down for DEC to borrow or loaning +disks to XX or any such matters. will someone who knows what's been +going on (SRA? JTW?) please insert a few notes so the rest of us can +remain mildly informed? + +Date: Wed, 21 May 86 00:35:26 EDT +From: Alan Bawden +Subject: 6 5 4 3 2 1 ... +To: BUG-ITS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU, + "(FILE [JNC:POOR MC])"@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].43668.860521.ALAN> + +OK folks, I switched the names MC and MX in the ITS sources and created new +binaries for the two machines. I also edited AI:SYSHST;HSTLCS to reflect +the swap. So the first symptom of this name swap that anyone will notice +will appear early this morning when new host tables start circulating with +the Chaosnet addresses switched. (Because we are switching both ArpaNet +addresses and physical connections, the change manifests itself in the host +tables as exchanged Chaosnet addresses.) + +Date: Tue, 20 May 86 19:02:57 EDT +From: David Chapman +Subject: pword follies +To: ALAN@AI.AI.MIT.EDU +cc: BUG-PWORD@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU, + POOOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 20 May 86 16:17:05 EDT from Alan Bawden +Message-ID: <[AI.AI.MIT.EDU].43388.860520.ZVONA> + +Maybe we should try copying over the AI database and then deleting +from that (unless Cstacy tells us how to win). I started to do this +until I realized that I needed your edits for it to be even faintly +plausible. + +Date: Tue, 20 May 86 16:17:05 EDT +From: Alan Bawden +Subject: pword follies +To: BUG-PWORD@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +cc: ZVONA@AI.AI.MIT.EDU, CENT@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].43173.860520.ALAN> + +I made some minor edits to the PWORD sources with the intent that we would +bring PWORD up on the KS since it becomes MC tomorrow morning. +Unfortunately I couldn't figure out how to make an empty PWORD database. + +I guess we'll just run DDT on both the KL and the KS until someone figures +this out. + +I changed the source to look for the database in the same place on both the +KL and the KS. This means that you have to -move- the database on the KL +before installing a new PWORD there. The database wants to live in the +same place so that you don't need a complicated algorithm based on cpu type +to figure out where the database is. You Grok? + +Date: Tue, 20 May 86 16:10:03 EDT +From: Alan Bawden +Subject: MC up +To: KARENS@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Tue 20 May 86 01:38:49 EDT from Alan Bawden +Message-ID: <[AI.AI.MIT.EDU].43165.860520.ALAN> + +Given that JTW fixed the problem with unit #2, I spent the afternoon +filling the holes in MC's filesystem. MC is now up and running about as +well as it was a week ago. Some mail was lost (not much), and some mail is +still trapped in a busted comsat database. + +We're going to try to do the name swap tomorrow morning. Oh boy. + +Received: from SPEECH.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 20 MAY 86 02:33:04 EDT +Date: Tue 20 May 86 02:34:50-EDT +From: "John Wroclawski" +Subject: Re: I have good news, and bad news +To: ALAN@AI.AI.MIT.EDU, POOOR-MC@AI.AI.MIT.EDU, BUG-COMSAT@AI.AI.MIT.EDU, + ZVONA@AI.AI.MIT.EDU, KARENS@AI.AI.MIT.EDU +Message-ID: <12208117956.19.JTW@MIT-SPEECH> + + From: Alan Bawden + + The single -new- problem is that unit #2 is now exhibiting one of the + canonical RP04 lossages: it is unable to fully retract its cleaning + brushes. This can be fixed by someone who + +I fixed this. It isn't going to last forever; there's a pretty sick +bearing in there. +------- + +Date: Tue, 20 May 86 01:38:49 EDT +From: Alan Bawden +Subject: I have good news, and bad news +To: POOOR-MC@AI.AI.MIT.EDU, BUG-COMSAT@AI.AI.MIT.EDU, + ZVONA@AI.AI.MIT.EDU, KARENS@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42865.860520.ALAN> + +Well, there wasn't anything wrong with MC's processor after all. No +irreplaceable processor boards were lost. The single -new- problem is that +unit #2 is now exhibiting one of the canonical RP04 lossages: it is unable +to fully retract its cleaning brushes. This can be fixed by someone who +knows what they are doing in about 5 minutes. All we have to do is find +someone like that. + +Until unit #2 gets fixed, Moon and I figured we would simply move pack 1 +from unit #2 to unit #1, and take pack 13 (SECOND) off-line. You may +recall that unit #1 is the one DEC replaced last month because they +couldn't fix the old unit #1. Since then I have been warning people not to +create new files on pack 13 because I was under the impression that it had +been mis-formatted by the old drive. Well, I was wrong, and tonight we +learned just how wrong in a slightly painful way. + +After ITS had run for an hour or so, it filled pack 0 up to a point where +it thought it might be a good idea to switch to creating files on pack 1 +for a while. At this point Alan learns that what DEC had convinced him of +last month was in fact not true. Unit #1 really -is- still broken. It can +read files just fine, but something like one out of every hundred blocks it +writes are unreadable. So now we have a few files on pack 1 that contain +locked and unreadable blocks, and probably a few more that are unreadable +that ITS hasn't discovered yet. The most important known casualty is +.MAIL.; LISTS MSGS (COMSAT's database of queued mail). + +This is a familiar story these days. DEC can't fix it, so your filesystem +gets gubble written in it. Fortunately, the ITS filesystem is built from +pretty stern stuff, so although we might lose a file or two, the whole +thing is much less likely to crumble around our ears. + +So here is where we stand: MC's filesystem contains a couple of bruises, +but nothing severe. However we can't really run MC untill one of the +drives gets fixed (unit #2 should be easy, as I said before) without +risking further damage to the filesystem. A few cycles from a COMSAT +wizard will be required to either fix its database and get COMSAT running +again, or to at least rescue the mail currently trapped in its queue (I can +explain the nature of the lossage further in person). The most important +thing we can get from MC right now is to empty the last valuable stuff from +its filesystem, and to use it to copy 7 track tapes. I know how we can +safely accomplish both of these tasks using the 1.5 RP04's we have left, +but I would rather not get into that here, and I hope we won't need to. + +I would recommend that the IMP reconfiguration take place as soon as +possible so that we can bring the MC KS online. + +We can't really make the KS be MC until Zvona finishes with the great +mailing list migration. He estimated to me today that he had about 8 hours +work to go, but he was handicapped by not having access to the mailing +lists file on MC. Fortunately while MC was up Penny grabbed a copy, so now +AI:.MAIL.;.MCNEW NAMES contains a copy of the NAMES file currently on the +KL. (We should give Zvona a medal when he finishes this job. (Zvona: if +you need any more files from the KL, I'll be happy to get them back for +you!)) + +Question: We are going to need a mess of tapes for copying MC's GFR tapes +to 9-track tapes and also for doing a last full dump to 9-track (and +perhaps copying a couple more older full dumps to 9-track). How does one +go about obtaining such large numbers of tapes? Who's going to pay for it? +If I truck on down to the stock room and ask for 100 reels of tape, I +presume they will want some kind of coherent story about who should be +charged for it... + +Date: Mon, 19 May 86 02:59:35 EDT +From: "John T. Wroclawski" +Subject: A stunning example of murphy in action... +To: POOOR-MC@AI.AI.MIT.EDU +cc: sollins@XX.LCS.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42542.860519.JTW> + + +Further study shows that the MC CPU board which has failed is + + a) One of only two types of board (out of about 20) of which there is + only one instance in the machine, preventing swapping. + + b) One of a handful of types of board not shared with model B processors + such as the TOPS20 machines, preventing swapping... + +Date: Sun, 18 May 86 21:26:53 EDT +From: "John T. Wroclawski" +To: POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].42471.860518.JTW> + + +Well kids, according to the DEC diagnostics MC's CPU has had it... + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 17 MAY 86 07:29:45 EDT +Date: Sat, 17 May 86 07:28:06 EDT +From: David Vinayak Wallace +Subject: heat problems +To: POOOR-MC@AI.AI.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].918143.860517.GUMBY> + +MC crashed this morning when the overtemp sensor in MH10-B tripped. +The bay wouldn't cool with the door shut so I opened it up and put a +sign on it. If anyone knows where we can get another of the big grey +"cake" fans that would be great -- one of them in that bay is a bit +wimpy. The muffin fans on the memory seem to work OK. + +david + +Date: Thu, 15 May 86 02:21:16 EDT +From: "Pandora B. Berman" +Subject: mc flag day +To: JNC@XX.LCS.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].41251.860515.CENT> + + Date: Wed 14 May 86 20:07:06-EDT + From: "J. Noel Chiappa" + Subject: Re: mc flag day + To: ALAN@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU + cc: POOR-MC@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU, sollins@XX.LCS.MIT.EDU, + ricchio@XX.LCS.MIT.EDU + The latest theory of the port swap is that we will do the hardware + change.... + +I think the technical description of the situation, Noel, is +Shit For Brains. + +Received: from XX.LCS.MIT.EDU by AI.AI.MIT.EDU 14 May 86 20:09:56 EDT +Date: Wed 14 May 86 20:07:06-EDT +From: "J. Noel Chiappa" +Subject: Re: mc flag day +To: ALAN@AI.AI.MIT.EDU, ZVONA@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU, JNC@XX.LCS.MIT.EDU, sollins@XX.LCS.MIT.EDU, + ricchio@XX.LCS.MIT.EDU +In-Reply-To: <[AI.AI.MIT.EDU].40905.860514.ALAN> +Message-ID: <12206736652.69.JNC@XX.LCS.MIT.EDU> + + The latest theory of the port swap is that we will do the +hardware change. That's right, after filing 42 forms, each of which +had at least 193 questions in gobbledygook military industrial complex +quasi-lingual acronymese, no less than 69% of which were completely +irrelevant to the task at hand, but which had to be filled out anyway, +in quintuplicate, in the office of the under sub assistant paper +frobber for the maintainence of network well being, they have decided +that the *right thing* is for us to power down the two IMP's in +question and move the adaptors ourselves; i.e. something we could have +done several months ago without saying a goddam word to the bozos who +run this insane asymlum of an excuse for an organized and responsive +support and maintainence organization. I don't know if they scare the +Russians, but they sure as hell scare me. + + Noel +------- + +Date: Wed, 14 May 86 13:19:12 EDT +From: Alan Bawden +Subject: mc flag day +To: ZVONA@AI.AI.MIT.EDU +cc: POOR-MC@AI.AI.MIT.EDU +In-reply-to: Msg of Wed 14 May 86 09:43:17 EDT from David Chapman +Message-ID: <[AI.AI.MIT.EDU].40905.860514.ALAN> + + Date: Wed, 14 May 86 09:43:17 EDT + From: David Chapman + Date: Tue, 13 May 86 12:50:10 EDT + From: Alan Bawden + ... In the case of $^A, of course, I decided not to do anything + about it. + + I don't understand why ``of course,'' but presumably you have the + situation under control. + +``of course'' because I thought we had talked about that particular case in +person the other day. Perhap that was someone else I had that conversation +with. + + We should make up a list of what needs to be done before the flag day, + if there is more than a couple things. I should be done with mailing + lists and INQUIR by Tuesday. + + Maybe it would be better to phase it? Stage one changes the primary + name of KL to KL, retaining the secondary name MC. That lets anything + break that depends on all KLs having a primary name MC. Stage two + moves the name MC to KS, which keeps KS as primary name. That lets + things break that depend on MC being a KL. Stage three makes MC the + primary name for KS and possibly moves the name MX to KL.... + +I have always imagined that the swap happens as follows: One day we come +in and find that MC/KL no longer has a network connection because the +coolies from BBN have finally converted the IMP port. At this moment we go +and make the final edits to the ITS sources that officially swap the names +and assemble the first MC/KS and KL/MX systems. Then we take down both the +KL and the KS. + +Now it would be nice if it this point we can get the host tables to change +to reflect the new names and Chaosnet addresses while both machines are +down. Dream on. + +We leave KL/MX down until we get everything else working since the +important goal is to keep "MC" working. We bring up MC/KS, and we spend +the rest of the day putting out the minor fires that this sets. Initially +the only mail going through MC/KS is coming in from the Internet, but +gradually as more people pick up the new Chaosnet address the mail load +picks up. + +When we are happy that MC/KS works, then at our leisure we can bring up +KL/MX. + +Date: Fri, 9 May 86 02:23:17 EDT +From: "David A. Moon" +Subject: Tape copying +To: POOR-MC@AI.AI.MIT.EDU +Message-ID: <[AI.AI.MIT.EDU].36591.860509.MOON> + +MC:MOON;TS ND was able to copy a couple of MC GFR tapes onto a 9-track, +1600 bpi tape on Gutenberg's drive. Beware: that's another hardware/Unix +combination that likes to go into 6250 bpi when you're not looking. ITS +dump tapes don't work at 6250 bpi. + +The tape copying is pretty fast. To use it, start up ND and use the +REMOTE command to specify your tape server. Then hit c-G and type +TCOPYG and answer the questions. You can copy two 800 bpi tapes onto +each 1600 bpi tape. + +I fixed a couple of things in the program and reassembled after I was +done testing it, and didn't retest, but I don't think I broke anything. +The only thing I haven't tested is recovery from tape errors, because +I wasn't able to find any unreadable tapes to copy from. It's supposed +to print an error message and copy whatever bad data it gets onto the +output tape where it will masquerade as good data, but I don't know +whether it works. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 8 MAY 86 05:06:41 EDT +Date: Thu, 8 May 86 05:06:34 EDT +From: Rob Austein +Subject: supplement to MC: CRASH; CRASH DRGFKT +To: pooor-mc@AI.AI.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].906917.860508.SRA> + +[The following was made a minute or so before MC gave up the ghost] + +MC ITS 1573 Peek 615 5/8/86 04:36:30 Up time = 8:11:52:58 +ERRS: CORPAR =! 4 +Memory: Free=979 Runnable Total=201 Out=3 Users: High=62 Runnable=2 +Index Uname Jname Sname Status TTY Core Out %Time Time PIs + 0 SYS SYS SYS HANG ? 89 0 0% 26:49 + 1 CORE JOB CORE UUO ? 0 0 0% 32:40 + 2 ___002 TCP ___002 OPEN ? 0 0 0% + 4 46TLNT TELSER MIT-XX SLEEP ? 1 0 0% + 5 ___005 TELSER TELNET CHAOSO ? 81 18 0% + 7 354C07 FILE MEDG PKTIOT ? 7 0 0% 9 + 10 PFTHMG DRAGON DRAGON *10!0 ? DSN 9 1 0% 52:39 REALTM PDLOV SCLOCK + 11 V80 SPOOLR DCP HANG ? 11 0 0% + 12 ___002 JOB.05 SYS 3!7777777777 ? 1 0 0% 4:31 + 13 COMSAT IV IV WALK<21 ? 190 1 2% 41:42 REALTM PURPG + 16 GIF HACTRO GUEST1 TTYI ? DSN 30 3 0% 2 + 31 GIF MAIL GUEST1 *10!0 < DSN 93 18 0% 1 + 17 CENT5 HACTRN ARM HANG > 30 3 0% 5 + 6 CENT5 DUMP FIRST MTAPE T43 B 17 0 0% 1 + 20 52TLNT TELSER MIT-AI SLEEP ? 1 0 0% 3 + 21 COMSAT JOB.07 SYS *LOGOUT>13 ? 103 16 0% 1:12:18 + 22 A2DEH HACTRO SYS2 TTYSO ? DSN 30 3 0% 4 + 34 A2DEH FR GUEST0 TTYI ? DSN 86 17 0% + 23 A2DEH ARGUS GUEST0 HANG ? DSN 2 0 0% + 24 SRA HACTRN SRA HANG > 30 3 0% 1 + 14 SRA P SRA MULTIX T46 C 11 2 0% + 30 JNC HACTRN JNC TTYI T35 30 3 0% 1 + 33 CENT HACTRN .MAIL. TTYI T52 30 3 0% 7 + 25 CENT E ARM 10!0 < 90 5 0% 6 + 40 CENT P CENT 10!0 < 89 19 0% 9 + 41 51TLNT TELSER 424527 SLEEP ? 1 0 0% 3 + 43 54TLNT TELSER 7B-HUB SLEEP ? 1 0 0% 1 + 44 GUMBY HACTRN BMT1 TTYI T54 35 3 0% 7 + 50 GUMBY E GUMBY 10!0 < 124 6 0% 6:24 REALTM + 45 TARAKA DVRSPL CENT *10!0 ? DSN 30 2 0% 27:06 MPV 20 + 46 GUMBY ARGUS GUMBY HANG ? DSN 2 0 0% + 51 BIL HACTRN JOEK TTYI T51 30 3 0% 9 + 54 LARRY HACTRO LARRY HANG > DSN 35 3 0% 6 + 3 LARRY FTP LARRY TTYI ? DSN 91 18 0% + 52 LARRY LISP LARRY 10!0 < DSN 147 0 0% 31 + 61 LARRY NE LARRY 10!0 < DSN 79 10 0% 31 +Fair Share 44% Totals: 1636 3% 4:26:38 +Logout time = 1:00:01:08 Lost 0% Idle 0% Null time = 5:21:52:40 + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 APR 86 18:27:31 EDT +Received: from SAPSUCKER.SCRC.Symbolics.COM by MC.LCS.MIT.EDU 27 Apr 86 18:27:42 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by SAPSUCKER.SCRC.Symbolics.COM via CHAOS with CHAOS-MAIL id 11111; Fri 25-Apr-86 17:45:39 EST +Date: Fri, 25 Apr 86 17:46 EST +From: David A. Moon +Subject: Re: down on Thursday +To: J. J. Tyrone Sealy +cc: poor-mc@MIT-MC.ARPA +In-Reply-To: <12201690823.41.TY@XX.LCS.MIT.EDU> +Message-ID: <860425174601.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Fri 25 Apr 86 13:09:32-EST + From: J. J. Tyrone Sealy + + The dump was completed..the drive survived.. + + PS: I was told that LNS have some 7/9 track drives that can run with the tape + controler that is now on MC. Can the ITS software hack it?? + +The ITS software can certainly handle 9-track drives on TM10 controllers, since +that's what DM had. That would let us dump MC onto 9-track tape. It wouldn't +give us a way to recover the contents of all those 7-track dumps lying around +after MC dies, which is the goal that would really be good to achieve. + + They are suppose to have about eight drives (working), that are gathering + dust and space.. + +I guess this should be investigated. + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 27 APR 86 18:16:37 EDT +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 27 Apr 86 18:16:42 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 473355; Sun 27-Apr-86 18:13:49-EDT +Date: Sun, 27 Apr 86 18:13 EDT +From: David A. Moon +Subject: LNS stuff +To: Gumby@MIT-MC.ARPA +cc: J. J. Tyrone Sealy , poor-mc@MIT-MC.ARPA, + ks-its@MIT-AI.ARPA +In-Reply-To: +Message-ID: <860427181311.3.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: 26 Apr 1986 10:17 EST (Sat) + From: David Vinayak Wallace + + Date: Friday, 25 April 1986 13:09-EST + From: J. J. Tyrone Sealy + + PS: I was told that LNS have some 7/9 track drives that can run + with the tape controler that is now on MC. Can the ITS software + hack it?? They are suppose to have about eight drives (working), + that are gathering dust and space.. + + I believe we could also hook one of these up to a KS. + +There are no tape drives that are capable of hooking -both- to MC and to a KS. + + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 26 APR 86 10:18:58 EST +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 26 Apr 86 10:18:44 EST +Date: 26 Apr 1986 10:17 EST (Sat) +Message-ID: +From: David Vinayak Wallace +To: "J. J. Tyrone Sealy" +Cc: poor-mc@MC.LCS.MIT.EDU, ks-its@AI.AI.MIT.EDU +Reply-to: Gumby@mc +Subject: LNS stuff +In-reply-to: Msg of 25 Apr 1986 13:09-EST from J. J. Tyrone Sealy + + Date: Friday, 25 April 1986 13:09-EST + From: J. J. Tyrone Sealy + + PS: I was told that LNS have some 7/9 track drives that can run + with the tape controler that is now on MC. Can the ITS software + hack it?? They are suppose to have about eight drives (working), + that are gathering dust and space.. + +I believe we could also hook one of these up to a KS. + +They apparently also have a brace of KA's. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 25 APR 86 13:13:25 EST +Received: from MC.LCS.MIT.EDU by MC.LCS.MIT.EDU via Chaosnet; 25 APR 86 13:13:13 EST +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 25 Apr 86 13:10:31 EST +Date: Fri 25 Apr 86 13:09:32-EST +From: J. J. Tyrone Sealy +Subject: Re: down on Thursday +To: Moon@SCRC-STONY-BROOK.ARPA +cc: poor-mc@MC.LCS.MIT.EDU +In-Reply-To: <860423222547.4.MOON@EUPHRATES.SCRC.Symbolics.COM> +Message-ID: <12201690823.41.TY@XX.LCS.MIT.EDU> + +The dump was completed..the drive survived.. + +PS: I was told that LNS have some 7/9 track drives that can run with the tape +controler that is now on MC. Can the ITS software hack it?? +They are suppose to have about eight drives (working), that are gathering +dust and space.. +------- + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 23 APR 86 23:21:55 EST +Received: from SCRC-STONY-BROOK.ARPA by MC.LCS.MIT.EDU 23 Apr 86 22:41:43 EST +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 470754; Wed 23-Apr-86 22:26:37-EST +Date: Wed, 23 Apr 86 22:25 EST +From: David A. Moon +Subject: down on Thursday +To: J. J. Tyrone Sealy +cc: poor-mc@MIT-MC.ARPA +In-Reply-To: <12201146871.25.TY@XX.LCS.MIT.EDU> +Message-ID: <860423222547.4.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed 23 Apr 86 11:21:31-EST + From: J. J. Tyrone Sealy + + I will have the machine in standalone mode most of the day, to do last official + full dump..The tape drive is not expected to survive the 50+ tapes that it takes + (Sez DEC...).We shall see..Its still on service...any other problems WE should + let DEC know/fix???? + +If the RP04 that has the SECOND: pack on it is still broken such that it gets a lot +of read errors, and DEC is not going to fix it, you are probably better off taking +it offline before doing the dump, so as not to be hassled by lots of disk errors. + +We're going to try to get a full dump onto 9-track tape soon, but you should go ahead +and do the 7-track full dump anyway. + + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 23 APR 86 18:56:32 EST +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 23 Apr 86 18:35:27 EST +Date: Wed 23 Apr 86 11:21:31-EST +From: J. J. Tyrone Sealy +Subject: down on Thursday +To: poor-mc@MC.LCS.MIT.EDU +Message-ID: <12201146871.25.TY@XX.LCS.MIT.EDU> + +I will have the machine in standalone mode most of the day, to do last official +full dump..The tape drive is not expected to survive the 50+ tapes that it takes +(Sez DEC...).We shall see..Its still on service...any other problems WE should +let DEC know/fix???? + --TY +------- + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 10 APR 86 17:33:43 EST +Date: Thu, 10 Apr 86 17:32:46 EST +From: Alan Bawden +Subject: The PARERR that broke the KL's back +To: GUMBY@MC.LCS.MIT.EDU +cc: POOR-MC@MC.LCS.MIT.EDU +In-reply-to: Msg of Thu 10 Apr 86 14:00:04 EST from David Vinayak Wallace +Message-ID: <[MC.LCS.MIT.EDU].880598.860410.ALAN> + + Date: Thu, 10 Apr 86 14:00:04 EST + From: David Vinayak Wallace + At least I think that's what it is; MC had been getting them for the past + 8 hours or so. Dumped to CRASH URET2 if anyone cares + (bugpc/ caia uret2+2 $Q-1/ pushj p,bugnil) + +Has nothing to do with parity errors. This is one of the three or four +canonical software bugs. Something in the RENAME system call fails to +unlock all of its locks. The process of launching a comsat seems to tickle +it every few months. + + Also, the GW tables are filling up every five or ten minutes rather + than every hour or so. Isn't that a bug, or am I just confused? + +No real problem. Ignore it. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 10 APR 86 17:11:02 EST +Date: Thu, 10 Apr 86 17:10:01 EST +From: Alan Bawden +Subject: The PARERR that broke the KL's back +To: JNC@XX.LCS.MIT.EDU +cc: GUMBY@MC.LCS.MIT.EDU, POOR-MC@MC.LCS.MIT.EDU +In-reply-to: Msg of Thu 10 Apr 86 14:57:33-EST from J. Noel Chiappa +Message-ID: <[MC.LCS.MIT.EDU].880572.860410.ALAN> + + Date: Thu 10 Apr 86 14:57:33-EST + From: J. Noel Chiappa + There was some discussion of the 'GW TBL FULL' message on the + BUG-TCP mailing list on MC a while ago, but some vandal seems to have + deleted the old archives (maybe they just rename them, I didn't check). + +They renamed them: MC:KSC;BUGTCP MAIL -> MC:KSC;BUGTCP OMAIL + + See if you can find them; if not, I'll forward you a set. + +I fixed the problem that caused these to com out so damned often, MC may +not get the fix ever, since we might not ever assemble another ITS for MC. + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 10 APR 86 16:02:26 EST +Received: from XX.LCS.MIT.EDU by MC.LCS.MIT.EDU 10 Apr 86 14:54:38 EST +Date: Thu 10 Apr 86 14:57:33-EST +From: "J. Noel Chiappa" +Subject: Re: The PARERR that broke the KL's back +To: GUMBY@MC.LCS.MIT.EDU, POOR-MC@MC.LCS.MIT.EDU +cc: JNC@XX.LCS.MIT.EDU +In-Reply-To: <[MC.LCS.MIT.EDU].880303.860410.GUMBY> +Message-ID: <12197778328.25.JNC@XX.LCS.MIT.EDU> + + There was some discussion of the 'GW TBL FULL' message on the +BUG-TCP mailing list on MC a while ago, but some vandal seems to have +deleted the old archives (maybe they just rename them, I didn't check). +See if you can find them; if not, I'll forward you a set. + + NOel +------- + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 10 APR 86 14:00:59 EST +Date: Thu, 10 Apr 86 14:00:04 EST +From: David Vinayak Wallace +Subject: The PARERR that broke the KL's back +To: POOR-MC@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].880303.860410.GUMBY> + +At least I think that's what it is; MC had been getting them for the past +8 hours or so. Dumped to CRASH URET2 if anyone cares +(bugpc/ caia uret2+2 $Q-1/ pushj p,bugnil) + +Also, the GW tables are filling up every five or ten minutes rather +than every hour or so. Isn't that a bug, or am I just confused? + +Received: from MC.LCS.MIT.EDU by AI.AI.MIT.EDU via Chaosnet; 8 APR 86 21:18:14 EST +Date: Tue, 8 Apr 86 21:17:35 EST +From: Alan Bawden +Subject: MC unit #1 +To: KARENS@MC.LCS.MIT.EDU, F-S@OZ.AI.MIT.EDU +cc: POOR-MC@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].878120.860408.ALAN> + +Well, the new RP04 on MC only seems to be half of an RP04. It seems +perfectly capable of reading the files off of our old pack, but new files +we create there usually get hard ECC errors when you read them back. +Tonight I tried formatting a fresh pack on that drive, hoping that this was +just some kind of head alignment prroblem. No such luck. The newly +formatted pack gets hard errors on every cylinder. + +I have left the old pack on line because it lets users get at their old +files (and it is hard for a user to accidentally create a file there), not +because I think this drive is fixed. + +Date: Sat, 11 Jan 86 22:18:31 EST +From: Alan Bawden +Subject: Losing Dialup +To: POOR-MC@MC.LCS.MIT.EDU +cc: CPH@MC.LCS.MIT.EDU +In-reply-to: Msg of Sat 11 Jan 86 18:25:45 EST from Chris Hanson +Message-ID: <[MC.LCS.MIT.EDU].780980.860111.ALAN> + + Date: Sat, 11 Jan 86 18:25:45 EST + From: Chris Hanson + To: BUG-SYSTEM at MC + When I dial x6985, I am getting a connection which responds to my + carriage return with the standard "Connected to MC.", but then it + fails to give me a HACTRN. C-Z has no effect. + + I notice that *nobody* is logged in from a dialup. This seems like it + might be related. + +No, its only T10. I'm using T11 right now now problem. Probably nobody is +using a dialup because they all dial the number CPH did, which is the base +of the hunt group, and when it doesn't work they hang up again so that the +broken line will shaft the next user. Doesn't occur to many people to try +dialing 6986... + +SYSMSG shows that ITS timed out waiting for the 11 to acknowledge a +character it sent to T10. (I guess somebody dropped an interrupt.) This +leaves ITS confused about the state of that TTY. Setting the right +variable in ITS (TTYOAC+10/ -1) unwedged it. (I finished sending this mail +from T10.) + +Date: Sat, 28 Dec 85 19:00:48 EST +From: Alan Bawden +Subject: page fault in system +To: GUMBY@MC.LCS.MIT.EDU +cc: HIC@MC.LCS.MIT.EDU, POOR-MC@MC.LCS.MIT.EDU, + BUG-ITS@MC.LCS.MIT.EDU +In-reply-to: Msg of Sun 22 Dec 85 15:21:29 EST from David Vinayak Wallace +Message-ID: <[MC.LCS.MIT.EDU].767454.851228.ALAN> + +[ Why are we Cc'ing this message to HIC? ] + + Date: Sun, 22 Dec 85 15:21:29 EST + From: David Vinayak Wallace + ITS took a page fault. Look in CRASS PAGFLT if you care. + +Specifically, ITS took a page fault running in the scheduler. It thought +it was looking at somebody's USTP bits, but U contains gubbish, and it +looks like the hardware pagetable must have contained some kind of a joke +as well. I am tempted to agree with you that this was the result of +glitch. (That must be what you think since you mailed this to Poor-MC, +right?) + + PS: Someone seems to have deleted the pooor-mc alias. + +I don't think it ever really had that name, at least not for long. I +suggested it, but I think somebody corrected my joke thinking it was a typo +almost instantly. + +Date: Sun, 22 Dec 85 15:22:54 EST +From: "Christopher C. Stacy" +To: BUG-COMSAT@MC.LCS.MIT.EDU +cc: POOR-MC@MC.LCS.MIT.EDU +In-reply-to: Msg of Sat 21 Dec 85 18:12:59 EST from Gail Zacharias +Message-ID: <[MC.LCS.MIT.EDU].763994.851222.CSTACY> + +Okay folks, here I am hooking up domains to COMSAT today. +The SYSNET directory is now locked. + +Date: Sun, 22 Dec 85 15:21:29 EST +From: David Vinayak Wallace +Subject: page fault in system +To: POOR-MC@MC.LCS.MIT.EDU +cc: HIC@MC.LCS.MIT.EDU +Message-ID: <[MC.LCS.MIT.EDU].763991.851222.GUMBY> + +ITS took a page fault. Look in CRASS PAGFLT if you care. + +david + +PS: Someone seems to have deleted the pooor-mc alias. + +Date: Sun, 8 Dec 85 12:15:59 EST +From: Alan Bawden +Subject: Crash +To: RDZ@MIT-MC.ARPA +cc: POOR-MC@MIT-MC.ARPA +In-reply-to: Msg of Sun 8 Dec 85 00:27:15 EST from Ramin Zabih +Message-ID: <[MIT-MC.ARPA].746247.851208.ALAN> + + Date: Sun, 8 Dec 85 00:27:15 EST + From: Ramin Zabih + MC died again. It printed the error "TTY: OUTPUT BUFFER POINTER PAST + END OF BUFFER". I saved it to CRASH;CRASH TTYOU1. When I reloaded + XITS and g'd it, the memory bay lights flashed for a while and + nothing else happened. I waited a minute or so, raised switch zero + and reloaded it; it then seemed happy. + + By the way, is this mailing list the place to send these reports or + should I just write them in the log? + +I think the idea behind Poor-MC was for hardware related problems. If you +think a crash was clearly caused by hardware, Poor-MC is the place. If you +can't tell, send mail to Bug-ITS. In either case write something in the +log. In this case I happen to know that this is one of the known software +bugs in ITS, perhaps someday somebody will figure out how this happens. +(If you see it again, don't bother to take a crash dump of it, we have +plenty of this one!) + +The other wierd thing that happend to you, where ITS comes up but nothing +gets printed on the system console, is something I have seen before, but I +haven't the slightest idea what causes it. The console 11 must get +confused or something given that the salvager manages to run without error, +yet it types nothing out! + +Date: Sun, 8 Dec 85 00:27:15 EST +From: Ramin Zabih +Subject: Crash +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].745940.851208.RDZ> + +MC died again. It printed the error "TTY: OUTPUT BUFFER POINTER PAST +END OF BUFFER". I saved it to CRASH;CRASH TTYOU1. When I reloaded +XITS and g'd it, the memory bay lights flashed for a while and +nothing else happened. I waited a minute or so, raised switch zero +and reloaded it; it then seemed happy. + +By the way, is this mailing list the place to send these reports or +should I just write them in the log? + + Ramin + +Date: Mon, 25 Nov 85 20:54:01 EST +From: Ramin Zabih +Subject: Guess what? MC crashed... +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].732690.851125.RDZ> + +It complained about too many parity errors. I warm booted it and it +was happy. Crash dump in crash;crash parerr. + + +Date: Mon, 11 Nov 85 21:08:40 EST +From: Alan Bawden +Subject: Hangup +To: ALAN@MIT-MC.ARPA +cc: POOR-MC@MIT-MC.ARPA +In-reply-to: Msg of Sun 10 Nov 85 16:14:18 EST from Alan Bawden +Message-ID: <[MIT-MC.ARPA].714898.851111.ALAN> + +Looks like reloading the console 11 fixed the hangup detection problem. I +guess we can stop worrying about broken hardware. + +Date: Sun, 10 Nov 85 16:14:18 EST +From: Alan Bawden +Subject: Hangup +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].713564.851110.ALAN> + +Sometime in the last couple of days the console 11 (the one that acts as a +front end for the vadic lines) has stopped detecting hangups. The symptoms +are that when you dial up to MC and type CR you do -not- get the "Connected +to MC" message, instead you have to type ^Z, because you are already +connected to MC. You thus lose your chance to do autospeeding if want to +talk something other than 1200 baud. Furthermore, ITS has not cleared the +terminal type for the line you are using (the 11 never told it the last guy +hung up the phone), so it will be sending inappropriate display codes to +your terminal. + +The next person to reload the system should be sure to reload the console +11 on the theory that it is running corrupted software. If this doesn't +work, then we will have to assume it is busted hardware. + +Date: Thu, 7 Nov 85 12:06:19 EST +From: Ramin Zabih +Subject: @#$%!*& +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].709588.851107.RDZ> + +Pinheads of the World, Unite! +You have nothing to lose but your Brains! + +(M-X Exit Flame Mode) + +When I came upstairs to reboot MC I discovered that the system console +had been cunningly set up so that it printed its messages on paper +that had been previously typed on. Note on the blank side of such +paper, mind you, but on the pre-written on side. I therefore have no +idea at all why the machine crashed. I went and found some clean +paper which the console is now using. + +The salvager also deleted the empty directories MBR and LND. + + Ramin + +Date: Wed, 16 Oct 85 17:14:43 EDT +From: Christopher C. Stacy +Subject: There is no hope for this place +To: ALAN@MIT-MC.ARPA +cc: POOR-MC@MIT-MC.ARPA +In-reply-to: Msg of Wed 16 Oct 85 13:50:13 EDT from Alan Bawden +Message-ID: <[MIT-MC.ARPA].681637.851016.CSTACY> + +I was around early Wednsday morning, and the indicated AMPEX memory +was offline then. I went home when DEC took the system down for PM. + + I guess we just have to assume that pinheads come in in the + middle of the night and randomly play with the switches on our machines. + +Probably at least every other week. + +Date: Wed, 16 Oct 85 13:50:13 EDT +From: Alan Bawden +Subject: There is no hope for this place +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].681361.851016.ALAN> + +Being in a mood that makes me easy to annoy, I was very annoyed to find +that: despite the fact that there was a system message on MC saying that +1/2 of the ampex was off-line, and despite the fact that there was a note +the MC's Very Small Bulletin Board about memory being offline, and despite +the fact that I sent mail to this mailing list, nevertheless all of the +ampex memory is currently online. How long has this been true I wonder? +Did whoever do this have a good reason for not turning interleaving in the +Ampex back on when the re-enabled that memory? Why didn't they remove the +now-erroneous note from the VSBB? Why didn't they take down the system +message? I guess we just have to assume that pinheads come in in the +middle of the night and randomly play with the switches on our machines. + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA 9 Oct 85 19:15:57 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 330516; Wed 9-Oct-85 19:13:07-EDT +Date: Wed, 9 Oct 85 19:12 EDT +From: David A. Moon +Subject: Ampex +To: Alan Bawden +cc: POOR-MC@MIT-MC.ARPA +In-Reply-To: <[MIT-MC.ARPA].674370.851009.ALAN> +Message-ID: <851009191216.4.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Wed, 9 Oct 85 19:07:10 EDT + From: Alan Bawden + + I took sector 0 of the Ampex offline as the parity errors got to bad to put + up with. I take it that since the errors had moved from sector 1 to sector + 0 thaat someone (TY?) has been swapping boards in there? None of the + module parity error lights were lit, perhaps this means that the light on + the module in question is burned out. + +Maybe the modules are fine and the problem is with getting the data between +the core modules and the cpu, thus fingering the memory bus interface in the +cpu (which I have never known to break), the memory bus cables (which don't +break very often), the memory bus transceiver cards in the ampex (which are +pieces of shit that always break), and the controller in the ampex (also a +piece of shit, but as far as I know has never broken). The errors might be +concentrated in a particular sector if the processor and the ampex are both +interleaved; in that case the even addresses would all be on a particular +pair of the 4 processor-memory busses, would go through a particular set of +transceivers, and would all end up in sector 0. The odd addresses would go +through different transceivers and end up in sector 1. + +Besides being pieces of garbage in their own right, the transceiver cards +have a manual adjustment with (as I recall) conflicting documentation about +what you're supposed to adjust it to, plus sensitivity to power supply problems. + + +Date: Wed, 9 Oct 85 19:07:10 EDT +From: Alan Bawden +Subject: Ampex +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].674370.851009.ALAN> + +I took sector 0 of the Ampex offline as the parity errors got to bad to put +up with. I take it that since the errors had moved from sector 1 to sector +0 thaat someone (TY?) has been swapping boards in there? None of the +module parity error lights were lit, perhaps this means that the light on +the module in question is burned out. + +Date: Fri, 4 Oct 85 20:52:20 EDT +From: Ken Harrenstien +Subject: CRASH;CRASH PKQGF +To: ALAN@MIT-MC.ARPA +cc: KLH@MIT-MC.ARPA, RDZ@MIT-MC.ARPA, POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].669032.851004.KLH> + +Of course, just about ANYTHING could happen as the result of a single +changed bit. The fact that this happened twice makes me mildly +suspicious, but I really have no clue. This is a pretty basic +routine that gets invoked continuously, and has never barfed before +to my knowledge. Most likely something clobbered some portion +of the memory. If you had both dumps available, I would suggest +looking at the network connections with PEEK's autopsy mode to see +if there is anything in common. + +Date: Fri, 4 Oct 85 15:37:20 EDT +From: Christopher C. Stacy +Subject: delete and ignore this message +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].668643.851004.CSTACY> + +Testing, 1,2,3,... + +Date: Fri, 4 Oct 85 15:25:17 EDT +From: Christopher C. Stacy +Subject: archival +To: GSB@MIT-MC.ARPA +cc: POOR-MC@MIT-MC.ARPA +In-reply-to: Msg of Fri 4 Oct 85 02:50:34 EDT from Glenn S. Burke +Message-ID: <[MIT-MC.ARPA].668630.851004.CSTACY> + + Date: Fri, 4 Oct 85 02:50:34 EDT + From: Glenn S. Burke + To: POOR-MC at MIT-MC.ARPA + Re: archival + + I made poor-mc archive in [sysdoc;poor mc]. + I suppose optimally it should archive on some other machine. + What's a good place on ai? + +I just created AI:SYSDOC; and will update the mailing list. +(I moved a copy of .CALLS there and a -READ- -THIS- too...) + +Date: Fri, 4 Oct 85 02:50:34 EDT +From: Glenn S. Burke +Subject: archival +To: POOR-MC@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].668396.851004.GSB> + +I made poor-mc archive in [sysdoc;poor mc]. +I suppose optimally it should archive on some other machine. +What's a good place on ai? + + +Received: from SCRC-STONY-BROOK.ARPA by MIT-MC.ARPA 3 Oct 85 16:59:49 EDT +Received: from EUPHRATES.SCRC.Symbolics.COM by SCRC-STONY-BROOK.ARPA via CHAOS with CHAOS-MAIL id 326337; Thu 3-Oct-85 17:00:27-EDT +Date: Thu, 3 Oct 85 16:59 EDT +From: David A. Moon +Subject: Poor-MC@MC +To: Christopher C. Stacy +cc: POOR-MC@MIT-MC.ARPA +In-Reply-To: <[MIT-MC.ARPA].667595.851003.CSTACY> +Message-ID: <851003165943.6.MOON@EUPHRATES.SCRC.Symbolics.COM> + + Date: Thu, 3 Oct 85 15:12:17 EDT + From: Christopher C. Stacy + + MC started crashing with parity errors in MH10-D (bank 0) today, and + TY thinks that the problem is related to the tape channel, since + whenever DUMP gets round to touching the tape, the system dies. + So, he's calling in DEC to run diagnostics on the memories and DF10. + +DDQCB on our disk is pretty good for checking for this problem. Don't +forget to write-protect the disks when running it, otherwise it may write +on them! You can get it to write and read a tape and tell you what bad +data were written into memory by the tape controller. + + +Date: Wed, 2 Oct 85 17:22:38 EDT +From: Alan Bawden +Subject: Poor-MC@MC +To: TY@MIT-MC.ARPA, GSB@MIT-MC.ARPA, ALAN@MIT-MC.ARPA, + CSTACY@MIT-MC.ARPA, CENT@MIT-MC.ARPA, DPH@MIT-MC.ARPA, + JNC@MIT-MC.ARPA, TAFT@MIT-MC.ARPA, GUMBY@MIT-MC.ARPA, + JTW@MIT-MC.ARPA +Message-ID: <[MIT-MC.ARPA].666412.851002.ALAN> + +(Who else would ever bring MC up after it crashes? I get tired of sending +these notes to all of Bug-ITS... Perhaps we should make a Pooor-MC mailing +list?) + +I reconfigured MC's memory as follows: + + 0 - 777777 MH10-D + 1,,0 - 4,,777777 Ampex (both sectors) + 5,,0 - 5,,777777 MH10-C + 6,,0 - 6,,777777 MH10-B + 7,,0 - 7,,777777 MH10-A + +This puts the system itself running in MH10-D which hasn't seen parity +errors in quite some time. Also if I understand the way ITS allocates +memory this will tend to keep users out of the Ampex, so perhaps its parity +errors will be less fatal. Finally, if the DL10 is really writing bad +parity, this should make them move to a different place so we can see. + +(Probably I should have put the boxes A,B,C in the other order since for a +while we thought A might have been broken, but its too late now.) + \ No newline at end of file diff --git a/sysdoc/ttyvar.103 b/sysdoc/ttyvar.103 new file mode 100644 index 0000000..c9c189d --- /dev/null +++ b/sysdoc/ttyvar.103 @@ -0,0 +1,414 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS TTY Variables: + + This file attempts to maintain up-to-date documentation on all +the TTY variables. Those wonderful souls who update this information +in anyway (additions, deletions, corrections) should describe their +modifications in a brief note to INFO-ITS so that interested parties +can correct their copies or conceptions without needing to print or read +the entire file again. For example: + +:MAIL INFO-ITS I added documentation on the FOO variable to TTYVAR.^C +---------------------------------------------------------------------- + + For a more complete description of TTY handling see the file +.INFO.;ITS TTY. This file exists primarily to facilitate lookup via +the DOC program. Use :DOC TTYVAR to read the documentation +of a specific variable. + + The system calls for reading and setting TTY variables are: +CNSGET, CNSSET, OPEN, RCPOS, RFNAME, RSSIZE, SCML, SCPOS, STYGET, +TTYGET, TTYSET, and TTYVAR. + +BIT names: + + Bit names begin with %Tx where x specifies which variable. Byte +pointer names begin with $Tx. Here is a list of the prefixs in use +and where they're found: + +%TA TTYSTA +%TB .TTY +%TC TTYCOM +%TD output buffers (these are characters, not bits) +%TF ? +%TG TTYST1 and TTYST2 +%TI IOCHNM (for input channels) +%TJ IOCHNM (for output channels) +%TN TCTYP (these are codes, not bits) +%TO TTYOPT LH +%TP TTYOPT RH +%TS TTYSTS +%TT TTYTYP LH +%TX input buffers +%TY TTYTYP RH + +HEIGHT: Screen Height (per-TTY) + + HEIGHT contains the number of lines on the screen. For printing +terminals it is usually some large number. + + This variable can be read with the CNSGET, RSSIZE, and TTYVAR system +calls and set with the CNSSET and TTYVAR system calls. + +IDLTIM: Idle Time (per-TTY) + + IDLTIM contains the length of time since the last input character +character was typed on the TTY, in 30'ths of a second. + + This variable can be read with the TTYVAR system call. + +IOCHNM: I/O channel bits (per-channel) + + Some of the control bits set first time options and some are per-channel. +Those which are per-channel are marked below with a *. The standard names +for these bits are also given. + +Control bits on input: + 2.6 * %TIECH Read even if char needs pi echoing + 2.5 * %TIPEK Don't remove char from buffer (peek) + 2.3 * %TIACT Don't wait for activation char + 2.2 * %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + 2.1 * %TINWT Do not wait for input. If no input is + available, return -1 in unit mode, or + return a partially filled block in block mode. + 1.9 * %TIFUL Use the full TV character set if possible. + In this mode, characters have this form: + 2.3 %TXTOP Top. + 2.2 Obsolete. Used to be Shift lock. + 2.1 %TXSUP Super. Used to be Shift. + 1.9 %TXMTA Meta. + 1.8 %TXCTL Control. + 1.7-1.1 %TXASC Ascii part of character. + Of course, for non-TV's only %TXASC + will be non-zero. + 1.6 Set up 3 line echo area (like SCML of 3). + 1.4 "DDT" mode. Initially clear the %TGPIE and + %TGMPE bits for carriage return, line feed, + and tab, thus causing them not to echo. + 1.3 Image mode. Initially clear the %TGPIE + and %TGMPE bits for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode, + ^C causes a block mode end of file. + 1.1 0 = input. + +Control bits on output: + + 2.6 * %TJECH Echo mode output. + 2.5 * %TJCTN Don't do line continuation. + 2.4 * %TJSTP Channel is hung in **MORE**. + Unusual in that the system modifies this bit. + 2.3 * %TJDIS Recognize ^P cursor codes. + 2.2 * %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 * %TJMOR Do not do **MORE** processing. + 1.9 * %TJPP2 Output in the echo area if it exists. + 1.6 Same as 2.2 - turns on %TJSIO. + 1.5 Same as 2.3 - turns on %TJDIS. + 1.4 Turns on %TJECH, %TJPP2, %TJMOR. + 1.3 Image mode. Initially set %TGIMG bits + for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode + output all ^C's are ignored. + 1.1 1 = output. + + The I/O channel word for a TTY channel can be read with RFNAME. It +is set by the OPEN call. + +ISPEED: Input Speed (per-TTY) + + ISPEED is the input speed of the terminal. It refers to the input +speed code stored in the TTYTYP variable. However, it is not a speed +code, but rather the speed in bits per second. Also, you are allowed to +set the ISPEED variable, while you are not allowed to set the whole TTYTYP +variable. + + This variable can be read and set with the TTYVAR system call. + +OSPEED: Output Speed (per-TTY) + + OSPEED is the output speed of the terminal. It refers to the output +speed code stored in the TTYTYP variable. However, it is not a speed +code, but rather the speed in bits per second. Also, you are allowed to +set the OSPEED variable, while you are not allowed to set the whole TTYTYP +variable. + + This variable can be read and set with the TTYVAR system call. + +TCTYP: Terminal type code (per-TTY) + + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 Zenith H19 + 16 %TNAAA Ann Arbor Ambassador + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYCOM: Com-link bits (per-TTY) + + 4.9 Communicate mode. + 4.8 %TCLFT Local feed through (my job sees his typing). + 4.7 %TCRFT Remote feed through (his job sees my typing). + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 4.1 %TCECH The last output to this tty was PI echo. + 3.9 %TCINP Someone waited for input since last home-up. + 3.8 %TCDET Console's tree detached by top level interrupt. + 3.7 %TCDNG Type bell (input buffer full). + 3.6 %TCCBK Reading uname or tty number after ^_K. + 3.5 %TCCBS Reading uname or tty number after ^_S. + 3.4 %TCFPD First part of an output code sequence is done. + 3.3 %TCTPN Type ^_N on leaving comm (unless user types it). + 3.2 %TCPAD 0 => padding necessary on datapoint. + 3.1 %TCHNG Done flag seems to be fried - time out quickly. + 2.9-1.1 -1 if not in comm mode; otherwise number of + next tty in circular list of those in comm mode + together. + +Only the %TCICO, %TCOCO, %TCRFS, %TCQRY, %TCMTR, and %TCINP bits may +be set. + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYOPT: TTY capability and option bits (per-TTY) + + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 3.2 %TOLID This tty can insert/delete lines. + 3.1 %TOCID This tty can insert/delete characters. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.9 %TPMTA Treat bit 1.8 of input characters as the meta bit. + this is for terminals such as Telerays which have Edit keys. + 1.8 %TPPRN interchange ( with [, and ) with ], on input. + 1.7 %TPTEL Treat CRLF input as CR for TELNET protocol. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling. + 1.2 %TPIBC Oddball 2741-like tty. ;no longer defined + 1.1 %TPIBM It really is a 2741. ;no longer defined + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYROL: Scroll count (per-TTY) + + TTYROL contains the number of lines the TTY moves up when it scrolls. +Scrolling occurs when a LF is sent while the cursor is on the last line. + + This variable can be read and set with the TTYVAR system call. + +TTYSTA: ? + + 4.9 %TACFM Tty does not need a console free message + eventually (hasn't been in use since + the last one). + 4.8 %TAC.Z Tty is being ^Z'd. Shouldn't be on with + %TACFM. If %TACFM and %TAC.Z are both 0, + the tty is being freed and a console free + message is immanent. + 4.7 %TANJS This ^Z is being flushed because no job + slots are available. If set, %TAC.Z + will be 1 and %TACFM will be 0. + 4.6-4.3 %TANEC Number of following chars to inhibit echo and ints for. + This is used for the arg chars that follow Top-E, + Top-S, Top-Y, etc. + + This variable can be read with the STYGET system call. + +TTYST1: Activation and Echo control word 1 (per-job) + +This variable contains six groups of six bits. +Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + +The character groups are: + 4.9-4.4 ^@-^F ^K ^L ^N-^R ^T-^Z ^\-^_ + 4.3-3.7 Upper and lower case letters. + 3.6-3.1 Digits. + 2.9-2.4 ! " # $ % & ' , . : ; ? @ \ ` | ~ + 2.3-1.7 + * - / = ^ _ + 1.6-1.1 < > ( ) [ ] { } + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYST2: Activation and Echo control word 2 (per-job) + +This variable contains six more groups of six bits. +Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + +The character groups are: + 4.9-4.4 ^G ^S + 4.3-3.7 ^I ^J (tab, linefeed) + 3.6-3.1 altmode (33) + 2.9-2.4 ^M (carriage return) + 2.3-1.7 rubout (177) + 1.6-1.1 space, ^H (backspace) + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYSTS: TTY option bits (per-job) + + 4.9 %TSFRE Free console (not in use). + 4.8 %TSCLE ^L should echo as "^L" (normally + clears screen on displays). + 4.7 %TSHDX Same as %TOHDX. Vestigial. + 4.6 %TSFCO Use full 12-bit TV char set for output + and echoing; echo META as BETA; echo + CONTROL as ALPHA. + 4.5 %TSALT Do not standardize altmodes. + 4.4 %TSROL Scroll mode. + 4.3 %TSSAI Echo and ascii output use SAIL + character set. + 4.2 %TSACT Next input IOT shouldn't wait + for an activation character. + 4.1 %TSNEA Don't echo in echo area; echo in M.P. Area. + 3.9 %TSINT Next input character should + interrupt even if it ordinarily + would not (%TGINT = 0). + 3.8 %TSMOR Inhibit **MORE** processing. + 3.7 %TSATY Set whenever an .ATTY executed by + some superior returns the tty to + the job. + 3.4 %TSNOE Defer echoing. + 3.3 %TSLCZ Last character typed was ^Z. + This bit causes .ATTY's to fail. + 3.2 %TSSII Super-image input. The special + actions of ^Z and ^_ are suppressed. + 3.1 %TSCNS This is a console, not a device. + 2.9-1.1 The user index of the job which controls + the tty, or -1 if the tty is free. + +%TSFRE, %TSHDX, %TSLCZ, %TSCNS, and the RH may not be altered. + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYTYP: Semi-permanent stuff (per-TTY) + +This variable may not be set, just read (but see ISPEED and OSPEED). + + 4.9 %TTLCL Local tty (i.e. right near the PDP-10). + 4.8 %TT340 Near the 340 or a 340 slave. + 4.7 %TT3HP High priority for grabbing 340. + 4.3 %TTPAR Tty needs a parity bit generated by software. + 4.2 %TTDDI Don't ding bell on excess input. + 4.1 %TTIBM Datel (2741) line. + 3.8-3.5 $TTISP Input speed code: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + 3.4-3.1 $TTOSP Output speed code, as above. + 2.9 %TYDPK Datapoint controller line. + 2.8 %TYSTY Alter ego to a STY. + 2.7 %TYNVA Nova tty (requiescat in pace). + 2.6 %TYMTY Morton controller line. + 2.5 %TYDIL Dial-up line. + 2.4 %TY11T PDP-11 TV tty. + 2.3 %TYDL DL-10 tty. + 2.2 %TYOTY KA-10 console tty. + 2.1 %TYETY DTE-20 tty. + 1.9 %TYNTY TK-10 tty. + 1.8 %TYMDM Dial-up line with modem control. + 1.7 %TYKST KS-10 console tty. + 1.6 %TYDZT DZ-11 tty on a KS-10. + 1.5 %TYRLM ROLM data switch tty. + + This variable can be read with the CNSGET and TTYVAR system calls. + +WIDTH: Screen width (per-TTY) + + WIDTH contains the no. of usable print positions on a line for the +TTY. It is usually one or two less than the actual no. of columns to allow +room for a "!" in the last column to indicate typeout being continued on +the next line (two columns are required when the terminal loses by +automatically performing a CRLF operation when a character is output to +the last column). + + This variable can be read with the CNSGET, RSSIZE and TTYVAR system +calls and set with the CNSSET and TTYVAR system calls. diff --git a/sysdoc/ttyvar.105 b/sysdoc/ttyvar.105 new file mode 100644 index 0000000..80ba12c --- /dev/null +++ b/sysdoc/ttyvar.105 @@ -0,0 +1,446 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS TTY Variables: + + This file attempts to maintain up-to-date documentation on all +the TTY variables. Those wonderful souls who update this information +in anyway (additions, deletions, corrections) should describe their +modifications in a brief note to INFO-ITS so that interested parties +can correct their copies or conceptions without needing to print or read +the entire file again. For example: + +:MAIL INFO-ITS I added documentation on the FOO variable to TTYVAR.^C +---------------------------------------------------------------------- + + For a more complete description of TTY handling see the file +.INFO.;ITS TTY. This file exists primarily to facilitate lookup via +the DOC program. Use :DOC TTYVAR to read the documentation +of a specific variable. + + The system calls for reading and setting TTY variables are: +CNSGET, CNSSET, OPEN, RCPOS, RFNAME, RSSIZE, SCML, SCPOS, STYGET, +TTYGET, TTYSET, and TTYVAR. + +BIT names: + + Bit names begin with %Tx where x specifies which variable. Byte +pointer names begin with $Tx. Here is a list of the prefixs in use +and where they're found: + +%TA TTYSTA +%TB .TTY +%TC TTYCOM +%TD output buffers (these are characters, not bits) +%TF ? +%TG TTYST1 and TTYST2 +%TI IOCHNM (for input channels) +%TJ IOCHNM (for output channels) +%TN TCTYP (these are codes, not bits) +%TO TTYOPT LH +%TP TTYOPT RH +%TQ TTYSMT LH +%TR TTYSMT RH +%TS TTYSTS +%TT TTYTYP LH +%TX input buffers +%TY TTYTYP RH + +HEIGHT: Screen Height (per-TTY) + + HEIGHT contains the number of lines on the screen. For printing +terminals it is usually some large number. + + This variable can be read with the CNSGET, RSSIZE, and TTYVAR system +calls and set with the CNSSET and TTYVAR system calls. + +IDLTIM: Idle Time (per-TTY) + + IDLTIM contains the length of time since the last input character +character was typed on the TTY, in 30'ths of a second. + + This variable can be read with the TTYVAR system call. + +IOCHNM: I/O channel bits (per-channel) + + Some of the control bits set first time options and some are per-channel. +Those which are per-channel are marked below with a *. The standard names +for these bits are also given. + +Control bits on input: + 2.6 * %TIECH Read even if char needs pi echoing + 2.5 * %TIPEK Don't remove char from buffer (peek) + 2.3 * %TIACT Don't wait for activation char + 2.2 * %TIINT Read even if char is an interrupt + char and hasn't interrupted yet. + 2.1 * %TINWT Do not wait for input. If no input is + available, return -1 in unit mode, or + return a partially filled block in block mode. + 1.9 * %TIFUL Use the full TV character set if possible. + In this mode, characters have this form: + 2.3 %TXTOP Top. + 2.2 Obsolete. Used to be Shift lock. + 2.1 %TXSUP Super. Used to be Shift. + 1.9 %TXMTA Meta. + 1.8 %TXCTL Control. + 1.7-1.1 %TXASC Ascii part of character. + Of course, for non-TV's only %TXASC + will be non-zero. + 1.6 Set up 3 line echo area (like SCML of 3). + 1.4 "DDT" mode. Initially clear the %TGPIE and + %TGMPE bits for carriage return, line feed, + and tab, thus causing them not to echo. + 1.3 Image mode. Initially clear the %TGPIE + and %TGMPE bits for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode, + ^C causes a block mode end of file. + 1.1 0 = input. + +Control bits on output: + + 2.6 * %TJECH Echo mode output. + 2.5 * %TJCTN Don't do line continuation. + 2.4 * %TJSTP Channel is hung in **MORE**. + Unusual in that the system modifies this bit. + 2.3 * %TJDIS Recognize ^P cursor codes. + 2.2 * %TJSIO Super-image output. No padding + or cursor control is performed. + 2.1 * %TJMOR Do not do **MORE** processing. + 1.9 * %TJPP2 Output in the echo area if it exists. + 1.6 Same as 2.2 - turns on %TJSIO. + 1.5 Same as 2.3 - turns on %TJDIS. + 1.4 Turns on %TJECH, %TJPP2, %TJMOR. + 1.3 Image mode. Initially set %TGIMG bits + for all characters. + 1.2 0 = unit mode, 1 = block mode. In block mode + output all ^C's are ignored. + 1.1 1 = output. + + The I/O channel word for a TTY channel can be read with RFNAME. It +is set by the OPEN call. + +ISPEED: Input Speed (per-TTY) + + ISPEED is the input speed of the terminal. It refers to the input +speed code stored in the TTYTYP variable. However, it is not a speed +code, but rather the speed in bits per second. Also, you are allowed to +set the ISPEED variable, while you are not allowed to set the whole TTYTYP +variable. + + This variable can be read and set with the TTYVAR system call. + +OSPEED: Output Speed (per-TTY) + + OSPEED is the output speed of the terminal. It refers to the output +speed code stored in the TTYTYP variable. However, it is not a speed +code, but rather the speed in bits per second. Also, you are allowed to +set the OSPEED variable, while you are not allowed to set the whole TTYTYP +variable. + + This variable can be read and set with the TTYVAR system call. + +TCTYP: Terminal type code (per-TTY) + + 0 %TNPRT Printing terminal. + 1 %TNDP Good Datapoint. + 2 %TNODP Bad Datapoint ("loser"). + 3 %TNIML Imlac. + 4 %TNTEK Tektronix. + 5 %TNTV PDP-11 TV. + 6 %TNMEM Memowreck. + 7 %TNSFW Software terminal (accepts internal + ITS display codes, such as live in + internal terminal output buffers; + see ITS TTY for details). + 10 %TNTRM Terminet. + 11 %TNESC Display using ASCII standard display codes. + 12 %TNDTM Datamedia. + 13 %TNRAY Teleray 1061 + 14 %TNHDS Concept 100 + 15 %TNH19 Zenith H19 + 16 %TNAAA Ann Arbor Ambassador + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYCOM: Com-link bits (per-TTY) + + 4.9 Communicate mode. + 4.8 %TCLFT Local feed through (my job sees his typing). + 4.7 %TCRFT Remote feed through (his job sees my typing). + 4.6 %TCICO Input comm override (my job sees my typing). + 4.5 %TCOCO Output comm override (I see my job's typing). + 4.4 %TCRFS Refuse comm messages. + 4.3 %TCQRY Query me if comm attempted to me. + 4.2 %TCMTR The tty's motor is off, and must be + turned on before next output. + (Currently only Terminets get turned off.) + 4.1 %TCECH The last output to this tty was PI echo. + 3.9 %TCINP Someone waited for input since last home-up. + 3.8 %TCDET Console's tree detached by top level interrupt. + 3.7 %TCDNG Type bell (input buffer full). + 3.6 %TCCBK Reading uname or tty number after ^_K. + 3.5 %TCCBS Reading uname or tty number after ^_S. + 3.4 %TCFPD First part of an output code sequence is done. + 3.3 %TCTPN Type ^_N on leaving comm (unless user types it). + 3.2 %TCPAD 0 => padding necessary on datapoint. + 3.1 %TCHNG Done flag seems to be fried - time out quickly. + 2.9-1.1 -1 if not in comm mode; otherwise number of + next tty in circular list of those in comm mode + together. + +Only the %TCICO, %TCOCO, %TCRFS, %TCQRY, %TCMTR, and %TCINP bits may +be set. + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYOPT: TTY capability and option bits (per-TTY) + + 4.8 %TOALT Standardize altmodes. + 4.7 %TOCLC Convert lower case input to upper case. + 4.6 %TOERS This tty can selectively erase. + 4.5 %TOHDX This tty is half-duplex. + 4.4 %TOMVB This tty can backspace directly. + 4.3 %TOSAI This tty handles SAIL characters. + 4.2 %TOSA1 Used to initialize %TSSAI for new jobs. + 4.1 %TOOVR This tty can overprint correctly. + 3.9 %TOMVU This tty can move its cursor upward. + 3.8 %TOMOR Used to initialize %TSMOR for new jobs. + 3.7 %TOROL Used to initialize %TSROL for new jobs. + 3.6 %TORAW Don't optimize cursor motion. + 3.5 %TOLWR This tty has a lower case keyboard. + 3.4 %TOFCI This tty's keyboard has the full TV character set. + 3.3 %TOIML This tty acts like an IMLAC. + 3.2 %TOLID This tty can insert/delete lines. + 3.1 %TOCID This tty can insert/delete characters. + 2.9-2.7 $TPPLF How to pad line feeds: + 0 Don't. + 1 Two pad chars (Memorex, 2741). + 2 Terminet. + 2.6-2.4 $TPPCR How to pad carriage returns: + 0 Don't. 4 Execuport. + 1 Normal. 5 2741. + 2 Double. 6 Memorex. + 3 Unused. 7 Unused. + For a Datapoint, number of pad chars before + each string of cursor motion commands. + For a Terminet, 0=no padding, 1,2,3,4,5 + correspond to 10,15,30,60,120 cps. + 2.3-2.1 $TPPTB How to pad tabs: + 0 Tabs not allowed. + Use pad chars. + On displays, + 0 don't use tabs. + 1 use tabs. + 2 use VT52-style absolute positioning. + 1.9 %TPMTA Treat bit 1.8 of input characters as the meta bit. + this is for terminals such as Telerays which have Edit keys. + 1.8 %TPPRN interchange ( with [, and ) with ], on input. + 1.7 %TPTEL Treat CRLF input as CR for TELNET protocol. + 1.6 %TPCBS The ^\ intelligent terminal protocol is enabled. + 1.5 %TP11T PDP-11 TV. Reflects %TY11T. + 1.4 %TPORS Output reset really does something. + 1.3 %TPRSC This tty can do region scrolling. + 1.2 %TPIBC Oddball 2741-like tty. ;no longer defined + 1.1 %TPIBM It really is a 2741. ;no longer defined + + This variable can be read with the CNSGET and TTYVAR system calls +and set with the CNSSET and TTYVAR system calls. + +TTYROL: Scroll count (per-TTY) + + TTYROL contains the number of lines the TTY moves up when it scrolls. +Scrolling occurs when a LF is sent while the cursor is on the last line. + + This variable can be read and set with the TTYVAR system call. + +TTYSMT: Smarts (per-TTY) + +Bits marked with a * are pertain to the graphics protocol. If %TQGRF is 0, +they should all be 0. + + 4.9-4.7 %TQMCH CPU type. 0 => unknown or uninteresting. + 1 => PDP11. 2 => IMLAC PDS4. 3 => IMLAC PDS1. + 4.6-4.2 * %TQHGT Character height in dots. + 4.1-3.7 * %TQWID Character width in dots. + 3.6 * %TQVIR Terminal implements virtual coordinates. + 3.5 * %TQBNK Terminal implements blinking. + 3.4 * %TQXOR Terminal implements XOR mode. + 3.3 * %TQREC Terminal implements the rectangle commands. + 3.2 * %TQSET Terminal implements multiple sets. + 3.1 * %TQGRF Terminal understands the graphics protocol. + (Used to be called %TQGPH.) + 2.9 * %TRGIN Terminal provides graphic input. + 2.8 * %TRGHC Terminal provides has graphic hardcopy. + 2.7 %TRLED Terminal supports the local-editing protocol. + (See SUPDUP doc) + 2.6 * %TRSCN Terminal implements scan-line output. + 2.5-2.3 %TRLSV Nonzero means terminal can save about 4**n lines. + (See SUPDUP doc) + 2.2-1.7 %TRTIM Signed offset from GMT minus 20. A value of zero + means don't know, don't care, or user program + hasn't implemented it yet. + + This variable can be read and set with the TTYVAR system call. + +TTYSTA: Console Status + + 4.9 %TACFM Tty does not need a console free message + eventually (hasn't been in use since + the last one). + 4.8 %TAC.Z Tty is being ^Z'd. Shouldn't be on with + %TACFM. If %TACFM and %TAC.Z are both 0, + the tty is being freed and a console free + message is immanent. + 4.7 %TANJS This ^Z is being flushed because no job + slots are available. If set, %TAC.Z + will be 1 and %TACFM will be 0. + 4.6-4.3 %TANEC Number of following chars to inhibit echo and ints for. + This is used for the arg chars that follow Top-E, + Top-S, Top-Y, etc. + + This variable can be read with the STYGET system call. + +TTYST1: Activation and Echo control word 1 (per-job) + +This variable contains six groups of six bits. +Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + +The character groups are: + 4.9-4.4 ^@-^F ^K ^L ^N-^R ^T-^Z ^\-^_ + 4.3-3.7 Upper and lower case letters. + 3.6-3.1 Digits. + 2.9-2.4 ! " # $ % & ' , . : ; ? @ \ ` | ~ + 2.3-1.7 + * - / = ^ _ + 1.6-1.1 < > ( ) [ ] { } + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYST2: Activation and Echo control word 2 (per-job) + +This variable contains six more groups of six bits. +Each group is as follows: + 1.6 %TGMPE Echo at main program level (when IOT'ed). + 1.5 %TGPIE Echo at interrupt level (when typed). + 1.4 %TGIMG Echo in image mode. + 1.3 %TGSPC Special hack: convert lower case to upper. + 1.2 %TGACT Activation character. + 1.1 %TGINT Interrupt character. + +The character groups are: + 4.9-4.4 ^G ^S + 4.3-3.7 ^I ^J (tab, linefeed) + 3.6-3.1 altmode (33) + 2.9-2.4 ^M (carriage return) + 2.3-1.7 rubout (177) + 1.6-1.1 space, ^H (backspace) + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYSTS: TTY option bits (per-job) + + 4.9 %TSFRE Free console (not in use). + 4.8 %TSCLE ^L should echo as "^L" (normally + clears screen on displays). + 4.7 %TSHDX Same as %TOHDX. Vestigial. + 4.6 %TSFCO Use full 12-bit TV char set for output and + echoing: echo CONTROL as ALPHA, echo META + as BETA, echo SUPER as EPSILON, and use + Sail graphics if TOP is set. + 4.5 %TSALT Do not standardize altmodes. + 4.4 %TSROL Scroll mode. + 4.3 %TSSAI Echo and ascii output use SAIL + character set. + 4.2 %TSACT Next input IOT shouldn't wait + for an activation character. + 4.1 %TSNEA Don't echo in echo area; echo in M.P. Area. + 3.9 %TSINT Next input character should + interrupt even if it ordinarily + would not (%TGINT = 0). + 3.8 %TSMOR Inhibit **MORE** processing. + 3.7 %TSATY Set whenever an .ATTY executed by + some superior returns the tty to + the job. + 3.4 %TSNOE Defer echoing. + 3.3 %TSLCZ Last character typed was ^Z. + This bit causes .ATTY's to fail. + 3.2 %TSSII Super-image input. The special + actions of ^Z and ^_ are suppressed. + 3.1 %TSCNS This is a console, not a device. + 2.9-1.1 The user index of the job which controls + the tty, or -1 if the tty is free. + +%TSFRE, %TSHDX, %TSLCZ, %TSCNS, and the RH may not be altered. + + This variable can be read with the TTYGET system call and set +with the TTYSET system call. + +TTYTYP: Semi-permanent stuff (per-TTY) + +This variable may not be set, just read (but see ISPEED and OSPEED). + + 4.9 %TTLCL Local tty (i.e. right near the PDP-10). + 4.8 %TT340 Near the 340 or a 340 slave. + 4.7 %TT3HP High priority for grabbing 340. + 4.3 %TTPAR Tty needs a parity bit generated by software. + 4.2 %TTDDI Don't ding bell on excess input. + 4.1 %TTIBM Datel (2741) line. + 3.8-3.5 $TTISP Input speed code: + 0 = unknown 6 = 1800 baud 13 = 40K baud + 1 = 600 baud 7 = 2400 baud 14 = 50K baud + 2 = 110 baud 10 = 4800 baud 15 = 80K baud + 3 = 150 baud 11 = 9600 baud 16 unused + 4 = 300 baud 12 = 25K baud 17 unused + 5 = 1200 baud + 3.4-3.1 $TTOSP Output speed code, as above. + 2.9 %TYDPK Datapoint controller line. + 2.8 %TYSTY Alter ego to a STY. + 2.7 %TYNVA Nova tty (requiescat in pace). + 2.6 %TYMTY Morton controller line. + 2.5 %TYDIL Dial-up line. + 2.4 %TY11T PDP-11 TV tty. + 2.3 %TYDL DL-10 tty. + 2.2 %TYOTY KA-10 console tty. + 2.1 %TYETY DTE-20 tty. + 1.9 %TYNTY TK-10 tty. + 1.8 %TYMDM Dial-up line with modem control. + 1.7 %TYKST KS-10 console tty. + 1.6 %TYDZT DZ-11 tty on a KS-10. + 1.5 %TYRLM ROLM data switch tty. + + This variable can be read with the CNSGET and TTYVAR system calls. + +WIDTH: Screen width (per-TTY) + + WIDTH contains the no. of usable print positions on a line for the +TTY. It is usually one or two less than the actual no. of columns to allow +room for a "!" in the last column to indicate typeout being continued on +the next line (two columns are required when the terminal loses by +automatically performing a CRLF operation when a character is output to +the last column). + + This variable can be read with the CNSGET, RSSIZE and TTYVAR system +calls and set with the CNSSET and TTYVAR system calls. diff --git a/sysdoc/tv.100 b/sysdoc/tv.100 new file mode 100644 index 0000000..06509ab --- /dev/null +++ b/sysdoc/tv.100 @@ -0,0 +1,327 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + + A slightly revised TV-11 program is up and running. +There are the following features/changes: + +SHIFT and SHIFT-LOCK no longer XOR. The general reaction + was against that feature, so it was removed. + +[ESC]D Buzzes the ninth-floor door for three seconds and + then flashes your screen. It works for free consoles + as well. + +[ESC]Q Generates a hardcopy, as before, but the timeout is + sixteen seconds, avoiding garbage output. + +[ESC]L Clears your screen. + NOTE: This is the same command as [ESC]I, which + is retained for old times' sake for the + moment, but will be garbage-collected + soon. +_______________________________________________________________ + +A. THE WHO-LINE. + +The who-line is a line that appears at the bottom of the screen +on a TV terminal, describing the status of either the system as +a whole, or a particular job. In the former case, it is said +that the system who-line is being displayed; in the latter, the +user who-line. The information is updated every 5 seconds. The +who-line may be turned on or off, and various modes may be +selected, under either user or program control. + + 1. WHAT APPEARS IN THE WHO-LINE. + + a. The User Who-line. + +The user who-line begins with system status information: +the version number of ITS, the time of day and the date. +Then comes information on the job that is selected for who-line +display: the job number, the uname, jname and sname, +a "status" that says what the job is doing, +the percentage of the system's time that the job is running, +its total run time so far, and its core size in K. +An example of a user who-line is: + +12/31/74 21:21:30 20 RMS NT .INFO. TTY 5% 0:03:09.2 24K RANDOM CRUFT + + ^time. ^uname. ^sname. ^% runtime. ^core size. +^date. ^job #. ^jname. ^status. ^job runtime. ^user-specified stuff. + + 1: The Who-line Status. + +STOP means that the job has been stopped (presumably by its + superior). This will be the case for jobs that have + been ^Z'd. +RUN for jobs that are running in user mode - that is, + neither stopped nor executing a system call. +PAGE means that the job is waiting to swap a page in. + + means that the job is executing an IOT (or SIOT) on that device. + Appended to the name of the device may be the following + characters: + I input. + O output. + B block mode. + S string mode. + For example, DSKBI means block mode input from the disk. + + (for example, "OPEN", "CLOSE"). + means that the job is executing the system call named. + +If the job is currently executing a system call (which implies +that the status is not RUN or STOP), a "+" will +appear in front of the status if the job is actually running, as +opposed to waiting (for buffer space, etc). +Thus, "DSKBI" indicates that the job is waiting for a disk +transfer to take place, while "+DSKBI" indicates that it is +copying information out of a system disk buffer. + +The user-specified part of the who-line is controlled by the +.WHO1, .WHO2 and .WHO3 variables of the job described by the +who-line. Those variables exist so that the program running can +show whatever internal status information it thinks the user might +want to know - what page of input is being processed, for example. +See the description of those variables in ITS USETS for details of +how to use them in a program. + + + b. The System Who-line. + +The items in the system who-line are as follows: + +ITS XXX MM/DD/YY HH:MM:SS USERS RNBL/TJOB SWAPB PAGEW RCORE/UCORE FCORE + +XXX ITS version # +MM/DD/YY today's date +HH:MM:SS time of day +USERS number of users logged in +RNBL number of runnable jobs +TJOB total number of ITS jobs +SWAPB number of swap blocked jobs +PAGEW number of jobs waiting for pages +RCORE number of pages belonging to runnable jobs +UCORE total number of pages in the system. +FCORE number of user pages there is room for + in real core at one time. + +In addition, if ITS is being debugged, the system who-line +will mention that fact. + + + 2. USER CONTROL OF WHO-LINES. + +Currently, who-line control uses the [ESC]W command, interpreted +directly by the PDP11. When a command is given, it is not really +processed until the next time the who-lines are updated. The +issuing of a command triggers such updating immediately, even +if the normal time for updating has not arrived, but there may +be a delay nevertheless. In that case, a second command given +before the updating is done will overwrite the first. + + The options are: + +[ESC]W turns off the who-line. +[ESC]1W selects the user who-line, migrating with the + ownership of the tty. That is, each time the + who-line is updated, it will describe whichever + job has the tty at that moment. + This is the default status. +[ESC]2W freezes the who-line on whatever job was last + shown. If you are about to ^Z - ^P a job but + wish the who-line to continue to show that job + instead of following the tty to its superior, + this is the thing to do. The who-line remains + frozen until the next time it is explicitly + changed. If the job selected disappears, strange + things may be displayed. +[ESC]3W moves the who-line to a different job with + the same uname as the one previously shown. + Repeated use of this command will cycle through + all the jobs with your uname. The who-line is + left frozen on whichever job is reached. +[ESC]4W moves similarly but in the other direction. That + is, it will move back to the job that [ESC]3W + left. +[ESC]5W selects the system who-line. + +[ESC]U selects the user wholine, for job number . + The job need not be part of your tree. + + + 3. PROGRAM CONTROL OF WHO-LINES. + + a. The Variables. + +Two variables, WHMODE and WHJOB, contain the information +about which mode of who-line display is selected. +WHMODE is interpreted as follows: + +-1 no who-line display. +0 user who-line, migrating with tty. +1 user who-line, frozen on a particular job + whose job number is in WHJOB. +4 system who-line. + +(2 and 3 are transitory states that occur while [ESC]3W or +[ESC]4W is waiting to be processed. [ESC]W actually works +by putting its argument plus 1 into WHMODE). + + b. System Calls. + +The WHOLIN symbolic system call is used for reading and +writing the two variables WHMODE and WHJOB. Its first +argument specifies the tty to be used. The second and third +arguments are optional; if present, they will be used to set +WHMODE and WHJOB. In any case, two values are available: +the previous values of WHMODE and WHJOB. +If only one argument is given, the tty may be specified by +number, since it is not being modified. If two or three args +are given, the tty must be specified by a channel. +If the tty specified is not a TV, the call will fail with a +"wrong type device" error. + +For example, to put the old values in FOO and FOO1, and +freeze the who-line on the job whose number is in BAR1: + + .CALL [ SETZ + 'WHOLIN + 1000,,TYIC ;IMMEDIATE TTY CHANNEL ARGUMENT. + 1000,,1 ;NEW WHMODE = FREEZE ON JOB. + BAR1 ;JOB TO LOOK AT. + 2000,,FOO ;STORE OLD WHMODE. + 402000,,FOO1] ;STORE OLD WHJOB. + .VALUE + ... + + c. Use of the TCTYP Program. + +The TCTYP program when asked to describe a tty fully, or when +a tty's WHMODE is not -1, will print out "WHOLINE=" followed by +one plus the value of WHMODE (in other words, the argument to +[ESC]W needed to put the tty in the state it is in). The command +"WHOLINE" is also available; it takes an argument and acts like +[ESC]W, except that 1) it may be put in init files and valret +strings, while [ESC]W cannot, and 2) giving the WHOLINE command +an argument of 3 or 4 does not produce useful results. + +Thus, if you like having a who-line, +:TCTYP WHOLINE 1 +in your init file will give you one automatically. + + +B. FEATURES FOR PROCESSING WHAT IS ON A TV SCREEN. + +What is sent to an ordinary terminal is unknowable to the +system unless specially remembered. That is not true +of TV terminals. Some standard facilities for processing +the contents of TV screens appear below. Of course, any +program may examine TV screens simply by mapping their +pages. + + 1. THE HARD COPY PRINTER. + +There exists a device for making a printed reproduction of +whatever appears on a TV screen. To use it, type [ESC]Q, +which causes one copy to be made immediately. If the device +is in use, the screen will flash and no action will be taken. +The process lasts 16 seconds; nothing prevents the screen from +changing during that period, and if such a thing happens the +results will be interesting. When the copy is finished, the +screen will flash. Thus [ESC]Q always flashes the screen, +but faster if you're losing. If an infix argument is given as +for [ESC]S (see below), then the specified video input is copied. +This command can be used even on non-logged-in keyboards. + + 2. RECORDINGS. + +The system program RECORD will make an ascii file out of +whatever is on the TV screen. To use it, just type +RECORD^K at DDT. The file is called RECORD > +and goes on your default directory (the MSNAME). + +Other more sophisticated programs for handling TV bit maps +may be found documented in AI:.INFO.;TVXGP INFO. + + 3. SPYING. + +When using a TV terminal, it is possible to spy on any other +TV terminal. This operates by routing a different video memory +through the video switch to your screen. Doing this does not +affect your programs in any way - their output continues to +be placed in your own video buffer and will be visible when +you stop spying. Also, spying does not affect the handling +of input in any way. +These commands can be used even on free keyboards. +[ESC]S on free keyboards, and [ESC]F on keyboards that are in use, +will time out after 40 seconds and an automatic [ESC]S will be done +to make the screen show its default picture once again. +Any character typed will make that happen prematurely. + +The commands are: + +[ESC]S begins spying. The number should be the number + of the terminal to spy on; thus, [ESC]64S spies + on TTY T64. If the specified tty is not in use, + the command is a no-op. + may also be 200 plus the number of a video buffer. + This makes it possible to spy on a screen that nobody + is currently using. + may also be a video switch input number, + for those of you who are hardware hackers. + +[ESC]S stops spying. You are again viewing your own + video buffer. + +[ESC]F spies on the video buffer used for logged-out consoles + (this is the one with the useful information from + the NAME dragon). + +C. OTHER TV FEATURES. + + 1. COMPLEMENTING THE SCREEN. + +The last PDP-10 word of every display memory is used to hold +various information on how the contents of the memory should +be modified on their way to the screen. The 200000 bit of the +word controls complementation of the screen; if the bit is +on the screen appears black on white. This bit may be complemented +by the user with the command [ESC]C. Programs may, of course, +change the bit easily by accessing the display pages. + + 2. CLEARING THE SCREEN COMPLETELY. + +[ESC]L is guaranteed to clear every bit of the display memory, +and also reset the scroll-register (don't worry if you don't +understand that). ^L usually does a good enough job, so this +command is hardly ever necessary. If ^L doesn't clear the +screen (because a program has turned it off), ^_L will clear it. + + 3. THE REPEAT KEY. + +[ESC]R is the "repeat key"; it causes the previous input +character to be sent to the PDP-10 8 times a second, forever, +or until a character is typed on the keyboard (escape commands +not included). The character that stops the repeat will be +ignored as input, unless it is CALL. + +[ESC]R, where is an OCTAL number, will repeat the +previous input character times (or until stopped by +the typing of a character). can't be more that 177 (octal). + + 4. \ No newline at end of file diff --git a/sysdoc/ufd.100 b/sysdoc/ufd.100 new file mode 100644 index 0000000..9228eb6 --- /dev/null +++ b/sysdoc/ufd.100 @@ -0,0 +1,165 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Disk file directories are each one disk block +of data (2000 words). The file directory contains +all the data necessary to maintain the actual files on the disk. +The directory is arranged in two main portions. The name area +contains identification data for every file said +to be "in that directory", including the file's names, time of +creation, and a pointer to the descriptor area. The descriptor +area portion of a file directory describes exactly where on the disk +the files are. + +The file SYSTEM; FSDEFS > contains a page beginning +";UFD INFO", UFD meaning "user file directory". +This page contains the assignment of most of the important +symbols which define the directory format parameters. The following +description assumes the values of the parameters when this +document was written, and although most of the parameters are not +apt to change, there is this possibility. + +The first word of the file directory contains a pointer to the beginning +of the descriptor area, and the second word points to the beginning +of the name area. The third word of the directory contains the sixbit +user name of the directory. + +The name area of the directory contains 5 words +of information for every file. + +1 - FN1 (SIXBIT) +2 - FN2 (SIXBIT) +3 - STATUS BITS & RANDOM INFO +4 - CREATION DATE +5 - DATE LAST REFERENCED + +The fourth word contains the compacted date and time of +creation for the file. The right half of this word is the +time of day since midnight in half-seconds. Bits 3.1-3.5 +are the day, bits 3.6-3.9 are the month, and bits 4.1-4.7 +are the year. The fifth word's left half holds the date the +file was last referenced. This is in the same format as the +creation date. + + 4.9-4.8 - UNUSED + 4.7-4.1 - YEAR (RELATIVE TO 1900) + 3.9-3.6 - MONTH (1=JAN) + 3.5-3.1 - DAY (1-31) + 2.9-1.1 - (RH) # HALF-SECS SINCE LAST MIDNIGHT (4th wd only) + +The third word in the name area for every file contains all +the information about the file's status, with bits +indicating things such as whether the file has been deleted, +whether it is open for writing, etc. + + 4.9 - FILE DUMPED TO TAPE + 4.8 - UNUSED + 4.7-3.7 - # WORDS IN LAST BLOCK OF FILE + 3.6 - FILE DELETED FROM UNMOUNTED PACK + 3.5 - FILE WILL DISAPPEAR WHEN CLOSED BY ALL WHO HAVE IT OPEN + 3.4 - UNUSED + 3.3 - OPEN FOR WRITING + 3.2 - UNUSED + 3.1 - THIS FILE IS LINK + 2.9-2.5 - PACK # FILE STORED ON + 2.4-1.1 - BYTE ADDR PTR TO START OF FILE'S DESCRIPTOR BYTES + +2.4-1.1 is actually a byte address relative to a point 11. +words from the beginning of the directory. The byte size is +6 characters, so the word address is the pointer divided by +6, and the byte within that word can easily be determined by +the remainder of the division. Once the correct byte +pointer is determined, successive ILDBs will get the +descriptor bytes of the file. Assuming the contents of A +points to the third word of the name block for a file, here +is a piece of code which will generate the correct byte +pointer in N, all set for ILDBing, with N indexing B, which +holds the correct word address: +;B=2 +;C=3 +;UFDBYT==6 ;SIZE OF BYTES +;UFDBPW==36./UFDBYT ;NUMBER OF BYTES PER WORD +;FDIRBF IS FIRST LOCATION IN DIRECTORY, UDDESC IS 11.. + + LDB B,[1500,,A] ;GET BYTE ADDRESS + IDIVI B,UFDBPW ;CHANGE TO WORD ADDRESS + ADDI B,FDIRBF+UDDESC + MOVNI N,-UFDBPW(C) + IMULI N,UFDBYT ;Only works because UFDBYT divides 36. + HRLI N,060200 ;ASSUMING B=2 !!!! + ROT N,30. +;END OF ROUTINE + +If the file is a link, the descriptor bytes themselves specify +what directory and file names this file is linked to. These +three args are the only pieces of information in the descriptor +area for links. Each name is terminated by a semicolon unless +it is a full six characters long. Colon quotes the character +that follows it. + +For normal disk files, every descriptor byte tells where the +next block, or group of blocks, of the file resides on the +disk. A byte with a value of 0 ends the description. A byte +with the value 31. (UDWPH) is an ignored place-holder. If +the byte is from 1 through 12. (UDTKMX), that many blocks +of the file reside contiguously. If the byte is from 13. +through 30., skip that many blocks minus 12., and the next +block, after the ones skipped, is in the file. If the 40 +bit of the byte is set, the low 4 bits of that byte together +with the next 2 bytes tell where the next block of the file +is to be found. When the 40 bit is set, the 20 bit is a +flag which, if on, says that blocks that follow each contain +a word count in their last word. + +Occasionally when a program tries to open a file for +writing, there is no more room in the file directory for the +file's specifications, not because there is really no room, +but because non-existant (deleted) files still have +descriptors etc. taking up unnecessary room. When this +happens, the system rearranges the directory, a +"housekeeping" chore known as garbage collecting. Garbage +collecting a file directory takes about 1-2 minutes of +realtime waiting, usually. If the system is provoked to +garbage collect FOO's file directory, it announces the +occasion on the system job console with the message "GC OF +USER DIR FOO". During the ordeal, the job provoking the +collection may not be control-Zed amongst other things. If +you try to control-Z it, however, the only noticeable +difference to you will be a long wait before DDT knows to +recognize your request for interruption. If ^Z seems not to +be "doing much", try checking the system job console to see +if you are being garbage collected. + +File directories are read by timesharing programs the way +any disk files are read. Merely use the file name .FILE. +(DIR) for the .OPEN, and the system will supply you with the +directory instead of a file. If the mode is ASCII, the data +you receive after .OPENing .FILE. (DIR) is the ASCII string +you normally see, upon doing :LISTF DSK: or DSK in DDT or +EYDSK: in TECO. If the mode for the .OPEN is image, the +data you receive is the actual file directory as advertised, +and as stored on the disk. As already mentioned, it is +exactly 2000 octal words long, and is organized exactly as +described above. Any program opening disk file directories +for the purpose of seeing what files are on the directory +will be far more efficient opening the directory in image as +opposed to ASCII mode. Such programs, when written in MIDAS +assembly language, should .INSRT SYSTEM; FSDEFS > and use +the symbolic definitions therein, for greater clarity and +immunity to system changes. + + \ No newline at end of file diff --git a/sysdoc/usets.116 b/sysdoc/usets.116 new file mode 100644 index 0000000..6b0dacf --- /dev/null +++ b/sysdoc/usets.116 @@ -0,0 +1,1410 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS USETS: + +This file attempts to maintain up-to-date documentation on +all user variables hacked by .USET/.SUSET. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the .FOO user var ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- +Each job running under ITS has a large number of variables +associated with it maintained by the system. In order to +examine and set these variables, the .USET and .SUSET +uuo's are provided. The .USET uuo allows the specification +of the job whose variables are to be accessed. The .SUSET +uuo always accesses the variables of the job which executes it +(SUSET = Self USET). + +The .USET uuo is used like this: .USET CHNL,SPEC +and the .SUSET uuo like this: .SUSET SPEC +The ac field CHNL of the USET must be the number of +an input/output channel for which a job is open, +as either the USR, JOB, or BOJ device. +The .USET may modify the variables only +if it has modification rights to the job (the job +is a JOB device, or is a direct inferior). + +The contents of the effective address SPEC are of this form: + 4.9 0 = read variable, 1 = set variable. + 4.8 Block mode (see below). + 4.7-3.1 Number of user variable to access. + 2.9-2.1 Address of a location within the caller which + is to receive the value of the variable, or which + contains the new value for the variable. +If bit 4.8 is 1, then the word at location SPEC is really +an AOBJN pointer to a block of specifications. This is +useful for getting several variables at a time easily. +The AOBJN pointer is updated as the operation progresses, +and so must be in a writable area. Block mode may not be nested. +If an illegal specification is given to .USET or .SUSET, +the job will receive an illegal operation word 1 interrupt +(bit 1.6 of the .PIRQC user variable). + +The variables are described in this document by the names which +DDT knows for them; the first character of each name is a ".". +If you open up a location by using one of these names, DDT +treats it specially and actually accesses the corresponding +variable and not a location in the job's core. + +When writing .USET's and .SUSET's in MIDAS code, +one may use the symbols defined by MIDAS for accessing them. +These are the same as the names known to DDT, except that +the "." is followed by "R" for reading or "S" for setting. + +If you open a location containing a SPEC, try typing +.R$?? if it is positive, or .S$?? if it is negative; this will +use bit typeout mode to print out the spec as it might have been +assembled; for example, 400001,,500 .S$?? gives .SVAL,,500 . + +Examples: + +To read your own runtime in 4-microsecond ticks into FOO: + + .SUSET [.RRUNT,,FOO] + +To set your word 1 interrupt mask: + + .SUSET [.SMASK,,[%PIDWN\%PIPDL]] + ;enable "pdl overflow" and "sys going down" interrupts + +To read your input/output status word for channel 13 into FOO: + + .SUSET [.RIOS+13,,FOO] + +To start a job (your immediate inferior!) open on channel + USRC at its location QUUX, with its option + bits indicating your readiness to supply JCL: + + .USET USRC,[.SOPTION,,[%OPCMD,,]] + .USET USRC,[.SUPC,,[QUUX]] + .USET USRC,[.SUSTP,,[0]] + +Another way to do the same thing is: + + MOVE AC,[-3,,USBLOK] + .USET USRC,AC + . . . +USBLOK: .SOPTION,,[%OPCMD,,] + .SUPC,,[QUUX] + .SUSTP,,[0] + +FORM OF DESCRIPTIONS: + +The descriptions of the various variables accessible by +.USET and .SUSET are in the following form: + + + + + +The descriptor contains four characters "wx yz". +The first two ("wx") refer to the access for .USET; +the last two ("yz") to the access for .SUSET. +In each case these characters are chosen from these sets: + -- May neither read nor set. + +- May read but not set. + +* May read and set. + +? May read, may sometimes set (please read on...) +That is, + means may read, * may set, - denies access, +while ? says that things are more complicated. + +.40ADDR +* +* "40" address + + The right half: + + Initially 40 octal. Whenever the system + references locations "40" through "44" specifically, + (e.g. giving the user interrupts, or returning uuo's 50-77), + the system really references the 5-word block that + .40ADDR points to. Thus, if .40ADDR is set to 500, the + system expects location 502 to contain the address of + the interrupt routine. This is especially useful to + distinguish system-returned uuo's (0 and 50-77) from + standard user-mode uuo's (1-37); the latter always + trap through location 40, while the former trap + through .40ADDR. + The various words accessed through .40ADDR are + as follows (indexed by "normal" location #): + 40 System places a uuo here when it wants + to give it to the user. + 41 Should contain the address of the uuo handler. + If .40ADDR is not indeed 40, this + may be a different uuo handler from the + one which handles uuo's 1-37. + If .40ADDR is actually 40, then unless + 41's index and indirect fileds are 0 and its + opcode is either 0 or JSR, all system-returned + UUOs will cause ILOPR interrupts instead. + This is to protect programs that want their + hardware user-UUOs to be handled by a PUSHJ + from being clobbered when they accidentally + execute a meaningless UUO. + 42 If the job's %OPINT bit in its + .OPTION variable (q.v.) is 0, then + this is a JSR to the user's old-style + interrupt handler. The three words addressed + by the JSR are, in order, the word in + which the interrupt bits are placed, the + return address for the interrupt, and the + first instruction of the handler. + If the %OPINT bit is 1, then this + is an AOBJN pointer to a vector of + 5-word blocks describing the various + interrupt handlers and their priorities. + See ITS INTRUP for details. + 43 If the job's %OPLOK bit is set in + its .OPTION variable, then this is + the pointer to the list of switches + to be reset if the job is killed. + 44 If the job's %OPLOK bit is set, + this is an AOBJN pointer to a block + of critical code region descriptors. + See ITS LOCKS for details. + + The left half: + + Initially 20 octal. This is the address of a block of + 20 octal words which a job's superior may use to hack + that job. For compatibility, if LH(.40ADDR) is zero, + the default of 20 will be assumed. + +.ADF1 +* +* ANDCAM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs ANDCAM into .DF1 when writing. + + +.ADF2 +* +* ANDCAM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs ANDCAM into .DF2 when writing. + + +.AIFPIR +* +* ANDCAM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs ANDCAM into .IFPIR when writing. + + +.AMASK +* +* ANDCAM into .MASK + + Like .MASK (q.v.) when reading. + Performs ANDCAM into .MASK when writing. + + +.AMSK2 +* +* ANDCAM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs ANDCAM into .MSK2 when writing. + + +.APIRQC +* +* ANDCAM into .PIRQ + + Like .PIRQC (q.v.) when reading. + Performs ANDCAM into .PIRQC when writing. + +.APRC +- +- APR CONO + + 4.9 Procedure is in a disowned tree. + 4.7 (BUMRTL) Tree will be gunned if hasn't run for an hour + (meaningful only in top level job). Cleared by reowning or + attaching. See the DETACH and DISOWN system calls. + 4.6 Core request pending for this job. + 4.5 User disabled, waiting to be flushed by SYS job. + The SYS job will delete the job tree eventually. + 4.4-4.1 .BCHN user variable (q.v.). + 3.9 In process of deleting or logging out this job. + Bit 4.5 will probably be set eventually. + 3.5-3.1 Must be zero. + 2.9-1.1 CONO'ed to APR whenever job is about + to be run. Initially 447. Modified by + altering the .MASK user variable. + + +.BCHN +* +* bad channel number + + Initially 0. + Number of channel most recently in error. + Typically after reading this variable one does a + .STATUS or a STATUS symbolic system call + to get the status word for the channel. This word + can then be fed to the ERR device. + .BCHN is actually part of the .APRC variable. + See also the .IOS variable. + + +.CNSL +- +- console tty number + + If the job is in a console-controlled tree, this + variable contains the console's number, even if + the job doesn't own the console. If the job is + in a non-console-controlled tree, .CNSL is -1 + if the job is scheduled as part of the system, + -2 if the job is scheduled as a disowned job; + for a job-device-handler job, .CNSL is the same + as it is for the job it is serving. + + +.DF1 +* +* defer bits, word 1 + + Initially 0. + Defer bits for word 1 interrupts (see .PIRQC + and .MASK). If an interrupt bit is set in both + .PIRQC and .MASK, but is also set in .DF1, + it is temporarily deferred. + + +.DF2 +* +* defer bits, word 2 + + Initially 0. + Defer bits for word 2 interrupts (see .IFPIR + and .MSK2). If an interrupt bit is set in both + .IFPIR and .MSK2, but is also set in .DF2, + it is temporarily deferred. + +.EBO1 +- +- KL-10 Ebox counter + + This is the low-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + Its location is .EBOX+1, for convenience. + + +.EBOX +- +- KL-10 Ebox counter + + This is the high-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + + +.FLS +- -- flush instruction + + Initially 0. + The instruction which is blocking the running of + the job. Zero if user not blocked (user can run + if .USTP is also zero). + (The scheduler tests a job for runnability by first + checking the .USTP variable, and if it is zero, + then executing the flush instruction. The job is + runnable iff the flush instruction skips.) + + +.FTL1 +- +- Fatal interrupt first word + + After a fatal interrupt, this variable contains the + .PIRQC bits which caused the error. At any other time + it contains garbage. + +.FTL2 +- +- Fatal interrupt second word + + After a fatal interrupt, this variable contains the + .IFPIR bits which caused the error. At any other time + it contains garbage. + + +.HSNAME +* +* Home System Name + + This is a word of sixbit like .SNAME (q.v.). It + is initialized to be the same as the UNAME on creation + of a not-logged-in tree, and when a job is created + as an inferior or as a job device, it's .HSNAME is + copied from that of it's creator. The LOGIN system call + sets it to be the same as the UNAME, although this should + be changed to be the XUNAME. + + This is not used by ITS for anything, but is intended to + associate a directory with a specific XUNAME for the sake + of init and mail files of people without a directory of + the same name as their XUNAME. DDT will soon initialize + it by looking up information in the INQUIR database for + the particular user. + +.IDF1 +* +* IORM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs IORM into .DF1 when writing. + +.IDF2 +* +* IORM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs IORM into .DF2 when writing. + + +.IFPIR +* +* inferior procedure and i/o requests (?) + + Initially 0. + This variable contains bits for pending word 2 interrupts. + + Bit 3.n is the interrupt bit for the n'th job directly + inferior to the specified job (see the .INTB user variable). + These therefore occupy bits 3.8-3.1. + An inferior interrupt bit is set if an a class 1 + or untrapped class 2 interrupt occurs in the inferior, + or if the inferior is using new-style interrupts + (see ITS INTRUP, and the %OPINT bit of the .OPTION + user variable) and any unhandled interrupt occurs. + Performing a .UCLOSE on an inferior clears the + inferior interrupt bit in the .IFPIR variable + of the job performing the .UCLOSE. + + Bit 1.n is the interrupt bit for input/output + channel n-1 (actually, these occupy bits 2.7-1.1). + Thus bit 1.1 = channel 0, 1.2 = channel 1, + 1.3 = channel 2, . . ., bit 2.7 = channel 17. + When an input/output interrupt is detected, the + system call WHYINT shoud be used to discover the + cause (see ITS .CALLS). + + The following devices can cause channel interrupts: + + TTY Input: A character was typed which according + to the job's TTYST1 and TTYST2 variables + (see ITS TTY) should be treated as an interrupt + character. If the tty is opened for input + on more than one channel, only one channel, + if any, receives the interrupt. + Output: The **MORE** condition has occurred. + See ITS TTY. + STY Input: Input is pending (i.e. the corresponding TTY + has attempted output). If the STY is open + for input on more than one channel, only + one channel, if any, receives the interrupt. + See ITS TTY. + Output: The STY's alter ego is waiting for input, + or at least was (it isn't guaranteed not to + stop waiting and do something else). + STK Input is available. Interrupts occur on all enabled channels. + USR A foreign job open on the channel has been killed. + If the job went away while the channel was pushed + on the I/O pdl, this interrupt will occur when the + channel is popped. See the .UCLOSE, .IOPUSH, and + .IOPOP uuo's. + If the job is the PDP-6, the PDP-6 has requested an interrupt. + JOB Various conditions, some programmable. See ITS JOB. + BOJ Various conditions, some programmable. See ITS JOB. + NET One of the following conditions has occurred: + The IMP has gone down. + RFC received. + After RFC sent, the connection is now open. + Input available. + Connection closed. + Net interrupt received (INR or INS). + MSP Message has been sent. + +.IIFPIR +* +* IORM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs IORM into .IFPIR when writing. + + +.IMASK +* +* IORM into .MASK + + Like .MASK (q.v.) when reading. + Performs IORM into .MASK when writing. + + +.IMSK2 +* +* IORM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs IORM into .MSK2 when writing. + + +.INTB +- +- interrupt bit + + Gets the interrupt bit for the procedure. This is + the word 2 interrupt bit which the procedure's + superior will see when the procedure interrupts + its superior. This variable will therefore have + exactly one of bits 3.1-3.8 set, and no others. + If the procedure is top level (has no superior), + then this variable is negative. + + +.IOC + +- +- input/output channel + + The variable .IOC+ is the input/output channel + word for channel , for n between 0 and 17 octal. + Normally zero for a closed channel. + + +.IOP + +- +- input/output pdl + + The input/output pdl is a pdl of two-word entries + used by the .IOPUSH, .IOPOP, and .IOPDL uuo's. + The first word of each pair is the .IOC word for + the stacked channel, and the second is the .IOS word. + In addition, bits 4.9-4.6 of the .IOS word of each + pair contain the channel number which the channel was + pushed from (this is used by the .IOPDL uuo). + The pdl has eight entries; thus should be between + 0 and 17 (0 is the .IOC word for the least recently + pushed entry, etc.). + +.IOS + +- +- input/output status + + The variable .IOS+ is the input/output status + word for channel , for between 0 and 17 octal. + Normally zero for a closed channel. + This word contains various bits describing the status + of the channel. The left half is a set of error + codes if non-zero; the .IOS word can be given to + the ERR device to obtain an ascii message for + the error. The right half contains various bits + describing the state of the device. (Internally to + ITS, the right half contains an access pointer; + the right half bits supplied for .IOS are the + same as those generated by the .STATUS uuo or + the STATUS symbolic system call.) + + The various bits in the .IOS word are as follows: + 4.9-4.6 Always zero (see the .IOP variable). + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an IDS interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + Set primarily by failing .OPEN's and + .FDELE's. These are the same as the error + codes returned by failing .CALL's (see + table below). + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code + (see table below). + + The error messages indicated by bits 4.5-4.1 are: + 1 DEVICE HUNG OR REPORTING NON-DATA ERROR + 2 END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (or directory full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + + The error messages indicated by bits 3.9-3.7 are: + 1 IDS ILLEGAL SCOPE MODE + 2 IDS SCOPE HUNG + 3 MORE THAN 1K SCOPE BUFFER + 4 IDS MEM PROTECT + 5 IDS ILLEGAL SCOPE OP + 6 IDS MEM PROTECT ON PDL PNTR + 7 IDS ILLEGAL PARAMETER SET + + The error messages indicated by bits 3.6-3.1 are: + 1 NO SUCH DEVICE + 2 WRONG DIRECTION + 3 TOO MANY TRANSLATIONS + 4 FILE NOT FOUND + 5 DIRECTORY FULL + 6 DEVICE FULL + 7 DEVICE NOT READY + 10 DEVICE NOT AVAILABLE + 11 ILLEGAL FILE NAME + 12 MODE NOT AVAILABLE + 13 FILE ALREADY EXISTS + 14 BAD CHANNEL NUMBER + 15 TOO MANY ARGUMENTS (CALL) + 16 PACK NOT MOUNTED + 17 DIRECTORY NOT AVAIL + 20 NON-EXISTENT DIRECTORY NAME + 21 LOCAL DEVICE ONLY + 22 SELF-CONTRADICTORY OPEN + 23 FILE LOCKED + 24 M.F.D. FULL + 25 DEVICE NOT ASSIGNABLE TO THIS PROCESSOR + 26 DEVICE WRITE-LOCKED + 27 LINK DEPTH EXCEEDED + 30 TOO FEW ARGUMENTS (CALL) + 31 CAN'T MODIFY JOB + 32 CAN'T GET THAT ACCESS TO PAGE + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + 36 VALID CLEAR OR STORED SET + 37 NO CORE AVAILABLE + 40 NOT TOP LEVEL + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + 42 JOB GONE OR GOING AWAY + 43 ILLEGAL SYSTEM CALL NAME + 44 CHANNEL NOT OPEN + 45 INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + 46 UNRECOGNIZABLE FILE (LOAD) + 47 LINK TO NON-EXISTENT FILE + + The physical device codes from bits 1.6-1.1 are as + follows. Note that, as a half-hearted rule, bit 1.6 + indicates that file names are significant, and bit 1.5 + indicates a software-implemented device. + This list is subject to additions and deletions! + CODE SYMBOL DEVICE DESCRIPTION + 0 TTY Console input. + 1 SNTTY TTY Printing console output. + 2 SNTDS TTY Display console output. + 3 SNLPD LPT Data Products line printer. + 4 SNVID VID Vidisector ??? + 5 SNBAT Vidisector ??? + 6 SNPLT PLT Calcomp plotter. + 7 SNPTP PTP Paper tape punch. + 10 SNIMPX IMX Input multiplexor. + 11 SNOMPX OMX Output multiplexor. + 12 SNPTR PTR Paper tape reader. + 13 SN340 DIS DEC 340 display, Ascii output. + 14 SN340I IDS Interpreted 340 display. ??? + 15 SNMTC MTn Magnetic tape. + 16 SNCOD COD Morse code device. + 17 SNTAB TAB Tablet. ??? + 21 SNNUL NUL Source of zeroes, or output sink. + 22 SNJOB JOB Job device. + 23 SNBOJ BOJ Inverse of JOB. + 24 SNSPY SPY Spy on another console. + 25 SNSTY STY Pseudo-teletype. + 26 SNNET NET ARPA network. + 27 SNLPV LPT Vogue line printer (yech!) + 30 SNSTK STK Stanford keyboard. + 31 SNMSP MSP Interprocess message protocol. + 41 SNUTC UTn Microtape (DECtape). + 43 SN2311 DSK 2311 disk drives or equivalent. + 60 SNFUSR USR A foreign (not immediately inferior) procedure. + 61 SNUSR USR An immediately inferior procedure. + 62 SNCLK CLx Various core link devices (x  {AIOU}) + 63 SNDIR --- File directory or ERR device. + 64 SNPDP USR The PDP-6. + +.IPIRQC +* +* IORM into .PIRQC + + Like .PIRQC (q.v.) when reading. + Performs IORM into .PIRQC when writing. + + +.JNAME +* +? job name + + The name of the job as a word of sixbit characters. + The uname-jname pair must be unique to a job + (there are some exceptions involving system-created + jobs or jobs not logged in). + The uname and jname are used as file names when + creating or subsequently opening the job on the USR + device. See also the .UNAME user variable. + The .JNAME variable may be set by a .SUSET only in a + top-level job, and then only if the job has no + inferiors. + Attempting to set a jname to zero causes an + illegal operation interrupt (bit 1.6 of the .PIRQC + user variable). So does attempting to set it such that + the uname-jname pair would no longer be unique. + So does attempting to illegally set one's own jname. + + +.JPC +* +* jump program counter + + The PC as of the most recent jump instruction, + i.e. an instruction which changed the PC by other + than 1 or 2. This is actually a register in the + paging box when running. + + +.MARA +* +* MAR (memory address register) address + + Initially 0. + The address for the MAR register in the paging box, + which gives a %PIMAR interrupt when the specified operation + is performed on the specified address. + 3.3 0 = exec mode, 1 = user mode. + This is forced to 1 when set with + .SUSET or .USET; exec mode is for very + obscure system hacks only. + 3.2-3.1 0 Never interrupt. + 1 Interrupt on instruction fetch. + 2 Interrupt on write. + 3 Interrupt on any reference. + 2.9-2.1 Address for MAR. + The MAR does not work well on accumulators. + See also the .PIRQC user variable, bit %PIMAR; + and ITS INTRUP and ITS USR. + +.MARPC +* +* MAR program counter + + The PC as of the instruction that most recently + tripped the MAR interrupt, if any. In addition, + the indirect bit will be set if that instruction + completed successfully (was not aborted by the MAR + hit). See the .MARA user variable. + + +.MASK +* +* word 1 interrupt mask + + Initially 0. + This is a mask for word 1 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 1 interrupt tries to + occur, but the corresponding bit in .MASK is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MASK directly + correspond to those in .PIRQC (q.v.). Bits for class + 1 interrupts are AND'ed out before setting the .MASK + variable. + + +.MBO1 +- +- KL-10 Mbox counter + + This is the low-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + Its location is .MBOX+1, for convenience. + + +.MBOX +- +- KL-10 Mbox counter + + This is the high-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + + +.MEMT +* +* memory top + + This variable contains 1 plus the highest legal + address in the job (the accessible word with the + largest address). Setting this variables is like + performing an equivalent .CORE uuo (q.v.): + .SUSET [.SMEMT,,[FOO]] + is like doing: + .CORE _12 + + +.MPVA +- +- memory protect violation address + + The address which the last instruction to cause a + memory protection violation (or a write into read only + memory violation) attempted to reference, + on KA-10's rounded down to a page boundary. + Thus an attempt to reference the non-existent + location 317435 would cause .MPVA to be set to + 316000 octal on a KA-10, or 317435 on a KL-10. + See also the .PIRQC variable. + On the KS-10, .MPVA holds the non-existant IO register address + after a %PINXI. + +.MSK2 +* +* word 2 interrupt mask + + Initially 0. + This is a mask for word 2 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 2 interrupt tries to + occur, but the corresponding bit in .MSK2 is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MSK2 directly + correspond to those in .IFPIR (q.v.). + + +.OPC +- +- old program counter + + The PC just before the last instruction was executed. + This corresponds to a register in the paging box. + It doesn't exist on KL-10's. + +.OPTION +* +* option bits + + Initially 0. + The bits in this word correspond to various options + as follows: + 4.9 %OPTRP Same as the .UTRP user variable. See ITS UUO. + 4.8 %OPDET ** This bit is OBSOLETE and NO LONGER EXISTS ** + It is documented for historical purposes only. + Nowadays, fatal interrupts always cause top-level + jobs to be detached. Once upon a time, top-level + jobs with consoles would be reloaded instead of + detached, unless they had set %OPDET=1. + See the DETACH and RELOAD symbolic system calls. + 4.7 %OPDEC Uuo's 40, 41, and 47 (that is, + .IOT, .OPEN, and .ACCESS) + should trap to the user as uuos + via the .40ADDR user variable (q.v.). + This is useful for programs which wish to + interpret DEC TOPS-10 UUO's, since those are the + only ones which conflict with ITS UUOs. + Luckily, those ITS UUOs are not essential since + there are symbolic system calls to do the same things. + 4.6 %OPCMD Superior claims it has JCL which + it will cheerfully supply in response to + the appropriate .BREAK 12, command. + 4.5 %OPBRK Superior claims to handle all .BREAK's. + 4.4 %OPDDT Superior claims to be DDT. + 4.3 %OPINT Job desires new-style (vectored + and stacked) interrupts. See also the + .40ADDR variable. See ITS INTRUP for + information on old- and new-style + interrupts. + 4.2 %OPOJB Other jobs may open this job + as the OJB device, thereby turning it + into a JOB device. See ITS JOB. + 4.1 %OPLOK Job desires the switch locking + and unlocking synchronization feature. + See also the .40ADDR variable. + See ITS LOCKS for information on locks. + 3.9 %OPLIV The job tree of which this is the + top-level job is permitted to survive a + system shutdown -- it should take care + of logging itself out. See the .SHUTDN uuo. + Meaningful only for top-level jobs. + Primarily useful for system demons which need to + survive system death (e.g. the statistics + demon PFTHMG DRAGON). + 3.8 %OPOPC Job desires that instruction-aborting interrupts + such as MPV leave the PC pointing before the + instruction that lost, instead of the old + convention of leaving it pointing after. + The new convention is far better and all new + programs should use it. + 3.7 %OPLSP Superior claims to be MacLisp. + 3.6 %OPLKF Unlock locks on fatal interrupt. When a + non-disowned top-level job receives a fatal + interrupt, if it has set this bit, its locks will + be unlocked by the system job as part of the + process of detaching it. See the %OPLOK bit and + ITS LOCKS. + +.PAGAHEAD +* +* page-ahead control + + Normally zero, this word is set nonzero to enable + sequential paging through a part of the address space + specified by .PAGRANGE. The right half of .PAGAHEAD is + the page-ahead interval width and the left half is the page-behind + distance. Each time a page in the designated range is + touched for the first time, the next few pages, forming the + page-ahead interval begin to swap in, and a page a certain + distance behind (specified by the page-behind distance) is + swapped out or marked for swap out in the near future. The + precise treatment depends on how loaded the system is. + + Exactly one of the page-ahead interval width and the + page-behind distance should be negative. The page-behind + distance should be negative, if memory is being used from low + addresses to high ones. The page-ahead width should be + negative if moving from high addresses to low ones. + + Example: -2,,4 means on first reference to page n, start + reading in pages n+1 through n+4 and possibly swap out page n-2. + Page n-1 is not affected until page n+1 is touched. A + page-behind distance of 2 means that two consecutive pages are + always available. + +.PAGRANGE +* +* page-ahead range + + Normally zero, this word is made nonzero together with .PAGAHEAD + to enable the sequential paging feature. The two halves of + .PAGRANGE are page numbers which specify the region of the + address space in which sequential paging should go on. + The left half specifies the first page in the sequentially + paged region, and the right half specifies the first page + after the end of that region. + +.PICLR +* +* priority interrupt clear + + Initially -1. + If non-zero, the job may take interrupts. If zero, + interupts are deferred. This variable is cleared + when an old-style interrupt occurs (but not by new-style + interupts!), and is set to -1 by the .DISMISS uuo + and the DISMIS symbolic system call. Attempts + to set this variable will convert the value to -1 or 0 + depending on bit 4.9. + + +.PIRQC +* +* priority interrupt request cruft (?) + + This word contains bits for pending word 1 interrupts. + Setting bits in this causes the corresponding interrupts + to attempt to take place, subject to .MASK, .DF1, + .PICLR (q.v.), and the %OPINT bit of the .OPTION user + variable (see ITS INTRUP). + + Interrupts are of three classes: + 1 Very serious. The job is stopped and its + superior interrupted. + 2 Semi-serious. The job may request to handle + such an interrupt by setting the corresponding + bit in .MASK (q.v.); otherwise it is treated + as a class 1 interrupt. + 3 Trivial. The job receives the interrupt if it + has requested to handle it; otherwise the + interrupt condition is ignored. (Under the + new-style interrupt scheme, a class 3 interrupt + may become a class 1 interrupt.) + See also the .IFPIR variable for word 2 interrupts. + + The interrupt bits and their classes are as follows. + The character * denotes a class 1 interrupt, and + a + class 2 interrupt. + 4.9 Must be zero. + %PIRLT 4.8 Clock break (see the .REALT uuo). + %PIRUN 4.7 Run time interrupt (see the .RTMR user variable). + %PINXI 4.6 + Non-Existent IO register + A Job in User IOT mode referenced a non-existent IO + register on the KS10 Unibus. The PC is left + pointing before the guilty instruction. The address + of the non-existant register may be found in .MPVA. + %PIJST 4.5 Job Status display request. + The sequence ^_J was typed on the console owned + by this process or some inferior. + %PIDCL 4.4 * A defered call was typed while the job had the TTY. + %PIATY 4.3 The tty was given back to the job by + its superior. Indicates that the screen has + probably been written on and its contents + have changed unpredictably. + %PITTY 4.2 + Attempt to use tty when not possessing it. + %PIPAR 4.1 + Parity error. + %PIFOV 3.9 Arithmetic floating overflow. + %PIWRO 3.8 + Attempt to write into read only memory. + See the .MPVA user variable. + %PIFET 3.7 + Pure page trap (attempt to fetch an instruction from + writable memory when bit 4.2 of the PC set). + This feature doesn't exist on KL-10's, instead + this interrupt is signalled for "Illegal entry + to concealed mode" which you probably can't make + happen. (See the KI10 Processor Reference Manual.) + See bit 4.2 of the .UPC user variable. + %PITRP 3.6 * System uuo to user trap (see the .UTRP user variable). + 3.5 Arm tip break 3 (OBSOLETE). + 3.4 Arm tip break 2 (OBSOLETE). + 3.3 Arm tip break 1 (OBSOLETE). + %PIDBG 3.2 System being debugged (occurs when someone uses the + .SETLOC or .IFSET uuo to alter SYSDBG and the new contents + are non-zero and the old contents non-negative). + See also the SSTATU symbolic system call. + %PILOS 3.1 + A .LOSE UUO or LOSE system call was executed + (their purpose is to signal the superior). + %PICLI 2.9 CLI device interrupt. + %PIPDL 2.8 Pdl overflow. + %PILTP 2.7 Light pen interrupt on 340. + Program stop or hit stop on E&S display. + %PIMAR 2.6 + MAR interrupt (see the .MARA and .MARPC user variables). + %PIMPV 2.5 + Memory protection violation (attempt to reference + a page not in the job's page map). See the .MPVA + user variable. + %PICLK 2.4 Slow clock interrupt (every .5 second). + %PI1PR 2.3 * Single intruction proceed interrupt. + Used by DDT for ^N commands. + %PIBRK 2.2 * Breakpoint interrupt (.BREAK uuo executed). + %PIOOB 2.1 + Illegal user address. (OBSOLETE) + %PIIOC 1.9 + Input/output channel error (see the .BCHN + and .IOS user variables). + %PIVAL 1.8 * Value interrupt (.VALUE uuo executed). + %PIDWN 1.7 System going down or being revived. See the .SHUTDN, .REVIVE, + and .DIETIME uuo's, and the SSTATU symbolic call. + %PIILO 1.6 + Illegal instruction operation. + %PIDIS 1.5 + Display memory protection violation (340 or E&S). + %PIARO 1.4 Arithmetic overflow. + %PIB42 1.3 * Bad location 42 (see the .40ADDR user variable, and ITS INTRUP). + %PIC.Z 1.2 * ^Z typed when this job had the TTY. + %PITYI 1.1 Character enabled for interrupt was typed on TTY. + (Semi-obsolete; see the .IFPIR user variable, and ITS TTY.) + +.PMAP + +- +- page map word + + This is the page map word for page of the job, + for between 0 and 377 octal (256.K = 400 1K pages). + The map word read has this form: + 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page exists (if this bit is zero, then the + whole word is zero). + 4.7 ??? Page is in core (as opposed to swapped out). + 4.6 %CBPUB Page is public (any job can write into it + which wants to). + 4.2 %CBLOK Page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + 3.8-3.1 Number of times the page is shared. + (See the CORTYP symbolic system call, + right half of value 4.) + 2.9-2.1 Absolute page number, or page number in next + sharer in the circular list of sharers. + (See CORTYP, value 3.) + 1.9-1.1 0 Page is absolute. + 777 Page is not shared. + Next sharer in circular list of sharers + is the job with user index . + + +.RTMR +* +* runtime timer + + Initially -1. + If non-negative, the amount of run time remaining until the job + will receive a word 1 runtime interrupt. (See bit %PIRUN of the + .PIRQC variable.) The time is measured in slightly different units + on different CPUs. On the KA in 4.069 microsecond units, on the KL + in 4 microsecond units, and on the KS in 3.9 microsecond units. + + +.RUNT +- +- run time + + Initially 0. + This is the run time used so far by the job, + measured in units of 4 microseconds. + +.SERVER +* +* server job + + Initially -1. + This is the user index of a job that has been given special + permission to modify this job, or -1 if there is no such job. + + This can be used to implement various oddball client/server + protocols between jobs. The client job will request some service + from the server job and will set his .SERVER variable to the server's + user index to allow the service to be performed. + + If the server job is killed, all of the client jobs will have their + .SERVER variables set back to -1. + + Although it is safe to set .SERVER to -1 using .SUSET or .USET, + there can be timing errors if a client loads his .SERVER variable + by simply writing the server's user index into it. Specifically, + during the time the server's user index is sitting in the client's + memory, the server job might be killed and another job started with + the same user index. This can be guarded against by handling + interrupts on the USR: channel, but this is clumsy. A better + method is to use the SSERVE system call. (See .INFO.;ITS .CALLS) + +.SNAME +* +* system name + + This is a word of six sixbit characters which is + the default "directory name" for various input/output + operations. It is initially the same as the job's + .UNAME (q.v.). It can be overridden by supplying the + directory name explicitly to a symbolic system call. + The other uuo's such as .OPEN and .FDELE always use .SNAME. + +.SUPPRO +- +- superior + + This is -1 if the job is top-level, or the user index + of the job's superior. See .UIND. + + +.SV40 +- +- saved 40 + + The contents of absolute location 40 (i.e., the last + uuo that trapped to the system for this job). + See also the .UUOH user variable. + Note that only uuo's 40-47 are really used for + communication with the system. All other uuo's are + handed back to the executing job via its .40ADDR + user variable (q.v.). + + +.TR1INS +? +? Trap 1 instruction. + + This is the instruction to be executed when arithmetic + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR1INS are simply %PIARO to + set the overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TR2INS +? +? Trap 2 instruction. + + This is the instruction to be executed when pdl + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR2INS are simply %PIPDL to + set the pdl overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TTST +- +- saved TTYSTS + + In a job which does not have the TTY, this variable + holds the saved contents of TTYSTS (what would be in + TTYSTS if the job were given a TTY). This is primarily + useful for examining from DDT. + See ITS TTY for a description of the contents of TTYSTS. + See also the TTYGET and TTYSET symbolic system calls. + + +.TTS1 +- +- saved TTYST1 + + Like .TTST, but for the TTYST1 variable instead of the + TTYSTS variable. + + +.TTS2 +- +- saved TTYST2 + + Like .TTST, but for the TTYST2 variable rather than the + TTYSTS variable. + +.TTY +* +* random TTY variable + + This variable indicates the status of the job with + respect to the console controlling its job tree. + The %TBNVR, %TBINT, %TBWAT, %TBOUT, %TBINF, %TBOIG, and %TBIIN bits + are settable. %TBWAT may be set only by the superior. + 4.9 %TBNOT Does not have TTY now. + 4.8 %TBNVR If 1, an OPEN on the tty will fail + rather than hanging, unless %TBWAT is on. + 4.7 %TBINT An attempt to use the console without owning + it will cause a %PITTY interrupt (LH of + the .PIRQC user variable), unless + %TBWAT is set to 1. + In particular an OPEN on the tty + will interrupt instead of failing or + hanging. + 4.6 %TBWAT If 1, overrides the setting of %TBINT + and %TBNVR, and makes the system act + as if they were 0. Settable only with + .USET. DDT sets this bit when $P'ing a + job, so that even if the job loses the tty + momentarily it will not get upset. + 4.4 %TBDTY If the TTY was taken from the job, + then when it gets it back, this bit says + that the TTY should stay with the job + and not be passed down to an inferior. + 4.3 %TBOUT Allow this job to type out, even if it + doesn't have the TTY. Some operations, + and all input will still require the job + to have the TTY. Not effective unless + the superior enables it by setting %TBINF + in the superior's .TTY var. + 4.2 %TBINF Enable this job's inferiors to take + advantage of their %TBOUT's. + 4.1 %TBOIG Ignore output. Overrides %TBWAT, %TBINT. + 3.9 %TBIIN Interrupt on attempt to do input. Overrides + %TBWAT. + 3.6-3.1 $TBECL Number if echo lines, if the job + doesn't currently have the TTY. + 2.9-1.1 If the job has the TTY, this is the TTY number. + If it doesn't, and doesn't want it, this is the + (internal) user number of the immediately + inferior job to give the TTY to. + +.TVCREG +* +* TV console register + + Initially -1. + This variable is placed in the console register + when the job is run if it is non-negative. + It controls which video buffer memory is used + when writing into the job's tty's TV buffer + (see the CORBLK symbolic system call). + The format of the console register is as follows: + 4.9-4.2 ALU function, used when writing into TV memory: + VALUE SYMBOL FUNCTION + 0 CSETC SETCAM + 1 CNOR ANDCBM + 2 CANDC ANDCAM + 3 CSETZ SETZM + 4 CNAND ORCBM + 5 CCOMP SETCMM + 6 CXOR XORM + 7 CANCSD ANDCMM + 10 CORCSD ORCAM + 11 CEQV EQVM + 12 CSAME SETMM/MOVES/JFCL + 13 CAND ANDM + 14 CSETO SETOM + 15 CORSCD ORCMM + 16 CIOR IORM + 17 CSET SETAM/MOVEM + Note that those symbols are not predefined in MIDAS. + 4.1-3.3 Video buffer number (video switch input number). + See the VIDSW symbolic system call. + + +.UIND +- +- user index + + The unique number assigned to the job by the system + when the job was created. These numbers typically + are between 0 and 77 octal or so (the exact maximum value + is a function of the particular incarnation of the + system). When a job is killed, its user index is + freed for re-use. + Most symbolic system calls which require a job + to be specified will accept 400000+the user index + in lieu of a channel with the job open on it if the + call is only to examine the job and not to modify it. + The .GUN and DETACH commands require a user index. + Jobs 0 and 1 are special in that they always stand for + the system itself and for the CORE job, respectively. + (The CORE job manages core allocation for the system.) + This may have various implications depending on context; + for example, when sharing a page with a job via the + CORBLK symbolic system call, sharing with + job 0 means sharing with an absolute page, and "sharing" + with job 1 means getting a fresh page. + +.UNAME +- +? user name + + A word of sixbit characters which is the user + name of the job. All jobs in a given job + tree must all have the same user name. Furthermore, + a console-controlled tree may not log in if another + console-controlled tree is logged in under the same + uname. When a new console-controlled tree is created + by typing ^Z on a free console, the uname of the newly + created top-level job of the tree is set to "___nnn", + where "nnn" is the user index of the newly-created + job. A non-disowned non-console controlled job is also given + such a uname initially. This may subsequently be changed to + something more reasonable by using the LOGIN symbolic + system call. + The uname of a newly created inferior job is initialized + to the uname of its creator. + If a disowned job tree is re-owned, the unames of all the + jobs in the re-owned job tree are set to the uname of the + re-owning job tree. + The .UNAME user variable may be set only with a .SUSET, and + only by a top level job which has no direct inferiors; + furthermore, attempting to set the uname to zero or the left + half to -1 causes an illegal operation interrupt (bit 1.6 of + the .PIRQC user variable), as does attempting to make the + uname-jname pair of the job non-unique. + See also the .JNAME user variable. + +.UPC +* +- user program counter + + The PC for the job. This word, of course, + contains the PC flags in the left half; + a job may set these flags for itself only by + using JRST 2,@[]. + On KA's, the flags in the left half are as follows: + (- = .USET may not set; % = peculiar to ITS) + %PCARO==400000 Overflow. + %PCCR0==200000 Carry 0. + %PCCR1==100000 Carry 1. + %PCFOV==40000 Floating overflow. + %PCFPD==20000 First part of instruction already done. + %PCUSR==10000 - User mode. + %PCUIO==4000 - User I/O. + %PCPUR==2000 % Pure. Instructions may only be fetched from + read-only memory. See bit 3.7 of the .PIRQC user + variable. This feature is not available on + all machines -- beware! + %PCSPC==1000 - Unused. (A PDP6 feature) + %PC1PR==400 % One proceed. An interrupt will occur at the end + of the next instruction. See bit 2.3 of the .PIRQC + user variable. Used by DDT for ^N commands. + %PCX17==200 % AI KA-10 computer only. Index-off-the-PC hack. + When this bit is set, an index field of 17 means + index off the PC instead of ac 17. + %PCFXU==100 Floating underflow. + %PCDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + On KL's the flags are as follows (note the "|" at the front + of lines that differ significantly from those for KA's): + +| %PSPCP==400000 "Previous Context Public" - this applies only + in exec mode; in user mode this bit is the same + as in KA (%PCARO, Arithmetic overflow). + %PSCR0==200000 Carry 0. + %PSCR1==100000 Carry 1. + %PSFOV==40000 Floating overflow. + %PSFPD==20000 First part of instruction already done. + %PSUSR==10000 - User mode. + %PSUIO==4000 - User I/O. +| %PSPUB==2000 "Public Mode" - not used in ITS +| %PSINH==1000 Inhibits MAR-breaks and trap3 (one-proceed trap) +| for one instruction. +| %PSTR2==400 Set by pdl overflow; causes the "trap 2 instruction" +| to be executed. That instruction is kept in .TR2INS +| %PSTR1==200 Set by arithmetic overflow; causes the +| "trap 1 instruction" in .TR1INS to be executed. +| Both %PSTR1 and %PSTR2 set generates a one-proceed trap. +| %PS1PR==160 % %PSINH+%PSTR2+%PSTR1. Setting those bits +| causes a single instruction proceed. + %PSFXU==100 Floating underflow. + %PSDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + The user mode (4.4) is always set to 1. + The user I/O bit (4000, bit 4.3) is set according + to whether the job is in .IOTLSR mode. + + If the .UPC user variable for one job is read by another while + the first is running, an exec mode PC may be seen (bit 4.4 = 0); + this reflects the fact that the job is in the middle + of a system call or something. The .UUOH user variable + should then be examined (this is precisely what DDT does + for the evaluation of .). + +.USTP +* -- user stop bits + + Initially <100000,,>. + If this variable is non-zero, the job is being blocked + from running for one reason or another. If zero, the + .FLS variable controls whether the job may run. + The form of the .USTP variable is as follows: + 4.9 BCSTOP Job is being moved in core. + 4.8 BUCSTP Core job is stopping this job + in order to get more core for another job. + 4.7 BUSRC User control bit. Only this + bit may be modified, and only by the + procedure's superior. Any attempt to + set the .USTP variable non-zero + will set this bit; any attempt to set it + to zero will clear this bit. + 4.6 BSSTP Set while superior is altering the page + map for the job. (Not directly settable + by superior.) + 2.9-1.1 Count of transient reasons for stopping the job. + If non-zero, inhibits relocation of the job by + the core job. + PEEK displays this variable by printing the high six bits + in octal, then a "!", then the rest in octal. This is + why one normally sees "10!0" for a stopped job. + + +.UTRP +* -- user trap switch + + When non-zero, this switch specifies that all uuo's + which trap to the system should, instead of performing + their usual actions, should cause a word 1 class 1 + interrupt to the job executing the uuo. This allows + simulators, etc., to trap all uuo's executed by a job. + An attempt to set this variable will use only bit 1.1. + + This is the same as the %OPTRP bit of the .OPTION user variable. + + +.UUOH +- +- system uuo PC + + The program counter as of the last uuo which trapped + to absolute location 40 (not location 40 in the job, + nor the location specified by .40ADDR!) + See also the variable .SV40. + + +.VAL +* +* value or error code of job + + .VALUE instructions set this word to the contents + of the memory location they address. That is useless. + More importantly, .LOSE instructions, and the LOSE + system call, set .VAL to ,,, so that the superior can decode the + error. + +.WHO1 +* +* user who-line control word + + This variable controls the printing of .WHO2 and .WHO3 + at the end of the TV who-line (see ITS TV). + 4.9 If 1, suppress the who-line entirely when focused + on this job. + 4.8 Suppress space between halves of .WHO2. + 4.7-4.5 Mode for printing left half of .WHO2: + 0 Do not print. + 1 Date in packed form: + 4.9-4.3 Year (mod 100.). + 4.2-3.8 Month. + 3.7-3.3 Day. + 3.2-3.1 Unused. + See the RQDATE symbolic system call, but + note that here the date is shifted. + 2 Time in fortieths of a second, printed in tenths + in the form HH:MM:SS.T. + 3 Time in half-seconds, printed in the form HH:MM:SS. + 4 Octal halfword. + 5 Decimal halfword (no . is supplied). + 6 Three sixbit characters. + 7 Unused. + 4.4-4.2 Mode for printing right half of .WHO2. + 4.1 Print 3.9-3.3 twice (doubled character). + 3.9-3.3 If non-zero, character to print after left half of .WHO2. + 3.2 If 1, suppress the space between .WHO2 and .WHO3 printout. + 3.1 If 1, suppress the space between halves of .WHO3. + 2.9-2.7 Mode for printing left half of .WHO3. + 2.6-2.4 Mode for printing right half of .WHO3. + 2.3 Print 2.2-1.5 twice. + 2.2-1.5 If non-zero, character to print after left half of .WHO3. + 1.4-1.1 Unused. + That is, if the who-line is printed at all, what appears + at the end is these characters: + AAAAXX-BBBB=CCCCYY+DDDD + where: AAAA is the result of printing the left half of .WHO2. + BBBB right half of .WHO2. + CCCC left half of .WHO3. + DDDD right half of .WHO3. + XX one or two characters specified by .WHO1 4.1-3.3. + YY one or two characters specified by .WHO1 2.3-1.5. + - space, unless .WHO1 4.8 is 1. + = space, unless .WHO1 3.2 is 1. + + space, unless .WHO1 3.1 is 1. + Note that the specifications fall neatly into 8-bit bytes + (for the convenience of the PDP-11); hence it is easiest + to specify this word using .BYTE 8 in MIDAS. + Example: + .SUSET [.SWHO1,,[ .BYTE 8 ? 166 ? 0 ? 144 ? 200+", ]] + causes .WHO2 to appear as a word of sixbit, and .WHO3 to + appear as octal halfword typeout in mmm,,nnn format. + + +.WHO2 +* +* first user who-line variable + + See .WHO1 for details. + + +.WHO3 +* +* second user who-line variable + + See .WHO1 for details. + +.XJNAME +* +* "intended" job name. + + This variable holds what the job's name was "intended" + to be, by its creator. Why might the job's name not + actually be what it was intended to be? Perhaps because + that name was already in use by some other job, and the + creator had to find a second choice. For example, when + :NEW T in DDT creates a job named T0 because there was + already a job named T, the job T0's .XJNAME will be "T". + In any case, when using the common technique of having + several programs be links to one file, which figures + out what name it was invoked under and behaves + accordingly, the .XJNAME is the right place to look to + find out what behavior the invoker desires. + + When a job is first created, its .XJNAME is the same as it's .JNAME. + + +.XUNAME +* +* "real" user name. + + This variable holds what says who you really are, + as opposed to what you are logged in as. + It should be a word of sixbit, just like .UNAME. + For example, if you are logged in as FOO1 then + your XUNAME will probably be FOO, because that's + what DDT will normally set it to. However, though + the .UNAME may change because of reowning or attaching, + the .XUNAME will ot change iunless requested specifically. + However, the user may alter DDT's .XUNAME by depositing in + ..XUNAME, which works by informing DDT and having DDT + tell ITS. + Whenever an inferior is created, its .XUNAME is initialized + from its superior's. diff --git a/sysdoc/usets.119 b/sysdoc/usets.119 new file mode 100644 index 0000000..ce4158d --- /dev/null +++ b/sysdoc/usets.119 @@ -0,0 +1,1422 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS USETS: + +This file attempts to maintain up-to-date documentation on +all user variables hacked by .USET/.SUSET. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the .FOO user var ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- +Each job running under ITS has a large number of variables +associated with it maintained by the system. In order to +examine and set these variables, the .USET and .SUSET +uuo's are provided. The .USET uuo allows the specification +of the job whose variables are to be accessed. The .SUSET +uuo always accesses the variables of the job which executes it +(SUSET = Self USET). + +The .USET uuo is used like this: .USET CHNL,SPEC +and the .SUSET uuo like this: .SUSET SPEC +The ac field CHNL of the USET must be the number of +an input/output channel for which a job is open, +as either the USR, JOB, or BOJ device. +The .USET may modify the variables only +if it has modification rights to the job (the job +is a JOB device, or is a direct inferior). + +The contents of the effective address SPEC are of this form: + 4.9 0 = read variable, 1 = set variable. + 4.8 Block mode (see below). + 4.7-3.1 Number of user variable to access. + 2.9-2.1 Address of a location within the caller which + is to receive the value of the variable, or which + contains the new value for the variable. +If bit 4.8 is 1, then the word at location SPEC is really +an AOBJN pointer to a block of specifications. This is +useful for getting several variables at a time easily. +The AOBJN pointer is updated as the operation progresses, +and so must be in a writable area. Block mode may not be nested. +If an illegal specification is given to .USET or .SUSET, +the job will receive an illegal operation word 1 interrupt +(bit 1.6 of the .PIRQC user variable). + +The variables are described in this document by the names which +DDT knows for them; the first character of each name is a ".". +If you open up a location by using one of these names, DDT +treats it specially and actually accesses the corresponding +variable and not a location in the job's core. + +When writing .USET's and .SUSET's in MIDAS code, +one may use the symbols defined by MIDAS for accessing them. +These are the same as the names known to DDT, except that +the "." is followed by "R" for reading or "S" for setting. + +If you open a location containing a SPEC, try typing +.R$?? if it is positive, or .S$?? if it is negative; this will +use bit typeout mode to print out the spec as it might have been +assembled; for example, 400001,,500 .S$?? gives .SVAL,,500 . + +Examples: + +To read your own runtime in 4-microsecond ticks into FOO: + + .SUSET [.RRUNT,,FOO] + +To set your word 1 interrupt mask: + + .SUSET [.SMASK,,[%PIDWN\%PIPDL]] + ;enable "pdl overflow" and "sys going down" interrupts + +To read your input/output status word for channel 13 into FOO: + + .SUSET [.RIOS+13,,FOO] + +To start a job (your immediate inferior!) open on channel + USRC at its location QUUX, with its option + bits indicating your readiness to supply JCL: + + .USET USRC,[.SOPTION,,[%OPCMD,,]] + .USET USRC,[.SUPC,,[QUUX]] + .USET USRC,[.SUSTP,,[0]] + +Another way to do the same thing is: + + MOVE AC,[-3,,USBLOK] + .USET USRC,AC + . . . +USBLOK: .SOPTION,,[%OPCMD,,] + .SUPC,,[QUUX] + .SUSTP,,[0] + +FORM OF DESCRIPTIONS: + +The descriptions of the various variables accessible by +.USET and .SUSET are in the following form: + + + + + +The descriptor contains four characters "wx yz". +The first two ("wx") refer to the access for .USET; +the last two ("yz") to the access for .SUSET. +In each case these characters are chosen from these sets: + -- May neither read nor set. + +- May read but not set. + +* May read and set. + +? May read, may sometimes set (please read on...) +That is, + means may read, * may set, - denies access, +while ? says that things are more complicated. + +.40ADDR +* +* "40" address + + The right half: + + Initially 40 octal. Whenever the system + references locations "40" through "44" specifically, + (e.g. giving the user interrupts, or returning uuo's 50-77), + the system really references the 5-word block that + .40ADDR points to. Thus, if .40ADDR is set to 500, the + system expects location 502 to contain the address of + the interrupt routine. This is especially useful to + distinguish system-returned uuo's (0 and 50-77) from + standard user-mode uuo's (1-37); the latter always + trap through location 40, while the former trap + through .40ADDR. + The various words accessed through .40ADDR are + as follows (indexed by "normal" location #): + 40 System places a uuo here when it wants + to give it to the user. + 41 Should contain the address of the uuo handler. + If .40ADDR is not indeed 40, this + may be a different uuo handler from the + one which handles uuo's 1-37. + If .40ADDR is actually 40, then unless + 41's index and indirect fileds are 0 and its + opcode is either 0 or JSR, all system-returned + UUOs will cause ILOPR interrupts instead. + This is to protect programs that want their + hardware user-UUOs to be handled by a PUSHJ + from being clobbered when they accidentally + execute a meaningless UUO. + 42 If the job's %OPINT bit in its + .OPTION variable (q.v.) is 0, then + this is a JSR to the user's old-style + interrupt handler. The three words addressed + by the JSR are, in order, the word in + which the interrupt bits are placed, the + return address for the interrupt, and the + first instruction of the handler. + If the %OPINT bit is 1, then this + is an AOBJN pointer to a vector of + 5-word blocks describing the various + interrupt handlers and their priorities. + See ITS INTRUP for details. + 43 If the job's %OPLOK bit is set in + its .OPTION variable, then this is + the pointer to the list of switches + to be reset if the job is killed. + 44 If the job's %OPLOK bit is set, + this is an AOBJN pointer to a block + of critical code region descriptors. + See ITS LOCKS for details. + + The left half: + + Initially 20 octal. This is the address of a block of + 20 octal words which a job's superior may use to hack + that job. For compatibility, if LH(.40ADDR) is zero, + the default of 20 will be assumed. + +.ADF1 +* +* ANDCAM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs ANDCAM into .DF1 when writing. + + +.ADF2 +* +* ANDCAM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs ANDCAM into .DF2 when writing. + + +.AIFPIR +* +* ANDCAM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs ANDCAM into .IFPIR when writing. + + +.AMASK +* +* ANDCAM into .MASK + + Like .MASK (q.v.) when reading. + Performs ANDCAM into .MASK when writing. + + +.AMSK2 +* +* ANDCAM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs ANDCAM into .MSK2 when writing. + + +.APIRQC +* +* ANDCAM into .PIRQ + + Like .PIRQC (q.v.) when reading. + Performs ANDCAM into .PIRQC when writing. + +.APRC +- +- APR CONO + + 4.9 Procedure is in a disowned tree. + 4.7 (BUMRTL) Tree will be gunned if hasn't run for an hour + (meaningful only in top level job). Cleared by reowning or + attaching. See the DETACH and DISOWN system calls. + 4.6 Core request pending for this job. + 4.5 User disabled, waiting to be flushed by SYS job. + The SYS job will delete the job tree eventually. + 4.4-4.1 .BCHN user variable (q.v.). + 3.9 In process of deleting or logging out this job. + Bit 4.5 will probably be set eventually. + 3.5-3.1 Must be zero. + 2.9-1.1 CONO'ed to APR whenever job is about + to be run. Initially 447. Modified by + altering the .MASK user variable. + + +.BCHN +* +* bad channel number + + Initially 0. + Number of channel most recently in error. + Typically after reading this variable one does a + .STATUS or a STATUS symbolic system call + to get the status word for the channel. This word + can then be fed to the ERR device. + .BCHN is actually part of the .APRC variable. + See also the .IOS variable. + + +.CNSL +- +- console tty number + + If the job is in a console-controlled tree, this + variable contains the console's number, even if + the job doesn't own the console. If the job is + in a non-console-controlled tree, .CNSL is -1 + if the job is scheduled as part of the system, + -2 if the job is scheduled as a disowned job; + for a job-device-handler job, .CNSL is the same + as it is for the job it is serving. + + +.DF1 +* +* defer bits, word 1 + + Initially 0. + Defer bits for word 1 interrupts (see .PIRQC + and .MASK). If an interrupt bit is set in both + .PIRQC and .MASK, but is also set in .DF1, + it is temporarily deferred. + + +.DF2 +* +* defer bits, word 2 + + Initially 0. + Defer bits for word 2 interrupts (see .IFPIR + and .MSK2). If an interrupt bit is set in both + .IFPIR and .MSK2, but is also set in .DF2, + it is temporarily deferred. + +.EBO1 +- +- KL-10 Ebox counter + + This is the low-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + Its location is .EBOX+1, for convenience. + + +.EBOX +- +- KL-10 Ebox counter + + This is the high-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + + +.FLS +- -- flush instruction + + Initially 0. + The instruction which is blocking the running of + the job. Zero if user not blocked (user can run + if .USTP is also zero). + (The scheduler tests a job for runnability by first + checking the .USTP variable, and if it is zero, + then executing the flush instruction. The job is + runnable iff the flush instruction skips.) + + +.FTL1 +- +- Fatal interrupt first word + + After a fatal interrupt, this variable contains the + .PIRQC bits which caused the error. At any other time + it contains garbage. + +.FTL2 +- +- Fatal interrupt second word + + After a fatal interrupt, this variable contains the + .IFPIR bits which caused the error. At any other time + it contains garbage. + + +.HSNAME +* +* Home System Name + + This is a word of sixbit like .SNAME (q.v.). It + is initialized to be the same as the UNAME on creation + of a not-logged-in tree, and when a job is created + as an inferior or as a job device, it's .HSNAME is + copied from that of it's creator. The LOGIN system call + sets it to be the same as the UNAME, although this should + be changed to be the XUNAME. + + This is not used by ITS for anything, but is intended to + associate a directory with a specific XUNAME for the sake + of init and mail files of people without a directory of + the same name as their XUNAME. DDT will soon initialize + it by looking up information in the INQUIR database for + the particular user. + +.IDF1 +* +* IORM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs IORM into .DF1 when writing. + +.IDF2 +* +* IORM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs IORM into .DF2 when writing. + + +.IFPIR +* +* inferior procedure and i/o requests (?) + + Initially 0. + This variable contains bits for pending word 2 interrupts. + + Bit 3.n is the interrupt bit for the n'th job directly + inferior to the specified job (see the .INTB user variable). + These therefore occupy bits 3.8-3.1. + An inferior interrupt bit is set if an a class 1 + or untrapped class 2 interrupt occurs in the inferior, + or if the inferior is using new-style interrupts + (see ITS INTRUP, and the %OPINT bit of the .OPTION + user variable) and any unhandled interrupt occurs. + Performing a .UCLOSE on an inferior clears the + inferior interrupt bit in the .IFPIR variable + of the job performing the .UCLOSE. + + Bit 1.n is the interrupt bit for input/output + channel n-1 (actually, these occupy bits 2.7-1.1). + Thus bit 1.1 = channel 0, 1.2 = channel 1, + 1.3 = channel 2, . . ., bit 2.7 = channel 17. + When an input/output interrupt is detected, the + system call WHYINT shoud be used to discover the + cause (see ITS .CALLS). + + The following devices can cause channel interrupts: + + TTY Input: A character was typed which according + to the job's TTYST1 and TTYST2 variables + (see ITS TTY) should be treated as an interrupt + character. If the tty is opened for input + on more than one channel, only one channel, + if any, receives the interrupt. + Output: The **MORE** condition has occurred. + See ITS TTY. + STY Input: Input is pending (i.e. the corresponding TTY + has attempted output). If the STY is open + for input on more than one channel, only + one channel, if any, receives the interrupt. + See ITS TTY. + Output: The STY's alter ego is waiting for input, + or at least was (it isn't guaranteed not to + stop waiting and do something else). + STK Input is available. Interrupts occur on all enabled channels. + USR A foreign job open on the channel has been killed. + If the job went away while the channel was pushed + on the I/O pdl, this interrupt will occur when the + channel is popped. See the .UCLOSE, .IOPUSH, and + .IOPOP uuo's. + If the job is the PDP-6, the PDP-6 has requested an interrupt. + JOB Various conditions, some programmable. See ITS JOB. + BOJ Various conditions, some programmable. See ITS JOB. + NET One of the following conditions has occurred: + The IMP has gone down. + RFC received. + After RFC sent, the connection is now open. + Input available. + Connection closed. + Net interrupt received (INR or INS). + MSP Message has been sent. + +.IIFPIR +* +* IORM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs IORM into .IFPIR when writing. + + +.IMASK +* +* IORM into .MASK + + Like .MASK (q.v.) when reading. + Performs IORM into .MASK when writing. + + +.IMSK2 +* +* IORM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs IORM into .MSK2 when writing. + + +.INTB +- +- interrupt bit + + Gets the interrupt bit for the procedure. This is + the word 2 interrupt bit which the procedure's + superior will see when the procedure interrupts + its superior. This variable will therefore have + exactly one of bits 3.1-3.8 set, and no others. + If the procedure is top level (has no superior), + then this variable is negative. + + +.IOC + +- +- input/output channel + + The variable .IOC+ is the input/output channel + word for channel , for n between 0 and 17 octal. + Normally zero for a closed channel. + + +.IOP + +- +- input/output pdl + + The input/output pdl is a pdl of two-word entries + used by the .IOPUSH, .IOPOP, and .IOPDL uuo's. + The first word of each pair is the .IOC word for + the stacked channel, and the second is the .IOS word. + In addition, bits 4.9-4.6 of the .IOS word of each + pair contain the channel number which the channel was + pushed from (this is used by the .IOPDL uuo). + The pdl has eight entries; thus should be between + 0 and 17 (0 is the .IOC word for the least recently + pushed entry, etc.). + +.IOS + +- +- input/output status + + The variable .IOS+ is the input/output status + word for channel , for between 0 and 17 octal. + Normally zero for a closed channel. + This word contains various bits describing the status + of the channel. The left half is a set of error + codes if non-zero; the .IOS word can be given to + the ERR device to obtain an ascii message for + the error. The right half contains various bits + describing the state of the device. (Internally to + ITS, the right half contains an access pointer; + the right half bits supplied for .IOS are the + same as those generated by the .STATUS uuo or + the STATUS symbolic system call.) + + The various bits in the .IOS word are as follows: + 4.9-4.6 Always zero (see the .IOP variable). + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an IDS interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + Set primarily by failing .OPEN's and + .FDELE's. These are the same as the error + codes returned by failing .CALL's (see + table below). + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code + (see table below). + + The error messages indicated by bits 4.5-4.1 are: + 1 DEVICE HUNG OR REPORTING NON-DATA ERROR + 2 END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (or directory full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + + The error messages indicated by bits 3.9-3.7 are: + 1 IDS ILLEGAL SCOPE MODE + 2 IDS SCOPE HUNG + 3 MORE THAN 1K SCOPE BUFFER + 4 IDS MEM PROTECT + 5 IDS ILLEGAL SCOPE OP + 6 IDS MEM PROTECT ON PDL PNTR + 7 IDS ILLEGAL PARAMETER SET + + The error messages indicated by bits 3.6-3.1 are: + 1 NO SUCH DEVICE + 2 WRONG DIRECTION + 3 TOO MANY TRANSLATIONS + 4 FILE NOT FOUND + 5 DIRECTORY FULL + 6 DEVICE FULL + 7 DEVICE NOT READY + 10 DEVICE NOT AVAILABLE + 11 ILLEGAL FILE NAME + 12 MODE NOT AVAILABLE + 13 FILE ALREADY EXISTS + 14 BAD CHANNEL NUMBER + 15 TOO MANY ARGUMENTS (CALL) + 16 PACK NOT MOUNTED + 17 DIRECTORY NOT AVAIL + 20 NON-EXISTENT DIRECTORY NAME + 21 LOCAL DEVICE ONLY + 22 SELF-CONTRADICTORY OPEN + 23 FILE LOCKED + 24 M.F.D. FULL + 25 DEVICE NOT ASSIGNABLE TO THIS PROCESSOR + 26 DEVICE WRITE-LOCKED + 27 LINK DEPTH EXCEEDED + 30 TOO FEW ARGUMENTS (CALL) + 31 CAN'T MODIFY JOB + 32 CAN'T GET THAT ACCESS TO PAGE + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + 36 VALID CLEAR OR STORED SET + 37 NO CORE AVAILABLE + 40 NOT TOP LEVEL + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + 42 JOB GONE OR GOING AWAY + 43 ILLEGAL SYSTEM CALL NAME + 44 CHANNEL NOT OPEN + 45 INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + 46 UNRECOGNIZABLE FILE (LOAD) + 47 LINK TO NON-EXISTENT FILE + + The physical device codes from bits 1.6-1.1 are as + follows. Note that, as a half-hearted rule, bit 1.6 + indicates that file names are significant, and bit 1.5 + indicates a software-implemented device. + This list is subject to additions and deletions! + CODE SYMBOL DEVICE DESCRIPTION + 0 TTY Console input. + 1 SNTTY TTY Printing console output. + 2 SNTDS TTY Display console output. + 3 SNLPD LPT Data Products line printer. + 4 SNVID VID Vidisector ??? + 5 SNBAT Vidisector ??? + 6 SNPLT PLT Calcomp plotter. + 7 SNPTP PTP Paper tape punch. + 10 SNIMPX IMX Input multiplexor. + 11 SNOMPX OMX Output multiplexor. + 12 SNPTR PTR Paper tape reader. + 13 SN340 DIS DEC 340 display, Ascii output. + 14 SN340I IDS Interpreted 340 display. ??? + 15 SNMTC MTn Magnetic tape. + 16 SNCOD COD Morse code device. + 17 SNTAB TAB Tablet. ??? + 21 SNNUL NUL Source of zeroes, or output sink. + 22 SNJOB JOB Job device. + 23 SNBOJ BOJ Inverse of JOB. + 24 SNSPY SPY Spy on another console. + 25 SNSTY STY Pseudo-teletype. + 26 SNNET NET ARPAnet (NCP). + 27 SNLPV LPT Vogue line printer (yech!) + 30 SNSTK STK Stanford keyboard. + 31 SNMSP MSP (DM) Interprocess message protocol. + 32 SNCHA CHAOS CHAOS net. + 33 SNTCP TCP TCP Internet. + 34 SNTRAP TRAP Trap "device" + 35 SNIPQ IPQ Internet IP Queue. + 41 SNUTC UTn Microtape (DECtape). + 43 SN2311 DSK 2311 disk drives or equivalent. + 60 SNFUSR USR A foreign (not immediately inferior) procedure. + 61 SNUSR USR An immediately inferior procedure. + 62 SNCLK CLx Various core link devices (x  {AIOU}) + 63 SNDIR --- File directory or ERR device. + 64 SNPDP USR The PDP-6. + 65 SNDIRH DIRHNG Directory hang "device" + 66 SNLCK LOCK Lock "device" + +.IPIRQC +* +* IORM into .PIRQC + + Like .PIRQC (q.v.) when reading. + Performs IORM into .PIRQC when writing. + + +.JNAME +* +? job name + + The name of the job as a word of sixbit characters. + The uname-jname pair must be unique to a job + (there are some exceptions involving system-created + jobs or jobs not logged in). + The uname and jname are used as file names when + creating or subsequently opening the job on the USR + device. See also the .UNAME user variable. + The .JNAME variable may be set by a .SUSET only in a + top-level job, and then only if the job has no + inferiors. + Attempting to set a jname to zero causes an + illegal operation interrupt (bit 1.6 of the .PIRQC + user variable). So does attempting to set it such that + the uname-jname pair would no longer be unique. + So does attempting to illegally set one's own jname. + + +.JPC +* +* jump program counter + + The PC as of the most recent jump instruction, + i.e. an instruction which changed the PC by other + than 1 or 2. This is actually a register in the + paging box when running. + + +.MARA +* +* MAR (memory address register) address + + Initially 0. + The address for the MAR register in the paging box, + which gives a %PIMAR interrupt when the specified operation + is performed on the specified address. + 3.3 0 = exec mode, 1 = user mode. + This is forced to 1 when set with + .SUSET or .USET; exec mode is for very + obscure system hacks only. + 3.2-3.1 0 Never interrupt. + 1 Interrupt on instruction fetch. + 2 Interrupt on write. + 3 Interrupt on any reference. + 2.9-2.1 Address for MAR. + The MAR does not work well on accumulators. + See also the .PIRQC user variable, bit %PIMAR; + and ITS INTRUP and ITS USR. + +.MARPC +* +* MAR program counter + + The PC as of the instruction that most recently + tripped the MAR interrupt, if any. In addition, + the indirect bit will be set if that instruction + completed successfully (was not aborted by the MAR + hit). See the .MARA user variable. + + +.MASK +* +* word 1 interrupt mask + + Initially 0. + This is a mask for word 1 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 1 interrupt tries to + occur, but the corresponding bit in .MASK is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MASK directly + correspond to those in .PIRQC (q.v.). Bits for class + 1 interrupts are AND'ed out before setting the .MASK + variable. + + +.MBO1 +- +- KL-10 Mbox counter + + This is the low-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + Its location is .MBOX+1, for convenience. + + +.MBOX +- +- KL-10 Mbox counter + + This is the high-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + + +.MEMT +* +* memory top + + This variable contains 1 plus the highest legal + address in the job (the accessible word with the + largest address). Setting this variables is like + performing an equivalent .CORE uuo (q.v.): + .SUSET [.SMEMT,,[FOO]] + is like doing: + .CORE _12 + + +.MPVA +- +- memory protect violation address + + The address which the last instruction to cause a memory protection + violation (or a write into read only memory violation) attempted to + reference, on KA-10's rounded down to a page boundary. Thus an + attempt to reference the non-existent location 317435 would cause + .MPVA to be set to 316000 octal on a KA-10, or 317435 on a KL-10. + + On the KS-10, .MPVA also holds the non-existant IO register address + after a %PINXI. + + See also the .PIRQC variable. + +.MSK2 +* +* word 2 interrupt mask + + Initially 0. + This is a mask for word 2 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 2 interrupt tries to + occur, but the corresponding bit in .MSK2 is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MSK2 directly + correspond to those in .IFPIR (q.v.). + + +.OPC +- +- old program counter + + The PC just before the last instruction was executed. + This corresponds to a register in the paging box. + It doesn't exist on KL-10's. + +.OPTION +* +* option bits + + Initially 0. + The bits in this word correspond to various options + as follows: + 4.9 %OPTRP Same as the .UTRP user variable. See ITS UUO. + 4.8 %OPDET ** This bit is OBSOLETE and NO LONGER EXISTS ** + It is documented for historical purposes only. + Nowadays, fatal interrupts always cause top-level + jobs to be detached. Once upon a time, top-level + jobs with consoles would be reloaded instead of + detached, unless they had set %OPDET=1. + See the DETACH and RELOAD symbolic system calls. + 4.7 %OPDEC Uuo's 40, 41, and 47 (that is, + .IOT, .OPEN, and .ACCESS) + should trap to the user as uuos + via the .40ADDR user variable (q.v.). + This is useful for programs which wish to + interpret DEC TOPS-10 UUO's, since those are the + only ones which conflict with ITS UUOs. + Luckily, those ITS UUOs are not essential since + there are symbolic system calls to do the same things. + 4.6 %OPCMD Superior claims it has JCL which + it will cheerfully supply in response to + the appropriate .BREAK 12, command. + 4.5 %OPBRK Superior claims to handle all .BREAK's. + 4.4 %OPDDT Superior claims to be DDT. + 4.3 %OPINT Job desires new-style (vectored + and stacked) interrupts. See also the + .40ADDR variable. See ITS INTRUP for + information on old- and new-style + interrupts. + 4.2 %OPOJB Other jobs may open this job + as the OJB device, thereby turning it + into a JOB device. See ITS JOB. + 4.1 %OPLOK Job desires the switch locking + and unlocking synchronization feature. + See also the .40ADDR variable. + See ITS LOCKS for information on locks. + 3.9 %OPLIV The job tree of which this is the + top-level job is permitted to survive a + system shutdown -- it should take care + of logging itself out. See the .SHUTDN uuo. + Meaningful only for top-level jobs. + Primarily useful for system demons which need to + survive system death (e.g. the statistics + demon PFTHMG DRAGON). + 3.8 %OPOPC Job desires that instruction-aborting interrupts + such as MPV leave the PC pointing before the + instruction that lost, instead of the old + convention of leaving it pointing after. + The new convention is far better and all new + programs should use it. + 3.7 %OPLSP Superior claims to be MacLisp. + 3.6 %OPLKF Unlock locks on fatal interrupt. When a + non-disowned top-level job receives a fatal + interrupt, if it has set this bit, its locks will + be unlocked by the system job as part of the + process of detaching it. See the %OPLOK bit and + ITS LOCKS. + +.PAGAHEAD +* +* page-ahead control + + Normally zero, this word is set nonzero to enable + sequential paging through a part of the address space + specified by .PAGRANGE. The right half of .PAGAHEAD is + the page-ahead interval width and the left half is the page-behind + distance. Each time a page in the designated range is + touched for the first time, the next few pages, forming the + page-ahead interval begin to swap in, and a page a certain + distance behind (specified by the page-behind distance) is + swapped out or marked for swap out in the near future. The + precise treatment depends on how loaded the system is. + + Exactly one of the page-ahead interval width and the + page-behind distance should be negative. The page-behind + distance should be negative, if memory is being used from low + addresses to high ones. The page-ahead width should be + negative if moving from high addresses to low ones. + + Example: -2,,4 means on first reference to page n, start + reading in pages n+1 through n+4 and possibly swap out page n-2. + Page n-1 is not affected until page n+1 is touched. A + page-behind distance of 2 means that two consecutive pages are + always available. + +.PAGRANGE +* +* page-ahead range + + Normally zero, this word is made nonzero together with .PAGAHEAD + to enable the sequential paging feature. The two halves of + .PAGRANGE are page numbers which specify the region of the + address space in which sequential paging should go on. + The left half specifies the first page in the sequentially + paged region, and the right half specifies the first page + after the end of that region. + +.PICLR +* +* priority interrupt clear + + Initially -1. + If non-zero, the job may take interrupts. If zero, + interupts are deferred. This variable is cleared + when an old-style interrupt occurs (but not by new-style + interupts!), and is set to -1 by the .DISMISS uuo + and the DISMIS symbolic system call. Attempts + to set this variable will convert the value to -1 or 0 + depending on bit 4.9. + + +.PIRQC +* +* priority interrupt request cruft (?) + + This word contains bits for pending word 1 interrupts. + Setting bits in this causes the corresponding interrupts + to attempt to take place, subject to .MASK, .DF1, + .PICLR (q.v.), and the %OPINT bit of the .OPTION user + variable (see ITS INTRUP). + + Interrupts are of three classes: + 1 Very serious. The job is stopped and its + superior interrupted. + 2 Semi-serious. The job may request to handle + such an interrupt by setting the corresponding + bit in .MASK (q.v.); otherwise it is treated + as a class 1 interrupt. + 3 Trivial. The job receives the interrupt if it + has requested to handle it; otherwise the + interrupt condition is ignored. (Under the + new-style interrupt scheme, a class 3 interrupt + may become a class 1 interrupt.) + See also the .IFPIR variable for word 2 interrupts. + + The interrupt bits and their classes are as follows. + The character * denotes a class 1 interrupt, and + a + class 2 interrupt. + 4.9 Must be zero. + %PIRLT 4.8 Clock break (see the .REALT uuo). + %PIRUN 4.7 Run time interrupt (see the .RTMR user variable). + %PINXI 4.6 + Non-Existent IO register + A Job in User IOT mode referenced a non-existent IO + register on the KS10 Unibus. The PC is left + pointing before the guilty instruction. The address + of the non-existant register may be found in .MPVA. + %PIJST 4.5 Job Status display request. + The sequence ^_J was typed on the console owned + by this process or some inferior. + %PIDCL 4.4 * A defered call was typed while the job had the TTY. + %PIATY 4.3 The tty was given back to the job by + its superior. Indicates that the screen has + probably been written on and its contents + have changed unpredictably. + %PITTY 4.2 + Attempt to use tty when not possessing it. + %PIPAR 4.1 + Parity error. + %PIFOV 3.9 Arithmetic floating overflow. + %PIWRO 3.8 + Attempt to write into read only memory. + See the .MPVA user variable. + %PIFET 3.7 + Pure page trap (attempt to fetch an instruction from + writable memory when bit 4.2 of the PC set). + This feature doesn't exist on KL-10's, instead + this interrupt is signalled for "Illegal entry + to concealed mode" which you probably can't make + happen. (See the KI10 Processor Reference Manual.) + See bit 4.2 of the .UPC user variable. + %PITRP 3.6 * System uuo to user trap (see the .UTRP user variable). + 3.5 Arm tip break 3 (OBSOLETE). + 3.4 Arm tip break 2 (OBSOLETE). + 3.3 Arm tip break 1 (OBSOLETE). + %PIDBG 3.2 System being debugged. + Occurs when someone uses the .SETLOC or .IFSET uuo + to alter SYSDBG and the new contents are non-zero + and the old contents non-negative. + (See also the SSTATU symbolic system call.) + %PILOS 3.1 + A .LOSE UUO or LOSE system call was executed + (their purpose is to signal the superior). + %PICLI 2.9 CLI device interrupt. + %PIPDL 2.8 Pdl overflow. + %PILTP 2.7 Light pen interrupt on 340. + Program stop or hit stop on E&S display. + %PIMAR 2.6 + MAR interrupt. + (See the .MARA and .MARPC user variables.) + %PIMPV 2.5 + Memory protection violation (attempt to reference + a page not in the job's page map). + (See the .MPVA user variable.) + %PICLK 2.4 Slow clock interrupt (every .5 second). + %PI1PR 2.3 * Single intruction proceed interrupt. + Used by DDT for ^N commands. + %PIBRK 2.2 * Breakpoint interrupt (.BREAK uuo executed). + %PIOOB 2.1 + Illegal user address. (OBSOLETE) + %PIIOC 1.9 + Input/output channel error. + (See the .BCHN and .IOS user variables.) + %PIVAL 1.8 * Value interrupt (.VALUE uuo executed). + %PIDWN 1.7 System going down or being revived. + (See the .SHUTDN, .REVIVE, and .DIETIME uuo's, + and the SSTATU symbolic call.) + %PIILO 1.6 + Illegal instruction operation. + %PIDIS 1.5 + Display memory protection violation (340 or E&S). + %PIARO 1.4 Arithmetic overflow. + %PIB42 1.3 * Bad location 42. + (See the .40ADDR user variable, and ITS INTRUP.) + %PIC.Z 1.2 * ^Z typed when this job had the TTY. + %PITYI 1.1 Character enabled for interrupt was typed on TTY. + (Semi-obsolete; see the .IFPIR user variable, + and ITS TTY.) + +.PMAP + +- +- page map word + + This is the page map word for page of the job, + for between 0 and 377 octal (256.K = 400 1K pages). + The map word read has this form: + 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page exists (if this bit is zero, then the + whole word is zero). + 4.7 ??? Page is in core (as opposed to swapped out). + 4.6 %CBPUB Page is public (any job can write into it + which wants to). + 4.2 %CBLOK Page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + 3.8-3.1 Number of times the page is shared. + (See the CORTYP symbolic system call, + right half of value 4.) + 2.9-2.1 Absolute page number, or page number in next + sharer in the circular list of sharers. + (See CORTYP, value 3.) + 1.9-1.1 0 Page is absolute. + 777 Page is not shared. + Next sharer in circular list of sharers + is the job with user index . + + +.RTMR +* +* runtime timer + + Initially -1. + If non-negative, the amount of run time remaining until the job + will receive a word 1 runtime interrupt. (See bit %PIRUN of the + .PIRQC variable.) The time is measured in slightly different units + on different CPUs. On the KA in 4.069 microsecond units, on the KL + in 4 microsecond units, and on the KS in 3.9 microsecond units. + + +.RUNT +- +- run time + + Initially 0. + This is the run time used so far by the job, + measured in units of 4 microseconds. + +.SERVER +* +* server job + + Initially -1. + This is the user index of a job that has been given special + permission to modify this job, or -1 if there is no such job. + + This can be used to implement various oddball client/server + protocols between jobs. The client job will request some service + from the server job and will set his .SERVER variable to the server's + user index to allow the service to be performed. + + If the server job is killed, all of the client jobs will have their + .SERVER variables set back to -1. + + Although it is safe to set .SERVER to -1 using .SUSET or .USET, + there can be timing errors if a client loads his .SERVER variable + by simply writing the server's user index into it. Specifically, + during the time the server's user index is sitting in the client's + memory, the server job might be killed and another job started with + the same user index. This can be guarded against by handling + interrupts on the USR: channel, but this is clumsy. A better + method is to use the SSERVE system call. (See .INFO.;ITS .CALLS) + +.SNAME +* +* system name + + This is a word of six sixbit characters which is + the default "directory name" for various input/output + operations. It is initially the same as the job's + .UNAME (q.v.). It can be overridden by supplying the + directory name explicitly to a symbolic system call. + The other uuo's such as .OPEN and .FDELE always use .SNAME. + +.SUPPRO +- +- superior + + This is -1 if the job is top-level, or the user index + of the job's superior. See .UIND. + + +.SV40 +- +- saved 40 + + The contents of absolute location 40 (i.e., the last + uuo that trapped to the system for this job). + See also the .UUOH user variable. + Note that only uuo's 40-47 are really used for + communication with the system. All other uuo's are + handed back to the executing job via its .40ADDR + user variable (q.v.). + + +.TR1INS +? +? Trap 1 instruction. + + This is the instruction to be executed when arithmetic + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR1INS are simply %PIARO to + set the overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TR2INS +? +? Trap 2 instruction. + + This is the instruction to be executed when pdl + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR2INS are simply %PIPDL to + set the pdl overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TTST +- +- saved TTYSTS + + In a job which does not have the TTY, this variable + holds the saved contents of TTYSTS (what would be in + TTYSTS if the job were given a TTY). This is primarily + useful for examining from DDT. + See ITS TTY for a description of the contents of TTYSTS. + See also the TTYGET and TTYSET symbolic system calls. + + +.TTS1 +- +- saved TTYST1 + + Like .TTST, but for the TTYST1 variable instead of the + TTYSTS variable. + + +.TTS2 +- +- saved TTYST2 + + Like .TTST, but for the TTYST2 variable rather than the + TTYSTS variable. + +.TTY +* +* random TTY variable + + This variable indicates the status of the job with + respect to the console controlling its job tree. + The %TBNVR, %TBINT, %TBWAT, %TBOUT, %TBINF, %TBOIG, and %TBIIN bits + are settable. %TBWAT may be set only by the superior. + 4.9 %TBNOT Does not have TTY now. + 4.8 %TBNVR If 1, an OPEN on the tty will fail + rather than hanging, unless %TBWAT is on. + 4.7 %TBINT An attempt to use the console without owning + it will cause a %PITTY interrupt (LH of + the .PIRQC user variable), unless + %TBWAT is set to 1. + In particular an OPEN on the tty + will interrupt instead of failing or + hanging. + 4.6 %TBWAT If 1, overrides the setting of %TBINT + and %TBNVR, and makes the system act + as if they were 0. Settable only with + .USET. DDT sets this bit when $P'ing a + job, so that even if the job loses the tty + momentarily it will not get upset. + 4.4 %TBDTY If the TTY was taken from the job, + then when it gets it back, this bit says + that the TTY should stay with the job + and not be passed down to an inferior. + 4.3 %TBOUT Allow this job to type out, even if it + doesn't have the TTY. Some operations, + and all input will still require the job + to have the TTY. Not effective unless + the superior enables it by setting %TBINF + in the superior's .TTY var. + 4.2 %TBINF Enable this job's inferiors to take + advantage of their %TBOUT's. + 4.1 %TBOIG Ignore output. Overrides %TBWAT, %TBINT. + 3.9 %TBIIN Interrupt on attempt to do input. Overrides + %TBWAT. + 3.6-3.1 $TBECL Number if echo lines, if the job + doesn't currently have the TTY. + 2.9-1.1 If the job has the TTY, this is the TTY number. + If it doesn't, and doesn't want it, this is the + (internal) user number of the immediately + inferior job to give the TTY to. + +.TVCREG +* +* TV console register + + Initially -1. + This variable is placed in the console register + when the job is run if it is non-negative. + It controls which video buffer memory is used + when writing into the job's tty's TV buffer + (see the CORBLK symbolic system call). + The format of the console register is as follows: + 4.9-4.2 ALU function, used when writing into TV memory: + VALUE SYMBOL FUNCTION + 0 CSETC SETCAM + 1 CNOR ANDCBM + 2 CANDC ANDCAM + 3 CSETZ SETZM + 4 CNAND ORCBM + 5 CCOMP SETCMM + 6 CXOR XORM + 7 CANCSD ANDCMM + 10 CORCSD ORCAM + 11 CEQV EQVM + 12 CSAME SETMM/MOVES/JFCL + 13 CAND ANDM + 14 CSETO SETOM + 15 CORSCD ORCMM + 16 CIOR IORM + 17 CSET SETAM/MOVEM + Note that those symbols are not predefined in MIDAS. + 4.1-3.3 Video buffer number (video switch input number). + See the VIDSW symbolic system call. + + +.UIND +- +- user index + + The unique number assigned to the job by the system + when the job was created. These numbers typically + are between 0 and 77 octal or so (the exact maximum value + is a function of the particular incarnation of the + system). When a job is killed, its user index is + freed for re-use. + Most symbolic system calls which require a job + to be specified will accept 400000+the user index + in lieu of a channel with the job open on it if the + call is only to examine the job and not to modify it. + The .GUN and DETACH commands require a user index. + Jobs 0 and 1 are special in that they always stand for + the system itself and for the CORE job, respectively. + (The CORE job manages core allocation for the system.) + This may have various implications depending on context; + for example, when sharing a page with a job via the + CORBLK symbolic system call, sharing with + job 0 means sharing with an absolute page, and "sharing" + with job 1 means getting a fresh page. + +.UNAME +- +? user name + + A word of sixbit characters which is the user + name of the job. All jobs in a given job + tree must all have the same user name. Furthermore, + a console-controlled tree may not log in if another + console-controlled tree is logged in under the same + uname. When a new console-controlled tree is created + by typing ^Z on a free console, the uname of the newly + created top-level job of the tree is set to "___nnn", + where "nnn" is the user index of the newly-created + job. A non-disowned non-console controlled job is also given + such a uname initially. This may subsequently be changed to + something more reasonable by using the LOGIN symbolic + system call. + The uname of a newly created inferior job is initialized + to the uname of its creator. + If a disowned job tree is re-owned, the unames of all the + jobs in the re-owned job tree are set to the uname of the + re-owning job tree. + The .UNAME user variable may be set only with a .SUSET, and + only by a top level job which has no direct inferiors; + furthermore, attempting to set the uname to zero or the left + half to -1 causes an illegal operation interrupt (bit 1.6 of + the .PIRQC user variable), as does attempting to make the + uname-jname pair of the job non-unique. + See also the .JNAME user variable. + +.UPC +* +- user program counter + + The PC for the job. This word, of course, + contains the PC flags in the left half; + a job may set these flags for itself only by + using JRST 2,@[]. + On KA's, the flags in the left half are as follows: + (- = .USET may not set; % = peculiar to ITS) + %PCARO==400000 Overflow. + %PCCR0==200000 Carry 0. + %PCCR1==100000 Carry 1. + %PCFOV==40000 Floating overflow. + %PCFPD==20000 First part of instruction already done. + %PCUSR==10000 - User mode. + %PCUIO==4000 - User I/O. + %PCPUR==2000 % Pure. Instructions may only be fetched from + read-only memory. See bit 3.7 of the .PIRQC user + variable. This feature is not available on + all machines -- beware! + %PCSPC==1000 - Unused. (A PDP6 feature) + %PC1PR==400 % One proceed. An interrupt will occur at the end + of the next instruction. See bit 2.3 of the .PIRQC + user variable. Used by DDT for ^N commands. + %PCX17==200 % AI KA-10 computer only. Index-off-the-PC hack. + When this bit is set, an index field of 17 means + index off the PC instead of ac 17. + %PCFXU==100 Floating underflow. + %PCDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + On KL's the flags are as follows (note the "|" at the front + of lines that differ significantly from those for KA's): + +| %PSPCP==400000 "Previous Context Public" - this applies only + in exec mode; in user mode this bit is the same + as in KA (%PCARO, Arithmetic overflow). + %PSCR0==200000 Carry 0. + %PSCR1==100000 Carry 1. + %PSFOV==40000 Floating overflow. + %PSFPD==20000 First part of instruction already done. + %PSUSR==10000 - User mode. + %PSUIO==4000 - User I/O. +| %PSPUB==2000 "Public Mode" - not used in ITS +| %PSINH==1000 Inhibits MAR-breaks and trap3 (one-proceed trap) +| for one instruction. +| %PSTR2==400 Set by pdl overflow; causes the "trap 2 instruction" +| to be executed. That instruction is kept in .TR2INS +| %PSTR1==200 Set by arithmetic overflow; causes the +| "trap 1 instruction" in .TR1INS to be executed. +| Both %PSTR1 and %PSTR2 set generates a one-proceed +| trap. +| %PS1PR==160 % %PSINH+%PSTR2+%PSTR1. Setting those bits +| causes a single instruction proceed. + %PSFXU==100 Floating underflow. + %PSDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + The user mode (4.4) is always set to 1. + The user I/O bit (4000, bit 4.3) is set according + to whether the job is in .IOTLSR mode. + + If the .UPC user variable for one job is read by another while + the first is running, an exec mode PC may be seen (bit 4.4 = 0); + this reflects the fact that the job is in the middle + of a system call or something. The .UUOH user variable + should then be examined (this is precisely what DDT does + for the evaluation of .). + +.USTP +* -- user stop bits + + Initially <100000,,>. + If this variable is non-zero, the job is being blocked + from running for one reason or another. If zero, the + .FLS variable controls whether the job may run. + The form of the .USTP variable is as follows: + 4.9 BCSTOP Job is being moved in core. + 4.8 BUCSTP Core job is stopping this job + in order to get more core for another job. + 4.7 BUSRC User control bit. Only this + bit may be modified, and only by the + procedure's superior. Any attempt to + set the .USTP variable non-zero + will set this bit; any attempt to set it + to zero will clear this bit. + 4.6 BSSTP Set while superior is altering the page + map for the job. (Not directly settable + by superior.) + 2.9-1.1 Count of transient reasons for stopping the job. + If non-zero, inhibits relocation of the job by + the core job. + PEEK displays this variable by printing the high six bits + in octal, then a "!", then the rest in octal. This is + why one normally sees "10!0" for a stopped job. + + +.UTRP +* -- user trap switch + + When non-zero, this switch specifies that all uuo's + which trap to the system should, instead of performing + their usual actions, should cause a word 1 class 1 + interrupt to the job executing the uuo. This allows + simulators, etc., to trap all uuo's executed by a job. + An attempt to set this variable will use only bit 1.1. + + This is the same as the %OPTRP bit of the .OPTION user variable. + + +.UUOH +- +- system uuo PC + + The program counter as of the last uuo which trapped + to absolute location 40 (not location 40 in the job, + nor the location specified by .40ADDR!) + See also the variable .SV40. + + +.VAL +* +* value or error code of job + + .VALUE instructions set this word to the contents + of the memory location they address. That is useless. + More importantly, .LOSE instructions, and the LOSE + system call, set .VAL to ,,, so that the superior can decode the + error. + +.WHO1 +* +* user who-line control word + + This variable controls the printing of .WHO2 and .WHO3 + at the end of the TV who-line (see ITS TV). + 4.9 If 1, suppress the who-line entirely when focused + on this job. + 4.8 Suppress space between halves of .WHO2. + 4.7-4.5 Mode for printing left half of .WHO2: + 0 Do not print. + 1 Date in packed form: + 4.9-4.3 Year (mod 100.). + 4.2-3.8 Month. + 3.7-3.3 Day. + 3.2-3.1 Unused. + See the RQDATE symbolic system call, but + note that here the date is shifted. + 2 Time in fortieths of a second, printed in tenths + in the form HH:MM:SS.T. + 3 Time in half-seconds, printed in the form HH:MM:SS. + 4 Octal halfword. + 5 Decimal halfword (no . is supplied). + 6 Three sixbit characters. + 7 Unused. + 4.4-4.2 Mode for printing right half of .WHO2. + 4.1 Print 3.9-3.3 twice (doubled character). + 3.9-3.3 If non-zero, character to print after left half of .WHO2. + 3.2 If 1, suppress the space between .WHO2 and .WHO3 printout. + 3.1 If 1, suppress the space between halves of .WHO3. + 2.9-2.7 Mode for printing left half of .WHO3. + 2.6-2.4 Mode for printing right half of .WHO3. + 2.3 Print 2.2-1.5 twice. + 2.2-1.5 If non-zero, character to print after left half of .WHO3. + 1.4-1.1 Unused. + That is, if the who-line is printed at all, what appears + at the end is these characters: + AAAAXX-BBBB=CCCCYY+DDDD + where: AAAA is the result of printing the left half of .WHO2. + BBBB right half of .WHO2. + CCCC left half of .WHO3. + DDDD right half of .WHO3. + XX one or two characters specified by .WHO1 4.1-3.3. + YY one or two characters specified by .WHO1 2.3-1.5. + - space, unless .WHO1 4.8 is 1. + = space, unless .WHO1 3.2 is 1. + + space, unless .WHO1 3.1 is 1. + Note that the specifications fall neatly into 8-bit bytes + (for the convenience of the PDP-11); hence it is easiest + to specify this word using .BYTE 8 in MIDAS. + Example: + .SUSET [.SWHO1,,[ .BYTE 8 ? 166 ? 0 ? 144 ? 200+", ]] + causes .WHO2 to appear as a word of sixbit, and .WHO3 to + appear as octal halfword typeout in mmm,,nnn format. + + +.WHO2 +* +* first user who-line variable + + See .WHO1 for details. + + +.WHO3 +* +* second user who-line variable + + See .WHO1 for details. + +.XJNAME +* +* "intended" job name. + + This variable holds what the job's name was "intended" + to be, by its creator. Why might the job's name not + actually be what it was intended to be? Perhaps because + that name was already in use by some other job, and the + creator had to find a second choice. For example, when + :NEW T in DDT creates a job named T0 because there was + already a job named T, the job T0's .XJNAME will be "T". + In any case, when using the common technique of having + several programs be links to one file, which figures + out what name it was invoked under and behaves + accordingly, the .XJNAME is the right place to look to + find out what behavior the invoker desires. + + When a job is first created, its .XJNAME is the same as it's .JNAME. + + +.XUNAME +* +* "real" user name. + + This variable holds what says who you really are, + as opposed to what you are logged in as. + It should be a word of sixbit, just like .UNAME. + For example, if you are logged in as FOO1 then + your XUNAME will probably be FOO, because that's + what DDT will normally set it to. However, though + the .UNAME may change because of reowning or attaching, + the .XUNAME will ot change iunless requested specifically. + However, the user may alter DDT's .XUNAME by depositing in + ..XUNAME, which works by informing DDT and having DDT + tell ITS. + Whenever an inferior is created, its .XUNAME is initialized + from its superior's. diff --git a/sysdoc/usets.120 b/sysdoc/usets.120 new file mode 100644 index 0000000..29a78a1 --- /dev/null +++ b/sysdoc/usets.120 @@ -0,0 +1,1423 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS USETS: + +This file attempts to maintain up-to-date documentation on +all user variables hacked by .USET/.SUSET. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the .FOO user var ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- +Each job running under ITS has a large number of variables +associated with it maintained by the system. In order to +examine and set these variables, the .USET and .SUSET +uuo's are provided. The .USET uuo allows the specification +of the job whose variables are to be accessed. The .SUSET +uuo always accesses the variables of the job which executes it +(SUSET = Self USET). + +The .USET uuo is used like this: .USET CHNL,SPEC +and the .SUSET uuo like this: .SUSET SPEC +The ac field CHNL of the USET must be the number of +an input/output channel for which a job is open, +as either the USR, JOB, or BOJ device. +The .USET may modify the variables only +if it has modification rights to the job (the job +is a JOB device, or is a direct inferior). + +The contents of the effective address SPEC are of this form: + 4.9 0 = read variable, 1 = set variable. + 4.8 Block mode (see below). + 4.7-3.1 Number of user variable to access. + 2.9-2.1 Address of a location within the caller which + is to receive the value of the variable, or which + contains the new value for the variable. +If bit 4.8 is 1, then the word at location SPEC is really +an AOBJN pointer to a block of specifications. This is +useful for getting several variables at a time easily. +The AOBJN pointer is updated as the operation progresses, +and so must be in a writable area. Block mode may not be nested. +If an illegal specification is given to .USET or .SUSET, +the job will receive an illegal operation word 1 interrupt +(bit 1.6 of the .PIRQC user variable). + +The variables are described in this document by the names which +DDT knows for them; the first character of each name is a ".". +If you open up a location by using one of these names, DDT +treats it specially and actually accesses the corresponding +variable and not a location in the job's core. + +When writing .USET's and .SUSET's in MIDAS code, +one may use the symbols defined by MIDAS for accessing them. +These are the same as the names known to DDT, except that +the "." is followed by "R" for reading or "S" for setting. + +If you open a location containing a SPEC, try typing +.R$?? if it is positive, or .S$?? if it is negative; this will +use bit typeout mode to print out the spec as it might have been +assembled; for example, 400001,,500 .S$?? gives .SVAL,,500 . + +Examples: + +To read your own runtime in 4-microsecond ticks into FOO: + + .SUSET [.RRUNT,,FOO] + +To set your word 1 interrupt mask: + + .SUSET [.SMASK,,[%PIDWN\%PIPDL]] + ;enable "pdl overflow" and "sys going down" interrupts + +To read your input/output status word for channel 13 into FOO: + + .SUSET [.RIOS+13,,FOO] + +To start a job (your immediate inferior!) open on channel + USRC at its location QUUX, with its option + bits indicating your readiness to supply JCL: + + .USET USRC,[.SOPTION,,[%OPCMD,,]] + .USET USRC,[.SUPC,,[QUUX]] + .USET USRC,[.SUSTP,,[0]] + +Another way to do the same thing is: + + MOVE AC,[-3,,USBLOK] + .USET USRC,AC + . . . +USBLOK: .SOPTION,,[%OPCMD,,] + .SUPC,,[QUUX] + .SUSTP,,[0] + +FORM OF DESCRIPTIONS: + +The descriptions of the various variables accessible by +.USET and .SUSET are in the following form: + + + + + +The descriptor contains four characters "wx yz". +The first two ("wx") refer to the access for .USET; +the last two ("yz") to the access for .SUSET. +In each case these characters are chosen from these sets: + -- May neither read nor set. + +- May read but not set. + +* May read and set. + +? May read, may sometimes set (please read on...) +That is, + means may read, * may set, - denies access, +while ? says that things are more complicated. + +.40ADDR +* +* "40" address + + The right half: + + Initially 40 octal. Whenever the system + references locations "40" through "44" specifically, + (e.g. giving the user interrupts, or returning uuo's 50-77), + the system really references the 5-word block that + .40ADDR points to. Thus, if .40ADDR is set to 500, the + system expects location 502 to contain the address of + the interrupt routine. This is especially useful to + distinguish system-returned uuo's (0 and 50-77) from + standard user-mode uuo's (1-37); the latter always + trap through location 40, while the former trap + through .40ADDR. + The various words accessed through .40ADDR are + as follows (indexed by "normal" location #): + 40 System places a uuo here when it wants + to give it to the user. + 41 Should contain the address of the uuo handler. + If .40ADDR is not indeed 40, this + may be a different uuo handler from the + one which handles uuo's 1-37. + If .40ADDR is actually 40, then unless + 41's index and indirect fileds are 0 and its + opcode is either 0 or JSR, all system-returned + UUOs will cause ILOPR interrupts instead. + This is to protect programs that want their + hardware user-UUOs to be handled by a PUSHJ + from being clobbered when they accidentally + execute a meaningless UUO. + 42 If the job's %OPINT bit in its + .OPTION variable (q.v.) is 0, then + this is a JSR to the user's old-style + interrupt handler. The three words addressed + by the JSR are, in order, the word in + which the interrupt bits are placed, the + return address for the interrupt, and the + first instruction of the handler. + If the %OPINT bit is 1, then this + is an AOBJN pointer to a vector of + 5-word blocks describing the various + interrupt handlers and their priorities. + See ITS INTRUP for details. + 43 If the job's %OPLOK bit is set in + its .OPTION variable, then this is + the pointer to the list of switches + to be reset if the job is killed. + 44 If the job's %OPLOK bit is set, + this is an AOBJN pointer to a block + of critical code region descriptors. + See ITS LOCKS for details. + + The left half: + + Initially 20 octal. This is the address of a block of + 20 octal words which a job's superior may use to hack + that job. For compatibility, if LH(.40ADDR) is zero, + the default of 20 will be assumed. + +.ADF1 +* +* ANDCAM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs ANDCAM into .DF1 when writing. + + +.ADF2 +* +* ANDCAM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs ANDCAM into .DF2 when writing. + + +.AIFPIR +* +* ANDCAM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs ANDCAM into .IFPIR when writing. + + +.AMASK +* +* ANDCAM into .MASK + + Like .MASK (q.v.) when reading. + Performs ANDCAM into .MASK when writing. + + +.AMSK2 +* +* ANDCAM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs ANDCAM into .MSK2 when writing. + + +.APIRQC +* +* ANDCAM into .PIRQ + + Like .PIRQC (q.v.) when reading. + Performs ANDCAM into .PIRQC when writing. + +.APRC +- +- APR CONO + + 4.9 Procedure is in a disowned tree. + 4.7 (BUMRTL) Tree will be gunned if hasn't run for an hour + (meaningful only in top level job). Cleared by reowning or + attaching. See the DETACH and DISOWN system calls. + 4.6 Core request pending for this job. + 4.5 User disabled, waiting to be flushed by SYS job. + The SYS job will delete the job tree eventually. + 4.4-4.1 .BCHN user variable (q.v.). + 3.9 In process of deleting or logging out this job. + Bit 4.5 will probably be set eventually. + 3.5-3.1 Must be zero. + 2.9-1.1 CONO'ed to APR whenever job is about + to be run. Initially 447. Modified by + altering the .MASK user variable. + + +.BCHN +* +* bad channel number + + Initially 0. + Number of channel most recently in error. + Typically after reading this variable one does a + .STATUS or a STATUS symbolic system call + to get the status word for the channel. This word + can then be fed to the ERR device. + .BCHN is actually part of the .APRC variable. + See also the .IOS variable. + + +.CNSL +- +- console tty number + + If the job is in a console-controlled tree, this + variable contains the console's number, even if + the job doesn't own the console. If the job is + in a non-console-controlled tree, .CNSL is -1 + if the job is scheduled as part of the system, + -2 if the job is scheduled as a disowned job; + for a job-device-handler job, .CNSL is the same + as it is for the job it is serving. + + +.DF1 +* +* defer bits, word 1 + + Initially 0. + Defer bits for word 1 interrupts (see .PIRQC + and .MASK). If an interrupt bit is set in both + .PIRQC and .MASK, but is also set in .DF1, + it is temporarily deferred. + + +.DF2 +* +* defer bits, word 2 + + Initially 0. + Defer bits for word 2 interrupts (see .IFPIR + and .MSK2). If an interrupt bit is set in both + .IFPIR and .MSK2, but is also set in .DF2, + it is temporarily deferred. + +.EBO1 +- +- KL-10 Ebox counter + + This is the low-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + Its location is .EBOX+1, for convenience. + + +.EBOX +- +- KL-10 Ebox counter + + This is the high-order word of the KL-10 Ebox counter + value for the job. It contains garbage on KA-10's. + + +.FLS +- -- flush instruction + + Initially 0. + The instruction which is blocking the running of + the job. Zero if user not blocked (user can run + if .USTP is also zero). + (The scheduler tests a job for runnability by first + checking the .USTP variable, and if it is zero, + then executing the flush instruction. The job is + runnable iff the flush instruction skips.) + + +.FTL1 +- +- Fatal interrupt first word + + After a fatal interrupt, this variable contains the + .PIRQC bits which caused the error. At any other time + it contains garbage. + +.FTL2 +- +- Fatal interrupt second word + + After a fatal interrupt, this variable contains the + .IFPIR bits which caused the error. At any other time + it contains garbage. + + +.HSNAME +* +* Home System Name + + This is a word of sixbit like .SNAME (q.v.). It + is initialized to be the same as the UNAME on creation + of a not-logged-in tree, and when a job is created + as an inferior or as a job device, it's .HSNAME is + copied from that of it's creator. The LOGIN system call + sets it to be the same as the UNAME, although this should + be changed to be the XUNAME. + + This is not used by ITS for anything, but is intended to + associate a directory with a specific XUNAME for the sake + of init and mail files of people without a directory of + the same name as their XUNAME. DDT will soon initialize + it by looking up information in the INQUIR database for + the particular user. + +.IDF1 +* +* IORM into .DF1 + + Like .DF1 (q.v.) when reading. + Performs IORM into .DF1 when writing. + +.IDF2 +* +* IORM into .DF2 + + Like .DF2 (q.v.) when reading. + Performs IORM into .DF2 when writing. + + +.IFPIR +* +* inferior procedure and i/o requests (?) + + Initially 0. + This variable contains bits for pending word 2 interrupts. + + Bit 3.n is the interrupt bit for the n'th job directly + inferior to the specified job (see the .INTB user variable). + These therefore occupy bits 3.8-3.1. + An inferior interrupt bit is set if an a class 1 + or untrapped class 2 interrupt occurs in the inferior, + or if the inferior is using new-style interrupts + (see ITS INTRUP, and the %OPINT bit of the .OPTION + user variable) and any unhandled interrupt occurs. + Performing a .UCLOSE on an inferior clears the + inferior interrupt bit in the .IFPIR variable + of the job performing the .UCLOSE. + + Bit 1.n is the interrupt bit for input/output + channel n-1 (actually, these occupy bits 2.7-1.1). + Thus bit 1.1 = channel 0, 1.2 = channel 1, + 1.3 = channel 2, . . ., bit 2.7 = channel 17. + When an input/output interrupt is detected, the + system call WHYINT shoud be used to discover the + cause (see ITS .CALLS). + + The following devices can cause channel interrupts: + + TTY Input: A character was typed which according + to the job's TTYST1 and TTYST2 variables + (see ITS TTY) should be treated as an interrupt + character. If the tty is opened for input + on more than one channel, only one channel, + if any, receives the interrupt. + Output: The **MORE** condition has occurred. + See ITS TTY. + STY Input: Input is pending (i.e. the corresponding TTY + has attempted output). If the STY is open + for input on more than one channel, only + one channel, if any, receives the interrupt. + See ITS TTY. + Output: The STY's alter ego is waiting for input, + or at least was (it isn't guaranteed not to + stop waiting and do something else). + STK Input is available. Interrupts occur on all enabled channels. + USR A foreign job open on the channel has been killed. + If the job went away while the channel was pushed + on the I/O pdl, this interrupt will occur when the + channel is popped. See the .UCLOSE, .IOPUSH, and + .IOPOP uuo's. + If the job is the PDP-6, the PDP-6 has requested an interrupt. + JOB Various conditions, some programmable. See ITS JOB. + BOJ Various conditions, some programmable. See ITS JOB. + NET One of the following conditions has occurred: + The IMP has gone down. + RFC received. + After RFC sent, the connection is now open. + Input available. + Connection closed. + Net interrupt received (INR or INS). + MSP Message has been sent. + +.IIFPIR +* +* IORM into .IFPIR + + Like .IFPIR (q.v.) when reading. + Performs IORM into .IFPIR when writing. + + +.IMASK +* +* IORM into .MASK + + Like .MASK (q.v.) when reading. + Performs IORM into .MASK when writing. + + +.IMSK2 +* +* IORM into .MSK2 + + Like .MSK2 (q.v.) when reading. + Performs IORM into .MSK2 when writing. + + +.INTB +- +- interrupt bit + + Gets the interrupt bit for the procedure. This is + the word 2 interrupt bit which the procedure's + superior will see when the procedure interrupts + its superior. This variable will therefore have + exactly one of bits 3.1-3.8 set, and no others. + If the procedure is top level (has no superior), + then this variable is negative. + + +.IOC + +- +- input/output channel + + The variable .IOC+ is the input/output channel + word for channel , for n between 0 and 17 octal. + Normally zero for a closed channel. + + +.IOP + +- +- input/output pdl + + The input/output pdl is a pdl of two-word entries + used by the .IOPUSH, .IOPOP, and .IOPDL uuo's. + The first word of each pair is the .IOC word for + the stacked channel, and the second is the .IOS word. + In addition, bits 4.9-4.6 of the .IOS word of each + pair contain the channel number which the channel was + pushed from (this is used by the .IOPDL uuo). + The pdl has eight entries; thus should be between + 0 and 17 (0 is the .IOC word for the least recently + pushed entry, etc.). + +.IOS + +- +- input/output status + + The variable .IOS+ is the input/output status + word for channel , for between 0 and 17 octal. + Normally zero for a closed channel. + This word contains various bits describing the status + of the channel. The left half is a set of error + codes if non-zero; the .IOS word can be given to + the ERR device to obtain an ascii message for + the error. The right half contains various bits + describing the state of the device. (Internally to + ITS, the right half contains an access pointer; + the right half bits supplied for .IOS are the + same as those generated by the .STATUS uuo or + the STATUS symbolic system call.) + + The various bits in the .IOS word are as follows: + 4.9-4.6 Always zero (see the .IOP variable). + 4.5-4.1 If non-zero, the number of a non-display + input/output error (see table below). + 3.9-3.7 If non-zero, the number of an IDS interpreted + display input/output error (see table below). + 3.6-3.1 If non-zero, the number of a standard error. + Set primarily by failing .OPEN's and + .FDELE's. These are the same as the error + codes returned by failing .CALL's (see + table below). + 2.9-2.3 Device dependent. + 2.2 Buffering capacity empty. + 2.1 Buffering capacity full. + 1.9-1.7 Mode in which device was opened. + 1.9 0 = ascii, 1 = image. + 1.8 0 = unit, 1 = block. + 1.7 0 = input, 1 = output. + 1.6-1.1 ITS internal physical device code + (see table below). + + The error messages indicated by bits 4.5-4.1 are: + 1 DEVICE HUNG OR REPORTING NON-DATA ERROR + 2 END OF FILE + 3 NON-RECOVERABLE DATA ERROR + 4 NON-EXISTENT SUB-DEVICE + 5 OVER IOPOP + 6 OVER IOPUSH + 7 USR OP CHNL DOES NOT HAVE USR OPEN + 10 CHNL NOT OPEN + 11 DEVICE FULL (or directory full) + 12 CHNL IN ILLEGAL MODE ON IOT + 13 ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY + 14 DIRECTORY FULL + 15 DIRECTORY'S ALLOCATION EXHAUSTED + + The error messages indicated by bits 3.9-3.7 are: + 1 IDS ILLEGAL SCOPE MODE + 2 IDS SCOPE HUNG + 3 MORE THAN 1K SCOPE BUFFER + 4 IDS MEM PROTECT + 5 IDS ILLEGAL SCOPE OP + 6 IDS MEM PROTECT ON PDL PNTR + 7 IDS ILLEGAL PARAMETER SET + + The error messages indicated by bits 3.6-3.1 are: + 1 NO SUCH DEVICE + 2 WRONG DIRECTION + 3 TOO MANY TRANSLATIONS + 4 FILE NOT FOUND + 5 DIRECTORY FULL + 6 DEVICE FULL + 7 DEVICE NOT READY + 10 DEVICE NOT AVAILABLE + 11 ILLEGAL FILE NAME + 12 MODE NOT AVAILABLE + 13 FILE ALREADY EXISTS + 14 BAD CHANNEL NUMBER + 15 TOO MANY ARGUMENTS (CALL) + 16 PACK NOT MOUNTED + 17 DIRECTORY NOT AVAIL + 20 NON-EXISTENT DIRECTORY NAME + 21 LOCAL DEVICE ONLY + 22 SELF-CONTRADICTORY OPEN + 23 FILE LOCKED + 24 M.F.D. FULL + 25 DEVICE NOT ASSIGNABLE TO THIS PROCESSOR + 26 DEVICE WRITE-LOCKED + 27 LINK DEPTH EXCEEDED + 30 TOO FEW ARGUMENTS (CALL) + 31 CAN'T MODIFY JOB + 32 CAN'T GET THAT ACCESS TO PAGE + 33 MEANINGLESS ARGS + 34 WRONG TYPE DEVICE + 35 NO SUCH JOB + 36 VALID CLEAR OR STORED SET + 37 NO CORE AVAILABLE + 40 NOT TOP LEVEL + 41 OTHER END OF PIPELINE GONE OR NOT OPEN + 42 JOB GONE OR GOING AWAY + 43 ILLEGAL SYSTEM CALL NAME + 44 CHANNEL NOT OPEN + 45 INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + 46 UNRECOGNIZABLE FILE (LOAD) + 47 LINK TO NON-EXISTENT FILE + + The physical device codes from bits 1.6-1.1 are as + follows. Note that, as a half-hearted rule, bit 1.6 + indicates that file names are significant, and bit 1.5 + indicates a software-implemented device. + This list is subject to additions and deletions! + CODE SYMBOL DEVICE DESCRIPTION + 0 TTY Console input. + 1 SNTTY TTY Printing console output. + 2 SNTDS TTY Display console output. + 3 SNLPD LPT Data Products line printer. + 4 SNVID VID Vidisector ??? + 5 SNBAT Vidisector ??? + 6 SNPLT PLT Calcomp plotter. + 7 SNPTP PTP Paper tape punch. + 10 SNIMPX IMX Input multiplexor. + 11 SNOMPX OMX Output multiplexor. + 12 SNPTR PTR Paper tape reader. + 13 SN340 DIS DEC 340 display, Ascii output. + 14 SN340I IDS Interpreted 340 display. ??? + 15 SNMTC MTn Magnetic tape. + 16 SNCOD COD Morse code device. + 17 SNTAB TAB Tablet. ??? + 21 SNNUL NUL Source of zeroes, or output sink. + 22 SNJOB JOB Job device. + 23 SNBOJ BOJ Inverse of JOB. + 24 SNSPY SPY Spy on another console. + 25 SNSTY STY Pseudo-teletype. + 26 SNNET NET ARPAnet (NCP). + 27 SNLPV LPT Vogue line printer (yech!) + 30 SNSTK STK Stanford keyboard. + 31 SNMSP MSP (DM) Interprocess message protocol. + 32 SNCHA CHAOS CHAOS net. + 33 SNTCP TCP TCP Internet. + 34 SNTRAP TRAP Trap "device" + 35 SNIPQ IPQ Internet IP Queue. + 36 SNUBI UBI KS10 Unibus interrupt. + 41 SNUTC UTn Microtape (DECtape). + 43 SN2311 DSK 2311 disk drives or equivalent. + 60 SNFUSR USR A foreign (not immediately inferior) procedure. + 61 SNUSR USR An immediately inferior procedure. + 62 SNCLK CLx Various core link devices (x  {AIOU}) + 63 SNDIR --- File directory or ERR device. + 64 SNPDP USR The PDP-6. + 65 SNDIRH DIRHNG Directory hang "device" + 66 SNLCK LOCK Lock "device" + +.IPIRQC +* +* IORM into .PIRQC + + Like .PIRQC (q.v.) when reading. + Performs IORM into .PIRQC when writing. + + +.JNAME +* +? job name + + The name of the job as a word of sixbit characters. + The uname-jname pair must be unique to a job + (there are some exceptions involving system-created + jobs or jobs not logged in). + The uname and jname are used as file names when + creating or subsequently opening the job on the USR + device. See also the .UNAME user variable. + The .JNAME variable may be set by a .SUSET only in a + top-level job, and then only if the job has no + inferiors. + Attempting to set a jname to zero causes an + illegal operation interrupt (bit 1.6 of the .PIRQC + user variable). So does attempting to set it such that + the uname-jname pair would no longer be unique. + So does attempting to illegally set one's own jname. + + +.JPC +* +* jump program counter + + The PC as of the most recent jump instruction, + i.e. an instruction which changed the PC by other + than 1 or 2. This is actually a register in the + paging box when running. + + +.MARA +* +* MAR (memory address register) address + + Initially 0. + The address for the MAR register in the paging box, + which gives a %PIMAR interrupt when the specified operation + is performed on the specified address. + 3.3 0 = exec mode, 1 = user mode. + This is forced to 1 when set with + .SUSET or .USET; exec mode is for very + obscure system hacks only. + 3.2-3.1 0 Never interrupt. + 1 Interrupt on instruction fetch. + 2 Interrupt on write. + 3 Interrupt on any reference. + 2.9-2.1 Address for MAR. + The MAR does not work well on accumulators. + See also the .PIRQC user variable, bit %PIMAR; + and ITS INTRUP and ITS USR. + +.MARPC +* +* MAR program counter + + The PC as of the instruction that most recently + tripped the MAR interrupt, if any. In addition, + the indirect bit will be set if that instruction + completed successfully (was not aborted by the MAR + hit). See the .MARA user variable. + + +.MASK +* +* word 1 interrupt mask + + Initially 0. + This is a mask for word 1 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 1 interrupt tries to + occur, but the corresponding bit in .MASK is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MASK directly + correspond to those in .PIRQC (q.v.). Bits for class + 1 interrupts are AND'ed out before setting the .MASK + variable. + + +.MBO1 +- +- KL-10 Mbox counter + + This is the low-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + Its location is .MBOX+1, for convenience. + + +.MBOX +- +- KL-10 Mbox counter + + This is the high-order word of the KL-10 Mbox counter + value for the job. On KA-10's, it holds garbage. + + +.MEMT +* +* memory top + + This variable contains 1 plus the highest legal + address in the job (the accessible word with the + largest address). Setting this variables is like + performing an equivalent .CORE uuo (q.v.): + .SUSET [.SMEMT,,[FOO]] + is like doing: + .CORE _12 + + +.MPVA +- +- memory protect violation address + + The address which the last instruction to cause a memory protection + violation (or a write into read only memory violation) attempted to + reference, on KA-10's rounded down to a page boundary. Thus an + attempt to reference the non-existent location 317435 would cause + .MPVA to be set to 316000 octal on a KA-10, or 317435 on a KL-10. + + On the KS-10, .MPVA also holds the non-existant IO register address + after a %PINXI. + + See also the .PIRQC variable. + +.MSK2 +* +* word 2 interrupt mask + + Initially 0. + This is a mask for word 2 interrupts which indicates + which interrupts the job is prepared to handle. + If a class 2 or class 3 word 2 interrupt tries to + occur, but the corresponding bit in .MSK2 is not + set, then the interrupt is converted to class 1 or + ignored, respectively. The bits in .MSK2 directly + correspond to those in .IFPIR (q.v.). + + +.OPC +- +- old program counter + + The PC just before the last instruction was executed. + This corresponds to a register in the paging box. + It doesn't exist on KL-10's. + +.OPTION +* +* option bits + + Initially 0. + The bits in this word correspond to various options + as follows: + 4.9 %OPTRP Same as the .UTRP user variable. See ITS UUO. + 4.8 %OPDET ** This bit is OBSOLETE and NO LONGER EXISTS ** + It is documented for historical purposes only. + Nowadays, fatal interrupts always cause top-level + jobs to be detached. Once upon a time, top-level + jobs with consoles would be reloaded instead of + detached, unless they had set %OPDET=1. + See the DETACH and RELOAD symbolic system calls. + 4.7 %OPDEC Uuo's 40, 41, and 47 (that is, + .IOT, .OPEN, and .ACCESS) + should trap to the user as uuos + via the .40ADDR user variable (q.v.). + This is useful for programs which wish to + interpret DEC TOPS-10 UUO's, since those are the + only ones which conflict with ITS UUOs. + Luckily, those ITS UUOs are not essential since + there are symbolic system calls to do the same things. + 4.6 %OPCMD Superior claims it has JCL which + it will cheerfully supply in response to + the appropriate .BREAK 12, command. + 4.5 %OPBRK Superior claims to handle all .BREAK's. + 4.4 %OPDDT Superior claims to be DDT. + 4.3 %OPINT Job desires new-style (vectored + and stacked) interrupts. See also the + .40ADDR variable. See ITS INTRUP for + information on old- and new-style + interrupts. + 4.2 %OPOJB Other jobs may open this job + as the OJB device, thereby turning it + into a JOB device. See ITS JOB. + 4.1 %OPLOK Job desires the switch locking + and unlocking synchronization feature. + See also the .40ADDR variable. + See ITS LOCKS for information on locks. + 3.9 %OPLIV The job tree of which this is the + top-level job is permitted to survive a + system shutdown -- it should take care + of logging itself out. See the .SHUTDN uuo. + Meaningful only for top-level jobs. + Primarily useful for system demons which need to + survive system death (e.g. the statistics + demon PFTHMG DRAGON). + 3.8 %OPOPC Job desires that instruction-aborting interrupts + such as MPV leave the PC pointing before the + instruction that lost, instead of the old + convention of leaving it pointing after. + The new convention is far better and all new + programs should use it. + 3.7 %OPLSP Superior claims to be MacLisp. + 3.6 %OPLKF Unlock locks on fatal interrupt. When a + non-disowned top-level job receives a fatal + interrupt, if it has set this bit, its locks will + be unlocked by the system job as part of the + process of detaching it. See the %OPLOK bit and + ITS LOCKS. + +.PAGAHEAD +* +* page-ahead control + + Normally zero, this word is set nonzero to enable + sequential paging through a part of the address space + specified by .PAGRANGE. The right half of .PAGAHEAD is + the page-ahead interval width and the left half is the page-behind + distance. Each time a page in the designated range is + touched for the first time, the next few pages, forming the + page-ahead interval begin to swap in, and a page a certain + distance behind (specified by the page-behind distance) is + swapped out or marked for swap out in the near future. The + precise treatment depends on how loaded the system is. + + Exactly one of the page-ahead interval width and the + page-behind distance should be negative. The page-behind + distance should be negative, if memory is being used from low + addresses to high ones. The page-ahead width should be + negative if moving from high addresses to low ones. + + Example: -2,,4 means on first reference to page n, start + reading in pages n+1 through n+4 and possibly swap out page n-2. + Page n-1 is not affected until page n+1 is touched. A + page-behind distance of 2 means that two consecutive pages are + always available. + +.PAGRANGE +* +* page-ahead range + + Normally zero, this word is made nonzero together with .PAGAHEAD + to enable the sequential paging feature. The two halves of + .PAGRANGE are page numbers which specify the region of the + address space in which sequential paging should go on. + The left half specifies the first page in the sequentially + paged region, and the right half specifies the first page + after the end of that region. + +.PICLR +* +* priority interrupt clear + + Initially -1. + If non-zero, the job may take interrupts. If zero, + interupts are deferred. This variable is cleared + when an old-style interrupt occurs (but not by new-style + interupts!), and is set to -1 by the .DISMISS uuo + and the DISMIS symbolic system call. Attempts + to set this variable will convert the value to -1 or 0 + depending on bit 4.9. + + +.PIRQC +* +* priority interrupt request cruft (?) + + This word contains bits for pending word 1 interrupts. + Setting bits in this causes the corresponding interrupts + to attempt to take place, subject to .MASK, .DF1, + .PICLR (q.v.), and the %OPINT bit of the .OPTION user + variable (see ITS INTRUP). + + Interrupts are of three classes: + 1 Very serious. The job is stopped and its + superior interrupted. + 2 Semi-serious. The job may request to handle + such an interrupt by setting the corresponding + bit in .MASK (q.v.); otherwise it is treated + as a class 1 interrupt. + 3 Trivial. The job receives the interrupt if it + has requested to handle it; otherwise the + interrupt condition is ignored. (Under the + new-style interrupt scheme, a class 3 interrupt + may become a class 1 interrupt.) + See also the .IFPIR variable for word 2 interrupts. + + The interrupt bits and their classes are as follows. + The character * denotes a class 1 interrupt, and + a + class 2 interrupt. + 4.9 Must be zero. + %PIRLT 4.8 Clock break (see the .REALT uuo). + %PIRUN 4.7 Run time interrupt (see the .RTMR user variable). + %PINXI 4.6 + Non-Existent IO register + A Job in User IOT mode referenced a non-existent IO + register on the KS10 Unibus. The PC is left + pointing before the guilty instruction. The address + of the non-existant register may be found in .MPVA. + %PIJST 4.5 Job Status display request. + The sequence ^_J was typed on the console owned + by this process or some inferior. + %PIDCL 4.4 * A defered call was typed while the job had the TTY. + %PIATY 4.3 The tty was given back to the job by + its superior. Indicates that the screen has + probably been written on and its contents + have changed unpredictably. + %PITTY 4.2 + Attempt to use tty when not possessing it. + %PIPAR 4.1 + Parity error. + %PIFOV 3.9 Arithmetic floating overflow. + %PIWRO 3.8 + Attempt to write into read only memory. + See the .MPVA user variable. + %PIFET 3.7 + Pure page trap (attempt to fetch an instruction from + writable memory when bit 4.2 of the PC set). + This feature doesn't exist on KL-10's, instead + this interrupt is signalled for "Illegal entry + to concealed mode" which you probably can't make + happen. (See the KI10 Processor Reference Manual.) + See bit 4.2 of the .UPC user variable. + %PITRP 3.6 * System uuo to user trap (see the .UTRP user variable). + 3.5 Arm tip break 3 (OBSOLETE). + 3.4 Arm tip break 2 (OBSOLETE). + 3.3 Arm tip break 1 (OBSOLETE). + %PIDBG 3.2 System being debugged. + Occurs when someone uses the .SETLOC or .IFSET uuo + to alter SYSDBG and the new contents are non-zero + and the old contents non-negative. + (See also the SSTATU symbolic system call.) + %PILOS 3.1 + A .LOSE UUO or LOSE system call was executed + (their purpose is to signal the superior). + %PICLI 2.9 CLI device interrupt. + %PIPDL 2.8 Pdl overflow. + %PILTP 2.7 Light pen interrupt on 340. + Program stop or hit stop on E&S display. + %PIMAR 2.6 + MAR interrupt. + (See the .MARA and .MARPC user variables.) + %PIMPV 2.5 + Memory protection violation (attempt to reference + a page not in the job's page map). + (See the .MPVA user variable.) + %PICLK 2.4 Slow clock interrupt (every .5 second). + %PI1PR 2.3 * Single intruction proceed interrupt. + Used by DDT for ^N commands. + %PIBRK 2.2 * Breakpoint interrupt (.BREAK uuo executed). + %PIOOB 2.1 + Illegal user address. (OBSOLETE) + %PIIOC 1.9 + Input/output channel error. + (See the .BCHN and .IOS user variables.) + %PIVAL 1.8 * Value interrupt (.VALUE uuo executed). + %PIDWN 1.7 System going down or being revived. + (See the .SHUTDN, .REVIVE, and .DIETIME uuo's, + and the SSTATU symbolic call.) + %PIILO 1.6 + Illegal instruction operation. + %PIDIS 1.5 + Display memory protection violation (340 or E&S). + %PIARO 1.4 Arithmetic overflow. + %PIB42 1.3 * Bad location 42. + (See the .40ADDR user variable, and ITS INTRUP.) + %PIC.Z 1.2 * ^Z typed when this job had the TTY. + %PITYI 1.1 Character enabled for interrupt was typed on TTY. + (Semi-obsolete; see the .IFPIR user variable, + and ITS TTY.) + +.PMAP + +- +- page map word + + This is the page map word for page of the job, + for between 0 and 377 octal (256.K = 400 1K pages). + The map word read has this form: + 4.9 %CBWRT Page is writable. + 4.8 %CBRED Page exists (if this bit is zero, then the + whole word is zero). + 4.7 ??? Page is in core (as opposed to swapped out). + 4.6 %CBPUB Page is public (any job can write into it + which wants to). + 4.2 %CBLOK Page is locked in core + (inhibited from swapout) + 3.9 %CBSLO Page is in slow memory + (Doesn't work; Moon says it never will) + 3.8-3.1 Number of times the page is shared. + (See the CORTYP symbolic system call, + right half of value 4.) + 2.9-2.1 Absolute page number, or page number in next + sharer in the circular list of sharers. + (See CORTYP, value 3.) + 1.9-1.1 0 Page is absolute. + 777 Page is not shared. + Next sharer in circular list of sharers + is the job with user index . + + +.RTMR +* +* runtime timer + + Initially -1. + If non-negative, the amount of run time remaining until the job + will receive a word 1 runtime interrupt. (See bit %PIRUN of the + .PIRQC variable.) The time is measured in slightly different units + on different CPUs. On the KA in 4.069 microsecond units, on the KL + in 4 microsecond units, and on the KS in 3.9 microsecond units. + + +.RUNT +- +- run time + + Initially 0. + This is the run time used so far by the job, + measured in units of 4 microseconds. + +.SERVER +* +* server job + + Initially -1. + This is the user index of a job that has been given special + permission to modify this job, or -1 if there is no such job. + + This can be used to implement various oddball client/server + protocols between jobs. The client job will request some service + from the server job and will set his .SERVER variable to the server's + user index to allow the service to be performed. + + If the server job is killed, all of the client jobs will have their + .SERVER variables set back to -1. + + Although it is safe to set .SERVER to -1 using .SUSET or .USET, + there can be timing errors if a client loads his .SERVER variable + by simply writing the server's user index into it. Specifically, + during the time the server's user index is sitting in the client's + memory, the server job might be killed and another job started with + the same user index. This can be guarded against by handling + interrupts on the USR: channel, but this is clumsy. A better + method is to use the SSERVE system call. (See .INFO.;ITS .CALLS) + +.SNAME +* +* system name + + This is a word of six sixbit characters which is + the default "directory name" for various input/output + operations. It is initially the same as the job's + .UNAME (q.v.). It can be overridden by supplying the + directory name explicitly to a symbolic system call. + The other uuo's such as .OPEN and .FDELE always use .SNAME. + +.SUPPRO +- +- superior + + This is -1 if the job is top-level, or the user index + of the job's superior. See .UIND. + + +.SV40 +- +- saved 40 + + The contents of absolute location 40 (i.e., the last + uuo that trapped to the system for this job). + See also the .UUOH user variable. + Note that only uuo's 40-47 are really used for + communication with the system. All other uuo's are + handed back to the executing job via its .40ADDR + user variable (q.v.). + + +.TR1INS +? +? Trap 1 instruction. + + This is the instruction to be executed when arithmetic + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR1INS are simply %PIARO to + set the overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TR2INS +? +? Trap 2 instruction. + + This is the instruction to be executed when pdl + overflow occurs. Op-code 0 is special, and uses + its E.A. as interrupt bits to turn on in the RH of .PIRQC. + The default contents of .TR2INS are simply %PIPDL to + set the pdl overflow interrupt. On the KA-10, writing the + variable doesn't change it. + + +.TTST +- +- saved TTYSTS + + In a job which does not have the TTY, this variable + holds the saved contents of TTYSTS (what would be in + TTYSTS if the job were given a TTY). This is primarily + useful for examining from DDT. + See ITS TTY for a description of the contents of TTYSTS. + See also the TTYGET and TTYSET symbolic system calls. + + +.TTS1 +- +- saved TTYST1 + + Like .TTST, but for the TTYST1 variable instead of the + TTYSTS variable. + + +.TTS2 +- +- saved TTYST2 + + Like .TTST, but for the TTYST2 variable rather than the + TTYSTS variable. + +.TTY +* +* random TTY variable + + This variable indicates the status of the job with + respect to the console controlling its job tree. + The %TBNVR, %TBINT, %TBWAT, %TBOUT, %TBINF, %TBOIG, and %TBIIN bits + are settable. %TBWAT may be set only by the superior. + 4.9 %TBNOT Does not have TTY now. + 4.8 %TBNVR If 1, an OPEN on the tty will fail + rather than hanging, unless %TBWAT is on. + 4.7 %TBINT An attempt to use the console without owning + it will cause a %PITTY interrupt (LH of + the .PIRQC user variable), unless + %TBWAT is set to 1. + In particular an OPEN on the tty + will interrupt instead of failing or + hanging. + 4.6 %TBWAT If 1, overrides the setting of %TBINT + and %TBNVR, and makes the system act + as if they were 0. Settable only with + .USET. DDT sets this bit when $P'ing a + job, so that even if the job loses the tty + momentarily it will not get upset. + 4.4 %TBDTY If the TTY was taken from the job, + then when it gets it back, this bit says + that the TTY should stay with the job + and not be passed down to an inferior. + 4.3 %TBOUT Allow this job to type out, even if it + doesn't have the TTY. Some operations, + and all input will still require the job + to have the TTY. Not effective unless + the superior enables it by setting %TBINF + in the superior's .TTY var. + 4.2 %TBINF Enable this job's inferiors to take + advantage of their %TBOUT's. + 4.1 %TBOIG Ignore output. Overrides %TBWAT, %TBINT. + 3.9 %TBIIN Interrupt on attempt to do input. Overrides + %TBWAT. + 3.6-3.1 $TBECL Number if echo lines, if the job + doesn't currently have the TTY. + 2.9-1.1 If the job has the TTY, this is the TTY number. + If it doesn't, and doesn't want it, this is the + (internal) user number of the immediately + inferior job to give the TTY to. + +.TVCREG +* +* TV console register + + Initially -1. + This variable is placed in the console register + when the job is run if it is non-negative. + It controls which video buffer memory is used + when writing into the job's tty's TV buffer + (see the CORBLK symbolic system call). + The format of the console register is as follows: + 4.9-4.2 ALU function, used when writing into TV memory: + VALUE SYMBOL FUNCTION + 0 CSETC SETCAM + 1 CNOR ANDCBM + 2 CANDC ANDCAM + 3 CSETZ SETZM + 4 CNAND ORCBM + 5 CCOMP SETCMM + 6 CXOR XORM + 7 CANCSD ANDCMM + 10 CORCSD ORCAM + 11 CEQV EQVM + 12 CSAME SETMM/MOVES/JFCL + 13 CAND ANDM + 14 CSETO SETOM + 15 CORSCD ORCMM + 16 CIOR IORM + 17 CSET SETAM/MOVEM + Note that those symbols are not predefined in MIDAS. + 4.1-3.3 Video buffer number (video switch input number). + See the VIDSW symbolic system call. + + +.UIND +- +- user index + + The unique number assigned to the job by the system + when the job was created. These numbers typically + are between 0 and 77 octal or so (the exact maximum value + is a function of the particular incarnation of the + system). When a job is killed, its user index is + freed for re-use. + Most symbolic system calls which require a job + to be specified will accept 400000+the user index + in lieu of a channel with the job open on it if the + call is only to examine the job and not to modify it. + The .GUN and DETACH commands require a user index. + Jobs 0 and 1 are special in that they always stand for + the system itself and for the CORE job, respectively. + (The CORE job manages core allocation for the system.) + This may have various implications depending on context; + for example, when sharing a page with a job via the + CORBLK symbolic system call, sharing with + job 0 means sharing with an absolute page, and "sharing" + with job 1 means getting a fresh page. + +.UNAME +- +? user name + + A word of sixbit characters which is the user + name of the job. All jobs in a given job + tree must all have the same user name. Furthermore, + a console-controlled tree may not log in if another + console-controlled tree is logged in under the same + uname. When a new console-controlled tree is created + by typing ^Z on a free console, the uname of the newly + created top-level job of the tree is set to "___nnn", + where "nnn" is the user index of the newly-created + job. A non-disowned non-console controlled job is also given + such a uname initially. This may subsequently be changed to + something more reasonable by using the LOGIN symbolic + system call. + The uname of a newly created inferior job is initialized + to the uname of its creator. + If a disowned job tree is re-owned, the unames of all the + jobs in the re-owned job tree are set to the uname of the + re-owning job tree. + The .UNAME user variable may be set only with a .SUSET, and + only by a top level job which has no direct inferiors; + furthermore, attempting to set the uname to zero or the left + half to -1 causes an illegal operation interrupt (bit 1.6 of + the .PIRQC user variable), as does attempting to make the + uname-jname pair of the job non-unique. + See also the .JNAME user variable. + +.UPC +* +- user program counter + + The PC for the job. This word, of course, + contains the PC flags in the left half; + a job may set these flags for itself only by + using JRST 2,@[]. + On KA's, the flags in the left half are as follows: + (- = .USET may not set; % = peculiar to ITS) + %PCARO==400000 Overflow. + %PCCR0==200000 Carry 0. + %PCCR1==100000 Carry 1. + %PCFOV==40000 Floating overflow. + %PCFPD==20000 First part of instruction already done. + %PCUSR==10000 - User mode. + %PCUIO==4000 - User I/O. + %PCPUR==2000 % Pure. Instructions may only be fetched from + read-only memory. See bit 3.7 of the .PIRQC user + variable. This feature is not available on + all machines -- beware! + %PCSPC==1000 - Unused. (A PDP6 feature) + %PC1PR==400 % One proceed. An interrupt will occur at the end + of the next instruction. See bit 2.3 of the .PIRQC + user variable. Used by DDT for ^N commands. + %PCX17==200 % AI KA-10 computer only. Index-off-the-PC hack. + When this bit is set, an index field of 17 means + index off the PC instead of ac 17. + %PCFXU==100 Floating underflow. + %PCDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + On KL's the flags are as follows (note the "|" at the front + of lines that differ significantly from those for KA's): + +| %PSPCP==400000 "Previous Context Public" - this applies only + in exec mode; in user mode this bit is the same + as in KA (%PCARO, Arithmetic overflow). + %PSCR0==200000 Carry 0. + %PSCR1==100000 Carry 1. + %PSFOV==40000 Floating overflow. + %PSFPD==20000 First part of instruction already done. + %PSUSR==10000 - User mode. + %PSUIO==4000 - User I/O. +| %PSPUB==2000 "Public Mode" - not used in ITS +| %PSINH==1000 Inhibits MAR-breaks and trap3 (one-proceed trap) +| for one instruction. +| %PSTR2==400 Set by pdl overflow; causes the "trap 2 instruction" +| to be executed. That instruction is kept in .TR2INS +| %PSTR1==200 Set by arithmetic overflow; causes the +| "trap 1 instruction" in .TR1INS to be executed. +| Both %PSTR1 and %PSTR2 set generates a one-proceed +| trap. +| %PS1PR==160 % %PSINH+%PSTR2+%PSTR1. Setting those bits +| causes a single instruction proceed. + %PSFXU==100 Floating underflow. + %PSDIV==40 No divide. + 3.5-3.1 Always zero. May not be set non-zero. + + The user mode (4.4) is always set to 1. + The user I/O bit (4000, bit 4.3) is set according + to whether the job is in .IOTLSR mode. + + If the .UPC user variable for one job is read by another while + the first is running, an exec mode PC may be seen (bit 4.4 = 0); + this reflects the fact that the job is in the middle + of a system call or something. The .UUOH user variable + should then be examined (this is precisely what DDT does + for the evaluation of .). + +.USTP +* -- user stop bits + + Initially <100000,,>. + If this variable is non-zero, the job is being blocked + from running for one reason or another. If zero, the + .FLS variable controls whether the job may run. + The form of the .USTP variable is as follows: + 4.9 BCSTOP Job is being moved in core. + 4.8 BUCSTP Core job is stopping this job + in order to get more core for another job. + 4.7 BUSRC User control bit. Only this + bit may be modified, and only by the + procedure's superior. Any attempt to + set the .USTP variable non-zero + will set this bit; any attempt to set it + to zero will clear this bit. + 4.6 BSSTP Set while superior is altering the page + map for the job. (Not directly settable + by superior.) + 2.9-1.1 Count of transient reasons for stopping the job. + If non-zero, inhibits relocation of the job by + the core job. + PEEK displays this variable by printing the high six bits + in octal, then a "!", then the rest in octal. This is + why one normally sees "10!0" for a stopped job. + + +.UTRP +* -- user trap switch + + When non-zero, this switch specifies that all uuo's + which trap to the system should, instead of performing + their usual actions, should cause a word 1 class 1 + interrupt to the job executing the uuo. This allows + simulators, etc., to trap all uuo's executed by a job. + An attempt to set this variable will use only bit 1.1. + + This is the same as the %OPTRP bit of the .OPTION user variable. + + +.UUOH +- +- system uuo PC + + The program counter as of the last uuo which trapped + to absolute location 40 (not location 40 in the job, + nor the location specified by .40ADDR!) + See also the variable .SV40. + + +.VAL +* +* value or error code of job + + .VALUE instructions set this word to the contents + of the memory location they address. That is useless. + More importantly, .LOSE instructions, and the LOSE + system call, set .VAL to ,,, so that the superior can decode the + error. + +.WHO1 +* +* user who-line control word + + This variable controls the printing of .WHO2 and .WHO3 + at the end of the TV who-line (see ITS TV). + 4.9 If 1, suppress the who-line entirely when focused + on this job. + 4.8 Suppress space between halves of .WHO2. + 4.7-4.5 Mode for printing left half of .WHO2: + 0 Do not print. + 1 Date in packed form: + 4.9-4.3 Year (mod 100.). + 4.2-3.8 Month. + 3.7-3.3 Day. + 3.2-3.1 Unused. + See the RQDATE symbolic system call, but + note that here the date is shifted. + 2 Time in fortieths of a second, printed in tenths + in the form HH:MM:SS.T. + 3 Time in half-seconds, printed in the form HH:MM:SS. + 4 Octal halfword. + 5 Decimal halfword (no . is supplied). + 6 Three sixbit characters. + 7 Unused. + 4.4-4.2 Mode for printing right half of .WHO2. + 4.1 Print 3.9-3.3 twice (doubled character). + 3.9-3.3 If non-zero, character to print after left half of .WHO2. + 3.2 If 1, suppress the space between .WHO2 and .WHO3 printout. + 3.1 If 1, suppress the space between halves of .WHO3. + 2.9-2.7 Mode for printing left half of .WHO3. + 2.6-2.4 Mode for printing right half of .WHO3. + 2.3 Print 2.2-1.5 twice. + 2.2-1.5 If non-zero, character to print after left half of .WHO3. + 1.4-1.1 Unused. + That is, if the who-line is printed at all, what appears + at the end is these characters: + AAAAXX-BBBB=CCCCYY+DDDD + where: AAAA is the result of printing the left half of .WHO2. + BBBB right half of .WHO2. + CCCC left half of .WHO3. + DDDD right half of .WHO3. + XX one or two characters specified by .WHO1 4.1-3.3. + YY one or two characters specified by .WHO1 2.3-1.5. + - space, unless .WHO1 4.8 is 1. + = space, unless .WHO1 3.2 is 1. + + space, unless .WHO1 3.1 is 1. + Note that the specifications fall neatly into 8-bit bytes + (for the convenience of the PDP-11); hence it is easiest + to specify this word using .BYTE 8 in MIDAS. + Example: + .SUSET [.SWHO1,,[ .BYTE 8 ? 166 ? 0 ? 144 ? 200+", ]] + causes .WHO2 to appear as a word of sixbit, and .WHO3 to + appear as octal halfword typeout in mmm,,nnn format. + + +.WHO2 +* +* first user who-line variable + + See .WHO1 for details. + + +.WHO3 +* +* second user who-line variable + + See .WHO1 for details. + +.XJNAME +* +* "intended" job name. + + This variable holds what the job's name was "intended" + to be, by its creator. Why might the job's name not + actually be what it was intended to be? Perhaps because + that name was already in use by some other job, and the + creator had to find a second choice. For example, when + :NEW T in DDT creates a job named T0 because there was + already a job named T, the job T0's .XJNAME will be "T". + In any case, when using the common technique of having + several programs be links to one file, which figures + out what name it was invoked under and behaves + accordingly, the .XJNAME is the right place to look to + find out what behavior the invoker desires. + + When a job is first created, its .XJNAME is the same as it's .JNAME. + + +.XUNAME +* +* "real" user name. + + This variable holds what says who you really are, + as opposed to what you are logged in as. + It should be a word of sixbit, just like .UNAME. + For example, if you are logged in as FOO1 then + your XUNAME will probably be FOO, because that's + what DDT will normally set it to. However, though + the .UNAME may change because of reowning or attaching, + the .XUNAME will ot change iunless requested specifically. + However, the user may alter DDT's .XUNAME by depositing in + ..XUNAME, which works by informing DDT and having DDT + tell ITS. + Whenever an inferior is created, its .XUNAME is initialized + from its superior's. diff --git a/sysdoc/usr.101 b/sysdoc/usr.101 new file mode 100644 index 0000000..ce50f27 --- /dev/null +++ b/sysdoc/usr.101 @@ -0,0 +1,840 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +JOBS IN ITS + + +@. ABSTRACT. + +In ITS, a "job" is an entity that consists mainly of memory to hold +a program, registers to run it with, and I/O channels for it to do +I/O on through the system. Whenever a program is +running, it must be running "in" some job. Jobs are structured +into trees; the root of a tree is a "top-level" job, and for any +job, the job one step closer to the root is the first job's superior; +the first job is one of its inferiors. Normally, each user has +one tree of jobs, but he may also have a few other secondary trees. + +Jobs may read anything associated with any job, but usually may write +only their direct inferiors. + +TABLE OF CONTENTS + +A. OVERVIEW OF JOBS. + +B. CREATING AND DELETING INFERIORS, AND OTHER METHODS OF CHANGING THE + 0. OPENING THE USR: DEVICE - A BASIC TOOL. + 1. CREATION + 2. DELETION + 3. DISOWNING + 4. REOWNING + 5. DETACHING + 6. ATTACHING + 7. LOGGING IN + 8. LOGGING OUT AND GUNNING + +C. CONTROL OF INFERIORS. + 1. READING AND WRITING + 2. SHARING MEMORY BETWEEN JOBS + 3. LOADING + a. Resetting + 4. DUMPING + a. Pure dumping + b. Impure dumping + 5. STARTING AND STOPPING + 6. HANDLING INTERRUPTS + 7. DEBUGGING CONTROLS. + 8. TTY PASSING + +D. SYSTEM JOBS AND WHAT THEY DO + 1. THE SYSTEM JOB. + 2. THE CORE JOB. + 3. DEMON JOBS. + +A. OVERVIEW OF JOBS. + +Each ITS job has an address space, the slots of which may be filled +with various types of memory, perhaps shared with other jobs; its own +set of accumulators (copied temporarily into the real ones when the +job is running); a program counter (PC); sixteen I/O channels, each of +which may be used to handle a device or file; system "user variables" +with which the program in the job may communicate with the system; +and other variables used by the system in scheduling +or swapping the job, or as temporaries for system call routines. + +The word "user" has two meanings on ITS: one is the human or other being +using a terminal; the other is an individual "user job". In specific +contexts either "job" or "user" sounds better for their common meaning. +A "program", however, is a more abstract entity; the same program may +be running in several jobs (but using different files, etc. in each). + +Each job is identified by two names, the UNAME and the JNAME, each of +which is up to six SIXBIT characters, left justified in a PDP-10 word. +They are available in the .UNAME and .JNAME user variables of the job. +These two names uniquely identify the job. +All the jobs in a tree must have the same uname. Two trees may have +the same uname; that usually means that they really correspond to the +same user. + +Each job is also uniquely identified by its "job number" (or +"user number"), which is a small positive number. This number +is the usual way to specify a job in a system call. A job may find +out its own number by reading its .UIND user variable; its superior's +is in its own .SUPPRO user variable. The term "user index" +may mean, loosely, the job number, but more strictly it means the +job number times LUBLK, the length of the system's per-job data block +(the "user variable block"). Supported communications paths +between the user and the system use the job number, not the user index +itself, even if the term "user index" is used. + +A job has several "user variables" which are really variables in the +system that pertain to it, and are readable by that job or others +using the .USET and .SUSET UUO's (see ITS UUOS). Each user variable +has a name, which starts with ".". User variables can be opened in +DDT just like memory locations, although what DDT does to access them +is a .USET. Some user variables, such as .UIND, .SUPPRO, .UNAME and +.JNAME mentioned above, exist solely to be read by programs. Others +also allow the program to tell the system how to treat it; examples +are .OPTION, which contains bits that enable various system features, +and .MASK, which is used to enable user interrupts (see ITS INTRUP). +A complete list of user variables and what they contain is in the +file ITS USETS. + +When a user connects to ITS by typing ^Z or CALL on a terminal, he is +supplied with a single top-level job using that terminal, running the +program "DDT" (on DM, "MONIT" is used instead). The jname of that +job is always "HACTRN" (pronounced "hack-tran"), +and the job is called "a HACTRN". The uname +will be three backarrows followed by three digits, identifying the tree +as non-logged-in. "Logging in" is nothing other than altering the uname +of the hactrn to a more meaningful name. It makes little direct +difference. +DDT and MONIT both provide facilities for creating other jobs for the +user, loading programs into them, and running them. There are no user +commands per se for controlling jobs built into ITS; instead, the +user gives commands to DDT or MONIT telling them to execute the system +calls to control his other jobs. + +The two main types of job trees are the console-controlled trees and +the non-console-controlled (or "disconsolate") trees. A console +controlled tree has one terminal which is "in use as a console" by +the whole tree. All the jobs in the tree can refer to that terminal as +device TTY:. The number of that terminal can be found in the .CNSL +variable of any job of the tree. +At any time, only one of the jobs in the tree has +permission to do I/O to the console; that job is said to "own" +the console. Ownership is transferred by means of .ATTY and .DTTY +UUO's executed by jobs in the tree (see ITS TTY). If ^Z (or CALL on +TV's) is typed on a console, the job that owns it gets a fatal +interrupt. The jobs may also have other terminals open "as devices", +but those can be in use only by a single job, not the whole tree. +The console-controlled trees are usually the ones with hactrn's at the +top. + +Disconsolate trees do not have any console, but in all other respects +bahave just like console-controlled trees. They may or may not be +"disowned". If they are, they get worse treatment from the scheduler +and swapper, and also may be more conveniently "reowned" (made into a +subtree of another tree - see below). Usually only system demons and +job-device handlers are disconsolate non-disowned trees. +Job-devices will have a .CNSL equal to that of the tree of the +job using the job-device. Other disconsolate jobs will have a .CNSL +of -1 if they are scheduled as part of the system, or -2 if scheduled +as disowned jobs. + +Jobs often refer to each other using a device, the "USR" device. A job +may be opened on the USR device by specifying its uname and jname as the +opened filenames. It is then possible to examine or deposit the job's +memory or user variables, etc. This is why DDT, when it starts up, +mentions its uname and jname by saying "USR: ". +The USR device should not be confused +with the JOB device, which is a mechanism for creating software devices +which enables the system calls that manipulate the device to be +simulated and handled by a user program, the job-device handler program +(See ITS JOBDEV). + +The remainder of this file is devoted to desribing the ITS system calls +with which jobs may create, delete, sense and control other jobs. + +B. CREATING AND DELETING INFERIORS, AND OTHER METHODS OF CHANGING THE + TREE STRUCTURE OF JOBS. + + 0. OPENING THE USR: DEVICE - A BASIC TOOL. + +Unfortunately, many different things are done by opening the +USR device in different ways in different situations. They +include creation of inferiors, reowning disowned jobs, selection +of existing jobs (inferiors or not), and testing for the existence +of a job. Opening USR is the ONLY way to do those things. What's +more, a job's memory cannot be read or written without having a USR +channel open in the appropriate direction, and a job's user variables +cannot be read or written without at least one USR channel open in +either direction. Thus, opening USR: is very important. It is intended +that this mechanism will be made more rational in the future. + +This section will describe what opening the USR device will do, +organised by how it is done. Later sections will say what +to do to achieve a specific goal. + +By convention, "USRI" and "USRO" are the canonical names in MIDAS +programs for the I/O channels used for opening the USR device for +input and output, respectively. Their use in an inferior-handling +program is a sort of comment. + +A USR: open always specifies two filenames. Normally they are +the uname and jname of the job to be opened. However, 0 may +be used as the first filename to specify your own uname. +If the second filename is 0, then the first is not really a +name but a job spec; this crock makes it possible to open a +job known only by its number. + +A USR: open must also ask for either block mode or unit mode. +Right now SIOT on unit mode USR channels is not as efficient as +IOT on block mode channels, so it is usually better to open in +block mode. In any case, this choice is orthogonal to everything +else. + +All USR: opens should specify image mode. Ascii mode doesn't now +exist for the USR device, and if you ask for it you will get image +mode instead, so for compatibility with the future you should ask +for image mode. + +There are four things specified in each USR open that affect the +actions taken in important ways. They are the two filenames, +the direction, and the device-dependent bit 1.4 of the open-mode, +known here (and inside ITS) as UBPFJ. + +If UBPFJ is set, the open may be for reading only, and will fail with +code 4 if the job specified by the uname and jname does not exist. +If the job does exist, it will be opened as a "foreign job", which +means that the opening job may not modify it at all using the +channel opened in this way. Also, the process of opening the job +with UBPFJ is guaranteed not to alter it. This style of open is +good for asking whether a job exists with particular names. + +Without UBPFJ, if the open is for writing, then +if a job with the specified uname and jname exists and is the + inferior of the job doing the open, it will be opened for + writing, with no special side effects. +If a job with the specified names exists and can be reowned + (it is a top-level disowned job), it will be reowned, and + opened for writing. Reowning may change its uname or jname, + so whenever an open might reown a job the program should + read back the uname and jname of the opened job just in case. +If no job with the specified names exists, then an attempt is + made to create an inferior by that name. If the specified + uname isn't the same as yours, that is impossible, and the open + fails with code 20. If you already have the maximum number of + inferiors, it fails with code 5. If there are no job slots available, + it fails with code 6. If the attempt succeeds, the new inferior + is opened for writing. +Otherwise (a job with the specified names exists, but isn't + an inferior of the running job already and can't be made one + by reowning it), the open fails with code 12. +Note that if an open for writing succeeds, you know the job that +is open is your inferior (thought it might not have been so before). + +An open for reading, without UBPFJ, is like an open for writing +except that when the job exists but isn't an inferior and can't +be reowned, it will be opened as a foreign job (as if UBPFJ were 1). + +To understand these possibilities better, think of the FOO$J command in +DDT, which means, essentially, "open the job named FOO". That command +will reselect a job named FOO if there is one; if not, it will create +one. If there is a job named FOO that isn't a direct inferior of DDT, +it will be selected, but will be unwriteable (DDT will type a "#"). If +there is a disowned job named FOO, it will be reowned (made into an +inferior of DDT), and DDT will type ":$REOWNED$"). + +There is no easy way to tell after the fact what has happened when +an open without UBPFJ has succeeded. You know you have an inferior, +if an open for writing succeeds, +but whether it is new, reowned or old is forgotten. If you care, +you should find out in advance what is going to happen by doing +an open with UBPFJ set. If it fails, you will get a newly created +inferior. If it succeeds, look at the .APRC and .SUPPRO user variables. +If both are negative, you have a top-level disowned job which +would be reowned. If .SUPPRO equals your .UIND variable, the +job is your inferior already. Otherwise, an open for writing +would fail, and an open for reading would open it as a foreign job. + +Some information is still available after an open. +The job's .UPC variable will be nonzero iff the job has ever run +(because the user-mode bit, %PCUSR, will be 1). +If the job has been run, then it certainly wasn't just created. +Also, if the job's uname or jname was changed by the open, then +it must have been reowned. + + 1. CREATION + +In order to create an inferior, one must choose a jname for it. +Its uname will have to be the same as its creator's, and together +the uname and jname must be unique among all jobs in existence. +An attempt to create an inferior looks just like an attempt to +open an existing job, so if the would-be creator is mistaken about +the uniqueness of the jname it may get confused (a way out of this +problem is described later). + +Given a jname which isn't in use, an inferior of that name may be +created by simply opening the USR device with the uname and jname +as filenames, as in section 0. You should open a channel in each +direction (call the input channel USRI and the output channel USRO). +If you are unwilling to try to live with a foreign job, do the +output open first. + +One way to make sure of getting a newly created job is to check +in advance that the names are not in use, by opening them with +UBPFJ (see section 0) before actually trying to create the job. +If the test open succeeds, close the channel again and +pick a new jname. + +The new inferior will have 1K of zeroed unshared core, +and will not be running (its .USTP will be nonzero). + +Then, if you wish to handle interrupts from the inferior, +read the inferior's interrupt bit, which may be found in +the inferior's .INTB variable, and remember it somewhere. +That is the bit .IFPIR on which YOU will be interrupted, +if the inferior gets a fatal interrupt. + + 2. DELETION + +Inferiors do not need to remain open to continue to exist. Simply +closing the channels one is open on does not delete it; it is +merely hard to refer to until it is opened again. This is so +that it is possible to have many inferiors without tying up many +I/O channels. When it IS desired to delete an inferior, the +.UCLOSE uuo should be used: + + .UCLOSE , + +This uuo kills the inferior open on . All the channels +it is open on are closed. The uuo does not skip. +If a foreign job instead of an inferior is open, all the channels +in this job that it is open on are closed, but it is not killed. +If there isn't a job open on the specified channel, an ILOPR +interrupt happens. + + 3. DISOWNING + +Disowning an inferior causes it to continue to exist, but no longer +as your inferior. This can be useful for two reasons: +1) you wish to log out but want the inferior to remain, or +2) you want the job to become someone else's inferior. + +Disowning is done with the DISOWN system call, as follows: + + .CALL [ SETZ ? 'DISOWN + 401000,,] + .VALUE + +It fails if the specified job isn't an inferior of the executing one. +If it succeeds, the specified job and its inferiors become +a separate disowned tree, of which the specified job is the top. +All channels on which the running job had that job open are closed. +See the DISOWN symbolic system call for more details and features. + + 4. REOWNING + +A top-level disowned job may be "reowned" (made one's inferior) +by opening it with bit 1.4 of the mode set to 0. The uname of +every job in the reowned tree will be changed to equal that of +the reowning job, if necessary. If as a result the uname/jname +pair of one of the reowned jobs is no longer unique, the jname +will be altered until the uname/jname pair is unique. + +Another way to reown a job is to use the REOWN symbolic system +call. The job to be reowned should already be open on an I/O +channel as a foreign user; the REOWN will cause it to be open +as an inferior instead on the same channel. An example is: + + .CALL [ SETZ ? SIXBIT/REOWN/ ? 401000,,USRI] + .VALUE + +In DDT, selecting a job that may be reowned will always reown it. +DDT will type ":$REOWNED$" when that happens. If the uname or +jname changes, DDT will type the new names. + + 5. DETACHING + +An entire tree may be made disowned, have its console taken +away from it, or both, with the DETACH system call. The goal might +be to free the console for other use, or to make the tree into +a subtree of another tree by reowning it. + + 6. ATTACHING + +Attaching is the operation of connecting a terminal to a tree +as the tree's console. The simplest kind of attachment takes +a free console and a disowned tree and connects them. A top-level +console-controlled job may also attach one of its inferiors to +its console; this has the same effect as if it were to disown +the inferior, detach itself, and then attach the erstwhile inferior +to the now free console, except that it happens more smoothly. +DDT's :ATTACH command uses the second flavor of ATTACH. See the +ATTACH system call for more details. + + 7. LOGGING IN + +When the system creates a top-level job (such as a HACTRN), its uname +will be three "_"'s followed by three unique digits. The job may +change its uname to one that gives more information to humans by +"logging in", which simply sets the uname. The job must not have any +inferiors at the time; the new uname must not start with "___" and +must not be in use. A logged-in job may not log in again, but it may +change its uname with a .SUSET of .UNAME. +Logging in is done with the LOGIN symbolic system call, as follows: + + .CALL [ SETZ ? SIXBIT/LOGIN/ + SETZ []] + .VALUE + +The system call takes an optional third argument which now should be +used only by network server telnet jobs. For them, its hould be the +sixbit string "HSTnnn", where nnn is the octal number of the foreign +host. + + 8. LOGGING OUT AND GUNNING + +A top-level job may delete itself, and all its inferiors, by "loggin +out". This is done with the .LOGOUT UUO, as follows: + + .LOGOUT + +The UUO returns only if it fails (the job isn't top level); it does not +skip. Programs that do not normally run in top-level jobs might +nevertheless be run in disowned jobs sometimes, so they should always +try to log out before requesting another command string or trying to ask +DDT to kill them. + +A job may force any top-level job to log out by "gunning" it, using the +.GUN UUO. The user index of the job to be gunned must be known. The +way to do it is: + + MOVEI AC, + .GUN AC, + JRST LOSE ;FAILED - JOB DIDN'T EXIST OR WASN'T TOP LEVEL. + ... ;SUCCEEDED. + +Gunning should go on only between consenting adults. + +C. CONTROL OF INFERIORS. + +Jobs can control their inferiors by means of several special-purpose +system calls. The more specific of them are documented below under +their uses. One more general one is .USET, which allows the inferior's +"user variables" to be read or set. For example, when section C.5. +speaks of "setting the job's .USTP variable", a .USET is meant. The +way to set the .FOO variable with a .USET is this: + .USET ,[.SFOO,,[]] +Thus, .USET ,[.SUSTP,,[0]] will stop the job open on channel +. + .USET ,[.RFOO,,TEMP] will read the value of the .FOO +variable into TEMP. +For a complete description of the available .USET variables, and more +features of .USET, see the file ITS .USETS. + + 1. READING AND WRITING + +Reading or writing the contents of another job requires having the job +open on a USR device channel. It is done by .IOT'ing on that channel; +thus, reading requires an input channel and output requires an output +channel. Selection of the region to read or write is done by setting +the channel's access pointer with .ACCESS. At the moment, SIOT on unit +mode USR channels is not very efficient, so it is best to open a job in +block mode. That requires one extra instruction when transferring a +single word, which is a slight cost when compared with the ease of +transferring several words. +Note that ascii mode does not exist for the USR device - all channels +should be opened in image mode. + +For example, to read the word at 500 into A, do + + .ACCESS USRI,[500] + HRROI B,A + .IOT USRI,B + +assuming that USRI is the USR input channel. This clobbers B. +To write A into the word at 500, do + + .ACCESS USRO,[500] + HRROI B,A + .IOT USRO,B + +assuming that USRO is the USR output channel. This clobbers B. + +If a non-existent location in another job is read or written +with an IOT, an MPV interrupt results. The .MPVA variable +of the job doing the reading will point at the non-existent +page of the other job. (Actually, in ITS before version 1017, +when a non-existent page is written, the system may give an MPV, +or may do a .CORE on the inferior so that it has enough core +to make the IOT succeed. ITS version 1017 and up will +always MPV). + + 2. SHARING MEMORY BETWEEN JOBS + +Another way to refer to the core of other jobs is to share +memory with them. The slots of a job's page map should be +understood to be pointers to pages; one page may be pointed +to independently by several slots in several jobs' page maps. +The CORBLK call can be used to copy other jobs' pointers to pages +into one's own job, resulting in shared memory. Of course, +the memory will not have the same address in both slots +unless that is specificaly arranged for. +Unfortunately, other jobs' accumulators cannot be referred to +via memory sharing, since they are not stored anywhere in +the job's memory even when the job isn't running. + + 3. LOADING + +Loading a binary file into a job is not actually a fundamental +operation, since it could be done by a program that understood +the format of the binary file and deposited in appropriate +locations in the job being loaded. However, for convenience' +sake, the LOAD system call exists for loading a binary file +into an inferior, or into the running job itself. Both types +of ITS binary files may be loaded with LOAD; it is not necessary +to know which type of file is being loaded. Unfortunately, this +call works only for disk files. For other devices, the program +must do it the hard way. Code may be copied from DDT for that +purpose. + +The LOAD system call takes two arguments: the job to be loaded, +and the file to load. The first is expressed by a job spec; the +second, by a channel number. For example, + + .CALL [ SETZ ? SIXBIT /LOAD/ + 1000,,-1 ;into myself + 401000,,DISKC] ;the file open on DISKC + .VALUE + +The LOAD will leave the disk channel set up to read the file's +start instruction, which is a jump to the starting address, or +zero if there is no starting address. After that word in the +file should come the symbol table and another copy of the start +instruction; see DDT ORDER for their format. + +Loading a PDUMP file (pure file) inserts pages into the job +as specified by the file. It does not alter the pages of the +job that the file has no data for. It also does not alter the +accumulators, even if page 0 is loaded. Loading an SBLK file +(impure file) alters only the words of the job that the file +specifies data for. The other words are NOT cleared. If data +are specified in a nonexistent page, fresh memory will be +put there, and also in all nonexistent pages below it in the +address space! Thus, if an impure dump is made of a job containing +nonzero data only at address 100000, the resulting file when +loaded will create core up through address 101777, even though +only the last page of that is actually being loaded. This +unfortunately cannot be changed, but often causes trouble. For +that reason (and many others), it is hoped that there will be +a new, more versatile binary format some day. + + a. Resetting + +Loading per se modifies only the locations that the binary file +specifies data for. It does NOT clear the rest of core. If you +want to do that, chances are that you really want to RESET the +inferior. To do that, use the .RESET UUO or the RESET symbolic system +call on an I/O channel with the inferior open. + +RESETting a job deletes all of its core, provides it with a single +page of unshared writeable core, closes all the job's channels, +kills all of its inferiors, and re-initializes most of the job's +system variables. Most notably not cleared out are the job's +translation lists for filenames. + + 4. DUMPING + a. Pure dumping + b. Impure dumping + 5. STARTING AND STOPPING + +An inferior may be started (caused to run) by setting its .USTP +variable to zero. It will continue with whatever PC it has. +To set the PC, store the desired new PC in the .UPC variable. + +An inferior may be stopped by setting the .USTP variable to +nonzero. The exact value deposited in .USTP will be forgotten +since it corresponds only to a single bit of real storage. +This is how the system stops a job which gets a fatal interrupt. + +DDT has another way of stopping a job, which it uses in executing +the ^X command: it turns on bit %PIC.Z of the job's .PIRQC, causing +a fatal ^Z-typed interrupt in that job. +This not only makes the system set the job's .USTP, but causes +DDT's interrupt handler to find out about the stoppage of the +job and be properly faked out. + + 6. HANDLING INTERRUPTS + +Every job has the ability to enable interrupts on several conditions +(see ITS INTRUP). Among those conditions is the occurrence of a fatal +error interrupt in an inferior. This is the mechanism that enables +a job to "return to DDT" deliberately - it simply causes a fatal +interrupt in itself. This is also how DDT knows when an illegal +instruction is executed by an inferior. + +Whenever a job acquires an inferior (by creation or reowning), one +of the job's interrupt bits is assigned to that inferior. Each +inferior has its own interrupt bit. There are exactly eight +interrupt bits which can be used for that purpose, which is why a +job can have at most eight inferiors at a time. Those eight are +all located in the left half of the .IFPIR variable. + +The superior should find out which interrupt bit was assigned by reading +the inferior's .INTB variable, in which that bit alone will be 1. + +See ITS INTRUP for more details. + +The two system calls .VALUE and .BREAK exist solely so that a job can +cause a fatal interrupt to signal its superior. DDT has standard +interpretations for those instructions; see .INFO.;DDT ORDER. + + 7. DEBUGGING CONTROLS. + +These features exist to facilitate debugging. They work currently on +KA-10's only, though they will be extended to KL-10's eventually. +They are generally used and controlled only by the superior of the +job on which they are acting, to which they are generally transparent. + + a: One-proceed. + +If appropriate bits in a job's PC are set, that job will be +able to execute one more instruction and then will get a fatal +%PI1PR interrupt. This feature is used by DDT's "single step" +command (^N). Which bits to use depends on the processor type: +for KA's, %PC1PR is the right bit (it is an 18 bit quantity, to +be OR'ed into the flags); for KL's, %PS1PR is right. On any +machine, the symbol OIPBIT will be defined in the ITS symbol +table as either %PC1PR,, or %PS1PR,, , whichever is appropriate. + + b: Address-stop (MAR). + +The MAR feature makes it possible to trap all references to a +particular address. When the specified location is referred to +("the MAR is hit"), the inferior will get a fatal %PIMAR +interrupt, which may or may not allow the instruction that +tripped the MAR to finish. The MAR is turned off when it is +hit and must be turned on again explicitly or it will stay +off forever. + +The MAR is controlled by the .MARA user variable. Its RH +contains the address to be traced. Its LH contains the control +code, which is 0 to turn the MAR off, 1 to trap instruction +fetches only, 2 to trap writes only, and 3 to trap all +references. There is also a variable .MARPC which, after +the MAR is hit, contains the address of the instruction that +hit it. In addition, the indirect bit will be set on KA's +if the instruction that hit the MAR was completed (on KL's, +the instruction is always aborted). +On KL's, after a MAR, the job's PC (.UPC) will have %PSINH +set, which will inhibit MAR hitting for one instruction +when the job is continued. +The job's PC in .UPC should NOT be used to locate the +instruction that hit the MAR, since if the instruction was +not aborted and was a jump, the PC will be the address +jumped to. Even if it wasn't a jump, it might have skipped. + + c: .JPC - Last Jump Address. + +The user variable .JPC always contains the address of the last +jump instruction executed in the job. It can be used, for +example, to trace a job backward from the point of failure by +putting in a breakpoint, examining the .JPC when the breakpoint +is hit, and running the program again with the breakpoint now +located at the previous jump, etc. Unfortunately, subroutine +calls (including user-trapping UUOs) alter the JPC, even though +the information is redundant for them, but returnable UUO's and +interrupts do not. For that reason, after a returnable UUO +or interrupt a program should always read .JPC before jumping +anywhere, for debugging purposes. The canonical names UUOJPC +and INTJPC exist for the locations .JPC is saved in. Also, +error-handling uuos used by the program should be returnable +uuos rather than direct user-trapping uuos, so that the JPC +will be meaningful. The vectored interrupt mechanism has the +ability to store .JPC automatically on each interrupt (see +ITS INTRUP). + + 8. TTY PASSING + +For now, see under .ATTY and .DTTY in ITS TTY. + +D. SYSTEM JOBS AND WHAT THEY DO + +There are two jobs built into the system, that run in exec mode +and perform housekeeping tasks; they are the system job and +the core job. There are also various "demon" jobs that exist +at times which, though receiving no special treatment from the +system, may be regarded as part of it in that they provide a +system-wide service. + + 1. THE SYSTEM JOB. + +This job, whose full name is SYS SYS, provides a great many +independent services; it is really a timesharing system for +many trusting processes, each of which is controlled by a +single bit in the system variable SUPCOR. Setting the bit for +a process causes the process to run, and clear the bit. The +process should never run for very long, or it may tie up the +system by making the services of the other processes +unobtainable. If a process wishes to run continually, it does +so by setting its bit in SUPCOP. SUPCOP is or'ed into SUPCOR +every second, so a process whose bit in SUPCOP is set will be +run again that often. The process is always started the same +way, but it can of course have state variables. + +The reasons why a given activity may involve the system job are +1) it may wish to print a message on the system log terminal, or +2) it may need to run in a job (eg, do system calls), but not be +associated with any one job, or +3) it may need to be able to hang up for short periods of time, +but the need to do it may be noticed at a time when that is +impossible, or +4) it needs to be done once every two minutes or every two hours. +The routines for those "very slow" and "super slow" clocks are in +the system job. + +Re-initialising the connection to the IMP is an example of reasons 1 +and 2. Typing "console free" messages is an example of reason 3 - it +involves doing I/O to the terminal, but it isn't done until the last +stage of killing a tree, when waiting of any sort would allow PCLSR'ing, +which would leave things in a screwed-up state. An example of reason 4 +is the detection of core-link files which have not been used for more +than 2 minutes. + +A complete list of the system job's functions follows: + + a: Allocating or Deallocating Memory for Job Slots. + +Most of the memory occupied by the system is marked as belonging to +the system job. For that reason, the way more is allocated for user +variable blocks is by having the system job do a .CORE UUO. This is +somewhat of a historical crock. Creating a job does not require such +allocation if there are free slots in the memory already allocated. +However, it may need to. For that reason, if the system job is hung +up, often jobs cannot be created. + + b: Printing Various Messages on All Terminals. + +Sometimes, messages such as "ITS GOING DOWN IN ..." or "ITS BEING +DEBUGGED" are printed on all the terminals in the world. It is the +system job that prints them on terminals which are free. Consoles have +them printed by DDT, however. + + c: Checksumming the Constant Areas of the System. + +The system job is always checksumming parts of the system and comparing +the checksums with those previously calculated. This mechanism causes +the clobberage of a word in the code of the system to be detected. If +only a single word in an area is clobbered, which word it is and the +original contents can be detarmined. In any case, a message is printed +on the system log terminal when clobberage is found. + + d: Determining the Date and Time. + + e: Detaching Trees. + +When a top-level job is halted by a fatal interrupt, it is the system +job which executes the DETACH system call to detach it. Similarly, it +is the system job which detaches trees controlled by TV terminals when +the TV system crashes, and trees controlled by dialup lines whose +connections are broken (only when the hardware can detect that). + + f: Depositing in the System. + +When a job deposits in the system using .SETLOC or .IFSET, the system +job is informed so that it can update its checksums and avoid a system +clobbered" message. It also makes the change. + +This used to be a great screw, in that if the system job were hung, it +could not be fixed by depositing in the system. Now, .SETLOC will do +the work itself without calling the system job, if the system job +appears to be hung. + + g: Printing "Console-free" Messages. + +When a terminal ceases to be in use, the system job is signalled to look +at all terminals and print console-free messages on all those which have +recently stopped being in use. + + h: Logging Out. + +The final stages of killing a job must be run by some other job. When a +top-level job is being killed, it does some of the work itself (kills +its inferiors and closes its channels). That is to make sure the +system job never hangs up trying to do it. The rest of the work is +then done by the system job, which can afford to wait for short peiods +of time when the job is almost killed. + + i: Reinitialising the NCP. + +When the connection to the ARPA network goes down, the system job gives +interrupts to all the jobs using the network, and also checks every so +often whether the network is useable again. + + j: Printing of Various Messages on the System Log Terminal. + +Events which cause messages on the log terminal include logging in, +logging out, writing on a directory whose name starts with "SYS", +garbage-collecting a disk directory, creating a disk directory, +gunning, parity errors, NXM errors. + + l: Spooling the LPT. + +On AIKA and ML, the system job checks periodically for spooled files +and prints them. + + m: Starting Other Demons. + +On DM, the system job checks for any domon programs which have been +signaled. If there are any, it loads them into newly created jobs +and strats them. + + n: Reinitialising the TV System, or Noticeing that it is Down. + + 2. THE CORE JOB. + +This job, whose full name is CORE JOB, allocates core to jobs that +request it, and also frees up memory for use as user variable blocks, +which have to be allocated consecutively, by relocating the old +contents. Before there was pageing, the core job used to do shuffling. + + 3. DEMON JOBS. + + a: The Comsat. + +This demon, always named after some spacecraft or rocket, is responsible +for handling mail. Requests to send mail are placed in the .MAIL. +directory, and are eventually processed by the demon. The demon is +necessary because it may not be possible to send mail to other machines +right away, and in any case the user should not have to wait the time +it takes. It also provides other services such as forwarding. + + b: NAMDRG. + +This demon maintains the list of logged in users which appears on all +free TV consoles. It also updates a file saying when every user +logged out last. It exists on AIKA only. + + c: PFTHMG DRAGON. + +This demon updates the logout times file and keeps track of each user's +total CPU time. This demon originated on ML, but has run on all ITS +machines at one time or another. + + \ No newline at end of file diff --git a/sysdoc/usr.102 b/sysdoc/usr.102 new file mode 100644 index 0000000..f84143d --- /dev/null +++ b/sysdoc/usr.102 @@ -0,0 +1,840 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +JOBS IN ITS + + +@. ABSTRACT. + +In ITS, a "job" is an entity that consists mainly of memory to hold +a program, registers to run it with, and I/O channels for it to do +I/O on through the system. Whenever a program is +running, it must be running "in" some job. Jobs are structured +into trees; the root of a tree is a "top-level" job, and for any +job, the job one step closer to the root is the first job's superior; +the first job is one of its inferiors. Normally, each user has +one tree of jobs, but he may also have a few other secondary trees. + +Jobs may read anything associated with any job, but usually may write +only their direct inferiors. + +TABLE OF CONTENTS + +A. OVERVIEW OF JOBS. + +B. CREATING AND DELETING INFERIORS, AND OTHER METHODS OF CHANGING THE + 0. OPENING THE USR: DEVICE - A BASIC TOOL. + 1. CREATION + 2. DELETION + 3. DISOWNING + 4. REOWNING + 5. DETACHING + 6. ATTACHING + 7. LOGGING IN + 8. LOGGING OUT AND GUNNING + +C. CONTROL OF INFERIORS. + 1. READING AND WRITING + 2. SHARING MEMORY BETWEEN JOBS + 3. LOADING + a. Resetting + 4. DUMPING + a. Pure dumping + b. Impure dumping + 5. STARTING AND STOPPING + 6. HANDLING INTERRUPTS + 7. DEBUGGING CONTROLS. + 8. TTY PASSING + +D. SYSTEM JOBS AND WHAT THEY DO + 1. THE SYSTEM JOB. + 2. THE CORE JOB. + 3. DEMON JOBS. + +A. OVERVIEW OF JOBS. + +Each ITS job has an address space, the slots of which may be filled +with various types of memory, perhaps shared with other jobs; its own +set of accumulators (copied temporarily into the real ones when the +job is running); a program counter (PC); sixteen I/O channels, each of +which may be used to handle a device or file; system "user variables" +with which the program in the job may communicate with the system; +and other variables used by the system in scheduling +or swapping the job, or as temporaries for system call routines. + +The word "user" has two meanings on ITS: one is the human or other being +using a terminal; the other is an individual "user job". In specific +contexts either "job" or "user" sounds better for their common meaning. +A "program", however, is a more abstract entity; the same program may +be running in several jobs (but using different files, etc. in each). + +Each job is identified by two names, the UNAME and the JNAME, each of +which is up to six SIXBIT characters, left justified in a PDP-10 word. +They are available in the .UNAME and .JNAME user variables of the job. +These two names uniquely identify the job. +All the jobs in a tree must have the same uname. Two trees may have +the same uname; that usually means that they really correspond to the +same user. + +Each job is also uniquely identified by its "job number" (or +"user number"), which is a small positive number. This number +is the usual way to specify a job in a system call. A job may find +out its own number by reading its .UIND user variable; its superior's +is in its own .SUPPRO user variable. The term "user index" +may mean, loosely, the job number, but more strictly it means the +job number times LUBLK, the length of the system's per-job data block +(the "user variable block"). Supported communications paths +between the user and the system use the job number, not the user index +itself, even if the term "user index" is used. + +A job has several "user variables" which are really variables in the +system that pertain to it, and are readable by that job or others +using the .USET and .SUSET UUO's (see ITS UUOS). Each user variable +has a name, which starts with ".". User variables can be opened in +DDT just like memory locations, although what DDT does to access them +is a .USET. Some user variables, such as .UIND, .SUPPRO, .UNAME and +.JNAME mentioned above, exist solely to be read by programs. Others +also allow the program to tell the system how to treat it; examples +are .OPTION, which contains bits that enable various system features, +and .MASK, which is used to enable user interrupts (see ITS INTRUP). +A complete list of user variables and what they contain is in the +file ITS USETS. + +When a user connects to ITS by typing ^Z or CALL on a terminal, he is +supplied with a single top-level job using that terminal, running the +program "DDT" (on DM, "MONIT" is used instead). The jname of that +job is always "HACTRN" (pronounced "hack-tran"), +and the job is called "a HACTRN". The uname +will be three backarrows followed by three digits, identifying the tree +as non-logged-in. "Logging in" is nothing other than altering the uname +of the hactrn to a more meaningful name. It makes little direct +difference. +DDT and MONIT both provide facilities for creating other jobs for the +user, loading programs into them, and running them. There are no user +commands per se for controlling jobs built into ITS; instead, the +user gives commands to DDT or MONIT telling them to execute the system +calls to control his other jobs. + +The two main types of job trees are the console-controlled trees and +the non-console-controlled (or "disconsolate") trees. A console +controlled tree has one terminal which is "in use as a console" by +the whole tree. All the jobs in the tree can refer to that terminal as +device TTY:. The number of that terminal can be found in the .CNSL +variable of any job of the tree. +At any time, only one of the jobs in the tree has +permission to do I/O to the console; that job is said to "own" +the console. Ownership is transferred by means of .ATTY and .DTTY +UUO's executed by jobs in the tree (see ITS TTY). If ^Z (or CALL on +TV's) is typed on a console, the job that owns it gets a fatal +interrupt. The jobs may also have other terminals open "as devices", +but those can be in use only by a single job, not the whole tree. +The console-controlled trees are usually the ones with hactrn's at the +top. + +Disconsolate trees do not have any console, but in all other respects +bahave just like console-controlled trees. They may or may not be +"disowned". If they are, they get worse treatment from the scheduler +and swapper, and also may be more conveniently "reowned" (made into a +subtree of another tree - see below). Usually only system demons and +job-device handlers are disconsolate non-disowned trees. +Job-devices will have a .CNSL equal to that of the tree of the +job using the job-device. Other disconsolate jobs will have a .CNSL +of -1 if they are scheduled as part of the system, or -2 if scheduled +as disowned jobs. + +Jobs often refer to each other using a device, the "USR" device. A job +may be opened on the USR device by specifying its uname and jname as the +opened filenames. It is then possible to examine or deposit the job's +memory or user variables, etc. This is why DDT, when it starts up, +mentions its uname and jname by saying "USR: ". +The USR device should not be confused +with the JOB device, which is a mechanism for creating software devices +which enables the system calls that manipulate the device to be +simulated and handled by a user program, the job-device handler program +(See ITS JOBDEV). + +The remainder of this file is devoted to desribing the ITS system calls +with which jobs may create, delete, sense and control other jobs. + +B. CREATING AND DELETING INFERIORS, AND OTHER METHODS OF CHANGING THE + TREE STRUCTURE OF JOBS. + + 0. OPENING THE USR: DEVICE - A BASIC TOOL. + +Unfortunately, many different things are done by opening the +USR device in different ways in different situations. They +include creation of inferiors, reowning disowned jobs, selection +of existing jobs (inferiors or not), and testing for the existence +of a job. Opening USR is the ONLY way to do those things. What's +more, a job's memory cannot be read or written without having a USR +channel open in the appropriate direction, and a job's user variables +cannot be read or written without at least one USR channel open in +either direction. Thus, opening USR: is very important. It is intended +that this mechanism will be made more rational in the future. + +This section will describe what opening the USR device will do, +organised by how it is done. Later sections will say what +to do to achieve a specific goal. + +By convention, "USRI" and "USRO" are the canonical names in MIDAS +programs for the I/O channels used for opening the USR device for +input and output, respectively. Their use in an inferior-handling +program is a sort of comment. + +A USR: open always specifies two filenames. Normally they are +the uname and jname of the job to be opened. However, 0 may +be used as the first filename to specify your own uname. +If the second filename is 0, then the first is not really a +name but a job spec; this crock makes it possible to open a +job known only by its number. + +A USR: open must also ask for either block mode or unit mode. +Right now SIOT on unit mode USR channels is not as efficient as +IOT on block mode channels, so it is usually better to open in +block mode. In any case, this choice is orthogonal to everything +else. + +All USR: opens should specify image mode. Ascii mode doesn't now +exist for the USR device, and if you ask for it you will get image +mode instead, so for compatibility with the future you should ask +for image mode. + +There are four things specified in each USR open that affect the +actions taken in important ways. They are the two filenames, +the direction, and the device-dependent bit 1.4 of the open-mode, +known here (and inside ITS) as UBPFJ. + +If UBPFJ is set, the open may be for reading only, and will fail with +code 4 if the job specified by the uname and jname does not exist. +If the job does exist, it will be opened as a "foreign job", which +means that the opening job may not modify it at all using the +channel opened in this way. Also, the process of opening the job +with UBPFJ is guaranteed not to alter it. This style of open is +good for asking whether a job exists with particular names. + +Without UBPFJ, if the open is for writing, then +if a job with the specified uname and jname exists and is the + inferior of the job doing the open, it will be opened for + writing, with no special side effects. +If a job with the specified names exists and can be reowned + (it is a top-level disowned job), it will be reowned, and + opened for writing. Reowning may change its uname or jname, + so whenever an open might reown a job the program should + read back the uname and jname of the opened job just in case. +If no job with the specified names exists, then an attempt is + made to create an inferior by that name. If the specified + uname isn't the same as yours, that is impossible, and the open + fails with code 20. If you already have the maximum number of + inferiors, it fails with code 5. If there are no job slots available, + it fails with code 6. If the attempt succeeds, the new inferior + is opened for writing. +Otherwise (a job with the specified names exists, but isn't + an inferior of the running job already and can't be made one + by reowning it), the open fails with code 12. +Note that if an open for writing succeeds, you know the job that +is open is your inferior (thought it might not have been so before). + +An open for reading, without UBPFJ, is like an open for writing +except that when the job exists but isn't an inferior and can't +be reowned, it will be opened as a foreign job (as if UBPFJ were 1). + +To understand these possibilities better, think of the FOO$J command in +DDT, which means, essentially, "open the job named FOO". That command +will reselect a job named FOO if there is one; if not, it will create +one. If there is a job named FOO that isn't a direct inferior of DDT, +it will be selected, but will be unwriteable (DDT will type a "#"). If +there is a disowned job named FOO, it will be reowned (made into an +inferior of DDT), and DDT will type ":$REOWNED$"). + +There is no easy way to tell after the fact what has happened when +an open without UBPFJ has succeeded. You know you have an inferior, +if an open for writing succeeds, +but whether it is new, reowned or old is forgotten. If you care, +you should find out in advance what is going to happen by doing +an open with UBPFJ set. If it fails, you will get a newly created +inferior. If it succeeds, look at the .APRC and .SUPPRO user variables. +If both are negative, you have a top-level disowned job which +would be reowned. If .SUPPRO equals your .UIND variable, the +job is your inferior already. Otherwise, an open for writing +would fail, and an open for reading would open it as a foreign job. + +Some information is still available after an open. +The job's .UPC variable will be nonzero iff the job has ever run +(because the user-mode bit, %PCUSR, will be 1). +If the job has been run, then it certainly wasn't just created. +Also, if the job's uname or jname was changed by the open, then +it must have been reowned. + + 1. CREATION + +In order to create an inferior, one must choose a jname for it. +Its uname will have to be the same as its creator's, and together +the uname and jname must be unique among all jobs in existence. +An attempt to create an inferior looks just like an attempt to +open an existing job, so if the would-be creator is mistaken about +the uniqueness of the jname it may get confused (a way out of this +problem is described later). + +Given a jname which isn't in use, an inferior of that name may be +created by simply opening the USR device with the uname and jname +as filenames, as in section 0. You should open a channel in each +direction (call the input channel USRI and the output channel USRO). +If you are unwilling to try to live with a foreign job, do the +output open first. + +One way to make sure of getting a newly created job is to check +in advance that the names are not in use, by opening them with +UBPFJ (see section 0) before actually trying to create the job. +If the test open succeeds, close the channel again and +pick a new jname. + +The new inferior will have 1K of zeroed unshared core, +and will not be running (its .USTP will be nonzero). + +Then, if you wish to handle interrupts from the inferior, +read the inferior's interrupt bit, which may be found in +the inferior's .INTB variable, and remember it somewhere. +That is the bit .IFPIR on which YOU will be interrupted, +if the inferior gets a fatal interrupt. + + 2. DELETION + +Inferiors do not need to remain open to continue to exist. Simply +closing the channels one is open on does not delete it; it is +merely hard to refer to until it is opened again. This is so +that it is possible to have many inferiors without tying up many +I/O channels. When it IS desired to delete an inferior, the +.UCLOSE uuo should be used: + + .UCLOSE , + +This uuo kills the inferior open on . All the channels +it is open on are closed. The uuo does not skip. +If a foreign job instead of an inferior is open, all the channels +in this job that it is open on are closed, but it is not killed. +If there isn't a job open on the specified channel, an ILOPR +interrupt happens. + + 3. DISOWNING + +Disowning an inferior causes it to continue to exist, but no longer +as your inferior. This can be useful for two reasons: +1) you wish to log out but want the inferior to remain, or +2) you want the job to become someone else's inferior. + +Disowning is done with the DISOWN system call, as follows: + + .CALL [ SETZ ? 'DISOWN + 401000,,] + .VALUE + +It fails if the specified job isn't an inferior of the executing one. +If it succeeds, the specified job and its inferiors become +a separate disowned tree, of which the specified job is the top. +All channels on which the running job had that job open are closed. +See the DISOWN symbolic system call for more details and features. + + 4. REOWNING + +A top-level disowned job may be "reowned" (made one's inferior) +by opening it with bit 1.4 of the mode set to 0. The uname of +every job in the reowned tree will be changed to equal that of +the reowning job, if necessary. If as a result the uname/jname +pair of one of the reowned jobs is no longer unique, the jname +will be altered until the uname/jname pair is unique. + +Another way to reown a job is to use the REOWN symbolic system +call. The job to be reowned should already be open on an I/O +channel as a foreign user; the REOWN will cause it to be open +as an inferior instead on the same channel. An example is: + + .CALL [ SETZ ? SIXBIT/REOWN/ ? 401000,,USRI] + .VALUE + +In DDT, selecting a job that may be reowned will always reown it. +DDT will type ":$REOWNED$" when that happens. If the uname or +jname changes, DDT will type the new names. + + 5. DETACHING + +An entire tree may be made disowned, have its console taken +away from it, or both, with the DETACH system call. The goal might +be to free the console for other use, or to make the tree into +a subtree of another tree by reowning it. + + 6. ATTACHING + +Attaching is the operation of connecting a terminal to a tree +as the tree's console. The simplest kind of attachment takes +a free console and a disowned tree and connects them. A top-level +console-controlled job may also attach one of its inferiors to +its console; this has the same effect as if it were to disown +the inferior, detach itself, and then attach the erstwhile inferior +to the now free console, except that it happens more smoothly. +DDT's :ATTACH command uses the second flavor of ATTACH. See the +ATTACH system call for more details. + + 7. LOGGING IN + +When the system creates a top-level job (such as a HACTRN), its uname +will be three "_"'s followed by three unique digits. The job may +change its uname to one that gives more information to humans by +"logging in", which simply sets the uname. The job must not have any +inferiors at the time; the new uname must not start with "___" and +must not be in use. A logged-in job may not log in again, but it may +change its uname with a .SUSET of .UNAME. +Logging in is done with the LOGIN symbolic system call, as follows: + + .CALL [ SETZ ? SIXBIT/LOGIN/ + SETZ []] + .VALUE + +The system call takes an optional third argument which now should be +used only by network server telnet jobs. For them, its hould be the +sixbit string "HSTnnn", where nnn is the octal number of the foreign +host. + + 8. LOGGING OUT AND GUNNING + +A top-level job may delete itself, and all its inferiors, by "loggin +out". This is done with the .LOGOUT UUO, as follows: + + .LOGOUT + +The UUO returns only if it fails (the job isn't top level); it does not +skip. Programs that do not normally run in top-level jobs might +nevertheless be run in disowned jobs sometimes, so they should always +try to log out before requesting another command string or trying to ask +DDT to kill them. + +A job may force any top-level job to log out by "gunning" it, using the +.GUN UUO. The user index of the job to be gunned must be known. The +way to do it is: + + MOVEI AC, + .GUN AC, + JRST LOSE ;FAILED - JOB DIDN'T EXIST OR WASN'T TOP LEVEL. + ... ;SUCCEEDED. + +Gunning should go on only between consenting adults. + +C. CONTROL OF INFERIORS. + +Jobs can control their inferiors by means of several special-purpose +system calls. The more specific of them are documented below under +their uses. One more general one is .USET, which allows the inferior's +"user variables" to be read or set. For example, when section C.5. +speaks of "setting the job's .USTP variable", a .USET is meant. The +way to set the .FOO variable with a .USET is this: + .USET ,[.SFOO,,[]] +Thus, .USET ,[.SUSTP,,[0]] will stop the job open on channel +. + .USET ,[.RFOO,,TEMP] will read the value of the .FOO +variable into TEMP. +For a complete description of the available .USET variables, and more +features of .USET, see the file ITS .USETS. + + 1. READING AND WRITING + +Reading or writing the contents of another job requires having the job +open on a USR device channel. It is done by .IOT'ing on that channel; +thus, reading requires an input channel and output requires an output +channel. Selection of the region to read or write is done by setting +the channel's access pointer with .ACCESS. At the moment, SIOT on unit +mode USR channels is not very efficient, so it is best to open a job in +block mode. That requires one extra instruction when transferring a +single word, which is a slight cost when compared with the ease of +transferring several words. +Note that ascii mode does not exist for the USR device - all channels +should be opened in image mode. + +For example, to read the word at 500 into A, do + + .ACCESS USRI,[500] + HRROI B,A + .IOT USRI,B + +assuming that USRI is the USR input channel. This clobbers B. +To write A into the word at 500, do + + .ACCESS USRO,[500] + HRROI B,A + .IOT USRO,B + +assuming that USRO is the USR output channel. This clobbers B. + +If a non-existent location in another job is read or written +with an IOT, an MPV interrupt results. The .MPVA variable +of the job doing the reading will point at the non-existent +page of the other job. (Actually, in ITS before version 1017, +when a non-existent page is written, the system may give an MPV, +or may do a .CORE on the inferior so that it has enough core +to make the IOT succeed. ITS version 1017 and up will +always MPV). + + 2. SHARING MEMORY BETWEEN JOBS + +Another way to refer to the core of other jobs is to share +memory with them. The slots of a job's page map should be +understood to be pointers to pages; one page may be pointed +to independently by several slots in several jobs' page maps. +The CORBLK call can be used to copy other jobs' pointers to pages +into one's own job, resulting in shared memory. Of course, +the memory will not have the same address in both slots +unless that is specificaly arranged for. +Unfortunately, other jobs' accumulators cannot be referred to +via memory sharing, since they are not stored anywhere in +the job's memory even when the job isn't running. + + 3. LOADING + +Loading a binary file into a job is not actually a fundamental +operation, since it could be done by a program that understood +the format of the binary file and deposited in appropriate +locations in the job being loaded. However, for convenience' +sake, the LOAD system call exists for loading a binary file +into an inferior, or into the running job itself. Both types +of ITS binary files may be loaded with LOAD; it is not necessary +to know which type of file is being loaded. Unfortunately, this +call works only for disk files. For other devices, the program +must do it the hard way. Code may be copied from DDT for that +purpose. + +The LOAD system call takes two arguments: the job to be loaded, +and the file to load. The first is expressed by a job spec; the +second, by a channel number. For example, + + .CALL [ SETZ ? SIXBIT /LOAD/ + 1000,,-1 ;into myself + 401000,,DISKC] ;the file open on DISKC + .VALUE + +The LOAD will leave the disk channel set up to read the file's +start instruction, which is a jump to the starting address, or +zero if there is no starting address. After that word in the +file should come the symbol table and another copy of the start +instruction; see DDT ORDER for their format. + +Loading a PDUMP file (pure file) inserts pages into the job +as specified by the file. It does not alter the pages of the +job that the file has no data for. It also does not alter the +accumulators, even if page 0 is loaded. Loading an SBLK file +(impure file) alters only the words of the job that the file +specifies data for. The other words are NOT cleared. If data +are specified in a nonexistent page, fresh memory will be +put there, and also in all nonexistent pages below it in the +address space! Thus, if an impure dump is made of a job containing +nonzero data only at address 100000, the resulting file when +loaded will create core up through address 101777, even though +only the last page of that is actually being loaded. This +unfortunately cannot be changed, but often causes trouble. For +that reason (and many others), it is hoped that there will be +a new, more versatile binary format some day. + + a. Resetting + +Loading per se modifies only the locations that the binary file +specifies data for. It does NOT clear the rest of core. If you +want to do that, chances are that you really want to RESET the +inferior. To do that, use the .RESET UUO or the RESET symbolic system +call on an I/O channel with the inferior open. + +RESETting a job deletes all of its core, provides it with a single +page of unshared writeable core, closes all the job's channels, +kills all of its inferiors, and re-initializes most of the job's +system variables. Most notably not cleared out are the job's +translation lists for filenames. + + 4. DUMPING + a. Pure dumping + b. Impure dumping + 5. STARTING AND STOPPING + +An inferior may be started (caused to run) by setting its .USTP +variable to zero. It will continue with whatever PC it has. +To set the PC, store the desired new PC in the .UPC variable. + +An inferior may be stopped by setting the .USTP variable to +nonzero. The exact value deposited in .USTP will be forgotten +since it corresponds only to a single bit of real storage. +This is how the system stops a job which gets a fatal interrupt. + +DDT has another way of stopping a job, which it uses in executing +the ^X command: it turns on bit %PIC.Z of the job's .PIRQC, causing +a fatal ^Z-typed interrupt in that job. +This not only makes the system set the job's .USTP, but causes +DDT's interrupt handler to find out about the stoppage of the +job and be properly faked out. + + 6. HANDLING INTERRUPTS + +Every job has the ability to enable interrupts on several conditions +(see ITS INTRUP). Among those conditions is the occurrence of a fatal +error interrupt in an inferior. This is the mechanism that enables +a job to "return to DDT" deliberately - it simply causes a fatal +interrupt in itself. This is also how DDT knows when an illegal +instruction is executed by an inferior. + +Whenever a job acquires an inferior (by creation or reowning), one +of the job's interrupt bits is assigned to that inferior. Each +inferior has its own interrupt bit. There are exactly eight +interrupt bits which can be used for that purpose, which is why a +job can have at most eight inferiors at a time. Those eight are +all located in the left half of the .IFPIR variable. + +The superior should find out which interrupt bit was assigned by reading +the inferior's .INTB variable, in which that bit alone will be 1. + +See ITS INTRUP for more details. + +The two system calls .VALUE and .BREAK exist solely so that a job can +cause a fatal interrupt to signal its superior. DDT has standard +interpretations for those instructions; see .INFO.;DDT ORDER. + + 7. DEBUGGING CONTROLS. + +These features exist to facilitate debugging. They work currently on +KA-10's only, though they will be extended to KL-10's eventually. +They are generally used and controlled only by the superior of the +job on which they are acting, to which they are generally transparent. + + a: One-proceed. + +If appropriate bits in a job's PC are set, that job will be +able to execute one more instruction and then will get a fatal +%PI1PR interrupt. This feature is used by DDT's "single step" +command (^N). Which bits to use depends on the processor type: +for KA's, %PC1PR is the right bit (it is an 18 bit quantity, to +be OR'ed into the flags); for KL's, %PS1PR is right. On any +machine, the symbol OIPBIT will be defined in the ITS symbol +table as either %PC1PR,, or %PS1PR,, , whichever is appropriate. + + b: Address-stop (MAR). + +The MAR feature makes it possible to trap all references to a +particular address. When the specified location is referred to +("the MAR is hit"), the inferior will get a fatal %PIMAR +interrupt, which may or may not allow the instruction that +tripped the MAR to finish. The MAR is turned off when it is +hit and must be turned on again explicitly or it will stay +off forever. + +The MAR is controlled by the .MARA user variable. Its RH +contains the address to be traced. Its LH contains the control +code, which is 0 to turn the MAR off, 1 to trap instruction +fetches only, 2 to trap writes only, and 3 to trap all +references. There is also a variable .MARPC which, after +the MAR is hit, contains the address of the instruction that +hit it. In addition, the indirect bit will be set on KA's +if the instruction that hit the MAR was completed (on KL's, +the instruction is always aborted). +On KL's, after a MAR, the job's PC (.UPC) will have %PSINH +set, which will inhibit MAR hitting for one instruction +when the job is continued. +The job's PC in .UPC should NOT be used to locate the +instruction that hit the MAR, since if the instruction was +not aborted and was a jump, the PC will be the address +jumped to. Even if it wasn't a jump, it might have skipped. + + c: .JPC - Last Jump Address. + +The user variable .JPC always contains the address of the last +jump instruction executed in the job. It can be used, for +example, to trace a job backward from the point of failure by +putting in a breakpoint, examining the .JPC when the breakpoint +is hit, and running the program again with the breakpoint now +located at the previous jump, etc. Unfortunately, subroutine +calls (including user-trapping UUOs) alter the JPC, even though +the information is redundant for them, but returnable UUO's and +interrupts do not. For that reason, after a returnable UUO +or interrupt a program should always read .JPC before jumping +anywhere, for debugging purposes. The canonical names UUOJPC +and INTJPC exist for the locations .JPC is saved in. Also, +error-handling uuos used by the program should be returnable +uuos rather than direct user-trapping uuos, so that the JPC +will be meaningful. The vectored interrupt mechanism has the +ability to store .JPC automatically on each interrupt (see +ITS INTRUP). + + 8. TTY PASSING + +For now, see under .ATTY and .DTTY in ITS TTY. + +D. SYSTEM JOBS AND WHAT THEY DO + +There are two jobs built into the system, that run in exec mode +and perform housekeeping tasks; they are the system job and +the core job. There are also various "demon" jobs that exist +at times which, though receiving no special treatment from the +system, may be regarded as part of it in that they provide a +system-wide service. + + 1. THE SYSTEM JOB. + +This job, whose full name is SYS SYS, provides a great many +independent services; it is really a timesharing system for +many trusting processes, each of which is controlled by a +single bit in the system variable SUPCOR. Setting the bit for +a process causes the process to run, and clear the bit. The +process should never run for very long, or it may tie up the +system by making the services of the other processes +unobtainable. If a process wishes to run continually, it does +so by setting its bit in SUPCOP. SUPCOP is or'ed into SUPCOR +every second, so a process whose bit in SUPCOP is set will be +run again that often. The process is always started the same +way, but it can of course have state variables. + +The reasons why a given activity may involve the system job are +1) it may wish to print a message on the system log terminal, or +2) it may need to run in a job (eg, do system calls), but not be +associated with any one job, or +3) it may need to be able to hang up for short periods of time, +but the need to do it may be noticed at a time when that is +impossible, or +4) it needs to be done once every two minutes or every two hours. +The routines for those "very slow" and "super slow" clocks are in +the system job. + +Re-initialising the connection to the IMP is an example of reasons 1 +and 2. Typing "console free" messages is an example of reason 3 - it +involves doing I/O to the terminal, but it isn't done until the last +stage of killing a tree, when waiting of any sort would allow PCLSR'ing, +which would leave things in a screwed-up state. An example of reason 4 +is the detection of core-link files which have not been used for more +than 2 minutes. + +A complete list of the system job's functions follows: + + a: Allocating or Deallocating Memory for Job Slots. + +Most of the memory occupied by the system is marked as belonging to +the system job. For that reason, the way more is allocated for user +variable blocks is by having the system job do a .CORE UUO. This is +somewhat of a historical crock. Creating a job does not require such +allocation if there are free slots in the memory already allocated. +However, it may need to. For that reason, if the system job is hung +up, often jobs cannot be created. + + b: Printing Various Messages on All Terminals. + +Sometimes, messages such as "ITS GOING DOWN IN ..." or "ITS BEING +DEBUGGED" are printed on all the terminals in the world. It is the +system job that prints them on terminals which are free. Consoles have +them printed by DDT, however. + + c: Checksumming the Constant Areas of the System. + +The system job is always checksumming parts of the system and comparing +the checksums with those previously calculated. This mechanism causes +the clobberage of a word in the code of the system to be detected. If +only a single word in an area is clobbered, which word it is and the +original contents can be detarmined. In any case, a message is printed +on the system log terminal when clobberage is found. + + d: Determining the Date and Time. + + e: Detaching Trees. + +When a top-level job is halted by a fatal interrupt, it is the system +job which executes the DETACH system call to detach it. Similarly, it +is the system job which detaches trees controlled by TV terminals when +the TV system crashes, and trees controlled by dialup lines whose +connections are broken (only when the hardware can detect that). + + f: Depositing in the System. + +When a job deposits in the system using .SETLOC or .IFSET, the system +job is informed so that it can update its checksums and avoid a system +clobbered" message. It also makes the change. + +This used to be a great screw, in that if the system job were hung, it +could not be fixed by depositing in the system. Now, .SETLOC will do +the work itself without calling the system job, if the system job +appears to be hung. + + g: Printing "Console-free" Messages. + +When a terminal ceases to be in use, the system job is signalled to look +at all terminals and print console-free messages on all those which have +recently stopped being in use. + + h: Logging Out. + +The final stages of killing a job must be run by some other job. When a +top-level job is being killed, it does some of the work itself (kills +its inferiors and closes its channels). That is to make sure the +system job never hangs up trying to do it. The rest of the work is +then done by the system job, which can afford to wait for short peiods +of time when the job is almost killed. + + i: Reinitialising the NCP. + +When the connection to the ARPA network goes down, the system job gives +interrupts to all the jobs using the network, and also checks every so +often whether the network is useable again. + + j: Printing of Various Messages on the System Log Terminal. + +Events which cause messages on the log terminal include logging in, +logging out, writing on a directory whose name starts with "SYS", +garbage-collecting a disk directory, creating a disk directory, +gunning, parity errors, NXM errors. + + l: Spooling the LPT. + +On the AI KA-10 and the ML KA-10, the system job checks periodically for +spooled files and prints them. + + m: Starting Other Demons. + +On DM, the system job checks for any domon programs which have been +signaled. If there are any, it loads them into newly created jobs +and starts them. + + n: Reinitialising the TV System, or Noticeing that it is Down. + + 2. THE CORE JOB. + +This job, whose full name is CORE JOB, allocates core to jobs that +request it, and also frees up memory for use as user variable blocks, +which have to be allocated consecutively, by relocating the old +contents. Before there was pageing, the core job used to do shuffling. + + 3. DEMON JOBS. + + a: The Comsat. + +This demon, always named after some spacecraft or rocket, is responsible +for handling mail. Requests to send mail are placed in the .MAIL. +directory, and are eventually processed by the demon. The demon is +necessary because it may not be possible to send mail to other machines +right away, and in any case the user should not have to wait the time +it takes. It also provides other services such as forwarding. + + b: NAMDRG. + +This demon maintains the list of logged in users which appears on all +free TV consoles. It also updates a file saying when every user +logged out last. It exists on the AI KA-10 only. + + c: PFTHMG DRAGON. + +This demon updates the logout times file and keeps track of each user's +total CPU time. This demon originated on the ML KA-10, but has run on all +ITS machines at one time or another. + + \ No newline at end of file diff --git a/sysdoc/uuos.111 b/sysdoc/uuos.111 new file mode 100644 index 0000000..ec51d2d --- /dev/null +++ b/sysdoc/uuos.111 @@ -0,0 +1,2307 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS UUOS: + +This file attempts to maintain up-to-date documentation on +all non-symbolic ("old") system calls. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the .FOO uuo ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + +On the PDP-10, opcodes 0 through 77 are deliberately "not +defined", and are called uuos ("unimplemented user operations"). +Also, certain other opcodes are either illegal in user mode +or undefined (for example, I/O instructions, JRST 4,). + +When an undefined instruction is executed, it "traps to 40": +it is stored in location 40 +with the index and indirect fields zeroed and the address field +replaced by the effective address, and then the instruction +in 41 is executed (it is usually a subroutine call). +(Some instructions actually trap to 60 on KA's, but ITS contrives +to make them appear to have trapped to 40 just like all +the others). + +uuos 1 through 37 are reserved for user programs. They +go through the entire trap sequence remaining in user mode, +so it is the user's locations 40 and 41 that are used. +The operating system is not involved at all. +These uuos are called "user uuos". + +The other undefined opcodes enter exec mode during the trap, +so that the system's 40 and 41 are used; the PC saved by the +subroutine call will say "user mode" if the uuo was executed +in user mode, however. These instructions are the normal way +of calling any PDP-10 operating system. + +ITS interprets uuos 40 through 47 as monitor calls; those +uuos are called "system uuos". The bulk of this file is devoted +to describing how to use them. In addition, ITS will simulate +some I/O instructions for the user (for example, any CONI, and +DATAI 0,). All other instructions that trap to the system +will be signaled to the user (they are "returnable uuos"). +For simple programs, they will cause an ILOPR interrupt +(%PIILO, bit 1.6 of .PIRQC). For programs that appear able to +handle them, they are "returned" to the user, pretending to +be user uuos - that is, the system makes it appear that they had +trapped to the user's 40. However, they do not act precisely +like user uuos: + 1) The system can't simulate any trap instruction but +unindexed, direct JSR. If the user's trap instruction is +not a JSR, or is indexed or indirect, the system assumes that +the user can't handle the returnable uuos, and causes an ILOPR +interrupt instead. Also, if the AC field of the JSR is nonzero, +the system will interrupt instead of returning the uuo; this +is a way for a program to say explicitly that it doesn't want +to have uuos returned, but still handle user uuos. + 2) If the opcode in 41 is 0, the system treats it as if it +were a JSR. + 3) 0 is not considered a reasonable place to JSR to. If the +address field of 41 is 0, the system will interrupt instead of +returning the uuo. + 4) While the addresses 40 and 41 are fixed by hardware for +user uuos, for system returned uuos they are not. They must +always be consecutive, but the address of the first one is +kept in the RH of the .USET variable .40ADDR (whose initial value is, +of course, 40). Thus, the user may have one handler for user uuos +and another for returned uuos. +Note that the system uses "42" for interrupts and "43" and "44" +for the "locks" feature; those locations are also shifted +by setting .40ADDR. + 5) Returnable UUOs have complicated interactions with DDT. +When proceeding from a breakpoint, DDT must simulate certain +instructions, including all those that can transfer control. +User uuos can be simulated properly, but not returnable ones +since DDT does not know how to decide whether they are to cause +ILOPRs. So DDT treats those uuos like the typical instructions; +it puts the uuo in 31, a jump to 1 + the actual address of the +uuo in 32, and a jump to 2 + that address in 33. It then starts +the job at 31. If the returnable uuo handler does nothing with +the PC except possibly return to it, and does not try to examine +the uuo except by looking at 40, this causes no problem. However, +if the uuo is followed by arguments, or if it can skip more than +once, or if it tries to remember the PC somewhere, the handler +must understand that if the PC is 31 (+1) special treatment is required. +In addition, the real location of the uuo will contain not the +uuo but a .BREAK, which will be there to implement the breakpoint. + +If the .UTRAP variable of a job is nonzero, ALL instructions +that trap to the system will cause ILOPR interrupts - even those +that are usually treated as system calls. In addition, the +job will not handle any of its own interrupts - they all interrupt +its superior. Thus, the superior can make the job believe it is +running under a non-ITS environment. User uuos are not affected. +The .UTRAP variable is the same as the %OPTRP bit in the LH of .OPTION. + +If the %OPDEC bit in the LH of .OPTION is set, uuos 40, 41 and 47 +(as well as those I/O instructions which ITS usually simulates) +become returnable uuos instead of system calls. By a lucky +coincidence, those uuos, which are the only ones used by both +ITS and TOPS-10, are not really necessary in ITS (they are +.OPEN, .IOT and .ACCESS, and all have alternative forms using .CALL). +In this mode, all uuos used as system calls by TOPS-10 are +returnable. One of the TOPS-10 simulators works by setting +this bit, and making .40ADDR point into the simulator where +it lives at the top of core (to avoid conflicting with the user +uuo handlers of the simulated programs). + +CALLS: Overview of ITS System Calls + +ITS system calls come in two kinds: the older, numerically +decoded, non-standardized kind, and the newer "symbolic +system calls" with a standard calling sequence. + +Each of the numerically decoded system calls is distinguished +from all of the others by the values of specific fields +in the instruction (the opcode, and maybe the AC and address +fields). Each specific system call is known as "a uuo", and +its name is a predefined symbol in the assembler, whose value +is the appropriate instruction. For example, one uuo is +.ACCESS; it is distinguished by the opcode field alone, which means +that the AC field and address are available as arguments. +The symbol .ACCESS is defined as the appropriate opcode. +.RCHST, however, is distinguished by its opcode and its address, +so that only the AC field can be used as an argument. The uuos +distinguished by opcode and address all have the same opcode, +which is called .OPER; thus, all such uuos are called ".OPER's". +.FDELE is distinguished by opcode and ac field, leaving the address +as an argument; such uuos are called ".CALL's" since they all have +.CALL as their opcode. Each uuo is described individually in this file. + +The symbolic system calls all use the uuo .CALL. They are +distinguished by the contents of the block addressed by the .CALL, +which also points to the arguments. Ths symbolic system calls +are described in more detail in the file .INFO.;ITS .CALLS. + +.ACCESS chnum,[access pointer] set file access pointer + + Sets the access pointer for the I/O channel + for the next input/output operation. This is used to + effect random access. On the DSK device (and DSK-like + JOB devices) the access pointer is the number of "bytes" + from the beginning of the file. Bytes are normally the + same as words, but in unit ascii mode there are five + seven-bit bytes per word. In the future there may be + the ability to have bytes of any size from 1 to 36 bits. + On the USR device the access pointer is the address + within the job's memory. + Random access on the USR device can also be effected + via page mapping (see the .CBLK uuo and the CORBLK + symbolic system call). If the channel number + is variable, the symbolic system call ACCESS may + be used in place of the .ACCESS uuo. + The symbolic call RFPNTR may be used to read the current + access pointer for a file. + +.ARMOFF + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ARMOVE + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ARMRS + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ASSIGN ac, assign a microtape + ;skip if successful + + The accumulator should contain the number of a + microtape drive. If it succeeds, it assigns the drive + to the user who executed the .ASSIGN. When a job + attempts to use a microtape drive, + it will succeed only if it has the same + sname as the uname of the job which did the .ASSIGN. + A .ASSIGN will fail only if the drive is already + assigned to a different user (i.e. a different uname), + or if an invalid drive number is given. + See also the .DESIGN and .RCHST uuo's. + +.ATTY chnum, assign tty to inferior + ;skip if successful + + Puts the job in the state of wishing to pass control of + the tty to the direct inferior open on the specified + channel. It skips if successful; it fails if the + channel does not have a direct inferior open, if the + executing job had never had the tty, or if it had not + been in the state of wishing to retain the tty. If the + job had the tty, after the .ATTY the tty will belong + to the specified inferior, or one of its inferiors. + A job need not have the tty to do an .ATTY. + See the .DTTY uuo, and the .TTY user variable. + Also see ITS TTY. + +.BREAK ac,address breakpoint instruction, etc. + + The and
fields of this uuo are totally + ignored by ITS. The procedure executing it receives + a class 1 interrupt (bit 2.2 of the .PICLR user + variable, called %PIBRK), stopping it and interrupting + its superior. + + The standard superior procedure, DDT, assigns + the following semantics to .BREAK, dependent on + the field (for full information see DDT ORDER): + + meaning + 1-10 Breakpoint number in the program, for + between 1 and 10. + 12 Request for information transfer. + 15 Temporary breakpoint number 1. + 16 Request for program suspension or termination. + 17 Temporary breakpoint number 2. + + The "normal termination" instruction is .BREAK 16,160000 + (but also see .LOGOUT). + + When DDT sets a breakpoint in a program on a given + instruction, it replaces the opcode with .BREAK + and the ac field with the breakpoint number. Thus + the instruction will still calculate its usual effective + address before breaking. The two temporary breakpoints + are used for ^N (multiple instruction proceed), etc. + + .BREAK 12, is used to transfer information between + DDT and the executing program at the latter's request. + .BREAK 12, is like .SUSET in that it points + either to a specification word or to an AOBJN + pointer of such words. Bit 4.9=0 means read, =1 means + write (from the program's point of view). Writing can + be illegal if the ..PERMIT variable in DDT for + the job is set appropriately. Bits 4.7-3.1 + determine the type of information transferred: + ..RSTA 1 Starting address of program. + ..RLFI 2 Loaded file name. + Four words: device, sname, file name 1, file name 2. + ..RSTP 3 (read only) AOBJN pointer to program's symbol table + in DDT. The left half is the negative of + the symbol table size. See type 7 (..RSTB). + ..RSYM 4 Symbol definition. Uses two words. + Read: first word contains squoze for symbol. + Second word receives value. + If undefined, first word is zeroed. + Write: first word contains squoze, second value. + ..RJCL 5 Read: fetches command string for program. + Set by : command or via :JCL. + Always transfers at least one word of + packed ascii, then more until either a + zero word is transferred or until a + non-zero is about to be transferred into. + String is terminated by ^M if non-null. + Write: clear command string. + ..RPFI 6 File name defaults used for :PRINT. + Four words: device, sname, file name 1, file name 2. + ..RSTB 7 Symbol table. Allows transfers of many + symbols in either direction. + ..RCON 10 (read only) Number to symbol conversion. + Uses two words. The first should initially + contain a value. It receives squoze for + a symbol, and the next word receives a delta. + The value of the symbol plus the delta equals + the original argument. The lookup used by DDT + for symbolic typeout is employed here. + If the lookup fails, the first word receives + zero and the second receives what the first held. + ..RXUN 11 (read only) The XUNAME (a uname to be used for + getting mail, etc.). This is like the UNAME, but + has trailing digits stripped off, etc. This is + OBSOLETE; use the .XUNAME user variable. + ..RXJN 12 (read only) The XJNAME (what this job should think + of as its "real" name). This is like the JNAME, + but has trailing digits stripped off, etc. This is + OBSOLETE; use the .XJNAME user variable. + ..RLJB 13 (read only) Read index of previously current job. + ..RRND 14 Reads or writes the ..URANDM variable in DDT for + this job. + ..RPUR 15 Unpurify page. + ..RHSN 16 (read only) Ask to lookup an HSNAME from an XUNAME. + ..RMAI 17 (read only) Ask to lookup user's mail file name. + (Symbols with names starting with "..S" exist for all those not + marked as read only. For example ..RSTA==1 and ..SSTA==400001.) + + Illegal .BREAK 12,'s cause DDT to give the program an + illegal operation interrupt (bit 1.6 in the .PIRQC + user variable). + + .BREAK 16, is used to return to DDT in various + nice ways. The effective address is decoded as follows: + 2.9 Return from X. (Do not use unless you understand it!) + 2.8 Type extra carriage return in DDT. + 2.7 Do not reset TTY input (effective only if + executing job has the TTY). + "Normal" returns to DDT should always have + this bit set. + 2.6 Kill executing job: + Immediately, if it has the TTY. + When it gets the TTY, if current job. + Otherwise when J'd to in DDT. + Will print ":KILL" when killed. + 2.5 Kill executing job: + Like 2.6 if job current. + Otherwise is killed silently. + 2.6&2.5 Together mean kill executing job: + Like 2.6 if job current. + Otherwise kill immediately, and print + JOB FINISHED on TTY. + 2.4 Conditional breakpoint return. + 2.8=1 => condition true. + 2.8=0 => condition false. + Used by DDT. Dangerous for users to play with. + 2.3 Don't type even a carriage return. Don't close + the currently open location. If killing self + don't type :KILL. + 2.2-1.1 Illegal. (Reserved for expansion.) + + DDT sets the %OPCMD and %OPBRK bits for + its inferiors appropriately. See the .OPTION + user variable. + +.CALL [ SETZ ? SIXBIT \name\ ? -- args -- ] symbolic system call + ;skip if successful + + The .CALL uuo is used to invoke a large class of + operations which are distinguished by a sixbit name. + See the file ITS .CALLS for more information. + + .CALL is sometimes used in a generic sense to denote + the set of uuo's with the same opcode as .CALL; they + are distinguished by their accumulator fields: + .CALL 0, .CALL + .CALL 1, .DISMISS + .CALL 2, .LOSE + .CALL 3, .TRANAD + .CALL 4, .VALUE + .CALL 5, .UTRAN + .CALL 6, .CORE + .CALL 7, .TRANDL + .CALL 10, .DSTART + .CALL 11, .FDELE + .CALL 12, .DSTRT + .CALL 13, .SUSET + .CALL 14, .LTPEN + .CALL 15, .VSCAN + .CALL 16, .POTSET + .CALL 17, unused + +.CBLK ac, hack a core block + ;skip if successful + + This uuo is ARCHAIC. Its use should be avoided + in new programs, since the CORBLK symbolic system call + is much more flexible and easy to understand. + + The contents of accumulator specify an operation + on the executing job's core. It modifies the job's + page map entry for one page. The contents of + should be as follows: + 4.9 Must be zero. + 4.3-4.1 Desired operation: + 0 Get page from self. + 1 Get absolute page. + 2 Get a page from the user open on + the channel specified by bits 3.8-3.1. + 3 Get a page from the user whose user + index is in bits 3.8-3.1. + 4 Get fresh page. + 5 Get public page. + 6 Make my page public. + 7 Make my page private. + 3.9 If 1, request write permission for the page. + Assumed 1 for operation 4 (fresh page). + Otherwise valid only for self, public page, + or direct inferior open on channel. + 3.8-3.1 User index or USR device channel. + If the executing job is a job device, then + 377 will refer to the job which invoked it. + 2.9 1 = insert page in core map. + 0 = delete page. If the operation is 6 or 7, + this bit is ignored. Otherwise, the operation + is ignored for deletion. + 2.8-2.1 Virtual page to be affected within the core map + of the executing job. + 1.9-1.1 Block number within source specified by + bits 4.3-4.1. + + Sample contents of for various operations: + Delete my page 43: 0,,43000 + Create a fresh page 217: 4400,,517000 + Make my page 45 be read-only: 0,,445045 + Make my read-only page 45 writable: 400,,445045 + Make page 16 of job 34 read-only + as my page 377: 3034,,777016 + + This uuo is all right for hacking single pages within + your own core map. To alter another job's core map, + or to hack many pages at once, use the CORBLK + symbolic system call. + For more information on core blocks, see ITS CORBLK. + +.CLOSE chnum, close a file + + The input/output channel is closed. All + operations associated with that channel are completed. + For file structured devices, if another file with + the same name exists (if was being used for + output), that file is deleted at this time and the new + file replaces it. + Any further attempts to use the channel without re-opening + it will cause errors. + .CLOSE does nothing if the channel is not open. + If the USR device is open on the specified channel, + the job is not killed by .CLOSE; it is merely made + to be no longer open on the channel. To kill a USR + device job, the .UCLOSE uuo must be used. + If the channel number is a variable, the CLOSE + symbolic system call may be used. + +.CORE set core limit + ;skip if successful + + This uuo is a relic of the old pre-paging version of ITS. + For applications which want to be relatively clever + about paging and core allocation, see the .CBLK uuo + and the CORBLK symbolic system call. + The effective address of .CORE should be a number between + 0 and 400 octal. The core of the procedure executing it + is modified as follows: + + (DEFUN *CORE (N) + (DO ((K (// (*SUSET *RMEMT) 2000) + (// (*SUSET *RMEMT) 2000))) + ((= K N)) + (COND ((< K N) (CREATE-PAGE K)) + (T (DELETE-PAGE (- K 1)))))) + + That is, at each step a page is either added or deleted + at the top of the job's memory until page is the + highest one in the job's memory. Only a .CORE to + acquire more core can fail. If a .CORE fails to skip, + some of the requested core may have been obtained, + though not all. + +.DCLOSE display close + + This system call releases the 340 display or the + E&S display, if possessed by the executing job, and + closes all channels on which the display is open. + If the display is being hacked via .DSTART, this + won't be any channels. In the case of the 340, the + display is made available to the pdp-6. + If the executing job does not possess the + display, .DCLOSE does nothing but return. + +.DCONTIN display continue + + This system call will restart the E&S display after stopping + or single stepping (.DSTOP, .DSTEP). If the display is + stopped because of a Display MPV, a Hit Stop, WCR stop or + PROG Stop, the condition will NOT be cleared and the display + NOT restarted. If the display is not stopped or does not + belong to the executing job, no action is taken. + + This system call is ignored by the 340 display. + +.DEMON acknowledge one demon request +.DEMON ac, acknowledge demon requests + ;skip if successful and more requests pending + + As of September 1, 1976, only the DM machine has this. + + If the executing job is not a demon, the uuo merely returns + without skipping. If it is a demon, then either 1 or + the contents of the specified non-zero are subtracted + from the demon's request count, and the uuo skips iff the + resulting count is still positive. + See the DEMSIG, RDDMST, and STDMST symbolic system calls. + +.DESIGN ac, de-assign a microtape + ;skip if successful + + The accumulator should contain the number of a + microtape drive. It reverses the effect of a .ASSIGN + uuo by making the drive unassigned again. A .DESIGN + will fail only if an invalid drive number is given, + or if the drive is assigned to some other user than + the one owning the job trying to do the .DESIGN. + It will succeed if the drive is already unassigned. + +.DIAL ac, ANCIENT HISTORY dial a dataphone line + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .NETAC. + + The accumulator should contain a byte pointer + of the following form: + 440600,,[data](n) + where is not an index field, but the number of + a dialer (0 or 1), and is a series of dialing + bytes. The byte string may not be longer than 5 words. + Each byte specifies a dialing step as follows: + 0 End of data. + 1-10. Send 1-10. dialing pulses. Pauses are supplied + between digits automatically. + > 10. Pause <-10.> seconds in dialing. + If the accumulator is zero except for the dialer number, + then the "break" signal is sent after any previous + dialing has been completed. + A .DIAL will fail if the dialer number is invalid, + if the TTY associated with the dialer (0=T07, 1=T06) + is in use by another job, or if the dialer is being used + by some other job (the other job has not done .HANGUP yet). + See the .DIALW and .HANGUP uuos. + +.DIALW dialnum, ANCIENT HISTORY wait for dialing to finish + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .NETS. + + If dialer number is assigned to the job + executing the .DIALW (i.e. the job has done a .DIAL + but not a .HANGUP), then .DIALW skips after waiting + for dialing to be completed. Otherwise it fails. + See the .DIAL and .HANGUP uuos. + +.DIETIME ac, OBSOLETE time until system dies + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the SSTATU + symbolic system call. + + The accumulator is set to the maximum time + (in thirtieths of a second) before ITS will go + down. If the system is not planning to go down + (the normal case, we hope!) is set to -1. + See also the .REVIVE and .SHUTDN uuos. + +.DISMISS [new PC] dismiss an interrupt + + Dismiss an interrupt. The user variable .PICLR + is set to -1, thereby enabling interrupts, and the PC + receives the quantity . + + This is for the so-called "old-style" interrupt scheme. + See also the DISMIS symbolic system call, which + is ordinarily used with the "new-style" vectored + interrupt scheme, but may be used in either case. + + Typically .DISMISS is used in this manner: + + LOC 42 + JSR TSINT ;pointer to interrupt handler + LOC 100 ;or wherever + TSINT: 0 ;interrupt flags + 0 ;PC as of interrupt + EXCH A,TSINT + TSINT1: TLZE A, ;check for various interrupts + JRST ;handlers return to TSINT1 + TLZE A, + JRST + . . . . + MOVE A,TSINT ;restore accumulator + .DISMISS TSINT+1 ;dismiss interrupt + + See ITS INTRUP for more information on interrupts. + +.DISOWN chnum, disown an inferior + + An inferior job should be open on channel . + The job is caused to be no longer an inferior of + the executing job, and is made to be the top level + job of a disowned job tree. The usual reason for + disowning a job is so that it can continue to exist + after its former superior has been killed (for instance, + after the user who disowned it has logged out). + Another reason for disowning a subtree is to reown it + under a different superior, thus altering the shape + of the system's job-tree structure. + All channels on which the executing job has open the + job being disowned will be closed in the process of + disowning (see the .CLOSE uuo). Disowning is illegal if + does not have an inferior open, or if the + subtree being disowned controls the console (see the + .ATTY uuo). If the jobs of the subtree have opened + the console, then the channels are not closed, but + are marked as "disowned tty"; certain operations + on such a channel will succeed, and others will hang + until the tree is re-owned and a console tty given + to the job. Such channels appear to be open on + tty number %TINON=77 octal. + A disowned job is distinguished by the fact that + bit 4.9 of its .APRC user variable is set. + A disowned job never succeeds in executing the RELOAD symbolic + system call, even if it is the top level job in its tree. + When a job tree is logged out, any micro-tapes assigned + to the uname of that job tree are de-assigned (see the + .ASSIGN and .DESIGN uuo's), but only if the job tree is + not disowned. + All disowned jobs share a resource word for purposes of + scheduling, in the same way that all jobs in a single + non-disowned tree share a resource word. Thus all disowned + jobs tend collectively to use no more runtime than any + single non-disowned job tree. + Furthermore, individual disowned jobs are given only 1/4 + the priority to run as a non-disowned job. This does + not apply, however, if the disowned job in question has + .MASTER mode, or controls the 340 display, the E&S display, + the vidisector, the arm, the LPT (line printer), or the + PLT (plotter). + When operating under heavy loads, the swapper prefers to + swap out disowned jobs rather than non-disowned jobs. + + The DETACH symbolic system call makes a non-disowned tree + disowned. + + When a non-disowned top-level job encounters + a fatal interrupt, the system will make it disowned and + print a suitable message on the system console and on + the job's console (if it has one). The disowned tree + can then be reowned with DDT and debugged. + +.DMPCH ac, OBSOLETE mung dump check bit + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the RDMPBT + and SDMPBT symbolic system calls. + + The accumulator should contain a channel number + in the right half, which should have a disk channel + open on it. The left half describes any alterations + to be made to the dump check bit for the open file: + 4.9 Set dump check bit. + 4.8 Clear dump check bit. + The state of the dump check bit (possibly after setting) + is returned in accumulator in bit 1.1. + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + +.DSTART [start-addr] start the display + ; skip if successful + + This system call is used to start the E&S or 340 display processor, + whichever one the system has. If it has neither, the uuo is + an illegal operation and gives a %PIILO interrupt. + .DSTART assigns the display to the executing job if it is available, + and skips if successful. If the display is not available + .DSTART does not skip. + + In the case of the 340 display, the effective address of the + .DSTART is the address of the user's display list. This can + be either a single BLKO pointer (if the word is negative), or + the first word in a linked list (if the word is positive). + The right half of each word in the linked list is zero + to end the list, or the address of the next word in the list. + The left half of each word in the linked list is the address + (which must be less than 400000!) of a BLKO pointer. If this + address is zero, or the BLKO pointer is zero, it is ignored + (this allows "jump-type" entries in the list.) + The display will continually execute the commands pointed + to by this list. It is OK to change the list, or the single + BLKO pointer, while the display is running, provided everything + always points to valid data. + The .DSTRTL uuo is the same as .DSTART except that it uses + regular AOBJN pointers instead of BLKO pointers. + + In the case of the E&S display, the argument to .DSTART contains + in the right half, the address at which the display program will + start, and in the left half, a code to determine modes of + operation: There are four 3-bit fields in this code: + + 3.1-3.3 Start mode. Only the 3.1 bit is significant. If set, + the display is started in single step mode. + 3.4-3.6 Action to take on Program stop. + 3.7-3.9 Action to take on Hit stop. + 4.1-4.3 Action to take on Memory stop. + + Each of the three Action fields is decoded as follows: + + 0 Restart from address of the last .DSTART. + 1 Continue after the stop condition has been reset. + 2 Stop. + 3 (Reserved). + 4 Interrupt and restart. + 5 Interrupt and continue. + 6 Interrupt and stop. + +.DSTEP step the E&S display + + The .DSTEP call will step the display processor one instruction + cycle if it has been stopped (.DSTOP) or started (.DSTART) in + step mode. If the display is not stopped, .DSTEP will first + simulate a .DSTOP. If the display is not the executing job's, + no action is taken. + + The .DSTEP call is ignored by the 340 display. + +.DSTOP stop the display + + The .DSTOP call will stop the E&S or 340 display processor, + if the display belongs to the executing job. + +.DSTRTL start the display + + In the case of the 340 display, this is the same as + .DSTART (q.v.) except that the display will use AOBJN + pointers instead of BLKO pointers. + + In the case of the E&S display, this + crashes the system. Maybe someday this will be fixed. + +.DTTY devour the tty + + .DTTY is used when a job decides that it wishes to + retain the tty. It skips if it succeeds; it fails if + the job was already in the state of wishing to retain + the tty, or if it had never had the tty. If the tty had + actually belonged to some (possibly indirect) inferior, it + will belong after the .DTTY to the job that executed it. + A job need not have the tty to do a .DTTY. + See ITS TTY for a full explanation of .DTTY. + See also the .ATTY uuo, and the .TTY user variable. + +.DWORD [word] send word to E&S display + + The specified word is sent to the E&S display via + the DATAO instruction. The display is stopped first + via .DSTOP if necessary. + + This system call is ignored if there is no E&S display + or the executing job does not own it. + +.EOFC ac, OBSOLETE end of file character + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been obsoleted and not replaced. + + Accumulator receives the eof character used to + pad the end of the file open on the channel specified + by the contents of before the uuo is executed. + Apparently early microtape files used 141 as the pad + character. + +.EVAL ac, evaluate squoze symbol + ;skip if successful + + Before the uuo is executed, accumulator should + contain the squoze code for a symbol. This symbol + is looked up in the symbol table used by exec DDT + (the one used to debug ITS); this table contains + symbols defined within ITS. The uuo fails to + skip if the symbol is not found; otherwise the value + is placed in and the uuo skips. + + This uuo offers a useful method of obtaining + information from ITS, when combined with the .GETLOC + uuo or with absolute memory pages; for example, + to find out how many irrecoverable disk errors there + have been, PEEK .EVAL's the symbol QIRRCV and examines + that location in the system. Naturally, this is more + risky than using a system call, since the system's + symbols may be changed. One protection against that + is to make an entry in the file AI:SYSTEM;EVSYMS > + mentioning which symbol is being .EVAL'ed by which + program. Then, there will probably be warning from + ITS hackers of any change. + +.FDELE fblock OBSOLETE delete or rename file + ;skip if successful + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the DELETE, + RENAME, and RENMWO symbolic system calls. + + This uuo may be used to delete and rename files. + It points to a five-word block describing the + operation to be performed. There are three cases. + + [1] Delete a file. + + fblock: SIXBIT \ dev\ ;right-justified device name + SIXBIT \fname1\ ;file name 1 + SIXBIT \fname2\ ;file name 2 + 0 ;zero + --- ;not examined + + [2] Rename a file open for writing on channel . + + fblock: --- ;not examined + 0 ;zero + ;channel number + SIXBIT \fname1\ ;new file name 1 + SIXBIT \fname2\ ;new file name 2 + + [3] Rename an arbitrary file. + + fblock: SIXBIT \ dev\ ;right-justified device name + SIXBIT \fname1\ ;old file name 1 + SIXBIT \fname2\ ;old file name 2 + SIXBIT \fname1\ ;new file name 1 + SIXBIT \fname2\ ;new file name 2 + + In cases [1] and [3], if the device specified has + true directory structure, the .SNAME user variable + for the executing job is used as the directory name. + Also, the file names (for case [1]) or the old file + names (for case [3]) are subject to input translation + (see the TRANAD symbolic system call). + If the device is not file structured, .FDELE + succeeds and skips. If .FDELE fails, it returns + an error code on channel 0 which can be retrieved via + the .STATUS uuo or the ERR device. + +.FEED chnum, feed paper tape + ;skip if successful + + If device PTP (the paper tape punch) is open on + channel , the uuo punches one line of blank + tape and skips. Otherwise it fails and does not skip. + +.GENNUM ac, generate number + + Accumulator receives a unique generated number + which will not be generated again for a very long + time (unless the system crashes, in which case the + counter is reset, of course). + [ In ITS 1554 and later. ] + +.GENSYM ac, generate symbol + + Accumulator receives the sixbit name of a + unique generated symbol which will not be generated + again for a very long time (unless the system + crashes, in which case the counter is reset, of + course). + +.GETLOC ac, get absolute location + + The accumulator should contain + an absolute address in the left half and an address + within the executing job in the right half. + The contents of the absolute location specified is + deposited in the location specified within the job. + This is useful for examining locations within the + system. However, if many locations are to be + examined, or if a location is to be examined many + times, it is far more efficient to map the absolute + page(s) containing the location(s) of interest into + the job's core map as read-only memory; the job + can then examine the locations at top speed without + having to go through the system uuo handler. + Such page mappings can be established via the .CBLK + uuo or the CORBLK symbolic system call. + +.GETSYS ac, get system data + ;skip if successful + + Accumulator should contain an AOBJN pointer to a data area in + the user's core. (A zero left half means the data area extends to + the end of core.) Accumulator should contain the sixbit + name of a system data area. The specified system data area is + transferred into the user's core in such a way that the data is + consistent (i.e. interrupts are inhibited in appropriate ways, + etc.). If the .GETSYS is successful, is updated to point to + the unused part of the user's data area. + + If the named data area does not exits, is cleared. If the + area in the user's core is too small, the left half of is + replaced with the negative of the correct size. In both of these + cases .GETSYS fails to skip. + + Valid data areas are: + MEMORY Memory tables. + UTAPE Micro-tape variables. + NCPSM Network control program socket map. + NCPPQ Network control program pending RFC queue. + NCPHT Network control program host table. + USERS User variables for all jobs. + USER User variables for job whose user index is in . + Formerly a uname-jname pair was accepted in + and , but this is no longer true (ANCIENT HISTORY). + GETS Valid sixbit .GETSYS area names. + DEVS Valid sixbit built-in device names. (Doesn't include those on + DEVICE directory.) + CALLS Official system symbol table. Squoze symbols and values for + UUO's, .USET variables, and bits DEFSYM'ed in SYSTEM;BITS. + IMPX Input multiplexor data area. + CLINK Core link device variables. + DSYMS Exec DDT symbol table. Squoze symbols and values. + USYMS Squoze symbols and values for .USET variables only. + (Does -not- contain .RMEMT or .SMEMT, but rather .MEMT. + Used by DDT when you type ".MEMT/".) + CHDEVS Device names, from .RCHST table. + NCALLS Valid sixbit names for symbolic system calls. + USRVAR Valid sixbit user variable names for USRVAR system call. + TTYVAR Valid sixbit tty variable names for TTYVAR system call. + ITSNMS Valid sixbit names of all local ITS machines. + + Names which used to be valid but are no longer (ANCIENT HISTORY): + TRANS Translation tables. + OMPX Output multiplexor data area. + + PEEK used to use this uuo to get system information. + Nowadays it merely maps systems pages into its core + image, thereby gaining efficiency at some small cost + in accuracy. + +.GSNAME ac, ANCIENT HISTORY get system name + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by .SUSET of .RSNAM. + Its opcode has been recycled as .REALT. + + Put the executing job's .SNAM user variable + into accumulator ; this is the default directory + name ("system name") for the job. + +.GUN ac, gun down a job tree + ;skip if successful + + Accumulator should contain the user index of the + top level job of a job tree. That job tree is expunged + from the system. All the jobs are closed and killed. + This is to be used as a last resort to flush hung + and worthless jobs. The system program LOCK + contains a command which performs this operation. + The system job will print a message on the system console + describing what job was gunned and who gunned it. + +.HANG hang until condition satisfied + + The .HANG uuo is to make it easy for programs to wait for various + conditions. It should be used the way a JRST .-1 would be used in + a stand-alone program. Explicitly, it should be preceded by an + instruction that will skip or jump if the awaited condition is + true. Because the system must understand that instruction, only + certain instructions are allowed to be used (any others cause + illegal operation interrupts (%PIILO, bit 1.6 of the .PIRQC user + variable)). They are: SKIP, JUMP, AOS, SOS, AOJ, SOJ, CAI, and CAM + class instructions, -all- test instructions, CONSO and CONSZ (which + work only if the job is in .IOTLSR mode, and the processor is not a + KS10), SKIP and JFCL, which are used to hang forever (really, until + some interrupt routine jumps away instead of returning), SKIPA and + CAIA, which are used to cause rescheduling but don't actually hang, + and JFFO. XCT is also allowed, but the ultimate end of the chain + of XCT's must be one of the instructions listed above. + + In the case of hanging forever, the job is specified to be + desirable to swap out, since it may hang for a long time. + + .HANG conditional instructions which reference only ACs are treated + as hang-forever, except that they don't set the desire-to-swap-out + flag, since the contents of the AC can't change without the job + being interrupted out of the .HANG. + + When a job executes a .HANG, the system effectively executes the + preceding instruction at each schedule to decide whether the job + may be run (cf. the .FLS user variable). If the job is + interrupted, the interrupt routine will find that the saved PC + points to the instruction before the .HANG instruction. It may + dismiss normally, in which case the .HANG will be executed again + unless the condition has become true (of course, the interrupt + routine may do something to make the condition true). + + .HANG takes care to be certain that any side effects of the + instruction will be performed when the condition finally becomes + true. .HANG does this by always exiting by jumping to .-1. Thus + an AOSE instruction followed by a .HANG really will increment the + referenced location after it becomes -1, JFFO AC, followed by .HANG + really will store a bit number into AC+1, and TLZN followed by + .HANG really will clear out the bit after it comes on. + + While a job is waiting in a .HANG, the system does not re-examine + the AC used by the conditional instruction each time it executes + that instruction; it uses what was in the AC when the .HANG was + entered. However, there is no way for this AC to change without + the job being interrupted of the .HANG so it can change it, or + PCLSRed out when it's superior changes it. Also, the effective + address calculation is not repeated, and if the actual instruction + supplied is an XCT, the XCT'd instruction is not re-fetched. + Therefore, it does not work to expect the condition to become true + because the contents of a memory location indirected through or + XCTed will change. Because an interrupt always causes the .HANG to + be redone, it does work to expect the interrupt routine to change + the AC or the indirect pointer in order to make the instruction + skip. + + In the special case of waiting for a specific interval of time to + pass, the .SLEEP uuo (q.v.) may be useful. In the special case of + waiting for a network socket to change state, the NETBLK symbolic + system call may be useful. + +.HANG ac, .HANG with timeout + + [In ITS version 1622 and later] + + .HANG with a non-zero AC field acts as the disjuction of .HANG and + .SLEEP, allowing a program to wait either for a condition to become + true or for some time to pass. The contents of accumulator + specify when the .HANG should stop waiting for the condition to + become true by returning to the instruction following the .HANG. + If non-negative, it is a length of time to wait in thirtieths of a + second. If negative, it means to wait until the system TIME + variable exceeds its absolute value. + + As with .SLEEP, if the job is interrupted while .HANGing, the + accumulator will be found to contain the appropriate negative + number to allow the .HANG to be resumed properly when the interrupt + is dismissed. + + If .HANG times out before the awaited condition becomes true, the + accumulator will contain 0. This is the only case in which .HANG + will exit to the following instruction. + + If the awaited condition becomes true, so that the previous + instruction skips or jumps away, the accumulator will contain the + negative of the time at which the .HANG would have timed out. + + +.HANGUP dialnum, ANCIENT HISTORY hang up a dialed line + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .REVIVE. + + This uuo was used to hang up on a line which had + been dialed by the .DIAL uuo. + +.IFSET ac, if location contains what I think, set it + ;skip if successful + + The accumulator should contain an absolute 18.-bit + address in the right half and a pointer to a two-word block + in the left half. The first word of the two-word block + contains a test word, and the second a new value. + + If the absolute core location specified contains exactly + the quantity specified by the test word, then the contents + of that location are replaced by the new value specified, + and the .IFSET skips. If the contents of the location + are not the same as the test word, the .IFSET fails. + + This is similar to the .SETLOC uuo, but provides a + measure of safety if the contents of the location + may be volatile. Like the .SETLOC uuo, if the .IFSET + succeeds the system job prints out a message on the + system console detailing the old and new contents + of the location and who modified it. + +.IOPDL reset I/O pdl + + The I/O channel pdl of the executing job is reset. + Entries on the I/O pdl contain the channel number + from which they were pushed; .IOPDL is equivalent + to just enough .IOPOP's (possibly none) to clear + the I/O pdl, popping each entry into the channel + it was pushed from. + See the .IOPUSH and .IOPOP uuos, and the .IOC, .IOS, + .IOP user variables. + +.IOPOP chnum, pop I/O channel + + This uuo is the inverse of the .IOPUSH uuo. + The top entry of the I/O pdl is popped into + channel , which may be a different channel + from the one the entry was pushed from. + A .CLOSE is first performed on the channel popped into. + If the channel originally pushed was a closed channel, + then after popping channel will be closed. + If the I/O pdl has no entries on it, IOC error + number 5 is signaled on channel , giving the + job a class 2 interrupt (%PIIOC, bit 1.9 of the .PIRQC + user variable). + + If the channel number is variable, the IOPOP symbolic + call may be used. + + See the .IOPUSH and .IOPDL uuos, and the .IOC, .IOS, + and .IOP user variables. + See also the .UCLOSE uuo for a discussion of what + occurs when a job open on a pushed channel is killed. + +.IOPUSH chnum, push I/O channel + + The channel is pushed onto the I/O pdl + for the executing job. A channel may be pushed + whether or not it is actually open; if it is open, + transactions on the channel are suspended when + it is pushed, and any transfer on that channel is + inaccessible until the pushed entry is popped + again. The error status and access pointer are + correctly saved as well. The channel number + is also saved in the pdl entry for use by the .IOPDL uuo. + After the channel has been pushed it is returned to + a non-open state (this is not the same as being closed + since closing implies terminating the I/O transaction). + The I/O pdl for each job has room for eight entries; + if all are in use .IOPUSH will signal IOC error + number 6 on channel , giving the job a + class 2 interrupt (%PIIOC, bit 1.9 of the .PIRQC user variable). + + If the channel number is variable, the IOPUSH + symbolic call may be used. + + See the .IOPOP and .IOPDL uuos, and the .IOC, .IOS, + and .IOP user variables. + See also the .UCLOSE uuo for a discussion of what + occurs when a job open on a pushed channel is killed. + +.IOT chan,[foo] input/output transfer + + Input or output is performed, according to the device + open on the specified channel and the mode in which it + was opened. If an error occurs, any of several IOC + errors may occur, giving the job a class 2 interrupt + (%PIIOC, bit 1.9 of the .PIRQC user variable.) + + In "unit mode", foo is the datum to be transferred + in or out. (In the case of input, the word pointed + to by the effective address of the .IOT is modified.) + + In "block mode", foo is an AOBJN pointer to the data + to be transferred in or out. The left half is the + negative of the number of words, the right half is + the address of the first word. The pointer is updated + as the transfer proceeds. When the .IOT returns the + pointer will have been fully counted out, that is + the left half will be zero, except in the case of input + that stops because the end of the file was reached. + + In the case of block mode on an intrinsically character + device, such as TTY, bits 4.9-4.7 of the pointer are + fiddled to indicate which byte in the word is being + processed. + + The VID, NVD, and IMX devices handle .IOT in a non-standard + way because they do both input and output at the same time. + + The symbolic system calls IOT and SIOT are versions of + .IOT which have additional features. + +.IOTLSR ac, iot loser mode + + This uuo is used to request permission from + the system to run in user I/O mode (bit 4.3 of the PC). + In this mode a program is in user mode (and thus is + subject to user mode page mapping), but may perform + I/O instructions without trapping to the system. + This facility must naturally be used with discretion. + It should be noted that ITS will interpretively + simulate most I/O instructions anyway, if it thinks + that the operation will not harm the time-sharing + system. For example, one may use DATAI to read the + console switches even when not in .IOTLSR mode. + This simulation is slower than direct execution + of I/O instructions, but much safer. + + If bit 4.9 (the sign bit) of accumulator is zero, + .IOTLSR mode is relinquished, even if it was not formerly + possessed by the job. + If bit 4.9 is one, then the executing job is granted .IOTLSR + mode, and the system job prints a message on the system + console to document the fact. + +.IPDP chnum, interrupt PDP-6 + + Channel should have the PDP-6 open as an + inferior procedure; if it does not, .IPDP does nothing. + Otherwise the PDP-6 receives an interrupt. + + The PDP-6 can also interrupt the PDP-10; when this occurs + a job with the PDP-6 open as an inferior will receive + an interrupt if enabled for it. See the .IFPIR + user variable for PDP-6 channel interrupts. + + The interface between the PDP-6 and the PDP-10 + is device 20 octal. + The interrupts are given via a CONO: + 1.5 Interrupt other processor. + 1.4 Clear interrupt flag. + 1.3-1.1 Priority interrupt assignment. + The bits read by CONI are as follows: + 1.4 Interrupt flag. + 1.3-1.1 Clear interrupt flag. + +.ITYI ac, OBSOLETE input tty interrupt + ;skip if successful + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the .ITYIC uuo. + + This uuo is exactly like .ITYIC except that it applies + only to the job's console, if any. This uuo is to be + flushed eventually. + +.ITYIC ac, input tty interrupt on channel + ;skip if successful + + The specified accumulator should contain the + number of a channel which is open for tty input. + If an interrupt character is pending in that tty's + input buffer, that character replaces the channel number + in and the .ITYIC skips. It will fail if the + channel is bad, if it does not have a tty open, if the + tty is the job's console but the job does not possess it, + or if there is no interrupt character pending. + If the job does not possess its console and the job's + %TBINT bit is set in the .TTY user variable, the job + receives a class 2 word 1 interrupt (bit 4.2 in the + .PIRQC user variable). + + This uuo is typically used in an interrupt routine + invoked by bit 1.1 (%PITYI) in the .PIRQC user variable or by + a word 2 I/O interrupt on a tty input channel. + If the .ITYIC does not skip the program should ignore + the interrupt entirely; this can happen due to certain + timing screws related to passing the console around + among several jobs. + + See the TTYGET and TTYSET symbolic system calls, which + manipulate bits relevant to interrupt characters. + See the WHYINT system call, which (in the case of + TTY channels) is another way to do the same function + as .ITYIC. + See the .PIRQC and .TTY user variables. + See ITS TTY for a complete explanation of .ITYIC. + +.LISTEN ac, listen to tty + + If the job possesses its console, .LISTEN waits + for any output to be completed, and then returns the + number of input characters pending in the input + buffer. If the job does not possess a console, zero is + returned. + See also the LISTEN symbolic system call. + +.LOGIN ac, ANCIENT HISTORY log in + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by the LOGIN symbolic system call. + Its opcode has been recycled as .DEMON. + + Accumulator contains the sixbit name to log in as. + Attempting to log in with a uname equal to 0 or -1 fails, + as does attempting to log in when already logged in. + +.LOGOUT log out + + The executing job and all direct inferiors are killed, + providing that it is the top-level job of its job tree. + All resources used by such jobs are freed. If the job + tree was console-controlled, the system job will print + a "console free" message on the freed console. + + If the executing job is not top-level, .LOGOUT with zero + in the AC field merely returns without skipping. + (An inferior job may not commit suicide without the consent + of its superior.) .LOGOUT with a nonzero AC field will + cause a fatal %PIBRK interrupt which will inform the superior + that the job wants to be killed. If the superior is DDT, + it will kill the job. Here is how a program should exit: + + SKIPE DEBUG ;optional debugging aid: + .VALUE ; job hangs if being debugged + .LOGOUT 1, ;log out or be killed. + +.LOSE lossage-code report lossage + + The job's Program Counter is set to the address of the + .LOSE minus one, the job's .VAL user variable is set + to the new PC,,the magic bits, and the + job is given a %PILOS interrupt. If the job does not + enable this interrupt, and it's superior is DDT, a + helpful error message will be printed. + + The magic bits are documented in DDT ORDER. + The most useful ones are 0 for a random error, + 1000 to ask DDT to type the error message corresponding + to the most recent system call error return, and + 1400 if DDT should attempt to print the names of + the file that the call was opening/referring to. + + The lossage codes are defined by DDT's interpretation of them. + The defined values are: + + %LSSYS==1000 The last error code returned by a failing + system call describes the problem. + + %LSFIL==1400 The last error code returned by a failing + system call, together with the name of the file + it was operating on, describe the problem. + That system call should be right before the .LOSE. + DDT will decode it to determine the filenames + (if it is an OPEN) or the channel number and then + the filenames via an RFNAME. + + %LSSYS+errcode Means that the system call error code + describes the problem. + + %LSFIL+errcode Means that the error code + together with the filenames being used + describe the problem. + + 1+.LZ + Means that the error should be handled as if it + were a fatal interrupt on the specified interrupt + bit. For example, the lossage code 1+.LZ %PIMPV + will to cause DDT to print out an MPV error message. + These lossage codes are more useful with the + LOSE and DISMIS symbolic system calls. + + 0 Signifies some other nondescript error condition. + + The usual way of using this uuo is to put it + after a system call which is expected always to + skip. If it fails to skip, DDT will print an error + message based on what the system call is and what + it was failing to do (if you said 1000 or 1400). + Proceeding the job will retry the call. + + See also the LOSE symbolic system call. + + This call never gets an error, and never returns. + +.LTPEN block hack light pen + + This uuo hacks the light pen on the 340 display. + The address should be the start of a six-word + block. The first word controls the mode: + 4.9 0 => ignore other bits, 1 => examine them. + 3.1 1 => hang until light pen seen at least once. + 1.1 Used to set the multiple sighting mode (1 = on). + The six words of data returned are as follows: + wd 0 The word read by DATAI from the 340 display at + the last light pen interrupt. + wd 1 Number of times the light pen interrupted + since the last .LTPEN uuo. + wd 2 Sum of all Y coordinates since the last .LTPEN uuo. + wd 3 Sum of all X coordinates since the last .LTPEN uuo. + wd 4 The current linked display list pointer. + wd 5 The current BLKO display pointer. + If the job does not currently possess the 340 display, + words 0 and 1 are set to zero. + + If the system has no 340, .LTPEN is ignored. + +.MASTER ac, request/release master mode + ;skip if successful + + Accumulator should have bit 4.9=1 to request + master mode, or =0 to release it. Releasing master + mode always succeeds, even if the job did not have it. + Requesting master mode succeeds if the job already has + master mode, or if it has control of its tty (as determined + by bit 4.9 (%TBNOT) of the .TTY user variable). + Only one job at a time may have master mode; thus requesting + master mode may imply taking it from some other job. + + A job in master mode gets double priority for run time; + that is, it tends to get twice as much run time as any other + job competing for run time. Furthermore, it has priority + in grabbing the 340 display from another user. (The precise + algorithm for grabbing the 340 is actually a function of + who has master mode and of the %TT340 and %TT3HP bits of + the TTYTYP variables of the jobs involved.) + + Master mode should be used only when absolutely necessary. + Needless use of it is considered to be antisocial, and may + be grounds for harassment. + +.MTAPE ac, hack magtape + ;skip if successful + + Accumulator should have a channel number in the + left half and an address in the right half. + (An illegal channel number causes an illegal operation + interrupt (%PIILO, bit 1.6 of the .PIRQC user variable).) + The channel should have device MTn open on it. + The address should point to a word with a signed count + in the left half and a function code in the right half. + Valid function codes are: + 0 Hang until tape motion done. + 1 Rewind tape. + 2 Rewind and dismount. + 3 Write end-of-record (i.e. force current output buffer). + 4 Write three inches of blank tape. + 5 Write end-of-file. + 6 Space over records (negative => backwards). + Illegal for output channel. + 7 Space over files (negative => backwards). + Illegal for output channel. + 10 Space to end-of-tape. + 11 Stop all commands on this channel. + 12 Set block size for writing to words. + 13 Return block size in . For reading, this is the size + of the record most recently swallowed by an IOT. + This operation may trigger one of the following IOC errors, + causing an interrupt (%PIIOC, bit 1.9 of the .PIRQC user variable): + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 3 NON-RECOVERABLE DATA ERROR + 9 DEVICE FULL + +.NDIS ac, display times + ;skip if successful + + This uuo is intended for use in taking pictures of + the 340 display screen. It sets a display control + variable from the contents of accumulator . + This variable has no effect if negative, but if + zero it inhibits display completely, and if positive + is decremented by 1 each time the current display + block or list of blocks is displayed. This call + fails to skip if the job does not possess the 340 display. + + On systems which don't have a 340, .NDIS is ignored. + +.NETAC chnum, OBSOLETE accept network connection + ;skip if successful + + This UUO is obsolete. + It is documented here for historical purposes only. + It now ALWAYS fails to skip. + + Channel should be be a network channel in + the "RFC received while listening" (%NSRFC) state (see + the ITS NCP file.) + This is used to accept a connection on a socket opened + with mode bit 1.5=1 (see the OPEN symbolic system call). + An RFC is sent back and the channel put into the + "connection open" state. + + To reject a connection, the channel should be closed with + either the .CLOSE uuo or the CLOSE symbolic system call. + +.NETINT chnum, OBSOLETE network interrupt + + This UUO is obsolete. + It is documented here for historical purposes only. + It is now always a no-op. + + Sends an interrupt out on the network socket associated + with channel number , which should be open on + the NET device. If the local socket number is even + (receiving), an INR message is sent; otherwise, INS + is sent. + +.NETS chnum, network send + + Channel number should be open for network + output. The .NETS uuo forces the current output buffer + to be sent. If the channel is open in the wrong direction, + IOC error 1 (ILLEGAL HARDWARE OPERATION ATTEMPTED) will occur, + possibly giving the user an IOC interrupt (%PIIOC, bit 1.9 of + the .PIRQC user variable). + +.OPEN chnum,block open a file + ;skip if successful + + This uuo is semi-obsolete. The OPEN symbolic system + call is somewhat more flexible and consistent. + However, it is still reasonable to use .OPEN for + devices which do not use directory names. + + A file is opened on the channel specified by . + That channel number is then used to specify the file + on all further I/O transactions on that file. + The address should be the first of several + locations: + wd 0 ,, + wd 1 File name 1, if applicable. + wd 2 File name 2, if applicable. + wd 3 For the NET device, the foreign host number. + The directory name, if applicable, is taken from the + .SNAME user variable. Note that the device name may + be only three characters. The mode bits are as for + the OPEN symbolic system call. + + If bits 4.9-4.7 of word 0 contain 2, then a link is + created. Words 1-5 are then as follows: + wd 1 From file name 1. + wd 2 From file name 2. + wd 3 To file name 1. + wd 4 To file name 2. + wd 5 To sname. + .OPEN should never be used in this way in new programs; + use the MLINK symbolic system call instead. + + If the .OPEN fails to skip, an error code as for + .CALL OPEN will be returned on channel . + +.OPER random operation + + The term .OPER is used to refer to a class of uuo's + which all have the same op-code and are decoded by + the value of their effective address. Those .OPER's + which take arguments generally specify either an + accumulator or an I/O channel number in the accumulator + field of the .OPER. + If the effective address is not a valid .OPER number, + then the job executing the .OPER receives an illegal + operation interrupt (%PIILO, bit 1.6 of the .PIRQC user + variable). + A list of currently valid .OPER's is given below in + numerical order. + + .OPER 0 illegal + .OPER 1 .ITYI + .OPER 2 .LISTEN + .OPER 3 .SLEEP + .OPER 4 .SETMSK + .OPER 5 .SETM2 + .OPER 6 .DEMON + .OPER 7 .CLOSE + .OPER 10 .UCLOSE + .OPER 11 .ATTY + .OPER 12 .DTTY + .OPER 13 .IOPUSH + .OPER 14 .IOPOP + .OPER 15 .DCLOSE + .OPER 16 .DSTOP + .OPER 17 .RDTIME + .OPER 20 .RDSW + .OPER 21 .GUN + .OPER 22 .UDISMT + .OPER 23 .GETSYS + .OPER 24 .IPDP + .OPER 25 .GETLOC + .OPER 26 .SETLOC + .OPER 27 .DISOWN + .OPER 30 .DWORD + .OPER 31 .DSTEP + .OPER 32 .GENSYM + .OPER 33 .LOGOUT + .OPER 34 .REALT + .OPER 35 .WSNAME + .OPER 36 .UPISET + .OPER 37 .RESET + .OPER 40 .ARMOVE + .OPER 41 .DCONT + .OPER 42 .CBLK + .OPER 43 .ASSIGN + .OPER 44 .DESIGN + .OPER 45 .RTIME + .OPER 46 .RDATE + .OPER 47 .HANG + .OPER 50 .EOFC + .OPER 51 .IOTLSR + .OPER 52 .RSYSI + .OPER 53 .SUPSET + .OPER 54 .PDTIME + .OPER 55 .ARMRS + .OPER 56 .UBLAT + .OPER 57 .IOPDL + .OPER 60 .ITYIC + .OPER 61 .MASTER + .OPER 62 .VSTST + .OPER 63 .NETAC + .OPER 64 .NETS + .OPER 65 .REVIVE + .OPER 66 .DIETIME + .OPER 67 .SHUTDN + .OPER 70 .ARMOFF + .OPER 71 .NDIS + .OPER 72 .FEED + .OPER 73 .EVAL + .OPER 74 .REDEF + .OPER 75 .IFSET + .OPER 76 .UTNAM + .OPER 77 .UINIT + .OPER 100 .RYEAR + .OPER 101 .RLPDTM + .OPER 102 .RDATIM + .OPER 103 .RCHST + .OPER 104 .RBTC + .OPER 105 .DMPCH + .OPER 106 .SWAP + .OPER 107 .MTAPE + .OPER 110 .GENNUM + .OPER 111 .NETINT + +.PDTIME ac, PD time + + Returns in accumulator the time since the beginning of the + year, measured in sixtieths of a second. If the time is not known, + -1 is returned. PD = Paul DeCoriolis, who hacked the original + clock on which this was based. Said clock ceased to work many + years ago. + +.POTSET + +.RBTC ac, robot console switches + + The contents of accumulator are sent to the + robot console (device 514) with a DATAO. After a short + delay the result of a DATAI are returned in . + + What the heck is device 514??? + +.RCHST ac, OBSOLETE read channel status + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the RCHST + and RFNAME symbolic system calls. + + Accumulator should contain a channel number + in the left half and an address in the right half + pointing to a block of several words. + The executing job receives an illegal operation + interrupt (%PIILO, bit 1.6 of the .PIRQC user variable) + if the channel number is illegal. + + The block of words is filled with information + about the status of the channel. The general + pattern of this information is as follows, though + not all devices adhere to it strictly: + wd 0 Device name in the right half. + wd 1 First file name, if applicable. + wd 2 Second file name, if applicable. + wd 3 Sname (directory name), if applicable. + wd 4 Access pointer. Measured in words. + A byte pointer if in character mode, for some devices. + -1 if not randomly accessible. + wds 5-n Other data. May be garbage, or not stored, + depending on the device as specified by word 0. + + See the RCHST symbolic system call for details + of what information is returned for specific devices. + Wd 0 from .RCHST has in its RH the LH of symbolic + RCHST's 1st value. Wds 1-4 from .RCHST are the same as + the 2nd-5th values returned by symbolic RCHST. + Wds 5 and up from .RCHST are the same as values 7 and up + of symbolic RCHST, except that they are not stored for + devices which do not return significant information in + them. Note that value 6 of the RCHST symbolic system + call is not available from .RCHST. + +.RD500 ac, ANCIENT HISTORY read device 500 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .IPDP. + + Device 500 formerly purported to be some kind of clock. + +.RD710 ac, ANCIENT HISTORY read device 710 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .HANG. + + Device 710 used to be a kind of clock on the PDP-6. + This uuo read a 24.-bit quantity from this clock, + measured in 4-microsecond ticks. + +.RD760 ANCIENT HISTORY + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .DWORD. + + Device 760 of the PDP-6 used to be used for temporary + direct sense hookups. (For example, the low six + bits controlled lights on the hand of the AMF arm.) + This uuo returned the result of a DATAI on this device. + +.RDATE ac, read date + + The current date is returned in accumulator as a + word of sixbit characters "YYMMDD", where YY is the + year (modulo 100.), MM is the month, and DD is the day, + all as two-digit decimal numbers. + If the system does not know what the current date is, + -1 is returned. + +.RDATIM ac, read date and time + + This is exactly like the sequence + .RTIME ac, + .RDATE ac+1, + except that the timing error involved with crossing + midnight between execution of the two uuo's is avoided. + Thus accumulator receives the time of day as a word + of sixbit "HHMMSS", where HH is the hour (in 24.-hour + notation), MM is the minute, and SS is the second, + all as two-digit decimal numbers. + Accumulator receives the date as a word of sixbit + characters "YYMMDD" where YY is the year (modulo + 100.), MM is the month, and DD is the day, + all as two-digit decimal numbers. + If one of the quantities is not known by the system, + -1 is returned for that quantity. + +.RDSW ac, OBSOLETE read switches + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by DATAI. + + The contents of the data switches on the PDP-10 console + are returned in accumulator . + The same effect can be achieved by using DATAI 0, + (or any arbitrary location instead of ), which, if + the job is not in .IOTLSR mode, ITS will interpret + specially and simulate. + Neither .RDSW nor DATAI works correctly on KL10s. + Hopefully this will not inconvenience anyone. + On KS10s .RDSW no longer exists. + +.RDTIME ac, read system time + + The time since the system started running, measured in + thirtieths of a second, is returned in accumulator . + Thus the difference between two successive values gives + the amount of real time which passed between the two + executions of .RDTIME. This time does not include time + during which the system was temporarily down, for instance + stopped at a bug halt from which it was later continued + by a system hacker. + +.REALT ac, real time hackery + ;maybe skip on success (see below) + + This uuo controls a fairly complex facility allowing + a job to get good service in real time. The contents + of the specified accumulator are decoded as follows: + %RLFLS 4.9 Turn off old clock rate, zero the tick count, + and release the real time facility. + %RLSET 4.8 Turn on new clock rate. + %RLUSR 4.7 Attempt to seize the real time facility. + %RLNPS 4.6 Do not settle for pseudo-real time status. + %RLPSD 4.5 Insist on pseudo-real time status. + %RLBLK 4.4 Block me except during high priority period. + %RLGET 4.3 Read into words 2-3 (see below) before + interpreting the other bits. + 4.2-3.1 Reserved. Should be zero. + 2.9-1.1 Pointer to four word block: + wd0 Frame time in sixtieths of a second. + Must fit in the right half. + wd1 Priority time in sixtieths of a second. + Must be less than 15 octal, and less + than or equal to half the contents + of word 0. + wd2 If bit 4.3 on, set the right half to + the frame time, and the left half to + the tick count since last examined. + wd3 If bit 4.3 on, set the right half to + the high priority time, and the left + half to 0 if currently at low priority + or -1 if currently at high priority. + + The real time facility is interpreted as follows: + real time is broken up into cycles, each the number + of sixtieths of a second in length specified by the frame + time. At the beginning of each frame, the %PIRLT + bit (4.8) in the job's .PIRQC user variable is turned + on. This causes an interrupt if the corresponding + bit is on in the .MASK user variable. + Within each frame, the first sixtieths are + high priority time for the job with the real time + facility, where is the specified high priority time. + If a job has the facility, presently has high priority, + and otherwise wants to run, then it is scheduled above + all other jobs. This guarantees that a job will + get a certain amount of run time at specified intervals; + this is useful for responding to real-time conditions. + The system will not schedule the job during its low-priority + phase if it has requested that it be blocked (bit 4.4), + unless it gets an interrupt and is not using the new-style + interrupt system. + The .REALT uuo will skip only if the facility + was requested and successfully seized. In all other + cases it does not skip, even if the requested operation + succeeded. If an invalid quantity is supplied for + a frame time, or for the high priority time, an + illegal operation interrupt occurs + (%PIILO, bit 1.6 of the .PIRQC user variable). + +.REDEF ac, redefine symbol to exec DDT + ;skip if successful + + The specified accumulator should contain the address of + a two word block: + wd0 SQUOZE bits,symbol + wd1 value + If the are all ones, then the symbol is deleted. + Otherwise it is defined with the specified value, + replacing any old value. This occurs in the symbol + table used by exec DDT, which is used to debug the + system, and which is used by the .EVAL uuo. + A .REDEF fails to skip only if it tries to add + a new symbol and fails for lack of room in the system. + +.RESET chnum, reset I/O channel + + I/O channel is reset. This is exactly + like the symbolic system call RESET. What happens + is device-dependent; see the description of that call. + +.REVIVE revive system + + This uuo reverses the effect of the .SHUTDN uuo. + It is used by the REVIVE command of LOCK. + Jobs which have enabled it will receive an + interrupt (bit 1.7 of the .PIRQC user variable). + See the .DIETIME and .SHUTDN uuo's, and the SSTATU + symbolic system call. + +.RLPDTM ac, read localized PD time and .RYEAR + + This returns the time and date in and , in a binary + form. contains the result of .RYEAR; see the description + of that uuo for details. contains the "localized" number + of seconds since the beginning of the year. If this is divided + by the number of seconds in a day (86400.), the remainder will + be the number of seconds since midnight local time, and the + quotient will be the number of days since the beginning of the + year, with the (mis)feature that all years are considered to + include February 29. This is done so that date-printing + routines do not have to check for leap-year, but it does mean + that during the last 10 months of non-leap years the day number + is 1 greater than the correct Julian day. Bit 4.9 of is + set in this case. + + Note also that when daylight savings time is in effect will + be advanced by one hour. Again this is done to simplify date + and time printing routines. Bit 4.7 of is set in this + case. + + Note that .RLPDTM should be used instead of .PDTIME followed by + .RYEAR, since it guarantees consistency of the two values + returned. + + +.RRTIM ac, ANCIENT HISTORY read run time + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by the .RUNT user variable. + Its opcode has been recycled as .CBLK. + + The job's run time is returned in accumulator . + See the .RUNT user variable. + +.RSYSI ac, read system incarnation + + Returns in the .FNAM2 of the system when it + was assembled. Thus, it is a version number in sixbit. + This is the same as the seventh value of the + SSTATU symbolic system call. + +.RTIME ac, read time + + The time of day is returned in accumulator as a word + of sixbit characters "HHMMSS", where HH is the hour + (in 24.-hour notation), MM is the minute, and SS is + the second, all as two-digit decimal numbers. + If the system does not know the time, -1 is returned. + See also .RDATIM. + +.RYEAR ac, read year + + Returns in accumulator a word as follows: + + 4.9 This year has 365. days, and it is after February 28. + 4.8 This year is a leap year (366. days). + 4.7 Daylight savings time is in effect. + 4.6 The time of year is known. + 4.2-3.9 If bit 4.6 set, the current day of the week. + Sunday=0, Monday=1, etc. + 3.8-3.6 The day of the week of January 1 of this year. + 3.5-3.1 Zero. + 2.9-1.1 The year, not modulo 100., but as a full quantity, + e.g. 1969. or 1975. + + If the system does not know the time, zero is returned. + +.SETLOC ac, deposit in system + + Expects the rh of to contain the address of a + location in physical core, and the lh of to point + to a word of data in the executing job's memory. + The job's argument word is copied into the addressed + location in physical core, and a message is printed + on the system console. + +.SETM2 OBSOLETE set two interrupt masks + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by block-mode + .SUSET of .MASK and .MSK2. + + The job's .MASK and .MSK2 user variables are set to + the respective contents of accumulators and . + +.SETMSK ac, OBSOLETE set interrupt mask + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .MASK. + + The job's .MASK user variable is set to the contents of + accumulator . + +.SHUTDN ac, shut down system + ;skip on success + + This uuo causes the system to prepare to go down. + (It is used by the KILL command in LOCK.) + Accumulator should contain a time interval, + in thirtieths of a second. The system will go down + exactly that much time after the present moment. + + When the system prepares to go down, all jobs enabled + for it receive a system going down interrupt (%PIDWN, bit 1.7 + of the .PIRQC user variable). (DDT prints a message when it + receives such an interrupt; part of this message is the + contents of the file SYS:DOWN MAIL.) This interrupt will + occur repeatedly every time 3/4 of the time from the previous + interrupt to the time of shutdown has elapsed, except that + interrupts will not occur less than ten seconds before shutdown. + (Thus, if the system were scheduled to go down in ten minutes, + interrupts would happen at the following times before shutdown: + 10:00, 2:30, 0:37. If in five minutes: 5:00, 1:15, 0:17.) + When the magic moment arrives, all users are forceably logged + out, all jobs killed (except job trees whose top-level jobs + have the %OPLIV bit set in their respective .OPTION user variables + -- a feature used primarily by system daemons. Such trees are + expected to log out on their own after finishing their work), + all micro-tapes are flapped, the file SYS:DOWN MAIL is deleted, + "ITS NOT IN OPERATION" messages are printed on all consoles, + all Terminet motors are stopped, all files, directories, and TUTs + are written out, and everything generally put into a good state; + the system then calls DDT. It may be brought back up again + with XREVIV$X, which reloads demons and allows ^Z'ing once more. + + The effects of a .SHUTDN may be reversed by a .REVIVE uuo. + See the .DIETIME and .REVIVE uuo's, and the SSTATU symbolic + system call. + +.SLEEP ac, sleep + + The .SLEEP uuo temporarily puts the executing job into + a dormant but interruptable state. The job consumes no + run time until the specified time interval has elapsed, + unless an interrupt occurs. + The contents of accumulator specify how long the + job is to sleep. If non-negative, it is the length + of time to sleep in thirtieths of a second. If negative, + it means to sleep until the system TIME variable (which + is read by the .RDTIME uuo (q.v.)) exceeds the absolute + value of the specified quantity; thus one can sleep + until a specific time. + + If the job is interrupted in the middle of a .SLEEP, + the accumulator will be seen to contain the appropriate + negative number, either the one originally there or one + calculated from the original positive argument. Thus + re-executing the .SLEEP after dismissing the interrupt + will cause the .SLEEP to be resumed correctly. + + Often it is desirable to "sleep" until some condition + other than the passing of time occurs. For this see + the .HANG uuo. For the special case of sleeping until + a network socket changes state, see the NETBLK symbolic + system call. + +.STATUS chnum,loc I/O channel status + + The status of I/O channel is placed in + location . This is exactly like the STATUS + symbolic system call. + +.SUPSET ac, SUPCOR set + + The system job is partially controlled by a variable + called SUPCOR; .SUPSET XOR's the contents of accumulator + with that variable, returning the result of + the XOR in . Not all bits specified by take + effect; some are AND'ed out first. A message is printed on + the system console as for the .IFSET and .SETLOC uuo's. + + The only really useful bits to set are as follows: + 1.6 Update TV who lines. + 1.2 Kill current file being spooled from TPL to LPT + (this is what the TPL command in LOCK uses). + +.SUSET [suset spec] self USET + + This uuo is used to examine and set user variables + associated with the executing job. See ITS USETS + for more information on .SUSET and .USET. + +.SWAP ac, hack swapping + + This uuo is illegal unless the system is being + debugged (the SYSDBG variable in the system is + non-zero; see the SSTATU symbolic system call). + + The bits in the specified accumulator indicate + a test of the page swapping software in the + system: + 4.9-4.7 Operation to perform. + 0 Swap out the number of pages + specified in 2.9-1.1. + 1,3,5,7 Go into a loop, waiting for + a few seconds and then referencing + location 2000 octal. + 2 Hack the PCLSR test feature on + this job. Bits 2.9-1.1 specify + the test mode: + -1 Enter in hold mode. + 0 Leave PCLSR test mode. + 1 Enter in advance mode. + 2 Enter in advance but don't ^Z. + 4 Swap out the virtual page specified + by bits 2.9-1.1 for the user specified + by bits 3.9-3.1. + 6 Swap out all pages for the user + specified by bits 3.9-3.1. + 3.9-3.1 User index, for operations 4 and 6. A user + index of zero means the job executing the .SWAP. + (After all, it's hard to swap out the system!) + 2.9-1.1 Number of pages for operation 0. + Test mode for operation 2. + Virtual page number for operation 4. + +.TRANAD OBSOLETE translation-list add + +.TRANDL OBSOLETE translation-list delete + +.TRANS ANCIENT HISTORY translate file name + +.UBLAT ac, micro-tape blat (?) + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the drive is marked + as being in .UBLAT mode. In this mode, there are + only two permissible operations on the drive: to dismount + (flap) it, and to open it as one giant file. This uuo + is intended for use in reading micro-tapes written in + non-standard (e.g. DEC) format. Any .OPEN + on a micro-tape in .UBLAT mode will ignore the + file names, and all the blocks of the tape except block 0 + will be read or written consecutively. No deletes, renames, + etc. are permitted. A .UBLAT will fail if the drive does + not exist, if the micro-tape directory has been read in + already by the system, or if the drive is not assigned + to the user whose job is trying to do a .UBLAT. + +.UCLOSE chnum, USR close + + This uuo is used to explicitly kill an inferior + open on channel . Merely performing a + .CLOSE on the channel is not enough - that + dissociates the inferior from the I/O channel, + but does not destroy the inferior procedure. + When the procedure is destroyed, all of its + inferiors, direct or indirect, are destroyed also. + As each job is destroyed, its I/O channels + are automatically .CLOSE'd, and any facilities + such as .MASTER mode are released. The translation + lists are cleared for all destroyed jobs. + + If any procedure whatever has a destroyed job + open on an I/O channel, that channel is automatically + closed; in particular, the channel is + closed. All jobs with channels which have the job open + as a foreign user (as opposed to an inferior or a + job device) also receive a word 2 I/O interrupt on each + such channel (see the .IFPIR user variable). + If a procedure has pushed a channel with a job to be + destroyed onto its I/O pdl (see the .IOPUSH, .IOPOP, and + .IOPDL uuos, and the .IOC, .IOS, and .IOP user variables), + then that I/O pdl entry is replaced on the pdl with a special + entry for a pseudo-device called the "interrupt on .IOPOP + device", which delivers a word 2 interrupt when popped from + the I/O pdl and then closes its channel (thus it should be + impossible to perform any operation on this "device" except + .IOPOP). In this way a job can detect the fact that a + foreign job disappeared while it was pushed. + + A procedure which executes a .UCLOSE receives + an I/O channel error interrupt (%PIIOC, bit 1.9 of the + .PIRQC user variable) if the specified channel + does not have an immediately inferior procedure + open on it. + +.UDISMT ac, micro-tape dismount + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the directory + is written back onto the micro-tape and excised from + the system's memory. The micro-tape is then physically + dismounted (this is known as "flapping" the tape, since + when it runs off the reel it goes flap, flap). + Micro-tapes should not be manually dismounted, for this + will cause the directories to get out of phase, messing + up that micro-tape and the next one to use that drive. + The .UDISMT will fail if any files are still + open on the micro-tape, or if someone else has the + drive assigned to him. + DDT makes this available via its command :FLAP. + See also the FLAP symbolic system call. + +.UINIT ac, initialize micro-tape + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the directory + of the micro-tape is initialized (containing no files). + The uuo fails if the drive does not exist, or if the + drive is not assigned to the user whose job is trying + to do the .UINIT. + See the .ASSIGN and .DESIGN uuos. + +.UPISET ac, OBSOLETE user priority interrupt set + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .PICLR + and/or the .DISMISS uuo and the DISMIS symbolic system + call. + + The value of the ac is converted to -1 or 0 on the basis + of bit 4.9; this value is then exchanged with the .PICLR + user variable for the executing job. Thus the accumulator + gets the old value of .PICLR even as it specifies a + new value. This allows enabling and disabling of + interrupts. + +.USET chnum,[uset spec] set (or get) user variable + + This uuo is used to inspect or alter the user variables + of a job open on channel , which may be a channel + open on the USR or BOJ device. + See ITS USETS for further information on .USET and .SUSET. + +.UTNAM ac, set micro-tape name + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number in the right half and a three character + sixbit name in the left half. If the uuo succeeds, + the name of the micro tape will be changed to the one + specified. The uuo fails if there is no such drive, + if it is in .UBLAT mode, or if it is assigned + to another user. + The name of a micro-tape can be examined with the .RCHST uuo. + +.UTRAN loc user interrupt bit translate + ;skip if successful + + + The effective address of .UTRAN must be a three-word + block: + loc: bit,, ;interrupt bit of inferior + 0 ;uname returned here + 0 ;jname returned here + + The first word should be all zero, except for one + of bits 3.1-3.8; these correspond to inferior + interrupt bits in the .IFPIR user variable. + If the job executing job has an inferior for that + interrupt bit, .UTRAN stores the uname and jname + of the inferior in the second and third words and skips; + otherwise it fails to skip. + + DDT uses this to find jobs which have been :FORGET'ed, or + accidentally created by open's of the USR: device via :PRINT + etc. Normally, superiors should keep track of the interrupt bit + and job names when the job is created, and this UUO should be + used only for exceptional cases. + + See the .IFPIR, .UNAME, .JNAME, and .UIND user variables. + +.VALUE [item] return value to superior + + The job which executes a .VALUE receives a class 1 + interrupt, which stops the job, turns on %PIVAL (bit 1.8) + in its .PIRQC variable, and interrupts its superior. + The word is placed in the .VAL variable of + the executing job (this fact is a historical artifact, + relatively useless now). + + The standard superior procedure (DDT) imposes the + following additional semantics on .VALUE: + If the effective address is zero, then DDT prints + out a message to that effect, and the job is left stopped. + This used to be the standard way to crap out from a grossly + irrecoverable situation (e.g. can't get core, or can't + open the TTY when started). Now .LOSE (q.v.) is preferred. + A typical sequence is: + + GO: .OPEN TTYC,[SIXBIT \ !TTY\] + .VALUE ;unhappy if never got TTY + .CALL [ SETZ ? 'TTYGET ? 1000,,TTYC ? 2000,,A ? 402000,,B ] + .VALUE ;shouldn't lose if .OPEN succeeded + + If the effective address is not zero, it is assumed to + point to an ASCIZ string in the memory of the job + which executed the .VALUE. DDT proceeds to + interpret these characters as if they were typed to + DDT on the console. Thus a job might execute + + .VALUE [ASCIZ \:PROCED :DISOWN V\] + + or something similar, to get itself running again and + disowned from its superior. See the DDT documentation + for specific details on .VALUE. + +.VSCAN + +.VSTST + +.WMAR ac, ANCIENT HISTORY write mar address + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by .SUSET of .MARA. + Its opcode has been recycled as .DCONT. + + The user's mar address variable is set from the + contents of the specified accumulator. + +.WR760 ac, ANCIENT HISTORY write device 760 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .DSTEP. + + Device 760 of the PDP-6 used to be used for temporary + direct sense hookups. (For example, the low six + bits controlled lights on the hand of the AMF arm.) + This uuo used the contents of accumulator for a + DATAO to device 760. + +.WSNAME ac, OBSOLETE write system name + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .SNAME. + + The system name for the job (used as a file directory name) + is set to the sixbit contents of accumulator . diff --git a/sysdoc/uuos.112 b/sysdoc/uuos.112 new file mode 100644 index 0000000..c85eb88 --- /dev/null +++ b/sysdoc/uuos.112 @@ -0,0 +1,2307 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +ITS UUOS: + +This file attempts to maintain up-to-date documentation on +all non-symbolic ("old") system calls. Those wonderful +souls who update the information in any way (additions, +deletions, corrections) should describe their +modifications in a brief note to INFO-ITS@AI so +that interested parties can correct their copies or +conceptions without needing to print or read the +entire file again. For example: + + :QMAIL INFO-ITS@AI I added more details to the .FOO uuo ^C + +If you want to be put on the INFO-ITS mailing list, +just say so in a message to it. +------------------------------------------------- + +On the PDP-10, opcodes 0 through 77 are deliberately "not +defined", and are called uuos ("unimplemented user operations"). +Also, certain other opcodes are either illegal in user mode +or undefined (for example, I/O instructions, JRST 4,). + +When an undefined instruction is executed, it "traps to 40": +it is stored in location 40 +with the index and indirect fields zeroed and the address field +replaced by the effective address, and then the instruction +in 41 is executed (it is usually a subroutine call). +(Some instructions actually trap to 60 on KA's, but ITS contrives +to make them appear to have trapped to 40 just like all +the others). + +uuos 1 through 37 are reserved for user programs. They +go through the entire trap sequence remaining in user mode, +so it is the user's locations 40 and 41 that are used. +The operating system is not involved at all. +These uuos are called "user uuos". + +The other undefined opcodes enter exec mode during the trap, +so that the system's 40 and 41 are used; the PC saved by the +subroutine call will say "user mode" if the uuo was executed +in user mode, however. These instructions are the normal way +of calling any PDP-10 operating system. + +ITS interprets uuos 40 through 47 as monitor calls; those +uuos are called "system uuos". The bulk of this file is devoted +to describing how to use them. In addition, ITS will simulate +some I/O instructions for the user (for example, any CONI, and +DATAI 0,). All other instructions that trap to the system +will be signaled to the user (they are "returnable uuos"). +For simple programs, they will cause an ILOPR interrupt +(%PIILO, bit 1.6 of .PIRQC). For programs that appear able to +handle them, they are "returned" to the user, pretending to +be user uuos - that is, the system makes it appear that they had +trapped to the user's 40. However, they do not act precisely +like user uuos: + 1) The system can't simulate any trap instruction but +unindexed, direct JSR. If the user's trap instruction is +not a JSR, or is indexed or indirect, the system assumes that +the user can't handle the returnable uuos, and causes an ILOPR +interrupt instead. Also, if the AC field of the JSR is nonzero, +the system will interrupt instead of returning the uuo; this +is a way for a program to say explicitly that it doesn't want +to have uuos returned, but still handle user uuos. + 2) If the opcode in 41 is 0, the system treats it as if it +were a JSR. + 3) 0 is not considered a reasonable place to JSR to. If the +address field of 41 is 0, the system will interrupt instead of +returning the uuo. + 4) While the addresses 40 and 41 are fixed by hardware for +user uuos, for system returned uuos they are not. They must +always be consecutive, but the address of the first one is +kept in the RH of the .USET variable .40ADDR (whose initial value is, +of course, 40). Thus, the user may have one handler for user uuos +and another for returned uuos. +Note that the system uses "42" for interrupts and "43" and "44" +for the "locks" feature; those locations are also shifted +by setting .40ADDR. + 5) Returnable UUOs have complicated interactions with DDT. +When proceeding from a breakpoint, DDT must simulate certain +instructions, including all those that can transfer control. +User uuos can be simulated properly, but not returnable ones +since DDT does not know how to decide whether they are to cause +ILOPRs. So DDT treats those uuos like the typical instructions; +it puts the uuo in 31, a jump to 1 + the actual address of the +uuo in 32, and a jump to 2 + that address in 33. It then starts +the job at 31. If the returnable uuo handler does nothing with +the PC except possibly return to it, and does not try to examine +the uuo except by looking at 40, this causes no problem. However, +if the uuo is followed by arguments, or if it can skip more than +once, or if it tries to remember the PC somewhere, the handler +must understand that if the PC is 31 (+1) special treatment is required. +In addition, the real location of the uuo will contain not the +uuo but a .BREAK, which will be there to implement the breakpoint. + +If the .UTRAP variable of a job is nonzero, ALL instructions +that trap to the system will cause ILOPR interrupts - even those +that are usually treated as system calls. In addition, the +job will not handle any of its own interrupts - they all interrupt +its superior. Thus, the superior can make the job believe it is +running under a non-ITS environment. User uuos are not affected. +The .UTRAP variable is the same as the %OPTRP bit in the LH of .OPTION. + +If the %OPDEC bit in the LH of .OPTION is set, uuos 40, 41 and 47 +(as well as those I/O instructions which ITS usually simulates) +become returnable uuos instead of system calls. By a lucky +coincidence, those uuos, which are the only ones used by both +ITS and TOPS-10, are not really necessary in ITS (they are +.OPEN, .IOT and .ACCESS, and all have alternative forms using .CALL). +In this mode, all uuos used as system calls by TOPS-10 are +returnable. One of the TOPS-10 simulators works by setting +this bit, and making .40ADDR point into the simulator where +it lives at the top of core (to avoid conflicting with the user +uuo handlers of the simulated programs). + +CALLS: Overview of ITS System Calls + +ITS system calls come in two kinds: the older, numerically +decoded, non-standardized kind, and the newer "symbolic +system calls" with a standard calling sequence. + +Each of the numerically decoded system calls is distinguished +from all of the others by the values of specific fields +in the instruction (the opcode, and maybe the AC and address +fields). Each specific system call is known as "a uuo", and +its name is a predefined symbol in the assembler, whose value +is the appropriate instruction. For example, one uuo is +.ACCESS; it is distinguished by the opcode field alone, which means +that the AC field and address are available as arguments. +The symbol .ACCESS is defined as the appropriate opcode. +.RCHST, however, is distinguished by its opcode and its address, +so that only the AC field can be used as an argument. The uuos +distinguished by opcode and address all have the same opcode, +which is called .OPER; thus, all such uuos are called ".OPER's". +.FDELE is distinguished by opcode and ac field, leaving the address +as an argument; such uuos are called ".CALL's" since they all have +.CALL as their opcode. Each uuo is described individually in this file. + +The symbolic system calls all use the uuo .CALL. They are +distinguished by the contents of the block addressed by the .CALL, +which also points to the arguments. Ths symbolic system calls +are described in more detail in the file .INFO.;ITS .CALLS. + +.ACCESS chnum,[access pointer] set file access pointer + + Sets the access pointer for the I/O channel + for the next input/output operation. This is used to + effect random access. On the DSK device (and DSK-like + JOB devices) the access pointer is the number of "bytes" + from the beginning of the file. Bytes are normally the + same as words, but in unit ascii mode there are five + seven-bit bytes per word. In the future there may be + the ability to have bytes of any size from 1 to 36 bits. + On the USR device the access pointer is the address + within the job's memory. + Random access on the USR device can also be effected + via page mapping (see the .CBLK uuo and the CORBLK + symbolic system call). If the channel number + is variable, the symbolic system call ACCESS may + be used in place of the .ACCESS uuo. + The symbolic call RFPNTR may be used to read the current + access pointer for a file. + +.ARMOFF + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ARMOVE + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ARMRS + +This uuo was for hacking the AMF arm. The arm no longer exists. + +.ASSIGN ac, assign a microtape + ;skip if successful + + The accumulator should contain the number of a + microtape drive. If it succeeds, it assigns the drive + to the user who executed the .ASSIGN. When a job + attempts to use a microtape drive, + it will succeed only if it has the same + sname as the uname of the job which did the .ASSIGN. + A .ASSIGN will fail only if the drive is already + assigned to a different user (i.e. a different uname), + or if an invalid drive number is given. + See also the .DESIGN and .RCHST uuo's. + +.ATTY chnum, assign tty to inferior + ;skip if successful + + Puts the job in the state of wishing to pass control of + the tty to the direct inferior open on the specified + channel. It skips if successful; it fails if the + channel does not have a direct inferior open, if the + executing job had never had the tty, or if it had not + been in the state of wishing to retain the tty. If the + job had the tty, after the .ATTY the tty will belong + to the specified inferior, or one of its inferiors. + A job need not have the tty to do an .ATTY. + See the .DTTY uuo, and the .TTY user variable. + Also see ITS TTY. + +.BREAK ac,address breakpoint instruction, etc. + + The and
fields of this uuo are totally + ignored by ITS. The procedure executing it receives + a class 1 interrupt (bit 2.2 of the .PICLR user + variable, called %PIBRK), stopping it and interrupting + its superior. + + The standard superior procedure, DDT, assigns + the following semantics to .BREAK, dependent on + the field (for full information see DDT ORDER): + + meaning + 1-10 Breakpoint number in the program, for + between 1 and 10. + 12 Request for information transfer. + 15 Temporary breakpoint number 1. + 16 Request for program suspension or termination. + 17 Temporary breakpoint number 2. + + The "normal termination" instruction is .BREAK 16,160000 + (but also see .LOGOUT). + + When DDT sets a breakpoint in a program on a given + instruction, it replaces the opcode with .BREAK + and the ac field with the breakpoint number. Thus + the instruction will still calculate its usual effective + address before breaking. The two temporary breakpoints + are used for ^N (multiple instruction proceed), etc. + + .BREAK 12, is used to transfer information between + DDT and the executing program at the latter's request. + .BREAK 12, is like .SUSET in that it points + either to a specification word or to an AOBJN + pointer of such words. Bit 4.9=0 means read, =1 means + write (from the program's point of view). Writing can + be illegal if the ..PERMIT variable in DDT for + the job is set appropriately. Bits 4.7-3.1 + determine the type of information transferred: + ..RSTA 1 Starting address of program. + ..RLFI 2 Loaded file name. + Four words: device, sname, file name 1, file name 2. + ..RSTP 3 (read only) AOBJN pointer to program's symbol table + in DDT. The left half is the negative of + the symbol table size. See type 7 (..RSTB). + ..RSYM 4 Symbol definition. Uses two words. + Read: first word contains squoze for symbol. + Second word receives value. + If undefined, first word is zeroed. + Write: first word contains squoze, second value. + ..RJCL 5 Read: fetches command string for program. + Set by : command or via :JCL. + Always transfers at least one word of + packed ascii, then more until either a + zero word is transferred or until a + non-zero is about to be transferred into. + String is terminated by ^M if non-null. + Write: clear command string. + ..RPFI 6 File name defaults used for :PRINT. + Four words: device, sname, file name 1, file name 2. + ..RSTB 7 Symbol table. Allows transfers of many + symbols in either direction. + ..RCON 10 (read only) Number to symbol conversion. + Uses two words. The first should initially + contain a value. It receives squoze for + a symbol, and the next word receives a delta. + The value of the symbol plus the delta equals + the original argument. The lookup used by DDT + for symbolic typeout is employed here. + If the lookup fails, the first word receives + zero and the second receives what the first held. + ..RXUN 11 (read only) The XUNAME (a uname to be used for + getting mail, etc.). This is like the UNAME, but + has trailing digits stripped off, etc. This is + OBSOLETE; use the .XUNAME user variable. + ..RXJN 12 (read only) The XJNAME (what this job should think + of as its "real" name). This is like the JNAME, + but has trailing digits stripped off, etc. This is + OBSOLETE; use the .XJNAME user variable. + ..RLJB 13 (read only) Read index of previously current job. + ..RRND 14 Reads or writes the ..URANDM variable in DDT for + this job. + ..RPUR 15 Unpurify page. + ..RHSN 16 (read only) Ask to lookup an HSNAME from an XUNAME. + ..RMAI 17 (read only) Ask to lookup user's mail file name. + (Symbols with names starting with "..S" exist for all those not + marked as read only. For example ..RSTA==1 and ..SSTA==400001.) + + Illegal .BREAK 12,'s cause DDT to give the program an + illegal operation interrupt (bit 1.6 in the .PIRQC + user variable). + + .BREAK 16, is used to return to DDT in various + nice ways. The effective address is decoded as follows: + 2.9 Return from X. (Do not use unless you understand it!) + 2.8 Type extra carriage return in DDT. + 2.7 Do not reset TTY input (effective only if + executing job has the TTY). + "Normal" returns to DDT should always have + this bit set. + 2.6 Kill executing job: + Immediately, if it has the TTY. + When it gets the TTY, if current job. + Otherwise when J'd to in DDT. + Will print ":KILL" when killed. + 2.5 Kill executing job: + Like 2.6 if job current. + Otherwise is killed silently. + 2.6&2.5 Together mean kill executing job: + Like 2.6 if job current. + Otherwise kill immediately, and print + JOB FINISHED on TTY. + 2.4 Conditional breakpoint return. + 2.8=1 => condition true. + 2.8=0 => condition false. + Used by DDT. Dangerous for users to play with. + 2.3 Don't type even a carriage return. Don't close + the currently open location. If killing self + don't type :KILL. + 2.2-1.1 Illegal. (Reserved for expansion.) + + DDT sets the %OPCMD and %OPBRK bits for + its inferiors appropriately. See the .OPTION + user variable. + +.CALL [ SETZ ? SIXBIT \name\ ? -- args -- ] symbolic system call + ;skip if successful + + The .CALL uuo is used to invoke a large class of + operations which are distinguished by a sixbit name. + See the file ITS .CALLS for more information. + + .CALL is sometimes used in a generic sense to denote + the set of uuo's with the same opcode as .CALL; they + are distinguished by their accumulator fields: + .CALL 0, .CALL + .CALL 1, .DISMISS + .CALL 2, .LOSE + .CALL 3, .TRANAD + .CALL 4, .VALUE + .CALL 5, .UTRAN + .CALL 6, .CORE + .CALL 7, .TRANDL + .CALL 10, .DSTART + .CALL 11, .FDELE + .CALL 12, .DSTRT + .CALL 13, .SUSET + .CALL 14, .LTPEN + .CALL 15, .VSCAN + .CALL 16, .POTSET + .CALL 17, unused + +.CBLK ac, hack a core block + ;skip if successful + + This uuo is ARCHAIC. Its use should be avoided + in new programs, since the CORBLK symbolic system call + is much more flexible and easy to understand. + + The contents of accumulator specify an operation + on the executing job's core. It modifies the job's + page map entry for one page. The contents of + should be as follows: + 4.9 Must be zero. + 4.3-4.1 Desired operation: + 0 Get page from self. + 1 Get absolute page. + 2 Get a page from the user open on + the channel specified by bits 3.8-3.1. + 3 Get a page from the user whose user + index is in bits 3.8-3.1. + 4 Get fresh page. + 5 Get public page. + 6 Make my page public. + 7 Make my page private. + 3.9 If 1, request write permission for the page. + Assumed 1 for operation 4 (fresh page). + Otherwise valid only for self, public page, + or direct inferior open on channel. + 3.8-3.1 User index or USR device channel. + If the executing job is a job device, then + 377 will refer to the job which invoked it. + 2.9 1 = insert page in core map. + 0 = delete page. If the operation is 6 or 7, + this bit is ignored. Otherwise, the operation + is ignored for deletion. + 2.8-2.1 Virtual page to be affected within the core map + of the executing job. + 1.9-1.1 Block number within source specified by + bits 4.3-4.1. + + Sample contents of for various operations: + Delete my page 43: 0,,43000 + Create a fresh page 217: 4400,,517000 + Make my page 45 be read-only: 0,,445045 + Make my read-only page 45 writable: 400,,445045 + Make page 16 of job 34 read-only + as my page 377: 3034,,777016 + + This uuo is all right for hacking single pages within + your own core map. To alter another job's core map, + or to hack many pages at once, use the CORBLK + symbolic system call. + For more information on core blocks, see ITS CORBLK. + +.CLOSE chnum, close a file + + The input/output channel is closed. All + operations associated with that channel are completed. + For file structured devices, if another file with + the same name exists (if was being used for + output), that file is deleted at this time and the new + file replaces it. + Any further attempts to use the channel without re-opening + it will cause errors. + .CLOSE does nothing if the channel is not open. + If the USR device is open on the specified channel, + the job is not killed by .CLOSE; it is merely made + to be no longer open on the channel. To kill a USR + device job, the .UCLOSE uuo must be used. + If the channel number is a variable, the CLOSE + symbolic system call may be used. + +.CORE set core limit + ;skip if successful + + This uuo is a relic of the old pre-paging version of ITS. + For applications which want to be relatively clever + about paging and core allocation, see the .CBLK uuo + and the CORBLK symbolic system call. + The effective address of .CORE should be a number between + 0 and 400 octal. The core of the procedure executing it + is modified as follows: + + (DEFUN *CORE (N) + (DO ((K (// (*SUSET *RMEMT) 2000) + (// (*SUSET *RMEMT) 2000))) + ((= K N)) + (COND ((< K N) (CREATE-PAGE K)) + (T (DELETE-PAGE (- K 1)))))) + + That is, at each step a page is either added or deleted + at the top of the job's memory until page is the + highest one in the job's memory. Only a .CORE to + acquire more core can fail. If a .CORE fails to skip, + some of the requested core may have been obtained, + though not all. + +.DCLOSE display close + + This system call releases the 340 display or the + E&S display, if possessed by the executing job, and + closes all channels on which the display is open. + If the display is being hacked via .DSTART, this + won't be any channels. In the case of the 340, the + display is made available to the pdp-6. + If the executing job does not possess the + display, .DCLOSE does nothing but return. + +.DCONTIN display continue + + This system call will restart the E&S display after stopping + or single stepping (.DSTOP, .DSTEP). If the display is + stopped because of a Display MPV, a Hit Stop, WCR stop or + PROG Stop, the condition will NOT be cleared and the display + NOT restarted. If the display is not stopped or does not + belong to the executing job, no action is taken. + + This system call is ignored by the 340 display. + +.DEMON acknowledge one demon request +.DEMON ac, acknowledge demon requests + ;skip if successful and more requests pending + + As of September 1, 1976, only the DM machine has this. + + If the executing job is not a demon, the uuo merely returns + without skipping. If it is a demon, then either 1 or + the contents of the specified non-zero are subtracted + from the demon's request count, and the uuo skips iff the + resulting count is still positive. + See the DEMSIG, RDDMST, and STDMST symbolic system calls. + +.DESIGN ac, de-assign a microtape + ;skip if successful + + The accumulator should contain the number of a + microtape drive. It reverses the effect of a .ASSIGN + uuo by making the drive unassigned again. A .DESIGN + will fail only if an invalid drive number is given, + or if the drive is assigned to some other user than + the one owning the job trying to do the .DESIGN. + It will succeed if the drive is already unassigned. + +.DIAL ac, ANCIENT HISTORY dial a dataphone line + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .NETAC. + + The accumulator should contain a byte pointer + of the following form: + 440600,,[data](n) + where is not an index field, but the number of + a dialer (0 or 1), and is a series of dialing + bytes. The byte string may not be longer than 5 words. + Each byte specifies a dialing step as follows: + 0 End of data. + 1-10. Send 1-10. dialing pulses. Pauses are supplied + between digits automatically. + > 10. Pause <-10.> seconds in dialing. + If the accumulator is zero except for the dialer number, + then the "break" signal is sent after any previous + dialing has been completed. + A .DIAL will fail if the dialer number is invalid, + if the TTY associated with the dialer (0=T07, 1=T06) + is in use by another job, or if the dialer is being used + by some other job (the other job has not done .HANGUP yet). + See the .DIALW and .HANGUP uuos. + +.DIALW dialnum, ANCIENT HISTORY wait for dialing to finish + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .NETS. + + If dialer number is assigned to the job + executing the .DIALW (i.e. the job has done a .DIAL + but not a .HANGUP), then .DIALW skips after waiting + for dialing to be completed. Otherwise it fails. + See the .DIAL and .HANGUP uuos. + +.DIETIME ac, OBSOLETE time until system dies + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the SSTATU + symbolic system call. + + The accumulator is set to the maximum time + (in thirtieths of a second) before ITS will go + down. If the system is not planning to go down + (the normal case, we hope!) is set to -1. + See also the .REVIVE and .SHUTDN uuos. + +.DISMISS [new PC] dismiss an interrupt + + Dismiss an interrupt. The user variable .PICLR + is set to -1, thereby enabling interrupts, and the PC + receives the quantity . + + This is for the so-called "old-style" interrupt scheme. + See also the DISMIS symbolic system call, which + is ordinarily used with the "new-style" vectored + interrupt scheme, but may be used in either case. + + Typically .DISMISS is used in this manner: + + LOC 42 + JSR TSINT ;pointer to interrupt handler + LOC 100 ;or wherever + TSINT: 0 ;interrupt flags + 0 ;PC as of interrupt + EXCH A,TSINT + TSINT1: TLZE A, ;check for various interrupts + JRST ;handlers return to TSINT1 + TLZE A, + JRST + . . . . + MOVE A,TSINT ;restore accumulator + .DISMISS TSINT+1 ;dismiss interrupt + + See ITS INTRUP for more information on interrupts. + +.DISOWN chnum, disown an inferior + + An inferior job should be open on channel . + The job is caused to be no longer an inferior of + the executing job, and is made to be the top level + job of a disowned job tree. The usual reason for + disowning a job is so that it can continue to exist + after its former superior has been killed (for instance, + after the user who disowned it has logged out). + Another reason for disowning a subtree is to reown it + under a different superior, thus altering the shape + of the system's job-tree structure. + All channels on which the executing job has open the + job being disowned will be closed in the process of + disowning (see the .CLOSE uuo). Disowning is illegal if + does not have an inferior open, or if the + subtree being disowned controls the console (see the + .ATTY uuo). If the jobs of the subtree have opened + the console, then the channels are not closed, but + are marked as "disowned tty"; certain operations + on such a channel will succeed, and others will hang + until the tree is re-owned and a console tty given + to the job. Such channels appear to be open on + tty number %TINON=77 octal. + A disowned job is distinguished by the fact that + bit 4.9 of its .APRC user variable is set. + A disowned job never succeeds in executing the RELOAD symbolic + system call, even if it is the top level job in its tree. + When a job tree is logged out, any micro-tapes assigned + to the uname of that job tree are de-assigned (see the + .ASSIGN and .DESIGN uuo's), but only if the job tree is + not disowned. + All disowned jobs share a resource word for purposes of + scheduling, in the same way that all jobs in a single + non-disowned tree share a resource word. Thus all disowned + jobs tend collectively to use no more runtime than any + single non-disowned job tree. + Furthermore, individual disowned jobs are given only 1/4 + the priority to run as a non-disowned job. This does + not apply, however, if the disowned job in question has + .MASTER mode, or controls the 340 display, the E&S display, + the vidisector, the arm, the LPT (line printer), or the + PLT (plotter). + When operating under heavy loads, the swapper prefers to + swap out disowned jobs rather than non-disowned jobs. + + The DETACH symbolic system call makes a non-disowned tree + disowned. + + When a non-disowned top-level job encounters + a fatal interrupt, the system will make it disowned and + print a suitable message on the system console and on + the job's console (if it has one). The disowned tree + can then be reowned with DDT and debugged. + +.DMPCH ac, OBSOLETE mung dump check bit + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the RDMPBT + and SDMPBT symbolic system calls. + + The accumulator should contain a channel number + in the right half, which should have a disk channel + open on it. The left half describes any alterations + to be made to the dump check bit for the open file: + 4.9 Set dump check bit. + 4.8 Clear dump check bit. + The state of the dump check bit (possibly after setting) + is returned in accumulator in bit 1.1. + The dump check bit is used by the magtape file backup + system to keep track of which files have been backed + up on magtape. This bit therefore should not be + twiddled light-heartedly. The "!" you sometimes see + in front of a date in a disk file directory is present + iff the dump check bit for the file is zero. + +.DSTART [start-addr] start the display + ; skip if successful + + This system call is used to start the E&S or 340 display processor, + whichever one the system has. If it has neither, the uuo is + an illegal operation and gives a %PIILO interrupt. + .DSTART assigns the display to the executing job if it is available, + and skips if successful. If the display is not available + .DSTART does not skip. + + In the case of the 340 display, the effective address of the + .DSTART is the address of the user's display list. This can + be either a single BLKO pointer (if the word is negative), or + the first word in a linked list (if the word is positive). + The right half of each word in the linked list is zero + to end the list, or the address of the next word in the list. + The left half of each word in the linked list is the address + (which must be less than 400000!) of a BLKO pointer. If this + address is zero, or the BLKO pointer is zero, it is ignored + (this allows "jump-type" entries in the list.) + The display will continually execute the commands pointed + to by this list. It is OK to change the list, or the single + BLKO pointer, while the display is running, provided everything + always points to valid data. + The .DSTRTL uuo is the same as .DSTART except that it uses + regular AOBJN pointers instead of BLKO pointers. + + In the case of the E&S display, the argument to .DSTART contains + in the right half, the address at which the display program will + start, and in the left half, a code to determine modes of + operation: There are four 3-bit fields in this code: + + 3.1-3.3 Start mode. Only the 3.1 bit is significant. If set, + the display is started in single step mode. + 3.4-3.6 Action to take on Program stop. + 3.7-3.9 Action to take on Hit stop. + 4.1-4.3 Action to take on Memory stop. + + Each of the three Action fields is decoded as follows: + + 0 Restart from address of the last .DSTART. + 1 Continue after the stop condition has been reset. + 2 Stop. + 3 (Reserved). + 4 Interrupt and restart. + 5 Interrupt and continue. + 6 Interrupt and stop. + +.DSTEP step the E&S display + + The .DSTEP call will step the display processor one instruction + cycle if it has been stopped (.DSTOP) or started (.DSTART) in + step mode. If the display is not stopped, .DSTEP will first + simulate a .DSTOP. If the display is not the executing job's, + no action is taken. + + The .DSTEP call is ignored by the 340 display. + +.DSTOP stop the display + + The .DSTOP call will stop the E&S or 340 display processor, + if the display belongs to the executing job. + +.DSTRTL start the display + + In the case of the 340 display, this is the same as + .DSTART (q.v.) except that the display will use AOBJN + pointers instead of BLKO pointers. + + In the case of the E&S display, this + crashes the system. Maybe someday this will be fixed. + +.DTTY devour the tty + + .DTTY is used when a job decides that it wishes to + retain the tty. It skips if it succeeds; it fails if + the job was already in the state of wishing to retain + the tty, or if it had never had the tty. If the tty had + actually belonged to some (possibly indirect) inferior, it + will belong after the .DTTY to the job that executed it. + A job need not have the tty to do a .DTTY. + See ITS TTY for a full explanation of .DTTY. + See also the .ATTY uuo, and the .TTY user variable. + +.DWORD [word] send word to E&S display + + The specified word is sent to the E&S display via + the DATAO instruction. The display is stopped first + via .DSTOP if necessary. + + This system call is ignored if there is no E&S display + or the executing job does not own it. + +.EOFC ac, OBSOLETE end of file character + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been obsoleted and not replaced. + + Accumulator receives the eof character used to + pad the end of the file open on the channel specified + by the contents of before the uuo is executed. + Apparently early microtape files used 141 as the pad + character. + +.EVAL ac, evaluate squoze symbol + ;skip if successful + + Before the uuo is executed, accumulator should + contain the squoze code for a symbol. This symbol + is looked up in the symbol table used by exec DDT + (the one used to debug ITS); this table contains + symbols defined within ITS. The uuo fails to + skip if the symbol is not found; otherwise the value + is placed in and the uuo skips. + + This uuo offers a useful method of obtaining + information from ITS, when combined with the .GETLOC + uuo or with absolute memory pages; for example, + to find out how many irrecoverable disk errors there + have been, PEEK .EVAL's the symbol QIRRCV and examines + that location in the system. Naturally, this is more + risky than using a system call, since the system's + symbols may be changed. One protection against that + is to make an entry in the file AI:SYSTEM;EVSYMS > + mentioning which symbol is being .EVAL'ed by which + program. Then, there will probably be warning from + ITS hackers of any change. + +.FDELE fblock OBSOLETE delete or rename file + ;skip if successful + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the DELETE, + RENAME, and RENMWO symbolic system calls. + + This uuo may be used to delete and rename files. + It points to a five-word block describing the + operation to be performed. There are three cases. + + [1] Delete a file. + + fblock: SIXBIT \ dev\ ;right-justified device name + SIXBIT \fname1\ ;file name 1 + SIXBIT \fname2\ ;file name 2 + 0 ;zero + --- ;not examined + + [2] Rename a file open for writing on channel . + + fblock: --- ;not examined + 0 ;zero + ;channel number + SIXBIT \fname1\ ;new file name 1 + SIXBIT \fname2\ ;new file name 2 + + [3] Rename an arbitrary file. + + fblock: SIXBIT \ dev\ ;right-justified device name + SIXBIT \fname1\ ;old file name 1 + SIXBIT \fname2\ ;old file name 2 + SIXBIT \fname1\ ;new file name 1 + SIXBIT \fname2\ ;new file name 2 + + In cases [1] and [3], if the device specified has + true directory structure, the .SNAME user variable + for the executing job is used as the directory name. + Also, the file names (for case [1]) or the old file + names (for case [3]) are subject to input translation + (see the TRANAD symbolic system call). + If the device is not file structured, .FDELE + succeeds and skips. If .FDELE fails, it returns + an error code on channel 0 which can be retrieved via + the .STATUS uuo or the ERR device. + +.FEED chnum, feed paper tape + ;skip if successful + + If device PTP (the paper tape punch) is open on + channel , the uuo punches one line of blank + tape and skips. Otherwise it fails and does not skip. + +.GENNUM ac, generate number + + Accumulator receives a unique generated number + which will not be generated again for a very long + time (unless the system crashes, in which case the + counter is reset, of course). + [ In ITS 1554 and later. ] + +.GENSYM ac, generate symbol + + Accumulator receives the sixbit name of a + unique generated symbol which will not be generated + again for a very long time (unless the system + crashes, in which case the counter is reset, of + course). + +.GETLOC ac, get absolute location + + The accumulator should contain + an absolute address in the left half and an address + within the executing job in the right half. + The contents of the absolute location specified is + deposited in the location specified within the job. + This is useful for examining locations within the + system. However, if many locations are to be + examined, or if a location is to be examined many + times, it is far more efficient to map the absolute + page(s) containing the location(s) of interest into + the job's core map as read-only memory; the job + can then examine the locations at top speed without + having to go through the system uuo handler. + Such page mappings can be established via the .CBLK + uuo or the CORBLK symbolic system call. + +.GETSYS ac, get system data + ;skip if successful + + Accumulator should contain an AOBJN pointer to a data area in + the user's core. (A zero left half means the data area extends to + the end of core.) Accumulator should contain the sixbit + name of a system data area. The specified system data area is + transferred into the user's core in such a way that the data is + consistent (i.e. interrupts are inhibited in appropriate ways, + etc.). If the .GETSYS is successful, is updated to point to + the unused part of the user's data area. + + If the named data area does not exits, is cleared. If the + area in the user's core is too small, the left half of is + replaced with the negative of the correct size. In both of these + cases .GETSYS fails to skip. + + Valid data areas are: + MEMORY Memory tables. + UTAPE Micro-tape variables. + NCPSM Network control program socket map. + NCPPQ Network control program pending RFC queue. + NCPHT Network control program host table. + USERS User variables for all jobs. + USER User variables for job whose user index is in . + Formerly a uname-jname pair was accepted in + and , but this is no longer true (ANCIENT HISTORY). + GETS Valid sixbit .GETSYS area names. + DEVS Valid sixbit built-in device names. (Doesn't include those on + DEVICE directory.) + CALLS Official system symbol table. Squoze symbols and values for + UUO's, .USET variables, and bits DEFSYM'ed in SYSTEM;BITS. + IMPX Input multiplexor data area. + CLINK Core link device variables. + DSYMS Exec DDT symbol table. Squoze symbols and values. + USYMS Squoze symbols and values for .USET variables only. + (Does -not- contain .RMEMT or .SMEMT, but rather .MEMT. + Used by DDT when you type ".MEMT/".) + CHDEVS Device names, from .RCHST table. + NCALLS Valid sixbit names for symbolic system calls. + USRVAR Valid sixbit user variable names for USRVAR system call. + TTYVAR Valid sixbit tty variable names for TTYVAR system call. + ITSNMS Valid sixbit names of all local ITS machines. + + Names which used to be valid but are no longer (ANCIENT HISTORY): + TRANS Translation tables. + OMPX Output multiplexor data area. + + PEEK used to use this uuo to get system information. + Nowadays it merely maps systems pages into its core + image, thereby gaining efficiency at some small cost + in accuracy. + +.GSNAME ac, ANCIENT HISTORY get system name + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by .SUSET of .RSNAM. + Its opcode has been recycled as .REALT. + + Put the executing job's .SNAM user variable + into accumulator ; this is the default directory + name ("system name") for the job. + +.GUN ac, gun down a job tree + ;skip if successful + + Accumulator should contain the user index of the + top level job of a job tree. That job tree is expunged + from the system. All the jobs are closed and killed. + This is to be used as a last resort to flush hung + and worthless jobs. The system program LOCK + contains a command which performs this operation. + The system job will print a message on the system console + describing what job was gunned and who gunned it. + +.HANG hang until condition satisfied + + The .HANG uuo is to make it easy for programs to wait for various + conditions. It should be used the way a JRST .-1 would be used in + a stand-alone program. Explicitly, it should be preceded by an + instruction that will skip or jump if the awaited condition is + true. Because the system must understand that instruction, only + certain instructions are allowed to be used (any others cause + illegal operation interrupts (%PIILO, bit 1.6 of the .PIRQC user + variable)). They are: SKIP, JUMP, AOS, SOS, AOJ, SOJ, CAI, and CAM + class instructions, -all- test instructions, CONSO and CONSZ (which + work only if the job is in .IOTLSR mode, and the processor is not a + KS10), SKIP and JFCL, which are used to hang forever (really, until + some interrupt routine jumps away instead of returning), SKIPA and + CAIA, which are used to cause rescheduling but don't actually hang, + and JFFO. XCT is also allowed, but the ultimate end of the chain + of XCT's must be one of the instructions listed above. + + In the case of hanging forever, the job is specified to be + desirable to swap out, since it may hang for a long time. + + .HANG conditional instructions which reference only ACs are treated + as hang-forever, except that they don't set the desire-to-swap-out + flag, since the contents of the AC can't change without the job + being interrupted out of the .HANG. + + When a job executes a .HANG, the system effectively executes the + preceding instruction at each schedule to decide whether the job + may be run (cf. the .FLS user variable). If the job is + interrupted, the interrupt routine will find that the saved PC + points to the instruction before the .HANG instruction. It may + dismiss normally, in which case the .HANG will be executed again + unless the condition has become true (of course, the interrupt + routine may do something to make the condition true). + + .HANG takes care to be certain that any side effects of the + instruction will be performed when the condition finally becomes + true. .HANG does this by always exiting by jumping to .-1. Thus + an AOSE instruction followed by a .HANG really will increment the + referenced location after it becomes -1, JFFO AC, followed by .HANG + really will store a bit number into AC+1, and TLZN followed by + .HANG really will clear out the bit after it comes on. + + While a job is waiting in a .HANG, the system does not re-examine + the AC used by the conditional instruction each time it executes + that instruction; it uses what was in the AC when the .HANG was + entered. However, there is no way for this AC to change without + the job being interrupted out of the .HANG so it can change it, or + PCLSRed out when it's superior changes it. Also, the effective + address calculation is not repeated, and if the actual instruction + supplied is an XCT, the XCT'd instruction is not re-fetched. + Therefore, it does not work to expect the condition to become true + because the contents of a memory location indirected through or + XCTed will change. Because an interrupt always causes the .HANG to + be redone, it does work to expect the interrupt routine to change + the AC or the indirect pointer in order to make the instruction + skip. + + In the special case of waiting for a specific interval of time to + pass, the .SLEEP uuo (q.v.) may be useful. In the special case of + waiting for a network socket to change state, the NETBLK symbolic + system call may be useful. + +.HANG ac, .HANG with timeout + + [In ITS version 1622 and later] + + .HANG with a non-zero AC field acts as the disjuction of .HANG and + .SLEEP, allowing a program to wait either for a condition to become + true or for some time to pass. The contents of accumulator + specify when the .HANG should stop waiting for the condition to + become true by returning to the instruction following the .HANG. + If non-negative, it is a length of time to wait in thirtieths of a + second. If negative, it means to wait until the system TIME + variable exceeds its absolute value. + + As with .SLEEP, if the job is interrupted while .HANGing, the + accumulator will be found to contain the appropriate negative + number to allow the .HANG to be resumed properly when the interrupt + is dismissed. + + If .HANG times out before the awaited condition becomes true, the + accumulator will contain 0. This is the only case in which .HANG + will exit to the following instruction. + + If the awaited condition becomes true, so that the previous + instruction skips or jumps away, the accumulator will contain the + negative of the time at which the .HANG would have timed out. + + +.HANGUP dialnum, ANCIENT HISTORY hang up a dialed line + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .REVIVE. + + This uuo was used to hang up on a line which had + been dialed by the .DIAL uuo. + +.IFSET ac, if location contains what I think, set it + ;skip if successful + + The accumulator should contain an absolute 18.-bit + address in the right half and a pointer to a two-word block + in the left half. The first word of the two-word block + contains a test word, and the second a new value. + + If the absolute core location specified contains exactly + the quantity specified by the test word, then the contents + of that location are replaced by the new value specified, + and the .IFSET skips. If the contents of the location + are not the same as the test word, the .IFSET fails. + + This is similar to the .SETLOC uuo, but provides a + measure of safety if the contents of the location + may be volatile. Like the .SETLOC uuo, if the .IFSET + succeeds the system job prints out a message on the + system console detailing the old and new contents + of the location and who modified it. + +.IOPDL reset I/O pdl + + The I/O channel pdl of the executing job is reset. + Entries on the I/O pdl contain the channel number + from which they were pushed; .IOPDL is equivalent + to just enough .IOPOP's (possibly none) to clear + the I/O pdl, popping each entry into the channel + it was pushed from. + See the .IOPUSH and .IOPOP uuos, and the .IOC, .IOS, + .IOP user variables. + +.IOPOP chnum, pop I/O channel + + This uuo is the inverse of the .IOPUSH uuo. + The top entry of the I/O pdl is popped into + channel , which may be a different channel + from the one the entry was pushed from. + A .CLOSE is first performed on the channel popped into. + If the channel originally pushed was a closed channel, + then after popping channel will be closed. + If the I/O pdl has no entries on it, IOC error + number 5 is signaled on channel , giving the + job a class 2 interrupt (%PIIOC, bit 1.9 of the .PIRQC + user variable). + + If the channel number is variable, the IOPOP symbolic + call may be used. + + See the .IOPUSH and .IOPDL uuos, and the .IOC, .IOS, + and .IOP user variables. + See also the .UCLOSE uuo for a discussion of what + occurs when a job open on a pushed channel is killed. + +.IOPUSH chnum, push I/O channel + + The channel is pushed onto the I/O pdl + for the executing job. A channel may be pushed + whether or not it is actually open; if it is open, + transactions on the channel are suspended when + it is pushed, and any transfer on that channel is + inaccessible until the pushed entry is popped + again. The error status and access pointer are + correctly saved as well. The channel number + is also saved in the pdl entry for use by the .IOPDL uuo. + After the channel has been pushed it is returned to + a non-open state (this is not the same as being closed + since closing implies terminating the I/O transaction). + The I/O pdl for each job has room for eight entries; + if all are in use .IOPUSH will signal IOC error + number 6 on channel , giving the job a + class 2 interrupt (%PIIOC, bit 1.9 of the .PIRQC user variable). + + If the channel number is variable, the IOPUSH + symbolic call may be used. + + See the .IOPOP and .IOPDL uuos, and the .IOC, .IOS, + and .IOP user variables. + See also the .UCLOSE uuo for a discussion of what + occurs when a job open on a pushed channel is killed. + +.IOT chan,[foo] input/output transfer + + Input or output is performed, according to the device + open on the specified channel and the mode in which it + was opened. If an error occurs, any of several IOC + errors may occur, giving the job a class 2 interrupt + (%PIIOC, bit 1.9 of the .PIRQC user variable.) + + In "unit mode", foo is the datum to be transferred + in or out. (In the case of input, the word pointed + to by the effective address of the .IOT is modified.) + + In "block mode", foo is an AOBJN pointer to the data + to be transferred in or out. The left half is the + negative of the number of words, the right half is + the address of the first word. The pointer is updated + as the transfer proceeds. When the .IOT returns the + pointer will have been fully counted out, that is + the left half will be zero, except in the case of input + that stops because the end of the file was reached. + + In the case of block mode on an intrinsically character + device, such as TTY, bits 4.9-4.7 of the pointer are + fiddled to indicate which byte in the word is being + processed. + + The VID, NVD, and IMX devices handle .IOT in a non-standard + way because they do both input and output at the same time. + + The symbolic system calls IOT and SIOT are versions of + .IOT which have additional features. + +.IOTLSR ac, iot loser mode + + This uuo is used to request permission from + the system to run in user I/O mode (bit 4.3 of the PC). + In this mode a program is in user mode (and thus is + subject to user mode page mapping), but may perform + I/O instructions without trapping to the system. + This facility must naturally be used with discretion. + It should be noted that ITS will interpretively + simulate most I/O instructions anyway, if it thinks + that the operation will not harm the time-sharing + system. For example, one may use DATAI to read the + console switches even when not in .IOTLSR mode. + This simulation is slower than direct execution + of I/O instructions, but much safer. + + If bit 4.9 (the sign bit) of accumulator is zero, + .IOTLSR mode is relinquished, even if it was not formerly + possessed by the job. + If bit 4.9 is one, then the executing job is granted .IOTLSR + mode, and the system job prints a message on the system + console to document the fact. + +.IPDP chnum, interrupt PDP-6 + + Channel should have the PDP-6 open as an + inferior procedure; if it does not, .IPDP does nothing. + Otherwise the PDP-6 receives an interrupt. + + The PDP-6 can also interrupt the PDP-10; when this occurs + a job with the PDP-6 open as an inferior will receive + an interrupt if enabled for it. See the .IFPIR + user variable for PDP-6 channel interrupts. + + The interface between the PDP-6 and the PDP-10 + is device 20 octal. + The interrupts are given via a CONO: + 1.5 Interrupt other processor. + 1.4 Clear interrupt flag. + 1.3-1.1 Priority interrupt assignment. + The bits read by CONI are as follows: + 1.4 Interrupt flag. + 1.3-1.1 Clear interrupt flag. + +.ITYI ac, OBSOLETE input tty interrupt + ;skip if successful + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the .ITYIC uuo. + + This uuo is exactly like .ITYIC except that it applies + only to the job's console, if any. This uuo is to be + flushed eventually. + +.ITYIC ac, input tty interrupt on channel + ;skip if successful + + The specified accumulator should contain the + number of a channel which is open for tty input. + If an interrupt character is pending in that tty's + input buffer, that character replaces the channel number + in and the .ITYIC skips. It will fail if the + channel is bad, if it does not have a tty open, if the + tty is the job's console but the job does not possess it, + or if there is no interrupt character pending. + If the job does not possess its console and the job's + %TBINT bit is set in the .TTY user variable, the job + receives a class 2 word 1 interrupt (bit 4.2 in the + .PIRQC user variable). + + This uuo is typically used in an interrupt routine + invoked by bit 1.1 (%PITYI) in the .PIRQC user variable or by + a word 2 I/O interrupt on a tty input channel. + If the .ITYIC does not skip the program should ignore + the interrupt entirely; this can happen due to certain + timing screws related to passing the console around + among several jobs. + + See the TTYGET and TTYSET symbolic system calls, which + manipulate bits relevant to interrupt characters. + See the WHYINT system call, which (in the case of + TTY channels) is another way to do the same function + as .ITYIC. + See the .PIRQC and .TTY user variables. + See ITS TTY for a complete explanation of .ITYIC. + +.LISTEN ac, listen to tty + + If the job possesses its console, .LISTEN waits + for any output to be completed, and then returns the + number of input characters pending in the input + buffer. If the job does not possess a console, zero is + returned. + See also the LISTEN symbolic system call. + +.LOGIN ac, ANCIENT HISTORY log in + ;skip if successful + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by the LOGIN symbolic system call. + Its opcode has been recycled as .DEMON. + + Accumulator contains the sixbit name to log in as. + Attempting to log in with a uname equal to 0 or -1 fails, + as does attempting to log in when already logged in. + +.LOGOUT log out + + The executing job and all direct inferiors are killed, + providing that it is the top-level job of its job tree. + All resources used by such jobs are freed. If the job + tree was console-controlled, the system job will print + a "console free" message on the freed console. + + If the executing job is not top-level, .LOGOUT with zero + in the AC field merely returns without skipping. + (An inferior job may not commit suicide without the consent + of its superior.) .LOGOUT with a nonzero AC field will + cause a fatal %PIBRK interrupt which will inform the superior + that the job wants to be killed. If the superior is DDT, + it will kill the job. Here is how a program should exit: + + SKIPE DEBUG ;optional debugging aid: + .VALUE ; job hangs if being debugged + .LOGOUT 1, ;log out or be killed. + +.LOSE lossage-code report lossage + + The job's Program Counter is set to the address of the + .LOSE minus one, the job's .VAL user variable is set + to the new PC,,the magic bits, and the + job is given a %PILOS interrupt. If the job does not + enable this interrupt, and it's superior is DDT, a + helpful error message will be printed. + + The magic bits are documented in DDT ORDER. + The most useful ones are 0 for a random error, + 1000 to ask DDT to type the error message corresponding + to the most recent system call error return, and + 1400 if DDT should attempt to print the names of + the file that the call was opening/referring to. + + The lossage codes are defined by DDT's interpretation of them. + The defined values are: + + %LSSYS==1000 The last error code returned by a failing + system call describes the problem. + + %LSFIL==1400 The last error code returned by a failing + system call, together with the name of the file + it was operating on, describe the problem. + That system call should be right before the .LOSE. + DDT will decode it to determine the filenames + (if it is an OPEN) or the channel number and then + the filenames via an RFNAME. + + %LSSYS+errcode Means that the system call error code + describes the problem. + + %LSFIL+errcode Means that the error code + together with the filenames being used + describe the problem. + + 1+.LZ + Means that the error should be handled as if it + were a fatal interrupt on the specified interrupt + bit. For example, the lossage code 1+.LZ %PIMPV + will to cause DDT to print out an MPV error message. + These lossage codes are more useful with the + LOSE and DISMIS symbolic system calls. + + 0 Signifies some other nondescript error condition. + + The usual way of using this uuo is to put it + after a system call which is expected always to + skip. If it fails to skip, DDT will print an error + message based on what the system call is and what + it was failing to do (if you said 1000 or 1400). + Proceeding the job will retry the call. + + See also the LOSE symbolic system call. + + This call never gets an error, and never returns. + +.LTPEN block hack light pen + + This uuo hacks the light pen on the 340 display. + The address should be the start of a six-word + block. The first word controls the mode: + 4.9 0 => ignore other bits, 1 => examine them. + 3.1 1 => hang until light pen seen at least once. + 1.1 Used to set the multiple sighting mode (1 = on). + The six words of data returned are as follows: + wd 0 The word read by DATAI from the 340 display at + the last light pen interrupt. + wd 1 Number of times the light pen interrupted + since the last .LTPEN uuo. + wd 2 Sum of all Y coordinates since the last .LTPEN uuo. + wd 3 Sum of all X coordinates since the last .LTPEN uuo. + wd 4 The current linked display list pointer. + wd 5 The current BLKO display pointer. + If the job does not currently possess the 340 display, + words 0 and 1 are set to zero. + + If the system has no 340, .LTPEN is ignored. + +.MASTER ac, request/release master mode + ;skip if successful + + Accumulator should have bit 4.9=1 to request + master mode, or =0 to release it. Releasing master + mode always succeeds, even if the job did not have it. + Requesting master mode succeeds if the job already has + master mode, or if it has control of its tty (as determined + by bit 4.9 (%TBNOT) of the .TTY user variable). + Only one job at a time may have master mode; thus requesting + master mode may imply taking it from some other job. + + A job in master mode gets double priority for run time; + that is, it tends to get twice as much run time as any other + job competing for run time. Furthermore, it has priority + in grabbing the 340 display from another user. (The precise + algorithm for grabbing the 340 is actually a function of + who has master mode and of the %TT340 and %TT3HP bits of + the TTYTYP variables of the jobs involved.) + + Master mode should be used only when absolutely necessary. + Needless use of it is considered to be antisocial, and may + be grounds for harassment. + +.MTAPE ac, hack magtape + ;skip if successful + + Accumulator should have a channel number in the + left half and an address in the right half. + (An illegal channel number causes an illegal operation + interrupt (%PIILO, bit 1.6 of the .PIRQC user variable).) + The channel should have device MTn open on it. + The address should point to a word with a signed count + in the left half and a function code in the right half. + Valid function codes are: + 0 Hang until tape motion done. + 1 Rewind tape. + 2 Rewind and dismount. + 3 Write end-of-record (i.e. force current output buffer). + 4 Write three inches of blank tape. + 5 Write end-of-file. + 6 Space over records (negative => backwards). + Illegal for output channel. + 7 Space over files (negative => backwards). + Illegal for output channel. + 10 Space to end-of-tape. + 11 Stop all commands on this channel. + 12 Set block size for writing to words. + 13 Return block size in . For reading, this is the size + of the record most recently swallowed by an IOT. + This operation may trigger one of the following IOC errors, + causing an interrupt (%PIIOC, bit 1.9 of the .PIRQC user variable): + 1 ILLEGAL HARDWARE OPERATION ATTEMPTED + 3 NON-RECOVERABLE DATA ERROR + 9 DEVICE FULL + +.NDIS ac, display times + ;skip if successful + + This uuo is intended for use in taking pictures of + the 340 display screen. It sets a display control + variable from the contents of accumulator . + This variable has no effect if negative, but if + zero it inhibits display completely, and if positive + is decremented by 1 each time the current display + block or list of blocks is displayed. This call + fails to skip if the job does not possess the 340 display. + + On systems which don't have a 340, .NDIS is ignored. + +.NETAC chnum, OBSOLETE accept network connection + ;skip if successful + + This UUO is obsolete. + It is documented here for historical purposes only. + It now ALWAYS fails to skip. + + Channel should be be a network channel in + the "RFC received while listening" (%NSRFC) state (see + the ITS NCP file.) + This is used to accept a connection on a socket opened + with mode bit 1.5=1 (see the OPEN symbolic system call). + An RFC is sent back and the channel put into the + "connection open" state. + + To reject a connection, the channel should be closed with + either the .CLOSE uuo or the CLOSE symbolic system call. + +.NETINT chnum, OBSOLETE network interrupt + + This UUO is obsolete. + It is documented here for historical purposes only. + It is now always a no-op. + + Sends an interrupt out on the network socket associated + with channel number , which should be open on + the NET device. If the local socket number is even + (receiving), an INR message is sent; otherwise, INS + is sent. + +.NETS chnum, network send + + Channel number should be open for network + output. The .NETS uuo forces the current output buffer + to be sent. If the channel is open in the wrong direction, + IOC error 1 (ILLEGAL HARDWARE OPERATION ATTEMPTED) will occur, + possibly giving the user an IOC interrupt (%PIIOC, bit 1.9 of + the .PIRQC user variable). + +.OPEN chnum,block open a file + ;skip if successful + + This uuo is semi-obsolete. The OPEN symbolic system + call is somewhat more flexible and consistent. + However, it is still reasonable to use .OPEN for + devices which do not use directory names. + + A file is opened on the channel specified by . + That channel number is then used to specify the file + on all further I/O transactions on that file. + The address should be the first of several + locations: + wd 0 ,, + wd 1 File name 1, if applicable. + wd 2 File name 2, if applicable. + wd 3 For the NET device, the foreign host number. + The directory name, if applicable, is taken from the + .SNAME user variable. Note that the device name may + be only three characters. The mode bits are as for + the OPEN symbolic system call. + + If bits 4.9-4.7 of word 0 contain 2, then a link is + created. Words 1-5 are then as follows: + wd 1 From file name 1. + wd 2 From file name 2. + wd 3 To file name 1. + wd 4 To file name 2. + wd 5 To sname. + .OPEN should never be used in this way in new programs; + use the MLINK symbolic system call instead. + + If the .OPEN fails to skip, an error code as for + .CALL OPEN will be returned on channel . + +.OPER random operation + + The term .OPER is used to refer to a class of uuo's + which all have the same op-code and are decoded by + the value of their effective address. Those .OPER's + which take arguments generally specify either an + accumulator or an I/O channel number in the accumulator + field of the .OPER. + If the effective address is not a valid .OPER number, + then the job executing the .OPER receives an illegal + operation interrupt (%PIILO, bit 1.6 of the .PIRQC user + variable). + A list of currently valid .OPER's is given below in + numerical order. + + .OPER 0 illegal + .OPER 1 .ITYI + .OPER 2 .LISTEN + .OPER 3 .SLEEP + .OPER 4 .SETMSK + .OPER 5 .SETM2 + .OPER 6 .DEMON + .OPER 7 .CLOSE + .OPER 10 .UCLOSE + .OPER 11 .ATTY + .OPER 12 .DTTY + .OPER 13 .IOPUSH + .OPER 14 .IOPOP + .OPER 15 .DCLOSE + .OPER 16 .DSTOP + .OPER 17 .RDTIME + .OPER 20 .RDSW + .OPER 21 .GUN + .OPER 22 .UDISMT + .OPER 23 .GETSYS + .OPER 24 .IPDP + .OPER 25 .GETLOC + .OPER 26 .SETLOC + .OPER 27 .DISOWN + .OPER 30 .DWORD + .OPER 31 .DSTEP + .OPER 32 .GENSYM + .OPER 33 .LOGOUT + .OPER 34 .REALT + .OPER 35 .WSNAME + .OPER 36 .UPISET + .OPER 37 .RESET + .OPER 40 .ARMOVE + .OPER 41 .DCONT + .OPER 42 .CBLK + .OPER 43 .ASSIGN + .OPER 44 .DESIGN + .OPER 45 .RTIME + .OPER 46 .RDATE + .OPER 47 .HANG + .OPER 50 .EOFC + .OPER 51 .IOTLSR + .OPER 52 .RSYSI + .OPER 53 .SUPSET + .OPER 54 .PDTIME + .OPER 55 .ARMRS + .OPER 56 .UBLAT + .OPER 57 .IOPDL + .OPER 60 .ITYIC + .OPER 61 .MASTER + .OPER 62 .VSTST + .OPER 63 .NETAC + .OPER 64 .NETS + .OPER 65 .REVIVE + .OPER 66 .DIETIME + .OPER 67 .SHUTDN + .OPER 70 .ARMOFF + .OPER 71 .NDIS + .OPER 72 .FEED + .OPER 73 .EVAL + .OPER 74 .REDEF + .OPER 75 .IFSET + .OPER 76 .UTNAM + .OPER 77 .UINIT + .OPER 100 .RYEAR + .OPER 101 .RLPDTM + .OPER 102 .RDATIM + .OPER 103 .RCHST + .OPER 104 .RBTC + .OPER 105 .DMPCH + .OPER 106 .SWAP + .OPER 107 .MTAPE + .OPER 110 .GENNUM + .OPER 111 .NETINT + +.PDTIME ac, PD time + + Returns in accumulator the time since the beginning of the + year, measured in sixtieths of a second. If the time is not known, + -1 is returned. PD = Paul DeCoriolis, who hacked the original + clock on which this was based. Said clock ceased to work many + years ago. + +.POTSET + +.RBTC ac, robot console switches + + The contents of accumulator are sent to the + robot console (device 514) with a DATAO. After a short + delay the result of a DATAI are returned in . + + What the heck is device 514??? + +.RCHST ac, OBSOLETE read channel status + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by the RCHST + and RFNAME symbolic system calls. + + Accumulator should contain a channel number + in the left half and an address in the right half + pointing to a block of several words. + The executing job receives an illegal operation + interrupt (%PIILO, bit 1.6 of the .PIRQC user variable) + if the channel number is illegal. + + The block of words is filled with information + about the status of the channel. The general + pattern of this information is as follows, though + not all devices adhere to it strictly: + wd 0 Device name in the right half. + wd 1 First file name, if applicable. + wd 2 Second file name, if applicable. + wd 3 Sname (directory name), if applicable. + wd 4 Access pointer. Measured in words. + A byte pointer if in character mode, for some devices. + -1 if not randomly accessible. + wds 5-n Other data. May be garbage, or not stored, + depending on the device as specified by word 0. + + See the RCHST symbolic system call for details + of what information is returned for specific devices. + Wd 0 from .RCHST has in its RH the LH of symbolic + RCHST's 1st value. Wds 1-4 from .RCHST are the same as + the 2nd-5th values returned by symbolic RCHST. + Wds 5 and up from .RCHST are the same as values 7 and up + of symbolic RCHST, except that they are not stored for + devices which do not return significant information in + them. Note that value 6 of the RCHST symbolic system + call is not available from .RCHST. + +.RD500 ac, ANCIENT HISTORY read device 500 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .IPDP. + + Device 500 formerly purported to be some kind of clock. + +.RD710 ac, ANCIENT HISTORY read device 710 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .HANG. + + Device 710 used to be a kind of clock on the PDP-6. + This uuo read a 24.-bit quantity from this clock, + measured in 4-microsecond ticks. + +.RD760 ANCIENT HISTORY + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .DWORD. + + Device 760 of the PDP-6 used to be used for temporary + direct sense hookups. (For example, the low six + bits controlled lights on the hand of the AMF arm.) + This uuo returned the result of a DATAI on this device. + +.RDATE ac, read date + + The current date is returned in accumulator as a + word of sixbit characters "YYMMDD", where YY is the + year (modulo 100.), MM is the month, and DD is the day, + all as two-digit decimal numbers. + If the system does not know what the current date is, + -1 is returned. + +.RDATIM ac, read date and time + + This is exactly like the sequence + .RTIME ac, + .RDATE ac+1, + except that the timing error involved with crossing + midnight between execution of the two uuo's is avoided. + Thus accumulator receives the time of day as a word + of sixbit "HHMMSS", where HH is the hour (in 24.-hour + notation), MM is the minute, and SS is the second, + all as two-digit decimal numbers. + Accumulator receives the date as a word of sixbit + characters "YYMMDD" where YY is the year (modulo + 100.), MM is the month, and DD is the day, + all as two-digit decimal numbers. + If one of the quantities is not known by the system, + -1 is returned for that quantity. + +.RDSW ac, OBSOLETE read switches + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by DATAI. + + The contents of the data switches on the PDP-10 console + are returned in accumulator . + The same effect can be achieved by using DATAI 0, + (or any arbitrary location instead of ), which, if + the job is not in .IOTLSR mode, ITS will interpret + specially and simulate. + Neither .RDSW nor DATAI works correctly on KL10s. + Hopefully this will not inconvenience anyone. + On KS10s .RDSW no longer exists. + +.RDTIME ac, read system time + + The time since the system started running, measured in + thirtieths of a second, is returned in accumulator . + Thus the difference between two successive values gives + the amount of real time which passed between the two + executions of .RDTIME. This time does not include time + during which the system was temporarily down, for instance + stopped at a bug halt from which it was later continued + by a system hacker. + +.REALT ac, real time hackery + ;maybe skip on success (see below) + + This uuo controls a fairly complex facility allowing + a job to get good service in real time. The contents + of the specified accumulator are decoded as follows: + %RLFLS 4.9 Turn off old clock rate, zero the tick count, + and release the real time facility. + %RLSET 4.8 Turn on new clock rate. + %RLUSR 4.7 Attempt to seize the real time facility. + %RLNPS 4.6 Do not settle for pseudo-real time status. + %RLPSD 4.5 Insist on pseudo-real time status. + %RLBLK 4.4 Block me except during high priority period. + %RLGET 4.3 Read into words 2-3 (see below) before + interpreting the other bits. + 4.2-3.1 Reserved. Should be zero. + 2.9-1.1 Pointer to four word block: + wd0 Frame time in sixtieths of a second. + Must fit in the right half. + wd1 Priority time in sixtieths of a second. + Must be less than 15 octal, and less + than or equal to half the contents + of word 0. + wd2 If bit 4.3 on, set the right half to + the frame time, and the left half to + the tick count since last examined. + wd3 If bit 4.3 on, set the right half to + the high priority time, and the left + half to 0 if currently at low priority + or -1 if currently at high priority. + + The real time facility is interpreted as follows: + real time is broken up into cycles, each the number + of sixtieths of a second in length specified by the frame + time. At the beginning of each frame, the %PIRLT + bit (4.8) in the job's .PIRQC user variable is turned + on. This causes an interrupt if the corresponding + bit is on in the .MASK user variable. + Within each frame, the first sixtieths are + high priority time for the job with the real time + facility, where is the specified high priority time. + If a job has the facility, presently has high priority, + and otherwise wants to run, then it is scheduled above + all other jobs. This guarantees that a job will + get a certain amount of run time at specified intervals; + this is useful for responding to real-time conditions. + The system will not schedule the job during its low-priority + phase if it has requested that it be blocked (bit 4.4), + unless it gets an interrupt and is not using the new-style + interrupt system. + The .REALT uuo will skip only if the facility + was requested and successfully seized. In all other + cases it does not skip, even if the requested operation + succeeded. If an invalid quantity is supplied for + a frame time, or for the high priority time, an + illegal operation interrupt occurs + (%PIILO, bit 1.6 of the .PIRQC user variable). + +.REDEF ac, redefine symbol to exec DDT + ;skip if successful + + The specified accumulator should contain the address of + a two word block: + wd0 SQUOZE bits,symbol + wd1 value + If the are all ones, then the symbol is deleted. + Otherwise it is defined with the specified value, + replacing any old value. This occurs in the symbol + table used by exec DDT, which is used to debug the + system, and which is used by the .EVAL uuo. + A .REDEF fails to skip only if it tries to add + a new symbol and fails for lack of room in the system. + +.RESET chnum, reset I/O channel + + I/O channel is reset. This is exactly + like the symbolic system call RESET. What happens + is device-dependent; see the description of that call. + +.REVIVE revive system + + This uuo reverses the effect of the .SHUTDN uuo. + It is used by the REVIVE command of LOCK. + Jobs which have enabled it will receive an + interrupt (bit 1.7 of the .PIRQC user variable). + See the .DIETIME and .SHUTDN uuo's, and the SSTATU + symbolic system call. + +.RLPDTM ac, read localized PD time and .RYEAR + + This returns the time and date in and , in a binary + form. contains the result of .RYEAR; see the description + of that uuo for details. contains the "localized" number + of seconds since the beginning of the year. If this is divided + by the number of seconds in a day (86400.), the remainder will + be the number of seconds since midnight local time, and the + quotient will be the number of days since the beginning of the + year, with the (mis)feature that all years are considered to + include February 29. This is done so that date-printing + routines do not have to check for leap-year, but it does mean + that during the last 10 months of non-leap years the day number + is 1 greater than the correct Julian day. Bit 4.9 of is + set in this case. + + Note also that when daylight savings time is in effect will + be advanced by one hour. Again this is done to simplify date + and time printing routines. Bit 4.7 of is set in this + case. + + Note that .RLPDTM should be used instead of .PDTIME followed by + .RYEAR, since it guarantees consistency of the two values + returned. + + +.RRTIM ac, ANCIENT HISTORY read run time + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by the .RUNT user variable. + Its opcode has been recycled as .CBLK. + + The job's run time is returned in accumulator . + See the .RUNT user variable. + +.RSYSI ac, read system incarnation + + Returns in the .FNAM2 of the system when it + was assembled. Thus, it is a version number in sixbit. + This is the same as the seventh value of the + SSTATU symbolic system call. + +.RTIME ac, read time + + The time of day is returned in accumulator as a word + of sixbit characters "HHMMSS", where HH is the hour + (in 24.-hour notation), MM is the minute, and SS is + the second, all as two-digit decimal numbers. + If the system does not know the time, -1 is returned. + See also .RDATIM. + +.RYEAR ac, read year + + Returns in accumulator a word as follows: + + 4.9 This year has 365. days, and it is after February 28. + 4.8 This year is a leap year (366. days). + 4.7 Daylight savings time is in effect. + 4.6 The time of year is known. + 4.2-3.9 If bit 4.6 set, the current day of the week. + Sunday=0, Monday=1, etc. + 3.8-3.6 The day of the week of January 1 of this year. + 3.5-3.1 Zero. + 2.9-1.1 The year, not modulo 100., but as a full quantity, + e.g. 1969. or 1975. + + If the system does not know the time, zero is returned. + +.SETLOC ac, deposit in system + + Expects the rh of to contain the address of a + location in physical core, and the lh of to point + to a word of data in the executing job's memory. + The job's argument word is copied into the addressed + location in physical core, and a message is printed + on the system console. + +.SETM2 OBSOLETE set two interrupt masks + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by block-mode + .SUSET of .MASK and .MSK2. + + The job's .MASK and .MSK2 user variables are set to + the respective contents of accumulators and . + +.SETMSK ac, OBSOLETE set interrupt mask + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .MASK. + + The job's .MASK user variable is set to the contents of + accumulator . + +.SHUTDN ac, shut down system + ;skip on success + + This uuo causes the system to prepare to go down. + (It is used by the KILL command in LOCK.) + Accumulator should contain a time interval, + in thirtieths of a second. The system will go down + exactly that much time after the present moment. + + When the system prepares to go down, all jobs enabled + for it receive a system going down interrupt (%PIDWN, bit 1.7 + of the .PIRQC user variable). (DDT prints a message when it + receives such an interrupt; part of this message is the + contents of the file SYS:DOWN MAIL.) This interrupt will + occur repeatedly every time 3/4 of the time from the previous + interrupt to the time of shutdown has elapsed, except that + interrupts will not occur less than ten seconds before shutdown. + (Thus, if the system were scheduled to go down in ten minutes, + interrupts would happen at the following times before shutdown: + 10:00, 2:30, 0:37. If in five minutes: 5:00, 1:15, 0:17.) + When the magic moment arrives, all users are forceably logged + out, all jobs killed (except job trees whose top-level jobs + have the %OPLIV bit set in their respective .OPTION user variables + -- a feature used primarily by system daemons. Such trees are + expected to log out on their own after finishing their work), + all micro-tapes are flapped, the file SYS:DOWN MAIL is deleted, + "ITS NOT IN OPERATION" messages are printed on all consoles, + all Terminet motors are stopped, all files, directories, and TUTs + are written out, and everything generally put into a good state; + the system then calls DDT. It may be brought back up again + with XREVIV$X, which reloads demons and allows ^Z'ing once more. + + The effects of a .SHUTDN may be reversed by a .REVIVE uuo. + See the .DIETIME and .REVIVE uuo's, and the SSTATU symbolic + system call. + +.SLEEP ac, sleep + + The .SLEEP uuo temporarily puts the executing job into + a dormant but interruptable state. The job consumes no + run time until the specified time interval has elapsed, + unless an interrupt occurs. + The contents of accumulator specify how long the + job is to sleep. If non-negative, it is the length + of time to sleep in thirtieths of a second. If negative, + it means to sleep until the system TIME variable (which + is read by the .RDTIME uuo (q.v.)) exceeds the absolute + value of the specified quantity; thus one can sleep + until a specific time. + + If the job is interrupted in the middle of a .SLEEP, + the accumulator will be seen to contain the appropriate + negative number, either the one originally there or one + calculated from the original positive argument. Thus + re-executing the .SLEEP after dismissing the interrupt + will cause the .SLEEP to be resumed correctly. + + Often it is desirable to "sleep" until some condition + other than the passing of time occurs. For this see + the .HANG uuo. For the special case of sleeping until + a network socket changes state, see the NETBLK symbolic + system call. + +.STATUS chnum,loc I/O channel status + + The status of I/O channel is placed in + location . This is exactly like the STATUS + symbolic system call. + +.SUPSET ac, SUPCOR set + + The system job is partially controlled by a variable + called SUPCOR; .SUPSET XOR's the contents of accumulator + with that variable, returning the result of + the XOR in . Not all bits specified by take + effect; some are AND'ed out first. A message is printed on + the system console as for the .IFSET and .SETLOC uuo's. + + The only really useful bits to set are as follows: + 1.6 Update TV who lines. + 1.2 Kill current file being spooled from TPL to LPT + (this is what the TPL command in LOCK uses). + +.SUSET [suset spec] self USET + + This uuo is used to examine and set user variables + associated with the executing job. See ITS USETS + for more information on .SUSET and .USET. + +.SWAP ac, hack swapping + + This uuo is illegal unless the system is being + debugged (the SYSDBG variable in the system is + non-zero; see the SSTATU symbolic system call). + + The bits in the specified accumulator indicate + a test of the page swapping software in the + system: + 4.9-4.7 Operation to perform. + 0 Swap out the number of pages + specified in 2.9-1.1. + 1,3,5,7 Go into a loop, waiting for + a few seconds and then referencing + location 2000 octal. + 2 Hack the PCLSR test feature on + this job. Bits 2.9-1.1 specify + the test mode: + -1 Enter in hold mode. + 0 Leave PCLSR test mode. + 1 Enter in advance mode. + 2 Enter in advance but don't ^Z. + 4 Swap out the virtual page specified + by bits 2.9-1.1 for the user specified + by bits 3.9-3.1. + 6 Swap out all pages for the user + specified by bits 3.9-3.1. + 3.9-3.1 User index, for operations 4 and 6. A user + index of zero means the job executing the .SWAP. + (After all, it's hard to swap out the system!) + 2.9-1.1 Number of pages for operation 0. + Test mode for operation 2. + Virtual page number for operation 4. + +.TRANAD OBSOLETE translation-list add + +.TRANDL OBSOLETE translation-list delete + +.TRANS ANCIENT HISTORY translate file name + +.UBLAT ac, micro-tape blat (?) + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the drive is marked + as being in .UBLAT mode. In this mode, there are + only two permissible operations on the drive: to dismount + (flap) it, and to open it as one giant file. This uuo + is intended for use in reading micro-tapes written in + non-standard (e.g. DEC) format. Any .OPEN + on a micro-tape in .UBLAT mode will ignore the + file names, and all the blocks of the tape except block 0 + will be read or written consecutively. No deletes, renames, + etc. are permitted. A .UBLAT will fail if the drive does + not exist, if the micro-tape directory has been read in + already by the system, or if the drive is not assigned + to the user whose job is trying to do a .UBLAT. + +.UCLOSE chnum, USR close + + This uuo is used to explicitly kill an inferior + open on channel . Merely performing a + .CLOSE on the channel is not enough - that + dissociates the inferior from the I/O channel, + but does not destroy the inferior procedure. + When the procedure is destroyed, all of its + inferiors, direct or indirect, are destroyed also. + As each job is destroyed, its I/O channels + are automatically .CLOSE'd, and any facilities + such as .MASTER mode are released. The translation + lists are cleared for all destroyed jobs. + + If any procedure whatever has a destroyed job + open on an I/O channel, that channel is automatically + closed; in particular, the channel is + closed. All jobs with channels which have the job open + as a foreign user (as opposed to an inferior or a + job device) also receive a word 2 I/O interrupt on each + such channel (see the .IFPIR user variable). + If a procedure has pushed a channel with a job to be + destroyed onto its I/O pdl (see the .IOPUSH, .IOPOP, and + .IOPDL uuos, and the .IOC, .IOS, and .IOP user variables), + then that I/O pdl entry is replaced on the pdl with a special + entry for a pseudo-device called the "interrupt on .IOPOP + device", which delivers a word 2 interrupt when popped from + the I/O pdl and then closes its channel (thus it should be + impossible to perform any operation on this "device" except + .IOPOP). In this way a job can detect the fact that a + foreign job disappeared while it was pushed. + + A procedure which executes a .UCLOSE receives + an I/O channel error interrupt (%PIIOC, bit 1.9 of the + .PIRQC user variable) if the specified channel + does not have an immediately inferior procedure + open on it. + +.UDISMT ac, micro-tape dismount + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the directory + is written back onto the micro-tape and excised from + the system's memory. The micro-tape is then physically + dismounted (this is known as "flapping" the tape, since + when it runs off the reel it goes flap, flap). + Micro-tapes should not be manually dismounted, for this + will cause the directories to get out of phase, messing + up that micro-tape and the next one to use that drive. + The .UDISMT will fail if any files are still + open on the micro-tape, or if someone else has the + drive assigned to him. + DDT makes this available via its command :FLAP. + See also the FLAP symbolic system call. + +.UINIT ac, initialize micro-tape + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number. If the uuo succeeds, the directory + of the micro-tape is initialized (containing no files). + The uuo fails if the drive does not exist, or if the + drive is not assigned to the user whose job is trying + to do the .UINIT. + See the .ASSIGN and .DESIGN uuos. + +.UPISET ac, OBSOLETE user priority interrupt set + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .PICLR + and/or the .DISMISS uuo and the DISMIS symbolic system + call. + + The value of the ac is converted to -1 or 0 on the basis + of bit 4.9; this value is then exchanged with the .PICLR + user variable for the executing job. Thus the accumulator + gets the old value of .PICLR even as it specifies a + new value. This allows enabling and disabling of + interrupts. + +.USET chnum,[uset spec] set (or get) user variable + + This uuo is used to inspect or alter the user variables + of a job open on channel , which may be a channel + open on the USR or BOJ device. + See ITS USETS for further information on .USET and .SUSET. + +.UTNAM ac, set micro-tape name + ;skip if successful + + The specified accumulator should contain a micro-tape + drive number in the right half and a three character + sixbit name in the left half. If the uuo succeeds, + the name of the micro tape will be changed to the one + specified. The uuo fails if there is no such drive, + if it is in .UBLAT mode, or if it is assigned + to another user. + The name of a micro-tape can be examined with the .RCHST uuo. + +.UTRAN loc user interrupt bit translate + ;skip if successful + + + The effective address of .UTRAN must be a three-word + block: + loc: bit,, ;interrupt bit of inferior + 0 ;uname returned here + 0 ;jname returned here + + The first word should be all zero, except for one + of bits 3.1-3.8; these correspond to inferior + interrupt bits in the .IFPIR user variable. + If the job executing job has an inferior for that + interrupt bit, .UTRAN stores the uname and jname + of the inferior in the second and third words and skips; + otherwise it fails to skip. + + DDT uses this to find jobs which have been :FORGET'ed, or + accidentally created by open's of the USR: device via :PRINT + etc. Normally, superiors should keep track of the interrupt bit + and job names when the job is created, and this UUO should be + used only for exceptional cases. + + See the .IFPIR, .UNAME, .JNAME, and .UIND user variables. + +.VALUE [item] return value to superior + + The job which executes a .VALUE receives a class 1 + interrupt, which stops the job, turns on %PIVAL (bit 1.8) + in its .PIRQC variable, and interrupts its superior. + The word is placed in the .VAL variable of + the executing job (this fact is a historical artifact, + relatively useless now). + + The standard superior procedure (DDT) imposes the + following additional semantics on .VALUE: + If the effective address is zero, then DDT prints + out a message to that effect, and the job is left stopped. + This used to be the standard way to crap out from a grossly + irrecoverable situation (e.g. can't get core, or can't + open the TTY when started). Now .LOSE (q.v.) is preferred. + A typical sequence is: + + GO: .OPEN TTYC,[SIXBIT \ !TTY\] + .VALUE ;unhappy if never got TTY + .CALL [ SETZ ? 'TTYGET ? 1000,,TTYC ? 2000,,A ? 402000,,B ] + .VALUE ;shouldn't lose if .OPEN succeeded + + If the effective address is not zero, it is assumed to + point to an ASCIZ string in the memory of the job + which executed the .VALUE. DDT proceeds to + interpret these characters as if they were typed to + DDT on the console. Thus a job might execute + + .VALUE [ASCIZ \:PROCED :DISOWN V\] + + or something similar, to get itself running again and + disowned from its superior. See the DDT documentation + for specific details on .VALUE. + +.VSCAN + +.VSTST + +.WMAR ac, ANCIENT HISTORY write mar address + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function has been superseded by .SUSET of .MARA. + Its opcode has been recycled as .DCONT. + + The user's mar address variable is set from the + contents of the specified accumulator. + +.WR760 ac, ANCIENT HISTORY write device 760 + + This uuo NO LONGER EXISTS. + It is documented here for historical purposes only. + Its function is obsolete. + Its opcode has been recycled as .DSTEP. + + Device 760 of the PDP-6 used to be used for temporary + direct sense hookups. (For example, the low six + bits controlled lights on the hand of the AMF arm.) + This uuo used the contents of accumulator for a + DATAO to device 760. + +.WSNAME ac, OBSOLETE write system name + + This uuo is ARCHAIC and OBSOLETE. + It is documented here for historical purposes only. + Its use in new programs is to be avoided. + Its function has been superseded by .SUSET of .SNAME. + + The system name for the job (used as a file directory name) + is set to the sixbit contents of accumulator . diff --git a/sysdoc/xgp.writup b/sysdoc/xgp.writup new file mode 100644 index 0000000..0bcdbba --- /dev/null +++ b/sysdoc/xgp.writup @@ -0,0 +1,175 @@ +Copyright (c) 1999 Massachusetts Institute of Technology + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +------------------------------ + +Character Mode for the XGP + +The PDP-11 program for the XGP interprets character strings in files +in the following format: + + +Byte Usual meaning Escape significance + +0 Null - byte is ignored Normal +1 Normal XGP ESCAPE 1 +2 Normal XGP ESCAPE 2 +3 Normal XGP ESCAPE 3 +4 Normal XGP ESCAPE 4 +5-7 Normal Reserved +10 Backspace Normal +11 TAB Normal +12 LF Normal +13 Normal Reserved +14 FF Normal +15 CR Normal +16-37 Normal Reserved +40-176 Normal Normal +177 ESCAPE Normal + +Normal means the definition of this byte in the current font will be +printed. If this byte is undefined in the current font, it will be +ignored. + +ESCAPE causes the next byte to have an alternate meaning selected +from the column "Escape significance". + +Backspace spaces to the left the width of +one space in the current font, including inter-character +spacing. + +TAB produces a column select to the column which is at least the +width of a blank to the right of the current column position, and +some multiple of 8 blank widths to the right of the left margin. +(this computation of the width includes the inter character spacing) + +LF activates the current text line. The current text will be queued +to printed. This line will be printed at a vertical location such +that the distance between the baselines of of it and the preceeding line +is equal to the vertical spacing parameter, unless this would cause +the subscripts of the former line to overlap vertically with the superscripts +of this line. It will then be pushed down to make this not the case. + +FF, like LF, activates the text. In addition, FF causes a page +eject after the current text line is printed. FF also sets the +defalut Y position to the first line below the top of page margin on +the new page. + +The program will automatically form feed when the next text line would +place characters below the bottom margin. Sequential form feeds will +increment the page number but will otherwise be ignored. + +CR causes a column select to the current left margin to be +generated. This can be used to produce overprinting. + + +XGP ESCAPE 1 ('177&'001) causes the next 7 bits to be read as a +special operation code. The following codes are implemented: + + 0-3 Font select. + The code, 0 to 3 is taken as the font identification + number of the font to use. + + 4-37 Reserved for future use. + + 40 XGP Column Selector + The next 14 bits are taken as the + x-position to print at next. (The intention is to + allow arbitrary width spaces for text justification.) + + 41 XGP Underscore + The next 7 bits are taken as the scan-line number on + which to underscore. It is taken as a 2's complement + increment to the base line. Zero is on the baseline, + positive bytes are down from it. Underscores outside + the range of the other characters on the line will be + ignored. The next 14 bits are taken as the length + of the underscore. + + 42 Line space. + This does a line feed and then takes the byte as the + number of lines between this line's baseline and the + baeline of the following line. + + 43 Base-line adjust. + The next 7 bits are taken in two's complement as the + base-line adjustment to the current font. The + adjustment sticks until reset by another adjust + command or a font select. The intention is to allow a + font to be used for subscripts and superscripts. + (Increment baseline for superscript, decrement for + subscript). + +** 44 Print the paper page number. + The paper page number is set to 1 by a form feed. It + is incremented each time the paper is cut. The + decimal value of this count is printed. + +** 45 Accept heading text. + The next byte is a count of bytes to follow. Those + bytes will be read into the heading line. When that + count is exhausted, the heading line will be printed. + If a line feed or line space command is given that + would cause text to be printed below the current text + area, a form feed is inserted by the XGP and if a + heading is defined, it will be printed. + + 46 Start Underline. + Set the left end of an underline. See Stop Underline. + + 47 Stop Underline. + The next byte is the scan line on which to write the + underline (same as XGP Underscore). The extent of + the underscore is defined by this command and Start + Underline. If this command is not preceded by a Start + Underline, it will underline from the left margin. + Beware of column selects. No underline will happen + until this command is given. + + 50 Takes the next byte as the intercharacter spacing + This is reset to zero at the end of each line. + +XGP ESCAPE 2 ('177&'002) causes the next 7 bits to be taken as the +column increment. This quantity is signed: 0-77 are positive +increments 100 to 177 are negative increments (100  -100, 177  -1). + +XGP ESCAPE 3 ('177&'003) causes the next 2 bytes to be taken as the +scan line number on which to start this text line. Scan line 0 is +the first scan line on the page (immediately following the cut). +The topmost scanline of the present text line will be placed on the +scan line indicated in this command. + + +** XGP ESCAPE 4 ('177&'004). This escape is used to specify a vector. +It is followed by 11 bytes describing the vector: + + 2 bytes Y0 Scan line number of first line of vector. + 2 bytes X0 Column position of left edge of first line + of the vector. + 3 bytes DX Delta X. 1 bit of sign; 11 bits of integer; + 9 bits of fraction. + 2 bytes N The number of scan lines on which this vector + is visible. + 2 bytes W The column width of each scan-line. + +The XGP service must be presented with vectors sorted by +ascendending values of Y0. If the vectors are not sorted, the +output will be wrong. + +The escape significance of codes 5 through 10, 13, and 16 through +37 is not defined at the present time but reserved for future use. + +$ +  \ No newline at end of file diff --git a/system/COPYING b/system/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/system/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/system/bits.115 b/system/bits.115 new file mode 100644 index 0000000..1c2080b --- /dev/null +++ b/system/bits.115 @@ -0,0 +1,1125 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;;; ITS BITS THAT ARE OFTEN NEEDED + +.AUXIL + +;;; CATALOGUE OF RESERVED BIT NAME AND CONSTANT PREFIXES IN ITS + +.SEE %CA ;BITS IN CLRAC FOR CORE LINK DEVICE +.SEE %CB ;BITS FOR CORBLK SYMBOLIC SYSTEM CALL +.SEE %CL ;.CALL ARGUMENT TYPES. +.SEE %CLS ;BITS IN LH OF CLSTB ENTRY +.SEE %DC ;DTE20 IOELEVEN COMMANDS +.SEE %DF ;T-300 FAULT (DSCFLT) +.SEE %DM ;T-300 COMMAND (DSCCMD) +.SEE %DO ;DSK OPEN MODE BITS +.SEE %DP ;DATAPOINT CURSOR CONTROL CONSTANTS +.SEE %DS ;T-300 STATUS (DSCSTS) +.SEE %DT ;DTE20 COMMANDS BITS AND CONSTANTS +.SEE %DV ;BITS IN DEVTAB +.SEE %E ;.CALL AND OPEN ERROR CODES +.SEE %GO ;SUPDUP GRAPHICS PROTOCOL COMMANDS +.SEE %H1 ;RP04 (RH10/RH11) ERROR REGISTER 1 +.SEE %H3 ;RP04 (RH10/RH11) ERROR REGISTER 3 +.SEE %HA ;RP04 (RH10/RH11) ADDRESS REGISTER +.SEE %HC ;RP04 (RH10) CONTROL REGISTER +.SEE %HD ;RH10 ERROR BITS IN DRIVE REGISTERS +.SEE %HI ;RH10 CONI BITS +.SEE %HM ;RP04 (RH10/RH11) COMMAND CONSTANTS +.SEE %HO ;RH10 CONO BITS +.SEE %HR ;RH10 CONTROLLER AND RP04 DRIVE REGISTER NUMBERS + ; OR RH11 UNIBUS REGISTER ADDRESSES +.SEE %HS ;RP04 (RH10/RH11) STATUS REGISTER BITS +.SEE %HW ;FOR KL AND KS, BITS IN RH OF RESULT OF APRID +.SEE %HX ;RH11 BITS IN %HRCS1 +.SEE %HY ;RH11 BITS IN %HRCS2 +.SEE %IL ;Interlan NI1010 bits and constants +.SEE %IOT ;BITS IN IOTTB +.SEE %JB ;BITS IN JBWST VARIABLE +.SEE %JG ;BITS IN JOBGET FIRST VALUE +.SEE %JO ;OPCODES IN JOBGET FIRST VALUE +.SEE %JS ;SPECIAL VALUES FOR SPECS +.SEE %KE ;BITS IN KS10 MEMORY STATUS REGISTER (KSECCS) +.SEE %LH ;BITS AND CONSTANTS FOR ACC LH/DH IMP INTERFACE (KS10) +.SEE %MA ;BITS IN MSRAC (MAGTAPE STATUS TABLE) +.SEE %NC ;NETWORK SOCKET CLOSE REASONS +.SEE %NE ;ETHERNET - constants and bits (%EN taken..) +.SEE %NO ;INTERNET - bits for TCPOPN system call +.SEE %NS ;NETWORK SOCKET STATES +.SEE %NT ;INTERNET - TCP channel states (almost = to %NS. See also %NX) +.SEE %NX ;INTERNET - TCP connection close reasons (almost = to %NC) +.SEE %OP ;BITS IN LH OF .OPTION USER VARIABLE +.SEE %PC ;KA10 PC FLAGS +.SEE %PF ;KL10 AND KS10 PAGE FAIL WORD BITS (DEFINITIONS DIFFER + ; BETWEEN MACHINES) +.SEE %PI ;BITS IN PIRQC USER VARIABLE +.SEE %PJ ;BITS IN LH OF PIRQC USER VARIABLE +.SEE %PS ;KL10 AND KS10 PC FLAGS +.SEE %QA ;BITS IN QSRAC (DISK STATUS TABLE) +.SEE %QM ;DISK ACTION MODES IN RH OF QSRAC +.SEE %RL ;BITS FOR COMMANDS TO .REALT UUO +.SEE %SCV ;BITS IN SYSCVL TO CONTROL SYMBOLIC SYSTEM CALLS +.SEE %SS ;STY STATUS BITS IN STYSTS +.SEE %SW ;LH(USWST) BITS +.SEE %SY ;NAMES FOR SQUOZE FLAGS IN SYMBOL TABLES (NOT DEFINED IN ITS) +.SEE %TA ;BITS IN TTYSTA +.SEE %TB ;BITS IN TTYTBL USER VARIABLE +.SEE %TC ;BITS IN TTYCOM +.SEE %TD ;SOFTWARE TTY CURSOR CONTROL CODE CONSTANTS +.SEE %TF ;BITS IN TPFLAG +.SEE %TG ;BITS IN TTYST1 AND TTYST2 +.SEE %TI ;BITS IN LEFT HALF OF TTY INPUT IOCHNM WORD +.SEE %TJ ;BITS IN LH OF TTY OPTPUT IOCHNM +.SEE %TM ;BITS AND CONSTANTS FOR TM03/RH11 TAPE CONTROLLER (KS10) +.SEE %TN ;CONSTANTS FOR TCTYP +.SEE %TO ;BITS IN LEFT HALF OF TTYOPT +.SEE %TP ;BITS IN RIGHT HALF OF TTYOPT +.SEE %TQ ;BITS IN LEFT HALF OF TTYSMT +.SEE %TR ;BITS IN RIGHT HALF OF TTYSMT +.SEE %TS ;BITS IN TTYSTS +.SEE %TT ;BITS IN LEFT HALF OF TTYTYP +.SEE %TX ;ASCII CHARACTER BITS (META, TOP, CONTROL, ETC.) +.SEE %TY ;BITS IN RIGHT HALF OF TTYTYP +.SEE %UB ;BITS IS KS10 UNIBUS STATUS REGISTER (UBASTA) +.SEE %UC ;FOR KL AND KS, BITS IN LH OF RESULT OF APRID +.SEE %UM ;BITS IN UMAPS VARIABLE, AND ARGS TO PGLD, MPLD1, PLD1. +.SEE %UP ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS READ) (UBAPAG) +.SEE %UQ ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS WRITTEN) (UBAPAG) +.SEE %UST ;BITS IN USTP VARIABLE. +.SEE %WY ;WHYINT CODES +.SEE $11 ;BYTE POINTERS TO PDP11 FIELDS IN PDP-10 WORDS, ON AI-KA + ;10-11 INTERFACE. +.SEE ..R ;ARGUMENT CODES FOR .BREAK 12, READING. +.SEE ..S ;ARGUMENT CODES FOR .BREAK 12, WRITING. +.SEE .XC ;INTERNET - TCP connection close reasons (almost = to %NC) + ; (Old names. Use %NX instead.) + +.SEE MMP ;BITS IN MMP ENTRY 1ST WORD L.H. +.SEE OPTTRP ;BITS IN LH OF .OPTION VARIABLE + ; (Old names. Use %OP instead) +.SEE SCL ;BITS IN LH OF SUPCOR +.SEE SCR ;BITS IN RH OF SUPCOR + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,.QUOTE/.QUOTE/X +.ELSE [ + $$TEM1==Z + .QUOTE/.QUOTE/X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +;OPEN-FAILURE CODE NAMES. +;3RD AND 4TH LETTER: "TM" = "TOO MANY", "BD" = "BAD OR ILLEGAL", +; "TF" = "TOO FEW", "RO" = "READ-ONLY", "NA" = "NOT AVAILABLE", +; "NS" = "NO SUCH", "EX" = "ALREADY EXISTS", "FL" = "FULL", +; "NR" = "NOT READY". +;5TH AND 6TH LETTER: "JB" = "JOB", "RG" = "ARG", "DV" = "DEVICE", +; "DR" = "DIRECTORY", "IO" = "DIRECTION", "FL" = "FILE", +; "FN" = "FILE NAME" +DEFSYM %E==:-100 ;BIT TYPEOUT MASK +DEFSYM %ENSDV==:1 ;NO SUCH DEVICE +DEFSYM %ENSIO==:2 ;WRONG DIRECTION +DEFSYM %ETMTR==:3 ;TOO MANY TRANSLATIONS +DEFSYM %ENSFL==:4 ;FILE NOT FOUND +DEFSYM %EFLDR==:5 ;DIRECTORY FULL +DEFSYM %EFLDV==:6 ;DEVICE FULL +DEFSYM %ENRDV==:7 ;DEVICE NOT READY +DEFSYM %ENADV==:10 ;DEVICE NOT AVAILABLE +DEFSYM %EBDFN==:11 ;ILLEGAL FILE NAME +DEFSYM %ENSMD==:12 ;MODE NOT AVAILABLE +DEFSYM %EEXFL==:13 ;FILE ALREADY EXISTS +DEFSYM %EBDCH==:14 ;BAD CHANNEL NUMBER +DEFSYM %ETMRG==:15 ;TOO MANY ARGUMENTS (CALL) +DEFSYM %ENAPK==:16 ;PACK NOT MOUNTED + ;17 FORMERLY DIRECTORY NOT AVAIL +DEFSYM %ENSDR==:20 ;NON-EXISTENT DIRECTORY +DEFSYM %ELCDV==:21 ;LOCAL DEVICE ONLY +DEFSYM %ESCO==: 22 ;SELF-CONTRADICTORY OPEN +DEFSYM %ENAFL==:23 ;FILE LOCKED +DEFSYM %ETMDR==:24 ;M.F.D. FULL +DEFSYM %EMCHN==:25 ;DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +DEFSYM %ERODV==:26 ;DEVICE WRITE-LOCKED +DEFSYM %ETMLK==:27 ;LINK DEPTH EXCEEDED +DEFSYM %ETFRG==:30 ;TOO FEW ARGUMENTS (CALL) +DEFSYM %EROJB==:31 ;CAN'T MODIFY JOB +DEFSYM %EROPG==:32 ;CAN'T GET THAT ACCESS TO PAGE +DEFSYM %EBDRG==:33 ;MEANINGLESS ARGS +DEFSYM %EBDDV==:34 ;WRONG TYPE DEVICE +DEFSYM %ENSJB==:35 ;NO SUCH JOB +DEFSYM %EBOJ==: 36 ;VALID CLEAR OR STORED SET +DEFSYM %ENACR==:37 ;NO CORE AVAILABLE +DEFSYM %ETOP==: 40 ;NOT TOP LEVEL +DEFSYM %ENAPP==:41 ;OTHER END OF PIPELINE GONE OR NOT OPEN +DEFSYM %ENAJB==:42 ;JOB GONE OR GOING AWAY +DEFSYM %ENSCL==:43 ;ILLEGAL SYSTEM CALL NAME +DEFSYM %ENSCH==:44 ;CHANNEL NOT OPEN +DEFSYM %ENRBF==:45 ;INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +DEFSYM %EBDFL==:46 ;UNRECOGNIZABLE FILE (LOAD) +DEFSYM %EBDLK==:47 ;LINK TO NON-EXISTENT FILE + +NOPNLS==:47 ;NO DEFSYM BECAUSE THIS SYMBOL IS NOT TO BE PREDEFINED TO USERS + +; BITS IN .PIRQC USER VARIABLE - FIRST-WORD INTERRUPTS +; CLASSES ARE: +; [1] STOPS JOB AND INTERRUPTS SUPERIOR (FATAL INTR) +; [2] STOPS JOB AND INTERRUPTS SUPERIOR UNLESS ENABLED +; [3] DOES NOTHING UNLESS ENABLED +; BITS IN THE LH HAVE TWO NAMES: %PI... AS A BIT IN THE WORD, +; AND %PJ... SHIFTED DOWN BY 18. BITS. + +.SEE PIRQC + +DEFSYM %PI==:525252,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %PIRLT==:200000,, ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PIRUN==:100000,, ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PINXI==:40000,, ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PIJST==:20000,, ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PIDCL==:10000,, ;DEFERRED CALL [1] +DEFSYM %PIATY==:4000,, ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PITTY==:2000,, ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PIPAR==:1000,, ;MEMORY PARITY ERROR [2] +DEFSYM %PIFOV==:400,, ;FLOATING OVERFLOW [3] +DEFSYM %PIWRO==:200,, ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PIFET==:100,, ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PITRP==:40,, ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PIDBG==:2,, ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PILOS==:1,, ;.LOSE INSTRUCTION EXECUTED [2] +DEFSYM %PICLI==:400000 ;CLI DEVICE OPENED TO THIS JOB [3] +DEFSYM %PIPDL==:200000 ;PUSHDOWN LIST OVERFLOW [3] +DEFSYM %PILTP==:100000 ;LIGHT PEN [3] +DEFSYM %PIMAR==:40000 ;MAR ADDRESS TRAP [2] +DEFSYM %PIMPV==:20000 ;MEMORY PROTECTION VIOLATION [2] +DEFSYM %PICLK==:10000 ;SLOW (1/2 SEC) CLOCK [3] +DEFSYM %PI1PR==:4000 ;SINGLE-INSTRUCTION PROCEED [1] +DEFSYM %PIBRK==:2000 ;.BREAK INSTRUCTION EXECUTED [1] +DEFSYM %PIOOB==:1000 ;ADDRESS OUT OF BOUNDS [2] +DEFSYM %PIIOC==:400 ;I/O CHANNEL ERROR [2] +DEFSYM %PIVAL==:200 ;.VALUE INSTRUCTION EXECUTED [1] +DEFSYM %PIDWN==:100 ;SYSTEM GOING DOWN STATUS CHANGE[3] +DEFSYM %PIILO==:40 ;ILLEGAL OPERATION (E.G. UUO) [2] +DEFSYM %PIDIS==:20 ;DISPLAY MEMORY PROTECT [2] +DEFSYM %PIARO==:10 ;ARITHMETIC OVERFLOW [3] +DEFSYM %PIB42==:4 ;BAD LOCATION 42 [1] +DEFSYM %PIC.Z==:2 ;^Z OR CALL TYPED [1] +DEFSYM %PITYI==:1 ;TTY INPUT (OBSOLETE) [3] + +DEFSYM %PJ==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %PJRLT==:200000 ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PJRUN==:100000 ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PJNXI==:40000 ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PJJST==:20000 ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PJDCL==:10000 ;DEFERRED CALL [1] +DEFSYM %PJATY==:4000 ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PJTTY==:2000 ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PJPAR==:1000 ;MEMORY PARITY ERROR [2] +DEFSYM %PJFOV==:400 ;FLOATING OVERFLOW [3] +DEFSYM %PJWRO==:200 ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PJFET==:100 ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PJTRP==:40 ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PJDBG==:2 ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PJLOS==:1 ;.LOSE INSTRUCTION EXECUTED [2] + +;;; PC FLAGS (LEFT HALF) + +DEFSYM %PC==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PCARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PCCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PCCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PCFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PCFPD==:020000 ;FIRST PART DONE + ; (E.G. ILDB PTR INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PCUSR==:010000 ;USER MODE +DEFSYM %PCUIO==:004000 ;USER I/O +DEFSYM %PCPUR==:002000 ;GIVE %PIFET IF FETCH INSTR FROM WRITABLE + ; PAGE (KA-10 ONLY) +DEFSYM %PCSPC==:001000 ;"SPECIAL" - OBSOLETE +DEFSYM %PC1PR==:000400 ;1 PROCEED - GIVE %PI1PR AFTER ONE INSTRUCTION +DEFSYM %PCX17==:000200 ;XR 17 = PC (AI-KA ONLY) +DEFSYM %PCFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PCDIV==:000040 ;DIVIDE ERROR + +;;; PC FLAGS FOR KL-10 AND KS-10 + +DEFSYM %PS==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PSARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PSPCP==:400000 ;PREVIOUS CONTEXT PUBLIC - PXCT CAN'T + ;REFERENCE CONCEALED PAGE THIS APPLIES ONLY + ;IN EXEC MODE. IN USER MODE AND ON KS IS + ;STILL %PSARO. +DEFSYM %PSCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PSCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PSFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PSFPD==:020000 ;FIRST PART DONE (E.G. ILDB PTR + ;INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PSUSR==:010000 ;USER MODE ; 0 0 1 1 +DEFSYM %PSUIO==:004000 ;USER I/O ;; KERNEL SUPERV CONCEAL PUBLIC +DEFSYM %PSPUB==:002000 ;PUBLIC MODE ; 0 1 0 1 + ;%PSPUB ALWAYS 0 ON KS. +DEFSYM %PSPCU==:004000 ;IN EXEC MODE %PSUIO MEANS PREVIOUS CONTEXT + ;USER. +DEFSYM %PSINH==:001000 ;INHIBIT ADDRESS BREAK & TRAP 3 (TURNS OFF + ;AFTER 1 INST) %PSINH ALWAYS 0 ON KS. +DEFSYM %PSTR2==:000400 ;TRAP 2 (PDL OVERFLOW) ;TRAP 1 PLUS TRAP 2 +DEFSYM %PSTR1==:000200 ;TRAP 1 (ARITH OVERFLOW) ; MAKES TRAP 3 + ; (ONE PROCEED + ; ON KL) +DEFSYM %PSFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PSDIV==:000040 ;DIVIDE ERROR + +DEFSYM %PS1PR==:001600 ;BITS TO SET TO CAUSE A 1-PROCEED ON KL. + +; INTERNET and ARPANET + +.SEE NETRFC +DEFSYM %NQ==:1,,525252 ; Control bits for NETRFC system call +DEFSYM %NQREF==:1 ; Refuse this connection request. Arg 2 must be a + ; previously returned RFC identifier. + +.SEE TCPOPN +DEFSYM %NO==:1,,525252 ; Control bits for TCPOPN system call +DEFSYM %NOLSN==:100 ; Listen mode - wait for SYN (request for conn) + +DEFSYM %NS==:,-1 ; NCP (old ARPANET) SOCKET STATES +DEFSYM %NSCLS==:0 ;CLS RECEIVED. CONNECTION CLOSED (IMSCLS GIVES REASON) +DEFSYM %NSLSN==:1 ;LISTENING FOR RFC +DEFSYM %NSRFC==:2 ;RFC RECEIVED WHILE IN LISTENING STATE +DEFSYM %NSRCL==:3 ;CLS RECEIVED WHILE IN RFC RECEIVED STATE +DEFSYM %NSRFS==:4 ;RFC SENT +DEFSYM %NSOPN==:5 ;CONNECTION OPEN +DEFSYM %NSRFN==:6 ;RFNM WAIT ON WRITE LINK +DEFSYM %NSCLW==:7 ;CLS SENT. WAITING FOR MATCHING CLS +DEFSYM %NSCLI==:10 ;CLS RECEIVED BUT INPUT STILL AVAILABLE +DEFSYM %NSINP==:11 ;INPUT AVAILABLE + +DEFSYM %NT==:,,-1 ; TCP port states as seen by user + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out +DEFSYM %NTCLS==:0 ; - - Closed (reason available from WHYINT) +DEFSYM %NTLSN==:1 ; - - Listening for a SYN +DEFSYM %NTSYR==:2 ; - - SYN received +DEFSYM %NTCLU==:3 ; + ? Being closed by fgn host +DEFSYM %NTSYN==:4 ; - - SYN sent, waiting for response +DEFSYM %NTOPN==:5 ; *I *O Open +DEFSYM %NTWRT==:6 ; ? *O Output buffer full +DEFSYM %NTCLX==:7 ; ? + Being closed by user +DEFSYM %NTCLI==:10 ; +I ? Closing/closed, input still available +DEFSYM %NTINP==:11 ; *I ? Open, input available + + +DEFSYM %NC==:,-1 ; NCP (old ARPANET) CLOSE REASONS (IN IMSCLS) +DEFSYM %NCNTO==:0 ;NEVER OPENED +DEFSYM %NCUSR==:1 ;CLSED BY USER +DEFSYM %NCFRN==:2 ;CLSED BY FOREIGN HOST +DEFSYM %NCRST==:3 ;RST +DEFSYM %NCDED==:4 ;HOST DEAD +DEFSYM %NCINC==:5 ;INCOMPLETE TRANSMISSION +DEFSYM %NCBYT==:6 ;BYTE SIZE MISMATCH. +DEFSYM %NCNCP==:7 ;OUR NCP WENT DOWN. +DEFSYM %NCRFS==:10 ;REQUEST FOR CONNECTION REFUSED + +;;; .XC is being phased out for the name %NX instead. +;;; The .XC symbols will be flushed "soon". + +DEFSYM .XC==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note .XC and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM .XCNTO==:0 ; Never opened +DEFSYM .XCUSR==:1 ; Closed by user +DEFSYM .XCFRN==:2 ; Closed by foreign host +DEFSYM .XCRST==:3 ; Fgn host refused or aborted connection. +DEFSYM .XCDED==:4 ; Fgn host dead (not used yet) +DEFSYM .XCINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM .XCNCP==:7 ; Local TCP went down (not used yet) +DEFSYM .XCRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + +DEFSYM %NX==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note %NX and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM %NXNTO==:0 ; Never opened +DEFSYM %NXUSR==:1 ; Closed by user +DEFSYM %NXFRN==:2 ; Closed by foreign host +DEFSYM %NXRST==:3 ; Fgn host refused or aborted connection. +DEFSYM %NXDED==:4 ; Fgn host dead (not used yet) +DEFSYM %NXINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM %NXNCP==:7 ; Local TCP went down (not used yet) +DEFSYM %NXRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + + + +;;; BITS IN RESULT OF APRID (BLKI APR,) ON KL-10 AND KS-10 +DEFSYM %UC==:1,,525000 ;FOR BIT-TYPEOUT MODE +DEFSYM $UCOPT==:331100 ;MICROCODE OPTIONS: +DEFSYM %UCKLP==:400000 ; KL-10-STYLE PAGING +DEFSYM %UCITS==:20000 ; ITS-STYLE PAGING +DEFSYM %UCTRK==:1000 ; TRACKS FEATURE +DEFSYM $UCVRS==:221100 ;MICROCODE VERSION NUMBER +DEFSYM %UCVRS==:1 +DEFSYM %HW==:0,,527777 ;FOR BIT-TYPEOUT MODE +DEFSYM $HWOPT==:140600 ;HARDWARE OPTIONS +DEFSYM $HWSER==:001400 ;PROCESSOR SERIAL NUMBER + + +;;; .CALL ARGUMENT TYPES +DEFSYM %CL==:1,,400777 +DEFSYM %CLIN==:0 ;INPUT ARGUMENT +DEFSYM %CLIMM==:1000 ;IMMEDIATE ARGUMENT +DEFSYM %CLOUT==:2000 ;OUTPUT ARGUMENT +DEFSYM %CLERR==:3000 ;ERROR CODE OUTPUT ARGUMENT +DEFSYM %CLBTW==:4000 ;DIRECT CONTROL BITS +DEFSYM %CLBIT==:5000 ;IMMEDIATE CONTROL BITS + + +;;; CONTROL BITS FOR CORBLK SYSTEM CALL + +.SEE NCORBLK +DEFSYM %CB==:0,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %CBWRT==:400000 ;TRY FOR WRITE ACCESS, OK IF CAN'T GET IT +DEFSYM %CBRED==:200000 ;TRY FOR READ ACCESS, OK IF CAN'T GET IT +DEFSYM %CBNDW==:100000 ;NEED WRITE ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBPUB==:040000 ;MAKE PAGE PUBLIC, REQUIRES WRITE ACCESS +DEFSYM %CBPRV==:020000 ;MAKE PAGE PRIVATE, REQUIRES WRITE ACCESS +DEFSYM %CBNDR==:010000 ;NEED READ ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBCPY==:004000 ;MAKE A COPY (DISK FILES ONLY) +DEFSYM %CBLOK==:002000 ;LOCK PAGE IN CORE. +DEFSYM %CBULK==:001000 ;UNLOCK PAGE (ALLOW SWAP-OUT) +DEFSYM %CBSLO==:000400 ;MAY ONLY RESIDE IN SLOWEST MEMORY +DEFSYM %CBUSL==:000200 ;ALLOWS USE OF ANY MEMORY. + ;ABOVE BITS ALL ZERO MEANS DELETE PAGE FROM MAP + +;;; SPECIAL VALUES FOR SPECS + +DEFSYM %JS==:,,-1 +DEFSYM %JSELF==:,,-1 ;SELF (ALL SPECS) +DEFSYM %JSTVB==:,,-2 ;11TV BUFFER (CORBLK) +DEFSYM %JSNUL==:,,-3 ;NULL JOB (KLPERF) +DEFSYM %JSALL==:,,-4 ;ALL JOBS (KLPERF) +DEFSYM %JSNEW==:,,-5 ;FRESH PAGE (CORBLK) +DEFSYM %JSABS==:,,-6 ;ABSOLUTE CORE (CORBLK) +DEFSYM %JSNUM==:400000 ;THIS + JOB # => THAT JOB (ALL SPECS) +DEFSYM %JSSIX==:400376 ;PDP6 IS USER NUMBER 376 +DEFSYM %JSSUP==:400377 ;SUPERIOR (ALL SPECS) +;A SPEC MAY ALSO BE THE NUMBER OF A CHANNEL OPEN ON USR:, BOJ:, OR STY: + +;;; CONTROL BITS FOR ".REALT AC," UUO. +;;; FLAG BITS ARE IN LH(AC). + +.SEE AREALT +DEFSYM %RL==:1,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %RLFLS==:400000 ;FLUSH OLD TIMER +DEFSYM %RLSET==:200000 ;SET NEW CLOCK RATE +DEFSYM %RLUSR==:100000 ;TRY TO SEIZE REAL TIME USER FACILITY +DEFSYM %RLPSD==:020000 ;ONLY WANT PSEUDO REAL TIME +DEFSYM %RLNPS==:040000 ;CANNOT ACCEPT PSEUDO REAL TIME +DEFSYM %RLBLK==:010000 ;PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY + ; PHASE OR INTERRUPT LEVEL +DEFSYM %RLGET==:004000 ;GET PREVIOUS STATUS IN WORDS 3+4 + ;REMAINING BITS MUST BE ZERO + +;;; BITS OF .OPTION USER VARIABLE. + +.SEE OPTION +DEFSYM OPTTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM OPTDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM OPTCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM OPTBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM OPTDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM OPTINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM OPTOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM OPTLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM OPTLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM OPTOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM OPTLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM OPTLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; NEW NAMES FOR BITS IN LH(.OPTION) + +DEFSYM %OP==:525252(1) ;FOR BIT-TYPEOUT MODE +DEFSYM %OPTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM %OPDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM %OPCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM %OPBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM %OPDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM %OPINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM %OPOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM %OPLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM %OPLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM %OPOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM %OPLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM %OPLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; LOSING ERROR CODES + +DEFSYM %LS==:777400 ;RH OF .LOSE INSTRUCTION +DEFSYM %LSINT==:1 +DEFSYM %LSSYS==:1000 ;INTERPRET LAST OPEN LOSS CODE, USING .BCHN +DEFSYM %LSFIL==:1400 ; DO THAT AND PRINT FILE NAMES FROM CALL'S CHNL + +;;; FIRST RESULT OF .CALL WHYINT + +DEFSYM %WY==:,-1 +DEFSYM %WYTYI==:1 ;TTY INPUT +DEFSYM %WYTYO==:2 ;TTY OUTPUT +DEFSYM %WYSTI==:3 ;STY INPUT +DEFSYM %WYSTO==:4 ;STY OUTPUT +DEFSYM %WYNET==:5 ;ARPANET (NCP) +DEFSYM %WYCHA==:6 ;CHAOS NET +DEFSYM %WYTCP==:7 ;INTERNET (TCP) + +;I/O MODES FOR OPENS. + +DEFSYM .UAI==0 ;UNIT ASCII INPUT. +DEFSYM .UAO==1 ;UNIT ASCII OUTPUT. +DEFSYM .BAI==2 ;BLOCK ASCII INPUT. +DEFSYM .BAO==3 ;BLOCK ASCII OUTPUT. +DEFSYM .UII==4 ;UNIT IMAGE INPUT. +DEFSYM .UIO==5 ;UNIT IMAGE OUTPUT. +DEFSYM .BII==6 ;BLOCK IMAGE INPUT. +DEFSYM .BIO==7 ;BLOCK IMAGE OUTPUT. + +;OPEN BITS FOR DEVICE DSK: + +DEFSYM %DO==1,,525252 ;BIT TYPEOUT MASK +DEFSYM %DOOUT==1 +DEFSYM %DOBLK==2 +DEFSYM %DOIMG==4 +DEFSYM %DONRF==10 ;DON'T SET REFERENCE DATE. +DEFSYM %DONLK==20 ;DON'T CHASE LINKS. +DEFSYM %DORWT==40 ;ON OUTPUT OPEN, MAKES WOULD-BE READERS + ;WAIT TILL WE CLOSE. +DEFSYM %DOWOV==100000 ;WRITE OVER (USE WITH %DOOUT, TO OVERWRITE + ;EXISTING FILE). + +;ARGUMENT CODES FOR .BREAK 12,'S. +;..R AND ..S ARE BIT TYPEOUT MASKS, NOT MADE PREDEFINED TO MIDAS +;SINCE THEY ARE USEFUL ONLY IN DDT, WHICH DEFINES THEM ITSELF. + +..R==0 ;(FOR .SEE) +DEFSYM ..RSTART==1 ;READ STARTING ADDRESS +DEFSYM ..RLFILE==2 ;READ LOADED FILE'S NAMES +DEFSYM ..RSTP==3 ;READ SYMBOL TABLE POINTER +DEFSYM ..RSYM==4 ;READ VALUE OF SYMBOL. +DEFSYM ..RJCL==5 ;READ JOB COMMAND LINE. +DEFSYM ..RPFILE==6 ;READ :PRINT FILENAME DEFAULTS. +DEFSYM ..RSTB==7 ;READ WHOLE SYMBOL TABLE. +DEFSYM ..RCONV==10 ;READ NAME OF SYMBOL CLOSEST IN VALUE TO + ; ARGUMENT. +DEFSYM ..RLJB==13 ;READ IDX OF PREVIOUSLY CURRENT JOB. +DEFSYM ..RRND==14 ;READ RANDOM JOB-SPECIFIC BITS. +DEFSYM ..RPUR==15 ;UNPURIFY PAGE +DEFSYM ..RHSNAME==16 ;ASK SUPERIOR TO LOOKUP AN HSNAME FROM XUNAME +DEFSYM ..RMAIL==17 ;ASK A SUPERIOR TO LOOKUP USER'S MAIL FILE NAME + +..S==0 ;(FOR .SEE) +DEFSYM ..SSTART==400001 ;SET STARTING ADDRESS +DEFSYM ..SLFILE==400002 ;SET LOADED FILE'S NAMES +DEFSYM ..SSYM==400004 ;SET VALUE OF SYMBOL. +DEFSYM ..SJCL==400005 ;CLEAR JOB COMMAND LINE. +DEFSYM ..SPFILE==400006 ;SET :PRINT FILENAME DEFAULTS. +DEFSYM ..SSTB==400007 ;PASS WHOLE SYMBOL TABLE TO SUPERIOR. +DEFSYM ..SRND==400014 ;SET RANDOM JOB-SPECIFIC BITS. +DEFSYM ..SPUR==400015 ;SAME AS ..RPUR + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +DEFSYM %JG==:1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN + ; WD7 ON AN OPEN +DEFSYM %JGCLS==:40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +DEFSYM %JGSIO==:1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +DEFSYM %JGFPD==:200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +DEFSYM %JO==:,,-1 +DEFSYM %JOOPN==:0 ;OPEN +DEFSYM %JOIOT==:1 ;IOT/SIOT +DEFSYM %JOLNK==:2 ;MLINK +DEFSYM %JORST==:3 ;RESET +DEFSYM %JORCH==:4 ;RCHST +DEFSYM %JOACC==:5 ;ACCESS +DEFSYM %JORNM==:6 ;FDELE (DELETE OR RENAME) +DEFSYM %JORWO==:7 ;FDELE (RENAME WHILE OPEN) +DEFSYM %JOCAL==:10 ;SYMBOLIC .CALL + +;MODE BITS FOR TTY OPENS: +;3.1 0 -> IN 1 -> OUT +;3.2 0 -> UNIT 1 -> BLOCK + +;OUTPUT +;3.3 => IMAGE MODE (SET ALL %TGIMG BITS IN TTYST1 AND TTYST2) +;3.4 0 -> NORMAL 1 -> ECHO MODE OUTPUT (SET %TJECH, %TJPP2, %TJMOR). +;3.5 0 -> NORMAL 1 -> DISPLAYMODE, LOOK FOR ^P (SET %TJDIS). +;3.6 0 -> NORMAL 1 -> SUPER-IMAGE OUTPUT (SET %TJSIO). +;OUTPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR +;%TJCNS, %TJCP1, AND %TJCP2 + +;INPUT +;3.3 => IMAGE MODE (CLEAR ALL ECHO BITS IN TTYST1, TTYST2). +;3.4 => "DDT" (DON'T ECHO CR, LF, TAB) +;3.6 => WANT 3 LINES IN ECHO AREA. +;INPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR %TICNS. + +;BITS 3.4 AND 3.6 ON INPUT, AND BIT 3.3, HAVE EFFECT +;ONLY ON THE FIRST OPEN IN EITHER DIRECTION. +;(THEY ARE OBSOLETED BY THE TTYSET SYSTEM CALL) + +;BITS IN LH OF A TTY CHANNEL IOCHNM WORD +;THESE BITS MAY BE TEMPORARILY COMPLEMENTED BY SPECIFYING +;THEM IN THE CONTROL-BIT ARGUMENT TO A SYMBOLIC IOT +;(EXCEPT FOR %TICNS AND $TIIDX). +DEFSYM %TI==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TJ==:1,,525277 ;BIT TYPEOUT MASK + +DEFSYM %TICNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE +DEFSYM %TJCNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE + +;THE FOLLOWING INTERPRETATIONS OF BITS ARE FOR OUTPUT ONLY. +DEFSYM %TJCP1==:200000 ;^P-CODE ANTICIPATION STATE. +DEFSYM %TJCP2==:100000 ; ". 0=>NORMAL, 1=> CHAR AFTER ^P, 2=> ^PH, 3=>^PV. +DEFSYM %TJECH==:40000 ;SET => ECHO MODE OUTPUT.-MODE OUTPUT (ALL CHARS + ; OUTPUT THE WAY THEY WOULD BE ECHOED) +DEFSYM %TJCTN==:20000 ;SET => DON'T DO LINE-CONTINUATION. +DEFSYM %TJSTP==:10000 ;SET => THIS CHANNEL IS HUNG IN **MORE**. +DEFSYM %TJDIS==:4000 ;SET => LOOK FOR ^P CODES. +DEFSYM %TJSIO==:2000 ;SET => SUPERIMAGE OUTPUT, NO PADDING OR CURSOR CTL. +DEFSYM %TJMOR==:1000 ;SET => DON'T DO **MORE** PROCESSING. +DEFSYM %TJPP2==:400 ;SET => USE ALTERNATE PC PPR (THE ECHO AREA) +DEFSYM %TJINK==:200 ;SET => NEXT CHAR OUT TAKEN AS PRINTING + ; REGARDLESS (^PI) +DEFSYM %TJHDE==:100 ;SET => ACCOUTING FOR CURSOR MOTION DUE TO + ;CHAR ECHOED ON A HALF-DUPLEX TTY. + +;INPUT +DEFSYM %TIECH==:40000 ;CAN READ EVEN IF CHAR NEEDS PI ECHOING. +DEFSYM %TIPEK==:20000 ;DON'T REMOVE CHAR FROM BUFFER. +DEFSYM %TIACT==:4000 ;SET => DON'T WAIT FOR ACTIVATION CHARACTER. +DEFSYM %TIINT==:2000 ;SET => CAN READ A CHAR EVEN IF IT IS SUPPOSED TO + ; INTERRUPT & HASN'T YET. +DEFSYM %TINWT==:1000 ;SET => IF NO INPUT AVAILABLE, DON'T WAIT, JUST + ; RETURN -1. +DEFSYM %TIFUL==:400 ;SET => GIVE FULL CHARACTER (SIGNIFICANT ON IMLAX, TVS) + +DEFSYM $TIIDX==:220600 ;3.6-3.1 CONSOLE #, OR 77 FOR A "DISOWNED" CONSOLE + ; TTY CHNL, IE, ONE THAT CORRESPONDS TO NO REAL TTY. + ; THEY EXIST ONLY IN TREES WITH NO TTY, IN JOBS + ; THAT CAME FROM TREES WITH TTYS. +DEFSYM %TIIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TJIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TINON==:77 ;"TTY #" FOR A CHANNEL WITH NO REAL TTY. + +;EACH CHARACTER IN THE INPUT BUFFER OCCUPIES 18 BITS +;THE UPPER BITS ARE AS FOLLOWS (NOTE THAT AN IOTTED +;CHARACTER MAY ACTUALLY CONTAIN %TXPIE, %TXMPE, %TXECI, OR %TXINT) +DEFSYM %TX==:525200 ;BIT TYPEOUT MASK +DEFSYM %TXMPE==:400000 ;MAIN PROGRAM ECHO CHARACTER +DEFSYM %TXPIE==:200000 ;PI ECHO CHARACTER +; DEFSYM %TXCOM==:100000 ;COM MODE ECHO CHAR; DO PI ECHO EVEN IF HDX +; ; TTY. +; DEFSYM %TXIGN==:40000 ;IGNORE THIS CHAR AT .IOT TIME. +; DEFSYM %TXACT==:20000 ;THIS IS AN ACTIVATION CHAR. +; THESE CAN'T BE NEEDED EXCEPT INSIDE THE SYSTEM. +DEFSYM %TXINT==:10000 ;THIS CHAR SHOULD INTERRUPT THE USER. +;GAP +DEFSYM %TXECI==:2000 ;THIS CHAR WAS ECHOED BY AN ECHOIN SYSTEM CALL. + +;NOW COME THE BITS OF THE CHARACTER ITSELF: +DEFSYM %TXTOP==:4000 ;The "TOP" key. +;GAP +DEFSYM %TXSFT==:1000 ;What used to be the "SHIFT" key is now the +DEFSYM %TXSUP==:1000 ;"SUPER" key. (def'ed in this order for DDT) +DEFSYM %TXMTA==:400 ;"META" key. +DEFSYM %TXCTL==:200 ;"CONTROL" key. +DEFSYM %TXASC==:177 ;The ASCII part of the character. + +;DISPLAY COMMANDS (WHICH LIVE IN THE OUTPUT BUFFER). +;NOTE THAT ALL OF THEM HAVE 200-BIT SET. +DEFSYM %TD==:777400 +DEFSYM %TDMOV==:200 ;MOVE CURSOR +DEFSYM %TDMV1==:201 ;DUMMY COMMAND CREATED BY TYMOV. + ;MAKES IT POSSIBLE FOR TYMOV TO STOP WHEN BUFFER FULL + ;AND BE REENTERED NEXT INTERRUPT. +DEFSYM %TDEOF==:202 ;CLEAR REST OF PAGE +DEFSYM %TDEOL==:203 ;CLEAR REST OF LINE +DEFSYM %TDDLF==:204 ;DELETE FORWARD (FOR IMLACS AND TVS) +DEFSYM %TDMTF==:205 ;MOTOR OFF (FOR TERMINETS) +DEFSYM %TDMTN==:206 ;MOTOR ON (FOR TERMINETS) +DEFSYM %TDCRL==:207 ;CRLF ON DATAPOINTS, IMLACS. +DEFSYM %TDNOP==:210 ;NO-OP FOR SUPERDUPERIMAGE MODE. +DEFSYM %TDBS==:211 ;BACKSPACE (FOR TTY'S WITH %TORAW SET). +DEFSYM %TDLF==:212 ;LINEFEED ("). +DEFSYM %TDRCR==:213 ;CARRET ("). +DEFSYM %TDORS==:214 ;"OUTPUT RESET" FOR SAKE OF SOFTWARE TTYS +DEFSYM %TDQOT==:215 ;MYSTERY COMMAND -- SEND IN A JINGLE IN 25 WORDS OR + ; LESS AND WIN +DEFSYM %TDFS==:216 ;CURSOR FORWARD ONE COLUMN +DEFSYM %TDMV0==:217 ;MOVE CURSOR, FOLLOWED BY NEW VERT POS, NEW HOR POS +DEFSYM %TDCLR==:220 ;CLEAR THE SCREEN +DEFSYM %TDBEL==:221 ;DING THE BELL +DEFSYM %TDINI==:222 ;SYSTEM JUST CAME UP, RE-INITIALIZE INTELLIGENT + ; TERMINAL +DEFSYM %TDILP==:223 ;INSERT LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDDLP==:224 ;DELETE LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDICP==:225 ;INSERT CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDDCP==:226 ;DELETE CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDBOW==:227 ;ENTER BLACK ON WHITE MODE +DEFSYM %TDRST==:230 ;DESELECT ALL SPECIAL MODES (SUCH AS BLACK-ON-WHITE). +DEFSYM %TDGRF==:231 ;ENTER GRAPHICS MODE +DEFSYM %TDRSU==:232 ;REGION SCROLL UP +DEFSYM %TDRSD==:233 ;REGION SCROLL DOWN + +; Apparently codes 234 - 237 are used for an undocumented kludge for +; sending ARDS graphics protocol. See SYSENG;IMPRIN (the source of +; :ARDPRN). + +;%TDSYN THROUGH %TDMLT ARE USED ONLY ON TERMINALS WHICH HAVE %TRLED SET IN +; TTYSMT. +DEFSYM %TDSYN==:240 ;RESYNCH REPLY TO LOCAL EDITING TERMINAL +DEFSYM %TDECO==:241 ;ASK TERMINAL TO TRY LOCAL EDITING BY SENDING A + ; RESYNCH. +DEFSYM %TDEDF==:242 ;SET LOCAL EDITING TERMINAL COMMAND DEFINITION. + ; FOLLOWED BY TWO BYTES, DECODED AS DESCRIBED IN + ; LOCAL EDITING PROTOCOL. +DEFSYM %TDNLE==:243 ;STOP DOING LOCAL EDITING. +DEFSYM %TDTSP==:244 ;DISPLAYS LIKE SPACE, BUT IS PART OF A TAB. USED + ; ONLY FOR LOCAL EDITING TERMINALS, TO ENABLE THEM + ; DISTINGUISH SPACES FROM TABS. +DEFSYM %TDCTB==:245 ;THIS LINE IS CONTINUED AT THE BEGINNING. +DEFSYM %TDCTE==:246 ;THIS LINE IS CONTINUED AT THE END. +DEFSYM %TDMLT==:247 ;%TDMLT => NEXT COLS ARE DISPLAY REP FOR + ; ONE CHAR OF TEXT. +;%TDSVL THROUGH %TDSLL ARE USED ON TERMINALS WHICH HAVE NONZERO %TRLSV. +DEFSYM %TDSVL==:250 ; => SAVE LINES' CONTENTS UNDER + ; LABELS STARTING WITH *200+. +DEFSYM %TDRSL==:251 ;SAME THREE ARGS. RESTORE LABELED CONTENTS ONTO + ; LINES. +DEFSYM %TDSSR==:252 ; SET RANGE OF COLUMNS TO COPY IN + ; %TDSVL, %TDRSL. +DEFSYM %TDSLL==:253 ; SET LABEL FOR NEXT LINE PUSHED OFF + ; SCREEN LOCALLY. +DEFSYM %TDMAX==:254 ;1 + LARGEST DISPLAY CODE. + +;THE TCTYP WORD FOR A TTY CONTAINS A NUMBER WHICH SAYS HOW TO +;PERFORM CURSOR-CONTROL FUNCTIONS ON THE TTY. THE POSSIBILITIES ARE: +DEFSYM %TN==:777777 +DEFSYM %TNPRT==:0 ;PRINTING TTY. +DEFSYM %TNDP==:1 ;TTY USES DATAPOINT CURSOR CTL CODES. +DEFSYM %TNODP==:2 ;TTY IS A LOSING DATAPOINT. +DEFSYM %TNIML==:3 ;TTY USES IMLAC CURSOR CODES. +DEFSYM %TNTEK==:4 ;TEKTRONIX 4000 SERIES +DEFSYM %TNTV==:5 ;TTY IS A KNIGHT TV DISPLAY. +DEFSYM %TNMEM==:6 ;TTY IS A MEMOWRECK. +DEFSYM %TNSFW==:7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. +DEFSYM %TNTRM==:10 ;TTY IS A TERMINET. +DEFSYM %TNESC==:11 ;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52) +DEFSYM %TNDTM==:12 ;DATAMEDIA +DEFSYM %TNRAY==:13 ;TELERAY 1061 +DEFSYM %TNHDS==:14 ;HDS CONCEPT-100 +DEFSYM %TNH19==:15 ;H19 +DEFSYM %TNAAA==:16 ;Ann Arbor Ambassador +DEFSYM %TNMAX==:17 + + +;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR +;TERMINAL ATTACHED TO EACH LINE. + +;LEFT HALF BITS ARE: +DEFSYM %TO==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TOALT==:200000 ;4.8 => STANDARDIZE ALTMODES. +DEFSYM %TOCLC==:100000 ;4.7 => CONVERT LOWER CASE TO UPPER. +DEFSYM %TOERS==:40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. +DEFSYM %TOHDX==:20000 ;4.5 => THIS TTY IS HALF-DUPLEX. +DEFSYM $TOHDX==:370100 +DEFSYM %TOMVB==:10000 ;4.4 => THIS TTY CAN BACKSPACE. +DEFSYM %TOSAI==:4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. +DEFSYM %TOSA1==:2000 ;4.2 INIT %TSSAI OF NEW JOBS. +DEFSYM %TOOVR==:1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. +DEFSYM %TOMVU==:400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A + ; DISPLAY). +DEFSYM %TOMOR==:200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY + ; (ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). +DEFSYM %TOROL==:100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. +DEFSYM %TORAW==:40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. +DEFSYM %TOLWR==:20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. +DEFSYM %TOFCI==:10 ;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET +DEFSYM %TOIML==:4 ;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC + ; SENDS ^L. +DEFSYM %TOLID==:2 ;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES) +DEFSYM %TOCID==:1 ;3.1 => %TDICP, %TDDCP WORK + ; (INSERT AND DELETE CHARACTERS) + +;RIGHT HALF: +DEFSYM %TP==:707252 ;BIT TYPEOUT MASK +DEFSYM %TPPLF==:100000 +DEFSYM $TPPLF==:170300 ;3-BIT FIELD SAYING HOW TO PAD LF. + ; 0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. +DEFSYM %TPPCR==:10000 +DEFSYM $TPPCR==:140300 ;3-BIT FIELD SAYING HOW TO PAD CR. + ; 7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. + ; 0 - DON'T. 1 - NORMAL. 2 - DOUBLE. + ; ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL + ; CURSOR MOTION. + ; 4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. + ; ON TERMINETS, 0 => NO PADDING, ELSE 1,2,3,4,5 + ; ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS. +DEFSYM %TPPCW==:6 ;FOR MEMO WRECK. +DEFSYM %TPPTB==:1000 +DEFSYM $TPPTB==:110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER + ; TAB. 0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING + ; CHARS NEEDED> BUT ON A DISPLAY, TABS ARE NEVER + ; PADDED AND THIS FIELD IS 1 TO USE TABS, 2 TO USE + ; ABSOLUTE CURSOR POSITIONING, 3 TO USE BOTH, 0 TO + ; USE NEITHER. +DEFSYM %TPMTA==:400 ;1.9 => HARDWARE META KEY SETS 8TH BIT +DEFSYM %TPPRN==:200 ;1.8 => INTERCHANGE () WITH [] ON INPUT +DEFSYM %TPTEL==:100 ;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET + ; PROTOCOL +DEFSYM %TPCBS==:40 ;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK + ; SLASH ON INPUT (THE "INTELLIGENT TERMINAL + ; PROTOCOL"). +DEFSYM %TP11T==:20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. NOT + ; SETTABLE BY USER. +DEFSYM %TPORS==:10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO + ; SOMETHING. +DEFSYM %TPRSC==:4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD + +;DEFINE BITS WHICH ARE USER-OPTIONS +DEFSYM %TOUSR==:%TOCLC+%TOSA1+%TOMOR+%TOROL +DEFSYM %TPUSR==:%TPPRN+1 ;THE 1 IS TO AVOID INTEFERING WITH BIT-TYPE-OUT + +DEFSYM %TQ==1,,701725 ;TTY "SMARTS" BITS IN LH(TTYSMT) +DEFSYM %TQIM1==300000 ;TTY IS A PDS1 +DEFSYM %TQIM4==200000 ;TTY IS A PDS4 +DEFSYM %TQP11==100000 ;TTY IS A PDP11 +DEFSYM %TQMCH==700000 ;4.7-4.9 MACHINE TYPE, 0 => NOTHING SPECIAL +DEFSYM %TQGRF==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL +DEFSYM %TQGPH==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL (OBSOLETE NAME) +DEFSYM %TQSET==2 ;3.2 HAS MULTIPLE OBJECT SETS +DEFSYM %TQREC==4 ;3.3 HAS RECTANGLE COMMANDS +DEFSYM %TQXOR==10 ;3.4 HAS XOR MODE +DEFSYM %TQBNK==20 ;3.5 HAS BLINKING +DEFSYM %TQVIR==40 ;3.6 VIRTUAL COORDINATES +DEFSYM %TQHGT==76000 ;4.2-4.6 CHARACTER HEIGHT IN DOTS +DEFSYM %TQWID==1700 ;3.7-4.1 CHARACTER WIDTH IN DOTS + +DEFSYM %TR==534052 ;RH(TTYSMT) +DEFSYM %TRGIN==400000 ;2.9 HAS GRAPHIC INPUT +DEFSYM %TRGHC==200000 ;2.8 HAS GRAPHIC HARDCOPY +DEFSYM %TRLED==100000 ;2.7 HAS LOCAL EDITING PROTOCOL. +DEFSYM %TRSCN==040000 ;2.6 HAS RASTER COMMANDS +DEFSYM %TRLSV==034000 ;2.3-2.5 NONZERO MEANS TERMINAL SUPPORTS 4**N SAVED + ; LINES. +DEFSYM %TRTIM==003700 +DEFSYM $TRTIM==060500 ;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT + ; MINUS #o20; A VALUE OF ZERO MEANS DON'T KNOW, + ; DON'T CARE, OR USER PROGRAM HASN'T IMPLEMENTED IT + ; YET + +;GROUP NUMBER CHARACTERS +;[ 0 ^A-^F ^K-^L ^N-^R ^T-^Z ^] ^^ ^_ ^@ ^\ +; 1 A-Z LOWER CASE A-Z +; 2 0-9 +; 3 !"#$(DOLLAR)%&',.:;?@\ (ACCENT GRAVE) +; (VERTICAL BAR) (TILDE) +; 4 *+-/=^_ +; 5 <>[]() (LEFT BRACE) (RIGHT BRACE) +; 6 ^G ^S +; 7 LF ^I(TAB) +; 10 (ALTMODE) +; 11 CR +; 12 RUBOUT +; 13 SPACE ^H(BACKSPACE) + +;TTYST1 HAS GROUPS 0 THROUGH 5 FROM LEFT TO RIGHT +;TTYST2 HAS 6 THROUGH 13 +;EACH GROUP HAS SIX BITS AS FOLLOWS: +DEFSYM %TG==:777725 ;BIT TYPEOUT MASK +DEFSYM %TGINT==:1 ;N.1 => INTERRUPT ON THIS GROUP +DEFSYM %TGACT==:2 ;N.2 => ACTIVATE ON THIS GROUP (FOR SWAPPING) +DEFSYM %TGSPC==:4 ;N.3 => SPECIAL HACKS. + ; (THIS SET ON GROUP 1 => CONVERT LOWER CASE) +DEFSYM %TGIMG==:10 ;N.4 => IMAGE MODE OUTPUT (N.4=0 => ASCII MODE) + ;N.6-N.5 => ECHO MODE + ; 00 => NO ECHO +DEFSYM %TGPIE==:20 ; 01 => PI ECHO (ECHO CHARACTER WHEN TYPED) +DEFSYM %TGMPE==:40 ; 10 => MAIN PROGRAM ECHO (ECHO WHEN MAIN + ; PROGRAM RECEIVES CHARACTER) + +;TTYSTS HAS RANDOM BITS ASSOCIATED WITH THE TELETYPE +DEFSYM %TS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TSFRE==:400000 ;4.9 => TTY FREE +DEFSYM %TSCLE==:200000 ;4.8 => ECHO ^L AS UPARROW-L EVEN ON DISPLAYS + ;(OTHERWISE WOULD ECHO AS CLEAR SCREEN) +DEFSYM %TSHDX==:100000 ;4.7 REFLECTS %TOHDX BIT. +DEFSYM %TSFCO==:040000 ;4.6 => HANDLE 9-BIT CHARS ON OUTPUT, USING ALPHA, + ; BETA, EPSILON. +DEFSYM %TSALT==:020000 ;4.5 => DON'T STANDARDIZE ALTMODE. +DEFSYM %TSROL==:010000 ;4.4 => SCROLL MODE. +DEFSYM %TSSAI==:004000 ;4.3 => ECHO AND ASCII MODE SHOULD USE SAIL CHAR SET. +DEFSYM %TSACT==:002000 ;4.2 => GOBBLE NEXT CHAR REGARDLESS OF ACTIVATION + ; STATUS +DEFSYM %TSNEA==:001000 ;4.1 => DON'T ECHO IN ECHO AREA; ECHO IN M.P. AREA +DEFSYM %TSINT==:000400 ;3.9 => INT ON NEXT CHAR REGARDLESS +DEFSYM %TSMOR==:000200 ;3.8 => INHIBIT **MORE**. +DEFSYM %TSATY==:000100 ;3.7 SET BY .ATTY, SAYS TTY WAS TAKEN AWAY & RETURNED. + ;3.6-3.5 UNUSED. +DEFSYM %TSNOE==:000010 ;3.4 => DEFER ECHOING, AND MAKE INPUT IOT'S ACT AS + ; IF %TIECH=1. +DEFSYM %TSLCZ==:000004 ;3.3 => LAST CHARACTER TYPED WAS ^Z + ; (NOT PRECEEDED BY ^_) +DEFSYM %TSSII==:000002 ;3.2 => SUPER IMAGE INPUT MODE. ^Z AND ^_ INHIBITED. +DEFSYM %TSCNS==:000001 ;3.1 => TTY IN USE AS CONSOLE CONTROLLING A TREE. +DEFSYM $TSCNS==:220100 + ;RH => USER INDEX + ; -1 => NO USER + +;TTYCOM VARIABLE. +;4.9 => TTY IN COMMUNICATE MODE +DEFSYM %TC==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TCLFT==:200000 ;4.8 => LOCAL FEED THROUGH (SET IF MY PRGM + ; RECEIVING HIS CHRS) +DEFSYM %TCRFT==:100000 ;4.7 => REMOTE FEED THROUGH (SET IF HIS PRGM + ; RECEIVING MY CHRS) +DEFSYM %TCICO==:40000 ;4.6 => INPUT COMMUNICATE OVERRIDE (SET IF MY + ; CONSOLE FEEDING MY PRGM EVEN THO IN COMM MODE). + ; ALSO IMPLIES OUTPUT OVER-RIDE +DEFSYM %TCOCO==:20000 ;4.5 => OUTPUT COMMUNICATE OVERRIDE (SET IF MY + ; PRGM'S OUTPUT TO APPEAR ON MY CONSOLE ONLY EVEN + ; THO IN COM MODE) + ;4.4-4.3 => MESSAGE RECEIPT SWITCH + ; 00 => ACCEPT +DEFSYM %TCRFS==:10000 ; 10 => REFUSE +DEFSYM %TCQRY==:4000 ; 01 => INTERROGATE +DEFSYM %TCMTR==:2000 ;4.2 SET FOR TTY WHOSE MOTOR IS OFF & MUST BE + ; TURNED ON BEFORE ANY OTHER OUTPUT IS DONE. (ONLY + ; TERMINETS HAVE THEIR MOTORS SHUT OFF BY ITS). +DEFSYM %TCECH==:1000 ;4.1 THE OUTPUT BUFFER CONTAINS ECHOING OUTPUT. + ; THIS MAKES OUTPUT RESET DO NOTHING. THE BUFFER + ; MUST NOT CONTAIN ECHO OUTPUT AND NORMAL OUTPUT AT + ; ONE TIME. +DEFSYM %TCLED==:400 ;3.9 JOB WHICH OWNS TTY WANTS LOCAL EDITING IN + ; TERMINAL. SET BY CTL BIT 1.1 IN SCPOS; CLEARED + ; BY SWITCHING JOBS. +DEFSYM %TCDET==:200 ;3.8 CONSOLE'S TREE DETACHED BY TOP LEVEL + ; INTERRUPT. SET BY NDETAC AS SIGNAL TO SYSCFM + ; (CNSL-FREE-MSG TYPER) +DEFSYM %TCDNG==:100 ;3.7 => TYPE BELL ON TTY (BECAUSE INPUT BFR FULL). +DEFSYM %TCCBK==:40 ;3.6 => READING UNAME OR TTY # AFTER ^_K. +DEFSYM %TCCBS==:20 ;3.5 => READING UNAME OR TTY # AFTER ^_S. +DEFSYM %TCFPD==:10 ;3.4 => FIRST PART OF MULTI-CHAR OUTPUT SEQUENCE DONE. +DEFSYM %TCTPN==:4 ;3.3 TYPE ^_N ON LEAVING COM MODE (UNLESS USER + ; EXPLICITLY TYPES ^_N) +DEFSYM %TCPAD==:2 ;3.2 0 => PADDING NECESSARY ON DATAPOINT. +DEFSYM %TCHNG==:1 ;3.1 TTY'S DONE FLAG APPEARS TO BE FRIED, TIME OUT + ; QUICKLY +;RH => USER INDEX COMMUNICATING WITH (-1 NONE) + +;TTYTYP TABLE +;THIS TABLE HOLDS BITS THAT DESCRIBE THE LINE +;AND ITS CONTROLLER, RATHER THAN THE TTY ATTACHED TO THE LINE. +DEFSYM %TT==:1,,525360 ;BIT TYPEOUT MASK +DEFSYM %TTLCL==:400000 ;BIT 4.9 ONE => LOCAL TTY +DEFSYM %TT340==:200000 ;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE +DEFSYM %TT3HP==:100000 ;BIT 4.7 HIGH PRIORITY ON 340 +DEFSYM %TTPAR==:004000 ;BIT 4.3 +DEFSYM %TTDDI==:002000 ;BIT 4.2 DONT DING ON EXCESS INPUT +DEFSYM $TTISP==:260400 ;3.8-3.5 INPUT SPEED CODE +DEFSYM %TTISP==:20 +DEFSYM $TTOSP==:220400 ;3.4-3.1 OUTPUT SPEED CODE +DEFSYM %TTOSP==:1 +;RIGHT HALF BITS +DEFSYM %TY==:525252 ;BIT TYPEOUT MASK +DEFSYM %TYDPK==:400000 ;BIT 2.9 (DATAPOINT KLUDGE TTY LINE) +DEFSYM %TYSTY==:200000 ;BIT 2.8 PSEUDO TTY +DEFSYM %TYNVA==:100000 ;BIT 2.7 NOVA TTY +DEFSYM %TYMTY==:040000 ;BIT 2.6 MORTON BOX +DEFSYM %TYDIL==:020000 ;BIT 2.5 DIAL UP +DEFSYM %TY11T==:010000 ;BIT 2.4 PDP-11 TV TTY. +DEFSYM %TYDL==:004000 ;BIT 2.3 DL-11 TTY +DEFSYM %TYOTY==:002000 ;BIT 2.2 KA-10 CONSOLE TTY +DEFSYM %TYETY==:001000 ;BIT 2.1 DTE20 TTY +DEFSYM %TYNTY==:000400 ;BIT 1.9 TK-10 TTY +DEFSYM %TYMDM==:000200 ;BIT 1.8 LINE DETECTS DIALINS AND HANGUPS +DEFSYM %TYKST==:000100 ;BIT 1.7 KS-10 CONSOLE TTY +DEFSYM %TYDZT==:000040 ;BIT 1.6 DZ-11 TTY ON KS-10 +DEFSYM %TYRLM==:000020 ;BIT 1.5 ROLM DATA SWITCH + +;SPEED CODES ARE DOCUMENTED ON PAGE 3 OF ITS (DEFINE SPEED1) + +;SUPDUP GRAPHICS PROTOCOL COMMANDS: + +DEFSYM %GO==:,,-1 + +DEFSYM %GODLR==:101 ;

Draw line relative, from the cursor to

. +DEFSYM %GODPR==:102 ;

Draw point relative, at

. +DEFSYM %GODRR==:103 ;

Draw rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GODCH==:104 ; <0> + ;Display the chars of starting at the current + ;graphics cursor position. +DEFSYM %GODSC==:105 ; Draws scan bits starting at + ;the current gaphics cursor position. come + ;in bits of 6-6-4. has 100 bit (character + ;gobbled) or 200 bit (interpreted as %TD code) set. +DEFSYM %GODRN==:106 ; <0> Draw run length encoded raster line + ;starting at current graphic cursor. Low six bits are + ;count. 100 bit determines point type (on/off). + +DEFSYM %GODLA==:121 ;

Draw line absolute, from the cursor to

. + ; The same effect as %GODLR, but the arg absolute. +DEFSYM %GODPA==:122 ;

Draw point absolute, at

. +DEFSYM %GODRA==:123 ;

Draw rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOELR==:141 ;

Erase line relative, from the cursor to

. +DEFSYM %GOEPR==:142 ;

Erase point relative, at

. +DEFSYM %GOERR==:143 ;

Erase rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GOECH==:144 ; <0> + ;Erase the chars of starting at the current + ;graphics cursor position. +DEFSYM %GOESC==:145 ; . Erase scan bits starting at + ;the current graphics cursor position. +DEFSYM %GOERN==:146 ; <0> Erase run-length encoded rasters + ;starting at current grphaics cursor position. + +DEFSYM %GOELA==:161 ;

Erase line absolute, from the cursor to

. +DEFSYM %GOEPA==:162 ;

Erase point absolute, at

. +DEFSYM %GOERA==:163 ;

Erase rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOMVR==:001 ;

Move cursor to point

+DEFSYM %GOMVA==:021 ;

Move cursor to point

, absolute address. +DEFSYM %GOXOR==:002 ; Turn on XOR mode. Bit matrix terminals only. +DEFSYM %GOIOR==:022 ; Turn off XOR mode. +DEFSYM %GOSET==:003 ; Select set. is a 1-character set number, + ; 0 - 177. +DEFSYM %GOMSR==:004 ;

Move set origin to

. Display list + ; terminals only. +DEFSYM %GOMSA==:024 ;

Move set origin to

, absolute address. +DEFSYM %GOINV==:006 ; Make current set invisible. +DEFSYM %GOVIS==:026 ; Make current set visible. +DEFSYM %GOBNK==:007 ; Make current set blink. Canceled by %GOINV + ; or %GOVIS. +DEFSYM %GOCLR==:010 ; Erase whole screen. +DEFSYM %GOCLS==:030 ; Erase entire current set (display list + ; terminals). +DEFSYM %GOPSH==:011 ; Push all input-stream status information, to be + ; restored when graphics mode is exited. +DEFSYM %GOVIR==:012 ; Start using virtual co-ordinates +DEFSYM %GOPHY==:032 ; Resume giving co-ordinates in units of dots. +DEFSYM %GOHRD==:013 ; Divert output to output subdevice . + ; =0 reselects the main display screen. +DEFSYM %GOGIN==:014 ; Request graphics input (mouse, tablet, etc). + ; is the reply code to include in the answer. +DEFSYM %GOLMT==:015 ; + ;Limits graphics to a subrectangle of the + ;screen. %GOCLR will clear only that area. + ;This is for those who would use the rest for text. + +;THE TTYTBL VARIABLE EXISTS FOR EACH JOB. +;IT DESCRIBES THE ATTY-DTTY STATE OF THE JOB +;AND OTHER THINGS THAT HAVE TO DO WITH THE TREE'S +;CONTROLLING TTY ONLY. +DEFSYM %TB==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TBNOT==:400000 ;4.9 THIS JOB DOES NOT HAVE THE TTY NOW. +DEFSYM %TBNVR==:200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +DEFSYM %TBINT==:100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY + ; SHOULD INTERRUPT. +DEFSYM %TBWAT==:040000 ;4.6 IF SET, OVERRIDES %TBINT AND %TBNVR, AND + ; FORCES TTY USAGE ATTEMPTS TO HANG. MAY BE ALTERED + ; ONLY BY SUPERIOR. +DEFSYM %TBDTY==:010000 ;4.4 THE JOB DOESN'T HAVE THE TTY, BUT IT IS IN A + ; DTTY'ING STATE. IN OTHER WORDS, THIS JOB DOESN'T + ; WANT TO GIVE THE TTY TO ONE OF ITS INFERIORS. +DEFSYM %TBOUT==:004000 ;4.3 ALLOW TYPEOUT EVEN IF DON'T HAVE TTY (SETTABLE + ; BY SUPERIOR) +DEFSYM %TBINF==:002000 ;4.2 ALLOW INFERIORS TO TAKE ADVANTAGE OF THEIR + ; %TBOUTS. +DEFSYM %TBOIG==:001000 ;4.1 IGNORE OUTPUT (NORMALLY SET BY SUPERIOR). + ; OVERRIDES %TBWAT, %TBINT. +DEFSYM %TBIIN==:000400 ;3.9 INTERRUPT ON ATTEMPT TO DO INPUT. OVERRIDES + ; %TBWAT. NORMALLY SET BY SUPERIOR. +DEFSYM $TBECL==:220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY +DEFSYM %TBECL==:77 + +;RH - IF %TBNOT IS 0, THE RH HAS THE TTY NUMBER. +;OTHERWISE, IF %TBDTY IS 0, THE RH HAS THE USR INDEX OF +;THE INFERIOR THAT THIS JOB GAVE OR WOULD LIKE TO GIVE +;THE TTY TO. OTHERWISE, THE RH IS 0. + +;BITS IN THE PER-STY VARIABLE STYSTS, RETURNED BY STYGET SYSTEM CALL. +DEFSYM %SS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %SSHNG==:400000 ;4.9 = 1 => DON'T HANG ON INPUT IOTS +DEFSYM %SSUSE==:200000 ;4.8 = 1 => IN USE +DEFSYM %SSINT==:100000 ;4.7 = 1 => HAVE GIVEN INT ON STY OUTPUT + ; CHNS ALREADY +DEFSYM %SSONT==:040000 ;4.6 = 1 => DITTO FOR STY INPUT (TTY OUTPUT) +DEFSYM %SSOHG==:20000 ;4.5 = 1 => DON'T HANG ON OUTPUT IOT + ;RH = USER INDEX THAT HAS IT OPEN + + +IFN $$TEMP, EXPUNGE DEFSYM diff --git a/system/bits.116 b/system/bits.116 new file mode 100644 index 0000000..8b2cc9a --- /dev/null +++ b/system/bits.116 @@ -0,0 +1,1126 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;;; ITS BITS THAT ARE OFTEN NEEDED + +.AUXIL + +;;; CATALOGUE OF RESERVED BIT NAME AND CONSTANT PREFIXES IN ITS + +.SEE %CA ;BITS IN CLRAC FOR CORE LINK DEVICE +.SEE %CB ;BITS FOR CORBLK SYMBOLIC SYSTEM CALL +.SEE %CL ;.CALL ARGUMENT TYPES. +.SEE %CLS ;BITS IN LH OF CLSTB ENTRY +.SEE %DC ;DTE20 IOELEVEN COMMANDS +.SEE %DF ;T-300 FAULT (DSCFLT) +.SEE %DM ;T-300 COMMAND (DSCCMD) +.SEE %DO ;DSK OPEN MODE BITS +.SEE %DP ;DATAPOINT CURSOR CONTROL CONSTANTS +.SEE %DS ;T-300 STATUS (DSCSTS) +.SEE %DT ;DTE20 COMMANDS BITS AND CONSTANTS +.SEE %DV ;BITS IN DEVTAB +.SEE %E ;.CALL AND OPEN ERROR CODES +.SEE %GO ;SUPDUP GRAPHICS PROTOCOL COMMANDS +.SEE %H1 ;RP04 (RH10/RH11) ERROR REGISTER 1 +.SEE %H3 ;RP04 (RH10/RH11) ERROR REGISTER 3 +.SEE %HA ;RP04 (RH10/RH11) ADDRESS REGISTER +.SEE %HC ;RP04 (RH10) CONTROL REGISTER +.SEE %HD ;RH10 ERROR BITS IN DRIVE REGISTERS +.SEE %HI ;RH10 CONI BITS +.SEE %HM ;RP04 (RH10/RH11) COMMAND CONSTANTS +.SEE %HO ;RH10 CONO BITS +.SEE %HR ;RH10 CONTROLLER AND RP04 DRIVE REGISTER NUMBERS + ; OR RH11 UNIBUS REGISTER ADDRESSES +.SEE %HS ;RP04 (RH10/RH11) STATUS REGISTER BITS +.SEE %HW ;FOR KL AND KS, BITS IN RH OF RESULT OF APRID +.SEE %HX ;RH11 BITS IN %HRCS1 +.SEE %HY ;RH11 BITS IN %HRCS2 +.SEE %IL ;Interlan NI1010 bits and constants +.SEE %IOT ;BITS IN IOTTB +.SEE %IR ;BITS IN IP ROUTE ENTRY FLAGS +.SEE %JB ;BITS IN JBWST VARIABLE +.SEE %JG ;BITS IN JOBGET FIRST VALUE +.SEE %JO ;OPCODES IN JOBGET FIRST VALUE +.SEE %JS ;SPECIAL VALUES FOR SPECS +.SEE %KE ;BITS IN KS10 MEMORY STATUS REGISTER (KSECCS) +.SEE %LH ;BITS AND CONSTANTS FOR ACC LH/DH IMP INTERFACE (KS10) +.SEE %MA ;BITS IN MSRAC (MAGTAPE STATUS TABLE) +.SEE %NC ;NETWORK SOCKET CLOSE REASONS +.SEE %NE ;ETHERNET - constants and bits (%EN taken..) +.SEE %NO ;INTERNET - bits for TCPOPN system call +.SEE %NS ;NETWORK SOCKET STATES +.SEE %NT ;INTERNET - TCP channel states (almost = to %NS. See also %NX) +.SEE %NX ;INTERNET - TCP connection close reasons (almost = to %NC) +.SEE %OP ;BITS IN LH OF .OPTION USER VARIABLE +.SEE %PC ;KA10 PC FLAGS +.SEE %PF ;KL10 AND KS10 PAGE FAIL WORD BITS (DEFINITIONS DIFFER + ; BETWEEN MACHINES) +.SEE %PI ;BITS IN PIRQC USER VARIABLE +.SEE %PJ ;BITS IN LH OF PIRQC USER VARIABLE +.SEE %PS ;KL10 AND KS10 PC FLAGS +.SEE %QA ;BITS IN QSRAC (DISK STATUS TABLE) +.SEE %QM ;DISK ACTION MODES IN RH OF QSRAC +.SEE %RL ;BITS FOR COMMANDS TO .REALT UUO +.SEE %SCV ;BITS IN SYSCVL TO CONTROL SYMBOLIC SYSTEM CALLS +.SEE %SS ;STY STATUS BITS IN STYSTS +.SEE %SW ;LH(USWST) BITS +.SEE %SY ;NAMES FOR SQUOZE FLAGS IN SYMBOL TABLES (NOT DEFINED IN ITS) +.SEE %TA ;BITS IN TTYSTA +.SEE %TB ;BITS IN TTYTBL USER VARIABLE +.SEE %TC ;BITS IN TTYCOM +.SEE %TD ;SOFTWARE TTY CURSOR CONTROL CODE CONSTANTS +.SEE %TF ;BITS IN TPFLAG +.SEE %TG ;BITS IN TTYST1 AND TTYST2 +.SEE %TI ;BITS IN LEFT HALF OF TTY INPUT IOCHNM WORD +.SEE %TJ ;BITS IN LH OF TTY OPTPUT IOCHNM +.SEE %TM ;BITS AND CONSTANTS FOR TM03/RH11 TAPE CONTROLLER (KS10) +.SEE %TN ;CONSTANTS FOR TCTYP +.SEE %TO ;BITS IN LEFT HALF OF TTYOPT +.SEE %TP ;BITS IN RIGHT HALF OF TTYOPT +.SEE %TQ ;BITS IN LEFT HALF OF TTYSMT +.SEE %TR ;BITS IN RIGHT HALF OF TTYSMT +.SEE %TS ;BITS IN TTYSTS +.SEE %TT ;BITS IN LEFT HALF OF TTYTYP +.SEE %TX ;ASCII CHARACTER BITS (META, TOP, CONTROL, ETC.) +.SEE %TY ;BITS IN RIGHT HALF OF TTYTYP +.SEE %UB ;BITS IS KS10 UNIBUS STATUS REGISTER (UBASTA) +.SEE %UC ;FOR KL AND KS, BITS IN LH OF RESULT OF APRID +.SEE %UM ;BITS IN UMAPS VARIABLE, AND ARGS TO PGLD, MPLD1, PLD1. +.SEE %UP ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS READ) (UBAPAG) +.SEE %UQ ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS WRITTEN) (UBAPAG) +.SEE %UST ;BITS IN USTP VARIABLE. +.SEE %WY ;WHYINT CODES +.SEE $11 ;BYTE POINTERS TO PDP11 FIELDS IN PDP-10 WORDS, ON AI-KA + ;10-11 INTERFACE. +.SEE ..R ;ARGUMENT CODES FOR .BREAK 12, READING. +.SEE ..S ;ARGUMENT CODES FOR .BREAK 12, WRITING. +.SEE .XC ;INTERNET - TCP connection close reasons (almost = to %NC) + ; (Old names. Use %NX instead.) + +.SEE MMP ;BITS IN MMP ENTRY 1ST WORD L.H. +.SEE OPTTRP ;BITS IN LH OF .OPTION VARIABLE + ; (Old names. Use %OP instead) +.SEE SCL ;BITS IN LH OF SUPCOR +.SEE SCR ;BITS IN RH OF SUPCOR + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,.QUOTE/.QUOTE/X +.ELSE [ + $$TEM1==Z + .QUOTE/.QUOTE/X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +;OPEN-FAILURE CODE NAMES. +;3RD AND 4TH LETTER: "TM" = "TOO MANY", "BD" = "BAD OR ILLEGAL", +; "TF" = "TOO FEW", "RO" = "READ-ONLY", "NA" = "NOT AVAILABLE", +; "NS" = "NO SUCH", "EX" = "ALREADY EXISTS", "FL" = "FULL", +; "NR" = "NOT READY". +;5TH AND 6TH LETTER: "JB" = "JOB", "RG" = "ARG", "DV" = "DEVICE", +; "DR" = "DIRECTORY", "IO" = "DIRECTION", "FL" = "FILE", +; "FN" = "FILE NAME" +DEFSYM %E==:-100 ;BIT TYPEOUT MASK +DEFSYM %ENSDV==:1 ;NO SUCH DEVICE +DEFSYM %ENSIO==:2 ;WRONG DIRECTION +DEFSYM %ETMTR==:3 ;TOO MANY TRANSLATIONS +DEFSYM %ENSFL==:4 ;FILE NOT FOUND +DEFSYM %EFLDR==:5 ;DIRECTORY FULL +DEFSYM %EFLDV==:6 ;DEVICE FULL +DEFSYM %ENRDV==:7 ;DEVICE NOT READY +DEFSYM %ENADV==:10 ;DEVICE NOT AVAILABLE +DEFSYM %EBDFN==:11 ;ILLEGAL FILE NAME +DEFSYM %ENSMD==:12 ;MODE NOT AVAILABLE +DEFSYM %EEXFL==:13 ;FILE ALREADY EXISTS +DEFSYM %EBDCH==:14 ;BAD CHANNEL NUMBER +DEFSYM %ETMRG==:15 ;TOO MANY ARGUMENTS (CALL) +DEFSYM %ENAPK==:16 ;PACK NOT MOUNTED + ;17 FORMERLY DIRECTORY NOT AVAIL +DEFSYM %ENSDR==:20 ;NON-EXISTENT DIRECTORY +DEFSYM %ELCDV==:21 ;LOCAL DEVICE ONLY +DEFSYM %ESCO==: 22 ;SELF-CONTRADICTORY OPEN +DEFSYM %ENAFL==:23 ;FILE LOCKED +DEFSYM %ETMDR==:24 ;M.F.D. FULL +DEFSYM %EMCHN==:25 ;DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +DEFSYM %ERODV==:26 ;DEVICE WRITE-LOCKED +DEFSYM %ETMLK==:27 ;LINK DEPTH EXCEEDED +DEFSYM %ETFRG==:30 ;TOO FEW ARGUMENTS (CALL) +DEFSYM %EROJB==:31 ;CAN'T MODIFY JOB +DEFSYM %EROPG==:32 ;CAN'T GET THAT ACCESS TO PAGE +DEFSYM %EBDRG==:33 ;MEANINGLESS ARGS +DEFSYM %EBDDV==:34 ;WRONG TYPE DEVICE +DEFSYM %ENSJB==:35 ;NO SUCH JOB +DEFSYM %EBOJ==: 36 ;VALID CLEAR OR STORED SET +DEFSYM %ENACR==:37 ;NO CORE AVAILABLE +DEFSYM %ETOP==: 40 ;NOT TOP LEVEL +DEFSYM %ENAPP==:41 ;OTHER END OF PIPELINE GONE OR NOT OPEN +DEFSYM %ENAJB==:42 ;JOB GONE OR GOING AWAY +DEFSYM %ENSCL==:43 ;ILLEGAL SYSTEM CALL NAME +DEFSYM %ENSCH==:44 ;CHANNEL NOT OPEN +DEFSYM %ENRBF==:45 ;INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +DEFSYM %EBDFL==:46 ;UNRECOGNIZABLE FILE (LOAD) +DEFSYM %EBDLK==:47 ;LINK TO NON-EXISTENT FILE + +NOPNLS==:47 ;NO DEFSYM BECAUSE THIS SYMBOL IS NOT TO BE PREDEFINED TO USERS + +; BITS IN .PIRQC USER VARIABLE - FIRST-WORD INTERRUPTS +; CLASSES ARE: +; [1] STOPS JOB AND INTERRUPTS SUPERIOR (FATAL INTR) +; [2] STOPS JOB AND INTERRUPTS SUPERIOR UNLESS ENABLED +; [3] DOES NOTHING UNLESS ENABLED +; BITS IN THE LH HAVE TWO NAMES: %PI... AS A BIT IN THE WORD, +; AND %PJ... SHIFTED DOWN BY 18. BITS. + +.SEE PIRQC + +DEFSYM %PI==:525252,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %PIRLT==:200000,, ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PIRUN==:100000,, ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PINXI==:40000,, ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PIJST==:20000,, ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PIDCL==:10000,, ;DEFERRED CALL [1] +DEFSYM %PIATY==:4000,, ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PITTY==:2000,, ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PIPAR==:1000,, ;MEMORY PARITY ERROR [2] +DEFSYM %PIFOV==:400,, ;FLOATING OVERFLOW [3] +DEFSYM %PIWRO==:200,, ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PIFET==:100,, ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PITRP==:40,, ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PIDBG==:2,, ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PILOS==:1,, ;.LOSE INSTRUCTION EXECUTED [2] +DEFSYM %PICLI==:400000 ;CLI DEVICE OPENED TO THIS JOB [3] +DEFSYM %PIPDL==:200000 ;PUSHDOWN LIST OVERFLOW [3] +DEFSYM %PILTP==:100000 ;LIGHT PEN [3] +DEFSYM %PIMAR==:40000 ;MAR ADDRESS TRAP [2] +DEFSYM %PIMPV==:20000 ;MEMORY PROTECTION VIOLATION [2] +DEFSYM %PICLK==:10000 ;SLOW (1/2 SEC) CLOCK [3] +DEFSYM %PI1PR==:4000 ;SINGLE-INSTRUCTION PROCEED [1] +DEFSYM %PIBRK==:2000 ;.BREAK INSTRUCTION EXECUTED [1] +DEFSYM %PIOOB==:1000 ;ADDRESS OUT OF BOUNDS [2] +DEFSYM %PIIOC==:400 ;I/O CHANNEL ERROR [2] +DEFSYM %PIVAL==:200 ;.VALUE INSTRUCTION EXECUTED [1] +DEFSYM %PIDWN==:100 ;SYSTEM GOING DOWN STATUS CHANGE[3] +DEFSYM %PIILO==:40 ;ILLEGAL OPERATION (E.G. UUO) [2] +DEFSYM %PIDIS==:20 ;DISPLAY MEMORY PROTECT [2] +DEFSYM %PIARO==:10 ;ARITHMETIC OVERFLOW [3] +DEFSYM %PIB42==:4 ;BAD LOCATION 42 [1] +DEFSYM %PIC.Z==:2 ;^Z OR CALL TYPED [1] +DEFSYM %PITYI==:1 ;TTY INPUT (OBSOLETE) [3] + +DEFSYM %PJ==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %PJRLT==:200000 ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PJRUN==:100000 ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PJNXI==:40000 ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PJJST==:20000 ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PJDCL==:10000 ;DEFERRED CALL [1] +DEFSYM %PJATY==:4000 ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PJTTY==:2000 ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PJPAR==:1000 ;MEMORY PARITY ERROR [2] +DEFSYM %PJFOV==:400 ;FLOATING OVERFLOW [3] +DEFSYM %PJWRO==:200 ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PJFET==:100 ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PJTRP==:40 ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PJDBG==:2 ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PJLOS==:1 ;.LOSE INSTRUCTION EXECUTED [2] + +;;; PC FLAGS (LEFT HALF) + +DEFSYM %PC==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PCARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PCCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PCCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PCFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PCFPD==:020000 ;FIRST PART DONE + ; (E.G. ILDB PTR INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PCUSR==:010000 ;USER MODE +DEFSYM %PCUIO==:004000 ;USER I/O +DEFSYM %PCPUR==:002000 ;GIVE %PIFET IF FETCH INSTR FROM WRITABLE + ; PAGE (KA-10 ONLY) +DEFSYM %PCSPC==:001000 ;"SPECIAL" - OBSOLETE +DEFSYM %PC1PR==:000400 ;1 PROCEED - GIVE %PI1PR AFTER ONE INSTRUCTION +DEFSYM %PCX17==:000200 ;XR 17 = PC (AI-KA ONLY) +DEFSYM %PCFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PCDIV==:000040 ;DIVIDE ERROR + +;;; PC FLAGS FOR KL-10 AND KS-10 + +DEFSYM %PS==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PSARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PSPCP==:400000 ;PREVIOUS CONTEXT PUBLIC - PXCT CAN'T + ;REFERENCE CONCEALED PAGE THIS APPLIES ONLY + ;IN EXEC MODE. IN USER MODE AND ON KS IS + ;STILL %PSARO. +DEFSYM %PSCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PSCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PSFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PSFPD==:020000 ;FIRST PART DONE (E.G. ILDB PTR + ;INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PSUSR==:010000 ;USER MODE ; 0 0 1 1 +DEFSYM %PSUIO==:004000 ;USER I/O ;; KERNEL SUPERV CONCEAL PUBLIC +DEFSYM %PSPUB==:002000 ;PUBLIC MODE ; 0 1 0 1 + ;%PSPUB ALWAYS 0 ON KS. +DEFSYM %PSPCU==:004000 ;IN EXEC MODE %PSUIO MEANS PREVIOUS CONTEXT + ;USER. +DEFSYM %PSINH==:001000 ;INHIBIT ADDRESS BREAK & TRAP 3 (TURNS OFF + ;AFTER 1 INST) %PSINH ALWAYS 0 ON KS. +DEFSYM %PSTR2==:000400 ;TRAP 2 (PDL OVERFLOW) ;TRAP 1 PLUS TRAP 2 +DEFSYM %PSTR1==:000200 ;TRAP 1 (ARITH OVERFLOW) ; MAKES TRAP 3 + ; (ONE PROCEED + ; ON KL) +DEFSYM %PSFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PSDIV==:000040 ;DIVIDE ERROR + +DEFSYM %PS1PR==:001600 ;BITS TO SET TO CAUSE A 1-PROCEED ON KL. + +; INTERNET and ARPANET + +.SEE NETRFC +DEFSYM %NQ==:1,,525252 ; Control bits for NETRFC system call +DEFSYM %NQREF==:1 ; Refuse this connection request. Arg 2 must be a + ; previously returned RFC identifier. + +.SEE TCPOPN +DEFSYM %NO==:1,,525252 ; Control bits for TCPOPN system call +DEFSYM %NOLSN==:100 ; Listen mode - wait for SYN (request for conn) + +DEFSYM %NS==:,-1 ; NCP (old ARPANET) SOCKET STATES +DEFSYM %NSCLS==:0 ;CLS RECEIVED. CONNECTION CLOSED (IMSCLS GIVES REASON) +DEFSYM %NSLSN==:1 ;LISTENING FOR RFC +DEFSYM %NSRFC==:2 ;RFC RECEIVED WHILE IN LISTENING STATE +DEFSYM %NSRCL==:3 ;CLS RECEIVED WHILE IN RFC RECEIVED STATE +DEFSYM %NSRFS==:4 ;RFC SENT +DEFSYM %NSOPN==:5 ;CONNECTION OPEN +DEFSYM %NSRFN==:6 ;RFNM WAIT ON WRITE LINK +DEFSYM %NSCLW==:7 ;CLS SENT. WAITING FOR MATCHING CLS +DEFSYM %NSCLI==:10 ;CLS RECEIVED BUT INPUT STILL AVAILABLE +DEFSYM %NSINP==:11 ;INPUT AVAILABLE + +DEFSYM %NT==:,,-1 ; TCP port states as seen by user + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out +DEFSYM %NTCLS==:0 ; - - Closed (reason available from WHYINT) +DEFSYM %NTLSN==:1 ; - - Listening for a SYN +DEFSYM %NTSYR==:2 ; - - SYN received +DEFSYM %NTCLU==:3 ; + ? Being closed by fgn host +DEFSYM %NTSYN==:4 ; - - SYN sent, waiting for response +DEFSYM %NTOPN==:5 ; *I *O Open +DEFSYM %NTWRT==:6 ; ? *O Output buffer full +DEFSYM %NTCLX==:7 ; ? + Being closed by user +DEFSYM %NTCLI==:10 ; +I ? Closing/closed, input still available +DEFSYM %NTINP==:11 ; *I ? Open, input available + + +DEFSYM %NC==:,-1 ; NCP (old ARPANET) CLOSE REASONS (IN IMSCLS) +DEFSYM %NCNTO==:0 ;NEVER OPENED +DEFSYM %NCUSR==:1 ;CLSED BY USER +DEFSYM %NCFRN==:2 ;CLSED BY FOREIGN HOST +DEFSYM %NCRST==:3 ;RST +DEFSYM %NCDED==:4 ;HOST DEAD +DEFSYM %NCINC==:5 ;INCOMPLETE TRANSMISSION +DEFSYM %NCBYT==:6 ;BYTE SIZE MISMATCH. +DEFSYM %NCNCP==:7 ;OUR NCP WENT DOWN. +DEFSYM %NCRFS==:10 ;REQUEST FOR CONNECTION REFUSED + +;;; .XC is being phased out for the name %NX instead. +;;; The .XC symbols will be flushed "soon". + +DEFSYM .XC==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note .XC and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM .XCNTO==:0 ; Never opened +DEFSYM .XCUSR==:1 ; Closed by user +DEFSYM .XCFRN==:2 ; Closed by foreign host +DEFSYM .XCRST==:3 ; Fgn host refused or aborted connection. +DEFSYM .XCDED==:4 ; Fgn host dead (not used yet) +DEFSYM .XCINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM .XCNCP==:7 ; Local TCP went down (not used yet) +DEFSYM .XCRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + +DEFSYM %NX==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note %NX and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM %NXNTO==:0 ; Never opened +DEFSYM %NXUSR==:1 ; Closed by user +DEFSYM %NXFRN==:2 ; Closed by foreign host +DEFSYM %NXRST==:3 ; Fgn host refused or aborted connection. +DEFSYM %NXDED==:4 ; Fgn host dead (not used yet) +DEFSYM %NXINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM %NXNCP==:7 ; Local TCP went down (not used yet) +DEFSYM %NXRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + + + +;;; BITS IN RESULT OF APRID (BLKI APR,) ON KL-10 AND KS-10 +DEFSYM %UC==:1,,525000 ;FOR BIT-TYPEOUT MODE +DEFSYM $UCOPT==:331100 ;MICROCODE OPTIONS: +DEFSYM %UCKLP==:400000 ; KL-10-STYLE PAGING +DEFSYM %UCITS==:20000 ; ITS-STYLE PAGING +DEFSYM %UCTRK==:1000 ; TRACKS FEATURE +DEFSYM $UCVRS==:221100 ;MICROCODE VERSION NUMBER +DEFSYM %UCVRS==:1 +DEFSYM %HW==:0,,527777 ;FOR BIT-TYPEOUT MODE +DEFSYM $HWOPT==:140600 ;HARDWARE OPTIONS +DEFSYM $HWSER==:001400 ;PROCESSOR SERIAL NUMBER + + +;;; .CALL ARGUMENT TYPES +DEFSYM %CL==:1,,400777 +DEFSYM %CLIN==:0 ;INPUT ARGUMENT +DEFSYM %CLIMM==:1000 ;IMMEDIATE ARGUMENT +DEFSYM %CLOUT==:2000 ;OUTPUT ARGUMENT +DEFSYM %CLERR==:3000 ;ERROR CODE OUTPUT ARGUMENT +DEFSYM %CLBTW==:4000 ;DIRECT CONTROL BITS +DEFSYM %CLBIT==:5000 ;IMMEDIATE CONTROL BITS + + +;;; CONTROL BITS FOR CORBLK SYSTEM CALL + +.SEE NCORBLK +DEFSYM %CB==:0,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %CBWRT==:400000 ;TRY FOR WRITE ACCESS, OK IF CAN'T GET IT +DEFSYM %CBRED==:200000 ;TRY FOR READ ACCESS, OK IF CAN'T GET IT +DEFSYM %CBNDW==:100000 ;NEED WRITE ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBPUB==:040000 ;MAKE PAGE PUBLIC, REQUIRES WRITE ACCESS +DEFSYM %CBPRV==:020000 ;MAKE PAGE PRIVATE, REQUIRES WRITE ACCESS +DEFSYM %CBNDR==:010000 ;NEED READ ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBCPY==:004000 ;MAKE A COPY (DISK FILES ONLY) +DEFSYM %CBLOK==:002000 ;LOCK PAGE IN CORE. +DEFSYM %CBULK==:001000 ;UNLOCK PAGE (ALLOW SWAP-OUT) +DEFSYM %CBSLO==:000400 ;MAY ONLY RESIDE IN SLOWEST MEMORY +DEFSYM %CBUSL==:000200 ;ALLOWS USE OF ANY MEMORY. + ;ABOVE BITS ALL ZERO MEANS DELETE PAGE FROM MAP + +;;; SPECIAL VALUES FOR SPECS + +DEFSYM %JS==:,,-1 +DEFSYM %JSELF==:,,-1 ;SELF (ALL SPECS) +DEFSYM %JSTVB==:,,-2 ;11TV BUFFER (CORBLK) +DEFSYM %JSNUL==:,,-3 ;NULL JOB (KLPERF) +DEFSYM %JSALL==:,,-4 ;ALL JOBS (KLPERF) +DEFSYM %JSNEW==:,,-5 ;FRESH PAGE (CORBLK) +DEFSYM %JSABS==:,,-6 ;ABSOLUTE CORE (CORBLK) +DEFSYM %JSNUM==:400000 ;THIS + JOB # => THAT JOB (ALL SPECS) +DEFSYM %JSSIX==:400376 ;PDP6 IS USER NUMBER 376 +DEFSYM %JSSUP==:400377 ;SUPERIOR (ALL SPECS) +;A SPEC MAY ALSO BE THE NUMBER OF A CHANNEL OPEN ON USR:, BOJ:, OR STY: + +;;; CONTROL BITS FOR ".REALT AC," UUO. +;;; FLAG BITS ARE IN LH(AC). + +.SEE AREALT +DEFSYM %RL==:1,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %RLFLS==:400000 ;FLUSH OLD TIMER +DEFSYM %RLSET==:200000 ;SET NEW CLOCK RATE +DEFSYM %RLUSR==:100000 ;TRY TO SEIZE REAL TIME USER FACILITY +DEFSYM %RLPSD==:020000 ;ONLY WANT PSEUDO REAL TIME +DEFSYM %RLNPS==:040000 ;CANNOT ACCEPT PSEUDO REAL TIME +DEFSYM %RLBLK==:010000 ;PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY + ; PHASE OR INTERRUPT LEVEL +DEFSYM %RLGET==:004000 ;GET PREVIOUS STATUS IN WORDS 3+4 + ;REMAINING BITS MUST BE ZERO + +;;; BITS OF .OPTION USER VARIABLE. + +.SEE OPTION +DEFSYM OPTTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM OPTDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM OPTCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM OPTBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM OPTDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM OPTINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM OPTOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM OPTLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM OPTLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM OPTOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM OPTLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM OPTLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; NEW NAMES FOR BITS IN LH(.OPTION) + +DEFSYM %OP==:525252(1) ;FOR BIT-TYPEOUT MODE +DEFSYM %OPTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM %OPDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM %OPCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM %OPBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM %OPDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM %OPINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM %OPOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM %OPLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM %OPLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM %OPOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM %OPLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM %OPLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; LOSING ERROR CODES + +DEFSYM %LS==:777400 ;RH OF .LOSE INSTRUCTION +DEFSYM %LSINT==:1 +DEFSYM %LSSYS==:1000 ;INTERPRET LAST OPEN LOSS CODE, USING .BCHN +DEFSYM %LSFIL==:1400 ; DO THAT AND PRINT FILE NAMES FROM CALL'S CHNL + +;;; FIRST RESULT OF .CALL WHYINT + +DEFSYM %WY==:,-1 +DEFSYM %WYTYI==:1 ;TTY INPUT +DEFSYM %WYTYO==:2 ;TTY OUTPUT +DEFSYM %WYSTI==:3 ;STY INPUT +DEFSYM %WYSTO==:4 ;STY OUTPUT +DEFSYM %WYNET==:5 ;ARPANET (NCP) +DEFSYM %WYCHA==:6 ;CHAOS NET +DEFSYM %WYTCP==:7 ;INTERNET (TCP) + +;I/O MODES FOR OPENS. + +DEFSYM .UAI==0 ;UNIT ASCII INPUT. +DEFSYM .UAO==1 ;UNIT ASCII OUTPUT. +DEFSYM .BAI==2 ;BLOCK ASCII INPUT. +DEFSYM .BAO==3 ;BLOCK ASCII OUTPUT. +DEFSYM .UII==4 ;UNIT IMAGE INPUT. +DEFSYM .UIO==5 ;UNIT IMAGE OUTPUT. +DEFSYM .BII==6 ;BLOCK IMAGE INPUT. +DEFSYM .BIO==7 ;BLOCK IMAGE OUTPUT. + +;OPEN BITS FOR DEVICE DSK: + +DEFSYM %DO==1,,525252 ;BIT TYPEOUT MASK +DEFSYM %DOOUT==1 +DEFSYM %DOBLK==2 +DEFSYM %DOIMG==4 +DEFSYM %DONRF==10 ;DON'T SET REFERENCE DATE. +DEFSYM %DONLK==20 ;DON'T CHASE LINKS. +DEFSYM %DORWT==40 ;ON OUTPUT OPEN, MAKES WOULD-BE READERS + ;WAIT TILL WE CLOSE. +DEFSYM %DOWOV==100000 ;WRITE OVER (USE WITH %DOOUT, TO OVERWRITE + ;EXISTING FILE). + +;ARGUMENT CODES FOR .BREAK 12,'S. +;..R AND ..S ARE BIT TYPEOUT MASKS, NOT MADE PREDEFINED TO MIDAS +;SINCE THEY ARE USEFUL ONLY IN DDT, WHICH DEFINES THEM ITSELF. + +..R==0 ;(FOR .SEE) +DEFSYM ..RSTART==1 ;READ STARTING ADDRESS +DEFSYM ..RLFILE==2 ;READ LOADED FILE'S NAMES +DEFSYM ..RSTP==3 ;READ SYMBOL TABLE POINTER +DEFSYM ..RSYM==4 ;READ VALUE OF SYMBOL. +DEFSYM ..RJCL==5 ;READ JOB COMMAND LINE. +DEFSYM ..RPFILE==6 ;READ :PRINT FILENAME DEFAULTS. +DEFSYM ..RSTB==7 ;READ WHOLE SYMBOL TABLE. +DEFSYM ..RCONV==10 ;READ NAME OF SYMBOL CLOSEST IN VALUE TO + ; ARGUMENT. +DEFSYM ..RLJB==13 ;READ IDX OF PREVIOUSLY CURRENT JOB. +DEFSYM ..RRND==14 ;READ RANDOM JOB-SPECIFIC BITS. +DEFSYM ..RPUR==15 ;UNPURIFY PAGE +DEFSYM ..RHSNAME==16 ;ASK SUPERIOR TO LOOKUP AN HSNAME FROM XUNAME +DEFSYM ..RMAIL==17 ;ASK A SUPERIOR TO LOOKUP USER'S MAIL FILE NAME + +..S==0 ;(FOR .SEE) +DEFSYM ..SSTART==400001 ;SET STARTING ADDRESS +DEFSYM ..SLFILE==400002 ;SET LOADED FILE'S NAMES +DEFSYM ..SSYM==400004 ;SET VALUE OF SYMBOL. +DEFSYM ..SJCL==400005 ;CLEAR JOB COMMAND LINE. +DEFSYM ..SPFILE==400006 ;SET :PRINT FILENAME DEFAULTS. +DEFSYM ..SSTB==400007 ;PASS WHOLE SYMBOL TABLE TO SUPERIOR. +DEFSYM ..SRND==400014 ;SET RANDOM JOB-SPECIFIC BITS. +DEFSYM ..SPUR==400015 ;SAME AS ..RPUR + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +DEFSYM %JG==:1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN + ; WD7 ON AN OPEN +DEFSYM %JGCLS==:40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +DEFSYM %JGSIO==:1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +DEFSYM %JGFPD==:200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +DEFSYM %JO==:,,-1 +DEFSYM %JOOPN==:0 ;OPEN +DEFSYM %JOIOT==:1 ;IOT/SIOT +DEFSYM %JOLNK==:2 ;MLINK +DEFSYM %JORST==:3 ;RESET +DEFSYM %JORCH==:4 ;RCHST +DEFSYM %JOACC==:5 ;ACCESS +DEFSYM %JORNM==:6 ;FDELE (DELETE OR RENAME) +DEFSYM %JORWO==:7 ;FDELE (RENAME WHILE OPEN) +DEFSYM %JOCAL==:10 ;SYMBOLIC .CALL + +;MODE BITS FOR TTY OPENS: +;3.1 0 -> IN 1 -> OUT +;3.2 0 -> UNIT 1 -> BLOCK + +;OUTPUT +;3.3 => IMAGE MODE (SET ALL %TGIMG BITS IN TTYST1 AND TTYST2) +;3.4 0 -> NORMAL 1 -> ECHO MODE OUTPUT (SET %TJECH, %TJPP2, %TJMOR). +;3.5 0 -> NORMAL 1 -> DISPLAYMODE, LOOK FOR ^P (SET %TJDIS). +;3.6 0 -> NORMAL 1 -> SUPER-IMAGE OUTPUT (SET %TJSIO). +;OUTPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR +;%TJCNS, %TJCP1, AND %TJCP2 + +;INPUT +;3.3 => IMAGE MODE (CLEAR ALL ECHO BITS IN TTYST1, TTYST2). +;3.4 => "DDT" (DON'T ECHO CR, LF, TAB) +;3.6 => WANT 3 LINES IN ECHO AREA. +;INPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR %TICNS. + +;BITS 3.4 AND 3.6 ON INPUT, AND BIT 3.3, HAVE EFFECT +;ONLY ON THE FIRST OPEN IN EITHER DIRECTION. +;(THEY ARE OBSOLETED BY THE TTYSET SYSTEM CALL) + +;BITS IN LH OF A TTY CHANNEL IOCHNM WORD +;THESE BITS MAY BE TEMPORARILY COMPLEMENTED BY SPECIFYING +;THEM IN THE CONTROL-BIT ARGUMENT TO A SYMBOLIC IOT +;(EXCEPT FOR %TICNS AND $TIIDX). +DEFSYM %TI==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TJ==:1,,525277 ;BIT TYPEOUT MASK + +DEFSYM %TICNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE +DEFSYM %TJCNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE + +;THE FOLLOWING INTERPRETATIONS OF BITS ARE FOR OUTPUT ONLY. +DEFSYM %TJCP1==:200000 ;^P-CODE ANTICIPATION STATE. +DEFSYM %TJCP2==:100000 ; ". 0=>NORMAL, 1=> CHAR AFTER ^P, 2=> ^PH, 3=>^PV. +DEFSYM %TJECH==:40000 ;SET => ECHO MODE OUTPUT.-MODE OUTPUT (ALL CHARS + ; OUTPUT THE WAY THEY WOULD BE ECHOED) +DEFSYM %TJCTN==:20000 ;SET => DON'T DO LINE-CONTINUATION. +DEFSYM %TJSTP==:10000 ;SET => THIS CHANNEL IS HUNG IN **MORE**. +DEFSYM %TJDIS==:4000 ;SET => LOOK FOR ^P CODES. +DEFSYM %TJSIO==:2000 ;SET => SUPERIMAGE OUTPUT, NO PADDING OR CURSOR CTL. +DEFSYM %TJMOR==:1000 ;SET => DON'T DO **MORE** PROCESSING. +DEFSYM %TJPP2==:400 ;SET => USE ALTERNATE PC PPR (THE ECHO AREA) +DEFSYM %TJINK==:200 ;SET => NEXT CHAR OUT TAKEN AS PRINTING + ; REGARDLESS (^PI) +DEFSYM %TJHDE==:100 ;SET => ACCOUTING FOR CURSOR MOTION DUE TO + ;CHAR ECHOED ON A HALF-DUPLEX TTY. + +;INPUT +DEFSYM %TIECH==:40000 ;CAN READ EVEN IF CHAR NEEDS PI ECHOING. +DEFSYM %TIPEK==:20000 ;DON'T REMOVE CHAR FROM BUFFER. +DEFSYM %TIACT==:4000 ;SET => DON'T WAIT FOR ACTIVATION CHARACTER. +DEFSYM %TIINT==:2000 ;SET => CAN READ A CHAR EVEN IF IT IS SUPPOSED TO + ; INTERRUPT & HASN'T YET. +DEFSYM %TINWT==:1000 ;SET => IF NO INPUT AVAILABLE, DON'T WAIT, JUST + ; RETURN -1. +DEFSYM %TIFUL==:400 ;SET => GIVE FULL CHARACTER (SIGNIFICANT ON IMLAX, TVS) + +DEFSYM $TIIDX==:220600 ;3.6-3.1 CONSOLE #, OR 77 FOR A "DISOWNED" CONSOLE + ; TTY CHNL, IE, ONE THAT CORRESPONDS TO NO REAL TTY. + ; THEY EXIST ONLY IN TREES WITH NO TTY, IN JOBS + ; THAT CAME FROM TREES WITH TTYS. +DEFSYM %TIIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TJIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TINON==:77 ;"TTY #" FOR A CHANNEL WITH NO REAL TTY. + +;EACH CHARACTER IN THE INPUT BUFFER OCCUPIES 18 BITS +;THE UPPER BITS ARE AS FOLLOWS (NOTE THAT AN IOTTED +;CHARACTER MAY ACTUALLY CONTAIN %TXPIE, %TXMPE, %TXECI, OR %TXINT) +DEFSYM %TX==:525200 ;BIT TYPEOUT MASK +DEFSYM %TXMPE==:400000 ;MAIN PROGRAM ECHO CHARACTER +DEFSYM %TXPIE==:200000 ;PI ECHO CHARACTER +; DEFSYM %TXCOM==:100000 ;COM MODE ECHO CHAR; DO PI ECHO EVEN IF HDX +; ; TTY. +; DEFSYM %TXIGN==:40000 ;IGNORE THIS CHAR AT .IOT TIME. +; DEFSYM %TXACT==:20000 ;THIS IS AN ACTIVATION CHAR. +; THESE CAN'T BE NEEDED EXCEPT INSIDE THE SYSTEM. +DEFSYM %TXINT==:10000 ;THIS CHAR SHOULD INTERRUPT THE USER. +;GAP +DEFSYM %TXECI==:2000 ;THIS CHAR WAS ECHOED BY AN ECHOIN SYSTEM CALL. + +;NOW COME THE BITS OF THE CHARACTER ITSELF: +DEFSYM %TXTOP==:4000 ;The "TOP" key. +;GAP +DEFSYM %TXSFT==:1000 ;What used to be the "SHIFT" key is now the +DEFSYM %TXSUP==:1000 ;"SUPER" key. (def'ed in this order for DDT) +DEFSYM %TXMTA==:400 ;"META" key. +DEFSYM %TXCTL==:200 ;"CONTROL" key. +DEFSYM %TXASC==:177 ;The ASCII part of the character. + +;DISPLAY COMMANDS (WHICH LIVE IN THE OUTPUT BUFFER). +;NOTE THAT ALL OF THEM HAVE 200-BIT SET. +DEFSYM %TD==:777400 +DEFSYM %TDMOV==:200 ;MOVE CURSOR +DEFSYM %TDMV1==:201 ;DUMMY COMMAND CREATED BY TYMOV. + ;MAKES IT POSSIBLE FOR TYMOV TO STOP WHEN BUFFER FULL + ;AND BE REENTERED NEXT INTERRUPT. +DEFSYM %TDEOF==:202 ;CLEAR REST OF PAGE +DEFSYM %TDEOL==:203 ;CLEAR REST OF LINE +DEFSYM %TDDLF==:204 ;DELETE FORWARD (FOR IMLACS AND TVS) +DEFSYM %TDMTF==:205 ;MOTOR OFF (FOR TERMINETS) +DEFSYM %TDMTN==:206 ;MOTOR ON (FOR TERMINETS) +DEFSYM %TDCRL==:207 ;CRLF ON DATAPOINTS, IMLACS. +DEFSYM %TDNOP==:210 ;NO-OP FOR SUPERDUPERIMAGE MODE. +DEFSYM %TDBS==:211 ;BACKSPACE (FOR TTY'S WITH %TORAW SET). +DEFSYM %TDLF==:212 ;LINEFEED ("). +DEFSYM %TDRCR==:213 ;CARRET ("). +DEFSYM %TDORS==:214 ;"OUTPUT RESET" FOR SAKE OF SOFTWARE TTYS +DEFSYM %TDQOT==:215 ;MYSTERY COMMAND -- SEND IN A JINGLE IN 25 WORDS OR + ; LESS AND WIN +DEFSYM %TDFS==:216 ;CURSOR FORWARD ONE COLUMN +DEFSYM %TDMV0==:217 ;MOVE CURSOR, FOLLOWED BY NEW VERT POS, NEW HOR POS +DEFSYM %TDCLR==:220 ;CLEAR THE SCREEN +DEFSYM %TDBEL==:221 ;DING THE BELL +DEFSYM %TDINI==:222 ;SYSTEM JUST CAME UP, RE-INITIALIZE INTELLIGENT + ; TERMINAL +DEFSYM %TDILP==:223 ;INSERT LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDDLP==:224 ;DELETE LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDICP==:225 ;INSERT CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDDCP==:226 ;DELETE CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDBOW==:227 ;ENTER BLACK ON WHITE MODE +DEFSYM %TDRST==:230 ;DESELECT ALL SPECIAL MODES (SUCH AS BLACK-ON-WHITE). +DEFSYM %TDGRF==:231 ;ENTER GRAPHICS MODE +DEFSYM %TDRSU==:232 ;REGION SCROLL UP +DEFSYM %TDRSD==:233 ;REGION SCROLL DOWN + +; Apparently codes 234 - 237 are used for an undocumented kludge for +; sending ARDS graphics protocol. See SYSENG;IMPRIN (the source of +; :ARDPRN). + +;%TDSYN THROUGH %TDMLT ARE USED ONLY ON TERMINALS WHICH HAVE %TRLED SET IN +; TTYSMT. +DEFSYM %TDSYN==:240 ;RESYNCH REPLY TO LOCAL EDITING TERMINAL +DEFSYM %TDECO==:241 ;ASK TERMINAL TO TRY LOCAL EDITING BY SENDING A + ; RESYNCH. +DEFSYM %TDEDF==:242 ;SET LOCAL EDITING TERMINAL COMMAND DEFINITION. + ; FOLLOWED BY TWO BYTES, DECODED AS DESCRIBED IN + ; LOCAL EDITING PROTOCOL. +DEFSYM %TDNLE==:243 ;STOP DOING LOCAL EDITING. +DEFSYM %TDTSP==:244 ;DISPLAYS LIKE SPACE, BUT IS PART OF A TAB. USED + ; ONLY FOR LOCAL EDITING TERMINALS, TO ENABLE THEM + ; DISTINGUISH SPACES FROM TABS. +DEFSYM %TDCTB==:245 ;THIS LINE IS CONTINUED AT THE BEGINNING. +DEFSYM %TDCTE==:246 ;THIS LINE IS CONTINUED AT THE END. +DEFSYM %TDMLT==:247 ;%TDMLT => NEXT COLS ARE DISPLAY REP FOR + ; ONE CHAR OF TEXT. +;%TDSVL THROUGH %TDSLL ARE USED ON TERMINALS WHICH HAVE NONZERO %TRLSV. +DEFSYM %TDSVL==:250 ; => SAVE LINES' CONTENTS UNDER + ; LABELS STARTING WITH *200+. +DEFSYM %TDRSL==:251 ;SAME THREE ARGS. RESTORE LABELED CONTENTS ONTO + ; LINES. +DEFSYM %TDSSR==:252 ; SET RANGE OF COLUMNS TO COPY IN + ; %TDSVL, %TDRSL. +DEFSYM %TDSLL==:253 ; SET LABEL FOR NEXT LINE PUSHED OFF + ; SCREEN LOCALLY. +DEFSYM %TDMAX==:254 ;1 + LARGEST DISPLAY CODE. + +;THE TCTYP WORD FOR A TTY CONTAINS A NUMBER WHICH SAYS HOW TO +;PERFORM CURSOR-CONTROL FUNCTIONS ON THE TTY. THE POSSIBILITIES ARE: +DEFSYM %TN==:777777 +DEFSYM %TNPRT==:0 ;PRINTING TTY. +DEFSYM %TNDP==:1 ;TTY USES DATAPOINT CURSOR CTL CODES. +DEFSYM %TNODP==:2 ;TTY IS A LOSING DATAPOINT. +DEFSYM %TNIML==:3 ;TTY USES IMLAC CURSOR CODES. +DEFSYM %TNTEK==:4 ;TEKTRONIX 4000 SERIES +DEFSYM %TNTV==:5 ;TTY IS A KNIGHT TV DISPLAY. +DEFSYM %TNMEM==:6 ;TTY IS A MEMOWRECK. +DEFSYM %TNSFW==:7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. +DEFSYM %TNTRM==:10 ;TTY IS A TERMINET. +DEFSYM %TNESC==:11 ;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52) +DEFSYM %TNDTM==:12 ;DATAMEDIA +DEFSYM %TNRAY==:13 ;TELERAY 1061 +DEFSYM %TNHDS==:14 ;HDS CONCEPT-100 +DEFSYM %TNH19==:15 ;H19 +DEFSYM %TNAAA==:16 ;Ann Arbor Ambassador +DEFSYM %TNMAX==:17 + + +;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR +;TERMINAL ATTACHED TO EACH LINE. + +;LEFT HALF BITS ARE: +DEFSYM %TO==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TOALT==:200000 ;4.8 => STANDARDIZE ALTMODES. +DEFSYM %TOCLC==:100000 ;4.7 => CONVERT LOWER CASE TO UPPER. +DEFSYM %TOERS==:40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. +DEFSYM %TOHDX==:20000 ;4.5 => THIS TTY IS HALF-DUPLEX. +DEFSYM $TOHDX==:370100 +DEFSYM %TOMVB==:10000 ;4.4 => THIS TTY CAN BACKSPACE. +DEFSYM %TOSAI==:4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. +DEFSYM %TOSA1==:2000 ;4.2 INIT %TSSAI OF NEW JOBS. +DEFSYM %TOOVR==:1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. +DEFSYM %TOMVU==:400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A + ; DISPLAY). +DEFSYM %TOMOR==:200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY + ; (ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). +DEFSYM %TOROL==:100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. +DEFSYM %TORAW==:40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. +DEFSYM %TOLWR==:20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. +DEFSYM %TOFCI==:10 ;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET +DEFSYM %TOIML==:4 ;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC + ; SENDS ^L. +DEFSYM %TOLID==:2 ;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES) +DEFSYM %TOCID==:1 ;3.1 => %TDICP, %TDDCP WORK + ; (INSERT AND DELETE CHARACTERS) + +;RIGHT HALF: +DEFSYM %TP==:707252 ;BIT TYPEOUT MASK +DEFSYM %TPPLF==:100000 +DEFSYM $TPPLF==:170300 ;3-BIT FIELD SAYING HOW TO PAD LF. + ; 0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. +DEFSYM %TPPCR==:10000 +DEFSYM $TPPCR==:140300 ;3-BIT FIELD SAYING HOW TO PAD CR. + ; 7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. + ; 0 - DON'T. 1 - NORMAL. 2 - DOUBLE. + ; ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL + ; CURSOR MOTION. + ; 4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. + ; ON TERMINETS, 0 => NO PADDING, ELSE 1,2,3,4,5 + ; ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS. +DEFSYM %TPPCW==:6 ;FOR MEMO WRECK. +DEFSYM %TPPTB==:1000 +DEFSYM $TPPTB==:110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER + ; TAB. 0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING + ; CHARS NEEDED> BUT ON A DISPLAY, TABS ARE NEVER + ; PADDED AND THIS FIELD IS 1 TO USE TABS, 2 TO USE + ; ABSOLUTE CURSOR POSITIONING, 3 TO USE BOTH, 0 TO + ; USE NEITHER. +DEFSYM %TPMTA==:400 ;1.9 => HARDWARE META KEY SETS 8TH BIT +DEFSYM %TPPRN==:200 ;1.8 => INTERCHANGE () WITH [] ON INPUT +DEFSYM %TPTEL==:100 ;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET + ; PROTOCOL +DEFSYM %TPCBS==:40 ;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK + ; SLASH ON INPUT (THE "INTELLIGENT TERMINAL + ; PROTOCOL"). +DEFSYM %TP11T==:20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. NOT + ; SETTABLE BY USER. +DEFSYM %TPORS==:10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO + ; SOMETHING. +DEFSYM %TPRSC==:4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD + +;DEFINE BITS WHICH ARE USER-OPTIONS +DEFSYM %TOUSR==:%TOCLC+%TOSA1+%TOMOR+%TOROL +DEFSYM %TPUSR==:%TPPRN+1 ;THE 1 IS TO AVOID INTEFERING WITH BIT-TYPE-OUT + +DEFSYM %TQ==1,,701725 ;TTY "SMARTS" BITS IN LH(TTYSMT) +DEFSYM %TQIM1==300000 ;TTY IS A PDS1 +DEFSYM %TQIM4==200000 ;TTY IS A PDS4 +DEFSYM %TQP11==100000 ;TTY IS A PDP11 +DEFSYM %TQMCH==700000 ;4.7-4.9 MACHINE TYPE, 0 => NOTHING SPECIAL +DEFSYM %TQGRF==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL +DEFSYM %TQGPH==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL (OBSOLETE NAME) +DEFSYM %TQSET==2 ;3.2 HAS MULTIPLE OBJECT SETS +DEFSYM %TQREC==4 ;3.3 HAS RECTANGLE COMMANDS +DEFSYM %TQXOR==10 ;3.4 HAS XOR MODE +DEFSYM %TQBNK==20 ;3.5 HAS BLINKING +DEFSYM %TQVIR==40 ;3.6 VIRTUAL COORDINATES +DEFSYM %TQHGT==76000 ;4.2-4.6 CHARACTER HEIGHT IN DOTS +DEFSYM %TQWID==1700 ;3.7-4.1 CHARACTER WIDTH IN DOTS + +DEFSYM %TR==534052 ;RH(TTYSMT) +DEFSYM %TRGIN==400000 ;2.9 HAS GRAPHIC INPUT +DEFSYM %TRGHC==200000 ;2.8 HAS GRAPHIC HARDCOPY +DEFSYM %TRLED==100000 ;2.7 HAS LOCAL EDITING PROTOCOL. +DEFSYM %TRSCN==040000 ;2.6 HAS RASTER COMMANDS +DEFSYM %TRLSV==034000 ;2.3-2.5 NONZERO MEANS TERMINAL SUPPORTS 4**N SAVED + ; LINES. +DEFSYM %TRTIM==003700 +DEFSYM $TRTIM==060500 ;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT + ; MINUS #o20; A VALUE OF ZERO MEANS DON'T KNOW, + ; DON'T CARE, OR USER PROGRAM HASN'T IMPLEMENTED IT + ; YET + +;GROUP NUMBER CHARACTERS +;[ 0 ^A-^F ^K-^L ^N-^R ^T-^Z ^] ^^ ^_ ^@ ^\ +; 1 A-Z LOWER CASE A-Z +; 2 0-9 +; 3 !"#$(DOLLAR)%&',.:;?@\ (ACCENT GRAVE) +; (VERTICAL BAR) (TILDE) +; 4 *+-/=^_ +; 5 <>[]() (LEFT BRACE) (RIGHT BRACE) +; 6 ^G ^S +; 7 LF ^I(TAB) +; 10 (ALTMODE) +; 11 CR +; 12 RUBOUT +; 13 SPACE ^H(BACKSPACE) + +;TTYST1 HAS GROUPS 0 THROUGH 5 FROM LEFT TO RIGHT +;TTYST2 HAS 6 THROUGH 13 +;EACH GROUP HAS SIX BITS AS FOLLOWS: +DEFSYM %TG==:777725 ;BIT TYPEOUT MASK +DEFSYM %TGINT==:1 ;N.1 => INTERRUPT ON THIS GROUP +DEFSYM %TGACT==:2 ;N.2 => ACTIVATE ON THIS GROUP (FOR SWAPPING) +DEFSYM %TGSPC==:4 ;N.3 => SPECIAL HACKS. + ; (THIS SET ON GROUP 1 => CONVERT LOWER CASE) +DEFSYM %TGIMG==:10 ;N.4 => IMAGE MODE OUTPUT (N.4=0 => ASCII MODE) + ;N.6-N.5 => ECHO MODE + ; 00 => NO ECHO +DEFSYM %TGPIE==:20 ; 01 => PI ECHO (ECHO CHARACTER WHEN TYPED) +DEFSYM %TGMPE==:40 ; 10 => MAIN PROGRAM ECHO (ECHO WHEN MAIN + ; PROGRAM RECEIVES CHARACTER) + +;TTYSTS HAS RANDOM BITS ASSOCIATED WITH THE TELETYPE +DEFSYM %TS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TSFRE==:400000 ;4.9 => TTY FREE +DEFSYM %TSCLE==:200000 ;4.8 => ECHO ^L AS UPARROW-L EVEN ON DISPLAYS + ;(OTHERWISE WOULD ECHO AS CLEAR SCREEN) +DEFSYM %TSHDX==:100000 ;4.7 REFLECTS %TOHDX BIT. +DEFSYM %TSFCO==:040000 ;4.6 => HANDLE 9-BIT CHARS ON OUTPUT, USING ALPHA, + ; BETA, EPSILON. +DEFSYM %TSALT==:020000 ;4.5 => DON'T STANDARDIZE ALTMODE. +DEFSYM %TSROL==:010000 ;4.4 => SCROLL MODE. +DEFSYM %TSSAI==:004000 ;4.3 => ECHO AND ASCII MODE SHOULD USE SAIL CHAR SET. +DEFSYM %TSACT==:002000 ;4.2 => GOBBLE NEXT CHAR REGARDLESS OF ACTIVATION + ; STATUS +DEFSYM %TSNEA==:001000 ;4.1 => DON'T ECHO IN ECHO AREA; ECHO IN M.P. AREA +DEFSYM %TSINT==:000400 ;3.9 => INT ON NEXT CHAR REGARDLESS +DEFSYM %TSMOR==:000200 ;3.8 => INHIBIT **MORE**. +DEFSYM %TSATY==:000100 ;3.7 SET BY .ATTY, SAYS TTY WAS TAKEN AWAY & RETURNED. + ;3.6-3.5 UNUSED. +DEFSYM %TSNOE==:000010 ;3.4 => DEFER ECHOING, AND MAKE INPUT IOT'S ACT AS + ; IF %TIECH=1. +DEFSYM %TSLCZ==:000004 ;3.3 => LAST CHARACTER TYPED WAS ^Z + ; (NOT PRECEEDED BY ^_) +DEFSYM %TSSII==:000002 ;3.2 => SUPER IMAGE INPUT MODE. ^Z AND ^_ INHIBITED. +DEFSYM %TSCNS==:000001 ;3.1 => TTY IN USE AS CONSOLE CONTROLLING A TREE. +DEFSYM $TSCNS==:220100 + ;RH => USER INDEX + ; -1 => NO USER + +;TTYCOM VARIABLE. +;4.9 => TTY IN COMMUNICATE MODE +DEFSYM %TC==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TCLFT==:200000 ;4.8 => LOCAL FEED THROUGH (SET IF MY PRGM + ; RECEIVING HIS CHRS) +DEFSYM %TCRFT==:100000 ;4.7 => REMOTE FEED THROUGH (SET IF HIS PRGM + ; RECEIVING MY CHRS) +DEFSYM %TCICO==:40000 ;4.6 => INPUT COMMUNICATE OVERRIDE (SET IF MY + ; CONSOLE FEEDING MY PRGM EVEN THO IN COMM MODE). + ; ALSO IMPLIES OUTPUT OVER-RIDE +DEFSYM %TCOCO==:20000 ;4.5 => OUTPUT COMMUNICATE OVERRIDE (SET IF MY + ; PRGM'S OUTPUT TO APPEAR ON MY CONSOLE ONLY EVEN + ; THO IN COM MODE) + ;4.4-4.3 => MESSAGE RECEIPT SWITCH + ; 00 => ACCEPT +DEFSYM %TCRFS==:10000 ; 10 => REFUSE +DEFSYM %TCQRY==:4000 ; 01 => INTERROGATE +DEFSYM %TCMTR==:2000 ;4.2 SET FOR TTY WHOSE MOTOR IS OFF & MUST BE + ; TURNED ON BEFORE ANY OTHER OUTPUT IS DONE. (ONLY + ; TERMINETS HAVE THEIR MOTORS SHUT OFF BY ITS). +DEFSYM %TCECH==:1000 ;4.1 THE OUTPUT BUFFER CONTAINS ECHOING OUTPUT. + ; THIS MAKES OUTPUT RESET DO NOTHING. THE BUFFER + ; MUST NOT CONTAIN ECHO OUTPUT AND NORMAL OUTPUT AT + ; ONE TIME. +DEFSYM %TCLED==:400 ;3.9 JOB WHICH OWNS TTY WANTS LOCAL EDITING IN + ; TERMINAL. SET BY CTL BIT 1.1 IN SCPOS; CLEARED + ; BY SWITCHING JOBS. +DEFSYM %TCDET==:200 ;3.8 CONSOLE'S TREE DETACHED BY TOP LEVEL + ; INTERRUPT. SET BY NDETAC AS SIGNAL TO SYSCFM + ; (CNSL-FREE-MSG TYPER) +DEFSYM %TCDNG==:100 ;3.7 => TYPE BELL ON TTY (BECAUSE INPUT BFR FULL). +DEFSYM %TCCBK==:40 ;3.6 => READING UNAME OR TTY # AFTER ^_K. +DEFSYM %TCCBS==:20 ;3.5 => READING UNAME OR TTY # AFTER ^_S. +DEFSYM %TCFPD==:10 ;3.4 => FIRST PART OF MULTI-CHAR OUTPUT SEQUENCE DONE. +DEFSYM %TCTPN==:4 ;3.3 TYPE ^_N ON LEAVING COM MODE (UNLESS USER + ; EXPLICITLY TYPES ^_N) +DEFSYM %TCPAD==:2 ;3.2 0 => PADDING NECESSARY ON DATAPOINT. +DEFSYM %TCHNG==:1 ;3.1 TTY'S DONE FLAG APPEARS TO BE FRIED, TIME OUT + ; QUICKLY +;RH => USER INDEX COMMUNICATING WITH (-1 NONE) + +;TTYTYP TABLE +;THIS TABLE HOLDS BITS THAT DESCRIBE THE LINE +;AND ITS CONTROLLER, RATHER THAN THE TTY ATTACHED TO THE LINE. +DEFSYM %TT==:1,,525360 ;BIT TYPEOUT MASK +DEFSYM %TTLCL==:400000 ;BIT 4.9 ONE => LOCAL TTY +DEFSYM %TT340==:200000 ;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE +DEFSYM %TT3HP==:100000 ;BIT 4.7 HIGH PRIORITY ON 340 +DEFSYM %TTPAR==:004000 ;BIT 4.3 +DEFSYM %TTDDI==:002000 ;BIT 4.2 DONT DING ON EXCESS INPUT +DEFSYM $TTISP==:260400 ;3.8-3.5 INPUT SPEED CODE +DEFSYM %TTISP==:20 +DEFSYM $TTOSP==:220400 ;3.4-3.1 OUTPUT SPEED CODE +DEFSYM %TTOSP==:1 +;RIGHT HALF BITS +DEFSYM %TY==:525252 ;BIT TYPEOUT MASK +DEFSYM %TYDPK==:400000 ;BIT 2.9 (DATAPOINT KLUDGE TTY LINE) +DEFSYM %TYSTY==:200000 ;BIT 2.8 PSEUDO TTY +DEFSYM %TYNVA==:100000 ;BIT 2.7 NOVA TTY +DEFSYM %TYMTY==:040000 ;BIT 2.6 MORTON BOX +DEFSYM %TYDIL==:020000 ;BIT 2.5 DIAL UP +DEFSYM %TY11T==:010000 ;BIT 2.4 PDP-11 TV TTY. +DEFSYM %TYDL==:004000 ;BIT 2.3 DL-11 TTY +DEFSYM %TYOTY==:002000 ;BIT 2.2 KA-10 CONSOLE TTY +DEFSYM %TYETY==:001000 ;BIT 2.1 DTE20 TTY +DEFSYM %TYNTY==:000400 ;BIT 1.9 TK-10 TTY +DEFSYM %TYMDM==:000200 ;BIT 1.8 LINE DETECTS DIALINS AND HANGUPS +DEFSYM %TYKST==:000100 ;BIT 1.7 KS-10 CONSOLE TTY +DEFSYM %TYDZT==:000040 ;BIT 1.6 DZ-11 TTY ON KS-10 +DEFSYM %TYRLM==:000020 ;BIT 1.5 ROLM DATA SWITCH + +;SPEED CODES ARE DOCUMENTED ON PAGE 3 OF ITS (DEFINE SPEED1) + +;SUPDUP GRAPHICS PROTOCOL COMMANDS: + +DEFSYM %GO==:,,-1 + +DEFSYM %GODLR==:101 ;

Draw line relative, from the cursor to

. +DEFSYM %GODPR==:102 ;

Draw point relative, at

. +DEFSYM %GODRR==:103 ;

Draw rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GODCH==:104 ; <0> + ;Display the chars of starting at the current + ;graphics cursor position. +DEFSYM %GODSC==:105 ; Draws scan bits starting at + ;the current gaphics cursor position. come + ;in bits of 6-6-4. has 100 bit (character + ;gobbled) or 200 bit (interpreted as %TD code) set. +DEFSYM %GODRN==:106 ; <0> Draw run length encoded raster line + ;starting at current graphic cursor. Low six bits are + ;count. 100 bit determines point type (on/off). + +DEFSYM %GODLA==:121 ;

Draw line absolute, from the cursor to

. + ; The same effect as %GODLR, but the arg absolute. +DEFSYM %GODPA==:122 ;

Draw point absolute, at

. +DEFSYM %GODRA==:123 ;

Draw rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOELR==:141 ;

Erase line relative, from the cursor to

. +DEFSYM %GOEPR==:142 ;

Erase point relative, at

. +DEFSYM %GOERR==:143 ;

Erase rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GOECH==:144 ; <0> + ;Erase the chars of starting at the current + ;graphics cursor position. +DEFSYM %GOESC==:145 ; . Erase scan bits starting at + ;the current graphics cursor position. +DEFSYM %GOERN==:146 ; <0> Erase run-length encoded rasters + ;starting at current grphaics cursor position. + +DEFSYM %GOELA==:161 ;

Erase line absolute, from the cursor to

. +DEFSYM %GOEPA==:162 ;

Erase point absolute, at

. +DEFSYM %GOERA==:163 ;

Erase rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOMVR==:001 ;

Move cursor to point

+DEFSYM %GOMVA==:021 ;

Move cursor to point

, absolute address. +DEFSYM %GOXOR==:002 ; Turn on XOR mode. Bit matrix terminals only. +DEFSYM %GOIOR==:022 ; Turn off XOR mode. +DEFSYM %GOSET==:003 ; Select set. is a 1-character set number, + ; 0 - 177. +DEFSYM %GOMSR==:004 ;

Move set origin to

. Display list + ; terminals only. +DEFSYM %GOMSA==:024 ;

Move set origin to

, absolute address. +DEFSYM %GOINV==:006 ; Make current set invisible. +DEFSYM %GOVIS==:026 ; Make current set visible. +DEFSYM %GOBNK==:007 ; Make current set blink. Canceled by %GOINV + ; or %GOVIS. +DEFSYM %GOCLR==:010 ; Erase whole screen. +DEFSYM %GOCLS==:030 ; Erase entire current set (display list + ; terminals). +DEFSYM %GOPSH==:011 ; Push all input-stream status information, to be + ; restored when graphics mode is exited. +DEFSYM %GOVIR==:012 ; Start using virtual co-ordinates +DEFSYM %GOPHY==:032 ; Resume giving co-ordinates in units of dots. +DEFSYM %GOHRD==:013 ; Divert output to output subdevice . + ; =0 reselects the main display screen. +DEFSYM %GOGIN==:014 ; Request graphics input (mouse, tablet, etc). + ; is the reply code to include in the answer. +DEFSYM %GOLMT==:015 ; + ;Limits graphics to a subrectangle of the + ;screen. %GOCLR will clear only that area. + ;This is for those who would use the rest for text. + +;THE TTYTBL VARIABLE EXISTS FOR EACH JOB. +;IT DESCRIBES THE ATTY-DTTY STATE OF THE JOB +;AND OTHER THINGS THAT HAVE TO DO WITH THE TREE'S +;CONTROLLING TTY ONLY. +DEFSYM %TB==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TBNOT==:400000 ;4.9 THIS JOB DOES NOT HAVE THE TTY NOW. +DEFSYM %TBNVR==:200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +DEFSYM %TBINT==:100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY + ; SHOULD INTERRUPT. +DEFSYM %TBWAT==:040000 ;4.6 IF SET, OVERRIDES %TBINT AND %TBNVR, AND + ; FORCES TTY USAGE ATTEMPTS TO HANG. MAY BE ALTERED + ; ONLY BY SUPERIOR. +DEFSYM %TBDTY==:010000 ;4.4 THE JOB DOESN'T HAVE THE TTY, BUT IT IS IN A + ; DTTY'ING STATE. IN OTHER WORDS, THIS JOB DOESN'T + ; WANT TO GIVE THE TTY TO ONE OF ITS INFERIORS. +DEFSYM %TBOUT==:004000 ;4.3 ALLOW TYPEOUT EVEN IF DON'T HAVE TTY (SETTABLE + ; BY SUPERIOR) +DEFSYM %TBINF==:002000 ;4.2 ALLOW INFERIORS TO TAKE ADVANTAGE OF THEIR + ; %TBOUTS. +DEFSYM %TBOIG==:001000 ;4.1 IGNORE OUTPUT (NORMALLY SET BY SUPERIOR). + ; OVERRIDES %TBWAT, %TBINT. +DEFSYM %TBIIN==:000400 ;3.9 INTERRUPT ON ATTEMPT TO DO INPUT. OVERRIDES + ; %TBWAT. NORMALLY SET BY SUPERIOR. +DEFSYM $TBECL==:220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY +DEFSYM %TBECL==:77 + +;RH - IF %TBNOT IS 0, THE RH HAS THE TTY NUMBER. +;OTHERWISE, IF %TBDTY IS 0, THE RH HAS THE USR INDEX OF +;THE INFERIOR THAT THIS JOB GAVE OR WOULD LIKE TO GIVE +;THE TTY TO. OTHERWISE, THE RH IS 0. + +;BITS IN THE PER-STY VARIABLE STYSTS, RETURNED BY STYGET SYSTEM CALL. +DEFSYM %SS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %SSHNG==:400000 ;4.9 = 1 => DON'T HANG ON INPUT IOTS +DEFSYM %SSUSE==:200000 ;4.8 = 1 => IN USE +DEFSYM %SSINT==:100000 ;4.7 = 1 => HAVE GIVEN INT ON STY OUTPUT + ; CHNS ALREADY +DEFSYM %SSONT==:040000 ;4.6 = 1 => DITTO FOR STY INPUT (TTY OUTPUT) +DEFSYM %SSOHG==:20000 ;4.5 = 1 => DON'T HANG ON OUTPUT IOT + ;RH = USER INDEX THAT HAS IT OPEN + + +IFN $$TEMP, EXPUNGE DEFSYM diff --git a/system/bits.117 b/system/bits.117 new file mode 100644 index 0000000..b986182 --- /dev/null +++ b/system/bits.117 @@ -0,0 +1,1127 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;;; ITS BITS THAT ARE OFTEN NEEDED + +.AUXIL + +;;; CATALOGUE OF RESERVED BIT NAME AND CONSTANT PREFIXES IN ITS + +.SEE %CA ;BITS IN CLRAC FOR CORE LINK DEVICE +.SEE %CB ;BITS FOR CORBLK SYMBOLIC SYSTEM CALL +.SEE %CL ;.CALL ARGUMENT TYPES. +.SEE %CLS ;BITS IN LH OF CLSTB ENTRY +.SEE %DC ;DTE20 IOELEVEN COMMANDS +.SEE %DF ;T-300 FAULT (DSCFLT) +.SEE %DM ;T-300 COMMAND (DSCCMD) +.SEE %DO ;DSK OPEN MODE BITS +.SEE %DP ;DATAPOINT CURSOR CONTROL CONSTANTS +.SEE %DS ;T-300 STATUS (DSCSTS) +.SEE %DT ;DTE20 COMMANDS BITS AND CONSTANTS +.SEE %DV ;BITS IN DEVTAB +.SEE %E ;.CALL AND OPEN ERROR CODES +.SEE %GO ;SUPDUP GRAPHICS PROTOCOL COMMANDS +.SEE %H1 ;RP04 (RH10/RH11) ERROR REGISTER 1 +.SEE %H3 ;RP04 (RH10/RH11) ERROR REGISTER 3 +.SEE %HA ;RP04 (RH10/RH11) ADDRESS REGISTER +.SEE %HC ;RP04 (RH10) CONTROL REGISTER +.SEE %HD ;RH10 ERROR BITS IN DRIVE REGISTERS +.SEE %HI ;RH10 CONI BITS +.SEE %HM ;RP04 (RH10/RH11) COMMAND CONSTANTS +.SEE %HO ;RH10 CONO BITS +.SEE %HR ;RH10 CONTROLLER AND RP04 DRIVE REGISTER NUMBERS + ; OR RH11 UNIBUS REGISTER ADDRESSES +.SEE %HS ;RP04 (RH10/RH11) STATUS REGISTER BITS +.SEE %HW ;FOR KL AND KS, BITS IN RH OF RESULT OF APRID +.SEE %HX ;RH11 BITS IN %HRCS1 +.SEE %HY ;RH11 BITS IN %HRCS2 +.SEE %IL ;Interlan NI1010 bits and constants +.SEE %IOT ;BITS IN IOTTB +.SEE %IR ;BITS IN IP ROUTE ENTRY FLAGS +.SEE %JB ;BITS IN JBWST VARIABLE +.SEE %JG ;BITS IN JOBGET FIRST VALUE +.SEE %JO ;OPCODES IN JOBGET FIRST VALUE +.SEE %JS ;SPECIAL VALUES FOR SPECS +.SEE %KE ;BITS IN KS10 MEMORY STATUS REGISTER (KSECCS) +.SEE %LH ;BITS AND CONSTANTS FOR ACC LH/DH IMP INTERFACE (KS10) +.SEE %MA ;BITS IN MSRAC (MAGTAPE STATUS TABLE) +.SEE %NC ;NETWORK SOCKET CLOSE REASONS +.SEE %NE ;ETHERNET - constants and bits (%EN taken..) +.SEE %NO ;INTERNET - bits for TCPOPN system call +.SEE %NS ;NETWORK SOCKET STATES +.SEE %NT ;INTERNET - TCP channel states (almost = to %NS. See also %NX) +.SEE %NX ;INTERNET - TCP connection close reasons (almost = to %NC) +.SEE %OP ;BITS IN LH OF .OPTION USER VARIABLE +.SEE %PC ;KA10 PC FLAGS +.SEE %PF ;KL10 AND KS10 PAGE FAIL WORD BITS (DEFINITIONS DIFFER + ; BETWEEN MACHINES) +.SEE %PI ;BITS IN PIRQC USER VARIABLE +.SEE %PJ ;BITS IN LH OF PIRQC USER VARIABLE +.SEE %PS ;KL10 AND KS10 PC FLAGS +.SEE %QA ;BITS IN QSRAC (DISK STATUS TABLE) +.SEE %QM ;DISK ACTION MODES IN RH OF QSRAC +.SEE %RL ;BITS FOR COMMANDS TO .REALT UUO +.SEE %SCV ;BITS IN SYSCVL TO CONTROL SYMBOLIC SYSTEM CALLS +.SEE %SS ;STY STATUS BITS IN STYSTS +.SEE %SW ;LH(USWST) BITS +.SEE %SY ;NAMES FOR SQUOZE FLAGS IN SYMBOL TABLES (NOT DEFINED IN ITS) +.SEE %TA ;BITS IN TTYSTA +.SEE %TB ;BITS IN TTYTBL USER VARIABLE +.SEE %TC ;BITS IN TTYCOM +.SEE %TD ;SOFTWARE TTY CURSOR CONTROL CODE CONSTANTS +.SEE %TF ;BITS IN TPFLAG +.SEE %TG ;BITS IN TTYST1 AND TTYST2 +.SEE %TI ;BITS IN LEFT HALF OF TTY INPUT IOCHNM WORD +.SEE %TJ ;BITS IN LH OF TTY OPTPUT IOCHNM +.SEE %TM ;BITS AND CONSTANTS FOR TM03/RH11 TAPE CONTROLLER (KS10) +.SEE %TN ;CONSTANTS FOR TCTYP +.SEE %TO ;BITS IN LEFT HALF OF TTYOPT +.SEE %TP ;BITS IN RIGHT HALF OF TTYOPT +.SEE %TQ ;BITS IN LEFT HALF OF TTYSMT +.SEE %TR ;BITS IN RIGHT HALF OF TTYSMT +.SEE %TS ;BITS IN TTYSTS +.SEE %TT ;BITS IN LEFT HALF OF TTYTYP +.SEE %TX ;ASCII CHARACTER BITS (META, TOP, CONTROL, ETC.) +.SEE %TY ;BITS IN RIGHT HALF OF TTYTYP +.SEE %UB ;BITS IS KS10 UNIBUS STATUS REGISTER (UBASTA) +.SEE %UC ;FOR KL AND KS, BITS IN LH OF RESULT OF APRID +.SEE %UM ;BITS IN UMAPS VARIABLE, AND ARGS TO PGLD, MPLD1, PLD1. +.SEE %UP ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS READ) (UBAPAG) +.SEE %UQ ;BITS IN KS10 UNIBUS PAGE MAP (WHEN MAP IS WRITTEN) (UBAPAG) +.SEE %UST ;BITS IN USTP VARIABLE. +.SEE %WY ;WHYINT CODES +.SEE $11 ;BYTE POINTERS TO PDP11 FIELDS IN PDP-10 WORDS, ON AI-KA + ;10-11 INTERFACE. +.SEE ..R ;ARGUMENT CODES FOR .BREAK 12, READING. +.SEE ..S ;ARGUMENT CODES FOR .BREAK 12, WRITING. +.SEE .XC ;INTERNET - TCP connection close reasons (almost = to %NC) + ; (Old names. Use %NX instead.) + +.SEE MMP ;BITS IN MMP ENTRY 1ST WORD L.H. +.SEE OPTTRP ;BITS IN LH OF .OPTION VARIABLE + ; (Old names. Use %OP instead) +.SEE SCL ;BITS IN LH OF SUPCOR +.SEE SCR ;BITS IN RH OF SUPCOR + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,.QUOTE/.QUOTE/X +.ELSE [ + $$TEM1==Z + .QUOTE/.QUOTE/X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +;OPEN-FAILURE CODE NAMES. +;3RD AND 4TH LETTER: "TM" = "TOO MANY", "BD" = "BAD OR ILLEGAL", +; "TF" = "TOO FEW", "RO" = "READ-ONLY", "NA" = "NOT AVAILABLE", +; "NS" = "NO SUCH", "EX" = "ALREADY EXISTS", "FL" = "FULL", +; "NR" = "NOT READY". +;5TH AND 6TH LETTER: "JB" = "JOB", "RG" = "ARG", "DV" = "DEVICE", +; "DR" = "DIRECTORY", "IO" = "DIRECTION", "FL" = "FILE", +; "FN" = "FILE NAME" +DEFSYM %E==:-100 ;BIT TYPEOUT MASK +DEFSYM %ENSDV==:1 ;NO SUCH DEVICE +DEFSYM %ENSIO==:2 ;WRONG DIRECTION +DEFSYM %ETMTR==:3 ;TOO MANY TRANSLATIONS +DEFSYM %ENSFL==:4 ;FILE NOT FOUND +DEFSYM %EFLDR==:5 ;DIRECTORY FULL +DEFSYM %EFLDV==:6 ;DEVICE FULL +DEFSYM %ENRDV==:7 ;DEVICE NOT READY +DEFSYM %ENADV==:10 ;DEVICE NOT AVAILABLE +DEFSYM %EBDFN==:11 ;ILLEGAL FILE NAME +DEFSYM %ENSMD==:12 ;MODE NOT AVAILABLE +DEFSYM %EEXFL==:13 ;FILE ALREADY EXISTS +DEFSYM %EBDCH==:14 ;BAD CHANNEL NUMBER +DEFSYM %ETMRG==:15 ;TOO MANY ARGUMENTS (CALL) +DEFSYM %ENAPK==:16 ;PACK NOT MOUNTED + ;17 FORMERLY DIRECTORY NOT AVAIL +DEFSYM %ENSDR==:20 ;NON-EXISTENT DIRECTORY +DEFSYM %ELCDV==:21 ;LOCAL DEVICE ONLY +DEFSYM %ESCO==: 22 ;SELF-CONTRADICTORY OPEN +DEFSYM %ENAFL==:23 ;FILE LOCKED +DEFSYM %ETMDR==:24 ;M.F.D. FULL +DEFSYM %EMCHN==:25 ;DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +DEFSYM %ERODV==:26 ;DEVICE WRITE-LOCKED +DEFSYM %ETMLK==:27 ;LINK DEPTH EXCEEDED +DEFSYM %ETFRG==:30 ;TOO FEW ARGUMENTS (CALL) +DEFSYM %EROJB==:31 ;CAN'T MODIFY JOB +DEFSYM %EROPG==:32 ;CAN'T GET THAT ACCESS TO PAGE +DEFSYM %EBDRG==:33 ;MEANINGLESS ARGS +DEFSYM %EBDDV==:34 ;WRONG TYPE DEVICE +DEFSYM %ENSJB==:35 ;NO SUCH JOB +DEFSYM %EBOJ==: 36 ;VALID CLEAR OR STORED SET +DEFSYM %ENACR==:37 ;NO CORE AVAILABLE +DEFSYM %ETOP==: 40 ;NOT TOP LEVEL +DEFSYM %ENAPP==:41 ;OTHER END OF PIPELINE GONE OR NOT OPEN +DEFSYM %ENAJB==:42 ;JOB GONE OR GOING AWAY +DEFSYM %ENSCL==:43 ;ILLEGAL SYSTEM CALL NAME +DEFSYM %ENSCH==:44 ;CHANNEL NOT OPEN +DEFSYM %ENRBF==:45 ;INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +DEFSYM %EBDFL==:46 ;UNRECOGNIZABLE FILE (LOAD) +DEFSYM %EBDLK==:47 ;LINK TO NON-EXISTENT FILE + +NOPNLS==:47 ;NO DEFSYM BECAUSE THIS SYMBOL IS NOT TO BE PREDEFINED TO USERS + +; BITS IN .PIRQC USER VARIABLE - FIRST-WORD INTERRUPTS +; CLASSES ARE: +; [1] STOPS JOB AND INTERRUPTS SUPERIOR (FATAL INTR) +; [2] STOPS JOB AND INTERRUPTS SUPERIOR UNLESS ENABLED +; [3] DOES NOTHING UNLESS ENABLED +; BITS IN THE LH HAVE TWO NAMES: %PI... AS A BIT IN THE WORD, +; AND %PJ... SHIFTED DOWN BY 18. BITS. + +.SEE PIRQC + +DEFSYM %PI==:525252,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %PIRLT==:200000,, ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PIRUN==:100000,, ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PINXI==:40000,, ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PIJST==:20000,, ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PIDCL==:10000,, ;DEFERRED CALL [1] +DEFSYM %PIATY==:4000,, ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PITTY==:2000,, ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PIPAR==:1000,, ;MEMORY PARITY ERROR [2] +DEFSYM %PIFOV==:400,, ;FLOATING OVERFLOW [3] +DEFSYM %PIWRO==:200,, ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PIFET==:100,, ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PITRP==:40,, ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PIDBG==:2,, ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PILOS==:1,, ;.LOSE INSTRUCTION EXECUTED [2] +DEFSYM %PICLI==:400000 ;CLI DEVICE OPENED TO THIS JOB [3] +DEFSYM %PIPDL==:200000 ;PUSHDOWN LIST OVERFLOW [3] +DEFSYM %PILTP==:100000 ;LIGHT PEN [3] +DEFSYM %PIMAR==:40000 ;MAR ADDRESS TRAP [2] +DEFSYM %PIMPV==:20000 ;MEMORY PROTECTION VIOLATION [2] +DEFSYM %PICLK==:10000 ;SLOW (1/2 SEC) CLOCK [3] +DEFSYM %PI1PR==:4000 ;SINGLE-INSTRUCTION PROCEED [1] +DEFSYM %PIBRK==:2000 ;.BREAK INSTRUCTION EXECUTED [1] +DEFSYM %PIOOB==:1000 ;ADDRESS OUT OF BOUNDS [2] +DEFSYM %PIIOC==:400 ;I/O CHANNEL ERROR [2] +DEFSYM %PIVAL==:200 ;.VALUE INSTRUCTION EXECUTED [1] +DEFSYM %PIDWN==:100 ;SYSTEM GOING DOWN STATUS CHANGE[3] +DEFSYM %PIILO==:40 ;ILLEGAL OPERATION (E.G. UUO) [2] +DEFSYM %PIDIS==:20 ;DISPLAY MEMORY PROTECT [2] +DEFSYM %PIARO==:10 ;ARITHMETIC OVERFLOW [3] +DEFSYM %PIB42==:4 ;BAD LOCATION 42 [1] +DEFSYM %PIC.Z==:2 ;^Z OR CALL TYPED [1] +DEFSYM %PITYI==:1 ;TTY INPUT (OBSOLETE) [3] + +DEFSYM %PJ==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %PJRLT==:200000 ;REAL-TIME TIMER WENT OFF [3] +DEFSYM %PJRUN==:100000 ;RUN-TIME TIMER WENT OFF [3] +DEFSYM %PJNXI==:40000 ;NON-EX IO REG (KS10 UNIBUS) [2] +DEFSYM %PJJST==:20000 ;JOB STATUS DISPLAY REQUEST [3] +DEFSYM %PJDCL==:10000 ;DEFERRED CALL [1] +DEFSYM %PJATY==:4000 ;WAS JUST GIVEN THE TTY [3] +DEFSYM %PJTTY==:2000 ;DON'T HAVE TTY (SEE %TBINT) [2] +DEFSYM %PJPAR==:1000 ;MEMORY PARITY ERROR [2] +DEFSYM %PJFOV==:400 ;FLOATING OVERFLOW [3] +DEFSYM %PJWRO==:200 ;WRITE IN READ-ONLY PAGE [2] +DEFSYM %PJFET==:100 ;FETCHED INSN FROM IMPURE PAGE [2] +DEFSYM %PJTRP==:40 ;SYSTEM UUO IN TRAP MODE [1] +DEFSYM %PJDBG==:2 ;SYSTEM BEING DEBUGGED STATE CHG[3] +DEFSYM %PJLOS==:1 ;.LOSE INSTRUCTION EXECUTED [2] + +;;; PC FLAGS (LEFT HALF) + +DEFSYM %PC==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PCARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PCCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PCCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PCFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PCFPD==:020000 ;FIRST PART DONE + ; (E.G. ILDB PTR INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PCUSR==:010000 ;USER MODE +DEFSYM %PCUIO==:004000 ;USER I/O +DEFSYM %PCPUR==:002000 ;GIVE %PIFET IF FETCH INSTR FROM WRITABLE + ; PAGE (KA-10 ONLY) +DEFSYM %PCSPC==:001000 ;"SPECIAL" - OBSOLETE +DEFSYM %PC1PR==:000400 ;1 PROCEED - GIVE %PI1PR AFTER ONE INSTRUCTION +DEFSYM %PCX17==:000200 ;XR 17 = PC (AI-KA ONLY) +DEFSYM %PCFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PCDIV==:000040 ;DIVIDE ERROR + +;;; PC FLAGS FOR KL-10 AND KS-10 + +DEFSYM %PS==:1,,525240 ;FOR BIT-TYPEOUT MODE +DEFSYM %PSARO==:400000 ;ARITHMETIC OVERFLOW +DEFSYM %PSPCP==:400000 ;PREVIOUS CONTEXT PUBLIC - PXCT CAN'T + ;REFERENCE CONCEALED PAGE THIS APPLIES ONLY + ;IN EXEC MODE. IN USER MODE AND ON KS IS + ;STILL %PSARO. +DEFSYM %PSCR0==:200000 ;CARRY OUT OF BIT 0 +DEFSYM %PSCR1==:100000 ;CARRY OUT OF BIT 1 +DEFSYM %PSFOV==:040000 ;FLOATING OVERFLOW +DEFSYM %PSFPD==:020000 ;FIRST PART DONE (E.G. ILDB PTR + ;INCREMENTED, BYTE NOT FETCHED) +DEFSYM %PSUSR==:010000 ;USER MODE ; 0 0 1 1 +DEFSYM %PSUIO==:004000 ;USER I/O ;; KERNEL SUPERV CONCEAL PUBLIC +DEFSYM %PSPUB==:002000 ;PUBLIC MODE ; 0 1 0 1 + ;%PSPUB ALWAYS 0 ON KS. +DEFSYM %PSPCU==:004000 ;IN EXEC MODE %PSUIO MEANS PREVIOUS CONTEXT + ;USER. +DEFSYM %PSINH==:001000 ;INHIBIT ADDRESS BREAK & TRAP 3 (TURNS OFF + ;AFTER 1 INST) %PSINH ALWAYS 0 ON KS. +DEFSYM %PSTR2==:000400 ;TRAP 2 (PDL OVERFLOW) ;TRAP 1 PLUS TRAP 2 +DEFSYM %PSTR1==:000200 ;TRAP 1 (ARITH OVERFLOW) ; MAKES TRAP 3 + ; (ONE PROCEED + ; ON KL) +DEFSYM %PSFXU==:000100 ;FLOATING EXPONENT UNDERFLOW +DEFSYM %PSDIV==:000040 ;DIVIDE ERROR + +DEFSYM %PS1PR==:001600 ;BITS TO SET TO CAUSE A 1-PROCEED ON KL. + +; INTERNET and ARPANET + +.SEE NETRFC +DEFSYM %NQ==:1,,525252 ; Control bits for NETRFC system call +DEFSYM %NQREF==:1 ; Refuse this connection request. Arg 2 must be a + ; previously returned RFC identifier. + +.SEE TCPOPN +DEFSYM %NO==:1,,525252 ; Control bits for TCPOPN system call +DEFSYM %NOLSN==:100 ; Listen mode - wait for SYN (request for conn) + +DEFSYM %NS==:,-1 ; NCP (old ARPANET) SOCKET STATES +DEFSYM %NSCLS==:0 ;CLS RECEIVED. CONNECTION CLOSED (IMSCLS GIVES REASON) +DEFSYM %NSLSN==:1 ;LISTENING FOR RFC +DEFSYM %NSRFC==:2 ;RFC RECEIVED WHILE IN LISTENING STATE +DEFSYM %NSRCL==:3 ;CLS RECEIVED WHILE IN RFC RECEIVED STATE +DEFSYM %NSRFS==:4 ;RFC SENT +DEFSYM %NSOPN==:5 ;CONNECTION OPEN +DEFSYM %NSRFN==:6 ;RFNM WAIT ON WRITE LINK +DEFSYM %NSCLW==:7 ;CLS SENT. WAITING FOR MATCHING CLS +DEFSYM %NSCLI==:10 ;CLS RECEIVED BUT INPUT STILL AVAILABLE +DEFSYM %NSINP==:11 ;INPUT AVAILABLE + +DEFSYM %NT==:,,-1 ; TCP port states as seen by user + ; Legend: - Pre-Open, * Open, + Post-open, ? impossible. + ; I = can read, O = can write. + ; Note that the input and output channels for a TCP connection + ; will usually have different states. Also, note that + ; for all practical purposes, %NT and %NS symbols with the same + ; value have the same meaning. SYN = Request for connection. + ; In Out +DEFSYM %NTCLS==:0 ; - - Closed (reason available from WHYINT) +DEFSYM %NTLSN==:1 ; - - Listening for a SYN +DEFSYM %NTSYR==:2 ; - - SYN received +DEFSYM %NTCLU==:3 ; + ? Being closed by fgn host +DEFSYM %NTSYN==:4 ; - - SYN sent, waiting for response +DEFSYM %NTOPN==:5 ; *I *O Open +DEFSYM %NTWRT==:6 ; ? *O Output buffer full +DEFSYM %NTCLX==:7 ; ? + Being closed by user +DEFSYM %NTCLI==:10 ; +I ? Closing/closed, input still available +DEFSYM %NTINP==:11 ; *I ? Open, input available + + +DEFSYM %NC==:,-1 ; NCP (old ARPANET) CLOSE REASONS (IN IMSCLS) +DEFSYM %NCNTO==:0 ;NEVER OPENED +DEFSYM %NCUSR==:1 ;CLSED BY USER +DEFSYM %NCFRN==:2 ;CLSED BY FOREIGN HOST +DEFSYM %NCRST==:3 ;RST +DEFSYM %NCDED==:4 ;HOST DEAD +DEFSYM %NCINC==:5 ;INCOMPLETE TRANSMISSION +DEFSYM %NCBYT==:6 ;BYTE SIZE MISMATCH. +DEFSYM %NCNCP==:7 ;OUR NCP WENT DOWN. +DEFSYM %NCRFS==:10 ;REQUEST FOR CONNECTION REFUSED + +;;; .XC is being phased out for the name %NX instead. +;;; The .XC symbols will be flushed "soon". + +DEFSYM .XC==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note .XC and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM .XCNTO==:0 ; Never opened +DEFSYM .XCUSR==:1 ; Closed by user +DEFSYM .XCFRN==:2 ; Closed by foreign host +DEFSYM .XCRST==:3 ; Fgn host refused or aborted connection. +DEFSYM .XCDED==:4 ; Fgn host dead (not used yet) +DEFSYM .XCINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM .XCNCP==:7 ; Local TCP went down (not used yet) +DEFSYM .XCRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + +DEFSYM %NX==,,-1 ; TCP port cls reasons (valid for ALL post-open states) + ; Note %NX and %NC symbols with the same value + ; have pretty much the same meanings. +DEFSYM %NXNTO==:0 ; Never opened +DEFSYM %NXUSR==:1 ; Closed by user +DEFSYM %NXFRN==:2 ; Closed by foreign host +DEFSYM %NXRST==:3 ; Fgn host refused or aborted connection. +DEFSYM %NXDED==:4 ; Fgn host dead (not used yet) +DEFSYM %NXINC==:5 ; Incomplete transmission (retransmission timeout) + ; This is the usual indication when a foreign host + ; or the intervening network crashes. + ; ==:6 ; Byte size mismatch - can't happen +DEFSYM %NXNCP==:7 ; Local TCP went down (not used yet) +DEFSYM %NXRFS==:10 ; RST received while in SYN-SENT state. + ; (foreign host refused connection) + + + +;;; BITS IN RESULT OF APRID (BLKI APR,) ON KL-10 AND KS-10 +DEFSYM %UC==:1,,525000 ;FOR BIT-TYPEOUT MODE +DEFSYM $UCOPT==:331100 ;MICROCODE OPTIONS: +DEFSYM %UCKLP==:400000 ; KL-10-STYLE PAGING +DEFSYM %UCITS==:20000 ; ITS-STYLE PAGING +DEFSYM %UCTRK==:1000 ; TRACKS FEATURE +DEFSYM $UCVRS==:221100 ;MICROCODE VERSION NUMBER +DEFSYM %UCVRS==:1 +DEFSYM %HW==:0,,527777 ;FOR BIT-TYPEOUT MODE +DEFSYM $HWOPT==:140600 ;HARDWARE OPTIONS +DEFSYM $HWSER==:001400 ;PROCESSOR SERIAL NUMBER + + +;;; .CALL ARGUMENT TYPES +DEFSYM %CL==:1,,400777 +DEFSYM %CLIN==:0 ;INPUT ARGUMENT +DEFSYM %CLIMM==:1000 ;IMMEDIATE ARGUMENT +DEFSYM %CLOUT==:2000 ;OUTPUT ARGUMENT +DEFSYM %CLERR==:3000 ;ERROR CODE OUTPUT ARGUMENT +DEFSYM %CLBTW==:4000 ;DIRECT CONTROL BITS +DEFSYM %CLBIT==:5000 ;IMMEDIATE CONTROL BITS + + +;;; CONTROL BITS FOR CORBLK SYSTEM CALL + +.SEE NCORBLK +DEFSYM %CB==:0,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %CBWRT==:400000 ;TRY FOR WRITE ACCESS, OK IF CAN'T GET IT +DEFSYM %CBRED==:200000 ;TRY FOR READ ACCESS, OK IF CAN'T GET IT +DEFSYM %CBNDW==:100000 ;NEED WRITE ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBPUB==:040000 ;MAKE PAGE PUBLIC, REQUIRES WRITE ACCESS +DEFSYM %CBPRV==:020000 ;MAKE PAGE PRIVATE, REQUIRES WRITE ACCESS +DEFSYM %CBNDR==:010000 ;NEED READ ACCESS, FAIL IF CAN'T GET IT +DEFSYM %CBCPY==:004000 ;MAKE A COPY (DISK FILES ONLY) +DEFSYM %CBLOK==:002000 ;LOCK PAGE IN CORE. +DEFSYM %CBULK==:001000 ;UNLOCK PAGE (ALLOW SWAP-OUT) +DEFSYM %CBSLO==:000400 ;MAY ONLY RESIDE IN SLOWEST MEMORY +DEFSYM %CBUSL==:000200 ;ALLOWS USE OF ANY MEMORY. + ;ABOVE BITS ALL ZERO MEANS DELETE PAGE FROM MAP + +;;; SPECIAL VALUES FOR SPECS + +DEFSYM %JS==:,,-1 +DEFSYM %JSELF==:,,-1 ;SELF (ALL SPECS) +DEFSYM %JSTVB==:,,-2 ;11TV BUFFER (CORBLK) +DEFSYM %JSNUL==:,,-3 ;NULL JOB (KLPERF) +DEFSYM %JSALL==:,,-4 ;ALL JOBS (KLPERF) +DEFSYM %JSNEW==:,,-5 ;FRESH PAGE (CORBLK) +DEFSYM %JSABS==:,,-6 ;ABSOLUTE CORE (CORBLK) +DEFSYM %JSNUM==:400000 ;THIS + JOB # => THAT JOB (ALL SPECS) +DEFSYM %JSSIX==:400376 ;PDP6 IS USER NUMBER 376 +DEFSYM %JSSUP==:400377 ;SUPERIOR (ALL SPECS) +;A SPEC MAY ALSO BE THE NUMBER OF A CHANNEL OPEN ON USR:, BOJ:, OR STY: + +;;; CONTROL BITS FOR ".REALT AC," UUO. +;;; FLAG BITS ARE IN LH(AC). + +.SEE AREALT +DEFSYM %RL==:1,,525252 ;FOR BIT-TYPEOUT MODE +DEFSYM %RLFLS==:400000 ;FLUSH OLD TIMER +DEFSYM %RLSET==:200000 ;SET NEW CLOCK RATE +DEFSYM %RLUSR==:100000 ;TRY TO SEIZE REAL TIME USER FACILITY +DEFSYM %RLPSD==:020000 ;ONLY WANT PSEUDO REAL TIME +DEFSYM %RLNPS==:040000 ;CANNOT ACCEPT PSEUDO REAL TIME +DEFSYM %RLBLK==:010000 ;PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY + ; PHASE OR INTERRUPT LEVEL +DEFSYM %RLGET==:004000 ;GET PREVIOUS STATUS IN WORDS 3+4 + ;REMAINING BITS MUST BE ZERO + +;;; BITS OF .OPTION USER VARIABLE. + +.SEE OPTION +DEFSYM OPTTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM OPTDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM OPTCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM OPTBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM OPTDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM OPTINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM OPTOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM OPTLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM OPTLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM OPTOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM OPTLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM OPTLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; NEW NAMES FOR BITS IN LH(.OPTION) + +DEFSYM %OP==:525252(1) ;FOR BIT-TYPEOUT MODE +DEFSYM %OPTRP==:400000 ;ALL SYSTEM UUOS TRAP TO SUPERIOR (%PITRP) +DEFSYM %OPDEC==:100000 ;UUOS 40,41 AND 47 ARE USER UUOS + ;THE FOLLOWING 3 BITS ARE NOT USED BY SYSTEM. + ;THEY ARE FOR COMMUNICATION FROM SUPERIOR. +DEFSYM %OPCMD==:040000 ;SUPERIOR SAYS IT HAS CMD STRING - DO + ; .BREAK 12,. +DEFSYM %OPBRK==:020000 ;SUPERIOR SAYS IT HANDLES ALL .BREAK'S. +DEFSYM %OPDDT==:010000 ;SUPERIOR SAYS HE'S DDT. (CLEARED WHEN DDT + ; DISOWNS) +DEFSYM %OPINT==:004000 ;NEW STYLE VECTORING INTS. +DEFSYM %OPOJB==:002000 ;ALLOW OTHER JOBS TO OPEN ME ON THE OJB + ; DEVICE. OPENING ME ON OJB DEVICE TURNS + ; ME INTO A JOB DEVICE. +DEFSYM %OPLOK==:001000 ;ENABLE SWITCH-UNLOCKING FEATURE + .SEE IODCSW ; SEE COMMENT THERE FOR DESCRIPTION. +DEFSYM %OPLIV==:000400 ;DON'T KILL THIS TOP LEVEL JOB WHEN SYS + ; GOES DOWN. +DEFSYM %OPOPC==:000200 ;INTERRUPTS THAT ABORT AN INSTRUCTION + ; SHOULD LEAVE THE PC POINTING TO THAT + ; INSTRUCTION (OTHERWISE IT GETS AOS'ED) +DEFSYM %OPLSP==:000100 ;SUPERIOR SAYS HE'S LISP +DEFSYM %OPLKF==:000040 ;UNLOCK LOCKS ON FATAL INTERRUPT IN + .SEE SYSDT ; TOP-LEVEL NON-DISOWNED JOB. + +;;; LOSING ERROR CODES + +DEFSYM %LS==:777400 ;RH OF .LOSE INSTRUCTION +DEFSYM %LSINT==:1 +DEFSYM %LSSYS==:1000 ;INTERPRET LAST OPEN LOSS CODE, USING .BCHN +DEFSYM %LSFIL==:1400 ; DO THAT AND PRINT FILE NAMES FROM CALL'S CHNL + +;;; FIRST RESULT OF .CALL WHYINT + +DEFSYM %WY==:,-1 +DEFSYM %WYTYI==:1 ;TTY INPUT +DEFSYM %WYTYO==:2 ;TTY OUTPUT +DEFSYM %WYSTI==:3 ;STY INPUT +DEFSYM %WYSTO==:4 ;STY OUTPUT +DEFSYM %WYNET==:5 ;ARPANET (NCP) +DEFSYM %WYCHA==:6 ;CHAOS NET +DEFSYM %WYTCP==:7 ;INTERNET (TCP) +DEFSYM %WYUBI==:10 ;UNIBUS INTERRUPT + +;I/O MODES FOR OPENS. + +DEFSYM .UAI==0 ;UNIT ASCII INPUT. +DEFSYM .UAO==1 ;UNIT ASCII OUTPUT. +DEFSYM .BAI==2 ;BLOCK ASCII INPUT. +DEFSYM .BAO==3 ;BLOCK ASCII OUTPUT. +DEFSYM .UII==4 ;UNIT IMAGE INPUT. +DEFSYM .UIO==5 ;UNIT IMAGE OUTPUT. +DEFSYM .BII==6 ;BLOCK IMAGE INPUT. +DEFSYM .BIO==7 ;BLOCK IMAGE OUTPUT. + +;OPEN BITS FOR DEVICE DSK: + +DEFSYM %DO==1,,525252 ;BIT TYPEOUT MASK +DEFSYM %DOOUT==1 +DEFSYM %DOBLK==2 +DEFSYM %DOIMG==4 +DEFSYM %DONRF==10 ;DON'T SET REFERENCE DATE. +DEFSYM %DONLK==20 ;DON'T CHASE LINKS. +DEFSYM %DORWT==40 ;ON OUTPUT OPEN, MAKES WOULD-BE READERS + ;WAIT TILL WE CLOSE. +DEFSYM %DOWOV==100000 ;WRITE OVER (USE WITH %DOOUT, TO OVERWRITE + ;EXISTING FILE). + +;ARGUMENT CODES FOR .BREAK 12,'S. +;..R AND ..S ARE BIT TYPEOUT MASKS, NOT MADE PREDEFINED TO MIDAS +;SINCE THEY ARE USEFUL ONLY IN DDT, WHICH DEFINES THEM ITSELF. + +..R==0 ;(FOR .SEE) +DEFSYM ..RSTART==1 ;READ STARTING ADDRESS +DEFSYM ..RLFILE==2 ;READ LOADED FILE'S NAMES +DEFSYM ..RSTP==3 ;READ SYMBOL TABLE POINTER +DEFSYM ..RSYM==4 ;READ VALUE OF SYMBOL. +DEFSYM ..RJCL==5 ;READ JOB COMMAND LINE. +DEFSYM ..RPFILE==6 ;READ :PRINT FILENAME DEFAULTS. +DEFSYM ..RSTB==7 ;READ WHOLE SYMBOL TABLE. +DEFSYM ..RCONV==10 ;READ NAME OF SYMBOL CLOSEST IN VALUE TO + ; ARGUMENT. +DEFSYM ..RLJB==13 ;READ IDX OF PREVIOUSLY CURRENT JOB. +DEFSYM ..RRND==14 ;READ RANDOM JOB-SPECIFIC BITS. +DEFSYM ..RPUR==15 ;UNPURIFY PAGE +DEFSYM ..RHSNAME==16 ;ASK SUPERIOR TO LOOKUP AN HSNAME FROM XUNAME +DEFSYM ..RMAIL==17 ;ASK A SUPERIOR TO LOOKUP USER'S MAIL FILE NAME + +..S==0 ;(FOR .SEE) +DEFSYM ..SSTART==400001 ;SET STARTING ADDRESS +DEFSYM ..SLFILE==400002 ;SET LOADED FILE'S NAMES +DEFSYM ..SSYM==400004 ;SET VALUE OF SYMBOL. +DEFSYM ..SJCL==400005 ;CLEAR JOB COMMAND LINE. +DEFSYM ..SPFILE==400006 ;SET :PRINT FILENAME DEFAULTS. +DEFSYM ..SSTB==400007 ;PASS WHOLE SYMBOL TABLE TO SUPERIOR. +DEFSYM ..SRND==400014 ;SET RANDOM JOB-SPECIFIC BITS. +DEFSYM ..SPUR==400015 ;SAME AS ..RPUR + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +DEFSYM %JG==:1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN + ; WD7 ON AN OPEN +DEFSYM %JGCLS==:40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +DEFSYM %JGSIO==:1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +DEFSYM %JGFPD==:200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +DEFSYM %JO==:,,-1 +DEFSYM %JOOPN==:0 ;OPEN +DEFSYM %JOIOT==:1 ;IOT/SIOT +DEFSYM %JOLNK==:2 ;MLINK +DEFSYM %JORST==:3 ;RESET +DEFSYM %JORCH==:4 ;RCHST +DEFSYM %JOACC==:5 ;ACCESS +DEFSYM %JORNM==:6 ;FDELE (DELETE OR RENAME) +DEFSYM %JORWO==:7 ;FDELE (RENAME WHILE OPEN) +DEFSYM %JOCAL==:10 ;SYMBOLIC .CALL + +;MODE BITS FOR TTY OPENS: +;3.1 0 -> IN 1 -> OUT +;3.2 0 -> UNIT 1 -> BLOCK + +;OUTPUT +;3.3 => IMAGE MODE (SET ALL %TGIMG BITS IN TTYST1 AND TTYST2) +;3.4 0 -> NORMAL 1 -> ECHO MODE OUTPUT (SET %TJECH, %TJPP2, %TJMOR). +;3.5 0 -> NORMAL 1 -> DISPLAYMODE, LOOK FOR ^P (SET %TJDIS). +;3.6 0 -> NORMAL 1 -> SUPER-IMAGE OUTPUT (SET %TJSIO). +;OUTPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR +;%TJCNS, %TJCP1, AND %TJCP2 + +;INPUT +;3.3 => IMAGE MODE (CLEAR ALL ECHO BITS IN TTYST1, TTYST2). +;3.4 => "DDT" (DON'T ECHO CR, LF, TAB) +;3.6 => WANT 3 LINES IN ECHO AREA. +;INPUT IOCHNM BITS MAY ALSO BE SPECIFIED, EXCEPT FOR %TICNS. + +;BITS 3.4 AND 3.6 ON INPUT, AND BIT 3.3, HAVE EFFECT +;ONLY ON THE FIRST OPEN IN EITHER DIRECTION. +;(THEY ARE OBSOLETED BY THE TTYSET SYSTEM CALL) + +;BITS IN LH OF A TTY CHANNEL IOCHNM WORD +;THESE BITS MAY BE TEMPORARILY COMPLEMENTED BY SPECIFYING +;THEM IN THE CONTROL-BIT ARGUMENT TO A SYMBOLIC IOT +;(EXCEPT FOR %TICNS AND $TIIDX). +DEFSYM %TI==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TJ==:1,,525277 ;BIT TYPEOUT MASK + +DEFSYM %TICNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE +DEFSYM %TJCNS==:400000 ;4.9 1-> CONSOLE 0 -> DEVICE + +;THE FOLLOWING INTERPRETATIONS OF BITS ARE FOR OUTPUT ONLY. +DEFSYM %TJCP1==:200000 ;^P-CODE ANTICIPATION STATE. +DEFSYM %TJCP2==:100000 ; ". 0=>NORMAL, 1=> CHAR AFTER ^P, 2=> ^PH, 3=>^PV. +DEFSYM %TJECH==:40000 ;SET => ECHO MODE OUTPUT.-MODE OUTPUT (ALL CHARS + ; OUTPUT THE WAY THEY WOULD BE ECHOED) +DEFSYM %TJCTN==:20000 ;SET => DON'T DO LINE-CONTINUATION. +DEFSYM %TJSTP==:10000 ;SET => THIS CHANNEL IS HUNG IN **MORE**. +DEFSYM %TJDIS==:4000 ;SET => LOOK FOR ^P CODES. +DEFSYM %TJSIO==:2000 ;SET => SUPERIMAGE OUTPUT, NO PADDING OR CURSOR CTL. +DEFSYM %TJMOR==:1000 ;SET => DON'T DO **MORE** PROCESSING. +DEFSYM %TJPP2==:400 ;SET => USE ALTERNATE PC PPR (THE ECHO AREA) +DEFSYM %TJINK==:200 ;SET => NEXT CHAR OUT TAKEN AS PRINTING + ; REGARDLESS (^PI) +DEFSYM %TJHDE==:100 ;SET => ACCOUTING FOR CURSOR MOTION DUE TO + ;CHAR ECHOED ON A HALF-DUPLEX TTY. + +;INPUT +DEFSYM %TIECH==:40000 ;CAN READ EVEN IF CHAR NEEDS PI ECHOING. +DEFSYM %TIPEK==:20000 ;DON'T REMOVE CHAR FROM BUFFER. +DEFSYM %TIACT==:4000 ;SET => DON'T WAIT FOR ACTIVATION CHARACTER. +DEFSYM %TIINT==:2000 ;SET => CAN READ A CHAR EVEN IF IT IS SUPPOSED TO + ; INTERRUPT & HASN'T YET. +DEFSYM %TINWT==:1000 ;SET => IF NO INPUT AVAILABLE, DON'T WAIT, JUST + ; RETURN -1. +DEFSYM %TIFUL==:400 ;SET => GIVE FULL CHARACTER (SIGNIFICANT ON IMLAX, TVS) + +DEFSYM $TIIDX==:220600 ;3.6-3.1 CONSOLE #, OR 77 FOR A "DISOWNED" CONSOLE + ; TTY CHNL, IE, ONE THAT CORRESPONDS TO NO REAL TTY. + ; THEY EXIST ONLY IN TREES WITH NO TTY, IN JOBS + ; THAT CAME FROM TREES WITH TTYS. +DEFSYM %TIIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TJIDX==:1 ;FOR BIT TYPEOUT MODE +DEFSYM %TINON==:77 ;"TTY #" FOR A CHANNEL WITH NO REAL TTY. + +;EACH CHARACTER IN THE INPUT BUFFER OCCUPIES 18 BITS +;THE UPPER BITS ARE AS FOLLOWS (NOTE THAT AN IOTTED +;CHARACTER MAY ACTUALLY CONTAIN %TXPIE, %TXMPE, %TXECI, OR %TXINT) +DEFSYM %TX==:525200 ;BIT TYPEOUT MASK +DEFSYM %TXMPE==:400000 ;MAIN PROGRAM ECHO CHARACTER +DEFSYM %TXPIE==:200000 ;PI ECHO CHARACTER +; DEFSYM %TXCOM==:100000 ;COM MODE ECHO CHAR; DO PI ECHO EVEN IF HDX +; ; TTY. +; DEFSYM %TXIGN==:40000 ;IGNORE THIS CHAR AT .IOT TIME. +; DEFSYM %TXACT==:20000 ;THIS IS AN ACTIVATION CHAR. +; THESE CAN'T BE NEEDED EXCEPT INSIDE THE SYSTEM. +DEFSYM %TXINT==:10000 ;THIS CHAR SHOULD INTERRUPT THE USER. +;GAP +DEFSYM %TXECI==:2000 ;THIS CHAR WAS ECHOED BY AN ECHOIN SYSTEM CALL. + +;NOW COME THE BITS OF THE CHARACTER ITSELF: +DEFSYM %TXTOP==:4000 ;The "TOP" key. +;GAP +DEFSYM %TXSFT==:1000 ;What used to be the "SHIFT" key is now the +DEFSYM %TXSUP==:1000 ;"SUPER" key. (def'ed in this order for DDT) +DEFSYM %TXMTA==:400 ;"META" key. +DEFSYM %TXCTL==:200 ;"CONTROL" key. +DEFSYM %TXASC==:177 ;The ASCII part of the character. + +;DISPLAY COMMANDS (WHICH LIVE IN THE OUTPUT BUFFER). +;NOTE THAT ALL OF THEM HAVE 200-BIT SET. +DEFSYM %TD==:777400 +DEFSYM %TDMOV==:200 ;MOVE CURSOR +DEFSYM %TDMV1==:201 ;DUMMY COMMAND CREATED BY TYMOV. + ;MAKES IT POSSIBLE FOR TYMOV TO STOP WHEN BUFFER FULL + ;AND BE REENTERED NEXT INTERRUPT. +DEFSYM %TDEOF==:202 ;CLEAR REST OF PAGE +DEFSYM %TDEOL==:203 ;CLEAR REST OF LINE +DEFSYM %TDDLF==:204 ;DELETE FORWARD (FOR IMLACS AND TVS) +DEFSYM %TDMTF==:205 ;MOTOR OFF (FOR TERMINETS) +DEFSYM %TDMTN==:206 ;MOTOR ON (FOR TERMINETS) +DEFSYM %TDCRL==:207 ;CRLF ON DATAPOINTS, IMLACS. +DEFSYM %TDNOP==:210 ;NO-OP FOR SUPERDUPERIMAGE MODE. +DEFSYM %TDBS==:211 ;BACKSPACE (FOR TTY'S WITH %TORAW SET). +DEFSYM %TDLF==:212 ;LINEFEED ("). +DEFSYM %TDRCR==:213 ;CARRET ("). +DEFSYM %TDORS==:214 ;"OUTPUT RESET" FOR SAKE OF SOFTWARE TTYS +DEFSYM %TDQOT==:215 ;MYSTERY COMMAND -- SEND IN A JINGLE IN 25 WORDS OR + ; LESS AND WIN +DEFSYM %TDFS==:216 ;CURSOR FORWARD ONE COLUMN +DEFSYM %TDMV0==:217 ;MOVE CURSOR, FOLLOWED BY NEW VERT POS, NEW HOR POS +DEFSYM %TDCLR==:220 ;CLEAR THE SCREEN +DEFSYM %TDBEL==:221 ;DING THE BELL +DEFSYM %TDINI==:222 ;SYSTEM JUST CAME UP, RE-INITIALIZE INTELLIGENT + ; TERMINAL +DEFSYM %TDILP==:223 ;INSERT LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDDLP==:224 ;DELETE LINE-POSITION, FOLLOW BY COUNT +DEFSYM %TDICP==:225 ;INSERT CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDDCP==:226 ;DELETE CHARACTER-POSITION, FOLLOW BY COUNT +DEFSYM %TDBOW==:227 ;ENTER BLACK ON WHITE MODE +DEFSYM %TDRST==:230 ;DESELECT ALL SPECIAL MODES (SUCH AS BLACK-ON-WHITE). +DEFSYM %TDGRF==:231 ;ENTER GRAPHICS MODE +DEFSYM %TDRSU==:232 ;REGION SCROLL UP +DEFSYM %TDRSD==:233 ;REGION SCROLL DOWN + +; Apparently codes 234 - 237 are used for an undocumented kludge for +; sending ARDS graphics protocol. See SYSENG;IMPRIN (the source of +; :ARDPRN). + +;%TDSYN THROUGH %TDMLT ARE USED ONLY ON TERMINALS WHICH HAVE %TRLED SET IN +; TTYSMT. +DEFSYM %TDSYN==:240 ;RESYNCH REPLY TO LOCAL EDITING TERMINAL +DEFSYM %TDECO==:241 ;ASK TERMINAL TO TRY LOCAL EDITING BY SENDING A + ; RESYNCH. +DEFSYM %TDEDF==:242 ;SET LOCAL EDITING TERMINAL COMMAND DEFINITION. + ; FOLLOWED BY TWO BYTES, DECODED AS DESCRIBED IN + ; LOCAL EDITING PROTOCOL. +DEFSYM %TDNLE==:243 ;STOP DOING LOCAL EDITING. +DEFSYM %TDTSP==:244 ;DISPLAYS LIKE SPACE, BUT IS PART OF A TAB. USED + ; ONLY FOR LOCAL EDITING TERMINALS, TO ENABLE THEM + ; DISTINGUISH SPACES FROM TABS. +DEFSYM %TDCTB==:245 ;THIS LINE IS CONTINUED AT THE BEGINNING. +DEFSYM %TDCTE==:246 ;THIS LINE IS CONTINUED AT THE END. +DEFSYM %TDMLT==:247 ;%TDMLT => NEXT COLS ARE DISPLAY REP FOR + ; ONE CHAR OF TEXT. +;%TDSVL THROUGH %TDSLL ARE USED ON TERMINALS WHICH HAVE NONZERO %TRLSV. +DEFSYM %TDSVL==:250 ; => SAVE LINES' CONTENTS UNDER + ; LABELS STARTING WITH *200+. +DEFSYM %TDRSL==:251 ;SAME THREE ARGS. RESTORE LABELED CONTENTS ONTO + ; LINES. +DEFSYM %TDSSR==:252 ; SET RANGE OF COLUMNS TO COPY IN + ; %TDSVL, %TDRSL. +DEFSYM %TDSLL==:253 ; SET LABEL FOR NEXT LINE PUSHED OFF + ; SCREEN LOCALLY. +DEFSYM %TDMAX==:254 ;1 + LARGEST DISPLAY CODE. + +;THE TCTYP WORD FOR A TTY CONTAINS A NUMBER WHICH SAYS HOW TO +;PERFORM CURSOR-CONTROL FUNCTIONS ON THE TTY. THE POSSIBILITIES ARE: +DEFSYM %TN==:777777 +DEFSYM %TNPRT==:0 ;PRINTING TTY. +DEFSYM %TNDP==:1 ;TTY USES DATAPOINT CURSOR CTL CODES. +DEFSYM %TNODP==:2 ;TTY IS A LOSING DATAPOINT. +DEFSYM %TNIML==:3 ;TTY USES IMLAC CURSOR CODES. +DEFSYM %TNTEK==:4 ;TEKTRONIX 4000 SERIES +DEFSYM %TNTV==:5 ;TTY IS A KNIGHT TV DISPLAY. +DEFSYM %TNMEM==:6 ;TTY IS A MEMOWRECK. +DEFSYM %TNSFW==:7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. +DEFSYM %TNTRM==:10 ;TTY IS A TERMINET. +DEFSYM %TNESC==:11 ;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52) +DEFSYM %TNDTM==:12 ;DATAMEDIA +DEFSYM %TNRAY==:13 ;TELERAY 1061 +DEFSYM %TNHDS==:14 ;HDS CONCEPT-100 +DEFSYM %TNH19==:15 ;H19 +DEFSYM %TNAAA==:16 ;Ann Arbor Ambassador +DEFSYM %TNMAX==:17 + + +;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR +;TERMINAL ATTACHED TO EACH LINE. + +;LEFT HALF BITS ARE: +DEFSYM %TO==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TOALT==:200000 ;4.8 => STANDARDIZE ALTMODES. +DEFSYM %TOCLC==:100000 ;4.7 => CONVERT LOWER CASE TO UPPER. +DEFSYM %TOERS==:40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. +DEFSYM %TOHDX==:20000 ;4.5 => THIS TTY IS HALF-DUPLEX. +DEFSYM $TOHDX==:370100 +DEFSYM %TOMVB==:10000 ;4.4 => THIS TTY CAN BACKSPACE. +DEFSYM %TOSAI==:4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. +DEFSYM %TOSA1==:2000 ;4.2 INIT %TSSAI OF NEW JOBS. +DEFSYM %TOOVR==:1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. +DEFSYM %TOMVU==:400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A + ; DISPLAY). +DEFSYM %TOMOR==:200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY + ; (ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). +DEFSYM %TOROL==:100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. +DEFSYM %TORAW==:40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. +DEFSYM %TOLWR==:20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. +DEFSYM %TOFCI==:10 ;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET +DEFSYM %TOIML==:4 ;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC + ; SENDS ^L. +DEFSYM %TOLID==:2 ;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES) +DEFSYM %TOCID==:1 ;3.1 => %TDICP, %TDDCP WORK + ; (INSERT AND DELETE CHARACTERS) + +;RIGHT HALF: +DEFSYM %TP==:707252 ;BIT TYPEOUT MASK +DEFSYM %TPPLF==:100000 +DEFSYM $TPPLF==:170300 ;3-BIT FIELD SAYING HOW TO PAD LF. + ; 0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. +DEFSYM %TPPCR==:10000 +DEFSYM $TPPCR==:140300 ;3-BIT FIELD SAYING HOW TO PAD CR. + ; 7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. + ; 0 - DON'T. 1 - NORMAL. 2 - DOUBLE. + ; ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL + ; CURSOR MOTION. + ; 4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. + ; ON TERMINETS, 0 => NO PADDING, ELSE 1,2,3,4,5 + ; ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS. +DEFSYM %TPPCW==:6 ;FOR MEMO WRECK. +DEFSYM %TPPTB==:1000 +DEFSYM $TPPTB==:110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER + ; TAB. 0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING + ; CHARS NEEDED> BUT ON A DISPLAY, TABS ARE NEVER + ; PADDED AND THIS FIELD IS 1 TO USE TABS, 2 TO USE + ; ABSOLUTE CURSOR POSITIONING, 3 TO USE BOTH, 0 TO + ; USE NEITHER. +DEFSYM %TPMTA==:400 ;1.9 => HARDWARE META KEY SETS 8TH BIT +DEFSYM %TPPRN==:200 ;1.8 => INTERCHANGE () WITH [] ON INPUT +DEFSYM %TPTEL==:100 ;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET + ; PROTOCOL +DEFSYM %TPCBS==:40 ;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK + ; SLASH ON INPUT (THE "INTELLIGENT TERMINAL + ; PROTOCOL"). +DEFSYM %TP11T==:20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. NOT + ; SETTABLE BY USER. +DEFSYM %TPORS==:10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO + ; SOMETHING. +DEFSYM %TPRSC==:4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD + +;DEFINE BITS WHICH ARE USER-OPTIONS +DEFSYM %TOUSR==:%TOCLC+%TOSA1+%TOMOR+%TOROL +DEFSYM %TPUSR==:%TPPRN+1 ;THE 1 IS TO AVOID INTEFERING WITH BIT-TYPE-OUT + +DEFSYM %TQ==1,,701725 ;TTY "SMARTS" BITS IN LH(TTYSMT) +DEFSYM %TQIM1==300000 ;TTY IS A PDS1 +DEFSYM %TQIM4==200000 ;TTY IS A PDS4 +DEFSYM %TQP11==100000 ;TTY IS A PDP11 +DEFSYM %TQMCH==700000 ;4.7-4.9 MACHINE TYPE, 0 => NOTHING SPECIAL +DEFSYM %TQGRF==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL +DEFSYM %TQGPH==1 ;3.1 UNDERSTANDS GRAPHICS PROTOCOL (OBSOLETE NAME) +DEFSYM %TQSET==2 ;3.2 HAS MULTIPLE OBJECT SETS +DEFSYM %TQREC==4 ;3.3 HAS RECTANGLE COMMANDS +DEFSYM %TQXOR==10 ;3.4 HAS XOR MODE +DEFSYM %TQBNK==20 ;3.5 HAS BLINKING +DEFSYM %TQVIR==40 ;3.6 VIRTUAL COORDINATES +DEFSYM %TQHGT==76000 ;4.2-4.6 CHARACTER HEIGHT IN DOTS +DEFSYM %TQWID==1700 ;3.7-4.1 CHARACTER WIDTH IN DOTS + +DEFSYM %TR==534052 ;RH(TTYSMT) +DEFSYM %TRGIN==400000 ;2.9 HAS GRAPHIC INPUT +DEFSYM %TRGHC==200000 ;2.8 HAS GRAPHIC HARDCOPY +DEFSYM %TRLED==100000 ;2.7 HAS LOCAL EDITING PROTOCOL. +DEFSYM %TRSCN==040000 ;2.6 HAS RASTER COMMANDS +DEFSYM %TRLSV==034000 ;2.3-2.5 NONZERO MEANS TERMINAL SUPPORTS 4**N SAVED + ; LINES. +DEFSYM %TRTIM==003700 +DEFSYM $TRTIM==060500 ;5 BIT FIELD WHICH IS THE SIGNED OFFSET FROM GMT + ; MINUS #o20; A VALUE OF ZERO MEANS DON'T KNOW, + ; DON'T CARE, OR USER PROGRAM HASN'T IMPLEMENTED IT + ; YET + +;GROUP NUMBER CHARACTERS +;[ 0 ^A-^F ^K-^L ^N-^R ^T-^Z ^] ^^ ^_ ^@ ^\ +; 1 A-Z LOWER CASE A-Z +; 2 0-9 +; 3 !"#$(DOLLAR)%&',.:;?@\ (ACCENT GRAVE) +; (VERTICAL BAR) (TILDE) +; 4 *+-/=^_ +; 5 <>[]() (LEFT BRACE) (RIGHT BRACE) +; 6 ^G ^S +; 7 LF ^I(TAB) +; 10 (ALTMODE) +; 11 CR +; 12 RUBOUT +; 13 SPACE ^H(BACKSPACE) + +;TTYST1 HAS GROUPS 0 THROUGH 5 FROM LEFT TO RIGHT +;TTYST2 HAS 6 THROUGH 13 +;EACH GROUP HAS SIX BITS AS FOLLOWS: +DEFSYM %TG==:777725 ;BIT TYPEOUT MASK +DEFSYM %TGINT==:1 ;N.1 => INTERRUPT ON THIS GROUP +DEFSYM %TGACT==:2 ;N.2 => ACTIVATE ON THIS GROUP (FOR SWAPPING) +DEFSYM %TGSPC==:4 ;N.3 => SPECIAL HACKS. + ; (THIS SET ON GROUP 1 => CONVERT LOWER CASE) +DEFSYM %TGIMG==:10 ;N.4 => IMAGE MODE OUTPUT (N.4=0 => ASCII MODE) + ;N.6-N.5 => ECHO MODE + ; 00 => NO ECHO +DEFSYM %TGPIE==:20 ; 01 => PI ECHO (ECHO CHARACTER WHEN TYPED) +DEFSYM %TGMPE==:40 ; 10 => MAIN PROGRAM ECHO (ECHO WHEN MAIN + ; PROGRAM RECEIVES CHARACTER) + +;TTYSTS HAS RANDOM BITS ASSOCIATED WITH THE TELETYPE +DEFSYM %TS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TSFRE==:400000 ;4.9 => TTY FREE +DEFSYM %TSCLE==:200000 ;4.8 => ECHO ^L AS UPARROW-L EVEN ON DISPLAYS + ;(OTHERWISE WOULD ECHO AS CLEAR SCREEN) +DEFSYM %TSHDX==:100000 ;4.7 REFLECTS %TOHDX BIT. +DEFSYM %TSFCO==:040000 ;4.6 => HANDLE 9-BIT CHARS ON OUTPUT, USING ALPHA, + ; BETA, EPSILON. +DEFSYM %TSALT==:020000 ;4.5 => DON'T STANDARDIZE ALTMODE. +DEFSYM %TSROL==:010000 ;4.4 => SCROLL MODE. +DEFSYM %TSSAI==:004000 ;4.3 => ECHO AND ASCII MODE SHOULD USE SAIL CHAR SET. +DEFSYM %TSACT==:002000 ;4.2 => GOBBLE NEXT CHAR REGARDLESS OF ACTIVATION + ; STATUS +DEFSYM %TSNEA==:001000 ;4.1 => DON'T ECHO IN ECHO AREA; ECHO IN M.P. AREA +DEFSYM %TSINT==:000400 ;3.9 => INT ON NEXT CHAR REGARDLESS +DEFSYM %TSMOR==:000200 ;3.8 => INHIBIT **MORE**. +DEFSYM %TSATY==:000100 ;3.7 SET BY .ATTY, SAYS TTY WAS TAKEN AWAY & RETURNED. + ;3.6-3.5 UNUSED. +DEFSYM %TSNOE==:000010 ;3.4 => DEFER ECHOING, AND MAKE INPUT IOT'S ACT AS + ; IF %TIECH=1. +DEFSYM %TSLCZ==:000004 ;3.3 => LAST CHARACTER TYPED WAS ^Z + ; (NOT PRECEEDED BY ^_) +DEFSYM %TSSII==:000002 ;3.2 => SUPER IMAGE INPUT MODE. ^Z AND ^_ INHIBITED. +DEFSYM %TSCNS==:000001 ;3.1 => TTY IN USE AS CONSOLE CONTROLLING A TREE. +DEFSYM $TSCNS==:220100 + ;RH => USER INDEX + ; -1 => NO USER + +;TTYCOM VARIABLE. +;4.9 => TTY IN COMMUNICATE MODE +DEFSYM %TC==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %TCLFT==:200000 ;4.8 => LOCAL FEED THROUGH (SET IF MY PRGM + ; RECEIVING HIS CHRS) +DEFSYM %TCRFT==:100000 ;4.7 => REMOTE FEED THROUGH (SET IF HIS PRGM + ; RECEIVING MY CHRS) +DEFSYM %TCICO==:40000 ;4.6 => INPUT COMMUNICATE OVERRIDE (SET IF MY + ; CONSOLE FEEDING MY PRGM EVEN THO IN COMM MODE). + ; ALSO IMPLIES OUTPUT OVER-RIDE +DEFSYM %TCOCO==:20000 ;4.5 => OUTPUT COMMUNICATE OVERRIDE (SET IF MY + ; PRGM'S OUTPUT TO APPEAR ON MY CONSOLE ONLY EVEN + ; THO IN COM MODE) + ;4.4-4.3 => MESSAGE RECEIPT SWITCH + ; 00 => ACCEPT +DEFSYM %TCRFS==:10000 ; 10 => REFUSE +DEFSYM %TCQRY==:4000 ; 01 => INTERROGATE +DEFSYM %TCMTR==:2000 ;4.2 SET FOR TTY WHOSE MOTOR IS OFF & MUST BE + ; TURNED ON BEFORE ANY OTHER OUTPUT IS DONE. (ONLY + ; TERMINETS HAVE THEIR MOTORS SHUT OFF BY ITS). +DEFSYM %TCECH==:1000 ;4.1 THE OUTPUT BUFFER CONTAINS ECHOING OUTPUT. + ; THIS MAKES OUTPUT RESET DO NOTHING. THE BUFFER + ; MUST NOT CONTAIN ECHO OUTPUT AND NORMAL OUTPUT AT + ; ONE TIME. +DEFSYM %TCLED==:400 ;3.9 JOB WHICH OWNS TTY WANTS LOCAL EDITING IN + ; TERMINAL. SET BY CTL BIT 1.1 IN SCPOS; CLEARED + ; BY SWITCHING JOBS. +DEFSYM %TCDET==:200 ;3.8 CONSOLE'S TREE DETACHED BY TOP LEVEL + ; INTERRUPT. SET BY NDETAC AS SIGNAL TO SYSCFM + ; (CNSL-FREE-MSG TYPER) +DEFSYM %TCDNG==:100 ;3.7 => TYPE BELL ON TTY (BECAUSE INPUT BFR FULL). +DEFSYM %TCCBK==:40 ;3.6 => READING UNAME OR TTY # AFTER ^_K. +DEFSYM %TCCBS==:20 ;3.5 => READING UNAME OR TTY # AFTER ^_S. +DEFSYM %TCFPD==:10 ;3.4 => FIRST PART OF MULTI-CHAR OUTPUT SEQUENCE DONE. +DEFSYM %TCTPN==:4 ;3.3 TYPE ^_N ON LEAVING COM MODE (UNLESS USER + ; EXPLICITLY TYPES ^_N) +DEFSYM %TCPAD==:2 ;3.2 0 => PADDING NECESSARY ON DATAPOINT. +DEFSYM %TCHNG==:1 ;3.1 TTY'S DONE FLAG APPEARS TO BE FRIED, TIME OUT + ; QUICKLY +;RH => USER INDEX COMMUNICATING WITH (-1 NONE) + +;TTYTYP TABLE +;THIS TABLE HOLDS BITS THAT DESCRIBE THE LINE +;AND ITS CONTROLLER, RATHER THAN THE TTY ATTACHED TO THE LINE. +DEFSYM %TT==:1,,525360 ;BIT TYPEOUT MASK +DEFSYM %TTLCL==:400000 ;BIT 4.9 ONE => LOCAL TTY +DEFSYM %TT340==:200000 ;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE +DEFSYM %TT3HP==:100000 ;BIT 4.7 HIGH PRIORITY ON 340 +DEFSYM %TTPAR==:004000 ;BIT 4.3 +DEFSYM %TTDDI==:002000 ;BIT 4.2 DONT DING ON EXCESS INPUT +DEFSYM $TTISP==:260400 ;3.8-3.5 INPUT SPEED CODE +DEFSYM %TTISP==:20 +DEFSYM $TTOSP==:220400 ;3.4-3.1 OUTPUT SPEED CODE +DEFSYM %TTOSP==:1 +;RIGHT HALF BITS +DEFSYM %TY==:525252 ;BIT TYPEOUT MASK +DEFSYM %TYDPK==:400000 ;BIT 2.9 (DATAPOINT KLUDGE TTY LINE) +DEFSYM %TYSTY==:200000 ;BIT 2.8 PSEUDO TTY +DEFSYM %TYNVA==:100000 ;BIT 2.7 NOVA TTY +DEFSYM %TYMTY==:040000 ;BIT 2.6 MORTON BOX +DEFSYM %TYDIL==:020000 ;BIT 2.5 DIAL UP +DEFSYM %TY11T==:010000 ;BIT 2.4 PDP-11 TV TTY. +DEFSYM %TYDL==:004000 ;BIT 2.3 DL-11 TTY +DEFSYM %TYOTY==:002000 ;BIT 2.2 KA-10 CONSOLE TTY +DEFSYM %TYETY==:001000 ;BIT 2.1 DTE20 TTY +DEFSYM %TYNTY==:000400 ;BIT 1.9 TK-10 TTY +DEFSYM %TYMDM==:000200 ;BIT 1.8 LINE DETECTS DIALINS AND HANGUPS +DEFSYM %TYKST==:000100 ;BIT 1.7 KS-10 CONSOLE TTY +DEFSYM %TYDZT==:000040 ;BIT 1.6 DZ-11 TTY ON KS-10 +DEFSYM %TYRLM==:000020 ;BIT 1.5 ROLM DATA SWITCH + +;SPEED CODES ARE DOCUMENTED ON PAGE 3 OF ITS (DEFINE SPEED1) + +;SUPDUP GRAPHICS PROTOCOL COMMANDS: + +DEFSYM %GO==:,,-1 + +DEFSYM %GODLR==:101 ;

Draw line relative, from the cursor to

. +DEFSYM %GODPR==:102 ;

Draw point relative, at

. +DEFSYM %GODRR==:103 ;

Draw rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GODCH==:104 ; <0> + ;Display the chars of starting at the current + ;graphics cursor position. +DEFSYM %GODSC==:105 ; Draws scan bits starting at + ;the current gaphics cursor position. come + ;in bits of 6-6-4. has 100 bit (character + ;gobbled) or 200 bit (interpreted as %TD code) set. +DEFSYM %GODRN==:106 ; <0> Draw run length encoded raster line + ;starting at current graphic cursor. Low six bits are + ;count. 100 bit determines point type (on/off). + +DEFSYM %GODLA==:121 ;

Draw line absolute, from the cursor to

. + ; The same effect as %GODLR, but the arg absolute. +DEFSYM %GODPA==:122 ;

Draw point absolute, at

. +DEFSYM %GODRA==:123 ;

Draw rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOELR==:141 ;

Erase line relative, from the cursor to

. +DEFSYM %GOEPR==:142 ;

Erase point relative, at

. +DEFSYM %GOERR==:143 ;

Erase rectangle relative, corners at

and + ; at the current cursor position. +DEFSYM %GOECH==:144 ; <0> + ;Erase the chars of starting at the current + ;graphics cursor position. +DEFSYM %GOESC==:145 ; . Erase scan bits starting at + ;the current graphics cursor position. +DEFSYM %GOERN==:146 ; <0> Erase run-length encoded rasters + ;starting at current grphaics cursor position. + +DEFSYM %GOELA==:161 ;

Erase line absolute, from the cursor to

. +DEFSYM %GOEPA==:162 ;

Erase point absolute, at

. +DEFSYM %GOERA==:163 ;

Erase rectangle absolute, corners at

and + ; at the current cursor position. + +DEFSYM %GOMVR==:001 ;

Move cursor to point

+DEFSYM %GOMVA==:021 ;

Move cursor to point

, absolute address. +DEFSYM %GOXOR==:002 ; Turn on XOR mode. Bit matrix terminals only. +DEFSYM %GOIOR==:022 ; Turn off XOR mode. +DEFSYM %GOSET==:003 ; Select set. is a 1-character set number, + ; 0 - 177. +DEFSYM %GOMSR==:004 ;

Move set origin to

. Display list + ; terminals only. +DEFSYM %GOMSA==:024 ;

Move set origin to

, absolute address. +DEFSYM %GOINV==:006 ; Make current set invisible. +DEFSYM %GOVIS==:026 ; Make current set visible. +DEFSYM %GOBNK==:007 ; Make current set blink. Canceled by %GOINV + ; or %GOVIS. +DEFSYM %GOCLR==:010 ; Erase whole screen. +DEFSYM %GOCLS==:030 ; Erase entire current set (display list + ; terminals). +DEFSYM %GOPSH==:011 ; Push all input-stream status information, to be + ; restored when graphics mode is exited. +DEFSYM %GOVIR==:012 ; Start using virtual co-ordinates +DEFSYM %GOPHY==:032 ; Resume giving co-ordinates in units of dots. +DEFSYM %GOHRD==:013 ; Divert output to output subdevice . + ; =0 reselects the main display screen. +DEFSYM %GOGIN==:014 ; Request graphics input (mouse, tablet, etc). + ; is the reply code to include in the answer. +DEFSYM %GOLMT==:015 ; + ;Limits graphics to a subrectangle of the + ;screen. %GOCLR will clear only that area. + ;This is for those who would use the rest for text. + +;THE TTYTBL VARIABLE EXISTS FOR EACH JOB. +;IT DESCRIBES THE ATTY-DTTY STATE OF THE JOB +;AND OTHER THINGS THAT HAVE TO DO WITH THE TREE'S +;CONTROLLING TTY ONLY. +DEFSYM %TB==:1,,525277 ;BIT TYPEOUT MASK +DEFSYM %TBNOT==:400000 ;4.9 THIS JOB DOES NOT HAVE THE TTY NOW. +DEFSYM %TBNVR==:200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +DEFSYM %TBINT==:100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY + ; SHOULD INTERRUPT. +DEFSYM %TBWAT==:040000 ;4.6 IF SET, OVERRIDES %TBINT AND %TBNVR, AND + ; FORCES TTY USAGE ATTEMPTS TO HANG. MAY BE ALTERED + ; ONLY BY SUPERIOR. +DEFSYM %TBDTY==:010000 ;4.4 THE JOB DOESN'T HAVE THE TTY, BUT IT IS IN A + ; DTTY'ING STATE. IN OTHER WORDS, THIS JOB DOESN'T + ; WANT TO GIVE THE TTY TO ONE OF ITS INFERIORS. +DEFSYM %TBOUT==:004000 ;4.3 ALLOW TYPEOUT EVEN IF DON'T HAVE TTY (SETTABLE + ; BY SUPERIOR) +DEFSYM %TBINF==:002000 ;4.2 ALLOW INFERIORS TO TAKE ADVANTAGE OF THEIR + ; %TBOUTS. +DEFSYM %TBOIG==:001000 ;4.1 IGNORE OUTPUT (NORMALLY SET BY SUPERIOR). + ; OVERRIDES %TBWAT, %TBINT. +DEFSYM %TBIIN==:000400 ;3.9 INTERRUPT ON ATTEMPT TO DO INPUT. OVERRIDES + ; %TBWAT. NORMALLY SET BY SUPERIOR. +DEFSYM $TBECL==:220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY +DEFSYM %TBECL==:77 + +;RH - IF %TBNOT IS 0, THE RH HAS THE TTY NUMBER. +;OTHERWISE, IF %TBDTY IS 0, THE RH HAS THE USR INDEX OF +;THE INFERIOR THAT THIS JOB GAVE OR WOULD LIKE TO GIVE +;THE TTY TO. OTHERWISE, THE RH IS 0. + +;BITS IN THE PER-STY VARIABLE STYSTS, RETURNED BY STYGET SYSTEM CALL. +DEFSYM %SS==:1,,525252 ;BIT TYPEOUT MASK +DEFSYM %SSHNG==:400000 ;4.9 = 1 => DON'T HANG ON INPUT IOTS +DEFSYM %SSUSE==:200000 ;4.8 = 1 => IN USE +DEFSYM %SSINT==:100000 ;4.7 = 1 => HAVE GIVEN INT ON STY OUTPUT + ; CHNS ALREADY +DEFSYM %SSONT==:040000 ;4.6 = 1 => DITTO FOR STY INPUT (TTY OUTPUT) +DEFSYM %SSOHG==:20000 ;4.5 = 1 => DON'T HANG ON OUTPUT IOT + ;RH = USER INDEX THAT HAS IT OPEN + + +IFN $$TEMP, EXPUNGE DEFSYM diff --git a/system/ch10.defs1 b/system/ch10.defs1 new file mode 100644 index 0000000..1de3bec --- /dev/null +++ b/system/ch10.defs1 @@ -0,0 +1,42 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;Hardware definitions for CH10 PDP-10 CHAOSNET interface + +CHX==470 ;I/O Device number + +;CONI/CONO BITS + ;1.1-1.3 PIA +CHXTEN==10 ;1.4 Transmit interrupt enable +CHXREN==20 ;1.5 Receive interrupt enable +CHXSPY==40 ;1.6 Match any destination (on receive) +CHXLUP==100 ;1.7 Loop back +CHXSWB==200 ;1.8 Swap bytes +CHXHLF==400 ;1.9 Halfword DATAO +CHXXMT==1000 ;2.1 Transmit done (CONI) + ; Transmit or retransmit packet (CONO) +CHXRCV==2000 ;2.2 Receive done (CONI) + ; Enable to receive next packet (CONO) +CHXABT==4000 ;2.3 Transmit aborted (CONI) + ; Reset transmitter (CONO) +$CHXLC==140400 ;2.4-2.7 Lost count (CONI) +CHXRST==10000 ;2.4 Reset (CONO) +CHXCRC==200000 ;2.8 CRC error (CONI) +CHXWLE==400000 ;2.9 Word length error (CONI) +CHXPLE==1,, ;3.1 Packet length error (CONI) +CHXOVR==2,, ;3.2 Overrun (CONI) +$CHXAD==242000 ;3.3-4.9 Chaosnet address (CONI) + diff --git a/system/ch11.defs1 b/system/ch11.defs1 new file mode 100644 index 0000000..9b058ff --- /dev/null +++ b/system/ch11.defs1 @@ -0,0 +1,74 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;; CH11 Unibus Chaosnet Interface definitions + +CAICSR=3,,764140 ;COMMAND STATUS REG +CH%CSR==0 + %CABSY==1 ;0 XMT BUSY (RO) + %CALUP==2 ;1 LOOP BACK (R/W) + %CASPY==4 ;2 RECIEVE MSGS FOR ANY DESTINATION (R/W) + %CARCL==10 ;3 CLEAR THE RECEIVER, IT CAN NOW GOBBLE ANOTHER MSG (WO) + %CAREN==20 ;4 RCV INT ENB (R/W) + %CATEN==40 ;5 XMT INT ENB (R/W) + %CATAB==100 ;6 TRANSMIT ABORTED BY ETHER CONFLICT (RO) + %CATDN==200 ;7 TRANSMIT DONE. SET WHEN TRANSMITTER IS DONE + %CATCL==400 ;8 CLEAR THE TRANSMITTER, MAKING IT READY (WO) + $CALOS==110400 ;9-12 LOST COUNT (RO) [# MSGS RCVED WITH RCV BFR FULL] + ; WHEN MSG IS WAITING IN BUFFER, THIS COUNTS + ; THE MESSAGES THAT MATCHED OUR DESTINATION OR + ; WERE BROADCAST, BUT COULDN'T BE RECIEVED. + ; WHEN RECEIVER IS RE-ENABLED (WRITE 1 INTO %CARDN) + ; THE COUNT IS THEN CLEARED. + ; WHEN A MESSAGE IS LOST, RECEIVER ZAPS ETHER + ; SO TRANSMITTER WILL ABORT (IF MESSAGE WAS DESTINED + ; TO US.) + %CARST==20000 ;13 I/O RESET (WO) + %CAERR==40000 ;14 CRC ERROR (RO) + %CARDN==100000 ;15 RCV DONE. + +CAIMYN==3,,764142 ;MY # (READ ONLY) +CH%MYN==2 ;RETURNS THE [SOURCE] HOST# OF THIS INTERFACE. + +CAIWBF=3,,764142 ;WRITE BUFFER (WRITE ONLY) +CH%WBF==2 ;FIRST WAIT FOR TDONE. (OR SET IT VIA CSR) + ;FIRST WORD IN RESETS TRANSMITTER AND CLEARS TDONE. + ;STORE INTO THIS REGISTER TO WRITE WORDS OF MESSAGE, + ;LAST WORD IN IS DESTINATION ADDRESS, THEN READ CAIXMT. + ;SOURCE ADDRESS AND CHECK WORD PUT IN BY HARDWARE. + +CAIRBF=3,,764144 ;READ BUFFER (READ ONLY) +CH%RBF==4 ;THE FIRST WORD READ WILL BE FILLED TO THE LEFT + ;TO MAKE THE MESSAGE RECIEVED A MULTIPLE OF 16 BITS. + ;IF THE NUMBER OF DATA BITS IN THE MESSAGE WAS A + ;MULTIPLE OF 16, THIS WORD WILL BE THE FIRST WORD PUT + ;INTO THE BUFFER BY THE TRANSMITTING HOST. + ;THE LAST 3 WORDS READ ARE DESTINATION, SOURCE, CHECK. + +CAIRBC=3,,764146 ;RECEIVE BIT COUNTER (READ ONLY) +CH%RBC==6 ;WHEN A MESSAGE HAS BEEN RECEIVED THIS IS ONE LESS THAN + ;THE NUMBER OF BITS IN THE MESSAGE (16 X THE + ;NUMBER OF WORDS INCLUDING THE THREE OVERHEAD WORDS.) + ;AFTER THE LAST WORD (THE CRC WORD) HAS BEEN READ, IT IS 7777 + ;BITS 10 AND 11 ARE THE HIGH ORDER BITS, AND IF THEY ARE ONE, + ;THEN THERE WAS A BUFFER OVERFLOW + +CAIXMT=3,,764152 ;READING THIS INITIATES TRANSMISSION (!!) +CH%XMT==12 ;THE VALUE READ IS ONE'S OWN HOST#. + +;REFERENCING ADDRESSES IN THE GROUP OF 8 WORDS NOT LISTED HERE, OR +;USING COMBINATIONS OF READ/WRITE NOT LISTED HERE, WILL TYPICALLY CAUSE +;STRANGE AND BIZARRE EFFECTS. diff --git a/system/chaos.286 b/system/chaos.286 new file mode 100644 index 0000000..a4413b6 --- /dev/null +++ b/system/chaos.286 @@ -0,0 +1,2795 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +IFE IMPP, IFE CH11P, .ERR NOT EVERYTHING IN CHAOS WILL WORK WITHOUT IMP +IFNDEF FTRCHK, FTRCHK==0 ;PROBABLY FOUND ALL THE BUGS THIS WAS GOOD FOR + ; LONG AGO +IFN FTRCHK, .ERR REDUNDANT CHECKING ENABLED IN CHAOS ROUTINES + +;NOTES: +; WINDOW SIZE ADJUSTMENT STUFF +; ROUND TRIP TIME MEASUREMENT & OTHER METERING +; BETTER METERING, SOME METERS ARE CURRENTLY MISSING + +SUBTTL CH-10 HARDWARE DEFINITIONS + +IFN CH10P,[ +CHX==470 ;I/O DEVICE NUMBER + +;CONI/CONO BITS + ;1.1-1.3 PIA +CHXTEN==10 ;1.4 TRANSMIT INTERRUPT ENABLE +CHXREN==20 ;1.5 RECEIVE INTERRUPT ENABLE +CHXSPY==40 ;1.6 MATCH ANY DESTINATION +CHXLUP==100 ;1.7 LOOP BACK +CHXSWB==200 ;1.8 SWAP BYTES +CHXHLF==400 ;1.9 HALFWORD DATAO +CHXXMT==1000 ;2.1 TRANSMIT DONE (CONI) + ; TRANSMIT OR RETRANSMIT PACKET (CONO) +CHXRCV==2000 ;2.2 RECEIVE DONE (CONI) + ; ENABLE TO RECEIVE NEXT PACKET (CONO) +CHXABT==4000 ;2.3 TRANSMIT ABORTED (CONI) + ; RESET TRANSMITTER (CONO) +$CHXLC==140400 ;2.4-2.7 LOST COUNT (CONI) +CHXRST==10000 ;2.4 RESET (CONO) +CHXCRC==200000 ;2.8 CRC ERROR (CONI) +CHXWLE==400000 ;2.9 WORD LENGTH ERROR (CONI) +CHXPLE==1,, ;3.1 PACKET LENGTH ERROR (CONI) +CHXOVR==2,, ;3.2 OVERRUN (CONI) +$CHXAD==242000 ;3.3-4.9 CHAOSNET ADDRESS (CONI) +];CH10P + +IFN CH11P,[ +$INSRT KSNET +];CH11P + +SUBTTL CHAOS NET VARIABLES + +EBLK + +$CHXRI==001200 ;REAL INDEX PART (LOW TEN BITS) - IS IN LH(IOCHNM) +$CHXUN==120600 ;UNIQUIZATION PART (TOP SIX BITS) +CHXMUN==1_6-1 ;MAXIMUM VALUE OF UNIQUIZER +MXWIND==100 ;MAXIMUM WINDOW SIZE (8K WORDS) +.SEE MYCHAD ;SUBNET AND HOST OF MYSELF +.SEE DLCP ;1 MEANS USE DL10 TO GET TO CHAOS NET +.SEE T11CHP ;1 MEANS USE TEN-11 INTERFACE TO GET TO CHAOS NET +.SEE CH10P ;1 MEANS USE CH10 HARDWARE TO GET TO CHAOS NET +.SEE CH11P ;1 MEANS USE UNIBUS CHAOSNET HARDWARE ON KS10 + +;Internet address of my Chaosnet Interface +IMPUS4==<.BYTE 4 ? 0 ? .BYTE 8 ? 128. ? 31. ? .BYTE 16. ? MYCHAD> + +;PER-INDEX VARIABLES + +CHSUSR: REPEAT NINDX,-1 ;-1 INDEX NOT IN USE + ;OTHERWISE RH USER + $CHSUO==220600 ;3.1-3.6 OUTPUT CHANNEL NUMBER (77=IOPUSHED) + $CHSUI==300600 ;3.7-4.3 INPUT CHANNEL NUMBER (77=IOPUSHED) + ;4.9 ZERO IF IN USE + +CHSSTA: REPEAT NINDX,-1 ;RH STATE, LH FLAGS + %CF==525252(1) + %CFOFF==400000 ;SIGN BIT MEANS TURNED OFF AT PI LEVEL, NO TALKING TO NETWORK + %CFSTS==200000 ;SEND STS PACKET AS SOON AS POSSIBLE (1/2 SECOND CLOCK) + %CFCLS==100000 ;HALF-CLOSED FLAG + %CFSTY==040000 ;DIRECT-CONNECTED TO STTY FLAG + $CFTTN==220600 ;TTY NUMBER OF STTY CONNECTED TO + + %CS==,,-1 + .SEE %CSCLS ;FOR SYMBOLS FOR STATES + +CHSNBF: BLOCK NINDX ;LH LENGTH(CHSPBF), RH LENGTH(CHSIBF) +CHSNOS: BLOCK NINDX ;NUMBER OF FREE OUTPUT SLOTS IN THE WINDOW +CHSIBF: BLOCK NINDX ;RECEIVE BUFFER POINTERS FIRST,,LAST +CHSPBF: BLOCK NINDX ;OUT OF ORDER RECEIVE BUFFER POINTERS FIRST,,LAST +CHSOBF: BLOCK NINDX ;TRANSMIT BUFFER POINTERS FIRST,,LAST +CHSITM: BLOCK NINDX ;TIME OF LAST INPUT FROM NET +CHSWIN: BLOCK NINDX ;WINDOW SIZE RECEIVE,,TRANSMIT +CHSPKN: BLOCK NINDX ;LAST PACKET# GIVEN TO USER,,LAST PACKET# SENT BY USER +CHSACK: BLOCK NINDX ;LAST PACKET# ACKNOWLEDGED RECEIVE,,TRANSMIT (START OF WINDOW) +CHSLCL: REPEAT NINDX,<.BYTE 16. ? MYCHAD ? 100000+.RPCNT> + ;BYTE (16) LOCAL HOST, LOCAL INDEX (4) 0 + ;NOTE THIS SAVES THE UNIQUIZER BITS FOR THIS INDEX +CHSFRN: BLOCK NINDX ;BYTE (16) FOREIGN HOST, FOREIGN INDEX (4) 0 +;THESE FOUR ARE FOR BYTE-STREAM I/O +CHSOBP: BLOCK NINDX ;BYTE PNTR TO OUTPUT BUFFER, 0 IF NONE +CHSOBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF BYTE SPACES LEFT IN OUTPUT BUFFER +CHSIBP: BLOCK NINDX ;BYTE PNTR TO INPUT BUFFER, 0 IF NONE +CHSIBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF VALID BYTES REMAINING IN INPUT BUFFER + +CHAOSW: -1 ? 0 ;SWITCH FOR ALLOCATING INDICES +CHALCP: 0 ;LAST INDEX ALLOCATED, USED TO CIRCULARIZE ALLOCATION + +CHIRFJ: SIXBIT/CHAOS/ ? 0 ;AGENT OF CHAOS +.SEE NETUSW ;NON-ZERO ENABLES RFC'S FROM HOSTS OTHER THAN SELF. + +;METERS + +CHNPI: 0 ;NUMBER OF PACKETS INPUT (REALLY TO 10) +CHNPO: 0 ;NUMBER OF PACKETS OUTPUT (ALL CAUSES) +CHNPF: 0 ;NUMBER OF PACKETS FORWARDED +CHNSTS: 0 ;NUMBER OF STS PACKETS OUTPUT +CHNSNS: 0 ;NUMBER OF SNS PACKETS OUTPUT +CHNRTR: 0 ;NUMBER OF RETRANSMITTED PACKETS OUTPUT +CHNPFL: 0 ;NUMBER OF PACKETS DISCARDED (FORWARDING LOOP) +CHNPD: 0 ;NUMBER OF PACKETS DISCARDED (DUPLICATES) +CHNIPI: 0 ;NUMBER OF INTERNET PACKETS IN FROM CHAOSNET +CHNIPO: 0 ;NUMBER OF INTERNET FRAGMENTS OUT TO CHAOSNET + +;BUFFER QUEUES. EACH HAS A ONE-WORD HEADER, WHICH IS ZERO +;IF IT IS EMPTY, OR CONTAINS FIRST,,LAST BUFFER ADDRESS. + +CHQFRE: 0 ;FREE LIST +CHQRFC: 0 ;PENDING RFCS +CHQLSN: 0 ;PENDING LISTENS +CHCLNQ: 0 .SEE CHCLN + +CHFRBF: 0 ;NUMBER OF FREE BUFFERS +CHTTBF: 0 ;TOTAL NUMBER OF BUFFERS +IF2 CHMXBF==50.*<1024./<%CPMXW+2>> ;MAX CORE FOR CHAOS NET 50K +CHMXTM: 0 ;TIME OF LAST COMPLAINT ABOUT USING TOO MUCH CORE + +IFN T11CHP,[ +;VARIABLES FOR TEN-11 INTERFACE CONNECTING TO CHAOS NET + +.SEE T11CHS ;EXEC ADDRESS OF PDP11 COMMUNICATION AREA +T11VER=T11CHS ;VERSION NUMBER +T11I10=T11CHS+1 ;INIT 10 +T11I11=T11CHS+2 ;INIT 11 +T11PRM=T11CHS+3 ;.WORD BUFFER SIZE, # BUFFERS + ;THEN 4 SPARE DOUBLEWORDS +T11IBB: T11CHS+8 ;BEGINNING OF INPUT BUFFERS +T11IBE: 0 ;END OF INPUT BUFFERS +T11IBP: 0 ;POINTER TO NEXT INPUT BUFFER +T11OBB: 0 ;BEGINNING OF OUTPUT BUFFERS +T11OBE: 0 ;END OF OUTPUT BUFFERS +T11OBP: 0 ;POINTER TO NEXT OUTPUT BUFFER +T11BSZ: 0 ;BUFFER SIZE IN PDP10 WORDS +T11WIN: 0 ;1 WINNING, -1 HAVE TOLD 11 TO INIT, 0 NOT WINNING +T11XMQ: 0 ;QUEUED TRANSMISSION QUEUE +T11CKE: 0 ;COUNT OF CHECKSUM ERRORS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +];T11CHP + +IFN DLCP,[ +;VARIABLES FOR INTERFACE TO CHAOS NET ON PDP11 ON DL10 +;.SEE INDICATES A VARIABLE SHARED BETWEEN 10 AND 11 +;NOTE THAT THE DL10 HARDWARE LIMITS PACKET LENGTH TO 256 WORDS (1K BYTES) + +.SEE DLCINI ;WHEN THE 11 SEES THIS NON-ZERO, IT KNOWS ITS HAS + ; BEEN RELOADED AND RESETS ITS PACKET POINTER TO 0 + ; AND CLEARS DLCINI. +DLCSBF: 0 ;CURRENT BUFFER, 10 SEND SIDE (1 OR 0) + +DLCSA1: 0 ;ADDRESS OF PACKET BEING SENT +DLCSA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCSP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCSP2 ;DITTO, SECOND BUFFER +.SEE DLCSS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 SENT TO 11, 2 11 DONE +.SEE DLCSS2 ;STATE FOR BUFFER 2 + +DLCRA1: 0 ;ADDRESS OF PACKET BUFFER RECEIVING A PACKET +DLCRA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCRP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCRP2 ;DITTO, SECOND BUFFER +.SEE DLCRS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 AWAITING 11, 2 CONTAINS A PACKET +.SEE DLCRS2 ;STATE FOR BUFFER 2 + +DLCXMQ: 0 ;TRANSMIT BUFFER LIST FOR DL10 + ;NOTE THAT THIS IS NOT A REGULAR BUFFER LIST SINCE + ;IT IS THREADED THROUGH LH INSTEAD OF RH. WE DO MAINTAIN + ;POINTERS TO FIRST,,LAST HOWEVER +];DLCP + +IFN CH10P,[ +;VARIABLES FOR CH10 INTERFACE ONLY + +CHXCNO: CHXREN+CHXTEN+CHXCHN ;CONO BITS CURRENTLY IN EFFECT +];CH10P + +IFN CH11P,[ +;VARIABLES FOR CH11 INTERFACE ONLY + +CHXCSR: %CAREN+%CATEN ;CURRENT BITS WANTED IN CSR +];CH11P + +IFN CH10P+CH11P,[ +;VARIABLES THAT WOULD OTHERWISE BE IN THE FRONT-END + +CHXXMQ: 0 ;HEAD,,TAIL OF TRANSMIT QUEUE +CHOSTA: 0 ;OUTPUT STATUS: 0 IDLE, ELSE NUMBER OF TRANSMISSIONS +NCHRTR==4 ;TRANSMIT UP TO 4 TIMES IN FACE OF COLLISIONS + +;ROUTING STUFF +NSUBNT==122. ;122 is maximum possible +SBNRUT: REPEAT NSUBNT, 1000,,3040 ;COST,,GATEWAY ADDRESS + +;EXTRA METERS +CHNABT: 0 ;NUMBER OF TRANSMIT ABORTS +CHNCRC: 0 ;NUMBER OF CRC ERRORS BEFORE READING PACKET +CHNCR2: 0 ;NUMBER OF CRC ERRORS AFTER READING PACKET +CHNWLE: 0 ;NUMBER OF WORD LENGTH ERRORS (NOT MULTIPLE OF 16 BITS) +CHNPLE: 0 ;NUMBER OF PACKET LENGTH ERRORS (DISAGREES WITH LENGTH IN HEADER) +CHNLOS: 0 ;NUMBER OF PACKETS LOST DUE TO RECEIVER BUSY +];CH10P+CH11P +IFN CH11P,[ +CHNSPZ: 0 ;NUMBER OF TIMERS BIT COUNTER SPAZZED +];CH11P + +BBLK + +;Get definitions of packet format + +IF1,[ +$INSRT CHSDEF + +PKTBSZ==%CPMXW+2 ;PACKET BUFFER IS 2 HEADER WORDS + MAX SIZE PACKET +IFN >-PKTBSZ, .ERR PKTBSZ IS SUPPOSED TO BE A POWER OF 2 + +$CPKSX==$CHXRI+40000,,2 ;REAL PART OF SOURCE INDEX +$CPKDX==$CHXRI+40000,,1 ;REAL PART OF DESTINATION INDEX + +];IF1 + +;;; Debugging Info + +;;; This contains the last N headers received from the network +NRECHD==20 +EBLK +RECHDP: RECHDR ;POINTER TO NEXT +RECHDR: BLOCK NRECHD*%CPKDT +BBLK + +SUBTTL CHAOS NET OPEN (.CALL CHAOSO) + +;.CALL CHAOSO,RCVCHN,XMTCHN, + +CHASO: JRST OPNL12 ; Say "mode not avail" +CHAOSO: HRRZS A + HRRZS B + CAIGE A,20 + CAIL B,20 + JRST OPNL14 ;BAD CHANNEL NUMBER ARGUMENT + CAMN A,B + JRST OPNL33 ;BOTH CHANNELS SAME IS ILLEGAL + PUSH P,A ;SAVE ARGS, CLOSE THE SPECIFIED CHANNELS + PUSH P,B + PUSH P,C + MOVE R,A + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + MOVE R,-1(P) ;B + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,C + POP P,B + POP P,A + MOVE U,USER ;TO SAVE ULCERS + HRRZM A,UUAC(U) ;REMEMBER INPUT CHNL # FOR ERRS + PUSHJ P,SWTL ;LOCK CHAOS INDEX ASSIGNMENT SWITCH + CHAOSW + MOVE I,CHALCP ;ALLOCATE AN INDEX + SOJL I,CHASO2 +CHASO1: SKIPL CHSUSR(I) + SOJGE I,CHASO1 + JUMPGE I,CHASO3 +CHASO2: MOVEI I,NINDX ;REACHED BEGINNING, WRAP AROUND TO END + CAMN I,CHALCP + JRST OPNL6 ;ALL INDICES IN USE + MOVEM I,CHALCP + SOJA I,CHASO1 + +CHASO3: MOVEM I,CHALCP ;SAVE SCAN POINTER FOR NEXT TIME + PUSHJ P,CHASO4 ;INIT VARIOUS STUFF + CAILE C,MXWIND ;SET UP WINDOW SIZE + MOVEI C,MXWIND ;DON'T LET USER USE UP TOO MUCH WIRED CORE + HRLZM C,CHSWIN(I) + HRRZM U,CHSUSR(I) ;VARIABLES INITIALIZED, MAKE INDEX IN USE. + DPB A,[$CHSUI,,CHSUSR(I)] + DPB B,[$CHSUO,,CHSUSR(I)] + HRLZ T,I ;SET UP USER'S IOCHNM WORDS + HRRI T,CHAIDN + ADDI A,IOCHNM(U) + MOVEM T,(A) + HRRI T,CHAODN + ADDI B,IOCHNM(U) + MOVEM T,(B) + JRST LSWPJ1 ;SUCCESS RETURN + +;INITIALIZE CONNECTION IN I +CHASO4: SETZM CHSNBF(I) + SETZM CHSNOS(I) + SETZM CHSIBF(I) + SETZM CHSPBF(I) + SETZM CHSOBF(I) + SETZM CHSACK(I) + SETZM CHSPKN(I) ;START PACKET NUMBERING AT ONE + SETZM CHSOBP(I) + SETZM CHSOBC(I) + SETZM CHSIBP(I) + SETZM CHSIBC(I) + MOVSI T,%CFOFF .SEE %CSCLS + MOVEM T,CHSSTA(I) + LDB TT,[$CHXUN+40000,,CHSLCL(I)] + CAIE TT,CHXMUN ;INCREMENT THE UNIQUIZER + AOSA TT + MOVEI TT,1 ;BUT MAKE SURE IT ISN'T ZERO + DPB TT,[$CHXUN+40000,,CHSLCL(I)] + SETZM CHSFRN(I) + POPJ P, + +SUBTTL CHAOS NET CLOSE, FINISH, WHYINT, NETBLK, CHAOSQ + +;CLOSE A CHAOS CHANNEL. +CHACLS: HLRZ I,(R) ;GET VARIABLES INDEX + MOVSI A,%CFCLS + TDNN A,CHSSTA(I) ;ONLY REALLY CLOSE WHEN BOTH CHANNELS CLOSED + JRST CHACS7 + PUSHJ P,CHACS1 ;FLUSH ALL BUFFERS OF THIS CONNECTION + HRRZ T,CHSSTA(I) + CAIN T,%CSOPN + PUSHJ P,CHABGI ;SEND A CLS IF OPEN AND MEM AVAIL + JRST CHACS4 + MOVE T,CHSFRN(I) + MOVEM T,%CPKS(A) + MOVE T,CHSLCL(I) + MOVEM T,%CPKD(A) + MOVEI B,[ASCIZ/Channel closed/] + PUSHJ P,CHIRF2 +CHACS4: CONO PI,NETOFF + SETZM (R) ;CLOSE THIS CHANNEL + SETOM CHSUSR(I) ;RETURN INDEX + MOVE W,CHQLSN ;FLUSH ANY PENDING LSN PACKET + SETZM CHQLSN +CHACS5: MOVEI Q,W ;GET NEXT PACKET OFF OLD LIST + PUSHJ P,CHAQGF + JUMPE A,NETONJ ;EXHAUSTED + LDB B,[$CPKSX(A)] ;GET OWNER + CAME B,I + JRST [ MOVEI Q,CHQLSN ;NOT THIS INDEX, PUT BACK + PUSHJ P,CHAQPL + JRST CHACS5 ] + PUSHJ P,CHABRT ;FREE + JRST CHACS5 + +CHACS7: IORM A,CHSSTA(I) .SEE %CFCLS + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + MOVEI T,77 ;CLOSE THAT CHANNEL + DPB T,B + SETZM (R) + POPJ P, + +;THIS FLUSHES ALL BUFFERS FOR CONNECTION IN I +CHACS1: MOVSI A,%CFOFF ;INHIBIT RETRANSMISSIONS + IORB A,CHSSTA(I) + LDB E,[$CFTTN,,CHSSTA(I)] + EXCH E,I + TLNE A,%CFSTY + PUSHJ P,NSTYN0 ;DISCONNECT FROM STY + JFCL + EXCH E,I +IFN DLCP,[ + MOVEI Q,DLCXMQ ;REMOVE THIS INDEX'S BUFFERS FROM DL10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ ;REMOVE THIS INDEX'S BUFFERS FROM TEN11 TRANSMIT LIST + PUSHJ P,CFLXMQ +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ ;REMOVE THIS INDEX'S BUFFERS FROM CH10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];CH10P+CH11P + MOVEI Q,CHSIBF(I) ;RETURN RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSPBF(I) ;RETURN OUT OF ORDER RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSOBF(I) ;RETURN TRANSMIT BUFFERS + PUSHJ P,CHALFR +IFE FTRCHK,[ + SKIPE A,CHSOBP(I) ;RETURN STREAM I/O BUFFERS + PUSHJ P,CHBPFR + SKIPE A,CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK +IFN FTRCHK,[ + SKIPN A,CHSOBP(I) + JRST .+3 + SETZM CHSOBP(I) + PUSHJ P,CHBPFR + SKIPN A,CHSIBP(I) + JRST .+3 + SETZM CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK + POPJ P, + +;.CALL FORCE ON A CHAOS OUTPUT CHANNEL. +CHAFRC: HLRZ I,(R) + SKIPGE CHSSTA(I) .SEE %CFOFF + JRST OPNL7 ;DEVICE NOT READY + AOS (P) ;WILL TAKE SUCCESS RETURN +CHAFC1: SKIPN A,CHSOBP(I) + POPJ P, ;NO BUFFERED OUTPUT TO BE FORCED + SUBI A,1 ;SIOKT LIKES TO POINT BP AT NEXT BUFFER + ANDI A,-PKTBSZ ;GET PACKET POINTER + ADDI A,2 + MOVSI T,(SETZ) ;DATA OPCODE + MOVEM T,(A) .SEE $CPKOP + MOVEI T,%CPMXC ;SET BYTE COUNT + SUB T,CHSOBC(I) + DPB T,[$CPKNB(A)] + PUSHJ P,[JUMPN T,CHODT1 ;IF THERE IS ANYTHING IN THE BUFFER, TRANSMIT IT + JRST CHABRT ] ;OTHERWISE, JUST THROW IT AWAY + SETZM CHSOBP(I) ;NOW THERE IS NO BUFFER + SETZM CHSOBC(I) + POPJ P, + +;.CALL FINISH ON A CHAOS OUTPUT CHANNEL. WAIT FOR ALL BUFFERS +;ON SEND LIST TO GET SENT AND ACKNOWLEDGED. +;HANGS FOREVER IF SOCKET GETS INTO AN IMPROPER STATE, BUT YOU SHOULD GET AN INTERRUPT +CHAFIN: HLRZ T,(R) + PUSHJ P,[HRRZ A,CHSWIN(T) + CAMG A,CHSNOS(T) + AOS (P) + POPJ P, ] + PUSHJ P,UFLS + JRST POPJ1 + +;.CALL WHYINT ON A CHAOS CHANNEL. +;RESULTS ARE: A/ %WYCHA +; B/ STATE +; C/ LH NUMBER OF INPUT PACKETS AVAILABLE +; RH NUMBER OF OUTPUT SLOTS AVAILABLE +; D/ WINDOW SIZE (RECEIVE,,TRANSMIT) +; E/ INPUT CHNL#,,OUTPUT CHNL# +CHAWHY: HLRZ I,(R) + MOVEI A,%WYCHA + HRRZ B,CHSSTA(I) + HRLZ C,CHSNBF(I) ;NUMBER OF PACKETS AVAILABLE + SKIPE CHSIBP(I) + ADD C,[1,,] ;ADD 1 IF PARTIALLY-READ INPUT BUFFER EXISTS + MOVSI D,%CFSTY + TDNE D,CHSSTA(I) + MOVEI C,0 ;NO INPUT AVAILABLE IF DIRECT-CONNECTED + SKIPLE CHSNOS(I) + HRR C,CHSNOS(I) + MOVE D,CHSWIN(I) + LDB E,[$CHSUO,,CHSUSR(I)] + CAIN E,77 + MOVEI E,-1 + LDB T,[$CHSUI,,CHSUSR(I)] + CAIN T,77 + TLOA E,-1 + HRL E,T + JRST POPJ1 + +;.CALL RFNAME on a CHAOS channel. A contains index. +;Returns results analogous to RFNAME on TCP: and (almost) RFNAME on NET:. +;"FN1" is local index, "FN2" is foreign index, "SNAME" is foreign host +;number in HOSTS3 format. +CHARCH: LDB B,[042000,,CHSLCL(A)] + LDB C,[042000,,CHSFRN(A)] + LDB D,[242000,,CHSFRN(A)] + TLO D,(NW%CHS) + POPJ P, + +;IOPDL ROUTINES. I IS 0 FOR IOPUSH, 1 FOR IOPOP. R POINTS AT IOCHNM WORD. +;C(R) IS SET UP TO THIS DEVICE IN EITHER CASE. +CHAIOP: HRRZ T,R ;DISCOVER CHANNEL NUMBER + SUBI T,IOCHNM(U) + SKIPN I + MOVEI T,77 ;IOPUSH, USE 77 + HLRZ I,(R) ;GET CHAOS INDEX + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + DPB T,B ;ADJUST SAVED CHANNEL NUMBER + POPJ P, + +;.CALL NETBLK ON A CHAOS CHANNEL. +;ARG 1 - CHANNEL (COMES IN IN R) +;ARG 2 - UNDESIRED STATE +;ARG 3 - OPTIONAL TIMEOUT, WRITTEN BACK UNLESS IMMEDIATE +;VAL 1 - NEW STATE +;VAL 2 - TIME LEFT +CHANBK: HRRZ T,(R) + CAIL T,CHAIDN + CAILE T,CHAODN +IFN NCPP, JRST ANETBL ;NOT A CHAOS CHANNEL, TRY ARPANET +IFE NCPP, JRST OPNL34 + HLRZ I,(R) + MOVE T,I ;SAVE INDEX IN T FOR FLSINS + CAIGE W,3 + JRST [ HRLOI D,377777 ;NO TIME GIVEN, USE INFINITY + JRST CHANB4 ] + TLNE C,1000 ;SKIP IF POINTER RATHER THAN IMMEDIATE + JRST [ HRRZ D,C ;GET IMMEDIATE TIME + ADD D,TIME + JRST CHANB4 ] + XCTR XRW,[MOVES D,(C)] ;GET TIME, CHECK WRITEABILITY + JUMPGE D,[ MOVNS D ;RELATIVE TIME, MAKE NEGATIVE ABSOLUTE + SUB D,TIME + JRST .+1 ] + UMOVEM D,(C) ;STORE BACK ABSOLUTE TIME + MOVNS D ;MAKE POSITIVE +CHANB4: MOVEM D,AC0S+D(U) ;SAVE ABSOLUTE TIME TO WAIT UNTIL + MOVEM B,AC0S+B(U) ;SAVE UNDESIRED STATE + PUSHJ P,CHANB2 ;SKIP IF STATE CHANGE OR TIMEOUT + PUSHJ P,UFLS + MOVE B,D + SUB B,TIME ;HOW MUCH USED? + HRRZ A,CHSSTA(I) ;NEW STATE + JRST POPJ1 + +CHANB2: HRRZ A,CHSSTA(T) ;CURRENT STATE + CAME A,AC0S+B(U) ;SKIP IF STILL MATCH + JRST POPJ1 + MOVE A,AC0S+D(U) ;TIMEOUT TIME + CAMG A,TIME + AOS (P) + POPJ P, + +;.CALL CHAOSQ +;ARG 1 - ADDRESS OF A %CPMXW-WORD PACKET BUFFER +;FINDS THE FIRST PACKET ON THE PENDING-RFC QUEUE, COPIES IT +;INTO THE USER'S BUFFER, AND RETURNS IT TO THE QUEUE. +CHAOSQ: MOVE C,A ;SAVE POINTER TO USER'S BUFFER + HRL A,A ;MAKE SURE USER'S BUFFER IS SWAPPED IN + XCTR XBRW,[BLT A,%CPMXW-1(C)] ;AND NO MAR BREAK SET + MOVEI Q,CHQRFC ;GET FIRST PACKET ON RFC QUEUE + PUSHJ P,CHAQGF + JUMPE A,OPNL4 ;QUEUE IS EMPTY + PUSHJ P,CHAQPL ;PUT BACK AT END OF QUEUE + HRL C,A ;COPY PACKET TO USER + MOVE T,C + XCTR XBW,[BLT T,%CPMXW-1(C)] + JRST POPJ1 + +SUBTTL CHAOS NET IOT ROUTINES + +;.CALL PKTIOT. ARG1 CHANNEL, ARG2 ADDRESS OF %CPMXW-WORD BUFFER +PKTIOT: HRRZ A,(R) + CAIN A,CHAODN + JRST CHPKO + CAIE A,CHAIDN + JRST OPNL34 ;WRONG TYPE DEVICE +;CHAOSNET INPUT PKTIOT +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKI: PUSHJ P,CHAIOS ;SET UP I, E + HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,[PUSHJ P,CHPKI0 ;LIST EMPTY + JRST CHPKI ] + HRL B,A ;COPY TO USER BEFORE REMOVING FROM LISTS + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,4*%CPKDT+3 ;HEADER PLUS ROUND-UP TO NEXT WORD BOUNDARY + LSH T,-2 ;CONVERT BYTES TO WORDS + ADDI T,-1(B) ;ADDRESS OF LAST DESTINATION WORD + XCTR XBW,[BLT B,(T)] + LDB TT,[$CPKOP(A)] ;GET OPCODE + CAIGE TT,%CODAT ;ACKNOWLEDGE IF DATA + CAIN TT,%COEOF ;OR EOF MARK + PUSHJ P,CHPKIA + SOS CHSNBF(I) ;NOW REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + PUSHJ P,CHABRT ;AND RETURN TO FREE + JRST POPJ1 ;SUCCESS + +;INPUT WITH INPUT BUFFER EMPTY. MUSTN'T BASH B,C,E. +CHPKI0: SKIPGE CHSSTA(I) .SEE %CFOFF + JRST [ HRRZ T,CHSSTA(I) + CAIE T,%CSFRN ;CHAOSNET OR FOREIGN PROTOCOL? + JRST IOCR10 ;IOT WITH CHANNEL IN IMPROPER STATE + JRST .+1 ] ;WAIT BUT DON'T TRY TO TOUCH WINDOW SIZE + ;HERE CONSIDER INCREASING WINDOW SIZE + SKIPN CHSIBF(I) ;AWAIT INPUT + PUSHJ P,UFLS + POPJ P, ;RETRY + +;ACKNOWLEDGE DATA PACKET IN A. ITS OPCODE IN TT. +CHPKIA: LDB T,[$CPKPN(A)] ;GET PACKET # + HRLM T,CHSPKN(I) ;IT NOW NEEDS TO BE ACKNOWLEDGED + CAIN TT,%COEOF ;ALWAYS ACKNOWLEDGE EOF RIGHT AWAY + JRST CHASTO + HLRZ TT,CHSACK(I) ;GET LAST ONE REALLY ACKNOWLEDGED + SUB T,TT ;GET NUMBER OF PACKETS AWAITING ACK + SKIPGE T + ADDI T,200000 + IMULI T,3 ;MORE THAN ONE THIRD THE WINDOW SIZE? +IFN FTRCHK,[ + MOVE TT,-1(A) + CAMN TT,[ASCII/LUNCH/] + BUG PAUSE,[CHAOS BUFFER ADDRESS TRASHED],OCT,A +];FTRCHK + HLRZ TT,CHSWIN(I) + CAML T,TT + PUSHJ P,CHASTO ;YES, SEND ACK (CAN'T PCLSR) + POPJ P, + +;SET UP FOR CHAOS IOT +CHAIOS: HLRZ I,(R) ;GET INDEX + MOVE E,CHSSTA(I) + TLNE E,%CFSTY+%CFCLS + JRST IOCR10 ;CAN'T DO I/O WHILE DIRECT-CONNECTED OR HALF-CLOSED + HRRZS E ;RETURN STATE IN E + POPJ P, + +;UNIT-MODE INPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUI: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + MOVE E,[440800,,4] + JSP B,(T) + CHSIBP(I) + CHSIBC(I) + CHAIBG + CHAIBD + 0 + TRNA + +;CHAOS INPUT BUFFER DISCARD +CHAIBD: SKIPN A,CHSIBP(I) + POPJ P, + SETZM CHSIBP(I) + SETZM CHSIBC(I) + JRST CHBPFR + +;CHAOS INPUT BUFFER GET +CHAIBG: HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,CHAIB2 ;NONE + LDB TT,[$CPKOP(A)] ;IS IT NORMAL DATA? + CAIE TT,%CODAT + JRST CHAIB1 ;NO + PUSHJ P,CHAIB3 ;YES, ACKNOWLEDGE AND REMOVE FROM LIST + LDB J,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEI TT,%CPKDT(A) + JRST SIOBG1 + +CHAIB3: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHPKIA ;SEND ACKNOWLEDGEMENT + POP P,E + POP P,C + POP P,B + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + JRST CHAQGF + +CHAIB1: CAIE TT,%COEOF + JRST CHAIB2 + PUSHJ P,CHAIB3 ;EOF PACKET, ACKNOWLEDGE IT + PUSHJ P,CHABRT ;RETURN IT TO FREE + JRST POPJ2 ;AND SIGNAL EOF + +CHAIB2: MOVE TT,CTLBTS(U) ;CHECK DON'T-HANG MODE + TRNE TT,10 + JRST POPJ2 ;YES, EOF + JUMPN A,IOCR10 ;NO, ABNORMAL PACKET, BARF + PUSHJ P,CHPKI0 ;AWAIT INPUT + JRST CHAIBG ;RETRY + +;UNIT-MODE OUTPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUO: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + CAIE E,%CSOPN + JRST IOCR10 ;NOT OPEN, ERROR + MOVE E,[440800,,4] + JSP B,(T) + SETZ CHSOBP(I) + CHSOBC(I) + CHAOBG + CHAOBW + 0 + TRNA + +;GET NEW OUTPUT BUFFER +CHAOBG: SKIPG CHSNOS(I) ;WINDOW FULL + PUSHJ P,[ MOVE TT,CTLBTS(U) + TRNN TT,10 + JRST UFLS + SUB P,[1,,1] + JRST POPJ2 ] ;DON'T HANG MODE, RETURN "EOF" + PUSH P,B + PUSHJ P,CHABGT ;SET UP AN OUTPUT BUFFER + POP P,B + + MOVEI TT,%CPKDT(A) + MOVEI J,%CPMXC + JRST SIOBG1 + +;WRITE OUTPUT BUFFER +CHAOBW: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHAFC1 + POP P,E + JRST POPCBJ + +;CHAOSNET OUTPUT PKTIOT. +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKO: PUSHJ P,CHAIOS ;SET UP I, E + UMOVE H,(B) ;GET HEADER WORD OF USER'S PACKET BUFFER + LDB D,[$CPKNB H] ;GET BYTE COUNT + CAIG D,%CPMXC + TLNE H,(.BM $CPKMV) ;WE DON'T SUPPORT MUPPETS ANY MORE + JRST IOCER3 ;BYTE LENGTH OUT OF BOUNDS + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS, INCLUDING HEADER WDS + LSH D,-2 + MOVSI J,1(B) ;SAVE ADDRESS+1 OF USER'S PACKET + PUSHJ P,CHABGT ;GET A BUFFER + PUSHJ P,LOSSET ;RETURN IT IF PCLSR + CHPKO2 + MOVEM H,(A) ;STORE PACKET HEADER, NOT STORED WITH BLT + HRRI J,1(A) ; BECAUSE MIGHT HAVE CHANGED AFTER ERROR CHECK + ADDI D,-1(A) + XCTR XBR,[BLT J,(D)] ;COPY USER'S PACKET INTO SYSTEM + AOS (P) ;GOING TO SUCCEED + SKIPGE (A) ;SKIP IF CONTROL PACKET + JRST CHODAT ;DATA + LDB D,[$CPKOP(A)] ;GET OPCODE + CAIGE D,%COMAX ;DISPATCH ON IT + JRST @.+1(D) + OFFSET -. + JRST IOCER3 ;OPCODE OUT OF BOUNDS +%CORFC::JRST CHORFC +%COOPN::JRST CHOOPN +%COCLS::JRST CHOCLS +%COFWD::JRST CHOFWD +%COANS::JRST CHOFWD +%COSNS::JRST IOCER3 +%COSTS::JRST IOCER3 +%CORUT::JRST IOCER3 +%COLOS::JRST IOCER3 +%COLSN::JRST CHOLSN +%COMNT::JRST IOCER3 +%COEOF::JRST CHOEOF +%COUNC::JRST CHOUNC +%COBRD::JRST IOCER9 ;UNTIL I IMPLEMENT IT +%COMAX::OFFSET 0 + +;LOSSET ROUTINE TO RETURN BUFFER A POINTS TO. +CHPKO2: MOVE A,AC0S+A(U) + PUSH P,Q ;MAY CLOBBER ONLY A AND T + PUSHJ P,CHABRT + JRST POPQJ + +;SENDING %COEOF (END-FILE MARK) +CHOEOF: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + JRST CHOOP1 ;SEND RETRANSMITTABLE CONTROL PACKET + +;SENDING REQUEST FOR CONNECTION +CHORFC: PUSHJ P,CHORF1 ;RE-INITIALIZE CONNECTION + MOVSI B,777774 ;SAVE DESTINATION HOST, CLEAR OTHER BITS + ANDB B,%CPKD(A) + MOVEM B,CHSFRN(I) + MOVEI E,%CSRFS ;PUT INTO RFC-SENT STATE + JRST CHOOP1 ;GO SEND + +;RE-INITIALIZE CONNECTION WHEN USER OUTPUTS RFC OR LSN +;FLUSHES ANY OLD PACKET BUFFERS, CHANGES UNIQUIZER IN INDEX# +CHORF1: JUMPN E,IOCR10 .SEE %CSCLS ;CONNECTION MUST BE CLOSED + PUSH P,A + PUSH P,B + PUSHJ P,CHACS1 ;FLUSH BUFFERS FROM CONNECTION + PUSHJ P,CHASO4 ;REINITIALIZE VARIABLES + JRST POPBAJ + +;"SENDING" LISTEN +CHOLSN: PUSHJ P,CHORF1 + PUSHJ P,LSWDEL ;GOING TO USE PACKET + MOVEI E,%CSLSN ;PUT INTO LISTENING STATE + HRRM E,CHSSTA(I) + MOVEI Q,CHQRFC ;NOW SEARCH PENDING-RFC QUEUE + CONO PI,NETOFF + PUSHJ P,CHAQSR + JRST [ CONO PI,NETON ;NO MATCH, PUT ONTO LISTENING QUEUE + MOVEI Q,CHQLSN + MOVE T,CHSLCL(I) + MOVEM T,%CPKS(A) + JRST CHAQPL ] + PUSHJ P,CHIRF0 ;MATCH, JOIN INTERRUPT LEVEL CODE + JRST NETONJ + +;SENDING OPEN +CHOOPN: CAIE E,%CSRFC ;CONNECTION MUST BE RFC-RECEIVED + JRST IOCR10 + MOVEI TT,4 ;SET BYTE COUNT TO 4 + DPB TT,[$CPKNB(A)] + PUSHJ P,DPBRCP ;INCLUDE RECEIPT + HLRZ B,CHSWIN(I) ;INCLUDE WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + MOVEI E,%CSOPN ;MAKE IT OPEN +;HERE TO SEND A RETRANSMITTABLE CONTROL PACKET (RFC OR OPN), NEW STATE IN E +;THIS PACKET WILL GET TAKEN OFF THE CHSOBF LIST BY RECEIPT IN THE NORMAL WAY +;THIS CODE COPIED FROM CHODAT WITH SOME MODIFICATIONS +CHOOP1: MOVE T,TIME ;UPDATE CHSITM SO WON'T THINK HOST IS DOWN + MOVEM T,CHSITM(I) + MOVEM E,CHSSTA(I) ;AND CLEAR %CFOFF (NO OTHER LH FLAGS CAN BE ON) + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] + HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + JRST CHAXM0 ;GO TRANSMIT + +;SENDING CLOSE +CHOCLS: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN +;SEND FWD OR ANS +CHOFWD: CAIN E,%CSRFC ; OR RFC-RECEIVED + TLOA E,%CFOFF ;PUT IT INTO THE CLOSED STATE + JRST IOCR10 + HLLZM E,CHSSTA(I) .SEE %CSCLS + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + JRST CHODT2 ;GO TRANSMIT + +;Here for transmitting an UNC packet. It could be part of a connection +;or it could be foreign-protocol mode. In any case transmit it without +;munging the header very much. +CHOUNC: CAIE E,%CSOPN + CAIN E,%CSFRN + JRST CHOUN1 ;Okay to transmit UNC now + JUMPN E,IOCR10 .SEE %CSCLS ;Bad state + SKIPE CHSPBF(I) ;I guess out of order packets would + JRST IOCR10 ; cause some confusion in the NCP. + MOVE E,[%CFOFF,,%CSFRN] ;Put into foreign-protocol state + MOVEM E,CHSSTA(I) + MOVE D,%CPKD(A) ;Save destination + MOVEM D,CHSFRN(I) +CHOUN1: MOVE B,CHSLCL(I) ;Set up source + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;Set up destination + MOVEM D,%CPKD(A) + PUSHJ P,LSWDEL + SETOM -2(A) + JRST CHAXMT + +OVHMTR CHX + +;SENDING REGULAR PACKET +CHODAT: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + PUSHJ P,LSWDEL ;BUFFER WILL BE USED +CHODT1: HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] +CHODT2: HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + SKIPL (A) ;SKIP IF DATA PACKET + JRST CHAXMT + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + SOSA CHSNOS(I) ;USE UP WINDOW, SKIP +;SKIPS THROUGH INTO CHAXMT + ;SKIPS IN +SUBTTL CHAOS NET PACKET TRANSMIT ROUTINE + +;CALL WITH PACKET IN A, SMASHES B, C, D, E, T, TT, Q, J +;USES E TO SAVE THE PI STATUS, NOTHING BETTER CLOBBER THIS, OR, BOY, WILL IT EVER LOSE! +;YOU BETTER SETOM -2(A) BEFORE CALLING THIS, AND IF YOU'RE +;PUTTING IT ON A SEND LIST, DO THAT FIRST ALSO. +;THIS CODE ASSUMES THERE IS ONLY ONE INTERFACE, AND IT IS ON A +;PDP11 WHICH WILL TAKE CARE OF THE ROUTING. +;;THIS ROUTINE IS SKIPPED INTO FROM THE PREVIOUS PAGE! +CHAXMT: CONI PI,E ;SAVE PI STATUS BEFORE TURNING NETOFF; CALLED FROM MANY LEVELS +CHAXM0: ANDI E,177 + AOS CHNPO + MOVE T,TIME + MOVEM T,-1(A) ;SET TIME OF LAST TRANSMISSION + CONO PI,NETOFF ;ONE PROCESS AT A TIME, TO PROTECT INTERFACE VARIABLES +IFN FTRCHK,[ + HLRZ J,-2(A) ;I TOLD YOU TO SETOM -2(A) + CAIE J,-1 + BUG PAUSE,[CHAOS BUFFER THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK +IFN DLCP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE DL10 +IFN FTRCHK,[ + HLRZ J,DLCXMQ ;MAKE SURE NOT PUTTING ON LIST TWICE + JUMPE J,.+7 + CAMN J,A + BUG PAUSE,[CHAOS BUFFER ALREADY ON DLCXMQ],OCT,A + HLRZ J,-2(J) + CAIN J,-1 + BUG PAUSE,[DLCXMQ THREAD TRASHED] + JUMPN J,.-5 + MOVEI J,1 ;MAKE SURE NOT ACTIVE TO 11 + HRRZ T,DLCSA1(J) + CAMN T,A + BUG PAUSE,[CHAOS BUFFER ALREADY ACTIVE TO 11],OCT,A + SOJGE J,.-3 +];FTRCHK + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH (FLAGS TRANSMIT ACTIVE) + MOVE J,DLCSBF ;SEE IF SEND BUFFER IS FREE + SKIPE DLCSS1(J) + JRST CHXMD1 + PUSHJ P,DLCXMT ;YES, SEND THE PACKET NOW + JRST CHXMD2 + +CHXMD1: HRRZ B,DLCXMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,DLCXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,DLCXMQ +CHXMD2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];DLCP +IFN T11CHP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE TEN11 + PUSHJ P,T11CHK ;SEE IF TEN-11 IS READY + JRST CHXME3 ;NO + SKIPE @T11OBP ;SEE IF HAVE AVAILABLE OUTPUT BUFFER + JRST CHXME1 ;NO + PUSHJ P,T11XMT ;SEND THE PACKET NOW + JRST CHXME2 + +CHXME3: HRROS T,-2(A) ;TEN11 DOWN, DISCARD PACKET + AOJN T,CHXME2 + PUSHJ P,CHABRT + JRST CHXME2 + +CHXME1: HRRZ B,T11XMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,T11XMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,T11XMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH +CHXME2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];T11CHP +IFN CH10P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH10 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,CHXTEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORM B,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH10P +IFN CH11P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH11 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,%CATEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORB B,CHXCSR + IOWRI B,CAICSR + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH11P + +SUBTTL CHAOS NET DIRECT CONNECT TO STY + +OVHMTR CHS + +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS + +SUBTTL CHAOS NET CLOCK LEVEL STUFF + +OVHMTR CHC + +;HERE FROM 1/2 SECOND CLOCK. DO RETRANSMISSIONS AND DELAYED STS'S +CHACLK: +IFN DLCP,[ + CONO PI,NETOFF + PUSHJ P,DLCIBG ;GET MEMORY FOR INPUT BUFFERS IF NEEDED + CONO PI,NETON +];DLCP + MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHACL0: SKIPL CHSUSR(I) ;SKIP THIS ONE IF NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL + SOJGE I,CHACL0 + JUMPL I,CPOPJ ;JUMP IF ALL INDICES DONE + PUSHJ P,CHARTR ;RETRANSMIT IF NEEDED + MOVSI B,%CFSTS + TDNE B,CHSSTA(I) ;SEND STS IF NEEDED + PUSHJ P,CHASTO + SOJGE I,CHACL0 + POPJ P, + +;HERE EVERY 5 SECONDS, TO DO PROBES +CHA5CL: MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHA5C0: SKIPL CHSUSR(I) ;SKIP IF THIS ONE NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL +CHA5C1: SOJGE I,CHA5C0 + JUMPL I,CHA5C4 ;JUMP IF ALL INDICES DONE + MOVE T,TIME + SUB T,CHSITM(I) ;TIME SINCE LAST COMMUNICATION FROM OTHER END + CAILE T,90.*30. + JRST [ MOVEI W,%CSINC ;TOO LONG, CONNECTION BROKEN + PUSHJ P,CHINT + JRST CHA5C1 ] + HRRZ B,CHSSTA(I) ;ONLY PROBE IF OPEN (COULD BE RFC-SENT) + CAIE B,%CSOPN + JRST CHA5C1 + HRRZ B,CHSWIN(I) ;SEE IF NO TRANSMIT WINDOW (LOST STS DURING OPEN) + JUMPE B,CHA5C2 + HRRZ B,CHSACK(I) ;SEE IF AWAITING ACK (WINDOW NOT EMPTY) + HRRZ C,CHSPKN(I) + CAMN B,C + CAIL T,60.*30. +CHA5C2: PUSHJ P,CHABGI ;AWAITING ACK OR IDLE FOR 1 MINUTE, PROBE + JRST CHA5C1 ;NO PROBE, OR NO BUFFER AVAILABLE + MOVSI T,(.DPB %COSNS,($CPKOP),0) ;SENSE PACKET, BYTE-COUNT=0 + MOVEM T,(A) + AOS CHNSNS + PUSHJ P,CHODT2 + JRST CHA5C1 + +CHA5C4: MOVEI B,[ASCIZ/Timeout/] + MOVEI Q,CHQRFC ;TIME-OUT FIRST RFC ON LIST + PUSHJ P,CHAQGF + JUMPE A,CHA5C5 + MOVE T,-1(A) + ADDI T,60.*30. ;TIME-OUT IS ONE MINUTE + PUSHJ P,[ CAMG T,TIME + JRST CHIRF2 + JRST CHAQPF ] +CHA5C5: +IFN CH10P,[ + MOVEI T,CHXREN+CHXTEN ;WAKE UP IN CASE OF TIMING ERROR + IORM T,CHXCNO ;IN DEALING WITH CHXCNO + CONO CHX,@CHXCNO + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH10P +IFN CH11P,[ + MOVEI T,%CAREN+%CATEN ;WAKE UP IN CASE OF TIMING ERROR + IORB T,CHXCSR ;IN DEALING WITH CHXCSR + IOWRI T,CAICSR + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH11P + MOVEI T,5*60. + MOVEI C,CHA5CK + JRST CLQREE + +OVHMTR CHR + +;RETRANSMIT FOR INDEX IN I +CHARTR: CONI PI,W ;SAVE PI CHANNELS ACTIVE + ANDI W,177 ;CHAXMT BETTER NOT CLOBBER W! + CONO PI,NETOFF ;PI BETTER BE OFF THROUGHOUT THIS ZONE + ; SO WE DON'T GET INTO CHIACK + HLRZ A,CHSOBF(I) ;SCAN DOWN OUTPUT BUFFER LIST + JUMPE A,CHART2 ;EMPTY +CHART1: MOVE T,-1(A) ;DON'T RETRANSMIT IF DONE TOO RECENTLY + HLRZ TT,-2(A) ;OR IF ALREADY ON ITS WAY OUT (DON'T LINK TWICE ON XMIT LIST) + CAME T,TIME + CAIE TT,-1 + JRST CHART2 ;ANYTHING AFTER THIS IS LIKELY TO LOSE ALSO + AOS CHNRTR + PUSHJ P,CHAXMT ;RETRANSMIT THIS +; HRRZ A,-2(A) ;THREAD TO NEXT +; JUMPN A,CHART1 +CHART2: CONO PI,PICON(W) + POPJ P, + +;THIS ROUTINE SENDS A STS PACKET, OR TRIES TO. FAILURE => SLOW CLOCK WILL TRY AGAIN. +;CANNOT PCLSR NOR WAIT, CALLABLE FROM INTERRUPT LEVEL. +;INDEX IN I, CLOBBERS A,B,C,D,E,T,TT,Q,J +CHASTO: MOVSI D,%CFSTS + IORM D,CHSSTA(I) + PUSHJ P,CHABGI ;GET A BUFFER, WITHOUT WAITING + POPJ P, ;CAN'T GET ONE, WILL RETRY AT CLOCK LEVEL + ANDCAM D,CHSSTA(I) ;OK, A STS WILL BE SENT, CLEAR NEED-STS FLAG + MOVE T,[.DPB %COSTS,($CPKOP),<.DPB 4,($CPKNB),0>] + MOVEM T,(A) ;SEND A STS WITH 4 DATA BYTES + PUSHJ P,DPBRCP ;FIRST PAIR IS RECEIPT + HLRZ B,CHSWIN(I) ;SECOND PAIR IS WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + AOS CHNSTS + JRST CHODT2 ;FIRE IT OFF + +DPBRCP: HLRZ B,CHSPKN(I) + SKIPE T,CHSIBF(I) + LDB B,[$CPKPN(T)] + DPB B,[242000,,%CPKDT(A)] + POPJ P, + +SUBTTL CHAOS NET INTERRUPT-LEVEL INPUT PROCESSING + +OVHMTR CHI + +;PROCESS A PACKET RECEIVED AT INTERRUPT LEVEL. BY THE TIME WE GET HERE +; A BUFFER HAS BEEN ALLOCATED AND FILLED WITH THE DATA FROM THE DEVICE. +; ITS ADDRESS IS IN A. RETURN VIA POPJ P, WITH ALL REGISTERS CLOBBERED. +CHAPII: MOVE B,RECHDP ;SAVE HEADER FOR DEBUGGING IN RING BUFFER + MOVEI D,%CPKDT(B) + HRL B,A + BLT B,-1(D) + CAIN D,RECHDR+ + MOVEI D,RECHDR + MOVEM D,RECHDP + ;END OF DEBUGGING CODE + LDB D,[$CPKMV(A)] ;MUPPET? + JUMPN D,CHABRT ;FLUSH, NOT SUPPORTED + LDB D,[$CPKOP(A)] ;GET OPCODE + LDB B,[$CPKDA(A)] ;CHECK DESTINATION + CAIE B,MYCHAD ;IF FOR ME, + SKIPN B ;OR FOR ME BY VIRTUE OF BROADCAST + AOSA CHNPI ;ACCEPT IT + JRST CHAPFW ;NOT ME, FORWARD + LDB C,[$CPKNB(A)] ;PASS LENGTH IN C TO OP ROUTINES + MOVEI B,[ASCIZ/Illegal byte count/] + CAILE C,%CPMXC + JRST CHALOS + SKIPGE (A) ;TEST OPCODE + JRST CHIDAT ;DATA PACKET + MOVEI B,[ASCIZ/Illegal opcode/] + CAIGE D,%COMAX + JRST @.+1(D) + OFFSET -. + JRST CHALOS ;ILLEGAL, FLUSH +%CORFC::JRST CHIRFC +%COOPN::JRST CHIOPN +%COCLS::JRST CHICLS +%COFWD::JRST CHIANS +%COANS::JRST CHIANS +%COSNS::JRST CHISNS +%COSTS::JRST CHISTS +%CORUT:: +IFE CH10P+CH11P,JRST CHABRT ;IGNORE +IFN CH10P+CH11P,JRST CHIRUT +%COLOS::JRST CHILOS +%COLSN::JRST CHALOS ;ILLEGAL, FLUSH +%COMNT::JRST CHABRT ;IGNORE +%COEOF::JRST CHIDAT +%COUNC::JRST CHIUNC +%COBRD::JRST CHIBRD +%COMAX::OFFSET 0 + +;FORWARDING +CHAPFW: LDB B,[$CPKDA(A)] ;CHECK DESTINATION HOST + TRNN B,377_8 ;SUBNET 0? + JRST CHABRT ;FLUSH IT, XX-NETWORK-11 IS TRYING TO MAKE US CRASH + LDB B,[$CPKFC(A)] ;INCREMENT FORWARDING COUNT + ADDI B,1 + CAIL B,20 + JRST [ AOS CHNPFL ? JRST CHABRT ] ;LOOP, DISCARD + DPB B,[$CPKFC(A)] + SETOM -2(A) ;NOT ON SEND LIST + AOS CHNPF + JRST CHAXMT + +IFN CH10P+CH11P,[ ;INCOMING ROUTING INFO +CHIRUT: LSH C,-2 ;NUMBER OF SUBNET ENTRIES + JUMPE C,CHABRT ;COULD BE ZERO-LENGTH + MOVEI D,%CPKDT(A) + HRLI D,442000 + LDB E,[$CPKSA(A)] ;SOURCE HOST IS GATEWAY +CHIRU1: ILDB T,D ;SUBNET + ILDB TT,D ;COST + HLRZ B,SBNRUT(T) ;COST OF EXISTING ROUTE + CAIGE T,NSUBNT + CAMLE TT,B + JRST CHIRU2 + HRLM TT,SBNRUT(T) ;THIS IS BEST ROUTE NOW + HRRM E,SBNRUT(T) +CHIRU2: SOJG C,CHIRU1 + JRST CHABRT +];CH10P+CH11P + +;INTERRUPT-LEVEL PROCESSING OF SNS PACKET +;NOTE THAT WE DO NOT BARF AT SNS'S TO EXISTENT NON-OPEN CONNECTIONS. IF IT +;WAS AN RFC-SENT CONNECTION, THIS COULD BREAK IT PREMATURELY IF AN OPN WAS +;LOST AND THEN A SNS WAS NOT. +CHISNS: MOVEI E,%CSOPN + PUSHJ P,CHFNDX + JRST [ CAIE E,%CSOPN + JRST CHABRT ;CONNECTION EXISTS AND IS NOT OPEN, IGNORE PACKET + JRST CHALOS ] ;CONNECTION DOES NOT EXIST, COMPLAIN + PUSHJ P,CHABRT ;CONNECTION DOES EXIST + CAIE E,%CSOPN + POPJ P, ;NOT OPEN, IGNORE + JRST CHASTO ;REPLY WITH STS + +;INTERRUPT LEVEL PROCESSING OF RECEIVED FWD OR ANS +CHIANS: PUSHJ P,CHFNDX ;FIND CONNECTION + JRST CHABRT ;NOBODY AT OTHER END TO RECEIVE A LOS ANYWAY + CAIE E,%CSRFS + JRST CHABRT ;NOT IN RFC-SENT STATE, LOSS +; JRST CHICL1 ;CLOSE THE CONNECTION BUT GIVE TO USER AS INPUT + ;DROPPING THROUGH WILL DO + +;INTERRUPT LEVEL PROCESSING OF RECEIVED CLS PACKET +CHICLS: PUSHJ P,CHFNDX ;FIND CONNECTION BEING CLOSED + JRST CHALOS ;NONE, LOSS +CHICL1: MOVEI W,%CSCLS ;CLOSE THE CONNECTION +CHICL2: PUSHJ P,CHINT ;SET TO STATE IN W, INTERRUPT + PUSH P,A + MOVEI Q,CHSPBF(I) ;DISCARD OUT-OF-ORDER PACKETS + PUSHJ P,CHALFR + HRRZS CHSNBF(I) +CHIC2A: MOVEI Q,CHSOBF(I) ;DISCARD TRANSMIT PACKETS, E.G. RFC WHICH RECEIVED + PUSHJ P,CHAQGF ;AN ANS OR FWD, DON'T WANT TO TRANSMIT AGAIN + JUMPE A,CHIC2B + PUSHJ P,CHABR1 + JRST CHIC2A + +CHIC2B: POP P,A + JRST CHIDT1 ;GIVE PACKET TO USER AS DATA + ;INTERRUPT LEVEL PROCESSING OF RFC PACKET +CHIRFC: MOVE T,%CPKDT(A) ;CHECK FOR STATUS REQUEST + CAMN T,[.BYTE 8 ? "S ? "T ? "A ? "T] + CAIE C,6 + JRST CHIRF7 + MOVS TT,%CPKDT+1(A) + XORI TT,(<.BYTE 8 ? "U ? "S>) + TRNN TT,(<.BYTE 8 ? -1 ? -1>) + JRST CHIRF3 +CHIRF7: MOVEI Q,CHQLSN ;SEARCH LISTENING QUEUE + PUSHJ P,CHAQSR + JRST CHIRF1 ;NOT FOUND, LOAD SERVER + EXCH A,B ;A LSN, B RFC + LDB I,[$CPKSX(A)] ;GET CORRESPONDING INDEX + HRRZ E,CHSSTA(I) + CAIE E,%CSLSN + JRST 4,. +CHIRF0: PUSHJ P,CHABRT ;FOUND, DISCARD LISTEN PACKET + MOVE A,B ;GET OTHER HOST'S RFC + LDB B,[$CPKPN(A)] ;INITIALIZE RECEIVER'S PACKET NUMBER + HRLM B,CHSPKN(I) + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + MOVEI W,%CSRFC ;PUT INTO RFC-RECEIVED STATE + MOVE T,TIME ;AND ENGAGE PI LEVEL + MOVEM T,CHSITM(I) + JRST CHICL2 + +;RFC RECEIVED AND NOT IMMEDIATELY MATCHED TO A LSN. QUEUE AND LOAD SERVER JOB. +;BUT FIRST CHECK WHETHER THIS IS A DUPLICATE WHICH SHOULD BE DISCARDED. +CHIRF1: MOVE C,%CPKS(A) ;SEARCH PENDING RFC QUEUE FOR RFC FROM + HLRZ T,CHQRFC ;THE SAME SOURCE AS THIS. + JUMPE T,CHIRD1 +CHIRD0: CAMN C,%CPKS(T) + JRST CHABRT ;THIS RFC IS A DUPLICATE, IGNORE IT + HRRZ T,-2(T) + JUMPN T,CHIRD0 +CHIRD1: MOVSI T,-NINDX ;SEARCH OPEN AND RFC-RECEIVED CONNECTIONS +CHIRD2: SKIPL CHSUSR(T) ;FOR ONE CONNECTED TO SAME GUY AS SENT RFC + CAME C,CHSFRN(T) + AOBJN T,CHIRD2 + JUMPGE T,CHIRD3 ;NO DUPLICATE OF THIS RFC, QUEUE IT + HRRZ TT,CHSSTA(T) + CAIE TT,%CSOPN + CAIN TT,%CSRFC + JRST CHABRT ;REALLY A DUPLICATE, DISCARD + AOBJN T,CHIRD2 +CHIRD3: MOVEI B,[ASCIZ/System not up/] + SKIPL SYSDBG ;REFUSE INCOMING CONNECTIONS IF LOGINS REFUSED + SKIPE NETUSW ;ALLOWING INCOMING NET CONNECTIONS? + JRST CHIRF2 ;NO, REFUSE (EVEN IF FROM OURSELVES) + HRROI T,CHIRFJ ;LOAD JOB + CONI PI,Q ;MUST TURN UTCOFF TO CALL NUJBST + ANDI Q,177 ;SINCE THIS MAY RUN AT OTHER INT LEVELS + CONO PI,NETOFF + PUSHJ P,NUJBST + JRST [ CONO PI,PICON(Q) + JRST CHABRT ] ;RING BUFFER FULL, IGNORE, RETRY WILL CATCH + CONO PI,PICON(Q) + MOVE T,TIME ;REMEMBER WHEN THIS RFC WAS QUEUED + MOVEM T,-1(A) + MOVEI Q,CHQRFC + JRST CHAQPF ;PUT ON FRONT OF QUEUE + +;COME HERE TO SEND A LOS PACKET IN RESPONSE TO CRUFTY INPUT IN A +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHALOS: SKIPA T,[%COLOS] +;HERE TO REFUSE AN RFC. TURN IT INTO A CLS AND SEND IT BACK. +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHIRF2: MOVEI T,%COCLS + HRLI B,440700 ;BP TO MESSAGE + SETZB C,(A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVE D,[440800,,%CPKDT(A)] +CHIRF4: ILDB T,B + JUMPE T,CHIRF5 + IDPB T,D + AOJA C,CHIRF4 + +CHIRF5: DPB C,[$CPKNB(A)] + SETOM -2(A) ;NOT ON ANY SEND LIST + JRST CHAXMT ;SEND IT + +;HERE FOR RFC TO "STATUS" +EXPUNGE FOO,BAR +DEFINE FOO NAME +BAR==0 +.BYTE 8 +IRPC CH,,NAME +"CH +BAR==BAR+1 +TERMIN +IFG BAR-4, .ERR NAME MORE THAN 4 CHARACTERS +REPEAT 4-BAR, 0 +.BYTE +TERMIN + +CHIRF3: MOVE B,[MNAME FOO ,,] ;NAME OF MACHINE IN 8-BIT ASCII +EXPUNGE FOO,BAR + MOVEM B,%CPKDT(A) + SETZM %CPKDT+1(A) + MOVSI B,%CPKDT+1(A) + HRRI B,%CPKDT+2(A) + BLT B,%CPKDT+7(A) + MOVE B,[.BYTE 8 ? MYCHAD/400 ? 1 ? 4+IFN CH10P+CH11P,[10.] ? 0 ] + MOVEM B,%CPKDT+10(A) + MOVEI B,%CPKDT+11(A) + HRLI B,441000 + MOVE T,CHNPI + PUSHJ P,CHRF3A + MOVE T,CHNPO + PUSHJ P,CHRF3A +IFN CH10P+CH11P,[ + MOVE T,CHNABT + PUSHJ P,CHRF3A + MOVE T,CHNLOS + PUSHJ P,CHRF3A + MOVE T,CHNCRC + PUSHJ P,CHRF3A + MOVE T,CHNCR2 + PUSHJ P,CHRF3A + MOVE T,CHNPLE + ADD T,CHNWLE + PUSHJ P,CHRF3A +];CH10P+CH11P + MOVEI T,%COANS + SETZM (A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVEI C,13*4+IFN CH10P+CH11P,[20.] ;BYTE COUNT + JRST CHIRF5 ;SEND + +CHRF3A: MOVEI TT,4 + IDPB T,B + LSH T,-8 + SOJG TT,.-2 + POPJ P, + +;HERE TO CONVERT A BRD INTO AN RFC + +CHIBRD: LDB T,[$CPKAN(A)] ;NUMBER OF BITMAP BYTES + LDB TT,[$CPKNB(A)] ;NUMBER OF TOTAL DATA BYES (INCLUDES BITMAP) + CAIG T,32. ;ACK NUMBER NO GREATER THAN 32. + TRNE T,3 ; MUST BE MULTIPLE OF 4 + JRST CHABRT ; FREE THE PACKET IF NO GOOD + CAMG TT,T ;MUST BE SOME TEXTUAL RFC DATA AS WELL + JRST CHABRT ; IF NOT, FREE PACKET + MOVE C,TT ;GET NUMBER OF BYTES (CHIRFC WANTS COUNT IN C) + SUB C,T ;WITHOUT BITMAP + DPB C,[$CPKNB(A)] ;NEW BYTE COUNT + LSH T,-2 ;CONVERT BITMAP BYTE COUNT TO WORD COUNT + ADDI TT,3 ;CONVERT BYTE COUNT TO... + LSH TT,-2 ;... WORD COUNT + MOVEI D,%CPKDT(A) ;GET POINTER TO BEGINNING OF DATA + HRL D,D ;IN UPPER AND LOWER HALVES (ALMOST BLT POINTER) + HRLZ T,T ;BITMAP WORD COUNT,,0 + ADD D,T ;RFC-STRING,,DATA-FIELD + ADDI TT,%CPKDT-1(A) ;LAST LOCATION FOR BLT + BLT D,(TT) + SETZI TT, + DPB TT,[$CPKAN(A)] ;ZERO THE ACK FIELD + MOVE TT,MYCHAD + DPB TT,[$CPKDA(A)] ;PRETEND IT WAS FOR ME + JRST CHIRFC ;AND HANDLE IT AS AN RFC + + +;ROUTINE TO FIND INDEX PACKET CORRESPONDS TO, SKIP IF FOUND, INDEX IN I. +;ALSO RETURNS STATE IN E SINCE THAT'S OFTEN HANDY. +;ALSO SETS B FOR CHALOS +CHFNDX: MOVEI B,[ASCIZ/Connection does not exist at this end/] + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + POPJ P, ;NO MATCH + SKIPGE CHSSTA(I) .SEE %CFOFF + POPJ P, ;NOT TALKING TO NETWORK + HRRZ E,CHSSTA(I) + MOVE TT,%CPKD(A) + MOVE T,%CPKS(A) + CAIN E,%CSRFS ;IF IN RFC-SENT STATE, ONLY + AND T,[.BYTE 16. ? -1 ? 0] ;THE SOURCE HOST HAS TO MATCH + CAMN TT,CHSLCL(I) ;COMPARE LOCAL ADDRESS + CAME T,CHSFRN(I) ; AND FOREIGN ADDRESS + POPJ P, ;NO MATCH + MOVE T,TIME + MOVEM T,CHSITM(I) + JRST POPJ1 ;SUCCEED, CALLER CHECKS THE STATE + +;INTERRUPT LEVEL PROCESSING OF RECEIVED OPN PACKET +CHIOPN: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE OPENED + JRST CHALOS + CAIE E,%CSRFS ;NOT IN RFC-SENT STATE, + JRST CHABRT ; MUST BE DUPLICATE, DISCARD. + LDB B,[$CPKPN(A)] ;GET ITS PACKET NUMBER + HRLM B,CHSPKN(I) ;INITIALIZE PACKET NUMBERING OF RECEIVED MESSAGES + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + PUSHJ P,CHIST1 ;PROCESS AS A STS, DISCARD + PUSHJ P,CHASTO ;RESPOND WITH A STS + MOVEI W,%CSOPN + ;DROP INTO CHINT + +;COME HERE WITH INDEX IN I AND NEW STATE IN W, TO CHANGE STATE AND INTERRUPT +CHINT: HRRM W,CHSSTA(I) + MOVE T,TIME + MOVEM T,CHSITM(I) ;IN CASE GOT HERE FROM CHOLSN + MOVSI T,%CFOFF + CAIE W,%CSOPN + IORM T,CHSSTA(I) ;DISENGAGE PI LEVEL + CAIN W,%CSOPN + ANDCAM T,CHSSTA(I) ;NOW OPEN, ENGAGE PI LEVEL +;COME HERE TO INTERRUPT ON THE INPUT CHANNEL. SMASHES T,TT,W +CHINTI: LDB T,[$CHSUI,,CHSUSR(I)] +CHINT2: MOVE TT,CHSSTA(I) ;SIGNAL USER OR STY? + TLNN TT,%CFSTY + JRST CHINT4 ;USER + LDB T,[$CFTTN,,TT] ;STY, GET TTY NUMBER + CONO PI,PIOFF ;PROTECT LIST MODIFICATION + SKIPL STYNTL-NFSTTY(T) ;DON'T PUT ON LIST TWICE + JRST PIONJ + MOVE TT,STYNTA ;ADD TO LIST + MOVEM TT,STYNTL-NFSTTY(T) + MOVEM T,STYNTA + JRST PIONJ + +CHINT4: SKIPGE TT,CHSUSR(I) + JRST 4,. + MOVSI W,(SETZ) ;PCLSR THE JOB SO IT GETS AN IOC ERROR IF NEEDFUL + IORM W,PIRQC(TT) ;EVEN IF NORMAL INTERRUPTS ARE NOT ENABLED + CAIN T,77 + POPJ P, ;IOPUSH'D, NO INTERRUPT + MOVE T,CHNBIT(T) + AND T,MSKST2(TT) + IORM T,IFPIR(TT) + POPJ P, + +OVHMTR CHD + +;INTERRUPT LEVEL PROCESSING OF RECEIVED DATA PACKET +CHIDAT: PUSHJ P,CHFNDX ;FIND ASSOCIATED CONNECTION + JRST CHALOS ;NONE, LOSS + CAIE E,%CSOPN ;STATE MUST BE OPEN + JRST CHALOS ;BAD, LOSS + PUSHJ P,CHIACK ;PROCESS ACKNOWLEDGEMENT FIELD +;NOW DECIDE WHETHER IT GOES ON CHSIBF(I), OR ON CHSPBF(I), OR GETS DISCARDED. + HLRZ B,CHSPKN(I) ;LAST PACKET NUMBER GIVEN TO USER + LDB C,[$CPKPN(A)] ;GET PACKET NUMBER OF THE NEW PACKET + HLRZ T,CHSWIN(I) ;RECEIVE WINDOW SIZE + ADDI T,(B) ;HIGHEST LEGAL PACKET NUMBER + SUB T,C + TRNE T,100000 ;SKIP IF T >= C + JRST CHABRT ;FOO ON YOU, OVER WINDOW SIZE + HRRZ T,CHSIBF(I) ;COMPUTE NEXT IN-ORDER PACKET EXPECTED + JUMPE T,CHIDT6 ;BASED ON LAST IN-ORDER PACKET + LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + JRST [ LDB B,[$CPKPN(T)] + JRST CHIDT6 ] + HLRZ T,CHSIBF(I) ;IF IT'S AN UNC, HAVE TO GO FIND CORRECT PACKET +CHIDT5: LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + LDB B,[$CPKPN(T)] + HRRZ T,-2(T) + JUMPN T,CHIDT5 +CHIDT6: ADDI B,1 + ANDI B,177777 ;NEXT IN-ORDER PACKET EXPECTED + CAMN B,C + JRST CHIDT1 ;EQUAL, IT GOES ON THE END OF CHSIBF(I) LIST. + SUB B,C ;NOT EQUAL, COMPARE THEM MODULO 2^16. + TRNN B,100000 + JRST CHIDTD ;B GREATER, THIS IS AN OLD PACKET, DISCARD IT + ;PUT ON CHSPBF(I) IN PROPER ORDER + ;A IS THIS PACKET, C IS HIS NUMBER, B IS PREDECESSOR, D IS NEXT, E IS HIS # + MOVEI B,0 ;SIGNIFY AT FRONT OF LIST + HLRZ D,CHSPBF(I) ;GET FIRST PACKET ON OUT-OF-ORDER LIST + JUMPE D,CHIDT4 ;LIST IS EMPTY +CHIDT3: LDB E,[$CPKPN(D)] + SUB E,C ;COMPARE PACKET NUMBERS + JUMPE E,CHIDTD ;DUPLICATE, DISCARD + TRNE E,100000 + JRST [ MOVE B,D ;E IS LESS, KEEP LOOPING + HRRZ D,-2(B) + JUMPN D,CHIDT3 + JRST .+1 ] ;REACHED END PUT IT HERE + SKIPE B + HRRM A,-2(B) ;THREAD ONTO PREVIOUS PACKET + SKIPN D +CHIDT4: HRRM A,CHSPBF(I) ;THREAD ONTO BACK OF LIST + SKIPN B + HRLM A,CHSPBF(I) ;THREAD ONTO FRONT OF LIST + HRRM D,-2(A) ;THREAD IN BEFORE PACKET IN D + MOVSI B,1 + ADDM B,CHSNBF(I) + POPJ P, + +;HERE IT GOES ON CHSIBF(I). A HAS PACKET, C HAS ITS PACKET NUMBER. +;IF GETTING HERE FROM CHICL1, C HAS GARBAGE BUT IT WILL NEVER BE USED. +CHIDT1: SKIPN CHSIBF(I) + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQPL ;PUT ON END OF RECEIVE LIST + HLRZ A,CHSPBF(I) ;GET FIRST OUT-OF-ORDER PACKET + JUMPE A,CPOPJ ;NONE + LDB B,[$CPKPN(A)] ;SEE IF THIS PACKET IS NOW IN-ORDER + CAIL C,177777 ;BY COMPARING AGAINST C+1 MODULO 2^16. + TDZA C,C + ADDI C,1 + CAME B,C + POPJ P, ;NO + MOVEI Q,CHSPBF(I) + PUSHJ P,CHAQGF ;YES, PULL PACKET OF OUT-OF-ORDER LIST + MOVSI B,-1 + ADDM B,CHSNBF(I) + JRST CHIDT1 ;AND GO PUT ONTO IN-ORDER LIST + +;HERE IF PACKET IS A DUPLICATE AND IS TO BE DISCARDED. MUST SEND +;RECEIPT TO SHUT OFF EXCESS RETRANSMISSION. +CHIDTD: PUSHJ P,CHABRT + AOS CHNPD + JRST CHASTO + +;HERE FOR RECEIVING AN UNC PACKET +CHIUNC: LDB I,[$CPKDI(A)] ;Destination index zero? + JUMPE I,CHIUN2 + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + JRST CHALOS ;NO MATCH + MOVE TT,%CPKD(A) ;DESTINATION ADDRESS MATCHES? + CAME TT,CHSLCL(I) + JRST CHALOS + HRRZ E,CHSSTA(I) ;IN FOREIGN PROTOCOL MODE? + CAIN E,%CSFRN + JRST CHIUN1 + MOVE TT,%CPKS(A) ;NORMAL PROTOCOL, SOURCE ADDRESS MUST MATCH + CAMN TT,CHSFRN(I) + CAIE E,%CSOPN ;AND STATE MUST BE OPEN + JRST CHALOS +CHIUN1: MOVE TT,TIME + MOVEM TT,CHSITM(I) + SKIPE T,CHSIBF(I) ;DISCARD PACKET IF OVER WINDOW SIZE + JRST [ LDB TT,[$CPKOP(T)] ; AND ALREADY HAVE AN UNC + HRRZ T,CHSNBF(I) + HLRZ Q,CHSWIN(I) + CAML T,Q + CAIE TT,%COUNC + JRST .+2 + JRST CHABRT ] + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) ;PUT ON END OF RECEIVE LIST. + MOVEI Q,CHSIBF(I) ;PACKET NUMBER IS RANDOM, NOTHING LOOKS AT IT + JRST CHAQPL + +CHIUN2: +IFE INETP,JRST CHALOS ;No comprendo internet +IFN INETP,[ + LDB I,[$CPKAN(A)] ;Protocol number + CAIE I,8_8 ;DOD Internet #x0800 + JRST CHALOS + AOS CHNIPI ;Meter Internet packets in from Chaosnet + MOVE J,A ;Save Chaosnet packet + LDB A,[$CPKNB(A)] ;Compute size of Internet datagram in words + ADDI A,3 + LSH A,-2 + MOVE C,A ;Save word count + CALL IPGIPT ;Get buffer to copy datagram into + JRST CHIUN3 ;No buffers available, discard packet + MOVSI T,%CPKDT(J) ;Make BLT pointer + HRRI T,1(B) + ADDI B,(C) ;Address of last destination word + BLT T,(B) + EXCH A,J ;Free the Chaosnet packet + CALL CHABRT + MOVE A,J ;Datagram structure + MOVE B,C ;Word count + MOVEI C,0 ;Offset to start of IP header + CALRET IPRDGM ;Dispose of datagram + +CHIUN3: MOVE A,J ;Discard Chaosnet packet + CALRET CHABRT +];INETP + +OVHMTR CHJ + +;INTERRUPT LEVEL PROCESSING OF LOS +CHILOS: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE BROKEN + JRST CHABRT ;NONE, IGNORE + MOVEI W,%CSLOS ;PUT INTO LOST STATE + JRST CHICL2 ;GIVE PACKET TO USER AS DATA, DISENGAGE, AND INTERRUPT + +;INTERRUPT LEVEL PROCESSING OF STS +CHISTS: PUSHJ P,CHFNDX + JRST CHALOS + CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST CHALOS +CHIST1: LDB B,[042000,,%CPKDT(A)] ;GET NEW WINDOW SIZE + CAILE B,MXWIND + MOVEI B,MXWIND + HRRM B,CHSWIN(I) + LDB B,[242000,,%CPKDT(A)] ;PROCESS RECEIPT + PUSHJ P,CHIAK0 + PUSHJ P,CHABRT + JRST CHARTR ;RETRANSMIT + +OVHMTR CHA + +;INTERRUPT LEVEL PROCESSING OF RECEIVED ACKNOWLEDGEMENT. +;REMOVE THE ACKNOWLEDGED PACKETS FROM THE INDEX'S SEND LIST AND UPDATE CHSNOS(I). +;NOTE THAT THE LIST IS ASSUMED TO BE SORTED SO WE ONLY +;REMOVE PACKETS FROM THE FRONT. CLOBBERS B,C,D,T,TT,Q. +CHIACK: LDB B,[$CPKAN(A)] ;PACKET NUMBER BEING RECEIPTED +CHIAK0: LDB T,[$CPKAN(A)] ;ENTER HERE FROM CHISTS + HRRZ D,CHSACK(I) ;GET MAX OF THIS ACKNOWLEDGE AND PREVIOUS + SUB D,T + TRNE D,100000 + HRRM T,CHSACK(I) ;ACKNOWLEDGED PACKET NUMBER IS NEW START OF WINDOW + PUSH P,A + HLRZ A,CHSOBF(I) ;MAP DOWN SEND LIST + JUMPE A,CHIAK2 ;LIST EMPTY +CHIAK1: LDB D,[$CPKPN(A)] + SUBM B,D + TRNE D,100000 + JRST CHIAK2 ;RCP# LESS THAN PKT# + HRRZ C,-2(A) ;GET NEXT PACKET + HLLOS D,-2(A) ;MARK NOT ON SEND LIST + AOJE D,CHIAK3 ;AND JUMP IF NOT ON TRANSMIT LIST +IFN DLCP,[ + MOVEI Q,DLCXMQ ;ON TRANSMIT LIST, TRY TO TAKE OFF + PUSHJ P,CHIAKF +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ + PUSHJ P,CHIAKF +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ + PUSHJ P,CHIAKF +];CH10P+CH11P + CAIA ;AND DON'T FREE IT +CHIAK3: PUSHJ P,CHABRT + HRLM C,CHSOBF(I) + SKIPE A,C + JRST CHIAK1 + SETZM CHSOBF(I) ;SEND LIST NOW EMPTY +CHIAK2: MOVE D,CHSNOS(I) ;COMPUTE NEW VALUE OF CHSNOS + HRRZ T,CHSACK(I) ;START OF WINDOW + HRRZ C,CHSPKN(I) ;LAST PACKET SENT + SUB T,C + SKIPLE T + SUBI T,200000 ;T GETS NEGATIVE AMOUNT OF WINDOW OCCUPIED + ADD T,CHSWIN(I) ;RH(T) GETS AVAILABLE PORTION OF WINDOW + HRREM T,CHSNOS(I) ;WHICH IS NUMBER OF OUTPUT SLOTS + JUMPG D,POPAJ ;IF FORMERLY THERE WERE NO OUTPUT SLOTS, + LDB T,[$CHSUO,,CHSUSR(I)] + SKIPLE CHSNOS(I) ;AND NOW THERE ARE, + PUSHJ P,CHINT2 ;INTERRUPT ON THE OUTPUT CHANNEL + JRST POPAJ + +;TRY TO TAKE PACKET IN A OFF OF TRANSMIT LIST IN Q. +;CLOBBER T,Q,D. CALLED WITH INTERRUPTS OFF. +;MAY RETURN WITH A POINTING TO FREE BUT THAT IS OK AT THIS TIME. +CHIKF1: SKIPA D,T +CHIAKF: MOVEI D,2(Q) ;LH[-2(D)] POINTS TO (T) + HLRZ T,-2(D) + JUMPE T,CPOPJ ;NOT FOUND + CAIE T,(A) + JRST CHIKF1 + HLRZ T,-2(A) ;LINK OUT + HRLM T,-2(D) + JUMPN T,CHABRT ;JUMP IF DIDN'T DELETE LAST PACKET IN LIST + HRRM D,(Q) ;NEW LAST PACKET IN LIST + CAIN D,2(Q) + SETZM (Q) ;FOO, TRANSMIT LIST NOW EMPTY + JRST CHABRT + +SUBTTL CHAOS NET DL10 INTERRUPT ROUTINE + +OVHMTR CHH + +IFN DLCP,[ + +;COME HERE FROM EACH DL10 INTERRUPT AT TTY LEVEL. SMASH ALL REGISTERS EXCEPT P AND 0. +DLCWAK: CONI PI,E ;SAVE PI STATUS AND SWITCH TO NETWORK INTERRUPT LEVEL + ANDI E,177 + PUSH P,E + CONO PI,NETOFF +DLCWK1: MOVEI J,1 ;ALWAYS CHECK BOTH BUFFERS SO WE CAN'T GET OUT OF PHASE WITH 11 + MOVEI R,2 ;CHECK FOR INPUT AVAILABLE + CAME R,DLCRS1(J) + SOJGE J,.-1 + JUMPL J,DLCWK2 + MOVE A,DLCRA1(J) ;GOT INPUT, PROCESS IT + SETZM DLCRS1(J) ;BUFFER SLOT NOT OCCUPIED NOW +IFN KS10P, CLRCSH +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE IN CASE ANYONE HAPPENED TO TOUCH BUFFER + SKIPE A ;THIS CAN HAPPEN IF PDP11 WAS JUST STUFFED + PUSHJ P,CHAPII ;PROCESS THE PACKET + PUSHJ P,DLCIBG ;SUPPLY A NEW INPUT BUFFER TO 11 + JRST DLCWK1 ;TRY FOR MORE INPUT + +DLCWK2: MOVEI J,1 ;SCAN CHANNELS FOR OUTPUT DONE + CAME R,DLCSS1(J) +DLCWK3: SOJGE J,.-1 + JUMPL J,DLCWK4 + MOVE A,DLCSA1(J) ;FOUND AN OUTPUT DONE BUFFER + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE + SETZM DLCSA1(J) ;IDLE THIS BUFFER + SETZM DLCSS1(J) + JRST DLCWK3 + +DLCWK4: MOVE J,DLCSBF ;TRY TO SEND SOME OUTPUT + SKIPE DLCSS1(J) + JRST DLCWK9 ;BUFFER BUSY + HLRZ A,DLCXMQ ;GET ANOTHER OFF TRANSMIT QUEUE + JUMPE A,DLCWK9 ;QUEUE EMPTY + HLRZ T,-2(A) +IFN FTRCHK,[ + CAIN T,-1 + BUG PAUSE,[CHAOS LIST THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK + HRLM T,DLCXMQ +IFN FTRCHK,[ + JUMPN T,.+4 + CAME A,DLCXMQ ;REACHED END OF LIST, END IN RIGHT PLACE? + BUG PAUSE,[DCLXMQ THREAD TRASHED] + SETZM DLCXMQ +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM DLCXMQ +];FTRCHK + PUSHJ P,DLCXMT ;SEND IT ON THIS BUFFER + JRST DLCWK4 ;GO TRY TO SEND ON OTHER BUFFER + +DLCWK9: POP P,E + CONO PI,PICON(E) ;RESTORE PI + POPJ P, + +;THIS ROUTINE SUPPLIES AN INPUT BUFFER TO THE 11 ON ALL BUFFERS THAT NEED IT +;CALL WITH INTERRUPTS OFF OR IN PROGRESS +DLCIBG: MOVEI J,1 + SKIPE DLCRS1(J) +DLCIB1: SOJGE J,.-1 + JUMPL J,CPOPJ + PUSHJ P,CHABGI ;GET A BUFFER + JRST [ SETZM DLCRA1(J) ;NO MEMORY, WILL TRY AGAIN AT CLOCK LEVEL + SETZM DLCRS1(J) + POPJ P, ] + SETZM (A) ;CLEAR THE BUFFER SINCE THE DL10 DOESN'T TOUCH LOW 4 BITS + HRLZ T,A + HRRI T,1(A) + BLT T,%CPMXW-1(A) + MOVEM A,DLCRA1(J) ;MAKE AVAILABLE TO PDP11 + HRLI A,120000 + MOVEM A,DLCRP1(J) + SOS DLCRP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE BEFORE SIGNALLING 11 + MOVEI T,1 + MOVEM T,DLCRS1(J) + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + JRST DLCIB1 ;TRY FOR OTHER BUFFER ALSO + +;THIS ROUTINE SENDS PACKET IN A TO DL10 (CALL WITH NETOFF OR IN PROGRESS) +;SWITCHES BUFFERS, LEAVES NEW ONE IN J +DLCXMT: MOVE J,DLCSBF + MOVEM A,DLCSA1(J) + HRLI A,120000 + MOVEM A,DLCSP1(J) ;GIVE 11 POINTER TO NEW PACKET + SOS DLCSP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE, PUTTING PACKET INTO CORE + MOVEI T,1 + MOVEM T,DLCSS1(J) ;ACTIVATE PDP11 + CONO DLC,100040+TTYCHN + XORI J,1 ;NEXT BUFFER + MOVEM J,DLCSBF + POPJ P, + +IFN KL10P,[ +;THIS ROUTINE SWEEPS PACKET IN A OUT OF THE CACHE, +;CLOBBERING B, C, AND D. +IFG PKTBSZ-1000, .ERR PKTBSZ BIGGER THAN HARDWARE PAGE SIZE, CACHE SWEEP LOSES +DLCSWP: LDB D,[111100,,A] ;SWEEP ONE PAGE OF CACHE + SWPUO (D) ;STORING PACKET INTO CORE + MOVE B,[CONSZ 200000] ;AWAIT COMPLETION IN ACS + MOVE C,[JRST B] ;TO MINIMIZE CACHE INTERFERENCE + MOVSI D,(POPJ P,) + JRST B +];KL10P +];DLCP + +SUBTTL CHAOS NET TEN-11 INTERFACE STUFF + +IFN T11CHP,[ +;THIS ROUTINE CHECKS FOR TEN-11 INITIALIZATION, SKIP-RETURNS IF OK TO USE +;CLOBBERS T,TT +T11CHK: SKIPE TEN11F + JRST T11LUZ ;NOT SUPPOSED TO USE TEN11 + MOVE T,T11VER ;CHECK VERSION TO MAKE SURE RIGHT PROGRAM, ETC. + CAME T,[.BYTE 8 ? "H ? "C ? 0 ? 1] + JRST T11LUZ ;PROBABLY TURNED OFF OR WRONG PROGRAM + SKIPE T11I10 ;SHOULD WE REINIT? + JRST T11CK1 ;YES, GO DO SO + SKIPLE T,T11WIN ;ARE WE WINNING? + JRST POPJ1 ;YES, FINE + JUMPE T,[SETOM T11WIN ;NOW THAT VERSION IS OK, TELL 11 TO INIT + MOVSI T,-1 + MOVEM T,T11I11 + JRST T11CK1 ] ;AND INIT OURSELVES + SKIPE T11I11 ;WAITING FOR 11 TO REINIT? + POPJ P, ;YES, WAIT +;HERE TO REINIT. FIRST, PICK UP PARAMETERS. +T11CK1: LDB TT,[242000,,T11PRM] ;BYTES PER PACKET BUFFER + CAIGE TT,<%CPMXW+1>*4 ;BETTER BE RIGHT SIZE + JRST T11LUZ ;TOO SMALL (ASSUME IF TOO BIG, PACKETS WON'T BE) + LSH TT,-2 + MOVEM TT,T11BSZ ;SAVE BUFFER SIZE IN PDP10 WORDS + LDB T,[042000,,T11PRM] ;NUMBER OF BUFFERS IN EACH DIRECTION + IMULB T,TT ;NUMBER OF PDP10 WORDS IN EACH DIRECTION + ADD TT,T11IBB + MOVEM TT,T11IBE ;INIT POINTERS + MOVEM TT,T11OBB + MOVEM TT,T11OBP + ADD TT,T + MOVEM TT,T11OBE + HRREI T,-T11CHS-2000(TT) + JUMPG T,T11LUZ ;COMMUNICATION AREA LONGER THAN 1K + MOVE T,T11IBB + MOVEM T,T11IBP +T11CK2: SETZM (T) ;CLEAR BUFFER HEADERS + ADD T,T11BSZ + CAMGE T,TT + JRST T11CK2 + MOVEM T,T11WIN ;WE'RE WINNING (MAKE T11WIN POSITIVE NON-ZERO) + SETZM T11I10 ;INIT DONE + JRST POPJ1 + +;HERE IF PDP11 PARAMETERS DON'T MATCH WHAT WE EXPECT +T11LUZ: SETZM T11WIN ;NOT WINNING + POPJ P, + +;HERE FROM CLOCK LEVEL TO CHECK ON TEN-11 CHAOS NET CHANNEL +T11WAK: PUSHJ P,T11CHK ;IS EVERYTHING OK? + POPJ P, ;NO. +T11WK0: MOVE C,T11IBP ;CHECK INPUT + SKIPN (C) + JRST T11WK1 ;NONE AVAILABLE + MOVSI J,2(C) ;POINT TO PACKET + LDB D,[$CPKNB+2(C)] ;GET SIZE OF PACKET + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS INCLUDING HEADER + LSH D,-2 + CAILE D,%CPMXW ;DON'T GET FAKED OUT BY CLOBBERED COUNT + MOVEI D,%CPMXW + PUSHJ P,CHABGI ;GET PLACE TO PUT IT + JRST T11WK1 ;NONE AVAILABLE + HRLOI E,-1(D) + EQVI E,(A) ;AOBJN POINTER TO PACKET BUFFER + HRRI J,(A) ;BLT POINTER TO COPY PACKET + ADDI D,-1(A) ;LAST WORD + BLT J,(D) ;COPY PACKET FROM 11 TO 10 + MOVEI H,0 ;COMPUTE CHECKSUM +T11WK4: ADD H,(E) + LSH H,-1 + TRZE H,10 + TLO H,(SETZ) + AOBJN E,T11WK4 + MOVE TT,1(C) ;GET PDP11'S CHECKSUM + SETZM (C) ;GIVE THE 11 BACK THE BUFFER + ADD C,T11BSZ ;ADVANCE THE POINTER + CAML C,T11IBE + MOVE C,T11IBB + MOVEM C,T11IBP + CAME H,TT + JRST [ AOS T11CKE ;COUNT CHECKSUM ERRORS + PUSHJ P,CHABRT ;AND DISCARD PACKET + JRST T11WK0 ] + CONO PI,NETOFF + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON + JRST T11WK0 + +T11WK1: CONO PI,NETOFF + SKIPE T11XMQ ;ANY OUTPUT? + SKIPE @T11OBP ;AND OUTPUT BUFFER SPACE AVAILABLE? + JRST NETONJ ;NO, RETURN FROM T11WAK + HLRZ A,T11XMQ ;GET PACKET OFF TRANSMIT QUEUE + HLRZ B,-2(A) ;GET NEXT AFTER THAT + HRLM B,T11XMQ ;BECOMES NEW HEAD OF QUEUE + SKIPN B + SETZM T11XMQ + PUSHJ P,T11XMT ;COPY PACKET INTO 11 + CONO PI,NETON + JRST T11WK1 ;LOOK FOR MORE OUTPUT + +;SEND PACKET A-> TO 11. SMASHES B,C,T,TT,Q. CALL WITH NETOFF. +T11XMT: LDB C,[$CPKNB(A)] ;GET BYTE COUNT + MOVE Q,C ;MUST CLEAR UNUSED BYTES AT END OF LAST WORD + ANDI Q,3 ;TO MAKE THE CHECKSUM COME OUT RIGHT + ADDI C,4*%CPKDT+3 + LSH C,-2 ;CONVERT TO WORD COUNT + MOVE Q,(Q)[ -1 ;MASK FOR BYTES TO RETAIN IN LAST WORD + <.BYTE 8 ? -1> + <.BYTE 8 ? -1 ? -1> + <.BYTE 8 ? -1 ? -1 ? -1> ] + MOVEI TT,-1(C) + ADD TT,A + ANDM Q,(TT) ;MASK OFF LAST WORD + HRLOI C,-1(C) + EQVI C,(A) ;AOBJN PTR + MOVEI TT,0 ;COMPUTE XOR CHECKSUM IN TT + SKIPA B,T11OBP ;-> CURRENT OUTPUT BUFFER IN 11 +T11XM1: ADDI B,1 + MOVE T,(C) + TRZ T,17 ;CLEAR BITS 10-11 TREATS SPECIALLY + ADD TT,T ;COMPUTE CHECKSUM + LSH TT,-1 + TRZE TT,10 + TLO TT,(SETZ) + MOVEM T,2(B) + AOBJN C,T11XM1 + MOVE B,T11OBP + MOVEM TT,1(B) ;GIVE CHECKSUM TO 11 + MOVSI TT,-1 + MOVEM TT,0(B) ;GIVE PACKET TO 11 + ADD B,T11BSZ ;ADVANCE BUFFER POINTER + CAML B,T11OBE + MOVE B,T11OBB + MOVEM B,T11OBP + HRROS T,-2(A) ;TAKE PACKET OFF TRANSMIT LIST + AOJN T,.+2 + PUSHJ P,CHABRT ;NOT ON SEND LIST, FREE IT + POPJ P, +];T11CHP + +SUBTTL CH-10 INTERRUPT ROUTINES + +;THE GENERAL IDEA IS THAT WE INTERRUPT ON A LOW-PRIORITY INTERRUPT LEVEL, +;AND DO THE TIME-INTENSIVE PACKET COPYING AT THAT LEVEL. THE GENERAL +;CHAOS ROUTINES ARE THEN CALLED WITH NETOFF. + +IFN CH10P,[ + +EBLK + +CHXACS: BLOCK 20 +CHXPDL: -60,,. + BLOCK 60 + +CHXBRK: 0 +BBLK + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + CONSO CHX,CHXRCV ;PACKET RECEIVED? + JRST CHXBK5 + PUSHJ P,CHABGI ;GET PLACE TO PUT PACKET + JRST [ MOVEI T,CHXREN ;NONE AVAILABLE, DISABLE INTR + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + JRST CHXBK5 ] + CONSZ CHX,CHXCRC+CHXWLE ;CHECK FOR ERRORS + JRST [ CONSZ CHX,CHXCRC + AOSA CHNCRC + AOS CHNWLE + JRST CHXBK4 ] ;IGNORE PACKET + DATAI CHX,T ;FIRST DATAI YIELDS GARBAGE + MOVEI T,CHXSWB ;DISABLE BYTE SWAPPING + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;READ HEADER + DATAI CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + CAILE T,%CPMXC ;DON'T RUN OFF END OF BUFFER + JRST CHXBK4 + ADDI T,3 ;ROUND UP TO NEXT WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, TT GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAI CHX,(D) + AOBJN D,.-1 + DATAI CHX,T ;NOW READ AND IGNORE HARDWARE HEADER + TLNE T+1,400000 + DATAI CHX,T ;THIRD HALFWORD + CONI CHX,T ;CHECK FOR ERRORS + TDNE T,[CHXPLE+CHXCRC+CHXOVR] + JRST [ TLNE T,(CHXOVR) + JRST CHXBKZ ;OVERRRUN CAN'T HAPPEN UNLESS HARDWARE BROKEN + TLNE T,(CHXPLE) + AOSA CHNPLE + TRNN T,CHXCRC + JRST CHXBK4 + AOS CHNCR2 + JRST CHXBK4 ] + CONO PI,NETOFF-1 + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON-1 + CAIA +CHXBK4: PUSHJ P,CHABRT ;DIDN'T USE BUFFER AFTER ALL + CONI CHX,T ;COUNT LOST PACKETS + LDB T,[$CHXLC,,T] + ADDM T,CHNLOS + MOVEI T,CHXREN ;ENABLE RECEIVER FOR NEXT PACKET + IORB T,CHXCNO + CONO CHX,CHXRCV(T) +CHXBK5: CONSO CHX,CHXXMT ;TRANSMIT DONE? + JRST CHXBK9 + SKIPE T,CHOSTA ;TRANSMIT IN PROGRESS? + CONSO CHX,CHXABT ;AND WAS ABORTED? + JRST CHXBK7 ;NO TO EITHER, LOOK FOR MORE WORK + AOS CHNABT ;METER TRANSMIT ABORTS + CAIL T,NCHRTR ;ABORTED TOO MANY TIMES? + JRST CHXBK7 ;DONE WITH PACKET + AOS CHOSTA ;COUNT RETRANSMISSIONS + MOVEI T,CHXTEN + IORB T,CHXCNO + CONO CHX,CHXXMT(T) ;RETRANSMIT PACKET + JRST CHXBK9 + +CHXBK7: SETZM CHOSTA ;TRANSMITTER IDLE, LOOK FOR NEXT PACKET + CONO PI,PIOFF + HLRZ A,CHXXMQ ;ANYTHING QUEUED FOR TRANSMISSION? + JUMPE A,[ MOVEI T,CHXTEN ;DISABLE INTERRUPTS + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PION + JRST CHXBK9 ] + HLRZ B,-2(A) ;CDR TRANSMIT QUEUE + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;QUEUE EMPTY NOW + CONO PI,PION + AOS CHOSTA ;NOW SEND THIS PACKET + MOVEI T,CHXHLF+CHXSWB ;CLEAR HALFWORD, BYTE-SWAP MODES + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;TRANSMIT HEADER + DATAO CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,1 ;ROUND UP TO NEXT HALF WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, T+1 GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAO CHX,(D) + AOBJN D,.-1 + MOVEI T,CHXHLF+CHXTEN ;SWITCH TO HALFWORD MODE, ENABLE DONE INTR + IORM T,CHXCNO + CONO CHX,@CHXCNO + TLNE T+1,400000 ;SEND EXTRA HALFWORD IF NEEDED + DATAO CHX,(D) + MOVEI T,CHXSWB ;DISABLE SWAP BYTES MODE + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + LDB T,[$CPKDN(A)] ;GET DESTINATION SUBNET + HRRZ D,SBNRUT(T) ;GATEWAY TO THAT SUBNET + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;IF ON LOCAL CABLE + LDB D,[$CPKDA(A)] ;GO DIRECT + LSH D,16.+4 + DATAO CHX,D ;STORE HARDWARE DESTINATION ADDRESS + MOVE T,CHXCNO ;TRANSMIT PACKET + CONO CHX,CHXXMT(T) + CONI CHX,T + TLNE T,(CHXOVR) ;CAN'T HAPPEN UNLESS HARDWARE BROKEN +CHXBKZ: BUG HALT,[CHAOS: I/O BUS OVERRUN] + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE +CHXBK9: MOVSI 17,CHXACS ;DISMISS INTERRUPT + BLT 17,17 + JRST 12,@CHXBRK + +CHSWAB: LDB T,[$CPKOP(A)] ;DOES THIS PACKET NEED BYTE SWAPPING? + TRNE T,200 + JRST [ TRNE T,100 + POPJ P, ;BINARY DATA + JRST CHSWB1 ] ;CHARACTER DATA + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;BINARY CONTROL PACKET +CHSWB1: MOVEI T,CHXSWB ;CHARACTER, SWAP DEM BYTES + IORM T,CHXCNO + CONO CHX,@CHXCNO + POPJ P, + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH10P + +SUBTTL CH-11 INTERRUPT ROUTINES + +;The Unibus Chaosnet board interrupts on the same level as TTYs, +;and comes to CHXBKH via vectored interrupt. We use a programmed +;interrupt request to drop down to a lower interrupt level for the +;slow packet-copying operation, so as not to interfere with the TTYs, +;then turn NETOFF when we call into the Chaosnet NCP. +;(We actually use NETOFF-1 and NETON-1 so as not to interfere with +;CLKOFF. This assumes that interrupt levels between CLKCHN and +;CHXCHN are never turned off.) + +IFN CH11P,[ + +;;; Macros that will eventually be instructions + +DEFINE PACK16 AC,E ;AC,AC+1 right-aligned and zero-filled + LSH AC,16. + IOR AC,AC+1 + LSH AC,4 + MOVEM AC,E +TERMIN + +DEFINE PACK8 AC,E ;AC: ...B2B1 AC+1: ...B4B3 zero-filled!! + ROTC AC,-8 ;B3...B2 B1...B4 + ROT AC,-16. ;B1,B2,B3 in position, B4 right-aligned + ADDI AC+1,(AC+1) ;Shift RH(AC+1) left 4 bits + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) ;B1,B4 in position in AC+1 + IOR AC,AC+1 + MOVEM AC,E +TERMIN + +DEFINE UNPK16 AC,E ;Doesn't bother masking off garbage bits + MOVE AC,E + MOVE AC+1,AC + ROT AC,16. ;First halfword right-aligned + LSH AC+1,-4 ;Second halfword right-aligned +TERMIN + +DEFINE UNPK8 AC,E + MOVE AC,E ;B1B2B3B4... + ROT AC,8 ;B2B3B4...B1 + MOVE AC+1,AC + AND AC,[377_2,,377] ;...B3...B1 zero-filled + ROT AC+1,16. ;B4...B1B2B3 + AND AC+1,[377_12,,377_8];B4...B2... zero-filled + IORB AC,AC+1 ;B4B3...B2B1 + ROT AC+1,16. ;...B4B3, garbage in high bits +TERMIN + +EBLK + +CHXACS: BLOCK 20 +CHXSVH: 0 +CHXPDL: -60,,. + BLOCK 60 + +CHXBKH: 0 ;Hardware interrupt on TTYCHN comes here +BBLK + CONO PI,CHXRQ ;Redirect to lower interrupt level + MOVEM T,CHXSVH ;Clear hardware interrupt enable + MOVEI T,%CAREN+%CATEN ; so the Chaos board will stop interrupting + ANDCAB T,CHXCSR + IOWRI T,CAICSR + MOVE T,CHXSVH + JRST 12,@CHXBKH +EBLK + +CHXBRK: 0 ;Software interrupt on CHXCHN comes here +BBLK + CONO PI,020000+200_<-CHXCHN> ;BAG-BITING DEC LOSERS + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + IORDI T,CAICSR ;Check for received packet + TRNN T,%CARDN + JRST CHXBK3 ;No incoming packet yet + TRNE T,%CAERR ;Check for error in received packet + JRST [ AOS CHNCRC + JRST CHXBK1 ] ;Ignore packet + IORDI R,CAIRBC ;Number of bits in packet - 1 + SUBI R,31. ;Exclude the three extra hardware words + TRNE R,17 + JRST [ AOS CHNWLE ;Length not a multiple of 16 + JRST CHXBK1 ] + ASH R,-5 ;32-bit word count, rounded up + PUSHJ P,CHABGI ;Get place to put packet + JRST [ AOS CHNLOS ;No buffers, lose this packet + JRST CHXBK1 ] + HRLI A,-%CPKDT ;Copy out the packet header +CHSRC1: IORDI B,CAIRBF + IORDI C,CAIRBF + PACK16 B,(A) + AOBJN A,CHSRC1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHSRC4 ;No byte swapping + JUMPGE D,CHSRC3 +CHSRC2: IORDI B,CAIRBF ;Read out the data, byte-swapped + IORDI C,CAIRBF + PACK8 B,(D) + AOBJN D,CHSRC2 +CHSRC3: JUMPGE H,CHSRC7 ;Jump if even packet length + IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK8 B,(D) + AOJA D,CHSRC7 + +CHSRC4: JUMPGE D,CHSRC6 +CHSRC5: IORDI B,CAIRBF ;Read out the data, halfwords + IORDI C,CAIRBF + PACK16 B,(D) + AOBJN D,CHSRC5 +CHSRC6: JUMPL H,[ IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK16 B,(D) + AOJA D,CHSRC7 ] +CHSRC7: SUB D,R ;AOBJN pointer minus number of words in packet + CAIE A,(D) + JRST [ AOS CHNPLE ;Packet length disagrees with hardware length + JRST CHXBK2 ] + IORDI T,CAIRBF ;Read the three hardware header words + IORDI T,CAIRBF + IORDI T,CAIRBF + IORDI T,CAICSR + TRNE T,%CAERR ;Make sure packet came out of RAM okay + JRST [ AOS CHNCR2 ;Garbage, try again + JRST CHXBK2 ] + IORDI T,CAIRBC ;Make sure counter didn't spazz + CAIE T,7777 + JRST [ AOS CHNSPZ + JRST CHXBK2 ] + CONO PI,NETOFF-1 ;Get to network interrupt level + PUSHJ P,CHAPII ;Process the input + CONO PI,NETON-1 +CHXBK1: IORDI T,CAICSR ;Count lost packets + LDB TT,[$CALOS,,T] + ADDM TT,CHNLOS + MOVE TT,CHXCSR + IORI TT,%CARCL ;Enable receiver for next packet + IOWRI TT,CAICSR +CHXBK3: TRNN T,%CATDN ;Transmit done? + JRST CHXBK8 ;No, dismiss + SKIPN TT,CHOSTA ;Transmit in progress? + JRST CHXBK7 ;No, look for something to transmit + TRNN T,%CATAB ;Yes, was it aborted? + JRST CHXBK5 ;No, we're done with that packet + AOS CHNABT ;Meter transmit aborts + CAIGE TT,NCHRTR ;Aborted too many times? + JRST CHXBK7 ;No, retransmit it +CHXBK5: CONO PI,PIOFF ;Lock transmit list + HLRZ A,CHXXMQ ;Get packet probably being transmitted now + JUMPE A,[ CONO PI,PION ;It vanished? + JRST CHXBK6 ] + HLRZ B,-2(A) ;CDR transmit queue + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;Queue empty now + CONO PI,PION + HRROS B,-2(A) ;Mark it not on transmit list + AOJN B,CHXBK6 ;And unless it is on send list + PUSHJ P,CHABRT ;Return it to free +CHXBK6: SETZM CHOSTA ;Transmitter idle, look for next packet +CHXBK7: HLRZ A,CHXXMQ ;Anything queued for transmission? + JUMPE A,CHXBK9 ;No, leave interrupts disabled + AOS CHOSTA ;Count retransmissions + MOVE T,CHXCSR ;Reset transmitter + IORI T,%CATDN + IOWRI T,CAICSR + HRLI A,-%CPKDT ;Transmit header +CHXXM1: UNPK16 B,(A) + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN A,CHXXM1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHXXM4 ;No byte swapping + JUMPGE D,CHXXM3 +CHXXM2: UNPK8 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM2 +CHXXM3: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK8 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF + JRST CHXXM7 + +CHXXM4: JUMPGE D,CHXXM6 +CHXXM5: UNPK16 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM5 +CHXXM6: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK16 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF +CHXXM7: LDB T,[$CPKDN(A)] ;Get destination subnet + HRRZ D,SBNRUT(T) ;Gateway to that subnet + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;If on local cable, + LDB D,[$CPKDA(A)] ; go direct + IOWRI D,CAIWBF ;Store hardware destination address + IORDI T,CAIXMT ;Transmit packet +CHXBK8: MOVEI A,%CATEN ;Enable transmit-done interrupt if xmitting +CHXBK9: IORI A,%CAREN ;Enable receive-done interrupt always + IORB A,CHXCSR + IOWRI A,CAICSR + MOVSI 17,CHXACS ;Dismiss software interrupt + BLT 17,17 + JRST 12,@CHXBRK + +CHXBK2: PUSHJ P,CHABRT ;Packet no good, discard it + JRST CHXBK1 + +;Examine packet in A, return AOBJN pointer to data in D, +; H is negative if there is an extra halfword after that. +; W gets number of full words of data (same as LH D). +; T,U get clobbered +; Returns: +; +1 16-bit data +; +2 8-bit data +CHSHDR: HRRZI A,-%CPKDT(A) ;Restore packet address + LDB W,[$CPKNB(A)] ;Get size of packet in bytes + CAILE W,%CPMXC + MOVEI W,%CPMXC ;Self-defense + ADDI W,1 ;Round up to next word boundary + LSHC W,-2 ;Convert bytes to words, H gets remainder + HRLOI D,-1(W) ;Make AOBJN pointer + EQVI D,%CPKDT(A) + LDB T,[$CPKOP(A)] ;Does this packet need byte swapping? + TRNE T,200 + JRST [ TRNN T,100 + AOS (P) ;Character data + POPJ P, ] ;Binary data + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;Binary control packet + JRST POPJ1 ;Characters + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH11P + +SUBTTL CHAOS NET BUFFER LIST STUFF + +OVHMTR CHL + +;BUFFERS ARE PKTBSZ WORDS LONG; 2 HEADER WORDS AND %CPMXW PACKET WORDS. +;PKTBSZ IS A POWER OF 2 AND LESS THAN 1K (MEMORY PAGE SIZE). +;NOTE THAT A BUFFER ADDRESS POINTS AT THE FIRST PACKET WORD +;AND THE HEADER WORDS ARE AT NEGATIVE ADDRESSES. +;FIRST HEADER WORD: -2(A) +; RH LIST THREAD FOR MOST LISTS, 0=END, -1=NOT ON LIST +; LH LIST THREAD FOR TRANSMIT LIST +;SECOND HEADER WORD: -1(A) +; TIME RECEIVED OR TIME PUT ON TRANSMIT LIST +; OR VALUE OF I FOR A PACKET ON THE LSN QUEUE +; ASCII/LUNCH/ FOR A PACKET ON THE FREE LIST + +;I DO IT THIS WAY (PIOFF) TO AVOID HAVING TO PUSH AND POP PI STATUS, +;CONO PI,NETOFF CAN LOSE AT INTERRUPT LEVEL (MAINLY THE NETON LOSES) + +;THESE ROUTINES TURN OFF INTERRUPTS MOMENTARILY SO THAT +;LISTS MAY BE SAFELY MANIPULATED. + +;Q POINTS TO THE HEADER WORD OF A QUEUE, REMOVE THE FIRST +;THING AND RETURN IN A. (ZERO IF NONE) CLOBBERS T +CHAQGF: CONO PI,PIOFF + HLRZ A,(Q) ;GET FIRST + JUMPE A,PIONJ ;EMPTY + HRRZ T,-2(A) ;GET SECOND + HRLM T,(Q) ;MAKE FIRST +IFN FTRCHK,[ + JUMPN T,PIONJ + HRRZ T,(Q) + CAIE T,(A) + BUG PAUSE,[CHAOS LIST TRASHED],OCT,Q + SETZM (Q) ;IS NOW EMPTY +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM (Q) ;IS NOW EMPTY +];FTRCHK + CONO PI,PION + POPJ P, + +;RETURN BUFFER INTO WHICH THE BYTE POINTER IN A POINTS. CLOBBERS A,T,Q +CHBPFR: SUBI A,1 ;SIOKT LIKES TO MAKE BP POINT AT NEXT BUFFER + ANDI A,-PKTBSZ + ADDI A,2 + JRST CHABRT + +;RETURN BUFFER POINTED TO BY A TO FREE UNLESS ON TRANSMIT LIST. +CHABR1: HLLOS T,-2(A) ;RH GETS -1, NO LONGER ON REGULAR LIST + AOJN T,CPOPJ ;EXIT IF STILL ON TRANSMIT LIST + ;DROPS THROUGH +;RETURN BUFFER POINTED BY A TO FREE STORAGE. CLOBBERS T, Q. +CHABRT: MOVEI Q,CHQFRE +IFN FTRCHK,[ + SKIPN A + BUG PAUSE,[FREEING 0] +];FTRCHK + MOVE T,[ASCII/LUNCH/] ;TANSTAAFL + MOVEM T,-1(A) + SETOM -2(A) ;NOT ON TRANSMIT LIST NOW (THIS IS WHAT INITS + AOS CHFRBF ; LH[-2(A)] WHEN BUFFER FIRST CREATED) + ;JRST CHAQPL ;DROPS THROUGH + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE LAST THING. BASHES T. +CHAQPL: HLLZS -2(A) ;PUT ENDLIST IN RH + CONO PI,PIOFF + HRRZ T,(Q) ;GET LAST + HRRM A,(Q) ;MAKE NEW LAST + JUMPN T,[HRRM A,-2(T) ;MAKE A COME AFTER IT + JRST PIONJ ] + HRLM A,(Q) ;WAS EMPTY, ALSO IS NEW FIRST + CONO PI,PION + POPJ P, + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE FIRST THING. SMASHES T. +CHAQPF: CONO PI,PIOFF + HLRZ T,(Q) ;GET FIRST + HRRM T,-2(A) ;MAKE SECOND + HRLM A,(Q) ;MAKE NEW FIRST + SKIPN T + HRRM A,(Q) ;WAS EMPTY, ALSO MAKE NEW LAST + CONO PI,PION + POPJ P, + +;ALLOCATE A BUFFER AT MAIN PROGRAM LEVEL, TO A, MASHES T, TT, Q, B. +CHABG0: PUSHJ P,UDELAY ;WAIT FOR MEMORY +CHABGT: PUSHJ P,CHABGI + JRST CHABG0 + POPJ P, ;WIN + +;ALLOCATE A BUFFER, RETURN POINTER TO IT IN A, SKIP. BLOWS AWAY T, TT, Q. +;NON-SKIP IF NO BUFFERS AVAILABLE. (DOESN'T MAKE NEW ONES IF FREE LIST EMPTY) +CHABAL: MOVEI Q,CHQFRE + PUSHJ P,CHAQGF + JUMPE A,CPOPJ + SETZM -1(A) ;NO LUNCH + SOS CHFRBF + JRST POPJ1 + +;ALLOCATE A BUFFER TO A, MAKE NEW IF NONE FREE. OBLITERATES T,Q,B. +;NON-SKIP IF CAN'T GET MEMORY. (SUITABLE FOR CALLING FROM INT LEVEL) +CHABGI: PUSHJ P,CHABAL ;TRY TO ALLOCATE A BUFFER FROM FREE LIST + CAIA + JRST POPJ1 ;WON, RETURN + CONI PI,Q ;SAVE PI CHANNELS ON STATUS + ANDI Q,177 + CONO PI,UTCOFF ;MAKE THE WORLD SAFE FOR IOMQ + MOVE B,CHTTBF + CAIL B,CHMXBF ;MAKE SURE NOT TO USE UP ALL CORE + JRST CHABG4 + PUSHJ P,IOMQ ;GET 1K OF MEMORY + JRST CHABG3 ;MEM NOT AVAILABLE, FAIL + CONO PI,PICON(Q) ;WON, RESTORE PI STATUS + MOVEI B,MUCHA + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ;ADDRESS OF 1K OF ALLOCATED MEMORY + ADD A,[-<2000/PKTBSZ>,,2] ;-BUFFERS PER 1K,,OFFSET TO HEADER +CHABG2: PUSHJ P,CHABRT ;PUT THEM ALL ON FREE LIST + ADDI A,PKTBSZ-1 + AOBJN A,CHABG2 + MOVEI B,<2000/PKTBSZ> ;THIS MANY MORE BUFFERS HAVE BEEN CREATED + ADDM B,CHTTBF + JRST CHABGI ;NOW GO ALLOCATE ONE + +;HERE IF CHAOS NET TRYING TO USE UP TOO MUCH CORE +CHABG4: MOVE B,CHMXTM ;DON'T COMPLAIN TOO OFTEN + ADDI B,60.*30. ;JUST ONCE A MINUTE + CAMLE B,TIME + JRST CHABG3 +IFE CH10P, BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE] +IFN CH10P,[ + CONI CHX,B + BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE, CONI=],OCT,B,[CONO=],OCT,CHXCNO,[CHOSTA=],OCT,CHOSTA +];CH10P + MOVE B,TIME + MOVEM B,CHMXTM +CHABG3: CONO PI,PICON(Q) ;LOST, RESTORE PI STATUS + POPJ P, ;AND TAKE ERROR RETURN + +;FREE A WHOLE LIST OF BUFFERS, Q-> HEAD. DESTROYS A,T +CHALFR: PUSHJ P,CHAQGF + JUMPE A,CPOPJ + PUSH P,Q + PUSHJ P,CHABR1 ;FREE UNLESS STILL ON TRANSMIT LIST + POP P,Q + JRST CHALFR + +;Q -> A TRANSMIT QUEUE, FLUSH ALL BUFFERS BELONGING TO INDEX I. +;CLOBBERS A,B,C,T +CFLXMQ: PUSH P,Q + CONO PI,NETOFF ;DON'T LET TRANSMIT LIST CHANGE (AT ALL) + HLRZ A,(Q) ;HEAD OF TRANSMIT LIST + JUMPE A,CFLXM3 + MOVEI B,2(Q) ;B PREVIOUS PACKET, A CURRENT, C NEXT +CFLXM1: HLRZ C,-2(A) ;GET THREAD TO NEXT +IFN FTRCHK,[ + CAIN C,-1 + JRST 4,. ;CLAIMS NOT TO BE ON LIST? +];FTRCHK + LDB T,[$CPKSX(A)] ;GET THIS PACKET'S INDEX + CAME T,I + JRST CFLXM2 + HRLM C,-2(B) ;THREAD PREVIOUS TO NEXT + HRROS T,-2(A) ;IF THIS BUFFER IS NOT ALSO ON SEND LIST, + AOJN T,.+2 + PUSHJ P,CHABRT ;RETURN IT + SKIPA Q,(P) +CFLXM2: MOVE B,A + SKIPE A,C + JRST CFLXM1 + HRRM B,(Q) ;LAST PACKET ON LIST MAY HAVE CHANGED + CAIN B,2(Q) + SETZM (Q) ;TRANSMIT QUEUE IS NOW EMPTY +CFLXM3: POP P,Q + JRST NETONJ + +;SEARCH LIST IN Q FOR PACKET WHOSE CONTACT NAME MATCHES THAT +;OF PACKET IN A, RETURN IT IN B, SKIPPING IF WINNING. CLOBBERS T,TT,C,D,E,H,J. +;THE PACKET RETURNED IN B IS DE-LINKED FROM THE SEARCHED QUEUE. +;HAS TO BE CALLED WITH NETOFF OR IN PROGRESS, SO LIST CAN'T GET MUNGED. +;I HOPE IT'S NOT TOO BLETCHEROUSLY SLOW. +CHAQSR: HLRZ B,(Q) ;GET START OF LIST TO SEARCH + JUMPE B,CPOPJ ;EMPTY, LOSE + MOVEI J,0 ;PACKET PREVIOUS TO B +CHAQS1: LDB C,[$CPKNB(A)] ;SET UP STRING COMPARE LOOP + LDB H,[$CPKNB(B)] ;THIS ASSUMES NO ZERO-LENGTH STRINGS + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEI E,%CPKDT(B) + HRLI E,440800 +CHAQS2: ILDB T,D + ILDB TT,E ;DON'T IGNORE CASE, THAT WOULD JUST SLOW THIS + CAME T,TT ;BAG-BITER DOWN EVEN MORE. EVERYONE SHOULD + JRST CHAQS4 ;PUT THEIR CONTACT NAMES IN UPPER-CASE. + CAIN T,40 ;TERMINATE ON SPACE + JRST CHAQS5 + SOJLE C,CHAQS3 + SOJG H,CHAQS2 + ILDB T,D + CAIE T,40 + JRST CHAQS4 +CHAQS5: HRRZ C,-2(B) ;WON, DELINK PACKET FROM LIST + JUMPE J,[ HRLM C,(Q) + JUMPN C,POPJ1 + IFN FTRCHK,[ + HRRZ C,(Q) ;CHECK LIST ENDING IN RIGHT PLACE + CAIE C,(B) + JRST 4,. + ];FTRCHK + SETZM (Q) + JRST POPJ1 ] + HRRM C,-2(J) + JUMPN C,POPJ1 + HRRM J,(Q) ;TOOK LAST PACKET, STORE NEW LAST + JRST POPJ1 + +CHAQS3: SOJLE H,CHAQS5 + ILDB TT,E + CAIN TT,40 + JRST CHAQS5 +CHAQS4: MOVE J,B ;THIS ONE DOESN'T MATCH, TRY NEXT + HRRZ B,-2(B) + JUMPN B,CHAQS1 + POPJ P, ;NO MATCHES + +;THIS ROUTINE RUNS IN THE CORE JOB AND CLEANS UP MEMORY USED BY CHAOS BUFFERS +;SMASHES ALL ACS +CHCLN: SKIPE A,CHTTBF ;SEE IF 2/3 OR MORE OF BUFFERS FREE + SKIPN B,CHFRBF + POPJ P, ;NO BUFFERS OR NONE FREE, NOTHING TO DO + SUBM A,B + IDIV A,B ;GET RATIO OF TOTAL TO USED + CAIGE A,3 ;NOTE IF B IS ZERO A IS UNCHANGED + POPJ P, ; AND AT LEAST 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ;SCAN MEMORY FOR CHAOS BUFFER PAGES +.ELSE MOVEI D,255. +CHCLN0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUCHA +CHCLN4: SOJGE D,CHCLN0 + JUMPL D,CPOPJ + MOVE A,D ;QUICKLY DETERMINE IF ANY NON-FREE BUFFERS + LSH A,10. ; ON THIS PAGE + HRLI A,-<2000/PKTBSZ> + MOVE T,[ASCII/LUNCH/] +CHCLN5: CAME T,1(A) + JRST CHCLN4 ;NOT FREE, DON'T BOTHER WITH SLOW STUFF + ADDI A,PKTBSZ-1 + AOBJN A,CHCLN5 + SETZB C,CHCLNQ ;COLLECT ALL FREE BUFFERS THAT ARE ON THIS PAGE + MOVE E,CHFRBF ;LOOP ABOUT AS MANY TIMES AS THERE ARE FREE BUFFERS +CHCLN1: PUSHJ P,CHABAL ;GET NEXT FREE BUFFER + JUMPE A,CHCLN2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,CHCLNQ ;THIS ONE'S ON THE PAGE, SAVE IT + PUSHJ P,CHAQPL + AOJA C,.+2 ] ;COUNT THEM + PUSHJ P,CHABRT ;NOT ON THE PAGE, PUT BACK + SOJG E,CHCLN1 +CHCLN2: CAIE C,<2000/PKTBSZ> ;DID WE GET THE WHOLE PAGE? + JRST [ MOVEI Q,CHCLNQ ? PUSHJ P,CHALFR ? JRST CHCLN4 ] + MOVNS C ;YES, GET RID OF THESE BUFFERS + ADDM C,CHTTBF + MOVE A,D + PUSHJ P,MEMR + JRST CHCLN + +OVHMTR CHZ diff --git a/system/chaos.287 b/system/chaos.287 new file mode 100644 index 0000000..769ce7c --- /dev/null +++ b/system/chaos.287 @@ -0,0 +1,2796 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +IFE IMPP, IFE CH11P, .ERR NOT EVERYTHING IN CHAOS WILL WORK WITHOUT IMP +IFNDEF FTRCHK, FTRCHK==0 ;PROBABLY FOUND ALL THE BUGS THIS WAS GOOD FOR + ; LONG AGO +IFN FTRCHK, .ERR REDUNDANT CHECKING ENABLED IN CHAOS ROUTINES + +;NOTES: +; WINDOW SIZE ADJUSTMENT STUFF +; ROUND TRIP TIME MEASUREMENT & OTHER METERING +; BETTER METERING, SOME METERS ARE CURRENTLY MISSING + +SUBTTL CH-10 HARDWARE DEFINITIONS + +IFN CH10P,[ +CHX==470 ;I/O DEVICE NUMBER + +;CONI/CONO BITS + ;1.1-1.3 PIA +CHXTEN==10 ;1.4 TRANSMIT INTERRUPT ENABLE +CHXREN==20 ;1.5 RECEIVE INTERRUPT ENABLE +CHXSPY==40 ;1.6 MATCH ANY DESTINATION +CHXLUP==100 ;1.7 LOOP BACK +CHXSWB==200 ;1.8 SWAP BYTES +CHXHLF==400 ;1.9 HALFWORD DATAO +CHXXMT==1000 ;2.1 TRANSMIT DONE (CONI) + ; TRANSMIT OR RETRANSMIT PACKET (CONO) +CHXRCV==2000 ;2.2 RECEIVE DONE (CONI) + ; ENABLE TO RECEIVE NEXT PACKET (CONO) +CHXABT==4000 ;2.3 TRANSMIT ABORTED (CONI) + ; RESET TRANSMITTER (CONO) +$CHXLC==140400 ;2.4-2.7 LOST COUNT (CONI) +CHXRST==10000 ;2.4 RESET (CONO) +CHXCRC==200000 ;2.8 CRC ERROR (CONI) +CHXWLE==400000 ;2.9 WORD LENGTH ERROR (CONI) +CHXPLE==1,, ;3.1 PACKET LENGTH ERROR (CONI) +CHXOVR==2,, ;3.2 OVERRUN (CONI) +$CHXAD==242000 ;3.3-4.9 CHAOSNET ADDRESS (CONI) +];CH10P + +IFN CH11P,[ +$INSRT KSNET +];CH11P + +SUBTTL CHAOS NET VARIABLES + +EBLK + +$CHXRI==001200 ;REAL INDEX PART (LOW TEN BITS) - IS IN LH(IOCHNM) +$CHXUN==120600 ;UNIQUIZATION PART (TOP SIX BITS) +CHXMUN==1_6-1 ;MAXIMUM VALUE OF UNIQUIZER +MXWIND==100 ;MAXIMUM WINDOW SIZE (8K WORDS) +.SEE MYCHAD ;SUBNET AND HOST OF MYSELF +.SEE DLCP ;1 MEANS USE DL10 TO GET TO CHAOS NET +.SEE T11CHP ;1 MEANS USE TEN-11 INTERFACE TO GET TO CHAOS NET +.SEE CH10P ;1 MEANS USE CH10 HARDWARE TO GET TO CHAOS NET +.SEE CH11P ;1 MEANS USE UNIBUS CHAOSNET HARDWARE ON KS10 + +;Internet address of my Chaosnet Interface +IMPUS4==<.BYTE 4 ? 0 ? .BYTE 8 ? 128. ? 31. ? .BYTE 16. ? MYCHAD> + +;PER-INDEX VARIABLES + +CHSUSR: REPEAT NINDX,-1 ;-1 INDEX NOT IN USE + ;OTHERWISE RH USER + $CHSUO==220600 ;3.1-3.6 OUTPUT CHANNEL NUMBER (77=IOPUSHED) + $CHSUI==300600 ;3.7-4.3 INPUT CHANNEL NUMBER (77=IOPUSHED) + ;4.9 ZERO IF IN USE + +CHSSTA: REPEAT NINDX,-1 ;RH STATE, LH FLAGS + %CF==525252(1) + %CFOFF==400000 ;SIGN BIT MEANS TURNED OFF AT PI LEVEL, NO TALKING TO NETWORK + %CFSTS==200000 ;SEND STS PACKET AS SOON AS POSSIBLE (1/2 SECOND CLOCK) + %CFCLS==100000 ;HALF-CLOSED FLAG + %CFSTY==040000 ;DIRECT-CONNECTED TO STTY FLAG + $CFTTN==220600 ;TTY NUMBER OF STTY CONNECTED TO + + %CS==,,-1 + .SEE %CSCLS ;FOR SYMBOLS FOR STATES + +CHSNBF: BLOCK NINDX ;LH LENGTH(CHSPBF), RH LENGTH(CHSIBF) +CHSNOS: BLOCK NINDX ;NUMBER OF FREE OUTPUT SLOTS IN THE WINDOW +CHSIBF: BLOCK NINDX ;RECEIVE BUFFER POINTERS FIRST,,LAST +CHSPBF: BLOCK NINDX ;OUT OF ORDER RECEIVE BUFFER POINTERS FIRST,,LAST +CHSOBF: BLOCK NINDX ;TRANSMIT BUFFER POINTERS FIRST,,LAST +CHSITM: BLOCK NINDX ;TIME OF LAST INPUT FROM NET +CHSWIN: BLOCK NINDX ;WINDOW SIZE RECEIVE,,TRANSMIT +CHSPKN: BLOCK NINDX ;LAST PACKET# GIVEN TO USER,,LAST PACKET# SENT BY USER +CHSACK: BLOCK NINDX ;LAST PACKET# ACKNOWLEDGED RECEIVE,,TRANSMIT (START OF WINDOW) +CHSLCL: REPEAT NINDX,<.BYTE 16. ? MYCHAD ? 100000+.RPCNT> + ;BYTE (16) LOCAL HOST, LOCAL INDEX (4) 0 + ;NOTE THIS SAVES THE UNIQUIZER BITS FOR THIS INDEX +CHSFRN: BLOCK NINDX ;BYTE (16) FOREIGN HOST, FOREIGN INDEX (4) 0 +;THESE FOUR ARE FOR BYTE-STREAM I/O +CHSOBP: BLOCK NINDX ;BYTE PNTR TO OUTPUT BUFFER, 0 IF NONE +CHSOBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF BYTE SPACES LEFT IN OUTPUT BUFFER +CHSIBP: BLOCK NINDX ;BYTE PNTR TO INPUT BUFFER, 0 IF NONE +CHSIBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF VALID BYTES REMAINING IN INPUT BUFFER + +CHAOSW: -1 ? 0 ;SWITCH FOR ALLOCATING INDICES +CHALCP: 0 ;LAST INDEX ALLOCATED, USED TO CIRCULARIZE ALLOCATION + +CHIRFJ: SIXBIT/CHAOS/ ? 0 ;AGENT OF CHAOS +.SEE NETUSW ;NON-ZERO ENABLES RFC'S FROM HOSTS OTHER THAN SELF. + +;METERS + +CHNPI: 0 ;NUMBER OF PACKETS INPUT (REALLY TO 10) +CHNPO: 0 ;NUMBER OF PACKETS OUTPUT (ALL CAUSES) +CHNPF: 0 ;NUMBER OF PACKETS FORWARDED +CHNSTS: 0 ;NUMBER OF STS PACKETS OUTPUT +CHNSNS: 0 ;NUMBER OF SNS PACKETS OUTPUT +CHNRTR: 0 ;NUMBER OF RETRANSMITTED PACKETS OUTPUT +CHNPFL: 0 ;NUMBER OF PACKETS DISCARDED (FORWARDING LOOP) +CHNPD: 0 ;NUMBER OF PACKETS DISCARDED (DUPLICATES) +CHNIPI: 0 ;NUMBER OF INTERNET PACKETS IN FROM CHAOSNET +CHNIPO: 0 ;NUMBER OF INTERNET FRAGMENTS OUT TO CHAOSNET + +;BUFFER QUEUES. EACH HAS A ONE-WORD HEADER, WHICH IS ZERO +;IF IT IS EMPTY, OR CONTAINS FIRST,,LAST BUFFER ADDRESS. + +CHQFRE: 0 ;FREE LIST +CHQRFC: 0 ;PENDING RFCS +CHQLSN: 0 ;PENDING LISTENS +CHCLNQ: 0 .SEE CHCLN + +CHFRBF: 0 ;NUMBER OF FREE BUFFERS +CHTTBF: 0 ;TOTAL NUMBER OF BUFFERS +IF2 CHMXBF==50.*<1024./<%CPMXW+2>> ;MAX CORE FOR CHAOS NET 50K +CHMXTM: 0 ;TIME OF LAST COMPLAINT ABOUT USING TOO MUCH CORE + +IFN T11CHP,[ +;VARIABLES FOR TEN-11 INTERFACE CONNECTING TO CHAOS NET + +.SEE T11CHS ;EXEC ADDRESS OF PDP11 COMMUNICATION AREA +T11VER=T11CHS ;VERSION NUMBER +T11I10=T11CHS+1 ;INIT 10 +T11I11=T11CHS+2 ;INIT 11 +T11PRM=T11CHS+3 ;.WORD BUFFER SIZE, # BUFFERS + ;THEN 4 SPARE DOUBLEWORDS +T11IBB: T11CHS+8 ;BEGINNING OF INPUT BUFFERS +T11IBE: 0 ;END OF INPUT BUFFERS +T11IBP: 0 ;POINTER TO NEXT INPUT BUFFER +T11OBB: 0 ;BEGINNING OF OUTPUT BUFFERS +T11OBE: 0 ;END OF OUTPUT BUFFERS +T11OBP: 0 ;POINTER TO NEXT OUTPUT BUFFER +T11BSZ: 0 ;BUFFER SIZE IN PDP10 WORDS +T11WIN: 0 ;1 WINNING, -1 HAVE TOLD 11 TO INIT, 0 NOT WINNING +T11XMQ: 0 ;QUEUED TRANSMISSION QUEUE +T11CKE: 0 ;COUNT OF CHECKSUM ERRORS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +];T11CHP + +IFN DLCP,[ +;VARIABLES FOR INTERFACE TO CHAOS NET ON PDP11 ON DL10 +;.SEE INDICATES A VARIABLE SHARED BETWEEN 10 AND 11 +;NOTE THAT THE DL10 HARDWARE LIMITS PACKET LENGTH TO 256 WORDS (1K BYTES) + +.SEE DLCINI ;WHEN THE 11 SEES THIS NON-ZERO, IT KNOWS ITS HAS + ; BEEN RELOADED AND RESETS ITS PACKET POINTER TO 0 + ; AND CLEARS DLCINI. +DLCSBF: 0 ;CURRENT BUFFER, 10 SEND SIDE (1 OR 0) + +DLCSA1: 0 ;ADDRESS OF PACKET BEING SENT +DLCSA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCSP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCSP2 ;DITTO, SECOND BUFFER +.SEE DLCSS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 SENT TO 11, 2 11 DONE +.SEE DLCSS2 ;STATE FOR BUFFER 2 + +DLCRA1: 0 ;ADDRESS OF PACKET BUFFER RECEIVING A PACKET +DLCRA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCRP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCRP2 ;DITTO, SECOND BUFFER +.SEE DLCRS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 AWAITING 11, 2 CONTAINS A PACKET +.SEE DLCRS2 ;STATE FOR BUFFER 2 + +DLCXMQ: 0 ;TRANSMIT BUFFER LIST FOR DL10 + ;NOTE THAT THIS IS NOT A REGULAR BUFFER LIST SINCE + ;IT IS THREADED THROUGH LH INSTEAD OF RH. WE DO MAINTAIN + ;POINTERS TO FIRST,,LAST HOWEVER +];DLCP + +IFN CH10P,[ +;VARIABLES FOR CH10 INTERFACE ONLY + +CHXCNO: CHXREN+CHXTEN+CHXCHN ;CONO BITS CURRENTLY IN EFFECT +];CH10P + +IFN CH11P,[ +;VARIABLES FOR CH11 INTERFACE ONLY + +CHXCSR: %CAREN+%CATEN ;CURRENT BITS WANTED IN CSR +];CH11P + +IFN CH10P+CH11P,[ +;VARIABLES THAT WOULD OTHERWISE BE IN THE FRONT-END + +CHXXMQ: 0 ;HEAD,,TAIL OF TRANSMIT QUEUE +CHOSTA: 0 ;OUTPUT STATUS: 0 IDLE, ELSE NUMBER OF TRANSMISSIONS +NCHRTR==4 ;TRANSMIT UP TO 4 TIMES IN FACE OF COLLISIONS + +;ROUTING STUFF +NSUBNT==122. ;122 is maximum possible +SBNRUT: REPEAT NSUBNT, 1000,,3040 ;COST,,GATEWAY ADDRESS + +;EXTRA METERS +CHNABT: 0 ;NUMBER OF TRANSMIT ABORTS +CHNCRC: 0 ;NUMBER OF CRC ERRORS BEFORE READING PACKET +CHNCR2: 0 ;NUMBER OF CRC ERRORS AFTER READING PACKET +CHNWLE: 0 ;NUMBER OF WORD LENGTH ERRORS (NOT MULTIPLE OF 16 BITS) +CHNPLE: 0 ;NUMBER OF PACKET LENGTH ERRORS (DISAGREES WITH LENGTH IN HEADER) +CHNLOS: 0 ;NUMBER OF PACKETS LOST DUE TO RECEIVER BUSY +];CH10P+CH11P +IFN CH11P,[ +CHNSPZ: 0 ;NUMBER OF TIMERS BIT COUNTER SPAZZED +];CH11P + +BBLK + +;Get definitions of packet format + +IF1,[ +$INSRT CHSDEF + +PKTBSZ==%CPMXW+2 ;PACKET BUFFER IS 2 HEADER WORDS + MAX SIZE PACKET +IFN >-PKTBSZ, .ERR PKTBSZ IS SUPPOSED TO BE A POWER OF 2 + +$CPKSX==$CHXRI+40000,,2 ;REAL PART OF SOURCE INDEX +$CPKDX==$CHXRI+40000,,1 ;REAL PART OF DESTINATION INDEX + +];IF1 + +;;; Debugging Info + +;;; This contains the last N headers received from the network +NRECHD==20 +EBLK +RECHDP: RECHDR ;POINTER TO NEXT +RECHDR: BLOCK NRECHD*%CPKDT +BBLK + +SUBTTL CHAOS NET OPEN (.CALL CHAOSO) + +;.CALL CHAOSO,RCVCHN,XMTCHN, + +CHASO: JRST OPNL12 ; Say "mode not avail" +CHAOSO: HRRZS A + HRRZS B + CAIGE A,20 + CAIL B,20 + JRST OPNL14 ;BAD CHANNEL NUMBER ARGUMENT + CAMN A,B + JRST OPNL33 ;BOTH CHANNELS SAME IS ILLEGAL + PUSH P,A ;SAVE ARGS, CLOSE THE SPECIFIED CHANNELS + PUSH P,B + PUSH P,C + MOVE R,A + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + MOVE R,-1(P) ;B + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,C + POP P,B + POP P,A + MOVE U,USER ;TO SAVE ULCERS + HRRZM A,UUAC(U) ;REMEMBER INPUT CHNL # FOR ERRS + PUSHJ P,SWTL ;LOCK CHAOS INDEX ASSIGNMENT SWITCH + CHAOSW + MOVE I,CHALCP ;ALLOCATE AN INDEX + SOJL I,CHASO2 +CHASO1: SKIPL CHSUSR(I) + SOJGE I,CHASO1 + JUMPGE I,CHASO3 +CHASO2: MOVEI I,NINDX ;REACHED BEGINNING, WRAP AROUND TO END + CAMN I,CHALCP + JRST OPNL6 ;ALL INDICES IN USE + MOVEM I,CHALCP + SOJA I,CHASO1 + +CHASO3: MOVEM I,CHALCP ;SAVE SCAN POINTER FOR NEXT TIME + PUSHJ P,CHASO4 ;INIT VARIOUS STUFF + CAILE C,MXWIND ;SET UP WINDOW SIZE + MOVEI C,MXWIND ;DON'T LET USER USE UP TOO MUCH WIRED CORE + HRLZM C,CHSWIN(I) + HRRZM U,CHSUSR(I) ;VARIABLES INITIALIZED, MAKE INDEX IN USE. + DPB A,[$CHSUI,,CHSUSR(I)] + DPB B,[$CHSUO,,CHSUSR(I)] + HRLZ T,I ;SET UP USER'S IOCHNM WORDS + HRRI T,CHAIDN + ADDI A,IOCHNM(U) + MOVEM T,(A) + HRRI T,CHAODN + ADDI B,IOCHNM(U) + MOVEM T,(B) + JRST LSWPJ1 ;SUCCESS RETURN + +;INITIALIZE CONNECTION IN I +CHASO4: SETZM CHSNBF(I) + SETZM CHSNOS(I) + SETZM CHSIBF(I) + SETZM CHSPBF(I) + SETZM CHSOBF(I) + SETZM CHSACK(I) + SETZM CHSPKN(I) ;START PACKET NUMBERING AT ONE + SETZM CHSOBP(I) + SETZM CHSOBC(I) + SETZM CHSIBP(I) + SETZM CHSIBC(I) + MOVSI T,%CFOFF .SEE %CSCLS + MOVEM T,CHSSTA(I) + LDB TT,[$CHXUN+40000,,CHSLCL(I)] + CAIE TT,CHXMUN ;INCREMENT THE UNIQUIZER + AOSA TT + MOVEI TT,1 ;BUT MAKE SURE IT ISN'T ZERO + DPB TT,[$CHXUN+40000,,CHSLCL(I)] + SETZM CHSFRN(I) + POPJ P, + +SUBTTL CHAOS NET CLOSE, FINISH, WHYINT, NETBLK, CHAOSQ + +;CLOSE A CHAOS CHANNEL. +CHACLS: HLRZ I,(R) ;GET VARIABLES INDEX + MOVSI A,%CFCLS + TDNN A,CHSSTA(I) ;ONLY REALLY CLOSE WHEN BOTH CHANNELS CLOSED + JRST CHACS7 + PUSHJ P,CHACS1 ;FLUSH ALL BUFFERS OF THIS CONNECTION + HRRZ T,CHSSTA(I) + CAIN T,%CSOPN + PUSHJ P,CHABGI ;SEND A CLS IF OPEN AND MEM AVAIL + JRST CHACS4 + MOVE T,CHSFRN(I) + MOVEM T,%CPKS(A) + MOVE T,CHSLCL(I) + MOVEM T,%CPKD(A) + MOVEI B,[ASCIZ/Channel closed/] + PUSHJ P,CHIRF2 +CHACS4: CONO PI,NETOFF + SETZM (R) ;CLOSE THIS CHANNEL + SETOM CHSUSR(I) ;RETURN INDEX + MOVE W,CHQLSN ;FLUSH ANY PENDING LSN PACKET + SETZM CHQLSN +CHACS5: MOVEI Q,W ;GET NEXT PACKET OFF OLD LIST + PUSHJ P,CHAQGF + JUMPE A,NETONJ ;EXHAUSTED + LDB B,[$CPKSX(A)] ;GET OWNER + CAME B,I + JRST [ MOVEI Q,CHQLSN ;NOT THIS INDEX, PUT BACK + PUSHJ P,CHAQPL + JRST CHACS5 ] + PUSHJ P,CHABRT ;FREE + JRST CHACS5 + +CHACS7: IORM A,CHSSTA(I) .SEE %CFCLS + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + MOVEI T,77 ;CLOSE THAT CHANNEL + DPB T,B + SETZM (R) + POPJ P, + +;THIS FLUSHES ALL BUFFERS FOR CONNECTION IN I +CHACS1: MOVSI A,%CFOFF ;INHIBIT RETRANSMISSIONS + IORB A,CHSSTA(I) + LDB E,[$CFTTN,,CHSSTA(I)] + EXCH E,I + TLNE A,%CFSTY + PUSHJ P,NSTYN0 ;DISCONNECT FROM STY + JFCL + EXCH E,I +IFN DLCP,[ + MOVEI Q,DLCXMQ ;REMOVE THIS INDEX'S BUFFERS FROM DL10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ ;REMOVE THIS INDEX'S BUFFERS FROM TEN11 TRANSMIT LIST + PUSHJ P,CFLXMQ +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ ;REMOVE THIS INDEX'S BUFFERS FROM CH10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];CH10P+CH11P + MOVEI Q,CHSIBF(I) ;RETURN RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSPBF(I) ;RETURN OUT OF ORDER RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSOBF(I) ;RETURN TRANSMIT BUFFERS + PUSHJ P,CHALFR +IFE FTRCHK,[ + SKIPE A,CHSOBP(I) ;RETURN STREAM I/O BUFFERS + PUSHJ P,CHBPFR + SKIPE A,CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK +IFN FTRCHK,[ + SKIPN A,CHSOBP(I) + JRST .+3 + SETZM CHSOBP(I) + PUSHJ P,CHBPFR + SKIPN A,CHSIBP(I) + JRST .+3 + SETZM CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK + POPJ P, + +;.CALL FORCE ON A CHAOS OUTPUT CHANNEL. +CHAFRC: HLRZ I,(R) + SKIPGE CHSSTA(I) .SEE %CFOFF + JRST OPNL7 ;DEVICE NOT READY + AOS (P) ;WILL TAKE SUCCESS RETURN +CHAFC1: SKIPN A,CHSOBP(I) + POPJ P, ;NO BUFFERED OUTPUT TO BE FORCED + SUBI A,1 ;SIOKT LIKES TO POINT BP AT NEXT BUFFER + ANDI A,-PKTBSZ ;GET PACKET POINTER + ADDI A,2 + MOVSI T,(SETZ) ;DATA OPCODE + MOVEM T,(A) .SEE $CPKOP + MOVEI T,%CPMXC ;SET BYTE COUNT + SUB T,CHSOBC(I) + DPB T,[$CPKNB(A)] + PUSHJ P,[JUMPN T,CHODT1 ;IF THERE IS ANYTHING IN THE BUFFER, TRANSMIT IT + JRST CHABRT ] ;OTHERWISE, JUST THROW IT AWAY + SETZM CHSOBP(I) ;NOW THERE IS NO BUFFER + SETZM CHSOBC(I) + POPJ P, + +;.CALL FINISH ON A CHAOS OUTPUT CHANNEL. WAIT FOR ALL BUFFERS +;ON SEND LIST TO GET SENT AND ACKNOWLEDGED. +;HANGS FOREVER IF SOCKET GETS INTO AN IMPROPER STATE, BUT YOU SHOULD GET AN INTERRUPT +CHAFIN: HLRZ T,(R) + PUSHJ P,[HRRZ A,CHSWIN(T) + CAMG A,CHSNOS(T) + AOS (P) + POPJ P, ] + PUSHJ P,UFLS + JRST POPJ1 + +;.CALL WHYINT ON A CHAOS CHANNEL. +;RESULTS ARE: A/ %WYCHA +; B/ STATE +; C/ LH NUMBER OF INPUT PACKETS AVAILABLE +; RH NUMBER OF OUTPUT SLOTS AVAILABLE +; D/ WINDOW SIZE (RECEIVE,,TRANSMIT) +; E/ INPUT CHNL#,,OUTPUT CHNL# +CHAWHY: HLRZ I,(R) + MOVEI A,%WYCHA + HRRZ B,CHSSTA(I) + HRLZ C,CHSNBF(I) ;NUMBER OF PACKETS AVAILABLE + SKIPE CHSIBP(I) + ADD C,[1,,] ;ADD 1 IF PARTIALLY-READ INPUT BUFFER EXISTS + MOVSI D,%CFSTY + TDNE D,CHSSTA(I) + MOVEI C,0 ;NO INPUT AVAILABLE IF DIRECT-CONNECTED + SKIPLE CHSNOS(I) + HRR C,CHSNOS(I) + MOVE D,CHSWIN(I) + LDB E,[$CHSUO,,CHSUSR(I)] + CAIN E,77 + MOVEI E,-1 + LDB T,[$CHSUI,,CHSUSR(I)] + CAIN T,77 + TLOA E,-1 + HRL E,T + JRST POPJ1 + +;.CALL RFNAME on a CHAOS channel. A contains index. +;Returns results analogous to RFNAME on TCP: and (almost) RFNAME on NET:. +;"FN1" is local index, "FN2" is foreign index, "SNAME" is foreign host +;number in HOSTS3 format. +CHARCH: LDB B,[042000,,CHSLCL(A)] + LDB C,[042000,,CHSFRN(A)] + LDB D,[242000,,CHSFRN(A)] + TLO D,(NW%CHS) + POPJ P, + +;IOPDL ROUTINES. I IS 0 FOR IOPUSH, 1 FOR IOPOP. R POINTS AT IOCHNM WORD. +;C(R) IS SET UP TO THIS DEVICE IN EITHER CASE. +CHAIOP: HRRZ T,R ;DISCOVER CHANNEL NUMBER + SUBI T,IOCHNM(U) + SKIPN I + MOVEI T,77 ;IOPUSH, USE 77 + HLRZ I,(R) ;GET CHAOS INDEX + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + DPB T,B ;ADJUST SAVED CHANNEL NUMBER + POPJ P, + +;.CALL NETBLK ON A CHAOS CHANNEL. +;ARG 1 - CHANNEL (COMES IN IN R) +;ARG 2 - UNDESIRED STATE +;ARG 3 - OPTIONAL TIMEOUT, WRITTEN BACK UNLESS IMMEDIATE +;VAL 1 - NEW STATE +;VAL 2 - TIME LEFT +CHANBK: HRRZ T,(R) + CAIL T,CHAIDN + CAILE T,CHAODN +IFN NCPP, JRST ANETBL ;NOT A CHAOS CHANNEL, TRY ARPANET +IFE NCPP, JRST OPNL34 + HLRZ I,(R) + MOVE T,I ;SAVE INDEX IN T FOR FLSINS + CAIGE W,3 + JRST [ HRLOI D,377777 ;NO TIME GIVEN, USE INFINITY + JRST CHANB4 ] + TLNE C,1000 ;SKIP IF POINTER RATHER THAN IMMEDIATE + JRST [ HRRZ D,C ;GET IMMEDIATE TIME + ADD D,TIME + JRST CHANB4 ] + XCTR XRW,[MOVES D,(C)] ;GET TIME, CHECK WRITEABILITY + JUMPGE D,[ MOVNS D ;RELATIVE TIME, MAKE NEGATIVE ABSOLUTE + SUB D,TIME + JRST .+1 ] + UMOVEM D,(C) ;STORE BACK ABSOLUTE TIME + MOVNS D ;MAKE POSITIVE +CHANB4: MOVEM D,AC0S+D(U) ;SAVE ABSOLUTE TIME TO WAIT UNTIL + MOVEM B,AC0S+B(U) ;SAVE UNDESIRED STATE + PUSHJ P,CHANB2 ;SKIP IF STATE CHANGE OR TIMEOUT + PUSHJ P,UFLS + MOVE B,D + SUB B,TIME ;HOW MUCH USED? + HRRZ A,CHSSTA(I) ;NEW STATE + JRST POPJ1 + +CHANB2: HRRZ A,CHSSTA(T) ;CURRENT STATE + CAME A,AC0S+B(U) ;SKIP IF STILL MATCH + JRST POPJ1 + MOVE A,AC0S+D(U) ;TIMEOUT TIME + CAMG A,TIME + AOS (P) + POPJ P, + +;.CALL CHAOSQ +;ARG 1 - ADDRESS OF A %CPMXW-WORD PACKET BUFFER +;FINDS THE FIRST PACKET ON THE PENDING-RFC QUEUE, COPIES IT +;INTO THE USER'S BUFFER, AND RETURNS IT TO THE QUEUE. +CHAOSQ: MOVE C,A ;SAVE POINTER TO USER'S BUFFER + HRL A,A ;MAKE SURE USER'S BUFFER IS SWAPPED IN + XCTR XBRW,[BLT A,%CPMXW-1(C)] ;AND NO MAR BREAK SET + MOVEI Q,CHQRFC ;GET FIRST PACKET ON RFC QUEUE + PUSHJ P,CHAQGF + JUMPE A,OPNL4 ;QUEUE IS EMPTY + PUSHJ P,CHAQPL ;PUT BACK AT END OF QUEUE + HRL C,A ;COPY PACKET TO USER + MOVE T,C + XCTR XBW,[BLT T,%CPMXW-1(C)] + JRST POPJ1 + +SUBTTL CHAOS NET IOT ROUTINES + +;.CALL PKTIOT. ARG1 CHANNEL, ARG2 ADDRESS OF %CPMXW-WORD BUFFER +PKTIOT: HRRZ A,(R) + CAIN A,CHAODN + JRST CHPKO + CAIE A,CHAIDN + JRST OPNL34 ;WRONG TYPE DEVICE +;CHAOSNET INPUT PKTIOT +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKI: PUSHJ P,CHAIOS ;SET UP I, E + HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,[PUSHJ P,CHPKI0 ;LIST EMPTY + JRST CHPKI ] + HRL B,A ;COPY TO USER BEFORE REMOVING FROM LISTS + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,4*%CPKDT+3 ;HEADER PLUS ROUND-UP TO NEXT WORD BOUNDARY + LSH T,-2 ;CONVERT BYTES TO WORDS + ADDI T,-1(B) ;ADDRESS OF LAST DESTINATION WORD + XCTR XBW,[BLT B,(T)] + LDB TT,[$CPKOP(A)] ;GET OPCODE + CAIGE TT,%CODAT ;ACKNOWLEDGE IF DATA + CAIN TT,%COEOF ;OR EOF MARK + PUSHJ P,CHPKIA + SOS CHSNBF(I) ;NOW REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + PUSHJ P,CHABRT ;AND RETURN TO FREE + JRST POPJ1 ;SUCCESS + +;INPUT WITH INPUT BUFFER EMPTY. MUSTN'T BASH B,C,E. +CHPKI0: SKIPGE CHSSTA(I) .SEE %CFOFF + JRST [ HRRZ T,CHSSTA(I) + CAIE T,%CSFRN ;CHAOSNET OR FOREIGN PROTOCOL? + JRST IOCR10 ;IOT WITH CHANNEL IN IMPROPER STATE + JRST .+1 ] ;WAIT BUT DON'T TRY TO TOUCH WINDOW SIZE + ;HERE CONSIDER INCREASING WINDOW SIZE + SKIPN CHSIBF(I) ;AWAIT INPUT + PUSHJ P,UFLS + POPJ P, ;RETRY + +;ACKNOWLEDGE DATA PACKET IN A. ITS OPCODE IN TT. +CHPKIA: LDB T,[$CPKPN(A)] ;GET PACKET # + HRLM T,CHSPKN(I) ;IT NOW NEEDS TO BE ACKNOWLEDGED + CAIN TT,%COEOF ;ALWAYS ACKNOWLEDGE EOF RIGHT AWAY + JRST CHASTO + HLRZ TT,CHSACK(I) ;GET LAST ONE REALLY ACKNOWLEDGED + SUB T,TT ;GET NUMBER OF PACKETS AWAITING ACK + SKIPGE T + ADDI T,200000 + IMULI T,3 ;MORE THAN ONE THIRD THE WINDOW SIZE? +IFN FTRCHK,[ + MOVE TT,-1(A) + CAMN TT,[ASCII/LUNCH/] + BUG PAUSE,[CHAOS BUFFER ADDRESS TRASHED],OCT,A +];FTRCHK + HLRZ TT,CHSWIN(I) + CAML T,TT + PUSHJ P,CHASTO ;YES, SEND ACK (CAN'T PCLSR) + POPJ P, + +;SET UP FOR CHAOS IOT +CHAIOS: HLRZ I,(R) ;GET INDEX + MOVE E,CHSSTA(I) + TLNE E,%CFSTY+%CFCLS + JRST IOCR10 ;CAN'T DO I/O WHILE DIRECT-CONNECTED OR HALF-CLOSED + HRRZS E ;RETURN STATE IN E + POPJ P, + +;UNIT-MODE INPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUI: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + MOVE E,[440800,,4] + JSP B,(T) + CHSIBP(I) + CHSIBC(I) + CHAIBG + CHAIBD + 0 + TRNA + +;CHAOS INPUT BUFFER DISCARD +CHAIBD: SKIPN A,CHSIBP(I) + POPJ P, + SETZM CHSIBP(I) + SETZM CHSIBC(I) + JRST CHBPFR + +;CHAOS INPUT BUFFER GET +CHAIBG: HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,CHAIB2 ;NONE + LDB TT,[$CPKOP(A)] ;IS IT NORMAL DATA? + CAIE TT,%CODAT + JRST CHAIB1 ;NO + PUSHJ P,CHAIB3 ;YES, ACKNOWLEDGE AND REMOVE FROM LIST + LDB J,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEI TT,%CPKDT(A) + JRST SIOBG1 + +CHAIB3: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHPKIA ;SEND ACKNOWLEDGEMENT + POP P,E + POP P,C + POP P,B + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + JRST CHAQGF + +CHAIB1: CAIE TT,%COEOF + JRST CHAIB2 + PUSHJ P,CHAIB3 ;EOF PACKET, ACKNOWLEDGE IT + PUSHJ P,CHABRT ;RETURN IT TO FREE + JRST POPJ2 ;AND SIGNAL EOF + +CHAIB2: MOVE TT,CTLBTS(U) ;CHECK DON'T-HANG MODE + TRNE TT,10 + JRST POPJ2 ;YES, EOF + JUMPN A,IOCR10 ;NO, ABNORMAL PACKET, BARF + PUSHJ P,CHPKI0 ;AWAIT INPUT + JRST CHAIBG ;RETRY + +;UNIT-MODE OUTPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUO: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + CAIE E,%CSOPN + JRST IOCR10 ;NOT OPEN, ERROR + MOVE E,[440800,,4] + JSP B,(T) + SETZ CHSOBP(I) + CHSOBC(I) + CHAOBG + CHAOBW + 0 + TRNA + +;GET NEW OUTPUT BUFFER +CHAOBG: SKIPG CHSNOS(I) ;WINDOW FULL + PUSHJ P,[ MOVE TT,CTLBTS(U) + TRNN TT,10 + JRST UFLS + SUB P,[1,,1] + JRST POPJ2 ] ;DON'T HANG MODE, RETURN "EOF" + PUSH P,B + PUSHJ P,CHABGT ;SET UP AN OUTPUT BUFFER + POP P,B + + MOVEI TT,%CPKDT(A) + MOVEI J,%CPMXC + JRST SIOBG1 + +;WRITE OUTPUT BUFFER +CHAOBW: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHAFC1 + POP P,E + JRST POPCBJ + +;CHAOSNET OUTPUT PKTIOT. +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKO: PUSHJ P,CHAIOS ;SET UP I, E + UMOVE H,(B) ;GET HEADER WORD OF USER'S PACKET BUFFER + LDB D,[$CPKNB H] ;GET BYTE COUNT + CAIG D,%CPMXC + TLNE H,(.BM $CPKMV) ;WE DON'T SUPPORT MUPPETS ANY MORE + JRST IOCER3 ;BYTE LENGTH OUT OF BOUNDS + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS, INCLUDING HEADER WDS + LSH D,-2 + MOVSI J,1(B) ;SAVE ADDRESS+1 OF USER'S PACKET + PUSHJ P,CHABGT ;GET A BUFFER + PUSHJ P,LOSSET ;RETURN IT IF PCLSR + CHPKO2 + MOVEM H,(A) ;STORE PACKET HEADER, NOT STORED WITH BLT + HRRI J,1(A) ; BECAUSE MIGHT HAVE CHANGED AFTER ERROR CHECK + ADDI D,-1(A) + XCTR XBR,[BLT J,(D)] ;COPY USER'S PACKET INTO SYSTEM + AOS (P) ;GOING TO SUCCEED + SKIPGE (A) ;SKIP IF CONTROL PACKET + JRST CHODAT ;DATA + LDB D,[$CPKOP(A)] ;GET OPCODE + CAIGE D,%COMAX ;DISPATCH ON IT + JRST @.+1(D) + OFFSET -. + JRST IOCER3 ;OPCODE OUT OF BOUNDS +%CORFC::JRST CHORFC +%COOPN::JRST CHOOPN +%COCLS::JRST CHOCLS +%COFWD::JRST CHOFWD +%COANS::JRST CHOFWD +%COSNS::JRST IOCER3 +%COSTS::JRST IOCER3 +%CORUT::JRST IOCER3 +%COLOS::JRST IOCER3 +%COLSN::JRST CHOLSN +%COMNT::JRST IOCER3 +%COEOF::JRST CHOEOF +%COUNC::JRST CHOUNC +%COBRD::JRST IOCER9 ;UNTIL I IMPLEMENT IT +%COMAX::OFFSET 0 + +;LOSSET ROUTINE TO RETURN BUFFER A POINTS TO. +CHPKO2: MOVE A,AC0S+A(U) + PUSH P,Q ;MAY CLOBBER ONLY A AND T + PUSHJ P,CHABRT + JRST POPQJ + +;SENDING %COEOF (END-FILE MARK) +CHOEOF: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + JRST CHOOP1 ;SEND RETRANSMITTABLE CONTROL PACKET + +;SENDING REQUEST FOR CONNECTION +CHORFC: PUSHJ P,CHORF1 ;RE-INITIALIZE CONNECTION + MOVSI B,777774 ;SAVE DESTINATION HOST, CLEAR OTHER BITS + ANDB B,%CPKD(A) + MOVEM B,CHSFRN(I) + MOVEI E,%CSRFS ;PUT INTO RFC-SENT STATE + JRST CHOOP1 ;GO SEND + +;RE-INITIALIZE CONNECTION WHEN USER OUTPUTS RFC OR LSN +;FLUSHES ANY OLD PACKET BUFFERS, CHANGES UNIQUIZER IN INDEX# +CHORF1: JUMPN E,IOCR10 .SEE %CSCLS ;CONNECTION MUST BE CLOSED + PUSH P,A + PUSH P,B + PUSHJ P,CHACS1 ;FLUSH BUFFERS FROM CONNECTION + PUSHJ P,CHASO4 ;REINITIALIZE VARIABLES + JRST POPBAJ + +;"SENDING" LISTEN +CHOLSN: PUSHJ P,CHORF1 + PUSHJ P,LSWDEL ;GOING TO USE PACKET + MOVEI E,%CSLSN ;PUT INTO LISTENING STATE + HRRM E,CHSSTA(I) + MOVEI Q,CHQRFC ;NOW SEARCH PENDING-RFC QUEUE + CONO PI,NETOFF + PUSHJ P,CHAQSR + JRST [ CONO PI,NETON ;NO MATCH, PUT ONTO LISTENING QUEUE + MOVEI Q,CHQLSN + MOVE T,CHSLCL(I) + MOVEM T,%CPKS(A) + JRST CHAQPL ] + PUSHJ P,CHIRF0 ;MATCH, JOIN INTERRUPT LEVEL CODE + JRST NETONJ + +;SENDING OPEN +CHOOPN: CAIE E,%CSRFC ;CONNECTION MUST BE RFC-RECEIVED + JRST IOCR10 + MOVEI TT,4 ;SET BYTE COUNT TO 4 + DPB TT,[$CPKNB(A)] + PUSHJ P,DPBRCP ;INCLUDE RECEIPT + HLRZ B,CHSWIN(I) ;INCLUDE WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + MOVEI E,%CSOPN ;MAKE IT OPEN +;HERE TO SEND A RETRANSMITTABLE CONTROL PACKET (RFC OR OPN), NEW STATE IN E +;THIS PACKET WILL GET TAKEN OFF THE CHSOBF LIST BY RECEIPT IN THE NORMAL WAY +;THIS CODE COPIED FROM CHODAT WITH SOME MODIFICATIONS +CHOOP1: MOVE T,TIME ;UPDATE CHSITM SO WON'T THINK HOST IS DOWN + MOVEM T,CHSITM(I) + MOVEM E,CHSSTA(I) ;AND CLEAR %CFOFF (NO OTHER LH FLAGS CAN BE ON) + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] + HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + JRST CHAXM0 ;GO TRANSMIT + +;SENDING CLOSE +CHOCLS: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN +;SEND FWD OR ANS +CHOFWD: CAIN E,%CSRFC ; OR RFC-RECEIVED + TLOA E,%CFOFF ;PUT IT INTO THE CLOSED STATE + JRST IOCR10 + HLLZM E,CHSSTA(I) .SEE %CSCLS + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + JRST CHODT2 ;GO TRANSMIT + +;Here for transmitting an UNC packet. It could be part of a connection +;or it could be foreign-protocol mode. In any case transmit it without +;munging the header very much. +CHOUNC: CAIN E,%CSFRN + JRST CHOUN1 ;Okay to transmit UNC now + CAIN E,%CSOPN + JRST CHOUN2 + JUMPN E,IOCR10 .SEE %CSCLS ;Bad state + SKIPE CHSPBF(I) ;I guess out of order packets would + JRST IOCR10 ; cause some confusion in the NCP. + MOVE E,[%CFOFF,,%CSFRN] ;Put into foreign-protocol state + MOVEM E,CHSSTA(I) + MOVE D,%CPKD(A) ;Save destination + MOVEM D,CHSFRN(I) +CHOUN2: MOVE D,CHSFRN(I) ;Set up destination + MOVEM D,%CPKD(A) +CHOUN1: MOVE B,CHSLCL(I) ;Set up source + MOVEM B,%CPKS(A) + PUSHJ P,LSWDEL + SETOM -2(A) + JRST CHAXMT + +OVHMTR CHX + +;SENDING REGULAR PACKET +CHODAT: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + PUSHJ P,LSWDEL ;BUFFER WILL BE USED +CHODT1: HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] +CHODT2: HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + SKIPL (A) ;SKIP IF DATA PACKET + JRST CHAXMT + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + SOSA CHSNOS(I) ;USE UP WINDOW, SKIP +;SKIPS THROUGH INTO CHAXMT + ;SKIPS IN +SUBTTL CHAOS NET PACKET TRANSMIT ROUTINE + +;CALL WITH PACKET IN A, SMASHES B, C, D, E, T, TT, Q, J +;USES E TO SAVE THE PI STATUS, NOTHING BETTER CLOBBER THIS, OR, BOY, WILL IT EVER LOSE! +;YOU BETTER SETOM -2(A) BEFORE CALLING THIS, AND IF YOU'RE +;PUTTING IT ON A SEND LIST, DO THAT FIRST ALSO. +;THIS CODE ASSUMES THERE IS ONLY ONE INTERFACE, AND IT IS ON A +;PDP11 WHICH WILL TAKE CARE OF THE ROUTING. +;;THIS ROUTINE IS SKIPPED INTO FROM THE PREVIOUS PAGE! +CHAXMT: CONI PI,E ;SAVE PI STATUS BEFORE TURNING NETOFF; CALLED FROM MANY LEVELS +CHAXM0: ANDI E,177 + AOS CHNPO + MOVE T,TIME + MOVEM T,-1(A) ;SET TIME OF LAST TRANSMISSION + CONO PI,NETOFF ;ONE PROCESS AT A TIME, TO PROTECT INTERFACE VARIABLES +IFN FTRCHK,[ + HLRZ J,-2(A) ;I TOLD YOU TO SETOM -2(A) + CAIE J,-1 + BUG PAUSE,[CHAOS BUFFER THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK +IFN DLCP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE DL10 +IFN FTRCHK,[ + HLRZ J,DLCXMQ ;MAKE SURE NOT PUTTING ON LIST TWICE + JUMPE J,.+7 + CAMN J,A + BUG PAUSE,[CHAOS BUFFER ALREADY ON DLCXMQ],OCT,A + HLRZ J,-2(J) + CAIN J,-1 + BUG PAUSE,[DLCXMQ THREAD TRASHED] + JUMPN J,.-5 + MOVEI J,1 ;MAKE SURE NOT ACTIVE TO 11 + HRRZ T,DLCSA1(J) + CAMN T,A + BUG PAUSE,[CHAOS BUFFER ALREADY ACTIVE TO 11],OCT,A + SOJGE J,.-3 +];FTRCHK + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH (FLAGS TRANSMIT ACTIVE) + MOVE J,DLCSBF ;SEE IF SEND BUFFER IS FREE + SKIPE DLCSS1(J) + JRST CHXMD1 + PUSHJ P,DLCXMT ;YES, SEND THE PACKET NOW + JRST CHXMD2 + +CHXMD1: HRRZ B,DLCXMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,DLCXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,DLCXMQ +CHXMD2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];DLCP +IFN T11CHP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE TEN11 + PUSHJ P,T11CHK ;SEE IF TEN-11 IS READY + JRST CHXME3 ;NO + SKIPE @T11OBP ;SEE IF HAVE AVAILABLE OUTPUT BUFFER + JRST CHXME1 ;NO + PUSHJ P,T11XMT ;SEND THE PACKET NOW + JRST CHXME2 + +CHXME3: HRROS T,-2(A) ;TEN11 DOWN, DISCARD PACKET + AOJN T,CHXME2 + PUSHJ P,CHABRT + JRST CHXME2 + +CHXME1: HRRZ B,T11XMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,T11XMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,T11XMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH +CHXME2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];T11CHP +IFN CH10P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH10 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,CHXTEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORM B,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH10P +IFN CH11P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH11 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,%CATEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORB B,CHXCSR + IOWRI B,CAICSR + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH11P + +SUBTTL CHAOS NET DIRECT CONNECT TO STY + +OVHMTR CHS + +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS + +SUBTTL CHAOS NET CLOCK LEVEL STUFF + +OVHMTR CHC + +;HERE FROM 1/2 SECOND CLOCK. DO RETRANSMISSIONS AND DELAYED STS'S +CHACLK: +IFN DLCP,[ + CONO PI,NETOFF + PUSHJ P,DLCIBG ;GET MEMORY FOR INPUT BUFFERS IF NEEDED + CONO PI,NETON +];DLCP + MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHACL0: SKIPL CHSUSR(I) ;SKIP THIS ONE IF NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL + SOJGE I,CHACL0 + JUMPL I,CPOPJ ;JUMP IF ALL INDICES DONE + PUSHJ P,CHARTR ;RETRANSMIT IF NEEDED + MOVSI B,%CFSTS + TDNE B,CHSSTA(I) ;SEND STS IF NEEDED + PUSHJ P,CHASTO + SOJGE I,CHACL0 + POPJ P, + +;HERE EVERY 5 SECONDS, TO DO PROBES +CHA5CL: MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHA5C0: SKIPL CHSUSR(I) ;SKIP IF THIS ONE NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL +CHA5C1: SOJGE I,CHA5C0 + JUMPL I,CHA5C4 ;JUMP IF ALL INDICES DONE + MOVE T,TIME + SUB T,CHSITM(I) ;TIME SINCE LAST COMMUNICATION FROM OTHER END + CAILE T,90.*30. + JRST [ MOVEI W,%CSINC ;TOO LONG, CONNECTION BROKEN + PUSHJ P,CHINT + JRST CHA5C1 ] + HRRZ B,CHSSTA(I) ;ONLY PROBE IF OPEN (COULD BE RFC-SENT) + CAIE B,%CSOPN + JRST CHA5C1 + HRRZ B,CHSWIN(I) ;SEE IF NO TRANSMIT WINDOW (LOST STS DURING OPEN) + JUMPE B,CHA5C2 + HRRZ B,CHSACK(I) ;SEE IF AWAITING ACK (WINDOW NOT EMPTY) + HRRZ C,CHSPKN(I) + CAMN B,C + CAIL T,60.*30. +CHA5C2: PUSHJ P,CHABGI ;AWAITING ACK OR IDLE FOR 1 MINUTE, PROBE + JRST CHA5C1 ;NO PROBE, OR NO BUFFER AVAILABLE + MOVSI T,(.DPB %COSNS,($CPKOP),0) ;SENSE PACKET, BYTE-COUNT=0 + MOVEM T,(A) + AOS CHNSNS + PUSHJ P,CHODT2 + JRST CHA5C1 + +CHA5C4: MOVEI B,[ASCIZ/Timeout/] + MOVEI Q,CHQRFC ;TIME-OUT FIRST RFC ON LIST + PUSHJ P,CHAQGF + JUMPE A,CHA5C5 + MOVE T,-1(A) + ADDI T,60.*30. ;TIME-OUT IS ONE MINUTE + PUSHJ P,[ CAMG T,TIME + JRST CHIRF2 + JRST CHAQPF ] +CHA5C5: +IFN CH10P,[ + MOVEI T,CHXREN+CHXTEN ;WAKE UP IN CASE OF TIMING ERROR + IORM T,CHXCNO ;IN DEALING WITH CHXCNO + CONO CHX,@CHXCNO + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH10P +IFN CH11P,[ + MOVEI T,%CAREN+%CATEN ;WAKE UP IN CASE OF TIMING ERROR + IORB T,CHXCSR ;IN DEALING WITH CHXCSR + IOWRI T,CAICSR + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH11P + MOVEI T,5*60. + MOVEI C,CHA5CK + JRST CLQREE + +OVHMTR CHR + +;RETRANSMIT FOR INDEX IN I +CHARTR: CONI PI,W ;SAVE PI CHANNELS ACTIVE + ANDI W,177 ;CHAXMT BETTER NOT CLOBBER W! + CONO PI,NETOFF ;PI BETTER BE OFF THROUGHOUT THIS ZONE + ; SO WE DON'T GET INTO CHIACK + HLRZ A,CHSOBF(I) ;SCAN DOWN OUTPUT BUFFER LIST + JUMPE A,CHART2 ;EMPTY +CHART1: MOVE T,-1(A) ;DON'T RETRANSMIT IF DONE TOO RECENTLY + HLRZ TT,-2(A) ;OR IF ALREADY ON ITS WAY OUT (DON'T LINK TWICE ON XMIT LIST) + CAME T,TIME + CAIE TT,-1 + JRST CHART2 ;ANYTHING AFTER THIS IS LIKELY TO LOSE ALSO + AOS CHNRTR + PUSHJ P,CHAXMT ;RETRANSMIT THIS +; HRRZ A,-2(A) ;THREAD TO NEXT +; JUMPN A,CHART1 +CHART2: CONO PI,PICON(W) + POPJ P, + +;THIS ROUTINE SENDS A STS PACKET, OR TRIES TO. FAILURE => SLOW CLOCK WILL TRY AGAIN. +;CANNOT PCLSR NOR WAIT, CALLABLE FROM INTERRUPT LEVEL. +;INDEX IN I, CLOBBERS A,B,C,D,E,T,TT,Q,J +CHASTO: MOVSI D,%CFSTS + IORM D,CHSSTA(I) + PUSHJ P,CHABGI ;GET A BUFFER, WITHOUT WAITING + POPJ P, ;CAN'T GET ONE, WILL RETRY AT CLOCK LEVEL + ANDCAM D,CHSSTA(I) ;OK, A STS WILL BE SENT, CLEAR NEED-STS FLAG + MOVE T,[.DPB %COSTS,($CPKOP),<.DPB 4,($CPKNB),0>] + MOVEM T,(A) ;SEND A STS WITH 4 DATA BYTES + PUSHJ P,DPBRCP ;FIRST PAIR IS RECEIPT + HLRZ B,CHSWIN(I) ;SECOND PAIR IS WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + AOS CHNSTS + JRST CHODT2 ;FIRE IT OFF + +DPBRCP: HLRZ B,CHSPKN(I) + SKIPE T,CHSIBF(I) + LDB B,[$CPKPN(T)] + DPB B,[242000,,%CPKDT(A)] + POPJ P, + +SUBTTL CHAOS NET INTERRUPT-LEVEL INPUT PROCESSING + +OVHMTR CHI + +;PROCESS A PACKET RECEIVED AT INTERRUPT LEVEL. BY THE TIME WE GET HERE +; A BUFFER HAS BEEN ALLOCATED AND FILLED WITH THE DATA FROM THE DEVICE. +; ITS ADDRESS IS IN A. RETURN VIA POPJ P, WITH ALL REGISTERS CLOBBERED. +CHAPII: MOVE B,RECHDP ;SAVE HEADER FOR DEBUGGING IN RING BUFFER + MOVEI D,%CPKDT(B) + HRL B,A + BLT B,-1(D) + CAIN D,RECHDR+ + MOVEI D,RECHDR + MOVEM D,RECHDP + ;END OF DEBUGGING CODE + LDB D,[$CPKMV(A)] ;MUPPET? + JUMPN D,CHABRT ;FLUSH, NOT SUPPORTED + LDB D,[$CPKOP(A)] ;GET OPCODE + LDB B,[$CPKDA(A)] ;CHECK DESTINATION + CAIE B,MYCHAD ;IF FOR ME, + SKIPN B ;OR FOR ME BY VIRTUE OF BROADCAST + AOSA CHNPI ;ACCEPT IT + JRST CHAPFW ;NOT ME, FORWARD + LDB C,[$CPKNB(A)] ;PASS LENGTH IN C TO OP ROUTINES + MOVEI B,[ASCIZ/Illegal byte count/] + CAILE C,%CPMXC + JRST CHALOS + SKIPGE (A) ;TEST OPCODE + JRST CHIDAT ;DATA PACKET + MOVEI B,[ASCIZ/Illegal opcode/] + CAIGE D,%COMAX + JRST @.+1(D) + OFFSET -. + JRST CHALOS ;ILLEGAL, FLUSH +%CORFC::JRST CHIRFC +%COOPN::JRST CHIOPN +%COCLS::JRST CHICLS +%COFWD::JRST CHIANS +%COANS::JRST CHIANS +%COSNS::JRST CHISNS +%COSTS::JRST CHISTS +%CORUT:: +IFE CH10P+CH11P,JRST CHABRT ;IGNORE +IFN CH10P+CH11P,JRST CHIRUT +%COLOS::JRST CHILOS +%COLSN::JRST CHALOS ;ILLEGAL, FLUSH +%COMNT::JRST CHABRT ;IGNORE +%COEOF::JRST CHIDAT +%COUNC::JRST CHIUNC +%COBRD::JRST CHIBRD +%COMAX::OFFSET 0 + +;FORWARDING +CHAPFW: LDB B,[$CPKDA(A)] ;CHECK DESTINATION HOST + TRNN B,377_8 ;SUBNET 0? + JRST CHABRT ;FLUSH IT, XX-NETWORK-11 IS TRYING TO MAKE US CRASH + LDB B,[$CPKFC(A)] ;INCREMENT FORWARDING COUNT + ADDI B,1 + CAIL B,20 + JRST [ AOS CHNPFL ? JRST CHABRT ] ;LOOP, DISCARD + DPB B,[$CPKFC(A)] + SETOM -2(A) ;NOT ON SEND LIST + AOS CHNPF + JRST CHAXMT + +IFN CH10P+CH11P,[ ;INCOMING ROUTING INFO +CHIRUT: LSH C,-2 ;NUMBER OF SUBNET ENTRIES + JUMPE C,CHABRT ;COULD BE ZERO-LENGTH + MOVEI D,%CPKDT(A) + HRLI D,442000 + LDB E,[$CPKSA(A)] ;SOURCE HOST IS GATEWAY +CHIRU1: ILDB T,D ;SUBNET + ILDB TT,D ;COST + HLRZ B,SBNRUT(T) ;COST OF EXISTING ROUTE + CAIGE T,NSUBNT + CAMLE TT,B + JRST CHIRU2 + HRLM TT,SBNRUT(T) ;THIS IS BEST ROUTE NOW + HRRM E,SBNRUT(T) +CHIRU2: SOJG C,CHIRU1 + JRST CHABRT +];CH10P+CH11P + +;INTERRUPT-LEVEL PROCESSING OF SNS PACKET +;NOTE THAT WE DO NOT BARF AT SNS'S TO EXISTENT NON-OPEN CONNECTIONS. IF IT +;WAS AN RFC-SENT CONNECTION, THIS COULD BREAK IT PREMATURELY IF AN OPN WAS +;LOST AND THEN A SNS WAS NOT. +CHISNS: MOVEI E,%CSOPN + PUSHJ P,CHFNDX + JRST [ CAIE E,%CSOPN + JRST CHABRT ;CONNECTION EXISTS AND IS NOT OPEN, IGNORE PACKET + JRST CHALOS ] ;CONNECTION DOES NOT EXIST, COMPLAIN + PUSHJ P,CHABRT ;CONNECTION DOES EXIST + CAIE E,%CSOPN + POPJ P, ;NOT OPEN, IGNORE + JRST CHASTO ;REPLY WITH STS + +;INTERRUPT LEVEL PROCESSING OF RECEIVED FWD OR ANS +CHIANS: PUSHJ P,CHFNDX ;FIND CONNECTION + JRST CHABRT ;NOBODY AT OTHER END TO RECEIVE A LOS ANYWAY + CAIE E,%CSRFS + JRST CHABRT ;NOT IN RFC-SENT STATE, LOSS +; JRST CHICL1 ;CLOSE THE CONNECTION BUT GIVE TO USER AS INPUT + ;DROPPING THROUGH WILL DO + +;INTERRUPT LEVEL PROCESSING OF RECEIVED CLS PACKET +CHICLS: PUSHJ P,CHFNDX ;FIND CONNECTION BEING CLOSED + JRST CHALOS ;NONE, LOSS +CHICL1: MOVEI W,%CSCLS ;CLOSE THE CONNECTION +CHICL2: PUSHJ P,CHINT ;SET TO STATE IN W, INTERRUPT + PUSH P,A + MOVEI Q,CHSPBF(I) ;DISCARD OUT-OF-ORDER PACKETS + PUSHJ P,CHALFR + HRRZS CHSNBF(I) +CHIC2A: MOVEI Q,CHSOBF(I) ;DISCARD TRANSMIT PACKETS, E.G. RFC WHICH RECEIVED + PUSHJ P,CHAQGF ;AN ANS OR FWD, DON'T WANT TO TRANSMIT AGAIN + JUMPE A,CHIC2B + PUSHJ P,CHABR1 + JRST CHIC2A + +CHIC2B: POP P,A + JRST CHIDT1 ;GIVE PACKET TO USER AS DATA + ;INTERRUPT LEVEL PROCESSING OF RFC PACKET +CHIRFC: MOVE T,%CPKDT(A) ;CHECK FOR STATUS REQUEST + CAMN T,[.BYTE 8 ? "S ? "T ? "A ? "T] + CAIE C,6 + JRST CHIRF7 + MOVS TT,%CPKDT+1(A) + XORI TT,(<.BYTE 8 ? "U ? "S>) + TRNN TT,(<.BYTE 8 ? -1 ? -1>) + JRST CHIRF3 +CHIRF7: MOVEI Q,CHQLSN ;SEARCH LISTENING QUEUE + PUSHJ P,CHAQSR + JRST CHIRF1 ;NOT FOUND, LOAD SERVER + EXCH A,B ;A LSN, B RFC + LDB I,[$CPKSX(A)] ;GET CORRESPONDING INDEX + HRRZ E,CHSSTA(I) + CAIE E,%CSLSN + JRST 4,. +CHIRF0: PUSHJ P,CHABRT ;FOUND, DISCARD LISTEN PACKET + MOVE A,B ;GET OTHER HOST'S RFC + LDB B,[$CPKPN(A)] ;INITIALIZE RECEIVER'S PACKET NUMBER + HRLM B,CHSPKN(I) + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + MOVEI W,%CSRFC ;PUT INTO RFC-RECEIVED STATE + MOVE T,TIME ;AND ENGAGE PI LEVEL + MOVEM T,CHSITM(I) + JRST CHICL2 + +;RFC RECEIVED AND NOT IMMEDIATELY MATCHED TO A LSN. QUEUE AND LOAD SERVER JOB. +;BUT FIRST CHECK WHETHER THIS IS A DUPLICATE WHICH SHOULD BE DISCARDED. +CHIRF1: MOVE C,%CPKS(A) ;SEARCH PENDING RFC QUEUE FOR RFC FROM + HLRZ T,CHQRFC ;THE SAME SOURCE AS THIS. + JUMPE T,CHIRD1 +CHIRD0: CAMN C,%CPKS(T) + JRST CHABRT ;THIS RFC IS A DUPLICATE, IGNORE IT + HRRZ T,-2(T) + JUMPN T,CHIRD0 +CHIRD1: MOVSI T,-NINDX ;SEARCH OPEN AND RFC-RECEIVED CONNECTIONS +CHIRD2: SKIPL CHSUSR(T) ;FOR ONE CONNECTED TO SAME GUY AS SENT RFC + CAME C,CHSFRN(T) + AOBJN T,CHIRD2 + JUMPGE T,CHIRD3 ;NO DUPLICATE OF THIS RFC, QUEUE IT + HRRZ TT,CHSSTA(T) + CAIE TT,%CSOPN + CAIN TT,%CSRFC + JRST CHABRT ;REALLY A DUPLICATE, DISCARD + AOBJN T,CHIRD2 +CHIRD3: MOVEI B,[ASCIZ/System not up/] + SKIPL SYSDBG ;REFUSE INCOMING CONNECTIONS IF LOGINS REFUSED + SKIPE NETUSW ;ALLOWING INCOMING NET CONNECTIONS? + JRST CHIRF2 ;NO, REFUSE (EVEN IF FROM OURSELVES) + HRROI T,CHIRFJ ;LOAD JOB + CONI PI,Q ;MUST TURN UTCOFF TO CALL NUJBST + ANDI Q,177 ;SINCE THIS MAY RUN AT OTHER INT LEVELS + CONO PI,NETOFF + PUSHJ P,NUJBST + JRST [ CONO PI,PICON(Q) + JRST CHABRT ] ;RING BUFFER FULL, IGNORE, RETRY WILL CATCH + CONO PI,PICON(Q) + MOVE T,TIME ;REMEMBER WHEN THIS RFC WAS QUEUED + MOVEM T,-1(A) + MOVEI Q,CHQRFC + JRST CHAQPF ;PUT ON FRONT OF QUEUE + +;COME HERE TO SEND A LOS PACKET IN RESPONSE TO CRUFTY INPUT IN A +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHALOS: SKIPA T,[%COLOS] +;HERE TO REFUSE AN RFC. TURN IT INTO A CLS AND SEND IT BACK. +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHIRF2: MOVEI T,%COCLS + HRLI B,440700 ;BP TO MESSAGE + SETZB C,(A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVE D,[440800,,%CPKDT(A)] +CHIRF4: ILDB T,B + JUMPE T,CHIRF5 + IDPB T,D + AOJA C,CHIRF4 + +CHIRF5: DPB C,[$CPKNB(A)] + SETOM -2(A) ;NOT ON ANY SEND LIST + JRST CHAXMT ;SEND IT + +;HERE FOR RFC TO "STATUS" +EXPUNGE FOO,BAR +DEFINE FOO NAME +BAR==0 +.BYTE 8 +IRPC CH,,NAME +"CH +BAR==BAR+1 +TERMIN +IFG BAR-4, .ERR NAME MORE THAN 4 CHARACTERS +REPEAT 4-BAR, 0 +.BYTE +TERMIN + +CHIRF3: MOVE B,[MNAME FOO ,,] ;NAME OF MACHINE IN 8-BIT ASCII +EXPUNGE FOO,BAR + MOVEM B,%CPKDT(A) + SETZM %CPKDT+1(A) + MOVSI B,%CPKDT+1(A) + HRRI B,%CPKDT+2(A) + BLT B,%CPKDT+7(A) + MOVE B,[.BYTE 8 ? MYCHAD/400 ? 1 ? 4+IFN CH10P+CH11P,[10.] ? 0 ] + MOVEM B,%CPKDT+10(A) + MOVEI B,%CPKDT+11(A) + HRLI B,441000 + MOVE T,CHNPI + PUSHJ P,CHRF3A + MOVE T,CHNPO + PUSHJ P,CHRF3A +IFN CH10P+CH11P,[ + MOVE T,CHNABT + PUSHJ P,CHRF3A + MOVE T,CHNLOS + PUSHJ P,CHRF3A + MOVE T,CHNCRC + PUSHJ P,CHRF3A + MOVE T,CHNCR2 + PUSHJ P,CHRF3A + MOVE T,CHNPLE + ADD T,CHNWLE + PUSHJ P,CHRF3A +];CH10P+CH11P + MOVEI T,%COANS + SETZM (A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVEI C,13*4+IFN CH10P+CH11P,[20.] ;BYTE COUNT + JRST CHIRF5 ;SEND + +CHRF3A: MOVEI TT,4 + IDPB T,B + LSH T,-8 + SOJG TT,.-2 + POPJ P, + +;HERE TO CONVERT A BRD INTO AN RFC + +CHIBRD: LDB T,[$CPKAN(A)] ;NUMBER OF BITMAP BYTES + LDB TT,[$CPKNB(A)] ;NUMBER OF TOTAL DATA BYES (INCLUDES BITMAP) + CAIG T,32. ;ACK NUMBER NO GREATER THAN 32. + TRNE T,3 ; MUST BE MULTIPLE OF 4 + JRST CHABRT ; FREE THE PACKET IF NO GOOD + CAMG TT,T ;MUST BE SOME TEXTUAL RFC DATA AS WELL + JRST CHABRT ; IF NOT, FREE PACKET + MOVE C,TT ;GET NUMBER OF BYTES (CHIRFC WANTS COUNT IN C) + SUB C,T ;WITHOUT BITMAP + DPB C,[$CPKNB(A)] ;NEW BYTE COUNT + LSH T,-2 ;CONVERT BITMAP BYTE COUNT TO WORD COUNT + ADDI TT,3 ;CONVERT BYTE COUNT TO... + LSH TT,-2 ;... WORD COUNT + MOVEI D,%CPKDT(A) ;GET POINTER TO BEGINNING OF DATA + HRL D,D ;IN UPPER AND LOWER HALVES (ALMOST BLT POINTER) + HRLZ T,T ;BITMAP WORD COUNT,,0 + ADD D,T ;RFC-STRING,,DATA-FIELD + ADDI TT,%CPKDT-1(A) ;LAST LOCATION FOR BLT + BLT D,(TT) + SETZI TT, + DPB TT,[$CPKAN(A)] ;ZERO THE ACK FIELD + MOVE TT,MYCHAD + DPB TT,[$CPKDA(A)] ;PRETEND IT WAS FOR ME + JRST CHIRFC ;AND HANDLE IT AS AN RFC + + +;ROUTINE TO FIND INDEX PACKET CORRESPONDS TO, SKIP IF FOUND, INDEX IN I. +;ALSO RETURNS STATE IN E SINCE THAT'S OFTEN HANDY. +;ALSO SETS B FOR CHALOS +CHFNDX: MOVEI B,[ASCIZ/Connection does not exist at this end/] + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + POPJ P, ;NO MATCH + SKIPGE CHSSTA(I) .SEE %CFOFF + POPJ P, ;NOT TALKING TO NETWORK + HRRZ E,CHSSTA(I) + MOVE TT,%CPKD(A) + MOVE T,%CPKS(A) + CAIN E,%CSRFS ;IF IN RFC-SENT STATE, ONLY + AND T,[.BYTE 16. ? -1 ? 0] ;THE SOURCE HOST HAS TO MATCH + CAMN TT,CHSLCL(I) ;COMPARE LOCAL ADDRESS + CAME T,CHSFRN(I) ; AND FOREIGN ADDRESS + POPJ P, ;NO MATCH + MOVE T,TIME + MOVEM T,CHSITM(I) + JRST POPJ1 ;SUCCEED, CALLER CHECKS THE STATE + +;INTERRUPT LEVEL PROCESSING OF RECEIVED OPN PACKET +CHIOPN: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE OPENED + JRST CHALOS + CAIE E,%CSRFS ;NOT IN RFC-SENT STATE, + JRST CHABRT ; MUST BE DUPLICATE, DISCARD. + LDB B,[$CPKPN(A)] ;GET ITS PACKET NUMBER + HRLM B,CHSPKN(I) ;INITIALIZE PACKET NUMBERING OF RECEIVED MESSAGES + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + PUSHJ P,CHIST1 ;PROCESS AS A STS, DISCARD + PUSHJ P,CHASTO ;RESPOND WITH A STS + MOVEI W,%CSOPN + ;DROP INTO CHINT + +;COME HERE WITH INDEX IN I AND NEW STATE IN W, TO CHANGE STATE AND INTERRUPT +CHINT: HRRM W,CHSSTA(I) + MOVE T,TIME + MOVEM T,CHSITM(I) ;IN CASE GOT HERE FROM CHOLSN + MOVSI T,%CFOFF + CAIE W,%CSOPN + IORM T,CHSSTA(I) ;DISENGAGE PI LEVEL + CAIN W,%CSOPN + ANDCAM T,CHSSTA(I) ;NOW OPEN, ENGAGE PI LEVEL +;COME HERE TO INTERRUPT ON THE INPUT CHANNEL. SMASHES T,TT,W +CHINTI: LDB T,[$CHSUI,,CHSUSR(I)] +CHINT2: MOVE TT,CHSSTA(I) ;SIGNAL USER OR STY? + TLNN TT,%CFSTY + JRST CHINT4 ;USER + LDB T,[$CFTTN,,TT] ;STY, GET TTY NUMBER + CONO PI,PIOFF ;PROTECT LIST MODIFICATION + SKIPL STYNTL-NFSTTY(T) ;DON'T PUT ON LIST TWICE + JRST PIONJ + MOVE TT,STYNTA ;ADD TO LIST + MOVEM TT,STYNTL-NFSTTY(T) + MOVEM T,STYNTA + JRST PIONJ + +CHINT4: SKIPGE TT,CHSUSR(I) + JRST 4,. + MOVSI W,(SETZ) ;PCLSR THE JOB SO IT GETS AN IOC ERROR IF NEEDFUL + IORM W,PIRQC(TT) ;EVEN IF NORMAL INTERRUPTS ARE NOT ENABLED + CAIN T,77 + POPJ P, ;IOPUSH'D, NO INTERRUPT + MOVE T,CHNBIT(T) + AND T,MSKST2(TT) + IORM T,IFPIR(TT) + POPJ P, + +OVHMTR CHD + +;INTERRUPT LEVEL PROCESSING OF RECEIVED DATA PACKET +CHIDAT: PUSHJ P,CHFNDX ;FIND ASSOCIATED CONNECTION + JRST CHALOS ;NONE, LOSS + CAIE E,%CSOPN ;STATE MUST BE OPEN + JRST CHALOS ;BAD, LOSS + PUSHJ P,CHIACK ;PROCESS ACKNOWLEDGEMENT FIELD +;NOW DECIDE WHETHER IT GOES ON CHSIBF(I), OR ON CHSPBF(I), OR GETS DISCARDED. + HLRZ B,CHSPKN(I) ;LAST PACKET NUMBER GIVEN TO USER + LDB C,[$CPKPN(A)] ;GET PACKET NUMBER OF THE NEW PACKET + HLRZ T,CHSWIN(I) ;RECEIVE WINDOW SIZE + ADDI T,(B) ;HIGHEST LEGAL PACKET NUMBER + SUB T,C + TRNE T,100000 ;SKIP IF T >= C + JRST CHABRT ;FOO ON YOU, OVER WINDOW SIZE + HRRZ T,CHSIBF(I) ;COMPUTE NEXT IN-ORDER PACKET EXPECTED + JUMPE T,CHIDT6 ;BASED ON LAST IN-ORDER PACKET + LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + JRST [ LDB B,[$CPKPN(T)] + JRST CHIDT6 ] + HLRZ T,CHSIBF(I) ;IF IT'S AN UNC, HAVE TO GO FIND CORRECT PACKET +CHIDT5: LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + LDB B,[$CPKPN(T)] + HRRZ T,-2(T) + JUMPN T,CHIDT5 +CHIDT6: ADDI B,1 + ANDI B,177777 ;NEXT IN-ORDER PACKET EXPECTED + CAMN B,C + JRST CHIDT1 ;EQUAL, IT GOES ON THE END OF CHSIBF(I) LIST. + SUB B,C ;NOT EQUAL, COMPARE THEM MODULO 2^16. + TRNN B,100000 + JRST CHIDTD ;B GREATER, THIS IS AN OLD PACKET, DISCARD IT + ;PUT ON CHSPBF(I) IN PROPER ORDER + ;A IS THIS PACKET, C IS HIS NUMBER, B IS PREDECESSOR, D IS NEXT, E IS HIS # + MOVEI B,0 ;SIGNIFY AT FRONT OF LIST + HLRZ D,CHSPBF(I) ;GET FIRST PACKET ON OUT-OF-ORDER LIST + JUMPE D,CHIDT4 ;LIST IS EMPTY +CHIDT3: LDB E,[$CPKPN(D)] + SUB E,C ;COMPARE PACKET NUMBERS + JUMPE E,CHIDTD ;DUPLICATE, DISCARD + TRNE E,100000 + JRST [ MOVE B,D ;E IS LESS, KEEP LOOPING + HRRZ D,-2(B) + JUMPN D,CHIDT3 + JRST .+1 ] ;REACHED END PUT IT HERE + SKIPE B + HRRM A,-2(B) ;THREAD ONTO PREVIOUS PACKET + SKIPN D +CHIDT4: HRRM A,CHSPBF(I) ;THREAD ONTO BACK OF LIST + SKIPN B + HRLM A,CHSPBF(I) ;THREAD ONTO FRONT OF LIST + HRRM D,-2(A) ;THREAD IN BEFORE PACKET IN D + MOVSI B,1 + ADDM B,CHSNBF(I) + POPJ P, + +;HERE IT GOES ON CHSIBF(I). A HAS PACKET, C HAS ITS PACKET NUMBER. +;IF GETTING HERE FROM CHICL1, C HAS GARBAGE BUT IT WILL NEVER BE USED. +CHIDT1: SKIPN CHSIBF(I) + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQPL ;PUT ON END OF RECEIVE LIST + HLRZ A,CHSPBF(I) ;GET FIRST OUT-OF-ORDER PACKET + JUMPE A,CPOPJ ;NONE + LDB B,[$CPKPN(A)] ;SEE IF THIS PACKET IS NOW IN-ORDER + CAIL C,177777 ;BY COMPARING AGAINST C+1 MODULO 2^16. + TDZA C,C + ADDI C,1 + CAME B,C + POPJ P, ;NO + MOVEI Q,CHSPBF(I) + PUSHJ P,CHAQGF ;YES, PULL PACKET OF OUT-OF-ORDER LIST + MOVSI B,-1 + ADDM B,CHSNBF(I) + JRST CHIDT1 ;AND GO PUT ONTO IN-ORDER LIST + +;HERE IF PACKET IS A DUPLICATE AND IS TO BE DISCARDED. MUST SEND +;RECEIPT TO SHUT OFF EXCESS RETRANSMISSION. +CHIDTD: PUSHJ P,CHABRT + AOS CHNPD + JRST CHASTO + +;HERE FOR RECEIVING AN UNC PACKET +CHIUNC: LDB I,[$CPKDI(A)] ;Destination index zero? + JUMPE I,CHIUN2 + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + JRST CHALOS ;NO MATCH + MOVE TT,%CPKD(A) ;DESTINATION ADDRESS MATCHES? + CAME TT,CHSLCL(I) + JRST CHALOS + HRRZ E,CHSSTA(I) ;IN FOREIGN PROTOCOL MODE? + CAIN E,%CSFRN + JRST CHIUN1 + MOVE TT,%CPKS(A) ;NORMAL PROTOCOL, SOURCE ADDRESS MUST MATCH + CAMN TT,CHSFRN(I) + CAIE E,%CSOPN ;AND STATE MUST BE OPEN + JRST CHALOS +CHIUN1: MOVE TT,TIME + MOVEM TT,CHSITM(I) + SKIPE T,CHSIBF(I) ;DISCARD PACKET IF OVER WINDOW SIZE + JRST [ LDB TT,[$CPKOP(T)] ; AND ALREADY HAVE AN UNC + HRRZ T,CHSNBF(I) + HLRZ Q,CHSWIN(I) + CAML T,Q + CAIE TT,%COUNC + JRST .+2 + JRST CHABRT ] + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) ;PUT ON END OF RECEIVE LIST. + MOVEI Q,CHSIBF(I) ;PACKET NUMBER IS RANDOM, NOTHING LOOKS AT IT + JRST CHAQPL + +CHIUN2: +IFE INETP,JRST CHALOS ;No comprendo internet +IFN INETP,[ + LDB I,[$CPKAN(A)] ;Protocol number + CAIE I,8_8 ;DOD Internet #x0800 + JRST CHALOS + AOS CHNIPI ;Meter Internet packets in from Chaosnet + MOVE J,A ;Save Chaosnet packet + LDB A,[$CPKNB(A)] ;Compute size of Internet datagram in words + ADDI A,3 + LSH A,-2 + MOVE C,A ;Save word count + CALL IPGIPT ;Get buffer to copy datagram into + JRST CHIUN3 ;No buffers available, discard packet + MOVSI T,%CPKDT(J) ;Make BLT pointer + HRRI T,1(B) + ADDI B,(C) ;Address of last destination word + BLT T,(B) + EXCH A,J ;Free the Chaosnet packet + CALL CHABRT + MOVE A,J ;Datagram structure + MOVE B,C ;Word count + MOVEI C,0 ;Offset to start of IP header + CALRET IPRDGM ;Dispose of datagram + +CHIUN3: MOVE A,J ;Discard Chaosnet packet + CALRET CHABRT +];INETP + +OVHMTR CHJ + +;INTERRUPT LEVEL PROCESSING OF LOS +CHILOS: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE BROKEN + JRST CHABRT ;NONE, IGNORE + MOVEI W,%CSLOS ;PUT INTO LOST STATE + JRST CHICL2 ;GIVE PACKET TO USER AS DATA, DISENGAGE, AND INTERRUPT + +;INTERRUPT LEVEL PROCESSING OF STS +CHISTS: PUSHJ P,CHFNDX + JRST CHALOS + CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST CHALOS +CHIST1: LDB B,[042000,,%CPKDT(A)] ;GET NEW WINDOW SIZE + CAILE B,MXWIND + MOVEI B,MXWIND + HRRM B,CHSWIN(I) + LDB B,[242000,,%CPKDT(A)] ;PROCESS RECEIPT + PUSHJ P,CHIAK0 + PUSHJ P,CHABRT + JRST CHARTR ;RETRANSMIT + +OVHMTR CHA + +;INTERRUPT LEVEL PROCESSING OF RECEIVED ACKNOWLEDGEMENT. +;REMOVE THE ACKNOWLEDGED PACKETS FROM THE INDEX'S SEND LIST AND UPDATE CHSNOS(I). +;NOTE THAT THE LIST IS ASSUMED TO BE SORTED SO WE ONLY +;REMOVE PACKETS FROM THE FRONT. CLOBBERS B,C,D,T,TT,Q. +CHIACK: LDB B,[$CPKAN(A)] ;PACKET NUMBER BEING RECEIPTED +CHIAK0: LDB T,[$CPKAN(A)] ;ENTER HERE FROM CHISTS + HRRZ D,CHSACK(I) ;GET MAX OF THIS ACKNOWLEDGE AND PREVIOUS + SUB D,T + TRNE D,100000 + HRRM T,CHSACK(I) ;ACKNOWLEDGED PACKET NUMBER IS NEW START OF WINDOW + PUSH P,A + HLRZ A,CHSOBF(I) ;MAP DOWN SEND LIST + JUMPE A,CHIAK2 ;LIST EMPTY +CHIAK1: LDB D,[$CPKPN(A)] + SUBM B,D + TRNE D,100000 + JRST CHIAK2 ;RCP# LESS THAN PKT# + HRRZ C,-2(A) ;GET NEXT PACKET + HLLOS D,-2(A) ;MARK NOT ON SEND LIST + AOJE D,CHIAK3 ;AND JUMP IF NOT ON TRANSMIT LIST +IFN DLCP,[ + MOVEI Q,DLCXMQ ;ON TRANSMIT LIST, TRY TO TAKE OFF + PUSHJ P,CHIAKF +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ + PUSHJ P,CHIAKF +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ + PUSHJ P,CHIAKF +];CH10P+CH11P + CAIA ;AND DON'T FREE IT +CHIAK3: PUSHJ P,CHABRT + HRLM C,CHSOBF(I) + SKIPE A,C + JRST CHIAK1 + SETZM CHSOBF(I) ;SEND LIST NOW EMPTY +CHIAK2: MOVE D,CHSNOS(I) ;COMPUTE NEW VALUE OF CHSNOS + HRRZ T,CHSACK(I) ;START OF WINDOW + HRRZ C,CHSPKN(I) ;LAST PACKET SENT + SUB T,C + SKIPLE T + SUBI T,200000 ;T GETS NEGATIVE AMOUNT OF WINDOW OCCUPIED + ADD T,CHSWIN(I) ;RH(T) GETS AVAILABLE PORTION OF WINDOW + HRREM T,CHSNOS(I) ;WHICH IS NUMBER OF OUTPUT SLOTS + JUMPG D,POPAJ ;IF FORMERLY THERE WERE NO OUTPUT SLOTS, + LDB T,[$CHSUO,,CHSUSR(I)] + SKIPLE CHSNOS(I) ;AND NOW THERE ARE, + PUSHJ P,CHINT2 ;INTERRUPT ON THE OUTPUT CHANNEL + JRST POPAJ + +;TRY TO TAKE PACKET IN A OFF OF TRANSMIT LIST IN Q. +;CLOBBER T,Q,D. CALLED WITH INTERRUPTS OFF. +;MAY RETURN WITH A POINTING TO FREE BUT THAT IS OK AT THIS TIME. +CHIKF1: SKIPA D,T +CHIAKF: MOVEI D,2(Q) ;LH[-2(D)] POINTS TO (T) + HLRZ T,-2(D) + JUMPE T,CPOPJ ;NOT FOUND + CAIE T,(A) + JRST CHIKF1 + HLRZ T,-2(A) ;LINK OUT + HRLM T,-2(D) + JUMPN T,CHABRT ;JUMP IF DIDN'T DELETE LAST PACKET IN LIST + HRRM D,(Q) ;NEW LAST PACKET IN LIST + CAIN D,2(Q) + SETZM (Q) ;FOO, TRANSMIT LIST NOW EMPTY + JRST CHABRT + +SUBTTL CHAOS NET DL10 INTERRUPT ROUTINE + +OVHMTR CHH + +IFN DLCP,[ + +;COME HERE FROM EACH DL10 INTERRUPT AT TTY LEVEL. SMASH ALL REGISTERS EXCEPT P AND 0. +DLCWAK: CONI PI,E ;SAVE PI STATUS AND SWITCH TO NETWORK INTERRUPT LEVEL + ANDI E,177 + PUSH P,E + CONO PI,NETOFF +DLCWK1: MOVEI J,1 ;ALWAYS CHECK BOTH BUFFERS SO WE CAN'T GET OUT OF PHASE WITH 11 + MOVEI R,2 ;CHECK FOR INPUT AVAILABLE + CAME R,DLCRS1(J) + SOJGE J,.-1 + JUMPL J,DLCWK2 + MOVE A,DLCRA1(J) ;GOT INPUT, PROCESS IT + SETZM DLCRS1(J) ;BUFFER SLOT NOT OCCUPIED NOW +IFN KS10P, CLRCSH +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE IN CASE ANYONE HAPPENED TO TOUCH BUFFER + SKIPE A ;THIS CAN HAPPEN IF PDP11 WAS JUST STUFFED + PUSHJ P,CHAPII ;PROCESS THE PACKET + PUSHJ P,DLCIBG ;SUPPLY A NEW INPUT BUFFER TO 11 + JRST DLCWK1 ;TRY FOR MORE INPUT + +DLCWK2: MOVEI J,1 ;SCAN CHANNELS FOR OUTPUT DONE + CAME R,DLCSS1(J) +DLCWK3: SOJGE J,.-1 + JUMPL J,DLCWK4 + MOVE A,DLCSA1(J) ;FOUND AN OUTPUT DONE BUFFER + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE + SETZM DLCSA1(J) ;IDLE THIS BUFFER + SETZM DLCSS1(J) + JRST DLCWK3 + +DLCWK4: MOVE J,DLCSBF ;TRY TO SEND SOME OUTPUT + SKIPE DLCSS1(J) + JRST DLCWK9 ;BUFFER BUSY + HLRZ A,DLCXMQ ;GET ANOTHER OFF TRANSMIT QUEUE + JUMPE A,DLCWK9 ;QUEUE EMPTY + HLRZ T,-2(A) +IFN FTRCHK,[ + CAIN T,-1 + BUG PAUSE,[CHAOS LIST THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK + HRLM T,DLCXMQ +IFN FTRCHK,[ + JUMPN T,.+4 + CAME A,DLCXMQ ;REACHED END OF LIST, END IN RIGHT PLACE? + BUG PAUSE,[DCLXMQ THREAD TRASHED] + SETZM DLCXMQ +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM DLCXMQ +];FTRCHK + PUSHJ P,DLCXMT ;SEND IT ON THIS BUFFER + JRST DLCWK4 ;GO TRY TO SEND ON OTHER BUFFER + +DLCWK9: POP P,E + CONO PI,PICON(E) ;RESTORE PI + POPJ P, + +;THIS ROUTINE SUPPLIES AN INPUT BUFFER TO THE 11 ON ALL BUFFERS THAT NEED IT +;CALL WITH INTERRUPTS OFF OR IN PROGRESS +DLCIBG: MOVEI J,1 + SKIPE DLCRS1(J) +DLCIB1: SOJGE J,.-1 + JUMPL J,CPOPJ + PUSHJ P,CHABGI ;GET A BUFFER + JRST [ SETZM DLCRA1(J) ;NO MEMORY, WILL TRY AGAIN AT CLOCK LEVEL + SETZM DLCRS1(J) + POPJ P, ] + SETZM (A) ;CLEAR THE BUFFER SINCE THE DL10 DOESN'T TOUCH LOW 4 BITS + HRLZ T,A + HRRI T,1(A) + BLT T,%CPMXW-1(A) + MOVEM A,DLCRA1(J) ;MAKE AVAILABLE TO PDP11 + HRLI A,120000 + MOVEM A,DLCRP1(J) + SOS DLCRP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE BEFORE SIGNALLING 11 + MOVEI T,1 + MOVEM T,DLCRS1(J) + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + JRST DLCIB1 ;TRY FOR OTHER BUFFER ALSO + +;THIS ROUTINE SENDS PACKET IN A TO DL10 (CALL WITH NETOFF OR IN PROGRESS) +;SWITCHES BUFFERS, LEAVES NEW ONE IN J +DLCXMT: MOVE J,DLCSBF + MOVEM A,DLCSA1(J) + HRLI A,120000 + MOVEM A,DLCSP1(J) ;GIVE 11 POINTER TO NEW PACKET + SOS DLCSP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE, PUTTING PACKET INTO CORE + MOVEI T,1 + MOVEM T,DLCSS1(J) ;ACTIVATE PDP11 + CONO DLC,100040+TTYCHN + XORI J,1 ;NEXT BUFFER + MOVEM J,DLCSBF + POPJ P, + +IFN KL10P,[ +;THIS ROUTINE SWEEPS PACKET IN A OUT OF THE CACHE, +;CLOBBERING B, C, AND D. +IFG PKTBSZ-1000, .ERR PKTBSZ BIGGER THAN HARDWARE PAGE SIZE, CACHE SWEEP LOSES +DLCSWP: LDB D,[111100,,A] ;SWEEP ONE PAGE OF CACHE + SWPUO (D) ;STORING PACKET INTO CORE + MOVE B,[CONSZ 200000] ;AWAIT COMPLETION IN ACS + MOVE C,[JRST B] ;TO MINIMIZE CACHE INTERFERENCE + MOVSI D,(POPJ P,) + JRST B +];KL10P +];DLCP + +SUBTTL CHAOS NET TEN-11 INTERFACE STUFF + +IFN T11CHP,[ +;THIS ROUTINE CHECKS FOR TEN-11 INITIALIZATION, SKIP-RETURNS IF OK TO USE +;CLOBBERS T,TT +T11CHK: SKIPE TEN11F + JRST T11LUZ ;NOT SUPPOSED TO USE TEN11 + MOVE T,T11VER ;CHECK VERSION TO MAKE SURE RIGHT PROGRAM, ETC. + CAME T,[.BYTE 8 ? "H ? "C ? 0 ? 1] + JRST T11LUZ ;PROBABLY TURNED OFF OR WRONG PROGRAM + SKIPE T11I10 ;SHOULD WE REINIT? + JRST T11CK1 ;YES, GO DO SO + SKIPLE T,T11WIN ;ARE WE WINNING? + JRST POPJ1 ;YES, FINE + JUMPE T,[SETOM T11WIN ;NOW THAT VERSION IS OK, TELL 11 TO INIT + MOVSI T,-1 + MOVEM T,T11I11 + JRST T11CK1 ] ;AND INIT OURSELVES + SKIPE T11I11 ;WAITING FOR 11 TO REINIT? + POPJ P, ;YES, WAIT +;HERE TO REINIT. FIRST, PICK UP PARAMETERS. +T11CK1: LDB TT,[242000,,T11PRM] ;BYTES PER PACKET BUFFER + CAIGE TT,<%CPMXW+1>*4 ;BETTER BE RIGHT SIZE + JRST T11LUZ ;TOO SMALL (ASSUME IF TOO BIG, PACKETS WON'T BE) + LSH TT,-2 + MOVEM TT,T11BSZ ;SAVE BUFFER SIZE IN PDP10 WORDS + LDB T,[042000,,T11PRM] ;NUMBER OF BUFFERS IN EACH DIRECTION + IMULB T,TT ;NUMBER OF PDP10 WORDS IN EACH DIRECTION + ADD TT,T11IBB + MOVEM TT,T11IBE ;INIT POINTERS + MOVEM TT,T11OBB + MOVEM TT,T11OBP + ADD TT,T + MOVEM TT,T11OBE + HRREI T,-T11CHS-2000(TT) + JUMPG T,T11LUZ ;COMMUNICATION AREA LONGER THAN 1K + MOVE T,T11IBB + MOVEM T,T11IBP +T11CK2: SETZM (T) ;CLEAR BUFFER HEADERS + ADD T,T11BSZ + CAMGE T,TT + JRST T11CK2 + MOVEM T,T11WIN ;WE'RE WINNING (MAKE T11WIN POSITIVE NON-ZERO) + SETZM T11I10 ;INIT DONE + JRST POPJ1 + +;HERE IF PDP11 PARAMETERS DON'T MATCH WHAT WE EXPECT +T11LUZ: SETZM T11WIN ;NOT WINNING + POPJ P, + +;HERE FROM CLOCK LEVEL TO CHECK ON TEN-11 CHAOS NET CHANNEL +T11WAK: PUSHJ P,T11CHK ;IS EVERYTHING OK? + POPJ P, ;NO. +T11WK0: MOVE C,T11IBP ;CHECK INPUT + SKIPN (C) + JRST T11WK1 ;NONE AVAILABLE + MOVSI J,2(C) ;POINT TO PACKET + LDB D,[$CPKNB+2(C)] ;GET SIZE OF PACKET + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS INCLUDING HEADER + LSH D,-2 + CAILE D,%CPMXW ;DON'T GET FAKED OUT BY CLOBBERED COUNT + MOVEI D,%CPMXW + PUSHJ P,CHABGI ;GET PLACE TO PUT IT + JRST T11WK1 ;NONE AVAILABLE + HRLOI E,-1(D) + EQVI E,(A) ;AOBJN POINTER TO PACKET BUFFER + HRRI J,(A) ;BLT POINTER TO COPY PACKET + ADDI D,-1(A) ;LAST WORD + BLT J,(D) ;COPY PACKET FROM 11 TO 10 + MOVEI H,0 ;COMPUTE CHECKSUM +T11WK4: ADD H,(E) + LSH H,-1 + TRZE H,10 + TLO H,(SETZ) + AOBJN E,T11WK4 + MOVE TT,1(C) ;GET PDP11'S CHECKSUM + SETZM (C) ;GIVE THE 11 BACK THE BUFFER + ADD C,T11BSZ ;ADVANCE THE POINTER + CAML C,T11IBE + MOVE C,T11IBB + MOVEM C,T11IBP + CAME H,TT + JRST [ AOS T11CKE ;COUNT CHECKSUM ERRORS + PUSHJ P,CHABRT ;AND DISCARD PACKET + JRST T11WK0 ] + CONO PI,NETOFF + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON + JRST T11WK0 + +T11WK1: CONO PI,NETOFF + SKIPE T11XMQ ;ANY OUTPUT? + SKIPE @T11OBP ;AND OUTPUT BUFFER SPACE AVAILABLE? + JRST NETONJ ;NO, RETURN FROM T11WAK + HLRZ A,T11XMQ ;GET PACKET OFF TRANSMIT QUEUE + HLRZ B,-2(A) ;GET NEXT AFTER THAT + HRLM B,T11XMQ ;BECOMES NEW HEAD OF QUEUE + SKIPN B + SETZM T11XMQ + PUSHJ P,T11XMT ;COPY PACKET INTO 11 + CONO PI,NETON + JRST T11WK1 ;LOOK FOR MORE OUTPUT + +;SEND PACKET A-> TO 11. SMASHES B,C,T,TT,Q. CALL WITH NETOFF. +T11XMT: LDB C,[$CPKNB(A)] ;GET BYTE COUNT + MOVE Q,C ;MUST CLEAR UNUSED BYTES AT END OF LAST WORD + ANDI Q,3 ;TO MAKE THE CHECKSUM COME OUT RIGHT + ADDI C,4*%CPKDT+3 + LSH C,-2 ;CONVERT TO WORD COUNT + MOVE Q,(Q)[ -1 ;MASK FOR BYTES TO RETAIN IN LAST WORD + <.BYTE 8 ? -1> + <.BYTE 8 ? -1 ? -1> + <.BYTE 8 ? -1 ? -1 ? -1> ] + MOVEI TT,-1(C) + ADD TT,A + ANDM Q,(TT) ;MASK OFF LAST WORD + HRLOI C,-1(C) + EQVI C,(A) ;AOBJN PTR + MOVEI TT,0 ;COMPUTE XOR CHECKSUM IN TT + SKIPA B,T11OBP ;-> CURRENT OUTPUT BUFFER IN 11 +T11XM1: ADDI B,1 + MOVE T,(C) + TRZ T,17 ;CLEAR BITS 10-11 TREATS SPECIALLY + ADD TT,T ;COMPUTE CHECKSUM + LSH TT,-1 + TRZE TT,10 + TLO TT,(SETZ) + MOVEM T,2(B) + AOBJN C,T11XM1 + MOVE B,T11OBP + MOVEM TT,1(B) ;GIVE CHECKSUM TO 11 + MOVSI TT,-1 + MOVEM TT,0(B) ;GIVE PACKET TO 11 + ADD B,T11BSZ ;ADVANCE BUFFER POINTER + CAML B,T11OBE + MOVE B,T11OBB + MOVEM B,T11OBP + HRROS T,-2(A) ;TAKE PACKET OFF TRANSMIT LIST + AOJN T,.+2 + PUSHJ P,CHABRT ;NOT ON SEND LIST, FREE IT + POPJ P, +];T11CHP + +SUBTTL CH-10 INTERRUPT ROUTINES + +;THE GENERAL IDEA IS THAT WE INTERRUPT ON A LOW-PRIORITY INTERRUPT LEVEL, +;AND DO THE TIME-INTENSIVE PACKET COPYING AT THAT LEVEL. THE GENERAL +;CHAOS ROUTINES ARE THEN CALLED WITH NETOFF. + +IFN CH10P,[ + +EBLK + +CHXACS: BLOCK 20 +CHXPDL: -60,,. + BLOCK 60 + +CHXBRK: 0 +BBLK + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + CONSO CHX,CHXRCV ;PACKET RECEIVED? + JRST CHXBK5 + PUSHJ P,CHABGI ;GET PLACE TO PUT PACKET + JRST [ MOVEI T,CHXREN ;NONE AVAILABLE, DISABLE INTR + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + JRST CHXBK5 ] + CONSZ CHX,CHXCRC+CHXWLE ;CHECK FOR ERRORS + JRST [ CONSZ CHX,CHXCRC + AOSA CHNCRC + AOS CHNWLE + JRST CHXBK4 ] ;IGNORE PACKET + DATAI CHX,T ;FIRST DATAI YIELDS GARBAGE + MOVEI T,CHXSWB ;DISABLE BYTE SWAPPING + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;READ HEADER + DATAI CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + CAILE T,%CPMXC ;DON'T RUN OFF END OF BUFFER + JRST CHXBK4 + ADDI T,3 ;ROUND UP TO NEXT WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, TT GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAI CHX,(D) + AOBJN D,.-1 + DATAI CHX,T ;NOW READ AND IGNORE HARDWARE HEADER + TLNE T+1,400000 + DATAI CHX,T ;THIRD HALFWORD + CONI CHX,T ;CHECK FOR ERRORS + TDNE T,[CHXPLE+CHXCRC+CHXOVR] + JRST [ TLNE T,(CHXOVR) + JRST CHXBKZ ;OVERRRUN CAN'T HAPPEN UNLESS HARDWARE BROKEN + TLNE T,(CHXPLE) + AOSA CHNPLE + TRNN T,CHXCRC + JRST CHXBK4 + AOS CHNCR2 + JRST CHXBK4 ] + CONO PI,NETOFF-1 + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON-1 + CAIA +CHXBK4: PUSHJ P,CHABRT ;DIDN'T USE BUFFER AFTER ALL + CONI CHX,T ;COUNT LOST PACKETS + LDB T,[$CHXLC,,T] + ADDM T,CHNLOS + MOVEI T,CHXREN ;ENABLE RECEIVER FOR NEXT PACKET + IORB T,CHXCNO + CONO CHX,CHXRCV(T) +CHXBK5: CONSO CHX,CHXXMT ;TRANSMIT DONE? + JRST CHXBK9 + SKIPE T,CHOSTA ;TRANSMIT IN PROGRESS? + CONSO CHX,CHXABT ;AND WAS ABORTED? + JRST CHXBK7 ;NO TO EITHER, LOOK FOR MORE WORK + AOS CHNABT ;METER TRANSMIT ABORTS + CAIL T,NCHRTR ;ABORTED TOO MANY TIMES? + JRST CHXBK7 ;DONE WITH PACKET + AOS CHOSTA ;COUNT RETRANSMISSIONS + MOVEI T,CHXTEN + IORB T,CHXCNO + CONO CHX,CHXXMT(T) ;RETRANSMIT PACKET + JRST CHXBK9 + +CHXBK7: SETZM CHOSTA ;TRANSMITTER IDLE, LOOK FOR NEXT PACKET + CONO PI,PIOFF + HLRZ A,CHXXMQ ;ANYTHING QUEUED FOR TRANSMISSION? + JUMPE A,[ MOVEI T,CHXTEN ;DISABLE INTERRUPTS + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PION + JRST CHXBK9 ] + HLRZ B,-2(A) ;CDR TRANSMIT QUEUE + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;QUEUE EMPTY NOW + CONO PI,PION + AOS CHOSTA ;NOW SEND THIS PACKET + MOVEI T,CHXHLF+CHXSWB ;CLEAR HALFWORD, BYTE-SWAP MODES + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;TRANSMIT HEADER + DATAO CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,1 ;ROUND UP TO NEXT HALF WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, T+1 GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAO CHX,(D) + AOBJN D,.-1 + MOVEI T,CHXHLF+CHXTEN ;SWITCH TO HALFWORD MODE, ENABLE DONE INTR + IORM T,CHXCNO + CONO CHX,@CHXCNO + TLNE T+1,400000 ;SEND EXTRA HALFWORD IF NEEDED + DATAO CHX,(D) + MOVEI T,CHXSWB ;DISABLE SWAP BYTES MODE + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + LDB T,[$CPKDN(A)] ;GET DESTINATION SUBNET + HRRZ D,SBNRUT(T) ;GATEWAY TO THAT SUBNET + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;IF ON LOCAL CABLE + LDB D,[$CPKDA(A)] ;GO DIRECT + LSH D,16.+4 + DATAO CHX,D ;STORE HARDWARE DESTINATION ADDRESS + MOVE T,CHXCNO ;TRANSMIT PACKET + CONO CHX,CHXXMT(T) + CONI CHX,T + TLNE T,(CHXOVR) ;CAN'T HAPPEN UNLESS HARDWARE BROKEN +CHXBKZ: BUG HALT,[CHAOS: I/O BUS OVERRUN] + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE +CHXBK9: MOVSI 17,CHXACS ;DISMISS INTERRUPT + BLT 17,17 + JRST 12,@CHXBRK + +CHSWAB: LDB T,[$CPKOP(A)] ;DOES THIS PACKET NEED BYTE SWAPPING? + TRNE T,200 + JRST [ TRNE T,100 + POPJ P, ;BINARY DATA + JRST CHSWB1 ] ;CHARACTER DATA + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;BINARY CONTROL PACKET +CHSWB1: MOVEI T,CHXSWB ;CHARACTER, SWAP DEM BYTES + IORM T,CHXCNO + CONO CHX,@CHXCNO + POPJ P, + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH10P + +SUBTTL CH-11 INTERRUPT ROUTINES + +;The Unibus Chaosnet board interrupts on the same level as TTYs, +;and comes to CHXBKH via vectored interrupt. We use a programmed +;interrupt request to drop down to a lower interrupt level for the +;slow packet-copying operation, so as not to interfere with the TTYs, +;then turn NETOFF when we call into the Chaosnet NCP. +;(We actually use NETOFF-1 and NETON-1 so as not to interfere with +;CLKOFF. This assumes that interrupt levels between CLKCHN and +;CHXCHN are never turned off.) + +IFN CH11P,[ + +;;; Macros that will eventually be instructions + +DEFINE PACK16 AC,E ;AC,AC+1 right-aligned and zero-filled + LSH AC,16. + IOR AC,AC+1 + LSH AC,4 + MOVEM AC,E +TERMIN + +DEFINE PACK8 AC,E ;AC: ...B2B1 AC+1: ...B4B3 zero-filled!! + ROTC AC,-8 ;B3...B2 B1...B4 + ROT AC,-16. ;B1,B2,B3 in position, B4 right-aligned + ADDI AC+1,(AC+1) ;Shift RH(AC+1) left 4 bits + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) ;B1,B4 in position in AC+1 + IOR AC,AC+1 + MOVEM AC,E +TERMIN + +DEFINE UNPK16 AC,E ;Doesn't bother masking off garbage bits + MOVE AC,E + MOVE AC+1,AC + ROT AC,16. ;First halfword right-aligned + LSH AC+1,-4 ;Second halfword right-aligned +TERMIN + +DEFINE UNPK8 AC,E + MOVE AC,E ;B1B2B3B4... + ROT AC,8 ;B2B3B4...B1 + MOVE AC+1,AC + AND AC,[377_2,,377] ;...B3...B1 zero-filled + ROT AC+1,16. ;B4...B1B2B3 + AND AC+1,[377_12,,377_8];B4...B2... zero-filled + IORB AC,AC+1 ;B4B3...B2B1 + ROT AC+1,16. ;...B4B3, garbage in high bits +TERMIN + +EBLK + +CHXACS: BLOCK 20 +CHXSVH: 0 +CHXPDL: -60,,. + BLOCK 60 + +CHXBKH: 0 ;Hardware interrupt on TTYCHN comes here +BBLK + CONO PI,CHXRQ ;Redirect to lower interrupt level + MOVEM T,CHXSVH ;Clear hardware interrupt enable + MOVEI T,%CAREN+%CATEN ; so the Chaos board will stop interrupting + ANDCAB T,CHXCSR + IOWRI T,CAICSR + MOVE T,CHXSVH + JRST 12,@CHXBKH +EBLK + +CHXBRK: 0 ;Software interrupt on CHXCHN comes here +BBLK + CONO PI,020000+200_<-CHXCHN> ;BAG-BITING DEC LOSERS + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + IORDI T,CAICSR ;Check for received packet + TRNN T,%CARDN + JRST CHXBK3 ;No incoming packet yet + TRNE T,%CAERR ;Check for error in received packet + JRST [ AOS CHNCRC + JRST CHXBK1 ] ;Ignore packet + IORDI R,CAIRBC ;Number of bits in packet - 1 + SUBI R,31. ;Exclude the three extra hardware words + TRNE R,17 + JRST [ AOS CHNWLE ;Length not a multiple of 16 + JRST CHXBK1 ] + ASH R,-5 ;32-bit word count, rounded up + PUSHJ P,CHABGI ;Get place to put packet + JRST [ AOS CHNLOS ;No buffers, lose this packet + JRST CHXBK1 ] + HRLI A,-%CPKDT ;Copy out the packet header +CHSRC1: IORDI B,CAIRBF + IORDI C,CAIRBF + PACK16 B,(A) + AOBJN A,CHSRC1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHSRC4 ;No byte swapping + JUMPGE D,CHSRC3 +CHSRC2: IORDI B,CAIRBF ;Read out the data, byte-swapped + IORDI C,CAIRBF + PACK8 B,(D) + AOBJN D,CHSRC2 +CHSRC3: JUMPGE H,CHSRC7 ;Jump if even packet length + IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK8 B,(D) + AOJA D,CHSRC7 + +CHSRC4: JUMPGE D,CHSRC6 +CHSRC5: IORDI B,CAIRBF ;Read out the data, halfwords + IORDI C,CAIRBF + PACK16 B,(D) + AOBJN D,CHSRC5 +CHSRC6: JUMPL H,[ IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK16 B,(D) + AOJA D,CHSRC7 ] +CHSRC7: SUB D,R ;AOBJN pointer minus number of words in packet + CAIE A,(D) + JRST [ AOS CHNPLE ;Packet length disagrees with hardware length + JRST CHXBK2 ] + IORDI T,CAIRBF ;Read the three hardware header words + IORDI T,CAIRBF + IORDI T,CAIRBF + IORDI T,CAICSR + TRNE T,%CAERR ;Make sure packet came out of RAM okay + JRST [ AOS CHNCR2 ;Garbage, try again + JRST CHXBK2 ] + IORDI T,CAIRBC ;Make sure counter didn't spazz + CAIE T,7777 + JRST [ AOS CHNSPZ + JRST CHXBK2 ] + CONO PI,NETOFF-1 ;Get to network interrupt level + PUSHJ P,CHAPII ;Process the input + CONO PI,NETON-1 +CHXBK1: IORDI T,CAICSR ;Count lost packets + LDB TT,[$CALOS,,T] + ADDM TT,CHNLOS + MOVE TT,CHXCSR + IORI TT,%CARCL ;Enable receiver for next packet + IOWRI TT,CAICSR +CHXBK3: TRNN T,%CATDN ;Transmit done? + JRST CHXBK8 ;No, dismiss + SKIPN TT,CHOSTA ;Transmit in progress? + JRST CHXBK7 ;No, look for something to transmit + TRNN T,%CATAB ;Yes, was it aborted? + JRST CHXBK5 ;No, we're done with that packet + AOS CHNABT ;Meter transmit aborts + CAIGE TT,NCHRTR ;Aborted too many times? + JRST CHXBK7 ;No, retransmit it +CHXBK5: CONO PI,PIOFF ;Lock transmit list + HLRZ A,CHXXMQ ;Get packet probably being transmitted now + JUMPE A,[ CONO PI,PION ;It vanished? + JRST CHXBK6 ] + HLRZ B,-2(A) ;CDR transmit queue + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;Queue empty now + CONO PI,PION + HRROS B,-2(A) ;Mark it not on transmit list + AOJN B,CHXBK6 ;And unless it is on send list + PUSHJ P,CHABRT ;Return it to free +CHXBK6: SETZM CHOSTA ;Transmitter idle, look for next packet +CHXBK7: HLRZ A,CHXXMQ ;Anything queued for transmission? + JUMPE A,CHXBK9 ;No, leave interrupts disabled + AOS CHOSTA ;Count retransmissions + MOVE T,CHXCSR ;Reset transmitter + IORI T,%CATDN + IOWRI T,CAICSR + HRLI A,-%CPKDT ;Transmit header +CHXXM1: UNPK16 B,(A) + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN A,CHXXM1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHXXM4 ;No byte swapping + JUMPGE D,CHXXM3 +CHXXM2: UNPK8 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM2 +CHXXM3: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK8 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF + JRST CHXXM7 + +CHXXM4: JUMPGE D,CHXXM6 +CHXXM5: UNPK16 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM5 +CHXXM6: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK16 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF +CHXXM7: LDB T,[$CPKDN(A)] ;Get destination subnet + HRRZ D,SBNRUT(T) ;Gateway to that subnet + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;If on local cable, + LDB D,[$CPKDA(A)] ; go direct + IOWRI D,CAIWBF ;Store hardware destination address + IORDI T,CAIXMT ;Transmit packet +CHXBK8: MOVEI A,%CATEN ;Enable transmit-done interrupt if xmitting +CHXBK9: IORI A,%CAREN ;Enable receive-done interrupt always + IORB A,CHXCSR + IOWRI A,CAICSR + MOVSI 17,CHXACS ;Dismiss software interrupt + BLT 17,17 + JRST 12,@CHXBRK + +CHXBK2: PUSHJ P,CHABRT ;Packet no good, discard it + JRST CHXBK1 + +;Examine packet in A, return AOBJN pointer to data in D, +; H is negative if there is an extra halfword after that. +; W gets number of full words of data (same as LH D). +; T,U get clobbered +; Returns: +; +1 16-bit data +; +2 8-bit data +CHSHDR: HRRZI A,-%CPKDT(A) ;Restore packet address + LDB W,[$CPKNB(A)] ;Get size of packet in bytes + CAILE W,%CPMXC + MOVEI W,%CPMXC ;Self-defense + ADDI W,1 ;Round up to next word boundary + LSHC W,-2 ;Convert bytes to words, H gets remainder + HRLOI D,-1(W) ;Make AOBJN pointer + EQVI D,%CPKDT(A) + LDB T,[$CPKOP(A)] ;Does this packet need byte swapping? + TRNE T,200 + JRST [ TRNN T,100 + AOS (P) ;Character data + POPJ P, ] ;Binary data + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;Binary control packet + JRST POPJ1 ;Characters + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH11P + +SUBTTL CHAOS NET BUFFER LIST STUFF + +OVHMTR CHL + +;BUFFERS ARE PKTBSZ WORDS LONG; 2 HEADER WORDS AND %CPMXW PACKET WORDS. +;PKTBSZ IS A POWER OF 2 AND LESS THAN 1K (MEMORY PAGE SIZE). +;NOTE THAT A BUFFER ADDRESS POINTS AT THE FIRST PACKET WORD +;AND THE HEADER WORDS ARE AT NEGATIVE ADDRESSES. +;FIRST HEADER WORD: -2(A) +; RH LIST THREAD FOR MOST LISTS, 0=END, -1=NOT ON LIST +; LH LIST THREAD FOR TRANSMIT LIST +;SECOND HEADER WORD: -1(A) +; TIME RECEIVED OR TIME PUT ON TRANSMIT LIST +; OR VALUE OF I FOR A PACKET ON THE LSN QUEUE +; ASCII/LUNCH/ FOR A PACKET ON THE FREE LIST + +;I DO IT THIS WAY (PIOFF) TO AVOID HAVING TO PUSH AND POP PI STATUS, +;CONO PI,NETOFF CAN LOSE AT INTERRUPT LEVEL (MAINLY THE NETON LOSES) + +;THESE ROUTINES TURN OFF INTERRUPTS MOMENTARILY SO THAT +;LISTS MAY BE SAFELY MANIPULATED. + +;Q POINTS TO THE HEADER WORD OF A QUEUE, REMOVE THE FIRST +;THING AND RETURN IN A. (ZERO IF NONE) CLOBBERS T +CHAQGF: CONO PI,PIOFF + HLRZ A,(Q) ;GET FIRST + JUMPE A,PIONJ ;EMPTY + HRRZ T,-2(A) ;GET SECOND + HRLM T,(Q) ;MAKE FIRST +IFN FTRCHK,[ + JUMPN T,PIONJ + HRRZ T,(Q) + CAIE T,(A) + BUG PAUSE,[CHAOS LIST TRASHED],OCT,Q + SETZM (Q) ;IS NOW EMPTY +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM (Q) ;IS NOW EMPTY +];FTRCHK + CONO PI,PION + POPJ P, + +;RETURN BUFFER INTO WHICH THE BYTE POINTER IN A POINTS. CLOBBERS A,T,Q +CHBPFR: SUBI A,1 ;SIOKT LIKES TO MAKE BP POINT AT NEXT BUFFER + ANDI A,-PKTBSZ + ADDI A,2 + JRST CHABRT + +;RETURN BUFFER POINTED TO BY A TO FREE UNLESS ON TRANSMIT LIST. +CHABR1: HLLOS T,-2(A) ;RH GETS -1, NO LONGER ON REGULAR LIST + AOJN T,CPOPJ ;EXIT IF STILL ON TRANSMIT LIST + ;DROPS THROUGH +;RETURN BUFFER POINTED BY A TO FREE STORAGE. CLOBBERS T, Q. +CHABRT: MOVEI Q,CHQFRE +IFN FTRCHK,[ + SKIPN A + BUG PAUSE,[FREEING 0] +];FTRCHK + MOVE T,[ASCII/LUNCH/] ;TANSTAAFL + MOVEM T,-1(A) + SETOM -2(A) ;NOT ON TRANSMIT LIST NOW (THIS IS WHAT INITS + AOS CHFRBF ; LH[-2(A)] WHEN BUFFER FIRST CREATED) + ;JRST CHAQPL ;DROPS THROUGH + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE LAST THING. BASHES T. +CHAQPL: HLLZS -2(A) ;PUT ENDLIST IN RH + CONO PI,PIOFF + HRRZ T,(Q) ;GET LAST + HRRM A,(Q) ;MAKE NEW LAST + JUMPN T,[HRRM A,-2(T) ;MAKE A COME AFTER IT + JRST PIONJ ] + HRLM A,(Q) ;WAS EMPTY, ALSO IS NEW FIRST + CONO PI,PION + POPJ P, + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE FIRST THING. SMASHES T. +CHAQPF: CONO PI,PIOFF + HLRZ T,(Q) ;GET FIRST + HRRM T,-2(A) ;MAKE SECOND + HRLM A,(Q) ;MAKE NEW FIRST + SKIPN T + HRRM A,(Q) ;WAS EMPTY, ALSO MAKE NEW LAST + CONO PI,PION + POPJ P, + +;ALLOCATE A BUFFER AT MAIN PROGRAM LEVEL, TO A, MASHES T, TT, Q, B. +CHABG0: PUSHJ P,UDELAY ;WAIT FOR MEMORY +CHABGT: PUSHJ P,CHABGI + JRST CHABG0 + POPJ P, ;WIN + +;ALLOCATE A BUFFER, RETURN POINTER TO IT IN A, SKIP. BLOWS AWAY T, TT, Q. +;NON-SKIP IF NO BUFFERS AVAILABLE. (DOESN'T MAKE NEW ONES IF FREE LIST EMPTY) +CHABAL: MOVEI Q,CHQFRE + PUSHJ P,CHAQGF + JUMPE A,CPOPJ + SETZM -1(A) ;NO LUNCH + SOS CHFRBF + JRST POPJ1 + +;ALLOCATE A BUFFER TO A, MAKE NEW IF NONE FREE. OBLITERATES T,Q,B. +;NON-SKIP IF CAN'T GET MEMORY. (SUITABLE FOR CALLING FROM INT LEVEL) +CHABGI: PUSHJ P,CHABAL ;TRY TO ALLOCATE A BUFFER FROM FREE LIST + CAIA + JRST POPJ1 ;WON, RETURN + CONI PI,Q ;SAVE PI CHANNELS ON STATUS + ANDI Q,177 + CONO PI,UTCOFF ;MAKE THE WORLD SAFE FOR IOMQ + MOVE B,CHTTBF + CAIL B,CHMXBF ;MAKE SURE NOT TO USE UP ALL CORE + JRST CHABG4 + PUSHJ P,IOMQ ;GET 1K OF MEMORY + JRST CHABG3 ;MEM NOT AVAILABLE, FAIL + CONO PI,PICON(Q) ;WON, RESTORE PI STATUS + MOVEI B,MUCHA + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ;ADDRESS OF 1K OF ALLOCATED MEMORY + ADD A,[-<2000/PKTBSZ>,,2] ;-BUFFERS PER 1K,,OFFSET TO HEADER +CHABG2: PUSHJ P,CHABRT ;PUT THEM ALL ON FREE LIST + ADDI A,PKTBSZ-1 + AOBJN A,CHABG2 + MOVEI B,<2000/PKTBSZ> ;THIS MANY MORE BUFFERS HAVE BEEN CREATED + ADDM B,CHTTBF + JRST CHABGI ;NOW GO ALLOCATE ONE + +;HERE IF CHAOS NET TRYING TO USE UP TOO MUCH CORE +CHABG4: MOVE B,CHMXTM ;DON'T COMPLAIN TOO OFTEN + ADDI B,60.*30. ;JUST ONCE A MINUTE + CAMLE B,TIME + JRST CHABG3 +IFE CH10P, BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE] +IFN CH10P,[ + CONI CHX,B + BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE, CONI=],OCT,B,[CONO=],OCT,CHXCNO,[CHOSTA=],OCT,CHOSTA +];CH10P + MOVE B,TIME + MOVEM B,CHMXTM +CHABG3: CONO PI,PICON(Q) ;LOST, RESTORE PI STATUS + POPJ P, ;AND TAKE ERROR RETURN + +;FREE A WHOLE LIST OF BUFFERS, Q-> HEAD. DESTROYS A,T +CHALFR: PUSHJ P,CHAQGF + JUMPE A,CPOPJ + PUSH P,Q + PUSHJ P,CHABR1 ;FREE UNLESS STILL ON TRANSMIT LIST + POP P,Q + JRST CHALFR + +;Q -> A TRANSMIT QUEUE, FLUSH ALL BUFFERS BELONGING TO INDEX I. +;CLOBBERS A,B,C,T +CFLXMQ: PUSH P,Q + CONO PI,NETOFF ;DON'T LET TRANSMIT LIST CHANGE (AT ALL) + HLRZ A,(Q) ;HEAD OF TRANSMIT LIST + JUMPE A,CFLXM3 + MOVEI B,2(Q) ;B PREVIOUS PACKET, A CURRENT, C NEXT +CFLXM1: HLRZ C,-2(A) ;GET THREAD TO NEXT +IFN FTRCHK,[ + CAIN C,-1 + JRST 4,. ;CLAIMS NOT TO BE ON LIST? +];FTRCHK + LDB T,[$CPKSX(A)] ;GET THIS PACKET'S INDEX + CAME T,I + JRST CFLXM2 + HRLM C,-2(B) ;THREAD PREVIOUS TO NEXT + HRROS T,-2(A) ;IF THIS BUFFER IS NOT ALSO ON SEND LIST, + AOJN T,.+2 + PUSHJ P,CHABRT ;RETURN IT + SKIPA Q,(P) +CFLXM2: MOVE B,A + SKIPE A,C + JRST CFLXM1 + HRRM B,(Q) ;LAST PACKET ON LIST MAY HAVE CHANGED + CAIN B,2(Q) + SETZM (Q) ;TRANSMIT QUEUE IS NOW EMPTY +CFLXM3: POP P,Q + JRST NETONJ + +;SEARCH LIST IN Q FOR PACKET WHOSE CONTACT NAME MATCHES THAT +;OF PACKET IN A, RETURN IT IN B, SKIPPING IF WINNING. CLOBBERS T,TT,C,D,E,H,J. +;THE PACKET RETURNED IN B IS DE-LINKED FROM THE SEARCHED QUEUE. +;HAS TO BE CALLED WITH NETOFF OR IN PROGRESS, SO LIST CAN'T GET MUNGED. +;I HOPE IT'S NOT TOO BLETCHEROUSLY SLOW. +CHAQSR: HLRZ B,(Q) ;GET START OF LIST TO SEARCH + JUMPE B,CPOPJ ;EMPTY, LOSE + MOVEI J,0 ;PACKET PREVIOUS TO B +CHAQS1: LDB C,[$CPKNB(A)] ;SET UP STRING COMPARE LOOP + LDB H,[$CPKNB(B)] ;THIS ASSUMES NO ZERO-LENGTH STRINGS + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEI E,%CPKDT(B) + HRLI E,440800 +CHAQS2: ILDB T,D + ILDB TT,E ;DON'T IGNORE CASE, THAT WOULD JUST SLOW THIS + CAME T,TT ;BAG-BITER DOWN EVEN MORE. EVERYONE SHOULD + JRST CHAQS4 ;PUT THEIR CONTACT NAMES IN UPPER-CASE. + CAIN T,40 ;TERMINATE ON SPACE + JRST CHAQS5 + SOJLE C,CHAQS3 + SOJG H,CHAQS2 + ILDB T,D + CAIE T,40 + JRST CHAQS4 +CHAQS5: HRRZ C,-2(B) ;WON, DELINK PACKET FROM LIST + JUMPE J,[ HRLM C,(Q) + JUMPN C,POPJ1 + IFN FTRCHK,[ + HRRZ C,(Q) ;CHECK LIST ENDING IN RIGHT PLACE + CAIE C,(B) + JRST 4,. + ];FTRCHK + SETZM (Q) + JRST POPJ1 ] + HRRM C,-2(J) + JUMPN C,POPJ1 + HRRM J,(Q) ;TOOK LAST PACKET, STORE NEW LAST + JRST POPJ1 + +CHAQS3: SOJLE H,CHAQS5 + ILDB TT,E + CAIN TT,40 + JRST CHAQS5 +CHAQS4: MOVE J,B ;THIS ONE DOESN'T MATCH, TRY NEXT + HRRZ B,-2(B) + JUMPN B,CHAQS1 + POPJ P, ;NO MATCHES + +;THIS ROUTINE RUNS IN THE CORE JOB AND CLEANS UP MEMORY USED BY CHAOS BUFFERS +;SMASHES ALL ACS +CHCLN: SKIPE A,CHTTBF ;SEE IF 2/3 OR MORE OF BUFFERS FREE + SKIPN B,CHFRBF + POPJ P, ;NO BUFFERS OR NONE FREE, NOTHING TO DO + SUBM A,B + IDIV A,B ;GET RATIO OF TOTAL TO USED + CAIGE A,3 ;NOTE IF B IS ZERO A IS UNCHANGED + POPJ P, ; AND AT LEAST 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ;SCAN MEMORY FOR CHAOS BUFFER PAGES +.ELSE MOVEI D,255. +CHCLN0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUCHA +CHCLN4: SOJGE D,CHCLN0 + JUMPL D,CPOPJ + MOVE A,D ;QUICKLY DETERMINE IF ANY NON-FREE BUFFERS + LSH A,10. ; ON THIS PAGE + HRLI A,-<2000/PKTBSZ> + MOVE T,[ASCII/LUNCH/] +CHCLN5: CAME T,1(A) + JRST CHCLN4 ;NOT FREE, DON'T BOTHER WITH SLOW STUFF + ADDI A,PKTBSZ-1 + AOBJN A,CHCLN5 + SETZB C,CHCLNQ ;COLLECT ALL FREE BUFFERS THAT ARE ON THIS PAGE + MOVE E,CHFRBF ;LOOP ABOUT AS MANY TIMES AS THERE ARE FREE BUFFERS +CHCLN1: PUSHJ P,CHABAL ;GET NEXT FREE BUFFER + JUMPE A,CHCLN2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,CHCLNQ ;THIS ONE'S ON THE PAGE, SAVE IT + PUSHJ P,CHAQPL + AOJA C,.+2 ] ;COUNT THEM + PUSHJ P,CHABRT ;NOT ON THE PAGE, PUT BACK + SOJG E,CHCLN1 +CHCLN2: CAIE C,<2000/PKTBSZ> ;DID WE GET THE WHOLE PAGE? + JRST [ MOVEI Q,CHCLNQ ? PUSHJ P,CHALFR ? JRST CHCLN4 ] + MOVNS C ;YES, GET RID OF THESE BUFFERS + ADDM C,CHTTBF + MOVE A,D + PUSHJ P,MEMR + JRST CHCLN + +OVHMTR CHZ diff --git a/system/chaos.288 b/system/chaos.288 new file mode 100644 index 0000000..359deea --- /dev/null +++ b/system/chaos.288 @@ -0,0 +1,2798 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +IFE IMPP, IFE CH11P, .ERR NOT EVERYTHING IN CHAOS WILL WORK WITHOUT IMP +IFNDEF FTRCHK, FTRCHK==0 ;PROBABLY FOUND ALL THE BUGS THIS WAS GOOD FOR + ; LONG AGO +IFN FTRCHK, .ERR REDUNDANT CHECKING ENABLED IN CHAOS ROUTINES + +;NOTES: +; WINDOW SIZE ADJUSTMENT STUFF +; ROUND TRIP TIME MEASUREMENT & OTHER METERING +; BETTER METERING, SOME METERS ARE CURRENTLY MISSING + +SUBTTL CH-10 HARDWARE DEFINITIONS + +IFN CH10P,[ +CHX==470 ;I/O DEVICE NUMBER + +;CONI/CONO BITS + ;1.1-1.3 PIA +CHXTEN==10 ;1.4 TRANSMIT INTERRUPT ENABLE +CHXREN==20 ;1.5 RECEIVE INTERRUPT ENABLE +CHXSPY==40 ;1.6 MATCH ANY DESTINATION +CHXLUP==100 ;1.7 LOOP BACK +CHXSWB==200 ;1.8 SWAP BYTES +CHXHLF==400 ;1.9 HALFWORD DATAO +CHXXMT==1000 ;2.1 TRANSMIT DONE (CONI) + ; TRANSMIT OR RETRANSMIT PACKET (CONO) +CHXRCV==2000 ;2.2 RECEIVE DONE (CONI) + ; ENABLE TO RECEIVE NEXT PACKET (CONO) +CHXABT==4000 ;2.3 TRANSMIT ABORTED (CONI) + ; RESET TRANSMITTER (CONO) +$CHXLC==140400 ;2.4-2.7 LOST COUNT (CONI) +CHXRST==10000 ;2.4 RESET (CONO) +CHXCRC==200000 ;2.8 CRC ERROR (CONI) +CHXWLE==400000 ;2.9 WORD LENGTH ERROR (CONI) +CHXPLE==1,, ;3.1 PACKET LENGTH ERROR (CONI) +CHXOVR==2,, ;3.2 OVERRUN (CONI) +$CHXAD==242000 ;3.3-4.9 CHAOSNET ADDRESS (CONI) +];CH10P + +IFN CH11P,[ +$INSRT KSNET +];CH11P + +SUBTTL CHAOS NET VARIABLES + +EBLK + +$CHXRI==001200 ;REAL INDEX PART (LOW TEN BITS) - IS IN LH(IOCHNM) +$CHXUN==120600 ;UNIQUIZATION PART (TOP SIX BITS) +CHXMUN==1_6-1 ;MAXIMUM VALUE OF UNIQUIZER +MXWIND==100 ;MAXIMUM WINDOW SIZE (8K WORDS) +.SEE MYCHAD ;SUBNET AND HOST OF MYSELF +.SEE DLCP ;1 MEANS USE DL10 TO GET TO CHAOS NET +.SEE T11CHP ;1 MEANS USE TEN-11 INTERFACE TO GET TO CHAOS NET +.SEE CH10P ;1 MEANS USE CH10 HARDWARE TO GET TO CHAOS NET +.SEE CH11P ;1 MEANS USE UNIBUS CHAOSNET HARDWARE ON KS10 + +;Internet address of my Chaosnet Interface +IMPUS4==<.BYTE 4 ? 0 ? .BYTE 8 ? 128. ? 31. ? .BYTE 16. ? MYCHAD> + +;PER-INDEX VARIABLES + +CHSUSR: REPEAT NINDX,-1 ;-1 INDEX NOT IN USE + ;OTHERWISE RH USER + $CHSUO==220600 ;3.1-3.6 OUTPUT CHANNEL NUMBER (77=IOPUSHED) + $CHSUI==300600 ;3.7-4.3 INPUT CHANNEL NUMBER (77=IOPUSHED) + ;4.9 ZERO IF IN USE + +CHSSTA: REPEAT NINDX,-1 ;RH STATE, LH FLAGS + %CF==525252(1) + %CFOFF==400000 ;SIGN BIT MEANS TURNED OFF AT PI LEVEL, NO TALKING TO NETWORK + %CFSTS==200000 ;SEND STS PACKET AS SOON AS POSSIBLE (1/2 SECOND CLOCK) + %CFCLS==100000 ;HALF-CLOSED FLAG + %CFSTY==040000 ;DIRECT-CONNECTED TO STTY FLAG + $CFTTN==220600 ;TTY NUMBER OF STTY CONNECTED TO + + %CS==,,-1 + .SEE %CSCLS ;FOR SYMBOLS FOR STATES + +CHSNBF: BLOCK NINDX ;LH LENGTH(CHSPBF), RH LENGTH(CHSIBF) +CHSNOS: BLOCK NINDX ;NUMBER OF FREE OUTPUT SLOTS IN THE WINDOW +CHSIBF: BLOCK NINDX ;RECEIVE BUFFER POINTERS FIRST,,LAST +CHSPBF: BLOCK NINDX ;OUT OF ORDER RECEIVE BUFFER POINTERS FIRST,,LAST +CHSOBF: BLOCK NINDX ;TRANSMIT BUFFER POINTERS FIRST,,LAST +CHSITM: BLOCK NINDX ;TIME OF LAST INPUT FROM NET +CHSWIN: BLOCK NINDX ;WINDOW SIZE RECEIVE,,TRANSMIT +CHSPKN: BLOCK NINDX ;LAST PACKET# GIVEN TO USER,,LAST PACKET# SENT BY USER +CHSACK: BLOCK NINDX ;LAST PACKET# ACKNOWLEDGED RECEIVE,,TRANSMIT (START OF WINDOW) +CHSLCL: REPEAT NINDX,<.BYTE 16. ? MYCHAD ? 100000+.RPCNT> + ;BYTE (16) LOCAL HOST, LOCAL INDEX (4) 0 + ;NOTE THIS SAVES THE UNIQUIZER BITS FOR THIS INDEX +CHSFRN: BLOCK NINDX ;BYTE (16) FOREIGN HOST, FOREIGN INDEX (4) 0 +;THESE FOUR ARE FOR BYTE-STREAM I/O +CHSOBP: BLOCK NINDX ;BYTE PNTR TO OUTPUT BUFFER, 0 IF NONE +CHSOBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF BYTE SPACES LEFT IN OUTPUT BUFFER +CHSIBP: BLOCK NINDX ;BYTE PNTR TO INPUT BUFFER, 0 IF NONE +CHSIBC: BLOCK NINDX ;BYTE COUNT, NUMBER OF VALID BYTES REMAINING IN INPUT BUFFER + +CHAOSW: -1 ? 0 ;SWITCH FOR ALLOCATING INDICES +CHALCP: 0 ;LAST INDEX ALLOCATED, USED TO CIRCULARIZE ALLOCATION + +CHIRFJ: SIXBIT/CHAOS/ ? 0 ;AGENT OF CHAOS +.SEE NETUSW ;NON-ZERO ENABLES RFC'S FROM HOSTS OTHER THAN SELF. + +;METERS + +CHNPI: 0 ;NUMBER OF PACKETS INPUT (REALLY TO 10) +CHNPO: 0 ;NUMBER OF PACKETS OUTPUT (ALL CAUSES) +CHNPF: 0 ;NUMBER OF PACKETS FORWARDED +CHNSTS: 0 ;NUMBER OF STS PACKETS OUTPUT +CHNSNS: 0 ;NUMBER OF SNS PACKETS OUTPUT +CHNRTR: 0 ;NUMBER OF RETRANSMITTED PACKETS OUTPUT +CHNPFL: 0 ;NUMBER OF PACKETS DISCARDED (FORWARDING LOOP) +CHNPD: 0 ;NUMBER OF PACKETS DISCARDED (DUPLICATES) +CHNIPI: 0 ;NUMBER OF INTERNET PACKETS IN FROM CHAOSNET +CHNIPO: 0 ;NUMBER OF INTERNET FRAGMENTS OUT TO CHAOSNET + +;BUFFER QUEUES. EACH HAS A ONE-WORD HEADER, WHICH IS ZERO +;IF IT IS EMPTY, OR CONTAINS FIRST,,LAST BUFFER ADDRESS. + +CHQFRE: 0 ;FREE LIST +CHQRFC: 0 ;PENDING RFCS +CHQLSN: 0 ;PENDING LISTENS +CHCLNQ: 0 .SEE CHCLN + +CHFRBF: 0 ;NUMBER OF FREE BUFFERS +CHTTBF: 0 ;TOTAL NUMBER OF BUFFERS +IF2 CHMXBF==50.*<1024./<%CPMXW+2>> ;MAX CORE FOR CHAOS NET 50K +CHMXTM: 0 ;TIME OF LAST COMPLAINT ABOUT USING TOO MUCH CORE + +IFN T11CHP,[ +;VARIABLES FOR TEN-11 INTERFACE CONNECTING TO CHAOS NET + +.SEE T11CHS ;EXEC ADDRESS OF PDP11 COMMUNICATION AREA +T11VER=T11CHS ;VERSION NUMBER +T11I10=T11CHS+1 ;INIT 10 +T11I11=T11CHS+2 ;INIT 11 +T11PRM=T11CHS+3 ;.WORD BUFFER SIZE, # BUFFERS + ;THEN 4 SPARE DOUBLEWORDS +T11IBB: T11CHS+8 ;BEGINNING OF INPUT BUFFERS +T11IBE: 0 ;END OF INPUT BUFFERS +T11IBP: 0 ;POINTER TO NEXT INPUT BUFFER +T11OBB: 0 ;BEGINNING OF OUTPUT BUFFERS +T11OBE: 0 ;END OF OUTPUT BUFFERS +T11OBP: 0 ;POINTER TO NEXT OUTPUT BUFFER +T11BSZ: 0 ;BUFFER SIZE IN PDP10 WORDS +T11WIN: 0 ;1 WINNING, -1 HAVE TOLD 11 TO INIT, 0 NOT WINNING +T11XMQ: 0 ;QUEUED TRANSMISSION QUEUE +T11CKE: 0 ;COUNT OF CHECKSUM ERRORS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +];T11CHP + +IFN DLCP,[ +;VARIABLES FOR INTERFACE TO CHAOS NET ON PDP11 ON DL10 +;.SEE INDICATES A VARIABLE SHARED BETWEEN 10 AND 11 +;NOTE THAT THE DL10 HARDWARE LIMITS PACKET LENGTH TO 256 WORDS (1K BYTES) + +.SEE DLCINI ;WHEN THE 11 SEES THIS NON-ZERO, IT KNOWS ITS HAS + ; BEEN RELOADED AND RESETS ITS PACKET POINTER TO 0 + ; AND CLEARS DLCINI. +DLCSBF: 0 ;CURRENT BUFFER, 10 SEND SIDE (1 OR 0) + +DLCSA1: 0 ;ADDRESS OF PACKET BEING SENT +DLCSA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCSP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCSP2 ;DITTO, SECOND BUFFER +.SEE DLCSS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 SENT TO 11, 2 11 DONE +.SEE DLCSS2 ;STATE FOR BUFFER 2 + +DLCRA1: 0 ;ADDRESS OF PACKET BUFFER RECEIVING A PACKET +DLCRA2: 0 ;DITTO, SECOND BUFFER +.SEE DLCRP1 ;POINTER USED BY PDP11 TO COPY PACKET (16-BIT BYTES) +.SEE DLCRP2 ;DITTO, SECOND BUFFER +.SEE DLCRS1 ;STATE FOR BUFFER 1, 0 IDLE, 1 AWAITING 11, 2 CONTAINS A PACKET +.SEE DLCRS2 ;STATE FOR BUFFER 2 + +DLCXMQ: 0 ;TRANSMIT BUFFER LIST FOR DL10 + ;NOTE THAT THIS IS NOT A REGULAR BUFFER LIST SINCE + ;IT IS THREADED THROUGH LH INSTEAD OF RH. WE DO MAINTAIN + ;POINTERS TO FIRST,,LAST HOWEVER +];DLCP + +IFN CH10P,[ +;VARIABLES FOR CH10 INTERFACE ONLY + +CHXCNO: CHXREN+CHXTEN+CHXCHN ;CONO BITS CURRENTLY IN EFFECT +];CH10P + +IFN CH11P,[ +;VARIABLES FOR CH11 INTERFACE ONLY + +CHXCSR: %CAREN+%CATEN ;CURRENT BITS WANTED IN CSR +];CH11P + +IFN CH10P+CH11P,[ +;VARIABLES THAT WOULD OTHERWISE BE IN THE FRONT-END + +CHXXMQ: 0 ;HEAD,,TAIL OF TRANSMIT QUEUE +CHOSTA: 0 ;OUTPUT STATUS: 0 IDLE, ELSE NUMBER OF TRANSMISSIONS +NCHRTR==4 ;TRANSMIT UP TO 4 TIMES IN FACE OF COLLISIONS + +;ROUTING STUFF +NSUBNT==122. ;122 is maximum possible +SBNRUT: REPEAT NSUBNT, 1000,,3040 ;COST,,GATEWAY ADDRESS + +;EXTRA METERS +CHNABT: 0 ;NUMBER OF TRANSMIT ABORTS +CHNCRC: 0 ;NUMBER OF CRC ERRORS BEFORE READING PACKET +CHNCR2: 0 ;NUMBER OF CRC ERRORS AFTER READING PACKET +CHNWLE: 0 ;NUMBER OF WORD LENGTH ERRORS (NOT MULTIPLE OF 16 BITS) +CHNPLE: 0 ;NUMBER OF PACKET LENGTH ERRORS (DISAGREES WITH LENGTH IN HEADER) +CHNLOS: 0 ;NUMBER OF PACKETS LOST DUE TO RECEIVER BUSY +];CH10P+CH11P +IFN CH11P,[ +CHNSPZ: 0 ;NUMBER OF TIMERS BIT COUNTER SPAZZED +];CH11P + +BBLK + +;Get definitions of packet format + +IF1,[ +$INSRT CHSDEF + +PKTBSZ==%CPMXW+2 ;PACKET BUFFER IS 2 HEADER WORDS + MAX SIZE PACKET +IFN >-PKTBSZ, .ERR PKTBSZ IS SUPPOSED TO BE A POWER OF 2 + +$CPKSX==$CHXRI+40000,,2 ;REAL PART OF SOURCE INDEX +$CPKDX==$CHXRI+40000,,1 ;REAL PART OF DESTINATION INDEX + +];IF1 + +;;; Debugging Info + +;;; This contains the last N headers received from the network +NRECHD==20 +EBLK +RECHDP: RECHDR ;POINTER TO NEXT +RECHDR: BLOCK NRECHD*%CPKDT +BBLK + +SUBTTL CHAOS NET OPEN (.CALL CHAOSO) + +;.CALL CHAOSO,RCVCHN,XMTCHN, + +CHASO: JRST OPNL12 ; Say "mode not avail" +CHAOSO: HRRZS A + HRRZS B + CAIGE A,20 + CAIL B,20 + JRST OPNL14 ;BAD CHANNEL NUMBER ARGUMENT + CAMN A,B + JRST OPNL33 ;BOTH CHANNELS SAME IS ILLEGAL + PUSH P,A ;SAVE ARGS, CLOSE THE SPECIFIED CHANNELS + PUSH P,B + PUSH P,C + MOVE R,A + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + MOVE R,-1(P) ;B + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,C + POP P,B + POP P,A + MOVE U,USER ;TO SAVE ULCERS + HRRZM A,UUAC(U) ;REMEMBER INPUT CHNL # FOR ERRS + PUSHJ P,SWTL ;LOCK CHAOS INDEX ASSIGNMENT SWITCH + CHAOSW + MOVE I,CHALCP ;ALLOCATE AN INDEX + SOJL I,CHASO2 +CHASO1: SKIPL CHSUSR(I) + SOJGE I,CHASO1 + JUMPGE I,CHASO3 +CHASO2: MOVEI I,NINDX ;REACHED BEGINNING, WRAP AROUND TO END + CAMN I,CHALCP + JRST OPNL6 ;ALL INDICES IN USE + MOVEM I,CHALCP + SOJA I,CHASO1 + +CHASO3: MOVEM I,CHALCP ;SAVE SCAN POINTER FOR NEXT TIME + PUSHJ P,CHASO4 ;INIT VARIOUS STUFF + CAILE C,MXWIND ;SET UP WINDOW SIZE + MOVEI C,MXWIND ;DON'T LET USER USE UP TOO MUCH WIRED CORE + HRLZM C,CHSWIN(I) + HRRZM U,CHSUSR(I) ;VARIABLES INITIALIZED, MAKE INDEX IN USE. + DPB A,[$CHSUI,,CHSUSR(I)] + DPB B,[$CHSUO,,CHSUSR(I)] + HRLZ T,I ;SET UP USER'S IOCHNM WORDS + HRRI T,CHAIDN + ADDI A,IOCHNM(U) + MOVEM T,(A) + HRRI T,CHAODN + ADDI B,IOCHNM(U) + MOVEM T,(B) + JRST LSWPJ1 ;SUCCESS RETURN + +;INITIALIZE CONNECTION IN I +CHASO4: SETZM CHSNBF(I) + SETZM CHSNOS(I) + SETZM CHSIBF(I) + SETZM CHSPBF(I) + SETZM CHSOBF(I) + SETZM CHSACK(I) + SETZM CHSPKN(I) ;START PACKET NUMBERING AT ONE + SETZM CHSOBP(I) + SETZM CHSOBC(I) + SETZM CHSIBP(I) + SETZM CHSIBC(I) + MOVSI T,%CFOFF .SEE %CSCLS + MOVEM T,CHSSTA(I) + LDB TT,[$CHXUN+40000,,CHSLCL(I)] + CAIE TT,CHXMUN ;INCREMENT THE UNIQUIZER + AOSA TT + MOVEI TT,1 ;BUT MAKE SURE IT ISN'T ZERO + DPB TT,[$CHXUN+40000,,CHSLCL(I)] + SETZM CHSFRN(I) + POPJ P, + +SUBTTL CHAOS NET CLOSE, FINISH, WHYINT, NETBLK, CHAOSQ + +;CLOSE A CHAOS CHANNEL. +CHACLS: HLRZ I,(R) ;GET VARIABLES INDEX + MOVSI A,%CFCLS + TDNN A,CHSSTA(I) ;ONLY REALLY CLOSE WHEN BOTH CHANNELS CLOSED + JRST CHACS7 + PUSHJ P,CHACS1 ;FLUSH ALL BUFFERS OF THIS CONNECTION + HRRZ T,CHSSTA(I) + CAIN T,%CSOPN + PUSHJ P,CHABGI ;SEND A CLS IF OPEN AND MEM AVAIL + JRST CHACS4 + MOVE T,CHSFRN(I) + MOVEM T,%CPKS(A) + MOVE T,CHSLCL(I) + MOVEM T,%CPKD(A) + MOVEI B,[ASCIZ/Channel closed/] + PUSHJ P,CHIRF2 +CHACS4: CONO PI,NETOFF + SETZM (R) ;CLOSE THIS CHANNEL + SETOM CHSUSR(I) ;RETURN INDEX + MOVE W,CHQLSN ;FLUSH ANY PENDING LSN PACKET + SETZM CHQLSN +CHACS5: MOVEI Q,W ;GET NEXT PACKET OFF OLD LIST + PUSHJ P,CHAQGF + JUMPE A,NETONJ ;EXHAUSTED + LDB B,[$CPKSX(A)] ;GET OWNER + CAME B,I + JRST [ MOVEI Q,CHQLSN ;NOT THIS INDEX, PUT BACK + PUSHJ P,CHAQPL + JRST CHACS5 ] + PUSHJ P,CHABRT ;FREE + JRST CHACS5 + +CHACS7: IORM A,CHSSTA(I) .SEE %CFCLS + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + MOVEI T,77 ;CLOSE THAT CHANNEL + DPB T,B + SETZM (R) + POPJ P, + +;THIS FLUSHES ALL BUFFERS FOR CONNECTION IN I +CHACS1: MOVSI A,%CFOFF ;INHIBIT RETRANSMISSIONS + IORB A,CHSSTA(I) + LDB E,[$CFTTN,,CHSSTA(I)] + EXCH E,I + TLNE A,%CFSTY + PUSHJ P,NSTYN0 ;DISCONNECT FROM STY + JFCL + EXCH E,I +IFN DLCP,[ + MOVEI Q,DLCXMQ ;REMOVE THIS INDEX'S BUFFERS FROM DL10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ ;REMOVE THIS INDEX'S BUFFERS FROM TEN11 TRANSMIT LIST + PUSHJ P,CFLXMQ +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ ;REMOVE THIS INDEX'S BUFFERS FROM CH10 TRANSMIT LIST + PUSHJ P,CFLXMQ +];CH10P+CH11P + MOVEI Q,CHSIBF(I) ;RETURN RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSPBF(I) ;RETURN OUT OF ORDER RECEIVE BUFFERS + PUSHJ P,CHALFR + MOVEI Q,CHSOBF(I) ;RETURN TRANSMIT BUFFERS + PUSHJ P,CHALFR +IFE FTRCHK,[ + SKIPE A,CHSOBP(I) ;RETURN STREAM I/O BUFFERS + PUSHJ P,CHBPFR + SKIPE A,CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK +IFN FTRCHK,[ + SKIPN A,CHSOBP(I) + JRST .+3 + SETZM CHSOBP(I) + PUSHJ P,CHBPFR + SKIPN A,CHSIBP(I) + JRST .+3 + SETZM CHSIBP(I) + PUSHJ P,CHBPFR +];FTRCHK + POPJ P, + +;.CALL FORCE ON A CHAOS OUTPUT CHANNEL. +CHAFRC: HLRZ I,(R) + SKIPGE CHSSTA(I) .SEE %CFOFF + JRST OPNL7 ;DEVICE NOT READY + AOS (P) ;WILL TAKE SUCCESS RETURN +CHAFC1: SKIPN A,CHSOBP(I) + POPJ P, ;NO BUFFERED OUTPUT TO BE FORCED + SUBI A,1 ;SIOKT LIKES TO POINT BP AT NEXT BUFFER + ANDI A,-PKTBSZ ;GET PACKET POINTER + ADDI A,2 + MOVSI T,(SETZ) ;DATA OPCODE + MOVEM T,(A) .SEE $CPKOP + MOVEI T,%CPMXC ;SET BYTE COUNT + SUB T,CHSOBC(I) + DPB T,[$CPKNB(A)] + PUSHJ P,[JUMPN T,CHODT1 ;IF THERE IS ANYTHING IN THE BUFFER, TRANSMIT IT + JRST CHABRT ] ;OTHERWISE, JUST THROW IT AWAY + SETZM CHSOBP(I) ;NOW THERE IS NO BUFFER + SETZM CHSOBC(I) + POPJ P, + +;.CALL FINISH ON A CHAOS OUTPUT CHANNEL. WAIT FOR ALL BUFFERS +;ON SEND LIST TO GET SENT AND ACKNOWLEDGED. +;HANGS FOREVER IF SOCKET GETS INTO AN IMPROPER STATE, BUT YOU SHOULD GET AN INTERRUPT +CHAFIN: HLRZ T,(R) + PUSHJ P,[HRRZ A,CHSWIN(T) + CAMG A,CHSNOS(T) + AOS (P) + POPJ P, ] + PUSHJ P,UFLS + JRST POPJ1 + +;.CALL WHYINT ON A CHAOS CHANNEL. +;RESULTS ARE: A/ %WYCHA +; B/ STATE +; C/ LH NUMBER OF INPUT PACKETS AVAILABLE +; RH NUMBER OF OUTPUT SLOTS AVAILABLE +; D/ WINDOW SIZE (RECEIVE,,TRANSMIT) +; E/ INPUT CHNL#,,OUTPUT CHNL# +CHAWHY: HLRZ I,(R) + MOVEI A,%WYCHA + HRRZ B,CHSSTA(I) + HRLZ C,CHSNBF(I) ;NUMBER OF PACKETS AVAILABLE + SKIPE CHSIBP(I) + ADD C,[1,,] ;ADD 1 IF PARTIALLY-READ INPUT BUFFER EXISTS + MOVSI D,%CFSTY + TDNE D,CHSSTA(I) + MOVEI C,0 ;NO INPUT AVAILABLE IF DIRECT-CONNECTED + SKIPLE CHSNOS(I) + HRR C,CHSNOS(I) + MOVE D,CHSWIN(I) + LDB E,[$CHSUO,,CHSUSR(I)] + CAIN E,77 + MOVEI E,-1 + LDB T,[$CHSUI,,CHSUSR(I)] + CAIN T,77 + TLOA E,-1 + HRL E,T + JRST POPJ1 + +;.CALL RFNAME on a CHAOS channel. A contains index. +;Returns results analogous to RFNAME on TCP: and (almost) RFNAME on NET:. +;"FN1" is local index, "FN2" is foreign index, "SNAME" is foreign host +;number in HOSTS3 format. +CHARCH: LDB B,[042000,,CHSLCL(A)] + LDB C,[042000,,CHSFRN(A)] + LDB D,[242000,,CHSFRN(A)] + TLO D,(NW%CHS) + POPJ P, + +;IOPDL ROUTINES. I IS 0 FOR IOPUSH, 1 FOR IOPOP. R POINTS AT IOCHNM WORD. +;C(R) IS SET UP TO THIS DEVICE IN EITHER CASE. +CHAIOP: HRRZ T,R ;DISCOVER CHANNEL NUMBER + SUBI T,IOCHNM(U) + SKIPN I + MOVEI T,77 ;IOPUSH, USE 77 + HLRZ I,(R) ;GET CHAOS INDEX + HRRZ B,(R) ;GET DIRECTION + CAIN B,CHAIDN ;AS A BYTE POINTER TO CHANNEL NUMBER + SKIPA B,[$CHSUI,,CHSUSR(I)] + MOVE B,[$CHSUO,,CHSUSR(I)] + DPB T,B ;ADJUST SAVED CHANNEL NUMBER + POPJ P, + +;.CALL NETBLK ON A CHAOS CHANNEL. +;ARG 1 - CHANNEL (COMES IN IN R) +;ARG 2 - UNDESIRED STATE +;ARG 3 - OPTIONAL TIMEOUT, WRITTEN BACK UNLESS IMMEDIATE +;VAL 1 - NEW STATE +;VAL 2 - TIME LEFT +CHANBK: HRRZ T,(R) + CAIL T,CHAIDN + CAILE T,CHAODN +IFN NCPP, JRST ANETBL ;NOT A CHAOS CHANNEL, TRY ARPANET +IFE NCPP, JRST OPNL34 + HLRZ I,(R) + MOVE T,I ;SAVE INDEX IN T FOR FLSINS + CAIGE W,3 + JRST [ HRLOI D,377777 ;NO TIME GIVEN, USE INFINITY + JRST CHANB4 ] + TLNE C,1000 ;SKIP IF POINTER RATHER THAN IMMEDIATE + JRST [ HRRZ D,C ;GET IMMEDIATE TIME + ADD D,TIME + JRST CHANB4 ] + XCTR XRW,[MOVES D,(C)] ;GET TIME, CHECK WRITEABILITY + JUMPGE D,[ MOVNS D ;RELATIVE TIME, MAKE NEGATIVE ABSOLUTE + SUB D,TIME + JRST .+1 ] + UMOVEM D,(C) ;STORE BACK ABSOLUTE TIME + MOVNS D ;MAKE POSITIVE +CHANB4: MOVEM D,AC0S+D(U) ;SAVE ABSOLUTE TIME TO WAIT UNTIL + MOVEM B,AC0S+B(U) ;SAVE UNDESIRED STATE + PUSHJ P,CHANB2 ;SKIP IF STATE CHANGE OR TIMEOUT + PUSHJ P,UFLS + MOVE B,D + SUB B,TIME ;HOW MUCH USED? + HRRZ A,CHSSTA(I) ;NEW STATE + JRST POPJ1 + +CHANB2: HRRZ A,CHSSTA(T) ;CURRENT STATE + CAME A,AC0S+B(U) ;SKIP IF STILL MATCH + JRST POPJ1 + MOVE A,AC0S+D(U) ;TIMEOUT TIME + CAMG A,TIME + AOS (P) + POPJ P, + +;.CALL CHAOSQ +;ARG 1 - ADDRESS OF A %CPMXW-WORD PACKET BUFFER +;FINDS THE FIRST PACKET ON THE PENDING-RFC QUEUE, COPIES IT +;INTO THE USER'S BUFFER, AND RETURNS IT TO THE QUEUE. +CHAOSQ: MOVE C,A ;SAVE POINTER TO USER'S BUFFER + HRL A,A ;MAKE SURE USER'S BUFFER IS SWAPPED IN + XCTR XBRW,[BLT A,%CPMXW-1(C)] ;AND NO MAR BREAK SET + MOVEI Q,CHQRFC ;GET FIRST PACKET ON RFC QUEUE + PUSHJ P,CHAQGF + JUMPE A,OPNL4 ;QUEUE IS EMPTY + PUSHJ P,CHAQPL ;PUT BACK AT END OF QUEUE + HRL C,A ;COPY PACKET TO USER + MOVE T,C + XCTR XBW,[BLT T,%CPMXW-1(C)] + JRST POPJ1 + +SUBTTL CHAOS NET IOT ROUTINES + +;.CALL PKTIOT. ARG1 CHANNEL, ARG2 ADDRESS OF %CPMXW-WORD BUFFER +PKTIOT: HRRZ A,(R) + CAIN A,CHAODN + JRST CHPKO + CAIE A,CHAIDN + JRST OPNL34 ;WRONG TYPE DEVICE +;CHAOSNET INPUT PKTIOT +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKI: PUSHJ P,CHAIOS ;SET UP I, E + HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,[PUSHJ P,CHPKI0 ;LIST EMPTY + JRST CHPKI ] + HRL B,A ;COPY TO USER BEFORE REMOVING FROM LISTS + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,4*%CPKDT+3 ;HEADER PLUS ROUND-UP TO NEXT WORD BOUNDARY + LSH T,-2 ;CONVERT BYTES TO WORDS + ADDI T,-1(B) ;ADDRESS OF LAST DESTINATION WORD + XCTR XBW,[BLT B,(T)] + LDB TT,[$CPKOP(A)] ;GET OPCODE + CAIGE TT,%CODAT ;ACKNOWLEDGE IF DATA + CAIN TT,%COEOF ;OR EOF MARK + PUSHJ P,CHPKIA + SOS CHSNBF(I) ;NOW REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + PUSHJ P,CHABRT ;AND RETURN TO FREE + JRST POPJ1 ;SUCCESS + +;INPUT WITH INPUT BUFFER EMPTY. MUSTN'T BASH B,C,E. +CHPKI0: SKIPGE CHSSTA(I) .SEE %CFOFF + JRST [ HRRZ T,CHSSTA(I) + CAIE T,%CSFRN ;CHAOSNET OR FOREIGN PROTOCOL? + JRST IOCR10 ;IOT WITH CHANNEL IN IMPROPER STATE + JRST .+1 ] ;WAIT BUT DON'T TRY TO TOUCH WINDOW SIZE + ;HERE CONSIDER INCREASING WINDOW SIZE + SKIPN CHSIBF(I) ;AWAIT INPUT + PUSHJ P,UFLS + POPJ P, ;RETRY + +;ACKNOWLEDGE DATA PACKET IN A. ITS OPCODE IN TT. +CHPKIA: LDB T,[$CPKPN(A)] ;GET PACKET # + HRLM T,CHSPKN(I) ;IT NOW NEEDS TO BE ACKNOWLEDGED + CAIN TT,%COEOF ;ALWAYS ACKNOWLEDGE EOF RIGHT AWAY + JRST CHASTO + HLRZ TT,CHSACK(I) ;GET LAST ONE REALLY ACKNOWLEDGED + SUB T,TT ;GET NUMBER OF PACKETS AWAITING ACK + SKIPGE T + ADDI T,200000 + IMULI T,3 ;MORE THAN ONE THIRD THE WINDOW SIZE? +IFN FTRCHK,[ + MOVE TT,-1(A) + CAMN TT,[ASCII/LUNCH/] + BUG PAUSE,[CHAOS BUFFER ADDRESS TRASHED],OCT,A +];FTRCHK + HLRZ TT,CHSWIN(I) + CAML T,TT + PUSHJ P,CHASTO ;YES, SEND ACK (CAN'T PCLSR) + POPJ P, + +;SET UP FOR CHAOS IOT +CHAIOS: HLRZ I,(R) ;GET INDEX + MOVE E,CHSSTA(I) + TLNE E,%CFSTY+%CFCLS + JRST IOCR10 ;CAN'T DO I/O WHILE DIRECT-CONNECTED OR HALF-CLOSED + HRRZS E ;RETURN STATE IN E + POPJ P, + +;UNIT-MODE INPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUI: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + MOVE E,[440800,,4] + JSP B,(T) + CHSIBP(I) + CHSIBC(I) + CHAIBG + CHAIBD + 0 + TRNA + +;CHAOS INPUT BUFFER DISCARD +CHAIBD: SKIPN A,CHSIBP(I) + POPJ P, + SETZM CHSIBP(I) + SETZM CHSIBC(I) + JRST CHBPFR + +;CHAOS INPUT BUFFER GET +CHAIBG: HLRZ A,CHSIBF(I) ;GET FIRST RECEIVE BUFFER + JUMPE A,CHAIB2 ;NONE + LDB TT,[$CPKOP(A)] ;IS IT NORMAL DATA? + CAIE TT,%CODAT + JRST CHAIB1 ;NO + PUSHJ P,CHAIB3 ;YES, ACKNOWLEDGE AND REMOVE FROM LIST + LDB J,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEI TT,%CPKDT(A) + JRST SIOBG1 + +CHAIB3: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHPKIA ;SEND ACKNOWLEDGEMENT + POP P,E + POP P,C + POP P,B + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + JRST CHAQGF + +CHAIB1: CAIE TT,%COEOF + JRST CHAIB2 + PUSHJ P,CHAIB3 ;EOF PACKET, ACKNOWLEDGE IT + PUSHJ P,CHABRT ;RETURN IT TO FREE + JRST POPJ2 ;AND SIGNAL EOF + +CHAIB2: MOVE TT,CTLBTS(U) ;CHECK DON'T-HANG MODE + TRNE TT,10 + JRST POPJ2 ;YES, EOF + JUMPN A,IOCR10 ;NO, ABNORMAL PACKET, BARF + PUSHJ P,CHPKI0 ;AWAIT INPUT + JRST CHAIBG ;RETRY + +;UNIT-MODE OUTPUT. +;1.4 IN CTLBTS IS DON'T-HANG MODE + SKIPA T,[SIOKT] +CHAUO: MOVEI T,CHRKT + PUSHJ P,CHAIOS ;SET UP I, E + CAIE E,%CSOPN + JRST IOCR10 ;NOT OPEN, ERROR + MOVE E,[440800,,4] + JSP B,(T) + SETZ CHSOBP(I) + CHSOBC(I) + CHAOBG + CHAOBW + 0 + TRNA + +;GET NEW OUTPUT BUFFER +CHAOBG: SKIPG CHSNOS(I) ;WINDOW FULL + PUSHJ P,[ MOVE TT,CTLBTS(U) + TRNN TT,10 + JRST UFLS + SUB P,[1,,1] + JRST POPJ2 ] ;DON'T HANG MODE, RETURN "EOF" + PUSH P,B + PUSHJ P,CHABGT ;SET UP AN OUTPUT BUFFER + POP P,B + + MOVEI TT,%CPKDT(A) + MOVEI J,%CPMXC + JRST SIOBG1 + +;WRITE OUTPUT BUFFER +CHAOBW: PUSH P,B + PUSH P,C + PUSH P,E + PUSHJ P,CHAFC1 + POP P,E + JRST POPCBJ + +;CHAOSNET OUTPUT PKTIOT. +;B POINTS TO %CPMXW-WORD PACKET BUFFER +CHPKO: PUSHJ P,CHAIOS ;SET UP I, E + UMOVE H,(B) ;GET HEADER WORD OF USER'S PACKET BUFFER + LDB D,[$CPKNB H] ;GET BYTE COUNT + CAIG D,%CPMXC + TLNE H,(.BM $CPKMV) ;WE DON'T SUPPORT MUPPETS ANY MORE + JRST IOCER3 ;BYTE LENGTH OUT OF BOUNDS + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS, INCLUDING HEADER WDS + LSH D,-2 + MOVSI J,1(B) ;SAVE ADDRESS+1 OF USER'S PACKET + PUSHJ P,CHABGT ;GET A BUFFER + PUSHJ P,LOSSET ;RETURN IT IF PCLSR + CHPKO2 + MOVEM H,(A) ;STORE PACKET HEADER, NOT STORED WITH BLT + HRRI J,1(A) ; BECAUSE MIGHT HAVE CHANGED AFTER ERROR CHECK + ADDI D,-1(A) + XCTR XBR,[BLT J,(D)] ;COPY USER'S PACKET INTO SYSTEM + AOS (P) ;GOING TO SUCCEED + SKIPGE (A) ;SKIP IF CONTROL PACKET + JRST CHODAT ;DATA + LDB D,[$CPKOP(A)] ;GET OPCODE + CAIGE D,%COMAX ;DISPATCH ON IT + JRST @.+1(D) + OFFSET -. + JRST IOCER3 ;OPCODE OUT OF BOUNDS +%CORFC::JRST CHORFC +%COOPN::JRST CHOOPN +%COCLS::JRST CHOCLS +%COFWD::JRST CHOFWD +%COANS::JRST CHOFWD +%COSNS::JRST IOCER3 +%COSTS::JRST IOCER3 +%CORUT::JRST IOCER3 +%COLOS::JRST IOCER3 +%COLSN::JRST CHOLSN +%COMNT::JRST IOCER3 +%COEOF::JRST CHOEOF +%COUNC::JRST CHOUNC +%COBRD::JRST IOCER9 ;UNTIL I IMPLEMENT IT +%COMAX::OFFSET 0 + +;LOSSET ROUTINE TO RETURN BUFFER A POINTS TO. +CHPKO2: MOVE A,AC0S+A(U) + PUSH P,Q ;MAY CLOBBER ONLY A AND T + PUSHJ P,CHABRT + JRST POPQJ + +;SENDING %COEOF (END-FILE MARK) +CHOEOF: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + JRST CHOOP1 ;SEND RETRANSMITTABLE CONTROL PACKET + +;SENDING REQUEST FOR CONNECTION +CHORFC: PUSHJ P,CHORF1 ;RE-INITIALIZE CONNECTION + MOVSI B,777774 ;SAVE DESTINATION HOST, CLEAR OTHER BITS + ANDB B,%CPKD(A) + MOVEM B,CHSFRN(I) + MOVEI E,%CSRFS ;PUT INTO RFC-SENT STATE + JRST CHOOP1 ;GO SEND + +;RE-INITIALIZE CONNECTION WHEN USER OUTPUTS RFC OR LSN +;FLUSHES ANY OLD PACKET BUFFERS, CHANGES UNIQUIZER IN INDEX# +CHORF1: JUMPN E,IOCR10 .SEE %CSCLS ;CONNECTION MUST BE CLOSED + PUSH P,A + PUSH P,B + PUSHJ P,CHACS1 ;FLUSH BUFFERS FROM CONNECTION + PUSHJ P,CHASO4 ;REINITIALIZE VARIABLES + JRST POPBAJ + +;"SENDING" LISTEN +CHOLSN: PUSHJ P,CHORF1 + PUSHJ P,LSWDEL ;GOING TO USE PACKET + MOVEI E,%CSLSN ;PUT INTO LISTENING STATE + HRRM E,CHSSTA(I) + MOVEI Q,CHQRFC ;NOW SEARCH PENDING-RFC QUEUE + CONO PI,NETOFF + PUSHJ P,CHAQSR + JRST [ CONO PI,NETON ;NO MATCH, PUT ONTO LISTENING QUEUE + MOVEI Q,CHQLSN + MOVE T,CHSLCL(I) + MOVEM T,%CPKS(A) + JRST CHAQPL ] + PUSHJ P,CHIRF0 ;MATCH, JOIN INTERRUPT LEVEL CODE + JRST NETONJ + +;SENDING OPEN +CHOOPN: CAIE E,%CSRFC ;CONNECTION MUST BE RFC-RECEIVED + JRST IOCR10 + MOVEI TT,4 ;SET BYTE COUNT TO 4 + DPB TT,[$CPKNB(A)] + PUSHJ P,DPBRCP ;INCLUDE RECEIPT + HLRZ B,CHSWIN(I) ;INCLUDE WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + MOVEI E,%CSOPN ;MAKE IT OPEN +;HERE TO SEND A RETRANSMITTABLE CONTROL PACKET (RFC OR OPN), NEW STATE IN E +;THIS PACKET WILL GET TAKEN OFF THE CHSOBF LIST BY RECEIPT IN THE NORMAL WAY +;THIS CODE COPIED FROM CHODAT WITH SOME MODIFICATIONS +CHOOP1: MOVE T,TIME ;UPDATE CHSITM SO WON'T THINK HOST IS DOWN + MOVEM T,CHSITM(I) + MOVEM E,CHSSTA(I) ;AND CLEAR %CFOFF (NO OTHER LH FLAGS CAN BE ON) + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] + HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + JRST CHAXM0 ;GO TRANSMIT + +;SENDING CLOSE +CHOCLS: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN +;SEND FWD OR ANS +CHOFWD: CAIN E,%CSRFC ; OR RFC-RECEIVED + TLOA E,%CFOFF ;PUT IT INTO THE CLOSED STATE + JRST IOCR10 + HLLZM E,CHSSTA(I) .SEE %CSCLS + PUSHJ P,LSWDEL ;BUFFER WILL BE USED + JRST CHODT2 ;GO TRANSMIT + +;Here for transmitting an UNC packet. It could be part of a connection +;or it could be foreign-protocol mode. In any case transmit it without +;munging the header very much. +CHOUNC: CAIN E,%CSFRN + JRST CHOUN1 ;Okay to transmit UNC now + CAIN E,%CSOPN + JRST CHOUN2 + JUMPN E,IOCR10 .SEE %CSCLS ;Bad state + SKIPE CHSPBF(I) ;I guess out of order packets would + JRST IOCR10 ; cause some confusion in the NCP. + MOVE E,[%CFOFF,,%CSFRN] ;Put into foreign-protocol state + MOVEM E,CHSSTA(I) +CHOUN1: MOVE D,%CPKD(A) ;Save destination + MOVEM D,CHSFRN(I) +CHOUN3: MOVE B,CHSLCL(I) ;Set up source + MOVEM B,%CPKS(A) + PUSHJ P,LSWDEL + SETOM -2(A) + JRST CHAXMT + +CHOUN2: MOVE D,CHSFRN(I) ;Set up destination + MOVEM D,%CPKD(A) + JRST CHOUN3 + +OVHMTR CHX + +;SENDING REGULAR PACKET +CHODAT: CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST IOCR10 + SKIPG CHSNOS(I) + PUSHJ P,UFLS ;WINDOW FULL, WAIT + PUSHJ P,LSWDEL ;BUFFER WILL BE USED +CHODT1: HRRZ B,CHSPKN(I) ;ASSIGN PACKET NUMBER + CAIL B,177777 + TDZA B,B + ADDI B,1 + HRRM B,CHSPKN(I) + DPB B,[$CPKPN(A)] +CHODT2: HLRZ B,CHSPKN(I) ;GET PACKET NUMBER TO ACKNOWLEDGE + HRLM B,CHSACK(I) ;REMEMBER IT HAS BEEN + DPB B,[$CPKAN(A)] ;PIGGY-BACK THIS ACKNOWLEDGE + MOVE B,[<.BM $CPKOP>+<.BM $CPKNB>] + ANDM B,(A) ;CLEAR FORWARDING COUNT AND UNUSED FIELD + MOVE B,CHSLCL(I) ;SET UP SOURCE + MOVEM B,%CPKS(A) + MOVE D,CHSFRN(I) ;SET UP DESTINATION + MOVEM D,%CPKD(A) + SETOM -2(A) ;NOTE NOT ON TRANSMIT LIST YET + SKIPL (A) ;SKIP IF DATA PACKET + JRST CHAXMT + CONI PI,E ;SUPER KLUDGERY REQUIRED HERE! FOREIGN HOST MIGHT RECEIPT + CONO PI,NETOFF ;THIS PACKET JUST AS WE START TO TRANSMIT IT. THIS IS A + ;VIOLATION OF PROTOCOL, BUT SHOULDN'T CRASH I.T.S. BECAUSE THE + ;PACKET ABOUT TO BE GIVEN TO CHAXMT HAS BEEN FREED ALREADY. + MOVEI Q,CHSOBF(I) ;PUT ON END OF SEND LIST + PUSHJ P,CHAQPL + SOSA CHSNOS(I) ;USE UP WINDOW, SKIP +;SKIPS THROUGH INTO CHAXMT + ;SKIPS IN +SUBTTL CHAOS NET PACKET TRANSMIT ROUTINE + +;CALL WITH PACKET IN A, SMASHES B, C, D, E, T, TT, Q, J +;USES E TO SAVE THE PI STATUS, NOTHING BETTER CLOBBER THIS, OR, BOY, WILL IT EVER LOSE! +;YOU BETTER SETOM -2(A) BEFORE CALLING THIS, AND IF YOU'RE +;PUTTING IT ON A SEND LIST, DO THAT FIRST ALSO. +;THIS CODE ASSUMES THERE IS ONLY ONE INTERFACE, AND IT IS ON A +;PDP11 WHICH WILL TAKE CARE OF THE ROUTING. +;;THIS ROUTINE IS SKIPPED INTO FROM THE PREVIOUS PAGE! +CHAXMT: CONI PI,E ;SAVE PI STATUS BEFORE TURNING NETOFF; CALLED FROM MANY LEVELS +CHAXM0: ANDI E,177 + AOS CHNPO + MOVE T,TIME + MOVEM T,-1(A) ;SET TIME OF LAST TRANSMISSION + CONO PI,NETOFF ;ONE PROCESS AT A TIME, TO PROTECT INTERFACE VARIABLES +IFN FTRCHK,[ + HLRZ J,-2(A) ;I TOLD YOU TO SETOM -2(A) + CAIE J,-1 + BUG PAUSE,[CHAOS BUFFER THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK +IFN DLCP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE DL10 +IFN FTRCHK,[ + HLRZ J,DLCXMQ ;MAKE SURE NOT PUTTING ON LIST TWICE + JUMPE J,.+7 + CAMN J,A + BUG PAUSE,[CHAOS BUFFER ALREADY ON DLCXMQ],OCT,A + HLRZ J,-2(J) + CAIN J,-1 + BUG PAUSE,[DLCXMQ THREAD TRASHED] + JUMPN J,.-5 + MOVEI J,1 ;MAKE SURE NOT ACTIVE TO 11 + HRRZ T,DLCSA1(J) + CAMN T,A + BUG PAUSE,[CHAOS BUFFER ALREADY ACTIVE TO 11],OCT,A + SOJGE J,.-3 +];FTRCHK + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH (FLAGS TRANSMIT ACTIVE) + MOVE J,DLCSBF ;SEE IF SEND BUFFER IS FREE + SKIPE DLCSS1(J) + JRST CHXMD1 + PUSHJ P,DLCXMT ;YES, SEND THE PACKET NOW + JRST CHXMD2 + +CHXMD1: HRRZ B,DLCXMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,DLCXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,DLCXMQ +CHXMD2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];DLCP +IFN T11CHP,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE TEN11 + PUSHJ P,T11CHK ;SEE IF TEN-11 IS READY + JRST CHXME3 ;NO + SKIPE @T11OBP ;SEE IF HAVE AVAILABLE OUTPUT BUFFER + JRST CHXME1 ;NO + PUSHJ P,T11XMT ;SEND THE PACKET NOW + JRST CHXME2 + +CHXME3: HRROS T,-2(A) ;TEN11 DOWN, DISCARD PACKET + AOJN T,CHXME2 + PUSHJ P,CHABRT + JRST CHXME2 + +CHXME1: HRRZ B,T11XMQ ;NO BUFFERS FREE RIGHT NOW, QUEUE + JUMPE B,[ HRLZM A,T11XMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,T11XMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH +CHXME2: CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];T11CHP +IFN CH10P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH10 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,CHXTEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORM B,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH10P +IFN CH11P,[ +;FOR NOW, JUST ALWAYS SHIP IT OUT THE CH11 + HRRZ B,CHXXMQ ;ADD TO END OF TRANSMIT QUEUE + JUMPE B,[ HRLZM A,CHXXMQ ? JRST .+2 ] + HRLM A,-2(B) + HRRM A,CHXXMQ + HRRZS -2(A) ;PUT END-LIST INDICATOR IN LH + MOVEI B,%CATEN ;ENABLE TRANSMIT-DONE INTERRUPT + IORB B,CHXCSR + IOWRI B,CAICSR + CONO PI,PICON(E) ;RESTORE PI + POPJ P, +];CH11P + +SUBTTL CHAOS NET DIRECT CONNECT TO STY + +OVHMTR CHS + +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS + +SUBTTL CHAOS NET CLOCK LEVEL STUFF + +OVHMTR CHC + +;HERE FROM 1/2 SECOND CLOCK. DO RETRANSMISSIONS AND DELAYED STS'S +CHACLK: +IFN DLCP,[ + CONO PI,NETOFF + PUSHJ P,DLCIBG ;GET MEMORY FOR INPUT BUFFERS IF NEEDED + CONO PI,NETON +];DLCP + MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHACL0: SKIPL CHSUSR(I) ;SKIP THIS ONE IF NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL + SOJGE I,CHACL0 + JUMPL I,CPOPJ ;JUMP IF ALL INDICES DONE + PUSHJ P,CHARTR ;RETRANSMIT IF NEEDED + MOVSI B,%CFSTS + TDNE B,CHSSTA(I) ;SEND STS IF NEEDED + PUSHJ P,CHASTO + SOJGE I,CHACL0 + POPJ P, + +;HERE EVERY 5 SECONDS, TO DO PROBES +CHA5CL: MOVEI I,NINDX-1 ;SCAN ALL INDICES +CHA5C0: SKIPL CHSUSR(I) ;SKIP IF THIS ONE NOT IN USE + SKIPGE CHSSTA(I) .SEE %CFOFF ;OR INHIBITED FROM PI LEVEL +CHA5C1: SOJGE I,CHA5C0 + JUMPL I,CHA5C4 ;JUMP IF ALL INDICES DONE + MOVE T,TIME + SUB T,CHSITM(I) ;TIME SINCE LAST COMMUNICATION FROM OTHER END + CAILE T,90.*30. + JRST [ MOVEI W,%CSINC ;TOO LONG, CONNECTION BROKEN + PUSHJ P,CHINT + JRST CHA5C1 ] + HRRZ B,CHSSTA(I) ;ONLY PROBE IF OPEN (COULD BE RFC-SENT) + CAIE B,%CSOPN + JRST CHA5C1 + HRRZ B,CHSWIN(I) ;SEE IF NO TRANSMIT WINDOW (LOST STS DURING OPEN) + JUMPE B,CHA5C2 + HRRZ B,CHSACK(I) ;SEE IF AWAITING ACK (WINDOW NOT EMPTY) + HRRZ C,CHSPKN(I) + CAMN B,C + CAIL T,60.*30. +CHA5C2: PUSHJ P,CHABGI ;AWAITING ACK OR IDLE FOR 1 MINUTE, PROBE + JRST CHA5C1 ;NO PROBE, OR NO BUFFER AVAILABLE + MOVSI T,(.DPB %COSNS,($CPKOP),0) ;SENSE PACKET, BYTE-COUNT=0 + MOVEM T,(A) + AOS CHNSNS + PUSHJ P,CHODT2 + JRST CHA5C1 + +CHA5C4: MOVEI B,[ASCIZ/Timeout/] + MOVEI Q,CHQRFC ;TIME-OUT FIRST RFC ON LIST + PUSHJ P,CHAQGF + JUMPE A,CHA5C5 + MOVE T,-1(A) + ADDI T,60.*30. ;TIME-OUT IS ONE MINUTE + PUSHJ P,[ CAMG T,TIME + JRST CHIRF2 + JRST CHAQPF ] +CHA5C5: +IFN CH10P,[ + MOVEI T,CHXREN+CHXTEN ;WAKE UP IN CASE OF TIMING ERROR + IORM T,CHXCNO ;IN DEALING WITH CHXCNO + CONO CHX,@CHXCNO + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH10P +IFN CH11P,[ + MOVEI T,%CAREN+%CATEN ;WAKE UP IN CASE OF TIMING ERROR + IORB T,CHXCSR ;IN DEALING WITH CHXCSR + IOWRI T,CAICSR + MOVSI T,-NSUBNT ;DECAY ROUTING COSTS + CONO PI,NETOFF ;PREVENT RUT PACKET FROM COMING IN +CHA5C6: HLRZ TT,SBNRUT(T) + ADDI TT,1 + CAIG TT,1000 + HRLM TT,SBNRUT(T) + AOBJN T,CHA5C6 + CONO PI,NETON +];CH11P + MOVEI T,5*60. + MOVEI C,CHA5CK + JRST CLQREE + +OVHMTR CHR + +;RETRANSMIT FOR INDEX IN I +CHARTR: CONI PI,W ;SAVE PI CHANNELS ACTIVE + ANDI W,177 ;CHAXMT BETTER NOT CLOBBER W! + CONO PI,NETOFF ;PI BETTER BE OFF THROUGHOUT THIS ZONE + ; SO WE DON'T GET INTO CHIACK + HLRZ A,CHSOBF(I) ;SCAN DOWN OUTPUT BUFFER LIST + JUMPE A,CHART2 ;EMPTY +CHART1: MOVE T,-1(A) ;DON'T RETRANSMIT IF DONE TOO RECENTLY + HLRZ TT,-2(A) ;OR IF ALREADY ON ITS WAY OUT (DON'T LINK TWICE ON XMIT LIST) + CAME T,TIME + CAIE TT,-1 + JRST CHART2 ;ANYTHING AFTER THIS IS LIKELY TO LOSE ALSO + AOS CHNRTR + PUSHJ P,CHAXMT ;RETRANSMIT THIS +; HRRZ A,-2(A) ;THREAD TO NEXT +; JUMPN A,CHART1 +CHART2: CONO PI,PICON(W) + POPJ P, + +;THIS ROUTINE SENDS A STS PACKET, OR TRIES TO. FAILURE => SLOW CLOCK WILL TRY AGAIN. +;CANNOT PCLSR NOR WAIT, CALLABLE FROM INTERRUPT LEVEL. +;INDEX IN I, CLOBBERS A,B,C,D,E,T,TT,Q,J +CHASTO: MOVSI D,%CFSTS + IORM D,CHSSTA(I) + PUSHJ P,CHABGI ;GET A BUFFER, WITHOUT WAITING + POPJ P, ;CAN'T GET ONE, WILL RETRY AT CLOCK LEVEL + ANDCAM D,CHSSTA(I) ;OK, A STS WILL BE SENT, CLEAR NEED-STS FLAG + MOVE T,[.DPB %COSTS,($CPKOP),<.DPB 4,($CPKNB),0>] + MOVEM T,(A) ;SEND A STS WITH 4 DATA BYTES + PUSHJ P,DPBRCP ;FIRST PAIR IS RECEIPT + HLRZ B,CHSWIN(I) ;SECOND PAIR IS WINDOW SIZE + DPB B,[042000,,%CPKDT(A)] + AOS CHNSTS + JRST CHODT2 ;FIRE IT OFF + +DPBRCP: HLRZ B,CHSPKN(I) + SKIPE T,CHSIBF(I) + LDB B,[$CPKPN(T)] + DPB B,[242000,,%CPKDT(A)] + POPJ P, + +SUBTTL CHAOS NET INTERRUPT-LEVEL INPUT PROCESSING + +OVHMTR CHI + +;PROCESS A PACKET RECEIVED AT INTERRUPT LEVEL. BY THE TIME WE GET HERE +; A BUFFER HAS BEEN ALLOCATED AND FILLED WITH THE DATA FROM THE DEVICE. +; ITS ADDRESS IS IN A. RETURN VIA POPJ P, WITH ALL REGISTERS CLOBBERED. +CHAPII: MOVE B,RECHDP ;SAVE HEADER FOR DEBUGGING IN RING BUFFER + MOVEI D,%CPKDT(B) + HRL B,A + BLT B,-1(D) + CAIN D,RECHDR+ + MOVEI D,RECHDR + MOVEM D,RECHDP + ;END OF DEBUGGING CODE + LDB D,[$CPKMV(A)] ;MUPPET? + JUMPN D,CHABRT ;FLUSH, NOT SUPPORTED + LDB D,[$CPKOP(A)] ;GET OPCODE + LDB B,[$CPKDA(A)] ;CHECK DESTINATION + CAIE B,MYCHAD ;IF FOR ME, + SKIPN B ;OR FOR ME BY VIRTUE OF BROADCAST + AOSA CHNPI ;ACCEPT IT + JRST CHAPFW ;NOT ME, FORWARD + LDB C,[$CPKNB(A)] ;PASS LENGTH IN C TO OP ROUTINES + MOVEI B,[ASCIZ/Illegal byte count/] + CAILE C,%CPMXC + JRST CHALOS + SKIPGE (A) ;TEST OPCODE + JRST CHIDAT ;DATA PACKET + MOVEI B,[ASCIZ/Illegal opcode/] + CAIGE D,%COMAX + JRST @.+1(D) + OFFSET -. + JRST CHALOS ;ILLEGAL, FLUSH +%CORFC::JRST CHIRFC +%COOPN::JRST CHIOPN +%COCLS::JRST CHICLS +%COFWD::JRST CHIANS +%COANS::JRST CHIANS +%COSNS::JRST CHISNS +%COSTS::JRST CHISTS +%CORUT:: +IFE CH10P+CH11P,JRST CHABRT ;IGNORE +IFN CH10P+CH11P,JRST CHIRUT +%COLOS::JRST CHILOS +%COLSN::JRST CHALOS ;ILLEGAL, FLUSH +%COMNT::JRST CHABRT ;IGNORE +%COEOF::JRST CHIDAT +%COUNC::JRST CHIUNC +%COBRD::JRST CHIBRD +%COMAX::OFFSET 0 + +;FORWARDING +CHAPFW: LDB B,[$CPKDA(A)] ;CHECK DESTINATION HOST + TRNN B,377_8 ;SUBNET 0? + JRST CHABRT ;FLUSH IT, XX-NETWORK-11 IS TRYING TO MAKE US CRASH + LDB B,[$CPKFC(A)] ;INCREMENT FORWARDING COUNT + ADDI B,1 + CAIL B,20 + JRST [ AOS CHNPFL ? JRST CHABRT ] ;LOOP, DISCARD + DPB B,[$CPKFC(A)] + SETOM -2(A) ;NOT ON SEND LIST + AOS CHNPF + JRST CHAXMT + +IFN CH10P+CH11P,[ ;INCOMING ROUTING INFO +CHIRUT: LSH C,-2 ;NUMBER OF SUBNET ENTRIES + JUMPE C,CHABRT ;COULD BE ZERO-LENGTH + MOVEI D,%CPKDT(A) + HRLI D,442000 + LDB E,[$CPKSA(A)] ;SOURCE HOST IS GATEWAY +CHIRU1: ILDB T,D ;SUBNET + ILDB TT,D ;COST + HLRZ B,SBNRUT(T) ;COST OF EXISTING ROUTE + CAIGE T,NSUBNT + CAMLE TT,B + JRST CHIRU2 + HRLM TT,SBNRUT(T) ;THIS IS BEST ROUTE NOW + HRRM E,SBNRUT(T) +CHIRU2: SOJG C,CHIRU1 + JRST CHABRT +];CH10P+CH11P + +;INTERRUPT-LEVEL PROCESSING OF SNS PACKET +;NOTE THAT WE DO NOT BARF AT SNS'S TO EXISTENT NON-OPEN CONNECTIONS. IF IT +;WAS AN RFC-SENT CONNECTION, THIS COULD BREAK IT PREMATURELY IF AN OPN WAS +;LOST AND THEN A SNS WAS NOT. +CHISNS: MOVEI E,%CSOPN + PUSHJ P,CHFNDX + JRST [ CAIE E,%CSOPN + JRST CHABRT ;CONNECTION EXISTS AND IS NOT OPEN, IGNORE PACKET + JRST CHALOS ] ;CONNECTION DOES NOT EXIST, COMPLAIN + PUSHJ P,CHABRT ;CONNECTION DOES EXIST + CAIE E,%CSOPN + POPJ P, ;NOT OPEN, IGNORE + JRST CHASTO ;REPLY WITH STS + +;INTERRUPT LEVEL PROCESSING OF RECEIVED FWD OR ANS +CHIANS: PUSHJ P,CHFNDX ;FIND CONNECTION + JRST CHABRT ;NOBODY AT OTHER END TO RECEIVE A LOS ANYWAY + CAIE E,%CSRFS + JRST CHABRT ;NOT IN RFC-SENT STATE, LOSS +; JRST CHICL1 ;CLOSE THE CONNECTION BUT GIVE TO USER AS INPUT + ;DROPPING THROUGH WILL DO + +;INTERRUPT LEVEL PROCESSING OF RECEIVED CLS PACKET +CHICLS: PUSHJ P,CHFNDX ;FIND CONNECTION BEING CLOSED + JRST CHALOS ;NONE, LOSS +CHICL1: MOVEI W,%CSCLS ;CLOSE THE CONNECTION +CHICL2: PUSHJ P,CHINT ;SET TO STATE IN W, INTERRUPT + PUSH P,A + MOVEI Q,CHSPBF(I) ;DISCARD OUT-OF-ORDER PACKETS + PUSHJ P,CHALFR + HRRZS CHSNBF(I) +CHIC2A: MOVEI Q,CHSOBF(I) ;DISCARD TRANSMIT PACKETS, E.G. RFC WHICH RECEIVED + PUSHJ P,CHAQGF ;AN ANS OR FWD, DON'T WANT TO TRANSMIT AGAIN + JUMPE A,CHIC2B + PUSHJ P,CHABR1 + JRST CHIC2A + +CHIC2B: POP P,A + JRST CHIDT1 ;GIVE PACKET TO USER AS DATA + ;INTERRUPT LEVEL PROCESSING OF RFC PACKET +CHIRFC: MOVE T,%CPKDT(A) ;CHECK FOR STATUS REQUEST + CAMN T,[.BYTE 8 ? "S ? "T ? "A ? "T] + CAIE C,6 + JRST CHIRF7 + MOVS TT,%CPKDT+1(A) + XORI TT,(<.BYTE 8 ? "U ? "S>) + TRNN TT,(<.BYTE 8 ? -1 ? -1>) + JRST CHIRF3 +CHIRF7: MOVEI Q,CHQLSN ;SEARCH LISTENING QUEUE + PUSHJ P,CHAQSR + JRST CHIRF1 ;NOT FOUND, LOAD SERVER + EXCH A,B ;A LSN, B RFC + LDB I,[$CPKSX(A)] ;GET CORRESPONDING INDEX + HRRZ E,CHSSTA(I) + CAIE E,%CSLSN + JRST 4,. +CHIRF0: PUSHJ P,CHABRT ;FOUND, DISCARD LISTEN PACKET + MOVE A,B ;GET OTHER HOST'S RFC + LDB B,[$CPKPN(A)] ;INITIALIZE RECEIVER'S PACKET NUMBER + HRLM B,CHSPKN(I) + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + MOVEI W,%CSRFC ;PUT INTO RFC-RECEIVED STATE + MOVE T,TIME ;AND ENGAGE PI LEVEL + MOVEM T,CHSITM(I) + JRST CHICL2 + +;RFC RECEIVED AND NOT IMMEDIATELY MATCHED TO A LSN. QUEUE AND LOAD SERVER JOB. +;BUT FIRST CHECK WHETHER THIS IS A DUPLICATE WHICH SHOULD BE DISCARDED. +CHIRF1: MOVE C,%CPKS(A) ;SEARCH PENDING RFC QUEUE FOR RFC FROM + HLRZ T,CHQRFC ;THE SAME SOURCE AS THIS. + JUMPE T,CHIRD1 +CHIRD0: CAMN C,%CPKS(T) + JRST CHABRT ;THIS RFC IS A DUPLICATE, IGNORE IT + HRRZ T,-2(T) + JUMPN T,CHIRD0 +CHIRD1: MOVSI T,-NINDX ;SEARCH OPEN AND RFC-RECEIVED CONNECTIONS +CHIRD2: SKIPL CHSUSR(T) ;FOR ONE CONNECTED TO SAME GUY AS SENT RFC + CAME C,CHSFRN(T) + AOBJN T,CHIRD2 + JUMPGE T,CHIRD3 ;NO DUPLICATE OF THIS RFC, QUEUE IT + HRRZ TT,CHSSTA(T) + CAIE TT,%CSOPN + CAIN TT,%CSRFC + JRST CHABRT ;REALLY A DUPLICATE, DISCARD + AOBJN T,CHIRD2 +CHIRD3: MOVEI B,[ASCIZ/System not up/] + SKIPL SYSDBG ;REFUSE INCOMING CONNECTIONS IF LOGINS REFUSED + SKIPE NETUSW ;ALLOWING INCOMING NET CONNECTIONS? + JRST CHIRF2 ;NO, REFUSE (EVEN IF FROM OURSELVES) + HRROI T,CHIRFJ ;LOAD JOB + CONI PI,Q ;MUST TURN UTCOFF TO CALL NUJBST + ANDI Q,177 ;SINCE THIS MAY RUN AT OTHER INT LEVELS + CONO PI,NETOFF + PUSHJ P,NUJBST + JRST [ CONO PI,PICON(Q) + JRST CHABRT ] ;RING BUFFER FULL, IGNORE, RETRY WILL CATCH + CONO PI,PICON(Q) + MOVE T,TIME ;REMEMBER WHEN THIS RFC WAS QUEUED + MOVEM T,-1(A) + MOVEI Q,CHQRFC + JRST CHAQPF ;PUT ON FRONT OF QUEUE + +;COME HERE TO SEND A LOS PACKET IN RESPONSE TO CRUFTY INPUT IN A +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHALOS: SKIPA T,[%COLOS] +;HERE TO REFUSE AN RFC. TURN IT INTO A CLS AND SEND IT BACK. +;B SHOULD POINT TO AN ASCIZ STRING FOR WHY. +CHIRF2: MOVEI T,%COCLS + HRLI B,440700 ;BP TO MESSAGE + SETZB C,(A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVE D,[440800,,%CPKDT(A)] +CHIRF4: ILDB T,B + JUMPE T,CHIRF5 + IDPB T,D + AOJA C,CHIRF4 + +CHIRF5: DPB C,[$CPKNB(A)] + SETOM -2(A) ;NOT ON ANY SEND LIST + JRST CHAXMT ;SEND IT + +;HERE FOR RFC TO "STATUS" +EXPUNGE FOO,BAR +DEFINE FOO NAME +BAR==0 +.BYTE 8 +IRPC CH,,NAME +"CH +BAR==BAR+1 +TERMIN +IFG BAR-4, .ERR NAME MORE THAN 4 CHARACTERS +REPEAT 4-BAR, 0 +.BYTE +TERMIN + +CHIRF3: MOVE B,[MNAME FOO ,,] ;NAME OF MACHINE IN 8-BIT ASCII +EXPUNGE FOO,BAR + MOVEM B,%CPKDT(A) + SETZM %CPKDT+1(A) + MOVSI B,%CPKDT+1(A) + HRRI B,%CPKDT+2(A) + BLT B,%CPKDT+7(A) + MOVE B,[.BYTE 8 ? MYCHAD/400 ? 1 ? 4+IFN CH10P+CH11P,[10.] ? 0 ] + MOVEM B,%CPKDT+10(A) + MOVEI B,%CPKDT+11(A) + HRLI B,441000 + MOVE T,CHNPI + PUSHJ P,CHRF3A + MOVE T,CHNPO + PUSHJ P,CHRF3A +IFN CH10P+CH11P,[ + MOVE T,CHNABT + PUSHJ P,CHRF3A + MOVE T,CHNLOS + PUSHJ P,CHRF3A + MOVE T,CHNCRC + PUSHJ P,CHRF3A + MOVE T,CHNCR2 + PUSHJ P,CHRF3A + MOVE T,CHNPLE + ADD T,CHNWLE + PUSHJ P,CHRF3A +];CH10P+CH11P + MOVEI T,%COANS + SETZM (A) .SEE $CPKFC + DPB T,[$CPKOP(A)] + MOVE T,%CPKS(A) ;EXCHANGE SOURCE AND DESTINATION + EXCH T,%CPKD(A) + MOVEM T,%CPKS(A) + MOVEI C,13*4+IFN CH10P+CH11P,[20.] ;BYTE COUNT + JRST CHIRF5 ;SEND + +CHRF3A: MOVEI TT,4 + IDPB T,B + LSH T,-8 + SOJG TT,.-2 + POPJ P, + +;HERE TO CONVERT A BRD INTO AN RFC + +CHIBRD: LDB T,[$CPKAN(A)] ;NUMBER OF BITMAP BYTES + LDB TT,[$CPKNB(A)] ;NUMBER OF TOTAL DATA BYES (INCLUDES BITMAP) + CAIG T,32. ;ACK NUMBER NO GREATER THAN 32. + TRNE T,3 ; MUST BE MULTIPLE OF 4 + JRST CHABRT ; FREE THE PACKET IF NO GOOD + CAMG TT,T ;MUST BE SOME TEXTUAL RFC DATA AS WELL + JRST CHABRT ; IF NOT, FREE PACKET + MOVE C,TT ;GET NUMBER OF BYTES (CHIRFC WANTS COUNT IN C) + SUB C,T ;WITHOUT BITMAP + DPB C,[$CPKNB(A)] ;NEW BYTE COUNT + LSH T,-2 ;CONVERT BITMAP BYTE COUNT TO WORD COUNT + ADDI TT,3 ;CONVERT BYTE COUNT TO... + LSH TT,-2 ;... WORD COUNT + MOVEI D,%CPKDT(A) ;GET POINTER TO BEGINNING OF DATA + HRL D,D ;IN UPPER AND LOWER HALVES (ALMOST BLT POINTER) + HRLZ T,T ;BITMAP WORD COUNT,,0 + ADD D,T ;RFC-STRING,,DATA-FIELD + ADDI TT,%CPKDT-1(A) ;LAST LOCATION FOR BLT + BLT D,(TT) + SETZI TT, + DPB TT,[$CPKAN(A)] ;ZERO THE ACK FIELD + MOVE TT,MYCHAD + DPB TT,[$CPKDA(A)] ;PRETEND IT WAS FOR ME + JRST CHIRFC ;AND HANDLE IT AS AN RFC + + +;ROUTINE TO FIND INDEX PACKET CORRESPONDS TO, SKIP IF FOUND, INDEX IN I. +;ALSO RETURNS STATE IN E SINCE THAT'S OFTEN HANDY. +;ALSO SETS B FOR CHALOS +CHFNDX: MOVEI B,[ASCIZ/Connection does not exist at this end/] + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + POPJ P, ;NO MATCH + SKIPGE CHSSTA(I) .SEE %CFOFF + POPJ P, ;NOT TALKING TO NETWORK + HRRZ E,CHSSTA(I) + MOVE TT,%CPKD(A) + MOVE T,%CPKS(A) + CAIN E,%CSRFS ;IF IN RFC-SENT STATE, ONLY + AND T,[.BYTE 16. ? -1 ? 0] ;THE SOURCE HOST HAS TO MATCH + CAMN TT,CHSLCL(I) ;COMPARE LOCAL ADDRESS + CAME T,CHSFRN(I) ; AND FOREIGN ADDRESS + POPJ P, ;NO MATCH + MOVE T,TIME + MOVEM T,CHSITM(I) + JRST POPJ1 ;SUCCEED, CALLER CHECKS THE STATE + +;INTERRUPT LEVEL PROCESSING OF RECEIVED OPN PACKET +CHIOPN: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE OPENED + JRST CHALOS + CAIE E,%CSRFS ;NOT IN RFC-SENT STATE, + JRST CHABRT ; MUST BE DUPLICATE, DISCARD. + LDB B,[$CPKPN(A)] ;GET ITS PACKET NUMBER + HRLM B,CHSPKN(I) ;INITIALIZE PACKET NUMBERING OF RECEIVED MESSAGES + MOVE B,%CPKS(A) + MOVEM B,CHSFRN(I) ;HOOK 'EM UP + PUSHJ P,CHIST1 ;PROCESS AS A STS, DISCARD + PUSHJ P,CHASTO ;RESPOND WITH A STS + MOVEI W,%CSOPN + ;DROP INTO CHINT + +;COME HERE WITH INDEX IN I AND NEW STATE IN W, TO CHANGE STATE AND INTERRUPT +CHINT: HRRM W,CHSSTA(I) + MOVE T,TIME + MOVEM T,CHSITM(I) ;IN CASE GOT HERE FROM CHOLSN + MOVSI T,%CFOFF + CAIE W,%CSOPN + IORM T,CHSSTA(I) ;DISENGAGE PI LEVEL + CAIN W,%CSOPN + ANDCAM T,CHSSTA(I) ;NOW OPEN, ENGAGE PI LEVEL +;COME HERE TO INTERRUPT ON THE INPUT CHANNEL. SMASHES T,TT,W +CHINTI: LDB T,[$CHSUI,,CHSUSR(I)] +CHINT2: MOVE TT,CHSSTA(I) ;SIGNAL USER OR STY? + TLNN TT,%CFSTY + JRST CHINT4 ;USER + LDB T,[$CFTTN,,TT] ;STY, GET TTY NUMBER + CONO PI,PIOFF ;PROTECT LIST MODIFICATION + SKIPL STYNTL-NFSTTY(T) ;DON'T PUT ON LIST TWICE + JRST PIONJ + MOVE TT,STYNTA ;ADD TO LIST + MOVEM TT,STYNTL-NFSTTY(T) + MOVEM T,STYNTA + JRST PIONJ + +CHINT4: SKIPGE TT,CHSUSR(I) + JRST 4,. + MOVSI W,(SETZ) ;PCLSR THE JOB SO IT GETS AN IOC ERROR IF NEEDFUL + IORM W,PIRQC(TT) ;EVEN IF NORMAL INTERRUPTS ARE NOT ENABLED + CAIN T,77 + POPJ P, ;IOPUSH'D, NO INTERRUPT + MOVE T,CHNBIT(T) + AND T,MSKST2(TT) + IORM T,IFPIR(TT) + POPJ P, + +OVHMTR CHD + +;INTERRUPT LEVEL PROCESSING OF RECEIVED DATA PACKET +CHIDAT: PUSHJ P,CHFNDX ;FIND ASSOCIATED CONNECTION + JRST CHALOS ;NONE, LOSS + CAIE E,%CSOPN ;STATE MUST BE OPEN + JRST CHALOS ;BAD, LOSS + PUSHJ P,CHIACK ;PROCESS ACKNOWLEDGEMENT FIELD +;NOW DECIDE WHETHER IT GOES ON CHSIBF(I), OR ON CHSPBF(I), OR GETS DISCARDED. + HLRZ B,CHSPKN(I) ;LAST PACKET NUMBER GIVEN TO USER + LDB C,[$CPKPN(A)] ;GET PACKET NUMBER OF THE NEW PACKET + HLRZ T,CHSWIN(I) ;RECEIVE WINDOW SIZE + ADDI T,(B) ;HIGHEST LEGAL PACKET NUMBER + SUB T,C + TRNE T,100000 ;SKIP IF T >= C + JRST CHABRT ;FOO ON YOU, OVER WINDOW SIZE + HRRZ T,CHSIBF(I) ;COMPUTE NEXT IN-ORDER PACKET EXPECTED + JUMPE T,CHIDT6 ;BASED ON LAST IN-ORDER PACKET + LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + JRST [ LDB B,[$CPKPN(T)] + JRST CHIDT6 ] + HLRZ T,CHSIBF(I) ;IF IT'S AN UNC, HAVE TO GO FIND CORRECT PACKET +CHIDT5: LDB TT,[$CPKOP(T)] + CAIE TT,%COUNC + LDB B,[$CPKPN(T)] + HRRZ T,-2(T) + JUMPN T,CHIDT5 +CHIDT6: ADDI B,1 + ANDI B,177777 ;NEXT IN-ORDER PACKET EXPECTED + CAMN B,C + JRST CHIDT1 ;EQUAL, IT GOES ON THE END OF CHSIBF(I) LIST. + SUB B,C ;NOT EQUAL, COMPARE THEM MODULO 2^16. + TRNN B,100000 + JRST CHIDTD ;B GREATER, THIS IS AN OLD PACKET, DISCARD IT + ;PUT ON CHSPBF(I) IN PROPER ORDER + ;A IS THIS PACKET, C IS HIS NUMBER, B IS PREDECESSOR, D IS NEXT, E IS HIS # + MOVEI B,0 ;SIGNIFY AT FRONT OF LIST + HLRZ D,CHSPBF(I) ;GET FIRST PACKET ON OUT-OF-ORDER LIST + JUMPE D,CHIDT4 ;LIST IS EMPTY +CHIDT3: LDB E,[$CPKPN(D)] + SUB E,C ;COMPARE PACKET NUMBERS + JUMPE E,CHIDTD ;DUPLICATE, DISCARD + TRNE E,100000 + JRST [ MOVE B,D ;E IS LESS, KEEP LOOPING + HRRZ D,-2(B) + JUMPN D,CHIDT3 + JRST .+1 ] ;REACHED END PUT IT HERE + SKIPE B + HRRM A,-2(B) ;THREAD ONTO PREVIOUS PACKET + SKIPN D +CHIDT4: HRRM A,CHSPBF(I) ;THREAD ONTO BACK OF LIST + SKIPN B + HRLM A,CHSPBF(I) ;THREAD ONTO FRONT OF LIST + HRRM D,-2(A) ;THREAD IN BEFORE PACKET IN D + MOVSI B,1 + ADDM B,CHSNBF(I) + POPJ P, + +;HERE IT GOES ON CHSIBF(I). A HAS PACKET, C HAS ITS PACKET NUMBER. +;IF GETTING HERE FROM CHICL1, C HAS GARBAGE BUT IT WILL NEVER BE USED. +CHIDT1: SKIPN CHSIBF(I) + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQPL ;PUT ON END OF RECEIVE LIST + HLRZ A,CHSPBF(I) ;GET FIRST OUT-OF-ORDER PACKET + JUMPE A,CPOPJ ;NONE + LDB B,[$CPKPN(A)] ;SEE IF THIS PACKET IS NOW IN-ORDER + CAIL C,177777 ;BY COMPARING AGAINST C+1 MODULO 2^16. + TDZA C,C + ADDI C,1 + CAME B,C + POPJ P, ;NO + MOVEI Q,CHSPBF(I) + PUSHJ P,CHAQGF ;YES, PULL PACKET OF OUT-OF-ORDER LIST + MOVSI B,-1 + ADDM B,CHSNBF(I) + JRST CHIDT1 ;AND GO PUT ONTO IN-ORDER LIST + +;HERE IF PACKET IS A DUPLICATE AND IS TO BE DISCARDED. MUST SEND +;RECEIPT TO SHUT OFF EXCESS RETRANSMISSION. +CHIDTD: PUSHJ P,CHABRT + AOS CHNPD + JRST CHASTO + +;HERE FOR RECEIVING AN UNC PACKET +CHIUNC: LDB I,[$CPKDI(A)] ;Destination index zero? + JUMPE I,CHIUN2 + LDB I,[$CPKDX(A)] ;GET REAL-INDEX PART OF DESTINATION INDEX + CAIGE I,NINDX + SKIPGE CHSUSR(I) + JRST CHALOS ;NO MATCH + MOVE TT,%CPKD(A) ;DESTINATION ADDRESS MATCHES? + CAME TT,CHSLCL(I) + JRST CHALOS + HRRZ E,CHSSTA(I) ;IN FOREIGN PROTOCOL MODE? + CAIN E,%CSFRN + JRST CHIUN1 + MOVE TT,%CPKS(A) ;NORMAL PROTOCOL, SOURCE ADDRESS MUST MATCH + CAMN TT,CHSFRN(I) + CAIE E,%CSOPN ;AND STATE MUST BE OPEN + JRST CHALOS +CHIUN1: MOVE TT,TIME + MOVEM TT,CHSITM(I) + SKIPE T,CHSIBF(I) ;DISCARD PACKET IF OVER WINDOW SIZE + JRST [ LDB TT,[$CPKOP(T)] ; AND ALREADY HAVE AN UNC + HRRZ T,CHSNBF(I) + HLRZ Q,CHSWIN(I) + CAML T,Q + CAIE TT,%COUNC + JRST .+2 + JRST CHABRT ] + PUSHJ P,CHINTI ;THERE WAS NO INPUT, BUT THERE IS NOW, COME AND GET IT + AOS CHSNBF(I) ;PUT ON END OF RECEIVE LIST. + MOVEI Q,CHSIBF(I) ;PACKET NUMBER IS RANDOM, NOTHING LOOKS AT IT + JRST CHAQPL + +CHIUN2: +IFE INETP,JRST CHALOS ;No comprendo internet +IFN INETP,[ + LDB I,[$CPKAN(A)] ;Protocol number + CAIE I,8_8 ;DOD Internet #x0800 + JRST CHALOS + AOS CHNIPI ;Meter Internet packets in from Chaosnet + MOVE J,A ;Save Chaosnet packet + LDB A,[$CPKNB(A)] ;Compute size of Internet datagram in words + ADDI A,3 + LSH A,-2 + MOVE C,A ;Save word count + CALL IPGIPT ;Get buffer to copy datagram into + JRST CHIUN3 ;No buffers available, discard packet + MOVSI T,%CPKDT(J) ;Make BLT pointer + HRRI T,1(B) + ADDI B,(C) ;Address of last destination word + BLT T,(B) + EXCH A,J ;Free the Chaosnet packet + CALL CHABRT + MOVE A,J ;Datagram structure + MOVE B,C ;Word count + MOVEI C,0 ;Offset to start of IP header + CALRET IPRDGM ;Dispose of datagram + +CHIUN3: MOVE A,J ;Discard Chaosnet packet + CALRET CHABRT +];INETP + +OVHMTR CHJ + +;INTERRUPT LEVEL PROCESSING OF LOS +CHILOS: PUSHJ P,CHFNDX ;FIND CONNECTION TO BE BROKEN + JRST CHABRT ;NONE, IGNORE + MOVEI W,%CSLOS ;PUT INTO LOST STATE + JRST CHICL2 ;GIVE PACKET TO USER AS DATA, DISENGAGE, AND INTERRUPT + +;INTERRUPT LEVEL PROCESSING OF STS +CHISTS: PUSHJ P,CHFNDX + JRST CHALOS + CAIE E,%CSOPN ;CONNECTION MUST BE OPEN + JRST CHALOS +CHIST1: LDB B,[042000,,%CPKDT(A)] ;GET NEW WINDOW SIZE + CAILE B,MXWIND + MOVEI B,MXWIND + HRRM B,CHSWIN(I) + LDB B,[242000,,%CPKDT(A)] ;PROCESS RECEIPT + PUSHJ P,CHIAK0 + PUSHJ P,CHABRT + JRST CHARTR ;RETRANSMIT + +OVHMTR CHA + +;INTERRUPT LEVEL PROCESSING OF RECEIVED ACKNOWLEDGEMENT. +;REMOVE THE ACKNOWLEDGED PACKETS FROM THE INDEX'S SEND LIST AND UPDATE CHSNOS(I). +;NOTE THAT THE LIST IS ASSUMED TO BE SORTED SO WE ONLY +;REMOVE PACKETS FROM THE FRONT. CLOBBERS B,C,D,T,TT,Q. +CHIACK: LDB B,[$CPKAN(A)] ;PACKET NUMBER BEING RECEIPTED +CHIAK0: LDB T,[$CPKAN(A)] ;ENTER HERE FROM CHISTS + HRRZ D,CHSACK(I) ;GET MAX OF THIS ACKNOWLEDGE AND PREVIOUS + SUB D,T + TRNE D,100000 + HRRM T,CHSACK(I) ;ACKNOWLEDGED PACKET NUMBER IS NEW START OF WINDOW + PUSH P,A + HLRZ A,CHSOBF(I) ;MAP DOWN SEND LIST + JUMPE A,CHIAK2 ;LIST EMPTY +CHIAK1: LDB D,[$CPKPN(A)] + SUBM B,D + TRNE D,100000 + JRST CHIAK2 ;RCP# LESS THAN PKT# + HRRZ C,-2(A) ;GET NEXT PACKET + HLLOS D,-2(A) ;MARK NOT ON SEND LIST + AOJE D,CHIAK3 ;AND JUMP IF NOT ON TRANSMIT LIST +IFN DLCP,[ + MOVEI Q,DLCXMQ ;ON TRANSMIT LIST, TRY TO TAKE OFF + PUSHJ P,CHIAKF +];DLCP +IFN T11CHP,[ + MOVEI Q,T11XMQ + PUSHJ P,CHIAKF +];T11CHP +IFN CH10P+CH11P,[ + MOVEI Q,CHXXMQ + PUSHJ P,CHIAKF +];CH10P+CH11P + CAIA ;AND DON'T FREE IT +CHIAK3: PUSHJ P,CHABRT + HRLM C,CHSOBF(I) + SKIPE A,C + JRST CHIAK1 + SETZM CHSOBF(I) ;SEND LIST NOW EMPTY +CHIAK2: MOVE D,CHSNOS(I) ;COMPUTE NEW VALUE OF CHSNOS + HRRZ T,CHSACK(I) ;START OF WINDOW + HRRZ C,CHSPKN(I) ;LAST PACKET SENT + SUB T,C + SKIPLE T + SUBI T,200000 ;T GETS NEGATIVE AMOUNT OF WINDOW OCCUPIED + ADD T,CHSWIN(I) ;RH(T) GETS AVAILABLE PORTION OF WINDOW + HRREM T,CHSNOS(I) ;WHICH IS NUMBER OF OUTPUT SLOTS + JUMPG D,POPAJ ;IF FORMERLY THERE WERE NO OUTPUT SLOTS, + LDB T,[$CHSUO,,CHSUSR(I)] + SKIPLE CHSNOS(I) ;AND NOW THERE ARE, + PUSHJ P,CHINT2 ;INTERRUPT ON THE OUTPUT CHANNEL + JRST POPAJ + +;TRY TO TAKE PACKET IN A OFF OF TRANSMIT LIST IN Q. +;CLOBBER T,Q,D. CALLED WITH INTERRUPTS OFF. +;MAY RETURN WITH A POINTING TO FREE BUT THAT IS OK AT THIS TIME. +CHIKF1: SKIPA D,T +CHIAKF: MOVEI D,2(Q) ;LH[-2(D)] POINTS TO (T) + HLRZ T,-2(D) + JUMPE T,CPOPJ ;NOT FOUND + CAIE T,(A) + JRST CHIKF1 + HLRZ T,-2(A) ;LINK OUT + HRLM T,-2(D) + JUMPN T,CHABRT ;JUMP IF DIDN'T DELETE LAST PACKET IN LIST + HRRM D,(Q) ;NEW LAST PACKET IN LIST + CAIN D,2(Q) + SETZM (Q) ;FOO, TRANSMIT LIST NOW EMPTY + JRST CHABRT + +SUBTTL CHAOS NET DL10 INTERRUPT ROUTINE + +OVHMTR CHH + +IFN DLCP,[ + +;COME HERE FROM EACH DL10 INTERRUPT AT TTY LEVEL. SMASH ALL REGISTERS EXCEPT P AND 0. +DLCWAK: CONI PI,E ;SAVE PI STATUS AND SWITCH TO NETWORK INTERRUPT LEVEL + ANDI E,177 + PUSH P,E + CONO PI,NETOFF +DLCWK1: MOVEI J,1 ;ALWAYS CHECK BOTH BUFFERS SO WE CAN'T GET OUT OF PHASE WITH 11 + MOVEI R,2 ;CHECK FOR INPUT AVAILABLE + CAME R,DLCRS1(J) + SOJGE J,.-1 + JUMPL J,DLCWK2 + MOVE A,DLCRA1(J) ;GOT INPUT, PROCESS IT + SETZM DLCRS1(J) ;BUFFER SLOT NOT OCCUPIED NOW +IFN KS10P, CLRCSH +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE IN CASE ANYONE HAPPENED TO TOUCH BUFFER + SKIPE A ;THIS CAN HAPPEN IF PDP11 WAS JUST STUFFED + PUSHJ P,CHAPII ;PROCESS THE PACKET + PUSHJ P,DLCIBG ;SUPPLY A NEW INPUT BUFFER TO 11 + JRST DLCWK1 ;TRY FOR MORE INPUT + +DLCWK2: MOVEI J,1 ;SCAN CHANNELS FOR OUTPUT DONE + CAME R,DLCSS1(J) +DLCWK3: SOJGE J,.-1 + JUMPL J,DLCWK4 + MOVE A,DLCSA1(J) ;FOUND AN OUTPUT DONE BUFFER + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE + SETZM DLCSA1(J) ;IDLE THIS BUFFER + SETZM DLCSS1(J) + JRST DLCWK3 + +DLCWK4: MOVE J,DLCSBF ;TRY TO SEND SOME OUTPUT + SKIPE DLCSS1(J) + JRST DLCWK9 ;BUFFER BUSY + HLRZ A,DLCXMQ ;GET ANOTHER OFF TRANSMIT QUEUE + JUMPE A,DLCWK9 ;QUEUE EMPTY + HLRZ T,-2(A) +IFN FTRCHK,[ + CAIN T,-1 + BUG PAUSE,[CHAOS LIST THREAD TRASHED],OCT,A,OCT,-2(A) +];FTRCHK + HRLM T,DLCXMQ +IFN FTRCHK,[ + JUMPN T,.+4 + CAME A,DLCXMQ ;REACHED END OF LIST, END IN RIGHT PLACE? + BUG PAUSE,[DCLXMQ THREAD TRASHED] + SETZM DLCXMQ +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM DLCXMQ +];FTRCHK + PUSHJ P,DLCXMT ;SEND IT ON THIS BUFFER + JRST DLCWK4 ;GO TRY TO SEND ON OTHER BUFFER + +DLCWK9: POP P,E + CONO PI,PICON(E) ;RESTORE PI + POPJ P, + +;THIS ROUTINE SUPPLIES AN INPUT BUFFER TO THE 11 ON ALL BUFFERS THAT NEED IT +;CALL WITH INTERRUPTS OFF OR IN PROGRESS +DLCIBG: MOVEI J,1 + SKIPE DLCRS1(J) +DLCIB1: SOJGE J,.-1 + JUMPL J,CPOPJ + PUSHJ P,CHABGI ;GET A BUFFER + JRST [ SETZM DLCRA1(J) ;NO MEMORY, WILL TRY AGAIN AT CLOCK LEVEL + SETZM DLCRS1(J) + POPJ P, ] + SETZM (A) ;CLEAR THE BUFFER SINCE THE DL10 DOESN'T TOUCH LOW 4 BITS + HRLZ T,A + HRRI T,1(A) + BLT T,%CPMXW-1(A) + MOVEM A,DLCRA1(J) ;MAKE AVAILABLE TO PDP11 + HRLI A,120000 + MOVEM A,DLCRP1(J) + SOS DLCRP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE BEFORE SIGNALLING 11 + MOVEI T,1 + MOVEM T,DLCRS1(J) + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + JRST DLCIB1 ;TRY FOR OTHER BUFFER ALSO + +;THIS ROUTINE SENDS PACKET IN A TO DL10 (CALL WITH NETOFF OR IN PROGRESS) +;SWITCHES BUFFERS, LEAVES NEW ONE IN J +DLCXMT: MOVE J,DLCSBF + MOVEM A,DLCSA1(J) + HRLI A,120000 + MOVEM A,DLCSP1(J) ;GIVE 11 POINTER TO NEW PACKET + SOS DLCSP1(J) +IFN KS10P, .ERR CLRCSH not needed here? +IFN KL10P, PUSHJ P,DLCSWP ;SWEEP CACHE, PUTTING PACKET INTO CORE + MOVEI T,1 + MOVEM T,DLCSS1(J) ;ACTIVATE PDP11 + CONO DLC,100040+TTYCHN + XORI J,1 ;NEXT BUFFER + MOVEM J,DLCSBF + POPJ P, + +IFN KL10P,[ +;THIS ROUTINE SWEEPS PACKET IN A OUT OF THE CACHE, +;CLOBBERING B, C, AND D. +IFG PKTBSZ-1000, .ERR PKTBSZ BIGGER THAN HARDWARE PAGE SIZE, CACHE SWEEP LOSES +DLCSWP: LDB D,[111100,,A] ;SWEEP ONE PAGE OF CACHE + SWPUO (D) ;STORING PACKET INTO CORE + MOVE B,[CONSZ 200000] ;AWAIT COMPLETION IN ACS + MOVE C,[JRST B] ;TO MINIMIZE CACHE INTERFERENCE + MOVSI D,(POPJ P,) + JRST B +];KL10P +];DLCP + +SUBTTL CHAOS NET TEN-11 INTERFACE STUFF + +IFN T11CHP,[ +;THIS ROUTINE CHECKS FOR TEN-11 INITIALIZATION, SKIP-RETURNS IF OK TO USE +;CLOBBERS T,TT +T11CHK: SKIPE TEN11F + JRST T11LUZ ;NOT SUPPOSED TO USE TEN11 + MOVE T,T11VER ;CHECK VERSION TO MAKE SURE RIGHT PROGRAM, ETC. + CAME T,[.BYTE 8 ? "H ? "C ? 0 ? 1] + JRST T11LUZ ;PROBABLY TURNED OFF OR WRONG PROGRAM + SKIPE T11I10 ;SHOULD WE REINIT? + JRST T11CK1 ;YES, GO DO SO + SKIPLE T,T11WIN ;ARE WE WINNING? + JRST POPJ1 ;YES, FINE + JUMPE T,[SETOM T11WIN ;NOW THAT VERSION IS OK, TELL 11 TO INIT + MOVSI T,-1 + MOVEM T,T11I11 + JRST T11CK1 ] ;AND INIT OURSELVES + SKIPE T11I11 ;WAITING FOR 11 TO REINIT? + POPJ P, ;YES, WAIT +;HERE TO REINIT. FIRST, PICK UP PARAMETERS. +T11CK1: LDB TT,[242000,,T11PRM] ;BYTES PER PACKET BUFFER + CAIGE TT,<%CPMXW+1>*4 ;BETTER BE RIGHT SIZE + JRST T11LUZ ;TOO SMALL (ASSUME IF TOO BIG, PACKETS WON'T BE) + LSH TT,-2 + MOVEM TT,T11BSZ ;SAVE BUFFER SIZE IN PDP10 WORDS + LDB T,[042000,,T11PRM] ;NUMBER OF BUFFERS IN EACH DIRECTION + IMULB T,TT ;NUMBER OF PDP10 WORDS IN EACH DIRECTION + ADD TT,T11IBB + MOVEM TT,T11IBE ;INIT POINTERS + MOVEM TT,T11OBB + MOVEM TT,T11OBP + ADD TT,T + MOVEM TT,T11OBE + HRREI T,-T11CHS-2000(TT) + JUMPG T,T11LUZ ;COMMUNICATION AREA LONGER THAN 1K + MOVE T,T11IBB + MOVEM T,T11IBP +T11CK2: SETZM (T) ;CLEAR BUFFER HEADERS + ADD T,T11BSZ + CAMGE T,TT + JRST T11CK2 + MOVEM T,T11WIN ;WE'RE WINNING (MAKE T11WIN POSITIVE NON-ZERO) + SETZM T11I10 ;INIT DONE + JRST POPJ1 + +;HERE IF PDP11 PARAMETERS DON'T MATCH WHAT WE EXPECT +T11LUZ: SETZM T11WIN ;NOT WINNING + POPJ P, + +;HERE FROM CLOCK LEVEL TO CHECK ON TEN-11 CHAOS NET CHANNEL +T11WAK: PUSHJ P,T11CHK ;IS EVERYTHING OK? + POPJ P, ;NO. +T11WK0: MOVE C,T11IBP ;CHECK INPUT + SKIPN (C) + JRST T11WK1 ;NONE AVAILABLE + MOVSI J,2(C) ;POINT TO PACKET + LDB D,[$CPKNB+2(C)] ;GET SIZE OF PACKET + ADDI D,4*%CPKDT+3 ;CONVERT BYTES TO WORDS INCLUDING HEADER + LSH D,-2 + CAILE D,%CPMXW ;DON'T GET FAKED OUT BY CLOBBERED COUNT + MOVEI D,%CPMXW + PUSHJ P,CHABGI ;GET PLACE TO PUT IT + JRST T11WK1 ;NONE AVAILABLE + HRLOI E,-1(D) + EQVI E,(A) ;AOBJN POINTER TO PACKET BUFFER + HRRI J,(A) ;BLT POINTER TO COPY PACKET + ADDI D,-1(A) ;LAST WORD + BLT J,(D) ;COPY PACKET FROM 11 TO 10 + MOVEI H,0 ;COMPUTE CHECKSUM +T11WK4: ADD H,(E) + LSH H,-1 + TRZE H,10 + TLO H,(SETZ) + AOBJN E,T11WK4 + MOVE TT,1(C) ;GET PDP11'S CHECKSUM + SETZM (C) ;GIVE THE 11 BACK THE BUFFER + ADD C,T11BSZ ;ADVANCE THE POINTER + CAML C,T11IBE + MOVE C,T11IBB + MOVEM C,T11IBP + CAME H,TT + JRST [ AOS T11CKE ;COUNT CHECKSUM ERRORS + PUSHJ P,CHABRT ;AND DISCARD PACKET + JRST T11WK0 ] + CONO PI,NETOFF + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON + JRST T11WK0 + +T11WK1: CONO PI,NETOFF + SKIPE T11XMQ ;ANY OUTPUT? + SKIPE @T11OBP ;AND OUTPUT BUFFER SPACE AVAILABLE? + JRST NETONJ ;NO, RETURN FROM T11WAK + HLRZ A,T11XMQ ;GET PACKET OFF TRANSMIT QUEUE + HLRZ B,-2(A) ;GET NEXT AFTER THAT + HRLM B,T11XMQ ;BECOMES NEW HEAD OF QUEUE + SKIPN B + SETZM T11XMQ + PUSHJ P,T11XMT ;COPY PACKET INTO 11 + CONO PI,NETON + JRST T11WK1 ;LOOK FOR MORE OUTPUT + +;SEND PACKET A-> TO 11. SMASHES B,C,T,TT,Q. CALL WITH NETOFF. +T11XMT: LDB C,[$CPKNB(A)] ;GET BYTE COUNT + MOVE Q,C ;MUST CLEAR UNUSED BYTES AT END OF LAST WORD + ANDI Q,3 ;TO MAKE THE CHECKSUM COME OUT RIGHT + ADDI C,4*%CPKDT+3 + LSH C,-2 ;CONVERT TO WORD COUNT + MOVE Q,(Q)[ -1 ;MASK FOR BYTES TO RETAIN IN LAST WORD + <.BYTE 8 ? -1> + <.BYTE 8 ? -1 ? -1> + <.BYTE 8 ? -1 ? -1 ? -1> ] + MOVEI TT,-1(C) + ADD TT,A + ANDM Q,(TT) ;MASK OFF LAST WORD + HRLOI C,-1(C) + EQVI C,(A) ;AOBJN PTR + MOVEI TT,0 ;COMPUTE XOR CHECKSUM IN TT + SKIPA B,T11OBP ;-> CURRENT OUTPUT BUFFER IN 11 +T11XM1: ADDI B,1 + MOVE T,(C) + TRZ T,17 ;CLEAR BITS 10-11 TREATS SPECIALLY + ADD TT,T ;COMPUTE CHECKSUM + LSH TT,-1 + TRZE TT,10 + TLO TT,(SETZ) + MOVEM T,2(B) + AOBJN C,T11XM1 + MOVE B,T11OBP + MOVEM TT,1(B) ;GIVE CHECKSUM TO 11 + MOVSI TT,-1 + MOVEM TT,0(B) ;GIVE PACKET TO 11 + ADD B,T11BSZ ;ADVANCE BUFFER POINTER + CAML B,T11OBE + MOVE B,T11OBB + MOVEM B,T11OBP + HRROS T,-2(A) ;TAKE PACKET OFF TRANSMIT LIST + AOJN T,.+2 + PUSHJ P,CHABRT ;NOT ON SEND LIST, FREE IT + POPJ P, +];T11CHP + +SUBTTL CH-10 INTERRUPT ROUTINES + +;THE GENERAL IDEA IS THAT WE INTERRUPT ON A LOW-PRIORITY INTERRUPT LEVEL, +;AND DO THE TIME-INTENSIVE PACKET COPYING AT THAT LEVEL. THE GENERAL +;CHAOS ROUTINES ARE THEN CALLED WITH NETOFF. + +IFN CH10P,[ + +EBLK + +CHXACS: BLOCK 20 +CHXPDL: -60,,. + BLOCK 60 + +CHXBRK: 0 +BBLK + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + CONSO CHX,CHXRCV ;PACKET RECEIVED? + JRST CHXBK5 + PUSHJ P,CHABGI ;GET PLACE TO PUT PACKET + JRST [ MOVEI T,CHXREN ;NONE AVAILABLE, DISABLE INTR + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + JRST CHXBK5 ] + CONSZ CHX,CHXCRC+CHXWLE ;CHECK FOR ERRORS + JRST [ CONSZ CHX,CHXCRC + AOSA CHNCRC + AOS CHNWLE + JRST CHXBK4 ] ;IGNORE PACKET + DATAI CHX,T ;FIRST DATAI YIELDS GARBAGE + MOVEI T,CHXSWB ;DISABLE BYTE SWAPPING + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;READ HEADER + DATAI CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + CAILE T,%CPMXC ;DON'T RUN OFF END OF BUFFER + JRST CHXBK4 + ADDI T,3 ;ROUND UP TO NEXT WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, TT GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAI CHX,(D) + AOBJN D,.-1 + DATAI CHX,T ;NOW READ AND IGNORE HARDWARE HEADER + TLNE T+1,400000 + DATAI CHX,T ;THIRD HALFWORD + CONI CHX,T ;CHECK FOR ERRORS + TDNE T,[CHXPLE+CHXCRC+CHXOVR] + JRST [ TLNE T,(CHXOVR) + JRST CHXBKZ ;OVERRRUN CAN'T HAPPEN UNLESS HARDWARE BROKEN + TLNE T,(CHXPLE) + AOSA CHNPLE + TRNN T,CHXCRC + JRST CHXBK4 + AOS CHNCR2 + JRST CHXBK4 ] + CONO PI,NETOFF-1 + PUSHJ P,CHAPII ;PROCESS THE INPUT + CONO PI,NETON-1 + CAIA +CHXBK4: PUSHJ P,CHABRT ;DIDN'T USE BUFFER AFTER ALL + CONI CHX,T ;COUNT LOST PACKETS + LDB T,[$CHXLC,,T] + ADDM T,CHNLOS + MOVEI T,CHXREN ;ENABLE RECEIVER FOR NEXT PACKET + IORB T,CHXCNO + CONO CHX,CHXRCV(T) +CHXBK5: CONSO CHX,CHXXMT ;TRANSMIT DONE? + JRST CHXBK9 + SKIPE T,CHOSTA ;TRANSMIT IN PROGRESS? + CONSO CHX,CHXABT ;AND WAS ABORTED? + JRST CHXBK7 ;NO TO EITHER, LOOK FOR MORE WORK + AOS CHNABT ;METER TRANSMIT ABORTS + CAIL T,NCHRTR ;ABORTED TOO MANY TIMES? + JRST CHXBK7 ;DONE WITH PACKET + AOS CHOSTA ;COUNT RETRANSMISSIONS + MOVEI T,CHXTEN + IORB T,CHXCNO + CONO CHX,CHXXMT(T) ;RETRANSMIT PACKET + JRST CHXBK9 + +CHXBK7: SETZM CHOSTA ;TRANSMITTER IDLE, LOOK FOR NEXT PACKET + CONO PI,PIOFF + HLRZ A,CHXXMQ ;ANYTHING QUEUED FOR TRANSMISSION? + JUMPE A,[ MOVEI T,CHXTEN ;DISABLE INTERRUPTS + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + CONO PI,PION + JRST CHXBK9 ] + HLRZ B,-2(A) ;CDR TRANSMIT QUEUE + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;QUEUE EMPTY NOW + CONO PI,PION + AOS CHOSTA ;NOW SEND THIS PACKET + MOVEI T,CHXHLF+CHXSWB ;CLEAR HALFWORD, BYTE-SWAP MODES + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + HRLI A,-%CPKDT ;TRANSMIT HEADER + DATAO CHX,(A) + AOBJN A,.-1 + HRRZI A,-%CPKDT(A) + PUSHJ P,CHSWAB ;ENABLE BYTE SWAPPING IF NEEDED + LDB T,[$CPKNB(A)] ;GET SIZE OF PACKET + ADDI T,1 ;ROUND UP TO NEXT HALF WORD BOUNDARY + LSHC T,-2 ;CONVERT BYTES TO WORDS, T+1 GETS REMAINDER + HRLOI D,-1(T) ;MAKE AOBJN POINTER + EQVI D,%CPKDT(A) + JUMPGE D,.+3 ;EMPTY PACKET BOUNDARY CASE + DATAO CHX,(D) + AOBJN D,.-1 + MOVEI T,CHXHLF+CHXTEN ;SWITCH TO HALFWORD MODE, ENABLE DONE INTR + IORM T,CHXCNO + CONO CHX,@CHXCNO + TLNE T+1,400000 ;SEND EXTRA HALFWORD IF NEEDED + DATAO CHX,(D) + MOVEI T,CHXSWB ;DISABLE SWAP BYTES MODE + ANDCAM T,CHXCNO + CONO CHX,@CHXCNO + LDB T,[$CPKDN(A)] ;GET DESTINATION SUBNET + HRRZ D,SBNRUT(T) ;GATEWAY TO THAT SUBNET + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;IF ON LOCAL CABLE + LDB D,[$CPKDA(A)] ;GO DIRECT + LSH D,16.+4 + DATAO CHX,D ;STORE HARDWARE DESTINATION ADDRESS + MOVE T,CHXCNO ;TRANSMIT PACKET + CONO CHX,CHXXMT(T) + CONI CHX,T + TLNE T,(CHXOVR) ;CAN'T HAPPEN UNLESS HARDWARE BROKEN +CHXBKZ: BUG HALT,[CHAOS: I/O BUS OVERRUN] + HRROS B,-2(A) ;MARK IT NOT ON TRANSMIT LIST + AOJN B,.+2 ;AND UNLESS IT IS ON SEND LIST + PUSHJ P,CHABRT ;RETURN IT TO FREE +CHXBK9: MOVSI 17,CHXACS ;DISMISS INTERRUPT + BLT 17,17 + JRST 12,@CHXBRK + +CHSWAB: LDB T,[$CPKOP(A)] ;DOES THIS PACKET NEED BYTE SWAPPING? + TRNE T,200 + JRST [ TRNE T,100 + POPJ P, ;BINARY DATA + JRST CHSWB1 ] ;CHARACTER DATA + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;BINARY CONTROL PACKET +CHSWB1: MOVEI T,CHXSWB ;CHARACTER, SWAP DEM BYTES + IORM T,CHXCNO + CONO CHX,@CHXCNO + POPJ P, + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH10P + +SUBTTL CH-11 INTERRUPT ROUTINES + +;The Unibus Chaosnet board interrupts on the same level as TTYs, +;and comes to CHXBKH via vectored interrupt. We use a programmed +;interrupt request to drop down to a lower interrupt level for the +;slow packet-copying operation, so as not to interfere with the TTYs, +;then turn NETOFF when we call into the Chaosnet NCP. +;(We actually use NETOFF-1 and NETON-1 so as not to interfere with +;CLKOFF. This assumes that interrupt levels between CLKCHN and +;CHXCHN are never turned off.) + +IFN CH11P,[ + +;;; Macros that will eventually be instructions + +DEFINE PACK16 AC,E ;AC,AC+1 right-aligned and zero-filled + LSH AC,16. + IOR AC,AC+1 + LSH AC,4 + MOVEM AC,E +TERMIN + +DEFINE PACK8 AC,E ;AC: ...B2B1 AC+1: ...B4B3 zero-filled!! + ROTC AC,-8 ;B3...B2 B1...B4 + ROT AC,-16. ;B1,B2,B3 in position, B4 right-aligned + ADDI AC+1,(AC+1) ;Shift RH(AC+1) left 4 bits + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) + ADDI AC+1,(AC+1) ;B1,B4 in position in AC+1 + IOR AC,AC+1 + MOVEM AC,E +TERMIN + +DEFINE UNPK16 AC,E ;Doesn't bother masking off garbage bits + MOVE AC,E + MOVE AC+1,AC + ROT AC,16. ;First halfword right-aligned + LSH AC+1,-4 ;Second halfword right-aligned +TERMIN + +DEFINE UNPK8 AC,E + MOVE AC,E ;B1B2B3B4... + ROT AC,8 ;B2B3B4...B1 + MOVE AC+1,AC + AND AC,[377_2,,377] ;...B3...B1 zero-filled + ROT AC+1,16. ;B4...B1B2B3 + AND AC+1,[377_12,,377_8];B4...B2... zero-filled + IORB AC,AC+1 ;B4B3...B2B1 + ROT AC+1,16. ;...B4B3, garbage in high bits +TERMIN + +EBLK + +CHXACS: BLOCK 20 +CHXSVH: 0 +CHXPDL: -60,,. + BLOCK 60 + +CHXBKH: 0 ;Hardware interrupt on TTYCHN comes here +BBLK + CONO PI,CHXRQ ;Redirect to lower interrupt level + MOVEM T,CHXSVH ;Clear hardware interrupt enable + MOVEI T,%CAREN+%CATEN ; so the Chaos board will stop interrupting + ANDCAB T,CHXCSR + IOWRI T,CAICSR + MOVE T,CHXSVH + JRST 12,@CHXBKH +EBLK + +CHXBRK: 0 ;Software interrupt on CHXCHN comes here +BBLK + CONO PI,020000+200_<-CHXCHN> ;BAG-BITING DEC LOSERS + MOVEM 17,CHXACS+17 + MOVEI 17,CHXACS + BLT 17,CHXACS+16 + MOVE P,CHXPDL + IORDI T,CAICSR ;Check for received packet + TRNN T,%CARDN + JRST CHXBK3 ;No incoming packet yet + TRNE T,%CAERR ;Check for error in received packet + JRST [ AOS CHNCRC + JRST CHXBK1 ] ;Ignore packet + IORDI R,CAIRBC ;Number of bits in packet - 1 + SUBI R,31. ;Exclude the three extra hardware words + TRNE R,17 + JRST [ AOS CHNWLE ;Length not a multiple of 16 + JRST CHXBK1 ] + ASH R,-5 ;32-bit word count, rounded up + PUSHJ P,CHABGI ;Get place to put packet + JRST [ AOS CHNLOS ;No buffers, lose this packet + JRST CHXBK1 ] + HRLI A,-%CPKDT ;Copy out the packet header +CHSRC1: IORDI B,CAIRBF + IORDI C,CAIRBF + PACK16 B,(A) + AOBJN A,CHSRC1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHSRC4 ;No byte swapping + JUMPGE D,CHSRC3 +CHSRC2: IORDI B,CAIRBF ;Read out the data, byte-swapped + IORDI C,CAIRBF + PACK8 B,(D) + AOBJN D,CHSRC2 +CHSRC3: JUMPGE H,CHSRC7 ;Jump if even packet length + IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK8 B,(D) + AOJA D,CHSRC7 + +CHSRC4: JUMPGE D,CHSRC6 +CHSRC5: IORDI B,CAIRBF ;Read out the data, halfwords + IORDI C,CAIRBF + PACK16 B,(D) + AOBJN D,CHSRC5 +CHSRC6: JUMPL H,[ IORDI B,CAIRBF ;Residual halfword + SETZ C, ;Somebody depends on zero here + PACK16 B,(D) + AOJA D,CHSRC7 ] +CHSRC7: SUB D,R ;AOBJN pointer minus number of words in packet + CAIE A,(D) + JRST [ AOS CHNPLE ;Packet length disagrees with hardware length + JRST CHXBK2 ] + IORDI T,CAIRBF ;Read the three hardware header words + IORDI T,CAIRBF + IORDI T,CAIRBF + IORDI T,CAICSR + TRNE T,%CAERR ;Make sure packet came out of RAM okay + JRST [ AOS CHNCR2 ;Garbage, try again + JRST CHXBK2 ] + IORDI T,CAIRBC ;Make sure counter didn't spazz + CAIE T,7777 + JRST [ AOS CHNSPZ + JRST CHXBK2 ] + CONO PI,NETOFF-1 ;Get to network interrupt level + PUSHJ P,CHAPII ;Process the input + CONO PI,NETON-1 +CHXBK1: IORDI T,CAICSR ;Count lost packets + LDB TT,[$CALOS,,T] + ADDM TT,CHNLOS + MOVE TT,CHXCSR + IORI TT,%CARCL ;Enable receiver for next packet + IOWRI TT,CAICSR +CHXBK3: TRNN T,%CATDN ;Transmit done? + JRST CHXBK8 ;No, dismiss + SKIPN TT,CHOSTA ;Transmit in progress? + JRST CHXBK7 ;No, look for something to transmit + TRNN T,%CATAB ;Yes, was it aborted? + JRST CHXBK5 ;No, we're done with that packet + AOS CHNABT ;Meter transmit aborts + CAIGE TT,NCHRTR ;Aborted too many times? + JRST CHXBK7 ;No, retransmit it +CHXBK5: CONO PI,PIOFF ;Lock transmit list + HLRZ A,CHXXMQ ;Get packet probably being transmitted now + JUMPE A,[ CONO PI,PION ;It vanished? + JRST CHXBK6 ] + HLRZ B,-2(A) ;CDR transmit queue + HRLM B,CHXXMQ + SKIPN B + SETZM CHXXMQ ;Queue empty now + CONO PI,PION + HRROS B,-2(A) ;Mark it not on transmit list + AOJN B,CHXBK6 ;And unless it is on send list + PUSHJ P,CHABRT ;Return it to free +CHXBK6: SETZM CHOSTA ;Transmitter idle, look for next packet +CHXBK7: HLRZ A,CHXXMQ ;Anything queued for transmission? + JUMPE A,CHXBK9 ;No, leave interrupts disabled + AOS CHOSTA ;Count retransmissions + MOVE T,CHXCSR ;Reset transmitter + IORI T,%CATDN + IOWRI T,CAICSR + HRLI A,-%CPKDT ;Transmit header +CHXXM1: UNPK16 B,(A) + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN A,CHXXM1 + PUSHJ P,CHSHDR ;Decode the header + JRST CHXXM4 ;No byte swapping + JUMPGE D,CHXXM3 +CHXXM2: UNPK8 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM2 +CHXXM3: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK8 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF + JRST CHXXM7 + +CHXXM4: JUMPGE D,CHXXM6 +CHXXM5: UNPK16 B,(D) ;Transmit data with byte swapping + IOWRI B,CAIWBF + IOWRI C,CAIWBF + AOBJN D,CHXXM5 +CHXXM6: JUMPGE H,CHXXM7 ;Jump if even packet length + UNPK16 B,(D) ;Transmit residual bytes + IOWRI B,CAIWBF +CHXXM7: LDB T,[$CPKDN(A)] ;Get destination subnet + HRRZ D,SBNRUT(T) ;Gateway to that subnet + CAIGE T,NSUBNT + CAIN T,MYCHAD_-8 ;If on local cable, + LDB D,[$CPKDA(A)] ; go direct + IOWRI D,CAIWBF ;Store hardware destination address + IORDI T,CAIXMT ;Transmit packet +CHXBK8: MOVEI A,%CATEN ;Enable transmit-done interrupt if xmitting +CHXBK9: IORI A,%CAREN ;Enable receive-done interrupt always + IORB A,CHXCSR + IOWRI A,CAICSR + MOVSI 17,CHXACS ;Dismiss software interrupt + BLT 17,17 + JRST 12,@CHXBRK + +CHXBK2: PUSHJ P,CHABRT ;Packet no good, discard it + JRST CHXBK1 + +;Examine packet in A, return AOBJN pointer to data in D, +; H is negative if there is an extra halfword after that. +; W gets number of full words of data (same as LH D). +; T,U get clobbered +; Returns: +; +1 16-bit data +; +2 8-bit data +CHSHDR: HRRZI A,-%CPKDT(A) ;Restore packet address + LDB W,[$CPKNB(A)] ;Get size of packet in bytes + CAILE W,%CPMXC + MOVEI W,%CPMXC ;Self-defense + ADDI W,1 ;Round up to next word boundary + LSHC W,-2 ;Convert bytes to words, H gets remainder + HRLOI D,-1(W) ;Make AOBJN pointer + EQVI D,%CPKDT(A) + LDB T,[$CPKOP(A)] ;Does this packet need byte swapping? + TRNE T,200 + JRST [ TRNN T,100 + AOS (P) ;Character data + POPJ P, ] ;Binary data + IDIVI T,40 + MOVE T,CHSWBT(T) + LSH T,(T+1) + JUMPL T,CPOPJ ;Binary control packet + JRST POPJ1 ;Characters + +CHSWBT: 1_<35.-%COOPN>+1_<35.-%COSTS>+1_<35.-%CORUT> + 0 ? 0 ? 0 +];CH11P + +SUBTTL CHAOS NET BUFFER LIST STUFF + +OVHMTR CHL + +;BUFFERS ARE PKTBSZ WORDS LONG; 2 HEADER WORDS AND %CPMXW PACKET WORDS. +;PKTBSZ IS A POWER OF 2 AND LESS THAN 1K (MEMORY PAGE SIZE). +;NOTE THAT A BUFFER ADDRESS POINTS AT THE FIRST PACKET WORD +;AND THE HEADER WORDS ARE AT NEGATIVE ADDRESSES. +;FIRST HEADER WORD: -2(A) +; RH LIST THREAD FOR MOST LISTS, 0=END, -1=NOT ON LIST +; LH LIST THREAD FOR TRANSMIT LIST +;SECOND HEADER WORD: -1(A) +; TIME RECEIVED OR TIME PUT ON TRANSMIT LIST +; OR VALUE OF I FOR A PACKET ON THE LSN QUEUE +; ASCII/LUNCH/ FOR A PACKET ON THE FREE LIST + +;I DO IT THIS WAY (PIOFF) TO AVOID HAVING TO PUSH AND POP PI STATUS, +;CONO PI,NETOFF CAN LOSE AT INTERRUPT LEVEL (MAINLY THE NETON LOSES) + +;THESE ROUTINES TURN OFF INTERRUPTS MOMENTARILY SO THAT +;LISTS MAY BE SAFELY MANIPULATED. + +;Q POINTS TO THE HEADER WORD OF A QUEUE, REMOVE THE FIRST +;THING AND RETURN IN A. (ZERO IF NONE) CLOBBERS T +CHAQGF: CONO PI,PIOFF + HLRZ A,(Q) ;GET FIRST + JUMPE A,PIONJ ;EMPTY + HRRZ T,-2(A) ;GET SECOND + HRLM T,(Q) ;MAKE FIRST +IFN FTRCHK,[ + JUMPN T,PIONJ + HRRZ T,(Q) + CAIE T,(A) + BUG PAUSE,[CHAOS LIST TRASHED],OCT,Q + SETZM (Q) ;IS NOW EMPTY +];FTRCHK +IFE FTRCHK,[ + SKIPN T + SETZM (Q) ;IS NOW EMPTY +];FTRCHK + CONO PI,PION + POPJ P, + +;RETURN BUFFER INTO WHICH THE BYTE POINTER IN A POINTS. CLOBBERS A,T,Q +CHBPFR: SUBI A,1 ;SIOKT LIKES TO MAKE BP POINT AT NEXT BUFFER + ANDI A,-PKTBSZ + ADDI A,2 + JRST CHABRT + +;RETURN BUFFER POINTED TO BY A TO FREE UNLESS ON TRANSMIT LIST. +CHABR1: HLLOS T,-2(A) ;RH GETS -1, NO LONGER ON REGULAR LIST + AOJN T,CPOPJ ;EXIT IF STILL ON TRANSMIT LIST + ;DROPS THROUGH +;RETURN BUFFER POINTED BY A TO FREE STORAGE. CLOBBERS T, Q. +CHABRT: MOVEI Q,CHQFRE +IFN FTRCHK,[ + SKIPN A + BUG PAUSE,[FREEING 0] +];FTRCHK + MOVE T,[ASCII/LUNCH/] ;TANSTAAFL + MOVEM T,-1(A) + SETOM -2(A) ;NOT ON TRANSMIT LIST NOW (THIS IS WHAT INITS + AOS CHFRBF ; LH[-2(A)] WHEN BUFFER FIRST CREATED) + ;JRST CHAQPL ;DROPS THROUGH + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE LAST THING. BASHES T. +CHAQPL: HLLZS -2(A) ;PUT ENDLIST IN RH + CONO PI,PIOFF + HRRZ T,(Q) ;GET LAST + HRRM A,(Q) ;MAKE NEW LAST + JUMPN T,[HRRM A,-2(T) ;MAKE A COME AFTER IT + JRST PIONJ ] + HRLM A,(Q) ;WAS EMPTY, ALSO IS NEW FIRST + CONO PI,PION + POPJ P, + +;A POINTS TO A BUFFER, Q TO A QUEUE. PUT IT ON AS THE FIRST THING. SMASHES T. +CHAQPF: CONO PI,PIOFF + HLRZ T,(Q) ;GET FIRST + HRRM T,-2(A) ;MAKE SECOND + HRLM A,(Q) ;MAKE NEW FIRST + SKIPN T + HRRM A,(Q) ;WAS EMPTY, ALSO MAKE NEW LAST + CONO PI,PION + POPJ P, + +;ALLOCATE A BUFFER AT MAIN PROGRAM LEVEL, TO A, MASHES T, TT, Q, B. +CHABG0: PUSHJ P,UDELAY ;WAIT FOR MEMORY +CHABGT: PUSHJ P,CHABGI + JRST CHABG0 + POPJ P, ;WIN + +;ALLOCATE A BUFFER, RETURN POINTER TO IT IN A, SKIP. BLOWS AWAY T, TT, Q. +;NON-SKIP IF NO BUFFERS AVAILABLE. (DOESN'T MAKE NEW ONES IF FREE LIST EMPTY) +CHABAL: MOVEI Q,CHQFRE + PUSHJ P,CHAQGF + JUMPE A,CPOPJ + SETZM -1(A) ;NO LUNCH + SOS CHFRBF + JRST POPJ1 + +;ALLOCATE A BUFFER TO A, MAKE NEW IF NONE FREE. OBLITERATES T,Q,B. +;NON-SKIP IF CAN'T GET MEMORY. (SUITABLE FOR CALLING FROM INT LEVEL) +CHABGI: PUSHJ P,CHABAL ;TRY TO ALLOCATE A BUFFER FROM FREE LIST + CAIA + JRST POPJ1 ;WON, RETURN + CONI PI,Q ;SAVE PI CHANNELS ON STATUS + ANDI Q,177 + CONO PI,UTCOFF ;MAKE THE WORLD SAFE FOR IOMQ + MOVE B,CHTTBF + CAIL B,CHMXBF ;MAKE SURE NOT TO USE UP ALL CORE + JRST CHABG4 + PUSHJ P,IOMQ ;GET 1K OF MEMORY + JRST CHABG3 ;MEM NOT AVAILABLE, FAIL + CONO PI,PICON(Q) ;WON, RESTORE PI STATUS + MOVEI B,MUCHA + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ;ADDRESS OF 1K OF ALLOCATED MEMORY + ADD A,[-<2000/PKTBSZ>,,2] ;-BUFFERS PER 1K,,OFFSET TO HEADER +CHABG2: PUSHJ P,CHABRT ;PUT THEM ALL ON FREE LIST + ADDI A,PKTBSZ-1 + AOBJN A,CHABG2 + MOVEI B,<2000/PKTBSZ> ;THIS MANY MORE BUFFERS HAVE BEEN CREATED + ADDM B,CHTTBF + JRST CHABGI ;NOW GO ALLOCATE ONE + +;HERE IF CHAOS NET TRYING TO USE UP TOO MUCH CORE +CHABG4: MOVE B,CHMXTM ;DON'T COMPLAIN TOO OFTEN + ADDI B,60.*30. ;JUST ONCE A MINUTE + CAMLE B,TIME + JRST CHABG3 +IFE CH10P, BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE] +IFN CH10P,[ + CONI CHX,B + BUG CHECK,[CHAOS NET ATTEMPTING TO USE TOO MUCH CORE, CONI=],OCT,B,[CONO=],OCT,CHXCNO,[CHOSTA=],OCT,CHOSTA +];CH10P + MOVE B,TIME + MOVEM B,CHMXTM +CHABG3: CONO PI,PICON(Q) ;LOST, RESTORE PI STATUS + POPJ P, ;AND TAKE ERROR RETURN + +;FREE A WHOLE LIST OF BUFFERS, Q-> HEAD. DESTROYS A,T +CHALFR: PUSHJ P,CHAQGF + JUMPE A,CPOPJ + PUSH P,Q + PUSHJ P,CHABR1 ;FREE UNLESS STILL ON TRANSMIT LIST + POP P,Q + JRST CHALFR + +;Q -> A TRANSMIT QUEUE, FLUSH ALL BUFFERS BELONGING TO INDEX I. +;CLOBBERS A,B,C,T +CFLXMQ: PUSH P,Q + CONO PI,NETOFF ;DON'T LET TRANSMIT LIST CHANGE (AT ALL) + HLRZ A,(Q) ;HEAD OF TRANSMIT LIST + JUMPE A,CFLXM3 + MOVEI B,2(Q) ;B PREVIOUS PACKET, A CURRENT, C NEXT +CFLXM1: HLRZ C,-2(A) ;GET THREAD TO NEXT +IFN FTRCHK,[ + CAIN C,-1 + JRST 4,. ;CLAIMS NOT TO BE ON LIST? +];FTRCHK + LDB T,[$CPKSX(A)] ;GET THIS PACKET'S INDEX + CAME T,I + JRST CFLXM2 + HRLM C,-2(B) ;THREAD PREVIOUS TO NEXT + HRROS T,-2(A) ;IF THIS BUFFER IS NOT ALSO ON SEND LIST, + AOJN T,.+2 + PUSHJ P,CHABRT ;RETURN IT + SKIPA Q,(P) +CFLXM2: MOVE B,A + SKIPE A,C + JRST CFLXM1 + HRRM B,(Q) ;LAST PACKET ON LIST MAY HAVE CHANGED + CAIN B,2(Q) + SETZM (Q) ;TRANSMIT QUEUE IS NOW EMPTY +CFLXM3: POP P,Q + JRST NETONJ + +;SEARCH LIST IN Q FOR PACKET WHOSE CONTACT NAME MATCHES THAT +;OF PACKET IN A, RETURN IT IN B, SKIPPING IF WINNING. CLOBBERS T,TT,C,D,E,H,J. +;THE PACKET RETURNED IN B IS DE-LINKED FROM THE SEARCHED QUEUE. +;HAS TO BE CALLED WITH NETOFF OR IN PROGRESS, SO LIST CAN'T GET MUNGED. +;I HOPE IT'S NOT TOO BLETCHEROUSLY SLOW. +CHAQSR: HLRZ B,(Q) ;GET START OF LIST TO SEARCH + JUMPE B,CPOPJ ;EMPTY, LOSE + MOVEI J,0 ;PACKET PREVIOUS TO B +CHAQS1: LDB C,[$CPKNB(A)] ;SET UP STRING COMPARE LOOP + LDB H,[$CPKNB(B)] ;THIS ASSUMES NO ZERO-LENGTH STRINGS + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEI E,%CPKDT(B) + HRLI E,440800 +CHAQS2: ILDB T,D + ILDB TT,E ;DON'T IGNORE CASE, THAT WOULD JUST SLOW THIS + CAME T,TT ;BAG-BITER DOWN EVEN MORE. EVERYONE SHOULD + JRST CHAQS4 ;PUT THEIR CONTACT NAMES IN UPPER-CASE. + CAIN T,40 ;TERMINATE ON SPACE + JRST CHAQS5 + SOJLE C,CHAQS3 + SOJG H,CHAQS2 + ILDB T,D + CAIE T,40 + JRST CHAQS4 +CHAQS5: HRRZ C,-2(B) ;WON, DELINK PACKET FROM LIST + JUMPE J,[ HRLM C,(Q) + JUMPN C,POPJ1 + IFN FTRCHK,[ + HRRZ C,(Q) ;CHECK LIST ENDING IN RIGHT PLACE + CAIE C,(B) + JRST 4,. + ];FTRCHK + SETZM (Q) + JRST POPJ1 ] + HRRM C,-2(J) + JUMPN C,POPJ1 + HRRM J,(Q) ;TOOK LAST PACKET, STORE NEW LAST + JRST POPJ1 + +CHAQS3: SOJLE H,CHAQS5 + ILDB TT,E + CAIN TT,40 + JRST CHAQS5 +CHAQS4: MOVE J,B ;THIS ONE DOESN'T MATCH, TRY NEXT + HRRZ B,-2(B) + JUMPN B,CHAQS1 + POPJ P, ;NO MATCHES + +;THIS ROUTINE RUNS IN THE CORE JOB AND CLEANS UP MEMORY USED BY CHAOS BUFFERS +;SMASHES ALL ACS +CHCLN: SKIPE A,CHTTBF ;SEE IF 2/3 OR MORE OF BUFFERS FREE + SKIPN B,CHFRBF + POPJ P, ;NO BUFFERS OR NONE FREE, NOTHING TO DO + SUBM A,B + IDIV A,B ;GET RATIO OF TOTAL TO USED + CAIGE A,3 ;NOTE IF B IS ZERO A IS UNCHANGED + POPJ P, ; AND AT LEAST 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ;SCAN MEMORY FOR CHAOS BUFFER PAGES +.ELSE MOVEI D,255. +CHCLN0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUCHA +CHCLN4: SOJGE D,CHCLN0 + JUMPL D,CPOPJ + MOVE A,D ;QUICKLY DETERMINE IF ANY NON-FREE BUFFERS + LSH A,10. ; ON THIS PAGE + HRLI A,-<2000/PKTBSZ> + MOVE T,[ASCII/LUNCH/] +CHCLN5: CAME T,1(A) + JRST CHCLN4 ;NOT FREE, DON'T BOTHER WITH SLOW STUFF + ADDI A,PKTBSZ-1 + AOBJN A,CHCLN5 + SETZB C,CHCLNQ ;COLLECT ALL FREE BUFFERS THAT ARE ON THIS PAGE + MOVE E,CHFRBF ;LOOP ABOUT AS MANY TIMES AS THERE ARE FREE BUFFERS +CHCLN1: PUSHJ P,CHABAL ;GET NEXT FREE BUFFER + JUMPE A,CHCLN2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,CHCLNQ ;THIS ONE'S ON THE PAGE, SAVE IT + PUSHJ P,CHAQPL + AOJA C,.+2 ] ;COUNT THEM + PUSHJ P,CHABRT ;NOT ON THE PAGE, PUT BACK + SOJG E,CHCLN1 +CHCLN2: CAIE C,<2000/PKTBSZ> ;DID WE GET THE WHOLE PAGE? + JRST [ MOVEI Q,CHCLNQ ? PUSHJ P,CHALFR ? JRST CHCLN4 ] + MOVNS C ;YES, GET RID OF THESE BUFFERS + ADDM C,CHTTBF + MOVE A,D + PUSHJ P,MEMR + JRST CHCLN + +OVHMTR CHZ diff --git a/system/chsdef.14 b/system/chsdef.14 new file mode 100644 index 0000000..b5c83b8 --- /dev/null +++ b/system/chsdef.14 @@ -0,0 +1,84 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; CHAOS NET PACKET DEFINITION + +;NOTE, IF YOU MAKE CHANGES TO OPCODES OR CONNECTION STATE SYMBOLS, +;ALSO CHANGE MC:MAINT;CHS DEFS. +;THIS FILE IS FOR PDP-10'S - CHS DEFS IS FOR PDP-11'S. + + +;PACKET HEADER +;NOTE THESE ARE FULL WORD BYTE POINTERS, INCLUDING A WORD OFFSET + +$CPKOP==341000,,0 ;OPCODE + %CO==,,-1 + %CORFC==1 ;REQUEST FOR CONNECTION + %COOPN==2 ;OPEN + %COCLS==3 ;CLOSE + %COFWD==4 ;FORWARD + %COANS==5 ;ANSWER + %COSNS==6 ;SENSE STATUS + %COSTS==7 ;REPORT STATUS + %CORUT==10 ;ROUTING INFO (NOT YET USED) + %COLOS==11 ;REPORT LOSSAGE + %COLSN==12 ;LISTEN FOR RFC + %COMNT==13 ;MAINTENANCE USE, IGNORED BY NORMAL NCPS + %COEOF==14 ;END OF FILE + %COUNC==15 ;UNCONTROLLED USER PACKET + %COBRD==16 ;Software broadcast packet + %COMAX==17 ;HIGHEST NON-DATA OPCODE +1 + %CODAT==200 ;NORMAL DATA OPCODE (NOTE SIGN BIT OF WORD IS SET) + %CODWD==300 ;16-BIT DATA +$CPKMV==241000,,0 ;"MUPPET" VERSION (MUST BE ZERO, NO MUPPETS EXIST!) +$CPKFC==200400,,0 ;FORWARDING COUNT +$CPKNB==041400,,0 ;NUMBER OF BYTES +$CPKDA==242000,,1 ;DESTINATION ADDRESS + $CPKDN==341000,,1 ;DESTINATION SUBNET + $CPKDH==241000,,1 ;DESTINATION HOST +$CPKDI==042000,,1 ;DESTINATION INDEX + %CPKD==1 ;DESTINATION ADDRESS WORD +$CPKSA==242000,,2 ;SOURCE ADDRESS + $CPKSN==341000,,2 ;SOURCE SUBNET + $CPKSH==241000,,2 ;SOURCE HOST +$CPKSI==042000,,2 ;SOURCE INDEX + %CPKS==2 ;SOURCE ADDRESS WORD +$CPKPN==242000,,3 ;PACKET NUMBER +$CPKAN==042000,,3 ;ACKNOWLEDGE NUMBER + %CPKDT==4 ;FIRST WORD OF DATA + +;PACKET SIZE + +;THESE NUMBERS ARE FOR 1K PACKET BUFFERS +;%CPMXW==30. ;MAXIMUM NUMBER OF PDP10 WORDS IN WHOLE PACKET +;%CPMXC==104. ;MAXIMUM NUMBER OF CHARACTERS OF DATA + +;THESE NUMBERS ARE FOR 4K PACKET BUFFERS +%CPMXW==126. ;MAXIMUM NUMBER OF PDP10 WORDS IN WHOLE PACKET +%CPMXC==488. ;MAXIMUM NUMBER OF CHARACTERS OF DATA + +;CONNECTION STATES + +%CS==,,-1 +%CSCLS==0 ;CLOSED +%CSLSN==1 ;LISTENING +%CSRFC==2 ;RFC RECEIVED +%CSRFS==3 ;RFC SENT +%CSOPN==4 ;OPEN +%CSLOS==5 ;BROKEN BY RECEIPT OF "LOS" +%CSINC==6 ;BROKEN BY INCOMPLETE TRANSMISSION (NO RESPONSE TO SNS) +%CSFRN==7 ;OPEN IN FOREIGN PROTOCOL MODE +%CSBRS==10 ;BRD sent state diff --git a/system/chsdef.15 b/system/chsdef.15 new file mode 100644 index 0000000..ffdde74 --- /dev/null +++ b/system/chsdef.15 @@ -0,0 +1,84 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; CHAOS NET PACKET DEFINITION + +;NOTE, IF YOU MAKE CHANGES TO OPCODES OR CONNECTION STATE SYMBOLS, +;ALSO CHANGE AI:MAINT;CHS DEFS. +;THIS FILE IS FOR PDP-10'S - CHS DEFS IS FOR PDP-11'S. + + +;PACKET HEADER +;NOTE THESE ARE FULL WORD BYTE POINTERS, INCLUDING A WORD OFFSET + +$CPKOP==341000,,0 ;OPCODE + %CO==,,-1 + %CORFC==1 ;REQUEST FOR CONNECTION + %COOPN==2 ;OPEN + %COCLS==3 ;CLOSE + %COFWD==4 ;FORWARD + %COANS==5 ;ANSWER + %COSNS==6 ;SENSE STATUS + %COSTS==7 ;REPORT STATUS + %CORUT==10 ;ROUTING INFO (NOT YET USED) + %COLOS==11 ;REPORT LOSSAGE + %COLSN==12 ;LISTEN FOR RFC + %COMNT==13 ;MAINTENANCE USE, IGNORED BY NORMAL NCPS + %COEOF==14 ;END OF FILE + %COUNC==15 ;UNCONTROLLED USER PACKET + %COBRD==16 ;Software broadcast packet + %COMAX==17 ;HIGHEST NON-DATA OPCODE +1 + %CODAT==200 ;NORMAL DATA OPCODE (NOTE SIGN BIT OF WORD IS SET) + %CODWD==300 ;16-BIT DATA +$CPKMV==241000,,0 ;"MUPPET" VERSION (MUST BE ZERO, NO MUPPETS EXIST!) +$CPKFC==200400,,0 ;FORWARDING COUNT +$CPKNB==041400,,0 ;NUMBER OF BYTES +$CPKDA==242000,,1 ;DESTINATION ADDRESS + $CPKDN==341000,,1 ;DESTINATION SUBNET + $CPKDH==241000,,1 ;DESTINATION HOST +$CPKDI==042000,,1 ;DESTINATION INDEX + %CPKD==1 ;DESTINATION ADDRESS WORD +$CPKSA==242000,,2 ;SOURCE ADDRESS + $CPKSN==341000,,2 ;SOURCE SUBNET + $CPKSH==241000,,2 ;SOURCE HOST +$CPKSI==042000,,2 ;SOURCE INDEX + %CPKS==2 ;SOURCE ADDRESS WORD +$CPKPN==242000,,3 ;PACKET NUMBER +$CPKAN==042000,,3 ;ACKNOWLEDGE NUMBER + %CPKDT==4 ;FIRST WORD OF DATA + +;PACKET SIZE + +;THESE NUMBERS ARE FOR 1K PACKET BUFFERS +;%CPMXW==30. ;MAXIMUM NUMBER OF PDP10 WORDS IN WHOLE PACKET +;%CPMXC==104. ;MAXIMUM NUMBER OF CHARACTERS OF DATA + +;THESE NUMBERS ARE FOR 4K PACKET BUFFERS +%CPMXW==126. ;MAXIMUM NUMBER OF PDP10 WORDS IN WHOLE PACKET +%CPMXC==488. ;MAXIMUM NUMBER OF CHARACTERS OF DATA + +;CONNECTION STATES + +%CS==,,-1 +%CSCLS==0 ;CLOSED +%CSLSN==1 ;LISTENING +%CSRFC==2 ;RFC RECEIVED +%CSRFS==3 ;RFC SENT +%CSOPN==4 ;OPEN +%CSLOS==5 ;BROKEN BY RECEIPT OF "LOS" +%CSINC==6 ;BROKEN BY INCOMPLETE TRANSMISSION (NO RESPONSE TO SNS) +%CSFRN==7 ;OPEN IN FOREIGN PROTOCOL MODE +%CSBRS==10 ;BRD sent state diff --git a/system/config.188 b/system/config.188 new file mode 100644 index 0000000..354dbfb --- /dev/null +++ b/system/config.188 @@ -0,0 +1,938 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==30. ; # TCP network channels +DEFOPT IMPP==1 ; Has an IMP interface +DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==3 ; 3 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==12. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==30. ; # TCP network channels +DEFOPT IMPP==1 ; Has an IMP interface +DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +DEFOPT IMPUS==354 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type + + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexor +IFN DZ11P,IFNDEF DZ11NB,.ERR DZ11P requires a value for DZ11NB + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/config.191 b/system/config.191 new file mode 100644 index 0000000..bd59dc6 --- /dev/null +++ b/system/config.191 @@ -0,0 +1,940 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +;AI's IMP is gone 5/5/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==206 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==3 ; 3 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==12. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +;MC's IMP is gone 5/18/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==354 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type + + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexor +IFN DZ11P,IFNDEF DZ11NB,.ERR DZ11P requires a value for DZ11NB + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/config.192 b/system/config.192 new file mode 100644 index 0000000..73cc9b8 --- /dev/null +++ b/system/config.192 @@ -0,0 +1,1004 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +;AI's IMP is gone 5/5/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==206 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==3 ; 3 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==12. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +;MC's IMP is gone 5/18/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==354 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +IFE MCOND DB,[ ;DistriBution world +DEFOPT KS10P==1 ;DB is a KS10 + +IF1,[ +PRINTX /Configuration? (RP06, RM03 or RM80) / +.TTYMAC CNFG +DBRP06==0 ? DBRM03==0 ? DBRM80==0 +DB!CNFG==1 +IFE DBRP06\DBRM03\DBRM80, .ERR "CNFG" unknown. +TERMIN +] + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +IFN DBRP06, DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with +IFN DBRM03, DEFOPT NTUTBL==2 ; RP06 DEFS, RM03 DEFS or RM80 DEFS) +IFN DBRM80, DEFOPT NTUTBL==3 + +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +IFN DBRP06, DEFOPT RP06P==1 ; with one RP06 +IFN DBRM03, DEFOPT RM03P==1 ; with one RM02/3 +IFN DBRM80, DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DB] +BODY +TERMIN +TERMIN +] ;DB + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type + + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexor +IFN DZ11P,IFNDEF DZ11NB,.ERR DZ11P requires a value for DZ11NB + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/config.193 b/system/config.193 new file mode 100644 index 0000000..a8a3506 --- /dev/null +++ b/system/config.193 @@ -0,0 +1,940 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +;AI's IMP is gone 5/5/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==206 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==3 ; 3 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==12. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +;MC's IMP is gone 5/18/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==354 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==6. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type + + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexor +IFN DZ11P,IFNDEF DZ11NB,.ERR DZ11P requires a value for DZ11NB + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/config.195 b/system/config.195 new file mode 100644 index 0000000..3417815 --- /dev/null +++ b/system/config.195 @@ -0,0 +1,937 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +;AI's IMP is gone 5/5/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==206 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +;MC's IMP is gone 5/18/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==354 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==6. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type + + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexors + +IFN DZ11P, IFNDEF DZ11NB, .ERR DZ11P requires a value for DZ11NB +IFE DZ11P, DEFSYM DZ11NB==0 ; # DZ11s + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/config.196 b/system/config.196 new file mode 100644 index 0000000..b2b00b8 --- /dev/null +++ b/system/config.196 @@ -0,0 +1,942 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; "INSTALLATION" RELATED SWITCHES + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +IFNDEF DEFOPT,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFOPT FOO==BAR DOES IT UNLESS FOO ALREADY DEFINED +DEFINE DEFOPT X/ +IRPS Z,,[X] +IFNDEF Z, X +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEM2==1 +] +.ELSE $$TEM2==0 + +IFE MCOND AIKA,[ +DEFOPT KA10P==1 ;AI-KA HAS KA10 PROCESSOR +DEFOPT MAXJ==85. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1=> SWAP BLOCKING, 0=> PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==8. ;# 2314 UNITS +DEFOPT NTUTBL==2 ;TUTS ARE 2 BLOCKS LONG (THIS DEFN BETTER AGREE WITH DC10 DEFS) +DEFSYM NUDSL==440. ;# USER DIRECTORIES ON DISK. NOTE: JUST CHANGING THIS + ; IS NOT SUFFICIENT!! +DEFOPT NQCHN==40. ;NUMBER 2314 CHNLS +DEFOPT DC10P==1 ;HAS SYSTEMS CONCEPTS DISK CONTROL +DEFOPT DMDSK==0 ;DOES NOT USE DM DSK FORMAT (I.E. HAS EXTRA WORDS) +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHNL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==0 ; But punch doesn't work! +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK +DEFOPT DPKPP==1 ;DATA POINT KLUDGE (TTY mux) + +DEFOPT NETP==1 ; Connected to a network +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==206 ; ARPA net host number +DEFOPT IMPUS3==<1200,,400006> ; Internet host number +DEFOPT NCPP==1 ; Include NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT TK10P==1 ;HAS TK10 TTY SCANNER (NO MORE, BUT LEAVE IT SO TTY#S DON'T CHANGE) +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NNTYS==16. ;# TTYS ON KNIGHT KLUDGE +DEFOPT NDPTYS==9. ;# TTYS ON DATAPOINT KLUDGE +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) +DEFOPT APL==10 ;AP TTY # (really?) + +DEFOPT CODP==1 ; Has Morse code output device (no antenna though) + +; The following AI-KA stuff is broken since the 10-11 interface doesn't work, +; but is retained in case it gets fixed. +DEFOPT TEN11P==0 ; Rubin 10-11 interface +IFN TEN11P,[ + DEFOPT XGP==1 ; Has XGP + DEFOPT CHAOSP==1 ; Has CHAOS net + DEFOPT MYCHAD==2026 ; CHAOS net address + DEFOPT NINDX==50. ; Number of Chaosnet indices + DEFOPT T11CHP==1 ; CHAOS net goes through TEN-11 interface + DEFOPT CH11NM==7 ; # of 10-11 PDP11 handling CHAOS net. + DEFOPT TT11NM==0 ; # of 10-11 PDP11 that handles TV TTYs. + DEFOPT N11TYS==16. ; # PDP11 TV TTYS + DEFOPT MXVBN==40 ; Max video bfr # for assignment purposes. +] ;TEN11P ; These actually correspond to video switch inputs. + + +; The following stuff used to be on AI-KA and is unlikely to ever +; come back. +;DEFOPT PDP6P==0 ;HAS PDP6 (ALAS, NO MORE) +;DEFOPT 340P==0 ;HAS 340 DISPLAY (ALAS, NO MORE) +;DEFOPT TABP==0 ;DOESN'T HAVE SYLVANIA TABLET ANY MORE +;DEFOPT DSDP==0 ;HAS DESELECTION DEVICE (ALAS, NO MORE) +;DEFOPT NEWDTP==0 ;HAD OLD DECTAPE CONTROLLER +;DEFOPT RBTCP==0 ;ROBOT CONSOLE +;DEFOPT HCLKP==0 ;HOLLOWAY CLOCK (ALAS, NO MORE) +;DEFOPT ARMP==0 ;HAS NO ARM (AMF MOSTLY) (R.I.P.) +;DEFOPT OMXP==0 ;HAS OMX (OUTPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT IMXP==0 ;HAS IMX (INPUT MULTIPLEXOR) (ALAS, NO MORE) +;DEFOPT VIDP==0 ;HAD VIDI (R.I.P.) +;DEFOPT CCLKP==0 ;NO CHESS TOURN CLOCK STUFF +;DEFOPT NDAP==0 ;NEW D/A CONVERTERS (ALAS, NO MORE) + +; Physical memory variables + +DEFOPT TSYSM==768. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT ECCMEM==1 ;HAS HIC'S ERROR CORRECTING MEMORY +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.); + +DEFSYM PMRCM==1777 ;CORE ADR FIELD IN PAGE MAP (AI-KA HAS 10 BITS) +DEFSYM PMAGEM==16000 ;AI-KA HAS ONE LESS AGE BITS +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS + +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA==3776000 ;ADRS OF TEN-11 CONTROL PAGE +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM==3000000 ;BASE ADR OF PDP6 MEM AS SEEN FROM 10 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M==16. ;LENGTH OF PDP6 MEM IN PAGES +] ;AIKA + +IFE MCOND MLKA,[ +DEFOPT KA10P==1 ;ML-KA HAS KA PROCESSOR +DEFOPT MAXJ==60. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIV USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ; Page-in preemption +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT NQS==7 ;# DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==250. ;# USER DIRECTORIES ON DISK +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT QRDCMP==1 ;SOFTWARE READ-COMPARE +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS (SECONDARY PACK) +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;CHANNEL 1 MPX FEATURE +DEFOPT NEWDTP==1 ;HAS NEW DECTAPE CONTROLLER +;DEFOPT NUNITS==4 ; Number of utape units (R.I.P.) +DEFOPT NMTCS==1 ;NUMBER OF MAG TAPE UNITS +DEFOPT TM10A==1 ;IO-BUS MAG TAPE +DEFOPT NLPTP==1 ;HAS NEW LPT (ODEC) +DEFOPT TPLP==1 ;PSEUDO LPT +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ; And punch works. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==306 ; ARPA net host number +DEFOPT IMPUS3==<1200,,600006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==20. ; # NCP net channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels +DEFOPT CHAOSP==1 ;CHAOS NET +DEFOPT MYCHAD==3114 ;CHAOS NET ADDRESS +DEFOPT NINDX==30. ;NUMBER OF INDICES +DEFOPT CH10P==1 ;CHAOS NET VIA PDP-10 I/O BUS, NOT FRONT-END + +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +;DEFOPT NNVTTS==0 ;# NOVA TTYS (used to have?) +DEFOPT NMTYS==33 ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==8 ;# STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;MLKA + +IFE MCOND DM,[ +DEFOPT KA10P==1 ;DM HAS KA10 PROCESSOR +DEFOPT MAXJ==63. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==0 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==0 ;NO PAGE-IN PREEMPTION +DEFOPT SCHBLN==10. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS +DEFOPT NTUTBL==1 ;TUTS ARE ONE BLOCK LONG +DEFSYM NUDSL==200. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==30. ;NUMBER 2314 CHNLS +DEFOPT RP10P==1 ;HAS DEC RP10 DISK CONTROL (RP02) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT C1MXP==1 ;HAS CHANNEL 1 MPX FEATURE +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED CONTROLLER +DEFOPT TTLPTP==1 ;LPT IS A TTY (I.E. ON A TTY LINE) VALUE IS LINE #. +DEFOPT PTRP==1 ;HAS PAPER TAPE +DEFOPT PTPP==1 ;PUNCH DOES WORK. +DEFOPT MTYP==1 ;HAS MORTON MULTIPLEX BOX +;DEFOPT CODP==0 ;NO COD DEVICE (used to?) +DEFOPT PDCLKP==1 ;"DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT DMIMP==1 ; This is a DM IMP interface +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==20. ; # TCP network channels + +DEFOPT MSPP==1 ;HAS MESSAGE SLURPER +DEFOPT DEMON==1 ;HAS DEMON ROUTINES +DEFOPT NOTYS==1 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NMTYS==12. ;# TTYS ON MORTON BOX +DEFOPT NSTTYS==16. ;# OF STY'S (PSEUDO-TTY'S) + + +DEFOPT TSYSM==512. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==4 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==777 ;9 BIT REAL CORE ADR +DEFSYM PMAGEM==17000 ;4 BIT AGE +DEFSYM PMCSHM==0 ;NO CACHE BIT +DEFSYM PMUNSD==160000 ;UNUSED BITS +] ;DM + +IFE MCOND MX,[ +DEFOPT KL10P==1 ;MX IS WHAT WE CALL THE KL10 NOW +DEFOPT MAXJ==120. ;MAX NUMBER OF JOBS ALLOWED +DEFOPT SWBLK==1 ;1 => SWAP BLOCKING, 0 => PRIVILEGED USER +DEFOPT SWPWSP==0 ;NO WORKING-SET SWAP SCHEDULER +DEFOPT PAGPRE==1 ;PAGE-IN PREEMPTION +DEFOPT SCHBLN==20. ;NUMBER OF RUNNABLE JOBS TO REMEMBER + +DEFOPT NQS==6 ;# OF DISK UNITS (3 RP04'S AND 3 T-300'S) +DEFOPT NTUTBL==2 ;TUTS ARE TWO BLOCKS LONG +DEFSYM NUDSL==500. ;# USER DIRECTORIES ON DISK +DEFOPT NQCHN==50. ;NUMBER 2314 CHNLS +DEFOPT RH10P==1 ;HAS DEC RH10 DISK CONTROL (RP04) +DEFOPT T300P==3 ;TRIDENT T-300S VIA PDP-11 START AT DRIVE 3 +DEFOPT QRDCMP==0 ;SOFTWARE READ-COMPARE, HARDWARE IS PINING FOR THE + ; FJORDS (But this isn't debugged yet.) +DEFOPT DMDSK==1 ;USES DM DISK FORMAT +DEFOPT QRSRVP==1 ;HAS RESERVED DISK PACKS +DEFOPT QAUTHP==1 ;KEEPS TRACK OF FILE AUTHORS + +DEFOPT NMTCS==1 ;NUMBER MAG TAPE UNITS +DEFOPT TM10B==1 ;DF10-BASED TAPE CONTROLLER + +DEFOPT DL10P==1 ;HAS DL10/DC76 TTY CONTROLLER +DEFOPT PDCLKP==1 ;HAS "DeCoriolis" CLOCK + +DEFOPT NETP==1 ; Has net connection +DEFOPT INETP==1 ; Include Internet IP code +DEFOPT TCPP==1 ; Include Internet TCP code +DEFOPT XBL==25. ; # TCP connections +DEFOPT IMPP==1 ; Has IMP interface +DEFOPT KAIMP==1 +DEFOPT IMPUS==106 ; ARPA net host number +DEFOPT IMPUS3==<1200,,200006> ; Internet host number +DEFOPT NCPP==0 ; Flush NCP code +DEFOPT NNETCH==30. ; # NCP network channels +DEFOPT CHAOSP==1 ;HAS CHAOS NET +DEFOPT MYCHAD==1440 ;CHAOS NET ADDRESS +DEFOPT NINDX==50. ;NUMBER OF INDICES +DEFOPT DLCP==1 ;CHAOS NET GOES THROUGH DL10 + +DEFOPT NOTYS==0 ;# KA-10 CONSOLE 0 TTYS +DEFOPT NETYS==33. ;# KL-10 DTE20 TTYS +NEWDTE==1 ;TEMPORARY CONDITIONAL TO ENABLE NEW DTE20 PROTOCOL +DEFOPT NDLTYS==4. ;# TTYS ON DL10/DC76 + ;Note: 3d TTY on DL10 is VT52 by console. +DEFOPT NSTTYS==25. ;# OF STY'S (PSEUDO-TTY'S) + +DEFOPT TSYSM==2048. ;TOTAL PDP10 1K MEM BLOCKS +DEFOPT NMMP==7 ;# EXEC PAGES FOR MMP TABLE (# VIR PGS/512.) + +DEFSYM PMRCM==7777 ;12 BIT REAL CORE ADDR +DEFSYM PMCSHM==10000 ;CACHE ENABLE BIT +DEFSYM PMAGEM==160000 ;3 BIT AGE +DEFSYM PMUNSD==0 ;NO UNUSED BITS + +DEFINE ITSIRP BODY +IRPS ITS,,[MX] +BODY +TERMIN +TERMIN +] ;MX + +IFE MCOND AI,[ +DEFOPT KS10P==1 ;The new AI has a KS10 processor. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==2 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with two RP06s + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT NETP==1 ;Has one kind of network anyway +;AI's IMP is gone 5/5/89 +;DEFOPT INETP==1 ; Include Internet code +;DEFOPT TCPP==1 ; Include TCP code +;DEFOPT XBL==30. ; # TCP network channels +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==206 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,400006> ; Internet host number of IMP +;DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3130 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==12. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;AI + +IFE MCOND MC,[ +DEFOPT KS10P==1 ;MC is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT INETP==1 ; Include Internet code +DEFOPT TCPP==1 ; Include TCP code +DEFOPT XBL==30. ; # TCP network channels +;MC's IMP is gone 5/18/89 +;DEFOPT IMPP==1 ; Has an IMP interface +;DEFOPT KSIMP==1 ; ACC LH/DH interface on KS unibus +;DEFOPT IMPUS==354 ; ARPA net host number +;DEFOPT IMPUS3==<1200,,600054> ; Internet host number of IMP +DEFOPT IPUNCP==1 ; IP in Chaos UNC is our only Internet address +DEFOPT PKTTRC==-1 ;Packet tracing code enabled +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3131 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==6. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC] +BODY +TERMIN +TERMIN +] ;MC + +IFE MCOND ML,[ +DEFOPT KS10P==1 ;ML is now a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3133 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML] +BODY +TERMIN +TERMIN +] ;ML + +IFE MCOND MD,[ + +DEFOPT KS10P==1 ;MD is a KS10. + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==3 ;# 1K blocks in a TUT (better agree with disk DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM80P==1 ; with one RM80 + +DEFOPT NETP==1 ;Has one kind of network anyway +DEFOPT CHAOSP==1 ;Has CHAOS net +DEFOPT MYCHAD==3132 ;CHAOS net address +DEFOPT NINDX==50. ;Number of indices +DEFOPT CH11P==1 ;CHAOS net goes through Unibus + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==4 ; 4 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + DEFSYM DZ2BA=:760030 + DEFSYM DZ3BA=:760040 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==4. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[AI MC ML MD] +BODY +TERMIN +TERMIN +] ;MD + +IFE MCOND SI,[ ;Stacken ITS +DEFOPT KS10P==1 ;SI is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==2 ; 2 of them + DEFSYM DZ0BA=:760010 + DEFSYM DZ1BA=:760020 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==16. ;# DZ-11 TTYs +DEFOPT NSTTYS==8. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[SI] +BODY +TERMIN +TERMIN +] ;SI + +IFE MCOND FU,[ ;Australian KS10 +DEFOPT KS10P==1 ;FU is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==4 ;# 1K blocks in a TUT (better agree with RP06 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RP06P==1 ; with one RP06 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[FU] +BODY +TERMIN +TERMIN +] ;FU + +IFE MCOND PM,[ ;MRC's KS10 (PandaMonium) +DEFOPT KS10P==1 ;PM is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM03 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==5. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[PM] +BODY +TERMIN +TERMIN +] ;PM + +IFE MCOND DX,[ ;Digex's KS10 +DEFOPT KS10P==1 ;DX is a KS10 + +DEFOPT MAXJ==60. ;Max number of jobs allowed +DEFOPT NQCHN==30. ;Max number of user disk channels open in system +DEFOPT SCHBLN==10. ;Number of runnable jobs to remember +DEFOPT SWBLK==1 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==1 ;1= Use page-in preemption + +DEFOPT DMDSK==1 ;1= Use DM DSK format +DEFOPT QRSRVP==1 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==1 ;1= Keep track of file authors + +DEFOPT NQS==1 ;# of disk drive units +DEFOPT NTUTBL==2 ;# 1K blocks in a TUT (better agree with RM03 DEFS) +DEFSYM NUDSL==500. ;# directories in file system (better agree with + ; SALV and DSKDMP) +DEFOPT RH11P==1 ; Has RH11 controller +DEFOPT RM03P==1 ; with one RM02/3 + +DEFOPT NMTCS==1 ;Number of magtape units (so why not NMTUS?) +DEFOPT TM03S==1 ;TM03/RH11 Unibus tape controller + +DEFOPT DZ11P==1 ;Has DZ11 TTY controllers + DEFOPT DZ11NB==1 ; 1 of them + DEFSYM DZ0BA=:760010 + +DEFOPT NKSTYS==1 ;# KS-10 8080 console 0 TTYs +DEFOPT NDZTYS==8. ;# DZ-11 TTYs +DEFOPT NSTTYS==4. ;# of STY's (Pseudo-TTY's) + +DEFOPT TSYSM==512. ;Total PDP10 1K memory blocks +DEFOPT NMMP==4 ;# exec pages for MMP table (# vir pgs/512.) + +;;; Next four better agree with SYSTEM;KSDEFS: +DEFSYM PMAGEM==020000 ;2.5 Age bit +DEFSYM PMCSHM==010000 ;2.4 Cache enable bit +DEFSYM PMRCM==001777 ;2.1 - 1.1 Physical page number + ; (The page table supports 20 bit physical + ; addresses.) +DEFSYM PMUNSD==146000 ;Unused bits + +DEFINE ITSIRP BODY +IRPS ITS,,[DX] +BODY +TERMIN +TERMIN +] ;DX + +; Default settings for all configuration-dependent assembly parameters. +; If a system definition has already set a value for a parameter, the +; default here will NOT be used. + +DEFOPT KL10P==0 ;1= KL10 processor +DEFOPT KS10P==0 ;1= KS10 processor +DEFOPT KA10P==0 ;1= KA10 processor + +IFE KL10P\KS10P\KA10P, .ERR Processor type required - KL10P, KS10P or KA10P + +IFN KS10P, DEFOPT KSFREQ==4100000./60. ; KS-ticks per PD-tick. + +DEFOPT C1MXP==0 ;1= Has PI channel 1 MPX feature + +DEFOPT MAXJ==63. ; Max number of jobs allowed +DEFOPT NQCHN==30. ; Max number of user disk channels open in system +DEFOPT SCHBLN==10. ; Number of runnable jobs to remember +DEFOPT SWBLK==0 ;1= 1=> swap blocking, 0=> privileged user +DEFOPT SWPWSP==0 ;1= Use working-set swap scheduler +DEFOPT PAGPRE==0 ;1= Use page-in preemption + +; Disk parameters + +IFNDEF NQS, .ERR NQS required - # of disk drive units +IFNDEF NTUTBL,.ERR NTUTBL required - # 1K blocks in a TUT + ; (This defn better agree with DC/RP/RH/T3 defs) +IFNDEF NUDSL, .ERR NUDSL required - # directories in file system + ; Just changing this will not work!! +DEFOPT DC10P==0 ;1= Has Systems Concepts disk control +DEFOPT RP10P==0 ;1= DEC RP10 disk control (RP02) +DEFOPT RH10P==0 ;1= DEC RH10 disk control (RP04) +DEFOPT RH11P==0 ;1= DEC RH11 disk control +DEFOPT RP06P==0 ;1= RH11 with RP06's +DEFOPT RM03P==0 ;1= RH11 with RM03's +DEFOPT RM80P==0 ;1= RH11 with RM80's +DEFOPT T300P==0 ;1= Trident T-300 via PDP-11 +DEFOPT QRDCMP==0 ;1= Software read-compare +DEFOPT DMDSK==0 ;1= Use DM DSK format +DEFOPT QRSRVP==0 ;1= Has reserved disk packs (Secondary pack) +DEFOPT QAUTHP==0 ;1= Keep track of file authors + + +; Magtape parameters +DEFOPT NMTCS==0 ; # Mag tape units +DEFOPT TM10A==0 ;1= IO-bus TM10 Mag tape +DEFOPT TM10B==0 ;1= DF10/TM10 Magtape +DEFOPT TM03S==0 ;1= TM03/RH11 KS Magtape +IFN NMTCS,IFE TM10A\TM10B\TM03S,.ERR No Magtape Controller type specified? + + +; Network parameters +DEFOPT NETP==0 ;1= Connected to some network, include net code. +DEFOPT CHAOSP==0 ;1= Has CHAOS net (Must have some interface def'd) +DEFOPT NCPP==0 ;1= Include NCP code (must have IMPP) +DEFOPT INETP==0 ;1= Include Internet Protocol code +DEFOPT TCPP==0 ;1= Include TCP code (must have INETP) +DEFOPT IPUNCP==0 ;1= IP in Chaos UNC is our only Internet address + +;NCP-specific parameters +DEFOPT NNETCH==30. ; # of NCP network channels system supports + +;IP-specific paramters +IFN INETP,[ +IFE IPUNCP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as Internet host addr +IFN IPUNCP,IFE CHAOSP,.ERR Chaosnet must exist for IP encapsulation scheme +] + +;Chaos-specific parameters +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as CHAOSnet host addr +DEFOPT NINDX==0 ; Number of indices for CHAOS connections +DEFOPT CH10P==0 ;1= CHAOS net via PDP-10 I/O bus +DEFOPT CH11P==0 ;1= CHAOS net via Unibus Chaos board on KS10 +DEFOPT DLCP==0 ;1= CHAOS net via DL10 +DEFOPT T11CHP==0 ;1= CHAOS net via Rubin 10-11 interface +IFN T11CHP,DEFOPT CH11NM==7 ; CHAOS net is on PDP-11 #7 of 10-11 interface + +;IMP interface specific parameters +DEFOPT IMPP==0 ;1= Has IMP interface to ARPAnet +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as ARPAnet host # +DEFOPT DMIMP==0 ;1= Has DM IMP interface +DEFOPT KAIMP==0 ;1= Has AI-KA/ML-KA/MX-KL IMP interface +DEFOPT KSIMP==0 ;1= Has KS10 UNIBUS ACC LH-DH IMP interface +IFN IMPP,IFE DMIMP+KAIMP+KSIMP,.ERR IMPP requires an interface type +IFN IMPP,IFN IPUNCP,.ERR IPUNCP and IMPP are incompatible + +; TTY line parameters +DEFOPT MTYP==0 ;1= Has Morton box multiplexor +DEFOPT DL10P==0 ;1= Has DL10/DC76 TTY controller +DEFOPT TK10P==0 ;1= Has TK10 TTY scanner +DEFOPT DPKPP==0 ;1= Has Datapoint kludge TTY mpxr +DEFOPT DZ11P==0 ;1= Has DZ11 Multiplexors + +IFN DZ11P, IFNDEF DZ11NB, .ERR DZ11P requires a value for DZ11NB +IFE DZ11P, DEFSYM DZ11NB==0 ; # DZ11s + +DEFOPT NOTYS==0 ; # KA-10 console 0 TTYs +DEFOPT NETYS==0 ; # KL-10 DTE20 console 0 TTYs +DEFOPT NKSTYS==0 ; # KS-10 8080 console 0 TTYs +DEFOPT NNVTTS==0 ; # Nova TTYs +DEFOPT NNTYS==0 ; # TTYs on Knight kludge +DEFOPT NDZTYS==0 ; # TTYs on DZ11s +DEFOPT NDPTYS==0 ; # TTYs on Datapoint kludge +DEFOPT NMTYS==0 ; # TTYs on Morton box +DEFOPT NDLTYS==0 ; # TTYs on DL10/DC76 +DEFOPT NSTTYS==0 ; # of STY's (Pseudo-TTY's) +DEFOPT N11TYS==0 ; # PDP11 TV TTYs (formerly 16. of them) +IFN N11TYS,[ + DEFOPT TT11NM==0 ; # of PDP11 that handles TTYs. + DEFOPT MXVBN==40 ; Max video buffer # for assignment purposes. +] ; These actually correspond to video switch inputs. +DEFOPT NF2741==0 ; First 2741 console # +DEFOPT N2741==0 ; # 2741's (formerly 3; flushed 3/21/76) +DEFOPT SYSCON==0 ; TTY # of system job console +DEFOPT APL==0 ; AP TTY # + +; Miscellaneous devices + +DEFOPT TEN11P==0 ;1= Rubin 10-11 interface (late of AI-KA) +DEFOPT XGP==0 ;1= Has XGP +DEFOPT NEWDTP==0 ;1= Has new dectape controller +DEFOPT NUNITS==0 ; # Utape (DECtape) units +DEFOPT OLPTP==0 ;1= Has old LPT (Data Products) +DEFOPT NLPTP==0 ;1= Has new LPT (ODEC) +DEFOPT GLPTP==0 ;1= Has Gould LPT +DEFOPT TTLPTP==0 ;1= LPT is on a TTY line (value = line #) +DEFOPT PTRP==0 ;1= Has paper tape reader/punch +DEFOPT PTPP==0 ;1= Paper tape punch works +DEFOPT PDCLKP==0 ;1= Has "DeCoriolis" clock +DEFOPT HCLKP==0 ;1= Has Holloway clock (device 710, 714) +DEFOPT CCLKP==0 ;1= Hack chess tournament clock stuff (device 374) +DEFOPT 340P==0 ;1= Has 340 display +DEFOPT TABP==0 ;1= Has Sylvania tablet +DEFOPT PLTP==0 ;1= Has Calcomp plotter +DEFOPT DSDP==0 ;1= Has deselection device +DEFOPT ARMP==0 ;1= Has arm (AMF mostly) (R.I.P.) +DEFOPT IMXP==0 ;1= Has IMX (input A/D multiplexor) (alas, no more) +DEFOPT OMXP==0 ;1= Has OMX (output D/A multiplexor) (alas, no more) +DEFOPT VIDP==0 ;1= Has VIDI (R.I.P.) +DEFOPT NTYP==0 ;1= Has DM kludge for talking to 11 +DEFOPT CODP==0 ;1= Has Morse code F1 92Mhz broadcast output device +DEFOPT PDP6P==0 ;1= Has PDP-6 (alas, no more) + ; (turning this on probably won't work) +DEFOPT RBTCP==0 ;1= Has Robot console +DEFOPT NDAP==0 ;1= Has "new" D/A converters (alas, no more) +DEFOPT STKP==0 ;1= Has Stanford keyboard (not any more) +DEFOPT E.SP==0 ;1= Has E&S LDS-1 display + +; Some software options + +DEFOPT MSPP==0 ;1= Want message slurper +DEFOPT DEMON==0 ;1= Want crufty DM demon facility +DEFOPT TPLP==0 ;1= Want pseudo LPT + + +; Physical memory parameters + +DEFOPT ECCMEM==0 ;1= Has HIC's error correcting memory +DEFOPT NMMP==4 ; # exec pages for MMP table (# vir pgs/512.) +IFNDEF TSYSM, .ERR TSYSM required - Total PDP10 1K mem blocks + +IFNDEF PMRCM, .ERR PMRCM required - Mem addr field in page map +IFNDEF PMAGEM,.ERR PMAGEM required - Age bits in page map +IFNDEF PMCSHM,.ERR PMCSHM required - Cache bit +IFNDEF PMUNSD,.ERR PMUNSD required - Unused bits + +IFNDEF ITSIRP,.ERR ITSIRP required - Names of local ITS machines + +; Any parameter conflict checks can be made here. + +IFN DZ11P,[ +IFG NDZTYS-, .ERR More DZ11 TTYs than controllers? +REPEAT DZ11NB,[ +IFNDEF CONC DZ,\.RPCNT,BA, .ERR DZ11 bus address not specified. +] +] +IFN $$TEMP,EXPUNGE DEFSYM +IFN $$TEM2,EXPUNGE DEFOPT diff --git a/system/core.81 b/system/core.81 new file mode 100644 index 0000000..27f3daf --- /dev/null +++ b/system/core.81 @@ -0,0 +1,3004 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;;; CORE JOB + +SUBTTL CORE ALLOCATOR - USER ROUTINES +; +; USER ROUTINES (TO COMMUNICATE WITH CORE JOB) +; +UACORE: ;U HAS INDEX CORE REQUEST IS FOR +ACORE: CAILE B,400 + POPJ P, + MOVE Q,U ;USER TO MAKE CORE FOR +ACORE1: PUSH P,U + MOVE U,USER + PUSHJ P,ACRF1 + SKIPA + AOS -1(P) + POP P,U + POPJ P, + +;EXCESSIVE CORE REQUEST CHECK +ACRTST: CAILE B,400 + POPJ P, + JRST POPJ1 + ;CORTYP SYSTEM CALL. +;IF 2 ARGS,1ST ARG IS JOB SPEC, LIKE CORBLK'S 2ND AND 4TH ARGS. +;2ND ARG IS PAGE NUMBER IN THAT JOB. +;IF ONLY 1 ARG, IT IS THE PAGE NUMBER IN THE EXECUTING JOB. +;RETURNED VALUES: +;1ST VALUE BITS: +; %CBWRT ;4.9 PAGE IS WRITEABLE +; %CBRED ;4.8 PAGE IS READABLE (EXISTS) +; %CBPUB ;4.6 PAGE IS PUBLIC +; %CBLOK ;4.2 PAGE IS LOCKED IN CORE +; %CBSLO ;3.9 PAGE IS IN SLOW MEMORY +; FOR NON EX PAGE, ALL THE REST ARE 0. +;2ND IS 0 => PAGE IS ABSOLUTE, -1 => UNSHARED, +; ELSE IS JOB NUMBER OF NEXT JOB IN CIRCULAR LIST. +;3RD IF ABSOLUTE PAGE, HAS PAGE NUMBER. +; IF PAGE IS SHARED, HAS PAGE NUMBER IN THE JOB +; WHOSE NUMBER IS THE 2ND VALUE. ELSE, 0. +;4TH BIT 4.9 => PAGE IS IN CORE. +; RH IS NUMBER OF TIMES PAGE IS SHARED +; (WILL BE 0 FOR ABS PAGE OR IF NO PAGE, +; OTHERWISE WILL BE >= 1) + +NCORTY: PUSHJ P,SWTL ;DON'T LET PAGE MAPS CHANGE. + CIRPSW + SOSG W ;IF 1 ARG, USE -1 (SELF) FOR JOB SPEC. + SKIPA B,[-1] + EXCH A,B ;ELSE 1ST ARG IS JOB SPEC. + MOVE J,B + JSP T,NCRUI2 ;DECODE THE JOB SPEC IN J, + JFCL ;RETURNS USR IDX IN J. + TDNE A,[-400] + JRST OPNL33 ;BAD PAGE NUM. + PUSHJ P,NCORT0 ;DO THE ACTUAL WORK. + PUSHJ P,LSWPOP ;UNLOCK CIRPSW, + JRST POPJ1 ;GIVE VALUES TO USER, SKIP. + +;CALL HERE FROM AUSET5 (ALWAYS COMES WITH CIRPSW LOCKED) +NCORT0: PUSH P,U +IFN PDP6P,[ + CAIN J,-1 + JRST [ SETZB B,D ;DON'T CALL UPLC IF PDP6, WOULD CRASH SYSTEM + MOVEI C,PDP6BM_-12(A) + CAIL A,LPDP6M + TDZA A,A + MOVSI A,%CBRED+%CBWRT + JRST POPUJ ] +];PDP6P + MOVEI U,(J) ;UPLC USES USER IN U. + PUSHJ P,UPLC ;NOTE PAGE NUM IS IN A. + LDB J,T ;GET PAGE'S HARDWARE HALFWD, + LDB C,Q ;GET CIRC. LIST POINTER. + JUMPE C,NCORTE ;J IF NO PAGE THERE. + MOVEI A,(J) + TRNE A,600000 ;GET ACCESS INTO A 1.1-1.2 + LDB A,[200200,,A] + CAIN A,2 ;CHANGE READ-WRITE-FIRST TO READ-WRITE. + MOVEI A,3 + ROT A,-2 ;SHIFT INTO 4.8-4.9 + CAIN C,-1 + JRST NCORTA ;J IF ABSOLUTE PAGE(CIRC PTR -1) + PUSHJ P,CHACK ;PG MUST HAVE REAL CIRC LIST, TRACE IT. + EXCH C,D ;D HAD MMP IDX; C HAD IN-CORE,,LIST LENGTH. + ADD C,MMPEAD + SKIPGE C,(C) .SEE MMPPUB + TLO A,%CBPUB + TLNE C,MMPLOK + TLO A,%CBLOK + TLNE C,MMPSLO + TLO A,%CBSLO + SUBI D,1 ;LIST LENGTH COUNTS THE MMP ENTRY, + SKIPGE D + SUBI D,1 ;COUNTS THE MEMBLT ENTRY IF PAGE IN CORE. + TRNN D,-2 ;RH NOW HAS # SHARERS, + JRST NCORTS ;ONLY 1 => PAGE NOT SHARED. + MOVE C,Q + MOVE B,P + PUSHJ P,UCPRL ;>1 SHARER => FIND NEXT SHARER, + 400000,,.+1 + MOVE P,B ;UN-SCREW STACK (UCPRL PUSHJ'D BACK) + LDB B,[101100,,T] + MOVE C,I ;2ND, 3RD VALUES USR NUM & PAGE NUM + JRST POPUJ ;OF THE NEXT SHARER. + +;COME HERE IF NO PAGE WITH THAT PAGE NUM. +NCORTE: SETZB A,B + SETZB C,D ;RETURN ALL ZEROS. + JRST POPUJ + +;COME HERE IF ABS PAGE, ACCESS ALREADY IN A. +NCORTA: SETZB B,D ;JOB # 0 (SYS JOB) FOR ABS PAGE. + LDB C,[PMRCAD,,J] ;GET ABS PAGE NUM FROM HARDWARE HALFWD. + JRST POPUJ + +;COME HERE IF UNSHARED NORMAL PAGE. +;ACCESS ALREADY IN A, 4TH VALUE IN D. +NCORTS: SETO B, ;2ND VALUE -1 FOR UNSHARED. + SETZ C, + JRST POPUJ + +;CORBLK CALL +;1ST ARG FLAG BITS: (RH XOR'D INTO LH BEFORE DECODING) + +%CB==0,,525252 +%CBWRT==400000 ; 4.9 GET WRITE ACCESS IF OK, DON'T FAIL IF NOT. +%CBRED==200000 ; 4.8 GET READ ACCESS +%CBNDW==100000 ; 4.7 GET WRITE ACCESS, FAIL IF CAN'T. +%CBPUB==40000 ; 4.6 MAKE PAGE PUBLIC +%CBPRV==20000 ; 4.5 MAKE IT PRIVATE (BOTH FAIL IF COULDN'T GET WRITE ACCESS) +%CBNDR==10000 ; 4.4 FAIL IF CAN'T GET READ ACCESS.(COPYING NONEXISTANT PAGE) +%CBCPY==4000 ; 4.3 MAKE COPY (CURRENTLY ONLY IMPLEMENTED FOR PAGE OF FILE) +%CBLOK==2000 ; 4.2 LOCK PAGE IN CORE. +%CBULK==1000 ; 4.1 UNLOCK PAGE (ALLOW SWAP-OUT) +%CBSLO==400 ; 3.9 MAY ONLY RESIDE IN SLOWEST MEMORY +%CBUSL==200 ; 3.8 ALLOWS USE OF ANY MEMORY. + ;IF ALL 0, DELETE. + +%CBNWP==563600 ;BITS THAT NEED WRITE-PERMISSION. + +;2ND ARG SPECIFIES JOB TO PUT PAGE IN +; IS EITHER CHNL NUM, -1 FOR SELF, OR 400000+USRNUM +;JOB SPECIFIED MUST BE CURRENT JOB OR INFERIOR. + +;3RD ARG RH. IS PAGE NUM. IN IT. +; LH. IF NEGATIVE, BLOCK MODE, REPEAT THAT MANY TIMES, +; INCREMENTING BOTH PAGE NUMS EACH TIME. +;IN BLOCK MODE, REWRITES 3RD AND 5TH ARGS EACH TIME. + +;4TH ARG IS SOURCE OF PAGE, +; A DISK CHANNEL NUMBER (GET N'TH PAGE IN FILE), OR +; A SPEC: +; A USR, JOB, BOJ, OR STY CHANNEL NUMBER +; OR ONE OF THE FOLLOWING SPECIAL CODES: +%JS==,-1 +%JSNUM==400000 ;400000+JOB NUMBER => THAT JOB +%JSSUP==400377 ;CURRENT JOB'S SUPERIOR +%JSELF==,,-1 ;SELF +%JSTVB==,,-2 ;TV11 VIDEO BUFFER IN FIRST 8 PAGES, 1ST WD OF 9TH PG IS CONSOLE REG +%JSNUL==,,-3 ;NULL JOB (NOT VALID FOR CORBLK) +%JSALL==,,-4 ;ALL JOBS (NOT VALID FOR CORBLK) +%JSNEW==,,-5 ;FRESH PAGE +%JSABS==,,-6 ;ABSOLUTE PAGE (PHYSICAL MEMORY) +; JOB 0 = SYSTEM JOB = EXEC VIRTUAL ADDRESS SPACE +; JOB 1 = CORE JOB = FRESH PAGE (OBSOLESCENT, USE %JSNEW, EVENTUALLY WILL GO AWAY) +;IF NO 4TH ARG, SAME AS 2ND + +;5TH ARG IS PAGE NUM IN SOURCE (IGNORED FOR FRESH PAGE) +;IF NO 5TH ARG, SAME AS 3RD IF 4TH ARG SPECIFIES JOB. + +;IF 4TH ARG SPECS FILE, USE CURRENT ACCESS PNTR +;IF INSERTING DISK PAGES, THE ACCESS PTR WILL BE +;POSITIONED AT THE BEGINNING OF THE PAGE AFTER THE LAST PAGE INSERTED. + +;BITS IN REGS R AND I: +NCOR$P==400000 ;SOURCE USER ISN'T WRITEABLE. PAGES ARE, IFF PUBLIC. +NCOR$Q==200000 ;SOURCE IS A DISK FILE. + +;CORBLK - COMMENTS ON PRECEDING PAGE. +NCORBL: TSC A,CTLBTS(U) + TLC A,(A) ;WIN FOR IMMEDIATE FIRST ARG + HRRZM C,SRN3(U) ;SAVE PTRS TO 3RD, 5TH ARGS IN SRN3, SRN4 RESPECTIVELY + TLNE C,1000 + TLZA C,-1 + UMOVE C,(C) + SKIPGE C ;IF WILL REWRITE,CHECK FOR PURE + XCTR XRW,[MOVES @SRN3(U)] + HRRZM E,SRN4(U) + CAIGE W,5 ;BUT IF NO 5TH ARG, SAY SO & USE 3RD. + JRST NCORB1 ;DEFAULT E TO C,SETOM SRN4 + TLNN E,1000 ;IMMEDIATE 5TH ARG LEGAL + JRST NCORB8 + JUMPGE C,NCORB7 ;ONLY IF WON'T HAVE TO REWRITE IT + JRST OPNL33 + +NCORB1: SETOM SRN4(U) + MOVE E,C + JRST NCORB7 + +NCORB8: UMOVE E,(E) + SKIPGE C + XCTR XRW,[MOVES @SRN4(U)] +NCORB7: ANDI E,-1 + MOVE J,B + JSP T,NCRUI1 ;GET USER INDEX OF TARGET. + JRST NCORB0 ;IF DOESN'T SKIP, CAN CERTAINLY WRITE. + CAIE J,-1 ;CAN'T STICK PAGE IN 6. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;CANT WRITE SO CANT STICK PAGE IN +NCORB0: MOVEI TT,(J) ;SAVE DEST. USER IDX. + CAIN TT,(U) ;IF NOT ACTING ON SELF, PCLSR TARGET JOB. + JRST NCORC1 + EXCH A,TT + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS DIELOK(A) + MOVEM A,SRN5(U) + MOVSI T,BSSTP ;BUT LEAVE BSSTP SET INSTEAD OF RH + IORM T,USTP(A) + SOS USTP(A) ;BECAUSE CORE JOB WANTS RH TO BE CLEAR + EXCH A,TT + PUSHJ P,LOSSET ;UNDO SETTING OF BSSTP IF WE PCLSR OR FAIL + NCORFS + CAIA +NCORC1: PUSHJ P,LSWPOP ;SOS DIELOK(TT) +;DROPS THROUGH. + +;DROPS THROUGH. ALSO COME HERE FROM ACBLK. +;TARGET DECODED AND STOPPED IF NEC.; USER IDX IN TT. +; NOW DECODE SOURCE IF NEC. +NCORB9: PUSHJ P,SWTL + CIRPSW + TLNE A,%CBNDW ;FORCE WRITE => WRITE. + TLO A,%CBWRT + JUMPE A,NCORD ;0 ACCESS WANTED => DELETE PAGES. + TLO A,%CBRED ;NOT DELETE, WANT AT LEAST READ ACCESS. + CAIGE W,4 ;IF HAD 4TH ARG, DECODE, + JRST NCORC2 ;ELSE USE DECODED 2ND (STILL IN J). + HRRZ J,D + CAIE J,%JSNEW + CAIN J,%JSABS + JRST NCORC2 ;SPECIAL NON-JOB SOURCE, SKIP DECODE +IFN N11TYS,[ + CAIN J,%JSTVB + JRST [ SKIPN TEN11F ;TV11 SOURCE + SKIPL TT11P + JRST OPNL10 ;DEVICE NOT AVAIL + JRST NCORC2] +] + MOVE J,D + JSP T,NCRUI1 ;GET SOURCE USR IDX + JRST NCORB2 + JRST NCORC0 + TLNN H,%CLSQ ;COME HERE IF ARG IS RANDOM IO CHANNEL. + JRST OPNL34 ;NOT DSK => NO GOOD. + MOVE R,J ;2 SKIPS => DISK CHNL; PUT ITS # IN R. + TLO R,NCOR$Q ;INDICATE DISK CHNL + MOVSI T,%QAACC + TDNE T,QSRAC(R) ;INSURE THAT %QAACC WILL BE ON IF OUR + JRST NCORQD + IORM T,QSRAC(R) ;CALL TO QFNTR FINDS EOF. + MOVE T,QFBLNO(R) ;IF %QAACC WAS 0, THEN QRADAD ISN'T SET UP. + MOVEM T,QRADAD(R) +NCORQD: SETOM NCORQC ;1ST TIME THRU NCORL LOOP COMING UP. + CAIGE W,5 + JRST NCORL + MOVE T,E ;DON'T SMASH E, WILL BE WRITTEN BACK TO USER + LSH T,10. ;5TH ARG GIVES PAGE ADDRESS IN FILE FOR DISK CHNL + IMULI T,@QSBYTE(R) + MOVEM T,QRADAD(R) ;SET ACCESS PTR OF DSK CHNL -> SPEC'D PAGE. + JRST NCORL + +NCORC0: TLNN A,%CBNWP ;IF REQUIRE ALTERATION, + JRST NCORB2 + JSP T,NCORW1 ;IF CAN'T WRITE THAT JOB, + HRLI J,NCOR$P ;SET FLAG TO CHECK FOR PUBLIC. +NCORB2: CAIE J,-1 ;IF NOT PDP6, + PUSHJ P,LSWPOP ;SOS DIELOK(J) + CAIN J,LUBLK ;IF SOURCE IS CORE JOB (EVENTUALLY DELETE THESE TWO LINES) + MOVEI J,%JSNEW ; THAT MEANS GET FRESH PAGE +NCORC2: MOVE R,J + CAIN R,%JSNEW ;FRESH PAGE IMPLIES WRITING + TLO A,%CBNDW+%CBWRT + +;DROPS THROUGH + +;DROPS IN + +;NOW HAVE TARGET IDX IN TT, SOURCE IN R (USER INDEX, -1 FOR +; PDP6, %JSTVB, %JSNEW, OR %JSABS). +;TARGET PAGNUM IN C; SOURCE IN E (MAYBE INVALID). +;R 4.9 => WRITE REQUIRES PUBLIC PAGE. +;R 4.8 => R HAS DISK CHNL (AND NCORQC IS -1 THE 1ST TIME AROUND) +;DECIDE WHAT KIND PAGE WANTED AND FIND IT. +;CIRPSW MUST BE ON TOP OF LSWPR. IT WILL BE +;UNLOCKED EVENTUALLY (AND ALSO 1 MORE UNDERNEATH IT +;IF THE TARGET JOB ISN'T US). FAILURE DOES A LSWCLR. +NCORL: MOVEI I,(R) ;I WILL HAVE USR IDX FOR ACTUAL PAGE. + HLRS A ;RH OF A WILL GET ACCESS TO BE GRANTED. + TRNE C,-400 ;CHECK DEST PAGE NUM IN RANGE. + JRST OPNL33 + + PUSH P,U + PUSH P,C + TLNE R,NCOR$Q + JRST NCORQ1 ;DISK FILE +IFN PDP6P,[ + CAIN I,-1 + JRST NCORE4 ;-1 => PDP6 PAGE. +] +IFN N11TYS,[ + CAIN I,%JSTVB + JRST NCORV1 ;TV11 +] + CAIN I,%JSNEW + JRST NCORF0 ;FRESH PAGE. + CAIN I,%JSABS + JRST NCORE1 ;ABSOLUTE PAGE. + CAIL E,400 + JRST NCORE7 ;ELSE SOURCE PAGNUM MUST BE < 400 + MOVEI U,(R) ;SOURCE IS A USER +NCORF2: EXCH E,A ;GET SOURCE PAGNUM IN A + PUSHJ P,UPLC;(A,U) ;FIND THE PAGE WANTED. + EXCH E,A + LDB J,Q ;UPLC RETURNS IN T,Q. + JUMPE J,NCORE6 ;FAIL OR DELETE IF HE HAS NO PAGE THERE. + CAIN J,-1 + JRST NCORE5 ;IF THAT PAGE IS ABS,CHANGE TO ABS REQ. + PUSHJ P,CHACK ;A REAL PAGE, FIND MMP, PREV. PTR. + ADD D,MMPEAD + MOVE B,Q + MOVEI I,(R) ;CHACK CLOBBERS I + TLNN A,%CBNDW+%CBWRT ;IF WANTED ALTERATION, CHECK LEGAL. + JRST NCORB3 + LDB J,T ;1ST OF ALL, SOURCE MUST HAVE WRITE PERM. + TRNN J,600000 + LSH J,20 + TRNN J,400000 + JRST NCORB5 + CAIN R,%JSNEW + JRST NCORF3 +NCORF4: CONO PI,UTCOFF ;DSK XFER COULD COMPLETE, CHANGING INTRANSIT BIT + MOVE J,(D) ; HE HAS WRITE PERM.; GET MMP IN J. + TLNE R,NCOR$P ; CAN'T ALTER IF NEEDED PUBLIC BUT IT ISN'T. + JUMPGE J,[ CONO PI,UTCON .SEE MMPPUB + JRST NCORB5] + TLNE A,%CBPUB ;WE CAN ALTER; CHANGE PUBLIC IF REQ. + TLO J,MMPPUB + TLNE A,%CBPRV + TLZ J,MMPPUB + TLNE A,%CBLOK + TLO J,MMPLOK + TLNE A,%CBULK + TLZ J,MMPLOK + TLNE A,%CBSLO + TLO J,MMPSLO + TLNE A,%CBUSL + TLZ J,MMPSLO + MOVEM J,(D) + CONO PI,UTCON + JRST NCORB3 + +NCORF0: MOVEI U,(TT) ;WHEN CREATING A FRESH PAGE, HAVE TO RE-USE A PREVIOUSLY + MOVEI E,(C) ;EXISTING PAGE IF POSSIBLE, BECAUSE AFTER THE FRESH PAGE + JRST NCORF2 ;IS GIVEN, USER WILL BE PCLSR'ED AND WILL COME IN AGAIN + ;LOOKING FOR A FRESH PAGE. CURRENTLY THIS CAUSES A BUG + ;THAT A "FRESH PAGE" IS NOT ALWAYS ZERO. + +NCORF3: CAIE C,2 ;WANT FRESH PAGE + CAMN C,[SETZ 3] + JRST .+2 + JRST NCORD0 ;SHARED PAGE CAN'T SERVE AS FRESH PAGE + MOVEI I,(TT) + JRST NCORF4 + +;COME HERE IF REQ WRITE ON REAL PAGE BUT CAN'T GRANT. +NCORB5: CAIN R,%JSNEW + JRST NCORD0 ;JUST REPLACE WITH FRESH PAGE + TLNE A,%CBNDW+%CBPUB+%CBPRV+%CBSLO+%CBUSL+%CBLOK+%CBULK ;IF HE INSISTED, FAIL. + JRST NCORE0 + TRZ A,%CBWRT ;ELSE GIVE HIM ONLY READ PERM. +;COME HERE IF PAGE EXISTS TO GIVE ACCESS AS IN A 2.8,2.9 +NCORB3: HRRZ J,(P) + CAIN TT,(I) ;ARE WE REPLACING PAGE BY ITSELF? + CAME E,J + JRST NCORD0 ;NO, DELETE OLD, INSERT NEW. + LDB J,T ;REPLACING PG W/ SELF, SET ACCESS & EXIT. + TRNN J,600000 + JRST NCORI1 + TRNN J,400000 ;CHANGE READ TO RWF + TRC J,600000 + TRNE A,%CBWRT + JRST NCORI2 + MOVSI I,40000 + TROE J,200000 + ANDCAM I,(D) + TRZ J,400000 + JRST NCORI2 + +NCORI1: MOVEI J,1 + TRNE A,%CBWRT + TRO J,2 +NCORI2: DPB J,T + POP P,C + POP P,U + JRST NCORX ;TO END OF LOOP. + +NCORQ1: PUSH P,A + PUSH P,TT + PUSH P,R + MOVEI A,(R) + AOSN NCORQC ;THE 1ST TIME AROUND LOOP? + JRST NCORQ0 ;YES, ACCESS TO 1ST PAGE TO BE INSERTED. + PUSHJ P,QFNTN ;NO, JUST MOVE FORWARD 1 PAGE + JRST NCORE8 ;REACHED EOF, CAN'T INSERT PAGE +NCORQF: POP P,R + POP P,TT + POP P,A + MOVE I,R ;FOUND THE PAGE, GO INSERT IT. + JRST NCORD0 + +NCORQ0: MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST NCORE8 + PUSHJ P,QUDULK ;QFNTR LEAVES IT LOCKED + AOS QSLGL(A) ;DON'T BE FOOLED BY QFNTR'S TRICK + SOS QSBI(A) ;ON THE DISK PI RTNS. + JRST NCORQF + +NCORE8: POP P,R + POP P,TT + POP P,A +NCORE6: CAIN R,%JSNEW ;COPY NONEXISTANT PAGE + JRST NCORD0 ;JUST PUT IN A FRESH PAGE + HRRI A,0 ;CHANGE TO DELETE RQ. + TLNN A,%CBNDR+%CBNDW+%CBPUB+%CBPRV+%CBLOK+%CBULK+%CBSLO+%CBUSL + JRST NCORD0 ;IF INSIST ON ACCESS, FAIL. +NCORE0: PUSHJ P,OPNL32 ;CAN'T GRANT ACCESS OPNL. +POPCUJ: POP P,C ;FAIL OUT OF CALL. + JRST POPUJ + +IFN PDP6P,[ +;REQ FOR PDP6 PAGE. +NCORE4: CAIL E,LPDP6M + JRST NCORE7 ;OUT OF RANGE. + MOVEI B,PDP6BM_<-10.>(E) + JRST NCORE3 ;CONVERT TO ABS REQ, WRITE OK +] + +IFN N11TYS,[ +;REQ FOR TV11 PAGE. +NCORV1: CAIL E,NTVBP + JRST NCORE7 + SKIPL TVCREG(TT) ;IF CONSOLE REGISTER NOT ALREADY SET UP + JRST NCORV2 + MOVE B,TVVBN(TT) ;INITIALIZE IT FROM BLINKER + MOVEM B,TVCREG(TT) + CAMN TT,USER + MOVEM B,400000+TTR10*2000 ;INITIALIZE HARDWARE CONSOLE REGISTER. +NCORV2: LDB B,TTCRT(E) ;GET MAP ENTRY OUT OF EXEUMP + ANDI B,PMRCM ;MASK TO PAGE # + JRST NCORE3 ;CONVERT TO ABS REQ, WRITE OK +] +;REQ FOR ABS PAGE. +NCORE1: MOVEI B,(E) + CAIGE B,TSYSM + JRST NCORE2 ;ACCESS AVAILABLE, READ ONLY + JRST NCORE6 ;CAN'T GET ACCESS TO PAGE. + +NCORE7: PUSHJ P,OPNL33 ;BAD ARG OPNL. + JRST POPCUJ + +;PAGE TO COPY WAS AN ABS PAGE. +NCORE5: CAIN R,%JSNEW + JRST NCORD0 ;SUBSTITUTE A FRESH PAGE + LDB B,T ;GET ABS PAGE NUM. + TRZE B,400000 ;IF HE HASN'T WRITE PERM. + JUMPGE R,NCORE3 ;OR WE CAN'T WRITE IN HIM, +NCORE2: TRZ A,%CBWRT ;CAN'T GET WRITE, + TLNN A,%CBNDW ;FAIL IF INSIST. +NCORE3: TLNE A,%CBPUB+%CBPRV+%CBLOK+%CBULK+%CBSLO+%CBUSL + JRST NCORE0 ;OR IF TRYING TO CHANGE PUBLICNESS. + MOVE D,B ;GET JUST THE PAGE # (NOT THE ACCESS CODE) + ANDI D,PMRCM ;TO INDEX INTO TABLES WITH. +IFN TEN11P,[ + LDB I,[.BP D] ;GET MOBY # + CAIE I,T11CPA_-18. + JRST NCORE9 + MOVE Q,D + SUBI Q,_8 + CAIL Q,256. + JRST 4,. + SKIPN I,T11MP(Q) + JRST 4,. ;SHOULDNT HAVE ABS PNTR TO NOT SET UP PAGE + AOJE I,NCOREA ;CONFLICT PAGE + LDB I,[350500,,T11MP(Q)] + CAIN I,37 + JRST NCOREA ;USAGE COUNT FULL + ADDI I,1 + DPB I,[350500,,T11MP(Q)] + JRST NCOREA +NCORE9:] +IFN PDP6P,[ + CAIL D,PDP6BM_-10. ;IS ABS PAGE # WITHIN RANGE OF PDP6 PAGES? + CAIL D,PDP6BM_-10.+LPDP6M + JRST NCOREB + SKIPL PDP6UP ;IF SO, ALLOW PAGE COPYING, IFF PDP6 IS UP. + JRST NCORE6 + JRST NCOREA + +NCOREB:] + CAIL D,TSYSM + JRST NCORE6 ;DONT ALLOW POINTER TO PAGE ABOVE TOTAL SYSTEM MEMORY + LDB I,[MUR,,MEMBLT(D)] + CAIN I,MUHOLE ;DON'T GIVE ABS PAGE THAT IS NXM. + JRST NCORE6 +NCOREA: MOVEI I,%JSABS ;INDICATE ABS REQ. + JRST NCORD0 + +EBLK +NCORQC: 0 ;COUNTS PASSES THRU NCORL, IF SOURCE IS DISK FILE. + ;FORCES COMPLETE REPOSITIONING IN FILE THE 1ST TIME THRU. +BBLK + +;THIS IS FOR DELETE RQS WHAT NCORL IS FOR INSERTS. +.SEE NCORL ;ABOUT CIRPSW, ACS, ETC. + ;ALSO SEE COMMENTS HALFWAY DOWN THIS PAGE. +NCORD: TRNE C,-400 + JRST OPNL33 ;PAGE NUM. OUT OF RANGE. + PUSH P,U + PUSH P,C +NCORD0: PUSH P,A ;COME IN HERE ON VALID INSERT RQ. +NCORD1: MOVE U,TT + HRRZ A,-1(P) + PUSH P,T + PUSH P,B + PUSHJ P,UPLC ;SAVE TIME BY CHECKING WHETHER PAGE EXISTS. + LDB B,T + SKIPE B + PUSHJ P,PAGERT ;IT EXISTS; DELETE IT. + POP P,B + POP P,T + POP P,A ;FLAG WORD + POP P,C ;TARGET PAGNUM + POP P,U + TRNN A,%CBRED+%CBWRT ;IF NO ACCESS REQ, IS DELETE, THRU. + JRST NCORX +;RH. OF A HAS ACCESS TO GRANT. LH(A) HAS ORIGINAL CONTROL BITS. +;IF I=%JSABS, ABS PAGE, NUM. IN B. +;IF I=%JSNEW, FRESH PAGE. +;IF 4.8 IN I SET, DISK PAGE POINTED TO BY CHNL IN I +;ELSE OLD PAGE, B IS BP -> CIRC LIST, T -> OLD ACCESS. + PUSH P,C ;-3 + PUSH P,E ;-2 + PUSH P,TT ;-1 + PUSH P,A ;0 + TLNE I,NCOR$Q + JRST NCORQ2 ;INSERT PAGE FROM FILE + CAIN I,%JSABS + JRST NCORA ;GO INSERT ABS PAGE + CAIE I,%JSNEW + JRST NCORR ;GO INSERT REAL PAGE. + PUSH P,R + LSH C,9 ;INSERT FRESH PAGE. + MOVEI Q,(TT) ;TARGET JOB + IDIVI TT,LUBLK ;CLOBBERS I. + IORI TT,400000(C) + HRLI TT,204000 + TLNE A,%CBPUB ;MAYBE RQ PUBLIC + TLO TT,1000 + PUSHJ P,NACRFL ;PUT IN CORE RQ (FREES CIRPSW) + JRST NCORF1 + POP P,R + PUSHJ P,SWTL + CIRPSW + HRRZ E,-3(P) ;GET TARGET PAGE NUM + JRST NCORR2 + +NCORF1: SUB P,[5,,5] + JRST OPNL37 ;NO CORE OPNL. + +;COME HERE IF NEED TO WAIT FOR CORE AVAILABLE FOR NEW MMP PAGE. +NCORQW: PUSHJ P,LSWPOP ;UNLOCK TUT. + PUSHJ P,LSWPOP ;AND CIRPSW, SO CORE JOB CAN OPERATE. + MOVEI T,3 ;WAIT TILL MEM HAS BEEN FREED BY CORE JOB. + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL ;RE-LOCK CIRPSW + CIRPSW + MOVE TT,(P) + JRST NCORQB ;THEN RETRY, RELOCKING TUT. + ;FIND OR CREATE MMP ENTRY FOR BLOCK <- DISK CHNL IN I. +;ACCESS TO GRANT IS IN A. +;RETURNS STUFF IN B,T ACCORDING TO COMMENT +;AFTER NCORD1 (IF NEW MMP, IT POINT TO SELF AND B -> IT) +NCORQ2: PUSH P,R + PUSH P,[NCORR3] ;RETURN TO NCORR3, SKIPPING UNLESS MMP FULL + MOVE TT,A + MOVE A,I +NCORQ7: PUSH P,TT ;ENTRY FROM NLOAD +NCORQB: MOVE I,QDSKN(A) + MOVE W,QSLGL(A) + HRL W,I + PUSHJ P,QTLOCK + TRNE TT,%CBCPY ;SPECIFIED COPY-ON-WRITE? + JRST NCORQ6 ;GET FRESH COPY OF PAGE + MOVE B,W ;ELSE TRY TO SHARE EXISTING COPY OF PAGE + IDIVI B,SHRHSL ;LOOK UP IN SHAREABLE-PAGE HASH TABLE + MOVEI B,SHRHSH-1(C) +NCORQ5: HRRZ B,1(B) ;THREAD TO NEXT MMP ENTRY IN BUCKET + JUMPE B,NCORQ6 ;END OF LIST, DESIRED PAGE NOT FOUND + HLRZ C,1(B) ;GET DISK ADDRESS OF THIS PAGE + LDB R,[$MMPUN,,(B)] + CAIN C,(W) + CAIE R,(I) + JRST NCORQ5 ;NOT THE ONE WE WANT + MOVEI R,(B) ;SET UP MMP IDX IN R + SUB R,MMPEAD ;AS GMMPP RETURNS IT. + PUSHJ P,QTULK ;TUT ALREADY AOS'ED. + MOVSI T,MMPGON + TDNE T,(B) + JRST [ MOVSI T,MMPTMP ;MMP ENTRY GOING AWAY. + TDNE T,(B) ;IF DISK TRANSFER ALSO IN PROGRESS, + JRST NCRMMW ; GO WAIT FOR THINGS TO SETTLE WITH CIRPSW FREE. + PUSH P,A + PUSHJ P,RETMM4 ;CLEAR PENDING FREEAGE + POP P,A + JRST NCORQB ] ;AND TRY AGAIN + MOVEI C,-1 + HRRZ T,(B) ;GET CIRC PNTR OUT OF MMP ENTRY. + CAIL T,600000 ;SKIP IF DOESN'T POINT TO MEMORY + TDNE C,MMSWP-600000(T) ;SKIP IF IT'S A LOOSE PAGE + JRST NCORQ8 + HRRZ C,MEMPNT-600000(T) + CAIE C,400000(R) ;SKIP IF NO USERS IN CIRCULAR LIST + JRST NCORQ8 ;NOT REALLY LOOSE, USERS LINKED BUT NOT CONNECTED + MOVEI C,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE W,FLOOSP +NCORQ3: MOVE TT,C ;TT PREDECESSOR + SKIPN C,W ;W SUCCESSOR + JRST 4,. ;NOT IN LOOSE PAGE LIST? + LDB W,[MLO,,MEMBLT(C)] + CAIE C,-600000(T) + JRST NCORQ3 + SKIPE TT + DPB W,[MLO,,MEMBLT(TT)] + SKIPN TT + MOVEM W,FLOOSP + SKIPN W + MOVEM TT,LLOOSP + SOSL NLOOSP + JRST NCORQ8 + JRST 4,. ;NLOOSP WAS TOO SMALL? + +NCORQ6: SOSGE MMPFR ;NEED TO CREATE NEW MMP ENTRY; COMMIT ONE + JRST [ AOS MMPFR ;MMP FULL + JRST POPTTJ ] ;TAKE ERROR RETURN + PUSHJ P,GMMPP ;GET FREE MMP ENTRY (CAN'T PCLSR AFTER THIS SUCCEEDS) + JRST NCORQW ;WAIT FOR MORE MEM + PUSHJ P,QTAOS1 ;AOS TUT FOR BLOCK (TUT ALREADY LOCKED) + HRLZM W,1(TT) ;STORE DISK ADR + MOVE D,R + IOR D,[MMPOUT+MMPWOD,,400000] ;SWAPPED OUT, MMP POINTING TO SELF + DPB I,[$MMPUN,,D] + MOVE C,(P) ;A + TRNE C,%CBCPY + TLCA D,MMPWOD+MMPISW ;COPYING, SO SET INITIAL-SWAPIN + JRST [ MOVE B,W ;NO COPYING, SO + IDIVI B,SHRHSL ;STICK INTO SHAREABLE-PAGE HASH TABLE + MOVE B,SHRHSH(C) + HRRM B,1(TT) + HRRZM TT,SHRHSH(C) + TLO D,MMPSHR ;FLAG MMP ENTRY AS IN SHRHSH TABLE + JRST .+1 ] + MOVEM D,(TT) + HRRZ B,TT + AOS NPGSWO +NCORQ8: MOVE T,[300,,[3]] + HRLI B,2200 + AOS -1(P) ;SUCCESS RETURN + JRST POPTTJ + +NCORA: MOVEI A,(C) + MOVE U,TT ;INSERT ABS PAGE. + PUSHJ P,UPLC ;FIND TARGET PAGE + IOR B,(P) ;COMBINE ACCESS W/ PAGE NUM. + TRZ B,PMAGEM\PMUNSD\PMCSHM +IFE KA10P,[ + TRNE B,PMRCM ;PAGE 0 NOT CACHED + IORI B,PMCSHM +] + LDB D,T + TRZ D,PMAGEM ;TURN OFF REMNANT AGE BITS + JUMPN D,[JRST 4,.] ;SHOULD HAVE DELETED PAGE ALREADY + DPB B,T + MOVNI B,1 ;CIRC. PTR. IS -1. + DPB B,Q + MOVEI E,(A) + JRST NCORR2 + + ;VIRTUAL PUSHJ AT NCORQ2 +NCORR3: JRST [ SUB P,[5,,5] ;MMP WAS FULL + JRST OPNL37 ] + POP P,R ;COME HERE FOR DSK PG, AFTER FINDING MMP. + MOVE C,QRADAD(A) ;MOVE ACCESS POINTER OF FILE TO + IDIVI C,@QSBYTE(A) ;NEXT PAGE BOUNDARY, BEING CAREFUL + IORI C,1777 ;ABOUT BYTES. + AOS C + IMULI C,@QSBYTE(A) ;NEXT USE OF FILE WILL GET + MOVEM C,QRADAD(A) ;WHAT FOLLOWS PAGES MAPPED. + MOVSI C,%QAACC ;INDICATE ACCESS PTR CHANGED. + IORM C,QSRAC(A) +;COME HERE TO INSERT PG FROM OTHER USER. +NCORR: HRRZ E,-3(P) ;TARGET PAGE # C + HRRZ U,-1(P) ;TARGET JOB TT + HRRZ TT,(P) ;ACCESS (WRITE BIT IN 2.9) + PUSHJ P,NCORR1 ;ACTUALLY MUNG MAP. +NCORR2: PUSHJ P,GHUSRA ;TARGET PAGE NUM MUST BE IN E + POP P,A + POP P,TT +NCORA1: POP P,E + POP P,C +;COME HERE AFTER HANDLING 1 PAGE. +NCORX: MOVE U,USER + CLRPGM (U) + JUMPGE C,NCORX1 ;IF LH POS, DON'T REWRITE. + ADD C,[1,,1] + ADDI E,1 + UMOVEM C,@SRN3(U) + SKIPL SRN4(U) ;REWRITE 5TH ARG ONLY IF WAS GIVEN. + UMOVEM E,@SRN4(U) + JUMPGE C,NCORX1 + TLNN A,%CBRED + JRST NCORD ;LOOP AROUND FOR DELETE RQ + JRST NCORL ;FOR INSERT RQ. + +NCORX1: AOS (P) +NCORX0: PUSHJ P,LSWPOP ;FREE CIRPSW +NCORX2: CAIN TT,(U) ;IF NOT ACTING ON SELF, + POPJ P, + JRST LSWPOP ;CAN'T FALL THRU SINCE MIGHT BE NULSET. + +;THIS IS A LOSSET ROUTINE TO CLEAR THE BSSTP BIT OF THE JOB +;WHOSE INDEX IS IN THE SRN5 OF THE RUNNING JOB. +NCORFS: MOVE A,SRN5(U) + MOVSI T,BSSTP + ANDCAM T,USTP(A) + POPJ P, + ;JSP T,NCORUI WITH JOB-SPEC IN J, RETURNS USER IDX IN J (OR ,,-1 FOR PDP6) + +;JOB SPECS ARE: +; -1 OR ,,-1 FOR SELF. +; (MUST BE USR, STY, JOB OR BOJ DEVICE ELSE OPNL34) +; 400000+ JOB WITH THAT NUMBER (OPNL35 IF NONE) +; ( -1,, ALSO WORKS) +;IF THIS JOB IS CERTAINLY ALLOWED TO MODIFY SPEC'D JOB, DOESN'T SKIP. +;IF SKIPS ONCE, MUST CHECK FARTHER. IN EITHER CASE, DIELOK OF JOB HAS BEEN AOS'D +;AND SOSSET'ED, UNLESS ENTRY POINT WAS NCRUI2, OR JOB IS PDP6. +;2 SKIPS => ARG IS RANDOM I-O CHANNEL; CLSTB ENTRY IN H. +;IN THAT CASE, NO SOSSET WAS DONE. RANDOM CHANNELS ALLOWED ONLY IF ENTRY POINT IS NCRUI1. + +NCRUI2: HRLI T,200000 ;ENTRY TO SUPPRESS AOS'ING OF DIELOK, AND SOSSET'ING. + JRST NCRUI3 + +NCRUI1: TLOA T,400000 ;ENTRY FOR RANDOM CHNLS OK (SKIP TWICE IF SO) +NCORUI: TLZ T,400000 ;RANDOM DEVS NOT OK + TLZ T,200000 +NCRUI3: TRZE J,400000 + HRLI J,-1 + JUMPL J,NCORU1 + CAIL J,NIOCHN ;>0 => CHNL NUM. + JRST OPNL14 + ADDI J,IOCHNM(U) + MOVE H,(J) + HLRZ J,H + SKIPGE H,CLSTB(H) + JRST NCORU4 ;IF INFERIOR, CAN WRITE. + TLNE H,%CLSBJ ;OR IF BOJ DEVICE + JRST [HRRZ J,JBCUI(J) ? JRST NCORU4] + TLNE H,%CLSST ;STY => USE JOB THAT HAS ASSOCIATED TTY. + JRST [ SKIPGE J,TTYSTS(J) + JRST OPNL41 ;NO JOB HAS THAT TTY. + ANDI J,-1 + JRST NCORU4] + TLNE H,%CLSFU ;FOREIGN USR, MUST CHECK. + AOJA T,NCORU4 +IFN PDP6P,[ + TLNN H,%CLS6 + JRST NCORU5 ;RANDOM DEVICE. (MAYBE DISK) +NCRUI6: MOVEI J,-1 ;PDP6, MUST CHECK. + JRST 1(T) +];PDP6P +NCORU5: JUMPL T,2(T) ;RANDOM DEVICE, SKIP TWICE IF THATS OK + JRST OPNL34 + +NCORU1: TRNE J,777400 ;CHECK FOR -1 FOR SELF. + JRST NCORU2 + ANDI J,377 + CAIN J,377 ;CHECK FOR 377 => SUPERIOR. + JRST NCORU3 +IFN PDP6P,[ ;AND FOR 376 => PDP6. + CAIN J,376 + JRST NCRUI6 +] + IMULI J,LUBLK ;ELSE WAS USRNUM, + CAMGE J,USRHI ;CHECK FOR VALID USER + SKIPN UNAME(J) + JRST OPNL35 ;IF NOT, NO SUCH JOB. + AOJA T,NCORU4 + +NCORU2: CAME J,[-1,,377777] + JRST OPNL33 + MOVEI J,(U) +NCORU4: CONO PI,CLKOFF + MOVE H,APRC(J) ;IS THE JOB WE'RE HACKING DIEING? + TLNE H,BULGOS + JRST OPNL42 ;YES, PREVENT TIMING ERRORS. + TLNE T,200000 ;UNLESS ENTRY POINT WAS NCRUI2, + JRST NCORU6 + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSH P,T + PUSHJ P,SOSSET + DIELOK(J) + POP P,T +NCORU6: CONO PI,CLKON + JRST (T) + +NCORU3: SKIPGE J,SUPPRO(U) ;GET SUPERIOR, + JRST OPNL35 + MOVEI J,(J) + AOJA T,NCORU4 + +;SKIP IF ALLOWED WRITE ACCESS TO PAGES FROM SOURCE IN J +;USE IF NCORUI ETC. SKIPS ONCE. CALL BY JSP T,. + +NCORW1: +IFN PDP6P,[ + CAIN J,-1 ;IF IT GETS THIS FAR, USER HAS A PDP6 CHANNEL, + JRST 1(T) ; THEREFORE OBVIOUSLY IS ALLOWED TO WRITE PDP6 MEMORY. +];PDP6P + CAIE J,LUBLK ;CAN GET WRITE ACCESS TO FRESH PAGE, +;SKIP IF ALLOWED TO MODIFY PAGE MAP OF TARGET JOB IN J. +NCORWR: CAIN J,(U) ;CAN DO THAT AND STICK PAGE IN SELF + JRST 1(T) + HRRZ H,SUPPRO(J) + CAIN U,(H) ;AND OUR INFERIORS + JRST 1(T) + SKIPL H,JBI(U) ;AND OUR BOJ DEVICE. + CAIE J,JBCUI(H) + JRST (T) + JRST 1(T) + +;.CBLK AC, +;(OBSOLESCENT) + ;AC 4.9 MUST BE ZERO + ;4.7 USED INTERNALLY IN CODE (W RQ ON PDP6) + ;4.3-4.1 = 0 GET PAGE FROM SELF + ; = 1 GET ABSOLUTE PAGE + ; = 2 GET PAGE FROM USER OPEN ON CH # 3.1-3.8 + ; = 3 GET PAGE FROM USER NUMBER 3.1-3.8 + ; = 4 GET PAGE + ; = 5 GET PAGE (PUBLIC) + ; = 6 MAKE PAGE PRIVATE + ; = 7 MAKE PAGE PUBLIC + ;3.9=1 REQUEST WRITE PERMISSION (IGNORED ON FRESH PAGE, OTHERWISE VALID ONLY FOR + ; SELF OR DIRECT INFERIOR OPEN ON CH OR PUBLIC PAGE) + ;3.1-3.8 USER NUMBER OR CH # (377 => CREATOR IF JOB DEVICE) + ;2.9=1 INSERT PAGE, 0 DELETE (IGNORES 4.3-4.1 EXCEPT FOR 6 OR 7 WHEN IT IS IGNORED) + ;2.1-2.8 VIRTUAL PAGE TO BE AFFECTED + ;1.1-1.9 BLOCK # IN ABSOLUTE OR OTHER USER (OR SELF IF 4.3-4.1 = 0) + +;TO CALL NCBLK, SET UP Q WITH USER INDEX REQUEST IS FOR AND U WITH +;THE USER INDEX MAKING THE REQUEST + +;NEW .CBLK CODE, PASSES THE BUCK TO CORBLK. +;SAME AS FAR AS CALLER IS CONCERNED. + +ACBLK: MOVE TT,U ;TARGET USR IDX. + UMOVE B,(J) +NCBLK0: MOVEI W,5 ;FAKE 5 ARGS TO NCORBL + LDB C,[111000,,B] ;TARGET PAGNUM. + LDB E,[1100,,B] ;SOURCE PAGNUM. + TRNN B,400000 + JRST NCBLKD ;LIKELY TO BE DELETE RQ. +NCBLK1: MOVSI A,210000 ;NOT DELETE => RQ READ, FAIL IF CAN'T. + LDB D,[221000,,B] ;SOURCE USR IDX OR CHNL NUM. + LDB H,[330300,,B] ;REQUEST TYPE-CODE. + JRST .+1(H) + + JRST NCBLKS ;TYPE 0, SOURCE IS SELF. + JRST NCBLKA ;TYPE 1, GET ABS PAGE. + JRST NCBLKC ;2, USE SPEC'D CHNL NUM. + JRST NCBLKI ;3, USE SPEC'D USR IDX. + JRST NCBLKF ;4, FRESH PAGE. + JRST NCBLKP ;5, FRESH PUBLIC PAGE. + TLOA A,420000 ;6, MAKE PRIVATE, SOURCE=TARGET. + TLO A,440000 ;7, MAKE PUBLIC, " " + MOVE E,C ;SOURCE PAGNUM _ TARGET PAGNUM, +NCBLKS: TROA D,-1 ;GET PAGE FROM SELF. (%JSELF=-1) +NCBLKA: MOVEI D,%JSABS ;GET ABS PAGE +;IF GET-FROM-CHANNEL, THE CHNL NUM IN D IS DESIRED JOB-SPEC. +NCBLKC: TLNE B,400 ;IF WRITE-RQ BIT ON, + TLO A,100000 ;INSIST ON WRITE ACCESS. +NCORBX: CAIE TT,(U) ;IF TARGET .NE. SELF, + PUSHJ P,NULSET ;FAKE OUT THOSE EXPECTING A LOSSET. + JRST NCORB9 + +NCBLKI: IORI D,%JSNUM ;GET FROM USR IDX, MAKE JOB SPEC. + JRST NCBLKC + +NCBLKP: TLO A,40000 ;GET FRESH PUBLIC PAGE. +NCBLKF: MOVEI D,%JSNEW ;GET FRESH PAGE + JRST NCBLKC + +NCBLKD: TLC B,6000 ;COME HERE IF BIT 2.9 IS 0 + TLCN B,6000 + JRST NCBLK1 ;(TYPES 6,7 IGNORE THAT BIT) + SETZB A,B ;OTHERWISE IS DELETE REQUEST. + JRST NCBLKS + +NCBLK: MOVE B,TT + MOVE TT,Q + JRST NCBLK0 + +;ACTUALLY COPY A PAGE FROM ONE MAP TO ANOTHER +;T PNTR TO MAP COPYING FROM +;TT 400000 BIT 1=> WRITE +;E TARGET PAGE # +;U TARGET USER +;B PNTR TO CIRC LIST + +NCORR1: LDB J,T ;ENTRY FROM NCORR + TRNN J,600000 + JRST ACBK3A ;PAGE NON EXISTANT OR SWAPPED OUT + TRNN TT,400000 ;WRITE RQ ? + TRZ J,400000 ;DOESN'T RQ MORE + TRNN J,600000 + TRO J,200000 ;IN CASE OF RWF +ACBK3B: MOVE A,E ;TARGET PAGE # + PUSHJ P,UPLC + LDB C,T ;GET PTW ABOUT TO BE CLOBBERED + TRZ C,PMAGEM ;TURN OFF AGE BITS + JUMPN C,[JRST 4,.] ;SHOULD HAVE DELETED PAGE BY NOW + DPB J,T ;SET UP MAP + TRNN J,600000 + JRST ACBK3C ;JUMP IF PAGE SWAPPED OUT + ANDI J,PMRCM + CAIL J,TSYSM + JRST 4,. +IFE SWPWSP, AOS MMSWP(J) ;AOS NUMBER OF USERS POINTING TO PAGE +IFN SWPWSP,[ + HRRZ TT,MMSWP(J) + AOS MMSWP(J) ;AOS NUMBER OF USERS POINTING TO PAGE + MOVSI C,1 ;ADJUST WORKING SET OF TARGET JOB + IDIV C,TT ;1,,0 IF DIVISION BY ZERO + ADDM C,UWRKST(U) + JUMPE TT,ACBK3D ;JUMP IF NO SHARERS + IMULI TT,1(TT) ;COMPUTE ADJUSTMENT TO ALL WORKING SETS + MOVSI C,-1 ;DUE TO INCREASE IN SHARING + IDIV C,TT + MOVE D,C + PUSH P,U + PUSH P,I + PUSHJ P,UCPRL7 ;CLOBBERS C,H,I,U + 400000,,SWOP6B + POP P,I + POP P,U +];SWPWSP +ACBK3D: LDB J,B ;POINTER TO PREVIOUS IN CHAIN + DPB J,Q ;PATCH + MOVE C,U + IDIVI C,LUBLK + DPB C,[101000,,A] + DPB A,B ;PATCH + AOS NMPGS(U) + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE + POPJ P, + +ACBK3A: TRNN TT,400000 + TRZ J,2 + TRO J,1 ;IN CASE OF R/W/F + JRST ACBK3B + +ACBK3C: AOS NSWPGS(U) + AOS SNSWPG + JRST ACBK3D + ACRF1: MOVE TT,B + MOVE W,Q ;INDEX OF USER THAT REQUEST IS FOR + IDIVI W,LUBLK ;CLOBBERS H + HRL TT,W + TLNE TT,600000 + JRST 4,. + JRST ACRFL + +NACRFL: PUSHJ P,LSWPOP ;UNLOCK CASW OR CIRPSW +ACRFL: PCLT + SKIPL CORRQ(U) ;CURRENT USER IN U COR RQ FOR USER IN Q + PUSHJ P,UFLS ;WAIT FOR MY CORE RQ TO CORE JOB TO CLEAR + MOVSI J,BUSRCR + MOVE T,J + TDNE T,APRC(Q) + PUSHJ P,UFLS ;SOMEBODY ELSE HAS RQ IN ON THIS JOB WAIT TO CLEAR + PUSHJ P,SWTL + CASW ;GET CORE ASSIGN SW + TDNE J,APRC(Q) + JRST NACRFL ;CHECK FOR TIMING ERROR + TLNN TT,200000 + JRST ACRF6 ;OLD TYPE + MOVNI J,1 ;ADDING ONE BLOCK + MOVEI B,105 ;FAKE OUT CORE TO ZERO CHECK + JRST ACRF8 + +ACRF6: MOVE J,HUSRAD(Q) + LSH J,-10. + CAMN J,B + JRST LSWPJ1 ;SAME AMOUNT AS NOW + MOVE T,APRC(Q) + TLNE T,BULGOS + JUMPN B,LSWPOP ;TRYING TO CORE NON-ZERO A JOB THAT IS DYING? + SUB J,B ;GET AMT OF DECREASE (- => INCREASE) + CAMGE J,[-20.] + JRST ACRF6A ;GET 20 AT A WHACK MAX +ACRF8: MOVN I,J ;I GETS POSITIVE # OF PAGES ADDED + ADD J,MEMFR + SUB J,NCBCOM ;J GETS AMT THAT WILL BE LEFT + CAIGE J,5 + JUMPG I,ACRF7 ;NOT ENUF CORE + MOVEI J,0 ;INDICATE RQ WILL BE COMPLETELY SATISFIED + CAIL I,20. + MOVNI J,1 ;MAKE SURE RQ IS REALLY FILLED +ACRF5: JUMPL I,ACRF2 ;JUMP IF DECREASING CORE + JUMPE Q,ACRF3 ;SYSTEM JOB DOESN'T USE MMP + MOVN T,I + ADDB T,MMPFR ;COMMIT SUFFICIENT NUMBER OF MMP ENTRIES + JUMPGE T,ACRF3 ;JUMP IF THAT MANY ARE AVAILABLE + ADDM I,MMPFR ;MMP FULL, DECOMMIT THE MMP ENTRIES + JRST LSWPOP ;AND TAKE ERROR RETURN + +ACRF2: AOSA NCRQL ;COUNT # REQUESTS FOR LESS +ACRF3: ADDM I,NCBCOM ;IF EXPANDING, COMMIT SUFFICIENT AMOUNT OF PHYSICAL CORE + MOVSI T,BUSRCR + IORM T,APRC(Q) ;CORING USER + MOVEM TT,CORRQ(U) + AOS NCORRQ + PUSHJ P,LSWPOP ;UNLOCK +IFN SCHBLN,[ + CONO PI,CLKOFF ;GET CORE JOB TO RUN RIGHT AWAY + MOVE I,USER ;THEN COME RIGHT BACK TO US (WHAT A CROCK THIS ALL IS) + PUSHJ P,SCHSB + MOVEI I,LUBLK + PUSHJ P,SCHSB + CONO PI,CLKON +];SCHBLN + PCLT + SKIPL CORRQ(U) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS + JUMPN J,ACRF1 ;REALLY NEED TO TAKE ANOTHER WACK AT THIS + JRST POPJ1 + +ACRF7: PUSHJ P,LSWPOP + PCLT + MOVE T,I + PUSHJ P,CFHPO3 + PUSHJ P,UFLS + TLNE TT,200000 + JRST ACRFL + JRST ACRF1 + +ACRF6A: ADDI J,20. + ADD TT,J ;GET REDUCED RQ + MOVNI J,20. + JRST ACRF8 + +SUBTTL CORE ALLOCATOR - CORE JOB ROUTINES + +CORJI: MOVE P,USRPDL+L ;SET UP CORE JOB PDL + JRST CORJOB + +CORJ2: AOSN UTBFLF + JRST UTBFF ;FLUSH UTAPE + AOSN UFDFLF + JRST UFDFF ;FLUSH 2314 UFDS + SKIPE MMPFS2 + JRST RETMM2 ;FLUSH PARTIALLY-RETURNED MMP ENTRIES + SKIPE QFBTS + JRST [ PUSHJ P,QDLFBT ;RETURN DISK BLOCKS TO FREE + SOS NCORRQ + JRST CORJOB ] + SKIPE NCRQL + JRST CORJOB ;RQ'S FOR LESS HAVE COME IN. BETTER EXECUTE THEM OR MAY NOT HAVE ENUF CORE + SKIPL CORUPU + JRST CORUP ;FOUND USER IN SEARCH WHO WANTS MORE GIVE IT TO HIM + SKIPL CORSRV + JRST CORJOB + MOVE A,LMEMFR + CAMGE A,MINCOR + PUSHJ P,CFLM1 ;FREE SOME LOW MEMORY BY SHUFFLING + SKIPLE NCORRQ + SOS NCORRQ ;CAN'T FIND ANYTHING TO DO SO DECREMENT COUNT + ;THIS CAN HAPPEN AS A RESULT OF EXCESS ATTEMPTED UTAPE FLUSHAGE + ;OR DUE TO CALLING CFLM1 +CORJOB: PUSHJ P,ACMTC ;XFER ANY "SPECIAL FREE" MEM BLOCKS TO FREE + SKIPN NCORRQ ;ANYONE WANT CORE? + PUSHJ P,[ ;IF NOT, WAIT UNTIL SOMEONE DOES, BUT FIRST + MOVE TT,QMDRO ;SEE IF MFD AND TUTS NEED TO BE READ IN + AOJE TT,IDSK + JRST UFLS ] ;WAIT + SETOM CORSRV ;INITIALIZE NO RQS SERVED THIS PASS + SETOM CORUPU + MOVNI U,LUBLK ;SCAN FOR USER WITH HIGHEST PRIORITY +CORLUP: ADDI U,LUBLK + CAML U,USRHI + JRST CORJ2 ;THRU EXAMINE RESULTS OF SEARCH + SKIPGE B,CORRQ(U) + JRST CORLUP + TLNE B,200000 + JRST CORNEW + LDB Q,[221000,,B] + IMULI Q,LUBLK + MOVE A,HUSRAD(Q) + LSH A,-10. ;COMPUTE # BLKS JOB HAS NOW + CAIN A,(B) + JRST 4,CORL1 ;SAME AS NOW, CHECKED FOR AT ACORE + CAIG A,(B) + JRST CORLUG ;INCREASE + MOVEM U,CORUPU ;DECREASE HAS PRIORITY + HRRZS B + SUB B,A + MOVEM A,CORUPS + MOVEM B,CORUPA ;DIFFERENCE + MOVEM Q,CORUUC + JRST CORUP + +CUSTOP: PUSHJ P,RPCLSR ;STOP USER WHO IS BEING CORED + MOVSI T,BUCSTP ;(THE BUCK STOPS HERE) + IORM T,USTP(A) + PUSHJ P,UPCLSR + MOVEI T,-1 ;GET MASK FOR RH + TDNE T,USTP(A) ;WAIT FOR RANDOM STOPS TO CLEAR + PUSHJ P,UFLS + POPJ P, + +;Core job initializes disks while system job stands around and supervises +;This makes it possible for system job to print any resulting error messages +;Provided no one hits ^Z too soon +IDSK: MOVE I,MDSK + MOVE U,USER + PUSHJ P,QMCH1 + MOVSI I,-NQS + SKIPL QACT(I) + PUSHJ P,QTCH1 + AOBJN I,.-2 + MOVSI TT,SCLIDK ;System is up now + IORM TT,SUPCOR + JRST CORJI + +EBLK + +CORUPU: -1 ;BEST USER SO FAR TO CHANGE CORE + ;IF SETOMED AT CORUPR, REQUEST NOT COMPLETELY FILLED +CORUPA: 0 ;INCREASE AMOUNT(1 FOR .CBLK) +CORUPS: 0 ;CURRENT SIZE +CORUUC: 0 ;USER CORE REQ ACTUALLY FOR +CORSRV: -1 ;0 => RQ SRVED THIS TIME THRU USER VARS +NCRQL: 0 ;# RQS FOR LESS + +BBLK + +CORLUG: HRRZS B ;GUY WANTS MORE GIVE GUY WHO WANTS LEAST PRIORITY + SUB B,A +CORLUH: MOVE A,NMPGS(Q) + SKIPGE CORUPU + JRST CORLG1 ;FIRST + CAMGE B,CORUPA ;IS RQ SMALLER? + JRST CORLG1 +CORLG2: CAME B,CORUPA ;OR IF TIE GIVE IT TO GUY WHO IS SMALLER NOW + JRST CORG1A + CAML A,CORUPS ;IS RQ= & SIZE SMALLER? + JRST CORG1A +CORLG1: MOVEM U,CORUPU ;HIGHEST PRIORITY SO FAR + MOVEM B,CORUPA + MOVEM A,CORUPS + MOVEM Q,CORUUC +CORG1A: JRST CORLUP + +CORNEW: LDB Q,[1100,,B] ;.CBLK TYPE RQ + IMULI Q,LUBLK + MOVEI B,1 + JRST CORLUH + +CORUP: ;EXECUTE REQUEST + MOVE U,CORUUC + MOVEM U,CUSER + SKIPL D,CORUPU + SKIPN UNAME(U) + JRST 4,. + MOVE A,CORUUC + JUMPE A,CORUP8 ;DONT USTOP SYS JOB + PUSHJ P,CUSTOP ;STOP GUY +CORUP8: PUSHJ P,SWTL + CIRPSW + MOVE TT,CORRQ(D) + TLNE TT,200000 + JRST CORUPN ;.CBLK TYPE + MOVE B,CORUPS + MOVE A,B ;A HAS CURRENT SIZE + ADD B,CORUPA ;B HAS NEW SIZE + PUSHJ P,SWTL + MEMFRZ + SKIPL J,CORUPA + JRST CORM1C ;WANTS MORE THAN NOW +CORL2: LDB A,[121100,,HUSRAD(U)] + CAMG A,B + JRST CORUPR + SOS A + PUSH P,B + PUSHJ P,UPGRTN ;RETURN USER PG + POP P,B + JRST CORL2 + +CORUPR: MOVE U,CUSER ;FINISHED FOR NOW ANYWAY REVIVE USER + SKIPN UNAME(U) + JRST 4,. +IFN E.SP,[ + CAMN U,DISUSR + PUSHJ P,E.SLPM ;LOAD PAGE MAP +] +IFN 340P,[ + CAMN U,DISUSR + PUSHJ P,DCRRST ;DIS IS RUNNING BUT UPDATE UPR ETC +] + MOVSI A,BUCSTP + ANDCAM A,USTP(U) ;RESTART USER + PUSHJ P,LSWPOP ;UNLOCK MEMORY + PUSHJ P,LSWPOP + PUSHJ P,ACMTC ;XFER IN PROCESS BLOCKS TO FREE + SKIPGE U,CORUPU + JRST CORJOB ;NOT THRU WITH THIS RQ + MOVE A,CORUUC ;THRU WITH RQ + SETOM CORUPU + SKIPGE CORUPA + SOS NCRQL ;FINISHED A REQUEST FOR LESS, DECREMENT COUNT OF THEM + MOVSI TT,BUSRCR + ANDCAM TT,APRC(A) ;CLEAR RQ PENDING THIS USER FLAG +CORL1: SETOM CORRQ(U) + CLEARM CORSRV + SOSE NCORRQ + JRST CORLUP + JRST CORJOB + +CORUPN: LDB A,[111000,,TT] + PUSHJ P,SWTL + MEMFRZ + PUSH P,A + PUSHJ P,UPGRTN + POP P,E + TLNE TT,4000 + TRNN TT,400000 + JRST 4,. + TLO E,600000+PMCSHM ;ADD FRESH PAGE + PUSH P,TT + PUSHJ P,CORGP + POP P,TT + LDB A,[111000,,TT] + PUSHJ P,UPLC + LDB B,T + TRNN B,400000 + JRST 4,. ;LOSEY + MOVE C,Q + PUSHJ P,UCPRL + 200000,,[ LDB B,[330100,,TT] + DPB B,[430100,,(C)] + POPJ P, ] ;SET TO DESIRED PUBLICNESS + SOS NCBCOM + JRST CORUPR + +CORM1C: MOVEM J,CORCNT +CORM1A: JUMPE U,CORS2 ;SNIFFLE +CORM1B: MOVE U,CORUUC + LDB E,[121100,,HUSRAD(U)] + TLO E,600000+PMCSHM + PUSHJ P,CORGP + SOS NCBCOM + SOSLE CORCNT + JRST CORM1A + JRST CORUPR + + ;INSERT FRESH PAGE INTO USR MEM IN PLACE SPECIFIED BY E PROT BITS IN LH +;MMPFR SHOULD HAVE BEEN SOS'ED ALREADY + +CORGP: JUMPN U,CORGP0 ;JUMP UNLESS GIVING PAGE TO SYS JOB + MOVE A,SJSPG ;GOBBLE PAGE RESERVED + SETZM MEMBLT(A) + CAIL A,SYSB + JRST CORGP1 ;USER VARIABLES, CLEAR IT OUT + JRST CORGP2 ;INITIAL GET OF SYSTEM, DON'T ZERO IT + +CORGP0: PUSHJ P,GMMPP ;RETN MMP PNTR IN R + JRST CORGPZ + PUSHJ P,TCALL + JRST HMEMRQ ;GET MEM, HIGH IF POSSIBLE + JRST 4,. +CORGP1: PUSHJ P,CZRR +CORGP2: AOS NMPGS(U) + AOS SNMPGS ;INCR SYS PAGE COUNT (VIRT) + PUSH P,A ;REAL CORE BLOCK # + HRRZ A,E ;ADDR IN USERS MAP + PUSHJ P,UPLC + POP P,A + LDB B,Q + SETZM MMSWP(A) + JUMPE U,CORGP3 ;IF SYS JOB, DON'T TRY TO SET UP MAP + JUMPN B,[JRST 4,.] ;ALREADY HAS PAGE + AOS MMSWP(A) ;INDICATE THAT ONE USER MAP POINTS AT THIS PAGE + TSO A,E ;SET PROTECTION BITS + DPB A,T ;STORE IN USER'S MAP + MOVE C,R ;MMP IDX + TRO R,400000 ;MAKE USERS CP POINT AT MMP + DPB R,Q +IFN SWPWSP,[ + MOVSI TT,1 ;INCREASE WORKING SET + ADDM TT,UWRKST(U) +];SWPWSP + ANDI A,PMRCM ;TURN ACCESS BITS BACK OFF +CORGP3: CAIL A,TSYSM + JRST 4,. + MOVEI TT,MURUSR + DPB TT,[MUR,,MEMBLT(A)] ;SET USER FIELD IN MEMBLT + MOVE TT,U + IDIVI TT,LUBLK + LSH TT,8 + IOR TT,E ;PG # IN USER'S MAP + SKIPN U + MOVEI TT,600000(A) ;IF SYS JOB, MEM BLOCK POINTS AT SELF + HRRZM TT,MEMPNT(A) ;ELSE MAKE MEM BLOCK POINT AT USERS MAP + JUMPE U,GHUSRA ;IF SYS JOB, NO MMP ENTRY + DPB C,[MMMPX,,MEMBLT(A)];STORE INDEX OF MMP ENTRY IN MEMBLT + TRO A,600000 + HRRM A,MMP(C) ;MAKE MMP POINT AT MEM BLOCK + PUSHJ P,CHACK ;FOR CHECKING ONLY + CAME C,[SETZ 3] ;REAL MEM, 3 ENTRIES (MMP, MEMPNT, USER) + JRST 4,. +GHUSRA: AOS E + LSH E,10. ;COMP NEW HUSRAD AFTER GETTING PAGE + TLZ E,-2 ;FLUSH PROTECT BITS (LEAVE 3.1) + CAMLE E,HUSRAD(U) + MOVEM E,HUSRAD(U) + POPJ P, + +CORGPZ: PUSH P,E ;SAVE REGISTERS + PUSH P,U + PUSHJ P,CFLM2 ;TRY TO FREE UP SOME LOW MEMORY + POP P,U + POP P,E + SKIPE LMEMFR + JRST CORGP ;SHOULD WORK NOW + PUSHJ P,LSWPOP ;MEMFRZ + PUSHJ P,LSWPOP ;CIRPSW + BUG INFO,[NO CORE AVAIL FOR MMP PAGE] + PUSHJ P,UDELAY ;Break possible infinite loop if no user pgs in low mem + SKIPG MEMFR ;WAIT FOR SWAPPER TO MAKE ROOM (PANIC!) + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW + PUSHJ P,SWTL + MEMFRZ + JRST CORGP + +PAGERT: PUSHJ P,SWTL + MEMFRZ + PUSHJ P,UPGRTN + JRST LSWPOP + +UPGRTN: PUSH P,R ;RETURN VIRT PG # IN A USER IN U + PUSH P,I + PUSH P,TT + PUSH P,E +IFN XGP,[ + PUSHJ P,UPLC ;SEE IF PAGE XGP LOCKED + LDB E,T + TRNN E,600000 + JRST UPGRT7 ;SWAPPED OUT, OBVIOUSLY NOT XGP + ANDI E,PMRCM ;E := PHYS PAGE NO + CAIL E,TSYSM + JRST UPGRT7 + IDIVI E,36. + MOVNS TT + PUSH P,T + MOVSI T,400000 + LSH T,(TT) + TDNE T,XGPMTB(E) + PUSHJ P,UFLS ;WAIT FOR XGP TO CLEAR + POP P,T +UPGRT7: ] +.ELSE PUSHJ P,UPLC ;FIND PAGE IF DIDN'T ALREADY + JUMPE U,UPGRT8 ;SYS JOB, NO SWAPPING NOR MMP ENTRY + LDB B,Q + CAIN B,-1 + JRST UPRABS ;ABSOLUTE PAGE + JUMPE B,RHUSRA ;DOESNT REALLY HAVE PG + PUSH P,T + PUSHJ P,CHACK + ADD D,MMPEAD ;D HAS MMP ADDRESS +UPGRTA: MOVSI T,MMPTMP + TDNE T,(D) + JRST UPGRTW ;WAIT FOR PAGE TO TRANSIT BUT UNLOCK SWITCHES + MOVNI I,1 ;ASSUME NO DISK SPACE + HLRZ A,1(D) ;SEE IF DISK SPACE ASSIGNED + JUMPE A,UPGRT5 + LDB I,[$MMPUN,,(D)] + PUSHJ P,QTLOCK ;LOCK APPRO TUT +UPGRT5: POP P,T ;POINTER TO ORIG MAP ENTRY OF USER + MOVE H,(T) ;SAVE MAP WORD FOR DEBUGGING + LDB TT,T ;IF PROT BITS=0 PAGE IS SWAPPED OUT FOR PURPOSES + MOVEI E,0 ;OF USER'S SWAP OUT COUNT, EVEN IF IN CORE + DPB E,T ;CLEAR USER MAP ENTRY + TRCN TT,600000 ;IS USER MAPPED TO PAGE? + JRST UPGRT9 + MOVSI E,MMPWRT ;YES, CHECK IF ACCESS BITS = RW + TRNN TT,600000 + IORM E,(D) ;PAGE WRITTEN BY USER WHO HAS DETACHED IT + ANDI TT,PMRCM ;MASK TO MEM PAGE # + CAIE TT,(J) + JRST 4,. ;PTW POINTED TO WRONG PAGE + MOVSI E,MMPOUT+MMPTMP + TDNE E,(D) + JRST 4,. ;PAGE NOT IN, IN MMP +IFE SWPWSP, SOS MMSWP(J) ;ONE LESS USER POINTING AT PAGE +IFN SWPWSP,[ + HRRZ E,MMSWP(TT) ;DECREASE THIS USER'S WORKING SET + MOVSI T,-1 + IDIVM T,E + ADDM E,UWRKST(U) + SOS MMSWP(TT) + HRRZ E,MMSWP(TT) + JUMPE E,UPGRTB ;JUMP IF NO OTHER SHARERS, FOR SPEED AND NO ZERODIVIDE + PUSH P,C ;ADJUST OTHER SHARER'S WORKING SETS + PUSH P,D + PUSH P,I + PUSH P,U + IMULI E,1(E) + MOVSI D,1 + IDIV D,E + PUSHJ P,UCPRL7 ;CLOBBERS H ALSO C,T,U,I + 400000,,SWOP6F + POP P,U + POP P,I + POP P,D + POP P,C +];SWPWSP + JRST UPGRTB + +;RETURNING A PAGE TO WHICH USER IS NOT CURRENTLY MAPPED (MAY BE IN OR OUT) +UPGRT9: SOS NSWPGS(U) + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + JUMPGE C,UPGRT4 ;NO MEM IN CP S, PAGE REALLY SWAPPED OUT +;RETURNING A PAGE WHICH IS SWAPPED IN +UPGRTB: HLRE E,MMSWP(J) ;GET # EXEC PGS POINTING TO THIS + JUMPL E,[JRST 4,.] ;<0 EXEC PAGES + JUMPE E,UPGRT4 ;NO EXEC PGS POINTING TO THIS + PUSH P,J + MOVE TT,J + MOVSI T,-NEXPGS ;LOOK FOR EXEC PGS SET UP TO PNT + MOVE E,[442200,,EXEUMP] ;TO USER PAGE FLUSHED +UPGRT3: ILDB J,E + TRZN J,600000 + JRST UPGRT2 + ANDI J,PMRCM + CAMN TT,J + JRST UPGRT1 +UPGRT2: AOBJN T,UPGRT3 +IFN E.SP,[ + MOVSI T,-1 + TDNE T,MMSWP(TT) + PUSHJ P,E.SPRT ;SEE IF E&S HAS IT +] +IFN XGP,[ + MOVSI T,-1 + TDNE T,MMSWP(TT) ;FLUSH XGP TIE DOWNS AND RETURN + PUSHJ P,XGPCFL +] + POP P,J +UPGRT4: LDB T,Q ;DELINK CIRC PNTR + DPB T,B + MOVEI T,0 + DPB T,Q ;CLOBBER CIRC P + SOS NMPGS(U) + SOS SNMPGS ;SYSTEM HAS 1 LESS PAGE + CAME C,[SETZ 3] + CAIN C,2 + JRST MMPRTN ;RETURN MMP ENTRY SINCE PAGE NO LONGER IN USE +MMPRT4: MOVE A,J + CAMN C,[SETZ 3] + JRST MMPRT5 ;FLUSH REAL MEM +MMPRT6: SKIPL I + PUSHJ P,QTULK +RHUSRA: POP P,E + POP P,TT + POP P,I + POP P,R +RHUSR1: LDB A,[121100,,HUSRAD(U)] ;COMP HUSRAD AFTER RETURNING PAGE + JUMPE A,CPOPJ + SOS A + PUSHJ P,UPLC + LDB B,Q + JUMPN B,CPOPJ ;FOUND ACTIVE PAGE + MOVNI C,2000 ;KEEP LOOKING + ADDM C,HUSRAD(U) + JRST RHUSR1 + +UPGRT8: SOS NMPGS ;RETURNING PAGE FROM SYS JOB + SOS SNMPGS + DPB A,[121100,,HUSRAD(U)] ;NORMAL METHOD OF COMPUTING HUSRAD WON'T WORK + MOVNI I,1 ;NO DISK SPACE +MMPRT5: SKIPE MMSWP(A) ;MAKE SURE NO ONE (EXEC OR USER) IS POINTING AT PAGE + JRST 4,. + PUSHJ P,CMEMR ;HAS REAL MEM, CIRC LENGTH =3 SO FLUSH MEM + JRST MMPRT6 + +UPRABS: +IFN TEN11P,[ + LDB B,T + LDB E,[.BP B] ;GET MOBY # + CAIE E,T11CPA_-18. + JRST UPRAB1 + ANDI B,377 + PUSHJ P,T11DL ;DELETE PAGE REF TO TEN11 MAP +UPRAB1:] + MOVEI B,0 + DPB B,Q + DPB B,T + JRST RHUSRA + +IFN E.SP,[ +;TT/MMSWP INDEX +E.SPRT: CAME U,DISUSR ;IS HE USING THE DISPLAY? + POPJ P, ;NO, DON'T UNTIE ANYTHING + PUSH P,H + MOVE T,TT ;FOR E.SPCH + PUSHJ P,E.SPCH ;LOOK IN E&S TABLES + SKIPA ;FOUND, INDEX IN H + JRST E.SPR2 ;NOT FOUND, DO NOTHING + MOVSI T,-1 + ADDM T,MMSWP(TT) ;SOS COUNT + SETZM DISSWP(H) ;CLEAR DISPLAY MMSWP TABLE + AOS E.SNUT ;COUNT FOR UNTIES +E.SPR2: POP P,H + POPJ P, +] +UPGRT1: MOVSI J,-1 + XCT EXPFT(T) ;MAYBE XFERR TO ROUTINE TO DO SOMETHING ABOUT THIS + JRST UPGRT6 ;NOT USER CONCERNED ABOUT (THERE HAD BETTER BE ANOTHER) + MOVEI J,0 + DPB J,E ;CLEAR OUT EXEC PAGE ENTRY + MOVE J,USER + CLRPGM (J) +UPGRT6: CONO PI,UTCON + JRST UPGRT2 + +;WAIT FOR PAGE TO TRANSIT, WITH CIRPSW FREE (IN CASE SWAP READ ERROR!) +;COME HERE WITH T/MMPTMP,, D/MMP.ENTRY.ADDR +UPGRTW: MOVE B,D +NCRMMW: MOVE U,USER + PUSHJ P,LSWCLR + PCLT + TDNE T,(B) + PUSHJ P,UFLS ;WAIT FOR ACTIVE PAGE TO SETTLE DOWN + CAIE U,LUBLK ;SKIP IF CORE JOB + JRST UUOTROLL ;AS IF PCLSR'ED OUT OF WAIT FOR PAGE & CAME BACK + SETOM CORUPU ;REQUEST FOR THIS USER NOT SATISFIED + MOVE P,USRPDL+LUBLK ;CLEAN UP AND RE INIT CORE JOB + PUSHJ P,NULSET + PUSHJ P,NULSET + JRST CORUPR + +EXPFT: +IFN 340P, REPEAT 2+N340PB, PUSHJ P,DISACR + REPEAT 2,JFCL ;CORJF, CORJT +IFN VIDP, REPEAT 2,PUSHJ P,SCNACR +IFN TEN11P, JRST 4,. ;TEN-11 CONTROL PAGE + JRST 4,. ;PAREP +IFN ECCMEM, JRST 4,. ;ECCPG +IFN XGP, REPEAT 3,JRST 4,. +IFN N11TYS, REPEAT NTTPG+NTVBP,JRST 4,. +IFN CHAOSP, IFN T11CHP, JRST 4,. + REPEAT NMMP,JRST 4,. ;MMP +IFN .-EXPFT-NEXPGS, .ERR LOSE AT EXPFT + ;CIRCULAR MEM LIST HACKER +;CALL WITH Q CONTAINING BYTE POINTER TO CIRC PNTR IN LIST TO BE HACKED +;THE BYTE POINTER MUST POINT AT A UPGCP ENTRY (RATHER THAN MEMPNT OR MMP) +;OR THIS CODE WILL LOOP FOREVER. +;RETN BYTE PNTR IN B TO GUY WHO PNTS TO THAT PNTR +;COUNT FOR ENTRIES IN C (RH) +; 4.9 C SAYS ACTUAL MEM IN LOOP +;RETN IN D MMP INDEX +;RETURN MEM PAGE IF ANY IN J +;CLOBBERS H,I,W + +CHACK: PUSH P,A + LDB J,Q ;PICK UP STARTING C. P. + SETZM C + MOVNI D,1 + MOVE B,Q +CHACK1: JUMPE B,[JRST 4,.] + AOS C + CAIE J,-1 ;SKIP ON ABS PAGE + TRNE C,776000 + JRST 4,. ;CIRC CHAIN TOO LONG? + TRZE J,400000 + JRST CHACK3 ;MEMPNT OR MMP PNTR + LDB I,[1000,,J] ;PG # + LDB H,[101100,,J] ;USER # + IMULI H,LUBLK + SKIPE UNAME(H) + CAML H,USRHI + JRST 4,. ;POINTER TO NON-EXISTENT USER + MOVEI W,UPGCP(H) + ROT I,-1 + ADDI W,(I) + HRLI W,222200 + SKIPGE I + HRLI W,2200 + CAMN W,Q + JRST CHACK2 ;FOUND ENTRY WHICH PNTS AT ORIGINAL ENTRY + LDB J,W + MOVE B,W + JRST CHACK1 ;KEEP LOOKING + +CHACK2: MOVE J,A + JUMPL D,[JRST 4,.] ;NO MMP ENTRY ? + JRST POPAJ + +CHACK3: TRZE J,200000 + JRST CHACK4 ;ACTUAL CORE + CAML J,MMPMX + JRST 4,. ;GARBAGE POINTER + MOVSI B,2200 ;MMP ENTRY + HRR B,MMPEAD + ADDI B,(J) + JUMPGE D,[JRST 4,.] ;MORE THAN 1 MMP ENTRY + MOVE D,J + LDB J,B + JRST CHACK1 + +CHACK4: TLOE C,400000 + JRST 4,. ;PAGES IS IN TWO PLACES IN CORE + CAIL J,TSYSM + JRST 4,. ;GARBAGE POINTER + MOVE A,J ;SAVE MEMBLT INDEX + MOVSI B,2200 + HRRI B,MEMPNT + ADDI B,(J) + LDB J,B + JRST CHACK1 + +;LOOK UP PAGE IN USER MAP +;USER IN U, VIR PG # IN A +;GET PNTR TO MAP HW IN T, TO CIRC IN Q + +UPLC: SKIPL A + CAIL A,400 + JRST 4,. ;BAD VIRTUAL PAGE NUMBER + PUSH P,A + MOVEI Q,UPGCP(U) + MOVEI T,UPGMP(U) + ROT A,-1 + ADDI T,(A) + HRLI T,222200 + SKIPGE A + HRLI T,2200 + ADDI Q,(A) + HLL Q,T + JRST POPAJ + +;FREE THE MMP ENTRY D POINTS AT, SOSING TUT IF DISK SPACE ASSIGNED. +;I HAS DSK #, C HAS WHAT CHACK RETURNED IN C, A HAS TRACK #. +;TUT MUST BE LOCKED ALREADY. CIRPSW AND MEMFRZ SHOULD BE LOCKED. +;EXIT TO MMPRT4 OR RHUSRA + +MMPRTN: MOVEM C,MMPRTC ;SAVE IN CASE OF BUG HALT LATER + JUMPL I,MMPRT3 ;NO DISK SPACE ASSIGNED + PUSH P,B + LDB B,[$MMPUN,,(D)] + CAME B,I + JRST 4,. ;WRITING WRONG DISK + MOVE H,D ;H SAVES POINTER TO MMP ENTRY + MOVE D,A ;D GETS DISK TRACK NUMBER + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] ;DETECT OVER-SOS + DPB B,D + EXCH D,H ;D GETS MMP PNTR, H GETS TUT BYTE PNTR + JUMPN B,MMPRT2 + MOVE T,QTUTO(I) + CAML A,QSWAPA(T) + AOS QSFT(I) + CAMGE A,QSWAPA(T) + AOS QSFTS(I) +MMPRT2: MOVE T,DCHBT(I) + IORM T,QTUTO(I) + MOVE A,(D) ;ELSE DELETE MMP ENTRY NOW + SKIPGE C + JUMPN B,MMPRT0 ;IF PG IS IN FILE, AND SWAPPED IN, MAYBE WRITE OUT. + TLNN A,MMPSHR + JRST MMPRT8 + HLRZ A,1(D) ;ALSO REMOVE FROM SHAREABLE PAGE TABLE + HRL A,I + IDIVI A,SHRHSL + ADDI B,SHRHSH-1 +MMPRT7: MOVE A,B + HRRZ B,1(B) + JUMPE B,[JRST 4,.] + CAME B,D + JRST MMPRT7 + HRRZ B,1(B) + HRRM B,1(A) +MMPRT8: POP P,B + JUMPL C,MMPRT3 ;WAS MEM IN LOOP SO NOT SWAPPED OUT FOR SYSTEM'S COUNT + SOS NPGSWO ;IT WAS SWAPPED OUT +MMPRT3: PUSHJ P,MMPRT1 + SOS MMPCNT ;1 LESS IN USE + AOS MMPFR ;1 MORE FREE + JRST MMPRT4 + +;FLUSHING AN MMP ENTRY FOR A PAGE SHARED WITH A FILE WHICH IS CURRENTLY IN CORE. +;WE MAY WANT THIS PAGE AGAIN, SO TRY TO KEEP IT AROUND FOR A WHILE. +;BUT IF PAGE HAS BEEN MODIFIED, IMMEDIATELY SWAP IT OUT SO FILE GETS UPDATED. + +MMPRT0: POP P,B + LDB C,H ;UN-SOS THE TUT + CAIGE C,TUTMNY ;DON'T OVER-AOS + AOS C + DPB C,H + PUSHJ P,QTULK + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(J) + SKIPE C,LLOOSP ;ADD TO TAIL OF LOOSE PAGE LIST + DPB J,[MLO,,MEMBLT(C)] + MOVEM J,LLOOSP + SKIPN C + MOVEM J,FLOOSP + AOS NLOOSP + TLNN A,MMPWRT + JRST RHUSRA + PUSH P,U ;PAGE WAS MODIFIED, SWAP IT OUT RIGHT AWAY + CONO PI,CLKOFF ;CALL SWAPPER AT IMITATION CLOCK LEVEL + MOVEM J,SWOBK + MOVEM D,SWOMMP + AOS CIRPSW ;SWOP1A WILL SOS IT BEFORE RETURNING + PUSHJ P,SWOP1A ;WILL RETURN THE MMP ENTRY SINCE NO USERS ARE LINKED TO IT + JRST 4,. ;EXEC PAGES STILL POINT TO PAGE, ALTHOUGH UPGRTN FLUSHED THEM + CONO PI,CLKON + POP P,U + JRST RHUSRA + +;HERE TO RETURN AN MMP ENTRY AND SOS THE TUT, AT P.I. LEVEL +;IF TUT OR CIRPSW IS LOCKED, PUTS ON MMPFS2 AND WAKES UP CORE JOB +;OTHERWISE, CLEARS OUT AND PUTS ON MMPFS +;A -> MMP ENTRY, CLOBBERS B,D,E,I + +RETMMP: PI2SAF + LDB I,[$MMPUN,,(A)] + SKIPGE CIRPSW + SKIPGE QTUTO(I) + JRST RETMM1 ;CAN'T SET LOCKS, LET CORE JOB DO IT +RETMM0: HLRZ D,1(A) + PUSHJ P,TUTPNT ;SOS THE TUT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + JUMPN B,RETMM7 + MOVE E,QTUTO(I) ;RETURNING BLOCK TO FREE, AOS APPROPRIATE FREE COUNT + HLRZ D,1(A) + CAML D,QSWAPA(E) + AOSA QSFT(I) + AOS QSFTS(I) +RETMM7: MOVSI D,MMPSHR + TDNN D,(A) + JRST RETMM6 + HLRZ D,1(A) ;REMOVE FROM SHAREABLE PAGE HASH TABLE + HRL D,I + IDIVI D,SHRHSL + MOVEI D,SHRHSH-1(E) +RETMM5: MOVE E,D + HRRZ D,1(D) + JUMPE D,[JRST 4,.] ;NOT IN TABLE OR MIS-HASHED? + CAME D,A + JRST RETMM5 + HRRZ D,1(D) + HRRM D,1(E) +RETMM6: MOVE D,A + SOS MMPCNT + AOS MMPFR +MMPRT1: EXCH D,MMPFS ;ADD THIS ENTRY ONTO THE FRONT OF + MOVE A,MMPFS ;THE LIST OF AVAILABLE MMP ENTRIES + MOVEM D,(A) ;CLEAR LH OF FIRST WORD OF ENTRY + SETZM 1(A) ;CLEAR SECOND WORD OF ENTRY + POPJ P, + +RETMM1: MOVE D,A ;ADD THIS ENTRY TO LIST OF ONES TO HACK LATER + EXCH D,MMPFS2 + HRRM D,(A) ;ONLY CLOBBER THE CIRC PNTR, WHICH POINTS TO SELF + SKIPN D + AOS NCORRQ ;LIST WAS EMPTY, AWAKEN CORE JOB + POPJ P, + +;CORE JOB COMES HERE WHEN MMPFS2 IS NON-ZERO + +RETMM2: SOS NCORRQ + PUSHJ P,SWTL + CIRPSW + PUSHJ P,RETMM4 + PUSHJ P,LSWPOP + JRST CORJOB + +RETMM4: MOVEI A,0 ;HERE, WITH CIRPSW LOCKED, TO FINISH RETURNING MMP ENTRIES + EXCH A,MMPFS2 +RETMM3: JUMPE A,CPOPJ + LDB I,[$MMPUN,,(A)] + PUSHJ P,QTLOCK + HRRZ H,(A) + PUSHJ P,RETMM0 + PUSHJ P,QTULK + MOVE A,H + JRST RETMM3 + +;GET AN MMP ENTRY, RET. IDX IN R, ADDR IN TT. +;CLEARS BOTH WDS OF MMP ENTRY. CLOBBERS NO ACS. +;SKIPS IF SUCCESSFUL. DOESN'T SKIP IF NO LOW CORE FOR NEW MMP PAGE. +;YOU BETTER ALREADY HAVE COMMITTED THE MMP ENTRY VIA SOSGE MMPFR + +GMMPP: HRRZ TT,MMPFS + JUMPE TT,GMMP1 ;FREE LIST IS EMPTY + CAMGE TT,MMPEAD + JRST 4,. ;IDX GOT ON FREE LIST; SHOULD BE ADDR + MOVE R,TT + SUB R,MMPEAD + CLEARM 1(TT) + HRL TT,(TT) + CLEARM (TT) + HLRZM TT,MMPFS + AOS MMPCNT ;1 MORE MMP ENTRY IN USE. + JRST POPJ1 + +GMMP1: SKIPN MMPFS2 + JRST GMMP4 + PUSH P,A ;PROTECT ACS CLOBBERED BY RETMM4 + PUSH P,B + PUSH P,D + PUSH P,E + PUSH P,H + PUSH P,I + PUSH P,T + PUSHJ P,RETMM4 + POP P,T + POP P,I + POP P,H + POP P,E + POP P,D + POP P,B + POP P,A + JRST GMMPP + +GMMP4: PUSH P,A ;CREATE ANOTHER PAGE-FULL OF MMP ENTRIES + PUSH P,B + PUSH P,D + PUSHJ P,TCALL + ;JRST IOMQ ;ALLOCATE LOW CORE SO GETS DUMPED WITH CRASHES + JRST NMMRQ ;IOMQ LOSES BECAUSE WE GET CALLED WITH MEMFRZ LOCKED + ;NMMRQ ISN'T QUITE RIGHT, BECAUSE OF NCBCOM. FIX LATER. --- + JRST GMMP3 ;NO LOW CORE AVAIL NOW + MOVEI B,MUMMP + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,2000 + ADDM B,MMPMX ;INCREMENT MAX ALLOWABLE ADDR OF MMP + AOS B,MMPNP + CAILE B,NMMP + JRST 4,. ;SOMEONE DIDN'T CHECK MMPFR? + MOVEM A,MMMPG-1(B) + TRO A,600000+PMCSHM + DPB A,MMPPPP-1(B) ;PUT NEW MMP PAGE INTO EXEC MAP + MOVE D,USER + CLRPGM (D) + SOS B + LSH B,10. + HRLI B,-1000 +GMMP2: MOVEI D,MMP(B) ;PUT ALL ENTRIES IN PAGE ON THE FREE LIST + PUSHJ P,MMPRT1 + AOS B + AOBJN B,GMMP2 + POP P,D + POP P,B + POP P,A + JRST GMMPP + +GMMP3: POP P,D + POP P,B + POP P,A + POPJ P, + +;HERE IF TRANSIENT CONDITION PREVENTS GRABBING PAGE RIGHT NOW + +CORS18: MOVE T,LSWPR+LUBLK + CAIE T,MEMFRZ + JRST 4,. + PUSHJ P,LSWPOP ;MEMFRZ + PUSHJ P,UDELAY + PUSHJ P,ACMTC + PUSHJ P,SWTL + MEMFRZ + +;GROW A JOB'S CONTIGUOUS MEMORY. USED ONLY FOR SYSTEM JOB THESE DAYS. + +CORS2: +IFN XGP,[ + SKIPL XGPUSR ;AVOID EXPANDING INTO XGP PAGE. + PUSHJ P,UFLS +] + LDB J,[121100,,HUSRAD(U)] + LDB E,[MUR,,MEMBLT(J)] + CAIN E,MUFR + JRST COSFR ;FREE PAGE, TAKE IT. + CAIE E,MUINP + CAIN E,MUFRT + JRST CORS18 ;WAIT UNTIL IT STABILIZES + CAIN E,MUSWPG + JRST CORS18 ;WAIT UNTIL IT GETS WHERE IT'S GOING + CAIE E,MURUSR ;USER PAGE, SHUFFLE IT AWAY. + JRST 4,. ;SHOULDN'T HAVE TO SHUFFLE SYSTEM PAGES. + +;SHUFFLE A USER PAGE +CORS4: PUSHJ P,TCALL + JRST HMEMRQ ;GET FREE PAGE TO SHUFFLE IT INTO + JRST 4,. ;THERE OUGHT TO BE ONE + PUSHJ P,CORS5 + JRST CBMRT + +;Shuffle user page in J into page in A +;Clobbers C,D,E,H,I,Q,U,T +CORS5: MOVE D,A + SKIPGE E,MMSWP(J) + JRST 4,. ;BLOCK IS ON SWAP OUT LIST (??) + TRNN E,-1 + PUSHJ P,CORS6 ;SHUFFLING A POSSIBLY LOOSE PAGE, FIX POINTERS + SETOM DLSRCH ;CAN'T BE BEING SWAPPED OUT ETC BECAUSE SWAPOUT + PUSHJ P,UCPRL7 ;BLOCKS HAVE MUR=MU23B, AND CIRPSW IS SIEZED + SETZ CORSTU ;STOP DIRECT TO MEM DEVICES AND FIX USER MAPS + TLC C,200 ;CHANGE TO 20 BIT BYTE + DPB D,C ;RELOCATE PTR TO MEMPNT ENTRY + PUSHJ P,CMOVE1 ;MOVE CONTENTS OF BLOCK + MOVSI C,-NEXPGS + MOVE T,[442200,,EXEUMP] + PUSHJ P,CORPS1 ;FIX ANY EXEC PAGE MAP PNTRS TO THIS PAGE + PUSHJ P,UCPRL4 + SETZ DEVSTR ;RESTART DIRECT TO MEM DEVICES + SETZM DLSRCH ;MAPS ARE CONSISTENT AGAIN, LET USERS RUN + POPJ P, + +CORSTU: PUSHJ P,DEVSTP ;STOP DIRECT-TO-MEM DEVICES + MOVE A,I ;COMPUTE USER'S MAP ENTRY LOCN + PUSHJ P,UPLC + LDB C,T + TRNN C,600000 + POPJ P, ;PAGE SWAPPED IN BUT NOT YET LINKED UP + ANDI C,PMRCM + CAIE C,(J) + JRST 4,. + TLC T,2200# ;CHANGE TO ADDRESS REAL CORE ADR FIELD + DPB D,T ;RELOCATE USER'S MAP + POPJ P, + +COSFR: MOVE D,J + PUSHJ P,MEMMF +CBMRT: MOVEM J,SJSPG ;SAVE PAGE # RESERVED + JRST CORM1B + +;CORE SHUFFLER, TO KEEP LOW MEMORY FREE +CFLM1: PUSHJ P,SWTL + CIRPSW + PUSHJ P,SWTL + MEMFRZ + PUSHJ P,CFLM2 + PUSHJ P,LSWPOP ;MEMFRZ + JRST LSWPOP ;CIRPSW + +CFLM2: MOVEI J,LIOBLK ;Scan through "low" memory + SKIPE MEMHPT ;Make sure there is likely to be free high mem + JRST CFLM4 + AOS SWPOPR ;Kick swapper more than kicked already + POPJ P, ;And give up + +CFLM3: CAIN J,128. + MOVEI J,128.+NEXPGS + CAIL J,256. ;Assume USEMDM is always on (safe assumption) + POPJ P, ;All done, couldn't find anything +CFLM4: LDB A,[MUR,,MEMBLT(J)] + CAIE A,MURUSR + AOJA J,CFLM3 + PUSHJ P,TCALL + JRST HMEMRQ ;Get free page to shuffle it into + POPJ P, ;No memory free, give up for now + PUSHJ P,CORS5 ;Shuffle page into new memory + MOVE A,J ;Free old page + PUSHJ P,CMEMR + MOVE A,LMEMFR + CAMGE A,MINCOR + AOJA J,CFLM3 + POPJ P, ;Freed sufficient low pages, stop now + +;STOP DIRECT TO MEM DEVICES + +DEVSTP: +IFN VIDP,[ + CAMN U,SCNUSR ;STOP DIRECT MEM DEVICES + PUSHJ P,SCNSTC ;STOP DIRECT VIDI INPUT +] +IFN 340P\E.SP,[ + CAMN U,DISUSR ;STOP DISPLAY IF THIS GUY HAS IT + PUSHJ P,DCRSTP +] + POPJ P, + +;RESTART DIRECT TO MEM DEVICES + +DEVSTR: CLRPGM +LUBLK ;CLEAR PAGE MAP ASSOC REGS IN HARDWARE +IFN VIDP,[ + CAMN U,SCNUSR ;RESTART DIRECT MEM DEVICES + PUSHJ P,SCNRST ;RESTART DIRECT VIDI INPUT +] +IFN 340P\E.SP,[ + CAMN U,DISUSR + PUSHJ P,DCRRST ;RESTART DISPLAY +] + POPJ P, + +;HERE TO RELOCATE EXEC PAGES WHICH POINT TO PAGE IN J + +CORPS1: MOVEI I,0 +CORPS4: ILDB Q,T + TLC T,2200# ;CHANGE SIZE FIELD TO ADDRESS REAL CORE ADR + ANDI Q,PMRCM + CAME Q,J + JRST CORPS3 + AOS I ;COUNT # OF EXEC PGS POINTING TO THIS ONE + DPB D,T ;RELOCATE EXEC PG PNTR +CORPS3: TLC T,2200# ;CHANGE SIZE BACK TO 22 + AOBJN C,CORPS4 + HLRZ T,MMSWP(D) + CAMN T,I ;CHECK COUNT OF EXEC PAGES + POPJ P, ;COUNTED CORRECTLY, WIN + +IFN E.SP,[ ;SEE IF E&S CAN ACCOUNT FOR SOME PAGES + MOVSI Q,-MXDISP ;SET UP INDEX + CAMN J,DISSWP(Q) ;J/ OLD INDEX, D/ NEW + AOJA I,E.SX2 ;COUNT I IF FOUND, AND RECHECK COUNT + AOBJN Q,.-2 ;ELSE CONTINUE SEARCH + JRST 4,. ;NOT FOUND, BOMB +E.SX2: MOVEM D,DISSWP(Q) ;RELOCATE PAGE + AOS E.SREL ;# PAGES RELOCATED (FOR DEBUGGING) + CAMN T,I ;SKIP IF COUNT IS STILL BAD + POPJ P, ;E&S COUNT WAS CULPRIT -- HAPPY AGAIN +] +IFN XGP,[ + PUSH P,A + PUSH P,B + MOVE B,J + PUSHJ P,XGPBIT + TDNE A,XGPMTB(B) + AOS I + CAMN I,T + JRST POPBAJ +] + JRST 4,. ;EXEC PGS COUNT OFF + +CORS6: MOVE T,FLOOSP ;FIX POINTERS TO LOOSE PAGE BEING SHUFFLED +CORS7: SKIPN C,T + JRST CORS8 + LDB T,[MLO,,MEMBLT(C)] + CAME T,J + JRST CORS7 + DPB D,[MLO,,MEMBLT(C)] +CORS8: CAMN J,FLOOSP + MOVEM D,FLOOSP + CAMN J,LLOOSP + MOVEM D,LLOOSP + POPJ P, + +;RUN AROUND CIRC LIST STRUCTURE +;WORD AFTER CALL IS POINTER TO ROUTINE TO BE CALLED FOR EACH ITEM IN LIST ACCORDING +;TO FLAGS IN LH: 4.9 USER PAGE (U=USER,I=PG#), 4.8 MMP (T=IDX), 4.7 MEMPNT (T=PG#) +;CALLED ROUTINE MUSTN'T CLOBBER C,H; NOR U,I IF A USER PAGE; NOR T IF MEMPNT. +;RETURNS IN C BYTE POINTER TO PLACE THAT POINTS TO +;STARTING BYTE POINTER THAT WAS IN C +;ENTRIES: +; UCPRL - STARTING BYTE POINTER IN C +; UCPRL4 - STARTING CORE PAGE # IN D +; UCPRL7 - STARTING CORE PAGE # IN J +;PDL DEEPENED BY TWO PUSH'S AND TWO PUSHJ'S. +;---WARNING--- : CLOBBERS U ------- ALSO CLOBBERS H,T,I + +UCPRL7: SKIPA C,[2200,,MEMPNT(J)] +UCPRL4: MOVE C,[2200,,MEMPNT(D)] +UCPRL: MOVE H,@(P) + HRRI C,@C + TLZ C,37 + PUSH P,C + PUSH P,C + JRST UCPRL5 + +UCPRL2: CAMN C,-1(P) + JRST UCPRL6 + MOVEM C,(P) +UCPRL5: LDB T,C + JUMPE T,[JRST 4,.] + TRZE T,400000 + JRST UCPRL1 + LDB I,[1000,,T] ;PAGE # + LDB U,[101100,,T] ;USER # + IMULI U,LUBLK + CAML U,USRHI + JRST 4,. + SKIPGE H + PUSHJ P,(H) + MOVEI C,UPGCP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + JRST UCPRL2 + +UCPRL1: TRZE T,200000 + JRST UCPRL3 + CAML T,MMPMX + JRST 4,. ;MMP ADR OUT OF RANGE + MOVSI C,2200 ;MMP + HRR C,MMPEAD + ADDI C,(T) + TLNE H,200000 + PUSHJ P,(H) + JRST UCPRL2 + +UCPRL3: CAIL T,TSYSM + JRST 4,. ;MEMBLT ADR OUT OF RANGE + TLNE H,100000 ;MEMPNT + PUSHJ P,(H) + MOVE C,[2200,,MEMPNT] + ADDI C,(T) + JRST UCPRL2 + +UCPRL6: MOVE C,(P) + SUB P,[2,,2] + JRST POPJ1 + ;DISCARD IDLE DISK UFD'S. + +UFDFF: PUSHJ P,SWTL + UDRSW + MOVEI C,MEMR + PUSHJ P,QDFLS + JRST UTBFF5 + +;FLUSH "UTAPE" (200-WD) BUFFERS +;TRY TO COMPACTIFY INTO FEWER PAGES BY DELETING PAGES CONTAINING +;ONLY FREE ONES AND BY MOVING NETWORK BUFFERS AROUND. OTHER KINDS +;OF BUFFERS DON'T STAY AROUND VERY LONG AND ARE HARD TO MOVE +;WITHOUT INTRODUCING TIMING/PCLSR'ING BUGS. + +UTBFF: PUSHJ P,SWTL + MEMFRZ + MOVSI J,-TSYSM +UTBFF3: LDB R,[MUR,,MEMBLT(J)] + CAIN R,MUIOB + PUSHJ P,UTBFF2 + AOBJN J,UTBFF3 +UTBFF5: SOS NCORRQ + PUSHJ P,LSWPOP +IFN CHAOSP, PUSHJ P,CHCLN ;ALSO, CLEAN UP CHAOS NET BUFFERS +IFN INETP, PUSHJ P,PKBCLN ; Clean up network packet buffers +;SWAP OUT ALL LOOSE PAGES. THE REASON THIS IS DONE IS THAT IF THE +;SYSTEM LOAD IS LIGHT LOOSE PAGES FOR DELETED INQUIR DATA BASE FILES +;CAN STAY AROUND INDEFINITELY, TYING UP DISK SPACE. +;SWAPPING OUT LOOSE PAGES DOES NOT CAUSE ANY DISK I/O. +;SWPOPG MAY NON-SKIP RETURN IF CIRPSW OR A TUT IS LOCKED, +;IN WHICH CASE WE GIVE UP UNTIL THE NEXT 2-MINUTE CLOCK. +UTBFF6: CONO PI,CLKOFF + SKIPN A,FLOOSP ;GET A LOOSE PAGE + JRST UTBFF7 + MOVNI C,1 + PUSHJ P,SWPOPL ;SWAP OUT EVEN IF LOCKED (SHOULDN'T BE) + JRST UTBFF7 ;COULDN'T SWAP OUT, GIVE UP FOR NOW + CONO PI,CLKON ;ALLOW CHANCE FOR AN INTERRUPT + JRST UTBFF6 + +UTBFF7: CONO PI,CLKON + JRST CORJOB + +;RH(J) HAS PAGE NUMBER OF A BLOCK OF 200-WD BUFFERS +UTBFF2: LDB R,[MNUMB,,MEMBLT(J)] ;GET LIST OF IOBFT ENTRIES IN THIS BLOCK + CLEARB Q,TT +COSIO1: MOVSI E,200000 ;ALLOC INH ALL BUFFERS IN BLOCK + IORM E,IOBFT(R) + LDB E,[IOCH,,IOBFT(R)] + CAIE E,77 + AOS Q ;COUNT NUMBER USED FOR SOMETHING + CAIL E,NFNETC + CAIL E,NFNETC+NNETCH + CAIA + AOS TT ;COUNT NUMBER USED FOR NETWORK + LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST COSIO1 + JUMPE Q,COSIO3 ;IF ALL BUFFERS FREE, FLUSH THIS PAGE + CAME Q,TT + JRST UTBFF1 ;CONTAINS NON-NET BUFFERS, LEAVE ALONE + MOVEI E,0 + EXCH E,UTTBF + CAIL E,8 ;IF THERE ARE ENOUGH FREE IN OTHER BLOCKS + JRST CISHUF ;THEN GO SHUFFLE THE NET BUFFERS + EXCH E,UTTBF +UTBFF1: LDB R,[MNUMB,,MEMBLT(J)] ;ABANDON IDEA OF FLUSHING THIS BLOCK + MOVSI E,200000 ;UN-INHIBIT THE BUFFERS.. +UTBFF4: ANDCAM E,IOBFT(R) + LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST UTBFF4 + POPJ P, ;RETURN OUT OF UTBFF2 + ;SHUFFLE BUFFERS +;COME HERE WITH UTTBF SET TO 0 AND OLD VALUE IN E +;LEAVE UTTBF 0 WHILE SHUFFLING SO NO ONE ELSE CAN ALLOCATE + +CISHUF: PUSH P,E + LDB R,[MNUMB,,MEMBLT(J)] +CISHF1: LDB Q,[IOCH,,IOBFT(R)] + CAIN Q,77 + JRST CISHF2 ;FREE, IGNORE + CAIL Q,NFNETC + CAILE Q,NFNETC+NNETCH + JRST 4,. ;SOME RANDOM UNSHUFFABLE BUFFER + PUSHJ P,CINET +CISHF2: LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST CISHF1 + POP P,UTTBF ;ALLOW ALLOC AGAIN. THIS MEM BLOCK NOW + ;CONTAINS 8 FREE, ALLOC INH BUFFERS. + ;SO FALL INTO COSIO3 TO FLUSH THEM. +;FLUSH ALL 8 BUFFERS. + +COSIO3: LDB R,[MNUMB,,MEMBLT(J)] + MOVEI TT,7 +COSIO4: LDB Q,[IOCH,,IOBFT(R)] + CAIE Q,77 + JRST 4,. ;BUFFER WAS SUPPOSED TO BE FREE?? + MOVEI Q,UTFS-IOBFT ;PNTR TO F.S. LIST + SOS UTTBF ;SOON WILL BE ONE LESS FREE UTAPE BUFFER + CONO PI,UTCOFF +COSIO5: MOVE E,Q ;REMOVE IOBFT ENTRY IN R FROM F.S. LIST + LDB Q,[IOLO,,IOBFT(Q)] + CAIN Q,377 + JRST 4,. ;IT WASN'T IN THE LIST + CAME Q,R + JRST COSIO5 + + LDB Q,[IOLO,,IOBFT(R)] + DPB Q,[IOLO,,IOBFT(E)] + MOVE A,R ;GIVE IOBFT ENTRY BACK TO LIST OF UNUSED IOBFTS + LDB R,[IOLC,,IOBFT(R)] + PUSHJ P,IOBR + CONO PI,UTCON + CAIE R,377 + SOJA TT,COSIO4 + + JUMPN TT,[JRST 4,.] ;BLOCK DIDN'T CONTAIN 8 BUFFERS + MOVNI A,8 + ADDB A,UTTLB + CAMGE A,[-NUTIC-NUTOC] + JRST 4,. + PUSHJ P,FSCMP + HRRZ A,J ;THIS BLOCK OF MEMORY IS FREE NOW + JRST CMEMR ;AND RETURN OUT OF UTBFF2 + +;EXCHANGE BUFFER IN R WITH SOME FREE BUFFER, RETURNED IN A +;CALL WITH UCTOFF, CHANNEL NUMBER IN Q, TURNS UTCON + +COSIMG: MOVEI D,NFNETC(Q) ;CHNL NO TO CONS FOR + AOS UTTBF ;UNRESERVE ONE BUFFER MOMENTARILY + PUSHJ P,IUTCONS + JRST 4,. + CONO PI,UTCON + LDB TT,[IOSA1,,IOBFT(R)] ;TRANSFER BUFFER R TO BUFFER A + LDB T,[IOSA1,,IOBFT(A)] + HRL T,TT + LSH T,7 + HRRZ TT,T + BLT T,177(TT) + EXCH R,A + CONO PI,UTCOFF + PUSHJ P,IBRTN ;RETURN THE OLD BUFFER + SOS UTTBF ;BUT RESERVE IT + EXCH R,A + JRST UTCONJ + +;SHUFFLE OFF A NCP NETWORK BUFFER +;R HAS IOBFT INDEX, Q HAS CHANNEL NUMBER, E MUST BE PRESERVED + +CINET: +IFE NCPP,JRST 4,. +IFN NCPP,[ + SUBI Q,NFNETC ;GET IMSOC INDEX + HRRZ A,IMSOC1(Q) ;USER WHO OWNS THIS BUFFER + MOVSI T,200000 + TDNE T,IMSOC1(Q) ;SKIP OVER USER STOP IF BEING CLOSED + TROA A,-1 ; SINCE USER CAN'T REFERENCE BUFFER ANY MORE + PUSHJ P,RPCLSR ;AND LEAVE A=USER # STOPPED OR 0,,-1 IF NONE + MOVSI T,200000 ;MUSTN'T BE ACTIVE AT PI LEVEL + PUSHJ P,LWAIT + TDNE T,IMSOC6(Q) + SKIPN IMSOC6(Q) ;LWAIT RETURNS WITH NETOFF + JRST CINET2 ;BUFFER HAS BEEN RETURNED + MOVSI T,400000 ;LOCK THE BUFFER SO PI LEVEL WON'T TOUCH + IORM T,IMSOC6(Q) + LDB T,[221000,,IMSOC6(Q)] + CAIE T,(R) + JRST 4,. ;IOBFT ENTRY POINTS TO WRONG CHANNEL + PUSH P,A ;SAVE INDEX OF STOPPED USER + PUSHJ P,COSIMG ;COPY BUFFER + LDB TT,[IOSA,,IOBFT(A)] + LSH TT,6 + MOVE T,TT + HRRZ D,IMSOC6(Q) + SUB T,D ;OFFSET NEW BUFFER MINUS OLD + HRL TT,A + DPB TT,[003200,,IMSOC6(Q)] ;STORE NEW BUFFER ADDR, LEAVE FLAGS ALONE + ADDM T,IMSBFE(Q) ;RELOCATE VARIOUS POINTERS + ADDM T,IMSMPP(Q) + ADDM T,IMSPIP(Q) + MOVE TT,IMSOC2(Q) + TRNN TT,1 + AOSA IMNISH + AOS IMNOSH + CONO PI,NETOFF + MOVE TT,IMSOC6(Q) + TLNN TT,100000 ;SKIP IF INPUT OCCURRED WITH BUFFER LOCKED + JRST CINET1 +IFE DMI,[ + MOVE TT,IMPSVP ;RESTART INPUT + MOVEM TT,IMPPIA + CONO IMP,(TT) +] +IFN DMI,CONO FI,FIIN+NETCHN*11 +CINET1: MOVSI TT,500000 ;UNLOCK THE BUFFER, CLEAR INPUT WITH LOCK FLAG + ANDCAM TT,IMSOC6(Q) + PUSHJ P,IMPIOS ;RESTART OUTPUT + POP P,A ;AND FALL INTO CINET2 TO RESTART USER +CINET2: CONO PI,NETON + JRST NJUPCL ;RESTART USER IF ONE WAS STOPPED +] ;END IFN NCPP + +;FREE BLOCKS THAT BECAME FREE AT INT LEVEL. +ACMTC: SKIPN MEMFP1 ;ANY BLKS BECAME FREE AT INT LVL? + POPJ P, + CONO PI,UTCOFF + SKIPL MEMFRZ ;IF MEMFRZ IS LOCKED, CAN'T DO THIS. JUST + JRST UTCONJ ;HOPE ENOUGH CORE IS FREE. MUST BE BETTER WAY! + MOVE A,MEMFP1 ;GET # OF ONE OF THEM, + LDB B,[MLO,,MEMBLT(A)] ;REMOVE IT FROM LIST OF SUCH BLOCKS + HRRZM B,MEMFP1 + LDB B,[MUR,,MEMBLT(A)] + CAIE B,MUFRT + JRST 4,. + PUSHJ P,MEMR + JRST ACMTC + +;COPY A PHYSICAL PAGE'S DATA FROM PAGE (J) TO PAGE (D) +CMOVE1: MOVE C,MEMBLT(J) + MOVEM C,MEMBLT(D) + CLEARM MEMBLT(J) + MOVE C,MEMPNT(J) + MOVEM C,MEMPNT(D) + CLEARM MEMPNT(J) + MOVE C,MMSWP(J) + MOVEM C,MMSWP(D) + HRRZ A,D + CAIGE A,SYSB + JRST 4,. + TRO D,600000+PMCSHM + TRO J,600000+PMCSHM + DPB D,[.CORJT+EXEUMP] + DPB J,[.CORJF+EXEUMP] + TRZ D,600000+PMCSHM + TRZ J,600000+PMCSHM + CLRPGM +LUBLK + MOVE A,[400000+CORJF*2000,,400000+CORJT*2000] + BLT A,400000+CORJT*2000+1777 + MOVEI A,0 + DPB A,[.CORJT+EXEUMP] + DPB A,[.CORJF+EXEUMP] + POPJ P, + +MEMMF: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUFR + JRST 4,. + HRRZ A,D + PUSHJ P,TCALL + JRST MPOUT + POPJ P, + +UDELAY: PUSH P,T + MOVE T,TIME + ADDI T,15. ;SLEEP 1/2 SEC. (REALLY SHOULD DO A LOW + CAMLE T,TIME ;PRIORITY UNBLOCK IF SYS LIGHTLY LOADED) +UDELA1: PUSHJ P,UFLS + JRST POPTJ + +CZRR: PUSH P,A + CAIGE A,SYSB ;CORE ZEROER + JRST 4,. + TRO A,600000+PMCSHM + DPB A,[.CORJT+EXEUMP] + CLRPGM +LUBLK + CLEARM 400000+CORJT*2000 + MOVE A,[400000+CORJT*2000,,400000+CORJT*2000+1] + BLT A,400000+CORJT*2000+1777 + MOVEI A,0 + DPB A,[.CORJT+EXEUMP] + JRST POPAJ + +;ROUTINES TO ALLOCATE BLOCKS OF MEMORY +;CALL ONLY AT UTC LEVEL OR WITH UTC OFF + +OVHMTR ALC ;CORE ALLOCATION + +;SEE IF CAN ALLOCATE MEMORY +MQTEST: MOVE A,MEMFR + SUB A,NCBCOM + JUMPLE A,CPOPJ + SKIPLE MEMFR + SKIPL MEMFRZ + POPJ P, + JRST POPJ1 + +;ALLOCATE PREFERRING HIGH MEMORY, FOR RANDOM USER PAGE. SHUFFLEABLE PAGE OK. +HMRQC: PUSHJ P,MQTEST + POPJ P, +HMEMRQ: PUSH P,B + PUSH P,E + HRREI B,MEMHPT-MEMBLT +HMRQ3: LDB A,[MLO,,MEMBLT(B)] + JUMPE A,HMRQ1 ;HIGH HALF FULL TRY LOW + CAIL A,SYSB ;DON'T ALLOCATE PART OF THE SYSTEM + SKIPGE MEMBLT(A) ;DON'T ALLOCATE IF LOCKED + SKIPA B,A ;THIS PAGE NOT AVAIL, TRY NEXT + JRST IMRQ8 ;GOBBLE IT + JRST HMRQ3 + +HMRQ1: POP P,E + POP P,B + JRST NMMRQ ;THAT DIDNT WORK, TRY LOW HALF + +;ALLOCATE A BLOCK OF MEM FOR 200-WORD BUFFERS +UIMRQ: MOVE A,IOBFC + CAIGE A,8 + POPJ P, ;NOT ENOUGH ROOM IM IOBFT + MOVE A,MEMFR + SUB A,NCBCOM + CAIG A,3 + POPJ P, + +;GET A BLOCK THAT WON'T BE SHUFFLED, AND IS DIRECTLY ACCESSIBLE. +IOMQ: PUSHJ P,MQTEST ;GET LOW OR MEDIUM MEMORY FOR I/O + POPJ P, + +;ALLOCATING LOW MEM +NMMRQ: MOVEI A,0 ;MEMFP = MEMBLT+0 +IMRQ7: PI2SAF + PUSH P,B + PUSH P,E +IMRQ2: LDB A,[MLO,,MEMBLT(A)] + JUMPN A,IMRQ3 + PUSH P,C + PUSH P,H + PUSH P,TT + MOVEI C,IMEMR + SKIPGE UDRSW + PUSHJ P,QDFLS ;TRY FLUSHING DISK DIRS + POP P,TT + POP P,H + POP P,C + MOVEI A,0 +IMRQ6: LDB A,[MLO,,MEMBLT(A)] + JUMPE A,IMRQR ;NO MEM AVAIL IN LOW HALF, TAKE NON-SKIP RETURN + SKIPGE MEMBLT(A) + JRST IMRQ6 + JRST IMRQ9 + +MPOUT1: +IMRQR: POP P,E + JRST POPBJ + +IMRQ3: SKIPGE MEMBLT(A) + JRST IMRQ2 ;LOCKED LOOK FOR ANOTHER +IMRQ9: TDZA B,B ;GOBBLE FROM LOW +IMRQ8: MOVNI B,1 ;GOBBLE FROM HIGH + AOS -2(P) ;CAUSE RETURN TO SKIP + LDB E,[MUR,,MEMBLT(A)] + CAIN E,MUFR + JUMPN A,IMRQ4 + JRST 4,. ;BLOCK GOT PUT ON FREE STORAGE LIST WITHOUT USAGE FIELD GETTING "FREE" + ;ROUTINES FOR RETURNING MEMORY +IMEMR: PI2SAF ;HERE OTHERWISE (SEE BELOW) + CAIGE A,TSYSM + CAIGE A,SYSB + JRST 4,. ;DON'T RETURN PART OF SYSTEM + SKIPL MEMFRZ + JRST IMEMR1 +CIMEMR: PUSH P,B ;ENTER HERE IF OK TO HACK WITH MEM FROZEN + LDB B,[MUR,,MEMBLT(A)] ;I E CALLING FROM CORE ALLOCATOR + CAIN B,MUFR + JRST 4,. ;ALREADY FREE, LOSSAGE + SETZM MEMBLT(A) ;INITIALIZE RANDOM FIELDS + CAIGE A,256. ;HIGH MOBY GOES ON HIGH LIST + CAIGE A,LIOBLK ;LOW SHUFFLEABLE GOES ON HIGH LIST + JRST CIMEM1 + CAIGE A,128. ;LOW NON-SHUFFLEABLE GOES ON LOW LIST + JRST CIMEM0 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES GO ON HIGH LIST + SKIPN USEMDM ;MEDIUM MEMORY GOES ON LOW OR HIGH DEPENDING ON USEMDM + JRST CIMEM1 +CIMEM0: LDB B,[MLO,,MEMFP] ;PICK UP HEAD OF APPRO FS LIST + DPB B,[MLO,,MEMBLT(A)] ;STORE AS LINK OUT OF CURRENT WD + CAIE B,0 ;SKIP IF NO BLOCK PREVIOUSLY ON LIST + DPB A,[MLU,,MEMBLT(B)] ;MAKE FORMER HEAD'S BACK PNTR POINT TO CURRENT + MOVEI B,0 ;NO BACK PTR, THIS WILL BE FIRST IN LIST + DPB B,[MLU,,MEMBLT(A)] + DPB A,[MLO,,MEMFP] ;STORE THIS AS FREE LIST HEAD + AOS LMEMFR +CIMEM3: MOVEI B,MUFR + DPB B,[MUR,,MEMBLT(A)] ;STORE FREE IN USER + CLEARM MEMPNT(A) + AOS MEMFR + JRST POPBJ + +CIMEM1: LDB B,[MLO,,MEMHPT] ;PICK UP HEAD OF APPRO FS LIST + DPB B,[MLO,,MEMBLT(A)] ;STORE AS LINK OUT OF CURRENT WD + CAIE B,0 ;SKIP IF NO BLOCK PREVIOUSLY ON LIST + DPB A,[MLU,,MEMBLT(B)] ;MAKE FORMER HEAD'S BACK PNTR POINT TO CURRENT + MOVEI B,0 ;NO BACK PTR, THIS WILL BE FIRST IN LIST + DPB B,[MLU,,MEMBLT(A)] + DPB A,[MLO,,MEMHPT] ;STORE THIS AS FREE LIST HEAD + JRST CIMEM3 + +IMEMR1: PUSH P,B ;FREE A PAGE WHEN MEMFRZ LOCKED. + MOVE B,MEMFP1 ;ADD IT TO FRONT OF MEMFP1 LIST + DPB B,[MLO,,MEMBLT(A)] + HRRZM A,MEMFP1 + MOVEI B,MUFRT ;THEN SAY THIS BLK BECAME FREE WITH MEM FROZEN. + DPB B,[MUR,,MEMBLT(A)] + SETZM MEMPNT(A) + JRST POPBJ + +;ROUTINES TO RETURN MEMORY CONTINUED + +MGMEMR: PUSHJ P,TMEMR ;MAG TAPE MEMR + MUMGB + POPJ P, + +TMEMR: PUSH P,B + LDB B,[MUR,,MEMBLT(A)] + CAME B,@-1(P) + JRST 4,. ;RETURNING BLOCK NOT OF TYPE EXPECTED + POP P,B + AOS (P) ;SKIP OVER ARG +MEMR: CONO PI,UTCOFF + PUSHJ P,IMEMR + JRST UTCONJ + +CMEMR: CONO PI,UTCOFF + PUSHJ P,CIMEMR + JRST UTCONJ + +; ROUTINES TO UNTHREAD BLOCKS FROM FREE LISTS + +MPOUT: PI2SAF +MPOUT2: JUMPE A,[JRST 4,.] ;ENTER HERE FROM INITIALIZATION IF HOLE FOUND + PUSH P,B + PUSH P,E + CAIGE A,256. ;HIGH MOBY GOES ON HIGH LIST + CAIGE A,LIOBLK ;LOW NON-SHUFFLEABLE GOES ON HIGH LIST + JRST MPOUT4 + CAIGE A,128. ;LOW SHUFFLEABLE GOES ON LOW LIST + JRST MPOUT3 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES GO ON HIGH LIST + SKIPN USEMDM ;MEDIUM MEMORY GOES ON LOW OR HIGH DEPENDING ON USEMDM +MPOUT4: SKIPA B,[-1] ;IT'S HIGH MEM +MPOUT3: MOVEI B,0 ;IT'S LOW MEM + +IMRQ4: PUSH P,B ;0 LOW -1 HIGH + LDB B,[MLU,,MEMBLT(A)] ;LINK UP + LDB E,[MLO,,MEMBLT(A)] ;LINK OUT + JUMPN B,IMRQ5 ;JUMP IF NOT FIRST IN LIST + JUMPE E,IMRQ5 ;JUMP IF LAST BLOCK IN LIST + LDB B,[MUR,,MEMBLT(E)] ;FIRST AND FOLLOWED + CAIE B,MUFR + JRST 4,. ;DOESNT LINK TO A FREE BLOCK + MOVEI B,0 ;PUT BACK 0 +IMRQ5: SKIPE E ;SKIP IF NO BLOCK FOLLOWS + DPB B,[MLU,,MEMBLT(E)] ;STORE LINK UP OF PATCHED OUT BLOCK IN LINK OUT BLOCK + JUMPE B,IMRQ5A + DPB E,[MLO,,MEMBLT(B)] ;STORE LINK OUT OF PATCHED OUT BLOCK IN LINK UP BLOCK + POP P,B ;GET BACK WHICH PART OF MEM IT'S IN + JRST IMRQ5C + +IMRQ5A: POP P,B ;GET BACK WHICH PART OF MEM IT'S IN + DPB E,[MLO,,MEMFP(B)] ;THIS WAS FIRST IN FREE LIST, ADJUST LIST HEADER +IMRQ5C: SKIPL B ;SKIP IF NOT IN LOW HALF + SOS LMEMFR ;ADJUST FREE BLOCKS IN LOWER HALF + SOS MEMFR ;1 LESS FREE BLOCK IN SYSTEM + SETZM MEMBLT(A) ;CLEAN UP MEMBLT ENTRY FOR CALLER'S SAKE + MOVEI B,MUINP ;IN PROCESS + DPB B,[MUR,,MEMBLT(A)] + JRST MPOUT1 + +OVHMTR UUO ;MORE MISC UUOS ETC. + +TCALL: CONO PI,UTCOFF + PUSHJ P,@(P) + SKIPA + AOS (P) + JRST UTCOJ1 + +EBLK + +SUBTTL MEMORY ALLOCATION TABLES + +IOBFTL: MXIOB ;BEG FOR GETSYS (MEMORY) +IOBFT: REPEAT MXIOB-1,176000,,.RPCNT+1 ;MAX DYN ALLOC IO BUFFERS + 176000,,377 ;4.9 FREEZE + ;4.8 ALLOC INHIBIT +IOCH==340600 ;4.7-4.2 SYS CHN NO 77 => FREE +IOLC==241000 ;4.1-3.3 LINK TO NEXT SEQ BUF IN CORE (W/IN 1K BLK) +IOLO==1000 ; LINK TO FOLLOWING BUFFER OR + ;SPECIAL STATES LINK OUT + ;-1 LAST BUFFER CURRENTLY FILLED + ;-2 END OF FILE + ;-3 BUFFER ACTIVE AT MAIN PROG LEVEL + ;-4 BUFFER ACTIVE AT PI LEVEL +;IF CHN IS NUTIC+NUTOC (UTAPE FILE DIR) THEN IOLO IS TAPE NO +;CHNLS NUTIC+NUTOC+1 (NFCLC)=>$Q+NCLCH-1 ARE CORE LINK DEVICE +;CHNLS NFNETC => $Q+NNETCH-1 ARE NET CHNLS +SCNCLO==NUTIC+NUTOC+1 + +IOSA==101400 ; BUFFER SA _-6 +IOSA1==111300 ;ONLY RELEVANT BITS FOR 200 WD BUFFERS + + +IOBFP: 0 ;FREE STG TO IOBFT ENT +IOBFC: MXIOB-8 ;CNT OF AVAIL + ;LEAVE 8 AVAIL SO CORE HACKER CAN NOT RUN OUT + +UTFS: 377 ;FREE STG PNTR TO 200 WD BUFFERS +UTTLB: -NUTIC-NUTOC ;TOTAL BUFFERS ALLOCATED TO UTAPES +UTTBF: 0 ;TOTAL UT BUFFERS FREE + +;EXEC MAPS +IF2,[ +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S MAP AREA +EXELMP==UPGMP ;KL10 AND KS10 ALSO NEED EXEC LOWER MAP, + EXISTS +];IF2 ;SO USERS CAN COPY PAGES FROM THE SYSTEM JOB + +;TABLE OF BYTE POINTERS THAT POINT TO VIDEO BUFFER AREA OF EXEUMP +IFN N11TYS,[ +TTCRT: REPEAT NTVBP,[ + CONC [.TTR]\.RPCNT,+EXEUMP +] +] + +IFN PDP6P,[ +;DBR FOR REFERENCING PDP6 MEM +PDP6MP: _1,,PDPUMP + +;PAGE MAP FOR REFERENCING PDP6 MEM +PDPUMP: REPEAT LPDP6M/2,600000++2*.RPCNT,,600000++2*.RPCNT+1 +] + +IFN 340P,[ +DDEXCF: BLOCK NEXPGS ;-1 IF EXEC PAGE SET UP FOR 340 +] + +IFN KA10P, EXECMP: 100_1,,EXEUMP ;EXEC DBR + ;MEMORY ORGANIZATION + +;PAGE 0 ALWAYS BELONGS TO THE SYSTEM AND IS NEVER ALLOCATED OR FREED. +; +;N PAGES OF SYSTEM CODE AND VARIABLES ARE ACQUIRED BY THE SYSTEM JOB AT STARTUP. +; +;N PAGES OF USER-VARIABLE BLOCKS BELONG TO THE SYSTEM JOB. THESE ARE +;ALLOCATED AND DEALLOCATED AS REQUIRED. LIOBLK-1 IS THE HIGHEST THIS CAN GO. +;USER PAGES BELOW LIOBLK CAN BE SHUFFLED OUT WHEN THE SYSTEM JOB NEEDS THE CORE. +; +;FROM LIOBLK TO 128K IS THE "LOW HALF." THESE PAGES ARE DIRECTLY ADDRESSABLE +;IN EXEC MODE AND NEVER NEED TO BE SHUFFLED. I/O BUFFERS, DISK DIRECTORIES, +;ETC. ARE ALLOCATED IN THESE PAGES. +; +;128K TO 128K+NEXPGS ARE PAGES WHICH CAN'T BE ADDRESSED DIRECTLY FROM +;EXEC MODE BECAUSE THEIR EXEUMP SLOTS ARE USED BY "EXEC PAGES." +; +;THE REST OF THE LOW MOBY, UP TO FDDTPG, IS DIRECT-MAPPED AND +;USED FOR ADDITIONAL "LOW HALF" PAGES. +; +;FDDTPG TO 256K CONTAINS DDT AND THE SYSTEM SYMBOL TABLE. +; +;PAGES ABOVE 256K ARE IN THE "HIGH MOBY". +; +;PAGES NOT IN THE "LOW HALF" (BELOW LIOBLK, SHADOWED BY EXEC, OR HIGH MOBY) +;ARE CONSIDERED TO BE IN THE "HIGH HALF". USER PAGES PREFER TO GO HERE. +; +;COMPLICATIONS: +; IF USEMDM IS OFF, THE DIRECT MAPPED PAGES IN THE HIGH HALF +; OF THE LOW MOBY ARE CONSIDERED HIGH RATHER THAN LOW. THIS IS USED +; MOSTLY FOR DEBUGGING, TO CATCH REFERENCES TO RANDOM ADDRESSES. +; THERE CAN BE HOLES IN MEMORY (NXM). +; +;THE MEMBLT TABLE HAS ONE WORD FOR EACH 1K BLOCK OF MEMORY. +;IT SAYS WHAT THAT BLOCK IS USED FOR AND CONTAINS LINKS TO OTHER +;BLOCKS AND OTHER TABLES. THE MEMPNT AND MMSWP TABLES ALSO CONTAIN +;ONE WORD PER BLOCK AND CONTAIN ADDITIONAL INFORMATION. + +FDDTPG: 0 ;# OF LOWEST BLOCK USED BY DDT & SYMTAB (SET AT STARTUP) + +MEMFR: 0 ;# OF FREE BLOCKS IN ALL OF MEMORY. + +LMEMFR: 0 ;# OF FREE BLOCKS IN LOW LIST (MEMFP). + +MINCOR: 8 ;TRY TO KEEP THIS MANY PAGES FREE IN LOW MEMORY + ;MUST BE >= 3, SINCE LESSER-PRIORITY CONSUMERS OF + ;MEMORY WAIT IF LMEMFR IS < 3. + +MEMFP1: 0 ;LIST (THREADED THROUGH MLO, TERMINATED BY 0) + ;OF BLKS THAT BECAME FREE WHILE MEMFRZ WAS LOCKED. + +MEMHPT: 0 ;FREE LIST OF HIGH HALF PAGES AND HIGH MOBY PAGES + ;AND SHUFFLEABLE LOW HALF PAGES. MUST BE AT MEMFP-1. +MEMFP:: +MEMBLT: 0 ;FREE LIST POINTER FOR LOW PGS AND ALSO WD FOR BLOCK 0 + BLOCK TSYSM-1 .SEE BEGF0 ;FILLS THIS IN + +;FIELDS IN MEMBLT ENTRY: +;4.9 FREEZE OR ALLOC INHIBIT +;IF 4.9=1, DONT SET UP ANY MORE EXEC PGS POINTING TO THIS ONE +MUR==360500 ;4.4-4.8 USAGE CODE + MURUSR==1 ;USER PAGE, MMMPX=MMP INDEX + MUEX==2 ;EXEC (?) + MUIOB==3 ;200 WD BUFFERS, MNUMB=FIRST IOBFT ENTRY IN BLOCK + MUFR==4 ;FREE + MUINP==5 ;IN PROCESS OF BEING ALLOCATED + MUMGB==6 ;MAG TAPE BUFFER, MNUMB=TAPE NO+EOF BIT, MWC=WORD COUNT + MUMMP==7 ;MMP TABLE + MUDISB==10 ;340 DISPLAY BUFFER + MUFRT==11 ;BLOCK RETURNING TO FREE WHEN MEM LOCKED + MU23B==12 ;DISK BUF, MWC=WORD COUNT, MNUMB=CHANNEL + MU23UD==13 ;DISK USER DIR, MNUMB=QSNUD SLOT + MU23MD==14 ;DISK MASTER DIR + MU23TT==15 ;DISK TUT MNUMB=DISK NO. + MU23LS==16 ;DISK COPY OF USER DIR FOR LISTING + MUHOLE==17 ;"HOLE" IN REAL MEM + MUDDT==20 ;"DDT" PAGE + MUNET==21 ;NETWORK "BIG" BUFFER + MUSWPG==22 ;PAGE IN SWAPPING QUEUE, MMMPX=MMP INDEX + MUCHA==23 ;CHAOS NET BUFFERS + MU23FB==24 .SEE QSFBT ;DISK FREED-BLOCKS TABLES + MUPKT==25 ; Net packet buffers + MUDVB==26 ;Semi-static device IO buffer page +;ADD NEW MUR TYPES HERE ^ +MURMAX==27 ;HIGHEST VALID CODE + 1 + +MWC==221400 ;3.1-4.3 WORD COUNT IN I/O BUFFERS + +MLU==221400 ;3.1-4.3 LINK UP FOR DOUBLY-THREADED FREE LIST + +MNUMB==140600 ;2.4-2.9 MAGIC NUMBER SEE COMMENTS UNDER MUR ABOVE + +MMMPX==142200 ;2.4-4.3 MMP INDEX IN USER PGS + SWAP BUFFERS + +MLO==001400 ;1.1-2.3 LINK TO NEXT PAGE IN A LIST + ;0 = END OF LIST + ;UNLIKE IOLO AND PREVIOUS VERSION OF MLO, THERE ARE NO MAGIC NEGATIVE CODES + ;N.B.: MLO MUST BE AT RIGHT-HAND END OF WORD - CODE DEPENDS + +MEMPNT: BLOCK TSYSM ;RH USED FOR CIRC MEM USE PNTR IF USER MEM + ;LH FOR DISK ADDRESS CAME FROM OR GOING TO + ;MEMPNT HAS BLOCK NUMBER + ;DISK NUMBER COMES FROM CHANNEL LINKED TO + ;CIRCULAR PAGE LINK FORM + ;2.9=0 + ;1.1-1.8 PAGE # + ;2.8-1.9 USER # + ;2.9=1 + ;2.8=0 2.7-1.1 LINK TO MMP TABLE + ;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE + ;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +MMSWP: BLOCK TSYSM ;IF USER MEM, HAS NUMBER OF PAGE TABLE WORDS + ; WHICH POINT AT THIS PAGE. LH IS NUMBER OF EXEC + ; PAGES, RH IS NUMBER OF USER PAGES. NOTE THAT THE + ; NUMBER OF UPGCP ENTRIES COULD BE MORE, FOR VARIOUS + ; REASONS, E.G. CIRPSW LOCKED WHEN PAGE SWAPPED IN, + ; OR A USER WAS SWAPPED OUT. + ;IFN SWPWSP, RH(MMSWP) IS USED AS NUMBER OF SHARERS. + +EMEMTL==.-1 ;END FOR GETSYS (MEMORY) + +MMPRTC: 0 ;C AT MMPRTN, FOR DEBUGGING + +MMPFS: 0 ;FREE-LIST OF MMP ENTRIES. VALUE IS ADDRESS. (FORMERLY WAS IDX). + +MMPFS2: 0 ;LIST OF MMPS THAT NEED TO HAVE TUT SOS'ED BEFORE THEY CAN BE FREED. + ;TUT COULDN'T BE SOS'ED AT P.I. LEVEL BECAUSE IT WAS LOCKED. + ;THESE MMPS MAY ALSO NEED TO BE REMOVED FROM THE SHAREABLE + ;PAGE TABLE, WHICH REQUIRES CIRPSW. + +MMPCNT: 0 ;# OF MMP ENTRIES IN USE. + +MMPFR: NMMP*1000 ;MAX POSSIBLE # MMP ENTRIES, MINUS # IN USE OR COMMITTED. + +;MMP TABLE - TWO WDS PER ENTRY +MMPPUB==400000 ;WD1 4.9 INDICATES A PUBLIC PAGE IF ON (ANYONE CAN ATTACH TO WRITE) +MMPOUT==200000 ;4.8 => PAGE IS SWAPPED OUT OR ON WAY OUT. +MMPTMP==100000 ;4.7 => IN TRANSIT (ON WAY IN OR ON WAY OUT). +MMPWOD==40000 ;4.6 => THIS PAGE HAS BEEN WRITTEN ON DISK AT LEAST ONCE +MMPISW==20000 ;4.5 PAGE ON INITIAL SWAPIN, BEING COPIED SO SWAP OUT TO DIFF PLACE +MMPWRT==10000 ;4.4 HAS BEEN WRITTEN SINCE LAST DISK WRITE BY USER WHO HAS DETACHED THIS PAGE +MMPGON==4000 ;4.3 FILE PAGE BEING WRITTEN OUT AFTER + ;DELETED FROM ALL MAPS (MMP ENTRY WILL SOON GO AWAY.) +MMPBAD==2000 ;4.2 PAGE GOT PAR ERR SINCE LAST TIME SWAPPED OUT OR IN. +MMPLOK==1000 ;4.1 => PAGE MAY NOT BE SWAPPED OUT. +MMPSLO==400 ;3.9 => PAGE SHOULD GO IN SLOW MEMORY. +MMPSHR==200 ;3.8 MMP ENTRY IS IN SHAREABLE PAGE HASH TABLE +MMPPGA==100 ;3.7 BEING SWAPPED IN BY PAGE-AHEAD. DON'T PUT IN USER MAPS; WAIT FOR FAULTS. +MMPPGB==40 ;3.6 BEING SWAPPED OUT BY PAGE-BEHIND. +$MMPUN==220300 ;3.1-3.3 UNIT NUMBER (GOES WITH DISK ADDR IN WD2 LH) + ;WD1 RH CIRC MEM USE PNTR + ;WD2 LH READ DISK ADR OR 0 + ;WD2 RH THREAD FOR SHAREABLE PAGE HASH TABLE + +MMPNP: 0 ;#MMP PGS ACTUALLY IN USE +MMPMX: 0 ;HIGHEST VALID MMP INDEX (MMPNP*2000) + +MMMPG: BLOCK NMMP ;BLOCK NOS OF BLOCKS ACTUALLY USED + +;SHAREABLE PAGE HASH TABLE +;MMP ENTRIES THAT ARE SHARED WITH FILES ARE LISTED HERE TO SAVE TIME AT NCORQ2 +;SIMPLE REMAINDER HASH ON UNIT#,,DISK ADDRESS, +;BUCKETS THREADED THROUGH RH(MMPE+1) + +SHRHSL==31. ;NUMBER OF BUCKETS +SHRHSH: BLOCK SHRHSL + +;"LOOSE" PAGES (NOT USED BY ANY USER, BUT NOT YET SWAPPED OUT.) +;MMP ENTRY GOES AWAY WHEN SWAPPED OUT, OR GETS PUT BACK INTO SERVICE AT NCORQ3. +NLOOSP: 0 ;NUMBER OF LOOSE PAGES +FLOOSP: 0 ;HEAD OF LIST. THREADED THROUGH MLO IN MEMBLT. +LLOOSP: 0 ;TAIL OF LIST. ADD AT TAIL, SWAPPER REMOVES FROM HEAD. + +BBLK +MMPEAD: REPEAT NMMP, CONC MMP,\.RPCNT,*2000+400000 ;EXEC ADR +MMPPPP: REPEAT NMMP, CONC .MMP,\.RPCNT,+EXEUMP ;PNTR TO EXEC PC MP +USEMDM: DIRMAP ;NON-ZERO => USE MEDIUM MEMORY. + ;DON'T CHANGE AFTER SYSTEM STARTUP + +SUBTTL 200-WORD I/O BUFFER ROUTINES + +;SYS CHANNEL ASSIGN +; 77=>FREE +; 0 - NUTIC+NUTOC-1 => UTAPE CHNL +;NUTIC+NUTOC (=NFCLC-1) =>UTAPE FILE DIR +;NFCLS-NFCLC+NCLCH-1 (=NFNETC-1) => CORE LINK +;NFNETC-NNETCH => NETWORK + +IOBCNS: MOVEI A,IOBFP-IOBFT +IOBC1: MOVE E,A + LDB A,[IOLO,,IOBFT(A)] + CAIN A,377 + JRST 4,. ;IOBFT POINTERS FOULED UP + +IOBC2: LDB B,[420200,,IOBFT(A)] + JUMPN B,IOBC1 + LDB B,[IOLO,,IOBFT(A)] + DPB B,[IOLO,,IOBFT(E)] + SOS IOBFC + POPJ P, + + +IOBR: MOVE B,IOBFP ;RETURN IOBFT WORD + CLEARM IOBFT(A) + DPB B,[IOLO,,IOBFT(A)] + MOVEM A,IOBFP + MOVEI B,77 + DPB B,[IOCH,,IOBFT(A)] + AOS IOBFC + POPJ P, + +IUTCONS: ;ALLOCATE 200 WORD BUFFER +IUTCO1: PI2SAF + SKIPG UTTBF ;CLOBBERS A B E TT, RETURNS IOBFT INDEX IN A + JRST IUTC1 ;NO UTAPE BUFFERS FREE + MOVEI E,UTFS-IOBFT + MOVE A,UTFS ;CHNL NO IN D +IUTC3: CAIN A,377 + JRST IUTC1 + LDB B,[420200,,IOBFT(A)] + JUMPN B,IUTC2 + LDB B,[IOCH,,IOBFT(A)] + CAIE B,77 + JRST 4,. ;BUFFER BEING ALLOCATED ISN'T FREE. + LDB B,[IOLO,,IOBFT(A)] + DPB B,[IOLO,,IOBFT(E)] + DPB D,[IOCH,,IOBFT(A)] + SOS UTTBF + JRST POPJ1 + +IUTC2: MOVE E,A + LDB A,[IOLO,,IOBFT(A)] + JRST IUTC3 + +IUTC1: PUSHJ P,UIMRQ + POPJ P, + PUSHJ P,UTMGB + JRST IUTCO1 + +IBRTN: PI2SAF + PUSH P,B ;FREE 200 WORD BUFFER (SEE BRTN) +; LDB B,[IOCH,,IOBFT(A)] +; CAIN B,77 +; JRST 4,. ;RETURNING A BUFFER THAT'S FREE? + MOVE B,UTFS + DPB B,[IOLO,,IOBFT(A)] + MOVEM A,UTFS + MOVEI B,77 + DPB B,[IOCH,,IOBFT(A)] + LDB B,[IOSA,,IOBFT(A)] + SKIPN B + JRST 4,. + AOS UTTBF + JRST POPBJ + +UTMGB: PUSH P,J ;GOBBLE MEM BLK IN A FOR UTAPE BUFFER + PUSH P,R + PUSH P,Q + PUSH P,B + PUSH P,E + MOVEI B,MUIOB + DPB B,[MUR,,MEMBLT(A)] + MOVE J,A + LSH A,10.-6. ;CONV TO BUF SA + MOVE TT,A ;INCR TO NEXT BUF ADR + MOVEI R,8 + ADDM R,UTTLB ;UTTBF AOSED AT IBRTN + MOVNI Q,1 +UTMG1: PUSHJ P,IOBCNS + DPB TT,[IOSA,,IOBFT(A)] + JUMPL Q,UTMG2 + DPB A,[IOLC,,IOBFT(Q)] +UTMG3: MOVE Q,A + PUSHJ P,IBRTN + ADDI TT,2 + SOJG R,UTMG1 + MOVEI TT,377 + DPB TT,[IOLC,,IOBFT(A)] + POP P,E + POP P,B + POP P,Q + POP P,R + POP P,J +FSCMP: ;RECOMPUTE UTAPE BUFFER FAIR SHARE +IFN NUNITS,[ + MOVE A,UTTLB + PUSH P,A+1 + IDIV A,NUTCA + POP P,A+1 + MOVEM A,UPCHFS +] + POPJ P, + +UTMG2: DPB A,[MNUMB,,MEMBLT(J)] + JRST UTMG3 + +BRTN: CONO PI,UTCOFF ;RETURN A 200-WD BUFFER + PUSHJ P,IBRTN + JRST UTCONJ diff --git a/system/core.82 b/system/core.82 new file mode 100644 index 0000000..a55ee75 --- /dev/null +++ b/system/core.82 @@ -0,0 +1,3005 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;;; CORE JOB + +SUBTTL CORE ALLOCATOR - USER ROUTINES +; +; USER ROUTINES (TO COMMUNICATE WITH CORE JOB) +; +UACORE: ;U HAS INDEX CORE REQUEST IS FOR +ACORE: CAILE B,400 + POPJ P, + MOVE Q,U ;USER TO MAKE CORE FOR +ACORE1: PUSH P,U + MOVE U,USER + PUSHJ P,ACRF1 + SKIPA + AOS -1(P) + POP P,U + POPJ P, + +;EXCESSIVE CORE REQUEST CHECK +ACRTST: CAILE B,400 + POPJ P, + JRST POPJ1 + ;CORTYP SYSTEM CALL. +;IF 2 ARGS,1ST ARG IS JOB SPEC, LIKE CORBLK'S 2ND AND 4TH ARGS. +;2ND ARG IS PAGE NUMBER IN THAT JOB. +;IF ONLY 1 ARG, IT IS THE PAGE NUMBER IN THE EXECUTING JOB. +;RETURNED VALUES: +;1ST VALUE BITS: +; %CBWRT ;4.9 PAGE IS WRITEABLE +; %CBRED ;4.8 PAGE IS READABLE (EXISTS) +; %CBPUB ;4.6 PAGE IS PUBLIC +; %CBLOK ;4.2 PAGE IS LOCKED IN CORE +; %CBSLO ;3.9 PAGE IS IN SLOW MEMORY +; FOR NON EX PAGE, ALL THE REST ARE 0. +;2ND IS 0 => PAGE IS ABSOLUTE, -1 => UNSHARED, +; ELSE IS JOB NUMBER OF NEXT JOB IN CIRCULAR LIST. +;3RD IF ABSOLUTE PAGE, HAS PAGE NUMBER. +; IF PAGE IS SHARED, HAS PAGE NUMBER IN THE JOB +; WHOSE NUMBER IS THE 2ND VALUE. ELSE, 0. +;4TH BIT 4.9 => PAGE IS IN CORE. +; RH IS NUMBER OF TIMES PAGE IS SHARED +; (WILL BE 0 FOR ABS PAGE OR IF NO PAGE, +; OTHERWISE WILL BE >= 1) + +NCORTY: PUSHJ P,SWTL ;DON'T LET PAGE MAPS CHANGE. + CIRPSW + SOSG W ;IF 1 ARG, USE -1 (SELF) FOR JOB SPEC. + SKIPA B,[-1] + EXCH A,B ;ELSE 1ST ARG IS JOB SPEC. + MOVE J,B + JSP T,NCRUI2 ;DECODE THE JOB SPEC IN J, + JFCL ;RETURNS USR IDX IN J. + TDNE A,[-400] + JRST OPNL33 ;BAD PAGE NUM. + PUSHJ P,NCORT0 ;DO THE ACTUAL WORK. + PUSHJ P,LSWPOP ;UNLOCK CIRPSW, + JRST POPJ1 ;GIVE VALUES TO USER, SKIP. + +;CALL HERE FROM AUSET5 (ALWAYS COMES WITH CIRPSW LOCKED) +NCORT0: PUSH P,U +IFN PDP6P,[ + CAIN J,-1 + JRST [ SETZB B,D ;DON'T CALL UPLC IF PDP6, WOULD CRASH SYSTEM + MOVEI C,PDP6BM_-12(A) + CAIL A,LPDP6M + TDZA A,A + MOVSI A,%CBRED+%CBWRT + JRST POPUJ ] +];PDP6P + MOVEI U,(J) ;UPLC USES USER IN U. + PUSHJ P,UPLC ;NOTE PAGE NUM IS IN A. + LDB J,T ;GET PAGE'S HARDWARE HALFWD, + LDB C,Q ;GET CIRC. LIST POINTER. + JUMPE C,NCORTE ;J IF NO PAGE THERE. + MOVEI A,(J) + TRNE A,600000 ;GET ACCESS INTO A 1.1-1.2 + LDB A,[200200,,A] + CAIN A,2 ;CHANGE READ-WRITE-FIRST TO READ-WRITE. + MOVEI A,3 + ROT A,-2 ;SHIFT INTO 4.8-4.9 + CAIN C,-1 + JRST NCORTA ;J IF ABSOLUTE PAGE(CIRC PTR -1) + PUSHJ P,CHACK ;PG MUST HAVE REAL CIRC LIST, TRACE IT. + EXCH C,D ;D HAD MMP IDX; C HAD IN-CORE,,LIST LENGTH. + ADD C,MMPEAD + SKIPGE C,(C) .SEE MMPPUB + TLO A,%CBPUB + TLNE C,MMPLOK + TLO A,%CBLOK + TLNE C,MMPSLO + TLO A,%CBSLO + SUBI D,1 ;LIST LENGTH COUNTS THE MMP ENTRY, + SKIPGE D + SUBI D,1 ;COUNTS THE MEMBLT ENTRY IF PAGE IN CORE. + TRNN D,-2 ;RH NOW HAS # SHARERS, + JRST NCORTS ;ONLY 1 => PAGE NOT SHARED. + MOVE C,Q + MOVE B,P + PUSHJ P,UCPRL ;>1 SHARER => FIND NEXT SHARER, + 400000,,.+1 + MOVE P,B ;UN-SCREW STACK (UCPRL PUSHJ'D BACK) + LDB B,[101100,,T] + MOVE C,I ;2ND, 3RD VALUES USR NUM & PAGE NUM + JRST POPUJ ;OF THE NEXT SHARER. + +;COME HERE IF NO PAGE WITH THAT PAGE NUM. +NCORTE: SETZB A,B + SETZB C,D ;RETURN ALL ZEROS. + JRST POPUJ + +;COME HERE IF ABS PAGE, ACCESS ALREADY IN A. +NCORTA: SETZB B,D ;JOB # 0 (SYS JOB) FOR ABS PAGE. + LDB C,[PMRCAD,,J] ;GET ABS PAGE NUM FROM HARDWARE HALFWD. + JRST POPUJ + +;COME HERE IF UNSHARED NORMAL PAGE. +;ACCESS ALREADY IN A, 4TH VALUE IN D. +NCORTS: SETO B, ;2ND VALUE -1 FOR UNSHARED. + SETZ C, + JRST POPUJ + +;CORBLK CALL +;1ST ARG FLAG BITS: (RH XOR'D INTO LH BEFORE DECODING) + +%CB==0,,525252 +%CBWRT==400000 ; 4.9 GET WRITE ACCESS IF OK, DON'T FAIL IF NOT. +%CBRED==200000 ; 4.8 GET READ ACCESS +%CBNDW==100000 ; 4.7 GET WRITE ACCESS, FAIL IF CAN'T. +%CBPUB==40000 ; 4.6 MAKE PAGE PUBLIC +%CBPRV==20000 ; 4.5 MAKE IT PRIVATE (BOTH FAIL IF COULDN'T GET WRITE ACCESS) +%CBNDR==10000 ; 4.4 FAIL IF CAN'T GET READ ACCESS.(COPYING NONEXISTANT PAGE) +%CBCPY==4000 ; 4.3 MAKE COPY (CURRENTLY ONLY IMPLEMENTED FOR PAGE OF FILE) +%CBLOK==2000 ; 4.2 LOCK PAGE IN CORE. +%CBULK==1000 ; 4.1 UNLOCK PAGE (ALLOW SWAP-OUT) +%CBSLO==400 ; 3.9 MAY ONLY RESIDE IN SLOWEST MEMORY +%CBUSL==200 ; 3.8 ALLOWS USE OF ANY MEMORY. + ;IF ALL 0, DELETE. + +%CBNWP==563600 ;BITS THAT NEED WRITE-PERMISSION. + +;2ND ARG SPECIFIES JOB TO PUT PAGE IN +; IS EITHER CHNL NUM, -1 FOR SELF, OR 400000+USRNUM +;JOB SPECIFIED MUST BE CURRENT JOB OR INFERIOR. + +;3RD ARG RH. IS PAGE NUM. IN IT. +; LH. IF NEGATIVE, BLOCK MODE, REPEAT THAT MANY TIMES, +; INCREMENTING BOTH PAGE NUMS EACH TIME. +;IN BLOCK MODE, REWRITES 3RD AND 5TH ARGS EACH TIME. + +;4TH ARG IS SOURCE OF PAGE, +; A DISK CHANNEL NUMBER (GET N'TH PAGE IN FILE), OR +; A SPEC: +; A USR, JOB, BOJ, OR STY CHANNEL NUMBER +; OR ONE OF THE FOLLOWING SPECIAL CODES: +%JS==,-1 +%JSNUM==400000 ;400000+JOB NUMBER => THAT JOB +%JSSUP==400377 ;CURRENT JOB'S SUPERIOR +%JSELF==,,-1 ;SELF +%JSTVB==,,-2 ;TV11 VIDEO BUFFER IN FIRST 8 PAGES, 1ST WD OF 9TH PG IS CONSOLE REG +%JSNUL==,,-3 ;NULL JOB (NOT VALID FOR CORBLK) +%JSALL==,,-4 ;ALL JOBS (NOT VALID FOR CORBLK) +%JSNEW==,,-5 ;FRESH PAGE +%JSABS==,,-6 ;ABSOLUTE PAGE (PHYSICAL MEMORY) +; JOB 0 = SYSTEM JOB = EXEC VIRTUAL ADDRESS SPACE +; JOB 1 = CORE JOB = FRESH PAGE (OBSOLESCENT, USE %JSNEW, EVENTUALLY WILL GO AWAY) +;IF NO 4TH ARG, SAME AS 2ND + +;5TH ARG IS PAGE NUM IN SOURCE (IGNORED FOR FRESH PAGE) +;IF NO 5TH ARG, SAME AS 3RD IF 4TH ARG SPECIFIES JOB. + +;IF 4TH ARG SPECS FILE, USE CURRENT ACCESS PNTR +;IF INSERTING DISK PAGES, THE ACCESS PTR WILL BE +;POSITIONED AT THE BEGINNING OF THE PAGE AFTER THE LAST PAGE INSERTED. + +;BITS IN REGS R AND I: +NCOR$P==400000 ;SOURCE USER ISN'T WRITEABLE. PAGES ARE, IFF PUBLIC. +NCOR$Q==200000 ;SOURCE IS A DISK FILE. + +;CORBLK - COMMENTS ON PRECEDING PAGE. +NCORBL: TSC A,CTLBTS(U) + TLC A,(A) ;WIN FOR IMMEDIATE FIRST ARG + HRRZM C,SRN3(U) ;SAVE PTRS TO 3RD, 5TH ARGS IN SRN3, SRN4 RESPECTIVELY + TLNE C,1000 + TLZA C,-1 + UMOVE C,(C) + SKIPGE C ;IF WILL REWRITE,CHECK FOR PURE + XCTR XRW,[MOVES @SRN3(U)] + HRRZM E,SRN4(U) + CAIGE W,5 ;BUT IF NO 5TH ARG, SAY SO & USE 3RD. + JRST NCORB1 ;DEFAULT E TO C,SETOM SRN4 + TLNN E,1000 ;IMMEDIATE 5TH ARG LEGAL + JRST NCORB8 + JUMPGE C,NCORB7 ;ONLY IF WON'T HAVE TO REWRITE IT + JRST OPNL33 + +NCORB1: SETOM SRN4(U) + MOVE E,C + JRST NCORB7 + +NCORB8: UMOVE E,(E) + SKIPGE C + XCTR XRW,[MOVES @SRN4(U)] +NCORB7: ANDI E,-1 + MOVE J,B + JSP T,NCRUI1 ;GET USER INDEX OF TARGET. + JRST NCORB0 ;IF DOESN'T SKIP, CAN CERTAINLY WRITE. + CAIE J,-1 ;CAN'T STICK PAGE IN 6. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;CANT WRITE SO CANT STICK PAGE IN +NCORB0: MOVEI TT,(J) ;SAVE DEST. USER IDX. + CAIN TT,(U) ;IF NOT ACTING ON SELF, PCLSR TARGET JOB. + JRST NCORC1 + EXCH A,TT + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS DIELOK(A) + MOVEM A,SRN5(U) + MOVSI T,BSSTP ;BUT LEAVE BSSTP SET INSTEAD OF RH + IORM T,USTP(A) + SOS USTP(A) ;BECAUSE CORE JOB WANTS RH TO BE CLEAR + EXCH A,TT + PUSHJ P,LOSSET ;UNDO SETTING OF BSSTP IF WE PCLSR OR FAIL + NCORFS + CAIA +NCORC1: PUSHJ P,LSWPOP ;SOS DIELOK(TT) +;DROPS THROUGH. + +;DROPS THROUGH. ALSO COME HERE FROM ACBLK. +;TARGET DECODED AND STOPPED IF NEC.; USER IDX IN TT. +; NOW DECODE SOURCE IF NEC. +NCORB9: PUSHJ P,SWTL + CIRPSW + TLNE A,%CBNDW ;FORCE WRITE => WRITE. + TLO A,%CBWRT + JUMPE A,NCORD ;0 ACCESS WANTED => DELETE PAGES. + TLO A,%CBRED ;NOT DELETE, WANT AT LEAST READ ACCESS. + CAIGE W,4 ;IF HAD 4TH ARG, DECODE, + JRST NCORC2 ;ELSE USE DECODED 2ND (STILL IN J). + HRRZ J,D + CAIE J,%JSNEW + CAIN J,%JSABS + JRST NCORC2 ;SPECIAL NON-JOB SOURCE, SKIP DECODE +IFN N11TYS,[ + CAIN J,%JSTVB + JRST [ SKIPN TEN11F ;TV11 SOURCE + SKIPL TT11P + JRST OPNL10 ;DEVICE NOT AVAIL + JRST NCORC2] +] + MOVE J,D + JSP T,NCRUI1 ;GET SOURCE USR IDX + JRST NCORB2 + JRST NCORC0 + TLNN H,%CLSQ ;COME HERE IF ARG IS RANDOM IO CHANNEL. + JRST OPNL34 ;NOT DSK => NO GOOD. + MOVE R,J ;2 SKIPS => DISK CHNL; PUT ITS # IN R. + TLO R,NCOR$Q ;INDICATE DISK CHNL + MOVSI T,%QAACC + TDNE T,QSRAC(R) ;INSURE THAT %QAACC WILL BE ON IF OUR + JRST NCORQD + IORM T,QSRAC(R) ;CALL TO QFNTR FINDS EOF. + MOVE T,QFBLNO(R) ;IF %QAACC WAS 0, THEN QRADAD ISN'T SET UP. + MOVEM T,QRADAD(R) +NCORQD: SETOM NCORQC ;1ST TIME THRU NCORL LOOP COMING UP. + CAIGE W,5 + JRST NCORL + MOVE T,E ;DON'T SMASH E, WILL BE WRITTEN BACK TO USER + LSH T,10. ;5TH ARG GIVES PAGE ADDRESS IN FILE FOR DISK CHNL + IMULI T,@QSBYTE(R) + MOVEM T,QRADAD(R) ;SET ACCESS PTR OF DSK CHNL -> SPEC'D PAGE. + JRST NCORL + +NCORC0: TLNN A,%CBNWP ;IF REQUIRE ALTERATION, + JRST NCORB2 + JSP T,NCORW1 ;IF CAN'T WRITE THAT JOB, + HRLI J,NCOR$P ;SET FLAG TO CHECK FOR PUBLIC. +NCORB2: CAIE J,-1 ;IF NOT PDP6, + PUSHJ P,LSWPOP ;SOS DIELOK(J) + CAIN J,LUBLK ;IF SOURCE IS CORE JOB (EVENTUALLY DELETE THESE TWO LINES) + MOVEI J,%JSNEW ; THAT MEANS GET FRESH PAGE +NCORC2: MOVE R,J + CAIN R,%JSNEW ;FRESH PAGE IMPLIES WRITING + TLO A,%CBNDW+%CBWRT + +;DROPS THROUGH + +;DROPS IN + +;NOW HAVE TARGET IDX IN TT, SOURCE IN R (USER INDEX, -1 FOR +; PDP6, %JSTVB, %JSNEW, OR %JSABS). +;TARGET PAGNUM IN C; SOURCE IN E (MAYBE INVALID). +;R 4.9 => WRITE REQUIRES PUBLIC PAGE. +;R 4.8 => R HAS DISK CHNL (AND NCORQC IS -1 THE 1ST TIME AROUND) +;DECIDE WHAT KIND PAGE WANTED AND FIND IT. +;CIRPSW MUST BE ON TOP OF LSWPR. IT WILL BE +;UNLOCKED EVENTUALLY (AND ALSO 1 MORE UNDERNEATH IT +;IF THE TARGET JOB ISN'T US). FAILURE DOES A LSWCLR. +NCORL: MOVEI I,(R) ;I WILL HAVE USR IDX FOR ACTUAL PAGE. + HLRS A ;RH OF A WILL GET ACCESS TO BE GRANTED. + TRNE C,-400 ;CHECK DEST PAGE NUM IN RANGE. + JRST OPNL33 + + PUSH P,U + PUSH P,C + TLNE R,NCOR$Q + JRST NCORQ1 ;DISK FILE +IFN PDP6P,[ + CAIN I,-1 + JRST NCORE4 ;-1 => PDP6 PAGE. +] +IFN N11TYS,[ + CAIN I,%JSTVB + JRST NCORV1 ;TV11 +] + CAIN I,%JSNEW + JRST NCORF0 ;FRESH PAGE. + CAIN I,%JSABS + JRST NCORE1 ;ABSOLUTE PAGE. + CAIL E,400 + JRST NCORE7 ;ELSE SOURCE PAGNUM MUST BE < 400 + MOVEI U,(R) ;SOURCE IS A USER +NCORF2: EXCH E,A ;GET SOURCE PAGNUM IN A + PUSHJ P,UPLC;(A,U) ;FIND THE PAGE WANTED. + EXCH E,A + LDB J,Q ;UPLC RETURNS IN T,Q. + JUMPE J,NCORE6 ;FAIL OR DELETE IF HE HAS NO PAGE THERE. + CAIN J,-1 + JRST NCORE5 ;IF THAT PAGE IS ABS,CHANGE TO ABS REQ. + PUSHJ P,CHACK ;A REAL PAGE, FIND MMP, PREV. PTR. + ADD D,MMPEAD + MOVE B,Q + MOVEI I,(R) ;CHACK CLOBBERS I + TLNN A,%CBNDW+%CBWRT ;IF WANTED ALTERATION, CHECK LEGAL. + JRST NCORB3 + LDB J,T ;1ST OF ALL, SOURCE MUST HAVE WRITE PERM. + TRNN J,600000 + LSH J,20 + TRNN J,400000 + JRST NCORB5 + CAIN R,%JSNEW + JRST NCORF3 +NCORF4: CONO PI,UTCOFF ;DSK XFER COULD COMPLETE, CHANGING INTRANSIT BIT + MOVE J,(D) ; HE HAS WRITE PERM.; GET MMP IN J. + TLNE R,NCOR$P ; CAN'T ALTER IF NEEDED PUBLIC BUT IT ISN'T. + JUMPGE J,[ CONO PI,UTCON .SEE MMPPUB + JRST NCORB5] + TLNE A,%CBPUB ;WE CAN ALTER; CHANGE PUBLIC IF REQ. + TLO J,MMPPUB + TLNE A,%CBPRV + TLZ J,MMPPUB + TLNE A,%CBLOK + TLO J,MMPLOK + TLNE A,%CBULK + TLZ J,MMPLOK + TLNE A,%CBSLO + TLO J,MMPSLO + TLNE A,%CBUSL + TLZ J,MMPSLO + MOVEM J,(D) + CONO PI,UTCON + JRST NCORB3 + +NCORF0: MOVEI U,(TT) ;WHEN CREATING A FRESH PAGE, HAVE TO RE-USE A PREVIOUSLY + MOVEI E,(C) ;EXISTING PAGE IF POSSIBLE, BECAUSE AFTER THE FRESH PAGE + JRST NCORF2 ;IS GIVEN, USER WILL BE PCLSR'ED AND WILL COME IN AGAIN + ;LOOKING FOR A FRESH PAGE. CURRENTLY THIS CAUSES A BUG + ;THAT A "FRESH PAGE" IS NOT ALWAYS ZERO. + +NCORF3: CAIE C,2 ;WANT FRESH PAGE + CAMN C,[SETZ 3] + JRST .+2 + JRST NCORD0 ;SHARED PAGE CAN'T SERVE AS FRESH PAGE + MOVEI I,(TT) + JRST NCORF4 + +;COME HERE IF REQ WRITE ON REAL PAGE BUT CAN'T GRANT. +NCORB5: CAIN R,%JSNEW + JRST NCORD0 ;JUST REPLACE WITH FRESH PAGE + TLNE A,%CBNDW+%CBPUB+%CBPRV+%CBSLO+%CBUSL+%CBLOK+%CBULK ;IF HE INSISTED, FAIL. + JRST NCORE0 + TRZ A,%CBWRT ;ELSE GIVE HIM ONLY READ PERM. +;COME HERE IF PAGE EXISTS TO GIVE ACCESS AS IN A 2.8,2.9 +NCORB3: HRRZ J,(P) + CAIN TT,(I) ;ARE WE REPLACING PAGE BY ITSELF? + CAME E,J + JRST NCORD0 ;NO, DELETE OLD, INSERT NEW. + LDB J,T ;REPLACING PG W/ SELF, SET ACCESS & EXIT. + TRNN J,600000 + JRST NCORI1 + TRNN J,400000 ;CHANGE READ TO RWF + TRC J,600000 + TRNE A,%CBWRT + JRST NCORI2 + MOVSI I,40000 + TROE J,200000 + ANDCAM I,(D) + TRZ J,400000 + JRST NCORI2 + +NCORI1: MOVEI J,1 + TRNE A,%CBWRT + TRO J,2 +NCORI2: DPB J,T + POP P,C + POP P,U + JRST NCORX ;TO END OF LOOP. + +NCORQ1: PUSH P,A + PUSH P,TT + PUSH P,R + MOVEI A,(R) + AOSN NCORQC ;THE 1ST TIME AROUND LOOP? + JRST NCORQ0 ;YES, ACCESS TO 1ST PAGE TO BE INSERTED. + PUSHJ P,QFNTN ;NO, JUST MOVE FORWARD 1 PAGE + JRST NCORE8 ;REACHED EOF, CAN'T INSERT PAGE +NCORQF: POP P,R + POP P,TT + POP P,A + MOVE I,R ;FOUND THE PAGE, GO INSERT IT. + JRST NCORD0 + +NCORQ0: MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST NCORE8 + PUSHJ P,QUDULK ;QFNTR LEAVES IT LOCKED + AOS QSLGL(A) ;DON'T BE FOOLED BY QFNTR'S TRICK + SOS QSBI(A) ;ON THE DISK PI RTNS. + JRST NCORQF + +NCORE8: POP P,R + POP P,TT + POP P,A +NCORE6: CAIN R,%JSNEW ;COPY NONEXISTANT PAGE + JRST NCORD0 ;JUST PUT IN A FRESH PAGE + HRRI A,0 ;CHANGE TO DELETE RQ. + TLNN A,%CBNDR+%CBNDW+%CBPUB+%CBPRV+%CBLOK+%CBULK+%CBSLO+%CBUSL + JRST NCORD0 ;IF INSIST ON ACCESS, FAIL. +NCORE0: PUSHJ P,OPNL32 ;CAN'T GRANT ACCESS OPNL. +POPCUJ: POP P,C ;FAIL OUT OF CALL. + JRST POPUJ + +IFN PDP6P,[ +;REQ FOR PDP6 PAGE. +NCORE4: CAIL E,LPDP6M + JRST NCORE7 ;OUT OF RANGE. + MOVEI B,PDP6BM_<-10.>(E) + JRST NCORE3 ;CONVERT TO ABS REQ, WRITE OK +] + +IFN N11TYS,[ +;REQ FOR TV11 PAGE. +NCORV1: CAIL E,NTVBP + JRST NCORE7 + SKIPL TVCREG(TT) ;IF CONSOLE REGISTER NOT ALREADY SET UP + JRST NCORV2 + MOVE B,TVVBN(TT) ;INITIALIZE IT FROM BLINKER + MOVEM B,TVCREG(TT) + CAMN TT,USER + MOVEM B,400000+TTR10*2000 ;INITIALIZE HARDWARE CONSOLE REGISTER. +NCORV2: LDB B,TTCRT(E) ;GET MAP ENTRY OUT OF EXEUMP + ANDI B,PMRCM ;MASK TO PAGE # + JRST NCORE3 ;CONVERT TO ABS REQ, WRITE OK +] +;REQ FOR ABS PAGE. +NCORE1: MOVEI B,(E) + CAIGE B,TSYSM + JRST NCORE2 ;ACCESS AVAILABLE, READ ONLY + JRST NCORE6 ;CAN'T GET ACCESS TO PAGE. + +NCORE7: PUSHJ P,OPNL33 ;BAD ARG OPNL. + JRST POPCUJ + +;PAGE TO COPY WAS AN ABS PAGE. +NCORE5: CAIN R,%JSNEW + JRST NCORD0 ;SUBSTITUTE A FRESH PAGE + LDB B,T ;GET ABS PAGE NUM. + TRZE B,400000 ;IF HE HASN'T WRITE PERM. + JUMPGE R,NCORE3 ;OR WE CAN'T WRITE IN HIM, +NCORE2: TRZ A,%CBWRT ;CAN'T GET WRITE, + TLNN A,%CBNDW ;FAIL IF INSIST. +NCORE3: TLNE A,%CBPUB+%CBPRV+%CBLOK+%CBULK+%CBSLO+%CBUSL + JRST NCORE0 ;OR IF TRYING TO CHANGE PUBLICNESS. + MOVE D,B ;GET JUST THE PAGE # (NOT THE ACCESS CODE) + ANDI D,PMRCM ;TO INDEX INTO TABLES WITH. +IFN TEN11P,[ + LDB I,[.BP D] ;GET MOBY # + CAIE I,T11CPA_-18. + JRST NCORE9 + MOVE Q,D + SUBI Q,_8 + CAIL Q,256. + JRST 4,. + SKIPN I,T11MP(Q) + JRST 4,. ;SHOULDNT HAVE ABS PNTR TO NOT SET UP PAGE + AOJE I,NCOREA ;CONFLICT PAGE + LDB I,[350500,,T11MP(Q)] + CAIN I,37 + JRST NCOREA ;USAGE COUNT FULL + ADDI I,1 + DPB I,[350500,,T11MP(Q)] + JRST NCOREA +NCORE9:] +IFN PDP6P,[ + CAIL D,PDP6BM_-10. ;IS ABS PAGE # WITHIN RANGE OF PDP6 PAGES? + CAIL D,PDP6BM_-10.+LPDP6M + JRST NCOREB + SKIPL PDP6UP ;IF SO, ALLOW PAGE COPYING, IFF PDP6 IS UP. + JRST NCORE6 + JRST NCOREA + +NCOREB:] + CAIL D,TSYSM + JRST NCORE6 ;DONT ALLOW POINTER TO PAGE ABOVE TOTAL SYSTEM MEMORY + LDB I,[MUR,,MEMBLT(D)] + CAIN I,MUHOLE ;DON'T GIVE ABS PAGE THAT IS NXM. + JRST NCORE6 +NCOREA: MOVEI I,%JSABS ;INDICATE ABS REQ. + JRST NCORD0 + +EBLK +NCORQC: 0 ;COUNTS PASSES THRU NCORL, IF SOURCE IS DISK FILE. + ;FORCES COMPLETE REPOSITIONING IN FILE THE 1ST TIME THRU. +BBLK + +;THIS IS FOR DELETE RQS WHAT NCORL IS FOR INSERTS. +.SEE NCORL ;ABOUT CIRPSW, ACS, ETC. + ;ALSO SEE COMMENTS HALFWAY DOWN THIS PAGE. +NCORD: TRNE C,-400 + JRST OPNL33 ;PAGE NUM. OUT OF RANGE. + PUSH P,U + PUSH P,C +NCORD0: PUSH P,A ;COME IN HERE ON VALID INSERT RQ. +NCORD1: MOVE U,TT + HRRZ A,-1(P) + PUSH P,T + PUSH P,B + PUSHJ P,UPLC ;SAVE TIME BY CHECKING WHETHER PAGE EXISTS. + LDB B,T + SKIPE B + PUSHJ P,PAGERT ;IT EXISTS; DELETE IT. + POP P,B + POP P,T + POP P,A ;FLAG WORD + POP P,C ;TARGET PAGNUM + POP P,U + TRNN A,%CBRED+%CBWRT ;IF NO ACCESS REQ, IS DELETE, THRU. + JRST NCORX +;RH. OF A HAS ACCESS TO GRANT. LH(A) HAS ORIGINAL CONTROL BITS. +;IF I=%JSABS, ABS PAGE, NUM. IN B. +;IF I=%JSNEW, FRESH PAGE. +;IF 4.8 IN I SET, DISK PAGE POINTED TO BY CHNL IN I +;ELSE OLD PAGE, B IS BP -> CIRC LIST, T -> OLD ACCESS. + PUSH P,C ;-3 + PUSH P,E ;-2 + PUSH P,TT ;-1 + PUSH P,A ;0 + TLNE I,NCOR$Q + JRST NCORQ2 ;INSERT PAGE FROM FILE + CAIN I,%JSABS + JRST NCORA ;GO INSERT ABS PAGE + CAIE I,%JSNEW + JRST NCORR ;GO INSERT REAL PAGE. + PUSH P,R + LSH C,9 ;INSERT FRESH PAGE. + MOVEI Q,(TT) ;TARGET JOB + IDIVI TT,LUBLK ;CLOBBERS I. + IORI TT,400000(C) + HRLI TT,204000 + TLNE A,%CBPUB ;MAYBE RQ PUBLIC + TLO TT,1000 + PUSHJ P,NACRFL ;PUT IN CORE RQ (FREES CIRPSW) + JRST NCORF1 + POP P,R + PUSHJ P,SWTL + CIRPSW + HRRZ E,-3(P) ;GET TARGET PAGE NUM + JRST NCORR2 + +NCORF1: SUB P,[5,,5] + JRST OPNL37 ;NO CORE OPNL. + +;COME HERE IF NEED TO WAIT FOR CORE AVAILABLE FOR NEW MMP PAGE. +NCORQW: PUSHJ P,LSWPOP ;UNLOCK TUT. + PUSHJ P,LSWPOP ;AND CIRPSW, SO CORE JOB CAN OPERATE. + MOVEI T,3 ;WAIT TILL MEM HAS BEEN FREED BY CORE JOB. + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL ;RE-LOCK CIRPSW + CIRPSW + MOVE TT,(P) + JRST NCORQB ;THEN RETRY, RELOCKING TUT. + ;FIND OR CREATE MMP ENTRY FOR BLOCK <- DISK CHNL IN I. +;ACCESS TO GRANT IS IN A. +;RETURNS STUFF IN B,T ACCORDING TO COMMENT +;AFTER NCORD1 (IF NEW MMP, IT POINT TO SELF AND B -> IT) +NCORQ2: PUSH P,R + PUSH P,[NCORR3] ;RETURN TO NCORR3, SKIPPING UNLESS MMP FULL + MOVE TT,A + MOVE A,I +NCORQ7: PUSH P,TT ;ENTRY FROM NLOAD +NCORQB: MOVE I,QDSKN(A) + MOVE W,QSLGL(A) + HRL W,I + PUSHJ P,QTLOCK + TRNE TT,%CBCPY ;SPECIFIED COPY-ON-WRITE? + JRST NCORQ6 ;GET FRESH COPY OF PAGE + MOVE B,W ;ELSE TRY TO SHARE EXISTING COPY OF PAGE + IDIVI B,SHRHSL ;LOOK UP IN SHAREABLE-PAGE HASH TABLE + MOVEI B,SHRHSH-1(C) +NCORQ5: HRRZ B,1(B) ;THREAD TO NEXT MMP ENTRY IN BUCKET + JUMPE B,NCORQ6 ;END OF LIST, DESIRED PAGE NOT FOUND + HLRZ C,1(B) ;GET DISK ADDRESS OF THIS PAGE + LDB R,[$MMPUN,,(B)] + CAIN C,(W) + CAIE R,(I) + JRST NCORQ5 ;NOT THE ONE WE WANT + MOVEI R,(B) ;SET UP MMP IDX IN R + SUB R,MMPEAD ;AS GMMPP RETURNS IT. + PUSHJ P,QTULK ;TUT ALREADY AOS'ED. + MOVSI T,MMPGON + TDNE T,(B) + JRST [ MOVSI T,MMPTMP ;MMP ENTRY GOING AWAY. + TDNE T,(B) ;IF DISK TRANSFER ALSO IN PROGRESS, + JRST NCRMMW ; GO WAIT FOR THINGS TO SETTLE WITH CIRPSW FREE. + PUSH P,A + PUSHJ P,RETMM4 ;CLEAR PENDING FREEAGE + POP P,A + JRST NCORQB ] ;AND TRY AGAIN + MOVEI C,-1 + HRRZ T,(B) ;GET CIRC PNTR OUT OF MMP ENTRY. + CAIL T,600000 ;SKIP IF DOESN'T POINT TO MEMORY + TDNE C,MMSWP-600000(T) ;SKIP IF IT'S A LOOSE PAGE + JRST NCORQ8 + HRRZ C,MEMPNT-600000(T) + CAIE C,400000(R) ;SKIP IF NO USERS IN CIRCULAR LIST + JRST NCORQ8 ;NOT REALLY LOOSE, USERS LINKED BUT NOT CONNECTED + MOVEI C,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE W,FLOOSP +NCORQ3: MOVE TT,C ;TT PREDECESSOR + SKIPN C,W ;W SUCCESSOR + JRST 4,. ;NOT IN LOOSE PAGE LIST? + LDB W,[MLO,,MEMBLT(C)] + CAIE C,-600000(T) + JRST NCORQ3 + SKIPE TT + DPB W,[MLO,,MEMBLT(TT)] + SKIPN TT + MOVEM W,FLOOSP + SKIPN W + MOVEM TT,LLOOSP + SOSL NLOOSP + JRST NCORQ8 + JRST 4,. ;NLOOSP WAS TOO SMALL? + +NCORQ6: SOSGE MMPFR ;NEED TO CREATE NEW MMP ENTRY; COMMIT ONE + JRST [ AOS MMPFR ;MMP FULL + JRST POPTTJ ] ;TAKE ERROR RETURN + PUSHJ P,GMMPP ;GET FREE MMP ENTRY (CAN'T PCLSR AFTER THIS SUCCEEDS) + JRST NCORQW ;WAIT FOR MORE MEM + PUSHJ P,QTAOS1 ;AOS TUT FOR BLOCK (TUT ALREADY LOCKED) + HRLZM W,1(TT) ;STORE DISK ADR + MOVE D,R + IOR D,[MMPOUT+MMPWOD,,400000] ;SWAPPED OUT, MMP POINTING TO SELF + DPB I,[$MMPUN,,D] + MOVE C,(P) ;A + TRNE C,%CBCPY + TLCA D,MMPWOD+MMPISW ;COPYING, SO SET INITIAL-SWAPIN + JRST [ MOVE B,W ;NO COPYING, SO + IDIVI B,SHRHSL ;STICK INTO SHAREABLE-PAGE HASH TABLE + MOVE B,SHRHSH(C) + HRRM B,1(TT) + HRRZM TT,SHRHSH(C) + TLO D,MMPSHR ;FLAG MMP ENTRY AS IN SHRHSH TABLE + JRST .+1 ] + MOVEM D,(TT) + HRRZ B,TT + AOS NPGSWO +NCORQ8: MOVE T,[300,,[3]] + HRLI B,2200 + AOS -1(P) ;SUCCESS RETURN + JRST POPTTJ + +NCORA: MOVEI A,(C) + MOVE U,TT ;INSERT ABS PAGE. + PUSHJ P,UPLC ;FIND TARGET PAGE + IOR B,(P) ;COMBINE ACCESS W/ PAGE NUM. + TRZ B,PMAGEM\PMUNSD\PMCSHM +IFE KA10P,[ + TRNE B,PMRCM ;PAGE 0 NOT CACHED + IORI B,PMCSHM +] + LDB D,T + TRZ D,PMAGEM ;TURN OFF REMNANT AGE BITS + JUMPN D,[JRST 4,.] ;SHOULD HAVE DELETED PAGE ALREADY + DPB B,T + MOVNI B,1 ;CIRC. PTR. IS -1. + DPB B,Q + MOVEI E,(A) + JRST NCORR2 + + ;VIRTUAL PUSHJ AT NCORQ2 +NCORR3: JRST [ SUB P,[5,,5] ;MMP WAS FULL + JRST OPNL37 ] + POP P,R ;COME HERE FOR DSK PG, AFTER FINDING MMP. + MOVE C,QRADAD(A) ;MOVE ACCESS POINTER OF FILE TO + IDIVI C,@QSBYTE(A) ;NEXT PAGE BOUNDARY, BEING CAREFUL + IORI C,1777 ;ABOUT BYTES. + AOS C + IMULI C,@QSBYTE(A) ;NEXT USE OF FILE WILL GET + MOVEM C,QRADAD(A) ;WHAT FOLLOWS PAGES MAPPED. + MOVSI C,%QAACC ;INDICATE ACCESS PTR CHANGED. + IORM C,QSRAC(A) +;COME HERE TO INSERT PG FROM OTHER USER. +NCORR: HRRZ E,-3(P) ;TARGET PAGE # C + HRRZ U,-1(P) ;TARGET JOB TT + HRRZ TT,(P) ;ACCESS (WRITE BIT IN 2.9) + PUSHJ P,NCORR1 ;ACTUALLY MUNG MAP. +NCORR2: PUSHJ P,GHUSRA ;TARGET PAGE NUM MUST BE IN E + POP P,A + POP P,TT +NCORA1: POP P,E + POP P,C +;COME HERE AFTER HANDLING 1 PAGE. +NCORX: MOVE U,USER + CLRPGM (U) + JUMPGE C,NCORX1 ;IF LH POS, DON'T REWRITE. + ADD C,[1,,1] + ADDI E,1 + UMOVEM C,@SRN3(U) + SKIPL SRN4(U) ;REWRITE 5TH ARG ONLY IF WAS GIVEN. + UMOVEM E,@SRN4(U) + JUMPGE C,NCORX1 + TLNN A,%CBRED + JRST NCORD ;LOOP AROUND FOR DELETE RQ + JRST NCORL ;FOR INSERT RQ. + +NCORX1: AOS (P) +NCORX0: PUSHJ P,LSWPOP ;FREE CIRPSW +NCORX2: CAIN TT,(U) ;IF NOT ACTING ON SELF, + POPJ P, + JRST LSWPOP ;CAN'T FALL THRU SINCE MIGHT BE NULSET. + +;THIS IS A LOSSET ROUTINE TO CLEAR THE BSSTP BIT OF THE JOB +;WHOSE INDEX IS IN THE SRN5 OF THE RUNNING JOB. +NCORFS: MOVE A,SRN5(U) + MOVSI T,BSSTP + ANDCAM T,USTP(A) + POPJ P, + ;JSP T,NCORUI WITH JOB-SPEC IN J, RETURNS USER IDX IN J (OR ,,-1 FOR PDP6) + +;JOB SPECS ARE: +; -1 OR ,,-1 FOR SELF. +; (MUST BE USR, STY, JOB OR BOJ DEVICE ELSE OPNL34) +; 400000+ JOB WITH THAT NUMBER (OPNL35 IF NONE) +; ( -1,, ALSO WORKS) +;IF THIS JOB IS CERTAINLY ALLOWED TO MODIFY SPEC'D JOB, DOESN'T SKIP. +;IF SKIPS ONCE, MUST CHECK FARTHER. IN EITHER CASE, DIELOK OF JOB HAS BEEN AOS'D +;AND SOSSET'ED, UNLESS ENTRY POINT WAS NCRUI2, OR JOB IS PDP6. +;2 SKIPS => ARG IS RANDOM I-O CHANNEL; CLSTB ENTRY IN H. +;IN THAT CASE, NO SOSSET WAS DONE. RANDOM CHANNELS ALLOWED ONLY IF ENTRY POINT IS NCRUI1. + +NCRUI2: HRLI T,200000 ;ENTRY TO SUPPRESS AOS'ING OF DIELOK, AND SOSSET'ING. + JRST NCRUI3 + +NCRUI1: TLOA T,400000 ;ENTRY FOR RANDOM CHNLS OK (SKIP TWICE IF SO) +NCORUI: TLZ T,400000 ;RANDOM DEVS NOT OK + TLZ T,200000 +NCRUI3: TRZE J,400000 + HRLI J,-1 + JUMPL J,NCORU1 + CAIL J,NIOCHN ;>0 => CHNL NUM. + JRST OPNL14 + ADDI J,IOCHNM(U) + MOVE H,(J) + HLRZ J,H + SKIPGE H,CLSTB(H) + JRST NCORU4 ;IF INFERIOR, CAN WRITE. + TLNE H,%CLSBJ ;OR IF BOJ DEVICE + JRST [HRRZ J,JBCUI(J) ? JRST NCORU4] + TLNE H,%CLSST ;STY => USE JOB THAT HAS ASSOCIATED TTY. + JRST [ SKIPGE J,TTYSTS(J) + JRST OPNL41 ;NO JOB HAS THAT TTY. + ANDI J,-1 + JRST NCORU4] + TLNE H,%CLSFU ;FOREIGN USR, MUST CHECK. + AOJA T,NCORU4 +IFN PDP6P,[ + TLNN H,%CLS6 + JRST NCORU5 ;RANDOM DEVICE. (MAYBE DISK) +NCRUI6: MOVEI J,-1 ;PDP6, MUST CHECK. + JRST 1(T) +];PDP6P +NCORU5: JUMPL T,2(T) ;RANDOM DEVICE, SKIP TWICE IF THATS OK + JRST OPNL34 + +NCORU1: TRNE J,777400 ;CHECK FOR -1 FOR SELF. + JRST NCORU2 + ANDI J,377 + CAIN J,377 ;CHECK FOR 377 => SUPERIOR. + JRST NCORU3 +IFN PDP6P,[ ;AND FOR 376 => PDP6. + CAIN J,376 + JRST NCRUI6 +] + IMULI J,LUBLK ;ELSE WAS USRNUM, + CAMGE J,USRHI ;CHECK FOR VALID USER + SKIPN UNAME(J) + JRST OPNL35 ;IF NOT, NO SUCH JOB. + AOJA T,NCORU4 + +NCORU2: CAME J,[-1,,377777] + JRST OPNL33 + MOVEI J,(U) +NCORU4: CONO PI,CLKOFF + MOVE H,APRC(J) ;IS THE JOB WE'RE HACKING DIEING? + TLNE H,BULGOS + JRST OPNL42 ;YES, PREVENT TIMING ERRORS. + TLNE T,200000 ;UNLESS ENTRY POINT WAS NCRUI2, + JRST NCORU6 + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSH P,T + PUSHJ P,SOSSET + DIELOK(J) + POP P,T +NCORU6: CONO PI,CLKON + JRST (T) + +NCORU3: SKIPGE J,SUPPRO(U) ;GET SUPERIOR, + JRST OPNL35 + MOVEI J,(J) + AOJA T,NCORU4 + +;SKIP IF ALLOWED WRITE ACCESS TO PAGES FROM SOURCE IN J +;USE IF NCORUI ETC. SKIPS ONCE. CALL BY JSP T,. + +NCORW1: +IFN PDP6P,[ + CAIN J,-1 ;IF IT GETS THIS FAR, USER HAS A PDP6 CHANNEL, + JRST 1(T) ; THEREFORE OBVIOUSLY IS ALLOWED TO WRITE PDP6 MEMORY. +];PDP6P + CAIE J,LUBLK ;CAN GET WRITE ACCESS TO FRESH PAGE, +;SKIP IF ALLOWED TO MODIFY PAGE MAP OF TARGET JOB IN J. +NCORWR: CAIN J,(U) ;CAN DO THAT AND STICK PAGE IN SELF + JRST 1(T) + HRRZ H,SUPPRO(J) + CAIE U,(H) ;AND OUR INFERIORS + CAMN U,SERVER(J) ; and anyone who thinks we are a server + JRST 1(T) + SKIPL H,JBI(U) ;AND OUR BOJ DEVICE. + CAIE J,JBCUI(H) + JRST (T) + JRST 1(T) + +;.CBLK AC, +;(OBSOLESCENT) + ;AC 4.9 MUST BE ZERO + ;4.7 USED INTERNALLY IN CODE (W RQ ON PDP6) + ;4.3-4.1 = 0 GET PAGE FROM SELF + ; = 1 GET ABSOLUTE PAGE + ; = 2 GET PAGE FROM USER OPEN ON CH # 3.1-3.8 + ; = 3 GET PAGE FROM USER NUMBER 3.1-3.8 + ; = 4 GET PAGE + ; = 5 GET PAGE (PUBLIC) + ; = 6 MAKE PAGE PRIVATE + ; = 7 MAKE PAGE PUBLIC + ;3.9=1 REQUEST WRITE PERMISSION (IGNORED ON FRESH PAGE, OTHERWISE VALID ONLY FOR + ; SELF OR DIRECT INFERIOR OPEN ON CH OR PUBLIC PAGE) + ;3.1-3.8 USER NUMBER OR CH # (377 => CREATOR IF JOB DEVICE) + ;2.9=1 INSERT PAGE, 0 DELETE (IGNORES 4.3-4.1 EXCEPT FOR 6 OR 7 WHEN IT IS IGNORED) + ;2.1-2.8 VIRTUAL PAGE TO BE AFFECTED + ;1.1-1.9 BLOCK # IN ABSOLUTE OR OTHER USER (OR SELF IF 4.3-4.1 = 0) + +;TO CALL NCBLK, SET UP Q WITH USER INDEX REQUEST IS FOR AND U WITH +;THE USER INDEX MAKING THE REQUEST + +;NEW .CBLK CODE, PASSES THE BUCK TO CORBLK. +;SAME AS FAR AS CALLER IS CONCERNED. + +ACBLK: MOVE TT,U ;TARGET USR IDX. + UMOVE B,(J) +NCBLK0: MOVEI W,5 ;FAKE 5 ARGS TO NCORBL + LDB C,[111000,,B] ;TARGET PAGNUM. + LDB E,[1100,,B] ;SOURCE PAGNUM. + TRNN B,400000 + JRST NCBLKD ;LIKELY TO BE DELETE RQ. +NCBLK1: MOVSI A,210000 ;NOT DELETE => RQ READ, FAIL IF CAN'T. + LDB D,[221000,,B] ;SOURCE USR IDX OR CHNL NUM. + LDB H,[330300,,B] ;REQUEST TYPE-CODE. + JRST .+1(H) + + JRST NCBLKS ;TYPE 0, SOURCE IS SELF. + JRST NCBLKA ;TYPE 1, GET ABS PAGE. + JRST NCBLKC ;2, USE SPEC'D CHNL NUM. + JRST NCBLKI ;3, USE SPEC'D USR IDX. + JRST NCBLKF ;4, FRESH PAGE. + JRST NCBLKP ;5, FRESH PUBLIC PAGE. + TLOA A,420000 ;6, MAKE PRIVATE, SOURCE=TARGET. + TLO A,440000 ;7, MAKE PUBLIC, " " + MOVE E,C ;SOURCE PAGNUM _ TARGET PAGNUM, +NCBLKS: TROA D,-1 ;GET PAGE FROM SELF. (%JSELF=-1) +NCBLKA: MOVEI D,%JSABS ;GET ABS PAGE +;IF GET-FROM-CHANNEL, THE CHNL NUM IN D IS DESIRED JOB-SPEC. +NCBLKC: TLNE B,400 ;IF WRITE-RQ BIT ON, + TLO A,100000 ;INSIST ON WRITE ACCESS. +NCORBX: CAIE TT,(U) ;IF TARGET .NE. SELF, + PUSHJ P,NULSET ;FAKE OUT THOSE EXPECTING A LOSSET. + JRST NCORB9 + +NCBLKI: IORI D,%JSNUM ;GET FROM USR IDX, MAKE JOB SPEC. + JRST NCBLKC + +NCBLKP: TLO A,40000 ;GET FRESH PUBLIC PAGE. +NCBLKF: MOVEI D,%JSNEW ;GET FRESH PAGE + JRST NCBLKC + +NCBLKD: TLC B,6000 ;COME HERE IF BIT 2.9 IS 0 + TLCN B,6000 + JRST NCBLK1 ;(TYPES 6,7 IGNORE THAT BIT) + SETZB A,B ;OTHERWISE IS DELETE REQUEST. + JRST NCBLKS + +NCBLK: MOVE B,TT + MOVE TT,Q + JRST NCBLK0 + +;ACTUALLY COPY A PAGE FROM ONE MAP TO ANOTHER +;T PNTR TO MAP COPYING FROM +;TT 400000 BIT 1=> WRITE +;E TARGET PAGE # +;U TARGET USER +;B PNTR TO CIRC LIST + +NCORR1: LDB J,T ;ENTRY FROM NCORR + TRNN J,600000 + JRST ACBK3A ;PAGE NON EXISTANT OR SWAPPED OUT + TRNN TT,400000 ;WRITE RQ ? + TRZ J,400000 ;DOESN'T RQ MORE + TRNN J,600000 + TRO J,200000 ;IN CASE OF RWF +ACBK3B: MOVE A,E ;TARGET PAGE # + PUSHJ P,UPLC + LDB C,T ;GET PTW ABOUT TO BE CLOBBERED + TRZ C,PMAGEM ;TURN OFF AGE BITS + JUMPN C,[JRST 4,.] ;SHOULD HAVE DELETED PAGE BY NOW + DPB J,T ;SET UP MAP + TRNN J,600000 + JRST ACBK3C ;JUMP IF PAGE SWAPPED OUT + ANDI J,PMRCM + CAIL J,TSYSM + JRST 4,. +IFE SWPWSP, AOS MMSWP(J) ;AOS NUMBER OF USERS POINTING TO PAGE +IFN SWPWSP,[ + HRRZ TT,MMSWP(J) + AOS MMSWP(J) ;AOS NUMBER OF USERS POINTING TO PAGE + MOVSI C,1 ;ADJUST WORKING SET OF TARGET JOB + IDIV C,TT ;1,,0 IF DIVISION BY ZERO + ADDM C,UWRKST(U) + JUMPE TT,ACBK3D ;JUMP IF NO SHARERS + IMULI TT,1(TT) ;COMPUTE ADJUSTMENT TO ALL WORKING SETS + MOVSI C,-1 ;DUE TO INCREASE IN SHARING + IDIV C,TT + MOVE D,C + PUSH P,U + PUSH P,I + PUSHJ P,UCPRL7 ;CLOBBERS C,H,I,U + 400000,,SWOP6B + POP P,I + POP P,U +];SWPWSP +ACBK3D: LDB J,B ;POINTER TO PREVIOUS IN CHAIN + DPB J,Q ;PATCH + MOVE C,U + IDIVI C,LUBLK + DPB C,[101000,,A] + DPB A,B ;PATCH + AOS NMPGS(U) + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE + POPJ P, + +ACBK3A: TRNN TT,400000 + TRZ J,2 + TRO J,1 ;IN CASE OF R/W/F + JRST ACBK3B + +ACBK3C: AOS NSWPGS(U) + AOS SNSWPG + JRST ACBK3D + ACRF1: MOVE TT,B + MOVE W,Q ;INDEX OF USER THAT REQUEST IS FOR + IDIVI W,LUBLK ;CLOBBERS H + HRL TT,W + TLNE TT,600000 + JRST 4,. + JRST ACRFL + +NACRFL: PUSHJ P,LSWPOP ;UNLOCK CASW OR CIRPSW +ACRFL: PCLT + SKIPL CORRQ(U) ;CURRENT USER IN U COR RQ FOR USER IN Q + PUSHJ P,UFLS ;WAIT FOR MY CORE RQ TO CORE JOB TO CLEAR + MOVSI J,BUSRCR + MOVE T,J + TDNE T,APRC(Q) + PUSHJ P,UFLS ;SOMEBODY ELSE HAS RQ IN ON THIS JOB WAIT TO CLEAR + PUSHJ P,SWTL + CASW ;GET CORE ASSIGN SW + TDNE J,APRC(Q) + JRST NACRFL ;CHECK FOR TIMING ERROR + TLNN TT,200000 + JRST ACRF6 ;OLD TYPE + MOVNI J,1 ;ADDING ONE BLOCK + MOVEI B,105 ;FAKE OUT CORE TO ZERO CHECK + JRST ACRF8 + +ACRF6: MOVE J,HUSRAD(Q) + LSH J,-10. + CAMN J,B + JRST LSWPJ1 ;SAME AMOUNT AS NOW + MOVE T,APRC(Q) + TLNE T,BULGOS + JUMPN B,LSWPOP ;TRYING TO CORE NON-ZERO A JOB THAT IS DYING? + SUB J,B ;GET AMT OF DECREASE (- => INCREASE) + CAMGE J,[-20.] + JRST ACRF6A ;GET 20 AT A WHACK MAX +ACRF8: MOVN I,J ;I GETS POSITIVE # OF PAGES ADDED + ADD J,MEMFR + SUB J,NCBCOM ;J GETS AMT THAT WILL BE LEFT + CAIGE J,5 + JUMPG I,ACRF7 ;NOT ENUF CORE + MOVEI J,0 ;INDICATE RQ WILL BE COMPLETELY SATISFIED + CAIL I,20. + MOVNI J,1 ;MAKE SURE RQ IS REALLY FILLED +ACRF5: JUMPL I,ACRF2 ;JUMP IF DECREASING CORE + JUMPE Q,ACRF3 ;SYSTEM JOB DOESN'T USE MMP + MOVN T,I + ADDB T,MMPFR ;COMMIT SUFFICIENT NUMBER OF MMP ENTRIES + JUMPGE T,ACRF3 ;JUMP IF THAT MANY ARE AVAILABLE + ADDM I,MMPFR ;MMP FULL, DECOMMIT THE MMP ENTRIES + JRST LSWPOP ;AND TAKE ERROR RETURN + +ACRF2: AOSA NCRQL ;COUNT # REQUESTS FOR LESS +ACRF3: ADDM I,NCBCOM ;IF EXPANDING, COMMIT SUFFICIENT AMOUNT OF PHYSICAL CORE + MOVSI T,BUSRCR + IORM T,APRC(Q) ;CORING USER + MOVEM TT,CORRQ(U) + AOS NCORRQ + PUSHJ P,LSWPOP ;UNLOCK +IFN SCHBLN,[ + CONO PI,CLKOFF ;GET CORE JOB TO RUN RIGHT AWAY + MOVE I,USER ;THEN COME RIGHT BACK TO US (WHAT A CROCK THIS ALL IS) + PUSHJ P,SCHSB + MOVEI I,LUBLK + PUSHJ P,SCHSB + CONO PI,CLKON +];SCHBLN + PCLT + SKIPL CORRQ(U) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS + JUMPN J,ACRF1 ;REALLY NEED TO TAKE ANOTHER WACK AT THIS + JRST POPJ1 + +ACRF7: PUSHJ P,LSWPOP + PCLT + MOVE T,I + PUSHJ P,CFHPO3 + PUSHJ P,UFLS + TLNE TT,200000 + JRST ACRFL + JRST ACRF1 + +ACRF6A: ADDI J,20. + ADD TT,J ;GET REDUCED RQ + MOVNI J,20. + JRST ACRF8 + +SUBTTL CORE ALLOCATOR - CORE JOB ROUTINES + +CORJI: MOVE P,USRPDL+L ;SET UP CORE JOB PDL + JRST CORJOB + +CORJ2: AOSN UTBFLF + JRST UTBFF ;FLUSH UTAPE + AOSN UFDFLF + JRST UFDFF ;FLUSH 2314 UFDS + SKIPE MMPFS2 + JRST RETMM2 ;FLUSH PARTIALLY-RETURNED MMP ENTRIES + SKIPE QFBTS + JRST [ PUSHJ P,QDLFBT ;RETURN DISK BLOCKS TO FREE + SOS NCORRQ + JRST CORJOB ] + SKIPE NCRQL + JRST CORJOB ;RQ'S FOR LESS HAVE COME IN. BETTER EXECUTE THEM OR MAY NOT HAVE ENUF CORE + SKIPL CORUPU + JRST CORUP ;FOUND USER IN SEARCH WHO WANTS MORE GIVE IT TO HIM + SKIPL CORSRV + JRST CORJOB + MOVE A,LMEMFR + CAMGE A,MINCOR + PUSHJ P,CFLM1 ;FREE SOME LOW MEMORY BY SHUFFLING + SKIPLE NCORRQ + SOS NCORRQ ;CAN'T FIND ANYTHING TO DO SO DECREMENT COUNT + ;THIS CAN HAPPEN AS A RESULT OF EXCESS ATTEMPTED UTAPE FLUSHAGE + ;OR DUE TO CALLING CFLM1 +CORJOB: PUSHJ P,ACMTC ;XFER ANY "SPECIAL FREE" MEM BLOCKS TO FREE + SKIPN NCORRQ ;ANYONE WANT CORE? + PUSHJ P,[ ;IF NOT, WAIT UNTIL SOMEONE DOES, BUT FIRST + MOVE TT,QMDRO ;SEE IF MFD AND TUTS NEED TO BE READ IN + AOJE TT,IDSK + JRST UFLS ] ;WAIT + SETOM CORSRV ;INITIALIZE NO RQS SERVED THIS PASS + SETOM CORUPU + MOVNI U,LUBLK ;SCAN FOR USER WITH HIGHEST PRIORITY +CORLUP: ADDI U,LUBLK + CAML U,USRHI + JRST CORJ2 ;THRU EXAMINE RESULTS OF SEARCH + SKIPGE B,CORRQ(U) + JRST CORLUP + TLNE B,200000 + JRST CORNEW + LDB Q,[221000,,B] + IMULI Q,LUBLK + MOVE A,HUSRAD(Q) + LSH A,-10. ;COMPUTE # BLKS JOB HAS NOW + CAIN A,(B) + JRST 4,CORL1 ;SAME AS NOW, CHECKED FOR AT ACORE + CAIG A,(B) + JRST CORLUG ;INCREASE + MOVEM U,CORUPU ;DECREASE HAS PRIORITY + HRRZS B + SUB B,A + MOVEM A,CORUPS + MOVEM B,CORUPA ;DIFFERENCE + MOVEM Q,CORUUC + JRST CORUP + +CUSTOP: PUSHJ P,RPCLSR ;STOP USER WHO IS BEING CORED + MOVSI T,BUCSTP ;(THE BUCK STOPS HERE) + IORM T,USTP(A) + PUSHJ P,UPCLSR + MOVEI T,-1 ;GET MASK FOR RH + TDNE T,USTP(A) ;WAIT FOR RANDOM STOPS TO CLEAR + PUSHJ P,UFLS + POPJ P, + +;Core job initializes disks while system job stands around and supervises +;This makes it possible for system job to print any resulting error messages +;Provided no one hits ^Z too soon +IDSK: MOVE I,MDSK + MOVE U,USER + PUSHJ P,QMCH1 + MOVSI I,-NQS + SKIPL QACT(I) + PUSHJ P,QTCH1 + AOBJN I,.-2 + MOVSI TT,SCLIDK ;System is up now + IORM TT,SUPCOR + JRST CORJI + +EBLK + +CORUPU: -1 ;BEST USER SO FAR TO CHANGE CORE + ;IF SETOMED AT CORUPR, REQUEST NOT COMPLETELY FILLED +CORUPA: 0 ;INCREASE AMOUNT(1 FOR .CBLK) +CORUPS: 0 ;CURRENT SIZE +CORUUC: 0 ;USER CORE REQ ACTUALLY FOR +CORSRV: -1 ;0 => RQ SRVED THIS TIME THRU USER VARS +NCRQL: 0 ;# RQS FOR LESS + +BBLK + +CORLUG: HRRZS B ;GUY WANTS MORE GIVE GUY WHO WANTS LEAST PRIORITY + SUB B,A +CORLUH: MOVE A,NMPGS(Q) + SKIPGE CORUPU + JRST CORLG1 ;FIRST + CAMGE B,CORUPA ;IS RQ SMALLER? + JRST CORLG1 +CORLG2: CAME B,CORUPA ;OR IF TIE GIVE IT TO GUY WHO IS SMALLER NOW + JRST CORG1A + CAML A,CORUPS ;IS RQ= & SIZE SMALLER? + JRST CORG1A +CORLG1: MOVEM U,CORUPU ;HIGHEST PRIORITY SO FAR + MOVEM B,CORUPA + MOVEM A,CORUPS + MOVEM Q,CORUUC +CORG1A: JRST CORLUP + +CORNEW: LDB Q,[1100,,B] ;.CBLK TYPE RQ + IMULI Q,LUBLK + MOVEI B,1 + JRST CORLUH + +CORUP: ;EXECUTE REQUEST + MOVE U,CORUUC + MOVEM U,CUSER + SKIPL D,CORUPU + SKIPN UNAME(U) + JRST 4,. + MOVE A,CORUUC + JUMPE A,CORUP8 ;DONT USTOP SYS JOB + PUSHJ P,CUSTOP ;STOP GUY +CORUP8: PUSHJ P,SWTL + CIRPSW + MOVE TT,CORRQ(D) + TLNE TT,200000 + JRST CORUPN ;.CBLK TYPE + MOVE B,CORUPS + MOVE A,B ;A HAS CURRENT SIZE + ADD B,CORUPA ;B HAS NEW SIZE + PUSHJ P,SWTL + MEMFRZ + SKIPL J,CORUPA + JRST CORM1C ;WANTS MORE THAN NOW +CORL2: LDB A,[121100,,HUSRAD(U)] + CAMG A,B + JRST CORUPR + SOS A + PUSH P,B + PUSHJ P,UPGRTN ;RETURN USER PG + POP P,B + JRST CORL2 + +CORUPR: MOVE U,CUSER ;FINISHED FOR NOW ANYWAY REVIVE USER + SKIPN UNAME(U) + JRST 4,. +IFN E.SP,[ + CAMN U,DISUSR + PUSHJ P,E.SLPM ;LOAD PAGE MAP +] +IFN 340P,[ + CAMN U,DISUSR + PUSHJ P,DCRRST ;DIS IS RUNNING BUT UPDATE UPR ETC +] + MOVSI A,BUCSTP + ANDCAM A,USTP(U) ;RESTART USER + PUSHJ P,LSWPOP ;UNLOCK MEMORY + PUSHJ P,LSWPOP + PUSHJ P,ACMTC ;XFER IN PROCESS BLOCKS TO FREE + SKIPGE U,CORUPU + JRST CORJOB ;NOT THRU WITH THIS RQ + MOVE A,CORUUC ;THRU WITH RQ + SETOM CORUPU + SKIPGE CORUPA + SOS NCRQL ;FINISHED A REQUEST FOR LESS, DECREMENT COUNT OF THEM + MOVSI TT,BUSRCR + ANDCAM TT,APRC(A) ;CLEAR RQ PENDING THIS USER FLAG +CORL1: SETOM CORRQ(U) + CLEARM CORSRV + SOSE NCORRQ + JRST CORLUP + JRST CORJOB + +CORUPN: LDB A,[111000,,TT] + PUSHJ P,SWTL + MEMFRZ + PUSH P,A + PUSHJ P,UPGRTN + POP P,E + TLNE TT,4000 + TRNN TT,400000 + JRST 4,. + TLO E,600000+PMCSHM ;ADD FRESH PAGE + PUSH P,TT + PUSHJ P,CORGP + POP P,TT + LDB A,[111000,,TT] + PUSHJ P,UPLC + LDB B,T + TRNN B,400000 + JRST 4,. ;LOSEY + MOVE C,Q + PUSHJ P,UCPRL + 200000,,[ LDB B,[330100,,TT] + DPB B,[430100,,(C)] + POPJ P, ] ;SET TO DESIRED PUBLICNESS + SOS NCBCOM + JRST CORUPR + +CORM1C: MOVEM J,CORCNT +CORM1A: JUMPE U,CORS2 ;SNIFFLE +CORM1B: MOVE U,CORUUC + LDB E,[121100,,HUSRAD(U)] + TLO E,600000+PMCSHM + PUSHJ P,CORGP + SOS NCBCOM + SOSLE CORCNT + JRST CORM1A + JRST CORUPR + + ;INSERT FRESH PAGE INTO USR MEM IN PLACE SPECIFIED BY E PROT BITS IN LH +;MMPFR SHOULD HAVE BEEN SOS'ED ALREADY + +CORGP: JUMPN U,CORGP0 ;JUMP UNLESS GIVING PAGE TO SYS JOB + MOVE A,SJSPG ;GOBBLE PAGE RESERVED + SETZM MEMBLT(A) + CAIL A,SYSB + JRST CORGP1 ;USER VARIABLES, CLEAR IT OUT + JRST CORGP2 ;INITIAL GET OF SYSTEM, DON'T ZERO IT + +CORGP0: PUSHJ P,GMMPP ;RETN MMP PNTR IN R + JRST CORGPZ + PUSHJ P,TCALL + JRST HMEMRQ ;GET MEM, HIGH IF POSSIBLE + JRST 4,. +CORGP1: PUSHJ P,CZRR +CORGP2: AOS NMPGS(U) + AOS SNMPGS ;INCR SYS PAGE COUNT (VIRT) + PUSH P,A ;REAL CORE BLOCK # + HRRZ A,E ;ADDR IN USERS MAP + PUSHJ P,UPLC + POP P,A + LDB B,Q + SETZM MMSWP(A) + JUMPE U,CORGP3 ;IF SYS JOB, DON'T TRY TO SET UP MAP + JUMPN B,[JRST 4,.] ;ALREADY HAS PAGE + AOS MMSWP(A) ;INDICATE THAT ONE USER MAP POINTS AT THIS PAGE + TSO A,E ;SET PROTECTION BITS + DPB A,T ;STORE IN USER'S MAP + MOVE C,R ;MMP IDX + TRO R,400000 ;MAKE USERS CP POINT AT MMP + DPB R,Q +IFN SWPWSP,[ + MOVSI TT,1 ;INCREASE WORKING SET + ADDM TT,UWRKST(U) +];SWPWSP + ANDI A,PMRCM ;TURN ACCESS BITS BACK OFF +CORGP3: CAIL A,TSYSM + JRST 4,. + MOVEI TT,MURUSR + DPB TT,[MUR,,MEMBLT(A)] ;SET USER FIELD IN MEMBLT + MOVE TT,U + IDIVI TT,LUBLK + LSH TT,8 + IOR TT,E ;PG # IN USER'S MAP + SKIPN U + MOVEI TT,600000(A) ;IF SYS JOB, MEM BLOCK POINTS AT SELF + HRRZM TT,MEMPNT(A) ;ELSE MAKE MEM BLOCK POINT AT USERS MAP + JUMPE U,GHUSRA ;IF SYS JOB, NO MMP ENTRY + DPB C,[MMMPX,,MEMBLT(A)];STORE INDEX OF MMP ENTRY IN MEMBLT + TRO A,600000 + HRRM A,MMP(C) ;MAKE MMP POINT AT MEM BLOCK + PUSHJ P,CHACK ;FOR CHECKING ONLY + CAME C,[SETZ 3] ;REAL MEM, 3 ENTRIES (MMP, MEMPNT, USER) + JRST 4,. +GHUSRA: AOS E + LSH E,10. ;COMP NEW HUSRAD AFTER GETTING PAGE + TLZ E,-2 ;FLUSH PROTECT BITS (LEAVE 3.1) + CAMLE E,HUSRAD(U) + MOVEM E,HUSRAD(U) + POPJ P, + +CORGPZ: PUSH P,E ;SAVE REGISTERS + PUSH P,U + PUSHJ P,CFLM2 ;TRY TO FREE UP SOME LOW MEMORY + POP P,U + POP P,E + SKIPE LMEMFR + JRST CORGP ;SHOULD WORK NOW + PUSHJ P,LSWPOP ;MEMFRZ + PUSHJ P,LSWPOP ;CIRPSW + BUG INFO,[NO CORE AVAIL FOR MMP PAGE] + PUSHJ P,UDELAY ;Break possible infinite loop if no user pgs in low mem + SKIPG MEMFR ;WAIT FOR SWAPPER TO MAKE ROOM (PANIC!) + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW + PUSHJ P,SWTL + MEMFRZ + JRST CORGP + +PAGERT: PUSHJ P,SWTL + MEMFRZ + PUSHJ P,UPGRTN + JRST LSWPOP + +UPGRTN: PUSH P,R ;RETURN VIRT PG # IN A USER IN U + PUSH P,I + PUSH P,TT + PUSH P,E +IFN XGP,[ + PUSHJ P,UPLC ;SEE IF PAGE XGP LOCKED + LDB E,T + TRNN E,600000 + JRST UPGRT7 ;SWAPPED OUT, OBVIOUSLY NOT XGP + ANDI E,PMRCM ;E := PHYS PAGE NO + CAIL E,TSYSM + JRST UPGRT7 + IDIVI E,36. + MOVNS TT + PUSH P,T + MOVSI T,400000 + LSH T,(TT) + TDNE T,XGPMTB(E) + PUSHJ P,UFLS ;WAIT FOR XGP TO CLEAR + POP P,T +UPGRT7: ] +.ELSE PUSHJ P,UPLC ;FIND PAGE IF DIDN'T ALREADY + JUMPE U,UPGRT8 ;SYS JOB, NO SWAPPING NOR MMP ENTRY + LDB B,Q + CAIN B,-1 + JRST UPRABS ;ABSOLUTE PAGE + JUMPE B,RHUSRA ;DOESNT REALLY HAVE PG + PUSH P,T + PUSHJ P,CHACK + ADD D,MMPEAD ;D HAS MMP ADDRESS +UPGRTA: MOVSI T,MMPTMP + TDNE T,(D) + JRST UPGRTW ;WAIT FOR PAGE TO TRANSIT BUT UNLOCK SWITCHES + MOVNI I,1 ;ASSUME NO DISK SPACE + HLRZ A,1(D) ;SEE IF DISK SPACE ASSIGNED + JUMPE A,UPGRT5 + LDB I,[$MMPUN,,(D)] + PUSHJ P,QTLOCK ;LOCK APPRO TUT +UPGRT5: POP P,T ;POINTER TO ORIG MAP ENTRY OF USER + MOVE H,(T) ;SAVE MAP WORD FOR DEBUGGING + LDB TT,T ;IF PROT BITS=0 PAGE IS SWAPPED OUT FOR PURPOSES + MOVEI E,0 ;OF USER'S SWAP OUT COUNT, EVEN IF IN CORE + DPB E,T ;CLEAR USER MAP ENTRY + TRCN TT,600000 ;IS USER MAPPED TO PAGE? + JRST UPGRT9 + MOVSI E,MMPWRT ;YES, CHECK IF ACCESS BITS = RW + TRNN TT,600000 + IORM E,(D) ;PAGE WRITTEN BY USER WHO HAS DETACHED IT + ANDI TT,PMRCM ;MASK TO MEM PAGE # + CAIE TT,(J) + JRST 4,. ;PTW POINTED TO WRONG PAGE + MOVSI E,MMPOUT+MMPTMP + TDNE E,(D) + JRST 4,. ;PAGE NOT IN, IN MMP +IFE SWPWSP, SOS MMSWP(J) ;ONE LESS USER POINTING AT PAGE +IFN SWPWSP,[ + HRRZ E,MMSWP(TT) ;DECREASE THIS USER'S WORKING SET + MOVSI T,-1 + IDIVM T,E + ADDM E,UWRKST(U) + SOS MMSWP(TT) + HRRZ E,MMSWP(TT) + JUMPE E,UPGRTB ;JUMP IF NO OTHER SHARERS, FOR SPEED AND NO ZERODIVIDE + PUSH P,C ;ADJUST OTHER SHARER'S WORKING SETS + PUSH P,D + PUSH P,I + PUSH P,U + IMULI E,1(E) + MOVSI D,1 + IDIV D,E + PUSHJ P,UCPRL7 ;CLOBBERS H ALSO C,T,U,I + 400000,,SWOP6F + POP P,U + POP P,I + POP P,D + POP P,C +];SWPWSP + JRST UPGRTB + +;RETURNING A PAGE TO WHICH USER IS NOT CURRENTLY MAPPED (MAY BE IN OR OUT) +UPGRT9: SOS NSWPGS(U) + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + JUMPGE C,UPGRT4 ;NO MEM IN CP S, PAGE REALLY SWAPPED OUT +;RETURNING A PAGE WHICH IS SWAPPED IN +UPGRTB: HLRE E,MMSWP(J) ;GET # EXEC PGS POINTING TO THIS + JUMPL E,[JRST 4,.] ;<0 EXEC PAGES + JUMPE E,UPGRT4 ;NO EXEC PGS POINTING TO THIS + PUSH P,J + MOVE TT,J + MOVSI T,-NEXPGS ;LOOK FOR EXEC PGS SET UP TO PNT + MOVE E,[442200,,EXEUMP] ;TO USER PAGE FLUSHED +UPGRT3: ILDB J,E + TRZN J,600000 + JRST UPGRT2 + ANDI J,PMRCM + CAMN TT,J + JRST UPGRT1 +UPGRT2: AOBJN T,UPGRT3 +IFN E.SP,[ + MOVSI T,-1 + TDNE T,MMSWP(TT) + PUSHJ P,E.SPRT ;SEE IF E&S HAS IT +] +IFN XGP,[ + MOVSI T,-1 + TDNE T,MMSWP(TT) ;FLUSH XGP TIE DOWNS AND RETURN + PUSHJ P,XGPCFL +] + POP P,J +UPGRT4: LDB T,Q ;DELINK CIRC PNTR + DPB T,B + MOVEI T,0 + DPB T,Q ;CLOBBER CIRC P + SOS NMPGS(U) + SOS SNMPGS ;SYSTEM HAS 1 LESS PAGE + CAME C,[SETZ 3] + CAIN C,2 + JRST MMPRTN ;RETURN MMP ENTRY SINCE PAGE NO LONGER IN USE +MMPRT4: MOVE A,J + CAMN C,[SETZ 3] + JRST MMPRT5 ;FLUSH REAL MEM +MMPRT6: SKIPL I + PUSHJ P,QTULK +RHUSRA: POP P,E + POP P,TT + POP P,I + POP P,R +RHUSR1: LDB A,[121100,,HUSRAD(U)] ;COMP HUSRAD AFTER RETURNING PAGE + JUMPE A,CPOPJ + SOS A + PUSHJ P,UPLC + LDB B,Q + JUMPN B,CPOPJ ;FOUND ACTIVE PAGE + MOVNI C,2000 ;KEEP LOOKING + ADDM C,HUSRAD(U) + JRST RHUSR1 + +UPGRT8: SOS NMPGS ;RETURNING PAGE FROM SYS JOB + SOS SNMPGS + DPB A,[121100,,HUSRAD(U)] ;NORMAL METHOD OF COMPUTING HUSRAD WON'T WORK + MOVNI I,1 ;NO DISK SPACE +MMPRT5: SKIPE MMSWP(A) ;MAKE SURE NO ONE (EXEC OR USER) IS POINTING AT PAGE + JRST 4,. + PUSHJ P,CMEMR ;HAS REAL MEM, CIRC LENGTH =3 SO FLUSH MEM + JRST MMPRT6 + +UPRABS: +IFN TEN11P,[ + LDB B,T + LDB E,[.BP B] ;GET MOBY # + CAIE E,T11CPA_-18. + JRST UPRAB1 + ANDI B,377 + PUSHJ P,T11DL ;DELETE PAGE REF TO TEN11 MAP +UPRAB1:] + MOVEI B,0 + DPB B,Q + DPB B,T + JRST RHUSRA + +IFN E.SP,[ +;TT/MMSWP INDEX +E.SPRT: CAME U,DISUSR ;IS HE USING THE DISPLAY? + POPJ P, ;NO, DON'T UNTIE ANYTHING + PUSH P,H + MOVE T,TT ;FOR E.SPCH + PUSHJ P,E.SPCH ;LOOK IN E&S TABLES + SKIPA ;FOUND, INDEX IN H + JRST E.SPR2 ;NOT FOUND, DO NOTHING + MOVSI T,-1 + ADDM T,MMSWP(TT) ;SOS COUNT + SETZM DISSWP(H) ;CLEAR DISPLAY MMSWP TABLE + AOS E.SNUT ;COUNT FOR UNTIES +E.SPR2: POP P,H + POPJ P, +] +UPGRT1: MOVSI J,-1 + XCT EXPFT(T) ;MAYBE XFERR TO ROUTINE TO DO SOMETHING ABOUT THIS + JRST UPGRT6 ;NOT USER CONCERNED ABOUT (THERE HAD BETTER BE ANOTHER) + MOVEI J,0 + DPB J,E ;CLEAR OUT EXEC PAGE ENTRY + MOVE J,USER + CLRPGM (J) +UPGRT6: CONO PI,UTCON + JRST UPGRT2 + +;WAIT FOR PAGE TO TRANSIT, WITH CIRPSW FREE (IN CASE SWAP READ ERROR!) +;COME HERE WITH T/MMPTMP,, D/MMP.ENTRY.ADDR +UPGRTW: MOVE B,D +NCRMMW: MOVE U,USER + PUSHJ P,LSWCLR + PCLT + TDNE T,(B) + PUSHJ P,UFLS ;WAIT FOR ACTIVE PAGE TO SETTLE DOWN + CAIE U,LUBLK ;SKIP IF CORE JOB + JRST UUOTROLL ;AS IF PCLSR'ED OUT OF WAIT FOR PAGE & CAME BACK + SETOM CORUPU ;REQUEST FOR THIS USER NOT SATISFIED + MOVE P,USRPDL+LUBLK ;CLEAN UP AND RE INIT CORE JOB + PUSHJ P,NULSET + PUSHJ P,NULSET + JRST CORUPR + +EXPFT: +IFN 340P, REPEAT 2+N340PB, PUSHJ P,DISACR + REPEAT 2,JFCL ;CORJF, CORJT +IFN VIDP, REPEAT 2,PUSHJ P,SCNACR +IFN TEN11P, JRST 4,. ;TEN-11 CONTROL PAGE + JRST 4,. ;PAREP +IFN ECCMEM, JRST 4,. ;ECCPG +IFN XGP, REPEAT 3,JRST 4,. +IFN N11TYS, REPEAT NTTPG+NTVBP,JRST 4,. +IFN CHAOSP, IFN T11CHP, JRST 4,. + REPEAT NMMP,JRST 4,. ;MMP +IFN .-EXPFT-NEXPGS, .ERR LOSE AT EXPFT + ;CIRCULAR MEM LIST HACKER +;CALL WITH Q CONTAINING BYTE POINTER TO CIRC PNTR IN LIST TO BE HACKED +;THE BYTE POINTER MUST POINT AT A UPGCP ENTRY (RATHER THAN MEMPNT OR MMP) +;OR THIS CODE WILL LOOP FOREVER. +;RETN BYTE PNTR IN B TO GUY WHO PNTS TO THAT PNTR +;COUNT FOR ENTRIES IN C (RH) +; 4.9 C SAYS ACTUAL MEM IN LOOP +;RETN IN D MMP INDEX +;RETURN MEM PAGE IF ANY IN J +;CLOBBERS H,I,W + +CHACK: PUSH P,A + LDB J,Q ;PICK UP STARTING C. P. + SETZM C + MOVNI D,1 + MOVE B,Q +CHACK1: JUMPE B,[JRST 4,.] + AOS C + CAIE J,-1 ;SKIP ON ABS PAGE + TRNE C,776000 + JRST 4,. ;CIRC CHAIN TOO LONG? + TRZE J,400000 + JRST CHACK3 ;MEMPNT OR MMP PNTR + LDB I,[1000,,J] ;PG # + LDB H,[101100,,J] ;USER # + IMULI H,LUBLK + SKIPE UNAME(H) + CAML H,USRHI + JRST 4,. ;POINTER TO NON-EXISTENT USER + MOVEI W,UPGCP(H) + ROT I,-1 + ADDI W,(I) + HRLI W,222200 + SKIPGE I + HRLI W,2200 + CAMN W,Q + JRST CHACK2 ;FOUND ENTRY WHICH PNTS AT ORIGINAL ENTRY + LDB J,W + MOVE B,W + JRST CHACK1 ;KEEP LOOKING + +CHACK2: MOVE J,A + JUMPL D,[JRST 4,.] ;NO MMP ENTRY ? + JRST POPAJ + +CHACK3: TRZE J,200000 + JRST CHACK4 ;ACTUAL CORE + CAML J,MMPMX + JRST 4,. ;GARBAGE POINTER + MOVSI B,2200 ;MMP ENTRY + HRR B,MMPEAD + ADDI B,(J) + JUMPGE D,[JRST 4,.] ;MORE THAN 1 MMP ENTRY + MOVE D,J + LDB J,B + JRST CHACK1 + +CHACK4: TLOE C,400000 + JRST 4,. ;PAGES IS IN TWO PLACES IN CORE + CAIL J,TSYSM + JRST 4,. ;GARBAGE POINTER + MOVE A,J ;SAVE MEMBLT INDEX + MOVSI B,2200 + HRRI B,MEMPNT + ADDI B,(J) + LDB J,B + JRST CHACK1 + +;LOOK UP PAGE IN USER MAP +;USER IN U, VIR PG # IN A +;GET PNTR TO MAP HW IN T, TO CIRC IN Q + +UPLC: SKIPL A + CAIL A,400 + JRST 4,. ;BAD VIRTUAL PAGE NUMBER + PUSH P,A + MOVEI Q,UPGCP(U) + MOVEI T,UPGMP(U) + ROT A,-1 + ADDI T,(A) + HRLI T,222200 + SKIPGE A + HRLI T,2200 + ADDI Q,(A) + HLL Q,T + JRST POPAJ + +;FREE THE MMP ENTRY D POINTS AT, SOSING TUT IF DISK SPACE ASSIGNED. +;I HAS DSK #, C HAS WHAT CHACK RETURNED IN C, A HAS TRACK #. +;TUT MUST BE LOCKED ALREADY. CIRPSW AND MEMFRZ SHOULD BE LOCKED. +;EXIT TO MMPRT4 OR RHUSRA + +MMPRTN: MOVEM C,MMPRTC ;SAVE IN CASE OF BUG HALT LATER + JUMPL I,MMPRT3 ;NO DISK SPACE ASSIGNED + PUSH P,B + LDB B,[$MMPUN,,(D)] + CAME B,I + JRST 4,. ;WRITING WRONG DISK + MOVE H,D ;H SAVES POINTER TO MMP ENTRY + MOVE D,A ;D GETS DISK TRACK NUMBER + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] ;DETECT OVER-SOS + DPB B,D + EXCH D,H ;D GETS MMP PNTR, H GETS TUT BYTE PNTR + JUMPN B,MMPRT2 + MOVE T,QTUTO(I) + CAML A,QSWAPA(T) + AOS QSFT(I) + CAMGE A,QSWAPA(T) + AOS QSFTS(I) +MMPRT2: MOVE T,DCHBT(I) + IORM T,QTUTO(I) + MOVE A,(D) ;ELSE DELETE MMP ENTRY NOW + SKIPGE C + JUMPN B,MMPRT0 ;IF PG IS IN FILE, AND SWAPPED IN, MAYBE WRITE OUT. + TLNN A,MMPSHR + JRST MMPRT8 + HLRZ A,1(D) ;ALSO REMOVE FROM SHAREABLE PAGE TABLE + HRL A,I + IDIVI A,SHRHSL + ADDI B,SHRHSH-1 +MMPRT7: MOVE A,B + HRRZ B,1(B) + JUMPE B,[JRST 4,.] + CAME B,D + JRST MMPRT7 + HRRZ B,1(B) + HRRM B,1(A) +MMPRT8: POP P,B + JUMPL C,MMPRT3 ;WAS MEM IN LOOP SO NOT SWAPPED OUT FOR SYSTEM'S COUNT + SOS NPGSWO ;IT WAS SWAPPED OUT +MMPRT3: PUSHJ P,MMPRT1 + SOS MMPCNT ;1 LESS IN USE + AOS MMPFR ;1 MORE FREE + JRST MMPRT4 + +;FLUSHING AN MMP ENTRY FOR A PAGE SHARED WITH A FILE WHICH IS CURRENTLY IN CORE. +;WE MAY WANT THIS PAGE AGAIN, SO TRY TO KEEP IT AROUND FOR A WHILE. +;BUT IF PAGE HAS BEEN MODIFIED, IMMEDIATELY SWAP IT OUT SO FILE GETS UPDATED. + +MMPRT0: POP P,B + LDB C,H ;UN-SOS THE TUT + CAIGE C,TUTMNY ;DON'T OVER-AOS + AOS C + DPB C,H + PUSHJ P,QTULK + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(J) + SKIPE C,LLOOSP ;ADD TO TAIL OF LOOSE PAGE LIST + DPB J,[MLO,,MEMBLT(C)] + MOVEM J,LLOOSP + SKIPN C + MOVEM J,FLOOSP + AOS NLOOSP + TLNN A,MMPWRT + JRST RHUSRA + PUSH P,U ;PAGE WAS MODIFIED, SWAP IT OUT RIGHT AWAY + CONO PI,CLKOFF ;CALL SWAPPER AT IMITATION CLOCK LEVEL + MOVEM J,SWOBK + MOVEM D,SWOMMP + AOS CIRPSW ;SWOP1A WILL SOS IT BEFORE RETURNING + PUSHJ P,SWOP1A ;WILL RETURN THE MMP ENTRY SINCE NO USERS ARE LINKED TO IT + JRST 4,. ;EXEC PAGES STILL POINT TO PAGE, ALTHOUGH UPGRTN FLUSHED THEM + CONO PI,CLKON + POP P,U + JRST RHUSRA + +;HERE TO RETURN AN MMP ENTRY AND SOS THE TUT, AT P.I. LEVEL +;IF TUT OR CIRPSW IS LOCKED, PUTS ON MMPFS2 AND WAKES UP CORE JOB +;OTHERWISE, CLEARS OUT AND PUTS ON MMPFS +;A -> MMP ENTRY, CLOBBERS B,D,E,I + +RETMMP: PI2SAF + LDB I,[$MMPUN,,(A)] + SKIPGE CIRPSW + SKIPGE QTUTO(I) + JRST RETMM1 ;CAN'T SET LOCKS, LET CORE JOB DO IT +RETMM0: HLRZ D,1(A) + PUSHJ P,TUTPNT ;SOS THE TUT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + JUMPN B,RETMM7 + MOVE E,QTUTO(I) ;RETURNING BLOCK TO FREE, AOS APPROPRIATE FREE COUNT + HLRZ D,1(A) + CAML D,QSWAPA(E) + AOSA QSFT(I) + AOS QSFTS(I) +RETMM7: MOVSI D,MMPSHR + TDNN D,(A) + JRST RETMM6 + HLRZ D,1(A) ;REMOVE FROM SHAREABLE PAGE HASH TABLE + HRL D,I + IDIVI D,SHRHSL + MOVEI D,SHRHSH-1(E) +RETMM5: MOVE E,D + HRRZ D,1(D) + JUMPE D,[JRST 4,.] ;NOT IN TABLE OR MIS-HASHED? + CAME D,A + JRST RETMM5 + HRRZ D,1(D) + HRRM D,1(E) +RETMM6: MOVE D,A + SOS MMPCNT + AOS MMPFR +MMPRT1: EXCH D,MMPFS ;ADD THIS ENTRY ONTO THE FRONT OF + MOVE A,MMPFS ;THE LIST OF AVAILABLE MMP ENTRIES + MOVEM D,(A) ;CLEAR LH OF FIRST WORD OF ENTRY + SETZM 1(A) ;CLEAR SECOND WORD OF ENTRY + POPJ P, + +RETMM1: MOVE D,A ;ADD THIS ENTRY TO LIST OF ONES TO HACK LATER + EXCH D,MMPFS2 + HRRM D,(A) ;ONLY CLOBBER THE CIRC PNTR, WHICH POINTS TO SELF + SKIPN D + AOS NCORRQ ;LIST WAS EMPTY, AWAKEN CORE JOB + POPJ P, + +;CORE JOB COMES HERE WHEN MMPFS2 IS NON-ZERO + +RETMM2: SOS NCORRQ + PUSHJ P,SWTL + CIRPSW + PUSHJ P,RETMM4 + PUSHJ P,LSWPOP + JRST CORJOB + +RETMM4: MOVEI A,0 ;HERE, WITH CIRPSW LOCKED, TO FINISH RETURNING MMP ENTRIES + EXCH A,MMPFS2 +RETMM3: JUMPE A,CPOPJ + LDB I,[$MMPUN,,(A)] + PUSHJ P,QTLOCK + HRRZ H,(A) + PUSHJ P,RETMM0 + PUSHJ P,QTULK + MOVE A,H + JRST RETMM3 + +;GET AN MMP ENTRY, RET. IDX IN R, ADDR IN TT. +;CLEARS BOTH WDS OF MMP ENTRY. CLOBBERS NO ACS. +;SKIPS IF SUCCESSFUL. DOESN'T SKIP IF NO LOW CORE FOR NEW MMP PAGE. +;YOU BETTER ALREADY HAVE COMMITTED THE MMP ENTRY VIA SOSGE MMPFR + +GMMPP: HRRZ TT,MMPFS + JUMPE TT,GMMP1 ;FREE LIST IS EMPTY + CAMGE TT,MMPEAD + JRST 4,. ;IDX GOT ON FREE LIST; SHOULD BE ADDR + MOVE R,TT + SUB R,MMPEAD + CLEARM 1(TT) + HRL TT,(TT) + CLEARM (TT) + HLRZM TT,MMPFS + AOS MMPCNT ;1 MORE MMP ENTRY IN USE. + JRST POPJ1 + +GMMP1: SKIPN MMPFS2 + JRST GMMP4 + PUSH P,A ;PROTECT ACS CLOBBERED BY RETMM4 + PUSH P,B + PUSH P,D + PUSH P,E + PUSH P,H + PUSH P,I + PUSH P,T + PUSHJ P,RETMM4 + POP P,T + POP P,I + POP P,H + POP P,E + POP P,D + POP P,B + POP P,A + JRST GMMPP + +GMMP4: PUSH P,A ;CREATE ANOTHER PAGE-FULL OF MMP ENTRIES + PUSH P,B + PUSH P,D + PUSHJ P,TCALL + ;JRST IOMQ ;ALLOCATE LOW CORE SO GETS DUMPED WITH CRASHES + JRST NMMRQ ;IOMQ LOSES BECAUSE WE GET CALLED WITH MEMFRZ LOCKED + ;NMMRQ ISN'T QUITE RIGHT, BECAUSE OF NCBCOM. FIX LATER. --- + JRST GMMP3 ;NO LOW CORE AVAIL NOW + MOVEI B,MUMMP + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,2000 + ADDM B,MMPMX ;INCREMENT MAX ALLOWABLE ADDR OF MMP + AOS B,MMPNP + CAILE B,NMMP + JRST 4,. ;SOMEONE DIDN'T CHECK MMPFR? + MOVEM A,MMMPG-1(B) + TRO A,600000+PMCSHM + DPB A,MMPPPP-1(B) ;PUT NEW MMP PAGE INTO EXEC MAP + MOVE D,USER + CLRPGM (D) + SOS B + LSH B,10. + HRLI B,-1000 +GMMP2: MOVEI D,MMP(B) ;PUT ALL ENTRIES IN PAGE ON THE FREE LIST + PUSHJ P,MMPRT1 + AOS B + AOBJN B,GMMP2 + POP P,D + POP P,B + POP P,A + JRST GMMPP + +GMMP3: POP P,D + POP P,B + POP P,A + POPJ P, + +;HERE IF TRANSIENT CONDITION PREVENTS GRABBING PAGE RIGHT NOW + +CORS18: MOVE T,LSWPR+LUBLK + CAIE T,MEMFRZ + JRST 4,. + PUSHJ P,LSWPOP ;MEMFRZ + PUSHJ P,UDELAY + PUSHJ P,ACMTC + PUSHJ P,SWTL + MEMFRZ + +;GROW A JOB'S CONTIGUOUS MEMORY. USED ONLY FOR SYSTEM JOB THESE DAYS. + +CORS2: +IFN XGP,[ + SKIPL XGPUSR ;AVOID EXPANDING INTO XGP PAGE. + PUSHJ P,UFLS +] + LDB J,[121100,,HUSRAD(U)] + LDB E,[MUR,,MEMBLT(J)] + CAIN E,MUFR + JRST COSFR ;FREE PAGE, TAKE IT. + CAIE E,MUINP + CAIN E,MUFRT + JRST CORS18 ;WAIT UNTIL IT STABILIZES + CAIN E,MUSWPG + JRST CORS18 ;WAIT UNTIL IT GETS WHERE IT'S GOING + CAIE E,MURUSR ;USER PAGE, SHUFFLE IT AWAY. + JRST 4,. ;SHOULDN'T HAVE TO SHUFFLE SYSTEM PAGES. + +;SHUFFLE A USER PAGE +CORS4: PUSHJ P,TCALL + JRST HMEMRQ ;GET FREE PAGE TO SHUFFLE IT INTO + JRST 4,. ;THERE OUGHT TO BE ONE + PUSHJ P,CORS5 + JRST CBMRT + +;Shuffle user page in J into page in A +;Clobbers C,D,E,H,I,Q,U,T +CORS5: MOVE D,A + SKIPGE E,MMSWP(J) + JRST 4,. ;BLOCK IS ON SWAP OUT LIST (??) + TRNN E,-1 + PUSHJ P,CORS6 ;SHUFFLING A POSSIBLY LOOSE PAGE, FIX POINTERS + SETOM DLSRCH ;CAN'T BE BEING SWAPPED OUT ETC BECAUSE SWAPOUT + PUSHJ P,UCPRL7 ;BLOCKS HAVE MUR=MU23B, AND CIRPSW IS SIEZED + SETZ CORSTU ;STOP DIRECT TO MEM DEVICES AND FIX USER MAPS + TLC C,200 ;CHANGE TO 20 BIT BYTE + DPB D,C ;RELOCATE PTR TO MEMPNT ENTRY + PUSHJ P,CMOVE1 ;MOVE CONTENTS OF BLOCK + MOVSI C,-NEXPGS + MOVE T,[442200,,EXEUMP] + PUSHJ P,CORPS1 ;FIX ANY EXEC PAGE MAP PNTRS TO THIS PAGE + PUSHJ P,UCPRL4 + SETZ DEVSTR ;RESTART DIRECT TO MEM DEVICES + SETZM DLSRCH ;MAPS ARE CONSISTENT AGAIN, LET USERS RUN + POPJ P, + +CORSTU: PUSHJ P,DEVSTP ;STOP DIRECT-TO-MEM DEVICES + MOVE A,I ;COMPUTE USER'S MAP ENTRY LOCN + PUSHJ P,UPLC + LDB C,T + TRNN C,600000 + POPJ P, ;PAGE SWAPPED IN BUT NOT YET LINKED UP + ANDI C,PMRCM + CAIE C,(J) + JRST 4,. + TLC T,2200# ;CHANGE TO ADDRESS REAL CORE ADR FIELD + DPB D,T ;RELOCATE USER'S MAP + POPJ P, + +COSFR: MOVE D,J + PUSHJ P,MEMMF +CBMRT: MOVEM J,SJSPG ;SAVE PAGE # RESERVED + JRST CORM1B + +;CORE SHUFFLER, TO KEEP LOW MEMORY FREE +CFLM1: PUSHJ P,SWTL + CIRPSW + PUSHJ P,SWTL + MEMFRZ + PUSHJ P,CFLM2 + PUSHJ P,LSWPOP ;MEMFRZ + JRST LSWPOP ;CIRPSW + +CFLM2: MOVEI J,LIOBLK ;Scan through "low" memory + SKIPE MEMHPT ;Make sure there is likely to be free high mem + JRST CFLM4 + AOS SWPOPR ;Kick swapper more than kicked already + POPJ P, ;And give up + +CFLM3: CAIN J,128. + MOVEI J,128.+NEXPGS + CAIL J,256. ;Assume USEMDM is always on (safe assumption) + POPJ P, ;All done, couldn't find anything +CFLM4: LDB A,[MUR,,MEMBLT(J)] + CAIE A,MURUSR + AOJA J,CFLM3 + PUSHJ P,TCALL + JRST HMEMRQ ;Get free page to shuffle it into + POPJ P, ;No memory free, give up for now + PUSHJ P,CORS5 ;Shuffle page into new memory + MOVE A,J ;Free old page + PUSHJ P,CMEMR + MOVE A,LMEMFR + CAMGE A,MINCOR + AOJA J,CFLM3 + POPJ P, ;Freed sufficient low pages, stop now + +;STOP DIRECT TO MEM DEVICES + +DEVSTP: +IFN VIDP,[ + CAMN U,SCNUSR ;STOP DIRECT MEM DEVICES + PUSHJ P,SCNSTC ;STOP DIRECT VIDI INPUT +] +IFN 340P\E.SP,[ + CAMN U,DISUSR ;STOP DISPLAY IF THIS GUY HAS IT + PUSHJ P,DCRSTP +] + POPJ P, + +;RESTART DIRECT TO MEM DEVICES + +DEVSTR: CLRPGM +LUBLK ;CLEAR PAGE MAP ASSOC REGS IN HARDWARE +IFN VIDP,[ + CAMN U,SCNUSR ;RESTART DIRECT MEM DEVICES + PUSHJ P,SCNRST ;RESTART DIRECT VIDI INPUT +] +IFN 340P\E.SP,[ + CAMN U,DISUSR + PUSHJ P,DCRRST ;RESTART DISPLAY +] + POPJ P, + +;HERE TO RELOCATE EXEC PAGES WHICH POINT TO PAGE IN J + +CORPS1: MOVEI I,0 +CORPS4: ILDB Q,T + TLC T,2200# ;CHANGE SIZE FIELD TO ADDRESS REAL CORE ADR + ANDI Q,PMRCM + CAME Q,J + JRST CORPS3 + AOS I ;COUNT # OF EXEC PGS POINTING TO THIS ONE + DPB D,T ;RELOCATE EXEC PG PNTR +CORPS3: TLC T,2200# ;CHANGE SIZE BACK TO 22 + AOBJN C,CORPS4 + HLRZ T,MMSWP(D) + CAMN T,I ;CHECK COUNT OF EXEC PAGES + POPJ P, ;COUNTED CORRECTLY, WIN + +IFN E.SP,[ ;SEE IF E&S CAN ACCOUNT FOR SOME PAGES + MOVSI Q,-MXDISP ;SET UP INDEX + CAMN J,DISSWP(Q) ;J/ OLD INDEX, D/ NEW + AOJA I,E.SX2 ;COUNT I IF FOUND, AND RECHECK COUNT + AOBJN Q,.-2 ;ELSE CONTINUE SEARCH + JRST 4,. ;NOT FOUND, BOMB +E.SX2: MOVEM D,DISSWP(Q) ;RELOCATE PAGE + AOS E.SREL ;# PAGES RELOCATED (FOR DEBUGGING) + CAMN T,I ;SKIP IF COUNT IS STILL BAD + POPJ P, ;E&S COUNT WAS CULPRIT -- HAPPY AGAIN +] +IFN XGP,[ + PUSH P,A + PUSH P,B + MOVE B,J + PUSHJ P,XGPBIT + TDNE A,XGPMTB(B) + AOS I + CAMN I,T + JRST POPBAJ +] + JRST 4,. ;EXEC PGS COUNT OFF + +CORS6: MOVE T,FLOOSP ;FIX POINTERS TO LOOSE PAGE BEING SHUFFLED +CORS7: SKIPN C,T + JRST CORS8 + LDB T,[MLO,,MEMBLT(C)] + CAME T,J + JRST CORS7 + DPB D,[MLO,,MEMBLT(C)] +CORS8: CAMN J,FLOOSP + MOVEM D,FLOOSP + CAMN J,LLOOSP + MOVEM D,LLOOSP + POPJ P, + +;RUN AROUND CIRC LIST STRUCTURE +;WORD AFTER CALL IS POINTER TO ROUTINE TO BE CALLED FOR EACH ITEM IN LIST ACCORDING +;TO FLAGS IN LH: 4.9 USER PAGE (U=USER,I=PG#), 4.8 MMP (T=IDX), 4.7 MEMPNT (T=PG#) +;CALLED ROUTINE MUSTN'T CLOBBER C,H; NOR U,I IF A USER PAGE; NOR T IF MEMPNT. +;RETURNS IN C BYTE POINTER TO PLACE THAT POINTS TO +;STARTING BYTE POINTER THAT WAS IN C +;ENTRIES: +; UCPRL - STARTING BYTE POINTER IN C +; UCPRL4 - STARTING CORE PAGE # IN D +; UCPRL7 - STARTING CORE PAGE # IN J +;PDL DEEPENED BY TWO PUSH'S AND TWO PUSHJ'S. +;---WARNING--- : CLOBBERS U ------- ALSO CLOBBERS H,T,I + +UCPRL7: SKIPA C,[2200,,MEMPNT(J)] +UCPRL4: MOVE C,[2200,,MEMPNT(D)] +UCPRL: MOVE H,@(P) + HRRI C,@C + TLZ C,37 + PUSH P,C + PUSH P,C + JRST UCPRL5 + +UCPRL2: CAMN C,-1(P) + JRST UCPRL6 + MOVEM C,(P) +UCPRL5: LDB T,C + JUMPE T,[JRST 4,.] + TRZE T,400000 + JRST UCPRL1 + LDB I,[1000,,T] ;PAGE # + LDB U,[101100,,T] ;USER # + IMULI U,LUBLK + CAML U,USRHI + JRST 4,. + SKIPGE H + PUSHJ P,(H) + MOVEI C,UPGCP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + JRST UCPRL2 + +UCPRL1: TRZE T,200000 + JRST UCPRL3 + CAML T,MMPMX + JRST 4,. ;MMP ADR OUT OF RANGE + MOVSI C,2200 ;MMP + HRR C,MMPEAD + ADDI C,(T) + TLNE H,200000 + PUSHJ P,(H) + JRST UCPRL2 + +UCPRL3: CAIL T,TSYSM + JRST 4,. ;MEMBLT ADR OUT OF RANGE + TLNE H,100000 ;MEMPNT + PUSHJ P,(H) + MOVE C,[2200,,MEMPNT] + ADDI C,(T) + JRST UCPRL2 + +UCPRL6: MOVE C,(P) + SUB P,[2,,2] + JRST POPJ1 + ;DISCARD IDLE DISK UFD'S. + +UFDFF: PUSHJ P,SWTL + UDRSW + MOVEI C,MEMR + PUSHJ P,QDFLS + JRST UTBFF5 + +;FLUSH "UTAPE" (200-WD) BUFFERS +;TRY TO COMPACTIFY INTO FEWER PAGES BY DELETING PAGES CONTAINING +;ONLY FREE ONES AND BY MOVING NETWORK BUFFERS AROUND. OTHER KINDS +;OF BUFFERS DON'T STAY AROUND VERY LONG AND ARE HARD TO MOVE +;WITHOUT INTRODUCING TIMING/PCLSR'ING BUGS. + +UTBFF: PUSHJ P,SWTL + MEMFRZ + MOVSI J,-TSYSM +UTBFF3: LDB R,[MUR,,MEMBLT(J)] + CAIN R,MUIOB + PUSHJ P,UTBFF2 + AOBJN J,UTBFF3 +UTBFF5: SOS NCORRQ + PUSHJ P,LSWPOP +IFN CHAOSP, PUSHJ P,CHCLN ;ALSO, CLEAN UP CHAOS NET BUFFERS +IFN INETP, PUSHJ P,PKBCLN ; Clean up network packet buffers +;SWAP OUT ALL LOOSE PAGES. THE REASON THIS IS DONE IS THAT IF THE +;SYSTEM LOAD IS LIGHT LOOSE PAGES FOR DELETED INQUIR DATA BASE FILES +;CAN STAY AROUND INDEFINITELY, TYING UP DISK SPACE. +;SWAPPING OUT LOOSE PAGES DOES NOT CAUSE ANY DISK I/O. +;SWPOPG MAY NON-SKIP RETURN IF CIRPSW OR A TUT IS LOCKED, +;IN WHICH CASE WE GIVE UP UNTIL THE NEXT 2-MINUTE CLOCK. +UTBFF6: CONO PI,CLKOFF + SKIPN A,FLOOSP ;GET A LOOSE PAGE + JRST UTBFF7 + MOVNI C,1 + PUSHJ P,SWPOPL ;SWAP OUT EVEN IF LOCKED (SHOULDN'T BE) + JRST UTBFF7 ;COULDN'T SWAP OUT, GIVE UP FOR NOW + CONO PI,CLKON ;ALLOW CHANCE FOR AN INTERRUPT + JRST UTBFF6 + +UTBFF7: CONO PI,CLKON + JRST CORJOB + +;RH(J) HAS PAGE NUMBER OF A BLOCK OF 200-WD BUFFERS +UTBFF2: LDB R,[MNUMB,,MEMBLT(J)] ;GET LIST OF IOBFT ENTRIES IN THIS BLOCK + CLEARB Q,TT +COSIO1: MOVSI E,200000 ;ALLOC INH ALL BUFFERS IN BLOCK + IORM E,IOBFT(R) + LDB E,[IOCH,,IOBFT(R)] + CAIE E,77 + AOS Q ;COUNT NUMBER USED FOR SOMETHING + CAIL E,NFNETC + CAIL E,NFNETC+NNETCH + CAIA + AOS TT ;COUNT NUMBER USED FOR NETWORK + LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST COSIO1 + JUMPE Q,COSIO3 ;IF ALL BUFFERS FREE, FLUSH THIS PAGE + CAME Q,TT + JRST UTBFF1 ;CONTAINS NON-NET BUFFERS, LEAVE ALONE + MOVEI E,0 + EXCH E,UTTBF + CAIL E,8 ;IF THERE ARE ENOUGH FREE IN OTHER BLOCKS + JRST CISHUF ;THEN GO SHUFFLE THE NET BUFFERS + EXCH E,UTTBF +UTBFF1: LDB R,[MNUMB,,MEMBLT(J)] ;ABANDON IDEA OF FLUSHING THIS BLOCK + MOVSI E,200000 ;UN-INHIBIT THE BUFFERS.. +UTBFF4: ANDCAM E,IOBFT(R) + LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST UTBFF4 + POPJ P, ;RETURN OUT OF UTBFF2 + ;SHUFFLE BUFFERS +;COME HERE WITH UTTBF SET TO 0 AND OLD VALUE IN E +;LEAVE UTTBF 0 WHILE SHUFFLING SO NO ONE ELSE CAN ALLOCATE + +CISHUF: PUSH P,E + LDB R,[MNUMB,,MEMBLT(J)] +CISHF1: LDB Q,[IOCH,,IOBFT(R)] + CAIN Q,77 + JRST CISHF2 ;FREE, IGNORE + CAIL Q,NFNETC + CAILE Q,NFNETC+NNETCH + JRST 4,. ;SOME RANDOM UNSHUFFABLE BUFFER + PUSHJ P,CINET +CISHF2: LDB R,[IOLC,,IOBFT(R)] + CAIE R,377 + JRST CISHF1 + POP P,UTTBF ;ALLOW ALLOC AGAIN. THIS MEM BLOCK NOW + ;CONTAINS 8 FREE, ALLOC INH BUFFERS. + ;SO FALL INTO COSIO3 TO FLUSH THEM. +;FLUSH ALL 8 BUFFERS. + +COSIO3: LDB R,[MNUMB,,MEMBLT(J)] + MOVEI TT,7 +COSIO4: LDB Q,[IOCH,,IOBFT(R)] + CAIE Q,77 + JRST 4,. ;BUFFER WAS SUPPOSED TO BE FREE?? + MOVEI Q,UTFS-IOBFT ;PNTR TO F.S. LIST + SOS UTTBF ;SOON WILL BE ONE LESS FREE UTAPE BUFFER + CONO PI,UTCOFF +COSIO5: MOVE E,Q ;REMOVE IOBFT ENTRY IN R FROM F.S. LIST + LDB Q,[IOLO,,IOBFT(Q)] + CAIN Q,377 + JRST 4,. ;IT WASN'T IN THE LIST + CAME Q,R + JRST COSIO5 + + LDB Q,[IOLO,,IOBFT(R)] + DPB Q,[IOLO,,IOBFT(E)] + MOVE A,R ;GIVE IOBFT ENTRY BACK TO LIST OF UNUSED IOBFTS + LDB R,[IOLC,,IOBFT(R)] + PUSHJ P,IOBR + CONO PI,UTCON + CAIE R,377 + SOJA TT,COSIO4 + + JUMPN TT,[JRST 4,.] ;BLOCK DIDN'T CONTAIN 8 BUFFERS + MOVNI A,8 + ADDB A,UTTLB + CAMGE A,[-NUTIC-NUTOC] + JRST 4,. + PUSHJ P,FSCMP + HRRZ A,J ;THIS BLOCK OF MEMORY IS FREE NOW + JRST CMEMR ;AND RETURN OUT OF UTBFF2 + +;EXCHANGE BUFFER IN R WITH SOME FREE BUFFER, RETURNED IN A +;CALL WITH UCTOFF, CHANNEL NUMBER IN Q, TURNS UTCON + +COSIMG: MOVEI D,NFNETC(Q) ;CHNL NO TO CONS FOR + AOS UTTBF ;UNRESERVE ONE BUFFER MOMENTARILY + PUSHJ P,IUTCONS + JRST 4,. + CONO PI,UTCON + LDB TT,[IOSA1,,IOBFT(R)] ;TRANSFER BUFFER R TO BUFFER A + LDB T,[IOSA1,,IOBFT(A)] + HRL T,TT + LSH T,7 + HRRZ TT,T + BLT T,177(TT) + EXCH R,A + CONO PI,UTCOFF + PUSHJ P,IBRTN ;RETURN THE OLD BUFFER + SOS UTTBF ;BUT RESERVE IT + EXCH R,A + JRST UTCONJ + +;SHUFFLE OFF A NCP NETWORK BUFFER +;R HAS IOBFT INDEX, Q HAS CHANNEL NUMBER, E MUST BE PRESERVED + +CINET: +IFE NCPP,JRST 4,. +IFN NCPP,[ + SUBI Q,NFNETC ;GET IMSOC INDEX + HRRZ A,IMSOC1(Q) ;USER WHO OWNS THIS BUFFER + MOVSI T,200000 + TDNE T,IMSOC1(Q) ;SKIP OVER USER STOP IF BEING CLOSED + TROA A,-1 ; SINCE USER CAN'T REFERENCE BUFFER ANY MORE + PUSHJ P,RPCLSR ;AND LEAVE A=USER # STOPPED OR 0,,-1 IF NONE + MOVSI T,200000 ;MUSTN'T BE ACTIVE AT PI LEVEL + PUSHJ P,LWAIT + TDNE T,IMSOC6(Q) + SKIPN IMSOC6(Q) ;LWAIT RETURNS WITH NETOFF + JRST CINET2 ;BUFFER HAS BEEN RETURNED + MOVSI T,400000 ;LOCK THE BUFFER SO PI LEVEL WON'T TOUCH + IORM T,IMSOC6(Q) + LDB T,[221000,,IMSOC6(Q)] + CAIE T,(R) + JRST 4,. ;IOBFT ENTRY POINTS TO WRONG CHANNEL + PUSH P,A ;SAVE INDEX OF STOPPED USER + PUSHJ P,COSIMG ;COPY BUFFER + LDB TT,[IOSA,,IOBFT(A)] + LSH TT,6 + MOVE T,TT + HRRZ D,IMSOC6(Q) + SUB T,D ;OFFSET NEW BUFFER MINUS OLD + HRL TT,A + DPB TT,[003200,,IMSOC6(Q)] ;STORE NEW BUFFER ADDR, LEAVE FLAGS ALONE + ADDM T,IMSBFE(Q) ;RELOCATE VARIOUS POINTERS + ADDM T,IMSMPP(Q) + ADDM T,IMSPIP(Q) + MOVE TT,IMSOC2(Q) + TRNN TT,1 + AOSA IMNISH + AOS IMNOSH + CONO PI,NETOFF + MOVE TT,IMSOC6(Q) + TLNN TT,100000 ;SKIP IF INPUT OCCURRED WITH BUFFER LOCKED + JRST CINET1 +IFE DMI,[ + MOVE TT,IMPSVP ;RESTART INPUT + MOVEM TT,IMPPIA + CONO IMP,(TT) +] +IFN DMI,CONO FI,FIIN+NETCHN*11 +CINET1: MOVSI TT,500000 ;UNLOCK THE BUFFER, CLEAR INPUT WITH LOCK FLAG + ANDCAM TT,IMSOC6(Q) + PUSHJ P,IMPIOS ;RESTART OUTPUT + POP P,A ;AND FALL INTO CINET2 TO RESTART USER +CINET2: CONO PI,NETON + JRST NJUPCL ;RESTART USER IF ONE WAS STOPPED +] ;END IFN NCPP + +;FREE BLOCKS THAT BECAME FREE AT INT LEVEL. +ACMTC: SKIPN MEMFP1 ;ANY BLKS BECAME FREE AT INT LVL? + POPJ P, + CONO PI,UTCOFF + SKIPL MEMFRZ ;IF MEMFRZ IS LOCKED, CAN'T DO THIS. JUST + JRST UTCONJ ;HOPE ENOUGH CORE IS FREE. MUST BE BETTER WAY! + MOVE A,MEMFP1 ;GET # OF ONE OF THEM, + LDB B,[MLO,,MEMBLT(A)] ;REMOVE IT FROM LIST OF SUCH BLOCKS + HRRZM B,MEMFP1 + LDB B,[MUR,,MEMBLT(A)] + CAIE B,MUFRT + JRST 4,. + PUSHJ P,MEMR + JRST ACMTC + +;COPY A PHYSICAL PAGE'S DATA FROM PAGE (J) TO PAGE (D) +CMOVE1: MOVE C,MEMBLT(J) + MOVEM C,MEMBLT(D) + CLEARM MEMBLT(J) + MOVE C,MEMPNT(J) + MOVEM C,MEMPNT(D) + CLEARM MEMPNT(J) + MOVE C,MMSWP(J) + MOVEM C,MMSWP(D) + HRRZ A,D + CAIGE A,SYSB + JRST 4,. + TRO D,600000+PMCSHM + TRO J,600000+PMCSHM + DPB D,[.CORJT+EXEUMP] + DPB J,[.CORJF+EXEUMP] + TRZ D,600000+PMCSHM + TRZ J,600000+PMCSHM + CLRPGM +LUBLK + MOVE A,[400000+CORJF*2000,,400000+CORJT*2000] + BLT A,400000+CORJT*2000+1777 + MOVEI A,0 + DPB A,[.CORJT+EXEUMP] + DPB A,[.CORJF+EXEUMP] + POPJ P, + +MEMMF: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUFR + JRST 4,. + HRRZ A,D + PUSHJ P,TCALL + JRST MPOUT + POPJ P, + +UDELAY: PUSH P,T + MOVE T,TIME + ADDI T,15. ;SLEEP 1/2 SEC. (REALLY SHOULD DO A LOW + CAMLE T,TIME ;PRIORITY UNBLOCK IF SYS LIGHTLY LOADED) +UDELA1: PUSHJ P,UFLS + JRST POPTJ + +CZRR: PUSH P,A + CAIGE A,SYSB ;CORE ZEROER + JRST 4,. + TRO A,600000+PMCSHM + DPB A,[.CORJT+EXEUMP] + CLRPGM +LUBLK + CLEARM 400000+CORJT*2000 + MOVE A,[400000+CORJT*2000,,400000+CORJT*2000+1] + BLT A,400000+CORJT*2000+1777 + MOVEI A,0 + DPB A,[.CORJT+EXEUMP] + JRST POPAJ + +;ROUTINES TO ALLOCATE BLOCKS OF MEMORY +;CALL ONLY AT UTC LEVEL OR WITH UTC OFF + +OVHMTR ALC ;CORE ALLOCATION + +;SEE IF CAN ALLOCATE MEMORY +MQTEST: MOVE A,MEMFR + SUB A,NCBCOM + JUMPLE A,CPOPJ + SKIPLE MEMFR + SKIPL MEMFRZ + POPJ P, + JRST POPJ1 + +;ALLOCATE PREFERRING HIGH MEMORY, FOR RANDOM USER PAGE. SHUFFLEABLE PAGE OK. +HMRQC: PUSHJ P,MQTEST + POPJ P, +HMEMRQ: PUSH P,B + PUSH P,E + HRREI B,MEMHPT-MEMBLT +HMRQ3: LDB A,[MLO,,MEMBLT(B)] + JUMPE A,HMRQ1 ;HIGH HALF FULL TRY LOW + CAIL A,SYSB ;DON'T ALLOCATE PART OF THE SYSTEM + SKIPGE MEMBLT(A) ;DON'T ALLOCATE IF LOCKED + SKIPA B,A ;THIS PAGE NOT AVAIL, TRY NEXT + JRST IMRQ8 ;GOBBLE IT + JRST HMRQ3 + +HMRQ1: POP P,E + POP P,B + JRST NMMRQ ;THAT DIDNT WORK, TRY LOW HALF + +;ALLOCATE A BLOCK OF MEM FOR 200-WORD BUFFERS +UIMRQ: MOVE A,IOBFC + CAIGE A,8 + POPJ P, ;NOT ENOUGH ROOM IM IOBFT + MOVE A,MEMFR + SUB A,NCBCOM + CAIG A,3 + POPJ P, + +;GET A BLOCK THAT WON'T BE SHUFFLED, AND IS DIRECTLY ACCESSIBLE. +IOMQ: PUSHJ P,MQTEST ;GET LOW OR MEDIUM MEMORY FOR I/O + POPJ P, + +;ALLOCATING LOW MEM +NMMRQ: MOVEI A,0 ;MEMFP = MEMBLT+0 +IMRQ7: PI2SAF + PUSH P,B + PUSH P,E +IMRQ2: LDB A,[MLO,,MEMBLT(A)] + JUMPN A,IMRQ3 + PUSH P,C + PUSH P,H + PUSH P,TT + MOVEI C,IMEMR + SKIPGE UDRSW + PUSHJ P,QDFLS ;TRY FLUSHING DISK DIRS + POP P,TT + POP P,H + POP P,C + MOVEI A,0 +IMRQ6: LDB A,[MLO,,MEMBLT(A)] + JUMPE A,IMRQR ;NO MEM AVAIL IN LOW HALF, TAKE NON-SKIP RETURN + SKIPGE MEMBLT(A) + JRST IMRQ6 + JRST IMRQ9 + +MPOUT1: +IMRQR: POP P,E + JRST POPBJ + +IMRQ3: SKIPGE MEMBLT(A) + JRST IMRQ2 ;LOCKED LOOK FOR ANOTHER +IMRQ9: TDZA B,B ;GOBBLE FROM LOW +IMRQ8: MOVNI B,1 ;GOBBLE FROM HIGH + AOS -2(P) ;CAUSE RETURN TO SKIP + LDB E,[MUR,,MEMBLT(A)] + CAIN E,MUFR + JUMPN A,IMRQ4 + JRST 4,. ;BLOCK GOT PUT ON FREE STORAGE LIST WITHOUT USAGE FIELD GETTING "FREE" + ;ROUTINES FOR RETURNING MEMORY +IMEMR: PI2SAF ;HERE OTHERWISE (SEE BELOW) + CAIGE A,TSYSM + CAIGE A,SYSB + JRST 4,. ;DON'T RETURN PART OF SYSTEM + SKIPL MEMFRZ + JRST IMEMR1 +CIMEMR: PUSH P,B ;ENTER HERE IF OK TO HACK WITH MEM FROZEN + LDB B,[MUR,,MEMBLT(A)] ;I E CALLING FROM CORE ALLOCATOR + CAIN B,MUFR + JRST 4,. ;ALREADY FREE, LOSSAGE + SETZM MEMBLT(A) ;INITIALIZE RANDOM FIELDS + CAIGE A,256. ;HIGH MOBY GOES ON HIGH LIST + CAIGE A,LIOBLK ;LOW SHUFFLEABLE GOES ON HIGH LIST + JRST CIMEM1 + CAIGE A,128. ;LOW NON-SHUFFLEABLE GOES ON LOW LIST + JRST CIMEM0 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES GO ON HIGH LIST + SKIPN USEMDM ;MEDIUM MEMORY GOES ON LOW OR HIGH DEPENDING ON USEMDM + JRST CIMEM1 +CIMEM0: LDB B,[MLO,,MEMFP] ;PICK UP HEAD OF APPRO FS LIST + DPB B,[MLO,,MEMBLT(A)] ;STORE AS LINK OUT OF CURRENT WD + CAIE B,0 ;SKIP IF NO BLOCK PREVIOUSLY ON LIST + DPB A,[MLU,,MEMBLT(B)] ;MAKE FORMER HEAD'S BACK PNTR POINT TO CURRENT + MOVEI B,0 ;NO BACK PTR, THIS WILL BE FIRST IN LIST + DPB B,[MLU,,MEMBLT(A)] + DPB A,[MLO,,MEMFP] ;STORE THIS AS FREE LIST HEAD + AOS LMEMFR +CIMEM3: MOVEI B,MUFR + DPB B,[MUR,,MEMBLT(A)] ;STORE FREE IN USER + CLEARM MEMPNT(A) + AOS MEMFR + JRST POPBJ + +CIMEM1: LDB B,[MLO,,MEMHPT] ;PICK UP HEAD OF APPRO FS LIST + DPB B,[MLO,,MEMBLT(A)] ;STORE AS LINK OUT OF CURRENT WD + CAIE B,0 ;SKIP IF NO BLOCK PREVIOUSLY ON LIST + DPB A,[MLU,,MEMBLT(B)] ;MAKE FORMER HEAD'S BACK PNTR POINT TO CURRENT + MOVEI B,0 ;NO BACK PTR, THIS WILL BE FIRST IN LIST + DPB B,[MLU,,MEMBLT(A)] + DPB A,[MLO,,MEMHPT] ;STORE THIS AS FREE LIST HEAD + JRST CIMEM3 + +IMEMR1: PUSH P,B ;FREE A PAGE WHEN MEMFRZ LOCKED. + MOVE B,MEMFP1 ;ADD IT TO FRONT OF MEMFP1 LIST + DPB B,[MLO,,MEMBLT(A)] + HRRZM A,MEMFP1 + MOVEI B,MUFRT ;THEN SAY THIS BLK BECAME FREE WITH MEM FROZEN. + DPB B,[MUR,,MEMBLT(A)] + SETZM MEMPNT(A) + JRST POPBJ + +;ROUTINES TO RETURN MEMORY CONTINUED + +MGMEMR: PUSHJ P,TMEMR ;MAG TAPE MEMR + MUMGB + POPJ P, + +TMEMR: PUSH P,B + LDB B,[MUR,,MEMBLT(A)] + CAME B,@-1(P) + JRST 4,. ;RETURNING BLOCK NOT OF TYPE EXPECTED + POP P,B + AOS (P) ;SKIP OVER ARG +MEMR: CONO PI,UTCOFF + PUSHJ P,IMEMR + JRST UTCONJ + +CMEMR: CONO PI,UTCOFF + PUSHJ P,CIMEMR + JRST UTCONJ + +; ROUTINES TO UNTHREAD BLOCKS FROM FREE LISTS + +MPOUT: PI2SAF +MPOUT2: JUMPE A,[JRST 4,.] ;ENTER HERE FROM INITIALIZATION IF HOLE FOUND + PUSH P,B + PUSH P,E + CAIGE A,256. ;HIGH MOBY GOES ON HIGH LIST + CAIGE A,LIOBLK ;LOW NON-SHUFFLEABLE GOES ON HIGH LIST + JRST MPOUT4 + CAIGE A,128. ;LOW SHUFFLEABLE GOES ON LOW LIST + JRST MPOUT3 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES GO ON HIGH LIST + SKIPN USEMDM ;MEDIUM MEMORY GOES ON LOW OR HIGH DEPENDING ON USEMDM +MPOUT4: SKIPA B,[-1] ;IT'S HIGH MEM +MPOUT3: MOVEI B,0 ;IT'S LOW MEM + +IMRQ4: PUSH P,B ;0 LOW -1 HIGH + LDB B,[MLU,,MEMBLT(A)] ;LINK UP + LDB E,[MLO,,MEMBLT(A)] ;LINK OUT + JUMPN B,IMRQ5 ;JUMP IF NOT FIRST IN LIST + JUMPE E,IMRQ5 ;JUMP IF LAST BLOCK IN LIST + LDB B,[MUR,,MEMBLT(E)] ;FIRST AND FOLLOWED + CAIE B,MUFR + JRST 4,. ;DOESNT LINK TO A FREE BLOCK + MOVEI B,0 ;PUT BACK 0 +IMRQ5: SKIPE E ;SKIP IF NO BLOCK FOLLOWS + DPB B,[MLU,,MEMBLT(E)] ;STORE LINK UP OF PATCHED OUT BLOCK IN LINK OUT BLOCK + JUMPE B,IMRQ5A + DPB E,[MLO,,MEMBLT(B)] ;STORE LINK OUT OF PATCHED OUT BLOCK IN LINK UP BLOCK + POP P,B ;GET BACK WHICH PART OF MEM IT'S IN + JRST IMRQ5C + +IMRQ5A: POP P,B ;GET BACK WHICH PART OF MEM IT'S IN + DPB E,[MLO,,MEMFP(B)] ;THIS WAS FIRST IN FREE LIST, ADJUST LIST HEADER +IMRQ5C: SKIPL B ;SKIP IF NOT IN LOW HALF + SOS LMEMFR ;ADJUST FREE BLOCKS IN LOWER HALF + SOS MEMFR ;1 LESS FREE BLOCK IN SYSTEM + SETZM MEMBLT(A) ;CLEAN UP MEMBLT ENTRY FOR CALLER'S SAKE + MOVEI B,MUINP ;IN PROCESS + DPB B,[MUR,,MEMBLT(A)] + JRST MPOUT1 + +OVHMTR UUO ;MORE MISC UUOS ETC. + +TCALL: CONO PI,UTCOFF + PUSHJ P,@(P) + SKIPA + AOS (P) + JRST UTCOJ1 + +EBLK + +SUBTTL MEMORY ALLOCATION TABLES + +IOBFTL: MXIOB ;BEG FOR GETSYS (MEMORY) +IOBFT: REPEAT MXIOB-1,176000,,.RPCNT+1 ;MAX DYN ALLOC IO BUFFERS + 176000,,377 ;4.9 FREEZE + ;4.8 ALLOC INHIBIT +IOCH==340600 ;4.7-4.2 SYS CHN NO 77 => FREE +IOLC==241000 ;4.1-3.3 LINK TO NEXT SEQ BUF IN CORE (W/IN 1K BLK) +IOLO==1000 ; LINK TO FOLLOWING BUFFER OR + ;SPECIAL STATES LINK OUT + ;-1 LAST BUFFER CURRENTLY FILLED + ;-2 END OF FILE + ;-3 BUFFER ACTIVE AT MAIN PROG LEVEL + ;-4 BUFFER ACTIVE AT PI LEVEL +;IF CHN IS NUTIC+NUTOC (UTAPE FILE DIR) THEN IOLO IS TAPE NO +;CHNLS NUTIC+NUTOC+1 (NFCLC)=>$Q+NCLCH-1 ARE CORE LINK DEVICE +;CHNLS NFNETC => $Q+NNETCH-1 ARE NET CHNLS +SCNCLO==NUTIC+NUTOC+1 + +IOSA==101400 ; BUFFER SA _-6 +IOSA1==111300 ;ONLY RELEVANT BITS FOR 200 WD BUFFERS + + +IOBFP: 0 ;FREE STG TO IOBFT ENT +IOBFC: MXIOB-8 ;CNT OF AVAIL + ;LEAVE 8 AVAIL SO CORE HACKER CAN NOT RUN OUT + +UTFS: 377 ;FREE STG PNTR TO 200 WD BUFFERS +UTTLB: -NUTIC-NUTOC ;TOTAL BUFFERS ALLOCATED TO UTAPES +UTTBF: 0 ;TOTAL UT BUFFERS FREE + +;EXEC MAPS +IF2,[ +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S MAP AREA +EXELMP==UPGMP ;KL10 AND KS10 ALSO NEED EXEC LOWER MAP, + EXISTS +];IF2 ;SO USERS CAN COPY PAGES FROM THE SYSTEM JOB + +;TABLE OF BYTE POINTERS THAT POINT TO VIDEO BUFFER AREA OF EXEUMP +IFN N11TYS,[ +TTCRT: REPEAT NTVBP,[ + CONC [.TTR]\.RPCNT,+EXEUMP +] +] + +IFN PDP6P,[ +;DBR FOR REFERENCING PDP6 MEM +PDP6MP: _1,,PDPUMP + +;PAGE MAP FOR REFERENCING PDP6 MEM +PDPUMP: REPEAT LPDP6M/2,600000++2*.RPCNT,,600000++2*.RPCNT+1 +] + +IFN 340P,[ +DDEXCF: BLOCK NEXPGS ;-1 IF EXEC PAGE SET UP FOR 340 +] + +IFN KA10P, EXECMP: 100_1,,EXEUMP ;EXEC DBR + ;MEMORY ORGANIZATION + +;PAGE 0 ALWAYS BELONGS TO THE SYSTEM AND IS NEVER ALLOCATED OR FREED. +; +;N PAGES OF SYSTEM CODE AND VARIABLES ARE ACQUIRED BY THE SYSTEM JOB AT STARTUP. +; +;N PAGES OF USER-VARIABLE BLOCKS BELONG TO THE SYSTEM JOB. THESE ARE +;ALLOCATED AND DEALLOCATED AS REQUIRED. LIOBLK-1 IS THE HIGHEST THIS CAN GO. +;USER PAGES BELOW LIOBLK CAN BE SHUFFLED OUT WHEN THE SYSTEM JOB NEEDS THE CORE. +; +;FROM LIOBLK TO 128K IS THE "LOW HALF." THESE PAGES ARE DIRECTLY ADDRESSABLE +;IN EXEC MODE AND NEVER NEED TO BE SHUFFLED. I/O BUFFERS, DISK DIRECTORIES, +;ETC. ARE ALLOCATED IN THESE PAGES. +; +;128K TO 128K+NEXPGS ARE PAGES WHICH CAN'T BE ADDRESSED DIRECTLY FROM +;EXEC MODE BECAUSE THEIR EXEUMP SLOTS ARE USED BY "EXEC PAGES." +; +;THE REST OF THE LOW MOBY, UP TO FDDTPG, IS DIRECT-MAPPED AND +;USED FOR ADDITIONAL "LOW HALF" PAGES. +; +;FDDTPG TO 256K CONTAINS DDT AND THE SYSTEM SYMBOL TABLE. +; +;PAGES ABOVE 256K ARE IN THE "HIGH MOBY". +; +;PAGES NOT IN THE "LOW HALF" (BELOW LIOBLK, SHADOWED BY EXEC, OR HIGH MOBY) +;ARE CONSIDERED TO BE IN THE "HIGH HALF". USER PAGES PREFER TO GO HERE. +; +;COMPLICATIONS: +; IF USEMDM IS OFF, THE DIRECT MAPPED PAGES IN THE HIGH HALF +; OF THE LOW MOBY ARE CONSIDERED HIGH RATHER THAN LOW. THIS IS USED +; MOSTLY FOR DEBUGGING, TO CATCH REFERENCES TO RANDOM ADDRESSES. +; THERE CAN BE HOLES IN MEMORY (NXM). +; +;THE MEMBLT TABLE HAS ONE WORD FOR EACH 1K BLOCK OF MEMORY. +;IT SAYS WHAT THAT BLOCK IS USED FOR AND CONTAINS LINKS TO OTHER +;BLOCKS AND OTHER TABLES. THE MEMPNT AND MMSWP TABLES ALSO CONTAIN +;ONE WORD PER BLOCK AND CONTAIN ADDITIONAL INFORMATION. + +FDDTPG: 0 ;# OF LOWEST BLOCK USED BY DDT & SYMTAB (SET AT STARTUP) + +MEMFR: 0 ;# OF FREE BLOCKS IN ALL OF MEMORY. + +LMEMFR: 0 ;# OF FREE BLOCKS IN LOW LIST (MEMFP). + +MINCOR: 8 ;TRY TO KEEP THIS MANY PAGES FREE IN LOW MEMORY + ;MUST BE >= 3, SINCE LESSER-PRIORITY CONSUMERS OF + ;MEMORY WAIT IF LMEMFR IS < 3. + +MEMFP1: 0 ;LIST (THREADED THROUGH MLO, TERMINATED BY 0) + ;OF BLKS THAT BECAME FREE WHILE MEMFRZ WAS LOCKED. + +MEMHPT: 0 ;FREE LIST OF HIGH HALF PAGES AND HIGH MOBY PAGES + ;AND SHUFFLEABLE LOW HALF PAGES. MUST BE AT MEMFP-1. +MEMFP:: +MEMBLT: 0 ;FREE LIST POINTER FOR LOW PGS AND ALSO WD FOR BLOCK 0 + BLOCK TSYSM-1 .SEE BEGF0 ;FILLS THIS IN + +;FIELDS IN MEMBLT ENTRY: +;4.9 FREEZE OR ALLOC INHIBIT +;IF 4.9=1, DONT SET UP ANY MORE EXEC PGS POINTING TO THIS ONE +MUR==360500 ;4.4-4.8 USAGE CODE + MURUSR==1 ;USER PAGE, MMMPX=MMP INDEX + MUEX==2 ;EXEC (?) + MUIOB==3 ;200 WD BUFFERS, MNUMB=FIRST IOBFT ENTRY IN BLOCK + MUFR==4 ;FREE + MUINP==5 ;IN PROCESS OF BEING ALLOCATED + MUMGB==6 ;MAG TAPE BUFFER, MNUMB=TAPE NO+EOF BIT, MWC=WORD COUNT + MUMMP==7 ;MMP TABLE + MUDISB==10 ;340 DISPLAY BUFFER + MUFRT==11 ;BLOCK RETURNING TO FREE WHEN MEM LOCKED + MU23B==12 ;DISK BUF, MWC=WORD COUNT, MNUMB=CHANNEL + MU23UD==13 ;DISK USER DIR, MNUMB=QSNUD SLOT + MU23MD==14 ;DISK MASTER DIR + MU23TT==15 ;DISK TUT MNUMB=DISK NO. + MU23LS==16 ;DISK COPY OF USER DIR FOR LISTING + MUHOLE==17 ;"HOLE" IN REAL MEM + MUDDT==20 ;"DDT" PAGE + MUNET==21 ;NETWORK "BIG" BUFFER + MUSWPG==22 ;PAGE IN SWAPPING QUEUE, MMMPX=MMP INDEX + MUCHA==23 ;CHAOS NET BUFFERS + MU23FB==24 .SEE QSFBT ;DISK FREED-BLOCKS TABLES + MUPKT==25 ; Net packet buffers + MUDVB==26 ;Semi-static device IO buffer page +;ADD NEW MUR TYPES HERE ^ +MURMAX==27 ;HIGHEST VALID CODE + 1 + +MWC==221400 ;3.1-4.3 WORD COUNT IN I/O BUFFERS + +MLU==221400 ;3.1-4.3 LINK UP FOR DOUBLY-THREADED FREE LIST + +MNUMB==140600 ;2.4-2.9 MAGIC NUMBER SEE COMMENTS UNDER MUR ABOVE + +MMMPX==142200 ;2.4-4.3 MMP INDEX IN USER PGS + SWAP BUFFERS + +MLO==001400 ;1.1-2.3 LINK TO NEXT PAGE IN A LIST + ;0 = END OF LIST + ;UNLIKE IOLO AND PREVIOUS VERSION OF MLO, THERE ARE NO MAGIC NEGATIVE CODES + ;N.B.: MLO MUST BE AT RIGHT-HAND END OF WORD - CODE DEPENDS + +MEMPNT: BLOCK TSYSM ;RH USED FOR CIRC MEM USE PNTR IF USER MEM + ;LH FOR DISK ADDRESS CAME FROM OR GOING TO + ;MEMPNT HAS BLOCK NUMBER + ;DISK NUMBER COMES FROM CHANNEL LINKED TO + ;CIRCULAR PAGE LINK FORM + ;2.9=0 + ;1.1-1.8 PAGE # + ;2.8-1.9 USER # + ;2.9=1 + ;2.8=0 2.7-1.1 LINK TO MMP TABLE + ;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE + ;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +MMSWP: BLOCK TSYSM ;IF USER MEM, HAS NUMBER OF PAGE TABLE WORDS + ; WHICH POINT AT THIS PAGE. LH IS NUMBER OF EXEC + ; PAGES, RH IS NUMBER OF USER PAGES. NOTE THAT THE + ; NUMBER OF UPGCP ENTRIES COULD BE MORE, FOR VARIOUS + ; REASONS, E.G. CIRPSW LOCKED WHEN PAGE SWAPPED IN, + ; OR A USER WAS SWAPPED OUT. + ;IFN SWPWSP, RH(MMSWP) IS USED AS NUMBER OF SHARERS. + +EMEMTL==.-1 ;END FOR GETSYS (MEMORY) + +MMPRTC: 0 ;C AT MMPRTN, FOR DEBUGGING + +MMPFS: 0 ;FREE-LIST OF MMP ENTRIES. VALUE IS ADDRESS. (FORMERLY WAS IDX). + +MMPFS2: 0 ;LIST OF MMPS THAT NEED TO HAVE TUT SOS'ED BEFORE THEY CAN BE FREED. + ;TUT COULDN'T BE SOS'ED AT P.I. LEVEL BECAUSE IT WAS LOCKED. + ;THESE MMPS MAY ALSO NEED TO BE REMOVED FROM THE SHAREABLE + ;PAGE TABLE, WHICH REQUIRES CIRPSW. + +MMPCNT: 0 ;# OF MMP ENTRIES IN USE. + +MMPFR: NMMP*1000 ;MAX POSSIBLE # MMP ENTRIES, MINUS # IN USE OR COMMITTED. + +;MMP TABLE - TWO WDS PER ENTRY +MMPPUB==400000 ;WD1 4.9 INDICATES A PUBLIC PAGE IF ON (ANYONE CAN ATTACH TO WRITE) +MMPOUT==200000 ;4.8 => PAGE IS SWAPPED OUT OR ON WAY OUT. +MMPTMP==100000 ;4.7 => IN TRANSIT (ON WAY IN OR ON WAY OUT). +MMPWOD==40000 ;4.6 => THIS PAGE HAS BEEN WRITTEN ON DISK AT LEAST ONCE +MMPISW==20000 ;4.5 PAGE ON INITIAL SWAPIN, BEING COPIED SO SWAP OUT TO DIFF PLACE +MMPWRT==10000 ;4.4 HAS BEEN WRITTEN SINCE LAST DISK WRITE BY USER WHO HAS DETACHED THIS PAGE +MMPGON==4000 ;4.3 FILE PAGE BEING WRITTEN OUT AFTER + ;DELETED FROM ALL MAPS (MMP ENTRY WILL SOON GO AWAY.) +MMPBAD==2000 ;4.2 PAGE GOT PAR ERR SINCE LAST TIME SWAPPED OUT OR IN. +MMPLOK==1000 ;4.1 => PAGE MAY NOT BE SWAPPED OUT. +MMPSLO==400 ;3.9 => PAGE SHOULD GO IN SLOW MEMORY. +MMPSHR==200 ;3.8 MMP ENTRY IS IN SHAREABLE PAGE HASH TABLE +MMPPGA==100 ;3.7 BEING SWAPPED IN BY PAGE-AHEAD. DON'T PUT IN USER MAPS; WAIT FOR FAULTS. +MMPPGB==40 ;3.6 BEING SWAPPED OUT BY PAGE-BEHIND. +$MMPUN==220300 ;3.1-3.3 UNIT NUMBER (GOES WITH DISK ADDR IN WD2 LH) + ;WD1 RH CIRC MEM USE PNTR + ;WD2 LH READ DISK ADR OR 0 + ;WD2 RH THREAD FOR SHAREABLE PAGE HASH TABLE + +MMPNP: 0 ;#MMP PGS ACTUALLY IN USE +MMPMX: 0 ;HIGHEST VALID MMP INDEX (MMPNP*2000) + +MMMPG: BLOCK NMMP ;BLOCK NOS OF BLOCKS ACTUALLY USED + +;SHAREABLE PAGE HASH TABLE +;MMP ENTRIES THAT ARE SHARED WITH FILES ARE LISTED HERE TO SAVE TIME AT NCORQ2 +;SIMPLE REMAINDER HASH ON UNIT#,,DISK ADDRESS, +;BUCKETS THREADED THROUGH RH(MMPE+1) + +SHRHSL==31. ;NUMBER OF BUCKETS +SHRHSH: BLOCK SHRHSL + +;"LOOSE" PAGES (NOT USED BY ANY USER, BUT NOT YET SWAPPED OUT.) +;MMP ENTRY GOES AWAY WHEN SWAPPED OUT, OR GETS PUT BACK INTO SERVICE AT NCORQ3. +NLOOSP: 0 ;NUMBER OF LOOSE PAGES +FLOOSP: 0 ;HEAD OF LIST. THREADED THROUGH MLO IN MEMBLT. +LLOOSP: 0 ;TAIL OF LIST. ADD AT TAIL, SWAPPER REMOVES FROM HEAD. + +BBLK +MMPEAD: REPEAT NMMP, CONC MMP,\.RPCNT,*2000+400000 ;EXEC ADR +MMPPPP: REPEAT NMMP, CONC .MMP,\.RPCNT,+EXEUMP ;PNTR TO EXEC PC MP +USEMDM: DIRMAP ;NON-ZERO => USE MEDIUM MEMORY. + ;DON'T CHANGE AFTER SYSTEM STARTUP + +SUBTTL 200-WORD I/O BUFFER ROUTINES + +;SYS CHANNEL ASSIGN +; 77=>FREE +; 0 - NUTIC+NUTOC-1 => UTAPE CHNL +;NUTIC+NUTOC (=NFCLC-1) =>UTAPE FILE DIR +;NFCLS-NFCLC+NCLCH-1 (=NFNETC-1) => CORE LINK +;NFNETC-NNETCH => NETWORK + +IOBCNS: MOVEI A,IOBFP-IOBFT +IOBC1: MOVE E,A + LDB A,[IOLO,,IOBFT(A)] + CAIN A,377 + JRST 4,. ;IOBFT POINTERS FOULED UP + +IOBC2: LDB B,[420200,,IOBFT(A)] + JUMPN B,IOBC1 + LDB B,[IOLO,,IOBFT(A)] + DPB B,[IOLO,,IOBFT(E)] + SOS IOBFC + POPJ P, + + +IOBR: MOVE B,IOBFP ;RETURN IOBFT WORD + CLEARM IOBFT(A) + DPB B,[IOLO,,IOBFT(A)] + MOVEM A,IOBFP + MOVEI B,77 + DPB B,[IOCH,,IOBFT(A)] + AOS IOBFC + POPJ P, + +IUTCONS: ;ALLOCATE 200 WORD BUFFER +IUTCO1: PI2SAF + SKIPG UTTBF ;CLOBBERS A B E TT, RETURNS IOBFT INDEX IN A + JRST IUTC1 ;NO UTAPE BUFFERS FREE + MOVEI E,UTFS-IOBFT + MOVE A,UTFS ;CHNL NO IN D +IUTC3: CAIN A,377 + JRST IUTC1 + LDB B,[420200,,IOBFT(A)] + JUMPN B,IUTC2 + LDB B,[IOCH,,IOBFT(A)] + CAIE B,77 + JRST 4,. ;BUFFER BEING ALLOCATED ISN'T FREE. + LDB B,[IOLO,,IOBFT(A)] + DPB B,[IOLO,,IOBFT(E)] + DPB D,[IOCH,,IOBFT(A)] + SOS UTTBF + JRST POPJ1 + +IUTC2: MOVE E,A + LDB A,[IOLO,,IOBFT(A)] + JRST IUTC3 + +IUTC1: PUSHJ P,UIMRQ + POPJ P, + PUSHJ P,UTMGB + JRST IUTCO1 + +IBRTN: PI2SAF + PUSH P,B ;FREE 200 WORD BUFFER (SEE BRTN) +; LDB B,[IOCH,,IOBFT(A)] +; CAIN B,77 +; JRST 4,. ;RETURNING A BUFFER THAT'S FREE? + MOVE B,UTFS + DPB B,[IOLO,,IOBFT(A)] + MOVEM A,UTFS + MOVEI B,77 + DPB B,[IOCH,,IOBFT(A)] + LDB B,[IOSA,,IOBFT(A)] + SKIPN B + JRST 4,. + AOS UTTBF + JRST POPBJ + +UTMGB: PUSH P,J ;GOBBLE MEM BLK IN A FOR UTAPE BUFFER + PUSH P,R + PUSH P,Q + PUSH P,B + PUSH P,E + MOVEI B,MUIOB + DPB B,[MUR,,MEMBLT(A)] + MOVE J,A + LSH A,10.-6. ;CONV TO BUF SA + MOVE TT,A ;INCR TO NEXT BUF ADR + MOVEI R,8 + ADDM R,UTTLB ;UTTBF AOSED AT IBRTN + MOVNI Q,1 +UTMG1: PUSHJ P,IOBCNS + DPB TT,[IOSA,,IOBFT(A)] + JUMPL Q,UTMG2 + DPB A,[IOLC,,IOBFT(Q)] +UTMG3: MOVE Q,A + PUSHJ P,IBRTN + ADDI TT,2 + SOJG R,UTMG1 + MOVEI TT,377 + DPB TT,[IOLC,,IOBFT(A)] + POP P,E + POP P,B + POP P,Q + POP P,R + POP P,J +FSCMP: ;RECOMPUTE UTAPE BUFFER FAIR SHARE +IFN NUNITS,[ + MOVE A,UTTLB + PUSH P,A+1 + IDIV A,NUTCA + POP P,A+1 + MOVEM A,UPCHFS +] + POPJ P, + +UTMG2: DPB A,[MNUMB,,MEMBLT(J)] + JRST UTMG3 + +BRTN: CONO PI,UTCOFF ;RETURN A 200-WD BUFFER + PUSHJ P,IBRTN + JRST UTCONJ diff --git a/system/dc10.defs27 b/system/dc10.defs27 new file mode 100644 index 0000000..ef2f9d4 --- /dev/null +++ b/system/dc10.defs27 @@ -0,0 +1,286 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + + +;SYSTEMS CONCEPTS DC10 PHYSICAL CHARACTERISTICS + +DEFSYM NCYLS==400. ;# CYLINDERS NORMALLY USED +DEFSYM XCYLS==6 ;# EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==20. ;# TRACKS/CYLINDER +DEFSYM NSECS==2 ;# BLKS/TRK +DEFSYM SECBLK==1 ;# SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS ;# BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ;TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ;# XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ;TOTAL BLOCKS + +DEFSYM NTUTBL==2 ;2 BLOCKS PER TUT (DUAL-DENSITY CALCOMPS THESE DAYS) +DEFSYM DECADE==20. ;NUMBER OF BLOCKS TO ALLOCATE AT A TIME + ;QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS + +;EXTRA WORDS IN BLOCK + +DEFSYM XWBWC==0 +DEFSYM XWBLK==1700,, ;BP TO PREV BLK # IN FILE FLD +DEFSYM XWAWC==171200,, ;BP TO ACTIVE WD CNT +DEFSYM XWSYSN==1 +DEFSYM XWFN1==2 +DEFSYM XWFN2==3 +DEFSYM NXWDS==4 ;NUMBER OF EXTRA WORDS + +DEFSYM DC0==610 ;MAIN DEVICE CODE +DEFSYM DC1==614 ;READS ERR STATUS ETC, SETS TIMER DRIVER # ON CONO + +;FIELDS IN HEADER WORD 0 + +DEFSYM DPKID==240700,, ;PACK ID FIELD +DEFSYM DCYL==131100,, ;CYLINDER CHECK FIELD +DEFSYM DSURF==60500,, ;SURFACE CHECK FIELD +DEFSYM DSECT==600,, ;SECTOR FIELD + +;WORD 1 HEADER + +DEFSYM DHIND==1000,, ;4.1 INDIRECT IF 1, CYL, SURF, SECTOR SAME AS ABOVE +DEFSYM DHSPRT==400,, ;BIT 3.9 SOFTWARE PROTECT +DEFSYM DHHPRT==200,, ;3.8 HARDWARE PROTECT +DEFSYM DHNXAD==270200,, ;3.7, 3.6 HOW TO COMPUTE NEXT DISK ADR + ;=00 ADD 1 TO SECTOR + ;01 SET SECTOR TO 0, ADD 1 TO SURF + ;10 SET SECTOR AND SURFACE TO 0, ADD 1 TO CYL + ;11 END OF DISK +DEFSYM DHEPB==10,, ;PARITY BIT FOR EVEN BITS OF 56 BIT HEADER +DEFSYM DHOPB==4,, ;PARITY BIT FOR ODD BITS OF 56 BIT HEADER +DEFSYM DHSLNG==1600,, ;-LENGTH OF SECTOR FIELD + +;DISK ADDRESS DATA COMMANDS (OP CODES) + +DEFSYM DRC==400000,, ;READ COMPARE +DEFSYM DWRITE==440000,, ;WRITE +DEFSYM DREAD==500000,, ;READ +DEFSYM DSEEK==540000,, ;SEEK +DEFSYM DRCC==600000,, ;READ COMPARE CONTINUOUS +DEFSYM DWRITC==640000,, ;WRITE CONTINUOUS +DEFSYM DREADC==700000,, ;READ CONTINUOUS + +DEFSYM DUNENB==20000,, ;ENABLE LOAD UNIT FIELD +DEFSYM DUNFLD==330400,, ;UNIT FIELD +;PKID, CYL, SURF, AND SECTOR SAME AS ABOVE + +;COPY / COMPARE / SKIP COMMAND + +DEFSYM DCOPY==40000,, ;COPY +DEFSYM DCCOMP==100000,, ;COMPARE +DEFSYM DCSKIP==140000,, ;SKIP + +DEFSYM DCWC==241400,, ;-WC FIELD +DEFSYM DCCA==2400,, ;CORE ADDRES +DEFSYM DCBN==121200,, ;BLOCK NUMBER + +;JUMP COMMANDS +DEFSYM DHLT==0 ;0 IN 4.9-4.5 = JUMP AND IN 3.5,3.6 = HALT +DEFSYM DXCT==20,, ;XCT +DEFSYM DJMP==40,, ;JUMP +DEFSYM DJSR==60,, ;JSR + +;"B" COMMAND BITS 3.3, 3.4 +;0 ALWAYS +DEFSYM DAOJNC==4,, ;AOJN THE CONTROL COUNTER +DEFSYM DDOK==10,, ;ON NO DATA ERROR +DEFSYM DSRQF==14,, ;IF SEEK RQ FLAG ON + +;STORE REGISTER COMMAND +DEFSYM DSREG==240400,, ;STORE REG +;USE, UNIT BITS SAME +DEFSYM DSREGS==240300,, ;SOURCE REGISTER SELECT FIELD +DEFSYM DSRDB==0 ;STORE DATA BUFFER +DEFSYM DSRDL==4,, ;STORE DISK LOCATION +DEFSYM DSRCC==10,, ;STORE COMMAND COUNT +DEFSYM DSRPC==24,, ;STORE PC (IN FORM OF JMP INST.) +DEFSYM DSRWC==30,, ;STORE WORD COUNT +DEFSYM DSRCA==34,, ;STORE CORE ADDRESS (TO XFER DATA TO OR FROM) + +;ALU COMMAND +DEFSYM DALU==300000,, ;BASIC ALU OP CODE +DEFSYM DALUX==40000,, ;INDEX BIT (ADD CC TO ADR) +DEFSYM DALUD==40,, ;DIRECT BIT IF 1, REF MEM OT GET B OP + +DEFSYM DASL==4000,, ;SKIP ON <0 +DEFSYM DASE==10000,, ;SKIP ON = 0 +DEFSYM DASLE==14000,, ;SKIP ON < OR = 0 +DEFSYM DASA==20000,, ;ALWAYS SKIP +DEFSYM DASGE==24000,, ;SKIP ON > OR = 0 +DEFSYM DASN==30000,, ;SKIP ON NOT = 0 +DEFSYM DASG==34000,, ;SKIP ON > 0 + +;DESTINATION SUB OP (ALSO SPECIFIES SOURCE A) +DEFSYM DLDB==0 ;OP A FROM DB, STORE IN DB +DEFSYM DLDL==4,, ;OP FROM DL, STORE IN DL +DEFSYM DLCC==10,, ;OP FROM CC, STORE IN CC +DEFSYM DLCA==14,, ;OP A =0, STORE IN CA +DEFSYM DLTDB==20,, ;TEST DB (OP A FROM DB, NO STORE) +DEFSYM DLDBPC==24,, ;OP A FROM DB, STORE IN PC +DEFSYM DLDBWC==30,, ;OP A FROM DB, STORE IN WC +DEFSYM DLDBM==34,, ;OP A FROM DB, STORE IN MEM (DIRECT MUST BE ONE TO REALLY MAKE IT) + +;SOME USEFUL (?) OPS +DEFSYM DLADD==100,, ;A+B +DEFSYM DLSOS==200,, ;B-1 +DEFSYM DLLB==300,, ;B +DEFSYM DLSUB==400,, ;B-A + +DEFSYM DLAND==2300,, ;A&B +DEFSYM DLIOR==2500,, ;A IOR B +DEFSYM DLLA==3100,, ;LOAD A +DEFSYM DLSETO==3200,, ;-1 +DEFSYM DLSETZ==3300,, ;0 + +;OPR COMMAND +DEFSYM DOPR==200000,, ;BASIC OPR +DEFSYM DOHXFR==400,, ;HALT DURING XFER (SO MB WILL BE SAFE) +DEFSYM DOCSRQ==200,, ;CLEAR SEEK RQ +DEFSYM DOSSRQ==100,, ;SET SEEK RQ +DEFSYM DOSCFL==40,, ;SET C FLAG + +;STORE DRIVE STATUS +DEFSYM DSDRST==240000,, ;STORE DRIVE STATUS +;UNIT ENABLE, UNIT FIELD SAME +DEFSYM DSDCNT==240400,, ;COUNT-1 FIELD + +;BITS IN DRIVE STATUS STORED + +DEFSYM DDSWC==40,, ;WRITE CURRENT SENSED +DEFSYM DDSUNS==20,, ;DRIVE UNSAFE +DEFSYM DDSRDO==10,, ;READ ONLY +DEFSYM DDSSIC==4,, ;SEEK INCOMPLETE +DEFSYM DDSRDY==2,, ;DRIVE READY +DEFSYM DDSONL==1,, ;DRIVE ON LINE +DEFSYM DDSSEL==400000 ;DRIVE SELECTED +DEFSYM DDSCYL==101000,, ;PRESENT CYLINDER +DEFSYM DDSLAT==1000,, ;LATENCY TIMER + +;DISK ADR "SPECIAL COMMAND" + +DEFSYM DSPC==740000,, ;BASIC OP CODE +;USE, UNIT FIELDS AS NORMAL + +; E CONDITION (WAIT) +;0 NONE +DEFSYM DSWIDX==20,, ;WAIT UNTIL INDEX PULSE +DEFSYM DSWSEC==40,, ;WAIT UNTIL SECTOR PULSE +DEFSYM DSWINF==60,, ;NEVER (USE WITH G=3 OR 7) + +; F CONDITION (OTHER WAIT) +DEFSYM DSWHDM==0 ;WAIT FOR MATCHING HEADER +DEFSYM DSWAGH==4,, ;ANY GOOD HEADER +DEFSYM DSWAH==10,, ;ANY HEADER +DEFSYM DSWNUL==14,, ;NO WAIT + +;G OPERATION +DEFSYM DSCRDC==0 ;READ DATA THRU DECODERS +DEFSYM DSCRIM==100,, ;READ DATA IMAGE +DEFSYM DSCRHD==200,, ;READ HEADER WORDS +DEFSYM DSRCAL==300,, ;(RECALIBRATE) +DEFSYM DSCWDC==400,, ;WRITE THRU DECODERS +DEFSYM DSCWIM==500,, ;WRITE IMAGE +DEFSYM DSMAIT==700,, ;MAINTENANCE (PUT CYL FIELD ON BUS LINES WITH CONTROL TAG) + +;BITS IN CONI DC0, +DEFSYM DASSGN==400000,, ;ASSIGNED TO PROC (WITH SWITCH) +DEFSYM DPIRQC==400000 ;PI REQ BEING GENERATED +DEFSYM DSSRQ==200000 ;SEEK REQUEST +DEFSYM DSDEEB==10000 ;ENABLE INTERRUPT ON DATA ERROR OR READ/ COMP ERROR +DEFSYM DSSERR==4000 ;ERROR FLAG +DEFSYM DSSAEB==2000 ;ATTENTION ENABLE FLAG +DEFSYM DSSATT==1000 ;ATTENTION FLAG +DEFSYM DSIENB==400 ;IDLE FLAG ENABLE +DEFSYM DSSRUN==200 ;RUN +DEFSYM DSSACT==100 ;ACTIVE +DEFSYM DSSCEB==40 ;CHANNEL ENABLE +DEFSYM DSSCHF==20 ;CHANNEL FLAG +DEFSYM DSSCFL==10 ;CPU FLAG +;PIA 1.3-1.1 + +;DATAO DC0, SENDS COMMAND TO DISK +; (IGNORED IF EXECUTING COMMANDS FROM MEMORY) + +;CONO DC0, +DEFSYM DCSET==400000 ;SET SELECTED +DEFSYM DCCLR==200000 ;CLEAR SELECTED +DEFSYM DCCSET==600000 ;RESET CONTROLLER THEN SET SELECTED +DEFSYM DCDENB==10000 ;DATA ERROR ENABLE +DEFSYM DCERR==4000 ;SET ERROR FLAG OR CLEAR ALL ERRORS +DEFSYM DCATEB==2000 ;ATTENTION ENABLE +DEFSYM DCCATT==1000 ;CLEAR ATTENTION +DEFSYM DCSSRQ==1000 ;SET SEEK REQUEST +DEFSYM DCIENB==400 ;IDLE ENABLE +DEFSYM DCSTAR==200 ;START (SET) +DEFSYM DCSSTP==200 ;STOP (CLEAR) +DEFSYM DCSGL==100 ;DO SINGLE COMMAND +DEFSYM DCCENB==40 ;CHANNEL ENABLE +DEFSYM DCCFLG==20 ;CHANNEL FLAG +DEFSYM DCCPUF==10 ;CPU FLAG +;1.1-1.3 PIA + +;CONO DC1, + +;SET TIMER DRIVE # FROM 1.1-1.3 + +;CONI DC1, +;LH +DEFSYM DSATDN==360400,, ;ATTENTION DRIVE # +DEFSYM DSTMDN==320400,, ;TIMER DRIVE # +DEFSYM DSLAT==221000,, ;LATENCY TIMER FOR DRIVE ABOVE + +;RH (ERROR FLAGS) +DEFSYM DIPE==4000 ;INTERNAL PARITY ERROR +DEFSYM DRLNER==2000 ;RECORD LENGTH +DEFSYM DRCER==1000 ;READ COMPARE ERROR +DEFSYM DOVRRN==400 ;OVERRUN +DEFSYM DCKSER==200 ;CKSUM OR DECODER ERR +DEFSYM DWTHER==100 ;WATCHDOG TIMER +DEFSYM DFUNSF==40 ;FILE UNSAFE, SEEK INCOMPLETE OR END OR DSK +DEFSYM DOFFL==20 ;OFF LINE OR MULT SEL +DEFSYM DPROT==10 ;WRT KEY OR RD ONLY OR PROTECT +DEFSYM DDOBSY==4 ;DATAO WHEN BSY +DEFSYM DNXM==2 ;NON-EX MEM +DEFSYM DCPERR==1 ;CORE PARITY ERR + +DEFSYM LRIBLK==16 ;CONSISTENCY CHECK DSKDMP VS MARK + + +IFN $$TEMP,EXPUNG DEFSYM + \ No newline at end of file diff --git a/system/ddt.49 b/system/ddt.49 new file mode 100644 index 0000000..547c3c0 --- /dev/null +++ b/system/ddt.49 @@ -0,0 +1,2738 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +subttl ddt conditional assembly + +define setf text,flg +ifdef flg,.stop +.tag foobar +printc "text +flg=" +.ttymac flag +.ttyflg==.ttyflg+1 +printx/flag +/ +.ttyflg==.ttyflg-1 +ifse flag,YES,flg==1 +ifse flag,NO,flg==0 +ifse flag,Y,flg==1 +ifse flag,N,flg==0 +ifndef flg,flg==flag +termin +ifndef flg,.go foobar +termin + +setf [CPU (0 KA, 1 KI, 2 KL, 3 KS)]cpusw ;KI not supported + define ka + ife cpusw!termin + define ki + ife cpusw-1!termin + define kl + ife cpusw-2!termin + define ks + ife cpusw-3!termin + +setf 340?,dpysw ;0 no display + ;1 340 display + define nodpy + ife dpysw!termin + define dpy340 + ife dpysw-1!termin + +setf Number of disks? (0 no swapping and file system goodies),ndsk + define swap + ifn ndsk!termin + define noswap + ife ndsk!termin + swap,lowlen==2200 ;disk routines take a little extra room + +setf [Type of disk? (0 none, 1 Systems Concepts, 2 RP-10, 3 RH-10)]dsksw + define nodsk + ife dsksw!termin + define scdsk + ife dsksw-1!termin + define rp10 + ife dsksw-2!termin + define rh10 + ife dsksw-3!termin + +ifndef moby, moby==740000 ;256k ddt (memsiz-40000) +ifndef lowlen, lowlen==1000 ;size of low code +setf Old Type Data Products Line Printer?,lptp +;setf [Assemble for MACDMP? (If no, DSKDMP)]mcdmpf +MCDMPF==0 +;setf One Proceed?,1PRSW ;DOESN'T WORK! +1PRSW==0 + +subttl assignments and definitions + +TITLE DDT + +LOC 34000+MOBY + +DDT: + +MEMSIZ=40000+MOBY ;INITIAL $I-2 +NLEVS==7 ;LENGTH OF RING BUFFER OF . + +F=0 ;FLAGS +P=1 ;PUSH DOWN +R=2 ;POINTERS TO TABLES, CORE, ETC. +S=3 +W=4 ;CONTAINS DISPATCH ADDRESS IN WORD ASSEMBLER +T=5 ;TRANSFER DATA +W1=6 +W2=7 +I=10 ;SWAP TYPEOUT VARIABLES BETWEEN DISPLAY AND TTY +A=R +B=S +C=W +D=T + +NBP==10 ;NUMBER OF BREAK POINTS +PRS==4 +LPDL==50 ;MAX LENGTH PUSH DOWN LIST + +KS, .INSRT DSK:SYSTEM;KSDEFS > + + ;GET DEFINITIONS OF DTE20 LOCATIONS IN LOW CORE +KL, .INSRT SYSTEM; EPT > +KL, SWPUA=701540,, ;SWEEP-CACHE INSTRUCTION + +IF2 LOC LOW + + SQUOZE 0,DDT ;initial symbols are for program name "DDT" + -NSYMS,,1 + +NUMSYM==1 +IRP A,,[CLEAR,CLEARI,CLEARM +CLEARB,CONSZ,CONSO,DATAI,DATAO,BLKI,BLKO,CONI,CONO] + SQUOZE 4,A + A + NUMSYM==NUMSYM+1 +TERMIN + +MTC==340 ;magtape control +MTS==344 ;magtape status +PI==004 + +ka,[ +DC0==610 ;THIS STUFF REALLY WANTS TO CONDITONALIZED ON DISK CONTROL +DC1==614 +DPK==604 +DPC==250 + +PTP==100 ;paper tape punch +PTR==104 ;paper tape reader +TTY==120 ;console terminal +LPT==124 ;line printer +DIS==130 ;340 display +DC==200 ;deselection device? +UTC==210 ;dectape control +UTS==214 ;dectape status + +IRP A,,[PI,PTP,PTR,TTY,LPT,DIS,DC,UTC,UTS,DC0,DC1,DPK,MTC,MTS,DPC] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];ka + +kl,[ +PAG==10 ;"PAGER" +CCA==14 ;"CACHE SWEEPER" +TIM==20 ;"TIMER" +MTR==24 ;"METER" +DSK==270 ;RH10 + +IRP A,,[PI,PAG,CCA,TIM,MTR,MTC,MTS,DSK] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];kl + +KS,[ +PAG==10 ; Paging +.RD.==20 ; Read various kludges +.WR.==24 ; Write various kludges + +IRP A,,[PI,PAG,.RD.,.WR.] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];KS + +SWAP,[ SQUOZE 4,$QACT ;DDT'S DISK-ACTIVE FLAG WORDS + QACT + NUMSYM==NUMSYM+1 +] + +DEFINE BUST A + SQUOZE 4,$!A!B + B1ADR+A*3-3 + NUMSYM==NUMSYM+1 + TERMIN + + SQUOZE 4,..START + STARTA + SQUOZE 4,$M + MSK + SQUOZE 4,$I + SAVPI + SQUOZE 4,DDT + DDT + +NUMSYM==NUMSYM+4 + +RADIX 10. +REPEAT NBP+1,BUST \.RPCNT +RADIX 8 + +DEFINE INFORM A,B +IF1,[ PRINTX /A = B +/] + TERMIN + +INFORM [INITIAL SYMS]\NUMSYM*2 + LOC DDT-LOWLEN +LOWCOD: INFORM [LOWCODE]\. + +SWAP,[ +.insrt ddtdsk > +] + +subttl display routines + +dpy340,[ +NREGS=10. +NUMREG=11. + + ;INITIALIZE DISPLAY (CALLED UNCONDITIONALLY WHEN DDT FIRST STARTED UP) + +DISINI: PUSH P,R + SKIPN DISON ;SKIP IF DISPLAY ON + SKIPA R,CJLP1 ;JRST LLUP1 + MOVSI R,(TRNA) + MOVEM R,LLUPI1 + JUMPGE R,DISIN1 ;JUMP IF JUST MUNGED INTO LLUPI1 + ;FOLLOWING CIDING SKIPPED IF DISPLAY OFF + HRRZ T,ESTUT + SUBI T,NUMREG*+3 + HRRM T,DISWD + MOVE R,[REPEAT 6,[35]] + MOVEM R,(T) + HRLI R,(T) + HRRI R,1(T) + BLT R,NUMREG*<2*NREGS+1>-1+1(T) + MOVNI R,NREGS+1 + MOVEM R,DISCNT + PUSHJ P,RECYC + MOVEI T,DISBEG + MOVEM T,DISPDL + SETCM T,.-1 + MOVNM T,DISACS+P +DISIN1: POP P,R + POPJ P, + +DISDON: 0 +DISPTR: 0 ;BLKO POINTER FOR DISPLAY +DISCC: 0 +DISPNR: 0 +DISON: -1 ;DISPLAY FEATURE INITIALLY ON +DISWD: -NUMREG*<2*NREGS+1>,, +DTOC: IDIVI T,8 ;CANT CALL TOC OR TOUT. SCREWS DISPLAY. + HRLM W1,(P) + SKIPE T + PUSHJ P,DTOC + HLRZ T,(P) + ADDI T,"0 + +DISAD: PUSH P,T + ANDI T,177 + CAIL T,40 + CAILE T,132 + JRST DISAD2 +DISAD0: IDPB T,DISPNR + AOS DISCC + HRRI T,-10. + SKIPGE T + MOVEM T,DISCC + JRST POPTJ + + +DISAD2: PUSH P,W1 + CAIL T,40 + CAILE T,140 + JRST DISAD5 + MOVEI W1,36 + IDPB W1,DISPNR + MOVE W1,BLOBS-133(T) + IDPB W1,DISPNR + MOVEI T,35 + POP P,W1 + JRST DISAD0 + +DISAD3: MOVEI T,34 + PUSH P,T + JRST DISAD0 + +DISAD7: PUSHJ P,DISAD3 +DISAD4: MOVNI T,-33 + PUSH P,T + JRST DISAD0 + +DISAD6: MOVEI T,35 + PUSH P,T + JRST DISAD0 + +BLOBS: 53 + 52 + 54 + 46 + 51 + 50 + +DISAD5: PUSHJ P,DIS69 + PUSHJ P,DTOC + PUSHJ P,DIS69 + POP P,W1 + JRST POPTJ + +DIS69: IRP X,,[36,50,35] + MOVEI W1,X + IDPB W1,DISPNR + TERMIN + POPJ P, + DISLP: AOS T,DISCNT + CAILE T,NREGS +DISBEG: MOVNI T,NREGS + MOVEM T,DISCNT + ADDI T,NREGS + IMULI T,NUMREG + ADD T,DISWD + HRLI T,600 + MOVEM T,DISPNR + MOVEM T,DISPN1 + MOVE R,DISCNT + PUSHJ P,DISAD7 + JUMPE R,.+2 + SOJN R,.+2 + PUSHJ P,DISAD4 + MOVE T,DISCNT + ADD T,LLOC + PUSH P,T + PUSHJ P,PAD + XCT "/,CRF + XCT CRF + SKIPG DISCC + JRST .-2 + POP P,R + PUSHJ P,FETCH + JRST DISL1 + PUSHJ P,CONSYM +DISL2: PUSHJ P,DISAD6 + MOVE T,DISPNR + TLNE T,770000 + JRST DISL2 + SUB T,DISPN1 + HRREI T,-NUMREG(T) + JUMPL T,DISL2 + PUSHJ P,CHECK + AOSE DISDON + JRST .-2 + JRST DISLP +DISL1: XCT "-,CRF + JRST DISL2 + DISCFT: SOS (P) + SOS (P) + SKIPN DISON + POPJ P, +DPYSWP: PUSH P,LLUP1 + MOVEI 17,ACSTG(I) + BLT 17,ACSTG+7(I) + XCT DISSW(I) + TLC T,(CONSO#CONSZ) + MOVEM T,LLUPI1 + XORI I,DIS2-DIS1 + MOVSI 17,ACSTG(I) + BLT 17,7 + POP P,LLUP1 + POPJ P, + +CHECK: CONSO DIS,200 + JRST CHECK1 + BLKO DIS,DISPTR + PUSHJ P,RECYC +CHECK1: XCT LLUPI1 ;JRST LLUP1 (IF OFF) OR TRNA (ALWAYS SKIP, VALUE OF WORD NEGATIVE) + JRST DPYSWP + POPJ P, +RECYC: MOVEM T,DISPTR + MOVEI T,40 + SOJG T,. + CONO DIS,100 + DATAO DIS,[20157,,261777] + MOVE T,DISWD + EXCH T,DISPTR + SETOM DISDON + POPJ P, +];dpy340 + +subttl ddt low code + +IIN: PUSHJ P,IN + CAIE T,177 + POPJ P, + JRST ERR + +LCT: PUSHJ P,TSPC + PUSHJ P,TSPC +TSPC: MOVEI T,40 ;SPACE + JRST TOUT + +TYOI: 0 + MOVE T,TYOI + LDB T,[270600+T,,-1] + PUSH P,TYOI + JRST TOUT + +LISTEN: SKIPN INSW + PUSHJ P,TYI + POPJ P, + CAIE T,^B + CAIN T,^E + JRST TYO2 + CAIE T,^V + CAIN T,^W + JRST TYO2 + JRST CPOPJ1 + +IN: SKIPE INSW + JRST @INSW ;ANOTHER IO ROUTINE PROVIDED, USE IT. (IT SHOULD POPJ 1,) + ILDB T,MACCR + JUMPN T,IN2 + SETZM MACCR +dpy340,[ + CONSO TTY,40 + PUSHJ P,DISCFT + PUSHJ P,TYI + JFCL +];dpy340 +nodpy,[ + PUSHJ P,TYI + JRST .-1 +];nodpy + +IN2: CAIE T,175 + CAIN T,176 + MOVEI T,33 + SKIPE OUTSW(I) + JRST @OUTSW(I) + CAIL T,^I + CAILE T,^M + JRST IN3 + SKIPE TTYFLG + POPJ P, + PUSH P,T + MOVEI T,15 + PUSHJ P,TYO2 + MOVEI T,12 + PUSHJ P,TYO2 +POPTJ: POP P,T + POPJ P, + +IN3: PUSHJ P,TYO2 + +LPTR: SKIPN LPTFLG + POPJ P, +IFN LPTP,[ + CAIE T,15 + JRST .+3 + CONO LPT,10 + POPJ P, + PUSH P,T + CAIN T,12 + MOVEI T,440 + CAIN T,14 + MOVEI T,441 + CAIN T,33 + MOVEI T,"$ + SUBI T,40 +dpy340,[ + CONSZ LPT,10 + PUSHJ P,DISCFT +];dpy340 +nodpy,[ + CONSZ LPT,10 + JRST .-1 +];nodpy + DATAO LPT,T + POP P,T +] + POPJ P, + +TOUT: +dpy340,[ + SKIPE DISON ;IF DISPLAY ON, + PUSHJ P,CHECK +];dpy340 +TOUT2: SKIPE OUTSW(I) + JRST @OUTSW(I) + PUSHJ P,LPTR +TYO: SKIPN TTYFLG + POPJ P, +TYO2: CAIL T," ;SPACE + JRST TYO3 + CAIN T,177 + POPJ P, + CAIL T,^I + CAILE T,^M + CAIN T,^G + JRST TYO3 + PUSH P,T + CAIE T,33 + MOVEI T,"^ + CAIN T,33 + MOVEI T,"$ + PUSHJ P,TYO3 + POP P,T + CAIN T,33 + POPJ P, + TRO T,100 + PUSHJ P,TYO3 + TRZ T,100 + POPJ P, + +TYO3: +ka,[ + CONSZ TTY,20 +dpy340, PUSHJ P,DISCFT +nodpy, JRST .-1 + DATAO TTY,T +];ka +kl,[ + PUSH P,T + ANDI T,177 + PUSHJ P,XDTCM + POP P,T +];kl +KS,[ PUSH P,T + ANDI T,177 + TRO T,400 ;Set CTY-char-pending + MOVEM T,8CTYOT ;Store in comm area + CONI T ;Read 8080 + TRO T,80INT ;Hey you! Get this! + CONO (T) ;Interrupt 8080 + SKIPE 8CTYOT ;Wait for completion + JRST .-1 + POP P,T +];KS + POPJ P, + + +TYI: +ka,[ + CONSO TTY,40 + POPJ P, + DATAI TTY,T +];ka +kl,[ + MOVEI T,3400 ;DDT MODE INPUT REQ + PUSHJ P,XDTCM + JUMPE T,CPOPJ ;NOTHING AVAILABLE +];kl + +KS,[ SKIPN T,8CTYIN ;Chars stored here by 8080. + POPJ P, + SETZM 8CTYIN ;Remember to clear it. +];KS + ANDI T,177 + CAIGE T,175 + CAIG T,137 + SKIPA + SUBI T,40 ;UPPERCASIFY + CAIE T,^B + JRST LPTON1 + SETOM LPTFLG +IFN LPTP, CONO LPT,10 +LPTON1: CAIN T,^E + SETZM LPTFLG + CAIN T,^V + SETOM TTYFLG + CAIN T,^W + SETZM TTYFLG + JRST CPOPJ1 + + +kl,[ +XDTCM: SETZM DTEFLG ;SEND ARG IN T TO 11, GET RESPONSE IN T + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE T,DTEF11 + SETZM DTEFLG + POPJ P, +];kl + + +RESTORE:SETOM TEM3 +RESTR1: HRRM T,SAVE + CLEARM SARS + MOVE T,SAVPI + HLLM T,SAVE + ANDI T,177 ;CHANNELS THAT WERE ON + IORI T,2000 ;TURN ON CHANNELS + MOVEM T,SAVPI +RES1: HRLZI 17,AC0 + BLT 17,17 + SKIPL TEM3 +CPUSHP: PUSH BCOM + CONO PRS,@SAVPI + JRST 2,@SAVE + +CRF: JSR 15,TYOI +LF: MOVEI T,12 ;LINE FEED + JRST TOUT + +;FLOATING POINT OUTPUT + +TFLOT: MOVE A,T + JUMPG A,TFL1 + JUMPE A,FP1A + MOVNS A + XCT "-,CRF + TLZE A,400000 + JRST FP1A + +TFL1: TLNN A,400 + XCT "#,CRF ;NOT NORMALIZED + +FP1: MOVEI B,0 + CAMGE A,FT01 + JRST,FP4 + CAML A,FT8 + AOJA B,FP4 +FP1A: MOVEI C,0 + +FP3: MULI A,400 + ASHC B,-243(A) + MOVE A,B + CLEARM,TEM1(I) + PUSHJ P,FP7 + XCT ".,CRF + MOVNI A,10 + ADD A,TEM1(I) + MOVE W1,C +FP3A: MOVE T,W1 + MULI T,12 + PUSHJ P,FP7B + SKIPE,W1 + AOJL A,FP3A + POPJ P, + +FP4: MOVNI C,6 + MOVEI W2,0 +FP4A: ADDI W2,1(W2) + XCT,FCP(B) + SOSA W2 + FMPR A,@FCP+1(B) +FP4B: AOJN C,FP4A + MOVNI B,-2(B) + PUSH P,B + PUSHJ P,FP3 + MOVEI T,105 + PUSHJ P,TOUT + POP P,T + DPB T,[300200,,.+1] + XCT "+,CRF + MOVE A,W2 + +FP7: JUMPE A,FP7A1 + IDIVI A,12 + AOS,TEM1(I) +FP7A: HRLM B,(P) + JUMPE A,FP7A1 + PUSHJ P,FP7 + +FP7A1: HLRZ T,(P) +FP7B: ADDI T,260 + JRST,TOUT + + 1.0^32. + 1.0^16. +FT8: 1.0^8 + 1.0^4 + 1.0^2 + 1.0^1 +FT: 1.0^0 + 1.0^-32. + 1.0^-16. + 1.0^-8 + 1.0^-4 + 1.0^-2 +FT01: 1.0^-1 +FT0=FT01+1 + +FCP: CAMLE A, FT0(C) + CAMGE A, FT(C) + 0, FT0(C) + +PS: BLOCK LPDL + +dpy340,DISPDL: BLOCK LPDL + + INFORM [END OF LOWCODE]\.-1 + +subttl communication with DSKDMP and ITS + +IF1, IFG .-LOWCOD+6-LOWLEN,.ERR LOW CODE DOESN'T FIT, MAKE LOWLEN BIGGER + +LOC DDT-6 + ALTPC ;-6 PLACE WHERE PC TO PROCEED THROUGH IS STORED + -20,,AC0 ;-5 PNTR TO SAVED LOW CORE (ESPECIALLY ACS) +STARTA: 0 ;-4 START ADDRESS +KILC: -NSYMS,,LOW ;-3 INITIAL SYMBOLS PNTR + -NSYMS,,LOW ;-2 ALL SYMBOLS PNTR +JOBSYM: .-1 ;-1 BIT 4.9=1 => SYMBOL TABLE CLOBBERED + ;+0 DDT STARTS HERE + +NSYMS==NUMSYM*2 +LOW=LOWCOD-NSYMS-2 + +IFN MCDMPF, MACDMP=37400+MOBY +.ELSE [ + noswap, MACDMP=37700+MOBY ;FOR DSKDMP + swap, IF2 MACDMP==ERR ;if neither dskdmp nor magdmp +] + +MACCR=37777+MOBY + +subttl flag register assignments + +;LEFT HALF FLAGS +TIF==100000 ;TRUNCATE TO 18 BITS - SET BY SPACE OR COMMA +PTF==100 ; +, -, OR * HAS BEEN TYPED +COMF==200000 ;COMMA FLAG +CTF==400 +SF==4 ;SYLLABLE FLAG +QF==1 ;QUANTITY TYPED IN TO WORD ASSEMBLER + +CF==40 ;ALTMODE TYPED +CCF==400000 ;2 ALTMODES TYPED +MF==2 ;MINUS SIGN TYPED IN +LTF==20 ;LETTER TYPED IN TO CURRENT SYLLABLE +ROF==10 ;REGISTER OPEN FLAG +STF==4000 ;! MODE +FAF==1000 ; < TYPED +SAF==2000 ; > TYPED + +FPF==20000 ; . TYPED IN +FEF==10000 ; E FLAG + +MLF==200 ;*FLAG +DVF==40000 ;DIVIDE FLAG + +;RIGHT HALF FLAGS +1RF==10 +OUTPUT==4 ;OPDECODER FLAGS + +CF1==400 ;OUTPUT 1 REGISTER AS CONSTANT +LF1==2000 ;OUTPUT 1 REGISTER AS FORCED SYMBOLIC OR CONSTANT +Q2F==1 ;NUMBER TYPED AFTER  +SBF==20 +NAF==200 ;NEGATIVE ADDRESSES PERMISSABLE +POWF==4000 ;ARGUMENT FOR EXPONENT COMING +SLL==10000 ;STOP LOOKING FOR LOCALS + +GLOBAL==040000 ;GLOBAL SYMBOL +LOCAL==100000 +PNAME==740000 ;PROGRAM NAME +DELI==200000 ;DELETE INPUT +DELO==400000 ;DELETE OUTPUT + +subttl ddt starts here + +INFORM DDT,\. + + +DDT: CLEARM INSW ;IF C(INSW) .NE. 0 THEN INPUT ROUTINE JRST'S @INSW + CLEARM OUTSW + JSR SAVE ;SAVE PROCESSOR CONDITION + PUSHJ P,BRKRET ;DIDN'T SKIP, PI STATUS AND AC'S WERE SAVED + SKIPGE JOBSYM ;IF SYMTAB MUNGED, + JRST IFIX ;THEN GO FIX IT +DD1A: +dpy340,[ + PUSHJ P,DISINI ;INITIALIZE DISPLAY +] +DD1: TLZ F,ROF ;INDICATE NO REGISTER OPEN + PUSHJ P,CRF ;TYPE CRLF (AND RUN SCOPE IF ON) + MOVE T,[SCHM,,SCH] + BLT T,ODF +DD2: MOVEI P,PS + CLEARM PRNC ;PARENTHESES COUNT +LIS: MOVE T,ESTU + MOVEM T,ESTUT +LISA: TDZ F,[(,-1-ROF-STF)LF1+CF1+SBF+2] ;LEAVE REGISTER OPENED,TYPEOUT SUPPRESSED +LISB: TDZ F,[(,-1-ROF-STF-FAF-SAF)NAF] + CLEARM,WRD +LIS1: CLEARM,FRASE +LIS2: MOVEI T,1 + MOVEM T,FRASE1 + TLZ F,MLF+DVF +L1: TLZ F,CF+CCF+SF+FPF ;TURN OFF CONTROL, SYL, PERIOD FLAG + CLEARM,SYL +L1RPR: CLEARM,SYM + MOVSI T,(50*50*50*50*50*50) + MOVEM T,TEM(I) ;INIT SYMBOL COUNTER + CLEARM,DEN + CLEARM,WRD2 + +L2: PUSHJ P,IN ;PICK UP CHARACTER + TLNE F,CF ;CONTROL FLAG + JRST,L21 + CAIG T,"Z ;Z + CAIGE T,"A ;A + JRST,.+2 + JRST,LET +L21: MOVE R,T + CAIN T,177 + JRST WRONG + CAILE T,"_ + JRST ERR + IDIVI R,3 + LDB W,BDISP(R+1) + CAIGE W,MULT-DDT ;LOCATIONS BEFORE MULT DON'T HAVE ARG EVALUATED + JRST DDT(W) + +L211: MOVE T,SYL + TLZN F,LTF + JRST POWER +L4A: PUSHJ P,EVAL + JRST,UND1 +L4: TLZE F,MF + MOVN T,T + TLNN F,SF + CAIE W,LPRN-DDT + JRST,.+2 + JRST,LPRN + + EXCH T,FRASE1 + TLNN F,DVF + IMULB T,FRASE1 + TLZE F,DVF + IDIVB T,FRASE1 + CAIGE W,ASSEM-DDT + JRST DDT(W) ;MULTIPLY OR DIVIDE + ADDB T,FRASE + CAIGE W,SPACE-DDT + JRST DDT(W) ; + - @ , + + ADD T,WRD + TLNE F,TIF ;TRUNCATE INDICATOR FLAG + HLL T,WRD ;TRUNCATE + MOVEM T,WRD + TLNN F,QF + MOVE T,LWT(I) + CLEARM,R + MOVE W1,ESTUT + CAMN W1,ESTU + JRST L5 + CAILE W,CARR-DDT + JRST ERR +L5: CAIG W,RPRN-DDT + JRST DDT(W) + PUSH P,KILRET + SKIPN PRNC + JRST DDT(W) + +UNDEF: MOVEI T,"U ;U + JRST WRONG1 +ERR: +WRONG: MOVEI T,"? +WRONG1: MOVEI P,PS + PUSHJ P,TOUT +RET: MOVEI P,PS + PUSHJ P,LCT ;COMMON RETURN FOR TAB;,JRST,LIS + JRST DD2 + +UND1: MOVE R,ESTUT ;UNDEFINED SYM ASSEMBLER + PUSHJ P,EVAL2 + CAIN W,ASSEM-DDT + TLNN F,ROF + JRST OPLOOK + LDB T,[(100)PRNC] + JUMPN T,UNDEF + CAIE W,ASSEM-DDT + XCT "#,CRF + MOVN R,[(2)2] + ADDB R,ESTUT +dpy340, PUSHJ P,DISINI + MOVE T,SYM + TLO T,GLOBAL + MOVEM T,(R) + HRRZ T,LLOCO + TLNE F,MF + TLO T,400000 + MOVEM T,1(R) + SETZI T, + JRST L4 + +QUESTN: PUSHJ P,CRF ;LIST UNDEFINED SYMBOLS + MOVE R,ESTU +QUEST1: JUMPGE R,DD1 + MOVE T, (R) + SKIPA W1,ESTU + +QUEST2: ADD W1,[(2)2] + CAME T,(W1) + JRST QUEST2 + +QUEST3: CAME R,W1 + JRST QUEST4 + PUSHJ P,SPT + PUSHJ P,CRF +QUEST4: ADD R,[(2)2] + JRST QUEST1 + +OPLOOK: MOVE T,OPLK1 + MOVEI W1,SYM + MOVE R,[(440700)TXT] + PUSHJ P,SPT+1 +OPLK1: IDPB T,R + +;OPDECODER + +OPEVAL: MOVEM P,SAVPDL + TRZA F,OUTPUT +OPTYPE: TRO F,OUTPUT + LSH T,-27. + MOVEM T,INST(I) + MOVE T,[(440700)TXT] + MOVEM T,CHP +DEC: TRZ F,1RF + CLEARB R,W1 + MOVE W2,BTAB +OPDC1: ILDB T,W2 + CAILE T,40 + CAIL T,73 + SOJGE R,OPDC1 + JUMPG R,OPDC1 + SUBI T,40 + JUMPE T,DECX + JUMPG T,DC2 + DPB T,[(340500)PNTR] + TRZ T,-4 + AOS T + DPB T,[(300600)PNTR] + TRNN F,OUTPUT + JRST DC6 + LDB R,PNTR + JRST OPDC1 + +DC2: HRREI T,-33(T) + JUMPL T,DECT + MOVE W1,T + IDIVI W1,3 + MOVE W2,BTAB(W2) + ADDI W2,(W1) + JRST OPDC1 + +DECT: TRNE F,OUTPUT + JRST O1CZ + ILDB W1,CHP + CAIE W1,133(T) + JRST LOSE + JRST OPDC1 + +DECX: TRNE F,OUTPUT + POPJ P, + ILDB W1,CHP + JUMPE W1,DC7 +LOSE: POP P,R + POP P,W2 + POP P,PNTR + POP P,CHP +LOSE1: AOS R + DPB R,PNTR + LDB R,PNTR + JUMPN R,DC6AA + CAME P,SAVPDL + JRST LOSE + MOVSI T,DELO ;LOOK FOR HALF-KILLED AND DIFFERENT PROGRAMS' LOCALS + IORM T,SYM ;NOTE SETTING DELO HACKS EVAL3+2 TO IGNORE PROGRAM NAMES + PUSHJ P,EVAL + JRST UNDEF ;NOT DEFINED AT ALL + PUSH P,R + PUSHJ P,EVAL1 ;LOOK FOR DUPLICATE INSTANCES + XCT "',CRF ;DIFFERENT PROGRAM SELECTED + CAME R,PRGM + XCT "",CRF ;MULTIPLY DEFINED + POP P,R +LOSE2: MOVEM R,PRGM ;BACK UP TO PRECEDING PROGRAM NAME+2 + SUB R,[2,,2] + MOVE W1,(R) + TLNE W1,PNAME + JRST LOSE2 + JRST L4A ;SELECT APPROPRIATE PROGRAM + +DC6: MOVEI R,0 + DPB R,PNTR +DC6AA: CAMN P,SAVPDL + JRST DC6BB + LDB T,-2(P) + CAME T,(P) + JRST LOSE1 +DC6BB: PUSH P,CHP + PUSH P,PNTR + PUSH P,W2 + PUSH P,R + JRST OPDC1 + +DC7: MOVE P,SAVPDL + MOVE T,INST(I) + LSH T,27. + JRST L4 + +O1CZ: TRO F,1RF + MOVEI T,133(T) + PUSHJ P,TOUT + JRST OPDC1 + +PNTR: INST(I) +CHP: 0 +TXT: BLOCK 2 + +SAVPDL: 0 +BTAB: FOO=44 +REPEAT 3,[(FOO_12.+1400)TBL + FOO=FOO-14 +] + +DEFINE BARF A +AWRD=AWRD+_CC +CC=CC-12. +IFL CC,[AWRD +AWRD=0 +CC=24. +] +CLOC=CLOC+1 +TERMIN + +DEFINE HACK A +IRPS B,D,[A] +Z="D +IFE Z-">,Y!B==CLOC +IF1 IFE Z-"/, BARF 1 +IF2 IFE Z-"/, BARF Y!B+73 +IFE Z-"^,BARF _-1+B&7-1 +IFE *,[ +IRPC Q,,B +Z="Q +IFE Z-".,Z=100 +BARF Z-40 +TERMIN +] +TERMIN +TERMIN + +subttl opcode dispatch table + +TBL: AWRD=0 + CLOC=0 + CC=24. + +KA,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ... BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ .. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/] +];KA + +KL,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ADJ/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + ADJ> 03^ . . . . . ADJSP. . .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] +];KL + +KS,[ +;INITIAL DISPATCH + HACK [63^ . FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ IO/ ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ XCAD/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + XCAD> 03^ . . XCTR/ XCTR/ . ADJSP. . . + XCTR> XCTR 01^ I. .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] + +;ITS KS IO INSTRUCTIONS + HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . + IO0> 12^ . . UMV/ . + UMV> UMOVE 01^ . M/ + IO1> IO2> 12^ IORD/ IOXX/ IOWR/ . + IOXX> 01^ IORD/ IOWR> IOWR IOBY/ + IORD> IORD IOBY> 41^ IOIQ/ B IOIQ> 02^ I/ Q. . .] + +;DEC KS IO INSTRUCTIONS +; HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . +; IO0> 12^ . . UMV/ . +; UMV> UMOVE 01^ . M/ +; IO1> IO2> 03^ TIO/ TIO/ RD IOB/ WR IOB/ BS IOB/ BC IOB/ . . +; TIO> TIO 01^ E IOBP/ N IOBP/ +; IOB> IO IOBP> 41^ . B/ ] + +];KS + +;FWT, FIXED POINT ARITH, MISC. + HACK [HAK> 33^ MV/ MV> MOV MO/ ML/ DV/ SH/ H1/ JP/ + 21^ ADD IMB/ SU BIMB> B IMB> 02^ . I>I. M/ B/ MO> 22^ + EIMS> E IMS/ S IMS/ N IMS/ M IMS> 02^ . I/ M/ S> S. + ML> 21^ I ML1/ ML1> MUL IMB/ DV> 21^ I DV1/ DV1> + DI DV2> V IMB/ H1> 03^ EXC S3/ BL T> T. AO/ AO> AOBJ + AOB/ JRS T/ JFC L/ XC T/ . AOB> 01^ P/ N/ + JP> 03^ PU/ PU> PUSH PUS/ PO/ PO> POP POP/ JSR. + JS P/ JS PA> A. JR PA/ PUS> 01^ J> J.. POP> + 01^ . J/ SH> 02^ A S2/ ROT S1/ L S2> S S3> H S1/ 21^ JFFO. CIR C/ + S1> 21^ . C> C. ] + +;ARITH COMP, SKIP, JUMP + HACK [ACCP> 42^ CA CA1/ SJ/ A JS/ S JS> O 31^ + J COMP/ S COMP/ CA1> 31^ I COMP/ M COMP/ + SJ> 31^ JUM PSJ/ SKI PSJ> P COMP> + 03^ . L/ E> E. L E/ PA/ G E/ N> N. G. ] + +;BOOLEAN + HACK [BOOLE> 24^ ST/ AN> AND B2/ AN/ ST/ AN/ ST/ + X OR> OR B2/ I OR/ AN/ EQ DV2/ ST/ OR/ ST/ OR/ OR/ + ST> SET B2> 24^ Z IMB/ IMB/ CA> C TA/ TM> M IMB/ + CM> C TM/ TA> A IMB/ IMB/ IMB/ CB> C BIMB/ IMB/ CA/ + CA/ CM/ CM/ CB/ O IMB/ ] + +;HALF WORDS + HACK [HWT> 51^ HW1/ 21^ R HW2/ L HW2> R HW3/ HW1> + 21^ L HW4/ R HW4> L HW3> 32^ IMS/ Z IMS/ O IMS/ + EIMS/ ] + +;TEST INST + HACK [ACBM> 31^ AC1/ 01^ D AC2/ S AC2/ AC1> 01^ R AC2/ L + AC2> 42^ N EAN/ Z EAN/ C EAN/ O EAN> 12^ . E/ PA/ N/ ] + +IFN AWRD,AWRD + +subttl command action routines + +NUM: ANDI T,17 ;T HOLDS CHARACTER + TLNE F,CF+FPF + JRST NM1 + MOVEI W,10 + IMULM W,SYL + ADDM T,SYL + MOVEI W,10. ;ALSO MAINTAIN DECIMAL WORD + IMULM W,DEN + ADDM T,DEN +LE1: AOJA T,LE1A ;FOR SQUOZE SYM + +DOLLAR: +PERC: MOVEI T,47+101-13-45(T) ;PERCENT SIGN +LET: TLC F,SF+FPF ;EXPONENT IFF LTF'*FEF'*(T=105)*SF*FPF=1 + TLZN F,LTF+FEF+SF+FPF + CAIE T,"E + TLOA F,LTF + TLOA F,FEF + JRST LET1 + TLZN F,MF + SKIPA W1,SYL + MOVN W1,SYL + MOVEM W1,FSV + CLEARM DEN +LET1: SUBI T,101-13 ;FORM RADIX 50 SYMBOL +LE1A: TLO F,SF+QF +LE2: MOVEI W,50 + EXCH W,TEM(I) + IDIVM W,TEM(I) + IMUL T,TEM(I) + ADDM T,SYM + JRST L2 + +NUM1: EXCH T,WRD2 ;FORM NUMBER AFTER DOLLAR SIGN + IMULI T,10. + ADDM T,WRD2 + TRO F,Q2F + JRST,L2 + +NM1: TLNE F,CF + JRST NUM1 + MOVEI W1,6 ;FORM FLOATING POINT NUMBER + AOS NM1A +NM1A: MOVEI W2,0 + MOVSI R,201400 +NM1A1: TRZE W2,1 + FMPR R,FT(W1) + JUMPE W2,NM1B + LSH W2,-1 + SOJG W1,NM1A1 +NM1B: MOVSI W1,211000(T) + FMPR R,W1 ;COMPUTE VALUE OF NEW DIGIT + FADRB R,FH ;ADD VALUE INTO FLOATING NO. +REPEAT 0,[ ;I THINK THIS HAIRY ROUNDING IS UNNEC. ALSO KL HAS NO "FMPL". + FMPL R,W1 + SKIPN FH + JRST NM1C + LDB W2,[(331000)R] + LDB W1,[(331000)FH] + TLZ R,377000 + SUB W2,W1 + ASHC R,(W2) + ADD S,FL + TLZE S,400000 + AOS R + MOVE W2,FH + TLZ W2,377000 + ADD R,W2 + TLNN R,1000 + SOSA W1 + ASHC R,-1 + FSC R,1(W1) +NM1C: MOVEM R,FH + MOVEM S,FL + JUMPE R,NM1D + TLNE S,200000 + AOS R ; ROUND + TLO R,400 ; NORMALIZE +NM1D: +] ;END REPEAT 0 + MOVEM R,SYL + AOJA T,LE1A + +POWER: TLNN F,FEF + JRST L4 ;NO EXPONENT + CAIE W,PLUS-DDT + CAIN W,MINUS-DDT + TROE F,POWF + TRZA F,POWF + JRST DDT(W) ; E+- + + MOVE W2,DEN + MOVEI W1,FT-1 + TLZE F,MF + MOVEI W1,FT01 + SKIPA T,FSV +POW2: LSH W2,-1 + TRZE W2,1 + FMPR T,(W1) + JUMPE W2,L4 + SOJA W1,POW2 + +PERIOD: MOVE T,LLOC + TLNE F,SF ;SYLLABLE STARTED + MOVE T,DEN + MOVEM T,SYL + TLON F,FPF+SF+QF + MOVEI T,0 + IDIVI T,400 + SKIPE T + TLC T,243000 + TLC W1,233000 + FSC T,0 ;NORMALIZE + FSC W1,0 + FADR T,W1 +REPEAT 0,[ ;I THINK THIS DOUBLE PRECISION IS UNNEC. ALSO KL HAS NO "FADL" + FADL T,W1 + MOVEM W1,FL +] ;END REPEAT 0 + MOVEM T,FH + HLLZS NM1A + MOVEI T,45 ;RADIX 50 PERIOD + JRST LE2 + +QUAN: SKIPA T,LWT(I) ;LAST QUANTITY TYPED +PILOC: MOVEI T, SAVPI +QUAN1: MOVEM T,SYL +QUAN2: TLO F,SF+QF ;WRD,SYL STARTED + TLZ F,CF+CCF + JRST,L2 + +CONTROL: TLOE F,CF + TLO F,CCF + JRST,L2 + +EVAL: MOVE R,PRGM ;LOOK UP SYMBOL +EVAL0: HRLOI W1,37777+DELI ;W1 BITS MUST BE OFF + JRST EVAL3 + +EVAL1: ADD R,[(2)2] ;NEXT SYMBOL +EVAL2: SKIPL R + MOVE R,@JOBSYM ;WRAP AROUND + CAMN R,PRGM ;SKIP UNLESS SCANNED ENTIRE SYMBOL TABLE + POPJ P, ;NO SYMBOL FOUND +EVAL3: MOVE T,(R) + XOR T,SYM + TLNN T,PNAME ;SKIP UNLESS SYMBOL IS PROGRAM NAME + TLOA W1,LOCAL ;PROGRAM NAME, FROM NOW ON IGNORE LOCALS + TDNE T,W1 + JRST EVAL1 ;PROGRAM NAME OR NO MATCH, TRY NEXT + TLNN T,340000 + JRST EVAL1 ;PROGRAM NAME, SKIP IT (CAN HAPPEN IF GOT HERE FROM LOSE1) + MOVE T,1(R) ;GOT IT, RETURN VALUE IN T, SYMBOL TABLE PNTR IN R. + +CPOPJ1: AOS (P) ;FOUND SYMBOL, SKIP +CPOPJ: POPJ P, + + +;BIT 40 - DELETE OUTPUT +; 20 - DELETE INPUT +; 10 - LOCAL +; 04 -GLOBAL +; NO BITS - PROGRAM NAME + +KILL: TLNN F,LTF ;DELETE SYMBOLS + JRST,KILLA + PUSHJ P,EVAL + JRST KILL1 + MOVEI T,DELO_-16. ;DELETE OUTPUT + TLNE F,CCF + MOVEI T,DELI_-16. ;NO INPUT OR OUTPUT + DPB T,[(420200+R)] +KILRET: JRST,RET + +KILLA: TLNN F,QF + TLNN F,CCF + JRST ERR + MOVE R,KILC + MOVEM R,@JOBSYM ;RESTORE INIT SYMS + HRRZM R,ESTU + MOVEM R,PRGM + HRLZI T,DELO+DELI + ANDCAM T,(R) ;GET RID OF DELETE BITS IN INITIAL TABLE + AOBJN R,.+1 + AOBJN R,.-2 + JRST,DD1 + +KILL1: MOVE R,ESTU ;REMOVE UNDEFINED SYMS + JUMPGE R,UNDEF +KILL2: PUSHJ P,EVAL0 + JRST RET + PUSHJ P,REMUN + JRST KILL2 + +REMUN: MOVE S,[(2)2] ;REMOVE ONE UNDEFINED SYM + ADDB S,ESTU + MOVE W,-2(S) + MOVEM W,(R) + MOVE W,-1(S) + MOVEM W,1(R) + POPJ P, + +DS: MOVE R,DSSAV(I) + MOVEI T,DELO_-16. + DPB T,[(420200+R)] + MOVE T,1(R) + PUSHJ P,LOOK + JRST RET + JRST RET + +TAG: TLNE F,CF ;DEFINE SYMBOL AS OPEN REGISTER + JRST SETNAM + MOVE W,LLOCO + HRRZM W,DEFV + TLOE F,FAF + JRST ERR +DEFIN: TLNE F,FAF + TLNN F,LTF + JRST ERR +ADEFIN: PUSHJ P,EVAL + JRST DEF1 + CAMGE R,KILC + JRST DEF2 ;REDEFINE + MOVEI T,DELI_-16. + DPB T,[(420200+R)] +DEF1: MOVN R,[(2)2] + ADDB R,@JOBSYM + HRRZ T,ESTU + SUBI T,2 + HRL T,ESTU + HRRM T,ESTU + SKIPGE ESTU + BLT T,-1(R) +dpy340, PUSHJ P,DISINI +DEF2: MOVE T,DEFV + MOVEM T,1(R) + MOVSI T,GLOBAL + IORB T,SYM + MOVEM T,(R) + MOVE R,ESTU + +DEF3: JUMPGE R,RET ;PATCH IN UNDEFINED SYM + MOVE T,SYM + CAME T,(R) + JRST DEF4 + MOVE S,DEFV + SKIPGE 1(R) + MOVNS S + PUSH P,R + MOVE R,1(R) + PUSHJ P,FETCH + JRST ERR + ADD S,T + HRRM S,T + PUSHJ P,DEP + POP P,R + PUSHJ P,REMUN +DEF4: ADD R,[(2)2] + JRST DEF3 + +;DISK COMMANDS HERE SO NO EVAL ARG + +SWAP,[ +LISTF0: JRST LISTF + +LOAD0: JRST LOAD + +DUMP0: JRST DUMP +];SWAP + +NOSWAP,[ +LISTF0==ERR +LOAD0==ERR +DUMP0==ERR +];NOSWAP + +SETNAM: MOVE R,@JOBSYM +SET2: JUMPGE R,UNDEF + MOVE T,(R) + ADD R,[(2)2] + CAME T,SYM + JRST SET2 + MOVEM R,PRGM + JRST RET + +MULT: TLOA F,PTF+MLF ;* +DIVD: TLO F,DVF+PTF ;SINGLE QUOTE + JRST L1 + +ASSEM: JRST PLUS ;# +MINUS: TLO F,MF +PLUS: TLO F,PTF + JRST LIS2 + +LPRN: CAML P,[(LPDL-32)] + JRST,ERR + PUSH P,F ;RECURSE FOR OPEN PAREN + PUSH P,WRD + PUSH P,FRASE + PUSH P,FRASE1 + AOS,PRNC + JRST,LISA + +INDIRECT: MOVSI W,(@) + IORB W,WRD + TLO F,QF + JRST,LIS2 + +ACCF: TLNN F,COMF + HRRM T,COMWD ;COMMA + MOVE R,T + HLLZS T + + LDB W1,[(331100)WRD] ; Get top 9 bits of opcode + LSH R,27 ; Shift into AC field + CAIN W1,700 ; Old-style IO instruction? + LSH R,1 ; Yes: Shift into device field + +;Used to be: +; LDB W1,[(410300)WRD] +; IDIVI W1,7 +; LSH R,27(W1) + + ADD T,R + ADD T,WRD + TLOE F,COMF +COMWD: HRLI T,. + MOVEM T,WRD + JRST SPACE+1 + +SPACE: TLNE F,QF + TLO F,TIF +SPAC1: TLZ F,MF+PTF + JRST,LIS1 + +RPRN: MOVS T,WRD ;) + SOSGE,PRNC + JRST,ERR + POP P,FRASE1 + POP P,FRASE + POP P,WRD + POP P,F + TLO F,QF + TLNE F,PTF + TLOE F,SF + JRST,RPRN1 + MOVEM T,SYL + JRST,L1RPR +RPRN1: ADDB T,WRD + JRST,L1RPR-1 + +VARRW: SOSA LLOC ;^ +TAB: PUSHJ P,PLOC +LI1B: SOS LLOC + +LINEF: PUSHJ P,DEPRA ;NEXT REGISTER + TLZN F,CF + JRST LI0 +LI1A: MOVE R,PLCR ;MOVE BACK IN RING BUFFER + MOVE T,LOCBF(R) + SOSGE R + MOVEI R,NLEVS-1 + MOVEM R,PLCR + HRRZM T,LLOC + JRST DDT(W) +LI0: PUSHJ P,CRF + AOS T,LLOC +LI1: HRRZM T,LLOC + HRRZM T,LLOCO + PUSHJ P,PAD + MOVEI T,"/ ;SLASH + TLNE F,STF + MOVEI T,"! ;EXCLAMATION MARK + PUSHJ P,TOUT +LI2: TLZ F,ROF + PUSHJ P,LCT + MOVE R,LLOCO + PUSHJ P,FETCH + JRST ERR + TLO F,ROF + TLNE F,STF + JRST DD2 + JRST CONSYM + + +CARR: PUSHJ P,DEPRA + MOVEI W,LI1B-DDT + TLZE F,CF + JRST LI1A + JRST DD1 + +OCON: TROA F,LF1+CF1 ;OPEN AS CONSTANT +OSYM: TRZ F,CF1 ;OPEN SYMBOLICALLY + TROA F,LF1 +SLASH: TLZ F,STF ;TYPE OUT REGISTER + TLZE F,CF ;ALTMODE SLASH SUPPRESSES TYPEOUT + TLO F,STF + TLNE F,QF + PUSHJ P,PLOC ;QUANTITY TYPED +SLAS1: HRRZM T,LLOCO + JRST LI2 + +ICON: TLZE F,CF + JRST IKON + PUSHJ P,DEPRA ;\ + JRST SLAS1 + +PLOC: CAMN T,LLOC + POPJ P, + AOS R,PLCR ;ADVANCE RING POINTER + CAIL R,NLEVS + CLEARB R,PLCR + EXCH T,LLOC + MOVEM T,LOCBF(R) + MOVE T,LLOC + HRRZS LLOC + POPJ P, + +ASLASH: TLNN F,QF + JRST QUESTN + PUSH P,T + MOVEI T,"/ + PUSHJ P,TOUT + POP P,T + JRST SLASH + +IKON: MOVEM T,LWT(I) + PUSHJ P,EFFEC0 + JRST ERR + MOVE R,T + PUSHJ P,FETCH + JRST ERR + JRST OVRD2 + +DEPRA: TLNE F,ROF ;IF REGISTER IS BEING CHANGED + TLNN F,QF ;REMOVE ALL PREVIOUS UNDEFINED + JRST DEPRS ;SYMBOL REFERENCES TO IT + MOVE R,ESTU + MOVEM W1,ESTU +DEPRA2: JUMPGE R,DEPRS + HRRZ W,1(R) + CAMN W,LLOCO + PUSHJ P,REMUN + ADD R,[(2)2] + JRST DEPRA2 + +EQUAL: TROA F,LF1+CF1 ;= +PSYM: TRZ F,CF1 ;@ + TRO F,LF1 + JRST CONSYM + +R50PNT: MOVEM T,LWT(I) ;AMPERSANT + LSH T,-36 + TRZ T,3 + PUSHJ P,TOC + PUSHJ P,TSPC + MOVEI W1,LWT(I) + JRST SPT + +HWRDS: MOVEI R,HLFW-TFLOT ;H +SFLOT: ADDI R,TFLOT-SATP ;F +RATP: ADDI R,SATP-IASCO ;T +ASCSET: ADDI R,IASCO-ISIXO ;" +SIXSET: ADDI R,ISIXO-PIN ;' +SYMBOL: ADDI R,PIN-FTOC ;S +CON: ADDI R,FTOC ;C + JSP W,SET + +RELA: TLZE F,QF ;R + JRST,BASECH + MOVEI R,PADSO-TOC +ABSA: ADDI R,TOC ;A + JSP W,SET + +BASECH: SOJLE T,ERR ;CHANGE RADIX + MOVEI R,1-10.(T) +SDEC: ADDI R,2 ;D +SOCT: ADDI R,10 ;O + JSP W,SET + +SET: MOVEI W,-RELA(W) + IDIVI W,5 + HRRZM R,SCH(W) + JUMPGE F,LIS1 + HRRZM R,SCHM(W) + JRST RET + +GO: HRLI T,(JRST) + TLC F,QF+CCF + TLCN F,QF+CCF + MOVEM T,STARTA + TLOE F,QF + JRST XEC0 + SKIPE T,STARTA + +XEC: TLNN F,QF ;X + JRST ,ERR +XEC0: MOVEM T,TEM + SETZM ALTPC + PUSHJ P,CRF + PUSHJ P,TTYLEV + PUSHJ P,INSRTB +KS,[ ;Compensate for DEC brain death: XCT of JRST 2, gets wrong flags + MOVE T,TEM + LSH T,-33 + CAIE T,JRST_-33 + JRST XECKS + JSP T,RESTORE + JRST TEM + +XECKS: +];KS + JSP T,RESTORE + XCT TEM +XEC1: JRST DDT ;USED BY BCOM + JSR SAVE + PUSHJ P,BRKRET + PUSHJ P,CRF + JRST DD1 + +DQUOTE: TLNE F,CF ;IF ALTMODE TYPED, + JRST DQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;DOUBLE QUOTE + ;DISPATCH ENTRY FOR IN DOUBLEQUOTE MODE +IASCO: SETZM TEM2 + MOVE W1,T + TDNE W1,[-200] ;SKIP IF ONLY ONE CHARACTER IN WORD + JRST TEXO1 + LSH W1,1 ;THEN ASSUME IT'S RIGHT JUSTIFIED +TEXO1: MOVEI T,0 +TEXO10: JUMPE W1,CPOPJ +TEXO11: LSHC T,7 +TEXO12: SKIPN TEM2 + JUMPE T,TEXO1 + SETOM TEM2 + PUSHJ P,TOUT + JRST TEXO1 + +SQUOTE: TLNE F,CF ;IF ALTMODE TYPED + JRST SQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;SINGLE QUOTE + ;DISPATCH ENTRY FOR IN SINGLEQUOTE MODE +ISIXO: MOVE W1,T +SIXO1: MOVEI T,0 + JUMPE W1,CPOPJ + LSHC T,6 + JUMPE T,SIXO1 + ADDI T,40 + PUSHJ P,TOUT + JRST SIXO1 + + ;ENTRY FROM ALTMODE DOUBLEQUOTE +DQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE, + JRST ASCSET ;THEN SET TYPEOUT MODE + MOVSI W1,440700 ;OTHERWISE, DO ASCII TYPEIN + HLLZS SASEM + JRST ISTRING + + ;ENTRY FROM ALTMODE SINGLEQUOTE +SQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE + JRST SIXSET ;THEN SET TYPEOUT MODE + MOVEI W1,40 ;OTHERWISE, DO ASCII TYPEIN + HRRM W1,SASEM + MOVSI W1,440600 + +ISTRING: + MOVE T,WRD2 ;SO 1" DOES RIGHT THING + MOVEM T,TEM +ISTR1: PUSHJ P,IIN + CAIN T,33 + JRST ISTR2 + CAIN T,^Q + PUSHJ P,IN + PUSHJ P,SASEM + JRST ISTR1 + +ISTR2: MOVE T,TEM + SETZM WRD2 + JRST MASK2 + +SASEM: SUBI T,0 ;CLOBBERED TO 0 OR 40 +SASME: HRRI W1,TEM + IDPB T,W1 + POPJ P, + +;ALTMODE V + +DISF: +dpy340,[ + SETCMM DISON ;COMPLEMENT STATUS FLAG + JRST DISINI ;INITIALIZE DISPLAY AND RETURN +];dpy340 +nodpy, POPJ P, + +BP0: REPEAT NBP+1,[ + 0 + JSA T, BCOM + 0 +] +IFN 1PRSW,[ +TBP1: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 1 +TBP2: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 2 +];1PRSW + +BP1=BP0+3 +B1INS=BP1+2 +BPN=.-3 + + ;BREAKPOINT 0 LIKE OTHERS EXCEPT DOESN'T GET CHECKED ON LOC$B OR CLEARED BY $B + +BCOM: 0 + HRRM T,LEAV + MOVEI T,B1SKP-B1INS(T) + HRRM T,BCOM3 ;CONDITIONAL BREAK SETUP + MOVEI T,B1CNT-B1SKP(T) + HRRM T,BCOM2 ;PROCEDE COUNTER SETUP + MOVE T,BP1-B1CNT(T) + HLLM T,LEAV1 ;SAVE FLAGS FOR RESTORING + EXCH T,BCOM ;RESTORE FORMER CONTENTS OF ACCUMULATOR + +BCOM3: SKIPE B1SKP ;ADDRESS MODIFIED, POINTS TO CONDITIONAL BPT INSTRUCTION + XCT @.-1 +BCOM2: SOSG B1CNT ;ADDRESS MODIFIED, POINTS TO COUNT OF CURRENT BPT + JRST BREAK + + MOVEM T,AC0+T + LDB T,[(331100)@LEAV] + CAIL T,264 ;JSR + CAILE T,266 ;JSA,JSP + TRNN T,700 ;UUO + JRST PROC1 + CAIE T,260 ;PUSHJ + CAIN T,256 ;XCT + JRST PROC1 + MOVE T,AC0+T + JRST 2,@LEAV1 ;RESTORE FLAGS AND JUMP TO .+1 + +LEAV: XCT B1INS ;ADDRESS MODIFIED + JRST @BCOM + AOS BCOM + JRST @BCOM + +LEAV1: LEAV + +BREAK: JSR SAVE + PUSHJ P,BRKRET + SOS T,BCOM3 + HRRZS T +IFN 1PRSW, CAIGE T,TB1ADR + PUSHJ P,PADSO + MOVEI T,"> + PUSHJ P,TOUT + SKIPG @BCOM2 + PUSHJ P,TOUT ;TYPE OUT SECOND ">" IF COUNT EXHAUSTED + MOVE T,BCOM + HLLM T, SAVPI + MOVEI T,-1(T) + PUSHJ P,PAD + HRRZ T,@BCOM3 + HRRM T,PROC0 + HLRZ T,@BCOM3 + JUMPE T,BREAK1 + PUSHJ P,LCT + HLRZ T,@BCOM3 + PUSHJ P,PLOC + PUSHJ P,LI1 +BREAK1: HRRZ R,BCOM3 + SUBI R,B1ADR + IDIVI R,3 + MOVEI S,1 + LSH S,1(R) + TDNN S,AUTOPI + JRST RET + PUSHJ P,LISTEN + JRST PROCD1 + JRST RET + +PROCEDE: + SKIPN T,ALTPC ;TURN INTO G? + JRST PROCD0 + MOVEM T,ALTPC1 ;YES + MOVE T,[JRST 2,@ALTPC1] + JRST XEC0 + +PROCD0: TLNN F,QF + MOVEI T,1 ;NO COUNT SPECIFIED, USE 1 + MOVEM T,@BCOM2 ;MOVE TO COUNT OF SPECIFIED BPT + HRRZ R,BCOM3 + PUSHJ P,AUTOP +PROCD1: PUSHJ P,CRF + PUSHJ P,TTYLEV +PROC0: HRRZI R,XEC1 ;ADDRESS MODIFIED + PUSHJ P,FETCH + JRST ERR + MOVEM T,WRD + PUSHJ P,INSRTB + MOVE T,WRD ;BREAKPOINTED INSTRUCTION TO XCT + JRST PROC2 + +PROC1: MOVE T,AC0+T + JSR SAVE + MOVE T,@LEAV +PROC2: MOVE R,BCOM + MOVEI W,100 + MOVEM W,TEM1 + JRST IXCT5 + +IXCT4: MOVEM R,40 + MOVEI R,41 +IXCT: SOSL TEM1 + PUSHJ P,FETCH + JRST BPLUP +IXCT5: MOVEM T,TEM + LSH T,-33 + CAIN T,254 + JRST IXCT6 + HRLZI 17,AC0 + BLT 17,17 + MOVEI T,@TEM + DPB T,[(2700)TEM] + LDB W1,[(270400)TEM] + LDB T,[(331100)TEM] + MOVEI P,PS + CAIN T,260 + JRST, IPUSHJ + + CAIN T,264 + JRST,IJSR + CAIN T,265 + JRST,IJSP + CAIN T,266 + JRST,IJSA + MOVE R,TEM +KA, CAIGE T,100 +KL, CAIGE T,74 ;LPMR,SPM,XCTR,XCTRI +KS, CAIGE T,100 + JRST,IXCT4 + CAIN T,256 + JRST,IXCT + +IXCT6: MOVEI T,TEM + HRRM T,LEAV + MOVEI T,LEAV + JRST,RESTORE + +BPLUP: PUSHJ P,BRKRET + JSR SAVE ;ALWAYS SKIPS +INC1: JSR BP0 ;USED AS "CONSTANT" IN SETTING UP FOR INSERTING BREAKPOINTS + JRST ERR + +IPUSHJ: DPB W1,[(270400)CPUSHP] + CLEARM,TEM3 + MOVE T,TEM + JRST,RESTR1 + +IJSA: MOVE T,BCOM + HRL T,TEM + EXCH T,AC0(W1) + JRST,IJSR2 + +IJSR: MOVE T,BCOM + HLL T,SAVPI +IJSR2: MOVE R,TEM + PUSHJ P,DEP + AOS,TEM +IJSR3: MOVE T,TEM + JRST,RESTORE + +IJSP: MOVE W,BCOM + HLL W,SAVPI + MOVEM W,AC0(W1) + JRST,IJSR3 + +;INSERT BREAKPOINTS + +INSRTB: MOVE S,INC1 +INSRT1: SKIPE R,B1ADR-BP1(S) ;GET C(BADR) IN R + PUSHJ P,FETCH ;GET CONTENTS OF LOC ADDRESSED BY R INTO T + JRST INSRT3 ;LOCATION OUTSIDE OF MEMORY OR BREAKPOINT EMPTY + MOVEM T,B1INS-BP1(S) ;PUT CONTENTS IN BINS + MOVE T,S ;JSR BP + PUSHJ P,DEP ;DEPOSIT T IN LOCATION SPECIFIED BY R +INSRT3: ADDI S,3 + CAMG S,[JSR BPN] + JRST INSRT1 + POPJ P, + +;REMOVE BREAKPOINTS + +REMOVB: MOVEI S,BNADR ;POINTER TO BADR +REMOV1: MOVE T,B1INS-B1ADR(S) ;INSTRUCTION AT BREAKPOINT + SKIPE R,(S) ;IF THERE'S REALLY A BREAKPOINT THERE, + PUSHJ P,DEP ;THEN DEPOSIT INSTRUCTION IN USER'S CORE (SPECIFIED BY R) +REMOV3: SUBI S,3 + CAIL S,B0ADR + JRST REMOV1 +IFN 1PRSW,[ + SETZM TB1ADR ;FLUSH TEMPORARY BREAKS + SETZM TB2ADR +] + POPJ P, + +;ALTMODE B + +BPS: TLZE F,QF + JRST BPS1 ;LOCATION SPECIFIED + TRZE F,Q2F + JRST BPS2 ;REMOVE SPECIFIED BREAKPOINT + MOVE T,[(B1ADR)B1ADR+1] ;REMOVE ALL BREAKPOINTS + CLEARM B1ADR + BLT T,BNADR+2 + JRST DD1 + + ;LOC$B, LOC$NB + +BPS1: TRZN F,Q2F + JRST,BPS3 ;NUMBER NOT TYPED AFTER ALTMODE + MOVE R,T + TRO F,2 ;USED LATER + + ;GET HERE WHEN NUMBER TYPED AFTER ALTMODE + +BPS2: SKIPL T,WRD2 ;BPT # NOT LEGAL... + CAILE T,10 ;IF NOT BETWEEN 0 AND 8 INCLUSIVE + JRST,ERR + IMULI T,3 ;AMOUNT OF STG PER BREAKPOINT + ADDI T,B1ADR-3 ;MAKE T POINT TO STG AREA OF SPECIFIED BREAKPOINT + TRZN F,2 + JRST MASK2 ;LOCATION NOT SPECIFIED, TREAT AS SYM + EXCH R,T ;R NOW IS POINTER TO BP STG AREA, T SPECIFIED LOCATION + JRST BPS5 + + ;LOC$B + +BPS3: MOVEI R,B1ADR +BPS4: HRRZ W,(R) ;GET BPN LOCATION + CAIE W,(T) ;IF SPECIFIED LOCATION, + SKIPN (R) ;OR IF ZERO, + JRST,BPS5 ;THEN USE IT, + ADDI R,3 ;OTHERWISE INCREMENT R TO POINT TO STG OF NEXT BPT + CAIG R,BNADR ;SKIP IF TOO MANY + JRST,BPS4 ;GO LOOK AT NEXT ONE + JRST,ERR ;ALL FULL + +BPS5: MOVEM T,(R) ;SET BP TO SPECIFIED LOCATION (0 MEANS NOT IN USE) + CLEARM,1(R) + CLEARM,2(R) +AUTOP: SUBI R,B1ADR ;NOW MUNG R, + IDIVI R,3 ;INTO BP NUMBER + MOVEI S,1 + LSH S,1(R) ;C(S):=1_<1+BP#> + ANDCAM S,AUTOPI + TLNE F,CCF + IORM S,AUTOPI ;ALTMODE ALTMODE TYPED MEANS BPT ENCOUNTER => TYPE MESSAGE + ;BUT CONTINUE (UNTIL CHARACTER TYPED AT TTY) + POPJ P, + +IFN 1PRSW,[ + +;CONTROL-N + +CTLN: TLZN F,CF + JRST ONEPRO + MOVE T,BCOM + HRLI T,1(T) + TLZE F,QF + MOVE T,WRD ;T HAS TB2ADR,,TB1ADR + HRRZM T,TB1ADR + HLRZM T,TB2ADR + JRST PROCEDE + +ONEPRO: JRST ERR ;NOT HACKED YET +];1PRSW +IFE 1PRSW, CTLN==ERR + +DEPRS: MOVEM T,LWT(I) +DEPR: MOVE R,LLOCO ;QUAN TYPED IN REGIS EXAM + TLZE F,ROF + TLNN F,QF + POPJ P,0 +DEP: TRNN R,777760 + JRST,DEP1 ;BPT LOCATION IS AN ACCUMULATOR + MOVEM T,0(R) + POPJ P,0 +DEP1: MOVEM T,AC0(R) + POPJ P,0 + +FETCH: MOVE T,HIGH + CAIGE T,(R) + POPJ P, + MOVE T,(R) + TRNN R,777760 + MOVE T,AC0(R) + JRST CPOPJ1 + +FIRARG: MOVEM T,DEFV + TLO F,FAF + JRST,ULIM1 +ULIM: TLO F,SAF + HRRZM T,ULIMIT +ULIM1: TLNE F,CF + JRST OVRD + TLNN F,QF + JRST,ERR + JRST,LISB + +LOOK: SETZB W1,S + MOVSI W1,DELI+DELO + MOVE R,PRGM + MOVEM R,PRGM(I) + MOVSI W2,PNAME + SKIPGE T + MOVSI S,400000 + MOVE W,[444400,,ENDT] + MOVEM W,TEM(I) +LEND1A: ILDB W,TEM(I) + MOVEM W,LLUP1 + JRST LLUP1 +ENDT: TDNN W2,(R) + TLO W1,LOCAL + SKIPL R + MOVE R,@JOBSYM + CAMN R,PRGM(I) + TLZA W1,-1 +LLUP: ADD R,[2,,2] +LLUPI1: JRST LLUP1 ;OR TRNA +dpy340,[ + PUSHJ P,DPYSWP + CONSZ DIS,200 + JRST LLUPD +];dpy340 +LLUP1: 0 + JRST LEND1 + CAML T,1(R) + CAML S,1(R) + JRST LLUP + HLRZ W,W1 + TSNN W,(R) + TDNN W2,(R) + JRST LLUP + HRR W1,R + CAMN T,1(R) + JRST SPT + MOVE S,1(R) + JRST LLUP + +dpy340,[ +LLUPD: BLKO DIS,DISPTR + PUSHJ P,RECYC +CJLP1: JRST LLUP1 +];dpy340 + +LEND1: AOS W,TEM(I) + XCT (W) + JRST LEND1A +LOOK1: MOVEM T,TEM(I) + TRNE W1,-1 + SUB T,S + JRST CPOPJ1 + +CONSYM: MOVEM T,LWT(I) +CONSM: TRNN F,LF1 +CONS1: JRST @SCH + TRNE F,CF1 + JRST, FTOC + +PIN: TRZ F,NAF + + PUSHJ P,OPTYPE ; Look it up in the opcode table first + TRNE F,1RF ; Anything typed? + JRST PI3.1 ; Yes: proceed + MOVE T,LWT(I) + TLNN T,777000 ; Opcode 0? + JRST PI3+1 ; Yes: skip this stuff + TLC T,700000 + TLCN T,700000 ; Traditional IO instruction? + JRST INOUT ; Yes: Go do it that way + PUSHJ P,LOOK ; No: look it up + +;Used to be: +; TLC T,700000 +; TLCN T,700000 +; JRST,INOUT +; PUSHJ P,OPTYPE +; MOVSI T,777000 +; AND T,LWT(I) +; JUMPE T,PI3+1 +; TRNN F,1RF +; PUSHJ P,LOOK + +PI3.1: TROA F,NAF + JRST HLFW +PI3: PUSHJ P,TSPC + LDB T,[(270400)LWT(I)] ;AC + JUMPE T,PI4 + PUSHJ P,PAD +PI3A: XCT ",,CRF +PI4: MOVE W1,LWT(I) + MOVEI T,"@ ;AT SIGN + TLNE W1,20 ;CHECK FOR INDIRECT BIT + PUSHJ P,TOUT +PI5: HRRZ T,LWT(I) + LDB W1,[(331100)LWT(I)] + CAIL W1,240 + CAILE W1,247 + PUSHJ P,SPAD + PUSHJ P,PADS3A +PI7: TRZ F,NAF + LDB R,[(220400)LWT(I)] ;INDEX REGISTER CHECK + JUMPE R,PADS1 ;EXIT +PI7.1: XCT "(,CRF + MOVE T,R + PUSHJ P,PAD + MOVEI T,") + JRST,TOUT ;EXIT + +HLFW: TRO F,NAF + HLRZ T,LWT(I) + PUSHJ P,PAD + XCT ",,CRF + XCT ",,CRF + SKIPA T,LWT(I) +SPAD: AOS (P) +PAD: ANDI T,777777 ;PRINT ADDRESS + JRST @AR ;PADSO OR PAD1 +PADSO: JUMPE T,TOC2+1 + PUSHJ P,LOOK +PADS1: POPJ P,0 + MOVE W2,1(W1) + CAIGE T,100 + CAIGE W2,60 + JRST,PADS3 + MOVEM T,TEM(I) + JUMPE W1,PAD1 + PUSHJ P,SPT + XCT "+,CRF +PADS2: HRRZ T,TEM(I) +PAD1: JRST,TOC ;EXIT + +PADS3: MOVE T,TEM(I) +PADS3A: TRNE F,NAF + CAIGE T,776000 + JRST TOC +PADS3B: MOVNM T,TEM(I) +PADS4: XCT "-,CRF + JRST,PADS2 + +INOUT: TDC T,[(,-1)400000] + TDCN T,[(,-1)400000] + JRST PADS3B + HLRZ R,T + CAILE R,(CONO 774,@) + JRST HLFW + AND T,[(700340)] + PUSHJ P,LOOK + JRST,.+2 + JRST,HLFW + PUSHJ P,TSPC + MOVE T,LWT(I) + AND T,[(77400)] +INOUT1: JUMPE T,PI4 ;USED BY "WORD" + PUSHJ P,LOOK ;LOOK FOR DEVICE NUMBER + JRST,PI3A + MOVE T,TEM(I) + LSH T,-30 + PUSHJ P,TOC + JRST,PI3A + +MASK: TLNE F,QF + JRST,MASK1 + MOVEI T,MSK + ;$NB ENTRY (WHERE N SPECIFIED, LOCATION NOT) +MASK2: MOVEI W,1 + MOVEM W,FRASE1 + JRST QUAN1 +MASK1: MOVEM T,MSK + JRST,RET + +OVRD: MOVSI B,-5 +OVRD1: MOVE R,MSKTB(B) + AND R,LWT(I) + TDNN T,MSKTB(B) + IOR T,R + AOBJN B,OVRD1 +OVRD2: CLEARM FRASE + TLZ F,TIF + CLEARM WRD + JRST MASK2 + +MSKTB: 777000,, + 0 17,0 + @ + (17) + ,-1 + +EFFEC: TLO F,LTF + HRRZ T,T +AWORD: SKIPA W,INOUT1 ;JUMPE T, +NWORD: MOVSI W,(JUMPN T,) + HLLM W,SEAR2 + +SEARC: TLZN F,QF + JRST,ERR + SETCAM T,WRD + MOVE T,[EQV T,WRD] + TLNE F,LTF + MOVE T,[JRST SEAR2B] + MOVEM T,SEARMD + MOVSI T,-5 + SETCMM FRASE(T) ;PREVENT TYPEOUT + AOBJN T,.-1 + MOVE T,ULIMIT + TLNE F,SAF + TLO F,QF + PUSHJ P,SETUP1 + PUSHJ P,CRF +SEAR1: TRNN R,777760 ; Looking at ACs? + JRST SEAR1A ; Yes: Be slow + MOVE T,(R) ; No: Be fast +SEAR1B: +SEARMD: EQV T,WRD + AND T,MSK +SEAR2: JUMPE T,SEAR3 ;OR JUMPN T +SEAR2A: TRNN R,77 ; LISTEN every 100 times + JRST SEAR2D +SEAR2E: AOBJN R,SEAR1 ; Loop until LH positive... + TLNE R,-1 ; And just how did that happen? + JRST SEAR1 ; It was already positive +SEAR2C: SETCMM LWT(I) ; Counted up to 0: Done + JRST,DD1 + +SEAR2D: PUSHJ P,LISTEN + JRST SEAR2E + JRST SEAR2C + +SEAR1A: PUSHJ P,FETCH + JRST SEAR2A + JRST SEAR1B +SEAR2B: PUSHJ P,EFFEC0 + JRST SEAR2A + EQV T,WRD + ANDI T,777777 + JRST SEAR2 + +SEAR3: PUSHJ P,FETCH + JRST ERR + MOVEM T,LWT(I) + MOVEM R,TEM2 + MOVEM R,T + HRRZM R,LLOCO + PUSHJ P,PLOC + PUSHJ P,PAD + XCT "/,CRF ;SLASH + PUSHJ P,LCT + MOVE T,LWT(I) + PUSHJ P,CONSYM + PUSHJ P,CRF + SETCMM LWT(I) + SETCMM TEM(I) +SEAR4: MOVE R,TEM2 + JRST, SEAR2D + +EFFEC0: MOVEM R,TEM2 ;CALLED BY SEARCH AND $\ + MOVEI W,100 + MOVEM W,TEM(I) +EFFEC1: MOVE W,T + LDB R,[(220400)T] + JUMPE R,EFFEC2 + HRRZ T,AC0(R) + ADD T,W +EFFEC2: HRR R,T + TLNN W,20 ;INDIRECT BIT CHECK + JRST EFFEC3 + SOSE TEM(I) + PUSHJ P,FETCH + JRST EFFEC4 + JRST EFFEC1 +EFFEC3: AOS (P) +EFFEC4: MOVE R,TEM2 + POPJ P, + +SETUP: TLO F,LTF ;ZERO +SETUP1: MOVEI T,1(T) + TLNN F,QF +SETUP2: HRRZ T,ESTU + HRRM T,ULIMIT + HRRZ R,DEFV + TLNN F,FAF + MOVEI R,0 + CAML R,ULIMIT + JRST ERR + MOVEM R,DEFV + MOVE W,R + SUB W,ULIMIT + HRLM W,R + POPJ P,0 + +ZERO: JUMPGE F,ERR + PUSHJ P,SETUP +ZERO1: TRNE R,777740 ;R AOBJN PNTR TO CORE TO CLEAR + JRST,ZERO2 ;T UPPER LIMIT (LAST LOC TO CLEAR+1) + TRNN R,20 ;DONT Z 20-37 + CLEARM,AC0(R) + AOBJN R,ZERO1 + TLNE R,-1 + JRST ZERO1 + JRST,DD1A +ZERO2: HRRZ S,@JOBSYM ;ONLY CLEAR CORE BELOW SYMBOL TABLE + CAILE T,(S) ;(JUST ASSUME IT'S A MOBY DDT) + MOVEI T,(S) + SETZM (R) + HRLS R + AOS R + BLT R,-1(T) + +; HRRZ S,T +; HRRZ W,@JOBSYM +; CAIL S,(W) +; MOVEI S,(W) +; CAILE S,(R) +; JSP W,ZEROR +; HRRZ R,R +; CAIG R, PS +; MOVEI R, PS +; HRRZ S,T +; CAMLE S, R +; JSP W,ZEROR + JRST,DD1A + +;ZEROR: HRL R,R +; CLEARM,(R) +; ADDI R, 1 +; BLT R, -1(S) +; JRST,(W) + +FTOC: +TOC: HRRZ W1,ODF + CAIN W1,12 + JRST, TOC4 +TOCA: LSHC T,-43 + LSH W1,-1 ;W1=T+1 +TOC1: DIVI T,@ODF + HRLM W1,0(P) +TOC3: JUMPE T,TOC2 + PUSHJ P,TOCA +TOC2: HLRZ T,0(P) + ADDI T,"0 +CJTOUT: JRST,TOUT ;DOES POPJ TO TOC2 OR EXIT + +TOC4: MOVM W1,T + JUMPGE T,TOC5 + XCT "-,CRF +TOC5: MOVEI T,0 + PUSHJ P,TOC1 +TPER: MOVEI T,". + JRST TOUT + +SPT: MOVE T,CJTOUT + MOVEM T,SPTS(I) + MOVE T,0(W1) ;SYMBOL PRINT + MOVEM W1,DSSAV(I) + TLZ T,740000 +SPT1: IDIV T,[50*50*50*50*50] + PUSHJ P,SPT2 + MOVE T,W1 + IMULI T,50 + JUMPN T,SPT1 + POPJ P, + +SPT2: ADDI T,260-1 + CAILE T,271 + ADDI T,301-272 + CAILE T,332 + SUBI T,334-244 + CAIN T,243 + MOVEI T,256 + XCT SPTS(I) + POPJ P, + +BRKRET: PUSHJ P,REMOVB +TTYRET: +dpy340,[ + CONI DIS,T + DPB T,[600,,DRESET] +];dpy340 +IFN LPTP,[ + CONI LPT,T + DPB T,[300,,LPTRST] + SKIPE LPTFLG + CONO LPT,10 +] +TTYRT: MOVEI T,10 +dpy340, MOVSM T,DISDON +ka,[ + CONI TTY,SAVTTY + CONO TTY,400000(T) +];ka +dpy340, PUSHJ P,DISINI + XCT TTYRT +TTY1: +ka,[ + MOVEI W2,40000 ;WAIT FOR LAST CHR TO BE TYPED (SO LOSERS PRGM DOESNT + CONSZ TTY,120 ;GET AN INTERRUPT.. + SOJG W2,.-1 + CONI TTY,W2 + XOR W2,SAVTTY + ANDI W2,10 ;ATTEMPT TO RESTORE STATE OF OUTPUT DONE FLAG + XORM W2,SAVTTY + DATAI TTY,W2 + HRLM W2,SAVTTY + CONO TTY,3400(T) +; CONO TTY,400000(T) ;MORE PDP6 TK KLUDGE WINNAGE +];ka + POPJ P, + +TTYLEV: +dpy340,[ + MOVS T,DISDON + CAIN T,@TTYRT + JRST .+3 +DRESET: CONO DIS,100 + DATAO DIS,[3000] +];dpy340 +IFN LPTP,[ + SKIPE T,LPTRST + CONO LPT,10(T) +] +ka,[ + MOVE T,SAVTTY + ANDI T,17 + TRNN T,10 + TRO T,200 +];ka + JRST TTY1 + +subttl variable area + +WRD: 0 +WRD2: 0 +PRNC: 0 +FRASE: 0 +SYL: 0 +DEN: 0 +ZLWT: 0 +TEM2: 0 +LPTRST: 0 +LPTFLG: 0 +TTYFLG: -1 +ESTU: LOW +ESTUT: LOW +FSV: 0 +FRACT: 0 +FPWR: 0 +FTERM: 0 +FH: 0 +;FL: 0 +SYM: 0 +DEFV: 0 +ULIMIT: 0 +LLOC: 112 ;CURRENT LOCATION +LLOCO: 0 +PLCR: 0 +LOCBF: BLOCK NLEVS + +DIS1: +ACSTG: BLOCK 10 +INST: 0 +LWT: 0 +TEM: 0 +TEM1: 0 +PRGM: -NSYMS+2,,LOW+2 +DSSAV: SYM +OUTSW: 0 +SPTS: JRST TOUT +ALTPC: 0 ;NON-ZERO MEANS ALT-P JUMPS THERE +ALTPC1: 0 + +dpy340,[ +DISSW: MOVE T,@-1(P) +];dpy340 + +SATPP: .+1 +SATPT: 0 + +dpy340,[ +DIS2: +DISACS: BLOCK DIS2-DIS1-6 + SYM + DISAD + JRST TOUT + MOVSI T,(TRNA#CONSZ#CONSO) + .+1 + 0 +];dpy340 + +HIGH: MEMSIZ-1 + +SAVPI: 0 + 1177 +SAVTTY: 0 + +MSK: -1 ;INITIAL MASK FOR WORD SEARCHES +B0ADR: REPEAT 3,0 ;FOR $0B, MUST BE SPECIFIED TO BE USED (NOT SET BY LOC$B, NOT CLEARED BY $B) +B1ADR: 0 +B1SKP: 0 +B1CNT: 0 ;ONE MORE THEN # TIMES TO IGNORE ENCOUNTER OF THIS BPT + +REPEAT NBP*3-3, 0 + +IFN 1PRSW,[ +TB1ADR: 0 ? 0 ? 0 +TB2ADR: 0 ? 0 ? 0 +] +BNADR=.-3 +AUTOPI: 0 ;1_N ON IF LOC$$B TYPED, ON MEANS PRECEED AFTER TYPING BPT MSG, UNTIL CHAR. TYPED AT TTY + +INFORM SAVED ACS AREA,\. ;FOR CRASH XFILE +AC0: BLOCK 17 +AC17: 0 +SWAP,TWENTY: BLOCK LOWFIX-20 ;DON'T MOVE FROM HERE + +SCH: 0 +AR: 0 +ODF: 0 +SCHM: PIN ;THESE 3 LOCATIONS BLT'D INTO PRECEDING 3 LOCATIONS DURING SAVE +ARM: PADSO +ODFM: 10 +SARS: 0 ;NON-ZERO IF STUFF SAVED (USED BY SAVE) +FRASE1: +TEM3: 0 +INSW: 0 + +dpy340,[ +DISCNT: 0 +DISPN1: 0 +];dpy340 + +subttl save + +SAVE: 0 + SKIPN SARS ;IF CRUD NOT ALREADY SAVED, + JRST SAV1 ;THEN GO SAVE IT, + AOS SAVE ;OTHERWISE AOS RETURN POINT, + JRST SAV5 ;AND SAVE MINIMALLY + +SAV1: CONI PRS,SAVPI + CONO PRS,@SAVPI+1 + MOVEM 17,AC17 + HRRZI 17,AC0 + BLT 17,AC0+16 + MOVE T,SAVE + HLLM T,SAVPI +SAV5: SETOM SARS ;INDICATE CRUD SAVED + MOVEI P,PS ;INITIALIZE PDL POINTER + MOVE F,[SCHM,,SCH] + BLT F,ODF + CLEARB F,I ;CLEAR FLAGS AND I + JRST @SAVE + + + ;SEE LOW CODE FOR RESTORE + +TATP: TLZE F,QF + SKIPN T + JRST ERR + MOVEI W,36. + DPB T,[300600,,SATPP] +dpy340, DPB T,[300600,,SATPP+DIS2-DIS1] + IDIV W,T + MOVEM W,SATPC + JRST RATP + +SATP: MOVEI W,44 + DPB W,[360600,,SATPP(I)] + MOVE W,SATPC + MOVEM T,SATPT(I) +SATPL: ILDB T,SATPP(I) + PUSHJ P,TOC + PUSHJ P,TSPC + SOJG W,SATPL + POPJ P, + +SATPC: 0 + +subttl command dispatch table + +BDISP: (301400+R)DISP + (141400+R)DISP + (1400+R)DISP + +DISP: .BYTE 12. +DEFINE ZD A,B,C + A-DDT + B-DDT + -DDT+C +TERMIN + +ZD ERR,ERR,L2 ; +ZD DS,ERR,L2 ;^C,, +ZD LISTF0,ERR,ERR ;,, +ZD TAB,LINEF,ERR ;TAB,LF, +ZD ERR,CARR,CTLN ;FORMF,CR, +ZD ERR,ERR,ERR ;,, +ZD ERR,ERR,ERR ;,, +ZD ERR,L2,L2 ;,, +ZD ERR,ERR,ERR ;,, +ZD CONTROL,ERR,ERR ;,^\,^] +ZD ERR,ERR,SPACE ;^^,^_,SP +ZD DIVD,DQUOTE,ASSEM ;!,",# +ZD DOLLAR,PERC,R50PNT ;$,%,& +ZD SQUOTE,LPRN,RPRN ;',(,) +ZD MULT,PLUS,ACCF ;*,+,, +ZD MINUS,PERIOD,SLASH ;-,.,/ +ZD NUM,NUM,NUM ;0,1,2 +ZD NUM,NUM,NUM ;3,4,5 +ZD NUM,NUM,NUM ;6,7,8 +ZD NUM,TAG,DEFIN ;9,:,; +ZD FIRARG,EQUAL,ULIM ;<,=,> +ZD ASLASH,INDIRECT,ABSA ;?,@,A +ZD BPS,CON,SDEC ;B,C,D +ZD EFFEC,SFLOT,GO ;E,F,G +ZD HWRDS,PILOC,ERR ;H,I,J +ZD KILL,LOAD0,MASK ;K,L,M +ZD NWORD,SOCT,PROCEDE ;N,O,P +ZD QUAN,RELA,SYMBOL ;Q,R,S +ZD TATP,DECDMP,DISF ;T,U,V +ZD AWORD,XEC,DUMP0 ;W,X,Y +ZD ZERO,OCON,ICON ;Z,[,\ +ZD OSYM,VARRW,PSYM ;],^,_ + + .BYTE + +DECDMP: +ka,[ + CONSZ TTY,20 ;ALLOW LAST CHAR TYPED TO APPEAR ON PAPER SO CANT BE CLOBBERED +dpy340, PUSHJ P,DISCFT ;BY IO RESET +nodpy, JRST .-1 +];ka +KL,[ CONSO PAG,600000 ;FLUSH CACHE IF NECC. + JRST MACDMP + SWPUA + CONSZ 200000 + JRST .-1 + CONO PAG,0 +] + JRST MACDMP + +IFIX: SKIPLE T,JOBSYM ;IF JOBSYM POSITIVE, + JRST DDT ;THEN CONTROL SHOULDN'T HAVE COME TO HERE TO BEGIN WITH + MOVE R,(T) ;GET POINTER TO SYMS + JUMPN T,IFIX1 ;JUMP IF SYMS ADDED + MOVE R,KILC ;INITIAL SYMS POINTER + MOVEM R,DDT-2 ;SET UP SYM POINTER + MOVEI T,DDT-2 +IFIX1: HRRZM T,JOBSYM ;INDICATE LOCATION OF SYMS POINTER + HRRZM R,ESTU + HRRZM R,ESTUT + MOVSI T,PNAME + TDNN T,(R) + ADD R,[(2)2] + MOVEM R,PRGM +; CONI TTY,T ;THIS HACK IS FOR THE KNIGHT MULTIPLE TTY KLUDGE ON THE PDP6!! +; ANDI T,170000 ;MAY IT REST IN PEACE +; IORI T,10 +; HRRM T,TTYRT ;CONO TO TTY + JRST DDT + +CONSTANTS + +DDTEND: +INFORM [HIGHEST USED]\.-1 + +END DDT diff --git a/system/ddt.51 b/system/ddt.51 new file mode 100644 index 0000000..08784bd --- /dev/null +++ b/system/ddt.51 @@ -0,0 +1,2739 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +subttl ddt conditional assembly + +define setf text,flg +ifdef flg,.stop +.tag foobar +printc "text +flg=" +.ttymac flag +.ttyflg==.ttyflg+1 +printx/flag +/ +.ttyflg==.ttyflg-1 +ifse flag,YES,flg==1 +ifse flag,NO,flg==0 +ifse flag,Y,flg==1 +ifse flag,N,flg==0 +ifndef flg,flg==flag +termin +ifndef flg,.go foobar +termin + +setf [CPU (0 KA, 1 KI, 2 KL, 3 KS)]cpusw ;KI not supported + define ka + ife cpusw!termin + define ki + ife cpusw-1!termin + define kl + ife cpusw-2!termin + define ks + ife cpusw-3!termin + +setf 340?,dpysw ;0 no display + ;1 340 display + define nodpy + ife dpysw!termin + define dpy340 + ife dpysw-1!termin + +setf Number of disks? (0 no swapping and file system goodies),ndsk + define swap + ifn ndsk!termin + define noswap + ife ndsk!termin + swap,lowlen==2200 ;disk routines take a little extra room + +setf [Type of disk? (0 none, 1 Systems Concepts, 2 RP-10, 3 RH-10)]dsksw + define nodsk + ife dsksw!termin + define scdsk + ife dsksw-1!termin + define rp10 + ife dsksw-2!termin + define rh10 + ife dsksw-3!termin + +ifndef moby, moby==740000 ;256k ddt (memsiz-40000) +ifndef lowlen, lowlen==1000 ;size of low code +setf Old Type Data Products Line Printer?,lptp +;setf [Assemble for MACDMP? (If no, DSKDMP)]mcdmpf +MCDMPF==0 +;setf One Proceed?,1PRSW ;DOESN'T WORK! +1PRSW==0 + +subttl assignments and definitions + +TITLE DDT + +LOC 34000+MOBY + +DDT: + +MEMSIZ=40000+MOBY ;INITIAL $I-2 +NLEVS==7 ;LENGTH OF RING BUFFER OF . + +F=0 ;FLAGS +P=1 ;PUSH DOWN +R=2 ;POINTERS TO TABLES, CORE, ETC. +S=3 +W=4 ;CONTAINS DISPATCH ADDRESS IN WORD ASSEMBLER +T=5 ;TRANSFER DATA +W1=6 +W2=7 +I=10 ;SWAP TYPEOUT VARIABLES BETWEEN DISPLAY AND TTY +A=R +B=S +C=W +D=T + +NBP==10 ;NUMBER OF BREAK POINTS +PRS==4 +LPDL==50 ;MAX LENGTH PUSH DOWN LIST + +KS, .INSRT DSK:SYSTEM;KSDEFS > + + ;GET DEFINITIONS OF DTE20 LOCATIONS IN LOW CORE +KL, .INSRT SYSTEM; EPT > +KL, SWPUA=701540,, ;SWEEP-CACHE INSTRUCTION + +IF2 LOC LOW + + SQUOZE 0,DDT ;initial symbols are for program name "DDT" + -NSYMS,,1 + +NUMSYM==1 +IRP A,,[CLEAR,CLEARI,CLEARM +CLEARB,CONSZ,CONSO,DATAI,DATAO,BLKI,BLKO,CONI,CONO] + SQUOZE 4,A + A + NUMSYM==NUMSYM+1 +TERMIN + +MTC==340 ;magtape control +MTS==344 ;magtape status +PI==004 + +ka,[ +DC0==610 ;THIS STUFF REALLY WANTS TO CONDITONALIZED ON DISK CONTROL +DC1==614 +DPK==604 +DPC==250 + +PTP==100 ;paper tape punch +PTR==104 ;paper tape reader +TTY==120 ;console terminal +LPT==124 ;line printer +DIS==130 ;340 display +DC==200 ;deselection device? +UTC==210 ;dectape control +UTS==214 ;dectape status + +IRP A,,[PI,PTP,PTR,TTY,LPT,DIS,DC,UTC,UTS,DC0,DC1,DPK,MTC,MTS,DPC] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];ka + +kl,[ +PAG==10 ;"PAGER" +CCA==14 ;"CACHE SWEEPER" +TIM==20 ;"TIMER" +MTR==24 ;"METER" +DSK==270 ;RH10 + +IRP A,,[PI,PAG,CCA,TIM,MTR,MTC,MTS,DSK] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];kl + +KS,[ +PAG==10 ; Paging +.RD.==20 ; Read various kludges +.WR.==24 ; Write various kludges + +IRP A,,[PI,PAG,.RD.,.WR.] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];KS + +SWAP,[ SQUOZE 4,$QACT ;DDT'S DISK-ACTIVE FLAG WORDS + QACT + NUMSYM==NUMSYM+1 +] + +DEFINE BUST A + SQUOZE 4,$!A!B + B1ADR+A*3-3 + NUMSYM==NUMSYM+1 + TERMIN + + SQUOZE 4,..START + STARTA + SQUOZE 4,$M + MSK + SQUOZE 4,$I + SAVPI + SQUOZE 4,DDT + DDT + +NUMSYM==NUMSYM+4 + +RADIX 10. +REPEAT NBP+1,BUST \.RPCNT +RADIX 8 + +DEFINE INFORM A,B +IF1,[ PRINTX /A = B +/] + TERMIN + +INFORM [INITIAL SYMS]\NUMSYM*2 + LOC DDT-LOWLEN +LOWCOD: INFORM [LOWCODE]\. + +SWAP,[ +.insrt ddtdsk > +] + +subttl display routines + +dpy340,[ +NREGS=10. +NUMREG=11. + + ;INITIALIZE DISPLAY (CALLED UNCONDITIONALLY WHEN DDT FIRST STARTED UP) + +DISINI: PUSH P,R + SKIPN DISON ;SKIP IF DISPLAY ON + SKIPA R,CJLP1 ;JRST LLUP1 + MOVSI R,(TRNA) + MOVEM R,LLUPI1 + JUMPGE R,DISIN1 ;JUMP IF JUST MUNGED INTO LLUPI1 + ;FOLLOWING CIDING SKIPPED IF DISPLAY OFF + HRRZ T,ESTUT + SUBI T,NUMREG*+3 + HRRM T,DISWD + MOVE R,[REPEAT 6,[35]] + MOVEM R,(T) + HRLI R,(T) + HRRI R,1(T) + BLT R,NUMREG*<2*NREGS+1>-1+1(T) + MOVNI R,NREGS+1 + MOVEM R,DISCNT + PUSHJ P,RECYC + MOVEI T,DISBEG + MOVEM T,DISPDL + SETCM T,.-1 + MOVNM T,DISACS+P +DISIN1: POP P,R + POPJ P, + +DISDON: 0 +DISPTR: 0 ;BLKO POINTER FOR DISPLAY +DISCC: 0 +DISPNR: 0 +DISON: -1 ;DISPLAY FEATURE INITIALLY ON +DISWD: -NUMREG*<2*NREGS+1>,, +DTOC: IDIVI T,8 ;CANT CALL TOC OR TOUT. SCREWS DISPLAY. + HRLM W1,(P) + SKIPE T + PUSHJ P,DTOC + HLRZ T,(P) + ADDI T,"0 + +DISAD: PUSH P,T + ANDI T,177 + CAIL T,40 + CAILE T,132 + JRST DISAD2 +DISAD0: IDPB T,DISPNR + AOS DISCC + HRRI T,-10. + SKIPGE T + MOVEM T,DISCC + JRST POPTJ + + +DISAD2: PUSH P,W1 + CAIL T,40 + CAILE T,140 + JRST DISAD5 + MOVEI W1,36 + IDPB W1,DISPNR + MOVE W1,BLOBS-133(T) + IDPB W1,DISPNR + MOVEI T,35 + POP P,W1 + JRST DISAD0 + +DISAD3: MOVEI T,34 + PUSH P,T + JRST DISAD0 + +DISAD7: PUSHJ P,DISAD3 +DISAD4: MOVNI T,-33 + PUSH P,T + JRST DISAD0 + +DISAD6: MOVEI T,35 + PUSH P,T + JRST DISAD0 + +BLOBS: 53 + 52 + 54 + 46 + 51 + 50 + +DISAD5: PUSHJ P,DIS69 + PUSHJ P,DTOC + PUSHJ P,DIS69 + POP P,W1 + JRST POPTJ + +DIS69: IRP X,,[36,50,35] + MOVEI W1,X + IDPB W1,DISPNR + TERMIN + POPJ P, + DISLP: AOS T,DISCNT + CAILE T,NREGS +DISBEG: MOVNI T,NREGS + MOVEM T,DISCNT + ADDI T,NREGS + IMULI T,NUMREG + ADD T,DISWD + HRLI T,600 + MOVEM T,DISPNR + MOVEM T,DISPN1 + MOVE R,DISCNT + PUSHJ P,DISAD7 + JUMPE R,.+2 + SOJN R,.+2 + PUSHJ P,DISAD4 + MOVE T,DISCNT + ADD T,LLOC + PUSH P,T + PUSHJ P,PAD + XCT "/,CRF + XCT CRF + SKIPG DISCC + JRST .-2 + POP P,R + PUSHJ P,FETCH + JRST DISL1 + PUSHJ P,CONSYM +DISL2: PUSHJ P,DISAD6 + MOVE T,DISPNR + TLNE T,770000 + JRST DISL2 + SUB T,DISPN1 + HRREI T,-NUMREG(T) + JUMPL T,DISL2 + PUSHJ P,CHECK + AOSE DISDON + JRST .-2 + JRST DISLP +DISL1: XCT "-,CRF + JRST DISL2 + DISCFT: SOS (P) + SOS (P) + SKIPN DISON + POPJ P, +DPYSWP: PUSH P,LLUP1 + MOVEI 17,ACSTG(I) + BLT 17,ACSTG+7(I) + XCT DISSW(I) + TLC T,(CONSO#CONSZ) + MOVEM T,LLUPI1 + XORI I,DIS2-DIS1 + MOVSI 17,ACSTG(I) + BLT 17,7 + POP P,LLUP1 + POPJ P, + +CHECK: CONSO DIS,200 + JRST CHECK1 + BLKO DIS,DISPTR + PUSHJ P,RECYC +CHECK1: XCT LLUPI1 ;JRST LLUP1 (IF OFF) OR TRNA (ALWAYS SKIP, VALUE OF WORD NEGATIVE) + JRST DPYSWP + POPJ P, +RECYC: MOVEM T,DISPTR + MOVEI T,40 + SOJG T,. + CONO DIS,100 + DATAO DIS,[20157,,261777] + MOVE T,DISWD + EXCH T,DISPTR + SETOM DISDON + POPJ P, +];dpy340 + +subttl ddt low code + +IIN: PUSHJ P,IN + CAIE T,177 + POPJ P, + JRST ERR + +LCT: PUSHJ P,TSPC + PUSHJ P,TSPC +TSPC: MOVEI T,40 ;SPACE + JRST TOUT + +TYOI: 0 + MOVE T,TYOI + LDB T,[270600+T,,-1] + PUSH P,TYOI + JRST TOUT + +LISTEN: SKIPN INSW + PUSHJ P,TYI + POPJ P, + CAIE T,^B + CAIN T,^E + JRST TYO2 + CAIE T,^V + CAIN T,^W + JRST TYO2 + JRST CPOPJ1 + +IN: SKIPE INSW + JRST @INSW ;ANOTHER IO ROUTINE PROVIDED, USE IT. (IT SHOULD POPJ 1,) + ILDB T,MACCR + JUMPN T,IN2 + SETZM MACCR +dpy340,[ + CONSO TTY,40 + PUSHJ P,DISCFT + PUSHJ P,TYI + JFCL +];dpy340 +nodpy,[ + PUSHJ P,TYI + JRST .-1 +];nodpy + +IN2: CAIE T,175 + CAIN T,176 + MOVEI T,33 + SKIPE OUTSW(I) + JRST @OUTSW(I) + CAIL T,^I + CAILE T,^M + JRST IN3 + SKIPE TTYFLG + POPJ P, + PUSH P,T + MOVEI T,15 + PUSHJ P,TYO2 + MOVEI T,12 + PUSHJ P,TYO2 +POPTJ: POP P,T + POPJ P, + +IN3: PUSHJ P,TYO2 + +LPTR: SKIPN LPTFLG + POPJ P, +IFN LPTP,[ + CAIE T,15 + JRST .+3 + CONO LPT,10 + POPJ P, + PUSH P,T + CAIN T,12 + MOVEI T,440 + CAIN T,14 + MOVEI T,441 + CAIN T,33 + MOVEI T,"$ + SUBI T,40 +dpy340,[ + CONSZ LPT,10 + PUSHJ P,DISCFT +];dpy340 +nodpy,[ + CONSZ LPT,10 + JRST .-1 +];nodpy + DATAO LPT,T + POP P,T +] + POPJ P, + +TOUT: +dpy340,[ + SKIPE DISON ;IF DISPLAY ON, + PUSHJ P,CHECK +];dpy340 +TOUT2: SKIPE OUTSW(I) + JRST @OUTSW(I) + PUSHJ P,LPTR +TYO: SKIPN TTYFLG + POPJ P, +TYO2: CAIL T," ;SPACE + JRST TYO3 + CAIN T,177 + POPJ P, + CAIL T,^I + CAILE T,^M + CAIN T,^G + JRST TYO3 + PUSH P,T + CAIE T,33 + MOVEI T,"^ + CAIN T,33 + MOVEI T,"$ + PUSHJ P,TYO3 + POP P,T + CAIN T,33 + POPJ P, + TRO T,100 + PUSHJ P,TYO3 + TRZ T,100 + POPJ P, + +TYO3: +ka,[ + CONSZ TTY,20 +dpy340, PUSHJ P,DISCFT +nodpy, JRST .-1 + DATAO TTY,T +];ka +kl,[ + PUSH P,T + ANDI T,177 + PUSHJ P,XDTCM + POP P,T +];kl +KS,[ PUSH P,T + ANDI T,177 + TRO T,400 ;Set CTY-char-pending + MOVEM T,8CTYOT ;Store in comm area + CONI T ;Read 8080 + TRO T,80INT ;Hey you! Get this! + CONO (T) ;Interrupt 8080 + SKIPE 8CTYOT ;Wait for completion + JRST .-1 + POP P,T +];KS + POPJ P, + + +TYI: +ka,[ + CONSO TTY,40 + POPJ P, + DATAI TTY,T +];ka +kl,[ + MOVEI T,3400 ;DDT MODE INPUT REQ + PUSHJ P,XDTCM + JUMPE T,CPOPJ ;NOTHING AVAILABLE +];kl + +KS,[ SKIPN T,8CTYIN ;Chars stored here by 8080. + POPJ P, + SETZM 8CTYIN ;Remember to clear it. +];KS + ANDI T,177 + CAIGE T,175 + CAIG T,137 + SKIPA + SUBI T,40 ;UPPERCASIFY + CAIE T,^B + JRST LPTON1 + SETOM LPTFLG +IFN LPTP, CONO LPT,10 +LPTON1: CAIN T,^E + SETZM LPTFLG + CAIN T,^V + SETOM TTYFLG + CAIN T,^W + SETZM TTYFLG + JRST CPOPJ1 + + +kl,[ +XDTCM: SETZM DTEFLG ;SEND ARG IN T TO 11, GET RESPONSE IN T + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE T,DTEF11 + SETZM DTEFLG + POPJ P, +];kl + + +RESTORE:SETOM TEM3 +RESTR1: HRRM T,SAVE + CLEARM SARS + MOVE T,SAVPI + HLLM T,SAVE + ANDI T,177 ;CHANNELS THAT WERE ON + IORI T,2000 ;TURN ON CHANNELS + MOVEM T,SAVPI +RES1: HRLZI 17,AC0 + BLT 17,17 + SKIPL TEM3 +CPUSHP: PUSH BCOM + CONO PRS,@SAVPI + JRST 2,@SAVE + +CRF: JSR 15,TYOI +LF: MOVEI T,12 ;LINE FEED + JRST TOUT + +;FLOATING POINT OUTPUT + +TFLOT: MOVE A,T + JUMPG A,TFL1 + JUMPE A,FP1A + MOVNS A + XCT "-,CRF + TLZE A,400000 + JRST FP1A + +TFL1: TLNN A,400 + XCT "#,CRF ;NOT NORMALIZED + +FP1: MOVEI B,0 + CAMGE A,FT01 + JRST,FP4 + CAML A,FT8 + AOJA B,FP4 +FP1A: MOVEI C,0 + +FP3: MULI A,400 + ASHC B,-243(A) + MOVE A,B + CLEARM,TEM1(I) + PUSHJ P,FP7 + XCT ".,CRF + MOVNI A,10 + ADD A,TEM1(I) + MOVE W1,C +FP3A: MOVE T,W1 + MULI T,12 + PUSHJ P,FP7B + SKIPE,W1 + AOJL A,FP3A + POPJ P, + +FP4: MOVNI C,6 + MOVEI W2,0 +FP4A: ADDI W2,1(W2) + XCT,FCP(B) + SOSA W2 + FMPR A,@FCP+1(B) +FP4B: AOJN C,FP4A + MOVNI B,-2(B) + PUSH P,B + PUSHJ P,FP3 + MOVEI T,105 + PUSHJ P,TOUT + POP P,T + DPB T,[300200,,.+1] + XCT "+,CRF + MOVE A,W2 + +FP7: JUMPE A,FP7A1 + IDIVI A,12 + AOS,TEM1(I) +FP7A: HRLM B,(P) + JUMPE A,FP7A1 + PUSHJ P,FP7 + +FP7A1: HLRZ T,(P) +FP7B: ADDI T,260 + JRST,TOUT + + 1.0^32. + 1.0^16. +FT8: 1.0^8 + 1.0^4 + 1.0^2 + 1.0^1 +FT: 1.0^0 + 1.0^-32. + 1.0^-16. + 1.0^-8 + 1.0^-4 + 1.0^-2 +FT01: 1.0^-1 +FT0=FT01+1 + +FCP: CAMLE A, FT0(C) + CAMGE A, FT(C) + 0, FT0(C) + +PS: BLOCK LPDL + +dpy340,DISPDL: BLOCK LPDL + + INFORM [END OF LOWCODE]\.-1 + +subttl communication with DSKDMP and ITS + +IF1, IFG .-LOWCOD+6-LOWLEN,.ERR LOW CODE DOESN'T FIT, MAKE LOWLEN BIGGER + +LOC DDT-6 + ALTPC ;-6 PLACE WHERE PC TO PROCEED THROUGH IS STORED + -20,,AC0 ;-5 PNTR TO SAVED LOW CORE (ESPECIALLY ACS) +STARTA: 0 ;-4 START ADDRESS +KILC: -NSYMS,,LOW ;-3 INITIAL SYMBOLS PNTR + -NSYMS,,LOW ;-2 ALL SYMBOLS PNTR +JOBSYM: .-1 ;-1 BIT 4.9=1 => SYMBOL TABLE CLOBBERED + ;+0 DDT STARTS HERE + +NSYMS==NUMSYM*2 +LOW=LOWCOD-NSYMS-2 + +IFN MCDMPF, MACDMP=37400+MOBY +.ELSE [ + noswap, MACDMP=37700+MOBY ;FOR DSKDMP + swap, IF2 MACDMP==ERR ;if neither dskdmp nor magdmp +] + +MACCR=37777+MOBY + +subttl flag register assignments + +;LEFT HALF FLAGS +TIF==100000 ;TRUNCATE TO 18 BITS - SET BY SPACE OR COMMA +PTF==100 ; +, -, OR * HAS BEEN TYPED +COMF==200000 ;COMMA FLAG +CTF==400 +SF==4 ;SYLLABLE FLAG +QF==1 ;QUANTITY TYPED IN TO WORD ASSEMBLER + +CF==40 ;ALTMODE TYPED +CCF==400000 ;2 ALTMODES TYPED +MF==2 ;MINUS SIGN TYPED IN +LTF==20 ;LETTER TYPED IN TO CURRENT SYLLABLE +ROF==10 ;REGISTER OPEN FLAG +STF==4000 ;! MODE +FAF==1000 ; < TYPED +SAF==2000 ; > TYPED + +FPF==20000 ; . TYPED IN +FEF==10000 ; E FLAG + +MLF==200 ;*FLAG +DVF==40000 ;DIVIDE FLAG + +;RIGHT HALF FLAGS +1RF==10 +OUTPUT==4 ;OPDECODER FLAGS + +CF1==400 ;OUTPUT 1 REGISTER AS CONSTANT +LF1==2000 ;OUTPUT 1 REGISTER AS FORCED SYMBOLIC OR CONSTANT +Q2F==1 ;NUMBER TYPED AFTER  +SBF==20 +NAF==200 ;NEGATIVE ADDRESSES PERMISSABLE +POWF==4000 ;ARGUMENT FOR EXPONENT COMING +SLL==10000 ;STOP LOOKING FOR LOCALS + +GLOBAL==040000 ;GLOBAL SYMBOL +LOCAL==100000 +PNAME==740000 ;PROGRAM NAME +DELI==200000 ;DELETE INPUT +DELO==400000 ;DELETE OUTPUT + +subttl ddt starts here + +INFORM DDT,\. + + +DDT: CLEARM INSW ;IF C(INSW) .NE. 0 THEN INPUT ROUTINE JRST'S @INSW + CLEARM OUTSW + JSR SAVE ;SAVE PROCESSOR CONDITION + PUSHJ P,BRKRET ;DIDN'T SKIP, PI STATUS AND AC'S WERE SAVED + SKIPGE JOBSYM ;IF SYMTAB MUNGED, + JRST IFIX ;THEN GO FIX IT +DD1A: +dpy340,[ + PUSHJ P,DISINI ;INITIALIZE DISPLAY +] +DD1: TLZ F,ROF ;INDICATE NO REGISTER OPEN + PUSHJ P,CRF ;TYPE CRLF (AND RUN SCOPE IF ON) + MOVE T,[SCHM,,SCH] + BLT T,ODF +DD2: MOVEI P,PS + CLEARM PRNC ;PARENTHESES COUNT +LIS: MOVE T,ESTU + MOVEM T,ESTUT +LISA: TDZ F,[(,-1-ROF-STF)LF1+CF1+SBF+2] ;LEAVE REGISTER OPENED,TYPEOUT SUPPRESSED +LISB: TDZ F,[(,-1-ROF-STF-FAF-SAF)NAF] + CLEARM,WRD +LIS1: CLEARM,FRASE +LIS2: MOVEI T,1 + MOVEM T,FRASE1 + TLZ F,MLF+DVF +L1: TLZ F,CF+CCF+SF+FPF ;TURN OFF CONTROL, SYL, PERIOD FLAG + CLEARM,SYL +L1RPR: CLEARM,SYM + MOVSI T,(50*50*50*50*50*50) + MOVEM T,TEM(I) ;INIT SYMBOL COUNTER + CLEARM,DEN + CLEARM,WRD2 + +L2: PUSHJ P,IN ;PICK UP CHARACTER + TLNE F,CF ;CONTROL FLAG + JRST,L21 + CAIG T,"Z ;Z + CAIGE T,"A ;A + JRST,.+2 + JRST,LET +L21: MOVE R,T + CAIN T,177 + JRST WRONG + CAILE T,"_ + JRST ERR + IDIVI R,3 + LDB W,BDISP(R+1) + CAIGE W,MULT-DDT ;LOCATIONS BEFORE MULT DON'T HAVE ARG EVALUATED + JRST DDT(W) + +L211: MOVE T,SYL + TLZN F,LTF + JRST POWER +L4A: PUSHJ P,EVAL + JRST,UND1 +L4: TLZE F,MF + MOVN T,T + TLNN F,SF + CAIE W,LPRN-DDT + JRST,.+2 + JRST,LPRN + + EXCH T,FRASE1 + TLNN F,DVF + IMULB T,FRASE1 + TLZE F,DVF + IDIVB T,FRASE1 + CAIGE W,ASSEM-DDT + JRST DDT(W) ;MULTIPLY OR DIVIDE + ADDB T,FRASE + CAIGE W,SPACE-DDT + JRST DDT(W) ; + - @ , + + ADD T,WRD + TLNE F,TIF ;TRUNCATE INDICATOR FLAG + HLL T,WRD ;TRUNCATE + MOVEM T,WRD + TLNN F,QF + MOVE T,LWT(I) + CLEARM,R + MOVE W1,ESTUT + CAMN W1,ESTU + JRST L5 + CAILE W,CARR-DDT + JRST ERR +L5: CAIG W,RPRN-DDT + JRST DDT(W) + PUSH P,KILRET + SKIPN PRNC + JRST DDT(W) + +UNDEF: MOVEI T,"U ;U + JRST WRONG1 +ERR: +WRONG: MOVEI T,"? +WRONG1: MOVEI P,PS + PUSHJ P,TOUT +RET: MOVEI P,PS + PUSHJ P,LCT ;COMMON RETURN FOR TAB;,JRST,LIS + JRST DD2 + +UND1: MOVE R,ESTUT ;UNDEFINED SYM ASSEMBLER + PUSHJ P,EVAL2 + CAIN W,ASSEM-DDT + TLNN F,ROF + JRST OPLOOK + LDB T,[(100)PRNC] + JUMPN T,UNDEF + CAIE W,ASSEM-DDT + XCT "#,CRF + MOVN R,[(2)2] + ADDB R,ESTUT +dpy340, PUSHJ P,DISINI + MOVE T,SYM + TLO T,GLOBAL + MOVEM T,(R) + HRRZ T,LLOCO + TLNE F,MF + TLO T,400000 + MOVEM T,1(R) + SETZI T, + JRST L4 + +QUESTN: PUSHJ P,CRF ;LIST UNDEFINED SYMBOLS + MOVE R,ESTU +QUEST1: JUMPGE R,DD1 + MOVE T, (R) + SKIPA W1,ESTU + +QUEST2: ADD W1,[(2)2] + CAME T,(W1) + JRST QUEST2 + +QUEST3: CAME R,W1 + JRST QUEST4 + PUSHJ P,SPT + PUSHJ P,CRF +QUEST4: ADD R,[(2)2] + JRST QUEST1 + +OPLOOK: MOVE T,OPLK1 + MOVEI W1,SYM + MOVE R,[(440700)TXT] + PUSHJ P,SPT+1 +OPLK1: IDPB T,R + +;OPDECODER + +OPEVAL: MOVEM P,SAVPDL + TRZA F,OUTPUT +OPTYPE: TRO F,OUTPUT + LSH T,-27. + MOVEM T,INST(I) + MOVE T,[(440700)TXT] + MOVEM T,CHP +DEC: TRZ F,1RF + CLEARB R,W1 + MOVE W2,BTAB +OPDC1: ILDB T,W2 + CAILE T,40 + CAIL T,73 + SOJGE R,OPDC1 + JUMPG R,OPDC1 + SUBI T,40 + JUMPE T,DECX + JUMPG T,DC2 + DPB T,[(340500)PNTR] + TRZ T,-4 + AOS T + DPB T,[(300600)PNTR] + TRNN F,OUTPUT + JRST DC6 + LDB R,PNTR + JRST OPDC1 + +DC2: HRREI T,-33(T) + JUMPL T,DECT + MOVE W1,T + IDIVI W1,3 + MOVE W2,BTAB(W2) + ADDI W2,(W1) + JRST OPDC1 + +DECT: TRNE F,OUTPUT + JRST O1CZ + ILDB W1,CHP + CAIE W1,133(T) + JRST LOSE + JRST OPDC1 + +DECX: TRNE F,OUTPUT + POPJ P, + ILDB W1,CHP + JUMPE W1,DC7 +LOSE: POP P,R + POP P,W2 + POP P,PNTR + POP P,CHP +LOSE1: AOS R + DPB R,PNTR + LDB R,PNTR + JUMPN R,DC6AA + CAME P,SAVPDL + JRST LOSE + MOVSI T,DELO ;LOOK FOR HALF-KILLED AND DIFFERENT PROGRAMS' LOCALS + IORM T,SYM ;NOTE SETTING DELO HACKS EVAL3+2 TO IGNORE PROGRAM NAMES + PUSHJ P,EVAL + JRST UNDEF ;NOT DEFINED AT ALL + PUSH P,R + PUSHJ P,EVAL1 ;LOOK FOR DUPLICATE INSTANCES + XCT "',CRF ;DIFFERENT PROGRAM SELECTED + CAME R,PRGM + XCT "",CRF ;MULTIPLY DEFINED + POP P,R +LOSE2: MOVEM R,PRGM ;BACK UP TO PRECEDING PROGRAM NAME+2 + SUB R,[2,,2] + MOVE W1,(R) + TLNE W1,PNAME + JRST LOSE2 + JRST L4A ;SELECT APPROPRIATE PROGRAM + +DC6: MOVEI R,0 + DPB R,PNTR +DC6AA: CAMN P,SAVPDL + JRST DC6BB + LDB T,-2(P) + CAME T,(P) + JRST LOSE1 +DC6BB: PUSH P,CHP + PUSH P,PNTR + PUSH P,W2 + PUSH P,R + JRST OPDC1 + +DC7: MOVE P,SAVPDL + MOVE T,INST(I) + LSH T,27. + JRST L4 + +O1CZ: TRO F,1RF + MOVEI T,133(T) + PUSHJ P,TOUT + JRST OPDC1 + +PNTR: INST(I) +CHP: 0 +TXT: BLOCK 2 + +SAVPDL: 0 +BTAB: FOO=44 +REPEAT 3,[(FOO_12.+1400)TBL + FOO=FOO-14 +] + +DEFINE BARF A +AWRD=AWRD+_CC +CC=CC-12. +IFL CC,[AWRD +AWRD=0 +CC=24. +] +CLOC=CLOC+1 +TERMIN + +DEFINE HACK A +IRPS B,D,[A] +Z="D +IFE Z-">,Y!B==CLOC +IF1 IFE Z-"/, BARF 1 +IF2 IFE Z-"/, BARF Y!B+73 +IFE Z-"^,BARF _-1+B&7-1 +IFE *,[ +IRPC Q,,B +Z="Q +IFE Z-".,Z=100 +BARF Z-40 +TERMIN +] +TERMIN +TERMIN + +subttl opcode dispatch table + +TBL: AWRD=0 + CLOC=0 + CC=24. + +KA,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ... BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ .. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/] +];KA + +KL,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ADJ/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + ADJ> 03^ . . . . . ADJSP. . .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] +];KL + +KS,[ +;INITIAL DISPATCH + HACK [63^ . FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ IO/ ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ XCAD/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + XCAD> 03^ . . XCTR/ XCTR/ . ADJSP. . . + XCTR> XCTR 01^ I. .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] + +;ITS KS IO INSTRUCTIONS + HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . + IO0> 12^ . . UMV/ . + UMV> UMOVE 01^ . M/ + IO1> IO2> 12^ IORD/ IOXX/ IOWR/ BLTX/ + IOXX> 01^ IORD/ IOWR> IOWR IOBY/ + IORD> IORD IOBY> 41^ IOIQ/ B IOIQ> 02^ I/ Q. . . + BLTX> 41^ BLTXX/ . BLTXX> BLT 01^ BU. UB.] + +;DEC KS IO INSTRUCTIONS +; HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . +; IO0> 12^ . . UMV/ . +; UMV> UMOVE 01^ . M/ +; IO1> IO2> 03^ TIO/ TIO/ RD IOB/ WR IOB/ BS IOB/ BC IOB/ . . +; TIO> TIO 01^ E IOBP/ N IOBP/ +; IOB> IO IOBP> 41^ . B/ ] + +];KS + +;FWT, FIXED POINT ARITH, MISC. + HACK [HAK> 33^ MV/ MV> MOV MO/ ML/ DV/ SH/ H1/ JP/ + 21^ ADD IMB/ SU BIMB> B IMB> 02^ . I>I. M/ B/ MO> 22^ + EIMS> E IMS/ S IMS/ N IMS/ M IMS> 02^ . I/ M/ S> S. + ML> 21^ I ML1/ ML1> MUL IMB/ DV> 21^ I DV1/ DV1> + DI DV2> V IMB/ H1> 03^ EXC S3/ BL T> T. AO/ AO> AOBJ + AOB/ JRS T/ JFC L/ XC T/ . AOB> 01^ P/ N/ + JP> 03^ PU/ PU> PUSH PUS/ PO/ PO> POP POP/ JSR. + JS P/ JS PA> A. JR PA/ PUS> 01^ J> J.. POP> + 01^ . J/ SH> 02^ A S2/ ROT S1/ L S2> S S3> H S1/ 21^ JFFO. CIR C/ + S1> 21^ . C> C. ] + +;ARITH COMP, SKIP, JUMP + HACK [ACCP> 42^ CA CA1/ SJ/ A JS/ S JS> O 31^ + J COMP/ S COMP/ CA1> 31^ I COMP/ M COMP/ + SJ> 31^ JUM PSJ/ SKI PSJ> P COMP> + 03^ . L/ E> E. L E/ PA/ G E/ N> N. G. ] + +;BOOLEAN + HACK [BOOLE> 24^ ST/ AN> AND B2/ AN/ ST/ AN/ ST/ + X OR> OR B2/ I OR/ AN/ EQ DV2/ ST/ OR/ ST/ OR/ OR/ + ST> SET B2> 24^ Z IMB/ IMB/ CA> C TA/ TM> M IMB/ + CM> C TM/ TA> A IMB/ IMB/ IMB/ CB> C BIMB/ IMB/ CA/ + CA/ CM/ CM/ CB/ O IMB/ ] + +;HALF WORDS + HACK [HWT> 51^ HW1/ 21^ R HW2/ L HW2> R HW3/ HW1> + 21^ L HW4/ R HW4> L HW3> 32^ IMS/ Z IMS/ O IMS/ + EIMS/ ] + +;TEST INST + HACK [ACBM> 31^ AC1/ 01^ D AC2/ S AC2/ AC1> 01^ R AC2/ L + AC2> 42^ N EAN/ Z EAN/ C EAN/ O EAN> 12^ . E/ PA/ N/ ] + +IFN AWRD,AWRD + +subttl command action routines + +NUM: ANDI T,17 ;T HOLDS CHARACTER + TLNE F,CF+FPF + JRST NM1 + MOVEI W,10 + IMULM W,SYL + ADDM T,SYL + MOVEI W,10. ;ALSO MAINTAIN DECIMAL WORD + IMULM W,DEN + ADDM T,DEN +LE1: AOJA T,LE1A ;FOR SQUOZE SYM + +DOLLAR: +PERC: MOVEI T,47+101-13-45(T) ;PERCENT SIGN +LET: TLC F,SF+FPF ;EXPONENT IFF LTF'*FEF'*(T=105)*SF*FPF=1 + TLZN F,LTF+FEF+SF+FPF + CAIE T,"E + TLOA F,LTF + TLOA F,FEF + JRST LET1 + TLZN F,MF + SKIPA W1,SYL + MOVN W1,SYL + MOVEM W1,FSV + CLEARM DEN +LET1: SUBI T,101-13 ;FORM RADIX 50 SYMBOL +LE1A: TLO F,SF+QF +LE2: MOVEI W,50 + EXCH W,TEM(I) + IDIVM W,TEM(I) + IMUL T,TEM(I) + ADDM T,SYM + JRST L2 + +NUM1: EXCH T,WRD2 ;FORM NUMBER AFTER DOLLAR SIGN + IMULI T,10. + ADDM T,WRD2 + TRO F,Q2F + JRST,L2 + +NM1: TLNE F,CF + JRST NUM1 + MOVEI W1,6 ;FORM FLOATING POINT NUMBER + AOS NM1A +NM1A: MOVEI W2,0 + MOVSI R,201400 +NM1A1: TRZE W2,1 + FMPR R,FT(W1) + JUMPE W2,NM1B + LSH W2,-1 + SOJG W1,NM1A1 +NM1B: MOVSI W1,211000(T) + FMPR R,W1 ;COMPUTE VALUE OF NEW DIGIT + FADRB R,FH ;ADD VALUE INTO FLOATING NO. +REPEAT 0,[ ;I THINK THIS HAIRY ROUNDING IS UNNEC. ALSO KL HAS NO "FMPL". + FMPL R,W1 + SKIPN FH + JRST NM1C + LDB W2,[(331000)R] + LDB W1,[(331000)FH] + TLZ R,377000 + SUB W2,W1 + ASHC R,(W2) + ADD S,FL + TLZE S,400000 + AOS R + MOVE W2,FH + TLZ W2,377000 + ADD R,W2 + TLNN R,1000 + SOSA W1 + ASHC R,-1 + FSC R,1(W1) +NM1C: MOVEM R,FH + MOVEM S,FL + JUMPE R,NM1D + TLNE S,200000 + AOS R ; ROUND + TLO R,400 ; NORMALIZE +NM1D: +] ;END REPEAT 0 + MOVEM R,SYL + AOJA T,LE1A + +POWER: TLNN F,FEF + JRST L4 ;NO EXPONENT + CAIE W,PLUS-DDT + CAIN W,MINUS-DDT + TROE F,POWF + TRZA F,POWF + JRST DDT(W) ; E+- + + MOVE W2,DEN + MOVEI W1,FT-1 + TLZE F,MF + MOVEI W1,FT01 + SKIPA T,FSV +POW2: LSH W2,-1 + TRZE W2,1 + FMPR T,(W1) + JUMPE W2,L4 + SOJA W1,POW2 + +PERIOD: MOVE T,LLOC + TLNE F,SF ;SYLLABLE STARTED + MOVE T,DEN + MOVEM T,SYL + TLON F,FPF+SF+QF + MOVEI T,0 + IDIVI T,400 + SKIPE T + TLC T,243000 + TLC W1,233000 + FSC T,0 ;NORMALIZE + FSC W1,0 + FADR T,W1 +REPEAT 0,[ ;I THINK THIS DOUBLE PRECISION IS UNNEC. ALSO KL HAS NO "FADL" + FADL T,W1 + MOVEM W1,FL +] ;END REPEAT 0 + MOVEM T,FH + HLLZS NM1A + MOVEI T,45 ;RADIX 50 PERIOD + JRST LE2 + +QUAN: SKIPA T,LWT(I) ;LAST QUANTITY TYPED +PILOC: MOVEI T, SAVPI +QUAN1: MOVEM T,SYL +QUAN2: TLO F,SF+QF ;WRD,SYL STARTED + TLZ F,CF+CCF + JRST,L2 + +CONTROL: TLOE F,CF + TLO F,CCF + JRST,L2 + +EVAL: MOVE R,PRGM ;LOOK UP SYMBOL +EVAL0: HRLOI W1,37777+DELI ;W1 BITS MUST BE OFF + JRST EVAL3 + +EVAL1: ADD R,[(2)2] ;NEXT SYMBOL +EVAL2: SKIPL R + MOVE R,@JOBSYM ;WRAP AROUND + CAMN R,PRGM ;SKIP UNLESS SCANNED ENTIRE SYMBOL TABLE + POPJ P, ;NO SYMBOL FOUND +EVAL3: MOVE T,(R) + XOR T,SYM + TLNN T,PNAME ;SKIP UNLESS SYMBOL IS PROGRAM NAME + TLOA W1,LOCAL ;PROGRAM NAME, FROM NOW ON IGNORE LOCALS + TDNE T,W1 + JRST EVAL1 ;PROGRAM NAME OR NO MATCH, TRY NEXT + TLNN T,340000 + JRST EVAL1 ;PROGRAM NAME, SKIP IT (CAN HAPPEN IF GOT HERE FROM LOSE1) + MOVE T,1(R) ;GOT IT, RETURN VALUE IN T, SYMBOL TABLE PNTR IN R. + +CPOPJ1: AOS (P) ;FOUND SYMBOL, SKIP +CPOPJ: POPJ P, + + +;BIT 40 - DELETE OUTPUT +; 20 - DELETE INPUT +; 10 - LOCAL +; 04 -GLOBAL +; NO BITS - PROGRAM NAME + +KILL: TLNN F,LTF ;DELETE SYMBOLS + JRST,KILLA + PUSHJ P,EVAL + JRST KILL1 + MOVEI T,DELO_-16. ;DELETE OUTPUT + TLNE F,CCF + MOVEI T,DELI_-16. ;NO INPUT OR OUTPUT + DPB T,[(420200+R)] +KILRET: JRST,RET + +KILLA: TLNN F,QF + TLNN F,CCF + JRST ERR + MOVE R,KILC + MOVEM R,@JOBSYM ;RESTORE INIT SYMS + HRRZM R,ESTU + MOVEM R,PRGM + HRLZI T,DELO+DELI + ANDCAM T,(R) ;GET RID OF DELETE BITS IN INITIAL TABLE + AOBJN R,.+1 + AOBJN R,.-2 + JRST,DD1 + +KILL1: MOVE R,ESTU ;REMOVE UNDEFINED SYMS + JUMPGE R,UNDEF +KILL2: PUSHJ P,EVAL0 + JRST RET + PUSHJ P,REMUN + JRST KILL2 + +REMUN: MOVE S,[(2)2] ;REMOVE ONE UNDEFINED SYM + ADDB S,ESTU + MOVE W,-2(S) + MOVEM W,(R) + MOVE W,-1(S) + MOVEM W,1(R) + POPJ P, + +DS: MOVE R,DSSAV(I) + MOVEI T,DELO_-16. + DPB T,[(420200+R)] + MOVE T,1(R) + PUSHJ P,LOOK + JRST RET + JRST RET + +TAG: TLNE F,CF ;DEFINE SYMBOL AS OPEN REGISTER + JRST SETNAM + MOVE W,LLOCO + HRRZM W,DEFV + TLOE F,FAF + JRST ERR +DEFIN: TLNE F,FAF + TLNN F,LTF + JRST ERR +ADEFIN: PUSHJ P,EVAL + JRST DEF1 + CAMGE R,KILC + JRST DEF2 ;REDEFINE + MOVEI T,DELI_-16. + DPB T,[(420200+R)] +DEF1: MOVN R,[(2)2] + ADDB R,@JOBSYM + HRRZ T,ESTU + SUBI T,2 + HRL T,ESTU + HRRM T,ESTU + SKIPGE ESTU + BLT T,-1(R) +dpy340, PUSHJ P,DISINI +DEF2: MOVE T,DEFV + MOVEM T,1(R) + MOVSI T,GLOBAL + IORB T,SYM + MOVEM T,(R) + MOVE R,ESTU + +DEF3: JUMPGE R,RET ;PATCH IN UNDEFINED SYM + MOVE T,SYM + CAME T,(R) + JRST DEF4 + MOVE S,DEFV + SKIPGE 1(R) + MOVNS S + PUSH P,R + MOVE R,1(R) + PUSHJ P,FETCH + JRST ERR + ADD S,T + HRRM S,T + PUSHJ P,DEP + POP P,R + PUSHJ P,REMUN +DEF4: ADD R,[(2)2] + JRST DEF3 + +;DISK COMMANDS HERE SO NO EVAL ARG + +SWAP,[ +LISTF0: JRST LISTF + +LOAD0: JRST LOAD + +DUMP0: JRST DUMP +];SWAP + +NOSWAP,[ +LISTF0==ERR +LOAD0==ERR +DUMP0==ERR +];NOSWAP + +SETNAM: MOVE R,@JOBSYM +SET2: JUMPGE R,UNDEF + MOVE T,(R) + ADD R,[(2)2] + CAME T,SYM + JRST SET2 + MOVEM R,PRGM + JRST RET + +MULT: TLOA F,PTF+MLF ;* +DIVD: TLO F,DVF+PTF ;SINGLE QUOTE + JRST L1 + +ASSEM: JRST PLUS ;# +MINUS: TLO F,MF +PLUS: TLO F,PTF + JRST LIS2 + +LPRN: CAML P,[(LPDL-32)] + JRST,ERR + PUSH P,F ;RECURSE FOR OPEN PAREN + PUSH P,WRD + PUSH P,FRASE + PUSH P,FRASE1 + AOS,PRNC + JRST,LISA + +INDIRECT: MOVSI W,(@) + IORB W,WRD + TLO F,QF + JRST,LIS2 + +ACCF: TLNN F,COMF + HRRM T,COMWD ;COMMA + MOVE R,T + HLLZS T + + LDB W1,[(331100)WRD] ; Get top 9 bits of opcode + LSH R,27 ; Shift into AC field + CAIN W1,700 ; Old-style IO instruction? + LSH R,1 ; Yes: Shift into device field + +;Used to be: +; LDB W1,[(410300)WRD] +; IDIVI W1,7 +; LSH R,27(W1) + + ADD T,R + ADD T,WRD + TLOE F,COMF +COMWD: HRLI T,. + MOVEM T,WRD + JRST SPACE+1 + +SPACE: TLNE F,QF + TLO F,TIF +SPAC1: TLZ F,MF+PTF + JRST,LIS1 + +RPRN: MOVS T,WRD ;) + SOSGE,PRNC + JRST,ERR + POP P,FRASE1 + POP P,FRASE + POP P,WRD + POP P,F + TLO F,QF + TLNE F,PTF + TLOE F,SF + JRST,RPRN1 + MOVEM T,SYL + JRST,L1RPR +RPRN1: ADDB T,WRD + JRST,L1RPR-1 + +VARRW: SOSA LLOC ;^ +TAB: PUSHJ P,PLOC +LI1B: SOS LLOC + +LINEF: PUSHJ P,DEPRA ;NEXT REGISTER + TLZN F,CF + JRST LI0 +LI1A: MOVE R,PLCR ;MOVE BACK IN RING BUFFER + MOVE T,LOCBF(R) + SOSGE R + MOVEI R,NLEVS-1 + MOVEM R,PLCR + HRRZM T,LLOC + JRST DDT(W) +LI0: PUSHJ P,CRF + AOS T,LLOC +LI1: HRRZM T,LLOC + HRRZM T,LLOCO + PUSHJ P,PAD + MOVEI T,"/ ;SLASH + TLNE F,STF + MOVEI T,"! ;EXCLAMATION MARK + PUSHJ P,TOUT +LI2: TLZ F,ROF + PUSHJ P,LCT + MOVE R,LLOCO + PUSHJ P,FETCH + JRST ERR + TLO F,ROF + TLNE F,STF + JRST DD2 + JRST CONSYM + + +CARR: PUSHJ P,DEPRA + MOVEI W,LI1B-DDT + TLZE F,CF + JRST LI1A + JRST DD1 + +OCON: TROA F,LF1+CF1 ;OPEN AS CONSTANT +OSYM: TRZ F,CF1 ;OPEN SYMBOLICALLY + TROA F,LF1 +SLASH: TLZ F,STF ;TYPE OUT REGISTER + TLZE F,CF ;ALTMODE SLASH SUPPRESSES TYPEOUT + TLO F,STF + TLNE F,QF + PUSHJ P,PLOC ;QUANTITY TYPED +SLAS1: HRRZM T,LLOCO + JRST LI2 + +ICON: TLZE F,CF + JRST IKON + PUSHJ P,DEPRA ;\ + JRST SLAS1 + +PLOC: CAMN T,LLOC + POPJ P, + AOS R,PLCR ;ADVANCE RING POINTER + CAIL R,NLEVS + CLEARB R,PLCR + EXCH T,LLOC + MOVEM T,LOCBF(R) + MOVE T,LLOC + HRRZS LLOC + POPJ P, + +ASLASH: TLNN F,QF + JRST QUESTN + PUSH P,T + MOVEI T,"/ + PUSHJ P,TOUT + POP P,T + JRST SLASH + +IKON: MOVEM T,LWT(I) + PUSHJ P,EFFEC0 + JRST ERR + MOVE R,T + PUSHJ P,FETCH + JRST ERR + JRST OVRD2 + +DEPRA: TLNE F,ROF ;IF REGISTER IS BEING CHANGED + TLNN F,QF ;REMOVE ALL PREVIOUS UNDEFINED + JRST DEPRS ;SYMBOL REFERENCES TO IT + MOVE R,ESTU + MOVEM W1,ESTU +DEPRA2: JUMPGE R,DEPRS + HRRZ W,1(R) + CAMN W,LLOCO + PUSHJ P,REMUN + ADD R,[(2)2] + JRST DEPRA2 + +EQUAL: TROA F,LF1+CF1 ;= +PSYM: TRZ F,CF1 ;@ + TRO F,LF1 + JRST CONSYM + +R50PNT: MOVEM T,LWT(I) ;AMPERSANT + LSH T,-36 + TRZ T,3 + PUSHJ P,TOC + PUSHJ P,TSPC + MOVEI W1,LWT(I) + JRST SPT + +HWRDS: MOVEI R,HLFW-TFLOT ;H +SFLOT: ADDI R,TFLOT-SATP ;F +RATP: ADDI R,SATP-IASCO ;T +ASCSET: ADDI R,IASCO-ISIXO ;" +SIXSET: ADDI R,ISIXO-PIN ;' +SYMBOL: ADDI R,PIN-FTOC ;S +CON: ADDI R,FTOC ;C + JSP W,SET + +RELA: TLZE F,QF ;R + JRST,BASECH + MOVEI R,PADSO-TOC +ABSA: ADDI R,TOC ;A + JSP W,SET + +BASECH: SOJLE T,ERR ;CHANGE RADIX + MOVEI R,1-10.(T) +SDEC: ADDI R,2 ;D +SOCT: ADDI R,10 ;O + JSP W,SET + +SET: MOVEI W,-RELA(W) + IDIVI W,5 + HRRZM R,SCH(W) + JUMPGE F,LIS1 + HRRZM R,SCHM(W) + JRST RET + +GO: HRLI T,(JRST) + TLC F,QF+CCF + TLCN F,QF+CCF + MOVEM T,STARTA + TLOE F,QF + JRST XEC0 + SKIPE T,STARTA + +XEC: TLNN F,QF ;X + JRST ,ERR +XEC0: MOVEM T,TEM + SETZM ALTPC + PUSHJ P,CRF + PUSHJ P,TTYLEV + PUSHJ P,INSRTB +KS,[ ;Compensate for DEC brain death: XCT of JRST 2, gets wrong flags + MOVE T,TEM + LSH T,-33 + CAIE T,JRST_-33 + JRST XECKS + JSP T,RESTORE + JRST TEM + +XECKS: +];KS + JSP T,RESTORE + XCT TEM +XEC1: JRST DDT ;USED BY BCOM + JSR SAVE + PUSHJ P,BRKRET + PUSHJ P,CRF + JRST DD1 + +DQUOTE: TLNE F,CF ;IF ALTMODE TYPED, + JRST DQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;DOUBLE QUOTE + ;DISPATCH ENTRY FOR IN DOUBLEQUOTE MODE +IASCO: SETZM TEM2 + MOVE W1,T + TDNE W1,[-200] ;SKIP IF ONLY ONE CHARACTER IN WORD + JRST TEXO1 + LSH W1,1 ;THEN ASSUME IT'S RIGHT JUSTIFIED +TEXO1: MOVEI T,0 +TEXO10: JUMPE W1,CPOPJ +TEXO11: LSHC T,7 +TEXO12: SKIPN TEM2 + JUMPE T,TEXO1 + SETOM TEM2 + PUSHJ P,TOUT + JRST TEXO1 + +SQUOTE: TLNE F,CF ;IF ALTMODE TYPED + JRST SQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;SINGLE QUOTE + ;DISPATCH ENTRY FOR IN SINGLEQUOTE MODE +ISIXO: MOVE W1,T +SIXO1: MOVEI T,0 + JUMPE W1,CPOPJ + LSHC T,6 + JUMPE T,SIXO1 + ADDI T,40 + PUSHJ P,TOUT + JRST SIXO1 + + ;ENTRY FROM ALTMODE DOUBLEQUOTE +DQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE, + JRST ASCSET ;THEN SET TYPEOUT MODE + MOVSI W1,440700 ;OTHERWISE, DO ASCII TYPEIN + HLLZS SASEM + JRST ISTRING + + ;ENTRY FROM ALTMODE SINGLEQUOTE +SQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE + JRST SIXSET ;THEN SET TYPEOUT MODE + MOVEI W1,40 ;OTHERWISE, DO ASCII TYPEIN + HRRM W1,SASEM + MOVSI W1,440600 + +ISTRING: + MOVE T,WRD2 ;SO 1" DOES RIGHT THING + MOVEM T,TEM +ISTR1: PUSHJ P,IIN + CAIN T,33 + JRST ISTR2 + CAIN T,^Q + PUSHJ P,IN + PUSHJ P,SASEM + JRST ISTR1 + +ISTR2: MOVE T,TEM + SETZM WRD2 + JRST MASK2 + +SASEM: SUBI T,0 ;CLOBBERED TO 0 OR 40 +SASME: HRRI W1,TEM + IDPB T,W1 + POPJ P, + +;ALTMODE V + +DISF: +dpy340,[ + SETCMM DISON ;COMPLEMENT STATUS FLAG + JRST DISINI ;INITIALIZE DISPLAY AND RETURN +];dpy340 +nodpy, POPJ P, + +BP0: REPEAT NBP+1,[ + 0 + JSA T, BCOM + 0 +] +IFN 1PRSW,[ +TBP1: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 1 +TBP2: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 2 +];1PRSW + +BP1=BP0+3 +B1INS=BP1+2 +BPN=.-3 + + ;BREAKPOINT 0 LIKE OTHERS EXCEPT DOESN'T GET CHECKED ON LOC$B OR CLEARED BY $B + +BCOM: 0 + HRRM T,LEAV + MOVEI T,B1SKP-B1INS(T) + HRRM T,BCOM3 ;CONDITIONAL BREAK SETUP + MOVEI T,B1CNT-B1SKP(T) + HRRM T,BCOM2 ;PROCEDE COUNTER SETUP + MOVE T,BP1-B1CNT(T) + HLLM T,LEAV1 ;SAVE FLAGS FOR RESTORING + EXCH T,BCOM ;RESTORE FORMER CONTENTS OF ACCUMULATOR + +BCOM3: SKIPE B1SKP ;ADDRESS MODIFIED, POINTS TO CONDITIONAL BPT INSTRUCTION + XCT @.-1 +BCOM2: SOSG B1CNT ;ADDRESS MODIFIED, POINTS TO COUNT OF CURRENT BPT + JRST BREAK + + MOVEM T,AC0+T + LDB T,[(331100)@LEAV] + CAIL T,264 ;JSR + CAILE T,266 ;JSA,JSP + TRNN T,700 ;UUO + JRST PROC1 + CAIE T,260 ;PUSHJ + CAIN T,256 ;XCT + JRST PROC1 + MOVE T,AC0+T + JRST 2,@LEAV1 ;RESTORE FLAGS AND JUMP TO .+1 + +LEAV: XCT B1INS ;ADDRESS MODIFIED + JRST @BCOM + AOS BCOM + JRST @BCOM + +LEAV1: LEAV + +BREAK: JSR SAVE + PUSHJ P,BRKRET + SOS T,BCOM3 + HRRZS T +IFN 1PRSW, CAIGE T,TB1ADR + PUSHJ P,PADSO + MOVEI T,"> + PUSHJ P,TOUT + SKIPG @BCOM2 + PUSHJ P,TOUT ;TYPE OUT SECOND ">" IF COUNT EXHAUSTED + MOVE T,BCOM + HLLM T, SAVPI + MOVEI T,-1(T) + PUSHJ P,PAD + HRRZ T,@BCOM3 + HRRM T,PROC0 + HLRZ T,@BCOM3 + JUMPE T,BREAK1 + PUSHJ P,LCT + HLRZ T,@BCOM3 + PUSHJ P,PLOC + PUSHJ P,LI1 +BREAK1: HRRZ R,BCOM3 + SUBI R,B1ADR + IDIVI R,3 + MOVEI S,1 + LSH S,1(R) + TDNN S,AUTOPI + JRST RET + PUSHJ P,LISTEN + JRST PROCD1 + JRST RET + +PROCEDE: + SKIPN T,ALTPC ;TURN INTO G? + JRST PROCD0 + MOVEM T,ALTPC1 ;YES + MOVE T,[JRST 2,@ALTPC1] + JRST XEC0 + +PROCD0: TLNN F,QF + MOVEI T,1 ;NO COUNT SPECIFIED, USE 1 + MOVEM T,@BCOM2 ;MOVE TO COUNT OF SPECIFIED BPT + HRRZ R,BCOM3 + PUSHJ P,AUTOP +PROCD1: PUSHJ P,CRF + PUSHJ P,TTYLEV +PROC0: HRRZI R,XEC1 ;ADDRESS MODIFIED + PUSHJ P,FETCH + JRST ERR + MOVEM T,WRD + PUSHJ P,INSRTB + MOVE T,WRD ;BREAKPOINTED INSTRUCTION TO XCT + JRST PROC2 + +PROC1: MOVE T,AC0+T + JSR SAVE + MOVE T,@LEAV +PROC2: MOVE R,BCOM + MOVEI W,100 + MOVEM W,TEM1 + JRST IXCT5 + +IXCT4: MOVEM R,40 + MOVEI R,41 +IXCT: SOSL TEM1 + PUSHJ P,FETCH + JRST BPLUP +IXCT5: MOVEM T,TEM + LSH T,-33 + CAIN T,254 + JRST IXCT6 + HRLZI 17,AC0 + BLT 17,17 + MOVEI T,@TEM + DPB T,[(2700)TEM] + LDB W1,[(270400)TEM] + LDB T,[(331100)TEM] + MOVEI P,PS + CAIN T,260 + JRST, IPUSHJ + + CAIN T,264 + JRST,IJSR + CAIN T,265 + JRST,IJSP + CAIN T,266 + JRST,IJSA + MOVE R,TEM +KA, CAIGE T,100 +KL, CAIGE T,74 ;LPMR,SPM,XCTR,XCTRI +KS, CAIGE T,100 + JRST,IXCT4 + CAIN T,256 + JRST,IXCT + +IXCT6: MOVEI T,TEM + HRRM T,LEAV + MOVEI T,LEAV + JRST,RESTORE + +BPLUP: PUSHJ P,BRKRET + JSR SAVE ;ALWAYS SKIPS +INC1: JSR BP0 ;USED AS "CONSTANT" IN SETTING UP FOR INSERTING BREAKPOINTS + JRST ERR + +IPUSHJ: DPB W1,[(270400)CPUSHP] + CLEARM,TEM3 + MOVE T,TEM + JRST,RESTR1 + +IJSA: MOVE T,BCOM + HRL T,TEM + EXCH T,AC0(W1) + JRST,IJSR2 + +IJSR: MOVE T,BCOM + HLL T,SAVPI +IJSR2: MOVE R,TEM + PUSHJ P,DEP + AOS,TEM +IJSR3: MOVE T,TEM + JRST,RESTORE + +IJSP: MOVE W,BCOM + HLL W,SAVPI + MOVEM W,AC0(W1) + JRST,IJSR3 + +;INSERT BREAKPOINTS + +INSRTB: MOVE S,INC1 +INSRT1: SKIPE R,B1ADR-BP1(S) ;GET C(BADR) IN R + PUSHJ P,FETCH ;GET CONTENTS OF LOC ADDRESSED BY R INTO T + JRST INSRT3 ;LOCATION OUTSIDE OF MEMORY OR BREAKPOINT EMPTY + MOVEM T,B1INS-BP1(S) ;PUT CONTENTS IN BINS + MOVE T,S ;JSR BP + PUSHJ P,DEP ;DEPOSIT T IN LOCATION SPECIFIED BY R +INSRT3: ADDI S,3 + CAMG S,[JSR BPN] + JRST INSRT1 + POPJ P, + +;REMOVE BREAKPOINTS + +REMOVB: MOVEI S,BNADR ;POINTER TO BADR +REMOV1: MOVE T,B1INS-B1ADR(S) ;INSTRUCTION AT BREAKPOINT + SKIPE R,(S) ;IF THERE'S REALLY A BREAKPOINT THERE, + PUSHJ P,DEP ;THEN DEPOSIT INSTRUCTION IN USER'S CORE (SPECIFIED BY R) +REMOV3: SUBI S,3 + CAIL S,B0ADR + JRST REMOV1 +IFN 1PRSW,[ + SETZM TB1ADR ;FLUSH TEMPORARY BREAKS + SETZM TB2ADR +] + POPJ P, + +;ALTMODE B + +BPS: TLZE F,QF + JRST BPS1 ;LOCATION SPECIFIED + TRZE F,Q2F + JRST BPS2 ;REMOVE SPECIFIED BREAKPOINT + MOVE T,[(B1ADR)B1ADR+1] ;REMOVE ALL BREAKPOINTS + CLEARM B1ADR + BLT T,BNADR+2 + JRST DD1 + + ;LOC$B, LOC$NB + +BPS1: TRZN F,Q2F + JRST,BPS3 ;NUMBER NOT TYPED AFTER ALTMODE + MOVE R,T + TRO F,2 ;USED LATER + + ;GET HERE WHEN NUMBER TYPED AFTER ALTMODE + +BPS2: SKIPL T,WRD2 ;BPT # NOT LEGAL... + CAILE T,10 ;IF NOT BETWEEN 0 AND 8 INCLUSIVE + JRST,ERR + IMULI T,3 ;AMOUNT OF STG PER BREAKPOINT + ADDI T,B1ADR-3 ;MAKE T POINT TO STG AREA OF SPECIFIED BREAKPOINT + TRZN F,2 + JRST MASK2 ;LOCATION NOT SPECIFIED, TREAT AS SYM + EXCH R,T ;R NOW IS POINTER TO BP STG AREA, T SPECIFIED LOCATION + JRST BPS5 + + ;LOC$B + +BPS3: MOVEI R,B1ADR +BPS4: HRRZ W,(R) ;GET BPN LOCATION + CAIE W,(T) ;IF SPECIFIED LOCATION, + SKIPN (R) ;OR IF ZERO, + JRST,BPS5 ;THEN USE IT, + ADDI R,3 ;OTHERWISE INCREMENT R TO POINT TO STG OF NEXT BPT + CAIG R,BNADR ;SKIP IF TOO MANY + JRST,BPS4 ;GO LOOK AT NEXT ONE + JRST,ERR ;ALL FULL + +BPS5: MOVEM T,(R) ;SET BP TO SPECIFIED LOCATION (0 MEANS NOT IN USE) + CLEARM,1(R) + CLEARM,2(R) +AUTOP: SUBI R,B1ADR ;NOW MUNG R, + IDIVI R,3 ;INTO BP NUMBER + MOVEI S,1 + LSH S,1(R) ;C(S):=1_<1+BP#> + ANDCAM S,AUTOPI + TLNE F,CCF + IORM S,AUTOPI ;ALTMODE ALTMODE TYPED MEANS BPT ENCOUNTER => TYPE MESSAGE + ;BUT CONTINUE (UNTIL CHARACTER TYPED AT TTY) + POPJ P, + +IFN 1PRSW,[ + +;CONTROL-N + +CTLN: TLZN F,CF + JRST ONEPRO + MOVE T,BCOM + HRLI T,1(T) + TLZE F,QF + MOVE T,WRD ;T HAS TB2ADR,,TB1ADR + HRRZM T,TB1ADR + HLRZM T,TB2ADR + JRST PROCEDE + +ONEPRO: JRST ERR ;NOT HACKED YET +];1PRSW +IFE 1PRSW, CTLN==ERR + +DEPRS: MOVEM T,LWT(I) +DEPR: MOVE R,LLOCO ;QUAN TYPED IN REGIS EXAM + TLZE F,ROF + TLNN F,QF + POPJ P,0 +DEP: TRNN R,777760 + JRST,DEP1 ;BPT LOCATION IS AN ACCUMULATOR + MOVEM T,0(R) + POPJ P,0 +DEP1: MOVEM T,AC0(R) + POPJ P,0 + +FETCH: MOVE T,HIGH + CAIGE T,(R) + POPJ P, + MOVE T,(R) + TRNN R,777760 + MOVE T,AC0(R) + JRST CPOPJ1 + +FIRARG: MOVEM T,DEFV + TLO F,FAF + JRST,ULIM1 +ULIM: TLO F,SAF + HRRZM T,ULIMIT +ULIM1: TLNE F,CF + JRST OVRD + TLNN F,QF + JRST,ERR + JRST,LISB + +LOOK: SETZB W1,S + MOVSI W1,DELI+DELO + MOVE R,PRGM + MOVEM R,PRGM(I) + MOVSI W2,PNAME + SKIPGE T + MOVSI S,400000 + MOVE W,[444400,,ENDT] + MOVEM W,TEM(I) +LEND1A: ILDB W,TEM(I) + MOVEM W,LLUP1 + JRST LLUP1 +ENDT: TDNN W2,(R) + TLO W1,LOCAL + SKIPL R + MOVE R,@JOBSYM + CAMN R,PRGM(I) + TLZA W1,-1 +LLUP: ADD R,[2,,2] +LLUPI1: JRST LLUP1 ;OR TRNA +dpy340,[ + PUSHJ P,DPYSWP + CONSZ DIS,200 + JRST LLUPD +];dpy340 +LLUP1: 0 + JRST LEND1 + CAML T,1(R) + CAML S,1(R) + JRST LLUP + HLRZ W,W1 + TSNN W,(R) + TDNN W2,(R) + JRST LLUP + HRR W1,R + CAMN T,1(R) + JRST SPT + MOVE S,1(R) + JRST LLUP + +dpy340,[ +LLUPD: BLKO DIS,DISPTR + PUSHJ P,RECYC +CJLP1: JRST LLUP1 +];dpy340 + +LEND1: AOS W,TEM(I) + XCT (W) + JRST LEND1A +LOOK1: MOVEM T,TEM(I) + TRNE W1,-1 + SUB T,S + JRST CPOPJ1 + +CONSYM: MOVEM T,LWT(I) +CONSM: TRNN F,LF1 +CONS1: JRST @SCH + TRNE F,CF1 + JRST, FTOC + +PIN: TRZ F,NAF + + PUSHJ P,OPTYPE ; Look it up in the opcode table first + TRNE F,1RF ; Anything typed? + JRST PI3.1 ; Yes: proceed + MOVE T,LWT(I) + TLNN T,777000 ; Opcode 0? + JRST PI3+1 ; Yes: skip this stuff + TLC T,700000 + TLCN T,700000 ; Traditional IO instruction? + JRST INOUT ; Yes: Go do it that way + PUSHJ P,LOOK ; No: look it up + +;Used to be: +; TLC T,700000 +; TLCN T,700000 +; JRST,INOUT +; PUSHJ P,OPTYPE +; MOVSI T,777000 +; AND T,LWT(I) +; JUMPE T,PI3+1 +; TRNN F,1RF +; PUSHJ P,LOOK + +PI3.1: TROA F,NAF + JRST HLFW +PI3: PUSHJ P,TSPC + LDB T,[(270400)LWT(I)] ;AC + JUMPE T,PI4 + PUSHJ P,PAD +PI3A: XCT ",,CRF +PI4: MOVE W1,LWT(I) + MOVEI T,"@ ;AT SIGN + TLNE W1,20 ;CHECK FOR INDIRECT BIT + PUSHJ P,TOUT +PI5: HRRZ T,LWT(I) + LDB W1,[(331100)LWT(I)] + CAIL W1,240 + CAILE W1,247 + PUSHJ P,SPAD + PUSHJ P,PADS3A +PI7: TRZ F,NAF + LDB R,[(220400)LWT(I)] ;INDEX REGISTER CHECK + JUMPE R,PADS1 ;EXIT +PI7.1: XCT "(,CRF + MOVE T,R + PUSHJ P,PAD + MOVEI T,") + JRST,TOUT ;EXIT + +HLFW: TRO F,NAF + HLRZ T,LWT(I) + PUSHJ P,PAD + XCT ",,CRF + XCT ",,CRF + SKIPA T,LWT(I) +SPAD: AOS (P) +PAD: ANDI T,777777 ;PRINT ADDRESS + JRST @AR ;PADSO OR PAD1 +PADSO: JUMPE T,TOC2+1 + PUSHJ P,LOOK +PADS1: POPJ P,0 + MOVE W2,1(W1) + CAIGE T,100 + CAIGE W2,60 + JRST,PADS3 + MOVEM T,TEM(I) + JUMPE W1,PAD1 + PUSHJ P,SPT + XCT "+,CRF +PADS2: HRRZ T,TEM(I) +PAD1: JRST,TOC ;EXIT + +PADS3: MOVE T,TEM(I) +PADS3A: TRNE F,NAF + CAIGE T,776000 + JRST TOC +PADS3B: MOVNM T,TEM(I) +PADS4: XCT "-,CRF + JRST,PADS2 + +INOUT: TDC T,[(,-1)400000] + TDCN T,[(,-1)400000] + JRST PADS3B + HLRZ R,T + CAILE R,(CONO 774,@) + JRST HLFW + AND T,[(700340)] + PUSHJ P,LOOK + JRST,.+2 + JRST,HLFW + PUSHJ P,TSPC + MOVE T,LWT(I) + AND T,[(77400)] +INOUT1: JUMPE T,PI4 ;USED BY "WORD" + PUSHJ P,LOOK ;LOOK FOR DEVICE NUMBER + JRST,PI3A + MOVE T,TEM(I) + LSH T,-30 + PUSHJ P,TOC + JRST,PI3A + +MASK: TLNE F,QF + JRST,MASK1 + MOVEI T,MSK + ;$NB ENTRY (WHERE N SPECIFIED, LOCATION NOT) +MASK2: MOVEI W,1 + MOVEM W,FRASE1 + JRST QUAN1 +MASK1: MOVEM T,MSK + JRST,RET + +OVRD: MOVSI B,-5 +OVRD1: MOVE R,MSKTB(B) + AND R,LWT(I) + TDNN T,MSKTB(B) + IOR T,R + AOBJN B,OVRD1 +OVRD2: CLEARM FRASE + TLZ F,TIF + CLEARM WRD + JRST MASK2 + +MSKTB: 777000,, + 0 17,0 + @ + (17) + ,-1 + +EFFEC: TLO F,LTF + HRRZ T,T +AWORD: SKIPA W,INOUT1 ;JUMPE T, +NWORD: MOVSI W,(JUMPN T,) + HLLM W,SEAR2 + +SEARC: TLZN F,QF + JRST,ERR + SETCAM T,WRD + MOVE T,[EQV T,WRD] + TLNE F,LTF + MOVE T,[JRST SEAR2B] + MOVEM T,SEARMD + MOVSI T,-5 + SETCMM FRASE(T) ;PREVENT TYPEOUT + AOBJN T,.-1 + MOVE T,ULIMIT + TLNE F,SAF + TLO F,QF + PUSHJ P,SETUP1 + PUSHJ P,CRF +SEAR1: TRNN R,777760 ; Looking at ACs? + JRST SEAR1A ; Yes: Be slow + MOVE T,(R) ; No: Be fast +SEAR1B: +SEARMD: EQV T,WRD + AND T,MSK +SEAR2: JUMPE T,SEAR3 ;OR JUMPN T +SEAR2A: TRNN R,77 ; LISTEN every 100 times + JRST SEAR2D +SEAR2E: AOBJN R,SEAR1 ; Loop until LH positive... + TLNE R,-1 ; And just how did that happen? + JRST SEAR1 ; It was already positive +SEAR2C: SETCMM LWT(I) ; Counted up to 0: Done + JRST,DD1 + +SEAR2D: PUSHJ P,LISTEN + JRST SEAR2E + JRST SEAR2C + +SEAR1A: PUSHJ P,FETCH + JRST SEAR2A + JRST SEAR1B +SEAR2B: PUSHJ P,EFFEC0 + JRST SEAR2A + EQV T,WRD + ANDI T,777777 + JRST SEAR2 + +SEAR3: PUSHJ P,FETCH + JRST ERR + MOVEM T,LWT(I) + MOVEM R,TEM2 + MOVEM R,T + HRRZM R,LLOCO + PUSHJ P,PLOC + PUSHJ P,PAD + XCT "/,CRF ;SLASH + PUSHJ P,LCT + MOVE T,LWT(I) + PUSHJ P,CONSYM + PUSHJ P,CRF + SETCMM LWT(I) + SETCMM TEM(I) +SEAR4: MOVE R,TEM2 + JRST, SEAR2D + +EFFEC0: MOVEM R,TEM2 ;CALLED BY SEARCH AND $\ + MOVEI W,100 + MOVEM W,TEM(I) +EFFEC1: MOVE W,T + LDB R,[(220400)T] + JUMPE R,EFFEC2 + HRRZ T,AC0(R) + ADD T,W +EFFEC2: HRR R,T + TLNN W,20 ;INDIRECT BIT CHECK + JRST EFFEC3 + SOSE TEM(I) + PUSHJ P,FETCH + JRST EFFEC4 + JRST EFFEC1 +EFFEC3: AOS (P) +EFFEC4: MOVE R,TEM2 + POPJ P, + +SETUP: TLO F,LTF ;ZERO +SETUP1: MOVEI T,1(T) + TLNN F,QF +SETUP2: HRRZ T,ESTU + HRRM T,ULIMIT + HRRZ R,DEFV + TLNN F,FAF + MOVEI R,0 + CAML R,ULIMIT + JRST ERR + MOVEM R,DEFV + MOVE W,R + SUB W,ULIMIT + HRLM W,R + POPJ P,0 + +ZERO: JUMPGE F,ERR + PUSHJ P,SETUP +ZERO1: TRNE R,777740 ;R AOBJN PNTR TO CORE TO CLEAR + JRST,ZERO2 ;T UPPER LIMIT (LAST LOC TO CLEAR+1) + TRNN R,20 ;DONT Z 20-37 + CLEARM,AC0(R) + AOBJN R,ZERO1 + TLNE R,-1 + JRST ZERO1 + JRST,DD1A +ZERO2: HRRZ S,@JOBSYM ;ONLY CLEAR CORE BELOW SYMBOL TABLE + CAILE T,(S) ;(JUST ASSUME IT'S A MOBY DDT) + MOVEI T,(S) + SETZM (R) + HRLS R + AOS R + BLT R,-1(T) + +; HRRZ S,T +; HRRZ W,@JOBSYM +; CAIL S,(W) +; MOVEI S,(W) +; CAILE S,(R) +; JSP W,ZEROR +; HRRZ R,R +; CAIG R, PS +; MOVEI R, PS +; HRRZ S,T +; CAMLE S, R +; JSP W,ZEROR + JRST,DD1A + +;ZEROR: HRL R,R +; CLEARM,(R) +; ADDI R, 1 +; BLT R, -1(S) +; JRST,(W) + +FTOC: +TOC: HRRZ W1,ODF + CAIN W1,12 + JRST, TOC4 +TOCA: LSHC T,-43 + LSH W1,-1 ;W1=T+1 +TOC1: DIVI T,@ODF + HRLM W1,0(P) +TOC3: JUMPE T,TOC2 + PUSHJ P,TOCA +TOC2: HLRZ T,0(P) + ADDI T,"0 +CJTOUT: JRST,TOUT ;DOES POPJ TO TOC2 OR EXIT + +TOC4: MOVM W1,T + JUMPGE T,TOC5 + XCT "-,CRF +TOC5: MOVEI T,0 + PUSHJ P,TOC1 +TPER: MOVEI T,". + JRST TOUT + +SPT: MOVE T,CJTOUT + MOVEM T,SPTS(I) + MOVE T,0(W1) ;SYMBOL PRINT + MOVEM W1,DSSAV(I) + TLZ T,740000 +SPT1: IDIV T,[50*50*50*50*50] + PUSHJ P,SPT2 + MOVE T,W1 + IMULI T,50 + JUMPN T,SPT1 + POPJ P, + +SPT2: ADDI T,260-1 + CAILE T,271 + ADDI T,301-272 + CAILE T,332 + SUBI T,334-244 + CAIN T,243 + MOVEI T,256 + XCT SPTS(I) + POPJ P, + +BRKRET: PUSHJ P,REMOVB +TTYRET: +dpy340,[ + CONI DIS,T + DPB T,[600,,DRESET] +];dpy340 +IFN LPTP,[ + CONI LPT,T + DPB T,[300,,LPTRST] + SKIPE LPTFLG + CONO LPT,10 +] +TTYRT: MOVEI T,10 +dpy340, MOVSM T,DISDON +ka,[ + CONI TTY,SAVTTY + CONO TTY,400000(T) +];ka +dpy340, PUSHJ P,DISINI + XCT TTYRT +TTY1: +ka,[ + MOVEI W2,40000 ;WAIT FOR LAST CHR TO BE TYPED (SO LOSERS PRGM DOESNT + CONSZ TTY,120 ;GET AN INTERRUPT.. + SOJG W2,.-1 + CONI TTY,W2 + XOR W2,SAVTTY + ANDI W2,10 ;ATTEMPT TO RESTORE STATE OF OUTPUT DONE FLAG + XORM W2,SAVTTY + DATAI TTY,W2 + HRLM W2,SAVTTY + CONO TTY,3400(T) +; CONO TTY,400000(T) ;MORE PDP6 TK KLUDGE WINNAGE +];ka + POPJ P, + +TTYLEV: +dpy340,[ + MOVS T,DISDON + CAIN T,@TTYRT + JRST .+3 +DRESET: CONO DIS,100 + DATAO DIS,[3000] +];dpy340 +IFN LPTP,[ + SKIPE T,LPTRST + CONO LPT,10(T) +] +ka,[ + MOVE T,SAVTTY + ANDI T,17 + TRNN T,10 + TRO T,200 +];ka + JRST TTY1 + +subttl variable area + +WRD: 0 +WRD2: 0 +PRNC: 0 +FRASE: 0 +SYL: 0 +DEN: 0 +ZLWT: 0 +TEM2: 0 +LPTRST: 0 +LPTFLG: 0 +TTYFLG: -1 +ESTU: LOW +ESTUT: LOW +FSV: 0 +FRACT: 0 +FPWR: 0 +FTERM: 0 +FH: 0 +;FL: 0 +SYM: 0 +DEFV: 0 +ULIMIT: 0 +LLOC: 112 ;CURRENT LOCATION +LLOCO: 0 +PLCR: 0 +LOCBF: BLOCK NLEVS + +DIS1: +ACSTG: BLOCK 10 +INST: 0 +LWT: 0 +TEM: 0 +TEM1: 0 +PRGM: -NSYMS+2,,LOW+2 +DSSAV: SYM +OUTSW: 0 +SPTS: JRST TOUT +ALTPC: 0 ;NON-ZERO MEANS ALT-P JUMPS THERE +ALTPC1: 0 + +dpy340,[ +DISSW: MOVE T,@-1(P) +];dpy340 + +SATPP: .+1 +SATPT: 0 + +dpy340,[ +DIS2: +DISACS: BLOCK DIS2-DIS1-6 + SYM + DISAD + JRST TOUT + MOVSI T,(TRNA#CONSZ#CONSO) + .+1 + 0 +];dpy340 + +HIGH: MEMSIZ-1 + +SAVPI: 0 + 1177 +SAVTTY: 0 + +MSK: -1 ;INITIAL MASK FOR WORD SEARCHES +B0ADR: REPEAT 3,0 ;FOR $0B, MUST BE SPECIFIED TO BE USED (NOT SET BY LOC$B, NOT CLEARED BY $B) +B1ADR: 0 +B1SKP: 0 +B1CNT: 0 ;ONE MORE THEN # TIMES TO IGNORE ENCOUNTER OF THIS BPT + +REPEAT NBP*3-3, 0 + +IFN 1PRSW,[ +TB1ADR: 0 ? 0 ? 0 +TB2ADR: 0 ? 0 ? 0 +] +BNADR=.-3 +AUTOPI: 0 ;1_N ON IF LOC$$B TYPED, ON MEANS PRECEED AFTER TYPING BPT MSG, UNTIL CHAR. TYPED AT TTY + +INFORM SAVED ACS AREA,\. ;FOR CRASH XFILE +AC0: BLOCK 17 +AC17: 0 +SWAP,TWENTY: BLOCK LOWFIX-20 ;DON'T MOVE FROM HERE + +SCH: 0 +AR: 0 +ODF: 0 +SCHM: PIN ;THESE 3 LOCATIONS BLT'D INTO PRECEDING 3 LOCATIONS DURING SAVE +ARM: PADSO +ODFM: 10 +SARS: 0 ;NON-ZERO IF STUFF SAVED (USED BY SAVE) +FRASE1: +TEM3: 0 +INSW: 0 + +dpy340,[ +DISCNT: 0 +DISPN1: 0 +];dpy340 + +subttl save + +SAVE: 0 + SKIPN SARS ;IF CRUD NOT ALREADY SAVED, + JRST SAV1 ;THEN GO SAVE IT, + AOS SAVE ;OTHERWISE AOS RETURN POINT, + JRST SAV5 ;AND SAVE MINIMALLY + +SAV1: CONI PRS,SAVPI + CONO PRS,@SAVPI+1 + MOVEM 17,AC17 + HRRZI 17,AC0 + BLT 17,AC0+16 + MOVE T,SAVE + HLLM T,SAVPI +SAV5: SETOM SARS ;INDICATE CRUD SAVED + MOVEI P,PS ;INITIALIZE PDL POINTER + MOVE F,[SCHM,,SCH] + BLT F,ODF + CLEARB F,I ;CLEAR FLAGS AND I + JRST @SAVE + + + ;SEE LOW CODE FOR RESTORE + +TATP: TLZE F,QF + SKIPN T + JRST ERR + MOVEI W,36. + DPB T,[300600,,SATPP] +dpy340, DPB T,[300600,,SATPP+DIS2-DIS1] + IDIV W,T + MOVEM W,SATPC + JRST RATP + +SATP: MOVEI W,44 + DPB W,[360600,,SATPP(I)] + MOVE W,SATPC + MOVEM T,SATPT(I) +SATPL: ILDB T,SATPP(I) + PUSHJ P,TOC + PUSHJ P,TSPC + SOJG W,SATPL + POPJ P, + +SATPC: 0 + +subttl command dispatch table + +BDISP: (301400+R)DISP + (141400+R)DISP + (1400+R)DISP + +DISP: .BYTE 12. +DEFINE ZD A,B,C + A-DDT + B-DDT + -DDT+C +TERMIN + +ZD ERR,ERR,L2 ; +ZD DS,ERR,L2 ;^C,, +ZD LISTF0,ERR,ERR ;,, +ZD TAB,LINEF,ERR ;TAB,LF, +ZD ERR,CARR,CTLN ;FORMF,CR, +ZD ERR,ERR,ERR ;,, +ZD ERR,ERR,ERR ;,, +ZD ERR,L2,L2 ;,, +ZD ERR,ERR,ERR ;,, +ZD CONTROL,ERR,ERR ;,^\,^] +ZD ERR,ERR,SPACE ;^^,^_,SP +ZD DIVD,DQUOTE,ASSEM ;!,",# +ZD DOLLAR,PERC,R50PNT ;$,%,& +ZD SQUOTE,LPRN,RPRN ;',(,) +ZD MULT,PLUS,ACCF ;*,+,, +ZD MINUS,PERIOD,SLASH ;-,.,/ +ZD NUM,NUM,NUM ;0,1,2 +ZD NUM,NUM,NUM ;3,4,5 +ZD NUM,NUM,NUM ;6,7,8 +ZD NUM,TAG,DEFIN ;9,:,; +ZD FIRARG,EQUAL,ULIM ;<,=,> +ZD ASLASH,INDIRECT,ABSA ;?,@,A +ZD BPS,CON,SDEC ;B,C,D +ZD EFFEC,SFLOT,GO ;E,F,G +ZD HWRDS,PILOC,ERR ;H,I,J +ZD KILL,LOAD0,MASK ;K,L,M +ZD NWORD,SOCT,PROCEDE ;N,O,P +ZD QUAN,RELA,SYMBOL ;Q,R,S +ZD TATP,DECDMP,DISF ;T,U,V +ZD AWORD,XEC,DUMP0 ;W,X,Y +ZD ZERO,OCON,ICON ;Z,[,\ +ZD OSYM,VARRW,PSYM ;],^,_ + + .BYTE + +DECDMP: +ka,[ + CONSZ TTY,20 ;ALLOW LAST CHAR TYPED TO APPEAR ON PAPER SO CANT BE CLOBBERED +dpy340, PUSHJ P,DISCFT ;BY IO RESET +nodpy, JRST .-1 +];ka +KL,[ CONSO PAG,600000 ;FLUSH CACHE IF NECC. + JRST MACDMP + SWPUA + CONSZ 200000 + JRST .-1 + CONO PAG,0 +] + JRST MACDMP + +IFIX: SKIPLE T,JOBSYM ;IF JOBSYM POSITIVE, + JRST DDT ;THEN CONTROL SHOULDN'T HAVE COME TO HERE TO BEGIN WITH + MOVE R,(T) ;GET POINTER TO SYMS + JUMPN T,IFIX1 ;JUMP IF SYMS ADDED + MOVE R,KILC ;INITIAL SYMS POINTER + MOVEM R,DDT-2 ;SET UP SYM POINTER + MOVEI T,DDT-2 +IFIX1: HRRZM T,JOBSYM ;INDICATE LOCATION OF SYMS POINTER + HRRZM R,ESTU + HRRZM R,ESTUT + MOVSI T,PNAME + TDNN T,(R) + ADD R,[(2)2] + MOVEM R,PRGM +; CONI TTY,T ;THIS HACK IS FOR THE KNIGHT MULTIPLE TTY KLUDGE ON THE PDP6!! +; ANDI T,170000 ;MAY IT REST IN PEACE +; IORI T,10 +; HRRM T,TTYRT ;CONO TO TTY + JRST DDT + +CONSTANTS + +DDTEND: +INFORM [HIGHEST USED]\.-1 + +END DDT diff --git a/system/ddt.68 b/system/ddt.68 new file mode 100644 index 0000000..868df3a --- /dev/null +++ b/system/ddt.68 @@ -0,0 +1,2864 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +subttl ddt conditional assembly + +define setf text,flg +ifdef flg,.stop +.tag foobar +printc "text +flg=" +.ttymac flag +.ttyflg==.ttyflg+1 +printx/flag +/ +.ttyflg==.ttyflg-1 +ifse flag,YES,flg==1 +ifse flag,NO,flg==0 +ifse flag,Y,flg==1 +ifse flag,N,flg==0 +ifndef flg,flg==flag +termin +ifndef flg,.go foobar +termin + +setf [CPU (0 KA, 1 KI, 2 KL, 3 KS, 4 TS)]cpusw ;KI not supported + define ka + ife cpusw!termin + define ki + ife cpusw-1!termin + define kl + ife cpusw-2!termin + define ks + ife cpusw-3!termin + define ts + ife cpusw-4!termin + define nts + ifn cpusw-4!termin + define tks + ife *!termin + +dpysw==:0 ; Obsolete +setf 340?,dpysw ;0 no display + ;1 340 display + define nodpy + ife dpysw!termin + define dpy340 + ife dpysw-1!termin + +TKS, ndsk==:0 ? dsksw==:0 ; No disk code for TS or KS version + +setf Number of disks? (0 no swapping and file system goodies),ndsk + define swap + ifn ndsk!termin + define noswap + ife ndsk!termin + swap,lowlen==2200 ;disk routines take a little extra room + +setf [Type of disk? (0 none, 1 Systems Concepts, 2 RP-10, 3 RH-10)]dsksw + define nodsk + ife dsksw!termin + define scdsk + ife dsksw-1!termin + define rp10 + ife dsksw-2!termin + define rh10 + ife dsksw-3!termin + +ifndef moby, moby==740000 ;256k ddt (memsiz-40000) +ifndef lowlen, lowlen==1000 ;size of low code + +lptp==:0 ; Obsolete +setf Old Type Data Products Line Printer?,lptp + +MCDMPF==:0 ; Obsolete +setf [Assemble for MACDMP? (If no, DSKDMP)]mcdmpf + +TKS, SETF New One Proceed? (Using 1-proceed microcode),KS1PR +IFNDEF KS1PR, KS1PR==:0 + +IFN KS1PR, 1PRSW==:0 ; Only one kind of one proceed please +1PRSW==:0 ; DOESN'T WORK! +setf Old One Proceed?,1PRSW + +subttl assignments and definitions + +TITLE DDT + +LOC 34000+MOBY + +DDT: + +MEMSIZ=40000+MOBY ;INITIAL $I-2 +NLEVS==7 ;LENGTH OF RING BUFFER OF . + +F=0 ;FLAGS +P=1 ;PUSH DOWN +R=2 ;POINTERS TO TABLES, CORE, ETC. +S=3 +W=4 ;CONTAINS DISPATCH ADDRESS IN WORD ASSEMBLER +T=5 ;TRANSFER DATA +W1=6 +W2=7 +I=10 ;SWAP TYPEOUT VARIABLES BETWEEN DISPLAY AND TTY +A=R +B=S +C=W +D=T + +NBP==10 ;NUMBER OF BREAK POINTS +PRS==4 +LPDL==50 ;MAX LENGTH PUSH DOWN LIST + +TS, CHTTYI==:1 ? CHTTYO==:2 + +TKS, .INSRT DSK:SYSTEM;KSDEFS > + + ;GET DEFINITIONS OF DTE20 LOCATIONS IN LOW CORE +KL, .INSRT SYSTEM; EPT > +KL, SWPUA=701540,, ;SWEEP-CACHE INSTRUCTION + +IF2 LOC LOW + + SQUOZE 0,DDT ;initial symbols are for program name "DDT" + -NSYMS,,1 + +NUMSYM==1 +IRP A,,[CLEAR,CLEARI,CLEARM +CLEARB,CONSZ,CONSO,DATAI,DATAO,BLKI,BLKO,CONI,CONO] + SQUOZE 4,A + A + NUMSYM==NUMSYM+1 +TERMIN + +MTC==340 ;magtape control +MTS==344 ;magtape status +PI==004 + +ka,[ +DC0==610 ;THIS STUFF REALLY WANTS TO CONDITONALIZED ON DISK CONTROL +DC1==614 +DPK==604 +DPC==250 + +PTP==100 ;paper tape punch +PTR==104 ;paper tape reader +TTY==120 ;console terminal +LPT==124 ;line printer +DIS==130 ;340 display +DC==200 ;deselection device? +UTC==210 ;dectape control +UTS==214 ;dectape status + +IRP A,,[PI,PTP,PTR,TTY,LPT,DIS,DC,UTC,UTS,DC0,DC1,DPK,MTC,MTS,DPC] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];ka + +kl,[ +PAG==10 ;"PAGER" +CCA==14 ;"CACHE SWEEPER" +TIM==20 ;"TIMER" +MTR==24 ;"METER" +DSK==270 ;RH10 + +IRP A,,[PI,PAG,CCA,TIM,MTR,MTC,MTS,DSK] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];kl + +TKS,[ +PAG==10 ; Paging +.RD.==20 ; Read various kludges +.WR.==24 ; Write various kludges + +IRP A,,[PI,PAG,.RD.,.WR.] + SQUOZE 4,A + -BLKI + NUMSYM==NUMSYM+1 + TERMIN +];TKS + +SWAP,[ SQUOZE 4,$QACT ;DDT'S DISK-ACTIVE FLAG WORDS + QACT + NUMSYM==NUMSYM+1 +] + +DEFINE BUST A + SQUOZE 4,$!A!B + B1ADR+A*3-3 + NUMSYM==NUMSYM+1 + TERMIN + + SQUOZE 4,..START + STARTA + SQUOZE 4,$M + MSK + SQUOZE 4,$I + SAVPI + SQUOZE 4,DDT + DDT + +NUMSYM==NUMSYM+4 + +RADIX 10. +REPEAT NBP+1,BUST \.RPCNT +RADIX 8 + +DEFINE INFORM A,B +IF1,[ PRINTX /A = B +/] + TERMIN + +INFORM [INITIAL SYMS]\NUMSYM*2 + LOC DDT-LOWLEN +LOWCOD: INFORM [LOWCODE]\. + +SWAP,[ +.insrt ddtdsk > +] + +subttl display routines + +dpy340,[ +NREGS=10. +NUMREG=11. + + ;INITIALIZE DISPLAY (CALLED UNCONDITIONALLY WHEN DDT FIRST STARTED UP) + +DISINI: PUSH P,R + SKIPN DISON ;SKIP IF DISPLAY ON + SKIPA R,CJLP1 ;JRST LLUP1 + MOVSI R,(TRNA) + MOVEM R,LLUPI1 + JUMPGE R,DISIN1 ;JUMP IF JUST MUNGED INTO LLUPI1 + ;FOLLOWING CIDING SKIPPED IF DISPLAY OFF + HRRZ T,ESTUT + SUBI T,NUMREG*+3 + HRRM T,DISWD + MOVE R,[REPEAT 6,[35]] + MOVEM R,(T) + HRLI R,(T) + HRRI R,1(T) + BLT R,NUMREG*<2*NREGS+1>-1+1(T) + MOVNI R,NREGS+1 + MOVEM R,DISCNT + PUSHJ P,RECYC + MOVEI T,DISBEG + MOVEM T,DISPDL + SETCM T,.-1 + MOVNM T,DISACS+P +DISIN1: POP P,R + POPJ P, + +DISDON: 0 +DISPTR: 0 ;BLKO POINTER FOR DISPLAY +DISCC: 0 +DISPNR: 0 +DISON: -1 ;DISPLAY FEATURE INITIALLY ON +DISWD: -NUMREG*<2*NREGS+1>,, +DTOC: IDIVI T,8 ;CANT CALL TOC OR TOUT. SCREWS DISPLAY. + HRLM W1,(P) + SKIPE T + PUSHJ P,DTOC + HLRZ T,(P) + ADDI T,"0 + +DISAD: PUSH P,T + ANDI T,177 + CAIL T,40 + CAILE T,132 + JRST DISAD2 +DISAD0: IDPB T,DISPNR + AOS DISCC + HRRI T,-10. + SKIPGE T + MOVEM T,DISCC + JRST POPTJ + + +DISAD2: PUSH P,W1 + CAIL T,40 + CAILE T,140 + JRST DISAD5 + MOVEI W1,36 + IDPB W1,DISPNR + MOVE W1,BLOBS-133(T) + IDPB W1,DISPNR + MOVEI T,35 + POP P,W1 + JRST DISAD0 + +DISAD3: MOVEI T,34 + PUSH P,T + JRST DISAD0 + +DISAD7: PUSHJ P,DISAD3 +DISAD4: MOVNI T,-33 + PUSH P,T + JRST DISAD0 + +DISAD6: MOVEI T,35 + PUSH P,T + JRST DISAD0 + +BLOBS: 53 + 52 + 54 + 46 + 51 + 50 + +DISAD5: PUSHJ P,DIS69 + PUSHJ P,DTOC + PUSHJ P,DIS69 + POP P,W1 + JRST POPTJ + +DIS69: IRP X,,[36,50,35] + MOVEI W1,X + IDPB W1,DISPNR + TERMIN + POPJ P, + DISLP: AOS T,DISCNT + CAILE T,NREGS +DISBEG: MOVNI T,NREGS + MOVEM T,DISCNT + ADDI T,NREGS + IMULI T,NUMREG + ADD T,DISWD + HRLI T,600 + MOVEM T,DISPNR + MOVEM T,DISPN1 + MOVE R,DISCNT + PUSHJ P,DISAD7 + JUMPE R,.+2 + SOJN R,.+2 + PUSHJ P,DISAD4 + MOVE T,DISCNT + ADD T,LLOC + PUSH P,T + PUSHJ P,PAD + XCT "/,CRF + XCT CRF + SKIPG DISCC + JRST .-2 + POP P,R + PUSHJ P,FETCH + JRST DISL1 + PUSHJ P,CONSYM +DISL2: PUSHJ P,DISAD6 + MOVE T,DISPNR + TLNE T,770000 + JRST DISL2 + SUB T,DISPN1 + HRREI T,-NUMREG(T) + JUMPL T,DISL2 + PUSHJ P,CHECK + AOSE DISDON + JRST .-2 + JRST DISLP +DISL1: XCT "-,CRF + JRST DISL2 + DISCFT: SOS (P) + SOS (P) + SKIPN DISON + POPJ P, +DPYSWP: PUSH P,LLUP1 + MOVEI 17,ACSTG(I) + BLT 17,ACSTG+7(I) + XCT DISSW(I) + TLC T,(CONSO#CONSZ) + MOVEM T,LLUPI1 + XORI I,DIS2-DIS1 + MOVSI 17,ACSTG(I) + BLT 17,7 + POP P,LLUP1 + POPJ P, + +CHECK: CONSO DIS,200 + JRST CHECK1 + BLKO DIS,DISPTR + PUSHJ P,RECYC +CHECK1: XCT LLUPI1 ;JRST LLUP1 (IF OFF) OR TRNA (ALWAYS SKIP, VALUE OF WORD NEGATIVE) + JRST DPYSWP + POPJ P, +RECYC: MOVEM T,DISPTR + MOVEI T,40 + SOJG T,. + CONO DIS,100 + DATAO DIS,[20157,,261777] + MOVE T,DISWD + EXCH T,DISPTR + SETOM DISDON + POPJ P, +];dpy340 + +subttl ddt low code + +IIN: PUSHJ P,IN + CAIE T,177 + POPJ P, + JRST ERR + +LCT: PUSHJ P,TSPC + PUSHJ P,TSPC +TSPC: MOVEI T,40 ;SPACE + JRST TOUT + +TYOI: 0 + MOVE T,TYOI + LDB T,[270600+T,,-1] + PUSH P,TYOI + JRST TOUT + +LISTEN: +TS,[ + SKIPE INSW + POPJ P, + .LISTEN T, + JUMPE T,CPOPJ + PUSHJ P,TYI + .LOSE +];TS +NTS,[ + SKIPN INSW + PUSHJ P,TYI + POPJ P, +];NTS + CAIE T,^B + CAIN T,^E + JRST TYO2 + CAIE T,^V + CAIN T,^W + JRST TYO2 + JRST CPOPJ1 + +IN: SKIPE INSW + JRST @INSW ;ANOTHER IO ROUTINE PROVIDED, USE IT. (IT SHOULD POPJ 1,) + ILDB T,MACCR + JUMPN T,IN2 + SETZM MACCR +dpy340,[ + CONSO TTY,40 + PUSHJ P,DISCFT + PUSHJ P,TYI + JFCL +];dpy340 +nodpy,[ + PUSHJ P,TYI + JRST .-1 +];nodpy + +IN2: CAIE T,175 + CAIN T,176 + MOVEI T,33 + SKIPE OUTSW(I) + JRST @OUTSW(I) + CAIL T,^I + CAILE T,^M + JRST IN3 + SKIPE TTYFLG + POPJ P, + PUSH P,T + MOVEI T,15 + PUSHJ P,TYO2 + MOVEI T,12 + PUSHJ P,TYO2 +POPTJ: POP P,T + POPJ P, + +IN3: PUSHJ P,TYO2 + +LPTR: SKIPN LPTFLG + POPJ P, +IFN LPTP,[ + CAIE T,15 + JRST .+3 + CONO LPT,10 + POPJ P, + PUSH P,T + CAIN T,12 + MOVEI T,440 + CAIN T,14 + MOVEI T,441 + CAIN T,33 + MOVEI T,"$ + SUBI T,40 +dpy340,[ + CONSZ LPT,10 + PUSHJ P,DISCFT +];dpy340 +nodpy,[ + CONSZ LPT,10 + JRST .-1 +];nodpy + DATAO LPT,T + POP P,T +] + POPJ P, + +TOUT: +dpy340,[ + SKIPE DISON ;IF DISPLAY ON, + PUSHJ P,CHECK +];dpy340 +TOUT2: SKIPE OUTSW(I) + JRST @OUTSW(I) + PUSHJ P,LPTR +TYO: SKIPN TTYFLG + POPJ P, +TYO2: CAIL T," ;SPACE + JRST TYO3 + CAIN T,177 + POPJ P, + CAIL T,^I + CAILE T,^M + CAIN T,^G + JRST TYO3 + PUSH P,T + CAIE T,33 + MOVEI T,"^ + CAIN T,33 + MOVEI T,"$ + PUSHJ P,TYO3 + POP P,T + CAIN T,33 + POPJ P, + TRO T,100 + PUSHJ P,TYO3 + TRZ T,100 + POPJ P, + +TYO3: +TS, .IOT CHTTYO,T +ka,[ + CONSZ TTY,20 +dpy340, PUSHJ P,DISCFT +nodpy, JRST .-1 + DATAO TTY,T +];ka +kl,[ + PUSH P,T + ANDI T,177 + PUSHJ P,XDTCM + POP P,T +];kl +KS,[ PUSH P,T + ANDI T,177 + TRO T,400 ;Set CTY-char-pending + MOVEM T,8CTYOT ;Store in comm area + CONI T ;Read 8080 + TRO T,80INT ;Hey you! Get this! + CONO (T) ;Interrupt 8080 + SKIPE 8CTYOT ;Wait for completion + JRST .-1 + POP P,T +];KS + POPJ P, + + +TYI: +TS, .IOT CHTTYI,T +ka,[ + CONSO TTY,40 + POPJ P, + DATAI TTY,T +];ka +kl,[ + MOVEI T,3400 ;DDT MODE INPUT REQ + PUSHJ P,XDTCM + JUMPE T,CPOPJ ;NOTHING AVAILABLE +];kl +KS,[ SKIPN T,8CTYIN ;Chars stored here by 8080. + POPJ P, + SETZM 8CTYIN ;Remember to clear it. +];KS + ANDI T,177 + CAIGE T,175 + CAIG T,137 + SKIPA + SUBI T,40 ;UPPERCASIFY + CAIE T,^B + JRST LPTON1 + SETOM LPTFLG +IFN LPTP, CONO LPT,10 +LPTON1: CAIN T,^E + SETZM LPTFLG + CAIN T,^V + SETOM TTYFLG + CAIN T,^W + SETZM TTYFLG + JRST CPOPJ1 + + +kl,[ +XDTCM: SETZM DTEFLG ;SEND ARG IN T TO 11, GET RESPONSE IN T + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE T,DTEF11 + SETZM DTEFLG + POPJ P, +];kl + + +RESTORE:SETOM TEM3 +RESTR1: HRRM T,SAVE + CLEARM SARS + MOVE T,SAVPI + HLLM T,SAVE + ANDI T,177 ;CHANNELS THAT WERE ON + IORI T,2000 ;TURN ON CHANNELS + MOVEM T,SAVPI +RES1: HRLZI 17,AC0 + BLT 17,17 + SKIPL TEM3 +CPUSHP: PUSH BCOM +NTS, CONO PRS,@SAVPI + JRST 2,@SAVE + +CRF: JSR 15,TYOI +LF: MOVEI T,12 ;LINE FEED + JRST TOUT + +;FLOATING POINT OUTPUT + +TFLOT: MOVE A,T + JUMPG A,TFL1 + JUMPE A,FP1A + MOVNS A + XCT "-,CRF + TLZE A,400000 + JRST FP1A + +TFL1: TLNN A,400 + XCT "#,CRF ;NOT NORMALIZED + +FP1: MOVEI B,0 + CAMGE A,FT01 + JRST,FP4 + CAML A,FT8 + AOJA B,FP4 +FP1A: MOVEI C,0 + +FP3: MULI A,400 + ASHC B,-243(A) + MOVE A,B + CLEARM,TEM1(I) + PUSHJ P,FP7 + XCT ".,CRF + MOVNI A,10 + ADD A,TEM1(I) + MOVE W1,C +FP3A: MOVE T,W1 + MULI T,12 + PUSHJ P,FP7B + SKIPE,W1 + AOJL A,FP3A + POPJ P, + +FP4: MOVNI C,6 + MOVEI W2,0 +FP4A: ADDI W2,1(W2) + XCT,FCP(B) + SOSA W2 + FMPR A,@FCP+1(B) +FP4B: AOJN C,FP4A + MOVNI B,-2(B) + PUSH P,B + PUSHJ P,FP3 + MOVEI T,105 + PUSHJ P,TOUT + POP P,T + DPB T,[300200,,.+1] + XCT "+,CRF + MOVE A,W2 + +FP7: JUMPE A,FP7A1 + IDIVI A,12 + AOS,TEM1(I) +FP7A: HRLM B,(P) + JUMPE A,FP7A1 + PUSHJ P,FP7 + +FP7A1: HLRZ T,(P) +FP7B: ADDI T,260 + JRST,TOUT + + 1.0^32. + 1.0^16. +FT8: 1.0^8 + 1.0^4 + 1.0^2 + 1.0^1 +FT: 1.0^0 + 1.0^-32. + 1.0^-16. + 1.0^-8 + 1.0^-4 + 1.0^-2 +FT01: 1.0^-1 +FT0=FT01+1 + +FCP: CAMLE A, FT0(C) + CAMGE A, FT(C) + 0, FT0(C) + +PS: BLOCK LPDL + +dpy340,DISPDL: BLOCK LPDL + + INFORM [END OF LOWCODE]\.-1 + +subttl communication with DSKDMP and ITS + +IF1, IFG .-LOWCOD+6-LOWLEN,.ERR LOW CODE DOESN'T FIT, MAKE LOWLEN BIGGER + +LOC DDT-6 + ALTPC ;-6 PLACE WHERE PC TO PROCEED THROUGH IS STORED + -20,,AC0 ;-5 PNTR TO SAVED LOW CORE (ESPECIALLY ACS) +STARTA: 0 ;-4 START ADDRESS +KILC: -NSYMS,,LOW ;-3 INITIAL SYMBOLS PNTR + -NSYMS,,LOW ;-2 ALL SYMBOLS PNTR +JOBSYM: .-1 ;-1 BIT 4.9=1 => SYMBOL TABLE CLOBBERED + ;+0 DDT STARTS HERE + +NSYMS==NUMSYM*2 +LOW=LOWCOD-NSYMS-2 + +IFN MCDMPF, MACDMP=37400+MOBY +.ELSE [ + noswap, MACDMP=37700+MOBY ;FOR DSKDMP + swap, IF2 MACDMP==ERR ;if neither dskdmp nor magdmp +] + +MACCR=37777+MOBY + +subttl flag register assignments + +;LEFT HALF FLAGS +TIF==100000 ;TRUNCATE TO 18 BITS - SET BY SPACE OR COMMA +PTF==100 ; +, -, OR * HAS BEEN TYPED +COMF==200000 ;COMMA FLAG +CTF==400 +SF==4 ;SYLLABLE FLAG +QF==1 ;QUANTITY TYPED IN TO WORD ASSEMBLER + +CF==40 ;ALTMODE TYPED +CCF==400000 ;2 ALTMODES TYPED +MF==2 ;MINUS SIGN TYPED IN +LTF==20 ;LETTER TYPED IN TO CURRENT SYLLABLE +ROF==10 ;REGISTER OPEN FLAG +STF==4000 ;! MODE +FAF==1000 ; < TYPED +SAF==2000 ; > TYPED + +FPF==20000 ; . TYPED IN +FEF==10000 ; E FLAG + +MLF==200 ;*FLAG +DVF==40000 ;DIVIDE FLAG + +;RIGHT HALF FLAGS +1RF==10 +OUTPUT==4 ;OPDECODER FLAGS + +CF1==400 ;OUTPUT 1 REGISTER AS CONSTANT +LF1==2000 ;OUTPUT 1 REGISTER AS FORCED SYMBOLIC OR CONSTANT +Q2F==1 ;NUMBER TYPED AFTER  +SBF==20 +NAF==200 ;NEGATIVE ADDRESSES PERMISSABLE +POWF==4000 ;ARGUMENT FOR EXPONENT COMING +SLL==10000 ;STOP LOOKING FOR LOCALS + +GLOBAL==040000 ;GLOBAL SYMBOL +LOCAL==100000 +PNAME==740000 ;PROGRAM NAME +DELI==200000 ;DELETE INPUT +DELO==400000 ;DELETE OUTPUT + +subttl ddt starts here + +INFORM DDT,\. + + +DDT: CLEARM INSW ;IF C(INSW) .NE. 0 THEN INPUT ROUTINE JRST'S @INSW + CLEARM OUTSW +TS,[ + .OPEN CHTTYO,[.UAO,,'TTY ? SETZ ? SETZ] + .LOSE + .OPEN CHTTYI,[.UII,,'TTY ? SETZ ? SETZ] + .LOSE +];TS + JSR SAVE ;SAVE PROCESSOR CONDITION + PUSHJ P,BRKRET ;DIDN'T SKIP, PI STATUS AND AC'S WERE SAVED + SKIPGE JOBSYM ;IF SYMTAB MUNGED, + JRST IFIX ;THEN GO FIX IT +DD1A: +dpy340,[ + PUSHJ P,DISINI ;INITIALIZE DISPLAY +] +DD1: TLZ F,ROF ;INDICATE NO REGISTER OPEN + PUSHJ P,CRF ;TYPE CRLF (AND RUN SCOPE IF ON) + MOVE T,[SCHM,,SCH] + BLT T,ODF +DD2: MOVEI P,PS + CLEARM PRNC ;PARENTHESES COUNT +LIS: MOVE T,ESTU + MOVEM T,ESTUT +LISA: TDZ F,[(,-1-ROF-STF)LF1+CF1+SBF+2] ;LEAVE REGISTER OPENED,TYPEOUT SUPPRESSED +LISB: TDZ F,[(,-1-ROF-STF-FAF-SAF)NAF] + CLEARM,WRD +LIS1: CLEARM,FRASE +LIS2: MOVEI T,1 + MOVEM T,FRASE1 + TLZ F,MLF+DVF +L1: TLZ F,CF+CCF+SF+FPF ;TURN OFF CONTROL, SYL, PERIOD FLAG + CLEARM,SYL +L1RPR: CLEARM,SYM + MOVSI T,(50*50*50*50*50*50) + MOVEM T,TEM(I) ;INIT SYMBOL COUNTER + CLEARM,DEN + CLEARM,WRD2 + +L2: PUSHJ P,IN ;PICK UP CHARACTER + TLNE F,CF ;CONTROL FLAG + JRST,L21 + CAIG T,"Z ;Z + CAIGE T,"A ;A + JRST,.+2 + JRST,LET +L21: MOVE R,T + CAIN T,177 + JRST WRONG + CAILE T,"_ + JRST ERR + IDIVI R,3 + LDB W,BDISP(R+1) + CAIGE W,MULT-DDT ;LOCATIONS BEFORE MULT DON'T HAVE ARG EVALUATED + JRST DDT(W) + +L211: MOVE T,SYL + TLZN F,LTF + JRST POWER +L4A: PUSHJ P,EVAL + JRST,UND1 +L4: TLZE F,MF + MOVN T,T + TLNN F,SF + CAIE W,LPRN-DDT + JRST,.+2 + JRST,LPRN + + EXCH T,FRASE1 + TLNN F,DVF + IMULB T,FRASE1 + TLZE F,DVF + IDIVB T,FRASE1 + CAIGE W,ASSEM-DDT + JRST DDT(W) ;MULTIPLY OR DIVIDE + ADDB T,FRASE + CAIGE W,SPACE-DDT + JRST DDT(W) ; + - @ , + + ADD T,WRD + TLNE F,TIF ;TRUNCATE INDICATOR FLAG + HLL T,WRD ;TRUNCATE + MOVEM T,WRD + TLNN F,QF + MOVE T,LWT(I) + CLEARM,R + MOVE W1,ESTUT + CAMN W1,ESTU + JRST L5 + CAILE W,CARR-DDT + JRST ERR +L5: CAIG W,RPRN-DDT + JRST DDT(W) + PUSH P,KILRET + SKIPN PRNC + JRST DDT(W) + +UNDEF: MOVEI T,"U ;U + JRST WRONG1 +ERR: +WRONG: MOVEI T,"? +WRONG1: MOVEI P,PS + PUSHJ P,TOUT +RET: MOVEI P,PS + PUSHJ P,LCT ;COMMON RETURN FOR TAB;,JRST,LIS + JRST DD2 + +UND1: MOVE R,ESTUT ;UNDEFINED SYM ASSEMBLER + PUSHJ P,EVAL2 + CAIN W,ASSEM-DDT + TLNN F,ROF + JRST OPLOOK + LDB T,[(100)PRNC] + JUMPN T,UNDEF + CAIE W,ASSEM-DDT + XCT "#,CRF + MOVN R,[(2)2] + ADDB R,ESTUT +dpy340, PUSHJ P,DISINI + MOVE T,SYM + TLO T,GLOBAL + MOVEM T,(R) + HRRZ T,LLOCO + TLNE F,MF + TLO T,400000 + MOVEM T,1(R) + SETZI T, + JRST L4 + +QUESTN: PUSHJ P,CRF ;LIST UNDEFINED SYMBOLS + MOVE R,ESTU +QUEST1: JUMPGE R,DD1 + MOVE T, (R) + SKIPA W1,ESTU + +QUEST2: ADD W1,[(2)2] + CAME T,(W1) + JRST QUEST2 + +QUEST3: CAME R,W1 + JRST QUEST4 + PUSHJ P,SPT + PUSHJ P,CRF +QUEST4: ADD R,[(2)2] + JRST QUEST1 + +OPLOOK: MOVE T,OPLK1 + MOVEI W1,SYM + MOVE R,[(440700)TXT] + PUSHJ P,SPT+1 +OPLK1: IDPB T,R + +;OPDECODER + +OPEVAL: MOVEM P,SAVPDL + TRZA F,OUTPUT +OPTYPE: TRO F,OUTPUT + LSH T,-27. + MOVEM T,INST(I) + MOVE T,[(440700)TXT] + MOVEM T,CHP +DEC: TRZ F,1RF + CLEARB R,W1 + MOVE W2,BTAB +OPDC1: ILDB T,W2 + CAILE T,40 + CAIL T,73 + SOJGE R,OPDC1 + JUMPG R,OPDC1 + SUBI T,40 + JUMPE T,DECX + JUMPG T,DC2 + DPB T,[(340500)PNTR] + TRZ T,-4 + AOS T + DPB T,[(300600)PNTR] + TRNN F,OUTPUT + JRST DC6 + LDB R,PNTR + JRST OPDC1 + +DC2: HRREI T,-33(T) + JUMPL T,DECT + MOVE W1,T + IDIVI W1,3 + MOVE W2,BTAB(W2) + ADDI W2,(W1) + JRST OPDC1 + +DECT: TRNE F,OUTPUT + JRST O1CZ + ILDB W1,CHP + CAIE W1,133(T) + JRST LOSE + JRST OPDC1 + +DECX: TRNE F,OUTPUT + POPJ P, + ILDB W1,CHP + JUMPE W1,DC7 +LOSE: POP P,R + POP P,W2 + POP P,PNTR + POP P,CHP +LOSE1: AOS R + DPB R,PNTR + LDB R,PNTR + JUMPN R,DC6AA + CAME P,SAVPDL + JRST LOSE + MOVSI T,DELO ;LOOK FOR HALF-KILLED AND DIFFERENT PROGRAMS' LOCALS + IORM T,SYM ;NOTE SETTING DELO HACKS EVAL3+2 TO IGNORE PROGRAM NAMES + PUSHJ P,EVAL + JRST UNDEF ;NOT DEFINED AT ALL + PUSH P,R + PUSHJ P,EVAL1 ;LOOK FOR DUPLICATE INSTANCES + XCT "',CRF ;DIFFERENT PROGRAM SELECTED + CAME R,PRGM + XCT "",CRF ;MULTIPLY DEFINED + POP P,R +LOSE2: MOVEM R,PRGM ;BACK UP TO PRECEDING PROGRAM NAME+2 + SUB R,[2,,2] + MOVE W1,(R) + TLNE W1,PNAME + JRST LOSE2 + JRST L4A ;SELECT APPROPRIATE PROGRAM + +DC6: MOVEI R,0 + DPB R,PNTR +DC6AA: CAMN P,SAVPDL + JRST DC6BB + LDB T,-2(P) + CAME T,(P) + JRST LOSE1 +DC6BB: PUSH P,CHP + PUSH P,PNTR + PUSH P,W2 + PUSH P,R + JRST OPDC1 + +DC7: MOVE P,SAVPDL + MOVE T,INST(I) + LSH T,27. + JRST L4 + +O1CZ: TRO F,1RF + MOVEI T,133(T) + PUSHJ P,TOUT + JRST OPDC1 + +PNTR: INST(I) +CHP: 0 +TXT: BLOCK 2 + +SAVPDL: 0 +BTAB: FOO=44 +REPEAT 3,[(FOO_12.+1400)TBL + FOO=FOO-14 +] + +DEFINE BARF A +AWRD=AWRD+_CC +CC=CC-12. +IFL CC,[AWRD +AWRD=0 +CC=24. +] +CLOC=CLOC+1 +TERMIN + +DEFINE HACK A +IRPS B,D,[A] +Z="D +IFE Z-">,Y!B==CLOC +IF1 IFE Z-"/, BARF 1 +IF2 IFE Z-"/, BARF Y!B+73 +IFE Z-"^,BARF _-1+B&7-1 +IFE *,[ +IRPC Q,,B +Z="Q +IFE Z-".,Z=100 +BARF Z-40 +TERMIN +] +TERMIN +TERMIN + +subttl opcode dispatch table + +TBL: AWRD=0 + CLOC=0 + CC=24. + +KA,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ... BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ .. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/] +];KA + +KL,[ +;INITIAL DISPATCH + HACK [63^. FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ . ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ ADJ/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + ADJ> 03^ . . . . . ADJSP. . .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] +];KL + +TKS,[ +;INITIAL DISPATCH + HACK [63^ . FLO/ HAK/ ACCP/ BOOLE/ H HWT/ T ACBM/ IO/ ] + +;BYTE AND FLOATING INST + HACK [FLO> 33^ XCAD/ D DBL/ KI/ BYTE/ FAD A/ FSB A/ FMP A/ FDV A> + 21^ LMB/ R IMB/ LMB> 02^ . L>L. M>M. B>B. BYTE> 03^ UFA. DFN. + FS C/ IB P> P. I LD/ LD> LD B/ I DP/ DP> DP B/ + XCAD> 03^ . . XCTR/ XCTR/ . ADJSP. . . + XCTR> XCTR 01^ I. .] + +;DOUBLE PRECISION + HACK [DBL> 03^ FAD . FSB . FMP . FDV . ADD . SUB . MUL . DIV .] + +;MISC KI/KL INSTRS + HACK [KI> 12^ DMV/ FIXEX/ DMV/ F 01^ IX R/ LT R> R . + DMV> DMOV 01^ E DMV2/ N DMV2> 21^ . M/ + FIXEX> 01^ FIX . EXTEND .] + +;ITS KS IO INSTRUCTIONS + HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . + IO0> 12^ . . UMV/ . + UMV> UMOVE 01^ . M/ + IO1> IO2> 12^ IORD/ IOXX/ IOWR/ BLTX/ + IOXX> 01^ IORD/ IOWR> IOWR IOBY/ + IORD> IORD IOBY> 41^ IOIQ/ B IOIQ> 02^ I/ Q. . . + BLTX> 41^ BLTXX/ . BLTXX> BLT 01^ BU. UB.] + +;DEC KS IO INSTRUCTIONS +; HACK [IO> 33^ IO0/ IO1/ IO2/ . . . . . +; IO0> 12^ . . UMV/ . +; UMV> UMOVE 01^ . M/ +; IO1> IO2> 03^ TIO/ TIO/ RD IOB/ WR IOB/ BS IOB/ BC IOB/ . . +; TIO> TIO 01^ E IOBP/ N IOBP/ +; IOB> IO IOBP> 41^ . B/ ] + +];TKS + +;FWT, FIXED POINT ARITH, MISC. + HACK [HAK> 33^ MV/ MV> MOV MO/ ML/ DV/ SH/ H1/ JP/ + 21^ ADD IMB/ SU BIMB> B IMB> 02^ . I>I. M/ B/ MO> 22^ + EIMS> E IMS/ S IMS/ N IMS/ M IMS> 02^ . I/ M/ S> S. + ML> 21^ I ML1/ ML1> MUL IMB/ DV> 21^ I DV1/ DV1> + DI DV2> V IMB/ H1> 03^ EXC S3/ BL T> T. AO/ AO> AOBJ + AOB/ JRS T/ JFC L/ XC T/ . AOB> 01^ P/ N/ + JP> 03^ PU/ PU> PUSH PUS/ PO/ PO> POP POP/ JSR. + JS P/ JS PA> A. JR PA/ PUS> 01^ J> J.. POP> + 01^ . J/ SH> 02^ A S2/ ROT S1/ L S2> S S3> H S1/ 21^ JFFO. CIR C/ + S1> 21^ . C> C. ] + +;ARITH COMP, SKIP, JUMP + HACK [ACCP> 42^ CA CA1/ SJ/ A JS/ S JS> O 31^ + J COMP/ S COMP/ CA1> 31^ I COMP/ M COMP/ + SJ> 31^ JUM PSJ/ SKI PSJ> P COMP> + 03^ . L/ E> E. L E/ PA/ G E/ N> N. G. ] + +;BOOLEAN + HACK [BOOLE> 24^ ST/ AN> AND B2/ AN/ ST/ AN/ ST/ + X OR> OR B2/ I OR/ AN/ EQ DV2/ ST/ OR/ ST/ OR/ OR/ + ST> SET B2> 24^ Z IMB/ IMB/ CA> C TA/ TM> M IMB/ + CM> C TM/ TA> A IMB/ IMB/ IMB/ CB> C BIMB/ IMB/ CA/ + CA/ CM/ CM/ CB/ O IMB/ ] + +;HALF WORDS + HACK [HWT> 51^ HW1/ 21^ R HW2/ L HW2> R HW3/ HW1> + 21^ L HW4/ R HW4> L HW3> 32^ IMS/ Z IMS/ O IMS/ + EIMS/ ] + +;TEST INST + HACK [ACBM> 31^ AC1/ 01^ D AC2/ S AC2/ AC1> 01^ R AC2/ L + AC2> 42^ N EAN/ Z EAN/ C EAN/ O EAN> 12^ . E/ PA/ N/ ] + +IFN AWRD,AWRD + +subttl command action routines + +NUM: ANDI T,17 ;T HOLDS CHARACTER + TLNE F,CF+FPF + JRST NM1 + MOVEI W,10 + IMULM W,SYL + ADDM T,SYL + MOVEI W,10. ;ALSO MAINTAIN DECIMAL WORD + IMULM W,DEN + ADDM T,DEN +LE1: AOJA T,LE1A ;FOR SQUOZE SYM + +DOLLAR: +PERC: MOVEI T,47+101-13-45(T) ;PERCENT SIGN +LET: TLC F,SF+FPF ;EXPONENT IFF LTF'*FEF'*(T=105)*SF*FPF=1 + TLZN F,LTF+FEF+SF+FPF + CAIE T,"E + TLOA F,LTF + TLOA F,FEF + JRST LET1 + TLZN F,MF + SKIPA W1,SYL + MOVN W1,SYL + MOVEM W1,FSV + CLEARM DEN +LET1: SUBI T,101-13 ;FORM RADIX 50 SYMBOL +LE1A: TLO F,SF+QF +LE2: MOVEI W,50 + EXCH W,TEM(I) + IDIVM W,TEM(I) + IMUL T,TEM(I) + ADDM T,SYM + JRST L2 + +NUM1: EXCH T,WRD2 ;FORM NUMBER AFTER DOLLAR SIGN + IMULI T,10. + ADDM T,WRD2 + TRO F,Q2F + JRST,L2 + +NM1: TLNE F,CF + JRST NUM1 + MOVEI W1,6 ;FORM FLOATING POINT NUMBER + AOS NM1A +NM1A: MOVEI W2,0 + MOVSI R,201400 +NM1A1: TRZE W2,1 + FMPR R,FT(W1) + JUMPE W2,NM1B + LSH W2,-1 + SOJG W1,NM1A1 +NM1B: MOVSI W1,211000(T) + FMPR R,W1 ;COMPUTE VALUE OF NEW DIGIT + FADRB R,FH ;ADD VALUE INTO FLOATING NO. +REPEAT 0,[ ;I THINK THIS HAIRY ROUNDING IS UNNEC. ALSO KL HAS NO "FMPL". + FMPL R,W1 + SKIPN FH + JRST NM1C + LDB W2,[(331000)R] + LDB W1,[(331000)FH] + TLZ R,377000 + SUB W2,W1 + ASHC R,(W2) + ADD S,FL + TLZE S,400000 + AOS R + MOVE W2,FH + TLZ W2,377000 + ADD R,W2 + TLNN R,1000 + SOSA W1 + ASHC R,-1 + FSC R,1(W1) +NM1C: MOVEM R,FH + MOVEM S,FL + JUMPE R,NM1D + TLNE S,200000 + AOS R ; ROUND + TLO R,400 ; NORMALIZE +NM1D: +] ;END REPEAT 0 + MOVEM R,SYL + AOJA T,LE1A + +POWER: TLNN F,FEF + JRST L4 ;NO EXPONENT + CAIE W,PLUS-DDT + CAIN W,MINUS-DDT + TROE F,POWF + TRZA F,POWF + JRST DDT(W) ; E+- + + MOVE W2,DEN + MOVEI W1,FT-1 + TLZE F,MF + MOVEI W1,FT01 + SKIPA T,FSV +POW2: LSH W2,-1 + TRZE W2,1 + FMPR T,(W1) + JUMPE W2,L4 + SOJA W1,POW2 + +PERIOD: MOVE T,LLOC + TLNE F,SF ;SYLLABLE STARTED + MOVE T,DEN + MOVEM T,SYL + TLON F,FPF+SF+QF + MOVEI T,0 + IDIVI T,400 + SKIPE T + TLC T,243000 + TLC W1,233000 + FSC T,0 ;NORMALIZE + FSC W1,0 + FADR T,W1 +REPEAT 0,[ ;I THINK THIS DOUBLE PRECISION IS UNNEC. ALSO KL HAS NO "FADL" + FADL T,W1 + MOVEM W1,FL +] ;END REPEAT 0 + MOVEM T,FH + HLLZS NM1A + MOVEI T,45 ;RADIX 50 PERIOD + JRST LE2 + +QUAN: SKIPA T,LWT(I) ;LAST QUANTITY TYPED +PILOC: MOVEI T, SAVPI +QUAN1: MOVEM T,SYL +QUAN2: TLO F,SF+QF ;WRD,SYL STARTED + TLZ F,CF+CCF + JRST,L2 + +CONTROL: TLOE F,CF + TLO F,CCF + JRST,L2 + +EVAL: MOVE R,PRGM ;LOOK UP SYMBOL +EVAL0: HRLOI W1,37777+DELI ;W1 BITS MUST BE OFF + JRST EVAL3 + +EVAL1: ADD R,[(2)2] ;NEXT SYMBOL +EVAL2: SKIPL R + MOVE R,@JOBSYM ;WRAP AROUND + CAMN R,PRGM ;SKIP UNLESS SCANNED ENTIRE SYMBOL TABLE + POPJ P, ;NO SYMBOL FOUND +EVAL3: MOVE T,(R) + XOR T,SYM + TLNN T,PNAME ;SKIP UNLESS SYMBOL IS PROGRAM NAME + TLOA W1,LOCAL ;PROGRAM NAME, FROM NOW ON IGNORE LOCALS + TDNE T,W1 + JRST EVAL1 ;PROGRAM NAME OR NO MATCH, TRY NEXT + TLNN T,340000 + JRST EVAL1 ;PROGRAM NAME, SKIP IT (CAN HAPPEN IF GOT HERE FROM LOSE1) + MOVE T,1(R) ;GOT IT, RETURN VALUE IN T, SYMBOL TABLE PNTR IN R. + +CPOPJ1: AOS (P) ;FOUND SYMBOL, SKIP +CPOPJ: POPJ P, + + +;BIT 40 - DELETE OUTPUT +; 20 - DELETE INPUT +; 10 - LOCAL +; 04 -GLOBAL +; NO BITS - PROGRAM NAME + +KILL: TLNN F,LTF ;DELETE SYMBOLS + JRST,KILLA + PUSHJ P,EVAL + JRST KILL1 + MOVEI T,DELO_-16. ;DELETE OUTPUT + TLNE F,CCF + MOVEI T,DELI_-16. ;NO INPUT OR OUTPUT + DPB T,[(420200+R)] +KILRET: JRST,RET + +KILLA: TLNN F,QF + TLNN F,CCF + JRST ERR + MOVE R,KILC + MOVEM R,@JOBSYM ;RESTORE INIT SYMS + HRRZM R,ESTU + MOVEM R,PRGM + HRLZI T,DELO+DELI + ANDCAM T,(R) ;GET RID OF DELETE BITS IN INITIAL TABLE + AOBJN R,.+1 + AOBJN R,.-2 + JRST,DD1 + +KILL1: MOVE R,ESTU ;REMOVE UNDEFINED SYMS + JUMPGE R,UNDEF +KILL2: PUSHJ P,EVAL0 + JRST RET + PUSHJ P,REMUN + JRST KILL2 + +REMUN: MOVE S,[(2)2] ;REMOVE ONE UNDEFINED SYM + ADDB S,ESTU + MOVE W,-2(S) + MOVEM W,(R) + MOVE W,-1(S) + MOVEM W,1(R) + POPJ P, + +DS: MOVE R,DSSAV(I) + MOVEI T,DELO_-16. + DPB T,[(420200+R)] + MOVE T,1(R) + PUSHJ P,LOOK + JRST RET + JRST RET + +TAG: TLNE F,CF ;DEFINE SYMBOL AS OPEN REGISTER + JRST SETNAM + MOVE W,LLOCO + HRRZM W,DEFV + TLOE F,FAF + JRST ERR +DEFIN: TLNE F,FAF + TLNN F,LTF + JRST ERR +ADEFIN: PUSHJ P,EVAL + JRST DEF1 + CAMGE R,KILC + JRST DEF2 ;REDEFINE + MOVEI T,DELI_-16. + DPB T,[(420200+R)] +DEF1: MOVN R,[(2)2] + ADDB R,@JOBSYM + HRRZ T,ESTU + SUBI T,2 + HRL T,ESTU + HRRM T,ESTU + SKIPGE ESTU + BLT T,-1(R) +dpy340, PUSHJ P,DISINI +DEF2: MOVE T,DEFV + MOVEM T,1(R) + MOVSI T,GLOBAL + IORB T,SYM + MOVEM T,(R) + MOVE R,ESTU + +DEF3: JUMPGE R,RET ;PATCH IN UNDEFINED SYM + MOVE T,SYM + CAME T,(R) + JRST DEF4 + MOVE S,DEFV + SKIPGE 1(R) + MOVNS S + PUSH P,R + MOVE R,1(R) + PUSHJ P,FETCH + JRST ERR + ADD S,T + HRRM S,T + PUSHJ P,DEP + POP P,R + PUSHJ P,REMUN +DEF4: ADD R,[(2)2] + JRST DEF3 + +;DISK COMMANDS HERE SO NO EVAL ARG + +SWAP,[ +LISTF0: JRST LISTF + +LOAD0: JRST LOAD + +DUMP0: JRST DUMP +];SWAP + +NOSWAP,[ +LISTF0==ERR +LOAD0==ERR +DUMP0==ERR +];NOSWAP + +SETNAM: MOVE R,@JOBSYM +SET2: JUMPGE R,UNDEF + MOVE T,(R) + ADD R,[(2)2] + CAME T,SYM + JRST SET2 + MOVEM R,PRGM + JRST RET + +MULT: TLOA F,PTF+MLF ;* +DIVD: TLO F,DVF+PTF ;SINGLE QUOTE + JRST L1 + +ASSEM: JRST PLUS ;# +MINUS: TLO F,MF +PLUS: TLO F,PTF + JRST LIS2 + +LPRN: CAML P,[(LPDL-32)] + JRST,ERR + PUSH P,F ;RECURSE FOR OPEN PAREN + PUSH P,WRD + PUSH P,FRASE + PUSH P,FRASE1 + AOS,PRNC + JRST,LISA + +INDIRECT: MOVSI W,(@) + IORB W,WRD + TLO F,QF + JRST,LIS2 + +ACCF: TLNN F,COMF + HRRM T,COMWD ;COMMA + MOVE R,T + HLLZS T + + LDB W1,[(331100)WRD] ; Get top 9 bits of opcode + LSH R,27 ; Shift into AC field + CAIN W1,700 ; Old-style IO instruction? + LSH R,1 ; Yes: Shift into device field + +;Used to be: +; LDB W1,[(410300)WRD] +; IDIVI W1,7 +; LSH R,27(W1) + + ADD T,R + ADD T,WRD + TLOE F,COMF +COMWD: HRLI T,. + MOVEM T,WRD + JRST SPACE+1 + +SPACE: TLNE F,QF + TLO F,TIF +SPAC1: TLZ F,MF+PTF + JRST,LIS1 + +RPRN: MOVS T,WRD ;) + SOSGE,PRNC + JRST,ERR + POP P,FRASE1 + POP P,FRASE + POP P,WRD + POP P,F + TLO F,QF + TLNE F,PTF + TLOE F,SF + JRST,RPRN1 + MOVEM T,SYL + JRST,L1RPR +RPRN1: ADDB T,WRD + JRST,L1RPR-1 + +VARRW: SOSA LLOC ;^ +TAB: PUSHJ P,PLOC +LI1B: SOS LLOC + +LINEF: PUSHJ P,DEPRA ;NEXT REGISTER + TLZN F,CF + JRST LI0 +LI1A: MOVE R,PLCR ;MOVE BACK IN RING BUFFER + MOVE T,LOCBF(R) + SOSGE R + MOVEI R,NLEVS-1 + MOVEM R,PLCR + HRRZM T,LLOC + JRST DDT(W) +LI0: PUSHJ P,CRF + AOS T,LLOC +LI1: HRRZM T,LLOC + HRRZM T,LLOCO + PUSHJ P,PAD + MOVEI T,"/ ;SLASH + TLNE F,STF + MOVEI T,"! ;EXCLAMATION MARK + PUSHJ P,TOUT +LI2: TLZ F,ROF + PUSHJ P,LCT + MOVE R,LLOCO + PUSHJ P,FETCH + JRST ERR + TLO F,ROF + TLNE F,STF + JRST DD2 + JRST CONSYM + + +CARR: PUSHJ P,DEPRA + MOVEI W,LI1B-DDT + TLZE F,CF + JRST LI1A + JRST DD1 + +OCON: TROA F,LF1+CF1 ;OPEN AS CONSTANT +OSYM: TRZ F,CF1 ;OPEN SYMBOLICALLY + TROA F,LF1 +SLASH: TLZ F,STF ;TYPE OUT REGISTER + TLZE F,CF ;ALTMODE SLASH SUPPRESSES TYPEOUT + TLO F,STF + TLNE F,QF + PUSHJ P,PLOC ;QUANTITY TYPED +SLAS1: HRRZM T,LLOCO + JRST LI2 + +ICON: TLZE F,CF + JRST IKON + PUSHJ P,DEPRA ;\ + JRST SLAS1 + +PLOC: CAMN T,LLOC + POPJ P, + AOS R,PLCR ;ADVANCE RING POINTER + CAIL R,NLEVS + CLEARB R,PLCR + EXCH T,LLOC + MOVEM T,LOCBF(R) + MOVE T,LLOC + HRRZS LLOC + POPJ P, + +ASLASH: TLNN F,QF + JRST QUESTN + PUSH P,T + MOVEI T,"/ + PUSHJ P,TOUT + POP P,T + JRST SLASH + +IKON: MOVEM T,LWT(I) + PUSHJ P,EFFEC0 + JRST ERR + MOVE R,T + PUSHJ P,FETCH + JRST ERR + JRST OVRD2 + +DEPRA: TLNE F,ROF ;IF REGISTER IS BEING CHANGED + TLNN F,QF ;REMOVE ALL PREVIOUS UNDEFINED + JRST DEPRS ;SYMBOL REFERENCES TO IT + MOVE R,ESTU + MOVEM W1,ESTU +DEPRA2: JUMPGE R,DEPRS + HRRZ W,1(R) + CAMN W,LLOCO + PUSHJ P,REMUN + ADD R,[(2)2] + JRST DEPRA2 + +EQUAL: TROA F,LF1+CF1 ;= +PSYM: TRZ F,CF1 ;@ + TRO F,LF1 + JRST CONSYM + +R50PNT: MOVEM T,LWT(I) ;AMPERSANT + LSH T,-36 + TRZ T,3 + PUSHJ P,TOC + PUSHJ P,TSPC + MOVEI W1,LWT(I) + JRST SPT + +HWRDS: MOVEI R,HLFW-TFLOT ;H +SFLOT: ADDI R,TFLOT-SATP ;F +RATP: ADDI R,SATP-IASCO ;T +ASCSET: ADDI R,IASCO-ISIXO ;" +SIXSET: ADDI R,ISIXO-PIN ;' +SYMBOL: ADDI R,PIN-FTOC ;S +CON: ADDI R,FTOC ;C + JSP W,SET + +RELA: TLZE F,QF ;R + JRST,BASECH + MOVEI R,PADSO-TOC +ABSA: ADDI R,TOC ;A + JSP W,SET + +BASECH: SOJLE T,ERR ;CHANGE RADIX + MOVEI R,1-10.(T) +SDEC: ADDI R,2 ;D +SOCT: ADDI R,10 ;O + JSP W,SET + +SET: MOVEI W,-RELA(W) + IDIVI W,5 + HRRZM R,SCH(W) + JUMPGE F,LIS1 + HRRZM R,SCHM(W) + JRST RET + +GO: HRLI T,(JRST) + TLC F,QF+CCF + TLCN F,QF+CCF + MOVEM T,STARTA + TLOE F,QF + JRST XEC0 + SKIPE T,STARTA + +XEC: TLNN F,QF ;X + JRST ,ERR +XEC0: MOVEM T,TEM + SETZM ALTPC + PUSHJ P,CRF + PUSHJ P,TTYLEV + PUSHJ P,INSRTB +TKS,[ ;Compensate for DEC brain death: XCT of JRST 2, gets wrong flags + MOVE T,TEM + LSH T,-33 + CAIE T,JRST_-33 + JRST XECKS + JSP T,RESTORE + JRST TEM + +XECKS: +];TKS + JSP T,RESTORE + XCT TEM +XEC1: JRST DDT ;USED BY BCOM + JSR SAVE + PUSHJ P,BRKRET + PUSHJ P,CRF + JRST DD1 + +DQUOTE: TLNE F,CF ;IF ALTMODE TYPED, + JRST DQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;DOUBLE QUOTE + ;DISPATCH ENTRY FOR IN DOUBLEQUOTE MODE +IASCO: SETZM TEM2 + MOVE W1,T + TDNE W1,[-200] ;SKIP IF ONLY ONE CHARACTER IN WORD + JRST TEXO1 + LSH W1,1 ;THEN ASSUME IT'S RIGHT JUSTIFIED +TEXO1: MOVEI T,0 +TEXO10: JUMPE W1,CPOPJ +TEXO11: LSHC T,7 +TEXO12: SKIPN TEM2 + JUMPE T,TEXO1 + SETOM TEM2 + PUSHJ P,TOUT + JRST TEXO1 + +SQUOTE: TLNE F,CF ;IF ALTMODE TYPED + JRST SQOT2 ;THEN SET TYPEOUT MODE + MOVEM T,LWT(I) ;SINGLE QUOTE + ;DISPATCH ENTRY FOR IN SINGLEQUOTE MODE +ISIXO: MOVE W1,T +SIXO1: MOVEI T,0 + JUMPE W1,CPOPJ + LSHC T,6 + JUMPE T,SIXO1 + ADDI T,40 + PUSHJ P,TOUT + JRST SIXO1 + + ;ENTRY FROM ALTMODE DOUBLEQUOTE +DQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE, + JRST ASCSET ;THEN SET TYPEOUT MODE + MOVSI W1,440700 ;OTHERWISE, DO ASCII TYPEIN + HLLZS SASEM + JRST ISTRING + + ;ENTRY FROM ALTMODE SINGLEQUOTE +SQOT2: TRZN F,Q2F ;IF NUMBER NOT TYPED AFTER ALTMODE + JRST SIXSET ;THEN SET TYPEOUT MODE + MOVEI W1,40 ;OTHERWISE, DO ASCII TYPEIN + HRRM W1,SASEM + MOVSI W1,440600 + +ISTRING: + MOVE T,WRD2 ;SO 1" DOES RIGHT THING + MOVEM T,TEM +ISTR1: PUSHJ P,IIN + CAIN T,33 + JRST ISTR2 + CAIN T,^Q + PUSHJ P,IN + PUSHJ P,SASEM + JRST ISTR1 + +ISTR2: MOVE T,TEM + SETZM WRD2 + JRST MASK2 + +SASEM: SUBI T,0 ;CLOBBERED TO 0 OR 40 +SASME: HRRI W1,TEM + IDPB T,W1 + POPJ P, + +;ALTMODE V + +DISF: +dpy340,[ + SETCMM DISON ;COMPLEMENT STATUS FLAG + JRST DISINI ;INITIALIZE DISPLAY AND RETURN +];dpy340 +nodpy, POPJ P, + +BP0: REPEAT NBP+1,[ + 0 + JSA T, BCOM + 0 +] +IFN 1PRSW,[ +TBP1: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 1 +TBP2: 0 ? JSA T,BCOM ? 0 ;TEMPORARY BREAK 2 +];1PRSW + +BP1=BP0+3 +B1INS=BP1+2 +BPN=.-3 + + ;BREAKPOINT 0 LIKE OTHERS EXCEPT DOESN'T GET CHECKED ON LOC$B OR CLEARED BY $B + +BCOM: 0 + HRRM T,LEAV + MOVEI T,B1SKP-B1INS(T) + HRRM T,BCOM3 ;CONDITIONAL BREAK SETUP + MOVEI T,B1CNT-B1SKP(T) + HRRM T,BCOM2 ;PROCEDE COUNTER SETUP + MOVE T,BP1-B1CNT(T) + HLLM T,LEAV1 ;SAVE FLAGS FOR RESTORING + EXCH T,BCOM ;RESTORE FORMER CONTENTS OF ACCUMULATOR + +BCOM3: SKIPE B1SKP ;ADDRESS MODIFIED, POINTS TO CONDITIONAL BPT INSTRUCTION + XCT @.-1 +BCOM2: SOSG B1CNT ;ADDRESS MODIFIED, POINTS TO COUNT OF CURRENT BPT + JRST BREAK + + MOVEM T,AC0+T + LDB T,[(331100)@LEAV] + CAIL T,264 ;JSR + CAILE T,266 ;JSA,JSP + TRNN T,700 ;UUO + JRST PROC1 + CAIE T,260 ;PUSHJ + CAIN T,256 ;XCT + JRST PROC1 + MOVE T,AC0+T + JRST 2,@LEAV1 ;RESTORE FLAGS AND JUMP TO .+1 + +LEAV: XCT B1INS ;ADDRESS MODIFIED + JRST @BCOM + AOS BCOM + JRST @BCOM + +LEAV1: LEAV + +BREAK: JSR SAVE + PUSHJ P,BRKRET + SOS T,BCOM3 + HRRZS T +IFN 1PRSW, CAIGE T,TB1ADR + PUSHJ P,PADSO + MOVEI T,"> + PUSHJ P,TOUT + SKIPG @BCOM2 + PUSHJ P,TOUT ;TYPE OUT SECOND ">" IF COUNT EXHAUSTED + MOVE T,BCOM + HLLM T, SAVPI + MOVEI T,-1(T) + PUSHJ P,PAD + HRRZ T,@BCOM3 + HRRM T,PROC0 + HLRZ T,@BCOM3 + JUMPE T,BREAK1 + PUSHJ P,LCT + HLRZ T,@BCOM3 + PUSHJ P,PLOC + PUSHJ P,LI1 +BREAK1: HRRZ R,BCOM3 + SUBI R,B1ADR + IDIVI R,3 + MOVEI S,1 + LSH S,1(R) + TDNN S,AUTOPI + JRST RET + PUSHJ P,LISTEN + JRST PROCD1 + JRST RET + +PROCEDE: + SKIPN R,ALTPC ;TURN INTO G? + JRST PROCD0 + MOVEM R,ALTPC1 ;YES + MOVE T,[JRST 2,@ALTPC1] + JRST XEC0 + +PROCD0: TLNN F,QF + MOVEI T,1 ;NO COUNT SPECIFIED, USE 1 + MOVEM T,@BCOM2 ;MOVE TO COUNT OF SPECIFIED BPT + HRRZ R,BCOM3 + PUSHJ P,AUTOP +PROCD1: PUSHJ P,CRF + PUSHJ P,TTYLEV +PROC0: HRRZI R,XEC1 ;ADDRESS MODIFIED + PUSHJ P,FETCH + JRST ERR + MOVEM T,WRD + PUSHJ P,INSRTB + MOVE T,WRD ;BREAKPOINTED INSTRUCTION TO XCT + JRST PROC2 + +PROC1: MOVE T,AC0+T + JSR SAVE + MOVE T,@LEAV +PROC2: MOVE R,BCOM + MOVEI W,100 + MOVEM W,TEM1 + JRST IXCT5 + +IXCT4: MOVEM R,40 + MOVEI R,41 +IXCT: SOSL TEM1 + PUSHJ P,FETCH + JRST BPLUP +IXCT5: MOVEM T,TEM + LSH T,-33 + CAIN T,254 + JRST IXCT6 + HRLZI 17,AC0 + BLT 17,17 + MOVEI T,@TEM + DPB T,[(2700)TEM] + LDB W1,[(270400)TEM] + LDB T,[(331100)TEM] + MOVEI P,PS + CAIN T,260 + JRST, IPUSHJ + + CAIN T,264 + JRST,IJSR + CAIN T,265 + JRST,IJSP + CAIN T,266 + JRST,IJSA + MOVE R,TEM +KL, CAIGE T,74 ;LPMR,SPM,XCTR,XCTRI +.ELSE, CAIGE T,100 + JRST,IXCT4 + CAIN T,256 + JRST,IXCT + +IXCT6: MOVEI T,TEM + HRRM T,LEAV + MOVEI T,LEAV + JRST,RESTORE + +BPLUP: PUSHJ P,BRKRET + JSR SAVE ;ALWAYS SKIPS +INC1: JSR BP0 ;USED AS "CONSTANT" IN SETTING UP FOR INSERTING BREAKPOINTS + JRST ERR + +IPUSHJ: DPB W1,[(270400)CPUSHP] + CLEARM,TEM3 + MOVE T,TEM + JRST,RESTR1 + +IJSA: MOVE T,BCOM + HRL T,TEM + EXCH T,AC0(W1) + JRST,IJSR2 + +IJSR: MOVE T,BCOM + HLL T,SAVPI +IJSR2: MOVE R,TEM + PUSHJ P,DEP + AOS,TEM +IJSR3: MOVE T,TEM + JRST,RESTORE + +IJSP: MOVE W,BCOM + HLL W,SAVPI + MOVEM W,AC0(W1) + JRST,IJSR3 + +;INSERT BREAKPOINTS + +INSRTB: MOVE S,INC1 +INSRT1: SKIPE R,B1ADR-BP1(S) ;GET C(BADR) IN R + PUSHJ P,FETCH ;GET CONTENTS OF LOC ADDRESSED BY R INTO T + JRST INSRT3 ;LOCATION OUTSIDE OF MEMORY OR BREAKPOINT EMPTY + MOVEM T,B1INS-BP1(S) ;PUT CONTENTS IN BINS + MOVE T,S ;JSR BP + PUSHJ P,DEP ;DEPOSIT T IN LOCATION SPECIFIED BY R +INSRT3: ADDI S,3 + CAMG S,[JSR BPN] + JRST INSRT1 +IFN KS1PR,[ + MOVEI T,1PRTRP + SKIPE R,1POADR ; If one-proceeding going on, + EXCH T,UPT1PN-UPT1PO(R) ; then usurp UPT1PN. + MOVEM T,1PNSV +];KS1PR + POPJ P, + +;REMOVE BREAKPOINTS + +REMOVB: MOVEI S,BNADR ;POINTER TO BADR +REMOV1: MOVE T,B1INS-B1ADR(S) ;INSTRUCTION AT BREAKPOINT + SKIPE R,(S) ;IF THERE'S REALLY A BREAKPOINT THERE, + PUSHJ P,DEP ;THEN DEPOSIT INSTRUCTION IN USER'S CORE (SPECIFIED BY R) +REMOV3: SUBI S,3 + CAIL S,B0ADR + JRST REMOV1 +IFN 1PRSW,[ + SETZM TB1ADR ;FLUSH TEMPORARY BREAKS + SETZM TB2ADR +];1PRSW +IFN KS1PR,[ + MOVE T,1PNSV + SKIPE R,1POADR ; If UPT1PN usurped, + MOVEM T,UPT1PN-UPT1PO(R) ; then put it back now. +];KS1PR + POPJ P, + +;ALTMODE B + +BPS: TLZE F,QF + JRST BPS1 ;LOCATION SPECIFIED + TRZE F,Q2F + JRST BPS2 ;REMOVE SPECIFIED BREAKPOINT + MOVE T,[(B1ADR)B1ADR+1] ;REMOVE ALL BREAKPOINTS + CLEARM B1ADR + BLT T,BNADR+2 + JRST DD1 + + ;LOC$B, LOC$NB + +BPS1: TRZN F,Q2F + JRST,BPS3 ;NUMBER NOT TYPED AFTER ALTMODE + MOVE R,T + TRO F,2 ;USED LATER + + ;GET HERE WHEN NUMBER TYPED AFTER ALTMODE + +BPS2: SKIPL T,WRD2 ;BPT # NOT LEGAL... + CAILE T,10 ;IF NOT BETWEEN 0 AND 8 INCLUSIVE + JRST,ERR + IMULI T,3 ;AMOUNT OF STG PER BREAKPOINT + ADDI T,B1ADR-3 ;MAKE T POINT TO STG AREA OF SPECIFIED BREAKPOINT + TRZN F,2 + JRST MASK2 ;LOCATION NOT SPECIFIED, TREAT AS SYM + EXCH R,T ;R NOW IS POINTER TO BP STG AREA, T SPECIFIED LOCATION + JRST BPS5 + + ;LOC$B + +BPS3: MOVEI R,B1ADR +BPS4: HRRZ W,(R) ;GET BPN LOCATION + CAIE W,(T) ;IF SPECIFIED LOCATION, + SKIPN (R) ;OR IF ZERO, + JRST,BPS5 ;THEN USE IT, + ADDI R,3 ;OTHERWISE INCREMENT R TO POINT TO STG OF NEXT BPT + CAIG R,BNADR ;SKIP IF TOO MANY + JRST,BPS4 ;GO LOOK AT NEXT ONE + JRST,ERR ;ALL FULL + +BPS5: MOVEM T,(R) ;SET BP TO SPECIFIED LOCATION (0 MEANS NOT IN USE) + CLEARM,1(R) + CLEARM,2(R) +AUTOP: SUBI R,B1ADR ;NOW MUNG R, + IDIVI R,3 ;INTO BP NUMBER + MOVEI S,1 + LSH S,1(R) ;C(S):=1_<1+BP#> + ANDCAM S,AUTOPI + TLNE F,CCF + IORM S,AUTOPI ;ALTMODE ALTMODE TYPED MEANS BPT ENCOUNTER => TYPE MESSAGE + ;BUT CONTINUE (UNTIL CHARACTER TYPED AT TTY) + POPJ P, + +IFN KS1PR,[ + +OIPBIT==:1000 + +1PRCNT: 0 ; If > 0, one-proceeding is going on +1POADR: 0 ; 0 or address of usurped UPT1PO +1PNSV: 0 ; Saved contents of usurped UPT1PN + +CTLN: TLNE F,CF\CCF + JRST ERR ; No  or  support + TLNN F,QF + MOVEI T,1 ; Argument defaults to 1 + JUMPLE T,ERR + MOVEM T,1PRCNT +NTS,[ + RDUBR R + MOVEI R,UPT1PO(R) +];NTS +TS, MOVEI R,44 ; Just a kludge for debugging under TS + MOVEM R,1POADR ; Commence usurpation + SKIPN T,ALTPC + SOS T,BCOM + TLO T,OIPBIT + MOVEM T,ALTPC1 + SETZM ALTPC + PUSHJ P,CRF + PUSHJ P,TTYLEV + PUSHJ P,INSRTB ; First, insert all breakpoints + MOVE R,ALTPC1 + PUSHJ P,FETCH ; Then take a look at the next instruction + JRST CTLN1 ; (oh well, just punt) + CAML T,[JSR BP0] ; Is it a breakpoint of some sort? + CAMLE T,[JSR BPN] + JRST CTLN1 ; Nope, get going + MOVE T,B1INS-BP1(T) ; Yeah, clobber it back again + PUSHJ P,DEP +CTLN1: JSP T,RESTORE +1PRTR1: MOVE T,AC0+T ; (redundant if you fall in) + JRST 2,@ALTPC1 + +1PRTRP: SOSG 1PRCNT + JRST 1PRBRK + MOVEM T,AC0+T + MOVE T,@1POADR + TLO T,OIPBIT + MOVEM T,ALTPC1 + MOVE T,AC0+T ; In case executing in ACs! + MOVE T,@ALTPC1 ; Peek at the next instruction + CAML T,[JSR BP0] ; Is it a breakpoint of some sort? + CAMLE T,[JSR BPN] + JRST 1PRTR1 ; Nope, get going + MOVE T,AC0+T ; Yup, abandon stepping +1PRBRK: JSR SAVE + PUSHJ P,BRKRET + MOVE T,@1POADR + SETZM 1POADR ; Cease usurpation + MOVEM T,ALTPC + HLLM T,SAVPI + SKIPLE 1PRCNT ; Abandoned because of breakpoint? + JRST PROCED ; Yes, proceed into breakpoint + MOVEI T,"> ; No, go tell user where we stopped + PUSHJ P,TOUT + PUSHJ P,TOUT +.ERR Shouldn't leave location open after 1-proceed + HRRZ T,ALTPC + PUSHJ P,PLOC + PUSHJ P,LI1 + JRST RET + +];KS1PR + +IFN 1PRSW,[ + +;CONTROL-N + +CTLN: TLZN F,CF + JRST ONEPRO + MOVE T,BCOM + HRLI T,1(T) + TLZE F,QF + MOVE T,WRD ;T HAS TB2ADR,,TB1ADR + HRRZM T,TB1ADR + HLRZM T,TB2ADR + JRST PROCEDE + +ONEPRO: JRST ERR ;NOT HACKED YET +];1PRSW + +IFNDEF CTLN, CTLN==:ERR + +DEPRS: MOVEM T,LWT(I) +DEPR: MOVE R,LLOCO ;QUAN TYPED IN REGIS EXAM + TLZE F,ROF + TLNN F,QF + POPJ P,0 +DEP: TRNN R,777760 + JRST DEP1 ;BPT LOCATION IS AN ACCUMULATOR + MOVEM T,0(R) + POPJ P,0 + +DEP1: MOVEM T,AC0(R) + POPJ P,0 + +FETCH: MOVE T,HIGH + CAIGE T,(R) + POPJ P, + MOVE T,(R) + TRNN R,777760 + MOVE T,AC0(R) + JRST CPOPJ1 + +FIRARG: MOVEM T,DEFV + TLO F,FAF + JRST,ULIM1 +ULIM: TLO F,SAF + HRRZM T,ULIMIT +ULIM1: TLNE F,CF + JRST OVRD + TLNN F,QF + JRST,ERR + JRST,LISB + +LOOK: SETZB W1,S + MOVSI W1,DELI+DELO + MOVE R,PRGM + MOVEM R,PRGM(I) + MOVSI W2,PNAME + SKIPGE T + MOVSI S,400000 + MOVE W,[444400,,ENDT] + MOVEM W,TEM(I) +LEND1A: ILDB W,TEM(I) + MOVEM W,LLUP1 + JRST LLUP1 +ENDT: TDNN W2,(R) + TLO W1,LOCAL + SKIPL R + MOVE R,@JOBSYM + CAMN R,PRGM(I) + TLZA W1,-1 +LLUP: ADD R,[2,,2] +LLUPI1: JRST LLUP1 ;OR TRNA +dpy340,[ + PUSHJ P,DPYSWP + CONSZ DIS,200 + JRST LLUPD +];dpy340 +LLUP1: 0 + JRST LEND1 + CAML T,1(R) + CAML S,1(R) + JRST LLUP + HLRZ W,W1 + TSNN W,(R) + TDNN W2,(R) + JRST LLUP + HRR W1,R + CAMN T,1(R) + JRST SPT + MOVE S,1(R) + JRST LLUP + +dpy340,[ +LLUPD: BLKO DIS,DISPTR + PUSHJ P,RECYC +CJLP1: JRST LLUP1 +];dpy340 + +LEND1: AOS W,TEM(I) + XCT (W) + JRST LEND1A +LOOK1: MOVEM T,TEM(I) + TRNE W1,-1 + SUB T,S + JRST CPOPJ1 + +CONSYM: MOVEM T,LWT(I) +CONSM: TRNN F,LF1 +CONS1: JRST @SCH + TRNE F,CF1 + JRST, FTOC + +PIN: TRZ F,NAF + + PUSHJ P,OPTYPE ; Look it up in the opcode table first + TRNE F,1RF ; Anything typed? + JRST PI3.1 ; Yes: proceed + MOVE T,LWT(I) + TLNN T,777000 ; Opcode 0? + JRST PI3+1 ; Yes: skip this stuff + TLC T,700000 + TLCN T,700000 ; Traditional IO instruction? + JRST INOUT ; Yes: Go do it that way + PUSHJ P,LOOK ; No: look it up + +;Used to be: +; TLC T,700000 +; TLCN T,700000 +; JRST,INOUT +; PUSHJ P,OPTYPE +; MOVSI T,777000 +; AND T,LWT(I) +; JUMPE T,PI3+1 +; TRNN F,1RF +; PUSHJ P,LOOK + +PI3.1: TROA F,NAF + JRST HLFW +PI3: PUSHJ P,TSPC + LDB T,[(270400)LWT(I)] ;AC + JUMPE T,PI4 + PUSHJ P,PAD +PI3A: XCT ",,CRF +PI4: MOVE W1,LWT(I) + MOVEI T,"@ ;AT SIGN + TLNE W1,20 ;CHECK FOR INDIRECT BIT + PUSHJ P,TOUT +PI5: HRRZ T,LWT(I) + LDB W1,[(331100)LWT(I)] + CAIL W1,240 + CAILE W1,247 + PUSHJ P,SPAD + PUSHJ P,PADS3A +PI7: TRZ F,NAF + LDB R,[(220400)LWT(I)] ;INDEX REGISTER CHECK + JUMPE R,PADS1 ;EXIT +PI7.1: XCT "(,CRF + MOVE T,R + PUSHJ P,PAD + MOVEI T,") + JRST,TOUT ;EXIT + +HLFW: TRO F,NAF + HLRZ T,LWT(I) + PUSHJ P,PAD + XCT ",,CRF + XCT ",,CRF + SKIPA T,LWT(I) +SPAD: AOS (P) +PAD: ANDI T,777777 ;PRINT ADDRESS + JRST @AR ;PADSO OR PAD1 +PADSO: JUMPE T,TOC2+1 + PUSHJ P,LOOK +PADS1: POPJ P,0 + MOVE W2,1(W1) + CAIGE T,100 + CAIGE W2,60 + JRST,PADS3 + MOVEM T,TEM(I) + JUMPE W1,PAD1 + PUSHJ P,SPT + XCT "+,CRF +PADS2: HRRZ T,TEM(I) +PAD1: JRST,TOC ;EXIT + +PADS3: MOVE T,TEM(I) +PADS3A: TRNE F,NAF + CAIGE T,776000 + JRST TOC +PADS3B: MOVNM T,TEM(I) +PADS4: XCT "-,CRF + JRST,PADS2 + +INOUT: TDC T,[(,-1)400000] + TDCN T,[(,-1)400000] + JRST PADS3B + HLRZ R,T + CAILE R,(CONO 774,@) + JRST HLFW + AND T,[(700340)] + PUSHJ P,LOOK + JRST,.+2 + JRST,HLFW + PUSHJ P,TSPC + MOVE T,LWT(I) + AND T,[(77400)] +INOUT1: JUMPE T,PI4 ;USED BY "WORD" + PUSHJ P,LOOK ;LOOK FOR DEVICE NUMBER + JRST,PI3A + MOVE T,TEM(I) + LSH T,-30 + PUSHJ P,TOC + JRST,PI3A + +MASK: TLNE F,QF + JRST,MASK1 + MOVEI T,MSK + ;$NB ENTRY (WHERE N SPECIFIED, LOCATION NOT) +MASK2: MOVEI W,1 + MOVEM W,FRASE1 + JRST QUAN1 +MASK1: MOVEM T,MSK + JRST,RET + +OVRD: MOVSI B,-5 +OVRD1: MOVE R,MSKTB(B) + AND R,LWT(I) + TDNN T,MSKTB(B) + IOR T,R + AOBJN B,OVRD1 +OVRD2: CLEARM FRASE + TLZ F,TIF + CLEARM WRD + JRST MASK2 + +MSKTB: 777000,, + 0 17,0 + @ + (17) + ,-1 + +EFFEC: TLO F,LTF + HRRZ T,T +AWORD: SKIPA W,INOUT1 ;JUMPE T, +NWORD: MOVSI W,(JUMPN T,) + HLLM W,SEAR2 + +SEARC: TLZN F,QF + JRST,ERR + SETCAM T,WRD + MOVE T,[EQV T,WRD] + TLNE F,LTF + MOVE T,[JRST SEAR2B] + MOVEM T,SEARMD + MOVSI T,-5 + SETCMM FRASE(T) ;PREVENT TYPEOUT + AOBJN T,.-1 + MOVE T,ULIMIT + TLNE F,SAF + TLO F,QF + PUSHJ P,SETUP1 + PUSHJ P,CRF +SEAR1: TRNN R,777760 ; Looking at ACs? + JRST SEAR1A ; Yes: Be slow + MOVE T,(R) ; No: Be fast +SEAR1B: +SEARMD: EQV T,WRD + AND T,MSK +SEAR2: JUMPE T,SEAR3 ;OR JUMPN T +SEAR2A: TRNN R,77 ; LISTEN every 100 times + JRST SEAR2D +SEAR2E: AOBJN R,SEAR1 ; Loop until LH positive... + TLNE R,-1 ; And just how did that happen? + JRST SEAR1 ; It was already positive +SEAR2C: SETCMM LWT(I) ; Counted up to 0: Done + JRST,DD1 + +SEAR2D: PUSHJ P,LISTEN + JRST SEAR2E + JRST SEAR2C + +SEAR1A: PUSHJ P,FETCH + JRST SEAR2A + JRST SEAR1B +SEAR2B: PUSHJ P,EFFEC0 + JRST SEAR2A + EQV T,WRD + ANDI T,777777 + JRST SEAR2 + +SEAR3: PUSHJ P,FETCH + JRST ERR + MOVEM T,LWT(I) + MOVEM R,TEM2 + MOVEM R,T + HRRZM R,LLOCO + PUSHJ P,PLOC + PUSHJ P,PAD + XCT "/,CRF ;SLASH + PUSHJ P,LCT + MOVE T,LWT(I) + PUSHJ P,CONSYM + PUSHJ P,CRF + SETCMM LWT(I) + SETCMM TEM(I) +SEAR4: MOVE R,TEM2 + JRST, SEAR2D + +EFFEC0: MOVEM R,TEM2 ;CALLED BY SEARCH AND $\ + MOVEI W,100 + MOVEM W,TEM(I) +EFFEC1: MOVE W,T + LDB R,[(220400)T] + JUMPE R,EFFEC2 + HRRZ T,AC0(R) + ADD T,W +EFFEC2: HRR R,T + TLNN W,20 ;INDIRECT BIT CHECK + JRST EFFEC3 + SOSE TEM(I) + PUSHJ P,FETCH + JRST EFFEC4 + JRST EFFEC1 +EFFEC3: AOS (P) +EFFEC4: MOVE R,TEM2 + POPJ P, + +SETUP: TLO F,LTF ;ZERO +SETUP1: MOVEI T,1(T) + TLNN F,QF +SETUP2: HRRZ T,ESTU + HRRM T,ULIMIT + HRRZ R,DEFV + TLNN F,FAF + MOVEI R,0 + CAML R,ULIMIT + JRST ERR + MOVEM R,DEFV + MOVE W,R + SUB W,ULIMIT + HRLM W,R + POPJ P,0 + +ZERO: JUMPGE F,ERR + PUSHJ P,SETUP +ZERO1: TRNE R,777740 ;R AOBJN PNTR TO CORE TO CLEAR + JRST,ZERO2 ;T UPPER LIMIT (LAST LOC TO CLEAR+1) + TRNN R,20 ;DONT Z 20-37 + CLEARM,AC0(R) + AOBJN R,ZERO1 + TLNE R,-1 + JRST ZERO1 + JRST,DD1A +ZERO2: HRRZ S,@JOBSYM ;ONLY CLEAR CORE BELOW SYMBOL TABLE + CAILE T,(S) ;(JUST ASSUME IT'S A MOBY DDT) + MOVEI T,(S) + SETZM (R) + HRLS R + AOS R + BLT R,-1(T) + +; HRRZ S,T +; HRRZ W,@JOBSYM +; CAIL S,(W) +; MOVEI S,(W) +; CAILE S,(R) +; JSP W,ZEROR +; HRRZ R,R +; CAIG R, PS +; MOVEI R, PS +; HRRZ S,T +; CAMLE S, R +; JSP W,ZEROR + JRST,DD1A + +;ZEROR: HRL R,R +; CLEARM,(R) +; ADDI R, 1 +; BLT R, -1(S) +; JRST,(W) + +FTOC: +TOC: HRRZ W1,ODF + CAIN W1,12 + JRST, TOC4 +TOCA: LSHC T,-43 + LSH W1,-1 ;W1=T+1 +TOC1: DIVI T,@ODF + HRLM W1,0(P) +TOC3: JUMPE T,TOC2 + PUSHJ P,TOCA +TOC2: HLRZ T,0(P) + ADDI T,"0 +CJTOUT: JRST,TOUT ;DOES POPJ TO TOC2 OR EXIT + +TOC4: MOVM W1,T + JUMPGE T,TOC5 + XCT "-,CRF +TOC5: MOVEI T,0 + PUSHJ P,TOC1 +TPER: MOVEI T,". + JRST TOUT + +SPT: MOVE T,CJTOUT + MOVEM T,SPTS(I) + MOVE T,0(W1) ;SYMBOL PRINT + MOVEM W1,DSSAV(I) + TLZ T,740000 +SPT1: IDIV T,[50*50*50*50*50] + PUSHJ P,SPT2 + MOVE T,W1 + IMULI T,50 + JUMPN T,SPT1 + POPJ P, + +SPT2: ADDI T,260-1 + CAILE T,271 + ADDI T,301-272 + CAILE T,332 + SUBI T,334-244 + CAIN T,243 + MOVEI T,256 + XCT SPTS(I) + POPJ P, + +BRKRET: PUSHJ P,REMOVB +TTYRET: +dpy340,[ + CONI DIS,T + DPB T,[600,,DRESET] +];dpy340 +IFN LPTP,[ + CONI LPT,T + DPB T,[300,,LPTRST] + SKIPE LPTFLG + CONO LPT,10 +] +TTYRT: MOVEI T,10 +dpy340, MOVSM T,DISDON +ka,[ + CONI TTY,SAVTTY + CONO TTY,400000(T) +];ka +dpy340, PUSHJ P,DISINI + XCT TTYRT +TTY1: +ka,[ + MOVEI W2,40000 ;WAIT FOR LAST CHR TO BE TYPED (SO LOSERS PRGM DOESNT + CONSZ TTY,120 ;GET AN INTERRUPT.. + SOJG W2,.-1 + CONI TTY,W2 + XOR W2,SAVTTY + ANDI W2,10 ;ATTEMPT TO RESTORE STATE OF OUTPUT DONE FLAG + XORM W2,SAVTTY + DATAI TTY,W2 + HRLM W2,SAVTTY + CONO TTY,3400(T) +; CONO TTY,400000(T) ;MORE PDP6 TK KLUDGE WINNAGE +];ka + POPJ P, + +TTYLEV: +dpy340,[ + MOVS T,DISDON + CAIN T,@TTYRT + JRST .+3 +DRESET: CONO DIS,100 + DATAO DIS,[3000] +];dpy340 +IFN LPTP,[ + SKIPE T,LPTRST + CONO LPT,10(T) +] +ka,[ + MOVE T,SAVTTY + ANDI T,17 + TRNN T,10 + TRO T,200 +];ka + JRST TTY1 + +subttl variable area + +WRD: 0 +WRD2: 0 +PRNC: 0 +FRASE: 0 +SYL: 0 +DEN: 0 +ZLWT: 0 +TEM2: 0 +LPTRST: 0 +LPTFLG: 0 +TTYFLG: -1 +ESTU: LOW +ESTUT: LOW +FSV: 0 +FRACT: 0 +FPWR: 0 +FTERM: 0 +FH: 0 +;FL: 0 +SYM: 0 +DEFV: 0 +ULIMIT: 0 +LLOC: 112 ;CURRENT LOCATION +LLOCO: 0 +PLCR: 0 +LOCBF: BLOCK NLEVS + +DIS1: +ACSTG: BLOCK 10 +INST: 0 +LWT: 0 +TEM: 0 +TEM1: 0 +PRGM: -NSYMS+2,,LOW+2 +DSSAV: SYM +OUTSW: 0 +SPTS: JRST TOUT +ALTPC: 0 ;NON-ZERO MEANS ALT-P JUMPS THERE +ALTPC1: 0 + +dpy340,[ +DISSW: MOVE T,@-1(P) +];dpy340 + +SATPP: .+1 +SATPT: 0 + +dpy340,[ +DIS2: +DISACS: BLOCK DIS2-DIS1-6 + SYM + DISAD + JRST TOUT + MOVSI T,(TRNA#CONSZ#CONSO) + .+1 + 0 +];dpy340 + +HIGH: MEMSIZ-1 + +SAVPI: 0 + 1177 +SAVTTY: 0 + +MSK: -1 ;INITIAL MASK FOR WORD SEARCHES +B0ADR: REPEAT 3,0 ;FOR $0B, MUST BE SPECIFIED TO BE USED (NOT SET BY + ; LOC$B, NOT CLEARED BY $B) +B1ADR: 0 +B1SKP: 0 +B1CNT: 0 ;ONE MORE THEN # TIMES TO IGNORE ENCOUNTER OF THIS BPT + +REPEAT NBP*3-3, 0 + +IFN 1PRSW,[ +TB1ADR: 0 ? 0 ? 0 +TB2ADR: 0 ? 0 ? 0 +];1PRSW +BNADR=.-3 +AUTOPI: 0 ;1_N ON IF LOC$$B TYPED, ON MEANS PRECEED AFTER + ; TYPING BPT MSG, UNTIL CHAR. TYPED AT TTY + +INFORM SAVED ACS AREA,\. ;FOR CRASH XFILE +AC0: BLOCK 17 +AC17: 0 +SWAP,TWENTY: BLOCK LOWFIX-20 ;DON'T MOVE FROM HERE + +SCH: 0 +AR: 0 +ODF: 0 +SCHM: PIN ;THESE 3 LOCATIONS BLT'D INTO PRECEDING 3 LOCATIONS DURING SAVE +ARM: PADSO +ODFM: 10 +SARS: 0 ;NON-ZERO IF STUFF SAVED (USED BY SAVE) +FRASE1: +TEM3: 0 +INSW: 0 + +dpy340,[ +DISCNT: 0 +DISPN1: 0 +];dpy340 + +subttl save + +SAVE: 0 + SKIPN SARS ;IF CRUD NOT ALREADY SAVED, + JRST SAV1 ;THEN GO SAVE IT, + AOS SAVE ;OTHERWISE AOS RETURN POINT, + JRST SAV5 ;AND SAVE MINIMALLY + +SAV1: +NTS,[ + CONI PRS,SAVPI + CONO PRS,@SAVPI+1 +];NTS + MOVEM 17,AC17 + HRRZI 17,AC0 + BLT 17,AC0+16 + MOVE T,SAVE + HLLM T,SAVPI +SAV5: SETOM SARS ;INDICATE CRUD SAVED + MOVEI P,PS ;INITIALIZE PDL POINTER + MOVE F,[SCHM,,SCH] + BLT F,ODF + CLEARB F,I ;CLEAR FLAGS AND I + JRST @SAVE + + + ;SEE LOW CODE FOR RESTORE + +TATP: TLZE F,QF + SKIPN T + JRST ERR + MOVEI W,36. + DPB T,[300600,,SATPP] +dpy340, DPB T,[300600,,SATPP+DIS2-DIS1] + IDIV W,T + MOVEM W,SATPC + JRST RATP + +SATP: MOVEI W,44 + DPB W,[360600,,SATPP(I)] + MOVE W,SATPC + MOVEM T,SATPT(I) +SATPL: ILDB T,SATPP(I) + PUSHJ P,TOC + PUSHJ P,TSPC + SOJG W,SATPL + POPJ P, + +SATPC: 0 + +subttl command dispatch table + +BDISP: (301400+R)DISP + (141400+R)DISP + (1400+R)DISP + +DISP: .BYTE 12. +DEFINE ZD A,B,C + A-DDT + B-DDT + -DDT+C +TERMIN + +ZD ERR,ERR,L2 ; +ZD DS,ERR,L2 ;^C,, +ZD LISTF0,ERR,ERR ;,, +ZD TAB,LINEF,ERR ;TAB,LF, +ZD ERR,CARR,CTLN ;FORMF,CR, +ZD ERR,ERR,ERR ;,, +ZD ERR,ERR,ERR ;,, +ZD ERR,L2,L2 ;,, +ZD ERR,ERR,ERR ;,, +ZD CONTROL,ERR,ERR ;,^\,^] +ZD ERR,ERR,SPACE ;^^,^_,SP +ZD DIVD,DQUOTE,ASSEM ;!,",# +ZD DOLLAR,PERC,R50PNT ;$,%,& +ZD SQUOTE,LPRN,RPRN ;',(,) +ZD MULT,PLUS,ACCF ;*,+,, +ZD MINUS,PERIOD,SLASH ;-,.,/ +ZD NUM,NUM,NUM ;0,1,2 +ZD NUM,NUM,NUM ;3,4,5 +ZD NUM,NUM,NUM ;6,7,8 +ZD NUM,TAG,DEFIN ;9,:,; +ZD FIRARG,EQUAL,ULIM ;<,=,> +ZD ASLASH,INDIRECT,ABSA ;?,@,A +ZD BPS,CON,SDEC ;B,C,D +ZD EFFEC,SFLOT,GO ;E,F,G +ZD HWRDS,PILOC,ERR ;H,I,J +ZD KILL,LOAD0,MASK ;K,L,M +ZD NWORD,SOCT,PROCEDE ;N,O,P +ZD QUAN,RELA,SYMBOL ;Q,R,S +ZD TATP,DECDMP,DISF ;T,U,V +ZD AWORD,XEC,DUMP0 ;W,X,Y +ZD ZERO,OCON,ICON ;Z,[,\ +ZD OSYM,VARRW,PSYM ;],^,_ + + .BYTE + +DECDMP: +ka,[ + CONSZ TTY,20 ;ALLOW LAST CHAR TYPED TO APPEAR ON PAPER SO CANT BE CLOBBERED +dpy340, PUSHJ P,DISCFT ;BY IO RESET +nodpy, JRST .-1 +];ka +KL,[ CONSO PAG,600000 ;FLUSH CACHE IF NECC. + JRST MACDMP + SWPUA + CONSZ 200000 + JRST .-1 + CONO PAG,0 +] + JRST MACDMP + +IFIX: SKIPLE T,JOBSYM ;IF JOBSYM POSITIVE, + JRST DDT ;THEN CONTROL SHOULDN'T HAVE COME TO HERE TO BEGIN WITH + MOVE R,(T) ;GET POINTER TO SYMS + JUMPN T,IFIX1 ;JUMP IF SYMS ADDED + MOVE R,KILC ;INITIAL SYMS POINTER + MOVEM R,DDT-2 ;SET UP SYM POINTER + MOVEI T,DDT-2 +IFIX1: HRRZM T,JOBSYM ;INDICATE LOCATION OF SYMS POINTER + HRRZM R,ESTU + HRRZM R,ESTUT + MOVSI T,PNAME + TDNN T,(R) + ADD R,[(2)2] + MOVEM R,PRGM +; CONI TTY,T ;THIS HACK IS FOR THE KNIGHT MULTIPLE TTY KLUDGE ON THE PDP6!! +; ANDI T,170000 ;MAY IT REST IN PEACE +; IORI T,10 +; HRRM T,TTYRT ;CONO TO TTY + JRST DDT + +CONSTANTS + +DDTEND: +INFORM [HIGHEST USED]\.-1 + +END DDT diff --git a/system/ddtdsk.31 b/system/ddtdsk.31 new file mode 100644 index 0000000..f030f6f --- /dev/null +++ b/system/ddtdsk.31 @@ -0,0 +1,1117 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;AC's used by disk routines + +da=11 ;used mostly for argument passing +db=12 +dc=13 +dd=14 ;dd>=0 if file open else reason why file is closed + +nudsl==500. ;# user directory slots in M.F.D. + +;file system parameters and RH10/RP04 parameters + +ifn dsksw-3, .err Only RH10 disk is supported +.insrt system;rh10 +.insrt system;fsdefs + +icwa==20 ;initial channel control word +lowfix==icwa+2 ;lowest fixed loacation +blksiz==2000 ;# words in disk block +maxtry==10 ;# times to try disk transfer before hard failure assumed +maxlnk==20 ;maximum # of links +;ntutbl== ;# pages necessary to store a TUT +swpags==ntutbl+4 ;# pages swapped to disk (mfd, ufd, io bfr, core bfr and tut) +swpblk==tblks-swpags ;first disk block used for core swapping +bootbl==swpblk-4 ;four disk blocks to save ddt for fast booting +mfd=lowcod-blksiz ;mfd origin +ufd=mfd-blksiz ;ufd origin +corbfr=ufd-blksiz ;core buffer origin +iobfr=corbfr-blksiz ;io buffer origin +tut=iobfr- + ;tut goes last +lowswp==lowcod- + ;lowest location swapped +ifn tut-lowswp, .err lowswp loses +maxdmp==200 ;largest dump block allowed +lowclr==40 ;lowest location zeroed when ddt loads + +;template for datao's that cause disk transfers + +rdatao==%hrctl\%hrlod,,%hmred\> +wdatao==%hrctl\%hrlod,,%hmwrt\> + +kl, swpua=701540,,0 + +;bug halt for bugs +;error halt for error conditions beyond capabilities of program + +define errhlt + jrst 4,. +termin + +define bughlt + jrst 4,. +termin + +dskcod==. + + +;lowest level io + +;calculates Physical Disk Address and sets up Channel Command List + +pdaccl: pushj p,rp4map ;caluculate physical disk address + skiple w1,ioadr ;first word to be transferred + caige w1,17 ;don't try transfer from or to shadow AC's + bughlt + subi w1,1 ;iowd format +ka, hrli w1,-blksiz ;# words in block +.else hrli w1,-blksiz_4 +pdacc2: movem w1,icwa ;transfer data (iowd) + setzm icwa+1 ;DF10 writes here for termination + popj p, + +;calculates RP04 cylinder, surface, and sector given block # + +rp4map: skipl w1,da ;the block # + cail w1,tblks ;check for reasonable block # + bughlt + idivi w1,nblksc ;blocks/cylinder + movem w1,cylndr + imuli w2,secblk ;sectors/block + move w1,w2 ;sector # on this cylinder + idivi w1,nsecs ;sectors/surface + movem w1,surfce + movem w2,sector + popj p, + +;transfers disk block + +redblk: skipa db,[rdatao] ;the beginnings of a datao (go bit is on) +wrtblk: move db,[wdatao] +rwblk: pushj p,pdaccl ;calculate physical disk address, set up CCL +rwblk0: move w1,drive ;fill in the desired drive + skipn qact(w1) ;make sure is good drive + jrst rwblkl + dpb w1,[$hcdrv db] + setzm xfrcnt ;count times through loop +rwblk1: pushj p,xfer ;transfer the data + aosa w1,xfrcnt + popj p, ;transfer succeeded, don't try again + caig w1,maxtry + jrst rwblk1 +rwblkl: move w1,drive + hrroi dd,'UN0(w1) + jrst fserr + +xfer: consz dsk,%hibsy ;wait for controller to finish + jrst .-1 + datao dsk,[%hrrae\%hrlod,,377];flush any rae's that may be there + cono dsk,%hoclr\%horae ;flush any left overs and plunge on +kl,[ consz pag,600000 + swpua ;sweep the cache + consz 200000 ;apr, + jrst .-1 +] + movsi w1,%hrsts ;get the drive status + jsp t,rhget ;will popj on error + trnn w1,%hserr ;any drive errors + jrst xfer2 ;drive is okay plunge on + +;detected drive error before data xfer, try to reset drive if possible + + trc w1,%hsvv\%hsmol\%hsrdy ;check for all ready bits on + trce w1,%hsvv\%hsmol\%hsrdy + popj p, ;not ready, transfer fails +xfer2: movsi w1,%hrcyl ;set cylinder + hrr w1,cylndr + jsp t,rhset + move w1,surfce ;set sector and track + lsh w1,10 + ior w1,sector + hrli w1,%hradr + jsp t,rhset + datao dsk,db ;zap + conso dsk,%hidone ;wait for transfer to finish + jrst .-1 + conso dsk,%hierr ;errors? + aos (p) ; no + popj p, ; yes + +;rhset and rhget are used to read and write device registers on Massbus +;They are called with jsp t, but popj if they fail. Beware!!! + +rhset: tloa w1,%hrlod ;load register +rhget: tlz w1,%hrlod ;just read register + tso w1,drive ;put in drive # + datao dsk,w1 + movei w1,6 ;delat for massbus + sojg w1,. + datai dsk,w1 + tlne w1,%hderr ;covers the multitude of sins + popj p, ;failed + jrst (t) ;success + +;routines to read and write special disk blocks + +swpin: skipl blkin ;skip if no core buffer + pushj p,swpbfo ;swap the buffer out first + pushj p,swpi1 ;do all disk transfers necessary + move c,[twenty,,20] ;restore old stuff at icwa + blt c,lowfix-1 + setob c,blkin ;also used as no blocks in flag + popj p, + +swpout: movs c,[twenty,,20] ;try and save a literal + blt c,ac0+lowfix-1 ;save stuff used by icwa + skipa c,[wrtblk] +swpi1: movei c,redblk + movei b,lowcod ;starting at this core address + move a,mu + movem a,drive ;always use master unit for swapping + movei a,swpags-1 ;block counter +swpio: movei b,-blksiz(b) + movem b,ioadr + movei da,swpblk(a) + pushj p,(c) ;call either redblk or wrtblk + sojge a,swpio + movei c,/blksiz +swpbfp: movem c,blkin ;block that is swapped in + skipge da,c + bughlt ;no blocks are swapped out + imuli da,blksiz + addi da,lowswp ;virtual address of first word in corbfr + movem da,swporg + addi da,blksiz-1 ;virtual address of last word in corbfr + movem da,swpor1 + popj p, + +;here to swap core block in and set up pointers + +swpbfi: pushj p,swpbfp ;set buffer pointers + skipa b,[redblk] + +;swaps out the block in corbfr + +swpbfo: movei b,wrtblk + skipge c,blkin ;index of block we want + bughlt + movei da,corbfr ;core address for transfer + movem da,ioadr + move da,mu ;swapped from and onto master unit + movem da,drive + movei da,swpblk(c) ;block # to read + jrst (b) ;transfer the block + +nxttut: aos c,cu ;try next tut + cail c,ndsk + setzb c,cu + skipn qact(c) + jrst nxttut +redtut: skipa c,[redblk] +wrttut: movei c,wrtblk + movei b,tut+ + move a,cu ;tut goes on current unit + movem a,drive + movei a,ntutbl-1 +tutio: movei b,-blksiz(b) + movem b,ioadr + movei da,tutblk(a) + pushj p,(c) + sojge a,tutio + popj p, + +redmfd: movei da,mfdblk + movei b,mfd +mfdufd: movem b,ioadr + move b,mu ;read from master unit + movem b,drive + jrst redblk + +redufd: move da,ufdblk ;where ufd is + movei b,ufd + jrst mfdufd + +wrtufd: move da,ufdblk ;ufd is written on all units + movei b,ufd + movem b,ioadr + move a,cu ;start with current unit + movem a,drive +wrtuf1: skipe qact(a) + pushj p,wrtblk + aos a,drive + cail a,ndsk + setzb a,drive + came a,cu + jrst wrtuf1 + popj p, + +; Reset the disks + +reset: coni pag,b ;turn off paging + trz b,060000 + cono pag,(b) + movei b,ndsk-1 +reset0: movem b,drive + skipe qact(b) ;skip unit if turned off + pushj p,reset1 + sojge b,reset0 + move b,mu ;is master unit active? + skipe qact(b) + popj p, + movei b,ndsk-1 ;no, pick an active unit for mu + skipn qact(b) + sojge b,.-1 + jumpl b,resetl ;"UN/" mumble + movem b,mu + popj p, + +reset1: pushj p,reset3 ;poptj if win +resetl: hrroi dd,'UN0(b) ;popj if lose + jrst fserr + +reset3: cono dsk,%hoclr\%horae + datao dsk,[%hrrae\%hrlod,,377] + movei w1,%hmclr + jsp t,rhset + movei w1,%hmrdp + jsp t,rhset + movsi w1,%hrofs + jsp t,rhset + movei w1,%hmack + jsp t,rhset + movsi w1,%hrsts + jsp t,rhget + trne w1,%hserr + popj p, + trc w1,%hsvv+%hsmol+%hsrdy + trcn w1,%hsvv+%hsmol+%hsrdy + jrst poptj ;win + popj p, + +;file system routines + +;lookup -- call with file names and sname in fn1, fn2, and sname +;fails if dd<0 otherwise returns user directory index in dd +;dirpt is set up as byte pointer into descriptor area +;if lookup found a link then lnkcnt will be non-zero and lnkufd and lnkptr +;will contain block # of ufd and name area index respectively of +;first link in chain fn1, fn2, and sname are clobbered file at end of chain + +lookup: setzm lnkcnt ;link counter + pushj p,redmfd ;read the mfd + move t,mfd+mdchk + came t,[sixbit /M.F.D./] + errhlt ;how can this be the mfd? + move t,mfd+mdnuds + caie t,nudsl ;make sure there are enough directory slots + errhlt ;this still doesn't look like an mfd +linklk: skipn t,sname ;entry point for link solver + jrst look1b + move db,mfd+mdnamp ;pointer to mfd name area +look1a: camn t,mfd+mnunam(db) + jrst look2 ;found directory in mfd + addi db,lmnblk ;next slot in mfd + caige db,blksiz + jrst look1a +look1b: hrroi dd,'NXD ;directory slot not found + popj p, + +;found the ufd slot, pointer in db + +look2: lsh db,-1 + movei da,(db);magic + movem da,ufdblk ;save address of ufd + move t,sname + camn t,ufd+udname + jrst look3 ;don't read ufd unless we have to + pushj p,redufd ;read ufd from master disk + move t,sname ;check for right one + came t,ufd+udname + errhlt ;this is not it +look3: move dd,ufd+udnamp ;pointer to name area + skipn da,fn1 ;search user directory + popj p, ;just getting dir, return now + move db,fn2 + movsi dc,unigfl ;deleted or open for writing +ulook: camn da,ufd+unfn1(dd) ;file name match? + came db,ufd+unfn2(dd) + jrst ulook1 + tdnn dc,ufd+unrndm(dd) ;file names match + jrst ulook2 ;found file +ulook1: addi dd,lunblk ;advance to next file + caige dd,blksiz + jrst ulook + hrroi dd,'FNF ;file not found + popj p, + +;found file, set up pointer into descriptor area, and get tut in core + +ulook2: pushj p,ufdbp ;make ufd descriptor byte pointer + movem da,dirpt + movsi da,unlink + tdne da,ufd+unrndm(dd) ;is this a link? + jrst ulink ; yes, call link solver + ldb dc,[unpkn ufd+unrndm(dd)] + setzm cu +ulook3: pushj p,nxttut + camn dc,tut+qpknum + jrst ulook4 + skipe cu + jrst ulook3 + hrroi dd,'NSP ;no such pack + popj p, + +ulook4: setzm lblock ;last block accessed + setzm blkcnt ;forces next descriptor byte + setzm wrdcnt ;forces buffer reload + popj p, + +;returns byte pointer into descriptor area in da, clobbers db + +ufdbp: ldb da,[undscp ufd+unrndm(dd)] + idivi da,ufdbyt ;convert ufd character address into byte pointer + imuli db,-10000*ufdbyt + hrli da,440000+(db) + addi da,ufd+uddesc ;origin of ufd descriptor area + popj p, + +;link solver + +ulink: skipe lnkcnt ;first link + jrst ulink1 ; no + movem dd,lnkptr ;save pointer to first one + move t,ufdblk + movem t,lnkufd +ulink1: aos t,lnkcnt + caile t,maxlnk ;too many links + jrst [ hrroi dd,'TML + popj p,] + pushj p,redlnk ;read the link name + jrst linklk + +redlnk: setzm sname + setzm fn1 + setzm fn2 + move dc,[440600,,sname] ;read file name from descriptor area +linkl: ildb t,dirpt + cain t,'; ;directory name? + jrst links + cain t,': + jrst [ ildb t,dirpt ;: quotes next character + idpb t,dc + jrst link1] ;allows blanks in file names + idpb t,dc + jumpe t,cpopj ;jump if finished reading link +link1: came dc,[000600,,fn2] ;finished? + jrst linkl + popj p, ;end of link + +;found ";" in file name + +links: tlnn dc,770000 ;align byte pointer on word boundary + jrst link1 + ibp dc + jrst links + +fsdele: pushj p,lookup ;find the file + jumpl dd,cpopj ;jump if we're losing + pushj p,zapdsc ;zap descriptor area + setzm ufd+unfn1(dd) + setzm ufd+unfn2(dd) + setzm ufd+unrndm(dd) + skipn lnkcnt ;don't write if link + pushj p,wrttut ;write the tut + jrst wrtufd ;write the ufd out on all units + +;zap file descriptor + +zapdsc: setzm blkcnt ;make plenty damn sure + skipn lnkcnt ;if there were no links + jrst zaprf ; then zap real file + +;zap link descriptor + + move da,lnkufd ;fetch the original ufd + pushj p,redufd + move dd,lnkptr ;pointer to file + movsi da,unlink ;test for link + tdnn da,ufd+unrndm(dd) + bughlt ;hmmm, it said it was a link + pushj p,ufdbp ;get byte pointer to descriptor area + push p,da ;save beginning byte pointer + movem da,dirpt ;grist for redlnk + pushj p,redlnk + skipa +zaplop: pop p,dd ;entry point from zaprf + pop p,da ;beginning of descriptor area + setzb db,blkcnt ;clear blkcnt set by advblk +zapl1: idpb db,da ;zero out descriptor + came da,dirpt ;caught the end yet? + jrst zapl1 + popj p, + +;zap real file descriptor + +zaprf: jumpl dd,cpopj ;if file not found then give error return + movsi da,unlink ;test for link + tdne da,ufd+unrndm(dd) + bughlt ;it should not be a link + +;update tut before zapping descriptor area + + push p,dirpt ;save pointer to beginning + push p,dd ;save pointer to name area in ufd +zaprf1: pushj p,advblk ;gets next block in da + jumpl dd,zaplop ;now zap descriptor area + pushj p,tutpnt ;returns tut byte pointer in da + ldb db,da ;tut entry + caige db,tutlk-1 ;block locked for some reason + sojl db,[bughlt] + dpb db,da ;clobber tut + jrst zaprf1 + +;opens file for output + +outopn: pushj p,lookup ;does version of file already exist? + skipn lnkcnt + jumpl dd,outo1 ;not necessary to zap descriptor area + skipn lnkcnt ;if its a link, we must make sure ufd and tut are in + jrst outo01 ; not a link all the good stuff is together + jrst pikpak ;not necessary to find a free directory slot + +;find free slot in ufd name area + +outo1: came dd,[-1,,'FNF] ;proceed only if file not in ufd + popj p, + move dd,ufd+udnamp ;start looking at beginning +outo11: skipn ufd+unfn1(dd) ;slot free? + jrst pikpak ; yes, pick-a-pack + addi dd,lunblk + caige dd,blksiz ;past end of ufd? + jrst outo11 ; no,try again + +;no free slots, try to extend name area down + + movni dd,lunblk + addb dd,ufd+udnamp + move da,ufd+udescp + idivi da,ufdbyt + addi da,uddesc+3 + caml da,ufd+udnamp ;did we run into descriptor area? + jrst [ hrroi dd,'FUL ;directory full + popj p,] + setzm ufd+unfn1(dd) ;clear out that file name + +;directory slot all set up, now decide which unit to write on (pick-a-pack) + +pikpak: move t,mu + movem t,cu + pushj p,redtut ;start searching on current unit + push p,cu ;unit we started on + push p,[0] ;# free blocks on best unit + push p,(p) ;# free blocks on this unit + push p,cu ;best unit so far +piknxt: setzm -1(p) ;# free blocks on this unit + move dc,tut+qfrstb + ;following lines commented out so that files will be written in swap area + ;thus avoiding Y files when dumping crashes. When sys comes up will get copied. + ;camge dc,tut+qswapa ;first track beyond swapping area + ;move dc,tut+qswapa + move da,dc + sub da,tut+qlastb + hrl dc,da ;aobjn pointer +piknx1: movei da,(dc) ;block # + pushj p,tutpnt ;byte pointer to tut entry + ldb da,da + skipn da + aos -1(p) ;found a free block + aobjn dc,piknx1 ;counted all free blocks on pack yet? + move da,-1(p) ;# free blocks on this pack + camg da,-2(p) ;more blocks on this one + jrst piknx2 ; no, advance to next tut + movem da,-2(p) + move db,cu + movem db,(p) ;this is best so far +piknx2: pushj p,nxttut ;try next tut + move db,cu + came db,-3(p) ;have we gone around the packs + jrst piknxt ; no, go to next unit + pop p,cu ;this unit won + sub p,[3,,3] ;clean up stack + pushj p,redtut ;read in tut from current unit + skipn lnkcnt ;if a link, then get ufd in + jrst outo0 ;was not a link, ufd is already there + move da,lnkufd + movem da,ufdblk + pushj p,redufd +outo0: skipe ufd+unfn1(dd) ;fresh file? + jrst outo01 ;no, zap descriptor area + move da,fn1 ;put in the file name + movem da,ufd+unfn1(dd) + move da,fn2 + movem da,ufd+unfn2(dd) + skipa +outo01: pushj p,zapdsc ;zap descriptor area + setzm blkcnt ;no contig blks taken yet + setzm lblock ;and start searching from beginning + setzm ufd+unrndm(dd) ;flush all random bits + move da,tut+qpknum ;pack # + dpb da,[unpkn ufd+unrndm(dd)] + setom ufd+undate(dd) ;clear date file created + move da,ufd+udescp ;first free byte in descriptor area + dpb da,[undscp ufd+unrndm(dd)] + pushj p,ufdbp ;turn him into a byte pointer + movem da,dirpt ;descriptor area byte pointer +outbuf: setzm iobfr ;clear io buffer + move da,[iobfr,,iobfr+1] + blt da,iobfr+blksiz-1 + jrst fsbfr ;set up buffer pointers and return + +tutpnt: skipge tut+qpknum + jrst [ hrroi dd,'OLD ;TUT must be old-format + jrst fserr ] + push p,db ;convert block no in da into ildb ptr to tut entry + camge da,tut+qlastb + camge da,tut+qfrstb + jrst 4,. ;block number out of bounds + sub da,tut+qfrstb + idivi da,tutepw + imul db,[-10000*tutbyt] + hrli da,440000-tutbyt_14+tutbyt_6(db) + addi da,tut+ltiblk + pop p,db + popj p, + +;opens file for input + +inpopn: pushj p,lookup ;look that file up + jumpl dd,fserr ;file not found, tell him why +fsin: pushj p,advblk ;set up pointers for next block + jumpl dd,cpopj ;jump if eof + +;actually reads the next sequential block in file + +rfsblk: movei da,iobfr ;read into the io buffer + movem da,ioadr + move da,cu ;read from the current unit + movem da,drive + move da,lblock ;this is the block to read + pushj p,redblk ;read it +fsbfr: movei da,blksiz ;set up buffer pointers + movem da,wrdcnt ;count + move da,[444400,,iobfr] + movem da,wrdptr ;byte pointer + jumpge dd,cpopj ;jump if block came in okay + +;here for file system error, print error message and give up + +fserr: skipl dd + bughlt ;make sure we don't have total garbage + skipl blkin ;are there blocks swapped out? + pushj p,swpin ;yes, get them back into core + hrlz w1,dd ;get sixbit error message + pushj p,sixo1 ;sixbit type out + jrst err + +;advances pointers for next block in file, returns next block in da + +advblk: sosl blkcnt ;take next sequential block? + jrst [ aos da,lblock ; yes, increment block number + popj p,] + ildb da,dirpt ;next descriptor byte + jumpe da,[ hrroi dd,'EOF ;end of file + popj p,] + movem da,blkcnt ;save block count just in case + caig da,udtkmx + jrst advblk ;take next blkcnt + caige da,udwph ;jump? + jrst advb0 ; no, skip some blocks and take one + cain da,udwph ;place holder? + bughlt ; yes, should not happen on read + subi da,udwph+1 + movei db,nxlbyt ;# bytes for jump address + movem db,lblock +fsjmp: ildb db,dirpt ;next descriptor byte + lsh da,ufdbyt ;accumulate + ior da,db + sosle lblock ;read enough bytes? + jrst fsjmp + movem da,lblock ;jump to that block + jrst advb01 ;and take next one + +advb0: subi da,udtkmx-1 + addb da,lblock ;skip da blocks +advb01: setzm blkcnt ;and take next one + popj p, + +;write block into file + +fsout: move dc,lblock ;save last block taken +fsout1: aos da,lblock ;and find next free block + ;following lines commented out so that files will be written in swap area + ;thus avoiding Y files when dumping crashes. When sys comes up will get copied. + ;camge da,tut+qswapa ;that lies within file area + ;move da,tut+qswapa + caml da,tut+qlastb + jrst [ hrroi dd,'DVF ;got whole way through + popj p, ] + movem da,lblock + pushj p,tutpnt + ldb db,da ;get corresponding tut byte + jumpn db,fsout1 ;not free, try next block + movei db,1 + dpb db,da ;claim it in tut + move da,lblock ;da := block # being written + subm da,dc ;dc := # blocks skipped + 1 + sojn dc,fsout2 ;fix dc and jump if not contiguous + aos dc,blkcnt ;add to contiguous group + caig dc,udtkmx + jrst fsout4 + movei db,udtkmx ;doesn't fit start new group + pushj p,ufdput + jumpl dd,cpopj + movei db,1 + movem db,blkcnt + jrst fsout4 + +fsout2: caile dc,udskmx ;maybe skip to it? + jrst fsout3 + skipe db,blkcnt + pushj p,ufdput + jumpl dd,cpopj + setzm blkcnt + movei db,udtkmx(dc) + pushj p,ufdput + jumpl dd,cpopj + jrst fsout4 + +fsout3: skipe db,blkcnt + pushj p,ufdput + jumpl dd,cpopj + setzm blkcnt + move db,lblock ;generate jump command + lshc db,-ufdbyt*nxlbyt + addi db,udwph+1 + pushj p,ufdput + jumpl dd,cpopj +repeat nxlbyt,[ + lshc db,ufdbyt + pushj p,ufdput + jumpl dd,cpopj +] + +fsout4: movei da,iobfr ;block is in ufd & tut. now write it + movem da,ioadr + move da,cu + movem da,drive + move da,lblock + pushj p,wrtblk + jrst outbuf + +;close the output file (writes ufds and tut) + +outeof: movni da,blksiz ;close file + addm da,wrdcnt + jsp t,acsav + skipge wrdcnt ;is buffer empty + pushj p,fsout ; no, write it + jumpl dd,outef1 ;don't update tut and ufd if problems + skipe db,blkcnt ;write any residual take-N code + pushj p,ufdput + jumpl dd,outef1 + aos ufd+udescp ;count one extra for zero block at end + pushj p,wrttut ;write the tut for this drive + pushj p,wrtufd ;write ufd on all drives +outef1: jsp t,acrest ;do some ac restoring here + jumpl dd,fserr + hrroi dd,'EOF ;this file is now closed + popj p, + +;put byte into ufd descriptor area, checks for directory full + +ufdput: idpb db,dirpt ;put byte into ufd + aos ufd+udescp + push p,da + movei db,0 ;throw in eof at end + move da,dirpt + idpb db,da + movei da,-ufd(da) ;word offset + caml da,ufd+udnamp ;did we flow into name area + hrroi dd,'FUL ; yes, give error indication + pop p,da + popj p, + +;gets one word into io buffer, reads next block if necessary + +wrdi0: jsp t,acsav ;save ddt ac's on stack + pushj p,fsin + jsp t,acrest ;restore ac's + jumpl dd,fserr ;tried to read past eof +wrdi: sosge wrdcnt + jrst wrdi0 ;buffer is empty read a new one + ildb d,wrdptr + popj p, + +;puts one word into io buffer, writes block if no more room + +wrdo0: movem d,dsktmp ;d=t + jsp t,acsav + pushj p,fsout + jsp t,acrest + skipa d,dsktmp ;restore d +dmpo: move d,(c) +wrdo: jumpl dd,fserr ;check for errors + sosge wrdcnt + jrst wrdo0 + idpb d,wrdptr + popj p, + +;ddt ac saving and restoring + +acsav: push p,a + push p,b + push p,c + push p,w1 + push p,w2 + jrst (t) + +acrest: pop p,w2 + pop p,w1 + pop p,c + pop p,b + pop p,a + jrst (t) + +;file name saving and restoring + +pushfn: push p,fn1 + push p,fn2 + push p,sname + jrst (t) + +popfn: pop p,sname + pop p,fn2 + pop p,fn1 ;restore file name + jrst (t) + +;load and dump routines + +dump: pushj p,reset + tlne f,ccf + jrst wboot + pushj p,getfil ;read a file name + jsp t,pushfn ;save old file names + pushj p,swpout ;make room for ufd, mfd, etc. + pushj p,outopn ;open file for output + jsp t,popfn ;and restore + jumpl dd,fserr ;jump if could not open file + +;ac usage +; b aobjn pointer for current block being dumped, rh is virtual address +; c real address of word to be dumped + + move d,[jrst 1] ;end of sblk loader + pushj p,wrdo + movei b,0 ;ac's are loaded and dumped! +dump1: pushj p,fd ;convert virtual address to real address + jrst dumpj ;went past end, write symbols and close + skipn (c) ;look for non-zero + aoja b,dump1 + hrrz a,@jobsym ;addr of lowest symbol + caml b,a + jrst dumpj ;all core done + move a,b ;save address of first non-zero + hrli b,-maxdmp ;keep size of dump block within reason +dump2: pushj p,fd ;calculate real address + jrst dump3 ;past end + skipe (c) ;look for zeros + jrst dump2a + aos b + pushj p,fd ;look ahead - block is ended by + soja b,dump3 ; two consecutive zeros + sos b + skipe (c) +dump2a: aobjn b,dump2 +dump3: hrrzm b,dmpnxt ;save next address to check + subm a,b ;negative block length + hrl a,b ;aobjn pointer to block + jumpge a,dumpj ;zero length block, must be all core done + move b,a + pushj p,dumpb + move b,dmpnxt ;start the next dump + jrst dump1 + +dumpb: pushj p,wrdoa ;a checksum, b aobjn ptr. write header +dumpb1: pushj p,fd ;calculate real address + bughlt ;can't fetch what we fetched before + pushj p,dmpo ;write word + rot a,1 ;checksum + add a,d + aobjn b,dumpb1 +wrdoa: move d,a + jrst wrdo ;write checksum + +;write starting address, symbols and close + +dumpj: move d,starta + hrli d,(jumpa) + pushj p,wrdo ;there goes starting address + move b,@jobsym + add b,[nsyms,,] ;don't punch builtin symbols + jumpge b,dumpj1 ;don't punch zero-length block + hllz a,b ;symbol block header has address=0 + pushj p,dumpb ;dump 'em all out +dumpj1: move d,starta ;starting address again + hrli d,(jumpa) + pushj p,wrdo + pushj p,outeof ;close the output file (writes ufds and tut) +dskex: pushj p,swpin ;swap real core back in + jrst dd1 ;crlf, close loc, ddt + +;load code + +load: pushj p,reset + tlne f,ccf + jrst load1 ;L merge core images + move a,kilc ;L flush the old symbols + movem a,@jobsym + movem a,prgm + setzm lowclr ; and clear core + move b,[lowclr,,lowclr+1] + blt b,-1(a) + setzm starta +load1: pushj p,getfil + jsp t,pushfn ;push file name + pushj p,swpout ;make space for dirs etc. + pushj p,lookup ;look him up + jsp t,popfn ;restore the file name + jumpl dd,fserr ;jump if file not found + pushj p,wrdi ;read first word + hrroi dd,'PDM + jumpe d,fserr ;can't read pdumped files + tdza dd,dd +load2: pushj p,wrdi ;skip sblk loader + came d,[jrst 1] + jrst load2 +load3: tlnn f,cf + jrst dskex ;after loading block of symbols + pushj p,wrdi + jumpge d,loads ;jump for starting address + move a,d ;set up ac's to load block + move b,d +load4: pushj p,wrdi ;read word + rot a,1 ;checksum + add a,d + pushj p,fd ;real address calculation + skipa ;ignore words that we can't wriet + movem d,(c) ;store word + aobjn b,load4 + pushj p,wrdi ;read checksum + camn a,d + jrst load3 +ckserr: hrroi dd,'CKS ;checksum error + jrst fserr + +;found starting address, hopefully there are some symbols there too + +loads: skipn starta ;only believe first start address seen + movem d,starta ;starting address + tlon f,ccf ;if L don't load symols +loadii: pushj p,wrdi ;else get symbol table pointer + jumpge d,dskex ;no symbol table in file or not to be loaded + trne d,-1 ;block type 0? + jrst loadi ;no, skip other brain-damaged info + movs b,d + hrli b,-1(b) ;compensate for carry + addb b,@jobsym ;subtract new symbol table size from both halves + movem b,prgm + hll b,d ;make aobjn ptr to new block of symbols + move a,d ;init checksum + tlz f,cf ;make sure only to load one block + jrst load4 ;go load 'em up (ccf now on so no read past eof) + +loadi: hlro b,d ;minus number of words to skip (also checksum) + pushj p,wrdi + aojle b,.-1 + jrst loadii ;try for next block of crud + +;takes virtual address in right half of b, returns real address in c +;swaps in block in necessary + +fd: aos (p) ;skip return is default + movei c,(b) ;get virtual address + cail c,lowswp ;lowest location swapped + jrst fdhi ;word might be swapped out + caige c,lowfix ;perhaps an ac or in channel command list + addi c,ac0 + popj p, ;word alread in place + +;here if address might be swapped out + +fdhi: cail c,lowcod ;address in ddt? + jrst [ sos (p) ;take non-skip return + popj p,] + camle c,swporg ;virtual origin of swapped block + camle c,swpor1 ;highest virtual address swapped in + jrst fdswp ;block not swapped in +fdhi1: sub c,swporg + addi c,corbfr ;address of word in core + popj p, + +;must swap out corbfr and swap the appropriate block + +fdswp: push p,d ;d=t + jsp t,acsav ;save the ac's before we do this + push p,c ;the address inside block we want + pushj p,swpbfo ;swap the old buffer out + pop p,c + subi c,lowswp ;lowest location swapped + idivi c,blksiz ;get block to swap in + pushj p,swpbfi ;swap that block in + jsp t,acrest ;get ac's back + pop p,d + jrst fdhi1 ;set up real address in c + +; List Directory + +listf: pushj p,reset + tlzn f,qf + jrst listf1 + move t,[440600,,sname] + movem t,dsktmp + move t,[jrst listf2] + movem t,spts(i) + move t,sym + pushj p,spt1-1 +listf1: push p,swpout + setzm fn1 + pushj p,lookup ;get ufd + jumpl dd,fserr + move b,ufd+udnamp + move w1,sname +listf3: pushj p,sixo1 + pushj p,crf + pushj p,listen + cail b,2000 + jrst dskex ;end of dir or char typed + ldb t,[unpkn ufd+unrndm(b)] + pushj p,toc + pushj p,tspc + move w1,ufd+unfn1(b) + pushj p,sixo1 + pushj p,tspc + move w1,ufd+unfn2(b) + addi b,lunblk + jrst listf3 + +listf2: subi t,40 + idpb t,dsktmp + popj p, + +;nY write DDT on boot area unit n + +wboot: move t,syl ;get n + movem t,drive + movei da,bootbl + pushj p,rp4map ;set up disk addr + move t,kilc ;flush all but builtin symbols + movem t,prgm + movem t,@jobsym +ka, move t,[-10000,,ddt-4001] ;write out last 4 pages of low moby +kl, move t,[-10000_4,,ddt-4001] ;.. + movem t,icwa + setzm icwa+1 + move db,[wdatao] + pushj p,rwblk0 + jrst dd1 + +;PUSHJ P,GETFIL reads a file name, sets SNAME, FN1, FN2 +;clobbers a,b,db,t + +getfil: pushj p,tspc + skipa b,[sixbit/@/] ;default fn1 +getfl3: movem a,sname +getfl1: movei a,0 + move db,[440600,,a] +getfl2: pushj p,iin + subi t,40 + jumple t,getfl4 ;break + cain t,'; + jrst getfl3 ;sname + tlne db,770000 + idpb t,db + jrst getfl2 + +getfl4: jumpe a,getfl5 ;leading space + exch a,b + jumpe t,getfl1 ;space, get another name + movem a,fn1 ;cr, done + movem b,fn2 + jrst crf ;echo crlf and return + +getfl5: jumpe t,getfl1 + jrst err ;blank name + +;disk address for next transfer + +drive: 0 +cylndr: 0 +sector: 0 +surfce: 0 +ioadr: 0 ;core address for next disk transfer +dsktmp: 0 ;used for temporary storage here and there +xfrcnt: 0 ;# times we have tried this disk transfer +cu: 0 ;current unit +mu: 0 ;master unit +ufdblk: 0 ;disk block of ufd +qact: repeat 8, -1+ifge .rpcnt-ndsk,1 ;-1 if should use, 0 if unit not active + +;file manipulation variables (leave sname, fn1, and fn2 contigous and in this order +;otherwise code at ulink will cease to function) + +sname: sixbit/./ ;directory name +fn1: 0 ;first file name +fn2: 0 ;second file name + +;dev: 0 ;for holding random device +wrdcnt: 0 ;disk io buffer word count +wrdptr: 0 ;disk buffer byte pointer +lblock: 0 ;last block read or written +blkcnt: 0 ;number of blocks read or written consectively +dirpt: 0 ;descriptor area byte pointer +tutpt: 0 ;tut byte pointer +lnkcnt: 0 ;link counter used by link solver non-zero means at least one link +lnkptr: 0 ;user directory index of first link in chain +lnkufd: 0 ;block # of ufd of of first link in chain +pknum: repeat ndsk,-1 +qded: repeat ndsk,0 + +dmpnxt: 0 ;virtual address of next block to dump + +;swapping variables + +blkin: -1 ;index of block in, negative implies no core swapped out +swporg: 0 ;virtual address of first location in corbfr +swpor1: 0 ;virtual address of last location in corbfr + +litter: constants +vars:: variables + +inform dsksiz,\<.-dskcod> diff --git a/system/disk.1221 b/system/disk.1221 new file mode 100644 index 0000000..ecb38e5 --- /dev/null +++ b/system/disk.1221 @@ -0,0 +1,6395 @@ +; I T S DISK SERVICE ROUTINES AND FILE SYSTEM -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +DSKVRS==.IFNM2 +IFN DC10P+RP10P+RH10P+RH11P-1, .ERR WRONG NUMBER OF DISK CONTROLLERS + +;GET DISK PHYSICAL PARAMETERS BY .INSRT'ING APPROPRIATE FILE + +IFN DC10P,[ +$INSRT DC10 +] + +IFN RP10P,[ +$INSRT RP10 +] + +IFN RH10P,[ +$INSRT RH10 +] + +IFN RH11P,[ +$INSRT RH11 +IFE KS10P, .ERR RH11 on something other than a KS10? +IFN RP06P+RM03P-1, .ERR WRONG NUMBER OF KINDS OF DISK DRIVE +IFN RP06P,[ +$INSRT RP06 +] +IFN RM03P,[ +$INSRT RM03 +] +] + +;GET FILE SYSTEM DEFINITIONS: +; MFD MASTER FILE DIRECTORY +; TUT TRACK (BLOCK) UTILIZATION TABLE +; UFD USER FILE DIRECTORY + +$INSRT FSDEFS + +IFN T300P,[ +$INSRT T300 +] + +SUBTTL MISC FILE SYSTEM CALLS + +ADMPCH: UMOVE A,(J) ;SET OR READ STATUS OF DUMP BIT OF FILE OPEN ON + ; CHNL IN AC(RH) + MOVEI T,POPJ1 ;MAKE CHNDCD SKIP RETURN IF ALL OK. + PUSHJ P,CHNDCD ;DECODE RH(A) AS CHNL NUM. + JRST ILUUO ;NO SKIP IMPLIES BAD CHNL NUM. + TLNN R,%CLSQ + JRST ILUUO ;NOT DISK CHANNEL. + PUSHJ P,QCHNLT ;DECODE THE CHNL FURTHER. + MOVSI B,400000 + TLNE A,400000 + IORM B,UNRNDM(C) + TLNE A,200000 + ANDCAM B,UNRNDM(C) + MOVE D,QACTB + TLNE A,600000 + IORM D,QSNLCN(H) + LDB A,[430100,,UNRNDM(C)] + PUSHJ P,QUDULK + JRST APTUAJ + +NRFDATE: PUSHJ P,QCHNLT ;READ FILE CREATION DATE WORD + MOVE A,UNDATE(C) +NRDM1: PUSHJ P,QUDULK + JRST POPJ1 ;STORE BACK IN USER MEM + +NSRDATE: PUSHJ P,QCHNLT ; SET REFERENCE DATE + HLRS B + DPB B,[UNREFD+UNREF(C)] + JRST NSDM1 + +NRESRDT: PUSHJ P,QCHNLT ; RESTORE REFERENCE DATE + HLRZ A,OLDRDT(R) ; WHOEVER CHOSE R IN QCHNLC SHOULD BE SHOT + DPB A,[UNREFD+UNREF(C)] + JRST NSDM1 + +NSFDATE: PUSHJ P,QCHNLT ;SET FILE CREATION DATE WORD + MOVEM B,UNDATE(C) +NSDM1: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QUDUL1: AOS (P) + JRST QUDULK + + +NRDMPBT: PUSHJ P,QCHNLT ;READ FILE DUMPED BIT + LDB A,[430100,,UNRNDM(C)] + JRST NRDM1 + +NSDMPBT: PUSHJ P,QCHNLT ;SET FILE DUMPED BIT + DPB B,[430100,,UNRNDM(C)] + JRST NSDM1 + +NLNKEDP: + PUSHJ P,QCHNLT ;RETURN NONZERO IF WE TRACED LINKS TO GET THIS FILE. + MOVE T,QSRAC(R) + LDB A,[.BP (%QALOP),T] + JRST NRDM1 + +NFILBLK:PUSHJ P,QCHNLT ;READ ALL 5 PARAMETERS OF NAME AREA + MOVE A,(C) + MOVE B,1(C) + MOVE D,3(C) + MOVE E,4(C) + MOVE C,2(C) + JRST NRDM1 ; UNLOCK DIR AND STORE ARGUMENTS + +QCHNLT: TLNN R,%CLSQ ;IS CHNL A DISK CHNL? + JRST [SUB P,[1,,1] ? JRST OPNL34] + HLRZ R,H + MOVE H,QUDPR(R) + PUSHJ P,QUDLK + MOVE C,QSNLCN(H) + ADD C,QUDFPR(R) + POPJ P, + +IFN QAUTHP,[ +ASAUTH: PUSHJ P,QCHNLT ;SET AUTHOR OF FILE + PUSH P,C + JUMPE B,ASAUT4 ;SETTING AUTHOR TO 0 + MOVE J,QSNMI(H) + CAMN B,QSNUD(H) + JRST ASAUT1 + MOVE C,B + PUSHJ P,QFL + SKIPA + JRST ASAUT1 + SETZM C + MOVEI J,5 + MOVE TT,[440600,,B] + MOVE I,[440600,,C] + ILDB D,TT + IDPB D,I +ASAUT2: ILDB D,TT + CAIG D,'Z + CAIGE D,'A + JRST ASAUT3 + IDPB D,I + SOJG J,ASAUT2 + JRST ASAUT4 + +ASAUT3: PUSHJ P,QFL +ASAUT4: SETOM J +ASAUT1: POP P,C + DPB J,[UNAUTH+UNREF(C)] + JRST NSDM1 + +ARAUTH: PUSHJ P,QCHNLT ;READ CREATOR OF FILE + LDB B,[UNAUTH+UNREF(C)] + MOVEI A,0 ;RETURN VALUE IS 0 IF UNKNOWN OR ILLEGAL AUTHOR + CAIL B,NUDSL + JRST NRDM1 + LSH B,1 + MOVEI B,2000-(B) + ADD B,QMDRO + MOVE A,(B) + JRST NRDM1 +];QAUTHP + +ASREAP: PUSHJ P,QCHNLT ;SET NO REAP BIT + DPB B,[.BP (UNREAP),UNRNDM(C)] + JRST NSDM1 + +ARQDAT: CONO PI,CLKOFF ;GET DSK TIME AND DATE + SKIPL A,QDATE + HRR A,TIMOFF + MOVE B,QDATEI ;2ND VALUE = DATE & TIME SYS CAME UP, IN DISK FORMAT. + CONO PI,CLKON + JRST POPJ1 + +ADSKUP: PUSHJ P,QCHNLT ;SET CREATION DATE, REF DATE AND CLEAR DUMP BIT + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(C) + HLRS TT + DPB TT,[UNREFD+UNREF(C)] + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(C) + JRST NSDM1 + +DELEWO: TLNN R,%CLSQ ;DELETE WHILE OPEN + JRST OPNL34 ;WRONG TYPE DEVICE + PUSHJ P,QCHNLT + PUSH P,W + PUSH P,C + MOVEI W,4 + MOVE A,UNFN1(C) ;Get names of file being hacked. + MOVE B,UNFN2(C) + MOVE C,QSNUD(H) + PUSHJ P,MNGDIR ;If this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. + POP P,C + POP P,W + MOVSI T,%QADEL ;SET DELETE BIT IN QSK CHNL + IORM T,QSRAC(R) + MOVSI T,UNCDEL ;AND IN FILE + IORM T,UNRNDM(C) + JRST NSDM1 + +;.CALL FILLEN +;RETURNS (1) FILE LENGTH IN BYTES (BYTE SIZE CURRENTLY OPEN IN) +; (2) BITS PER BYTE (BYTE SIZE CURRENTLY OPEN IN) +; (3) FILE LENGTH IN BYTES (BYTE SIZE WRITTEN IN) +; (4) BITS PER BYTE (BYTE SIZE WRITTEN IN) + +NFILLEN:PUSHJ P,QCHNLT + MOVE A,QSRAC(R) + TLNE A,%QALNK + JRST OPNL34 ;NOT A FILE + SKIPGE QSCRW(R) + TLNE A,%QAMWO + JRST NFILL1 ;READ CHANNEL OR WRITE-OVER, GET FILE'S STORED LENGTH. + MOVE A,QFBLNO(R);NORMAL WRITE, GET ACCESS POINTER. + SKIPGE QSMDN(R) + JRST NFILL2 ;NO BUFFER ACTIVE + ADD A,QMPBSZ(R) ;END OF CURRENT BUFFER + SUB A,QSMPRC(R) ;BACK UP TO CURRENT LOC +NFILL2: PUSHJ P,QUDULK + LDB B,[QSBSIZ(R)] ;CURRENT BYTE SIZE + MOVE D,B ;WRITTEN BYTE SIZE SAME AS CURRENT + MOVE C,A ;WRITTEN LENGTH SAME AS CURRENT + JRST POPJ1 + +NFILL1: LDB TT,[UNDSCP+UNRNDM(C)] + IDIVI TT,UFDBPW + HLL TT,QBTBLI(I) ;GET DESCRIPTOR POINTER + LDB E,[UNWRDC+UNRNDM(C)] + SKIPN E + MOVEI E,2000 ;E GETS NUMBER OF WORDS IN LAST BLOCK + LDB D,[UNBYTE+UNREF(C)] ;D GETS BYTE INFO + ANDI C,-2000 ;C GETS BASE ADDR OF DIR + ADDI TT,UDDESC(C) ;TT GETS DESC PNTR + SETOM A ;INITIALIZE NUMBER OF BLOCKS IN FILE + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE MINUS ONE + PUSHJ P,QUDULK + IMULI A,2000 ;NUMBER OF WORDS IN COMPLETE BLOCKS + ADD A,E ;ADD WORDS IN LAST BLOCK + PUSHJ P,QBDCD ;D GETS BYTE SIZE, E NUMBER OF RESIDUE BYTES + MOVEI Q,36. + IDIV Q,D ;Q GETS BYTES PER WORD + MOVE C,A ;C WRITTEN LENGTH, A CURRENT (B.S. DIFFERENT) + IMUL C,Q ;CONVERT WORD LENGTH TO BYTES + SUB C,E ;C NOW HAS CORRECT WRITTEN LENGTH + IMUL E,D ;E GETS NUMBER OF RESIDUE BITS + LDB B,[QSBSIZ(R)] ;B GETS BYTE SIZE OPENED IN + IMULI A,@QSBYTE(R) ;A GETS LENGTH IN THOSE SIZE BYTES + IDIV E,B ;NUMBER OF RESIDUE BYTES, -ROUNDING DOWN- + SUB A,E ;ADJUST THE LENGTH + JRST POPJ1 ;RETURN VALUES IN A,B,C,D + +NFLLN2: ADD A,B ; NEXT N BLOCKS +NFLLN1: ILDB B,TT ; GET NEXT DESC BYTE + JUMPE B,CPOPJ ; NO MORE + CAIG B,UDTKMX + JRST NFLLN2 ; TAKE-N + CAIGE B,UDWPH + AOJA A,NFLLN1 ; SKIP-N, TAKE-1 + CAIN B,UDWPH + JRST NFLLN1 ; IGNORE WRITE-PLACEHOLDER +REPEAT NXLBYT, IBP TT ; LOAD-ADDRESS, TAKE-1 + AOJA A,NFLLN1 + +;DIRSIZ - READ OR SET DISK QUOTAS, READ # BLOCKS IN ALL FILES IN DIRECTORY. +;1ST VALUE IS GRIM REAP QUOTA,,DIR SIZE +;2ND VALUE IS 0 OR PACK#,,ALLOCATION FOR DIR ALLOCATED TO SPECIFIC PACK +;LH OF 2ND ARG SETS GRIM REAP QUOTA; 3RD ARG SETS PACK#,,ALLOCATION +NDIRSI: MOVE D,C + PUSHJ P,QCHNLT + MOVE C,QSNLCN(H) + MOVE A,UDBLKS(C) + JUMPL B,NDIRS1 + CAIE W,1 + HLLM B,UDBLKS(C) +NDIRS1: MOVE B,UDALLO(C) + CAILE W,2 + MOVEM D,UDALLO(C) +IFN QRSRVP,[ + HLRZS D ;PACK ALLOCATED TO + SETO E, + JUMPE D,NDIRS2 + MOVEI E,NQS-1 ;UPDATE ALLOC DRIVE NUM + CAME D,QPKID(E) + SOJGE E,.-1 +NDIRS2: MOVEM E,QSALLO(H) +];QRSRVP + JRST NSDM1 + +SUBTTL DISK OPEN ROUTINES + +%DO==1,,525252 ;Special mode bits for disk opens. +%DOWOV==100000 ;Write over mode +%DONRF==10 ;Don't set ref-date +%DONLK==20 ;Don't chase links; actually open the link itself. +%DORWT==40 ;Make readers wait (used on opens for write or write-over). + +IFN TPLP+UNSPLP,[ +TPLO: MOVE C,[SIXBIT /.LPTR./] ;PSEUDO LINE PRINTER (DISC) + JUMPGE D,TPLO2 + MOVE B,UNAME(U) + AOS A,TPLFNO ;GENERATE RANDOM FILE NAME + JRST TPLO2 +] + +COMO: SKIPA C,[SIXBIT /COMMON/] ;.OPEN ENTRY FOR "COM" DEVICE +SYSO: MOVSI C,(SIXBIT /SYS/) ; " FOR "SYS" DEVICE +TPLO2: MOVEM C,USYSN1(U) + MOVNI I,1 + JRST QSKO + +QSKPO: MOVSI TT,-NQS ;PACK # OPEN + CAME I,QPKID(TT) + AOBJN TT,.-1 ;I <= PHYSICAL UNIT WITH SPECIFIED PACK + JUMPL TT,QSKPO1 + PUSHJ P,QPKNFP + JRST QSKPO + CAIE W,4 ;IF RENAME/DELETE, OK, DOESN'T TOUCH FILE ANYWAY + JRST OPNL16 ;OTHERWISE COMPLAIN PACK NOT MOUNTED +QSKPO1: HRRZ I,TT +QSKUO: CAIGE I,NQS ;DISK UNIT # OPEN + SKIPE QACT(I) ;I <= UNIT # + JRST OPNL10 ;BAD UNIT # OR NOT ENGAGED +IFE MCOND DM,[ ;; Security check in reserved pack feature only on DM. +IFN QRSRVP,[ + JUMPN W,QSKOB ;WRITE-OVER OR RENAME OK. + JUMPGE D,QSKOB ;READ OK. + SKIPE QRESRV(I) ;WRITE: IS PACK ON THIS DRIVE RESERVED? + JRST OPNL10 ;YES, CAN'T WRITE ON IT. +];QRSRVP +];DM + JRST QSKOB + +;DNRF: DEVICE IS LIKE DSK: BUT DOESN'T SET REFERENCE DATE +DNRFO: TRO D,%DONRF/2 ;SET MODE BIT AND DROP INTO QSKO + +; Regular DSK: device +; +; RH(D) has open mode, rotated 1 bit right. +; W has operation code (0=r/w, 2=link, 4=del/rnm, 1=wov) + +QSKO: MOVNI I,1 ;DSK OPEN, I <= # DETERMINED BY SYS +QSKOB: MOVEM I,EPDL(U) ;SAVE DISK # + MOVE C,USYSN1(U) + CAIN W,4 + JUMPE A,QSKOB2 ;IF RENAME OF OPEN FILE TRAP OUT +QSKOA: MOVE I,MDSK ;IS MFD IN? + PUSHJ P,QMCH1 ;READ IN MFD OF MASTER DISK + CLEARM QLD(U) ;LINK DEPTH +QSKOL: PUSHJ P,MFDCK + JRST SYSDS2 + JUMPN W,OPNL11 + JUMPL D,OPNL11 ;MUST BE NORMAL READ + JRST QMLSTF ;USER WANT TO READ THE MASTER DIRECTORY + +MFDCK: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + POPJ P, + JRST POPJ1 + +SYSDS2: PUSHJ P,QFLD ;H <= PTR TO USER DIR TABLE + PUSHJ P,QSKO1 ;LOSER DIR NOT IN CORE + SKIPG QSNNR(H) + BUG + PUSHJ P,QUDLK ;RETURN WITH SOS OF QSNNR ON LSWPR + MOVSI TT,40000 + TDNE TT,QSNLCN(H) + JRST QSKDP1 ;PAW OVER USER DIRECTORY +QSKDP2: PUSHJ P,QUDULK + PUSHJ P,FLDRCK + JRST QSKDP9 ;NOT SPECIAL DIRECTORY FILE + JUMPN W,QPNL11 + JUMPL D,QPNL11 + JRST QLISTF ;USER WANTS TO READ HIS USER DIRECTORY + +QSKDP9: JUMPN W,QSKDPY ;If doing IO? + SKIPL D ; and reading + JRST QSKDPZ ; then don't bother with "security". +QSKDPY: PUSHJ P,MNGDIR ;Else if this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. +QSKDPZ: JUMPL D,QWRO ;WRITE + CAIN W,4 + JRST QRNAM ;RENAME/DEL + CAIN W,2 + JRST QALINK ;MAKE LINK + JUMPN W,QPNL22 +QWROR: JUMPE A,QPNL11 ;ALSO ENTER FOR VARIOUS WRITE OVER, COPY OVER MODES + JUMPE B,QPNL11 + PUSHJ P,QCHNF ;GET CHANNEL FOR READ + PUSHJ P,LOSSET + QCHNRT + PUSHJ P,QUDLK ;LOCK USER DIR + PUSHJ P,QLOOK ;LOOK UP FILE + JRST [ PUSHJ P,QROR1C ;Not found => decide whethe error or wait. + POPJ P, ;Error (error code already set up). + PUSHJ P,QUDULK ;If retrying, first unlock directory, + PUSHJ P,LSWPOP ;Return the channel, + PUSHJ P,UDELAY ;Wait a little while, + JRST QWROR] ;Try again. + TRNE D,3 ;SKIP IF UNIT ASCII MODE + JRST QSKO2 + MOVE J,[440700,,5] ;BYTE SIZE IS 7 BITS + MOVEM J,QSBYTE(E) +QSKO2: HLLZ J,QSBYTE(E) ;GET PROPER BYTE POINTER LH + MOVEM J,QSMPRP(E) + TRNN D,%DONRF/2 ;3.4 BIT IN OPEN IMPLIES DONT SET REFERENCE DATE + PUSHJ P,QFREF ;"REFERENCE" FILE + MOVE C,Q + SUB C,QSNLCN(H) + HRRZM C,QUDFPR(E) ;SET UP PTR FROM CHNL TO FILE NAME AREA + LDB TT,[UNDSCP+UNRNDM(Q)] ;FOUND FILE SET UP CHNL + MOVEM TT,QDIRP(E) ;SET UP CHAR PTR TO DESC AREA + MOVE C,UNRNDM(Q) + TLNE C,UNLINK + JRST QLINK ;FILE IS A LINK + MOVSI C,%QALOP + SKIPE QLD(U) ;IF WE TRACED A LINK TO OPEN THE FILE, REMEMBER THAT. + IORM C,QSRAC(E) + MOVSI C,%QARWT + TRNE D,%DORWT/2 + IORM C,QSRAC(E) + LDB J,[UNPKN+UNRNDM(Q)] ;GET PACK NUMBER FILE IS ON + MOVSI I,-NQS + CAME J,QPKID(I) + AOBJN I,.-1 ;TRANSLATE LOGICAL TO PHYSICAL DISK UNIT + JUMPGE I,QPKNF ;PACK NOT ON * + HRRZM I,QDSKN(E) ;SET CHNL DISK NUMBER + JUMPL D,QWROR1 ;REALLY WANT TO WRITE OVER, ETC + MOVEI TT,%QMRD ;PUT CHANNEL IN NORMAL READ MODE + HRRM TT,QSRAC(E) +QOEX1: PUSHJ P,QUDULK ;UNLOCK USER DIR + PUSHJ P,LSWDEL ;QUSR ENTRY + PUSHJ P,LSWDEL ;QSNNR ENTRY + SKIPG QSNNR(H) + BUG + PUSHJ P,QSTRTR + MOVE C,D + ROT C,1 + HRL A,E + JSP Q,OPSLC7 ;SET UP IOCHNM AND DEPART + DQUAI,,DQUAO + DQBI,,DQBO + DQUII,,DQUIO + DQBI,,DQBO + +QWROR1: SOJN W,OPNL12 ;NORMAL WRITE OVER MODE + HRRZS H ;CLEAR GARBAGE IN USER DIR NUM + HRRZS E ;CLEAR GARBAGE IN CHNL NUM + HRRZ J,QUDFPR(E) ;PICK UP LOCN OF FILE WITH U.F.D + MOVSI I,-NQCHN ;MAKE SURE THIS FILE NOT OPEN FOR READING +QROR1A: CAIE E,(I) ;DONT GET FAKED OUT BY OWN CHNL + SKIPGE QUSR(I) + JRST QROR1B + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1B + JRST OPNL23 + +QROR1B: AOBJN I,QROR1A + PUSHJ P,QAUTH + MOVSI TT,UNWRIT + IORM TT,UNRNDM(Q) ;SET WRITE BIT + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(Q) + PUSH P,D + PUSH P,Q + PUSH P,R + PUSH P,E ;CONVERT FROM ORIGINAL BYTE SIZE TO ONE OPENED IN NOW + LDB D,[UNBYTE+UNREF(Q)] + PUSHJ P,QBDCD ;GET INFO FROM ORIGINAL WRITE OF FILE + MOVEI Q,36. + IDIV Q,D ;BYTES PER WORD + SUB Q,E ;# VALID BYTES + IMUL Q,D ;VALID BITS IN LAST WORD + POP P,E ;RESTORE QSK CHNL # + HRRZ R,QSBYTE(E);BYTES PER WORD IN NEW BYTE SIZE + LDB J,[QSBSIZ(E)] ;BITS PER BYTE IN NEW BYTE SIZE + IDIV Q,J ;NUMBER OF NEW-SIZE BYTES IN LAST WORD + SUB R,Q ;RESIDUE IN NEW-SIZE BYTES + LDB Q,[QSBSIZ(E)] ;NEW BYTE SIZE + PUSHJ P,QBENC ;RH(Q) GETS NEW BYTE INFO + MOVE R,-1(P) + DPB Q,[UNBYTE+UNREF(R)] ;CLOBBER FILE'S BYTE SIZE + POP P,R + POP P,Q + POP P,D + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(Q) + HLRS TT + DPB TT,[UNREFD+UNREF(Q)] + HLLM TT,OLDRDT(E) + MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVSI TT,%QAMWO ;WRITE OVER MODE + IORM TT,QSRAC(E) ;LEAVE %QMIDL UNTIL FIRST .IOT SINCE + JRST QOEX1 ; THE USER WILL PROBABLY DO A .ACCESS + +;Call here if lookup fails on open. +;Either signal some error and return, +;or skip-return if caller should wait and retry the lookup. +;Assumes H has dir slot, Q has address of filename block, +;E has channel number allocated for this open. +;Clobbers C, J. +QROR1C: HRRZ C,QSNLCN(H) + SUBI Q,-LUNBLK(C) + SKIPL Q ;SEE IF STILL POINTED INSIDE DIR + CAILE Q,2000-LUNBLK + JRST QROR1D ;NO - REALLY FNF + ADDI Q,(C) + CAMN A,UNFN1(Q) ;DO NAMES MATCH? + CAME B,UNFN2(Q) + JRST QROR1D ;NO - REALLY FNF + HRRZ J,Q ;Find channel that has this file open. + SUB J,QSNLCN(H) + ANDI J,-1 + HRRZS H ;Clear garbage in user dir num + HRRZS E ;Clear garbage in chnl num + MOVSI I,-NQCHN +QROR1E: CAIE E,(I) ;Dont get faked out by our own chnl. + SKIPGE QUSR(I) + JRST QROR1F + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1F +;Found the channel. Does it want us to wait? + MOVE I,QSRAC(I) + TLNN I,%QARWT + JRST OPNL23 ;He didn't say so => get "file locked". + JRST POPJ1 + +QROR1F: AOBJN I,QROR1E + JRST POPJ1 ;Cannot find channel => maybe was closed. Retry. + +QROR1D: SKIPN QLD(U) + JRST OPNL4 ;FILE NOT FOUND + JRST OPNL47 ;LINK WAS FOUND, BUT NOT THE FILE IT POINTED TO + +;COME HERE FOR RENAME-WHILE-OPEN +QSKOB2: HRRZ A,B ;DO RENAME WHILE OPEN HERE TO AVOID + CAIL A,20 ;IN CASE SYS NAME HAS CHANGED + JRST OPNL14 + SKIPE SRN3(U) + SKIPN SRN4(U) + JRST OPNL11 + ADD A,U + HLRZ E,IOCHNM(A) + MOVE H,QUDPR(E) + MOVE A,SRN3(U) + MOVE B,SRN4(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL11 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL11 + PUSHJ P,QUDLK + MOVE Q,QUDFPR(E) + ADD Q,QSNLCN(H) + PUSHJ P,QGRLSC ;EITHER NAME > OR FROM POINTER + MOVE I,D ;I => TO POINTER + HRLOI E,377777 ;PREVIOUS FN1 (BIT 4.9 COMPLEMENTED) + MOVE W,E ;FN2 + MOVEI J,0 ;J NEGATIVE => NEED SORT, NON-ZERO => DIR MODIFIED +QSKDP4: SUBI I,LUNBLK +QSKDP5: SUBI D,LUNBLK + CAMLE C,D + JRST QSKDP8 ;THROUGH + SKIPN A,UNFN1(D) + SKIPE UNFN2(D) + JRST QSKDP3 + HLLOS J + JRST QSKDP5 ;NAME BLOCK FREE + +QSKDP3: MOVE Q,UNRNDM(D) + TLNN Q,UNIGFL + JRST QSKDPR ;NOT OPEN FOR WRITE OR BEING DELETED + HLLOS J ;NEED TO WRITE OUT DIR + SKIPN A,UNFN1(D) + MOVSI A,(SETZ) + SKIPN B,UNFN2(D) + MOVSI B,(SETZ) +QSKDP7: PUSHJ P,QGRLSC ;DON'T CREATE ANY FILE WITH NAME OF < OR > + AOJA A,QSKDPA ;CHANGE BOTH JUST TO BE SURE + AOJA A,QSKDPA + MOVE Q,QSNLCN(H) ;SEE IF THAT NAME EXISTS + MOVEI Q,2000-LUNBLK(Q) ;THERE MAY BE DUPLICATE ENTRIES +QSKDPU: CAMN A,UNFN1(Q) ;DURING THIS SEARCH BUT IT DOESN'T + CAME B,UNFN2(Q) ;MATTER + JRST QSKDPT + CAIE Q,(D) ;DON'T CHANGE NAME IF NOT DUPLICATE +QSKDPA: AOJA B,QSKDP7 ;FOUND IT. CHANGE SECOND NAME +QSKDPT: SUBI Q,LUNBLK + CAMG C,Q + JRST QSKDPU + MOVEM A,UNFN1(D) + MOVEM B,UNFN2(D) + MOVSI Q,UNIGFL + ANDCAM Q,UNRNDM(D) +QSKDPR: CAMN D,I + JRST QSKDP6 + HRLZ Q,D ;RELOCATE FILE BLOCK + HRR Q,I + BLT Q,LUNBLK-1(I) +QSKDP6: JUMPL J,QSKDP4 ;ALREADY NEEDS SORT + MOVE B,UNFN2(D) ;MAY NOT HAVE YET IF GOT HERE FASTEST WAY + TLC A,(SETZ) + TLC B,(SETZ) + EXCH A,E + EXCH B,W + CAMLE A,E + JRST QSKDP4 ;ORDER OK + CAMN A,E + CAMGE B,W + MOVNI J,1 ;NEED SORT + JRST QSKDP4 + +QSKDP8: ADDI I,LUNBLK ;I POINTED TO EMPTY SLOT + MOVE D,I + SUBI D,(TT) + EXCH D,UDNAMP(TT) + ADDI D,(TT) + CAML D,I + JRST QSKDPV + SETZM (D) ;CLEAR VACATED AREA + HRLS D + ADDI D,1 + BLT D,-1(I) +QSKDPV: JUMPL J,QSKDPS ;SORT + TRNN J,-1 + JRST QSKDPK +QSKDPX: MOVE I,QACTB + IORM I,QSNLCN(H) +QSKDPK: MOVE W,QSNLCN(H) +IFN QRSRVP,[ + HLRZ A,UDALLO(W) ;IF THIS DIR HAS ALLOCATION + JUMPE A,QSKBK0 + MOVEI B,NQS-1 ;CONVERT PACK # TO DRIVE # + CAME A,QPKID(B) + SOJGE B,.-1 + SKIPGE A,B +QSKBK0: SETO A, ;ALLOCATED PACK NOT MOUNTED, USE ANY + MOVEM A,QSALLO(H) ;SAVE DRIVE # (-1 IF NONE) +];QRSRVP + HLLZS UDBLKS(W) + MOVE A,UDNAMP(W) + ADDI A,(W) +QSKBK1: CAIL A,2000(W) ;COUNT BLOCKS USED + JRST QSKBK2 + MOVE B,UNRNDM(A) + TLNE B,UNLINK + JRST QSKBK3 + LDB B,[UNDSCP+UNRNDM(A)] + IDIVI B,UFDBPW + HLL B,QBTBLI(C) + ADDI B,UDDESC(W) ;B GETS BYTE PNTR TO DESC +QSKBK4: ILDB C,B + JUMPE C,QSKBK3 + CAIN C,UDWPH + JRST QSKBK4 + CAIG C,UDTKMX + JRST [ADDM C,UDBLKS(W) ? JRST QSKBK4] + CAIG C,UDWPH + JRST [AOS UDBLKS(W) ? JRST QSKBK4] + REPEAT NXLBYT, IBP B + AOS UDBLKS(W) + JRST QSKBK4 + +QSKBK3: ADDI A,LUNBLK + JRST QSKBK1 + +QSKBK2: POP P,W + POP P,I + POP P,D + POP P,C + POP P,B + POP P,A + JRST QSKDP2 + +QSKDPS: MOVEI T,LUNBLK + ADD P,[3,,3] +QSKDPB: MOVEI Q,(I) ;BEGINNING OF NAME AREA + SKIPGE T + MOVEI Q,2000-LUNBLK(TT) ;START AT END + MOVEI W,2000(TT) + SKIPGE T + MOVEI W,-LUNBLK(I) + SETZM (P) + TDZA J,J ;0 => SORTED -1 => MAKE ANOTHER PASS +QSKDPE: ADD Q,T + CAIE Q,(W) + JRST QSKDPC + JUMPE J,QSKDPW + MOVNS T + JRST QSKDPB + +QSKDPW: SUB P,[3,,3] + JRST QSKDPX + +QSKDPC: SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + JRST QSKDPD + BUG + +QSKDPD: MOVE B,UNFN2(Q) + TLC A,(SETZ) + TLC B,(SETZ) + SKIPE E,(P) ;FIRST ENTRY + JRST QSKDPF +QSKDPG: MOVEM A,-2(P) + MOVEM B,-1(P) +QSKDPI: MOVEM Q,(P) + JRST QSKDPE + +QSKDPF: JUMPL T,QSKDPJ + CAMLE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAML B,-1(P) + JRST QSKDPG +QSKDPH: REPEAT LUNBLK,[ + EXCH A,.RPCNT(E) + EXCH A,.RPCNT(Q) + EXCH A,.RPCNT(E) +] + MOVNI J,1 + JRST QSKDPI + +QSKDPJ: CAMGE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAMG B,-1(P) + JRST QSKDPG + JRST QSKDPH + +SUBTTL OPEN FOR WRITE + +;RETURNS WITH QUSR(E) AND QSNLCN(E) ON LSWPR +QWRO2: JUMPE A,QPNL11 + JUMPE B,QPNL11 + SKIPGE I,EPDL(U) ;PICK UP DESIRED DISK UNIT + JRST QWRO2A ;SYSTEMS CHOICE +QWRO2B: CAIGE I,NQS + SKIPE QACT(I) + BUG ;WE LOST SOMEHOW... + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) ;TUT IN BUT NOT PAWED OVER + TLNE TT,40000 ;TUT NOT IN + PUSHJ P,QTCH1 ;READ IN TUT OF DISK INVOLVED + PUSHJ P,QCHNF ;GET CHANNEL + PUSHJ P,LOSSET + QCHNRT + MOVE TT,[440700,,5] + TRNN D,3 + MOVEM TT,QSBYTE(E) ;UNIT ASCII MODE, BYTE SIZE=7 + PUSHJ P,QUDLK ;LOCK USER DIRECTORY + PUSHJ P,QGRLSC ;CHECK < AND > + JRST QPNLBN ;LOSE + PUSHJ P,QFNG ;REPLACE WITH COMPUTED EFFECTIVE NAME + PUSHJ P,QFREEF ;FIND FREE FILE NAME AREA AND STORE IN QDIRP(E) + JRST QFDF ;FILE DIR FULL + MOVSI TT,UNWRIT ;SET WRITE IN PROGRESS + IORM TT,UNRNDM(Q) + MOVE TT,QPKID(I) + DPB TT,[UNPKN+UNRNDM(Q)] + PUSHJ P,QAUTH ;SET FILE AUTHOR, MAY NOT PCLSR + MOVE TT,QACTB + IORM TT,QSNLCN(H) + SETOM QSCRW(E) ;SET CHNL WRITE SWITCH + POPJ P, + +QWRO2A: +IFN QRSRVP,[ + SKIPL I,QSALLO(H) + JRST QWRO2B ;THIS DIR GOES ON A PARTICULAR UNIT +] + SKIPGE I,QWRU ;GET CURRENT WRITING UNIT + JRST QWRO2E ;NO CURRENT UNIT, GO FIND ONE + MOVE TT,QSFT(I) + CAML TT,QFTTHR + JRST QWRO2B ;ENOUGH ROOM ON PREFERRED UNIT +QWRO2E: SETOB T,I ;NOT MUCH SPACE LEFT TRY OTHER UNITS + MOVSI E,-NQS +QWRO2C: SKIPGE QACT(E) ;SKIP ON UNIT ACTIVE + JRST QWRO2D +IFN QRSRVP,SKIPN QRESRV(E) ;DONT CHOOSE THIS PACK IF RESERVED + CAML T,QSFT(E) ;NOTE QSFT IS -1 IF TUT NEVER BEEN READ IN + JRST QWRO2D ;OTHERWISE CONTAINS VALID BLOCK COUNT + MOVE T,QSFT(E) + HRRZ I,E +QWRO2D: AOBJN E,QWRO2C + SKIPGE I + BUG ;NO ACTIVE UNRESERVED UNITS + CAMN I,QWRU + JRST QWRO2B ;DON'T WRITE MFD IF UNCHANGED + MOVEM I,QWRU + MOVE E,QACTB + IORB E,QMDRO + MOVEM I,MPDWDK(E) + JRST QWRO2B + +QWRO: JUMPN W,QWROR ;REALLY WANT TO MODIFY OR OTHERWISE HACK AN EXISTING FILE + PUSHJ P,QWRO2 ;MAKING NEW FILE, DECIDE WHICH UNIT TO PUT IT ON + SETOM QMFTP(E) ;TRACK TO SCAN IN TUT + SETOM QMTTR(E) + CLEARM QMPTN(E) + CLEARM QMPTC(E) + MOVEI TT,%QMWRT ;ENTER NORMAL WRITE MODE + HRRM TT,QSRAC(E) + MOVSI TT,%QARWT + TRNE D,%DORWT/2 + IORM TT,QSRAC(E) + JRST QOEX1 ;EXIT + + +SUBTTL File hacking tracking + +; MNGDIR checks the file name (sname in C) +; Fails to skip if the file is an important system file. +; Skips if the file is of the everyday sort. + +MNGDIR: HLRZ TT,C +IFN KL10P, CAME C,[SIXBIT /.KLFE./] + CAIN TT,'SYS ;A sys directory? + POPJ P, + CAME C,[SIXBIT /ACOUNT/] + CAMN C,[SIXBIT /./] + POPJ P, + CAME C,[SIXBIT /DEVICE/] + CAMN C,[SIXBIT /CHANNA/] + POPJ P, + AOS (P) ;Not a system directory. skip return. + POPJ P, + +; SYSDSK notifies the SYS job to print a message on the +; console about the file being hacked. +; File names in C;A B, the opcode in W (or zero) specifies the hacking. + +SYSDSK: JUMPE U,CPOPJ ;Avoid deadly embrace! + MOVSI T,SCLWRT ;Writing on SYS directory. + PUSHJ P,CWAIT ;Take turns like nice little lusers. + TDNE T,SUPCOR ;Wait for previous req to finish. + MOVE TT,W ;Check file operation code. + CAILE TT,4 ;If impossible opcode + SETZ TT, ; probably supposed to be R/W. + MOVEM TT,SWMOD ;Store opcode. + MOVE TT,UNAME(U) + MOVEM TT,SWUNAM ;Luser. + MOVE TT,JNAME(U) + MOVEM TT,SWJNAM + MOVEM A,SWFN1 + MOVEM B,SWFN2 + MOVEM C,SWFN3 ;Sname. + IORM T,SUPCOR ;Notify the SYS job. + JRST CLKONJ ;Turn on the clock and return. + + +SUBTTL DIRECTORY ROUTINES + +QFREEF: PUSH P,A ;Q_PTR TO USER DIR FREE FILE QDIRP(E)_PTR TO FREE DESC AREA + PUSH P,B ;GET FREE FILE AREA + PUSH P,I + MOVEI I,0 ;SIGNAL NO GC YET +QFREFA: SETZM QUDFPR(E) ;CLEAR SO WILL NOT POINT TO RANDOMNESS IN CASE OF G C + MOVE TT,QSNLCN(H) + SKIPL Q,UDESCP(TT) + CAIL Q,2000*UFDBPW + BUG ;FREE DESC POINTER OUT OF RANGE + IDIVI Q,UFDBPW + MOVE C,UDNAMP(TT) + CAIL Q,-UDDESC-7-LUNBLK(C) + JRST QAGARB ;NOT ENOUGH ROOM BETWEEN DESC AND NAME AREAS + PUSHJ P,QLGLK ;FIND WHERE FILE OUGHT TO GO + JRST QFREFF ;DIR WAS EMPTY + TRNN J,1777 + JRST QFREFE ;GOES AT END OF DIR +QFREFC: CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QFREFE + MOVE C,UNRNDM(J) + TLNE C,UNIGFL ;* FILES MUST COME AFTER NON * FILES + JRST QFREFE ;OF SAME NAME + ADDI J,LUNBLK + CAIGE J,2000(TT) + JRST QFREFC +QFREFE: CAMN Q,J + JRST QFREFF ;GOES AT BEGINNING + PUSHJ P,QINSRT + JRST QFREFD + +QFREFF: SUBI Q,LUNBLK ;Q -> NAME BLOCK FILE WILL GO IN +QFREFD: MOVNI T,LUNBLK ;ALLOCATE MORE SPACE FOR NAME AREA + ADDM T,UDNAMP(TT) + HRRZ A,UDESCP(TT) ;FIRST FREE DESCRIPTOR LOC + DPB A,[UNDSCP+UNRNDM(Q)];STORE IN FILE AREA + MOVEM A,QDIRP(E) ;STORE IN CHANNEL + MOVEI B,6*UFDBPW+1 ;ENOUGH FOR A LINK WITH EVERY CHAR QUOTED PLUS ONE ZERO + ADDM B,UDESCP(TT) ;ALLOCATE MORE SPACE FOR DESC AREA + MOVE B,Q + SUB B,QSNLCN(H) + HRRZM B,QUDFPR(E) ;ASSOCIATE CHANNEL WITH FILE + CONO PI,CLKOFF + SKIPL B,QDATE ;GET TIME AND DATE + HRR B,TIMOFF + CONO PI,CLKON + MOVEM B,UNDATE(Q) ;SET CREATION DATE + HLLM B,OLDRDT(E) + HLRS B + DPB B,[UNREFD+UNREF(Q)] ;SET REFERENCE DATE + IDIVI A,UFDBPW ;GET WRD AND CHAR ADRS + HLLZ B,QBTBLI(B) + ADDI B,UDDESC(A) + HRRZ A,QSNLCN(H) + ADD B,A + ILDB A,B + SKIPE A + BUG ;DESCRIPTOR AREA ALREADY OCCUPIED + MOVEI A,UDWPH + DPB A,B + ILDB A,B + SKIPE A + BUG ;NOT FOLLOWED BY ZERO + POP P,I + POP P,B + POP P,A + MOVEM A,UNFN1(Q) ;SET FILE NAMES + MOVEM B,UNFN2(Q) + JRST POPJ1 + +QAGARB: JUMPL I,QNOFRE ;IF GC WAS ALREADY TRIED, DON'T TRY IT AGAIN - GIVE UP. + PUSHJ P,QGC ;GC. BTW, IT IS OK TO PCLSR HERE. + JFCL + MOVNI I,1 ;SIGNAL GC HAS BEEN TRIED + JRST QFREFA + +;MAKE ROOM FOR FILE BEFORE J. Q POINTS TO NEW EMPTY FILE SLOT +QINSRT: PUSH P,A + PUSH P,TT + HRRZ TT,QSNLCN(H) + HRRZ A,UDNAMP(TT) + PUSH P,A + ADDI A,(TT) + HRLS A + SUBI A,LUNBLK + BLT A,-LUNBLK-1(J) + SETZM -LUNBLK(J) + HRRZI A,-LUNBLK+1(J) + HRLI A,-LUNBLK(J) + BLT A,-1(J) + SUB J,QSNLCN(H) + MOVSI A,-NQCHN +QINSR1: HRRZ TT,QUDPR(A) + SKIPL QUSR(A) + CAIE TT,(H) + JRST QINSR2 + MOVE TT,QUDFPR(A) + CAMGE TT,(P) + JRST QINSR2 + CAIGE TT,(J) + SUBI TT,LUNBLK + MOVEM TT,QUDFPR(A) +QINSR2: AOBJN A,QINSR1 + ADD J,QSNLCN(H) + HRRZI Q,-LUNBLK(J) + SUB P,[1,,1] + POP P,TT + POP P,A + POPJ P, + +;DIR NOT IN CORE. GET IT FROM DISK, CREATE IT IF DOESN'T ALREADY +; EXIST, OR GIVE NO SUCH DIRECTORY ERROR. +;C HAS SNAME. RETURNS DIRECTORY NUMBER IN H. + +QSKO1: PUSHJ P,SWTL + QSKOSW ;PREVENT TIMING ERROR IF TWO PCS SHOULD + PUSHJ P,QFLD ; ATTEMPT TO BRING IN SAME DIRECTORY + JRST QSKO11 + MOVEI T,2 ;SOMEONE ELSE BROUGHT IT IN, RELEASE QSKOSW + JRST LSWPON ;BUT LEAVE QSNNR(H) LOCKED. + +QSKO11: PUSH P,J + PUSH P,I + PUSHJ P,QFL ;LOOK UP DIR IN MFD, RET TRACK IN J + JRST QSKON ;NON EXISTENT + PUSHJ P,QFLDF ;FIND FREE LOSER DIR SLOT + MOVE I,MDSK + PUSHJ P,QCHNF ;FIND FREE CHNL (TO READ IN DIR) + MOVEM C,QSNUD(H) ;SET USER NAME IN DIR SLOT + MOVEM J,QSLGL(E) ;REQUEST READ IN OF USER DIR FROM TRACK IN J + MOVEI TT,%QMUDR + MOVEM TT,QSRAC(E) +QSKON1: MOVEI T,2 + PUSHJ P,LSWPON ;RELEASE QSKOSW, LEAVE SOSSET OF QSNNR(H) + POP P,I ;GO AWAY WILL HANG UP WAITING IN QUDLK + POP P,J ;DIR IS LOCKED BUT NOT ON LSWPR, PI WILL UNLOCK AFTER READIN + JRST QSTRTR + +QNOFRE: POP P,I ;NO FREE FILES AVAIL + JRST POPBAJ + +QPNL24: PUSHJ P,OPNL24 + JRST URET + +QPNL20: PUSHJ P,OPNL20 + SKIPE QLD(U) + PUSHJ P,OPNL47 ;FOUND LINK, BUT IT POINTS TO NON-EXISTENT DIRECTORY + JRST URET + +AUTOCR: ;AUTOMATICALLY CREATED DIRECTORIES +IFN TPLP+UNSPLP,SIXBIT /.LPTR./ ;FOR TPL SPOOLING + SIXBIT /.MSGS./ ;FOR MESSAGES TO ALL LOSERS + SIXBIT /.MAIL./ ; Programs like to write mail here + SIXBIT /CRASH/ ; Programs like to dump themselves here + SIXBIT /.TEMP./ ; Programs like to write randomness here +NATOCR==.-AUTOCR + +QSKON: JUMPE C,QPNL20 ;DON'T ALLOW ZERO USER NAME + PUSH P,TT + MOVSI TT,-NATOCR +QSKONA: CAMN C,AUTOCR(TT) + JRST QSKONB + AOBJN TT,QSKONA + CAMN A,[SIXBIT /..NEW./] + CAME B,[SIXBIT /(UDIR)/] + JRST [POP P,TT + JRST QPNL20] + BUG INFO,[DSK: DIR ],SIXBIT,C,[CREATED BY ],SIXBIT,UNAME(U),SIXBIT,JNAME(U) +QSKONB: POP P,TT + SKIPG NQFUS + JRST QPNL24 ;NO MFD SLOTS AVAILABLE + PUSH P,A + PUSH P,B + PUSH P,C +QSKONE: PUSHJ P,QFLDF ;FIND FREE DIR SLOT + PUSHJ P,QMLOCK + PUSHJ P,TCALL + JRST IOMQ + JRST [PUSHJ P,LSWPOP ;QMDRO + PUSHJ P,LSWPOP ;QSNNR + PUSHJ P,UDELAY ;HOPEFULLY MEMORY WILL APPEAR SHORTLY + JRST QSKONE] + MOVEM C,QSNUD(H) + SOS NQFUS ;NO TIMING ERR DUE TO QSKOSW + MOVEI J,MU23UD + DPB J,[MUR,,MEMBLT(A)] + DPB H,[MNUMB,,MEMBLT(A)] + LSH A,10. + HRRM A,QSNLCN(H) + SETZM (A) + HRLS A + AOS B,A + BLT A,2000-2(B) + MOVEI A,2000 + MOVEM A,UDNAMP-1(B) + MOVE A,QSNUD(H) + MOVEM A,UDNAME-1(B) + MOVE B,QACTB ;NOW PUT UFD INTO MFD + IORB B,QMDRO + MOVE TT,MDNAMP(B) ;LOOK FOR A FREE SLOT + ADDI TT,(B) +QSKONC: TRNN TT,1777 + JRST QSKOND + SKIPN MNUNAM(TT) + JRST QSKONF + ADDI TT,LMNBLK + JRST QSKONC + +QSKONF: SUBI TT,(B) + JRST QSKONG + +QSKOND: MOVNI TT,LMNBLK ;NO FREE SLOTS, SO EXTEND DOWNWARD + ADDB TT,MDNAMP(B) +QSKONG: ADDI B,(TT) + MOVEM A,MNUNAM(B) + SUBI TT,2000-2*NUDSL ;GET DISK BLOCK NUMBER +IFN KA10P, SKIPGE TT +IFE KA10P, CAIGE TT,2 ; Don't clobber 'HOM' blocks + BUG ;TOO MANY UFDS (NQFUS CHECK DIDN'T WORK) + LSH TT,-1 + MOVEM TT,QSNMI(H) + MOVE TT,QACTB ;UNLOCK UFD AND CAUSE IT TO GET WRITTEN + HLLM TT,QSNLCN(H) + PUSHJ P,QMULK ;UNLOCK MFD + POP P,C + POP P,B + POP P,A + JRST QSKON1 + +SUBTTL MAKE LINK + +QALINK: MOVE I,MDSK ;ENTER WITH QSNNR ON LSWPR + MOVEM I,EPDL(U) + PUSHJ P,QWRO2 ;MAKES NEW FILE WITH MINIMUM OF 37 BYTES OF DESC SPACE + MOVSI A,UNLINK ; AND ADDS QUSR AND QSNLCN ON LSWPR + IORM A,UNRNDM(Q) ;SET LINK BIT + MOVE A,E ;QSK CHANNEL NUMBER + MOVE C,SRN5(U) ;SNAME LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN3(U) ;FN1 LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN4(U) ;FN2 LINKED TO + PUSHJ P,LDEP + JFCL + MOVE E,A ;QSK CHANNEL NUMBER FOR QCHNRT + MOVEI R,EPDL(U) ;DON'T CLOSE A REAL IOCHNM WORD + PUSHJ P,QSOCL4 ;CLOSE CHNL & FILE + PUSHJ P,LSWDEL ;DELETE QUSR, HAS BEEN SETOM'ED + PUSHJ P,LSWDEL ;DELETE QSNRR, HAS BEEN SOS'ED + JRST POPJ1 + +LDEP: MOVEI E,6 ;STORE SIXBIT FROM C INTO LINK DESC +LDEPL: MOVEI B,0 ;GET NEXT CHAR + LSHC B,6 + JUMPE B,LDEPS ;*THIS ALLOWS EMBEDDED BLANKS. + CAIE B,'; + CAIN B,': + JRST LDEPS +LDEPS2: MOVE D,B + PUSHJ P,QUDS + SOS E ;NUMBER OF CHARACTERS LEFT IN WORD + JUMPN C,LDEPL ;JUMP IF ANY MORE NON-BLANK CHARS TO STORE + MOVEI D,'; + JUMPE E,POPJ1 ;JUMP IF STORED 6 CHARACTERS + POPJ P, ;STORED FEWER, NEED TERMINATOR + +LDEPS: MOVEI D,': ;THIS CHAR NEEDS TO BE QUOTED + PUSHJ P,QUDS + JRST LDEPS2 + +;LINK ENCOUNTERED DURING LOOKUP + +QLINK: TRNE D,%DONLK/2 ;CHECK 3.5 BIT IN OPEN MODE + JRST QOLINK ;JUMP IF DON'T CHASE LINKS MODE + AOS A,QLD(U) + CAIL A,100. + JRST OPNL27 ;LINK DEPTH EXCEEDED + PUSH P,E ;SAVE XR NEEDED BY LSWPOP OF QUSR ENTRY + MOVE E,TT + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + MOVE TT,QBTBLI(TT) + HRR TT,E + MOVE I,[440600,,A] + SETZB A,B + SETZ C, +QL1: ILDB J,TT + JUMPE J,QL3 ;END DESC + CAIN J,': + JRST QL4 ;QUOTE NEXT CHAR + CAIN J,'; + TLZA I,770000 ;TERMINATE THIS WORD +QL5: IDPB J,I + JRST QL1 + +QL4: ILDB J,TT ;GET CHAR THAT WAS QUOTED + JRST QL5 + +QL3: EXCH A,C ;END OF DESC REACHED + EXCH A,B ;MAKE A FN1 B FN2 C SNM + SKIPN C + MOVE C,USYSN1(U) + PUSHJ P,QUDULK ;UNLOCK DIR + POP P,E ;RESTORE XR USED BY LSWPOP OF QUSR ENTRY + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,OPBRK ;IF TRYING TO BE PCLSRED, SUBMIT + JRST QSKOL + +QOLINK: MOVSI TT,%QALNK ;OPENING UP A LINK + IORM TT,QSRAC(E);DON'T ALLOW FILE-ONLY OPERATIONS SUCH AS IOT + JUMPL D,QWROR1 ;LEAVE RH(QSRAC)=%QMIDL SO PI LEVEL WON'T MESS WITH IT + JRST QOEX1 ;AND FINISH OPENING + +SUBTTL PAW OVER MFD + +QMCH1: CONO PI,UTCOFF + MOVE TT,QMDRO + TLNE TT,40000 + AOJE TT,QMCH2 ;NOT ON WAY IN +QMCH3: CONO PI,UTCON + SKIPGE QMDRO + PUSHJ P,UFLS + MOVSI E,2 + TDNN E,QMDRO + POPJ P, ;PAWED OVER + PUSHJ P,QMLOCK + ANDCAM E,QMDRO + HRRZ E,QMDRO + MOVE TT,MDCHK(E) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] +QMCH1A: MOVEI E,2000-LMNBLK*NUDSL(E) +IFN KA10P, SETZM NQFUS +IFE KA10P,[ + MOVNI TT,2 ;PROTECT DEC 'HOM' BLOCKS SO KLDCP OR 8080 + MOVEM TT,NQFUS ; CAN FIND ITS CRUFT +] ;IFE KA10P +QMCH1E: LDB TT,[1200,,E] + JUMPE TT,QMULK + SKIPN (E) + AOS NQFUS + ADDI E,LMNBLK + JRST QMCH1E + +QMCH2: SOS QMDRO ;INDICATE ON WAY IN + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + MOVEI TT,MFDBLK ;MFD TRACK + MOVEM TT,QSLGL(E) + MOVEI TT,%QMMDR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QMCH3 + +SUBTTL PAW OVER TUT + +QTCH1: CONO PI,UTCOFF + MOVSI TT,200000 + TDNE TT,QTUTO(I) + JRST QTCH2 ;GO READ IT IN + CONO PI,UTCON +QTCH1A: PUSHJ P,QTLOCK ;TO MAKE SURE IT'S IN + AOSE QDPWF(I) + JRST QTULK ;ALREADY PAWED OVER + PUSH P,A + PUSH P,B + MOVE T,QTUTO(I) + MOVE E,QSWAPA(T) + IDIVI E,DECADE + SKIPE TT + ADDI E,1 + IMULI E,DECADE ;ROUND SWAPPING ALLOC TO MULTIPLE OF A DECADE + MOVEM E,QSWAPA(T) + PUSH P,D + PUSH P,E ;FIRST TRACK OF NON-SWAPPING (FILE) AREA + MOVE E,QTUTP(T) ;ROUND TUT POINTER TO MULTIPLE OF A DECADE + ADDI E,DECADE-1 + IDIVI E,DECADE + IMULI E,DECADE + CAMGE E,(P) ;KEEP IT WITHIN THE FILE AREA + MOVE E,(P) + MOVEM E,QTUTP(T) + MOVE E,QPKNUM(T) +IFN DC10P,[ + CAME E,QPKID(I) + BUG HALT,[PACK ID ],OCT,E,[IN TUT FOR UNIT ],DEC,I,[DIFFERS FROM HARDWARE PACK ID],OCT,QPKID(I) +] +IFE DC10P, MOVEM E,QPKID(I) + MOVE E,QPAKID(T) + MOVEM E,QPKNM(I) +IFN QRSRVP,[ + MOVE E,QTRSRV(T) + MOVEM E,QRESRV(I) +] +;DROPS THROUGH + ;DROPS IN + CLEARM QSFTS(I) ;FREE SPACE IN SWAPPING AREA + SETZB D,QSFT(I) + MOVE B,QTUTO(I) + HRLI B,(TUTBP) + ADDI B,LTIBLK +QTCH1D: ILDB A,B + JUMPN A,QTCH1F + CAML D,(P) + AOS QSFT(I) ;BLOCK IN NON-SWAPPING AREA + CAMGE D,(P) + AOS QSFTS(I) ;BLOCK IN SWAPPING AREA +QTCH1F: ADDI D,1 + CAMGE D,QLASTB(T) + JRST QTCH1D + SUB P,[1,,1] + POP P,D + POP P,B + POP P,A + JRST QTULK + +QTCH2: SETOM QDPWF(I) + ANDCAM TT,QTUTO(I) + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + HRRZM I,QDSKN(E) + MOVEI TT,MFDBLK ;TELL PI LEVEL TO READ IT ALL IN + SUB TT,NTBL(I) + MOVEM TT,QSLGL(E) + LDB TT,[121000,,QTUTO(I)] + MOVEM TT,QSCABN(E) + MOVEI TT,%QMTTR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QTCH1A + +;ROUTINE TO ACCESS TUT +;CALL WITH DISK UNIT NUMBER IN I, BLOCK NUMBER IN D +;RETURNS IN D AN LDB-STYLE POINTER TO THE TUT AND IN B THE BYTE +;THAT YOU WOULD GET BY LDB'ING THAT POINTER. +;CLOBBERS E +;CALLER MUST LOCK TUT + +TUTPNT: MOVE B,QTUTO(I) + CAML D,QFRSTB(B) + CAML D,QLASTB(B) + BUG ;BLOCK NUMBER NOT IN RANGE COVERED BY TUT + SUB D,QFRSTB(B) + IDIVI D,TUTEPW + ADDI D,LTIBLK(B) + HLL D,TBTBL(E) + LDB B,D + POPJ P, + +QSTRTR: +IFN DC10P,[ +QSTRT1: CONSO DC0,DSKCHN + SETOM QHUNGF ;SOMEONE PUSHED RESET BUTTON, RECOVER AT PI LEVEL + CONO DC0,DCSET+DCIENB+DSKCHN ;ENABLE IDLE INTERRUPT +] +IFN RP10P+RH10P+RH11P,[ + CONO PI,UTCOFF + PUSHJ P,QSTRT1 + CONO PI,UTCON +] + POPJ P, + +IFN RP10P+RH10P+RH11P,[ ;START DISK WITH UTC ALREADY OFF +QSTRT1: SETOM QGTBZY ;NOTE: TURNS UTC BACK ON BUT NOT CLOCK +IFN RP10P, CONSO DPC,20 ;ONLY IF DISK IDLE +IFN RH10P, CONSO DSK,%HIBSY +IFN RH11P, IORDQ TT,%HRCS1 +IFN RH11P, TRNE TT,%HXRDY + CONO PI,DSKRQ + POPJ P, +] + +;TRY TO FLUSH UNNEEDED UFDS FROM CORE. +;ARG IN C IS ROUTINE TO FREE THE MEMORY. +;CALL WITH UDRSW SIEZED, OR WITH PI 2 IN PROGRESS AND UDRSW NOT LOCKED BY ANYONE +;CLOBBERS H, TT. DOESN'T SKIP. +QDFLS: MOVSI H,-QNUD +QDFLS1: SKIPE QSNUD(H) + SKIPE QSNNR(H) +QDFLS2: AOBJN H,QDFLS1 ;CAN'T FLUSH IF SLOT NOT USED OR CHANNELS OPEN IN DIR + JUMPGE H,CPOPJ + MOVE TT,QACTB + TLO TT,600000 + TDNE TT,QSNLCN(H) + JRST QDFLS2 ;CAN'T FLUSH IF LOCKED OR NOT WRITTEN OUT + PUSHJ P,QDFCHK ;CHECK THAT NO POINTERS TO THIS DIRECTORY REMAIN + CLEARM QSNUD(H) ;FLUSH + AOS QFUD + PUSH P,A + HRRZ A,QSNLCN(H) + LSH A,-10. + PUSHJ P,(C) ;RETURN THE MEMORY + POP P,A + JRST QDFLS2 ;TRY FLUSHING SOME MORE + +;CALL WITH UFD SLOT# IN H, WHEN YOU THINK THAT UFD IS FREE. +QDFCHK: PUSH P,C + PUSH P,J + MOVSI C,-NQCHN +QDFCH1: SKIPGE QUSR(C) + AOBJN C,QDFCH1 + JUMPGE C,QDFCH2 + HRRZ J,QUDPR(C) + CAIN J,(H) + BUG ;IT WASN'T REALLY FREE, MAYBE QSNNR IS SCREWED UP? + AOBJN C,QDFCH1 +QDFCH2: POP P,J + POP P,C + POPJ P, + +;FIND A FREE UFD SLOT, RETURN INDEX IN H. PUTS QSNNR ON LSWPR. +;CLOBBERS T, TT. + +QFLDF: PUSHJ P,SWTL + UDRSW + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSH P,C ;ALL UFD SLOTS IN USE, TRY FLUSHING SOME + MOVEI C,MEMR + PUSHJ P,QDFLS + POP P,C + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,UDELAY ;WAIT 1/2 SECOND THEN TRY AGAIN, INCLUDING QDFLS + JRST QFLDF + +QFLDF1: SKIPN QSNNR(H) ;SLOT ALREADY GOBBLED + SKIPE QSNUD(H) ;OR ALREADY OCCUPIED + AOBJN H,QFLDF1 ;MEANS CAN'T TAKE IT + SKIPL H + BUG ;NONE FREE, QFUD OUT OF PHASE WITH REALITY + HRRZS H + SOS QFUD + MOVSI TT,600000 ;DOUBLE LOCK + MOVEM TT,QSNLCN(H) + AOSG QSNNR(H) + BUG + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,LOSSET + QFLDRT + POPJ P, + +;LOSSET ROUTINE +QFLDRT: SKIPL A,AC0S+H(U) + CAIL A,QNUD + BUG ;H CLOBBERED + SOSGE T,QSNNR(A) + BUG + JUMPG T,CPOPJ ;HOW DID SOMEONE ELSE GET IT? + SKIPN QSNUD(A) + AOS QFUD ;READ-IN NEVER STARTED, SLOT BECOMES FREE + POPJ P, ;OK TO LEAVE 600000,, SET IN QSNLCN + +;C HAS DIR NAME. +;IF IN CORE, SET H TO UFD SLOT#, AOS QSNNR, PUT ON LSWPR, AND SKIP. +;IF DIRECTORY NOT IN CORE, NO SKIP. CLOBBERS T,TT. +QFLD: PUSHJ P,SWTL + UDRSW +QFLD1A: MOVSI H,-QNUD +QFLD1: CAME C,QSNUD(H) + AOBJN H,QFLD1 + JUMPGE H,LSWPOP ;JUMP ON FAILED TO FIND USER. +QFLD2A: AOSG QSNNR(H) + BUG ;MUST HAVE GOTTEN NEGATIVE SOMEHOW + PUSHJ P,LSWPOP ;UDRSW +; PUSHJ P,SOSSET +; QSNNR(H) +;THIS IS AN ATTEMPT TO FIND A BUG. + PUSH P,T + MOVEI T,QSNNR(H) + MOVEM T,IOTBTS(U) + PUSHJ P,LOSSET + [ SOSGE @IOTBTS(U) + BUG + POPJ P, ] + POP P,T +;END TEMPORARY CODE + JRST POPJ1 + +;C <=SYS NAME, RETURNS TRACK ADDR OF DIR IN J, SKIPS IF FINDS LOSER +QFL: PUSHJ P,QMLOCK + PUSHJ P,QFL0 + JRST QMULK + AOS (P) + JRST QMULK + +QFL0: PUSH P,Q + HRRZ Q,QMDRO + ADD Q,MDNAMP(Q) ;PTR TO USER AREA +QFL1: LDB J,[1200,,Q] + JUMPE J,QFL3 + CAMN C,MNUNAM(Q) + JRST QFL2 + ADDI Q,LMNBLK + JRST QFL1 + +QFL2: SUBI J,2000-LMNBLK*NUDSL ;J <= TRACK ADDR OF USER DIR + LSH J,-1 + AOS -1(P) ;SUCCESS +QFL3: POP P,Q + POPJ P, + +;ROUTINE TO ASSIGN A DISK CHANNEL. +;ARGS: U USER TO GO IN QUSR, H UFD SLOT# TO GO IN QUDPR, I DSK# TO GO IN QDSKN +;RETURNS QSK CHNL INDX IN E. +;DOESN'T DO A LOSSET OF QCHNRT, BUT CALLER MAY WANT TO. +;CLOBBERS T. NEVER SKIPS. + +QCHNF: PUSHJ P,SWTL ;PREVENT ANYONE ELSE FROM ALLOCATING CHANNELS + QCHSW + MOVSI E,-NQCHN + SKIPLE QFCHN + JRST QCH2 ;SOME CHANNELS ARE AVAILABLE, GO FIND ONE + PUSHJ P,LSWPOP ;QCHSW + SKIPG QFCHN + PUSHJ P,UFLS + JRST QCHNF + +QCH2: SKIPGE QSRAC(E) .SEE %QALOK + JRST QCH3 + SKIPGE QUSR(E) + JRST QCH1 +QCH3: AOBJN E,QCH2 + BUG ;WHERE DID THAT FREE CHANNEL GO? + +QCH1: HRRZS E ;CHANNEL ALLOCATED, INITIALIZE VARIABLES + HRRZM I,QDSKN(E) + SETOM QSCABN(E) + SETOM QSGL(E) + SETOM QSLGL(E) ;IN CASE OF WRITE-OVER ON 0-LENGTH FILE. + SETZM QBFP(E) + SETZM QSBFS(E) + CLEARM QSLBLK(E) + SETOM QSMDN(E) + SETZM QSCRW(E) + SETZM QSBI(E) + SETZM QSRAC(E) .SEE %QMIDL + CLEARM QFBLNO(E) + SETZM QSMPRC(E) + SETZM QSMPRP(E) + MOVE T,[444400,,1] ;ASSUME BYTES=WORDS, WILL BE FIXED LATER + MOVEM T,QSBYTE(E) + SETZM QPCLSR(E) + HRRZM H,QUDPR(E) + SETZM QUDFPR(E) ;NOT YET SET UP TO ANY PARTICULAR FILE + MOVEM U,QUSR(E) ;CHANNEL IS NOW IN-USE + SOSGE QFCHN + BUG + JRST LSWPOP ;QCHSW + +;LOSSET ROUTINE TO RETURN TENTATIVELY ASSIGNED QSK CHNL +;E HAD BETTER CONTAIN THE QSK CHANNEL NUMBER AT "ALL" TIMES +QCHNRT: SKIPL T,AC0S+E(U) + CAIL T,NQCHN + BUG ;E CLOBBERED + HRRZ A,U ;LSWPOP MESSES WITH LH(U) + CAME A,QUSR(T) + BUG + SETOM QUSR(T) + AOS QFCHN + POPJ P, + +SUBTTL DELETE, RENAME +;COME HERE FOR DELETE, OR RENAME NOT WHILE OPEN, ON DISK. + +QRNAM: SKIPN SRN3(U) + JRST QDEL + PUSH P,A + PUSH P,B + SKIPN B,SRN4(U) + JRST QPNL11 + MOVE A,SRN3(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL13 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL13 + POP P,B + POP P,A + PUSH P,SRN3(U) + PUSH P,SRN4(U) + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST [ SUB P,[2,,2] + JRST QROR1C ] ;GIVE FILE NOT FOUND OR FILE LOCKED + MOVE I,Q + POP P,B + POP P,A + PUSHJ P,QGRLSC + JRST QPNLBN ;FILE ALREADY EXISTS + PUSHJ P,QFNG +QRNAM4: PUSHJ P,QLOOK + JRST QRNAM3 + CAME I,Q ;ALLOW RENAME THAT DOESN'T CHANGE NAMES. + JRST QPNL13 +QRNAM3: MOVE Q,I + MOVSI TT,UNDUMP ;SAY FILE NOT DUMPED. + ANDCAM TT,UNRNDM(Q) + MOVNI E,1 ;TELL QFREF NOT TO CLOBBER NON-EX DISK CHNL. + PUSHJ P,QFREF ;"REFERENCE" FILE + PUSHJ P,QRELOC ;STORE NEW NAMES IN DIR +QRNAM2: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QRNAM1: MOVE U,USER ;U MAY NOT HAVE USER IF CAME HERE FROM LOGOUT + PUSHJ P,LSWCLR + JRST POPJ1 + +QGRLSC: CAME A,[SIXBIT />/] ;SKIP NONE IF BOTH A+B ARE SPECIAL + CAMN A,[SIXBIT //] ;AND TWICE IF NEITHER + CAMN B,[SIXBIT / LOOK UP FILE TO DELETE +;Q .NE. 0 => DELETE FILE POINTED TO BY QUDFPR OF CHNL IN D +;H MUST HAVE DIR SLOT INDEX +QDELA: MOVEI Q,0 +QDLA1: PUSHJ P,SLUGH + QCHSW + 1000,,QSNLCN(H) + 1000,,QTUTO(I) + JUMPN Q,QDLA2 + PUSHJ P,QLOOK + JRST QDEL4A ;FNF + SETO D, ;NO ASSOCIATED CHANNEL +QDLA3: LDB A,[UNLNKB+UNRNDM(Q)] + LDB TT,[UNPKN+UNRNDM(Q)] + CAME TT,J + JUMPE A,QDELA1 ;ON DIFFERENT DISK (DIDN'T LOCK RIGHT TUT TRY AGAIN) + MOVE A,Q + SUB A,QSNLCN(H) + MOVSI J,-NQCHN +QDEL1: CAIN D,(J) + JRST QDEL2 ;IGNORE CHANNEL (IF ANY) WHOSE CLOSING CAUSED THIS + HRRZ TT,QUDPR(J) + SKIPL QSCRW(J) ;ONLY LOOK AT READ CHNLS + CAIE TT,(H) + JRST QDEL2 + HRRZ TT,QUDFPR(J) + SKIPL QUSR(J) + CAIE TT,(A) + JRST QDEL2 + MOVSI TT,%QADEL ;FOUND CHNL WITH THIS FILE OPEN + IORM TT,QSRAC(J) ;DELETE FILE WHEN THIS CHNL CLOSED + MOVSI TT,UNCDEL ;SET DELETED BIT + IORM TT,UNRNDM(Q) +QDEL4: MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVE TT,DCHBT(I) + IORM TT,QTUTO(I) +QDEL4B: PUSHJ P,QTULK + PUSHJ P,QUDULK + PUSHJ P,LSWPOP + JRST POPJ1 + +QDLA2: MOVE Q,QUDFPR(D) ;COMPUTE FILE ADR FROM CHNL IN D + ADD Q,QSNLCN(H) ;DIR MAY HAVE MOVED + JRST QDLA3 + +QDEL4A: SOS (P) + JRST QDEL4B + +QCDLWO: PUSH P,R ;OUTPUT CLOSE BUT FILE WAS DELEWO'ED + SETZM QSCRW(D) ;FAKE OUT ERROR CHECK AT QSQSH6 + PUSHJ P,QUDULK +QSICLD: MOVE H,QUDPR(D) ;ENTRY FROM INPUT CLOSE, FILE WAS DELETED + MOVE I,QDSKN(D) + PUSHJ P,QUDLK + MOVE Q,QSNLCN(H) + ADD Q,QUDFPR(D) + MOVE J,QPKID(I) + PUSHJ P,QUDULK + PUSH P,D + PUSHJ P,QDLA1 + BUG ;FILE ISNT THERE? + POP P,D + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QICLX + +QDELA1: PUSHJ P,QDEL4B ;NOT OUR DISK IN J + JFCL + MOVE J,TT ;DISK ITS REALLY ON +QDELA2: MOVSI I,-NQS ;TRANSLATE PACK # IN J TO DRIVE # IN I + CAME J,QPKID(I) + AOBJN I,.-1 + JUMPGE I,QPKNF1 + JRST QDELA + +QSOCLD: PUSH P,D ;DELETE FILE WHEN CLOSING OVER IT + PUSH P,R + LDB J,[UNPKN+UNRNDM(Q)] + PUSHJ P,QUDULK + PUSHJ P,QDELA2 + JFCL +QPKNF7: POP P,R + POP P,D + POPJ P, + +QPKNF1: PUSHJ P,QPKNFP ;MAYBE TUT NOT IN YET? + JRST QDELA2 ;YUP, TRY AGAIN + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST QUDULK ;GONE AWAY BETWEEN LOCKS + JRST QDFPK ;GO DELETE OFF OF NON-MOUNTED PACK + +QDL2: PUSHJ P,QTULK ;DELETE LINK + MOVEI T,2 + PUSHJ P,LSWPON ;UNLOCK QCHSW +QDLINK: LDB E,[UNDSCP+UNRNDM(Q)] + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + HLL E,QBTBLI(TT) + ILDB A,E + SKIPN E + BUG ;NULL LINK? + MOVEI B,0 +QDL1: DPB B,E ;CLEAR OUT THE CHAR + CAIN A,': + IDPB B,E ;CLEAR A QUOTED CHAR WITHOUT LOOKING AT IT + ILDB A,E + JUMPN A,QDL1 + PUSHJ P,QSQSH ;REMOVE ENTRY + MOVE TT,QACTB + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + JRST POPJ1 + +QDEL2: AOBJN J,QDEL1 ;CHECK NEXT DISK CHANNEL + MOVE C,UNRNDM(Q) ;NOT OPEN, SO REALLY DELETE IT + TLNE C,UNLINK + JRST QDL2 + ANDI C,.BM UNDSCP + IDIVI C,UFDBPW + ADD C,QSNLCN(H) + ADDI C,UDDESC + HLL C,QBTBLI(D) ;GET DESCRIPTOR POINTER IN C AND TT + MOVE TT,C + MOVEI A,0 + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE + PUSH P,A + SKIPN D,QSFBT(H) ;SEE IF ENOUGH QSFBT STORAGE EXISTS + JRST QDEL11 +QDEL10: HLRE B,(D) ;NUMBER OF FREE LOCATIONS IN THIS PAGE + ADD A,B ;DECREASE LOCATIONS NEEDED + MOVE D,1(D) ;CDR + JUMPN D,QDEL10 +QDEL11: JUMPLE A,QDEL12 ;JUMP IF SUFFICIENT STORAGE EXISTS + PUSHJ P,TCALL ;GET MORE + JRST IOMQ + JRST [ MOVE U,USER ;U MAY NOT HAVE USER IF CAME FROM LOGOUT + PUSHJ P,LSWCLR ;HAVE TO WAIT FOR MEMORY + PUSHJ P,MQTEST ;AVOID DEADLOCKS BY UNLOCKING EVERYTHING + PUSHJ P,UFLS + JRST UUOTRO ] + MOVEI D,MU23FB + DPB D,[MUR,,MEMBLT(A)] + LSH A,10. + MOVEI D,2(A) + HRLI D,-1776 + MOVEM D,(A) + MOVE D,A + EXCH A,QSFBT(H) ;ADD TO FRONT OF LIST + MOVEM A,1(D) + MOVE A,(P) ;GET BACK NUMBER OF BLOCKS NEEDED + JRST QDEL10 ;SEE IF THERE ARE ENOUGH NOW + +QDEL12: POP P,A ;GET RID OF BLOCKS COUNT + PUSHJ P,QSQSH ;REMOVE ENTRY, CANNOT PCLSR AFTER THIS + CLEARB J,D ;J GETS NUMERIC TRACK NUMBER, D BYTE POINTER TO TUT + MOVE TT,QTUTO(I) ;D ZERO SO WILL HALT IF DESC DOESN'T START WITH LOAD-ADDR! + MOVE Q,QSFBT(H) ;Q -> AOBJN POINTER FOR STORING BLOCK NUMBERS +QDEL3: ILDB B,C ; INTO QSFBT AS DESCRIPTORS ARE ZEROED OUT + MOVEI A,0 ;I DISK, C BP TO DESCRIPTOR, A,B,E TEMP. + DPB A,C + JUMPE B,QDEL4 ;END OF FILE DESCRIPTION + TRNE B,40 + JRST QDEL6 + CAILE B,UDTKMX + JRST QDEL7 +QDEL8: SKIPN Q + BUG ;OOPS, OUT OF QSFBT STORAGE + SKIPL E,(Q) ;PICK UP AOBJN POINTER + JRST [ MOVE Q,1(Q) ;THIS PAGE FULL, TRY NEXT + JRST QDEL8 ] + MOVEM J,(E) ;STORE DISK,,BLOCK FOR LATER FREEING + AOBJN E,.+1 + MOVEM E,(Q) ;INCREMENT POINTER + MOVE E,QSNLCN(H) ;DECREASE DIR'S BLOCKS-USED + HRRZ A,UDBLKS(E) + SOSL A + HRRM A,UDBLKS(E) + ILDB A,D ;CHECK TUT + SKIPN A + BUG ;TUT SHOWS TRACK NOT USED + AOS J ;DO NEXT BLOCK IN CONTIGUOUS GROUP + SOJG B,QDEL8 + JRST QDEL3 + +IFN NXLBYT-2, .ERR THIS ROUTINE AND OTHERS KNOW IMPLICITLY THAT NXLBYT=2 +QDEL6: MOVEI D,0 ;LOAD ADDRESS + DPB B,[140500,,D] + ILDB B,C + DPB B,[060600,,D] + DPB A,C ;A HAS ZERO FROM QDEL3 + ILDB B,C + DPB B,[0600,,D] + DPB A,C + MOVE J,D + HRL J,I + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + JRST QDEL7A + +QDEL7: CAIN B,UDWPH + JRST QDEL3 + SUBI B,UDTKMX + ADD J,B + IBP D + SOJG B,.-1 +QDEL7A: MOVEI B,1 ;LOAD ADDRESS OR SKIP AND TAKE, SO ONLY ONE TRACK + JRST QDEL8 + +QDFNF: PUSHJ P,OPNL4 + JRST URET + +QDELB: CONO PI,UTCON + JRST QDELA + +;PERFORM BLOCK-FREEING SPECIFIED BY QFBTS +QDLFBT: CONO PI,UTCOFF ;PROTECT QFBTS + SKIPN B,QFBTS + JRST UTCONJ + MOVE T,1(B) + MOVEM T,QFBTS + CONO PI,UTCON + HRRZ T,(B) ;FIRST FREE LOCATION + SUBI T,2(B) ;NUMBER OF LOCATIONS TO DO + HRLO A,T + EQVI A,1(B) + AOBJP A,QDLFB9 ;A NOW -> BLOCKS TO FREE, & CHECK FOR EMPTY + SETO I, ;NO TUT LOCKED YET +QDLFB1: HLRZ J,(A) ;DISK NUMBER + CAMN J,I ;MAKE SURE RIGHT TUT IS LOCKED + JRST QDLFB2 + SKIPL I + PUSHJ P,QTULK + MOVE I,J + PUSHJ P,QTLOCK +QDLFB2: HRRZ D,(A) ;BLOCK NUMBER TO FREE + PUSHJ P,TUTPNT + CAIGE B,TUTMNY ;USED IN "MANY" FILES(1,2,...,TUTMNY,TUTLK) + SOJL B,[JRST 4,.] ;HALT IF TUT SHOWS TRACK NOT USED + JUMPN B,QDLFB3 ;NOT LAST USE + HRRZ T,(A) ;BLOCK NUMBER AGAIN + MOVE TT,QTUTO(I) + CAML T,QSWAPA(TT) + AOSA QSFT(I) + AOS QSFTS(I) ;TRACK IN SWAPPING AREA +QDLFB3: DPB B,D ;DECREASE USAGE COUNT IN TUT + AOBJN A,QDLFB1 + PUSHJ P,QTULK +QDLFB9: MOVEI A,-1(A) ;GET AN ADDRESS ON THAT PAGE + LSH A,-10. ;DONE WITH THIS PAGE, FREE IT + PUSHJ P,TMEMR ;RETURN PAGE TO FREE AND TRY FOR MORE + MU23FB + JRST QDLFBT + +;REMOVE HOLE FROM NAME AREA AT Q +QSQSH: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,TT + HRRZ TT,QSNLCN(H) + MOVE A,UDNAMP(TT) + CAILE A,2000 + BUG ;UDNAMP BAD + ADDI A,(TT) + HRRZ C,Q + SUB C,A + SKIPL C + CAIL C,2000-UDDESC + BUG ;Q BAD + HRRZ C,Q +QSQSH1: SUBI C,LUNBLK + CAMLE A,C + JRST QSQSH2 + HRLZ B,C + HRRI B,LUNBLK(C) + BLT B,2*LUNBLK-1(C) + JRST QSQSH1 + +QSQSH2: +REPEAT LUNBLK,SETZM .RPCNT(A) + SUBI A,-LUNBLK(TT) + HRRZM A,UDNAMP(TT) + HRRZ C,Q + SUBI C,(TT) ;INDEX OF DELETED FILE + HRRZI TT,-LUNBLK(A) ;INDEX OF OLD BEGINNING OF NAME AREA + MOVSI A,-NQCHN +QSQSH3: HRRZ B,QUDPR(A) + SKIPL QUSR(A) + CAIE B,(H) + JRST QSQSH4 + SKIPN B,QUDFPR(A) + JRST QSQSH4 + CAIGE B,(TT) + BUG + CAIN B,(C) + JRST QSQSH6 ;PNTR TO FLUSHED HOLE, CHECK IF READ CHNL + CAIG B,(C) ;IF AFTER DELETED FILE DON'T RELOCATE + ADDI B,LUNBLK + HRRZM B,QUDFPR(A) + SKIPL QSCRW(A) + JRST QSQSH4 ;READ CHNL + ADD B,QSNLCN(H) + MOVE B,UNRNDM(B) + TLNN B,UNWRIT + BUG ;CHNL WRITING BUT BEING WRITTEN BIT NOT SET +QSQSH4: AOBJN A,QSQSH3 + POP P,TT + POP P,C + POP P,B + POP P,A + POPJ P, + +QSQSH6: MOVE B,QSRAC(A) ;FOUND PNTR TO DELETED FILE + TLNE B,%QADEL ;SKIP IF NOT DELETE AFTER CLOSE + SKIPGE QSCRW(A) ;ALSO ERROR IF NOT READ CHNL + BUG + JRST QSQSH4 ;WAS DELETE AFTER CLOSE ON READ CHNL + +SUBTTL DIRECTORY LOOK UP, > FEATURE + +;A contains the FN1 and B contains the FN2. +;H is the index of the directory slot. The dir must be locked. + +;Returns the address of the filename block in Q. +;Clobbers C. + +;Internally, J and Q point to the bottom and top of the +;area of the dir we are still searching. +;Bit 4.9 of J is set to indicate one of the names is ">". +;C used as a flag: sign bit says creating a file. +;Bit 1.1 of C says FN2 is > or <. + +;Look for place to create new file, +;and generate new version for >. +QFNG: MOVEM Q,EPDL3(U) + SKIPA C,[SETZ] +;Look for existing files only +QLOOK: MOVEI C,0 + PUSH P,J + HRRZ J,QSNLCN(H) + MOVEI Q,2000-LUNBLK(J) + ADD J,UDNAMP(J) + CAMN A,[SIXBIT />/] + TLOA J,400000 + CAMN A,[SIXBIT / + CAMN B,[SIXBIT />/] + TLOA J,400000 + CAMN B,[SIXBIT //] + JRST POPJJ ;MUST BE READ RETN FILE NOT FOUND +QLOOK1: JUMPGE C,QLOOK9 + CAMN B,[SIXBIT /" +QLOOK9: PUSH P,D + PUSH P,TT + PUSH P,I + PUSH P,[-1] ;BEST INDEX + PUSH P,[SETZ] ;BEST "NUMERIC" PART + PUSH P,[SETZ] ;BEST ALPHA PART +QLOOK4: CAIGE Q,(J) + JRST QLOOK2 + XCT QLKI1(C) + JRST QLOOK3 + MOVE D,UNRNDM(Q) + TLNE D,UNIGFL + JUMPGE C,[ SKIPGE -2(P) ;FILE LOCKED, REMEMBER IT IF WE HAVE NO BETTER, + HRRM Q,-2(P) ; BUT DON'T CONSIDER IT IF READING + JRST QLOOK3 ] ;BUT IF WRITING, CONSIDER ALL FILES + SKIPE TT,@QLKI1+1(C) +QLOOK6: TRNE TT,77 ;RIGHT ADJ + JRST QLOOK5 + LSH TT,-6 + JRST QLOOK6 + +QLOOK5: MOVEI I,0 +QLOOK8: LDB D,[600,,TT] + CAIL D,'0 + CAILE D,'9 + JRST QLOOK7 ;NOT A DIGIT +QLOK5B: TRNE I,77 ;RIGHT ADJ LOW NON NUM PART + JRST QLOK5A + LSH I,-6 + JUMPN I,QLOK5B +QLOK5A: TLC TT,400000 ;AVOID CAM LOSSAGE + TLC I,400000 + SKIPGE -2(P) + JRST QLOK5D ;FIRST MATCH + JUMPGE J,QLOK5E ;GET LEAST + CAMGE TT,-1(P) ;GET GREATEST + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMGE I,(P) + JRST QLOOK3 ;NOT AS GOOD +QLOK5D: HRRZM Q,-2(P) + MOVEM TT,-1(P) + MOVEM I,(P) +QLOOK3: SUBI Q,LUNBLK + JRST QLOOK4 + +QLOK5E: CAMLE TT,-1(P) + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMLE I,(P) + JRST QLOOK3 + JRST QLOK5D + +QLOOK7: LSHC TT,-6 ;LOW DIGIT NOT NUMERIC + JUMPN TT,QLOOK8 ;NO NUMERIC DIGITS AT ALL ("BIN", MAYBE?) + JUMPL J,QLOK5B ;IF LOOKING FOR GREATEST, LET THIS BE LEAST + MOVNI TT,1 ;GREATEST IF LOOKING FOR LEAST + JRST QLOK5B + +QLOOK2: JUMPL C,QFNG1 ;REALLY WANT TO MAKE F.N.'S FOR WRITE + SUB P,[1,,1] + POP P,C ;BEST "NUMERIC" PART + POP P,Q ;ADR + POP P,I + POP P,TT + POP P,D + AOJE Q,POPJJ + MOVE A,UNFN1-1(Q) ;ACTUAL MATCHED FILE NAMES + MOVE B,UNFN2-1(Q) + SOJGE Q,POPJJ1 ;FOUND A FILE THAT WASN'T LOCKED + MOVEI Q,-LUNBLK(Q) + JRST POPJJ + +QFNG1: SKIPGE -2(P) + JRST QFNG2 ;NOT FOUND START W/ 1 + MOVE TT,-1(P) + TLC TT,400000 + MOVE I,[600,,TT] +QFNG3: LDB D,I + CAIL D,'0 + CAILE D,'9 + JRST QFNG4 ;REACH END OF NUMERIC FIELD + AOS D + CAILE D,'9 + JRST QFNG5 + DPB D,I +QFNG5A: TLNE TT,770000 + JRST QFNG3A + LSH TT,6 + JRST QFNG5A + +QFNG2: MOVSI TT,(SIXBIT /1/) +QFNG3A: MOVEM TT,A(C) ;STORE INTO A OR B AS APPRO + SUB P,[3,,3] + POP P,I + POP P,TT + POP P,D + MOVE Q,EPDL3(U) + JRST POPJJ + +QFNG5: MOVEI D,'0 + DPB D,I + ADD I,[60000,,] + JUMPL I,QFNG5A + JRST QFNG3 + +QFNG4: TLNN TT,770000 ;SKIP ON ALREADY 6 CHAR NAME + LSH TT,6 + MOVEI D,'1 + DPB D,I + MOVEI D,'0 +QFNG4B: TLNN I,770000 + JRST QFNG5A + IDPB D,I + JRST QFNG4B + +QLKI1: CAME B,UNFN2(Q) + CAME A,UNFN1(Q) + UNFN2(Q) + +QPKNF: MOVE C,QSNUD(H) + PUSHJ P,QUDULK ;UNLOCK DIR + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,QPKNFP + JRST QSKOL + PUSHJ P,OPNL16 ;PACK NOT MOUNTED + JRST URET + +QPKNFP: MOVSI I,-NQS +QPKNF3: SKIPGE QACT(I) + JRST QPKNF4 + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) + TLNE TT,40000 + JRST QPKNF2 ;PACK NOT IN OR NOT PAWED OVER +QPKNF4: AOBJN I,QPKNF3 + JRST POPJ1 + +QPKNF2: JRST QTCH1 ;MAYBE THIS UNIT HAS GOODIES + +QFDF: PUSHJ P,OPNL5 ;FILE DIR FULL ON WRITE + JRST URET + +QPNL13: PUSHJ P,OPNL13 + JRST URET + +QPNL22: PUSHJ P,OPNL22 + JRST URET + +QPNLBN: +QPNL11: PUSHJ P,OPNL11 + JRST URET + +;ROUTINE TO FIND PLACE IN DIRECTORY WHERE A B WOULD GO +;SKIPS ONLY IF DIRECTORY CONTAINS AT LEAST ONE FILE +;FOR INSERTION, FILE GOES BEFORE PNTR RETURNED IN J +;RETURNS PNTR IN Q TO BEGINNING OF NAME AREA +;(ONLY WORKS FOR LUNBLK = 5) +QLGLK: HRRZ J,QSNLCN(H) + HRRZ Q,UDNAMP(J) + ADDI Q,(J) + CAIL Q,2000(J) + POPJ P, ;DIRECTORY EMPTY + TLC A,(SETZ) + TLC B,(SETZ) + PUSH P,D + PUSH P,E + ADDI J,600 ;128. NAME BLOCKS FROM END +REPEAT 7,[ ;THIS CODE DELIBERATELY NOT INDENTED. NEED 4 DIMENSIONS. + CAMGE J,Q + JRST .+6 + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAMN A,D + JSP E,QLGLE + CAML A,D + ADDI J,<1_<7-.RPCNT>>*LUNBLK + SUBI J,<1_<6-.RPCNT>>*LUNBLK +] + CAMGE J,Q + ADDI J,LUNBLK + CAMGE J,Q + BUG + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAME A,D + JRST QLGL1 + MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMLE B,D +QLGL2: ADDI J,LUNBLK +QLGL3: TLC A,(SETZ) + TLC B,(SETZ) + POP P,E + POP P,D + JRST POPJ1 + +QLGL1: CAML A,D + JRST QLGL2 + JRST QLGL3 + +;CALL BY JSP E,QLGLE +QLGLE: MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMN B,D + JRST QLGL3 + CAML B,D + JRST 1(E) + JRST 2(E) + +SUBTTL LOCKING ROUTINES + +QMLOCK: PUSHJ P,LSWTL + QMDRO + POPJ P, + +QMULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QMDRO + BUG + POP P,U + JRST LSWPOP + +QTLOCK: PUSHJ P,LSWTL + QTUTO(I) + POPJ P, + +QTULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QTUTO(I) + BUG + POP P,U + JRST LSWPOP + +QUDLK: PUSHJ P,LSWTL + QSNLCN(H) + POPJ P, + +QUDULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QSNLCN(H) + BUG + POP P,U + JRST LSWPOP + +SBTBLI: +QBTBLI: 440600,, ;IF GOING TO ILDB +SBTBL: +QBTBL: 360600,, + 300600,, + 220600,, + 140600,, + 060600,, + 000600,, + +TBTBL=.+1 +TBTBLI: REPEAT 1+TUTEPW, TUTBP-<.RPCNT*TUTBYT*010000,,> + +SUBTTL DIRECTORY GARBAGE COLLECTOR + +; MOVE H, directory number +; lock the directory +; PUSHJ P,QGC +; return if directory full. +; return if won. +; No ACs clobbered. +; All pointers to directory relocated appropriately. + +; Called from disk open routines if a new file is to be created +; and there are less than 6+LUNBLK words in the free area of the directory. +; Called from QSBWG if %QAFUL is set in QSRAC. +; %QAFUL means "must have successful GC before committing another track to this file." + +;NOTE NOTE NOTE: +; This GC allocates an extra block of core for temporary storage. +; If no memory is free in low half, waits without unlocking directory. +; Can possibly PCLSR. No deadly embrace to not unlock directory since +; it can't be flushed from core anyway and it's not holding anything else in. + +QAPBMN==NXLBYT+3 ;minimum number of descriptor bytes which + ; must be available at the end of a file to + ; commit another track to the file. + ;1 for a take-N, NXLBYT+1 for jump, 1 for ending zero. +QAPBMX==36. ;maximum number of descriptor bytes to allocate at a time. + +QGC: IRPC X,,ABCDQIJTR + PUSH P,X + TERMIN + +;Old GC prints message on system console. Any reason to with fast one? + +; validate the directory + +QGC00: SKIPL A,QSNLCN(H) + BUG ;directory not locked + MOVE C,UDNAME(A) + MOVEM C,LASTGC ;save name of last dir GCed + CAME C,QSNUD(H) + BUG ;directory clobbered + SKIPLE C,UDNAMP(A) + CAILE C,2000 + BUG ;name pointer out of bounds + IMULI C,UFDBPW + SKIPL D,UDESCP(A) + CAIL D,-UDDESC*UFDBPW(C) + BUG ;descriptor/name overlap + +; Get a block of core to use for temporary storage. +; The block is left in the "in-process" state. + + HRRZ Q,A + PUSHJ P,TCALL + JRST IOMQ + JRST [ PUSHJ P,UDELAY ;no core available in low half + JRST QGC00 ] ;so wait, then loop back to beginning + LSH A,10. + MOVEI B,1(A) ;zero it out + HRL B,A + SETZM (A) + BLT B,1777(A) + EXCH Q,A ;A -> directory, Q -> temporary core +;Drops through + ;Drops in +; Scan the directory and count: +; I all files +; J files open for writing +; R active bytes of descriptor + + SETZB I,J + SETZ R, + MOVEI B,2000(A) ;end of name area + ADD A,UDNAMP(A) ;start of name area +QGC10: CAML A,B + JRST QGC19 ;jump if all files done + SKIPE UNFN2(A) + SKIPN UNFN1(A) + BUG ;zero name block? + AOJA I,QGC12 ;file exists + +QGC11: ADDI A,LUNBLK ;advance to next file + AOJA R,QGC10 ;also count the zero byte that ends the descriptor + +QGC12: MOVE C,UNRNDM(A) + TLNE C,UNWRIT + ADDI J,1 + ANDI C,.BM UNDSCP ;get descriptor ptr (undscp has pos=0) + IDIVI C,UFDBPW + HLL C,QBTBLI(D) + ADDI C,UDDESC-2000(B) + MOVE D,UNRNDM(A) + TLNE D,UNLINK + JRST QGC14 +QGC13: ILDB T,C ;get byte of descrip + JUMPE T,QGC11 ;eof + CAIG T,UDWPH + AOJA R,QGC13 ;1-byte desc +REPEAT NXLBYT, IBP C ;multi-byte desc + ADDI R,NXLBYT+1 + JRST QGC13 + +QGC14: ILDB T,C ;count bytes of link descriptor + JUMPE T,QGC11 + CAIN T,': + AOJA R,[IBP C ;quoted + AOJA R,QGC14 ] + AOJA R,QGC14 + + +; Compute number of bytes of descriptor to add after each +; file open for output. If > QAPBMX, set to QAPBMX. +; If < QAPBMN, take directory-full exit. + +QGC19: MOVE C,I ;save number of files + IMULI I,LUNBLK*UFDBPW ;number of bytes in name area + ADDI R,UDDESC*UFDBPW(I) ;R := total number of bytes claimed + MOVEI A,2000*UFDBPW-1 + SUB A,R ;A := number of bytes left + SKIPE J + IDIV A,J ;number of bytes available to extend open files + CAIGE A,QAPBMN + JRST QGC69 ;if < minimum, dir. full + CAILE A,QAPBMX + MOVEI A,QAPBMX ;limit to at most QAPBMX bytes at a time +;Drops through + ;Drops in +; A = number of bytes of room to leave after each file open for writing +; B -> name block under consideration +; C -> old descriptors +; D = disk channel number under consideration. Also D = C+1 +; J counts new descriptor bytes generated +; Q -> new descriptors (in temporary core block) +; R -> base of directory + + SETZ J, + HRRZ R,QSNLCN(H) ;old dir + ADDI Q,UDDESC ;new dir + HLL Q,QBTBLI + MOVE B,UDNAMP(R) + ADD B,R + +; Loop over files + +QGC20: CAIL B,2000(R) + JRST QGC40 ;all files done + LDB C,[UNDSCP UNRNDM(B)] ;get old desc ptr + DPB J,[UNDSCP UNRNDM(B)] ;store new desc ptr + +; Loop over all disk channels, relocating the ones that point to this file + + MOVSI D,-NQCHN +QGC31: HRRZ T,QUDPR(D) + SKIPL QUSR(D) + CAIE T,(H) + AOBJN D,QGC31 ;not in use or not same directory + JUMPGE D,QGC39 ;jump if all disk channels done + LDB T,[1200,,B] + CAME T,QUDFPR(D) + JRST QGC32 ;not same file + MOVE T,J ;relocate descriptor pointer + SUB T,C + ADDM T,QDIRP(D) +QGC32: AOBJN D,QGC31 + +QGC39: IDIVI C,UFDBPW ;make desc pntr into byte pointer + HLL C,QBTBLI(D) + ADDI C,UDDESC(R) + MOVE T,UNRNDM(B) + TLNE T,UNLINK + JRST QGC22 +QGC21: ILDB T,C ;copy descriptor bytes of a file into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIG T,UDWPH + AOJA J,QGC21 +REPEAT NXLBYT,[ + ILDB T,C + IDPB T,Q +] ADDI J,NXLBYT+1 + JRST QGC21 + +QGC22: ILDB T,C ;copy descriptor bytes of a link into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIN T,': + AOJA J,[ILDB T,C + IDPB T,Q + AOJA J,QGC22 ] + AOJA J,QGC22 + +QGC23: MOVE T,UNRNDM(B) + TLNN T,UNWRIT + JRST QGC25 + ADD J,A ;file being written, increase desc area + MOVE T,A + IBP Q + SOJG T,.-1 + +QGC25: ADDI B,LUNBLK ;next file + AOJA J,QGC20 ;also account for final zero at end of descriptor + +; Paranoia: check that all disk channels to this directory look OK + +QGC40: MOVEM J,UDESCP(R) ;store free-desc pointer + LDB A,[1200,,Q] ;last word used by descriptors + CAML A,UDNAMP(R) + BUG ;overlap + ANDI Q,-2000 ;base of temp core block again + MOVSI A,-NQCHN +QGC41: HRRZ T,QUDPR(A) + SKIPL QUSR(A) + CAIE T,(H) + AOBJN A,QGC41 ;channel not in use, or to some other dir + JUMPGE A,QGC49 ;all channels done + SKIPN B,QUDFPR(A) ;get file open on this channel + JRST QGC42 ;channel not set up to any particular file + CAIGE B,2000 + CAMGE B,UDNAMP(R) + BUG ;file pointer screwed + ADD B,R + SKIPL J,QDIRP(A) ;get descriptor pointer + CAMLE J,UDESCP(R) + BUG ;descriptor pointer screwed + LDB C,[UNDSCP UNRNDM(B)] + CAIGE B,2000-LUNBLK(R) ;skip if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get desc pntr for next file + CAIL B,2000-LUNBLK(R) + MOVEI D,2000*UFDBPW ;but if last file, get infinity + CAML J,C ;verify that QDIRP points to this file + CAML J,D + BUG +QGC42: AOBJN A,QGC41 ;do next channel + +; If you thought that was paranoid, get a load of this: + +QGC49: MOVE B,UDNAMP(R) + ADD B,R +QGC50: CAIL B,2000(R) + JRST QGC60 + LDB C,[UNDSCP UNRNDM(B)] + SOS C + IDIVI C,UFDBPW ;NOTE if UNDSCP = 0 we depend on bytes + HLL C,QBTBL(D) ; off left end of word LDB'ing as zero + ADDI C,UDDESC(Q) + LDB T,C + SKIPE T + BUG ;descriptor not preceeded by zero + MOVE J,UNRNDM(B) + TRZ J,#.BM UNDSCP ;LH(J) flags, RH(J) just desc pntr + TLNE J,UNLINK + JRST QGC52 +QGC51: ILDB T,C + JUMPE T,QGC53 + CAIG T,UDWPH + AOJA J,QGC51 +REPEAT NXLBYT, IBP C + ADDI J,NXLBYT+1 + JRST QGC51 + +QGC52: ILDB T,C + JUMPE T,QGC53 + CAIE T,': + AOJA J,QGC52 + IBP C + ADDI J,2 + JRST QGC52 + +QGC53: TLNE J,UNWRIT ;RH(J) has desc pntr to the zero that ends the file + ADDI J,QAPBMN ;if being written, needs room for one more track + CAIL B,2000-LUNBLK(R) ;now set D to point to next descriptor area + SKIPA D,UDESCP(R) ;do this instr if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get next file's desc pntr + CAIG D,(J) + BUG ;descriptors overlap + ADDI B,LUNBLK + JRST QGC50 + +; Copy the descriptors back into the directory + +QGC60: MOVSI C,UDDESC(Q) ;make BLT pointer to copy it back + HRRI C,UDDESC(R) + MOVE B,UDNAMP(R) ;use same BLT to zero out the free area + ADD B,R + BLT C,-1(B) + +; Take win return. + + AOS -9(P) +QGC69: LDB A,[121000,,Q] ;core block number of temporary page + PUSHJ P,TMEMR ;return it + MUINP ;verifying that it is the right one. + IRPC X,,RTJIQDCBA + POP P,X + TERMIN + POPJ P, + +SUBTTL INTERPRET DESCRIPTORS + +QFNTR: MOVE H,QUDPR(A) ;BYTE # IN Q CHNL # IN A + PUSHJ P,QUDLK ;DONT SKIP IF OFF FILE + MOVE T,QSNLCN(H) ;RETN BLOCK IN QSLGL(A) AND QSBI(A) DIR PNTR IN QDIRP(A) + ADD T,QUDFPR(A) ;FIRST ADR OF BLOCK IN QFBLNO(A) + LDB TT,[UNDSCP+UNRNDM(T)] ;CHAR ADR OF FILE BEG + MOVEM TT,QDIRP(A) ;SKIPS IF FINDS BLOCK AND LEAVES USER DIR LOCKED + CLEARM QSBI(A) + CLEARM QFBLNO(A) + CLEARB J,QSLGL(A) ;J HAS ORG OF FIRST NON-EX-BLOCK IF OFF END OF FILE +QFNT1A: PUSHJ P,QFNT1 + JRST QUDULK ;OFF END OF FILE RETN NOT SKIPPING + CAMLE J,Q + JRST QFNT7 ;LOCATED BLOCK CONTAINING WORD + MOVEM J,QFBLNO(A) + JRST QFNT1A + +QFNTN: MOVE H,QUDPR(A) ;LIKE ABOVE BUT SCAN FORWARD ONLY FROM CURRENT SPOT + PUSHJ P,QUDLK + PUSHJ P,QFNT1 + CAIA ;EOF, DON'T SKIP RETURN + AOS (P) + MOVEM J,QFBLNO(A) + JRST QUDULK + +QFNT1: SKIPE QSBI(A) ;DECODE NEXT BLOCK, CHNL IN A, SKIP UNLESS EOF. + JRST QFNT2 ;BLOCK # IN QSLGL FILE ADR IN J (TAKE N PENDING) +QFNT3: PUSHJ P,QMPDCH ;GOBBLE NEXT CHR OF DESC IN R (POINTED TO BY QDIRP) INCR QDIRP + CAIN R,UDWPH ;ALSO RET BYTE PNTR IN TT + JRST QFNT3 ;NULL + JUMPN R,QFNT8 ;NOT OFF END OF FILE + SOS QDIRP(A) + POPJ P, + +QFNT8: TRNE R,40 + JRST QFNT4 + CAILE R,UDTKMX + JRST QFNT6 ;SKIP AND TAKE + MOVEM R,QSBI(A) +QFNT2: SOS QSBI(A) + AOS QSLGL(A) +QFNT5: MOVEI J,2000 ;ACTIVE BYTES IN BLOCK + IMULI J,@QSBYTE(A) + ADD J,QFBLNO(A) + JRST POPJ1 + +QFNT7: MOVSI T,%QALBK ;SET UP PROC LAST BLOCK FLG AND RETN + ANDCAM T,QSRAC(A) ;CLEAR LAST BLOCK OF FILE BIT + SKIPE QSBI(A) + JRST QFNT7A ;NOT LAST BLOCK + ILDB R,TT ;GET NEXT CHR IN DIR + JUMPN R,QFNT7A + IORM T,QSRAC(A) ;PROCESSING LAST BLOCK +QFNT7A: AOS QSBI(A) ;FAKE OUT PI ROUTINE WHICH WILL TRY TO INCREMENT + SOS QSLGL(A) + JRST POPJ1 + +QFNT4: MOVEI J,0 ;LOAD ADR + DPB R,[140400,,J] + PUSHJ P,QMPDCH + DPB R,[060600,,J] + PUSHJ P,QMPDCH + DPB R,[0600,,J] + MOVEM J,QSLGL(A) + JRST QFNT5 + +QFNT6: MOVEI J,1-UDTKMX(R) + ADDM J,QSLGL(A) + JRST QFNT5 + EBLK + +SUBTTL DISK CHANNEL DATA AREAS + +QBFP: BLOCK NQCHN ;BUFFER LIST LH LAST RH FIRST + ;READ: PI IN MP OUT. WRITE: MP IN PI OUT. +SINLST: BLOCK NQS ;SWAP-IN LISTS FOR EACH DISK +SOUTLS: BLOCK NQS ;SWAP-OUT LISTS FOR EACH DISK + +;READ/WRITE LISTS LINK THROUGH MLO IN MEMBLT. +;LH(MEMPNT) HAS DISK ADDR, RH(MEMPNT) HAS # BYTES IN BLOCK IF FILE READ +;MWC IN MEMBLT HAS WORD COUNT IF WRITE (FOR EXTRA-WORDS) + +QFCHN: NQCHN ;NUMBER OF FREE QSK CHNLS (NOT COUNTING DIR WRITE AND SWAP CHANNELS) + +QUSR: REPEAT NQCHN,-1 ;USER +DWUSR: -1 ;0 IF DIR WRITE ACTIVE +SWUSR: REPEAT NQS,-1 ;0 IF SWAP XFER ACTIVE +QDIRP: BLOCK NQCHN ;CHAR ADR PNTR TO DESC AREA FOR FILE +QSLBLK: BLOCK NQCHN+NQS+1 ;LAST BLOCK NUMBER OF FILE WRITTEN +QSLGL: BLOCK NQCHN ;LAST QSGL +QSGL: REPEAT NQCHN+NQS+1,-1 ;-1 IDLE + ACTIVE TRACK + ;LAST NQS+1 FOR FD WRITE AND SWAPPING +QSBI: BLOCK NQCHN ; COUNT CONSECUTIVE BLOCKS +QSBFS: BLOCK NQCHN ;NUMBER OF BUFFS THIS CHNL +1 IF EOF AT PI WITH QSBFS=0 +QPCLSR: BLOCK NQCHN ;PCLSR STATUS OF MAIN PROGRAM - LOAD SYSTEM CALL +QSMDN: BLOCK NQCHN ;MAIN PRGM ACTIVE BUFFER NUM +OLDRDT: BLOCK NQCHN ;STORAGE FOR PREVIOUS REFERENCE DATE +QSRAC: BLOCK NQCHN+1 + REPEAT NQS, %QMSWP ;SWAPPING CHANNELS START OUT IN SWAP MODE + %QA==525252(1) + %QALOK==400000 ;4.9 CHNL LOCKED (NOT USED) + %QAEFR==200000 ;4.8 EOF REACHED READ + %QAEFW==100000 ;4.7 EOF WRITE + %QACTH==40000 ;4.6 DONT RELOAD. CORE JOB HUNG ON ACTIVE BUFFER + %QAFUL==20000 ;4.5 GC DIR BEFORE COMMITTING ANOTHER BLOCK TO FILE + %QADEL==10000 ;4.4 DELETE WHEN CLOSED + %QAACC==4000 ;4.3 FILE ADDRESS ALTERED BY .ACCESS OR OTHERWISE + %QAPAR==2000 ;4.2 NON RECOV PARITY ERR (OR OTHER DISK ERR) AT PI + %QAOUT==1000 ;4.1 ASSOC USER OUT DONT RELOAD (NOT IMPLEM.) + %QALBK==400 ;3.9 READ CHNL PROCESSING LAST BLOCK FLAG + %QAMPU==200 ;3.8 UPDATE QSMPRP, QSMPRC ON NEXT BUFFER GOBBLE + %QAWOV==100 ;3.7 FILLING OUT LAST BLK OF FILE IN WRITE OVER MODE PAST ORIG EOF + %QALNK==40 ;3.6 FILE IS REALLY A LINK + %QALOP==20 ;3.5 LINKS WERE TRACED IN OPENING THIS FILE. + %QARWT==10 ;3.4 MAKE WOULD-BE READERS WAIT (RATHER THAN GETTING FILE LOCKED ERROR) + %QAFNY==4 ;3.3 "FUNNY BLOCK", WORD COUNT IN LAST WORD + $QAMOD==220200 ;3.2-3.1 READ/WRITE MODE 0 NORMAL 1 WRITE OVER 2 COPY OVER WRITE + %QAMWO==1 ;3.1=1 => WRITE-OVER MODE. + %QM==777777 ;RH CHANNEL MODE. INDEX INTO ACTION TABLES USED AT PI LEVEL. +.SEE %QMIDL ;FOR TABLE OF CHANNEL MODES + +QDSKN: BLOCK NQCHN ;DISK UNIT NUMBER +DWSKN: 0 ;DISK WRITING DIR ON +SWSKN: REPEAT NQS,.RPCNT ;DISK SWAP XFER +QSCRW: BLOCK NQCHN ;0 READ -1 WRITE + -1 ;D.W. + BLOCK NQS ;SWAP +QSCABN: BLOCK NQCHN ;ACTIVE BUFFER NUMBER PI LEVEL OR -1 IF NONE +DWABN: -1 ;DISK D.W. A.B.N +SWABN: REPEAT NQS,-1 ;SWAP ABN +QUDPR: BLOCK NQCHN ;NUMBER OF ASSOCIATED USER DIR PNTR +QUDFPR: BLOCK NQCHN ;RELATIVE PNTR TO FILE AREA, ZERO IF NO PARTICULAR FILE +QMPTN: BLOCK NQCHN ;HAS LAST TRACK STORED IN DIRECTORY +QMPTC: BLOCK NQCHN ;MAIN PRGM TRACK COUNT +QMTTR: BLOCK NQCHN ;TRACK RESERVED OR -1 +QMFTP: BLOCK NQCHN+1 ;TRACK NUMBER FOR SCAN FOR FREE TRACKS IN TUT ON WRITE + REPEAT NQS,NUDSL; DITTO FOR SWAP CHANNELS +QERRS: BLOCK NQCHN+NQS+1 ;NUMBER ERRORS TRYING LAST OP +QSMPRP: BLOCK NQCHN ;MAIN PRGM BYTE POINTER +QSMPRC: BLOCK NQCHN ;M.P. COUNT (BYTES LEFT IN BUFFER) +QSBYTE: BLOCK NQCHN ;LH BYTE PNTR (P=44), RH BYTES PER WORD +QSBSIZ==300600,,QSBYTE ;BYTE POINTER TO CHANNEL BYTE SIZE +QFBLNO: BLOCK NQCHN ;BYTE # IN FILE OF BEG OF BLOCK BEING PROCESSED AT M.P. LEVEL +QRADAD: BLOCK NQCHN ;DESIRED BYTE ADR (LOOKED AT IF %QAACC OR %QAMPU IN QSRAC SET) +QPIBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN BLOCK ACTIVE AT P.I. LEVEL (READ) + ;BIT 4.9 => GET FROM LAST WORD IN BLOCK (%QAFNY) +QMPBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN MN PROG ACTIVE BUFFER +QLDPTR: BLOCK NQCHN .SEE NLDSBQ ;DURING SBLK LOADING, HOLDS THE AOBJN POINTER + ;INTO USER CORE FOR DOING A DISK TRANSFER ON. +QSMMP: BLOCK NQS ;MMP ADDRESS OF BLOCK ACTIVE ON SWAPPING CHANNEL + +;VARIABLES FOR CURRENT TRANSFER + +QSDU: -1 ;UNIT TRANSFERING DATA, -1 IF NONE. +QSDCH: -1 ;CHNL READY TO BE TRANSFERED ON QSDU +QERS1: -1 ;ERR VERIFY SWITCH -1 NO ERR 0 EXPECTING COMPLETION OF VERIFY OP +QDWIP: 0 ;NUMBER OF DIR WRITE IN PROGRESS 4.9=1=>MASTER + +IFN T300P,[ +QSDU1: -1 ;QSDU FOR OTHER CONTROLLER +QSDCH1: -1 ;ASSOCIATED CHANNEL +QTUNT1: -1 ;UNIT TO TRANSFER NEXT +QTCHN1: -1 ;CHANNEL TO TRANSFER NEXT +NRXFR1: 0 ;METERS +NWXFR1: 0 +NSRXF1: 0 +NSWXF1: 0 +LQTM1: 0 ;TIME LAST TRANSFER STARTED +];T300P + +;MASTER FILE DIRECTORY + +QMDRO: -1 ;ORIGIN OF MASTER DIR 4.9 IF LOCKED + ;-2 ON WAY IN + ;4.6 NOT IN + ;4.5, 4.4, 4.3, ... CHANGED + NOT WRITTEN UNIT 0, 1, 2, ... + ;3.2=1 NOT RECONCILED (NQFUS NOT SET UP) + ;3.1-3.5 MUST BE ZERO (AT LEAST AFTER ITS RECONCILED) +QAMDNO: -1 ;ASCENDING MASTER DIRECTORY NUMBER, -1 NOT SET UP +NQFUS: 0 ;NUMBER OF FREE LOSER SLOTS IN MFD + +;TRACK UTILIZATION TABLES + +QTUTO: REPEAT NQS,-1 ;ADDRESS OF TUT. LH SIMILAR TO QMDRO + ;4.9 LOCK + ;4.8 READ-IN NOT STARTED YET + ;4.6 NOT READ IN YET + ;CHANGED AND NOT WRITTEN ON UNIT + ;0 = 4.5 1 = 4.4 2 = 4.3 3 = 4.2 4 = 4.1 + ;5 = 3.9 6 = 3.8 + ;3.1-3.5 MUST BE ZERO +QDPWF: BLOCK NQS ;-1 TUT NOT RECONCILED (CALL QTCH1) +QTWRTM: BLOCK NQS ;TIME TUT LAST WRITTEN +QSFT: REPEAT NQS,-1 ;NUMBER TRACKS FREE IN USER AREA +QSFTS: BLOCK NQS ;NUMBER TRACKS FREE IN SWAPPING AREA +QPKNM: BLOCK NQS ;NAME OF PACK +QPKID: REPEAT NQS,-1 ;PACK ID OF DISK ON DRIVE +IFN QRSRVP,[ +QRESRV: REPEAT NQS,-1 ;NON-ZERO => PACK ON THIS DRIVE RESERVED. SET FROM TUT. + ;NOT 0 AND NOT -1 => SIXBIT DEVICE NAME FOR "SECONDARY" PACK +];QRSRVP +NTBL: ;NUMBER OF BLOCKS IN TUT ON THIS DRIVE +IFE T300P, REPEAT NQS, NTUTBL +IFN T300P,[ + REPEAT T300P, NTUTBL + REPEAT NQS-T300P, NTUTB1 +];T300P + +;POSITIONER VARIABLES (INDEXED BY PHYSICAL DRIVE) + +QSKT1: REPEAT NQS,-1 ;CHANNEL POSITIONER SET FOR OR -1 IF NONE +QRCAL: REPEAT NQS,0 ;-1 IF RECALIBRATING +QSPPS: REPEAT NQS,-1 ;INTENDED POSITIONER POSITION (NOT USED???) +QSEEK: BLOCK NQS ;-1 IF SEEKING +QPOS: REPEAT NQS,-1 ;CURRENT CYLINDER +QPOSGL: BLOCK NQS ;CYLINDER TRYING TO POSITION TO +IFN DC10P,[ +QRCTIM: BLOCK NQS ;RECALIBRATE TIMEOUT IN HALF SECONDS. THE ATTNS +];DC10P ; TEND TO GET LOST FOR SOME REASON + +;MISCELLANEOUS DISK VARIABLES + +QACT: REPEAT NQS,0 ;ONLY USE UNITS WITH 0 +QACTB: 0 ;4.5 UNIT 0 ACT 4.4 1 ACT 4.3 2 4.2 3 4.1 4 + ;3.9 5 3.8 6 +QWBUFS: 0 ;TOTAL NUMBER OF WRITE BUFFERS ACTIVE + +QWBFMX: 10.*DC10P+15.*RP10P+30.*RH10P+20.*RH11P ;MAX # ALLOWED. SHOULD BE + ; ABOUT 1 SEC DISK XFER. +QHUNGF: 0 ;-1 => DISK CONTROL HUNG, PI LEVEL SHOULD RESET, RECALIBRATE, RETRY +NTQHNG: BLOCK NQS ;NUMBER OF TIMES TRANSFER HUNG ON THIS UNIT + +QTUNT: 0 ;UNIT TO TRANSFER ON NEXT +QTCHN: 0 ;CHNL .. +QLCHN: 0 .SEE QINT2C +QWRU: -1 ;DEFAULT WRITE UNIT (-1 if there isn't a default unit yet) +MDSK: 0 ;DRIVE # OF MASTER DISK +QACTTM: -1 ;SETOM ON READ OR WRITE DATA TRANSFER + ;AOS AT SSLCK IF + OK TO WRITE DIRS + ;IE DON'T TIE UP DISK TO WRITE DIR UNLESS THINGS ARE QUIET +QDWFAR: -10. .SEE QINT3 ;WRITE DIRS SOME OF THE TIME ANYWAY +LQTM: 0 ;TIME AT WHICH LAST COMMAND GIVEN TO DISK +QFTTHR: 600. ;IF FREE TRKS ON QWRU GOES BELOW THIS, SWITCH TO UNIT WITH MOST FREE TRACKS +QRDAHD: IFE MCOND DM,[0] .ELSE 2 ;NUMBER OF BLOCKS TO READ AHEAD + +LASTGC: 0 ;NAME OF LAST DIRECTORY TO GET GC'ED + +;USER DIRECTORIES + +QNUD==40. ;NUMBER USER DIRECTORIES + +QFUD: QNUD ;NUMBER OF FREE UFD SLOTS + +QSNUD: BLOCK QNUD ;USER NAME OR 0 IF FREE +QSNLCN: BLOCK QNUD ;4.9 LOCKED, 4.8 ALSO NOT IN CORE RH CORE ADR + .SEE DCHBT ;4.6 =1 NOT PAWED OVER 4.5 CHNGD AND NOT WRITTEN ON UNIT 0 + ;4.4 UNIT 1 4.3 UNIT 2 4.2 UNIT 3 4.1 UNIT 4 + ;3.9 UNIT 5 3.8 UNIT 6 3.7 UNIT 7 + %QUDWM==40 ;3.6 WRITE IMMEDIATELY ON MASTER DISK + ;@ + XR BITS MUST = 0 + +QSNNR: BLOCK QNUD ;NUMBER PC'S LOOKING AT THIS IE + ;+1 FOR FILE OPEN AND USER IN CORE(?) +QSNMI: BLOCK QNUD ;TRACK N OF USER DIR IF NOT NEWLY CREATED +QSFBT: BLOCK QNUD ;FREED-BLOCKS-TABLE. HEAD OF A LIST OF PAGES, + ;THREADED THROUGH THE SECOND WORD AND ENDING WITH + ;ZERO. FIRST WORD IS AOBJN POINTER TO FREE PART + ;OF PAGE. FROM THIRD WORD UP TO BELOW WHERE AOBJN + ;POINTS ARE WORDS UNIT,,BLOCK WHICH RECORD DISK + ;BLOCKS TO BE FREED ONCE THE DIR HAS BEEN WRITTEN + ;OUT TO THE MASTER DISK. ELIMINATES REUSED ADDRESS + ;PROBLEMS BY GUARANTEEING THAT IF THE SYSTEM SHOULD + ;CRASH AT ANY TIME, THERE CANNOT BE TWO DIRECTORIES + ;ON DISK THAT BOTH POINT TO THE SAME BLOCK. + +IFN QRSRVP,[ +QSALLO: BLOCK QNUD ;-1 OR DRIVE # DIRECTORY ALLOCATED TO +] + +;LOCKS + +UDRSW: -1 ;USER DIR AREA LOCKED + 0 +QCHSW: -1 ;CHNL AREA LOCKED + 0 +QSKOSW: -1 ;QSKO1 LOCKED (USER DIR READIN) + 0 + +;LIST OF PAGES CONTAINING BLOCKS WHICH CAN NOW BE FREED. MOVED TO +;HERE FROM QSFBT WHEN THE DIR IS WRITTEN OUT. THE ACTUAL FREEING +;IS DONE BY THE CORE JOB. + +QFBTS: 0 + +;VARIABLES FOR SYSTEMS CONCEPTS DISK CONTROL + +IFN DC10P,[ +QRCSW: 105 ;- NO READ COMPARE 0 COMPARE WRITES + COMPARE ALL +QCST: 0 ;CONI DC0, AT QINT +QERST: 0 ;HAS CONI DC1, BITS WHEN AN ERROR HAPPENS +PKIDM: 0 ;-1 WAITING FOR PACK ID TO BE READ +RPKID: -1 ;PACK ID READ INTO HERE BY DISK CONTROL +QDRSTS: 0 ;DRIVE STATUS WORD STORED BY DISK CONTROL +] +IFE DMDSK,[ + 0 ;FOR BLT INTO QXWDS +QXWDS: BLOCK NXWDS +] +IFN DC10P,[ +QCHPRG: 0 +QCHPR2: DCOPY (-2000_2&37774) + DCOPY (-NXWDS_2&37774)QXWDS +QCHPR4: DHLT ;OR DRC +QCHPR3: DCCOMP (-2000_2&37774) + DCCOMP (-NXWDS_2&37774)QXWDS + DHLT + +GPKID: DSPC+DSCRHD+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +QRECAL: DSPC+DSRCAL+DUNENB +] + +;VARIABLES FOR DEC RP10 DISK CONTROL + +IFN RP10P,[ +QERST: 0 ;CONI DPC, ON ERROR +QERDTI: 0 ;DATAI DPC, ON ERROR +QCST: 0 ;CONI DPC, AT QINT +QCHPRG: 0 ;SEEK COMM +IFN KA10P, QIOWD: -2000,, ;XFER DATA (HRRM ADR-1 IN RH) +IFE DMDSK,[ + -NXWDS,,QXWDS-1 + -200+NXWDS,,0 +];DMDSK + 0 + +QRECAL: 700000,, +QGTBZY: 0 ;FLAG FOR SOFTWARE AT INT +];RP10P +IFN QRDCMP,[ +QRCSW: 0 ;NON-ZERO TO ENABLE READ-COMPARING +RDCPHS: 0 ;0 NORMAL, -1 DOING OPERATION WHICH SHOULD BE READ-COMPARED + ; AFTERWARD, + DOING READ-COMPARE +IFN KA10P,[ +RCIOWD: BLOCK 2 ;CHANNEL PROGRAM FOR READ INTO QRCBUF +];KA10P ;ON KL WE HAVE TO PUT IT IN THE EPT! +QRCBUF: BLOCK 2000 +];QRDCMP + +;VARIABLES FOR DEC RH10 DISK CONTROL + +IFN RH10P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +NCSHI: 0 ;NUMBER OF CACHE INVALIDATES +NCSHIL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE INVALIDATES +NCSHU: 0 ;NUMBER OF CACHE UNLOADS +NCSHUL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE UNLOADS +QERST: 0 ;CONI AT LAST ERROR (LEAVE THIS THROUGH QECPAT IN SAME ORDER) + 0 ;DATAI AT LAST ERROR +QERSTS: 0 ;%HRSTS AT LAST ERROR +QERER1: 0 ;%HRER1 AT LAST ERROR +QERER2: 0 ;%HRER2 AT LAST ERROR +QERER3: 0 ;%HRER3 AT LAST ERROR (IBM WOULD CALL THIS A CHANNEL LOGOUT AREA) +QERDCL: 0 ;%HRDCL AT LAST ERROR +QECPOS: 0 ;%HRPOS AT LAST ERROR +QECPAT: 0 ;%HRPAT AT LAST ERROR +QCST: 0 ;CONI AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR +RHDATO: -1 ;LAST DATAO DSK, FOR DEBUGGING +ECCPAG: BLOCK 8 ;TEMP FOR SAVING PAGE MAP VARS AT QECC (WITH SPM) +NQDRE: BLOCK NQS ;# MASSBUS TIMEOUTS PER DRIVE. +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +] + +;VARIABLES FOR DEC RH11 DISK CONTROL (ON THE KS10 UNIBUS) + +IFN RH11P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +QIOWD: 0 ; BA,,WC for RH11 +QCST: 0 ;CS1 AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT + +QERST:: ;Gubbish saved at last error +QERCS1: 0 ; CS1 Control & Status 1 +QERCS2: 0 ; CS2 Control & Status 2 +QERSTS: 0 ; STS Drive status +QERBA: 0 ; BA Unibus address for transfer +QERWC: 0 ; WC Word count for transfer +QERER1: 0 ; ER1 Error 1 +QERER2: 0 ; ER2 Error 2 +QERER3: 0 ; ER3 Error 3 +QERPOS:: +QECPOS: 0 ; POS ECC position +QERPAT:: +QECPAT: 0 ; PAT ECC pattern +QERMAP: 0 ? 0 ; Unibus map to disk buffer + +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR + +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +NQOFFL: BLOCK NQS ;# TIMES DISK WENT OFFLINE +] + +DIRHNG: 0 ;LH POINTS TO LIST OF DIRHNG DEVICE CHANNELS, + ;CHAINED THROUGH LH'S OF IOCHNM WORDS. + ;0 MEANS END OF LIST + ;MODIFY ONLY WITH THE CLOCK OFF. + ;EACH DIRHNG DEVICE CHANNEL'S IOCHST WORD RH CONTAINS THE + ;TRACK NUMBER OF THE DIRECTORY IT IS LOOKING AT. + +BBLK + +;DISK CONSTANTS + +IFN RP10P,[ +QATTNS: REPEAT NQS,500000+.RPCNT_14,,1_<10-.RPCNT> +;WORDS TO CLEAR ATTNS AND SELECT DRIVES +] + +SWAPL: SINLST(Q) + SOUTLS(Q) + +DCHBT: 20000,, ;BIT SET IF DIR NOT WRITTEN OUT ON UNIT + 10000,, + 4000,, + 2000,, + 1000,, + 400,, + 200,, + 100,, +IFL .-DCHBT-NQS,.ERR YOU BETTER FIND ANOTHER BIT FOR QACTB,QSNLCN,QTUTO + +IFN DC10P,[ +QTRAN: 0 ;FORMERLY MAPPED 203 CYL VIRTUAL DRIVES TO 406 CYL CALCOMPS + 1 ;4.9 => 2ND HALF OF PHYSICAL DRIVE + 2 ;(DOESN'T DO ANYTHING NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NQS, .ERR BARF AT QTRAN +] + +SUBTTL DISK CLOSE ROUTINES + +QICL: PUSH P,R + SKIPGE QUSR(A) + BUG + MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) ;FLUSH RANDOM ACCESS HACKERY + PUSHJ P,QICLW1 ;WAIT FOR INPUT TO STOP + MOVE TT,QSRAC(D) + TLNE TT,%QADEL ;DELETE? + JRST QSICLD ;YES + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) + AOS QFCHN +QICLX: SOSGE QSNNR(H) ;FREE DIRECTORY CHANNEL HAD BEEN USING + BUG + POP P,R + SETZM (R) + POPJ P, + +QICLW1: MOVE D,A ;IDLE CHANNEL AND FLUSH READ BUFFERS + CONO PI,UTCOFF + SKIPGE QSGL(D) + JRST QSICL3 + SKIPL QSCABN(D) + JRST QSICL4 + SETOM QSGL(D) + +QSICL3: HLLZS QSRAC(D) .SEE %QMIDL ;STOP PI + CONO PI,UTCON +QSICL5: PUSHJ P,QSBRB1 ;RETURN M.P. BUFFER IF ANY +QOCL7: HRRZ A,QBFP(D) ;ALSO ENTER TO RETURN UNUSED READ BUFFER ON WRITE OVER MODE +QSICL2: JUMPE A,QSICL6 + LDB C,[MLO,,MEMBLT(A)] + PUSHJ P,MEMR + MOVE A,C + SOS QSBFS(D) + JRST QSICL2 + +QSICL6: SETZM QBFP(D) + POPJ P, + +QSICL4: MOVEI A,%QMRD1 ;STOP PI AFTER THIS BLOCK + HRRM A,QSRAC(D) + CONO PI,UTCON + SKIPL QSGL(D) ;WAIT FOR CHANNEL TO DEACTIVATE + PUSHJ P,UFLS + JRST QSICL5 + +;OUTPUT CLOSE +QOCL: PUSHJ P,QSOCL5 ;CLEAN UP THE DISK CHANNEL +QSOCL4: MOVE D,A ;ENTRY FROM QALINK +QSOCL6: MOVE Q,QUDFPR(D) + MOVE H,QUDPR(D) + ADD Q,QSNLCN(H) + MOVE TT,QSRAC(D) + TLNE TT,%QADEL + JRST QCDLWO ;DELETED (PRESUMABLY VIA DELEWO) + MOVE A,UNFN1(Q) ;Get names of file being hacked. + MOVE B,UNFN2(Q) + PUSHJ P,QLOOK ;FILING OVER ANYTHING? + JRST QSOCL3 + HRRZ I,QSNLCN(H) + ADD I,QUDFPR(D) + CAMN I,Q ;BEING WRITTEN BITS WENT AWAY? + BUG ;TRYING TO DELETE THE FILE WE'RE WRITING + PUSHJ P,QSOCLD ;YES FLUSH IT + PUSHJ P,QUDLK ;RELOCK DIR UNLOCKED BY QSOCLD ETC + JRST QSOCL6 ;MAKE SURE ONE HASN'T REAPPEARED WHILE DIR UNLOCKED + +QSOCL5: LDB H,[$QAMOD,,QSRAC(A)] + JUMPN H,QOCL6 ;DONT HACK ACTIVE WD COUNT IN WRITEOVER MODE +QOCL6A: MOVN D,QSMPRC(A) ;- NUMBER OF BYTES IN BLOCK NOT USED + ADDB D,QMPBSZ(A) ;ADJUST BYTE COUNT OF LAST BLOCK TO REFLECT WHATS USED + CLEARM QSMPRC(A) ;SO WILL BE A NOOP IF PCLSR OUT AND COME BACK THRU HERE +QOCL4: MOVSI Q,%QAEFW + IORM Q,QSRAC(A) ;SET EOF BIT FOR QSBWW AND QUDS + JUMPN H,QOCL5 + SKIPL QSMDN(A) ;NO M.P. BUFFER ANYWAY + JUMPE D,QOCL1 ;ABOUT TO WRITE NULL BLOCK, DON'T +QOCL5: PUSHJ P,QSBWW +QOCL2: MOVE T,A + PUSHJ P,[ SKIPGE QSCRW(T) ;WAIT FOR CHANNEL EITHER LEAVING WRITE MODE + SKIPN QSBFS(T) ;OR WRITING OUT ALL ITS BUFFERS, I.E. PI LEVEL + JRST POPJ1 ;ISN'T GOING TO DO ANYTHING MORE TO IT. + POPJ P, ] + PUSHJ P,UFLS + SKIPE QBFP(A) ;MAKE SURE IF QSBFS NON-ZERO THAT IS ONLY EOF + BUG ;NOT A BUFFER SITTING AROUND FORGOTTEN +QOCL3: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SKIPN D,QMPTC(A) ;SKIP ON NEXT "N" STILL PENDING + POPJ P, + PUSHJ P,QUDS ;STORE IT AWAY + CLEARM QMPTC(A) + POPJ P, + +QOCL6: SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO IDLE OR HANG UP IN READ + PUSHJ P,UFLS + SKIPL QSGL(A) + PUSHJ P,UFLS + MOVE D,A + PUSHJ P,QOCL7 + MOVE A,D + MOVE Q,QSRAC(A) + MOVE B,QSBFS(A) + JUMPE B,QOCL6B + TLNE Q,%QAEFW + JRST QOCL6B + TLNE Q,%QAEFR + SOS B,QSBFS(A) ;COMPENSATE FOR EXTRA AOS ON EOF READ +QOCL6B: CAILE B,1 + BUG + TLNE Q,%QAWOV + JRST QOCL6A ;HACKING LAST BLOCK PAST EOF, UPDATE ACTIVE WD COUNT + JRST QOCL4 + +QOCL1: PUSHJ P,QSBRB ;DISCARD BUFFER + SOS QSBFS(A) + SOS QWBUFS + MOVE D,QDSKN(A) + AOS QSFT(D) ;RESTORE TRACK + JRST QOCL2 + +QSOCL3: MOVE Q,QUDFPR(D) + MOVE TT,QSNLCN(H) + ADDI Q,(TT) + MOVSI T,UNWRIT + ANDCAM T,UNRNDM(Q) ;CLEAR WRITE IN PROG + MOVE TT,QSNLCN(H) + MOVE T,UDNAMP(TT) ;MAKE SURE IT GOES BEFORE * FILE OF SAME NAME + ADDI T,(TT) + CAMN T,Q + JRST QSOC3E ;NO PREV FILE + MOVE J,Q +QSOC3A: SUBI J,LUNBLK + CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QSOC3B ;PREV FILE HAS DIFFERENT NAME + CAILE J,(T) + JRST QSOC3A +QSOC3C: CAMN J,Q + JRST QSOC3E +REPEAT LUNBLK, PUSH P,.RPCNT(J) + MOVE T,J + HRL T,Q + BLT T,LUNBLK-1(J) +REPEAT LUNBLK, POP P,LUNBLK-.RPCNT-1(Q) + SUB Q,J + SUBI J,(TT) + MOVSI T,-NQCHN +QSOC3D: HRRZ A,QUDPR(T) + SKIPL QUSR(T) + CAIE A,(H) + JRST QSOC3F + HRRZ A,QUDFPR(T) + CAIN A,(J) + ADD A,Q + MOVEM A,QUDFPR(T) +QSOC3F: AOBJN T,QSOC3D +QSOC3E: SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + MOVE C,QSNUD(H) +IFN TPLP+UNSPLP,[ + MOVEI TT,SCRTPC + CAMN C,[SIXBIT /.LPTR./] + IORM TT,SUPCOR ;CLOSING FILE ON TPL DEVICE SO SET FLAG FOR SYS JOB +];TPLP + CAMN C,[SIXBIT/.MAIL./] + AOS NQMFWR ;CLOSING FILE ON .MAIL. => BUMP COUNT TO WAKE MAILER DEMON +IFN XGP,[ + CAMN C,[SIXBIT/.XGPR./] + AOS NXGPFW ;WAKE XGPSPL +];XGP + MOVE A,QSNMI(H) ;TELL DIRHNG DEVICE ABOUT IT + PUSHJ P,DIRSIG + MOVE TT,QACTB ;DIR CHANGED (AT LEAST WRITE-IN-PROG BIT TURNED OFF) + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + SOSGE QSNNR(H) + BUG + PUSHJ P,QSTRTR + SETZM (R) ;CLEAR IOCHNM WORD. + POPJ P, + +QSOC3B: ADDI J,LUNBLK + JRST QSOC3C + +QOCLR: MOVE Q,QSRAC(A) ;CLOSE UNIT ASCII OUTPUT + TLNN Q,%QAWOV + TLNN Q,%QAMWO+%QALNK + PUSHJ P,QOCLPD ;PUT NEEDED PADDING UNLESS NOT A FILE OR NOT AT END + JRST QOCL + +QOCLPD: LDB Q,[360600,,QSMPRP(A)] ;NUMBER OF BITS NOT WRITTEN IN LAST WORD + CAIL Q,44 + POPJ P, ;LAST WORD NOT WRITTEN AT ALL + LSH Q,18.+6 ;FILL THOSE BITS WITH ^CS + HRR Q,QSMPRP(A) + MOVE C,[EOFWRD] + SKIPLE QSMPRC(A) ;INHIBIT STORE IF NO BUFFER ETC. + DPB C,Q + POPJ P, + +SUBTTL DISK INTERRUPT ROUTINES + +OVHMTR QIN ;DISK INTERRUPT LOW-LEVEL + +IFN RP10P,[ + +QINT: AOS QGTBZY + MOVEM TT,QCST +IFN DMDSK,[ + TRNN TT,200000 ;END OF CYLINDER + JRST QINT0 + SKIPGE C,QSDCH + BUG + MOVE D,QSGL(C) + IDIVI D,NBLKSC ;IS IT LEGITIMATE? + SKIPL QSDU ;IF NO TRANSFER IN PROGRESS, IGNORE + CAIN E,NBLKSC-1 ;IS LEGITIMATE FOR LAST BLOCK IN CYLINDER + CAIA ;IGNORE + BUG PAUSE,[MAYBE DISK CONTROL IS WRITING ALL OVER THE DISK AGAIN] +QINT0: ];DMDSK + TDNE TT,[17177700] ;ANY ERRORS? + JRST QINTE +QINTN2: DATAI DPC,R + SKIPGE QSDU ;DONT CLOB CMD BUF TO CLR ATTS DURING DATA XFER + TRNN R,776 ;ANY ATTNS + JRST QINTA ;NO + LDB I,[11000,,R] ;YES,FIND WHICH DRIVE + JFFO I,.+1 ;CLOBBERS Q + SUBI Q,28. + +QINTAT: DATAO DPC,QATTNS(Q) ;CLEAR ATTNS + DATAI DPC,E + TLNN E,40 + JRST QRECAT ;NOT ON CYLINDER, RECALIBRATE + LDB A,[DCYLI E] + TRNE E,.BM DCYLXI + ADDI A,400 + CAME A,QPOSGL(Q) + JRST QRECAT ;SEEK TO THE WRONG PLACE (CALCOMPS LIKE TO DO THIS) + MOVEM A,QPOS(Q) ;REMEMBER WHERE IT IS AT + SETZM QSEEK(Q) + SETZM QRCAL(Q) + JRST QINT ;TRY AGAIN + +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION - FIND NEW TRANSFER + CONSO DPC,400000 + CONSO DPC,10 + JRST DSKEX ;TRANSFER STILL IN PROGRESS, DISMISS + CONSZ DPC,20 + JRST .-1 ;BUSY? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: DATAI DPC,R + CONI DPC,TT ;THIS LOOKS REDUNDANT BUT APPARENTLY IS NECESSARY + ;DUE TO TIMING OF THE DISK-NOT-READY CONDITION + CONO DPC,175700+DSKCHN ;RESET CONDITIONS + MOVEM TT,QERST + MOVEM R,QERDTI + CONSZ DPC,20 ;WAIT FOR UNBUSY + JRST .-1 + MOVE Q,QSDU ;FOR QOVR + MOVE E,QCHPRG + TRNE TT,20000 ;OVERRUN + JRST QOVR + TRNE TT,2000 ;NOT READY + JRST QNRDY + TDNE TT,[12010700] ;BITS 14,16,23,27-29 ARE LOSERS + BUG HALT,[DSK: TOTALLY FATAL ERROR, CONI=],OCT,QERST + TLNE TT,5 ;WD OR SECTOR PARITY ERROR + JRST QDE + TRNE TT,1000 ;WRITE LOCKED + JRST QIRWRE + TRNE TT,40000 ;SEARCH FAILED + JRST QHE + TRNN TT,100000 ;POWER FAILURE + JRST QINTE1 + CONSZ DPC,100000 ;TRY IT AGAIN + JRST 4,.-1 + JRST QHE + +QINTE1: TLNE R,10 ;FILE UNSAFE--NEED OPERATOR INTERVENTION + BUG PAUSE,[DSK: FILE UNSAFE UNIT ],DEC,Q + TLNE R,4 + BUG ;NO SUCH DRIVE + TLNE R,110 ;POSITION FAILURE (OR PROCEEDED FILE UNSAFE) + JRST QHE + AOS NQSE(Q) ;SPURIOUS ERROR + JRST QINTX ;IGNORE + +QIRWRE: BUG PAUSE,[DSK: WRITE LOCKED UNIT ],DEC,Q + JRST QHE + +QNRDY: LDB Q,[410300,,R] ;WHICH DPC + SKIPN QSEEK(Q) + SKIPGE QRCAL(Q) ;NOT SEEKING OR RECALIBRATING IS ERROR + JRST QINTN2 + BUG PAUSE,[DSK: UNIT ],DEC,Q,[NOT READY] + JRST QREC +] ;END IFN RP10P + +IFN DC10P,[ + +QINT: MOVEM TT,QCST + SKIPL PKIDM ;GETS SPURIOUS DIPE WHEN READING PACK ID + CONSO DC1,7777 ;RUMOR THAT DSSERR DOESN'T ALWAYS SET + TRNE TT,DSSERR + JRST QINTE + TRNE TT,DSSATT + JRST QINTAT +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION, FIND NEW TRANSFER + CONSZ DC0,DSSRUN+DSSACT + JRST DSKEX ;ACTIVE OR RUN, TRANSFER IN PROGRESS, DISMISS + AOSN PKIDM ;SKIP IF NOT FINISHED READING PACK ID + JRST QSPKID + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + SKIPL QERS1 + JRST QEROK ;OK ON VERIFY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: CONI DC1,TT + CONO DC0,DCCLR+DCERR+DSKCHN ;CLEAR ERRORS + MOVEM TT,QERST + MOVE Q,QSDU + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 ;ACTIVE OR RUN? + SKIPL QERS1 + JRST QERL1 ;VERIFY ALSO LOST + TRNE TT,DOFFL+DPROT+DDOBSY+DNXM+DCPERR + JRST QINTE1 ;REALLY LOST BIG + TRNE TT,DOVRRN + JRST QOVR + TRNE TT,DWTHER+DFUNSF ;SEEK INC, END DISK, WATCHDOG, OR UNSAFE + JRST QHE ;TRY TO RECALIBRATE + SKIPGE PKIDM + TRZ TT,DRLNER ;IGNORE LENGTH ERROR IF READING PACK # + TRNE TT,DIPE+DRLNER+DRCER+DCKSER + JRST QDE ;TRY AGAIN + SKIPGE PKIDM + TRNE TT,-1 + AOS NQSE ;SPURIOUS ERROR (NOT LENGTH ERROR IN PKIDM) + JRST QINTX ;SPURIOUS ERROR + +QINTE1: TRNE TT,DOFFL + BUG PAUSE,[DSK: UNIT ],DEC,Q,[OFFLINE] + TRNE TT,DPROT + BUG PAUSE,[DSK: UNIT ],DEC,Q,[WRITE PROTECTED] + TRNE TT,DDOBSY + BUG PAUSE,[DSK: DATAO WHEN BUSY] + TRNE TT,DNXM+DCPERR + BUG PAUSE,[DSK: MEM PAR OR NXM ERROR] + JRST QOVR + +QINTAT: CONI DC1,Q + CONO DC0,DCCLR+DCCATT+DSKCHN ;CLEAR ATTENTION + LDB Q,[DSATDN Q] ;ATTENTION DRIVE NUMBER + CAIGE Q,NQS + SKIPL QRCAL(Q) + JRST QINTX + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE + JRST QINTX + +;THIS IS CALLED EVERY HALF SECOND +QRCTMO: MOVEI Q,NQS-1 + SKIPL QRCAL(Q) +QRCTM1: SOJGE Q,.-1 + JUMPL Q,CPOPJ + SOSL QRCTIM(Q) + JRST QRCTM1 + BUG INFO,[DSK: RECAL TIMEOUT UNIT],DEC,Q + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE I GUESS + JRST QRCTM1 +];DC10P + +IFN RH11P,[ + +;;; RHCLRC(Q) Clear controller errors and select drive Q +;;; RHSLCT(Q) Select drive Q +;;; RHCMD(A) Command in A to current drive +;;; RHCLRD Clear current drive +;;; RHCHEK Check for immediate bad news +;;; All return CS1 in A + +RHSLCT: IOWRQ Q,%HRCS2 +RHCHEK: IORDQ A,%HRCS1 + TRNE A,%HXTRE+%HXMCP + BUG HALT,[DSK: MASSBUS ERROR, CS1=],OCT,A + POPJ P, + +RHCLRC: IOWRQ Q,%HRCS2 ; Must select drive before clearing controller + MOVEI A,%HXTRE+%HXIE+%HMNOP +RHCMD: TROA A,%HXIE +RHCLRD: MOVEI A,%HXIE+%HMCLR + IOWRQ A,%HRCS1 + JRST RHCHEK + +EBLK +DSKBRK: 0 +BBLK + JSR UTCSAV +QINT: AOS QGTBZY + MOVE Q,QSDU + IORDQ TT,%HRCS1 + MOVEM TT,QCST + TRNE TT,%HXTRE+%HXMCP + JRST QINTE + TRNN TT,%HXSC ; Perhaps some drive needs attention? + JRST QINT0 ; Not unless SC is set! + IORDQ A,%HRATN + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ; Not expecting completion of transfer. + TRNN TT,%HXRDY + JRST DSKEX ; Transfer still in progress. + AOSN QHUNGF + JRST QHE ; Transfer hung, recalibrate and retry. + PUSHJ P,RHSLCT ; Select that drive. + IORDQ A,%HRSTS ; Get its status. + TRNE A,%HSERR ; Just in case %HXTRE didn't get set (by + JRST QINTE ; analogy with RH10)... + JRST QINTA1 ; Transfer complete... + +QINTAT: MOVNI Q,-35.(B) + HRRZS Q + MOVEI A,1 + LSH A,(Q) + IOWRQ A,%HRATN ; Turn off attention bit. + CAIL Q,NQS + JRST QINT0 + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ; Ignore attention in mid-transfer. + JRST QINTA2 ] + SKIPE QACT(Q) + JRST QINTA2 ; Ignore this drive. + PUSHJ P,RHSLCT + IORDQ B,%HRSTS ; Get status of drive with attention. + TRC B,%HSMOL+%HSDPR+%HSRDY + TRNN B,%HSMOL+%HSDPR+%HSRDY+%HSVV + PUSHJ P,QOFFL ; Went offline and came back online + TRNE B,%HSERR+%HSPIP + JRST [ PUSHJ P,RHCLRD ; Drive barfing not during transfer + AOS NQEATN(Q) ; so clear it + JRST .+1] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION +IFE RM03P,[ ;No %HRCCY register on damn RM03s + IORDQ A,%HRCCY + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE +];RM03P +IFN RM03P,[ + MOVE A,QPOSGL(Q) ;On RM03, jump to conclusion + MOVEM A,QPOS(Q) +];RM03P + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON + ; THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +; Went offline and came back online +QOFFL: TRC B,%HSMOL+%HSDPR+%HSRDY ;Recover %HRSTS + IORDQ C,%HRER1 + IORDQ D,%HRER2 + IORDQ E,%HRER3 + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D,[ER3=],OCT,E + AOS NQOFFL(Q) + MOVEI A,%HMCLR ;Clear the drive + PUSHJ P,RHCMD + MOVEI A,%HMRDP ;I said, clear the drive! + PUSHJ P,RHCMD + MOVEI A,0 + IOWRQ A,%HROFS ;No offset, 18 bits, ECC on, HCI off + MOVEI A,%HMACK ;Turn %HSVV back on so drive will work + PUSHJ P,RHCMD + POPJ P, + +QINTE: +IRPS X,,[CS1 CS2 BA WC POS PAT] ; First get status of controller + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + IORDQ A,UBAPAG+QUBPG_1 ; Unibus map counts as part of + MOVEM A,QERMAP ; controller status. + IORDQ A,UBAPAG+QUBPG_1+1 + MOVEM A,QERMAP+1 + SKIPGE Q ; Try hard to guess the drive. + LDB Q,[$HYDSK QERCS2] + PUSHJ P,RHCLRC ; Clear controller errors and select drive + ; so that we can read its status too. + TRNN A,%HXRDY ; Why would controller be busy? (RH10 + BUG ; code checks for this...) +IRPS X,,[STS ER1 ER2 ER3] + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + MOVE A,QERCS1 ; A: CS1 + MOVE R,QERCS2 ; R: CS2 + SKIPN QERER2 ; Bad news + SKIPE QERER3 + JRST UNSAFE + TRNN A,%HXMCP ; Real bad news + TRNE R,%HYWCE+%HYPE+%HYNED+%HYNEM+%HYPGE+%HYMXF + BUG HALT,[DSK: UNIT #],DEC,Q,[LOSING. CS1=],OCT,A,[ CS2=],OCT,R + TRNE R,%HYDLT+%HYMDP ; Data bus losing? + JRST QINTE1 + MOVE A,QERSTS ; Check Drive Status + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ; Better be all on! + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ; Spurious? + JRST QINT0] + MOVE B,QERER1 ; Check the main error register + TRNE B,#<%H1ECC+%H1DTE+%H1CRC+%H1HCE+%H1ECH+%H1FER+%H1PAR> + JRST UNSAFE ; Those not listed above are considered "hard" + CAIN B,%H1ECC ; Correct correctable error if that is the + JRST QECC ; only problem. + PUSHJ P,QINTER ; Else print message and reset drive + TRNE B,%H1DTE+%H1CRC+%H1HCE+%H1FER ; These require recalibration + JRST QHE + TRNE B,%H1ECC+%H1ECH+%H1PAR ; These require reread + JRST QDE + JRST QOVR ; No error bits set? (How can this + ; happen?) Go and retry... + +;;; Controller error: +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CS1=],OCT,QERCS1,[CS2=],OCT,QERCS2 + JRST QOVR + +;;; Drive error: +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA + JRST RHCLRD ; Reset error status in drive + +;;; Come here for drive unsafe and similar bad things. May be set to +;;; either halt or attempt retry (via USFHLT variable). Note that when we +;;; get here the state of the drive has not yet been disturbed. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + SKIPL QSDU + JRST QHE ;RECALIBRATE AND RETRY + JRST QREC ;Just recalibrate, no transfer to retry + +QECC: PUSHJ P,RHCLRD ; Reset drive + CAME Q,QSDU ; ECC error better be for transfer in + BUG ; progress... + MOVE A,QCHPRG + TRNN A,10 .SEE %HMRED + BUG ; ECC error should only happen during read. + LDB A,[$UPPAG QERMAP] + IORI A,600000 + DPB A,[.PAREP+EXEUMP] ; Point parity error page at buffer. + CLRPT 400000+PAREP_12 ; Get it into our map now. + CLRPT 401000+PAREP_12 ; Both halves... + MOVE J,QERBA + SUBI J,1000+QUBPG_14 ; Correct to relative byte address of start + ; of losing sector. + TRNE J,770777 ; Should always be aligned on sector boundary + BUG ; and within a single block, right? + LSH J,-2 ; J: Address of first word of losing sector + ; within block. + MOVE A,QECPOS ; Get error position + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADDI J,400000+PAREP_12(A) ; J: Address of losing word-pair + ; (In parity error page.) + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + CLRPT 400000+PAREP_12 + CLRPT 401000+PAREP_12 ; Both halves... + + AOS QECCS(Q) ;LOG THE LOSS + LDB E,[111000,,QERBA] ; E: Number of sectors transferred (including + SUBI E,QUBPG_3 ; ECC sector) + MOVE A,QCHPGA + LDB B,[$HASEC A] ;Compute disk address of failing sector: + ADDI B,-1(E) + IDIVI B,NSECS ; C: sector + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D ; B: track + DPB B,[$HATRK A] + MOVEM A,QECCAD(Q) + HLRZ A,A ; A: cylinder + MOVE D,QSDCH ; D: chnl + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT #],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + CAIL E,SECBLK + JRST QINTA1 ;XFER COMPLETE + + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS + ; CYLINDERS + + HRL E,QERWC ; Reassemble "iowd" from + HRR E,QERBA ; saved parts. (Don't trust stuff saved + MOVEM E,QIOWD ; in controller more than we have to.) + HRRZ C,QSDCH ;FOR QECCX + JRST QECCX ;MORE TO DO, CONTINUE XFER + +] ;RH11P + +IFN RH10P,[ + +QINT: AOS QGTBZY + MOVE Q,QSDU + MOVEM TT,QCST + TRNE TT,%HIERR + JRST QINTE + TRNN TT,%HIATN + JRST QINT0 + MOVSI A,%HRATN ;FIND DRIVES NEEDING ATTENTION + PUSHJ P,RHGET + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING COMPLETION OF TRANSFER + TRNN TT,%HIDON + JRST DSKEX ;NO COMPLETED TRANSFER + CONSZ DSK,%HIBSY + JRST 4,.-1 ;TRANSFER STILL IN PROGRESS?? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + MOVSI A,%HRSTS(Q) ;SOMETIMES %HSERR SETS AND %HIERR DOESN'T! + PUSHJ P,RHGET + TRNE A,%HSERR + JRST QINTE + JRST QINTA1 ;XFER COMPLETE... + +QINTAT: MOVNI Q,-35.(B) ;LOW BIT IS DRIVE 0 + HRRZS Q + MOVEI A,1 ;TURN OFF ATTENTION (DRIVE MAY BE LOSING + LSH A,(Q) ;IN SUCH A WAY THAT READING %HRSTS DOESN'T CLEAR ATTN) + HRLI A,%HRATN + PUSHJ P,RHSET + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ;IGNORE ATTN IN MID-TRANSFER + JRST QINTA2 ] + MOVSI A,%HRSTS(Q) ;GET STATUS OF DRIVE WITH ATTENTION + PUSHJ P,RHGET ;THIS ALSO CLEARS THE ATTENTION BIT + SKIPE QACT(Q) + JRST QINTA2 ;IGNORE THIS DRIVE + TRNE A,%HSERR+%HSPIP + JRST [ MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;DRIVE REPORTING ERROR NOT DURING TRANSFER + PUSHJ P,RHSET ;SO CLEAR THE DRIVE + AOS NQEATN(Q) + JRST .+1 ] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION + MOVSI A,%HRCCY(Q) + PUSHJ P,RHGET + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +;INPUT FROM MASSBUS - ADDRESS IN LH(A), RETURNS DATA IN A + +RHGET: TLZA A,%HRLOD + +;OUTPUT TO MASSBUS - ADDRESS IN LH(A), DATA IN RH(A) + +RHSET: TLO A,%HRLOD + DATAO DSK,A + MOVEM A,RHDATO ;SAVE FOR REBUGGING + MOVEI A,5 ;WAIT 3 USEC FOR BUS CYCLE + SOJG A,. + DATAI DSK,A + TLNE A,%HDERR + BUG HALT,[DSK: MASSBUS ERROR, DATAO=],OCT,RHDATO,[DATAI=],OCT,A + ANDI A,177777 ;RETURN 16-BIT REGISTER CONTENTS + POPJ P, + +QINTE: CONI DSK,TT + DATAI DSK,R + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN ;RESET CONTROLLER SO DRIVE STATUS MAY BE READ + CONSZ DSK,%HIBSY + JRST .-1 ;SOMETIMES CONTROLLER IS BUSY?? + MOVEM TT,QERST + MOVEM R,QERST+1 + SKIPGE Q ;TRY HARD TO GUESS THE RIGHT DRIVE! + LDB Q,[$HCDRV R] ;CURRENTLY SELECTED DRIVE + IRPS X,,[%HRSTS %HRER1 %HRER2 %HRER3 %HRDCL %HRPOS %HRPAT] + MOVSI A,X(Q) ;GET STATUS OF DRIVE + PUSHJ P,RHGET + MOVEM A,QERST+.IRPCNT+2 + TERMIN + SKIPN QERER2 ;FILE UNSAFE + SKIPE QERER3 + JRST UNSAFE + TRZE TT,%HIDRE + AOS NQDRE(Q) ;THIS BIT SUSPECTED OF BEING SET RANDOMLY. + ;;CHECK FOR IRRECOV (?) HARDWARE LOSSAGE. EVEN MORE SO THAN 'UNSAFE' + TDNE TT,[%HIILF+%HISDE+%HINXM+%HIDRE+%HIILC+%HIPWR] + BUG HALT,[DSK: UNIT ],DEC,Q,[ LOSING. RH10 CONI= ],OCT,QERST +IFN KS10P, .ERR So whats this all about? +IFN KL10P,[ + TLNN TT,(%HIDPE+%HICPE) ;IF CHANNEL DETECTS PARITY ERROR, CAUSE + JRST QINTE0 ;PROCESSOR PARITY SWEEP WHICH WILL PROBABLY + MOVSI A,SCLPAR ;CRASH THE SYSTEM ANYWAY. BEATS LOOPING! + TDNN A,SUPCOR ;BUT DON'T CAUSE CLKB1E+7 HALT + CONO 10407 + BUG CHECK,[DSK: MEM PAR ERR, QICWA/],OCT,QICWA,OCT,QICWA+1,[QIOWD/],OCT,QIOWD +QINTE0: +];KL10P + TDNE TT,[%HIOVR+%HICOV+%HIDPE+%HICPE+%HIBPE] + JRST QINTE1 ;OVERRUN OR PARITY ON CONTROL BUS OR CHANNEL BUS - RETRY + MOVE A,QERSTS ;DRIVE EXCEPTION, CHECK DRIVE STATUS + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ;THESE BITS BETTER ALL BE ON + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG ;DRIVE TURNED OFF? MAYBE 11 HACKING THIS DRIVE? + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ;SPURIOUS? + JRST QINT0 ] + MOVE B,QERER1 ;CHECK THE MAIN ERROR REGISTER + TRNE B,#%H1SOF ;ANY HARD ERRORS? + JRST UNSAFE + CAIN B,%H1ECC ;IF JUST A CORRECTABLE ERROR, + JRST QECC ;GO CORRECT IT + PUSHJ P,QINTER ;OTHER SOFT ERROR, PRINT MESSAGE AND RESET DRIVE + TRNE B,010620 ;SEARCH ERROR, OR HEADER READ OR FORMAT ERROR OR DRIVE TIMING + JRST QHE ;REQUIRES RECALIBRATE + TRNE B,100110 ;BUS PARITY OR ECC "HARD" + JRST QDE ;REQUIRES RE-READ, GIVE UP AFTER N + JRST QOVR ;NO ERROR BITS, PRINT MESSAGE AND RETRY + +;CONTROLLER ERROR +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CONI=],OCT,QERST,[DCL=],OCT,QERDCL + JRST QOVR + +;DRIVE ERROR +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA + MOVSI A,%HRDCL(Q) ;NOW RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + JRST RHSET + +;COME HERE FOR DRIVE UNSAFE AND SIMILAR BAD THINGS. MAY BE SET TO +;EITHER HALT OR ATTEMPT RETRY (VIA USFHLT VARIABLE). NOTE THAT WHEN +;WE GET HERE THE STATE OF THE DRIVE HAS NOT YET BEEN DISTURBED. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + JRST QHE ;RECALIBRATE AND RETRY + +QECC: MOVSI A,%HRDCL(Q) ;RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + PUSHJ P,RHSET + CAME Q,QSDU ;CORRECT AN ECC ERROR + BUG ;BARF ... NO TRANSFER IN PROGRESS + MOVE A,QCHPRG + TRNN A,10 + BUG ;BARF ... SHOULDN'T HAPPEN DURING WRITE + SKIPN A,QICWA+1 ;GET ADDRESS OF LAST WORD READ + JRST 4,.-1 ;CHANNEL OUGHT TO HAVE STORED CONTROL WORD BY NOW + SOS J,A + TDZ J,[177+.BM $DFCWA] ;J := ADDRESS OF FIRST WORD IN LOSING SECTOR + LDB A,[$DFCAD QIOWD] + SUBM J,A + SOS H,A ;# WORDS SUCCESSFULLY XFERED. + CAIL H,0 ;CHECK IF CHANNEL STORED BAD ADDRESS + CAILE H,2000-200 + JRST QDE ;THIS SHOULD NEVER HAPPEN, BUT IT DOES, FREQUENTLY + MOVE A,QECPOS ;GET ERROR POSITION + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADD J,A ;J := ADDRESS OF LOSING WORD-PAIR + LDB A,[121400,,J] + ANDI J,1777 ;GET ADDR OF PAR ERR PAG + ADDI J,400000+2000*PAREP ;IN EXEC ADDRESS SPACE + IORI A,600000 ;MAKE THAT PAGE POINT TO THE DISK BUFFER + DPB A,[.PAREP+EXEUMP] + SPM ECCPAG ;GET IT INTO OUR MAP. + LPMR ECCPAG + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + LPMR ECCPAG + + AOS QECCS(Q) ;LOG THE LOSS + MOVE A,QCHPGA + MOVEI E,200(H) + LSH E,-7 ;NUMBER OF SECTORS TRANSFERRED (INCLUDING ECC SECTOR) + LDB B,[$HASEC A] ;GET DISK ADDR OF FAILING SECTOR + ADDI B,-1(E) + IDIVI B,NSECS + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D + DPB B,[$HATRK A] ;NO NEED TO DIVIDE BY NHEDS SINCE NEVER CROSS CYLINDERS + MOVEM A,QECCAD(Q) + HLRZ A,A + MOVE D,QSDCH + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT ],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS CYLINDERS + HRRZ C,QSDCH ;FOR QECCX + LDB A,[$DFCWA QICWA+1] ;LAST CONTROL WORD PROCESSED + SUBI A,1 ;CRETINOUS DF10 + CAIE A,QIOWD + BUG ;CHANNEL STORED BAD ADDRESS? + HRRZM A,QICWA + MOVEI A,200(H) ;# WORDS ALREADY DONE. + DPB A,[$DFWC A] ;PUT IT IN BOTH FIELDS. + ADDB A,@QICWA ;ADVANCE C.W. TO REMAINING STUFF + TLNE A,(.BM $DFWC) + JRST QECCX ;MORE TO DO, CONTINUE XFER + AOS QICWA ;ELSE ADVANCE TO NEXT C.W. + SKIPE @QICWA + JRST QECCX ;MORE TO DO, CONTINUE XFER + JRST QINTA1 ;XFER COMPLETE +] + +IFN T300P,[ +T3INT: SETZM DSCDON ;CLEAR DONE FLAG THAT GOT US HERE + SKIPGE QSDU1 ;OPERATION COMPLETE? + JRST QINT1 ;NO, GO FIND SOMETHING TO DO + HRRZ Q,DSCDRV ;YES, GET DRIVE OPERATION WAS ON + ADDI Q,T300P + CAIGE Q,NQS + CAME Q,QSDU1 ;TERMINATION ON DRIVE WE EXPECTED? + BUG ;DRIVE NUMBER CLOBBERED? + SETZM QRCAL(Q) ;PRESUMABLY NOT RECALIBRATING ANY MORE. + MOVE A,DSCCMD ;COMMAND THAT JUST COMPLETED + CAIN A,%DMREC ;WAS IT A RECALIBRATE? + JRST QINT1E ;IF SO, CONTROLLER IS IDLE NOW + MOVE C,QSDCH1 ;CHANNEL + HRLZ E,DSCFLT ;CHECK FOR ERRORS + HRR E,DSCSTS + JUMPE E,QINTI ;OPERATION COMPLETED UNEVENTFULLY + MOVE D,DSCHED ;GET DISK ADDRESS AS CYL,,HEAD_9+SECTOR + LSH D,9 + IOR D,DSCSEC + HRL D,DSCCYL + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: T-300 ERR UNIT ],DEC,Q,[FAULT=],OCT,DSCFLT,[STATUS=],OCT,DSCSTS,[CMD=],OCT,DSCCMD,[CYL-SURF-SEC=],OCT,D + TRZE E,%DSRTR+%DSECC ;THESE ARE NOT ERRORS + AOS QECCS(Q) + JUMPE E,QINTI ;OPERATION COMPLETED SUCCESSFULLY (WITH INTERVENTION OF 2561) + MOVE T,E + TRZ T,%DSECH+%DSIDE+%DSHCE + JUMPN T,T3INT2 ;CONSIDER USING ERROR RECOVERY FEATURES + TRNE A,%DMRED ;IF COMMAND IS A READ + TRNE A,10 ;AND WE HAVEN'T TRIED THEM ALL + JRST T3INT2 + AOS NQSE(Q) ;COUNT "SOFT ERRORS" (NOT "SPURIOUS" IN T-300 CASE) + AOJA A,T3IO1 ;GO RETRY OPERATION USING NEXT FEATURE + +T3INT2: TLNN E,-1 ;ANY FAULT? PROBABLY UNRECOVERABLE BUT TRY RECALIBRATE + TRNE E,%DSIDE+%DSHCE+%DSSKE+%DSOFL+%DSFLT ;DISK CONDITION THAT CALLS FOR RECAL + JRST T3HE + JRST T3DE ;TRY OPERATION AGAIN. PROBABLY WILL LOSE BUT TRY. +];T300P + +OVHMTR QSC ;DISK SCHEDULER (AND HIGHER-LEVEL INTERRUPT STUFF) + +QINTA1: SKIPL C,QSDCH ;XFER COMPLETE +QINTI: SKIPGE A,QSCABN(C) ;CHANNEL IN C + BUG ;MEMBLT INDEX IN A + MOVE R,A ;BUFFER ADDRESS IN R +IFN KL10P,[ ;QSRAC IN D, QSK# IN Q + SKIPL QSCRW(C) ;IF READ, FLUSH CACHE AGAIN + JRST [ PUSHJ P,CSHSWP ;SINCE USER MIGHT HAVE TOUCHED ABS PAGE + CAIA + MOVE A,R ;A WAS CLOBBERED + JRST .+1 ] +] +IFN KS10P,[ + SKIPL QSCRW(C) ;ON KS, CAN ONLY CLEAR THE WHOLE CACHE + CLRCSH +] + LSH R,10. + MOVE D,QSRAC(C) +IFN RP10P,[ + HRRZ TT,QICWA+1 + CAIE TT,1777(R) + TLNE D,%QAPAR ;IGNORE IF LOSING ANYWAY (E.G. SEARCH ERR) + CAIA + JRST QDFLOS +];RP10P +IFN QRDCMP,[ + SKIPE TT,RDCPHS ;NEED TO READ-COMPARE? + JRST QRC1 ;READ-COMPARE STARTING OR FINISHED +QRC0: +];QRDCMP + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE COMPLETION HANDLER + OFFSET -. +%QMIDL::JRST 4,QINT1 ;IDLE - SHOULDN'T BE ACTIVE +%QMRD:: JRST QRDFIN ;READ +%QMWRT::JRST QWRFIN ;WRITE +%QMWOV::JRST QWOVFN ;WRITE-OVER MODE +%QMRD1::JRST QRD1FN ;READ BLOCK AT A TIME MODE + JRST 4,QINT1 ;ILL CODE +%QMUDR::JRST QUDRIN ;USER DIR IN +%QMMDR::JRST QMDRIN ;MASTER DIR IN +%QMTTR::JRST QTUTIN ;TUT IN +%QMUDW::JRST QUFDWF ;USER DIR WRITE +%QMMDW::JRST QMFDWF ;MASTER DIR WRITE +%QMTTW::JRST QTUTWF ;TUT WRITE +%QMSWP::JRST QSWPFN ;SWAP FINISHED + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE +%QMMAX::OFFSET 0 +IFN %QMMAX-20, .ERR %QMMAX MUST BE A POWER OF 2 + +IFN RP10P,[ +;CHANNEL DIDN'T TRANSFER EXACTLY 2000 WORDS +QDFLOS: MOVEI D,1777(R) ;EXPECTED TERMINATION ADDRESS + HRRZ B,QICWA+1 ;ACTUAL TERMINATION ADDRESS + CAIL B,(D) + SKIPL QSCRW(C) + JRST QDFLZ1 + BUG HALT,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D,[DISK IS CLOBBERED NOW.] + +QDFLZ1: BUG PAUSE,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D + JRST QOVR +];RP10P + +;;; SOFTWARE READ-COMPARE ROUTINES + +IFN QRDCMP,[ +IFE RP10P+RH10P, .ERR READ-COMPARE ONLY CODED FOR RP-10 AND RH10 +;IFE KA10P, .ERR READ-COMPARE ONLY CODED FOR KA-10 + +;;; REGULAR OPERATION COMPLETE, DO A READ-COMPARE TO BE SURE +QRC1: +IFN T300P, CAIGE Q,T300P ;NO READ/COMPARE IF THIS IS T-300 CONTROLLER + TLNE D,%QAPAR ;GIVING UP WITH FATAL ERR? + JRST QRC0 ;NO READ-COMPARE THEN + JUMPG TT,QRC2 ;JUMP IF READ-COMPARE COMPLETED + MOVE E,QSGL(C) ;DISK BLOCK + PUSHJ P,QPOSR ;E GETS DATAO WORD +IFN RP10P,[ + IOR E,[DREADC+7000+RCICWA] ;MAKE READ COMMAND + CONO DPC,175700+DSKCHN + MOVE T,[-2000,,QRCBUF-1] ;STORE CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + DATAO DPC,E ;START DISK +];RP10P +IFN RH10P,[ + MOVE T,[-2000_4,,QRCBUF-1] ;DF10-C CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + SWPUA ;DUMP CACHE + CONSZ 200000 ;IT'S INEFFICIENT, BUT WHAT THE HELL + JRST .-1 + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + MOVSI A,%HRADR(Q) + HRR A,E ;HEAD AND SECTOR (CYL DOESN'T CHANGE) + PUSHJ P,RHSET + MOVEI A,%HMRED+ + TLO A,%HRCTL(Q) + PUSHJ P,RHSET ;START DISK +];RH10P + MOVEM T,RDCPHS ;RDCPHS POSITIVE MEANS DOING RD/CMP NOW + JRST DSKEX ;AWAIT COMPLETION + +;;; READ-COMPARE COMPLETED. CHECK IT. +QRC2: SPM PARPG ;SET UP MAP TO PAGE BEING READ/WRITTEN + MOVEI T,600000+PMCSHM(A) + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + MOVEI H,0 ;H DIFFERENCE COUNT +IFN KA10P,[ + PUSH P,A ;WILL DO COMPARE LOOP IN ACS + PUSH P,C + PUSH P,D + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVSI D,[ MOVE T,400000+PAREP*2000(E) ;A + CAMN T,QRCBUF(E) ;B + AOBJN E,A ;C + JRST QRC3 ] ;D + HRRI D,A + BLT D,D + JRST A +];KA10P +.ELSE [ + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVE T,400000+PAREP*2000(E) + CAMN T,QRCBUF(E) +QRC2A: AOBJN E,.-2 +];NOT KA10P +QRC3: JUMPGE E,QRC5 ;JUMP IF DONE + JUMPG H,QRC4 ;COMPARE ERROR, REPORT IT + AOS NQCMPE(Q) +IFN KA10P,[ + MOVE T,-1(P) ;SAVED C + BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(T) +];KA10P +.ELSE BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(C) +QRC4: ADDI H,1 + HRRZ T,E + CAIG H,4 ;ONLY REPORT FIRST 4 BAD WORDS + BUG INFO,[DSK: READ-COMPARE DIFFERENCE ],OCT,T,OCT,400000+PAREP*2000(E),OCT,QRCBUF(E) +IFN KA10P,JRST C +.ELSE JRST QRC2A + +QRC5: +IFN KA10P,[ + POP P,D + POP P,C + POP P,A +];KA10P + MOVEI T,0 ;CLEAR MAP + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + JUMPE H,QRC0 ;NO DIFFERENCE, I/O OPERATION IS DONE + CAILE H,4 ;FAILED, DO IT ALL OVER AGAIN + BUG INFO,[DSK: READ-COMPARE DIFFERENCES TOTAL],DEC,H + JRST QOVR +];QRDCMP + +QUFDWF: MOVE TT,QDWIP + CAMN Q,MDSK ;WRITTEN TO MASTER DISK? + SKIPN E,QSFBT(TT) ;AND HAVE SOME BLOCKS TO FREE? + JRST QUDWF1 + SETZM QSFBT(TT) ;YES, TRANSFER THEM TO QFBTS LIST + MOVE T,E ;E FINDS LAST OF LIST, T RPLACD'D IN THERE + EXCH T,QFBTS ;NCONC QSFBT ONTO FRONT OF QFBTS + SKIPE 1(E) + JRST [ MOVE E,1(E) + JRST .-1 ] + MOVEM T,1(E) + SKIPN T + AOS NCORRQ ;WAKE UP CORE JOB IF QFBTS HAD BEEN EMPTY +QUDWF1: JSP D,QDWF + QSNLCN(TT) + +QMFDWF: JSP D,QDWF + QMDRO + +QTUTWF: AOS T,QSGL(C) ;NEXT BLOCK TO GO OUT + AOS QSCABN(C) ;FROM NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;WRITE MORE + JSP D,QDWF + QTUTO(TT) + +QDWF: MOVSI E,(SETZ) ;UNLOCK DIR THAT WAS WRITTEN + IOR E,DCHBT(Q) ;COPY ON THIS DISK IS NOW UP TO DATE + MOVE TT,QDWIP + ANDCAM E,@(D) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + SETOM DWUSR + JRST QINT1A ;DON'T COUNT THIS AS DISK ACTIVITY + +QUDRIN: MOVE TT,QUDPR(C) ;USER DIR IN OK + MOVE D,UDNAME(R) + CAME D,QSNUD(TT) ;COMPARE UNAME IN DIR WITH RQ'ED + JRST QUDER1 + TLO R,40000 ;NOT PAWED OVER + MOVEM R,QSNLCN(TT) + MOVE R,QSLGL(C) + MOVEM R,QSNMI(TT) + MOVEI R,MU23UD ;USER DIRECTORY + PUSH P,A + PUSH P,C + MOVE C,TT + PUSHJ P,QDIRCK ;VERIFY NOT TOTALLY BASHED TO BEGIN WITH + POP P,C ;CLOBBERS A,B,I + POP P,A +QINTU4: DPB R,[MUR,,MEMBLT(A)] + DPB TT,[MNUMB,,MEMBLT(A)] +QTUTI1: SETOM QUSR(C) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QINT1A + +QMDRIN: TLO R,2 ;NOT RECONCILED + MOVEM R,QMDRO ;MASTER DIRECTORY IN + MOVE TT,MDCHK(R) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + MOVE TT,MDNUDS(R) + CAIE TT,NUDSL + BUG HALT,[MFD HAS WRONG NUMBER OF DIRECTORIES] + MOVE TT,(R) ;ASCENDING DIR # + SKIPGE QAMDNO + MOVEM TT,QAMDNO ;FIRST DISK IN STORE ASCENDING # + MOVEI R,MU23MD ;MASTER DIRECTORY + MOVE TT,Q ;DISK NO + JRST QINTU4 + +QTUTIN: AOS T,QSGL(C) ;NEXT BLOCK TO COME IN + AOS QSCABN(C) ;INTO NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;READ MORE + HRRZS QTUTO(Q) ;UNLOCK TUT, BUT QDPWF IS STILL SET + JRST QTUTI1 + +QSWPFN: MOVE Q,QDSKN(C) + TLNE D,%QAPAR + JRST QSWPF2 ;SWAP READ ERROR (I HOPE) + MOVSI E,MMPTMP ;PAGE NO LONGER IN TRANSIT + TDNN E,@QSMMP(Q) + BUG ;ALREADY WASN'T? + ANDCAM E,@QSMMP(Q) + SKIPL QSCRW(C) + JRST QSWPIF + PUSHJ P,IMEMR ;SWAP-OUT COMPLETE, RETURN MEMORY + MOVSI E,MMPPGB + ANDCAM E,@QSMMP(Q) + MOVSI E,MMPWOD ;PAGE HAS BEEN WRITTEN ON DISK. AND NO LONGER + IORB E,@QSMMP(Q) ;BEING PAGED BEHIND. + TLNN E,MMPGON + JRST QSWPF2 + MOVE A,QSMMP(Q) ;WE'RE SUPPOSED TO RETURN THE MMP ENTRY + PUSHJ P,RETMMP +QSWPF2: SETOM SWUSR(Q) ;SWAPPING IDLE + JRST QINT1B + +QSWPIF: +;SOME ERROR CHECKING + MOVE E,QSMMP(Q) + HLLZ TT,1(E) + JUMPE TT,QSWPF3 ;ON INITIAL-SWAP-IN, ADDRESS IN MMP IS SUPPOSED TO BE ZERO + LDB TT,[$MMPUN,,(E)] + CAME TT,Q + BUG + HLRZ TT,1(E) + CAME TT,QSGL(C) + BUG +QSWPF3: LDB TT,[MMMPX,,MEMBLT(A)] + CAIE TT,-MMP(E) + BUG +;END ERROR CHECKING + MOVEI TT,MURUSR ;SWAP IN OF PAGE COMPLETED + DPB TT,[MUR,,MEMBLT(A)] + SETZM MMSWP(A) + MOVE D,(E) + SKIPL CIRPSW + JRST QSWPF2 ;CAN'T PUT IN MAPS IF CIRPSW NOT AVAILABLE. + MOVSI D,(TDNE T,) ;SET UP CHECK USED BY PRIVELEGED USER FEATURE + HRR D,QSMMP(Q) + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS + POP P,Q + POP P,C + JRST QSWPF2 + +QWOVFN: CLEARM QSCRW(C) ;WRITE OVER SWITCH TO READ MODE + HRRI D,%QMRD1 + TLZE D,%QAEFW + HRRI D,%QMIDL ;TRYING TO CLOSE, STOP CHANNEL + MOVEM D,QSRAC(C) + AOS QWBUFS ;COMPENSATE FOR EXTRA SOS BELOW + +QWRFIN: TLNN D,%QACTH ;WRITE COMPLETE, RETURN BUFFER + PUSHJ P,IMEMR + TLNE D,%QACTH + PUSHJ P,CIMEMR + SOS QSBFS(C) + SOS QWBUFS + MOVE TT,QSGL(C) + MOVEM TT,QSLBLK(C) + JRST QINT1B + +QRD1FN: HLLZS QSRAC(C) .SEE %QMIDL ;BLOCK-AT-A-TIME READ COMPLETE, IDLE THE CHANNEL + +QRDFIN: MOVEI B,.BM MLO ;NORMAL READ COMPLETED + ANDCAM B,MEMBLT(A) ;THREAD ONTO CHANNEL LIST + HLRZ B,QBFP(C) + SKIPE B + DPB A,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM A,QBFP(C) + HRLM A,QBFP(C) + SKIPL B,QPIBSZ(C) ;GET BYTE COUNT OF BLOCK + JRST QRDFN1 + HRRZ B,1777(R) ;FUNNY BLOCK, GET FROM LAST WORD + HRRZ TT,QSBYTE(C) ;AND MAKE SURE IT'S NOT TOO BIG + IMULI TT,2000 + CAMLE B,TT + MOVE B,TT +QRDFN1: HRRZM B,MEMPNT(A) ;PASS TO MAIN PROGRAM + AOS QSBFS(C) +IFE DMDSK, LDB B,[XWBLK QXWDS] + .ALSO MOVEM B,QSLBLK(C) + +;XFER COMPLETE, DEACTIVATE CHANNEL + +QINT1B: SETOM QACTTM +QINT1A: SETOM QSGL(C) + SETOM QSCABN(C) +QINT1E: +IFE DC10P, SETOM QSKT1(Q) +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] ;DC10P +IFN T300P,[ + CAIL Q,T300P + SETOM QSDU1 + CAIGE Q,T300P + SETOM QSDU +];T300P +.ELSE SETOM QSDU +;DROPS THROUGH + ;DROPS IN + +;ACTIVATE CHANNELS, LOOK FOR SEEKS AND TRANSFERS TO BE DONE + +QINT1: SETZM QHUNGF + SETOM QTUNT ;NO UNIT SELECTED YET +IFN T300P, SETOM QTUNT1 + MOVE C,QTCHN ;START SCAN IN SUITABLE PLACE + MOVEM C,QLCHN + JRST QINT2D + +QINT2L: CAIGE C,NQCHN ;IF DIR-WRITE OR SWAP CHANNEL, DON'T CHECK QUSR + SKIPL QUSR(C) + SKIPGE D,QSRAC(C) .SEE %QALOK + JRST QINT2C ;CHANNEL LOCKED OR NOT OPEN, SKIP IT + MOVE Q,QDSKN(C) + SKIPL E,QSGL(C) + JRST QINT4 ;JUMP IF CHANNEL ACTIVE ALREADY + TLNE D,%QACTH+%QAOUT + JRST QINT2C ;CHANNEL BLOCKED BY CORE JOB, DON'T ACTIVATE + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE ACTIVATE HANDLER + OFFSET -. +%QMIDL::JRST QINT2C ;IDLE - DON'T ACTIVATE +%QMRD:: JRST QRDACT ;READ +%QMWRT::JRST QWRACT ;WRITE +%QMWOV::JRST QWRACT ;WRITE OVER +%QMRD1::JRST QRDACT ;READ 1 BLOCK + JRST 4,QINT2C ;ILL CODE +%QMUDR::JRST QDRACT ;UFD READ +%QMMDR::JRST QDRACT ;MFD READ +%QMTTR::JRST QDRACT ;TUT READ +%QMUDW::JRST 4,QINT2C ;UFD WRITE - SHOULDN'T LEAVE THIS MODE AROUND +%QMMDW::JRST 4,QINT2C ;MFD WRITE - .. +%QMTTW::JRST QINT5 ;TUT WRITE - MAY BE WRITING SECOND PAGE +%QMSWP::JRST SWPACT ;SWAP + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE +%QMMAX::OFFSET 0 + +; ACTIVATION ROUTINES + +SWPACT: SKIPL SWUSR(Q) + BUG ;SWAPPING ALREADY ACTIVE ON THIS DISK + MOVE A,MEMFR + SUB A,NCBCOM + MOVEI B,0 ;CHECK FIRST FOR SWAP IN OR OUT + CAIGE A,6 ;ACCORDING TO AVAIL MEM + MOVEI B,1 + SKIPN @SWAPL(B) ;IF NO TRAFFIC THAT DIRECTION, CHECK THE OTHER. + TRC B,1 + HRRZ E,@SWAPL(B) + JUMPE E,QINT2C ;NO SWAPPING TRAFFIC THIS DISK. + LDB A,[MLO,,MEMBLT(E)] ;TAKE BLOCK OFF LIST + SKIPN A + SETZM @SWAPL(B) ;LAST BLOCK, LIST IS NOW EMPTY + HRRM A,@SWAPL(B) ;SET NEW FIRST BLOCK + LDB D,[MMMPX,,MEMBLT(E)] + ADD D,MMPEAD ;GET MMP ADDRESS + LDB TT,[410200,,(D)] + TRNN TT,1 + BUG ;THIS PAGE SHOULD BE MARKED IN TRANSIT + HRRZM D,QSMMP(Q) + SOS SILNG(B) + CAIGE E,TSYSM + CAIGE E,SYSB + BUG + HRRZM E,QSCABN+NQCHN+1(Q) + CLEARM SWUSR(Q) ;CHNL ACTIVE + HLRZ E,MEMPNT(E) + MOVEM E,QSGL+NQCHN+1(Q) ;DISK BLOCK + HRRZS QSRAC+NQCHN+1(Q) .SEE %QMSWP + MOVNM B,QSCRW+NQCHN+1(Q) ;DIRECTION + CLEARM QERRS+NQCHN+1(Q) ;NO ERRORS (YET) + JRST QINT4 ;CHANNEL SUCCESSFULLY ACTIVATED + + +; MORE ACTIVATION ROUTINES + +QRDACT: TLNE D,%QAACC ;ACTIVATE READ CHANNEL + JRST QINT2C ;NOT IF USER HACKING RANDOM ACCESS NOW + SETZM QERRS(C) + MOVE J,QUDPR(C) + SKIPGE QSNLCN(J) + JRST QINT2C ;USER DIRECTORY OUT OR LOCKED + MOVE A,QSBFS(C) + SKIPL QSMDN(C) + AOS A ;A := TOTAL NUMBER OF BUFFERS + CAMLE A,QRDAHD ;HOW MUCH SHOULD BE READ AHEAD + JRST QINT2C ;BLOATED, DON'T ACTIVATE + SKIPE QSBI(C) + JRST QINT4A ;BLOCKS LEFT FROM LAST TIME +QINT4B: PUSHJ P,QIDRCH ;GET NEXT DESC BYTE IN A, ALSO RET BYTE PNTR IN TT + CAIN A,UDWPH + JRST QINT4B + JUMPE A,QEOF ;REACHED READ EOF + TRZE A,40 + JRST QINT4C + CAILE A,UDTKMX + JRST QINT4D ;SKIP AND TAKE + MOVEM A,QSBI(C) ;TAKE NEXT N +QINT4A: SOS QSBI(C) + AOS E,QSLGL(C) +QINT4G: MOVEM E,QSGL(C) + MOVSI B,%QALBK + ANDCAM B,QSRAC(C) ;CLEAR PROCESSING LAST BLOCK IN FILE BIT + HRRZ A,QSBYTE(C) + IMULI A,2000 ;NUMBER OF BYTES IN A FULL BLOCK +IFN DMDSK,[ + MOVSI D,%QAFNY ;FUNNY FILE + TDNE D,QSRAC(C) + SETO A, +] + MOVEM A,QPIBSZ(C) ;SET FUNNY BIT + SKIPE QSBI(C) + JRST QINT4 ;IF MORE BLOCKS FOLLOW DON'T CHECK EOF + PUSHJ P,QIDRCH ;GET NEXT DESCR BYTE + SOS QDIRP(C) ;CORRECT PNTR + JUMPN A,QINT4 + MOVE A,QUDFPR(C) ;THIS IS LAST BLOCK + ADD A,QSNLCN(J) + LDB D,[UNBYTE+UNREF(A)] + PUSHJ P,QBDCD + IMUL D,E ;NUMBER OF UNUSED BITS IN LAST WORD + LDB E,[QSBSIZ(C)] ;(DEPEND ON DIVIDE ROUNDING DOWN) + IDIV D,E ;NUMBER OF UNUSED BYTES (IN SIZE OPEN) + LDB E,[UNWRDC+UNRNDM(A)];NUMBER OF USED WORDS IN LAST BLOCK + SKIPN E + MOVEI E,2000 + IMULI E,@QSBYTE(C) ;CONVERT TO NUMBER OF BYTES + SUB E,D ;NUMBER OF VALID BYTES IN BLOCK + HRRM E,QPIBSZ(C) ;STORE BYTE COUNT OF LAST BLOCK + IORM B,QSRAC(C) .SEE %QALBK + MOVE E,QSGL(C) + JRST QINT4 + +QINT4D: MOVEI E,1-UDTKMX(A) ;SKIP N AND TAKE 1 + ADDB E,QSLGL(C) + JRST QINT4G + +QWRACT: SKIPN I,QBFP(C) ;ACTIVATE WRITE CHANNEL + JRST QINT2C ;END OF WRITE LIST FOR NOW + HRRZM I,QSCABN(C) + LDB H,[MLO,,MEMBLT(I)] + HRRM H,QBFP(C) + SKIPN H + SETZM QBFP(C) ;LAST BLOCK, LIST NOW EMPTY + HLRZ E,MEMPNT(I) + MOVEM E,QSGL(C) + JRST QINT4 + +QDRACT: MOVE E,QSLGL(C) ;ACTIVATE DIRECTORY-READ CHANNEL + MOVEM E,QSGL(C) +; JRST QINT4 ;DROPS THROUGH + ;DROPS IN +QINT4: SKIPL QSCABN(C) ;SKIP IF NEED MEMORY + JRST QINT5 + PUSHJ P,IOMQ ;GET MEMORY FOR READ BUFFER + JRST QINT2C ;CAN'T +QINT5A: MOVEM A,QSCABN(C) + MOVEI D,MU23B + DPB D,[MUR,,MEMBLT(A)] + DPB C,[MNUMB,,MEMBLT(A)] + +QINT5: +IFN DC10P, MOVE TT,QTRAN(Q) +.ELSE MOVE TT,Q + SKIPN QSEEK(TT) ;IGNORE SEEKING DRIVE + SKIPGE QRCAL(TT) ;IGNORE RECALIBRATING DRIVE + JRST QINT2C +IFN T300P,[ ;IGNORE IF FOR CONTROLLER THAT IS NOT READY + CAIL TT,T300P + JRST [ SKIPGE QSDU1 + SKIPL QTUNT1 ;NOTE CODE HERE IS SIMILAR TO THAT AT QINT2F + JRST QINT2C ;T-300 CONTROLLER BUSY OR ALREADY COMMITTED + HRRZM Q,QTUNT1 ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN1 ;FOR THIS CHANNEL + JRST QINT2C ] ;T-300 CODE IS SIMPLIFIED SINCE NO SEEK OVERLAPS + SKIPL QSDU + JRST QINT2C +];T300P + HRRZ B,QSKT1(TT) + CAIN B,(C) + JRST QINT2F ;ALREADY SET FOR ME + SKIPL QSKT1(TT) + JRST QINT2C ;SET FOR SOME OTHER CHNL + HRRZM C,QSKT1(TT) ;AVAILABLE, SET IT FOR ME + PUSHJ P,QPOSR ;CONVERT DISK ADDRESS TO PHYSICAL +IFN DC10P,[ ;AND INITIATE SEEK + ADD E,[DSEEK] + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,E + LDB B,[DCYL E] + MOVE TT,QTRAN(Q) ;PRETEND SEEK ALREADY COMPLETE + MOVEM B,QPOSGL(TT) + MOVEM B,QPOS(TT) + JRST QINT2F ;DON'T WAIT FOR SEEK, START TRANSFER RIGHT AWAY +] ;DC10P +IFN RP10P,[ + TLO E,(DSEEKC) ;DSK SEEK + CONSZ DPC,20 + JRST 4,.-1 + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAMN TT,QPOS(Q) + JRST QINT2F ;IF WE'RE THERE, DON'T SEEK + MOVEM TT,QPOSGL(Q) + DATAO DPC,E + MOVEM E,QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, GO GET ANOTHER +] ;RP10P +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + HRRZ A,E + IOWRQ A,%HRADR ; Set track and sector + HLRZ A,E + IOWRQ A,%HRCYL ; Set cylinder + CAMN A,QPOS(Q) + JRST QINT2F ; On cylinder, don't seek + MOVEM A,QPOSGL(Q) + MOVEI A,%HMSEK + PUSHJ P,RHCMD ; Start seeking + SETOM QSEEK(Q) + JRST QINT2C ; Start other drives now? +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,E + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,E + PUSHJ P,RHSET + HLRZ TT,E ;GET CYLINDER PART OF ADDRESS + CAMN TT,QPOS(Q) + JRST QINT2F ;ON CYLINDER, DON'T SEEK + MOVEM TT,QPOSGL(Q) + MOVSI A,%HRDCL(Q) ;START SEEK + HRRI A,%HMSEK + PUSHJ P,RHSET + SETOM QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, START OTHER DRIVES +] ;RH10P + +IFN KL10P,[ +;CALL HERE TO SWEEP THE CACHE. CORE PAGE # IN R. +;INSTRUCTION AT CALL+1 SHOULD SKIP IF READING INTO CORE. +;CLOBBERS A,B,D,E,TT. + +CSHSWP: SETZB A,B ;A COUNTS WAIT TIME, B IS SWEEP INSTRUCTION + XCT @(P) + TLOA B,(SWPUO (R)) ;WRITE - UNLOAD PAGE FROM CACHE + MOVSI B,(SWPIO (R)) ;READ - CLEAR PAGE FROM CACHE + LSH R,1 ;HARDWARE PAGES ARE 1/2 K + XCT B ;SWEEP FIRST HALF-PAGE + MOVE D,[CONSZ 200000] + MOVE E,[AOJA A,D] + MOVSI TT,(POPJ P,) + PUSHJ P,D ;WAIT IN ACS TO MINIMIZE MBOX INTERFERENCE + AOS R ;SWEEP SECOND HALF-PAGE + XCT B + PUSHJ P,D + XCT @(P) + AOSA NCSHU ;COUNT NUMBER OF TIMES THIS DONE + AOSA NCSHI + JRST [ ADDM A,NCSHUL ? JRST .+2 ] + ADDM A,NCSHIL ;AND COUNT NUMBER OF LOOPS IN ACS + LSH R,-1 + JRST POPJ1 +] + +;VARIOUS EXITS FROM CHANNEL-CHECKING ROUTINES + +QINT2F: SKIPL QTUNT ;THIS CHANNEL IS READY TO TRANSFER + JRST QINT2C ;ALREADY FOUND A TRANSFER + HRRZM Q,QTUNT ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN ;FOR THIS CHANNEL +QINT2C: CAMN C,QLCHN ;CONTINUE CHANNEL SCAN + JRST QINT2E ;UNLESS CHECKED ALL CHANNELS +QINT2D: CAIL C,NQCHN+1+NQS-1 ;SKIP IF NOT TIME TO WRAP AROUND + SETO C, + AOJA C,QINT2L ;CHECK ANOTHER + +QINT2E: +IFN T300P,[ + MOVE C,QTCHN1 + SKIPL Q,QTUNT1 ;FOUND XFER FOR T-300? + JRST QDE1 ;YES +];T300P + SKIPGE Q,QTUNT ;FOUND XFER? + JRST QINT3 ;IDLE + MOVE C,QTCHN +;Q DISK TO TRANSFER ON, C CHANNEL. START (OR RESTART) TRANSFER ON THEM. +QDE1: MOVE R,QSCABN(C) +IFN KL10P,[ + PUSHJ P,CSHSWP + SKIPGE QSCRW(C) +];KL10P +IFN KS10P,[ + SKIPL QSCRW(C) + CLRCSH +];KS10P +IFE T300P, MOVEM C,QSDCH +IFN T300P,[ + CAIL Q,T300P + JRST T3IO + CAIGE Q,T300P + MOVEM C,QSDCH +];T300P + SKIPGE B,QSCRW(C) ;LOAD R/W STATUS IN B + JRST QINT6W + ;READ - DROPS IN +IFN RP10P,[ + MOVSI T,(DREADC) +QINT6A: IORI T,7000+QICWA ;DON'T STOP FOR PARITY ERRORS (PLUS INITIAL CHNL ADR) + MOVEM T,QCHPRG + DPB Q,[DUNFLD+QCHPRG] + HLLZS QIOWD + DPB R,[121000,,QIOWD] + LDB E,[100300,,R] ;MA15-17 + TRC E,7 + DPB E,[410300,,QIOWD] ;SET UP HIGH ADDR BITS. + MOVE TT,QIOWD + SOS TT + HRRM TT,QIOWD + SETZM QIOWD+1 + MOVEM Q,QSDU + MOVE E,QSGL(C) + PUSHJ P,QPOSR + IORM E,QCHPRG +QOVR: CONSZ DPC,20 + JRST QOVR + SKIPGE Q,QSDU + BUG + CONO DPC,175700+DSKCHN +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVEI TT,QIOWD + HRRZM TT,QICWA + MOVE E,QCHPRG + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAME TT,QPOS(Q) + BUG ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + SETZM QICWA+1 + DATAO DPC,QCHPRG ;ENTRY ON OVERRUN + MOVE A,TIME + MOVEM A,LQTM + MOVEM Q,QSDU + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DPC,DCLEAR+20+DSKCHN ;DISK NOTICED TO BE HUNG, RESET IT + SETOM QHUNGF ;TELL P.I. LEVEL TO RETRY OPERATION + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + ;READ - DROPS IN + +IFN RH11P,[ + MOVEI T,%HMRED +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,1 ; Set up Unibus map for RH11 to point at + TRO R,%UQVAL+%UQFST ; the block in question. + IOWRQ R,UBAPAG+QUBPG_1 + ADDI R,1 + IOWRQ R,UBAPAG+QUBPG_1+1 + MOVE E,[-4000,,QUBPG_14] + MOVEM E,QIOWD + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: IORDQ TT,%HRCS1 ; Enter here to recover from PI level lossage + TRNN TT,%HXRDY + JRST QOVR + SKIPGE Q,QSDU + BUG +QECCX: ;; Enter here from ECC correction code + PUSHJ P,RHCLRC ; Clear controller errors and select drive + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ; Punt if not positioned in right place + IOWRQ TT,%HRCYL ; Store cylinder in drive + HRRZ TT,QCHPGA + IOWRQ TT,%HRADR ; Store track and sector + HLRZ TT,QIOWD + IOWRQ TT,%HRWC ; Store halfword count + HRRZ TT,QIOWD + IOWRQ TT,%HRBA ; Store Unibus base address + MOVE A,QCHPRG + PUSHJ P,RHCMD ; Go! + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: MOVEI A,%HYCLR ; Sock controller in jaw + IOWRQ A,%HRCS2 + MOVE Q,QSDU + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Redundantly clear drive + SETOM QHUNGF + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT #],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, + +] ;RH11P + ;READ - DROPS IN + +IFN RH10P,[ + MOVEI T,%HMRED +QINT6A: IORI T,QICWA_6 .SEE $HCICWA + TLO T,%HRCTL(Q) + MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,10. ;ASSEMBLE DF10-C CONTROL WORD + SUBI R,1 + MOVNI E,2000 + DPB E,[$DFWC R] + MOVEM R,QIOWD + SETZM QIOWD+1 + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: CONSZ DSK,20 ;ENTER HERE FOR RECOVER FROM PI HALT, OVERRUN + JRST QOVR + SKIPGE Q,QSDU + BUG + MOVEI TT,QIOWD + HRRZM TT,QICWA +QECCX: SETZM QICWA+1 ;ENTER HERE FROM ECC CORRECTION CODE + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,QCHPGA + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,QCHPGA + PUSHJ P,RHSET + MOVE A,QCHPRG + PUSHJ P,RHSET +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DSK,%HOCLR+%HORST+%HOSTP+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;CLEAR DRIVE + PUSHJ P,RHSET + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, +] + ;READ - DROPS IN +IFN DC10P,[ + MOVSI T,(DREAD) +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + DPB R,[DCBN+QCHPR2] ;MEM BLOCK # + DPB R,[DCBN+QCHPR3] ;FOR POSSIBLE READ COMPARE + MOVE E,QSGL(C) + PUSHJ P,QPOSR ;QPOSR ALSO STORES MAPPED UNIT IN QCHPRG + IORB E,QCHPRG + CLEARM QCHPR4 ;STORE DHALT FOR NO RCC + CAILE C,NQCHN + JRST QINT6S ;SWAPPING CHNL + SKIPL B + AOSA NRXFR + AOS NWXFR + CAIE C,NQCHN ;ALWAYS R COMPARE DIR WRITES + SKIPLE QRCSW ;SKIP ON NOT READ COMP EVERYTHING + JRST QINT6B ;RCC + SKIPL QRCSW + JUMPL B,QINT6B ;RCC WRITES + HRRZ D,QSRAC(C) + CAIL D,%QMUDR + CAILE D,%QMTTR + JRST QINT6C ;NOT DIR READ +QINT6B: TLZ E,340000 ;CHANGE TO READ COMPARE + MOVEM E,QCHPR4 +QINT6C: SETOM QERS1 ;ERR VERIFY IND +QOVR: CONSZ DC0,DSSRUN+DSSACT + JRST QOVR + DATAO DC0,[DJMP QCHPRG] ;ENTRY ON OVERRUN +QOVR1: CONO DC0,DCSET+DCIENB+DSKCHN ;INTERRUPT WHEN DONE + MOVE A,TIME + MOVEM A,LQTM +QINTX: JRST DSKEX + +QINT6S: SKIPL B + AOSA NSRXFR + AOS NSWXFR + JUMPL B,QINT6B ;RCC WRITES + JRST QINT6C ;NOT READS + +QHUNG: CONO DC0,DCCSET+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + +QINT6W:IFE DMDSK,[ + MOVE T,[QXWDS-1,,QXWDS] + BLT T,QXWDS+3 + CAIL C,NQCHN + JRST QNT6W2 ;SWAP OR DIR WRITE + MOVE A,QUDPR(C) + MOVE T,QSNUD(A) + MOVEM T,QXWDS+XWSYSN + HRRZ A,QSNLCN(A) + ADD A,QUDFPR(C) + MOVE T,UNFN1(A) + MOVEM T,QXWDS+XWFN1 + MOVE T,UNFN2(A) + MOVEM T,QXWDS+XWFN2 + MOVE T,QSLBLK(C) + DPB T,[XWBLK+QXWDS] + LDB T,[MWC,,MEMBLT(R)] + DPB T,[XWAWC+QXWDS] +QNT6W2: +] +IFN DC10P, MOVSI T,(DWRITE) +IFN RP10P, MOVSI T,(DWRITC) +IFN RH10P, MOVEI T,%HMWRT +IFN RH11P, MOVEI T,%HMWRT + JRST QINT6A + +IFN T300P,[ +T3IO: MOVEM C,QSDCH1 ;THIS IS MORE OR LESS QINT6A FOR T-300 + MOVEM Q,QSDU1 + MOVEI A,%DMRED + SKIPGE B,QSCRW(C) + MOVEI A,%DMWRT +T3IO1: MOVE R,QSCABN(C) ;RE-ENTER HERE TO RETRY WITH COMMAND IN A + LSH R,10. ;FIRST ADDRESS IN TRANSFER + TLO R,730000 ;12-BIT BYTES, START WITH FIRST BYTE IN WORD + MOVSI E,-4 ;SET UP BYTE POINTERS + MOVEM R,DSCPNT(E) + ADDI R,400 + AOBJN E,.-2 + MOVE D,QSGL(C) ;DO LIKE QPOSR + CAIL D,NBLKS1 + BUG + IDIVI D,NBLKC1 + MOVEM D,DSCCYL + IMULI E,SECBL1 + IDIVI E,NSECS1 + MOVEM E,DSCHED + MOVEM TT,DSCSEC + PUSHJ P,T3CMD + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR1 + AOS NWXFR1 + JRST QINTX + SKIPL B + AOSA NSRXF1 + AOS NSWXF1 + JRST QINTX + +;START T-300, COMMAND IN A, DRIVE IN Q +T3CMD: MOVEI TT,2561 + MOVEM TT,DSCCHK + MOVE TT,TIME + MOVEM TT,LQTM1 + MOVEI TT,-T300P(Q) + MOVEM TT,DSCDRV + HRRZM A,DSCCMD + SETZM DSCDON + MOVEI T,1 + MOVEM T,DSCREQ + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, + +QHUNG1: MOVE Q,QSDU1 + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON T-300 UNIT ],DEC,QSDU + MOVEI TT,5*60.*30. ;SHUT UP FOR FIVE MINUTES + ADDM TT,LQTM1 + POPJ P, +];T300P + +QDE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT +IFN DC10P, AOSE PKIDM + SKIPGE Q,QSDU + BUG +IFN DC10P,[ + TRNE TT,DCKSER + JRST .+3 ;GET CKS ERR + TRNE TT,DRCER + AOS NQCMPE(Q) ;# COMPARE ERRORS [WITH NO OTHER ERROR] +];DC10P +IFN T300P,T3DE: ;ENTER HERE FOR ERROR ON T-300 + AOS NQDE(Q) + SKIPL R,QSCRW(C) + AOSA NQRDE(Q) + AOS NQWDE(Q) +IFN DC10P, JUMPL R,QERV1 ;DO ANOTHER RD/COMP TO SEE IF OK ON DSK (IF WRITE) +QERV2: AOS R,QERRS(C) + TRNN R,10 ;TRY 8 TIMES BEFORE AND AFTER REPOSITION + JRST QDE1 + TRNN R,1000 + JRST QDE2 ;TRY REPOSITION ONCE +QERV3: MOVE D,QSRAC(C) + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE IRRECOV ERROR HANDLER +QERV: OFFSET -. +%QMIDL::JRST 4,QERV+. ;IDLE CHANNELS SHOULDN'T GET HERE +%QMRD:: JRST QPE2D ;USER DATA +%QMWRT::JRST QDE1 ;WRITE KEEP TRYING +%QMWOV::JRST QDE1 ;.. +%QMRD1::JRST QPE2D + JRST 4,QERV+. ;ILL CODE +%QMUDR::JRST QUDER1 +%QMMDR::JRST QDE1 +%QMTTR::JRST QDE1 +%QMUDW::JRST QDE1 +%QMMDW::JRST QDE1 +%QMTTW::JRST QDE1 +%QMSWP::JRST QSWPER + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE +%QMMAX::OFFSET 0 + +QSWPER: SKIPGE CIRPSW ;TRY XFER AGAIN IF CIRPSW NOT AVAILABLE + SKIPGE QSCRW(C) + JRST QDE1 ;DON'T TRY TO DO ANYTHING ABOUT WRITE ERRORS + MOVE A,QSCABN(C) ;READ - GIVE ALL USERS OF PAGE PARITY ERR + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,UCPRL + 400000,,QSWER1 + LDB Q,[2200,,MEMPNT(A)] + DPB Q,C ;REMOVE MEM FROM LOOP + PUSHJ P,IMEMR ;AND GIVE BACK MEM + POP P,Q ;ALTERNATIVELY, COULD LEAVE THE MEM BUT SET MMPBAD + POP P,C ;TO INDICATE THAT THAT MEM COPY OF THE PAGE IS NO GOOD. + MOVEI D,2 + DPB D,[410200,,@QSMMP(Q)] ;PAGE IS OUT + JRST QPE2D + +QSWER1: PUSH P,T + MOVSI T,%PJPAR + IORM T,PIRQC(U) + JRST POPTJ + +IFN DC10P,[ +QERV1: SKIPN QCHPR4 + JRST QERV2 ;NOT SET FOR RCC + CLEARM QERS1 +QERL2: CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,[DJMP QCHPR4] + JRST QOVR1 + +QERL1: AOS Q,QERS1 + CAIGE Q,50. + JRST QERL2 + AOSA NQWIRE +QEROK: AOS NQWRE + MOVE C,QSDCH + MOVE Q,QSDU + SETOM QERS1 + JRST QERV2 +] +QDE2: MOVEI R,1000 + MOVEM R,QERRS(C) ;CLOBBER QERRS + JRST QREC ;AND TRY REPOSITIONING + +IFN RP10P,[ +QERSOFT:LDB A,[DCYL+QCHPRG] ;PARSE STARTING DISK ADDRESS + LDB B,[DCYLXB+QCHPRG] + LSH B,8 + IOR A,B + LDB B,[DSURF+QCHPRG] + LDB D,[DSECT+QCHPRG] + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: SOFT ERR UNIT ],DEC,Q,[CYL ],DEC,A,[STARTING HEAD ],DEC,B,[SEC ],DEC,D,[CONI=],OCT,QERST,[DATAI=],OCT,QERDTI + POPJ P, + +QRECAT: CONI DPC,A + BUG INFO,[DSK: SEEK ERR DATAO=],OCT,QSEEK(Q),[CONI=],OCT,A,[DATAI=],OCT,E + SETZM QSEEK(Q) + JRST QREC +];RP10P + +QHE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT + SKIPGE Q,QSDU + BUG +IFN T300P,T3HE: ;ENTER HERE FOR ID ERROR ON T-300 + AOS NQHE(Q) + AOS E,QERRS(C) + CAIL E,5. + JRST QHE2 +QREC: +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QRCAL(Q) + MOVEI A,%DMREC + PUSHJ P,T3CMD + MOVEM Q,QSDU1 ;CONTROLLER IS TIED UP BY RECAL BECAUSE + JRST QINT1 ] ;IT'S TOO DAMNED PSEUDO-INTELLIGENT +];T300P +IFN DC10P,[ + MOVE TT,QTRAN(Q) +QREC0: DPB TT,[DUNFLD+QRECAL] + SETOM QRCAL(TT) + SETOM QSKT1(TT) + CLEARM QSPPS(TT) + CLEARM QPOSGL(TT) + SETOM QPOS(TT) + MOVEI T,10. ;5-SECOND RECALIBRATE TIMEOUT + MOVEM T,QRCTIM(TT) + DATAO DC0,QRECAL + CONO DC0,DCSET+DCATEB+DSKCHN ;ENABLE ATTENTION +] +IFN RP10P,[ + DPB Q,[DUNFLD+QRECAL] + SETOM QPOS(Q) + DATAO DPC,QRECAL + CLEARM QSPPS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) ;INDICATE RECALIBRATING THIS DISK + CLEARM QPOSGL(Q) +] +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Clear errors + MOVEI A,%HMREC + PUSHJ P,RHCMD ; Recalibrate + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR + PUSHJ P,RHSET ;CLEAR ERROR OUT OF DRIVE. + MOVSI A,%HRDCL(Q) + HRRI A,%HMREC ;RECALIBRATE + PUSHJ P,RHSET ;MAYBE SHOULD TRY OFFSET FIRST? + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] + SETOM QSDU + JRST QINT1 ;LOOK FOR SOME OTHER TRANSFER + +QHE2: SKIPL QSCRW(C) ;HANG UP OR POSITIONING ERR (AFTER 5 TRIES) + JRST QERV3 ;IF READ, PERFORM RECOVERY + +QPE2D: MOVSI R,%QAPAR ;IRRECOVERABLE ERROR + IORM R,QSRAC(C) + AOS QIRRCV + MOVE D,QSGL(C) + MOVEM D,QIRCBK ;BLOCK # AT IRRCV ERR + MOVEM Q,QIRUNT ;SAVE UNIT TOO + CAILE C,NQCHN + AOS NIRSWE ;# IRRCV SWAPPING ERRS + MOVE I,Q + SKIPGE QTUTO(I) + JRST QPE2E ;DON'T MESS WITH LOCKED TUT + PUSHJ P,TUTPNT + CAIN B,TUTLK ;PRINT MESSAGE IF NOT YET LOCKED OUT + JRST QINTI + MOVEI B,TUTLK + DPB B,D +QPE2E: BUG INFO,[DSK: IRREC DATA ERR #],DEC,QIRRCV,[UNIT=],DEC,QIRUNT,[BLK=],OCT,QIRCBK + JRST QINTI + +QUDER1: MOVEI R,1(Q) ;TRY TO READ DIR FROM OTHER DISKS +QUDER2: CAIL R,NQS + MOVEI R,0 + CAME R,QDSKN(C) + JRST QUDER4 + JRST QDE1 ;NO OTHER DISK AVAIL TO READ FROM, TRY AGAIN + +QUDER4: SKIPGE QACT(R) + AOJA R,QUDER2 + HRRZM R,QDSKN(C) ;TRY THIS DISK +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QSDU1 ;FREE DRIVE FORMERLY HACKING + SETOM QTUNT1 + JRST T3UDE4 ] +];T300P +IFE DC10P, SETOM QSKT1(Q) ;FREE DRIVE FORMERLY HACKING +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] + SETOM QSDU + SETOM QTUNT +IFN T300P,T3UDE4: + MOVE E,QSGL(C) + MOVE Q,QDSKN(C) + SETZM QERRS(C) + JRST QINT5 + +QIDRCH: MOVE TT,QDIRP(C) ;CHNL IN C PNTR TO QSNUD IN J LOAD NEXT CHR INTO A + AOS QDIRP(C) ;ALSO RET BYTE PNTR IN TT + IDIVI TT,UFDBPW + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(J) + ADDI TT,UDDESC(I) + LDB A,TT + POPJ P, + +QMPDCH: MOVE TT,QDIRP(A) ;CHNL IN A PNTR TO QSNUD IN H LOADS NEXT CHR IN R + AOS QDIRP(A) ;USED AT M.P. LEVEL +QMPDC1: IDIVI TT,UFDBPW ;ALSO RETN BYTE PNTR IN TT + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(H) + ADDI TT,UDDESC(I) + LDB R,TT + POPJ P, + +;REACHED EOF ON READ +QEOF: SOS QDIRP(C) ;AVOID GC UNHAPPINESS + MOVSI I,%QAEFR + IORM I,QSRAC(C) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + AOS QSBFS(C) ;TO UNHANG M.P. WHICH IS WAITING FOR BUF TO APPEAR + JRST QINT2C + +QINT4C: +IFN DMDSK,[ + MOVSI E,%QAFNY + ANDCAM E,QSRAC(C) + TRZE A,20 ; FUNNY FILE BLOCK + IORM E,QSRAC(C); INDICATE SO +] + MOVEI E,0 + DPB A,[140500,,E] + PUSHJ P,QIDRCH + DPB A,[060600,,E] + PUSHJ P,QIDRCH + DPB A,[0600,,E] + MOVEM E,QSLGL(C) + JRST QINT4G + +;DECODE UNBYTE SPEC IN D. +;RETURNS BYTE SIZE IN D, NUMBER OF UNUSED BYTES IN LAST WORD IN E. +QBDCD: TRZE D,400 + JRST [ IDIVI D,100 ? POPJ P, ] + TRZE D,200 + JRST [ IDIVI D,20 ? POPJ P, ] + SUBI D,44 + JUMPGE D,[ IDIVI D,4 ? POPJ P, ] + MOVNS D + SETZ E, + POPJ P, + +;ENCODE BYTE SIZE IN Q AND RESIDUE IN R INTO UNBYTE SPEC IN RH(Q) +QBENC: CAIG Q,3 + JRST [ IMULI Q,100 ? ADDI Q,400(R) ? POPJ P, ] + CAIG Q,7 + JRST [ IMULI Q,20 ? ADDI Q,200(R) ? POPJ P, ] + CAIG Q,18. + JRST [ IMULI Q,4 ? ADDI Q,44(R) ? POPJ P, ] + MOVNI Q,-44(Q) + POPJ P, + +QINT3: SKIPL DWUSR + JRST QINT3X ;DIR CHNL IN USE +IFN T300P,[ + SKIPGE QSDU ;DON'T GET PAST HERE UNLESS BOTH CONTROLLERS ARE IDLE + SKIPL QSDU1 + JRST QINT3X +];T300P + AOSL QDWFAR + JRST [ MOVNI H,10. + MOVEM H,QDWFAR + JRST .+3 ] + SKIPG QACTTM ;LAST ACTIVITY TOO RECENT + JRST QUDW + SKIPGE H,QMDRO + JRST QTDW + MOVE J,QACTB + TDNN J,H + JRST QTDW + MOVSI Q,-NQS +QMDW: SKIPGE QACT(Q) + JRST QMDWA ;UNIT NOT ACTIVE + MOVE J,DCHBT(Q) + TDNN J,QMDRO + JRST QMDWA + HRLI Q,(SETZ) ;INDICATE MFD WRITE IN PROGRESS + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMMDW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QMDRO + MOVE C,MDCHK(TT) + CAME C,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + HRRZ C,Q + CAMN C,MDSK + AOSA C,QAMDNO + MOVE C,QAMDNO + MOVEM C,MDNUM(TT) + SETZM DWUSR + MOVEI TT,MFDBLK + MOVEM TT,QSGL+NQCHN + HRRZ TT,QMDRO + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QMDWA: AOBJN Q,QMDW +QTDW: SKIPG QACTTM + JRST QUDW + MOVSI Q,-NQS +QTDW1: SKIPGE QACT(Q) + JRST QTDWA + MOVE J,DCHBT(Q) + SKIPL QTUTO(Q) + TDNN J,QTUTO(Q) + JRST QTDWA + MOVSI H,240000 + TDNE H,QTUTO(Q) + JRST QTDWA1 + MOVE TT,TIME ;DON'T WRITE TUTS TOO OFTEN + SUB TT,QTWRTM(Q) ;BECAUSE THE TUT IS LOCKED WHILE IT'S BEING WRITTEN + CAIGE TT,100. + JRST QTDWA + ADDM TT,QTWRTM(Q) + HRLI Q,200000 + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMTTW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QTUTO(Q) + MOVE H,QPKNM(Q) ;VERIFY THAT TUT IS NOT BEING CLOBBERED + MOVE C,QPKID(Q) + CAMN H,QPAKID(TT) + CAME C,QPKNUM(TT) + BUG HALT,[TUT ],DEC,Q,[CLOBBERED] + SETZM DWUSR + MOVEI TT,MFDBLK ;INITIATE WRITING OF FIRST BLOCK OF TUT + SUB TT,NTBL(Q) + MOVEM TT,QSGL+NQCHN + LDB TT,[121000,,QTUTO(Q)] + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QTDWA1: ANDCAM J,QTUTO(Q) +QTDWA: AOBJN Q,QTDW1 +QUDW: MOVSI C,-QNUD +QDW4A: MOVE J,QACTB ;BITS CORRESP TO ACTIVE DISKS +QDW4: SKIPE TT,QSNUD(C) + SKIPGE QSNLCN(C) + JRST QDW3 ;SLOT VACANT OR LOCKED + TDNE J,QSNLCN(C) + JRST QUDW1 ;NEEDS TO BE WRITTEN ON SOME UNIT +QDW3: AOBJN C,QDW4A +QINT3X: ;HERE IF DISK GOING IDLE. CLEAR DONE FLAG. + ;IN 2-CONTROLLER CASE, MAKE SURE WE ONLY DO IT TO THE RIGHT CONTROLLER. +IFN T300P,[ + SKIPL QSDU + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW +] ;T300P +IFN DC10P, CONO DC0,DCCLR+DCIENB+DSKCHN +IFN RP10P, CONO DPC,177710+DSKCHN ;MUST CLEAR "DONE" +IFN RH10P, CONO DSK,%HOCLR+%HOATN+%HORAE+DSKCHN +IFN RH11P, ;; RH11 doesn't need this? + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW + +QUDW1: MOVSI J,%QUDWM ;WRITE RIGHT AWAY IF %QUDWM IS ON + TDNN J,QSNLCN(C) + SKIPE QSFBT(C) ;OR DISK BLOCKS (AND CORE) WAITING TO BE FREED + JRST QUDW6 + SKIPG QACTTM ; ACTIVITY TOO RECENT + SKIPN QSNNR(C) ; THEN ONLY WRITE IF NOTHING POINTING TO DIRECTORY + SKIPA + JRST QDW3 + MOVSI Q,-NQS +QUDW4: SKIPGE QACT(Q) + JRST QUDW3 + MOVE J,DCHBT(Q) + TDNE J,QSNLCN(C) + JRST QUDW2 +QUDW3: AOBJN Q,QUDW4 + JRST QDW3 + +QUDW6: ANDCAM J,QSNLCN(C) ;TURN OFF %QUDWM + MOVE Q,MDSK ;AND WRITE ON MASTER DISK (ASSUME MDSK IS ACTIVE AND BIT IN QSNLCN IS SET) + +QUDW2: MOVE I,QMDRO + TLNE I,40000 ;IS THIS CODE OBSOLETE? LEFT FROM DAYS OF 1 MFD PER DRIVE? + JRST QUDW2B ;MASTER DIR NOT IN + HRRZS Q + CAMN Q,MDSK ;SKIP IF NOT WRITING ON MASTER DISK + PUSHJ P,QDIRCK ;BLESS THIS UFD!!! + MOVSI TT,(SETZ) + IORB TT,QSNLCN(C) ;LOCK USER DIRECTORY + MOVEI J,%QMUDW + HRRZM J,QSRAC+NQCHN + MOVE A,1(TT) ;NAME AREA PTR + MOVE J,QSNUD(C) + CAMN J,UDNAME(TT) ;MAKE SURE NOT ABOUT TO WRITE BAD DIRECTORY + CAILE A,2000 + JSP TT,QUDCLB + SUBI A,11. + IMULI A,6 + SKIPL J,(TT) + CAMLE J,A ;FS PTR BAD? + JSP TT,QUDCLB + CLEARM DWUSR + MOVEM Q,DWSKN + MOVE TT,QSNMI(C) + MOVEM TT,QSGL+NQCHN + HRRZ TT,QSNLCN(C) + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + HRRZM C,QDWIP + CLEARM QERRS+NQCHN + JRST QINT1 + +QUDW2B: ANDCAM J,QSNLCN(C) ;CLEAR BIT + GO AWAY + JRST QUDW3 + +;GENERALLY GET HERE BY JSP TT, +QUDCLB: BUG HALT,[DIR ],OCT,C,SIXBIT,QSNUD(C),[CLOBBERED] + +QDIRCK: PUSH P,TT ;CHECKS FILES FOR REASONABLE DESCRIPTORS - + ; PRECEDING BYTE =0, FIRST BYTE NOT=0 + HRRZ A,QSNLCN(C) + MOVEI B,1777(A) ;END OF NAMES + ADD A,1(A) ;BEGIN NAMES +QDIRC1: CAMG B,A + JRST POPTTJ ;DONE + SKIPN (A) + JRST QDIRC2 ;0 NAME=NO FILE + LDB TT,[1500,,UNRNDM(A)] ;DESC PTR + SOS TT ;TRICK - IF DESC PTR = 0 LDB BELOW GETS 0 BECAUSE P FIELD = 44 + IDIVI TT,6 + HLL TT,SBTBL(I) ;BYTE POINTER + ADDI TT,UDDESC-1777(B) + LDB I,TT + JUMPN I,QUDCLB + ILDB I,TT + JUMPE I,QUDCLB +QDIRC2: ADDI A,LUNBLK + JRST QDIRC1 + +IFN RP10P,[ +QPOSR: CAIL E,MBLKS + BUG ;TOO BIG EVEN FOR RP03 +IFN DMDSK,[ + IMULI E,SECBLK + IDIVI E,NSECS + SETZM D + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + DPB Q,[DUNFLD+D] +] +IFE DMDSK,[ + MOVEI D,0 + IDIVI E,NBLKSC + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + MOVE E,TT + IMULI E,NSSECS + IDIVI E,NHSECS + DPB E,[DSURF+D] + DPB TT,[DSECT+D] + DPB Q,[DUNFLD+D] +] + MOVE E,D + POPJ P, +] +IFN RH10P+RH11P,[ +IFE DMDSK, .ERR CHANGE QPOSR FOR 9-SECTOR BLOCKS! +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NBLKSC + HRLZ D,E ;CYLINDER IN LH + MOVEM E,QSPPS(Q) + MOVE E,TT + IMULI E,SECBLK + IDIVI E,NSECS + LSH E,8 + IOR E,D ;SURFACE IN 1.9-2.4 + IOR E,TT ;SECTOR IN 1.1-1.5 + POPJ P, +] ;RH10P+RH11P + +IFN DC10P,[ +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NSECS + MOVSI D,(DUNENB) + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + SKIPGE TT,QTRAN(Q) + ADDI E,NCYLS+XCYLS + DPB E,[DCYL+D] + MOVEM E,QSPPS(TT) + MOVE E,D + DPB TT,[DUNFLD+E] + DPB TT,[DUNFLD+QCHPRG] + SKIPGE TT,QPKID(Q) + JRST QPOSRI + DPB TT,[DPKID+E] + POPJ P, + +QPOSRI: MOVE TT,QTRAN(Q) ;NEED PACK ID BEFORE PROCEEDING + DPB TT,[DUNFLD+GPKID] + SETOM QSKT1(TT) + MOVEI A,TUTCYL + SKIPGE QTRAN(Q) + ADDI A,NCYLS+XCYLS + DPB A,[DCYL+GPKID] + MOVEM A,QPOS(TT) ;WILL SEEK TO HERE AUTOMATICALLY + MOVEM A,QPOSGL(TT) + DATAO DC0,[DJMP GPKID] + MOVEM Q,QSDU + SETOM PKIDM + JRST QINTX + +QSPKID: CONSZ DC1,1777 + BUG ;ERRORS + LDB TT,[DPKID+RPKID] + MOVEM TT,QPKID(Q) + SETOM QSDU + JRST QINT1 +] + +SUBTTL DISK IOT ROUTINES + +OVHMTR UUO ;MORE RANDOM UUOS + +;BECAUSE .ACCESS MERELY DROPS ITS ARG IN A VARIABLE AND SETS %QAACC, +;ALL IOT ROUTINES MUST TEST %QAACC AND DO THE REAL WORK OF CHANGING +;THE ACCESS POINTER IF NECESSARY. + +QBO: MOVEI T,BLKT + JRST QUO1 + + SKIPA T,[SIOKT] +QUIO: +QUAO: MOVEI T,CHRKT +QUO1: PUSH P,T + PUSH P,TT + PUSH P,D + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBWRA1 ;RANDOM ACCESS MODE HACK + POP P,D + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKT, SIOKT, OR BLKT +QBOV: SETZ QSMPRP(A) + QSMPRC(A) + QSBWG + SETZ QSBWW + JRST QOCL + TRNA + +QBI: MOVEI T,BLKT + JRST QUI1 + + SKIPA T,[SIOKT] +QUII: +QUAI: MOVEI T,CHRKTI +QUI1: PUSH P,T + PUSH P,TT + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBRRA1 + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKTI, SIOKT, OR BLKT +QBIV: QSMPRP(A) + QSMPRC(A) + QSBGB + QSBRB + JRST QICL + SKIPG QSBFS(A) + +QBWRA1: TLNE T,%QALNK + JRST IOCR10 + LDB T,[$QAMOD,,QSRAC(A)] ;SET RANDOM ACCESS PNTRS ON WRITE + SOJN T,QBWRA2 ;IN ORDINARY WRITE MODE + SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO BECOME IDLE OR HANG UP IN READ + PUSHJ P,UFLS ; WAITING FOR %QAACC TO TURN OFF + SKIPL QSGL(A) + PUSHJ P,UFLS + SKIPGE QSMDN(A) + JRST QBWRA2 + MOVE T,QRADAD(A) ;DESIRED ADDRESS + SUB T,QFBLNO(A) ;ACTUAL ADDRESS OF BEG OF CURRENT BUFFER + JUMPL T,QBWRA2 ;XFER ON BEFORE CURRENT BLOCK + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER IN BYTES + JUMPL T,QBWRA3 ;SAME BLOCK AS NOW +QBWRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QSOCL5 ;CLEAR ANY CURRENT BUFFERS ETC + PUSHJ P,QUDULK + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR ;LOCKS DIR IF SKIPS + JRST QBWRA4 ;OFF END OF FILE +QBWRA5: PUSHJ P,QUDULK +QBWRA9: POP P,C + POP P,I + POP P,R + CLEARM QSCRW(A) ;SWITCH TO WRITE OVER MODE + MOVSI Q,%QAMPU+%QAMWO ;SET UPDATE ADR AND WRITE OVER + IORM Q,QSRAC(A) + CLEARM QSMPRC(A) + MOVSI Q,%QAEFR+%QAEFW+%QAACC ;CLEAR EOF, WRITE EOF, AND ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD1 ;AND READ IN THE CURRENT BLOCK + HRRM Q,QSRAC(A) + POPJ P, + +QBWRA4: JUMPE Q,QBWRA0 + CAME J,Q ;MIGHT BE ADDING TO END OF FULL BLOCK + JRST IOCER2 + JRST QBWRA9 + +QBWRA0: PUSHJ P,QLWO ;OFF END OF FILE AND WAS ACCESSING WD 0 + MOVSI C,%QAACC ;SO SWITCH TO NORMAL WRITE MODE AND + ANDCAM C,QSRAC(A) ;TURN OFF RANDOM ACCESS BIT + POP P,C + POP P,I + POP P,R + POPJ P, + +QBWRA3: SKIPGE TT,QSMDN(A) + BUG ;NO BUFFER REALLY ACTIVE AT M.P. + MOVSI J,%QAWOV + TDNN J,QSRAC(A) + JRST QBWRA7 + ANDCAM J,QSRAC(A) ;WAS WRITING IN LAST BLK PAST EOF, + MOVN D,QSMPRC(A) ; UPDATE ACTIVE BYTE COUNT + ADDM D,QMPBSZ(A) ;DECREASE SIZE OF BUFFER TO AMT ACTUALLY WRITTEN +QBWRA7: LSH TT,10. ;ADDRESS OF BUFFER + MOVE T,Q ;SAVE RELATIVE BYTE ADDR WITHIN BUFFER + IDIVI Q,@QSBYTE(A) ;Q = WDS, J = BYTES + ADD TT,Q ;ADDRESS OF DESIRED WORD + HLL TT,QSBYTE(A) ;BYTE POINTER TO FIRST BYTE IN THAT WORD + JUMPE J,.+3 ;ADVANCE TO APPROPRIATE BYTE + IBP TT + SOJG J,.-1 + MOVEM TT,QSMPRP(A) + SUB T,QMPBSZ(A) ;MINUS # BYTES LEFT IN BLOCK + MOVNM T,QSMPRC(A) +QBRRA4: MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) + POPJ P, + +QSKFRC: MOVN B,QSMPRC(A) + ADD B,QMPBSZ(A) ;NUMBER OF BYTES WRITTEN IN BLOCK + MOVE C,QSRAC(A) + TLNE C,%QAMWO + TLNE C,%QAWOV + JRST [MOVEM B,QMPBSZ(A) ;IS LAST BLOCK, CHANGE LENGTH + PUSHJ P,QOCLPD ;AND PAD IT (GUARANTEED NO-OP IF WORD MODE CHNL) + JRST .+1 ] + SETZM QSMPRC(A) ;BUFFER WILL BE DISPOSED OF + MOVSI E,%QUDWM + SKIPGE QSMDN(A) + SETZB B,E ;NO BUFFER AFTER ALL + ADD B,QFBLNO(A) ;CURRENT POSITION IN FILE + MOVSI C,%QAACC + TDNN C,QSRAC(A) + MOVEM B,QRADAD(A) ;ACCESS BACK ON NEXT IOT + IORB C,QSRAC(A) + PUSHJ P,[TLNE C,%QAWOV ;WRITE OUT THE BUFFER + JUMPN E,QSBWO2 + JRST QSBWW ] + SKIPE QMPTC(A) + MOVSI E,%QUDWM + PUSHJ P,QOCL2 ;STORE QMPTC IF NECESSARY + IORM E,QSNLCN(H) ;WRITE OUT DIR FAST IF CHANGED + PUSHJ P,QUDULK + JRST POPJ1 + +;.CALL FINISH ON DISK OUTPUT CHANNEL +QSKFIN: HRRZ T,QSRAC(A) + CAIN T,%QMWOV ;IF WRITE-OVER MODE + JRST [ SKIPE QSCRW(A) ;THEN WAIT FOR IT TO SWITCH TO READ MODE + PUSHJ P,UFLS + JRST QSKFIN ] + CAIN T,%QMWRT ;IF WRITE MODE + JRST [ SKIPE QSBFS(A) ;THEN WAIT FOR ALL BUFFERS TO GET WRITTEN + PUSHJ P,UFLS + JRST .+1 ] + MOVE H,QUDPR(A) + MOVE T,MDSK ;HAS THE DIR BEEN CHANGED AND NOT WRITTEN + MOVE T,DCHBT(T) ;YET TO THE MASTER DISK? + TDNN T,QSNLCN(H) + JRST POPJ1 + MOVSI TT,%QUDWM ;YES, WRITE IT OUT IMMEDIATELY + IORM TT,QSNLCN(H) ;AND DON'T RETURN UNTIL IT IS WRITTEN + TDNE T,QSNLCN(H) + PUSHJ P,UFLS + JRST POPJ1 + +QBRRA1: TLNE T,%QALNK + JRST IOCR10 + SKIPGE QSMDN(A) + JRST QBRRA2 ;NO MAIN PRGM BUFFER + MOVE T,QRADAD(A) + SUB T,QFBLNO(A) + JUMPL T,QBRRA2 + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER + JUMPL T,QBRRA3 ;SAME BLOCK AS NOW +QBRRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QICLW1 ;STOP THE CHANNEL AND FLUSH CURRENT BUFFERS + MOVE A,D + CLEARM QSBFS(A) ;FLUSH POSSIBLE EXTRA AOSES WHEN PI HIT EOF + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST QBRRA5 ;OFF END OF FILE (DIR ALREADY UNLOCKED) + POP P,C + POP P,I + POP P,R + CLEARM QSMPRC(A) + MOVSI Q,%QAMPU + IORM Q,QSRAC(A) ;SET FLAG TO SET QSMPRP AND QSMPRC ON NEXT BUFFER LOAD + MOVSI Q,%QAEFR+%QAACC ;CLEAR EOF AND .ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD ;START READING AGAIN + HRRM Q,QSRAC(A) + JRST QUDULK + +QBRRA5: POP P,C + POP P,I + POP P,R + CAME J,Q + JRST IOCER2 ;ACCESS OFF END OF FILE IS ERROR + MOVSI TT,%QAEFR ;BUT ACCESS TO EXACTLY EOF IS OK + IORM TT,QSRAC(A) ;IMITATES WHAT QEOF DOES + AOS QSBFS(A) + SETZM QSMPRC(A) ;AND READS ZERO WORDS + JRST QBRRA4 + +QBRRA3: SKIPGE TT,QSMDN(A) + JRST QBRRA2 + JRST QBWRA7 + +;BLKT-SIOKT-CHRKT GET BUFFER ROUTINE FOR WRITE-OVER MODE. +QWOG1: SKIPGE QSCRW(A) ;FETCH BLOCK WRITEOVER MODE + JRST QWOG2 ;STILL WRITING PREVIOUS ONE, WAIT + MOVEI Q,%QMRD1 ;SWITCH INTO READ MODE + SKIPG QSBFS(A) ;IF A BUFFER HAS TO BE READ + HRRM Q,QSRAC(A) + SKIPG QSBFS(A) + PUSHJ P,UFLS + POP P,A +;BLKT-SIOKT-CHRKT GET-BUFFER ROUTINE FOR DISK INPUT. +QSBGB: MOVSI Q,%QAPAR + TDNE Q,QSRAC(A) + JRST QSBGB2 + CONO PI,UTCOFF + HRRZ Q,QBFP(A) + JUMPE Q,[MOVSI J,%QAEFR ;SAID TO BE BUFFERS, BUT NONE THERE + TDNN J,QSRAC(A) + BUG ;SHOULDN'T HAPPEN EXCEPT AT EOF + JRST QSBGB5 ] + LDB J,[MLO,,MEMBLT(Q)] + HRRM J,QBFP(A) + SKIPN J + SETZM QBFP(A) ;LAST BLOCK, LIST NOW EMPTY + HRRZ J,MEMPNT(Q) ;GET SIZE OF BUFFER IN BYTES + MOVEM J,QMPBSZ(A) + LDB TT,[$QAMOD,,QSRAC(A)] + SKIPN TT ;DONT SOS IF IN WRITE OVER MODE + SOS QSBFS(A) +QSBWG4: MOVE TT,Q + LSH TT,10. ;RETURN ADDR OF BUFFER + MOVEM Q,QSMDN(A) + CONO PI,UTCON + HLL TT,QSBYTE(A) + MOVSI Q,%QAMPU + TDNN Q,QSRAC(A) + JRST SIOBG2 + MOVE Q,QRADAD(A) ;DIDDLE PNTRS TO TAKE CARE OF RANDOM ACCESS WITHIN BLOCK + SUB Q,QFBLNO(A) ;DESIRED OFFSET WITHIN BLOCK + SUB J,Q + JUMPL J,IOCER2 ;OFF END OF FILE + JUMPL Q,IOCER2 ;OFF FRONT OF FILE (NEGATIVE .ACCESS PNTR) + PUSH P,J + IDIVI Q,@QSBYTE(A) + ADD TT,Q ;ADJUST BYTE POINTER + JUMPE J,.+3 + IBP TT + SOJG J,.-1 + POP P,J + MOVSI Q,%QAMPU ;NOW IS SAFE TO TURN OFF FLAG + ANDCAM Q,QSRAC(A) + JRST SIOBG2 + +;GET-BUFFER DETECTED EOF ON INPUT OR WRITE-OVER. +QSBGB5: CONO PI,UTCON + MOVE Q,QSRAC(A) + TLNE Q,%QALNK + JRST IOCR10 + LDB Q,[$QAMOD,,QSRAC(A)] + SOJN Q,POPJ2 ;ON INPUT, SKIP TWICE TO SIGNAL EOF. + PUSHJ P,QLWO ;LEAVE WRITE OVER MODE + JRST QSBWG ;START NORMAL WRITE + +QWOG2: SKIPGE QSCRW(A) ;WAIT FOR WRITE TO FINISH + PUSHJ P,UFLS + JRST POPAJ ;NOW RECYCLE AND WAIT FOR READ + +;LEAVE WRITE OVER MODE +QLWO: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + CONO PI,UTCOFF + SETZM QBFP(A) ;WRITEOVER MODE EXTEND FILE (SWITCH TO NORMAL MODE) + CLEARM QSBFS(A) + SETOM QSCRW(A) + MOVE Q,QSLGL(A) + HRRZM Q,QMPTN(A) ;STORE BASE TRACK + MOVSI Q,%QAEFR+%QAMWO ;CLEAR EOF AND WRITEOVER + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMWRT ;NORMAL WRITE MODE + HRRM Q,QSRAC(A) + CLEARM QMPTC(A) ;TRACK COUNT FOR TAKE N + SETOM QMTTR(A) ;NO TRACK RESERVED + SETOM QMFTP(A) ;GET NEW DECADE RESERVATION + CONO PI,UTCON + MOVE TT,QDIRP(A) ;SEE IF GARBAGE COLLECTION NEEDED + PUSH P,R + PUSH P,I + PUSHJ P,QMPDC1 ;CONV CHAR ADR TO BYTE PNTR (AND LDB IN R) + POP P,I + SKIPE R + BUG + MOVE R,QDIRP(A) + ADDI R,NXLBYT+2 + CAMGE R,@QSNLCN(H) + JRST QLWO1 ;DON'T NEED TO EXPAND F.S. + MOVEI R,LUNBLK(TT) + MOVE Q,QSNLCN(H) + SUBI R,(Q) + CAML R,UDNAMP(Q) + JRST QSBWG7 ;DON'T HAVE ROOM. GC + MOVEI R,3*6 ;HAVE ROOM + ADDM R,(Q) +QLWO1: +REPEAT NXLBYT+2,[ + ILDB R,TT + JUMPN R,QSBWG7 +] + JRST QSBWG8 ;OK + +QSBWG7: MOVSI R,%QAFUL ;NO ROOM, GC BEFORE COMMITTING NEXT TRACK + IORM R,QSRAC(A) +QSBWG8: POP P,R + JRST QUDULK + +QSBGB2: ANDCAM Q,QSRAC(A) ;DISK READ ERROR + JRST IOCER3 ;TELL USER + +;DISK OUTPUT GET-BUFFER ROUTINE. PRESERVES D FOR BENEFIT OF PDUMP. +QSBWG: MOVE Q,QSRAC(A) + TLNE Q,%QALNK+%QAACC ;DON'T WRITE TO LINK, DON'T LET PDUMP GET + JRST IOCR10 ; FAKED OUT BY USE FORCE OR ACCESS + PUSH P,A + TLNE Q,%QAMWO + JRST QWOG1 ;JUMP IF WRITE OVER MODE + HRRZ Q,QBFP(A) ;NORMAL MODE + JUMPE Q,QSBWG1 ;CAN ALWAYS HAVE ONE BUFFER + MOVE Q,QWBUFS + CAML Q,QWBFMX + JRST POPAJ ;TOO MANY WRITE BUFFERS QUEUED +QSBWG1: PUSHJ P,QSTWG + PUSHJ P,TCALL + JRST IOMQ + JRST QSBWG5 ;MEM FROZE OR NOT AVAILABLE + MOVE Q,(P) ;DISK CHNL # + DPB Q,[MNUMB,,MEMBLT(A)] + MOVEI Q,MU23B + DPB Q,[MUR,,MEMBLT(A)] + MOVE Q,A + POP P,A + AOS QSBFS(A) + AOS QWBUFS + HRRZ J,QSBYTE(A) + IMULI J,2000 + MOVEM J,QMPBSZ(A) ;FRESH BLOCK SIZE + JRST QSBWG4 + +QSTWG: MOVSI Q,%QAFUL + TDNE Q,QSRAC(A) ;ROUTINE TO COMMIT A TRACK + JRST QSTWG1 ;DIR FULL, NEED GC BEFORE GROWING FILE + MOVE H,QUDPR(A) ;IF THIS DIRECTORY HAS AN ALLOCATION + MOVE Q,QSNLCN(H) ; ENFORCE IT +IFN QRSRVP,[ + HRRZ J,UDALLO(Q) + JUMPE J,QSTWG0 ;NO ALLOCATION + HRRZ H,UDBLKS(Q) ;GET BLOCKS USED + CAML H,J + JRST IOCR13 ;HAS ALLOCATION AND USER IS TRYING TO EXCEED IT +] +QSTWG0: MOVE J,QDSKN(A) + SOSL QSFT(J) ;RESERVE A TRACK + POPJ P, + AOS QSFT(J) ;DISK FULL, GIVE BACK THE TRACK + SKIPE QFBTS ;WAIT FOR ANY PENDING FILE DELETIONS + PUSHJ P,UFLS ; TO COMPLETE AND FREE THEIR BLOCKS + SOSL QSFT(J) ;GOT SPACE NOW? + POPJ P, + AOS QSFT(J) ;NO, GIVE UP AND ERR OUT + JRST IOCER9 + +QSTWG1: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + PUSHJ P,QGC + JRST IOCR12 ;DIR FULL + PUSHJ P,QUDULK + ANDCAM Q,QSRAC(A) .SEE %QAFUL + JRST QSTWG + +QSBWG5: POP P,A ;GET BACK QSK CHANNEL # + MOVE J,QDSKN(A) + AOS QSFT(J) ;NO MEMORY; GIVE EVERYTHING BACK + POPJ P, + +;DISK OUTPUT RELEASE-BUFFER ROUTINE FOR BLKT, SIOKT, CHRKT. +QSBWW: SKIPGE QSMDN(A) ;WRITE BUFFER FROM MN PROG TO CHAIN FOR PI + POPJ P, ;NO WRITE BUFFER ACTIVE + LDB TT,[$QAMOD,,QSRAC(A)] + SOJE TT,QSBWO1 ;WRITE OVER MODE + SKIPL D,QMTTR(A) + JRST QTG1 ;TRACK ALREADY RESERVED + PUSH P,I + MOVE I,QDSKN(A) + PUSHJ P,QGTRK ;GET A TRACK + POP P,I + MOVEM D,QMTTR(A) +QTG1: MOVE H,QUDPR(A) ;TRACK IN D + PUSHJ P,QUDLK + MOVE TT,QSNLCN(H) + AOS UDBLKS(TT) + MOVE TT,QMPTN(A) ;GET PREVIOUS TRACK# + CAIN D,1(TT) + JRST QTG2 ;THIS TRACK IS CONSECUTIVE + SKIPN QMPTC(A) ;THIS TRACK NOT CONSEC CHECK COUNT OF PREV CONSEC BLOCKS + JRST QTG3 + PUSH P,D ;NON-ZERO SO STORE IN USER DIRECTORY + MOVE D,QMPTC(A) + CLEARM QMPTC(A) + PUSHJ P,QUDS + POP P,D +QTG3: MOVE J,QMTTR(A) ;DESCRIPTOR WILL BE STORED + MOVEM J,QMPTN(A) + SUB D,QMPTN(A) ;CAN TRACK BE SKIPPED TO? + SOJL D,QTG4 ;CAN'T BE SKIPPED TO (NOTE QMPTN HAS NOT BEEN AOS'D) + CAILE D,UDWPH-UDTKMX-1 + JRST QTG4 ;ALSO NO + ADDI D,UDTKMX ;NEXT BLOCK WITHIN N + PUSHJ P,QUDS ;STORE APPROPRIATE SKIP +QTG5A: +QTG5: MOVE Q,QSMDN(A) ;CORE BLOCK NUM BEING WRITTEN + MOVE D,QMPTN(A) ;TRACK NUM OF BLOCK ADDING TO FILE + HRLZM D,MEMPNT(Q) ;STORE TRACK NUM + SETOM QMTTR(A) ;INDICATE TRACK USED + MOVE J,QMPBSZ(A) ;LENGTH OF THIS BLOCK + ADDM J,QFBLNO(A) ;INCR BYTE ADR OF START OF CURRENT BLOCK IN FILE + HRRM J,MEMPNT(Q) ;SAVE BYTE COUNT + PUSH P,R + IDIVI J,@QSBYTE(A) ;CONVERT TO WORD COUNT + JUMPE R,QTG7 ;EXACT MULTIPLE OF WORD + AOS J + MOVNS R + ADDI R,@QSBYTE(A) ;# BYTES RESIDUE IN LAST WORD +QTG7: DPB J,[MWC,,MEMBLT(Q)] ;STORE ACTIVE WORD COUNT + MOVE D,QSRAC(A) + LDB TT,[$QAMOD,,QSRAC(A)] + TLNN D,%QALBK ;LAST BLOCK OF WRITE OVER POSSIBLY + SOJE TT,QTG6 ;WRITEOVER MODE AND NOT LAST BLOCK, DONT UPDATE LAST BLOCK WORD COUNT + MOVE H,QUDPR(A) ;SET UP DIRECTORY CHANNEL + MOVE D,QUDFPR(A) + ADD D,QSNLCN(H) + DPB J,[UNWRDC+UNRNDM(D)] ;SET WORD COUNT OF LAST BLOCK + LDB Q,[QSBSIZ(A)] + PUSHJ P,QBENC ;ENCODE BYTE CRUFT + DPB Q,[UNBYTE+UNREF(D)] + MOVE J,QACTB + IORM J,QSNLCN(H) +QTG6: POP P,R + PUSHJ P,QUDULK + MOVE Q,QSMDN(A) + MOVEI J,.BM MLO + ANDCAM J,MEMBLT(Q) ;SET END OF LIST INDICATOR IN MEMORY BLOCK + CONO PI,UTCOFF + HLRZ J,QBFP(A) ;STORE MEMORY BLOCK IN OUTPUT LIST + JUMPE J,QSBWW1 + DPB Q,[MLO,,MEMBLT(J)] +QSBWW2: HRLM Q,QBFP(A) + CONO PI,UTCON + SETOM QSMDN(A) ;MN PROG BUFFER NOW WRITTEN + JRST QSTRTR ;START ACTION IF 2311 IDLE AND RETURN + +QSBWO1: MOVE Q,QSRAC(A) ;PUT BUFFER IN WRITE-OVER MODE + TLNE Q,%QALBK ;IF NOT HACKING LAST BLOCK + TLNE Q,%QAEFW ;OR HACKING CLOSE + JRST QSBWO2 ;THEN JUST WRITE IT + HRRZ D,QSBYTE(A) + IMULI D,2000 + SUB D,QMPBSZ(A) + JUMPE D,QSBWO2 ;BLOCK REALLY FULL + TLNE Q,%QAMPU ;DID WE IOCER2 AT QSBWG4? + JRST IOCER2 ;YES, QSMPRP NOT SET UP, DON'T WRITE ANYTHING + MOVEM D,QSMPRC(A) ;LAST BLOCK NOT REALLY USED UP ("SPRUNG BACK TO LIFE") + ADDM D,QMPBSZ(A) ;EXTRA ROOM IN LAST BLOCK TO FILL UP + MOVSI D,%QAWOV + IORM D,QSRAC(A) ;FILLING LAST BLK PAST ORIG EOF + POPJ P, ;FINISH OUT BLOCK + +QSBWO2: MOVSI D,%QAWOV + ANDCAM D,QSRAC(A) + MOVE D,QSLGL(A) ;WRITE TRACK BACK WHERE IT CAME FROM + MOVEM D,QMPTN(A) ;PUT TRACK NO WHERE QTG5 CAN FIND IT + MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SETOM QSCRW(A) ;SWITCH TO WRITE MODE + MOVEI Q,%QMWOV + HRRM Q,QSRAC(A) + JRST QTG5 + + +QTG4: LDB D,[140500,,QMTTR(A)] ;WRITE LOAD ADDRESS + IORI D,40 + PUSHJ P,QUDS + LDB D,[060600,,QMTTR(A)] + PUSHJ P,QUDS + LDB D,[0600,,QMTTR(A)] + PUSHJ P,QUDS + JRST QTG5A + +QGTRK: PUSHJ P,QTLOCK ;GET TRK CHNL IN A DSK IN I RET IN D CLOBBERS E,TT,Q,J,B +QGTK4: PUSH P,R ;ENTER HERE FROM SWAP OUT WITH UTCOFF + PUSH P,B + PUSH P,E + HRRZ R,QTUTO(I) +QGTK4A: SKIPGE Q,QMFTP(A) + JRST QGTK3A ;FIRST TRACK + IDIVI Q,DECADE + HRREI J,-DECADE(J) ;COMPUTE TRACKS REMAINING IN DECADE + MOVE D,QMFTP(A) + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + MOVE TT,QMFTP(A) + EXCH D,TT +QGTK3: CAML D,QLASTB(R) + JRST QGTK3A ;REACHED END OF DISK + ILDB Q,TT + JUMPE Q,QGTK2 + AOJGE J,QGTK3A ;DECADE OUT + AOJA D,QGTK3 + +QGTK3A: CAILE A,NQCHN + JRST QGTK3C ;SWAP CHANNEL +QGTK3D: MOVEI Q,DECADE + ADDB Q,QTUTP(R) +QGTK3B: MOVEM Q,QMFTP(A) + CAMGE Q,QLASTB(R) + JRST QGTK4A + MOVE Q,QSWAPA(R) ;REACHED END OF DSK, RESET TO END OF SWAPPING AREA + ADDI Q,DECADE-1 ;ROUND UP TO A MULTIPLE OF A DECADE + IDIVI Q,DECADE + IMULI Q,DECADE + MOVEM Q,QTUTP(R) + JRST QGTK3B + +QGTK2: MOVEI B,1 + DPB B,TT + MOVEM D,QMFTP(A) + MOVE J,DCHBT(I) + IORM J,QTUTO(I) + POP P,E + POP P,B + POP P,R + CAILE A,NQCHN + POPJ P, ;CALLED FROM SWAP OUT + JRST QTULK + +QGTK3C: CAML D,QSWAPA(R) + JRST QGTK3D ;IN NON-SWAP AREA + AOS D + CAMN D,QSWAPA(R) + MOVEI D,NUDSL + MOVEM D,QMFTP(A) + JRST QGTK4A + ;STORE CHR IN D CHNL IN A USER DIR PNTR IN H +;CANNOT PCLSR NOR GC + +QUDS: PUSH P,I + PUSH P,Q + MOVE I,QDIRP(A) + CAIGE I,2000*UFDBPW + CAML I,@QSNLCN(H) ;UDESCP + BUG ;WRITING ABOVE F.S. PNTR? + AOS QDIRP(A) + IDIVI I,UFDBPW + MOVE Q,QBTBL(Q) + ADD Q,I + SKIPL I,QSNLCN(H) + BUG ;UFD WAS NOT LOCKED + ADDI Q,UDDESC(I) + LDB I,Q + CAIE I,UDWPH ;OK TO CLOBBER UDWPH (NORMALLY DOES AT START OF FILE) + JUMPN I,[JRST 4,.] ;ABOUT TO CLOBBER SOMETHING IN UFD + DPB D,Q + ILDB I,Q ;MAKE SURE FILE DESC WILL ALWAYS BE FOLLOWED BY ZERO + SKIPE I + BUG +REPEAT NXLBYT+2,[ ;MAKE SURE THERE'S ROOM FOR ONE MORE TRACK + ILDB I,Q + JUMPN I,QUDS1 +] + MOVE I,QDIRP(A) + ADDI I,NXLBYT+2 + CAMGE I,@QSNLCN(H) ;UDESCP + JRST QUDSX ;DESC AREA NOT COLLIDING WITH LIM OF DESC SPACE + MOVEI Q,LUNBLK(Q) + MOVE I,QSNLCN(H) + SUBI Q,(I) + CAML Q,UDNAMP(I) + JRST QUDS1 ;NO ROOM. + MOVEI Q,3*UFDBPW ;EXPAND DESC AREA + ADDM Q,UDESCP(I) + JRST QUDSX + +QUDS1: MOVSI Q,%QAFUL ;NEED GC BEFORE STARTING ON NEXT TRACK + IORM Q,QSRAC(A) +QUDSX: MOVE Q,QACTB + IORM Q,QSNLCN(H) ;SET DIRECTORY CHANGED + POP P,Q + POP P,I + POPJ P, + +QSBWW1: HRRM Q,QBFP(A) + JRST QSBWW2 + +QSBRB1: MOVE A,D +QSBRB: PUSH P,A + SKIPGE A,QSMDN(A) + JRST POPAJ + PUSHJ P,MEMR + POP P,A + HRRZ TT,QMPBSZ(A) + ADDM TT,QFBLNO(A) ;INCREMENT BYTE ADR IN FILE OF BEG OF NEXT BLOCK + SETOM QSMDN(A) + JRST QSTRTR + +QTG2: MOVE J,QMTTR(A) ;INDICATE WE WILL STORE DESCRIPTOR FOR NEXT TRACK. + MOVEM J,QMPTN(A) + AOS D,QMPTC(A) ;NEXT BLOCK IS CONSECUTIVE + CAIGE D,UDTKMX + JRST QTG5A + SETZM QMPTC(A) ;MAX # CONSECUTIVE BLOCKS, STORE DESC NOW + PUSHJ P,QUDS + JRST QTG5A + +SUBTTL DIRHNG DEVICE + +;WHENEVER THE DIRECTORY SPECIFIED AS THE SNAME WHEN DIRHNG IS OPENED +;IS MODIFIED, YOU GET AN INTERRUPT ON THE DIRHNG DEVICE CHANNEL. + +;HERE TO OPEN THE DIRHNG DEVICE. IOCHNM ADDR IN R, SNAME IN USYSN1(U). +DIRHO: MOVE C,USYSN1(U) + PUSHJ P,QFL ;LOOK UP THIS DIRECTORY + JRST OPNL20 ;CALL FAILS IF DIRECTORY DOES NOT EXIST. + HRRZM J,IOCHST-IOCHNM(R) ;DIR EXISTS; STORE TRACK NUMBER IN IOCHST. +DIRHP1: CONO PI,CLKOFF + HLLZ A,DIRHNG ;ADD THIS CHANNEL'S IOCHNM TO THE LIST OF DIRHNG CHANNELS. + HRRI A,DNDIRH + MOVEM A,(R) ;SET UP THE IOCHNM WITH IOTTB INDEX AND LIST CHAIN. + HRLZM R,DIRHNG + JRST CLKOJ1 + +;CLOSE A DIRHNG DEVICE CHANNEL. +DIRHCL: PUSHJ P,DIRHPS ;REMOVE IT FROM THE LIST, AND + SETZM (R) ;MARK IT CLOSED. + POPJ P, + +;IOPUSH A DIRHNG DEVICE CHANNEL. REMOVE IT FROM THE LIST OF ALL SUCH. +DIRHPS: MOVEI A,DIRHNG + CONO PI,CLKOFF +;FIND THE PLACE THAT POINTS AT THIS IOCHNM WORD. +DIRHC1: HLRZ B,(A) + CAIN B,(R) + JRST DIRHC2 + SKIPN A,B ;END OF LIST REACHED => + BUG ;THIS IOCHNM ISN'T IN THE LIST. BUT IT IS SUPPOSED TO BE! + JRST DIRHC1 + +;A POINTS AT IOCHNM THAT POINTS AT THIS ONE. PATCH THIS ONE OUT OF LIST. +DIRHC2: HLRZ B,(B) ;THE ONE AFTER THIS ONE + HRLM B,(A) + JRST CLKONJ + +;IOPUSH OR IOPOP THE DIRHNG CHANNEL WITH R -> IOCHNM WORD. I SAYS WHICH OPERATION. +DIRHIP: JUMPE I,DIRHPS ;IOPUSH REMOVES CHANNEL FROM LIST OF ALL DIRHNG CHANNELS. + +;IOPOP A DIRHNG DEVICE CHANNEL. JUST LIKE OPENING IT EXCEPT THAT +;THE DIRECTORY TRACK NUMBER IS ALREADY IN THE IOCHST. +;ALSO, WE SHOULD GIVE AN INTERRUPT NOW, +;IN CASE THE DIRECTORY WAS WRITTEN IN WHILE THE CHANNEL WAS PUSHED. +DIRHPP: PUSHJ P,DIRHP1 ;FIRST, REOPEN THE CHANNEL. LINK IT INTO THE DIRHNG LIST. + BUG + MOVE A,R + SUBI A,IOCHNM(U) ;COMPUTE CHANNEL NUMBER FROM IOCHNM WORD ADDRESS. + MOVE A,CHNBIT(A) ;GET BIT CORRESPONDING TO CHANNEL. + AND A,MSKST2(U) ;GIVE THE INT IF THE INT IS ENABLED. + IORM A,IFPIR(U) + POPJ P, + +;HERE WITH A/ DIRECTORY'S TRACK NUMBER (AS RETURNED BY QFL) +;TO SIGNAL A WRITE IN THAT DIRECTORY TO ALL DIRHNG DEVICES THAT ARE LOOKING. +;CLOBBERS B, C, D. +DIRSIG: CONO PI,CLKOFF + MOVEI B,DIRHNG +DIRSI0: HLRZ B,(B) ;GET IOCHNM ADDR OF NEXT DIRHNG DEVICE. + JUMPE B,CLKONJ + HRRZ C,IOCHST-IOCHNM(B) + CAIE C,(A) ;DOES IT LOOK AT THIS DIRECTORY? + JRST DIRSI0 + MOVEI C,-IOCHNM(B) ;YES => FIGURE OUT USER INDEX OF JOB IT BELONGS TO. + IDIVI C,LUBLK + IMULI C,LUBLK ;C NOW HAS USER INDEX. + MOVNI D,IOCHNM(C) + ADD D,B ;D GETS CHANNEL NUMBER + MOVE D,CHNBIT(D) + AND D,MSKST2(C) ;INTERRUPT THE USER ON THAT CHANNEL, IF IT'S ENABLED. + IORM D,IFPIR(C) + JRST DIRSI0 diff --git a/system/disk.1222 b/system/disk.1222 new file mode 100644 index 0000000..d9c72cc --- /dev/null +++ b/system/disk.1222 @@ -0,0 +1,6418 @@ +; I T S DISK SERVICE ROUTINES AND FILE SYSTEM -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +DSKVRS==.IFNM2 +IFN DC10P+RP10P+RH10P+RH11P-1, .ERR WRONG NUMBER OF DISK CONTROLLERS + +;GET DISK PHYSICAL PARAMETERS BY .INSRT'ING APPROPRIATE FILE + +IFN DC10P,[ +$INSRT DC10 +] + +IFN RP10P,[ +$INSRT RP10 +] + +IFN RH10P,[ +$INSRT RH10 +] + +IFN RH11P,[ +$INSRT RH11 +IFE KS10P, .ERR RH11 on something other than a KS10? +IFN RP06P+RM03P+RM80P-1, .ERR WRONG NUMBER OF KINDS OF DISK DRIVE +IFN RP06P,[ +$INSRT RP06 +] +IFN RM03P,[ +$INSRT RM03 +] +IFN RM80P,[ +$INSRT RM80 +] +] + +;GET FILE SYSTEM DEFINITIONS: +; MFD MASTER FILE DIRECTORY +; TUT TRACK (BLOCK) UTILIZATION TABLE +; UFD USER FILE DIRECTORY + +$INSRT FSDEFS + +IFN T300P,[ +$INSRT T300 +] + +SUBTTL MISC FILE SYSTEM CALLS + +ADMPCH: UMOVE A,(J) ;SET OR READ STATUS OF DUMP BIT OF FILE OPEN ON + ; CHNL IN AC(RH) + MOVEI T,POPJ1 ;MAKE CHNDCD SKIP RETURN IF ALL OK. + PUSHJ P,CHNDCD ;DECODE RH(A) AS CHNL NUM. + JRST ILUUO ;NO SKIP IMPLIES BAD CHNL NUM. + TLNN R,%CLSQ + JRST ILUUO ;NOT DISK CHANNEL. + PUSHJ P,QCHNLT ;DECODE THE CHNL FURTHER. + MOVSI B,400000 + TLNE A,400000 + IORM B,UNRNDM(C) + TLNE A,200000 + ANDCAM B,UNRNDM(C) + MOVE D,QACTB + TLNE A,600000 + IORM D,QSNLCN(H) + LDB A,[430100,,UNRNDM(C)] + PUSHJ P,QUDULK + JRST APTUAJ + +NRFDATE: PUSHJ P,QCHNLT ;READ FILE CREATION DATE WORD + MOVE A,UNDATE(C) +NRDM1: PUSHJ P,QUDULK + JRST POPJ1 ;STORE BACK IN USER MEM + +NSRDATE: PUSHJ P,QCHNLT ; SET REFERENCE DATE + HLRS B + DPB B,[UNREFD+UNREF(C)] + JRST NSDM1 + +NRESRDT: PUSHJ P,QCHNLT ; RESTORE REFERENCE DATE + HLRZ A,OLDRDT(R) ; WHOEVER CHOSE R IN QCHNLC SHOULD BE SHOT + DPB A,[UNREFD+UNREF(C)] + JRST NSDM1 + +NSFDATE: PUSHJ P,QCHNLT ;SET FILE CREATION DATE WORD + MOVEM B,UNDATE(C) +NSDM1: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QUDUL1: AOS (P) + JRST QUDULK + + +NRDMPBT: PUSHJ P,QCHNLT ;READ FILE DUMPED BIT + LDB A,[430100,,UNRNDM(C)] + JRST NRDM1 + +NSDMPBT: PUSHJ P,QCHNLT ;SET FILE DUMPED BIT + DPB B,[430100,,UNRNDM(C)] + JRST NSDM1 + +NLNKEDP: + PUSHJ P,QCHNLT ;RETURN NONZERO IF WE TRACED LINKS TO GET THIS FILE. + MOVE T,QSRAC(R) + LDB A,[.BP (%QALOP),T] + JRST NRDM1 + +NFILBLK:PUSHJ P,QCHNLT ;READ ALL 5 PARAMETERS OF NAME AREA + MOVE A,(C) + MOVE B,1(C) + MOVE D,3(C) + MOVE E,4(C) + MOVE C,2(C) + JRST NRDM1 ; UNLOCK DIR AND STORE ARGUMENTS + +QCHNLT: TLNN R,%CLSQ ;IS CHNL A DISK CHNL? + JRST [SUB P,[1,,1] ? JRST OPNL34] + HLRZ R,H + MOVE H,QUDPR(R) + PUSHJ P,QUDLK + MOVE C,QSNLCN(H) + ADD C,QUDFPR(R) + POPJ P, + +IFN QAUTHP,[ +ASAUTH: PUSHJ P,QCHNLT ;SET AUTHOR OF FILE + PUSH P,C + JUMPE B,ASAUT4 ;SETTING AUTHOR TO 0 + MOVE J,QSNMI(H) + CAMN B,QSNUD(H) + JRST ASAUT1 + MOVE C,B + PUSHJ P,QFL + SKIPA + JRST ASAUT1 + SETZM C + MOVEI J,5 + MOVE TT,[440600,,B] + MOVE I,[440600,,C] + ILDB D,TT + IDPB D,I +ASAUT2: ILDB D,TT + CAIG D,'Z + CAIGE D,'A + JRST ASAUT3 + IDPB D,I + SOJG J,ASAUT2 + JRST ASAUT4 + +ASAUT3: PUSHJ P,QFL +ASAUT4: SETOM J +ASAUT1: POP P,C + DPB J,[UNAUTH+UNREF(C)] + JRST NSDM1 + +ARAUTH: PUSHJ P,QCHNLT ;READ CREATOR OF FILE + LDB B,[UNAUTH+UNREF(C)] + MOVEI A,0 ;RETURN VALUE IS 0 IF UNKNOWN OR ILLEGAL AUTHOR + CAIL B,NUDSL + JRST NRDM1 + LSH B,1 + MOVEI B,2000-(B) + ADD B,QMDRO + MOVE A,(B) + JRST NRDM1 +];QAUTHP + +ASREAP: PUSHJ P,QCHNLT ;SET NO REAP BIT + DPB B,[.BP (UNREAP),UNRNDM(C)] + JRST NSDM1 + +ARQDAT: CONO PI,CLKOFF ;GET DSK TIME AND DATE + SKIPL A,QDATE + HRR A,TIMOFF + MOVE B,QDATEI ;2ND VALUE = DATE & TIME SYS CAME UP, IN DISK FORMAT. + CONO PI,CLKON + JRST POPJ1 + +ADSKUP: PUSHJ P,QCHNLT ;SET CREATION DATE, REF DATE AND CLEAR DUMP BIT + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(C) + HLRS TT + DPB TT,[UNREFD+UNREF(C)] + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(C) + JRST NSDM1 + +DELEWO: TLNN R,%CLSQ ;DELETE WHILE OPEN + JRST OPNL34 ;WRONG TYPE DEVICE + PUSHJ P,QCHNLT + PUSH P,W + PUSH P,C + MOVEI W,4 + MOVE A,UNFN1(C) ;Get names of file being hacked. + MOVE B,UNFN2(C) + MOVE C,QSNUD(H) + PUSHJ P,MNGDIR ;If this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. + POP P,C + POP P,W + MOVSI T,%QADEL ;SET DELETE BIT IN QSK CHNL + IORM T,QSRAC(R) + MOVSI T,UNCDEL ;AND IN FILE + IORM T,UNRNDM(C) + JRST NSDM1 + +;.CALL FILLEN +;RETURNS (1) FILE LENGTH IN BYTES (BYTE SIZE CURRENTLY OPEN IN) +; (2) BITS PER BYTE (BYTE SIZE CURRENTLY OPEN IN) +; (3) FILE LENGTH IN BYTES (BYTE SIZE WRITTEN IN) +; (4) BITS PER BYTE (BYTE SIZE WRITTEN IN) + +NFILLEN:PUSHJ P,QCHNLT + MOVE A,QSRAC(R) + TLNE A,%QALNK + JRST OPNL34 ;NOT A FILE + SKIPGE QSCRW(R) + TLNE A,%QAMWO + JRST NFILL1 ;READ CHANNEL OR WRITE-OVER, GET FILE'S STORED LENGTH. + MOVE A,QFBLNO(R);NORMAL WRITE, GET ACCESS POINTER. + SKIPGE QSMDN(R) + JRST NFILL2 ;NO BUFFER ACTIVE + ADD A,QMPBSZ(R) ;END OF CURRENT BUFFER + SUB A,QSMPRC(R) ;BACK UP TO CURRENT LOC +NFILL2: PUSHJ P,QUDULK + LDB B,[QSBSIZ(R)] ;CURRENT BYTE SIZE + MOVE D,B ;WRITTEN BYTE SIZE SAME AS CURRENT + MOVE C,A ;WRITTEN LENGTH SAME AS CURRENT + JRST POPJ1 + +NFILL1: LDB TT,[UNDSCP+UNRNDM(C)] + IDIVI TT,UFDBPW + HLL TT,QBTBLI(I) ;GET DESCRIPTOR POINTER + LDB E,[UNWRDC+UNRNDM(C)] + SKIPN E + MOVEI E,2000 ;E GETS NUMBER OF WORDS IN LAST BLOCK + LDB D,[UNBYTE+UNREF(C)] ;D GETS BYTE INFO + ANDI C,-2000 ;C GETS BASE ADDR OF DIR + ADDI TT,UDDESC(C) ;TT GETS DESC PNTR + SETOM A ;INITIALIZE NUMBER OF BLOCKS IN FILE + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE MINUS ONE + PUSHJ P,QUDULK + IMULI A,2000 ;NUMBER OF WORDS IN COMPLETE BLOCKS + ADD A,E ;ADD WORDS IN LAST BLOCK + PUSHJ P,QBDCD ;D GETS BYTE SIZE, E NUMBER OF RESIDUE BYTES + MOVEI Q,36. + IDIV Q,D ;Q GETS BYTES PER WORD + MOVE C,A ;C WRITTEN LENGTH, A CURRENT (B.S. DIFFERENT) + IMUL C,Q ;CONVERT WORD LENGTH TO BYTES + SUB C,E ;C NOW HAS CORRECT WRITTEN LENGTH + IMUL E,D ;E GETS NUMBER OF RESIDUE BITS + LDB B,[QSBSIZ(R)] ;B GETS BYTE SIZE OPENED IN + IMULI A,@QSBYTE(R) ;A GETS LENGTH IN THOSE SIZE BYTES + IDIV E,B ;NUMBER OF RESIDUE BYTES, -ROUNDING DOWN- + SUB A,E ;ADJUST THE LENGTH + JRST POPJ1 ;RETURN VALUES IN A,B,C,D + +NFLLN2: ADD A,B ; NEXT N BLOCKS +NFLLN1: ILDB B,TT ; GET NEXT DESC BYTE + JUMPE B,CPOPJ ; NO MORE + CAIG B,UDTKMX + JRST NFLLN2 ; TAKE-N + CAIGE B,UDWPH + AOJA A,NFLLN1 ; SKIP-N, TAKE-1 + CAIN B,UDWPH + JRST NFLLN1 ; IGNORE WRITE-PLACEHOLDER +REPEAT NXLBYT, IBP TT ; LOAD-ADDRESS, TAKE-1 + AOJA A,NFLLN1 + +;DIRSIZ - READ OR SET DISK QUOTAS, READ # BLOCKS IN ALL FILES IN DIRECTORY. +;1ST VALUE IS GRIM REAP QUOTA,,DIR SIZE +;2ND VALUE IS 0 OR PACK#,,ALLOCATION FOR DIR ALLOCATED TO SPECIFIC PACK +;LH OF 2ND ARG SETS GRIM REAP QUOTA; 3RD ARG SETS PACK#,,ALLOCATION +NDIRSI: MOVE D,C + PUSHJ P,QCHNLT + MOVE C,QSNLCN(H) + MOVE A,UDBLKS(C) + JUMPL B,NDIRS1 + CAIE W,1 + HLLM B,UDBLKS(C) +NDIRS1: MOVE B,UDALLO(C) + CAILE W,2 + MOVEM D,UDALLO(C) +IFN QRSRVP,[ + HLRZS D ;PACK ALLOCATED TO + SETO E, + JUMPE D,NDIRS2 + MOVEI E,NQS-1 ;UPDATE ALLOC DRIVE NUM + CAME D,QPKID(E) + SOJGE E,.-1 +NDIRS2: MOVEM E,QSALLO(H) +];QRSRVP + JRST NSDM1 + +SUBTTL DISK OPEN ROUTINES + +%DO==1,,525252 ;Special mode bits for disk opens. +%DOWOV==100000 ;Write over mode +%DONRF==10 ;Don't set ref-date +%DONLK==20 ;Don't chase links; actually open the link itself. +%DORWT==40 ;Make readers wait (used on opens for write or write-over). + +IFN TPLP+UNSPLP,[ +TPLO: MOVE C,[SIXBIT /.LPTR./] ;PSEUDO LINE PRINTER (DISC) + JUMPGE D,TPLO2 + MOVE B,UNAME(U) + AOS A,TPLFNO ;GENERATE RANDOM FILE NAME + JRST TPLO2 +] + +COMO: SKIPA C,[SIXBIT /COMMON/] ;.OPEN ENTRY FOR "COM" DEVICE +SYSO: MOVSI C,(SIXBIT /SYS/) ; " FOR "SYS" DEVICE +TPLO2: MOVEM C,USYSN1(U) + MOVNI I,1 + JRST QSKO + +QSKPO: MOVSI TT,-NQS ;PACK # OPEN + CAME I,QPKID(TT) + AOBJN TT,.-1 ;I <= PHYSICAL UNIT WITH SPECIFIED PACK + JUMPL TT,QSKPO1 + PUSHJ P,QPKNFP + JRST QSKPO + CAIE W,4 ;IF RENAME/DELETE, OK, DOESN'T TOUCH FILE ANYWAY + JRST OPNL16 ;OTHERWISE COMPLAIN PACK NOT MOUNTED +QSKPO1: HRRZ I,TT +QSKUO: CAIGE I,NQS ;DISK UNIT # OPEN + SKIPE QACT(I) ;I <= UNIT # + JRST OPNL10 ;BAD UNIT # OR NOT ENGAGED +IFE MCOND DM,[ ;; Security check in reserved pack feature only on DM. +IFN QRSRVP,[ + JUMPN W,QSKOB ;WRITE-OVER OR RENAME OK. + JUMPGE D,QSKOB ;READ OK. + SKIPE QRESRV(I) ;WRITE: IS PACK ON THIS DRIVE RESERVED? + JRST OPNL10 ;YES, CAN'T WRITE ON IT. +];QRSRVP +];DM + JRST QSKOB + +;DNRF: DEVICE IS LIKE DSK: BUT DOESN'T SET REFERENCE DATE +DNRFO: TRO D,%DONRF/2 ;SET MODE BIT AND DROP INTO QSKO + +; Regular DSK: device +; +; RH(D) has open mode, rotated 1 bit right. +; W has operation code (0=r/w, 2=link, 4=del/rnm, 1=wov) + +QSKO: MOVNI I,1 ;DSK OPEN, I <= # DETERMINED BY SYS +QSKOB: MOVEM I,EPDL(U) ;SAVE DISK # + MOVE C,USYSN1(U) + CAIN W,4 + JUMPE A,QSKOB2 ;IF RENAME OF OPEN FILE TRAP OUT +QSKOA: MOVE I,MDSK ;IS MFD IN? + PUSHJ P,QMCH1 ;READ IN MFD OF MASTER DISK + CLEARM QLD(U) ;LINK DEPTH +QSKOL: PUSHJ P,MFDCK + JRST SYSDS2 + JUMPN W,OPNL11 + JUMPL D,OPNL11 ;MUST BE NORMAL READ + JRST QMLSTF ;USER WANT TO READ THE MASTER DIRECTORY + +MFDCK: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + POPJ P, + JRST POPJ1 + +SYSDS2: PUSHJ P,QFLD ;H <= PTR TO USER DIR TABLE + PUSHJ P,QSKO1 ;LOSER DIR NOT IN CORE + SKIPG QSNNR(H) + BUG + PUSHJ P,QUDLK ;RETURN WITH SOS OF QSNNR ON LSWPR + MOVSI TT,40000 + TDNE TT,QSNLCN(H) + JRST QSKDP1 ;PAW OVER USER DIRECTORY +QSKDP2: PUSHJ P,QUDULK + PUSHJ P,FLDRCK + JRST QSKDP9 ;NOT SPECIAL DIRECTORY FILE + JUMPN W,QPNL11 + JUMPL D,QPNL11 + JRST QLISTF ;USER WANTS TO READ HIS USER DIRECTORY + +QSKDP9: JUMPN W,QSKDPY ;If doing IO? + SKIPL D ; and reading + JRST QSKDPZ ; then don't bother with "security". +QSKDPY: PUSHJ P,MNGDIR ;Else if this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. +QSKDPZ: JUMPL D,QWRO ;WRITE + CAIN W,4 + JRST QRNAM ;RENAME/DEL + CAIN W,2 + JRST QALINK ;MAKE LINK + JUMPN W,QPNL22 +QWROR: JUMPE A,QPNL11 ;ALSO ENTER FOR VARIOUS WRITE OVER, COPY OVER MODES + JUMPE B,QPNL11 + PUSHJ P,QCHNF ;GET CHANNEL FOR READ + PUSHJ P,LOSSET + QCHNRT + PUSHJ P,QUDLK ;LOCK USER DIR + PUSHJ P,QLOOK ;LOOK UP FILE + JRST [ PUSHJ P,QROR1C ;Not found => decide whethe error or wait. + POPJ P, ;Error (error code already set up). + PUSHJ P,QUDULK ;If retrying, first unlock directory, + PUSHJ P,LSWPOP ;Return the channel, + PUSHJ P,UDELAY ;Wait a little while, + JRST QWROR] ;Try again. + TRNE D,3 ;SKIP IF UNIT ASCII MODE + JRST QSKO2 + MOVE J,[440700,,5] ;BYTE SIZE IS 7 BITS + MOVEM J,QSBYTE(E) +QSKO2: HLLZ J,QSBYTE(E) ;GET PROPER BYTE POINTER LH + MOVEM J,QSMPRP(E) + TRNN D,%DONRF/2 ;3.4 BIT IN OPEN IMPLIES DONT SET REFERENCE DATE + PUSHJ P,QFREF ;"REFERENCE" FILE + MOVE C,Q + SUB C,QSNLCN(H) + HRRZM C,QUDFPR(E) ;SET UP PTR FROM CHNL TO FILE NAME AREA + LDB TT,[UNDSCP+UNRNDM(Q)] ;FOUND FILE SET UP CHNL + MOVEM TT,QDIRP(E) ;SET UP CHAR PTR TO DESC AREA + MOVE C,UNRNDM(Q) + TLNE C,UNLINK + JRST QLINK ;FILE IS A LINK + MOVSI C,%QALOP + SKIPE QLD(U) ;IF WE TRACED A LINK TO OPEN THE FILE, REMEMBER THAT. + IORM C,QSRAC(E) + MOVSI C,%QARWT + TRNE D,%DORWT/2 + IORM C,QSRAC(E) + LDB J,[UNPKN+UNRNDM(Q)] ;GET PACK NUMBER FILE IS ON + MOVSI I,-NQS + CAME J,QPKID(I) + AOBJN I,.-1 ;TRANSLATE LOGICAL TO PHYSICAL DISK UNIT + JUMPGE I,QPKNF ;PACK NOT ON * + HRRZM I,QDSKN(E) ;SET CHNL DISK NUMBER + JUMPL D,QWROR1 ;REALLY WANT TO WRITE OVER, ETC + MOVEI TT,%QMRD ;PUT CHANNEL IN NORMAL READ MODE + HRRM TT,QSRAC(E) +QOEX1: PUSHJ P,QUDULK ;UNLOCK USER DIR + PUSHJ P,LSWDEL ;QUSR ENTRY + PUSHJ P,LSWDEL ;QSNNR ENTRY + SKIPG QSNNR(H) + BUG + PUSHJ P,QSTRTR + MOVE C,D + ROT C,1 + HRL A,E + JSP Q,OPSLC7 ;SET UP IOCHNM AND DEPART + DQUAI,,DQUAO + DQBI,,DQBO + DQUII,,DQUIO + DQBI,,DQBO + +QWROR1: SOJN W,OPNL12 ;NORMAL WRITE OVER MODE + HRRZS H ;CLEAR GARBAGE IN USER DIR NUM + HRRZS E ;CLEAR GARBAGE IN CHNL NUM + HRRZ J,QUDFPR(E) ;PICK UP LOCN OF FILE WITH U.F.D + MOVSI I,-NQCHN ;MAKE SURE THIS FILE NOT OPEN FOR READING +QROR1A: CAIE E,(I) ;DONT GET FAKED OUT BY OWN CHNL + SKIPGE QUSR(I) + JRST QROR1B + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1B + JRST OPNL23 + +QROR1B: AOBJN I,QROR1A + PUSHJ P,QAUTH + MOVSI TT,UNWRIT + IORM TT,UNRNDM(Q) ;SET WRITE BIT + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(Q) + PUSH P,D + PUSH P,Q + PUSH P,R + PUSH P,E ;CONVERT FROM ORIGINAL BYTE SIZE TO ONE OPENED IN NOW + LDB D,[UNBYTE+UNREF(Q)] + PUSHJ P,QBDCD ;GET INFO FROM ORIGINAL WRITE OF FILE + MOVEI Q,36. + IDIV Q,D ;BYTES PER WORD + SUB Q,E ;# VALID BYTES + IMUL Q,D ;VALID BITS IN LAST WORD + POP P,E ;RESTORE QSK CHNL # + HRRZ R,QSBYTE(E);BYTES PER WORD IN NEW BYTE SIZE + LDB J,[QSBSIZ(E)] ;BITS PER BYTE IN NEW BYTE SIZE + IDIV Q,J ;NUMBER OF NEW-SIZE BYTES IN LAST WORD + SUB R,Q ;RESIDUE IN NEW-SIZE BYTES + LDB Q,[QSBSIZ(E)] ;NEW BYTE SIZE + PUSHJ P,QBENC ;RH(Q) GETS NEW BYTE INFO + MOVE R,-1(P) + DPB Q,[UNBYTE+UNREF(R)] ;CLOBBER FILE'S BYTE SIZE + POP P,R + POP P,Q + POP P,D + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(Q) + HLRS TT + DPB TT,[UNREFD+UNREF(Q)] + HLLM TT,OLDRDT(E) + MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVSI TT,%QAMWO ;WRITE OVER MODE + IORM TT,QSRAC(E) ;LEAVE %QMIDL UNTIL FIRST .IOT SINCE + JRST QOEX1 ; THE USER WILL PROBABLY DO A .ACCESS + +;Call here if lookup fails on open. +;Either signal some error and return, +;or skip-return if caller should wait and retry the lookup. +;Assumes H has dir slot, Q has address of filename block, +;E has channel number allocated for this open. +;Clobbers C, J. +QROR1C: HRRZ C,QSNLCN(H) + SUBI Q,-LUNBLK(C) + SKIPL Q ;SEE IF STILL POINTED INSIDE DIR + CAILE Q,2000-LUNBLK + JRST QROR1D ;NO - REALLY FNF + ADDI Q,(C) + CAMN A,UNFN1(Q) ;DO NAMES MATCH? + CAME B,UNFN2(Q) + JRST QROR1D ;NO - REALLY FNF + HRRZ J,Q ;Find channel that has this file open. + SUB J,QSNLCN(H) + ANDI J,-1 + HRRZS H ;Clear garbage in user dir num + HRRZS E ;Clear garbage in chnl num + MOVSI I,-NQCHN +QROR1E: CAIE E,(I) ;Dont get faked out by our own chnl. + SKIPGE QUSR(I) + JRST QROR1F + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1F +;Found the channel. Does it want us to wait? + MOVE I,QSRAC(I) + TLNN I,%QARWT + JRST OPNL23 ;He didn't say so => get "file locked". + JRST POPJ1 + +QROR1F: AOBJN I,QROR1E + JRST POPJ1 ;Cannot find channel => maybe was closed. Retry. + +QROR1D: SKIPN QLD(U) + JRST OPNL4 ;FILE NOT FOUND + JRST OPNL47 ;LINK WAS FOUND, BUT NOT THE FILE IT POINTED TO + +;COME HERE FOR RENAME-WHILE-OPEN +QSKOB2: HRRZ A,B ;DO RENAME WHILE OPEN HERE TO AVOID + CAIL A,20 ;IN CASE SYS NAME HAS CHANGED + JRST OPNL14 + SKIPE SRN3(U) + SKIPN SRN4(U) + JRST OPNL11 + ADD A,U + HLRZ E,IOCHNM(A) + MOVE H,QUDPR(E) + MOVE A,SRN3(U) + MOVE B,SRN4(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL11 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL11 + PUSHJ P,QUDLK + MOVE Q,QUDFPR(E) + ADD Q,QSNLCN(H) + PUSHJ P,QGRLSC ;EITHER NAME > OR FROM POINTER + MOVE I,D ;I => TO POINTER + HRLOI E,377777 ;PREVIOUS FN1 (BIT 4.9 COMPLEMENTED) + MOVE W,E ;FN2 + MOVEI J,0 ;J NEGATIVE => NEED SORT, NON-ZERO => DIR MODIFIED +QSKDP4: SUBI I,LUNBLK +QSKDP5: SUBI D,LUNBLK + CAMLE C,D + JRST QSKDP8 ;THROUGH + SKIPN A,UNFN1(D) + SKIPE UNFN2(D) + JRST QSKDP3 + HLLOS J + JRST QSKDP5 ;NAME BLOCK FREE + +QSKDP3: MOVE Q,UNRNDM(D) + TLNN Q,UNIGFL + JRST QSKDPR ;NOT OPEN FOR WRITE OR BEING DELETED + HLLOS J ;NEED TO WRITE OUT DIR + SKIPN A,UNFN1(D) + MOVSI A,(SETZ) + SKIPN B,UNFN2(D) + MOVSI B,(SETZ) +QSKDP7: PUSHJ P,QGRLSC ;DON'T CREATE ANY FILE WITH NAME OF < OR > + AOJA A,QSKDPA ;CHANGE BOTH JUST TO BE SURE + AOJA A,QSKDPA + MOVE Q,QSNLCN(H) ;SEE IF THAT NAME EXISTS + MOVEI Q,2000-LUNBLK(Q) ;THERE MAY BE DUPLICATE ENTRIES +QSKDPU: CAMN A,UNFN1(Q) ;DURING THIS SEARCH BUT IT DOESN'T + CAME B,UNFN2(Q) ;MATTER + JRST QSKDPT + CAIE Q,(D) ;DON'T CHANGE NAME IF NOT DUPLICATE +QSKDPA: AOJA B,QSKDP7 ;FOUND IT. CHANGE SECOND NAME +QSKDPT: SUBI Q,LUNBLK + CAMG C,Q + JRST QSKDPU + MOVEM A,UNFN1(D) + MOVEM B,UNFN2(D) + MOVSI Q,UNIGFL + ANDCAM Q,UNRNDM(D) +QSKDPR: CAMN D,I + JRST QSKDP6 + HRLZ Q,D ;RELOCATE FILE BLOCK + HRR Q,I + BLT Q,LUNBLK-1(I) +QSKDP6: JUMPL J,QSKDP4 ;ALREADY NEEDS SORT + MOVE B,UNFN2(D) ;MAY NOT HAVE YET IF GOT HERE FASTEST WAY + TLC A,(SETZ) + TLC B,(SETZ) + EXCH A,E + EXCH B,W + CAMLE A,E + JRST QSKDP4 ;ORDER OK + CAMN A,E + CAMGE B,W + MOVNI J,1 ;NEED SORT + JRST QSKDP4 + +QSKDP8: ADDI I,LUNBLK ;I POINTED TO EMPTY SLOT + MOVE D,I + SUBI D,(TT) + EXCH D,UDNAMP(TT) + ADDI D,(TT) + CAML D,I + JRST QSKDPV + SETZM (D) ;CLEAR VACATED AREA + HRLS D + ADDI D,1 + BLT D,-1(I) +QSKDPV: JUMPL J,QSKDPS ;SORT + TRNN J,-1 + JRST QSKDPK +QSKDPX: MOVE I,QACTB + IORM I,QSNLCN(H) +QSKDPK: MOVE W,QSNLCN(H) +IFN QRSRVP,[ + HLRZ A,UDALLO(W) ;IF THIS DIR HAS ALLOCATION + JUMPE A,QSKBK0 + MOVEI B,NQS-1 ;CONVERT PACK # TO DRIVE # + CAME A,QPKID(B) + SOJGE B,.-1 + SKIPGE A,B +QSKBK0: SETO A, ;ALLOCATED PACK NOT MOUNTED, USE ANY + MOVEM A,QSALLO(H) ;SAVE DRIVE # (-1 IF NONE) +];QRSRVP + HLLZS UDBLKS(W) + MOVE A,UDNAMP(W) + ADDI A,(W) +QSKBK1: CAIL A,2000(W) ;COUNT BLOCKS USED + JRST QSKBK2 + MOVE B,UNRNDM(A) + TLNE B,UNLINK + JRST QSKBK3 + LDB B,[UNDSCP+UNRNDM(A)] + IDIVI B,UFDBPW + HLL B,QBTBLI(C) + ADDI B,UDDESC(W) ;B GETS BYTE PNTR TO DESC +QSKBK4: ILDB C,B + JUMPE C,QSKBK3 + CAIN C,UDWPH + JRST QSKBK4 + CAIG C,UDTKMX + JRST [ADDM C,UDBLKS(W) ? JRST QSKBK4] + CAIG C,UDWPH + JRST [AOS UDBLKS(W) ? JRST QSKBK4] + REPEAT NXLBYT, IBP B + AOS UDBLKS(W) + JRST QSKBK4 + +QSKBK3: ADDI A,LUNBLK + JRST QSKBK1 + +QSKBK2: POP P,W + POP P,I + POP P,D + POP P,C + POP P,B + POP P,A + JRST QSKDP2 + +QSKDPS: MOVEI T,LUNBLK + ADD P,[3,,3] +QSKDPB: MOVEI Q,(I) ;BEGINNING OF NAME AREA + SKIPGE T + MOVEI Q,2000-LUNBLK(TT) ;START AT END + MOVEI W,2000(TT) + SKIPGE T + MOVEI W,-LUNBLK(I) + SETZM (P) + TDZA J,J ;0 => SORTED -1 => MAKE ANOTHER PASS +QSKDPE: ADD Q,T + CAIE Q,(W) + JRST QSKDPC + JUMPE J,QSKDPW + MOVNS T + JRST QSKDPB + +QSKDPW: SUB P,[3,,3] + JRST QSKDPX + +QSKDPC: SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + JRST QSKDPD + BUG + +QSKDPD: MOVE B,UNFN2(Q) + TLC A,(SETZ) + TLC B,(SETZ) + SKIPE E,(P) ;FIRST ENTRY + JRST QSKDPF +QSKDPG: MOVEM A,-2(P) + MOVEM B,-1(P) +QSKDPI: MOVEM Q,(P) + JRST QSKDPE + +QSKDPF: JUMPL T,QSKDPJ + CAMLE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAML B,-1(P) + JRST QSKDPG +QSKDPH: REPEAT LUNBLK,[ + EXCH A,.RPCNT(E) + EXCH A,.RPCNT(Q) + EXCH A,.RPCNT(E) +] + MOVNI J,1 + JRST QSKDPI + +QSKDPJ: CAMGE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAMG B,-1(P) + JRST QSKDPG + JRST QSKDPH + +SUBTTL OPEN FOR WRITE + +;RETURNS WITH QUSR(E) AND QSNLCN(E) ON LSWPR +QWRO2: JUMPE A,QPNL11 + JUMPE B,QPNL11 + SKIPGE I,EPDL(U) ;PICK UP DESIRED DISK UNIT + JRST QWRO2A ;SYSTEMS CHOICE +QWRO2B: CAIGE I,NQS + SKIPE QACT(I) + BUG ;WE LOST SOMEHOW... + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) ;TUT IN BUT NOT PAWED OVER + TLNE TT,40000 ;TUT NOT IN + PUSHJ P,QTCH1 ;READ IN TUT OF DISK INVOLVED + PUSHJ P,QCHNF ;GET CHANNEL + PUSHJ P,LOSSET + QCHNRT + MOVE TT,[440700,,5] + TRNN D,3 + MOVEM TT,QSBYTE(E) ;UNIT ASCII MODE, BYTE SIZE=7 + PUSHJ P,QUDLK ;LOCK USER DIRECTORY + PUSHJ P,QGRLSC ;CHECK < AND > + JRST QPNLBN ;LOSE + PUSHJ P,QFNG ;REPLACE WITH COMPUTED EFFECTIVE NAME + PUSHJ P,QFREEF ;FIND FREE FILE NAME AREA AND STORE IN QDIRP(E) + JRST QFDF ;FILE DIR FULL + MOVSI TT,UNWRIT ;SET WRITE IN PROGRESS + IORM TT,UNRNDM(Q) + MOVE TT,QPKID(I) + DPB TT,[UNPKN+UNRNDM(Q)] + PUSHJ P,QAUTH ;SET FILE AUTHOR, MAY NOT PCLSR + MOVE TT,QACTB + IORM TT,QSNLCN(H) + SETOM QSCRW(E) ;SET CHNL WRITE SWITCH + POPJ P, + +QWRO2A: +IFN QRSRVP,[ + SKIPL I,QSALLO(H) + JRST QWRO2B ;THIS DIR GOES ON A PARTICULAR UNIT +] + SKIPGE I,QWRU ;GET CURRENT WRITING UNIT + JRST QWRO2E ;NO CURRENT UNIT, GO FIND ONE + MOVE TT,QSFT(I) + CAML TT,QFTTHR + JRST QWRO2B ;ENOUGH ROOM ON PREFERRED UNIT +QWRO2E: SETOB T,I ;NOT MUCH SPACE LEFT TRY OTHER UNITS + MOVSI E,-NQS +QWRO2C: SKIPGE QACT(E) ;SKIP ON UNIT ACTIVE + JRST QWRO2D +IFN QRSRVP,SKIPN QRESRV(E) ;DONT CHOOSE THIS PACK IF RESERVED + CAML T,QSFT(E) ;NOTE QSFT IS -1 IF TUT NEVER BEEN READ IN + JRST QWRO2D ;OTHERWISE CONTAINS VALID BLOCK COUNT + MOVE T,QSFT(E) + HRRZ I,E +QWRO2D: AOBJN E,QWRO2C + SKIPGE I + BUG ;NO ACTIVE UNRESERVED UNITS + CAMN I,QWRU + JRST QWRO2B ;DON'T WRITE MFD IF UNCHANGED + MOVEM I,QWRU + MOVE E,QACTB + IORB E,QMDRO + MOVEM I,MPDWDK(E) + JRST QWRO2B + +QWRO: JUMPN W,QWROR ;REALLY WANT TO MODIFY OR OTHERWISE HACK AN EXISTING FILE + PUSHJ P,QWRO2 ;MAKING NEW FILE, DECIDE WHICH UNIT TO PUT IT ON + SETOM QMFTP(E) ;TRACK TO SCAN IN TUT + SETOM QMTTR(E) + CLEARM QMPTN(E) + CLEARM QMPTC(E) + MOVEI TT,%QMWRT ;ENTER NORMAL WRITE MODE + HRRM TT,QSRAC(E) + MOVSI TT,%QARWT + TRNE D,%DORWT/2 + IORM TT,QSRAC(E) + JRST QOEX1 ;EXIT + + +SUBTTL File hacking tracking + +; MNGDIR checks the file name (sname in C) +; Fails to skip if the file is an important system file. +; Skips if the file is of the everyday sort. + +MNGDIR: HLRZ TT,C +IFN KL10P, CAME C,[SIXBIT /.KLFE./] + CAIN TT,'SYS ;A sys directory? + POPJ P, + CAME C,[SIXBIT /ACOUNT/] + CAMN C,[SIXBIT /./] + POPJ P, + CAME C,[SIXBIT /DEVICE/] + CAMN C,[SIXBIT /CHANNA/] + POPJ P, + AOS (P) ;Not a system directory. skip return. + POPJ P, + +; SYSDSK notifies the SYS job to print a message on the +; console about the file being hacked. +; File names in C;A B, the opcode in W (or zero) specifies the hacking. + +SYSDSK: JUMPE U,CPOPJ ;Avoid deadly embrace! + MOVSI T,SCLWRT ;Writing on SYS directory. + PUSHJ P,CWAIT ;Take turns like nice little lusers. + TDNE T,SUPCOR ;Wait for previous req to finish. + MOVE TT,W ;Check file operation code. + CAILE TT,4 ;If impossible opcode + SETZ TT, ; probably supposed to be R/W. + MOVEM TT,SWMOD ;Store opcode. + MOVE TT,UNAME(U) + MOVEM TT,SWUNAM ;Luser. + MOVE TT,JNAME(U) + MOVEM TT,SWJNAM + MOVEM A,SWFN1 + MOVEM B,SWFN2 + MOVEM C,SWFN3 ;Sname. + IORM T,SUPCOR ;Notify the SYS job. + JRST CLKONJ ;Turn on the clock and return. + + +SUBTTL DIRECTORY ROUTINES + +QFREEF: PUSH P,A ;Q_PTR TO USER DIR FREE FILE QDIRP(E)_PTR TO FREE DESC AREA + PUSH P,B ;GET FREE FILE AREA + PUSH P,I + MOVEI I,0 ;SIGNAL NO GC YET +QFREFA: SETZM QUDFPR(E) ;CLEAR SO WILL NOT POINT TO RANDOMNESS IN CASE OF G C + MOVE TT,QSNLCN(H) + SKIPL Q,UDESCP(TT) + CAIL Q,2000*UFDBPW + BUG ;FREE DESC POINTER OUT OF RANGE + IDIVI Q,UFDBPW + MOVE C,UDNAMP(TT) + CAIL Q,-UDDESC-7-LUNBLK(C) + JRST QAGARB ;NOT ENOUGH ROOM BETWEEN DESC AND NAME AREAS + PUSHJ P,QLGLK ;FIND WHERE FILE OUGHT TO GO + JRST QFREFF ;DIR WAS EMPTY + TRNN J,1777 + JRST QFREFE ;GOES AT END OF DIR +QFREFC: CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QFREFE + MOVE C,UNRNDM(J) + TLNE C,UNIGFL ;* FILES MUST COME AFTER NON * FILES + JRST QFREFE ;OF SAME NAME + ADDI J,LUNBLK + CAIGE J,2000(TT) + JRST QFREFC +QFREFE: CAMN Q,J + JRST QFREFF ;GOES AT BEGINNING + PUSHJ P,QINSRT + JRST QFREFD + +QFREFF: SUBI Q,LUNBLK ;Q -> NAME BLOCK FILE WILL GO IN +QFREFD: MOVNI T,LUNBLK ;ALLOCATE MORE SPACE FOR NAME AREA + ADDM T,UDNAMP(TT) + HRRZ A,UDESCP(TT) ;FIRST FREE DESCRIPTOR LOC + DPB A,[UNDSCP+UNRNDM(Q)];STORE IN FILE AREA + MOVEM A,QDIRP(E) ;STORE IN CHANNEL + MOVEI B,6*UFDBPW+1 ;ENOUGH FOR A LINK WITH EVERY CHAR QUOTED PLUS ONE ZERO + ADDM B,UDESCP(TT) ;ALLOCATE MORE SPACE FOR DESC AREA + MOVE B,Q + SUB B,QSNLCN(H) + HRRZM B,QUDFPR(E) ;ASSOCIATE CHANNEL WITH FILE + CONO PI,CLKOFF + SKIPL B,QDATE ;GET TIME AND DATE + HRR B,TIMOFF + CONO PI,CLKON + MOVEM B,UNDATE(Q) ;SET CREATION DATE + HLLM B,OLDRDT(E) + HLRS B + DPB B,[UNREFD+UNREF(Q)] ;SET REFERENCE DATE + IDIVI A,UFDBPW ;GET WRD AND CHAR ADRS + HLLZ B,QBTBLI(B) + ADDI B,UDDESC(A) + HRRZ A,QSNLCN(H) + ADD B,A + ILDB A,B + SKIPE A + BUG ;DESCRIPTOR AREA ALREADY OCCUPIED + MOVEI A,UDWPH + DPB A,B + ILDB A,B + SKIPE A + BUG ;NOT FOLLOWED BY ZERO + POP P,I + POP P,B + POP P,A + MOVEM A,UNFN1(Q) ;SET FILE NAMES + MOVEM B,UNFN2(Q) + JRST POPJ1 + +QAGARB: JUMPL I,QNOFRE ;IF GC WAS ALREADY TRIED, DON'T TRY IT AGAIN - GIVE UP. + PUSHJ P,QGC ;GC. BTW, IT IS OK TO PCLSR HERE. + JFCL + MOVNI I,1 ;SIGNAL GC HAS BEEN TRIED + JRST QFREFA + +;MAKE ROOM FOR FILE BEFORE J. Q POINTS TO NEW EMPTY FILE SLOT +QINSRT: PUSH P,A + PUSH P,TT + HRRZ TT,QSNLCN(H) + HRRZ A,UDNAMP(TT) + PUSH P,A + ADDI A,(TT) + HRLS A + SUBI A,LUNBLK + BLT A,-LUNBLK-1(J) + SETZM -LUNBLK(J) + HRRZI A,-LUNBLK+1(J) + HRLI A,-LUNBLK(J) + BLT A,-1(J) + SUB J,QSNLCN(H) + MOVSI A,-NQCHN +QINSR1: HRRZ TT,QUDPR(A) + SKIPL QUSR(A) + CAIE TT,(H) + JRST QINSR2 + MOVE TT,QUDFPR(A) + CAMGE TT,(P) + JRST QINSR2 + CAIGE TT,(J) + SUBI TT,LUNBLK + MOVEM TT,QUDFPR(A) +QINSR2: AOBJN A,QINSR1 + ADD J,QSNLCN(H) + HRRZI Q,-LUNBLK(J) + SUB P,[1,,1] + POP P,TT + POP P,A + POPJ P, + +;DIR NOT IN CORE. GET IT FROM DISK, CREATE IT IF DOESN'T ALREADY +; EXIST, OR GIVE NO SUCH DIRECTORY ERROR. +;C HAS SNAME. RETURNS DIRECTORY NUMBER IN H. + +QSKO1: PUSHJ P,SWTL + QSKOSW ;PREVENT TIMING ERROR IF TWO PCS SHOULD + PUSHJ P,QFLD ; ATTEMPT TO BRING IN SAME DIRECTORY + JRST QSKO11 + MOVEI T,2 ;SOMEONE ELSE BROUGHT IT IN, RELEASE QSKOSW + JRST LSWPON ;BUT LEAVE QSNNR(H) LOCKED. + +QSKO11: PUSH P,J + PUSH P,I + PUSHJ P,QFL ;LOOK UP DIR IN MFD, RET TRACK IN J + JRST QSKON ;NON EXISTENT + PUSHJ P,QFLDF ;FIND FREE LOSER DIR SLOT + MOVE I,MDSK + PUSHJ P,QCHNF ;FIND FREE CHNL (TO READ IN DIR) + MOVEM C,QSNUD(H) ;SET USER NAME IN DIR SLOT + MOVEM J,QSLGL(E) ;REQUEST READ IN OF USER DIR FROM TRACK IN J + MOVEI TT,%QMUDR + MOVEM TT,QSRAC(E) +QSKON1: MOVEI T,2 + PUSHJ P,LSWPON ;RELEASE QSKOSW, LEAVE SOSSET OF QSNNR(H) + POP P,I ;GO AWAY WILL HANG UP WAITING IN QUDLK + POP P,J ;DIR IS LOCKED BUT NOT ON LSWPR, PI WILL UNLOCK AFTER READIN + JRST QSTRTR + +QNOFRE: POP P,I ;NO FREE FILES AVAIL + JRST POPBAJ + +QPNL24: PUSHJ P,OPNL24 + JRST URET + +QPNL20: PUSHJ P,OPNL20 + SKIPE QLD(U) + PUSHJ P,OPNL47 ;FOUND LINK, BUT IT POINTS TO NON-EXISTENT DIRECTORY + JRST URET + +AUTOCR: ;AUTOMATICALLY CREATED DIRECTORIES +IFN TPLP+UNSPLP,SIXBIT /.LPTR./ ;FOR TPL SPOOLING + SIXBIT /.MSGS./ ;FOR MESSAGES TO ALL LOSERS + SIXBIT /.MAIL./ ; Programs like to write mail here + SIXBIT /CRASH/ ; Programs like to dump themselves here + SIXBIT /.TEMP./ ; Programs like to write randomness here +NATOCR==.-AUTOCR + +QSKON: JUMPE C,QPNL20 ;DON'T ALLOW ZERO USER NAME + PUSH P,TT + MOVSI TT,-NATOCR +QSKONA: CAMN C,AUTOCR(TT) + JRST QSKONB + AOBJN TT,QSKONA + CAMN A,[SIXBIT /..NEW./] + CAME B,[SIXBIT /(UDIR)/] + JRST [POP P,TT + JRST QPNL20] + BUG INFO,[DSK: DIR ],SIXBIT,C,[CREATED BY ],SIXBIT,UNAME(U),SIXBIT,JNAME(U) +QSKONB: POP P,TT + SKIPG NQFUS + JRST QPNL24 ;NO MFD SLOTS AVAILABLE + PUSH P,A + PUSH P,B + PUSH P,C +QSKONE: PUSHJ P,QFLDF ;FIND FREE DIR SLOT + PUSHJ P,QMLOCK + PUSHJ P,TCALL + JRST IOMQ + JRST [PUSHJ P,LSWPOP ;QMDRO + PUSHJ P,LSWPOP ;QSNNR + PUSHJ P,UDELAY ;HOPEFULLY MEMORY WILL APPEAR SHORTLY + JRST QSKONE] + MOVEM C,QSNUD(H) + SOS NQFUS ;NO TIMING ERR DUE TO QSKOSW + MOVEI J,MU23UD + DPB J,[MUR,,MEMBLT(A)] + DPB H,[MNUMB,,MEMBLT(A)] + LSH A,10. + HRRM A,QSNLCN(H) + SETZM (A) + HRLS A + AOS B,A + BLT A,2000-2(B) + MOVEI A,2000 + MOVEM A,UDNAMP-1(B) + MOVE A,QSNUD(H) + MOVEM A,UDNAME-1(B) + MOVE B,QACTB ;NOW PUT UFD INTO MFD + IORB B,QMDRO + MOVE TT,MDNAMP(B) ;LOOK FOR A FREE SLOT + ADDI TT,(B) +QSKONC: TRNN TT,1777 + JRST QSKOND + SKIPN MNUNAM(TT) + JRST QSKONF + ADDI TT,LMNBLK + JRST QSKONC + +QSKONF: SUBI TT,(B) + JRST QSKONG + +QSKOND: MOVNI TT,LMNBLK ;NO FREE SLOTS, SO EXTEND DOWNWARD + ADDB TT,MDNAMP(B) +QSKONG: ADDI B,(TT) + MOVEM A,MNUNAM(B) + SUBI TT,2000-2*NUDSL ;GET DISK BLOCK NUMBER +IFN KA10P, SKIPGE TT +IFE KA10P, CAIGE TT,2 ; Don't clobber 'HOM' blocks + BUG ;TOO MANY UFDS (NQFUS CHECK DIDN'T WORK) + LSH TT,-1 + MOVEM TT,QSNMI(H) + MOVE TT,QACTB ;UNLOCK UFD AND CAUSE IT TO GET WRITTEN + HLLM TT,QSNLCN(H) + PUSHJ P,QMULK ;UNLOCK MFD + POP P,C + POP P,B + POP P,A + JRST QSKON1 + +SUBTTL MAKE LINK + +QALINK: MOVE I,MDSK ;ENTER WITH QSNNR ON LSWPR + MOVEM I,EPDL(U) + PUSHJ P,QWRO2 ;MAKES NEW FILE WITH MINIMUM OF 37 BYTES OF DESC SPACE + MOVSI A,UNLINK ; AND ADDS QUSR AND QSNLCN ON LSWPR + IORM A,UNRNDM(Q) ;SET LINK BIT + MOVE A,E ;QSK CHANNEL NUMBER + MOVE C,SRN5(U) ;SNAME LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN3(U) ;FN1 LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN4(U) ;FN2 LINKED TO + PUSHJ P,LDEP + JFCL + MOVE E,A ;QSK CHANNEL NUMBER FOR QCHNRT + MOVEI R,EPDL(U) ;DON'T CLOSE A REAL IOCHNM WORD + PUSHJ P,QSOCL4 ;CLOSE CHNL & FILE + PUSHJ P,LSWDEL ;DELETE QUSR, HAS BEEN SETOM'ED + PUSHJ P,LSWDEL ;DELETE QSNRR, HAS BEEN SOS'ED + JRST POPJ1 + +LDEP: MOVEI E,6 ;STORE SIXBIT FROM C INTO LINK DESC +LDEPL: MOVEI B,0 ;GET NEXT CHAR + LSHC B,6 + JUMPE B,LDEPS ;*THIS ALLOWS EMBEDDED BLANKS. + CAIE B,'; + CAIN B,': + JRST LDEPS +LDEPS2: MOVE D,B + PUSHJ P,QUDS + SOS E ;NUMBER OF CHARACTERS LEFT IN WORD + JUMPN C,LDEPL ;JUMP IF ANY MORE NON-BLANK CHARS TO STORE + MOVEI D,'; + JUMPE E,POPJ1 ;JUMP IF STORED 6 CHARACTERS + POPJ P, ;STORED FEWER, NEED TERMINATOR + +LDEPS: MOVEI D,': ;THIS CHAR NEEDS TO BE QUOTED + PUSHJ P,QUDS + JRST LDEPS2 + +;LINK ENCOUNTERED DURING LOOKUP + +QLINK: TRNE D,%DONLK/2 ;CHECK 3.5 BIT IN OPEN MODE + JRST QOLINK ;JUMP IF DON'T CHASE LINKS MODE + AOS A,QLD(U) + CAIL A,100. + JRST OPNL27 ;LINK DEPTH EXCEEDED + PUSH P,E ;SAVE XR NEEDED BY LSWPOP OF QUSR ENTRY + MOVE E,TT + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + MOVE TT,QBTBLI(TT) + HRR TT,E + MOVE I,[440600,,A] + SETZB A,B + SETZ C, +QL1: ILDB J,TT + JUMPE J,QL3 ;END DESC + CAIN J,': + JRST QL4 ;QUOTE NEXT CHAR + CAIN J,'; + TLZA I,770000 ;TERMINATE THIS WORD +QL5: IDPB J,I + JRST QL1 + +QL4: ILDB J,TT ;GET CHAR THAT WAS QUOTED + JRST QL5 + +QL3: EXCH A,C ;END OF DESC REACHED + EXCH A,B ;MAKE A FN1 B FN2 C SNM + SKIPN C + MOVE C,USYSN1(U) + PUSHJ P,QUDULK ;UNLOCK DIR + POP P,E ;RESTORE XR USED BY LSWPOP OF QUSR ENTRY + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,OPBRK ;IF TRYING TO BE PCLSRED, SUBMIT + JRST QSKOL + +QOLINK: MOVSI TT,%QALNK ;OPENING UP A LINK + IORM TT,QSRAC(E);DON'T ALLOW FILE-ONLY OPERATIONS SUCH AS IOT + JUMPL D,QWROR1 ;LEAVE RH(QSRAC)=%QMIDL SO PI LEVEL WON'T MESS WITH IT + JRST QOEX1 ;AND FINISH OPENING + +SUBTTL PAW OVER MFD + +QMCH1: CONO PI,UTCOFF + MOVE TT,QMDRO + TLNE TT,40000 + AOJE TT,QMCH2 ;NOT ON WAY IN +QMCH3: CONO PI,UTCON + SKIPGE QMDRO + PUSHJ P,UFLS + MOVSI E,2 + TDNN E,QMDRO + POPJ P, ;PAWED OVER + PUSHJ P,QMLOCK + ANDCAM E,QMDRO + HRRZ E,QMDRO + MOVE TT,MDCHK(E) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] +QMCH1A: MOVEI E,2000-LMNBLK*NUDSL(E) +IFN KA10P, SETZM NQFUS +IFE KA10P,[ + MOVNI TT,2 ;PROTECT DEC 'HOM' BLOCKS SO KLDCP OR 8080 + MOVEM TT,NQFUS ; CAN FIND ITS CRUFT +] ;IFE KA10P +QMCH1E: LDB TT,[1200,,E] + JUMPE TT,QMULK + SKIPN (E) + AOS NQFUS + ADDI E,LMNBLK + JRST QMCH1E + +QMCH2: SOS QMDRO ;INDICATE ON WAY IN + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + MOVEI TT,MFDBLK ;MFD TRACK + MOVEM TT,QSLGL(E) + MOVEI TT,%QMMDR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QMCH3 + +SUBTTL PAW OVER TUT + +QTCH1: CONO PI,UTCOFF + MOVSI TT,200000 + TDNE TT,QTUTO(I) + JRST QTCH2 ;GO READ IT IN + CONO PI,UTCON +QTCH1A: PUSHJ P,QTLOCK ;TO MAKE SURE IT'S IN + AOSE QDPWF(I) + JRST QTULK ;ALREADY PAWED OVER + PUSH P,A + PUSH P,B + MOVE T,QTUTO(I) + MOVE E,QSWAPA(T) + IDIVI E,DECADE + SKIPE TT + ADDI E,1 + IMULI E,DECADE ;ROUND SWAPPING ALLOC TO MULTIPLE OF A DECADE + MOVEM E,QSWAPA(T) + PUSH P,D + PUSH P,E ;FIRST TRACK OF NON-SWAPPING (FILE) AREA + MOVE E,QTUTP(T) ;ROUND TUT POINTER TO MULTIPLE OF A DECADE + ADDI E,DECADE-1 + IDIVI E,DECADE + IMULI E,DECADE + CAMGE E,(P) ;KEEP IT WITHIN THE FILE AREA + MOVE E,(P) + MOVEM E,QTUTP(T) + MOVE E,QPKNUM(T) +IFN DC10P,[ + CAME E,QPKID(I) + BUG HALT,[PACK ID ],OCT,E,[IN TUT FOR UNIT ],DEC,I,[DIFFERS FROM HARDWARE PACK ID],OCT,QPKID(I) +] +IFE DC10P, MOVEM E,QPKID(I) + MOVE E,QPAKID(T) + MOVEM E,QPKNM(I) +IFN QRSRVP,[ + MOVE E,QTRSRV(T) + MOVEM E,QRESRV(I) +] +;DROPS THROUGH + ;DROPS IN + CLEARM QSFTS(I) ;FREE SPACE IN SWAPPING AREA + SETZB D,QSFT(I) + MOVE B,QTUTO(I) + HRLI B,(TUTBP) + ADDI B,LTIBLK +QTCH1D: ILDB A,B + JUMPN A,QTCH1F + CAML D,(P) + AOS QSFT(I) ;BLOCK IN NON-SWAPPING AREA + CAMGE D,(P) + AOS QSFTS(I) ;BLOCK IN SWAPPING AREA +QTCH1F: ADDI D,1 + CAMGE D,QLASTB(T) + JRST QTCH1D + SUB P,[1,,1] + POP P,D + POP P,B + POP P,A + JRST QTULK + +QTCH2: SETOM QDPWF(I) + ANDCAM TT,QTUTO(I) + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + HRRZM I,QDSKN(E) + MOVEI TT,MFDBLK ;TELL PI LEVEL TO READ IT ALL IN + SUB TT,NTBL(I) + MOVEM TT,QSLGL(E) + LDB TT,[121000,,QTUTO(I)] + MOVEM TT,QSCABN(E) + MOVEI TT,%QMTTR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QTCH1A + +;ROUTINE TO ACCESS TUT +;CALL WITH DISK UNIT NUMBER IN I, BLOCK NUMBER IN D +;RETURNS IN D AN LDB-STYLE POINTER TO THE TUT AND IN B THE BYTE +;THAT YOU WOULD GET BY LDB'ING THAT POINTER. +;CLOBBERS E +;CALLER MUST LOCK TUT + +TUTPNT: MOVE B,QTUTO(I) + CAML D,QFRSTB(B) + CAML D,QLASTB(B) + BUG ;BLOCK NUMBER NOT IN RANGE COVERED BY TUT + SUB D,QFRSTB(B) + IDIVI D,TUTEPW + ADDI D,LTIBLK(B) + HLL D,TBTBL(E) + LDB B,D + POPJ P, + +QSTRTR: +IFN DC10P,[ +QSTRT1: CONSO DC0,DSKCHN + SETOM QHUNGF ;SOMEONE PUSHED RESET BUTTON, RECOVER AT PI LEVEL + CONO DC0,DCSET+DCIENB+DSKCHN ;ENABLE IDLE INTERRUPT +] +IFN RP10P+RH10P+RH11P,[ + CONO PI,UTCOFF + PUSHJ P,QSTRT1 + CONO PI,UTCON +] + POPJ P, + +IFN RP10P+RH10P+RH11P,[ ;START DISK WITH UTC ALREADY OFF +QSTRT1: SETOM QGTBZY ;NOTE: TURNS UTC BACK ON BUT NOT CLOCK +IFN RP10P, CONSO DPC,20 ;ONLY IF DISK IDLE +IFN RH10P, CONSO DSK,%HIBSY +IFN RH11P, IORDQ TT,%HRCS1 +IFN RH11P, TRNE TT,%HXRDY + CONO PI,DSKRQ + POPJ P, +] + +;TRY TO FLUSH UNNEEDED UFDS FROM CORE. +;ARG IN C IS ROUTINE TO FREE THE MEMORY. +;CALL WITH UDRSW SIEZED, OR WITH PI 2 IN PROGRESS AND UDRSW NOT LOCKED BY ANYONE +;CLOBBERS H, TT. DOESN'T SKIP. +QDFLS: MOVSI H,-QNUD +QDFLS1: SKIPE QSNUD(H) + SKIPE QSNNR(H) +QDFLS2: AOBJN H,QDFLS1 ;CAN'T FLUSH IF SLOT NOT USED OR CHANNELS OPEN IN DIR + JUMPGE H,CPOPJ + MOVE TT,QACTB + TLO TT,600000 + TDNE TT,QSNLCN(H) + JRST QDFLS2 ;CAN'T FLUSH IF LOCKED OR NOT WRITTEN OUT + PUSHJ P,QDFCHK ;CHECK THAT NO POINTERS TO THIS DIRECTORY REMAIN + CLEARM QSNUD(H) ;FLUSH + AOS QFUD + PUSH P,A + HRRZ A,QSNLCN(H) + LSH A,-10. + PUSHJ P,(C) ;RETURN THE MEMORY + POP P,A + JRST QDFLS2 ;TRY FLUSHING SOME MORE + +;CALL WITH UFD SLOT# IN H, WHEN YOU THINK THAT UFD IS FREE. +QDFCHK: PUSH P,C + PUSH P,J + MOVSI C,-NQCHN +QDFCH1: SKIPGE QUSR(C) + AOBJN C,QDFCH1 + JUMPGE C,QDFCH2 + HRRZ J,QUDPR(C) + CAIN J,(H) + BUG ;IT WASN'T REALLY FREE, MAYBE QSNNR IS SCREWED UP? + AOBJN C,QDFCH1 +QDFCH2: POP P,J + POP P,C + POPJ P, + +;FIND A FREE UFD SLOT, RETURN INDEX IN H. PUTS QSNNR ON LSWPR. +;CLOBBERS T, TT. + +QFLDF: PUSHJ P,SWTL + UDRSW + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSH P,C ;ALL UFD SLOTS IN USE, TRY FLUSHING SOME + MOVEI C,MEMR + PUSHJ P,QDFLS + POP P,C + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,UDELAY ;WAIT 1/2 SECOND THEN TRY AGAIN, INCLUDING QDFLS + JRST QFLDF + +QFLDF1: SKIPN QSNNR(H) ;SLOT ALREADY GOBBLED + SKIPE QSNUD(H) ;OR ALREADY OCCUPIED + AOBJN H,QFLDF1 ;MEANS CAN'T TAKE IT + SKIPL H + BUG ;NONE FREE, QFUD OUT OF PHASE WITH REALITY + HRRZS H + SOS QFUD + MOVSI TT,600000 ;DOUBLE LOCK + MOVEM TT,QSNLCN(H) + AOSG QSNNR(H) + BUG + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,LOSSET + QFLDRT + POPJ P, + +;LOSSET ROUTINE +QFLDRT: SKIPL A,AC0S+H(U) + CAIL A,QNUD + BUG ;H CLOBBERED + SOSGE T,QSNNR(A) + BUG + JUMPG T,CPOPJ ;HOW DID SOMEONE ELSE GET IT? + SKIPN QSNUD(A) + AOS QFUD ;READ-IN NEVER STARTED, SLOT BECOMES FREE + POPJ P, ;OK TO LEAVE 600000,, SET IN QSNLCN + +;C HAS DIR NAME. +;IF IN CORE, SET H TO UFD SLOT#, AOS QSNNR, PUT ON LSWPR, AND SKIP. +;IF DIRECTORY NOT IN CORE, NO SKIP. CLOBBERS T,TT. +QFLD: PUSHJ P,SWTL + UDRSW +QFLD1A: MOVSI H,-QNUD +QFLD1: CAME C,QSNUD(H) + AOBJN H,QFLD1 + JUMPGE H,LSWPOP ;JUMP ON FAILED TO FIND USER. +QFLD2A: AOSG QSNNR(H) + BUG ;MUST HAVE GOTTEN NEGATIVE SOMEHOW + PUSHJ P,LSWPOP ;UDRSW +; PUSHJ P,SOSSET +; QSNNR(H) +;THIS IS AN ATTEMPT TO FIND A BUG. + PUSH P,T + MOVEI T,QSNNR(H) + MOVEM T,IOTBTS(U) + PUSHJ P,LOSSET + [ SOSGE @IOTBTS(U) + BUG + POPJ P, ] + POP P,T +;END TEMPORARY CODE + JRST POPJ1 + +;C <=SYS NAME, RETURNS TRACK ADDR OF DIR IN J, SKIPS IF FINDS LOSER +QFL: PUSHJ P,QMLOCK + PUSHJ P,QFL0 + JRST QMULK + AOS (P) + JRST QMULK + +QFL0: PUSH P,Q + HRRZ Q,QMDRO + ADD Q,MDNAMP(Q) ;PTR TO USER AREA +QFL1: LDB J,[1200,,Q] + JUMPE J,QFL3 + CAMN C,MNUNAM(Q) + JRST QFL2 + ADDI Q,LMNBLK + JRST QFL1 + +QFL2: SUBI J,2000-LMNBLK*NUDSL ;J <= TRACK ADDR OF USER DIR + LSH J,-1 + AOS -1(P) ;SUCCESS +QFL3: POP P,Q + POPJ P, + +;ROUTINE TO ASSIGN A DISK CHANNEL. +;ARGS: U USER TO GO IN QUSR, H UFD SLOT# TO GO IN QUDPR, I DSK# TO GO IN QDSKN +;RETURNS QSK CHNL INDX IN E. +;DOESN'T DO A LOSSET OF QCHNRT, BUT CALLER MAY WANT TO. +;CLOBBERS T. NEVER SKIPS. + +QCHNF: PUSHJ P,SWTL ;PREVENT ANYONE ELSE FROM ALLOCATING CHANNELS + QCHSW + MOVSI E,-NQCHN + SKIPLE QFCHN + JRST QCH2 ;SOME CHANNELS ARE AVAILABLE, GO FIND ONE + PUSHJ P,LSWPOP ;QCHSW + SKIPG QFCHN + PUSHJ P,UFLS + JRST QCHNF + +QCH2: SKIPGE QSRAC(E) .SEE %QALOK + JRST QCH3 + SKIPGE QUSR(E) + JRST QCH1 +QCH3: AOBJN E,QCH2 + BUG ;WHERE DID THAT FREE CHANNEL GO? + +QCH1: HRRZS E ;CHANNEL ALLOCATED, INITIALIZE VARIABLES + HRRZM I,QDSKN(E) + SETOM QSCABN(E) + SETOM QSGL(E) + SETOM QSLGL(E) ;IN CASE OF WRITE-OVER ON 0-LENGTH FILE. + SETZM QBFP(E) + SETZM QSBFS(E) + CLEARM QSLBLK(E) + SETOM QSMDN(E) + SETZM QSCRW(E) + SETZM QSBI(E) + SETZM QSRAC(E) .SEE %QMIDL + CLEARM QFBLNO(E) + SETZM QSMPRC(E) + SETZM QSMPRP(E) + MOVE T,[444400,,1] ;ASSUME BYTES=WORDS, WILL BE FIXED LATER + MOVEM T,QSBYTE(E) + SETZM QPCLSR(E) + HRRZM H,QUDPR(E) + SETZM QUDFPR(E) ;NOT YET SET UP TO ANY PARTICULAR FILE + MOVEM U,QUSR(E) ;CHANNEL IS NOW IN-USE + SOSGE QFCHN + BUG + JRST LSWPOP ;QCHSW + +;LOSSET ROUTINE TO RETURN TENTATIVELY ASSIGNED QSK CHNL +;E HAD BETTER CONTAIN THE QSK CHANNEL NUMBER AT "ALL" TIMES +QCHNRT: SKIPL T,AC0S+E(U) + CAIL T,NQCHN + BUG ;E CLOBBERED + HRRZ A,U ;LSWPOP MESSES WITH LH(U) + CAME A,QUSR(T) + BUG + SETOM QUSR(T) + AOS QFCHN + POPJ P, + +SUBTTL DELETE, RENAME +;COME HERE FOR DELETE, OR RENAME NOT WHILE OPEN, ON DISK. + +QRNAM: SKIPN SRN3(U) + JRST QDEL + PUSH P,A + PUSH P,B + SKIPN B,SRN4(U) + JRST QPNL11 + MOVE A,SRN3(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL13 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL13 + POP P,B + POP P,A + PUSH P,SRN3(U) + PUSH P,SRN4(U) + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST [ SUB P,[2,,2] + JRST QROR1C ] ;GIVE FILE NOT FOUND OR FILE LOCKED + MOVE I,Q + POP P,B + POP P,A + PUSHJ P,QGRLSC + JRST QPNLBN ;FILE ALREADY EXISTS + PUSHJ P,QFNG +QRNAM4: PUSHJ P,QLOOK + JRST QRNAM3 + CAME I,Q ;ALLOW RENAME THAT DOESN'T CHANGE NAMES. + JRST QPNL13 +QRNAM3: MOVE Q,I + MOVSI TT,UNDUMP ;SAY FILE NOT DUMPED. + ANDCAM TT,UNRNDM(Q) + MOVNI E,1 ;TELL QFREF NOT TO CLOBBER NON-EX DISK CHNL. + PUSHJ P,QFREF ;"REFERENCE" FILE + PUSHJ P,QRELOC ;STORE NEW NAMES IN DIR +QRNAM2: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QRNAM1: MOVE U,USER ;U MAY NOT HAVE USER IF CAME HERE FROM LOGOUT + PUSHJ P,LSWCLR + JRST POPJ1 + +QGRLSC: CAME A,[SIXBIT />/] ;SKIP NONE IF BOTH A+B ARE SPECIAL + CAMN A,[SIXBIT //] ;AND TWICE IF NEITHER + CAMN B,[SIXBIT / LOOK UP FILE TO DELETE +;Q .NE. 0 => DELETE FILE POINTED TO BY QUDFPR OF CHNL IN D +;H MUST HAVE DIR SLOT INDEX +QDELA: MOVEI Q,0 +QDLA1: PUSHJ P,SLUGH + QCHSW + 1000,,QSNLCN(H) + 1000,,QTUTO(I) + JUMPN Q,QDLA2 + PUSHJ P,QLOOK + JRST QDEL4A ;FNF + SETO D, ;NO ASSOCIATED CHANNEL +QDLA3: LDB A,[UNLNKB+UNRNDM(Q)] + LDB TT,[UNPKN+UNRNDM(Q)] + CAME TT,J + JUMPE A,QDELA1 ;ON DIFFERENT DISK (DIDN'T LOCK RIGHT TUT TRY AGAIN) + MOVE A,Q + SUB A,QSNLCN(H) + MOVSI J,-NQCHN +QDEL1: CAIN D,(J) + JRST QDEL2 ;IGNORE CHANNEL (IF ANY) WHOSE CLOSING CAUSED THIS + HRRZ TT,QUDPR(J) + SKIPL QSCRW(J) ;ONLY LOOK AT READ CHNLS + CAIE TT,(H) + JRST QDEL2 + HRRZ TT,QUDFPR(J) + SKIPL QUSR(J) + CAIE TT,(A) + JRST QDEL2 + MOVSI TT,%QADEL ;FOUND CHNL WITH THIS FILE OPEN + IORM TT,QSRAC(J) ;DELETE FILE WHEN THIS CHNL CLOSED + MOVSI TT,UNCDEL ;SET DELETED BIT + IORM TT,UNRNDM(Q) +QDEL4: MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVE TT,DCHBT(I) + IORM TT,QTUTO(I) +QDEL4B: PUSHJ P,QTULK + PUSHJ P,QUDULK + PUSHJ P,LSWPOP + JRST POPJ1 + +QDLA2: MOVE Q,QUDFPR(D) ;COMPUTE FILE ADR FROM CHNL IN D + ADD Q,QSNLCN(H) ;DIR MAY HAVE MOVED + JRST QDLA3 + +QDEL4A: SOS (P) + JRST QDEL4B + +QCDLWO: PUSH P,R ;OUTPUT CLOSE BUT FILE WAS DELEWO'ED + SETZM QSCRW(D) ;FAKE OUT ERROR CHECK AT QSQSH6 + PUSHJ P,QUDULK +QSICLD: MOVE H,QUDPR(D) ;ENTRY FROM INPUT CLOSE, FILE WAS DELETED + MOVE I,QDSKN(D) + PUSHJ P,QUDLK + MOVE Q,QSNLCN(H) + ADD Q,QUDFPR(D) + MOVE J,QPKID(I) + PUSHJ P,QUDULK + PUSH P,D + PUSHJ P,QDLA1 + BUG ;FILE ISNT THERE? + POP P,D + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QICLX + +QDELA1: PUSHJ P,QDEL4B ;NOT OUR DISK IN J + JFCL + MOVE J,TT ;DISK ITS REALLY ON +QDELA2: MOVSI I,-NQS ;TRANSLATE PACK # IN J TO DRIVE # IN I + CAME J,QPKID(I) + AOBJN I,.-1 + JUMPGE I,QPKNF1 + JRST QDELA + +QSOCLD: PUSH P,D ;DELETE FILE WHEN CLOSING OVER IT + PUSH P,R + LDB J,[UNPKN+UNRNDM(Q)] + PUSHJ P,QUDULK + PUSHJ P,QDELA2 + JFCL +QPKNF7: POP P,R + POP P,D + POPJ P, + +QPKNF1: PUSHJ P,QPKNFP ;MAYBE TUT NOT IN YET? + JRST QDELA2 ;YUP, TRY AGAIN + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST QUDULK ;GONE AWAY BETWEEN LOCKS + JRST QDFPK ;GO DELETE OFF OF NON-MOUNTED PACK + +QDL2: PUSHJ P,QTULK ;DELETE LINK + MOVEI T,2 + PUSHJ P,LSWPON ;UNLOCK QCHSW +QDLINK: LDB E,[UNDSCP+UNRNDM(Q)] + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + HLL E,QBTBLI(TT) + ILDB A,E + SKIPN E + BUG ;NULL LINK? + MOVEI B,0 +QDL1: DPB B,E ;CLEAR OUT THE CHAR + CAIN A,': + IDPB B,E ;CLEAR A QUOTED CHAR WITHOUT LOOKING AT IT + ILDB A,E + JUMPN A,QDL1 + PUSHJ P,QSQSH ;REMOVE ENTRY + MOVE TT,QACTB + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + JRST POPJ1 + +QDEL2: AOBJN J,QDEL1 ;CHECK NEXT DISK CHANNEL + MOVE C,UNRNDM(Q) ;NOT OPEN, SO REALLY DELETE IT + TLNE C,UNLINK + JRST QDL2 + ANDI C,.BM UNDSCP + IDIVI C,UFDBPW + ADD C,QSNLCN(H) + ADDI C,UDDESC + HLL C,QBTBLI(D) ;GET DESCRIPTOR POINTER IN C AND TT + MOVE TT,C + MOVEI A,0 + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE + PUSH P,A + SKIPN D,QSFBT(H) ;SEE IF ENOUGH QSFBT STORAGE EXISTS + JRST QDEL11 +QDEL10: HLRE B,(D) ;NUMBER OF FREE LOCATIONS IN THIS PAGE + ADD A,B ;DECREASE LOCATIONS NEEDED + MOVE D,1(D) ;CDR + JUMPN D,QDEL10 +QDEL11: JUMPLE A,QDEL12 ;JUMP IF SUFFICIENT STORAGE EXISTS + PUSHJ P,TCALL ;GET MORE + JRST IOMQ + JRST [ MOVE U,USER ;U MAY NOT HAVE USER IF CAME FROM LOGOUT + PUSHJ P,LSWCLR ;HAVE TO WAIT FOR MEMORY + PUSHJ P,MQTEST ;AVOID DEADLOCKS BY UNLOCKING EVERYTHING + PUSHJ P,UFLS + JRST UUOTRO ] + MOVEI D,MU23FB + DPB D,[MUR,,MEMBLT(A)] + LSH A,10. + MOVEI D,2(A) + HRLI D,-1776 + MOVEM D,(A) + MOVE D,A + EXCH A,QSFBT(H) ;ADD TO FRONT OF LIST + MOVEM A,1(D) + MOVE A,(P) ;GET BACK NUMBER OF BLOCKS NEEDED + JRST QDEL10 ;SEE IF THERE ARE ENOUGH NOW + +QDEL12: POP P,A ;GET RID OF BLOCKS COUNT + PUSHJ P,QSQSH ;REMOVE ENTRY, CANNOT PCLSR AFTER THIS + CLEARB J,D ;J GETS NUMERIC TRACK NUMBER, D BYTE POINTER TO TUT + MOVE TT,QTUTO(I) ;D ZERO SO WILL HALT IF DESC DOESN'T START WITH LOAD-ADDR! + MOVE Q,QSFBT(H) ;Q -> AOBJN POINTER FOR STORING BLOCK NUMBERS +QDEL3: ILDB B,C ; INTO QSFBT AS DESCRIPTORS ARE ZEROED OUT + MOVEI A,0 ;I DISK, C BP TO DESCRIPTOR, A,B,E TEMP. + DPB A,C + JUMPE B,QDEL4 ;END OF FILE DESCRIPTION + TRNE B,40 + JRST QDEL6 + CAILE B,UDTKMX + JRST QDEL7 +QDEL8: SKIPN Q + BUG ;OOPS, OUT OF QSFBT STORAGE + SKIPL E,(Q) ;PICK UP AOBJN POINTER + JRST [ MOVE Q,1(Q) ;THIS PAGE FULL, TRY NEXT + JRST QDEL8 ] + MOVEM J,(E) ;STORE DISK,,BLOCK FOR LATER FREEING + AOBJN E,.+1 + MOVEM E,(Q) ;INCREMENT POINTER + MOVE E,QSNLCN(H) ;DECREASE DIR'S BLOCKS-USED + HRRZ A,UDBLKS(E) + SOSL A + HRRM A,UDBLKS(E) + ILDB A,D ;CHECK TUT + SKIPN A + BUG ;TUT SHOWS TRACK NOT USED + AOS J ;DO NEXT BLOCK IN CONTIGUOUS GROUP + SOJG B,QDEL8 + JRST QDEL3 + +IFN NXLBYT-2, .ERR THIS ROUTINE AND OTHERS KNOW IMPLICITLY THAT NXLBYT=2 +QDEL6: MOVEI D,0 ;LOAD ADDRESS + DPB B,[140500,,D] + ILDB B,C + DPB B,[060600,,D] + DPB A,C ;A HAS ZERO FROM QDEL3 + ILDB B,C + DPB B,[0600,,D] + DPB A,C + MOVE J,D + HRL J,I + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + JRST QDEL7A + +QDEL7: CAIN B,UDWPH + JRST QDEL3 + SUBI B,UDTKMX + ADD J,B + IBP D + SOJG B,.-1 +QDEL7A: MOVEI B,1 ;LOAD ADDRESS OR SKIP AND TAKE, SO ONLY ONE TRACK + JRST QDEL8 + +QDFNF: PUSHJ P,OPNL4 + JRST URET + +QDELB: CONO PI,UTCON + JRST QDELA + +;PERFORM BLOCK-FREEING SPECIFIED BY QFBTS +QDLFBT: CONO PI,UTCOFF ;PROTECT QFBTS + SKIPN B,QFBTS + JRST UTCONJ + MOVE T,1(B) + MOVEM T,QFBTS + CONO PI,UTCON + HRRZ T,(B) ;FIRST FREE LOCATION + SUBI T,2(B) ;NUMBER OF LOCATIONS TO DO + HRLO A,T + EQVI A,1(B) + AOBJP A,QDLFB9 ;A NOW -> BLOCKS TO FREE, & CHECK FOR EMPTY + SETO I, ;NO TUT LOCKED YET +QDLFB1: HLRZ J,(A) ;DISK NUMBER + CAMN J,I ;MAKE SURE RIGHT TUT IS LOCKED + JRST QDLFB2 + SKIPL I + PUSHJ P,QTULK + MOVE I,J + PUSHJ P,QTLOCK +QDLFB2: HRRZ D,(A) ;BLOCK NUMBER TO FREE + PUSHJ P,TUTPNT + CAIGE B,TUTMNY ;USED IN "MANY" FILES(1,2,...,TUTMNY,TUTLK) + SOJL B,[JRST 4,.] ;HALT IF TUT SHOWS TRACK NOT USED + JUMPN B,QDLFB3 ;NOT LAST USE + HRRZ T,(A) ;BLOCK NUMBER AGAIN + MOVE TT,QTUTO(I) + CAML T,QSWAPA(TT) + AOSA QSFT(I) + AOS QSFTS(I) ;TRACK IN SWAPPING AREA +QDLFB3: DPB B,D ;DECREASE USAGE COUNT IN TUT + AOBJN A,QDLFB1 + PUSHJ P,QTULK +QDLFB9: MOVEI A,-1(A) ;GET AN ADDRESS ON THAT PAGE + LSH A,-10. ;DONE WITH THIS PAGE, FREE IT + PUSHJ P,TMEMR ;RETURN PAGE TO FREE AND TRY FOR MORE + MU23FB + JRST QDLFBT + +;REMOVE HOLE FROM NAME AREA AT Q +QSQSH: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,TT + HRRZ TT,QSNLCN(H) + MOVE A,UDNAMP(TT) + CAILE A,2000 + BUG ;UDNAMP BAD + ADDI A,(TT) + HRRZ C,Q + SUB C,A + SKIPL C + CAIL C,2000-UDDESC + BUG ;Q BAD + HRRZ C,Q +QSQSH1: SUBI C,LUNBLK + CAMLE A,C + JRST QSQSH2 + HRLZ B,C + HRRI B,LUNBLK(C) + BLT B,2*LUNBLK-1(C) + JRST QSQSH1 + +QSQSH2: +REPEAT LUNBLK,SETZM .RPCNT(A) + SUBI A,-LUNBLK(TT) + HRRZM A,UDNAMP(TT) + HRRZ C,Q + SUBI C,(TT) ;INDEX OF DELETED FILE + HRRZI TT,-LUNBLK(A) ;INDEX OF OLD BEGINNING OF NAME AREA + MOVSI A,-NQCHN +QSQSH3: HRRZ B,QUDPR(A) + SKIPL QUSR(A) + CAIE B,(H) + JRST QSQSH4 + SKIPN B,QUDFPR(A) + JRST QSQSH4 + CAIGE B,(TT) + BUG + CAIN B,(C) + JRST QSQSH6 ;PNTR TO FLUSHED HOLE, CHECK IF READ CHNL + CAIG B,(C) ;IF AFTER DELETED FILE DON'T RELOCATE + ADDI B,LUNBLK + HRRZM B,QUDFPR(A) + SKIPL QSCRW(A) + JRST QSQSH4 ;READ CHNL + ADD B,QSNLCN(H) + MOVE B,UNRNDM(B) + TLNN B,UNWRIT + BUG ;CHNL WRITING BUT BEING WRITTEN BIT NOT SET +QSQSH4: AOBJN A,QSQSH3 + POP P,TT + POP P,C + POP P,B + POP P,A + POPJ P, + +QSQSH6: MOVE B,QSRAC(A) ;FOUND PNTR TO DELETED FILE + TLNE B,%QADEL ;SKIP IF NOT DELETE AFTER CLOSE + SKIPGE QSCRW(A) ;ALSO ERROR IF NOT READ CHNL + BUG + JRST QSQSH4 ;WAS DELETE AFTER CLOSE ON READ CHNL + +SUBTTL DIRECTORY LOOK UP, > FEATURE + +;A contains the FN1 and B contains the FN2. +;H is the index of the directory slot. The dir must be locked. + +;Returns the address of the filename block in Q. +;Clobbers C. + +;Internally, J and Q point to the bottom and top of the +;area of the dir we are still searching. +;Bit 4.9 of J is set to indicate one of the names is ">". +;C used as a flag: sign bit says creating a file. +;Bit 1.1 of C says FN2 is > or <. + +;Look for place to create new file, +;and generate new version for >. +QFNG: MOVEM Q,EPDL3(U) + SKIPA C,[SETZ] +;Look for existing files only +QLOOK: MOVEI C,0 + PUSH P,J + HRRZ J,QSNLCN(H) + MOVEI Q,2000-LUNBLK(J) + ADD J,UDNAMP(J) + CAMN A,[SIXBIT />/] + TLOA J,400000 + CAMN A,[SIXBIT / + CAMN B,[SIXBIT />/] + TLOA J,400000 + CAMN B,[SIXBIT //] + JRST POPJJ ;MUST BE READ RETN FILE NOT FOUND +QLOOK1: JUMPGE C,QLOOK9 + CAMN B,[SIXBIT /" +QLOOK9: PUSH P,D + PUSH P,TT + PUSH P,I + PUSH P,[-1] ;BEST INDEX + PUSH P,[SETZ] ;BEST "NUMERIC" PART + PUSH P,[SETZ] ;BEST ALPHA PART +QLOOK4: CAIGE Q,(J) + JRST QLOOK2 + XCT QLKI1(C) + JRST QLOOK3 + MOVE D,UNRNDM(Q) + TLNE D,UNIGFL + JUMPGE C,[ SKIPGE -2(P) ;FILE LOCKED, REMEMBER IT IF WE HAVE NO BETTER, + HRRM Q,-2(P) ; BUT DON'T CONSIDER IT IF READING + JRST QLOOK3 ] ;BUT IF WRITING, CONSIDER ALL FILES + SKIPE TT,@QLKI1+1(C) +QLOOK6: TRNE TT,77 ;RIGHT ADJ + JRST QLOOK5 + LSH TT,-6 + JRST QLOOK6 + +QLOOK5: MOVEI I,0 +QLOOK8: LDB D,[600,,TT] + CAIL D,'0 + CAILE D,'9 + JRST QLOOK7 ;NOT A DIGIT +QLOK5B: TRNE I,77 ;RIGHT ADJ LOW NON NUM PART + JRST QLOK5A + LSH I,-6 + JUMPN I,QLOK5B +QLOK5A: TLC TT,400000 ;AVOID CAM LOSSAGE + TLC I,400000 + SKIPGE -2(P) + JRST QLOK5D ;FIRST MATCH + JUMPGE J,QLOK5E ;GET LEAST + CAMGE TT,-1(P) ;GET GREATEST + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMGE I,(P) + JRST QLOOK3 ;NOT AS GOOD +QLOK5D: HRRZM Q,-2(P) + MOVEM TT,-1(P) + MOVEM I,(P) +QLOOK3: SUBI Q,LUNBLK + JRST QLOOK4 + +QLOK5E: CAMLE TT,-1(P) + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMLE I,(P) + JRST QLOOK3 + JRST QLOK5D + +QLOOK7: LSHC TT,-6 ;LOW DIGIT NOT NUMERIC + JUMPN TT,QLOOK8 ;NO NUMERIC DIGITS AT ALL ("BIN", MAYBE?) + JUMPL J,QLOK5B ;IF LOOKING FOR GREATEST, LET THIS BE LEAST + MOVNI TT,1 ;GREATEST IF LOOKING FOR LEAST + JRST QLOK5B + +QLOOK2: JUMPL C,QFNG1 ;REALLY WANT TO MAKE F.N.'S FOR WRITE + SUB P,[1,,1] + POP P,C ;BEST "NUMERIC" PART + POP P,Q ;ADR + POP P,I + POP P,TT + POP P,D + AOJE Q,POPJJ + MOVE A,UNFN1-1(Q) ;ACTUAL MATCHED FILE NAMES + MOVE B,UNFN2-1(Q) + SOJGE Q,POPJJ1 ;FOUND A FILE THAT WASN'T LOCKED + MOVEI Q,-LUNBLK(Q) + JRST POPJJ + +QFNG1: SKIPGE -2(P) + JRST QFNG2 ;NOT FOUND START W/ 1 + MOVE TT,-1(P) + TLC TT,400000 + MOVE I,[600,,TT] +QFNG3: LDB D,I + CAIL D,'0 + CAILE D,'9 + JRST QFNG4 ;REACH END OF NUMERIC FIELD + AOS D + CAILE D,'9 + JRST QFNG5 + DPB D,I +QFNG5A: TLNE TT,770000 + JRST QFNG3A + LSH TT,6 + JRST QFNG5A + +QFNG2: MOVSI TT,(SIXBIT /1/) +QFNG3A: MOVEM TT,A(C) ;STORE INTO A OR B AS APPRO + SUB P,[3,,3] + POP P,I + POP P,TT + POP P,D + MOVE Q,EPDL3(U) + JRST POPJJ + +QFNG5: MOVEI D,'0 + DPB D,I + ADD I,[60000,,] + JUMPL I,QFNG5A + JRST QFNG3 + +QFNG4: TLNN TT,770000 ;SKIP ON ALREADY 6 CHAR NAME + LSH TT,6 + MOVEI D,'1 + DPB D,I + MOVEI D,'0 +QFNG4B: TLNN I,770000 + JRST QFNG5A + IDPB D,I + JRST QFNG4B + +QLKI1: CAME B,UNFN2(Q) + CAME A,UNFN1(Q) + UNFN2(Q) + +QPKNF: MOVE C,QSNUD(H) + PUSHJ P,QUDULK ;UNLOCK DIR + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,QPKNFP + JRST QSKOL + PUSHJ P,OPNL16 ;PACK NOT MOUNTED + JRST URET + +QPKNFP: MOVSI I,-NQS +QPKNF3: SKIPGE QACT(I) + JRST QPKNF4 + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) + TLNE TT,40000 + JRST QPKNF2 ;PACK NOT IN OR NOT PAWED OVER +QPKNF4: AOBJN I,QPKNF3 + JRST POPJ1 + +QPKNF2: JRST QTCH1 ;MAYBE THIS UNIT HAS GOODIES + +QFDF: PUSHJ P,OPNL5 ;FILE DIR FULL ON WRITE + JRST URET + +QPNL13: PUSHJ P,OPNL13 + JRST URET + +QPNL22: PUSHJ P,OPNL22 + JRST URET + +QPNLBN: +QPNL11: PUSHJ P,OPNL11 + JRST URET + +;ROUTINE TO FIND PLACE IN DIRECTORY WHERE A B WOULD GO +;SKIPS ONLY IF DIRECTORY CONTAINS AT LEAST ONE FILE +;FOR INSERTION, FILE GOES BEFORE PNTR RETURNED IN J +;RETURNS PNTR IN Q TO BEGINNING OF NAME AREA +;(ONLY WORKS FOR LUNBLK = 5) +QLGLK: HRRZ J,QSNLCN(H) + HRRZ Q,UDNAMP(J) + ADDI Q,(J) + CAIL Q,2000(J) + POPJ P, ;DIRECTORY EMPTY + TLC A,(SETZ) + TLC B,(SETZ) + PUSH P,D + PUSH P,E + ADDI J,600 ;128. NAME BLOCKS FROM END +REPEAT 7,[ ;THIS CODE DELIBERATELY NOT INDENTED. NEED 4 DIMENSIONS. + CAMGE J,Q + JRST .+6 + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAMN A,D + JSP E,QLGLE + CAML A,D + ADDI J,<1_<7-.RPCNT>>*LUNBLK + SUBI J,<1_<6-.RPCNT>>*LUNBLK +] + CAMGE J,Q + ADDI J,LUNBLK + CAMGE J,Q + BUG + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAME A,D + JRST QLGL1 + MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMLE B,D +QLGL2: ADDI J,LUNBLK +QLGL3: TLC A,(SETZ) + TLC B,(SETZ) + POP P,E + POP P,D + JRST POPJ1 + +QLGL1: CAML A,D + JRST QLGL2 + JRST QLGL3 + +;CALL BY JSP E,QLGLE +QLGLE: MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMN B,D + JRST QLGL3 + CAML B,D + JRST 1(E) + JRST 2(E) + +SUBTTL LOCKING ROUTINES + +QMLOCK: PUSHJ P,LSWTL + QMDRO + POPJ P, + +QMULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QMDRO + BUG + POP P,U + JRST LSWPOP + +QTLOCK: PUSHJ P,LSWTL + QTUTO(I) + POPJ P, + +QTULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QTUTO(I) + BUG + POP P,U + JRST LSWPOP + +QUDLK: PUSHJ P,LSWTL + QSNLCN(H) + POPJ P, + +QUDULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QSNLCN(H) + BUG + POP P,U + JRST LSWPOP + +SBTBLI: +QBTBLI: 440600,, ;IF GOING TO ILDB +SBTBL: +QBTBL: 360600,, + 300600,, + 220600,, + 140600,, + 060600,, + 000600,, + +TBTBL=.+1 +TBTBLI: REPEAT 1+TUTEPW, TUTBP-<.RPCNT*TUTBYT*010000,,> + +SUBTTL DIRECTORY GARBAGE COLLECTOR + +; MOVE H, directory number +; lock the directory +; PUSHJ P,QGC +; return if directory full. +; return if won. +; No ACs clobbered. +; All pointers to directory relocated appropriately. + +; Called from disk open routines if a new file is to be created +; and there are less than 6+LUNBLK words in the free area of the directory. +; Called from QSBWG if %QAFUL is set in QSRAC. +; %QAFUL means "must have successful GC before committing another track to this file." + +;NOTE NOTE NOTE: +; This GC allocates an extra block of core for temporary storage. +; If no memory is free in low half, waits without unlocking directory. +; Can possibly PCLSR. No deadly embrace to not unlock directory since +; it can't be flushed from core anyway and it's not holding anything else in. + +QAPBMN==NXLBYT+3 ;minimum number of descriptor bytes which + ; must be available at the end of a file to + ; commit another track to the file. + ;1 for a take-N, NXLBYT+1 for jump, 1 for ending zero. +QAPBMX==36. ;maximum number of descriptor bytes to allocate at a time. + +QGC: IRPC X,,ABCDQIJTR + PUSH P,X + TERMIN + +;Old GC prints message on system console. Any reason to with fast one? + +; validate the directory + +QGC00: SKIPL A,QSNLCN(H) + BUG ;directory not locked + MOVE C,UDNAME(A) + MOVEM C,LASTGC ;save name of last dir GCed + CAME C,QSNUD(H) + BUG ;directory clobbered + SKIPLE C,UDNAMP(A) + CAILE C,2000 + BUG ;name pointer out of bounds + IMULI C,UFDBPW + SKIPL D,UDESCP(A) + CAIL D,-UDDESC*UFDBPW(C) + BUG ;descriptor/name overlap + +; Get a block of core to use for temporary storage. +; The block is left in the "in-process" state. + + HRRZ Q,A + PUSHJ P,TCALL + JRST IOMQ + JRST [ PUSHJ P,UDELAY ;no core available in low half + JRST QGC00 ] ;so wait, then loop back to beginning + LSH A,10. + MOVEI B,1(A) ;zero it out + HRL B,A + SETZM (A) + BLT B,1777(A) + EXCH Q,A ;A -> directory, Q -> temporary core +;Drops through + ;Drops in +; Scan the directory and count: +; I all files +; J files open for writing +; R active bytes of descriptor + + SETZB I,J + SETZ R, + MOVEI B,2000(A) ;end of name area + ADD A,UDNAMP(A) ;start of name area +QGC10: CAML A,B + JRST QGC19 ;jump if all files done + SKIPE UNFN2(A) + SKIPN UNFN1(A) + BUG ;zero name block? + AOJA I,QGC12 ;file exists + +QGC11: ADDI A,LUNBLK ;advance to next file + AOJA R,QGC10 ;also count the zero byte that ends the descriptor + +QGC12: MOVE C,UNRNDM(A) + TLNE C,UNWRIT + ADDI J,1 + ANDI C,.BM UNDSCP ;get descriptor ptr (undscp has pos=0) + IDIVI C,UFDBPW + HLL C,QBTBLI(D) + ADDI C,UDDESC-2000(B) + MOVE D,UNRNDM(A) + TLNE D,UNLINK + JRST QGC14 +QGC13: ILDB T,C ;get byte of descrip + JUMPE T,QGC11 ;eof + CAIG T,UDWPH + AOJA R,QGC13 ;1-byte desc +REPEAT NXLBYT, IBP C ;multi-byte desc + ADDI R,NXLBYT+1 + JRST QGC13 + +QGC14: ILDB T,C ;count bytes of link descriptor + JUMPE T,QGC11 + CAIN T,': + AOJA R,[IBP C ;quoted + AOJA R,QGC14 ] + AOJA R,QGC14 + + +; Compute number of bytes of descriptor to add after each +; file open for output. If > QAPBMX, set to QAPBMX. +; If < QAPBMN, take directory-full exit. + +QGC19: MOVE C,I ;save number of files + IMULI I,LUNBLK*UFDBPW ;number of bytes in name area + ADDI R,UDDESC*UFDBPW(I) ;R := total number of bytes claimed + MOVEI A,2000*UFDBPW-1 + SUB A,R ;A := number of bytes left + SKIPE J + IDIV A,J ;number of bytes available to extend open files + CAIGE A,QAPBMN + JRST QGC69 ;if < minimum, dir. full + CAILE A,QAPBMX + MOVEI A,QAPBMX ;limit to at most QAPBMX bytes at a time +;Drops through + ;Drops in +; A = number of bytes of room to leave after each file open for writing +; B -> name block under consideration +; C -> old descriptors +; D = disk channel number under consideration. Also D = C+1 +; J counts new descriptor bytes generated +; Q -> new descriptors (in temporary core block) +; R -> base of directory + + SETZ J, + HRRZ R,QSNLCN(H) ;old dir + ADDI Q,UDDESC ;new dir + HLL Q,QBTBLI + MOVE B,UDNAMP(R) + ADD B,R + +; Loop over files + +QGC20: CAIL B,2000(R) + JRST QGC40 ;all files done + LDB C,[UNDSCP UNRNDM(B)] ;get old desc ptr + DPB J,[UNDSCP UNRNDM(B)] ;store new desc ptr + +; Loop over all disk channels, relocating the ones that point to this file + + MOVSI D,-NQCHN +QGC31: HRRZ T,QUDPR(D) + SKIPL QUSR(D) + CAIE T,(H) + AOBJN D,QGC31 ;not in use or not same directory + JUMPGE D,QGC39 ;jump if all disk channels done + LDB T,[1200,,B] + CAME T,QUDFPR(D) + JRST QGC32 ;not same file + MOVE T,J ;relocate descriptor pointer + SUB T,C + ADDM T,QDIRP(D) +QGC32: AOBJN D,QGC31 + +QGC39: IDIVI C,UFDBPW ;make desc pntr into byte pointer + HLL C,QBTBLI(D) + ADDI C,UDDESC(R) + MOVE T,UNRNDM(B) + TLNE T,UNLINK + JRST QGC22 +QGC21: ILDB T,C ;copy descriptor bytes of a file into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIG T,UDWPH + AOJA J,QGC21 +REPEAT NXLBYT,[ + ILDB T,C + IDPB T,Q +] ADDI J,NXLBYT+1 + JRST QGC21 + +QGC22: ILDB T,C ;copy descriptor bytes of a link into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIN T,': + AOJA J,[ILDB T,C + IDPB T,Q + AOJA J,QGC22 ] + AOJA J,QGC22 + +QGC23: MOVE T,UNRNDM(B) + TLNN T,UNWRIT + JRST QGC25 + ADD J,A ;file being written, increase desc area + MOVE T,A + IBP Q + SOJG T,.-1 + +QGC25: ADDI B,LUNBLK ;next file + AOJA J,QGC20 ;also account for final zero at end of descriptor + +; Paranoia: check that all disk channels to this directory look OK + +QGC40: MOVEM J,UDESCP(R) ;store free-desc pointer + LDB A,[1200,,Q] ;last word used by descriptors + CAML A,UDNAMP(R) + BUG ;overlap + ANDI Q,-2000 ;base of temp core block again + MOVSI A,-NQCHN +QGC41: HRRZ T,QUDPR(A) + SKIPL QUSR(A) + CAIE T,(H) + AOBJN A,QGC41 ;channel not in use, or to some other dir + JUMPGE A,QGC49 ;all channels done + SKIPN B,QUDFPR(A) ;get file open on this channel + JRST QGC42 ;channel not set up to any particular file + CAIGE B,2000 + CAMGE B,UDNAMP(R) + BUG ;file pointer screwed + ADD B,R + SKIPL J,QDIRP(A) ;get descriptor pointer + CAMLE J,UDESCP(R) + BUG ;descriptor pointer screwed + LDB C,[UNDSCP UNRNDM(B)] + CAIGE B,2000-LUNBLK(R) ;skip if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get desc pntr for next file + CAIL B,2000-LUNBLK(R) + MOVEI D,2000*UFDBPW ;but if last file, get infinity + CAML J,C ;verify that QDIRP points to this file + CAML J,D + BUG +QGC42: AOBJN A,QGC41 ;do next channel + +; If you thought that was paranoid, get a load of this: + +QGC49: MOVE B,UDNAMP(R) + ADD B,R +QGC50: CAIL B,2000(R) + JRST QGC60 + LDB C,[UNDSCP UNRNDM(B)] + SOS C + IDIVI C,UFDBPW ;NOTE if UNDSCP = 0 we depend on bytes + HLL C,QBTBL(D) ; off left end of word LDB'ing as zero + ADDI C,UDDESC(Q) + LDB T,C + SKIPE T + BUG ;descriptor not preceeded by zero + MOVE J,UNRNDM(B) + TRZ J,#.BM UNDSCP ;LH(J) flags, RH(J) just desc pntr + TLNE J,UNLINK + JRST QGC52 +QGC51: ILDB T,C + JUMPE T,QGC53 + CAIG T,UDWPH + AOJA J,QGC51 +REPEAT NXLBYT, IBP C + ADDI J,NXLBYT+1 + JRST QGC51 + +QGC52: ILDB T,C + JUMPE T,QGC53 + CAIE T,': + AOJA J,QGC52 + IBP C + ADDI J,2 + JRST QGC52 + +QGC53: TLNE J,UNWRIT ;RH(J) has desc pntr to the zero that ends the file + ADDI J,QAPBMN ;if being written, needs room for one more track + CAIL B,2000-LUNBLK(R) ;now set D to point to next descriptor area + SKIPA D,UDESCP(R) ;do this instr if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get next file's desc pntr + CAIG D,(J) + BUG ;descriptors overlap + ADDI B,LUNBLK + JRST QGC50 + +; Copy the descriptors back into the directory + +QGC60: MOVSI C,UDDESC(Q) ;make BLT pointer to copy it back + HRRI C,UDDESC(R) + MOVE B,UDNAMP(R) ;use same BLT to zero out the free area + ADD B,R + BLT C,-1(B) + +; Take win return. + + AOS -9(P) +QGC69: LDB A,[121000,,Q] ;core block number of temporary page + PUSHJ P,TMEMR ;return it + MUINP ;verifying that it is the right one. + IRPC X,,RTJIQDCBA + POP P,X + TERMIN + POPJ P, + +SUBTTL INTERPRET DESCRIPTORS + +QFNTR: MOVE H,QUDPR(A) ;BYTE # IN Q CHNL # IN A + PUSHJ P,QUDLK ;DONT SKIP IF OFF FILE + MOVE T,QSNLCN(H) ;RETN BLOCK IN QSLGL(A) AND QSBI(A) DIR PNTR IN QDIRP(A) + ADD T,QUDFPR(A) ;FIRST ADR OF BLOCK IN QFBLNO(A) + LDB TT,[UNDSCP+UNRNDM(T)] ;CHAR ADR OF FILE BEG + MOVEM TT,QDIRP(A) ;SKIPS IF FINDS BLOCK AND LEAVES USER DIR LOCKED + CLEARM QSBI(A) + CLEARM QFBLNO(A) + CLEARB J,QSLGL(A) ;J HAS ORG OF FIRST NON-EX-BLOCK IF OFF END OF FILE +QFNT1A: PUSHJ P,QFNT1 + JRST QUDULK ;OFF END OF FILE RETN NOT SKIPPING + CAMLE J,Q + JRST QFNT7 ;LOCATED BLOCK CONTAINING WORD + MOVEM J,QFBLNO(A) + JRST QFNT1A + +QFNTN: MOVE H,QUDPR(A) ;LIKE ABOVE BUT SCAN FORWARD ONLY FROM CURRENT SPOT + PUSHJ P,QUDLK + PUSHJ P,QFNT1 + CAIA ;EOF, DON'T SKIP RETURN + AOS (P) + MOVEM J,QFBLNO(A) + JRST QUDULK + +QFNT1: SKIPE QSBI(A) ;DECODE NEXT BLOCK, CHNL IN A, SKIP UNLESS EOF. + JRST QFNT2 ;BLOCK # IN QSLGL FILE ADR IN J (TAKE N PENDING) +QFNT3: PUSHJ P,QMPDCH ;GOBBLE NEXT CHR OF DESC IN R (POINTED TO BY QDIRP) INCR QDIRP + CAIN R,UDWPH ;ALSO RET BYTE PNTR IN TT + JRST QFNT3 ;NULL + JUMPN R,QFNT8 ;NOT OFF END OF FILE + SOS QDIRP(A) + POPJ P, + +QFNT8: TRNE R,40 + JRST QFNT4 + CAILE R,UDTKMX + JRST QFNT6 ;SKIP AND TAKE + MOVEM R,QSBI(A) +QFNT2: SOS QSBI(A) + AOS QSLGL(A) +QFNT5: MOVEI J,2000 ;ACTIVE BYTES IN BLOCK + IMULI J,@QSBYTE(A) + ADD J,QFBLNO(A) + JRST POPJ1 + +QFNT7: MOVSI T,%QALBK ;SET UP PROC LAST BLOCK FLG AND RETN + ANDCAM T,QSRAC(A) ;CLEAR LAST BLOCK OF FILE BIT + SKIPE QSBI(A) + JRST QFNT7A ;NOT LAST BLOCK + ILDB R,TT ;GET NEXT CHR IN DIR + JUMPN R,QFNT7A + IORM T,QSRAC(A) ;PROCESSING LAST BLOCK +QFNT7A: AOS QSBI(A) ;FAKE OUT PI ROUTINE WHICH WILL TRY TO INCREMENT + SOS QSLGL(A) + JRST POPJ1 + +QFNT4: MOVEI J,0 ;LOAD ADR + DPB R,[140400,,J] + PUSHJ P,QMPDCH + DPB R,[060600,,J] + PUSHJ P,QMPDCH + DPB R,[0600,,J] + MOVEM J,QSLGL(A) + JRST QFNT5 + +QFNT6: MOVEI J,1-UDTKMX(R) + ADDM J,QSLGL(A) + JRST QFNT5 + EBLK + +SUBTTL DISK CHANNEL DATA AREAS + +QBFP: BLOCK NQCHN ;BUFFER LIST LH LAST RH FIRST + ;READ: PI IN MP OUT. WRITE: MP IN PI OUT. +SINLST: BLOCK NQS ;SWAP-IN LISTS FOR EACH DISK +SOUTLS: BLOCK NQS ;SWAP-OUT LISTS FOR EACH DISK + +;READ/WRITE LISTS LINK THROUGH MLO IN MEMBLT. +;LH(MEMPNT) HAS DISK ADDR, RH(MEMPNT) HAS # BYTES IN BLOCK IF FILE READ +;MWC IN MEMBLT HAS WORD COUNT IF WRITE (FOR EXTRA-WORDS) + +QFCHN: NQCHN ;NUMBER OF FREE QSK CHNLS (NOT COUNTING DIR WRITE AND SWAP CHANNELS) + +QUSR: REPEAT NQCHN,-1 ;USER +DWUSR: -1 ;0 IF DIR WRITE ACTIVE +SWUSR: REPEAT NQS,-1 ;0 IF SWAP XFER ACTIVE +QDIRP: BLOCK NQCHN ;CHAR ADR PNTR TO DESC AREA FOR FILE +QSLBLK: BLOCK NQCHN+NQS+1 ;LAST BLOCK NUMBER OF FILE WRITTEN +QSLGL: BLOCK NQCHN ;LAST QSGL +QSGL: REPEAT NQCHN+NQS+1,-1 ;-1 IDLE + ACTIVE TRACK + ;LAST NQS+1 FOR FD WRITE AND SWAPPING +QSBI: BLOCK NQCHN ; COUNT CONSECUTIVE BLOCKS +QSBFS: BLOCK NQCHN ;NUMBER OF BUFFS THIS CHNL +1 IF EOF AT PI WITH QSBFS=0 +QPCLSR: BLOCK NQCHN ;PCLSR STATUS OF MAIN PROGRAM - LOAD SYSTEM CALL +QSMDN: BLOCK NQCHN ;MAIN PRGM ACTIVE BUFFER NUM +OLDRDT: BLOCK NQCHN ;STORAGE FOR PREVIOUS REFERENCE DATE +QSRAC: BLOCK NQCHN+1 + REPEAT NQS, %QMSWP ;SWAPPING CHANNELS START OUT IN SWAP MODE + %QA==525252(1) + %QALOK==400000 ;4.9 CHNL LOCKED (NOT USED) + %QAEFR==200000 ;4.8 EOF REACHED READ + %QAEFW==100000 ;4.7 EOF WRITE + %QACTH==40000 ;4.6 DONT RELOAD. CORE JOB HUNG ON ACTIVE BUFFER + %QAFUL==20000 ;4.5 GC DIR BEFORE COMMITTING ANOTHER BLOCK TO FILE + %QADEL==10000 ;4.4 DELETE WHEN CLOSED + %QAACC==4000 ;4.3 FILE ADDRESS ALTERED BY .ACCESS OR OTHERWISE + %QAPAR==2000 ;4.2 NON RECOV PARITY ERR (OR OTHER DISK ERR) AT PI + %QAOUT==1000 ;4.1 ASSOC USER OUT DONT RELOAD (NOT IMPLEM.) + %QALBK==400 ;3.9 READ CHNL PROCESSING LAST BLOCK FLAG + %QAMPU==200 ;3.8 UPDATE QSMPRP, QSMPRC ON NEXT BUFFER GOBBLE + %QAWOV==100 ;3.7 FILLING OUT LAST BLK OF FILE IN WRITE OVER MODE PAST ORIG EOF + %QALNK==40 ;3.6 FILE IS REALLY A LINK + %QALOP==20 ;3.5 LINKS WERE TRACED IN OPENING THIS FILE. + %QARWT==10 ;3.4 MAKE WOULD-BE READERS WAIT (RATHER THAN GETTING FILE LOCKED ERROR) + %QAFNY==4 ;3.3 "FUNNY BLOCK", WORD COUNT IN LAST WORD + $QAMOD==220200 ;3.2-3.1 READ/WRITE MODE 0 NORMAL 1 WRITE OVER 2 COPY OVER WRITE + %QAMWO==1 ;3.1=1 => WRITE-OVER MODE. + %QM==777777 ;RH CHANNEL MODE. INDEX INTO ACTION TABLES USED AT PI LEVEL. +.SEE %QMIDL ;FOR TABLE OF CHANNEL MODES + +QDSKN: BLOCK NQCHN ;DISK UNIT NUMBER +DWSKN: 0 ;DISK WRITING DIR ON +SWSKN: REPEAT NQS,.RPCNT ;DISK SWAP XFER +QSCRW: BLOCK NQCHN ;0 READ -1 WRITE + -1 ;D.W. + BLOCK NQS ;SWAP +QSCABN: BLOCK NQCHN ;ACTIVE BUFFER NUMBER PI LEVEL OR -1 IF NONE +DWABN: -1 ;DISK D.W. A.B.N +SWABN: REPEAT NQS,-1 ;SWAP ABN +QUDPR: BLOCK NQCHN ;NUMBER OF ASSOCIATED USER DIR PNTR +QUDFPR: BLOCK NQCHN ;RELATIVE PNTR TO FILE AREA, ZERO IF NO PARTICULAR FILE +QMPTN: BLOCK NQCHN ;HAS LAST TRACK STORED IN DIRECTORY +QMPTC: BLOCK NQCHN ;MAIN PRGM TRACK COUNT +QMTTR: BLOCK NQCHN ;TRACK RESERVED OR -1 +QMFTP: BLOCK NQCHN+1 ;TRACK NUMBER FOR SCAN FOR FREE TRACKS IN TUT ON WRITE + REPEAT NQS,NUDSL; DITTO FOR SWAP CHANNELS +QERRS: BLOCK NQCHN+NQS+1 ;NUMBER ERRORS TRYING LAST OP +QSMPRP: BLOCK NQCHN ;MAIN PRGM BYTE POINTER +QSMPRC: BLOCK NQCHN ;M.P. COUNT (BYTES LEFT IN BUFFER) +QSBYTE: BLOCK NQCHN ;LH BYTE PNTR (P=44), RH BYTES PER WORD +QSBSIZ==300600,,QSBYTE ;BYTE POINTER TO CHANNEL BYTE SIZE +QFBLNO: BLOCK NQCHN ;BYTE # IN FILE OF BEG OF BLOCK BEING PROCESSED AT M.P. LEVEL +QRADAD: BLOCK NQCHN ;DESIRED BYTE ADR (LOOKED AT IF %QAACC OR %QAMPU IN QSRAC SET) +QPIBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN BLOCK ACTIVE AT P.I. LEVEL (READ) + ;BIT 4.9 => GET FROM LAST WORD IN BLOCK (%QAFNY) +QMPBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN MN PROG ACTIVE BUFFER +QLDPTR: BLOCK NQCHN .SEE NLDSBQ ;DURING SBLK LOADING, HOLDS THE AOBJN POINTER + ;INTO USER CORE FOR DOING A DISK TRANSFER ON. +QSMMP: BLOCK NQS ;MMP ADDRESS OF BLOCK ACTIVE ON SWAPPING CHANNEL + +;VARIABLES FOR CURRENT TRANSFER + +QSDU: -1 ;UNIT TRANSFERING DATA, -1 IF NONE. +QSDCH: -1 ;CHNL READY TO BE TRANSFERED ON QSDU +QERS1: -1 ;ERR VERIFY SWITCH -1 NO ERR 0 EXPECTING COMPLETION OF VERIFY OP +QDWIP: 0 ;NUMBER OF DIR WRITE IN PROGRESS 4.9=1=>MASTER + +IFN T300P,[ +QSDU1: -1 ;QSDU FOR OTHER CONTROLLER +QSDCH1: -1 ;ASSOCIATED CHANNEL +QTUNT1: -1 ;UNIT TO TRANSFER NEXT +QTCHN1: -1 ;CHANNEL TO TRANSFER NEXT +NRXFR1: 0 ;METERS +NWXFR1: 0 +NSRXF1: 0 +NSWXF1: 0 +LQTM1: 0 ;TIME LAST TRANSFER STARTED +];T300P + +;MASTER FILE DIRECTORY + +QMDRO: -1 ;ORIGIN OF MASTER DIR 4.9 IF LOCKED + ;-2 ON WAY IN + ;4.6 NOT IN + ;4.5, 4.4, 4.3, ... CHANGED + NOT WRITTEN UNIT 0, 1, 2, ... + ;3.2=1 NOT RECONCILED (NQFUS NOT SET UP) + ;3.1-3.5 MUST BE ZERO (AT LEAST AFTER ITS RECONCILED) +QAMDNO: -1 ;ASCENDING MASTER DIRECTORY NUMBER, -1 NOT SET UP +NQFUS: 0 ;NUMBER OF FREE LOSER SLOTS IN MFD + +;TRACK UTILIZATION TABLES + +QTUTO: REPEAT NQS,-1 ;ADDRESS OF TUT. LH SIMILAR TO QMDRO + ;4.9 LOCK + ;4.8 READ-IN NOT STARTED YET + ;4.6 NOT READ IN YET + ;CHANGED AND NOT WRITTEN ON UNIT + ;0 = 4.5 1 = 4.4 2 = 4.3 3 = 4.2 4 = 4.1 + ;5 = 3.9 6 = 3.8 + ;3.1-3.5 MUST BE ZERO +QDPWF: BLOCK NQS ;-1 TUT NOT RECONCILED (CALL QTCH1) +QTWRTM: BLOCK NQS ;TIME TUT LAST WRITTEN +QSFT: REPEAT NQS,-1 ;NUMBER TRACKS FREE IN USER AREA +QSFTS: BLOCK NQS ;NUMBER TRACKS FREE IN SWAPPING AREA +QPKNM: BLOCK NQS ;NAME OF PACK +QPKID: REPEAT NQS,-1 ;PACK ID OF DISK ON DRIVE +IFN QRSRVP,[ +QRESRV: REPEAT NQS,-1 ;NON-ZERO => PACK ON THIS DRIVE RESERVED. SET FROM TUT. + ;NOT 0 AND NOT -1 => SIXBIT DEVICE NAME FOR "SECONDARY" PACK +];QRSRVP +NTBL: ;NUMBER OF BLOCKS IN TUT ON THIS DRIVE +IFE T300P, REPEAT NQS, NTUTBL +IFN T300P,[ + REPEAT T300P, NTUTBL + REPEAT NQS-T300P, NTUTB1 +];T300P + +;POSITIONER VARIABLES (INDEXED BY PHYSICAL DRIVE) + +QSKT1: REPEAT NQS,-1 ;CHANNEL POSITIONER SET FOR OR -1 IF NONE +QRCAL: REPEAT NQS,0 ;-1 IF RECALIBRATING +QSPPS: REPEAT NQS,-1 ;INTENDED POSITIONER POSITION (NOT USED???) +QSEEK: BLOCK NQS ;-1 IF SEEKING +QPOS: REPEAT NQS,-1 ;CURRENT CYLINDER +QPOSGL: BLOCK NQS ;CYLINDER TRYING TO POSITION TO +IFN DC10P,[ +QRCTIM: BLOCK NQS ;RECALIBRATE TIMEOUT IN HALF SECONDS. THE ATTNS +];DC10P ; TEND TO GET LOST FOR SOME REASON + +;MISCELLANEOUS DISK VARIABLES + +QACT: REPEAT NQS,0 ;ONLY USE UNITS WITH 0 +QACTB: 0 ;4.5 UNIT 0 ACT 4.4 1 ACT 4.3 2 4.2 3 4.1 4 + ;3.9 5 3.8 6 +QWBUFS: 0 ;TOTAL NUMBER OF WRITE BUFFERS ACTIVE + +QWBFMX: 10.*DC10P+15.*RP10P+30.*RH10P+20.*RH11P ;MAX # ALLOWED. SHOULD BE + ; ABOUT 1 SEC DISK XFER. +QHUNGF: 0 ;-1 => DISK CONTROL HUNG, PI LEVEL SHOULD RESET, RECALIBRATE, RETRY +NTQHNG: BLOCK NQS ;NUMBER OF TIMES TRANSFER HUNG ON THIS UNIT + +QTUNT: 0 ;UNIT TO TRANSFER ON NEXT +QTCHN: 0 ;CHNL .. +QLCHN: 0 .SEE QINT2C +QWRU: -1 ;DEFAULT WRITE UNIT (-1 if there isn't a default unit yet) +MDSK: 0 ;DRIVE # OF MASTER DISK +QACTTM: -1 ;SETOM ON READ OR WRITE DATA TRANSFER + ;AOS AT SSLCK IF + OK TO WRITE DIRS + ;IE DON'T TIE UP DISK TO WRITE DIR UNLESS THINGS ARE QUIET +QDWFAR: -10. .SEE QINT3 ;WRITE DIRS SOME OF THE TIME ANYWAY +LQTM: 0 ;TIME AT WHICH LAST COMMAND GIVEN TO DISK +QFTTHR: 600. ;IF FREE TRKS ON QWRU GOES BELOW THIS, SWITCH TO UNIT WITH MOST FREE TRACKS +QRDAHD: IFE MCOND DM,[0] .ELSE 2 ;NUMBER OF BLOCKS TO READ AHEAD + +LASTGC: 0 ;NAME OF LAST DIRECTORY TO GET GC'ED + +;USER DIRECTORIES + +QNUD==40. ;NUMBER USER DIRECTORIES + +QFUD: QNUD ;NUMBER OF FREE UFD SLOTS + +QSNUD: BLOCK QNUD ;USER NAME OR 0 IF FREE +QSNLCN: BLOCK QNUD ;4.9 LOCKED, 4.8 ALSO NOT IN CORE RH CORE ADR + .SEE DCHBT ;4.6 =1 NOT PAWED OVER 4.5 CHNGD AND NOT WRITTEN ON UNIT 0 + ;4.4 UNIT 1 4.3 UNIT 2 4.2 UNIT 3 4.1 UNIT 4 + ;3.9 UNIT 5 3.8 UNIT 6 3.7 UNIT 7 + %QUDWM==40 ;3.6 WRITE IMMEDIATELY ON MASTER DISK + ;@ + XR BITS MUST = 0 + +QSNNR: BLOCK QNUD ;NUMBER PC'S LOOKING AT THIS IE + ;+1 FOR FILE OPEN AND USER IN CORE(?) +QSNMI: BLOCK QNUD ;TRACK N OF USER DIR IF NOT NEWLY CREATED +QSFBT: BLOCK QNUD ;FREED-BLOCKS-TABLE. HEAD OF A LIST OF PAGES, + ;THREADED THROUGH THE SECOND WORD AND ENDING WITH + ;ZERO. FIRST WORD IS AOBJN POINTER TO FREE PART + ;OF PAGE. FROM THIRD WORD UP TO BELOW WHERE AOBJN + ;POINTS ARE WORDS UNIT,,BLOCK WHICH RECORD DISK + ;BLOCKS TO BE FREED ONCE THE DIR HAS BEEN WRITTEN + ;OUT TO THE MASTER DISK. ELIMINATES REUSED ADDRESS + ;PROBLEMS BY GUARANTEEING THAT IF THE SYSTEM SHOULD + ;CRASH AT ANY TIME, THERE CANNOT BE TWO DIRECTORIES + ;ON DISK THAT BOTH POINT TO THE SAME BLOCK. + +IFN QRSRVP,[ +QSALLO: BLOCK QNUD ;-1 OR DRIVE # DIRECTORY ALLOCATED TO +] + +;LOCKS + +UDRSW: -1 ;USER DIR AREA LOCKED + 0 +QCHSW: -1 ;CHNL AREA LOCKED + 0 +QSKOSW: -1 ;QSKO1 LOCKED (USER DIR READIN) + 0 + +;LIST OF PAGES CONTAINING BLOCKS WHICH CAN NOW BE FREED. MOVED TO +;HERE FROM QSFBT WHEN THE DIR IS WRITTEN OUT. THE ACTUAL FREEING +;IS DONE BY THE CORE JOB. + +QFBTS: 0 + +;VARIABLES FOR SYSTEMS CONCEPTS DISK CONTROL + +IFN DC10P,[ +QRCSW: 105 ;- NO READ COMPARE 0 COMPARE WRITES + COMPARE ALL +QCST: 0 ;CONI DC0, AT QINT +QERST: 0 ;HAS CONI DC1, BITS WHEN AN ERROR HAPPENS +PKIDM: 0 ;-1 WAITING FOR PACK ID TO BE READ +RPKID: -1 ;PACK ID READ INTO HERE BY DISK CONTROL +QDRSTS: 0 ;DRIVE STATUS WORD STORED BY DISK CONTROL +] +IFE DMDSK,[ + 0 ;FOR BLT INTO QXWDS +QXWDS: BLOCK NXWDS +] +IFN DC10P,[ +QCHPRG: 0 +QCHPR2: DCOPY (-2000_2&37774) + DCOPY (-NXWDS_2&37774)QXWDS +QCHPR4: DHLT ;OR DRC +QCHPR3: DCCOMP (-2000_2&37774) + DCCOMP (-NXWDS_2&37774)QXWDS + DHLT + +GPKID: DSPC+DSCRHD+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +QRECAL: DSPC+DSRCAL+DUNENB +] + +;VARIABLES FOR DEC RP10 DISK CONTROL + +IFN RP10P,[ +QERST: 0 ;CONI DPC, ON ERROR +QERDTI: 0 ;DATAI DPC, ON ERROR +QCST: 0 ;CONI DPC, AT QINT +QCHPRG: 0 ;SEEK COMM +IFN KA10P, QIOWD: -2000,, ;XFER DATA (HRRM ADR-1 IN RH) +IFE DMDSK,[ + -NXWDS,,QXWDS-1 + -200+NXWDS,,0 +];DMDSK + 0 + +QRECAL: 700000,, +QGTBZY: 0 ;FLAG FOR SOFTWARE AT INT +];RP10P +IFN QRDCMP,[ +QRCSW: 0 ;NON-ZERO TO ENABLE READ-COMPARING +RDCPHS: 0 ;0 NORMAL, -1 DOING OPERATION WHICH SHOULD BE READ-COMPARED + ; AFTERWARD, + DOING READ-COMPARE +IFN KA10P,[ +RCIOWD: BLOCK 2 ;CHANNEL PROGRAM FOR READ INTO QRCBUF +];KA10P ;ON KL WE HAVE TO PUT IT IN THE EPT! +QRCBUF: BLOCK 2000 +];QRDCMP + +;VARIABLES FOR DEC RH10 DISK CONTROL + +IFN RH10P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +NCSHI: 0 ;NUMBER OF CACHE INVALIDATES +NCSHIL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE INVALIDATES +NCSHU: 0 ;NUMBER OF CACHE UNLOADS +NCSHUL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE UNLOADS +QERST: 0 ;CONI AT LAST ERROR (LEAVE THIS THROUGH QECPAT IN SAME ORDER) + 0 ;DATAI AT LAST ERROR +QERSTS: 0 ;%HRSTS AT LAST ERROR +QERER1: 0 ;%HRER1 AT LAST ERROR +QERER2: 0 ;%HRER2 AT LAST ERROR +QERER3: 0 ;%HRER3 AT LAST ERROR (IBM WOULD CALL THIS A CHANNEL LOGOUT AREA) +QERDCL: 0 ;%HRDCL AT LAST ERROR +QECPOS: 0 ;%HRPOS AT LAST ERROR +QECPAT: 0 ;%HRPAT AT LAST ERROR +QCST: 0 ;CONI AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR +RHDATO: -1 ;LAST DATAO DSK, FOR DEBUGGING +ECCPAG: BLOCK 8 ;TEMP FOR SAVING PAGE MAP VARS AT QECC (WITH SPM) +NQDRE: BLOCK NQS ;# MASSBUS TIMEOUTS PER DRIVE. +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +] + +;VARIABLES FOR DEC RH11 DISK CONTROL (ON THE KS10 UNIBUS) + +IFN RH11P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +QIOWD: 0 ; BA,,WC for RH11 +QCST: 0 ;CS1 AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT + +QERST:: ;Gubbish saved at last error +QERCS1: 0 ; CS1 Control & Status 1 +QERCS2: 0 ; CS2 Control & Status 2 +QERSTS: 0 ; STS Drive status +QERBA: 0 ; BA Unibus address for transfer +QERWC: 0 ; WC Word count for transfer +QERER1: 0 ; ER1 Error 1 +QERER2: 0 ; ER2 Error 2 +QERER3: 0 ; ER3 Error 3 +QERPOS:: +QECPOS: 0 ; POS ECC position +QERPAT:: +QECPAT: 0 ; PAT ECC pattern +QERMAP: 0 ? 0 ; Unibus map to disk buffer + +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR + +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +NQOFFL: BLOCK NQS ;# TIMES DISK WENT OFFLINE +] + +DIRHNG: 0 ;LH POINTS TO LIST OF DIRHNG DEVICE CHANNELS, + ;CHAINED THROUGH LH'S OF IOCHNM WORDS. + ;0 MEANS END OF LIST + ;MODIFY ONLY WITH THE CLOCK OFF. + ;EACH DIRHNG DEVICE CHANNEL'S IOCHST WORD RH CONTAINS THE + ;TRACK NUMBER OF THE DIRECTORY IT IS LOOKING AT. + +BBLK + +;DISK CONSTANTS + +IFN RP10P,[ +QATTNS: REPEAT NQS,500000+.RPCNT_14,,1_<10-.RPCNT> +;WORDS TO CLEAR ATTNS AND SELECT DRIVES +] + +SWAPL: SINLST(Q) + SOUTLS(Q) + +DCHBT: 20000,, ;BIT SET IF DIR NOT WRITTEN OUT ON UNIT + 10000,, + 4000,, + 2000,, + 1000,, + 400,, + 200,, + 100,, +IFL .-DCHBT-NQS,.ERR YOU BETTER FIND ANOTHER BIT FOR QACTB,QSNLCN,QTUTO + +IFN DC10P,[ +QTRAN: 0 ;FORMERLY MAPPED 203 CYL VIRTUAL DRIVES TO 406 CYL CALCOMPS + 1 ;4.9 => 2ND HALF OF PHYSICAL DRIVE + 2 ;(DOESN'T DO ANYTHING NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NQS, .ERR BARF AT QTRAN +] + +SUBTTL DISK CLOSE ROUTINES + +QICL: PUSH P,R + SKIPGE QUSR(A) + BUG + MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) ;FLUSH RANDOM ACCESS HACKERY + PUSHJ P,QICLW1 ;WAIT FOR INPUT TO STOP + MOVE TT,QSRAC(D) + TLNE TT,%QADEL ;DELETE? + JRST QSICLD ;YES + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) + AOS QFCHN +QICLX: SOSGE QSNNR(H) ;FREE DIRECTORY CHANNEL HAD BEEN USING + BUG + POP P,R + SETZM (R) + POPJ P, + +QICLW1: MOVE D,A ;IDLE CHANNEL AND FLUSH READ BUFFERS + CONO PI,UTCOFF + SKIPGE QSGL(D) + JRST QSICL3 + SKIPL QSCABN(D) + JRST QSICL4 + SETOM QSGL(D) + +QSICL3: HLLZS QSRAC(D) .SEE %QMIDL ;STOP PI + CONO PI,UTCON +QSICL5: PUSHJ P,QSBRB1 ;RETURN M.P. BUFFER IF ANY +QOCL7: HRRZ A,QBFP(D) ;ALSO ENTER TO RETURN UNUSED READ BUFFER ON WRITE OVER MODE +QSICL2: JUMPE A,QSICL6 + LDB C,[MLO,,MEMBLT(A)] + PUSHJ P,MEMR + MOVE A,C + SOS QSBFS(D) + JRST QSICL2 + +QSICL6: SETZM QBFP(D) + POPJ P, + +QSICL4: MOVEI A,%QMRD1 ;STOP PI AFTER THIS BLOCK + HRRM A,QSRAC(D) + CONO PI,UTCON + SKIPL QSGL(D) ;WAIT FOR CHANNEL TO DEACTIVATE + PUSHJ P,UFLS + JRST QSICL5 + +;OUTPUT CLOSE +QOCL: PUSHJ P,QSOCL5 ;CLEAN UP THE DISK CHANNEL +QSOCL4: MOVE D,A ;ENTRY FROM QALINK +QSOCL6: MOVE Q,QUDFPR(D) + MOVE H,QUDPR(D) + ADD Q,QSNLCN(H) + MOVE TT,QSRAC(D) + TLNE TT,%QADEL + JRST QCDLWO ;DELETED (PRESUMABLY VIA DELEWO) + MOVE A,UNFN1(Q) ;Get names of file being hacked. + MOVE B,UNFN2(Q) + PUSHJ P,QLOOK ;FILING OVER ANYTHING? + JRST QSOCL3 + HRRZ I,QSNLCN(H) + ADD I,QUDFPR(D) + CAMN I,Q ;BEING WRITTEN BITS WENT AWAY? + BUG ;TRYING TO DELETE THE FILE WE'RE WRITING + PUSHJ P,QSOCLD ;YES FLUSH IT + PUSHJ P,QUDLK ;RELOCK DIR UNLOCKED BY QSOCLD ETC + JRST QSOCL6 ;MAKE SURE ONE HASN'T REAPPEARED WHILE DIR UNLOCKED + +QSOCL5: LDB H,[$QAMOD,,QSRAC(A)] + JUMPN H,QOCL6 ;DONT HACK ACTIVE WD COUNT IN WRITEOVER MODE +QOCL6A: MOVN D,QSMPRC(A) ;- NUMBER OF BYTES IN BLOCK NOT USED + ADDB D,QMPBSZ(A) ;ADJUST BYTE COUNT OF LAST BLOCK TO REFLECT WHATS USED + CLEARM QSMPRC(A) ;SO WILL BE A NOOP IF PCLSR OUT AND COME BACK THRU HERE +QOCL4: MOVSI Q,%QAEFW + IORM Q,QSRAC(A) ;SET EOF BIT FOR QSBWW AND QUDS + JUMPN H,QOCL5 + SKIPL QSMDN(A) ;NO M.P. BUFFER ANYWAY + JUMPE D,QOCL1 ;ABOUT TO WRITE NULL BLOCK, DON'T +QOCL5: PUSHJ P,QSBWW +QOCL2: MOVE T,A + PUSHJ P,[ SKIPGE QSCRW(T) ;WAIT FOR CHANNEL EITHER LEAVING WRITE MODE + SKIPN QSBFS(T) ;OR WRITING OUT ALL ITS BUFFERS, I.E. PI LEVEL + JRST POPJ1 ;ISN'T GOING TO DO ANYTHING MORE TO IT. + POPJ P, ] + PUSHJ P,UFLS + SKIPE QBFP(A) ;MAKE SURE IF QSBFS NON-ZERO THAT IS ONLY EOF + BUG ;NOT A BUFFER SITTING AROUND FORGOTTEN +QOCL3: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SKIPN D,QMPTC(A) ;SKIP ON NEXT "N" STILL PENDING + POPJ P, + PUSHJ P,QUDS ;STORE IT AWAY + CLEARM QMPTC(A) + POPJ P, + +QOCL6: SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO IDLE OR HANG UP IN READ + PUSHJ P,UFLS + SKIPL QSGL(A) + PUSHJ P,UFLS + MOVE D,A + PUSHJ P,QOCL7 + MOVE A,D + MOVE Q,QSRAC(A) + MOVE B,QSBFS(A) + JUMPE B,QOCL6B + TLNE Q,%QAEFW + JRST QOCL6B + TLNE Q,%QAEFR + SOS B,QSBFS(A) ;COMPENSATE FOR EXTRA AOS ON EOF READ +QOCL6B: CAILE B,1 + BUG + TLNE Q,%QAWOV + JRST QOCL6A ;HACKING LAST BLOCK PAST EOF, UPDATE ACTIVE WD COUNT + JRST QOCL4 + +QOCL1: PUSHJ P,QSBRB ;DISCARD BUFFER + SOS QSBFS(A) + SOS QWBUFS + MOVE D,QDSKN(A) + AOS QSFT(D) ;RESTORE TRACK + JRST QOCL2 + +QSOCL3: MOVE Q,QUDFPR(D) + MOVE TT,QSNLCN(H) + ADDI Q,(TT) + MOVSI T,UNWRIT + ANDCAM T,UNRNDM(Q) ;CLEAR WRITE IN PROG + MOVE TT,QSNLCN(H) + MOVE T,UDNAMP(TT) ;MAKE SURE IT GOES BEFORE * FILE OF SAME NAME + ADDI T,(TT) + CAMN T,Q + JRST QSOC3E ;NO PREV FILE + MOVE J,Q +QSOC3A: SUBI J,LUNBLK + CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QSOC3B ;PREV FILE HAS DIFFERENT NAME + CAILE J,(T) + JRST QSOC3A +QSOC3C: CAMN J,Q + JRST QSOC3E +REPEAT LUNBLK, PUSH P,.RPCNT(J) + MOVE T,J + HRL T,Q + BLT T,LUNBLK-1(J) +REPEAT LUNBLK, POP P,LUNBLK-.RPCNT-1(Q) + SUB Q,J + SUBI J,(TT) + MOVSI T,-NQCHN +QSOC3D: HRRZ A,QUDPR(T) + SKIPL QUSR(T) + CAIE A,(H) + JRST QSOC3F + HRRZ A,QUDFPR(T) + CAIN A,(J) + ADD A,Q + MOVEM A,QUDFPR(T) +QSOC3F: AOBJN T,QSOC3D +QSOC3E: SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + MOVE C,QSNUD(H) +IFN TPLP+UNSPLP,[ + MOVEI TT,SCRTPC + CAMN C,[SIXBIT /.LPTR./] + IORM TT,SUPCOR ;CLOSING FILE ON TPL DEVICE SO SET FLAG FOR SYS JOB +];TPLP + CAMN C,[SIXBIT/.MAIL./] + AOS NQMFWR ;CLOSING FILE ON .MAIL. => BUMP COUNT TO WAKE MAILER DEMON +IFN XGP,[ + CAMN C,[SIXBIT/.XGPR./] + AOS NXGPFW ;WAKE XGPSPL +];XGP + MOVE A,QSNMI(H) ;TELL DIRHNG DEVICE ABOUT IT + PUSHJ P,DIRSIG + MOVE TT,QACTB ;DIR CHANGED (AT LEAST WRITE-IN-PROG BIT TURNED OFF) + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + SOSGE QSNNR(H) + BUG + PUSHJ P,QSTRTR + SETZM (R) ;CLEAR IOCHNM WORD. + POPJ P, + +QSOC3B: ADDI J,LUNBLK + JRST QSOC3C + +QOCLR: MOVE Q,QSRAC(A) ;CLOSE UNIT ASCII OUTPUT + TLNN Q,%QAWOV + TLNN Q,%QAMWO+%QALNK + PUSHJ P,QOCLPD ;PUT NEEDED PADDING UNLESS NOT A FILE OR NOT AT END + JRST QOCL + +QOCLPD: LDB Q,[360600,,QSMPRP(A)] ;NUMBER OF BITS NOT WRITTEN IN LAST WORD + CAIL Q,44 + POPJ P, ;LAST WORD NOT WRITTEN AT ALL + LSH Q,18.+6 ;FILL THOSE BITS WITH ^CS + HRR Q,QSMPRP(A) + MOVE C,[EOFWRD] + SKIPLE QSMPRC(A) ;INHIBIT STORE IF NO BUFFER ETC. + DPB C,Q + POPJ P, + +SUBTTL DISK INTERRUPT ROUTINES + +OVHMTR QIN ;DISK INTERRUPT LOW-LEVEL + +IFN RP10P,[ + +QINT: AOS QGTBZY + MOVEM TT,QCST +IFN DMDSK,[ + TRNN TT,200000 ;END OF CYLINDER + JRST QINT0 + SKIPGE C,QSDCH + BUG + MOVE D,QSGL(C) + IDIVI D,NBLKSC ;IS IT LEGITIMATE? + SKIPL QSDU ;IF NO TRANSFER IN PROGRESS, IGNORE + CAIN E,NBLKSC-1 ;IS LEGITIMATE FOR LAST BLOCK IN CYLINDER + CAIA ;IGNORE + BUG PAUSE,[MAYBE DISK CONTROL IS WRITING ALL OVER THE DISK AGAIN] +QINT0: ];DMDSK + TDNE TT,[17177700] ;ANY ERRORS? + JRST QINTE +QINTN2: DATAI DPC,R + SKIPGE QSDU ;DONT CLOB CMD BUF TO CLR ATTS DURING DATA XFER + TRNN R,776 ;ANY ATTNS + JRST QINTA ;NO + LDB I,[11000,,R] ;YES,FIND WHICH DRIVE + JFFO I,.+1 ;CLOBBERS Q + SUBI Q,28. + +QINTAT: DATAO DPC,QATTNS(Q) ;CLEAR ATTNS + DATAI DPC,E + TLNN E,40 + JRST QRECAT ;NOT ON CYLINDER, RECALIBRATE + LDB A,[DCYLI E] + TRNE E,.BM DCYLXI + ADDI A,400 + CAME A,QPOSGL(Q) + JRST QRECAT ;SEEK TO THE WRONG PLACE (CALCOMPS LIKE TO DO THIS) + MOVEM A,QPOS(Q) ;REMEMBER WHERE IT IS AT + SETZM QSEEK(Q) + SETZM QRCAL(Q) + JRST QINT ;TRY AGAIN + +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION - FIND NEW TRANSFER + CONSO DPC,400000 + CONSO DPC,10 + JRST DSKEX ;TRANSFER STILL IN PROGRESS, DISMISS + CONSZ DPC,20 + JRST .-1 ;BUSY? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: DATAI DPC,R + CONI DPC,TT ;THIS LOOKS REDUNDANT BUT APPARENTLY IS NECESSARY + ;DUE TO TIMING OF THE DISK-NOT-READY CONDITION + CONO DPC,175700+DSKCHN ;RESET CONDITIONS + MOVEM TT,QERST + MOVEM R,QERDTI + CONSZ DPC,20 ;WAIT FOR UNBUSY + JRST .-1 + MOVE Q,QSDU ;FOR QOVR + MOVE E,QCHPRG + TRNE TT,20000 ;OVERRUN + JRST QOVR + TRNE TT,2000 ;NOT READY + JRST QNRDY + TDNE TT,[12010700] ;BITS 14,16,23,27-29 ARE LOSERS + BUG HALT,[DSK: TOTALLY FATAL ERROR, CONI=],OCT,QERST + TLNE TT,5 ;WD OR SECTOR PARITY ERROR + JRST QDE + TRNE TT,1000 ;WRITE LOCKED + JRST QIRWRE + TRNE TT,40000 ;SEARCH FAILED + JRST QHE + TRNN TT,100000 ;POWER FAILURE + JRST QINTE1 + CONSZ DPC,100000 ;TRY IT AGAIN + JRST 4,.-1 + JRST QHE + +QINTE1: TLNE R,10 ;FILE UNSAFE--NEED OPERATOR INTERVENTION + BUG PAUSE,[DSK: FILE UNSAFE UNIT ],DEC,Q + TLNE R,4 + BUG ;NO SUCH DRIVE + TLNE R,110 ;POSITION FAILURE (OR PROCEEDED FILE UNSAFE) + JRST QHE + AOS NQSE(Q) ;SPURIOUS ERROR + JRST QINTX ;IGNORE + +QIRWRE: BUG PAUSE,[DSK: WRITE LOCKED UNIT ],DEC,Q + JRST QHE + +QNRDY: LDB Q,[410300,,R] ;WHICH DPC + SKIPN QSEEK(Q) + SKIPGE QRCAL(Q) ;NOT SEEKING OR RECALIBRATING IS ERROR + JRST QINTN2 + BUG PAUSE,[DSK: UNIT ],DEC,Q,[NOT READY] + JRST QREC +] ;END IFN RP10P + +IFN DC10P,[ + +QINT: MOVEM TT,QCST + SKIPL PKIDM ;GETS SPURIOUS DIPE WHEN READING PACK ID + CONSO DC1,7777 ;RUMOR THAT DSSERR DOESN'T ALWAYS SET + TRNE TT,DSSERR + JRST QINTE + TRNE TT,DSSATT + JRST QINTAT +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION, FIND NEW TRANSFER + CONSZ DC0,DSSRUN+DSSACT + JRST DSKEX ;ACTIVE OR RUN, TRANSFER IN PROGRESS, DISMISS + AOSN PKIDM ;SKIP IF NOT FINISHED READING PACK ID + JRST QSPKID + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + SKIPL QERS1 + JRST QEROK ;OK ON VERIFY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: CONI DC1,TT + CONO DC0,DCCLR+DCERR+DSKCHN ;CLEAR ERRORS + MOVEM TT,QERST + MOVE Q,QSDU + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 ;ACTIVE OR RUN? + SKIPL QERS1 + JRST QERL1 ;VERIFY ALSO LOST + TRNE TT,DOFFL+DPROT+DDOBSY+DNXM+DCPERR + JRST QINTE1 ;REALLY LOST BIG + TRNE TT,DOVRRN + JRST QOVR + TRNE TT,DWTHER+DFUNSF ;SEEK INC, END DISK, WATCHDOG, OR UNSAFE + JRST QHE ;TRY TO RECALIBRATE + SKIPGE PKIDM + TRZ TT,DRLNER ;IGNORE LENGTH ERROR IF READING PACK # + TRNE TT,DIPE+DRLNER+DRCER+DCKSER + JRST QDE ;TRY AGAIN + SKIPGE PKIDM + TRNE TT,-1 + AOS NQSE ;SPURIOUS ERROR (NOT LENGTH ERROR IN PKIDM) + JRST QINTX ;SPURIOUS ERROR + +QINTE1: TRNE TT,DOFFL + BUG PAUSE,[DSK: UNIT ],DEC,Q,[OFFLINE] + TRNE TT,DPROT + BUG PAUSE,[DSK: UNIT ],DEC,Q,[WRITE PROTECTED] + TRNE TT,DDOBSY + BUG PAUSE,[DSK: DATAO WHEN BUSY] + TRNE TT,DNXM+DCPERR + BUG PAUSE,[DSK: MEM PAR OR NXM ERROR] + JRST QOVR + +QINTAT: CONI DC1,Q + CONO DC0,DCCLR+DCCATT+DSKCHN ;CLEAR ATTENTION + LDB Q,[DSATDN Q] ;ATTENTION DRIVE NUMBER + CAIGE Q,NQS + SKIPL QRCAL(Q) + JRST QINTX + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE + JRST QINTX + +;THIS IS CALLED EVERY HALF SECOND +QRCTMO: MOVEI Q,NQS-1 + SKIPL QRCAL(Q) +QRCTM1: SOJGE Q,.-1 + JUMPL Q,CPOPJ + SOSL QRCTIM(Q) + JRST QRCTM1 + BUG INFO,[DSK: RECAL TIMEOUT UNIT],DEC,Q + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE I GUESS + JRST QRCTM1 +];DC10P + +IFN RH11P,[ + +;;; RHCLRC(Q) Clear controller errors and select drive Q +;;; RHSLCT(Q) Select drive Q +;;; RHCMD(A) Command in A to current drive +;;; RHCLRD Clear current drive +;;; RHCHEK Check for immediate bad news +;;; All return CS1 in A + +RHSLCT: IOWRQ Q,%HRCS2 +RHCHEK: IORDQ A,%HRCS1 + TRNE A,%HXTRE+%HXMCP + BUG HALT,[DSK: MASSBUS ERROR, CS1=],OCT,A + POPJ P, + +RHCLRC: IOWRQ Q,%HRCS2 ; Must select drive before clearing controller + MOVEI A,%HXTRE+%HXIE+%HMNOP +RHCMD: TROA A,%HXIE +RHCLRD: MOVEI A,%HXIE+%HMCLR + IOWRQ A,%HRCS1 + JRST RHCHEK + +EBLK +DSKBRK: 0 +BBLK + JSR UTCSAV +QINT: AOS QGTBZY + MOVE Q,QSDU + IORDQ TT,%HRCS1 + MOVEM TT,QCST + TRNE TT,%HXTRE+%HXMCP + JRST QINTE + TRNN TT,%HXSC ; Perhaps some drive needs attention? + JRST QINT0 ; Not unless SC is set! + IORDQ A,%HRATN + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ; Not expecting completion of transfer. + TRNN TT,%HXRDY + JRST DSKEX ; Transfer still in progress. + AOSN QHUNGF + JRST QHE ; Transfer hung, recalibrate and retry. + PUSHJ P,RHSLCT ; Select that drive. + IORDQ A,%HRSTS ; Get its status. + TRNE A,%HSERR ; Just in case %HXTRE didn't get set (by + JRST QINTE ; analogy with RH10)... + JRST QINTA1 ; Transfer complete... + +QINTAT: MOVNI Q,-35.(B) + HRRZS Q + MOVEI A,1 + LSH A,(Q) + IOWRQ A,%HRATN ; Turn off attention bit. + CAIL Q,NQS + JRST QINT0 + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ; Ignore attention in mid-transfer. + JRST QINTA2 ] + SKIPE QACT(Q) + JRST QINTA2 ; Ignore this drive. + PUSHJ P,RHSLCT + IORDQ B,%HRSTS ; Get status of drive with attention. + TRC B,%HSMOL+%HSDPR+%HSRDY + TRNN B,%HSMOL+%HSDPR+%HSRDY+%HSVV + PUSHJ P,QOFFL ; Went offline and came back online + TRNE B,%HSERR+%HSPIP + JRST [ PUSHJ P,RHCLRD ; Drive barfing not during transfer + AOS NQEATN(Q) ; so clear it + JRST .+1] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION +IFDEF %HRCCY,[ ;Current Cyl register only on RP disks + IORDQ A,%HRCCY + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE +];IFDEF %HRCCY +IFNDEF %HRCCY,[ + MOVE A,QPOSGL(Q) ;On RMxx, jump to conclusion + MOVEM A,QPOS(Q) +];IFNDEF %HRCCY + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON + ; THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +; Went offline and came back online +QOFFL: TRC B,%HSMOL+%HSDPR+%HSRDY ;Recover %HRSTS + IORDQ C,%HRER1 + IORDQ D,%HRER2 +IFDEF %HRER3,[ + IORDQ E,%HRER3 + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D,[ER3=],OCT,E +] +IFNDEF %HRER3,[ + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D +] + + AOS NQOFFL(Q) + MOVEI A,%HMCLR ;Clear the drive + PUSHJ P,RHCMD + MOVEI A,%HMRDP ;I said, clear the drive! + PUSHJ P,RHCMD + MOVEI A,0 + IOWRQ A,%HROFS ;No offset, 18 bits, ECC on, HCI off + MOVEI A,%HMACK ;Turn %HSVV back on so drive will work + PUSHJ P,RHCMD + POPJ P, + +QINTE: +IRPS X,,[CS1 CS2 BA WC POS PAT] ; First get status of controller + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + IORDQ A,UBAPAG+QUBPG_1 ; Unibus map counts as part of + MOVEM A,QERMAP ; controller status. + IORDQ A,UBAPAG+QUBPG_1+1 + MOVEM A,QERMAP+1 + SKIPGE Q ; Try hard to guess the drive. + LDB Q,[$HYDSK QERCS2] + PUSHJ P,RHCLRC ; Clear controller errors and select drive + ; so that we can read its status too. + TRNN A,%HXRDY ; Why would controller be busy? (RH10 + BUG ; code checks for this...) + +IRPS X,,[STS ER1 ER2] + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + MOVE A,QERCS1 ; A: CS1 + MOVE R,QERCS2 ; R: CS2 +IFDEF %HRER3,[ ; Disks with ER2 -and- ER3 + IORDQ A,%HRER3 + MOVEM A,QERER3 + SKIPN QERER2 ; Bad news + SKIPE QERER3 + JRST UNSAFE +] +IFNDEF %HRER3,[ ; Disks with just ER2 + SKIPE QERER2 + JRST UNSAFE +] + TRNN A,%HXMCP ; Real bad news + TRNE R,%HYWCE+%HYPE+%HYNED+%HYNEM+%HYPGE+%HYMXF + BUG HALT,[DSK: UNIT #],DEC,Q,[LOSING. CS1=],OCT,A,[ CS2=],OCT,R + TRNE R,%HYDLT+%HYMDP ; Data bus losing? + JRST QINTE1 + MOVE A,QERSTS ; Check Drive Status + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ; Better be all on! + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ; Spurious? + JRST QINT0] + MOVE B,QERER1 ; Check the main error register + TRNE B,#<%H1ECC+%H1DTE+%H1CRC+%H1HCE+%H1ECH+%H1FER+%H1PAR> + JRST UNSAFE ; Those not listed above are considered "hard" + CAIN B,%H1ECC ; Correct correctable error if that is the + JRST QECC ; only problem. + PUSHJ P,QINTER ; Else print message and reset drive + TRNE B,%H1DTE+%H1CRC+%H1HCE+%H1FER ; These require recalibration + JRST QHE + TRNE B,%H1ECC+%H1ECH+%H1PAR ; These require reread + JRST QDE + JRST QOVR ; No error bits set? (How can this + ; happen?) Go and retry... + +;;; Controller error: +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CS1=],OCT,QERCS1,[CS2=],OCT,QERCS2 + JRST QOVR + +;;; Drive error: +IFDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA +] +IFNDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[STARTING DISK ADDR=],OCT,QCHPGA +] + JRST RHCLRD ; Reset error status in drive + +;;; Come here for drive unsafe and similar bad things. May be set to +;;; either halt or attempt retry (via USFHLT variable). Note that when we +;;; get here the state of the drive has not yet been disturbed. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + SKIPL QSDU + JRST QHE ;RECALIBRATE AND RETRY + JRST QREC ;Just recalibrate, no transfer to retry + +QECC: PUSHJ P,RHCLRD ; Reset drive + CAME Q,QSDU ; ECC error better be for transfer in + BUG ; progress... + MOVE A,QCHPRG + TRNN A,10 .SEE %HMRED + BUG ; ECC error should only happen during read. + LDB A,[$UPPAG QERMAP] + IORI A,600000 + DPB A,[.PAREP+EXEUMP] ; Point parity error page at buffer. + CLRPT 400000+PAREP_12 ; Get it into our map now. + CLRPT 401000+PAREP_12 ; Both halves... + MOVE J,QERBA + SUBI J,1000+QUBPG_14 ; Correct to relative byte address of start + ; of losing sector. + TRNE J,770777 ; Should always be aligned on sector boundary + BUG ; and within a single block, right? + LSH J,-2 ; J: Address of first word of losing sector + ; within block. + MOVE A,QECPOS ; Get error position + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADDI J,400000+PAREP_12(A) ; J: Address of losing word-pair + ; (In parity error page.) + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + CLRPT 400000+PAREP_12 + CLRPT 401000+PAREP_12 ; Both halves... + + AOS QECCS(Q) ;LOG THE LOSS + LDB E,[111000,,QERBA] ; E: Number of sectors transferred (including + SUBI E,QUBPG_3 ; ECC sector) + MOVE A,QCHPGA + LDB B,[$HASEC A] ;Compute disk address of failing sector: + ADDI B,-1(E) + IDIVI B,NSECS ; C: sector + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D ; B: track + DPB B,[$HATRK A] + MOVEM A,QECCAD(Q) + HLRZ A,A ; A: cylinder + MOVE D,QSDCH ; D: chnl + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT #],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + CAIL E,SECBLK + JRST QINTA1 ;XFER COMPLETE + + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS + ; CYLINDERS + + HRL E,QERWC ; Reassemble "iowd" from + HRR E,QERBA ; saved parts. (Don't trust stuff saved + MOVEM E,QIOWD ; in controller more than we have to.) + HRRZ C,QSDCH ;FOR QECCX + JRST QECCX ;MORE TO DO, CONTINUE XFER + +] ;RH11P + +IFN RH10P,[ + +QINT: AOS QGTBZY + MOVE Q,QSDU + MOVEM TT,QCST + TRNE TT,%HIERR + JRST QINTE + TRNN TT,%HIATN + JRST QINT0 + MOVSI A,%HRATN ;FIND DRIVES NEEDING ATTENTION + PUSHJ P,RHGET + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING COMPLETION OF TRANSFER + TRNN TT,%HIDON + JRST DSKEX ;NO COMPLETED TRANSFER + CONSZ DSK,%HIBSY + JRST 4,.-1 ;TRANSFER STILL IN PROGRESS?? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + MOVSI A,%HRSTS(Q) ;SOMETIMES %HSERR SETS AND %HIERR DOESN'T! + PUSHJ P,RHGET + TRNE A,%HSERR + JRST QINTE + JRST QINTA1 ;XFER COMPLETE... + +QINTAT: MOVNI Q,-35.(B) ;LOW BIT IS DRIVE 0 + HRRZS Q + MOVEI A,1 ;TURN OFF ATTENTION (DRIVE MAY BE LOSING + LSH A,(Q) ;IN SUCH A WAY THAT READING %HRSTS DOESN'T CLEAR ATTN) + HRLI A,%HRATN + PUSHJ P,RHSET + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ;IGNORE ATTN IN MID-TRANSFER + JRST QINTA2 ] + MOVSI A,%HRSTS(Q) ;GET STATUS OF DRIVE WITH ATTENTION + PUSHJ P,RHGET ;THIS ALSO CLEARS THE ATTENTION BIT + SKIPE QACT(Q) + JRST QINTA2 ;IGNORE THIS DRIVE + TRNE A,%HSERR+%HSPIP + JRST [ MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;DRIVE REPORTING ERROR NOT DURING TRANSFER + PUSHJ P,RHSET ;SO CLEAR THE DRIVE + AOS NQEATN(Q) + JRST .+1 ] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION + MOVSI A,%HRCCY(Q) + PUSHJ P,RHGET + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +;INPUT FROM MASSBUS - ADDRESS IN LH(A), RETURNS DATA IN A + +RHGET: TLZA A,%HRLOD + +;OUTPUT TO MASSBUS - ADDRESS IN LH(A), DATA IN RH(A) + +RHSET: TLO A,%HRLOD + DATAO DSK,A + MOVEM A,RHDATO ;SAVE FOR REBUGGING + MOVEI A,5 ;WAIT 3 USEC FOR BUS CYCLE + SOJG A,. + DATAI DSK,A + TLNE A,%HDERR + BUG HALT,[DSK: MASSBUS ERROR, DATAO=],OCT,RHDATO,[DATAI=],OCT,A + ANDI A,177777 ;RETURN 16-BIT REGISTER CONTENTS + POPJ P, + +QINTE: CONI DSK,TT + DATAI DSK,R + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN ;RESET CONTROLLER SO DRIVE STATUS MAY BE READ + CONSZ DSK,%HIBSY + JRST .-1 ;SOMETIMES CONTROLLER IS BUSY?? + MOVEM TT,QERST + MOVEM R,QERST+1 + SKIPGE Q ;TRY HARD TO GUESS THE RIGHT DRIVE! + LDB Q,[$HCDRV R] ;CURRENTLY SELECTED DRIVE + IRPS X,,[%HRSTS %HRER1 %HRER2 %HRER3 %HRDCL %HRPOS %HRPAT] + MOVSI A,X(Q) ;GET STATUS OF DRIVE + PUSHJ P,RHGET + MOVEM A,QERST+.IRPCNT+2 + TERMIN + SKIPN QERER2 ;FILE UNSAFE + SKIPE QERER3 + JRST UNSAFE + TRZE TT,%HIDRE + AOS NQDRE(Q) ;THIS BIT SUSPECTED OF BEING SET RANDOMLY. + ;;CHECK FOR IRRECOV (?) HARDWARE LOSSAGE. EVEN MORE SO THAN 'UNSAFE' + TDNE TT,[%HIILF+%HISDE+%HINXM+%HIDRE+%HIILC+%HIPWR] + BUG HALT,[DSK: UNIT ],DEC,Q,[ LOSING. RH10 CONI= ],OCT,QERST +IFN KS10P, .ERR So whats this all about? +IFN KL10P,[ + TLNN TT,(%HIDPE+%HICPE) ;IF CHANNEL DETECTS PARITY ERROR, CAUSE + JRST QINTE0 ;PROCESSOR PARITY SWEEP WHICH WILL PROBABLY + MOVSI A,SCLPAR ;CRASH THE SYSTEM ANYWAY. BEATS LOOPING! + TDNN A,SUPCOR ;BUT DON'T CAUSE CLKB1E+7 HALT + CONO 10407 + BUG CHECK,[DSK: MEM PAR ERR, QICWA/],OCT,QICWA,OCT,QICWA+1,[QIOWD/],OCT,QIOWD +QINTE0: +];KL10P + TDNE TT,[%HIOVR+%HICOV+%HIDPE+%HICPE+%HIBPE] + JRST QINTE1 ;OVERRUN OR PARITY ON CONTROL BUS OR CHANNEL BUS - RETRY + MOVE A,QERSTS ;DRIVE EXCEPTION, CHECK DRIVE STATUS + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ;THESE BITS BETTER ALL BE ON + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG ;DRIVE TURNED OFF? MAYBE 11 HACKING THIS DRIVE? + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ;SPURIOUS? + JRST QINT0 ] + MOVE B,QERER1 ;CHECK THE MAIN ERROR REGISTER + TRNE B,#%H1SOF ;ANY HARD ERRORS? + JRST UNSAFE + CAIN B,%H1ECC ;IF JUST A CORRECTABLE ERROR, + JRST QECC ;GO CORRECT IT + PUSHJ P,QINTER ;OTHER SOFT ERROR, PRINT MESSAGE AND RESET DRIVE + TRNE B,010620 ;SEARCH ERROR, OR HEADER READ OR FORMAT ERROR OR DRIVE TIMING + JRST QHE ;REQUIRES RECALIBRATE + TRNE B,100110 ;BUS PARITY OR ECC "HARD" + JRST QDE ;REQUIRES RE-READ, GIVE UP AFTER N + JRST QOVR ;NO ERROR BITS, PRINT MESSAGE AND RETRY + +;CONTROLLER ERROR +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CONI=],OCT,QERST,[DCL=],OCT,QERDCL + JRST QOVR + +;DRIVE ERROR +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA + MOVSI A,%HRDCL(Q) ;NOW RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + JRST RHSET + +;COME HERE FOR DRIVE UNSAFE AND SIMILAR BAD THINGS. MAY BE SET TO +;EITHER HALT OR ATTEMPT RETRY (VIA USFHLT VARIABLE). NOTE THAT WHEN +;WE GET HERE THE STATE OF THE DRIVE HAS NOT YET BEEN DISTURBED. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + JRST QHE ;RECALIBRATE AND RETRY + +QECC: MOVSI A,%HRDCL(Q) ;RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + PUSHJ P,RHSET + CAME Q,QSDU ;CORRECT AN ECC ERROR + BUG ;BARF ... NO TRANSFER IN PROGRESS + MOVE A,QCHPRG + TRNN A,10 + BUG ;BARF ... SHOULDN'T HAPPEN DURING WRITE + SKIPN A,QICWA+1 ;GET ADDRESS OF LAST WORD READ + JRST 4,.-1 ;CHANNEL OUGHT TO HAVE STORED CONTROL WORD BY NOW + SOS J,A + TDZ J,[177+.BM $DFCWA] ;J := ADDRESS OF FIRST WORD IN LOSING SECTOR + LDB A,[$DFCAD QIOWD] + SUBM J,A + SOS H,A ;# WORDS SUCCESSFULLY XFERED. + CAIL H,0 ;CHECK IF CHANNEL STORED BAD ADDRESS + CAILE H,2000-200 + JRST QDE ;THIS SHOULD NEVER HAPPEN, BUT IT DOES, FREQUENTLY + MOVE A,QECPOS ;GET ERROR POSITION + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADD J,A ;J := ADDRESS OF LOSING WORD-PAIR + LDB A,[121400,,J] + ANDI J,1777 ;GET ADDR OF PAR ERR PAG + ADDI J,400000+2000*PAREP ;IN EXEC ADDRESS SPACE + IORI A,600000 ;MAKE THAT PAGE POINT TO THE DISK BUFFER + DPB A,[.PAREP+EXEUMP] + SPM ECCPAG ;GET IT INTO OUR MAP. + LPMR ECCPAG + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + LPMR ECCPAG + + AOS QECCS(Q) ;LOG THE LOSS + MOVE A,QCHPGA + MOVEI E,200(H) + LSH E,-7 ;NUMBER OF SECTORS TRANSFERRED (INCLUDING ECC SECTOR) + LDB B,[$HASEC A] ;GET DISK ADDR OF FAILING SECTOR + ADDI B,-1(E) + IDIVI B,NSECS + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D + DPB B,[$HATRK A] ;NO NEED TO DIVIDE BY NHEDS SINCE NEVER CROSS CYLINDERS + MOVEM A,QECCAD(Q) + HLRZ A,A + MOVE D,QSDCH + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT ],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS CYLINDERS + HRRZ C,QSDCH ;FOR QECCX + LDB A,[$DFCWA QICWA+1] ;LAST CONTROL WORD PROCESSED + SUBI A,1 ;CRETINOUS DF10 + CAIE A,QIOWD + BUG ;CHANNEL STORED BAD ADDRESS? + HRRZM A,QICWA + MOVEI A,200(H) ;# WORDS ALREADY DONE. + DPB A,[$DFWC A] ;PUT IT IN BOTH FIELDS. + ADDB A,@QICWA ;ADVANCE C.W. TO REMAINING STUFF + TLNE A,(.BM $DFWC) + JRST QECCX ;MORE TO DO, CONTINUE XFER + AOS QICWA ;ELSE ADVANCE TO NEXT C.W. + SKIPE @QICWA + JRST QECCX ;MORE TO DO, CONTINUE XFER + JRST QINTA1 ;XFER COMPLETE +] + +IFN T300P,[ +T3INT: SETZM DSCDON ;CLEAR DONE FLAG THAT GOT US HERE + SKIPGE QSDU1 ;OPERATION COMPLETE? + JRST QINT1 ;NO, GO FIND SOMETHING TO DO + HRRZ Q,DSCDRV ;YES, GET DRIVE OPERATION WAS ON + ADDI Q,T300P + CAIGE Q,NQS + CAME Q,QSDU1 ;TERMINATION ON DRIVE WE EXPECTED? + BUG ;DRIVE NUMBER CLOBBERED? + SETZM QRCAL(Q) ;PRESUMABLY NOT RECALIBRATING ANY MORE. + MOVE A,DSCCMD ;COMMAND THAT JUST COMPLETED + CAIN A,%DMREC ;WAS IT A RECALIBRATE? + JRST QINT1E ;IF SO, CONTROLLER IS IDLE NOW + MOVE C,QSDCH1 ;CHANNEL + HRLZ E,DSCFLT ;CHECK FOR ERRORS + HRR E,DSCSTS + JUMPE E,QINTI ;OPERATION COMPLETED UNEVENTFULLY + MOVE D,DSCHED ;GET DISK ADDRESS AS CYL,,HEAD_9+SECTOR + LSH D,9 + IOR D,DSCSEC + HRL D,DSCCYL + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: T-300 ERR UNIT ],DEC,Q,[FAULT=],OCT,DSCFLT,[STATUS=],OCT,DSCSTS,[CMD=],OCT,DSCCMD,[CYL-SURF-SEC=],OCT,D + TRZE E,%DSRTR+%DSECC ;THESE ARE NOT ERRORS + AOS QECCS(Q) + JUMPE E,QINTI ;OPERATION COMPLETED SUCCESSFULLY (WITH INTERVENTION OF 2561) + MOVE T,E + TRZ T,%DSECH+%DSIDE+%DSHCE + JUMPN T,T3INT2 ;CONSIDER USING ERROR RECOVERY FEATURES + TRNE A,%DMRED ;IF COMMAND IS A READ + TRNE A,10 ;AND WE HAVEN'T TRIED THEM ALL + JRST T3INT2 + AOS NQSE(Q) ;COUNT "SOFT ERRORS" (NOT "SPURIOUS" IN T-300 CASE) + AOJA A,T3IO1 ;GO RETRY OPERATION USING NEXT FEATURE + +T3INT2: TLNN E,-1 ;ANY FAULT? PROBABLY UNRECOVERABLE BUT TRY RECALIBRATE + TRNE E,%DSIDE+%DSHCE+%DSSKE+%DSOFL+%DSFLT ;DISK CONDITION THAT CALLS FOR RECAL + JRST T3HE + JRST T3DE ;TRY OPERATION AGAIN. PROBABLY WILL LOSE BUT TRY. +];T300P + +OVHMTR QSC ;DISK SCHEDULER (AND HIGHER-LEVEL INTERRUPT STUFF) + +QINTA1: SKIPL C,QSDCH ;XFER COMPLETE +QINTI: SKIPGE A,QSCABN(C) ;CHANNEL IN C + BUG ;MEMBLT INDEX IN A + MOVE R,A ;BUFFER ADDRESS IN R +IFN KL10P,[ ;QSRAC IN D, QSK# IN Q + SKIPL QSCRW(C) ;IF READ, FLUSH CACHE AGAIN + JRST [ PUSHJ P,CSHSWP ;SINCE USER MIGHT HAVE TOUCHED ABS PAGE + CAIA + MOVE A,R ;A WAS CLOBBERED + JRST .+1 ] +] +IFN KS10P,[ + SKIPL QSCRW(C) ;ON KS, CAN ONLY CLEAR THE WHOLE CACHE + CLRCSH +] + LSH R,10. + MOVE D,QSRAC(C) +IFN RP10P,[ + HRRZ TT,QICWA+1 + CAIE TT,1777(R) + TLNE D,%QAPAR ;IGNORE IF LOSING ANYWAY (E.G. SEARCH ERR) + CAIA + JRST QDFLOS +];RP10P +IFN QRDCMP,[ + SKIPE TT,RDCPHS ;NEED TO READ-COMPARE? + JRST QRC1 ;READ-COMPARE STARTING OR FINISHED +QRC0: +];QRDCMP + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE COMPLETION HANDLER + OFFSET -. +%QMIDL::JRST 4,QINT1 ;IDLE - SHOULDN'T BE ACTIVE +%QMRD:: JRST QRDFIN ;READ +%QMWRT::JRST QWRFIN ;WRITE +%QMWOV::JRST QWOVFN ;WRITE-OVER MODE +%QMRD1::JRST QRD1FN ;READ BLOCK AT A TIME MODE + JRST 4,QINT1 ;ILL CODE +%QMUDR::JRST QUDRIN ;USER DIR IN +%QMMDR::JRST QMDRIN ;MASTER DIR IN +%QMTTR::JRST QTUTIN ;TUT IN +%QMUDW::JRST QUFDWF ;USER DIR WRITE +%QMMDW::JRST QMFDWF ;MASTER DIR WRITE +%QMTTW::JRST QTUTWF ;TUT WRITE +%QMSWP::JRST QSWPFN ;SWAP FINISHED + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE +%QMMAX::OFFSET 0 +IFN %QMMAX-20, .ERR %QMMAX MUST BE A POWER OF 2 + +IFN RP10P,[ +;CHANNEL DIDN'T TRANSFER EXACTLY 2000 WORDS +QDFLOS: MOVEI D,1777(R) ;EXPECTED TERMINATION ADDRESS + HRRZ B,QICWA+1 ;ACTUAL TERMINATION ADDRESS + CAIL B,(D) + SKIPL QSCRW(C) + JRST QDFLZ1 + BUG HALT,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D,[DISK IS CLOBBERED NOW.] + +QDFLZ1: BUG PAUSE,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D + JRST QOVR +];RP10P + +;;; SOFTWARE READ-COMPARE ROUTINES + +IFN QRDCMP,[ +IFE RP10P+RH10P, .ERR READ-COMPARE ONLY CODED FOR RP-10 AND RH10 +;IFE KA10P, .ERR READ-COMPARE ONLY CODED FOR KA-10 + +;;; REGULAR OPERATION COMPLETE, DO A READ-COMPARE TO BE SURE +QRC1: +IFN T300P, CAIGE Q,T300P ;NO READ/COMPARE IF THIS IS T-300 CONTROLLER + TLNE D,%QAPAR ;GIVING UP WITH FATAL ERR? + JRST QRC0 ;NO READ-COMPARE THEN + JUMPG TT,QRC2 ;JUMP IF READ-COMPARE COMPLETED + MOVE E,QSGL(C) ;DISK BLOCK + PUSHJ P,QPOSR ;E GETS DATAO WORD +IFN RP10P,[ + IOR E,[DREADC+7000+RCICWA] ;MAKE READ COMMAND + CONO DPC,175700+DSKCHN + MOVE T,[-2000,,QRCBUF-1] ;STORE CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + DATAO DPC,E ;START DISK +];RP10P +IFN RH10P,[ + MOVE T,[-2000_4,,QRCBUF-1] ;DF10-C CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + SWPUA ;DUMP CACHE + CONSZ 200000 ;IT'S INEFFICIENT, BUT WHAT THE HELL + JRST .-1 + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + MOVSI A,%HRADR(Q) + HRR A,E ;HEAD AND SECTOR (CYL DOESN'T CHANGE) + PUSHJ P,RHSET + MOVEI A,%HMRED+ + TLO A,%HRCTL(Q) + PUSHJ P,RHSET ;START DISK +];RH10P + MOVEM T,RDCPHS ;RDCPHS POSITIVE MEANS DOING RD/CMP NOW + JRST DSKEX ;AWAIT COMPLETION + +;;; READ-COMPARE COMPLETED. CHECK IT. +QRC2: SPM PARPG ;SET UP MAP TO PAGE BEING READ/WRITTEN + MOVEI T,600000+PMCSHM(A) + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + MOVEI H,0 ;H DIFFERENCE COUNT +IFN KA10P,[ + PUSH P,A ;WILL DO COMPARE LOOP IN ACS + PUSH P,C + PUSH P,D + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVSI D,[ MOVE T,400000+PAREP*2000(E) ;A + CAMN T,QRCBUF(E) ;B + AOBJN E,A ;C + JRST QRC3 ] ;D + HRRI D,A + BLT D,D + JRST A +];KA10P +.ELSE [ + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVE T,400000+PAREP*2000(E) + CAMN T,QRCBUF(E) +QRC2A: AOBJN E,.-2 +];NOT KA10P +QRC3: JUMPGE E,QRC5 ;JUMP IF DONE + JUMPG H,QRC4 ;COMPARE ERROR, REPORT IT + AOS NQCMPE(Q) +IFN KA10P,[ + MOVE T,-1(P) ;SAVED C + BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(T) +];KA10P +.ELSE BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(C) +QRC4: ADDI H,1 + HRRZ T,E + CAIG H,4 ;ONLY REPORT FIRST 4 BAD WORDS + BUG INFO,[DSK: READ-COMPARE DIFFERENCE ],OCT,T,OCT,400000+PAREP*2000(E),OCT,QRCBUF(E) +IFN KA10P,JRST C +.ELSE JRST QRC2A + +QRC5: +IFN KA10P,[ + POP P,D + POP P,C + POP P,A +];KA10P + MOVEI T,0 ;CLEAR MAP + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + JUMPE H,QRC0 ;NO DIFFERENCE, I/O OPERATION IS DONE + CAILE H,4 ;FAILED, DO IT ALL OVER AGAIN + BUG INFO,[DSK: READ-COMPARE DIFFERENCES TOTAL],DEC,H + JRST QOVR +];QRDCMP + +QUFDWF: MOVE TT,QDWIP + CAMN Q,MDSK ;WRITTEN TO MASTER DISK? + SKIPN E,QSFBT(TT) ;AND HAVE SOME BLOCKS TO FREE? + JRST QUDWF1 + SETZM QSFBT(TT) ;YES, TRANSFER THEM TO QFBTS LIST + MOVE T,E ;E FINDS LAST OF LIST, T RPLACD'D IN THERE + EXCH T,QFBTS ;NCONC QSFBT ONTO FRONT OF QFBTS + SKIPE 1(E) + JRST [ MOVE E,1(E) + JRST .-1 ] + MOVEM T,1(E) + SKIPN T + AOS NCORRQ ;WAKE UP CORE JOB IF QFBTS HAD BEEN EMPTY +QUDWF1: JSP D,QDWF + QSNLCN(TT) + +QMFDWF: JSP D,QDWF + QMDRO + +QTUTWF: AOS T,QSGL(C) ;NEXT BLOCK TO GO OUT + AOS QSCABN(C) ;FROM NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;WRITE MORE + JSP D,QDWF + QTUTO(TT) + +QDWF: MOVSI E,(SETZ) ;UNLOCK DIR THAT WAS WRITTEN + IOR E,DCHBT(Q) ;COPY ON THIS DISK IS NOW UP TO DATE + MOVE TT,QDWIP + ANDCAM E,@(D) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + SETOM DWUSR + JRST QINT1A ;DON'T COUNT THIS AS DISK ACTIVITY + +QUDRIN: MOVE TT,QUDPR(C) ;USER DIR IN OK + MOVE D,UDNAME(R) + CAME D,QSNUD(TT) ;COMPARE UNAME IN DIR WITH RQ'ED + JRST QUDER1 + TLO R,40000 ;NOT PAWED OVER + MOVEM R,QSNLCN(TT) + MOVE R,QSLGL(C) + MOVEM R,QSNMI(TT) + MOVEI R,MU23UD ;USER DIRECTORY + PUSH P,A + PUSH P,C + MOVE C,TT + PUSHJ P,QDIRCK ;VERIFY NOT TOTALLY BASHED TO BEGIN WITH + POP P,C ;CLOBBERS A,B,I + POP P,A +QINTU4: DPB R,[MUR,,MEMBLT(A)] + DPB TT,[MNUMB,,MEMBLT(A)] +QTUTI1: SETOM QUSR(C) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QINT1A + +QMDRIN: TLO R,2 ;NOT RECONCILED + MOVEM R,QMDRO ;MASTER DIRECTORY IN + MOVE TT,MDCHK(R) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + MOVE TT,MDNUDS(R) + CAIE TT,NUDSL + BUG HALT,[MFD HAS WRONG NUMBER OF DIRECTORIES] + MOVE TT,(R) ;ASCENDING DIR # + SKIPGE QAMDNO + MOVEM TT,QAMDNO ;FIRST DISK IN STORE ASCENDING # + MOVEI R,MU23MD ;MASTER DIRECTORY + MOVE TT,Q ;DISK NO + JRST QINTU4 + +QTUTIN: AOS T,QSGL(C) ;NEXT BLOCK TO COME IN + AOS QSCABN(C) ;INTO NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;READ MORE + HRRZS QTUTO(Q) ;UNLOCK TUT, BUT QDPWF IS STILL SET + JRST QTUTI1 + +QSWPFN: MOVE Q,QDSKN(C) + TLNE D,%QAPAR + JRST QSWPF2 ;SWAP READ ERROR (I HOPE) + MOVSI E,MMPTMP ;PAGE NO LONGER IN TRANSIT + TDNN E,@QSMMP(Q) + BUG ;ALREADY WASN'T? + ANDCAM E,@QSMMP(Q) + SKIPL QSCRW(C) + JRST QSWPIF + PUSHJ P,IMEMR ;SWAP-OUT COMPLETE, RETURN MEMORY + MOVSI E,MMPPGB + ANDCAM E,@QSMMP(Q) + MOVSI E,MMPWOD ;PAGE HAS BEEN WRITTEN ON DISK. AND NO LONGER + IORB E,@QSMMP(Q) ;BEING PAGED BEHIND. + TLNN E,MMPGON + JRST QSWPF2 + MOVE A,QSMMP(Q) ;WE'RE SUPPOSED TO RETURN THE MMP ENTRY + PUSHJ P,RETMMP +QSWPF2: SETOM SWUSR(Q) ;SWAPPING IDLE + JRST QINT1B + +QSWPIF: +;SOME ERROR CHECKING + MOVE E,QSMMP(Q) + HLLZ TT,1(E) + JUMPE TT,QSWPF3 ;ON INITIAL-SWAP-IN, ADDRESS IN MMP IS SUPPOSED TO BE ZERO + LDB TT,[$MMPUN,,(E)] + CAME TT,Q + BUG + HLRZ TT,1(E) + CAME TT,QSGL(C) + BUG +QSWPF3: LDB TT,[MMMPX,,MEMBLT(A)] + CAIE TT,-MMP(E) + BUG +;END ERROR CHECKING + MOVEI TT,MURUSR ;SWAP IN OF PAGE COMPLETED + DPB TT,[MUR,,MEMBLT(A)] + SETZM MMSWP(A) + MOVE D,(E) + SKIPL CIRPSW + JRST QSWPF2 ;CAN'T PUT IN MAPS IF CIRPSW NOT AVAILABLE. + MOVSI D,(TDNE T,) ;SET UP CHECK USED BY PRIVELEGED USER FEATURE + HRR D,QSMMP(Q) + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS + POP P,Q + POP P,C + JRST QSWPF2 + +QWOVFN: CLEARM QSCRW(C) ;WRITE OVER SWITCH TO READ MODE + HRRI D,%QMRD1 + TLZE D,%QAEFW + HRRI D,%QMIDL ;TRYING TO CLOSE, STOP CHANNEL + MOVEM D,QSRAC(C) + AOS QWBUFS ;COMPENSATE FOR EXTRA SOS BELOW + +QWRFIN: TLNN D,%QACTH ;WRITE COMPLETE, RETURN BUFFER + PUSHJ P,IMEMR + TLNE D,%QACTH + PUSHJ P,CIMEMR + SOS QSBFS(C) + SOS QWBUFS + MOVE TT,QSGL(C) + MOVEM TT,QSLBLK(C) + JRST QINT1B + +QRD1FN: HLLZS QSRAC(C) .SEE %QMIDL ;BLOCK-AT-A-TIME READ COMPLETE, IDLE THE CHANNEL + +QRDFIN: MOVEI B,.BM MLO ;NORMAL READ COMPLETED + ANDCAM B,MEMBLT(A) ;THREAD ONTO CHANNEL LIST + HLRZ B,QBFP(C) + SKIPE B + DPB A,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM A,QBFP(C) + HRLM A,QBFP(C) + SKIPL B,QPIBSZ(C) ;GET BYTE COUNT OF BLOCK + JRST QRDFN1 + HRRZ B,1777(R) ;FUNNY BLOCK, GET FROM LAST WORD + HRRZ TT,QSBYTE(C) ;AND MAKE SURE IT'S NOT TOO BIG + IMULI TT,2000 + CAMLE B,TT + MOVE B,TT +QRDFN1: HRRZM B,MEMPNT(A) ;PASS TO MAIN PROGRAM + AOS QSBFS(C) +IFE DMDSK, LDB B,[XWBLK QXWDS] + .ALSO MOVEM B,QSLBLK(C) + +;XFER COMPLETE, DEACTIVATE CHANNEL + +QINT1B: SETOM QACTTM +QINT1A: SETOM QSGL(C) + SETOM QSCABN(C) +QINT1E: +IFE DC10P, SETOM QSKT1(Q) +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] ;DC10P +IFN T300P,[ + CAIL Q,T300P + SETOM QSDU1 + CAIGE Q,T300P + SETOM QSDU +];T300P +.ELSE SETOM QSDU +;DROPS THROUGH + ;DROPS IN + +;ACTIVATE CHANNELS, LOOK FOR SEEKS AND TRANSFERS TO BE DONE + +QINT1: SETZM QHUNGF + SETOM QTUNT ;NO UNIT SELECTED YET +IFN T300P, SETOM QTUNT1 + MOVE C,QTCHN ;START SCAN IN SUITABLE PLACE + MOVEM C,QLCHN + JRST QINT2D + +QINT2L: CAIGE C,NQCHN ;IF DIR-WRITE OR SWAP CHANNEL, DON'T CHECK QUSR + SKIPL QUSR(C) + SKIPGE D,QSRAC(C) .SEE %QALOK + JRST QINT2C ;CHANNEL LOCKED OR NOT OPEN, SKIP IT + MOVE Q,QDSKN(C) + SKIPL E,QSGL(C) + JRST QINT4 ;JUMP IF CHANNEL ACTIVE ALREADY + TLNE D,%QACTH+%QAOUT + JRST QINT2C ;CHANNEL BLOCKED BY CORE JOB, DON'T ACTIVATE + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE ACTIVATE HANDLER + OFFSET -. +%QMIDL::JRST QINT2C ;IDLE - DON'T ACTIVATE +%QMRD:: JRST QRDACT ;READ +%QMWRT::JRST QWRACT ;WRITE +%QMWOV::JRST QWRACT ;WRITE OVER +%QMRD1::JRST QRDACT ;READ 1 BLOCK + JRST 4,QINT2C ;ILL CODE +%QMUDR::JRST QDRACT ;UFD READ +%QMMDR::JRST QDRACT ;MFD READ +%QMTTR::JRST QDRACT ;TUT READ +%QMUDW::JRST 4,QINT2C ;UFD WRITE - SHOULDN'T LEAVE THIS MODE AROUND +%QMMDW::JRST 4,QINT2C ;MFD WRITE - .. +%QMTTW::JRST QINT5 ;TUT WRITE - MAY BE WRITING SECOND PAGE +%QMSWP::JRST SWPACT ;SWAP + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE +%QMMAX::OFFSET 0 + +; ACTIVATION ROUTINES + +SWPACT: SKIPL SWUSR(Q) + BUG ;SWAPPING ALREADY ACTIVE ON THIS DISK + MOVE A,MEMFR + SUB A,NCBCOM + MOVEI B,0 ;CHECK FIRST FOR SWAP IN OR OUT + CAIGE A,6 ;ACCORDING TO AVAIL MEM + MOVEI B,1 + SKIPN @SWAPL(B) ;IF NO TRAFFIC THAT DIRECTION, CHECK THE OTHER. + TRC B,1 + HRRZ E,@SWAPL(B) + JUMPE E,QINT2C ;NO SWAPPING TRAFFIC THIS DISK. + LDB A,[MLO,,MEMBLT(E)] ;TAKE BLOCK OFF LIST + SKIPN A + SETZM @SWAPL(B) ;LAST BLOCK, LIST IS NOW EMPTY + HRRM A,@SWAPL(B) ;SET NEW FIRST BLOCK + LDB D,[MMMPX,,MEMBLT(E)] + ADD D,MMPEAD ;GET MMP ADDRESS + LDB TT,[410200,,(D)] + TRNN TT,1 + BUG ;THIS PAGE SHOULD BE MARKED IN TRANSIT + HRRZM D,QSMMP(Q) + SOS SILNG(B) + CAIGE E,TSYSM + CAIGE E,SYSB + BUG + HRRZM E,QSCABN+NQCHN+1(Q) + CLEARM SWUSR(Q) ;CHNL ACTIVE + HLRZ E,MEMPNT(E) + MOVEM E,QSGL+NQCHN+1(Q) ;DISK BLOCK + HRRZS QSRAC+NQCHN+1(Q) .SEE %QMSWP + MOVNM B,QSCRW+NQCHN+1(Q) ;DIRECTION + CLEARM QERRS+NQCHN+1(Q) ;NO ERRORS (YET) + JRST QINT4 ;CHANNEL SUCCESSFULLY ACTIVATED + + +; MORE ACTIVATION ROUTINES + +QRDACT: TLNE D,%QAACC ;ACTIVATE READ CHANNEL + JRST QINT2C ;NOT IF USER HACKING RANDOM ACCESS NOW + SETZM QERRS(C) + MOVE J,QUDPR(C) + SKIPGE QSNLCN(J) + JRST QINT2C ;USER DIRECTORY OUT OR LOCKED + MOVE A,QSBFS(C) + SKIPL QSMDN(C) + AOS A ;A := TOTAL NUMBER OF BUFFERS + CAMLE A,QRDAHD ;HOW MUCH SHOULD BE READ AHEAD + JRST QINT2C ;BLOATED, DON'T ACTIVATE + SKIPE QSBI(C) + JRST QINT4A ;BLOCKS LEFT FROM LAST TIME +QINT4B: PUSHJ P,QIDRCH ;GET NEXT DESC BYTE IN A, ALSO RET BYTE PNTR IN TT + CAIN A,UDWPH + JRST QINT4B + JUMPE A,QEOF ;REACHED READ EOF + TRZE A,40 + JRST QINT4C + CAILE A,UDTKMX + JRST QINT4D ;SKIP AND TAKE + MOVEM A,QSBI(C) ;TAKE NEXT N +QINT4A: SOS QSBI(C) + AOS E,QSLGL(C) +QINT4G: MOVEM E,QSGL(C) + MOVSI B,%QALBK + ANDCAM B,QSRAC(C) ;CLEAR PROCESSING LAST BLOCK IN FILE BIT + HRRZ A,QSBYTE(C) + IMULI A,2000 ;NUMBER OF BYTES IN A FULL BLOCK +IFN DMDSK,[ + MOVSI D,%QAFNY ;FUNNY FILE + TDNE D,QSRAC(C) + SETO A, +] + MOVEM A,QPIBSZ(C) ;SET FUNNY BIT + SKIPE QSBI(C) + JRST QINT4 ;IF MORE BLOCKS FOLLOW DON'T CHECK EOF + PUSHJ P,QIDRCH ;GET NEXT DESCR BYTE + SOS QDIRP(C) ;CORRECT PNTR + JUMPN A,QINT4 + MOVE A,QUDFPR(C) ;THIS IS LAST BLOCK + ADD A,QSNLCN(J) + LDB D,[UNBYTE+UNREF(A)] + PUSHJ P,QBDCD + IMUL D,E ;NUMBER OF UNUSED BITS IN LAST WORD + LDB E,[QSBSIZ(C)] ;(DEPEND ON DIVIDE ROUNDING DOWN) + IDIV D,E ;NUMBER OF UNUSED BYTES (IN SIZE OPEN) + LDB E,[UNWRDC+UNRNDM(A)];NUMBER OF USED WORDS IN LAST BLOCK + SKIPN E + MOVEI E,2000 + IMULI E,@QSBYTE(C) ;CONVERT TO NUMBER OF BYTES + SUB E,D ;NUMBER OF VALID BYTES IN BLOCK + HRRM E,QPIBSZ(C) ;STORE BYTE COUNT OF LAST BLOCK + IORM B,QSRAC(C) .SEE %QALBK + MOVE E,QSGL(C) + JRST QINT4 + +QINT4D: MOVEI E,1-UDTKMX(A) ;SKIP N AND TAKE 1 + ADDB E,QSLGL(C) + JRST QINT4G + +QWRACT: SKIPN I,QBFP(C) ;ACTIVATE WRITE CHANNEL + JRST QINT2C ;END OF WRITE LIST FOR NOW + HRRZM I,QSCABN(C) + LDB H,[MLO,,MEMBLT(I)] + HRRM H,QBFP(C) + SKIPN H + SETZM QBFP(C) ;LAST BLOCK, LIST NOW EMPTY + HLRZ E,MEMPNT(I) + MOVEM E,QSGL(C) + JRST QINT4 + +QDRACT: MOVE E,QSLGL(C) ;ACTIVATE DIRECTORY-READ CHANNEL + MOVEM E,QSGL(C) +; JRST QINT4 ;DROPS THROUGH + ;DROPS IN +QINT4: SKIPL QSCABN(C) ;SKIP IF NEED MEMORY + JRST QINT5 + PUSHJ P,IOMQ ;GET MEMORY FOR READ BUFFER + JRST QINT2C ;CAN'T +QINT5A: MOVEM A,QSCABN(C) + MOVEI D,MU23B + DPB D,[MUR,,MEMBLT(A)] + DPB C,[MNUMB,,MEMBLT(A)] + +QINT5: +IFN DC10P, MOVE TT,QTRAN(Q) +.ELSE MOVE TT,Q + SKIPN QSEEK(TT) ;IGNORE SEEKING DRIVE + SKIPGE QRCAL(TT) ;IGNORE RECALIBRATING DRIVE + JRST QINT2C +IFN T300P,[ ;IGNORE IF FOR CONTROLLER THAT IS NOT READY + CAIL TT,T300P + JRST [ SKIPGE QSDU1 + SKIPL QTUNT1 ;NOTE CODE HERE IS SIMILAR TO THAT AT QINT2F + JRST QINT2C ;T-300 CONTROLLER BUSY OR ALREADY COMMITTED + HRRZM Q,QTUNT1 ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN1 ;FOR THIS CHANNEL + JRST QINT2C ] ;T-300 CODE IS SIMPLIFIED SINCE NO SEEK OVERLAPS + SKIPL QSDU + JRST QINT2C +];T300P + HRRZ B,QSKT1(TT) + CAIN B,(C) + JRST QINT2F ;ALREADY SET FOR ME + SKIPL QSKT1(TT) + JRST QINT2C ;SET FOR SOME OTHER CHNL + HRRZM C,QSKT1(TT) ;AVAILABLE, SET IT FOR ME + PUSHJ P,QPOSR ;CONVERT DISK ADDRESS TO PHYSICAL +IFN DC10P,[ ;AND INITIATE SEEK + ADD E,[DSEEK] + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,E + LDB B,[DCYL E] + MOVE TT,QTRAN(Q) ;PRETEND SEEK ALREADY COMPLETE + MOVEM B,QPOSGL(TT) + MOVEM B,QPOS(TT) + JRST QINT2F ;DON'T WAIT FOR SEEK, START TRANSFER RIGHT AWAY +] ;DC10P +IFN RP10P,[ + TLO E,(DSEEKC) ;DSK SEEK + CONSZ DPC,20 + JRST 4,.-1 + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAMN TT,QPOS(Q) + JRST QINT2F ;IF WE'RE THERE, DON'T SEEK + MOVEM TT,QPOSGL(Q) + DATAO DPC,E + MOVEM E,QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, GO GET ANOTHER +] ;RP10P +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + HRRZ A,E + IOWRQ A,%HRADR ; Set track and sector + HLRZ A,E + IOWRQ A,%HRCYL ; Set cylinder + CAMN A,QPOS(Q) + JRST QINT2F ; On cylinder, don't seek + MOVEM A,QPOSGL(Q) + MOVEI A,%HMSEK + PUSHJ P,RHCMD ; Start seeking + SETOM QSEEK(Q) + JRST QINT2C ; Start other drives now? +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,E + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,E + PUSHJ P,RHSET + HLRZ TT,E ;GET CYLINDER PART OF ADDRESS + CAMN TT,QPOS(Q) + JRST QINT2F ;ON CYLINDER, DON'T SEEK + MOVEM TT,QPOSGL(Q) + MOVSI A,%HRDCL(Q) ;START SEEK + HRRI A,%HMSEK + PUSHJ P,RHSET + SETOM QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, START OTHER DRIVES +] ;RH10P + +IFN KL10P,[ +;CALL HERE TO SWEEP THE CACHE. CORE PAGE # IN R. +;INSTRUCTION AT CALL+1 SHOULD SKIP IF READING INTO CORE. +;CLOBBERS A,B,D,E,TT. + +CSHSWP: SETZB A,B ;A COUNTS WAIT TIME, B IS SWEEP INSTRUCTION + XCT @(P) + TLOA B,(SWPUO (R)) ;WRITE - UNLOAD PAGE FROM CACHE + MOVSI B,(SWPIO (R)) ;READ - CLEAR PAGE FROM CACHE + LSH R,1 ;HARDWARE PAGES ARE 1/2 K + XCT B ;SWEEP FIRST HALF-PAGE + MOVE D,[CONSZ 200000] + MOVE E,[AOJA A,D] + MOVSI TT,(POPJ P,) + PUSHJ P,D ;WAIT IN ACS TO MINIMIZE MBOX INTERFERENCE + AOS R ;SWEEP SECOND HALF-PAGE + XCT B + PUSHJ P,D + XCT @(P) + AOSA NCSHU ;COUNT NUMBER OF TIMES THIS DONE + AOSA NCSHI + JRST [ ADDM A,NCSHUL ? JRST .+2 ] + ADDM A,NCSHIL ;AND COUNT NUMBER OF LOOPS IN ACS + LSH R,-1 + JRST POPJ1 +] + +;VARIOUS EXITS FROM CHANNEL-CHECKING ROUTINES + +QINT2F: SKIPL QTUNT ;THIS CHANNEL IS READY TO TRANSFER + JRST QINT2C ;ALREADY FOUND A TRANSFER + HRRZM Q,QTUNT ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN ;FOR THIS CHANNEL +QINT2C: CAMN C,QLCHN ;CONTINUE CHANNEL SCAN + JRST QINT2E ;UNLESS CHECKED ALL CHANNELS +QINT2D: CAIL C,NQCHN+1+NQS-1 ;SKIP IF NOT TIME TO WRAP AROUND + SETO C, + AOJA C,QINT2L ;CHECK ANOTHER + +QINT2E: +IFN T300P,[ + MOVE C,QTCHN1 + SKIPL Q,QTUNT1 ;FOUND XFER FOR T-300? + JRST QDE1 ;YES +];T300P + SKIPGE Q,QTUNT ;FOUND XFER? + JRST QINT3 ;IDLE + MOVE C,QTCHN +;Q DISK TO TRANSFER ON, C CHANNEL. START (OR RESTART) TRANSFER ON THEM. +QDE1: MOVE R,QSCABN(C) +IFN KL10P,[ + PUSHJ P,CSHSWP + SKIPGE QSCRW(C) +];KL10P +IFN KS10P,[ + SKIPL QSCRW(C) + CLRCSH +];KS10P +IFE T300P, MOVEM C,QSDCH +IFN T300P,[ + CAIL Q,T300P + JRST T3IO + CAIGE Q,T300P + MOVEM C,QSDCH +];T300P + SKIPGE B,QSCRW(C) ;LOAD R/W STATUS IN B + JRST QINT6W + ;READ - DROPS IN +IFN RP10P,[ + MOVSI T,(DREADC) +QINT6A: IORI T,7000+QICWA ;DON'T STOP FOR PARITY ERRORS (PLUS INITIAL CHNL ADR) + MOVEM T,QCHPRG + DPB Q,[DUNFLD+QCHPRG] + HLLZS QIOWD + DPB R,[121000,,QIOWD] + LDB E,[100300,,R] ;MA15-17 + TRC E,7 + DPB E,[410300,,QIOWD] ;SET UP HIGH ADDR BITS. + MOVE TT,QIOWD + SOS TT + HRRM TT,QIOWD + SETZM QIOWD+1 + MOVEM Q,QSDU + MOVE E,QSGL(C) + PUSHJ P,QPOSR + IORM E,QCHPRG +QOVR: CONSZ DPC,20 + JRST QOVR + SKIPGE Q,QSDU + BUG + CONO DPC,175700+DSKCHN +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVEI TT,QIOWD + HRRZM TT,QICWA + MOVE E,QCHPRG + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAME TT,QPOS(Q) + BUG ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + SETZM QICWA+1 + DATAO DPC,QCHPRG ;ENTRY ON OVERRUN + MOVE A,TIME + MOVEM A,LQTM + MOVEM Q,QSDU + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DPC,DCLEAR+20+DSKCHN ;DISK NOTICED TO BE HUNG, RESET IT + SETOM QHUNGF ;TELL P.I. LEVEL TO RETRY OPERATION + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + ;READ - DROPS IN + +IFN RH11P,[ + MOVEI T,%HMRED +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,1 ; Set up Unibus map for RH11 to point at + TRO R,%UQVAL+%UQFST ; the block in question. + IOWRQ R,UBAPAG+QUBPG_1 + ADDI R,1 + IOWRQ R,UBAPAG+QUBPG_1+1 + MOVE E,[-4000,,QUBPG_14] + MOVEM E,QIOWD + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: IORDQ TT,%HRCS1 ; Enter here to recover from PI level lossage + TRNN TT,%HXRDY + JRST QOVR + SKIPGE Q,QSDU + BUG +QECCX: ;; Enter here from ECC correction code + PUSHJ P,RHCLRC ; Clear controller errors and select drive + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ; Punt if not positioned in right place + IOWRQ TT,%HRCYL ; Store cylinder in drive + HRRZ TT,QCHPGA + IOWRQ TT,%HRADR ; Store track and sector + HLRZ TT,QIOWD + IOWRQ TT,%HRWC ; Store halfword count + HRRZ TT,QIOWD + IOWRQ TT,%HRBA ; Store Unibus base address + MOVE A,QCHPRG + PUSHJ P,RHCMD ; Go! + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: MOVEI A,%HYCLR ; Sock controller in jaw + IOWRQ A,%HRCS2 + MOVE Q,QSDU + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Redundantly clear drive + SETOM QHUNGF + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT #],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, + +] ;RH11P + ;READ - DROPS IN + +IFN RH10P,[ + MOVEI T,%HMRED +QINT6A: IORI T,QICWA_6 .SEE $HCICWA + TLO T,%HRCTL(Q) + MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,10. ;ASSEMBLE DF10-C CONTROL WORD + SUBI R,1 + MOVNI E,2000 + DPB E,[$DFWC R] + MOVEM R,QIOWD + SETZM QIOWD+1 + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: CONSZ DSK,20 ;ENTER HERE FOR RECOVER FROM PI HALT, OVERRUN + JRST QOVR + SKIPGE Q,QSDU + BUG + MOVEI TT,QIOWD + HRRZM TT,QICWA +QECCX: SETZM QICWA+1 ;ENTER HERE FROM ECC CORRECTION CODE + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,QCHPGA + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,QCHPGA + PUSHJ P,RHSET + MOVE A,QCHPRG + PUSHJ P,RHSET +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DSK,%HOCLR+%HORST+%HOSTP+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;CLEAR DRIVE + PUSHJ P,RHSET + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, +] + ;READ - DROPS IN +IFN DC10P,[ + MOVSI T,(DREAD) +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + DPB R,[DCBN+QCHPR2] ;MEM BLOCK # + DPB R,[DCBN+QCHPR3] ;FOR POSSIBLE READ COMPARE + MOVE E,QSGL(C) + PUSHJ P,QPOSR ;QPOSR ALSO STORES MAPPED UNIT IN QCHPRG + IORB E,QCHPRG + CLEARM QCHPR4 ;STORE DHALT FOR NO RCC + CAILE C,NQCHN + JRST QINT6S ;SWAPPING CHNL + SKIPL B + AOSA NRXFR + AOS NWXFR + CAIE C,NQCHN ;ALWAYS R COMPARE DIR WRITES + SKIPLE QRCSW ;SKIP ON NOT READ COMP EVERYTHING + JRST QINT6B ;RCC + SKIPL QRCSW + JUMPL B,QINT6B ;RCC WRITES + HRRZ D,QSRAC(C) + CAIL D,%QMUDR + CAILE D,%QMTTR + JRST QINT6C ;NOT DIR READ +QINT6B: TLZ E,340000 ;CHANGE TO READ COMPARE + MOVEM E,QCHPR4 +QINT6C: SETOM QERS1 ;ERR VERIFY IND +QOVR: CONSZ DC0,DSSRUN+DSSACT + JRST QOVR + DATAO DC0,[DJMP QCHPRG] ;ENTRY ON OVERRUN +QOVR1: CONO DC0,DCSET+DCIENB+DSKCHN ;INTERRUPT WHEN DONE + MOVE A,TIME + MOVEM A,LQTM +QINTX: JRST DSKEX + +QINT6S: SKIPL B + AOSA NSRXFR + AOS NSWXFR + JUMPL B,QINT6B ;RCC WRITES + JRST QINT6C ;NOT READS + +QHUNG: CONO DC0,DCCSET+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + +QINT6W:IFE DMDSK,[ + MOVE T,[QXWDS-1,,QXWDS] + BLT T,QXWDS+3 + CAIL C,NQCHN + JRST QNT6W2 ;SWAP OR DIR WRITE + MOVE A,QUDPR(C) + MOVE T,QSNUD(A) + MOVEM T,QXWDS+XWSYSN + HRRZ A,QSNLCN(A) + ADD A,QUDFPR(C) + MOVE T,UNFN1(A) + MOVEM T,QXWDS+XWFN1 + MOVE T,UNFN2(A) + MOVEM T,QXWDS+XWFN2 + MOVE T,QSLBLK(C) + DPB T,[XWBLK+QXWDS] + LDB T,[MWC,,MEMBLT(R)] + DPB T,[XWAWC+QXWDS] +QNT6W2: +] +IFN DC10P, MOVSI T,(DWRITE) +IFN RP10P, MOVSI T,(DWRITC) +IFN RH10P, MOVEI T,%HMWRT +IFN RH11P, MOVEI T,%HMWRT + JRST QINT6A + +IFN T300P,[ +T3IO: MOVEM C,QSDCH1 ;THIS IS MORE OR LESS QINT6A FOR T-300 + MOVEM Q,QSDU1 + MOVEI A,%DMRED + SKIPGE B,QSCRW(C) + MOVEI A,%DMWRT +T3IO1: MOVE R,QSCABN(C) ;RE-ENTER HERE TO RETRY WITH COMMAND IN A + LSH R,10. ;FIRST ADDRESS IN TRANSFER + TLO R,730000 ;12-BIT BYTES, START WITH FIRST BYTE IN WORD + MOVSI E,-4 ;SET UP BYTE POINTERS + MOVEM R,DSCPNT(E) + ADDI R,400 + AOBJN E,.-2 + MOVE D,QSGL(C) ;DO LIKE QPOSR + CAIL D,NBLKS1 + BUG + IDIVI D,NBLKC1 + MOVEM D,DSCCYL + IMULI E,SECBL1 + IDIVI E,NSECS1 + MOVEM E,DSCHED + MOVEM TT,DSCSEC + PUSHJ P,T3CMD + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR1 + AOS NWXFR1 + JRST QINTX + SKIPL B + AOSA NSRXF1 + AOS NSWXF1 + JRST QINTX + +;START T-300, COMMAND IN A, DRIVE IN Q +T3CMD: MOVEI TT,2561 + MOVEM TT,DSCCHK + MOVE TT,TIME + MOVEM TT,LQTM1 + MOVEI TT,-T300P(Q) + MOVEM TT,DSCDRV + HRRZM A,DSCCMD + SETZM DSCDON + MOVEI T,1 + MOVEM T,DSCREQ + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, + +QHUNG1: MOVE Q,QSDU1 + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON T-300 UNIT ],DEC,QSDU + MOVEI TT,5*60.*30. ;SHUT UP FOR FIVE MINUTES + ADDM TT,LQTM1 + POPJ P, +];T300P + +QDE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT +IFN DC10P, AOSE PKIDM + SKIPGE Q,QSDU + BUG +IFN DC10P,[ + TRNE TT,DCKSER + JRST .+3 ;GET CKS ERR + TRNE TT,DRCER + AOS NQCMPE(Q) ;# COMPARE ERRORS [WITH NO OTHER ERROR] +];DC10P +IFN T300P,T3DE: ;ENTER HERE FOR ERROR ON T-300 + AOS NQDE(Q) + SKIPL R,QSCRW(C) + AOSA NQRDE(Q) + AOS NQWDE(Q) +IFN DC10P, JUMPL R,QERV1 ;DO ANOTHER RD/COMP TO SEE IF OK ON DSK (IF WRITE) +QERV2: AOS R,QERRS(C) + TRNN R,10 ;TRY 8 TIMES BEFORE AND AFTER REPOSITION + JRST QDE1 + TRNN R,1000 + JRST QDE2 ;TRY REPOSITION ONCE +QERV3: MOVE D,QSRAC(C) + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE IRRECOV ERROR HANDLER +QERV: OFFSET -. +%QMIDL::JRST 4,QERV+. ;IDLE CHANNELS SHOULDN'T GET HERE +%QMRD:: JRST QPE2D ;USER DATA +%QMWRT::JRST QDE1 ;WRITE KEEP TRYING +%QMWOV::JRST QDE1 ;.. +%QMRD1::JRST QPE2D + JRST 4,QERV+. ;ILL CODE +%QMUDR::JRST QUDER1 +%QMMDR::JRST QDE1 +%QMTTR::JRST QDE1 +%QMUDW::JRST QDE1 +%QMMDW::JRST QDE1 +%QMTTW::JRST QDE1 +%QMSWP::JRST QSWPER + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE +%QMMAX::OFFSET 0 + +QSWPER: SKIPGE CIRPSW ;TRY XFER AGAIN IF CIRPSW NOT AVAILABLE + SKIPGE QSCRW(C) + JRST QDE1 ;DON'T TRY TO DO ANYTHING ABOUT WRITE ERRORS + MOVE A,QSCABN(C) ;READ - GIVE ALL USERS OF PAGE PARITY ERR + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,UCPRL + 400000,,QSWER1 + LDB Q,[2200,,MEMPNT(A)] + DPB Q,C ;REMOVE MEM FROM LOOP + PUSHJ P,IMEMR ;AND GIVE BACK MEM + POP P,Q ;ALTERNATIVELY, COULD LEAVE THE MEM BUT SET MMPBAD + POP P,C ;TO INDICATE THAT THAT MEM COPY OF THE PAGE IS NO GOOD. + MOVEI D,2 + DPB D,[410200,,@QSMMP(Q)] ;PAGE IS OUT + JRST QPE2D + +QSWER1: PUSH P,T + MOVSI T,%PJPAR + IORM T,PIRQC(U) + JRST POPTJ + +IFN DC10P,[ +QERV1: SKIPN QCHPR4 + JRST QERV2 ;NOT SET FOR RCC + CLEARM QERS1 +QERL2: CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,[DJMP QCHPR4] + JRST QOVR1 + +QERL1: AOS Q,QERS1 + CAIGE Q,50. + JRST QERL2 + AOSA NQWIRE +QEROK: AOS NQWRE + MOVE C,QSDCH + MOVE Q,QSDU + SETOM QERS1 + JRST QERV2 +] +QDE2: MOVEI R,1000 + MOVEM R,QERRS(C) ;CLOBBER QERRS + JRST QREC ;AND TRY REPOSITIONING + +IFN RP10P,[ +QERSOFT:LDB A,[DCYL+QCHPRG] ;PARSE STARTING DISK ADDRESS + LDB B,[DCYLXB+QCHPRG] + LSH B,8 + IOR A,B + LDB B,[DSURF+QCHPRG] + LDB D,[DSECT+QCHPRG] + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: SOFT ERR UNIT ],DEC,Q,[CYL ],DEC,A,[STARTING HEAD ],DEC,B,[SEC ],DEC,D,[CONI=],OCT,QERST,[DATAI=],OCT,QERDTI + POPJ P, + +QRECAT: CONI DPC,A + BUG INFO,[DSK: SEEK ERR DATAO=],OCT,QSEEK(Q),[CONI=],OCT,A,[DATAI=],OCT,E + SETZM QSEEK(Q) + JRST QREC +];RP10P + +QHE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT + SKIPGE Q,QSDU + BUG +IFN T300P,T3HE: ;ENTER HERE FOR ID ERROR ON T-300 + AOS NQHE(Q) + AOS E,QERRS(C) + CAIL E,5. + JRST QHE2 +QREC: +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QRCAL(Q) + MOVEI A,%DMREC + PUSHJ P,T3CMD + MOVEM Q,QSDU1 ;CONTROLLER IS TIED UP BY RECAL BECAUSE + JRST QINT1 ] ;IT'S TOO DAMNED PSEUDO-INTELLIGENT +];T300P +IFN DC10P,[ + MOVE TT,QTRAN(Q) +QREC0: DPB TT,[DUNFLD+QRECAL] + SETOM QRCAL(TT) + SETOM QSKT1(TT) + CLEARM QSPPS(TT) + CLEARM QPOSGL(TT) + SETOM QPOS(TT) + MOVEI T,10. ;5-SECOND RECALIBRATE TIMEOUT + MOVEM T,QRCTIM(TT) + DATAO DC0,QRECAL + CONO DC0,DCSET+DCATEB+DSKCHN ;ENABLE ATTENTION +] +IFN RP10P,[ + DPB Q,[DUNFLD+QRECAL] + SETOM QPOS(Q) + DATAO DPC,QRECAL + CLEARM QSPPS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) ;INDICATE RECALIBRATING THIS DISK + CLEARM QPOSGL(Q) +] +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Clear errors + MOVEI A,%HMREC + PUSHJ P,RHCMD ; Recalibrate + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR + PUSHJ P,RHSET ;CLEAR ERROR OUT OF DRIVE. + MOVSI A,%HRDCL(Q) + HRRI A,%HMREC ;RECALIBRATE + PUSHJ P,RHSET ;MAYBE SHOULD TRY OFFSET FIRST? + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] + SETOM QSDU + JRST QINT1 ;LOOK FOR SOME OTHER TRANSFER + +QHE2: SKIPL QSCRW(C) ;HANG UP OR POSITIONING ERR (AFTER 5 TRIES) + JRST QERV3 ;IF READ, PERFORM RECOVERY + +QPE2D: MOVSI R,%QAPAR ;IRRECOVERABLE ERROR + IORM R,QSRAC(C) + AOS QIRRCV + MOVE D,QSGL(C) + MOVEM D,QIRCBK ;BLOCK # AT IRRCV ERR + MOVEM Q,QIRUNT ;SAVE UNIT TOO + CAILE C,NQCHN + AOS NIRSWE ;# IRRCV SWAPPING ERRS + MOVE I,Q + SKIPGE QTUTO(I) + JRST QPE2E ;DON'T MESS WITH LOCKED TUT + PUSHJ P,TUTPNT + CAIN B,TUTLK ;PRINT MESSAGE IF NOT YET LOCKED OUT + JRST QINTI + MOVEI B,TUTLK + DPB B,D +QPE2E: BUG INFO,[DSK: IRREC DATA ERR #],DEC,QIRRCV,[UNIT=],DEC,QIRUNT,[BLK=],OCT,QIRCBK + JRST QINTI + +QUDER1: MOVEI R,1(Q) ;TRY TO READ DIR FROM OTHER DISKS +QUDER2: CAIL R,NQS + MOVEI R,0 + CAME R,QDSKN(C) + JRST QUDER4 + JRST QDE1 ;NO OTHER DISK AVAIL TO READ FROM, TRY AGAIN + +QUDER4: SKIPGE QACT(R) + AOJA R,QUDER2 + HRRZM R,QDSKN(C) ;TRY THIS DISK +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QSDU1 ;FREE DRIVE FORMERLY HACKING + SETOM QTUNT1 + JRST T3UDE4 ] +];T300P +IFE DC10P, SETOM QSKT1(Q) ;FREE DRIVE FORMERLY HACKING +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] + SETOM QSDU + SETOM QTUNT +IFN T300P,T3UDE4: + MOVE E,QSGL(C) + MOVE Q,QDSKN(C) + SETZM QERRS(C) + JRST QINT5 + +QIDRCH: MOVE TT,QDIRP(C) ;CHNL IN C PNTR TO QSNUD IN J LOAD NEXT CHR INTO A + AOS QDIRP(C) ;ALSO RET BYTE PNTR IN TT + IDIVI TT,UFDBPW + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(J) + ADDI TT,UDDESC(I) + LDB A,TT + POPJ P, + +QMPDCH: MOVE TT,QDIRP(A) ;CHNL IN A PNTR TO QSNUD IN H LOADS NEXT CHR IN R + AOS QDIRP(A) ;USED AT M.P. LEVEL +QMPDC1: IDIVI TT,UFDBPW ;ALSO RETN BYTE PNTR IN TT + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(H) + ADDI TT,UDDESC(I) + LDB R,TT + POPJ P, + +;REACHED EOF ON READ +QEOF: SOS QDIRP(C) ;AVOID GC UNHAPPINESS + MOVSI I,%QAEFR + IORM I,QSRAC(C) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + AOS QSBFS(C) ;TO UNHANG M.P. WHICH IS WAITING FOR BUF TO APPEAR + JRST QINT2C + +QINT4C: +IFN DMDSK,[ + MOVSI E,%QAFNY + ANDCAM E,QSRAC(C) + TRZE A,20 ; FUNNY FILE BLOCK + IORM E,QSRAC(C); INDICATE SO +] + MOVEI E,0 + DPB A,[140500,,E] + PUSHJ P,QIDRCH + DPB A,[060600,,E] + PUSHJ P,QIDRCH + DPB A,[0600,,E] + MOVEM E,QSLGL(C) + JRST QINT4G + +;DECODE UNBYTE SPEC IN D. +;RETURNS BYTE SIZE IN D, NUMBER OF UNUSED BYTES IN LAST WORD IN E. +QBDCD: TRZE D,400 + JRST [ IDIVI D,100 ? POPJ P, ] + TRZE D,200 + JRST [ IDIVI D,20 ? POPJ P, ] + SUBI D,44 + JUMPGE D,[ IDIVI D,4 ? POPJ P, ] + MOVNS D + SETZ E, + POPJ P, + +;ENCODE BYTE SIZE IN Q AND RESIDUE IN R INTO UNBYTE SPEC IN RH(Q) +QBENC: CAIG Q,3 + JRST [ IMULI Q,100 ? ADDI Q,400(R) ? POPJ P, ] + CAIG Q,7 + JRST [ IMULI Q,20 ? ADDI Q,200(R) ? POPJ P, ] + CAIG Q,18. + JRST [ IMULI Q,4 ? ADDI Q,44(R) ? POPJ P, ] + MOVNI Q,-44(Q) + POPJ P, + +QINT3: SKIPL DWUSR + JRST QINT3X ;DIR CHNL IN USE +IFN T300P,[ + SKIPGE QSDU ;DON'T GET PAST HERE UNLESS BOTH CONTROLLERS ARE IDLE + SKIPL QSDU1 + JRST QINT3X +];T300P + AOSL QDWFAR + JRST [ MOVNI H,10. + MOVEM H,QDWFAR + JRST .+3 ] + SKIPG QACTTM ;LAST ACTIVITY TOO RECENT + JRST QUDW + SKIPGE H,QMDRO + JRST QTDW + MOVE J,QACTB + TDNN J,H + JRST QTDW + MOVSI Q,-NQS +QMDW: SKIPGE QACT(Q) + JRST QMDWA ;UNIT NOT ACTIVE + MOVE J,DCHBT(Q) + TDNN J,QMDRO + JRST QMDWA + HRLI Q,(SETZ) ;INDICATE MFD WRITE IN PROGRESS + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMMDW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QMDRO + MOVE C,MDCHK(TT) + CAME C,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + HRRZ C,Q + CAMN C,MDSK + AOSA C,QAMDNO + MOVE C,QAMDNO + MOVEM C,MDNUM(TT) + SETZM DWUSR + MOVEI TT,MFDBLK + MOVEM TT,QSGL+NQCHN + HRRZ TT,QMDRO + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QMDWA: AOBJN Q,QMDW +QTDW: SKIPG QACTTM + JRST QUDW + MOVSI Q,-NQS +QTDW1: SKIPGE QACT(Q) + JRST QTDWA + MOVE J,DCHBT(Q) + SKIPL QTUTO(Q) + TDNN J,QTUTO(Q) + JRST QTDWA + MOVSI H,240000 + TDNE H,QTUTO(Q) + JRST QTDWA1 + MOVE TT,TIME ;DON'T WRITE TUTS TOO OFTEN + SUB TT,QTWRTM(Q) ;BECAUSE THE TUT IS LOCKED WHILE IT'S BEING WRITTEN + CAIGE TT,100. + JRST QTDWA + ADDM TT,QTWRTM(Q) + HRLI Q,200000 + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMTTW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QTUTO(Q) + MOVE H,QPKNM(Q) ;VERIFY THAT TUT IS NOT BEING CLOBBERED + MOVE C,QPKID(Q) + CAMN H,QPAKID(TT) + CAME C,QPKNUM(TT) + BUG HALT,[TUT ],DEC,Q,[CLOBBERED] + SETZM DWUSR + MOVEI TT,MFDBLK ;INITIATE WRITING OF FIRST BLOCK OF TUT + SUB TT,NTBL(Q) + MOVEM TT,QSGL+NQCHN + LDB TT,[121000,,QTUTO(Q)] + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QTDWA1: ANDCAM J,QTUTO(Q) +QTDWA: AOBJN Q,QTDW1 +QUDW: MOVSI C,-QNUD +QDW4A: MOVE J,QACTB ;BITS CORRESP TO ACTIVE DISKS +QDW4: SKIPE TT,QSNUD(C) + SKIPGE QSNLCN(C) + JRST QDW3 ;SLOT VACANT OR LOCKED + TDNE J,QSNLCN(C) + JRST QUDW1 ;NEEDS TO BE WRITTEN ON SOME UNIT +QDW3: AOBJN C,QDW4A +QINT3X: ;HERE IF DISK GOING IDLE. CLEAR DONE FLAG. + ;IN 2-CONTROLLER CASE, MAKE SURE WE ONLY DO IT TO THE RIGHT CONTROLLER. +IFN T300P,[ + SKIPL QSDU + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW +] ;T300P +IFN DC10P, CONO DC0,DCCLR+DCIENB+DSKCHN +IFN RP10P, CONO DPC,177710+DSKCHN ;MUST CLEAR "DONE" +IFN RH10P, CONO DSK,%HOCLR+%HOATN+%HORAE+DSKCHN +IFN RH11P, ;; RH11 doesn't need this? + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW + +QUDW1: MOVSI J,%QUDWM ;WRITE RIGHT AWAY IF %QUDWM IS ON + TDNN J,QSNLCN(C) + SKIPE QSFBT(C) ;OR DISK BLOCKS (AND CORE) WAITING TO BE FREED + JRST QUDW6 + SKIPG QACTTM ; ACTIVITY TOO RECENT + SKIPN QSNNR(C) ; THEN ONLY WRITE IF NOTHING POINTING TO DIRECTORY + SKIPA + JRST QDW3 + MOVSI Q,-NQS +QUDW4: SKIPGE QACT(Q) + JRST QUDW3 + MOVE J,DCHBT(Q) + TDNE J,QSNLCN(C) + JRST QUDW2 +QUDW3: AOBJN Q,QUDW4 + JRST QDW3 + +QUDW6: ANDCAM J,QSNLCN(C) ;TURN OFF %QUDWM + MOVE Q,MDSK ;AND WRITE ON MASTER DISK (ASSUME MDSK IS ACTIVE AND BIT IN QSNLCN IS SET) + +QUDW2: MOVE I,QMDRO + TLNE I,40000 ;IS THIS CODE OBSOLETE? LEFT FROM DAYS OF 1 MFD PER DRIVE? + JRST QUDW2B ;MASTER DIR NOT IN + HRRZS Q + CAMN Q,MDSK ;SKIP IF NOT WRITING ON MASTER DISK + PUSHJ P,QDIRCK ;BLESS THIS UFD!!! + MOVSI TT,(SETZ) + IORB TT,QSNLCN(C) ;LOCK USER DIRECTORY + MOVEI J,%QMUDW + HRRZM J,QSRAC+NQCHN + MOVE A,1(TT) ;NAME AREA PTR + MOVE J,QSNUD(C) + CAMN J,UDNAME(TT) ;MAKE SURE NOT ABOUT TO WRITE BAD DIRECTORY + CAILE A,2000 + JSP TT,QUDCLB + SUBI A,11. + IMULI A,6 + SKIPL J,(TT) + CAMLE J,A ;FS PTR BAD? + JSP TT,QUDCLB + CLEARM DWUSR + MOVEM Q,DWSKN + MOVE TT,QSNMI(C) + MOVEM TT,QSGL+NQCHN + HRRZ TT,QSNLCN(C) + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + HRRZM C,QDWIP + CLEARM QERRS+NQCHN + JRST QINT1 + +QUDW2B: ANDCAM J,QSNLCN(C) ;CLEAR BIT + GO AWAY + JRST QUDW3 + +;GENERALLY GET HERE BY JSP TT, +QUDCLB: BUG HALT,[DIR ],OCT,C,SIXBIT,QSNUD(C),[CLOBBERED] + +QDIRCK: PUSH P,TT ;CHECKS FILES FOR REASONABLE DESCRIPTORS - + ; PRECEDING BYTE =0, FIRST BYTE NOT=0 + HRRZ A,QSNLCN(C) + MOVEI B,1777(A) ;END OF NAMES + ADD A,1(A) ;BEGIN NAMES +QDIRC1: CAMG B,A + JRST POPTTJ ;DONE + SKIPN (A) + JRST QDIRC2 ;0 NAME=NO FILE + LDB TT,[1500,,UNRNDM(A)] ;DESC PTR + SOS TT ;TRICK - IF DESC PTR = 0 LDB BELOW GETS 0 BECAUSE P FIELD = 44 + IDIVI TT,6 + HLL TT,SBTBL(I) ;BYTE POINTER + ADDI TT,UDDESC-1777(B) + LDB I,TT + JUMPN I,QUDCLB + ILDB I,TT + JUMPE I,QUDCLB +QDIRC2: ADDI A,LUNBLK + JRST QDIRC1 + +IFN RP10P,[ +QPOSR: CAIL E,MBLKS + BUG ;TOO BIG EVEN FOR RP03 +IFN DMDSK,[ + IMULI E,SECBLK + IDIVI E,NSECS + SETZM D + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + DPB Q,[DUNFLD+D] +] +IFE DMDSK,[ + MOVEI D,0 + IDIVI E,NBLKSC + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + MOVE E,TT + IMULI E,NSSECS + IDIVI E,NHSECS + DPB E,[DSURF+D] + DPB TT,[DSECT+D] + DPB Q,[DUNFLD+D] +] + MOVE E,D + POPJ P, +] +IFN RH10P+RH11P,[ +IFE DMDSK, .ERR CHANGE QPOSR FOR 9-SECTOR BLOCKS! +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NBLKSC + HRLZ D,E ;CYLINDER IN LH + MOVEM E,QSPPS(Q) + MOVE E,TT + IMULI E,SECBLK + IDIVI E,NSECS + LSH E,8 + IOR E,D ;SURFACE IN 1.9-2.4 + IOR E,TT ;SECTOR IN 1.1-1.5 + POPJ P, +] ;RH10P+RH11P + +IFN DC10P,[ +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NSECS + MOVSI D,(DUNENB) + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + SKIPGE TT,QTRAN(Q) + ADDI E,NCYLS+XCYLS + DPB E,[DCYL+D] + MOVEM E,QSPPS(TT) + MOVE E,D + DPB TT,[DUNFLD+E] + DPB TT,[DUNFLD+QCHPRG] + SKIPGE TT,QPKID(Q) + JRST QPOSRI + DPB TT,[DPKID+E] + POPJ P, + +QPOSRI: MOVE TT,QTRAN(Q) ;NEED PACK ID BEFORE PROCEEDING + DPB TT,[DUNFLD+GPKID] + SETOM QSKT1(TT) + MOVEI A,TUTCYL + SKIPGE QTRAN(Q) + ADDI A,NCYLS+XCYLS + DPB A,[DCYL+GPKID] + MOVEM A,QPOS(TT) ;WILL SEEK TO HERE AUTOMATICALLY + MOVEM A,QPOSGL(TT) + DATAO DC0,[DJMP GPKID] + MOVEM Q,QSDU + SETOM PKIDM + JRST QINTX + +QSPKID: CONSZ DC1,1777 + BUG ;ERRORS + LDB TT,[DPKID+RPKID] + MOVEM TT,QPKID(Q) + SETOM QSDU + JRST QINT1 +] + +SUBTTL DISK IOT ROUTINES + +OVHMTR UUO ;MORE RANDOM UUOS + +;BECAUSE .ACCESS MERELY DROPS ITS ARG IN A VARIABLE AND SETS %QAACC, +;ALL IOT ROUTINES MUST TEST %QAACC AND DO THE REAL WORK OF CHANGING +;THE ACCESS POINTER IF NECESSARY. + +QBO: MOVEI T,BLKT + JRST QUO1 + + SKIPA T,[SIOKT] +QUIO: +QUAO: MOVEI T,CHRKT +QUO1: PUSH P,T + PUSH P,TT + PUSH P,D + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBWRA1 ;RANDOM ACCESS MODE HACK + POP P,D + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKT, SIOKT, OR BLKT +QBOV: SETZ QSMPRP(A) + QSMPRC(A) + QSBWG + SETZ QSBWW + JRST QOCL + TRNA + +QBI: MOVEI T,BLKT + JRST QUI1 + + SKIPA T,[SIOKT] +QUII: +QUAI: MOVEI T,CHRKTI +QUI1: PUSH P,T + PUSH P,TT + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBRRA1 + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKTI, SIOKT, OR BLKT +QBIV: QSMPRP(A) + QSMPRC(A) + QSBGB + QSBRB + JRST QICL + SKIPG QSBFS(A) + +QBWRA1: TLNE T,%QALNK + JRST IOCR10 + LDB T,[$QAMOD,,QSRAC(A)] ;SET RANDOM ACCESS PNTRS ON WRITE + SOJN T,QBWRA2 ;IN ORDINARY WRITE MODE + SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO BECOME IDLE OR HANG UP IN READ + PUSHJ P,UFLS ; WAITING FOR %QAACC TO TURN OFF + SKIPL QSGL(A) + PUSHJ P,UFLS + SKIPGE QSMDN(A) + JRST QBWRA2 + MOVE T,QRADAD(A) ;DESIRED ADDRESS + SUB T,QFBLNO(A) ;ACTUAL ADDRESS OF BEG OF CURRENT BUFFER + JUMPL T,QBWRA2 ;XFER ON BEFORE CURRENT BLOCK + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER IN BYTES + JUMPL T,QBWRA3 ;SAME BLOCK AS NOW +QBWRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QSOCL5 ;CLEAR ANY CURRENT BUFFERS ETC + PUSHJ P,QUDULK + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR ;LOCKS DIR IF SKIPS + JRST QBWRA4 ;OFF END OF FILE +QBWRA5: PUSHJ P,QUDULK +QBWRA9: POP P,C + POP P,I + POP P,R + CLEARM QSCRW(A) ;SWITCH TO WRITE OVER MODE + MOVSI Q,%QAMPU+%QAMWO ;SET UPDATE ADR AND WRITE OVER + IORM Q,QSRAC(A) + CLEARM QSMPRC(A) + MOVSI Q,%QAEFR+%QAEFW+%QAACC ;CLEAR EOF, WRITE EOF, AND ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD1 ;AND READ IN THE CURRENT BLOCK + HRRM Q,QSRAC(A) + POPJ P, + +QBWRA4: JUMPE Q,QBWRA0 + CAME J,Q ;MIGHT BE ADDING TO END OF FULL BLOCK + JRST IOCER2 + JRST QBWRA9 + +QBWRA0: PUSHJ P,QLWO ;OFF END OF FILE AND WAS ACCESSING WD 0 + MOVSI C,%QAACC ;SO SWITCH TO NORMAL WRITE MODE AND + ANDCAM C,QSRAC(A) ;TURN OFF RANDOM ACCESS BIT + POP P,C + POP P,I + POP P,R + POPJ P, + +QBWRA3: SKIPGE TT,QSMDN(A) + BUG ;NO BUFFER REALLY ACTIVE AT M.P. + MOVSI J,%QAWOV + TDNN J,QSRAC(A) + JRST QBWRA7 + ANDCAM J,QSRAC(A) ;WAS WRITING IN LAST BLK PAST EOF, + MOVN D,QSMPRC(A) ; UPDATE ACTIVE BYTE COUNT + ADDM D,QMPBSZ(A) ;DECREASE SIZE OF BUFFER TO AMT ACTUALLY WRITTEN +QBWRA7: LSH TT,10. ;ADDRESS OF BUFFER + MOVE T,Q ;SAVE RELATIVE BYTE ADDR WITHIN BUFFER + IDIVI Q,@QSBYTE(A) ;Q = WDS, J = BYTES + ADD TT,Q ;ADDRESS OF DESIRED WORD + HLL TT,QSBYTE(A) ;BYTE POINTER TO FIRST BYTE IN THAT WORD + JUMPE J,.+3 ;ADVANCE TO APPROPRIATE BYTE + IBP TT + SOJG J,.-1 + MOVEM TT,QSMPRP(A) + SUB T,QMPBSZ(A) ;MINUS # BYTES LEFT IN BLOCK + MOVNM T,QSMPRC(A) +QBRRA4: MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) + POPJ P, + +QSKFRC: MOVN B,QSMPRC(A) + ADD B,QMPBSZ(A) ;NUMBER OF BYTES WRITTEN IN BLOCK + MOVE C,QSRAC(A) + TLNE C,%QAMWO + TLNE C,%QAWOV + JRST [MOVEM B,QMPBSZ(A) ;IS LAST BLOCK, CHANGE LENGTH + PUSHJ P,QOCLPD ;AND PAD IT (GUARANTEED NO-OP IF WORD MODE CHNL) + JRST .+1 ] + SETZM QSMPRC(A) ;BUFFER WILL BE DISPOSED OF + MOVSI E,%QUDWM + SKIPGE QSMDN(A) + SETZB B,E ;NO BUFFER AFTER ALL + ADD B,QFBLNO(A) ;CURRENT POSITION IN FILE + MOVSI C,%QAACC + TDNN C,QSRAC(A) + MOVEM B,QRADAD(A) ;ACCESS BACK ON NEXT IOT + IORB C,QSRAC(A) + PUSHJ P,[TLNE C,%QAWOV ;WRITE OUT THE BUFFER + JUMPN E,QSBWO2 + JRST QSBWW ] + SKIPE QMPTC(A) + MOVSI E,%QUDWM + PUSHJ P,QOCL2 ;STORE QMPTC IF NECESSARY + IORM E,QSNLCN(H) ;WRITE OUT DIR FAST IF CHANGED + PUSHJ P,QUDULK + JRST POPJ1 + +;.CALL FINISH ON DISK OUTPUT CHANNEL +QSKFIN: HRRZ T,QSRAC(A) + CAIN T,%QMWOV ;IF WRITE-OVER MODE + JRST [ SKIPE QSCRW(A) ;THEN WAIT FOR IT TO SWITCH TO READ MODE + PUSHJ P,UFLS + JRST QSKFIN ] + CAIN T,%QMWRT ;IF WRITE MODE + JRST [ SKIPE QSBFS(A) ;THEN WAIT FOR ALL BUFFERS TO GET WRITTEN + PUSHJ P,UFLS + JRST .+1 ] + MOVE H,QUDPR(A) + MOVE T,MDSK ;HAS THE DIR BEEN CHANGED AND NOT WRITTEN + MOVE T,DCHBT(T) ;YET TO THE MASTER DISK? + TDNN T,QSNLCN(H) + JRST POPJ1 + MOVSI TT,%QUDWM ;YES, WRITE IT OUT IMMEDIATELY + IORM TT,QSNLCN(H) ;AND DON'T RETURN UNTIL IT IS WRITTEN + TDNE T,QSNLCN(H) + PUSHJ P,UFLS + JRST POPJ1 + +QBRRA1: TLNE T,%QALNK + JRST IOCR10 + SKIPGE QSMDN(A) + JRST QBRRA2 ;NO MAIN PRGM BUFFER + MOVE T,QRADAD(A) + SUB T,QFBLNO(A) + JUMPL T,QBRRA2 + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER + JUMPL T,QBRRA3 ;SAME BLOCK AS NOW +QBRRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QICLW1 ;STOP THE CHANNEL AND FLUSH CURRENT BUFFERS + MOVE A,D + CLEARM QSBFS(A) ;FLUSH POSSIBLE EXTRA AOSES WHEN PI HIT EOF + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST QBRRA5 ;OFF END OF FILE (DIR ALREADY UNLOCKED) + POP P,C + POP P,I + POP P,R + CLEARM QSMPRC(A) + MOVSI Q,%QAMPU + IORM Q,QSRAC(A) ;SET FLAG TO SET QSMPRP AND QSMPRC ON NEXT BUFFER LOAD + MOVSI Q,%QAEFR+%QAACC ;CLEAR EOF AND .ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD ;START READING AGAIN + HRRM Q,QSRAC(A) + JRST QUDULK + +QBRRA5: POP P,C + POP P,I + POP P,R + CAME J,Q + JRST IOCER2 ;ACCESS OFF END OF FILE IS ERROR + MOVSI TT,%QAEFR ;BUT ACCESS TO EXACTLY EOF IS OK + IORM TT,QSRAC(A) ;IMITATES WHAT QEOF DOES + AOS QSBFS(A) + SETZM QSMPRC(A) ;AND READS ZERO WORDS + JRST QBRRA4 + +QBRRA3: SKIPGE TT,QSMDN(A) + JRST QBRRA2 + JRST QBWRA7 + +;BLKT-SIOKT-CHRKT GET BUFFER ROUTINE FOR WRITE-OVER MODE. +QWOG1: SKIPGE QSCRW(A) ;FETCH BLOCK WRITEOVER MODE + JRST QWOG2 ;STILL WRITING PREVIOUS ONE, WAIT + MOVEI Q,%QMRD1 ;SWITCH INTO READ MODE + SKIPG QSBFS(A) ;IF A BUFFER HAS TO BE READ + HRRM Q,QSRAC(A) + SKIPG QSBFS(A) + PUSHJ P,UFLS + POP P,A +;BLKT-SIOKT-CHRKT GET-BUFFER ROUTINE FOR DISK INPUT. +QSBGB: MOVSI Q,%QAPAR + TDNE Q,QSRAC(A) + JRST QSBGB2 + CONO PI,UTCOFF + HRRZ Q,QBFP(A) + JUMPE Q,[MOVSI J,%QAEFR ;SAID TO BE BUFFERS, BUT NONE THERE + TDNN J,QSRAC(A) + BUG ;SHOULDN'T HAPPEN EXCEPT AT EOF + JRST QSBGB5 ] + LDB J,[MLO,,MEMBLT(Q)] + HRRM J,QBFP(A) + SKIPN J + SETZM QBFP(A) ;LAST BLOCK, LIST NOW EMPTY + HRRZ J,MEMPNT(Q) ;GET SIZE OF BUFFER IN BYTES + MOVEM J,QMPBSZ(A) + LDB TT,[$QAMOD,,QSRAC(A)] + SKIPN TT ;DONT SOS IF IN WRITE OVER MODE + SOS QSBFS(A) +QSBWG4: MOVE TT,Q + LSH TT,10. ;RETURN ADDR OF BUFFER + MOVEM Q,QSMDN(A) + CONO PI,UTCON + HLL TT,QSBYTE(A) + MOVSI Q,%QAMPU + TDNN Q,QSRAC(A) + JRST SIOBG2 + MOVE Q,QRADAD(A) ;DIDDLE PNTRS TO TAKE CARE OF RANDOM ACCESS WITHIN BLOCK + SUB Q,QFBLNO(A) ;DESIRED OFFSET WITHIN BLOCK + SUB J,Q + JUMPL J,IOCER2 ;OFF END OF FILE + JUMPL Q,IOCER2 ;OFF FRONT OF FILE (NEGATIVE .ACCESS PNTR) + PUSH P,J + IDIVI Q,@QSBYTE(A) + ADD TT,Q ;ADJUST BYTE POINTER + JUMPE J,.+3 + IBP TT + SOJG J,.-1 + POP P,J + MOVSI Q,%QAMPU ;NOW IS SAFE TO TURN OFF FLAG + ANDCAM Q,QSRAC(A) + JRST SIOBG2 + +;GET-BUFFER DETECTED EOF ON INPUT OR WRITE-OVER. +QSBGB5: CONO PI,UTCON + MOVE Q,QSRAC(A) + TLNE Q,%QALNK + JRST IOCR10 + LDB Q,[$QAMOD,,QSRAC(A)] + SOJN Q,POPJ2 ;ON INPUT, SKIP TWICE TO SIGNAL EOF. + PUSHJ P,QLWO ;LEAVE WRITE OVER MODE + JRST QSBWG ;START NORMAL WRITE + +QWOG2: SKIPGE QSCRW(A) ;WAIT FOR WRITE TO FINISH + PUSHJ P,UFLS + JRST POPAJ ;NOW RECYCLE AND WAIT FOR READ + +;LEAVE WRITE OVER MODE +QLWO: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + CONO PI,UTCOFF + SETZM QBFP(A) ;WRITEOVER MODE EXTEND FILE (SWITCH TO NORMAL MODE) + CLEARM QSBFS(A) + SETOM QSCRW(A) + MOVE Q,QSLGL(A) + HRRZM Q,QMPTN(A) ;STORE BASE TRACK + MOVSI Q,%QAEFR+%QAMWO ;CLEAR EOF AND WRITEOVER + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMWRT ;NORMAL WRITE MODE + HRRM Q,QSRAC(A) + CLEARM QMPTC(A) ;TRACK COUNT FOR TAKE N + SETOM QMTTR(A) ;NO TRACK RESERVED + SETOM QMFTP(A) ;GET NEW DECADE RESERVATION + CONO PI,UTCON + MOVE TT,QDIRP(A) ;SEE IF GARBAGE COLLECTION NEEDED + PUSH P,R + PUSH P,I + PUSHJ P,QMPDC1 ;CONV CHAR ADR TO BYTE PNTR (AND LDB IN R) + POP P,I + SKIPE R + BUG + MOVE R,QDIRP(A) + ADDI R,NXLBYT+2 + CAMGE R,@QSNLCN(H) + JRST QLWO1 ;DON'T NEED TO EXPAND F.S. + MOVEI R,LUNBLK(TT) + MOVE Q,QSNLCN(H) + SUBI R,(Q) + CAML R,UDNAMP(Q) + JRST QSBWG7 ;DON'T HAVE ROOM. GC + MOVEI R,3*6 ;HAVE ROOM + ADDM R,(Q) +QLWO1: +REPEAT NXLBYT+2,[ + ILDB R,TT + JUMPN R,QSBWG7 +] + JRST QSBWG8 ;OK + +QSBWG7: MOVSI R,%QAFUL ;NO ROOM, GC BEFORE COMMITTING NEXT TRACK + IORM R,QSRAC(A) +QSBWG8: POP P,R + JRST QUDULK + +QSBGB2: ANDCAM Q,QSRAC(A) ;DISK READ ERROR + JRST IOCER3 ;TELL USER + +;DISK OUTPUT GET-BUFFER ROUTINE. PRESERVES D FOR BENEFIT OF PDUMP. +QSBWG: MOVE Q,QSRAC(A) + TLNE Q,%QALNK+%QAACC ;DON'T WRITE TO LINK, DON'T LET PDUMP GET + JRST IOCR10 ; FAKED OUT BY USE FORCE OR ACCESS + PUSH P,A + TLNE Q,%QAMWO + JRST QWOG1 ;JUMP IF WRITE OVER MODE + HRRZ Q,QBFP(A) ;NORMAL MODE + JUMPE Q,QSBWG1 ;CAN ALWAYS HAVE ONE BUFFER + MOVE Q,QWBUFS + CAML Q,QWBFMX + JRST POPAJ ;TOO MANY WRITE BUFFERS QUEUED +QSBWG1: PUSHJ P,QSTWG + PUSHJ P,TCALL + JRST IOMQ + JRST QSBWG5 ;MEM FROZE OR NOT AVAILABLE + MOVE Q,(P) ;DISK CHNL # + DPB Q,[MNUMB,,MEMBLT(A)] + MOVEI Q,MU23B + DPB Q,[MUR,,MEMBLT(A)] + MOVE Q,A + POP P,A + AOS QSBFS(A) + AOS QWBUFS + HRRZ J,QSBYTE(A) + IMULI J,2000 + MOVEM J,QMPBSZ(A) ;FRESH BLOCK SIZE + JRST QSBWG4 + +QSTWG: MOVSI Q,%QAFUL + TDNE Q,QSRAC(A) ;ROUTINE TO COMMIT A TRACK + JRST QSTWG1 ;DIR FULL, NEED GC BEFORE GROWING FILE + MOVE H,QUDPR(A) ;IF THIS DIRECTORY HAS AN ALLOCATION + MOVE Q,QSNLCN(H) ; ENFORCE IT +IFN QRSRVP,[ + HRRZ J,UDALLO(Q) + JUMPE J,QSTWG0 ;NO ALLOCATION + HRRZ H,UDBLKS(Q) ;GET BLOCKS USED + CAML H,J + JRST IOCR13 ;HAS ALLOCATION AND USER IS TRYING TO EXCEED IT +] +QSTWG0: MOVE J,QDSKN(A) + SOSL QSFT(J) ;RESERVE A TRACK + POPJ P, + AOS QSFT(J) ;DISK FULL, GIVE BACK THE TRACK + SKIPE QFBTS ;WAIT FOR ANY PENDING FILE DELETIONS + PUSHJ P,UFLS ; TO COMPLETE AND FREE THEIR BLOCKS + SOSL QSFT(J) ;GOT SPACE NOW? + POPJ P, + AOS QSFT(J) ;NO, GIVE UP AND ERR OUT + JRST IOCER9 + +QSTWG1: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + PUSHJ P,QGC + JRST IOCR12 ;DIR FULL + PUSHJ P,QUDULK + ANDCAM Q,QSRAC(A) .SEE %QAFUL + JRST QSTWG + +QSBWG5: POP P,A ;GET BACK QSK CHANNEL # + MOVE J,QDSKN(A) + AOS QSFT(J) ;NO MEMORY; GIVE EVERYTHING BACK + POPJ P, + +;DISK OUTPUT RELEASE-BUFFER ROUTINE FOR BLKT, SIOKT, CHRKT. +QSBWW: SKIPGE QSMDN(A) ;WRITE BUFFER FROM MN PROG TO CHAIN FOR PI + POPJ P, ;NO WRITE BUFFER ACTIVE + LDB TT,[$QAMOD,,QSRAC(A)] + SOJE TT,QSBWO1 ;WRITE OVER MODE + SKIPL D,QMTTR(A) + JRST QTG1 ;TRACK ALREADY RESERVED + PUSH P,I + MOVE I,QDSKN(A) + PUSHJ P,QGTRK ;GET A TRACK + POP P,I + MOVEM D,QMTTR(A) +QTG1: MOVE H,QUDPR(A) ;TRACK IN D + PUSHJ P,QUDLK + MOVE TT,QSNLCN(H) + AOS UDBLKS(TT) + MOVE TT,QMPTN(A) ;GET PREVIOUS TRACK# + CAIN D,1(TT) + JRST QTG2 ;THIS TRACK IS CONSECUTIVE + SKIPN QMPTC(A) ;THIS TRACK NOT CONSEC CHECK COUNT OF PREV CONSEC BLOCKS + JRST QTG3 + PUSH P,D ;NON-ZERO SO STORE IN USER DIRECTORY + MOVE D,QMPTC(A) + CLEARM QMPTC(A) + PUSHJ P,QUDS + POP P,D +QTG3: MOVE J,QMTTR(A) ;DESCRIPTOR WILL BE STORED + MOVEM J,QMPTN(A) + SUB D,QMPTN(A) ;CAN TRACK BE SKIPPED TO? + SOJL D,QTG4 ;CAN'T BE SKIPPED TO (NOTE QMPTN HAS NOT BEEN AOS'D) + CAILE D,UDWPH-UDTKMX-1 + JRST QTG4 ;ALSO NO + ADDI D,UDTKMX ;NEXT BLOCK WITHIN N + PUSHJ P,QUDS ;STORE APPROPRIATE SKIP +QTG5A: +QTG5: MOVE Q,QSMDN(A) ;CORE BLOCK NUM BEING WRITTEN + MOVE D,QMPTN(A) ;TRACK NUM OF BLOCK ADDING TO FILE + HRLZM D,MEMPNT(Q) ;STORE TRACK NUM + SETOM QMTTR(A) ;INDICATE TRACK USED + MOVE J,QMPBSZ(A) ;LENGTH OF THIS BLOCK + ADDM J,QFBLNO(A) ;INCR BYTE ADR OF START OF CURRENT BLOCK IN FILE + HRRM J,MEMPNT(Q) ;SAVE BYTE COUNT + PUSH P,R + IDIVI J,@QSBYTE(A) ;CONVERT TO WORD COUNT + JUMPE R,QTG7 ;EXACT MULTIPLE OF WORD + AOS J + MOVNS R + ADDI R,@QSBYTE(A) ;# BYTES RESIDUE IN LAST WORD +QTG7: DPB J,[MWC,,MEMBLT(Q)] ;STORE ACTIVE WORD COUNT + MOVE D,QSRAC(A) + LDB TT,[$QAMOD,,QSRAC(A)] + TLNN D,%QALBK ;LAST BLOCK OF WRITE OVER POSSIBLY + SOJE TT,QTG6 ;WRITEOVER MODE AND NOT LAST BLOCK, DONT UPDATE LAST BLOCK WORD COUNT + MOVE H,QUDPR(A) ;SET UP DIRECTORY CHANNEL + MOVE D,QUDFPR(A) + ADD D,QSNLCN(H) + DPB J,[UNWRDC+UNRNDM(D)] ;SET WORD COUNT OF LAST BLOCK + LDB Q,[QSBSIZ(A)] + PUSHJ P,QBENC ;ENCODE BYTE CRUFT + DPB Q,[UNBYTE+UNREF(D)] + MOVE J,QACTB + IORM J,QSNLCN(H) +QTG6: POP P,R + PUSHJ P,QUDULK + MOVE Q,QSMDN(A) + MOVEI J,.BM MLO + ANDCAM J,MEMBLT(Q) ;SET END OF LIST INDICATOR IN MEMORY BLOCK + CONO PI,UTCOFF + HLRZ J,QBFP(A) ;STORE MEMORY BLOCK IN OUTPUT LIST + JUMPE J,QSBWW1 + DPB Q,[MLO,,MEMBLT(J)] +QSBWW2: HRLM Q,QBFP(A) + CONO PI,UTCON + SETOM QSMDN(A) ;MN PROG BUFFER NOW WRITTEN + JRST QSTRTR ;START ACTION IF 2311 IDLE AND RETURN + +QSBWO1: MOVE Q,QSRAC(A) ;PUT BUFFER IN WRITE-OVER MODE + TLNE Q,%QALBK ;IF NOT HACKING LAST BLOCK + TLNE Q,%QAEFW ;OR HACKING CLOSE + JRST QSBWO2 ;THEN JUST WRITE IT + HRRZ D,QSBYTE(A) + IMULI D,2000 + SUB D,QMPBSZ(A) + JUMPE D,QSBWO2 ;BLOCK REALLY FULL + TLNE Q,%QAMPU ;DID WE IOCER2 AT QSBWG4? + JRST IOCER2 ;YES, QSMPRP NOT SET UP, DON'T WRITE ANYTHING + MOVEM D,QSMPRC(A) ;LAST BLOCK NOT REALLY USED UP ("SPRUNG BACK TO LIFE") + ADDM D,QMPBSZ(A) ;EXTRA ROOM IN LAST BLOCK TO FILL UP + MOVSI D,%QAWOV + IORM D,QSRAC(A) ;FILLING LAST BLK PAST ORIG EOF + POPJ P, ;FINISH OUT BLOCK + +QSBWO2: MOVSI D,%QAWOV + ANDCAM D,QSRAC(A) + MOVE D,QSLGL(A) ;WRITE TRACK BACK WHERE IT CAME FROM + MOVEM D,QMPTN(A) ;PUT TRACK NO WHERE QTG5 CAN FIND IT + MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SETOM QSCRW(A) ;SWITCH TO WRITE MODE + MOVEI Q,%QMWOV + HRRM Q,QSRAC(A) + JRST QTG5 + + +QTG4: LDB D,[140500,,QMTTR(A)] ;WRITE LOAD ADDRESS + IORI D,40 + PUSHJ P,QUDS + LDB D,[060600,,QMTTR(A)] + PUSHJ P,QUDS + LDB D,[0600,,QMTTR(A)] + PUSHJ P,QUDS + JRST QTG5A + +QGTRK: PUSHJ P,QTLOCK ;GET TRK CHNL IN A DSK IN I RET IN D CLOBBERS E,TT,Q,J,B +QGTK4: PUSH P,R ;ENTER HERE FROM SWAP OUT WITH UTCOFF + PUSH P,B + PUSH P,E + HRRZ R,QTUTO(I) +QGTK4A: SKIPGE Q,QMFTP(A) + JRST QGTK3A ;FIRST TRACK + IDIVI Q,DECADE + HRREI J,-DECADE(J) ;COMPUTE TRACKS REMAINING IN DECADE + MOVE D,QMFTP(A) + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + MOVE TT,QMFTP(A) + EXCH D,TT +QGTK3: CAML D,QLASTB(R) + JRST QGTK3A ;REACHED END OF DISK + ILDB Q,TT + JUMPE Q,QGTK2 + AOJGE J,QGTK3A ;DECADE OUT + AOJA D,QGTK3 + +QGTK3A: CAILE A,NQCHN + JRST QGTK3C ;SWAP CHANNEL +QGTK3D: MOVEI Q,DECADE + ADDB Q,QTUTP(R) +QGTK3B: MOVEM Q,QMFTP(A) + CAMGE Q,QLASTB(R) + JRST QGTK4A + MOVE Q,QSWAPA(R) ;REACHED END OF DSK, RESET TO END OF SWAPPING AREA + ADDI Q,DECADE-1 ;ROUND UP TO A MULTIPLE OF A DECADE + IDIVI Q,DECADE + IMULI Q,DECADE + MOVEM Q,QTUTP(R) + JRST QGTK3B + +QGTK2: MOVEI B,1 + DPB B,TT + MOVEM D,QMFTP(A) + MOVE J,DCHBT(I) + IORM J,QTUTO(I) + POP P,E + POP P,B + POP P,R + CAILE A,NQCHN + POPJ P, ;CALLED FROM SWAP OUT + JRST QTULK + +QGTK3C: CAML D,QSWAPA(R) + JRST QGTK3D ;IN NON-SWAP AREA + AOS D + CAMN D,QSWAPA(R) + MOVEI D,NUDSL + MOVEM D,QMFTP(A) + JRST QGTK4A + ;STORE CHR IN D CHNL IN A USER DIR PNTR IN H +;CANNOT PCLSR NOR GC + +QUDS: PUSH P,I + PUSH P,Q + MOVE I,QDIRP(A) + CAIGE I,2000*UFDBPW + CAML I,@QSNLCN(H) ;UDESCP + BUG ;WRITING ABOVE F.S. PNTR? + AOS QDIRP(A) + IDIVI I,UFDBPW + MOVE Q,QBTBL(Q) + ADD Q,I + SKIPL I,QSNLCN(H) + BUG ;UFD WAS NOT LOCKED + ADDI Q,UDDESC(I) + LDB I,Q + CAIE I,UDWPH ;OK TO CLOBBER UDWPH (NORMALLY DOES AT START OF FILE) + JUMPN I,[JRST 4,.] ;ABOUT TO CLOBBER SOMETHING IN UFD + DPB D,Q + ILDB I,Q ;MAKE SURE FILE DESC WILL ALWAYS BE FOLLOWED BY ZERO + SKIPE I + BUG +REPEAT NXLBYT+2,[ ;MAKE SURE THERE'S ROOM FOR ONE MORE TRACK + ILDB I,Q + JUMPN I,QUDS1 +] + MOVE I,QDIRP(A) + ADDI I,NXLBYT+2 + CAMGE I,@QSNLCN(H) ;UDESCP + JRST QUDSX ;DESC AREA NOT COLLIDING WITH LIM OF DESC SPACE + MOVEI Q,LUNBLK(Q) + MOVE I,QSNLCN(H) + SUBI Q,(I) + CAML Q,UDNAMP(I) + JRST QUDS1 ;NO ROOM. + MOVEI Q,3*UFDBPW ;EXPAND DESC AREA + ADDM Q,UDESCP(I) + JRST QUDSX + +QUDS1: MOVSI Q,%QAFUL ;NEED GC BEFORE STARTING ON NEXT TRACK + IORM Q,QSRAC(A) +QUDSX: MOVE Q,QACTB + IORM Q,QSNLCN(H) ;SET DIRECTORY CHANGED + POP P,Q + POP P,I + POPJ P, + +QSBWW1: HRRM Q,QBFP(A) + JRST QSBWW2 + +QSBRB1: MOVE A,D +QSBRB: PUSH P,A + SKIPGE A,QSMDN(A) + JRST POPAJ + PUSHJ P,MEMR + POP P,A + HRRZ TT,QMPBSZ(A) + ADDM TT,QFBLNO(A) ;INCREMENT BYTE ADR IN FILE OF BEG OF NEXT BLOCK + SETOM QSMDN(A) + JRST QSTRTR + +QTG2: MOVE J,QMTTR(A) ;INDICATE WE WILL STORE DESCRIPTOR FOR NEXT TRACK. + MOVEM J,QMPTN(A) + AOS D,QMPTC(A) ;NEXT BLOCK IS CONSECUTIVE + CAIGE D,UDTKMX + JRST QTG5A + SETZM QMPTC(A) ;MAX # CONSECUTIVE BLOCKS, STORE DESC NOW + PUSHJ P,QUDS + JRST QTG5A + +SUBTTL DIRHNG DEVICE + +;WHENEVER THE DIRECTORY SPECIFIED AS THE SNAME WHEN DIRHNG IS OPENED +;IS MODIFIED, YOU GET AN INTERRUPT ON THE DIRHNG DEVICE CHANNEL. + +;HERE TO OPEN THE DIRHNG DEVICE. IOCHNM ADDR IN R, SNAME IN USYSN1(U). +DIRHO: MOVE C,USYSN1(U) + PUSHJ P,QFL ;LOOK UP THIS DIRECTORY + JRST OPNL20 ;CALL FAILS IF DIRECTORY DOES NOT EXIST. + HRRZM J,IOCHST-IOCHNM(R) ;DIR EXISTS; STORE TRACK NUMBER IN IOCHST. +DIRHP1: CONO PI,CLKOFF + HLLZ A,DIRHNG ;ADD THIS CHANNEL'S IOCHNM TO THE LIST OF DIRHNG CHANNELS. + HRRI A,DNDIRH + MOVEM A,(R) ;SET UP THE IOCHNM WITH IOTTB INDEX AND LIST CHAIN. + HRLZM R,DIRHNG + JRST CLKOJ1 + +;CLOSE A DIRHNG DEVICE CHANNEL. +DIRHCL: PUSHJ P,DIRHPS ;REMOVE IT FROM THE LIST, AND + SETZM (R) ;MARK IT CLOSED. + POPJ P, + +;IOPUSH A DIRHNG DEVICE CHANNEL. REMOVE IT FROM THE LIST OF ALL SUCH. +DIRHPS: MOVEI A,DIRHNG + CONO PI,CLKOFF +;FIND THE PLACE THAT POINTS AT THIS IOCHNM WORD. +DIRHC1: HLRZ B,(A) + CAIN B,(R) + JRST DIRHC2 + SKIPN A,B ;END OF LIST REACHED => + BUG ;THIS IOCHNM ISN'T IN THE LIST. BUT IT IS SUPPOSED TO BE! + JRST DIRHC1 + +;A POINTS AT IOCHNM THAT POINTS AT THIS ONE. PATCH THIS ONE OUT OF LIST. +DIRHC2: HLRZ B,(B) ;THE ONE AFTER THIS ONE + HRLM B,(A) + JRST CLKONJ + +;IOPUSH OR IOPOP THE DIRHNG CHANNEL WITH R -> IOCHNM WORD. I SAYS WHICH OPERATION. +DIRHIP: JUMPE I,DIRHPS ;IOPUSH REMOVES CHANNEL FROM LIST OF ALL DIRHNG CHANNELS. + +;IOPOP A DIRHNG DEVICE CHANNEL. JUST LIKE OPENING IT EXCEPT THAT +;THE DIRECTORY TRACK NUMBER IS ALREADY IN THE IOCHST. +;ALSO, WE SHOULD GIVE AN INTERRUPT NOW, +;IN CASE THE DIRECTORY WAS WRITTEN IN WHILE THE CHANNEL WAS PUSHED. +DIRHPP: PUSHJ P,DIRHP1 ;FIRST, REOPEN THE CHANNEL. LINK IT INTO THE DIRHNG LIST. + BUG + MOVE A,R + SUBI A,IOCHNM(U) ;COMPUTE CHANNEL NUMBER FROM IOCHNM WORD ADDRESS. + MOVE A,CHNBIT(A) ;GET BIT CORRESPONDING TO CHANNEL. + AND A,MSKST2(U) ;GIVE THE INT IF THE INT IS ENABLED. + IORM A,IFPIR(U) + POPJ P, + +;HERE WITH A/ DIRECTORY'S TRACK NUMBER (AS RETURNED BY QFL) +;TO SIGNAL A WRITE IN THAT DIRECTORY TO ALL DIRHNG DEVICES THAT ARE LOOKING. +;CLOBBERS B, C, D. +DIRSIG: CONO PI,CLKOFF + MOVEI B,DIRHNG +DIRSI0: HLRZ B,(B) ;GET IOCHNM ADDR OF NEXT DIRHNG DEVICE. + JUMPE B,CLKONJ + HRRZ C,IOCHST-IOCHNM(B) + CAIE C,(A) ;DOES IT LOOK AT THIS DIRECTORY? + JRST DIRSI0 + MOVEI C,-IOCHNM(B) ;YES => FIGURE OUT USER INDEX OF JOB IT BELONGS TO. + IDIVI C,LUBLK + IMULI C,LUBLK ;C NOW HAS USER INDEX. + MOVNI D,IOCHNM(C) + ADD D,B ;D GETS CHANNEL NUMBER + MOVE D,CHNBIT(D) + AND D,MSKST2(C) ;INTERRUPT THE USER ON THAT CHANNEL, IF IT'S ENABLED. + IORM D,IFPIR(C) + JRST DIRSI0 diff --git a/system/disk.1223 b/system/disk.1223 new file mode 100644 index 0000000..74b9bb7 --- /dev/null +++ b/system/disk.1223 @@ -0,0 +1,6425 @@ +; I T S DISK SERVICE ROUTINES AND FILE SYSTEM -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +DSKVRS==.IFNM2 +IFN DC10P+RP10P+RH10P+RH11P-1, .ERR WRONG NUMBER OF DISK CONTROLLERS + +;GET DISK PHYSICAL PARAMETERS BY .INSRT'ING APPROPRIATE FILE + +IFN DC10P,[ +$INSRT DC10 +] + +IFN RP10P,[ +$INSRT RP10 +] + +IFN RH10P,[ +$INSRT RH10 +] + +IFN RH11P,[ +$INSRT RH11 +IFE KS10P, .ERR RH11 on something other than a KS10? +IFN RP06P+RM03P+RM80P-1, .ERR WRONG NUMBER OF KINDS OF DISK DRIVE +IFN RP06P,[ +$INSRT RP06 +] +IFN RM03P,[ +$INSRT RM03 +] +IFN RM80P,[ +$INSRT RM80 +] +] + +;GET FILE SYSTEM DEFINITIONS: +; MFD MASTER FILE DIRECTORY +; TUT TRACK (BLOCK) UTILIZATION TABLE +; UFD USER FILE DIRECTORY + +$INSRT FSDEFS + +IFN T300P,[ +$INSRT T300 +] + +SUBTTL MISC FILE SYSTEM CALLS + +ADMPCH: UMOVE A,(J) ;SET OR READ STATUS OF DUMP BIT OF FILE OPEN ON + ; CHNL IN AC(RH) + MOVEI T,POPJ1 ;MAKE CHNDCD SKIP RETURN IF ALL OK. + PUSHJ P,CHNDCD ;DECODE RH(A) AS CHNL NUM. + JRST ILUUO ;NO SKIP IMPLIES BAD CHNL NUM. + TLNN R,%CLSQ + JRST ILUUO ;NOT DISK CHANNEL. + PUSHJ P,QCHNLT ;DECODE THE CHNL FURTHER. + MOVSI B,400000 + TLNE A,400000 + IORM B,UNRNDM(C) + TLNE A,200000 + ANDCAM B,UNRNDM(C) + MOVE D,QACTB + TLNE A,600000 + IORM D,QSNLCN(H) + LDB A,[430100,,UNRNDM(C)] + PUSHJ P,QUDULK + JRST APTUAJ + +NRFDATE: PUSHJ P,QCHNLT ;READ FILE CREATION DATE WORD + MOVE A,UNDATE(C) +NRDM1: PUSHJ P,QUDULK + JRST POPJ1 ;STORE BACK IN USER MEM + +NSRDATE: PUSHJ P,QCHNLT ; SET REFERENCE DATE + HLRS B + DPB B,[UNREFD+UNREF(C)] + JRST NSDM1 + +NRESRDT: PUSHJ P,QCHNLT ; RESTORE REFERENCE DATE + HLRZ A,OLDRDT(R) ; WHOEVER CHOSE R IN QCHNLC SHOULD BE SHOT + DPB A,[UNREFD+UNREF(C)] + JRST NSDM1 + +NSFDATE: PUSHJ P,QCHNLT ;SET FILE CREATION DATE WORD + MOVEM B,UNDATE(C) +NSDM1: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QUDUL1: AOS (P) + JRST QUDULK + + +NRDMPBT: PUSHJ P,QCHNLT ;READ FILE DUMPED BIT + LDB A,[430100,,UNRNDM(C)] + JRST NRDM1 + +NSDMPBT: PUSHJ P,QCHNLT ;SET FILE DUMPED BIT + DPB B,[430100,,UNRNDM(C)] + JRST NSDM1 + +NLNKEDP: + PUSHJ P,QCHNLT ;RETURN NONZERO IF WE TRACED LINKS TO GET THIS FILE. + MOVE T,QSRAC(R) + LDB A,[.BP (%QALOP),T] + JRST NRDM1 + +NFILBLK:PUSHJ P,QCHNLT ;READ ALL 5 PARAMETERS OF NAME AREA + MOVE A,(C) + MOVE B,1(C) + MOVE D,3(C) + MOVE E,4(C) + MOVE C,2(C) + JRST NRDM1 ; UNLOCK DIR AND STORE ARGUMENTS + +QCHNLT: TLNN R,%CLSQ ;IS CHNL A DISK CHNL? + JRST [SUB P,[1,,1] ? JRST OPNL34] + HLRZ R,H + MOVE H,QUDPR(R) + PUSHJ P,QUDLK + MOVE C,QSNLCN(H) + ADD C,QUDFPR(R) + POPJ P, + +IFN QAUTHP,[ +ASAUTH: PUSHJ P,QCHNLT ;SET AUTHOR OF FILE + PUSH P,C + JUMPE B,ASAUT4 ;SETTING AUTHOR TO 0 + MOVE J,QSNMI(H) + CAMN B,QSNUD(H) + JRST ASAUT1 + MOVE C,B + PUSHJ P,QFL + SKIPA + JRST ASAUT1 + SETZM C + MOVEI J,5 + MOVE TT,[440600,,B] + MOVE I,[440600,,C] + ILDB D,TT + IDPB D,I +ASAUT2: ILDB D,TT + CAIG D,'Z + CAIGE D,'A + JRST ASAUT3 + IDPB D,I + SOJG J,ASAUT2 + JRST ASAUT4 + +ASAUT3: PUSHJ P,QFL +ASAUT4: SETOM J +ASAUT1: POP P,C + DPB J,[UNAUTH+UNREF(C)] + JRST NSDM1 + +ARAUTH: PUSHJ P,QCHNLT ;READ CREATOR OF FILE + LDB B,[UNAUTH+UNREF(C)] + MOVEI A,0 ;RETURN VALUE IS 0 IF UNKNOWN OR ILLEGAL AUTHOR + CAIL B,NUDSL + JRST NRDM1 + LSH B,1 + MOVEI B,2000-(B) + ADD B,QMDRO + MOVE A,(B) + JRST NRDM1 +];QAUTHP + +ASREAP: PUSHJ P,QCHNLT ;SET NO REAP BIT + DPB B,[.BP (UNREAP),UNRNDM(C)] + JRST NSDM1 + +ARQDAT: CONO PI,CLKOFF ;GET DSK TIME AND DATE + SKIPL A,QDATE + HRR A,TIMOFF + MOVE B,QDATEI ;2ND VALUE = DATE & TIME SYS CAME UP, IN DISK FORMAT. + CONO PI,CLKON + JRST POPJ1 + +ADSKUP: PUSHJ P,QCHNLT ;SET CREATION DATE, REF DATE AND CLEAR DUMP BIT + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(C) + HLRS TT + DPB TT,[UNREFD+UNREF(C)] + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(C) + JRST NSDM1 + +DELEWO: TLNN R,%CLSQ ;DELETE WHILE OPEN + JRST OPNL34 ;WRONG TYPE DEVICE + PUSHJ P,QCHNLT + PUSH P,W + PUSH P,C + MOVEI W,4 + MOVE A,UNFN1(C) ;Get names of file being hacked. + MOVE B,UNFN2(C) + MOVE C,QSNUD(H) + PUSHJ P,MNGDIR ;If this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. + POP P,C + POP P,W + MOVSI T,%QADEL ;SET DELETE BIT IN QSK CHNL + IORM T,QSRAC(R) + MOVSI T,UNCDEL ;AND IN FILE + IORM T,UNRNDM(C) + JRST NSDM1 + +;.CALL FILLEN +;RETURNS (1) FILE LENGTH IN BYTES (BYTE SIZE CURRENTLY OPEN IN) +; (2) BITS PER BYTE (BYTE SIZE CURRENTLY OPEN IN) +; (3) FILE LENGTH IN BYTES (BYTE SIZE WRITTEN IN) +; (4) BITS PER BYTE (BYTE SIZE WRITTEN IN) + +NFILLEN:PUSHJ P,QCHNLT + MOVE A,QSRAC(R) + TLNE A,%QALNK + JRST OPNL34 ;NOT A FILE + SKIPGE QSCRW(R) + TLNE A,%QAMWO + JRST NFILL1 ;READ CHANNEL OR WRITE-OVER, GET FILE'S STORED LENGTH. + MOVE A,QFBLNO(R);NORMAL WRITE, GET ACCESS POINTER. + SKIPGE QSMDN(R) + JRST NFILL2 ;NO BUFFER ACTIVE + ADD A,QMPBSZ(R) ;END OF CURRENT BUFFER + SUB A,QSMPRC(R) ;BACK UP TO CURRENT LOC +NFILL2: PUSHJ P,QUDULK + LDB B,[QSBSIZ(R)] ;CURRENT BYTE SIZE + MOVE D,B ;WRITTEN BYTE SIZE SAME AS CURRENT + MOVE C,A ;WRITTEN LENGTH SAME AS CURRENT + JRST POPJ1 + +NFILL1: LDB TT,[UNDSCP+UNRNDM(C)] + IDIVI TT,UFDBPW + HLL TT,QBTBLI(I) ;GET DESCRIPTOR POINTER + LDB E,[UNWRDC+UNRNDM(C)] + SKIPN E + MOVEI E,2000 ;E GETS NUMBER OF WORDS IN LAST BLOCK + LDB D,[UNBYTE+UNREF(C)] ;D GETS BYTE INFO + ANDI C,-2000 ;C GETS BASE ADDR OF DIR + ADDI TT,UDDESC(C) ;TT GETS DESC PNTR + SETOM A ;INITIALIZE NUMBER OF BLOCKS IN FILE + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE MINUS ONE + PUSHJ P,QUDULK + IMULI A,2000 ;NUMBER OF WORDS IN COMPLETE BLOCKS + ADD A,E ;ADD WORDS IN LAST BLOCK + PUSHJ P,QBDCD ;D GETS BYTE SIZE, E NUMBER OF RESIDUE BYTES + MOVEI Q,36. + IDIV Q,D ;Q GETS BYTES PER WORD + MOVE C,A ;C WRITTEN LENGTH, A CURRENT (B.S. DIFFERENT) + IMUL C,Q ;CONVERT WORD LENGTH TO BYTES + SUB C,E ;C NOW HAS CORRECT WRITTEN LENGTH + IMUL E,D ;E GETS NUMBER OF RESIDUE BITS + LDB B,[QSBSIZ(R)] ;B GETS BYTE SIZE OPENED IN + IMULI A,@QSBYTE(R) ;A GETS LENGTH IN THOSE SIZE BYTES + IDIV E,B ;NUMBER OF RESIDUE BYTES, -ROUNDING DOWN- + SUB A,E ;ADJUST THE LENGTH + JRST POPJ1 ;RETURN VALUES IN A,B,C,D + +NFLLN2: ADD A,B ; NEXT N BLOCKS +NFLLN1: ILDB B,TT ; GET NEXT DESC BYTE + JUMPE B,CPOPJ ; NO MORE + CAIG B,UDTKMX + JRST NFLLN2 ; TAKE-N + CAIGE B,UDWPH + AOJA A,NFLLN1 ; SKIP-N, TAKE-1 + CAIN B,UDWPH + JRST NFLLN1 ; IGNORE WRITE-PLACEHOLDER +REPEAT NXLBYT, IBP TT ; LOAD-ADDRESS, TAKE-1 + AOJA A,NFLLN1 + +;DIRSIZ - READ OR SET DISK QUOTAS, READ # BLOCKS IN ALL FILES IN DIRECTORY. +;1ST VALUE IS GRIM REAP QUOTA,,DIR SIZE +;2ND VALUE IS 0 OR PACK#,,ALLOCATION FOR DIR ALLOCATED TO SPECIFIC PACK +;LH OF 2ND ARG SETS GRIM REAP QUOTA; 3RD ARG SETS PACK#,,ALLOCATION +NDIRSI: MOVE D,C + PUSHJ P,QCHNLT + MOVE C,QSNLCN(H) + MOVE A,UDBLKS(C) + JUMPL B,NDIRS1 + CAIE W,1 + HLLM B,UDBLKS(C) +NDIRS1: MOVE B,UDALLO(C) + CAILE W,2 + MOVEM D,UDALLO(C) +IFN QRSRVP,[ + HLRZS D ;PACK ALLOCATED TO + SETO E, + JUMPE D,NDIRS2 + MOVEI E,NQS-1 ;UPDATE ALLOC DRIVE NUM + CAME D,QPKID(E) + SOJGE E,.-1 +NDIRS2: MOVEM E,QSALLO(H) +];QRSRVP + JRST NSDM1 + +SUBTTL DISK OPEN ROUTINES + +%DO==1,,525252 ;Special mode bits for disk opens. +%DOWOV==100000 ;Write over mode +%DONRF==10 ;Don't set ref-date +%DONLK==20 ;Don't chase links; actually open the link itself. +%DORWT==40 ;Make readers wait (used on opens for write or write-over). + +IFN TPLP+UNSPLP,[ +TPLO: MOVE C,[SIXBIT /.LPTR./] ;PSEUDO LINE PRINTER (DISC) + JUMPGE D,TPLO2 + MOVE B,UNAME(U) + AOS A,TPLFNO ;GENERATE RANDOM FILE NAME + JRST TPLO2 +] + +COMO: SKIPA C,[SIXBIT /COMMON/] ;.OPEN ENTRY FOR "COM" DEVICE +SYSO: MOVSI C,(SIXBIT /SYS/) ; " FOR "SYS" DEVICE +TPLO2: MOVEM C,USYSN1(U) + MOVNI I,1 + JRST QSKO + +QSKPO: MOVSI TT,-NQS ;PACK # OPEN + CAME I,QPKID(TT) + AOBJN TT,.-1 ;I <= PHYSICAL UNIT WITH SPECIFIED PACK + JUMPL TT,QSKPO1 + PUSHJ P,QPKNFP + JRST QSKPO + CAIE W,4 ;IF RENAME/DELETE, OK, DOESN'T TOUCH FILE ANYWAY + JRST OPNL16 ;OTHERWISE COMPLAIN PACK NOT MOUNTED +QSKPO1: HRRZ I,TT +QSKUO: CAIGE I,NQS ;DISK UNIT # OPEN + SKIPE QACT(I) ;I <= UNIT # + JRST OPNL10 ;BAD UNIT # OR NOT ENGAGED +IFE MCOND DM,[ ;; Security check in reserved pack feature only on DM. +IFN QRSRVP,[ + JUMPN W,QSKOB ;WRITE-OVER OR RENAME OK. + JUMPGE D,QSKOB ;READ OK. + SKIPE QRESRV(I) ;WRITE: IS PACK ON THIS DRIVE RESERVED? + JRST OPNL10 ;YES, CAN'T WRITE ON IT. +];QRSRVP +];DM + JRST QSKOB + +;DNRF: DEVICE IS LIKE DSK: BUT DOESN'T SET REFERENCE DATE +DNRFO: TRO D,%DONRF/2 ;SET MODE BIT AND DROP INTO QSKO + +; Regular DSK: device +; +; RH(D) has open mode, rotated 1 bit right. +; W has operation code (0=r/w, 2=link, 4=del/rnm, 1=wov) + +QSKO: MOVNI I,1 ;DSK OPEN, I <= # DETERMINED BY SYS +QSKOB: MOVEM I,EPDL(U) ;SAVE DISK # + MOVE C,USYSN1(U) + CAIN W,4 + JUMPE A,QSKOB2 ;IF RENAME OF OPEN FILE TRAP OUT +QSKOA: MOVE I,MDSK ;IS MFD IN? + PUSHJ P,QMCH1 ;READ IN MFD OF MASTER DISK + CLEARM QLD(U) ;LINK DEPTH +QSKOL: PUSHJ P,MFDCK + JRST SYSDS2 + JUMPN W,OPNL11 + JUMPL D,OPNL11 ;MUST BE NORMAL READ + JRST QMLSTF ;USER WANT TO READ THE MASTER DIRECTORY + +MFDCK: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + POPJ P, + JRST POPJ1 + +SYSDS2: PUSHJ P,QFLD ;H <= PTR TO USER DIR TABLE + PUSHJ P,QSKO1 ;LOSER DIR NOT IN CORE + SKIPG QSNNR(H) + BUG + PUSHJ P,QUDLK ;RETURN WITH SOS OF QSNNR ON LSWPR + MOVSI TT,40000 + TDNE TT,QSNLCN(H) + JRST QSKDP1 ;PAW OVER USER DIRECTORY +QSKDP2: PUSHJ P,QUDULK + PUSHJ P,FLDRCK + JRST QSKDP9 ;NOT SPECIAL DIRECTORY FILE + JUMPN W,QPNL11 + JUMPL D,QPNL11 + JRST QLISTF ;USER WANTS TO READ HIS USER DIRECTORY + +QSKDP9: JUMPN W,QSKDPY ;If doing IO? + SKIPL D ; and reading + JRST QSKDPZ ; then don't bother with "security". +QSKDPY: PUSHJ P,MNGDIR ;Else if this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. +QSKDPZ: JUMPL D,QWRO ;WRITE + CAIN W,4 + JRST QRNAM ;RENAME/DEL + CAIN W,2 + JRST QALINK ;MAKE LINK + JUMPN W,QPNL22 +QWROR: JUMPE A,QPNL11 ;ALSO ENTER FOR VARIOUS WRITE OVER, COPY OVER MODES + JUMPE B,QPNL11 + PUSHJ P,QCHNF ;GET CHANNEL FOR READ + PUSHJ P,LOSSET + QCHNRT + PUSHJ P,QUDLK ;LOCK USER DIR + PUSHJ P,QLOOK ;LOOK UP FILE + JRST [ PUSHJ P,QROR1C ;Not found => decide whethe error or wait. + POPJ P, ;Error (error code already set up). + PUSHJ P,QUDULK ;If retrying, first unlock directory, + PUSHJ P,LSWPOP ;Return the channel, + PUSHJ P,UDELAY ;Wait a little while, + JRST QWROR] ;Try again. + TRNE D,3 ;SKIP IF UNIT ASCII MODE + JRST QSKO2 + MOVE J,[440700,,5] ;BYTE SIZE IS 7 BITS + MOVEM J,QSBYTE(E) +QSKO2: HLLZ J,QSBYTE(E) ;GET PROPER BYTE POINTER LH + MOVEM J,QSMPRP(E) + TRNN D,%DONRF/2 ;3.4 BIT IN OPEN IMPLIES DONT SET REFERENCE DATE + PUSHJ P,QFREF ;"REFERENCE" FILE + MOVE C,Q + SUB C,QSNLCN(H) + HRRZM C,QUDFPR(E) ;SET UP PTR FROM CHNL TO FILE NAME AREA + LDB TT,[UNDSCP+UNRNDM(Q)] ;FOUND FILE SET UP CHNL + MOVEM TT,QDIRP(E) ;SET UP CHAR PTR TO DESC AREA + MOVE C,UNRNDM(Q) + TLNE C,UNLINK + JRST QLINK ;FILE IS A LINK + MOVSI C,%QALOP + SKIPE QLD(U) ;IF WE TRACED A LINK TO OPEN THE FILE, REMEMBER THAT. + IORM C,QSRAC(E) + MOVSI C,%QARWT + TRNE D,%DORWT/2 + IORM C,QSRAC(E) + LDB J,[UNPKN+UNRNDM(Q)] ;GET PACK NUMBER FILE IS ON + MOVSI I,-NQS + CAME J,QPKID(I) + AOBJN I,.-1 ;TRANSLATE LOGICAL TO PHYSICAL DISK UNIT + JUMPGE I,QPKNF ;PACK NOT ON * + HRRZM I,QDSKN(E) ;SET CHNL DISK NUMBER + JUMPL D,QWROR1 ;REALLY WANT TO WRITE OVER, ETC + MOVEI TT,%QMRD ;PUT CHANNEL IN NORMAL READ MODE + HRRM TT,QSRAC(E) +QOEX1: PUSHJ P,QUDULK ;UNLOCK USER DIR + PUSHJ P,LSWDEL ;QUSR ENTRY + PUSHJ P,LSWDEL ;QSNNR ENTRY + SKIPG QSNNR(H) + BUG + PUSHJ P,QSTRTR + MOVE C,D + ROT C,1 + HRL A,E + JSP Q,OPSLC7 ;SET UP IOCHNM AND DEPART + DQUAI,,DQUAO + DQBI,,DQBO + DQUII,,DQUIO + DQBI,,DQBO + +QWROR1: SOJN W,OPNL12 ;NORMAL WRITE OVER MODE + HRRZS H ;CLEAR GARBAGE IN USER DIR NUM + HRRZS E ;CLEAR GARBAGE IN CHNL NUM + HRRZ J,QUDFPR(E) ;PICK UP LOCN OF FILE WITH U.F.D + MOVSI I,-NQCHN ;MAKE SURE THIS FILE NOT OPEN FOR READING +QROR1A: CAIE E,(I) ;DONT GET FAKED OUT BY OWN CHNL + SKIPGE QUSR(I) + JRST QROR1B + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1B + JRST OPNL23 + +QROR1B: AOBJN I,QROR1A + PUSHJ P,QAUTH + MOVSI TT,UNWRIT + IORM TT,UNRNDM(Q) ;SET WRITE BIT + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(Q) + PUSH P,D + PUSH P,Q + PUSH P,R + PUSH P,E ;CONVERT FROM ORIGINAL BYTE SIZE TO ONE OPENED IN NOW + LDB D,[UNBYTE+UNREF(Q)] + PUSHJ P,QBDCD ;GET INFO FROM ORIGINAL WRITE OF FILE + MOVEI Q,36. + IDIV Q,D ;BYTES PER WORD + SUB Q,E ;# VALID BYTES + IMUL Q,D ;VALID BITS IN LAST WORD + POP P,E ;RESTORE QSK CHNL # + HRRZ R,QSBYTE(E);BYTES PER WORD IN NEW BYTE SIZE + LDB J,[QSBSIZ(E)] ;BITS PER BYTE IN NEW BYTE SIZE + IDIV Q,J ;NUMBER OF NEW-SIZE BYTES IN LAST WORD + SUB R,Q ;RESIDUE IN NEW-SIZE BYTES + LDB Q,[QSBSIZ(E)] ;NEW BYTE SIZE + PUSHJ P,QBENC ;RH(Q) GETS NEW BYTE INFO + MOVE R,-1(P) + DPB Q,[UNBYTE+UNREF(R)] ;CLOBBER FILE'S BYTE SIZE + POP P,R + POP P,Q + POP P,D + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(Q) + HLRS TT + DPB TT,[UNREFD+UNREF(Q)] + HLLM TT,OLDRDT(E) + MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVSI TT,%QAMWO ;WRITE OVER MODE + IORM TT,QSRAC(E) ;LEAVE %QMIDL UNTIL FIRST .IOT SINCE + JRST QOEX1 ; THE USER WILL PROBABLY DO A .ACCESS + +;Call here if lookup fails on open. +;Either signal some error and return, +;or skip-return if caller should wait and retry the lookup. +;Assumes H has dir slot, Q has address of filename block, +;E has channel number allocated for this open. +;Clobbers C, J. +QROR1C: HRRZ C,QSNLCN(H) + SUBI Q,-LUNBLK(C) + SKIPL Q ;SEE IF STILL POINTED INSIDE DIR + CAILE Q,2000-LUNBLK + JRST QROR1D ;NO - REALLY FNF + ADDI Q,(C) + CAMN A,UNFN1(Q) ;DO NAMES MATCH? + CAME B,UNFN2(Q) + JRST QROR1D ;NO - REALLY FNF + HRRZ J,Q ;Find channel that has this file open. + SUB J,QSNLCN(H) + ANDI J,-1 + HRRZS H ;Clear garbage in user dir num + HRRZS E ;Clear garbage in chnl num + MOVSI I,-NQCHN +QROR1E: CAIE E,(I) ;Dont get faked out by our own chnl. + SKIPGE QUSR(I) + JRST QROR1F + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1F +;Found the channel. Does it want us to wait? + MOVE I,QSRAC(I) + TLNN I,%QARWT + JRST OPNL23 ;He didn't say so => get "file locked". + JRST POPJ1 + +QROR1F: AOBJN I,QROR1E + JRST POPJ1 ;Cannot find channel => maybe was closed. Retry. + +QROR1D: SKIPN QLD(U) + JRST OPNL4 ;FILE NOT FOUND + JRST OPNL47 ;LINK WAS FOUND, BUT NOT THE FILE IT POINTED TO + +;COME HERE FOR RENAME-WHILE-OPEN +QSKOB2: HRRZ A,B ;DO RENAME WHILE OPEN HERE TO AVOID + CAIL A,20 ;IN CASE SYS NAME HAS CHANGED + JRST OPNL14 + SKIPE SRN3(U) + SKIPN SRN4(U) + JRST OPNL11 + ADD A,U + HLRZ E,IOCHNM(A) + MOVE H,QUDPR(E) + MOVE A,SRN3(U) + MOVE B,SRN4(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL11 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL11 + PUSHJ P,QUDLK + MOVE Q,QUDFPR(E) + ADD Q,QSNLCN(H) + PUSHJ P,QGRLSC ;EITHER NAME > OR FROM POINTER + MOVE I,D ;I => TO POINTER + HRLOI E,377777 ;PREVIOUS FN1 (BIT 4.9 COMPLEMENTED) + MOVE W,E ;FN2 + MOVEI J,0 ;J NEGATIVE => NEED SORT, NON-ZERO => DIR MODIFIED +QSKDP4: SUBI I,LUNBLK +QSKDP5: SUBI D,LUNBLK + CAMLE C,D + JRST QSKDP8 ;THROUGH + SKIPN A,UNFN1(D) + SKIPE UNFN2(D) + JRST QSKDP3 + HLLOS J + JRST QSKDP5 ;NAME BLOCK FREE + +QSKDP3: MOVE Q,UNRNDM(D) + TLNN Q,UNIGFL + JRST QSKDPR ;NOT OPEN FOR WRITE OR BEING DELETED + HLLOS J ;NEED TO WRITE OUT DIR + SKIPN A,UNFN1(D) + MOVSI A,(SETZ) + SKIPN B,UNFN2(D) + MOVSI B,(SETZ) +QSKDP7: PUSHJ P,QGRLSC ;DON'T CREATE ANY FILE WITH NAME OF < OR > + AOJA A,QSKDPA ;CHANGE BOTH JUST TO BE SURE + AOJA A,QSKDPA + MOVE Q,QSNLCN(H) ;SEE IF THAT NAME EXISTS + MOVEI Q,2000-LUNBLK(Q) ;THERE MAY BE DUPLICATE ENTRIES +QSKDPU: CAMN A,UNFN1(Q) ;DURING THIS SEARCH BUT IT DOESN'T + CAME B,UNFN2(Q) ;MATTER + JRST QSKDPT + CAIE Q,(D) ;DON'T CHANGE NAME IF NOT DUPLICATE +QSKDPA: AOJA B,QSKDP7 ;FOUND IT. CHANGE SECOND NAME +QSKDPT: SUBI Q,LUNBLK + CAMG C,Q + JRST QSKDPU + MOVEM A,UNFN1(D) + MOVEM B,UNFN2(D) + MOVSI Q,UNIGFL + ANDCAM Q,UNRNDM(D) +QSKDPR: CAMN D,I + JRST QSKDP6 + HRLZ Q,D ;RELOCATE FILE BLOCK + HRR Q,I + BLT Q,LUNBLK-1(I) +QSKDP6: JUMPL J,QSKDP4 ;ALREADY NEEDS SORT + MOVE B,UNFN2(D) ;MAY NOT HAVE YET IF GOT HERE FASTEST WAY + TLC A,(SETZ) + TLC B,(SETZ) + EXCH A,E + EXCH B,W + CAMLE A,E + JRST QSKDP4 ;ORDER OK + CAMN A,E + CAMGE B,W + MOVNI J,1 ;NEED SORT + JRST QSKDP4 + +QSKDP8: ADDI I,LUNBLK ;I POINTED TO EMPTY SLOT + MOVE D,I + SUBI D,(TT) + EXCH D,UDNAMP(TT) + ADDI D,(TT) + CAML D,I + JRST QSKDPV + SETZM (D) ;CLEAR VACATED AREA + HRLS D + ADDI D,1 + BLT D,-1(I) +QSKDPV: JUMPL J,QSKDPS ;SORT + TRNN J,-1 + JRST QSKDPK +QSKDPX: MOVE I,QACTB + IORM I,QSNLCN(H) +QSKDPK: MOVE W,QSNLCN(H) +IFN QRSRVP,[ + HLRZ A,UDALLO(W) ;IF THIS DIR HAS ALLOCATION + JUMPE A,QSKBK0 + MOVEI B,NQS-1 ;CONVERT PACK # TO DRIVE # + CAME A,QPKID(B) + SOJGE B,.-1 + SKIPGE A,B +QSKBK0: SETO A, ;ALLOCATED PACK NOT MOUNTED, USE ANY + MOVEM A,QSALLO(H) ;SAVE DRIVE # (-1 IF NONE) +];QRSRVP + HLLZS UDBLKS(W) + MOVE A,UDNAMP(W) + ADDI A,(W) +QSKBK1: CAIL A,2000(W) ;COUNT BLOCKS USED + JRST QSKBK2 + MOVE B,UNRNDM(A) + TLNE B,UNLINK + JRST QSKBK3 + LDB B,[UNDSCP+UNRNDM(A)] + IDIVI B,UFDBPW + HLL B,QBTBLI(C) + ADDI B,UDDESC(W) ;B GETS BYTE PNTR TO DESC +QSKBK4: ILDB C,B + JUMPE C,QSKBK3 + CAIN C,UDWPH + JRST QSKBK4 + CAIG C,UDTKMX + JRST [ADDM C,UDBLKS(W) ? JRST QSKBK4] + CAIG C,UDWPH + JRST [AOS UDBLKS(W) ? JRST QSKBK4] + REPEAT NXLBYT, IBP B + AOS UDBLKS(W) + JRST QSKBK4 + +QSKBK3: ADDI A,LUNBLK + JRST QSKBK1 + +QSKBK2: POP P,W + POP P,I + POP P,D + POP P,C + POP P,B + POP P,A + JRST QSKDP2 + +QSKDPS: MOVEI T,LUNBLK + ADD P,[3,,3] +QSKDPB: MOVEI Q,(I) ;BEGINNING OF NAME AREA + SKIPGE T + MOVEI Q,2000-LUNBLK(TT) ;START AT END + MOVEI W,2000(TT) + SKIPGE T + MOVEI W,-LUNBLK(I) + SETZM (P) + TDZA J,J ;0 => SORTED -1 => MAKE ANOTHER PASS +QSKDPE: ADD Q,T + CAIE Q,(W) + JRST QSKDPC + JUMPE J,QSKDPW + MOVNS T + JRST QSKDPB + +QSKDPW: SUB P,[3,,3] + JRST QSKDPX + +QSKDPC: SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + JRST QSKDPD + BUG + +QSKDPD: MOVE B,UNFN2(Q) + TLC A,(SETZ) + TLC B,(SETZ) + SKIPE E,(P) ;FIRST ENTRY + JRST QSKDPF +QSKDPG: MOVEM A,-2(P) + MOVEM B,-1(P) +QSKDPI: MOVEM Q,(P) + JRST QSKDPE + +QSKDPF: JUMPL T,QSKDPJ + CAMLE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAML B,-1(P) + JRST QSKDPG +QSKDPH: REPEAT LUNBLK,[ + EXCH A,.RPCNT(E) + EXCH A,.RPCNT(Q) + EXCH A,.RPCNT(E) +] + MOVNI J,1 + JRST QSKDPI + +QSKDPJ: CAMGE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAMG B,-1(P) + JRST QSKDPG + JRST QSKDPH + +SUBTTL OPEN FOR WRITE + +;RETURNS WITH QUSR(E) AND QSNLCN(E) ON LSWPR +QWRO2: JUMPE A,QPNL11 + JUMPE B,QPNL11 + SKIPGE I,EPDL(U) ;PICK UP DESIRED DISK UNIT + JRST QWRO2A ;SYSTEMS CHOICE +QWRO2B: CAIGE I,NQS + SKIPE QACT(I) + BUG ;WE LOST SOMEHOW... + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) ;TUT IN BUT NOT PAWED OVER + TLNE TT,40000 ;TUT NOT IN + PUSHJ P,QTCH1 ;READ IN TUT OF DISK INVOLVED + PUSHJ P,QCHNF ;GET CHANNEL + PUSHJ P,LOSSET + QCHNRT + MOVE TT,[440700,,5] + TRNN D,3 + MOVEM TT,QSBYTE(E) ;UNIT ASCII MODE, BYTE SIZE=7 + PUSHJ P,QUDLK ;LOCK USER DIRECTORY + PUSHJ P,QGRLSC ;CHECK < AND > + JRST QPNLBN ;LOSE + PUSHJ P,QFNG ;REPLACE WITH COMPUTED EFFECTIVE NAME + PUSHJ P,QFREEF ;FIND FREE FILE NAME AREA AND STORE IN QDIRP(E) + JRST QFDF ;FILE DIR FULL + MOVSI TT,UNWRIT ;SET WRITE IN PROGRESS + IORM TT,UNRNDM(Q) + MOVE TT,QPKID(I) + DPB TT,[UNPKN+UNRNDM(Q)] + PUSHJ P,QAUTH ;SET FILE AUTHOR, MAY NOT PCLSR + MOVE TT,QACTB + IORM TT,QSNLCN(H) + SETOM QSCRW(E) ;SET CHNL WRITE SWITCH + POPJ P, + +QWRO2A: +IFN QRSRVP,[ + SKIPL I,QSALLO(H) + JRST QWRO2B ;THIS DIR GOES ON A PARTICULAR UNIT +] + SKIPGE I,QWRU ;GET CURRENT WRITING UNIT + JRST QWRO2E ;NO CURRENT UNIT, GO FIND ONE + MOVE TT,QSFT(I) + CAML TT,QFTTHR + JRST QWRO2B ;ENOUGH ROOM ON PREFERRED UNIT +QWRO2E: SETOB T,I ;NOT MUCH SPACE LEFT TRY OTHER UNITS + MOVSI E,-NQS +QWRO2C: SKIPGE QACT(E) ;SKIP ON UNIT ACTIVE + JRST QWRO2D +IFN QRSRVP,SKIPN QRESRV(E) ;DONT CHOOSE THIS PACK IF RESERVED + CAML T,QSFT(E) ;NOTE QSFT IS -1 IF TUT NEVER BEEN READ IN + JRST QWRO2D ;OTHERWISE CONTAINS VALID BLOCK COUNT + MOVE T,QSFT(E) + HRRZ I,E +QWRO2D: AOBJN E,QWRO2C + SKIPGE I + BUG ;NO ACTIVE UNRESERVED UNITS + CAMN I,QWRU + JRST QWRO2B ;DON'T WRITE MFD IF UNCHANGED + MOVEM I,QWRU + MOVE E,QACTB + IORB E,QMDRO + MOVEM I,MPDWDK(E) + JRST QWRO2B + +QWRO: JUMPN W,QWROR ;REALLY WANT TO MODIFY OR OTHERWISE HACK AN EXISTING FILE + PUSHJ P,QWRO2 ;MAKING NEW FILE, DECIDE WHICH UNIT TO PUT IT ON + SETOM QMFTP(E) ;TRACK TO SCAN IN TUT + SETOM QMTTR(E) + CLEARM QMPTN(E) + CLEARM QMPTC(E) + MOVEI TT,%QMWRT ;ENTER NORMAL WRITE MODE + HRRM TT,QSRAC(E) + MOVSI TT,%QARWT + TRNE D,%DORWT/2 + IORM TT,QSRAC(E) + JRST QOEX1 ;EXIT + + +SUBTTL File hacking tracking + +; MNGDIR checks the file name (sname in C) +; Fails to skip if the file is an important system file. +; Skips if the file is of the everyday sort. + +MNGDIR: HLRZ TT,C +IFN KL10P, CAME C,[SIXBIT /.KLFE./] + CAIN TT,'SYS ;A sys directory? + POPJ P, + CAME C,[SIXBIT /ACOUNT/] + CAMN C,[SIXBIT /./] + POPJ P, + CAME C,[SIXBIT /DEVICE/] + CAMN C,[SIXBIT /CHANNA/] + POPJ P, + AOS (P) ;Not a system directory. skip return. + POPJ P, + +; SYSDSK notifies the SYS job to print a message on the +; console about the file being hacked. +; File names in C;A B, the opcode in W (or zero) specifies the hacking. + +SYSDSK: JUMPE U,CPOPJ ;Avoid deadly embrace! + MOVSI T,SCLWRT ;Writing on SYS directory. + PUSHJ P,CWAIT ;Take turns like nice little lusers. + TDNE T,SUPCOR ;Wait for previous req to finish. + MOVE TT,W ;Check file operation code. + CAILE TT,4 ;If impossible opcode + SETZ TT, ; probably supposed to be R/W. + MOVEM TT,SWMOD ;Store opcode. + MOVE TT,UNAME(U) + MOVEM TT,SWUNAM ;Luser. + MOVE TT,JNAME(U) + MOVEM TT,SWJNAM + MOVEM A,SWFN1 + MOVEM B,SWFN2 + MOVEM C,SWFN3 ;Sname. + IORM T,SUPCOR ;Notify the SYS job. + JRST CLKONJ ;Turn on the clock and return. + + +SUBTTL DIRECTORY ROUTINES + +QFREEF: PUSH P,A ;Q_PTR TO USER DIR FREE FILE QDIRP(E)_PTR TO FREE DESC AREA + PUSH P,B ;GET FREE FILE AREA + PUSH P,I + MOVEI I,0 ;SIGNAL NO GC YET +QFREFA: SETZM QUDFPR(E) ;CLEAR SO WILL NOT POINT TO RANDOMNESS IN CASE OF G C + MOVE TT,QSNLCN(H) + SKIPL Q,UDESCP(TT) + CAIL Q,2000*UFDBPW + BUG ;FREE DESC POINTER OUT OF RANGE + IDIVI Q,UFDBPW + MOVE C,UDNAMP(TT) + CAIL Q,-UDDESC-7-LUNBLK(C) + JRST QAGARB ;NOT ENOUGH ROOM BETWEEN DESC AND NAME AREAS + PUSHJ P,QLGLK ;FIND WHERE FILE OUGHT TO GO + JRST QFREFF ;DIR WAS EMPTY + TRNN J,1777 + JRST QFREFE ;GOES AT END OF DIR +QFREFC: CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QFREFE + MOVE C,UNRNDM(J) + TLNE C,UNIGFL ;* FILES MUST COME AFTER NON * FILES + JRST QFREFE ;OF SAME NAME + ADDI J,LUNBLK + CAIGE J,2000(TT) + JRST QFREFC +QFREFE: CAMN Q,J + JRST QFREFF ;GOES AT BEGINNING + PUSHJ P,QINSRT + JRST QFREFD + +QFREFF: SUBI Q,LUNBLK ;Q -> NAME BLOCK FILE WILL GO IN +QFREFD: MOVNI T,LUNBLK ;ALLOCATE MORE SPACE FOR NAME AREA + ADDM T,UDNAMP(TT) + HRRZ A,UDESCP(TT) ;FIRST FREE DESCRIPTOR LOC + DPB A,[UNDSCP+UNRNDM(Q)];STORE IN FILE AREA + MOVEM A,QDIRP(E) ;STORE IN CHANNEL + MOVEI B,6*UFDBPW+1 ;ENOUGH FOR A LINK WITH EVERY CHAR QUOTED PLUS ONE ZERO + ADDM B,UDESCP(TT) ;ALLOCATE MORE SPACE FOR DESC AREA + MOVE B,Q + SUB B,QSNLCN(H) + HRRZM B,QUDFPR(E) ;ASSOCIATE CHANNEL WITH FILE + CONO PI,CLKOFF + SKIPL B,QDATE ;GET TIME AND DATE + HRR B,TIMOFF + CONO PI,CLKON + MOVEM B,UNDATE(Q) ;SET CREATION DATE + HLLM B,OLDRDT(E) + HLRS B + DPB B,[UNREFD+UNREF(Q)] ;SET REFERENCE DATE + IDIVI A,UFDBPW ;GET WRD AND CHAR ADRS + HLLZ B,QBTBLI(B) + ADDI B,UDDESC(A) + HRRZ A,QSNLCN(H) + ADD B,A + ILDB A,B + SKIPE A + BUG ;DESCRIPTOR AREA ALREADY OCCUPIED + MOVEI A,UDWPH + DPB A,B + ILDB A,B + SKIPE A + BUG ;NOT FOLLOWED BY ZERO + POP P,I + POP P,B + POP P,A + MOVEM A,UNFN1(Q) ;SET FILE NAMES + MOVEM B,UNFN2(Q) + JRST POPJ1 + +QAGARB: JUMPL I,QNOFRE ;IF GC WAS ALREADY TRIED, DON'T TRY IT AGAIN - GIVE UP. + PUSHJ P,QGC ;GC. BTW, IT IS OK TO PCLSR HERE. + JFCL + MOVNI I,1 ;SIGNAL GC HAS BEEN TRIED + JRST QFREFA + +;MAKE ROOM FOR FILE BEFORE J. Q POINTS TO NEW EMPTY FILE SLOT +QINSRT: PUSH P,A + PUSH P,TT + HRRZ TT,QSNLCN(H) + HRRZ A,UDNAMP(TT) + PUSH P,A + ADDI A,(TT) + HRLS A + SUBI A,LUNBLK + BLT A,-LUNBLK-1(J) + SETZM -LUNBLK(J) + HRRZI A,-LUNBLK+1(J) + HRLI A,-LUNBLK(J) + BLT A,-1(J) + SUB J,QSNLCN(H) + MOVSI A,-NQCHN +QINSR1: HRRZ TT,QUDPR(A) + SKIPL QUSR(A) + CAIE TT,(H) + JRST QINSR2 + MOVE TT,QUDFPR(A) + CAMGE TT,(P) + JRST QINSR2 + CAIGE TT,(J) + SUBI TT,LUNBLK + MOVEM TT,QUDFPR(A) +QINSR2: AOBJN A,QINSR1 + ADD J,QSNLCN(H) + HRRZI Q,-LUNBLK(J) + SUB P,[1,,1] + POP P,TT + POP P,A + POPJ P, + +;DIR NOT IN CORE. GET IT FROM DISK, CREATE IT IF DOESN'T ALREADY +; EXIST, OR GIVE NO SUCH DIRECTORY ERROR. +;C HAS SNAME. RETURNS DIRECTORY NUMBER IN H. + +QSKO1: PUSHJ P,SWTL + QSKOSW ;PREVENT TIMING ERROR IF TWO PCS SHOULD + PUSHJ P,QFLD ; ATTEMPT TO BRING IN SAME DIRECTORY + JRST QSKO11 + MOVEI T,2 ;SOMEONE ELSE BROUGHT IT IN, RELEASE QSKOSW + JRST LSWPON ;BUT LEAVE QSNNR(H) LOCKED. + +QSKO11: PUSH P,J + PUSH P,I + PUSHJ P,QFL ;LOOK UP DIR IN MFD, RET TRACK IN J + JRST QSKON ;NON EXISTENT + PUSHJ P,QFLDF ;FIND FREE LOSER DIR SLOT + MOVE I,MDSK + PUSHJ P,QCHNF ;FIND FREE CHNL (TO READ IN DIR) + MOVEM C,QSNUD(H) ;SET USER NAME IN DIR SLOT + MOVEM J,QSLGL(E) ;REQUEST READ IN OF USER DIR FROM TRACK IN J + MOVEI TT,%QMUDR + MOVEM TT,QSRAC(E) +QSKON1: MOVEI T,2 + PUSHJ P,LSWPON ;RELEASE QSKOSW, LEAVE SOSSET OF QSNNR(H) + POP P,I ;GO AWAY WILL HANG UP WAITING IN QUDLK + POP P,J ;DIR IS LOCKED BUT NOT ON LSWPR, PI WILL UNLOCK AFTER READIN + JRST QSTRTR + +QNOFRE: POP P,I ;NO FREE FILES AVAIL + JRST POPBAJ + +QPNL24: PUSHJ P,OPNL24 + JRST URET + +QPNL20: PUSHJ P,OPNL20 + SKIPE QLD(U) + PUSHJ P,OPNL47 ;FOUND LINK, BUT IT POINTS TO NON-EXISTENT DIRECTORY + JRST URET + +AUTOCR: ;AUTOMATICALLY CREATED DIRECTORIES +IFN TPLP+UNSPLP,SIXBIT /.LPTR./ ;FOR TPL SPOOLING + SIXBIT /.MSGS./ ;FOR MESSAGES TO ALL LOSERS + SIXBIT /.MAIL./ ; Programs like to write mail here + SIXBIT /CRASH/ ; Programs like to dump themselves here + SIXBIT /.TEMP./ ; Programs like to write randomness here +NATOCR==.-AUTOCR + +QSKON: JUMPE C,QPNL20 ;DON'T ALLOW ZERO USER NAME + PUSH P,TT + MOVSI TT,-NATOCR +QSKONA: CAMN C,AUTOCR(TT) + JRST QSKONB + AOBJN TT,QSKONA + CAMN A,[SIXBIT /..NEW./] + CAME B,[SIXBIT /(UDIR)/] + JRST [POP P,TT + JRST QPNL20] + BUG INFO,[DSK: DIR ],SIXBIT,C,[CREATED BY ],SIXBIT,UNAME(U),SIXBIT,JNAME(U) +QSKONB: POP P,TT + SKIPG NQFUS + JRST QPNL24 ;NO MFD SLOTS AVAILABLE + PUSH P,A + PUSH P,B + PUSH P,C +QSKONE: PUSHJ P,QFLDF ;FIND FREE DIR SLOT + PUSHJ P,QMLOCK + PUSHJ P,TCALL + JRST IOMQ + JRST [PUSHJ P,LSWPOP ;QMDRO + PUSHJ P,LSWPOP ;QSNNR + PUSHJ P,UDELAY ;HOPEFULLY MEMORY WILL APPEAR SHORTLY + JRST QSKONE] + MOVEM C,QSNUD(H) + SOS NQFUS ;NO TIMING ERR DUE TO QSKOSW + MOVEI J,MU23UD + DPB J,[MUR,,MEMBLT(A)] + DPB H,[MNUMB,,MEMBLT(A)] + LSH A,10. + HRRM A,QSNLCN(H) + SETZM (A) + HRLS A + AOS B,A + BLT A,2000-2(B) + MOVEI A,2000 + MOVEM A,UDNAMP-1(B) + MOVE A,QSNUD(H) + MOVEM A,UDNAME-1(B) + MOVE B,QACTB ;NOW PUT UFD INTO MFD + IORB B,QMDRO + MOVE TT,MDNAMP(B) ;LOOK FOR A FREE SLOT + ADDI TT,(B) +QSKONC: TRNN TT,1777 + JRST QSKOND + SKIPN MNUNAM(TT) + JRST QSKONF + ADDI TT,LMNBLK + JRST QSKONC + +QSKONF: SUBI TT,(B) + JRST QSKONG + +QSKOND: MOVNI TT,LMNBLK ;NO FREE SLOTS, SO EXTEND DOWNWARD + ADDB TT,MDNAMP(B) +QSKONG: ADDI B,(TT) + MOVEM A,MNUNAM(B) + SUBI TT,2000-2*NUDSL ;GET DISK BLOCK NUMBER +IFN KA10P, SKIPGE TT +IFE KA10P, CAIGE TT,2 ; Don't clobber 'HOM' blocks + BUG ;TOO MANY UFDS (NQFUS CHECK DIDN'T WORK) + LSH TT,-1 + MOVEM TT,QSNMI(H) + MOVE TT,QACTB ;UNLOCK UFD AND CAUSE IT TO GET WRITTEN + HLLM TT,QSNLCN(H) + PUSHJ P,QMULK ;UNLOCK MFD + POP P,C + POP P,B + POP P,A + JRST QSKON1 + +SUBTTL MAKE LINK + +QALINK: MOVE I,MDSK ;ENTER WITH QSNNR ON LSWPR + MOVEM I,EPDL(U) + PUSHJ P,QWRO2 ;MAKES NEW FILE WITH MINIMUM OF 37 BYTES OF DESC SPACE + MOVSI A,UNLINK ; AND ADDS QUSR AND QSNLCN ON LSWPR + IORM A,UNRNDM(Q) ;SET LINK BIT + MOVE A,E ;QSK CHANNEL NUMBER + MOVE C,SRN5(U) ;SNAME LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN3(U) ;FN1 LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN4(U) ;FN2 LINKED TO + PUSHJ P,LDEP + JFCL + MOVE E,A ;QSK CHANNEL NUMBER FOR QCHNRT + MOVEI R,EPDL(U) ;DON'T CLOSE A REAL IOCHNM WORD + PUSHJ P,QSOCL4 ;CLOSE CHNL & FILE + PUSHJ P,LSWDEL ;DELETE QUSR, HAS BEEN SETOM'ED + PUSHJ P,LSWDEL ;DELETE QSNRR, HAS BEEN SOS'ED + JRST POPJ1 + +LDEP: MOVEI E,6 ;STORE SIXBIT FROM C INTO LINK DESC +LDEPL: MOVEI B,0 ;GET NEXT CHAR + LSHC B,6 + JUMPE B,LDEPS ;*THIS ALLOWS EMBEDDED BLANKS. + CAIE B,'; + CAIN B,': + JRST LDEPS +LDEPS2: MOVE D,B + PUSHJ P,QUDS + SOS E ;NUMBER OF CHARACTERS LEFT IN WORD + JUMPN C,LDEPL ;JUMP IF ANY MORE NON-BLANK CHARS TO STORE + MOVEI D,'; + JUMPE E,POPJ1 ;JUMP IF STORED 6 CHARACTERS + POPJ P, ;STORED FEWER, NEED TERMINATOR + +LDEPS: MOVEI D,': ;THIS CHAR NEEDS TO BE QUOTED + PUSHJ P,QUDS + JRST LDEPS2 + +;LINK ENCOUNTERED DURING LOOKUP + +QLINK: TRNE D,%DONLK/2 ;CHECK 3.5 BIT IN OPEN MODE + JRST QOLINK ;JUMP IF DON'T CHASE LINKS MODE + AOS A,QLD(U) + CAIL A,100. + JRST OPNL27 ;LINK DEPTH EXCEEDED + PUSH P,E ;SAVE XR NEEDED BY LSWPOP OF QUSR ENTRY + MOVE E,TT + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + MOVE TT,QBTBLI(TT) + HRR TT,E + MOVE I,[440600,,A] + SETZB A,B + SETZ C, +QL1: ILDB J,TT + JUMPE J,QL3 ;END DESC + CAIN J,': + JRST QL4 ;QUOTE NEXT CHAR + CAIN J,'; + TLZA I,770000 ;TERMINATE THIS WORD +QL5: IDPB J,I + JRST QL1 + +QL4: ILDB J,TT ;GET CHAR THAT WAS QUOTED + JRST QL5 + +QL3: EXCH A,C ;END OF DESC REACHED + EXCH A,B ;MAKE A FN1 B FN2 C SNM + SKIPN C + MOVE C,USYSN1(U) + PUSHJ P,QUDULK ;UNLOCK DIR + POP P,E ;RESTORE XR USED BY LSWPOP OF QUSR ENTRY + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,OPBRK ;IF TRYING TO BE PCLSRED, SUBMIT + JRST QSKOL + +QOLINK: MOVSI TT,%QALNK ;OPENING UP A LINK + IORM TT,QSRAC(E);DON'T ALLOW FILE-ONLY OPERATIONS SUCH AS IOT + JUMPL D,QWROR1 ;LEAVE RH(QSRAC)=%QMIDL SO PI LEVEL WON'T MESS WITH IT + JRST QOEX1 ;AND FINISH OPENING + +SUBTTL PAW OVER MFD + +QMCH1: CONO PI,UTCOFF + MOVE TT,QMDRO + TLNE TT,40000 + AOJE TT,QMCH2 ;NOT ON WAY IN +QMCH3: CONO PI,UTCON + SKIPGE QMDRO + PUSHJ P,UFLS + MOVSI E,2 + TDNN E,QMDRO + POPJ P, ;PAWED OVER + PUSHJ P,QMLOCK + ANDCAM E,QMDRO + HRRZ E,QMDRO + MOVE TT,MDCHK(E) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] +QMCH1A: MOVEI E,2000-LMNBLK*NUDSL(E) +IFN KA10P, SETZM NQFUS +IFE KA10P,[ + MOVNI TT,2 ;PROTECT DEC 'HOM' BLOCKS SO KLDCP OR 8080 + MOVEM TT,NQFUS ; CAN FIND ITS CRUFT +] ;IFE KA10P +QMCH1E: LDB TT,[1200,,E] + JUMPE TT,QMULK + SKIPN (E) + AOS NQFUS + ADDI E,LMNBLK + JRST QMCH1E + +QMCH2: SOS QMDRO ;INDICATE ON WAY IN + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + MOVEI TT,MFDBLK ;MFD TRACK + MOVEM TT,QSLGL(E) + MOVEI TT,%QMMDR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QMCH3 + +SUBTTL PAW OVER TUT + +QTCH1: CONO PI,UTCOFF + MOVSI TT,200000 + TDNE TT,QTUTO(I) + JRST QTCH2 ;GO READ IT IN + CONO PI,UTCON +QTCH1A: PUSHJ P,QTLOCK ;TO MAKE SURE IT'S IN + AOSE QDPWF(I) + JRST QTULK ;ALREADY PAWED OVER + PUSH P,A + PUSH P,B + MOVE T,QTUTO(I) + MOVE E,QSWAPA(T) + IDIVI E,DECADE + SKIPE TT + ADDI E,1 + IMULI E,DECADE ;ROUND SWAPPING ALLOC TO MULTIPLE OF A DECADE + MOVEM E,QSWAPA(T) + PUSH P,D + PUSH P,E ;FIRST TRACK OF NON-SWAPPING (FILE) AREA + MOVE E,QTUTP(T) ;ROUND TUT POINTER TO MULTIPLE OF A DECADE + ADDI E,DECADE-1 + IDIVI E,DECADE + IMULI E,DECADE + CAMGE E,(P) ;KEEP IT WITHIN THE FILE AREA + MOVE E,(P) + MOVEM E,QTUTP(T) + MOVE E,QPKNUM(T) +IFN DC10P,[ + CAME E,QPKID(I) + BUG HALT,[PACK ID ],OCT,E,[IN TUT FOR UNIT ],DEC,I,[DIFFERS FROM HARDWARE PACK ID],OCT,QPKID(I) +] +IFE DC10P, MOVEM E,QPKID(I) + MOVE E,QPAKID(T) + MOVEM E,QPKNM(I) +IFN QRSRVP,[ + MOVE E,QTRSRV(T) + MOVEM E,QRESRV(I) +] +;DROPS THROUGH + ;DROPS IN + CLEARM QSFTS(I) ;FREE SPACE IN SWAPPING AREA + SETZB D,QSFT(I) + MOVE B,QTUTO(I) + HRLI B,(TUTBP) + ADDI B,LTIBLK +QTCH1D: ILDB A,B + JUMPN A,QTCH1F + CAML D,(P) + AOS QSFT(I) ;BLOCK IN NON-SWAPPING AREA + CAMGE D,(P) + AOS QSFTS(I) ;BLOCK IN SWAPPING AREA +QTCH1F: ADDI D,1 + CAMGE D,QLASTB(T) + JRST QTCH1D + SUB P,[1,,1] + POP P,D + POP P,B + POP P,A + JRST QTULK + +QTCH2: SETOM QDPWF(I) + ANDCAM TT,QTUTO(I) + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + HRRZM I,QDSKN(E) + MOVEI TT,MFDBLK ;TELL PI LEVEL TO READ IT ALL IN + SUB TT,NTBL(I) + MOVEM TT,QSLGL(E) + LDB TT,[121000,,QTUTO(I)] + MOVEM TT,QSCABN(E) + MOVEI TT,%QMTTR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QTCH1A + +;ROUTINE TO ACCESS TUT +;CALL WITH DISK UNIT NUMBER IN I, BLOCK NUMBER IN D +;RETURNS IN D AN LDB-STYLE POINTER TO THE TUT AND IN B THE BYTE +;THAT YOU WOULD GET BY LDB'ING THAT POINTER. +;CLOBBERS E +;CALLER MUST LOCK TUT + +TUTPNT: MOVE B,QTUTO(I) + CAML D,QFRSTB(B) + CAML D,QLASTB(B) + BUG ;BLOCK NUMBER NOT IN RANGE COVERED BY TUT + SUB D,QFRSTB(B) + IDIVI D,TUTEPW + ADDI D,LTIBLK(B) + HLL D,TBTBL(E) + LDB B,D + POPJ P, + +QSTRTR: +IFN DC10P,[ +QSTRT1: CONSO DC0,DSKCHN + SETOM QHUNGF ;SOMEONE PUSHED RESET BUTTON, RECOVER AT PI LEVEL + CONO DC0,DCSET+DCIENB+DSKCHN ;ENABLE IDLE INTERRUPT +] +IFN RP10P+RH10P+RH11P,[ + CONO PI,UTCOFF + PUSHJ P,QSTRT1 + CONO PI,UTCON +] + POPJ P, + +IFN RP10P+RH10P+RH11P,[ ;START DISK WITH UTC ALREADY OFF +QSTRT1: SETOM QGTBZY ;NOTE: TURNS UTC BACK ON BUT NOT CLOCK +IFN RP10P, CONSO DPC,20 ;ONLY IF DISK IDLE +IFN RH10P, CONSO DSK,%HIBSY +IFN RH11P, IORDQ TT,%HRCS1 +IFN RH11P, TRNE TT,%HXRDY + CONO PI,DSKRQ + POPJ P, +] + +;TRY TO FLUSH UNNEEDED UFDS FROM CORE. +;ARG IN C IS ROUTINE TO FREE THE MEMORY. +;CALL WITH UDRSW SIEZED, OR WITH PI 2 IN PROGRESS AND UDRSW NOT LOCKED BY ANYONE +;CLOBBERS H, TT. DOESN'T SKIP. +QDFLS: MOVSI H,-QNUD +QDFLS1: SKIPE QSNUD(H) + SKIPE QSNNR(H) +QDFLS2: AOBJN H,QDFLS1 ;CAN'T FLUSH IF SLOT NOT USED OR CHANNELS OPEN IN DIR + JUMPGE H,CPOPJ + MOVE TT,QACTB + TLO TT,600000 + TDNE TT,QSNLCN(H) + JRST QDFLS2 ;CAN'T FLUSH IF LOCKED OR NOT WRITTEN OUT + PUSHJ P,QDFCHK ;CHECK THAT NO POINTERS TO THIS DIRECTORY REMAIN + CLEARM QSNUD(H) ;FLUSH + AOS QFUD + PUSH P,A + HRRZ A,QSNLCN(H) + LSH A,-10. + PUSHJ P,(C) ;RETURN THE MEMORY + POP P,A + JRST QDFLS2 ;TRY FLUSHING SOME MORE + +;CALL WITH UFD SLOT# IN H, WHEN YOU THINK THAT UFD IS FREE. +QDFCHK: PUSH P,C + PUSH P,J + MOVSI C,-NQCHN +QDFCH1: SKIPGE QUSR(C) + AOBJN C,QDFCH1 + JUMPGE C,QDFCH2 + HRRZ J,QUDPR(C) + CAIN J,(H) + BUG ;IT WASN'T REALLY FREE, MAYBE QSNNR IS SCREWED UP? + AOBJN C,QDFCH1 +QDFCH2: POP P,J + POP P,C + POPJ P, + +;FIND A FREE UFD SLOT, RETURN INDEX IN H. PUTS QSNNR ON LSWPR. +;CLOBBERS T, TT. + +QFLDF: PUSHJ P,SWTL + UDRSW + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSH P,C ;ALL UFD SLOTS IN USE, TRY FLUSHING SOME + MOVEI C,MEMR + PUSHJ P,QDFLS + POP P,C + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,UDELAY ;WAIT 1/2 SECOND THEN TRY AGAIN, INCLUDING QDFLS + JRST QFLDF + +QFLDF1: SKIPN QSNNR(H) ;SLOT ALREADY GOBBLED + SKIPE QSNUD(H) ;OR ALREADY OCCUPIED + AOBJN H,QFLDF1 ;MEANS CAN'T TAKE IT + SKIPL H + BUG ;NONE FREE, QFUD OUT OF PHASE WITH REALITY + HRRZS H + SOS QFUD + MOVSI TT,600000 ;DOUBLE LOCK + MOVEM TT,QSNLCN(H) + AOSG QSNNR(H) + BUG + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,LOSSET + QFLDRT + POPJ P, + +;LOSSET ROUTINE +QFLDRT: SKIPL A,AC0S+H(U) + CAIL A,QNUD + BUG ;H CLOBBERED + SOSGE T,QSNNR(A) + BUG + JUMPG T,CPOPJ ;HOW DID SOMEONE ELSE GET IT? + SKIPN QSNUD(A) + AOS QFUD ;READ-IN NEVER STARTED, SLOT BECOMES FREE + POPJ P, ;OK TO LEAVE 600000,, SET IN QSNLCN + +;C HAS DIR NAME. +;IF IN CORE, SET H TO UFD SLOT#, AOS QSNNR, PUT ON LSWPR, AND SKIP. +;IF DIRECTORY NOT IN CORE, NO SKIP. CLOBBERS T,TT. +QFLD: PUSHJ P,SWTL + UDRSW +QFLD1A: MOVSI H,-QNUD +QFLD1: CAME C,QSNUD(H) + AOBJN H,QFLD1 + JUMPGE H,LSWPOP ;JUMP ON FAILED TO FIND USER. +QFLD2A: AOSG QSNNR(H) + BUG ;MUST HAVE GOTTEN NEGATIVE SOMEHOW + PUSHJ P,LSWPOP ;UDRSW +; PUSHJ P,SOSSET +; QSNNR(H) +;THIS IS AN ATTEMPT TO FIND A BUG. + PUSH P,T + MOVEI T,QSNNR(H) + MOVEM T,IOTBTS(U) + PUSHJ P,LOSSET + [ SOSGE @IOTBTS(U) + BUG + POPJ P, ] + POP P,T +;END TEMPORARY CODE + JRST POPJ1 + +;C <=SYS NAME, RETURNS TRACK ADDR OF DIR IN J, SKIPS IF FINDS LOSER +QFL: PUSHJ P,QMLOCK + PUSHJ P,QFL0 + JRST QMULK + AOS (P) + JRST QMULK + +QFL0: PUSH P,Q + HRRZ Q,QMDRO + ADD Q,MDNAMP(Q) ;PTR TO USER AREA +QFL1: LDB J,[1200,,Q] + JUMPE J,QFL3 + CAMN C,MNUNAM(Q) + JRST QFL2 + ADDI Q,LMNBLK + JRST QFL1 + +QFL2: SUBI J,2000-LMNBLK*NUDSL ;J <= TRACK ADDR OF USER DIR + LSH J,-1 + AOS -1(P) ;SUCCESS +QFL3: POP P,Q + POPJ P, + +;ROUTINE TO ASSIGN A DISK CHANNEL. +;ARGS: U USER TO GO IN QUSR, H UFD SLOT# TO GO IN QUDPR, I DSK# TO GO IN QDSKN +;RETURNS QSK CHNL INDX IN E. +;DOESN'T DO A LOSSET OF QCHNRT, BUT CALLER MAY WANT TO. +;CLOBBERS T. NEVER SKIPS. + +QCHNF: PUSHJ P,SWTL ;PREVENT ANYONE ELSE FROM ALLOCATING CHANNELS + QCHSW + MOVSI E,-NQCHN + SKIPLE QFCHN + JRST QCH2 ;SOME CHANNELS ARE AVAILABLE, GO FIND ONE + PUSHJ P,LSWPOP ;QCHSW + SKIPG QFCHN + PUSHJ P,UFLS + JRST QCHNF + +QCH2: SKIPGE QSRAC(E) .SEE %QALOK + JRST QCH3 + SKIPGE QUSR(E) + JRST QCH1 +QCH3: AOBJN E,QCH2 + BUG ;WHERE DID THAT FREE CHANNEL GO? + +QCH1: HRRZS E ;CHANNEL ALLOCATED, INITIALIZE VARIABLES + HRRZM I,QDSKN(E) + SETOM QSCABN(E) + SETOM QSGL(E) + SETOM QSLGL(E) ;IN CASE OF WRITE-OVER ON 0-LENGTH FILE. + SETZM QBFP(E) + SETZM QSBFS(E) + CLEARM QSLBLK(E) + SETOM QSMDN(E) + SETZM QSCRW(E) + SETZM QSBI(E) + SETZM QSRAC(E) .SEE %QMIDL + CLEARM QFBLNO(E) + SETZM QSMPRC(E) + SETZM QSMPRP(E) + MOVE T,[444400,,1] ;ASSUME BYTES=WORDS, WILL BE FIXED LATER + MOVEM T,QSBYTE(E) + SETZM QPCLSR(E) + HRRZM H,QUDPR(E) + SETZM QUDFPR(E) ;NOT YET SET UP TO ANY PARTICULAR FILE + MOVEM U,QUSR(E) ;CHANNEL IS NOW IN-USE + SOSGE QFCHN + BUG + JRST LSWPOP ;QCHSW + +;LOSSET ROUTINE TO RETURN TENTATIVELY ASSIGNED QSK CHNL +;E HAD BETTER CONTAIN THE QSK CHANNEL NUMBER AT "ALL" TIMES +QCHNRT: SKIPL T,AC0S+E(U) + CAIL T,NQCHN + BUG ;E CLOBBERED + HRRZ A,U ;LSWPOP MESSES WITH LH(U) + CAME A,QUSR(T) + BUG + SETOM QUSR(T) + AOS QFCHN + POPJ P, + +SUBTTL DELETE, RENAME +;COME HERE FOR DELETE, OR RENAME NOT WHILE OPEN, ON DISK. + +QRNAM: SKIPN SRN3(U) + JRST QDEL + PUSH P,A + PUSH P,B + SKIPN B,SRN4(U) + JRST QPNL11 + MOVE A,SRN3(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL13 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL13 + POP P,B + POP P,A + PUSH P,SRN3(U) + PUSH P,SRN4(U) + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST [ SUB P,[2,,2] + JRST QROR1C ] ;GIVE FILE NOT FOUND OR FILE LOCKED + MOVE I,Q + POP P,B + POP P,A + PUSHJ P,QGRLSC + JRST QPNLBN ;FILE ALREADY EXISTS + PUSHJ P,QFNG +QRNAM4: PUSHJ P,QLOOK + JRST QRNAM3 + CAME I,Q ;ALLOW RENAME THAT DOESN'T CHANGE NAMES. + JRST QPNL13 +QRNAM3: MOVE Q,I + MOVSI TT,UNDUMP ;SAY FILE NOT DUMPED. + ANDCAM TT,UNRNDM(Q) + MOVNI E,1 ;TELL QFREF NOT TO CLOBBER NON-EX DISK CHNL. + PUSHJ P,QFREF ;"REFERENCE" FILE + PUSHJ P,QRELOC ;STORE NEW NAMES IN DIR +QRNAM2: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QRNAM1: MOVE U,USER ;U MAY NOT HAVE USER IF CAME HERE FROM LOGOUT + PUSHJ P,LSWCLR + JRST POPJ1 + +QGRLSC: CAME A,[SIXBIT />/] ;SKIP NONE IF BOTH A+B ARE SPECIAL + CAMN A,[SIXBIT //] ;AND TWICE IF NEITHER + CAMN B,[SIXBIT / LOOK UP FILE TO DELETE +;Q .NE. 0 => DELETE FILE POINTED TO BY QUDFPR OF CHNL IN D +;H MUST HAVE DIR SLOT INDEX +QDELA: MOVEI Q,0 +QDLA1: PUSHJ P,SLUGH + QCHSW + 1000,,QSNLCN(H) + 1000,,QTUTO(I) + JUMPN Q,QDLA2 + PUSHJ P,QLOOK + JRST QDEL4A ;FNF + SETO D, ;NO ASSOCIATED CHANNEL +QDLA3: LDB A,[UNLNKB+UNRNDM(Q)] + LDB TT,[UNPKN+UNRNDM(Q)] + CAME TT,J + JUMPE A,QDELA1 ;ON DIFFERENT DISK (DIDN'T LOCK RIGHT TUT TRY AGAIN) + MOVE A,Q + SUB A,QSNLCN(H) + MOVSI J,-NQCHN +QDEL1: CAIN D,(J) + JRST QDEL2 ;IGNORE CHANNEL (IF ANY) WHOSE CLOSING CAUSED THIS + HRRZ TT,QUDPR(J) + SKIPL QSCRW(J) ;ONLY LOOK AT READ CHNLS + CAIE TT,(H) + JRST QDEL2 + HRRZ TT,QUDFPR(J) + SKIPL QUSR(J) + CAIE TT,(A) + JRST QDEL2 + MOVSI TT,%QADEL ;FOUND CHNL WITH THIS FILE OPEN + IORM TT,QSRAC(J) ;DELETE FILE WHEN THIS CHNL CLOSED + MOVSI TT,UNCDEL ;SET DELETED BIT + IORM TT,UNRNDM(Q) +QDEL4: MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVE TT,DCHBT(I) + IORM TT,QTUTO(I) +QDEL4B: PUSHJ P,QTULK + PUSHJ P,QUDULK + PUSHJ P,LSWPOP + JRST POPJ1 + +QDLA2: MOVE Q,QUDFPR(D) ;COMPUTE FILE ADR FROM CHNL IN D + ADD Q,QSNLCN(H) ;DIR MAY HAVE MOVED + JRST QDLA3 + +QDEL4A: SOS (P) + JRST QDEL4B + +QCDLWO: PUSH P,R ;OUTPUT CLOSE BUT FILE WAS DELEWO'ED + SETZM QSCRW(D) ;FAKE OUT ERROR CHECK AT QSQSH6 + PUSHJ P,QUDULK +QSICLD: MOVE H,QUDPR(D) ;ENTRY FROM INPUT CLOSE, FILE WAS DELETED + MOVE I,QDSKN(D) + PUSHJ P,QUDLK + MOVE Q,QSNLCN(H) + ADD Q,QUDFPR(D) + MOVE J,QPKID(I) + PUSHJ P,QUDULK + PUSH P,D + PUSHJ P,QDLA1 + BUG ;FILE ISNT THERE? + POP P,D + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QICLX + +QDELA1: PUSHJ P,QDEL4B ;NOT OUR DISK IN J + JFCL + MOVE J,TT ;DISK ITS REALLY ON +QDELA2: MOVSI I,-NQS ;TRANSLATE PACK # IN J TO DRIVE # IN I + CAME J,QPKID(I) + AOBJN I,.-1 + JUMPGE I,QPKNF1 + JRST QDELA + +QSOCLD: PUSH P,D ;DELETE FILE WHEN CLOSING OVER IT + PUSH P,R + LDB J,[UNPKN+UNRNDM(Q)] + PUSHJ P,QUDULK + PUSHJ P,QDELA2 + JFCL +QPKNF7: POP P,R + POP P,D + POPJ P, + +QPKNF1: PUSHJ P,QPKNFP ;MAYBE TUT NOT IN YET? + JRST QDELA2 ;YUP, TRY AGAIN + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST QUDULK ;GONE AWAY BETWEEN LOCKS + JRST QDFPK ;GO DELETE OFF OF NON-MOUNTED PACK + +QDL2: PUSHJ P,QTULK ;DELETE LINK + MOVEI T,2 + PUSHJ P,LSWPON ;UNLOCK QCHSW +QDLINK: LDB E,[UNDSCP+UNRNDM(Q)] + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + HLL E,QBTBLI(TT) + ILDB A,E + SKIPN E + BUG ;NULL LINK? + MOVEI B,0 +QDL1: DPB B,E ;CLEAR OUT THE CHAR + CAIN A,': + IDPB B,E ;CLEAR A QUOTED CHAR WITHOUT LOOKING AT IT + ILDB A,E + JUMPN A,QDL1 + PUSHJ P,QSQSH ;REMOVE ENTRY + MOVE TT,QACTB + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + JRST POPJ1 + +QDEL2: AOBJN J,QDEL1 ;CHECK NEXT DISK CHANNEL + MOVE C,UNRNDM(Q) ;NOT OPEN, SO REALLY DELETE IT + TLNE C,UNLINK + JRST QDL2 + ANDI C,.BM UNDSCP + IDIVI C,UFDBPW + ADD C,QSNLCN(H) + ADDI C,UDDESC + HLL C,QBTBLI(D) ;GET DESCRIPTOR POINTER IN C AND TT + MOVE TT,C + MOVEI A,0 + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE + PUSH P,A + SKIPN D,QSFBT(H) ;SEE IF ENOUGH QSFBT STORAGE EXISTS + JRST QDEL11 +QDEL10: HLRE B,(D) ;NUMBER OF FREE LOCATIONS IN THIS PAGE + ADD A,B ;DECREASE LOCATIONS NEEDED + MOVE D,1(D) ;CDR + JUMPN D,QDEL10 +QDEL11: JUMPLE A,QDEL12 ;JUMP IF SUFFICIENT STORAGE EXISTS + PUSHJ P,TCALL ;GET MORE + JRST IOMQ + JRST [ MOVE U,USER ;U MAY NOT HAVE USER IF CAME FROM LOGOUT + PUSHJ P,LSWCLR ;HAVE TO WAIT FOR MEMORY + PUSHJ P,MQTEST ;AVOID DEADLOCKS BY UNLOCKING EVERYTHING + PUSHJ P,UFLS + JRST UUOTRO ] + MOVEI D,MU23FB + DPB D,[MUR,,MEMBLT(A)] + LSH A,10. + MOVEI D,2(A) + HRLI D,-1776 + MOVEM D,(A) + MOVE D,A + EXCH A,QSFBT(H) ;ADD TO FRONT OF LIST + MOVEM A,1(D) + MOVE A,(P) ;GET BACK NUMBER OF BLOCKS NEEDED + JRST QDEL10 ;SEE IF THERE ARE ENOUGH NOW + +QDEL12: POP P,A ;GET RID OF BLOCKS COUNT + PUSHJ P,QSQSH ;REMOVE ENTRY, CANNOT PCLSR AFTER THIS + CLEARB J,D ;J GETS NUMERIC TRACK NUMBER, D BYTE POINTER TO TUT + MOVE TT,QTUTO(I) ;D ZERO SO WILL HALT IF DESC DOESN'T START WITH LOAD-ADDR! + MOVE Q,QSFBT(H) ;Q -> AOBJN POINTER FOR STORING BLOCK NUMBERS +QDEL3: ILDB B,C ; INTO QSFBT AS DESCRIPTORS ARE ZEROED OUT + MOVEI A,0 ;I DISK, C BP TO DESCRIPTOR, A,B,E TEMP. + DPB A,C + JUMPE B,QDEL4 ;END OF FILE DESCRIPTION + TRNE B,40 + JRST QDEL6 + CAILE B,UDTKMX + JRST QDEL7 +QDEL8: SKIPN Q + BUG ;OOPS, OUT OF QSFBT STORAGE + SKIPL E,(Q) ;PICK UP AOBJN POINTER + JRST [ MOVE Q,1(Q) ;THIS PAGE FULL, TRY NEXT + JRST QDEL8 ] + MOVEM J,(E) ;STORE DISK,,BLOCK FOR LATER FREEING + AOBJN E,.+1 + MOVEM E,(Q) ;INCREMENT POINTER + MOVE E,QSNLCN(H) ;DECREASE DIR'S BLOCKS-USED + HRRZ A,UDBLKS(E) + SOSL A + HRRM A,UDBLKS(E) + ILDB A,D ;CHECK TUT + SKIPN A + BUG ;TUT SHOWS TRACK NOT USED + AOS J ;DO NEXT BLOCK IN CONTIGUOUS GROUP + SOJG B,QDEL8 + JRST QDEL3 + +IFN NXLBYT-2, .ERR THIS ROUTINE AND OTHERS KNOW IMPLICITLY THAT NXLBYT=2 +QDEL6: MOVEI D,0 ;LOAD ADDRESS + DPB B,[140500,,D] + ILDB B,C + DPB B,[060600,,D] + DPB A,C ;A HAS ZERO FROM QDEL3 + ILDB B,C + DPB B,[0600,,D] + DPB A,C + MOVE J,D + HRL J,I + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + JRST QDEL7A + +QDEL7: CAIN B,UDWPH + JRST QDEL3 + SUBI B,UDTKMX + ADD J,B + IBP D + SOJG B,.-1 +QDEL7A: MOVEI B,1 ;LOAD ADDRESS OR SKIP AND TAKE, SO ONLY ONE TRACK + JRST QDEL8 + +QDFNF: PUSHJ P,OPNL4 + JRST URET + +QDELB: CONO PI,UTCON + JRST QDELA + +;PERFORM BLOCK-FREEING SPECIFIED BY QFBTS +QDLFBT: CONO PI,UTCOFF ;PROTECT QFBTS + SKIPN B,QFBTS + JRST UTCONJ + MOVE T,1(B) + MOVEM T,QFBTS + CONO PI,UTCON + HRRZ T,(B) ;FIRST FREE LOCATION + SUBI T,2(B) ;NUMBER OF LOCATIONS TO DO + HRLO A,T + EQVI A,1(B) + AOBJP A,QDLFB9 ;A NOW -> BLOCKS TO FREE, & CHECK FOR EMPTY + SETO I, ;NO TUT LOCKED YET +QDLFB1: HLRZ J,(A) ;DISK NUMBER + CAMN J,I ;MAKE SURE RIGHT TUT IS LOCKED + JRST QDLFB2 + SKIPL I + PUSHJ P,QTULK + MOVE I,J + PUSHJ P,QTLOCK +QDLFB2: HRRZ D,(A) ;BLOCK NUMBER TO FREE + PUSHJ P,TUTPNT + CAIGE B,TUTMNY ;USED IN "MANY" FILES(1,2,...,TUTMNY,TUTLK) + SOJL B,[JRST 4,.] ;HALT IF TUT SHOWS TRACK NOT USED + JUMPN B,QDLFB3 ;NOT LAST USE + HRRZ T,(A) ;BLOCK NUMBER AGAIN + MOVE TT,QTUTO(I) + CAML T,QSWAPA(TT) + AOSA QSFT(I) + AOS QSFTS(I) ;TRACK IN SWAPPING AREA +QDLFB3: DPB B,D ;DECREASE USAGE COUNT IN TUT + AOBJN A,QDLFB1 + PUSHJ P,QTULK +QDLFB9: MOVEI A,-1(A) ;GET AN ADDRESS ON THAT PAGE + LSH A,-10. ;DONE WITH THIS PAGE, FREE IT + PUSHJ P,TMEMR ;RETURN PAGE TO FREE AND TRY FOR MORE + MU23FB + JRST QDLFBT + +;REMOVE HOLE FROM NAME AREA AT Q +QSQSH: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,TT + HRRZ TT,QSNLCN(H) + MOVE A,UDNAMP(TT) + CAILE A,2000 + BUG ;UDNAMP BAD + ADDI A,(TT) + HRRZ C,Q + SUB C,A + SKIPL C + CAIL C,2000-UDDESC + BUG ;Q BAD + HRRZ C,Q +QSQSH1: SUBI C,LUNBLK + CAMLE A,C + JRST QSQSH2 + HRLZ B,C + HRRI B,LUNBLK(C) + BLT B,2*LUNBLK-1(C) + JRST QSQSH1 + +QSQSH2: +REPEAT LUNBLK,SETZM .RPCNT(A) + SUBI A,-LUNBLK(TT) + HRRZM A,UDNAMP(TT) + HRRZ C,Q + SUBI C,(TT) ;INDEX OF DELETED FILE + HRRZI TT,-LUNBLK(A) ;INDEX OF OLD BEGINNING OF NAME AREA + MOVSI A,-NQCHN +QSQSH3: HRRZ B,QUDPR(A) + SKIPL QUSR(A) + CAIE B,(H) + JRST QSQSH4 + SKIPN B,QUDFPR(A) + JRST QSQSH4 + CAIGE B,(TT) + BUG + CAIN B,(C) + JRST QSQSH6 ;PNTR TO FLUSHED HOLE, CHECK IF READ CHNL + CAIG B,(C) ;IF AFTER DELETED FILE DON'T RELOCATE + ADDI B,LUNBLK + HRRZM B,QUDFPR(A) + SKIPL QSCRW(A) + JRST QSQSH4 ;READ CHNL + ADD B,QSNLCN(H) + MOVE B,UNRNDM(B) + TLNN B,UNWRIT + BUG ;CHNL WRITING BUT BEING WRITTEN BIT NOT SET +QSQSH4: AOBJN A,QSQSH3 + POP P,TT + POP P,C + POP P,B + POP P,A + POPJ P, + +QSQSH6: MOVE B,QSRAC(A) ;FOUND PNTR TO DELETED FILE + TLNE B,%QADEL ;SKIP IF NOT DELETE AFTER CLOSE + SKIPGE QSCRW(A) ;ALSO ERROR IF NOT READ CHNL + BUG + JRST QSQSH4 ;WAS DELETE AFTER CLOSE ON READ CHNL + +SUBTTL DIRECTORY LOOK UP, > FEATURE + +;A contains the FN1 and B contains the FN2. +;H is the index of the directory slot. The dir must be locked. + +;Returns the address of the filename block in Q. +;Clobbers C. + +;Internally, J and Q point to the bottom and top of the +;area of the dir we are still searching. +;Bit 4.9 of J is set to indicate one of the names is ">". +;C used as a flag: sign bit says creating a file. +;Bit 1.1 of C says FN2 is > or <. + +;Look for place to create new file, +;and generate new version for >. +QFNG: MOVEM Q,EPDL3(U) + SKIPA C,[SETZ] +;Look for existing files only +QLOOK: MOVEI C,0 + PUSH P,J + HRRZ J,QSNLCN(H) + MOVEI Q,2000-LUNBLK(J) + ADD J,UDNAMP(J) + CAMN A,[SIXBIT />/] + TLOA J,400000 + CAMN A,[SIXBIT / + CAMN B,[SIXBIT />/] + TLOA J,400000 + CAMN B,[SIXBIT //] + JRST POPJJ ;MUST BE READ RETN FILE NOT FOUND +QLOOK1: JUMPGE C,QLOOK9 + CAMN B,[SIXBIT /" +QLOOK9: PUSH P,D + PUSH P,TT + PUSH P,I + PUSH P,[-1] ;BEST INDEX + PUSH P,[SETZ] ;BEST "NUMERIC" PART + PUSH P,[SETZ] ;BEST ALPHA PART +QLOOK4: CAIGE Q,(J) + JRST QLOOK2 + XCT QLKI1(C) + JRST QLOOK3 + MOVE D,UNRNDM(Q) + TLNE D,UNIGFL + JUMPGE C,[ SKIPGE -2(P) ;FILE LOCKED, REMEMBER IT IF WE HAVE NO BETTER, + HRRM Q,-2(P) ; BUT DON'T CONSIDER IT IF READING + JRST QLOOK3 ] ;BUT IF WRITING, CONSIDER ALL FILES + SKIPE TT,@QLKI1+1(C) +QLOOK6: TRNE TT,77 ;RIGHT ADJ + JRST QLOOK5 + LSH TT,-6 + JRST QLOOK6 + +QLOOK5: MOVEI I,0 +QLOOK8: LDB D,[600,,TT] + CAIL D,'0 + CAILE D,'9 + JRST QLOOK7 ;NOT A DIGIT +QLOK5B: TRNE I,77 ;RIGHT ADJ LOW NON NUM PART + JRST QLOK5A + LSH I,-6 + JUMPN I,QLOK5B +QLOK5A: TLC TT,400000 ;AVOID CAM LOSSAGE + TLC I,400000 + SKIPGE -2(P) + JRST QLOK5D ;FIRST MATCH + JUMPGE J,QLOK5E ;GET LEAST + CAMGE TT,-1(P) ;GET GREATEST + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMGE I,(P) + JRST QLOOK3 ;NOT AS GOOD +QLOK5D: HRRZM Q,-2(P) + MOVEM TT,-1(P) + MOVEM I,(P) +QLOOK3: SUBI Q,LUNBLK + JRST QLOOK4 + +QLOK5E: CAMLE TT,-1(P) + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMLE I,(P) + JRST QLOOK3 + JRST QLOK5D + +QLOOK7: LSHC TT,-6 ;LOW DIGIT NOT NUMERIC + JUMPN TT,QLOOK8 ;NO NUMERIC DIGITS AT ALL ("BIN", MAYBE?) + JUMPL J,QLOK5B ;IF LOOKING FOR GREATEST, LET THIS BE LEAST + MOVNI TT,1 ;GREATEST IF LOOKING FOR LEAST + JRST QLOK5B + +QLOOK2: JUMPL C,QFNG1 ;REALLY WANT TO MAKE F.N.'S FOR WRITE + SUB P,[1,,1] + POP P,C ;BEST "NUMERIC" PART + POP P,Q ;ADR + POP P,I + POP P,TT + POP P,D + AOJE Q,POPJJ + MOVE A,UNFN1-1(Q) ;ACTUAL MATCHED FILE NAMES + MOVE B,UNFN2-1(Q) + SOJGE Q,POPJJ1 ;FOUND A FILE THAT WASN'T LOCKED + MOVEI Q,-LUNBLK(Q) + JRST POPJJ + +QFNG1: SKIPGE -2(P) + JRST QFNG2 ;NOT FOUND START W/ 1 + MOVE TT,-1(P) + TLC TT,400000 + MOVE I,[600,,TT] +QFNG3: LDB D,I + CAIL D,'0 + CAILE D,'9 + JRST QFNG4 ;REACH END OF NUMERIC FIELD + AOS D + CAILE D,'9 + JRST QFNG5 + DPB D,I +QFNG5A: TLNE TT,770000 + JRST QFNG3A + LSH TT,6 + JRST QFNG5A + +QFNG2: MOVSI TT,(SIXBIT /1/) +QFNG3A: MOVEM TT,A(C) ;STORE INTO A OR B AS APPRO + SUB P,[3,,3] + POP P,I + POP P,TT + POP P,D + MOVE Q,EPDL3(U) + JRST POPJJ + +QFNG5: MOVEI D,'0 + DPB D,I + ADD I,[60000,,] + JUMPL I,QFNG5A + JRST QFNG3 + +QFNG4: TLNN TT,770000 ;SKIP ON ALREADY 6 CHAR NAME + LSH TT,6 + MOVEI D,'1 + DPB D,I + MOVEI D,'0 +QFNG4B: TLNN I,770000 + JRST QFNG5A + IDPB D,I + JRST QFNG4B + +QLKI1: CAME B,UNFN2(Q) + CAME A,UNFN1(Q) + UNFN2(Q) + +QPKNF: MOVE C,QSNUD(H) + PUSHJ P,QUDULK ;UNLOCK DIR + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,QPKNFP + JRST QSKOL + PUSHJ P,OPNL16 ;PACK NOT MOUNTED + JRST URET + +QPKNFP: MOVSI I,-NQS +QPKNF3: SKIPGE QACT(I) + JRST QPKNF4 + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) + TLNE TT,40000 + JRST QPKNF2 ;PACK NOT IN OR NOT PAWED OVER +QPKNF4: AOBJN I,QPKNF3 + JRST POPJ1 + +QPKNF2: JRST QTCH1 ;MAYBE THIS UNIT HAS GOODIES + +QFDF: PUSHJ P,OPNL5 ;FILE DIR FULL ON WRITE + JRST URET + +QPNL13: PUSHJ P,OPNL13 + JRST URET + +QPNL22: PUSHJ P,OPNL22 + JRST URET + +QPNLBN: +QPNL11: PUSHJ P,OPNL11 + JRST URET + +;ROUTINE TO FIND PLACE IN DIRECTORY WHERE A B WOULD GO +;SKIPS ONLY IF DIRECTORY CONTAINS AT LEAST ONE FILE +;FOR INSERTION, FILE GOES BEFORE PNTR RETURNED IN J +;RETURNS PNTR IN Q TO BEGINNING OF NAME AREA +;(ONLY WORKS FOR LUNBLK = 5) +QLGLK: HRRZ J,QSNLCN(H) + HRRZ Q,UDNAMP(J) + ADDI Q,(J) + CAIL Q,2000(J) + POPJ P, ;DIRECTORY EMPTY + TLC A,(SETZ) + TLC B,(SETZ) + PUSH P,D + PUSH P,E + ADDI J,600 ;128. NAME BLOCKS FROM END +REPEAT 7,[ ;THIS CODE DELIBERATELY NOT INDENTED. NEED 4 DIMENSIONS. + CAMGE J,Q + JRST .+6 + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAMN A,D + JSP E,QLGLE + CAML A,D + ADDI J,<1_<7-.RPCNT>>*LUNBLK + SUBI J,<1_<6-.RPCNT>>*LUNBLK +] + CAMGE J,Q + ADDI J,LUNBLK + CAMGE J,Q + BUG + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAME A,D + JRST QLGL1 + MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMLE B,D +QLGL2: ADDI J,LUNBLK +QLGL3: TLC A,(SETZ) + TLC B,(SETZ) + POP P,E + POP P,D + JRST POPJ1 + +QLGL1: CAML A,D + JRST QLGL2 + JRST QLGL3 + +;CALL BY JSP E,QLGLE +QLGLE: MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMN B,D + JRST QLGL3 + CAML B,D + JRST 1(E) + JRST 2(E) + +SUBTTL LOCKING ROUTINES + +QMLOCK: PUSHJ P,LSWTL + QMDRO + POPJ P, + +QMULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QMDRO + BUG + POP P,U + JRST LSWPOP + +QTLOCK: PUSHJ P,LSWTL + QTUTO(I) + POPJ P, + +QTULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QTUTO(I) + BUG + POP P,U + JRST LSWPOP + +QUDLK: PUSHJ P,LSWTL + QSNLCN(H) + POPJ P, + +QUDULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QSNLCN(H) + BUG + POP P,U + JRST LSWPOP + +SBTBLI: +QBTBLI: 440600,, ;IF GOING TO ILDB +SBTBL: +QBTBL: 360600,, + 300600,, + 220600,, + 140600,, + 060600,, + 000600,, + +TBTBL=.+1 +TBTBLI: REPEAT 1+TUTEPW, TUTBP-<.RPCNT*TUTBYT*010000,,> + +SUBTTL DIRECTORY GARBAGE COLLECTOR + +; MOVE H, directory number +; lock the directory +; PUSHJ P,QGC +; return if directory full. +; return if won. +; No ACs clobbered. +; All pointers to directory relocated appropriately. + +; Called from disk open routines if a new file is to be created +; and there are less than 6+LUNBLK words in the free area of the directory. +; Called from QSBWG if %QAFUL is set in QSRAC. +; %QAFUL means "must have successful GC before committing another track to this file." + +;NOTE NOTE NOTE: +; This GC allocates an extra block of core for temporary storage. +; If no memory is free in low half, waits without unlocking directory. +; Can possibly PCLSR. No deadly embrace to not unlock directory since +; it can't be flushed from core anyway and it's not holding anything else in. + +QAPBMN==NXLBYT+3 ;minimum number of descriptor bytes which + ; must be available at the end of a file to + ; commit another track to the file. + ;1 for a take-N, NXLBYT+1 for jump, 1 for ending zero. +QAPBMX==36. ;maximum number of descriptor bytes to allocate at a time. + +QGC: IRPC X,,ABCDQIJTR + PUSH P,X + TERMIN + +;Old GC prints message on system console. Any reason to with fast one? + +; validate the directory + +QGC00: SKIPL A,QSNLCN(H) + BUG ;directory not locked + MOVE C,UDNAME(A) + MOVEM C,LASTGC ;save name of last dir GCed + CAME C,QSNUD(H) + BUG ;directory clobbered + SKIPLE C,UDNAMP(A) + CAILE C,2000 + BUG ;name pointer out of bounds + IMULI C,UFDBPW + SKIPL D,UDESCP(A) + CAIL D,-UDDESC*UFDBPW(C) + BUG ;descriptor/name overlap + +; Get a block of core to use for temporary storage. +; The block is left in the "in-process" state. + + HRRZ Q,A + PUSHJ P,TCALL + JRST IOMQ + JRST [ PUSHJ P,UDELAY ;no core available in low half + JRST QGC00 ] ;so wait, then loop back to beginning + LSH A,10. + MOVEI B,1(A) ;zero it out + HRL B,A + SETZM (A) + BLT B,1777(A) + EXCH Q,A ;A -> directory, Q -> temporary core +;Drops through + ;Drops in +; Scan the directory and count: +; I all files +; J files open for writing +; R active bytes of descriptor + + SETZB I,J + SETZ R, + MOVEI B,2000(A) ;end of name area + ADD A,UDNAMP(A) ;start of name area +QGC10: CAML A,B + JRST QGC19 ;jump if all files done + SKIPE UNFN2(A) + SKIPN UNFN1(A) + BUG ;zero name block? + AOJA I,QGC12 ;file exists + +QGC11: ADDI A,LUNBLK ;advance to next file + AOJA R,QGC10 ;also count the zero byte that ends the descriptor + +QGC12: MOVE C,UNRNDM(A) + TLNE C,UNWRIT + ADDI J,1 + ANDI C,.BM UNDSCP ;get descriptor ptr (undscp has pos=0) + IDIVI C,UFDBPW + HLL C,QBTBLI(D) + ADDI C,UDDESC-2000(B) + MOVE D,UNRNDM(A) + TLNE D,UNLINK + JRST QGC14 +QGC13: ILDB T,C ;get byte of descrip + JUMPE T,QGC11 ;eof + CAIG T,UDWPH + AOJA R,QGC13 ;1-byte desc +REPEAT NXLBYT, IBP C ;multi-byte desc + ADDI R,NXLBYT+1 + JRST QGC13 + +QGC14: ILDB T,C ;count bytes of link descriptor + JUMPE T,QGC11 + CAIN T,': + AOJA R,[IBP C ;quoted + AOJA R,QGC14 ] + AOJA R,QGC14 + + +; Compute number of bytes of descriptor to add after each +; file open for output. If > QAPBMX, set to QAPBMX. +; If < QAPBMN, take directory-full exit. + +QGC19: MOVE C,I ;save number of files + IMULI I,LUNBLK*UFDBPW ;number of bytes in name area + ADDI R,UDDESC*UFDBPW(I) ;R := total number of bytes claimed + MOVEI A,2000*UFDBPW-1 + SUB A,R ;A := number of bytes left + SKIPE J + IDIV A,J ;number of bytes available to extend open files + CAIGE A,QAPBMN + JRST QGC69 ;if < minimum, dir. full + CAILE A,QAPBMX + MOVEI A,QAPBMX ;limit to at most QAPBMX bytes at a time +;Drops through + ;Drops in +; A = number of bytes of room to leave after each file open for writing +; B -> name block under consideration +; C -> old descriptors +; D = disk channel number under consideration. Also D = C+1 +; J counts new descriptor bytes generated +; Q -> new descriptors (in temporary core block) +; R -> base of directory + + SETZ J, + HRRZ R,QSNLCN(H) ;old dir + ADDI Q,UDDESC ;new dir + HLL Q,QBTBLI + MOVE B,UDNAMP(R) + ADD B,R + +; Loop over files + +QGC20: CAIL B,2000(R) + JRST QGC40 ;all files done + LDB C,[UNDSCP UNRNDM(B)] ;get old desc ptr + DPB J,[UNDSCP UNRNDM(B)] ;store new desc ptr + +; Loop over all disk channels, relocating the ones that point to this file + + MOVSI D,-NQCHN +QGC31: HRRZ T,QUDPR(D) + SKIPL QUSR(D) + CAIE T,(H) + AOBJN D,QGC31 ;not in use or not same directory + JUMPGE D,QGC39 ;jump if all disk channels done + LDB T,[1200,,B] + CAME T,QUDFPR(D) + JRST QGC32 ;not same file + MOVE T,J ;relocate descriptor pointer + SUB T,C + ADDM T,QDIRP(D) +QGC32: AOBJN D,QGC31 + +QGC39: IDIVI C,UFDBPW ;make desc pntr into byte pointer + HLL C,QBTBLI(D) + ADDI C,UDDESC(R) + MOVE T,UNRNDM(B) + TLNE T,UNLINK + JRST QGC22 +QGC21: ILDB T,C ;copy descriptor bytes of a file into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIG T,UDWPH + AOJA J,QGC21 +REPEAT NXLBYT,[ + ILDB T,C + IDPB T,Q +] ADDI J,NXLBYT+1 + JRST QGC21 + +QGC22: ILDB T,C ;copy descriptor bytes of a link into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIN T,': + AOJA J,[ILDB T,C + IDPB T,Q + AOJA J,QGC22 ] + AOJA J,QGC22 + +QGC23: MOVE T,UNRNDM(B) + TLNN T,UNWRIT + JRST QGC25 + ADD J,A ;file being written, increase desc area + MOVE T,A + IBP Q + SOJG T,.-1 + +QGC25: ADDI B,LUNBLK ;next file + AOJA J,QGC20 ;also account for final zero at end of descriptor + +; Paranoia: check that all disk channels to this directory look OK + +QGC40: MOVEM J,UDESCP(R) ;store free-desc pointer + LDB A,[1200,,Q] ;last word used by descriptors + CAML A,UDNAMP(R) + BUG ;overlap + ANDI Q,-2000 ;base of temp core block again + MOVSI A,-NQCHN +QGC41: HRRZ T,QUDPR(A) + SKIPL QUSR(A) + CAIE T,(H) + AOBJN A,QGC41 ;channel not in use, or to some other dir + JUMPGE A,QGC49 ;all channels done + SKIPN B,QUDFPR(A) ;get file open on this channel + JRST QGC42 ;channel not set up to any particular file + CAIGE B,2000 + CAMGE B,UDNAMP(R) + BUG ;file pointer screwed + ADD B,R + SKIPL J,QDIRP(A) ;get descriptor pointer + CAMLE J,UDESCP(R) + BUG ;descriptor pointer screwed + LDB C,[UNDSCP UNRNDM(B)] + CAIGE B,2000-LUNBLK(R) ;skip if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get desc pntr for next file + CAIL B,2000-LUNBLK(R) + MOVEI D,2000*UFDBPW ;but if last file, get infinity + CAML J,C ;verify that QDIRP points to this file + CAML J,D + BUG +QGC42: AOBJN A,QGC41 ;do next channel + +; If you thought that was paranoid, get a load of this: + +QGC49: MOVE B,UDNAMP(R) + ADD B,R +QGC50: CAIL B,2000(R) + JRST QGC60 + LDB C,[UNDSCP UNRNDM(B)] + SOS C + IDIVI C,UFDBPW ;NOTE if UNDSCP = 0 we depend on bytes + HLL C,QBTBL(D) ; off left end of word LDB'ing as zero + ADDI C,UDDESC(Q) + LDB T,C + SKIPE T + BUG ;descriptor not preceeded by zero + MOVE J,UNRNDM(B) + TRZ J,#.BM UNDSCP ;LH(J) flags, RH(J) just desc pntr + TLNE J,UNLINK + JRST QGC52 +QGC51: ILDB T,C + JUMPE T,QGC53 + CAIG T,UDWPH + AOJA J,QGC51 +REPEAT NXLBYT, IBP C + ADDI J,NXLBYT+1 + JRST QGC51 + +QGC52: ILDB T,C + JUMPE T,QGC53 + CAIE T,': + AOJA J,QGC52 + IBP C + ADDI J,2 + JRST QGC52 + +QGC53: TLNE J,UNWRIT ;RH(J) has desc pntr to the zero that ends the file + ADDI J,QAPBMN ;if being written, needs room for one more track + CAIL B,2000-LUNBLK(R) ;now set D to point to next descriptor area + SKIPA D,UDESCP(R) ;do this instr if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get next file's desc pntr + CAIG D,(J) + BUG ;descriptors overlap + ADDI B,LUNBLK + JRST QGC50 + +; Copy the descriptors back into the directory + +QGC60: MOVSI C,UDDESC(Q) ;make BLT pointer to copy it back + HRRI C,UDDESC(R) + MOVE B,UDNAMP(R) ;use same BLT to zero out the free area + ADD B,R + BLT C,-1(B) + +; Take win return. + + AOS -9(P) +QGC69: LDB A,[121000,,Q] ;core block number of temporary page + PUSHJ P,TMEMR ;return it + MUINP ;verifying that it is the right one. + IRPC X,,RTJIQDCBA + POP P,X + TERMIN + POPJ P, + +SUBTTL INTERPRET DESCRIPTORS + +QFNTR: MOVE H,QUDPR(A) ;BYTE # IN Q CHNL # IN A + PUSHJ P,QUDLK ;DONT SKIP IF OFF FILE + MOVE T,QSNLCN(H) ;RETN BLOCK IN QSLGL(A) AND QSBI(A) DIR PNTR IN QDIRP(A) + ADD T,QUDFPR(A) ;FIRST ADR OF BLOCK IN QFBLNO(A) + LDB TT,[UNDSCP+UNRNDM(T)] ;CHAR ADR OF FILE BEG + MOVEM TT,QDIRP(A) ;SKIPS IF FINDS BLOCK AND LEAVES USER DIR LOCKED + CLEARM QSBI(A) + CLEARM QFBLNO(A) + CLEARB J,QSLGL(A) ;J HAS ORG OF FIRST NON-EX-BLOCK IF OFF END OF FILE +QFNT1A: PUSHJ P,QFNT1 + JRST QUDULK ;OFF END OF FILE RETN NOT SKIPPING + CAMLE J,Q + JRST QFNT7 ;LOCATED BLOCK CONTAINING WORD + MOVEM J,QFBLNO(A) + JRST QFNT1A + +QFNTN: MOVE H,QUDPR(A) ;LIKE ABOVE BUT SCAN FORWARD ONLY FROM CURRENT SPOT + PUSHJ P,QUDLK + PUSHJ P,QFNT1 + CAIA ;EOF, DON'T SKIP RETURN + AOS (P) + MOVEM J,QFBLNO(A) + JRST QUDULK + +QFNT1: SKIPE QSBI(A) ;DECODE NEXT BLOCK, CHNL IN A, SKIP UNLESS EOF. + JRST QFNT2 ;BLOCK # IN QSLGL FILE ADR IN J (TAKE N PENDING) +QFNT3: PUSHJ P,QMPDCH ;GOBBLE NEXT CHR OF DESC IN R (POINTED TO BY QDIRP) INCR QDIRP + CAIN R,UDWPH ;ALSO RET BYTE PNTR IN TT + JRST QFNT3 ;NULL + JUMPN R,QFNT8 ;NOT OFF END OF FILE + SOS QDIRP(A) + POPJ P, + +QFNT8: TRNE R,40 + JRST QFNT4 + CAILE R,UDTKMX + JRST QFNT6 ;SKIP AND TAKE + MOVEM R,QSBI(A) +QFNT2: SOS QSBI(A) + AOS QSLGL(A) +QFNT5: MOVEI J,2000 ;ACTIVE BYTES IN BLOCK + IMULI J,@QSBYTE(A) + ADD J,QFBLNO(A) + JRST POPJ1 + +QFNT7: MOVSI T,%QALBK ;SET UP PROC LAST BLOCK FLG AND RETN + ANDCAM T,QSRAC(A) ;CLEAR LAST BLOCK OF FILE BIT + SKIPE QSBI(A) + JRST QFNT7A ;NOT LAST BLOCK + ILDB R,TT ;GET NEXT CHR IN DIR + JUMPN R,QFNT7A + IORM T,QSRAC(A) ;PROCESSING LAST BLOCK +QFNT7A: AOS QSBI(A) ;FAKE OUT PI ROUTINE WHICH WILL TRY TO INCREMENT + SOS QSLGL(A) + JRST POPJ1 + +QFNT4: MOVEI J,0 ;LOAD ADR + DPB R,[140400,,J] + PUSHJ P,QMPDCH + DPB R,[060600,,J] + PUSHJ P,QMPDCH + DPB R,[0600,,J] + MOVEM J,QSLGL(A) + JRST QFNT5 + +QFNT6: MOVEI J,1-UDTKMX(R) + ADDM J,QSLGL(A) + JRST QFNT5 + EBLK + +SUBTTL DISK CHANNEL DATA AREAS + +QBFP: BLOCK NQCHN ;BUFFER LIST LH LAST RH FIRST + ;READ: PI IN MP OUT. WRITE: MP IN PI OUT. +SINLST: BLOCK NQS ;SWAP-IN LISTS FOR EACH DISK +SOUTLS: BLOCK NQS ;SWAP-OUT LISTS FOR EACH DISK + +;READ/WRITE LISTS LINK THROUGH MLO IN MEMBLT. +;LH(MEMPNT) HAS DISK ADDR, RH(MEMPNT) HAS # BYTES IN BLOCK IF FILE READ +;MWC IN MEMBLT HAS WORD COUNT IF WRITE (FOR EXTRA-WORDS) + +QFCHN: NQCHN ;NUMBER OF FREE QSK CHNLS (NOT COUNTING DIR WRITE AND SWAP CHANNELS) + +QUSR: REPEAT NQCHN,-1 ;USER +DWUSR: -1 ;0 IF DIR WRITE ACTIVE +SWUSR: REPEAT NQS,-1 ;0 IF SWAP XFER ACTIVE +QDIRP: BLOCK NQCHN ;CHAR ADR PNTR TO DESC AREA FOR FILE +QSLBLK: BLOCK NQCHN+NQS+1 ;LAST BLOCK NUMBER OF FILE WRITTEN +QSLGL: BLOCK NQCHN ;LAST QSGL +QSGL: REPEAT NQCHN+NQS+1,-1 ;-1 IDLE + ACTIVE TRACK + ;LAST NQS+1 FOR FD WRITE AND SWAPPING +QSBI: BLOCK NQCHN ; COUNT CONSECUTIVE BLOCKS +QSBFS: BLOCK NQCHN ;NUMBER OF BUFFS THIS CHNL +1 IF EOF AT PI WITH QSBFS=0 +QPCLSR: BLOCK NQCHN ;PCLSR STATUS OF MAIN PROGRAM - LOAD SYSTEM CALL +QSMDN: BLOCK NQCHN ;MAIN PRGM ACTIVE BUFFER NUM +OLDRDT: BLOCK NQCHN ;STORAGE FOR PREVIOUS REFERENCE DATE +QSRAC: BLOCK NQCHN+1 + REPEAT NQS, %QMSWP ;SWAPPING CHANNELS START OUT IN SWAP MODE + %QA==525252(1) + %QALOK==400000 ;4.9 CHNL LOCKED (NOT USED) + %QAEFR==200000 ;4.8 EOF REACHED READ + %QAEFW==100000 ;4.7 EOF WRITE + %QACTH==40000 ;4.6 DONT RELOAD. CORE JOB HUNG ON ACTIVE BUFFER + %QAFUL==20000 ;4.5 GC DIR BEFORE COMMITTING ANOTHER BLOCK TO FILE + %QADEL==10000 ;4.4 DELETE WHEN CLOSED + %QAACC==4000 ;4.3 FILE ADDRESS ALTERED BY .ACCESS OR OTHERWISE + %QAPAR==2000 ;4.2 NON RECOV PARITY ERR (OR OTHER DISK ERR) AT PI + %QAOUT==1000 ;4.1 ASSOC USER OUT DONT RELOAD (NOT IMPLEM.) + %QALBK==400 ;3.9 READ CHNL PROCESSING LAST BLOCK FLAG + %QAMPU==200 ;3.8 UPDATE QSMPRP, QSMPRC ON NEXT BUFFER GOBBLE + %QAWOV==100 ;3.7 FILLING OUT LAST BLK OF FILE IN WRITE OVER MODE PAST ORIG EOF + %QALNK==40 ;3.6 FILE IS REALLY A LINK + %QALOP==20 ;3.5 LINKS WERE TRACED IN OPENING THIS FILE. + %QARWT==10 ;3.4 MAKE WOULD-BE READERS WAIT (RATHER THAN GETTING FILE LOCKED ERROR) + %QAFNY==4 ;3.3 "FUNNY BLOCK", WORD COUNT IN LAST WORD + ; 8/20/90 No longer ever gets set. + $QAMOD==220200 ;3.2-3.1 READ/WRITE MODE 0 NORMAL 1 WRITE OVER 2 COPY OVER WRITE + %QAMWO==1 ;3.1=1 => WRITE-OVER MODE. + %QM==777777 ;RH CHANNEL MODE. INDEX INTO ACTION TABLES USED AT PI LEVEL. +.SEE %QMIDL ;FOR TABLE OF CHANNEL MODES + +QDSKN: BLOCK NQCHN ;DISK UNIT NUMBER +DWSKN: 0 ;DISK WRITING DIR ON +SWSKN: REPEAT NQS,.RPCNT ;DISK SWAP XFER +QSCRW: BLOCK NQCHN ;0 READ -1 WRITE + -1 ;D.W. + BLOCK NQS ;SWAP +QSCABN: BLOCK NQCHN ;ACTIVE BUFFER NUMBER PI LEVEL OR -1 IF NONE +DWABN: -1 ;DISK D.W. A.B.N +SWABN: REPEAT NQS,-1 ;SWAP ABN +QUDPR: BLOCK NQCHN ;NUMBER OF ASSOCIATED USER DIR PNTR +QUDFPR: BLOCK NQCHN ;RELATIVE PNTR TO FILE AREA, ZERO IF NO PARTICULAR FILE +QMPTN: BLOCK NQCHN ;HAS LAST TRACK STORED IN DIRECTORY +QMPTC: BLOCK NQCHN ;MAIN PRGM TRACK COUNT +QMTTR: BLOCK NQCHN ;TRACK RESERVED OR -1 +QMFTP: BLOCK NQCHN+1 ;TRACK NUMBER FOR SCAN FOR FREE TRACKS IN TUT ON WRITE + REPEAT NQS,NUDSL; DITTO FOR SWAP CHANNELS +QERRS: BLOCK NQCHN+NQS+1 ;NUMBER ERRORS TRYING LAST OP +QSMPRP: BLOCK NQCHN ;MAIN PRGM BYTE POINTER +QSMPRC: BLOCK NQCHN ;M.P. COUNT (BYTES LEFT IN BUFFER) +QSBYTE: BLOCK NQCHN ;LH BYTE PNTR (P=44), RH BYTES PER WORD +QSBSIZ==300600,,QSBYTE ;BYTE POINTER TO CHANNEL BYTE SIZE +QFBLNO: BLOCK NQCHN ;BYTE # IN FILE OF BEG OF BLOCK BEING PROCESSED AT M.P. LEVEL +QRADAD: BLOCK NQCHN ;DESIRED BYTE ADR (LOOKED AT IF %QAACC OR %QAMPU IN QSRAC SET) +QPIBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN BLOCK ACTIVE AT P.I. LEVEL (READ) + ;BIT 4.9 => GET FROM LAST WORD IN BLOCK (%QAFNY) + ; 8/20/90 %QAFNY can no longer happen. +QMPBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN MN PROG ACTIVE BUFFER +QLDPTR: BLOCK NQCHN .SEE NLDSBQ ;DURING SBLK LOADING, HOLDS THE AOBJN POINTER + ;INTO USER CORE FOR DOING A DISK TRANSFER ON. +QSMMP: BLOCK NQS ;MMP ADDRESS OF BLOCK ACTIVE ON SWAPPING CHANNEL + +;VARIABLES FOR CURRENT TRANSFER + +QSDU: -1 ;UNIT TRANSFERING DATA, -1 IF NONE. +QSDCH: -1 ;CHNL READY TO BE TRANSFERED ON QSDU +QERS1: -1 ;ERR VERIFY SWITCH -1 NO ERR 0 EXPECTING COMPLETION OF VERIFY OP +QDWIP: 0 ;NUMBER OF DIR WRITE IN PROGRESS 4.9=1=>MASTER + +IFN T300P,[ +QSDU1: -1 ;QSDU FOR OTHER CONTROLLER +QSDCH1: -1 ;ASSOCIATED CHANNEL +QTUNT1: -1 ;UNIT TO TRANSFER NEXT +QTCHN1: -1 ;CHANNEL TO TRANSFER NEXT +NRXFR1: 0 ;METERS +NWXFR1: 0 +NSRXF1: 0 +NSWXF1: 0 +LQTM1: 0 ;TIME LAST TRANSFER STARTED +];T300P + +;MASTER FILE DIRECTORY + +QMDRO: -1 ;ORIGIN OF MASTER DIR 4.9 IF LOCKED + ;-2 ON WAY IN + ;4.6 NOT IN + ;4.5, 4.4, 4.3, ... CHANGED + NOT WRITTEN UNIT 0, 1, 2, ... + ;3.2=1 NOT RECONCILED (NQFUS NOT SET UP) + ;3.1-3.5 MUST BE ZERO (AT LEAST AFTER ITS RECONCILED) +QAMDNO: -1 ;ASCENDING MASTER DIRECTORY NUMBER, -1 NOT SET UP +NQFUS: 0 ;NUMBER OF FREE LOSER SLOTS IN MFD + +;TRACK UTILIZATION TABLES + +QTUTO: REPEAT NQS,-1 ;ADDRESS OF TUT. LH SIMILAR TO QMDRO + ;4.9 LOCK + ;4.8 READ-IN NOT STARTED YET + ;4.6 NOT READ IN YET + ;CHANGED AND NOT WRITTEN ON UNIT + ;0 = 4.5 1 = 4.4 2 = 4.3 3 = 4.2 4 = 4.1 + ;5 = 3.9 6 = 3.8 + ;3.1-3.5 MUST BE ZERO +QDPWF: BLOCK NQS ;-1 TUT NOT RECONCILED (CALL QTCH1) +QTWRTM: BLOCK NQS ;TIME TUT LAST WRITTEN +QSFT: REPEAT NQS,-1 ;NUMBER TRACKS FREE IN USER AREA +QSFTS: BLOCK NQS ;NUMBER TRACKS FREE IN SWAPPING AREA +QPKNM: BLOCK NQS ;NAME OF PACK +QPKID: REPEAT NQS,-1 ;PACK ID OF DISK ON DRIVE +IFN QRSRVP,[ +QRESRV: REPEAT NQS,-1 ;NON-ZERO => PACK ON THIS DRIVE RESERVED. SET FROM TUT. + ;NOT 0 AND NOT -1 => SIXBIT DEVICE NAME FOR "SECONDARY" PACK +];QRSRVP +NTBL: ;NUMBER OF BLOCKS IN TUT ON THIS DRIVE +IFE T300P, REPEAT NQS, NTUTBL +IFN T300P,[ + REPEAT T300P, NTUTBL + REPEAT NQS-T300P, NTUTB1 +];T300P + +;POSITIONER VARIABLES (INDEXED BY PHYSICAL DRIVE) + +QSKT1: REPEAT NQS,-1 ;CHANNEL POSITIONER SET FOR OR -1 IF NONE +QRCAL: REPEAT NQS,0 ;-1 IF RECALIBRATING +QSPPS: REPEAT NQS,-1 ;INTENDED POSITIONER POSITION (NOT USED???) +QSEEK: BLOCK NQS ;-1 IF SEEKING +QPOS: REPEAT NQS,-1 ;CURRENT CYLINDER +QPOSGL: BLOCK NQS ;CYLINDER TRYING TO POSITION TO +IFN DC10P,[ +QRCTIM: BLOCK NQS ;RECALIBRATE TIMEOUT IN HALF SECONDS. THE ATTNS +];DC10P ; TEND TO GET LOST FOR SOME REASON + +;MISCELLANEOUS DISK VARIABLES + +QACT: REPEAT NQS,0 ;ONLY USE UNITS WITH 0 +QACTB: 0 ;4.5 UNIT 0 ACT 4.4 1 ACT 4.3 2 4.2 3 4.1 4 + ;3.9 5 3.8 6 +QWBUFS: 0 ;TOTAL NUMBER OF WRITE BUFFERS ACTIVE + +QWBFMX: 10.*DC10P+15.*RP10P+30.*RH10P+20.*RH11P ;MAX # ALLOWED. SHOULD BE + ; ABOUT 1 SEC DISK XFER. +QHUNGF: 0 ;-1 => DISK CONTROL HUNG, PI LEVEL SHOULD RESET, RECALIBRATE, RETRY +NTQHNG: BLOCK NQS ;NUMBER OF TIMES TRANSFER HUNG ON THIS UNIT + +QTUNT: 0 ;UNIT TO TRANSFER ON NEXT +QTCHN: 0 ;CHNL .. +QLCHN: 0 .SEE QINT2C +QWRU: -1 ;DEFAULT WRITE UNIT (-1 if there isn't a default unit yet) +MDSK: 0 ;DRIVE # OF MASTER DISK +QACTTM: -1 ;SETOM ON READ OR WRITE DATA TRANSFER + ;AOS AT SSLCK IF + OK TO WRITE DIRS + ;IE DON'T TIE UP DISK TO WRITE DIR UNLESS THINGS ARE QUIET +QDWFAR: -10. .SEE QINT3 ;WRITE DIRS SOME OF THE TIME ANYWAY +LQTM: 0 ;TIME AT WHICH LAST COMMAND GIVEN TO DISK +QFTTHR: 600. ;IF FREE TRKS ON QWRU GOES BELOW THIS, SWITCH TO UNIT WITH MOST FREE TRACKS +QRDAHD: IFE MCOND DM,[0] .ELSE 2 ;NUMBER OF BLOCKS TO READ AHEAD + +LASTGC: 0 ;NAME OF LAST DIRECTORY TO GET GC'ED + +;USER DIRECTORIES + +QNUD==40. ;NUMBER USER DIRECTORIES + +QFUD: QNUD ;NUMBER OF FREE UFD SLOTS + +QSNUD: BLOCK QNUD ;USER NAME OR 0 IF FREE +QSNLCN: BLOCK QNUD ;4.9 LOCKED, 4.8 ALSO NOT IN CORE RH CORE ADR + .SEE DCHBT ;4.6 =1 NOT PAWED OVER 4.5 CHNGD AND NOT WRITTEN ON UNIT 0 + ;4.4 UNIT 1 4.3 UNIT 2 4.2 UNIT 3 4.1 UNIT 4 + ;3.9 UNIT 5 3.8 UNIT 6 3.7 UNIT 7 + %QUDWM==40 ;3.6 WRITE IMMEDIATELY ON MASTER DISK + ;@ + XR BITS MUST = 0 + +QSNNR: BLOCK QNUD ;NUMBER PC'S LOOKING AT THIS IE + ;+1 FOR FILE OPEN AND USER IN CORE(?) +QSNMI: BLOCK QNUD ;TRACK N OF USER DIR IF NOT NEWLY CREATED +QSFBT: BLOCK QNUD ;FREED-BLOCKS-TABLE. HEAD OF A LIST OF PAGES, + ;THREADED THROUGH THE SECOND WORD AND ENDING WITH + ;ZERO. FIRST WORD IS AOBJN POINTER TO FREE PART + ;OF PAGE. FROM THIRD WORD UP TO BELOW WHERE AOBJN + ;POINTS ARE WORDS UNIT,,BLOCK WHICH RECORD DISK + ;BLOCKS TO BE FREED ONCE THE DIR HAS BEEN WRITTEN + ;OUT TO THE MASTER DISK. ELIMINATES REUSED ADDRESS + ;PROBLEMS BY GUARANTEEING THAT IF THE SYSTEM SHOULD + ;CRASH AT ANY TIME, THERE CANNOT BE TWO DIRECTORIES + ;ON DISK THAT BOTH POINT TO THE SAME BLOCK. + +IFN QRSRVP,[ +QSALLO: BLOCK QNUD ;-1 OR DRIVE # DIRECTORY ALLOCATED TO +] + +;LOCKS + +UDRSW: -1 ;USER DIR AREA LOCKED + 0 +QCHSW: -1 ;CHNL AREA LOCKED + 0 +QSKOSW: -1 ;QSKO1 LOCKED (USER DIR READIN) + 0 + +;LIST OF PAGES CONTAINING BLOCKS WHICH CAN NOW BE FREED. MOVED TO +;HERE FROM QSFBT WHEN THE DIR IS WRITTEN OUT. THE ACTUAL FREEING +;IS DONE BY THE CORE JOB. + +QFBTS: 0 + +;VARIABLES FOR SYSTEMS CONCEPTS DISK CONTROL + +IFN DC10P,[ +QRCSW: 105 ;- NO READ COMPARE 0 COMPARE WRITES + COMPARE ALL +QCST: 0 ;CONI DC0, AT QINT +QERST: 0 ;HAS CONI DC1, BITS WHEN AN ERROR HAPPENS +PKIDM: 0 ;-1 WAITING FOR PACK ID TO BE READ +RPKID: -1 ;PACK ID READ INTO HERE BY DISK CONTROL +QDRSTS: 0 ;DRIVE STATUS WORD STORED BY DISK CONTROL +] +IFE DMDSK,[ + 0 ;FOR BLT INTO QXWDS +QXWDS: BLOCK NXWDS +] +IFN DC10P,[ +QCHPRG: 0 +QCHPR2: DCOPY (-2000_2&37774) + DCOPY (-NXWDS_2&37774)QXWDS +QCHPR4: DHLT ;OR DRC +QCHPR3: DCCOMP (-2000_2&37774) + DCCOMP (-NXWDS_2&37774)QXWDS + DHLT + +GPKID: DSPC+DSCRHD+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +QRECAL: DSPC+DSRCAL+DUNENB +] + +;VARIABLES FOR DEC RP10 DISK CONTROL + +IFN RP10P,[ +QERST: 0 ;CONI DPC, ON ERROR +QERDTI: 0 ;DATAI DPC, ON ERROR +QCST: 0 ;CONI DPC, AT QINT +QCHPRG: 0 ;SEEK COMM +IFN KA10P, QIOWD: -2000,, ;XFER DATA (HRRM ADR-1 IN RH) +IFE DMDSK,[ + -NXWDS,,QXWDS-1 + -200+NXWDS,,0 +];DMDSK + 0 + +QRECAL: 700000,, +QGTBZY: 0 ;FLAG FOR SOFTWARE AT INT +];RP10P +IFN QRDCMP,[ +QRCSW: 0 ;NON-ZERO TO ENABLE READ-COMPARING +RDCPHS: 0 ;0 NORMAL, -1 DOING OPERATION WHICH SHOULD BE READ-COMPARED + ; AFTERWARD, + DOING READ-COMPARE +IFN KA10P,[ +RCIOWD: BLOCK 2 ;CHANNEL PROGRAM FOR READ INTO QRCBUF +];KA10P ;ON KL WE HAVE TO PUT IT IN THE EPT! +QRCBUF: BLOCK 2000 +];QRDCMP + +;VARIABLES FOR DEC RH10 DISK CONTROL + +IFN RH10P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +NCSHI: 0 ;NUMBER OF CACHE INVALIDATES +NCSHIL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE INVALIDATES +NCSHU: 0 ;NUMBER OF CACHE UNLOADS +NCSHUL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE UNLOADS +QERST: 0 ;CONI AT LAST ERROR (LEAVE THIS THROUGH QECPAT IN SAME ORDER) + 0 ;DATAI AT LAST ERROR +QERSTS: 0 ;%HRSTS AT LAST ERROR +QERER1: 0 ;%HRER1 AT LAST ERROR +QERER2: 0 ;%HRER2 AT LAST ERROR +QERER3: 0 ;%HRER3 AT LAST ERROR (IBM WOULD CALL THIS A CHANNEL LOGOUT AREA) +QERDCL: 0 ;%HRDCL AT LAST ERROR +QECPOS: 0 ;%HRPOS AT LAST ERROR +QECPAT: 0 ;%HRPAT AT LAST ERROR +QCST: 0 ;CONI AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR +RHDATO: -1 ;LAST DATAO DSK, FOR DEBUGGING +ECCPAG: BLOCK 8 ;TEMP FOR SAVING PAGE MAP VARS AT QECC (WITH SPM) +NQDRE: BLOCK NQS ;# MASSBUS TIMEOUTS PER DRIVE. +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +] + +;VARIABLES FOR DEC RH11 DISK CONTROL (ON THE KS10 UNIBUS) + +IFN RH11P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +QIOWD: 0 ; BA,,WC for RH11 +QCST: 0 ;CS1 AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT + +QERST:: ;Gubbish saved at last error +QERCS1: 0 ; CS1 Control & Status 1 +QERCS2: 0 ; CS2 Control & Status 2 +QERSTS: 0 ; STS Drive status +QERBA: 0 ; BA Unibus address for transfer +QERWC: 0 ; WC Word count for transfer +QERER1: 0 ; ER1 Error 1 +QERER2: 0 ; ER2 Error 2 +QERER3: 0 ; ER3 Error 3 +QERPOS:: +QECPOS: 0 ; POS ECC position +QERPAT:: +QECPAT: 0 ; PAT ECC pattern +QERMAP: 0 ? 0 ; Unibus map to disk buffer + +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR + +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +NQOFFL: BLOCK NQS ;# TIMES DISK WENT OFFLINE +] + +DIRHNG: 0 ;LH POINTS TO LIST OF DIRHNG DEVICE CHANNELS, + ;CHAINED THROUGH LH'S OF IOCHNM WORDS. + ;0 MEANS END OF LIST + ;MODIFY ONLY WITH THE CLOCK OFF. + ;EACH DIRHNG DEVICE CHANNEL'S IOCHST WORD RH CONTAINS THE + ;TRACK NUMBER OF THE DIRECTORY IT IS LOOKING AT. + +BBLK + +;DISK CONSTANTS + +IFN RP10P,[ +QATTNS: REPEAT NQS,500000+.RPCNT_14,,1_<10-.RPCNT> +;WORDS TO CLEAR ATTNS AND SELECT DRIVES +] + +SWAPL: SINLST(Q) + SOUTLS(Q) + +DCHBT: 20000,, ;BIT SET IF DIR NOT WRITTEN OUT ON UNIT + 10000,, + 4000,, + 2000,, + 1000,, + 400,, + 200,, + 100,, +IFL .-DCHBT-NQS,.ERR YOU BETTER FIND ANOTHER BIT FOR QACTB,QSNLCN,QTUTO + +IFN DC10P,[ +QTRAN: 0 ;FORMERLY MAPPED 203 CYL VIRTUAL DRIVES TO 406 CYL CALCOMPS + 1 ;4.9 => 2ND HALF OF PHYSICAL DRIVE + 2 ;(DOESN'T DO ANYTHING NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NQS, .ERR BARF AT QTRAN +] + +SUBTTL DISK CLOSE ROUTINES + +QICL: PUSH P,R + SKIPGE QUSR(A) + BUG + MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) ;FLUSH RANDOM ACCESS HACKERY + PUSHJ P,QICLW1 ;WAIT FOR INPUT TO STOP + MOVE TT,QSRAC(D) + TLNE TT,%QADEL ;DELETE? + JRST QSICLD ;YES + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) + AOS QFCHN +QICLX: SOSGE QSNNR(H) ;FREE DIRECTORY CHANNEL HAD BEEN USING + BUG + POP P,R + SETZM (R) + POPJ P, + +QICLW1: MOVE D,A ;IDLE CHANNEL AND FLUSH READ BUFFERS + CONO PI,UTCOFF + SKIPGE QSGL(D) + JRST QSICL3 + SKIPL QSCABN(D) + JRST QSICL4 + SETOM QSGL(D) + +QSICL3: HLLZS QSRAC(D) .SEE %QMIDL ;STOP PI + CONO PI,UTCON +QSICL5: PUSHJ P,QSBRB1 ;RETURN M.P. BUFFER IF ANY +QOCL7: HRRZ A,QBFP(D) ;ALSO ENTER TO RETURN UNUSED READ BUFFER ON WRITE OVER MODE +QSICL2: JUMPE A,QSICL6 + LDB C,[MLO,,MEMBLT(A)] + PUSHJ P,MEMR + MOVE A,C + SOS QSBFS(D) + JRST QSICL2 + +QSICL6: SETZM QBFP(D) + POPJ P, + +QSICL4: MOVEI A,%QMRD1 ;STOP PI AFTER THIS BLOCK + HRRM A,QSRAC(D) + CONO PI,UTCON + SKIPL QSGL(D) ;WAIT FOR CHANNEL TO DEACTIVATE + PUSHJ P,UFLS + JRST QSICL5 + +;OUTPUT CLOSE +QOCL: PUSHJ P,QSOCL5 ;CLEAN UP THE DISK CHANNEL +QSOCL4: MOVE D,A ;ENTRY FROM QALINK +QSOCL6: MOVE Q,QUDFPR(D) + MOVE H,QUDPR(D) + ADD Q,QSNLCN(H) + MOVE TT,QSRAC(D) + TLNE TT,%QADEL + JRST QCDLWO ;DELETED (PRESUMABLY VIA DELEWO) + MOVE A,UNFN1(Q) ;Get names of file being hacked. + MOVE B,UNFN2(Q) + PUSHJ P,QLOOK ;FILING OVER ANYTHING? + JRST QSOCL3 + HRRZ I,QSNLCN(H) + ADD I,QUDFPR(D) + CAMN I,Q ;BEING WRITTEN BITS WENT AWAY? + BUG ;TRYING TO DELETE THE FILE WE'RE WRITING + PUSHJ P,QSOCLD ;YES FLUSH IT + PUSHJ P,QUDLK ;RELOCK DIR UNLOCKED BY QSOCLD ETC + JRST QSOCL6 ;MAKE SURE ONE HASN'T REAPPEARED WHILE DIR UNLOCKED + +QSOCL5: LDB H,[$QAMOD,,QSRAC(A)] + JUMPN H,QOCL6 ;DONT HACK ACTIVE WD COUNT IN WRITEOVER MODE +QOCL6A: MOVN D,QSMPRC(A) ;- NUMBER OF BYTES IN BLOCK NOT USED + ADDB D,QMPBSZ(A) ;ADJUST BYTE COUNT OF LAST BLOCK TO REFLECT WHATS USED + CLEARM QSMPRC(A) ;SO WILL BE A NOOP IF PCLSR OUT AND COME BACK THRU HERE +QOCL4: MOVSI Q,%QAEFW + IORM Q,QSRAC(A) ;SET EOF BIT FOR QSBWW AND QUDS + JUMPN H,QOCL5 + SKIPL QSMDN(A) ;NO M.P. BUFFER ANYWAY + JUMPE D,QOCL1 ;ABOUT TO WRITE NULL BLOCK, DON'T +QOCL5: PUSHJ P,QSBWW +QOCL2: MOVE T,A + PUSHJ P,[ SKIPGE QSCRW(T) ;WAIT FOR CHANNEL EITHER LEAVING WRITE MODE + SKIPN QSBFS(T) ;OR WRITING OUT ALL ITS BUFFERS, I.E. PI LEVEL + JRST POPJ1 ;ISN'T GOING TO DO ANYTHING MORE TO IT. + POPJ P, ] + PUSHJ P,UFLS + SKIPE QBFP(A) ;MAKE SURE IF QSBFS NON-ZERO THAT IS ONLY EOF + BUG ;NOT A BUFFER SITTING AROUND FORGOTTEN +QOCL3: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SKIPN D,QMPTC(A) ;SKIP ON NEXT "N" STILL PENDING + POPJ P, + PUSHJ P,QUDS ;STORE IT AWAY + CLEARM QMPTC(A) + POPJ P, + +QOCL6: SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO IDLE OR HANG UP IN READ + PUSHJ P,UFLS + SKIPL QSGL(A) + PUSHJ P,UFLS + MOVE D,A + PUSHJ P,QOCL7 + MOVE A,D + MOVE Q,QSRAC(A) + MOVE B,QSBFS(A) + JUMPE B,QOCL6B + TLNE Q,%QAEFW + JRST QOCL6B + TLNE Q,%QAEFR + SOS B,QSBFS(A) ;COMPENSATE FOR EXTRA AOS ON EOF READ +QOCL6B: CAILE B,1 + BUG + TLNE Q,%QAWOV + JRST QOCL6A ;HACKING LAST BLOCK PAST EOF, UPDATE ACTIVE WD COUNT + JRST QOCL4 + +QOCL1: PUSHJ P,QSBRB ;DISCARD BUFFER + SOS QSBFS(A) + SOS QWBUFS + MOVE D,QDSKN(A) + AOS QSFT(D) ;RESTORE TRACK + JRST QOCL2 + +QSOCL3: MOVE Q,QUDFPR(D) + MOVE TT,QSNLCN(H) + ADDI Q,(TT) + MOVSI T,UNWRIT + ANDCAM T,UNRNDM(Q) ;CLEAR WRITE IN PROG + MOVE TT,QSNLCN(H) + MOVE T,UDNAMP(TT) ;MAKE SURE IT GOES BEFORE * FILE OF SAME NAME + ADDI T,(TT) + CAMN T,Q + JRST QSOC3E ;NO PREV FILE + MOVE J,Q +QSOC3A: SUBI J,LUNBLK + CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QSOC3B ;PREV FILE HAS DIFFERENT NAME + CAILE J,(T) + JRST QSOC3A +QSOC3C: CAMN J,Q + JRST QSOC3E +REPEAT LUNBLK, PUSH P,.RPCNT(J) + MOVE T,J + HRL T,Q + BLT T,LUNBLK-1(J) +REPEAT LUNBLK, POP P,LUNBLK-.RPCNT-1(Q) + SUB Q,J + SUBI J,(TT) + MOVSI T,-NQCHN +QSOC3D: HRRZ A,QUDPR(T) + SKIPL QUSR(T) + CAIE A,(H) + JRST QSOC3F + HRRZ A,QUDFPR(T) + CAIN A,(J) + ADD A,Q + MOVEM A,QUDFPR(T) +QSOC3F: AOBJN T,QSOC3D +QSOC3E: SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + MOVE C,QSNUD(H) +IFN TPLP+UNSPLP,[ + MOVEI TT,SCRTPC + CAMN C,[SIXBIT /.LPTR./] + IORM TT,SUPCOR ;CLOSING FILE ON TPL DEVICE SO SET FLAG FOR SYS JOB +];TPLP + CAMN C,[SIXBIT/.MAIL./] + AOS NQMFWR ;CLOSING FILE ON .MAIL. => BUMP COUNT TO WAKE MAILER DEMON +IFN XGP,[ + CAMN C,[SIXBIT/.XGPR./] + AOS NXGPFW ;WAKE XGPSPL +];XGP + MOVE A,QSNMI(H) ;TELL DIRHNG DEVICE ABOUT IT + PUSHJ P,DIRSIG + MOVE TT,QACTB ;DIR CHANGED (AT LEAST WRITE-IN-PROG BIT TURNED OFF) + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + SOSGE QSNNR(H) + BUG + PUSHJ P,QSTRTR + SETZM (R) ;CLEAR IOCHNM WORD. + POPJ P, + +QSOC3B: ADDI J,LUNBLK + JRST QSOC3C + +QOCLR: MOVE Q,QSRAC(A) ;CLOSE UNIT ASCII OUTPUT + TLNN Q,%QAWOV + TLNN Q,%QAMWO+%QALNK + PUSHJ P,QOCLPD ;PUT NEEDED PADDING UNLESS NOT A FILE OR NOT AT END + JRST QOCL + +QOCLPD: LDB Q,[360600,,QSMPRP(A)] ;NUMBER OF BITS NOT WRITTEN IN LAST WORD + CAIL Q,44 + POPJ P, ;LAST WORD NOT WRITTEN AT ALL + LSH Q,18.+6 ;FILL THOSE BITS WITH ^CS + HRR Q,QSMPRP(A) + MOVE C,[EOFWRD] + SKIPLE QSMPRC(A) ;INHIBIT STORE IF NO BUFFER ETC. + DPB C,Q + POPJ P, + +SUBTTL DISK INTERRUPT ROUTINES + +OVHMTR QIN ;DISK INTERRUPT LOW-LEVEL + +IFN RP10P,[ + +QINT: AOS QGTBZY + MOVEM TT,QCST +IFN DMDSK,[ + TRNN TT,200000 ;END OF CYLINDER + JRST QINT0 + SKIPGE C,QSDCH + BUG + MOVE D,QSGL(C) + IDIVI D,NBLKSC ;IS IT LEGITIMATE? + SKIPL QSDU ;IF NO TRANSFER IN PROGRESS, IGNORE + CAIN E,NBLKSC-1 ;IS LEGITIMATE FOR LAST BLOCK IN CYLINDER + CAIA ;IGNORE + BUG PAUSE,[MAYBE DISK CONTROL IS WRITING ALL OVER THE DISK AGAIN] +QINT0: ];DMDSK + TDNE TT,[17177700] ;ANY ERRORS? + JRST QINTE +QINTN2: DATAI DPC,R + SKIPGE QSDU ;DONT CLOB CMD BUF TO CLR ATTS DURING DATA XFER + TRNN R,776 ;ANY ATTNS + JRST QINTA ;NO + LDB I,[11000,,R] ;YES,FIND WHICH DRIVE + JFFO I,.+1 ;CLOBBERS Q + SUBI Q,28. + +QINTAT: DATAO DPC,QATTNS(Q) ;CLEAR ATTNS + DATAI DPC,E + TLNN E,40 + JRST QRECAT ;NOT ON CYLINDER, RECALIBRATE + LDB A,[DCYLI E] + TRNE E,.BM DCYLXI + ADDI A,400 + CAME A,QPOSGL(Q) + JRST QRECAT ;SEEK TO THE WRONG PLACE (CALCOMPS LIKE TO DO THIS) + MOVEM A,QPOS(Q) ;REMEMBER WHERE IT IS AT + SETZM QSEEK(Q) + SETZM QRCAL(Q) + JRST QINT ;TRY AGAIN + +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION - FIND NEW TRANSFER + CONSO DPC,400000 + CONSO DPC,10 + JRST DSKEX ;TRANSFER STILL IN PROGRESS, DISMISS + CONSZ DPC,20 + JRST .-1 ;BUSY? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: DATAI DPC,R + CONI DPC,TT ;THIS LOOKS REDUNDANT BUT APPARENTLY IS NECESSARY + ;DUE TO TIMING OF THE DISK-NOT-READY CONDITION + CONO DPC,175700+DSKCHN ;RESET CONDITIONS + MOVEM TT,QERST + MOVEM R,QERDTI + CONSZ DPC,20 ;WAIT FOR UNBUSY + JRST .-1 + MOVE Q,QSDU ;FOR QOVR + MOVE E,QCHPRG + TRNE TT,20000 ;OVERRUN + JRST QOVR + TRNE TT,2000 ;NOT READY + JRST QNRDY + TDNE TT,[12010700] ;BITS 14,16,23,27-29 ARE LOSERS + BUG HALT,[DSK: TOTALLY FATAL ERROR, CONI=],OCT,QERST + TLNE TT,5 ;WD OR SECTOR PARITY ERROR + JRST QDE + TRNE TT,1000 ;WRITE LOCKED + JRST QIRWRE + TRNE TT,40000 ;SEARCH FAILED + JRST QHE + TRNN TT,100000 ;POWER FAILURE + JRST QINTE1 + CONSZ DPC,100000 ;TRY IT AGAIN + JRST 4,.-1 + JRST QHE + +QINTE1: TLNE R,10 ;FILE UNSAFE--NEED OPERATOR INTERVENTION + BUG PAUSE,[DSK: FILE UNSAFE UNIT ],DEC,Q + TLNE R,4 + BUG ;NO SUCH DRIVE + TLNE R,110 ;POSITION FAILURE (OR PROCEEDED FILE UNSAFE) + JRST QHE + AOS NQSE(Q) ;SPURIOUS ERROR + JRST QINTX ;IGNORE + +QIRWRE: BUG PAUSE,[DSK: WRITE LOCKED UNIT ],DEC,Q + JRST QHE + +QNRDY: LDB Q,[410300,,R] ;WHICH DPC + SKIPN QSEEK(Q) + SKIPGE QRCAL(Q) ;NOT SEEKING OR RECALIBRATING IS ERROR + JRST QINTN2 + BUG PAUSE,[DSK: UNIT ],DEC,Q,[NOT READY] + JRST QREC +] ;END IFN RP10P + +IFN DC10P,[ + +QINT: MOVEM TT,QCST + SKIPL PKIDM ;GETS SPURIOUS DIPE WHEN READING PACK ID + CONSO DC1,7777 ;RUMOR THAT DSSERR DOESN'T ALWAYS SET + TRNE TT,DSSERR + JRST QINTE + TRNE TT,DSSATT + JRST QINTAT +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION, FIND NEW TRANSFER + CONSZ DC0,DSSRUN+DSSACT + JRST DSKEX ;ACTIVE OR RUN, TRANSFER IN PROGRESS, DISMISS + AOSN PKIDM ;SKIP IF NOT FINISHED READING PACK ID + JRST QSPKID + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + SKIPL QERS1 + JRST QEROK ;OK ON VERIFY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: CONI DC1,TT + CONO DC0,DCCLR+DCERR+DSKCHN ;CLEAR ERRORS + MOVEM TT,QERST + MOVE Q,QSDU + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 ;ACTIVE OR RUN? + SKIPL QERS1 + JRST QERL1 ;VERIFY ALSO LOST + TRNE TT,DOFFL+DPROT+DDOBSY+DNXM+DCPERR + JRST QINTE1 ;REALLY LOST BIG + TRNE TT,DOVRRN + JRST QOVR + TRNE TT,DWTHER+DFUNSF ;SEEK INC, END DISK, WATCHDOG, OR UNSAFE + JRST QHE ;TRY TO RECALIBRATE + SKIPGE PKIDM + TRZ TT,DRLNER ;IGNORE LENGTH ERROR IF READING PACK # + TRNE TT,DIPE+DRLNER+DRCER+DCKSER + JRST QDE ;TRY AGAIN + SKIPGE PKIDM + TRNE TT,-1 + AOS NQSE ;SPURIOUS ERROR (NOT LENGTH ERROR IN PKIDM) + JRST QINTX ;SPURIOUS ERROR + +QINTE1: TRNE TT,DOFFL + BUG PAUSE,[DSK: UNIT ],DEC,Q,[OFFLINE] + TRNE TT,DPROT + BUG PAUSE,[DSK: UNIT ],DEC,Q,[WRITE PROTECTED] + TRNE TT,DDOBSY + BUG PAUSE,[DSK: DATAO WHEN BUSY] + TRNE TT,DNXM+DCPERR + BUG PAUSE,[DSK: MEM PAR OR NXM ERROR] + JRST QOVR + +QINTAT: CONI DC1,Q + CONO DC0,DCCLR+DCCATT+DSKCHN ;CLEAR ATTENTION + LDB Q,[DSATDN Q] ;ATTENTION DRIVE NUMBER + CAIGE Q,NQS + SKIPL QRCAL(Q) + JRST QINTX + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE + JRST QINTX + +;THIS IS CALLED EVERY HALF SECOND +QRCTMO: MOVEI Q,NQS-1 + SKIPL QRCAL(Q) +QRCTM1: SOJGE Q,.-1 + JUMPL Q,CPOPJ + SOSL QRCTIM(Q) + JRST QRCTM1 + BUG INFO,[DSK: RECAL TIMEOUT UNIT],DEC,Q + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE I GUESS + JRST QRCTM1 +];DC10P + +IFN RH11P,[ + +;;; RHCLRC(Q) Clear controller errors and select drive Q +;;; RHSLCT(Q) Select drive Q +;;; RHCMD(A) Command in A to current drive +;;; RHCLRD Clear current drive +;;; RHCHEK Check for immediate bad news +;;; All return CS1 in A + +RHSLCT: IOWRQ Q,%HRCS2 +RHCHEK: IORDQ A,%HRCS1 + TRNE A,%HXTRE+%HXMCP + BUG HALT,[DSK: MASSBUS ERROR, CS1=],OCT,A + POPJ P, + +RHCLRC: IOWRQ Q,%HRCS2 ; Must select drive before clearing controller + MOVEI A,%HXTRE+%HXIE+%HMNOP +RHCMD: TROA A,%HXIE +RHCLRD: MOVEI A,%HXIE+%HMCLR + IOWRQ A,%HRCS1 + JRST RHCHEK + +EBLK +DSKBRK: 0 +BBLK + JSR UTCSAV +QINT: AOS QGTBZY + MOVE Q,QSDU + IORDQ TT,%HRCS1 + MOVEM TT,QCST + TRNE TT,%HXTRE+%HXMCP + JRST QINTE + TRNN TT,%HXSC ; Perhaps some drive needs attention? + JRST QINT0 ; Not unless SC is set! + IORDQ A,%HRATN + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ; Not expecting completion of transfer. + TRNN TT,%HXRDY + JRST DSKEX ; Transfer still in progress. + AOSN QHUNGF + JRST QHE ; Transfer hung, recalibrate and retry. + PUSHJ P,RHSLCT ; Select that drive. + IORDQ A,%HRSTS ; Get its status. + TRNE A,%HSERR ; Just in case %HXTRE didn't get set (by + JRST QINTE ; analogy with RH10)... + JRST QINTA1 ; Transfer complete... + +QINTAT: MOVNI Q,-35.(B) + HRRZS Q + MOVEI A,1 + LSH A,(Q) + IOWRQ A,%HRATN ; Turn off attention bit. + CAIL Q,NQS + JRST QINT0 + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ; Ignore attention in mid-transfer. + JRST QINTA2 ] + SKIPE QACT(Q) + JRST QINTA2 ; Ignore this drive. + PUSHJ P,RHSLCT + IORDQ B,%HRSTS ; Get status of drive with attention. + TRC B,%HSMOL+%HSDPR+%HSRDY + TRNN B,%HSMOL+%HSDPR+%HSRDY+%HSVV + PUSHJ P,QOFFL ; Went offline and came back online + TRNE B,%HSERR+%HSPIP + JRST [ PUSHJ P,RHCLRD ; Drive barfing not during transfer + AOS NQEATN(Q) ; so clear it + JRST .+1] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION +IFDEF %HRCCY,[ ;Current Cyl register only on RP disks + IORDQ A,%HRCCY + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE +];IFDEF %HRCCY +IFNDEF %HRCCY,[ + MOVE A,QPOSGL(Q) ;On RMxx, jump to conclusion + MOVEM A,QPOS(Q) +];IFNDEF %HRCCY + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON + ; THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +; Went offline and came back online +QOFFL: TRC B,%HSMOL+%HSDPR+%HSRDY ;Recover %HRSTS + IORDQ C,%HRER1 + IORDQ D,%HRER2 +IFDEF %HRER3,[ + IORDQ E,%HRER3 + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D,[ER3=],OCT,E +] +IFNDEF %HRER3,[ + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D +] + + AOS NQOFFL(Q) + MOVEI A,%HMCLR ;Clear the drive + PUSHJ P,RHCMD + MOVEI A,%HMRDP ;I said, clear the drive! + PUSHJ P,RHCMD + MOVEI A,0 + IOWRQ A,%HROFS ;No offset, 18 bits, ECC on, HCI off + MOVEI A,%HMACK ;Turn %HSVV back on so drive will work + PUSHJ P,RHCMD + POPJ P, + +QINTE: +IRPS X,,[CS1 CS2 BA WC POS PAT] ; First get status of controller + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + IORDQ A,UBAPAG+QUBPG_1 ; Unibus map counts as part of + MOVEM A,QERMAP ; controller status. + IORDQ A,UBAPAG+QUBPG_1+1 + MOVEM A,QERMAP+1 + SKIPGE Q ; Try hard to guess the drive. + LDB Q,[$HYDSK QERCS2] + PUSHJ P,RHCLRC ; Clear controller errors and select drive + ; so that we can read its status too. + TRNN A,%HXRDY ; Why would controller be busy? (RH10 + BUG ; code checks for this...) + +IRPS X,,[STS ER1 ER2] + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + MOVE A,QERCS1 ; A: CS1 + MOVE R,QERCS2 ; R: CS2 +IFDEF %HRER3,[ ; Disks with ER2 -and- ER3 + IORDQ A,%HRER3 + MOVEM A,QERER3 + SKIPN QERER2 ; Bad news + SKIPE QERER3 + JRST UNSAFE +] +IFNDEF %HRER3,[ ; Disks with just ER2 + SKIPE QERER2 + JRST UNSAFE +] + TRNN A,%HXMCP ; Real bad news + TRNE R,%HYWCE+%HYPE+%HYNED+%HYNEM+%HYPGE+%HYMXF + BUG HALT,[DSK: UNIT #],DEC,Q,[LOSING. CS1=],OCT,A,[ CS2=],OCT,R + TRNE R,%HYDLT+%HYMDP ; Data bus losing? + JRST QINTE1 + MOVE A,QERSTS ; Check Drive Status + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ; Better be all on! + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ; Spurious? + JRST QINT0] + MOVE B,QERER1 ; Check the main error register + TRNE B,#<%H1ECC+%H1DTE+%H1CRC+%H1HCE+%H1ECH+%H1FER+%H1PAR> + JRST UNSAFE ; Those not listed above are considered "hard" + CAIN B,%H1ECC ; Correct correctable error if that is the + JRST QECC ; only problem. + PUSHJ P,QINTER ; Else print message and reset drive + TRNE B,%H1DTE+%H1CRC+%H1HCE+%H1FER ; These require recalibration + JRST QHE + TRNE B,%H1ECC+%H1ECH+%H1PAR ; These require reread + JRST QDE + JRST QOVR ; No error bits set? (How can this + ; happen?) Go and retry... + +;;; Controller error: +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CS1=],OCT,QERCS1,[CS2=],OCT,QERCS2 + JRST QOVR + +;;; Drive error: +IFDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA +] +IFNDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[STARTING DISK ADDR=],OCT,QCHPGA +] + JRST RHCLRD ; Reset error status in drive + +;;; Come here for drive unsafe and similar bad things. May be set to +;;; either halt or attempt retry (via USFHLT variable). Note that when we +;;; get here the state of the drive has not yet been disturbed. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + SKIPL QSDU + JRST QHE ;RECALIBRATE AND RETRY + JRST QREC ;Just recalibrate, no transfer to retry + +QECC: PUSHJ P,RHCLRD ; Reset drive + CAME Q,QSDU ; ECC error better be for transfer in + BUG ; progress... + MOVE A,QCHPRG + TRNN A,10 .SEE %HMRED + BUG ; ECC error should only happen during read. + LDB A,[$UPPAG QERMAP] + IORI A,600000 + DPB A,[.PAREP+EXEUMP] ; Point parity error page at buffer. + CLRPT 400000+PAREP_12 ; Get it into our map now. + CLRPT 401000+PAREP_12 ; Both halves... + MOVE J,QERBA + SUBI J,1000+QUBPG_14 ; Correct to relative byte address of start + ; of losing sector. + TRNE J,770777 ; Should always be aligned on sector boundary + BUG ; and within a single block, right? + LSH J,-2 ; J: Address of first word of losing sector + ; within block. + MOVE A,QECPOS ; Get error position + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADDI J,400000+PAREP_12(A) ; J: Address of losing word-pair + ; (In parity error page.) + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + CLRPT 400000+PAREP_12 + CLRPT 401000+PAREP_12 ; Both halves... + + AOS QECCS(Q) ;LOG THE LOSS + LDB E,[111000,,QERBA] ; E: Number of sectors transferred (including + SUBI E,QUBPG_3 ; ECC sector) + MOVE A,QCHPGA + LDB B,[$HASEC A] ;Compute disk address of failing sector: + ADDI B,-1(E) + IDIVI B,NSECS ; C: sector + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D ; B: track + DPB B,[$HATRK A] + MOVEM A,QECCAD(Q) + HLRZ A,A ; A: cylinder + MOVE D,QSDCH ; D: chnl + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT #],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + CAIL E,SECBLK + JRST QINTA1 ;XFER COMPLETE + + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS + ; CYLINDERS + + HRL E,QERWC ; Reassemble "iowd" from + HRR E,QERBA ; saved parts. (Don't trust stuff saved + MOVEM E,QIOWD ; in controller more than we have to.) + HRRZ C,QSDCH ;FOR QECCX + JRST QECCX ;MORE TO DO, CONTINUE XFER + +] ;RH11P + +IFN RH10P,[ + +QINT: AOS QGTBZY + MOVE Q,QSDU + MOVEM TT,QCST + TRNE TT,%HIERR + JRST QINTE + TRNN TT,%HIATN + JRST QINT0 + MOVSI A,%HRATN ;FIND DRIVES NEEDING ATTENTION + PUSHJ P,RHGET + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING COMPLETION OF TRANSFER + TRNN TT,%HIDON + JRST DSKEX ;NO COMPLETED TRANSFER + CONSZ DSK,%HIBSY + JRST 4,.-1 ;TRANSFER STILL IN PROGRESS?? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + MOVSI A,%HRSTS(Q) ;SOMETIMES %HSERR SETS AND %HIERR DOESN'T! + PUSHJ P,RHGET + TRNE A,%HSERR + JRST QINTE + JRST QINTA1 ;XFER COMPLETE... + +QINTAT: MOVNI Q,-35.(B) ;LOW BIT IS DRIVE 0 + HRRZS Q + MOVEI A,1 ;TURN OFF ATTENTION (DRIVE MAY BE LOSING + LSH A,(Q) ;IN SUCH A WAY THAT READING %HRSTS DOESN'T CLEAR ATTN) + HRLI A,%HRATN + PUSHJ P,RHSET + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ;IGNORE ATTN IN MID-TRANSFER + JRST QINTA2 ] + MOVSI A,%HRSTS(Q) ;GET STATUS OF DRIVE WITH ATTENTION + PUSHJ P,RHGET ;THIS ALSO CLEARS THE ATTENTION BIT + SKIPE QACT(Q) + JRST QINTA2 ;IGNORE THIS DRIVE + TRNE A,%HSERR+%HSPIP + JRST [ MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;DRIVE REPORTING ERROR NOT DURING TRANSFER + PUSHJ P,RHSET ;SO CLEAR THE DRIVE + AOS NQEATN(Q) + JRST .+1 ] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION + MOVSI A,%HRCCY(Q) + PUSHJ P,RHGET + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +;INPUT FROM MASSBUS - ADDRESS IN LH(A), RETURNS DATA IN A + +RHGET: TLZA A,%HRLOD + +;OUTPUT TO MASSBUS - ADDRESS IN LH(A), DATA IN RH(A) + +RHSET: TLO A,%HRLOD + DATAO DSK,A + MOVEM A,RHDATO ;SAVE FOR REBUGGING + MOVEI A,5 ;WAIT 3 USEC FOR BUS CYCLE + SOJG A,. + DATAI DSK,A + TLNE A,%HDERR + BUG HALT,[DSK: MASSBUS ERROR, DATAO=],OCT,RHDATO,[DATAI=],OCT,A + ANDI A,177777 ;RETURN 16-BIT REGISTER CONTENTS + POPJ P, + +QINTE: CONI DSK,TT + DATAI DSK,R + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN ;RESET CONTROLLER SO DRIVE STATUS MAY BE READ + CONSZ DSK,%HIBSY + JRST .-1 ;SOMETIMES CONTROLLER IS BUSY?? + MOVEM TT,QERST + MOVEM R,QERST+1 + SKIPGE Q ;TRY HARD TO GUESS THE RIGHT DRIVE! + LDB Q,[$HCDRV R] ;CURRENTLY SELECTED DRIVE + IRPS X,,[%HRSTS %HRER1 %HRER2 %HRER3 %HRDCL %HRPOS %HRPAT] + MOVSI A,X(Q) ;GET STATUS OF DRIVE + PUSHJ P,RHGET + MOVEM A,QERST+.IRPCNT+2 + TERMIN + SKIPN QERER2 ;FILE UNSAFE + SKIPE QERER3 + JRST UNSAFE + TRZE TT,%HIDRE + AOS NQDRE(Q) ;THIS BIT SUSPECTED OF BEING SET RANDOMLY. + ;;CHECK FOR IRRECOV (?) HARDWARE LOSSAGE. EVEN MORE SO THAN 'UNSAFE' + TDNE TT,[%HIILF+%HISDE+%HINXM+%HIDRE+%HIILC+%HIPWR] + BUG HALT,[DSK: UNIT ],DEC,Q,[ LOSING. RH10 CONI= ],OCT,QERST +IFN KS10P, .ERR So whats this all about? +IFN KL10P,[ + TLNN TT,(%HIDPE+%HICPE) ;IF CHANNEL DETECTS PARITY ERROR, CAUSE + JRST QINTE0 ;PROCESSOR PARITY SWEEP WHICH WILL PROBABLY + MOVSI A,SCLPAR ;CRASH THE SYSTEM ANYWAY. BEATS LOOPING! + TDNN A,SUPCOR ;BUT DON'T CAUSE CLKB1E+7 HALT + CONO 10407 + BUG CHECK,[DSK: MEM PAR ERR, QICWA/],OCT,QICWA,OCT,QICWA+1,[QIOWD/],OCT,QIOWD +QINTE0: +];KL10P + TDNE TT,[%HIOVR+%HICOV+%HIDPE+%HICPE+%HIBPE] + JRST QINTE1 ;OVERRUN OR PARITY ON CONTROL BUS OR CHANNEL BUS - RETRY + MOVE A,QERSTS ;DRIVE EXCEPTION, CHECK DRIVE STATUS + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ;THESE BITS BETTER ALL BE ON + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG ;DRIVE TURNED OFF? MAYBE 11 HACKING THIS DRIVE? + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ;SPURIOUS? + JRST QINT0 ] + MOVE B,QERER1 ;CHECK THE MAIN ERROR REGISTER + TRNE B,#%H1SOF ;ANY HARD ERRORS? + JRST UNSAFE + CAIN B,%H1ECC ;IF JUST A CORRECTABLE ERROR, + JRST QECC ;GO CORRECT IT + PUSHJ P,QINTER ;OTHER SOFT ERROR, PRINT MESSAGE AND RESET DRIVE + TRNE B,010620 ;SEARCH ERROR, OR HEADER READ OR FORMAT ERROR OR DRIVE TIMING + JRST QHE ;REQUIRES RECALIBRATE + TRNE B,100110 ;BUS PARITY OR ECC "HARD" + JRST QDE ;REQUIRES RE-READ, GIVE UP AFTER N + JRST QOVR ;NO ERROR BITS, PRINT MESSAGE AND RETRY + +;CONTROLLER ERROR +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CONI=],OCT,QERST,[DCL=],OCT,QERDCL + JRST QOVR + +;DRIVE ERROR +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA + MOVSI A,%HRDCL(Q) ;NOW RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + JRST RHSET + +;COME HERE FOR DRIVE UNSAFE AND SIMILAR BAD THINGS. MAY BE SET TO +;EITHER HALT OR ATTEMPT RETRY (VIA USFHLT VARIABLE). NOTE THAT WHEN +;WE GET HERE THE STATE OF THE DRIVE HAS NOT YET BEEN DISTURBED. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + JRST QHE ;RECALIBRATE AND RETRY + +QECC: MOVSI A,%HRDCL(Q) ;RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + PUSHJ P,RHSET + CAME Q,QSDU ;CORRECT AN ECC ERROR + BUG ;BARF ... NO TRANSFER IN PROGRESS + MOVE A,QCHPRG + TRNN A,10 + BUG ;BARF ... SHOULDN'T HAPPEN DURING WRITE + SKIPN A,QICWA+1 ;GET ADDRESS OF LAST WORD READ + JRST 4,.-1 ;CHANNEL OUGHT TO HAVE STORED CONTROL WORD BY NOW + SOS J,A + TDZ J,[177+.BM $DFCWA] ;J := ADDRESS OF FIRST WORD IN LOSING SECTOR + LDB A,[$DFCAD QIOWD] + SUBM J,A + SOS H,A ;# WORDS SUCCESSFULLY XFERED. + CAIL H,0 ;CHECK IF CHANNEL STORED BAD ADDRESS + CAILE H,2000-200 + JRST QDE ;THIS SHOULD NEVER HAPPEN, BUT IT DOES, FREQUENTLY + MOVE A,QECPOS ;GET ERROR POSITION + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADD J,A ;J := ADDRESS OF LOSING WORD-PAIR + LDB A,[121400,,J] + ANDI J,1777 ;GET ADDR OF PAR ERR PAG + ADDI J,400000+2000*PAREP ;IN EXEC ADDRESS SPACE + IORI A,600000 ;MAKE THAT PAGE POINT TO THE DISK BUFFER + DPB A,[.PAREP+EXEUMP] + SPM ECCPAG ;GET IT INTO OUR MAP. + LPMR ECCPAG + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + LPMR ECCPAG + + AOS QECCS(Q) ;LOG THE LOSS + MOVE A,QCHPGA + MOVEI E,200(H) + LSH E,-7 ;NUMBER OF SECTORS TRANSFERRED (INCLUDING ECC SECTOR) + LDB B,[$HASEC A] ;GET DISK ADDR OF FAILING SECTOR + ADDI B,-1(E) + IDIVI B,NSECS + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D + DPB B,[$HATRK A] ;NO NEED TO DIVIDE BY NHEDS SINCE NEVER CROSS CYLINDERS + MOVEM A,QECCAD(Q) + HLRZ A,A + MOVE D,QSDCH + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT ],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS CYLINDERS + HRRZ C,QSDCH ;FOR QECCX + LDB A,[$DFCWA QICWA+1] ;LAST CONTROL WORD PROCESSED + SUBI A,1 ;CRETINOUS DF10 + CAIE A,QIOWD + BUG ;CHANNEL STORED BAD ADDRESS? + HRRZM A,QICWA + MOVEI A,200(H) ;# WORDS ALREADY DONE. + DPB A,[$DFWC A] ;PUT IT IN BOTH FIELDS. + ADDB A,@QICWA ;ADVANCE C.W. TO REMAINING STUFF + TLNE A,(.BM $DFWC) + JRST QECCX ;MORE TO DO, CONTINUE XFER + AOS QICWA ;ELSE ADVANCE TO NEXT C.W. + SKIPE @QICWA + JRST QECCX ;MORE TO DO, CONTINUE XFER + JRST QINTA1 ;XFER COMPLETE +] + +IFN T300P,[ +T3INT: SETZM DSCDON ;CLEAR DONE FLAG THAT GOT US HERE + SKIPGE QSDU1 ;OPERATION COMPLETE? + JRST QINT1 ;NO, GO FIND SOMETHING TO DO + HRRZ Q,DSCDRV ;YES, GET DRIVE OPERATION WAS ON + ADDI Q,T300P + CAIGE Q,NQS + CAME Q,QSDU1 ;TERMINATION ON DRIVE WE EXPECTED? + BUG ;DRIVE NUMBER CLOBBERED? + SETZM QRCAL(Q) ;PRESUMABLY NOT RECALIBRATING ANY MORE. + MOVE A,DSCCMD ;COMMAND THAT JUST COMPLETED + CAIN A,%DMREC ;WAS IT A RECALIBRATE? + JRST QINT1E ;IF SO, CONTROLLER IS IDLE NOW + MOVE C,QSDCH1 ;CHANNEL + HRLZ E,DSCFLT ;CHECK FOR ERRORS + HRR E,DSCSTS + JUMPE E,QINTI ;OPERATION COMPLETED UNEVENTFULLY + MOVE D,DSCHED ;GET DISK ADDRESS AS CYL,,HEAD_9+SECTOR + LSH D,9 + IOR D,DSCSEC + HRL D,DSCCYL + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: T-300 ERR UNIT ],DEC,Q,[FAULT=],OCT,DSCFLT,[STATUS=],OCT,DSCSTS,[CMD=],OCT,DSCCMD,[CYL-SURF-SEC=],OCT,D + TRZE E,%DSRTR+%DSECC ;THESE ARE NOT ERRORS + AOS QECCS(Q) + JUMPE E,QINTI ;OPERATION COMPLETED SUCCESSFULLY (WITH INTERVENTION OF 2561) + MOVE T,E + TRZ T,%DSECH+%DSIDE+%DSHCE + JUMPN T,T3INT2 ;CONSIDER USING ERROR RECOVERY FEATURES + TRNE A,%DMRED ;IF COMMAND IS A READ + TRNE A,10 ;AND WE HAVEN'T TRIED THEM ALL + JRST T3INT2 + AOS NQSE(Q) ;COUNT "SOFT ERRORS" (NOT "SPURIOUS" IN T-300 CASE) + AOJA A,T3IO1 ;GO RETRY OPERATION USING NEXT FEATURE + +T3INT2: TLNN E,-1 ;ANY FAULT? PROBABLY UNRECOVERABLE BUT TRY RECALIBRATE + TRNE E,%DSIDE+%DSHCE+%DSSKE+%DSOFL+%DSFLT ;DISK CONDITION THAT CALLS FOR RECAL + JRST T3HE + JRST T3DE ;TRY OPERATION AGAIN. PROBABLY WILL LOSE BUT TRY. +];T300P + +OVHMTR QSC ;DISK SCHEDULER (AND HIGHER-LEVEL INTERRUPT STUFF) + +QINTA1: SKIPL C,QSDCH ;XFER COMPLETE +QINTI: SKIPGE A,QSCABN(C) ;CHANNEL IN C + BUG ;MEMBLT INDEX IN A + MOVE R,A ;BUFFER ADDRESS IN R +IFN KL10P,[ ;QSRAC IN D, QSK# IN Q + SKIPL QSCRW(C) ;IF READ, FLUSH CACHE AGAIN + JRST [ PUSHJ P,CSHSWP ;SINCE USER MIGHT HAVE TOUCHED ABS PAGE + CAIA + MOVE A,R ;A WAS CLOBBERED + JRST .+1 ] +] +IFN KS10P,[ + SKIPL QSCRW(C) ;ON KS, CAN ONLY CLEAR THE WHOLE CACHE + CLRCSH +] + LSH R,10. + MOVE D,QSRAC(C) +IFN RP10P,[ + HRRZ TT,QICWA+1 + CAIE TT,1777(R) + TLNE D,%QAPAR ;IGNORE IF LOSING ANYWAY (E.G. SEARCH ERR) + CAIA + JRST QDFLOS +];RP10P +IFN QRDCMP,[ + SKIPE TT,RDCPHS ;NEED TO READ-COMPARE? + JRST QRC1 ;READ-COMPARE STARTING OR FINISHED +QRC0: +];QRDCMP + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE COMPLETION HANDLER + OFFSET -. +%QMIDL::JRST 4,QINT1 ;IDLE - SHOULDN'T BE ACTIVE +%QMRD:: JRST QRDFIN ;READ +%QMWRT::JRST QWRFIN ;WRITE +%QMWOV::JRST QWOVFN ;WRITE-OVER MODE +%QMRD1::JRST QRD1FN ;READ BLOCK AT A TIME MODE + JRST 4,QINT1 ;ILL CODE +%QMUDR::JRST QUDRIN ;USER DIR IN +%QMMDR::JRST QMDRIN ;MASTER DIR IN +%QMTTR::JRST QTUTIN ;TUT IN +%QMUDW::JRST QUFDWF ;USER DIR WRITE +%QMMDW::JRST QMFDWF ;MASTER DIR WRITE +%QMTTW::JRST QTUTWF ;TUT WRITE +%QMSWP::JRST QSWPFN ;SWAP FINISHED + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE +%QMMAX::OFFSET 0 +IFN %QMMAX-20, .ERR %QMMAX MUST BE A POWER OF 2 + +IFN RP10P,[ +;CHANNEL DIDN'T TRANSFER EXACTLY 2000 WORDS +QDFLOS: MOVEI D,1777(R) ;EXPECTED TERMINATION ADDRESS + HRRZ B,QICWA+1 ;ACTUAL TERMINATION ADDRESS + CAIL B,(D) + SKIPL QSCRW(C) + JRST QDFLZ1 + BUG HALT,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D,[DISK IS CLOBBERED NOW.] + +QDFLZ1: BUG PAUSE,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D + JRST QOVR +];RP10P + +;;; SOFTWARE READ-COMPARE ROUTINES + +IFN QRDCMP,[ +IFE RP10P+RH10P, .ERR READ-COMPARE ONLY CODED FOR RP-10 AND RH10 +;IFE KA10P, .ERR READ-COMPARE ONLY CODED FOR KA-10 + +;;; REGULAR OPERATION COMPLETE, DO A READ-COMPARE TO BE SURE +QRC1: +IFN T300P, CAIGE Q,T300P ;NO READ/COMPARE IF THIS IS T-300 CONTROLLER + TLNE D,%QAPAR ;GIVING UP WITH FATAL ERR? + JRST QRC0 ;NO READ-COMPARE THEN + JUMPG TT,QRC2 ;JUMP IF READ-COMPARE COMPLETED + MOVE E,QSGL(C) ;DISK BLOCK + PUSHJ P,QPOSR ;E GETS DATAO WORD +IFN RP10P,[ + IOR E,[DREADC+7000+RCICWA] ;MAKE READ COMMAND + CONO DPC,175700+DSKCHN + MOVE T,[-2000,,QRCBUF-1] ;STORE CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + DATAO DPC,E ;START DISK +];RP10P +IFN RH10P,[ + MOVE T,[-2000_4,,QRCBUF-1] ;DF10-C CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + SWPUA ;DUMP CACHE + CONSZ 200000 ;IT'S INEFFICIENT, BUT WHAT THE HELL + JRST .-1 + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + MOVSI A,%HRADR(Q) + HRR A,E ;HEAD AND SECTOR (CYL DOESN'T CHANGE) + PUSHJ P,RHSET + MOVEI A,%HMRED+ + TLO A,%HRCTL(Q) + PUSHJ P,RHSET ;START DISK +];RH10P + MOVEM T,RDCPHS ;RDCPHS POSITIVE MEANS DOING RD/CMP NOW + JRST DSKEX ;AWAIT COMPLETION + +;;; READ-COMPARE COMPLETED. CHECK IT. +QRC2: SPM PARPG ;SET UP MAP TO PAGE BEING READ/WRITTEN + MOVEI T,600000+PMCSHM(A) + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + MOVEI H,0 ;H DIFFERENCE COUNT +IFN KA10P,[ + PUSH P,A ;WILL DO COMPARE LOOP IN ACS + PUSH P,C + PUSH P,D + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVSI D,[ MOVE T,400000+PAREP*2000(E) ;A + CAMN T,QRCBUF(E) ;B + AOBJN E,A ;C + JRST QRC3 ] ;D + HRRI D,A + BLT D,D + JRST A +];KA10P +.ELSE [ + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVE T,400000+PAREP*2000(E) + CAMN T,QRCBUF(E) +QRC2A: AOBJN E,.-2 +];NOT KA10P +QRC3: JUMPGE E,QRC5 ;JUMP IF DONE + JUMPG H,QRC4 ;COMPARE ERROR, REPORT IT + AOS NQCMPE(Q) +IFN KA10P,[ + MOVE T,-1(P) ;SAVED C + BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(T) +];KA10P +.ELSE BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(C) +QRC4: ADDI H,1 + HRRZ T,E + CAIG H,4 ;ONLY REPORT FIRST 4 BAD WORDS + BUG INFO,[DSK: READ-COMPARE DIFFERENCE ],OCT,T,OCT,400000+PAREP*2000(E),OCT,QRCBUF(E) +IFN KA10P,JRST C +.ELSE JRST QRC2A + +QRC5: +IFN KA10P,[ + POP P,D + POP P,C + POP P,A +];KA10P + MOVEI T,0 ;CLEAR MAP + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + JUMPE H,QRC0 ;NO DIFFERENCE, I/O OPERATION IS DONE + CAILE H,4 ;FAILED, DO IT ALL OVER AGAIN + BUG INFO,[DSK: READ-COMPARE DIFFERENCES TOTAL],DEC,H + JRST QOVR +];QRDCMP + +QUFDWF: MOVE TT,QDWIP + CAMN Q,MDSK ;WRITTEN TO MASTER DISK? + SKIPN E,QSFBT(TT) ;AND HAVE SOME BLOCKS TO FREE? + JRST QUDWF1 + SETZM QSFBT(TT) ;YES, TRANSFER THEM TO QFBTS LIST + MOVE T,E ;E FINDS LAST OF LIST, T RPLACD'D IN THERE + EXCH T,QFBTS ;NCONC QSFBT ONTO FRONT OF QFBTS + SKIPE 1(E) + JRST [ MOVE E,1(E) + JRST .-1 ] + MOVEM T,1(E) + SKIPN T + AOS NCORRQ ;WAKE UP CORE JOB IF QFBTS HAD BEEN EMPTY +QUDWF1: JSP D,QDWF + QSNLCN(TT) + +QMFDWF: JSP D,QDWF + QMDRO + +QTUTWF: AOS T,QSGL(C) ;NEXT BLOCK TO GO OUT + AOS QSCABN(C) ;FROM NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;WRITE MORE + JSP D,QDWF + QTUTO(TT) + +QDWF: MOVSI E,(SETZ) ;UNLOCK DIR THAT WAS WRITTEN + IOR E,DCHBT(Q) ;COPY ON THIS DISK IS NOW UP TO DATE + MOVE TT,QDWIP + ANDCAM E,@(D) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + SETOM DWUSR + JRST QINT1A ;DON'T COUNT THIS AS DISK ACTIVITY + +QUDRIN: MOVE TT,QUDPR(C) ;USER DIR IN OK + MOVE D,UDNAME(R) + CAME D,QSNUD(TT) ;COMPARE UNAME IN DIR WITH RQ'ED + JRST QUDER1 + TLO R,40000 ;NOT PAWED OVER + MOVEM R,QSNLCN(TT) + MOVE R,QSLGL(C) + MOVEM R,QSNMI(TT) + MOVEI R,MU23UD ;USER DIRECTORY + PUSH P,A + PUSH P,C + MOVE C,TT + PUSHJ P,QDIRCK ;VERIFY NOT TOTALLY BASHED TO BEGIN WITH + POP P,C ;CLOBBERS A,B,I + POP P,A +QINTU4: DPB R,[MUR,,MEMBLT(A)] + DPB TT,[MNUMB,,MEMBLT(A)] +QTUTI1: SETOM QUSR(C) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QINT1A + +QMDRIN: TLO R,2 ;NOT RECONCILED + MOVEM R,QMDRO ;MASTER DIRECTORY IN + MOVE TT,MDCHK(R) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + MOVE TT,MDNUDS(R) + CAIE TT,NUDSL + BUG HALT,[MFD HAS WRONG NUMBER OF DIRECTORIES] + MOVE TT,(R) ;ASCENDING DIR # + SKIPGE QAMDNO + MOVEM TT,QAMDNO ;FIRST DISK IN STORE ASCENDING # + MOVEI R,MU23MD ;MASTER DIRECTORY + MOVE TT,Q ;DISK NO + JRST QINTU4 + +QTUTIN: AOS T,QSGL(C) ;NEXT BLOCK TO COME IN + AOS QSCABN(C) ;INTO NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;READ MORE + HRRZS QTUTO(Q) ;UNLOCK TUT, BUT QDPWF IS STILL SET + JRST QTUTI1 + +QSWPFN: MOVE Q,QDSKN(C) + TLNE D,%QAPAR + JRST QSWPF2 ;SWAP READ ERROR (I HOPE) + MOVSI E,MMPTMP ;PAGE NO LONGER IN TRANSIT + TDNN E,@QSMMP(Q) + BUG ;ALREADY WASN'T? + ANDCAM E,@QSMMP(Q) + SKIPL QSCRW(C) + JRST QSWPIF + PUSHJ P,IMEMR ;SWAP-OUT COMPLETE, RETURN MEMORY + MOVSI E,MMPPGB + ANDCAM E,@QSMMP(Q) + MOVSI E,MMPWOD ;PAGE HAS BEEN WRITTEN ON DISK. AND NO LONGER + IORB E,@QSMMP(Q) ;BEING PAGED BEHIND. + TLNN E,MMPGON + JRST QSWPF2 + MOVE A,QSMMP(Q) ;WE'RE SUPPOSED TO RETURN THE MMP ENTRY + PUSHJ P,RETMMP +QSWPF2: SETOM SWUSR(Q) ;SWAPPING IDLE + JRST QINT1B + +QSWPIF: +;SOME ERROR CHECKING + MOVE E,QSMMP(Q) + HLLZ TT,1(E) + JUMPE TT,QSWPF3 ;ON INITIAL-SWAP-IN, ADDRESS IN MMP IS SUPPOSED TO BE ZERO + LDB TT,[$MMPUN,,(E)] + CAME TT,Q + BUG + HLRZ TT,1(E) + CAME TT,QSGL(C) + BUG +QSWPF3: LDB TT,[MMMPX,,MEMBLT(A)] + CAIE TT,-MMP(E) + BUG +;END ERROR CHECKING + MOVEI TT,MURUSR ;SWAP IN OF PAGE COMPLETED + DPB TT,[MUR,,MEMBLT(A)] + SETZM MMSWP(A) + MOVE D,(E) + SKIPL CIRPSW + JRST QSWPF2 ;CAN'T PUT IN MAPS IF CIRPSW NOT AVAILABLE. + MOVSI D,(TDNE T,) ;SET UP CHECK USED BY PRIVELEGED USER FEATURE + HRR D,QSMMP(Q) + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS + POP P,Q + POP P,C + JRST QSWPF2 + +QWOVFN: CLEARM QSCRW(C) ;WRITE OVER SWITCH TO READ MODE + HRRI D,%QMRD1 + TLZE D,%QAEFW + HRRI D,%QMIDL ;TRYING TO CLOSE, STOP CHANNEL + MOVEM D,QSRAC(C) + AOS QWBUFS ;COMPENSATE FOR EXTRA SOS BELOW + +QWRFIN: TLNN D,%QACTH ;WRITE COMPLETE, RETURN BUFFER + PUSHJ P,IMEMR + TLNE D,%QACTH + PUSHJ P,CIMEMR + SOS QSBFS(C) + SOS QWBUFS + MOVE TT,QSGL(C) + MOVEM TT,QSLBLK(C) + JRST QINT1B + +QRD1FN: HLLZS QSRAC(C) .SEE %QMIDL ;BLOCK-AT-A-TIME READ COMPLETE, IDLE THE CHANNEL + +QRDFIN: MOVEI B,.BM MLO ;NORMAL READ COMPLETED + ANDCAM B,MEMBLT(A) ;THREAD ONTO CHANNEL LIST + HLRZ B,QBFP(C) + SKIPE B + DPB A,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM A,QBFP(C) + HRLM A,QBFP(C) + SKIPL B,QPIBSZ(C) ;GET BYTE COUNT OF BLOCK + JRST QRDFN1 + HRRZ B,1777(R) ;FUNNY BLOCK, GET FROM LAST WORD + ; 8/20/90 No more funny blocks + HRRZ TT,QSBYTE(C) ;AND MAKE SURE IT'S NOT TOO BIG + IMULI TT,2000 + CAMLE B,TT + MOVE B,TT +QRDFN1: HRRZM B,MEMPNT(A) ;PASS TO MAIN PROGRAM + AOS QSBFS(C) +IFE DMDSK, LDB B,[XWBLK QXWDS] + .ALSO MOVEM B,QSLBLK(C) + +;XFER COMPLETE, DEACTIVATE CHANNEL + +QINT1B: SETOM QACTTM +QINT1A: SETOM QSGL(C) + SETOM QSCABN(C) +QINT1E: +IFE DC10P, SETOM QSKT1(Q) +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] ;DC10P +IFN T300P,[ + CAIL Q,T300P + SETOM QSDU1 + CAIGE Q,T300P + SETOM QSDU +];T300P +.ELSE SETOM QSDU +;DROPS THROUGH + ;DROPS IN + +;ACTIVATE CHANNELS, LOOK FOR SEEKS AND TRANSFERS TO BE DONE + +QINT1: SETZM QHUNGF + SETOM QTUNT ;NO UNIT SELECTED YET +IFN T300P, SETOM QTUNT1 + MOVE C,QTCHN ;START SCAN IN SUITABLE PLACE + MOVEM C,QLCHN + JRST QINT2D + +QINT2L: CAIGE C,NQCHN ;IF DIR-WRITE OR SWAP CHANNEL, DON'T CHECK QUSR + SKIPL QUSR(C) + SKIPGE D,QSRAC(C) .SEE %QALOK + JRST QINT2C ;CHANNEL LOCKED OR NOT OPEN, SKIP IT + MOVE Q,QDSKN(C) + SKIPL E,QSGL(C) + JRST QINT4 ;JUMP IF CHANNEL ACTIVE ALREADY + TLNE D,%QACTH+%QAOUT + JRST QINT2C ;CHANNEL BLOCKED BY CORE JOB, DON'T ACTIVATE + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE ACTIVATE HANDLER + OFFSET -. +%QMIDL::JRST QINT2C ;IDLE - DON'T ACTIVATE +%QMRD:: JRST QRDACT ;READ +%QMWRT::JRST QWRACT ;WRITE +%QMWOV::JRST QWRACT ;WRITE OVER +%QMRD1::JRST QRDACT ;READ 1 BLOCK + JRST 4,QINT2C ;ILL CODE +%QMUDR::JRST QDRACT ;UFD READ +%QMMDR::JRST QDRACT ;MFD READ +%QMTTR::JRST QDRACT ;TUT READ +%QMUDW::JRST 4,QINT2C ;UFD WRITE - SHOULDN'T LEAVE THIS MODE AROUND +%QMMDW::JRST 4,QINT2C ;MFD WRITE - .. +%QMTTW::JRST QINT5 ;TUT WRITE - MAY BE WRITING SECOND PAGE +%QMSWP::JRST SWPACT ;SWAP + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE +%QMMAX::OFFSET 0 + +; ACTIVATION ROUTINES + +SWPACT: SKIPL SWUSR(Q) + BUG ;SWAPPING ALREADY ACTIVE ON THIS DISK + MOVE A,MEMFR + SUB A,NCBCOM + MOVEI B,0 ;CHECK FIRST FOR SWAP IN OR OUT + CAIGE A,6 ;ACCORDING TO AVAIL MEM + MOVEI B,1 + SKIPN @SWAPL(B) ;IF NO TRAFFIC THAT DIRECTION, CHECK THE OTHER. + TRC B,1 + HRRZ E,@SWAPL(B) + JUMPE E,QINT2C ;NO SWAPPING TRAFFIC THIS DISK. + LDB A,[MLO,,MEMBLT(E)] ;TAKE BLOCK OFF LIST + SKIPN A + SETZM @SWAPL(B) ;LAST BLOCK, LIST IS NOW EMPTY + HRRM A,@SWAPL(B) ;SET NEW FIRST BLOCK + LDB D,[MMMPX,,MEMBLT(E)] + ADD D,MMPEAD ;GET MMP ADDRESS + LDB TT,[410200,,(D)] + TRNN TT,1 + BUG ;THIS PAGE SHOULD BE MARKED IN TRANSIT + HRRZM D,QSMMP(Q) + SOS SILNG(B) + CAIGE E,TSYSM + CAIGE E,SYSB + BUG + HRRZM E,QSCABN+NQCHN+1(Q) + CLEARM SWUSR(Q) ;CHNL ACTIVE + HLRZ E,MEMPNT(E) + MOVEM E,QSGL+NQCHN+1(Q) ;DISK BLOCK + HRRZS QSRAC+NQCHN+1(Q) .SEE %QMSWP + MOVNM B,QSCRW+NQCHN+1(Q) ;DIRECTION + CLEARM QERRS+NQCHN+1(Q) ;NO ERRORS (YET) + JRST QINT4 ;CHANNEL SUCCESSFULLY ACTIVATED + + +; MORE ACTIVATION ROUTINES + +QRDACT: TLNE D,%QAACC ;ACTIVATE READ CHANNEL + JRST QINT2C ;NOT IF USER HACKING RANDOM ACCESS NOW + SETZM QERRS(C) + MOVE J,QUDPR(C) + SKIPGE QSNLCN(J) + JRST QINT2C ;USER DIRECTORY OUT OR LOCKED + MOVE A,QSBFS(C) + SKIPL QSMDN(C) + AOS A ;A := TOTAL NUMBER OF BUFFERS + CAMLE A,QRDAHD ;HOW MUCH SHOULD BE READ AHEAD + JRST QINT2C ;BLOATED, DON'T ACTIVATE + SKIPE QSBI(C) + JRST QINT4A ;BLOCKS LEFT FROM LAST TIME +QINT4B: PUSHJ P,QIDRCH ;GET NEXT DESC BYTE IN A, ALSO RET BYTE PNTR IN TT + CAIN A,UDWPH + JRST QINT4B + JUMPE A,QEOF ;REACHED READ EOF + TRZE A,40 + JRST QINT4C + CAILE A,UDTKMX + JRST QINT4D ;SKIP AND TAKE + MOVEM A,QSBI(C) ;TAKE NEXT N +QINT4A: SOS QSBI(C) + AOS E,QSLGL(C) +QINT4G: MOVEM E,QSGL(C) + MOVSI B,%QALBK + ANDCAM B,QSRAC(C) ;CLEAR PROCESSING LAST BLOCK IN FILE BIT + HRRZ A,QSBYTE(C) + IMULI A,2000 ;NUMBER OF BYTES IN A FULL BLOCK +IFN DMDSK,[ + MOVSI D,%QAFNY ;FUNNY FILE + TDNE D,QSRAC(C) + SETO A, +] + MOVEM A,QPIBSZ(C) ;SET FUNNY BIT + SKIPE QSBI(C) + JRST QINT4 ;IF MORE BLOCKS FOLLOW DON'T CHECK EOF + PUSHJ P,QIDRCH ;GET NEXT DESCR BYTE + SOS QDIRP(C) ;CORRECT PNTR + JUMPN A,QINT4 + MOVE A,QUDFPR(C) ;THIS IS LAST BLOCK + ADD A,QSNLCN(J) + LDB D,[UNBYTE+UNREF(A)] + PUSHJ P,QBDCD + IMUL D,E ;NUMBER OF UNUSED BITS IN LAST WORD + LDB E,[QSBSIZ(C)] ;(DEPEND ON DIVIDE ROUNDING DOWN) + IDIV D,E ;NUMBER OF UNUSED BYTES (IN SIZE OPEN) + LDB E,[UNWRDC+UNRNDM(A)];NUMBER OF USED WORDS IN LAST BLOCK + SKIPN E + MOVEI E,2000 + IMULI E,@QSBYTE(C) ;CONVERT TO NUMBER OF BYTES + SUB E,D ;NUMBER OF VALID BYTES IN BLOCK + HRRM E,QPIBSZ(C) ;STORE BYTE COUNT OF LAST BLOCK + IORM B,QSRAC(C) .SEE %QALBK + MOVE E,QSGL(C) + JRST QINT4 + +QINT4D: MOVEI E,1-UDTKMX(A) ;SKIP N AND TAKE 1 + ADDB E,QSLGL(C) + JRST QINT4G + +QWRACT: SKIPN I,QBFP(C) ;ACTIVATE WRITE CHANNEL + JRST QINT2C ;END OF WRITE LIST FOR NOW + HRRZM I,QSCABN(C) + LDB H,[MLO,,MEMBLT(I)] + HRRM H,QBFP(C) + SKIPN H + SETZM QBFP(C) ;LAST BLOCK, LIST NOW EMPTY + HLRZ E,MEMPNT(I) + MOVEM E,QSGL(C) + JRST QINT4 + +QDRACT: MOVE E,QSLGL(C) ;ACTIVATE DIRECTORY-READ CHANNEL + MOVEM E,QSGL(C) +; JRST QINT4 ;DROPS THROUGH + ;DROPS IN +QINT4: SKIPL QSCABN(C) ;SKIP IF NEED MEMORY + JRST QINT5 + PUSHJ P,IOMQ ;GET MEMORY FOR READ BUFFER + JRST QINT2C ;CAN'T +QINT5A: MOVEM A,QSCABN(C) + MOVEI D,MU23B + DPB D,[MUR,,MEMBLT(A)] + DPB C,[MNUMB,,MEMBLT(A)] + +QINT5: +IFN DC10P, MOVE TT,QTRAN(Q) +.ELSE MOVE TT,Q + SKIPN QSEEK(TT) ;IGNORE SEEKING DRIVE + SKIPGE QRCAL(TT) ;IGNORE RECALIBRATING DRIVE + JRST QINT2C +IFN T300P,[ ;IGNORE IF FOR CONTROLLER THAT IS NOT READY + CAIL TT,T300P + JRST [ SKIPGE QSDU1 + SKIPL QTUNT1 ;NOTE CODE HERE IS SIMILAR TO THAT AT QINT2F + JRST QINT2C ;T-300 CONTROLLER BUSY OR ALREADY COMMITTED + HRRZM Q,QTUNT1 ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN1 ;FOR THIS CHANNEL + JRST QINT2C ] ;T-300 CODE IS SIMPLIFIED SINCE NO SEEK OVERLAPS + SKIPL QSDU + JRST QINT2C +];T300P + HRRZ B,QSKT1(TT) + CAIN B,(C) + JRST QINT2F ;ALREADY SET FOR ME + SKIPL QSKT1(TT) + JRST QINT2C ;SET FOR SOME OTHER CHNL + HRRZM C,QSKT1(TT) ;AVAILABLE, SET IT FOR ME + PUSHJ P,QPOSR ;CONVERT DISK ADDRESS TO PHYSICAL +IFN DC10P,[ ;AND INITIATE SEEK + ADD E,[DSEEK] + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,E + LDB B,[DCYL E] + MOVE TT,QTRAN(Q) ;PRETEND SEEK ALREADY COMPLETE + MOVEM B,QPOSGL(TT) + MOVEM B,QPOS(TT) + JRST QINT2F ;DON'T WAIT FOR SEEK, START TRANSFER RIGHT AWAY +] ;DC10P +IFN RP10P,[ + TLO E,(DSEEKC) ;DSK SEEK + CONSZ DPC,20 + JRST 4,.-1 + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAMN TT,QPOS(Q) + JRST QINT2F ;IF WE'RE THERE, DON'T SEEK + MOVEM TT,QPOSGL(Q) + DATAO DPC,E + MOVEM E,QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, GO GET ANOTHER +] ;RP10P +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + HRRZ A,E + IOWRQ A,%HRADR ; Set track and sector + HLRZ A,E + IOWRQ A,%HRCYL ; Set cylinder + CAMN A,QPOS(Q) + JRST QINT2F ; On cylinder, don't seek + MOVEM A,QPOSGL(Q) + MOVEI A,%HMSEK + PUSHJ P,RHCMD ; Start seeking + SETOM QSEEK(Q) + JRST QINT2C ; Start other drives now? +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,E + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,E + PUSHJ P,RHSET + HLRZ TT,E ;GET CYLINDER PART OF ADDRESS + CAMN TT,QPOS(Q) + JRST QINT2F ;ON CYLINDER, DON'T SEEK + MOVEM TT,QPOSGL(Q) + MOVSI A,%HRDCL(Q) ;START SEEK + HRRI A,%HMSEK + PUSHJ P,RHSET + SETOM QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, START OTHER DRIVES +] ;RH10P + +IFN KL10P,[ +;CALL HERE TO SWEEP THE CACHE. CORE PAGE # IN R. +;INSTRUCTION AT CALL+1 SHOULD SKIP IF READING INTO CORE. +;CLOBBERS A,B,D,E,TT. + +CSHSWP: SETZB A,B ;A COUNTS WAIT TIME, B IS SWEEP INSTRUCTION + XCT @(P) + TLOA B,(SWPUO (R)) ;WRITE - UNLOAD PAGE FROM CACHE + MOVSI B,(SWPIO (R)) ;READ - CLEAR PAGE FROM CACHE + LSH R,1 ;HARDWARE PAGES ARE 1/2 K + XCT B ;SWEEP FIRST HALF-PAGE + MOVE D,[CONSZ 200000] + MOVE E,[AOJA A,D] + MOVSI TT,(POPJ P,) + PUSHJ P,D ;WAIT IN ACS TO MINIMIZE MBOX INTERFERENCE + AOS R ;SWEEP SECOND HALF-PAGE + XCT B + PUSHJ P,D + XCT @(P) + AOSA NCSHU ;COUNT NUMBER OF TIMES THIS DONE + AOSA NCSHI + JRST [ ADDM A,NCSHUL ? JRST .+2 ] + ADDM A,NCSHIL ;AND COUNT NUMBER OF LOOPS IN ACS + LSH R,-1 + JRST POPJ1 +] + +;VARIOUS EXITS FROM CHANNEL-CHECKING ROUTINES + +QINT2F: SKIPL QTUNT ;THIS CHANNEL IS READY TO TRANSFER + JRST QINT2C ;ALREADY FOUND A TRANSFER + HRRZM Q,QTUNT ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN ;FOR THIS CHANNEL +QINT2C: CAMN C,QLCHN ;CONTINUE CHANNEL SCAN + JRST QINT2E ;UNLESS CHECKED ALL CHANNELS +QINT2D: CAIL C,NQCHN+1+NQS-1 ;SKIP IF NOT TIME TO WRAP AROUND + SETO C, + AOJA C,QINT2L ;CHECK ANOTHER + +QINT2E: +IFN T300P,[ + MOVE C,QTCHN1 + SKIPL Q,QTUNT1 ;FOUND XFER FOR T-300? + JRST QDE1 ;YES +];T300P + SKIPGE Q,QTUNT ;FOUND XFER? + JRST QINT3 ;IDLE + MOVE C,QTCHN +;Q DISK TO TRANSFER ON, C CHANNEL. START (OR RESTART) TRANSFER ON THEM. +QDE1: MOVE R,QSCABN(C) +IFN KL10P,[ + PUSHJ P,CSHSWP + SKIPGE QSCRW(C) +];KL10P +IFN KS10P,[ + SKIPL QSCRW(C) + CLRCSH +];KS10P +IFE T300P, MOVEM C,QSDCH +IFN T300P,[ + CAIL Q,T300P + JRST T3IO + CAIGE Q,T300P + MOVEM C,QSDCH +];T300P + SKIPGE B,QSCRW(C) ;LOAD R/W STATUS IN B + JRST QINT6W + ;READ - DROPS IN +IFN RP10P,[ + MOVSI T,(DREADC) +QINT6A: IORI T,7000+QICWA ;DON'T STOP FOR PARITY ERRORS (PLUS INITIAL CHNL ADR) + MOVEM T,QCHPRG + DPB Q,[DUNFLD+QCHPRG] + HLLZS QIOWD + DPB R,[121000,,QIOWD] + LDB E,[100300,,R] ;MA15-17 + TRC E,7 + DPB E,[410300,,QIOWD] ;SET UP HIGH ADDR BITS. + MOVE TT,QIOWD + SOS TT + HRRM TT,QIOWD + SETZM QIOWD+1 + MOVEM Q,QSDU + MOVE E,QSGL(C) + PUSHJ P,QPOSR + IORM E,QCHPRG +QOVR: CONSZ DPC,20 + JRST QOVR + SKIPGE Q,QSDU + BUG + CONO DPC,175700+DSKCHN +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVEI TT,QIOWD + HRRZM TT,QICWA + MOVE E,QCHPRG + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAME TT,QPOS(Q) + BUG ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + SETZM QICWA+1 + DATAO DPC,QCHPRG ;ENTRY ON OVERRUN + MOVE A,TIME + MOVEM A,LQTM + MOVEM Q,QSDU + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DPC,DCLEAR+20+DSKCHN ;DISK NOTICED TO BE HUNG, RESET IT + SETOM QHUNGF ;TELL P.I. LEVEL TO RETRY OPERATION + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + ;READ - DROPS IN + +IFN RH11P,[ + MOVEI T,%HMRED +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,1 ; Set up Unibus map for RH11 to point at + TRO R,%UQVAL+%UQFST ; the block in question. + IOWRQ R,UBAPAG+QUBPG_1 + ADDI R,1 + IOWRQ R,UBAPAG+QUBPG_1+1 + MOVE E,[-4000,,QUBPG_14] + MOVEM E,QIOWD + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: IORDQ TT,%HRCS1 ; Enter here to recover from PI level lossage + TRNN TT,%HXRDY + JRST QOVR + SKIPGE Q,QSDU + BUG +QECCX: ;; Enter here from ECC correction code + PUSHJ P,RHCLRC ; Clear controller errors and select drive + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ; Punt if not positioned in right place + IOWRQ TT,%HRCYL ; Store cylinder in drive + HRRZ TT,QCHPGA + IOWRQ TT,%HRADR ; Store track and sector + HLRZ TT,QIOWD + IOWRQ TT,%HRWC ; Store halfword count + HRRZ TT,QIOWD + IOWRQ TT,%HRBA ; Store Unibus base address + MOVE A,QCHPRG + PUSHJ P,RHCMD ; Go! + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: MOVEI A,%HYCLR ; Sock controller in jaw + IOWRQ A,%HRCS2 + MOVE Q,QSDU + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Redundantly clear drive + SETOM QHUNGF + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT #],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, + +] ;RH11P + ;READ - DROPS IN + +IFN RH10P,[ + MOVEI T,%HMRED +QINT6A: IORI T,QICWA_6 .SEE $HCICWA + TLO T,%HRCTL(Q) + MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,10. ;ASSEMBLE DF10-C CONTROL WORD + SUBI R,1 + MOVNI E,2000 + DPB E,[$DFWC R] + MOVEM R,QIOWD + SETZM QIOWD+1 + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: CONSZ DSK,20 ;ENTER HERE FOR RECOVER FROM PI HALT, OVERRUN + JRST QOVR + SKIPGE Q,QSDU + BUG + MOVEI TT,QIOWD + HRRZM TT,QICWA +QECCX: SETZM QICWA+1 ;ENTER HERE FROM ECC CORRECTION CODE + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,QCHPGA + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,QCHPGA + PUSHJ P,RHSET + MOVE A,QCHPRG + PUSHJ P,RHSET +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DSK,%HOCLR+%HORST+%HOSTP+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;CLEAR DRIVE + PUSHJ P,RHSET + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, +] + ;READ - DROPS IN +IFN DC10P,[ + MOVSI T,(DREAD) +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + DPB R,[DCBN+QCHPR2] ;MEM BLOCK # + DPB R,[DCBN+QCHPR3] ;FOR POSSIBLE READ COMPARE + MOVE E,QSGL(C) + PUSHJ P,QPOSR ;QPOSR ALSO STORES MAPPED UNIT IN QCHPRG + IORB E,QCHPRG + CLEARM QCHPR4 ;STORE DHALT FOR NO RCC + CAILE C,NQCHN + JRST QINT6S ;SWAPPING CHNL + SKIPL B + AOSA NRXFR + AOS NWXFR + CAIE C,NQCHN ;ALWAYS R COMPARE DIR WRITES + SKIPLE QRCSW ;SKIP ON NOT READ COMP EVERYTHING + JRST QINT6B ;RCC + SKIPL QRCSW + JUMPL B,QINT6B ;RCC WRITES + HRRZ D,QSRAC(C) + CAIL D,%QMUDR + CAILE D,%QMTTR + JRST QINT6C ;NOT DIR READ +QINT6B: TLZ E,340000 ;CHANGE TO READ COMPARE + MOVEM E,QCHPR4 +QINT6C: SETOM QERS1 ;ERR VERIFY IND +QOVR: CONSZ DC0,DSSRUN+DSSACT + JRST QOVR + DATAO DC0,[DJMP QCHPRG] ;ENTRY ON OVERRUN +QOVR1: CONO DC0,DCSET+DCIENB+DSKCHN ;INTERRUPT WHEN DONE + MOVE A,TIME + MOVEM A,LQTM +QINTX: JRST DSKEX + +QINT6S: SKIPL B + AOSA NSRXFR + AOS NSWXFR + JUMPL B,QINT6B ;RCC WRITES + JRST QINT6C ;NOT READS + +QHUNG: CONO DC0,DCCSET+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + +QINT6W:IFE DMDSK,[ + MOVE T,[QXWDS-1,,QXWDS] + BLT T,QXWDS+3 + CAIL C,NQCHN + JRST QNT6W2 ;SWAP OR DIR WRITE + MOVE A,QUDPR(C) + MOVE T,QSNUD(A) + MOVEM T,QXWDS+XWSYSN + HRRZ A,QSNLCN(A) + ADD A,QUDFPR(C) + MOVE T,UNFN1(A) + MOVEM T,QXWDS+XWFN1 + MOVE T,UNFN2(A) + MOVEM T,QXWDS+XWFN2 + MOVE T,QSLBLK(C) + DPB T,[XWBLK+QXWDS] + LDB T,[MWC,,MEMBLT(R)] + DPB T,[XWAWC+QXWDS] +QNT6W2: +] +IFN DC10P, MOVSI T,(DWRITE) +IFN RP10P, MOVSI T,(DWRITC) +IFN RH10P, MOVEI T,%HMWRT +IFN RH11P, MOVEI T,%HMWRT + JRST QINT6A + +IFN T300P,[ +T3IO: MOVEM C,QSDCH1 ;THIS IS MORE OR LESS QINT6A FOR T-300 + MOVEM Q,QSDU1 + MOVEI A,%DMRED + SKIPGE B,QSCRW(C) + MOVEI A,%DMWRT +T3IO1: MOVE R,QSCABN(C) ;RE-ENTER HERE TO RETRY WITH COMMAND IN A + LSH R,10. ;FIRST ADDRESS IN TRANSFER + TLO R,730000 ;12-BIT BYTES, START WITH FIRST BYTE IN WORD + MOVSI E,-4 ;SET UP BYTE POINTERS + MOVEM R,DSCPNT(E) + ADDI R,400 + AOBJN E,.-2 + MOVE D,QSGL(C) ;DO LIKE QPOSR + CAIL D,NBLKS1 + BUG + IDIVI D,NBLKC1 + MOVEM D,DSCCYL + IMULI E,SECBL1 + IDIVI E,NSECS1 + MOVEM E,DSCHED + MOVEM TT,DSCSEC + PUSHJ P,T3CMD + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR1 + AOS NWXFR1 + JRST QINTX + SKIPL B + AOSA NSRXF1 + AOS NSWXF1 + JRST QINTX + +;START T-300, COMMAND IN A, DRIVE IN Q +T3CMD: MOVEI TT,2561 + MOVEM TT,DSCCHK + MOVE TT,TIME + MOVEM TT,LQTM1 + MOVEI TT,-T300P(Q) + MOVEM TT,DSCDRV + HRRZM A,DSCCMD + SETZM DSCDON + MOVEI T,1 + MOVEM T,DSCREQ + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, + +QHUNG1: MOVE Q,QSDU1 + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON T-300 UNIT ],DEC,QSDU + MOVEI TT,5*60.*30. ;SHUT UP FOR FIVE MINUTES + ADDM TT,LQTM1 + POPJ P, +];T300P + +QDE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT +IFN DC10P, AOSE PKIDM + SKIPGE Q,QSDU + BUG +IFN DC10P,[ + TRNE TT,DCKSER + JRST .+3 ;GET CKS ERR + TRNE TT,DRCER + AOS NQCMPE(Q) ;# COMPARE ERRORS [WITH NO OTHER ERROR] +];DC10P +IFN T300P,T3DE: ;ENTER HERE FOR ERROR ON T-300 + AOS NQDE(Q) + SKIPL R,QSCRW(C) + AOSA NQRDE(Q) + AOS NQWDE(Q) +IFN DC10P, JUMPL R,QERV1 ;DO ANOTHER RD/COMP TO SEE IF OK ON DSK (IF WRITE) +QERV2: AOS R,QERRS(C) + TRNN R,10 ;TRY 8 TIMES BEFORE AND AFTER REPOSITION + JRST QDE1 + TRNN R,1000 + JRST QDE2 ;TRY REPOSITION ONCE +QERV3: MOVE D,QSRAC(C) + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE IRRECOV ERROR HANDLER +QERV: OFFSET -. +%QMIDL::JRST 4,QERV+. ;IDLE CHANNELS SHOULDN'T GET HERE +%QMRD:: JRST QPE2D ;USER DATA +%QMWRT::JRST QDE1 ;WRITE KEEP TRYING +%QMWOV::JRST QDE1 ;.. +%QMRD1::JRST QPE2D + JRST 4,QERV+. ;ILL CODE +%QMUDR::JRST QUDER1 +%QMMDR::JRST QDE1 +%QMTTR::JRST QDE1 +%QMUDW::JRST QDE1 +%QMMDW::JRST QDE1 +%QMTTW::JRST QDE1 +%QMSWP::JRST QSWPER + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE +%QMMAX::OFFSET 0 + +QSWPER: SKIPGE CIRPSW ;TRY XFER AGAIN IF CIRPSW NOT AVAILABLE + SKIPGE QSCRW(C) + JRST QDE1 ;DON'T TRY TO DO ANYTHING ABOUT WRITE ERRORS + MOVE A,QSCABN(C) ;READ - GIVE ALL USERS OF PAGE PARITY ERR + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,UCPRL + 400000,,QSWER1 + LDB Q,[2200,,MEMPNT(A)] + DPB Q,C ;REMOVE MEM FROM LOOP + PUSHJ P,IMEMR ;AND GIVE BACK MEM + POP P,Q ;ALTERNATIVELY, COULD LEAVE THE MEM BUT SET MMPBAD + POP P,C ;TO INDICATE THAT THAT MEM COPY OF THE PAGE IS NO GOOD. + MOVEI D,2 + DPB D,[410200,,@QSMMP(Q)] ;PAGE IS OUT + JRST QPE2D + +QSWER1: PUSH P,T + MOVSI T,%PJPAR + IORM T,PIRQC(U) + JRST POPTJ + +IFN DC10P,[ +QERV1: SKIPN QCHPR4 + JRST QERV2 ;NOT SET FOR RCC + CLEARM QERS1 +QERL2: CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,[DJMP QCHPR4] + JRST QOVR1 + +QERL1: AOS Q,QERS1 + CAIGE Q,50. + JRST QERL2 + AOSA NQWIRE +QEROK: AOS NQWRE + MOVE C,QSDCH + MOVE Q,QSDU + SETOM QERS1 + JRST QERV2 +] +QDE2: MOVEI R,1000 + MOVEM R,QERRS(C) ;CLOBBER QERRS + JRST QREC ;AND TRY REPOSITIONING + +IFN RP10P,[ +QERSOFT:LDB A,[DCYL+QCHPRG] ;PARSE STARTING DISK ADDRESS + LDB B,[DCYLXB+QCHPRG] + LSH B,8 + IOR A,B + LDB B,[DSURF+QCHPRG] + LDB D,[DSECT+QCHPRG] + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: SOFT ERR UNIT ],DEC,Q,[CYL ],DEC,A,[STARTING HEAD ],DEC,B,[SEC ],DEC,D,[CONI=],OCT,QERST,[DATAI=],OCT,QERDTI + POPJ P, + +QRECAT: CONI DPC,A + BUG INFO,[DSK: SEEK ERR DATAO=],OCT,QSEEK(Q),[CONI=],OCT,A,[DATAI=],OCT,E + SETZM QSEEK(Q) + JRST QREC +];RP10P + +QHE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT + SKIPGE Q,QSDU + BUG +IFN T300P,T3HE: ;ENTER HERE FOR ID ERROR ON T-300 + AOS NQHE(Q) + AOS E,QERRS(C) + CAIL E,5. + JRST QHE2 +QREC: +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QRCAL(Q) + MOVEI A,%DMREC + PUSHJ P,T3CMD + MOVEM Q,QSDU1 ;CONTROLLER IS TIED UP BY RECAL BECAUSE + JRST QINT1 ] ;IT'S TOO DAMNED PSEUDO-INTELLIGENT +];T300P +IFN DC10P,[ + MOVE TT,QTRAN(Q) +QREC0: DPB TT,[DUNFLD+QRECAL] + SETOM QRCAL(TT) + SETOM QSKT1(TT) + CLEARM QSPPS(TT) + CLEARM QPOSGL(TT) + SETOM QPOS(TT) + MOVEI T,10. ;5-SECOND RECALIBRATE TIMEOUT + MOVEM T,QRCTIM(TT) + DATAO DC0,QRECAL + CONO DC0,DCSET+DCATEB+DSKCHN ;ENABLE ATTENTION +] +IFN RP10P,[ + DPB Q,[DUNFLD+QRECAL] + SETOM QPOS(Q) + DATAO DPC,QRECAL + CLEARM QSPPS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) ;INDICATE RECALIBRATING THIS DISK + CLEARM QPOSGL(Q) +] +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Clear errors + MOVEI A,%HMREC + PUSHJ P,RHCMD ; Recalibrate + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR + PUSHJ P,RHSET ;CLEAR ERROR OUT OF DRIVE. + MOVSI A,%HRDCL(Q) + HRRI A,%HMREC ;RECALIBRATE + PUSHJ P,RHSET ;MAYBE SHOULD TRY OFFSET FIRST? + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] + SETOM QSDU + JRST QINT1 ;LOOK FOR SOME OTHER TRANSFER + +QHE2: SKIPL QSCRW(C) ;HANG UP OR POSITIONING ERR (AFTER 5 TRIES) + JRST QERV3 ;IF READ, PERFORM RECOVERY + +QPE2D: MOVSI R,%QAPAR ;IRRECOVERABLE ERROR + IORM R,QSRAC(C) + AOS QIRRCV + MOVE D,QSGL(C) + MOVEM D,QIRCBK ;BLOCK # AT IRRCV ERR + MOVEM Q,QIRUNT ;SAVE UNIT TOO + CAILE C,NQCHN + AOS NIRSWE ;# IRRCV SWAPPING ERRS + MOVE I,Q + SKIPGE QTUTO(I) + JRST QPE2E ;DON'T MESS WITH LOCKED TUT + PUSHJ P,TUTPNT + CAIN B,TUTLK ;PRINT MESSAGE IF NOT YET LOCKED OUT + JRST QINTI + MOVEI B,TUTLK + DPB B,D +QPE2E: BUG INFO,[DSK: IRREC DATA ERR #],DEC,QIRRCV,[UNIT=],DEC,QIRUNT,[BLK=],OCT,QIRCBK + JRST QINTI + +QUDER1: MOVEI R,1(Q) ;TRY TO READ DIR FROM OTHER DISKS +QUDER2: CAIL R,NQS + MOVEI R,0 + CAME R,QDSKN(C) + JRST QUDER4 + JRST QDE1 ;NO OTHER DISK AVAIL TO READ FROM, TRY AGAIN + +QUDER4: SKIPGE QACT(R) + AOJA R,QUDER2 + HRRZM R,QDSKN(C) ;TRY THIS DISK +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QSDU1 ;FREE DRIVE FORMERLY HACKING + SETOM QTUNT1 + JRST T3UDE4 ] +];T300P +IFE DC10P, SETOM QSKT1(Q) ;FREE DRIVE FORMERLY HACKING +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] + SETOM QSDU + SETOM QTUNT +IFN T300P,T3UDE4: + MOVE E,QSGL(C) + MOVE Q,QDSKN(C) + SETZM QERRS(C) + JRST QINT5 + +QIDRCH: MOVE TT,QDIRP(C) ;CHNL IN C PNTR TO QSNUD IN J LOAD NEXT CHR INTO A + AOS QDIRP(C) ;ALSO RET BYTE PNTR IN TT + IDIVI TT,UFDBPW + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(J) + ADDI TT,UDDESC(I) + LDB A,TT + POPJ P, + +QMPDCH: MOVE TT,QDIRP(A) ;CHNL IN A PNTR TO QSNUD IN H LOADS NEXT CHR IN R + AOS QDIRP(A) ;USED AT M.P. LEVEL +QMPDC1: IDIVI TT,UFDBPW ;ALSO RETN BYTE PNTR IN TT + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(H) + ADDI TT,UDDESC(I) + LDB R,TT + POPJ P, + +;REACHED EOF ON READ +QEOF: SOS QDIRP(C) ;AVOID GC UNHAPPINESS + MOVSI I,%QAEFR + IORM I,QSRAC(C) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + AOS QSBFS(C) ;TO UNHANG M.P. WHICH IS WAITING FOR BUF TO APPEAR + JRST QINT2C + +QINT4C: +; 8/20/90 DM "funny" bit no longer supported. Allows for huge RP07 block +; numbers. Commenting this out means that %QAFNY can no longer get set +; under any circumstances, so I am leaving a certain amount of dead code in +; other places. +; IFN DMDSK,[ +; MOVSI E,%QAFNY +; ANDCAM E,QSRAC(C) +; TRZE A,20 ; FUNNY FILE BLOCK +; IORM E,QSRAC(C); INDICATE SO +; ] + MOVEI E,0 + DPB A,[140500,,E] + PUSHJ P,QIDRCH + DPB A,[060600,,E] + PUSHJ P,QIDRCH + DPB A,[0600,,E] + MOVEM E,QSLGL(C) + JRST QINT4G + +;DECODE UNBYTE SPEC IN D. +;RETURNS BYTE SIZE IN D, NUMBER OF UNUSED BYTES IN LAST WORD IN E. +QBDCD: TRZE D,400 + JRST [ IDIVI D,100 ? POPJ P, ] + TRZE D,200 + JRST [ IDIVI D,20 ? POPJ P, ] + SUBI D,44 + JUMPGE D,[ IDIVI D,4 ? POPJ P, ] + MOVNS D + SETZ E, + POPJ P, + +;ENCODE BYTE SIZE IN Q AND RESIDUE IN R INTO UNBYTE SPEC IN RH(Q) +QBENC: CAIG Q,3 + JRST [ IMULI Q,100 ? ADDI Q,400(R) ? POPJ P, ] + CAIG Q,7 + JRST [ IMULI Q,20 ? ADDI Q,200(R) ? POPJ P, ] + CAIG Q,18. + JRST [ IMULI Q,4 ? ADDI Q,44(R) ? POPJ P, ] + MOVNI Q,-44(Q) + POPJ P, + +QINT3: SKIPL DWUSR + JRST QINT3X ;DIR CHNL IN USE +IFN T300P,[ + SKIPGE QSDU ;DON'T GET PAST HERE UNLESS BOTH CONTROLLERS ARE IDLE + SKIPL QSDU1 + JRST QINT3X +];T300P + AOSL QDWFAR + JRST [ MOVNI H,10. + MOVEM H,QDWFAR + JRST .+3 ] + SKIPG QACTTM ;LAST ACTIVITY TOO RECENT + JRST QUDW + SKIPGE H,QMDRO + JRST QTDW + MOVE J,QACTB + TDNN J,H + JRST QTDW + MOVSI Q,-NQS +QMDW: SKIPGE QACT(Q) + JRST QMDWA ;UNIT NOT ACTIVE + MOVE J,DCHBT(Q) + TDNN J,QMDRO + JRST QMDWA + HRLI Q,(SETZ) ;INDICATE MFD WRITE IN PROGRESS + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMMDW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QMDRO + MOVE C,MDCHK(TT) + CAME C,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + HRRZ C,Q + CAMN C,MDSK + AOSA C,QAMDNO + MOVE C,QAMDNO + MOVEM C,MDNUM(TT) + SETZM DWUSR + MOVEI TT,MFDBLK + MOVEM TT,QSGL+NQCHN + HRRZ TT,QMDRO + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QMDWA: AOBJN Q,QMDW +QTDW: SKIPG QACTTM + JRST QUDW + MOVSI Q,-NQS +QTDW1: SKIPGE QACT(Q) + JRST QTDWA + MOVE J,DCHBT(Q) + SKIPL QTUTO(Q) + TDNN J,QTUTO(Q) + JRST QTDWA + MOVSI H,240000 + TDNE H,QTUTO(Q) + JRST QTDWA1 + MOVE TT,TIME ;DON'T WRITE TUTS TOO OFTEN + SUB TT,QTWRTM(Q) ;BECAUSE THE TUT IS LOCKED WHILE IT'S BEING WRITTEN + CAIGE TT,100. + JRST QTDWA + ADDM TT,QTWRTM(Q) + HRLI Q,200000 + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMTTW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QTUTO(Q) + MOVE H,QPKNM(Q) ;VERIFY THAT TUT IS NOT BEING CLOBBERED + MOVE C,QPKID(Q) + CAMN H,QPAKID(TT) + CAME C,QPKNUM(TT) + BUG HALT,[TUT ],DEC,Q,[CLOBBERED] + SETZM DWUSR + MOVEI TT,MFDBLK ;INITIATE WRITING OF FIRST BLOCK OF TUT + SUB TT,NTBL(Q) + MOVEM TT,QSGL+NQCHN + LDB TT,[121000,,QTUTO(Q)] + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QTDWA1: ANDCAM J,QTUTO(Q) +QTDWA: AOBJN Q,QTDW1 +QUDW: MOVSI C,-QNUD +QDW4A: MOVE J,QACTB ;BITS CORRESP TO ACTIVE DISKS +QDW4: SKIPE TT,QSNUD(C) + SKIPGE QSNLCN(C) + JRST QDW3 ;SLOT VACANT OR LOCKED + TDNE J,QSNLCN(C) + JRST QUDW1 ;NEEDS TO BE WRITTEN ON SOME UNIT +QDW3: AOBJN C,QDW4A +QINT3X: ;HERE IF DISK GOING IDLE. CLEAR DONE FLAG. + ;IN 2-CONTROLLER CASE, MAKE SURE WE ONLY DO IT TO THE RIGHT CONTROLLER. +IFN T300P,[ + SKIPL QSDU + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW +] ;T300P +IFN DC10P, CONO DC0,DCCLR+DCIENB+DSKCHN +IFN RP10P, CONO DPC,177710+DSKCHN ;MUST CLEAR "DONE" +IFN RH10P, CONO DSK,%HOCLR+%HOATN+%HORAE+DSKCHN +IFN RH11P, ;; RH11 doesn't need this? + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW + +QUDW1: MOVSI J,%QUDWM ;WRITE RIGHT AWAY IF %QUDWM IS ON + TDNN J,QSNLCN(C) + SKIPE QSFBT(C) ;OR DISK BLOCKS (AND CORE) WAITING TO BE FREED + JRST QUDW6 + SKIPG QACTTM ; ACTIVITY TOO RECENT + SKIPN QSNNR(C) ; THEN ONLY WRITE IF NOTHING POINTING TO DIRECTORY + SKIPA + JRST QDW3 + MOVSI Q,-NQS +QUDW4: SKIPGE QACT(Q) + JRST QUDW3 + MOVE J,DCHBT(Q) + TDNE J,QSNLCN(C) + JRST QUDW2 +QUDW3: AOBJN Q,QUDW4 + JRST QDW3 + +QUDW6: ANDCAM J,QSNLCN(C) ;TURN OFF %QUDWM + MOVE Q,MDSK ;AND WRITE ON MASTER DISK (ASSUME MDSK IS ACTIVE AND BIT IN QSNLCN IS SET) + +QUDW2: MOVE I,QMDRO + TLNE I,40000 ;IS THIS CODE OBSOLETE? LEFT FROM DAYS OF 1 MFD PER DRIVE? + JRST QUDW2B ;MASTER DIR NOT IN + HRRZS Q + CAMN Q,MDSK ;SKIP IF NOT WRITING ON MASTER DISK + PUSHJ P,QDIRCK ;BLESS THIS UFD!!! + MOVSI TT,(SETZ) + IORB TT,QSNLCN(C) ;LOCK USER DIRECTORY + MOVEI J,%QMUDW + HRRZM J,QSRAC+NQCHN + MOVE A,1(TT) ;NAME AREA PTR + MOVE J,QSNUD(C) + CAMN J,UDNAME(TT) ;MAKE SURE NOT ABOUT TO WRITE BAD DIRECTORY + CAILE A,2000 + JSP TT,QUDCLB + SUBI A,11. + IMULI A,6 + SKIPL J,(TT) + CAMLE J,A ;FS PTR BAD? + JSP TT,QUDCLB + CLEARM DWUSR + MOVEM Q,DWSKN + MOVE TT,QSNMI(C) + MOVEM TT,QSGL+NQCHN + HRRZ TT,QSNLCN(C) + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + HRRZM C,QDWIP + CLEARM QERRS+NQCHN + JRST QINT1 + +QUDW2B: ANDCAM J,QSNLCN(C) ;CLEAR BIT + GO AWAY + JRST QUDW3 + +;GENERALLY GET HERE BY JSP TT, +QUDCLB: BUG HALT,[DIR ],OCT,C,SIXBIT,QSNUD(C),[CLOBBERED] + +QDIRCK: PUSH P,TT ;CHECKS FILES FOR REASONABLE DESCRIPTORS - + ; PRECEDING BYTE =0, FIRST BYTE NOT=0 + HRRZ A,QSNLCN(C) + MOVEI B,1777(A) ;END OF NAMES + ADD A,1(A) ;BEGIN NAMES +QDIRC1: CAMG B,A + JRST POPTTJ ;DONE + SKIPN (A) + JRST QDIRC2 ;0 NAME=NO FILE + LDB TT,[1500,,UNRNDM(A)] ;DESC PTR + SOS TT ;TRICK - IF DESC PTR = 0 LDB BELOW GETS 0 BECAUSE P FIELD = 44 + IDIVI TT,6 + HLL TT,SBTBL(I) ;BYTE POINTER + ADDI TT,UDDESC-1777(B) + LDB I,TT + JUMPN I,QUDCLB + ILDB I,TT + JUMPE I,QUDCLB +QDIRC2: ADDI A,LUNBLK + JRST QDIRC1 + +IFN RP10P,[ +QPOSR: CAIL E,MBLKS + BUG ;TOO BIG EVEN FOR RP03 +IFN DMDSK,[ + IMULI E,SECBLK + IDIVI E,NSECS + SETZM D + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + DPB Q,[DUNFLD+D] +] +IFE DMDSK,[ + MOVEI D,0 + IDIVI E,NBLKSC + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + MOVE E,TT + IMULI E,NSSECS + IDIVI E,NHSECS + DPB E,[DSURF+D] + DPB TT,[DSECT+D] + DPB Q,[DUNFLD+D] +] + MOVE E,D + POPJ P, +] +IFN RH10P+RH11P,[ +IFE DMDSK, .ERR CHANGE QPOSR FOR 9-SECTOR BLOCKS! +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NBLKSC + HRLZ D,E ;CYLINDER IN LH + MOVEM E,QSPPS(Q) + MOVE E,TT + IMULI E,SECBLK + IDIVI E,NSECS + LSH E,8 + IOR E,D ;SURFACE IN 1.9-2.4 + IOR E,TT ;SECTOR IN 1.1-1.5 + POPJ P, +] ;RH10P+RH11P + +IFN DC10P,[ +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NSECS + MOVSI D,(DUNENB) + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + SKIPGE TT,QTRAN(Q) + ADDI E,NCYLS+XCYLS + DPB E,[DCYL+D] + MOVEM E,QSPPS(TT) + MOVE E,D + DPB TT,[DUNFLD+E] + DPB TT,[DUNFLD+QCHPRG] + SKIPGE TT,QPKID(Q) + JRST QPOSRI + DPB TT,[DPKID+E] + POPJ P, + +QPOSRI: MOVE TT,QTRAN(Q) ;NEED PACK ID BEFORE PROCEEDING + DPB TT,[DUNFLD+GPKID] + SETOM QSKT1(TT) + MOVEI A,TUTCYL + SKIPGE QTRAN(Q) + ADDI A,NCYLS+XCYLS + DPB A,[DCYL+GPKID] + MOVEM A,QPOS(TT) ;WILL SEEK TO HERE AUTOMATICALLY + MOVEM A,QPOSGL(TT) + DATAO DC0,[DJMP GPKID] + MOVEM Q,QSDU + SETOM PKIDM + JRST QINTX + +QSPKID: CONSZ DC1,1777 + BUG ;ERRORS + LDB TT,[DPKID+RPKID] + MOVEM TT,QPKID(Q) + SETOM QSDU + JRST QINT1 +] + +SUBTTL DISK IOT ROUTINES + +OVHMTR UUO ;MORE RANDOM UUOS + +;BECAUSE .ACCESS MERELY DROPS ITS ARG IN A VARIABLE AND SETS %QAACC, +;ALL IOT ROUTINES MUST TEST %QAACC AND DO THE REAL WORK OF CHANGING +;THE ACCESS POINTER IF NECESSARY. + +QBO: MOVEI T,BLKT + JRST QUO1 + + SKIPA T,[SIOKT] +QUIO: +QUAO: MOVEI T,CHRKT +QUO1: PUSH P,T + PUSH P,TT + PUSH P,D + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBWRA1 ;RANDOM ACCESS MODE HACK + POP P,D + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKT, SIOKT, OR BLKT +QBOV: SETZ QSMPRP(A) + QSMPRC(A) + QSBWG + SETZ QSBWW + JRST QOCL + TRNA + +QBI: MOVEI T,BLKT + JRST QUI1 + + SKIPA T,[SIOKT] +QUII: +QUAI: MOVEI T,CHRKTI +QUI1: PUSH P,T + PUSH P,TT + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBRRA1 + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKTI, SIOKT, OR BLKT +QBIV: QSMPRP(A) + QSMPRC(A) + QSBGB + QSBRB + JRST QICL + SKIPG QSBFS(A) + +QBWRA1: TLNE T,%QALNK + JRST IOCR10 + LDB T,[$QAMOD,,QSRAC(A)] ;SET RANDOM ACCESS PNTRS ON WRITE + SOJN T,QBWRA2 ;IN ORDINARY WRITE MODE + SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO BECOME IDLE OR HANG UP IN READ + PUSHJ P,UFLS ; WAITING FOR %QAACC TO TURN OFF + SKIPL QSGL(A) + PUSHJ P,UFLS + SKIPGE QSMDN(A) + JRST QBWRA2 + MOVE T,QRADAD(A) ;DESIRED ADDRESS + SUB T,QFBLNO(A) ;ACTUAL ADDRESS OF BEG OF CURRENT BUFFER + JUMPL T,QBWRA2 ;XFER ON BEFORE CURRENT BLOCK + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER IN BYTES + JUMPL T,QBWRA3 ;SAME BLOCK AS NOW +QBWRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QSOCL5 ;CLEAR ANY CURRENT BUFFERS ETC + PUSHJ P,QUDULK + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR ;LOCKS DIR IF SKIPS + JRST QBWRA4 ;OFF END OF FILE +QBWRA5: PUSHJ P,QUDULK +QBWRA9: POP P,C + POP P,I + POP P,R + CLEARM QSCRW(A) ;SWITCH TO WRITE OVER MODE + MOVSI Q,%QAMPU+%QAMWO ;SET UPDATE ADR AND WRITE OVER + IORM Q,QSRAC(A) + CLEARM QSMPRC(A) + MOVSI Q,%QAEFR+%QAEFW+%QAACC ;CLEAR EOF, WRITE EOF, AND ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD1 ;AND READ IN THE CURRENT BLOCK + HRRM Q,QSRAC(A) + POPJ P, + +QBWRA4: JUMPE Q,QBWRA0 + CAME J,Q ;MIGHT BE ADDING TO END OF FULL BLOCK + JRST IOCER2 + JRST QBWRA9 + +QBWRA0: PUSHJ P,QLWO ;OFF END OF FILE AND WAS ACCESSING WD 0 + MOVSI C,%QAACC ;SO SWITCH TO NORMAL WRITE MODE AND + ANDCAM C,QSRAC(A) ;TURN OFF RANDOM ACCESS BIT + POP P,C + POP P,I + POP P,R + POPJ P, + +QBWRA3: SKIPGE TT,QSMDN(A) + BUG ;NO BUFFER REALLY ACTIVE AT M.P. + MOVSI J,%QAWOV + TDNN J,QSRAC(A) + JRST QBWRA7 + ANDCAM J,QSRAC(A) ;WAS WRITING IN LAST BLK PAST EOF, + MOVN D,QSMPRC(A) ; UPDATE ACTIVE BYTE COUNT + ADDM D,QMPBSZ(A) ;DECREASE SIZE OF BUFFER TO AMT ACTUALLY WRITTEN +QBWRA7: LSH TT,10. ;ADDRESS OF BUFFER + MOVE T,Q ;SAVE RELATIVE BYTE ADDR WITHIN BUFFER + IDIVI Q,@QSBYTE(A) ;Q = WDS, J = BYTES + ADD TT,Q ;ADDRESS OF DESIRED WORD + HLL TT,QSBYTE(A) ;BYTE POINTER TO FIRST BYTE IN THAT WORD + JUMPE J,.+3 ;ADVANCE TO APPROPRIATE BYTE + IBP TT + SOJG J,.-1 + MOVEM TT,QSMPRP(A) + SUB T,QMPBSZ(A) ;MINUS # BYTES LEFT IN BLOCK + MOVNM T,QSMPRC(A) +QBRRA4: MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) + POPJ P, + +QSKFRC: MOVN B,QSMPRC(A) + ADD B,QMPBSZ(A) ;NUMBER OF BYTES WRITTEN IN BLOCK + MOVE C,QSRAC(A) + TLNE C,%QAMWO + TLNE C,%QAWOV + JRST [MOVEM B,QMPBSZ(A) ;IS LAST BLOCK, CHANGE LENGTH + PUSHJ P,QOCLPD ;AND PAD IT (GUARANTEED NO-OP IF WORD MODE CHNL) + JRST .+1 ] + SETZM QSMPRC(A) ;BUFFER WILL BE DISPOSED OF + MOVSI E,%QUDWM + SKIPGE QSMDN(A) + SETZB B,E ;NO BUFFER AFTER ALL + ADD B,QFBLNO(A) ;CURRENT POSITION IN FILE + MOVSI C,%QAACC + TDNN C,QSRAC(A) + MOVEM B,QRADAD(A) ;ACCESS BACK ON NEXT IOT + IORB C,QSRAC(A) + PUSHJ P,[TLNE C,%QAWOV ;WRITE OUT THE BUFFER + JUMPN E,QSBWO2 + JRST QSBWW ] + SKIPE QMPTC(A) + MOVSI E,%QUDWM + PUSHJ P,QOCL2 ;STORE QMPTC IF NECESSARY + IORM E,QSNLCN(H) ;WRITE OUT DIR FAST IF CHANGED + PUSHJ P,QUDULK + JRST POPJ1 + +;.CALL FINISH ON DISK OUTPUT CHANNEL +QSKFIN: HRRZ T,QSRAC(A) + CAIN T,%QMWOV ;IF WRITE-OVER MODE + JRST [ SKIPE QSCRW(A) ;THEN WAIT FOR IT TO SWITCH TO READ MODE + PUSHJ P,UFLS + JRST QSKFIN ] + CAIN T,%QMWRT ;IF WRITE MODE + JRST [ SKIPE QSBFS(A) ;THEN WAIT FOR ALL BUFFERS TO GET WRITTEN + PUSHJ P,UFLS + JRST .+1 ] + MOVE H,QUDPR(A) + MOVE T,MDSK ;HAS THE DIR BEEN CHANGED AND NOT WRITTEN + MOVE T,DCHBT(T) ;YET TO THE MASTER DISK? + TDNN T,QSNLCN(H) + JRST POPJ1 + MOVSI TT,%QUDWM ;YES, WRITE IT OUT IMMEDIATELY + IORM TT,QSNLCN(H) ;AND DON'T RETURN UNTIL IT IS WRITTEN + TDNE T,QSNLCN(H) + PUSHJ P,UFLS + JRST POPJ1 + +QBRRA1: TLNE T,%QALNK + JRST IOCR10 + SKIPGE QSMDN(A) + JRST QBRRA2 ;NO MAIN PRGM BUFFER + MOVE T,QRADAD(A) + SUB T,QFBLNO(A) + JUMPL T,QBRRA2 + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER + JUMPL T,QBRRA3 ;SAME BLOCK AS NOW +QBRRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QICLW1 ;STOP THE CHANNEL AND FLUSH CURRENT BUFFERS + MOVE A,D + CLEARM QSBFS(A) ;FLUSH POSSIBLE EXTRA AOSES WHEN PI HIT EOF + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST QBRRA5 ;OFF END OF FILE (DIR ALREADY UNLOCKED) + POP P,C + POP P,I + POP P,R + CLEARM QSMPRC(A) + MOVSI Q,%QAMPU + IORM Q,QSRAC(A) ;SET FLAG TO SET QSMPRP AND QSMPRC ON NEXT BUFFER LOAD + MOVSI Q,%QAEFR+%QAACC ;CLEAR EOF AND .ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD ;START READING AGAIN + HRRM Q,QSRAC(A) + JRST QUDULK + +QBRRA5: POP P,C + POP P,I + POP P,R + CAME J,Q + JRST IOCER2 ;ACCESS OFF END OF FILE IS ERROR + MOVSI TT,%QAEFR ;BUT ACCESS TO EXACTLY EOF IS OK + IORM TT,QSRAC(A) ;IMITATES WHAT QEOF DOES + AOS QSBFS(A) + SETZM QSMPRC(A) ;AND READS ZERO WORDS + JRST QBRRA4 + +QBRRA3: SKIPGE TT,QSMDN(A) + JRST QBRRA2 + JRST QBWRA7 + +;BLKT-SIOKT-CHRKT GET BUFFER ROUTINE FOR WRITE-OVER MODE. +QWOG1: SKIPGE QSCRW(A) ;FETCH BLOCK WRITEOVER MODE + JRST QWOG2 ;STILL WRITING PREVIOUS ONE, WAIT + MOVEI Q,%QMRD1 ;SWITCH INTO READ MODE + SKIPG QSBFS(A) ;IF A BUFFER HAS TO BE READ + HRRM Q,QSRAC(A) + SKIPG QSBFS(A) + PUSHJ P,UFLS + POP P,A +;BLKT-SIOKT-CHRKT GET-BUFFER ROUTINE FOR DISK INPUT. +QSBGB: MOVSI Q,%QAPAR + TDNE Q,QSRAC(A) + JRST QSBGB2 + CONO PI,UTCOFF + HRRZ Q,QBFP(A) + JUMPE Q,[MOVSI J,%QAEFR ;SAID TO BE BUFFERS, BUT NONE THERE + TDNN J,QSRAC(A) + BUG ;SHOULDN'T HAPPEN EXCEPT AT EOF + JRST QSBGB5 ] + LDB J,[MLO,,MEMBLT(Q)] + HRRM J,QBFP(A) + SKIPN J + SETZM QBFP(A) ;LAST BLOCK, LIST NOW EMPTY + HRRZ J,MEMPNT(Q) ;GET SIZE OF BUFFER IN BYTES + MOVEM J,QMPBSZ(A) + LDB TT,[$QAMOD,,QSRAC(A)] + SKIPN TT ;DONT SOS IF IN WRITE OVER MODE + SOS QSBFS(A) +QSBWG4: MOVE TT,Q + LSH TT,10. ;RETURN ADDR OF BUFFER + MOVEM Q,QSMDN(A) + CONO PI,UTCON + HLL TT,QSBYTE(A) + MOVSI Q,%QAMPU + TDNN Q,QSRAC(A) + JRST SIOBG2 + MOVE Q,QRADAD(A) ;DIDDLE PNTRS TO TAKE CARE OF RANDOM ACCESS WITHIN BLOCK + SUB Q,QFBLNO(A) ;DESIRED OFFSET WITHIN BLOCK + SUB J,Q + JUMPL J,IOCER2 ;OFF END OF FILE + JUMPL Q,IOCER2 ;OFF FRONT OF FILE (NEGATIVE .ACCESS PNTR) + PUSH P,J + IDIVI Q,@QSBYTE(A) + ADD TT,Q ;ADJUST BYTE POINTER + JUMPE J,.+3 + IBP TT + SOJG J,.-1 + POP P,J + MOVSI Q,%QAMPU ;NOW IS SAFE TO TURN OFF FLAG + ANDCAM Q,QSRAC(A) + JRST SIOBG2 + +;GET-BUFFER DETECTED EOF ON INPUT OR WRITE-OVER. +QSBGB5: CONO PI,UTCON + MOVE Q,QSRAC(A) + TLNE Q,%QALNK + JRST IOCR10 + LDB Q,[$QAMOD,,QSRAC(A)] + SOJN Q,POPJ2 ;ON INPUT, SKIP TWICE TO SIGNAL EOF. + PUSHJ P,QLWO ;LEAVE WRITE OVER MODE + JRST QSBWG ;START NORMAL WRITE + +QWOG2: SKIPGE QSCRW(A) ;WAIT FOR WRITE TO FINISH + PUSHJ P,UFLS + JRST POPAJ ;NOW RECYCLE AND WAIT FOR READ + +;LEAVE WRITE OVER MODE +QLWO: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + CONO PI,UTCOFF + SETZM QBFP(A) ;WRITEOVER MODE EXTEND FILE (SWITCH TO NORMAL MODE) + CLEARM QSBFS(A) + SETOM QSCRW(A) + MOVE Q,QSLGL(A) + HRRZM Q,QMPTN(A) ;STORE BASE TRACK + MOVSI Q,%QAEFR+%QAMWO ;CLEAR EOF AND WRITEOVER + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMWRT ;NORMAL WRITE MODE + HRRM Q,QSRAC(A) + CLEARM QMPTC(A) ;TRACK COUNT FOR TAKE N + SETOM QMTTR(A) ;NO TRACK RESERVED + SETOM QMFTP(A) ;GET NEW DECADE RESERVATION + CONO PI,UTCON + MOVE TT,QDIRP(A) ;SEE IF GARBAGE COLLECTION NEEDED + PUSH P,R + PUSH P,I + PUSHJ P,QMPDC1 ;CONV CHAR ADR TO BYTE PNTR (AND LDB IN R) + POP P,I + SKIPE R + BUG + MOVE R,QDIRP(A) + ADDI R,NXLBYT+2 + CAMGE R,@QSNLCN(H) + JRST QLWO1 ;DON'T NEED TO EXPAND F.S. + MOVEI R,LUNBLK(TT) + MOVE Q,QSNLCN(H) + SUBI R,(Q) + CAML R,UDNAMP(Q) + JRST QSBWG7 ;DON'T HAVE ROOM. GC + MOVEI R,3*6 ;HAVE ROOM + ADDM R,(Q) +QLWO1: +REPEAT NXLBYT+2,[ + ILDB R,TT + JUMPN R,QSBWG7 +] + JRST QSBWG8 ;OK + +QSBWG7: MOVSI R,%QAFUL ;NO ROOM, GC BEFORE COMMITTING NEXT TRACK + IORM R,QSRAC(A) +QSBWG8: POP P,R + JRST QUDULK + +QSBGB2: ANDCAM Q,QSRAC(A) ;DISK READ ERROR + JRST IOCER3 ;TELL USER + +;DISK OUTPUT GET-BUFFER ROUTINE. PRESERVES D FOR BENEFIT OF PDUMP. +QSBWG: MOVE Q,QSRAC(A) + TLNE Q,%QALNK+%QAACC ;DON'T WRITE TO LINK, DON'T LET PDUMP GET + JRST IOCR10 ; FAKED OUT BY USE FORCE OR ACCESS + PUSH P,A + TLNE Q,%QAMWO + JRST QWOG1 ;JUMP IF WRITE OVER MODE + HRRZ Q,QBFP(A) ;NORMAL MODE + JUMPE Q,QSBWG1 ;CAN ALWAYS HAVE ONE BUFFER + MOVE Q,QWBUFS + CAML Q,QWBFMX + JRST POPAJ ;TOO MANY WRITE BUFFERS QUEUED +QSBWG1: PUSHJ P,QSTWG + PUSHJ P,TCALL + JRST IOMQ + JRST QSBWG5 ;MEM FROZE OR NOT AVAILABLE + MOVE Q,(P) ;DISK CHNL # + DPB Q,[MNUMB,,MEMBLT(A)] + MOVEI Q,MU23B + DPB Q,[MUR,,MEMBLT(A)] + MOVE Q,A + POP P,A + AOS QSBFS(A) + AOS QWBUFS + HRRZ J,QSBYTE(A) + IMULI J,2000 + MOVEM J,QMPBSZ(A) ;FRESH BLOCK SIZE + JRST QSBWG4 + +QSTWG: MOVSI Q,%QAFUL + TDNE Q,QSRAC(A) ;ROUTINE TO COMMIT A TRACK + JRST QSTWG1 ;DIR FULL, NEED GC BEFORE GROWING FILE + MOVE H,QUDPR(A) ;IF THIS DIRECTORY HAS AN ALLOCATION + MOVE Q,QSNLCN(H) ; ENFORCE IT +IFN QRSRVP,[ + HRRZ J,UDALLO(Q) + JUMPE J,QSTWG0 ;NO ALLOCATION + HRRZ H,UDBLKS(Q) ;GET BLOCKS USED + CAML H,J + JRST IOCR13 ;HAS ALLOCATION AND USER IS TRYING TO EXCEED IT +] +QSTWG0: MOVE J,QDSKN(A) + SOSL QSFT(J) ;RESERVE A TRACK + POPJ P, + AOS QSFT(J) ;DISK FULL, GIVE BACK THE TRACK + SKIPE QFBTS ;WAIT FOR ANY PENDING FILE DELETIONS + PUSHJ P,UFLS ; TO COMPLETE AND FREE THEIR BLOCKS + SOSL QSFT(J) ;GOT SPACE NOW? + POPJ P, + AOS QSFT(J) ;NO, GIVE UP AND ERR OUT + JRST IOCER9 + +QSTWG1: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + PUSHJ P,QGC + JRST IOCR12 ;DIR FULL + PUSHJ P,QUDULK + ANDCAM Q,QSRAC(A) .SEE %QAFUL + JRST QSTWG + +QSBWG5: POP P,A ;GET BACK QSK CHANNEL # + MOVE J,QDSKN(A) + AOS QSFT(J) ;NO MEMORY; GIVE EVERYTHING BACK + POPJ P, + +;DISK OUTPUT RELEASE-BUFFER ROUTINE FOR BLKT, SIOKT, CHRKT. +QSBWW: SKIPGE QSMDN(A) ;WRITE BUFFER FROM MN PROG TO CHAIN FOR PI + POPJ P, ;NO WRITE BUFFER ACTIVE + LDB TT,[$QAMOD,,QSRAC(A)] + SOJE TT,QSBWO1 ;WRITE OVER MODE + SKIPL D,QMTTR(A) + JRST QTG1 ;TRACK ALREADY RESERVED + PUSH P,I + MOVE I,QDSKN(A) + PUSHJ P,QGTRK ;GET A TRACK + POP P,I + MOVEM D,QMTTR(A) +QTG1: MOVE H,QUDPR(A) ;TRACK IN D + PUSHJ P,QUDLK + MOVE TT,QSNLCN(H) + AOS UDBLKS(TT) + MOVE TT,QMPTN(A) ;GET PREVIOUS TRACK# + CAIN D,1(TT) + JRST QTG2 ;THIS TRACK IS CONSECUTIVE + SKIPN QMPTC(A) ;THIS TRACK NOT CONSEC CHECK COUNT OF PREV CONSEC BLOCKS + JRST QTG3 + PUSH P,D ;NON-ZERO SO STORE IN USER DIRECTORY + MOVE D,QMPTC(A) + CLEARM QMPTC(A) + PUSHJ P,QUDS + POP P,D +QTG3: MOVE J,QMTTR(A) ;DESCRIPTOR WILL BE STORED + MOVEM J,QMPTN(A) + SUB D,QMPTN(A) ;CAN TRACK BE SKIPPED TO? + SOJL D,QTG4 ;CAN'T BE SKIPPED TO (NOTE QMPTN HAS NOT BEEN AOS'D) + CAILE D,UDWPH-UDTKMX-1 + JRST QTG4 ;ALSO NO + ADDI D,UDTKMX ;NEXT BLOCK WITHIN N + PUSHJ P,QUDS ;STORE APPROPRIATE SKIP +QTG5A: +QTG5: MOVE Q,QSMDN(A) ;CORE BLOCK NUM BEING WRITTEN + MOVE D,QMPTN(A) ;TRACK NUM OF BLOCK ADDING TO FILE + HRLZM D,MEMPNT(Q) ;STORE TRACK NUM + SETOM QMTTR(A) ;INDICATE TRACK USED + MOVE J,QMPBSZ(A) ;LENGTH OF THIS BLOCK + ADDM J,QFBLNO(A) ;INCR BYTE ADR OF START OF CURRENT BLOCK IN FILE + HRRM J,MEMPNT(Q) ;SAVE BYTE COUNT + PUSH P,R + IDIVI J,@QSBYTE(A) ;CONVERT TO WORD COUNT + JUMPE R,QTG7 ;EXACT MULTIPLE OF WORD + AOS J + MOVNS R + ADDI R,@QSBYTE(A) ;# BYTES RESIDUE IN LAST WORD +QTG7: DPB J,[MWC,,MEMBLT(Q)] ;STORE ACTIVE WORD COUNT + MOVE D,QSRAC(A) + LDB TT,[$QAMOD,,QSRAC(A)] + TLNN D,%QALBK ;LAST BLOCK OF WRITE OVER POSSIBLY + SOJE TT,QTG6 ;WRITEOVER MODE AND NOT LAST BLOCK, DONT UPDATE LAST BLOCK WORD COUNT + MOVE H,QUDPR(A) ;SET UP DIRECTORY CHANNEL + MOVE D,QUDFPR(A) + ADD D,QSNLCN(H) + DPB J,[UNWRDC+UNRNDM(D)] ;SET WORD COUNT OF LAST BLOCK + LDB Q,[QSBSIZ(A)] + PUSHJ P,QBENC ;ENCODE BYTE CRUFT + DPB Q,[UNBYTE+UNREF(D)] + MOVE J,QACTB + IORM J,QSNLCN(H) +QTG6: POP P,R + PUSHJ P,QUDULK + MOVE Q,QSMDN(A) + MOVEI J,.BM MLO + ANDCAM J,MEMBLT(Q) ;SET END OF LIST INDICATOR IN MEMORY BLOCK + CONO PI,UTCOFF + HLRZ J,QBFP(A) ;STORE MEMORY BLOCK IN OUTPUT LIST + JUMPE J,QSBWW1 + DPB Q,[MLO,,MEMBLT(J)] +QSBWW2: HRLM Q,QBFP(A) + CONO PI,UTCON + SETOM QSMDN(A) ;MN PROG BUFFER NOW WRITTEN + JRST QSTRTR ;START ACTION IF 2311 IDLE AND RETURN + +QSBWO1: MOVE Q,QSRAC(A) ;PUT BUFFER IN WRITE-OVER MODE + TLNE Q,%QALBK ;IF NOT HACKING LAST BLOCK + TLNE Q,%QAEFW ;OR HACKING CLOSE + JRST QSBWO2 ;THEN JUST WRITE IT + HRRZ D,QSBYTE(A) + IMULI D,2000 + SUB D,QMPBSZ(A) + JUMPE D,QSBWO2 ;BLOCK REALLY FULL + TLNE Q,%QAMPU ;DID WE IOCER2 AT QSBWG4? + JRST IOCER2 ;YES, QSMPRP NOT SET UP, DON'T WRITE ANYTHING + MOVEM D,QSMPRC(A) ;LAST BLOCK NOT REALLY USED UP ("SPRUNG BACK TO LIFE") + ADDM D,QMPBSZ(A) ;EXTRA ROOM IN LAST BLOCK TO FILL UP + MOVSI D,%QAWOV + IORM D,QSRAC(A) ;FILLING LAST BLK PAST ORIG EOF + POPJ P, ;FINISH OUT BLOCK + +QSBWO2: MOVSI D,%QAWOV + ANDCAM D,QSRAC(A) + MOVE D,QSLGL(A) ;WRITE TRACK BACK WHERE IT CAME FROM + MOVEM D,QMPTN(A) ;PUT TRACK NO WHERE QTG5 CAN FIND IT + MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SETOM QSCRW(A) ;SWITCH TO WRITE MODE + MOVEI Q,%QMWOV + HRRM Q,QSRAC(A) + JRST QTG5 + + +QTG4: LDB D,[140500,,QMTTR(A)] ;WRITE LOAD ADDRESS + IORI D,40 + PUSHJ P,QUDS + LDB D,[060600,,QMTTR(A)] + PUSHJ P,QUDS + LDB D,[0600,,QMTTR(A)] + PUSHJ P,QUDS + JRST QTG5A + +QGTRK: PUSHJ P,QTLOCK ;GET TRK CHNL IN A DSK IN I RET IN D CLOBBERS E,TT,Q,J,B +QGTK4: PUSH P,R ;ENTER HERE FROM SWAP OUT WITH UTCOFF + PUSH P,B + PUSH P,E + HRRZ R,QTUTO(I) +QGTK4A: SKIPGE Q,QMFTP(A) + JRST QGTK3A ;FIRST TRACK + IDIVI Q,DECADE + HRREI J,-DECADE(J) ;COMPUTE TRACKS REMAINING IN DECADE + MOVE D,QMFTP(A) + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + MOVE TT,QMFTP(A) + EXCH D,TT +QGTK3: CAML D,QLASTB(R) + JRST QGTK3A ;REACHED END OF DISK + ILDB Q,TT + JUMPE Q,QGTK2 + AOJGE J,QGTK3A ;DECADE OUT + AOJA D,QGTK3 + +QGTK3A: CAILE A,NQCHN + JRST QGTK3C ;SWAP CHANNEL +QGTK3D: MOVEI Q,DECADE + ADDB Q,QTUTP(R) +QGTK3B: MOVEM Q,QMFTP(A) + CAMGE Q,QLASTB(R) + JRST QGTK4A + MOVE Q,QSWAPA(R) ;REACHED END OF DSK, RESET TO END OF SWAPPING AREA + ADDI Q,DECADE-1 ;ROUND UP TO A MULTIPLE OF A DECADE + IDIVI Q,DECADE + IMULI Q,DECADE + MOVEM Q,QTUTP(R) + JRST QGTK3B + +QGTK2: MOVEI B,1 + DPB B,TT + MOVEM D,QMFTP(A) + MOVE J,DCHBT(I) + IORM J,QTUTO(I) + POP P,E + POP P,B + POP P,R + CAILE A,NQCHN + POPJ P, ;CALLED FROM SWAP OUT + JRST QTULK + +QGTK3C: CAML D,QSWAPA(R) + JRST QGTK3D ;IN NON-SWAP AREA + AOS D + CAMN D,QSWAPA(R) + MOVEI D,NUDSL + MOVEM D,QMFTP(A) + JRST QGTK4A + ;STORE CHR IN D CHNL IN A USER DIR PNTR IN H +;CANNOT PCLSR NOR GC + +QUDS: PUSH P,I + PUSH P,Q + MOVE I,QDIRP(A) + CAIGE I,2000*UFDBPW + CAML I,@QSNLCN(H) ;UDESCP + BUG ;WRITING ABOVE F.S. PNTR? + AOS QDIRP(A) + IDIVI I,UFDBPW + MOVE Q,QBTBL(Q) + ADD Q,I + SKIPL I,QSNLCN(H) + BUG ;UFD WAS NOT LOCKED + ADDI Q,UDDESC(I) + LDB I,Q + CAIE I,UDWPH ;OK TO CLOBBER UDWPH (NORMALLY DOES AT START OF FILE) + JUMPN I,[JRST 4,.] ;ABOUT TO CLOBBER SOMETHING IN UFD + DPB D,Q + ILDB I,Q ;MAKE SURE FILE DESC WILL ALWAYS BE FOLLOWED BY ZERO + SKIPE I + BUG +REPEAT NXLBYT+2,[ ;MAKE SURE THERE'S ROOM FOR ONE MORE TRACK + ILDB I,Q + JUMPN I,QUDS1 +] + MOVE I,QDIRP(A) + ADDI I,NXLBYT+2 + CAMGE I,@QSNLCN(H) ;UDESCP + JRST QUDSX ;DESC AREA NOT COLLIDING WITH LIM OF DESC SPACE + MOVEI Q,LUNBLK(Q) + MOVE I,QSNLCN(H) + SUBI Q,(I) + CAML Q,UDNAMP(I) + JRST QUDS1 ;NO ROOM. + MOVEI Q,3*UFDBPW ;EXPAND DESC AREA + ADDM Q,UDESCP(I) + JRST QUDSX + +QUDS1: MOVSI Q,%QAFUL ;NEED GC BEFORE STARTING ON NEXT TRACK + IORM Q,QSRAC(A) +QUDSX: MOVE Q,QACTB + IORM Q,QSNLCN(H) ;SET DIRECTORY CHANGED + POP P,Q + POP P,I + POPJ P, + +QSBWW1: HRRM Q,QBFP(A) + JRST QSBWW2 + +QSBRB1: MOVE A,D +QSBRB: PUSH P,A + SKIPGE A,QSMDN(A) + JRST POPAJ + PUSHJ P,MEMR + POP P,A + HRRZ TT,QMPBSZ(A) + ADDM TT,QFBLNO(A) ;INCREMENT BYTE ADR IN FILE OF BEG OF NEXT BLOCK + SETOM QSMDN(A) + JRST QSTRTR + +QTG2: MOVE J,QMTTR(A) ;INDICATE WE WILL STORE DESCRIPTOR FOR NEXT TRACK. + MOVEM J,QMPTN(A) + AOS D,QMPTC(A) ;NEXT BLOCK IS CONSECUTIVE + CAIGE D,UDTKMX + JRST QTG5A + SETZM QMPTC(A) ;MAX # CONSECUTIVE BLOCKS, STORE DESC NOW + PUSHJ P,QUDS + JRST QTG5A + +SUBTTL DIRHNG DEVICE + +;WHENEVER THE DIRECTORY SPECIFIED AS THE SNAME WHEN DIRHNG IS OPENED +;IS MODIFIED, YOU GET AN INTERRUPT ON THE DIRHNG DEVICE CHANNEL. + +;HERE TO OPEN THE DIRHNG DEVICE. IOCHNM ADDR IN R, SNAME IN USYSN1(U). +DIRHO: MOVE C,USYSN1(U) + PUSHJ P,QFL ;LOOK UP THIS DIRECTORY + JRST OPNL20 ;CALL FAILS IF DIRECTORY DOES NOT EXIST. + HRRZM J,IOCHST-IOCHNM(R) ;DIR EXISTS; STORE TRACK NUMBER IN IOCHST. +DIRHP1: CONO PI,CLKOFF + HLLZ A,DIRHNG ;ADD THIS CHANNEL'S IOCHNM TO THE LIST OF DIRHNG CHANNELS. + HRRI A,DNDIRH + MOVEM A,(R) ;SET UP THE IOCHNM WITH IOTTB INDEX AND LIST CHAIN. + HRLZM R,DIRHNG + JRST CLKOJ1 + +;CLOSE A DIRHNG DEVICE CHANNEL. +DIRHCL: PUSHJ P,DIRHPS ;REMOVE IT FROM THE LIST, AND + SETZM (R) ;MARK IT CLOSED. + POPJ P, + +;IOPUSH A DIRHNG DEVICE CHANNEL. REMOVE IT FROM THE LIST OF ALL SUCH. +DIRHPS: MOVEI A,DIRHNG + CONO PI,CLKOFF +;FIND THE PLACE THAT POINTS AT THIS IOCHNM WORD. +DIRHC1: HLRZ B,(A) + CAIN B,(R) + JRST DIRHC2 + SKIPN A,B ;END OF LIST REACHED => + BUG ;THIS IOCHNM ISN'T IN THE LIST. BUT IT IS SUPPOSED TO BE! + JRST DIRHC1 + +;A POINTS AT IOCHNM THAT POINTS AT THIS ONE. PATCH THIS ONE OUT OF LIST. +DIRHC2: HLRZ B,(B) ;THE ONE AFTER THIS ONE + HRLM B,(A) + JRST CLKONJ + +;IOPUSH OR IOPOP THE DIRHNG CHANNEL WITH R -> IOCHNM WORD. I SAYS WHICH OPERATION. +DIRHIP: JUMPE I,DIRHPS ;IOPUSH REMOVES CHANNEL FROM LIST OF ALL DIRHNG CHANNELS. + +;IOPOP A DIRHNG DEVICE CHANNEL. JUST LIKE OPENING IT EXCEPT THAT +;THE DIRECTORY TRACK NUMBER IS ALREADY IN THE IOCHST. +;ALSO, WE SHOULD GIVE AN INTERRUPT NOW, +;IN CASE THE DIRECTORY WAS WRITTEN IN WHILE THE CHANNEL WAS PUSHED. +DIRHPP: PUSHJ P,DIRHP1 ;FIRST, REOPEN THE CHANNEL. LINK IT INTO THE DIRHNG LIST. + BUG + MOVE A,R + SUBI A,IOCHNM(U) ;COMPUTE CHANNEL NUMBER FROM IOCHNM WORD ADDRESS. + MOVE A,CHNBIT(A) ;GET BIT CORRESPONDING TO CHANNEL. + AND A,MSKST2(U) ;GIVE THE INT IF THE INT IS ENABLED. + IORM A,IFPIR(U) + POPJ P, + +;HERE WITH A/ DIRECTORY'S TRACK NUMBER (AS RETURNED BY QFL) +;TO SIGNAL A WRITE IN THAT DIRECTORY TO ALL DIRHNG DEVICES THAT ARE LOOKING. +;CLOBBERS B, C, D. +DIRSIG: CONO PI,CLKOFF + MOVEI B,DIRHNG +DIRSI0: HLRZ B,(B) ;GET IOCHNM ADDR OF NEXT DIRHNG DEVICE. + JUMPE B,CLKONJ + HRRZ C,IOCHST-IOCHNM(B) + CAIE C,(A) ;DOES IT LOOK AT THIS DIRECTORY? + JRST DIRSI0 + MOVEI C,-IOCHNM(B) ;YES => FIGURE OUT USER INDEX OF JOB IT BELONGS TO. + IDIVI C,LUBLK + IMULI C,LUBLK ;C NOW HAS USER INDEX. + MOVNI D,IOCHNM(C) + ADD D,B ;D GETS CHANNEL NUMBER + MOVE D,CHNBIT(D) + AND D,MSKST2(C) ;INTERRUPT THE USER ON THAT CHANNEL, IF IT'S ENABLED. + IORM D,IFPIR(C) + JRST DIRSI0 diff --git a/system/disk.1224 b/system/disk.1224 new file mode 100644 index 0000000..fd533d4 --- /dev/null +++ b/system/disk.1224 @@ -0,0 +1,6428 @@ +; I T S DISK SERVICE ROUTINES AND FILE SYSTEM -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +DSKVRS==.IFNM2 +IFN DC10P+RP10P+RH10P+RH11P-1, .ERR WRONG NUMBER OF DISK CONTROLLERS + +;GET DISK PHYSICAL PARAMETERS BY .INSRT'ING APPROPRIATE FILE + +IFN DC10P,[ +$INSRT DC10 +] + +IFN RP10P,[ +$INSRT RP10 +] + +IFN RH10P,[ +$INSRT RH10 +] + +IFN RH11P,[ +$INSRT RH11 +IFE KS10P, .ERR RH11 on something other than a KS10? +IFN RP06P+RP07P+RM03P+RM80P-1, .ERR WRONG NUMBER OF KINDS OF DISK DRIVE +IFN RP06P,[ +$INSRT RP06 +] +IFN RP07P,[ +$INSRT RP07 +] +IFN RM03P,[ +$INSRT RM03 +] +IFN RM80P,[ +$INSRT RM80 +] +] + +;GET FILE SYSTEM DEFINITIONS: +; MFD MASTER FILE DIRECTORY +; TUT TRACK (BLOCK) UTILIZATION TABLE +; UFD USER FILE DIRECTORY + +$INSRT FSDEFS + +IFN T300P,[ +$INSRT T300 +] + +SUBTTL MISC FILE SYSTEM CALLS + +ADMPCH: UMOVE A,(J) ;SET OR READ STATUS OF DUMP BIT OF FILE OPEN ON + ; CHNL IN AC(RH) + MOVEI T,POPJ1 ;MAKE CHNDCD SKIP RETURN IF ALL OK. + PUSHJ P,CHNDCD ;DECODE RH(A) AS CHNL NUM. + JRST ILUUO ;NO SKIP IMPLIES BAD CHNL NUM. + TLNN R,%CLSQ + JRST ILUUO ;NOT DISK CHANNEL. + PUSHJ P,QCHNLT ;DECODE THE CHNL FURTHER. + MOVSI B,400000 + TLNE A,400000 + IORM B,UNRNDM(C) + TLNE A,200000 + ANDCAM B,UNRNDM(C) + MOVE D,QACTB + TLNE A,600000 + IORM D,QSNLCN(H) + LDB A,[430100,,UNRNDM(C)] + PUSHJ P,QUDULK + JRST APTUAJ + +NRFDATE: PUSHJ P,QCHNLT ;READ FILE CREATION DATE WORD + MOVE A,UNDATE(C) +NRDM1: PUSHJ P,QUDULK + JRST POPJ1 ;STORE BACK IN USER MEM + +NSRDATE: PUSHJ P,QCHNLT ; SET REFERENCE DATE + HLRS B + DPB B,[UNREFD+UNREF(C)] + JRST NSDM1 + +NRESRDT: PUSHJ P,QCHNLT ; RESTORE REFERENCE DATE + HLRZ A,OLDRDT(R) ; WHOEVER CHOSE R IN QCHNLC SHOULD BE SHOT + DPB A,[UNREFD+UNREF(C)] + JRST NSDM1 + +NSFDATE: PUSHJ P,QCHNLT ;SET FILE CREATION DATE WORD + MOVEM B,UNDATE(C) +NSDM1: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QUDUL1: AOS (P) + JRST QUDULK + + +NRDMPBT: PUSHJ P,QCHNLT ;READ FILE DUMPED BIT + LDB A,[430100,,UNRNDM(C)] + JRST NRDM1 + +NSDMPBT: PUSHJ P,QCHNLT ;SET FILE DUMPED BIT + DPB B,[430100,,UNRNDM(C)] + JRST NSDM1 + +NLNKEDP: + PUSHJ P,QCHNLT ;RETURN NONZERO IF WE TRACED LINKS TO GET THIS FILE. + MOVE T,QSRAC(R) + LDB A,[.BP (%QALOP),T] + JRST NRDM1 + +NFILBLK:PUSHJ P,QCHNLT ;READ ALL 5 PARAMETERS OF NAME AREA + MOVE A,(C) + MOVE B,1(C) + MOVE D,3(C) + MOVE E,4(C) + MOVE C,2(C) + JRST NRDM1 ; UNLOCK DIR AND STORE ARGUMENTS + +QCHNLT: TLNN R,%CLSQ ;IS CHNL A DISK CHNL? + JRST [SUB P,[1,,1] ? JRST OPNL34] + HLRZ R,H + MOVE H,QUDPR(R) + PUSHJ P,QUDLK + MOVE C,QSNLCN(H) + ADD C,QUDFPR(R) + POPJ P, + +IFN QAUTHP,[ +ASAUTH: PUSHJ P,QCHNLT ;SET AUTHOR OF FILE + PUSH P,C + JUMPE B,ASAUT4 ;SETTING AUTHOR TO 0 + MOVE J,QSNMI(H) + CAMN B,QSNUD(H) + JRST ASAUT1 + MOVE C,B + PUSHJ P,QFL + SKIPA + JRST ASAUT1 + SETZM C + MOVEI J,5 + MOVE TT,[440600,,B] + MOVE I,[440600,,C] + ILDB D,TT + IDPB D,I +ASAUT2: ILDB D,TT + CAIG D,'Z + CAIGE D,'A + JRST ASAUT3 + IDPB D,I + SOJG J,ASAUT2 + JRST ASAUT4 + +ASAUT3: PUSHJ P,QFL +ASAUT4: SETOM J +ASAUT1: POP P,C + DPB J,[UNAUTH+UNREF(C)] + JRST NSDM1 + +ARAUTH: PUSHJ P,QCHNLT ;READ CREATOR OF FILE + LDB B,[UNAUTH+UNREF(C)] + MOVEI A,0 ;RETURN VALUE IS 0 IF UNKNOWN OR ILLEGAL AUTHOR + CAIL B,NUDSL + JRST NRDM1 + LSH B,1 + MOVEI B,2000-(B) + ADD B,QMDRO + MOVE A,(B) + JRST NRDM1 +];QAUTHP + +ASREAP: PUSHJ P,QCHNLT ;SET NO REAP BIT + DPB B,[.BP (UNREAP),UNRNDM(C)] + JRST NSDM1 + +ARQDAT: CONO PI,CLKOFF ;GET DSK TIME AND DATE + SKIPL A,QDATE + HRR A,TIMOFF + MOVE B,QDATEI ;2ND VALUE = DATE & TIME SYS CAME UP, IN DISK FORMAT. + CONO PI,CLKON + JRST POPJ1 + +ADSKUP: PUSHJ P,QCHNLT ;SET CREATION DATE, REF DATE AND CLEAR DUMP BIT + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(C) + HLRS TT + DPB TT,[UNREFD+UNREF(C)] + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(C) + JRST NSDM1 + +DELEWO: TLNN R,%CLSQ ;DELETE WHILE OPEN + JRST OPNL34 ;WRONG TYPE DEVICE + PUSHJ P,QCHNLT + PUSH P,W + PUSH P,C + MOVEI W,4 + MOVE A,UNFN1(C) ;Get names of file being hacked. + MOVE B,UNFN2(C) + MOVE C,QSNUD(H) + PUSHJ P,MNGDIR ;If this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. + POP P,C + POP P,W + MOVSI T,%QADEL ;SET DELETE BIT IN QSK CHNL + IORM T,QSRAC(R) + MOVSI T,UNCDEL ;AND IN FILE + IORM T,UNRNDM(C) + JRST NSDM1 + +;.CALL FILLEN +;RETURNS (1) FILE LENGTH IN BYTES (BYTE SIZE CURRENTLY OPEN IN) +; (2) BITS PER BYTE (BYTE SIZE CURRENTLY OPEN IN) +; (3) FILE LENGTH IN BYTES (BYTE SIZE WRITTEN IN) +; (4) BITS PER BYTE (BYTE SIZE WRITTEN IN) + +NFILLEN:PUSHJ P,QCHNLT + MOVE A,QSRAC(R) + TLNE A,%QALNK + JRST OPNL34 ;NOT A FILE + SKIPGE QSCRW(R) + TLNE A,%QAMWO + JRST NFILL1 ;READ CHANNEL OR WRITE-OVER, GET FILE'S STORED LENGTH. + MOVE A,QFBLNO(R);NORMAL WRITE, GET ACCESS POINTER. + SKIPGE QSMDN(R) + JRST NFILL2 ;NO BUFFER ACTIVE + ADD A,QMPBSZ(R) ;END OF CURRENT BUFFER + SUB A,QSMPRC(R) ;BACK UP TO CURRENT LOC +NFILL2: PUSHJ P,QUDULK + LDB B,[QSBSIZ(R)] ;CURRENT BYTE SIZE + MOVE D,B ;WRITTEN BYTE SIZE SAME AS CURRENT + MOVE C,A ;WRITTEN LENGTH SAME AS CURRENT + JRST POPJ1 + +NFILL1: LDB TT,[UNDSCP+UNRNDM(C)] + IDIVI TT,UFDBPW + HLL TT,QBTBLI(I) ;GET DESCRIPTOR POINTER + LDB E,[UNWRDC+UNRNDM(C)] + SKIPN E + MOVEI E,2000 ;E GETS NUMBER OF WORDS IN LAST BLOCK + LDB D,[UNBYTE+UNREF(C)] ;D GETS BYTE INFO + ANDI C,-2000 ;C GETS BASE ADDR OF DIR + ADDI TT,UDDESC(C) ;TT GETS DESC PNTR + SETOM A ;INITIALIZE NUMBER OF BLOCKS IN FILE + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE MINUS ONE + PUSHJ P,QUDULK + IMULI A,2000 ;NUMBER OF WORDS IN COMPLETE BLOCKS + ADD A,E ;ADD WORDS IN LAST BLOCK + PUSHJ P,QBDCD ;D GETS BYTE SIZE, E NUMBER OF RESIDUE BYTES + MOVEI Q,36. + IDIV Q,D ;Q GETS BYTES PER WORD + MOVE C,A ;C WRITTEN LENGTH, A CURRENT (B.S. DIFFERENT) + IMUL C,Q ;CONVERT WORD LENGTH TO BYTES + SUB C,E ;C NOW HAS CORRECT WRITTEN LENGTH + IMUL E,D ;E GETS NUMBER OF RESIDUE BITS + LDB B,[QSBSIZ(R)] ;B GETS BYTE SIZE OPENED IN + IMULI A,@QSBYTE(R) ;A GETS LENGTH IN THOSE SIZE BYTES + IDIV E,B ;NUMBER OF RESIDUE BYTES, -ROUNDING DOWN- + SUB A,E ;ADJUST THE LENGTH + JRST POPJ1 ;RETURN VALUES IN A,B,C,D + +NFLLN2: ADD A,B ; NEXT N BLOCKS +NFLLN1: ILDB B,TT ; GET NEXT DESC BYTE + JUMPE B,CPOPJ ; NO MORE + CAIG B,UDTKMX + JRST NFLLN2 ; TAKE-N + CAIGE B,UDWPH + AOJA A,NFLLN1 ; SKIP-N, TAKE-1 + CAIN B,UDWPH + JRST NFLLN1 ; IGNORE WRITE-PLACEHOLDER +REPEAT NXLBYT, IBP TT ; LOAD-ADDRESS, TAKE-1 + AOJA A,NFLLN1 + +;DIRSIZ - READ OR SET DISK QUOTAS, READ # BLOCKS IN ALL FILES IN DIRECTORY. +;1ST VALUE IS GRIM REAP QUOTA,,DIR SIZE +;2ND VALUE IS 0 OR PACK#,,ALLOCATION FOR DIR ALLOCATED TO SPECIFIC PACK +;LH OF 2ND ARG SETS GRIM REAP QUOTA; 3RD ARG SETS PACK#,,ALLOCATION +NDIRSI: MOVE D,C + PUSHJ P,QCHNLT + MOVE C,QSNLCN(H) + MOVE A,UDBLKS(C) + JUMPL B,NDIRS1 + CAIE W,1 + HLLM B,UDBLKS(C) +NDIRS1: MOVE B,UDALLO(C) + CAILE W,2 + MOVEM D,UDALLO(C) +IFN QRSRVP,[ + HLRZS D ;PACK ALLOCATED TO + SETO E, + JUMPE D,NDIRS2 + MOVEI E,NQS-1 ;UPDATE ALLOC DRIVE NUM + CAME D,QPKID(E) + SOJGE E,.-1 +NDIRS2: MOVEM E,QSALLO(H) +];QRSRVP + JRST NSDM1 + +SUBTTL DISK OPEN ROUTINES + +%DO==1,,525252 ;Special mode bits for disk opens. +%DOWOV==100000 ;Write over mode +%DONRF==10 ;Don't set ref-date +%DONLK==20 ;Don't chase links; actually open the link itself. +%DORWT==40 ;Make readers wait (used on opens for write or write-over). + +IFN TPLP+UNSPLP,[ +TPLO: MOVE C,[SIXBIT /.LPTR./] ;PSEUDO LINE PRINTER (DISC) + JUMPGE D,TPLO2 + MOVE B,UNAME(U) + AOS A,TPLFNO ;GENERATE RANDOM FILE NAME + JRST TPLO2 +] + +COMO: SKIPA C,[SIXBIT /COMMON/] ;.OPEN ENTRY FOR "COM" DEVICE +SYSO: MOVSI C,(SIXBIT /SYS/) ; " FOR "SYS" DEVICE +TPLO2: MOVEM C,USYSN1(U) + MOVNI I,1 + JRST QSKO + +QSKPO: MOVSI TT,-NQS ;PACK # OPEN + CAME I,QPKID(TT) + AOBJN TT,.-1 ;I <= PHYSICAL UNIT WITH SPECIFIED PACK + JUMPL TT,QSKPO1 + PUSHJ P,QPKNFP + JRST QSKPO + CAIE W,4 ;IF RENAME/DELETE, OK, DOESN'T TOUCH FILE ANYWAY + JRST OPNL16 ;OTHERWISE COMPLAIN PACK NOT MOUNTED +QSKPO1: HRRZ I,TT +QSKUO: CAIGE I,NQS ;DISK UNIT # OPEN + SKIPE QACT(I) ;I <= UNIT # + JRST OPNL10 ;BAD UNIT # OR NOT ENGAGED +IFE MCOND DM,[ ;; Security check in reserved pack feature only on DM. +IFN QRSRVP,[ + JUMPN W,QSKOB ;WRITE-OVER OR RENAME OK. + JUMPGE D,QSKOB ;READ OK. + SKIPE QRESRV(I) ;WRITE: IS PACK ON THIS DRIVE RESERVED? + JRST OPNL10 ;YES, CAN'T WRITE ON IT. +];QRSRVP +];DM + JRST QSKOB + +;DNRF: DEVICE IS LIKE DSK: BUT DOESN'T SET REFERENCE DATE +DNRFO: TRO D,%DONRF/2 ;SET MODE BIT AND DROP INTO QSKO + +; Regular DSK: device +; +; RH(D) has open mode, rotated 1 bit right. +; W has operation code (0=r/w, 2=link, 4=del/rnm, 1=wov) + +QSKO: MOVNI I,1 ;DSK OPEN, I <= # DETERMINED BY SYS +QSKOB: MOVEM I,EPDL(U) ;SAVE DISK # + MOVE C,USYSN1(U) + CAIN W,4 + JUMPE A,QSKOB2 ;IF RENAME OF OPEN FILE TRAP OUT +QSKOA: MOVE I,MDSK ;IS MFD IN? + PUSHJ P,QMCH1 ;READ IN MFD OF MASTER DISK + CLEARM QLD(U) ;LINK DEPTH +QSKOL: PUSHJ P,MFDCK + JRST SYSDS2 + JUMPN W,OPNL11 + JUMPL D,OPNL11 ;MUST BE NORMAL READ + JRST QMLSTF ;USER WANT TO READ THE MASTER DIRECTORY + +MFDCK: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + POPJ P, + JRST POPJ1 + +SYSDS2: PUSHJ P,QFLD ;H <= PTR TO USER DIR TABLE + PUSHJ P,QSKO1 ;LOSER DIR NOT IN CORE + SKIPG QSNNR(H) + BUG + PUSHJ P,QUDLK ;RETURN WITH SOS OF QSNNR ON LSWPR + MOVSI TT,40000 + TDNE TT,QSNLCN(H) + JRST QSKDP1 ;PAW OVER USER DIRECTORY +QSKDP2: PUSHJ P,QUDULK + PUSHJ P,FLDRCK + JRST QSKDP9 ;NOT SPECIAL DIRECTORY FILE + JUMPN W,QPNL11 + JUMPL D,QPNL11 + JRST QLISTF ;USER WANTS TO READ HIS USER DIRECTORY + +QSKDP9: JUMPN W,QSKDPY ;If doing IO? + SKIPL D ; and reading + JRST QSKDPZ ; then don't bother with "security". +QSKDPY: PUSHJ P,MNGDIR ;Else if this is a sanctified dir + PUSHJ P,SYSDSK ; get SYS job to tattle about it. +QSKDPZ: JUMPL D,QWRO ;WRITE + CAIN W,4 + JRST QRNAM ;RENAME/DEL + CAIN W,2 + JRST QALINK ;MAKE LINK + JUMPN W,QPNL22 +QWROR: JUMPE A,QPNL11 ;ALSO ENTER FOR VARIOUS WRITE OVER, COPY OVER MODES + JUMPE B,QPNL11 + PUSHJ P,QCHNF ;GET CHANNEL FOR READ + PUSHJ P,LOSSET + QCHNRT + PUSHJ P,QUDLK ;LOCK USER DIR + PUSHJ P,QLOOK ;LOOK UP FILE + JRST [ PUSHJ P,QROR1C ;Not found => decide whethe error or wait. + POPJ P, ;Error (error code already set up). + PUSHJ P,QUDULK ;If retrying, first unlock directory, + PUSHJ P,LSWPOP ;Return the channel, + PUSHJ P,UDELAY ;Wait a little while, + JRST QWROR] ;Try again. + TRNE D,3 ;SKIP IF UNIT ASCII MODE + JRST QSKO2 + MOVE J,[440700,,5] ;BYTE SIZE IS 7 BITS + MOVEM J,QSBYTE(E) +QSKO2: HLLZ J,QSBYTE(E) ;GET PROPER BYTE POINTER LH + MOVEM J,QSMPRP(E) + TRNN D,%DONRF/2 ;3.4 BIT IN OPEN IMPLIES DONT SET REFERENCE DATE + PUSHJ P,QFREF ;"REFERENCE" FILE + MOVE C,Q + SUB C,QSNLCN(H) + HRRZM C,QUDFPR(E) ;SET UP PTR FROM CHNL TO FILE NAME AREA + LDB TT,[UNDSCP+UNRNDM(Q)] ;FOUND FILE SET UP CHNL + MOVEM TT,QDIRP(E) ;SET UP CHAR PTR TO DESC AREA + MOVE C,UNRNDM(Q) + TLNE C,UNLINK + JRST QLINK ;FILE IS A LINK + MOVSI C,%QALOP + SKIPE QLD(U) ;IF WE TRACED A LINK TO OPEN THE FILE, REMEMBER THAT. + IORM C,QSRAC(E) + MOVSI C,%QARWT + TRNE D,%DORWT/2 + IORM C,QSRAC(E) + LDB J,[UNPKN+UNRNDM(Q)] ;GET PACK NUMBER FILE IS ON + MOVSI I,-NQS + CAME J,QPKID(I) + AOBJN I,.-1 ;TRANSLATE LOGICAL TO PHYSICAL DISK UNIT + JUMPGE I,QPKNF ;PACK NOT ON * + HRRZM I,QDSKN(E) ;SET CHNL DISK NUMBER + JUMPL D,QWROR1 ;REALLY WANT TO WRITE OVER, ETC + MOVEI TT,%QMRD ;PUT CHANNEL IN NORMAL READ MODE + HRRM TT,QSRAC(E) +QOEX1: PUSHJ P,QUDULK ;UNLOCK USER DIR + PUSHJ P,LSWDEL ;QUSR ENTRY + PUSHJ P,LSWDEL ;QSNNR ENTRY + SKIPG QSNNR(H) + BUG + PUSHJ P,QSTRTR + MOVE C,D + ROT C,1 + HRL A,E + JSP Q,OPSLC7 ;SET UP IOCHNM AND DEPART + DQUAI,,DQUAO + DQBI,,DQBO + DQUII,,DQUIO + DQBI,,DQBO + +QWROR1: SOJN W,OPNL12 ;NORMAL WRITE OVER MODE + HRRZS H ;CLEAR GARBAGE IN USER DIR NUM + HRRZS E ;CLEAR GARBAGE IN CHNL NUM + HRRZ J,QUDFPR(E) ;PICK UP LOCN OF FILE WITH U.F.D + MOVSI I,-NQCHN ;MAKE SURE THIS FILE NOT OPEN FOR READING +QROR1A: CAIE E,(I) ;DONT GET FAKED OUT BY OWN CHNL + SKIPGE QUSR(I) + JRST QROR1B + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1B + JRST OPNL23 + +QROR1B: AOBJN I,QROR1A + PUSHJ P,QAUTH + MOVSI TT,UNWRIT + IORM TT,UNRNDM(Q) ;SET WRITE BIT + MOVSI TT,UNDUMP + ANDCAM TT,UNRNDM(Q) + PUSH P,D + PUSH P,Q + PUSH P,R + PUSH P,E ;CONVERT FROM ORIGINAL BYTE SIZE TO ONE OPENED IN NOW + LDB D,[UNBYTE+UNREF(Q)] + PUSHJ P,QBDCD ;GET INFO FROM ORIGINAL WRITE OF FILE + MOVEI Q,36. + IDIV Q,D ;BYTES PER WORD + SUB Q,E ;# VALID BYTES + IMUL Q,D ;VALID BITS IN LAST WORD + POP P,E ;RESTORE QSK CHNL # + HRRZ R,QSBYTE(E);BYTES PER WORD IN NEW BYTE SIZE + LDB J,[QSBSIZ(E)] ;BITS PER BYTE IN NEW BYTE SIZE + IDIV Q,J ;NUMBER OF NEW-SIZE BYTES IN LAST WORD + SUB R,Q ;RESIDUE IN NEW-SIZE BYTES + LDB Q,[QSBSIZ(E)] ;NEW BYTE SIZE + PUSHJ P,QBENC ;RH(Q) GETS NEW BYTE INFO + MOVE R,-1(P) + DPB Q,[UNBYTE+UNREF(R)] ;CLOBBER FILE'S BYTE SIZE + POP P,R + POP P,Q + POP P,D + CONO PI,CLKOFF + SKIPL TT,QDATE + HRR TT,TIMOFF + CONO PI,CLKON + MOVEM TT,UNDATE(Q) + HLRS TT + DPB TT,[UNREFD+UNREF(Q)] + HLLM TT,OLDRDT(E) + MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVSI TT,%QAMWO ;WRITE OVER MODE + IORM TT,QSRAC(E) ;LEAVE %QMIDL UNTIL FIRST .IOT SINCE + JRST QOEX1 ; THE USER WILL PROBABLY DO A .ACCESS + +;Call here if lookup fails on open. +;Either signal some error and return, +;or skip-return if caller should wait and retry the lookup. +;Assumes H has dir slot, Q has address of filename block, +;E has channel number allocated for this open. +;Clobbers C, J. +QROR1C: HRRZ C,QSNLCN(H) + SUBI Q,-LUNBLK(C) + SKIPL Q ;SEE IF STILL POINTED INSIDE DIR + CAILE Q,2000-LUNBLK + JRST QROR1D ;NO - REALLY FNF + ADDI Q,(C) + CAMN A,UNFN1(Q) ;DO NAMES MATCH? + CAME B,UNFN2(Q) + JRST QROR1D ;NO - REALLY FNF + HRRZ J,Q ;Find channel that has this file open. + SUB J,QSNLCN(H) + ANDI J,-1 + HRRZS H ;Clear garbage in user dir num + HRRZS E ;Clear garbage in chnl num + MOVSI I,-NQCHN +QROR1E: CAIE E,(I) ;Dont get faked out by our own chnl. + SKIPGE QUSR(I) + JRST QROR1F + CAMN H,QUDPR(I) + CAME J,QUDFPR(I) + JRST QROR1F +;Found the channel. Does it want us to wait? + MOVE I,QSRAC(I) + TLNN I,%QARWT + JRST OPNL23 ;He didn't say so => get "file locked". + JRST POPJ1 + +QROR1F: AOBJN I,QROR1E + JRST POPJ1 ;Cannot find channel => maybe was closed. Retry. + +QROR1D: SKIPN QLD(U) + JRST OPNL4 ;FILE NOT FOUND + JRST OPNL47 ;LINK WAS FOUND, BUT NOT THE FILE IT POINTED TO + +;COME HERE FOR RENAME-WHILE-OPEN +QSKOB2: HRRZ A,B ;DO RENAME WHILE OPEN HERE TO AVOID + CAIL A,20 ;IN CASE SYS NAME HAS CHANGED + JRST OPNL14 + SKIPE SRN3(U) + SKIPN SRN4(U) + JRST OPNL11 + ADD A,U + HLRZ E,IOCHNM(A) + MOVE H,QUDPR(E) + MOVE A,SRN3(U) + MOVE B,SRN4(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL11 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL11 + PUSHJ P,QUDLK + MOVE Q,QUDFPR(E) + ADD Q,QSNLCN(H) + PUSHJ P,QGRLSC ;EITHER NAME > OR FROM POINTER + MOVE I,D ;I => TO POINTER + HRLOI E,377777 ;PREVIOUS FN1 (BIT 4.9 COMPLEMENTED) + MOVE W,E ;FN2 + MOVEI J,0 ;J NEGATIVE => NEED SORT, NON-ZERO => DIR MODIFIED +QSKDP4: SUBI I,LUNBLK +QSKDP5: SUBI D,LUNBLK + CAMLE C,D + JRST QSKDP8 ;THROUGH + SKIPN A,UNFN1(D) + SKIPE UNFN2(D) + JRST QSKDP3 + HLLOS J + JRST QSKDP5 ;NAME BLOCK FREE + +QSKDP3: MOVE Q,UNRNDM(D) + TLNN Q,UNIGFL + JRST QSKDPR ;NOT OPEN FOR WRITE OR BEING DELETED + HLLOS J ;NEED TO WRITE OUT DIR + SKIPN A,UNFN1(D) + MOVSI A,(SETZ) + SKIPN B,UNFN2(D) + MOVSI B,(SETZ) +QSKDP7: PUSHJ P,QGRLSC ;DON'T CREATE ANY FILE WITH NAME OF < OR > + AOJA A,QSKDPA ;CHANGE BOTH JUST TO BE SURE + AOJA A,QSKDPA + MOVE Q,QSNLCN(H) ;SEE IF THAT NAME EXISTS + MOVEI Q,2000-LUNBLK(Q) ;THERE MAY BE DUPLICATE ENTRIES +QSKDPU: CAMN A,UNFN1(Q) ;DURING THIS SEARCH BUT IT DOESN'T + CAME B,UNFN2(Q) ;MATTER + JRST QSKDPT + CAIE Q,(D) ;DON'T CHANGE NAME IF NOT DUPLICATE +QSKDPA: AOJA B,QSKDP7 ;FOUND IT. CHANGE SECOND NAME +QSKDPT: SUBI Q,LUNBLK + CAMG C,Q + JRST QSKDPU + MOVEM A,UNFN1(D) + MOVEM B,UNFN2(D) + MOVSI Q,UNIGFL + ANDCAM Q,UNRNDM(D) +QSKDPR: CAMN D,I + JRST QSKDP6 + HRLZ Q,D ;RELOCATE FILE BLOCK + HRR Q,I + BLT Q,LUNBLK-1(I) +QSKDP6: JUMPL J,QSKDP4 ;ALREADY NEEDS SORT + MOVE B,UNFN2(D) ;MAY NOT HAVE YET IF GOT HERE FASTEST WAY + TLC A,(SETZ) + TLC B,(SETZ) + EXCH A,E + EXCH B,W + CAMLE A,E + JRST QSKDP4 ;ORDER OK + CAMN A,E + CAMGE B,W + MOVNI J,1 ;NEED SORT + JRST QSKDP4 + +QSKDP8: ADDI I,LUNBLK ;I POINTED TO EMPTY SLOT + MOVE D,I + SUBI D,(TT) + EXCH D,UDNAMP(TT) + ADDI D,(TT) + CAML D,I + JRST QSKDPV + SETZM (D) ;CLEAR VACATED AREA + HRLS D + ADDI D,1 + BLT D,-1(I) +QSKDPV: JUMPL J,QSKDPS ;SORT + TRNN J,-1 + JRST QSKDPK +QSKDPX: MOVE I,QACTB + IORM I,QSNLCN(H) +QSKDPK: MOVE W,QSNLCN(H) +IFN QRSRVP,[ + HLRZ A,UDALLO(W) ;IF THIS DIR HAS ALLOCATION + JUMPE A,QSKBK0 + MOVEI B,NQS-1 ;CONVERT PACK # TO DRIVE # + CAME A,QPKID(B) + SOJGE B,.-1 + SKIPGE A,B +QSKBK0: SETO A, ;ALLOCATED PACK NOT MOUNTED, USE ANY + MOVEM A,QSALLO(H) ;SAVE DRIVE # (-1 IF NONE) +];QRSRVP + HLLZS UDBLKS(W) + MOVE A,UDNAMP(W) + ADDI A,(W) +QSKBK1: CAIL A,2000(W) ;COUNT BLOCKS USED + JRST QSKBK2 + MOVE B,UNRNDM(A) + TLNE B,UNLINK + JRST QSKBK3 + LDB B,[UNDSCP+UNRNDM(A)] + IDIVI B,UFDBPW + HLL B,QBTBLI(C) + ADDI B,UDDESC(W) ;B GETS BYTE PNTR TO DESC +QSKBK4: ILDB C,B + JUMPE C,QSKBK3 + CAIN C,UDWPH + JRST QSKBK4 + CAIG C,UDTKMX + JRST [ADDM C,UDBLKS(W) ? JRST QSKBK4] + CAIG C,UDWPH + JRST [AOS UDBLKS(W) ? JRST QSKBK4] + REPEAT NXLBYT, IBP B + AOS UDBLKS(W) + JRST QSKBK4 + +QSKBK3: ADDI A,LUNBLK + JRST QSKBK1 + +QSKBK2: POP P,W + POP P,I + POP P,D + POP P,C + POP P,B + POP P,A + JRST QSKDP2 + +QSKDPS: MOVEI T,LUNBLK + ADD P,[3,,3] +QSKDPB: MOVEI Q,(I) ;BEGINNING OF NAME AREA + SKIPGE T + MOVEI Q,2000-LUNBLK(TT) ;START AT END + MOVEI W,2000(TT) + SKIPGE T + MOVEI W,-LUNBLK(I) + SETZM (P) + TDZA J,J ;0 => SORTED -1 => MAKE ANOTHER PASS +QSKDPE: ADD Q,T + CAIE Q,(W) + JRST QSKDPC + JUMPE J,QSKDPW + MOVNS T + JRST QSKDPB + +QSKDPW: SUB P,[3,,3] + JRST QSKDPX + +QSKDPC: SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + JRST QSKDPD + BUG + +QSKDPD: MOVE B,UNFN2(Q) + TLC A,(SETZ) + TLC B,(SETZ) + SKIPE E,(P) ;FIRST ENTRY + JRST QSKDPF +QSKDPG: MOVEM A,-2(P) + MOVEM B,-1(P) +QSKDPI: MOVEM Q,(P) + JRST QSKDPE + +QSKDPF: JUMPL T,QSKDPJ + CAMLE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAML B,-1(P) + JRST QSKDPG +QSKDPH: REPEAT LUNBLK,[ + EXCH A,.RPCNT(E) + EXCH A,.RPCNT(Q) + EXCH A,.RPCNT(E) +] + MOVNI J,1 + JRST QSKDPI + +QSKDPJ: CAMGE A,-2(P) + JRST QSKDPG + CAME A,-2(P) + JRST QSKDPH + CAMG B,-1(P) + JRST QSKDPG + JRST QSKDPH + +SUBTTL OPEN FOR WRITE + +;RETURNS WITH QUSR(E) AND QSNLCN(E) ON LSWPR +QWRO2: JUMPE A,QPNL11 + JUMPE B,QPNL11 + SKIPGE I,EPDL(U) ;PICK UP DESIRED DISK UNIT + JRST QWRO2A ;SYSTEMS CHOICE +QWRO2B: CAIGE I,NQS + SKIPE QACT(I) + BUG ;WE LOST SOMEHOW... + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) ;TUT IN BUT NOT PAWED OVER + TLNE TT,40000 ;TUT NOT IN + PUSHJ P,QTCH1 ;READ IN TUT OF DISK INVOLVED + PUSHJ P,QCHNF ;GET CHANNEL + PUSHJ P,LOSSET + QCHNRT + MOVE TT,[440700,,5] + TRNN D,3 + MOVEM TT,QSBYTE(E) ;UNIT ASCII MODE, BYTE SIZE=7 + PUSHJ P,QUDLK ;LOCK USER DIRECTORY + PUSHJ P,QGRLSC ;CHECK < AND > + JRST QPNLBN ;LOSE + PUSHJ P,QFNG ;REPLACE WITH COMPUTED EFFECTIVE NAME + PUSHJ P,QFREEF ;FIND FREE FILE NAME AREA AND STORE IN QDIRP(E) + JRST QFDF ;FILE DIR FULL + MOVSI TT,UNWRIT ;SET WRITE IN PROGRESS + IORM TT,UNRNDM(Q) + MOVE TT,QPKID(I) + DPB TT,[UNPKN+UNRNDM(Q)] + PUSHJ P,QAUTH ;SET FILE AUTHOR, MAY NOT PCLSR + MOVE TT,QACTB + IORM TT,QSNLCN(H) + SETOM QSCRW(E) ;SET CHNL WRITE SWITCH + POPJ P, + +QWRO2A: +IFN QRSRVP,[ + SKIPL I,QSALLO(H) + JRST QWRO2B ;THIS DIR GOES ON A PARTICULAR UNIT +] + SKIPGE I,QWRU ;GET CURRENT WRITING UNIT + JRST QWRO2E ;NO CURRENT UNIT, GO FIND ONE + MOVE TT,QSFT(I) + CAML TT,QFTTHR + JRST QWRO2B ;ENOUGH ROOM ON PREFERRED UNIT +QWRO2E: SETOB T,I ;NOT MUCH SPACE LEFT TRY OTHER UNITS + MOVSI E,-NQS +QWRO2C: SKIPGE QACT(E) ;SKIP ON UNIT ACTIVE + JRST QWRO2D +IFN QRSRVP,SKIPN QRESRV(E) ;DONT CHOOSE THIS PACK IF RESERVED + CAML T,QSFT(E) ;NOTE QSFT IS -1 IF TUT NEVER BEEN READ IN + JRST QWRO2D ;OTHERWISE CONTAINS VALID BLOCK COUNT + MOVE T,QSFT(E) + HRRZ I,E +QWRO2D: AOBJN E,QWRO2C + SKIPGE I + BUG ;NO ACTIVE UNRESERVED UNITS + CAMN I,QWRU + JRST QWRO2B ;DON'T WRITE MFD IF UNCHANGED + MOVEM I,QWRU + MOVE E,QACTB + IORB E,QMDRO + MOVEM I,MPDWDK(E) + JRST QWRO2B + +QWRO: JUMPN W,QWROR ;REALLY WANT TO MODIFY OR OTHERWISE HACK AN EXISTING FILE + PUSHJ P,QWRO2 ;MAKING NEW FILE, DECIDE WHICH UNIT TO PUT IT ON + SETOM QMFTP(E) ;TRACK TO SCAN IN TUT + SETOM QMTTR(E) + CLEARM QMPTN(E) + CLEARM QMPTC(E) + MOVEI TT,%QMWRT ;ENTER NORMAL WRITE MODE + HRRM TT,QSRAC(E) + MOVSI TT,%QARWT + TRNE D,%DORWT/2 + IORM TT,QSRAC(E) + JRST QOEX1 ;EXIT + + +SUBTTL File hacking tracking + +; MNGDIR checks the file name (sname in C) +; Fails to skip if the file is an important system file. +; Skips if the file is of the everyday sort. + +MNGDIR: HLRZ TT,C +IFN KL10P, CAME C,[SIXBIT /.KLFE./] + CAIN TT,'SYS ;A sys directory? + POPJ P, + CAME C,[SIXBIT /ACOUNT/] + CAMN C,[SIXBIT /./] + POPJ P, + CAME C,[SIXBIT /DEVICE/] + CAMN C,[SIXBIT /CHANNA/] + POPJ P, + AOS (P) ;Not a system directory. skip return. + POPJ P, + +; SYSDSK notifies the SYS job to print a message on the +; console about the file being hacked. +; File names in C;A B, the opcode in W (or zero) specifies the hacking. + +SYSDSK: JUMPE U,CPOPJ ;Avoid deadly embrace! + MOVSI T,SCLWRT ;Writing on SYS directory. + PUSHJ P,CWAIT ;Take turns like nice little lusers. + TDNE T,SUPCOR ;Wait for previous req to finish. + MOVE TT,W ;Check file operation code. + CAILE TT,4 ;If impossible opcode + SETZ TT, ; probably supposed to be R/W. + MOVEM TT,SWMOD ;Store opcode. + MOVE TT,UNAME(U) + MOVEM TT,SWUNAM ;Luser. + MOVE TT,JNAME(U) + MOVEM TT,SWJNAM + MOVEM A,SWFN1 + MOVEM B,SWFN2 + MOVEM C,SWFN3 ;Sname. + IORM T,SUPCOR ;Notify the SYS job. + JRST CLKONJ ;Turn on the clock and return. + + +SUBTTL DIRECTORY ROUTINES + +QFREEF: PUSH P,A ;Q_PTR TO USER DIR FREE FILE QDIRP(E)_PTR TO FREE DESC AREA + PUSH P,B ;GET FREE FILE AREA + PUSH P,I + MOVEI I,0 ;SIGNAL NO GC YET +QFREFA: SETZM QUDFPR(E) ;CLEAR SO WILL NOT POINT TO RANDOMNESS IN CASE OF G C + MOVE TT,QSNLCN(H) + SKIPL Q,UDESCP(TT) + CAIL Q,2000*UFDBPW + BUG ;FREE DESC POINTER OUT OF RANGE + IDIVI Q,UFDBPW + MOVE C,UDNAMP(TT) + CAIL Q,-UDDESC-7-LUNBLK(C) + JRST QAGARB ;NOT ENOUGH ROOM BETWEEN DESC AND NAME AREAS + PUSHJ P,QLGLK ;FIND WHERE FILE OUGHT TO GO + JRST QFREFF ;DIR WAS EMPTY + TRNN J,1777 + JRST QFREFE ;GOES AT END OF DIR +QFREFC: CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QFREFE + MOVE C,UNRNDM(J) + TLNE C,UNIGFL ;* FILES MUST COME AFTER NON * FILES + JRST QFREFE ;OF SAME NAME + ADDI J,LUNBLK + CAIGE J,2000(TT) + JRST QFREFC +QFREFE: CAMN Q,J + JRST QFREFF ;GOES AT BEGINNING + PUSHJ P,QINSRT + JRST QFREFD + +QFREFF: SUBI Q,LUNBLK ;Q -> NAME BLOCK FILE WILL GO IN +QFREFD: MOVNI T,LUNBLK ;ALLOCATE MORE SPACE FOR NAME AREA + ADDM T,UDNAMP(TT) + HRRZ A,UDESCP(TT) ;FIRST FREE DESCRIPTOR LOC + DPB A,[UNDSCP+UNRNDM(Q)];STORE IN FILE AREA + MOVEM A,QDIRP(E) ;STORE IN CHANNEL + MOVEI B,6*UFDBPW+1 ;ENOUGH FOR A LINK WITH EVERY CHAR QUOTED PLUS ONE ZERO + ADDM B,UDESCP(TT) ;ALLOCATE MORE SPACE FOR DESC AREA + MOVE B,Q + SUB B,QSNLCN(H) + HRRZM B,QUDFPR(E) ;ASSOCIATE CHANNEL WITH FILE + CONO PI,CLKOFF + SKIPL B,QDATE ;GET TIME AND DATE + HRR B,TIMOFF + CONO PI,CLKON + MOVEM B,UNDATE(Q) ;SET CREATION DATE + HLLM B,OLDRDT(E) + HLRS B + DPB B,[UNREFD+UNREF(Q)] ;SET REFERENCE DATE + IDIVI A,UFDBPW ;GET WRD AND CHAR ADRS + HLLZ B,QBTBLI(B) + ADDI B,UDDESC(A) + HRRZ A,QSNLCN(H) + ADD B,A + ILDB A,B + SKIPE A + BUG ;DESCRIPTOR AREA ALREADY OCCUPIED + MOVEI A,UDWPH + DPB A,B + ILDB A,B + SKIPE A + BUG ;NOT FOLLOWED BY ZERO + POP P,I + POP P,B + POP P,A + MOVEM A,UNFN1(Q) ;SET FILE NAMES + MOVEM B,UNFN2(Q) + JRST POPJ1 + +QAGARB: JUMPL I,QNOFRE ;IF GC WAS ALREADY TRIED, DON'T TRY IT AGAIN - GIVE UP. + PUSHJ P,QGC ;GC. BTW, IT IS OK TO PCLSR HERE. + JFCL + MOVNI I,1 ;SIGNAL GC HAS BEEN TRIED + JRST QFREFA + +;MAKE ROOM FOR FILE BEFORE J. Q POINTS TO NEW EMPTY FILE SLOT +QINSRT: PUSH P,A + PUSH P,TT + HRRZ TT,QSNLCN(H) + HRRZ A,UDNAMP(TT) + PUSH P,A + ADDI A,(TT) + HRLS A + SUBI A,LUNBLK + BLT A,-LUNBLK-1(J) + SETZM -LUNBLK(J) + HRRZI A,-LUNBLK+1(J) + HRLI A,-LUNBLK(J) + BLT A,-1(J) + SUB J,QSNLCN(H) + MOVSI A,-NQCHN +QINSR1: HRRZ TT,QUDPR(A) + SKIPL QUSR(A) + CAIE TT,(H) + JRST QINSR2 + MOVE TT,QUDFPR(A) + CAMGE TT,(P) + JRST QINSR2 + CAIGE TT,(J) + SUBI TT,LUNBLK + MOVEM TT,QUDFPR(A) +QINSR2: AOBJN A,QINSR1 + ADD J,QSNLCN(H) + HRRZI Q,-LUNBLK(J) + SUB P,[1,,1] + POP P,TT + POP P,A + POPJ P, + +;DIR NOT IN CORE. GET IT FROM DISK, CREATE IT IF DOESN'T ALREADY +; EXIST, OR GIVE NO SUCH DIRECTORY ERROR. +;C HAS SNAME. RETURNS DIRECTORY NUMBER IN H. + +QSKO1: PUSHJ P,SWTL + QSKOSW ;PREVENT TIMING ERROR IF TWO PCS SHOULD + PUSHJ P,QFLD ; ATTEMPT TO BRING IN SAME DIRECTORY + JRST QSKO11 + MOVEI T,2 ;SOMEONE ELSE BROUGHT IT IN, RELEASE QSKOSW + JRST LSWPON ;BUT LEAVE QSNNR(H) LOCKED. + +QSKO11: PUSH P,J + PUSH P,I + PUSHJ P,QFL ;LOOK UP DIR IN MFD, RET TRACK IN J + JRST QSKON ;NON EXISTENT + PUSHJ P,QFLDF ;FIND FREE LOSER DIR SLOT + MOVE I,MDSK + PUSHJ P,QCHNF ;FIND FREE CHNL (TO READ IN DIR) + MOVEM C,QSNUD(H) ;SET USER NAME IN DIR SLOT + MOVEM J,QSLGL(E) ;REQUEST READ IN OF USER DIR FROM TRACK IN J + MOVEI TT,%QMUDR + MOVEM TT,QSRAC(E) +QSKON1: MOVEI T,2 + PUSHJ P,LSWPON ;RELEASE QSKOSW, LEAVE SOSSET OF QSNNR(H) + POP P,I ;GO AWAY WILL HANG UP WAITING IN QUDLK + POP P,J ;DIR IS LOCKED BUT NOT ON LSWPR, PI WILL UNLOCK AFTER READIN + JRST QSTRTR + +QNOFRE: POP P,I ;NO FREE FILES AVAIL + JRST POPBAJ + +QPNL24: PUSHJ P,OPNL24 + JRST URET + +QPNL20: PUSHJ P,OPNL20 + SKIPE QLD(U) + PUSHJ P,OPNL47 ;FOUND LINK, BUT IT POINTS TO NON-EXISTENT DIRECTORY + JRST URET + +AUTOCR: ;AUTOMATICALLY CREATED DIRECTORIES +IFN TPLP+UNSPLP,SIXBIT /.LPTR./ ;FOR TPL SPOOLING + SIXBIT /.MSGS./ ;FOR MESSAGES TO ALL LOSERS + SIXBIT /.MAIL./ ; Programs like to write mail here + SIXBIT /CRASH/ ; Programs like to dump themselves here + SIXBIT /.TEMP./ ; Programs like to write randomness here +NATOCR==.-AUTOCR + +QSKON: JUMPE C,QPNL20 ;DON'T ALLOW ZERO USER NAME + PUSH P,TT + MOVSI TT,-NATOCR +QSKONA: CAMN C,AUTOCR(TT) + JRST QSKONB + AOBJN TT,QSKONA + CAMN A,[SIXBIT /..NEW./] + CAME B,[SIXBIT /(UDIR)/] + JRST [POP P,TT + JRST QPNL20] + BUG INFO,[DSK: DIR ],SIXBIT,C,[CREATED BY ],SIXBIT,UNAME(U),SIXBIT,JNAME(U) +QSKONB: POP P,TT + SKIPG NQFUS + JRST QPNL24 ;NO MFD SLOTS AVAILABLE + PUSH P,A + PUSH P,B + PUSH P,C +QSKONE: PUSHJ P,QFLDF ;FIND FREE DIR SLOT + PUSHJ P,QMLOCK + PUSHJ P,TCALL + JRST IOMQ + JRST [PUSHJ P,LSWPOP ;QMDRO + PUSHJ P,LSWPOP ;QSNNR + PUSHJ P,UDELAY ;HOPEFULLY MEMORY WILL APPEAR SHORTLY + JRST QSKONE] + MOVEM C,QSNUD(H) + SOS NQFUS ;NO TIMING ERR DUE TO QSKOSW + MOVEI J,MU23UD + DPB J,[MUR,,MEMBLT(A)] + DPB H,[MNUMB,,MEMBLT(A)] + LSH A,10. + HRRM A,QSNLCN(H) + SETZM (A) + HRLS A + AOS B,A + BLT A,2000-2(B) + MOVEI A,2000 + MOVEM A,UDNAMP-1(B) + MOVE A,QSNUD(H) + MOVEM A,UDNAME-1(B) + MOVE B,QACTB ;NOW PUT UFD INTO MFD + IORB B,QMDRO + MOVE TT,MDNAMP(B) ;LOOK FOR A FREE SLOT + ADDI TT,(B) +QSKONC: TRNN TT,1777 + JRST QSKOND + SKIPN MNUNAM(TT) + JRST QSKONF + ADDI TT,LMNBLK + JRST QSKONC + +QSKONF: SUBI TT,(B) + JRST QSKONG + +QSKOND: MOVNI TT,LMNBLK ;NO FREE SLOTS, SO EXTEND DOWNWARD + ADDB TT,MDNAMP(B) +QSKONG: ADDI B,(TT) + MOVEM A,MNUNAM(B) + SUBI TT,2000-2*NUDSL ;GET DISK BLOCK NUMBER +IFN KA10P, SKIPGE TT +IFE KA10P, CAIGE TT,2 ; Don't clobber 'HOM' blocks + BUG ;TOO MANY UFDS (NQFUS CHECK DIDN'T WORK) + LSH TT,-1 + MOVEM TT,QSNMI(H) + MOVE TT,QACTB ;UNLOCK UFD AND CAUSE IT TO GET WRITTEN + HLLM TT,QSNLCN(H) + PUSHJ P,QMULK ;UNLOCK MFD + POP P,C + POP P,B + POP P,A + JRST QSKON1 + +SUBTTL MAKE LINK + +QALINK: MOVE I,MDSK ;ENTER WITH QSNNR ON LSWPR + MOVEM I,EPDL(U) + PUSHJ P,QWRO2 ;MAKES NEW FILE WITH MINIMUM OF 37 BYTES OF DESC SPACE + MOVSI A,UNLINK ; AND ADDS QUSR AND QSNLCN ON LSWPR + IORM A,UNRNDM(Q) ;SET LINK BIT + MOVE A,E ;QSK CHANNEL NUMBER + MOVE C,SRN5(U) ;SNAME LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN3(U) ;FN1 LINKED TO + PUSHJ P,LDEP + PUSHJ P,QUDS + MOVE C,SRN4(U) ;FN2 LINKED TO + PUSHJ P,LDEP + JFCL + MOVE E,A ;QSK CHANNEL NUMBER FOR QCHNRT + MOVEI R,EPDL(U) ;DON'T CLOSE A REAL IOCHNM WORD + PUSHJ P,QSOCL4 ;CLOSE CHNL & FILE + PUSHJ P,LSWDEL ;DELETE QUSR, HAS BEEN SETOM'ED + PUSHJ P,LSWDEL ;DELETE QSNRR, HAS BEEN SOS'ED + JRST POPJ1 + +LDEP: MOVEI E,6 ;STORE SIXBIT FROM C INTO LINK DESC +LDEPL: MOVEI B,0 ;GET NEXT CHAR + LSHC B,6 + JUMPE B,LDEPS ;*THIS ALLOWS EMBEDDED BLANKS. + CAIE B,'; + CAIN B,': + JRST LDEPS +LDEPS2: MOVE D,B + PUSHJ P,QUDS + SOS E ;NUMBER OF CHARACTERS LEFT IN WORD + JUMPN C,LDEPL ;JUMP IF ANY MORE NON-BLANK CHARS TO STORE + MOVEI D,'; + JUMPE E,POPJ1 ;JUMP IF STORED 6 CHARACTERS + POPJ P, ;STORED FEWER, NEED TERMINATOR + +LDEPS: MOVEI D,': ;THIS CHAR NEEDS TO BE QUOTED + PUSHJ P,QUDS + JRST LDEPS2 + +;LINK ENCOUNTERED DURING LOOKUP + +QLINK: TRNE D,%DONLK/2 ;CHECK 3.5 BIT IN OPEN MODE + JRST QOLINK ;JUMP IF DON'T CHASE LINKS MODE + AOS A,QLD(U) + CAIL A,100. + JRST OPNL27 ;LINK DEPTH EXCEEDED + PUSH P,E ;SAVE XR NEEDED BY LSWPOP OF QUSR ENTRY + MOVE E,TT + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + MOVE TT,QBTBLI(TT) + HRR TT,E + MOVE I,[440600,,A] + SETZB A,B + SETZ C, +QL1: ILDB J,TT + JUMPE J,QL3 ;END DESC + CAIN J,': + JRST QL4 ;QUOTE NEXT CHAR + CAIN J,'; + TLZA I,770000 ;TERMINATE THIS WORD +QL5: IDPB J,I + JRST QL1 + +QL4: ILDB J,TT ;GET CHAR THAT WAS QUOTED + JRST QL5 + +QL3: EXCH A,C ;END OF DESC REACHED + EXCH A,B ;MAKE A FN1 B FN2 C SNM + SKIPN C + MOVE C,USYSN1(U) + PUSHJ P,QUDULK ;UNLOCK DIR + POP P,E ;RESTORE XR USED BY LSWPOP OF QUSR ENTRY + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,OPBRK ;IF TRYING TO BE PCLSRED, SUBMIT + JRST QSKOL + +QOLINK: MOVSI TT,%QALNK ;OPENING UP A LINK + IORM TT,QSRAC(E);DON'T ALLOW FILE-ONLY OPERATIONS SUCH AS IOT + JUMPL D,QWROR1 ;LEAVE RH(QSRAC)=%QMIDL SO PI LEVEL WON'T MESS WITH IT + JRST QOEX1 ;AND FINISH OPENING + +SUBTTL PAW OVER MFD + +QMCH1: CONO PI,UTCOFF + MOVE TT,QMDRO + TLNE TT,40000 + AOJE TT,QMCH2 ;NOT ON WAY IN +QMCH3: CONO PI,UTCON + SKIPGE QMDRO + PUSHJ P,UFLS + MOVSI E,2 + TDNN E,QMDRO + POPJ P, ;PAWED OVER + PUSHJ P,QMLOCK + ANDCAM E,QMDRO + HRRZ E,QMDRO + MOVE TT,MDCHK(E) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] +QMCH1A: MOVEI E,2000-LMNBLK*NUDSL(E) +IFN KA10P, SETZM NQFUS +IFE KA10P,[ + MOVNI TT,2 ;PROTECT DEC 'HOM' BLOCKS SO KLDCP OR 8080 + MOVEM TT,NQFUS ; CAN FIND ITS CRUFT +] ;IFE KA10P +QMCH1E: LDB TT,[1200,,E] + JUMPE TT,QMULK + SKIPN (E) + AOS NQFUS + ADDI E,LMNBLK + JRST QMCH1E + +QMCH2: SOS QMDRO ;INDICATE ON WAY IN + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + MOVEI TT,MFDBLK ;MFD TRACK + MOVEM TT,QSLGL(E) + MOVEI TT,%QMMDR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QMCH3 + +SUBTTL PAW OVER TUT + +QTCH1: CONO PI,UTCOFF + MOVSI TT,200000 + TDNE TT,QTUTO(I) + JRST QTCH2 ;GO READ IT IN + CONO PI,UTCON +QTCH1A: PUSHJ P,QTLOCK ;TO MAKE SURE IT'S IN + AOSE QDPWF(I) + JRST QTULK ;ALREADY PAWED OVER + PUSH P,A + PUSH P,B + MOVE T,QTUTO(I) + MOVE E,QSWAPA(T) + IDIVI E,DECADE + SKIPE TT + ADDI E,1 + IMULI E,DECADE ;ROUND SWAPPING ALLOC TO MULTIPLE OF A DECADE + MOVEM E,QSWAPA(T) + PUSH P,D + PUSH P,E ;FIRST TRACK OF NON-SWAPPING (FILE) AREA + MOVE E,QTUTP(T) ;ROUND TUT POINTER TO MULTIPLE OF A DECADE + ADDI E,DECADE-1 + IDIVI E,DECADE + IMULI E,DECADE + CAMGE E,(P) ;KEEP IT WITHIN THE FILE AREA + MOVE E,(P) + MOVEM E,QTUTP(T) + MOVE E,QPKNUM(T) +IFN DC10P,[ + CAME E,QPKID(I) + BUG HALT,[PACK ID ],OCT,E,[IN TUT FOR UNIT ],DEC,I,[DIFFERS FROM HARDWARE PACK ID],OCT,QPKID(I) +] +IFE DC10P, MOVEM E,QPKID(I) + MOVE E,QPAKID(T) + MOVEM E,QPKNM(I) +IFN QRSRVP,[ + MOVE E,QTRSRV(T) + MOVEM E,QRESRV(I) +] +;DROPS THROUGH + ;DROPS IN + CLEARM QSFTS(I) ;FREE SPACE IN SWAPPING AREA + SETZB D,QSFT(I) + MOVE B,QTUTO(I) + HRLI B,(TUTBP) + ADDI B,LTIBLK +QTCH1D: ILDB A,B + JUMPN A,QTCH1F + CAML D,(P) + AOS QSFT(I) ;BLOCK IN NON-SWAPPING AREA + CAMGE D,(P) + AOS QSFTS(I) ;BLOCK IN SWAPPING AREA +QTCH1F: ADDI D,1 + CAMGE D,QLASTB(T) + JRST QTCH1D + SUB P,[1,,1] + POP P,D + POP P,B + POP P,A + JRST QTULK + +QTCH2: SETOM QDPWF(I) + ANDCAM TT,QTUTO(I) + CONO PI,UTCON + SKIPG QFCHN + BUG ;DON'T WANT TO WAIT FOR CHANNEL? + PUSHJ P,QCHNF + HRRZM I,QDSKN(E) + MOVEI TT,MFDBLK ;TELL PI LEVEL TO READ IT ALL IN + SUB TT,NTBL(I) + MOVEM TT,QSLGL(E) + LDB TT,[121000,,QTUTO(I)] + MOVEM TT,QSCABN(E) + MOVEI TT,%QMTTR + MOVEM TT,QSRAC(E) + PUSHJ P,QSTRTR + JRST QTCH1A + +;ROUTINE TO ACCESS TUT +;CALL WITH DISK UNIT NUMBER IN I, BLOCK NUMBER IN D +;RETURNS IN D AN LDB-STYLE POINTER TO THE TUT AND IN B THE BYTE +;THAT YOU WOULD GET BY LDB'ING THAT POINTER. +;CLOBBERS E +;CALLER MUST LOCK TUT + +TUTPNT: MOVE B,QTUTO(I) + CAML D,QFRSTB(B) + CAML D,QLASTB(B) + BUG ;BLOCK NUMBER NOT IN RANGE COVERED BY TUT + SUB D,QFRSTB(B) + IDIVI D,TUTEPW + ADDI D,LTIBLK(B) + HLL D,TBTBL(E) + LDB B,D + POPJ P, + +QSTRTR: +IFN DC10P,[ +QSTRT1: CONSO DC0,DSKCHN + SETOM QHUNGF ;SOMEONE PUSHED RESET BUTTON, RECOVER AT PI LEVEL + CONO DC0,DCSET+DCIENB+DSKCHN ;ENABLE IDLE INTERRUPT +] +IFN RP10P+RH10P+RH11P,[ + CONO PI,UTCOFF + PUSHJ P,QSTRT1 + CONO PI,UTCON +] + POPJ P, + +IFN RP10P+RH10P+RH11P,[ ;START DISK WITH UTC ALREADY OFF +QSTRT1: SETOM QGTBZY ;NOTE: TURNS UTC BACK ON BUT NOT CLOCK +IFN RP10P, CONSO DPC,20 ;ONLY IF DISK IDLE +IFN RH10P, CONSO DSK,%HIBSY +IFN RH11P, IORDQ TT,%HRCS1 +IFN RH11P, TRNE TT,%HXRDY + CONO PI,DSKRQ + POPJ P, +] + +;TRY TO FLUSH UNNEEDED UFDS FROM CORE. +;ARG IN C IS ROUTINE TO FREE THE MEMORY. +;CALL WITH UDRSW SIEZED, OR WITH PI 2 IN PROGRESS AND UDRSW NOT LOCKED BY ANYONE +;CLOBBERS H, TT. DOESN'T SKIP. +QDFLS: MOVSI H,-QNUD +QDFLS1: SKIPE QSNUD(H) + SKIPE QSNNR(H) +QDFLS2: AOBJN H,QDFLS1 ;CAN'T FLUSH IF SLOT NOT USED OR CHANNELS OPEN IN DIR + JUMPGE H,CPOPJ + MOVE TT,QACTB + TLO TT,600000 + TDNE TT,QSNLCN(H) + JRST QDFLS2 ;CAN'T FLUSH IF LOCKED OR NOT WRITTEN OUT + PUSHJ P,QDFCHK ;CHECK THAT NO POINTERS TO THIS DIRECTORY REMAIN + CLEARM QSNUD(H) ;FLUSH + AOS QFUD + PUSH P,A + HRRZ A,QSNLCN(H) + LSH A,-10. + PUSHJ P,(C) ;RETURN THE MEMORY + POP P,A + JRST QDFLS2 ;TRY FLUSHING SOME MORE + +;CALL WITH UFD SLOT# IN H, WHEN YOU THINK THAT UFD IS FREE. +QDFCHK: PUSH P,C + PUSH P,J + MOVSI C,-NQCHN +QDFCH1: SKIPGE QUSR(C) + AOBJN C,QDFCH1 + JUMPGE C,QDFCH2 + HRRZ J,QUDPR(C) + CAIN J,(H) + BUG ;IT WASN'T REALLY FREE, MAYBE QSNNR IS SCREWED UP? + AOBJN C,QDFCH1 +QDFCH2: POP P,J + POP P,C + POPJ P, + +;FIND A FREE UFD SLOT, RETURN INDEX IN H. PUTS QSNNR ON LSWPR. +;CLOBBERS T, TT. + +QFLDF: PUSHJ P,SWTL + UDRSW + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSH P,C ;ALL UFD SLOTS IN USE, TRY FLUSHING SOME + MOVEI C,MEMR + PUSHJ P,QDFLS + POP P,C + MOVSI H,-QNUD + SKIPLE QFUD + JRST QFLDF1 + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,UDELAY ;WAIT 1/2 SECOND THEN TRY AGAIN, INCLUDING QDFLS + JRST QFLDF + +QFLDF1: SKIPN QSNNR(H) ;SLOT ALREADY GOBBLED + SKIPE QSNUD(H) ;OR ALREADY OCCUPIED + AOBJN H,QFLDF1 ;MEANS CAN'T TAKE IT + SKIPL H + BUG ;NONE FREE, QFUD OUT OF PHASE WITH REALITY + HRRZS H + SOS QFUD + MOVSI TT,600000 ;DOUBLE LOCK + MOVEM TT,QSNLCN(H) + AOSG QSNNR(H) + BUG + PUSHJ P,LSWPOP ;UDRSW + PUSHJ P,LOSSET + QFLDRT + POPJ P, + +;LOSSET ROUTINE +QFLDRT: SKIPL A,AC0S+H(U) + CAIL A,QNUD + BUG ;H CLOBBERED + SOSGE T,QSNNR(A) + BUG + JUMPG T,CPOPJ ;HOW DID SOMEONE ELSE GET IT? + SKIPN QSNUD(A) + AOS QFUD ;READ-IN NEVER STARTED, SLOT BECOMES FREE + POPJ P, ;OK TO LEAVE 600000,, SET IN QSNLCN + +;C HAS DIR NAME. +;IF IN CORE, SET H TO UFD SLOT#, AOS QSNNR, PUT ON LSWPR, AND SKIP. +;IF DIRECTORY NOT IN CORE, NO SKIP. CLOBBERS T,TT. +QFLD: PUSHJ P,SWTL + UDRSW +QFLD1A: MOVSI H,-QNUD +QFLD1: CAME C,QSNUD(H) + AOBJN H,QFLD1 + JUMPGE H,LSWPOP ;JUMP ON FAILED TO FIND USER. +QFLD2A: AOSG QSNNR(H) + BUG ;MUST HAVE GOTTEN NEGATIVE SOMEHOW + PUSHJ P,LSWPOP ;UDRSW +; PUSHJ P,SOSSET +; QSNNR(H) +;THIS IS AN ATTEMPT TO FIND A BUG. + PUSH P,T + MOVEI T,QSNNR(H) + MOVEM T,IOTBTS(U) + PUSHJ P,LOSSET + [ SOSGE @IOTBTS(U) + BUG + POPJ P, ] + POP P,T +;END TEMPORARY CODE + JRST POPJ1 + +;C <=SYS NAME, RETURNS TRACK ADDR OF DIR IN J, SKIPS IF FINDS LOSER +QFL: PUSHJ P,QMLOCK + PUSHJ P,QFL0 + JRST QMULK + AOS (P) + JRST QMULK + +QFL0: PUSH P,Q + HRRZ Q,QMDRO + ADD Q,MDNAMP(Q) ;PTR TO USER AREA +QFL1: LDB J,[1200,,Q] + JUMPE J,QFL3 + CAMN C,MNUNAM(Q) + JRST QFL2 + ADDI Q,LMNBLK + JRST QFL1 + +QFL2: SUBI J,2000-LMNBLK*NUDSL ;J <= TRACK ADDR OF USER DIR + LSH J,-1 + AOS -1(P) ;SUCCESS +QFL3: POP P,Q + POPJ P, + +;ROUTINE TO ASSIGN A DISK CHANNEL. +;ARGS: U USER TO GO IN QUSR, H UFD SLOT# TO GO IN QUDPR, I DSK# TO GO IN QDSKN +;RETURNS QSK CHNL INDX IN E. +;DOESN'T DO A LOSSET OF QCHNRT, BUT CALLER MAY WANT TO. +;CLOBBERS T. NEVER SKIPS. + +QCHNF: PUSHJ P,SWTL ;PREVENT ANYONE ELSE FROM ALLOCATING CHANNELS + QCHSW + MOVSI E,-NQCHN + SKIPLE QFCHN + JRST QCH2 ;SOME CHANNELS ARE AVAILABLE, GO FIND ONE + PUSHJ P,LSWPOP ;QCHSW + SKIPG QFCHN + PUSHJ P,UFLS + JRST QCHNF + +QCH2: SKIPGE QSRAC(E) .SEE %QALOK + JRST QCH3 + SKIPGE QUSR(E) + JRST QCH1 +QCH3: AOBJN E,QCH2 + BUG ;WHERE DID THAT FREE CHANNEL GO? + +QCH1: HRRZS E ;CHANNEL ALLOCATED, INITIALIZE VARIABLES + HRRZM I,QDSKN(E) + SETOM QSCABN(E) + SETOM QSGL(E) + SETOM QSLGL(E) ;IN CASE OF WRITE-OVER ON 0-LENGTH FILE. + SETZM QBFP(E) + SETZM QSBFS(E) + CLEARM QSLBLK(E) + SETOM QSMDN(E) + SETZM QSCRW(E) + SETZM QSBI(E) + SETZM QSRAC(E) .SEE %QMIDL + CLEARM QFBLNO(E) + SETZM QSMPRC(E) + SETZM QSMPRP(E) + MOVE T,[444400,,1] ;ASSUME BYTES=WORDS, WILL BE FIXED LATER + MOVEM T,QSBYTE(E) + SETZM QPCLSR(E) + HRRZM H,QUDPR(E) + SETZM QUDFPR(E) ;NOT YET SET UP TO ANY PARTICULAR FILE + MOVEM U,QUSR(E) ;CHANNEL IS NOW IN-USE + SOSGE QFCHN + BUG + JRST LSWPOP ;QCHSW + +;LOSSET ROUTINE TO RETURN TENTATIVELY ASSIGNED QSK CHNL +;E HAD BETTER CONTAIN THE QSK CHANNEL NUMBER AT "ALL" TIMES +QCHNRT: SKIPL T,AC0S+E(U) + CAIL T,NQCHN + BUG ;E CLOBBERED + HRRZ A,U ;LSWPOP MESSES WITH LH(U) + CAME A,QUSR(T) + BUG + SETOM QUSR(T) + AOS QFCHN + POPJ P, + +SUBTTL DELETE, RENAME +;COME HERE FOR DELETE, OR RENAME NOT WHILE OPEN, ON DISK. + +QRNAM: SKIPN SRN3(U) + JRST QDEL + PUSH P,A + PUSH P,B + SKIPN B,SRN4(U) + JRST QPNL11 + MOVE A,SRN3(U) + PUSHJ P,MFDCK + JRST .+2 + JRST QPNL13 + PUSHJ P,FLDRCK + JRST .+2 + JRST QPNL13 + POP P,B + POP P,A + PUSH P,SRN3(U) + PUSH P,SRN4(U) + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST [ SUB P,[2,,2] + JRST QROR1C ] ;GIVE FILE NOT FOUND OR FILE LOCKED + MOVE I,Q + POP P,B + POP P,A + PUSHJ P,QGRLSC + JRST QPNLBN ;FILE ALREADY EXISTS + PUSHJ P,QFNG +QRNAM4: PUSHJ P,QLOOK + JRST QRNAM3 + CAME I,Q ;ALLOW RENAME THAT DOESN'T CHANGE NAMES. + JRST QPNL13 +QRNAM3: MOVE Q,I + MOVSI TT,UNDUMP ;SAY FILE NOT DUMPED. + ANDCAM TT,UNRNDM(Q) + MOVNI E,1 ;TELL QFREF NOT TO CLOBBER NON-EX DISK CHNL. + PUSHJ P,QFREF ;"REFERENCE" FILE + PUSHJ P,QRELOC ;STORE NEW NAMES IN DIR +QRNAM2: MOVE TT,QACTB + IORM TT,QSNLCN(H) +QRNAM1: MOVE U,USER ;U MAY NOT HAVE USER IF CAME HERE FROM LOGOUT + PUSHJ P,LSWCLR + JRST POPJ1 + +QGRLSC: CAME A,[SIXBIT />/] ;SKIP NONE IF BOTH A+B ARE SPECIAL + CAMN A,[SIXBIT //] ;AND TWICE IF NEITHER + CAMN B,[SIXBIT / LOOK UP FILE TO DELETE +;Q .NE. 0 => DELETE FILE POINTED TO BY QUDFPR OF CHNL IN D +;H MUST HAVE DIR SLOT INDEX +QDELA: MOVEI Q,0 +QDLA1: PUSHJ P,SLUGH + QCHSW + 1000,,QSNLCN(H) + 1000,,QTUTO(I) + JUMPN Q,QDLA2 + PUSHJ P,QLOOK + JRST QDEL4A ;FNF + SETO D, ;NO ASSOCIATED CHANNEL +QDLA3: LDB A,[UNLNKB+UNRNDM(Q)] + LDB TT,[UNPKN+UNRNDM(Q)] + CAME TT,J + JUMPE A,QDELA1 ;ON DIFFERENT DISK (DIDN'T LOCK RIGHT TUT TRY AGAIN) + MOVE A,Q + SUB A,QSNLCN(H) + MOVSI J,-NQCHN +QDEL1: CAIN D,(J) + JRST QDEL2 ;IGNORE CHANNEL (IF ANY) WHOSE CLOSING CAUSED THIS + HRRZ TT,QUDPR(J) + SKIPL QSCRW(J) ;ONLY LOOK AT READ CHNLS + CAIE TT,(H) + JRST QDEL2 + HRRZ TT,QUDFPR(J) + SKIPL QUSR(J) + CAIE TT,(A) + JRST QDEL2 + MOVSI TT,%QADEL ;FOUND CHNL WITH THIS FILE OPEN + IORM TT,QSRAC(J) ;DELETE FILE WHEN THIS CHNL CLOSED + MOVSI TT,UNCDEL ;SET DELETED BIT + IORM TT,UNRNDM(Q) +QDEL4: MOVE TT,QACTB + IORM TT,QSNLCN(H) + MOVE TT,DCHBT(I) + IORM TT,QTUTO(I) +QDEL4B: PUSHJ P,QTULK + PUSHJ P,QUDULK + PUSHJ P,LSWPOP + JRST POPJ1 + +QDLA2: MOVE Q,QUDFPR(D) ;COMPUTE FILE ADR FROM CHNL IN D + ADD Q,QSNLCN(H) ;DIR MAY HAVE MOVED + JRST QDLA3 + +QDEL4A: SOS (P) + JRST QDEL4B + +QCDLWO: PUSH P,R ;OUTPUT CLOSE BUT FILE WAS DELEWO'ED + SETZM QSCRW(D) ;FAKE OUT ERROR CHECK AT QSQSH6 + PUSHJ P,QUDULK +QSICLD: MOVE H,QUDPR(D) ;ENTRY FROM INPUT CLOSE, FILE WAS DELETED + MOVE I,QDSKN(D) + PUSHJ P,QUDLK + MOVE Q,QSNLCN(H) + ADD Q,QUDFPR(D) + MOVE J,QPKID(I) + PUSHJ P,QUDULK + PUSH P,D + PUSHJ P,QDLA1 + BUG ;FILE ISNT THERE? + POP P,D + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QICLX + +QDELA1: PUSHJ P,QDEL4B ;NOT OUR DISK IN J + JFCL + MOVE J,TT ;DISK ITS REALLY ON +QDELA2: MOVSI I,-NQS ;TRANSLATE PACK # IN J TO DRIVE # IN I + CAME J,QPKID(I) + AOBJN I,.-1 + JUMPGE I,QPKNF1 + JRST QDELA + +QSOCLD: PUSH P,D ;DELETE FILE WHEN CLOSING OVER IT + PUSH P,R + LDB J,[UNPKN+UNRNDM(Q)] + PUSHJ P,QUDULK + PUSHJ P,QDELA2 + JFCL +QPKNF7: POP P,R + POP P,D + POPJ P, + +QPKNF1: PUSHJ P,QPKNFP ;MAYBE TUT NOT IN YET? + JRST QDELA2 ;YUP, TRY AGAIN + PUSHJ P,QUDLK + PUSHJ P,QLOOK + JRST QUDULK ;GONE AWAY BETWEEN LOCKS + JRST QDFPK ;GO DELETE OFF OF NON-MOUNTED PACK + +QDL2: PUSHJ P,QTULK ;DELETE LINK + MOVEI T,2 + PUSHJ P,LSWPON ;UNLOCK QCHSW +QDLINK: LDB E,[UNDSCP+UNRNDM(Q)] + IDIVI E,UFDBPW + ADD E,QSNLCN(H) + ADDI E,UDDESC + HLL E,QBTBLI(TT) + ILDB A,E + SKIPN E + BUG ;NULL LINK? + MOVEI B,0 +QDL1: DPB B,E ;CLEAR OUT THE CHAR + CAIN A,': + IDPB B,E ;CLEAR A QUOTED CHAR WITHOUT LOOKING AT IT + ILDB A,E + JUMPN A,QDL1 + PUSHJ P,QSQSH ;REMOVE ENTRY + MOVE TT,QACTB + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + JRST POPJ1 + +QDEL2: AOBJN J,QDEL1 ;CHECK NEXT DISK CHANNEL + MOVE C,UNRNDM(Q) ;NOT OPEN, SO REALLY DELETE IT + TLNE C,UNLINK + JRST QDL2 + ANDI C,.BM UNDSCP + IDIVI C,UFDBPW + ADD C,QSNLCN(H) + ADDI C,UDDESC + HLL C,QBTBLI(D) ;GET DESCRIPTOR POINTER IN C AND TT + MOVE TT,C + MOVEI A,0 + PUSHJ P,NFLLN1 ;A GETS NUMBER OF BLOCKS IN FILE + PUSH P,A + SKIPN D,QSFBT(H) ;SEE IF ENOUGH QSFBT STORAGE EXISTS + JRST QDEL11 +QDEL10: HLRE B,(D) ;NUMBER OF FREE LOCATIONS IN THIS PAGE + ADD A,B ;DECREASE LOCATIONS NEEDED + MOVE D,1(D) ;CDR + JUMPN D,QDEL10 +QDEL11: JUMPLE A,QDEL12 ;JUMP IF SUFFICIENT STORAGE EXISTS + PUSHJ P,TCALL ;GET MORE + JRST IOMQ + JRST [ MOVE U,USER ;U MAY NOT HAVE USER IF CAME FROM LOGOUT + PUSHJ P,LSWCLR ;HAVE TO WAIT FOR MEMORY + PUSHJ P,MQTEST ;AVOID DEADLOCKS BY UNLOCKING EVERYTHING + PUSHJ P,UFLS + JRST UUOTRO ] + MOVEI D,MU23FB + DPB D,[MUR,,MEMBLT(A)] + LSH A,10. + MOVEI D,2(A) + HRLI D,-1776 + MOVEM D,(A) + MOVE D,A + EXCH A,QSFBT(H) ;ADD TO FRONT OF LIST + MOVEM A,1(D) + MOVE A,(P) ;GET BACK NUMBER OF BLOCKS NEEDED + JRST QDEL10 ;SEE IF THERE ARE ENOUGH NOW + +QDEL12: POP P,A ;GET RID OF BLOCKS COUNT + PUSHJ P,QSQSH ;REMOVE ENTRY, CANNOT PCLSR AFTER THIS + CLEARB J,D ;J GETS NUMERIC TRACK NUMBER, D BYTE POINTER TO TUT + MOVE TT,QTUTO(I) ;D ZERO SO WILL HALT IF DESC DOESN'T START WITH LOAD-ADDR! + MOVE Q,QSFBT(H) ;Q -> AOBJN POINTER FOR STORING BLOCK NUMBERS +QDEL3: ILDB B,C ; INTO QSFBT AS DESCRIPTORS ARE ZEROED OUT + MOVEI A,0 ;I DISK, C BP TO DESCRIPTOR, A,B,E TEMP. + DPB A,C + JUMPE B,QDEL4 ;END OF FILE DESCRIPTION + TRNE B,40 + JRST QDEL6 + CAILE B,UDTKMX + JRST QDEL7 +QDEL8: SKIPN Q + BUG ;OOPS, OUT OF QSFBT STORAGE + SKIPL E,(Q) ;PICK UP AOBJN POINTER + JRST [ MOVE Q,1(Q) ;THIS PAGE FULL, TRY NEXT + JRST QDEL8 ] + MOVEM J,(E) ;STORE DISK,,BLOCK FOR LATER FREEING + AOBJN E,.+1 + MOVEM E,(Q) ;INCREMENT POINTER + MOVE E,QSNLCN(H) ;DECREASE DIR'S BLOCKS-USED + HRRZ A,UDBLKS(E) + SOSL A + HRRM A,UDBLKS(E) + ILDB A,D ;CHECK TUT + SKIPN A + BUG ;TUT SHOWS TRACK NOT USED + AOS J ;DO NEXT BLOCK IN CONTIGUOUS GROUP + SOJG B,QDEL8 + JRST QDEL3 + +IFN NXLBYT-2, .ERR THIS ROUTINE AND OTHERS KNOW IMPLICITLY THAT NXLBYT=2 +QDEL6: MOVEI D,0 ;LOAD ADDRESS + DPB B,[140500,,D] + ILDB B,C + DPB B,[060600,,D] + DPB A,C ;A HAS ZERO FROM QDEL3 + ILDB B,C + DPB B,[0600,,D] + DPB A,C + MOVE J,D + HRL J,I + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + JRST QDEL7A + +QDEL7: CAIN B,UDWPH + JRST QDEL3 + SUBI B,UDTKMX + ADD J,B + IBP D + SOJG B,.-1 +QDEL7A: MOVEI B,1 ;LOAD ADDRESS OR SKIP AND TAKE, SO ONLY ONE TRACK + JRST QDEL8 + +QDFNF: PUSHJ P,OPNL4 + JRST URET + +QDELB: CONO PI,UTCON + JRST QDELA + +;PERFORM BLOCK-FREEING SPECIFIED BY QFBTS +QDLFBT: CONO PI,UTCOFF ;PROTECT QFBTS + SKIPN B,QFBTS + JRST UTCONJ + MOVE T,1(B) + MOVEM T,QFBTS + CONO PI,UTCON + HRRZ T,(B) ;FIRST FREE LOCATION + SUBI T,2(B) ;NUMBER OF LOCATIONS TO DO + HRLO A,T + EQVI A,1(B) + AOBJP A,QDLFB9 ;A NOW -> BLOCKS TO FREE, & CHECK FOR EMPTY + SETO I, ;NO TUT LOCKED YET +QDLFB1: HLRZ J,(A) ;DISK NUMBER + CAMN J,I ;MAKE SURE RIGHT TUT IS LOCKED + JRST QDLFB2 + SKIPL I + PUSHJ P,QTULK + MOVE I,J + PUSHJ P,QTLOCK +QDLFB2: HRRZ D,(A) ;BLOCK NUMBER TO FREE + PUSHJ P,TUTPNT + CAIGE B,TUTMNY ;USED IN "MANY" FILES(1,2,...,TUTMNY,TUTLK) + SOJL B,[JRST 4,.] ;HALT IF TUT SHOWS TRACK NOT USED + JUMPN B,QDLFB3 ;NOT LAST USE + HRRZ T,(A) ;BLOCK NUMBER AGAIN + MOVE TT,QTUTO(I) + CAML T,QSWAPA(TT) + AOSA QSFT(I) + AOS QSFTS(I) ;TRACK IN SWAPPING AREA +QDLFB3: DPB B,D ;DECREASE USAGE COUNT IN TUT + AOBJN A,QDLFB1 + PUSHJ P,QTULK +QDLFB9: MOVEI A,-1(A) ;GET AN ADDRESS ON THAT PAGE + LSH A,-10. ;DONE WITH THIS PAGE, FREE IT + PUSHJ P,TMEMR ;RETURN PAGE TO FREE AND TRY FOR MORE + MU23FB + JRST QDLFBT + +;REMOVE HOLE FROM NAME AREA AT Q +QSQSH: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,TT + HRRZ TT,QSNLCN(H) + MOVE A,UDNAMP(TT) + CAILE A,2000 + BUG ;UDNAMP BAD + ADDI A,(TT) + HRRZ C,Q + SUB C,A + SKIPL C + CAIL C,2000-UDDESC + BUG ;Q BAD + HRRZ C,Q +QSQSH1: SUBI C,LUNBLK + CAMLE A,C + JRST QSQSH2 + HRLZ B,C + HRRI B,LUNBLK(C) + BLT B,2*LUNBLK-1(C) + JRST QSQSH1 + +QSQSH2: +REPEAT LUNBLK,SETZM .RPCNT(A) + SUBI A,-LUNBLK(TT) + HRRZM A,UDNAMP(TT) + HRRZ C,Q + SUBI C,(TT) ;INDEX OF DELETED FILE + HRRZI TT,-LUNBLK(A) ;INDEX OF OLD BEGINNING OF NAME AREA + MOVSI A,-NQCHN +QSQSH3: HRRZ B,QUDPR(A) + SKIPL QUSR(A) + CAIE B,(H) + JRST QSQSH4 + SKIPN B,QUDFPR(A) + JRST QSQSH4 + CAIGE B,(TT) + BUG + CAIN B,(C) + JRST QSQSH6 ;PNTR TO FLUSHED HOLE, CHECK IF READ CHNL + CAIG B,(C) ;IF AFTER DELETED FILE DON'T RELOCATE + ADDI B,LUNBLK + HRRZM B,QUDFPR(A) + SKIPL QSCRW(A) + JRST QSQSH4 ;READ CHNL + ADD B,QSNLCN(H) + MOVE B,UNRNDM(B) + TLNN B,UNWRIT + BUG ;CHNL WRITING BUT BEING WRITTEN BIT NOT SET +QSQSH4: AOBJN A,QSQSH3 + POP P,TT + POP P,C + POP P,B + POP P,A + POPJ P, + +QSQSH6: MOVE B,QSRAC(A) ;FOUND PNTR TO DELETED FILE + TLNE B,%QADEL ;SKIP IF NOT DELETE AFTER CLOSE + SKIPGE QSCRW(A) ;ALSO ERROR IF NOT READ CHNL + BUG + JRST QSQSH4 ;WAS DELETE AFTER CLOSE ON READ CHNL + +SUBTTL DIRECTORY LOOK UP, > FEATURE + +;A contains the FN1 and B contains the FN2. +;H is the index of the directory slot. The dir must be locked. + +;Returns the address of the filename block in Q. +;Clobbers C. + +;Internally, J and Q point to the bottom and top of the +;area of the dir we are still searching. +;Bit 4.9 of J is set to indicate one of the names is ">". +;C used as a flag: sign bit says creating a file. +;Bit 1.1 of C says FN2 is > or <. + +;Look for place to create new file, +;and generate new version for >. +QFNG: MOVEM Q,EPDL3(U) + SKIPA C,[SETZ] +;Look for existing files only +QLOOK: MOVEI C,0 + PUSH P,J + HRRZ J,QSNLCN(H) + MOVEI Q,2000-LUNBLK(J) + ADD J,UDNAMP(J) + CAMN A,[SIXBIT />/] + TLOA J,400000 + CAMN A,[SIXBIT / + CAMN B,[SIXBIT />/] + TLOA J,400000 + CAMN B,[SIXBIT //] + JRST POPJJ ;MUST BE READ RETN FILE NOT FOUND +QLOOK1: JUMPGE C,QLOOK9 + CAMN B,[SIXBIT /" +QLOOK9: PUSH P,D + PUSH P,TT + PUSH P,I + PUSH P,[-1] ;BEST INDEX + PUSH P,[SETZ] ;BEST "NUMERIC" PART + PUSH P,[SETZ] ;BEST ALPHA PART +QLOOK4: CAIGE Q,(J) + JRST QLOOK2 + XCT QLKI1(C) + JRST QLOOK3 + MOVE D,UNRNDM(Q) + TLNE D,UNIGFL + JUMPGE C,[ SKIPGE -2(P) ;FILE LOCKED, REMEMBER IT IF WE HAVE NO BETTER, + HRRM Q,-2(P) ; BUT DON'T CONSIDER IT IF READING + JRST QLOOK3 ] ;BUT IF WRITING, CONSIDER ALL FILES + SKIPE TT,@QLKI1+1(C) +QLOOK6: TRNE TT,77 ;RIGHT ADJ + JRST QLOOK5 + LSH TT,-6 + JRST QLOOK6 + +QLOOK5: MOVEI I,0 +QLOOK8: LDB D,[600,,TT] + CAIL D,'0 + CAILE D,'9 + JRST QLOOK7 ;NOT A DIGIT +QLOK5B: TRNE I,77 ;RIGHT ADJ LOW NON NUM PART + JRST QLOK5A + LSH I,-6 + JUMPN I,QLOK5B +QLOK5A: TLC TT,400000 ;AVOID CAM LOSSAGE + TLC I,400000 + SKIPGE -2(P) + JRST QLOK5D ;FIRST MATCH + JUMPGE J,QLOK5E ;GET LEAST + CAMGE TT,-1(P) ;GET GREATEST + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMGE I,(P) + JRST QLOOK3 ;NOT AS GOOD +QLOK5D: HRRZM Q,-2(P) + MOVEM TT,-1(P) + MOVEM I,(P) +QLOOK3: SUBI Q,LUNBLK + JRST QLOOK4 + +QLOK5E: CAMLE TT,-1(P) + JRST QLOOK3 + CAME TT,-1(P) + JRST QLOK5D + CAMLE I,(P) + JRST QLOOK3 + JRST QLOK5D + +QLOOK7: LSHC TT,-6 ;LOW DIGIT NOT NUMERIC + JUMPN TT,QLOOK8 ;NO NUMERIC DIGITS AT ALL ("BIN", MAYBE?) + JUMPL J,QLOK5B ;IF LOOKING FOR GREATEST, LET THIS BE LEAST + MOVNI TT,1 ;GREATEST IF LOOKING FOR LEAST + JRST QLOK5B + +QLOOK2: JUMPL C,QFNG1 ;REALLY WANT TO MAKE F.N.'S FOR WRITE + SUB P,[1,,1] + POP P,C ;BEST "NUMERIC" PART + POP P,Q ;ADR + POP P,I + POP P,TT + POP P,D + AOJE Q,POPJJ + MOVE A,UNFN1-1(Q) ;ACTUAL MATCHED FILE NAMES + MOVE B,UNFN2-1(Q) + SOJGE Q,POPJJ1 ;FOUND A FILE THAT WASN'T LOCKED + MOVEI Q,-LUNBLK(Q) + JRST POPJJ + +QFNG1: SKIPGE -2(P) + JRST QFNG2 ;NOT FOUND START W/ 1 + MOVE TT,-1(P) + TLC TT,400000 + MOVE I,[600,,TT] +QFNG3: LDB D,I + CAIL D,'0 + CAILE D,'9 + JRST QFNG4 ;REACH END OF NUMERIC FIELD + AOS D + CAILE D,'9 + JRST QFNG5 + DPB D,I +QFNG5A: TLNE TT,770000 + JRST QFNG3A + LSH TT,6 + JRST QFNG5A + +QFNG2: MOVSI TT,(SIXBIT /1/) +QFNG3A: MOVEM TT,A(C) ;STORE INTO A OR B AS APPRO + SUB P,[3,,3] + POP P,I + POP P,TT + POP P,D + MOVE Q,EPDL3(U) + JRST POPJJ + +QFNG5: MOVEI D,'0 + DPB D,I + ADD I,[60000,,] + JUMPL I,QFNG5A + JRST QFNG3 + +QFNG4: TLNN TT,770000 ;SKIP ON ALREADY 6 CHAR NAME + LSH TT,6 + MOVEI D,'1 + DPB D,I + MOVEI D,'0 +QFNG4B: TLNN I,770000 + JRST QFNG5A + IDPB D,I + JRST QFNG4B + +QLKI1: CAME B,UNFN2(Q) + CAME A,UNFN1(Q) + UNFN2(Q) + +QPKNF: MOVE C,QSNUD(H) + PUSHJ P,QUDULK ;UNLOCK DIR + PUSHJ P,LSWPOP ;QUSR ENTRY + PUSHJ P,LSWPOP ;QSNNR ENTRY + PUSHJ P,QPKNFP + JRST QSKOL + PUSHJ P,OPNL16 ;PACK NOT MOUNTED + JRST URET + +QPKNFP: MOVSI I,-NQS +QPKNF3: SKIPGE QACT(I) + JRST QPKNF4 + MOVE TT,QTUTO(I) + SKIPL QDPWF(I) + TLNE TT,40000 + JRST QPKNF2 ;PACK NOT IN OR NOT PAWED OVER +QPKNF4: AOBJN I,QPKNF3 + JRST POPJ1 + +QPKNF2: JRST QTCH1 ;MAYBE THIS UNIT HAS GOODIES + +QFDF: PUSHJ P,OPNL5 ;FILE DIR FULL ON WRITE + JRST URET + +QPNL13: PUSHJ P,OPNL13 + JRST URET + +QPNL22: PUSHJ P,OPNL22 + JRST URET + +QPNLBN: +QPNL11: PUSHJ P,OPNL11 + JRST URET + +;ROUTINE TO FIND PLACE IN DIRECTORY WHERE A B WOULD GO +;SKIPS ONLY IF DIRECTORY CONTAINS AT LEAST ONE FILE +;FOR INSERTION, FILE GOES BEFORE PNTR RETURNED IN J +;RETURNS PNTR IN Q TO BEGINNING OF NAME AREA +;(ONLY WORKS FOR LUNBLK = 5) +QLGLK: HRRZ J,QSNLCN(H) + HRRZ Q,UDNAMP(J) + ADDI Q,(J) + CAIL Q,2000(J) + POPJ P, ;DIRECTORY EMPTY + TLC A,(SETZ) + TLC B,(SETZ) + PUSH P,D + PUSH P,E + ADDI J,600 ;128. NAME BLOCKS FROM END +REPEAT 7,[ ;THIS CODE DELIBERATELY NOT INDENTED. NEED 4 DIMENSIONS. + CAMGE J,Q + JRST .+6 + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAMN A,D + JSP E,QLGLE + CAML A,D + ADDI J,<1_<7-.RPCNT>>*LUNBLK + SUBI J,<1_<6-.RPCNT>>*LUNBLK +] + CAMGE J,Q + ADDI J,LUNBLK + CAMGE J,Q + BUG + MOVE D,UNFN1(J) + TLC D,(SETZ) + CAME A,D + JRST QLGL1 + MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMLE B,D +QLGL2: ADDI J,LUNBLK +QLGL3: TLC A,(SETZ) + TLC B,(SETZ) + POP P,E + POP P,D + JRST POPJ1 + +QLGL1: CAML A,D + JRST QLGL2 + JRST QLGL3 + +;CALL BY JSP E,QLGLE +QLGLE: MOVE D,UNFN2(J) + TLC D,(SETZ) + CAMN B,D + JRST QLGL3 + CAML B,D + JRST 1(E) + JRST 2(E) + +SUBTTL LOCKING ROUTINES + +QMLOCK: PUSHJ P,LSWTL + QMDRO + POPJ P, + +QMULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QMDRO + BUG + POP P,U + JRST LSWPOP + +QTLOCK: PUSHJ P,LSWTL + QTUTO(I) + POPJ P, + +QTULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QTUTO(I) + BUG + POP P,U + JRST LSWPOP + +QUDLK: PUSHJ P,LSWTL + QSNLCN(H) + POPJ P, + +QUDULK: PUSH P,U + MOVE U,USER + MOVE U,LSWPR(U) + HRRZ U,(U) + CAIE U,QSNLCN(H) + BUG + POP P,U + JRST LSWPOP + +SBTBLI: +QBTBLI: 440600,, ;IF GOING TO ILDB +SBTBL: +QBTBL: 360600,, + 300600,, + 220600,, + 140600,, + 060600,, + 000600,, + +TBTBL=.+1 +TBTBLI: REPEAT 1+TUTEPW, TUTBP-<.RPCNT*TUTBYT*010000,,> + +SUBTTL DIRECTORY GARBAGE COLLECTOR + +; MOVE H, directory number +; lock the directory +; PUSHJ P,QGC +; return if directory full. +; return if won. +; No ACs clobbered. +; All pointers to directory relocated appropriately. + +; Called from disk open routines if a new file is to be created +; and there are less than 6+LUNBLK words in the free area of the directory. +; Called from QSBWG if %QAFUL is set in QSRAC. +; %QAFUL means "must have successful GC before committing another track to this file." + +;NOTE NOTE NOTE: +; This GC allocates an extra block of core for temporary storage. +; If no memory is free in low half, waits without unlocking directory. +; Can possibly PCLSR. No deadly embrace to not unlock directory since +; it can't be flushed from core anyway and it's not holding anything else in. + +QAPBMN==NXLBYT+3 ;minimum number of descriptor bytes which + ; must be available at the end of a file to + ; commit another track to the file. + ;1 for a take-N, NXLBYT+1 for jump, 1 for ending zero. +QAPBMX==36. ;maximum number of descriptor bytes to allocate at a time. + +QGC: IRPC X,,ABCDQIJTR + PUSH P,X + TERMIN + +;Old GC prints message on system console. Any reason to with fast one? + +; validate the directory + +QGC00: SKIPL A,QSNLCN(H) + BUG ;directory not locked + MOVE C,UDNAME(A) + MOVEM C,LASTGC ;save name of last dir GCed + CAME C,QSNUD(H) + BUG ;directory clobbered + SKIPLE C,UDNAMP(A) + CAILE C,2000 + BUG ;name pointer out of bounds + IMULI C,UFDBPW + SKIPL D,UDESCP(A) + CAIL D,-UDDESC*UFDBPW(C) + BUG ;descriptor/name overlap + +; Get a block of core to use for temporary storage. +; The block is left in the "in-process" state. + + HRRZ Q,A + PUSHJ P,TCALL + JRST IOMQ + JRST [ PUSHJ P,UDELAY ;no core available in low half + JRST QGC00 ] ;so wait, then loop back to beginning + LSH A,10. + MOVEI B,1(A) ;zero it out + HRL B,A + SETZM (A) + BLT B,1777(A) + EXCH Q,A ;A -> directory, Q -> temporary core +;Drops through + ;Drops in +; Scan the directory and count: +; I all files +; J files open for writing +; R active bytes of descriptor + + SETZB I,J + SETZ R, + MOVEI B,2000(A) ;end of name area + ADD A,UDNAMP(A) ;start of name area +QGC10: CAML A,B + JRST QGC19 ;jump if all files done + SKIPE UNFN2(A) + SKIPN UNFN1(A) + BUG ;zero name block? + AOJA I,QGC12 ;file exists + +QGC11: ADDI A,LUNBLK ;advance to next file + AOJA R,QGC10 ;also count the zero byte that ends the descriptor + +QGC12: MOVE C,UNRNDM(A) + TLNE C,UNWRIT + ADDI J,1 + ANDI C,.BM UNDSCP ;get descriptor ptr (undscp has pos=0) + IDIVI C,UFDBPW + HLL C,QBTBLI(D) + ADDI C,UDDESC-2000(B) + MOVE D,UNRNDM(A) + TLNE D,UNLINK + JRST QGC14 +QGC13: ILDB T,C ;get byte of descrip + JUMPE T,QGC11 ;eof + CAIG T,UDWPH + AOJA R,QGC13 ;1-byte desc +REPEAT NXLBYT, IBP C ;multi-byte desc + ADDI R,NXLBYT+1 + JRST QGC13 + +QGC14: ILDB T,C ;count bytes of link descriptor + JUMPE T,QGC11 + CAIN T,': + AOJA R,[IBP C ;quoted + AOJA R,QGC14 ] + AOJA R,QGC14 + + +; Compute number of bytes of descriptor to add after each +; file open for output. If > QAPBMX, set to QAPBMX. +; If < QAPBMN, take directory-full exit. + +QGC19: MOVE C,I ;save number of files + IMULI I,LUNBLK*UFDBPW ;number of bytes in name area + ADDI R,UDDESC*UFDBPW(I) ;R := total number of bytes claimed + MOVEI A,2000*UFDBPW-1 + SUB A,R ;A := number of bytes left + SKIPE J + IDIV A,J ;number of bytes available to extend open files + CAIGE A,QAPBMN + JRST QGC69 ;if < minimum, dir. full + CAILE A,QAPBMX + MOVEI A,QAPBMX ;limit to at most QAPBMX bytes at a time +;Drops through + ;Drops in +; A = number of bytes of room to leave after each file open for writing +; B -> name block under consideration +; C -> old descriptors +; D = disk channel number under consideration. Also D = C+1 +; J counts new descriptor bytes generated +; Q -> new descriptors (in temporary core block) +; R -> base of directory + + SETZ J, + HRRZ R,QSNLCN(H) ;old dir + ADDI Q,UDDESC ;new dir + HLL Q,QBTBLI + MOVE B,UDNAMP(R) + ADD B,R + +; Loop over files + +QGC20: CAIL B,2000(R) + JRST QGC40 ;all files done + LDB C,[UNDSCP UNRNDM(B)] ;get old desc ptr + DPB J,[UNDSCP UNRNDM(B)] ;store new desc ptr + +; Loop over all disk channels, relocating the ones that point to this file + + MOVSI D,-NQCHN +QGC31: HRRZ T,QUDPR(D) + SKIPL QUSR(D) + CAIE T,(H) + AOBJN D,QGC31 ;not in use or not same directory + JUMPGE D,QGC39 ;jump if all disk channels done + LDB T,[1200,,B] + CAME T,QUDFPR(D) + JRST QGC32 ;not same file + MOVE T,J ;relocate descriptor pointer + SUB T,C + ADDM T,QDIRP(D) +QGC32: AOBJN D,QGC31 + +QGC39: IDIVI C,UFDBPW ;make desc pntr into byte pointer + HLL C,QBTBLI(D) + ADDI C,UDDESC(R) + MOVE T,UNRNDM(B) + TLNE T,UNLINK + JRST QGC22 +QGC21: ILDB T,C ;copy descriptor bytes of a file into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIG T,UDWPH + AOJA J,QGC21 +REPEAT NXLBYT,[ + ILDB T,C + IDPB T,Q +] ADDI J,NXLBYT+1 + JRST QGC21 + +QGC22: ILDB T,C ;copy descriptor bytes of a link into temporary core + IDPB T,Q + JUMPE T,QGC23 + CAIN T,': + AOJA J,[ILDB T,C + IDPB T,Q + AOJA J,QGC22 ] + AOJA J,QGC22 + +QGC23: MOVE T,UNRNDM(B) + TLNN T,UNWRIT + JRST QGC25 + ADD J,A ;file being written, increase desc area + MOVE T,A + IBP Q + SOJG T,.-1 + +QGC25: ADDI B,LUNBLK ;next file + AOJA J,QGC20 ;also account for final zero at end of descriptor + +; Paranoia: check that all disk channels to this directory look OK + +QGC40: MOVEM J,UDESCP(R) ;store free-desc pointer + LDB A,[1200,,Q] ;last word used by descriptors + CAML A,UDNAMP(R) + BUG ;overlap + ANDI Q,-2000 ;base of temp core block again + MOVSI A,-NQCHN +QGC41: HRRZ T,QUDPR(A) + SKIPL QUSR(A) + CAIE T,(H) + AOBJN A,QGC41 ;channel not in use, or to some other dir + JUMPGE A,QGC49 ;all channels done + SKIPN B,QUDFPR(A) ;get file open on this channel + JRST QGC42 ;channel not set up to any particular file + CAIGE B,2000 + CAMGE B,UDNAMP(R) + BUG ;file pointer screwed + ADD B,R + SKIPL J,QDIRP(A) ;get descriptor pointer + CAMLE J,UDESCP(R) + BUG ;descriptor pointer screwed + LDB C,[UNDSCP UNRNDM(B)] + CAIGE B,2000-LUNBLK(R) ;skip if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get desc pntr for next file + CAIL B,2000-LUNBLK(R) + MOVEI D,2000*UFDBPW ;but if last file, get infinity + CAML J,C ;verify that QDIRP points to this file + CAML J,D + BUG +QGC42: AOBJN A,QGC41 ;do next channel + +; If you thought that was paranoid, get a load of this: + +QGC49: MOVE B,UDNAMP(R) + ADD B,R +QGC50: CAIL B,2000(R) + JRST QGC60 + LDB C,[UNDSCP UNRNDM(B)] + SOS C + IDIVI C,UFDBPW ;NOTE if UNDSCP = 0 we depend on bytes + HLL C,QBTBL(D) ; off left end of word LDB'ing as zero + ADDI C,UDDESC(Q) + LDB T,C + SKIPE T + BUG ;descriptor not preceeded by zero + MOVE J,UNRNDM(B) + TRZ J,#.BM UNDSCP ;LH(J) flags, RH(J) just desc pntr + TLNE J,UNLINK + JRST QGC52 +QGC51: ILDB T,C + JUMPE T,QGC53 + CAIG T,UDWPH + AOJA J,QGC51 +REPEAT NXLBYT, IBP C + ADDI J,NXLBYT+1 + JRST QGC51 + +QGC52: ILDB T,C + JUMPE T,QGC53 + CAIE T,': + AOJA J,QGC52 + IBP C + ADDI J,2 + JRST QGC52 + +QGC53: TLNE J,UNWRIT ;RH(J) has desc pntr to the zero that ends the file + ADDI J,QAPBMN ;if being written, needs room for one more track + CAIL B,2000-LUNBLK(R) ;now set D to point to next descriptor area + SKIPA D,UDESCP(R) ;do this instr if last file in dir + LDB D,[UNDSCP UNRNDM+LUNBLK(B)] ;else get next file's desc pntr + CAIG D,(J) + BUG ;descriptors overlap + ADDI B,LUNBLK + JRST QGC50 + +; Copy the descriptors back into the directory + +QGC60: MOVSI C,UDDESC(Q) ;make BLT pointer to copy it back + HRRI C,UDDESC(R) + MOVE B,UDNAMP(R) ;use same BLT to zero out the free area + ADD B,R + BLT C,-1(B) + +; Take win return. + + AOS -9(P) +QGC69: LDB A,[121000,,Q] ;core block number of temporary page + PUSHJ P,TMEMR ;return it + MUINP ;verifying that it is the right one. + IRPC X,,RTJIQDCBA + POP P,X + TERMIN + POPJ P, + +SUBTTL INTERPRET DESCRIPTORS + +QFNTR: MOVE H,QUDPR(A) ;BYTE # IN Q CHNL # IN A + PUSHJ P,QUDLK ;DONT SKIP IF OFF FILE + MOVE T,QSNLCN(H) ;RETN BLOCK IN QSLGL(A) AND QSBI(A) DIR PNTR IN QDIRP(A) + ADD T,QUDFPR(A) ;FIRST ADR OF BLOCK IN QFBLNO(A) + LDB TT,[UNDSCP+UNRNDM(T)] ;CHAR ADR OF FILE BEG + MOVEM TT,QDIRP(A) ;SKIPS IF FINDS BLOCK AND LEAVES USER DIR LOCKED + CLEARM QSBI(A) + CLEARM QFBLNO(A) + CLEARB J,QSLGL(A) ;J HAS ORG OF FIRST NON-EX-BLOCK IF OFF END OF FILE +QFNT1A: PUSHJ P,QFNT1 + JRST QUDULK ;OFF END OF FILE RETN NOT SKIPPING + CAMLE J,Q + JRST QFNT7 ;LOCATED BLOCK CONTAINING WORD + MOVEM J,QFBLNO(A) + JRST QFNT1A + +QFNTN: MOVE H,QUDPR(A) ;LIKE ABOVE BUT SCAN FORWARD ONLY FROM CURRENT SPOT + PUSHJ P,QUDLK + PUSHJ P,QFNT1 + CAIA ;EOF, DON'T SKIP RETURN + AOS (P) + MOVEM J,QFBLNO(A) + JRST QUDULK + +QFNT1: SKIPE QSBI(A) ;DECODE NEXT BLOCK, CHNL IN A, SKIP UNLESS EOF. + JRST QFNT2 ;BLOCK # IN QSLGL FILE ADR IN J (TAKE N PENDING) +QFNT3: PUSHJ P,QMPDCH ;GOBBLE NEXT CHR OF DESC IN R (POINTED TO BY QDIRP) INCR QDIRP + CAIN R,UDWPH ;ALSO RET BYTE PNTR IN TT + JRST QFNT3 ;NULL + JUMPN R,QFNT8 ;NOT OFF END OF FILE + SOS QDIRP(A) + POPJ P, + +QFNT8: TRNE R,40 + JRST QFNT4 + CAILE R,UDTKMX + JRST QFNT6 ;SKIP AND TAKE + MOVEM R,QSBI(A) +QFNT2: SOS QSBI(A) + AOS QSLGL(A) +QFNT5: MOVEI J,2000 ;ACTIVE BYTES IN BLOCK + IMULI J,@QSBYTE(A) + ADD J,QFBLNO(A) + JRST POPJ1 + +QFNT7: MOVSI T,%QALBK ;SET UP PROC LAST BLOCK FLG AND RETN + ANDCAM T,QSRAC(A) ;CLEAR LAST BLOCK OF FILE BIT + SKIPE QSBI(A) + JRST QFNT7A ;NOT LAST BLOCK + ILDB R,TT ;GET NEXT CHR IN DIR + JUMPN R,QFNT7A + IORM T,QSRAC(A) ;PROCESSING LAST BLOCK +QFNT7A: AOS QSBI(A) ;FAKE OUT PI ROUTINE WHICH WILL TRY TO INCREMENT + SOS QSLGL(A) + JRST POPJ1 + +QFNT4: MOVEI J,0 ;LOAD ADR + DPB R,[140400,,J] + PUSHJ P,QMPDCH + DPB R,[060600,,J] + PUSHJ P,QMPDCH + DPB R,[0600,,J] + MOVEM J,QSLGL(A) + JRST QFNT5 + +QFNT6: MOVEI J,1-UDTKMX(R) + ADDM J,QSLGL(A) + JRST QFNT5 + EBLK + +SUBTTL DISK CHANNEL DATA AREAS + +QBFP: BLOCK NQCHN ;BUFFER LIST LH LAST RH FIRST + ;READ: PI IN MP OUT. WRITE: MP IN PI OUT. +SINLST: BLOCK NQS ;SWAP-IN LISTS FOR EACH DISK +SOUTLS: BLOCK NQS ;SWAP-OUT LISTS FOR EACH DISK + +;READ/WRITE LISTS LINK THROUGH MLO IN MEMBLT. +;LH(MEMPNT) HAS DISK ADDR, RH(MEMPNT) HAS # BYTES IN BLOCK IF FILE READ +;MWC IN MEMBLT HAS WORD COUNT IF WRITE (FOR EXTRA-WORDS) + +QFCHN: NQCHN ;NUMBER OF FREE QSK CHNLS (NOT COUNTING DIR WRITE AND SWAP CHANNELS) + +QUSR: REPEAT NQCHN,-1 ;USER +DWUSR: -1 ;0 IF DIR WRITE ACTIVE +SWUSR: REPEAT NQS,-1 ;0 IF SWAP XFER ACTIVE +QDIRP: BLOCK NQCHN ;CHAR ADR PNTR TO DESC AREA FOR FILE +QSLBLK: BLOCK NQCHN+NQS+1 ;LAST BLOCK NUMBER OF FILE WRITTEN +QSLGL: BLOCK NQCHN ;LAST QSGL +QSGL: REPEAT NQCHN+NQS+1,-1 ;-1 IDLE + ACTIVE TRACK + ;LAST NQS+1 FOR FD WRITE AND SWAPPING +QSBI: BLOCK NQCHN ; COUNT CONSECUTIVE BLOCKS +QSBFS: BLOCK NQCHN ;NUMBER OF BUFFS THIS CHNL +1 IF EOF AT PI WITH QSBFS=0 +QPCLSR: BLOCK NQCHN ;PCLSR STATUS OF MAIN PROGRAM - LOAD SYSTEM CALL +QSMDN: BLOCK NQCHN ;MAIN PRGM ACTIVE BUFFER NUM +OLDRDT: BLOCK NQCHN ;STORAGE FOR PREVIOUS REFERENCE DATE +QSRAC: BLOCK NQCHN+1 + REPEAT NQS, %QMSWP ;SWAPPING CHANNELS START OUT IN SWAP MODE + %QA==525252(1) + %QALOK==400000 ;4.9 CHNL LOCKED (NOT USED) + %QAEFR==200000 ;4.8 EOF REACHED READ + %QAEFW==100000 ;4.7 EOF WRITE + %QACTH==40000 ;4.6 DONT RELOAD. CORE JOB HUNG ON ACTIVE BUFFER + %QAFUL==20000 ;4.5 GC DIR BEFORE COMMITTING ANOTHER BLOCK TO FILE + %QADEL==10000 ;4.4 DELETE WHEN CLOSED + %QAACC==4000 ;4.3 FILE ADDRESS ALTERED BY .ACCESS OR OTHERWISE + %QAPAR==2000 ;4.2 NON RECOV PARITY ERR (OR OTHER DISK ERR) AT PI + %QAOUT==1000 ;4.1 ASSOC USER OUT DONT RELOAD (NOT IMPLEM.) + %QALBK==400 ;3.9 READ CHNL PROCESSING LAST BLOCK FLAG + %QAMPU==200 ;3.8 UPDATE QSMPRP, QSMPRC ON NEXT BUFFER GOBBLE + %QAWOV==100 ;3.7 FILLING OUT LAST BLK OF FILE IN WRITE OVER MODE PAST ORIG EOF + %QALNK==40 ;3.6 FILE IS REALLY A LINK + %QALOP==20 ;3.5 LINKS WERE TRACED IN OPENING THIS FILE. + %QARWT==10 ;3.4 MAKE WOULD-BE READERS WAIT (RATHER THAN GETTING FILE LOCKED ERROR) + %QAFNY==4 ;3.3 "FUNNY BLOCK", WORD COUNT IN LAST WORD + ; 8/20/90 No longer ever gets set. + $QAMOD==220200 ;3.2-3.1 READ/WRITE MODE 0 NORMAL 1 WRITE OVER 2 COPY OVER WRITE + %QAMWO==1 ;3.1=1 => WRITE-OVER MODE. + %QM==777777 ;RH CHANNEL MODE. INDEX INTO ACTION TABLES USED AT PI LEVEL. +.SEE %QMIDL ;FOR TABLE OF CHANNEL MODES + +QDSKN: BLOCK NQCHN ;DISK UNIT NUMBER +DWSKN: 0 ;DISK WRITING DIR ON +SWSKN: REPEAT NQS,.RPCNT ;DISK SWAP XFER +QSCRW: BLOCK NQCHN ;0 READ -1 WRITE + -1 ;D.W. + BLOCK NQS ;SWAP +QSCABN: BLOCK NQCHN ;ACTIVE BUFFER NUMBER PI LEVEL OR -1 IF NONE +DWABN: -1 ;DISK D.W. A.B.N +SWABN: REPEAT NQS,-1 ;SWAP ABN +QUDPR: BLOCK NQCHN ;NUMBER OF ASSOCIATED USER DIR PNTR +QUDFPR: BLOCK NQCHN ;RELATIVE PNTR TO FILE AREA, ZERO IF NO PARTICULAR FILE +QMPTN: BLOCK NQCHN ;HAS LAST TRACK STORED IN DIRECTORY +QMPTC: BLOCK NQCHN ;MAIN PRGM TRACK COUNT +QMTTR: BLOCK NQCHN ;TRACK RESERVED OR -1 +QMFTP: BLOCK NQCHN+1 ;TRACK NUMBER FOR SCAN FOR FREE TRACKS IN TUT ON WRITE + REPEAT NQS,NUDSL; DITTO FOR SWAP CHANNELS +QERRS: BLOCK NQCHN+NQS+1 ;NUMBER ERRORS TRYING LAST OP +QSMPRP: BLOCK NQCHN ;MAIN PRGM BYTE POINTER +QSMPRC: BLOCK NQCHN ;M.P. COUNT (BYTES LEFT IN BUFFER) +QSBYTE: BLOCK NQCHN ;LH BYTE PNTR (P=44), RH BYTES PER WORD +QSBSIZ==300600,,QSBYTE ;BYTE POINTER TO CHANNEL BYTE SIZE +QFBLNO: BLOCK NQCHN ;BYTE # IN FILE OF BEG OF BLOCK BEING PROCESSED AT M.P. LEVEL +QRADAD: BLOCK NQCHN ;DESIRED BYTE ADR (LOOKED AT IF %QAACC OR %QAMPU IN QSRAC SET) +QPIBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN BLOCK ACTIVE AT P.I. LEVEL (READ) + ;BIT 4.9 => GET FROM LAST WORD IN BLOCK (%QAFNY) + ; 8/20/90 %QAFNY can no longer happen. +QMPBSZ: BLOCK NQCHN ;NUMBER OF BYTES IN MN PROG ACTIVE BUFFER +QLDPTR: BLOCK NQCHN .SEE NLDSBQ ;DURING SBLK LOADING, HOLDS THE AOBJN POINTER + ;INTO USER CORE FOR DOING A DISK TRANSFER ON. +QSMMP: BLOCK NQS ;MMP ADDRESS OF BLOCK ACTIVE ON SWAPPING CHANNEL + +;VARIABLES FOR CURRENT TRANSFER + +QSDU: -1 ;UNIT TRANSFERING DATA, -1 IF NONE. +QSDCH: -1 ;CHNL READY TO BE TRANSFERED ON QSDU +QERS1: -1 ;ERR VERIFY SWITCH -1 NO ERR 0 EXPECTING COMPLETION OF VERIFY OP +QDWIP: 0 ;NUMBER OF DIR WRITE IN PROGRESS 4.9=1=>MASTER + +IFN T300P,[ +QSDU1: -1 ;QSDU FOR OTHER CONTROLLER +QSDCH1: -1 ;ASSOCIATED CHANNEL +QTUNT1: -1 ;UNIT TO TRANSFER NEXT +QTCHN1: -1 ;CHANNEL TO TRANSFER NEXT +NRXFR1: 0 ;METERS +NWXFR1: 0 +NSRXF1: 0 +NSWXF1: 0 +LQTM1: 0 ;TIME LAST TRANSFER STARTED +];T300P + +;MASTER FILE DIRECTORY + +QMDRO: -1 ;ORIGIN OF MASTER DIR 4.9 IF LOCKED + ;-2 ON WAY IN + ;4.6 NOT IN + ;4.5, 4.4, 4.3, ... CHANGED + NOT WRITTEN UNIT 0, 1, 2, ... + ;3.2=1 NOT RECONCILED (NQFUS NOT SET UP) + ;3.1-3.5 MUST BE ZERO (AT LEAST AFTER ITS RECONCILED) +QAMDNO: -1 ;ASCENDING MASTER DIRECTORY NUMBER, -1 NOT SET UP +NQFUS: 0 ;NUMBER OF FREE LOSER SLOTS IN MFD + +;TRACK UTILIZATION TABLES + +QTUTO: REPEAT NQS,-1 ;ADDRESS OF TUT. LH SIMILAR TO QMDRO + ;4.9 LOCK + ;4.8 READ-IN NOT STARTED YET + ;4.6 NOT READ IN YET + ;CHANGED AND NOT WRITTEN ON UNIT + ;0 = 4.5 1 = 4.4 2 = 4.3 3 = 4.2 4 = 4.1 + ;5 = 3.9 6 = 3.8 + ;3.1-3.5 MUST BE ZERO +QDPWF: BLOCK NQS ;-1 TUT NOT RECONCILED (CALL QTCH1) +QTWRTM: BLOCK NQS ;TIME TUT LAST WRITTEN +QSFT: REPEAT NQS,-1 ;NUMBER TRACKS FREE IN USER AREA +QSFTS: BLOCK NQS ;NUMBER TRACKS FREE IN SWAPPING AREA +QPKNM: BLOCK NQS ;NAME OF PACK +QPKID: REPEAT NQS,-1 ;PACK ID OF DISK ON DRIVE +IFN QRSRVP,[ +QRESRV: REPEAT NQS,-1 ;NON-ZERO => PACK ON THIS DRIVE RESERVED. SET FROM TUT. + ;NOT 0 AND NOT -1 => SIXBIT DEVICE NAME FOR "SECONDARY" PACK +];QRSRVP +NTBL: ;NUMBER OF BLOCKS IN TUT ON THIS DRIVE +IFE T300P, REPEAT NQS, NTUTBL +IFN T300P,[ + REPEAT T300P, NTUTBL + REPEAT NQS-T300P, NTUTB1 +];T300P + +;POSITIONER VARIABLES (INDEXED BY PHYSICAL DRIVE) + +QSKT1: REPEAT NQS,-1 ;CHANNEL POSITIONER SET FOR OR -1 IF NONE +QRCAL: REPEAT NQS,0 ;-1 IF RECALIBRATING +QSPPS: REPEAT NQS,-1 ;INTENDED POSITIONER POSITION (NOT USED???) +QSEEK: BLOCK NQS ;-1 IF SEEKING +QPOS: REPEAT NQS,-1 ;CURRENT CYLINDER +QPOSGL: BLOCK NQS ;CYLINDER TRYING TO POSITION TO +IFN DC10P,[ +QRCTIM: BLOCK NQS ;RECALIBRATE TIMEOUT IN HALF SECONDS. THE ATTNS +];DC10P ; TEND TO GET LOST FOR SOME REASON + +;MISCELLANEOUS DISK VARIABLES + +QACT: REPEAT NQS,0 ;ONLY USE UNITS WITH 0 +QACTB: 0 ;4.5 UNIT 0 ACT 4.4 1 ACT 4.3 2 4.2 3 4.1 4 + ;3.9 5 3.8 6 +QWBUFS: 0 ;TOTAL NUMBER OF WRITE BUFFERS ACTIVE + +QWBFMX: 10.*DC10P+15.*RP10P+30.*RH10P+20.*RH11P ;MAX # ALLOWED. SHOULD BE + ; ABOUT 1 SEC DISK XFER. +QHUNGF: 0 ;-1 => DISK CONTROL HUNG, PI LEVEL SHOULD RESET, RECALIBRATE, RETRY +NTQHNG: BLOCK NQS ;NUMBER OF TIMES TRANSFER HUNG ON THIS UNIT + +QTUNT: 0 ;UNIT TO TRANSFER ON NEXT +QTCHN: 0 ;CHNL .. +QLCHN: 0 .SEE QINT2C +QWRU: -1 ;DEFAULT WRITE UNIT (-1 if there isn't a default unit yet) +MDSK: 0 ;DRIVE # OF MASTER DISK +QACTTM: -1 ;SETOM ON READ OR WRITE DATA TRANSFER + ;AOS AT SSLCK IF + OK TO WRITE DIRS + ;IE DON'T TIE UP DISK TO WRITE DIR UNLESS THINGS ARE QUIET +QDWFAR: -10. .SEE QINT3 ;WRITE DIRS SOME OF THE TIME ANYWAY +LQTM: 0 ;TIME AT WHICH LAST COMMAND GIVEN TO DISK +QFTTHR: 600. ;IF FREE TRKS ON QWRU GOES BELOW THIS, SWITCH TO UNIT WITH MOST FREE TRACKS +QRDAHD: IFE MCOND DM,[0] .ELSE 2 ;NUMBER OF BLOCKS TO READ AHEAD + +LASTGC: 0 ;NAME OF LAST DIRECTORY TO GET GC'ED + +;USER DIRECTORIES + +QNUD==40. ;NUMBER USER DIRECTORIES + +QFUD: QNUD ;NUMBER OF FREE UFD SLOTS + +QSNUD: BLOCK QNUD ;USER NAME OR 0 IF FREE +QSNLCN: BLOCK QNUD ;4.9 LOCKED, 4.8 ALSO NOT IN CORE RH CORE ADR + .SEE DCHBT ;4.6 =1 NOT PAWED OVER 4.5 CHNGD AND NOT WRITTEN ON UNIT 0 + ;4.4 UNIT 1 4.3 UNIT 2 4.2 UNIT 3 4.1 UNIT 4 + ;3.9 UNIT 5 3.8 UNIT 6 3.7 UNIT 7 + %QUDWM==40 ;3.6 WRITE IMMEDIATELY ON MASTER DISK + ;@ + XR BITS MUST = 0 + +QSNNR: BLOCK QNUD ;NUMBER PC'S LOOKING AT THIS IE + ;+1 FOR FILE OPEN AND USER IN CORE(?) +QSNMI: BLOCK QNUD ;TRACK N OF USER DIR IF NOT NEWLY CREATED +QSFBT: BLOCK QNUD ;FREED-BLOCKS-TABLE. HEAD OF A LIST OF PAGES, + ;THREADED THROUGH THE SECOND WORD AND ENDING WITH + ;ZERO. FIRST WORD IS AOBJN POINTER TO FREE PART + ;OF PAGE. FROM THIRD WORD UP TO BELOW WHERE AOBJN + ;POINTS ARE WORDS UNIT,,BLOCK WHICH RECORD DISK + ;BLOCKS TO BE FREED ONCE THE DIR HAS BEEN WRITTEN + ;OUT TO THE MASTER DISK. ELIMINATES REUSED ADDRESS + ;PROBLEMS BY GUARANTEEING THAT IF THE SYSTEM SHOULD + ;CRASH AT ANY TIME, THERE CANNOT BE TWO DIRECTORIES + ;ON DISK THAT BOTH POINT TO THE SAME BLOCK. + +IFN QRSRVP,[ +QSALLO: BLOCK QNUD ;-1 OR DRIVE # DIRECTORY ALLOCATED TO +] + +;LOCKS + +UDRSW: -1 ;USER DIR AREA LOCKED + 0 +QCHSW: -1 ;CHNL AREA LOCKED + 0 +QSKOSW: -1 ;QSKO1 LOCKED (USER DIR READIN) + 0 + +;LIST OF PAGES CONTAINING BLOCKS WHICH CAN NOW BE FREED. MOVED TO +;HERE FROM QSFBT WHEN THE DIR IS WRITTEN OUT. THE ACTUAL FREEING +;IS DONE BY THE CORE JOB. + +QFBTS: 0 + +;VARIABLES FOR SYSTEMS CONCEPTS DISK CONTROL + +IFN DC10P,[ +QRCSW: 105 ;- NO READ COMPARE 0 COMPARE WRITES + COMPARE ALL +QCST: 0 ;CONI DC0, AT QINT +QERST: 0 ;HAS CONI DC1, BITS WHEN AN ERROR HAPPENS +PKIDM: 0 ;-1 WAITING FOR PACK ID TO BE READ +RPKID: -1 ;PACK ID READ INTO HERE BY DISK CONTROL +QDRSTS: 0 ;DRIVE STATUS WORD STORED BY DISK CONTROL +] +IFE DMDSK,[ + 0 ;FOR BLT INTO QXWDS +QXWDS: BLOCK NXWDS +] +IFN DC10P,[ +QCHPRG: 0 +QCHPR2: DCOPY (-2000_2&37774) + DCOPY (-NXWDS_2&37774)QXWDS +QCHPR4: DHLT ;OR DRC +QCHPR3: DCCOMP (-2000_2&37774) + DCCOMP (-NXWDS_2&37774)QXWDS + DHLT + +GPKID: DSPC+DSCRHD+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +QRECAL: DSPC+DSRCAL+DUNENB +] + +;VARIABLES FOR DEC RP10 DISK CONTROL + +IFN RP10P,[ +QERST: 0 ;CONI DPC, ON ERROR +QERDTI: 0 ;DATAI DPC, ON ERROR +QCST: 0 ;CONI DPC, AT QINT +QCHPRG: 0 ;SEEK COMM +IFN KA10P, QIOWD: -2000,, ;XFER DATA (HRRM ADR-1 IN RH) +IFE DMDSK,[ + -NXWDS,,QXWDS-1 + -200+NXWDS,,0 +];DMDSK + 0 + +QRECAL: 700000,, +QGTBZY: 0 ;FLAG FOR SOFTWARE AT INT +];RP10P +IFN QRDCMP,[ +QRCSW: 0 ;NON-ZERO TO ENABLE READ-COMPARING +RDCPHS: 0 ;0 NORMAL, -1 DOING OPERATION WHICH SHOULD BE READ-COMPARED + ; AFTERWARD, + DOING READ-COMPARE +IFN KA10P,[ +RCIOWD: BLOCK 2 ;CHANNEL PROGRAM FOR READ INTO QRCBUF +];KA10P ;ON KL WE HAVE TO PUT IT IN THE EPT! +QRCBUF: BLOCK 2000 +];QRDCMP + +;VARIABLES FOR DEC RH10 DISK CONTROL + +IFN RH10P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +NCSHI: 0 ;NUMBER OF CACHE INVALIDATES +NCSHIL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE INVALIDATES +NCSHU: 0 ;NUMBER OF CACHE UNLOADS +NCSHUL: 0 ;NUMBER OF LOOPS WAITING FOR CACHE UNLOADS +QERST: 0 ;CONI AT LAST ERROR (LEAVE THIS THROUGH QECPAT IN SAME ORDER) + 0 ;DATAI AT LAST ERROR +QERSTS: 0 ;%HRSTS AT LAST ERROR +QERER1: 0 ;%HRER1 AT LAST ERROR +QERER2: 0 ;%HRER2 AT LAST ERROR +QERER3: 0 ;%HRER3 AT LAST ERROR (IBM WOULD CALL THIS A CHANNEL LOGOUT AREA) +QERDCL: 0 ;%HRDCL AT LAST ERROR +QECPOS: 0 ;%HRPOS AT LAST ERROR +QECPAT: 0 ;%HRPAT AT LAST ERROR +QCST: 0 ;CONI AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR +RHDATO: -1 ;LAST DATAO DSK, FOR DEBUGGING +ECCPAG: BLOCK 8 ;TEMP FOR SAVING PAGE MAP VARS AT QECC (WITH SPM) +NQDRE: BLOCK NQS ;# MASSBUS TIMEOUTS PER DRIVE. +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +] + +;VARIABLES FOR DEC RH11 DISK CONTROL (ON THE KS10 UNIBUS) + +IFN RH11P,[ +QCHPRG: 0 ;DATA TRANSFER COMMAND +QCHPGA: 0 ;ADDRESS (CYL IN LH, TRACK-SECTOR IN RH) +QIOWD: 0 ; BA,,WC for RH11 +QCST: 0 ;CS1 AT LAST INTERRUPT +QGTBZY: 0 ;FLAG FOR SOFTWARE-CAUSED INTERRUPT + +QERST:: ;Gubbish saved at last error +QERCS1: 0 ; CS1 Control & Status 1 +QERCS2: 0 ; CS2 Control & Status 2 +QERSTS: 0 ; STS Drive status +QERBA: 0 ; BA Unibus address for transfer +QERWC: 0 ; WC Word count for transfer +QERER1: 0 ; ER1 Error 1 +QERER2: 0 ; ER2 Error 2 +QERER3: 0 ; ER3 Error 3 +QERPOS:: +QECPOS: 0 ; POS ECC position +QERPAT:: +QECPAT: 0 ; PAT ECC pattern +QERMAP: 0 ? 0 ; Unibus map to disk buffer + +QECCS: BLOCK NQS ;NUMBER OF ECC CORRECTED ERRORS, PER DRIVE +QECCAD: BLOCK NQS ;DISK ADDRESS OF MOST RECENT ECC CORRECTED ERROR + +NQSATN: BLOCK NQS ;# SPURIOUS ATTENTIONS IN MID-TRANSFER +NQEATN: BLOCK NQS ;# ATTENTIONS REPORTING ERRORS +NQOFFL: BLOCK NQS ;# TIMES DISK WENT OFFLINE +] + +DIRHNG: 0 ;LH POINTS TO LIST OF DIRHNG DEVICE CHANNELS, + ;CHAINED THROUGH LH'S OF IOCHNM WORDS. + ;0 MEANS END OF LIST + ;MODIFY ONLY WITH THE CLOCK OFF. + ;EACH DIRHNG DEVICE CHANNEL'S IOCHST WORD RH CONTAINS THE + ;TRACK NUMBER OF THE DIRECTORY IT IS LOOKING AT. + +BBLK + +;DISK CONSTANTS + +IFN RP10P,[ +QATTNS: REPEAT NQS,500000+.RPCNT_14,,1_<10-.RPCNT> +;WORDS TO CLEAR ATTNS AND SELECT DRIVES +] + +SWAPL: SINLST(Q) + SOUTLS(Q) + +DCHBT: 20000,, ;BIT SET IF DIR NOT WRITTEN OUT ON UNIT + 10000,, + 4000,, + 2000,, + 1000,, + 400,, + 200,, + 100,, +IFL .-DCHBT-NQS,.ERR YOU BETTER FIND ANOTHER BIT FOR QACTB,QSNLCN,QTUTO + +IFN DC10P,[ +QTRAN: 0 ;FORMERLY MAPPED 203 CYL VIRTUAL DRIVES TO 406 CYL CALCOMPS + 1 ;4.9 => 2ND HALF OF PHYSICAL DRIVE + 2 ;(DOESN'T DO ANYTHING NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NQS, .ERR BARF AT QTRAN +] + +SUBTTL DISK CLOSE ROUTINES + +QICL: PUSH P,R + SKIPGE QUSR(A) + BUG + MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) ;FLUSH RANDOM ACCESS HACKERY + PUSHJ P,QICLW1 ;WAIT FOR INPUT TO STOP + MOVE TT,QSRAC(D) + TLNE TT,%QADEL ;DELETE? + JRST QSICLD ;YES + MOVE H,QUDPR(D) ;DIRECTORY NUMBER + SETOM QUSR(D) + AOS QFCHN +QICLX: SOSGE QSNNR(H) ;FREE DIRECTORY CHANNEL HAD BEEN USING + BUG + POP P,R + SETZM (R) + POPJ P, + +QICLW1: MOVE D,A ;IDLE CHANNEL AND FLUSH READ BUFFERS + CONO PI,UTCOFF + SKIPGE QSGL(D) + JRST QSICL3 + SKIPL QSCABN(D) + JRST QSICL4 + SETOM QSGL(D) + +QSICL3: HLLZS QSRAC(D) .SEE %QMIDL ;STOP PI + CONO PI,UTCON +QSICL5: PUSHJ P,QSBRB1 ;RETURN M.P. BUFFER IF ANY +QOCL7: HRRZ A,QBFP(D) ;ALSO ENTER TO RETURN UNUSED READ BUFFER ON WRITE OVER MODE +QSICL2: JUMPE A,QSICL6 + LDB C,[MLO,,MEMBLT(A)] + PUSHJ P,MEMR + MOVE A,C + SOS QSBFS(D) + JRST QSICL2 + +QSICL6: SETZM QBFP(D) + POPJ P, + +QSICL4: MOVEI A,%QMRD1 ;STOP PI AFTER THIS BLOCK + HRRM A,QSRAC(D) + CONO PI,UTCON + SKIPL QSGL(D) ;WAIT FOR CHANNEL TO DEACTIVATE + PUSHJ P,UFLS + JRST QSICL5 + +;OUTPUT CLOSE +QOCL: PUSHJ P,QSOCL5 ;CLEAN UP THE DISK CHANNEL +QSOCL4: MOVE D,A ;ENTRY FROM QALINK +QSOCL6: MOVE Q,QUDFPR(D) + MOVE H,QUDPR(D) + ADD Q,QSNLCN(H) + MOVE TT,QSRAC(D) + TLNE TT,%QADEL + JRST QCDLWO ;DELETED (PRESUMABLY VIA DELEWO) + MOVE A,UNFN1(Q) ;Get names of file being hacked. + MOVE B,UNFN2(Q) + PUSHJ P,QLOOK ;FILING OVER ANYTHING? + JRST QSOCL3 + HRRZ I,QSNLCN(H) + ADD I,QUDFPR(D) + CAMN I,Q ;BEING WRITTEN BITS WENT AWAY? + BUG ;TRYING TO DELETE THE FILE WE'RE WRITING + PUSHJ P,QSOCLD ;YES FLUSH IT + PUSHJ P,QUDLK ;RELOCK DIR UNLOCKED BY QSOCLD ETC + JRST QSOCL6 ;MAKE SURE ONE HASN'T REAPPEARED WHILE DIR UNLOCKED + +QSOCL5: LDB H,[$QAMOD,,QSRAC(A)] + JUMPN H,QOCL6 ;DONT HACK ACTIVE WD COUNT IN WRITEOVER MODE +QOCL6A: MOVN D,QSMPRC(A) ;- NUMBER OF BYTES IN BLOCK NOT USED + ADDB D,QMPBSZ(A) ;ADJUST BYTE COUNT OF LAST BLOCK TO REFLECT WHATS USED + CLEARM QSMPRC(A) ;SO WILL BE A NOOP IF PCLSR OUT AND COME BACK THRU HERE +QOCL4: MOVSI Q,%QAEFW + IORM Q,QSRAC(A) ;SET EOF BIT FOR QSBWW AND QUDS + JUMPN H,QOCL5 + SKIPL QSMDN(A) ;NO M.P. BUFFER ANYWAY + JUMPE D,QOCL1 ;ABOUT TO WRITE NULL BLOCK, DON'T +QOCL5: PUSHJ P,QSBWW +QOCL2: MOVE T,A + PUSHJ P,[ SKIPGE QSCRW(T) ;WAIT FOR CHANNEL EITHER LEAVING WRITE MODE + SKIPN QSBFS(T) ;OR WRITING OUT ALL ITS BUFFERS, I.E. PI LEVEL + JRST POPJ1 ;ISN'T GOING TO DO ANYTHING MORE TO IT. + POPJ P, ] + PUSHJ P,UFLS + SKIPE QBFP(A) ;MAKE SURE IF QSBFS NON-ZERO THAT IS ONLY EOF + BUG ;NOT A BUFFER SITTING AROUND FORGOTTEN +QOCL3: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SKIPN D,QMPTC(A) ;SKIP ON NEXT "N" STILL PENDING + POPJ P, + PUSHJ P,QUDS ;STORE IT AWAY + CLEARM QMPTC(A) + POPJ P, + +QOCL6: SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO IDLE OR HANG UP IN READ + PUSHJ P,UFLS + SKIPL QSGL(A) + PUSHJ P,UFLS + MOVE D,A + PUSHJ P,QOCL7 + MOVE A,D + MOVE Q,QSRAC(A) + MOVE B,QSBFS(A) + JUMPE B,QOCL6B + TLNE Q,%QAEFW + JRST QOCL6B + TLNE Q,%QAEFR + SOS B,QSBFS(A) ;COMPENSATE FOR EXTRA AOS ON EOF READ +QOCL6B: CAILE B,1 + BUG + TLNE Q,%QAWOV + JRST QOCL6A ;HACKING LAST BLOCK PAST EOF, UPDATE ACTIVE WD COUNT + JRST QOCL4 + +QOCL1: PUSHJ P,QSBRB ;DISCARD BUFFER + SOS QSBFS(A) + SOS QWBUFS + MOVE D,QDSKN(A) + AOS QSFT(D) ;RESTORE TRACK + JRST QOCL2 + +QSOCL3: MOVE Q,QUDFPR(D) + MOVE TT,QSNLCN(H) + ADDI Q,(TT) + MOVSI T,UNWRIT + ANDCAM T,UNRNDM(Q) ;CLEAR WRITE IN PROG + MOVE TT,QSNLCN(H) + MOVE T,UDNAMP(TT) ;MAKE SURE IT GOES BEFORE * FILE OF SAME NAME + ADDI T,(TT) + CAMN T,Q + JRST QSOC3E ;NO PREV FILE + MOVE J,Q +QSOC3A: SUBI J,LUNBLK + CAMN A,UNFN1(J) + CAME B,UNFN2(J) + JRST QSOC3B ;PREV FILE HAS DIFFERENT NAME + CAILE J,(T) + JRST QSOC3A +QSOC3C: CAMN J,Q + JRST QSOC3E +REPEAT LUNBLK, PUSH P,.RPCNT(J) + MOVE T,J + HRL T,Q + BLT T,LUNBLK-1(J) +REPEAT LUNBLK, POP P,LUNBLK-.RPCNT-1(Q) + SUB Q,J + SUBI J,(TT) + MOVSI T,-NQCHN +QSOC3D: HRRZ A,QUDPR(T) + SKIPL QUSR(T) + CAIE A,(H) + JRST QSOC3F + HRRZ A,QUDFPR(T) + CAIN A,(J) + ADD A,Q + MOVEM A,QUDFPR(T) +QSOC3F: AOBJN T,QSOC3D +QSOC3E: SETOM QUSR(D) ;FREE THE DISK CHANNEL + AOS QFCHN + MOVE C,QSNUD(H) +IFN TPLP+UNSPLP,[ + MOVEI TT,SCRTPC + CAMN C,[SIXBIT /.LPTR./] + IORM TT,SUPCOR ;CLOSING FILE ON TPL DEVICE SO SET FLAG FOR SYS JOB +];TPLP + CAMN C,[SIXBIT/.MAIL./] + AOS NQMFWR ;CLOSING FILE ON .MAIL. => BUMP COUNT TO WAKE MAILER DEMON +IFN XGP,[ + CAMN C,[SIXBIT/.XGPR./] + AOS NXGPFW ;WAKE XGPSPL +];XGP + MOVE A,QSNMI(H) ;TELL DIRHNG DEVICE ABOUT IT + PUSHJ P,DIRSIG + MOVE TT,QACTB ;DIR CHANGED (AT LEAST WRITE-IN-PROG BIT TURNED OFF) + IORM TT,QSNLCN(H) + PUSHJ P,QUDULK + SOSGE QSNNR(H) + BUG + PUSHJ P,QSTRTR + SETZM (R) ;CLEAR IOCHNM WORD. + POPJ P, + +QSOC3B: ADDI J,LUNBLK + JRST QSOC3C + +QOCLR: MOVE Q,QSRAC(A) ;CLOSE UNIT ASCII OUTPUT + TLNN Q,%QAWOV + TLNN Q,%QAMWO+%QALNK + PUSHJ P,QOCLPD ;PUT NEEDED PADDING UNLESS NOT A FILE OR NOT AT END + JRST QOCL + +QOCLPD: LDB Q,[360600,,QSMPRP(A)] ;NUMBER OF BITS NOT WRITTEN IN LAST WORD + CAIL Q,44 + POPJ P, ;LAST WORD NOT WRITTEN AT ALL + LSH Q,18.+6 ;FILL THOSE BITS WITH ^CS + HRR Q,QSMPRP(A) + MOVE C,[EOFWRD] + SKIPLE QSMPRC(A) ;INHIBIT STORE IF NO BUFFER ETC. + DPB C,Q + POPJ P, + +SUBTTL DISK INTERRUPT ROUTINES + +OVHMTR QIN ;DISK INTERRUPT LOW-LEVEL + +IFN RP10P,[ + +QINT: AOS QGTBZY + MOVEM TT,QCST +IFN DMDSK,[ + TRNN TT,200000 ;END OF CYLINDER + JRST QINT0 + SKIPGE C,QSDCH + BUG + MOVE D,QSGL(C) + IDIVI D,NBLKSC ;IS IT LEGITIMATE? + SKIPL QSDU ;IF NO TRANSFER IN PROGRESS, IGNORE + CAIN E,NBLKSC-1 ;IS LEGITIMATE FOR LAST BLOCK IN CYLINDER + CAIA ;IGNORE + BUG PAUSE,[MAYBE DISK CONTROL IS WRITING ALL OVER THE DISK AGAIN] +QINT0: ];DMDSK + TDNE TT,[17177700] ;ANY ERRORS? + JRST QINTE +QINTN2: DATAI DPC,R + SKIPGE QSDU ;DONT CLOB CMD BUF TO CLR ATTS DURING DATA XFER + TRNN R,776 ;ANY ATTNS + JRST QINTA ;NO + LDB I,[11000,,R] ;YES,FIND WHICH DRIVE + JFFO I,.+1 ;CLOBBERS Q + SUBI Q,28. + +QINTAT: DATAO DPC,QATTNS(Q) ;CLEAR ATTNS + DATAI DPC,E + TLNN E,40 + JRST QRECAT ;NOT ON CYLINDER, RECALIBRATE + LDB A,[DCYLI E] + TRNE E,.BM DCYLXI + ADDI A,400 + CAME A,QPOSGL(Q) + JRST QRECAT ;SEEK TO THE WRONG PLACE (CALCOMPS LIKE TO DO THIS) + MOVEM A,QPOS(Q) ;REMEMBER WHERE IT IS AT + SETZM QSEEK(Q) + SETZM QRCAL(Q) + JRST QINT ;TRY AGAIN + +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION - FIND NEW TRANSFER + CONSO DPC,400000 + CONSO DPC,10 + JRST DSKEX ;TRANSFER STILL IN PROGRESS, DISMISS + CONSZ DPC,20 + JRST .-1 ;BUSY? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: DATAI DPC,R + CONI DPC,TT ;THIS LOOKS REDUNDANT BUT APPARENTLY IS NECESSARY + ;DUE TO TIMING OF THE DISK-NOT-READY CONDITION + CONO DPC,175700+DSKCHN ;RESET CONDITIONS + MOVEM TT,QERST + MOVEM R,QERDTI + CONSZ DPC,20 ;WAIT FOR UNBUSY + JRST .-1 + MOVE Q,QSDU ;FOR QOVR + MOVE E,QCHPRG + TRNE TT,20000 ;OVERRUN + JRST QOVR + TRNE TT,2000 ;NOT READY + JRST QNRDY + TDNE TT,[12010700] ;BITS 14,16,23,27-29 ARE LOSERS + BUG HALT,[DSK: TOTALLY FATAL ERROR, CONI=],OCT,QERST + TLNE TT,5 ;WD OR SECTOR PARITY ERROR + JRST QDE + TRNE TT,1000 ;WRITE LOCKED + JRST QIRWRE + TRNE TT,40000 ;SEARCH FAILED + JRST QHE + TRNN TT,100000 ;POWER FAILURE + JRST QINTE1 + CONSZ DPC,100000 ;TRY IT AGAIN + JRST 4,.-1 + JRST QHE + +QINTE1: TLNE R,10 ;FILE UNSAFE--NEED OPERATOR INTERVENTION + BUG PAUSE,[DSK: FILE UNSAFE UNIT ],DEC,Q + TLNE R,4 + BUG ;NO SUCH DRIVE + TLNE R,110 ;POSITION FAILURE (OR PROCEEDED FILE UNSAFE) + JRST QHE + AOS NQSE(Q) ;SPURIOUS ERROR + JRST QINTX ;IGNORE + +QIRWRE: BUG PAUSE,[DSK: WRITE LOCKED UNIT ],DEC,Q + JRST QHE + +QNRDY: LDB Q,[410300,,R] ;WHICH DPC + SKIPN QSEEK(Q) + SKIPGE QRCAL(Q) ;NOT SEEKING OR RECALIBRATING IS ERROR + JRST QINTN2 + BUG PAUSE,[DSK: UNIT ],DEC,Q,[NOT READY] + JRST QREC +] ;END IFN RP10P + +IFN DC10P,[ + +QINT: MOVEM TT,QCST + SKIPL PKIDM ;GETS SPURIOUS DIPE WHEN READING PACK ID + CONSO DC1,7777 ;RUMOR THAT DSSERR DOESN'T ALWAYS SET + TRNE TT,DSSERR + JRST QINTE + TRNE TT,DSSATT + JRST QINTAT +QINTA: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING DATA COMPLETION, FIND NEW TRANSFER + CONSZ DC0,DSSRUN+DSSACT + JRST DSKEX ;ACTIVE OR RUN, TRANSFER IN PROGRESS, DISMISS + AOSN PKIDM ;SKIP IF NOT FINISHED READING PACK ID + JRST QSPKID + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + SKIPL QERS1 + JRST QEROK ;OK ON VERIFY + JRST QINTA1 ;TRANSFER COMPLETE... + +QINTE: CONI DC1,TT + CONO DC0,DCCLR+DCERR+DSKCHN ;CLEAR ERRORS + MOVEM TT,QERST + MOVE Q,QSDU + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 ;ACTIVE OR RUN? + SKIPL QERS1 + JRST QERL1 ;VERIFY ALSO LOST + TRNE TT,DOFFL+DPROT+DDOBSY+DNXM+DCPERR + JRST QINTE1 ;REALLY LOST BIG + TRNE TT,DOVRRN + JRST QOVR + TRNE TT,DWTHER+DFUNSF ;SEEK INC, END DISK, WATCHDOG, OR UNSAFE + JRST QHE ;TRY TO RECALIBRATE + SKIPGE PKIDM + TRZ TT,DRLNER ;IGNORE LENGTH ERROR IF READING PACK # + TRNE TT,DIPE+DRLNER+DRCER+DCKSER + JRST QDE ;TRY AGAIN + SKIPGE PKIDM + TRNE TT,-1 + AOS NQSE ;SPURIOUS ERROR (NOT LENGTH ERROR IN PKIDM) + JRST QINTX ;SPURIOUS ERROR + +QINTE1: TRNE TT,DOFFL + BUG PAUSE,[DSK: UNIT ],DEC,Q,[OFFLINE] + TRNE TT,DPROT + BUG PAUSE,[DSK: UNIT ],DEC,Q,[WRITE PROTECTED] + TRNE TT,DDOBSY + BUG PAUSE,[DSK: DATAO WHEN BUSY] + TRNE TT,DNXM+DCPERR + BUG PAUSE,[DSK: MEM PAR OR NXM ERROR] + JRST QOVR + +QINTAT: CONI DC1,Q + CONO DC0,DCCLR+DCCATT+DSKCHN ;CLEAR ATTENTION + LDB Q,[DSATDN Q] ;ATTENTION DRIVE NUMBER + CAIGE Q,NQS + SKIPL QRCAL(Q) + JRST QINTX + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE + JRST QINTX + +;THIS IS CALLED EVERY HALF SECOND +QRCTMO: MOVEI Q,NQS-1 + SKIPL QRCAL(Q) +QRCTM1: SOJGE Q,.-1 + JUMPL Q,CPOPJ + SOSL QRCTIM(Q) + JRST QRCTM1 + BUG INFO,[DSK: RECAL TIMEOUT UNIT],DEC,Q + SETZM QRCAL(Q) + CONO DC0,DCCLR+DCATEB+DSKCHN ;CLEAR ATTENTION ENABLE I GUESS + JRST QRCTM1 +];DC10P + +IFN RH11P,[ + +;;; RHCLRC(Q) Clear controller errors and select drive Q +;;; RHSLCT(Q) Select drive Q +;;; RHCMD(A) Command in A to current drive +;;; RHCLRD Clear current drive +;;; RHCHEK Check for immediate bad news +;;; All return CS1 in A + +RHSLCT: IOWRQ Q,%HRCS2 +RHCHEK: IORDQ A,%HRCS1 + TRNE A,%HXTRE+%HXMCP + BUG HALT,[DSK: MASSBUS ERROR, CS1=],OCT,A + POPJ P, + +RHCLRC: IOWRQ Q,%HRCS2 ; Must select drive before clearing controller + MOVEI A,%HXTRE+%HXIE+%HMNOP +RHCMD: TROA A,%HXIE +RHCLRD: MOVEI A,%HXIE+%HMCLR + IOWRQ A,%HRCS1 + JRST RHCHEK + +EBLK +DSKBRK: 0 +BBLK + JSR UTCSAV +QINT: AOS QGTBZY + MOVE Q,QSDU + IORDQ TT,%HRCS1 + MOVEM TT,QCST + TRNE TT,%HXTRE+%HXMCP + JRST QINTE + TRNN TT,%HXSC ; Perhaps some drive needs attention? + JRST QINT0 ; Not unless SC is set! + IORDQ A,%HRATN + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ; Not expecting completion of transfer. + TRNN TT,%HXRDY + JRST DSKEX ; Transfer still in progress. + AOSN QHUNGF + JRST QHE ; Transfer hung, recalibrate and retry. + PUSHJ P,RHSLCT ; Select that drive. + IORDQ A,%HRSTS ; Get its status. + TRNE A,%HSERR ; Just in case %HXTRE didn't get set (by + JRST QINTE ; analogy with RH10)... + JRST QINTA1 ; Transfer complete... + +QINTAT: MOVNI Q,-35.(B) + HRRZS Q + MOVEI A,1 + LSH A,(Q) + IOWRQ A,%HRATN ; Turn off attention bit. + CAIL Q,NQS + JRST QINT0 + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ; Ignore attention in mid-transfer. + JRST QINTA2 ] + SKIPE QACT(Q) + JRST QINTA2 ; Ignore this drive. + PUSHJ P,RHSLCT + IORDQ B,%HRSTS ; Get status of drive with attention. + TRC B,%HSMOL+%HSDPR+%HSRDY + TRNN B,%HSMOL+%HSDPR+%HSRDY+%HSVV + PUSHJ P,QOFFL ; Went offline and came back online + TRNE B,%HSERR+%HSPIP + JRST [ PUSHJ P,RHCLRD ; Drive barfing not during transfer + AOS NQEATN(Q) ; so clear it + JRST .+1] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION +IFDEF %HRCCY,[ ;Current Cyl register only on RP disks + IORDQ A,%HRCCY + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE +];IFDEF %HRCCY +IFNDEF %HRCCY,[ + MOVE A,QPOSGL(Q) ;On RMxx, jump to conclusion + MOVEM A,QPOS(Q) +];IFNDEF %HRCCY + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON + ; THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +; Went offline and came back online +QOFFL: TRC B,%HSMOL+%HSDPR+%HSRDY ;Recover %HRSTS + IORDQ C,%HRER1 + IORDQ D,%HRER2 +IFDEF %HRER3,[ + IORDQ E,%HRER3 + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D,[ER3=],OCT,E +] +IFNDEF %HRER3,[ + BUG INFO,[DSK: UNIT #],DEC,Q,[CAME BACK ONLINE, CS1=],OCT,A,[STS=],OCT,B,[ER1=],OCT,C,[ER2=],OCT,D +] + + AOS NQOFFL(Q) + MOVEI A,%HMCLR ;Clear the drive + PUSHJ P,RHCMD + MOVEI A,%HMRDP ;I said, clear the drive! + PUSHJ P,RHCMD + MOVEI A,0 + IOWRQ A,%HROFS ;No offset, 18 bits, ECC on, HCI off + MOVEI A,%HMACK ;Turn %HSVV back on so drive will work + PUSHJ P,RHCMD + POPJ P, + +QINTE: +IRPS X,,[CS1 CS2 BA WC POS PAT] ; First get status of controller + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + IORDQ A,UBAPAG+QUBPG_1 ; Unibus map counts as part of + MOVEM A,QERMAP ; controller status. + IORDQ A,UBAPAG+QUBPG_1+1 + MOVEM A,QERMAP+1 + SKIPGE Q ; Try hard to guess the drive. + LDB Q,[$HYDSK QERCS2] + PUSHJ P,RHCLRC ; Clear controller errors and select drive + ; so that we can read its status too. + TRNN A,%HXRDY ; Why would controller be busy? (RH10 + BUG ; code checks for this...) + +IRPS X,,[STS ER1 ER2] + IORDQ A,%HR!X + MOVEM A,QER!X +TERMIN + MOVE A,QERCS1 ; A: CS1 + MOVE R,QERCS2 ; R: CS2 +IFDEF %HRER3,[ ; Disks with ER2 -and- ER3 + IORDQ A,%HRER3 + MOVEM A,QERER3 + SKIPN QERER2 ; Bad news + SKIPE QERER3 + JRST UNSAFE +] +IFNDEF %HRER3,[ ; Disks with just ER2 + SKIPE QERER2 + JRST UNSAFE +] + TRNN A,%HXMCP ; Real bad news + TRNE R,%HYWCE+%HYPE+%HYNED+%HYNEM+%HYPGE+%HYMXF + BUG HALT,[DSK: UNIT #],DEC,Q,[LOSING. CS1=],OCT,A,[ CS2=],OCT,R + TRNE R,%HYDLT+%HYMDP ; Data bus losing? + JRST QINTE1 + MOVE A,QERSTS ; Check Drive Status + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ; Better be all on! + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ; Spurious? + JRST QINT0] + MOVE B,QERER1 ; Check the main error register + TRNE B,#<%H1ECC+%H1DTE+%H1CRC+%H1HCE+%H1ECH+%H1FER+%H1PAR> + JRST UNSAFE ; Those not listed above are considered "hard" + CAIN B,%H1ECC ; Correct correctable error if that is the + JRST QECC ; only problem. + PUSHJ P,QINTER ; Else print message and reset drive + TRNE B,%H1DTE+%H1CRC+%H1HCE+%H1FER ; These require recalibration + JRST QHE + TRNE B,%H1ECC+%H1ECH+%H1PAR ; These require reread + JRST QDE + JRST QOVR ; No error bits set? (How can this + ; happen?) Go and retry... + +;;; Controller error: +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CS1=],OCT,QERCS1,[CS2=],OCT,QERCS2 + JRST QOVR + +;;; Drive error: +IFDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA +] +IFNDEF %HRER3,[ +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[STARTING DISK ADDR=],OCT,QCHPGA +] + JRST RHCLRD ; Reset error status in drive + +;;; Come here for drive unsafe and similar bad things. May be set to +;;; either halt or attempt retry (via USFHLT variable). Note that when we +;;; get here the state of the drive has not yet been disturbed. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + SKIPL QSDU + JRST QHE ;RECALIBRATE AND RETRY + JRST QREC ;Just recalibrate, no transfer to retry + +QECC: PUSHJ P,RHCLRD ; Reset drive + CAME Q,QSDU ; ECC error better be for transfer in + BUG ; progress... + MOVE A,QCHPRG + TRNN A,10 .SEE %HMRED + BUG ; ECC error should only happen during read. + LDB A,[$UPPAG QERMAP] + IORI A,600000 + DPB A,[.PAREP+EXEUMP] ; Point parity error page at buffer. + CLRPT 400000+PAREP_12 ; Get it into our map now. + CLRPT 401000+PAREP_12 ; Both halves... + MOVE J,QERBA + SUBI J,1000+QUBPG_14 ; Correct to relative byte address of start + ; of losing sector. + TRNE J,770777 ; Should always be aligned on sector boundary + BUG ; and within a single block, right? + LSH J,-2 ; J: Address of first word of losing sector + ; within block. + MOVE A,QECPOS ; Get error position + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADDI J,400000+PAREP_12(A) ; J: Address of losing word-pair + ; (In parity error page.) + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + CLRPT 400000+PAREP_12 + CLRPT 401000+PAREP_12 ; Both halves... + + AOS QECCS(Q) ;LOG THE LOSS + LDB E,[111000,,QERBA] ; E: Number of sectors transferred (including + SUBI E,QUBPG_3 ; ECC sector) + MOVE A,QCHPGA + LDB B,[$HASEC A] ;Compute disk address of failing sector: + ADDI B,-1(E) + IDIVI B,NSECS ; C: sector + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D ; B: track + DPB B,[$HATRK A] + MOVEM A,QECCAD(Q) + HLRZ A,A ; A: cylinder + MOVE D,QSDCH ; D: chnl + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT #],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + CAIL E,SECBLK + JRST QINTA1 ;XFER COMPLETE + + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS + ; CYLINDERS + + HRL E,QERWC ; Reassemble "iowd" from + HRR E,QERBA ; saved parts. (Don't trust stuff saved + MOVEM E,QIOWD ; in controller more than we have to.) + HRRZ C,QSDCH ;FOR QECCX + JRST QECCX ;MORE TO DO, CONTINUE XFER + +] ;RH11P + +IFN RH10P,[ + +QINT: AOS QGTBZY + MOVE Q,QSDU + MOVEM TT,QCST + TRNE TT,%HIERR + JRST QINTE + TRNN TT,%HIATN + JRST QINT0 + MOVSI A,%HRATN ;FIND DRIVES NEEDING ATTENTION + PUSHJ P,RHGET + JFFO A,QINTAT +QINT0: SKIPGE Q,QSDU + JRST QINT1 ;NOT EXPECTING COMPLETION OF TRANSFER + TRNN TT,%HIDON + JRST DSKEX ;NO COMPLETED TRANSFER + CONSZ DSK,%HIBSY + JRST 4,.-1 ;TRANSFER STILL IN PROGRESS?? + AOSN QHUNGF + JRST QHE ;XFER HUNG, RECALIBRATE AND RETRY + MOVSI A,%HRSTS(Q) ;SOMETIMES %HSERR SETS AND %HIERR DOESN'T! + PUSHJ P,RHGET + TRNE A,%HSERR + JRST QINTE + JRST QINTA1 ;XFER COMPLETE... + +QINTAT: MOVNI Q,-35.(B) ;LOW BIT IS DRIVE 0 + HRRZS Q + MOVEI A,1 ;TURN OFF ATTENTION (DRIVE MAY BE LOSING + LSH A,(Q) ;IN SUCH A WAY THAT READING %HRSTS DOESN'T CLEAR ATTN) + HRLI A,%HRATN + PUSHJ P,RHSET + CAMN Q,QSDU + JRST [ AOS NQSATN(Q) ;IGNORE ATTN IN MID-TRANSFER + JRST QINTA2 ] + MOVSI A,%HRSTS(Q) ;GET STATUS OF DRIVE WITH ATTENTION + PUSHJ P,RHGET ;THIS ALSO CLEARS THE ATTENTION BIT + SKIPE QACT(Q) + JRST QINTA2 ;IGNORE THIS DRIVE + TRNE A,%HSERR+%HSPIP + JRST [ MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;DRIVE REPORTING ERROR NOT DURING TRANSFER + PUSHJ P,RHSET ;SO CLEAR THE DRIVE + AOS NQEATN(Q) + JRST .+1 ] ;THEN CLEAR SEEK AND RECALIBRATE FLAGS + SETZM QSEEK(Q) ;POSITIONING COMPLETION + MOVSI A,%HRCCY(Q) + PUSHJ P,RHGET + MOVEM A,QPOS(Q) ;UPDATE CURRENT CYLINDER + CAME A,QPOSGL(Q) + SETOM QSKT1(Q) ;SEEK TO WRONG PLACE + SETZM QRCAL(Q) ;NO LONGER RECALIBRATING + JRST QINT0 ;IF NO XFER ACTIVE, MAYBE CAN START ONE ON THIS UNIT NOW + +QINTA2: SETOM QSKT1(Q) ;DON'T TRUST POS + JRST DSKEX + +;INPUT FROM MASSBUS - ADDRESS IN LH(A), RETURNS DATA IN A + +RHGET: TLZA A,%HRLOD + +;OUTPUT TO MASSBUS - ADDRESS IN LH(A), DATA IN RH(A) + +RHSET: TLO A,%HRLOD + DATAO DSK,A + MOVEM A,RHDATO ;SAVE FOR REBUGGING + MOVEI A,5 ;WAIT 3 USEC FOR BUS CYCLE + SOJG A,. + DATAI DSK,A + TLNE A,%HDERR + BUG HALT,[DSK: MASSBUS ERROR, DATAO=],OCT,RHDATO,[DATAI=],OCT,A + ANDI A,177777 ;RETURN 16-BIT REGISTER CONTENTS + POPJ P, + +QINTE: CONI DSK,TT + DATAI DSK,R + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN ;RESET CONTROLLER SO DRIVE STATUS MAY BE READ + CONSZ DSK,%HIBSY + JRST .-1 ;SOMETIMES CONTROLLER IS BUSY?? + MOVEM TT,QERST + MOVEM R,QERST+1 + SKIPGE Q ;TRY HARD TO GUESS THE RIGHT DRIVE! + LDB Q,[$HCDRV R] ;CURRENTLY SELECTED DRIVE + IRPS X,,[%HRSTS %HRER1 %HRER2 %HRER3 %HRDCL %HRPOS %HRPAT] + MOVSI A,X(Q) ;GET STATUS OF DRIVE + PUSHJ P,RHGET + MOVEM A,QERST+.IRPCNT+2 + TERMIN + SKIPN QERER2 ;FILE UNSAFE + SKIPE QERER3 + JRST UNSAFE + TRZE TT,%HIDRE + AOS NQDRE(Q) ;THIS BIT SUSPECTED OF BEING SET RANDOMLY. + ;;CHECK FOR IRRECOV (?) HARDWARE LOSSAGE. EVEN MORE SO THAN 'UNSAFE' + TDNE TT,[%HIILF+%HISDE+%HINXM+%HIDRE+%HIILC+%HIPWR] + BUG HALT,[DSK: UNIT ],DEC,Q,[ LOSING. RH10 CONI= ],OCT,QERST +IFN KS10P, .ERR So whats this all about? +IFN KL10P,[ + TLNN TT,(%HIDPE+%HICPE) ;IF CHANNEL DETECTS PARITY ERROR, CAUSE + JRST QINTE0 ;PROCESSOR PARITY SWEEP WHICH WILL PROBABLY + MOVSI A,SCLPAR ;CRASH THE SYSTEM ANYWAY. BEATS LOOPING! + TDNN A,SUPCOR ;BUT DON'T CAUSE CLKB1E+7 HALT + CONO 10407 + BUG CHECK,[DSK: MEM PAR ERR, QICWA/],OCT,QICWA,OCT,QICWA+1,[QIOWD/],OCT,QIOWD +QINTE0: +];KL10P + TDNE TT,[%HIOVR+%HICOV+%HIDPE+%HICPE+%HIBPE] + JRST QINTE1 ;OVERRUN OR PARITY ON CONTROL BUS OR CHANNEL BUS - RETRY + MOVE A,QERSTS ;DRIVE EXCEPTION, CHECK DRIVE STATUS + TRC A,%HSVV+%HSRDY+%HSDPR+%HSMOL ;THESE BITS BETTER ALL BE ON + TRCE A,%HSVV+%HSRDY+%HSDPR+%HSMOL + BUG ;DRIVE TURNED OFF? MAYBE 11 HACKING THIS DRIVE? + TRNN A,%HSERR + JRST [ AOS NQSE(Q) ;SPURIOUS? + JRST QINT0 ] + MOVE B,QERER1 ;CHECK THE MAIN ERROR REGISTER + TRNE B,#%H1SOF ;ANY HARD ERRORS? + JRST UNSAFE + CAIN B,%H1ECC ;IF JUST A CORRECTABLE ERROR, + JRST QECC ;GO CORRECT IT + PUSHJ P,QINTER ;OTHER SOFT ERROR, PRINT MESSAGE AND RESET DRIVE + TRNE B,010620 ;SEARCH ERROR, OR HEADER READ OR FORMAT ERROR OR DRIVE TIMING + JRST QHE ;REQUIRES RECALIBRATE + TRNE B,100110 ;BUS PARITY OR ECC "HARD" + JRST QDE ;REQUIRES RE-READ, GIVE UP AFTER N + JRST QOVR ;NO ERROR BITS, PRINT MESSAGE AND RETRY + +;CONTROLLER ERROR +QINTE1: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[CONI=],OCT,QERST,[DCL=],OCT,QERDCL + JRST QOVR + +;DRIVE ERROR +QINTER: BUG INFO,[DSK: ERR UNIT #],DEC,Q,[ER1=],OCT,QERER1,[ER2=],OCT,QERER2,[ER3=],OCT,QERER3,[STARTING DISK ADDR=],OCT,QCHPGA + MOVSI A,%HRDCL(Q) ;NOW RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + JRST RHSET + +;COME HERE FOR DRIVE UNSAFE AND SIMILAR BAD THINGS. MAY BE SET TO +;EITHER HALT OR ATTEMPT RETRY (VIA USFHLT VARIABLE). NOTE THAT WHEN +;WE GET HERE THE STATE OF THE DRIVE HAS NOT YET BEEN DISTURBED. +UNSAFE: SKIPE USFHLT + BUG PAUSE,[DSK: TOO MANY ERRORS] + MOVEI A,2 ;HALT IF ANOTHER ERROR WITHIN 1/2 - 1 SECOND + MOVEM A,USFHLT + PUSHJ P,QINTER ;GIVE ERROR MESSAGE AND RESET DRIVE + JRST QHE ;RECALIBRATE AND RETRY + +QECC: MOVSI A,%HRDCL(Q) ;RESET ERROR STATUS IN DRIVE + HRRI A,%HMCLR + PUSHJ P,RHSET + CAME Q,QSDU ;CORRECT AN ECC ERROR + BUG ;BARF ... NO TRANSFER IN PROGRESS + MOVE A,QCHPRG + TRNN A,10 + BUG ;BARF ... SHOULDN'T HAPPEN DURING WRITE + SKIPN A,QICWA+1 ;GET ADDRESS OF LAST WORD READ + JRST 4,.-1 ;CHANNEL OUGHT TO HAVE STORED CONTROL WORD BY NOW + SOS J,A + TDZ J,[177+.BM $DFCWA] ;J := ADDRESS OF FIRST WORD IN LOSING SECTOR + LDB A,[$DFCAD QIOWD] + SUBM J,A + SOS H,A ;# WORDS SUCCESSFULLY XFERED. + CAIL H,0 ;CHECK IF CHANNEL STORED BAD ADDRESS + CAILE H,2000-200 + JRST QDE ;THIS SHOULD NEVER HAPPEN, BUT IT DOES, FREQUENTLY + MOVE A,QECPOS ;GET ERROR POSITION + SOJL A,QDE ;HARDWARE POS IS OFF BY 1; IF 0 NOT CORRECTABLE + IDIVI A,36. ;CONVERT TO WORD NO AND BIT NO + CAIL A,177 + JRST [ ADDI B,36. ;LAST WORD IN SECTOR - HACK IT TO AVOID NXM + SOJA A,.+1] + ADD J,A ;J := ADDRESS OF LOSING WORD-PAIR + LDB A,[121400,,J] + ANDI J,1777 ;GET ADDR OF PAR ERR PAG + ADDI J,400000+2000*PAREP ;IN EXEC ADDRESS SPACE + IORI A,600000 ;MAKE THAT PAGE POINT TO THE DISK BUFFER + DPB A,[.PAREP+EXEUMP] + SPM ECCPAG ;GET IT INTO OUR MAP. + LPMR ECCPAG + MOVE U,B ;SAVE BIT NUMBER + MOVS B,(J) ;GET FIRST LOSING WORD + MOVS C,1(J) ;GET SECOND LOSING WORD + MOVE D,QECPAT ;GET ERROR PATTERN + SETZ E, ;MAKE INTO DOUBLE-WORD + ROTC D,(U) ;ALIGN IT + XOR B,D ;FIX THE BAD BITS + XOR C,E + MOVSM B,(J) ;PUT CORRECTED DATA BACK + MOVSM C,1(J) + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] ;FLUSH THE DISK BUFF FROM MAP + LPMR ECCPAG + + AOS QECCS(Q) ;LOG THE LOSS + MOVE A,QCHPGA + MOVEI E,200(H) + LSH E,-7 ;NUMBER OF SECTORS TRANSFERRED (INCLUDING ECC SECTOR) + LDB B,[$HASEC A] ;GET DISK ADDR OF FAILING SECTOR + ADDI B,-1(E) + IDIVI B,NSECS + DPB C,[$HASEC A] + LDB D,[$HATRK A] + ADD B,D + DPB B,[$HATRK A] ;NO NEED TO DIVIDE BY NHEDS SINCE NEVER CROSS CYLINDERS + MOVEM A,QECCAD(Q) + HLRZ A,A + MOVE D,QSDCH + BUG INFO,[DSK: ECC CORRECTED ERROR, UNIT ],DEC,Q,[CYL ],DEC,A,[HEAD ],DEC,B,[SEC ],DEC,C,[QSRAC],OCT,QSRAC(D) + LDB B,[$HASEC QCHPGA] ;NOW DETERMINE WHERE TO RESUME TRANSFER + ADD B,E + IDIVI B,NSECS + DPB C,[$HASEC QCHPGA] + LDB C,[$HATRK QCHPGA] + ADD C,B + DPB C,[$HATRK QCHPGA] ;NO NEED TO IDIVI A,NHEDS SINCE NEVER CROSS CYLINDERS + HRRZ C,QSDCH ;FOR QECCX + LDB A,[$DFCWA QICWA+1] ;LAST CONTROL WORD PROCESSED + SUBI A,1 ;CRETINOUS DF10 + CAIE A,QIOWD + BUG ;CHANNEL STORED BAD ADDRESS? + HRRZM A,QICWA + MOVEI A,200(H) ;# WORDS ALREADY DONE. + DPB A,[$DFWC A] ;PUT IT IN BOTH FIELDS. + ADDB A,@QICWA ;ADVANCE C.W. TO REMAINING STUFF + TLNE A,(.BM $DFWC) + JRST QECCX ;MORE TO DO, CONTINUE XFER + AOS QICWA ;ELSE ADVANCE TO NEXT C.W. + SKIPE @QICWA + JRST QECCX ;MORE TO DO, CONTINUE XFER + JRST QINTA1 ;XFER COMPLETE +] + +IFN T300P,[ +T3INT: SETZM DSCDON ;CLEAR DONE FLAG THAT GOT US HERE + SKIPGE QSDU1 ;OPERATION COMPLETE? + JRST QINT1 ;NO, GO FIND SOMETHING TO DO + HRRZ Q,DSCDRV ;YES, GET DRIVE OPERATION WAS ON + ADDI Q,T300P + CAIGE Q,NQS + CAME Q,QSDU1 ;TERMINATION ON DRIVE WE EXPECTED? + BUG ;DRIVE NUMBER CLOBBERED? + SETZM QRCAL(Q) ;PRESUMABLY NOT RECALIBRATING ANY MORE. + MOVE A,DSCCMD ;COMMAND THAT JUST COMPLETED + CAIN A,%DMREC ;WAS IT A RECALIBRATE? + JRST QINT1E ;IF SO, CONTROLLER IS IDLE NOW + MOVE C,QSDCH1 ;CHANNEL + HRLZ E,DSCFLT ;CHECK FOR ERRORS + HRR E,DSCSTS + JUMPE E,QINTI ;OPERATION COMPLETED UNEVENTFULLY + MOVE D,DSCHED ;GET DISK ADDRESS AS CYL,,HEAD_9+SECTOR + LSH D,9 + IOR D,DSCSEC + HRL D,DSCCYL + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: T-300 ERR UNIT ],DEC,Q,[FAULT=],OCT,DSCFLT,[STATUS=],OCT,DSCSTS,[CMD=],OCT,DSCCMD,[CYL-SURF-SEC=],OCT,D + TRZE E,%DSRTR+%DSECC ;THESE ARE NOT ERRORS + AOS QECCS(Q) + JUMPE E,QINTI ;OPERATION COMPLETED SUCCESSFULLY (WITH INTERVENTION OF 2561) + MOVE T,E + TRZ T,%DSECH+%DSIDE+%DSHCE + JUMPN T,T3INT2 ;CONSIDER USING ERROR RECOVERY FEATURES + TRNE A,%DMRED ;IF COMMAND IS A READ + TRNE A,10 ;AND WE HAVEN'T TRIED THEM ALL + JRST T3INT2 + AOS NQSE(Q) ;COUNT "SOFT ERRORS" (NOT "SPURIOUS" IN T-300 CASE) + AOJA A,T3IO1 ;GO RETRY OPERATION USING NEXT FEATURE + +T3INT2: TLNN E,-1 ;ANY FAULT? PROBABLY UNRECOVERABLE BUT TRY RECALIBRATE + TRNE E,%DSIDE+%DSHCE+%DSSKE+%DSOFL+%DSFLT ;DISK CONDITION THAT CALLS FOR RECAL + JRST T3HE + JRST T3DE ;TRY OPERATION AGAIN. PROBABLY WILL LOSE BUT TRY. +];T300P + +OVHMTR QSC ;DISK SCHEDULER (AND HIGHER-LEVEL INTERRUPT STUFF) + +QINTA1: SKIPL C,QSDCH ;XFER COMPLETE +QINTI: SKIPGE A,QSCABN(C) ;CHANNEL IN C + BUG ;MEMBLT INDEX IN A + MOVE R,A ;BUFFER ADDRESS IN R +IFN KL10P,[ ;QSRAC IN D, QSK# IN Q + SKIPL QSCRW(C) ;IF READ, FLUSH CACHE AGAIN + JRST [ PUSHJ P,CSHSWP ;SINCE USER MIGHT HAVE TOUCHED ABS PAGE + CAIA + MOVE A,R ;A WAS CLOBBERED + JRST .+1 ] +] +IFN KS10P,[ + SKIPL QSCRW(C) ;ON KS, CAN ONLY CLEAR THE WHOLE CACHE + CLRCSH +] + LSH R,10. + MOVE D,QSRAC(C) +IFN RP10P,[ + HRRZ TT,QICWA+1 + CAIE TT,1777(R) + TLNE D,%QAPAR ;IGNORE IF LOSING ANYWAY (E.G. SEARCH ERR) + CAIA + JRST QDFLOS +];RP10P +IFN QRDCMP,[ + SKIPE TT,RDCPHS ;NEED TO READ-COMPARE? + JRST QRC1 ;READ-COMPARE STARTING OR FINISHED +QRC0: +];QRDCMP + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE COMPLETION HANDLER + OFFSET -. +%QMIDL::JRST 4,QINT1 ;IDLE - SHOULDN'T BE ACTIVE +%QMRD:: JRST QRDFIN ;READ +%QMWRT::JRST QWRFIN ;WRITE +%QMWOV::JRST QWOVFN ;WRITE-OVER MODE +%QMRD1::JRST QRD1FN ;READ BLOCK AT A TIME MODE + JRST 4,QINT1 ;ILL CODE +%QMUDR::JRST QUDRIN ;USER DIR IN +%QMMDR::JRST QMDRIN ;MASTER DIR IN +%QMTTR::JRST QTUTIN ;TUT IN +%QMUDW::JRST QUFDWF ;USER DIR WRITE +%QMMDW::JRST QMFDWF ;MASTER DIR WRITE +%QMTTW::JRST QTUTWF ;TUT WRITE +%QMSWP::JRST QSWPFN ;SWAP FINISHED + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE + JRST 4,QINT1 ;ILL CODE +%QMMAX::OFFSET 0 +IFN %QMMAX-20, .ERR %QMMAX MUST BE A POWER OF 2 + +IFN RP10P,[ +;CHANNEL DIDN'T TRANSFER EXACTLY 2000 WORDS +QDFLOS: MOVEI D,1777(R) ;EXPECTED TERMINATION ADDRESS + HRRZ B,QICWA+1 ;ACTUAL TERMINATION ADDRESS + CAIL B,(D) + SKIPL QSCRW(C) + JRST QDFLZ1 + BUG HALT,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D,[DISK IS CLOBBERED NOW.] + +QDFLZ1: BUG PAUSE,[DSK: CHANNEL TRANSFERRED UP TO ],OCT,B,[RATHER THAN],OCT,D + JRST QOVR +];RP10P + +;;; SOFTWARE READ-COMPARE ROUTINES + +IFN QRDCMP,[ +IFE RP10P+RH10P, .ERR READ-COMPARE ONLY CODED FOR RP-10 AND RH10 +;IFE KA10P, .ERR READ-COMPARE ONLY CODED FOR KA-10 + +;;; REGULAR OPERATION COMPLETE, DO A READ-COMPARE TO BE SURE +QRC1: +IFN T300P, CAIGE Q,T300P ;NO READ/COMPARE IF THIS IS T-300 CONTROLLER + TLNE D,%QAPAR ;GIVING UP WITH FATAL ERR? + JRST QRC0 ;NO READ-COMPARE THEN + JUMPG TT,QRC2 ;JUMP IF READ-COMPARE COMPLETED + MOVE E,QSGL(C) ;DISK BLOCK + PUSHJ P,QPOSR ;E GETS DATAO WORD +IFN RP10P,[ + IOR E,[DREADC+7000+RCICWA] ;MAKE READ COMMAND + CONO DPC,175700+DSKCHN + MOVE T,[-2000,,QRCBUF-1] ;STORE CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + DATAO DPC,E ;START DISK +];RP10P +IFN RH10P,[ + MOVE T,[-2000_4,,QRCBUF-1] ;DF10-C CHANNEL PROGRAM + MOVEM T,RCIOWD + SETZM RCIOWD+1 + MOVEI T,RCIOWD + MOVEM T,RCICWA + SETZM RCICWA+1 + SWPUA ;DUMP CACHE + CONSZ 200000 ;IT'S INEFFICIENT, BUT WHAT THE HELL + JRST .-1 + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + MOVSI A,%HRADR(Q) + HRR A,E ;HEAD AND SECTOR (CYL DOESN'T CHANGE) + PUSHJ P,RHSET + MOVEI A,%HMRED+ + TLO A,%HRCTL(Q) + PUSHJ P,RHSET ;START DISK +];RH10P + MOVEM T,RDCPHS ;RDCPHS POSITIVE MEANS DOING RD/CMP NOW + JRST DSKEX ;AWAIT COMPLETION + +;;; READ-COMPARE COMPLETED. CHECK IT. +QRC2: SPM PARPG ;SET UP MAP TO PAGE BEING READ/WRITTEN + MOVEI T,600000+PMCSHM(A) + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + MOVEI H,0 ;H DIFFERENCE COUNT +IFN KA10P,[ + PUSH P,A ;WILL DO COMPARE LOOP IN ACS + PUSH P,C + PUSH P,D + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVSI D,[ MOVE T,400000+PAREP*2000(E) ;A + CAMN T,QRCBUF(E) ;B + AOBJN E,A ;C + JRST QRC3 ] ;D + HRRI D,A + BLT D,D + JRST A +];KA10P +.ELSE [ + MOVSI E,-2000 ;E ADDRESS WITHIN PAGE + MOVE T,400000+PAREP*2000(E) + CAMN T,QRCBUF(E) +QRC2A: AOBJN E,.-2 +];NOT KA10P +QRC3: JUMPGE E,QRC5 ;JUMP IF DONE + JUMPG H,QRC4 ;COMPARE ERROR, REPORT IT + AOS NQCMPE(Q) +IFN KA10P,[ + MOVE T,-1(P) ;SAVED C + BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(T) +];KA10P +.ELSE BUG INFO,[DSK: READ-COMPARE ERROR #],DEC,NQCMPE(Q),[UNIT=],DEC,Q,[BLK=],OCT,QSGL(C) +QRC4: ADDI H,1 + HRRZ T,E + CAIG H,4 ;ONLY REPORT FIRST 4 BAD WORDS + BUG INFO,[DSK: READ-COMPARE DIFFERENCE ],OCT,T,OCT,400000+PAREP*2000(E),OCT,QRCBUF(E) +IFN KA10P,JRST C +.ELSE JRST QRC2A + +QRC5: +IFN KA10P,[ + POP P,D + POP P,C + POP P,A +];KA10P + MOVEI T,0 ;CLEAR MAP + DPB T,[.PAREP+EXEUMP] + LPMR PARPG + JUMPE H,QRC0 ;NO DIFFERENCE, I/O OPERATION IS DONE + CAILE H,4 ;FAILED, DO IT ALL OVER AGAIN + BUG INFO,[DSK: READ-COMPARE DIFFERENCES TOTAL],DEC,H + JRST QOVR +];QRDCMP + +QUFDWF: MOVE TT,QDWIP + CAMN Q,MDSK ;WRITTEN TO MASTER DISK? + SKIPN E,QSFBT(TT) ;AND HAVE SOME BLOCKS TO FREE? + JRST QUDWF1 + SETZM QSFBT(TT) ;YES, TRANSFER THEM TO QFBTS LIST + MOVE T,E ;E FINDS LAST OF LIST, T RPLACD'D IN THERE + EXCH T,QFBTS ;NCONC QSFBT ONTO FRONT OF QFBTS + SKIPE 1(E) + JRST [ MOVE E,1(E) + JRST .-1 ] + MOVEM T,1(E) + SKIPN T + AOS NCORRQ ;WAKE UP CORE JOB IF QFBTS HAD BEEN EMPTY +QUDWF1: JSP D,QDWF + QSNLCN(TT) + +QMFDWF: JSP D,QDWF + QMDRO + +QTUTWF: AOS T,QSGL(C) ;NEXT BLOCK TO GO OUT + AOS QSCABN(C) ;FROM NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;WRITE MORE + JSP D,QDWF + QTUTO(TT) + +QDWF: MOVSI E,(SETZ) ;UNLOCK DIR THAT WAS WRITTEN + IOR E,DCHBT(Q) ;COPY ON THIS DISK IS NOW UP TO DATE + MOVE TT,QDWIP + ANDCAM E,@(D) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + SETOM DWUSR + JRST QINT1A ;DON'T COUNT THIS AS DISK ACTIVITY + +QUDRIN: MOVE TT,QUDPR(C) ;USER DIR IN OK + MOVE D,UDNAME(R) + CAME D,QSNUD(TT) ;COMPARE UNAME IN DIR WITH RQ'ED + JRST QUDER1 + TLO R,40000 ;NOT PAWED OVER + MOVEM R,QSNLCN(TT) + MOVE R,QSLGL(C) + MOVEM R,QSNMI(TT) + MOVEI R,MU23UD ;USER DIRECTORY + PUSH P,A + PUSH P,C + MOVE C,TT + PUSHJ P,QDIRCK ;VERIFY NOT TOTALLY BASHED TO BEGIN WITH + POP P,C ;CLOBBERS A,B,I + POP P,A +QINTU4: DPB R,[MUR,,MEMBLT(A)] + DPB TT,[MNUMB,,MEMBLT(A)] +QTUTI1: SETOM QUSR(C) ;FREE THE DISK CHANNEL + AOS QFCHN + JRST QINT1A + +QMDRIN: TLO R,2 ;NOT RECONCILED + MOVEM R,QMDRO ;MASTER DIRECTORY IN + MOVE TT,MDCHK(R) + CAME TT,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + MOVE TT,MDNUDS(R) + CAIE TT,NUDSL + BUG HALT,[MFD HAS WRONG NUMBER OF DIRECTORIES] + MOVE TT,(R) ;ASCENDING DIR # + SKIPGE QAMDNO + MOVEM TT,QAMDNO ;FIRST DISK IN STORE ASCENDING # + MOVEI R,MU23MD ;MASTER DIRECTORY + MOVE TT,Q ;DISK NO + JRST QINTU4 + +QTUTIN: AOS T,QSGL(C) ;NEXT BLOCK TO COME IN + AOS QSCABN(C) ;INTO NEXT CORE PAGE + CAIGE T,MFDBLK ;SKIP IF DONE + JRST QINT1E ;READ MORE + HRRZS QTUTO(Q) ;UNLOCK TUT, BUT QDPWF IS STILL SET + JRST QTUTI1 + +QSWPFN: MOVE Q,QDSKN(C) + TLNE D,%QAPAR + JRST QSWPF2 ;SWAP READ ERROR (I HOPE) + MOVSI E,MMPTMP ;PAGE NO LONGER IN TRANSIT + TDNN E,@QSMMP(Q) + BUG ;ALREADY WASN'T? + ANDCAM E,@QSMMP(Q) + SKIPL QSCRW(C) + JRST QSWPIF + PUSHJ P,IMEMR ;SWAP-OUT COMPLETE, RETURN MEMORY + MOVSI E,MMPPGB + ANDCAM E,@QSMMP(Q) + MOVSI E,MMPWOD ;PAGE HAS BEEN WRITTEN ON DISK. AND NO LONGER + IORB E,@QSMMP(Q) ;BEING PAGED BEHIND. + TLNN E,MMPGON + JRST QSWPF2 + MOVE A,QSMMP(Q) ;WE'RE SUPPOSED TO RETURN THE MMP ENTRY + PUSHJ P,RETMMP +QSWPF2: SETOM SWUSR(Q) ;SWAPPING IDLE + JRST QINT1B + +QSWPIF: +;SOME ERROR CHECKING + MOVE E,QSMMP(Q) + HLLZ TT,1(E) + JUMPE TT,QSWPF3 ;ON INITIAL-SWAP-IN, ADDRESS IN MMP IS SUPPOSED TO BE ZERO + LDB TT,[$MMPUN,,(E)] + CAME TT,Q + BUG + HLRZ TT,1(E) + CAME TT,QSGL(C) + BUG +QSWPF3: LDB TT,[MMMPX,,MEMBLT(A)] + CAIE TT,-MMP(E) + BUG +;END ERROR CHECKING + MOVEI TT,MURUSR ;SWAP IN OF PAGE COMPLETED + DPB TT,[MUR,,MEMBLT(A)] + SETZM MMSWP(A) + MOVE D,(E) + SKIPL CIRPSW + JRST QSWPF2 ;CAN'T PUT IN MAPS IF CIRPSW NOT AVAILABLE. + MOVSI D,(TDNE T,) ;SET UP CHECK USED BY PRIVELEGED USER FEATURE + HRR D,QSMMP(Q) + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS + POP P,Q + POP P,C + JRST QSWPF2 + +QWOVFN: CLEARM QSCRW(C) ;WRITE OVER SWITCH TO READ MODE + HRRI D,%QMRD1 + TLZE D,%QAEFW + HRRI D,%QMIDL ;TRYING TO CLOSE, STOP CHANNEL + MOVEM D,QSRAC(C) + AOS QWBUFS ;COMPENSATE FOR EXTRA SOS BELOW + +QWRFIN: TLNN D,%QACTH ;WRITE COMPLETE, RETURN BUFFER + PUSHJ P,IMEMR + TLNE D,%QACTH + PUSHJ P,CIMEMR + SOS QSBFS(C) + SOS QWBUFS + MOVE TT,QSGL(C) + MOVEM TT,QSLBLK(C) + JRST QINT1B + +QRD1FN: HLLZS QSRAC(C) .SEE %QMIDL ;BLOCK-AT-A-TIME READ COMPLETE, IDLE THE CHANNEL + +QRDFIN: MOVEI B,.BM MLO ;NORMAL READ COMPLETED + ANDCAM B,MEMBLT(A) ;THREAD ONTO CHANNEL LIST + HLRZ B,QBFP(C) + SKIPE B + DPB A,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM A,QBFP(C) + HRLM A,QBFP(C) + SKIPL B,QPIBSZ(C) ;GET BYTE COUNT OF BLOCK + JRST QRDFN1 + HRRZ B,1777(R) ;FUNNY BLOCK, GET FROM LAST WORD + ; 8/20/90 No more funny blocks + HRRZ TT,QSBYTE(C) ;AND MAKE SURE IT'S NOT TOO BIG + IMULI TT,2000 + CAMLE B,TT + MOVE B,TT +QRDFN1: HRRZM B,MEMPNT(A) ;PASS TO MAIN PROGRAM + AOS QSBFS(C) +IFE DMDSK, LDB B,[XWBLK QXWDS] + .ALSO MOVEM B,QSLBLK(C) + +;XFER COMPLETE, DEACTIVATE CHANNEL + +QINT1B: SETOM QACTTM +QINT1A: SETOM QSGL(C) + SETOM QSCABN(C) +QINT1E: +IFE DC10P, SETOM QSKT1(Q) +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] ;DC10P +IFN T300P,[ + CAIL Q,T300P + SETOM QSDU1 + CAIGE Q,T300P + SETOM QSDU +];T300P +.ELSE SETOM QSDU +;DROPS THROUGH + ;DROPS IN + +;ACTIVATE CHANNELS, LOOK FOR SEEKS AND TRANSFERS TO BE DONE + +QINT1: SETZM QHUNGF + SETOM QTUNT ;NO UNIT SELECTED YET +IFN T300P, SETOM QTUNT1 + MOVE C,QTCHN ;START SCAN IN SUITABLE PLACE + MOVEM C,QLCHN + JRST QINT2D + +QINT2L: CAIGE C,NQCHN ;IF DIR-WRITE OR SWAP CHANNEL, DON'T CHECK QUSR + SKIPL QUSR(C) + SKIPGE D,QSRAC(C) .SEE %QALOK + JRST QINT2C ;CHANNEL LOCKED OR NOT OPEN, SKIP IT + MOVE Q,QDSKN(C) + SKIPL E,QSGL(C) + JRST QINT4 ;JUMP IF CHANNEL ACTIVE ALREADY + TLNE D,%QACTH+%QAOUT + JRST QINT2C ;CHANNEL BLOCKED BY CORE JOB, DON'T ACTIVATE + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE ACTIVATE HANDLER + OFFSET -. +%QMIDL::JRST QINT2C ;IDLE - DON'T ACTIVATE +%QMRD:: JRST QRDACT ;READ +%QMWRT::JRST QWRACT ;WRITE +%QMWOV::JRST QWRACT ;WRITE OVER +%QMRD1::JRST QRDACT ;READ 1 BLOCK + JRST 4,QINT2C ;ILL CODE +%QMUDR::JRST QDRACT ;UFD READ +%QMMDR::JRST QDRACT ;MFD READ +%QMTTR::JRST QDRACT ;TUT READ +%QMUDW::JRST 4,QINT2C ;UFD WRITE - SHOULDN'T LEAVE THIS MODE AROUND +%QMMDW::JRST 4,QINT2C ;MFD WRITE - .. +%QMTTW::JRST QINT5 ;TUT WRITE - MAY BE WRITING SECOND PAGE +%QMSWP::JRST SWPACT ;SWAP + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE + JRST 4,QINT2C ;ILL CODE +%QMMAX::OFFSET 0 + +; ACTIVATION ROUTINES + +SWPACT: SKIPL SWUSR(Q) + BUG ;SWAPPING ALREADY ACTIVE ON THIS DISK + MOVE A,MEMFR + SUB A,NCBCOM + MOVEI B,0 ;CHECK FIRST FOR SWAP IN OR OUT + CAIGE A,6 ;ACCORDING TO AVAIL MEM + MOVEI B,1 + SKIPN @SWAPL(B) ;IF NO TRAFFIC THAT DIRECTION, CHECK THE OTHER. + TRC B,1 + HRRZ E,@SWAPL(B) + JUMPE E,QINT2C ;NO SWAPPING TRAFFIC THIS DISK. + LDB A,[MLO,,MEMBLT(E)] ;TAKE BLOCK OFF LIST + SKIPN A + SETZM @SWAPL(B) ;LAST BLOCK, LIST IS NOW EMPTY + HRRM A,@SWAPL(B) ;SET NEW FIRST BLOCK + LDB D,[MMMPX,,MEMBLT(E)] + ADD D,MMPEAD ;GET MMP ADDRESS + LDB TT,[410200,,(D)] + TRNN TT,1 + BUG ;THIS PAGE SHOULD BE MARKED IN TRANSIT + HRRZM D,QSMMP(Q) + SOS SILNG(B) + CAIGE E,TSYSM + CAIGE E,SYSB + BUG + HRRZM E,QSCABN+NQCHN+1(Q) + CLEARM SWUSR(Q) ;CHNL ACTIVE + HLRZ E,MEMPNT(E) + MOVEM E,QSGL+NQCHN+1(Q) ;DISK BLOCK + HRRZS QSRAC+NQCHN+1(Q) .SEE %QMSWP + MOVNM B,QSCRW+NQCHN+1(Q) ;DIRECTION + CLEARM QERRS+NQCHN+1(Q) ;NO ERRORS (YET) + JRST QINT4 ;CHANNEL SUCCESSFULLY ACTIVATED + + +; MORE ACTIVATION ROUTINES + +QRDACT: TLNE D,%QAACC ;ACTIVATE READ CHANNEL + JRST QINT2C ;NOT IF USER HACKING RANDOM ACCESS NOW + SETZM QERRS(C) + MOVE J,QUDPR(C) + SKIPGE QSNLCN(J) + JRST QINT2C ;USER DIRECTORY OUT OR LOCKED + MOVE A,QSBFS(C) + SKIPL QSMDN(C) + AOS A ;A := TOTAL NUMBER OF BUFFERS + CAMLE A,QRDAHD ;HOW MUCH SHOULD BE READ AHEAD + JRST QINT2C ;BLOATED, DON'T ACTIVATE + SKIPE QSBI(C) + JRST QINT4A ;BLOCKS LEFT FROM LAST TIME +QINT4B: PUSHJ P,QIDRCH ;GET NEXT DESC BYTE IN A, ALSO RET BYTE PNTR IN TT + CAIN A,UDWPH + JRST QINT4B + JUMPE A,QEOF ;REACHED READ EOF + TRZE A,40 + JRST QINT4C + CAILE A,UDTKMX + JRST QINT4D ;SKIP AND TAKE + MOVEM A,QSBI(C) ;TAKE NEXT N +QINT4A: SOS QSBI(C) + AOS E,QSLGL(C) +QINT4G: MOVEM E,QSGL(C) + MOVSI B,%QALBK + ANDCAM B,QSRAC(C) ;CLEAR PROCESSING LAST BLOCK IN FILE BIT + HRRZ A,QSBYTE(C) + IMULI A,2000 ;NUMBER OF BYTES IN A FULL BLOCK +IFN DMDSK,[ + MOVSI D,%QAFNY ;FUNNY FILE + TDNE D,QSRAC(C) + SETO A, +] + MOVEM A,QPIBSZ(C) ;SET FUNNY BIT + SKIPE QSBI(C) + JRST QINT4 ;IF MORE BLOCKS FOLLOW DON'T CHECK EOF + PUSHJ P,QIDRCH ;GET NEXT DESCR BYTE + SOS QDIRP(C) ;CORRECT PNTR + JUMPN A,QINT4 + MOVE A,QUDFPR(C) ;THIS IS LAST BLOCK + ADD A,QSNLCN(J) + LDB D,[UNBYTE+UNREF(A)] + PUSHJ P,QBDCD + IMUL D,E ;NUMBER OF UNUSED BITS IN LAST WORD + LDB E,[QSBSIZ(C)] ;(DEPEND ON DIVIDE ROUNDING DOWN) + IDIV D,E ;NUMBER OF UNUSED BYTES (IN SIZE OPEN) + LDB E,[UNWRDC+UNRNDM(A)];NUMBER OF USED WORDS IN LAST BLOCK + SKIPN E + MOVEI E,2000 + IMULI E,@QSBYTE(C) ;CONVERT TO NUMBER OF BYTES + SUB E,D ;NUMBER OF VALID BYTES IN BLOCK + HRRM E,QPIBSZ(C) ;STORE BYTE COUNT OF LAST BLOCK + IORM B,QSRAC(C) .SEE %QALBK + MOVE E,QSGL(C) + JRST QINT4 + +QINT4D: MOVEI E,1-UDTKMX(A) ;SKIP N AND TAKE 1 + ADDB E,QSLGL(C) + JRST QINT4G + +QWRACT: SKIPN I,QBFP(C) ;ACTIVATE WRITE CHANNEL + JRST QINT2C ;END OF WRITE LIST FOR NOW + HRRZM I,QSCABN(C) + LDB H,[MLO,,MEMBLT(I)] + HRRM H,QBFP(C) + SKIPN H + SETZM QBFP(C) ;LAST BLOCK, LIST NOW EMPTY + HLRZ E,MEMPNT(I) + MOVEM E,QSGL(C) + JRST QINT4 + +QDRACT: MOVE E,QSLGL(C) ;ACTIVATE DIRECTORY-READ CHANNEL + MOVEM E,QSGL(C) +; JRST QINT4 ;DROPS THROUGH + ;DROPS IN +QINT4: SKIPL QSCABN(C) ;SKIP IF NEED MEMORY + JRST QINT5 + PUSHJ P,IOMQ ;GET MEMORY FOR READ BUFFER + JRST QINT2C ;CAN'T +QINT5A: MOVEM A,QSCABN(C) + MOVEI D,MU23B + DPB D,[MUR,,MEMBLT(A)] + DPB C,[MNUMB,,MEMBLT(A)] + +QINT5: +IFN DC10P, MOVE TT,QTRAN(Q) +.ELSE MOVE TT,Q + SKIPN QSEEK(TT) ;IGNORE SEEKING DRIVE + SKIPGE QRCAL(TT) ;IGNORE RECALIBRATING DRIVE + JRST QINT2C +IFN T300P,[ ;IGNORE IF FOR CONTROLLER THAT IS NOT READY + CAIL TT,T300P + JRST [ SKIPGE QSDU1 + SKIPL QTUNT1 ;NOTE CODE HERE IS SIMILAR TO THAT AT QINT2F + JRST QINT2C ;T-300 CONTROLLER BUSY OR ALREADY COMMITTED + HRRZM Q,QTUNT1 ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN1 ;FOR THIS CHANNEL + JRST QINT2C ] ;T-300 CODE IS SIMPLIFIED SINCE NO SEEK OVERLAPS + SKIPL QSDU + JRST QINT2C +];T300P + HRRZ B,QSKT1(TT) + CAIN B,(C) + JRST QINT2F ;ALREADY SET FOR ME + SKIPL QSKT1(TT) + JRST QINT2C ;SET FOR SOME OTHER CHNL + HRRZM C,QSKT1(TT) ;AVAILABLE, SET IT FOR ME + PUSHJ P,QPOSR ;CONVERT DISK ADDRESS TO PHYSICAL +IFN DC10P,[ ;AND INITIATE SEEK + ADD E,[DSEEK] + CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,E + LDB B,[DCYL E] + MOVE TT,QTRAN(Q) ;PRETEND SEEK ALREADY COMPLETE + MOVEM B,QPOSGL(TT) + MOVEM B,QPOS(TT) + JRST QINT2F ;DON'T WAIT FOR SEEK, START TRANSFER RIGHT AWAY +] ;DC10P +IFN RP10P,[ + TLO E,(DSEEKC) ;DSK SEEK + CONSZ DPC,20 + JRST 4,.-1 + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAMN TT,QPOS(Q) + JRST QINT2F ;IF WE'RE THERE, DON'T SEEK + MOVEM TT,QPOSGL(Q) + DATAO DPC,E + MOVEM E,QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, GO GET ANOTHER +] ;RP10P +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + HRRZ A,E + IOWRQ A,%HRADR ; Set track and sector + HLRZ A,E + IOWRQ A,%HRCYL ; Set cylinder + CAMN A,QPOS(Q) + JRST QINT2F ; On cylinder, don't seek + MOVEM A,QPOSGL(Q) + MOVEI A,%HMSEK + PUSHJ P,RHCMD ; Start seeking + SETOM QSEEK(Q) + JRST QINT2C ; Start other drives now? +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,E + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,E + PUSHJ P,RHSET + HLRZ TT,E ;GET CYLINDER PART OF ADDRESS + CAMN TT,QPOS(Q) + JRST QINT2F ;ON CYLINDER, DON'T SEEK + MOVEM TT,QPOSGL(Q) + MOVSI A,%HRDCL(Q) ;START SEEK + HRRI A,%HMSEK + PUSHJ P,RHSET + SETOM QSEEK(Q) + JRST QINT2C ;THIS ONE SEEKING, START OTHER DRIVES +] ;RH10P + +IFN KL10P,[ +;CALL HERE TO SWEEP THE CACHE. CORE PAGE # IN R. +;INSTRUCTION AT CALL+1 SHOULD SKIP IF READING INTO CORE. +;CLOBBERS A,B,D,E,TT. + +CSHSWP: SETZB A,B ;A COUNTS WAIT TIME, B IS SWEEP INSTRUCTION + XCT @(P) + TLOA B,(SWPUO (R)) ;WRITE - UNLOAD PAGE FROM CACHE + MOVSI B,(SWPIO (R)) ;READ - CLEAR PAGE FROM CACHE + LSH R,1 ;HARDWARE PAGES ARE 1/2 K + XCT B ;SWEEP FIRST HALF-PAGE + MOVE D,[CONSZ 200000] + MOVE E,[AOJA A,D] + MOVSI TT,(POPJ P,) + PUSHJ P,D ;WAIT IN ACS TO MINIMIZE MBOX INTERFERENCE + AOS R ;SWEEP SECOND HALF-PAGE + XCT B + PUSHJ P,D + XCT @(P) + AOSA NCSHU ;COUNT NUMBER OF TIMES THIS DONE + AOSA NCSHI + JRST [ ADDM A,NCSHUL ? JRST .+2 ] + ADDM A,NCSHIL ;AND COUNT NUMBER OF LOOPS IN ACS + LSH R,-1 + JRST POPJ1 +] + +;VARIOUS EXITS FROM CHANNEL-CHECKING ROUTINES + +QINT2F: SKIPL QTUNT ;THIS CHANNEL IS READY TO TRANSFER + JRST QINT2C ;ALREADY FOUND A TRANSFER + HRRZM Q,QTUNT ;WILL TRANSFER ON THIS UNIT + HRRZM C,QTCHN ;FOR THIS CHANNEL +QINT2C: CAMN C,QLCHN ;CONTINUE CHANNEL SCAN + JRST QINT2E ;UNLESS CHECKED ALL CHANNELS +QINT2D: CAIL C,NQCHN+1+NQS-1 ;SKIP IF NOT TIME TO WRAP AROUND + SETO C, + AOJA C,QINT2L ;CHECK ANOTHER + +QINT2E: +IFN T300P,[ + MOVE C,QTCHN1 + SKIPL Q,QTUNT1 ;FOUND XFER FOR T-300? + JRST QDE1 ;YES +];T300P + SKIPGE Q,QTUNT ;FOUND XFER? + JRST QINT3 ;IDLE + MOVE C,QTCHN +;Q DISK TO TRANSFER ON, C CHANNEL. START (OR RESTART) TRANSFER ON THEM. +QDE1: MOVE R,QSCABN(C) +IFN KL10P,[ + PUSHJ P,CSHSWP + SKIPGE QSCRW(C) +];KL10P +IFN KS10P,[ + SKIPL QSCRW(C) + CLRCSH +];KS10P +IFE T300P, MOVEM C,QSDCH +IFN T300P,[ + CAIL Q,T300P + JRST T3IO + CAIGE Q,T300P + MOVEM C,QSDCH +];T300P + SKIPGE B,QSCRW(C) ;LOAD R/W STATUS IN B + JRST QINT6W + ;READ - DROPS IN +IFN RP10P,[ + MOVSI T,(DREADC) +QINT6A: IORI T,7000+QICWA ;DON'T STOP FOR PARITY ERRORS (PLUS INITIAL CHNL ADR) + MOVEM T,QCHPRG + DPB Q,[DUNFLD+QCHPRG] + HLLZS QIOWD + DPB R,[121000,,QIOWD] + LDB E,[100300,,R] ;MA15-17 + TRC E,7 + DPB E,[410300,,QIOWD] ;SET UP HIGH ADDR BITS. + MOVE TT,QIOWD + SOS TT + HRRM TT,QIOWD + SETZM QIOWD+1 + MOVEM Q,QSDU + MOVE E,QSGL(C) + PUSHJ P,QPOSR + IORM E,QCHPRG +QOVR: CONSZ DPC,20 + JRST QOVR + SKIPGE Q,QSDU + BUG + CONO DPC,175700+DSKCHN +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVEI TT,QIOWD + HRRZM TT,QICWA + MOVE E,QCHPRG + LDB TT,[DCYL E] + TRNE E,.BM DCYLXB + ADDI TT,400 + CAME TT,QPOS(Q) + BUG ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + SETZM QICWA+1 + DATAO DPC,QCHPRG ;ENTRY ON OVERRUN + MOVE A,TIME + MOVEM A,LQTM + MOVEM Q,QSDU + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DPC,DCLEAR+20+DSKCHN ;DISK NOTICED TO BE HUNG, RESET IT + SETOM QHUNGF ;TELL P.I. LEVEL TO RETRY OPERATION + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + ;READ - DROPS IN + +IFN RH11P,[ + MOVEI T,%HMRED +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,1 ; Set up Unibus map for RH11 to point at + TRO R,%UQVAL+%UQFST ; the block in question. + IOWRQ R,UBAPAG+QUBPG_1 + ADDI R,1 + IOWRQ R,UBAPAG+QUBPG_1+1 + MOVE E,[-4000,,QUBPG_14] + MOVEM E,QIOWD + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: IORDQ TT,%HRCS1 ; Enter here to recover from PI level lossage + TRNN TT,%HXRDY + JRST QOVR + SKIPGE Q,QSDU + BUG +QECCX: ;; Enter here from ECC correction code + PUSHJ P,RHCLRC ; Clear controller errors and select drive + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ; Punt if not positioned in right place + IOWRQ TT,%HRCYL ; Store cylinder in drive + HRRZ TT,QCHPGA + IOWRQ TT,%HRADR ; Store track and sector + HLRZ TT,QIOWD + IOWRQ TT,%HRWC ; Store halfword count + HRRZ TT,QIOWD + IOWRQ TT,%HRBA ; Store Unibus base address + MOVE A,QCHPRG + PUSHJ P,RHCMD ; Go! + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: MOVEI A,%HYCLR ; Sock controller in jaw + IOWRQ A,%HRCS2 + MOVE Q,QSDU + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Redundantly clear drive + SETOM QHUNGF + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT #],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, + +] ;RH11P + ;READ - DROPS IN + +IFN RH10P,[ + MOVEI T,%HMRED +QINT6A: IORI T,QICWA_6 .SEE $HCICWA + TLO T,%HRCTL(Q) + MOVEM T,QCHPRG + MOVEM Q,QSDU + LSH R,10. ;ASSEMBLE DF10-C CONTROL WORD + SUBI R,1 + MOVNI E,2000 + DPB E,[$DFWC R] + MOVEM R,QIOWD + SETZM QIOWD+1 + MOVE E,QSGL(C) + PUSHJ P,QPOSR + MOVEM E,QCHPGA +QOVR: CONSZ DSK,20 ;ENTER HERE FOR RECOVER FROM PI HALT, OVERRUN + JRST QOVR + SKIPGE Q,QSDU + BUG + MOVEI TT,QIOWD + HRRZM TT,QICWA +QECCX: SETZM QICWA+1 ;ENTER HERE FROM ECC CORRECTION CODE + CONO DSK,%HOCLR+%HORAE+%HOATN+DSKCHN + HLRZ TT,QCHPGA + CAME TT,QPOS(Q) + JRST DSKEX ;DONT DO ANYTHING IF NOT WHERE YOU SHOULD BE + MOVSI A,%HRCYL(Q) ;STORE ADDRESS IN DRIVE + HLR A,QCHPGA + PUSHJ P,RHSET + MOVSI A,%HRADR(Q) + HRR A,QCHPGA + PUSHJ P,RHSET + MOVE A,QCHPRG + PUSHJ P,RHSET +IFN QRDCMP,[ + SETZM RDCPHS ;ASSUME NO READ-COMPARE WANTED + SKIPE QRCSW + SETOM RDCPHS ;REMEMBER TO READ-COMPARE LATER +];QRDCMP + MOVE A,TIME + MOVEM A,LQTM + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR + AOS NWXFR + JRST QINTX + SKIPL B + AOSA NSRXFR + AOS NSWXFR +QINTX: JRST DSKEX + +QHUNG: CONO DSK,%HOCLR+%HORST+%HOSTP+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR ;CLEAR DRIVE + PUSHJ P,RHSET + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[ADDR=],OCT,QCHPGA + POPJ P, +] + ;READ - DROPS IN +IFN DC10P,[ + MOVSI T,(DREAD) +QINT6A: MOVEM T,QCHPRG + MOVEM Q,QSDU + DPB R,[DCBN+QCHPR2] ;MEM BLOCK # + DPB R,[DCBN+QCHPR3] ;FOR POSSIBLE READ COMPARE + MOVE E,QSGL(C) + PUSHJ P,QPOSR ;QPOSR ALSO STORES MAPPED UNIT IN QCHPRG + IORB E,QCHPRG + CLEARM QCHPR4 ;STORE DHALT FOR NO RCC + CAILE C,NQCHN + JRST QINT6S ;SWAPPING CHNL + SKIPL B + AOSA NRXFR + AOS NWXFR + CAIE C,NQCHN ;ALWAYS R COMPARE DIR WRITES + SKIPLE QRCSW ;SKIP ON NOT READ COMP EVERYTHING + JRST QINT6B ;RCC + SKIPL QRCSW + JUMPL B,QINT6B ;RCC WRITES + HRRZ D,QSRAC(C) + CAIL D,%QMUDR + CAILE D,%QMTTR + JRST QINT6C ;NOT DIR READ +QINT6B: TLZ E,340000 ;CHANGE TO READ COMPARE + MOVEM E,QCHPR4 +QINT6C: SETOM QERS1 ;ERR VERIFY IND +QOVR: CONSZ DC0,DSSRUN+DSSACT + JRST QOVR + DATAO DC0,[DJMP QCHPRG] ;ENTRY ON OVERRUN +QOVR1: CONO DC0,DCSET+DCIENB+DSKCHN ;INTERRUPT WHEN DONE + MOVE A,TIME + MOVEM A,LQTM +QINTX: JRST DSKEX + +QINT6S: SKIPL B + AOSA NSRXFR + AOS NSWXFR + JUMPL B,QINT6B ;RCC WRITES + JRST QINT6C ;NOT READS + +QHUNG: CONO DC0,DCCSET+DSKCHN ;HUNG, CLEAR CONTROLLER + SETOM QHUNGF + MOVE Q,QSDU + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON UNIT ],DEC,QSDU,[QCHPRG=],OCT,QCHPRG + POPJ P, +] + +QINT6W:IFE DMDSK,[ + MOVE T,[QXWDS-1,,QXWDS] + BLT T,QXWDS+3 + CAIL C,NQCHN + JRST QNT6W2 ;SWAP OR DIR WRITE + MOVE A,QUDPR(C) + MOVE T,QSNUD(A) + MOVEM T,QXWDS+XWSYSN + HRRZ A,QSNLCN(A) + ADD A,QUDFPR(C) + MOVE T,UNFN1(A) + MOVEM T,QXWDS+XWFN1 + MOVE T,UNFN2(A) + MOVEM T,QXWDS+XWFN2 + MOVE T,QSLBLK(C) + DPB T,[XWBLK+QXWDS] + LDB T,[MWC,,MEMBLT(R)] + DPB T,[XWAWC+QXWDS] +QNT6W2: +] +IFN DC10P, MOVSI T,(DWRITE) +IFN RP10P, MOVSI T,(DWRITC) +IFN RH10P, MOVEI T,%HMWRT +IFN RH11P, MOVEI T,%HMWRT + JRST QINT6A + +IFN T300P,[ +T3IO: MOVEM C,QSDCH1 ;THIS IS MORE OR LESS QINT6A FOR T-300 + MOVEM Q,QSDU1 + MOVEI A,%DMRED + SKIPGE B,QSCRW(C) + MOVEI A,%DMWRT +T3IO1: MOVE R,QSCABN(C) ;RE-ENTER HERE TO RETRY WITH COMMAND IN A + LSH R,10. ;FIRST ADDRESS IN TRANSFER + TLO R,730000 ;12-BIT BYTES, START WITH FIRST BYTE IN WORD + MOVSI E,-4 ;SET UP BYTE POINTERS + MOVEM R,DSCPNT(E) + ADDI R,400 + AOBJN E,.-2 + MOVE D,QSGL(C) ;DO LIKE QPOSR + CAIL D,NBLKS1 + BUG + IDIVI D,NBLKC1 + MOVEM D,DSCCYL + IMULI E,SECBL1 + IDIVI E,NSECS1 + MOVEM E,DSCHED + MOVEM TT,DSCSEC + PUSHJ P,T3CMD + CAILE C,NQCHN + JRST .+5 + SKIPL B + AOSA NRXFR1 + AOS NWXFR1 + JRST QINTX + SKIPL B + AOSA NSRXF1 + AOS NSWXF1 + JRST QINTX + +;START T-300, COMMAND IN A, DRIVE IN Q +T3CMD: MOVEI TT,2561 + MOVEM TT,DSCCHK + MOVE TT,TIME + MOVEM TT,LQTM1 + MOVEI TT,-T300P(Q) + MOVEM TT,DSCDRV + HRRZM A,DSCCMD + SETZM DSCDON + MOVEI T,1 + MOVEM T,DSCREQ + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, + +QHUNG1: MOVE Q,QSDU1 + AOS NTQHNG(Q) + BUG INFO,[DSK: HUNG ON T-300 UNIT ],DEC,QSDU + MOVEI TT,5*60.*30. ;SHUT UP FOR FIVE MINUTES + ADDM TT,LQTM1 + POPJ P, +];T300P + +QDE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT +IFN DC10P, AOSE PKIDM + SKIPGE Q,QSDU + BUG +IFN DC10P,[ + TRNE TT,DCKSER + JRST .+3 ;GET CKS ERR + TRNE TT,DRCER + AOS NQCMPE(Q) ;# COMPARE ERRORS [WITH NO OTHER ERROR] +];DC10P +IFN T300P,T3DE: ;ENTER HERE FOR ERROR ON T-300 + AOS NQDE(Q) + SKIPL R,QSCRW(C) + AOSA NQRDE(Q) + AOS NQWDE(Q) +IFN DC10P, JUMPL R,QERV1 ;DO ANOTHER RD/COMP TO SEE IF OK ON DSK (IF WRITE) +QERV2: AOS R,QERRS(C) + TRNN R,10 ;TRY 8 TIMES BEFORE AND AFTER REPOSITION + JRST QDE1 + TRNN R,1000 + JRST QDE2 ;TRY REPOSITION ONCE +QERV3: MOVE D,QSRAC(C) + TRNE D,-%QMMAX + BUG + XCT .+1(D) ;INVOKE IRRECOV ERROR HANDLER +QERV: OFFSET -. +%QMIDL::JRST 4,QERV+. ;IDLE CHANNELS SHOULDN'T GET HERE +%QMRD:: JRST QPE2D ;USER DATA +%QMWRT::JRST QDE1 ;WRITE KEEP TRYING +%QMWOV::JRST QDE1 ;.. +%QMRD1::JRST QPE2D + JRST 4,QERV+. ;ILL CODE +%QMUDR::JRST QUDER1 +%QMMDR::JRST QDE1 +%QMTTR::JRST QDE1 +%QMUDW::JRST QDE1 +%QMMDW::JRST QDE1 +%QMTTW::JRST QDE1 +%QMSWP::JRST QSWPER + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE + JRST 4,QERV+. ;ILL CODE +%QMMAX::OFFSET 0 + +QSWPER: SKIPGE CIRPSW ;TRY XFER AGAIN IF CIRPSW NOT AVAILABLE + SKIPGE QSCRW(C) + JRST QDE1 ;DON'T TRY TO DO ANYTHING ABOUT WRITE ERRORS + MOVE A,QSCABN(C) ;READ - GIVE ALL USERS OF PAGE PARITY ERR + PUSH P,C + PUSH P,Q + MOVE C,[2200,,MEMPNT(A)] + PUSHJ P,UCPRL + 400000,,QSWER1 + LDB Q,[2200,,MEMPNT(A)] + DPB Q,C ;REMOVE MEM FROM LOOP + PUSHJ P,IMEMR ;AND GIVE BACK MEM + POP P,Q ;ALTERNATIVELY, COULD LEAVE THE MEM BUT SET MMPBAD + POP P,C ;TO INDICATE THAT THAT MEM COPY OF THE PAGE IS NO GOOD. + MOVEI D,2 + DPB D,[410200,,@QSMMP(Q)] ;PAGE IS OUT + JRST QPE2D + +QSWER1: PUSH P,T + MOVSI T,%PJPAR + IORM T,PIRQC(U) + JRST POPTJ + +IFN DC10P,[ +QERV1: SKIPN QCHPR4 + JRST QERV2 ;NOT SET FOR RCC + CLEARM QERS1 +QERL2: CONSZ DC0,DSSRUN+DSSACT + JRST .-1 + DATAO DC0,[DJMP QCHPR4] + JRST QOVR1 + +QERL1: AOS Q,QERS1 + CAIGE Q,50. + JRST QERL2 + AOSA NQWIRE +QEROK: AOS NQWRE + MOVE C,QSDCH + MOVE Q,QSDU + SETOM QERS1 + JRST QERV2 +] +QDE2: MOVEI R,1000 + MOVEM R,QERRS(C) ;CLOBBER QERRS + JRST QREC ;AND TRY REPOSITIONING + +IFN RP10P,[ +QERSOFT:LDB A,[DCYL+QCHPRG] ;PARSE STARTING DISK ADDRESS + LDB B,[DCYLXB+QCHPRG] + LSH B,8 + IOR A,B + LDB B,[DSURF+QCHPRG] + LDB D,[DSECT+QCHPRG] + SKIPN QERRS(C) ;PRINT ONLY ONCE, NOT ON RETRIES + BUG INFO,[DSK: SOFT ERR UNIT ],DEC,Q,[CYL ],DEC,A,[STARTING HEAD ],DEC,B,[SEC ],DEC,D,[CONI=],OCT,QERST,[DATAI=],OCT,QERDTI + POPJ P, + +QRECAT: CONI DPC,A + BUG INFO,[DSK: SEEK ERR DATAO=],OCT,QSEEK(Q),[CONI=],OCT,A,[DATAI=],OCT,E + SETZM QSEEK(Q) + JRST QREC +];RP10P + +QHE: MOVE C,QSDCH +IFN RP10P, PUSHJ P,QERSOFT + SKIPGE Q,QSDU + BUG +IFN T300P,T3HE: ;ENTER HERE FOR ID ERROR ON T-300 + AOS NQHE(Q) + AOS E,QERRS(C) + CAIL E,5. + JRST QHE2 +QREC: +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QRCAL(Q) + MOVEI A,%DMREC + PUSHJ P,T3CMD + MOVEM Q,QSDU1 ;CONTROLLER IS TIED UP BY RECAL BECAUSE + JRST QINT1 ] ;IT'S TOO DAMNED PSEUDO-INTELLIGENT +];T300P +IFN DC10P,[ + MOVE TT,QTRAN(Q) +QREC0: DPB TT,[DUNFLD+QRECAL] + SETOM QRCAL(TT) + SETOM QSKT1(TT) + CLEARM QSPPS(TT) + CLEARM QPOSGL(TT) + SETOM QPOS(TT) + MOVEI T,10. ;5-SECOND RECALIBRATE TIMEOUT + MOVEM T,QRCTIM(TT) + DATAO DC0,QRECAL + CONO DC0,DCSET+DCATEB+DSKCHN ;ENABLE ATTENTION +] +IFN RP10P,[ + DPB Q,[DUNFLD+QRECAL] + SETOM QPOS(Q) + DATAO DPC,QRECAL + CLEARM QSPPS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) ;INDICATE RECALIBRATING THIS DISK + CLEARM QPOSGL(Q) +] +IFN RH11P,[ + PUSHJ P,RHSLCT ; Select drive + PUSHJ P,RHCLRD ; Clear errors + MOVEI A,%HMREC + PUSHJ P,RHCMD ; Recalibrate + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] ;RH11P +IFN RH10P,[ + MOVSI A,%HRDCL(Q) + HRRI A,%HMCLR + PUSHJ P,RHSET ;CLEAR ERROR OUT OF DRIVE. + MOVSI A,%HRDCL(Q) + HRRI A,%HMREC ;RECALIBRATE + PUSHJ P,RHSET ;MAYBE SHOULD TRY OFFSET FIRST? + CLEARM QSPPS(Q) + CLEARM QPOSGL(Q) + SETOM QPOS(Q) + SETOM QSKT1(Q) + SETOM QRCAL(Q) +] + SETOM QSDU + JRST QINT1 ;LOOK FOR SOME OTHER TRANSFER + +QHE2: SKIPL QSCRW(C) ;HANG UP OR POSITIONING ERR (AFTER 5 TRIES) + JRST QERV3 ;IF READ, PERFORM RECOVERY + +QPE2D: MOVSI R,%QAPAR ;IRRECOVERABLE ERROR + IORM R,QSRAC(C) + AOS QIRRCV + MOVE D,QSGL(C) + MOVEM D,QIRCBK ;BLOCK # AT IRRCV ERR + MOVEM Q,QIRUNT ;SAVE UNIT TOO + CAILE C,NQCHN + AOS NIRSWE ;# IRRCV SWAPPING ERRS + MOVE I,Q + SKIPGE QTUTO(I) + JRST QPE2E ;DON'T MESS WITH LOCKED TUT + PUSHJ P,TUTPNT + CAIN B,TUTLK ;PRINT MESSAGE IF NOT YET LOCKED OUT + JRST QINTI + MOVEI B,TUTLK + DPB B,D +QPE2E: BUG INFO,[DSK: IRREC DATA ERR #],DEC,QIRRCV,[UNIT=],DEC,QIRUNT,[BLK=],OCT,QIRCBK + JRST QINTI + +QUDER1: MOVEI R,1(Q) ;TRY TO READ DIR FROM OTHER DISKS +QUDER2: CAIL R,NQS + MOVEI R,0 + CAME R,QDSKN(C) + JRST QUDER4 + JRST QDE1 ;NO OTHER DISK AVAIL TO READ FROM, TRY AGAIN + +QUDER4: SKIPGE QACT(R) + AOJA R,QUDER2 + HRRZM R,QDSKN(C) ;TRY THIS DISK +IFN T300P,[ + CAIL Q,T300P + JRST [ SETOM QSDU1 ;FREE DRIVE FORMERLY HACKING + SETOM QTUNT1 + JRST T3UDE4 ] +];T300P +IFE DC10P, SETOM QSKT1(Q) ;FREE DRIVE FORMERLY HACKING +IFN DC10P,[ + MOVE TT,QTRAN(Q) + SETOM QSKT1(TT) +] + SETOM QSDU + SETOM QTUNT +IFN T300P,T3UDE4: + MOVE E,QSGL(C) + MOVE Q,QDSKN(C) + SETZM QERRS(C) + JRST QINT5 + +QIDRCH: MOVE TT,QDIRP(C) ;CHNL IN C PNTR TO QSNUD IN J LOAD NEXT CHR INTO A + AOS QDIRP(C) ;ALSO RET BYTE PNTR IN TT + IDIVI TT,UFDBPW + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(J) + ADDI TT,UDDESC(I) + LDB A,TT + POPJ P, + +QMPDCH: MOVE TT,QDIRP(A) ;CHNL IN A PNTR TO QSNUD IN H LOADS NEXT CHR IN R + AOS QDIRP(A) ;USED AT M.P. LEVEL +QMPDC1: IDIVI TT,UFDBPW ;ALSO RETN BYTE PNTR IN TT + HLL TT,QBTBL(I) + HRRZ I,QSNLCN(H) + ADDI TT,UDDESC(I) + LDB R,TT + POPJ P, + +;REACHED EOF ON READ +QEOF: SOS QDIRP(C) ;AVOID GC UNHAPPINESS + MOVSI I,%QAEFR + IORM I,QSRAC(C) + HLLZS QSRAC(C) .SEE %QMIDL ;IDLE THE CHANNEL + AOS QSBFS(C) ;TO UNHANG M.P. WHICH IS WAITING FOR BUF TO APPEAR + JRST QINT2C + +QINT4C: +; 8/20/90 DM "funny" bit no longer supported. Allows for huge RP07 block +; numbers. Commenting this out means that %QAFNY can no longer get set +; under any circumstances, so I am leaving a certain amount of dead code in +; other places. +; IFN DMDSK,[ +; MOVSI E,%QAFNY +; ANDCAM E,QSRAC(C) +; TRZE A,20 ; FUNNY FILE BLOCK +; IORM E,QSRAC(C); INDICATE SO +; ] + MOVEI E,0 + DPB A,[140500,,E] + PUSHJ P,QIDRCH + DPB A,[060600,,E] + PUSHJ P,QIDRCH + DPB A,[0600,,E] + MOVEM E,QSLGL(C) + JRST QINT4G + +;DECODE UNBYTE SPEC IN D. +;RETURNS BYTE SIZE IN D, NUMBER OF UNUSED BYTES IN LAST WORD IN E. +QBDCD: TRZE D,400 + JRST [ IDIVI D,100 ? POPJ P, ] + TRZE D,200 + JRST [ IDIVI D,20 ? POPJ P, ] + SUBI D,44 + JUMPGE D,[ IDIVI D,4 ? POPJ P, ] + MOVNS D + SETZ E, + POPJ P, + +;ENCODE BYTE SIZE IN Q AND RESIDUE IN R INTO UNBYTE SPEC IN RH(Q) +QBENC: CAIG Q,3 + JRST [ IMULI Q,100 ? ADDI Q,400(R) ? POPJ P, ] + CAIG Q,7 + JRST [ IMULI Q,20 ? ADDI Q,200(R) ? POPJ P, ] + CAIG Q,18. + JRST [ IMULI Q,4 ? ADDI Q,44(R) ? POPJ P, ] + MOVNI Q,-44(Q) + POPJ P, + +QINT3: SKIPL DWUSR + JRST QINT3X ;DIR CHNL IN USE +IFN T300P,[ + SKIPGE QSDU ;DON'T GET PAST HERE UNLESS BOTH CONTROLLERS ARE IDLE + SKIPL QSDU1 + JRST QINT3X +];T300P + AOSL QDWFAR + JRST [ MOVNI H,10. + MOVEM H,QDWFAR + JRST .+3 ] + SKIPG QACTTM ;LAST ACTIVITY TOO RECENT + JRST QUDW + SKIPGE H,QMDRO + JRST QTDW + MOVE J,QACTB + TDNN J,H + JRST QTDW + MOVSI Q,-NQS +QMDW: SKIPGE QACT(Q) + JRST QMDWA ;UNIT NOT ACTIVE + MOVE J,DCHBT(Q) + TDNN J,QMDRO + JRST QMDWA + HRLI Q,(SETZ) ;INDICATE MFD WRITE IN PROGRESS + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMMDW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QMDRO + MOVE C,MDCHK(TT) + CAME C,[SIXBIT /M.F.D./] + BUG HALT,[MFD CLOBBERED] + HRRZ C,Q + CAMN C,MDSK + AOSA C,QAMDNO + MOVE C,QAMDNO + MOVEM C,MDNUM(TT) + SETZM DWUSR + MOVEI TT,MFDBLK + MOVEM TT,QSGL+NQCHN + HRRZ TT,QMDRO + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QMDWA: AOBJN Q,QMDW +QTDW: SKIPG QACTTM + JRST QUDW + MOVSI Q,-NQS +QTDW1: SKIPGE QACT(Q) + JRST QTDWA + MOVE J,DCHBT(Q) + SKIPL QTUTO(Q) + TDNN J,QTUTO(Q) + JRST QTDWA + MOVSI H,240000 + TDNE H,QTUTO(Q) + JRST QTDWA1 + MOVE TT,TIME ;DON'T WRITE TUTS TOO OFTEN + SUB TT,QTWRTM(Q) ;BECAUSE THE TUT IS LOCKED WHILE IT'S BEING WRITTEN + CAIGE TT,100. + JRST QTDWA + ADDM TT,QTWRTM(Q) + HRLI Q,200000 + MOVEM Q,QDWIP + HRRZM Q,DWSKN + MOVEI TT,%QMTTW + HRRZM TT,QSRAC+NQCHN + MOVSI TT,(SETZ) + IORB TT,QTUTO(Q) + MOVE H,QPKNM(Q) ;VERIFY THAT TUT IS NOT BEING CLOBBERED + MOVE C,QPKID(Q) + CAMN H,QPAKID(TT) + CAME C,QPKNUM(TT) + BUG HALT,[TUT ],DEC,Q,[CLOBBERED] + SETZM DWUSR + MOVEI TT,MFDBLK ;INITIATE WRITING OF FIRST BLOCK OF TUT + SUB TT,NTBL(Q) + MOVEM TT,QSGL+NQCHN + LDB TT,[121000,,QTUTO(Q)] + MOVEM TT,QSCABN+NQCHN + JRST QINT1 + +QTDWA1: ANDCAM J,QTUTO(Q) +QTDWA: AOBJN Q,QTDW1 +QUDW: MOVSI C,-QNUD +QDW4A: MOVE J,QACTB ;BITS CORRESP TO ACTIVE DISKS +QDW4: SKIPE TT,QSNUD(C) + SKIPGE QSNLCN(C) + JRST QDW3 ;SLOT VACANT OR LOCKED + TDNE J,QSNLCN(C) + JRST QUDW1 ;NEEDS TO BE WRITTEN ON SOME UNIT +QDW3: AOBJN C,QDW4A +QINT3X: ;HERE IF DISK GOING IDLE. CLEAR DONE FLAG. + ;IN 2-CONTROLLER CASE, MAKE SURE WE ONLY DO IT TO THE RIGHT CONTROLLER. +IFN T300P,[ + SKIPL QSDU + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW +] ;T300P +IFN DC10P, CONO DC0,DCCLR+DCIENB+DSKCHN +IFN RP10P, CONO DPC,177710+DSKCHN ;MUST CLEAR "DONE" +IFN RH10P, CONO DSK,%HOCLR+%HOATN+%HORAE+DSKCHN +IFN RH11P, ;; RH11 doesn't need this? + JRST DSKEX ;STUFF NEEDS TO BE DONE BUT CANT NOW + +QUDW1: MOVSI J,%QUDWM ;WRITE RIGHT AWAY IF %QUDWM IS ON + TDNN J,QSNLCN(C) + SKIPE QSFBT(C) ;OR DISK BLOCKS (AND CORE) WAITING TO BE FREED + JRST QUDW6 + SKIPG QACTTM ; ACTIVITY TOO RECENT + SKIPN QSNNR(C) ; THEN ONLY WRITE IF NOTHING POINTING TO DIRECTORY + SKIPA + JRST QDW3 + MOVSI Q,-NQS +QUDW4: SKIPGE QACT(Q) + JRST QUDW3 + MOVE J,DCHBT(Q) + TDNE J,QSNLCN(C) + JRST QUDW2 +QUDW3: AOBJN Q,QUDW4 + JRST QDW3 + +QUDW6: ANDCAM J,QSNLCN(C) ;TURN OFF %QUDWM + MOVE Q,MDSK ;AND WRITE ON MASTER DISK (ASSUME MDSK IS ACTIVE AND BIT IN QSNLCN IS SET) + +QUDW2: MOVE I,QMDRO + TLNE I,40000 ;IS THIS CODE OBSOLETE? LEFT FROM DAYS OF 1 MFD PER DRIVE? + JRST QUDW2B ;MASTER DIR NOT IN + HRRZS Q + CAMN Q,MDSK ;SKIP IF NOT WRITING ON MASTER DISK + PUSHJ P,QDIRCK ;BLESS THIS UFD!!! + MOVSI TT,(SETZ) + IORB TT,QSNLCN(C) ;LOCK USER DIRECTORY + MOVEI J,%QMUDW + HRRZM J,QSRAC+NQCHN + MOVE A,1(TT) ;NAME AREA PTR + MOVE J,QSNUD(C) + CAMN J,UDNAME(TT) ;MAKE SURE NOT ABOUT TO WRITE BAD DIRECTORY + CAILE A,2000 + JSP TT,QUDCLB + SUBI A,11. + IMULI A,6 + SKIPL J,(TT) + CAMLE J,A ;FS PTR BAD? + JSP TT,QUDCLB + CLEARM DWUSR + MOVEM Q,DWSKN + MOVE TT,QSNMI(C) + MOVEM TT,QSGL+NQCHN + HRRZ TT,QSNLCN(C) + LSH TT,-10. + MOVEM TT,QSCABN+NQCHN + HRRZM C,QDWIP + CLEARM QERRS+NQCHN + JRST QINT1 + +QUDW2B: ANDCAM J,QSNLCN(C) ;CLEAR BIT + GO AWAY + JRST QUDW3 + +;GENERALLY GET HERE BY JSP TT, +QUDCLB: BUG HALT,[DIR ],OCT,C,SIXBIT,QSNUD(C),[CLOBBERED] + +QDIRCK: PUSH P,TT ;CHECKS FILES FOR REASONABLE DESCRIPTORS - + ; PRECEDING BYTE =0, FIRST BYTE NOT=0 + HRRZ A,QSNLCN(C) + MOVEI B,1777(A) ;END OF NAMES + ADD A,1(A) ;BEGIN NAMES +QDIRC1: CAMG B,A + JRST POPTTJ ;DONE + SKIPN (A) + JRST QDIRC2 ;0 NAME=NO FILE + LDB TT,[1500,,UNRNDM(A)] ;DESC PTR + SOS TT ;TRICK - IF DESC PTR = 0 LDB BELOW GETS 0 BECAUSE P FIELD = 44 + IDIVI TT,6 + HLL TT,SBTBL(I) ;BYTE POINTER + ADDI TT,UDDESC-1777(B) + LDB I,TT + JUMPN I,QUDCLB + ILDB I,TT + JUMPE I,QUDCLB +QDIRC2: ADDI A,LUNBLK + JRST QDIRC1 + +IFN RP10P,[ +QPOSR: CAIL E,MBLKS + BUG ;TOO BIG EVEN FOR RP03 +IFN DMDSK,[ + IMULI E,SECBLK + IDIVI E,NSECS + SETZM D + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + DPB Q,[DUNFLD+D] +] +IFE DMDSK,[ + MOVEI D,0 + IDIVI E,NBLKSC + DPB E,[DCYL+D] + MOVEM E,QSPPS(Q) + LSH E,-8 + DPB E,[DCYLXB+D] + MOVE E,TT + IMULI E,NSSECS + IDIVI E,NHSECS + DPB E,[DSURF+D] + DPB TT,[DSECT+D] + DPB Q,[DUNFLD+D] +] + MOVE E,D + POPJ P, +] +IFN RH10P+RH11P,[ +IFE DMDSK, .ERR CHANGE QPOSR FOR 9-SECTOR BLOCKS! +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NBLKSC + HRLZ D,E ;CYLINDER IN LH + MOVEM E,QSPPS(Q) + MOVE E,TT + IMULI E,SECBLK + IDIVI E,NSECS + LSH E,8 + IOR E,D ;SURFACE IN 1.9-2.4 + IOR E,TT ;SECTOR IN 1.1-1.5 + POPJ P, +] ;RH10P+RH11P + +IFN DC10P,[ +QPOSR: CAIL E,NBLKS + BUG + IDIVI E,NSECS + MOVSI D,(DUNENB) + DPB TT,[DSECT+D] + IDIVI E,NHEDS + DPB TT,[DSURF+D] + SKIPGE TT,QTRAN(Q) + ADDI E,NCYLS+XCYLS + DPB E,[DCYL+D] + MOVEM E,QSPPS(TT) + MOVE E,D + DPB TT,[DUNFLD+E] + DPB TT,[DUNFLD+QCHPRG] + SKIPGE TT,QPKID(Q) + JRST QPOSRI + DPB TT,[DPKID+E] + POPJ P, + +QPOSRI: MOVE TT,QTRAN(Q) ;NEED PACK ID BEFORE PROCEEDING + DPB TT,[DUNFLD+GPKID] + SETOM QSKT1(TT) + MOVEI A,TUTCYL + SKIPGE QTRAN(Q) + ADDI A,NCYLS+XCYLS + DPB A,[DCYL+GPKID] + MOVEM A,QPOS(TT) ;WILL SEEK TO HERE AUTOMATICALLY + MOVEM A,QPOSGL(TT) + DATAO DC0,[DJMP GPKID] + MOVEM Q,QSDU + SETOM PKIDM + JRST QINTX + +QSPKID: CONSZ DC1,1777 + BUG ;ERRORS + LDB TT,[DPKID+RPKID] + MOVEM TT,QPKID(Q) + SETOM QSDU + JRST QINT1 +] + +SUBTTL DISK IOT ROUTINES + +OVHMTR UUO ;MORE RANDOM UUOS + +;BECAUSE .ACCESS MERELY DROPS ITS ARG IN A VARIABLE AND SETS %QAACC, +;ALL IOT ROUTINES MUST TEST %QAACC AND DO THE REAL WORK OF CHANGING +;THE ACCESS POINTER IF NECESSARY. + +QBO: MOVEI T,BLKT + JRST QUO1 + + SKIPA T,[SIOKT] +QUIO: +QUAO: MOVEI T,CHRKT +QUO1: PUSH P,T + PUSH P,TT + PUSH P,D + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBWRA1 ;RANDOM ACCESS MODE HACK + POP P,D + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKT, SIOKT, OR BLKT +QBOV: SETZ QSMPRP(A) + QSMPRC(A) + QSBWG + SETZ QSBWW + JRST QOCL + TRNA + +QBI: MOVEI T,BLKT + JRST QUI1 + + SKIPA T,[SIOKT] +QUII: +QUAI: MOVEI T,CHRKTI +QUI1: PUSH P,T + PUSH P,TT + MOVE T,QSRAC(A) + TLNE T,%QAACC+%QALNK + PUSHJ P,QBRRA1 + POP P,TT + MOVE E,QSBYTE(A) + JSP B,CPOPJ ;TRANSFER TO CHRKTI, SIOKT, OR BLKT +QBIV: QSMPRP(A) + QSMPRC(A) + QSBGB + QSBRB + JRST QICL + SKIPG QSBFS(A) + +QBWRA1: TLNE T,%QALNK + JRST IOCR10 + LDB T,[$QAMOD,,QSRAC(A)] ;SET RANDOM ACCESS PNTRS ON WRITE + SOJN T,QBWRA2 ;IN ORDINARY WRITE MODE + SKIPGE QSCRW(A) ;WAIT FOR CHANNEL TO BECOME IDLE OR HANG UP IN READ + PUSHJ P,UFLS ; WAITING FOR %QAACC TO TURN OFF + SKIPL QSGL(A) + PUSHJ P,UFLS + SKIPGE QSMDN(A) + JRST QBWRA2 + MOVE T,QRADAD(A) ;DESIRED ADDRESS + SUB T,QFBLNO(A) ;ACTUAL ADDRESS OF BEG OF CURRENT BUFFER + JUMPL T,QBWRA2 ;XFER ON BEFORE CURRENT BLOCK + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER IN BYTES + JUMPL T,QBWRA3 ;SAME BLOCK AS NOW +QBWRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QSOCL5 ;CLEAR ANY CURRENT BUFFERS ETC + PUSHJ P,QUDULK + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR ;LOCKS DIR IF SKIPS + JRST QBWRA4 ;OFF END OF FILE +QBWRA5: PUSHJ P,QUDULK +QBWRA9: POP P,C + POP P,I + POP P,R + CLEARM QSCRW(A) ;SWITCH TO WRITE OVER MODE + MOVSI Q,%QAMPU+%QAMWO ;SET UPDATE ADR AND WRITE OVER + IORM Q,QSRAC(A) + CLEARM QSMPRC(A) + MOVSI Q,%QAEFR+%QAEFW+%QAACC ;CLEAR EOF, WRITE EOF, AND ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD1 ;AND READ IN THE CURRENT BLOCK + HRRM Q,QSRAC(A) + POPJ P, + +QBWRA4: JUMPE Q,QBWRA0 + CAME J,Q ;MIGHT BE ADDING TO END OF FULL BLOCK + JRST IOCER2 + JRST QBWRA9 + +QBWRA0: PUSHJ P,QLWO ;OFF END OF FILE AND WAS ACCESSING WD 0 + MOVSI C,%QAACC ;SO SWITCH TO NORMAL WRITE MODE AND + ANDCAM C,QSRAC(A) ;TURN OFF RANDOM ACCESS BIT + POP P,C + POP P,I + POP P,R + POPJ P, + +QBWRA3: SKIPGE TT,QSMDN(A) + BUG ;NO BUFFER REALLY ACTIVE AT M.P. + MOVSI J,%QAWOV + TDNN J,QSRAC(A) + JRST QBWRA7 + ANDCAM J,QSRAC(A) ;WAS WRITING IN LAST BLK PAST EOF, + MOVN D,QSMPRC(A) ; UPDATE ACTIVE BYTE COUNT + ADDM D,QMPBSZ(A) ;DECREASE SIZE OF BUFFER TO AMT ACTUALLY WRITTEN +QBWRA7: LSH TT,10. ;ADDRESS OF BUFFER + MOVE T,Q ;SAVE RELATIVE BYTE ADDR WITHIN BUFFER + IDIVI Q,@QSBYTE(A) ;Q = WDS, J = BYTES + ADD TT,Q ;ADDRESS OF DESIRED WORD + HLL TT,QSBYTE(A) ;BYTE POINTER TO FIRST BYTE IN THAT WORD + JUMPE J,.+3 ;ADVANCE TO APPROPRIATE BYTE + IBP TT + SOJG J,.-1 + MOVEM TT,QSMPRP(A) + SUB T,QMPBSZ(A) ;MINUS # BYTES LEFT IN BLOCK + MOVNM T,QSMPRC(A) +QBRRA4: MOVSI Q,%QAACC + ANDCAM Q,QSRAC(A) + POPJ P, + +QSKFRC: MOVN B,QSMPRC(A) + ADD B,QMPBSZ(A) ;NUMBER OF BYTES WRITTEN IN BLOCK + MOVE C,QSRAC(A) + TLNE C,%QAMWO + TLNE C,%QAWOV + JRST [MOVEM B,QMPBSZ(A) ;IS LAST BLOCK, CHANGE LENGTH + PUSHJ P,QOCLPD ;AND PAD IT (GUARANTEED NO-OP IF WORD MODE CHNL) + JRST .+1 ] + SETZM QSMPRC(A) ;BUFFER WILL BE DISPOSED OF + MOVSI E,%QUDWM + SKIPGE QSMDN(A) + SETZB B,E ;NO BUFFER AFTER ALL + ADD B,QFBLNO(A) ;CURRENT POSITION IN FILE + MOVSI C,%QAACC + TDNN C,QSRAC(A) + MOVEM B,QRADAD(A) ;ACCESS BACK ON NEXT IOT + IORB C,QSRAC(A) + PUSHJ P,[TLNE C,%QAWOV ;WRITE OUT THE BUFFER + JUMPN E,QSBWO2 + JRST QSBWW ] + SKIPE QMPTC(A) + MOVSI E,%QUDWM + PUSHJ P,QOCL2 ;STORE QMPTC IF NECESSARY + IORM E,QSNLCN(H) ;WRITE OUT DIR FAST IF CHANGED + PUSHJ P,QUDULK + JRST POPJ1 + +;.CALL FINISH ON DISK OUTPUT CHANNEL +QSKFIN: HRRZ T,QSRAC(A) + CAIN T,%QMWOV ;IF WRITE-OVER MODE + JRST [ SKIPE QSCRW(A) ;THEN WAIT FOR IT TO SWITCH TO READ MODE + PUSHJ P,UFLS + JRST QSKFIN ] + CAIN T,%QMWRT ;IF WRITE MODE + JRST [ SKIPE QSBFS(A) ;THEN WAIT FOR ALL BUFFERS TO GET WRITTEN + PUSHJ P,UFLS + JRST .+1 ] + MOVE H,QUDPR(A) + MOVE T,MDSK ;HAS THE DIR BEEN CHANGED AND NOT WRITTEN + MOVE T,DCHBT(T) ;YET TO THE MASTER DISK? + TDNN T,QSNLCN(H) + JRST POPJ1 + MOVSI TT,%QUDWM ;YES, WRITE IT OUT IMMEDIATELY + IORM TT,QSNLCN(H) ;AND DON'T RETURN UNTIL IT IS WRITTEN + TDNE T,QSNLCN(H) + PUSHJ P,UFLS + JRST POPJ1 + +QBRRA1: TLNE T,%QALNK + JRST IOCR10 + SKIPGE QSMDN(A) + JRST QBRRA2 ;NO MAIN PRGM BUFFER + MOVE T,QRADAD(A) + SUB T,QFBLNO(A) + JUMPL T,QBRRA2 + MOVE Q,T + SUB T,QMPBSZ(A) ;SIZE OF CURRENT BUFFER + JUMPL T,QBRRA3 ;SAME BLOCK AS NOW +QBRRA2: PUSH P,R + PUSH P,I + PUSH P,C + PUSHJ P,QICLW1 ;STOP THE CHANNEL AND FLUSH CURRENT BUFFERS + MOVE A,D + CLEARM QSBFS(A) ;FLUSH POSSIBLE EXTRA AOSES WHEN PI HIT EOF + MOVE Q,QRADAD(A) + PUSHJ P,QFNTR + JRST QBRRA5 ;OFF END OF FILE (DIR ALREADY UNLOCKED) + POP P,C + POP P,I + POP P,R + CLEARM QSMPRC(A) + MOVSI Q,%QAMPU + IORM Q,QSRAC(A) ;SET FLAG TO SET QSMPRP AND QSMPRC ON NEXT BUFFER LOAD + MOVSI Q,%QAEFR+%QAACC ;CLEAR EOF AND .ACCESS FLAGS + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMRD ;START READING AGAIN + HRRM Q,QSRAC(A) + JRST QUDULK + +QBRRA5: POP P,C + POP P,I + POP P,R + CAME J,Q + JRST IOCER2 ;ACCESS OFF END OF FILE IS ERROR + MOVSI TT,%QAEFR ;BUT ACCESS TO EXACTLY EOF IS OK + IORM TT,QSRAC(A) ;IMITATES WHAT QEOF DOES + AOS QSBFS(A) + SETZM QSMPRC(A) ;AND READS ZERO WORDS + JRST QBRRA4 + +QBRRA3: SKIPGE TT,QSMDN(A) + JRST QBRRA2 + JRST QBWRA7 + +;BLKT-SIOKT-CHRKT GET BUFFER ROUTINE FOR WRITE-OVER MODE. +QWOG1: SKIPGE QSCRW(A) ;FETCH BLOCK WRITEOVER MODE + JRST QWOG2 ;STILL WRITING PREVIOUS ONE, WAIT + MOVEI Q,%QMRD1 ;SWITCH INTO READ MODE + SKIPG QSBFS(A) ;IF A BUFFER HAS TO BE READ + HRRM Q,QSRAC(A) + SKIPG QSBFS(A) + PUSHJ P,UFLS + POP P,A +;BLKT-SIOKT-CHRKT GET-BUFFER ROUTINE FOR DISK INPUT. +QSBGB: MOVSI Q,%QAPAR + TDNE Q,QSRAC(A) + JRST QSBGB2 + CONO PI,UTCOFF + HRRZ Q,QBFP(A) + JUMPE Q,[MOVSI J,%QAEFR ;SAID TO BE BUFFERS, BUT NONE THERE + TDNN J,QSRAC(A) + BUG ;SHOULDN'T HAPPEN EXCEPT AT EOF + JRST QSBGB5 ] + LDB J,[MLO,,MEMBLT(Q)] + HRRM J,QBFP(A) + SKIPN J + SETZM QBFP(A) ;LAST BLOCK, LIST NOW EMPTY + HRRZ J,MEMPNT(Q) ;GET SIZE OF BUFFER IN BYTES + MOVEM J,QMPBSZ(A) + LDB TT,[$QAMOD,,QSRAC(A)] + SKIPN TT ;DONT SOS IF IN WRITE OVER MODE + SOS QSBFS(A) +QSBWG4: MOVE TT,Q + LSH TT,10. ;RETURN ADDR OF BUFFER + MOVEM Q,QSMDN(A) + CONO PI,UTCON + HLL TT,QSBYTE(A) + MOVSI Q,%QAMPU + TDNN Q,QSRAC(A) + JRST SIOBG2 + MOVE Q,QRADAD(A) ;DIDDLE PNTRS TO TAKE CARE OF RANDOM ACCESS WITHIN BLOCK + SUB Q,QFBLNO(A) ;DESIRED OFFSET WITHIN BLOCK + SUB J,Q + JUMPL J,IOCER2 ;OFF END OF FILE + JUMPL Q,IOCER2 ;OFF FRONT OF FILE (NEGATIVE .ACCESS PNTR) + PUSH P,J + IDIVI Q,@QSBYTE(A) + ADD TT,Q ;ADJUST BYTE POINTER + JUMPE J,.+3 + IBP TT + SOJG J,.-1 + POP P,J + MOVSI Q,%QAMPU ;NOW IS SAFE TO TURN OFF FLAG + ANDCAM Q,QSRAC(A) + JRST SIOBG2 + +;GET-BUFFER DETECTED EOF ON INPUT OR WRITE-OVER. +QSBGB5: CONO PI,UTCON + MOVE Q,QSRAC(A) + TLNE Q,%QALNK + JRST IOCR10 + LDB Q,[$QAMOD,,QSRAC(A)] + SOJN Q,POPJ2 ;ON INPUT, SKIP TWICE TO SIGNAL EOF. + PUSHJ P,QLWO ;LEAVE WRITE OVER MODE + JRST QSBWG ;START NORMAL WRITE + +QWOG2: SKIPGE QSCRW(A) ;WAIT FOR WRITE TO FINISH + PUSHJ P,UFLS + JRST POPAJ ;NOW RECYCLE AND WAIT FOR READ + +;LEAVE WRITE OVER MODE +QLWO: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + CONO PI,UTCOFF + SETZM QBFP(A) ;WRITEOVER MODE EXTEND FILE (SWITCH TO NORMAL MODE) + CLEARM QSBFS(A) + SETOM QSCRW(A) + MOVE Q,QSLGL(A) + HRRZM Q,QMPTN(A) ;STORE BASE TRACK + MOVSI Q,%QAEFR+%QAMWO ;CLEAR EOF AND WRITEOVER + ANDCAM Q,QSRAC(A) + MOVEI Q,%QMWRT ;NORMAL WRITE MODE + HRRM Q,QSRAC(A) + CLEARM QMPTC(A) ;TRACK COUNT FOR TAKE N + SETOM QMTTR(A) ;NO TRACK RESERVED + SETOM QMFTP(A) ;GET NEW DECADE RESERVATION + CONO PI,UTCON + MOVE TT,QDIRP(A) ;SEE IF GARBAGE COLLECTION NEEDED + PUSH P,R + PUSH P,I + PUSHJ P,QMPDC1 ;CONV CHAR ADR TO BYTE PNTR (AND LDB IN R) + POP P,I + SKIPE R + BUG + MOVE R,QDIRP(A) + ADDI R,NXLBYT+2 + CAMGE R,@QSNLCN(H) + JRST QLWO1 ;DON'T NEED TO EXPAND F.S. + MOVEI R,LUNBLK(TT) + MOVE Q,QSNLCN(H) + SUBI R,(Q) + CAML R,UDNAMP(Q) + JRST QSBWG7 ;DON'T HAVE ROOM. GC + MOVEI R,3*6 ;HAVE ROOM + ADDM R,(Q) +QLWO1: +REPEAT NXLBYT+2,[ + ILDB R,TT + JUMPN R,QSBWG7 +] + JRST QSBWG8 ;OK + +QSBWG7: MOVSI R,%QAFUL ;NO ROOM, GC BEFORE COMMITTING NEXT TRACK + IORM R,QSRAC(A) +QSBWG8: POP P,R + JRST QUDULK + +QSBGB2: ANDCAM Q,QSRAC(A) ;DISK READ ERROR + JRST IOCER3 ;TELL USER + +;DISK OUTPUT GET-BUFFER ROUTINE. PRESERVES D FOR BENEFIT OF PDUMP. +QSBWG: MOVE Q,QSRAC(A) + TLNE Q,%QALNK+%QAACC ;DON'T WRITE TO LINK, DON'T LET PDUMP GET + JRST IOCR10 ; FAKED OUT BY USE FORCE OR ACCESS + PUSH P,A + TLNE Q,%QAMWO + JRST QWOG1 ;JUMP IF WRITE OVER MODE + HRRZ Q,QBFP(A) ;NORMAL MODE + JUMPE Q,QSBWG1 ;CAN ALWAYS HAVE ONE BUFFER + MOVE Q,QWBUFS + CAML Q,QWBFMX + JRST POPAJ ;TOO MANY WRITE BUFFERS QUEUED +QSBWG1: PUSHJ P,QSTWG + PUSHJ P,TCALL + JRST IOMQ + JRST QSBWG5 ;MEM FROZE OR NOT AVAILABLE + MOVE Q,(P) ;DISK CHNL # + DPB Q,[MNUMB,,MEMBLT(A)] + MOVEI Q,MU23B + DPB Q,[MUR,,MEMBLT(A)] + MOVE Q,A + POP P,A + AOS QSBFS(A) + AOS QWBUFS + HRRZ J,QSBYTE(A) + IMULI J,2000 + MOVEM J,QMPBSZ(A) ;FRESH BLOCK SIZE + JRST QSBWG4 + +QSTWG: MOVSI Q,%QAFUL + TDNE Q,QSRAC(A) ;ROUTINE TO COMMIT A TRACK + JRST QSTWG1 ;DIR FULL, NEED GC BEFORE GROWING FILE + MOVE H,QUDPR(A) ;IF THIS DIRECTORY HAS AN ALLOCATION + MOVE Q,QSNLCN(H) ; ENFORCE IT +IFN QRSRVP,[ + HRRZ J,UDALLO(Q) + JUMPE J,QSTWG0 ;NO ALLOCATION + HRRZ H,UDBLKS(Q) ;GET BLOCKS USED + CAML H,J + JRST IOCR13 ;HAS ALLOCATION AND USER IS TRYING TO EXCEED IT +] +QSTWG0: MOVE J,QDSKN(A) + SOSL QSFT(J) ;RESERVE A TRACK + POPJ P, + AOS QSFT(J) ;DISK FULL, GIVE BACK THE TRACK + SKIPE QFBTS ;WAIT FOR ANY PENDING FILE DELETIONS + PUSHJ P,UFLS ; TO COMPLETE AND FREE THEIR BLOCKS + SOSL QSFT(J) ;GOT SPACE NOW? + POPJ P, + AOS QSFT(J) ;NO, GIVE UP AND ERR OUT + JRST IOCER9 + +QSTWG1: MOVE H,QUDPR(A) + PUSHJ P,QUDLK + PUSHJ P,QGC + JRST IOCR12 ;DIR FULL + PUSHJ P,QUDULK + ANDCAM Q,QSRAC(A) .SEE %QAFUL + JRST QSTWG + +QSBWG5: POP P,A ;GET BACK QSK CHANNEL # + MOVE J,QDSKN(A) + AOS QSFT(J) ;NO MEMORY; GIVE EVERYTHING BACK + POPJ P, + +;DISK OUTPUT RELEASE-BUFFER ROUTINE FOR BLKT, SIOKT, CHRKT. +QSBWW: SKIPGE QSMDN(A) ;WRITE BUFFER FROM MN PROG TO CHAIN FOR PI + POPJ P, ;NO WRITE BUFFER ACTIVE + LDB TT,[$QAMOD,,QSRAC(A)] + SOJE TT,QSBWO1 ;WRITE OVER MODE + SKIPL D,QMTTR(A) + JRST QTG1 ;TRACK ALREADY RESERVED + PUSH P,I + MOVE I,QDSKN(A) + PUSHJ P,QGTRK ;GET A TRACK + POP P,I + MOVEM D,QMTTR(A) +QTG1: MOVE H,QUDPR(A) ;TRACK IN D + PUSHJ P,QUDLK + MOVE TT,QSNLCN(H) + AOS UDBLKS(TT) + MOVE TT,QMPTN(A) ;GET PREVIOUS TRACK# + CAIN D,1(TT) + JRST QTG2 ;THIS TRACK IS CONSECUTIVE + SKIPN QMPTC(A) ;THIS TRACK NOT CONSEC CHECK COUNT OF PREV CONSEC BLOCKS + JRST QTG3 + PUSH P,D ;NON-ZERO SO STORE IN USER DIRECTORY + MOVE D,QMPTC(A) + CLEARM QMPTC(A) + PUSHJ P,QUDS + POP P,D +QTG3: MOVE J,QMTTR(A) ;DESCRIPTOR WILL BE STORED + MOVEM J,QMPTN(A) + SUB D,QMPTN(A) ;CAN TRACK BE SKIPPED TO? + SOJL D,QTG4 ;CAN'T BE SKIPPED TO (NOTE QMPTN HAS NOT BEEN AOS'D) + CAILE D,UDWPH-UDTKMX-1 + JRST QTG4 ;ALSO NO + ADDI D,UDTKMX ;NEXT BLOCK WITHIN N + PUSHJ P,QUDS ;STORE APPROPRIATE SKIP +QTG5A: +QTG5: MOVE Q,QSMDN(A) ;CORE BLOCK NUM BEING WRITTEN + MOVE D,QMPTN(A) ;TRACK NUM OF BLOCK ADDING TO FILE + HRLZM D,MEMPNT(Q) ;STORE TRACK NUM + SETOM QMTTR(A) ;INDICATE TRACK USED + MOVE J,QMPBSZ(A) ;LENGTH OF THIS BLOCK + ADDM J,QFBLNO(A) ;INCR BYTE ADR OF START OF CURRENT BLOCK IN FILE + HRRM J,MEMPNT(Q) ;SAVE BYTE COUNT + PUSH P,R + IDIVI J,@QSBYTE(A) ;CONVERT TO WORD COUNT + JUMPE R,QTG7 ;EXACT MULTIPLE OF WORD + AOS J + MOVNS R + ADDI R,@QSBYTE(A) ;# BYTES RESIDUE IN LAST WORD +QTG7: DPB J,[MWC,,MEMBLT(Q)] ;STORE ACTIVE WORD COUNT + MOVE D,QSRAC(A) + LDB TT,[$QAMOD,,QSRAC(A)] + TLNN D,%QALBK ;LAST BLOCK OF WRITE OVER POSSIBLY + SOJE TT,QTG6 ;WRITEOVER MODE AND NOT LAST BLOCK, DONT UPDATE LAST BLOCK WORD COUNT + MOVE H,QUDPR(A) ;SET UP DIRECTORY CHANNEL + MOVE D,QUDFPR(A) + ADD D,QSNLCN(H) + DPB J,[UNWRDC+UNRNDM(D)] ;SET WORD COUNT OF LAST BLOCK + LDB Q,[QSBSIZ(A)] + PUSHJ P,QBENC ;ENCODE BYTE CRUFT + DPB Q,[UNBYTE+UNREF(D)] + MOVE J,QACTB + IORM J,QSNLCN(H) +QTG6: POP P,R + PUSHJ P,QUDULK + MOVE Q,QSMDN(A) + MOVEI J,.BM MLO + ANDCAM J,MEMBLT(Q) ;SET END OF LIST INDICATOR IN MEMORY BLOCK + CONO PI,UTCOFF + HLRZ J,QBFP(A) ;STORE MEMORY BLOCK IN OUTPUT LIST + JUMPE J,QSBWW1 + DPB Q,[MLO,,MEMBLT(J)] +QSBWW2: HRLM Q,QBFP(A) + CONO PI,UTCON + SETOM QSMDN(A) ;MN PROG BUFFER NOW WRITTEN + JRST QSTRTR ;START ACTION IF 2311 IDLE AND RETURN + +QSBWO1: MOVE Q,QSRAC(A) ;PUT BUFFER IN WRITE-OVER MODE + TLNE Q,%QALBK ;IF NOT HACKING LAST BLOCK + TLNE Q,%QAEFW ;OR HACKING CLOSE + JRST QSBWO2 ;THEN JUST WRITE IT + HRRZ D,QSBYTE(A) + IMULI D,2000 + SUB D,QMPBSZ(A) + JUMPE D,QSBWO2 ;BLOCK REALLY FULL + TLNE Q,%QAMPU ;DID WE IOCER2 AT QSBWG4? + JRST IOCER2 ;YES, QSMPRP NOT SET UP, DON'T WRITE ANYTHING + MOVEM D,QSMPRC(A) ;LAST BLOCK NOT REALLY USED UP ("SPRUNG BACK TO LIFE") + ADDM D,QMPBSZ(A) ;EXTRA ROOM IN LAST BLOCK TO FILL UP + MOVSI D,%QAWOV + IORM D,QSRAC(A) ;FILLING LAST BLK PAST ORIG EOF + POPJ P, ;FINISH OUT BLOCK + +QSBWO2: MOVSI D,%QAWOV + ANDCAM D,QSRAC(A) + MOVE D,QSLGL(A) ;WRITE TRACK BACK WHERE IT CAME FROM + MOVEM D,QMPTN(A) ;PUT TRACK NO WHERE QTG5 CAN FIND IT + MOVE H,QUDPR(A) + PUSHJ P,QUDLK + SETOM QSCRW(A) ;SWITCH TO WRITE MODE + MOVEI Q,%QMWOV + HRRM Q,QSRAC(A) + JRST QTG5 + + +QTG4: LDB D,[140500,,QMTTR(A)] ;WRITE LOAD ADDRESS + IORI D,40 + PUSHJ P,QUDS + LDB D,[060600,,QMTTR(A)] + PUSHJ P,QUDS + LDB D,[0600,,QMTTR(A)] + PUSHJ P,QUDS + JRST QTG5A + +QGTRK: PUSHJ P,QTLOCK ;GET TRK CHNL IN A DSK IN I RET IN D CLOBBERS E,TT,Q,J,B +QGTK4: PUSH P,R ;ENTER HERE FROM SWAP OUT WITH UTCOFF + PUSH P,B + PUSH P,E + HRRZ R,QTUTO(I) +QGTK4A: SKIPGE Q,QMFTP(A) + JRST QGTK3A ;FIRST TRACK + IDIVI Q,DECADE + HRREI J,-DECADE(J) ;COMPUTE TRACKS REMAINING IN DECADE + MOVE D,QMFTP(A) + PUSHJ P,TUTPNT + ADD D,[TUTBYT_14,,] ;MAKE INTO ILDB-TYPE POINTER + MOVE TT,QMFTP(A) + EXCH D,TT +QGTK3: CAML D,QLASTB(R) + JRST QGTK3A ;REACHED END OF DISK + ILDB Q,TT + JUMPE Q,QGTK2 + AOJGE J,QGTK3A ;DECADE OUT + AOJA D,QGTK3 + +QGTK3A: CAILE A,NQCHN + JRST QGTK3C ;SWAP CHANNEL +QGTK3D: MOVEI Q,DECADE + ADDB Q,QTUTP(R) +QGTK3B: MOVEM Q,QMFTP(A) + CAMGE Q,QLASTB(R) + JRST QGTK4A + MOVE Q,QSWAPA(R) ;REACHED END OF DSK, RESET TO END OF SWAPPING AREA + ADDI Q,DECADE-1 ;ROUND UP TO A MULTIPLE OF A DECADE + IDIVI Q,DECADE + IMULI Q,DECADE + MOVEM Q,QTUTP(R) + JRST QGTK3B + +QGTK2: MOVEI B,1 + DPB B,TT + MOVEM D,QMFTP(A) + MOVE J,DCHBT(I) + IORM J,QTUTO(I) + POP P,E + POP P,B + POP P,R + CAILE A,NQCHN + POPJ P, ;CALLED FROM SWAP OUT + JRST QTULK + +QGTK3C: CAML D,QSWAPA(R) + JRST QGTK3D ;IN NON-SWAP AREA + AOS D + CAMN D,QSWAPA(R) + MOVEI D,NUDSL + MOVEM D,QMFTP(A) + JRST QGTK4A + ;STORE CHR IN D CHNL IN A USER DIR PNTR IN H +;CANNOT PCLSR NOR GC + +QUDS: PUSH P,I + PUSH P,Q + MOVE I,QDIRP(A) + CAIGE I,2000*UFDBPW + CAML I,@QSNLCN(H) ;UDESCP + BUG ;WRITING ABOVE F.S. PNTR? + AOS QDIRP(A) + IDIVI I,UFDBPW + MOVE Q,QBTBL(Q) + ADD Q,I + SKIPL I,QSNLCN(H) + BUG ;UFD WAS NOT LOCKED + ADDI Q,UDDESC(I) + LDB I,Q + CAIE I,UDWPH ;OK TO CLOBBER UDWPH (NORMALLY DOES AT START OF FILE) + JUMPN I,[JRST 4,.] ;ABOUT TO CLOBBER SOMETHING IN UFD + DPB D,Q + ILDB I,Q ;MAKE SURE FILE DESC WILL ALWAYS BE FOLLOWED BY ZERO + SKIPE I + BUG +REPEAT NXLBYT+2,[ ;MAKE SURE THERE'S ROOM FOR ONE MORE TRACK + ILDB I,Q + JUMPN I,QUDS1 +] + MOVE I,QDIRP(A) + ADDI I,NXLBYT+2 + CAMGE I,@QSNLCN(H) ;UDESCP + JRST QUDSX ;DESC AREA NOT COLLIDING WITH LIM OF DESC SPACE + MOVEI Q,LUNBLK(Q) + MOVE I,QSNLCN(H) + SUBI Q,(I) + CAML Q,UDNAMP(I) + JRST QUDS1 ;NO ROOM. + MOVEI Q,3*UFDBPW ;EXPAND DESC AREA + ADDM Q,UDESCP(I) + JRST QUDSX + +QUDS1: MOVSI Q,%QAFUL ;NEED GC BEFORE STARTING ON NEXT TRACK + IORM Q,QSRAC(A) +QUDSX: MOVE Q,QACTB + IORM Q,QSNLCN(H) ;SET DIRECTORY CHANGED + POP P,Q + POP P,I + POPJ P, + +QSBWW1: HRRM Q,QBFP(A) + JRST QSBWW2 + +QSBRB1: MOVE A,D +QSBRB: PUSH P,A + SKIPGE A,QSMDN(A) + JRST POPAJ + PUSHJ P,MEMR + POP P,A + HRRZ TT,QMPBSZ(A) + ADDM TT,QFBLNO(A) ;INCREMENT BYTE ADR IN FILE OF BEG OF NEXT BLOCK + SETOM QSMDN(A) + JRST QSTRTR + +QTG2: MOVE J,QMTTR(A) ;INDICATE WE WILL STORE DESCRIPTOR FOR NEXT TRACK. + MOVEM J,QMPTN(A) + AOS D,QMPTC(A) ;NEXT BLOCK IS CONSECUTIVE + CAIGE D,UDTKMX + JRST QTG5A + SETZM QMPTC(A) ;MAX # CONSECUTIVE BLOCKS, STORE DESC NOW + PUSHJ P,QUDS + JRST QTG5A + +SUBTTL DIRHNG DEVICE + +;WHENEVER THE DIRECTORY SPECIFIED AS THE SNAME WHEN DIRHNG IS OPENED +;IS MODIFIED, YOU GET AN INTERRUPT ON THE DIRHNG DEVICE CHANNEL. + +;HERE TO OPEN THE DIRHNG DEVICE. IOCHNM ADDR IN R, SNAME IN USYSN1(U). +DIRHO: MOVE C,USYSN1(U) + PUSHJ P,QFL ;LOOK UP THIS DIRECTORY + JRST OPNL20 ;CALL FAILS IF DIRECTORY DOES NOT EXIST. + HRRZM J,IOCHST-IOCHNM(R) ;DIR EXISTS; STORE TRACK NUMBER IN IOCHST. +DIRHP1: CONO PI,CLKOFF + HLLZ A,DIRHNG ;ADD THIS CHANNEL'S IOCHNM TO THE LIST OF DIRHNG CHANNELS. + HRRI A,DNDIRH + MOVEM A,(R) ;SET UP THE IOCHNM WITH IOTTB INDEX AND LIST CHAIN. + HRLZM R,DIRHNG + JRST CLKOJ1 + +;CLOSE A DIRHNG DEVICE CHANNEL. +DIRHCL: PUSHJ P,DIRHPS ;REMOVE IT FROM THE LIST, AND + SETZM (R) ;MARK IT CLOSED. + POPJ P, + +;IOPUSH A DIRHNG DEVICE CHANNEL. REMOVE IT FROM THE LIST OF ALL SUCH. +DIRHPS: MOVEI A,DIRHNG + CONO PI,CLKOFF +;FIND THE PLACE THAT POINTS AT THIS IOCHNM WORD. +DIRHC1: HLRZ B,(A) + CAIN B,(R) + JRST DIRHC2 + SKIPN A,B ;END OF LIST REACHED => + BUG ;THIS IOCHNM ISN'T IN THE LIST. BUT IT IS SUPPOSED TO BE! + JRST DIRHC1 + +;A POINTS AT IOCHNM THAT POINTS AT THIS ONE. PATCH THIS ONE OUT OF LIST. +DIRHC2: HLRZ B,(B) ;THE ONE AFTER THIS ONE + HRLM B,(A) + JRST CLKONJ + +;IOPUSH OR IOPOP THE DIRHNG CHANNEL WITH R -> IOCHNM WORD. I SAYS WHICH OPERATION. +DIRHIP: JUMPE I,DIRHPS ;IOPUSH REMOVES CHANNEL FROM LIST OF ALL DIRHNG CHANNELS. + +;IOPOP A DIRHNG DEVICE CHANNEL. JUST LIKE OPENING IT EXCEPT THAT +;THE DIRECTORY TRACK NUMBER IS ALREADY IN THE IOCHST. +;ALSO, WE SHOULD GIVE AN INTERRUPT NOW, +;IN CASE THE DIRECTORY WAS WRITTEN IN WHILE THE CHANNEL WAS PUSHED. +DIRHPP: PUSHJ P,DIRHP1 ;FIRST, REOPEN THE CHANNEL. LINK IT INTO THE DIRHNG LIST. + BUG + MOVE A,R + SUBI A,IOCHNM(U) ;COMPUTE CHANNEL NUMBER FROM IOCHNM WORD ADDRESS. + MOVE A,CHNBIT(A) ;GET BIT CORRESPONDING TO CHANNEL. + AND A,MSKST2(U) ;GIVE THE INT IF THE INT IS ENABLED. + IORM A,IFPIR(U) + POPJ P, + +;HERE WITH A/ DIRECTORY'S TRACK NUMBER (AS RETURNED BY QFL) +;TO SIGNAL A WRITE IN THAT DIRECTORY TO ALL DIRHNG DEVICES THAT ARE LOOKING. +;CLOBBERS B, C, D. +DIRSIG: CONO PI,CLKOFF + MOVEI B,DIRHNG +DIRSI0: HLRZ B,(B) ;GET IOCHNM ADDR OF NEXT DIRHNG DEVICE. + JUMPE B,CLKONJ + HRRZ C,IOCHST-IOCHNM(B) + CAIE C,(A) ;DOES IT LOOK AT THIS DIRECTORY? + JRST DIRSI0 + MOVEI C,-IOCHNM(B) ;YES => FIGURE OUT USER INDEX OF JOB IT BELONGS TO. + IDIVI C,LUBLK + IMULI C,LUBLK ;C NOW HAS USER INDEX. + MOVNI D,IOCHNM(C) + ADD D,B ;D GETS CHANNEL NUMBER + MOVE D,CHNBIT(D) + AND D,MSKST2(C) ;INTERRUPT THE USER ON THAT CHANNEL, IF IT'S ENABLED. + IORM D,IFPIR(C) + JRST DIRSI0 diff --git a/system/dmpcpy.11 b/system/dmpcpy.11 new file mode 100644 index 0000000..1572c15 --- /dev/null +++ b/system/dmpcpy.11 @@ -0,0 +1,169 @@ +; -*- MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + + TITLE DMPCPY - COPY DUMPS FROM SWAP AREA TO FILE AREA + +A=1 +B=2 +C=3 +D=4 +E=5 +T=6 +TT=7 +P=17 + +CHDIRI=10 +CHDSKI=11 +CHDSKO=12 + +.INSRT SYSENG;FSDEFS > + +PDL: -20,,. + BLOCK 20 + +;DIRECTORIES WHERE STUFF MIGHT GET DUMPED OUT OF TIMESHARING +DIRLST: SIXBIT/./ + SIXBIT/CRASH/ + SIXBIT/CRASH2/ +NDIRS==.-DIRLST + +DIR: BLOCK 2000 +BUF: BLOCK 2000 + +USRVAR: SIXBIT /OPTION/ ? TLO %OPINT\%OPOPC + SIXBIT /MASK/ ? MOVE [%PIIOC\%PIPDL] +LUSRVAR==:.-USRVAR + +GO: .CLOSE 1, ;RUNS AS DAEMON + MOVE P,PDL + MOVE TT,[-LUSRVAR,,USRVAR] + .CALL [ SETZ ? SIXBIT /USRVAR/ + MOVEI %JSELF + SETZ TT ] + .LOSE %LSSYS +CHKTIM: .CALL [ SETZ ? SIXBIT /RQDATE/ ; don't frob with files + SETZM A ] ; if system doesn't know the time + .LOSE %LSSYS + AOJN A,KNOTIM + MOVEI A,30.*15. ; 15 seconds + .SLEEP A, + JRST CHKTIM + +KNOTIM: MOVSI E,-NDIRS +CHKDIR: .CALL [ SETZ ? SIXBIT/OPEN/ + [.BII,,CHDIRI] + [SIXBIT/DSK/] + [SIXBIT/.FILE./] + [SIXBIT/(DIR)/] + SETZ DIRLST(E)] + JRST NXTDIR ; Hey, there might not -be- such a directory! + MOVE TT,[-2000,,DIR] + .IOT CHDIRI,TT + .CLOSE CHDIRI, + MOVE D,UDNAMP+DIR +CHKFIL: CAIL D,2000 + JRST NXTDIR + MOVE TT,UNRNDM+DIR(D) + SKIPGE UNDATE+DIR(D) + TLNE TT,UNDUMP\UNIGFL\UNREAP\UNLINK ; Don't screw with files + JRST NXTFIL ; you don't understand. + ;HERE WE HAVE FOUND A FILE WRITTEN OUT OF TIMESHARING + ;COPY IT SO AS TO (1) SET THE FILE DATE AND (2) GET IT OUT + ; OF THE SWAPPING AREA. NTS FILES ARE WRITTEN IN THE SWAPPING + ; AREA TO DECREASE THE PROBABILITY OF CLOBBERING SOME OTHER FILE. + .CALL [ SETZ ? SIXBIT/OPEN/ + MOVES TT + [.BII,,CHDSKI] + [SIXBIT/DSK/] + UNFN1+DIR(D) + UNFN2+DIR(D) + SETZ DIRLST(E) ] + JSP T,[ CAIE TT,%ENSFL ; perhaps a hacker deleted it + CAIN TT,%ENAPK ; perhaps that pack had to go offline + JRST NXTFIL + JRST LOSE ] + .CALL [ SETZ ? SIXBIT/OPEN/ + MOVES TT + [.BIO,,CHDSKO] + [SIXBIT/DSK/] + [SIXBIT/_DMPCP/] + [SIXBIT/OUTPUT/] + SETZ DIRLST(E) ] + JSP T,[ CAIE TT,%EFLDR + JRST LOSE + MOVEI TT,30.*60.*5 ; 5 minutes + .SLEEP TT, + JRST .-1 ] +CPYFIL: MOVE TT,[-2000,,BUF] + .IOT CHDSKI,TT + MOVEI T,-BUF(TT) + JUMPE T,ENDFIL + MOVNS T + MOVSS T + HRRI T,BUF + .IOT CHDSKO,T + JRST CPYFIL + +ENDFIL: .CLOSE CHDSKI, + .CALL [ SETZ ? 'RENMWO + MOVEI CHDSKO + UNFN1+DIR(D) + SETZ UNFN2+DIR(D) ] + .LOSE %LSSYS + .CLOSE CHDSKO, +NXTFIL: ADDI D,LUNBLK + JRST CHKFIL + +NXTDIR: AOBJN E,CHKDIR + .LOGOUT 1, + .VALUE + +; JSP T,LOSE is like .LOSE %LSFIL(TT) +LOSE: .CALL [ SETZ ? SIXBIT /LOSE/ + MOVEI %LSFIL(TT) + SETZI -2(T) ] + .LOSE %LSSYS + +TSINT: +LOC 42 + -LTSINT,,TSINT +LOC TSINT + P + %PIIOC ? 0 ? %PIIOC ? 0 ? IOCINT +LTSINT==:.-TSINT + +; If there is a disk or directory full problem, wait for someone to notice. +IOCINT: PUSH P,T + .SUSET [.RBCHN,,T] + CAIE T,CHDSKO + .LOSE + .STATUS CHDSKO,T + LDB T,[330500,,T] + CAIE T,11 ; DEVICE FULL + CAIN T,14 ; DIRECTORY FULL + JRST WAIT + .VALUE + +WAIT: MOVEI T,30.*60.*5 ; 5 minutes + .SLEEP T, + POP P,T + .CALL [ SETZ ? SIXBIT /DISMIS/ + SETZ P ] + .LOSE %LSSYS + +END GO diff --git a/system/dmpcpy.8 b/system/dmpcpy.8 new file mode 100644 index 0000000..056fab6 --- /dev/null +++ b/system/dmpcpy.8 @@ -0,0 +1,127 @@ +; -*- MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + + TITLE DMPCPY - COPY DUMPS FROM SWAP AREA TO FILE AREA + +A=1 +B=2 +C=3 +D=4 +E=5 +T=6 +TT=7 +P=17 + +CHDIRI=10 +CHDSKI=11 +CHDSKO=12 + +.INSRT SYSENG;FSDEFS > + +PDL: -20,,. + BLOCK 20 + +;DIRECTORIES WHERE STUFF MIGHT GET DUMPED OUT OF TIMESHARING +DIRLST: SIXBIT/./ + SIXBIT/CRASH/ + SIXBIT/CRASH2/ +NDIRS==.-DIRLST + +DIR: BLOCK 2000 +BUF: BLOCK 2000 + +GO: .CLOSE 1, ;RUNS AS DAEMON + MOVE P,PDL +CHKTIM: .CALL [ SETZ ? SIXBIT /RQDATE/ ; don't frob with files + SETZM A ] ; if system doesn't know the time + .LOSE %LSSYS + AOJN A,KNOTIM + MOVEI A,30.*15. ; 15 seconds + .SLEEP A, + JRST CHKTIM + +KNOTIM: MOVSI E,-NDIRS +CHKDIR: .CALL [ SETZ ? SIXBIT/OPEN/ + [.BII,,CHDIRI] + [SIXBIT/DSK/] + [SIXBIT/.FILE./] + [SIXBIT/(DIR)/] + SETZ DIRLST(E)] + JRST NXTDIR ; Hey, there might not -be- such a directory! + MOVE TT,[-2000,,DIR] + .IOT CHDIRI,TT + .CLOSE CHDIRI, + MOVE D,UDNAMP+DIR +CHKFIL: CAIL D,2000 + JRST NXTDIR + MOVE TT,UNRNDM+DIR(D) + SKIPGE UNDATE+DIR(D) + TLNE TT,UNDUMP\UNIGFL\UNREAP\UNLINK ; Don't screw with files + JRST NXTFIL ; you don't understand. + ;HERE WE HAVE FOUND A FILE WRITTEN OUT OF TIMESHARING + ;COPY IT SO AS TO (1) SET THE FILE DATE AND (2) GET IT OUT + ; OF THE SWAPPING AREA. NTS FILES ARE WRITTEN IN THE SWAPPING + ; AREA TO DECREASE THE PROBABILITY OF CLOBBERING SOME OTHER FILE. + .CALL [ SETZ ? SIXBIT/OPEN/ + MOVES TT + [.BII,,CHDSKI] + [SIXBIT/DSK/] + UNFN1+DIR(D) + UNFN2+DIR(D) + SETZ DIRLST(E) ] + JSP T,[ CAIN TT,%ENAPK + JRST NXTFIL + JRST LOSE ] + .CALL [ SETZ ? SIXBIT/OPEN/ + [.BIO,,CHDSKO] + [SIXBIT/DSK/] + [SIXBIT/_DMPCP/] + [SIXBIT/OUTPUT/] + SETZ DIRLST(E) ] + .LOSE %LSFIL +CPYFIL: MOVE TT,[-2000,,BUF] + .IOT CHDSKI,TT + MOVEI T,-BUF(TT) + JUMPE T,ENDFIL + MOVNS T + MOVSS T + HRRI T,BUF + .IOT CHDSKO,T + JRST CPYFIL + +ENDFIL: .CLOSE CHDSKI, + .CALL [ SETZ ? 'RENMWO + MOVEI CHDSKO + UNFN1+DIR(D) + SETZ UNFN2+DIR(D) ] + .LOSE %LSSYS + .CLOSE CHDSKO, +NXTFIL: ADDI D,LUNBLK + JRST CHKFIL + +NXTDIR: AOBJN E,CHKDIR + .LOGOUT 1, + .VALUE + +; JSP T,LOSE is like .LOSE %LSFIL(TT) +LOSE: .CALL [ SETZ ? SIXBIT /LOSE/ + MOVEI %LSFIL(TT) + SETZI -2(T) ] + .LOSE %LSSYS + +END GO diff --git a/system/dskdmp.212 b/system/dskdmp.212 new file mode 100644 index 0000000..ceaf045 --- /dev/null +++ b/system/dskdmp.212 @@ -0,0 +1,1870 @@ +;;; -*-Midas-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +TITLE DSKDMP + +.MLLIT==1 + +DEFINE SETF TEXT,FLG +IFDEF FLG,.STOP +.TAG FOOBAR +PRINTC "TEXT +FLG=" +.TTYMAC FLAG +.TTYFLG==.TTYFLG+1 +PRINTX/FLAG +/ +.TTYFLG==.TTYFLG-1 +IFSE FLAG,YES,FLG==1 +IFSE FLAG,NO,FLG==0 +IFSE FLAG,Y,FLG==1 +IFSE FLAG,N,FLG==0 +IFNDEF FLG,FLG==FLAG +TERMIN +IFNDEF FLG,.GO FOOBAR +TERMIN + +IF1,[ +PRINTC "Configuration (KSRP06, KSRM03, or ASK) ? " +.TTYMAC MACH +IFSE MACH,KSRP06,[ + HRIFLG==0 + RP06P==1 + KS10P==1 + NUDSL==500. +] ;KSRP06 +IFSE MACH,KSRM03,[ + HRIFLG==0 + RP06P==0 + RM03P==1 + KS10P==1 + NUDSL==500. +] ;KSRM03 +IFSN MACH,ASK,[ +IFNDEF NUDSL,[ PRINTC /No known configuration for "MACH". +/ ]] +TERMIN +] ;IF1 + +SETF [Readin Mode Paper Tape?]HRIFLG +SETF [Assemble BOOT? (If no, full DSKDMP)]BOOTSW + +SETF [RH11/RP06 disk system?]RP06P +IFE RP06P,[ +SETF [RH11/RM03 disk system?]RM03P +IFE RM03P,[ +SETF [RH10 (MC-KL) disk control?]RH10P +IFE RH10P,[ +SETF [AIKA disk control? (no => RP02/RP03)]DC10P +]]] +IFN RP06P, RM03P==0 +IFN RP06P+RM03P, RH10P==0 +IFN RP06P+RM03P+RH10P, DC10P==0 +IFN RP06P+RM03P+RH10P+DC10P, RP10P==0 +IFE RP06P+RM03P+RH10P+DC10P, RP10P==1 + +IFE BOOTSW, SETF [Number of dirs? (DM-KA: 200., ML-KA: 250., AI-KA: 440., all others: 500.)]NUDSL + +SETF [KS10 processor?]KS10P +IFE KS10P, SETF [KL10 processor? (no => KA10)]KL10P +IFN KS10P, KL10P==0 +IFN KS10P+KL10P, KA10P==0 +IFE KS10P+KL10P, KA10P==1 + +DEFINE RP +IFN RP10P!TERMIN +DEFINE SC +IFN DC10P!TERMIN +DEFINE RH +IFN RH10P!TERMIN +DEFINE PH +IFN RP06P+RM03P!TERMIN + +DEFINE KA +IFN KA10P!TERMIN +DEFINE KL +IFN KL10P!TERMIN +DEFINE KS +IFN KS10P!TERMIN + +IFN HRIFLG,[ +NOSYMS ;MAKE PAPER TAPE SHORTER +RIM10 +] + +C=1 ;C-A-B FOR LINKS +A=2 +B=3 +D=4 +BLKIN=5 ;PSEUDO-CORE BLOCK IN CBUF +WRITE=6 ;NEG MEANS DUMP, RH 0 OR WRBIT +DIFF=7 ;DIFF CONO ALSO TEMP +HEAD=10 ;HEAD CONO ALSO TEMP +P=11 ;JSP AC +BLOK=12 +UNIT=13 ;UNIT AND M.A. DATAO +CMD=14 ;COMMAND CHAR +T=15 ;VERY TEMP +TT=16 ;ANOTHER JSP AC, ALSO VERY TEMP +BUFP=17 ;DBUF PNTR--LAST WORD USED + +IF1,[ ;DON'T TAKE A WEEK AND A HALF TO ASSEMBLE. +RP, .INSRT SYSTEM;RP10 > +SC, .INSRT SYSTEM;DC10 > +RH, .INSRT SYSTEM;RH10 > +IFN RP06P, .INSRT SYSTEM;RH11 > +IFN RM03P, .INSRT SYSTEM;RM03 > +IFE BOOTSW, .INSRT SYSTEM;FSDEFS > +IFE BOOTSW, KL, .INSRT SYSTEM;EPT > +KS, .INSRT SYSTEM;KSDEFS > +KA, TTY==120 +] + +;PARAMETER FILE FOR DSKDMP + +MEMSIZ=1000000 ;ACTUAL SIZE OF MEM +IFNDEF DBGSW,DBGSW==0 ;1 TO DEBUG THIS WITH DDT +DDT==MEMSIZ-4000 +IFN DBGSW,MEMSIZ==MEMSIZ-10000 ;MOVE DOWN UNDER DDT IF DEBUG MODE +CORE==MEMSIZ-10000-<2000*NTUTBL> ;HIGHEST ADR ALWAYS IN CORE+1 +CORES==CORE_<-12> ;BLK # OF ABOVE (FIRST OF BLKS SWAPPED OUT FOR BUFFER AREAS) +NSWBL==4+NTUTBL ;# BLOCKS SWAPPED OUT FOR BUFFER AREAS, +1 FOR DSKDMP ITSELF +HIGH==MEMSIZ-100 ;HIGHEST ADR LOADED/DUMPED+1 + +NDSK==8 ;MAX POSSIBLE. L$n$ DEFINES WHICH ARE REALLY THERE +RP,ICWA=34 +RH,ICWA=34 + +PH, UBPG==:17 ; Use last (usable) page in Unibus map + +KA, LPM=102000,, +KA, LPMR=LPM 2, +KL, PAG=- + +DEFINE INFORM A,B +IF1,[ PRINTX  A = B +] TERMIN + +;COMMANDS ARE: +; L$file LOAD FILE INTO CORE +; T$file LOAD FILE INTO CORE AND GIVE SYMBOLS TO DDT AND START DDT +; M$file LOAD FILE INTO CORE WITHOUT CLEARING CORE FIRST, DOESN'T LOAD SYMBOLS +; K$file DELETE FILE +; D$file DUMP CORE INTO FILE +; I$file VERIFY FILE AGAINST CORE +; G$ START AT STARTING ADDRESS +; U$dir; LIST DIRECTORY +; F$ LIST CURRENT DIRECTORY +; S$ LIST PACK IDS THEN MFD +; nnn$ SET STARTING ADDRESS TO nnn +; L$n$ PUT DISK n ONLINE +; K$n$ TAKE DISK n OFFLINE + +;ERROR MESSAGES ARE: +; CMPERR VERIFY FAILED TO MATCH +; DIRFUL DIRECTORY FULL +; EOF UNEXPECTED EOF +; DIRNF DIRECTORY DOES NOT EXIST +; FNF FILE NOT FOUND +; PKNMTD FILE IS ON PACK THAT IS NOT MOUNTED +; CKSERR CHECKSUM ERROR +; DSKFUL DISK FULL +; NODDT CAN'T ADDRESS DDT SYMBOL TABLE (BUG) +; ?BUG? BUG +; SEEKFL DISK SEEK ERROR +; CLOBRD DISK READ ERROR +; CLOBWR DISK WRITE ERROR +; DIRCLB DIR NAME DIFFERS, TUT DISAGREES WITH DIR +; MFDCLB M.F.D. CLOBBERED +; DSKLUZ DISK LOSSAGE (OFFLINE OR UNSAFE OR MASSBUS ERROR) + +KS, LOC 4000 ; Avoid MTBOOT and KSRIM + +IFE BOOTSW,[ +ZZZ: IFE DBGSW,[ + MOVE T,.... ;THIS CODE BLTS THE FOLLOWING OFFSET CODE + BLT T,MEMSIZ-1-1 ;INTO HIGH MEMORY AND WRITES DSKDMP ON ITS + MOVE T,PROG+MEMSIZ-2-BEG+1 + MOVEM T,BEG+MEMSIZ-2-BEG+1 ;AVOID LOSING DUE TO -1 BLT LOSSAGE +] + MOVSI T,-NDSK+1 ;MAKE ALL BUT DISK 0 BE DEAD (MUST DO L$ TO MAKE THEM ALIVE) + SETOM QDED+1(T) + MOVNS QDED+1(T) + AOBJN T,.-2 + SETZM QDED+0 +RP,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 + DATAO DPC,SUNIT0 + DATAI DPC,B + TRNN B,RP03BT + JRST WBOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +WBOOT1: HLLZS BOOT0 + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DPC,ALLER +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +PH,[ MOVEI T,%HYCLR ; Clear controller + IOWRQ T,%HRCS2 ; (Selects drive 0) +WBOOT0: IORDQ T,%HRCS1 + TRNN T,%HXDVA + JRST WBOOT0 ; Await drive available (well, it is a dual + ; ported drive... perhaps someday?) + MOVEI UNIT,BEG + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ; FIRST BLOCK AFTER CORE BUFFER IS WHERE + ; DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + IORDQ TT,%HRCS1 + TRNE TT,%HXTRE+%HXMCP +IFN DBGSW, JRST DDT +IFE DBGSW, JRST 4,. ; Formerly JRST MEMSIZ-400 (??) + JRST BEG +];PH +RH,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 +WBOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST WBOOT0 ;AWAIT DRIVE AVAILABLE + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DSK,%HIERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +SC,[ MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + MOVEI BLOK,NBLKS+NSWBL + MOVEI WRITE,60 + JSP TT,WRD3 + MOVEI BLOK,NBLKS+NSWBL+1 + MOVEI WRITE,60 + JSP TT,WRD3 + DATAO DC0,..... + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG + +.....: DJMP .+1 + DWRITE + DCOPY ......(-LRIBLK_2&37774) + DHLT + +......: DWRITE+DUNENB+DADR ;FOR READIN + DCOPY BEG(-2000_2&37774) + DREAD+DADR1 + DCOPY BEG(-2000_2&37774) + DHLT +];SC + +IFE DBGSW,[ +....: PROG,,BEG + +KA, LOC 2000 ; MAKE OFFSET CONVENIENT +KL, LOC 2000 +KS, LOC 6000 ; Avoid MTBOOT and KSRIM +PROG: OFFSET CORE+<*2000>-. +]IFN DBGSW,LOC MEMSIZ-2000 + +BEG: +KA,[ CONO 635550 ;ENTER HERE, CLEAR WORLD + JRST .+1 + JFCL 1,[JRST 4,.] ;A PDP6?? + LPMR [0]-2 ;TURN OFF EXEC PAGING +] +KL,[ CONO 327740 ;CLEAR APR + CONSZ PAG,660000 ;PAGING AND CACHE BETTER BE OFF + JRST 4,. +] +KS,[ CONO 127760 ; Enable, and Clear all. + RDEBR B + TRNE B,60000 ; Paging and Tops-20 better be off. + JRST 4,. + SETZM 8SWIT0 ; Clear 8080 Communications area to prevent + MOVE B,[8SWIT0,,8SWIT0+1] ; mysterious IO behavior. + BLT B,8RHBAS-1 + ;; If the machine has just been powered on, there is likely to be + ;; bad parity all over the place. I guess that isn't our problem + ;; as long as we don't touch any of it... +] + MOVSI B,-NDSK ;FOR NUMBER OF DISKS + SETOM PKNUM(B) ;SET DISK TO UNKNOWN + AOBJN B,.-1 + MOVE T,[JRST LOADG1] ;SET BOOTSTRAP TO MIDDLE OF WORLD + MOVEM T,BOOT + MOVE D,['DSKDMP] ;ANNOUNCE SELF + JSP TT,PD + JRST READ ;CRLF AND BEGIN READING COMMANDS + +ERROR: 0 + CLEARM MEMSIZ-1 ;DON'T READ ANY MORE COMMANDS FROM MEMORY + SOS T,ERROR ;PICK UP ERROR CODE FROM THE AC FIELD OF + LDB T,[270400+T,,] ;THE JSR ERROR + MOVE D,ERMESS(T) + JSP TT,PD ;PRINT OUT APPROPRIATE COMMENT + CAIL T,EBUG + JRST READ ;BAD ERROR - NO MORE DISKING +LOADG1: +KA, DATAI TTY,C ;FLUSH RANDOM CHARACTER +KS, SETZM 8CTYIN ; ".RESET" + TRO CMD,10 ;MAKE SURE PSEUDO-CORE IN CORE + JRST LOADG ;BY SIMULATING END OF LOADING, NON-GOING COMMAND + +ERMESS: IRP XX,,[ECMP,EDIR,EEOF,ESNF,EFNF,EPNM,ECKS +EDSK,EDDT,EBUG,EC63,ECRD,ECWR,ECDR,EMFC,EDLZ]YY,,[CMPERR,DIRFUL +EOF,DIRNF,FNF,PKNMTD,CKSERR,DSKFUL,NODDT,?BUG?,SEEKFL +CLOBRD,CLOBWR,DIRCLB,MFDCLB,DSKLUZ] +XX==.-ERMESS + SIXBIT \YY\ +TERMIN + +PD: JSP P,CRLF ;TYPE A CR +PD2: MOVEI C,40 + JSP P,TYO ;AND A SPACE + MOVE B,[440600,,D] +PD1: ILDB C,B ;AND THE SIXBIT CONTENTS OF D + ADDI C,40 + JSP P,TYO + TLNE B,770000 + JRST PD1 + JRST (TT) + +PNO: +C12: IDIVI C,10. ;PRINT CONTENTS OF C AS A TWO-DIGIT + DPB C,[60600,,A] ;DECIMAL NUMBER PRECEDED + MOVEI D,(SIXBIT /#00/+A) ;BY # + MOVE B,[300600,,D] + JRST PD1 + +WRCB: MOVEI UNIT,CBUF ;WRITE OUT CONTENTS OF CBUF + LSH BLKIN,-12 ;ON APPROPRIATE BLOCK + HRRZ BLOK,CBLK + ADDI BLOK,-CORES(BLKIN) + JRST WRM + +LODUMP: MOVEI UNIT,CORE ;DEPENDING ON SIGN BIT OF WRITE, LOAD OR DUMP + HRRZ BLOK,CBLK ;PSEUDO-CORE (766000-775777) +LODMP1: JSP TT,WRDM + ADDI UNIT,2000 + CAIGE UNIT,BEG + AOJA BLOK,LODMP1 + MOVEI BLKIN,CORE + JRST (P) + +FD: HRRZ C,B ;SET UP POINTER IN C TO FETCH OR DEPOSIT + ;CONTENTS OF ADDRESS IN RIGHT HALF OF B +IFN DBGSW, SKIPGE WRITE ;LOAD DDT WHEN IN DEBUG MODE + CAIGE C,HIGH + CAIGE C,40 + JRST (P) + CAIGE C,CORE ;IF ADDR IS IN REAL CORE, RETURN IMMEDIATELY + JRST 1(P) +FDX: CAIL C,(BLKIN) ;ADDR IS IN PSEUDO-CORE--CHECK IF RIGHT + CAILE C,1777(BLKIN) ;BLOCK IS IN CBUF + JRST FD3 ;IT'S NOT THERE--READ IT IN +FD4: SUBI C,-CORE(BLKIN) ;IT'S THERE--SET UP RIGHT POINTER IN C + JRST 1(P) ;AND RETURN +FD3: JUMPLE WRITE,FD3A ;IF DUMP OR VERIFY DON'T BOTHER + ;TO WRITE OUT CURRENT BLOCK +FD3B: JSP TT,WRCB ;IF LOAD, WRITE CURRENT BLOCK FIRST +FD3A: MOVEI UNIT,CBUF + MOVE BLKIN,C + ANDI BLKIN,776000 + LDB BLOK,[121000,,BLKIN] + ADD BLOK,CBLK + MOVEI BLOK,-CORES(BLOK) + JSP TT,RDM ;READ IN CORRECT BLOCK + JRST FD4 ;SET UP POINTER AND RETURN + +GBP: IDIVI C,6 ;TURN USER DIRECTORY CHARACTER ADDR IN C + IMULI A,-60000 ;INTO A BYTE POINTER + HRLI C,440600(A) + ADDI C,DIR+UDDESC + JRST (TT) + +WD: AOBJN BUFP,WD1 ;READ, WRITE, OR VERIFY WORD IN D FROM, INTO, + JSP TT,NXTBLK ;OR AGAINST WORD IN DBUF + JSP TT,WRDB ;TIME TO REFILL OR EMPTY DBUF + MOVSI BUFP,-2000 ;RESET BUFFER POINTER +WD1: JUMPG WRITE,WD2 ;JUMP ON LOAD + JUMPL WRITE,WD3 ;JUMP ON WRITE + CAME D,DBUF(BUFP) ;HERE IF VERIFY + JSR ECMP,ERROR ;VERIFY COMPARE LOST + JRST (P) +WD2: SKIPA D,DBUF(BUFP) ;LOAD +WD3: MOVEM D,DBUF(BUFP) ;DUMP + JRST (P) + +NXTTUT: HRRZ B,CU ;SELECT NEXT UNIT AND READ ITS TUT + AOJ B, + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + CAIN B,@MU + JRST 1(TT) ;SKIP IF NO MORE + SKIPE QDED(B) + JRST NXTTUT ;UNIT NOT ON LINE +RDTUT: MOVEI BLOK,TUTBLK ;READ TUT OF CURRENT UNIT + MOVEI UNIT,TUT + SETOM PKNUM(B) ;ALWAYS READ HEADER FOR TUT +IFG NTUTBL-1,[ ;READ IN MULTI-BLOCK TUT + HRRM TT,RDTUTX ;SAVE RETURN ADDRESS +REPEAT NTUTBL-1,[ + JSP TT,RD + ADDI UNIT,2000 + AOS BLOK +] +RDTUTX: MOVEI TT,. +] + JRST RD + +NXTBW3: 0 + IBP DIRPT ;DO AN IDPB T,DIRPT CHECKING TO SEE IF + LDB DIFF,[1200,,DIRPT] ;RUNNING INTO NAME AREA + CAML DIFF,DIR+UDNAMP + JSR EDIR,ERROR + DPB T,DIRPT + JRST @NXTBW3 + +NXTBW: MOVE BLOK,LBLOCK ;FIND NEXT FREE BLOCK TO WRITE + MOVEI HEAD,1(BLOK) + ILDB T,TUTPT + JUMPN T,NXTBW1 ;JUMP IF VERY NEXT BLOCK NOT FREE + AOSG T,BLKCNT +NXTBW5: SOJA HEAD,NXTBW4 ;GENERATE LOAD ADR IF FIRST TIME (COMPENSATE FOR LBLOCK OFF BY 1) + CAIG T,UDTKMX-1 + JRST NXTBW2 ;NO NEED TO MODIFY DIRECTORY YET + CLEARM BLKCNT ;14 IN A ROW--RESET COUNTER AND +NXTBW6: JSR NXTBW3 ;DPB BYTE INTO DIRECTORY +NXTBW2: MOVE BLOK,HEAD + CAML BLOK,TUT+QLASTB + JSR EDSK,ERROR ;NO MORE DISK LEFT + MOVEI T,1 + DPB T,TUTPT ;MARK BLOCK USED IN TUT + JRST WRDB1 + +NXTBW1: ADDI HEAD,1 ;SEARCH FOR NEXT FREE BLOCK + ILDB T,TUTPT + JUMPN T,NXTBW1 + SUBM HEAD,BLOK + SKIPLE T,BLKCNT ;COME UP WITH DESC BYTE FOR LAST FEW BLOCKS + JSR NXTBW3 + CLEARM BLKCNT + JUMPL T,NXTBW5 ;FIRST TIME + MOVEI T,UDTKMX-1(BLOK) + CAIGE T,UDWPH ;CAN WE SAY SKIP N--TAKE 1? + JRST NXTBW6 ;YES +NXTBW4: MOVEI BLOK,NXLBYT + MOVE T,HEAD + ROT T,-NXLBYT*6 + ADDI T,UDWPH+1 + JSR NXTBW3 + ROT T,6 + SOJG BLOK,.-2 + JRST NXTBW6 + +NXTBLK: JUMPL WRITE,NXTBW ;GET NEXT BLOCK OF FILE--IF DUMP, FIND FREE + MOVE BLOK,LBLOCK ;BLOCK +NXTB6: SOSLE BLKCNT ;HAVE WE RUN OUT OF "TAKE N"? + AOJA BLOK,WRDB1 ;NO--TAKE NEXT BLOCK + ILDB T,DIRPT ;YES--GET NEXT DESC BYTE + CAILE T,UDWPH + JRST NXTB1 ;IT'S A LOAD ADDR + CAIE T,UDWPH + JUMPN T,NXTB2 ;IT'S A TAKE OR SKIP + CAIE CMD,'D ;IT'S 0 OR NULL--IF THIS IS A LOAD, IT'S AN + CAIN CMD,'K ;UNEXPECTED END OF FILE + JRST KILL1 ;IF DUMP OR KILL, O.K. + JSR EEOF,ERROR + +NXTB1: MOVEI BLOK,-UDWPH-1(T) ;LOAD ADR + MOVEI BUFP,NXLBYTS +NXTB1A: MOVEI T,0 + CAIE CMD,'D + CAIN CMD,'K + DPB T,DIRPT ;IF KILLING FILE, ZERO THIS BYTE (OTHERS ZEROED AT KILL) + LSH BLOK,6 + ILDB T,DIRPT + ADD BLOK,T ;GET COMPLETE BLOCK NUMBER + SOJG BUFP,NXTB1A + JRST NXTB3 + +NXTB2: MOVEM T,BLKCNT + CAIG T,UDTKMX + AOJA BLOK,WRDB1 ;TAKE N STARTING WITH NEXT ONE + ADDI BLOK,-UDTKMX+1(T) ;SKIP N- AND TAKE 1 +NXTB3: CLEARM BLKCNT +WRDB1: MOVEM BLOK,LBLOCK + JRST (TT) + ;RP10 IO ROUTINE +RP,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: DPB WRITE,[360600,,DBLK] ;SET OP, UNIT SEL + DPB WRITE,[DUNFLD SEEK] + DPB WRITE,[DUNFLD RECAL] + HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + MOVEM UNIT,@ICWA + SOS @ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + DPB DIFF,[DCYL SEEK] + DATAO DPC,CLATT ;CLEAR ATTENTIONS + LSH DIFF,-8 ;EXTRA CYLINDER BIT FOR RP03 + DPB DIFF,[DCYLXB DBLK] + DPB DIFF,[DCYLXB SEEK] + DATAO DPC,SEEK + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + DATAO DPC,CLATT + TLNN DIFF,(ONCYL) + JRST WRD0 + DATAO DPC,DBLK + CONSO DPC,DONE + JRST .-1 + CONSO DPC,ALLER + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: AOSLE ERRCT + JSR EC63,ERROR + DATAO DPC,RECAL + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + JRST WRD5 + +DBLK: ICWA +SEEK: DSEEKC +RECAL: DRCALC +CLATT: DEASEC ALLATT +];RP + ;RH11 IO ROUTINE +PH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: TRNE UNIT,1777 ; Better be on a page boundary! + JRST 4,. + LDB DIFF,[111100,,UNIT] ; Point Unibus map at page in question + TRO DIFF,%UQFST+%UQVAL + IOWRQ DIFF,UBAPAG+UBPG_1 + ADDI DIFF,1 + IOWRQ DIFF,UBAPAG+UBPG_1+1 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + JSP HEAD,RHCHEK ; Check for immediate trouble + MOVEI DIFF,%HMRDP ; Init the drive + IOWRQ DIFF,%HRCS1 + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVNI DIFF,4000 + IOWRQ DIFF,%HRWC ; 4000 half words + MOVEI DIFF,UBPG_14 + IOWRQ DIFF,%HRBA ; "Byte" base address + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + IOWRQ DIFF,%HRCYL ; Desire cylinder + MOVE DIFF,HEAD + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB DIFF,[$HATRK HEAD] + IOWRQ HEAD,%HRADR ; Desire track and sector + MOVEI DIFF,%HMRED + TRNE WRITE,10 + MOVEI DIFF,%HMWRT + IOWRQ DIFF,%HRCS1 ; Do it (implied seek) +WRD7: IORDQ DIFF,%HRCS1 + TRNN DIFF,%HXRDY ; Wait for controller to finish + JRST WRD7 + TRNN DIFF,%HXTRE+%HXMCP ; Trouble? + JRST WRDX ; Nope, exit + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVEI DIFF,%HYCLR ; Clear controller + IOWRQ DIFF,%HRCS2 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + MOVEI DIFF,%HMCLR ; Clear drive + IOWRQ DIFF,%HRCS1 + JSP HEAD,RHCHEK ; Immediate lossage? + MOVEI DIFF,%HMREC ; Recalibrate + IOWRQ DIFF,%HRCS1 + MOVEI HEAD,100000. +WRD0A: SOSGE HEAD + JSR EC63,ERROR + IORDQ DIFF,%HRSTS + TRNE DIFF,%HSPIP ; WAIT FOR DRIVE TO FINISH + JRST WRD0A + ANDI DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY+%HSERR + CAIE DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY + JSR EDLZ,ERROR + JRST WRD5 + +;;; JSP HEAD,RHCHEK to check for errors. +RHCHEK: IORDQ DIFF,%HRCS1 + TRNE DIFF,%HXTRE+%HXMCP + JSR EDLZ,ERROR + JRST (HEAD) +];PH + ;RH10 IO ROUTINE +RH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + CONI DSK,HEAD ;SET WORD COUNT TO ONE BLOCK + TLNE HEAD,(%HID22) ;ACCORDING TO TYPE OF CHANNEL + HRLI UNIT,-2000_4 + MOVEM UNIT,@ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + SOS @ICWA ;ADJUST FOR DF10 LOSSAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMRDP ;INIT THE DRIVE + JSP HEAD,RHSET + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + EXCH DIFF,HEAD + MOVEM HEAD,DBLK ;SAVE CYLINDER + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + EXCH DIFF,HEAD + DPB HEAD,[$HATRK DIFF] + TLO DIFF,%HRADR(UNIT) + JSP HEAD,RHSET + MOVE DIFF,DBLK + TLO DIFF,%HRCYL(UNIT) + JSP HEAD,RHSET + MOVSI DIFF,%HRCTL(UNIT) + IORI DIFF,ICWA_6 + TRNE WRITE,10 + TROA DIFF,%HMWRT + TRO DIFF,%HMRED + JSP HEAD,RHSET ;DO IT (USE IMPLIED SEEK) + CONSO DSK,%HIDON + JRST .-1 + CONSO DSK,%HIERR + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMCLR + JSP HEAD,RHSET + MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMREC + JSP HEAD,RHSET + MOVEI DIFF,100000. + MOVEM DIFF,DBLK +WRD0A: SOSGE DBLK + JSR EC63,ERROR + MOVSI DIFF,%HRSTS(UNIT) + JSP HEAD,RHGET + TRNE DIFF,%HSPIP + JRST WRD0A + ANDI DIFF,%HSVV+%HSRDY+%HSMOL+%HSERR + CAIE DIFF,%HSVV+%HSRDY+%HSMOL + JSR EDLZ,ERROR + JRST WRD5 + +;RH10 HACKING ROUTINES. CALL BY JSP HEAD,. DIFF HAS REGISTER ADDRESS IN LH, DATA IN RH. +RHSET: TLOA DIFF,%HRLOD +RHGET: TLZ DIFF,%HRLOD + DATAO DSK,DIFF + MOVEI DIFF,20 + SOJG DIFF,. + DATAI DSK,DIFF + TLNE DIFF,%HDERR + JSR EDLZ,ERROR + ANDI DIFF,177777 + JRST (HEAD) + +DBLK: 0 +];RH + ;SC DISK IO ROUTINE +SC,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,60#120 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,60#120 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: TRC WRITE,120 +WRD3: DPB WRITE,[330700,,DBLK] ;SET OP, UNIT SEL + DPB UNIT,[DCCA DBLK+1] ; & CORE ADDR + DPB UNIT,[DCCA DBLK1+1] + LDB UNIT,[400,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + CONO DC0,DCCSET\DCDENB ;RESET ALL, THEN SET DCDENB + CAIL DIFF,NCYLS + TDZA DIFF,DIFF + SKIPLE DIFF,PKNUM(UNIT) + JRST WRD4 ;PKID IN + MOVE DIFF,QTRAN(UNIT) ;READ PACK ID + DPB DIFF,[DUNFLD GPKID] + MOVEI DIFF,TUTCYL + SKIPGE QTRAN(UNIT) + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL GPKID] + DATAO DC0,[DJMP GPKID] + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR + JRST WRD0 + CONO DC0,DCCSET\DCDENB ;RESET POSSIBLE "FUTURE" IP OR RLCERR + LDB DIFF,[DPKID RPKID] + MOVEM DIFF,PKNUM(UNIT) +WRD4: DPB DIFF,[DPKID DBLK] + MOVE DIFF,DBLK + DPB DIFF,[3300,,DBLK1] + MOVE DIFF,QTRAN(UNIT) + DPB DIFF,[DUNFLD DBLK] + JUMPGE DIFF,WRD4A + LDB DIFF,[DCYL DBLK] ;2ND HALF UNIT + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL DBLK] +WRD4A: DATAO DC0,[DJMP DBLK] + CONSZ DC0,DSSACT + JRST .-1 + CONSO DC0,DSSERR + JRST WRDX ;XFER OK + MOVE DIFF,ERRCT + TRNN DIFF,2 ;DO RECALIBRATE 2 OUT OF 4 RETRIES + JRST WRD2 +WRD0: AOSLE ERRCT ;POSITIONER ERROR--CHECK ERROR COUNT + JSR EC63,ERROR ;TOO MANY--GIVE UP + DATAO DC0,[DSPC+DSRCAL+DSWINF] + CONSO DC0,DSSATT + JRST .-1 + JRST WRD5 ;TRY AGAIN AFTER RESETTING UNIT + +WRD2: HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,40 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: DPB BLOK,[XWBLK XWDS] ;PNTR TO PREV BLOCK + LDB UNIT,[DCCA DBLK+1] ;RESTORE ADR + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +DBLK: DREAD+DUNENB + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) +DBLK1: DRC + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) + DHLT + +GPKID: DSPC+DSCRHD+DSWIDX+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +];SC + +;JSP P,TYI RETURNS CHAR IN C. +;JSP P,TYI0 ALSO SKIPS IF NO INPUT AVAILABLE. +TYI: ILDB C,MEMSIZ-1 ;CHECK FOR COMMANDS FROM MEMORY + JUMPN C,(P) ;FOUND ONE--RETURN + CLEARM MEMSIZ-1 +TYI0: ;ENTRY TO SKIP IF NO INPUT AVAILABLE +KA,[ CONSO TTY,40 + JRST TYI1 + DATAI TTY,C +] +KS,[ SKIPN C,8CTYIN + JRST TYI1 + ANDI C,177 + SETZM 8CTYIN +] +KL,[ MOVEI C,3400 ;DDT MODE INPUT + SETZM DTEFLG + MOVEM C,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE C,DTEF11 + SETZM DTEFLG + JUMPE C,TYI1 +] ANDI C,177 + CAIGE C,175 + CAIN C,33 + JRST (P) ;DON'T ECHO GRITCHES +;DROP INTO TYO + +;JSP P,TYO TYPES OUT CHAR IN C. CLOBBERS A,C. +TYO: ;SKIPE MEMSIZ-1 + ; JRST (P) ;DON'T ECHO COMMANDS FROM MEMORY +KA,[ HRRZ A,C ;COMPUTE PARITY + IMULI A,40201 + AND A,[1111111] + IMUL A,[1111111] + TLNE A,1 + IORI C,200 + CONSZ TTY,20 + JRST .-1 + DATAO TTY,C + ANDCMI C,200 +] +KS,[ MOVE A,C + ANDI A,177 + TRO A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 +] +KL,[ MOVE A,C + ANDI A,177 + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SETZM DTEFLG +] + JUMPGE C,(P) ;CHECK FOR CRLF (AS OPPOSED TO ECHOING A CR) + SKIPA C,C12 ;TYPE AN LF +CRLF: HRROI C,15 + JRST TYO + +TYI1: HRRZ C,-1(P) ;NO INPUT AVAILABLE + CAIE C,TYI0 + JRST TYI ;WAIT FOR IT + JRST 1(P) ;CALL WAS TO TYI0, SKIP RETURN + +LINK: CAIE CMD,'D + CAIN CMD,'K + MOVSI WRITE,-1 ;MAKE THIS INFO MORE CONVENIENT + MOVE D,[440600,,C] + MOVEI T,0 +LINKL: ILDB TT,DIRPT + SKIPGE WRITE + DPB T,DIRPT ;CLOBBER CHARS READ FOR DUMP OR KILL + CAIN TT,'; + JRST LINKN + CAIN TT,': + JRST LINKQ + JUMPE TT,LINKN +LINKQ1: IDPB TT,D + TLNE D,770000 + JRST LINKL +LINKN1: CAMGE D,[600,,B] ;THROUGH WITH FN2? + JRST LINKL + JUMPL WRITE,KILL1 + MOVEM A,FN1 + MOVEM B,FN2 + JRST MLOOK2 + +LINKN: TLNN D,770000 + JRST LINKN1 + IDPB T,D ;FILL OUT WITH SPACES + JRST LINKN + +LINKQ: ILDB TT,DIRPT + JUMPGE WRITE,LINKQ1 + DPB T,DIRPT + JRST LINKQ1 + +READ: MOVEI BLKIN,CORE + JSP P,CRLF + MOVEI CMD,0 ;INITIALIZE COMMAND +READ1A: MOVEI WRITE,0 ;INITIALIZE NUMBER + MOVSI B,(SIXBIT \@\) ;INITIALIZE 1ST FILE NAME +READ1: MOVEM B,FN1 +READ3A: MOVSI B,(SIXBIT \@\) ;INITIALIZE CURRENT FILE NAME + MOVE D,[440600,,B] +READ2: JSP P,TYI + CAIN C,177 + JRST READ ;IF RUBOUT START OVER + CAIGE C,175 + CAIN C,33 + JRST ALTMOD ;JUMP IF 33, 175, 176 + ASH WRITE,3 ;DOES NOT CHANGE SIGN OF WRITE + CAIL C,"0 + CAILE C,"7 + TLOA WRITE,400000 ;NON-NUMERIC CHAR--MAKE WRITE NEGATIVE + ADDI WRITE,-"0(C) ;NUMERIC CHAR--ACCUMULATE NUMBER + CAIN C,"; + JRST READ3 ;SET SYSTEM NAME + CAIN C,40 + JRST READ1 ;SET FIRST FILE NAME + CAIN C,^Q + JSP P,TYI ;QUOTED CHARACTER + CAIGE C,140 ;CHECK FOR LOWER CASE + SUBI C,40 + JUMPL C,DOIT ;IF LESS THAN 40 (EXC. ^Q) END OF COMMAND + TLNE D,770000 ;SKIP IF ALREADY SIX CHARS + IDPB C,D + JRST READ2 + +READ3: MOVEM B,SYSN + CAIE CMD,'U + JRST READ3A + JRST DOIT ;IF COMMAND IS U GO LIST DIRECTORY + +ONOFF: CAIGE WRITE,NDSK + DPB CMD,[100,,QDED(WRITE)] ;LOW BIT OF CMD DETERMINES ON/OFF LINE STATUS + JRST READ ; (K=13, L=14) + +ALT1: LDB CMD,D ;PICK UP COMMAND CHAR + CAIE CMD,'K + TRNN CMD,2 + JRST READ1A ;GET FILE NAME + JRST DOIT ;DON'T WANT FILE NAME--GO TO WORK + +ALTMOD: MOVEI C,"$ + JSP P,TYO ;ECHO DOLLAR SIGN + JUMPLE WRITE,ALT2 ;JUMP IF NOT LAST TYPED + JUMPN CMD,ONOFF ;JUMP IF + HRRM WRITE,SADR ;SET STARTING ADDR + JRST READ + +ALT2: TLC D,360000 + TLCN D,360000 ;SKIP IF SINGLE CHARACTER BEFORE + JUMPE CMD,ALT1 ;JUMP IF NO COMMAND ALREADY TYPED +DOIT: MOVEM B,FN2 ;STORE SECOND FILE NAME + HRRZ B,MU + HRRM B,CU ;MAKE MASTER UNIT CURRENT UNIT + MOVNI WRITE,1 + JSP P,LODUMP ;DUMP OUT PSEUDO-CORE + CAIN CMD,'G + JRST LOADG0 ;GO + JSP TT,RDTUT + MOVE C,SYSN +MLOOK2: MOVSI WRITE,1 ;MAKE WRITE INDICATE LOAD + MOVEI BLOK,MFDBLK + MOVEI UNIT,DIR + JSP TT,RD ;READ MASTER DIRECTORY TO FIND WHERE USER DIRECTORY IS + MOVE T,DIR+MDCHK + CAME T,[SIXBIT/M.F.D./] + JSR EMFC,ERROR + MOVE T,DIR+MDNUDS + CAIE T,NUDSL + JSR EMFC,ERROR + CAIN CMD,'S + JRST LISTS ;LIST DISK ID'S AND SYSTEM NAMES + MOVE T,DIR+MDNAMP +MLOOK: CAMN C,DIR+MNUNAM(T) ;LOOK UP SYSTEM NAME + JRST MLOOK1 + ADDI T,LMNBLK + CAIGE T,2000 + JRST MLOOK + JSR ESNF,ERROR ;NOT FOUND + +MLOOK1: MOVEI BLOK,2*NUDSL-2000(T) ;CONVERT USER SLOT TO BLOCK NUMBER + LSH BLOK,-1 + HRRM BLOK,UDBLK ;REMEMBER FOR KILL OR DUMP + MOVEI UNIT,DIR + JSP TT,RDM ;READ USER DIRECTORY +ULOOK: CAME C,DIR+UDNAME + JSR ECDR,ERROR ;WRONG ONE?? + CAIE CMD,'F + CAIN CMD,'U + JRST LISTFC ;LIST USER DIRECTORY + MOVSI TT,UNIGFL + MOVE T,DIR+UDNAMP + MOVE A,FN1 + MOVE B,FN2 +ULOOK1: CAMN A,DIR+UNFN1(T) ;LOOK UP FILE NAME + CAME B,DIR+UNFN2(T) + JRST ULOOK2 + TDNN TT,DIR+UNRNDM(T) ;IS THIS FILE FOR REAL? + JRST ULOOK3 +ULOOK2: ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK1 + CAIE CMD,'D ;IF NOT FOUND BETTER BE DUMP + JSR EFNF,ERROR + MOVE T,DIR+UDNAMP +ULOOK4: SKIPN DIR+UNFN1(T) ;FIND FREE SLOT FOR NEW FILE + JRST DUMP + ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK4 + MOVNI T,LUNBLK ;NO FREE SLOTS--TRY TO EXTEND NAME AREA DOWN + ADDM T,DIR+UDNAMP + MOVE T,DIR+UDESCP + IDIVI T,6 + ADDI T,UDDESC + CAMGE T,DIR+UDNAMP ;DID WE RUN INTO DESCRIPTOR AREA? + JRST DUMP0 + JSR EDIR,ERROR ;YES + +ULOOK3: HRRM T,DMP4 ;IF FILE FOUND, SAVE SLOT NUMBER FOR DUMP + LDB C,[UNDSCP DIR+UNRNDM(T)] + JSP TT,GBP + MOVEM C,DIRPT ;SET UP DESCRIPTOR AREA BYTE POINTER + MOVSI TT,UNLINK + TDNE TT,DIR+UNRNDM(T) + JRST LINK ;FILE IS A LINK + LDB A,[UNPKN DIR+UNRNDM(T)] +ULOOK5: CAMN A,TUT+QPKNUM ;SEE IF IT'S MOUNTED + JRST LOAD + JSP TT,NXTTUT + JRST ULOOK5 + JSR EPNM,ERROR + +LOAD: CAIE CMD,'D ;GET HERE IF FILE FOUND + CAIN CMD,'K ;IF DUMP OR KILL, DELETE IT + JRST KILL +ZERO: MOVEI TT,CORE-1 + TRNN CMD,20 ;SKIP IF T$ SYMBOL LOADING COMMAND + JRST ZERO1 + MOVEI B,DDT-1 ;ASSUME ALWAYS USING MOBY DDT + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAME B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSR EDDT,ERROR + SKIPE D,-2(C) ;FLUSH ALL BUT INITIAL SYMBOLS + MOVEM D,-1(C) + MOVE D,-1(C) + MOVEI TT,CORE-1 + CAILE TT,-1(D) + MOVEI TT,-1(D) ;DON'T ZERO SYMBOL TABLE NOR DDT +ZERO1: TRNE CMD,1 + JRST LOAD1 ;NON-ZEROING COMMAND + SETZM 40 ;BEGIN CLEARING CORE + MOVE T,[40,,41] ;SET UP BLT POINTER +;CODE TO SKIP OVER NXM +ZERO2: CAIG TT,10*2000-1(T) ;MORE THAN 8K LEFT TO ZERO? + JRST ZERO4 ;NO, ZERO REMAINING WORDS AND PROCEED + MOVE D,T ;AVOID KA/KL INCOMPAT BY COPYING BLT PNTR + BLT D,10*2000-1(T) ;ZERO NEXT 8K +ZERO3: ADDI T,10*2000 ;MOVE DEST OF BLT PNTR UP 8K + ANDCMI T,1777 ;ROUND DOWN TO 1K BOUNDARY +KA, CONO 10000 ;CLEAR NXM + MOVES (T) ;SET NXM IF HOLE +KA, CONSZ 10000 ;NXM GENERATED? +KA, JRST ZERO3 ;YES, GO TO NEXT 8K + JRST ZERO2 ;NO, CLEAR THIS 8K + +ZERO4: BLT T,(TT) ;AND CLEAR TO TOP BOUNDARY + TRNE CMD,20 + JRST LOAD1 ;IF SYMBOL-LOADING COMMAND, STOP THERE + CLEARM CBUF + MOVE T,[CBUF,,CBUF+1] + BLT T,CBUF+1777 + MOVEI UNIT,CBUF + MOVE BLOK,CBLK ;-NSWBL IN LH + JSP TT,WRM ;CLEAR PSEUDO-CORE + AOBJN BLOK,.-1 +LOAD1: SETZB BUFP,BLKCNT ;SET UP BUFP SO FIRST CALL TO WD WILL READ +LOAD2: JSP P,WD ;FIRST BLOCK OF FILE + CAME D,[JRST 1] ;LOOK FOR END OF SBLK LOADER + JRST LOAD2 + CAIN CMD,'I ;IF VERIFY, START SIMULATING DUMP + JRST DUMP.5 +LOAD3: JSP P,WD ;READ BLOCK HEADER + JUMPGE D,LOADS ;IT'S A JUMP BLOCK + MOVE A,D + MOVE B,D + JSR LOADB ;LOAD LOGICAL BLOCK INTO CORE + JRST LOAD3 + +LOADB: 0 +LOAD4: JSP P,WD ;LOAD A LOGICAL BLOCK--AOBJN POINTER IN B, + ROT A,1 ;BLOCK HEADER IN A (FOR CHECKSUM) + ADD A,D ;ADD NEW WORD INTO CHECKSUM + JSP P,FD ;AND PREPARE TO SMASH IT AWAY + JRST .+2 ;LOCATION CAN'T BE LOADED + MOVEM D,(C) ;SMASH WORD AWAY + AOBJN B,LOAD4 + JSP P,WD + CAMN A,D ;CHECK THE CHECKSUM + JRST @LOADB + JSR ECKS,ERROR ;BAD CHECKSUM + +LOADS: CAIN CMD,'M + JRST LOADG0 ;DON'T LOAD SYMBOLS NOR SADR + MOVEM D,NXTBW3 ;SAVE S.A. + MOVEI B,DDT-1 ;ASSUME IS ALWAYS MOBY DDT. + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + SKIPN (C) + JRST LOADJ ;AIN'T GOT NO DDT, IGNORE SYMBOLS + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAMN B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSP P,FD ;FETCH SYMBOL TABLE POINTER + JSR EDDT,ERROR + MOVE D,(C) + MOVEM D,DDTM2 +LOADS1: MOVE B,DDTM2 ;GET LOWEST SYMBOL LOC SO FAR + JSP P,WD ;GET SYMBOL BLOCK HEADER + JUMPGE D,LOADS2 ;JUMP IF END OF SYMBOLS + TRNE D,-1 ;SKIP IF REALLY SYMBOLS AND NOT SOME OTHER BRAIN-DAMAGED CRUFT + JRST LOADBD + MOVSS D + HRLI D,-1(D) + ADD B,D ;EFFECTIVELY SUBTRACTS LENGTH OF BLOCK FROM BOTH HALVES + MOVEM B,DDTM2 ;OF SYMBOL TABLE POINTER + HRL B,D ;SET UP AOBJN POINTER IN B + HRLZ A,D ;AND RECREATE HEADER IN A + JSR LOADB ;LOAD THE SYMBOLS + JRST LOADS1 + +LOADBD: HLRO B,D ;-# WORDS TO SKIP (NOT COUNTING CHECKSUM) + JSP P,WD + AOJLE B,.-1 + JRST LOADS1 ;TRY NEXT SYMBOL BLOCK + +LOADS2: MOVE D,DDTM2 ;GET UPDATED DDT SYMBOL PNTR +LOADS4: MOVEI B,DDT-2 ;WE KNOW WHERE IT ALWAYS GOES + JSP P,FD ;PUT BACK SYMBOL TABLE POINTER + JSR EBUG,ERROR ;CAN'T PUT IT BACK?? + MOVEM D,(C) + MOVEI B,DDT-4 ;GIVE STARTING ADDRESS TO DDT + JSP P,FD + JSR EBUG,ERROR + MOVE D,NXTBW3 + MOVEM D,(C) + MOVEI D,DDT ;AND SET DSKDMP START ADDRESS TO DDT +LOADJ: HRRM D,SADR ;SET STARTING ADDRESS FROM JUMP BLOCK +LOADG0: MOVE T,BOOTNS ;APPROP DISK WAIT FOR NON BUSY INSTR + MOVEM T,BOOT +LOADG: JSP TT,WRCB ;MAKE SURE ALL LOADED CRUFT IN PSEUDO-CORE IS OUT + MOVEI WRITE,0 + JSP P,LODUMP ;AND LOAD IT ALL IN + TRNE CMD,10 + JRST READ ;NON-GOING COMMAND +GO: +PH,[ MOVSI B,-LSWPADR +GO1: IORD DIFF,SWPCS1 + TRNN DIFF,%HXRDY ; Wait for controller + JRST GO1 + HRRZ DIFF,SWPVAL(B) + IOWR DIFF,SWPADR(B) + AOBJN B,GO1 +];PH +RH,[ MOVE B,ERRWD + CONI DSK,HEAD + TLNE HEAD,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +GO1: CONSZ DSK,%HIBSY + JRST .-1 + MOVE DIFF,SWPOU1(B) + JSP HEAD,RHSET + AOBJN B,GO1 +];RH +RP,[ MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPOU1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPOU2 +];RP +SC, DATAO DC0,[DJMP SWPOUT] + JRST WAIT + +LISTS: JSP P,CRLF +LISTS2: JSP P,TYI0 + JRST LOADG1 ;SHUT UP IF KEY HIT + MOVE C,TUT+QPKNUM ;TYPE PACK NUMBER + JSP TT,PNO + MOVE D,TUT+QPAKID ;AND I.D. + JSP TT,PD2 + JSP TT,NXTTUT ;SAME FOR ALL DIRECTORIES + JRST LISTS2 + MOVE T,DIR+MDNAMP +LISTS1: CAIGE T,2000 + JSP P,TYI0 ;STOP TYPING IF TTI FLAG ON + JRST LOADG1 + SKIPE D,DIR+MNUNAM(T) + JSP TT,PD ;TYPE OUT USER NAME + ADDI T,LMNBLK + JRST LISTS1 + +LISTFC: MOVE T,DIR+UDNAMP +LISTF1: +KA, CONSO TTY,40 ;STOP TYPING IF TTI FLAG ON +KS, SKIPN 8CTYIN ; Stop typing if character waiting + CAIL T,2000 + JRST LOADG1 + SKIPN DIR+UNFN1(T) ;SKIP IF FILE IN THIS SLOT + JRST LISTF2 + JSP P,CRLF + LDB C,[UNPKN DIR+UNRNDM(T)] + JSP TT,PNO ;TYPE PACK NUMBER + MOVE D,DIR+UNFN1(T) + JSP TT,PD2 ;TYPE FIRST FILE NAME + MOVE D,DIR+UNFN2(T) + JSP TT,PD2 ;AND SECOND FILE NAME +LISTF2: ADDI T,LUNBLK + JRST LISTF1 + +KILL: JSP TT,NXTB6 ;GET HERE ON KILL OR DUMP OF EXISTING FILE + MOVEI T,0 ;ZERO BYTES IN USER DIRECTORY DESCIPTOR AREA + DPB T,DIRPT ;NXTB6 JUMPS TO KILL1 AT END OF FILE + MOVE C,BLOK + JSP TT,GTP + ILDB T,C + CAIGE T,TUTLK-1 ;SOS USAGE OF THIS BLOCK + SOJL T,[JSR ECDR,ERROR] + DPB T,C + JRST KILL + +KILL1: HRRZ T,DMP4 ;CLEAR OUT USER DIRECTORY SLOT + CLEARM DIR+UNFN1(T) + CLEARM DIR+UNFN2(T) + CLEARM DIR+UNRNDM(T) + MOVSI WRITE,-1 + CAIN CMD,'K + JRST KILDMP ;IF KILL DON'T DUMP + JRST DMP4 ;MUST DUMP ON SAME UNIT + +DUMP0: MOVE T,DIR+UDNAMP ;GET HERE IF SLOT CREATED AT BOTTOM OF NAME AREA +DUMP: HRRM T,DMP4 ;GET HERE IF EMPTY SLOT FOUND IN NAME AREA +DMP0: MOVEI D,0 ;GET HERE IF USING SLOT OF OLD FILE +DMP1: ;MOVE C,TUT+QSWAPA + MOVEI C,0 ;NOTE START AT 0 NOT QSWAPA + MOVE B,C + SUB B,TUT+QLASTB + HRLZ B,B ;LH(B) COUNTS BLOCKS, RH(B) COUNTS FREE BLOCKS + JSP TT,GTP +DMP2: ILDB T,C + SKIPE T +KA, SUBI B,1 ;THIS RELIES ON CARRY PROPAGATING FROM RH TO LH IN AOBJN +KL, HRRI B,-1(B) ;ON KI10, KL10 CHANGE SUBI B,1 TO HRRI B,-1(B) +KS, HRRI B,-1(B) ;KS too... + AOBJN B,DMP2 + CAIG B,(D) ;RH OF D IS HIGHEST SO FAR, LH SAYS WHICH UNIT + JRST DMP5 ;NOT BETTER THAN RECORD + MOVE D,B ;NEW RECORD--RECORD IT + HRL D,CU +DMP5: JSP TT,NXTTUT ;TRY NEXT + JRST DMP1 + ;FALLS THROUGH AT END +DMP3: HLRM D,CU ;SET CURRENT UNIT TO ONE WITH MOST FREE BLOCKS + JSP TT,RDTUT ;GET ITS TUT +DMP4: MOVEI T,. + MOVE A,FN1 + MOVE B,FN2 + MOVEM A,DIR+UNFN1(T) ;PUT CRUFT INTO SLOT + MOVEM B,DIR+UNFN2(T) + SETOM DIR+UNDATE(T) ; Unknown creation date + HRROI C,777000 ; Unknown reference date + MOVEM C,DIR+UNREF(T) ; Unknown author, 36. bit bytes +SC,[ MOVEM A,XWDS+XWFN1 + MOVEM B,XWDS+XWFN2 + MOVE C,SYSN + MOVEM C,XWDS+XWSYSN +] MOVE C,DIR+UDESCP ;PUT DESCRIPTOR CHARACTER ADDRESS + MOVE B,TUT+QPKNUM ;AND PACK NUMBER + DPB B,[UNPKN C] + MOVEM C,DIR+UNRNDM(T) ;INTO USER DIRECTORY SLOT + ;MOVE C,TUT+QSWAPA ;COMMENTED OUT INSN DUMPS INTO FILE AREA + MOVEI C,0 ;DUMP INTO SWAPPING AREA TO AVOID Y FILES + MOVEM C,LBLOCK ;A DAEMON WILL COPY INTO FILE AREA AFTER SALVAGE + JSP TT,GTP + MOVEM C,TUTPT ;INITIALIZE TUT POINTER + MOVE C,DIR+UDESCP + JSP TT,GBP + MOVEM C,DIRPT ;INITIALIZE DESCRIPTOR AREA POINTER + SETOB WRITE,BLKCNT ;FORCE NXTBW TO LOAD ADR +KA, HRLOI BUFP,-2001-1 ;SET UP BUFP SO FIRST WORD GOES IN DBUF+0 +KL, HRLOI BUFP,-2001 +KS, HRLOI BUFP,-2001 + MOVE D,[JRST 1] + JSP P,WD ;END OF SBLK LOADER +;DROPS THROUGH + +;DROPS IN +DUMP.5: MOVSI WRITE,-'I(CMD) ;GET HERE IF VERIFY--SET WRITE NEGATIVE IF + MOVEI B,40 ;DUMP AND ZERO IF VERIFY--FIRST ADDR DUMPED IS 40 + HRRM B,DUMP4 + HLLOS DUMP6 + SETZM DUMP9S + SETZM DUMP9J + SETZM DUMP9K + MOVEI B,DDT-3 ;SET UP TO NOT DUMP SYMBOLS AS PART OF CORE IMAGE + JSP P,FD + JSR EBUG,ERROR + SKIPN A,(C) ;GET PNTR TO BUILT IN SYMBOLS + JRST DUMP4 ;NO DDT, DON'T HACK THIS + HRRM A,DUMP7 ;THIS IS WHERE WE START DUMPING AGAIN + MOVEM A,DUMP9K ;THIS WILL BE INITIAL SYMBOL TABLE PNTR WHEN DDT LOADED + MOVNI A,(A) + ADD A,1(C) ;GET MINUS SIZE OF NON-BUILTIN SYMBOL TABLE IN RH(A) + HRL A,1(C) ;GET PNTR TO SYMBOL TABLE + HLRM A,DUMP6 ;THIS IS WHERE WE STOP DUMPING + MOVSM A,DUMP9S ;SAVE AOBJN PNTR TO NON-BUILTIN SYMBOLS + MOVE A,-1(C) ;PICK UP START ADDRESS + MOVEM A,DUMP9J ;SAVE + MOVE B,-2(C) ;DUMP LOW CORE (ACS) OUT OF PLACE SAVED IN DDT + HLLZ A,B ;HERE B HAS ADDRESS DUMPING FROM + JRST DUMP3B ;AND A AND D HAVE VIRTUAL ADDRESS + +DUMP1: ;SKIP OVER NXM ON DUMPING +KA,[ CONSO 10000 ;NXM SET? + JRST DUMP1A ;NO, CONTINUE IN SEQUENCE + ADDI B,10*2000-1 ;SKIP 8K + TRZ B,1777 ;ROUND DOWN TO 8K BOUDARY + CONO 10000 ;CLEAR NXM +DUMP1A: +];KA +DUMP6: CAIGE B,. ;SKIP IF REACHED SYMBOL TABLE + JRST DUMP8 +DUMP7: MOVEI B,. ;SKIP OVER SYMBOLS, DUMP DDT + HLLOS DUMP6 ;DEFUSE TEST +DUMP8: JSP P,FD + JRST DUMPJ ;TIME TO WRITE JUMP BLOCK AND SYMBOL TABLE + SKIPN (C) ;LOOK FOR NON-ZEROES + AOJA B,DUMP1 + MOVE A,B ;SAVE START OF BLOCK +DUMP2: TLZ A,-1 ;LOOK FOR TWO CONSECUTIVE ZEROES +DUMP2A: CAIL B,200(A) ;BUT DON'T DUMP MORE THAN 200 WORDS AT A TIME + JRST DUMP3 + XCT DUMP6 + JSP P,FD + JRST DUMP3 ;END OF CORE, WRITE OUT LAST BLOCK + SKIPE (C) + AOJA B,DUMP2 ;NONZERO + TLON A,-1 ;ZERO, WAS PREV LOC ZERO ALSO? + AOJA B,DUMP2A ;NO, CHECK FOLLOWING LOC + SOJA B,DUMP3 ;YES, DUMP THE NON-ZERO THAT PRECEDES IT + +DUMP3: HRRM B,DUMP4 ;SAVE ADDRESS TO CONTINUE SEARCH + SUBM A,B ;RH(B) GETS MINUS THE LENGTH OF THE BLOCK + HRL A,B ;SET UP HEADER IN A + MOVE B,A ;AND B +DUMP3B: MOVE D,A ;AND D + JSP P,WD ;WRITE HEADER +DUMP3A: JSP P,FD + JSR EBUG,ERROR ;CAN'T FETCH WORD WE FETCHED BEFORE?? + MOVE D,(C) + ROT A,1 + ADD A,D ;COMPUTE CHECKSUM + JSP P,WD ;WRITE DATA WORD + AOBJN B,DUMP3A + MOVE D,A + JSP P,WD ;WRITE OUT CHECKSUM +DUMP4: MOVEI B,. ;AND CONTINUE SEARCHING + JUMPN B,DUMP1 ;IF MRC EVER SEES THIS --SELFMODIFYING CODE-- .... + JRST DUMP9 ;FINISHED DUMPING SYMBOLS + +DUMPJ: SKIPN DUMP9K + JRST DMP9J1 + HRROI D,DDT-2 ;BUGGER THE SYMBOL TABLE + MOVE A,D + JSP P,WD + MOVE D,DUMP9K + ROT A,1 + JSP P,WD + ADD D,A + JSP P,WD +DMP9J1: SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;WRITE OUT JUMP BLOCK + SKIPN B,DUMP9S ;WRITE SYMBOLS + JRST DUMP9 ;NO SYMBOLS + HLLZ A,B + HLLZS DUMP4 ;DUMP SYMBOL BLOCK, RETURN TO DUMP9 + JRST DUMP3B + +DUMP9: JUMPE WRITE,LOADG1 ;IF VERIFY, THAT'S ALL + SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;SECOND JUMP BLOCK + HRRZ T,DMP4 ; GET POINTER TO NAME AREA + AOS BUFP + DPB BUFP,[UNWRDC+DIR+UNRNDM(T)] + JSP TT,NXTBLK + JSP TT,WRDB ;WRITE OUT LAST BLOCK + SKIPE T,BLKCNT + JSR NXTBW3 ;STORE LAST DESCRIPTOR BYTE + MOVEI T,0 + JSR NXTBW3 ;AND INDICATE END OF FILE + LDB T,[360600,,DIRPT] + IDIVI T,6 + HRRZ TT,DIRPT + IMULI TT,6 + SUBI TT,6*-5-1(T) + HRRZM TT,DIR+UDESCP ;INDICATE NEW END OF DESCRIPTOR AREA +KILDMP: MOVEI UNIT,TUT + MOVEI BLOK,TUTBLK + JSP TT,WRD ;WRITE OUT TUT ON THIS UNIT +REPEAT NTUTBL-1,[ + ADDI UNIT,2000 + ADDI BLOK,1 + JSP TT,WRD +] + HRRZ B,CU + HRRM B,KD2 ;WRITE OUT USER DIRECTORY ON ALL UNITS +KD1: ADDI B,1 + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + SKIPE QDED(B) + JRST KD2 + MOVEI UNIT,DIR +UDBLK: MOVEI BLOK,. + MOVE TT,DIR+UDNAME + CAME TT,SYSN + JSR EBUG,ERROR + JSP TT,WR +KD2: CAIN B,. + JRST LOADG1 + JRST KD1 + +GTP: SKIPGE TUT+QPKNUM + JSR EBUG,ERROR ;MUST BE OLD-STYLE TUT? + SUB C,TUT+QFRSTB + JUMPL C,[JSR EBUG,ERROR] + IDIVI C,TUTEPW + IMULI A,-10000*TUTBYT + HRLI C,440000+TUTBYT_6(A) + ADDI C,TUT+LTIBLK + JRST (TT) + +SC,[ ;LOGICAL TO PHYSICAL DISK MAPPING +QTRAN: 0 ;INDEX BY LOG DSK # + 1 ;4.9 => USE HIGH HALF OF DRIVE, RH = PHYS DRIVE # + 2 ;(NO LONGER DOES ANYTHING, NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND JUST IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NDSK,.ERR QTRAN LOSES!! +];SC + +ERRCT: 0 ;ERROR COUNTER +DDTM2: 0 ;DDT SYMBOL TABLE POINTER +DUMP9J: 0 ;START INSTRUCTION (AT DUMP9) +DUMP9S: 0 ;SYMBOL TABLE POINTER (AT DUMP9) +DUMP9K: 0 ;INITIAL SYMBOL TABLE PNTR (AT DUMP9) +LBLOCK: 0 ;LAST BLOCK WRITTEN OR READ +BLKCNT: 0 ;NUMBER OF BLOCKS READ OR WRITTEN CONSECUTIVELY +DIRPT: 0 ;DESCRIPTOR AREA BYTE POINTER +TUTPT: 0 ;TUT BYTE POINTER +FN1: 0 ;FILE NAME 1 +FN2: 0 ;FILE NAME 2 +PKNUM: REPEAT NDSK,-1 ;PACK NUMBER INDEXED BY DRIVE NUMBER +QDED: BLOCK NDSK ;-1 IF DRIVE NOT TO BE USED +XWDS: BLOCK 4 +RPKID: 0 +BOOTNS: RP, CONSZ DPC,BUSY + SC, CONSZ DC0,DSSACT + RH, CONSZ DSK,%HIBSY + PH, IORD B,SWPCS1 ; UGH! + + CONSTANTS + +IFL BEG+1677-., .ERR BLOAT +INFORM SPACE LEFT,\BEG+1677-. +BLOCK BEG+1677-. + +BADBLK: 0 ;BLOCK WITH HDWE ERROR +INFORM BADBLK,\.-1-BEG+ + +];END IFE BOOTSW +IFN BOOTSW,[ +BEG=MEMSIZ-2000 +LOC MEMSIZ-100 +] + +CBOOT: CLEARM MEMSIZ-1 ;BOOTSTRAP +RP,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DPC,BUSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DPC,BUSY + JRST .-1 + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 + DATAO DPC,CLATT1 + DATAO DPC,SUNIT0 + DATAI DPC,B +BOOT0: TRNN B,RP03BT + JRST BOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +BOOT1: HLLZS BOOT0 ;PREVENT TRNN FROM SKIPPING AGAIN + MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPIN1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPIN2 + CONSO DPC,DONE + JRST .-1 + JRST BEG + +ERRWD: -1700,,BEG-1 +CLATT1: DEASEC ALLATT +SWPSK: DSEEKC+200._22. +SWPIN1: DWRITC+200._22.+3_17.+2._12.+ICWA ;NBLKS 4 +SWPIN2: DREADC+200._22.+4_17.+8._12.+ICWA +SWPOU1: DWRITC+200._22.+4_17.+8._12.+ICWA +SWPOU2: DREADC+200._22.+3_17.+2_12.+ICWA +IFN NSWBL-5, .ERR THE PRECEDING 4 CONSTANTS ARE WRONG! +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +RP3ADJ: <&377>_22.+<.BM DCYLXB> +SUNIT0: DNOOPC + +SKWAIT: DATAI DPC,A ;AWAIT SEEK DONE UNIT 0 + TRNN A,ALLATT + JRST SKWAIT + DATAO DPC,CLATT1 + MOVEI A,30. + SOJG A,. + DATAI DPC,A + TLNN A,(ONCYL) + JRST SKWAIT + JRST (P) + +WAIT: CONSO DPC,DONE + JRST .-1 +];RP + +PH,[ ;; Initially we could not use IORDQ or IOWRQ because they were + ;; macros that used a literal. There is nothing to stop us now, + ;; except the fact that this code works fine and is as small as you + ;; could possibly want. + +BOOT: +IFE BOOTSW, JRST BEG ; or IORD B,SWPCS1 or JRST LOADG1 +IFN BOOTSW, IORD B,SWPCS1 + TRNN B,%HXRDY + JRST BOOT +KS, WREBR 0 ; No paging or caching + MOVEI A,0 + IOWR A,SWPCS2 ; Select drive +BOOT0: IORD A,SWPCS1 + TRNN A,%HXDVA + JRST BOOT0 ; Await drive available + MOVSI B,-LSWPADR +BOOT1: HLRZ A,SWPVAL(B) + IOWR A,SWPADR(B) +BOOT2: IORD A,SWPCS1 + TRNN A,%HXRDY ; Wait for controller + JRST BOOT2 + TRNE A,%HXTRE+%HXMCP ; Lossage? + JRST 4,. ; Foo! + AOBJN B,BOOT1 + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +SWPADR: UBAQ,,UBAPAG+UBPG_1 ; Set up Unibus map + UBAQ,,UBAPAG+UBPG_1+1 + UBAQ,,%HRCS2 ; Clear controller +SWPCS2: UBAQ,,%HRCS2 ; Select drive +SWPCS1: UBAQ,,%HRCS1 ; Initialize + UBAQ,,%HRCYL ; Desire cylinder + UBAQ,,%HRWC ; Set (half) word count + UBAQ,,%HRBA ; Set Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Write + UBAQ,,%HRWC ; Reset (half) word count + UBAQ,,%HRBA ; Reset Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Read +LSWPADR==:.-SWPADR + +IFN BEG&1777, .ERR BEG does not lie on a page boundary? + +;;; LH FOR SWAP IN, RH FOR SWAP OUT +SWPVAL: %UQVAL+%UQFST+BEG_-9,,%UQVAL+%UQFST+BEG_-9 ; Set up Unibus map + %UQVAL+%UQFST+BEG_-9+1,,%UQVAL+%UQFST+BEG_-9+1 + %HYCLR,,%HYCLR ; Clear controller + 0,,0 ; Select drive + %HMRDP,,%HMRDP ; Initialize + NCYLS,,NCYLS ; Desire cylinder + -1700*2,,-1700*2 ; Set (half) word count + UBPG_14,,UBPG_14 ; Set Unibus address + ZZ1,,ZZ2 ; Desire track and sector + %HMWRT,,%HMWRT ; Write + -1700*2,,-1700*2 ; Reset (half) word count + UBPG_14,,UBPG_14 ; Reset Unibus address + ZZ2,,ZZ1 ; Desire track and sector + %HMRED,,%HMRED ; Read +IFN .-SWPVAL-LSWPADR, .ERR SWPVAL wrong length. + +CBLK: -NSWBL,,NBLKS + +WAIT: IORD B,SWPCS1 + TRNN B,%HXRDY + JRST WAIT +];PH + +RH,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DSK,%HIBSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DSK,%HIBSY + JRST .-1 +KL, CONSZ PAG,660000 ;PAGING AND CACHE MUST BE DISABLED +KL, JRST 4,. + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 +BOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST BOOT0 ;AWAIT DRIVE AVAILABLE + MOVE B,ERRWD + CONI DSK,A + TLNE A,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +BOOT1: DATAO DSK,SWPIN1(B) + MOVEI A,20 + SOJG A,. + CONSZ DSK,%HIBSY + JRST .-1 + AOBJN B,BOOT1 + CONSZ DSK,%HIERR + JRST 4,. + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +ERRWD: -1700,,BEG-1 +SWPIN1: %HRLOD+%HRDCL,,%HMRDP +SWPIN2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPIN3: %HRLOD+%HRADR,,ZZ1 +SWPIN4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPIN5: %HRLOD+%HRADR,,ZZ2 +SWPIN6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +SWPOU1: %HRLOD+%HRDCL,,%HMRDP +SWPOU2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPOU3: %HRLOD+%HRADR,,ZZ2 +SWPOU4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPOU5: %HRLOD+%HRADR,,ZZ1 +SWPOU6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +CBLK: -NSWBL,,NBLKS+NBLKSC ;AVOID CYLINDER 406 WHICH KLDCP USES + +WAIT: CONSO DSK,%HIDON + JRST .-1 +];RH + +SC,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DC0,DSSACT OR JRST LOADG1 +IFN BOOTSW, CONSZ DC0,DSSACT + JRST .-1 + DATAO DC0,SWPINJ + CONSZ DC0,DSSACT + JRST .-1 + JRST BEG + +SWPINJ: DJMP SWPIN + +DADR==NCYLS_13+</2>_6+<&1> ;ADDR OF LAST BLOCK IN CORE BUFFER +DADR1==NCYLS_13+_6+ ;ADDR OF NEXT BLOCK (CONTAINS +SWPIN: DWRITE+DUNENB+DADR ; WORKING COPY OF DSKDMP) + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +SWPOUT: DWRITE+DUNENB+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +WAIT: CONSZ DC0,DSSACT + JRST .-1 +];SC +SADR: JRST BOOT ;AND GO TO PROGRAM TO BE STARTED +SYSN: SIXBIT /./ ;CURRENT DIRECTORY +IFG .+1-MEMSIZ,.ERR BOOT BLOAT + +IFE BOOTSW,{ ;CURLY BRACKETS TO AVOID ERROR MESSAGE + OFFSET 0 + LOC CORE + +;THESE ARE THE BLOCKS THAT GET WRITTEN ON DISK +; STARTING AT THE BEGINNING OF THE FIRST EXTRA CYLINDER + +CBUF: BLOCK 2000 ;PSEUDO-CORE BUFFER +DBUF: BLOCK 2000 ;DISK BUFFER +DIR: BLOCK 2000 ;DIRECTORY BUFFER +TUT: BLOCK 2000*NTUTBL ;TUT BUFFER +IFN .-BEG,.ERR BLOCKS LOST +; BLOCK 2000 ;CORE OVERLAYED BY DSKDMP +; BLOCK 2000 ;COPY OF DSKDMP +; BLOCK 2000 ;SPARE COPY OF DSKDMP + +END ZZZ +};END IFE BOOTSW +IFN BOOTSW, END CBOOT diff --git a/system/dskdmp.213 b/system/dskdmp.213 new file mode 100644 index 0000000..fd5d08a --- /dev/null +++ b/system/dskdmp.213 @@ -0,0 +1,1873 @@ +;;; -*-Midas-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +TITLE DSKDMP + +.MLLIT==1 + +DEFINE SETF TEXT,FLG +IFDEF FLG,.STOP +.TAG FOOBAR +PRINTC "TEXT +FLG=" +.TTYMAC FLAG +.TTYFLG==.TTYFLG+1 +PRINTX/FLAG +/ +.TTYFLG==.TTYFLG-1 +IFSE FLAG,YES,FLG==1 +IFSE FLAG,NO,FLG==0 +IFSE FLAG,Y,FLG==1 +IFSE FLAG,N,FLG==0 +IFNDEF FLG,FLG==FLAG +TERMIN +IFNDEF FLG,.GO FOOBAR +TERMIN + +IF1,[ +PRINTC "Configuration (KSRP06, KSRM03, or ASK) ? " +.TTYMAC MACH +IFSE MACH,KSRP06,[ + HRIFLG==0 + RP06P==1 + KS10P==1 + NUDSL==500. +] ;KSRP06 +IFSE MACH,KSRM03,[ + HRIFLG==0 + RP06P==0 + RM03P==1 + KS10P==1 + NUDSL==500. +] ;KSRM03 +IFSN MACH,ASK,[ +IFNDEF NUDSL,[ PRINTC /No known configuration for "MACH". +/ ]] +TERMIN +] ;IF1 + +SETF [Readin Mode Paper Tape?]HRIFLG +SETF [Assemble BOOT? (If no, full DSKDMP)]BOOTSW + +SETF [RH11/RP06 disk system?]RP06P +IFE RP06P,[ +SETF [RH11/RM03 disk system?]RM03P +IFE RM03P,[ +SETF [RH10 (MC-KL) disk control?]RH10P +IFE RH10P,[ +SETF [AIKA disk control? (no => RP02/RP03)]DC10P +]]] +IFN RP06P, RM03P==0 +IFN RP06P+RM03P, RH10P==0 +IFN RP06P+RM03P+RH10P, DC10P==0 +IFN RP06P+RM03P+RH10P+DC10P, RP10P==0 +IFE RP06P+RM03P+RH10P+DC10P, RP10P==1 + +IFE BOOTSW, SETF [Number of dirs? (DM-KA: 200., ML-KA: 250., AI-KA: 440., all others: 500.)]NUDSL + +SETF [KS10 processor?]KS10P +IFE KS10P, SETF [KL10 processor? (no => KA10)]KL10P +IFN KS10P, KL10P==0 +IFN KS10P+KL10P, KA10P==0 +IFE KS10P+KL10P, KA10P==1 + +RH11P==:RP06P+RM03P + +DEFINE RP +IFN RP10P!TERMIN +DEFINE SC +IFN DC10P!TERMIN +DEFINE RH +IFN RH10P!TERMIN +DEFINE PH +IFN RH11P!TERMIN + +DEFINE KA +IFN KA10P!TERMIN +DEFINE KL +IFN KL10P!TERMIN +DEFINE KS +IFN KS10P!TERMIN + +IFN HRIFLG,[ +NOSYMS ;MAKE PAPER TAPE SHORTER +RIM10 +] + +C=1 ;C-A-B FOR LINKS +A=2 +B=3 +D=4 +BLKIN=5 ;PSEUDO-CORE BLOCK IN CBUF +WRITE=6 ;NEG MEANS DUMP, RH 0 OR WRBIT +DIFF=7 ;DIFF CONO ALSO TEMP +HEAD=10 ;HEAD CONO ALSO TEMP +P=11 ;JSP AC +BLOK=12 +UNIT=13 ;UNIT AND M.A. DATAO +CMD=14 ;COMMAND CHAR +T=15 ;VERY TEMP +TT=16 ;ANOTHER JSP AC, ALSO VERY TEMP +BUFP=17 ;DBUF PNTR--LAST WORD USED + +IF1,[ ;DON'T TAKE A WEEK AND A HALF TO ASSEMBLE. +RP, .INSRT SYSTEM;RP10 > +SC, .INSRT SYSTEM;DC10 > +RH, .INSRT SYSTEM;RH10 > +PH, .INSRT SYSTEM;RH11 > +IFN RP06P, .INSRT SYSTEM;RP06 > +IFN RM03P, .INSRT SYSTEM;RM03 > +IFE BOOTSW, .INSRT SYSTEM;FSDEFS > +IFE BOOTSW, KL, .INSRT SYSTEM;EPT > +KS, .INSRT SYSTEM;KSDEFS > +KA, TTY==120 +] + +;PARAMETER FILE FOR DSKDMP + +MEMSIZ=1000000 ;ACTUAL SIZE OF MEM +IFNDEF DBGSW,DBGSW==0 ;1 TO DEBUG THIS WITH DDT +DDT==MEMSIZ-4000 +IFN DBGSW,MEMSIZ==MEMSIZ-10000 ;MOVE DOWN UNDER DDT IF DEBUG MODE +CORE==MEMSIZ-10000-<2000*NTUTBL> ;HIGHEST ADR ALWAYS IN CORE+1 +CORES==CORE_<-12> ;BLK # OF ABOVE (FIRST OF BLKS SWAPPED OUT FOR BUFFER AREAS) +NSWBL==4+NTUTBL ;# BLOCKS SWAPPED OUT FOR BUFFER AREAS, +1 FOR DSKDMP ITSELF +HIGH==MEMSIZ-100 ;HIGHEST ADR LOADED/DUMPED+1 + +NDSK==8 ;MAX POSSIBLE. L$n$ DEFINES WHICH ARE REALLY THERE +RP,ICWA=34 +RH,ICWA=34 + +PH, UBPG==:17 ; Use last (usable) page in Unibus map + +KA, LPM=102000,, +KA, LPMR=LPM 2, +KL, PAG=- + +DEFINE INFORM A,B +IF1,[ PRINTX  A = B +] TERMIN + +;COMMANDS ARE: +; L$file LOAD FILE INTO CORE +; T$file LOAD FILE INTO CORE AND GIVE SYMBOLS TO DDT AND START DDT +; M$file LOAD FILE INTO CORE WITHOUT CLEARING CORE FIRST, DOESN'T LOAD SYMBOLS +; K$file DELETE FILE +; D$file DUMP CORE INTO FILE +; I$file VERIFY FILE AGAINST CORE +; G$ START AT STARTING ADDRESS +; U$dir; LIST DIRECTORY +; F$ LIST CURRENT DIRECTORY +; S$ LIST PACK IDS THEN MFD +; nnn$ SET STARTING ADDRESS TO nnn +; L$n$ PUT DISK n ONLINE +; K$n$ TAKE DISK n OFFLINE + +;ERROR MESSAGES ARE: +; CMPERR VERIFY FAILED TO MATCH +; DIRFUL DIRECTORY FULL +; EOF UNEXPECTED EOF +; DIRNF DIRECTORY DOES NOT EXIST +; FNF FILE NOT FOUND +; PKNMTD FILE IS ON PACK THAT IS NOT MOUNTED +; CKSERR CHECKSUM ERROR +; DSKFUL DISK FULL +; NODDT CAN'T ADDRESS DDT SYMBOL TABLE (BUG) +; ?BUG? BUG +; SEEKFL DISK SEEK ERROR +; CLOBRD DISK READ ERROR +; CLOBWR DISK WRITE ERROR +; DIRCLB DIR NAME DIFFERS, TUT DISAGREES WITH DIR +; MFDCLB M.F.D. CLOBBERED +; DSKLUZ DISK LOSSAGE (OFFLINE OR UNSAFE OR MASSBUS ERROR) + +KS, LOC 4000 ; Avoid MTBOOT and KSRIM + +IFE BOOTSW,[ +ZZZ: IFE DBGSW,[ + MOVE T,.... ;THIS CODE BLTS THE FOLLOWING OFFSET CODE + BLT T,MEMSIZ-1-1 ;INTO HIGH MEMORY AND WRITES DSKDMP ON ITS + MOVE T,PROG+MEMSIZ-2-BEG+1 + MOVEM T,BEG+MEMSIZ-2-BEG+1 ;AVOID LOSING DUE TO -1 BLT LOSSAGE +] + MOVSI T,-NDSK+1 ;MAKE ALL BUT DISK 0 BE DEAD (MUST DO L$ TO MAKE THEM ALIVE) + SETOM QDED+1(T) + MOVNS QDED+1(T) + AOBJN T,.-2 + SETZM QDED+0 +RP,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 + DATAO DPC,SUNIT0 + DATAI DPC,B + TRNN B,RP03BT + JRST WBOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +WBOOT1: HLLZS BOOT0 + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DPC,ALLER +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +PH,[ MOVEI T,%HYCLR ; Clear controller + IOWRQ T,%HRCS2 ; (Selects drive 0) +WBOOT0: IORDQ T,%HRCS1 + TRNN T,%HXDVA + JRST WBOOT0 ; Await drive available (well, it is a dual + ; ported drive... perhaps someday?) + MOVEI UNIT,BEG + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ; FIRST BLOCK AFTER CORE BUFFER IS WHERE + ; DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + IORDQ TT,%HRCS1 + TRNE TT,%HXTRE+%HXMCP +IFN DBGSW, JRST DDT +IFE DBGSW, JRST 4,. ; Formerly JRST MEMSIZ-400 (??) + JRST BEG +];PH +RH,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 +WBOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST WBOOT0 ;AWAIT DRIVE AVAILABLE + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DSK,%HIERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +SC,[ MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + MOVEI BLOK,NBLKS+NSWBL + MOVEI WRITE,60 + JSP TT,WRD3 + MOVEI BLOK,NBLKS+NSWBL+1 + MOVEI WRITE,60 + JSP TT,WRD3 + DATAO DC0,..... + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG + +.....: DJMP .+1 + DWRITE + DCOPY ......(-LRIBLK_2&37774) + DHLT + +......: DWRITE+DUNENB+DADR ;FOR READIN + DCOPY BEG(-2000_2&37774) + DREAD+DADR1 + DCOPY BEG(-2000_2&37774) + DHLT +];SC + +IFE DBGSW,[ +....: PROG,,BEG + +KA, LOC 2000 ; MAKE OFFSET CONVENIENT +KL, LOC 2000 +KS, LOC 6000 ; Avoid MTBOOT and KSRIM +PROG: OFFSET CORE+<*2000>-. +]IFN DBGSW,LOC MEMSIZ-2000 + +BEG: +KA,[ CONO 635550 ;ENTER HERE, CLEAR WORLD + JRST .+1 + JFCL 1,[JRST 4,.] ;A PDP6?? + LPMR [0]-2 ;TURN OFF EXEC PAGING +] +KL,[ CONO 327740 ;CLEAR APR + CONSZ PAG,660000 ;PAGING AND CACHE BETTER BE OFF + JRST 4,. +] +KS,[ CONO 127760 ; Enable, and Clear all. + RDEBR B + TRNE B,60000 ; Paging and Tops-20 better be off. + JRST 4,. + SETZM 8SWIT0 ; Clear 8080 Communications area to prevent + MOVE B,[8SWIT0,,8SWIT0+1] ; mysterious IO behavior. + BLT B,8RHBAS-1 + ;; If the machine has just been powered on, there is likely to be + ;; bad parity all over the place. I guess that isn't our problem + ;; as long as we don't touch any of it... +] + MOVSI B,-NDSK ;FOR NUMBER OF DISKS + SETOM PKNUM(B) ;SET DISK TO UNKNOWN + AOBJN B,.-1 + MOVE T,[JRST LOADG1] ;SET BOOTSTRAP TO MIDDLE OF WORLD + MOVEM T,BOOT + MOVE D,['DSKDMP] ;ANNOUNCE SELF + JSP TT,PD + JRST READ ;CRLF AND BEGIN READING COMMANDS + +ERROR: 0 + CLEARM MEMSIZ-1 ;DON'T READ ANY MORE COMMANDS FROM MEMORY + SOS T,ERROR ;PICK UP ERROR CODE FROM THE AC FIELD OF + LDB T,[270400+T,,] ;THE JSR ERROR + MOVE D,ERMESS(T) + JSP TT,PD ;PRINT OUT APPROPRIATE COMMENT + CAIL T,EBUG + JRST READ ;BAD ERROR - NO MORE DISKING +LOADG1: +KA, DATAI TTY,C ;FLUSH RANDOM CHARACTER +KS, SETZM 8CTYIN ; ".RESET" + TRO CMD,10 ;MAKE SURE PSEUDO-CORE IN CORE + JRST LOADG ;BY SIMULATING END OF LOADING, NON-GOING COMMAND + +ERMESS: IRP XX,,[ECMP,EDIR,EEOF,ESNF,EFNF,EPNM,ECKS +EDSK,EDDT,EBUG,EC63,ECRD,ECWR,ECDR,EMFC,EDLZ]YY,,[CMPERR,DIRFUL +EOF,DIRNF,FNF,PKNMTD,CKSERR,DSKFUL,NODDT,?BUG?,SEEKFL +CLOBRD,CLOBWR,DIRCLB,MFDCLB,DSKLUZ] +XX==.-ERMESS + SIXBIT \YY\ +TERMIN + +PD: JSP P,CRLF ;TYPE A CR +PD2: MOVEI C,40 + JSP P,TYO ;AND A SPACE + MOVE B,[440600,,D] +PD1: ILDB C,B ;AND THE SIXBIT CONTENTS OF D + ADDI C,40 + JSP P,TYO + TLNE B,770000 + JRST PD1 + JRST (TT) + +PNO: +C12: IDIVI C,10. ;PRINT CONTENTS OF C AS A TWO-DIGIT + DPB C,[60600,,A] ;DECIMAL NUMBER PRECEDED + MOVEI D,(SIXBIT /#00/+A) ;BY # + MOVE B,[300600,,D] + JRST PD1 + +WRCB: MOVEI UNIT,CBUF ;WRITE OUT CONTENTS OF CBUF + LSH BLKIN,-12 ;ON APPROPRIATE BLOCK + HRRZ BLOK,CBLK + ADDI BLOK,-CORES(BLKIN) + JRST WRM + +LODUMP: MOVEI UNIT,CORE ;DEPENDING ON SIGN BIT OF WRITE, LOAD OR DUMP + HRRZ BLOK,CBLK ;PSEUDO-CORE (766000-775777) +LODMP1: JSP TT,WRDM + ADDI UNIT,2000 + CAIGE UNIT,BEG + AOJA BLOK,LODMP1 + MOVEI BLKIN,CORE + JRST (P) + +FD: HRRZ C,B ;SET UP POINTER IN C TO FETCH OR DEPOSIT + ;CONTENTS OF ADDRESS IN RIGHT HALF OF B +IFN DBGSW, SKIPGE WRITE ;LOAD DDT WHEN IN DEBUG MODE + CAIGE C,HIGH + CAIGE C,40 + JRST (P) + CAIGE C,CORE ;IF ADDR IS IN REAL CORE, RETURN IMMEDIATELY + JRST 1(P) +FDX: CAIL C,(BLKIN) ;ADDR IS IN PSEUDO-CORE--CHECK IF RIGHT + CAILE C,1777(BLKIN) ;BLOCK IS IN CBUF + JRST FD3 ;IT'S NOT THERE--READ IT IN +FD4: SUBI C,-CORE(BLKIN) ;IT'S THERE--SET UP RIGHT POINTER IN C + JRST 1(P) ;AND RETURN +FD3: JUMPLE WRITE,FD3A ;IF DUMP OR VERIFY DON'T BOTHER + ;TO WRITE OUT CURRENT BLOCK +FD3B: JSP TT,WRCB ;IF LOAD, WRITE CURRENT BLOCK FIRST +FD3A: MOVEI UNIT,CBUF + MOVE BLKIN,C + ANDI BLKIN,776000 + LDB BLOK,[121000,,BLKIN] + ADD BLOK,CBLK + MOVEI BLOK,-CORES(BLOK) + JSP TT,RDM ;READ IN CORRECT BLOCK + JRST FD4 ;SET UP POINTER AND RETURN + +GBP: IDIVI C,6 ;TURN USER DIRECTORY CHARACTER ADDR IN C + IMULI A,-60000 ;INTO A BYTE POINTER + HRLI C,440600(A) + ADDI C,DIR+UDDESC + JRST (TT) + +WD: AOBJN BUFP,WD1 ;READ, WRITE, OR VERIFY WORD IN D FROM, INTO, + JSP TT,NXTBLK ;OR AGAINST WORD IN DBUF + JSP TT,WRDB ;TIME TO REFILL OR EMPTY DBUF + MOVSI BUFP,-2000 ;RESET BUFFER POINTER +WD1: JUMPG WRITE,WD2 ;JUMP ON LOAD + JUMPL WRITE,WD3 ;JUMP ON WRITE + CAME D,DBUF(BUFP) ;HERE IF VERIFY + JSR ECMP,ERROR ;VERIFY COMPARE LOST + JRST (P) +WD2: SKIPA D,DBUF(BUFP) ;LOAD +WD3: MOVEM D,DBUF(BUFP) ;DUMP + JRST (P) + +NXTTUT: HRRZ B,CU ;SELECT NEXT UNIT AND READ ITS TUT + AOJ B, + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + CAIN B,@MU + JRST 1(TT) ;SKIP IF NO MORE + SKIPE QDED(B) + JRST NXTTUT ;UNIT NOT ON LINE +RDTUT: MOVEI BLOK,TUTBLK ;READ TUT OF CURRENT UNIT + MOVEI UNIT,TUT + SETOM PKNUM(B) ;ALWAYS READ HEADER FOR TUT +IFG NTUTBL-1,[ ;READ IN MULTI-BLOCK TUT + HRRM TT,RDTUTX ;SAVE RETURN ADDRESS +REPEAT NTUTBL-1,[ + JSP TT,RD + ADDI UNIT,2000 + AOS BLOK +] +RDTUTX: MOVEI TT,. +] + JRST RD + +NXTBW3: 0 + IBP DIRPT ;DO AN IDPB T,DIRPT CHECKING TO SEE IF + LDB DIFF,[1200,,DIRPT] ;RUNNING INTO NAME AREA + CAML DIFF,DIR+UDNAMP + JSR EDIR,ERROR + DPB T,DIRPT + JRST @NXTBW3 + +NXTBW: MOVE BLOK,LBLOCK ;FIND NEXT FREE BLOCK TO WRITE + MOVEI HEAD,1(BLOK) + ILDB T,TUTPT + JUMPN T,NXTBW1 ;JUMP IF VERY NEXT BLOCK NOT FREE + AOSG T,BLKCNT +NXTBW5: SOJA HEAD,NXTBW4 ;GENERATE LOAD ADR IF FIRST TIME (COMPENSATE FOR LBLOCK OFF BY 1) + CAIG T,UDTKMX-1 + JRST NXTBW2 ;NO NEED TO MODIFY DIRECTORY YET + CLEARM BLKCNT ;14 IN A ROW--RESET COUNTER AND +NXTBW6: JSR NXTBW3 ;DPB BYTE INTO DIRECTORY +NXTBW2: MOVE BLOK,HEAD + CAML BLOK,TUT+QLASTB + JSR EDSK,ERROR ;NO MORE DISK LEFT + MOVEI T,1 + DPB T,TUTPT ;MARK BLOCK USED IN TUT + JRST WRDB1 + +NXTBW1: ADDI HEAD,1 ;SEARCH FOR NEXT FREE BLOCK + ILDB T,TUTPT + JUMPN T,NXTBW1 + SUBM HEAD,BLOK + SKIPLE T,BLKCNT ;COME UP WITH DESC BYTE FOR LAST FEW BLOCKS + JSR NXTBW3 + CLEARM BLKCNT + JUMPL T,NXTBW5 ;FIRST TIME + MOVEI T,UDTKMX-1(BLOK) + CAIGE T,UDWPH ;CAN WE SAY SKIP N--TAKE 1? + JRST NXTBW6 ;YES +NXTBW4: MOVEI BLOK,NXLBYT + MOVE T,HEAD + ROT T,-NXLBYT*6 + ADDI T,UDWPH+1 + JSR NXTBW3 + ROT T,6 + SOJG BLOK,.-2 + JRST NXTBW6 + +NXTBLK: JUMPL WRITE,NXTBW ;GET NEXT BLOCK OF FILE--IF DUMP, FIND FREE + MOVE BLOK,LBLOCK ;BLOCK +NXTB6: SOSLE BLKCNT ;HAVE WE RUN OUT OF "TAKE N"? + AOJA BLOK,WRDB1 ;NO--TAKE NEXT BLOCK + ILDB T,DIRPT ;YES--GET NEXT DESC BYTE + CAILE T,UDWPH + JRST NXTB1 ;IT'S A LOAD ADDR + CAIE T,UDWPH + JUMPN T,NXTB2 ;IT'S A TAKE OR SKIP + CAIE CMD,'D ;IT'S 0 OR NULL--IF THIS IS A LOAD, IT'S AN + CAIN CMD,'K ;UNEXPECTED END OF FILE + JRST KILL1 ;IF DUMP OR KILL, O.K. + JSR EEOF,ERROR + +NXTB1: MOVEI BLOK,-UDWPH-1(T) ;LOAD ADR + MOVEI BUFP,NXLBYTS +NXTB1A: MOVEI T,0 + CAIE CMD,'D + CAIN CMD,'K + DPB T,DIRPT ;IF KILLING FILE, ZERO THIS BYTE (OTHERS ZEROED AT KILL) + LSH BLOK,6 + ILDB T,DIRPT + ADD BLOK,T ;GET COMPLETE BLOCK NUMBER + SOJG BUFP,NXTB1A + JRST NXTB3 + +NXTB2: MOVEM T,BLKCNT + CAIG T,UDTKMX + AOJA BLOK,WRDB1 ;TAKE N STARTING WITH NEXT ONE + ADDI BLOK,-UDTKMX+1(T) ;SKIP N- AND TAKE 1 +NXTB3: CLEARM BLKCNT +WRDB1: MOVEM BLOK,LBLOCK + JRST (TT) + ;RP10 IO ROUTINE +RP,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: DPB WRITE,[360600,,DBLK] ;SET OP, UNIT SEL + DPB WRITE,[DUNFLD SEEK] + DPB WRITE,[DUNFLD RECAL] + HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + MOVEM UNIT,@ICWA + SOS @ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + DPB DIFF,[DCYL SEEK] + DATAO DPC,CLATT ;CLEAR ATTENTIONS + LSH DIFF,-8 ;EXTRA CYLINDER BIT FOR RP03 + DPB DIFF,[DCYLXB DBLK] + DPB DIFF,[DCYLXB SEEK] + DATAO DPC,SEEK + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + DATAO DPC,CLATT + TLNN DIFF,(ONCYL) + JRST WRD0 + DATAO DPC,DBLK + CONSO DPC,DONE + JRST .-1 + CONSO DPC,ALLER + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: AOSLE ERRCT + JSR EC63,ERROR + DATAO DPC,RECAL + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + JRST WRD5 + +DBLK: ICWA +SEEK: DSEEKC +RECAL: DRCALC +CLATT: DEASEC ALLATT +];RP + ;RH11 IO ROUTINE +PH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: TRNE UNIT,1777 ; Better be on a page boundary! + JRST 4,. + LDB DIFF,[111100,,UNIT] ; Point Unibus map at page in question + TRO DIFF,%UQFST+%UQVAL + IOWRQ DIFF,UBAPAG+UBPG_1 + ADDI DIFF,1 + IOWRQ DIFF,UBAPAG+UBPG_1+1 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + JSP HEAD,RHCHEK ; Check for immediate trouble + MOVEI DIFF,%HMRDP ; Init the drive + IOWRQ DIFF,%HRCS1 + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVNI DIFF,4000 + IOWRQ DIFF,%HRWC ; 4000 half words + MOVEI DIFF,UBPG_14 + IOWRQ DIFF,%HRBA ; "Byte" base address + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + IOWRQ DIFF,%HRCYL ; Desire cylinder + MOVE DIFF,HEAD + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB DIFF,[$HATRK HEAD] + IOWRQ HEAD,%HRADR ; Desire track and sector + MOVEI DIFF,%HMRED + TRNE WRITE,10 + MOVEI DIFF,%HMWRT + IOWRQ DIFF,%HRCS1 ; Do it (implied seek) +WRD7: IORDQ DIFF,%HRCS1 + TRNN DIFF,%HXRDY ; Wait for controller to finish + JRST WRD7 + TRNN DIFF,%HXTRE+%HXMCP ; Trouble? + JRST WRDX ; Nope, exit + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVEI DIFF,%HYCLR ; Clear controller + IOWRQ DIFF,%HRCS2 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + MOVEI DIFF,%HMCLR ; Clear drive + IOWRQ DIFF,%HRCS1 + JSP HEAD,RHCHEK ; Immediate lossage? + MOVEI DIFF,%HMREC ; Recalibrate + IOWRQ DIFF,%HRCS1 + MOVEI HEAD,100000. +WRD0A: SOSGE HEAD + JSR EC63,ERROR + IORDQ DIFF,%HRSTS + TRNE DIFF,%HSPIP ; WAIT FOR DRIVE TO FINISH + JRST WRD0A + ANDI DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY+%HSERR + CAIE DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY + JSR EDLZ,ERROR + JRST WRD5 + +;;; JSP HEAD,RHCHEK to check for errors. +RHCHEK: IORDQ DIFF,%HRCS1 + TRNE DIFF,%HXTRE+%HXMCP + JSR EDLZ,ERROR + JRST (HEAD) +];PH + ;RH10 IO ROUTINE +RH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + CONI DSK,HEAD ;SET WORD COUNT TO ONE BLOCK + TLNE HEAD,(%HID22) ;ACCORDING TO TYPE OF CHANNEL + HRLI UNIT,-2000_4 + MOVEM UNIT,@ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + SOS @ICWA ;ADJUST FOR DF10 LOSSAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMRDP ;INIT THE DRIVE + JSP HEAD,RHSET + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + EXCH DIFF,HEAD + MOVEM HEAD,DBLK ;SAVE CYLINDER + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + EXCH DIFF,HEAD + DPB HEAD,[$HATRK DIFF] + TLO DIFF,%HRADR(UNIT) + JSP HEAD,RHSET + MOVE DIFF,DBLK + TLO DIFF,%HRCYL(UNIT) + JSP HEAD,RHSET + MOVSI DIFF,%HRCTL(UNIT) + IORI DIFF,ICWA_6 + TRNE WRITE,10 + TROA DIFF,%HMWRT + TRO DIFF,%HMRED + JSP HEAD,RHSET ;DO IT (USE IMPLIED SEEK) + CONSO DSK,%HIDON + JRST .-1 + CONSO DSK,%HIERR + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMCLR + JSP HEAD,RHSET + MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMREC + JSP HEAD,RHSET + MOVEI DIFF,100000. + MOVEM DIFF,DBLK +WRD0A: SOSGE DBLK + JSR EC63,ERROR + MOVSI DIFF,%HRSTS(UNIT) + JSP HEAD,RHGET + TRNE DIFF,%HSPIP + JRST WRD0A + ANDI DIFF,%HSVV+%HSRDY+%HSMOL+%HSERR + CAIE DIFF,%HSVV+%HSRDY+%HSMOL + JSR EDLZ,ERROR + JRST WRD5 + +;RH10 HACKING ROUTINES. CALL BY JSP HEAD,. DIFF HAS REGISTER ADDRESS IN LH, DATA IN RH. +RHSET: TLOA DIFF,%HRLOD +RHGET: TLZ DIFF,%HRLOD + DATAO DSK,DIFF + MOVEI DIFF,20 + SOJG DIFF,. + DATAI DSK,DIFF + TLNE DIFF,%HDERR + JSR EDLZ,ERROR + ANDI DIFF,177777 + JRST (HEAD) + +DBLK: 0 +];RH + ;SC DISK IO ROUTINE +SC,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,60#120 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,60#120 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: TRC WRITE,120 +WRD3: DPB WRITE,[330700,,DBLK] ;SET OP, UNIT SEL + DPB UNIT,[DCCA DBLK+1] ; & CORE ADDR + DPB UNIT,[DCCA DBLK1+1] + LDB UNIT,[400,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + CONO DC0,DCCSET\DCDENB ;RESET ALL, THEN SET DCDENB + CAIL DIFF,NCYLS + TDZA DIFF,DIFF + SKIPLE DIFF,PKNUM(UNIT) + JRST WRD4 ;PKID IN + MOVE DIFF,QTRAN(UNIT) ;READ PACK ID + DPB DIFF,[DUNFLD GPKID] + MOVEI DIFF,TUTCYL + SKIPGE QTRAN(UNIT) + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL GPKID] + DATAO DC0,[DJMP GPKID] + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR + JRST WRD0 + CONO DC0,DCCSET\DCDENB ;RESET POSSIBLE "FUTURE" IP OR RLCERR + LDB DIFF,[DPKID RPKID] + MOVEM DIFF,PKNUM(UNIT) +WRD4: DPB DIFF,[DPKID DBLK] + MOVE DIFF,DBLK + DPB DIFF,[3300,,DBLK1] + MOVE DIFF,QTRAN(UNIT) + DPB DIFF,[DUNFLD DBLK] + JUMPGE DIFF,WRD4A + LDB DIFF,[DCYL DBLK] ;2ND HALF UNIT + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL DBLK] +WRD4A: DATAO DC0,[DJMP DBLK] + CONSZ DC0,DSSACT + JRST .-1 + CONSO DC0,DSSERR + JRST WRDX ;XFER OK + MOVE DIFF,ERRCT + TRNN DIFF,2 ;DO RECALIBRATE 2 OUT OF 4 RETRIES + JRST WRD2 +WRD0: AOSLE ERRCT ;POSITIONER ERROR--CHECK ERROR COUNT + JSR EC63,ERROR ;TOO MANY--GIVE UP + DATAO DC0,[DSPC+DSRCAL+DSWINF] + CONSO DC0,DSSATT + JRST .-1 + JRST WRD5 ;TRY AGAIN AFTER RESETTING UNIT + +WRD2: HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,40 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: DPB BLOK,[XWBLK XWDS] ;PNTR TO PREV BLOCK + LDB UNIT,[DCCA DBLK+1] ;RESTORE ADR + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +DBLK: DREAD+DUNENB + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) +DBLK1: DRC + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) + DHLT + +GPKID: DSPC+DSCRHD+DSWIDX+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +];SC + +;JSP P,TYI RETURNS CHAR IN C. +;JSP P,TYI0 ALSO SKIPS IF NO INPUT AVAILABLE. +TYI: ILDB C,MEMSIZ-1 ;CHECK FOR COMMANDS FROM MEMORY + JUMPN C,(P) ;FOUND ONE--RETURN + CLEARM MEMSIZ-1 +TYI0: ;ENTRY TO SKIP IF NO INPUT AVAILABLE +KA,[ CONSO TTY,40 + JRST TYI1 + DATAI TTY,C +] +KS,[ SKIPN C,8CTYIN + JRST TYI1 + ANDI C,177 + SETZM 8CTYIN +] +KL,[ MOVEI C,3400 ;DDT MODE INPUT + SETZM DTEFLG + MOVEM C,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE C,DTEF11 + SETZM DTEFLG + JUMPE C,TYI1 +] ANDI C,177 + CAIGE C,175 + CAIN C,33 + JRST (P) ;DON'T ECHO GRITCHES +;DROP INTO TYO + +;JSP P,TYO TYPES OUT CHAR IN C. CLOBBERS A,C. +TYO: ;SKIPE MEMSIZ-1 + ; JRST (P) ;DON'T ECHO COMMANDS FROM MEMORY +KA,[ HRRZ A,C ;COMPUTE PARITY + IMULI A,40201 + AND A,[1111111] + IMUL A,[1111111] + TLNE A,1 + IORI C,200 + CONSZ TTY,20 + JRST .-1 + DATAO TTY,C + ANDCMI C,200 +] +KS,[ MOVE A,C + ANDI A,177 + TRO A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 +] +KL,[ MOVE A,C + ANDI A,177 + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SETZM DTEFLG +] + JUMPGE C,(P) ;CHECK FOR CRLF (AS OPPOSED TO ECHOING A CR) + SKIPA C,C12 ;TYPE AN LF +CRLF: HRROI C,15 + JRST TYO + +TYI1: HRRZ C,-1(P) ;NO INPUT AVAILABLE + CAIE C,TYI0 + JRST TYI ;WAIT FOR IT + JRST 1(P) ;CALL WAS TO TYI0, SKIP RETURN + +LINK: CAIE CMD,'D + CAIN CMD,'K + MOVSI WRITE,-1 ;MAKE THIS INFO MORE CONVENIENT + MOVE D,[440600,,C] + MOVEI T,0 +LINKL: ILDB TT,DIRPT + SKIPGE WRITE + DPB T,DIRPT ;CLOBBER CHARS READ FOR DUMP OR KILL + CAIN TT,'; + JRST LINKN + CAIN TT,': + JRST LINKQ + JUMPE TT,LINKN +LINKQ1: IDPB TT,D + TLNE D,770000 + JRST LINKL +LINKN1: CAMGE D,[600,,B] ;THROUGH WITH FN2? + JRST LINKL + JUMPL WRITE,KILL1 + MOVEM A,FN1 + MOVEM B,FN2 + JRST MLOOK2 + +LINKN: TLNN D,770000 + JRST LINKN1 + IDPB T,D ;FILL OUT WITH SPACES + JRST LINKN + +LINKQ: ILDB TT,DIRPT + JUMPGE WRITE,LINKQ1 + DPB T,DIRPT + JRST LINKQ1 + +READ: MOVEI BLKIN,CORE + JSP P,CRLF + MOVEI CMD,0 ;INITIALIZE COMMAND +READ1A: MOVEI WRITE,0 ;INITIALIZE NUMBER + MOVSI B,(SIXBIT \@\) ;INITIALIZE 1ST FILE NAME +READ1: MOVEM B,FN1 +READ3A: MOVSI B,(SIXBIT \@\) ;INITIALIZE CURRENT FILE NAME + MOVE D,[440600,,B] +READ2: JSP P,TYI + CAIN C,177 + JRST READ ;IF RUBOUT START OVER + CAIGE C,175 + CAIN C,33 + JRST ALTMOD ;JUMP IF 33, 175, 176 + ASH WRITE,3 ;DOES NOT CHANGE SIGN OF WRITE + CAIL C,"0 + CAILE C,"7 + TLOA WRITE,400000 ;NON-NUMERIC CHAR--MAKE WRITE NEGATIVE + ADDI WRITE,-"0(C) ;NUMERIC CHAR--ACCUMULATE NUMBER + CAIN C,"; + JRST READ3 ;SET SYSTEM NAME + CAIN C,40 + JRST READ1 ;SET FIRST FILE NAME + CAIN C,^Q + JSP P,TYI ;QUOTED CHARACTER + CAIGE C,140 ;CHECK FOR LOWER CASE + SUBI C,40 + JUMPL C,DOIT ;IF LESS THAN 40 (EXC. ^Q) END OF COMMAND + TLNE D,770000 ;SKIP IF ALREADY SIX CHARS + IDPB C,D + JRST READ2 + +READ3: MOVEM B,SYSN + CAIE CMD,'U + JRST READ3A + JRST DOIT ;IF COMMAND IS U GO LIST DIRECTORY + +ONOFF: CAIGE WRITE,NDSK + DPB CMD,[100,,QDED(WRITE)] ;LOW BIT OF CMD DETERMINES ON/OFF LINE STATUS + JRST READ ; (K=13, L=14) + +ALT1: LDB CMD,D ;PICK UP COMMAND CHAR + CAIE CMD,'K + TRNN CMD,2 + JRST READ1A ;GET FILE NAME + JRST DOIT ;DON'T WANT FILE NAME--GO TO WORK + +ALTMOD: MOVEI C,"$ + JSP P,TYO ;ECHO DOLLAR SIGN + JUMPLE WRITE,ALT2 ;JUMP IF NOT LAST TYPED + JUMPN CMD,ONOFF ;JUMP IF + HRRM WRITE,SADR ;SET STARTING ADDR + JRST READ + +ALT2: TLC D,360000 + TLCN D,360000 ;SKIP IF SINGLE CHARACTER BEFORE + JUMPE CMD,ALT1 ;JUMP IF NO COMMAND ALREADY TYPED +DOIT: MOVEM B,FN2 ;STORE SECOND FILE NAME + HRRZ B,MU + HRRM B,CU ;MAKE MASTER UNIT CURRENT UNIT + MOVNI WRITE,1 + JSP P,LODUMP ;DUMP OUT PSEUDO-CORE + CAIN CMD,'G + JRST LOADG0 ;GO + JSP TT,RDTUT + MOVE C,SYSN +MLOOK2: MOVSI WRITE,1 ;MAKE WRITE INDICATE LOAD + MOVEI BLOK,MFDBLK + MOVEI UNIT,DIR + JSP TT,RD ;READ MASTER DIRECTORY TO FIND WHERE USER DIRECTORY IS + MOVE T,DIR+MDCHK + CAME T,[SIXBIT/M.F.D./] + JSR EMFC,ERROR + MOVE T,DIR+MDNUDS + CAIE T,NUDSL + JSR EMFC,ERROR + CAIN CMD,'S + JRST LISTS ;LIST DISK ID'S AND SYSTEM NAMES + MOVE T,DIR+MDNAMP +MLOOK: CAMN C,DIR+MNUNAM(T) ;LOOK UP SYSTEM NAME + JRST MLOOK1 + ADDI T,LMNBLK + CAIGE T,2000 + JRST MLOOK + JSR ESNF,ERROR ;NOT FOUND + +MLOOK1: MOVEI BLOK,2*NUDSL-2000(T) ;CONVERT USER SLOT TO BLOCK NUMBER + LSH BLOK,-1 + HRRM BLOK,UDBLK ;REMEMBER FOR KILL OR DUMP + MOVEI UNIT,DIR + JSP TT,RDM ;READ USER DIRECTORY +ULOOK: CAME C,DIR+UDNAME + JSR ECDR,ERROR ;WRONG ONE?? + CAIE CMD,'F + CAIN CMD,'U + JRST LISTFC ;LIST USER DIRECTORY + MOVSI TT,UNIGFL + MOVE T,DIR+UDNAMP + MOVE A,FN1 + MOVE B,FN2 +ULOOK1: CAMN A,DIR+UNFN1(T) ;LOOK UP FILE NAME + CAME B,DIR+UNFN2(T) + JRST ULOOK2 + TDNN TT,DIR+UNRNDM(T) ;IS THIS FILE FOR REAL? + JRST ULOOK3 +ULOOK2: ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK1 + CAIE CMD,'D ;IF NOT FOUND BETTER BE DUMP + JSR EFNF,ERROR + MOVE T,DIR+UDNAMP +ULOOK4: SKIPN DIR+UNFN1(T) ;FIND FREE SLOT FOR NEW FILE + JRST DUMP + ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK4 + MOVNI T,LUNBLK ;NO FREE SLOTS--TRY TO EXTEND NAME AREA DOWN + ADDM T,DIR+UDNAMP + MOVE T,DIR+UDESCP + IDIVI T,6 + ADDI T,UDDESC + CAMGE T,DIR+UDNAMP ;DID WE RUN INTO DESCRIPTOR AREA? + JRST DUMP0 + JSR EDIR,ERROR ;YES + +ULOOK3: HRRM T,DMP4 ;IF FILE FOUND, SAVE SLOT NUMBER FOR DUMP + LDB C,[UNDSCP DIR+UNRNDM(T)] + JSP TT,GBP + MOVEM C,DIRPT ;SET UP DESCRIPTOR AREA BYTE POINTER + MOVSI TT,UNLINK + TDNE TT,DIR+UNRNDM(T) + JRST LINK ;FILE IS A LINK + LDB A,[UNPKN DIR+UNRNDM(T)] +ULOOK5: CAMN A,TUT+QPKNUM ;SEE IF IT'S MOUNTED + JRST LOAD + JSP TT,NXTTUT + JRST ULOOK5 + JSR EPNM,ERROR + +LOAD: CAIE CMD,'D ;GET HERE IF FILE FOUND + CAIN CMD,'K ;IF DUMP OR KILL, DELETE IT + JRST KILL +ZERO: MOVEI TT,CORE-1 + TRNN CMD,20 ;SKIP IF T$ SYMBOL LOADING COMMAND + JRST ZERO1 + MOVEI B,DDT-1 ;ASSUME ALWAYS USING MOBY DDT + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAME B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSR EDDT,ERROR + SKIPE D,-2(C) ;FLUSH ALL BUT INITIAL SYMBOLS + MOVEM D,-1(C) + MOVE D,-1(C) + MOVEI TT,CORE-1 + CAILE TT,-1(D) + MOVEI TT,-1(D) ;DON'T ZERO SYMBOL TABLE NOR DDT +ZERO1: TRNE CMD,1 + JRST LOAD1 ;NON-ZEROING COMMAND + SETZM 40 ;BEGIN CLEARING CORE + MOVE T,[40,,41] ;SET UP BLT POINTER +;CODE TO SKIP OVER NXM +ZERO2: CAIG TT,10*2000-1(T) ;MORE THAN 8K LEFT TO ZERO? + JRST ZERO4 ;NO, ZERO REMAINING WORDS AND PROCEED + MOVE D,T ;AVOID KA/KL INCOMPAT BY COPYING BLT PNTR + BLT D,10*2000-1(T) ;ZERO NEXT 8K +ZERO3: ADDI T,10*2000 ;MOVE DEST OF BLT PNTR UP 8K + ANDCMI T,1777 ;ROUND DOWN TO 1K BOUNDARY +KA, CONO 10000 ;CLEAR NXM + MOVES (T) ;SET NXM IF HOLE +KA, CONSZ 10000 ;NXM GENERATED? +KA, JRST ZERO3 ;YES, GO TO NEXT 8K + JRST ZERO2 ;NO, CLEAR THIS 8K + +ZERO4: BLT T,(TT) ;AND CLEAR TO TOP BOUNDARY + TRNE CMD,20 + JRST LOAD1 ;IF SYMBOL-LOADING COMMAND, STOP THERE + CLEARM CBUF + MOVE T,[CBUF,,CBUF+1] + BLT T,CBUF+1777 + MOVEI UNIT,CBUF + MOVE BLOK,CBLK ;-NSWBL IN LH + JSP TT,WRM ;CLEAR PSEUDO-CORE + AOBJN BLOK,.-1 +LOAD1: SETZB BUFP,BLKCNT ;SET UP BUFP SO FIRST CALL TO WD WILL READ +LOAD2: JSP P,WD ;FIRST BLOCK OF FILE + CAME D,[JRST 1] ;LOOK FOR END OF SBLK LOADER + JRST LOAD2 + CAIN CMD,'I ;IF VERIFY, START SIMULATING DUMP + JRST DUMP.5 +LOAD3: JSP P,WD ;READ BLOCK HEADER + JUMPGE D,LOADS ;IT'S A JUMP BLOCK + MOVE A,D + MOVE B,D + JSR LOADB ;LOAD LOGICAL BLOCK INTO CORE + JRST LOAD3 + +LOADB: 0 +LOAD4: JSP P,WD ;LOAD A LOGICAL BLOCK--AOBJN POINTER IN B, + ROT A,1 ;BLOCK HEADER IN A (FOR CHECKSUM) + ADD A,D ;ADD NEW WORD INTO CHECKSUM + JSP P,FD ;AND PREPARE TO SMASH IT AWAY + JRST .+2 ;LOCATION CAN'T BE LOADED + MOVEM D,(C) ;SMASH WORD AWAY + AOBJN B,LOAD4 + JSP P,WD + CAMN A,D ;CHECK THE CHECKSUM + JRST @LOADB + JSR ECKS,ERROR ;BAD CHECKSUM + +LOADS: CAIN CMD,'M + JRST LOADG0 ;DON'T LOAD SYMBOLS NOR SADR + MOVEM D,NXTBW3 ;SAVE S.A. + MOVEI B,DDT-1 ;ASSUME IS ALWAYS MOBY DDT. + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + SKIPN (C) + JRST LOADJ ;AIN'T GOT NO DDT, IGNORE SYMBOLS + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAMN B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSP P,FD ;FETCH SYMBOL TABLE POINTER + JSR EDDT,ERROR + MOVE D,(C) + MOVEM D,DDTM2 +LOADS1: MOVE B,DDTM2 ;GET LOWEST SYMBOL LOC SO FAR + JSP P,WD ;GET SYMBOL BLOCK HEADER + JUMPGE D,LOADS2 ;JUMP IF END OF SYMBOLS + TRNE D,-1 ;SKIP IF REALLY SYMBOLS AND NOT SOME OTHER BRAIN-DAMAGED CRUFT + JRST LOADBD + MOVSS D + HRLI D,-1(D) + ADD B,D ;EFFECTIVELY SUBTRACTS LENGTH OF BLOCK FROM BOTH HALVES + MOVEM B,DDTM2 ;OF SYMBOL TABLE POINTER + HRL B,D ;SET UP AOBJN POINTER IN B + HRLZ A,D ;AND RECREATE HEADER IN A + JSR LOADB ;LOAD THE SYMBOLS + JRST LOADS1 + +LOADBD: HLRO B,D ;-# WORDS TO SKIP (NOT COUNTING CHECKSUM) + JSP P,WD + AOJLE B,.-1 + JRST LOADS1 ;TRY NEXT SYMBOL BLOCK + +LOADS2: MOVE D,DDTM2 ;GET UPDATED DDT SYMBOL PNTR +LOADS4: MOVEI B,DDT-2 ;WE KNOW WHERE IT ALWAYS GOES + JSP P,FD ;PUT BACK SYMBOL TABLE POINTER + JSR EBUG,ERROR ;CAN'T PUT IT BACK?? + MOVEM D,(C) + MOVEI B,DDT-4 ;GIVE STARTING ADDRESS TO DDT + JSP P,FD + JSR EBUG,ERROR + MOVE D,NXTBW3 + MOVEM D,(C) + MOVEI D,DDT ;AND SET DSKDMP START ADDRESS TO DDT +LOADJ: HRRM D,SADR ;SET STARTING ADDRESS FROM JUMP BLOCK +LOADG0: MOVE T,BOOTNS ;APPROP DISK WAIT FOR NON BUSY INSTR + MOVEM T,BOOT +LOADG: JSP TT,WRCB ;MAKE SURE ALL LOADED CRUFT IN PSEUDO-CORE IS OUT + MOVEI WRITE,0 + JSP P,LODUMP ;AND LOAD IT ALL IN + TRNE CMD,10 + JRST READ ;NON-GOING COMMAND +GO: +PH,[ MOVSI B,-LSWPADR +GO1: IORD DIFF,SWPCS1 + TRNN DIFF,%HXRDY ; Wait for controller + JRST GO1 + HRRZ DIFF,SWPVAL(B) + IOWR DIFF,SWPADR(B) + AOBJN B,GO1 +];PH +RH,[ MOVE B,ERRWD + CONI DSK,HEAD + TLNE HEAD,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +GO1: CONSZ DSK,%HIBSY + JRST .-1 + MOVE DIFF,SWPOU1(B) + JSP HEAD,RHSET + AOBJN B,GO1 +];RH +RP,[ MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPOU1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPOU2 +];RP +SC, DATAO DC0,[DJMP SWPOUT] + JRST WAIT + +LISTS: JSP P,CRLF +LISTS2: JSP P,TYI0 + JRST LOADG1 ;SHUT UP IF KEY HIT + MOVE C,TUT+QPKNUM ;TYPE PACK NUMBER + JSP TT,PNO + MOVE D,TUT+QPAKID ;AND I.D. + JSP TT,PD2 + JSP TT,NXTTUT ;SAME FOR ALL DIRECTORIES + JRST LISTS2 + MOVE T,DIR+MDNAMP +LISTS1: CAIGE T,2000 + JSP P,TYI0 ;STOP TYPING IF TTI FLAG ON + JRST LOADG1 + SKIPE D,DIR+MNUNAM(T) + JSP TT,PD ;TYPE OUT USER NAME + ADDI T,LMNBLK + JRST LISTS1 + +LISTFC: MOVE T,DIR+UDNAMP +LISTF1: +KA, CONSO TTY,40 ;STOP TYPING IF TTI FLAG ON +KS, SKIPN 8CTYIN ; Stop typing if character waiting + CAIL T,2000 + JRST LOADG1 + SKIPN DIR+UNFN1(T) ;SKIP IF FILE IN THIS SLOT + JRST LISTF2 + JSP P,CRLF + LDB C,[UNPKN DIR+UNRNDM(T)] + JSP TT,PNO ;TYPE PACK NUMBER + MOVE D,DIR+UNFN1(T) + JSP TT,PD2 ;TYPE FIRST FILE NAME + MOVE D,DIR+UNFN2(T) + JSP TT,PD2 ;AND SECOND FILE NAME +LISTF2: ADDI T,LUNBLK + JRST LISTF1 + +KILL: JSP TT,NXTB6 ;GET HERE ON KILL OR DUMP OF EXISTING FILE + MOVEI T,0 ;ZERO BYTES IN USER DIRECTORY DESCIPTOR AREA + DPB T,DIRPT ;NXTB6 JUMPS TO KILL1 AT END OF FILE + MOVE C,BLOK + JSP TT,GTP + ILDB T,C + CAIGE T,TUTLK-1 ;SOS USAGE OF THIS BLOCK + SOJL T,[JSR ECDR,ERROR] + DPB T,C + JRST KILL + +KILL1: HRRZ T,DMP4 ;CLEAR OUT USER DIRECTORY SLOT + CLEARM DIR+UNFN1(T) + CLEARM DIR+UNFN2(T) + CLEARM DIR+UNRNDM(T) + MOVSI WRITE,-1 + CAIN CMD,'K + JRST KILDMP ;IF KILL DON'T DUMP + JRST DMP4 ;MUST DUMP ON SAME UNIT + +DUMP0: MOVE T,DIR+UDNAMP ;GET HERE IF SLOT CREATED AT BOTTOM OF NAME AREA +DUMP: HRRM T,DMP4 ;GET HERE IF EMPTY SLOT FOUND IN NAME AREA +DMP0: MOVEI D,0 ;GET HERE IF USING SLOT OF OLD FILE +DMP1: ;MOVE C,TUT+QSWAPA + MOVEI C,0 ;NOTE START AT 0 NOT QSWAPA + MOVE B,C + SUB B,TUT+QLASTB + HRLZ B,B ;LH(B) COUNTS BLOCKS, RH(B) COUNTS FREE BLOCKS + JSP TT,GTP +DMP2: ILDB T,C + SKIPE T +KA, SUBI B,1 ;THIS RELIES ON CARRY PROPAGATING FROM RH TO LH IN AOBJN +KL, HRRI B,-1(B) ;ON KI10, KL10 CHANGE SUBI B,1 TO HRRI B,-1(B) +KS, HRRI B,-1(B) ;KS too... + AOBJN B,DMP2 + CAIG B,(D) ;RH OF D IS HIGHEST SO FAR, LH SAYS WHICH UNIT + JRST DMP5 ;NOT BETTER THAN RECORD + MOVE D,B ;NEW RECORD--RECORD IT + HRL D,CU +DMP5: JSP TT,NXTTUT ;TRY NEXT + JRST DMP1 + ;FALLS THROUGH AT END +DMP3: HLRM D,CU ;SET CURRENT UNIT TO ONE WITH MOST FREE BLOCKS + JSP TT,RDTUT ;GET ITS TUT +DMP4: MOVEI T,. + MOVE A,FN1 + MOVE B,FN2 + MOVEM A,DIR+UNFN1(T) ;PUT CRUFT INTO SLOT + MOVEM B,DIR+UNFN2(T) + SETOM DIR+UNDATE(T) ; Unknown creation date + HRROI C,777000 ; Unknown reference date + MOVEM C,DIR+UNREF(T) ; Unknown author, 36. bit bytes +SC,[ MOVEM A,XWDS+XWFN1 + MOVEM B,XWDS+XWFN2 + MOVE C,SYSN + MOVEM C,XWDS+XWSYSN +] MOVE C,DIR+UDESCP ;PUT DESCRIPTOR CHARACTER ADDRESS + MOVE B,TUT+QPKNUM ;AND PACK NUMBER + DPB B,[UNPKN C] + MOVEM C,DIR+UNRNDM(T) ;INTO USER DIRECTORY SLOT + ;MOVE C,TUT+QSWAPA ;COMMENTED OUT INSN DUMPS INTO FILE AREA + MOVEI C,0 ;DUMP INTO SWAPPING AREA TO AVOID Y FILES + MOVEM C,LBLOCK ;A DAEMON WILL COPY INTO FILE AREA AFTER SALVAGE + JSP TT,GTP + MOVEM C,TUTPT ;INITIALIZE TUT POINTER + MOVE C,DIR+UDESCP + JSP TT,GBP + MOVEM C,DIRPT ;INITIALIZE DESCRIPTOR AREA POINTER + SETOB WRITE,BLKCNT ;FORCE NXTBW TO LOAD ADR +KA, HRLOI BUFP,-2001-1 ;SET UP BUFP SO FIRST WORD GOES IN DBUF+0 +KL, HRLOI BUFP,-2001 +KS, HRLOI BUFP,-2001 + MOVE D,[JRST 1] + JSP P,WD ;END OF SBLK LOADER +;DROPS THROUGH + +;DROPS IN +DUMP.5: MOVSI WRITE,-'I(CMD) ;GET HERE IF VERIFY--SET WRITE NEGATIVE IF + MOVEI B,40 ;DUMP AND ZERO IF VERIFY--FIRST ADDR DUMPED IS 40 + HRRM B,DUMP4 + HLLOS DUMP6 + SETZM DUMP9S + SETZM DUMP9J + SETZM DUMP9K + MOVEI B,DDT-3 ;SET UP TO NOT DUMP SYMBOLS AS PART OF CORE IMAGE + JSP P,FD + JSR EBUG,ERROR + SKIPN A,(C) ;GET PNTR TO BUILT IN SYMBOLS + JRST DUMP4 ;NO DDT, DON'T HACK THIS + HRRM A,DUMP7 ;THIS IS WHERE WE START DUMPING AGAIN + MOVEM A,DUMP9K ;THIS WILL BE INITIAL SYMBOL TABLE PNTR WHEN DDT LOADED + MOVNI A,(A) + ADD A,1(C) ;GET MINUS SIZE OF NON-BUILTIN SYMBOL TABLE IN RH(A) + HRL A,1(C) ;GET PNTR TO SYMBOL TABLE + HLRM A,DUMP6 ;THIS IS WHERE WE STOP DUMPING + MOVSM A,DUMP9S ;SAVE AOBJN PNTR TO NON-BUILTIN SYMBOLS + MOVE A,-1(C) ;PICK UP START ADDRESS + MOVEM A,DUMP9J ;SAVE + MOVE B,-2(C) ;DUMP LOW CORE (ACS) OUT OF PLACE SAVED IN DDT + HLLZ A,B ;HERE B HAS ADDRESS DUMPING FROM + JRST DUMP3B ;AND A AND D HAVE VIRTUAL ADDRESS + +DUMP1: ;SKIP OVER NXM ON DUMPING +KA,[ CONSO 10000 ;NXM SET? + JRST DUMP1A ;NO, CONTINUE IN SEQUENCE + ADDI B,10*2000-1 ;SKIP 8K + TRZ B,1777 ;ROUND DOWN TO 8K BOUDARY + CONO 10000 ;CLEAR NXM +DUMP1A: +];KA +DUMP6: CAIGE B,. ;SKIP IF REACHED SYMBOL TABLE + JRST DUMP8 +DUMP7: MOVEI B,. ;SKIP OVER SYMBOLS, DUMP DDT + HLLOS DUMP6 ;DEFUSE TEST +DUMP8: JSP P,FD + JRST DUMPJ ;TIME TO WRITE JUMP BLOCK AND SYMBOL TABLE + SKIPN (C) ;LOOK FOR NON-ZEROES + AOJA B,DUMP1 + MOVE A,B ;SAVE START OF BLOCK +DUMP2: TLZ A,-1 ;LOOK FOR TWO CONSECUTIVE ZEROES +DUMP2A: CAIL B,200(A) ;BUT DON'T DUMP MORE THAN 200 WORDS AT A TIME + JRST DUMP3 + XCT DUMP6 + JSP P,FD + JRST DUMP3 ;END OF CORE, WRITE OUT LAST BLOCK + SKIPE (C) + AOJA B,DUMP2 ;NONZERO + TLON A,-1 ;ZERO, WAS PREV LOC ZERO ALSO? + AOJA B,DUMP2A ;NO, CHECK FOLLOWING LOC + SOJA B,DUMP3 ;YES, DUMP THE NON-ZERO THAT PRECEDES IT + +DUMP3: HRRM B,DUMP4 ;SAVE ADDRESS TO CONTINUE SEARCH + SUBM A,B ;RH(B) GETS MINUS THE LENGTH OF THE BLOCK + HRL A,B ;SET UP HEADER IN A + MOVE B,A ;AND B +DUMP3B: MOVE D,A ;AND D + JSP P,WD ;WRITE HEADER +DUMP3A: JSP P,FD + JSR EBUG,ERROR ;CAN'T FETCH WORD WE FETCHED BEFORE?? + MOVE D,(C) + ROT A,1 + ADD A,D ;COMPUTE CHECKSUM + JSP P,WD ;WRITE DATA WORD + AOBJN B,DUMP3A + MOVE D,A + JSP P,WD ;WRITE OUT CHECKSUM +DUMP4: MOVEI B,. ;AND CONTINUE SEARCHING + JUMPN B,DUMP1 ;IF MRC EVER SEES THIS --SELFMODIFYING CODE-- .... + JRST DUMP9 ;FINISHED DUMPING SYMBOLS + +DUMPJ: SKIPN DUMP9K + JRST DMP9J1 + HRROI D,DDT-2 ;BUGGER THE SYMBOL TABLE + MOVE A,D + JSP P,WD + MOVE D,DUMP9K + ROT A,1 + JSP P,WD + ADD D,A + JSP P,WD +DMP9J1: SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;WRITE OUT JUMP BLOCK + SKIPN B,DUMP9S ;WRITE SYMBOLS + JRST DUMP9 ;NO SYMBOLS + HLLZ A,B + HLLZS DUMP4 ;DUMP SYMBOL BLOCK, RETURN TO DUMP9 + JRST DUMP3B + +DUMP9: JUMPE WRITE,LOADG1 ;IF VERIFY, THAT'S ALL + SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;SECOND JUMP BLOCK + HRRZ T,DMP4 ; GET POINTER TO NAME AREA + AOS BUFP + DPB BUFP,[UNWRDC+DIR+UNRNDM(T)] + JSP TT,NXTBLK + JSP TT,WRDB ;WRITE OUT LAST BLOCK + SKIPE T,BLKCNT + JSR NXTBW3 ;STORE LAST DESCRIPTOR BYTE + MOVEI T,0 + JSR NXTBW3 ;AND INDICATE END OF FILE + LDB T,[360600,,DIRPT] + IDIVI T,6 + HRRZ TT,DIRPT + IMULI TT,6 + SUBI TT,6*-5-1(T) + HRRZM TT,DIR+UDESCP ;INDICATE NEW END OF DESCRIPTOR AREA +KILDMP: MOVEI UNIT,TUT + MOVEI BLOK,TUTBLK + JSP TT,WRD ;WRITE OUT TUT ON THIS UNIT +REPEAT NTUTBL-1,[ + ADDI UNIT,2000 + ADDI BLOK,1 + JSP TT,WRD +] + HRRZ B,CU + HRRM B,KD2 ;WRITE OUT USER DIRECTORY ON ALL UNITS +KD1: ADDI B,1 + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + SKIPE QDED(B) + JRST KD2 + MOVEI UNIT,DIR +UDBLK: MOVEI BLOK,. + MOVE TT,DIR+UDNAME + CAME TT,SYSN + JSR EBUG,ERROR + JSP TT,WR +KD2: CAIN B,. + JRST LOADG1 + JRST KD1 + +GTP: SKIPGE TUT+QPKNUM + JSR EBUG,ERROR ;MUST BE OLD-STYLE TUT? + SUB C,TUT+QFRSTB + JUMPL C,[JSR EBUG,ERROR] + IDIVI C,TUTEPW + IMULI A,-10000*TUTBYT + HRLI C,440000+TUTBYT_6(A) + ADDI C,TUT+LTIBLK + JRST (TT) + +SC,[ ;LOGICAL TO PHYSICAL DISK MAPPING +QTRAN: 0 ;INDEX BY LOG DSK # + 1 ;4.9 => USE HIGH HALF OF DRIVE, RH = PHYS DRIVE # + 2 ;(NO LONGER DOES ANYTHING, NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND JUST IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NDSK,.ERR QTRAN LOSES!! +];SC + +ERRCT: 0 ;ERROR COUNTER +DDTM2: 0 ;DDT SYMBOL TABLE POINTER +DUMP9J: 0 ;START INSTRUCTION (AT DUMP9) +DUMP9S: 0 ;SYMBOL TABLE POINTER (AT DUMP9) +DUMP9K: 0 ;INITIAL SYMBOL TABLE PNTR (AT DUMP9) +LBLOCK: 0 ;LAST BLOCK WRITTEN OR READ +BLKCNT: 0 ;NUMBER OF BLOCKS READ OR WRITTEN CONSECUTIVELY +DIRPT: 0 ;DESCRIPTOR AREA BYTE POINTER +TUTPT: 0 ;TUT BYTE POINTER +FN1: 0 ;FILE NAME 1 +FN2: 0 ;FILE NAME 2 +PKNUM: REPEAT NDSK,-1 ;PACK NUMBER INDEXED BY DRIVE NUMBER +QDED: BLOCK NDSK ;-1 IF DRIVE NOT TO BE USED +XWDS: BLOCK 4 +RPKID: 0 +BOOTNS: RP, CONSZ DPC,BUSY + SC, CONSZ DC0,DSSACT + RH, CONSZ DSK,%HIBSY + PH, IORD B,SWPCS1 ; UGH! + + CONSTANTS + +IFL BEG+1677-., .ERR BLOAT +INFORM SPACE LEFT,\BEG+1677-. +BLOCK BEG+1677-. + +BADBLK: 0 ;BLOCK WITH HDWE ERROR +INFORM BADBLK,\.-1-BEG+ + +];END IFE BOOTSW +IFN BOOTSW,[ +BEG=MEMSIZ-2000 +LOC MEMSIZ-100 +] + +CBOOT: CLEARM MEMSIZ-1 ;BOOTSTRAP +RP,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DPC,BUSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DPC,BUSY + JRST .-1 + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 + DATAO DPC,CLATT1 + DATAO DPC,SUNIT0 + DATAI DPC,B +BOOT0: TRNN B,RP03BT + JRST BOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +BOOT1: HLLZS BOOT0 ;PREVENT TRNN FROM SKIPPING AGAIN + MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPIN1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPIN2 + CONSO DPC,DONE + JRST .-1 + JRST BEG + +ERRWD: -1700,,BEG-1 +CLATT1: DEASEC ALLATT +SWPSK: DSEEKC+200._22. +SWPIN1: DWRITC+200._22.+3_17.+2._12.+ICWA ;NBLKS 4 +SWPIN2: DREADC+200._22.+4_17.+8._12.+ICWA +SWPOU1: DWRITC+200._22.+4_17.+8._12.+ICWA +SWPOU2: DREADC+200._22.+3_17.+2_12.+ICWA +IFN NSWBL-5, .ERR THE PRECEDING 4 CONSTANTS ARE WRONG! +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +RP3ADJ: <&377>_22.+<.BM DCYLXB> +SUNIT0: DNOOPC + +SKWAIT: DATAI DPC,A ;AWAIT SEEK DONE UNIT 0 + TRNN A,ALLATT + JRST SKWAIT + DATAO DPC,CLATT1 + MOVEI A,30. + SOJG A,. + DATAI DPC,A + TLNN A,(ONCYL) + JRST SKWAIT + JRST (P) + +WAIT: CONSO DPC,DONE + JRST .-1 +];RP + +PH,[ ;; Initially we could not use IORDQ or IOWRQ because they were + ;; macros that used a literal. There is nothing to stop us now, + ;; except the fact that this code works fine and is as small as you + ;; could possibly want. + +BOOT: +IFE BOOTSW, JRST BEG ; or IORD B,SWPCS1 or JRST LOADG1 +IFN BOOTSW, IORD B,SWPCS1 + TRNN B,%HXRDY + JRST BOOT +KS, WREBR 0 ; No paging or caching + MOVEI A,0 + IOWR A,SWPCS2 ; Select drive +BOOT0: IORD A,SWPCS1 + TRNN A,%HXDVA + JRST BOOT0 ; Await drive available + MOVSI B,-LSWPADR +BOOT1: HLRZ A,SWPVAL(B) + IOWR A,SWPADR(B) +BOOT2: IORD A,SWPCS1 + TRNN A,%HXRDY ; Wait for controller + JRST BOOT2 + TRNE A,%HXTRE+%HXMCP ; Lossage? + JRST 4,. ; Foo! + AOBJN B,BOOT1 + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +SWPADR: UBAQ,,UBAPAG+UBPG_1 ; Set up Unibus map + UBAQ,,UBAPAG+UBPG_1+1 + UBAQ,,%HRCS2 ; Clear controller +SWPCS2: UBAQ,,%HRCS2 ; Select drive +SWPCS1: UBAQ,,%HRCS1 ; Initialize + UBAQ,,%HRCYL ; Desire cylinder + UBAQ,,%HRWC ; Set (half) word count + UBAQ,,%HRBA ; Set Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Write + UBAQ,,%HRWC ; Reset (half) word count + UBAQ,,%HRBA ; Reset Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Read +LSWPADR==:.-SWPADR + +IFN BEG&1777, .ERR BEG does not lie on a page boundary? + +;;; LH FOR SWAP IN, RH FOR SWAP OUT +SWPVAL: %UQVAL+%UQFST+BEG_-9,,%UQVAL+%UQFST+BEG_-9 ; Set up Unibus map + %UQVAL+%UQFST+BEG_-9+1,,%UQVAL+%UQFST+BEG_-9+1 + %HYCLR,,%HYCLR ; Clear controller + 0,,0 ; Select drive + %HMRDP,,%HMRDP ; Initialize + NCYLS,,NCYLS ; Desire cylinder + -1700*2,,-1700*2 ; Set (half) word count + UBPG_14,,UBPG_14 ; Set Unibus address + ZZ1,,ZZ2 ; Desire track and sector + %HMWRT,,%HMWRT ; Write + -1700*2,,-1700*2 ; Reset (half) word count + UBPG_14,,UBPG_14 ; Reset Unibus address + ZZ2,,ZZ1 ; Desire track and sector + %HMRED,,%HMRED ; Read +IFN .-SWPVAL-LSWPADR, .ERR SWPVAL wrong length. + +CBLK: -NSWBL,,NBLKS + +WAIT: IORD B,SWPCS1 + TRNN B,%HXRDY + JRST WAIT +];PH + +RH,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DSK,%HIBSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DSK,%HIBSY + JRST .-1 +KL, CONSZ PAG,660000 ;PAGING AND CACHE MUST BE DISABLED +KL, JRST 4,. + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 +BOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST BOOT0 ;AWAIT DRIVE AVAILABLE + MOVE B,ERRWD + CONI DSK,A + TLNE A,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +BOOT1: DATAO DSK,SWPIN1(B) + MOVEI A,20 + SOJG A,. + CONSZ DSK,%HIBSY + JRST .-1 + AOBJN B,BOOT1 + CONSZ DSK,%HIERR + JRST 4,. + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +ERRWD: -1700,,BEG-1 +SWPIN1: %HRLOD+%HRDCL,,%HMRDP +SWPIN2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPIN3: %HRLOD+%HRADR,,ZZ1 +SWPIN4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPIN5: %HRLOD+%HRADR,,ZZ2 +SWPIN6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +SWPOU1: %HRLOD+%HRDCL,,%HMRDP +SWPOU2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPOU3: %HRLOD+%HRADR,,ZZ2 +SWPOU4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPOU5: %HRLOD+%HRADR,,ZZ1 +SWPOU6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +CBLK: -NSWBL,,NBLKS+NBLKSC ;AVOID CYLINDER 406 WHICH KLDCP USES + +WAIT: CONSO DSK,%HIDON + JRST .-1 +];RH + +SC,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DC0,DSSACT OR JRST LOADG1 +IFN BOOTSW, CONSZ DC0,DSSACT + JRST .-1 + DATAO DC0,SWPINJ + CONSZ DC0,DSSACT + JRST .-1 + JRST BEG + +SWPINJ: DJMP SWPIN + +DADR==NCYLS_13+</2>_6+<&1> ;ADDR OF LAST BLOCK IN CORE BUFFER +DADR1==NCYLS_13+_6+ ;ADDR OF NEXT BLOCK (CONTAINS +SWPIN: DWRITE+DUNENB+DADR ; WORKING COPY OF DSKDMP) + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +SWPOUT: DWRITE+DUNENB+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +WAIT: CONSZ DC0,DSSACT + JRST .-1 +];SC +SADR: JRST BOOT ;AND GO TO PROGRAM TO BE STARTED +SYSN: SIXBIT /./ ;CURRENT DIRECTORY +IFG .+1-MEMSIZ,.ERR BOOT BLOAT + +IFE BOOTSW,{ ;CURLY BRACKETS TO AVOID ERROR MESSAGE + OFFSET 0 + LOC CORE + +;THESE ARE THE BLOCKS THAT GET WRITTEN ON DISK +; STARTING AT THE BEGINNING OF THE FIRST EXTRA CYLINDER + +CBUF: BLOCK 2000 ;PSEUDO-CORE BUFFER +DBUF: BLOCK 2000 ;DISK BUFFER +DIR: BLOCK 2000 ;DIRECTORY BUFFER +TUT: BLOCK 2000*NTUTBL ;TUT BUFFER +IFN .-BEG,.ERR BLOCKS LOST +; BLOCK 2000 ;CORE OVERLAYED BY DSKDMP +; BLOCK 2000 ;COPY OF DSKDMP +; BLOCK 2000 ;SPARE COPY OF DSKDMP + +END ZZZ +};END IFE BOOTSW +IFN BOOTSW, END CBOOT diff --git a/system/dskdmp.214 b/system/dskdmp.214 new file mode 100644 index 0000000..2242bd5 --- /dev/null +++ b/system/dskdmp.214 @@ -0,0 +1,1885 @@ +;;; -*-Midas-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +TITLE DSKDMP + +.MLLIT==1 + +DEFINE SETF TEXT,FLG +IFDEF FLG,.STOP +.TAG FOOBAR +PRINTC "TEXT +FLG=" +.TTYMAC FLAG +.TTYFLG==.TTYFLG+1 +PRINTX/FLAG +/ +.TTYFLG==.TTYFLG-1 +IFSE FLAG,YES,FLG==1 +IFSE FLAG,NO,FLG==0 +IFSE FLAG,Y,FLG==1 +IFSE FLAG,N,FLG==0 +IFNDEF FLG,FLG==FLAG +TERMIN +IFNDEF FLG,.GO FOOBAR +TERMIN + +IF1,[ +PRINTC "Configuration (KSRP06, KSRM03, KSRM80 or ASK) ? " +.TTYMAC MACH +IFSE MACH,KSRP06,[ + HRIFLG==0 + RP06P==1 + KS10P==1 + NUDSL==500. +] ;KSRP06 +IFSE MACH,KSRM03,[ + HRIFLG==0 + RP06P==0 + RM03P==1 + KS10P==1 + NUDSL==500. +] ;KSRM03 +IFSE MACH,KSRM80,[ + HRIFLG==0 + RP06P==0 + RM03P==0 + RM80P==1 + KS10P==1 + NUDSL==500. +] ;KSRM80 +IFSN MACH,ASK,[ +IFNDEF NUDSL,[ PRINTC /No known configuration for "MACH". +/ ]] +TERMIN +] ;IF1 + +SETF [Readin Mode Paper Tape?]HRIFLG +SETF [Assemble BOOT? (If no, full DSKDMP)]BOOTSW + +SETF [RH11/RP06 disk system?]RP06P +IFE RP06P,[ +SETF [RH11/RM03 disk system?]RM03P +IFE RM03P,[ +SETF [RH11/RM80 disk system?]RM80P +IFE RM80P,[ +SETF [RH10 (MC-KL) disk control?]RH10P +IFE RH10P,[ +SETF [AIKA disk control? (no => RP02/RP03)]DC10P +]]]] +IFN RP06P, RM03P==0 +IFN RP06P+RM03P, RM80P==0 +IFN RP06P+RM03P+RM80P, RH10P==0 +IFN RP06P+RM03P+RM80P+RH10P, DC10P==0 +IFN RP06P+RM03P+RM80P+RH10P+DC10P, RP10P==0 +IFE RP06P+RM03P+RM80P+RH10P+DC10P, RP10P==1 + +IFE BOOTSW, SETF [Number of dirs? (DM-KA: 200., ML-KA: 250., AI-KA: 440., all others: 500.)]NUDSL + +SETF [KS10 processor?]KS10P +IFE KS10P, SETF [KL10 processor? (no => KA10)]KL10P +IFN KS10P, KL10P==0 +IFN KS10P+KL10P, KA10P==0 +IFE KS10P+KL10P, KA10P==1 + +RH11P==:RP06P+RM03P+RM80P + +DEFINE RP +IFN RP10P!TERMIN +DEFINE SC +IFN DC10P!TERMIN +DEFINE RH +IFN RH10P!TERMIN +DEFINE PH +IFN RH11P!TERMIN + +DEFINE KA +IFN KA10P!TERMIN +DEFINE KL +IFN KL10P!TERMIN +DEFINE KS +IFN KS10P!TERMIN + +IFN HRIFLG,[ +NOSYMS ;MAKE PAPER TAPE SHORTER +RIM10 +] + +C=1 ;C-A-B FOR LINKS +A=2 +B=3 +D=4 +BLKIN=5 ;PSEUDO-CORE BLOCK IN CBUF +WRITE=6 ;NEG MEANS DUMP, RH 0 OR WRBIT +DIFF=7 ;DIFF CONO ALSO TEMP +HEAD=10 ;HEAD CONO ALSO TEMP +P=11 ;JSP AC +BLOK=12 +UNIT=13 ;UNIT AND M.A. DATAO +CMD=14 ;COMMAND CHAR +T=15 ;VERY TEMP +TT=16 ;ANOTHER JSP AC, ALSO VERY TEMP +BUFP=17 ;DBUF PNTR--LAST WORD USED + +IF1,[ ;DON'T TAKE A WEEK AND A HALF TO ASSEMBLE. +RP, .INSRT SYSTEM;RP10 > +SC, .INSRT SYSTEM;DC10 > +RH, .INSRT SYSTEM;RH10 > +PH, .INSRT SYSTEM;RH11 > +IFN RP06P, .INSRT SYSTEM;RP06 > +IFN RM03P, .INSRT SYSTEM;RM03 > +IFN RM80P, .INSRT SYSTEM;RM80 > +IFE BOOTSW, .INSRT SYSTEM;FSDEFS > +IFE BOOTSW, KL, .INSRT SYSTEM;EPT > +KS, .INSRT SYSTEM;KSDEFS > +KA, TTY==120 +] + +;PARAMETER FILE FOR DSKDMP + +MEMSIZ=1000000 ;ACTUAL SIZE OF MEM +IFNDEF DBGSW,DBGSW==0 ;1 TO DEBUG THIS WITH DDT +DDT==MEMSIZ-4000 +IFN DBGSW,MEMSIZ==MEMSIZ-10000 ;MOVE DOWN UNDER DDT IF DEBUG MODE +CORE==MEMSIZ-10000-<2000*NTUTBL> ;HIGHEST ADR ALWAYS IN CORE+1 +CORES==CORE_<-12> ;BLK # OF ABOVE (FIRST OF BLKS SWAPPED OUT FOR BUFFER AREAS) +NSWBL==4+NTUTBL ;# BLOCKS SWAPPED OUT FOR BUFFER AREAS, +1 FOR DSKDMP ITSELF +HIGH==MEMSIZ-100 ;HIGHEST ADR LOADED/DUMPED+1 + +NDSK==8 ;MAX POSSIBLE. L$n$ DEFINES WHICH ARE REALLY THERE +RP,ICWA=34 +RH,ICWA=34 + +PH, UBPG==:17 ; Use last (usable) page in Unibus map + +KA, LPM=102000,, +KA, LPMR=LPM 2, +KL, PAG=- + +DEFINE INFORM A,B +IF1,[ PRINTX  A = B +] TERMIN + +;COMMANDS ARE: +; L$file LOAD FILE INTO CORE +; T$file LOAD FILE INTO CORE AND GIVE SYMBOLS TO DDT AND START DDT +; M$file LOAD FILE INTO CORE WITHOUT CLEARING CORE FIRST, DOESN'T LOAD SYMBOLS +; K$file DELETE FILE +; D$file DUMP CORE INTO FILE +; I$file VERIFY FILE AGAINST CORE +; G$ START AT STARTING ADDRESS +; U$dir; LIST DIRECTORY +; F$ LIST CURRENT DIRECTORY +; S$ LIST PACK IDS THEN MFD +; nnn$ SET STARTING ADDRESS TO nnn +; L$n$ PUT DISK n ONLINE +; K$n$ TAKE DISK n OFFLINE + +;ERROR MESSAGES ARE: +; CMPERR VERIFY FAILED TO MATCH +; DIRFUL DIRECTORY FULL +; EOF UNEXPECTED EOF +; DIRNF DIRECTORY DOES NOT EXIST +; FNF FILE NOT FOUND +; PKNMTD FILE IS ON PACK THAT IS NOT MOUNTED +; CKSERR CHECKSUM ERROR +; DSKFUL DISK FULL +; NODDT CAN'T ADDRESS DDT SYMBOL TABLE (BUG) +; ?BUG? BUG +; SEEKFL DISK SEEK ERROR +; CLOBRD DISK READ ERROR +; CLOBWR DISK WRITE ERROR +; DIRCLB DIR NAME DIFFERS, TUT DISAGREES WITH DIR +; MFDCLB M.F.D. CLOBBERED +; DSKLUZ DISK LOSSAGE (OFFLINE OR UNSAFE OR MASSBUS ERROR) + +KS, LOC 4000 ; Avoid MTBOOT and KSRIM + +IFE BOOTSW,[ +ZZZ: IFE DBGSW,[ + MOVE T,.... ;THIS CODE BLTS THE FOLLOWING OFFSET CODE + BLT T,MEMSIZ-1-1 ;INTO HIGH MEMORY AND WRITES DSKDMP ON ITS + MOVE T,PROG+MEMSIZ-2-BEG+1 + MOVEM T,BEG+MEMSIZ-2-BEG+1 ;AVOID LOSING DUE TO -1 BLT LOSSAGE +] + MOVSI T,-NDSK+1 ;MAKE ALL BUT DISK 0 BE DEAD (MUST DO L$ TO MAKE THEM ALIVE) + SETOM QDED+1(T) + MOVNS QDED+1(T) + AOBJN T,.-2 + SETZM QDED+0 +RP,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 + DATAO DPC,SUNIT0 + DATAI DPC,B + TRNN B,RP03BT + JRST WBOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +WBOOT1: HLLZS BOOT0 + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DPC,ALLER +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +PH,[ MOVEI T,%HYCLR ; Clear controller + IOWRQ T,%HRCS2 ; (Selects drive 0) +WBOOT0: IORDQ T,%HRCS1 + TRNN T,%HXDVA + JRST WBOOT0 ; Await drive available (well, it is a dual + ; ported drive... perhaps someday?) + MOVEI UNIT,BEG + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ; FIRST BLOCK AFTER CORE BUFFER IS WHERE + ; DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + IORDQ TT,%HRCS1 + TRNE TT,%HXTRE+%HXMCP +IFN DBGSW, JRST DDT +IFE DBGSW, JRST 4,. ; Formerly JRST MEMSIZ-400 (??) + JRST BEG +];PH +RH,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 +WBOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST WBOOT0 ;AWAIT DRIVE AVAILABLE + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DSK,%HIERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +SC,[ MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + MOVEI BLOK,NBLKS+NSWBL + MOVEI WRITE,60 + JSP TT,WRD3 + MOVEI BLOK,NBLKS+NSWBL+1 + MOVEI WRITE,60 + JSP TT,WRD3 + DATAO DC0,..... + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG + +.....: DJMP .+1 + DWRITE + DCOPY ......(-LRIBLK_2&37774) + DHLT + +......: DWRITE+DUNENB+DADR ;FOR READIN + DCOPY BEG(-2000_2&37774) + DREAD+DADR1 + DCOPY BEG(-2000_2&37774) + DHLT +];SC + +IFE DBGSW,[ +....: PROG,,BEG + +KA, LOC 2000 ; MAKE OFFSET CONVENIENT +KL, LOC 2000 +KS, LOC 6000 ; Avoid MTBOOT and KSRIM +PROG: OFFSET CORE+<*2000>-. +]IFN DBGSW,LOC MEMSIZ-2000 + +BEG: +KA,[ CONO 635550 ;ENTER HERE, CLEAR WORLD + JRST .+1 + JFCL 1,[JRST 4,.] ;A PDP6?? + LPMR [0]-2 ;TURN OFF EXEC PAGING +] +KL,[ CONO 327740 ;CLEAR APR + CONSZ PAG,660000 ;PAGING AND CACHE BETTER BE OFF + JRST 4,. +] +KS,[ CONO 127760 ; Enable, and Clear all. + RDEBR B + TRNE B,60000 ; Paging and Tops-20 better be off. + JRST 4,. + SETZM 8SWIT0 ; Clear 8080 Communications area to prevent + MOVE B,[8SWIT0,,8SWIT0+1] ; mysterious IO behavior. + BLT B,8RHBAS-1 + ;; If the machine has just been powered on, there is likely to be + ;; bad parity all over the place. I guess that isn't our problem + ;; as long as we don't touch any of it... +] + MOVSI B,-NDSK ;FOR NUMBER OF DISKS + SETOM PKNUM(B) ;SET DISK TO UNKNOWN + AOBJN B,.-1 + MOVE T,[JRST LOADG1] ;SET BOOTSTRAP TO MIDDLE OF WORLD + MOVEM T,BOOT + MOVE D,['DSKDMP] ;ANNOUNCE SELF + JSP TT,PD + JRST READ ;CRLF AND BEGIN READING COMMANDS + +ERROR: 0 + CLEARM MEMSIZ-1 ;DON'T READ ANY MORE COMMANDS FROM MEMORY + SOS T,ERROR ;PICK UP ERROR CODE FROM THE AC FIELD OF + LDB T,[270400+T,,] ;THE JSR ERROR + MOVE D,ERMESS(T) + JSP TT,PD ;PRINT OUT APPROPRIATE COMMENT + CAIL T,EBUG + JRST READ ;BAD ERROR - NO MORE DISKING +LOADG1: +KA, DATAI TTY,C ;FLUSH RANDOM CHARACTER +KS, SETZM 8CTYIN ; ".RESET" + TRO CMD,10 ;MAKE SURE PSEUDO-CORE IN CORE + JRST LOADG ;BY SIMULATING END OF LOADING, NON-GOING COMMAND + +ERMESS: IRP XX,,[ECMP,EDIR,EEOF,ESNF,EFNF,EPNM,ECKS +EDSK,EDDT,EBUG,EC63,ECRD,ECWR,ECDR,EMFC,EDLZ]YY,,[CMPERR,DIRFUL +EOF,DIRNF,FNF,PKNMTD,CKSERR,DSKFUL,NODDT,?BUG?,SEEKFL +CLOBRD,CLOBWR,DIRCLB,MFDCLB,DSKLUZ] +XX==.-ERMESS + SIXBIT \YY\ +TERMIN + +PD: JSP P,CRLF ;TYPE A CR +PD2: MOVEI C,40 + JSP P,TYO ;AND A SPACE + MOVE B,[440600,,D] +PD1: ILDB C,B ;AND THE SIXBIT CONTENTS OF D + ADDI C,40 + JSP P,TYO + TLNE B,770000 + JRST PD1 + JRST (TT) + +PNO: +C12: IDIVI C,10. ;PRINT CONTENTS OF C AS A TWO-DIGIT + DPB C,[60600,,A] ;DECIMAL NUMBER PRECEDED + MOVEI D,(SIXBIT /#00/+A) ;BY # + MOVE B,[300600,,D] + JRST PD1 + +WRCB: MOVEI UNIT,CBUF ;WRITE OUT CONTENTS OF CBUF + LSH BLKIN,-12 ;ON APPROPRIATE BLOCK + HRRZ BLOK,CBLK + ADDI BLOK,-CORES(BLKIN) + JRST WRM + +LODUMP: MOVEI UNIT,CORE ;DEPENDING ON SIGN BIT OF WRITE, LOAD OR DUMP + HRRZ BLOK,CBLK ;PSEUDO-CORE (766000-775777) +LODMP1: JSP TT,WRDM + ADDI UNIT,2000 + CAIGE UNIT,BEG + AOJA BLOK,LODMP1 + MOVEI BLKIN,CORE + JRST (P) + +FD: HRRZ C,B ;SET UP POINTER IN C TO FETCH OR DEPOSIT + ;CONTENTS OF ADDRESS IN RIGHT HALF OF B +IFN DBGSW, SKIPGE WRITE ;LOAD DDT WHEN IN DEBUG MODE + CAIGE C,HIGH + CAIGE C,40 + JRST (P) + CAIGE C,CORE ;IF ADDR IS IN REAL CORE, RETURN IMMEDIATELY + JRST 1(P) +FDX: CAIL C,(BLKIN) ;ADDR IS IN PSEUDO-CORE--CHECK IF RIGHT + CAILE C,1777(BLKIN) ;BLOCK IS IN CBUF + JRST FD3 ;IT'S NOT THERE--READ IT IN +FD4: SUBI C,-CORE(BLKIN) ;IT'S THERE--SET UP RIGHT POINTER IN C + JRST 1(P) ;AND RETURN +FD3: JUMPLE WRITE,FD3A ;IF DUMP OR VERIFY DON'T BOTHER + ;TO WRITE OUT CURRENT BLOCK +FD3B: JSP TT,WRCB ;IF LOAD, WRITE CURRENT BLOCK FIRST +FD3A: MOVEI UNIT,CBUF + MOVE BLKIN,C + ANDI BLKIN,776000 + LDB BLOK,[121000,,BLKIN] + ADD BLOK,CBLK + MOVEI BLOK,-CORES(BLOK) + JSP TT,RDM ;READ IN CORRECT BLOCK + JRST FD4 ;SET UP POINTER AND RETURN + +GBP: IDIVI C,6 ;TURN USER DIRECTORY CHARACTER ADDR IN C + IMULI A,-60000 ;INTO A BYTE POINTER + HRLI C,440600(A) + ADDI C,DIR+UDDESC + JRST (TT) + +WD: AOBJN BUFP,WD1 ;READ, WRITE, OR VERIFY WORD IN D FROM, INTO, + JSP TT,NXTBLK ;OR AGAINST WORD IN DBUF + JSP TT,WRDB ;TIME TO REFILL OR EMPTY DBUF + MOVSI BUFP,-2000 ;RESET BUFFER POINTER +WD1: JUMPG WRITE,WD2 ;JUMP ON LOAD + JUMPL WRITE,WD3 ;JUMP ON WRITE + CAME D,DBUF(BUFP) ;HERE IF VERIFY + JSR ECMP,ERROR ;VERIFY COMPARE LOST + JRST (P) +WD2: SKIPA D,DBUF(BUFP) ;LOAD +WD3: MOVEM D,DBUF(BUFP) ;DUMP + JRST (P) + +NXTTUT: HRRZ B,CU ;SELECT NEXT UNIT AND READ ITS TUT + AOJ B, + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + CAIN B,@MU + JRST 1(TT) ;SKIP IF NO MORE + SKIPE QDED(B) + JRST NXTTUT ;UNIT NOT ON LINE +RDTUT: MOVEI BLOK,TUTBLK ;READ TUT OF CURRENT UNIT + MOVEI UNIT,TUT + SETOM PKNUM(B) ;ALWAYS READ HEADER FOR TUT +IFG NTUTBL-1,[ ;READ IN MULTI-BLOCK TUT + HRRM TT,RDTUTX ;SAVE RETURN ADDRESS +REPEAT NTUTBL-1,[ + JSP TT,RD + ADDI UNIT,2000 + AOS BLOK +] +RDTUTX: MOVEI TT,. +] + JRST RD + +NXTBW3: 0 + IBP DIRPT ;DO AN IDPB T,DIRPT CHECKING TO SEE IF + LDB DIFF,[1200,,DIRPT] ;RUNNING INTO NAME AREA + CAML DIFF,DIR+UDNAMP + JSR EDIR,ERROR + DPB T,DIRPT + JRST @NXTBW3 + +NXTBW: MOVE BLOK,LBLOCK ;FIND NEXT FREE BLOCK TO WRITE + MOVEI HEAD,1(BLOK) + ILDB T,TUTPT + JUMPN T,NXTBW1 ;JUMP IF VERY NEXT BLOCK NOT FREE + AOSG T,BLKCNT +NXTBW5: SOJA HEAD,NXTBW4 ;GENERATE LOAD ADR IF FIRST TIME (COMPENSATE FOR LBLOCK OFF BY 1) + CAIG T,UDTKMX-1 + JRST NXTBW2 ;NO NEED TO MODIFY DIRECTORY YET + CLEARM BLKCNT ;14 IN A ROW--RESET COUNTER AND +NXTBW6: JSR NXTBW3 ;DPB BYTE INTO DIRECTORY +NXTBW2: MOVE BLOK,HEAD + CAML BLOK,TUT+QLASTB + JSR EDSK,ERROR ;NO MORE DISK LEFT + MOVEI T,1 + DPB T,TUTPT ;MARK BLOCK USED IN TUT + JRST WRDB1 + +NXTBW1: ADDI HEAD,1 ;SEARCH FOR NEXT FREE BLOCK + ILDB T,TUTPT + JUMPN T,NXTBW1 + SUBM HEAD,BLOK + SKIPLE T,BLKCNT ;COME UP WITH DESC BYTE FOR LAST FEW BLOCKS + JSR NXTBW3 + CLEARM BLKCNT + JUMPL T,NXTBW5 ;FIRST TIME + MOVEI T,UDTKMX-1(BLOK) + CAIGE T,UDWPH ;CAN WE SAY SKIP N--TAKE 1? + JRST NXTBW6 ;YES +NXTBW4: MOVEI BLOK,NXLBYT + MOVE T,HEAD + ROT T,-NXLBYT*6 + ADDI T,UDWPH+1 + JSR NXTBW3 + ROT T,6 + SOJG BLOK,.-2 + JRST NXTBW6 + +NXTBLK: JUMPL WRITE,NXTBW ;GET NEXT BLOCK OF FILE--IF DUMP, FIND FREE + MOVE BLOK,LBLOCK ;BLOCK +NXTB6: SOSLE BLKCNT ;HAVE WE RUN OUT OF "TAKE N"? + AOJA BLOK,WRDB1 ;NO--TAKE NEXT BLOCK + ILDB T,DIRPT ;YES--GET NEXT DESC BYTE + CAILE T,UDWPH + JRST NXTB1 ;IT'S A LOAD ADDR + CAIE T,UDWPH + JUMPN T,NXTB2 ;IT'S A TAKE OR SKIP + CAIE CMD,'D ;IT'S 0 OR NULL--IF THIS IS A LOAD, IT'S AN + CAIN CMD,'K ;UNEXPECTED END OF FILE + JRST KILL1 ;IF DUMP OR KILL, O.K. + JSR EEOF,ERROR + +NXTB1: MOVEI BLOK,-UDWPH-1(T) ;LOAD ADR + MOVEI BUFP,NXLBYTS +NXTB1A: MOVEI T,0 + CAIE CMD,'D + CAIN CMD,'K + DPB T,DIRPT ;IF KILLING FILE, ZERO THIS BYTE (OTHERS ZEROED AT KILL) + LSH BLOK,6 + ILDB T,DIRPT + ADD BLOK,T ;GET COMPLETE BLOCK NUMBER + SOJG BUFP,NXTB1A + JRST NXTB3 + +NXTB2: MOVEM T,BLKCNT + CAIG T,UDTKMX + AOJA BLOK,WRDB1 ;TAKE N STARTING WITH NEXT ONE + ADDI BLOK,-UDTKMX+1(T) ;SKIP N- AND TAKE 1 +NXTB3: CLEARM BLKCNT +WRDB1: MOVEM BLOK,LBLOCK + JRST (TT) + ;RP10 IO ROUTINE +RP,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: DPB WRITE,[360600,,DBLK] ;SET OP, UNIT SEL + DPB WRITE,[DUNFLD SEEK] + DPB WRITE,[DUNFLD RECAL] + HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + MOVEM UNIT,@ICWA + SOS @ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + DPB DIFF,[DCYL SEEK] + DATAO DPC,CLATT ;CLEAR ATTENTIONS + LSH DIFF,-8 ;EXTRA CYLINDER BIT FOR RP03 + DPB DIFF,[DCYLXB DBLK] + DPB DIFF,[DCYLXB SEEK] + DATAO DPC,SEEK + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + DATAO DPC,CLATT + TLNN DIFF,(ONCYL) + JRST WRD0 + DATAO DPC,DBLK + CONSO DPC,DONE + JRST .-1 + CONSO DPC,ALLER + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: AOSLE ERRCT + JSR EC63,ERROR + DATAO DPC,RECAL + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + JRST WRD5 + +DBLK: ICWA +SEEK: DSEEKC +RECAL: DRCALC +CLATT: DEASEC ALLATT +];RP + ;RH11 IO ROUTINE +PH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: TRNE UNIT,1777 ; Better be on a page boundary! + JRST 4,. + LDB DIFF,[111100,,UNIT] ; Point Unibus map at page in question + TRO DIFF,%UQFST+%UQVAL + IOWRQ DIFF,UBAPAG+UBPG_1 + ADDI DIFF,1 + IOWRQ DIFF,UBAPAG+UBPG_1+1 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + JSP HEAD,RHCHEK ; Check for immediate trouble + MOVEI DIFF,%HMRDP ; Init the drive + IOWRQ DIFF,%HRCS1 + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVNI DIFF,4000 + IOWRQ DIFF,%HRWC ; 4000 half words + MOVEI DIFF,UBPG_14 + IOWRQ DIFF,%HRBA ; "Byte" base address + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + IOWRQ DIFF,%HRCYL ; Desire cylinder + MOVE DIFF,HEAD + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB DIFF,[$HATRK HEAD] + IOWRQ HEAD,%HRADR ; Desire track and sector + MOVEI DIFF,%HMRED + TRNE WRITE,10 + MOVEI DIFF,%HMWRT + IOWRQ DIFF,%HRCS1 ; Do it (implied seek) +WRD7: IORDQ DIFF,%HRCS1 + TRNN DIFF,%HXRDY ; Wait for controller to finish + JRST WRD7 + TRNN DIFF,%HXTRE+%HXMCP ; Trouble? + JRST WRDX ; Nope, exit + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVEI DIFF,%HYCLR ; Clear controller + IOWRQ DIFF,%HRCS2 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + MOVEI DIFF,%HMCLR ; Clear drive + IOWRQ DIFF,%HRCS1 + JSP HEAD,RHCHEK ; Immediate lossage? + MOVEI DIFF,%HMREC ; Recalibrate + IOWRQ DIFF,%HRCS1 + MOVEI HEAD,100000. +WRD0A: SOSGE HEAD + JSR EC63,ERROR + IORDQ DIFF,%HRSTS + TRNE DIFF,%HSPIP ; WAIT FOR DRIVE TO FINISH + JRST WRD0A + ANDI DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY+%HSERR + CAIE DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY + JSR EDLZ,ERROR + JRST WRD5 + +;;; JSP HEAD,RHCHEK to check for errors. +RHCHEK: IORDQ DIFF,%HRCS1 + TRNE DIFF,%HXTRE+%HXMCP + JSR EDLZ,ERROR + JRST (HEAD) +];PH + ;RH10 IO ROUTINE +RH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + CONI DSK,HEAD ;SET WORD COUNT TO ONE BLOCK + TLNE HEAD,(%HID22) ;ACCORDING TO TYPE OF CHANNEL + HRLI UNIT,-2000_4 + MOVEM UNIT,@ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + SOS @ICWA ;ADJUST FOR DF10 LOSSAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMRDP ;INIT THE DRIVE + JSP HEAD,RHSET + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + EXCH DIFF,HEAD + MOVEM HEAD,DBLK ;SAVE CYLINDER + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + EXCH DIFF,HEAD + DPB HEAD,[$HATRK DIFF] + TLO DIFF,%HRADR(UNIT) + JSP HEAD,RHSET + MOVE DIFF,DBLK + TLO DIFF,%HRCYL(UNIT) + JSP HEAD,RHSET + MOVSI DIFF,%HRCTL(UNIT) + IORI DIFF,ICWA_6 + TRNE WRITE,10 + TROA DIFF,%HMWRT + TRO DIFF,%HMRED + JSP HEAD,RHSET ;DO IT (USE IMPLIED SEEK) + CONSO DSK,%HIDON + JRST .-1 + CONSO DSK,%HIERR + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMCLR + JSP HEAD,RHSET + MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMREC + JSP HEAD,RHSET + MOVEI DIFF,100000. + MOVEM DIFF,DBLK +WRD0A: SOSGE DBLK + JSR EC63,ERROR + MOVSI DIFF,%HRSTS(UNIT) + JSP HEAD,RHGET + TRNE DIFF,%HSPIP + JRST WRD0A + ANDI DIFF,%HSVV+%HSRDY+%HSMOL+%HSERR + CAIE DIFF,%HSVV+%HSRDY+%HSMOL + JSR EDLZ,ERROR + JRST WRD5 + +;RH10 HACKING ROUTINES. CALL BY JSP HEAD,. DIFF HAS REGISTER ADDRESS IN LH, DATA IN RH. +RHSET: TLOA DIFF,%HRLOD +RHGET: TLZ DIFF,%HRLOD + DATAO DSK,DIFF + MOVEI DIFF,20 + SOJG DIFF,. + DATAI DSK,DIFF + TLNE DIFF,%HDERR + JSR EDLZ,ERROR + ANDI DIFF,177777 + JRST (HEAD) + +DBLK: 0 +];RH + ;SC DISK IO ROUTINE +SC,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,60#120 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,60#120 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: TRC WRITE,120 +WRD3: DPB WRITE,[330700,,DBLK] ;SET OP, UNIT SEL + DPB UNIT,[DCCA DBLK+1] ; & CORE ADDR + DPB UNIT,[DCCA DBLK1+1] + LDB UNIT,[400,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + CONO DC0,DCCSET\DCDENB ;RESET ALL, THEN SET DCDENB + CAIL DIFF,NCYLS + TDZA DIFF,DIFF + SKIPLE DIFF,PKNUM(UNIT) + JRST WRD4 ;PKID IN + MOVE DIFF,QTRAN(UNIT) ;READ PACK ID + DPB DIFF,[DUNFLD GPKID] + MOVEI DIFF,TUTCYL + SKIPGE QTRAN(UNIT) + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL GPKID] + DATAO DC0,[DJMP GPKID] + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR + JRST WRD0 + CONO DC0,DCCSET\DCDENB ;RESET POSSIBLE "FUTURE" IP OR RLCERR + LDB DIFF,[DPKID RPKID] + MOVEM DIFF,PKNUM(UNIT) +WRD4: DPB DIFF,[DPKID DBLK] + MOVE DIFF,DBLK + DPB DIFF,[3300,,DBLK1] + MOVE DIFF,QTRAN(UNIT) + DPB DIFF,[DUNFLD DBLK] + JUMPGE DIFF,WRD4A + LDB DIFF,[DCYL DBLK] ;2ND HALF UNIT + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL DBLK] +WRD4A: DATAO DC0,[DJMP DBLK] + CONSZ DC0,DSSACT + JRST .-1 + CONSO DC0,DSSERR + JRST WRDX ;XFER OK + MOVE DIFF,ERRCT + TRNN DIFF,2 ;DO RECALIBRATE 2 OUT OF 4 RETRIES + JRST WRD2 +WRD0: AOSLE ERRCT ;POSITIONER ERROR--CHECK ERROR COUNT + JSR EC63,ERROR ;TOO MANY--GIVE UP + DATAO DC0,[DSPC+DSRCAL+DSWINF] + CONSO DC0,DSSATT + JRST .-1 + JRST WRD5 ;TRY AGAIN AFTER RESETTING UNIT + +WRD2: HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,40 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: DPB BLOK,[XWBLK XWDS] ;PNTR TO PREV BLOCK + LDB UNIT,[DCCA DBLK+1] ;RESTORE ADR + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +DBLK: DREAD+DUNENB + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) +DBLK1: DRC + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) + DHLT + +GPKID: DSPC+DSCRHD+DSWIDX+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +];SC + +;JSP P,TYI RETURNS CHAR IN C. +;JSP P,TYI0 ALSO SKIPS IF NO INPUT AVAILABLE. +TYI: ILDB C,MEMSIZ-1 ;CHECK FOR COMMANDS FROM MEMORY + JUMPN C,(P) ;FOUND ONE--RETURN + CLEARM MEMSIZ-1 +TYI0: ;ENTRY TO SKIP IF NO INPUT AVAILABLE +KA,[ CONSO TTY,40 + JRST TYI1 + DATAI TTY,C +] +KS,[ SKIPN C,8CTYIN + JRST TYI1 + ANDI C,177 + SETZM 8CTYIN +] +KL,[ MOVEI C,3400 ;DDT MODE INPUT + SETZM DTEFLG + MOVEM C,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE C,DTEF11 + SETZM DTEFLG + JUMPE C,TYI1 +] ANDI C,177 + CAIGE C,175 + CAIN C,33 + JRST (P) ;DON'T ECHO GRITCHES +;DROP INTO TYO + +;JSP P,TYO TYPES OUT CHAR IN C. CLOBBERS A,C. +TYO: ;SKIPE MEMSIZ-1 + ; JRST (P) ;DON'T ECHO COMMANDS FROM MEMORY +KA,[ HRRZ A,C ;COMPUTE PARITY + IMULI A,40201 + AND A,[1111111] + IMUL A,[1111111] + TLNE A,1 + IORI C,200 + CONSZ TTY,20 + JRST .-1 + DATAO TTY,C + ANDCMI C,200 +] +KS,[ MOVE A,C + ANDI A,177 + TRO A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 +] +KL,[ MOVE A,C + ANDI A,177 + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SETZM DTEFLG +] + JUMPGE C,(P) ;CHECK FOR CRLF (AS OPPOSED TO ECHOING A CR) + SKIPA C,C12 ;TYPE AN LF +CRLF: HRROI C,15 + JRST TYO + +TYI1: HRRZ C,-1(P) ;NO INPUT AVAILABLE + CAIE C,TYI0 + JRST TYI ;WAIT FOR IT + JRST 1(P) ;CALL WAS TO TYI0, SKIP RETURN + +LINK: CAIE CMD,'D + CAIN CMD,'K + MOVSI WRITE,-1 ;MAKE THIS INFO MORE CONVENIENT + MOVE D,[440600,,C] + MOVEI T,0 +LINKL: ILDB TT,DIRPT + SKIPGE WRITE + DPB T,DIRPT ;CLOBBER CHARS READ FOR DUMP OR KILL + CAIN TT,'; + JRST LINKN + CAIN TT,': + JRST LINKQ + JUMPE TT,LINKN +LINKQ1: IDPB TT,D + TLNE D,770000 + JRST LINKL +LINKN1: CAMGE D,[600,,B] ;THROUGH WITH FN2? + JRST LINKL + JUMPL WRITE,KILL1 + MOVEM A,FN1 + MOVEM B,FN2 + JRST MLOOK2 + +LINKN: TLNN D,770000 + JRST LINKN1 + IDPB T,D ;FILL OUT WITH SPACES + JRST LINKN + +LINKQ: ILDB TT,DIRPT + JUMPGE WRITE,LINKQ1 + DPB T,DIRPT + JRST LINKQ1 + +READ: MOVEI BLKIN,CORE + JSP P,CRLF + MOVEI CMD,0 ;INITIALIZE COMMAND +READ1A: MOVEI WRITE,0 ;INITIALIZE NUMBER + MOVSI B,(SIXBIT \@\) ;INITIALIZE 1ST FILE NAME +READ1: MOVEM B,FN1 +READ3A: MOVSI B,(SIXBIT \@\) ;INITIALIZE CURRENT FILE NAME + MOVE D,[440600,,B] +READ2: JSP P,TYI + CAIN C,177 + JRST READ ;IF RUBOUT START OVER + CAIGE C,175 + CAIN C,33 + JRST ALTMOD ;JUMP IF 33, 175, 176 + ASH WRITE,3 ;DOES NOT CHANGE SIGN OF WRITE + CAIL C,"0 + CAILE C,"7 + TLOA WRITE,400000 ;NON-NUMERIC CHAR--MAKE WRITE NEGATIVE + ADDI WRITE,-"0(C) ;NUMERIC CHAR--ACCUMULATE NUMBER + CAIN C,"; + JRST READ3 ;SET SYSTEM NAME + CAIN C,40 + JRST READ1 ;SET FIRST FILE NAME + CAIN C,^Q + JSP P,TYI ;QUOTED CHARACTER + CAIGE C,140 ;CHECK FOR LOWER CASE + SUBI C,40 + JUMPL C,DOIT ;IF LESS THAN 40 (EXC. ^Q) END OF COMMAND + TLNE D,770000 ;SKIP IF ALREADY SIX CHARS + IDPB C,D + JRST READ2 + +READ3: MOVEM B,SYSN + CAIE CMD,'U + JRST READ3A + JRST DOIT ;IF COMMAND IS U GO LIST DIRECTORY + +ONOFF: CAIGE WRITE,NDSK + DPB CMD,[100,,QDED(WRITE)] ;LOW BIT OF CMD DETERMINES ON/OFF LINE STATUS + JRST READ ; (K=13, L=14) + +ALT1: LDB CMD,D ;PICK UP COMMAND CHAR + CAIE CMD,'K + TRNN CMD,2 + JRST READ1A ;GET FILE NAME + JRST DOIT ;DON'T WANT FILE NAME--GO TO WORK + +ALTMOD: MOVEI C,"$ + JSP P,TYO ;ECHO DOLLAR SIGN + JUMPLE WRITE,ALT2 ;JUMP IF NOT LAST TYPED + JUMPN CMD,ONOFF ;JUMP IF + HRRM WRITE,SADR ;SET STARTING ADDR + JRST READ + +ALT2: TLC D,360000 + TLCN D,360000 ;SKIP IF SINGLE CHARACTER BEFORE + JUMPE CMD,ALT1 ;JUMP IF NO COMMAND ALREADY TYPED +DOIT: MOVEM B,FN2 ;STORE SECOND FILE NAME + HRRZ B,MU + HRRM B,CU ;MAKE MASTER UNIT CURRENT UNIT + MOVNI WRITE,1 + JSP P,LODUMP ;DUMP OUT PSEUDO-CORE + CAIN CMD,'G + JRST LOADG0 ;GO + JSP TT,RDTUT + MOVE C,SYSN +MLOOK2: MOVSI WRITE,1 ;MAKE WRITE INDICATE LOAD + MOVEI BLOK,MFDBLK + MOVEI UNIT,DIR + JSP TT,RD ;READ MASTER DIRECTORY TO FIND WHERE USER DIRECTORY IS + MOVE T,DIR+MDCHK + CAME T,[SIXBIT/M.F.D./] + JSR EMFC,ERROR + MOVE T,DIR+MDNUDS + CAIE T,NUDSL + JSR EMFC,ERROR + CAIN CMD,'S + JRST LISTS ;LIST DISK ID'S AND SYSTEM NAMES + MOVE T,DIR+MDNAMP +MLOOK: CAMN C,DIR+MNUNAM(T) ;LOOK UP SYSTEM NAME + JRST MLOOK1 + ADDI T,LMNBLK + CAIGE T,2000 + JRST MLOOK + JSR ESNF,ERROR ;NOT FOUND + +MLOOK1: MOVEI BLOK,2*NUDSL-2000(T) ;CONVERT USER SLOT TO BLOCK NUMBER + LSH BLOK,-1 + HRRM BLOK,UDBLK ;REMEMBER FOR KILL OR DUMP + MOVEI UNIT,DIR + JSP TT,RDM ;READ USER DIRECTORY +ULOOK: CAME C,DIR+UDNAME + JSR ECDR,ERROR ;WRONG ONE?? + CAIE CMD,'F + CAIN CMD,'U + JRST LISTFC ;LIST USER DIRECTORY + MOVSI TT,UNIGFL + MOVE T,DIR+UDNAMP + MOVE A,FN1 + MOVE B,FN2 +ULOOK1: CAMN A,DIR+UNFN1(T) ;LOOK UP FILE NAME + CAME B,DIR+UNFN2(T) + JRST ULOOK2 + TDNN TT,DIR+UNRNDM(T) ;IS THIS FILE FOR REAL? + JRST ULOOK3 +ULOOK2: ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK1 + CAIE CMD,'D ;IF NOT FOUND BETTER BE DUMP + JSR EFNF,ERROR + MOVE T,DIR+UDNAMP +ULOOK4: SKIPN DIR+UNFN1(T) ;FIND FREE SLOT FOR NEW FILE + JRST DUMP + ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK4 + MOVNI T,LUNBLK ;NO FREE SLOTS--TRY TO EXTEND NAME AREA DOWN + ADDM T,DIR+UDNAMP + MOVE T,DIR+UDESCP + IDIVI T,6 + ADDI T,UDDESC + CAMGE T,DIR+UDNAMP ;DID WE RUN INTO DESCRIPTOR AREA? + JRST DUMP0 + JSR EDIR,ERROR ;YES + +ULOOK3: HRRM T,DMP4 ;IF FILE FOUND, SAVE SLOT NUMBER FOR DUMP + LDB C,[UNDSCP DIR+UNRNDM(T)] + JSP TT,GBP + MOVEM C,DIRPT ;SET UP DESCRIPTOR AREA BYTE POINTER + MOVSI TT,UNLINK + TDNE TT,DIR+UNRNDM(T) + JRST LINK ;FILE IS A LINK + LDB A,[UNPKN DIR+UNRNDM(T)] +ULOOK5: CAMN A,TUT+QPKNUM ;SEE IF IT'S MOUNTED + JRST LOAD + JSP TT,NXTTUT + JRST ULOOK5 + JSR EPNM,ERROR + +LOAD: CAIE CMD,'D ;GET HERE IF FILE FOUND + CAIN CMD,'K ;IF DUMP OR KILL, DELETE IT + JRST KILL +ZERO: MOVEI TT,CORE-1 + TRNN CMD,20 ;SKIP IF T$ SYMBOL LOADING COMMAND + JRST ZERO1 + MOVEI B,DDT-1 ;ASSUME ALWAYS USING MOBY DDT + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAME B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSR EDDT,ERROR + SKIPE D,-2(C) ;FLUSH ALL BUT INITIAL SYMBOLS + MOVEM D,-1(C) + MOVE D,-1(C) + MOVEI TT,CORE-1 + CAILE TT,-1(D) + MOVEI TT,-1(D) ;DON'T ZERO SYMBOL TABLE NOR DDT +ZERO1: TRNE CMD,1 + JRST LOAD1 ;NON-ZEROING COMMAND + SETZM 40 ;BEGIN CLEARING CORE + MOVE T,[40,,41] ;SET UP BLT POINTER +;CODE TO SKIP OVER NXM +ZERO2: CAIG TT,10*2000-1(T) ;MORE THAN 8K LEFT TO ZERO? + JRST ZERO4 ;NO, ZERO REMAINING WORDS AND PROCEED + MOVE D,T ;AVOID KA/KL INCOMPAT BY COPYING BLT PNTR + BLT D,10*2000-1(T) ;ZERO NEXT 8K +ZERO3: ADDI T,10*2000 ;MOVE DEST OF BLT PNTR UP 8K + ANDCMI T,1777 ;ROUND DOWN TO 1K BOUNDARY +KA, CONO 10000 ;CLEAR NXM + MOVES (T) ;SET NXM IF HOLE +KA, CONSZ 10000 ;NXM GENERATED? +KA, JRST ZERO3 ;YES, GO TO NEXT 8K + JRST ZERO2 ;NO, CLEAR THIS 8K + +ZERO4: BLT T,(TT) ;AND CLEAR TO TOP BOUNDARY + TRNE CMD,20 + JRST LOAD1 ;IF SYMBOL-LOADING COMMAND, STOP THERE + CLEARM CBUF + MOVE T,[CBUF,,CBUF+1] + BLT T,CBUF+1777 + MOVEI UNIT,CBUF + MOVE BLOK,CBLK ;-NSWBL IN LH + JSP TT,WRM ;CLEAR PSEUDO-CORE + AOBJN BLOK,.-1 +LOAD1: SETZB BUFP,BLKCNT ;SET UP BUFP SO FIRST CALL TO WD WILL READ +LOAD2: JSP P,WD ;FIRST BLOCK OF FILE + CAME D,[JRST 1] ;LOOK FOR END OF SBLK LOADER + JRST LOAD2 + CAIN CMD,'I ;IF VERIFY, START SIMULATING DUMP + JRST DUMP.5 +LOAD3: JSP P,WD ;READ BLOCK HEADER + JUMPGE D,LOADS ;IT'S A JUMP BLOCK + MOVE A,D + MOVE B,D + JSR LOADB ;LOAD LOGICAL BLOCK INTO CORE + JRST LOAD3 + +LOADB: 0 +LOAD4: JSP P,WD ;LOAD A LOGICAL BLOCK--AOBJN POINTER IN B, + ROT A,1 ;BLOCK HEADER IN A (FOR CHECKSUM) + ADD A,D ;ADD NEW WORD INTO CHECKSUM + JSP P,FD ;AND PREPARE TO SMASH IT AWAY + JRST .+2 ;LOCATION CAN'T BE LOADED + MOVEM D,(C) ;SMASH WORD AWAY + AOBJN B,LOAD4 + JSP P,WD + CAMN A,D ;CHECK THE CHECKSUM + JRST @LOADB + JSR ECKS,ERROR ;BAD CHECKSUM + +LOADS: CAIN CMD,'M + JRST LOADG0 ;DON'T LOAD SYMBOLS NOR SADR + MOVEM D,NXTBW3 ;SAVE S.A. + MOVEI B,DDT-1 ;ASSUME IS ALWAYS MOBY DDT. + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + SKIPN (C) + JRST LOADJ ;AIN'T GOT NO DDT, IGNORE SYMBOLS + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAMN B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSP P,FD ;FETCH SYMBOL TABLE POINTER + JSR EDDT,ERROR + MOVE D,(C) + MOVEM D,DDTM2 +LOADS1: MOVE B,DDTM2 ;GET LOWEST SYMBOL LOC SO FAR + JSP P,WD ;GET SYMBOL BLOCK HEADER + JUMPGE D,LOADS2 ;JUMP IF END OF SYMBOLS + TRNE D,-1 ;SKIP IF REALLY SYMBOLS AND NOT SOME OTHER BRAIN-DAMAGED CRUFT + JRST LOADBD + MOVSS D + HRLI D,-1(D) + ADD B,D ;EFFECTIVELY SUBTRACTS LENGTH OF BLOCK FROM BOTH HALVES + MOVEM B,DDTM2 ;OF SYMBOL TABLE POINTER + HRL B,D ;SET UP AOBJN POINTER IN B + HRLZ A,D ;AND RECREATE HEADER IN A + JSR LOADB ;LOAD THE SYMBOLS + JRST LOADS1 + +LOADBD: HLRO B,D ;-# WORDS TO SKIP (NOT COUNTING CHECKSUM) + JSP P,WD + AOJLE B,.-1 + JRST LOADS1 ;TRY NEXT SYMBOL BLOCK + +LOADS2: MOVE D,DDTM2 ;GET UPDATED DDT SYMBOL PNTR +LOADS4: MOVEI B,DDT-2 ;WE KNOW WHERE IT ALWAYS GOES + JSP P,FD ;PUT BACK SYMBOL TABLE POINTER + JSR EBUG,ERROR ;CAN'T PUT IT BACK?? + MOVEM D,(C) + MOVEI B,DDT-4 ;GIVE STARTING ADDRESS TO DDT + JSP P,FD + JSR EBUG,ERROR + MOVE D,NXTBW3 + MOVEM D,(C) + MOVEI D,DDT ;AND SET DSKDMP START ADDRESS TO DDT +LOADJ: HRRM D,SADR ;SET STARTING ADDRESS FROM JUMP BLOCK +LOADG0: MOVE T,BOOTNS ;APPROP DISK WAIT FOR NON BUSY INSTR + MOVEM T,BOOT +LOADG: JSP TT,WRCB ;MAKE SURE ALL LOADED CRUFT IN PSEUDO-CORE IS OUT + MOVEI WRITE,0 + JSP P,LODUMP ;AND LOAD IT ALL IN + TRNE CMD,10 + JRST READ ;NON-GOING COMMAND +GO: +PH,[ MOVSI B,-LSWPADR +GO1: IORD DIFF,SWPCS1 + TRNN DIFF,%HXRDY ; Wait for controller + JRST GO1 + HRRZ DIFF,SWPVAL(B) + IOWR DIFF,SWPADR(B) + AOBJN B,GO1 +];PH +RH,[ MOVE B,ERRWD + CONI DSK,HEAD + TLNE HEAD,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +GO1: CONSZ DSK,%HIBSY + JRST .-1 + MOVE DIFF,SWPOU1(B) + JSP HEAD,RHSET + AOBJN B,GO1 +];RH +RP,[ MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPOU1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPOU2 +];RP +SC, DATAO DC0,[DJMP SWPOUT] + JRST WAIT + +LISTS: JSP P,CRLF +LISTS2: JSP P,TYI0 + JRST LOADG1 ;SHUT UP IF KEY HIT + MOVE C,TUT+QPKNUM ;TYPE PACK NUMBER + JSP TT,PNO + MOVE D,TUT+QPAKID ;AND I.D. + JSP TT,PD2 + JSP TT,NXTTUT ;SAME FOR ALL DIRECTORIES + JRST LISTS2 + MOVE T,DIR+MDNAMP +LISTS1: CAIGE T,2000 + JSP P,TYI0 ;STOP TYPING IF TTI FLAG ON + JRST LOADG1 + SKIPE D,DIR+MNUNAM(T) + JSP TT,PD ;TYPE OUT USER NAME + ADDI T,LMNBLK + JRST LISTS1 + +LISTFC: MOVE T,DIR+UDNAMP +LISTF1: +KA, CONSO TTY,40 ;STOP TYPING IF TTI FLAG ON +KS, SKIPN 8CTYIN ; Stop typing if character waiting + CAIL T,2000 + JRST LOADG1 + SKIPN DIR+UNFN1(T) ;SKIP IF FILE IN THIS SLOT + JRST LISTF2 + JSP P,CRLF + LDB C,[UNPKN DIR+UNRNDM(T)] + JSP TT,PNO ;TYPE PACK NUMBER + MOVE D,DIR+UNFN1(T) + JSP TT,PD2 ;TYPE FIRST FILE NAME + MOVE D,DIR+UNFN2(T) + JSP TT,PD2 ;AND SECOND FILE NAME +LISTF2: ADDI T,LUNBLK + JRST LISTF1 + +KILL: JSP TT,NXTB6 ;GET HERE ON KILL OR DUMP OF EXISTING FILE + MOVEI T,0 ;ZERO BYTES IN USER DIRECTORY DESCIPTOR AREA + DPB T,DIRPT ;NXTB6 JUMPS TO KILL1 AT END OF FILE + MOVE C,BLOK + JSP TT,GTP + ILDB T,C + CAIGE T,TUTLK-1 ;SOS USAGE OF THIS BLOCK + SOJL T,[JSR ECDR,ERROR] + DPB T,C + JRST KILL + +KILL1: HRRZ T,DMP4 ;CLEAR OUT USER DIRECTORY SLOT + CLEARM DIR+UNFN1(T) + CLEARM DIR+UNFN2(T) + CLEARM DIR+UNRNDM(T) + MOVSI WRITE,-1 + CAIN CMD,'K + JRST KILDMP ;IF KILL DON'T DUMP + JRST DMP4 ;MUST DUMP ON SAME UNIT + +DUMP0: MOVE T,DIR+UDNAMP ;GET HERE IF SLOT CREATED AT BOTTOM OF NAME AREA +DUMP: HRRM T,DMP4 ;GET HERE IF EMPTY SLOT FOUND IN NAME AREA +DMP0: MOVEI D,0 ;GET HERE IF USING SLOT OF OLD FILE +DMP1: ;MOVE C,TUT+QSWAPA + MOVEI C,0 ;NOTE START AT 0 NOT QSWAPA + MOVE B,C + SUB B,TUT+QLASTB + HRLZ B,B ;LH(B) COUNTS BLOCKS, RH(B) COUNTS FREE BLOCKS + JSP TT,GTP +DMP2: ILDB T,C + SKIPE T +KA, SUBI B,1 ;THIS RELIES ON CARRY PROPAGATING FROM RH TO LH IN AOBJN +KL, HRRI B,-1(B) ;ON KI10, KL10 CHANGE SUBI B,1 TO HRRI B,-1(B) +KS, HRRI B,-1(B) ;KS too... + AOBJN B,DMP2 + CAIG B,(D) ;RH OF D IS HIGHEST SO FAR, LH SAYS WHICH UNIT + JRST DMP5 ;NOT BETTER THAN RECORD + MOVE D,B ;NEW RECORD--RECORD IT + HRL D,CU +DMP5: JSP TT,NXTTUT ;TRY NEXT + JRST DMP1 + ;FALLS THROUGH AT END +DMP3: HLRM D,CU ;SET CURRENT UNIT TO ONE WITH MOST FREE BLOCKS + JSP TT,RDTUT ;GET ITS TUT +DMP4: MOVEI T,. + MOVE A,FN1 + MOVE B,FN2 + MOVEM A,DIR+UNFN1(T) ;PUT CRUFT INTO SLOT + MOVEM B,DIR+UNFN2(T) + SETOM DIR+UNDATE(T) ; Unknown creation date + HRROI C,777000 ; Unknown reference date + MOVEM C,DIR+UNREF(T) ; Unknown author, 36. bit bytes +SC,[ MOVEM A,XWDS+XWFN1 + MOVEM B,XWDS+XWFN2 + MOVE C,SYSN + MOVEM C,XWDS+XWSYSN +] MOVE C,DIR+UDESCP ;PUT DESCRIPTOR CHARACTER ADDRESS + MOVE B,TUT+QPKNUM ;AND PACK NUMBER + DPB B,[UNPKN C] + MOVEM C,DIR+UNRNDM(T) ;INTO USER DIRECTORY SLOT + ;MOVE C,TUT+QSWAPA ;COMMENTED OUT INSN DUMPS INTO FILE AREA + MOVEI C,0 ;DUMP INTO SWAPPING AREA TO AVOID Y FILES + MOVEM C,LBLOCK ;A DAEMON WILL COPY INTO FILE AREA AFTER SALVAGE + JSP TT,GTP + MOVEM C,TUTPT ;INITIALIZE TUT POINTER + MOVE C,DIR+UDESCP + JSP TT,GBP + MOVEM C,DIRPT ;INITIALIZE DESCRIPTOR AREA POINTER + SETOB WRITE,BLKCNT ;FORCE NXTBW TO LOAD ADR +KA, HRLOI BUFP,-2001-1 ;SET UP BUFP SO FIRST WORD GOES IN DBUF+0 +KL, HRLOI BUFP,-2001 +KS, HRLOI BUFP,-2001 + MOVE D,[JRST 1] + JSP P,WD ;END OF SBLK LOADER +;DROPS THROUGH + +;DROPS IN +DUMP.5: MOVSI WRITE,-'I(CMD) ;GET HERE IF VERIFY--SET WRITE NEGATIVE IF + MOVEI B,40 ;DUMP AND ZERO IF VERIFY--FIRST ADDR DUMPED IS 40 + HRRM B,DUMP4 + HLLOS DUMP6 + SETZM DUMP9S + SETZM DUMP9J + SETZM DUMP9K + MOVEI B,DDT-3 ;SET UP TO NOT DUMP SYMBOLS AS PART OF CORE IMAGE + JSP P,FD + JSR EBUG,ERROR + SKIPN A,(C) ;GET PNTR TO BUILT IN SYMBOLS + JRST DUMP4 ;NO DDT, DON'T HACK THIS + HRRM A,DUMP7 ;THIS IS WHERE WE START DUMPING AGAIN + MOVEM A,DUMP9K ;THIS WILL BE INITIAL SYMBOL TABLE PNTR WHEN DDT LOADED + MOVNI A,(A) + ADD A,1(C) ;GET MINUS SIZE OF NON-BUILTIN SYMBOL TABLE IN RH(A) + HRL A,1(C) ;GET PNTR TO SYMBOL TABLE + HLRM A,DUMP6 ;THIS IS WHERE WE STOP DUMPING + MOVSM A,DUMP9S ;SAVE AOBJN PNTR TO NON-BUILTIN SYMBOLS + MOVE A,-1(C) ;PICK UP START ADDRESS + MOVEM A,DUMP9J ;SAVE + MOVE B,-2(C) ;DUMP LOW CORE (ACS) OUT OF PLACE SAVED IN DDT + HLLZ A,B ;HERE B HAS ADDRESS DUMPING FROM + JRST DUMP3B ;AND A AND D HAVE VIRTUAL ADDRESS + +DUMP1: ;SKIP OVER NXM ON DUMPING +KA,[ CONSO 10000 ;NXM SET? + JRST DUMP1A ;NO, CONTINUE IN SEQUENCE + ADDI B,10*2000-1 ;SKIP 8K + TRZ B,1777 ;ROUND DOWN TO 8K BOUDARY + CONO 10000 ;CLEAR NXM +DUMP1A: +];KA +DUMP6: CAIGE B,. ;SKIP IF REACHED SYMBOL TABLE + JRST DUMP8 +DUMP7: MOVEI B,. ;SKIP OVER SYMBOLS, DUMP DDT + HLLOS DUMP6 ;DEFUSE TEST +DUMP8: JSP P,FD + JRST DUMPJ ;TIME TO WRITE JUMP BLOCK AND SYMBOL TABLE + SKIPN (C) ;LOOK FOR NON-ZEROES + AOJA B,DUMP1 + MOVE A,B ;SAVE START OF BLOCK +DUMP2: TLZ A,-1 ;LOOK FOR TWO CONSECUTIVE ZEROES +DUMP2A: CAIL B,200(A) ;BUT DON'T DUMP MORE THAN 200 WORDS AT A TIME + JRST DUMP3 + XCT DUMP6 + JSP P,FD + JRST DUMP3 ;END OF CORE, WRITE OUT LAST BLOCK + SKIPE (C) + AOJA B,DUMP2 ;NONZERO + TLON A,-1 ;ZERO, WAS PREV LOC ZERO ALSO? + AOJA B,DUMP2A ;NO, CHECK FOLLOWING LOC + SOJA B,DUMP3 ;YES, DUMP THE NON-ZERO THAT PRECEDES IT + +DUMP3: HRRM B,DUMP4 ;SAVE ADDRESS TO CONTINUE SEARCH + SUBM A,B ;RH(B) GETS MINUS THE LENGTH OF THE BLOCK + HRL A,B ;SET UP HEADER IN A + MOVE B,A ;AND B +DUMP3B: MOVE D,A ;AND D + JSP P,WD ;WRITE HEADER +DUMP3A: JSP P,FD + JSR EBUG,ERROR ;CAN'T FETCH WORD WE FETCHED BEFORE?? + MOVE D,(C) + ROT A,1 + ADD A,D ;COMPUTE CHECKSUM + JSP P,WD ;WRITE DATA WORD + AOBJN B,DUMP3A + MOVE D,A + JSP P,WD ;WRITE OUT CHECKSUM +DUMP4: MOVEI B,. ;AND CONTINUE SEARCHING + JUMPN B,DUMP1 ;IF MRC EVER SEES THIS --SELFMODIFYING CODE-- .... + JRST DUMP9 ;FINISHED DUMPING SYMBOLS + +DUMPJ: SKIPN DUMP9K + JRST DMP9J1 + HRROI D,DDT-2 ;BUGGER THE SYMBOL TABLE + MOVE A,D + JSP P,WD + MOVE D,DUMP9K + ROT A,1 + JSP P,WD + ADD D,A + JSP P,WD +DMP9J1: SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;WRITE OUT JUMP BLOCK + SKIPN B,DUMP9S ;WRITE SYMBOLS + JRST DUMP9 ;NO SYMBOLS + HLLZ A,B + HLLZS DUMP4 ;DUMP SYMBOL BLOCK, RETURN TO DUMP9 + JRST DUMP3B + +DUMP9: JUMPE WRITE,LOADG1 ;IF VERIFY, THAT'S ALL + SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;SECOND JUMP BLOCK + HRRZ T,DMP4 ; GET POINTER TO NAME AREA + AOS BUFP + DPB BUFP,[UNWRDC+DIR+UNRNDM(T)] + JSP TT,NXTBLK + JSP TT,WRDB ;WRITE OUT LAST BLOCK + SKIPE T,BLKCNT + JSR NXTBW3 ;STORE LAST DESCRIPTOR BYTE + MOVEI T,0 + JSR NXTBW3 ;AND INDICATE END OF FILE + LDB T,[360600,,DIRPT] + IDIVI T,6 + HRRZ TT,DIRPT + IMULI TT,6 + SUBI TT,6*-5-1(T) + HRRZM TT,DIR+UDESCP ;INDICATE NEW END OF DESCRIPTOR AREA +KILDMP: MOVEI UNIT,TUT + MOVEI BLOK,TUTBLK + JSP TT,WRD ;WRITE OUT TUT ON THIS UNIT +REPEAT NTUTBL-1,[ + ADDI UNIT,2000 + ADDI BLOK,1 + JSP TT,WRD +] + HRRZ B,CU + HRRM B,KD2 ;WRITE OUT USER DIRECTORY ON ALL UNITS +KD1: ADDI B,1 + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + SKIPE QDED(B) + JRST KD2 + MOVEI UNIT,DIR +UDBLK: MOVEI BLOK,. + MOVE TT,DIR+UDNAME + CAME TT,SYSN + JSR EBUG,ERROR + JSP TT,WR +KD2: CAIN B,. + JRST LOADG1 + JRST KD1 + +GTP: SKIPGE TUT+QPKNUM + JSR EBUG,ERROR ;MUST BE OLD-STYLE TUT? + SUB C,TUT+QFRSTB + JUMPL C,[JSR EBUG,ERROR] + IDIVI C,TUTEPW + IMULI A,-10000*TUTBYT + HRLI C,440000+TUTBYT_6(A) + ADDI C,TUT+LTIBLK + JRST (TT) + +SC,[ ;LOGICAL TO PHYSICAL DISK MAPPING +QTRAN: 0 ;INDEX BY LOG DSK # + 1 ;4.9 => USE HIGH HALF OF DRIVE, RH = PHYS DRIVE # + 2 ;(NO LONGER DOES ANYTHING, NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND JUST IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NDSK,.ERR QTRAN LOSES!! +];SC + +ERRCT: 0 ;ERROR COUNTER +DDTM2: 0 ;DDT SYMBOL TABLE POINTER +DUMP9J: 0 ;START INSTRUCTION (AT DUMP9) +DUMP9S: 0 ;SYMBOL TABLE POINTER (AT DUMP9) +DUMP9K: 0 ;INITIAL SYMBOL TABLE PNTR (AT DUMP9) +LBLOCK: 0 ;LAST BLOCK WRITTEN OR READ +BLKCNT: 0 ;NUMBER OF BLOCKS READ OR WRITTEN CONSECUTIVELY +DIRPT: 0 ;DESCRIPTOR AREA BYTE POINTER +TUTPT: 0 ;TUT BYTE POINTER +FN1: 0 ;FILE NAME 1 +FN2: 0 ;FILE NAME 2 +PKNUM: REPEAT NDSK,-1 ;PACK NUMBER INDEXED BY DRIVE NUMBER +QDED: BLOCK NDSK ;-1 IF DRIVE NOT TO BE USED +XWDS: BLOCK 4 +RPKID: 0 +BOOTNS: RP, CONSZ DPC,BUSY + SC, CONSZ DC0,DSSACT + RH, CONSZ DSK,%HIBSY + PH, IORD B,SWPCS1 ; UGH! + + CONSTANTS + +IFL BEG+1677-., .ERR BLOAT +INFORM SPACE LEFT,\BEG+1677-. +BLOCK BEG+1677-. + +BADBLK: 0 ;BLOCK WITH HDWE ERROR +INFORM BADBLK,\.-1-BEG+ + +];END IFE BOOTSW +IFN BOOTSW,[ +BEG=MEMSIZ-2000 +LOC MEMSIZ-100 +] + +CBOOT: CLEARM MEMSIZ-1 ;BOOTSTRAP +RP,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DPC,BUSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DPC,BUSY + JRST .-1 + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 + DATAO DPC,CLATT1 + DATAO DPC,SUNIT0 + DATAI DPC,B +BOOT0: TRNN B,RP03BT + JRST BOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +BOOT1: HLLZS BOOT0 ;PREVENT TRNN FROM SKIPPING AGAIN + MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPIN1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPIN2 + CONSO DPC,DONE + JRST .-1 + JRST BEG + +ERRWD: -1700,,BEG-1 +CLATT1: DEASEC ALLATT +SWPSK: DSEEKC+200._22. +SWPIN1: DWRITC+200._22.+3_17.+2._12.+ICWA ;NBLKS 4 +SWPIN2: DREADC+200._22.+4_17.+8._12.+ICWA +SWPOU1: DWRITC+200._22.+4_17.+8._12.+ICWA +SWPOU2: DREADC+200._22.+3_17.+2_12.+ICWA +IFN NSWBL-5, .ERR THE PRECEDING 4 CONSTANTS ARE WRONG! +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +RP3ADJ: <&377>_22.+<.BM DCYLXB> +SUNIT0: DNOOPC + +SKWAIT: DATAI DPC,A ;AWAIT SEEK DONE UNIT 0 + TRNN A,ALLATT + JRST SKWAIT + DATAO DPC,CLATT1 + MOVEI A,30. + SOJG A,. + DATAI DPC,A + TLNN A,(ONCYL) + JRST SKWAIT + JRST (P) + +WAIT: CONSO DPC,DONE + JRST .-1 +];RP + +PH,[ ;; Initially we could not use IORDQ or IOWRQ because they were + ;; macros that used a literal. There is nothing to stop us now, + ;; except the fact that this code works fine and is as small as you + ;; could possibly want. + +BOOT: +IFE BOOTSW, JRST BEG ; or IORD B,SWPCS1 or JRST LOADG1 +IFN BOOTSW, IORD B,SWPCS1 + TRNN B,%HXRDY + JRST BOOT +KS, WREBR 0 ; No paging or caching + MOVEI A,0 + IOWR A,SWPCS2 ; Select drive +BOOT0: IORD A,SWPCS1 + TRNN A,%HXDVA + JRST BOOT0 ; Await drive available + MOVSI B,-LSWPADR +BOOT1: HLRZ A,SWPVAL(B) + IOWR A,SWPADR(B) +BOOT2: IORD A,SWPCS1 + TRNN A,%HXRDY ; Wait for controller + JRST BOOT2 + TRNE A,%HXTRE+%HXMCP ; Lossage? + JRST 4,. ; Foo! + AOBJN B,BOOT1 + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +SWPADR: UBAQ,,UBAPAG+UBPG_1 ; Set up Unibus map + UBAQ,,UBAPAG+UBPG_1+1 + UBAQ,,%HRCS2 ; Clear controller +SWPCS2: UBAQ,,%HRCS2 ; Select drive +SWPCS1: UBAQ,,%HRCS1 ; Initialize + UBAQ,,%HRCYL ; Desire cylinder + UBAQ,,%HRWC ; Set (half) word count + UBAQ,,%HRBA ; Set Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Write + UBAQ,,%HRWC ; Reset (half) word count + UBAQ,,%HRBA ; Reset Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Read +LSWPADR==:.-SWPADR + +IFN BEG&1777, .ERR BEG does not lie on a page boundary? + +;;; LH FOR SWAP IN, RH FOR SWAP OUT +SWPVAL: %UQVAL+%UQFST+BEG_-9,,%UQVAL+%UQFST+BEG_-9 ; Set up Unibus map + %UQVAL+%UQFST+BEG_-9+1,,%UQVAL+%UQFST+BEG_-9+1 + %HYCLR,,%HYCLR ; Clear controller + 0,,0 ; Select drive + %HMRDP,,%HMRDP ; Initialize + NCYLS,,NCYLS ; Desire cylinder + -1700*2,,-1700*2 ; Set (half) word count + UBPG_14,,UBPG_14 ; Set Unibus address + ZZ1,,ZZ2 ; Desire track and sector + %HMWRT,,%HMWRT ; Write + -1700*2,,-1700*2 ; Reset (half) word count + UBPG_14,,UBPG_14 ; Reset Unibus address + ZZ2,,ZZ1 ; Desire track and sector + %HMRED,,%HMRED ; Read +IFN .-SWPVAL-LSWPADR, .ERR SWPVAL wrong length. + +CBLK: -NSWBL,,NBLKS + +WAIT: IORD B,SWPCS1 + TRNN B,%HXRDY + JRST WAIT +];PH + +RH,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DSK,%HIBSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DSK,%HIBSY + JRST .-1 +KL, CONSZ PAG,660000 ;PAGING AND CACHE MUST BE DISABLED +KL, JRST 4,. + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 +BOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST BOOT0 ;AWAIT DRIVE AVAILABLE + MOVE B,ERRWD + CONI DSK,A + TLNE A,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +BOOT1: DATAO DSK,SWPIN1(B) + MOVEI A,20 + SOJG A,. + CONSZ DSK,%HIBSY + JRST .-1 + AOBJN B,BOOT1 + CONSZ DSK,%HIERR + JRST 4,. + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +ERRWD: -1700,,BEG-1 +SWPIN1: %HRLOD+%HRDCL,,%HMRDP +SWPIN2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPIN3: %HRLOD+%HRADR,,ZZ1 +SWPIN4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPIN5: %HRLOD+%HRADR,,ZZ2 +SWPIN6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +SWPOU1: %HRLOD+%HRDCL,,%HMRDP +SWPOU2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPOU3: %HRLOD+%HRADR,,ZZ2 +SWPOU4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPOU5: %HRLOD+%HRADR,,ZZ1 +SWPOU6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +CBLK: -NSWBL,,NBLKS+NBLKSC ;AVOID CYLINDER 406 WHICH KLDCP USES + +WAIT: CONSO DSK,%HIDON + JRST .-1 +];RH + +SC,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DC0,DSSACT OR JRST LOADG1 +IFN BOOTSW, CONSZ DC0,DSSACT + JRST .-1 + DATAO DC0,SWPINJ + CONSZ DC0,DSSACT + JRST .-1 + JRST BEG + +SWPINJ: DJMP SWPIN + +DADR==NCYLS_13+</2>_6+<&1> ;ADDR OF LAST BLOCK IN CORE BUFFER +DADR1==NCYLS_13+_6+ ;ADDR OF NEXT BLOCK (CONTAINS +SWPIN: DWRITE+DUNENB+DADR ; WORKING COPY OF DSKDMP) + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +SWPOUT: DWRITE+DUNENB+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +WAIT: CONSZ DC0,DSSACT + JRST .-1 +];SC +SADR: JRST BOOT ;AND GO TO PROGRAM TO BE STARTED +SYSN: SIXBIT /./ ;CURRENT DIRECTORY +IFG .+1-MEMSIZ,.ERR BOOT BLOAT + +IFE BOOTSW,{ ;CURLY BRACKETS TO AVOID ERROR MESSAGE + OFFSET 0 + LOC CORE + +;THESE ARE THE BLOCKS THAT GET WRITTEN ON DISK +; STARTING AT THE BEGINNING OF THE FIRST EXTRA CYLINDER + +CBUF: BLOCK 2000 ;PSEUDO-CORE BUFFER +DBUF: BLOCK 2000 ;DISK BUFFER +DIR: BLOCK 2000 ;DIRECTORY BUFFER +TUT: BLOCK 2000*NTUTBL ;TUT BUFFER +IFN .-BEG,.ERR BLOCKS LOST +; BLOCK 2000 ;CORE OVERLAYED BY DSKDMP +; BLOCK 2000 ;COPY OF DSKDMP +; BLOCK 2000 ;SPARE COPY OF DSKDMP + +END ZZZ +};END IFE BOOTSW +IFN BOOTSW, END CBOOT diff --git a/system/dskdmp.215 b/system/dskdmp.215 new file mode 100644 index 0000000..561cf07 --- /dev/null +++ b/system/dskdmp.215 @@ -0,0 +1,1898 @@ +;;; -*-Midas-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +TITLE DSKDMP + +.MLLIT==1 + +DEFINE SETF TEXT,FLG +IFDEF FLG,.STOP +.TAG FOOBAR +PRINTC "TEXT +FLG=" +.TTYMAC FLAG +.TTYFLG==.TTYFLG+1 +PRINTX/FLAG +/ +.TTYFLG==.TTYFLG-1 +IFSE FLAG,YES,FLG==1 +IFSE FLAG,NO,FLG==0 +IFSE FLAG,Y,FLG==1 +IFSE FLAG,N,FLG==0 +IFNDEF FLG,FLG==FLAG +TERMIN +IFNDEF FLG,.GO FOOBAR +TERMIN + +IF1,[ +PRINTC "Configuration (KSRP06, KSRP07, KSRM03, KSRM80 or ASK) ? " +.TTYMAC MACH +IFSE MACH,KSRP06,[ + HRIFLG==0 + RP06P==1 + KS10P==1 + NUDSL==500. +] ;KSRP06 +IFSE MACH,KSRP07,[ + HRIFLG==0 + RP06P==0 + RP07P==1 + KS10P==1 + NUDSL==500. +] ;KSRP07 +IFSE MACH,KSRM03,[ + HRIFLG==0 + RP06P==0 + RP07P==0 + RM03P==1 + KS10P==1 + NUDSL==500. +] ;KSRM03 +IFSE MACH,KSRM80,[ + HRIFLG==0 + RP06P==0 + RP07P==0 + RM03P==0 + RM80P==1 + KS10P==1 + NUDSL==500. +] ;KSRM80 +IFSN MACH,ASK,[ +IFNDEF NUDSL,[ PRINTC /No known configuration for "MACH". +/ ]] +TERMIN +] ;IF1 + +SETF [Readin Mode Paper Tape?]HRIFLG +SETF [Assemble BOOT? (If no, full DSKDMP)]BOOTSW + +SETF [RH11/RP06 disk system?]RP06P +IFE RP06P,[ +SETF [RH11/RP07 disk system?]RP07P +IFE RP07P,[ +SETF [RH11/RM03 disk system?]RM03P +IFE RM03P,[ +SETF [RH11/RM80 disk system?]RM80P +IFE RM80P,[ +SETF [RH10 (MC-KL) disk control?]RH10P +IFE RH10P,[ +SETF [AIKA disk control? (no => RP02/RP03)]DC10P +]]]]] +IFN RP06P, RP07P==0 +IFN RP06P+RP07P, RM03P==0 +IFN RP06P+RP07P+RM03P, RM80P==0 +IFN RP06P+RP07P+RM03P+RM80P, RH10P==0 +IFN RP06P+RP07P+RM03P+RM80P+RH10P, DC10P==0 +IFN RP06P+RP07P+RM03P+RM80P+RH10P+DC10P, RP10P==0 +IFE RP06P+RP07P+RM03P+RM80P+RH10P+DC10P, RP10P==1 + +IFE BOOTSW, SETF [Number of dirs? (DM-KA: 200., ML-KA: 250., AI-KA: 440., all others: 500.)]NUDSL + +SETF [KS10 processor?]KS10P +IFE KS10P, SETF [KL10 processor? (no => KA10)]KL10P +IFN KS10P, KL10P==0 +IFN KS10P+KL10P, KA10P==0 +IFE KS10P+KL10P, KA10P==1 + +RH11P==:RP06P+RP07P+RM03P+RM80P + +DEFINE RP +IFN RP10P!TERMIN +DEFINE SC +IFN DC10P!TERMIN +DEFINE RH +IFN RH10P!TERMIN +DEFINE PH +IFN RH11P!TERMIN + +DEFINE KA +IFN KA10P!TERMIN +DEFINE KL +IFN KL10P!TERMIN +DEFINE KS +IFN KS10P!TERMIN + +IFN HRIFLG,[ +NOSYMS ;MAKE PAPER TAPE SHORTER +RIM10 +] + +C=1 ;C-A-B FOR LINKS +A=2 +B=3 +D=4 +BLKIN=5 ;PSEUDO-CORE BLOCK IN CBUF +WRITE=6 ;NEG MEANS DUMP, RH 0 OR WRBIT +DIFF=7 ;DIFF CONO ALSO TEMP +HEAD=10 ;HEAD CONO ALSO TEMP +P=11 ;JSP AC +BLOK=12 +UNIT=13 ;UNIT AND M.A. DATAO +CMD=14 ;COMMAND CHAR +T=15 ;VERY TEMP +TT=16 ;ANOTHER JSP AC, ALSO VERY TEMP +BUFP=17 ;DBUF PNTR--LAST WORD USED + +IF1,[ ;DON'T TAKE A WEEK AND A HALF TO ASSEMBLE. +RP, .INSRT SYSTEM;RP10 > +SC, .INSRT SYSTEM;DC10 > +RH, .INSRT SYSTEM;RH10 > +PH, .INSRT SYSTEM;RH11 > +IFN RP06P, .INSRT SYSTEM;RP06 > +IFN RP07P, .INSRT SYSTEM;RP07 > +IFN RM03P, .INSRT SYSTEM;RM03 > +IFN RM80P, .INSRT SYSTEM;RM80 > +IFE BOOTSW, .INSRT SYSTEM;FSDEFS > +IFE BOOTSW, KL, .INSRT SYSTEM;EPT > +KS, .INSRT SYSTEM;KSDEFS > +KA, TTY==120 +] + +;PARAMETER FILE FOR DSKDMP + +MEMSIZ=1000000 ;ACTUAL SIZE OF MEM +IFNDEF DBGSW,DBGSW==0 ;1 TO DEBUG THIS WITH DDT +DDT==MEMSIZ-4000 +IFN DBGSW,MEMSIZ==MEMSIZ-10000 ;MOVE DOWN UNDER DDT IF DEBUG MODE +CORE==MEMSIZ-10000-<2000*NTUTBL> ;HIGHEST ADR ALWAYS IN CORE+1 +CORES==CORE_<-12> ;BLK # OF ABOVE (FIRST OF BLKS SWAPPED OUT FOR BUFFER AREAS) +NSWBL==4+NTUTBL ;# BLOCKS SWAPPED OUT FOR BUFFER AREAS, +1 FOR DSKDMP ITSELF +HIGH==MEMSIZ-100 ;HIGHEST ADR LOADED/DUMPED+1 + +NDSK==8 ;MAX POSSIBLE. L$n$ DEFINES WHICH ARE REALLY THERE +RP,ICWA=34 +RH,ICWA=34 + +PH, UBPG==:17 ; Use last (usable) page in Unibus map + +KA, LPM=102000,, +KA, LPMR=LPM 2, +KL, PAG=- + +DEFINE INFORM A,B +IF1,[ PRINTX  A = B +] TERMIN + +;COMMANDS ARE: +; L$file LOAD FILE INTO CORE +; T$file LOAD FILE INTO CORE AND GIVE SYMBOLS TO DDT AND START DDT +; M$file LOAD FILE INTO CORE WITHOUT CLEARING CORE FIRST, DOESN'T LOAD SYMBOLS +; K$file DELETE FILE +; D$file DUMP CORE INTO FILE +; I$file VERIFY FILE AGAINST CORE +; G$ START AT STARTING ADDRESS +; U$dir; LIST DIRECTORY +; F$ LIST CURRENT DIRECTORY +; S$ LIST PACK IDS THEN MFD +; nnn$ SET STARTING ADDRESS TO nnn +; L$n$ PUT DISK n ONLINE +; K$n$ TAKE DISK n OFFLINE + +;ERROR MESSAGES ARE: +; CMPERR VERIFY FAILED TO MATCH +; DIRFUL DIRECTORY FULL +; EOF UNEXPECTED EOF +; DIRNF DIRECTORY DOES NOT EXIST +; FNF FILE NOT FOUND +; PKNMTD FILE IS ON PACK THAT IS NOT MOUNTED +; CKSERR CHECKSUM ERROR +; DSKFUL DISK FULL +; NODDT CAN'T ADDRESS DDT SYMBOL TABLE (BUG) +; ?BUG? BUG +; SEEKFL DISK SEEK ERROR +; CLOBRD DISK READ ERROR +; CLOBWR DISK WRITE ERROR +; DIRCLB DIR NAME DIFFERS, TUT DISAGREES WITH DIR +; MFDCLB M.F.D. CLOBBERED +; DSKLUZ DISK LOSSAGE (OFFLINE OR UNSAFE OR MASSBUS ERROR) + +KS, LOC 4000 ; Avoid MTBOOT and KSRIM + +IFE BOOTSW,[ +ZZZ: IFE DBGSW,[ + MOVE T,.... ;THIS CODE BLTS THE FOLLOWING OFFSET CODE + BLT T,MEMSIZ-1-1 ;INTO HIGH MEMORY AND WRITES DSKDMP ON ITS + MOVE T,PROG+MEMSIZ-2-BEG+1 + MOVEM T,BEG+MEMSIZ-2-BEG+1 ;AVOID LOSING DUE TO -1 BLT LOSSAGE +] + MOVSI T,-NDSK+1 ;MAKE ALL BUT DISK 0 BE DEAD (MUST DO L$ TO MAKE THEM ALIVE) + SETOM QDED+1(T) + MOVNS QDED+1(T) + AOBJN T,.-2 + SETZM QDED+0 +RP,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 + DATAO DPC,SUNIT0 + DATAI DPC,B + TRNN B,RP03BT + JRST WBOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +WBOOT1: HLLZS BOOT0 + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DPC,ALLER +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +PH,[ MOVEI T,%HYCLR ; Clear controller + IOWRQ T,%HRCS2 ; (Selects drive 0) +WBOOT0: IORDQ T,%HRCS1 + TRNN T,%HXDVA + JRST WBOOT0 ; Await drive available (well, it is a dual + ; ported drive... perhaps someday?) + MOVEI UNIT,BEG + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ; FIRST BLOCK AFTER CORE BUFFER IS WHERE + ; DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + IORDQ TT,%HRCS1 + TRNE TT,%HXTRE+%HXMCP +IFN DBGSW, JRST DDT +IFE DBGSW, JRST 4,. ; Formerly JRST MEMSIZ-400 (??) + JRST BEG +];PH +RH,[ MOVEI T,ICWA+2 ;SET UP CHANNEL JUMP + MOVEM T,ICWA ;IN INITIAL CHANNEL ADDRESS + SETZM ICWA+1 ;AND CLEAR REMAINING STUFF + SETZM ICWA+3 +WBOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST WBOOT0 ;AWAIT DRIVE AVAILABLE + MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL ;FIRST BLOCK AFTER CORE BUFFER IS WHERE DSKDMP LIVES + MOVEI WRITE,10 + JSP TT,WRD3 + HRRZ BLOK,CBLK + ADDI BLOK,NSWBL+1 + MOVEI WRITE,10 + JSP TT,WRD3 + CONSZ DSK,%HIERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG +];RP +SC,[ MOVEI UNIT,BEG ;MAGIC BLOCK THEN STARTS IT + MOVEI BLOK,NBLKS+NSWBL + MOVEI WRITE,60 + JSP TT,WRD3 + MOVEI BLOK,NBLKS+NSWBL+1 + MOVEI WRITE,60 + JSP TT,WRD3 + DATAO DC0,..... + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR +IFN DBGSW,JRST DDT +IFE DBGSW,JRST 4,. ;FORMERLY JRST MEMSIZ-400 (??) + JRST BEG + +.....: DJMP .+1 + DWRITE + DCOPY ......(-LRIBLK_2&37774) + DHLT + +......: DWRITE+DUNENB+DADR ;FOR READIN + DCOPY BEG(-2000_2&37774) + DREAD+DADR1 + DCOPY BEG(-2000_2&37774) + DHLT +];SC + +IFE DBGSW,[ +....: PROG,,BEG + +KA, LOC 2000 ; MAKE OFFSET CONVENIENT +KL, LOC 2000 +KS, LOC 6000 ; Avoid MTBOOT and KSRIM +PROG: OFFSET CORE+<*2000>-. +]IFN DBGSW,LOC MEMSIZ-2000 + +BEG: +KA,[ CONO 635550 ;ENTER HERE, CLEAR WORLD + JRST .+1 + JFCL 1,[JRST 4,.] ;A PDP6?? + LPMR [0]-2 ;TURN OFF EXEC PAGING +] +KL,[ CONO 327740 ;CLEAR APR + CONSZ PAG,660000 ;PAGING AND CACHE BETTER BE OFF + JRST 4,. +] +KS,[ CONO 127760 ; Enable, and Clear all. + RDEBR B + TRNE B,60000 ; Paging and Tops-20 better be off. + JRST 4,. + SETZM 8SWIT0 ; Clear 8080 Communications area to prevent + MOVE B,[8SWIT0,,8SWIT0+1] ; mysterious IO behavior. + BLT B,8RHBAS-1 + ;; If the machine has just been powered on, there is likely to be + ;; bad parity all over the place. I guess that isn't our problem + ;; as long as we don't touch any of it... +] + MOVSI B,-NDSK ;FOR NUMBER OF DISKS + SETOM PKNUM(B) ;SET DISK TO UNKNOWN + AOBJN B,.-1 + MOVE T,[JRST LOADG1] ;SET BOOTSTRAP TO MIDDLE OF WORLD + MOVEM T,BOOT + MOVE D,['DSKDMP] ;ANNOUNCE SELF + JSP TT,PD + JRST READ ;CRLF AND BEGIN READING COMMANDS + +ERROR: 0 + CLEARM MEMSIZ-1 ;DON'T READ ANY MORE COMMANDS FROM MEMORY + SOS T,ERROR ;PICK UP ERROR CODE FROM THE AC FIELD OF + LDB T,[270400+T,,] ;THE JSR ERROR + MOVE D,ERMESS(T) + JSP TT,PD ;PRINT OUT APPROPRIATE COMMENT + CAIL T,EBUG + JRST READ ;BAD ERROR - NO MORE DISKING +LOADG1: +KA, DATAI TTY,C ;FLUSH RANDOM CHARACTER +KS, SETZM 8CTYIN ; ".RESET" + TRO CMD,10 ;MAKE SURE PSEUDO-CORE IN CORE + JRST LOADG ;BY SIMULATING END OF LOADING, NON-GOING COMMAND + +ERMESS: IRP XX,,[ECMP,EDIR,EEOF,ESNF,EFNF,EPNM,ECKS +EDSK,EDDT,EBUG,EC63,ECRD,ECWR,ECDR,EMFC,EDLZ]YY,,[CMPERR,DIRFUL +EOF,DIRNF,FNF,PKNMTD,CKSERR,DSKFUL,NODDT,?BUG?,SEEKFL +CLOBRD,CLOBWR,DIRCLB,MFDCLB,DSKLUZ] +XX==.-ERMESS + SIXBIT \YY\ +TERMIN + +PD: JSP P,CRLF ;TYPE A CR +PD2: MOVEI C,40 + JSP P,TYO ;AND A SPACE + MOVE B,[440600,,D] +PD1: ILDB C,B ;AND THE SIXBIT CONTENTS OF D + ADDI C,40 + JSP P,TYO + TLNE B,770000 + JRST PD1 + JRST (TT) + +PNO: +C12: IDIVI C,10. ;PRINT CONTENTS OF C AS A TWO-DIGIT + DPB C,[60600,,A] ;DECIMAL NUMBER PRECEDED + MOVEI D,(SIXBIT /#00/+A) ;BY # + MOVE B,[300600,,D] + JRST PD1 + +WRCB: MOVEI UNIT,CBUF ;WRITE OUT CONTENTS OF CBUF + LSH BLKIN,-12 ;ON APPROPRIATE BLOCK + HRRZ BLOK,CBLK + ADDI BLOK,-CORES(BLKIN) + JRST WRM + +LODUMP: MOVEI UNIT,CORE ;DEPENDING ON SIGN BIT OF WRITE, LOAD OR DUMP + HRRZ BLOK,CBLK ;PSEUDO-CORE (766000-775777) +LODMP1: JSP TT,WRDM + ADDI UNIT,2000 + CAIGE UNIT,BEG + AOJA BLOK,LODMP1 + MOVEI BLKIN,CORE + JRST (P) + +FD: HRRZ C,B ;SET UP POINTER IN C TO FETCH OR DEPOSIT + ;CONTENTS OF ADDRESS IN RIGHT HALF OF B +IFN DBGSW, SKIPGE WRITE ;LOAD DDT WHEN IN DEBUG MODE + CAIGE C,HIGH + CAIGE C,40 + JRST (P) + CAIGE C,CORE ;IF ADDR IS IN REAL CORE, RETURN IMMEDIATELY + JRST 1(P) +FDX: CAIL C,(BLKIN) ;ADDR IS IN PSEUDO-CORE--CHECK IF RIGHT + CAILE C,1777(BLKIN) ;BLOCK IS IN CBUF + JRST FD3 ;IT'S NOT THERE--READ IT IN +FD4: SUBI C,-CORE(BLKIN) ;IT'S THERE--SET UP RIGHT POINTER IN C + JRST 1(P) ;AND RETURN +FD3: JUMPLE WRITE,FD3A ;IF DUMP OR VERIFY DON'T BOTHER + ;TO WRITE OUT CURRENT BLOCK +FD3B: JSP TT,WRCB ;IF LOAD, WRITE CURRENT BLOCK FIRST +FD3A: MOVEI UNIT,CBUF + MOVE BLKIN,C + ANDI BLKIN,776000 + LDB BLOK,[121000,,BLKIN] + ADD BLOK,CBLK + MOVEI BLOK,-CORES(BLOK) + JSP TT,RDM ;READ IN CORRECT BLOCK + JRST FD4 ;SET UP POINTER AND RETURN + +GBP: IDIVI C,6 ;TURN USER DIRECTORY CHARACTER ADDR IN C + IMULI A,-60000 ;INTO A BYTE POINTER + HRLI C,440600(A) + ADDI C,DIR+UDDESC + JRST (TT) + +WD: AOBJN BUFP,WD1 ;READ, WRITE, OR VERIFY WORD IN D FROM, INTO, + JSP TT,NXTBLK ;OR AGAINST WORD IN DBUF + JSP TT,WRDB ;TIME TO REFILL OR EMPTY DBUF + MOVSI BUFP,-2000 ;RESET BUFFER POINTER +WD1: JUMPG WRITE,WD2 ;JUMP ON LOAD + JUMPL WRITE,WD3 ;JUMP ON WRITE + CAME D,DBUF(BUFP) ;HERE IF VERIFY + JSR ECMP,ERROR ;VERIFY COMPARE LOST + JRST (P) +WD2: SKIPA D,DBUF(BUFP) ;LOAD +WD3: MOVEM D,DBUF(BUFP) ;DUMP + JRST (P) + +NXTTUT: HRRZ B,CU ;SELECT NEXT UNIT AND READ ITS TUT + AOJ B, + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + CAIN B,@MU + JRST 1(TT) ;SKIP IF NO MORE + SKIPE QDED(B) + JRST NXTTUT ;UNIT NOT ON LINE +RDTUT: MOVEI BLOK,TUTBLK ;READ TUT OF CURRENT UNIT + MOVEI UNIT,TUT + SETOM PKNUM(B) ;ALWAYS READ HEADER FOR TUT +IFG NTUTBL-1,[ ;READ IN MULTI-BLOCK TUT + HRRM TT,RDTUTX ;SAVE RETURN ADDRESS +REPEAT NTUTBL-1,[ + JSP TT,RD + ADDI UNIT,2000 + AOS BLOK +] +RDTUTX: MOVEI TT,. +] + JRST RD + +NXTBW3: 0 + IBP DIRPT ;DO AN IDPB T,DIRPT CHECKING TO SEE IF + LDB DIFF,[1200,,DIRPT] ;RUNNING INTO NAME AREA + CAML DIFF,DIR+UDNAMP + JSR EDIR,ERROR + DPB T,DIRPT + JRST @NXTBW3 + +NXTBW: MOVE BLOK,LBLOCK ;FIND NEXT FREE BLOCK TO WRITE + MOVEI HEAD,1(BLOK) + ILDB T,TUTPT + JUMPN T,NXTBW1 ;JUMP IF VERY NEXT BLOCK NOT FREE + AOSG T,BLKCNT +NXTBW5: SOJA HEAD,NXTBW4 ;GENERATE LOAD ADR IF FIRST TIME (COMPENSATE FOR LBLOCK OFF BY 1) + CAIG T,UDTKMX-1 + JRST NXTBW2 ;NO NEED TO MODIFY DIRECTORY YET + CLEARM BLKCNT ;14 IN A ROW--RESET COUNTER AND +NXTBW6: JSR NXTBW3 ;DPB BYTE INTO DIRECTORY +NXTBW2: MOVE BLOK,HEAD + CAML BLOK,TUT+QLASTB + JSR EDSK,ERROR ;NO MORE DISK LEFT + MOVEI T,1 + DPB T,TUTPT ;MARK BLOCK USED IN TUT + JRST WRDB1 + +NXTBW1: ADDI HEAD,1 ;SEARCH FOR NEXT FREE BLOCK + ILDB T,TUTPT + JUMPN T,NXTBW1 + SUBM HEAD,BLOK + SKIPLE T,BLKCNT ;COME UP WITH DESC BYTE FOR LAST FEW BLOCKS + JSR NXTBW3 + CLEARM BLKCNT + JUMPL T,NXTBW5 ;FIRST TIME + MOVEI T,UDTKMX-1(BLOK) + CAIGE T,UDWPH ;CAN WE SAY SKIP N--TAKE 1? + JRST NXTBW6 ;YES +NXTBW4: MOVEI BLOK,NXLBYT + MOVE T,HEAD + ROT T,-NXLBYT*6 + ADDI T,UDWPH+1 + JSR NXTBW3 + ROT T,6 + SOJG BLOK,.-2 + JRST NXTBW6 + +NXTBLK: JUMPL WRITE,NXTBW ;GET NEXT BLOCK OF FILE--IF DUMP, FIND FREE + MOVE BLOK,LBLOCK ;BLOCK +NXTB6: SOSLE BLKCNT ;HAVE WE RUN OUT OF "TAKE N"? + AOJA BLOK,WRDB1 ;NO--TAKE NEXT BLOCK + ILDB T,DIRPT ;YES--GET NEXT DESC BYTE + CAILE T,UDWPH + JRST NXTB1 ;IT'S A LOAD ADDR + CAIE T,UDWPH + JUMPN T,NXTB2 ;IT'S A TAKE OR SKIP + CAIE CMD,'D ;IT'S 0 OR NULL--IF THIS IS A LOAD, IT'S AN + CAIN CMD,'K ;UNEXPECTED END OF FILE + JRST KILL1 ;IF DUMP OR KILL, O.K. + JSR EEOF,ERROR + +NXTB1: MOVEI BLOK,-UDWPH-1(T) ;LOAD ADR + MOVEI BUFP,NXLBYTS +NXTB1A: MOVEI T,0 + CAIE CMD,'D + CAIN CMD,'K + DPB T,DIRPT ;IF KILLING FILE, ZERO THIS BYTE (OTHERS ZEROED AT KILL) + LSH BLOK,6 + ILDB T,DIRPT + ADD BLOK,T ;GET COMPLETE BLOCK NUMBER + SOJG BUFP,NXTB1A + JRST NXTB3 + +NXTB2: MOVEM T,BLKCNT + CAIG T,UDTKMX + AOJA BLOK,WRDB1 ;TAKE N STARTING WITH NEXT ONE + ADDI BLOK,-UDTKMX+1(T) ;SKIP N- AND TAKE 1 +NXTB3: CLEARM BLKCNT +WRDB1: MOVEM BLOK,LBLOCK + JRST (TT) + ;RP10 IO ROUTINE +RP,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: DPB WRITE,[360600,,DBLK] ;SET OP, UNIT SEL + DPB WRITE,[DUNFLD SEEK] + DPB WRITE,[DUNFLD RECAL] + HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + MOVEM UNIT,@ICWA + SOS @ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + DPB DIFF,[DCYL SEEK] + DATAO DPC,CLATT ;CLEAR ATTENTIONS + LSH DIFF,-8 ;EXTRA CYLINDER BIT FOR RP03 + DPB DIFF,[DCYLXB DBLK] + DPB DIFF,[DCYLXB SEEK] + DATAO DPC,SEEK + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + DATAO DPC,CLATT + TLNN DIFF,(ONCYL) + JRST WRD0 + DATAO DPC,DBLK + CONSO DPC,DONE + JRST .-1 + CONSO DPC,ALLER + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: AOSLE ERRCT + JSR EC63,ERROR + DATAO DPC,RECAL + DATAI DPC,DIFF + TRNN DIFF,ALLATT + JRST .-2 + JRST WRD5 + +DBLK: ICWA +SEEK: DSEEKC +RECAL: DRCALC +CLATT: DEASEC ALLATT +];RP + ;RH11 IO ROUTINE +PH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: TRNE UNIT,1777 ; Better be on a page boundary! + JRST 4,. + LDB DIFF,[111100,,UNIT] ; Point Unibus map at page in question + TRO DIFF,%UQFST+%UQVAL + IOWRQ DIFF,UBAPAG+UBPG_1 + ADDI DIFF,1 + IOWRQ DIFF,UBAPAG+UBPG_1+1 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + JSP HEAD,RHCHEK ; Check for immediate trouble + MOVEI DIFF,%HMRDP ; Init the drive + IOWRQ DIFF,%HRCS1 + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVNI DIFF,4000 + IOWRQ DIFF,%HRWC ; 4000 half words + MOVEI DIFF,UBPG_14 + IOWRQ DIFF,%HRBA ; "Byte" base address + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + IOWRQ DIFF,%HRCYL ; Desire cylinder + MOVE DIFF,HEAD + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + DPB DIFF,[$HATRK HEAD] + IOWRQ HEAD,%HRADR ; Desire track and sector + MOVEI DIFF,%HMRED + TRNE WRITE,10 + MOVEI DIFF,%HMWRT + IOWRQ DIFF,%HRCS1 ; Do it (implied seek) +WRD7: IORDQ DIFF,%HRCS1 + TRNN DIFF,%HXRDY ; Wait for controller to finish + JRST WRD7 + TRNN DIFF,%HXTRE+%HXMCP ; Trouble? + JRST WRDX ; Nope, exit + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVEI DIFF,%HYCLR ; Clear controller + IOWRQ DIFF,%HRCS2 + LDB DIFF,[000300,,WRITE] ; Select drive + IOWRQ DIFF,%HRCS2 + MOVEI DIFF,%HMCLR ; Clear drive + IOWRQ DIFF,%HRCS1 + JSP HEAD,RHCHEK ; Immediate lossage? + MOVEI DIFF,%HMREC ; Recalibrate + IOWRQ DIFF,%HRCS1 + MOVEI HEAD,100000. +WRD0A: SOSGE HEAD + JSR EC63,ERROR + IORDQ DIFF,%HRSTS + TRNE DIFF,%HSPIP ; WAIT FOR DRIVE TO FINISH + JRST WRD0A + ANDI DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY+%HSERR + CAIE DIFF,%HSDPR+%HSMOL+%HSVV+%HSRDY + JSR EDLZ,ERROR + JRST WRD5 + +;;; JSP HEAD,RHCHEK to check for errors. +RHCHEK: IORDQ DIFF,%HRCS1 + TRNE DIFF,%HXTRE+%HXMCP + JSR EDLZ,ERROR + JRST (HEAD) +];PH + ;RH10 IO ROUTINE +RH,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,10 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,10 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: +WRD3: HRLI UNIT,-2000 ;ADDRESS COMES IN IN `UNIT' + CONI DSK,HEAD ;SET WORD COUNT TO ONE BLOCK + TLNE HEAD,(%HID22) ;ACCORDING TO TYPE OF CHANNEL + HRLI UNIT,-2000_4 + MOVEM UNIT,@ICWA + LDB UNIT,[300,,WRITE] ;ISOLATE FROM GARBAGE + SOS @ICWA ;ADJUST FOR DF10 LOSSAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMRDP ;INIT THE DRIVE + JSP HEAD,RHSET + HRRZ DIFF,BLOK + IDIVI DIFF,NBLKSC + EXCH DIFF,HEAD + MOVEM HEAD,DBLK ;SAVE CYLINDER + IMULI DIFF,SECBLK + IDIVI DIFF,NSECS + EXCH DIFF,HEAD + DPB HEAD,[$HATRK DIFF] + TLO DIFF,%HRADR(UNIT) + JSP HEAD,RHSET + MOVE DIFF,DBLK + TLO DIFF,%HRCYL(UNIT) + JSP HEAD,RHSET + MOVSI DIFF,%HRCTL(UNIT) + IORI DIFF,ICWA_6 + TRNE WRITE,10 + TROA DIFF,%HMWRT + TRO DIFF,%HMRED + JSP HEAD,RHSET ;DO IT (USE IMPLIED SEEK) + CONSO DSK,%HIDON + JRST .-1 + CONSO DSK,%HIERR + JRST WRDX + HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD0 ;RECALIBRATE AND TRY AGAIN + TRNE WRITE,10 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: HRRZ UNIT,@ICWA ;RESTORE ADDR + ADDI UNIT,1 ;COMPENSATE FOR IOWD LOSSAGE + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +WRD0: MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMCLR + JSP HEAD,RHSET + MOVSI DIFF,%HRDCL(UNIT) + HRRI DIFF,%HMREC + JSP HEAD,RHSET + MOVEI DIFF,100000. + MOVEM DIFF,DBLK +WRD0A: SOSGE DBLK + JSR EC63,ERROR + MOVSI DIFF,%HRSTS(UNIT) + JSP HEAD,RHGET + TRNE DIFF,%HSPIP + JRST WRD0A + ANDI DIFF,%HSVV+%HSRDY+%HSMOL+%HSERR + CAIE DIFF,%HSVV+%HSRDY+%HSMOL + JSR EDLZ,ERROR + JRST WRD5 + +;RH10 HACKING ROUTINES. CALL BY JSP HEAD,. DIFF HAS REGISTER ADDRESS IN LH, DATA IN RH. +RHSET: TLOA DIFF,%HRLOD +RHGET: TLZ DIFF,%HRLOD + DATAO DSK,DIFF + MOVEI DIFF,20 + SOJG DIFF,. + DATAI DSK,DIFF + TLNE DIFF,%HDERR + JSR EDLZ,ERROR + ANDI DIFF,177777 + JRST (HEAD) + +DBLK: 0 +];RH + ;SC DISK IO ROUTINE +SC,[ +WRDM: SKIPL WRITE ;SEE WHETHER LOAD OR DUMP/VERIFY +RDM: TRZA WRITE,(WRITE) ;READ FROM MASTER UNIT +WRM: HRRI WRITE,60#120 ;WRITE ON MASTER UNIT +MU: IORI WRITE,0 ;MASTER UNIT SELECT STORED HERE + JRST WRD3A + +WRDB: MOVEI UNIT,DBUF ;READ OR WRITE DBUF FROM/ON CURRENT UNIT +WRD: SKIPL WRITE ;READ OR WRITE FROM/ON CURRENT UNIT +RD: TRZA WRITE,(WRITE) ;READ FROM CURRENT UNIT +WR: HRRI WRITE,60#120 ;WRITE ON CURRENT UNIT +CU: IORI WRITE,0 ;CURRENT UNIT SELECT STORED HERE +WRD3A: TRC WRITE,120 +WRD3: DPB WRITE,[330700,,DBLK] ;SET OP, UNIT SEL + DPB UNIT,[DCCA DBLK+1] ; & CORE ADDR + DPB UNIT,[DCCA DBLK1+1] + LDB UNIT,[400,,WRITE] ;ISOLATE FROM GARBAGE + MOVNI DIFF,16. ;INITIALIZE ERROR COUNTER + MOVEM DIFF,ERRCT ;15. LOSSES PERMITTED +WRD5: HRRZ DIFF,BLOK + IDIVI DIFF,NSECS + DPB HEAD,[DSECT DBLK] + IDIVI DIFF,NHEDS + DPB HEAD,[DSURF DBLK] + DPB DIFF,[DCYL DBLK] + CONO DC0,DCCSET\DCDENB ;RESET ALL, THEN SET DCDENB + CAIL DIFF,NCYLS + TDZA DIFF,DIFF + SKIPLE DIFF,PKNUM(UNIT) + JRST WRD4 ;PKID IN + MOVE DIFF,QTRAN(UNIT) ;READ PACK ID + DPB DIFF,[DUNFLD GPKID] + MOVEI DIFF,TUTCYL + SKIPGE QTRAN(UNIT) + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL GPKID] + DATAO DC0,[DJMP GPKID] + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR + JRST WRD0 + CONO DC0,DCCSET\DCDENB ;RESET POSSIBLE "FUTURE" IP OR RLCERR + LDB DIFF,[DPKID RPKID] + MOVEM DIFF,PKNUM(UNIT) +WRD4: DPB DIFF,[DPKID DBLK] + MOVE DIFF,DBLK + DPB DIFF,[3300,,DBLK1] + MOVE DIFF,QTRAN(UNIT) + DPB DIFF,[DUNFLD DBLK] + JUMPGE DIFF,WRD4A + LDB DIFF,[DCYL DBLK] ;2ND HALF UNIT + ADDI DIFF,NCYLS+XCYLS + DPB DIFF,[DCYL DBLK] +WRD4A: DATAO DC0,[DJMP DBLK] + CONSZ DC0,DSSACT + JRST .-1 + CONSO DC0,DSSERR + JRST WRDX ;XFER OK + MOVE DIFF,ERRCT + TRNN DIFF,2 ;DO RECALIBRATE 2 OUT OF 4 RETRIES + JRST WRD2 +WRD0: AOSLE ERRCT ;POSITIONER ERROR--CHECK ERROR COUNT + JSR EC63,ERROR ;TOO MANY--GIVE UP + DATAO DC0,[DSPC+DSRCAL+DSWINF] + CONSO DC0,DSSATT + JRST .-1 + JRST WRD5 ;TRY AGAIN AFTER RESETTING UNIT + +WRD2: HRRZM BLOK,BADBLK + AOSG ERRCT ;HARDWARE ERROR--CHECK COUNTER + JRST WRD5 ;TRY AGAIN + TRNE WRITE,40 ;GIVE UP--DISTINGUISH BETWEEN + JSR ECWR,ERROR ;WRITE ERRORS AND + JSR ECRD,ERROR ;READ ERRORS + +WRDX: DPB BLOK,[XWBLK XWDS] ;PNTR TO PREV BLOCK + LDB UNIT,[DCCA DBLK+1] ;RESTORE ADR + TRZ WRITE,-1 ;FLUSH GARBAGE + JRST (TT) + +DBLK: DREAD+DUNENB + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) +DBLK1: DRC + DCOPY .(-2000_2&37774) + DCOPY XWDS(-4_2&37774) + DHLT + +GPKID: DSPC+DSCRHD+DSWIDX+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +];SC + +;JSP P,TYI RETURNS CHAR IN C. +;JSP P,TYI0 ALSO SKIPS IF NO INPUT AVAILABLE. +TYI: ILDB C,MEMSIZ-1 ;CHECK FOR COMMANDS FROM MEMORY + JUMPN C,(P) ;FOUND ONE--RETURN + CLEARM MEMSIZ-1 +TYI0: ;ENTRY TO SKIP IF NO INPUT AVAILABLE +KA,[ CONSO TTY,40 + JRST TYI1 + DATAI TTY,C +] +KS,[ SKIPN C,8CTYIN + JRST TYI1 + ANDI C,177 + SETZM 8CTYIN +] +KL,[ MOVEI C,3400 ;DDT MODE INPUT + SETZM DTEFLG + MOVEM C,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + MOVE C,DTEF11 + SETZM DTEFLG + JUMPE C,TYI1 +] ANDI C,177 + CAIGE C,175 + CAIN C,33 + JRST (P) ;DON'T ECHO GRITCHES +;DROP INTO TYO + +;JSP P,TYO TYPES OUT CHAR IN C. CLOBBERS A,C. +TYO: ;SKIPE MEMSIZ-1 + ; JRST (P) ;DON'T ECHO COMMANDS FROM MEMORY +KA,[ HRRZ A,C ;COMPUTE PARITY + IMULI A,40201 + AND A,[1111111] + IMUL A,[1111111] + TLNE A,1 + IORI C,200 + CONSZ TTY,20 + JRST .-1 + DATAO TTY,C + ANDCMI C,200 +] +KS,[ MOVE A,C + ANDI A,177 + TRO A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 +] +KL,[ MOVE A,C + ANDI A,177 + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SETZM DTEFLG +] + JUMPGE C,(P) ;CHECK FOR CRLF (AS OPPOSED TO ECHOING A CR) + SKIPA C,C12 ;TYPE AN LF +CRLF: HRROI C,15 + JRST TYO + +TYI1: HRRZ C,-1(P) ;NO INPUT AVAILABLE + CAIE C,TYI0 + JRST TYI ;WAIT FOR IT + JRST 1(P) ;CALL WAS TO TYI0, SKIP RETURN + +LINK: CAIE CMD,'D + CAIN CMD,'K + MOVSI WRITE,-1 ;MAKE THIS INFO MORE CONVENIENT + MOVE D,[440600,,C] + MOVEI T,0 +LINKL: ILDB TT,DIRPT + SKIPGE WRITE + DPB T,DIRPT ;CLOBBER CHARS READ FOR DUMP OR KILL + CAIN TT,'; + JRST LINKN + CAIN TT,': + JRST LINKQ + JUMPE TT,LINKN +LINKQ1: IDPB TT,D + TLNE D,770000 + JRST LINKL +LINKN1: CAMGE D,[600,,B] ;THROUGH WITH FN2? + JRST LINKL + JUMPL WRITE,KILL1 + MOVEM A,FN1 + MOVEM B,FN2 + JRST MLOOK2 + +LINKN: TLNN D,770000 + JRST LINKN1 + IDPB T,D ;FILL OUT WITH SPACES + JRST LINKN + +LINKQ: ILDB TT,DIRPT + JUMPGE WRITE,LINKQ1 + DPB T,DIRPT + JRST LINKQ1 + +READ: MOVEI BLKIN,CORE + JSP P,CRLF + MOVEI CMD,0 ;INITIALIZE COMMAND +READ1A: MOVEI WRITE,0 ;INITIALIZE NUMBER + MOVSI B,(SIXBIT \@\) ;INITIALIZE 1ST FILE NAME +READ1: MOVEM B,FN1 +READ3A: MOVSI B,(SIXBIT \@\) ;INITIALIZE CURRENT FILE NAME + MOVE D,[440600,,B] +READ2: JSP P,TYI + CAIN C,177 + JRST READ ;IF RUBOUT START OVER + CAIGE C,175 + CAIN C,33 + JRST ALTMOD ;JUMP IF 33, 175, 176 + ASH WRITE,3 ;DOES NOT CHANGE SIGN OF WRITE + CAIL C,"0 + CAILE C,"7 + TLOA WRITE,400000 ;NON-NUMERIC CHAR--MAKE WRITE NEGATIVE + ADDI WRITE,-"0(C) ;NUMERIC CHAR--ACCUMULATE NUMBER + CAIN C,"; + JRST READ3 ;SET SYSTEM NAME + CAIN C,40 + JRST READ1 ;SET FIRST FILE NAME + CAIN C,^Q + JSP P,TYI ;QUOTED CHARACTER + CAIGE C,140 ;CHECK FOR LOWER CASE + SUBI C,40 + JUMPL C,DOIT ;IF LESS THAN 40 (EXC. ^Q) END OF COMMAND + TLNE D,770000 ;SKIP IF ALREADY SIX CHARS + IDPB C,D + JRST READ2 + +READ3: MOVEM B,SYSN + CAIE CMD,'U + JRST READ3A + JRST DOIT ;IF COMMAND IS U GO LIST DIRECTORY + +ONOFF: CAIGE WRITE,NDSK + DPB CMD,[100,,QDED(WRITE)] ;LOW BIT OF CMD DETERMINES ON/OFF LINE STATUS + JRST READ ; (K=13, L=14) + +ALT1: LDB CMD,D ;PICK UP COMMAND CHAR + CAIE CMD,'K + TRNN CMD,2 + JRST READ1A ;GET FILE NAME + JRST DOIT ;DON'T WANT FILE NAME--GO TO WORK + +ALTMOD: MOVEI C,"$ + JSP P,TYO ;ECHO DOLLAR SIGN + JUMPLE WRITE,ALT2 ;JUMP IF NOT LAST TYPED + JUMPN CMD,ONOFF ;JUMP IF + HRRM WRITE,SADR ;SET STARTING ADDR + JRST READ + +ALT2: TLC D,360000 + TLCN D,360000 ;SKIP IF SINGLE CHARACTER BEFORE + JUMPE CMD,ALT1 ;JUMP IF NO COMMAND ALREADY TYPED +DOIT: MOVEM B,FN2 ;STORE SECOND FILE NAME + HRRZ B,MU + HRRM B,CU ;MAKE MASTER UNIT CURRENT UNIT + MOVNI WRITE,1 + JSP P,LODUMP ;DUMP OUT PSEUDO-CORE + CAIN CMD,'G + JRST LOADG0 ;GO + JSP TT,RDTUT + MOVE C,SYSN +MLOOK2: MOVSI WRITE,1 ;MAKE WRITE INDICATE LOAD + MOVEI BLOK,MFDBLK + MOVEI UNIT,DIR + JSP TT,RD ;READ MASTER DIRECTORY TO FIND WHERE USER DIRECTORY IS + MOVE T,DIR+MDCHK + CAME T,[SIXBIT/M.F.D./] + JSR EMFC,ERROR + MOVE T,DIR+MDNUDS + CAIE T,NUDSL + JSR EMFC,ERROR + CAIN CMD,'S + JRST LISTS ;LIST DISK ID'S AND SYSTEM NAMES + MOVE T,DIR+MDNAMP +MLOOK: CAMN C,DIR+MNUNAM(T) ;LOOK UP SYSTEM NAME + JRST MLOOK1 + ADDI T,LMNBLK + CAIGE T,2000 + JRST MLOOK + JSR ESNF,ERROR ;NOT FOUND + +MLOOK1: MOVEI BLOK,2*NUDSL-2000(T) ;CONVERT USER SLOT TO BLOCK NUMBER + LSH BLOK,-1 + HRRM BLOK,UDBLK ;REMEMBER FOR KILL OR DUMP + MOVEI UNIT,DIR + JSP TT,RDM ;READ USER DIRECTORY +ULOOK: CAME C,DIR+UDNAME + JSR ECDR,ERROR ;WRONG ONE?? + CAIE CMD,'F + CAIN CMD,'U + JRST LISTFC ;LIST USER DIRECTORY + MOVSI TT,UNIGFL + MOVE T,DIR+UDNAMP + MOVE A,FN1 + MOVE B,FN2 +ULOOK1: CAMN A,DIR+UNFN1(T) ;LOOK UP FILE NAME + CAME B,DIR+UNFN2(T) + JRST ULOOK2 + TDNN TT,DIR+UNRNDM(T) ;IS THIS FILE FOR REAL? + JRST ULOOK3 +ULOOK2: ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK1 + CAIE CMD,'D ;IF NOT FOUND BETTER BE DUMP + JSR EFNF,ERROR + MOVE T,DIR+UDNAMP +ULOOK4: SKIPN DIR+UNFN1(T) ;FIND FREE SLOT FOR NEW FILE + JRST DUMP + ADDI T,LUNBLK + CAIGE T,2000 + JRST ULOOK4 + MOVNI T,LUNBLK ;NO FREE SLOTS--TRY TO EXTEND NAME AREA DOWN + ADDM T,DIR+UDNAMP + MOVE T,DIR+UDESCP + IDIVI T,6 + ADDI T,UDDESC + CAMGE T,DIR+UDNAMP ;DID WE RUN INTO DESCRIPTOR AREA? + JRST DUMP0 + JSR EDIR,ERROR ;YES + +ULOOK3: HRRM T,DMP4 ;IF FILE FOUND, SAVE SLOT NUMBER FOR DUMP + LDB C,[UNDSCP DIR+UNRNDM(T)] + JSP TT,GBP + MOVEM C,DIRPT ;SET UP DESCRIPTOR AREA BYTE POINTER + MOVSI TT,UNLINK + TDNE TT,DIR+UNRNDM(T) + JRST LINK ;FILE IS A LINK + LDB A,[UNPKN DIR+UNRNDM(T)] +ULOOK5: CAMN A,TUT+QPKNUM ;SEE IF IT'S MOUNTED + JRST LOAD + JSP TT,NXTTUT + JRST ULOOK5 + JSR EPNM,ERROR + +LOAD: CAIE CMD,'D ;GET HERE IF FILE FOUND + CAIN CMD,'K ;IF DUMP OR KILL, DELETE IT + JRST KILL +ZERO: MOVEI TT,CORE-1 + TRNN CMD,20 ;SKIP IF T$ SYMBOL LOADING COMMAND + JRST ZERO1 + MOVEI B,DDT-1 ;ASSUME ALWAYS USING MOBY DDT + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAME B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSR EDDT,ERROR + SKIPE D,-2(C) ;FLUSH ALL BUT INITIAL SYMBOLS + MOVEM D,-1(C) + MOVE D,-1(C) + MOVEI TT,CORE-1 + CAILE TT,-1(D) + MOVEI TT,-1(D) ;DON'T ZERO SYMBOL TABLE NOR DDT +ZERO1: TRNE CMD,1 + JRST LOAD1 ;NON-ZEROING COMMAND + SETZM 40 ;BEGIN CLEARING CORE + MOVE T,[40,,41] ;SET UP BLT POINTER +;CODE TO SKIP OVER NXM +ZERO2: CAIG TT,10*2000-1(T) ;MORE THAN 8K LEFT TO ZERO? + JRST ZERO4 ;NO, ZERO REMAINING WORDS AND PROCEED + MOVE D,T ;AVOID KA/KL INCOMPAT BY COPYING BLT PNTR + BLT D,10*2000-1(T) ;ZERO NEXT 8K +ZERO3: ADDI T,10*2000 ;MOVE DEST OF BLT PNTR UP 8K + ANDCMI T,1777 ;ROUND DOWN TO 1K BOUNDARY +KA, CONO 10000 ;CLEAR NXM + MOVES (T) ;SET NXM IF HOLE +KA, CONSZ 10000 ;NXM GENERATED? +KA, JRST ZERO3 ;YES, GO TO NEXT 8K + JRST ZERO2 ;NO, CLEAR THIS 8K + +ZERO4: BLT T,(TT) ;AND CLEAR TO TOP BOUNDARY + TRNE CMD,20 + JRST LOAD1 ;IF SYMBOL-LOADING COMMAND, STOP THERE + CLEARM CBUF + MOVE T,[CBUF,,CBUF+1] + BLT T,CBUF+1777 + MOVEI UNIT,CBUF + MOVE BLOK,CBLK ;-NSWBL IN LH + JSP TT,WRM ;CLEAR PSEUDO-CORE + AOBJN BLOK,.-1 +LOAD1: SETZB BUFP,BLKCNT ;SET UP BUFP SO FIRST CALL TO WD WILL READ +LOAD2: JSP P,WD ;FIRST BLOCK OF FILE + CAME D,[JRST 1] ;LOOK FOR END OF SBLK LOADER + JRST LOAD2 + CAIN CMD,'I ;IF VERIFY, START SIMULATING DUMP + JRST DUMP.5 +LOAD3: JSP P,WD ;READ BLOCK HEADER + JUMPGE D,LOADS ;IT'S A JUMP BLOCK + MOVE A,D + MOVE B,D + JSR LOADB ;LOAD LOGICAL BLOCK INTO CORE + JRST LOAD3 + +LOADB: 0 +LOAD4: JSP P,WD ;LOAD A LOGICAL BLOCK--AOBJN POINTER IN B, + ROT A,1 ;BLOCK HEADER IN A (FOR CHECKSUM) + ADD A,D ;ADD NEW WORD INTO CHECKSUM + JSP P,FD ;AND PREPARE TO SMASH IT AWAY + JRST .+2 ;LOCATION CAN'T BE LOADED + MOVEM D,(C) ;SMASH WORD AWAY + AOBJN B,LOAD4 + JSP P,WD + CAMN A,D ;CHECK THE CHECKSUM + JRST @LOADB + JSR ECKS,ERROR ;BAD CHECKSUM + +LOADS: CAIN CMD,'M + JRST LOADG0 ;DON'T LOAD SYMBOLS NOR SADR + MOVEM D,NXTBW3 ;SAVE S.A. + MOVEI B,DDT-1 ;ASSUME IS ALWAYS MOBY DDT. + JSP P,FD ;GET DDT'S SYMBOL TABLE POINTER + JSR EDDT,ERROR ;CAN'T GET IT?? + SKIPN (C) + JRST LOADJ ;AIN'T GOT NO DDT, IGNORE SYMBOLS + HRROS B,(C) ;TELL DDT ITS SYMBOL TABLE WAS BUGGERED + CAMN B,[-1,,DDT-2] ;VERIFY THAT IT'S REALLY A MOBY DDT LIKE WE THOUGHT + JSP P,FD ;FETCH SYMBOL TABLE POINTER + JSR EDDT,ERROR + MOVE D,(C) + MOVEM D,DDTM2 +LOADS1: MOVE B,DDTM2 ;GET LOWEST SYMBOL LOC SO FAR + JSP P,WD ;GET SYMBOL BLOCK HEADER + JUMPGE D,LOADS2 ;JUMP IF END OF SYMBOLS + TRNE D,-1 ;SKIP IF REALLY SYMBOLS AND NOT SOME OTHER BRAIN-DAMAGED CRUFT + JRST LOADBD + MOVSS D + HRLI D,-1(D) + ADD B,D ;EFFECTIVELY SUBTRACTS LENGTH OF BLOCK FROM BOTH HALVES + MOVEM B,DDTM2 ;OF SYMBOL TABLE POINTER + HRL B,D ;SET UP AOBJN POINTER IN B + HRLZ A,D ;AND RECREATE HEADER IN A + JSR LOADB ;LOAD THE SYMBOLS + JRST LOADS1 + +LOADBD: HLRO B,D ;-# WORDS TO SKIP (NOT COUNTING CHECKSUM) + JSP P,WD + AOJLE B,.-1 + JRST LOADS1 ;TRY NEXT SYMBOL BLOCK + +LOADS2: MOVE D,DDTM2 ;GET UPDATED DDT SYMBOL PNTR +LOADS4: MOVEI B,DDT-2 ;WE KNOW WHERE IT ALWAYS GOES + JSP P,FD ;PUT BACK SYMBOL TABLE POINTER + JSR EBUG,ERROR ;CAN'T PUT IT BACK?? + MOVEM D,(C) + MOVEI B,DDT-4 ;GIVE STARTING ADDRESS TO DDT + JSP P,FD + JSR EBUG,ERROR + MOVE D,NXTBW3 + MOVEM D,(C) + MOVEI D,DDT ;AND SET DSKDMP START ADDRESS TO DDT +LOADJ: HRRM D,SADR ;SET STARTING ADDRESS FROM JUMP BLOCK +LOADG0: MOVE T,BOOTNS ;APPROP DISK WAIT FOR NON BUSY INSTR + MOVEM T,BOOT +LOADG: JSP TT,WRCB ;MAKE SURE ALL LOADED CRUFT IN PSEUDO-CORE IS OUT + MOVEI WRITE,0 + JSP P,LODUMP ;AND LOAD IT ALL IN + TRNE CMD,10 + JRST READ ;NON-GOING COMMAND +GO: +PH,[ MOVSI B,-LSWPADR +GO1: IORD DIFF,SWPCS1 + TRNN DIFF,%HXRDY ; Wait for controller + JRST GO1 + HRRZ DIFF,SWPVAL(B) + IOWR DIFF,SWPADR(B) + AOBJN B,GO1 +];PH +RH,[ MOVE B,ERRWD + CONI DSK,HEAD + TLNE HEAD,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +GO1: CONSZ DSK,%HIBSY + JRST .-1 + MOVE DIFF,SWPOU1(B) + JSP HEAD,RHSET + AOBJN B,GO1 +];RH +RP,[ MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPOU1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPOU2 +];RP +SC, DATAO DC0,[DJMP SWPOUT] + JRST WAIT + +LISTS: JSP P,CRLF +LISTS2: JSP P,TYI0 + JRST LOADG1 ;SHUT UP IF KEY HIT + MOVE C,TUT+QPKNUM ;TYPE PACK NUMBER + JSP TT,PNO + MOVE D,TUT+QPAKID ;AND I.D. + JSP TT,PD2 + JSP TT,NXTTUT ;SAME FOR ALL DIRECTORIES + JRST LISTS2 + MOVE T,DIR+MDNAMP +LISTS1: CAIGE T,2000 + JSP P,TYI0 ;STOP TYPING IF TTI FLAG ON + JRST LOADG1 + SKIPE D,DIR+MNUNAM(T) + JSP TT,PD ;TYPE OUT USER NAME + ADDI T,LMNBLK + JRST LISTS1 + +LISTFC: MOVE T,DIR+UDNAMP +LISTF1: +KA, CONSO TTY,40 ;STOP TYPING IF TTI FLAG ON +KS, SKIPN 8CTYIN ; Stop typing if character waiting + CAIL T,2000 + JRST LOADG1 + SKIPN DIR+UNFN1(T) ;SKIP IF FILE IN THIS SLOT + JRST LISTF2 + JSP P,CRLF + LDB C,[UNPKN DIR+UNRNDM(T)] + JSP TT,PNO ;TYPE PACK NUMBER + MOVE D,DIR+UNFN1(T) + JSP TT,PD2 ;TYPE FIRST FILE NAME + MOVE D,DIR+UNFN2(T) + JSP TT,PD2 ;AND SECOND FILE NAME +LISTF2: ADDI T,LUNBLK + JRST LISTF1 + +KILL: JSP TT,NXTB6 ;GET HERE ON KILL OR DUMP OF EXISTING FILE + MOVEI T,0 ;ZERO BYTES IN USER DIRECTORY DESCIPTOR AREA + DPB T,DIRPT ;NXTB6 JUMPS TO KILL1 AT END OF FILE + MOVE C,BLOK + JSP TT,GTP + ILDB T,C + CAIGE T,TUTLK-1 ;SOS USAGE OF THIS BLOCK + SOJL T,[JSR ECDR,ERROR] + DPB T,C + JRST KILL + +KILL1: HRRZ T,DMP4 ;CLEAR OUT USER DIRECTORY SLOT + CLEARM DIR+UNFN1(T) + CLEARM DIR+UNFN2(T) + CLEARM DIR+UNRNDM(T) + MOVSI WRITE,-1 + CAIN CMD,'K + JRST KILDMP ;IF KILL DON'T DUMP + JRST DMP4 ;MUST DUMP ON SAME UNIT + +DUMP0: MOVE T,DIR+UDNAMP ;GET HERE IF SLOT CREATED AT BOTTOM OF NAME AREA +DUMP: HRRM T,DMP4 ;GET HERE IF EMPTY SLOT FOUND IN NAME AREA +DMP0: MOVEI D,0 ;GET HERE IF USING SLOT OF OLD FILE +DMP1: ;MOVE C,TUT+QSWAPA + MOVEI C,0 ;NOTE START AT 0 NOT QSWAPA + MOVE B,C + SUB B,TUT+QLASTB + HRLZ B,B ;LH(B) COUNTS BLOCKS, RH(B) COUNTS FREE BLOCKS + JSP TT,GTP +DMP2: ILDB T,C + SKIPE T +KA, SUBI B,1 ;THIS RELIES ON CARRY PROPAGATING FROM RH TO LH IN AOBJN +KL, HRRI B,-1(B) ;ON KI10, KL10 CHANGE SUBI B,1 TO HRRI B,-1(B) +KS, HRRI B,-1(B) ;KS too... + AOBJN B,DMP2 + CAIG B,(D) ;RH OF D IS HIGHEST SO FAR, LH SAYS WHICH UNIT + JRST DMP5 ;NOT BETTER THAN RECORD + MOVE D,B ;NEW RECORD--RECORD IT + HRL D,CU +DMP5: JSP TT,NXTTUT ;TRY NEXT + JRST DMP1 + ;FALLS THROUGH AT END +DMP3: HLRM D,CU ;SET CURRENT UNIT TO ONE WITH MOST FREE BLOCKS + JSP TT,RDTUT ;GET ITS TUT +DMP4: MOVEI T,. + MOVE A,FN1 + MOVE B,FN2 + MOVEM A,DIR+UNFN1(T) ;PUT CRUFT INTO SLOT + MOVEM B,DIR+UNFN2(T) + SETOM DIR+UNDATE(T) ; Unknown creation date + HRROI C,777000 ; Unknown reference date + MOVEM C,DIR+UNREF(T) ; Unknown author, 36. bit bytes +SC,[ MOVEM A,XWDS+XWFN1 + MOVEM B,XWDS+XWFN2 + MOVE C,SYSN + MOVEM C,XWDS+XWSYSN +] MOVE C,DIR+UDESCP ;PUT DESCRIPTOR CHARACTER ADDRESS + MOVE B,TUT+QPKNUM ;AND PACK NUMBER + DPB B,[UNPKN C] + MOVEM C,DIR+UNRNDM(T) ;INTO USER DIRECTORY SLOT + ;MOVE C,TUT+QSWAPA ;COMMENTED OUT INSN DUMPS INTO FILE AREA + MOVEI C,0 ;DUMP INTO SWAPPING AREA TO AVOID Y FILES + MOVEM C,LBLOCK ;A DAEMON WILL COPY INTO FILE AREA AFTER SALVAGE + JSP TT,GTP + MOVEM C,TUTPT ;INITIALIZE TUT POINTER + MOVE C,DIR+UDESCP + JSP TT,GBP + MOVEM C,DIRPT ;INITIALIZE DESCRIPTOR AREA POINTER + SETOB WRITE,BLKCNT ;FORCE NXTBW TO LOAD ADR +KA, HRLOI BUFP,-2001-1 ;SET UP BUFP SO FIRST WORD GOES IN DBUF+0 +KL, HRLOI BUFP,-2001 +KS, HRLOI BUFP,-2001 + MOVE D,[JRST 1] + JSP P,WD ;END OF SBLK LOADER +;DROPS THROUGH + +;DROPS IN +DUMP.5: MOVSI WRITE,-'I(CMD) ;GET HERE IF VERIFY--SET WRITE NEGATIVE IF + MOVEI B,40 ;DUMP AND ZERO IF VERIFY--FIRST ADDR DUMPED IS 40 + HRRM B,DUMP4 + HLLOS DUMP6 + SETZM DUMP9S + SETZM DUMP9J + SETZM DUMP9K + MOVEI B,DDT-3 ;SET UP TO NOT DUMP SYMBOLS AS PART OF CORE IMAGE + JSP P,FD + JSR EBUG,ERROR + SKIPN A,(C) ;GET PNTR TO BUILT IN SYMBOLS + JRST DUMP4 ;NO DDT, DON'T HACK THIS + HRRM A,DUMP7 ;THIS IS WHERE WE START DUMPING AGAIN + MOVEM A,DUMP9K ;THIS WILL BE INITIAL SYMBOL TABLE PNTR WHEN DDT LOADED + MOVNI A,(A) + ADD A,1(C) ;GET MINUS SIZE OF NON-BUILTIN SYMBOL TABLE IN RH(A) + HRL A,1(C) ;GET PNTR TO SYMBOL TABLE + HLRM A,DUMP6 ;THIS IS WHERE WE STOP DUMPING + MOVSM A,DUMP9S ;SAVE AOBJN PNTR TO NON-BUILTIN SYMBOLS + MOVE A,-1(C) ;PICK UP START ADDRESS + MOVEM A,DUMP9J ;SAVE + MOVE B,-2(C) ;DUMP LOW CORE (ACS) OUT OF PLACE SAVED IN DDT + HLLZ A,B ;HERE B HAS ADDRESS DUMPING FROM + JRST DUMP3B ;AND A AND D HAVE VIRTUAL ADDRESS + +DUMP1: ;SKIP OVER NXM ON DUMPING +KA,[ CONSO 10000 ;NXM SET? + JRST DUMP1A ;NO, CONTINUE IN SEQUENCE + ADDI B,10*2000-1 ;SKIP 8K + TRZ B,1777 ;ROUND DOWN TO 8K BOUDARY + CONO 10000 ;CLEAR NXM +DUMP1A: +];KA +DUMP6: CAIGE B,. ;SKIP IF REACHED SYMBOL TABLE + JRST DUMP8 +DUMP7: MOVEI B,. ;SKIP OVER SYMBOLS, DUMP DDT + HLLOS DUMP6 ;DEFUSE TEST +DUMP8: JSP P,FD + JRST DUMPJ ;TIME TO WRITE JUMP BLOCK AND SYMBOL TABLE + SKIPN (C) ;LOOK FOR NON-ZEROES + AOJA B,DUMP1 + MOVE A,B ;SAVE START OF BLOCK +DUMP2: TLZ A,-1 ;LOOK FOR TWO CONSECUTIVE ZEROES +DUMP2A: CAIL B,200(A) ;BUT DON'T DUMP MORE THAN 200 WORDS AT A TIME + JRST DUMP3 + XCT DUMP6 + JSP P,FD + JRST DUMP3 ;END OF CORE, WRITE OUT LAST BLOCK + SKIPE (C) + AOJA B,DUMP2 ;NONZERO + TLON A,-1 ;ZERO, WAS PREV LOC ZERO ALSO? + AOJA B,DUMP2A ;NO, CHECK FOLLOWING LOC + SOJA B,DUMP3 ;YES, DUMP THE NON-ZERO THAT PRECEDES IT + +DUMP3: HRRM B,DUMP4 ;SAVE ADDRESS TO CONTINUE SEARCH + SUBM A,B ;RH(B) GETS MINUS THE LENGTH OF THE BLOCK + HRL A,B ;SET UP HEADER IN A + MOVE B,A ;AND B +DUMP3B: MOVE D,A ;AND D + JSP P,WD ;WRITE HEADER +DUMP3A: JSP P,FD + JSR EBUG,ERROR ;CAN'T FETCH WORD WE FETCHED BEFORE?? + MOVE D,(C) + ROT A,1 + ADD A,D ;COMPUTE CHECKSUM + JSP P,WD ;WRITE DATA WORD + AOBJN B,DUMP3A + MOVE D,A + JSP P,WD ;WRITE OUT CHECKSUM +DUMP4: MOVEI B,. ;AND CONTINUE SEARCHING + JUMPN B,DUMP1 ;IF MRC EVER SEES THIS --SELFMODIFYING CODE-- .... + JRST DUMP9 ;FINISHED DUMPING SYMBOLS + +DUMPJ: SKIPN DUMP9K + JRST DMP9J1 + HRROI D,DDT-2 ;BUGGER THE SYMBOL TABLE + MOVE A,D + JSP P,WD + MOVE D,DUMP9K + ROT A,1 + JSP P,WD + ADD D,A + JSP P,WD +DMP9J1: SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;WRITE OUT JUMP BLOCK + SKIPN B,DUMP9S ;WRITE SYMBOLS + JRST DUMP9 ;NO SYMBOLS + HLLZ A,B + HLLZS DUMP4 ;DUMP SYMBOL BLOCK, RETURN TO DUMP9 + JRST DUMP3B + +DUMP9: JUMPE WRITE,LOADG1 ;IF VERIFY, THAT'S ALL + SKIPN D,DUMP9J + MOVE D,SADR + JSP P,WD ;SECOND JUMP BLOCK + HRRZ T,DMP4 ; GET POINTER TO NAME AREA + AOS BUFP + DPB BUFP,[UNWRDC+DIR+UNRNDM(T)] + JSP TT,NXTBLK + JSP TT,WRDB ;WRITE OUT LAST BLOCK + SKIPE T,BLKCNT + JSR NXTBW3 ;STORE LAST DESCRIPTOR BYTE + MOVEI T,0 + JSR NXTBW3 ;AND INDICATE END OF FILE + LDB T,[360600,,DIRPT] + IDIVI T,6 + HRRZ TT,DIRPT + IMULI TT,6 + SUBI TT,6*-5-1(T) + HRRZM TT,DIR+UDESCP ;INDICATE NEW END OF DESCRIPTOR AREA +KILDMP: MOVEI UNIT,TUT + MOVEI BLOK,TUTBLK + JSP TT,WRD ;WRITE OUT TUT ON THIS UNIT +REPEAT NTUTBL-1,[ + ADDI UNIT,2000 + ADDI BLOK,1 + JSP TT,WRD +] + HRRZ B,CU + HRRM B,KD2 ;WRITE OUT USER DIRECTORY ON ALL UNITS +KD1: ADDI B,1 + CAIN B,NDSK + MOVEI B,0 + HRRM B,CU + SKIPE QDED(B) + JRST KD2 + MOVEI UNIT,DIR +UDBLK: MOVEI BLOK,. + MOVE TT,DIR+UDNAME + CAME TT,SYSN + JSR EBUG,ERROR + JSP TT,WR +KD2: CAIN B,. + JRST LOADG1 + JRST KD1 + +GTP: SKIPGE TUT+QPKNUM + JSR EBUG,ERROR ;MUST BE OLD-STYLE TUT? + SUB C,TUT+QFRSTB + JUMPL C,[JSR EBUG,ERROR] + IDIVI C,TUTEPW + IMULI A,-10000*TUTBYT + HRLI C,440000+TUTBYT_6(A) + ADDI C,TUT+LTIBLK + JRST (TT) + +SC,[ ;LOGICAL TO PHYSICAL DISK MAPPING +QTRAN: 0 ;INDEX BY LOG DSK # + 1 ;4.9 => USE HIGH HALF OF DRIVE, RH = PHYS DRIVE # + 2 ;(NO LONGER DOES ANYTHING, NOW THAT MEMOWRECKS ARE GONE, + 3 ; BUT KEEP AROUND JUST IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +IFL .-QTRAN-NDSK,.ERR QTRAN LOSES!! +];SC + +ERRCT: 0 ;ERROR COUNTER +DDTM2: 0 ;DDT SYMBOL TABLE POINTER +DUMP9J: 0 ;START INSTRUCTION (AT DUMP9) +DUMP9S: 0 ;SYMBOL TABLE POINTER (AT DUMP9) +DUMP9K: 0 ;INITIAL SYMBOL TABLE PNTR (AT DUMP9) +LBLOCK: 0 ;LAST BLOCK WRITTEN OR READ +BLKCNT: 0 ;NUMBER OF BLOCKS READ OR WRITTEN CONSECUTIVELY +DIRPT: 0 ;DESCRIPTOR AREA BYTE POINTER +TUTPT: 0 ;TUT BYTE POINTER +FN1: 0 ;FILE NAME 1 +FN2: 0 ;FILE NAME 2 +PKNUM: REPEAT NDSK,-1 ;PACK NUMBER INDEXED BY DRIVE NUMBER +QDED: BLOCK NDSK ;-1 IF DRIVE NOT TO BE USED +XWDS: BLOCK 4 +RPKID: 0 +BOOTNS: RP, CONSZ DPC,BUSY + SC, CONSZ DC0,DSSACT + RH, CONSZ DSK,%HIBSY + PH, IORD B,SWPCS1 ; UGH! + + CONSTANTS + +IFL BEG+1677-., .ERR BLOAT +INFORM SPACE LEFT,\BEG+1677-. +BLOCK BEG+1677-. + +BADBLK: 0 ;BLOCK WITH HDWE ERROR +INFORM BADBLK,\.-1-BEG+ + +];END IFE BOOTSW +IFN BOOTSW,[ +BEG=MEMSIZ-2000 +LOC MEMSIZ-100 +] + +CBOOT: CLEARM MEMSIZ-1 ;BOOTSTRAP +RP,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DPC,BUSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DPC,BUSY + JRST .-1 + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 + DATAO DPC,CLATT1 + DATAO DPC,SUNIT0 + DATAI DPC,B +BOOT0: TRNN B,RP03BT + JRST BOOT1 + MOVEI B,MBLKS ;UNIT 0 IS AN RP03, ADJUST WORLD + HRRM B,CBLK + MOVE B,RP3ADJ + MOVSI A,-NSWBL + XORM B,SWPSK(A) + AOBJN A,.-1 +BOOT1: HLLZS BOOT0 ;PREVENT TRNN FROM SKIPPING AGAIN + MOVE B,ERRWD + MOVEM B,@ICWA + DATAO DPC,SWPSK + JSP P,SKWAIT + DATAO DPC,SWPIN1 + CONSO DPC,DONE + JRST .-1 + DATAO DPC,SWPIN2 + CONSO DPC,DONE + JRST .-1 + JRST BEG + +ERRWD: -1700,,BEG-1 +CLATT1: DEASEC ALLATT +SWPSK: DSEEKC+200._22. +SWPIN1: DWRITC+200._22.+3_17.+2._12.+ICWA ;NBLKS 4 +SWPIN2: DREADC+200._22.+4_17.+8._12.+ICWA +SWPOU1: DWRITC+200._22.+4_17.+8._12.+ICWA +SWPOU2: DREADC+200._22.+3_17.+2_12.+ICWA +IFN NSWBL-5, .ERR THE PRECEDING 4 CONSTANTS ARE WRONG! +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +RP3ADJ: <&377>_22.+<.BM DCYLXB> +SUNIT0: DNOOPC + +SKWAIT: DATAI DPC,A ;AWAIT SEEK DONE UNIT 0 + TRNN A,ALLATT + JRST SKWAIT + DATAO DPC,CLATT1 + MOVEI A,30. + SOJG A,. + DATAI DPC,A + TLNN A,(ONCYL) + JRST SKWAIT + JRST (P) + +WAIT: CONSO DPC,DONE + JRST .-1 +];RP + +PH,[ ;; Initially we could not use IORDQ or IOWRQ because they were + ;; macros that used a literal. There is nothing to stop us now, + ;; except the fact that this code works fine and is as small as you + ;; could possibly want. + +BOOT: +IFE BOOTSW, JRST BEG ; or IORD B,SWPCS1 or JRST LOADG1 +IFN BOOTSW, IORD B,SWPCS1 + TRNN B,%HXRDY + JRST BOOT +KS, WREBR 0 ; No paging or caching + MOVEI A,0 + IOWR A,SWPCS2 ; Select drive +BOOT0: IORD A,SWPCS1 + TRNN A,%HXDVA + JRST BOOT0 ; Await drive available + MOVSI B,-LSWPADR +BOOT1: HLRZ A,SWPVAL(B) + IOWR A,SWPADR(B) +BOOT2: IORD A,SWPCS1 + TRNN A,%HXRDY ; Wait for controller + JRST BOOT2 + TRNE A,%HXTRE+%HXMCP ; Lossage? + JRST 4,. ; Foo! + AOBJN B,BOOT1 + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +SWPADR: UBAQ,,UBAPAG+UBPG_1 ; Set up Unibus map + UBAQ,,UBAPAG+UBPG_1+1 + UBAQ,,%HRCS2 ; Clear controller +SWPCS2: UBAQ,,%HRCS2 ; Select drive +SWPCS1: UBAQ,,%HRCS1 ; Initialize + UBAQ,,%HRCYL ; Desire cylinder + UBAQ,,%HRWC ; Set (half) word count + UBAQ,,%HRBA ; Set Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Write + UBAQ,,%HRWC ; Reset (half) word count + UBAQ,,%HRBA ; Reset Unibus address + UBAQ,,%HRADR ; Desire track and sector + UBAQ,,%HRCS1 ; Read +LSWPADR==:.-SWPADR + +IFN BEG&1777, .ERR BEG does not lie on a page boundary? + +;;; LH FOR SWAP IN, RH FOR SWAP OUT +SWPVAL: %UQVAL+%UQFST+BEG_-9,,%UQVAL+%UQFST+BEG_-9 ; Set up Unibus map + %UQVAL+%UQFST+BEG_-9+1,,%UQVAL+%UQFST+BEG_-9+1 + %HYCLR,,%HYCLR ; Clear controller + 0,,0 ; Select drive + %HMRDP,,%HMRDP ; Initialize + NCYLS,,NCYLS ; Desire cylinder + -1700*2,,-1700*2 ; Set (half) word count + UBPG_14,,UBPG_14 ; Set Unibus address + ZZ1,,ZZ2 ; Desire track and sector + %HMWRT,,%HMWRT ; Write + -1700*2,,-1700*2 ; Reset (half) word count + UBPG_14,,UBPG_14 ; Reset Unibus address + ZZ2,,ZZ1 ; Desire track and sector + %HMRED,,%HMRED ; Read +IFN .-SWPVAL-LSWPADR, .ERR SWPVAL wrong length. + +CBLK: -NSWBL,,NBLKS + +WAIT: IORD B,SWPCS1 + TRNN B,%HXRDY + JRST WAIT +];PH + +RH,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DSK,%HIBSY OR JRST LOADG1 +IFN BOOTSW, CONSZ DSK,%HIBSY + JRST .-1 +KL, CONSZ PAG,660000 ;PAGING AND CACHE MUST BE DISABLED +KL, JRST 4,. + MOVEI B,ICWA+2 ;SET UP CHANNEL PROG + MOVEM B,ICWA + SETZM ICWA+1 + SETZM ICWA+3 +BOOT0: DATAO DSK,[%HRDCL,,] + MOVEI A,20 + SOJG A,. + DATAI DSK,A + TRNN A,%HCDVA + JRST BOOT0 ;AWAIT DRIVE AVAILABLE + MOVE B,ERRWD + CONI DSK,A + TLNE A,(%HID22) + HRLI B,-1700_4 + MOVEM B,@ICWA + MOVSI B,-6 +BOOT1: DATAO DSK,SWPIN1(B) + MOVEI A,20 + SOJG A,. + CONSZ DSK,%HIBSY + JRST .-1 + AOBJN B,BOOT1 + CONSZ DSK,%HIERR + JRST 4,. + JRST BEG + +ZZ1==*SECBLK ;BLOCK CONTAINING CORE SWAPPED OUT TO BRING DSKDMP IN +ZZ2==*SECBLK ;DSKDMP RESIDENCE BLOCK +ZZ3==ZZ1/NSECS +ZZ4==ZZ2/NSECS +ZZ1==ZZ3*400+ ;CONVERT ADDR TO DISK FORMAT +ZZ2==ZZ4*400+ + +ERRWD: -1700,,BEG-1 +SWPIN1: %HRLOD+%HRDCL,,%HMRDP +SWPIN2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPIN3: %HRLOD+%HRADR,,ZZ1 +SWPIN4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPIN5: %HRLOD+%HRADR,,ZZ2 +SWPIN6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +SWPOU1: %HRLOD+%HRDCL,,%HMRDP +SWPOU2: %HRLOD+%HRCYL,,NCYLS+1 ;AVOID CYLINDER 406 WHICH KLDCP USES +SWPOU3: %HRLOD+%HRADR,,ZZ2 +SWPOU4: %HRLOD+%HRCTL,,%HMWRT+ICWA_6 +SWPOU5: %HRLOD+%HRADR,,ZZ1 +SWPOU6: %HRLOD+%HRCTL,,%HMRED+ICWA_6 + +CBLK: -NSWBL,,NBLKS+NBLKSC ;AVOID CYLINDER 406 WHICH KLDCP USES + +WAIT: CONSO DSK,%HIDON + JRST .-1 +];RH + +SC,[ +BOOT: +IFE BOOTSW, JRST BEG ;OR CONSZ DC0,DSSACT OR JRST LOADG1 +IFN BOOTSW, CONSZ DC0,DSSACT + JRST .-1 + DATAO DC0,SWPINJ + CONSZ DC0,DSSACT + JRST .-1 + JRST BEG + +SWPINJ: DJMP SWPIN + +DADR==NCYLS_13+</2>_6+<&1> ;ADDR OF LAST BLOCK IN CORE BUFFER +DADR1==NCYLS_13+_6+ ;ADDR OF NEXT BLOCK (CONTAINS +SWPIN: DWRITE+DUNENB+DADR ; WORKING COPY OF DSKDMP) + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR1 + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +SWPOUT: DWRITE+DUNENB+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DRC+DADR1 + DCOPY BEG(-2000_2&37774) + DCSKIP (-4_2&37774) + DREAD+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DRC+DADR + DCOPY BEG(-1700_2&37774) + DCSKIP (-104_2&37774) + DHLT + +CBLK: -NSWBL,,NBLKS ;DISK ADDR OF CORE BUFFER, - # BLOCKS IN LH +WAIT: CONSZ DC0,DSSACT + JRST .-1 +];SC +SADR: JRST BOOT ;AND GO TO PROGRAM TO BE STARTED +SYSN: SIXBIT /./ ;CURRENT DIRECTORY +IFG .+1-MEMSIZ,.ERR BOOT BLOAT + +IFE BOOTSW,{ ;CURLY BRACKETS TO AVOID ERROR MESSAGE + OFFSET 0 + LOC CORE + +;THESE ARE THE BLOCKS THAT GET WRITTEN ON DISK +; STARTING AT THE BEGINNING OF THE FIRST EXTRA CYLINDER + +CBUF: BLOCK 2000 ;PSEUDO-CORE BUFFER +DBUF: BLOCK 2000 ;DISK BUFFER +DIR: BLOCK 2000 ;DIRECTORY BUFFER +TUT: BLOCK 2000*NTUTBL ;TUT BUFFER +IFN .-BEG,.ERR BLOCKS LOST +; BLOCK 2000 ;CORE OVERLAYED BY DSKDMP +; BLOCK 2000 ;COPY OF DSKDMP +; BLOCK 2000 ;SPARE COPY OF DSKDMP + +END ZZZ +};END IFE BOOTSW +IFN BOOTSW, END CBOOT diff --git a/system/dz11.10 b/system/dz11.10 new file mode 100644 index 0000000..2c32b41 --- /dev/null +++ b/system/dz11.10 @@ -0,0 +1,72 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; DZ11 definitions + +DZLNLN==3 +DZNLN==1_DZLNLN ;Number of DZ terminal lines per board +DZLNM==DZNLN-1 ;Line number mask given DZ number of TTY + +%DZLM==3400 ;Line Number Mask +%DZLS==8. ;Line number shift + +%DZRCS==0 ;Control & Status register +; CSR Bits and fields +%DZCMN==10 ;Maintenance +%DZCCL==20 ;Clear +%DZCMS==40 ;Master Scan Enable +%DZCRE==100 ;Receiver Interrupt Enable +%DZCRD==200 ;Receiver Done +%DZCSE==10000 ;Silo Alarm Enable +%DZCSA==20000 ;Silo Alarm +%DZCTE==40000 ;Transmitter Interrupt Enable +%DZCTR==100000 ;Transmitter Ready + +%DZRLP==2 ;Line Parameter register +; LPR Bits and fields +%DZLLM==7 ;Line number mask +%DZLCL==10 ;Character Length position +%DZLSC==40 ;Stop code bit +%DZLPY==100 ;Parity bit +%DZLOP==200 ;Odd parity +%DZLSP==400 ;Speed code position +%DZLSS==8. ;Speed code shift +%DZLRO==10000 ;Receiver on + +%DZRDR==2 ;Read Data register +; RDR Bits and fields +%DZDCM==377 ;Character mask +%DZDPE==10000 ;Parity Error +%DZDFE==20000 ;Frame Error (break key) +%DZDOR==40000 ;Overrun +%DZDDV==100000 ;Data valid + +%DZRTC==4 ;Transmitter Control & Data Terminal registers + +%DZRTD==6 ;Transmitter Buffer & Break registers +; TDR and BR fields +%DZTCM==377 ;Character mask +%DZTBM==177400 ;Break mask + +%DZRMS==6 ;Modem status +; MSR fields +%DZMRI==377 ;Ring detect +%DZMCD==177400 ;Carrier detect + +; To do: +; - Add modem control. + diff --git a/system/dz11.9 b/system/dz11.9 new file mode 100644 index 0000000..dabda4e --- /dev/null +++ b/system/dz11.9 @@ -0,0 +1,67 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; DZ11 definitions + +DZLNLN==3 +DZNLN==1_DZLNLN ;Number of DZ terminal lines per board +DZLNM==DZNLN-1 ;Line number mask given DZ number of TTY + +%DZLM==3400 ;Line Number Mask +%DZLS==8. ;Line number shift + +%DZRCS==0 ;Control & Status register +; CSR Bits and fields +%DZCMN==10 ;Maintenance +%DZCCL==20 ;Clear +%DZCMS==40 ;Master Scan Enable +%DZCRE==100 ;Receiver Interrupt Enable +%DZCRD==200 ;Receiver Done +%DZCSE==10000 ;Silo Alarm Enable +%DZCSA==20000 ;Silo Alarm +%DZCTE==40000 ;Transmitter Interrupt Enable +%DZCTR==100000 ;Transmitter Ready + +%DZRLP==2 ;Line Parameter register +; LPR Bits and fields +%DZLLM==7 ;Line number mask +%DZLCL==10 ;Character Length position +%DZLSC==40 ;Stop code bit +%DZLPY==100 ;Parity bit +%DZLOP==200 ;Odd parity +%DZLSP==400 ;Speed code position +%DZLSS==8. ;Speed code shift +%DZLRO==10000 ;Receiver on + +%DZRDR==2 ;Read Data register +; RDR Bits and fields +%DZDCM==377 ;Character mask +%DZDPE==10000 ;Parity Error +%DZDFE==20000 ;Frame Error (break key) +%DZDOR==40000 ;Overrun +%DZDDV==100000 ;Data valid + +%DZRTC==4 ;Transmitter Control & Data Terminal registers + +%DZRTD==6 ;Transmitter Buffer & Break registers +; TDR and BR fields +%DZTCM==377 ;Character mask +%DZTBM==177400 ;Break mask + +; To do: +; - Add modem control. + diff --git a/system/ept.defs15 b/system/ept.defs15 new file mode 100644 index 0000000..ae4c621 --- /dev/null +++ b/system/ept.defs15 @@ -0,0 +1,175 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +IFN 0,[ +.AUXIL +] + +IF1,[ +.TYO6 .IFNM1 +.TYO 40 +.TYO6 .IFNM2 +PRINTX / included in this assembly. +/ +];IF1 + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + + + +IFNDEF EPT, EPT=1000 ;ABSOLUTE LOCATION OF EPT + ;LOCS 0-1777 UNCACHED + ;BUT THE HARDWARE CACHES EPT REFERENCES ANYWAY + +DEFSYM PI0LOC=EPT+40 ;PI0LOC+2*PICHN = ADDRESS OF INSTR PAIR FOR PICHN + +DEFSYM DTEBPO=EPT+140 ;DTE20 OUTPUT (BYTE TRANSFER) BYTE POINTER +DEFSYM DTEBPI=EPT+141 ;DTE20 INPUT (BYTE TRANSFER) BYTE POINTER +DEFSYM DTELOC=EPT+142 ;DTE20 INTERRUPT INSTRUCTION +DEFSYM DTEPRO=EPT+144 ;DTE20 OUTPUT (EXAMINE) PROTECTION WORD +DEFSYM DTERLO=EPT+145 ;DTE20 OUTPUT (EXAMINE) RELOCATION WORD +DEFSYM DTEPRI=EPT+146 ;DTE20 INPUT (DEPOSIT) PROTECTION WORD +DEFSYM DTERLI=EPT+147 ;DTE20 INPUT (DEPOSIT) RELOCATION WORD + +DEFSYM EPTCLK=EPT+510 ;DOUBLE WORD FOR CALENDAR CLOCK (TIME BASE) +DEFSYM EPTPRF=EPT+512 ;DOUBLE WORD FOR PERFORMANCE COUNTER +DEFSYM EPTEBC==EPT+504 ;DOUBLE WORD EBOX COUNT WHEN UPT=EPT +DEFSYM EPTMBC==EPT+506 ;DOUBLE WORD MBOX COUNT WHEN UPT=EPT +DEFSYM TIMLOC=EPT+514 ;INTERRUPT INSTRUCTION FOR INTERVAL TIMER + +DEFSYM EPTTR1=EPT+421 ;EXEC MODE ARITH OVFL TRAP +DEFSYM EPTTR2=EPT+422 ;EXEC MODE PDL OV TRAP +DEFSYM EPTTR3=EPT+423 ;EXEC MODE TRAP 3 (1 PROCEED) + +;UPT LOCATIONS - IN NON-TIME SHARING AND AT CLOCK LEVEL IN ITS UPT=EPT + +;424 MUUO STORED HERE +;425 MUUO PC STORED HERE +;426 MUUO DATAI PAG, HERE +;430 MUUO NEW PC KERNEL NO TRAP +;431 . . K T +;432 . . S N T +;433 . . S T +;434 . . C N T +;435 . . C T +;436 . . P N T +;437 . . P T +;500 PAGE FAIL WORD STORED HERE IN DEC PAGING MODE +;501 PAGE FAIL PC STORED HERE IN DEC PAGING MODE +;502 PAGE FAIL NEW PC FROM HERE IN DEC PAGING MODE +;504-5 EBOX COUNT +;506-7 MBOX COUNT + +DEFSYM EPTPFW=EPT+500 ;PAGE FAIL WORD STORED HERE IN ITS PAGING MODE +DEFSYM PFOPC=EPT+501 ;PAGE FAIL OLD PC STORED HERE IN ITS PAGING MODE +DEFSYM PFNPC=EPT+502 ;PAGE FAIL NEW PC OBTAINED FROM HERE IN ITS PAGING MODE + +;LOW CORE +;0-200 DF10S CHANNEL PROGRAMS, INTERRUPT LOCATIONS FOR IMP INTERFACE +;400-500 DTE20 COMMUNICATION AREA (COMMUNICATE WITH KLDCP AND IOELEV) +;500-1000 DL10 COMMUNICATION AREA AND BUFFERS (COMMUNICATE WITH IOELEV) + +DEFSYM QICWA=32 ;ITS DISK ICWA +DEFSYM QIOWD=160 ;ITS DISK IOWD AREA + +DEFSYM MICWA=30 ;ITS TAPE ICWA +DEFSYM MIOWD=170 ;ITS TAPE IOWD AREA + +;LUUO IN EXEC MODE LOCATIONS 40,41 + +DEFSYM SLVICW=60 ;SALVAGER ICWA +DEFSYM SLVIOW=62 ;SALVAGER IOWD AREA + +;EXEC DDT'S DISK ROUTINES USE LOCATIONS 20 AND 21, BUT THEY SAVE AND RESTORE THEM + +DEFSYM IMPILC=70 ;IMPTERFACE INPUT INTERRUPT INSTRUCTION PAIR +DEFSYM IMPOLC=72 ;IMPTERFACE OUTPUT INTERRUPT INSTRUCTION PAIR + +;DTE20 STUFF AS DEFINED BY KLDCP, ETC. +;THE DOCUMENTATION CLAIMS THIS STUFF IS IN THE EPT, BUT ACTUALLY +;IT'S IN FIXED LOCATIONS IN LOW CORE. + +DEFSYM EPTDIA=440 ;DIAGNOSTIC (SALV) START ADDRESS +DEFSYM EPTDDT=441 ;DDT START ADDRESS +DEFSYM EPTSTL=442 ;LOADER (DSKDMP) START ADDRESS +DEFSYM EPTITS=443 ;MONITOR (ITS) START ADDRESS + +DEFSYM DTEFLG=444 ;DTE20 OPERATION COMPLETE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTECLK=445 ;DTE20 CLOCK INTERRUPT FLAG (SET BY 11, CLEARED BY 10) +;DEFSYM DTECI=446 ;DTE20 CLOCK INTERRUPT INSTRUCTION (USED BY 10 SOFTWARE) +DEFSYM DTET11=447 ;DTE20 10->11 ARGUMENT (SET BY 10) (NOT USED?) +DEFSYM DTEF11=450 ;DTE20 11->10 ARGUMENT (SET BY 11) +DEFSYM DTECMD=451 ;DTE20 10->11 COMMAND WORD (SET BY 10) +DEFSYM DTESEQ=452 ;DTE20 OPERATION SEQUENCE NUMBER (AOS BY 10) +DEFSYM DTEOPR=453 ;DTE20 OPERATION IN PROGRESS FLAG (SET/CLEARED BY 10) +DEFSYM DTECHR=454 ;DTE20 LAST TYPED CHARACTER (SET BY 11, CLEARED BY 10) +DEFSYM DTEMTO=455 ;DTE20 MONITOR-MODE TYPEOUT DONE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTEMTI=456 ;DTE20 MONITOR-MODE TYPEIN DONE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTESWR=457 ;DTE20 SIMULATED SWITCH REGISTER (SET BY 11 ON START) + +DEFSYM DTE==200 ;DTE20 #0 DEVICE CODE +DEFSYM %DBL11==20000 ;CONO BIT TO "DOORBELL" 11 +DEFSYM %DBL10==1000 ;CONI BIT FOR DOORBEL FROM 11. CONO BIT TO CLEAR. +;1.1-1.3 DTE20 PIA + +;WORDS STORED IN DTECMD + +DEFSYM %DTTTI==2400 ;BUFFERED INPUT. CHAR RETURNED IN DTEF11 AFTER LINE TYPED. +;NUMBER 0-377 IS CHAR TO BE TYPED OUT (FLUSHES INPUT. BUFFER NOT PRINTED UNTIL LF/^G/^@) +DEFSYM %DTTTO==2000 ;THIS + CHAR ALSO = TTY OUTPUT +DEFSYM %DTTYI==3400 ;"DDT" INPUT, CHAR RETURNED IN DTEF11, ZERO IF NO CHAR TYPED +DEFSYM %DTTYO==4000 ;THIS + CHAR = ITS (MONITOR) TTY OUTPUT. + ;WHEN TYPEOUT DONE, INTERRUPT WITH DTEMTO SET. + ;TYPEIN CAUSES INTERRUPT WITH DTEMTI SET, CHAR IN DTEF11. +DEFSYM %DTMMN==4400 ;MONITOR MODE ON (DEFAULT WHEN START) +DEFSYM %DTMMF==5000 ;MONITOR MODE OFF (TYPEIN OF A ^X DOES THIS ALSO) +DEFSYM %DTMMS==5400 ;RETURN MONITOR MODE STATE IN DTEF11 +;DEFSYM %DTNRM==3000 ;NORMAL PRINT MODE +;DEFSYM %DTFRC==3001 ;FORCED PRINT MODE +DEFSYM %DTCLN==1001 ;CLOCK ON (60 CYCLE SIMULATED CLOCK) +DEFSYM %DTCLF==1000 ;CLOCK OFF +;DEFSYM %DTCLW==1002 ;"CLOCK WAIT" DTET11 HAS COUNT (? WHAT THE HECK IS THIS?) +;DEFSYM %DTCLR==1003 ;RETURN "CLOCK COUNT" IN DTEF11 (? WHAT THE HECK IS THIS?) +DEFSYM %DTHLT==400 ;HALT +;DEFSYM %DTFTL==401 ;DIAG FATAL ERROR (ACTUALLY JUST TURNS OFF CLOCK) +;DEFSYM %DTERR==402 ;DIAG ERROR HALT (ACTUALLY JUST TURNS OFF CLOCK) +;DEFSYM %DTEPG==403 ;END OF DIAGNOSTIC PROGRAM +;DEFSYM %DTEOP==404 ;END OF DIAGNOSTIC PASS +;DEFSYM %DTCLK==405 ;GET "CLOCK DEFAULT WORD" +;DEFSYM %DTFSL==406 ;DIAMON FILE SELECT (NAME.EXT MUST HAVE BEEN %DTTTO'ED) +;DEFSYM %DTFRD==407 ;DIAMON FILE READ (5 CHARS OR -1 (EOF) RETURNED IN DTEF11) +;DEFSYM %DTCMD==410 ;KLDCP COMMAND EXECUTED FROM OUTPUT BUFFER (%DTTTO IT) +;DEFSYM %DTRSW==1400 ;RETURN SIMULATED SWITCHES IN DTEF11. 10 SHOULD THEN STORE IN DTESWR + + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/ept.defs16 b/system/ept.defs16 new file mode 100644 index 0000000..5a90641 --- /dev/null +++ b/system/ept.defs16 @@ -0,0 +1,176 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +IFN 0,[ +.AUXIL +] + +IF1,[ +.TYO6 .IFNM1 +.TYO 40 +.TYO6 .IFNM2 +PRINTX / included in this assembly. +/ +];IF1 + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + + + +IFNDEF EPT, EPT=1000 ;ABSOLUTE LOCATION OF EPT + ;LOCS 0-1777 UNCACHED + ;BUT THE HARDWARE CACHES EPT REFERENCES ANYWAY + +DEFSYM PI0LOC=EPT+40 ;PI0LOC+2*PICHN = ADDRESS OF INSTR PAIR FOR PICHN + +DEFSYM DTEBPO=EPT+140 ;DTE20 OUTPUT (BYTE TRANSFER) BYTE POINTER +DEFSYM DTEBPI=EPT+141 ;DTE20 INPUT (BYTE TRANSFER) BYTE POINTER +DEFSYM DTELOC=EPT+142 ;DTE20 INTERRUPT INSTRUCTION +DEFSYM DTEPRO=EPT+144 ;DTE20 OUTPUT (EXAMINE) PROTECTION WORD +DEFSYM DTERLO=EPT+145 ;DTE20 OUTPUT (EXAMINE) RELOCATION WORD +DEFSYM DTEPRI=EPT+146 ;DTE20 INPUT (DEPOSIT) PROTECTION WORD +DEFSYM DTERLI=EPT+147 ;DTE20 INPUT (DEPOSIT) RELOCATION WORD + +DEFSYM EPTCLK=EPT+510 ;DOUBLE WORD FOR CALENDAR CLOCK (TIME BASE) +DEFSYM EPTPRF=EPT+512 ;DOUBLE WORD FOR PERFORMANCE COUNTER +DEFSYM EPTEBC==EPT+504 ;DOUBLE WORD EBOX COUNT WHEN UPT=EPT +DEFSYM EPTMBC==EPT+506 ;DOUBLE WORD MBOX COUNT WHEN UPT=EPT +DEFSYM TIMLOC=EPT+514 ;INTERRUPT INSTRUCTION FOR INTERVAL TIMER + +DEFSYM EPTTR1=EPT+421 ;EXEC MODE ARITH OVFL TRAP +DEFSYM EPTTR2=EPT+422 ;EXEC MODE PDL OV TRAP +DEFSYM EPTTR3=EPT+423 ;EXEC MODE TRAP 3 (1 PROCEED) + +;UPT LOCATIONS - IN NON-TIME SHARING AND AT CLOCK LEVEL IN ITS UPT=EPT + +;424 MUUO STORED HERE +;425 MUUO PC STORED HERE +;426 MUUO DATAI PAG, HERE +;430 MUUO NEW PC KERNEL NO TRAP +;431 . . K T +;432 . . S N T +;433 . . S T +;434 . . C N T +;435 . . C T +;436 . . P N T +;437 . . P T +;500 PAGE FAIL WORD STORED HERE IN DEC PAGING MODE +;501 PAGE FAIL PC STORED HERE IN DEC PAGING MODE +;502 PAGE FAIL NEW PC FROM HERE IN DEC PAGING MODE +;504-5 EBOX COUNT +;506-7 MBOX COUNT + +DEFSYM EPTPFW=EPT+500 ;PAGE FAIL WORD STORED HERE IN ITS PAGING MODE +DEFSYM PFOPC=EPT+501 ;PAGE FAIL OLD PC STORED HERE IN ITS PAGING MODE +DEFSYM PFNPC=EPT+502 ;PAGE FAIL NEW PC OBTAINED FROM HERE IN ITS PAGING MODE + +;LOW CORE +;0-200 DF10S CHANNEL PROGRAMS, INTERRUPT LOCATIONS FOR IMP INTERFACE +;400-500 DTE20 COMMUNICATION AREA (COMMUNICATE WITH KLDCP AND IOELEV) +;500-1000 DL10 COMMUNICATION AREA AND BUFFERS (COMMUNICATE WITH IOELEV) + +DEFSYM QICWA=32 ;ITS DISK ICWA +DEFSYM QIOWD=160 ;ITS DISK IOWD AREA +DEFSYM RCIOWD=162 ;.. FOR READ COMPARE + +DEFSYM MICWA=30 ;ITS TAPE ICWA +DEFSYM MIOWD=170 ;ITS TAPE IOWD AREA + +;LUUO IN EXEC MODE LOCATIONS 40,41 + +DEFSYM SLVICW=60 ;SALVAGER ICWA +DEFSYM SLVIOW=62 ;SALVAGER IOWD AREA + +;EXEC DDT'S DISK ROUTINES USE LOCATIONS 20 AND 21, BUT THEY SAVE AND RESTORE THEM + +DEFSYM IMPILC=70 ;IMPTERFACE INPUT INTERRUPT INSTRUCTION PAIR +DEFSYM IMPOLC=72 ;IMPTERFACE OUTPUT INTERRUPT INSTRUCTION PAIR + +;DTE20 STUFF AS DEFINED BY KLDCP, ETC. +;THE DOCUMENTATION CLAIMS THIS STUFF IS IN THE EPT, BUT ACTUALLY +;IT'S IN FIXED LOCATIONS IN LOW CORE. + +DEFSYM EPTDIA=440 ;DIAGNOSTIC (SALV) START ADDRESS +DEFSYM EPTDDT=441 ;DDT START ADDRESS +DEFSYM EPTSTL=442 ;LOADER (DSKDMP) START ADDRESS +DEFSYM EPTITS=443 ;MONITOR (ITS) START ADDRESS + +DEFSYM DTEFLG=444 ;DTE20 OPERATION COMPLETE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTECLK=445 ;DTE20 CLOCK INTERRUPT FLAG (SET BY 11, CLEARED BY 10) +;DEFSYM DTECI=446 ;DTE20 CLOCK INTERRUPT INSTRUCTION (USED BY 10 SOFTWARE) +DEFSYM DTET11=447 ;DTE20 10->11 ARGUMENT (SET BY 10) (NOT USED?) +DEFSYM DTEF11=450 ;DTE20 11->10 ARGUMENT (SET BY 11) +DEFSYM DTECMD=451 ;DTE20 10->11 COMMAND WORD (SET BY 10) +DEFSYM DTESEQ=452 ;DTE20 OPERATION SEQUENCE NUMBER (AOS BY 10) +DEFSYM DTEOPR=453 ;DTE20 OPERATION IN PROGRESS FLAG (SET/CLEARED BY 10) +DEFSYM DTECHR=454 ;DTE20 LAST TYPED CHARACTER (SET BY 11, CLEARED BY 10) +DEFSYM DTEMTO=455 ;DTE20 MONITOR-MODE TYPEOUT DONE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTEMTI=456 ;DTE20 MONITOR-MODE TYPEIN DONE FLAG (SET BY 11, CLEARED BY 10) +DEFSYM DTESWR=457 ;DTE20 SIMULATED SWITCH REGISTER (SET BY 11 ON START) + +DEFSYM DTE==200 ;DTE20 #0 DEVICE CODE +DEFSYM %DBL11==20000 ;CONO BIT TO "DOORBELL" 11 +DEFSYM %DBL10==1000 ;CONI BIT FOR DOORBEL FROM 11. CONO BIT TO CLEAR. +;1.1-1.3 DTE20 PIA + +;WORDS STORED IN DTECMD + +DEFSYM %DTTTI==2400 ;BUFFERED INPUT. CHAR RETURNED IN DTEF11 AFTER LINE TYPED. +;NUMBER 0-377 IS CHAR TO BE TYPED OUT (FLUSHES INPUT. BUFFER NOT PRINTED UNTIL LF/^G/^@) +DEFSYM %DTTTO==2000 ;THIS + CHAR ALSO = TTY OUTPUT +DEFSYM %DTTYI==3400 ;"DDT" INPUT, CHAR RETURNED IN DTEF11, ZERO IF NO CHAR TYPED +DEFSYM %DTTYO==4000 ;THIS + CHAR = ITS (MONITOR) TTY OUTPUT. + ;WHEN TYPEOUT DONE, INTERRUPT WITH DTEMTO SET. + ;TYPEIN CAUSES INTERRUPT WITH DTEMTI SET, CHAR IN DTEF11. +DEFSYM %DTMMN==4400 ;MONITOR MODE ON (DEFAULT WHEN START) +DEFSYM %DTMMF==5000 ;MONITOR MODE OFF (TYPEIN OF A ^X DOES THIS ALSO) +DEFSYM %DTMMS==5400 ;RETURN MONITOR MODE STATE IN DTEF11 +;DEFSYM %DTNRM==3000 ;NORMAL PRINT MODE +;DEFSYM %DTFRC==3001 ;FORCED PRINT MODE +DEFSYM %DTCLN==1001 ;CLOCK ON (60 CYCLE SIMULATED CLOCK) +DEFSYM %DTCLF==1000 ;CLOCK OFF +;DEFSYM %DTCLW==1002 ;"CLOCK WAIT" DTET11 HAS COUNT (? WHAT THE HECK IS THIS?) +;DEFSYM %DTCLR==1003 ;RETURN "CLOCK COUNT" IN DTEF11 (? WHAT THE HECK IS THIS?) +DEFSYM %DTHLT==400 ;HALT +;DEFSYM %DTFTL==401 ;DIAG FATAL ERROR (ACTUALLY JUST TURNS OFF CLOCK) +;DEFSYM %DTERR==402 ;DIAG ERROR HALT (ACTUALLY JUST TURNS OFF CLOCK) +;DEFSYM %DTEPG==403 ;END OF DIAGNOSTIC PROGRAM +;DEFSYM %DTEOP==404 ;END OF DIAGNOSTIC PASS +;DEFSYM %DTCLK==405 ;GET "CLOCK DEFAULT WORD" +;DEFSYM %DTFSL==406 ;DIAMON FILE SELECT (NAME.EXT MUST HAVE BEEN %DTTTO'ED) +;DEFSYM %DTFRD==407 ;DIAMON FILE READ (5 CHARS OR -1 (EOF) RETURNED IN DTEF11) +;DEFSYM %DTCMD==410 ;KLDCP COMMAND EXECUTED FROM OUTPUT BUFFER (%DTTTO IT) +;DEFSYM %DTRSW==1400 ;RETURN SIMULATED SWITCHES IN DTEF11. 10 SHOULD THEN STORE IN DTESWR + + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/evsyms.21 b/system/evsyms.21 new file mode 100644 index 0000000..30ef9e2 --- /dev/null +++ b/system/evsyms.21 @@ -0,0 +1,294 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;This purports to be a table of all ITS symbols +;referenced by user programs, not counting sys$j in DDT. +;to sort in TECO, do J6FXA 12U0 <:S0; -DK> CS;$:LL :FWLFWLL J<50L .-Z; 12I 13I 10I> JGA +;The "5" is chosen to count these 4 comment lines, and the blank line. +;Commented-out symbols are those for obsolete devices, used from PEEK/FIDO but not essential. + +%QAACC ;used by PEEK +%QACTH ;used by PEEK +%QADEL ;used by PEEK +%QAEFR ;used by PEEK +%QAEFW ;used by PEEK +%QAFUL ;used by PEEK +%QAPAR ;used by PEEK +%QAWOV ;used by PEEK +%QMMDR ;used by PEEK +%QMMDW ;used by PEEK +%QMTTR ;used by PEEK +%QMTTW ;used by PEEK +%QMUDR ;used by PEEK +%QMUDW ;used by PEEK +AC0S ;used by PEEK +APRC ;used by PEEK +AUSOPG ;used by PEEK +BADBTS ;used by DDT +CALSXB ;used by PEEK +CLSTB ;used by PEEK +CUSER ;used by PEEK +DCHSTB ;used by FIDO (.EVAL and core mapping) +DCHSTB ;used by PEEK +DEDTIM ;used by PFTHMG DRAGON +DEVTAB ;used by PEEK +;DG2 ;used by PEEK +DIRCHN ;used by PEEK +;DISUSR ;used by FIDO (.EVAL and core mapping) +;DISUSR ;used by PEEK +DMNBC ;used by PFTHMG DRAGON +DMNBD ;used by NAMDRG +DMNBD ;used by PFTHMG DRAGON +DMNBEL ;used by NAMDRG +DMNBEL ;used by PFTHMG DRAGON +DMNBF ;used by NAMDRG +DMNBF ;used by PFTHMG DRAGON +DMNBFE ;used by PFTHMG DRAGON +DMNSZ ;used by NAMDRG +DPKBAS ;used by LOCK +;DRTM ;used by PEEK +EDEVS ;used by PEEK +;EUPOS ;used by PEEK +FLSINS ;used by PEEK +HUSRAD ;used by PEEK +IDF1 ;used by PEEK +IDF2 ;used by PEEK +IDLRCE ;used by PEEK +IFPIR ;used by PEEK +IMPBPQ ;used by PEEK +IMPSTL ;used by PEEK +IMPUP ;used by FIDO (.EVAL and core mapping) +IMPUP ;used by PEEK +IMPUP ;used by TELNET (and by other network programs I think - MRC) +IMPUS ;used by COMSAT (.EVAL) +IMPUS ;used by DDT +IMPUS ;used by NAMDRG +IMPUS ;used by NAME +IMPUS ;used by QMAIL (.EVAL) +IMSOC1 ;used by PEEK +IMSOC2 ;used by PEEK +IMSOC3 ;used by PEEK +IMSOC4 ;used by PEEK +IMSOC4 ;used by NAME and NAMDRG +IMSOC5 ;used by PEEK +IMSOC6 ;used by PEEK +IMSOC7 ;used by PEEK +IMSOC8 ;used by PEEK +IOCHNM ;used by FIDO (.EVAL and core mapping) +IOCHNM ;used by PEEK +IOCHNM ;used by NAME and NAMDRG +IOCHST ;used by FIDO (.EVAL and core mapping) +IOCHST ;used by PEEK +IOTLSR ;used by PEEK +IOTTB ;used by PEEK +JBDEV ;used by PEEK +JNAME ;used by FIDO (.EVAL and core mapping) +JNAME ;used by NAMDRG +JNAME ;used by NAME +JNAME ;used by PEEK +JNAME ;used by PFTHMG DRAGON +JTMU ;used by PEEK +LIOBLK ;used by PFTHMG DRAGON +LOSRCE ;used by PEEK +LOUTIM ;used by PEEK +LPTUSR ;used by FIDO (.EVAL and core mapping) +LPTUSR ;used by PEEK +LSCALL ;used by PEEK +LUBLK ;used by COMSAT +LUBLK ;used by FIDO (.EVAL) +LUBLK ;used by NAMDRG +LUBLK ;used by NAME +LUBLK ;used by PEEK +LUBLK ;used by PFTHMG DRAGON +LUBLK ;used by CLU +LUIOP ;used by PEEK +MAXJ ;used by COMSAT +MEMBLT ;used by PEEK +MEMFR ;used by PEEK +MEMPNT ;used by PEEK +MMMPG ;used by PEEK +MMPNP ;used by PEEK +MMSWP ;used by PEEK +;MPXBUF ;used by PEEK +MSKST ;used by PEEK +MSKST2 ;used by PEEK +MTUSR ;used by PEEK +MUR ;used by PEEK +MURUSR ;used by PEEK +N11TYS ;used by FIDO (.EVAL) +N11TYS ;used by NAMDRG +N11TYS ;used by NAME +NCBCOM ;used by PEEK +NCT ;used by FIDO (.EVAL) +NCT ;used by LOCK +NCT ;used by NAMDRG +NCT ;used by NAME +NCT ;used by PEEK +NDPTYS ;used by LOCK +NETDBO ;used by NAME and NAMDRG +NETDUI ;used by NAME and NAMDRG +NETP ;used by COMSAT (.EVAL) +NETP ;used by QMAIL (.EVAL) +NF11TY ;used by FIDO (.EVAL) +NF11TY ;used by NAMDRG +NF11TY ;used by NAME +NFDPTY ;used by LOCK +NFSTTY ;used by NAMDRG +NFSTTY ;used by NAME +NFSTTY ;used by PEEK +NIOCHN ;used by NAME and NAMDRG +NMPGS ;used by PEEK +NNTYS ;used by LOCK +NPGSWO ;used by PEEK +NQCHN ;used by PEEK +NQMFWR ;used by COMSAT (.EVAL and core mapping) +NQS ;used by PEEK +NSTTYS ;used by NAMDRG +NSTTYS ;used by NAME +NSTTYS ;used by PEEK +NSWPGS ;used by PEEK +NULTIM ;used by PEEK +NUNITS ;used by PEEK +NUTIC ;used by PEEK +NUTOC ;used by PEEK +;NVDUSR ;used by PEEK +NXGPFW ;used by XGPSPL +OIPBIT ;used by DDT +OPRSXB ;used by PEEK +PARERR ;used by PEEK +;PDPUSR ;used by FIDO (.EVAL and core mapping) +;PDPUSR ;used by PEEK +PICLR ;used by PEEK +PIRQC ;used by PEEK +PLTUSR ;used by PEEK +PRVUSR ;used by PEEK +PSWOUS ;used by PEEK +PTPUSR ;used by PEEK +PTRUSR ;used by PEEK +QFBLNO ;used by PEEK +QIRRCV ;used by PEEK +QSCRW ;used by PEEK +QSMDN ;used by PEEK +QSMPRP ;used by PEEK +QSNLCN ;used by PEEK +QSNUD ;used by PEEK +QSRAC ;used by PEEK +QUDFPR ;used by PEEK +QUDPR ;used by PEEK +QUSR ;used by PEEK +RNABLU ;used by PEEK +RPCL ;used by PEEK +SCHHB ;used by PEEK +SCLNET ;used by LOCK +SHUTDN ;used by NAMDRG +SHUTDN ;used by NAME +SILNG ;used by PEEK +SLOADU ;used by DDT +SLOADU ;used by PEEK +SOLNG ;used by PEEK +SSCHDB ;used by PEEK +STYSTS ;used by NAMDRG +STYSTS ;used by NAME +STYSTS ;used by PEEK +SUEXIT ;used by PEEK +SUPCOR ;used by LOCK +SUPPRO ;used by COMSAT +SUPPRO ;used by FIDO (.EVAL and core mapping) +SUPPRO ;used by NAMDRG +SUPPRO ;used by NAME +SUPPRO ;used by PEEK +SUPPRO ;used by PFTHMG DRAGON +SUUOH ;used by PEEK +SV40 ;used by PEEK +SWPOPR ;used by PEEK +SWRCE ;used by PEEK +SYSUSB ;used by DDT +SYSUSE ;used by DDT +SYSYMB ;used by DDT +SYSYME ;used by DDT +;TABUSR ;used by PEEK +TCTYP ;used by FIDO (.EVAL and core mapping) +TIME ;used by NAMDRG +TIME ;used by NAME +TIME ;used by PEEK +TIME ;used by PFTHMG DRAGON +TRNLS1 ;used by PEEK +TRNLST ;used by PEEK +TRUMM ;used by PEEK +TRUNTM ;used by PEEK +TRUNTM ;used by PFTHMG DRAGON +TSIPRQ ;used by PFTHMG DRAGON +TSYSM ;used by PEEK +TT11P ;used by NAMDRG +TT11P ;used by NAME +TTITM ;used by NAMDRG +TTITM ;used by NAME +TTYCHN ;used by LOCK +TTYSTS ;used by FIDO (.EVAL and core mapping) +TTYSTS ;used by NAMDRG +TTYSTS ;used by NAME +TTYTBL ;used by FIDO (.EVAL and core mapping) +TTYTBL ;used by NAMDRG +TTYTBL ;used by NAME +TTYTBL ;used by PEEK +TTYTYP ;used by FIDO (.EVAL and core mapping) +TTYTYP ;used by LOCK +TTYTYP ;used by NAMDRG +TTYTYP ;used by NAME +;UDIR ;used by PEEK +;UDIRO ;used by PEEK +;UGOAL ;used by PEEK +;ULCTM ;used by PEEK +UMASTER ;used by FIDO (.EVAL and core mapping) +UMASTER ;used by PEEK +UMNTR ;used by PEEK +UNAME ;used by COMSAT +UNAME ;used by FIDO (.EVAL and core mapping) +UNAME ;used by NAMDRG +UNAME ;used by NAME +UNAME ;used by PEEK +UNAME ;used by PFTHMG DRAGON +UPC ;used by PEEK +UPGCP ;used by PEEK +UPGSEC ;used by PEEK +UREALT ;used by PEEK +USRSTG ;used by COMSAT +USIPRQ ;used by PEEK +USIPRQ ;used by PFTHMG DRAGON +USIPRQ ;used by CLU +USRHI ;used by COMSAT +USRHI ;used by FIDO (.EVAL and core mapping) +USRHI ;used by PEEK +USRHI ;used by PFTHMG DRAGON +USRRCE ;used by PEEK +USTP ;used by PEEK +USWPRI ;used by PEEK +USWSCD ;used by PEEK +USWST ;used by PEEK +USYSN1 ;used by PEEK +USYSNM ;used by PEEK +;UTASS ;used by PEEK +;UTBFS ;used by PEEK +UTMPTR ;used by NAMDRG +UTMPTR ;used by NAME +UTMPTR ;used by PEEK +UTRNTM ;used by PEEK +UTRNTM ;used by PFTHMG DRAGON +;UTTNO ;used by PEEK +;UTUSR ;used by PEEK +UUAC ;used by PEEK +XJNAME ;used by COMSAT +XUNAME ;used by COMSAT diff --git a/system/fsdefs.40 b/system/fsdefs.40 new file mode 100644 index 0000000..37fbe06 --- /dev/null +++ b/system/fsdefs.40 @@ -0,0 +1,170 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +;FILE SYSTEM PARAMETERS - APPLIES TO ALL ITS MACHINES + +;9/5/79 - tut format changed! + +;MFD INFO + +IFDEF NBLKS,[ ;MFDBLK KNOWN ONLY IF .INSRT APPROPRIATE PHYSICAL PARAMS FILE +DEFSYM MFDBLK==NBLKS/2-1 ;LOC ON DISK +DEFSYM MFDCYL==MFDBLK/NBLKSC +DEFSYM MFDSRF==*SECBLK/NSECS +DEFSYM MFDSEC==*SECBLK-MFDSRF*NSECS +] + ;RANDOM INFO IN MFD +DEFSYM MDNUM==0 ;ASCENDING DIR NUM +DEFSYM MDNAMP==1 ;PNTR TO ORG OF USER NAME BLOCK AREA +DEFSYM MDYEAR==2 ;CURRENT YEAR +DEFSYM MPDOFF==3 ;DE-CORIOLIS CLOCK OFFSET +DEFSYM MPDWDK==4 ;PREFERRED WRITING DISK (PHYSICAL DRIVE #) +DEFSYM MDCHK==5 ;THIS WORD MUST BE M.F.D. (FOR CHECKING) +DEFSYM MDNUDS==6 ;NUMBER USER DIRECTORIES (FOR CHECKING ONLY) +DEFSYM LMIBLK==7 ;TOTAL STG USED BY HACKS LIKE THIS + ;USER NAME BLKS FROM C(MDNAMP) TO END +DEFSYM LMNBLK==2 ;# WDS/BLK +DEFSYM MNUNAM==0 ;6BIT USER NAME + ;SECOND WORD OF A USER-NAME BLOCK IS ZERO. + ;DECUUO CONTAINS A KLUDGE WHICH DEPENDS ON THIS, + ;PLEASE NOTIFY BUG-DECUUO BEFORE CHANGING IT. + +;TUT INFO + +IFDEF NBLKS,[ +DEFSYM TUTBLK==MFDBLK-NTUTBL ;LOC ON DISK +DEFSYM TUTCYL==TUTBLK/NBLKSC +DEFSYM TUTSRF==*SECBLK/NSECS +DEFSYM TUTSEC==*SECBLK-TUTSRF*NSECS +] +DEFSYM TUTBYT==3 ;SIZE OF BYTES (USED TO BE 4) +DEFSYM TUTBP==<440000+TUTBYT_6>,, +DEFSYM TUTEPW==36./TUTBYT ;NUMBER OF ENTRIES PER WORD +DEFSYM TUTMAX==1_TUTBYT +DEFSYM TUTLK==TUTMAX-1 ;HIGHEST CODE MEANS LOCKED OUT +DEFSYM TUTMNY==TUTLK-1 ;TUT MANY OR MORE REFS + +;RANDOM INFO IN TUT (AT THE FRONT) +DEFSYM QPKNUM==0 ;PACK # +DEFSYM QPAKID==1 ;PACK ID +DEFSYM QTUTP==2 ;FREE SPACE POINTER TO TRACK AREA. ADVANCE BY CYLINDERS +DEFSYM QSWAPA==3 ;SWAPPING AREA. FIRST TRACK OF NON-SWAPPING AREA + ;NEW FILES WILL NOT BE WRITTEN LOWER THAN THIS. +DEFSYM QFRSTB==4 ;FIRST BLOCK TUT'ED +DEFSYM QLASTB==5 ;LAST BLOCK TUT'ED +DEFSYM QTRSRV==6 ;-1 IF ONLY ALLOCATED DIRS CAN HAVE FILES ON THIS PACK + ;IF NOT 0 AND NOT -1, SIXBIT NAME OF "SECONDARY" PACK + ;STG FOR RANDOM INFO ^ +DEFSYM LTIBLK==20 ;BYTES MAPPING THE DISK START HERE + +;UFD INFO +;IF A IS RELATIVE LOCATION OF MFD ENTRY, USER DIR IS LOCATED IN +;TRACK NUMBERED /2 (SEE QFL2) + +DEFSYM UFDBYT==6 ;SIZE OF BYTES (Do not change!) +DEFSYM UFDBPW==36./UFDBYT ;NUMBER OF BYTES PER WORD + + ;RANDOM INFO IN UFD +DEFSYM UDESCP==0 ;FS PNTR TO DESC AREA +DEFSYM UDNAMP==1 ;PNTR TO ORG OF NAME AREA +DEFSYM UDNAME==2 ;USER NAME (FOR CHECKING) +DEFSYM UDBLKS==3 ;LEFT HALF HAS AMOUNT OF SPACE ALLOCATED (NOT USED + ; CURRENTLY BY SYSTEM), RIGHT HALF HAS NUMBER OF BLOCKS USED. +DEFSYM UDALLO==4 ;IF NONZERO, LEFT HALF HAS DISK NUMBER, RIGHT + ; HALF HAS AMOUNT OF SPACE ALLOCATED +DEFSYM UDDESC==11. ;FIRST LOC AVAIL FOR DESC + + ;UFD DESCRIPTORS + ;0 => FREE 1-UDTKMX => TAKE NEXT N + ;UDTKMX+1 THRU UDWPH-1 => SKIP N-UDTKMX AND TAKE ONE + ;UDWPH => WRITE-PLACE-HOLDER + ;40 BIT SET => LOAD ADDRESS. LOWER 5 BITS PLUS NEXT NXLBYT (2) + ; CHARS (17 BITS IN ALL) + ;40 BIT & 20 BIT => "FUNNY" BLOCK IF DMDSK. WHAT IS THIS, ANYWAY? + ;END BY 0 + + ;IF LINK DESCR + ;6 CHAR OR UNTIL ; = SYS NAME. MUST HAVE NO CHAR = 0 IN THIS OR NEXT 2 NAMES + ;NEXT CHAR QUOTED BY : (FOR NAMES WITH : OR ;) + ;NEXT CHAR N1 + ;NEXT CHAR N2 + ;END BY 0 + +DEFSYM UDTKMX==12. ;HIGHEST "TAKE N" CODE +DEFSYM UDWPH==31. ;PLACE HOLDER ON WRITE (OR NULL FILE) +DEFSYM UDSKMX==UDWPH-UDTKMX-1 ;# BLOCKS THAT CAN BE SKIPPED +DEFSYM NXLBYT==2 ;# ADDITIONAL BYTES FOR LOAD ADDR + ;IN SYSTEM THIS IS DEFINED AT FRONT OF FILE + + ;NAME AREA DATA + +DEFSYM LUNBLK==5 ;WDS/NAME BLK +DEFSYM UNFN1==0 ;FIRST FN +DEFSYM UNFN2==1 ;SECOND FN +DEFSYM UNRNDM==2 ;ALL KINDS OF RANDOM INFO +DEFSYM UNDSCP==1500,, ;PNTR TO DESC +DEFSYM UNPKN==150500,, ;PACK # +DEFSYM UNLINK==1 ;LINK BIT +DEFSYM UNLNKB==220100,, +DEFSYM UNREAP==2 ;IF 1, DONT REAP FILE +DEFSYM UNWRIT==4 ;OPEN FOR WRITING +DEFSYM UNMARK==10 ;GC MARK BIT +DEFSYM UNCDEL==20 ;DEL WHEN CLOSED +DEFSYM DELBTS==20 ;DELETED -- IGNORE +DEFSYM UNIGFL==24 ;BITS TO IGNORE FILE +DEFSYM UNWRDC==301200,, ;WORD COUNT OF LAST BLOCK MOD 2000 +DEFSYM UNDUMP==400000 ;HAS BEEN DUMPED +DEFSYM UNDATE==3 ;DATE ETC. +DEFSYM UNTIM==2200,, ;COMPACTED TIME OF CREATION +DEFSYM UNYMD==222000,, ;Y,M,D OF CREATION +DEFSYM UNMON==270400,, ;MONTH +DEFSYM UNDAY==220500,, ;DAY +DEFSYM UNYRB==330700,, ;YEAR +DEFSYM UNREF==4 ;REFERENCE DATE SAME AS LEFT HALF OF UNDATE +DEFSYM UNREFD==222000,, ;REFERENCE DATE BYTE POINTER +DEFSYM UNAUTH==111100,, ;MFD INDEX OF AUTHOR, ALL 1=> NO DIRECTORY +DEFSYM UNBYTE==001100,, ;FILE BYTE SIZE AND LENGTH INFO. + ;LET S=BITS PER BYTE, C=COUNT OF UNUSED BYTES IN LAST WD + ;400+100xS+C S=1 TO 3 C=0 TO 35. + ;200+20xS+C S=4 TO 7 C=0 TO 8 + ;44+4xS+C S=8 TO 18. C=0 TO 3 + ;44-S S=19. TO 36. C=0 + ;NOTE THAT OLD FILES HAVE UNBYTE=0 => S=36. + +IF1 IFDEF NUDSL, IFG NUDSL*LMNBLK+LMIBLK-2000,.ERR MFD LOSES + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/fsdefs.43 b/system/fsdefs.43 new file mode 100644 index 0000000..a2b00e8 --- /dev/null +++ b/system/fsdefs.43 @@ -0,0 +1,232 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + +;FILE SYSTEM PARAMETERS - APPLIES TO ALL ITS MACHINES + +;9/5/79 - tut format changed! +;8/19/90 - DM "funny" bit flushed + +;MFD INFO + +IFDEF NBLKS,[ ;MFDBLK KNOWN ONLY IF .INSRT APPROPRIATE PHYSICAL PARAMS FILE +DEFSYM MFDBLK==NBLKS/2-1 ;LOC ON DISK +DEFSYM MFDCYL==MFDBLK/NBLKSC +DEFSYM MFDSRF==*SECBLK/NSECS +DEFSYM MFDSEC==*SECBLK-MFDSRF*NSECS +] + ;RANDOM INFO IN MFD +DEFSYM MDNUM==0 ;ASCENDING DIR NUM +DEFSYM MDNAMP==1 ;PNTR TO ORG OF USER NAME BLOCK AREA +DEFSYM MDYEAR==2 ;CURRENT YEAR +DEFSYM MPDOFF==3 ;DE-CORIOLIS CLOCK OFFSET +DEFSYM MPDWDK==4 ;PREFERRED WRITING DISK (PHYSICAL DRIVE #) +DEFSYM MDCHK==5 ;THIS WORD MUST BE M.F.D. (FOR CHECKING) +DEFSYM MDNUDS==6 ;NUMBER USER DIRECTORIES (FOR CHECKING ONLY) +DEFSYM LMIBLK==7 ;TOTAL STG USED BY HACKS LIKE THIS + ;USER NAME BLKS FROM C(MDNAMP) TO END +DEFSYM LMNBLK==2 ;# WDS/BLK +DEFSYM MNUNAM==0 ;6BIT USER NAME + ;SECOND WORD OF A USER-NAME BLOCK IS ZERO. + ;DECUUO CONTAINS A KLUDGE WHICH DEPENDS ON THIS, + ;PLEASE NOTIFY BUG-DECUUO BEFORE CHANGING IT. + +;TUT INFO + +IFDEF NBLKS,[ +DEFSYM TUTBLK==MFDBLK-NTUTBL ;LOC ON DISK +DEFSYM TUTCYL==TUTBLK/NBLKSC +DEFSYM TUTSRF==*SECBLK/NSECS +DEFSYM TUTSEC==*SECBLK-TUTSRF*NSECS +] +DEFSYM TUTBYT==3 ;SIZE OF BYTES (USED TO BE 4) +DEFSYM TUTBP==<440000+TUTBYT_6>,, +DEFSYM TUTEPW==36./TUTBYT ;NUMBER OF ENTRIES PER WORD +DEFSYM TUTMAX==1_TUTBYT +DEFSYM TUTLK==TUTMAX-1 ;HIGHEST CODE MEANS LOCKED OUT +DEFSYM TUTMNY==TUTLK-1 ;TUT MANY OR MORE REFS + +;RANDOM INFO IN TUT (AT THE FRONT) +DEFSYM QPKNUM==0 ;PACK # +DEFSYM QPAKID==1 ;PACK ID +DEFSYM QTUTP==2 ;FREE SPACE POINTER TO TRACK AREA. ADVANCE BY CYLINDERS +DEFSYM QSWAPA==3 ;SWAPPING AREA. FIRST TRACK OF NON-SWAPPING AREA + ;NEW FILES WILL NOT BE WRITTEN LOWER THAN THIS. +DEFSYM QFRSTB==4 ;FIRST BLOCK TUT'ED +DEFSYM QLASTB==5 ;LAST BLOCK TUT'ED +DEFSYM QTRSRV==6 ;-1 IF ONLY ALLOCATED DIRS CAN HAVE FILES ON THIS PACK + ;IF NOT 0 AND NOT -1, SIXBIT NAME OF "SECONDARY" PACK + ;STG FOR RANDOM INFO ^ +DEFSYM LTIBLK==20 ;BYTES MAPPING THE DISK START HERE + +;UFD INFO +;IF A IS RELATIVE LOCATION OF MFD ENTRY, USER DIR IS LOCATED IN +;TRACK NUMBERED /2 (SEE QFL2) + +DEFSYM UFDBYT==6 ;SIZE OF BYTES (Do not change!) +DEFSYM UFDBPW==36./UFDBYT ;NUMBER OF BYTES PER WORD + + ;RANDOM INFO IN UFD +DEFSYM UDESCP==0 ;FS PNTR TO DESC AREA +DEFSYM UDNAMP==1 ;PNTR TO ORG OF NAME AREA +DEFSYM UDNAME==2 ;USER NAME (FOR CHECKING) +DEFSYM UDBLKS==3 ;LEFT HALF HAS AMOUNT OF SPACE ALLOCATED (NOT USED + ; CURRENTLY BY SYSTEM), RIGHT HALF HAS NUMBER OF BLOCKS USED. +DEFSYM UDALLO==4 ;IF NONZERO, LEFT HALF HAS DISK NUMBER, RIGHT + ; HALF HAS AMOUNT OF SPACE ALLOCATED +DEFSYM UDDESC==11. ;FIRST LOC AVAIL FOR DESC + +; 8/19/90 Due to the larger size of RP07s it was necessary to officially +; flush the DM "funny" bit. This change only changes the comments in this +; file, but any program that interprets UFD descriptors needs to be fixed +; to not mask that bit out (as most of them currently do). Fortunately all +; the known ITS filesystems have zeros in all their "funny" bits, so the +; change is upward compatible. + +; UFD descriptor format described: +; +; Each 6-bit byte is taken in turn and used to compute a sequence of block +; numbers. If N is the current descriptor byte, and B is the current block +; number (initially undefined), then N is interpreted as follows: +; +; 0 Marks the end of the file description. +; +; 1 to UDTKMX (1 to 14) "Take" N blocks. +; Blocks B through B + N - 1 are the next N blocks of the file. +; Set B := B + N . +; +; UDTKMX+1 to UDWPH-1 (15 to 36) "Skip" B - UDTKMX blocks. +; Set N := N + B - UDTKMX . +; (ITS has been broken for years such that it never uses this +; UFD descriptor code!) +; +; UDWPH (37) Write Place Holder +; A noop. Used to reserve space in directories for files that are +; being written. Just skip over it and read the next byte. +; +; 40 - 77 Load address and take 1. +; Read the next NXLBYT descriptor bytes (NXLBYT=2), N2 and N3. +; Set B := LSH(AND(N, 37), 12.) + LSH(N2, 6) + N3 . +; Block B is the next block in the file. +; Set B := B + 1 . +; +; A zero length file is described as two bytes: UDWPH then 0. UDWPH does +; not otherwise normally appear in UFD descriptions for closed files. +; Note that a legal description must use codes 40 - 77 before it can use +; any code other than UDWPH. + +; Links are described as a sequence of SIXBIT characters terminated with a +; 0 byte. The directory, first and second name are stored in order. +; The first two components are terminated with a ";" if they are less than +; 6 characters long. ";" (73), ":" (72) and " " (0) are quoted by +; preceding them with a ":". Some examples: +; +; Link target names: Bytes stored in directory: +; +; 123456 123456 123456 "123456123456123456 " +; ALAN FOO BAR "ALAN;FOO;BAR " +; .MAIL. NAMES > ".MAIL.NAMES;> " +; .MAIL. LISTS MSGS ".MAIL.: LISTS: : MSGS " +; MOON LUNAR :EJ "MOON;LUNAR;::EJ " +; +; There are a lot of illegal or wasteful possibilities for link descriptors +; ("A;B ", "A;B;C;D ", ":A;:B;:C ", etc.), which is suprising since +; somebody was clearly trying to compress them into as few bytes as +; possible. + +; Here is the pre 8/19/90 comment describing UFD descriptors: +; +; ;UFD DESCRIPTORS +; ;0 => FREE 1-UDTKMX => TAKE NEXT N +; ;UDTKMX+1 THRU UDWPH-1 => SKIP N-UDTKMX AND TAKE ONE +; ;UDWPH => WRITE-PLACE-HOLDER +; ;40 BIT SET => LOAD ADDRESS. LOWER 5 BITS PLUS NEXT NXLBYT (2) +; ; CHARS (17 BITS IN ALL) +; ;40 BIT & 20 BIT => "FUNNY" BLOCK IF DMDSK. WHAT IS THIS, ANYWAY? +; ;END BY 0 +; +; ;IF LINK DESCR +; ;6 CHAR OR UNTIL ; = SYS NAME. MUST HAVE NO CHAR = 0 IN THIS OR +; ; NEXT 2 NAMES +; ;NEXT CHAR QUOTED BY : (FOR NAMES WITH : OR ;) +; ;NEXT CHAR N1 +; ;NEXT CHAR N2 +; ;END BY 0 + +DEFSYM UDTKMX==12. ;HIGHEST "TAKE N" CODE +DEFSYM UDWPH==31. ;PLACE HOLDER ON WRITE (OR NULL FILE) +DEFSYM UDSKMX==UDWPH-UDTKMX-1 ;# BLOCKS THAT CAN BE SKIPPED +DEFSYM NXLBYT==2 ;# ADDITIONAL BYTES FOR LOAD ADDR + ;IN SYSTEM THIS IS DEFINED AT FRONT OF FILE + + ;NAME AREA DATA + +DEFSYM LUNBLK==5 ;WDS/NAME BLK +DEFSYM UNFN1==0 ;FIRST FN +DEFSYM UNFN2==1 ;SECOND FN +DEFSYM UNRNDM==2 ;ALL KINDS OF RANDOM INFO +DEFSYM UNDSCP==1500,, ;PNTR TO DESC +DEFSYM UNPKN==150500,, ;PACK # +DEFSYM UNLINK==1 ;LINK BIT +DEFSYM UNLNKB==220100,, +DEFSYM UNREAP==2 ;IF 1, DONT REAP FILE +DEFSYM UNWRIT==4 ;OPEN FOR WRITING +DEFSYM UNMARK==10 ;GC MARK BIT +DEFSYM UNCDEL==20 ;DEL WHEN CLOSED +DEFSYM DELBTS==20 ;DELETED -- IGNORE +DEFSYM UNIGFL==24 ;BITS TO IGNORE FILE +DEFSYM UNWRDC==301200,, ;WORD COUNT OF LAST BLOCK MOD 2000 +DEFSYM UNDUMP==400000 ;HAS BEEN DUMPED +DEFSYM UNDATE==3 ;DATE ETC. +DEFSYM UNTIM==2200,, ;COMPACTED TIME OF CREATION +DEFSYM UNYMD==222000,, ;Y,M,D OF CREATION +DEFSYM UNMON==270400,, ;MONTH +DEFSYM UNDAY==220500,, ;DAY +DEFSYM UNYRB==330700,, ;YEAR +DEFSYM UNREF==4 ;REFERENCE DATE SAME AS LEFT HALF OF UNDATE +DEFSYM UNREFD==222000,, ;REFERENCE DATE BYTE POINTER +DEFSYM UNAUTH==111100,, ;MFD INDEX OF AUTHOR, ALL 1=> NO DIRECTORY +DEFSYM UNBYTE==001100,, ;FILE BYTE SIZE AND LENGTH INFO. + ;LET S=BITS PER BYTE, C=COUNT OF UNUSED BYTES IN LAST WD + ;400+100xS+C S=1 TO 3 C=0 TO 35. + ;200+20xS+C S=4 TO 7 C=0 TO 8 + ;44+4xS+C S=8 TO 18. C=0 TO 3 + ;44-S S=19. TO 36. C=0 + ;NOTE THAT OLD FILES HAVE UNBYTE=0 => S=36. + +IF1 IFDEF NUDSL, IFG NUDSL*LMNBLK+LMIBLK-2000,.ERR MFD LOSES + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/imp.361 b/system/imp.361 new file mode 100644 index 0000000..9b10ccc --- /dev/null +++ b/system/imp.361 @@ -0,0 +1,1678 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +IMPVRS==.IFNM2 ; Version of IMP code + +IFN NCPP,.FATAL IMP Code doesn't support NCP any more! +IFNDEF IMPDBG,IMPDBG==:0 ;Random bits of debugging code +IFN IMPDBG,PRINTX /IMP Debugging code included +/ + +IFN KAIMP,[ +$INSRT KAIMP +];KAIMP + +IFN KSIMP,[ +$INSRT LHDH +IMPLW==400000 ;Bit unused by hardware +];IFN KSIMP + +; IMP 1822 PROTOCOL INFORMATION (EXTENDED-LEADER VERSION) + +; The IMP leader is 96 bits long, usually organized as 3 words of 32 bits. +; For further details, these documents are available from the Network +; Information Center: +; IMP-HOST protocol: BBN Report No. 1822 +; NCP protocol: NIC 8246, Host-to-Host Protocol for the ARPANET +; IP, TCP: Internet Protocol Transition Workbook, and +; Internet Protocol Implementor's Guide +; +; Here is the leader format used by the IMP code. This format uses +; no IMP padding, assumes IP only, and expects all IMP<->HOST data +; transfers in 32-bit mode. +; +; Previous versions of this code which supported NCP used a much more +; complicated leader formatting scheme based on 36 bit transfers and +; IMP padding. That scheme is dead, see SYSTEM;IMPOLD WTHNCP for details. +; +; All data from the IMP interface ends up in the -10 as left-justified +; 32-bit words. Objects of less than 32 bits length, such as IP octets, +; are stored in PDP10 ILDB byte order. +; +;------------------------------------------------------------------------ +;1: 4.9-4.6 not used (0) +; 4.5-4.2 all 1's for new format, else old msg type (4=old nop) +; 4.1-3.3 network number (0) +; 3.2-2.8 not used (0) +; 2.7 trace (ignored) +; 2.6-2.4 leader flags (2.6 is to be ignored, 2.5-2.4 are not used!) +; 2.3-1.5 message type +; +;2: 4.9-4.2 Handling type (7 for big buffers, 4 for small buffers, +; 0 for the control link) +; 4.1-3.3 Host number on IMP +; 3.2-1.5 IMP number +; +;3: 4.9-4.2 Link Number (High 8 bits of Message ID) +; 4.1-3.7 Low 4 bits of Message ID (0) +; 3.6-3.3 Sub-type +; 3.2-1.5 Message length +;------------------------------------------------------------------------ +;4: 4.9-1.5 First word of IP datagram +; .... +;------------------------------------------------------------------------ +; +;In message types 2 and 6, the going-down status 16-bit word is +;in word 3 bits 4.9-3.3. + +;3.6-3.3 of word 3 are the padding count for type 4 (nop) from host. +;This is currently 0 (none). Padding is only put on type-0 messages. + +IMOTBP: 340400,,IMPILB+0 ;BYTE POINTER FOR MESSAGE FORMAT TYPE +IMTBP: 041000,,IMPILB+0 ;BYTE POINTER FOR MESSAGE TYPE FIELD +IMSABP: 043000,,IMPILB+1 ;BYTE POINTER FOR SOURCE ADDR FIELD (HOST+IMP) +IMSHBP: 241000,,IMPILB+1 ;BYTE POINTER FOR SOURCE HOST FIELD +IMSIBP: 042000,,IMPILB+1 ;BYTE POINTER FOR SOURCE IMP FIELD +IMLNBP: 341000,,IMPILB+2 ;BYTE POINTER FOR LINK NUMBER FIELD +IMSTBP: 240400,,IMPILB+2 ;BYTE POINTER FOR SUBTYPE FIELD +IMMLBP: 042000,,IMPILB+2 ;BYTE POINTER FOR MESSAGE LENGTH FIELD + + + +SUBTTL ARPANET VARIABLES AND TABLES + +EBLK + +IMPN:: ;IMP DATA AREA CLEARED WHEN IMPUP + +%IMXLN==:<<8159.-96.>+31.>/32. ; Max # of 32-bit words in IMP regular msg, + ; exclusive of leader and leader padding. = 252. +IMPIBS: 0 ; Saved initial BLKI pointer for IP datagram read +IMPIDP: 0 ; Pointer to IP datagram being input at PI level +IMPODP: 0 ; Pointer to IP datagram being output at PI level + +IFN KAIMP,[ +IMPI: 0 ;-1 => IMPCHN INPUT INTERRUPT OCCURRED +IMPO: 0 ;-1 => IMPCHN OUTPUT INTERRUPT OCCURRED +IMPB: 0 ;-1 => IMPCHN FLAG INTERRUPT OCCURRED +IMPIH: 0 ;-1 => INPUT WANTS PIA = IMPCHN +IMPOH: 0 ;-1 => OUTPUT WANTS PIA = IMPCHN +] +IFN KSIMP,[ +IMPIEC: 0 ;Count of input errors while down. +] +IMPIS: 0 ;INPUT STATE + %ISIDN==:-1 ; Network shut off + %ISIDL==:0 ; Normal - idle, not expecting input (i.e. between msgs) + %ISIGN==:1 ; Ignore input until end of current message (32 bit mode) + %ISIML==:2 ; Reading IMP initial leader (32 bit mode) + %ISIID==:3 ; Reading IP datagram (32 bit mode) + +IMPOS: 0 ;OUTPUT STATE + %ISODL==:0 ; Not expecting output done (i.e. between messages) + %ISONP==:1 ; Sending NOP + %ISOID==:2 ; Sending IP Datagram + %ISOIL==:3 ; Sending IMP leader + +; ACTIVE HOST TABLE. Entries herein are allocated as needed, using garbage +; collection. Most "host number" fields are really indices into this table. +; +LIMPHT== ; TCP conns plus a few extra +IMPHTN: BLOCK LIMPHT ; Host number. 1.1-1.8 HOST, 2.1-3.7 IMP +IMPHTB: BLOCK LIMPHT ;Bits: + ;4.9 UNUSED + ;4.8 GC MARK BIT + ;4.7-4.3 UNUSED + ;4.2-4.1 STATUS OF HOST 0 DOWN, 1 RST SENT, 2 UP + ;3.9-3.1 UNUSED + .SEE IMPHDS ;RH Last message from IMP about "host dead status" +IMPHTC: BLOCK LIMPHT ; # active messages outstanding for host (8 max) +IMPHTT: BLOCK LIMPHT ; Time of last RFNM received + +LIMPN==.-1 +;Last location BLT'ed to zero when initialized + +IMNBLK: 0 ;Number of times blockage avoided (output held up by ITS) +IMPHTF: -1 ;Host table free list, threaded through IMPHTB, end with -1 +IMPUP: -1 ;0 => IMP up ;-1 => down ;-2 => coming up, PI lvl still off + ;1 => down for good, until next time IMP ready line changes +IMPTCU: 0 ;0 IMP up/down status not changing + ;>0 Trying to reinitialize, SYSJOB hasn't done so yet + ;-1 Has been reinitialized, haven't exchanged NOPs yet +IMPUCT: 0 ;IMP coming up timeout, if 4 NOPs don't go through promptly. +IMPDWN: BLOCK 3 ;Last message from IMP that it is going down + ;WD0: "Reason" claimed by IMP (see ch 3 of BBN report 1822) + ;WD1: Time when expected down + ;WD2: Time when expected up (SYS time=1/30 sec since up) +IFN KAIMP,[ +IMPPIA: 0 ;Current IMP PIA +IMPCNI: 0 ;CONI into here at slow clock level +IMPA: 0 ;Save A at IMPCHN PI level +] + +IMERCN: -1 ;CONI into here when net goes down + +BBLK + + +EBLK + +IMPCSH: -1 ;Current source host (IMPHTB index). -1 when idle. +IMPCLN: 0 ;Current link number +IMNWSI: 0 ;Second BLKI pointer, zero if none +IMBLKI: 0 ;Place to store BLKI pointer + IFN KSIMP,[ +IMIFLS: 0 ;Flushing output at interrupt handler +IMPIBP: 0 ;Pointer to input buffer data + ] + +IMPILB: BLOCK 6 ;Input leader buffer + +IMNOPC: 0 ;< 0 => Send NOPs +IMPOAC: 0 ;> 0 => Output active, don't restart +IMBLKO: 0 ;Place to store BLKO pointer +IMPBZY: 0 ;Software interrupt start flag + +; IMP output list. +; +; NEGATIVE = BLKO POINTER +; 0=STOP, 1=SET LAST WORD +; 2=32-BIT MODE +; 3=NOP +; +IMOPNT: 0 ;Index of next "instruction" in IMP output list: +IMOLST: 0 ;BLKO for second and third leader words (first is DATAOed) +IMOBK1: 0 ;First BLKO pointer +IMOBK2: 0 ;Usually 1, set LAST IMP BIT +IMOBK3: 0 ;Second BLKO pointer + 0 ;Stop + +IMOLDR: BLOCK 6 ;Build preamble here for data messages + +;METERS + +;IP meters +IMNIPI: 0 ; # of IP datagrams input (rcvd) +IMNIPF: 0 ; # of IP datagrams flushed (input threw away) +IMNIPO: 0 ; # of IP datagrams output (sent) +IMNIPR: 0 ; # of IP RFNMs received +IMNIP7: 0 ; # of IP Type 7 (Dest Host Dead) messages received +IMNIP8: 0 ; # of IP Type 8 (Error) msgs rcvd +IMNIP9: 0 ; # of IP Type 9 (Incomplete Transmission) msgs rcvd +IMNWIG: 0 ; # words ignored by "Ignore" state (%ISIGN) +IMNWIF: 0 ; # words flushed by IMPRM5 + +;IMP meters +IMNSRF: 0 ;Number of spurious RFNMs on non-IP links + +IMPMSR: BLOCK 20;Count of IMP messages rcvd +IMPM1S: BLOCK 4 ; # Type 1 (Error in Leader) subtype msgs +IMPM9S: BLOCK 2 ; # Type 9 (Incomplete Transmission) subtype msgs +IMPMSS: BLOCK 1 ;Count of IMP msg sent (we only send regular msgs) +IMCT1: 0 ;# Times at IMPBKZ +IMCT2: 0 ;# Times at IMPIBZ +IMCT3: 0 ;# Times at IMPOBZ +BBLK + +SUBTTL ARPANET MAIN-PROGRAM LEVEL + +;(Re)Start IMP +; +IMPINI: +IFN KAIMP,[ + CONO IMP,IMI32S ;32-bit data mode + DATAI IMP,A ;Clear any cruft + CONO IMP,IMPODC ;Clear OUTPUT DONE and PIA + CONSZ IMP,IMPOD+7 ;Check OUTPUT DONE, PIA, cause HOST READY + BUG HALT,[IMP: Hardware dead] ;CONO didn't clear some bits? + CONO IMP,IMPIR+IMPHEC ;Clear HOST ERR, enable int on IMP READY +] +IFN KSIMP,[ +IF2,IFN IMPIBF&777,.FATAL IMPIBF not on DEC page boundary + MOVEI A,IMPIBF_-9. ;DEC page # of IMP buffer page + TRO A,%UQ16B\%UQVAL ;Valid mapping, 16 bit device + IOWRI A,UBAPAG+IUIMPG_1 ;Set up 1 DEC page of UBA mapping. Note that + ; the second half of IUIMPG isn't mapped at all + MOVEI A,%LHRST + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side +] + MOVE T,TIME + ADDI T,30. + CAMLE T,TIME + PUSHJ P,UFLS ;Wait one sec for IMP to notice rdy line drop +IFN KAIMP,[ + CONO IMP,0 ;Clear "ENA IMP RDY" int (turns off IMP error) + MOVEI A,NETCHN ;Set idle PIA + MOVEM A,IMPPIA + MOVE A,[JSR IMPIBK] ;Set up default interrupt handlers + MOVEM A,IMPILC + MOVE A,[JSR IMPOBK] + MOVEM A,IMPOLC +] +;IMP now shut down. Reset variables + +IFN KAIMP,[ + SETZM IMPILC+1 ;Clear BLKI, BLKO runout locations (KA\DM) + SETZM IMPOLC+1 +] +IFN KSIMP,[ + SETZM IMPIBP ;Reset DMA input buffer pointer + SETZM IMIFLS ;Not flushing output at PI handler +] + SETOM IMPOAC ;Output not active + SETOM IMPBZY ;Don't start interrupts by accident + SETOM IMPUP ;Not up yet + SETOM IMPTCU ;Note trying to come up + MOVNI A,30. ;Allow 15 seconds to come up + MOVEM A,IMPUCT + SETOM IMPHTF ;Will GC IMPHTB on first reference + MOVE A,[IMPN,,IMPN+1] ;This resets IMPIBS,IMPIDP,IMPODP,IMPI,IMPO, + SETZM IMPN ; IMPB,IMPIH,IMPOH,IMPI,IMPOS, and host + BLT A,LIMPN ; tables. + SETOM IMPIS ;Init input state FSM correctly + MOVE T,TIME ;Note when we last started IMP + MOVEM T,LNETIM +IFN KAIMP,[ + CONO IMP,NETCHN ;Enable interrupts on NETCHN, start input +] +IFN KSIMP,[ + CALL IMPHRS ;Set host ready + CALL IMPIST ;Start input +] + SETOM IMPDWN+1 ;Time for IMP to go down, not known + MOVE T,TIME + ADDI T,15. ;Wait 1/2 sec before we try to output + CAMLE T,TIME + PUSHJ P,UFLS + MOVNI A,4 + MOVEM A,IMNOPC ;Send 4 NOPs to start + ;Falls through to start output + +;Start IMP output, from process level +; +IMPOST: CONO PI,NETOFF ;Kill interrupts +IFN KAIMP,[ + MOVE TT,IMPPIA ;Get desired level for output done int + AOSN IMPOAC ;Skip if output already active + CONO IMP,IMPODS(TT) ;Generate output done int to start things + JRST NETONJ ;Reenable interrupt system + +];IFN KAIMP +IFN KSIMP,[ + SKIPL IMPOAC ;Skip if output already active + JRST NETONJ ;Yes, nothing to do + SETZM IMPBZY ;Tell interrupt handler to run + CONO PI,NETRQ ;Request interrupt on net channel + JRST NETONJ ;Reenable interrupt system +] + +;Start output, called from PI (NETCHN) level +; +IMPIOS: +IFN KAIMP,[ + AOSE IMPOAC ;Note output active. If already active, + POPJ P, ; nothing more to do + PUSH P,TT + CONO PI,400 ;Turn PI off, IMP may have PIA = 1 + MOVE TT,IMPPIA ;Get current PI level + CONO IMP,IMPODS(TT) ;Set OUTPUT DONE to cause interrupt + CONO PI,200 ;Reenable interrupts + POP P,TT + POPJ P, +] +IFN KSIMP,[ + SKIPL IMPOAC ;Output already active? + POPJ P, ;Yes, do nothing + SKIPE IMPOS ;Output state is idle? + BUG HALT,[IMP: Bad IMPOS state, ],DEC,IMPOS + SETZM IMPBZY ;Tell interrupt handler to run + CONO PI,NETRQ ;Request net interrupt + POPJ P, ;all done. +] + +;Check if IMP ready line is set +; Called from SYSJOB. +; Return +1 if IMP not ready, +2 if so +; +IMPCKR: +IFN KSIMP,[ + IORDI A,%LHICS ;Get input CSR + TRNN A,%LHINR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, ;That's all +] +IFN KAIMP,[ + CONSZ IMP,IMPR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, +] + + +SUBTTL HOST-TABLE MANAGEMENT + +; FNDHST - Look up host-table index for a given IMP host address. +; Call with NETOFF or NETCHN PI in progress. +; T/ IMP host address (maybe someday other nets?) +; Returns .+1 if failed (no room in table) +; Returns .+2 +; H/ host-table index +; Smashes W. + +FNDHST: MOVEI H,LIMPHT-1 ;Search for an entry for this host + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,POPJ1 ;Found + SKIPGE H,IMPHTF ;Not found, cons one off free list + JRST FNDHS1 ;Oops, must garbage collect + MOVE W,IMPHTB(H) + CAIGE H,LIMPHT ;Make sure H is valid idx + CAIL W,LIMPHT ;ditto W + BUG HALT,[NET: FNDHST idx clobbered!!!] + MOVEM W,IMPHTF + MOVEM T,IMPHTN(H) + SETZM IMPHTB(H) ;Nothing is known about this host + SETZM IMPHTC(H) ;Assume no RFNMs outstanding + SETZM IMPHTT(H) ;Clear out time of last RFNM. + JRST POPJ1 + +; Host-Table full, attempt to GC it and flush unused entries, by +; scanning all possible pointers into table. +; IMP pointers are IMPCSH and IMPHTC(H) +; TCP pointers are XBNADR(I) + +; GC mark phase - mark entries in use +FNDHS1: PUSH P,I + MOVSI W,200000 ;Mark bit + MOVEI H,LIMPHT-1 ;Clear all mark bits + ANDCAM W,IMPHTB(H) + SOJGE H,.-1 + SKIPL H,IMPCSH ;Mark from IMPCSH + IORM W,IMPHTB(H) +IFN TCPP,[ + MOVEI I,XBL-1 + SKIPL H,XBNADR(I) ; See if TCP conn has a net addr specified + IORM W,IMPHTB(H) ; Yes, set the mark bit. + SOJGE I,.-2 +] ;IFN TCPP + +; GC sweep phase - free all unmarked entries + SETO I, ;Free pointer + MOVEI H,LIMPHT-1 + MOVSI W,601000 ;Protect if RFNM-WAIT, RST-WAIT, or marked +FNDHS4: + SKIPG IMPHTC(H) ;Also protect if any outstanding RFNMs + TDNE W,IMPHTB(H) + SOJGE H,FNDHS4 + JUMPL H,FNDHS5 + SETZM IMPHTN(H) ;Don't belong to any host + MOVEM I,IMPHTB(H) ;Cons onto free list + MOVE I,H + SOJGE H,FNDHS4 +FNDHS5: MOVEM I,IMPHTF ;Free list + POP P,I + SKIPGE IMPHTF + POPJ P, ;GC-overflow + JRST FNDHST ;Try again, should win + +SUBTTL ARPANET INPUT INTERRUPT LEVEL + +COMMENT | +The KA/KL IMP interrupt level structure is fairly complicated and +deserves some explanation. Because the IMP interface is not a DMA +device, all I/O is done "by hand", a word at a time; for this reason +all I/O is done at PI level IMPCHN=1 (the highest) whenever possible. +However, to prevent general IMP processing from taking complete +precedence over everything else, all non-I/O handling is done at +PI level NETCHN=2, which is the same level as disk devices. + +Because the KA/KL interface only has one PI assignment available, +the software to switch levels is much more complicated. For either +case, the code will not make sense unless you understand the channel 1 +multiplexing feature (see interface CONI bit descriptions). + +The KS interface avoids all this cruft by being a DMA device and only +interrupting on NETCHN when it has finished a transfer. The first-level +KS interrupt handler dispatches to IMPBER on errors, IMPBKZ for "control" +interrupts (Last Imp Word seen) and IMPIBZ for other Input Done interrupts; +this is very similar to the DM interface. +| + +; Here when IMP interface is interrupting at PI level 2 (NETCHN) +; TT has CONI bits. Can clobber most ACs +; +IMPINT: +IFN KAIMP,[ + AOSN IMPB ;Requested by PI 1 control interrupt? + JRST IMPBKZ ; Yes + AOSN IMPI ;Requested by PI 1 Input Done interrupt? + JRST IMPIBZ ; Yes + AOSN IMPO ;Requested by PI 1 Output Done interrupt? + JRST IMPOBZ ; Yes already + TRNE TT,IMPLW+IMPHER+IMPERR ;No PI 1 ints, check status bits + JRST IMPBKZ ;PI 2 Control interrupt (error, Last Imp Word) + TRNE TT,IMPID + JRST IMPIBZ ;PI 2 Input Done + TRNE TT,IMPOD + JRST IMPOBZ ;PI 2 Output Done + BUG HALT,[IMP: Bogus interrupt] +] +IFN KSIMP,[ + SETOM IMPBZY ;Tell MP we are handling request + SKIPL IMPOAC ;Output already active? + JRST IMPEX ;Yes, do nothing + AOS IMPOAC ;Output is now active + JRST IMPOBZ ;No, go try to start output +] + +IFN KAIMP,[ +; IMPIBK - Default PI 1 Input Done routine, called from IMPILC. +; We're idling, switch to PI 2 to handle the input +; (normally 1st word of new IMP message) +EBLK +IMPIBK: 0 +BBLK + SETOM IMPI ;Set flag saying PI 1 Input Int seen + CONO IMP,NETCHN ;Switch PIA to 2 + JRST 12,@IMPIBK ;Go re-interrupt, will get to IMPINT->IMPIBK + +; IMPBRK - PI 1 Control interrupt, called from PI0LOC+2 (= 42 on KA's) +; which is the standard PI 1 vector location. +; Again, switch to PI 2 to handle the condition +; (typically Last Imp Word seen on input) +EBLK +IMPBRK: 0 ;This interrupt is to 42, may not be the IMP +BBLK + CONSO IMP,IMPLW+IMPHER+IMPERR ;This really from the IMP? +IFE NEWDTP,JRST RC1INT +IFN NEWDTP,JRST IMPBR1 + SETOM IMPB ;Yes, re-interrupt and handle at NETCHN level + CONO IMP,NETCHN ;Switch PIA to 2 (NETCHN) + JRST 12,@IMPBRK ;Go re-interrupt, will get to IMPINT->IMPBKZ + +IFN NEWDTP,[ +IMPBR1: CONSZ DTC,70 ;Allow for non-IMP interrupt on PI chan 1 + JRST 12,@IMPBRK +] + +RC1INT: MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@IMPBRK + +; IMPRM4 - PI 1 Input-Done handler during readin of IMP data (not leader) +; BLKI has run out but haven't yet gotten Last Imp Word! +; Either read more (if 2nd ptr specifed) or ignore following data. +EBLK +IMPRM4: 0 +BBLK + MOVEM A,IMPA ;Save A + SKIPL A,IMNWSI ;Second BLKI pointer exists? + JRST IMPRM6 ;Nope, none now + MOVEM A,IMBLKI ;Yes, store it! + SETZM IMNWSI ;Clear this flag so don't do it again + MOVE A,IMPA ;Restore A + JRST 12,@IMPRM4 ;Return, continuing BLKI. + +IMPRM6: MOVE A,[JSR IMPRM5] ;Ugh! Ignore additional input + MOVEM A,IMPILC ;Set up new vector to "ignore" routine + MOVE A,IMPA + JRST 12,@IMPRM4 + +; IMPRM5 - PI 1 Input-Done handler while ignoring IMP data, only +; set up by IMPRM6 above. +; Just reads a word and ignores it. This loop is broken +; by a control interrupt when Last-Imp-Word is seen. +EBLK +IMPRM5: 0 ;Hmm? Flush input at PI 1 +BBLK + DATAI IMP,IMPA + AOS IMNWIF ;See how often we come here. + JRST 12,@IMPRM5 +];IFN KAIMP + + +IFN KSIMP,[ +;First level interrupt handling for input side. Here from UBA vector hardware. +IMPIBK: +IFN NETCHN-UTCCHN,.ERR You lost at IMPIBK + + EBLK +IMPIBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + IORDI TT,%LHICS ;Get CS register + TRNE TT,%LHERR\%LHNXM + BUG HALT,[IMP: I NXM] + TRNE TT,%LHMRE ;Ready line flapped + JRST IMPIER ;Go directly to error routine + TRNN TT,%LHRDY ;Device ready for new operation? + BUG HALT,[IMP: Input device not ready] + TRNN TT,%LHEOM ;Saw EOM from IMP? + JRST IMPIB1 ;No, word count ran out before message + SKIPGE IMIFLS ;Flushing output? + JRST [ SETZM IMIFLS ;Not any more! + JRST IMPIRT ] ;But flush last piece by queueing new request + IORDI A,%LHIWC ;End of message. Get remaining UB word count + SKIPE A ;This would be a surprise, really + TDO A,[-1,,600000] ;36bit number of UBA words remaining in bfr + IDIVI A,2 ;Number of PDP10 words (cleverly rounded) + ADDI A,IMPBFS ;Number of PDP10 words of message + MOVNS A ;Negative word count + HRLZS A ;NWG,,0 + HRRI A,IMPIBF ;NWG,,Start of buffer + MOVEM A,IMPIBP ;Init input buffer pointer for new data + MOVE A,[-3,,IMPILB-1] ;Read leader - 3 words to IMPILB + CALL IMPGRI ;Do it + MOVEI A,%ISIML + SKIPN IMPIS ;Already in non-idle state? (shouldn't happen) + MOVEM A,IMPIS ;Was idling, set state to "Saw IMP LEADER" + TRNE TT,IMPLW ;Saw last word of message? + JRST IMPBKZ ;EOM, so this is a control interrupt + JRST IMPIBZ ;Not EOM, handle differently + +;Message didn't fit in input buffer. Shouldn't ever get here, but +;might if messages concatenated due to ready line randomness +; +IMPIB1: BUG INFO,[IMP: Huge message] + SETOM IMIFLS ;Say we are flushing output + JRST IMPIRT ;And go queue up another read + +;Fake output interrupt - come here when we have read more data from the +;input buffer and want to re-dispatch. +; +IMPIBL: TRNE TT,IMPLW ;Saw last word of message? + JRST IMPBKZ ;EOM, so this is a control interrupt + JRST IMPIBZ ;Not EOM, handle differently + +];IFN KSIMP + +; IMPIBZ - PI 2 (NETCHN) "Input Done", via IMPINT (KA) or IMPIBK (KS) +;KA\KL: Note there is one input word waiting in the IMP interface, +; but it is NOT the last IMP word (if it was, we would get a +; control interrupt and go to IMPBKZ instead). This situation +; should only happen while reading the IMP leader and there is +; more input than just the leader, i.e. it is a NCP or IP message. +; This is also where we come after being in idle state. +; +;KS: A bunch of stuff has been DMA'd into the input buffer and the +; DMA word count ran out before the IMP sent EOM. +; +; TT/ IMP CONI word or status register + +IMPIBZ: AOS IMCT2 +IFN KAIMP&IMPDBG,[ + TRNN TT,IMPI32 ;Debugging, make sure we reading in 32 bit mode + BUG HALT,[IMP: 36bit mode at IMPIBZ] +];IFN KAIMP&IMPDBG + MOVE B,IMPIS ;Skip hold-up check unless start of msg (idle) + CAILE B,%ISIID + BUG HALT,[IMP: Bad IMPIBZ state] ;Unknown input state + JRST @.+2(B) ;Dispatch, note data not read yet + + IMPIGN ;-1 Supposed to be shut off, go ignore message. + OFFSET -. + %ISIDL:: IMSTR1 ; 0 Was idle, this is start of a message! + %ISIGN:: IMPIGN ; 1 Ignoring this message. + %ISIML:: IMPLD2 ; 2 Reading IMP leader, see what we got. + %ISIID:: [JRST 4,.] ; 3 Was reading IP datagram! Runout is error. + OFFSET 0 + +IMPIGN: AOS IMNWIG ;See how often we come here. +IFN KAIMP,[ + DATAI IMP,A ;Ignore input (only come here via table above) + JRST IMPRET +] +IFN KSIMP,JRST IMPIRT + +; All routines dispatched to from IMPIBZ and IMPOBZ return via IMPRET. +IMPRET: +IFN KAIMP,[ + IFN IMPDBG,[ + CONSO IMP,IMPI32 ;Make sure input is in 32-bit mode + BUG HALT,[IMP: 36bit mode at IMPRET] + ] + CONO IMP,@IMPPIA ;Switch to desired exit PIA + JRST IMPEX +] +IFN KSIMP,JRST IMPEX + +; IMPBKZ - PI 2 (NETCHN) Control interrupt, via IMPINT (KA) or IMPIBK (KS) +; Error or Last Imp Word on input. +; TT/ IMP CONI word or status register + +IMPBKZ: AOS IMCT1 ;Bump count of control interrupts +IFN KAIMP,[ + TRNE TT,IMPERR+IMPHER ;See if error or last-imp-word. + JRST IMPBER ;Jump if IMP Error or Host Error +] +; Not an error, interface has Last Imp Word ready for DATAI'ing! +; Go handle end of IMP message +IFN KAIMP,[ + MOVE A,[JSR IMPIBK] ;Get rid of input BLKI + MOVEM A,IMPILC ;Replace with default switch-PIA vector + SETZM IMPIH ;Say don't need PI 1 for input any more. + MOVEI A,NETCHN ;And change exit PIA to 2 + SKIPL IMPOH ;Unless output side still needs PI 1. + MOVEM A,IMPPIA ;Set value of PI level desired on exit. + DATAI IMP,A ;Get the last input word for processing +] + SKIPGE B,IMPIS ; Unless network has been shut off + JRST IMPIGN ; (in which case ignore input) + JRST @IMSDT2(B) ; then go process end of IMP message. + +IMSDT2: OFFSET -. + %ISIDL:: IMPBKN ; 0 Was idle - leader only 1 word long?? + %ISIGN:: IMPIRT ; 1 Ignore input + %ISIML:: IMPLD1 ; 2 End of IMP leader - can't be regular msg + %ISIID:: IMPRMI ; 3 End of IP datagram + OFFSET 0 + + +IMPBKN: +IFN KSIMP,BUG HALT,[IMP: Bad state IMPBKN] +IFN KAIMP,[ +; Here from table above for old-type leader (1 word) +; IMPBN1 is used by IMPLD2 if long leader has wrong format. +; + MOVEM A,IMPILB ;Store first (and only) word of leader + ;Falls through +];IFN KAIMP +;Here from KA short leader or all long leader with wrong format +; +IMPBN1: LDB A,IMOTBP ; Get message format type + CAIN A,4 ; Old-type NOP? + JRST IMPIRT ; Just ignore it. + CAIN A,16 ; Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE A,17 ; Is it not the long-leader format? + BUG INFO,[IMP: Old-type leader],OCT,IMPILB + JRST IMPIRT ; Ignore rest of message, if any + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; IMP LEADER READING/DISPATCH ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Code on this page handles the initial processing of +;;; IMP messages and dispatches to the appropriate +;;; routines for each message type. Only Type 0 ("Regular") +;;; messages carry Host-Host traffic. + +IMSTR1: +IFN KAIMP,[ +; Here from IMPIBZ only, to handle first word of an IMP message. +; (It's not the last word or IMPBKZ would complain about it) +; Set up a BLKI to get the rest of the leader. + DATAI IMP,A ;Get 1st word from interface +; Entry point from IMPOB6 only to restart input from "held-up" state +; First word already in A +IMSTRT: MOVEM A,IMPILB ;Store first word of leader + MOVEI C,%ISIML ;Set new state = reading rest of IMP leader + MOVE B,[-2,,IMPILB] ;There are two more words in the leader + JRST IMPRM9 ;Go read the leader. +];IFN KAIMP +IFN KSIMP,BUG HALT,[IMP: Bad state IMSTR1] + +; Here from IMPBKZ only for a leader not followed by any data. +; KA/KL has last word in A +; IMPLW flag in TT. +; +IMPLD1: +IFN KAIMP,[ + AOS B,IMBLKI ;Update pointer to buffer + MOVEM A,(B) ;and store last word in right place. +] + JRST IMPLDD + ; Fall through to handle what should be an IMP-Host note. + ; The IMPLW flag distinguishes this entry point from IMPLD2, + ; so we know there isn't a data word in the interface. + +; Here from IMPIBZ only, for an IMP leader with more data following; +; almost certainly a "Regular" host-host message. +; +IMPLD2: +IFN KAIMP,[ +++++ ;Missing DATAI of current word first?? + AOS B,IMBLKI ;Update pointer to buffer + MOVEM A,(B) ;and store last word in right place. +] + JRST IMPLDD + ; Fall through to handle what should be a real message + ; The IMPLW flag distinguishes this entry point from IMPLD2, + ; so we know there is a data word in the interface. (KA) + + + SUBTTL IMP leader dispatch handling +IMPLDD: HRRZ B,IMBLKI ;Get address of last word read + CAIGE B,IMPILB+2 ;Must be at least 3 words to be valid + JRST IMPLD3 + LDB T,IMOTBP ;Examine new-format flag bits of leader + CAIN T,16 ;Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE T,17 ;Verify that leader is "new" 96-bit fmt. + JRST IMPBN1 ;Something else?? Go discard. + LDB T,IMLNBP ;Extract link number (high 8 bits of msg-id) + MOVEM T,IMPCLN ;Save link message arrived on + LDB T,IMSABP ;Get arpanet address (source host+imp) +IFN 0,[ + LDB T,IMSHBP ;Source host + LDB A,IMSIBP ;Source imp + DPB A,[112000,,T] ;Form host address +];IFN 0 + PUSHJ P,FNDHST ;H gets host table index + JRST IMPLD9 ;Host table full + MOVEM H,IMPCSH ;Save current host + LDB A,IMTBP ;Get message type in A + CAILE A,10. + JRST IMPUN ;Unknown type? + AOS IMPMSR(A) ;Count IMP msgs rcvd + JRST @IMTDT(A) ;Dispatch + +IMTDT: IMPRM ; 0 Regular Message + IMPBE1 ; 1 Error in Leader (no msg-id) + IMPGD ; 2 IMP Going Down + IMPUN ; 3 - + IMPIN ; 4 NOP + IMPRFN ; 5 RFNM - Ready For Next Message (transmit succeeded) + IMPHDS ; 6 Host Dead Status (general info) + IMPDHD ; 7 Destination Host Dead (transmit failed) + IMPBE8 ; 8 Error in Data (has msg-id) + IMPINC ; 9 Incomplete Transmission (transmit failed temporarily) + IMPIRS ;10 Interface Reset - IMP dropped its ready line + +IMPLD9: BUG INFO,[IMP: Message discarded due to host table full],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;Here from IMPLDD if leader is too short +; +IMPLD3: SUBI B,IMPILB-1 ;Number of words read + BUG INFO,[IMP: Short leader, ],DEC,B,[wds. WD1=],OCT,IMPILB,[WD2=],OCT,IMPILB+1 + JRST IMPIRT ;Flush rest of message + +;;; IMP->Host Type X (e.g. 3, 11-255) - bad type + +IMPUN: BUG INFO,[IMP: Unknown msg type ],OCT,A,[ leader ],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + + +;;; IMP->Host Type 1 - Error in leader (msg-id not given) +;;; IMP->Host Type 8 - Error in data (msg-id given) + +IMPBE1: LDB T,IMSTBP ;Get subtype (4 bits) + ANDI T,3 ;Only 2 bits should be used + AOS IMPM1S(T) ;Increment count of Type 1 subtype messages +IMPBE8: MOVE T,TIME + SUB T,LNETIM + CAIL T,60. ;Ignore error during initial synchronization + BUG INFO,[IMP: Type ],DEC,A,[err msg, leader],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + MOVE B,IMPCLN ;Get link msg came in on + CAIN B,233 ;Internet link? + AOS IMNIP8 ;Yes, count IP meter + CAIN A,8. ;Error identified with a particular message? + JSP T,IMPBLD ;Decrement count of active messages + JRST IMPIRT + +;;; IMP->Host Type 2 - IMP going down + +IMPGD: LDB B,[420200,,IMPILB+2] ;Reason (see 1822) + MOVEM B,IMPDWN + LDB B,[360400,,IMPILB+2] ;How soon going down * 5 mins + MOVE H,B + IMULI B,5*60.*30. ;Ticks in 5 mins + ADD B,TIME + MOVEM B,IMPDWN+1 + LDB C,[241200,,IMPILB+2] ;How long to be down * 5 minutes + MOVE Q,C + IMULI C,5*60.*30. ;Downtime in ticks + ADD C,B ;Add to time down + MOVEM C,IMPDWN+2 ;Store time when will be up + IMULI H,5 ;Minutes + IMULI Q,5 + BUG INFO,[IMP: Going down in ],DEC,H,[mins for ],DEC,Q,[mins, reason],DEC,IMPDWN + JRST IMPIRT + +;;; IMP->Host Type 4 - NOP + +IMPIN: JRST IMPIRT ;One more NOP from IMP + +;;; IMP->Host Type 5 - RFNM (Ready For Next Message) + +IMPRFN: JSP T,IMPBLD ; Decrement count of active IMP messages for this host + MOVE A,IMPCLN ;Get link # + CAIE A,233 ;IP link number? + JRST IMRFNX ;No, skip IP code +IFN INETP,.ERR INETP needs handling for RFNM on link 233 + AOS IMNIPR ;Bump count of IP RFNMs received + JRST IMPIRT ; and do nothing else about it, ugh. + +IMRFNX: BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN + AOS IMNSRF + JRST IMPIRT + + +;;; IMP->Host Type 6 - Host Down Status +; H/ host index + +IMPHDS: LDB A,[301400,,IMPILB+2];Bits 65-76 of leader, 4.9-3.7 3rd word + HRRM A,IMPHTB(H) ;Store, hope user read RFC 611 + JRST IMPIRT + +;;; IMP->Host Type 7 - Destination Host Dead + +IMPDHD: MOVEI E,%NCDED + JRST IMPHNR + +;;; IMP->Host Type 9 - Incomplete Transmission + +IMPINC: LDB T,IMSTBP ;Get subtype field (4 bit reason for failure) + AOS IMPM9S(T) ;Bump count of subtypes + MOVEI E,%NCINC ;This is an incomplete msg response + +IMPHNR: JSP T,IMPBLD ;Decrement active IMP msg count for this host + MOVE A,IMPCLN ;Link for this message? + CAIE A,233 ;IP Link? + JRST IMPHN1 + CAIN E,%NCINC ;Yes, count IP meters + AOS IMNIP9 + CAIN E,%NCDED + AOS IMNIP7 + JRST IMPIRT + +IMPHN1: BUG INFO,[IMP: DHD or IT msg rcvd on non-IP link] + JRST IMPIRT + +;;; IMP->Host Type 10 - Interface Reset + +IMPIRS: BUG INFO,[IMP: Interface-reset msg] + JRST IMPIRT ;Probably nothing useful to do about it. + + +; Here from all over, to flush rest of this message. +; All non-regular messages (not type 0) return here, as well as some +; errors with regular msgs. +; TT says whether there is any more data to read from this message. +IFN KAIMP,[ +IMPIRT: SETZM IMPIS ;Assume end of message, reset to normal state + TRNN TT,IMPLW ;But if we haven't yet read the last word, + AOSA IMPIS ;then change state to "Ignore" and flush input. + ;Note skip over following SETZM. + +; Regular messages (type 0) return here, when we already know this message +; was completely read. TT isn't valid. +IMPIR1: SETZM IMPIS ;Reset to normal idle state + SETOM IMPCSH ;Say no current host + CONO IMP,IMI32S ;Make sure in 32 bit data mode + JRST IMPRET +] +IFN KSIMP,[ +;We have already read the whole message from the IMP into the input buffer, +; so flushing excess input is no work at all. +IMPIRT: + +;Regular messages (type 0) return here, when we already know this message +;was completely read. TT isn't valid. +IMPIR1: SETZM IMPIS ;Set idle state + CALL IMPIST ;Start listening for new input + SETOM IMPCSH ;Say no current host + JRST IMPRET +];IFN KSIMP + + +;;; IMP->Host Type 0 - Regular Host-Host message +; Unless the source host screwed up and sent a dataless message, +; there is at least one word waiting to be read from the interface. +; For IP this is the 4th word and we are in 32-bit mode. +; TT/ IMP CONI bits or status register +; B/ addr of last wd input (counted-out BLKI pointer) + +IMPRM: TRNE TT,IMPLW + JRST IMPRM3 ;Foo, message shouldn't end so soon. Go barf. + MOVE A,IMPCLN ;Is link number the magic cookie for IP? + CAIE A,233 + JRST IMPIRT ;No, ignore it since we don't have NCP + +;This is an Internet Protocol datagram. Make sure we are +;in right mode for reading. +; + AOS IMNIPI ;Bump count of IP datagrams received +IFN KAIMP&IMPDBG,[ + TRNN TT,IMPI32 ;Should already be in 32-bit mode + BUG PAUSE,[IMP: Reading IP dgm in 36-bit mode] +] + MOVEI A,%IMXLN ;Specify max size of IMP message + ; (we can't trust msg-len leader field) + PUSHJ P,IPGIPT ;Call IP module - get input buffer pointer + JRST [ AOS IMNIPF ;Punted, bump cnt of datagrams lost + JRST IMPIRT] ;Flush this message (err msg already printed) + MOVEM A,IMPIDP ;Save datagram pointer + MOVEM B,IMPIBS ;Save input BLKI pointer for later check + MOVEI C,%ISIID ;Set state = reading IP datagram + ;JRST IMPRM9 ;Go do it. + +; Set up and start multiword data input. This place is jumped to by +; several things that initiate IMP input, specifically IMSTRT, IMPRMT, +; and IMPRM. +; B/ BLKI pointer +; C/ New input FSM state +; +IMPRM9: MOVEM C,IMPIS ;Save current input state + MOVEM B,IMBLKI ;Save BLKI pointer +IFN KSIMP,[ + MOVE A,B ;Set up BLKI pointer + CALL IMPGRI ;Get requested data from input buffer + JRST IMPIBL ;Jump back to handle new input data! +] +IFN KAIMP,[ + MOVE B,[BLKI IMP,IMBLKI] + MOVEM B,IMPILC + MOVE B,IMPBRO(C) ;Get BLKI runout instruction and set vector; + MOVEM B,IMPILC+1 ; will execute when ptr counts out. + SETOM IMPIH ;Say that input wants high pri + MOVEI B,IMPCHN ;And set our exit PIA to it (IMP) + MOVEM B,IMPPIA + JRST IMPRET ;Return from interrupt +];IFN KAIMP + +;Message with no data. Just ignore it, could print a note +IMPRM3: JRST IMPIRT + +IFN KAIMP,[ + ; This table holds the instruction to execute after the input + ; BLKI has counted out the ptr and stored the current input word. + ; Note that if the IMP message ends during the BLKI, a control + ; interrupt will happen instead and control goes to IMPBKZ + ; where there is another state dispatch table. + ; Normally only %ISIML and %ISINL actually use these instructions; + ; the other states are impossible or expect to read the entire + ; remaining message. +IMPBRO: OFFSET -. + %ISIDL:: JRST 4,IMPBRO ; 0 Idle - shouldn't be BLKI'ing. + %ISIGN:: JRST 4,IMPBRO+1 ; 1 Ignore - shouldn't be BLKI'ing. + %ISIML:: JSR IMPLD5 ; 2 Reading IMP leader (4 wds partial msg) + %ISIID:: JSR IMPRM4 ; 3 Reading IP datagram (get all) + OFFSET 0 + +EBLK ; PI 1 Input Done interrupt (from IMPILC+1, runout) +IMPLD5: 0 ; JSR here on BLKI runout after reading 3rd wd of IMP leader. +BBLK ; Input Done is not set, because BLKI just turned it off. + MOVEM A,IMPILC ;Save A + MOVE A,[JSR IMPLD6] ;Make very next input word interrupt to IMPLD6 + EXCH A,IMPILC ;Do it, restore A + JRST 12,@IMPLD5 + +EBLK ; PI 1 Input Done interrupt (from IMPILC) +IMPLD6: 0 ; JSR here with 4th wd of leader in interface. +BBLK ; Must decide whether to continue reading leader in + ; 36-bit mode (NCP) or 32-bit mode (IP). + MOVEM A,IMPILC ; Save A + MOVE A,IMPILB+1 ; Get word with link number in it + ANDI A,377 ; Mask off + CAIN A,233 ; Internet Protocol "link"? + JRST IMPLI3 ; Yes! Go handle it. + + ; NCP read will immediately store current 36-bit word (4th), + ; store another 36-bit word (5th), and then run out to IMPLD4. + MOVE A,[-2,,IMPILB+2] ; Reading NCP message. + MOVEM A,IMBLKI + MOVEI A,%ISINL ; Reading NCP leader, set state thereto. + MOVEM A,IMPIS + MOVE A,[JSR IMPLD4] ; And change dispatch vector. + MOVEM A,IMPILC+1 + MOVE A,[BLKI IMP,IMBLKI] + EXCH A,IMPILC ; Set up BLKI and restore A + JRST 12,@IMPLD6 ; Return. Note current input word is still waiting. + + ; IP read will immediately store current 36-bit word (4th), + ; then set up so next input-done interrupt (on 5th, 32-bit word) + ; goes directly to IMPIBZ->IMPLD2 with NETCHN PI. + ; (For AI-KA/ML-KA/MC-KL, perhaps by way of IMPIBK if output is active) +IMPLI3: MOVEI A,%ISIIL ; Say reading IP type leader. + MOVEM A,IMPIS + CONO IMP,IMI32S+IMPCHN ; Set further input to 32-bit mode + DATAI IMP,IMPILB+3 ; Store the 4th 36-bit word immediately; this + ; also starts interface reading the 5th word. + MOVE A,IMPLD6 ; Now must set up for next interrupt. + MOVEM A,IMPLD4 ; Fake out the common code below + JRST IMPLI4 ; Set up for next Input-Done interrupt + +EBLK ; PI 1 Input Done interrupt (from IMPILC+1, runout) +IMPLD4: 0 ; JSR here on BLKI runout after reading IMP leader +BBLK ; There is still one word to go, to be gotten at NETCHN level + + MOVEM A,IMPILC ; Save A + ; Drop through to common code + +IMPLI4: SETZM IMPIH ; Say input no longer needs PI 1 + MOVEI A,NETCHN ; Make PI 2 (NETCHN) the exit PIA, + SKIPL IMPOH ; unless output side needs PI 1. + MOVEM A,IMPPIA ; Set desired PIA channel on exit + CONO IMP,@IMPPIA ; Set PIA to whatever it was! + MOVE A,[JSR IMPIBK] ; Reset PI 1 Input-Done vector back to std. + EXCH A,IMPILC ; and restore A. + JRST 12,@IMPLD4 + +IMPBCM: BUG INFO,[NCP: CTL MSG BS NOT 8 OR CT>120. HST ],OCT,IMPHTN(H),[BS ],DEC,IMPCBS,[BC ],DEC,IMPCBC + JRST IMPIRT +];IFN KAIMP + +; IMPRMI - End of IP datagram, PI in progress on NETCHN, here from IMPBKZ +; A/ Last IMP word (32-bit) (KA/KL only) +; TT/ CONI bits as of interrupt +; +IMPRMI: AOS B,IMBLKI ;Get address to store last word in +IFN KAIMP,MOVEM A,(B) ;Store it away + SUB B,IMPIBS ;Get # words read into datagram buffer + MOVEI B,(B) + MOVE A,IMPIDP ;Get pointer to IP datagram buffer we're using + SETZ C, ;Say zero offset to IP header. + MOVE J,IMPCSH ;Set idx to host-table entry dgm received from. + PUSHJ P,IPRDGM ;Hand off rcvd datagram to IP + SETZM IMPIDP ;Clear PI level pointer + JRST IMPIR1 ;Return from PI level, setting up for next msg + +IFN KSIMP,[ +;Set HOST READY. From SYS job only, please, loops waiting. +; +IMPHRS: IORDI T,%LHICS + TRNN T,%LHRDY ;Can we mung? + BUG + IORI T,%LHHRC\%LHSE ;Turn on HR. SE prevents dropping messages + IOWRI T,%LHICS + MOVEI A,777777 ;I don't know why this takes so long. +IMPHR1: IORDI T,%LHICS ;Get the bits back + TRNE T,%LHHR ;LHDH thinks host ready is ready + RET ;HR line set + SOJG A,IMPHR1 ;Timed out yet? + BUG CHECK,[IMP: Timed out setting Host Ready] + RET + +;Start listening for new input from IMP +; +IMPIST: HRREI T,-IMPBFS*2 + IOWRI T,%LHIWC ;Read up to a buffer full of data + MOVEI T,+<4*> + IOWRI T,%LHICA ;Read data to here + MOVEI T,%LHIE\%LHHRC\%LHSE\%LHGO ;Interrupt, store data, go + IOWRI T,%LHICS ;Start read + RET + +;Move data from IMP DMA buffer to somewhere else, reformatting as we go. +; IMBLKI/ BLKI ptr -count,,dest-addr-1 +; Updates IMBLKI +; Bashes A,B,C,D,E +; Sets IMPLW in TT iff last word we read was last word available. + +IMPGRI: +IFN IMPDBG,[ + SKIPL IMPIBP ;Make sure we have something to give + BUG HALT,[IMP: IMPGRI called with no more data] +] + MOVE B,IMPIBP ;Get current count,,location in input bfr. +IMPGR1: MOVE C,(B) ;Get data word from message + LDB D,[.BP <377_26.>,C] ;Get Byte 2 + LDB E,[.BP <377_8.>,C] ;Get Byte 4 + LSH C,10. ;Shift so Byte 1 is correct + DPB D,[.BP <377_20.>,C] ;Put Byte 2 + LDB D,[.BP <377_10.>,C] ;Get Byte 3 + DPB E,[.BP <377_4.>,C] ;Put Byte 4 + DPB D,[.BP <377_12.>,C] ;Put Byte 3 + MOVEM C,1(A) ;Store word. It's a BLKI ptr, remember? + AOBJP B,IMPGR2 ;Incr source, exit if done + AOBJN A,IMPGR1 ;Incr dest, maybe loop for more + +;Here if ran out of desstination buffer space + TRZ TT,IMPLW ;Didn't see last word + MOVEM A,IMBLKI + MOVEM B,IMPIBP + RET + +;Here if ran out of source data +IMPGR2: IORI TT,IMPLW ;Say we read last word + AOBJN A,.+1 ;Adjust BLKI ptr for last word read + MOVEM A,IMBLKI ;Update IMBLKI for everyone else + MOVEM B,IMPIBP + RET +];IFN KSIMP + +;Here if error during IMP message transfer +; +IFN KAIMP,[ +IMPBER: SKIPGE IMPUP ;Skip if up, or thought to be broken + JRST IMPBE2 ;Already down, let it come up in peace + MOVSI J,SCLNET ;Thinks it's up, reset it + IORM J,SUPCOR ;By getting system job to run SYSNET + CONI IMP,IMERCN ;Record if imp error flip/flop set + SETOM IMPUP ;IMP is down + SETZM IMPTCU ;And not trying to come up +IFN INETP,.ERR IP/TCP code needs handling for IMP crashing. + +IMPBE2: SETZM IMPPIA ;No PI expected + CONO IMP,0 ;Clear IMP + BUG INFO,[IMP: Ready line flapped, resetting] + JRST IMPEX +];IFN KAIMP +IFN KSIMP,[ +;Input side saw ready line flap +IMPIER: SKIPE IMPUP ;Is the IMP supposed to be up? + JRST IMPIE1 ;No, handle differently + IORDI T,%LHICS ;Was up; get status + BUG INFO,[IMP: Input RDY error, Status ],OCT,T + JRST IMPRST ;And go request a full cycling of IMP + +IMPIE1: AOS T,IMPIEC + CAIG T,10. ;Huge number of errors whiile down? + JRST IMPIRT ;No, just ignore this input and start another + SETZM IMPIEC ;Reset + BUG INFO,[IMP: Excessive input errors while down] + JRST IMPIRT + +;Output side flapped +IMPOER: SKIPN IMPUP ;IMP up? + JRST IMPOE1 ;Running, request a full reset + MOVE T,IMPOS + CAIE T,%ISONP ;Were we sending a NOP? + BUG CHECK,[IMP: Confusing output error] + SOS IMNOPC ;Add another NOP to make up for this one + SETZM IMPOS + JRST IMPOB0 ;Go send it + +IMPOE1: IORDI T,%LHOCS + BUG INFO,[IMP: Output RDY error, Status ],OCT,T +;;; JRST IMPRST + +IMPRST: BUG INFO,[IMP: Ready line flapped, resetting] + MOVSI J,SCLNET ;Thinks it's up, reset it + IORM J,SUPCOR ;By getting system job to run SYSNET + IORDI T,%LHICS + HRLZM T,IMERCN + IORDI T,%LHOCS + HRRM T,IMERCN + SETOM IMPUP ;IMP is down + MOVEI T,1 + MOVEM T,IMPTCU ;But trying to come up (sysjob poked) +IFN INETP,.ERR IP/TCP code needs handling for IMP crashing. + JRST IMPEX + +];IFN KSIMP + +;;; IMP Blockage avoidance +; The current IMP software will not accept more than 8 active +; messages to a single host; attempting to send a 9th message will block +; ALL output to the interface, until the first message has been ack'd +; by means of one of the following message types: +; Type 5, RFNM - Message delivered OK +; Type 7, Host dead - transmit failed ("permanent") +; Type 8, Error in data - interface spazzed +; Type 9, Incomplete Transmission - temporary failure +; If for some reason the first message simply becomes lost, the IMP timeout +; (and blockage) can last for up to 30-45 seconds. +; More details in BBN Report 1822. +; ITS attempts to fix this by keeping a count of active un-ACKed +; messages for each host it is communicating with. A timeout is also +; associated with each host; if output to a given host is blocked by ITS +; because there are 8 active messages, trying to send a 9th message +; will check the last-RFNM-received time and if this was more than +; 30 or so seconds then the IMP is probably not giving us what it should +; and we should reset things for that host. + +%IMPMA==:8. ; # of maximum active IMP messages allowed + +; IMPBLI, IMPBLD - routines to hack active-message counts, called via JSP T, +; IMPBLD decrements count. +; IMPBLI increments count and skips if successful (else failed, +; and must NOT output another message to this host!) +; Also clobbers Q. +; +IMPBLI: AOS Q,IMPHTC(H) + CAIGE Q,%IMPMA ;Trying to send max or more messages? + JRST 1(T) ;No, can return safely. + CAIG Q,8. ;Is this the maximum # allowed? + JRST [ MOVE Q,TIME ;Yes, set up blockage timeout + ADDI Q,60.*30. ; for one minute. + MOVEM Q,IMPHTT(H) + JRST 1(T)] ;And allow this one to be sent + + ; Trying to send too many messages, block it (check for timeout though) + SOS IMPHTC(H) ;Restore original count + AOS IMNBLK ;Increment # of times softwarily blocked. + MOVE Q,IMPHTT(H) + CAML Q,TIME ;See if timeout still in the future + JRST (T) ;Yes, just take failure-return to block. + BUG INFO,[IMP: RFNM-wait timeout! Hst=],OCT,IMPHTN(H) + SETZM IMPHTC(H) ;This may be dangerous... oh well. + SETZM IMPHTT(H) + JRST (T) ;Block one last time, next try will win. + +;Decrement block count on reciept of any kind of ACK +; +IMPBLD: SOSL Q,IMPHTC(H) + JRST IMPBL2 + BUG INFO,[IMP: neg RFNM-wait cnt, Hst=],OCT,IMPHTN(H) + SETZB Q,IMPHTC(H) +IMPBL2: CAIL Q,8.-1 ;If we were blocking on this host, + CALL IMPIOS ;Ensure IMP output started up so blocked stuff + JRST (T) ; gets sent promptly. + + + +SUBTTL ARPANET OUTPUT INTERRUPT LEVEL + +IFN KAIMP,[ + +; See comments at IMPINT for a description of the overall IMP interrupt +; structure. Output is simpler than input, however. +; Each IMP message is output at PI level 1 except for the initial DATAO; +; the setup and takedown for each message is done at PI level 2. +; The code on this page is not referenced by anything outside the page +; except interrupt vector setup at IMPINI (to IMPOBK) and IMOB9 (to IMPCH1). + +; IMPCH1 - PI 1 Output-Done interrupt, from IMPOLC. +; Comes here when last word DATAO'd has been sent to IMP. +EBLK +IMPCH1: 0 +BBLK + MOVEM A,IMPOLC ;Save A + MOVE A,IMOPNT +IMCH1A: SKIPGE A,IMOLST(A) ;Get next "instruction" + JRST IMCH1B ;Jump if it's a BLKO pointer + CAILE A,3 ;Ensure valid operation + BUG HLT,[IMP: Bad command in output list.] + XCT IMCH1I(A) ;Do it + AOS A,IMOPNT ;Still here? Point to next operation + JRST IMCH1A ;and loop to do it. + +IMCH1I: JRST IMCH1C ;0 Stop - end of output list + CONO IMP,IMPLHW+IMPCHN ;1 Set Last Word + CONO IMP,IMO32S+IMPCHN ;2 Set 32-bit mode + JFCL ;3 NOP + +IMCH1B: MOVEM A,IMBLKO ;Set up BLKO - store the pointer + MOVE A,[JSR IMCH1D] ;Set dispatch for BLKO runout + MOVEM A,IMPOLC+1 + MOVE A,[BLKO IMP,IMBLKO] + EXCH A,IMPOLC ;Store the BLKO and restore A + AOS IMOPNT ;Increment output list ptr past this op. + JRST 12,@IMPCH1 ;Will interrupt immediately for first BLKO + ;word, since Output-Done wasn't cleared. + +; PI 1 Output-Done, from IMPOLC+1 (BLKO runout) +; Final word of the BLKO pointer is now in interface, being sent +; to IMP, and Output-Done flag is off. +EBLK +IMCH1D: 0 +BBLK + MOVEM A,IMPOLC + MOVE A,[JSR IMPCH1] ;Interrupt back when output of final word done + EXCH A,IMPOLC + JRST 12,@IMCH1D + +; Here from IMPCH1, PI 1 Output-Done interrupt +; Output list has hit "stop" operation (previous op had better be +; 1 to set Last-Host-Word!) +; This code reverts control back to PI level 2 (IMPOBK). +; +IMCH1C: SETZM IMPOH ;Say output side doesn't need PI 1 anymore + MOVEI A,NETCHN ;And set exit PIA to 2, + SKIPL IMPIH ;unless input side still needs PI 1 + MOVEM A,IMPPIA ;Set it. + CONO IMP,@IMPPIA + SETOM IMPO ;Tell IMPINT we have output-done interrupt. + MOVE A,[JSR IMPOBK] ;Point PI 1 channel at switch-PIA routine, + EXCH A,IMPOLC + JRST 12,@IMPCH1 + +; PI 1 Output Done interrupt, when we should really be interrupting +; at IMPINT on PI 2. +EBLK +IMPOBK: 0 +BBLK + SETOM IMPO ;Tell IMPINT what kind of interrupt + CONO IMP,NETCHN ;Reset PIA to 2 + JRST 12,@IMPOBK +];IFN KAIMP + +IFN KSIMP,[ +;First-level interrupt handling, from hardware dispatch. +IFN NETCHN-UTCCHN,.ERR Interrupt channel mismatch at IMPOBK + + EBLK +IMPOBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + IORDI TT,%LHOCS ;Get CS register + TRNE TT,%LHERR\%LHNXM ;Interface lost? + BUG HALT,[IMP: O NXM] + TRNE TT,%LHMRE ;Somebody bounce a ready line? + JRST IMPOER + TRNN TT,%LHRDY ;Device ready for new operation? + BUG HALT,[IMP: Output device not ready] + TRZ TT,%LHIE\%LHGO ;Is this right? + IOWRI TT,%LHOCS + AOS IMPOAC ;Output active. Reset when no more output + ;JRST IMPOBZ ;Falls through +];IFN KSIMP + +; IMPOBZ - PI 2 (NETCHN) "Output Done" interrupt, via IMPINT (or IMPOBK on KS) +; KA/KL, come here when we have finished sending stuff out at PI 1, +; also when something wants output to start and tickled the "Done" +; flag. +; TT/ IMP CONI word. +; +; KS, come here from output done interrupt if no errors, or when +; someone wants to start output. +; +IMPOBZ: AOS IMCT3 + SKIPL B,IMPOS + CAIL B,IMPODL + BUG HALT,[IMP: Bad output state] + JRST @IMPODT(B) + +IMPODT: OFFSET -. +%ISODL:: IMPOB0 ; 0 Idle, look for something to send +%ISONP:: IMPOB1 ; 1 Finished NOP +%ISOID:: IMPOB2 ; 2 Finished IP datagram messge +%ISOIL:: IMPOB3 ; 3 Finished IP leader (KS10 only) +IMPODL::OFFSET 0 + +;Return from all output finished interrupts +; KA interface, we don't turn off Output Done unless there is no more +; output to go. Thus if there is more output we will immediately +; re-interrupt to look for it. +; +; KS, we explicitly look here for more output to send +; +IMORET: SKIPE IMPOS + BUG HALT,[IMP: Bad state at output finish] +IFN KAIMP,[ + JRST IMPRET +] +IFN KSIMP,[ + SKIPGE IMPOAC ;Output still active? + JRST IMPRET ;Yes or no, don't look for more output + ;JRST IMPOB0 ;Fall through to try for more +];IFN KSIMP + +; Idle - Look for output to send. First ensure we can send stuff, +; then try things in the order: +; (1) Send NOP if net coming up +; (2) Check IP datagram queue +; +IMPOB0: HRRZ T,IMPUP + CAIE T,-2 ;Don't say it's up when it's still going down + CAIN T,1 ;or when it is broken + JRST IMPOBN + + ; First check to see if NOP needs to be sent. + AOSG IMNOPC ;Check to see if sending NOPs + JRST IMONOP ;Output a NOP + SETZM IMPUP ;Say IMP is up + SETZM IMPTCU ;Say no longer trying to come up + + ; Now see if there is any real traffic to send + + PUSHJ P,IPGIOQ ;Check IP. Get IP IMP output queue entry if any + JRST IMPOBN ;Nothing there, we're done. + ; Returns A/ ptr to IP dgm struct + ; B/ BLKO pointer to 32-bit words + ; C/ Arpanet address + ; + ;KA/KL interfaces build an output list which is interpreted + ;by code running at PI 1. The output list should be set up as: + ;IMOLST: -2,,IMOLDR ; Send 2nd and 3rd word of IMP leader + ;IMOBK1: Output BLKO ; Send datagram minus last word + ;IMOBK2: 1 ; Set last IMP bit + ;IMOBK3: -1,,lstwd-1 ; BLKO to last word of datagram + ; 0 ; Stop + ; + ;KS interface uses locations in IMOLST to store data for various + ;output routines, which are dispatched to at PI 2 by the state + ;machine at IMPOBZ. These locations are: + ;IMOLST: Unused + ;IMOBK1: Datagram BLKO + ;IMOBK2: Unused + ;IMOBK3: Unused +IMOB01: + MOVEM A,IMPODP ;Save ptr to datagram being output + AOS IMNIPO ;# of IP datagrams sent +IFN KAIMP,[ + MOVE D,[-2,,IMOLDR] ;IMP leader is always three words output + MOVEM D,IMOLST ; from IMOLST (first with DATAO) + ADD B,[1,,] ;Reduce BLKO count by one + MOVEM B,IMOBK1 ;Store in output list + HLRO D,B ;Get -<# wds-1> + MOVN D,D ;Get <#wds-1> + ADDI D,(B) ;Get addr for last-word BLKO + HRROM D,IMOBK3 ;Store -1,,lastwd-1 +] +IFN KSIMP,[ + MOVEM B,IMOBK1 ;Save BLKO pointer for IP datagram +] + ;Output list set up, now must put together the IMP leader in IMOLDR. + MOVE B,[17_10.,,0] ;Regular message + MOVEM B,IMOLDR + LSH C,4. ;Move net address to correct field + MOVEM C,IMOLDR+1 ;Set up second word + MOVSI B,233_10. ;IP link # in left 8 bits + MOVEM B,IMOLDR+2 ;Set up third word + + ;IMP leader set up, start output +IFN KAIMP,[ + CONO IMP,IMO32S ;Set 32 bit mode, clear PIA + DATAO IMP,IMOLDR ;Start it going! + MOVEI C,%ISOID ;State = outputting IP datagram. +] +IFN KSIMP,[ + MOVE A,[-3,,IMOLDR-1] ;IMP leader is three words output from IMOLDR + PUSHJ P,IMOST ;Go set up and start output + MOVEI C,%ISOIL ;Remember we are outputting IP leader +] +;Here after output of any kind started +; +IMOB9: MOVEM C,IMPOS ;Save current output state +IFN KAIMP,[ + SETZM IMOPNT ;Initialize output list pointer + SETOM IMPOH ;Output side wants IMP to run on channel 1 + MOVEI A,IMPCHN + MOVEM A,IMPPIA + MOVE C,[JSR IMPCH1] ;Set up handler for CH1 interrupts + MOVEM C,IMPOLC +] + JRST IMPRET + +;Couldn't find anything to output +IMPOBN: SETOM IMPOAC ;No more output +IFN KAIMP,[ + CONO IMP,IMPODC ;Clear Output-Done interrupt bit, so we won't +] ;immediately re-interrupt to start next output + JRST IMORET + + +;IMONOP - Send a NOP, here from IMPOBZ only. +; +IMONOP: +IFN KAIMP,[ + MOVEI A,IMPNOP ;Get address of NOP leader + MOVEI B,1 ;No text, but one extra wd (to make BLKO win) + CONO IMP,IMO32S ;Put IMP in 32-bit mode, Clear PIA + DATAO IMP,(A) ;Output first leader word + MOVEI C,(A) ;Set up BLKO pointer for 2nd word of NOP + HRLI C,-1 ;Including count + MOVEM C,IMOLST + AOS C ;Now a BLKO ptr for third word + MOVEM C,IMOBK2 ;Save it in output list + MOVEI C,1 ;Command to set last IMP bit + MOVEM C,IMOBK1 ;Set that in list + SETZM IMOBK3 ;End of output list + MOVEI C,%ISONP ;State for control return to NETCHN + JRST IMOB9 ;Falls through +];IFN KAIMP + +IFN KSIMP,[ + MOVE A,[-3,,IMPNOP-1] ;Get address of a BLKO word for NOP leader + PUSHJ P,IMOSTL ;Start output to IMP + MOVEI C,%ISONP ;State for control return to NETCHN + JRST IMOB9 ;Go finish up interrupt +] + +;Prefabricated NOP Host-IMP leader +IMPNOP: 17_10.,,4_4 ;New format, type 4 = NOP + 0 + 0 ;No padding required on regular messages + +;Finished sending NOP, from IMPOBZ +; +IMPOB1: SETZM IMPOS ;Reset state + JRST IMORET ;No, was a NOP. Done. + + +;Was sending IP datagram, from IMPOBZ +; +IMPOB2: SETZM IMPOS ;Reset output state + MOVE A,IMPODP + PUSHJ P,IPIODN ;Tell IP level that datagram was output + SETZM IMPODP + JRST IMORET ;Go see if there is anything else to do. + +IFN KSIMP,[ +;Was sending IP leader, from IMPOBZ. Start actual datagram output +; +IMPOB3: MOVE A,IMOBK1 ;Get BLKO word set up before + PUSHJ P,IMOSTL ;Go start output + MOVEI C,%ISOID ;Remember sending IP datagram + JRST IMOB9 ;Go clean up and dismiss +];IFN KSIMP + + +IFN KSIMP,[ +;Output startup routines for KS IMP. Call from NETCHN level or interrupts off. +; IMOST - start output +; IMOSTL - start output for last segment of message +; A/ BLKO word describing output. +; Bashes A,B,C,D,E,T,TT +; +IMOSTL: TLOA T,-1 ;Remember which entry point +IMOST: SETZ T, +IFN 0,[ + HLRE TT,A ;Get count + MOVN C,TT ;Make positive + CAILE C,IMPBFS ;Message fits in output buffer? + JRST IMOSTE + HRLZI B,1(A) ;Build BLT arg IO_buffer,,IMPOBF + HRRI B,IMPOBF + BLTBU B,IMPOBF-1(C) ;Move and reformat data +] +IFN 1,[ + AOS A ;Point to first data address + HLRE TT,A ;Get count + MOVN C,TT ;Make positive + CAILE C,IMPBFS ;Message fits in output buffer? + JRST IMOSTE + MOVNI B,-IMPOBF(A) ;B = + HRLI B,A ;B = (A) +IMOST1: MOVE C,(A) ;Get data word from message + LDB D,[341000,,C] ;Get Byte 1 + LDB E,[141000,,C] ;Get Byte 3 + LSH C,6. ;Shift so Byte 2 is correct + DPB D,[221000,,C] ;Put byte 1 + LDB D,[121000,,C] ;Get Byte 4 + DPB D,[101000,,C] ;Put Byte 4 + DPB E,[001000,,C] ;Put Byte 3 + MOVEM C,@B ;Store reformatted word in temp buffer + AOBJN A,IMOST1 ;Do more words if there are any +] + ASH TT,1 ;Convert PDP10 word count to unibus word count + IOWRI TT,%LHOWC ;Tell the IMP interface + MOVEI TT,+<4*> + IOWRI TT,%LHOCA ;Unibus address of output buffer + MOVEI TT,%LHIE\%LHGO ;IMP Interface interrupt enable, GO + SKIPE T ;This the last segment in the message? + IORI TT,%LHELB ;Yep, turn on EOM bit in interface + IOWRI TT,%LHOCS ;Start DMA transfer + POPJ P, ;And forget it. + +IMOSTE: BUG CHECK,[IMP output msg too big],DEC,C + POPJ P, ;Ignore overly large msg + +];IFN KSIMP + +SUBTTL ARPANET CLOCK LEVEL + +OVHMTR IMP ;NETWORK INTERRUPT LEVEL (NOT STYNET STUFF) + +IMRSTO: RET ;Nothing to do any more? + +;NETHST (HOST INFO) +; ARG 1 - HOST => VAL 1 - STATUS, VAL 2 - HOST NUMBER +; ARG 1 - -1 => VAL 1 - (STATUS), VAL 2 - OUR HOST NUMBER +;NOT CURRENTLY IMPLEMENTED- ARG 1 - -1, ARG 2 - OUR GOING-DOWN REASON +; +ANETHST:HRRE T,A ;Let immediate -1 win (777777 not a valid host) + AOJE T,ANETH2 ;Jump if want local status and host number + MOVE T,A + JSP J,STDHST ;Standardize and error-check host number + MOVE B,T ;Return new format + TLO B,(NW%ARP) + MOVEI H,LIMPHT-1 + CONO PI,NETOFF ;Do we have status for this host? + CAME T,IMPHTN(H) ;Scan table + SOJGE H,.-1 + JUMPGE H,ANETH1 ;Yes, return it + CONO PI,NETON ;No, have to go get it + MOVEM T,SRN3(U) + POPJ P, ;Oh, too bad + +;Here to return status of foreign ARPAnet host +ANETH1: MOVE A,IMPHTB(H) ;Get status + CONO PI,NETON + EXCH A,B + CALL CVH2NA ;Convert to HOSTS2 for compat + EXCH A,B + JRST LSWCJ1 ;Return IMSOC, NETLST if not done already + +;Here to return our status, host +ANETH2: +REPEAT 0,[ + CAIL W,2 ;(This is a crock) + MOVEM B,NTHDSW ;If 2 args, set our reason for going down. +] + SKIPE IMPUP ;Fake up our status + TDZA A,A ;We're down + MOVSI A,2000 ;We are up + MOVEI B,IMPUS ;And our host umber + JRST POPJ1 + + +;NETIMP (REASON,TIMEDOWN,TIMEUP) READ/SET +; +ANETIM: JUMPLE W,ANETM1 ;No args, return current data + CAIGE W,3 ;Must have 3 args if any + JRST OPNL30 + MOVEM A,IMPDWN ;Set data + MOVEM B,IMPDWN+1 + MOVEM C,IMPDWN+2 + JRST POPJ1 + +ANETM1: MOVE A,IMPDWN ;Get data to return + MOVE B,IMPDWN+1 + MOVE C,IMPDWN+2 + SKIPE IMPUP ;Note current condition of IMP, too + TLO A,400000 + JRST POPJ1 diff --git a/system/imp.363 b/system/imp.363 new file mode 100644 index 0000000..f66713b --- /dev/null +++ b/system/imp.363 @@ -0,0 +1,941 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +IMPVRS==.IFNM2 ; Version of IMP code + +IFN NCPP,.FATAL IMP Code doesn't support NCP any more! +IFE KSIMP,.FATAL Wrong IMP driver file included! + +$INSRT LHDH + +; IMP 1822 PROTOCOL INFORMATION (EXTENDED-LEADER VERSION) + +; The IMP leader is 96 bits long, usually organized as 3 words of 32 bits. +; For further details, these documents are available from the Network +; Information Center: +; IMP-HOST protocol: BBN Report No. 1822 +; NCP protocol: NIC 8246, Host-to-Host Protocol for the ARPANET +; IP, TCP: Internet Protocol Transition Workbook, and +; Internet Protocol Implementor's Guide +; +; Here is the leader format used by the IMP code. This format uses +; no IMP padding, assumes IP only, and expects all IMP<->HOST data +; transfers in 32-bit mode. +; +; Previous versions of this code which supported NCP used a much more +; complicated leader formatting scheme based on 36 bit transfers and +; IMP padding. That scheme is dead, see SYSTEM;IMPOLD WTHNCP for details. +; +; All data from the IMP interface ends up in the -10 as left-justified +; 32-bit words. Objects of less than 32 bits length, such as IP octets, +; are stored in PDP10 ILDB byte order. +; +;------------------------------------------------------------------------ +;1: 4.9-4.6 not used (0) +; 4.5-4.2 all 1's for new format, else old msg type (4=old nop) +; 4.1-3.3 network number (0) +; 3.2-2.8 not used (0) +; 2.7 trace (ignored) +; 2.6-2.4 leader flags (2.6 is to be ignored, 2.5-2.4 are not used!) +; 2.3-1.5 message type +; +;2: 4.9-4.2 Handling type (7 for big buffers, 4 for small buffers, +; 0 for the control link) +; 4.1-3.3 Host number on IMP +; 3.2-1.5 IMP number +; +;3: 4.9-4.2 Link Number (High 8 bits of Message ID) +; 4.1-3.7 Low 4 bits of Message ID (0) +; 3.6-3.3 Sub-type +; 3.2-1.5 Message length +;------------------------------------------------------------------------ +;4: 4.9-1.5 First word of IP datagram +; .... +;------------------------------------------------------------------------ +; +;In message types 2 and 6, the going-down status 16-bit word is +;in word 3 bits 4.9-3.3. + +;3.6-3.3 of word 3 are the padding count for type 4 (nop) from host. +;This is currently 0 (none). Padding is only put on type-0 messages. + +IMPLDS==3 ;IMP local leader size + + ;Byte pointers to fields of input leader +IMOTBP: 340400,,IMPILB+0 ;Message format type +IMTBP: 041000,,IMPILB+0 ;Message type field +IMSABP: 043000,,IMPILB+1 ;Source address field (host+IMP) +IMSHBP: 241000,,IMPILB+1 ;Source host field +IMSIBP: 042000,,IMPILB+1 ;Source IMP field +IMLNBP: 341000,,IMPILB+2 ;Link number field +IMSTBP: 240400,,IMPILB+2 ;Subtype field +IMMLBP: 042000,,IMPILB+2 ;Message length field + + + +SUBTTL ARPANET VARIABLES AND TABLES + +EBLK + +%IMXLN==:<<8159.-96.>+31.>/32. ; Max # of 32-bit words in IMP regular msg, + ; exclusive of leader and leader padding. = 252. + +; ACTIVE HOST TABLE. Entries herein are allocated as needed, using garbage +; collection. Most "host number" fields are really indices into this table. +; +LIMPHT== ; TCP conns plus a few extra + +IMPHTF: -1 ;Host table free list, threaded through IMPHTB, end with -1 + +IMPHTS: ;Start of table area +IMPHTN: BLOCK LIMPHT ; Host number. 1.1-1.8 HOST, 2.1-3.7 IMP +IMPHTB: BLOCK LIMPHT ;Bits: + ;4.9 UNUSED + ;4.8 GC MARK BIT + ;4.7-4.3 UNUSED + ;4.2-4.1 STATUS OF HOST 0 DOWN, 1 RST SENT, 2 UP + ;3.9-3.1 UNUSED + .SEE IMPHDS ;RH Last message from IMP about "host dead status" +IMPHTC: BLOCK LIMPHT ; # active messages outstanding for host (8 max) +IMPHTT: BLOCK LIMPHT ; Time of last RFNM received +IMPHTE==.-1 ;Last location in table + +;Status variables +; +IMPUP: -1 ;0 => IMP up ;-1 => down ;-2 => coming up, PI still off + ;1 => down for good, until next time IMP ready line changes +IMPTCU: 0 ;0 IMP up/down status not changing + ;>0 Trying to reinitialize, SYSJOB hasn't done so yet + ;-1 Has been reinitialized, haven't exchanged NOPs yet +IMPUCT: 0 ;IMP coming up timeout, if 4 NOPs don't go through promptly. +IMPDWN: BLOCK 3 ;Last message from IMP that it is going down + ;WD0: "Reason" claimed by IMP (see ch 3 of BBN report 1822) + ;WD1: Time when expected down + ;WD2: Time when expected up (SYS time=1/30 sec since up) + +IMERCN: -1 ;CONI into here when net goes down + +BBLK + +EBLK + +;Input side variables +; +IMPILB: BLOCK IMPLDS ;Input leader buffer +IMPCSH: -1 ;Current source host (IMPHTB index). -1 when idle. +IMPCLN: 0 ;Current link number +IMIFLS: 0 ;Flushing output at interrupt handler +IMPIEC: 0 ;Count of input errors while down. +IMPIBC: 0 ;Count of words available in DMA input buffer +IMPIBP: 0 ;Pointer into DMA input buffer + +;Output side variables +; + ;Output leader buffer +IMOLDR: <17_10.>,,0 ;Regular new-format message +IMOLAD: 0 ;Filled in with destination IMP address + <233_10.>,,0 ;IP link field + +IMNOPC: 0 ;< 0 => Send NOPs +IMPOAC: -1 ;>= 0 => Output active, don't restart +IMPBZY: 0 ;-1 == Waiting for output interrupt +IMPODP: 0 ;Pointer to IP datagram being output at PI level +IMPOS: 0 ;Output state + %ISODL==:0 ; Not expecting output done (i.e. between messages) + %ISONP==:1 ; Sending NOP + %ISOID==:2 ; Sending IP Datagram + +;Meters + +;IP meters +IMNIPI: 0 ; # of IP datagrams input (rcvd) +IMNIPF: 0 ; # of IP datagrams flushed (input threw away) +IMNIPO: 0 ; # of IP datagrams output (sent) +IMNIPR: 0 ; # of IP RFNMs received +IMNIP7: 0 ; # of IP Type 7 (Dest Host Dead) messages received +IMNIP8: 0 ; # of IP Type 8 (Error) msgs rcvd +IMNIP9: 0 ; # of IP Type 9 (Incomplete Transmission) msgs rcvd +IMNWIG: 0 ; # words ignored by "Ignore" state (%ISIGN) +IMNWIF: 0 ; # words flushed by IMPRM5 + +;IMP meters +IMNSRF: 0 ;Number of spurious RFNMs on non-IP links +IMNBLK: 0 ;Number of times blockage avoided (output held up by ITS) + +IMPMSR: BLOCK 20;Count of IMP messages rcvd +IMPM1S: BLOCK 4 ; # Type 1 (Error in Leader) subtype msgs +IMPM9S: BLOCK 2 ; # Type 9 (Incomplete Transmission) subtype msgs +IMPMSS: BLOCK 1 ;Count of IMP msg sent (we only send regular msgs) +IMCT1: 0 ;# Unvectored interrupts +IMCT2: 0 ;# Valid input interrupts +IMCT3: 0 ;# Valid output interrupts +BBLK + +SUBTTL ARPANET MAIN-PROGRAM LEVEL +;IMPIBF, IMPOBF defined as low-memory buffer page in ITS +IF2,IFN IMPIBF&777,.FATAL IMPIBF not on DEC page boundary + +;(Re)Start IMP. Called from SYSJOB to start IMP, or on error or +; user requested cycle through LOCK +; +IMPINI: SETOM IMPUP ;Not up yet, + SETOM IMPTCU ; but thinking about it. + MOVEI A,IMPIBF_-9. ;DEC page # of IMP buffer page + TRO A,%UQ16B\%UQVAL ;Valid mapping, 16 bit device + IOWRI A,UBAPAG+IUIMPG_1 ;Set up 1 DEC page of UBA mapping. Note that + ; the second half of IUIMPG isn't mapped at all + CONO PI,NETOFF ;Freeze things while IMP bashing occurs + MOVEI A,%LHRST + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + + ;IMP now shut down. Reset variables + SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPODP ;No output datagram + SETZM IMPOS ;Output idle + SETOM IMPOAC ;Output interrupt level inactive + SETZM IMPBZY ;No pending output interrupt + + SETZM IMPIBC ;No input available + SETZM IMPIEC ;No input errors yet + SETZM IMIFLS ;Not flushing input at interrupt level + SETOM IMPCSH ;No current host table index + SETOM IMPDWN+1 ;Time for IMP to go down, not known + CONO PI,NETON ;Allow interrupts again + + ;Wait one sec for IMP to notice rdy line drop + MOVE T,TIME + ADDI T,30. + CAMLE T,TIME + PUSHJ P,UFLS + + MOVNI A,30. ;Allow 15 seconds to come up + MOVEM A,IMPUCT + MOVE T,TIME ;Note when we last started IMP + MOVEM T,LNETIM + PUSHJ P,IMPHRS ;Set host ready + PUSHJ P,IMPIST ;Start input + + MOVE T,TIME + ADDI T,15. ;Wait 1/2 sec before we try to output + CAMLE T,TIME + PUSHJ P,UFLS + MOVNI A,4 + MOVEM A,IMNOPC ;Send 4 NOPs to start + ;Falls through to start output + +;Start IMP output +; +IMPOST: +IMPIOS: CONO PI,PIOFF ;Freeze. + AOSE IMPOAC ;Do nothing if output already active. + JRST PIONJ + SETOM IMPBZY ;Note we want an IMP interrupt + CONO PI,NETRQ ;Force nonvectored IMP interrupt + JRST PIONJ + +;Check if IMP ready line is set +; Called from SYSJOB. +; Return +1 if IMP not ready, +2 if so +; +IMPCKR: IORDI A,%LHICS ;Get input CSR + TRNN A,%LHINR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, ;That's all + +;Set HOST READY. From SYS job only, please, loops waiting. +; +IMPHRS: IORDI T,%LHICS + TRNN T,%LHRDY ;Can we mung? + BUG + IORI T,%LHHRC\%LHSE ;Turn on HR. SE prevents dropping messages + IOWRI T,%LHICS + MOVEI A,777777 ;I don't know why this takes so long. +IMPHR1: IORDI T,%LHICS ;Get the bits back + TRNE T,%LHHR ;LHDH thinks host ready is ready + RET ;HR line set + SOJG A,IMPHR1 ;Timed out yet? + BUG CHECK,[IMP: Timed out setting Host Ready] + RET + +SUBTTL HOST-TABLE MANAGEMENT + +;IMPHTI - Initialize host table +; Performed whenever IMP announces that it has been reset +; +IMPHTI: SETOM IMPHTF ;Force GC of IMPHTB on first reference + SETZM IMPHTS ;Clear table of old information + MOVE A,[IMPHTS,,IMPHTS+1] + BLT A,IMPHTE + POPJ P, + +; FNDHST - Look up host-table index for a given IMP host address. +; Call with NETOFF or NETCHN PI in progress. +; T/ IMP host address (maybe someday other nets?) +; Returns .+1 if failed (no room in table) +; Returns .+2 +; H/ host-table index +; Smashes W. + +FNDHST: MOVEI H,LIMPHT-1 ;Search for an entry for this host + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,POPJ1 ;Found + SKIPGE H,IMPHTF ;Not found, cons one off free list + JRST FNDHS1 ;Oops, must garbage collect + MOVE W,IMPHTB(H) + CAIGE H,LIMPHT ;Make sure H is valid idx + CAIL W,LIMPHT ;ditto W + BUG HALT,[NET: FNDHST idx clobbered!!!] + MOVEM W,IMPHTF + MOVEM T,IMPHTN(H) + SETZM IMPHTB(H) ;Nothing is known about this host + SETZM IMPHTC(H) ;Assume no RFNMs outstanding + SETZM IMPHTT(H) ;Clear out time of last RFNM. + JRST POPJ1 + +; Host-Table full, attempt to GC it and flush unused entries, by +; scanning all possible pointers into table. +; IMP pointers are IMPCSH and IMPHTC(H) +; TCP pointers are XBNADR(I) + +; GC mark phase - mark entries in use +FNDHS1: PUSH P,I + MOVSI W,200000 ;Mark bit + MOVEI H,LIMPHT-1 ;Clear all mark bits + ANDCAM W,IMPHTB(H) + SOJGE H,.-1 + SKIPL H,IMPCSH ;Mark from IMPCSH + IORM W,IMPHTB(H) +IFN TCPP,[ + MOVEI I,XBL-1 + SKIPL H,XBNADR(I) ; See if TCP conn has a net addr specified + IORM W,IMPHTB(H) ; Yes, set the mark bit. + SOJGE I,.-2 +] ;IFN TCPP + +; GC sweep phase - free all unmarked entries + SETO I, ;Free pointer + MOVEI H,LIMPHT-1 + MOVSI W,601000 ;Protect if RFNM-WAIT, RST-WAIT, or marked +FNDHS4: + SKIPG IMPHTC(H) ;Also protect if any outstanding RFNMs + TDNE W,IMPHTB(H) + SOJGE H,FNDHS4 + JUMPL H,FNDHS5 + SETZM IMPHTN(H) ;Don't belong to any host + MOVEM I,IMPHTB(H) ;Cons onto free list + MOVE I,H + SOJGE H,FNDHS4 +FNDHS5: MOVEM I,IMPHTF ;Free list + POP P,I + SKIPGE IMPHTF + POPJ P, ;GC-overflow + JRST FNDHST ;Try again, should win + +;See if IMP code is willing to handle a particular datagram right now. +; A/ IP DGM pointer +; C/ Immediate destination address +; Returns +1, can't send right now, +2, OK to send +; +IMPCTS: MOVE T,C ;Set up for FNDHST + AND T,[<377_16.>+377] ;Mask out all but host and IMP field + CALL FNDHST ;Get host index in H + POPJ P, ;No host entry, don't send + JSP T,IMPBLI ;See if OK to send + POPJ P, ;IMP wants to block, no send + JRST POPJ1 ;Skip return if OK to send. + + +;;; IMP Blockage avoidance +; The current IMP software will not accept more than 8 active +; messages to a single host; attempting to send a 9th message will block +; ALL output to the interface, until the first message has been ack'd +; by means of one of the following message types: +; Type 5, RFNM - Message delivered OK +; Type 7, Host dead - transmit failed ("permanent") +; Type 8, Error in data - interface spazzed +; Type 9, Incomplete Transmission - temporary failure +; If for some reason the first message simply becomes lost, the IMP timeout +; (and blockage) can last for up to 30-45 seconds. +; More details in BBN Report 1822. +; ITS attempts to fix this by keeping a count of active un-ACKed +; messages for each host it is communicating with. A timeout is also +; associated with each host; if output to a given host is blocked by ITS +; because there are 8 active messages, trying to send a 9th message +; will check the last-RFNM-received time and if this was more than +; 30 or so seconds then the IMP is probably not giving us what it should +; and we should reset things for that host. + +%IMPMA==:8. ; # of maximum active IMP messages allowed + +; IMPBLI, IMPBLD - routines to hack active-message counts, called via JSP T, +; IMPBLD decrements count. +; IMPBLI increments count and skips if successful (else failed, +; and must NOT output another message to this host!) +; Also clobbers Q. +; +IMPBLI: AOS Q,IMPHTC(H) + CAIGE Q,%IMPMA ;Trying to send max or more messages? + JRST 1(T) ;No, can return safely. + CAIG Q,%IMPMA ;Is this the maximum # allowed? + JRST [ MOVE Q,TIME ;Yes, set up blockage timeout + ADDI Q,60.*30. ; for one minute. + MOVEM Q,IMPHTT(H) + JRST 1(T)] ;And allow this one to be sent + + ; Trying to send too many messages, block it (check for timeout though) + SOS IMPHTC(H) ;Restore original count + AOS IMNBLK ;Increment # of times softwarily blocked. + MOVE Q,IMPHTT(H) + CAML Q,TIME ;See if timeout still in the future + JRST (T) ;Yes, just take failure-return to block. + BUG INFO,[IMP: RFNM-wait timeout! Hst=],OCT,IMPHTN(H) + SETZM IMPHTC(H) ;This may be dangerous... oh well. + SETZM IMPHTT(H) + JRST (T) ;Block one last time, next try will win. + +;Decrement block count on receipt of any kind of ACK +; +IMPBLD: SOSL Q,IMPHTC(H) + JRST IMPBL2 + BUG INFO,[IMP: negative RFNM-wait cnt, Hst=],OCT,IMPHTN(H) + SETZB Q,IMPHTC(H) +IMPBL2: CAIL Q,%IMPMA-1 ;If we were blocking on this host, + PUSHJ P,IMPIOS ;Ensure IMP output started up so blocked stuff + JRST (T) ; gets sent promptly. + + +SUBTTL ARPANET INPUT INTERRUPT LEVEL + +;First level interrupt handling for input side. Here from UBA vector hardware. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPIBK + + EBLK +IMPIBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT2 ;Count input interrupts + IORDI TT,%LHICS ;Get CS register + TRNE TT,%LHERR\%LHNXM + JRST IMPRST ;Try resetting the IMP + TRNE TT,%LHMRE ;Ready line flapped + JRST IMPIER ;Go directly to error routine + TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPRST ;Try resetting. + TRNN TT,%LHEOM ;Saw EOM from IMP? + JRST IMPIB1 ;No, word count ran out before message + SKIPGE IMIFLS ;Flushing output? + JRST [ SETZM IMIFLS ;Not any more! + JRST IMPIRT ] ;But flush last piece by queueing new request + IORDI A,%LHIWC ;End of message. Get remaining UB word count + SKIPE A ;This would be a surprise, really + TDO A,[-1,,600000] ;36bit number of UBA words remaining in bfr + IDIVI A,2 ;Number of PDP10 words (cleverly rounded) + ADDI A,IMPBFS ;Number of PDP10 words of message + MOVEM A,IMPIBC ;Set current count of available data words + MOVEI A,IMPIBF + MOVEM A,IMPIBP ;Set pointer to available data words + JRST IMPLDD ;Go process input message + +;Here when finished processing current message. +IMPIRT: SETOM IMPCSH ;Note no current host + PUSHJ P,IMPIST ;Restart input listener + JRST IMPEX + +;Message didn't fit in input buffer. Shouldn't ever get here, but +;might if messages concatenated due to ready line randomness +; +IMPIB1: BUG INFO,[IMP: Huge message] + SETOM IMIFLS ;Say we are flushing output + JRST IMPIRT ;And go queue up another read + +;Here if error during IMP message transfer +; Currently the only error handled is the IMP going non-ready + +IMPIER: SKIPE IMPUP ;Is the IMP supposed to be up? + JRST IMPIE1 ;No, handle errors differently + BUG INFO,[IMP: Input Ready Error] + JRST IMPRST ;Ready line flapped while up, cycle interface + +IMPIE1: AOS T,IMPIEC + CAIG T,10. ;Huge number of errors while down? + JRST IMPIRT ;No, just ignore this input and start another + SETZM IMPIEC ;Reset + BUG INFO,[IMP: Excessive input errors while down] + JRST IMPRST ;Cycle the interface + +IMPRST: IORDI T,%LHICS ;Record IMP status for sysjob + HRLZM T,IMERCN + IORDI T,%LHOCS + HRRM T,IMERCN + MOVEI A,%LHRST ;Avoid randomness by resetting HW now. + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + SETOM IMPUP ;IMP is down + MOVEI T,1 + MOVEM T,IMPTCU ;But trying to come up (sysjob poked) + MOVSI J,SCLNET ;Ask SYSJOB to cycle the IMP + IORM J,SUPCOR + JRST IMPEX + + SUBTTL IMP leader dispatch handling + +IMPLDD: SKIPG B,IMPIBC ;Get count of available data + POPJ P, ;None, nothing to do. + CAILE B,IMPLDS ;More than a leader worth? + MOVEI B,IMPLDS ;Yep, only want leader now + MOVS A,IMPIBP ;Copy and reformat leader to IMPILB + HRRI A,IMPILB + BLTUB A,IMPILB-1(B) + ADDM B,IMPIBP ;Increment buffer pointer, + MOVN C,B + ADDM C,IMPIBC ; and decrement count + + LDB T,IMOTBP ;Examine new-format flag bits of leader + CAIL B,IMPLDS ;Large enough to be a valid leader? + CAIE T,17 ;Verify that leader is "new" 96-bit fmt. + JRST IMPLDE ;Go process error in leader + + LDB T,IMLNBP ;Extract link number (high 8 bits of msg-id) + MOVEM T,IMPCLN ;Save link message arrived on + LDB T,IMSABP ;Get arpanet address (source host+imp) +IFN 0,[ + LDB T,IMSHBP ;Source host + LDB A,IMSIBP ;Source imp + DPB A,[112000,,T] ;Form host address +];IFN 0 + PUSHJ P,FNDHST ;H gets host table index + JRST IMPLHE ;Host table full + MOVEM H,IMPCSH ;Save current host + LDB A,IMTBP ;Get message type in A + CAIL A,IMTDTS + JRST IMPUN ;Unknown type? + AOS IMPMSR(A) ;Count IMP msgs rcvd + JRST @IMTDT(A) ;Dispatch + +IMTDT: IMPRM ; 0 Regular Message + IMPBE1 ; 1 Error in Leader (no msg-id) + IMPGD ; 2 IMP Going Down + IMPUN ; 3 - + IMPIN ; 4 NOP + IMPRFN ; 5 RFNM - Ready For Next Message (transmit succeeded) + IMPHDS ; 6 Host Dead Status (general info) + IMPDHD ; 7 Destination Host Dead (transmit failed) + IMPBE8 ; 8 Error in Data (has msg-id) + IMPINC ; 9 Incomplete Transmission (transmit failed temporarily) + IMPIRS ;10 Interface Reset - IMP dropped its ready line +IMTDTS==.-IMTDT + +IMPLHE: BUG INFO,[IMP: Message discarded due to host table full],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;Here if leader is too short or of wrong format. +; B/ Leader length +IMPLDE: SKIPE IMPUP ;If IMP is not up, we'll take anything. + JRST IMPIRT + CAIGE B,IMPLDS ;Announce short leader if so. + BUG INFO,[IMP: Short leader, ],DEC,B,[wds. WD1=],OCT,IMPILB,[WD2=],OCT,IMPILB+1 + LDB A,IMOTBP ;Get message format type + CAIN A,4 ;Old-type NOP? + JRST IMPIRT ; Just ignore it. +IFN 0,[ ;;For the moment this is a problem because the IMP is marked + ;;up too soon, before all incoming NOPS are received. + CAIN A,16 ;Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE A,17 ;Is it not the long-leader format? + BUG INFO,[IMP: Old-type leader],OCT,IMPILB +] + JRST IMPIRT ;Ignore rest of message, if any + +;;; IMP->Host Type X (e.g. 3, 11-255) - bad type + +IMPUN: BUG INFO,[IMP: Unknown msg type ],OCT,A,[ leader ],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;;; IMP->Host Type 1 - Error in leader (msg-id not given) +;;; IMP->Host Type 8 - Error in data (msg-id given) + +IMPBE1: LDB T,IMSTBP ;Get subtype (4 bits) + ANDI T,3 ;Only 2 bits should be used + AOS IMPM1S(T) ;Increment count of Type 1 subtype messages +IMPBE8: SKIPN IMPUP ;Ignore error during initial syncronization + BUG INFO,[IMP: Type ],DEC,A,[err msg, leader],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + MOVE B,IMPCLN ;Get link msg came in on + CAIN B,233 ;Internet link? + AOS IMNIP8 ;Yes, count IP meter + CAIN A,8. ;Error identified with a particular message? + JSP T,IMPBLD ;Decrement count of active messages + JRST IMPIRT + +;;; IMP->Host Type 2 - IMP going down + +IMPGD: LDB B,[420200,,IMPILB+2] ;Reason (see 1822) + MOVEM B,IMPDWN + LDB B,[360400,,IMPILB+2] ;How soon going down * 5 mins + MOVE H,B + IMULI B,5*60.*30. ;Ticks in 5 mins + ADD B,TIME + MOVEM B,IMPDWN+1 + LDB C,[241200,,IMPILB+2] ;How long to be down * 5 minutes + MOVE Q,C + IMULI C,5*60.*30. ;Downtime in ticks + ADD C,B ;Add to time down + MOVEM C,IMPDWN+2 ;Store time when will be up + IMULI H,5 ;Minutes + IMULI Q,5 + BUG INFO,[IMP: Going down in ],DEC,H,[mins for ],DEC,Q,[mins, reason],DEC,IMPDWN + JRST IMPIRT + +;;; IMP->Host Type 4 - NOP + +IMPIN: JRST IMPIRT ;One more NOP from IMP + +;;; IMP->Host Type 5 - RFNM (Ready For Next Message) + +IMPRFN: JSP T,IMPBLD ;Decrement outstanding message count for host + MOVE A,IMPCLN ;Get link # + CAIE A,233 ;IP link number? + JRST IMRFNX ;No, skip IP code + AOS IMNIPR ;Bump count of IP RFNMs received + JRST IMPIRT ; and do nothing else about it, ugh. + +IMRFNX: BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN + AOS IMNSRF + JRST IMPIRT + +;;; IMP->Host Type 6 - Host Down Status +; H/ host index + +IMPHDS: LDB A,[301400,,IMPILB+2];Bits 65-76 of leader, 4.9-3.7 3rd word + HRRM A,IMPHTB(H) ;Store, hope user read RFC 611 + JRST IMPIRT + +;;; IMP->Host Type 7 - Destination Host Dead + +IMPDHD: MOVEI E,%NCDED + JRST IMPHNR + +;;; IMP->Host Type 9 - Incomplete Transmission + +IMPINC: LDB T,IMSTBP ;Get subtype field (4 bit reason for failure) + AOS IMPM9S(T) ;Bump count of subtypes + MOVEI E,%NCINC ;This is an incomplete msg response + +IMPHNR: JSP T,IMPBLD ;Decrement active IMP msg count for this host + MOVE A,IMPCLN ;Link for this message? + CAIE A,233 ;IP Link? + JRST IMPHN1 + CAIN E,%NCINC ;Yes, count IP meters + AOS IMNIP9 + CAIN E,%NCDED + AOS IMNIP7 + JRST IMPIRT + +IMPHN1: BUG INFO,[IMP: DHD or IT msg rcvd on non-IP link] + JRST IMPIRT + +;;; IMP->Host Type 10 - Interface Reset + +IMPIRS: PUSHJ P,IMPHTI ;Initialize host table + BUG INFO,[IMP: Interface reset] + JRST IMPIRT + + +;;; IMP->Host Type 0 - Regular Host-Host message +; Unless the source host screwed up and sent a dataless message, +; there is at least one word waiting to be read in the buffer. +; +IMPRM: SKIPG A,IMPIBC ;Get available input word count + JRST IMPIRT ;None left, just ignore message + MOVE B,IMPCLN ;Is link number the magic cookie for IP? + CAIE B,233 + JRST IMPIRT ;No, ignore it + +;IP datagram. Copy into IP buffer and pass it up. +; + AOS IMNIPI ;Bump count of IP datagrams received + PUSHJ P,IPGIPT ;Ask IP for buffer of size (A) + JRST [ AOS IMNIPF ;Punted, bump cnt of datagrams lost + JRST IMPIRT ] ;Flush this message (err msg already printed) + MOVE B,PK.BUF(A) ;Destination + HRL B,IMPIBP ;Source + MOVE C,IMPIBC ;Input words available + ADDI C,-1(B) ;Last destination address + BLTUB B,(C) ;Copy and reformat data to IP buffer + MOVE B,IMPIBC ;Get word count back to B + SETZB C,IMPIBC ;Say zero offset to IP header, and clear count. + MOVE J,IMPCSH ;Set idx to host-table entry dgm received from. + PUSHJ P,IPRDGM ;Hand off rcvd datagram to IP + JRST IMPIRT ;Return from PI level, setting up for next msg + +;Start listening for new input from IMP +; +IMPIST: HRREI T,-IMPBFS*2 + IOWRI T,%LHIWC ;Read up to a buffer full of data + MOVEI T,+<4*> + IOWRI T,%LHICA ;Read data to here + MOVEI T,%LHIE\%LHHRC\%LHSE\%LHGO ;Interrupt, store data, go + IOWRI T,%LHICS ;Start read + RET + + +SUBTTL ARPANET OUTPUT INTERRUPT LEVEL + +;Here on unvectored interrupt caused by call to IMPIOS + +IMPINT: AOS IMCT1 ;Count unvectored interrupts + JRST IMPOBZ ;Go try to start output + ;Returns directly to interrupt dispatcher + +;First-level interrupt handling, from hardware dispatch. +; Crash on severe interface errors +; Restart IMP on ready line flappage. +; Else, go look for more output to send. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPOBK + + EBLK +IMPOBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT3 ;Count output interrupts + IORDI TT,%LHOCS ;Get CS register + TRNE TT,%LHERR\%LHNXM ;Interface lost? + JRST IMPOEC ;Try cycling + TRNE TT,%LHMRE ;Somebody bounce a ready line? + JRST IMPOER +IMPOBE: TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPOEC ;Try cycling + PUSHJ P,IMPOBZ ;No IMP error. Perform planned action. + JRST IMPEX ;Dismiss interrupt. + +;Error while outputting datagram. Currently, just means ready line flapped. +; If IMP was up, finish up IP output if necessary to free buffer, then +; cycle the interface. +; If trying to send NOPS to come up, just send a few more to resynch. +; +IMPOER: SKIPE IMPUP ;IMP up? + JRST IMPOE1 ;Not running normally, maybe OK. + BUG INFO,[IMP: Output RDY error] +IMPOEC: SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPOS ;Doing nothing useful + JRST IMPRST ;Go poke SYSJOB to cycle the IMP + +;Here if interface wasn't fully up. +IMPOE1: MOVE T,IMPOS + CAIE T,%ISONP ;Were we sending a NOP? + BUG CHECK,[IMP: Confusing output error] + SOS IMNOPC ;Add another NOP to make up for this one + SETZM IMPOS ;NOt doing anything anymore + JRST IMPOBE ;Go continue processing. + +;IMPOBZ - Toplevel output processing routing. +; Called from output done interrupt handler or from MP/CLOCK level with +; NETOFF to start output. + +IMPOBZ: SKIPL B,IMPOS + CAIL B,IMPODL + BUG HALT,[IMP: Bad output state] + JRST @IMPODT(B) + +IMPODT: OFFSET -. +%ISODL:: IMPOB0 ; 0 Idle, look for something to send +%ISONP:: IMPOB1 ; 1 Finished NOP +%ISOID:: IMPOB2 ; 2 Finished IP datagram messge +IMPODL::OFFSET 0 + +;Here when interrupt has finished processing a complete message. +; Attempt to find something else to do. +; +IMORET: + ;JRST IMPOB0 ;Fall through to try for more + +; Idle - Look for output to send. First ensure we can send stuff, +; then try things in the order: +; (1) Send NOP if net coming up +; (2) Check IP datagram queue +; +IMPOB0: HRRZ T,IMPUP ;Get current IMP state. + CAIE T,-2 ;Don't say it's up when it's still going down + CAIN T,1 ;or when it is broken + JRST IMPOBN + + ; First check to see if NOP needs to be sent. + AOSG IMNOPC ;Check to see if sending NOPs + JRST IMONOP ;Output a NOP + SETZM IMPUP ;Say IMP is up + SETZM IMPTCU ;Say no longer trying to come up + + ; Now see if there is any real traffic to send + PUSHJ P,IPGIOQ ;Check IP. Get IP IMP output queue entry if any + JRST IMPOBN ;Nothing there, we're done. + + ; Returns A/ ptr to IP dgm struct + ; B/ BLKO pointer to 32-bit words (unused) + ; C/ Arpanet address + ; + ;Build an IMP-format datagram at IMPOBF. + ; Set correct address in prototype leader. + ; BLT and reformat leader to IMPOBF. + ; BLT and reformat datagram to IMPOBF + leader size. + + MOVEM A,IMPODP ;Save ptr to datagram being output + AOS IMNIPO ;# of IP datagrams sent + + ;Put together the IMP leader in IMOLDR. +IFN 0,[ ;First and third word initialized at assembly time + MOVE B,[17_10.,,0] ;Regular message + MOVEM B,IMOLDR + MOVSI B,233_10. ;IP link # in left 8 bits + MOVEM B,IMOLDR+2 ;Set up third word +] + LSH C,4. ;Move net address to correct field + MOVEM C,IMOLAD ;set up second word of leader + + ;Copy leader and datagram to IMPOBF + MOVE B,[IMOLDR,,IMPOBF] + BLTBU B,IMPOBF+IMPLDS-1 ;Move IMP leader into place + MOVS B,PK.BUF(A) ;SOURCE,,COUNT + MOVEI A,IMPLDS(B) ;Size including leader to A + HRRI B,IMPOBF+IMPLDS ;Put d'gram immediately after leader. + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Go start hardware + MOVEI C,%ISOID ;Remember we are outputting IP leader + MOVEM C,IMPOS + POPJ P, + + + +;Here if nothing to output. +; Flag output inactive and disable interface +; +IMPOBN: SETOM IMPOAC ;No more output + IORDI TT,%LHOCS + TRZ TT,%LHIE\%LHGO ;Deactivate interface for a bit + IOWRI TT,%LHOCS + POPJ P, + +;IMONOP - Send a NOP, here from IMPOBZ only. +; +IMONOP: MOVEI A,IMPNOS ;Length of NOP message + MOVE B,[IMPNOP,,IMPOBF] ;BLT (and reformat) NOP to output buffer + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Start output of (A) words from IMPOBF to IMP + MOVEI C,%ISONP ;Set correct output FSM state + MOVEM C,IMPOS + POPJ P, + +;Prefabricated NOP Host-IMP leader +IMPNOP: 17_10.,,4_4 ;New format, type 4 = NOP + 0 + 0 ;No padding required on regular messages +IMPNOS==.-IMPNOP + +;Finished sending NOP, from IMPOBZ +; +IMPOB1: SETZM IMPOS ;Reset state + JRST IMORET ;Go look for something else to do. + +;Was sending IP datagram, from IMPOBZ +; +IMPOB2: SETZB A,IMPOS ;Reset output state. + EXCH A,IMPODP ;Get active datagram and reset pointer + PUSHJ P,IPIODN ;Tell IP level that datagram was output + JRST IMORET ;Go see if there is anything else to do. + +;Start output hardware. +; A/ Count of PDP10 words to write to net. +; Data to output in IMPOBF. +; Must be NETOFF or at NETCHN interrupt level. Bashes A only. + +IMPSOH: ASH A,1 ;Convert PDP10 word count to... + MOVNS A ; negative unibus word count. + IOWRI A,%LHOWC ;Tell the interface + MOVEI A,+<4*> + IOWRI A,%LHOCA ;Unibus address of output buffer + MOVEI A,%LHIE\%LHELB\%LHGO ;Enable interrupts, send EOM, GO + IOWRI A,%LHOCS ;Start DMA transfer + POPJ P, ;And forget it. + +SUBTTL ARPANET CLOCK LEVEL + +OVHMTR IMP ;NETWORK INTERRUPT LEVEL (NOT STYNET STUFF) + +IMRSTO: RET ;Nothing to do any more? + +;NETHST (HOST INFO) +; ARG 1 - HOST => VAL 1 - STATUS, VAL 2 - HOST NUMBER +; ARG 1 - -1 => VAL 1 - (STATUS), VAL 2 - OUR HOST NUMBER +;NOT CURRENTLY IMPLEMENTED- ARG 1 - -1, ARG 2 - OUR GOING-DOWN REASON +; +ANETHST:HRRE T,A ;Let immediate -1 win (777777 not a valid host) + AOJE T,ANETH2 ;Jump if want local status and host number + MOVE T,A + JSP J,STDHST ;Standardize and error-check host number + MOVE B,T ;Return new format + TLO B,(NW%ARP) + MOVEI H,LIMPHT-1 + CONO PI,NETOFF ;Do we have status for this host? + CAME T,IMPHTN(H) ;Scan table + SOJGE H,.-1 + JUMPGE H,ANETH1 ;Yes, return it + CONO PI,NETON ;No, have to go get it + MOVEM T,SRN3(U) + POPJ P, ;Oh, too bad + +;Here to return status of foreign ARPAnet host +ANETH1: MOVE A,IMPHTB(H) ;Get status + CONO PI,NETON + EXCH A,B + CALL CVH2NA ;Convert to HOSTS2 for compat + EXCH A,B + JRST LSWCJ1 ;Return IMSOC, NETLST if not done already + +;Here to return our status, host +ANETH2: +REPEAT 0,[ + CAIL W,2 ;(This is a crock) + MOVEM B,NTHDSW ;If 2 args, set our reason for going down. +] + SKIPE IMPUP ;Fake up our status + TDZA A,A ;We're down + MOVSI A,2000 ;We are up + MOVEI B,IMPUS ;And our host umber + JRST POPJ1 + + +;NETIMP (REASON,TIMEDOWN,TIMEUP) READ/SET +; +ANETIM: JUMPLE W,ANETM1 ;No args, return current data + CAIGE W,3 ;Must have 3 args if any + JRST OPNL30 + MOVEM A,IMPDWN ;Set data + MOVEM B,IMPDWN+1 + MOVEM C,IMPDWN+2 + JRST POPJ1 + +ANETM1: MOVE A,IMPDWN ;Get data to return + MOVE B,IMPDWN+1 + MOVE C,IMPDWN+2 + SKIPE IMPUP ;Note current condition of IMP, too + TLO A,400000 + JRST POPJ1 diff --git a/system/imp.364 b/system/imp.364 new file mode 100644 index 0000000..fad3912 --- /dev/null +++ b/system/imp.364 @@ -0,0 +1,946 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +IMPVRS==.IFNM2 ; Version of IMP code + +IFN NCPP,.FATAL IMP Code doesn't support NCP any more! +IFE KSIMP,.FATAL Wrong IMP driver file included! + +OVHMTR IMP ;Charge all this stuff to the IMP + +$INSRT LHDH + +; IMP 1822 PROTOCOL INFORMATION (EXTENDED-LEADER VERSION) + +; The IMP leader is 96 bits long, usually organized as 3 words of 32 bits. +; For further details, these documents are available from the Network +; Information Center: +; IMP-HOST protocol: BBN Report No. 1822 +; NCP protocol: NIC 8246, Host-to-Host Protocol for the ARPANET +; IP, TCP: Internet Protocol Transition Workbook, and +; Internet Protocol Implementor's Guide +; +; Here is the leader format used by the IMP code. This format uses +; no IMP padding, assumes IP only, and expects all IMP<->HOST data +; transfers in 32-bit mode. +; +; Previous versions of this code which supported NCP used a much more +; complicated leader formatting scheme based on 36 bit transfers and +; IMP padding. That scheme is dead, see SYSTEM;IMPOLD WTHNCP for details. +; +; All data from the IMP interface ends up in the -10 as left-justified +; 32-bit words. Objects of less than 32 bits length, such as IP octets, +; are stored in PDP10 ILDB byte order. +; +;------------------------------------------------------------------------ +;1: 4.9-4.6 not used (0) +; 4.5-4.2 all 1's for new format, else old msg type (4=old nop) +; 4.1-3.3 network number (0) +; 3.2-2.8 not used (0) +; 2.7 trace (ignored) +; 2.6-2.4 leader flags (2.6 is to be ignored, 2.5-2.4 are not used!) +; 2.3-1.5 message type +; +;2: 4.9-4.2 Handling type (7 for big buffers, 4 for small buffers, +; 0 for the control link) +; 4.1-3.3 Host number on IMP +; 3.2-1.5 IMP number +; +;3: 4.9-4.2 Link Number (High 8 bits of Message ID) +; 4.1-3.7 Low 4 bits of Message ID (0) +; 3.6-3.3 Sub-type +; 3.2-1.5 Message length +;------------------------------------------------------------------------ +;4: 4.9-1.5 First word of IP datagram +; .... +;------------------------------------------------------------------------ +; +;In message types 2 and 6, the going-down status 16-bit word is +;in word 3 bits 4.9-3.3. + +;3.6-3.3 of word 3 are the padding count for type 4 (nop) from host. +;This is currently 0 (none). Padding is only put on type-0 messages. + +IMPLDS==3 ;IMP local leader size + + ;Byte pointers to fields of input leader +IMOTBP: 340400,,IMPILB+0 ;Message format type +IMTBP: 041000,,IMPILB+0 ;Message type field +IMSABP: 043000,,IMPILB+1 ;Source address field (host+IMP) +IMSHBP: 241000,,IMPILB+1 ;Source host field +IMSIBP: 042000,,IMPILB+1 ;Source IMP field +IMLNBP: 341000,,IMPILB+2 ;Link number field +IMSTBP: 240400,,IMPILB+2 ;Subtype field +IMMLBP: 042000,,IMPILB+2 ;Message length field + + + +SUBTTL ARPANET VARIABLES AND TABLES + +EBLK + +%IMXLN==:<<8159.-96.>+31.>/32. ; Max # of 32-bit words in IMP regular msg, + ; exclusive of leader and leader padding. = 252. + +%IMMTU==:251.*4 ; Used by IP/TCP. Driver currently rounds to PDP10 words, + ; forcing this to be 1004 instead of 1007. + +; ACTIVE HOST TABLE. Entries herein are allocated as needed, using garbage +; collection. Most "host number" fields are really indices into this table. +; +LIMPHT== ; TCP conns plus a few extra + +IMPHTF: -1 ;Host table free list, threaded through IMPHTB, end with -1 + +IMPHTS: ;Start of table area +IMPHTN: BLOCK LIMPHT ; Host number. 1.1-1.8 HOST, 2.1-3.7 IMP +IMPHTB: BLOCK LIMPHT ;Bits: + ;4.9 UNUSED + ;4.8 GC MARK BIT + ;4.7-4.3 UNUSED + ;4.2-4.1 STATUS OF HOST 0 DOWN, 1 RST SENT, 2 UP + ;3.9-3.1 UNUSED + .SEE IMPHDS ;RH Last message from IMP about "host dead status" +IMPHTC: BLOCK LIMPHT ; # active messages outstanding for host (8 max) +IMPHTT: BLOCK LIMPHT ; Time of last RFNM received +IMPHTE==.-1 ;Last location in table + +;Status variables +; +IMPUP: -1 ;0 => IMP up ;-1 => down ;-2 => coming up, PI still off + ;1 => down for good, until next time IMP ready line changes +IMPTCU: 0 ;0 IMP up/down status not changing + ;>0 Trying to reinitialize, SYSJOB hasn't done so yet + ;-1 Has been reinitialized, haven't exchanged NOPs yet +IMPUCT: 0 ;IMP coming up timeout, if 4 NOPs don't go through promptly. +IMPDWN: BLOCK 3 ;Last message from IMP that it is going down + ;WD0: "Reason" claimed by IMP (see ch 3 of BBN report 1822) + ;WD1: Time when expected down + ;WD2: Time when expected up (SYS time=1/30 sec since up) + +IMERCN: -1 ;CONI into here when net goes down + +BBLK + +EBLK + +;Input side variables +; +IMPILB: BLOCK IMPLDS ;Input leader buffer +IMPCSH: -1 ;Current source host (IMPHTB index). -1 when idle. +IMPCLN: 0 ;Current link number +IMIFLS: 0 ;Flushing output at interrupt handler +IMPIEC: 0 ;Count of input errors while down. +IMPIBC: 0 ;Count of words available in DMA input buffer +IMPIBP: 0 ;Pointer into DMA input buffer + +;Output side variables +; + ;Output leader buffer +IMOLDR: <17_10.>,,0 ;Regular new-format message +IMOLAD: 0 ;Filled in with destination IMP address + <233_10.>,,0 ;IP link field + +IMNOPC: 0 ;< 0 => Send NOPs +IMPOAC: -1 ;>= 0 => Output active, don't restart +IMPBZY: 0 ;-1 == Waiting for output interrupt +IMPODP: 0 ;Pointer to IP datagram being output at PI level +IMPOS: 0 ;Output state + %ISODL==:0 ; Not expecting output done (i.e. between messages) + %ISONP==:1 ; Sending NOP + %ISOID==:2 ; Sending IP Datagram + +;Meters + +;IP meters +IMNIPI: 0 ; # of IP datagrams input (rcvd) +IMNIPF: 0 ; # of IP datagrams flushed (input threw away) +IMNIPO: 0 ; # of IP datagrams output (sent) +IMNIPR: 0 ; # of IP RFNMs received +IMNIP7: 0 ; # of IP Type 7 (Dest Host Dead) messages received +IMNIP8: 0 ; # of IP Type 8 (Error) msgs rcvd +IMNIP9: 0 ; # of IP Type 9 (Incomplete Transmission) msgs rcvd +IMNWIG: 0 ; # words ignored by "Ignore" state (%ISIGN) +IMNWIF: 0 ; # words flushed by IMPRM5 + +;IMP meters +IMNSRF: 0 ;Number of spurious RFNMs on non-IP links +IMNBLK: 0 ;Number of times blockage avoided (output held up by ITS) + +IMPMSR: BLOCK 20;Count of IMP messages rcvd +IMPM1S: BLOCK 4 ; # Type 1 (Error in Leader) subtype msgs +IMPM9S: BLOCK 2 ; # Type 9 (Incomplete Transmission) subtype msgs +IMPMSS: BLOCK 1 ;Count of IMP msg sent (we only send regular msgs) +IMCT1: 0 ;# Unvectored interrupts +IMCT2: 0 ;# Valid input interrupts +IMCT3: 0 ;# Valid output interrupts +BBLK + +SUBTTL ARPANET MAIN-PROGRAM LEVEL +;IMPIBF, IMPOBF defined as low-memory buffer page in ITS +IF2,IFN IMPIBF&777,.FATAL IMPIBF not on DEC page boundary + +;(Re)Start IMP. Called from SYSJOB to start IMP, or on error or +; user requested cycle through LOCK +; +IMPINI: SETOM IMPUP ;Not up yet, + SETOM IMPTCU ; but thinking about it. + MOVEI A,IMPIBF_-9. ;DEC page # of IMP buffer page + TRO A,%UQ16B\%UQVAL ;Valid mapping, 16 bit device + IOWRI A,UBAPAG+IUIMPG_1 ;Set up 1 DEC page of UBA mapping. Note that + ; the second half of IUIMPG isn't mapped at all + CONO PI,NETOFF ;Freeze things while IMP bashing occurs + MOVEI A,%LHRST + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + + ;IMP now shut down. Reset variables + SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPODP ;No output datagram + SETZM IMPOS ;Output idle + SETOM IMPOAC ;Output interrupt level inactive + SETZM IMPBZY ;No pending output interrupt + + SETZM IMPIBC ;No input available + SETZM IMPIEC ;No input errors yet + SETZM IMIFLS ;Not flushing input at interrupt level + SETOM IMPCSH ;No current host table index + SETOM IMPDWN+1 ;Time for IMP to go down, not known + CONO PI,NETON ;Allow interrupts again + + ;Wait one sec for IMP to notice rdy line drop + MOVE T,TIME + ADDI T,30. + CAMLE T,TIME + PUSHJ P,UFLS + + MOVNI A,30. ;Allow 15 seconds to come up + MOVEM A,IMPUCT + MOVE T,TIME ;Note when we last started IMP + MOVEM T,LNETIM + PUSHJ P,IMPHRS ;Set host ready + PUSHJ P,IMPIST ;Start input + + MOVE T,TIME + ADDI T,15. ;Wait 1/2 sec before we try to output + CAMLE T,TIME + PUSHJ P,UFLS + MOVNI A,4 + MOVEM A,IMNOPC ;Send 4 NOPs to start + ;Falls through to start output + +;Start IMP output +; +IMPOST: +IMPIOS: CONO PI,PIOFF ;Freeze. + AOSE IMPOAC ;Do nothing if output already active. + JRST PIONJ + SETOM IMPBZY ;Note we want an IMP interrupt + CONO PI,NETRQ ;Force nonvectored IMP interrupt + JRST PIONJ + +;Check if IMP ready line is set +; Called from SYSJOB. +; Return +1 if IMP not ready, +2 if so +; +IMPCKR: IORDI A,%LHICS ;Get input CSR + TRNN A,%LHINR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, ;That's all + +;Set HOST READY. From SYS job only, please, loops waiting. +; +IMPHRS: IORDI T,%LHICS + TRNN T,%LHRDY ;Can we mung? + BUG + IORI T,%LHHRC\%LHSE ;Turn on HR. SE prevents dropping messages + IOWRI T,%LHICS + MOVEI A,777777 ;I don't know why this takes so long. +IMPHR1: IORDI T,%LHICS ;Get the bits back + TRNE T,%LHHR ;LHDH thinks host ready is ready + RET ;HR line set + SOJG A,IMPHR1 ;Timed out yet? + BUG CHECK,[IMP: Timed out setting Host Ready] + RET + +SUBTTL HOST-TABLE MANAGEMENT + +;IMPHTI - Initialize host table +; Performed whenever IMP announces that it has been reset +; +IMPHTI: SETOM IMPHTF ;Force GC of IMPHTB on first reference + SETZM IMPHTS ;Clear table of old information + MOVE A,[IMPHTS,,IMPHTS+1] + BLT A,IMPHTE + POPJ P, + +; FNDHST - Look up host-table index for a given IMP host address. +; Call with NETOFF or NETCHN PI in progress. +; T/ IMP host address (maybe someday other nets?) +; Returns .+1 if failed (no room in table) +; Returns .+2 +; H/ host-table index +; Smashes W. + +FNDHST: MOVEI H,LIMPHT-1 ;Search for an entry for this host + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,POPJ1 ;Found + SKIPGE H,IMPHTF ;Not found, cons one off free list + JRST FNDHS1 ;Oops, must garbage collect + MOVE W,IMPHTB(H) + CAIGE H,LIMPHT ;Make sure H is valid idx + CAIL W,LIMPHT ;ditto W + BUG HALT,[NET: FNDHST idx clobbered!!!] + MOVEM W,IMPHTF + MOVEM T,IMPHTN(H) + SETZM IMPHTB(H) ;Nothing is known about this host + SETZM IMPHTC(H) ;Assume no RFNMs outstanding + SETZM IMPHTT(H) ;Clear out time of last RFNM. + JRST POPJ1 + +; Host-Table full, attempt to GC it and flush unused entries, by +; scanning all possible pointers into table. +; IMP pointers are IMPCSH and IMPHTC(H) +; TCP pointers are XBNADR(I) + +; GC mark phase - mark entries in use +FNDHS1: PUSH P,I + MOVSI W,200000 ;Mark bit + MOVEI H,LIMPHT-1 ;Clear all mark bits + ANDCAM W,IMPHTB(H) + SOJGE H,.-1 + SKIPL H,IMPCSH ;Mark from IMPCSH + IORM W,IMPHTB(H) +IFN TCPP,[ + MOVEI I,XBL-1 + SKIPL H,XBNADR(I) ; See if TCP conn has a net addr specified + IORM W,IMPHTB(H) ; Yes, set the mark bit. + SOJGE I,.-2 +] ;IFN TCPP + +; GC sweep phase - free all unmarked entries + SETO I, ;Free pointer + MOVEI H,LIMPHT-1 + MOVSI W,601000 ;Protect if RFNM-WAIT, RST-WAIT, or marked +FNDHS4: + SKIPG IMPHTC(H) ;Also protect if any outstanding RFNMs + TDNE W,IMPHTB(H) + SOJGE H,FNDHS4 + JUMPL H,FNDHS5 + SETZM IMPHTN(H) ;Don't belong to any host + MOVEM I,IMPHTB(H) ;Cons onto free list + MOVE I,H + SOJGE H,FNDHS4 +FNDHS5: MOVEM I,IMPHTF ;Free list + POP P,I + SKIPGE IMPHTF + POPJ P, ;GC-overflow + JRST FNDHST ;Try again, should win + +;See if IMP code is willing to handle a particular datagram right now. +; A/ IP DGM pointer +; C/ Immediate destination address +; Returns +1, can't send right now, +2, OK to send +; +IMPCTS: MOVE T,C ;Set up for FNDHST + AND T,[<377_16.>+377] ;Mask out all but host and IMP field + CALL FNDHST ;Get host index in H + POPJ P, ;No host entry, don't send + JSP T,IMPBLI ;See if OK to send + POPJ P, ;IMP wants to block, no send + JRST POPJ1 ;Skip return if OK to send. + + +;;; IMP Blockage avoidance +; The current IMP software will not accept more than 8 active +; messages to a single host; attempting to send a 9th message will block +; ALL output to the interface, until the first message has been ack'd +; by means of one of the following message types: +; Type 5, RFNM - Message delivered OK +; Type 7, Host dead - transmit failed ("permanent") +; Type 8, Error in data - interface spazzed +; Type 9, Incomplete Transmission - temporary failure +; If for some reason the first message simply becomes lost, the IMP timeout +; (and blockage) can last for up to 30-45 seconds. +; More details in BBN Report 1822. +; ITS attempts to fix this by keeping a count of active un-ACKed +; messages for each host it is communicating with. A timeout is also +; associated with each host; if output to a given host is blocked by ITS +; because there are 8 active messages, trying to send a 9th message +; will check the last-RFNM-received time and if this was more than +; 30 or so seconds then the IMP is probably not giving us what it should +; and we should reset things for that host. + +%IMPMA==:8. ; # of maximum active IMP messages allowed + +; IMPBLI, IMPBLD - routines to hack active-message counts, called via JSP T, +; IMPBLD decrements count. +; IMPBLI increments count and skips if successful (else failed, +; and must NOT output another message to this host!) +; Also clobbers Q. +; +IMPBLI: AOS Q,IMPHTC(H) + CAIGE Q,%IMPMA ;Trying to send max or more messages? + JRST 1(T) ;No, can return safely. + CAIG Q,%IMPMA ;Is this the maximum # allowed? + JRST [ MOVE Q,TIME ;Yes, set up blockage timeout + ADDI Q,60.*30. ; for one minute. + MOVEM Q,IMPHTT(H) + JRST 1(T)] ;And allow this one to be sent + + ; Trying to send too many messages, block it (check for timeout though) + SOS IMPHTC(H) ;Restore original count + AOS IMNBLK ;Increment # of times softwarily blocked. + MOVE Q,IMPHTT(H) + CAML Q,TIME ;See if timeout still in the future + JRST (T) ;Yes, just take failure-return to block. + BUG INFO,[IMP: RFNM-wait timeout! Hst=],OCT,IMPHTN(H) + SETZM IMPHTC(H) ;This may be dangerous... oh well. + SETZM IMPHTT(H) + JRST (T) ;Block one last time, next try will win. + +;Decrement block count on receipt of any kind of ACK +; +IMPBLD: SOSL Q,IMPHTC(H) + JRST IMPBL2 + BUG INFO,[IMP: negative RFNM-wait cnt, Hst=],OCT,IMPHTN(H) + SETZB Q,IMPHTC(H) +IMPBL2: CAIL Q,%IMPMA-1 ;If we were blocking on this host, + PUSHJ P,IMPIOS ;Ensure IMP output started up so blocked stuff + JRST (T) ; gets sent promptly. + + +SUBTTL ARPANET INPUT INTERRUPT LEVEL + +;First level interrupt handling for input side. Here from UBA vector hardware. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPIBK + + EBLK +IMPIBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT2 ;Count input interrupts + IORDI TT,%LHICS ;Get CS register + TRNE TT,%LHERR\%LHNXM + JRST IMPRST ;Try resetting the IMP + TRNE TT,%LHMRE ;Ready line flapped + JRST IMPIER ;Go directly to error routine + TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPRST ;Try resetting. + TRNN TT,%LHEOM ;Saw EOM from IMP? + JRST IMPIB1 ;No, word count ran out before message + SKIPGE IMIFLS ;Flushing output? + JRST [ SETZM IMIFLS ;Not any more! + JRST IMPIRT ] ;But flush last piece by queueing new request + IORDI A,%LHIWC ;End of message. Get remaining UB word count + SKIPE A ;This would be a surprise, really + TDO A,[-1,,600000] ;36bit number of UBA words remaining in bfr + IDIVI A,2 ;Number of PDP10 words (cleverly rounded) + ADDI A,IMPBFS ;Number of PDP10 words of message + MOVEM A,IMPIBC ;Set current count of available data words + MOVEI A,IMPIBF + MOVEM A,IMPIBP ;Set pointer to available data words + JRST IMPLDD ;Go process input message + +;Here when finished processing current message. +IMPIRT: SETOM IMPCSH ;Note no current host + PUSHJ P,IMPIST ;Restart input listener + JRST IMPEX + +;Message didn't fit in input buffer. Shouldn't ever get here, but +;might if messages concatenated due to ready line randomness +; +IMPIB1: BUG INFO,[IMP: Huge message] + SETOM IMIFLS ;Say we are flushing output + JRST IMPIRT ;And go queue up another read + +;Here if error during IMP message transfer +; Currently the only error handled is the IMP going non-ready + +IMPIER: SKIPE IMPUP ;Is the IMP supposed to be up? + JRST IMPIE1 ;No, handle errors differently + BUG INFO,[IMP: Input Ready Error] + JRST IMPRST ;Ready line flapped while up, cycle interface + +IMPIE1: AOS T,IMPIEC + CAIG T,10. ;Huge number of errors while down? + JRST IMPIRT ;No, just ignore this input and start another + SETZM IMPIEC ;Reset + BUG INFO,[IMP: Excessive input errors while down] + JRST IMPRST ;Cycle the interface + +IMPRST: IORDI T,%LHICS ;Record IMP status for sysjob + HRLZM T,IMERCN + IORDI T,%LHOCS + HRRM T,IMERCN + MOVEI A,%LHRST ;Avoid randomness by resetting HW now. + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + SETOM IMPUP ;IMP is down + MOVEI T,1 + MOVEM T,IMPTCU ;But trying to come up (sysjob poked) + MOVSI J,SCLNET ;Ask SYSJOB to cycle the IMP + IORM J,SUPCOR + JRST IMPEX + + SUBTTL IMP leader dispatch handling + +IMPLDD: SKIPG B,IMPIBC ;Get count of available data + POPJ P, ;None, nothing to do. + CAILE B,IMPLDS ;More than a leader worth? + MOVEI B,IMPLDS ;Yep, only want leader now + MOVS A,IMPIBP ;Copy and reformat leader to IMPILB + HRRI A,IMPILB + BLTUB A,IMPILB-1(B) + ADDM B,IMPIBP ;Increment buffer pointer, + MOVN C,B + ADDM C,IMPIBC ; and decrement count + + LDB T,IMOTBP ;Examine new-format flag bits of leader + CAIL B,IMPLDS ;Large enough to be a valid leader? + CAIE T,17 ;Verify that leader is "new" 96-bit fmt. + JRST IMPLDE ;Go process error in leader + + LDB T,IMLNBP ;Extract link number (high 8 bits of msg-id) + MOVEM T,IMPCLN ;Save link message arrived on + LDB T,IMSABP ;Get arpanet address (source host+imp) +IFN 0,[ + LDB T,IMSHBP ;Source host + LDB A,IMSIBP ;Source imp + DPB A,[112000,,T] ;Form host address +];IFN 0 + PUSHJ P,FNDHST ;H gets host table index + JRST IMPLHE ;Host table full + MOVEM H,IMPCSH ;Save current host + LDB A,IMTBP ;Get message type in A + CAIL A,IMTDTS + JRST IMPUN ;Unknown type? + AOS IMPMSR(A) ;Count IMP msgs rcvd + JRST @IMTDT(A) ;Dispatch + +IMTDT: IMPRM ; 0 Regular Message + IMPBE1 ; 1 Error in Leader (no msg-id) + IMPGD ; 2 IMP Going Down + IMPUN ; 3 - + IMPIN ; 4 NOP + IMPRFN ; 5 RFNM - Ready For Next Message (transmit succeeded) + IMPHDS ; 6 Host Dead Status (general info) + IMPDHD ; 7 Destination Host Dead (transmit failed) + IMPBE8 ; 8 Error in Data (has msg-id) + IMPINC ; 9 Incomplete Transmission (transmit failed temporarily) + IMPIRS ;10 Interface Reset - IMP dropped its ready line +IMTDTS==.-IMTDT + +IMPLHE: BUG INFO,[IMP: Message discarded due to host table full],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;Here if leader is too short or of wrong format. +; B/ Leader length +IMPLDE: SKIPE IMPUP ;If IMP is not up, we'll take anything. + JRST IMPIRT + CAIGE B,IMPLDS ;Announce short leader if so. + BUG INFO,[IMP: Short leader, ],DEC,B,[wds. WD1=],OCT,IMPILB,[WD2=],OCT,IMPILB+1 + LDB A,IMOTBP ;Get message format type + CAIN A,4 ;Old-type NOP? + JRST IMPIRT ; Just ignore it. +IFN 0,[ ;;For the moment this is a problem because the IMP is marked + ;;up too soon, before all incoming NOPS are received. + CAIN A,16 ;Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE A,17 ;Is it not the long-leader format? + BUG INFO,[IMP: Old-type leader],OCT,IMPILB +] + JRST IMPIRT ;Ignore rest of message, if any + +;;; IMP->Host Type X (e.g. 3, 11-255) - bad type + +IMPUN: BUG INFO,[IMP: Unknown msg type ],OCT,A,[ leader ],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;;; IMP->Host Type 1 - Error in leader (msg-id not given) +;;; IMP->Host Type 8 - Error in data (msg-id given) + +IMPBE1: LDB T,IMSTBP ;Get subtype (4 bits) + ANDI T,3 ;Only 2 bits should be used + AOS IMPM1S(T) ;Increment count of Type 1 subtype messages +IMPBE8: SKIPN IMPUP ;Ignore error during initial syncronization + BUG INFO,[IMP: Type ],DEC,A,[err msg, leader],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + MOVE B,IMPCLN ;Get link msg came in on + CAIN B,233 ;Internet link? + AOS IMNIP8 ;Yes, count IP meter + CAIN A,8. ;Error identified with a particular message? + JSP T,IMPBLD ;Decrement count of active messages + JRST IMPIRT + +;;; IMP->Host Type 2 - IMP going down + +IMPGD: LDB B,[420200,,IMPILB+2] ;Reason (see 1822) + MOVEM B,IMPDWN + LDB B,[360400,,IMPILB+2] ;How soon going down * 5 mins + MOVE H,B + IMULI B,5*60.*30. ;Ticks in 5 mins + ADD B,TIME + MOVEM B,IMPDWN+1 + LDB C,[241200,,IMPILB+2] ;How long to be down * 5 minutes + MOVE Q,C + IMULI C,5*60.*30. ;Downtime in ticks + ADD C,B ;Add to time down + MOVEM C,IMPDWN+2 ;Store time when will be up + IMULI H,5 ;Minutes + IMULI Q,5 + BUG INFO,[IMP: Going down in ],DEC,H,[mins for ],DEC,Q,[mins, reason],DEC,IMPDWN + JRST IMPIRT + +;;; IMP->Host Type 4 - NOP + +IMPIN: JRST IMPIRT ;One more NOP from IMP + +;;; IMP->Host Type 5 - RFNM (Ready For Next Message) + +IMPRFN: JSP T,IMPBLD ;Decrement outstanding message count for host + MOVE A,IMPCLN ;Get link # + CAIE A,233 ;IP link number? + JRST IMRFNX ;No, skip IP code + AOS IMNIPR ;Bump count of IP RFNMs received + JRST IMPIRT ; and do nothing else about it, ugh. + +IMRFNX: BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN + AOS IMNSRF + JRST IMPIRT + +;;; IMP->Host Type 6 - Host Down Status +; H/ host index + +IMPHDS: LDB A,[301400,,IMPILB+2];Bits 65-76 of leader, 4.9-3.7 3rd word + HRRM A,IMPHTB(H) ;Store, hope user read RFC 611 + JRST IMPIRT + +;;; IMP->Host Type 7 - Destination Host Dead + +IMPDHD: MOVEI E,%NCDED + JRST IMPHNR + +;;; IMP->Host Type 9 - Incomplete Transmission + +IMPINC: LDB T,IMSTBP ;Get subtype field (4 bit reason for failure) + AOS IMPM9S(T) ;Bump count of subtypes + MOVEI E,%NCINC ;This is an incomplete msg response + +IMPHNR: JSP T,IMPBLD ;Decrement active IMP msg count for this host + MOVE A,IMPCLN ;Link for this message? + CAIE A,233 ;IP Link? + JRST IMPHN1 + CAIN E,%NCINC ;Yes, count IP meters + AOS IMNIP9 + CAIN E,%NCDED + AOS IMNIP7 + JRST IMPIRT + +IMPHN1: BUG INFO,[IMP: DHD or IT msg rcvd on non-IP link] + JRST IMPIRT + +;;; IMP->Host Type 10 - Interface Reset + +IMPIRS: PUSHJ P,IMPHTI ;Initialize host table + BUG INFO,[IMP: Interface reset] + JRST IMPIRT + + +;;; IMP->Host Type 0 - Regular Host-Host message +; Unless the source host screwed up and sent a dataless message, +; there is at least one word waiting to be read in the buffer. +; +IMPRM: SKIPG A,IMPIBC ;Get available input word count + JRST IMPIRT ;None left, just ignore message + MOVE B,IMPCLN ;Is link number the magic cookie for IP? + CAIE B,233 + JRST IMPIRT ;No, ignore it + +;IP datagram. Copy into IP buffer and pass it up. +; + AOS IMNIPI ;Bump count of IP datagrams received + PUSHJ P,IPGIPT ;Ask IP for buffer of size (A) + JRST [ AOS IMNIPF ;Punted, bump cnt of datagrams lost + JRST IMPIRT ] ;Flush this message (err msg already printed) + MOVE B,PK.BUF(A) ;Destination + HRL B,IMPIBP ;Source + MOVE C,IMPIBC ;Input words available + ADDI C,-1(B) ;Last destination address + BLTUB B,(C) ;Copy and reformat data to IP buffer + MOVE B,IMPIBC ;Get word count back to B + SETZB C,IMPIBC ;Say zero offset to IP header, and clear count. + MOVE J,IMPCSH ;Set idx to host-table entry dgm received from. + PUSHJ P,IPRDGM ;Hand off rcvd datagram to IP + JRST IMPIRT ;Return from PI level, setting up for next msg + +;Start listening for new input from IMP +; +IMPIST: HRREI T,-IMPBFS*2 + IOWRI T,%LHIWC ;Read up to a buffer full of data + MOVEI T,+<4*> + IOWRI T,%LHICA ;Read data to here + MOVEI T,%LHIE\%LHHRC\%LHSE\%LHGO ;Interrupt, store data, go + IOWRI T,%LHICS ;Start read + RET + + +SUBTTL ARPANET OUTPUT INTERRUPT LEVEL + +;Here on unvectored interrupt caused by call to IMPIOS + +IMPINT: AOS IMCT1 ;Count unvectored interrupts + JRST IMPOBZ ;Go try to start output + ;Returns directly to interrupt dispatcher + +;First-level interrupt handling, from hardware dispatch. +; Crash on severe interface errors +; Restart IMP on ready line flappage. +; Else, go look for more output to send. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPOBK + + EBLK +IMPOBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT3 ;Count output interrupts + IORDI TT,%LHOCS ;Get CS register + TRNE TT,%LHERR\%LHNXM ;Interface lost? + JRST IMPOEC ;Try cycling + TRNE TT,%LHMRE ;Somebody bounce a ready line? + JRST IMPOER +IMPOBE: TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPOEC ;Try cycling + PUSHJ P,IMPOBZ ;No IMP error. Perform planned action. + JRST IMPEX ;Dismiss interrupt. + +;Error while outputting datagram. Currently, just means ready line flapped. +; If IMP was up, finish up IP output if necessary to free buffer, then +; cycle the interface. +; If trying to send NOPS to come up, just send a few more to resynch. +; +IMPOER: SKIPE IMPUP ;IMP up? + JRST IMPOE1 ;Not running normally, maybe OK. + BUG INFO,[IMP: Output RDY error] +IMPOEC: SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPOS ;Doing nothing useful + JRST IMPRST ;Go poke SYSJOB to cycle the IMP + +;Here if interface wasn't fully up. +IMPOE1: MOVE T,IMPOS + CAIE T,%ISONP ;Were we sending a NOP? + BUG CHECK,[IMP: Confusing output error] + SOS IMNOPC ;Add another NOP to make up for this one + SETZM IMPOS ;NOt doing anything anymore + JRST IMPOBE ;Go continue processing. + +;IMPOBZ - Toplevel output processing routing. +; Called from output done interrupt handler or from MP/CLOCK level with +; NETOFF to start output. + +IMPOBZ: SKIPL B,IMPOS + CAIL B,IMPODL + BUG HALT,[IMP: Bad output state] + JRST @IMPODT(B) + +IMPODT: OFFSET -. +%ISODL:: IMPOB0 ; 0 Idle, look for something to send +%ISONP:: IMPOB1 ; 1 Finished NOP +%ISOID:: IMPOB2 ; 2 Finished IP datagram messge +IMPODL::OFFSET 0 + +;Here when interrupt has finished processing a complete message. +; Attempt to find something else to do. +; +IMORET: + ;JRST IMPOB0 ;Fall through to try for more + +; Idle - Look for output to send. First ensure we can send stuff, +; then try things in the order: +; (1) Send NOP if net coming up +; (2) Check IP datagram queue +; +IMPOB0: HRRZ T,IMPUP ;Get current IMP state. + CAIE T,-2 ;Don't say it's up when it's still going down + CAIN T,1 ;or when it is broken + JRST IMPOBN + + ; First check to see if NOP needs to be sent. + AOSG IMNOPC ;Check to see if sending NOPs + JRST IMONOP ;Output a NOP + SETZM IMPUP ;Say IMP is up + SETZM IMPTCU ;Say no longer trying to come up + + ; Now see if there is any real traffic to send + PUSHJ P,IPGIOQ ;Check IP. Get IP IMP output queue entry if any + JRST IMPOBN ;Nothing there, we're done. + + ; Returns A/ ptr to IP dgm struct + ; B/ BLKO pointer to 32-bit words (unused) + ; C/ Arpanet address + ; + ;Build an IMP-format datagram at IMPOBF. + ; Set correct address in prototype leader. + ; BLT and reformat leader to IMPOBF. + ; BLT and reformat datagram to IMPOBF + leader size. + + MOVEM A,IMPODP ;Save ptr to datagram being output + AOS IMNIPO ;# of IP datagrams sent + + ;Put together the IMP leader in IMOLDR. +IFN 0,[ ;First and third word initialized at assembly time + MOVE B,[17_10.,,0] ;Regular message + MOVEM B,IMOLDR + MOVSI B,233_10. ;IP link # in left 8 bits + MOVEM B,IMOLDR+2 ;Set up third word +] + LSH C,4. ;Move net address to correct field + MOVEM C,IMOLAD ;set up second word of leader + + ;Copy leader and datagram to IMPOBF + MOVE B,[IMOLDR,,IMPOBF] + BLTBU B,IMPOBF+IMPLDS-1 ;Move IMP leader into place + MOVS B,PK.BUF(A) ;SOURCE,,COUNT + MOVEI A,IMPLDS(B) ;Size including leader to A + HRRI B,IMPOBF+IMPLDS ;Put d'gram immediately after leader. + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Go start hardware + MOVEI C,%ISOID ;Remember we are outputting IP leader + MOVEM C,IMPOS + POPJ P, + + + +;Here if nothing to output. +; Flag output inactive and disable interface +; +IMPOBN: SETOM IMPOAC ;No more output + IORDI TT,%LHOCS + TRZ TT,%LHIE\%LHGO ;Deactivate interface for a bit + IOWRI TT,%LHOCS + POPJ P, + +;IMONOP - Send a NOP, here from IMPOBZ only. +; +IMONOP: MOVEI A,IMPNOS ;Length of NOP message + MOVE B,[IMPNOP,,IMPOBF] ;BLT (and reformat) NOP to output buffer + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Start output of (A) words from IMPOBF to IMP + MOVEI C,%ISONP ;Set correct output FSM state + MOVEM C,IMPOS + POPJ P, + +;Prefabricated NOP Host-IMP leader +IMPNOP: 17_10.,,4_4 ;New format, type 4 = NOP + 0 + 0 ;No padding required on regular messages +IMPNOS==.-IMPNOP + +;Finished sending NOP, from IMPOBZ +; +IMPOB1: SETZM IMPOS ;Reset state + JRST IMORET ;Go look for something else to do. + +;Was sending IP datagram, from IMPOBZ +; +IMPOB2: SETZB A,IMPOS ;Reset output state. + EXCH A,IMPODP ;Get active datagram and reset pointer + PUSHJ P,IPIODN ;Tell IP level that datagram was output + JRST IMORET ;Go see if there is anything else to do. + +;Start output hardware. +; A/ Count of PDP10 words to write to net. +; Data to output in IMPOBF. +; Must be NETOFF or at NETCHN interrupt level. Bashes A only. + +IMPSOH: ASH A,1 ;Convert PDP10 word count to... + MOVNS A ; negative unibus word count. + IOWRI A,%LHOWC ;Tell the interface + MOVEI A,+<4*> + IOWRI A,%LHOCA ;Unibus address of output buffer + MOVEI A,%LHIE\%LHELB\%LHGO ;Enable interrupts, send EOM, GO + IOWRI A,%LHOCS ;Start DMA transfer + POPJ P, ;And forget it. + +SUBTTL ARPANET CLOCK LEVEL + +IMRSTO: RET ;Nothing to do any more? + +OVHMTR UUO + +;NETHST (HOST INFO) +; ARG 1 - HOST => VAL 1 - STATUS, VAL 2 - HOST NUMBER +; ARG 1 - -1 => VAL 1 - (STATUS), VAL 2 - OUR HOST NUMBER +;NOT CURRENTLY IMPLEMENTED- ARG 1 - -1, ARG 2 - OUR GOING-DOWN REASON +; +ANETHST:HRRE T,A ;Let immediate -1 win (777777 not a valid host) + AOJE T,ANETH2 ;Jump if want local status and host number + MOVE T,A + JSP J,STDHST ;Standardize and error-check host number + MOVE B,T ;Return new format + TLO B,(NW%ARP) + MOVEI H,LIMPHT-1 + CONO PI,NETOFF ;Do we have status for this host? + CAME T,IMPHTN(H) ;Scan table + SOJGE H,.-1 + JUMPGE H,ANETH1 ;Yes, return it + CONO PI,NETON ;No, have to go get it + MOVEM T,SRN3(U) + POPJ P, ;Oh, too bad + +;Here to return status of foreign ARPAnet host +ANETH1: MOVE A,IMPHTB(H) ;Get status + CONO PI,NETON + EXCH A,B + CALL CVH2NA ;Convert to HOSTS2 for compat + EXCH A,B + JRST LSWCJ1 ;Return IMSOC, NETLST if not done already + +;Here to return our status, host +ANETH2: +REPEAT 0,[ + CAIL W,2 ;(This is a crock) + MOVEM B,NTHDSW ;If 2 args, set our reason for going down. +] + SKIPE IMPUP ;Fake up our status + TDZA A,A ;We're down + MOVSI A,2000 ;We are up + MOVEI B,IMPUS ;And our host umber + JRST POPJ1 + + +;NETIMP (REASON,TIMEDOWN,TIMEUP) READ/SET +; +ANETIM: JUMPLE W,ANETM1 ;No args, return current data + CAIGE W,3 ;Must have 3 args if any + JRST OPNL30 + MOVEM A,IMPDWN ;Set data + MOVEM B,IMPDWN+1 + MOVEM C,IMPDWN+2 + JRST POPJ1 + +ANETM1: MOVE A,IMPDWN ;Get data to return + MOVE B,IMPDWN+1 + MOVE C,IMPDWN+2 + SKIPE IMPUP ;Note current condition of IMP, too + TLO A,400000 + JRST POPJ1 diff --git a/system/imp.365 b/system/imp.365 new file mode 100644 index 0000000..012c6dc --- /dev/null +++ b/system/imp.365 @@ -0,0 +1,947 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +IMPVRS==.IFNM2 ; Version of IMP code + +IFN NCPP,.FATAL IMP Code doesn't support NCP any more! +IFE KSIMP,.FATAL Wrong IMP driver file included! + +OVHMTR IMP ;Charge all this stuff to the IMP + +$INSRT LHDH + +; IMP 1822 PROTOCOL INFORMATION (EXTENDED-LEADER VERSION) + +; The IMP leader is 96 bits long, usually organized as 3 words of 32 bits. +; For further details, these documents are available from the Network +; Information Center: +; IMP-HOST protocol: BBN Report No. 1822 +; NCP protocol: NIC 8246, Host-to-Host Protocol for the ARPANET +; IP, TCP: Internet Protocol Transition Workbook, and +; Internet Protocol Implementor's Guide +; +; Here is the leader format used by the IMP code. This format uses +; no IMP padding, assumes IP only, and expects all IMP<->HOST data +; transfers in 32-bit mode. +; +; Previous versions of this code which supported NCP used a much more +; complicated leader formatting scheme based on 36 bit transfers and +; IMP padding. That scheme is dead, see SYSTEM;IMPOLD WTHNCP for details. +; +; All data from the IMP interface ends up in the -10 as left-justified +; 32-bit words. Objects of less than 32 bits length, such as IP octets, +; are stored in PDP10 ILDB byte order. +; +;------------------------------------------------------------------------ +;1: 4.9-4.6 not used (0) +; 4.5-4.2 all 1's for new format, else old msg type (4=old nop) +; 4.1-3.3 network number (0) +; 3.2-2.8 not used (0) +; 2.7 trace (ignored) +; 2.6-2.4 leader flags (2.6 is to be ignored, 2.5-2.4 are not used!) +; 2.3-1.5 message type +; +;2: 4.9-4.2 Handling type (7 for big buffers, 4 for small buffers, +; 0 for the control link) +; 4.1-3.3 Host number on IMP +; 3.2-1.5 IMP number +; +;3: 4.9-4.2 Link Number (High 8 bits of Message ID) +; 4.1-3.7 Low 4 bits of Message ID (0) +; 3.6-3.3 Sub-type +; 3.2-1.5 Message length +;------------------------------------------------------------------------ +;4: 4.9-1.5 First word of IP datagram +; .... +;------------------------------------------------------------------------ +; +;In message types 2 and 6, the going-down status 16-bit word is +;in word 3 bits 4.9-3.3. + +;3.6-3.3 of word 3 are the padding count for type 4 (nop) from host. +;This is currently 0 (none). Padding is only put on type-0 messages. + +IMPLDS==3 ;IMP local leader size + + ;Byte pointers to fields of input leader +IMOTBP: 340400,,IMPILB+0 ;Message format type +IMTBP: 041000,,IMPILB+0 ;Message type field +IMSABP: 043000,,IMPILB+1 ;Source address field (host+IMP) +IMSHBP: 241000,,IMPILB+1 ;Source host field +IMSIBP: 042000,,IMPILB+1 ;Source IMP field +IMLNBP: 341000,,IMPILB+2 ;Link number field +IMSTBP: 240400,,IMPILB+2 ;Subtype field +IMMLBP: 042000,,IMPILB+2 ;Message length field + + + +SUBTTL ARPANET VARIABLES AND TABLES + +EBLK + +%IMXLN==:<<8159.-96.>+31.>/32. ; Max # of 32-bit words in IMP regular msg, + ; exclusive of leader and leader padding. = 252. + +%IMMTU==:251.*4 ; Used by IP/TCP. Driver currently rounds to PDP10 words, + ; forcing this to be 1004 instead of 1007. + +; ACTIVE HOST TABLE. Entries herein are allocated as needed, using garbage +; collection. Most "host number" fields are really indices into this table. +; +LIMPHT== ; TCP conns plus a few extra + +IMPHTF: -1 ;Host table free list, threaded through IMPHTB, end with -1 + +IMPHTS: ;Start of table area +IMPHTN: BLOCK LIMPHT ; Host number. 1.1-1.8 HOST, 2.1-3.7 IMP +IMPHTB: BLOCK LIMPHT ;Bits: + ;4.9 UNUSED + ;4.8 GC MARK BIT + ;4.7-4.3 UNUSED + ;4.2-4.1 STATUS OF HOST 0 DOWN, 1 RST SENT, 2 UP + ;3.9-3.1 UNUSED + .SEE IMPHDS ;RH Last message from IMP about "host dead status" +IMPHTC: BLOCK LIMPHT ; # active messages outstanding for host (8 max) +IMPHTT: BLOCK LIMPHT ; Time of last RFNM received +IMPHTE==.-1 ;Last location in table + +;Status variables +; +IMPUP: -1 ;0 => IMP up ;-1 => down ;-2 => coming up, PI still off + ;1 => down for good, until next time IMP ready line changes +IMPTCU: 0 ;0 IMP up/down status not changing + ;>0 Trying to reinitialize, SYSJOB hasn't done so yet + ;-1 Has been reinitialized, haven't exchanged NOPs yet +IMPUCT: 0 ;IMP coming up timeout, if 4 NOPs don't go through promptly. +IMPDWN: BLOCK 3 ;Last message from IMP that it is going down + ;WD0: "Reason" claimed by IMP (see ch 3 of BBN report 1822) + ;WD1: Time when expected down + ;WD2: Time when expected up (SYS time=1/30 sec since up) + +IMERCN: -1 ;CONI into here when net goes down + +BBLK + +EBLK + +;Input side variables +; +IMPILB: BLOCK IMPLDS ;Input leader buffer +IMPCSH: -1 ;Current source host (IMPHTB index). -1 when idle. +IMPCLN: 0 ;Current link number +IMIFLS: 0 ;Flushing output at interrupt handler +IMPIEC: 0 ;Count of input errors while down. +IMPIBC: 0 ;Count of words available in DMA input buffer +IMPIBP: 0 ;Pointer into DMA input buffer + +;Output side variables +; + ;Output leader buffer +IMOLDR: <17_10.>,,0 ;Regular new-format message +IMOLAD: 0 ;Filled in with destination IMP address + <233_10.>,,0 ;IP link field + +IMNOPC: 0 ;< 0 => Send NOPs +IMPOAC: -1 ;>= 0 => Output active, don't restart +IMPBZY: 0 ;-1 == Waiting for output interrupt +IMPODP: 0 ;Pointer to IP datagram being output at PI level +IMPOS: 0 ;Output state + %ISODL==:0 ; Not expecting output done (i.e. between messages) + %ISONP==:1 ; Sending NOP + %ISOID==:2 ; Sending IP Datagram + +;Meters + +;IP meters +IMNIPI: 0 ; # of IP datagrams input (rcvd) +IMNIPF: 0 ; # of IP datagrams flushed (input threw away) +IMNIPO: 0 ; # of IP datagrams output (sent) +IMNIPR: 0 ; # of IP RFNMs received +IMNIP7: 0 ; # of IP Type 7 (Dest Host Dead) messages received +IMNIP8: 0 ; # of IP Type 8 (Error) msgs rcvd +IMNIP9: 0 ; # of IP Type 9 (Incomplete Transmission) msgs rcvd +IMNWIG: 0 ; # words ignored by "Ignore" state (%ISIGN) +IMNWIF: 0 ; # words flushed by IMPRM5 + +;IMP meters +IMNSRF: 0 ;Number of spurious RFNMs on non-IP links +IMNBLK: 0 ;Number of times blockage avoided (output held up by ITS) + +IMPMSR: BLOCK 20;Count of IMP messages rcvd +IMPM1S: BLOCK 4 ; # Type 1 (Error in Leader) subtype msgs +IMPM9S: BLOCK 2 ; # Type 9 (Incomplete Transmission) subtype msgs +IMPMSS: BLOCK 1 ;Count of IMP msg sent (we only send regular msgs) +IMCT1: 0 ;# Unvectored interrupts +IMCT2: 0 ;# Valid input interrupts +IMCT3: 0 ;# Valid output interrupts +BBLK + +SUBTTL ARPANET MAIN-PROGRAM LEVEL +;IMPIBF, IMPOBF defined as low-memory buffer page in ITS +IF2,IFN IMPIBF&777,.FATAL IMPIBF not on DEC page boundary + +;(Re)Start IMP. Called from SYSJOB to start IMP, or on error or +; user requested cycle through LOCK +; +IMPINI: SETOM IMPUP ;Not up yet, + SETOM IMPTCU ; but thinking about it. + MOVEI A,IMPIBF_-9. ;DEC page # of IMP buffer page + TRO A,%UQ16B\%UQVAL ;Valid mapping, 16 bit device + IOWRI A,UBAPAG+IUIMPG_1 ;Set up 1 DEC page of UBA mapping. Note that + ; the second half of IUIMPG isn't mapped at all + CONO PI,NETOFF ;Freeze things while IMP bashing occurs + MOVEI A,%LHRST + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + + ;IMP now shut down. Reset variables + SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPODP ;No output datagram + SETZM IMPOS ;Output idle + SETOM IMPOAC ;Output interrupt level inactive + SETZM IMPBZY ;No pending output interrupt + + SETZM IMPIBC ;No input available + SETZM IMPIEC ;No input errors yet + SETZM IMIFLS ;Not flushing input at interrupt level + SETOM IMPCSH ;No current host table index + SETOM IMPDWN+1 ;Time for IMP to go down, not known + CONO PI,NETON ;Allow interrupts again + + ;Wait one sec for IMP to notice rdy line drop + MOVE T,TIME + ADDI T,30. + CAMLE T,TIME + PUSHJ P,UFLS + + MOVNI A,30. ;Allow 15 seconds to come up + MOVEM A,IMPUCT + MOVE T,TIME ;Note when we last started IMP + MOVEM T,LNETIM + PUSHJ P,IMPHRS ;Set host ready + PUSHJ P,IMPIST ;Start input + + MOVE T,TIME + ADDI T,15. ;Wait 1/2 sec before we try to output + CAMLE T,TIME + PUSHJ P,UFLS + MOVNI A,4 + MOVEM A,IMNOPC ;Send 4 NOPs to start + ;Falls through to start output + +;Start IMP output +; +IMPOST: +IMPIOS: CONO PI,PIOFF ;Freeze. + AOSE IMPOAC ;Do nothing if output already active. + JRST PIONJ + SETOM IMPBZY ;Note we want an IMP interrupt + CONO PI,NETRQ ;Force nonvectored IMP interrupt + JRST PIONJ + +;Check if IMP ready line is set +; Called from SYSJOB. +; Return +1 if IMP not ready, +2 if so +; +IMPCKR: IORDI A,%LHICS ;Get input CSR + TRNN A,%LHINR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, ;That's all + +;Set HOST READY. From SYS job only, please, loops waiting. +; +IMPHRS: IORDI T,%LHICS + TRNN T,%LHRDY ;Can we mung? + BUG + IORI T,%LHHRC\%LHSE ;Turn on HR. SE prevents dropping messages + IOWRI T,%LHICS + MOVEI A,777777 ;I don't know why this takes so long. +IMPHR1: IORDI T,%LHICS ;Get the bits back + TRNE T,%LHHR ;LHDH thinks host ready is ready + RET ;HR line set + SOJG A,IMPHR1 ;Timed out yet? + BUG CHECK,[IMP: Timed out setting Host Ready] + RET + +SUBTTL HOST-TABLE MANAGEMENT + +;IMPHTI - Initialize host table +; Performed whenever IMP announces that it has been reset +; +IMPHTI: SETOM IMPHTF ;Force GC of IMPHTB on first reference + SETZM IMPHTS ;Clear table of old information + MOVE A,[IMPHTS,,IMPHTS+1] + BLT A,IMPHTE + POPJ P, + +; FNDHST - Look up host-table index for a given IMP host address. +; Call with NETOFF or NETCHN PI in progress. +; T/ IMP host address (maybe someday other nets?) +; Returns .+1 if failed (no room in table) +; Returns .+2 +; H/ host-table index +; Smashes W. + +FNDHST: MOVEI H,LIMPHT-1 ;Search for an entry for this host + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,POPJ1 ;Found + SKIPGE H,IMPHTF ;Not found, cons one off free list + JRST FNDHS1 ;Oops, must garbage collect + MOVE W,IMPHTB(H) + CAIGE H,LIMPHT ;Make sure H is valid idx + CAIL W,LIMPHT ;ditto W + BUG HALT,[NET: FNDHST idx clobbered!!!] + MOVEM W,IMPHTF + MOVEM T,IMPHTN(H) + SETZM IMPHTB(H) ;Nothing is known about this host + SETZM IMPHTC(H) ;Assume no RFNMs outstanding + SETZM IMPHTT(H) ;Clear out time of last RFNM. + JRST POPJ1 + +; Host-Table full, attempt to GC it and flush unused entries, by +; scanning all possible pointers into table. +; IMP pointers are IMPCSH and IMPHTC(H) +; TCP pointers are XBNADR(I) + +; GC mark phase - mark entries in use +FNDHS1: PUSH P,I + MOVSI W,200000 ;Mark bit + MOVEI H,LIMPHT-1 ;Clear all mark bits + ANDCAM W,IMPHTB(H) + SOJGE H,.-1 + SKIPL H,IMPCSH ;Mark from IMPCSH + IORM W,IMPHTB(H) +IFN TCPP,[ + MOVEI I,XBL-1 + SKIPL H,XBNADR(I) ; See if TCP conn has a net addr specified + IORM W,IMPHTB(H) ; Yes, set the mark bit. + SOJGE I,.-2 +] ;IFN TCPP + +; GC sweep phase - free all unmarked entries + SETO I, ;Free pointer + MOVEI H,LIMPHT-1 + MOVSI W,601000 ;Protect if RFNM-WAIT, RST-WAIT, or marked +FNDHS4: + SKIPG IMPHTC(H) ;Also protect if any outstanding RFNMs + TDNE W,IMPHTB(H) + SOJGE H,FNDHS4 + JUMPL H,FNDHS5 + SETZM IMPHTN(H) ;Don't belong to any host + MOVEM I,IMPHTB(H) ;Cons onto free list + MOVE I,H + SOJGE H,FNDHS4 +FNDHS5: MOVEM I,IMPHTF ;Free list + POP P,I + SKIPGE IMPHTF + POPJ P, ;GC-overflow + JRST FNDHST ;Try again, should win + +;See if IMP code is willing to handle a particular datagram right now. +; A/ IP DGM pointer +; C/ Immediate destination address +; Returns +1, can't send right now, +2, OK to send +; +IMPCTS: MOVE T,C ;Set up for FNDHST + AND T,[<377_16.>+377] ;Mask out all but host and IMP field + CALL FNDHST ;Get host index in H + POPJ P, ;No host entry, don't send + JSP T,IMPBLI ;See if OK to send + POPJ P, ;IMP wants to block, no send + JRST POPJ1 ;Skip return if OK to send. + + +;;; IMP Blockage avoidance +; The current IMP software will not accept more than 8 active +; messages to a single host; attempting to send a 9th message will block +; ALL output to the interface, until the first message has been ack'd +; by means of one of the following message types: +; Type 5, RFNM - Message delivered OK +; Type 7, Host dead - transmit failed ("permanent") +; Type 8, Error in data - interface spazzed +; Type 9, Incomplete Transmission - temporary failure +; If for some reason the first message simply becomes lost, the IMP timeout +; (and blockage) can last for up to 30-45 seconds. +; More details in BBN Report 1822. +; ITS attempts to fix this by keeping a count of active un-ACKed +; messages for each host it is communicating with. A timeout is also +; associated with each host; if output to a given host is blocked by ITS +; because there are 8 active messages, trying to send a 9th message +; will check the last-RFNM-received time and if this was more than +; 30 or so seconds then the IMP is probably not giving us what it should +; and we should reset things for that host. + +%IMPMA==:8. ; # of maximum active IMP messages allowed + +; IMPBLI, IMPBLD - routines to hack active-message counts, called via JSP T, +; IMPBLD decrements count. +; IMPBLI increments count and skips if successful (else failed, +; and must NOT output another message to this host!) +; Also clobbers Q. +; +IMPBLI: AOS Q,IMPHTC(H) + CAIGE Q,%IMPMA ;Trying to send max or more messages? + JRST 1(T) ;No, can return safely. + CAIG Q,%IMPMA ;Is this the maximum # allowed? + JRST [ MOVE Q,TIME ;Yes, set up blockage timeout + ADDI Q,60.*30. ; for one minute. + MOVEM Q,IMPHTT(H) + JRST 1(T)] ;And allow this one to be sent + + ; Trying to send too many messages, block it (check for timeout though) + SOS IMPHTC(H) ;Restore original count + AOS IMNBLK ;Increment # of times softwarily blocked. + MOVE Q,IMPHTT(H) + CAML Q,TIME ;See if timeout still in the future + JRST (T) ;Yes, just take failure-return to block. + BUG INFO,[IMP: RFNM-wait timeout! Hst=],OCT,IMPHTN(H) + SETZM IMPHTC(H) ;This may be dangerous... oh well. + SETZM IMPHTT(H) + JRST (T) ;Block one last time, next try will win. + +;Decrement block count on receipt of any kind of ACK +; +IMPBLD: SOSL Q,IMPHTC(H) + JRST IMPBL2 + BUG INFO,[IMP: negative RFNM-wait cnt, Hst=],OCT,IMPHTN(H) + SETZB Q,IMPHTC(H) +IMPBL2: CAIL Q,%IMPMA-1 ;If we were blocking on this host, + PUSHJ P,IMPIOS ;Ensure IMP output started up so blocked stuff + JRST (T) ; gets sent promptly. + + +SUBTTL ARPANET INPUT INTERRUPT LEVEL + +;First level interrupt handling for input side. Here from UBA vector hardware. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPIBK + + EBLK +IMPIBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT2 ;Count input interrupts + IORDI TT,%LHICS ;Get CS register + TRNE TT,%LHERR\%LHNXM + JRST IMPRST ;Try resetting the IMP + TRNE TT,%LHMRE ;Ready line flapped + JRST IMPIER ;Go directly to error routine + TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPRST ;Try resetting. + TRNN TT,%LHEOM ;Saw EOM from IMP? + JRST IMPIB1 ;No, word count ran out before message + SKIPGE IMIFLS ;Flushing output? + JRST [ SETZM IMIFLS ;Not any more! + JRST IMPIRT ] ;But flush last piece by queueing new request + IORDI A,%LHIWC ;End of message. Get remaining UB word count + SKIPE A ;This would be a surprise, really + TDO A,[-1,,600000] ;36bit number of UBA words remaining in bfr + IDIVI A,2 ;Number of PDP10 words (cleverly rounded) + ADDI A,IMPBFS ;Number of PDP10 words of message + MOVEM A,IMPIBC ;Set current count of available data words + MOVEI A,IMPIBF + MOVEM A,IMPIBP ;Set pointer to available data words + JRST IMPLDD ;Go process input message + +;Here when finished processing current message. +IMPIRT: SETOM IMPCSH ;Note no current host + PUSHJ P,IMPIST ;Restart input listener + JRST IMPEX + +;Message didn't fit in input buffer. Shouldn't ever get here, but +;might if messages concatenated due to ready line randomness +; +IMPIB1: BUG INFO,[IMP: Huge message] + SETOM IMIFLS ;Say we are flushing output + JRST IMPIRT ;And go queue up another read + +;Here if error during IMP message transfer +; Currently the only error handled is the IMP going non-ready + +IMPIER: SKIPE IMPUP ;Is the IMP supposed to be up? + JRST IMPIE1 ;No, handle errors differently + BUG INFO,[IMP: Input Ready Error] + JRST IMPRST ;Ready line flapped while up, cycle interface + +IMPIE1: AOS T,IMPIEC + CAIG T,10. ;Huge number of errors while down? + JRST IMPIRT ;No, just ignore this input and start another + SETZM IMPIEC ;Reset + BUG INFO,[IMP: Excessive input errors while down] + JRST IMPRST ;Cycle the interface + +IMPRST: IORDI T,%LHICS ;Record IMP status for sysjob + HRLZM T,IMERCN + IORDI T,%LHOCS + HRRM T,IMERCN + MOVEI A,%LHRST ;Avoid randomness by resetting HW now. + IOWRI A,%LHOCS ;Reset output side + IOWRI A,%LHICS ;Reset Input side + SETOM IMPUP ;IMP is down + MOVEI T,1 + MOVEM T,IMPTCU ;But trying to come up (sysjob poked) + MOVSI J,SCLNET ;Ask SYSJOB to cycle the IMP + IORM J,SUPCOR + JRST IMPEX + + SUBTTL IMP leader dispatch handling + +IMPLDD: SKIPG B,IMPIBC ;Get count of available data + POPJ P, ;None, nothing to do. + CAILE B,IMPLDS ;More than a leader worth? + MOVEI B,IMPLDS ;Yep, only want leader now + MOVS A,IMPIBP ;Copy and reformat leader to IMPILB + HRRI A,IMPILB + BLTUB A,IMPILB-1(B) + ADDM B,IMPIBP ;Increment buffer pointer, + MOVN C,B + ADDM C,IMPIBC ; and decrement count + + LDB T,IMOTBP ;Examine new-format flag bits of leader + CAIL B,IMPLDS ;Large enough to be a valid leader? + CAIE T,17 ;Verify that leader is "new" 96-bit fmt. + JRST IMPLDE ;Go process error in leader + + LDB T,IMLNBP ;Extract link number (high 8 bits of msg-id) + MOVEM T,IMPCLN ;Save link message arrived on + LDB T,IMSABP ;Get arpanet address (source host+imp) +IFN 0,[ + LDB T,IMSHBP ;Source host + LDB A,IMSIBP ;Source imp + DPB A,[112000,,T] ;Form host address +];IFN 0 + PUSHJ P,FNDHST ;H gets host table index + JRST IMPLHE ;Host table full + MOVEM H,IMPCSH ;Save current host + LDB A,IMTBP ;Get message type in A + CAIL A,IMTDTS + JRST IMPUN ;Unknown type? + AOS IMPMSR(A) ;Count IMP msgs rcvd + JRST @IMTDT(A) ;Dispatch + +IMTDT: IMPRM ; 0 Regular Message + IMPBE1 ; 1 Error in Leader (no msg-id) + IMPGD ; 2 IMP Going Down + IMPUN ; 3 - + IMPIN ; 4 NOP + IMPRFN ; 5 RFNM - Ready For Next Message (transmit succeeded) + IMPHDS ; 6 Host Dead Status (general info) + IMPDHD ; 7 Destination Host Dead (transmit failed) + IMPBE8 ; 8 Error in Data (has msg-id) + IMPINC ; 9 Incomplete Transmission (transmit failed temporarily) + IMPIRS ;10 Interface Reset - IMP dropped its ready line +IMTDTS==.-IMTDT + +IMPLHE: BUG INFO,[IMP: Message discarded due to host table full],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;Here if leader is too short or of wrong format. +; B/ Leader length +IMPLDE: SKIPE IMPUP ;If IMP is not up, we'll take anything. + JRST IMPIRT + CAIGE B,IMPLDS ;Announce short leader if so. + BUG INFO,[IMP: Short leader, ],DEC,B,[wds. WD1=],OCT,IMPILB,[WD2=],OCT,IMPILB+1 + LDB A,IMOTBP ;Get message format type + CAIN A,4 ;Old-type NOP? + JRST IMPIRT ; Just ignore it. +IFN 0,[ ;;For the moment this is a problem because the IMP is marked + ;;up too soon, before all incoming NOPS are received. + CAIN A,16 ;Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE A,17 ;Is it not the long-leader format? + BUG INFO,[IMP: Old-type leader],OCT,IMPILB +] + JRST IMPIRT ;Ignore rest of message, if any + +;;; IMP->Host Type X (e.g. 3, 11-255) - bad type + +IMPUN: BUG INFO,[IMP: Unknown msg type ],OCT,A,[ leader ],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +;;; IMP->Host Type 1 - Error in leader (msg-id not given) +;;; IMP->Host Type 8 - Error in data (msg-id given) + +IMPBE1: LDB T,IMSTBP ;Get subtype (4 bits) + ANDI T,3 ;Only 2 bits should be used + AOS IMPM1S(T) ;Increment count of Type 1 subtype messages +IMPBE8: SKIPN IMPUP ;Ignore error during initial syncronization + BUG INFO,[IMP: Type ],DEC,A,[err msg, leader],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + MOVE B,IMPCLN ;Get link msg came in on + CAIN B,233 ;Internet link? + AOS IMNIP8 ;Yes, count IP meter + CAIN A,8. ;Error identified with a particular message? + JSP T,IMPBLD ;Decrement count of active messages + JRST IMPIRT + +;;; IMP->Host Type 2 - IMP going down + +IMPGD: LDB B,[420200,,IMPILB+2] ;Reason (see 1822) + MOVEM B,IMPDWN + LDB B,[360400,,IMPILB+2] ;How soon going down * 5 mins + MOVE H,B + IMULI B,5*60.*30. ;Ticks in 5 mins + ADD B,TIME + MOVEM B,IMPDWN+1 + LDB C,[241200,,IMPILB+2] ;How long to be down * 5 minutes + MOVE Q,C + IMULI C,5*60.*30. ;Downtime in ticks + ADD C,B ;Add to time down + MOVEM C,IMPDWN+2 ;Store time when will be up + IMULI H,5 ;Minutes + IMULI Q,5 + BUG INFO,[IMP: Going down in ],DEC,H,[mins for ],DEC,Q,[mins, reason],DEC,IMPDWN + JRST IMPIRT + +;;; IMP->Host Type 4 - NOP + +IMPIN: JRST IMPIRT ;One more NOP from IMP + +;;; IMP->Host Type 5 - RFNM (Ready For Next Message) + +IMPRFN: JSP T,IMPBLD ;Decrement outstanding message count for host + MOVE A,IMPCLN ;Get link # + CAIE A,233 ;IP link number? + JRST IMRFNX ;No, skip IP code + AOS IMNIPR ;Bump count of IP RFNMs received + JRST IMPIRT ; and do nothing else about it, ugh. + +IMRFNX: BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN + AOS IMNSRF + JRST IMPIRT + +;;; IMP->Host Type 6 - Host Down Status +; H/ host index + +IMPHDS: LDB A,[301400,,IMPILB+2];Bits 65-76 of leader, 4.9-3.7 3rd word + HRRM A,IMPHTB(H) ;Store, hope user read RFC 611 + JRST IMPIRT + +;;; IMP->Host Type 7 - Destination Host Dead + +IMPDHD: MOVEI E,%NCDED + JRST IMPHNR + +;;; IMP->Host Type 9 - Incomplete Transmission + +IMPINC: LDB T,IMSTBP ;Get subtype field (4 bit reason for failure) + AOS IMPM9S(T) ;Bump count of subtypes + MOVEI E,%NCINC ;This is an incomplete msg response + +IMPHNR: JSP T,IMPBLD ;Decrement active IMP msg count for this host + MOVE A,IMPCLN ;Link for this message? + CAIE A,233 ;IP Link? + JRST IMPHN1 + CAIN E,%NCINC ;Yes, count IP meters + AOS IMNIP9 + CAIN E,%NCDED + AOS IMNIP7 + JRST IMPIRT + +IMPHN1: BUG INFO,[IMP: DHD or IT msg rcvd on non-IP link] + JRST IMPIRT + +;;; IMP->Host Type 10 - Interface Reset + +IMPIRS: PUSHJ P,IMPHTI ;Initialize host table + BUG INFO,[IMP: Interface reset] + JRST IMPIRT + + +;;; IMP->Host Type 0 - Regular Host-Host message +; Unless the source host screwed up and sent a dataless message, +; there is at least one word waiting to be read in the buffer. +; +IMPRM: SKIPG A,IMPIBC ;Get available input word count + JRST IMPIRT ;None left, just ignore message + MOVE B,IMPCLN ;Is link number the magic cookie for IP? + CAIE B,233 + JRST IMPIRT ;No, ignore it + +;IP datagram. Copy into IP buffer and pass it up. +; + AOS IMNIPI ;Bump count of IP datagrams received + PUSHJ P,IPGIPT ;Ask IP for buffer of size (A) + JRST [ AOS IMNIPF ;Punted, bump cnt of datagrams lost + JRST IMPIRT ] ;Flush this message (err msg already printed) + MOVE B,PK.BUF(A) ;Destination + HRL B,IMPIBP ;Source + MOVE C,IMPIBC ;Input words available + ADDI C,-1(B) ;Last destination address + BLTUB B,(C) ;Copy and reformat data to IP buffer + MOVE B,IMPIBC ;Get word count back to B + SETZB C,IMPIBC ;Say zero offset to IP header, and clear count. + MOVE J,IMPCSH ;Set idx to host-table entry dgm received from. + PUSHJ P,IPRDGM ;Hand off rcvd datagram to IP + JRST IMPIRT ;Return from PI level, setting up for next msg + +;Start listening for new input from IMP +; +IMPIST: HRREI T,-IMPBFS*2 + IOWRI T,%LHIWC ;Read up to a buffer full of data + MOVEI T,+<4*> + IOWRI T,%LHICA ;Read data to here + MOVEI T,%LHIE\%LHHRC\%LHSE\%LHGO ;Interrupt, store data, go + IOWRI T,%LHICS ;Start read + RET + + +SUBTTL ARPANET OUTPUT INTERRUPT LEVEL + +;Here on unvectored interrupt caused by call to IMPIOS + +IMPINT: AOS IMCT1 ;Count unvectored interrupts + JRST IMPOBZ ;Go try to start output + ;Returns directly to interrupt dispatcher + +;First-level interrupt handling, from hardware dispatch. +; Crash on severe interface errors +; Restart IMP on ready line flappage. +; Else, go look for more output to send. + +IFN NETCHN-UTCCHN,.ERR NETCHN assumed == UTCCHN at IMPOBK + + EBLK +IMPOBK: 0 + BBLK + JSR UTCSAV ;Save AC's, get a stack + AOS IMCT3 ;Count output interrupts + IORDI TT,%LHOCS ;Get CS register + TRNE TT,%LHERR\%LHNXM ;Interface lost? + JRST IMPOEC ;Try cycling + TRNE TT,%LHMRE ;Somebody bounce a ready line? + JRST IMPOER +IMPOBE: TRNN TT,%LHRDY ;Device ready for new operation? + JRST IMPOEC ;Try cycling + PUSHJ P,IMPOBZ ;No IMP error. Perform planned action. + JRST IMPEX ;Dismiss interrupt. + +;Error while outputting datagram. Currently, just means ready line flapped. +; If IMP was up, finish up IP output if necessary to free buffer, then +; cycle the interface. +; If trying to send NOPS to come up, just send a few more to resynch. +; +IMPOER: SKIPE IMPUP ;IMP up? + JRST IMPOE1 ;Not running normally, maybe OK. + BUG INFO,[IMP: Output RDY error] +IMPOEC: SKIPE A,IMPODP ;Have an output datagram ? + PUSHJ P,IPIODN ;Yep, release it. + SETZM IMPOS ;Doing nothing useful + JRST IMPRST ;Go poke SYSJOB to cycle the IMP + +;Here if interface wasn't fully up. +IMPOE1: MOVE T,IMPOS + CAIE T,%ISONP ;Were we sending a NOP? + BUG CHECK,[IMP: Confusing output error] + SOS IMNOPC ;Add another NOP to make up for this one + SETZM IMPOS ;NOt doing anything anymore + JRST IMPOBE ;Go continue processing. + +;IMPOBZ - Toplevel output processing routing. +; Called from output done interrupt handler or from MP/CLOCK level with +; NETOFF to start output. + +IMPOBZ: SKIPL B,IMPOS + CAIL B,IMPODL + BUG HALT,[IMP: Bad output state] + JRST @IMPODT(B) + +IMPODT: OFFSET -. +%ISODL:: IMPOB0 ; 0 Idle, look for something to send +%ISONP:: IMPOB1 ; 1 Finished NOP +%ISOID:: IMPOB2 ; 2 Finished IP datagram messge +IMPODL::OFFSET 0 + +;Here when interrupt has finished processing a complete message. +; Attempt to find something else to do. +; +IMORET: + ;JRST IMPOB0 ;Fall through to try for more + +; Idle - Look for output to send. First ensure we can send stuff, +; then try things in the order: +; (1) Send NOP if net coming up +; (2) Check IP datagram queue +; +IMPOB0: HRRZ T,IMPUP ;Get current IMP state. + CAIE T,-2 ;Don't say it's up when it's still going down + CAIN T,1 ;or when it is broken + JRST IMPOBN + + ; First check to see if NOP needs to be sent. + AOSG IMNOPC ;Check to see if sending NOPs + JRST IMONOP ;Output a NOP + SETZM IMPUP ;Say IMP is up + SETZM IMPTCU ;Say no longer trying to come up + + ; Now see if there is any real traffic to send + PUSHJ P,IPGIOQ ;Check IP. Get IP IMP output queue entry if any + JRST IMPOBN ;Nothing there, we're done. + + ; Returns A/ ptr to IP dgm struct + ; B/ BLKO pointer to 32-bit words (unused) + ; C/ Arpanet address + ; + ;Build an IMP-format datagram at IMPOBF. + ; Set correct address in prototype leader. + ; BLT and reformat leader to IMPOBF. + ; BLT and reformat datagram to IMPOBF + leader size. + + MOVEM A,IMPODP ;Save ptr to datagram being output + AOS IMNIPO ;# of IP datagrams sent + + ;Put together the IMP leader in IMOLDR. +IFN 0,[ ;First and third word initialized at assembly time + MOVE B,[17_10.,,0] ;Regular message + MOVEM B,IMOLDR + MOVSI B,233_10. ;IP link # in left 8 bits + MOVEM B,IMOLDR+2 ;Set up third word +] + AND C,[<377_16.>+377] ;Mask out all but host and IMP field + LSH C,4. ;Move net address to correct field + MOVEM C,IMOLAD ;set up second word of leader + + ;Copy leader and datagram to IMPOBF + MOVE B,[IMOLDR,,IMPOBF] + BLTBU B,IMPOBF+IMPLDS-1 ;Move IMP leader into place + MOVS B,PK.BUF(A) ;SOURCE,,COUNT + MOVEI A,IMPLDS(B) ;Size including leader to A + HRRI B,IMPOBF+IMPLDS ;Put d'gram immediately after leader. + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Go start hardware + MOVEI C,%ISOID ;Remember we are outputting IP leader + MOVEM C,IMPOS + POPJ P, + + + +;Here if nothing to output. +; Flag output inactive and disable interface +; +IMPOBN: SETOM IMPOAC ;No more output + IORDI TT,%LHOCS + TRZ TT,%LHIE\%LHGO ;Deactivate interface for a bit + IOWRI TT,%LHOCS + POPJ P, + +;IMONOP - Send a NOP, here from IMPOBZ only. +; +IMONOP: MOVEI A,IMPNOS ;Length of NOP message + MOVE B,[IMPNOP,,IMPOBF] ;BLT (and reformat) NOP to output buffer + BLTBU B,IMPOBF-1(A) + PUSHJ P,IMPSOH ;Start output of (A) words from IMPOBF to IMP + MOVEI C,%ISONP ;Set correct output FSM state + MOVEM C,IMPOS + POPJ P, + +;Prefabricated NOP Host-IMP leader +IMPNOP: 17_10.,,4_4 ;New format, type 4 = NOP + 0 + 0 ;No padding required on regular messages +IMPNOS==.-IMPNOP + +;Finished sending NOP, from IMPOBZ +; +IMPOB1: SETZM IMPOS ;Reset state + JRST IMORET ;Go look for something else to do. + +;Was sending IP datagram, from IMPOBZ +; +IMPOB2: SETZB A,IMPOS ;Reset output state. + EXCH A,IMPODP ;Get active datagram and reset pointer + PUSHJ P,IPIODN ;Tell IP level that datagram was output + JRST IMORET ;Go see if there is anything else to do. + +;Start output hardware. +; A/ Count of PDP10 words to write to net. +; Data to output in IMPOBF. +; Must be NETOFF or at NETCHN interrupt level. Bashes A only. + +IMPSOH: ASH A,1 ;Convert PDP10 word count to... + MOVNS A ; negative unibus word count. + IOWRI A,%LHOWC ;Tell the interface + MOVEI A,+<4*> + IOWRI A,%LHOCA ;Unibus address of output buffer + MOVEI A,%LHIE\%LHELB\%LHGO ;Enable interrupts, send EOM, GO + IOWRI A,%LHOCS ;Start DMA transfer + POPJ P, ;And forget it. + +SUBTTL ARPANET CLOCK LEVEL + +IMRSTO: RET ;Nothing to do any more? + +OVHMTR UUO + +;NETHST (HOST INFO) +; ARG 1 - HOST => VAL 1 - STATUS, VAL 2 - HOST NUMBER +; ARG 1 - -1 => VAL 1 - (STATUS), VAL 2 - OUR HOST NUMBER +;NOT CURRENTLY IMPLEMENTED- ARG 1 - -1, ARG 2 - OUR GOING-DOWN REASON +; +ANETHST:HRRE T,A ;Let immediate -1 win (777777 not a valid host) + AOJE T,ANETH2 ;Jump if want local status and host number + MOVE T,A + JSP J,STDHST ;Standardize and error-check host number + MOVE B,T ;Return new format + TLO B,(NW%ARP) + MOVEI H,LIMPHT-1 + CONO PI,NETOFF ;Do we have status for this host? + CAME T,IMPHTN(H) ;Scan table + SOJGE H,.-1 + JUMPGE H,ANETH1 ;Yes, return it + CONO PI,NETON ;No, have to go get it + MOVEM T,SRN3(U) + POPJ P, ;Oh, too bad + +;Here to return status of foreign ARPAnet host +ANETH1: MOVE A,IMPHTB(H) ;Get status + CONO PI,NETON + EXCH A,B + CALL CVH2NA ;Convert to HOSTS2 for compat + EXCH A,B + JRST LSWCJ1 ;Return IMSOC, NETLST if not done already + +;Here to return our status, host +ANETH2: +REPEAT 0,[ + CAIL W,2 ;(This is a crock) + MOVEM B,NTHDSW ;If 2 args, set our reason for going down. +] + SKIPE IMPUP ;Fake up our status + TDZA A,A ;We're down + MOVSI A,2000 ;We are up + MOVEI B,IMPUS ;And our host umber + JRST POPJ1 + + +;NETIMP (REASON,TIMEDOWN,TIMEUP) READ/SET +; +ANETIM: JUMPLE W,ANETM1 ;No args, return current data + CAIGE W,3 ;Must have 3 args if any + JRST OPNL30 + MOVEM A,IMPDWN ;Set data + MOVEM B,IMPDWN+1 + MOVEM C,IMPDWN+2 + JRST POPJ1 + +ANETM1: MOVE A,IMPDWN ;Get data to return + MOVE B,IMPDWN+1 + MOVE C,IMPDWN+2 + SKIPE IMPUP ;Note current condition of IMP, too + TLO A,400000 + JRST POPJ1 diff --git a/system/impold.wthncp b/system/impold.wthncp new file mode 100644 index 0000000..652aba5 --- /dev/null +++ b/system/impold.wthncp @@ -0,0 +1,1990 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SUBTTL ARPANET HARDWARE DEFINITIONS + +IFNDEF BLIMPP,BLIMPP==INETP ; Use IMP blockage avoidance code +IMPVRS==.IFNM2 ; Version of IMP/NCP code + +IFN KAIMP,[ +; Hardware description of AI-KA/ML/MC IMP interface, device "IMP". +; For a more detailed description, see AI Hardware Memo #10, +; "ARPA Network Interface". +; In particular, the "channel 1 multiplexing" feature of the ITS KA's +; is used, so that: +; When PI level 2 (NETCHN) is assigned, the IMP interface takes +; all interrupts on the normal channel (goes to IMPINT). +; When PI level 1 (IMPCHN) is assigned, +; IMPID+(-IMPLIW) => Pseudo channel 4, location 70 (IMPILC)-> various +; IMPOD => Pseudo channel 5, location 72 (IMPOLC)-> various +; else normal PI channel 1 (PI0LOC+2)-> IMPBRK + +; CONI bits - starred items cause interrupt on PIA channel + ; 1.1-1.3 => PIA +IMPID==10 ;* INPUT DONE - Turned on when interface has word for DATAI +IMPI32==20 ; Input in 32 bit mode +;IMPIB==40 ; Input Busy +IMPOD==100 ;* OUTPUT DONE - Interface has finished giving word to IMP +;IMPO32==200 ; Output in 32 bit mode +;IMPOB==400 ; Output Busy +IMPERR==1000 ;* Imp Error (interrupt if IMPIC zero) +IMPR==2000 ;* Imp Ready (interrupt if IMPIC set) +;IMPIC==4000 ; Imp interrupt condition (0 = int on IMPERR, 1= int on IMPR) +IMPHER==10000 ;* Host Error (interrupt if IMPIHE zero) +;IMPHR==20000 ; Host Ready +;IMPIHE==40000 ; Inhibit interrupt on Host Error (IMPHER) +IMPLW==100000 ;* Last Imp Word + +; CONO bits - starred flags are always copied directly to set states + ;* 1.1-1.3 => PIA set from these bits +IMPIDC==10 ; Clear Input Done +IMI32S==20 ; Set input to 32 bit mode +IMI32C==40 ; Clear input in 32 bit mode +IMPODC==100 ; Clear Output Done +IMO32S==200 ; Set output to 32 bit mode +IMO32C==400 ; Clear output in 32 bit mode +IMPODS==1000 ; Set Output Done +IMPIR==4000 ;* Copied to IMPIC; 1= Enable int on imp ready +IMPHEC==10000 ; Clear Host Error +;IMIIHE==40000 ;* Copied to IMPIHE; 1= Inhibit int on host error +IMPLHW==200000 ; Set Last Host Word (do this before last DATAO of msg) + +];DMIMP + IFN DMIMP,[ ;HARDWARE DESCRIPTION OF DM IMP INTERFACE (PER RMM) + +; Note that all PI level 2 interrupts go to normal ITS location +; and thence vectored to IMPINT. +; However, PI 1 interrupts go to different places: +; Input Done -> loc 70 (IMPILC) +; Output Done -> loc 72 (IMPOLC) +; Control -> Should never get control interrupt at PI 1. +; Thus for example "Last Imp Word" interrupts go to +; IMPINT even though input side PIA is 1, because LIW is +; a control interrupt and control ints are always kept at PI 2. + + ;IMP INTERFACE CONO FLAG DESCRIPTION + +;COMMON FLAG BITS TO CONTROLLER + + ;18-> 0 FOR INPUT SIDE, 1 FOR OUTPUT SIDE + ;19->CLEAR TEST MODE (200000) + ;20->SET TEST MODE (100000) + + ;21->CLEAR HOST READY + ;22->SET HOST READY (20000) + ;23->CLEAR IMP-WAS-DOWN (10000) + + ;24->FI DEVICE RESET (CLEAR ALL INPUT AND OUTPUT FLAGS) (4000) + +;CONO FI (424) TO OUTPUT SIDE + ;BIT ;18->IS '1' INDICATING TO OUTPUT + ;25->CLEAR OUTPUT 32-BIT MODE + ;26->SET OUTPUT 32-BIT MODE + + ;27->SET OUTPUT EOT (CLEAR DONE, SET BUSY) (400) + ;28->SET OUTPUT DONE (200) + ;29->RESET OUTPUT (CLEAR ALL OUTPUT FLAGS) (100) + + ;30-32->CONTROL PI ASSIGNMENT + + ;33-35->OUTPUT DONE PI ASSIGNMENT + +;CONO FI (424) TO INPUT SIDE + ;BIT ;18->IS '0' INDICATING TO INPUT + ;25->CLEAR 32-BIT MODE (2000) + ;26->SET 32-BIT MODE (1000) + + ;27->SUSPEND INPUT (400) DATAI WONT SET BUSY NOW + ;28->SET INPUT BUSY (LISTENING TO NETWORK) (200) + ;29->RESET INPUT (CLEAR ALL INPUT FLAGS!) (100) + + ;30-32->CONTROL PI ASSIGNMENT + + ;33-35->INPUT DONE PI ASSIGNMENT + + ;FI CONI FLAG DESCRIPTION + + ;BIT ;00->TEST MODE IS ENABLED + ;08->OUTPUT IS IN 32-BIT MODE + ;17->INPUT IS IN 32-BIT MODE + + ;18->IMP IS DOWN + ;19->IMP WAS DOWN + ;20->HOST READY (?) + + ;21->OUTPUT EOT ON + ;22->OUTPUT BUSY + ;23->OUTPUT DONE + ;24-26->OUTPUT-DONE PI ASSIGNMENT + + ;27->INPUT EOT ON + ;28->INPUT BUSY + ;29->INPUT DONE + + ;30-32->CONTROL INTERRUPT PI ASSIGNMENT + + ;33-35->INPUT DONE PI ASSIGNMENT + +; SYMBOL ASSIGNMENTS FOR DM HARDWARE + +; CONO BITS + +FIIN==000000 ;(SIC) SPECIFY CONO FOR INPUT +FIOUT==400000 ;SPECIFY CONO FOR OUTPUT SIDE +;FITSTC==200000 ;CLEAR TEST MODE +;FITSTS==100000 ;SET TEST MODE + +;FIHSTC==040000 ;CLEAR HOST READY +FIHSTS==020000 ;SET HOST READY +FIIWDC==010000 ;CLEAR "IMP WAS DOWN" + +FIRSET==004000 ;DO LOCAL IOB RESET FOR FI DEVICE + +;INPUT SIDE ONLY + +FII32C==002000 ;CLEAR 32 BIT MODE, INPUT +FII32S==001000 ;SET 32 BIT MODE, INPUT + +FISUSP==000400 ;"SUSPEND INPUT" CLEAR FLAG, NOT SET BUSY +FIIBSY==000200 ;SET INPUT BUSY, ALLOWS BITS IN FROM IMP +FIIDC==000100 ;CLEAR INPUT DONE + +; 0000X0 ;CONTROL PIA + +; 00000X ;INPUT DONE PIA + +;OUTPUT SIDE ONLY + +FIO32C==402000 ;CLEAR 32 BIT MODE, OUTPUT +FIO32S==401000 ;SET 32 BIT MODE, OUTPUT + +FILHW==400400 ;SET "LAST HOST BIT TO IMP" +FIODS==400200 ;SET OUTPUT DONE +FIODC==400100 ;CLR OUTPUT DONE + +; 0000X0 ;CONTROL PIA + +; 40000X ;OUTPUT DONE PIA + +; CONI BITS + +; LEFT HALF OF CONI WORD FOR FOLLOWING 3 BITS + +;FITSTM==400000 ;TEST MODE IS ON +;FIO32==001000 ;OUTPUT IS IN 32 BIT MODE +FII32==000001 ;INPUT IS IN 32 BIT MODE + +; RIGHT HALF OF CONI + +FIDOWN==400000 ;IMP IS DOWN +FIWASD==200000 ;IMP WAS DOWN (OR IS) SINCE LAST RESET +;FIHSTR==100000 ;HOST READY IS SET ON + +;FIOEOT==040000 ;OUTPUT LAST IMP BIT IS ON +;FIOBSY==020000 ;OUTPUT IS BUSY AFTER DATAO +FIOD==010000 ;OUTPUT IS DONE, (INTERRUPTING) + +; 00X000 ;OUTPUT DONE PIA + +FILW==000400 ;LAST BIT SET FROM IMP +FIIBSY==000200 ;INPUT IS BUSY, WORD BEING ASSEMBLED FROM IMP +FIID==000100 ;INPUT IS DONE (INTERRUPTING) TO DO DATAI + +; 0000X0 ;CONTROL PIA + +; 00000X ;INPUT PIA + +IMPLW==FILW ;USEFUL TO TEST IN AC +IMP==FI ;USEFUL FOR BLKO, DATAO INSTR +] + +; IMP 1822 PROTOCOL INFORMATION (EXTENDED-LEADER VERSION) + +; The IMP leader is 96 bits long, usually organized as 3 words of 32 bits. +; For further details, these documents are available from the Network +; Information Center: +; IMP-HOST protocol: BBN Report No. 1822 +; NCP protocol: NIC 8246, Host-to-Host Protocol for the ARPANET +; IP, TCP: Internet Protocol Transition Workbook, and +; Internet Protocol Implementor's Guide +; +; For the benefit of the NCP code, ITS reads in the leader as 36-bit words +; with sufficient IMP padding (5 16-bit wds) to cause NCP data to be aligned +; on a word boundary. The first 4 words of the leader are read +; in 36-bit mode: +;------------------------------------------------------------------------ +;1: 4.9-4.6 not used (0) +; 4.5-4.2 all 1's for new format, else old msg type (4=old nop) +; 4.1-3.3 network number (0) +; 3.2-2.8 not used (0) +; 2.7 trace (ignored) +; 2.6-2.4 leader flags (2.6 is to be ignored, 2.5-2.4 are not used!) +; 2.3-1.5 message type (as of yore, but more bits) (see IMTDT) +; 1.4-1.1 high 4 bits of handling type (0) +; +;2: 4.9-4.6 Low bits of handling type (7 for big buffers, 4 for small buffers, +; 4.5-3.7 host number and 0 for the control link) +; 3.6-1.9 Imp number +; 1.8-1.1 Link number (high 8 bits of message-id) +; +;3: 4.9-4.6 Low 4 bits of message-id (0) +; 4.5-4.2 Sub-type +; 4.1-2.4 Message length (ignored) +; 2.3-1.1 Padding +;------------------------------------------------------------------------ +; All non-regular messages (ie Host-Imp, not Host-Host) +; stop here, since padding and data only exist for regular +; messages (Type 0). +;------------------------------------------------------------------------ +;4: 4.9-1.1 Padding +;------------------------------------------------------------------------ +; At this point there are still 32 bits of padding left. The +; Internet Protocol messages are vectored off here (they are +; identified by a message-type of 0 and a link-number of 233). +;------------------------------------------------------------------------ +; HOST-HOST REGULAR MESSAGES +; NETWORK CONTROL PROTOCOL (NCP) - read in 36-bit mode +;5: 4.9-1.5 Padding +; 1.4-1.1 M1 Host-host padding +; +;6: 4.9-4.6 M1 Host-host padding ; NCP leader contained in this word. +; 4.5-3.7 S Byte size +; 3.6-1.9 C Byte count +; 1.8-1.1 M2 Host-host padding +;------------------------------------------------------------------------ +; HOST-HOST REGULAR MESSAGES +; INTERNET PROTOCOL (IP) - read in 32-bit mode +;5: 4.9-1.5 Padding +;6: 4.9-1.5 First word of IP datagram +;------------------------------------------------------------------------ + +;In message types 2 and 6, the going-down status 16-bit word is +;in word 2 1.8-1.1 and word 3 4.9-4.2. + +;4.5-4.2 of word 3 are the padding count for type 4 (nop) from host. +;This is 5. Padding is only put on type-0 messages. + +IMTBP: 041000,,IMPILB+0 ;BYTE POINTER FOR MESSAGE TYPE FIELD +IMOTBP: 340400,,IMPILB+0 ; Byte ptr for message format type +IMLNBP: 001000,,IMPILB+1 ;BYTE POINTER FOR LINK NUMBER FIELD +IMSABP: 103000,,IMPILB+1 ; Byte ptr for source address field (host+imp) +IMSHBP: 301000,,IMPILB+1 ;BYTE POINTER FOR SOURCE HOST FIELD +IMSIBP: 102000,,IMPILB+1 ;BYTE POINTER FOR SOURCE IMP FIELD +IMSTBP: 340400,,IMPILB+2 ; Byte ptr for subtype field +IMCBBP: 301000,,IMPILB+5 ;BYTE POINTER FOR CONNECTION BYTE SIZE FIELD +IMBCBP: 102000,,IMPILB+5 ;BYTE POINTER FOR BYTE COUNT FIELD + + +SUBTTL ARPANET VARIABLES AND TABLES + +IFN NCPP,[ +IMPSTL==NNETCH ;SOCKET TABLE LENGTH (MUST BE .LE. 70) +IFG NNETCH-70,.ERR NNETCH SHOULD BE LESS THAN 70 OCTAL, PER BBN SPECS +];NCPP + +IFN INETP,[ +IMPCLP: 0 ; HACK!! # to use for control-link link field. +] +EBLK + +IMPN:: ;IMP DATA AREA CLEARED WHEN IMPUP +IFN INETP,[ +%IMXLN==:<<8159.-96.>+31.>/32. ; Max # of 32-bit words in IMP regular msg, + ; exclusive of leader and leader padding. = 252. +IMPIBS: 0 ; Saved initial BLKI pointer for IP datagram read +IMPIDP: 0 ; Pointer to IP datagram being input at PI level +IMPODP: 0 ; Pointer to IP datagram being output at PI level +IMPPSW: 0 ; Flip-flop to alternate output of IP and NCP msgs +] +IFN KAIMP,[ +IMPI: 0 ;-1 => IMPCHN INPUT INTERRUPT OCCURRED +IMPO: 0 ;-1 => IMPCHN OUTPUT INTERRUPT OCCURRED +IMPB: 0 ;-1 => IMPCHN FLAG INTERRUPT OCCURRED +IMPIH: 0 ;-1 => INPUT WANTS PIA = IMPCHN +IMPOH: 0 ;-1 => OUTPUT WANTS PIA = IMPCHN +] +IMPIS: 0 ;INPUT STATE + %ISIDN==:-1 ; Network shut off + %ISIDL==:0 ; Normal - idle, not expecting input (i.e. between msgs) + %ISIGN==:1 ; Ignore input until end of current message (36 bit mode) + %ISIML==:2 ; Reading IMP initial leader (36 bit mode) + %ISINC==:3 ; Reading NCP control message (32 bit mode) + %ISIND==:4 ; Reading NCP data message (32 or 36 bit mode) + %ISINL==:5 ; Reading NCP-type IMP leader (36 bit mode) + %ISIIL==:6 ; Reading IP-type IMP leader (32 bit mode) + %ISIID==:7 ; Reading IP datagram (32 bit mode) + +IMPOS: 0 ;OUTPUT STATE + %ISODL==:0 ; Not expecting output done (i.e. between messages) + %ISONC==:1 ; Sending NCP control message + %ISOND==:2 ; Sending NCP data message + %ISOID==:3 ; Sending IP Datagram + +IMPHI: 0 ;-1 TO HOLD UP INPUT + ;-2 INPUT IS SUCCESSFULLY HELD UP +IMRFCT: 0 ;NUMBER OF HOST TABLE ENTRIES WITH PENDING + ;TIMEOUTS FOR CONTROL-LINK RFNM OR RST-RRP. + +; ACTIVE HOST TABLE. Entries herein are allocated as needed, using garbage +; collection. Most "host number" fields are really indices into +; this table. +LIMPHT==+ ; NCP conns plus TCP conns plus a few extra +IMPHTN: BLOCK LIMPHT ; Host number. 1.1-1.8 HOST, 2.1-3.7 IMP +IMPHTB: BLOCK LIMPHT ;BITS: + ;4.9 1=RFNM WAIT ON LINK 0 (NCP) + ;4.8 GC MARK BIT + ;4.7-4.3 UNUSED + ;4.2-4.1 STATUS OF HOST 0 DOWN, 1 RST SENT, 2 UP + ;3.9-3.1 TIME (MOD 2**9) LAST RFNM SENT ON LINK 0 (NCP) + .SEE IMPHDS ;RH LAST MESSAGE FROM IMP ABOUT "HOST DEAD STATUS" +IMPHTC: BLOCK LIMPHT ; # active messages outstanding for host (8 max) +IMPHTT: BLOCK LIMPHT ; Time of last RFNM received + +IMNCS: 0 ;NUMBER OF CHANNELS BEING CLOSED +IMNAS: 0 ;NUMBER OF CHANNELS WITH 4.8 IN IMSOC5 SET +LIMPN==.-1 ;LAST LOCATION BLT'ED TO ZERO WHEN INITIALIZED +IMNBLK: 0 ; Number of times blockage avoided (output held up by ITS) +IMPHTF: -1 ;HOST TABLE FREE LIST, THREADED THROUGH IMPHTB, END WITH -1 +IMPUP: -1 ;0 => IMP UP ;-1 => DOWN ;-2 => COMING UP, PI LVL STILL OFF + ;1 => DOWN FOR GOOD, UNTIL NEXT TIME IMP READY LINE CHANGES +IMPTCU: 0 ;0 IMP UP/DOWN STATUS NOT CHANGING + ;>0 TRYING TO REINITIALIZE, SYS JOB HASN'T DONE SO YET + ;-1 HAS BEEN REINITIALIZED, HAVEN'T EXCHANGED NOPS YET +IMPUCT: 0 ;IMP COMING UP TIMEOUT, IF 4 NOOPS DON'T GO THROUGH PROMPTLY. +IMPDWN: BLOCK 3 ;LAST MESSAGE FROM IMP THAT IT IS GOING DOWN + ;WD0 "REASON" CLAIMED BY IMP (SEE CH 3 OF BBN REPORT 1822) + ;WD1 TIME WHEN EXPECTED DOWN + ;WD2 TIME WHEN EXPECTED UP (SYS TIME=1/30 SEC SINCE UP) +IFN KAIMP,IMPPIA: 0 ;CURRENT IMP PIA +IMPCNI: 0 ;CONI INTO HERE AT SLOW CLOCK LEVEL +IMERCN: -1 ;CONI INTO HERE WHEN NET GOES DOWN +IMNOPC: 0 ;< 0 => SEND NOPS +IMPA: 0 ;SAVE A AT IMPCHN PI LEVEL +IMPOAC: -1 ;-1 => OUTPUT INACTIVE +IMPERB: BLOCK 5 ;LAST "ERR" MESSAGE FROM A HOST + ;WD 0 TIME WHEN RCVD, WD 1 HOST, WD2-4 11. 9-BIT BYTES OF DATA +IFN DMIMP,IMPSUS: 0 ;HOLDS INPUT WORD WHILE INPUT IS HELD UP +IMPILB: BLOCK 6 ;INPUT LEADER BUFFER +IMPINB: BLOCK 30.+5 ;30. WORDS @ 32 BITS/WD = 120. 8 BIT BYTES + ;+5 WORDS FOR GOOD MEASURE + ;THIS BUFFER IS FOR CONTROL-LINK MESSAGES +BBLK + +IMHSBT: 330200,,IMPHTB(H) ;RST/RRP STATUS + +EBLK + +IMPCSH: -1 ;CURRENT SOURCE HOST (IMPHTB INDEX). -1 WHEN IDLE. +IMPCLN: 0 ;CURRENT LINK NUMBER +IMPCBS: 0 ;CURRENT BYTE SIZE +IMPCBC: 0 ;CURRENT BYTE COUNT +IMPNIW: 0 ;EXPECTED LAST BLKI ADDRESS +IMNWSI: 0 ;SECOND BLKI POINTER, ZERO IF NONE +IMPSVP: 0 ;SAVE PIA AT IMPRMP +IMPSVQ: 0 ;SAVE CONTROL MESSAGE QUEUE POINTER AT IMPOB2 +IMBLKI: 0 ;PLACE TO STORE BLKI POINTER +IMBLKO: 0 ;PLACE TO STORE BLKO POINTER +IMPNBI: 0 ;AMOUNT TO INCREMENT IMSMPC(I) BY, I.E. # OF DATA BYTES + ; IN MESSAGE CURRENTLY COMING IN AT P.I. LEVEL +IMPNBO: 0 ;AMOUNT TO INCREMENT IMSMPC(I) BY, I.E. # OF DATA BYTES THAT WILL BE + ; MADE FREE IN BUFFER BY MESSAGE CURRENTLY GOING OUT AT P.I. LEVEL +IMPNBT: 0 ;# BITS ACTUALLY BEING SENT, USED TO ADJUST ALLOCATION +IMPNPT: 0 ;NEW VALUE FOR IMSPIP(I) AFTER MSG IS SENT +IMPIPI: -1 ;IMSOC INDEX ACTIVE FOR INPUT AT P.I. LEVEL, OR -1 IF NONE +IMPOPI: -1 ;IMSOC INDEX ACTIVE FOR OUTPUT AT P.I. LEVEL, OR -1 IF NONE +IMOB0Z: 0 ;IMSMPP AT IMOBD1, FOR DEBUGGING + +;IMP OUTPUT LIST. EXECUTED AT PI LEVEL 1. +;NEGATIVE = BLKO POINTER, 0=STOP, 1=SET LAST WORD, 2=32-BIT MODE, 3=NOP +IMOPNT: 0 ;INDEX OF NEXT "INSTRUCTION" IN IMP OUTPUT LIST: +IMOLST: 0 ;BLKO FOR SECOND THROUGH SIXTH LEADER WORDS (FIRST IS DATAO'ED) +IMOMOD: 2 ;SWITCH TO 32-BIT MODE IF NECESSARY +IMOBK1: 0 ;FIRST BLKO POINTER +IMOBK2: 0 ;SECOND BLKO POINTER + 1 ;SET LAST WORD +IMOBK3: 0 ;THIRD BLKO POINTER (SEND LAST WORD, NOT USED WITH DM INTERFACE) + 0 ;STOP +IMOLDR: BLOCK 6 ;BUILD PREAMBLE HERE FOR DATA MESSAGES + +IMPNEA: 0 ;NUMBER OF ECOS IN COMMAND MESSAGE THAT HAVE BEEN ANSWERED +IMPNRA: 0 ;NUMBER OF RSTS ANSWERED + +;METERS +IFN INETP,[ +IMNIPI: 0 ; # of IP datagrams input (rcvd) +IMNIPF: 0 ; # of IP datagrams flushed (input threw away) +IMNIPO: 0 ; # of IP datagrams output (sent) +IMNIPR: 0 ; # of IP RFNMs received +IMNIP7: 0 ; # of IP Type 7 (Dest Host Dead) messages received +IMNIP8: 0 ; # of IP Type 8 (Error) msgs rcvd +IMNIP9: 0 ; # of IP Type 9 (Incomplete Transmission) msgs rcvd +IMNWIG: 0 ; # words ignored by "Ignore" state (%ISIGN) +IMNWIF: 0 ; # words flushed by IMPRM5 +] ;INETP +IFN NCPP,[ +IMNOSH: 0 ;# OF SHUFFLES OF NET OUTPUT BUFFERS +IMNISH: 0 ;# OF SHUFFLES OF NET INPUT BUFFERS +IMNSCM: 0 ;NUMBER OF SHORT CONTROL LINK MESSAGES +IMPNEI: 0 ;NUMBER OF ERPS NOT SENT +IMPNRI: 0 ;NUMBER OF RRPS NOT SENT +IMNRFC: 0 ;NUMBER OF RFCS CLSED +IMNRFI: 0 ;NUMBER OF RFCS IGNORED +IMNCLI: 0 ;NUMBER OF CLS IGNORED +IMNALI: 0 ;NUMBER OF ALLS IGNORED +IMNPIL: 0 ;NUMBER OF TIMES PI CONTROL QUEUE EXCEEDED +IMNCNS: 0 ;NUMBER OF CLS NOT SENT +IMNANS: 0 ;NUMBER OF ALLS NOT SENT +IMNMNC: 0 ;NUMBER OF REGULAR MESSAGES FOR NON-EXISTANT CONNECTIONS +IMNMAE: 0 ;NUMBER OF TIMES MSG ALL EXCEEDED +IMNMSS: 0 ;NUMBER OF TIMES MSG SHORT +IMNBAE: 0 ;NUMBER OF TIMES BIT ALL EXCEEDED +] ;IFN NCPP +IMPNPE: 0 ;NUMBER OF PROTOCOL ERRORS +IMNSRC: 0 ;NUMBER OF SPURIOUS RFNMS ON CONTROL LINK +IMNSRF: 0 ;NUMBER OF SPURIOUS RFNMS ON REG CONNECTIONS +IMNRFN: 0 ;NUMBER OF RFNMS NOT SENT +IMSTAS: 0 ;STATUS OF INPUT AT TIME HELD UP +IMPNIH: 0 ;NUMBER OF TIMES INPUT SUCCESSFULLY HELD UP +IMPNUH: 0 ;NUMBER OF TIMES INPUT HOLDUP UNDONE +IMRFTO==60.*30. ;RFNM WAIT TIME OUT +IFN NCPP,[ +IMNORH: 0 ;NUMBER OF STYNET OUTPUT RESETS DELAYED +;IMPRTO==30.*60. ;RESET TIME OUT (IDENTICALLY = IMRFTO) +IMPCTO==30.*30. ;CLS TIME OUT +IMFCTO==55.*30. ;RFC QUEUE TIME OUT - SHOULD BE LESS THAN 2*IMPCTO +IMPCMR: BLOCK 20 ;COUNT OF CONTROL MESSAGES RCD +IMPCMS: BLOCK 20 ;COUNT OF CTL MSG SENT +] ;IFN NCPP +IMPMSR: BLOCK 20 ;COUNT OF IMP MESSAGES RCD +IMPM1S: BLOCK 4 ; # Type 1 (Error in Leader) subtype msgs +IMPM9S: BLOCK 20 ; # Type 9 (Incomplete Transmission) subtype msgs +IMPMSS: BLOCK 1 ;COUNT OF IMP MSG SENT (WE ONLY SEND REGULAR MSGS) +IMCT1: 0 ;# TIMES AT IMPBKZ +IMCT2: 0 ;# TIMES AT IMPIBZ +IMCT3: 0 ;# TIMES AT IMPOBZ +BBLK + +SUBTTL ARPANET MAIN-PROGRAM LEVEL + +IMPINI: +IFN KAIMP,[ + CONO IMP,IMI32C + DATAI IMP,A + CONO IMP,IMPODC ;CLEAR OUTPUT DONE AND PIA + CONSZ IMP,IMPOD+7 ;CHECK OUTPUT DONE, PIA, CAUSE HOST READY + JRST 4,. ;CONO DIDN'T CLEAR SOME BITS? + CONO IMP,IMPIR+IMPHEC ;CLEAR HOST ERR, ENABLE INT ON IMP READY +] +IFN DMIMP,[ + CONO FI,FIRSET ;RESET IMP INTERFACE, SET HOST READY + CONO FI,FIHSTS +] + SETOM IMPIPI + SETOM IMPOPI + MOVE T,TIME + ADDI T,15. + CAMLE T,TIME + PUSHJ P,UFLS ;WAIT FOR HALF SECOND +IFN KAIMP,[ + CONO IMP,0 ;CLEAR "ENABLE IMP READY" INT (TURNS OFF IMP ERROR) + MOVEI A,NETCHN ;IDLE PIA + MOVEM A,IMPPIA + MOVE A,[JSR IMPIBK] + MOVEM A,IMPILC + MOVE A,[JSR IMPOBK] + MOVEM A,IMPOLC +] +IFN DMIMP,CONO FI,FIIWDC ;CLEAR "IMP WAS DOWN" +IFN NCPP,[ + MOVSI I,-IMPSTL +IMPINA: SKIPE IMSOC6(I) + JRST 4,. + SETZM IMSOC1(I) + AOBJN I,IMPINA +] ;IFN NCPP + SETZM IMPILC+1 + SETZM IMPOLC+1 + SETOM IMPOAC + SETOM IMPUP ;NOT UP YET + MOVNI A,20. ;ALLOW 10 SECONDS TO COME UP + MOVEM A,IMPUCT + SETOM IMPTCU ;TRYING TO COME UP + SETOM IMPHTF ;WILL GC IMPHTB ON FIRST REFERENCE +IFN NCPP,[ + SETOM IMPMPU + SETOM IMPMPL + SETOM IMPNCQ + SETOM IMPLCQ + MOVEI I,IMNPIC + MOVEM I,IMFCQL + MOVEI A,IMPCQ + MOVEM A,IMFFCQ + JRST IMPIN1 + +IMPIN2: ADDI A,IMPMQS+1 + MOVEM A,-IMPMQS-1(A) +IMPIN1: SOJG I,IMPIN2 + SETOM (A) + SETOM IMPBPQ + SETOM IMPEPQ + MOVEI A,IMPPQ + MOVEM A,IMFFPQ + MOVEI I,IMNPQ + JRST IMPIN4 + +IMPIN3: ADDI A,4 + MOVEM A,-4(A) +IMPIN4: SOJG I,IMPIN3 + SETOM (A) + MOVEI A,NETSRS + MOVEM A,NRSOC +];NCPP + MOVE A,[IMPN,,IMPN+1] + SETZM IMPN + BLT A,LIMPN + SETOM IMPIS ; Say IMP shut off + MOVE T,TIME + MOVEM T,LNETIM +IFN KAIMP,CONO IMP,NETCHN +IFN DMIMP,[ + CONSZ FI,FIDOWN+FIWASD ;SKIP IF STILL UP + POPJ P, ;LOSE IF NOT IMP UP + CONO FI,FIIN\FIIBSY+NETCHN*11 + CONO FI,FIOUT+NETCHN*11 +] + SETOM IMPDWN+1 ;TIME FOR IMP TO GO DOWN, NOT KNOWN + ;MOVE T,TIME + ADDI T,15. + CAMLE T,TIME + PUSHJ P,UFLS + SETZM IMPIS ; Say up but idle + MOVNI A,4 + MOVEM A,IMNOPC ;SEND 4 NOPS +IMPOST: CONO PI,NETOFF +IFN DMIMP,[ + CONSO FI,70 ;SKIP IF PIA NON-ZERO + JRST NETONJ ;IF NO PIA, THEN DONT SET INT +] +IFN KAIMP,MOVE TT,IMPPIA ;MAIN PROGRAM OUTPUT START + AOSN IMPOAC ;SKIP IF OUTPUT ALREADY ACTIVE +IFN KAIMP, CONO IMP,IMPODS(TT) ;GENERATE OUTPUT INTERRUPT +IFN DMIMP, CONO FI,FIODS+NETCHN*11 + JRST NETONJ + +IMPIOS: +IFN KAIMP,[ + AOSE IMPOAC ;PI LEVEL OUTPUT START + POPJ P, + PUSH P,TT + CONO PI,400 ;TURN PI OFF, IMP MAY HAVE PIA = 1 + MOVE TT,IMPPIA + CONO IMP,IMPODS(TT) + CONO PI,200 + POP P,TT +]IFN DMIMP,[ + AOSN IMPOAC + CONO FI,FIODS+NETCHN*11 +] + POPJ P, + + + +;Check if IMP ready line is set +; Called from SYSJOB. +; Return +1 if IMP not ready, +2 if so +; +IMPCKR: +IFN DMIMP,[ + .ERR IMPCKR Missing for DMIMP! +] +IFN KAIMP,[ + CONSZ IMP,IMPR ;Skip if IMP not ready + AOS (P) ;Return +2 if ready + POPJ P, +] + + +SUBTTL HOST-TABLE MANAGEMENT + +; FNDHST - Look up host-table index for a given IMP host address. +; Call with NETOFF or NETCHN PI in progress. +; T/ IMP host address (maybe someday other nets?) +; Returns .+1 if failed (no room in table) +; Returns .+2 +; H/ host-table index +; Smashes W. + +FNDHST: MOVEI H,LIMPHT-1 ;SEARCH FOR AN ENTRY FOR THIS HOST + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,POPJ1 ;FOUND + SKIPGE H,IMPHTF ;NOT FOUND, CONS ONE OFF FREE LIST + JRST FNDHS1 ;OOPS, MUST GARBAGE COLLECT + MOVE W,IMPHTB(H) +IFN INETP,[ ; Later make this check standard! + CAIGE H,LIMPHT ; Make sure H is valid idx + CAIL W,LIMPHT ; ditto W + BUG HALT,[NET: FNDHST idx clobbered!!!] +] + MOVEM W,IMPHTF + MOVEM T,IMPHTN(H) + SETZM IMPHTB(H) ;NOTHING IS KNOWN ABOUT THIS HOST + SETZM IMPHTC(H) ; Assume no RFNMs outstanding + SETZM IMPHTT(H) ; Clear out time of last RFNM. + JRST POPJ1 + +; Host-Table full, attempt to GC it and flush unused entries, by +; scanning all possible pointers into table. +; IMP pointers are IMPCSH and IMPHTC(H) +; NCP pointers are IMSOC4<3.9-4.7>, RFC queue, PI ctl msg queue, +; and the RFNM-wait and RST-sent bits in table. +; TCP pointers are XBNADR(I) + + ; GC mark phase - mark entries in use +FNDHS1: PUSH P,I + MOVSI W,200000 ;MARK BIT + MOVEI H,LIMPHT-1 ;CLEAR ALL MARK BITS + ANDCAM W,IMPHTB(H) + SOJGE H,.-1 + SKIPL H,IMPCSH ;MARK FROM IMPCSH + IORM W,IMPHTB(H) + +IFN TCPP,[ + MOVEI I,XBL-1 + SKIPL H,XBNADR(I) ; See if TCP conn has a net addr specified + IORM W,IMPHTB(H) ; Yes, set the mark bit. + SOJGE I,.-2 +] ;IFN TCPP +IFN NCPP,[ + MOVEI I,IMPSTL-1 ;MARK FROM IMSOC4 +FNDHS2: SKIPN IMSOC1(I) ;SKIP IF IMSOC4 IS BEING USED BY ANYONE + SOJGE I,FNDHS2 + JUMPL I,FNDHS3 + LDB H,IMSCFH + CAIE H,377 + IORM W,IMPHTB(H) + SOJGE I,FNDHS2 +FNDHS3: MOVE I,IMPBPQ ;MARK RFC PENDING QUEUE + JUMPGE I,[ LDB H,[101000,,3(I)] + IORM W,IMPHTB(H) + MOVE I,(I) + JRST . ] + MOVE I,IMPNCQ ;MARK CONTROL QUEUE + JUMPGE I,[ HLRZ H,1(I) + IORM W,IMPHTB(H) + MOVE I,(I) + JRST . ] +] ;NCPP + + ; GC sweep phase - free all unmarked entries + SETO I, ;FREE POINTER + MOVEI H,LIMPHT-1 + MOVSI W,601000 ;PROTECT IF RFNM-WAIT, RST-WAIT, OR MARKED +FNDHS4: + SKIPG IMPHTC(H) ; Also protect if any outstanding RFNMs + TDNE W,IMPHTB(H) + SOJGE H,FNDHS4 + JUMPL H,FNDHS5 + SETZM IMPHTN(H) ;DON'T BELONG TO ANY HOST + MOVEM I,IMPHTB(H) ;CONS ONTO FREE LIST + MOVE I,H + SOJGE H,FNDHS4 +FNDHS5: MOVEM I,IMPHTF ;FREE LIST + POP P,I + SKIPGE IMPHTF + POPJ P, ;GC-OVERFLOW + JRST FNDHST ;TRY AGAIN, SHOULD WIN + +SUBTTL ARPANET INPUT INTERRUPT LEVEL + +COMMENT | + The IMP interrupt level structure is fairly complicated and +deserves some explanation. Because the IMP interface is not a DMA +device, all I/O is done "by hand", a word at a time; for this reason +all I/O is done at PI level IMPCHN=1 (the highest) whenever possible. +However, to prevent general IMP processing from taking complete +precedence over everything else, all non-I/O handling is done at +PI level NETCHN=2, which is the same level as disk devices. + The MIT-DMS interface (DMIMP) is much more complicated than the +AI-KA/ML/MC interface and was designed to facilitate this dual-level +interrupt processing by providing different PI channel assignments +for each of 3 possible conditions: + Input Done (must usually read next word) + Output Done (must usually output next word) + Control Int (some unusual condition, including Last-IMP-Word) + +Because the non-DM interface only has one PI assignment available, +the software to switch levels is much more complicated. For either +case, the code will not make sense unless you understand the channel 1 +multiplexing feature (see interface CONI bit descriptions). +| + +; Here when IMP interface is interrupting at PI level 2 (NETCHN) +; TT has CONI bits. Can clobber most ACs + +IMPINT: +IFN KAIMP,[ + AOSN IMPB ; PI 1 control interrupt? + JRST IMPBKZ ; Yes + AOSN IMPI ; PI 1 Input Done interrupt? + JRST IMPIBZ ; Yes + AOSN IMPO ; PI 1 Output Done interrupt? + JRST IMPOBZ ; Yes already + TRNE TT,IMPLW+IMPHER+IMPERR ; No PI 1 ints, check status bits + JRST IMPBKZ ; PI 2 Control interrupt (error or Last Imp Word) + TRNE TT,IMPID + JRST IMPIBZ ; PI 2 Input Done + TRNE TT,IMPOD + JRST IMPOBZ ; PI 2 Output Done +]IFN DMIMP,[ + TRNE TT,FILW+FIWASD+FIDOWN + JRST IMPBKZ ; PI 2 Control interrupt (error or Last Imp Word) + TRNE TT,FIID + JRST IMPIBZ ; PI 2 Input Done + TRNE TT,FIOD + JRST IMPOBZ ; PI 2 Output Done +] + JRST 4,. ; Must be one of above!! + +IFN KAIMP,[ +; IMPIBK - Default PI 1 Input Done routine, called from IMPILC. +; We're idling, switch to PI 2 to handle the input +; (normally 1st word of new IMP message) +EBLK +IMPIBK: 0 +BBLK + SETOM IMPI ; Set flag saying PI 1 Input Int seen + CONO IMP,NETCHN ; Switch PIA to 2 + JRST 12,@IMPIBK ; Go re-interrupt, will get to IMPINT->IMPIBK +] + +IFN KAIMP,[ + +; IMPBRK - PI 1 Control interrupt, called from PI0LOC+2 (= 42 on KA's) +; which is the standard PI 1 vector location. +; Again, switch to PI 2 to handle the condition +; (typically Last Imp Word seen on input) +EBLK +IMPBRK: 0 ; This interrupt is to 42, may not be the IMP +BBLK + CONSO IMP,IMPLW+IMPHER+IMPERR ; This really from the IMP? +IFE NEWDTP,JRST RC1INT +IFN NEWDTP,JRST IMPBR1 + SETOM IMPB ; Yes, re-interrupt and handle at NETCHN level + CONO IMP,NETCHN ; Switch PIA to 2 (NETCHN) + JRST 12,@IMPBRK ; Go re-interrupt, will get to IMPINT->IMPBKZ + +IFN NEWDTP,[ +IMPBR1: CONSZ DTC,70 ; Allow for non-IMP interrupt on PI chan 1 + JRST 12,@IMPBRK +] + +RC1INT: MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@IMPBRK +];IFN KAIMP + +; IMPRM4 - PI 1 Input-Done handler during readin of IMP data (not leader) +; BLKI has run out but haven't yet gotten Last Imp Word! +; Either read more (if 2nd ptr specifed) or ignore following data. +EBLK +IMPRM4: 0 +BBLK + MOVEM A,IMPA ; Save A + SKIPL A,IMNWSI ; Second BLKI pointer exists? + JRST IMPRM6 ; Nope, none now + MOVEM A,IMBLKI ; Yes, store it! + SETZM IMNWSI ; Clear this flag so don't do it again + MOVE A,IMPA ; Restore A + JRST 12,@IMPRM4 ; Return, continuing BLKI. + +IMPRM6: MOVE A,[JSR IMPRM5] ; Ugh! Ignore additional input + MOVEM A,IMPILC ; Set up new vector to "ignore" routine + MOVE A,IMPA + JRST 12,@IMPRM4 + +; IMPRM5 - PI 1 Input-Done handler while ignoring IMP data, only +; set up by IMPRM6 above. +; Just reads a word and ignores it. This loop is broken +; by a control interrupt when Last-Imp-Word is seen. +EBLK +IMPRM5: 0 ; Hmm? Flush input at PI 1 +BBLK + DATAI IMP,IMPA +IFN INETP,AOS IMNWIF ; See how often we come here. + JRST 12,@IMPRM5 + +; IMPIBZ - PI 2 (NETCHN) "Input Done" interrupt, via IMPINT. +; Note there is one input word waiting in the IMP interface, +; but it is NOT the last IMP word (if it was, we would get a +; control interrupt and go to IMPBKZ instead). This situation +; should only happen while reading the IMP leader and there is +; more input than just the leader, i.e. it is a NCP or IP message. +; This is also where we come after being in idle state. +; TT/ IMP CONI word + +IMPIBZ: AOS IMCT2 +IFN DMIMP,[ + TRC TT,IMPCHN ;FIND IF INPUT PIA=IMPCHN + TRNN TT,7 + JRST IMPRET ;YES, ALREADY HANDLED BY IMPCHN +];DMIMP +IFE INETP,[ ; Note IP datagram is read in 32-bit mode! +IFN DMIMP,TLNE TT,FII32 +IFN KAIMP,TRNE TT,IMPI32 + JRST 4,. ; NCP-only, leader should always be read in 36-bit mode +] ;IFE INETP + MOVE C,IMPHI + SKIPN B,IMPIS ; Skip hold-up check unless at start of msg (idle) + AOJE C,IMPBKW ; Jump if input needs to be held up (can only do at start or end of msg) +IFE INETP,CAILE B,%ISIML +IFN INETP,CAILE B,%ISIID + JRST 4,. ; Unknown input state + JRST @.+2(B) ; Dispatch, note data not read yet + + IMPIGN ;-1 Supposed to be shut off, go ignore message. + OFFSET -. + %ISIDL:: IMSTR1 ; 0 Was idle, this is start of a message! + %ISIGN:: IMPIGN ; 1 Ignoring this message. +IFE INETP,%ISIML:: IMPLD2 ; 2 Reading IMP leader, see what we got. +IFN INETP,[ + %ISIML:: [JRST 4,.] ; 2 Should only see %ISINL or %ISIIL + %ISINC:: [JRST 4,.] ; 3 Was reading control msg! Runout is error. + %ISIND:: [JRST 4,.] ; 4 Was reading NCP data msg! Runout is error. + %ISINL:: IMPLD2 ; 5 Was reading NCP IMP leader + %ISIIL:: IMPLD2 ; 6 Was reading IP IMP leader. + %ISIID:: [JRST 4,.] ; 7 Was reading IP datagram! Runout is error. +] ;INETP + OFFSET 0 + +IMPIGN: DATAI IMP,A ; Ignore input (only come here via table above) +IFN INETP,AOS IMNWIG ; See how often we come here. + ;JRST IMPRET + + ; All routines dispatched to from IMPIBZ should return via IMPRET. +IMPRET: +IFN DMIMP,CONI FI,A + SKIPN IMPIS ; Skip if input not in normal (idle) state +IFN KAIMP, CONSO IMP,IMPI32 ; It is, see if input is in 32-bit mode +IFN DMIMP, TLNN A,FII32 + JRST .+2 + JRST 4,. ; Shouldn't be in 32 bit mode in normal state +IFN KAIMP,CONO IMP,@IMPPIA ; Switch to desired exit PIA + JRST IMPEX + +; IMPBKZ - PI 2 (NETCHN) Control interrupt, via IMPINT. +; Error or Last Imp Word on input. +; TT/ IMP CONI word + +IMPBKZ: AOS IMCT1 ; Bump count of control interrupts +IFN KAIMP,TRNE TT,IMPERR+IMPHER ; See if error or last-imp-word. +IFN DMIMP,TRNE TT,FIWASD+FIDOWN + JRST IMPBER ; Jump if IMP Error or Host Error + + ; Not an error, interface has Last Imp Word ready for DATAI'ing! + MOVE B,IMPHI ; Check here to see if input should be held up + AOJN B,IMPBKX ; Jump if not. + + ; Input must be held up. Also enter here from IMPIBZ if + ; at start of message (only other time input can be held up). +IMPBKW: +IFN KAIMP,CONO IMP,IMPIDC ; Clear Input Done so we don't re-interrupt +IFN DMIMP,[ + CONO FI,FISUSP ; Suspend input, no bits accepted after DATAI + DATAI FI,IMPSUS ; Have to read word now + CONO FI,FIIDC+NETCHN_3 ; Have to do this to clear IMP Last Word +] ; (also to clear Input-Done PIA) + SOS IMPHI ; Set -2 to indicate successfully held up + MOVEM TT,IMSTAS ; Save status (CONI bits) + AOS IMPNIH ; Bump meter - count of times input was held up. + JRST IMPRET + +; IMPBKX - Auxiliary to IMPBKZ, PI 2 Control Interrupt +; Have got Last Imp Word and not holding up input, so go +; handle end of IMP message. + +IMPBKX: +IFN KAIMP,[ + MOVE A,[JSR IMPIBK] ; Get rid of input BLKI + MOVEM A,IMPILC ; Replace with default switch-PIA vector + SETZM IMPIH ; Say don't need PI 1 for input any more. + MOVEI A,NETCHN ; And change exit PIA to 2 + SKIPL IMPOH ; Unless output side still needs PI 1. + MOVEM A,IMPPIA ; Set value of PI level desired on exit. + CONO IMP,IMI32C ; Put back in 36 bit mode to start next msg + DATAI IMP,A ; Get the last input word for processing +]IFN DMIMP,[ + CONO FI,FII32C+FISUSP ; Hold up bits for following clear + DATAI FI,A ; Get last input word + CONO FI,FIIDC+FIIBSY+NETCHN*11 ; Now clear Last-Imp-Word +] + ; Enter here from IMOB6 if input had been held up. +IMPBKV: SKIPGE B,IMPIS ; Unless network has been shut off + JRST IMPRET ; (in which case ignore input) + JRST @IMSDT2(B) ; then go process end of IMP message. + +IMSDT2: OFFSET -. + %ISIDL:: IMPBKN ; 0 Was idle - leader only 1 word long?? + %ISIGN:: IMPIRT ; 1 Ignore input + %ISIML:: IMPLD1 ; 2 End of IMP leader - can't be regular msg + %ISINC:: IMPBK3 ; 3 End of NCP control message + %ISIND:: IMPRMB ; 4 End of NCP data input +IFN INETP,[ + %ISINL:: IMPLD1 ; 5 End of NCP IMP leader?? Probably error. + %ISIIL:: IMPLD1 ; 6 End of IP IMP leader?? Probably error. + %ISIID:: IMPRMI ; 7 End of IP datagram +] ;INETP + OFFSET 0 + +; Here from table above for old-type leader (1 word) +; IMPBN1 is used by IMPLD2 if long leader has wrong format. + +IMPBKN: MOVEM A,IMPILB ; Store first (and only) word of leader +IMPBN1: LDB A,IMOTBP ; Get message format type + CAIN A,4 ; Old-type NOP? + JRST IMPIRT ; Just ignore it. + CAIN A,16 ; Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE A,17 ; Is it not the long-leader format? + BUG INFO,[IMP: Old-type leader],OCT,IMPILB + JRST IMPIRT ; Ignore rest of message, if any + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; IMP LEADER READING/DISPATCH ;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; Code on this page handles the initial processing of +;;; IMP messages and dispatches to the appropriate +;;; routines for each message type. Only Type 0 ("Regular") +;;; messages carry Host-Host traffic. + +; Here from IMPIBZ only, to handle first word of an IMP message. +; (It's not the last word or IMPBKZ would complain about it) +; Set up a BLKI to get the rest of the leader. + +IMSTR1: DATAI IMP,A ; Get 1st word from interface + ; Entry point from IMPOB6 only to restart input from "held-up" state + ; First word already in A +IMSTRT: MOVEM A,IMPILB ; Store first word of leader + MOVEI C,%ISIML ; Set new state = reading rest of IMP leader +IFE INETP,MOVE B,[-4,,IMPILB] ; If not diverting IP, ask for it all. +IFN INETP,MOVE B,[-2,,IMPILB] ; Must vector IP, ask for max 36-bit wds + JRST IMPRM9 ; Go read the leader. + +; The code at IMPLD5 will switch to 32-bit mode at right place if +; the message turns out to be an IP datagram. Otherwise the message +; is either a NCP Host-Host message, or an IMP-to-Host note of some kind; +; both stay in 36-bit mode. + +; Here from IMPBKX only for a leader not followed by any data. +; Last word in A, IMPLW flag in TT. +IMPLD1: AOS B,IMBLKI ; Update pointer to buffer + MOVEM A,(B) ; and store last word in right place. + ; Fall through to handle what should be an IMP-Host note. + ; The IMPLW flag distinguishes this entry point from IMPLD2, + ; so we know there isn't a data word in the interface. + +; Here from IMPIBZ only, for an IMP leader with more data following; +; almost certainly a "Regular" host-host message. The 2 possible +; states are: +; %ISINL - NCP, in 36-bit mode, have read 5 wds and 6th awaits. +; %ISIIL - IP, in 32-bit mode, have read 4 wds and 5th awaits. +; We can't DATAI the current word from the interface until we know +; what mode the remaining data should be read in. + +IMPLD2: +IFN KAIMP,TRNE TT,IMPI32 +IFN DMIMP,TLNE TT,FII32 +IFE INETP, JRST 4,. ; Input was in 32 bit mode when shouldn't! +IFN INETP,[JRST [MOVE B,IMPIS ; If reading IP IMP leader then 32 bit OK. + CAIE B,%ISIIL ; Leader read in 32-bit mode, must be IP. + JRST 4,. ; It isn't??? + JRST .+1] +] ;INETP + LDB T,IMOTBP ; Examine new-format flag bits of leader + CAIN A,16 ; Is it 1822L format? + BUG INFO,[IMP: 1822L leader],OCT,IMPILB + CAIE T,17 ; to verify that leader is "new" 96-bit fmt. + JRST IMPBN1 ; Something else?? Go discard. + HRRZ B,IMBLKI ;-> LAST WORD READ + CAIGE B,IMPILB+2 ;MUST BE AT LEAST 3 WORDS TO BE VALID + JRST IMPLD3 + LDB T,IMLNBP ; Extract link number (high 8 bits of msg-id) +IFN INETP,[ + CAMN T,IMPCLP ; HACK! If it matches our specified ctl link + SETZ T, ; number, then make it look like ctl link! +] + MOVEM T,IMPCLN + LDB T,IMSABP ; Get arpanet address (source host+imp) +IFN 0,[ LDB T,IMSHBP ;SOURCE HOST + LDB A,IMSIBP ;SOURCE IMP + DPB A,[112000,,T] ;FORM HOST ADDRESS +] ;ifn 0 + PUSHJ P,FNDHST ;H GETS HOST TABLE INDEX + JRST IMPLD9 ;HOST TABLE FULL + MOVEM H,IMPCSH ;SAVE CURRENT HOST + LDB A,IMTBP ;GET MESSAGE TYPE IN A + CAILE A,10. + JRST IMPUN ;UNKNOWN TYPE + AOS IMPMSR(A) ;COUNT IMP MSGS RCD + JRST @IMTDT(A) ;DISPATCH + +IMTDT: IMPRM ; 0 Regular Message + IMPBE1 ; 1 Error in Leader (no msg-id) + IMPGD ; 2 IMP Going Down + IMPUN ; 3 - + IMPIN ; 4 NOP + IMPRFN ; 5 RFNM - Ready For Next Message (transmit succeeded) + IMPHDS ; 6 Host Dead Status (general info) + IMPDHD ; 7 Destination Host Dead (transmit failed) + IMPBE8 ; 8 Error in Data (has msg-id) + IMPINC ; 9 Incomplete Transmission (transmit failed temporarily) + IMPIRS ;10 Interface Reset - IMP dropped its ready line + +IMPLD9: BUG INFO,[IMP: Message discarded due to host table full],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + JRST IMPIRT + +; Here from IMPLD2 if leader is too short +IMPLD3: SUBI B,IMPILB-1 ;# WDS READ + BUG INFO,[IMP: Short leader, ],DEC,B,[wds. WD1=],OCT,IMPILB,[WD2=],OCT,IMPILB+1 + ;JRST IMPIRT ;FLUSH REST OF MESSAGE + +;;; IMP->Host Type 4 - NOP + +IMPIN: JRST IMPIRT ; One more nop from IMP + +;;; IMP->Host Type 10 - Interface Reset + +IMPIRS: BUG INFO,[IMP: Interface-reset msg] + JRST IMPIRT ; Probably nothing useful to do about it. + +;;; IMP->Host Type X (e.g. 3, 11-255) - bad type + +IMPUN: BUG INFO,[IMP: Unknown msg type ],OCT,A,[ leader ],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 + ;JRST IMPIRT + +IFE NCPP,[ +IMPBK3:: ;Ignore NCP messages +IMPRMB:: +];NCPP + +; Here from all over, to flush rest of this message. +; All non-regular messages (not type 0) return here, as well as some +; errors with regular msgs. +; TT says whether there is any more data to read from this message. +IMPIRT: SETZM IMPIS ; Assume end of message, reset to normal state + TRNN TT,IMPLW ; But if we haven't yet read the last word, + AOSA IMPIS ; then change state to "Ignore" and flush input. + ; Note skip over following SETZM. + +; Regular messages (type 0) return here, when we already know this message +; was completely read. TT isn't valid. +IMPIR1: SETZM IMPIS ; Reset to normal idle state + SETOM IMPCSH ; Say no current host +IFN KAIMP,CONO IMP,IMI32C ; Put world back in 36 bit input mode +IFN DMIMP,CONO FI,FII32C+NETCHN*11 + JRST IMPRET + +;;; IMP->Host Type 0 - Regular Host-Host message +; Unless the source host screwed up and sent a dataless message, +; there is a word waiting to be read from the interface. +; For IP this is the 5th word and we are in 32-bit mode. +; For NCP it's the 6th (the NCP leader) and we're in 36-bit mode. +; TT/ IMP CONI bits, +; B/ addr of last wd input (counted-out BLKI pointer) + +IMPRM: TRNE TT,IMPLW + JRST IMPRM3 ; Foo, message shouldn't end so soon. Go barf. +IFE INETP,[ + CAIE B,IMPILB+4 ; Check that host-host leader word is next in + JRST IMPLD3 ; Barf + SKIPE IMPCLN ; Skip if link 0 - NCP control msg + JRST IMPRMD ; Data message, go read into user buffer. +] +IFN INETP,[ + SKIPN A,IMPCLN ; Skip unless NCP control link message + JRST IMPRM1 ; NCP control message, go handle it. + CAIE A,233 ; Is link number the magic cookie for IP? +IFN NCPP, JRST IMPRMD ; No, go handle as NCP data message. +IFE NCPP, JRST IMPIRT ; No, ignore it if we don't have NCP + + ; This is an Internet Protocol datagram. Make sure we are + ; in right mode for reading. + AOS IMNIPI ; Bump count of IP datagrams received +IFN KAIMP,TRNN TT,IMPI32 ; Should already be in 32-bit mode +IFN DMIMP,TLNN TT,FII32 + BUG PAUSE,[IMP: Reading IP dgm in 36-bit mode] + DATAI IMP,IMPILB+4 ; Okay, read in the padding and get going. + MOVEI A,%IMXLN ; Specify max size of IMP message + ; (we can't trust msg-len leader field) + PUSHJ P,IPGIPT ; Call IP module - get input buffer pointer + JRST [ AOS IMNIPF ; Punted, bump cnt of datagrams lost + JRST IMPIRT] ; Flush this message (err msg already printed) + MOVEM A,IMPIDP ; Save datagram pointer + MOVEM B,IMPIBS ; Save input BLKI pointer for later check + MOVEI C,%ISIID ; Set state = reading IP datagram + JRST IMPRM9 ; Go do it. + +IMPRM1: CAIE B,IMPILB+4 ; NCP control message, check that NCP leader is next + JRST IMPLD3 ; Barf, short message?? +] ;INETP +IFN KAIMP,CONO IMP,IMI32S ; NCP control message, set 32-bit mode +IFN DMIMP,CONO FI,FII32S+NETCHN*11 + DATAI IMP,IMPILB+5 ; Get NCP leader word + LDB A,IMCBBP + MOVEM A,IMPCBS ; Byte size + LDB B,IMBCBP + MOVEM B,IMPCBC ; Byte count + CAIN A,8 ; Byte size should be 8 for control link + CAILE B,120. ; Byte count shouldn't be > 120. + JRST IMPBCM + ADDI B,3 + LSH B,-2 ; Number of words necessary + MOVEM B,IMPNIW ; Number of input words expected + HRLOI B,-1(B) + EQVI B,IMPINB-1 ; BLKI pointer + MOVEI C,%ISINC ; New state = reading NCP control message + +; Set up BLKI. Pointer in B, state in C. +; This place is jumped to by several things that initiate IMP input, +; specifically IMSTRT, IMPRMT, and IMPRM. + +IMPRM9: MOVEM C,IMPIS + MOVEM B,IMBLKI + MOVE B,[BLKI IMP,IMBLKI] + MOVEM B,IMPILC + MOVE B,IMPBRO(C) ; Get BLKI runout instruction and set vector; + MOVEM B,IMPILC+1 ; will execute when ptr counts out. +IFN KAIMP,[ + SETOM IMPIH ; Say that input wants high pri + MOVEI B,IMPCHN ; And set our exit PIA to it (IMP) + MOVEM B,IMPPIA +] +IFN DMIMP,CONO FI,NETCHN_3+IMPCHN ; Set control PIA = NET, input done = IMP + + JRST IMPRET + + ; This table holds the instruction to execute after the input + ; BLKI has counted out the ptr and stored the current input word. + ; Note that if the IMP message ends during the BLKI, a control + ; interrupt will happen instead and control goes to IMPBKZ->IMPBKX + ; where there is another state dispatch table. + ; Normally only %ISIML and %ISINL actually use these instructions; + ; the other states are impossible or expect to read the entire + ; remaining message. +IMPBRO: OFFSET -. + %ISIDL:: JRST 4,IMPBRO ; 0 Idle - shouldn't be BLKI'ing. + %ISIGN:: JRST 4,IMPBRO+1 ; 1 Ignore - shouldn't be BLKI'ing. + %ISIML:: + IFE INETP,JSR IMPLD4 ; 2 Reading IMP leader (5 wds partial msg) + IFN INETP,JSR IMPLD5 ; 2 Reading IMP leader (4 wds partial msg) + %ISINC:: JSR IMPRM4 ; 3 Reading NCP control message (get all) + %ISIND:: JSR IMPRM4 ; 4 Reading NCP data (get all) +IFN INETP,[ + %ISINL:: JSR IMPLD4 ; 5 Reading NCP IMP leader (partial msg) + %ISIIL:: JSR IMPLD4 ; 6 Reading IP IMP leader (partial msg) + %ISIID:: JSR IMPRM4 ; 7 Reading IP datagram (get all) +] ;INETP + OFFSET 0 + +IMPRM3: LDB B,IMBCBP ;BYTE COUNT OF EMPTY CONTROL LINK MESSAGE + JUMPE B,IMPIRT + AOS IMPNPE ;NO TEXT BUT BYTE COUNT NOT ZERO + BUG INFO,[NCP: CTL MSG NO TXT, BC NOT 0. HST ],OCT,IMPHTN(H),[BC],DEC,B + JRST IMPIRT + +IFN INETP,[ +EBLK ; PI 1 Input Done interrupt (from IMPILC+1, runout) +IMPLD5: 0 ; JSR here on BLKI runout after reading 3rd wd of IMP leader. +BBLK ; Input Done is not set, because BLKI just turned it off. + MOVEM A,IMPILC ; Save A + MOVE A,[JSR IMPLD6] ; Make very next input word interrupt to IMPLD6 + EXCH A,IMPILC ; Do it, restore A + JRST 12,@IMPLD5 + +EBLK ; PI 1 Input Done interrupt (from IMPILC) +IMPLD6: 0 ; JSR here with 4th wd of leader in interface. +BBLK ; Must decide whether to continue reading leader in + ; 36-bit mode (NCP) or 32-bit mode (IP). + MOVEM A,IMPILC ; Save A + MOVE A,IMPILB+1 ; Get word with link number in it + ANDI A,377 ; Mask off + CAIN A,233 ; Internet Protocol "link"? + JRST IMPLI3 ; Yes! Go handle it. + + ; NCP read will immediately store current 36-bit word (4th), + ; store another 36-bit word (5th), and then run out to IMPLD4. + MOVE A,[-2,,IMPILB+2] ; Reading NCP message. + MOVEM A,IMBLKI + MOVEI A,%ISINL ; Reading NCP leader, set state thereto. + MOVEM A,IMPIS + MOVE A,[JSR IMPLD4] ; And change dispatch vector. + MOVEM A,IMPILC+1 + MOVE A,[BLKI IMP,IMBLKI] + EXCH A,IMPILC ; Set up BLKI and restore A + JRST 12,@IMPLD6 ; Return. Note current input word is still waiting. + + ; IP read will immediately store current 36-bit word (4th), + ; then set up so next input-done interrupt (on 5th, 32-bit word) + ; goes directly to IMPIBZ->IMPLD2 with NETCHN PI. + ; (For AI-KA/MC/ML, perhaps by way of IMPIBK if output is active) +IMPLI3: MOVEI A,%ISIIL ; Say reading IP type leader. + MOVEM A,IMPIS +IFN KAIMP,CONO IMP,IMI32S+IMPCHN ; Set further input to 32-bit mode +IFN DMIMP,CONO FI,FII32S+NETCHN_3+IMPCHN + DATAI IMP,IMPILB+3 ; Store the 4th 36-bit word immediately; this + ; also starts interface reading the 5th word. +IFN KAIMP,[ + MOVE A,IMPLD6 ; Now must set up for next interrupt. + MOVEM A,IMPLD4 ; Fake out the common code below + JRST IMPLI4 ; Set up for next Input-Done interrupt +] +IFN DMIMP,[ + MOVE A,[JSR IMPLD4] ; Shouldn't need this, but just in case... + EXCH A,IMPILC ; Restore A, set int vector to safe rtn + CONO FI,NETCHN*11 ; DM interface can simply set Input-Done PIA! + JRST 12,@IMPLD6 +] ;DMIMP +] ;INETP + +EBLK ; PI 1 Input Done interrupt (from IMPILC+1, runout) +IMPLD4: 0 ; JSR here on BLKI runout after reading IMP leader +BBLK ; There is still one word to go, to be gotten at NETCHN level +IFN KAIMP,[ + MOVEM A,IMPILC ; Save A + ; Drop through to common code + +IMPLI4: SETZM IMPIH ; Say input no longer needs PI 1 + MOVEI A,NETCHN ; Make PI 2 (NETCHN) the exit PIA, + SKIPL IMPOH ; unless output side needs PI 1. + MOVEM A,IMPPIA ; Set desired PIA channel on exit + CONO IMP,@IMPPIA ; Set PIA to whatever it was! + MOVE A,[JSR IMPIBK] ; Reset PI 1 Input-Done vector back to std. + EXCH A,IMPILC ; and restore A. +];DMIMP +IFN DMIMP, CONO FI,NETCHN*11 ; DM interface can simply set Input-Done PIA! + JRST 12,@IMPLD4 + +IMPBCM: BUG INFO,[NCP: CTL MSG BS NOT 8 OR CT>120. HST ],OCT,IMPHTN(H),[BS ],DEC,IMPCBS,[BC ],DEC,IMPCBC + JRST IMPIRT + +;;; IMP->Host Type 6 - Host Down Status +; H/ host index + +IMPHDS: MOVE A,IMPILB+1 ;1.8-1.1 AND 4.9-4.2 ARE THE INFO + MOVE B,IMPILB+2 + LSHC A,8 + ANDI A,177777 + HRRM A,IMPHTB(H) ;STORE, HOPE USER READ RFC 611 + JRST IMPIRT + +;;; IMP->Host Type 1 - Error in leader (msg-id not given) +;;; IMP->Host Type 8 - Error in data (msg-id given) + +IMPBE1: LDB T,IMSTBP ; Get subtype (4 bits) + ANDI T,3 ; Only 2 bits should be used + AOS IMPM1S(T) ; Increment count of Type 1 subtype messages +IMPBE8: MOVE T,TIME + SUB T,LNETIM + CAIL T,60. ;IGNORE ERROR DURING INITIAL SYNCHRONIZATION + BUG INFO,[IMP: Type ],DEC,A,[err msg, leader],OCT,IMPILB,OCT,IMPILB+1,OCT,IMPILB+2 +IFN INETP,[ + MOVE B,IMPCLN + CAIN B,233 + AOS IMNIP8 +] + CAIN A,8. + JRST IMPBEB ; Process "Error in data" (decrement RFNM wait cnt) + JRST IMPIRT + +IMPBER: SKIPGE IMPUP ;SKIP IF UP, OR THOUGHT TO BE BROKEN + JRST IMPBE2 ;ALREADY DOWN, LET IT COME UP IN PEACE + MOVSI J,SCLNET ;THINKS IT'S UP, RESET IT + IORM J,SUPCOR + CONI IMP,IMERCN ;RECORD IF IMP ERROR FLIP/FLOP SET + SETOM IMPUP ;IMP IS DOWN + SETZM IMPTCU ;AND NOT TRYING TO COME UP +IFN INETP,.ERR IP/TCP code needs handling for IMP crashing. +IFN NCPP,[ + MOVSI T,200000 ;CLEAR ALL BUFFERS ACTIVE AT PI LEVEL + MOVSI I,-IMPSTL ;SINCE CORE JOB MAY BE WAITING ON THIS + ANDCAM T,IMSOC6(I) + AOBJN I,.-1 +] ;NCPP +IMPBE2: +IFN KAIMP,[ + SETZM IMPPIA + CONO IMP,0 +] +IFN DMIMP,CONO FI,FIRSET + JRST IMPEX + +;;; IMP->Host Type 2 - IMP going down + +IMPGD: LDB B,[060200,,IMPILB+1] ;WHY + MOVEM B,IMPDWN + LDB B,[020400,,IMPILB+1] ;HOW SOON GOING DOWN * 5 MINS + MOVE H,B + IMULI B,5*60.*30. ;TICKS IN 5 MINS + ADD B,TIME + MOVEM B,IMPDWN+1 + MOVE C,IMPILB+1 ;HOW LONG TO BE DOWN, SPANS WORD BOUNDARY + MOVE D,IMPILB+2 + LSHC C,8 + ANDI C,1777 + MOVE Q,C + IMULI C,5*60.*30. + ADD C,B ;ADD TO TIME DOWN + MOVEM C,IMPDWN+2 ;STORE TIME WHEN WILL BE UP + IMULI H,5 ;MINUTES + IMULI Q,5 + BUG INFO,[IMP: Going down in ],DEC,H,[mins for ],DEC,Q,[mins, reason],DEC,IMPDWN + JRST IMPIRT + +;;; IMP Blockage avoidance +; The current IMP software will not accept more than 8 active +; messages to a single host; attempting to send a 9th message will block +; ALL output to the interface, until the first message has been ack'd +; by means of one of the following message types: +; Type 5, RFNM - Message delivered OK +; Type 7, Host dead - transmit failed ("permanent") +; Type 8, Error in data - interface spazzed +; Type 9, Incomplete Transmission - temporary failure +; If for some reason the first message simply becomes lost, the IMP timeout +; (and blockage) can last for up to 30-45 seconds. +; More details in BBN Report 1822. +; ITS attempts to fix this by keeping a count of active un-ACKed +; messages for each host it is communicating with. A timeout is also +; associated with each host; if output to a given host is blocked by ITS +; because there are 8 active messages, trying to send a 9th message +; will check the last-RFNM-received time and if this was more than +; 30 or so seconds then the IMP is probably not giving us what it should +; and we should reset things for that host. + +%IMPMA==:8. ; # of maximum active IMP messages allowed + +; IMPBLI, IMPBLD - routines to hack active-message counts, called via JSP T, +; IMPBLD decrements count. +; IMPBLI increments count and skips if successful (else failed, +; and must NOT output another message to this host!) +; Also clobbers Q. +IMPBLI: AOS Q,IMPHTC(H) + CAIGE Q,%IMPMA ; Trying to send max or more messages? + JRST 1(T) ; No, can return safely. + CAIG Q,8. ; Is this the maximum # allowed? + JRST [ MOVE Q,TIME ; Yes, set up blockage timeout + ADDI Q,60.*30. ; for one minute. + MOVEM Q,IMPHTT(H) + JRST 1(T)] + + ; Trying to send too many messages, block it (check for timeout though) + SOS IMPHTC(H) ; Restore original count + AOS IMNBLK ; Increment # of times softwarily blocked. + MOVE Q,IMPHTT(H) + CAML Q,TIME ; See if timeout still in the future + JRST (T) ; Yes, just take failure-return to block. + BUG INFO,[IMP: RFNM-wait timeout! Hst=],OCT,IMPHTN(H) + SETZM IMPHTC(H) ; This may be dangerous... oh well. + SETZM IMPHTT(H) + JRST (T) ; Block one last time, next try will win. + +IMPBLD: SOSL Q,IMPHTC(H) + JRST IMPBL2 + BUG INFO,[IMP: neg RFNM-wait cnt, Hst=],OCT,IMPHTN(H) + SETZB Q,IMPHTC(H) +IMPBL2: CAIL Q,8.-1 ; If we were blocking on this host, + CALL IMPIOS ; Ensure IMP output started up so blocked stuff + JRST (T) ; gets sent promptly. + +;;; IMP->Host Type 8 - Error in Data +; Actually this is secondary routine that IMPBE1 jumps to. + +IMPBEB: JSP T,IMPBLD ; Decrement count of active messages + JRST IMPIRT + + + +;;; IMP->Host Type 5 - RFNM (Ready For Next Message) + +IFN INETP,.ERR INETP needs handling for RFNM on link 233 +IMPRFN: +IFN BLIMPP,JSP T,IMPBLD ; Decrement count of active IMP messages for this host + SKIPE IMPCLN ;LINK NUMBER + JRST IMRFN1 ;DATA LINK +IMRFN6: SKIPL IMPHTB(H) + JRST IMRFN7 + SKIPN IMPHTN(H) + BUG HALT,[IMP: IMRFN6 sees free IMPHTB entry ],OCT,H + MOVSI D,400000 + ANDCAM D,IMPHTB(H) ;SET RFNM RECEIVED + SOS IMRFCT +IFN NCPP,[ + SKIPL IMPNCQ ;SKIP IF NO PENDING CONTROL-LINK OUTPUT + PUSHJ P,IMPIOS ;START OUTPUT +];NCPP + JRST IMPIRT + +IMRFN7: AOS IMNSRC + BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[LNK 0] + JRST IMPIRT + +; RFNM on non-zero link message +IMRFN1: +IFN INETP,[ + MOVE A,IMPCLN ; Get link # + CAIE A,233 ; IP link number? + JRST IMRFNX ; No, skip IP code + AOS IMNIPR ; Bump count of IP RFNMs received + JRST IMPIRT ; and do nothing else about it, ugh. +IMRFNX: +];INETP +IFN NCPP,[ + MOVE A,IMPCSH + LSH A,8 + IOR A,IMPCLN ;HEADER + MOVSI I,-IMPSTL + MOVEI W,1 +IMRFN2: LDB D,IMSCHL ;HEADER + SKIPGE IMSOC1(I) ;SKIP IF SLOT NOT IN USE + CAME A,D ;SKIP IF HEADER AGREES + JRST IMRFN3 + HRRZ J,IMSOC4(I) ;STATE + MOVEI W,0 + CAIN J,%NSRFN + SOJA J,IMRFN4 ;RFNM WAIT + MOVSI J,20000 ;MIGHT BE EXPECTING RFNM AFTER CLOSE + TDNE J,IMSOC5(I) + JRST [ ANDCAM J,IMSOC5(I) + JRST IMPIRT ] +IMRFN3: AOBJN I,IMRFN2 + BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN,SIXBIT,[(W)[SIXBIT/NOWAITNOLINK/]] +];NCPP +.ELSE BUG INFO,[IMP: Spurious RFNM from ],OCT,IMPHTN(H),[link],OCT,IMPCLN + AOS IMNSRF + JRST IMPIRT + +IFN NCPP,[ +IMRFN4: HRRM J,IMSOC4(I) ;CONNECTION OPEN + MOVSI J,30000 ;TURN OFF CLOSE-AWAITING-RFNM BIT, AND + ANDCAM J,IMSOC5(I) ; RFNM-TIMEOUT-DURING-CLOSE BIT + MOVE T,IMSPIP(I) + CAME T,IMSMPP(I) ;SKIP IF OUTPUT BUFFER EMPTY + PUSHJ P,IMPIOS ;START OUTPUT + JRST IMPIRT +];NCPP + + +;;; IMP->Host Type 9 - Incomplete Transmission + +IMPINC: LDB T,IMSTBP ; Get subtype field (4 bit reason for failure) + AOS IMPM9S(T) ; Bump count of subtypes + SKIPA E,[%NCINC] + +;;; IMP->Host Type 7 - Destination Host Dead + +IMPDHD: MOVEI E,%NCDED +IFN BLIMPP,JSP T,IMPBLD ; Decrement count of active IMP messages for this host +IFN INETP,[ + MOVE A,IMPCLN + CAIN A,233 + JRST [ CAIN E,%NCINC + AOS IMNIP9 + CAIN E,%NCDED + AOS IMNIP7 + JRST IMPIRT] ; Don't bother with NCP stuff or anything. +] + MOVSI C,1000 ;RST SENT? + TDNE C,IMPHTB(H) + SOS IMRFCT ;GOING TO CLEAR IT, DECREASE TIMEOUT RQ + MOVSI C,3000 + ANDCAM C,IMPHTB(H) ;CLEAR RST STATUS, RFNM SIMULATED LATER +IFN NCPP,[ + MOVSI I,-IMPSTL +IMDHD: LDB T,IMSCFH + SKIPGE C,IMSOC1(I) ;SKIP IF NOT IN USE + CAME T,IMPCSH + JRST IMDHDA + HRRZ T,IMSOC4(I) + TLNN C,200000 ;THIS GUY IS CLOSING ANYWAY + CAIG T,%NSLSN + JRST IMDHDA ;THIS SOCKET'S HOST NUMBER FIELD IS MEANINGLESS + CAIGE T,%NSCLI .SEE %NSINP + TDZA T,T .SEE %NSCLS + MOVEI T,%NSCLI + HRRM T,IMSOC4(I) + DPB E,IMSCLS ;CLS REASON + PUSHJ P,IMPUIN +IMDHDA: AOBJN I,IMDHD +];NCPP + JRST IMRFN6 ;CONTROL LINK, TAKE AS RFNM SO AS NOT TO HANG THINGS + +IFN INETP,[ +; IMPRMI - End of IP datagram, PI in progress on NETCHN, here from IMPBKX +; A/ Last IMP word (32-bit) +; TT/ CONI bits as of interrupt (note already returned to 36-bit mode) + +IMPRMI: AOS B,IMBLKI ; Get address to store last word in + MOVEM A,(B) ; Store it away + SUB B,IMPIBS ; Get # words read into datagram buffer + MOVEI B,(B) + MOVE A,IMPIDP ; Get pointer to IP datagram buffer we were using + SETZ C, ; Say zero offset to IP header. + MOVE J,IMPCSH ; Set index to host-table entry dgm received from. + PUSHJ P,IPRDGM ; Call IP module to process received datagram at PI lvl + SETZM IMPIDP ; Clear PI level pointer + JRST IMPIR1 ; Return from PI level, setting up for next msg + +] ;INETP + +SUBTTL ARPANET OUTPUT INTERRUPT LEVEL + +; See comments at IMPINT for a description of the overall IMP interrupt +; structure. Output is simpler than input, however. +; Each IMP message is output at PI level 1 except for the initial DATAO; +; the setup and takedown for each message is done at PI level 2. +; The code on this page is not referenced by anything outside the page +; except interrupt vector setup at IMPINI (to IMPOBK) and IMOB9 (to IMPCH1). + +; IMPCH1 - PI 1 Output-Done interrupt, from IMPOLC. +; Comes here when last word DATAO'd has been sent to IMP. +EBLK +IMPCH1: 0 +BBLK + MOVEM A,IMPOLC ; Save A + MOVE A,IMOPNT +IMCH1A: SKIPGE A,IMOLST(A) ; Get next "instruction" + JRST IMCH1B ; Jump if it's a BLKO pointer + CAILE A,3 ; Ensure valid operation + JRST 4,. + XCT IMCH1I(A) ; Do it + AOS A,IMOPNT ; Still here? Point to next operation + JRST IMCH1A ; and loop to do it. + +IMCH1I: JRST IMCH1C ;0 Stop - end of output list +IFN KAIMP,CONO IMP,IMPLHW+IMPCHN ;1 Set Last Word +IFN DMIMP,CONO FI,FILHW+11*NETCHN +IFN KAIMP,CONO IMP,IMO32S+IMPCHN ;2 Set 32-bit mode +IFN DMIMP,CONO FI,FIO32S+10*NETCHN+IMPCHN + JFCL ;3 NOP + +IMCH1B: MOVEM A,IMBLKO ; Set up BLKO - store the pointer + MOVE A,[JSR IMCH1D] ; Set dispatch for BLKO runout + MOVEM A,IMPOLC+1 + MOVE A,[BLKO IMP,IMBLKO] + EXCH A,IMPOLC ; Store the BLKO and restore A + AOS IMOPNT ; Increment output list ptr past this op. + JRST 12,@IMPCH1 ; Will interrupt immediately for first BLKO + ; word, since Output-Done wasn't cleared. + +; PI 1 Output-Done, from IMPOLC+1 (BLKO runout) +; Final word of the BLKO pointer is now in interface, being sent +; to IMP, and Output-Done flag is off. +EBLK +IMCH1D: 0 +BBLK + MOVEM A,IMPOLC + MOVE A,[JSR IMPCH1] ; Interrupt back when output of final word done + EXCH A,IMPOLC + JRST 12,@IMCH1D + +; Here from IMPCH1, PI 1 Output-Done interrupt +; Output list has hit "stop" operation (previous op had better be +; 1 to set Last-Host-Word!) +; This code reverts control back to PI level 2 (IMPOBK). +IMCH1C: +IFN DMIMP,[ + CONO FI,FIOUT+11*NETCHN ; Reset PIA to normal 2 + MOVE A,[JSR RINT1] ; and ensure any further output PI 1 ints +] ; are classified as spurious. + +IFN KAIMP,[ ; Non-DM interface needs more hair. + SETZM IMPOH ; Say output side doesn't need PI 1 anymore + MOVEI A,NETCHN ; And set exit PIA to 2, + SKIPL IMPIH ; unless input side still needs PI 1 + MOVEM A,IMPPIA ; Set it. + CONO IMP,NETCHN ; Shouldn't this be CONO IMP,@IMPPIA?? + SETOM IMPO ; Tell IMPINT we have output-done interrupt. + MOVE A,[JSR IMPOBK] ; Point PI 1 channel at switch-PIA routine, +] ; in case we interrupt on PI 1 again anyway. + EXCH A,IMPOLC + JRST 12,@IMPCH1 + +IFN KAIMP,[ + +; PI 1 Output Done interrupt, when we should really be interrupting +; at IMPINT on PI 2. +EBLK +IMPOBK: 0 +BBLK + SETOM IMPO ; Tell IMPINT what kind of interrupt + CONO IMP,NETCHN ; Reset PIA to 2 + JRST 12,@IMPOBK +] + +; IMPOBZ - PI 2 (NETCHN) "Output Done" interrupt, via IMPINT. +; Come here when we have finished sending stuff out at PI 1, +; also when something wants output to start and tickled the "Done" +; flag. +; TT/ IMP CONI word. + +IMPOBZ: AOS IMCT3 +IFN DMIMP,[ + TRC TT,IMPCHN_9 ;CHECK IF OUTPUT PIA=IMPCHN + TRNN TT,7_9 + JRST IMPRET ;IGNORE, ALREADY HANDLED BY IMPCHN +] + SKIPL B,IMPOS + CAIL B,IMPODL + JRST 4,. + JRST @IMPODT(B) + +IMPODT: OFFSET -. +%ISODL:: IMPOB1 ; 0 Idle, look for something to send +%ISONC:: IMPOB6 ; 1 Finished NCP control message +%ISOND:: IMPOBG ; 2 Finished NCP data message +IFN INETP,%ISOID::IMPOBI ; 3 Finished IP datagram messge +IMPODL::OFFSET 0 + +IFE NCPP,[ +IMPOB6: SETZM IMPOS + SKIPN A,IMPSVQ + JRST IMPRET ;THAT WAS A NOP +IMPOBG: JRST 4,. ;Can't get here +];not NCPP + +; Idle - Look for output to send. First ensure we can send stuff, +; then try things in the order: +; (1) Send NOP if net coming up +; (2) Check NCP control queue, then (3) NCP data output queue +; OR +; (2) Check IP datagram queue +; +; Note that we alternate between checking the NCP and IP queues first, +; so that neither protocol can totally wedge the other up even if +; going at full blst. + +IMPOB1: HRRZ T,IMPUP + CAIE T,-2 ; Don't say it's up when it's still going down + CAIN T,1 ; or when it is broken + JRST IMPOB9 + + ; First check to see if NOP needs to be sent. + AOSG IMNOPC ; Check to see if sending NOPs + JRST IMONOP ; Output a NOP + SETZM IMPUP ; Say IMP is up + SETZM IMPTCU ; Say no longer trying to come up + + ; Now see whether to check NCP or IP. +IFN INETP,[ + SETCMB T,IMPPSW ; Complement IMP output protocol switch + JUMPN T,IMOBNN ; Jump for NCP + PUSHJ P,IPGIOQ ; Check IP! Get IP IMP output queue entry if any + JRST IMOBN ; Nothing there, go check NCP. + ; Returns A/ ptr to IP dgm struct + ; B/ BLKO pointer to 32-bit words + ; C/ Arpanet address + ; The output list should be set up as: + ;IMOLST: -3,,IMOLDR + ;IMOMOD: 2 ; switch to 32-bit mode + ;IMOBK1: -1,,IMOLDR+3 ; Send 5th word of padding + ;IMOBK2:output BLKO ; Send datagram minus last word + ; 1 + ;IMOBK3: -1,,lstwd-1 ; BLKO to last word of datagram + ; 0 +IMOBI1: + MOVEM A,IMPODP ; Save ptr to datagram being output + AOS IMNIPO ; # of IP datagrams sent + ADD B,[1,,] ; Reduce BLKO count by one + MOVEM B,IMOBK2 ; Store in output list + HLRO D,B ; Get -<# wds-1> + MOVN D,D ; Get <#wds-1> + ADDI D,(B) ; Get addr for last-word BLKO + HRROM D,IMOBK3 ; Store -1,,lastwd-1 + MOVE B,[-3,,IMOLDR] + MOVEM B,IMOLST + MOVE B,[-1,,IMOLDR+3] + MOVEM B,IMOBK1 + + ; Output list set up, now must put together the IMP leader + ; in IMOLDR. + MOVE B,[17_10.,,0] ; Regular message + MOVEM B,IMOLDR + LSH C,8. ; Move net address over + IORI C,233 ; Get link # for IP + MOVEM C,IMOLDR+1 ; Store 2nd word + SETZM IMOLDR+2 ; 3rd word can be zero + SETZM IMOLDR+3 ; rest is padding + SETZM IMOLDR+4 ; ditto + +IFN KAIMP,CONO IMP,IMO32C +IFN DMIMP,CONO FI,FIO32C ;SET 36 BIT MODE FOR LEADER, CLEAR PIA + DATAO IMP,IMOLDR ; Start it going! + + MOVEI C,%ISOID ; State = outputting IP datagram. + JRST IMOB9 + +IMOBN: SKIPE IMPPSW ; If no IP, check NCP only if havent already + JRST IMOBI9 ; Skip NCP check, just return. +IMOBNN: +] ;INETP + +IFN NCPP,[ + ; Check NCP control message queue. +IFN BLIMPP,[ + MOVEI C,IMPNCQ +IMPOBV: SKIPGE A,(C) + JRST IMPOBW + HLRZ H,1(A) ; Got one! Go send NCP control msg, + SKIPL IMPHTB(H) ; unless control link waiting for RFNM + JSP T,IMPBLI ; or too many msgs active for that host. + CAIA + JRST [MOVEI T,(C) ? JRST IMPOB2] ; Compat hack + MOVEI C,(A) + JRST IMPOBV +] ;BLIMPP +.ELSE [ + MOVEI T,IMPNCQ +IMPOBV: SKIPGE A,(T) + JRST IMPOBW + HLRZ B,1(A) ;HOST TABLE INDEX + SKIPL IMPHTB(B) ;SKIP IF WAITING FOR RFNM + JRST IMPOB2 ; Got one! Go send NCP control message. + MOVE T,A + JRST IMPOBV +] ;IFE BLIMPP + + ; Check NCP data output queue. This simply runs through + ; all the sockets to see if any want to output something. +IMPOBW: MOVSI I,-IMPSTL + MOVEI W,1 +IMPOBB: SKIPGE IMSOC1(I) ;SKIP IF NOT IN USE + TDNN W,IMSOC2(I) ;SKIP IF SEND + JRST IMOBA9 + HRRZ A,IMSOC4(I) + CAIN A,%NSOPN ;SKIP IF WRONG STATE + SKIPGE IMSOC6(I) ;SKIP IF NOT LOCKED BY CORE JOB +IMOBA9: +IFE BLIMPP,IMPOBA: + AOBJN I,IMPOBB +IFN BLIMPP,[ + JUMPGE I,IMPOB9 + LDB H,IMSCFH ; Get fgn host index for this NCP conn + JSP T,IMPBLI ; Make sure not too many active msgs + JRST IMOBA9 ; Sigh, too many, keep looking. + JRST IMPOBD ; OK, can send! +IMPOBA: JSP T,IMPBLD ; Couldn't send data msg after all, decr cnt + JRST IMOBA9 +] +.ELSE JUMPL I,IMPOBD ; Got one! Go send NCP data message. +];NCPP + + ; No more NCP output for IMP. +IMPOB9: +IFN INETP,[ + SKIPN IMPPSW ; If we didnt check IP queue yet, + JRST IMOBI9 + PUSHJ P,IPGIOQ ; then do it now, after NCP check. + JRST IMOBI9 ; Nothing, really no more output. + JRST IMOBI1 ; Aha, have stuff! Go get it. +IMOBI9: +] + SETOM IMPOAC ; No more output, couldn't find anything to send. +IFN KAIMP,CONO IMP,IMPODC ; Clear Output-Done interrupt bit +IFN DMIMP,CONO FI,FIODC+NETCHN*11 + JRST IMPRET + + +; IMONOP - Send a NOP, here from IMPOBZ only. + +IMONOP: MOVEI A,IMPNOP-2 + SETZM IMPSVQ ; Set flag => this msg not really from control queue + MOVEI B,1 ; No text, but one extra wd (needed to make BLKO win) + JRST IMPOB3 + + ; NOP Host-IMP leader +IMPNOP: 17_10.,,4_4 ; New format, type 4 = NOP + 0 + 5_10.,,0 ; 5 16-bit words of padding desired + +; IMPOB2 - Send a NCP control message, from IMPOBZ only + +IMPOB2: HRL A,T + MOVEM A,IMPSVQ ;SAVE CTL MSG QUEUE PNTR + HRRE B,1(A) ;GET COUNT + JUMPG B,IMPOB3 + JRST 4,. ;ERROR, COUNT NOT > 0 +IMPOB3: ; Entry pt from NOP sending code +IFN KAIMP,CONO IMP,IMO32C +IFN DMIMP,CONO FI,FIO32C ;SET 36 BIT MODE FOR LEADER, CLEAR PIA + DATAO IMP,2(A) ;OUTPUT FIRST LEADER WORD + MOVEI C,2(A) ;SET UP BLKO POINTER FOR REST OF LEADER + SKIPN IMPSVQ + JRST [ HRLI C,-2 ;KLUDGE, SENDING NOP + JRST IMPOB4 ] + HRLI C,-5 + AOS IMPMSS+0 ;COUNT REGULAR MSGS SENT +IFN INETP,[ + MOVE T,IMPCLP ; HACK! Get specified # to use for ctl link + DPB T,[001000,,3(A)] ; Deposit in link field of leader. +];INETP +IFN NCPP,[ + LDB T,[341000,,10(A)] ;FIRST BYTE OF CONTROL MESSAGE + CAIGE T,20 + AOS IMPCMS(T) +];NCPP +IMPOB4: MOVEM C,IMOLST ;STORE BLKO POINTER THAT SENDS LEADER + MOVEI C,2 ;DO TEXT WORDS IN 32-BIT MODE + MOVEM C,IMOMOD +IFN DMIMP,MOVNI B,(B) ;GET MINUS WORD COUNT +IFN KAIMP,MOVNI B,-1(B) ;ALSO -1 FOR LAST WORD SENT SEPARATELY. + HRLI B,7(A) ;ADDR-1 FOR BLKO + MOVSM B,IMOBK1 ;STORE FOR PI 1 +IFN KAIMP,[ + MOVNI B,(B) + ADD B,IMOBK1 ;LAST WORD SENT SEPARATELY + HRROM B,IMOBK3 + MOVEI B,3 ;CHECK FOR SCREW CASE, ONLY SENDING ONE WORD, IT'S THE + SKIPL IMOBK1 ; LAST, SO NOP OUT THE MAIN BLKO + MOVEM B,IMOBK1 +] +.ELSE MOVEI B,3 + MOVEM B,IMOBK2 ;NO 2ND BLKO + MOVEI C,%ISONC ;STATE FOR CONTROL RETURN TO NETCHN +IMOB9: MOVEM C,IMPOS + SETZM IMOPNT + MOVE C,[JSR IMPCH1] + MOVEM C,IMPOLC +IFN KAIMP,[ + SETOM IMPOH ;OUTPUT SIDE WANTS IMP TO RUN ON CHANNEL 1 + MOVEI A,IMPCHN + MOVEM A,IMPPIA +] +IFN DMIMP,CONO FI,FIOUT+NETCHN_3+IMPCHN ;SET PIA FOR OUTPUT + JRST IMPRET + +IFN INETP,[ +; Here when IP datagram transmission completed + +IMPOBI: SETZM IMPOS ; Reset output state + MOVE A,IMPODP + PUSHJ P,IPIODN ; Tell IP level that datagram was output + SETZM IMPODP + JRST IMPRET +] ;INETP + +SUBTTL ARPANET CLOCK LEVEL + +OVHMTR IMP ;NETWORK INTERRUPT LEVEL (NOT STYNET STUFF) + +IMRSTO: SKIPN IMRFCT ;CALLED AT 15 SEC CLK LEVEL TO UNHANG RFNM WAITS +IFE NCPP,POPJ P, +IFN NCPP,JRST IMFCT1 + MOVEI H,LIMPHT-1 ;SOME CONTROL LINKS WAITING FOR RFNM, CHECK FOR TIME OUT + MOVSI TT,401000 ;4.9 AND 4.1 - RFNM AND RRP TIMEOUTS + TDNN TT,IMPHTB(H) +IMRS4: SOJGE H,.-1 +IFN NCPP,JUMPL H,IMFCT1 +IFE NCPP,JUMPL H,CPOPJ + CONO PI,NETOFF + SKIPE IMPHTN(H) ;MAKE SURE IT'S A REAL HOST, NOT A FREE ENTRY + TDNN TT,IMPHTB(H) ;AND THAT THE BITS DIDN'T TURN OFF DUE TO INTERRUPT + JRST IMRS1 + LDB E,[221100,,IMPHTB(H)] + LDB D,[051100,,TIME] ;GET TIME IN SECONDS (APPROX) + CAMLE E,D + ADDI D,1_9 + SUB D,E + CAIGE D,IMRFTO_<-5> + JRST IMRS1 ;HASN'T TIMED OUT YET. + LDB D,IMHSBT ;TIMED OUT. CHECK RST/RRP STATUS. + SOJE D,IMRS2 + MOVSI D,400000 + ANDCAM D,IMPHTB(H) ;RFNM SENT, CLEAR IT + AOS IMNRFN + SOS IMRFCT + BUG INFO,[NET: CTL LNK RFNM TIMEOUT HST],OCT,IMPHTN(H) +IMRS1: CONO PI,NETON + JRST IMRS4 + +IMRS2: DPB D,IMHSBT ;RST SENT, SET STATE TO DOWN + BUG INFO,[NET: RST TIMEOUT HST=],OCT,IMPHTN(H) + SOS IMRFCT + JRST IMRS1 + +;NETHST (HOST INFO) +; ARG 1 - HOST => VAL 1 - STATUS, VAL 2 - HOST NUMBER +; ARG 1 - -1 => VAL 1 - (STATUS), VAL 2 - OUR HOST NUMBER +;NOT CURRENTLY IMPLEMENTED- ARG 1 - -1, ARG 2 - OUR GOING-DOWN REASON + +ANETHST:HRRE T,A ;LET IMMEDIATE -1 WIN (777777 NOT A VALID HOST) + AOJE T,ANETH2 ;JUMP IF WANT LOCAL STATUS AND HOST NUMBER + MOVE T,A + JSP J,STDHST ;STANDARDIZE AND ERROR-CHECK HOST NUMBER + MOVE B,T ;RETURN NEW FORMAT ******* + TLO B,(NW%ARP) + MOVEI H,LIMPHT-1 + CONO PI,NETOFF ;DO WE HAVE STATUS? + CAME T,IMPHTN(H) + SOJGE H,.-1 + JUMPGE H,ANETH1 ;YES, RETURN IT + CONO PI,NETON ;NO, HAVE TO GO GET IT + MOVEM T,SRN3(U) +IFN NCPP,[ + PUSHJ P,NETO00 ;GET IMSOC, RETURN WITH NETLST, IMSOC LOCKED + POPJ P, ;DEVICE FULL OR SOMETHING + PUSHJ P,NETOR ;OPEN COMMUNICATIONS WITH HOST + JFCL ;IT'S DOWN, THAT'S OK +];NCPP +.ELSE POPJ P, ;OH, TOO BAD +ANETH1: MOVE A,IMPHTB(H) ;GET STATUS + CONO PI,NETON + EXCH A,B + CALL CVH2NA ; Convert to HOSTS2 for compat + EXCH A,B + JRST LSWCJ1 ;RETURN IMSOC, NETLST IF NOT DONE ALREADY + +ANETH2: ;CAIL W,2 ;(THIS IS A CROCK) + ;MOVEM B,NTHDSW ;IF 2 ARGS, SET OUR REASON FOR GOING DOWN. + SKIPE IMPUP ;FAKE UP OUR STATUS + TDZA A,A ;WE'RE DOWN + MOVSI A,2000 ;WE ARE UP + MOVEI B,IMPUS ;AND OUR HOST #. + JRST POPJ1 + + +;NETIMP (REASON,TIMEDOWN,TIMEUP) READ/SET + +ANETIMP:JUMPLE W,ANETM1 ;NO ARGS, RETURN + CAIGE W,3 ;MUST HAVE 3 ARGS IF ANY + JRST OPNL30 + MOVEM A,IMPDWN + MOVEM B,IMPDWN+1 + MOVEM C,IMPDWN+2 + JRST POPJ1 + +ANETM1: MOVE A,IMPDWN + MOVE B,IMPDWN+1 + MOVE C,IMPDWN+2 + SKIPE IMPUP + TLO A,400000 + JRST POPJ1 diff --git a/system/inet.130 b/system/inet.130 new file mode 100644 index 0000000..095bfb6 --- /dev/null +++ b/system/inet.130 @@ -0,0 +1,1441 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us + CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + + + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + TLNN T,(%PKFLS) ; Asked to flush? (shudda caught at IPGIOQ) + TLNN T,(%PKNOF) ; Unless requested not to free it, + CALRET PKTRT ; Return it to freelist. + + ; Keep around (assume its on some other list) + POPJ P, + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS3_4] ; Must be a datagram WE sent. + CAMN A,[IMPUS4_4] + CAIA + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] + TLNN T,%PKNOF ; Ordinary queue. Unless specifically protected, +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: MOVEI T,(%PKNOF) ; Sanity check. Asking not to free? + TLNN T,PK.FLG(A) + JRST .+4 + MOVEI T,(%PQFLX) ; But not on any queues? + TLNN T,PK.FLG(A) + BUG CHECK,[IP: Dgm about to be lost, caller ],OCT,(P) + + PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: HOSTN 26,0,0,0 ; MILNET (core gateway entry) + HOSTN 128,9,0,0 ; ISINET (core gateway entry) + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET + HOSTN 36,0,0,0 ; Stanford + HOSTN 128,2,0,0 ; CMU + HOSTN 11,0,0,0 ; UCL +NIPMGW==<.-IPGWTN> ; Number of prime gateways + NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: HOSTN 10,5,0,5 ; BBN-MILNET-GATEWAY (core gateway entry) + HOSTN 10,3,0,27 ; ISI-GATEWAY (core gateway entry) + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW + HOSTN 10,1,0,11 ; STANFORD-GW + HOSTN 10,2,0,14 ; CMU-GW + HOSTN 10,1,0,20 ; DCEC-GATEWAY + 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: IPKSNA ; BBN-MILNET-GATEWAY (prime gateway entry) + IPKSNA ; ISI-GATEWAY (prime gateway entry) + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW + IPKSNA ; STANFORD-GW + IPKSNA ; CMU-GW + IPKSNA ; DCEC-GATEWAY + IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/inet.131 b/system/inet.131 new file mode 100644 index 0000000..092a4f0 --- /dev/null +++ b/system/inet.131 @@ -0,0 +1,1429 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us + CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + + + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + CALRET PKTRT ; Return to freelist if not otherwise queued + + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS3_4] ; Must be a datagram WE sent. + CAMN A,[IMPUS4_4] + CAIA + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: HOSTN 26,0,0,0 ; MILNET (core gateway entry) + HOSTN 128,9,0,0 ; ISINET (core gateway entry) + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET + HOSTN 36,0,0,0 ; Stanford + HOSTN 128,2,0,0 ; CMU + HOSTN 11,0,0,0 ; UCL +NIPMGW==<.-IPGWTN> ; Number of prime gateways + NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: HOSTN 10,5,0,5 ; BBN-MILNET-GATEWAY (core gateway entry) + HOSTN 10,3,0,27 ; ISI-GATEWAY (core gateway entry) + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW + HOSTN 10,1,0,11 ; STANFORD-GW + HOSTN 10,2,0,14 ; CMU-GW + HOSTN 10,1,0,20 ; DCEC-GATEWAY + 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: IPKSNA ; BBN-MILNET-GATEWAY (prime gateway entry) + IPKSNA ; ISI-GATEWAY (prime gateway entry) + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW + IPKSNA ; STANFORD-GW + IPKSNA ; CMU-GW + IPKSNA ; DCEC-GATEWAY + IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/inet.132 b/system/inet.132 new file mode 100644 index 0000000..e746ec6 --- /dev/null +++ b/system/inet.132 @@ -0,0 +1,1429 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us + CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + + + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + CALRET PKTRT ; Return to freelist if not otherwise queued + + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS3_4] ; Must be a datagram WE sent. + CAMN A,[IMPUS4_4] + CAIA + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: HOSTN 26,0,0,0 ; MILNET (core gateway entry) + HOSTN 128,9,0,0 ; ISINET (core gateway entry) + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET + HOSTN 36,0,0,0 ; Stanford + HOSTN 128,2,0,0 ; CMU + HOSTN 11,0,0,0 ; UCL +NIPMGW==<.-IPGWTN> ; Number of prime gateways + NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: HOSTN 10,3,0,111 ; Someplace at MITRE I believe... + HOSTN 10,3,0,27 ; ISI-GATEWAY (core gateway entry) + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW + HOSTN 10,1,0,11 ; STANFORD-GW + HOSTN 10,2,0,14 ; CMU-GW + HOSTN 10,1,0,20 ; DCEC-GATEWAY + 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: IPKSNA ; BBN-MILNET-GATEWAY (prime gateway entry) + IPKSNA ; ISI-GATEWAY (prime gateway entry) + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW + IPKSNA ; STANFORD-GW + IPKSNA ; CMU-GW + IPKSNA ; DCEC-GATEWAY + IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/inet.133 b/system/inet.133 new file mode 100644 index 0000000..1693db6 --- /dev/null +++ b/system/inet.133 @@ -0,0 +1,1429 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us + CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + + + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + CALRET PKTRT ; Return to freelist if not otherwise queued + + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS3_4] ; Must be a datagram WE sent. + CAMN A,[IMPUS4_4] + CAIA + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: HOSTN 26,0,0,0 ; MILNET (core gateway entry) +; HOSTN 128,9,0,0 ; ISINET (core gateway entry) + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET +; HOSTN 36,0,0,0 ; Stanford +; HOSTN 128,2,0,0 ; CMU +; HOSTN 11,0,0,0 ; UCL +NIPMGW==<.-IPGWTN> ; Number of prime gateways + NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: HOSTN 10,3,0,111 ; Someplace at MITRE I believe... +; HOSTN 10,3,0,27 ; ISI-GATEWAY (core gateway entry) + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW +; HOSTN 10,1,0,11 ; STANFORD-GW +; HOSTN 10,2,0,14 ; CMU-GW +; HOSTN 10,1,0,20 ; DCEC-GATEWAY + 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: IPKSNA ; Someplace at MITRE I believe... +; IPKSNA ; ISI-GATEWAY (prime gateway entry) + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW +; IPKSNA ; STANFORD-GW +; IPKSNA ; CMU-GW +; IPKSNA ; DCEC-GATEWAY + IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/inet.137 b/system/inet.137 new file mode 100644 index 0000000..e9499a1 --- /dev/null +++ b/system/inet.137 @@ -0,0 +1,1440 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us +IFE IPUNCP, CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + + + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + CALRET PKTRT ; Return to freelist if not otherwise queued + + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS4_4] ; Must be a datagram WE sent. +IFE IPUNCP,[ + CAMN A,[IMPUS3_4] + CAIA + ] + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: +IFE IPUNCP,[ + GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP +] ;IFE IPUNCP +IFN IPUNCP, MOVE A,[IMPUS4] + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: +IFE IPUNCP, CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET +NIPMGW==<.-IPGWTN> ; Number of prime gateways +IFE IPUNCP, NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: +IFE IPUNCP,[ + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW +] ;IFE IPUNCP +IFN IPUNCP,[ + HOSTN 128,31,6,1 ; ??? + HOSTN 128,31,6,2 ; ??? +] ;IFN IPUNCP +IFE IPUNCP, 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: +IFE IPUNCP,[ + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW +] ;IFE IPUNCP +IFN IPUNCP,[ + IPKSNC ; ??? + IPKSNC ; ??? +] ;IFN IPUNCP +IFE IPUNCP, IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +IFE IPUNCP, [ + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +] ;IFE IPUNCP + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/inet.138 b/system/inet.138 new file mode 100644 index 0000000..658d639 --- /dev/null +++ b/system/inet.138 @@ -0,0 +1,1446 @@ +;:;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; Insert new buffer stuff... +$INSRT TCPBUF + +IP%VER==740000,, ; 0 IP Version # (= 4) +IP%IHL==036000,, ; 0 IP Header Length in 32-bit wds - at least 5 +IP%TOS==001774,, ; 0 Type Of Service +IP%TOL==000003,,777760 ; 0 Total Length in octets (including header) +IP%ID== 777774,, ; 1 Identification +IP%FLG== 3,,400000 ; 1 Flags + IP%FDF== 1,,0 ; Don't-Fragment flag + IP%FMF== 400000 ; More-Fragments flag +IP%FRG== 0,,377760 ; 1 Fragment Offset +IP%TTL==776000,, ; 2 Time To Live +IP%PTC== 1774,, ; 2 Protocol +IP%CKS== 3,,777760 ; 2 Header Checksum +IP%SRC==777777,,777760 ; 3 Source Address +IP%DST==777777,,777760 ; 4 Destination Address + ; 5 Start of options +IP$VER==<.BP IP%VER,0> +IP$IHL==<.BP IP%IHL,0> +IP$TOS==<.BP IP%TOS,0> +IP$TOL==<.BP IP%TOL,0> +IP$ID== <.BP IP%ID, 1> +IP$FLG==<.BP IP%FLG,1> +IP$FRG==<.BP IP%FRG,1> +IP$TTL==<.BP IP%TTL,2> +IP$PTC==<.BP IP%PTC,2> + %PTCIC==:1 ; Protocol ICMP + %PTCTC==:6. ; Protocol TCP + %PTCUD==:17. ; Protocol UDP +IP$CKS==<.BP IP%CKS,2> +IP$SRC==<.BP IP%SRC,3> +IP$DST==<.BP IP%DST,4> + + ; UDP fields +UD$SRC==<242000,,0> ; 0 wd 1 Source port +UD$DST==<042000,,0> ; 0 wd 2 Dest port +UD$LEN==<242000,,1> ; 1 wd 1 # octets in data +UD$CKS==<042000,,1> ; 1 wd 2 UDP checksum +UD$DAT==<441000,,2> ; 2 Data - actually an ILDB pointer! + + ; ICMP fields +IC$TYP==<341000,,0> ; 0 Type of message +IC$COD==<241000,,0> ; 0 Code (subtype) +IC$CKS==<042000,,0> ; 0 ICMP Checksum +IC$GWA==<044000,,1> ; 1 Random arg, usually Gateway Addr +IC$IPH==2 ; 2 Random data, usually an IP header + +; Hack metering macro, since we'll want lots of 'em to start with. +; You know, MR% used to be MTR%, except that when %NMTRS is over 100 +; you get duplicated symbols, and since they used to be defined with +; == instead of ==: you didn't hear about it, either. + +%NMTRS==:140 ; Allow this many meters +DEFINE MTRCOD ; Put this macro someplace after last meter. +EBLK +MTRCNT: BLOCK %NMTRS ; Holds actual meter AOS'd +BBLK +MTRNAM: BLOCK %NMTRS ; Holds ,, + LOC MTRNAM + REPEAT %%%MTR,CONC MR%,\.RPCNT +IF2, REPEAT %%%MTR,CONC EXPUNGE MR%,\.RPCNT + LOC MTRNAM+%NMTRS + +TERMIN + +; METER - Must be used as in following example: +; METER("IP: # of bad cksums") +%%%MTR==0 +DEFINE METER &(NAME) +IFGE %%%MTR-%NMTRS,.ERR Too many meters! +AOS MTRCNT+%%%MTR +CONC MR%,\%%%MTR,==:<.,,[ASCIZ NAME]> +;CONC MR%,\%%%MTR,==:<.,,> +;IF1 SHOMTR %%%MTR,NAME +%%%MTR==%%%MTR+1 +TERMIN + +DEFINE SHOMTR #OFF#,&STR& +PRINTX /;;;;;;;; METER :::: MTRCNT+!OFF! => / +PRINTX STR +PRINTX / +/ +TERMIN + +EBLK +IPMDFL: 0 ; # of flushed input datagrams +IPMCKF: 0 ; # of input datagrams with bad checksum +IPMFRG: 0 ; # of fragments received +IPMFRD: 0 ; # of sucessfully reassembled datagrams +BBLK + +SUBTTL IP Input Interrupt Level + +; IPGIPT - Get datagram input buffer +; Clobbers Q,T +; A/ Max size of buffer in words +; Returns .+1 if failure (error message already printed) +; Returns .+2 +; A/ Pointer to datagram structure associated with buffer +; B/ Input BLKI pointer to buffer, -<# wds>,, + +IPGIPT: CAILE A,PKBSIZ ; Make sure size needed will fit in a packet buffer + JRST IPGIP9 + CALL PKTGFI ; Get a packet at int level + RET ; Failed, none available. + TRCPKT A,"IPGIPT Net input alloc" + MOVE T,PK.BUF(A) ; Get addr of buffer + HRLOI B,-PKBSIZ ; -<#wds>,,-1 + ADDI B,(T) ; Now get BLKI pointer into buffer + JRST POPJ1 ; Win! +IPGIP9: BUG CHECK,[IP: Too-big buff reqd =],OCT,A + RET ; Fail. + + +; IPRDGM - Process a received datagram at PI level +; Must put datagram into one of the following lists: +; User IP input queue (IPQ) +; IP reassembly table +; ICMP processing +; TCP connection queue +; A/ Pointer to datagram structure +; B/ # words read in datagram +; C/ # wds offset to start of IP header +;;; J is not used, and not supplied by all callers +;;; J/ host-table index of address datagram came from +; Returns .+1 always +; Can clobber all ACs except P +; Sets up +; R/ addr of packet entry +; W/ addr of IP header +; H/ addr of IP data + +IPRDGM: METER("IP: IDs rcvd") + MOVEI R,(A) ; Set up packet entry ptr in canonical place + TRCPKT R,"IPRDGM Input from net" + CAIGE B,5(C) ; Make sure it's big enough + JRST IPRDG9 + HRLM B,PK.BUF(R) ; Store # words read + ADD C,PK.BUF(R) ; Find addr of start of IP header + HRLZM C,PK.IP(R) ; and set it. + MOVEI W,(C) + LDB H,[IP$IHL (W)] ; Find claimed length of IP header + ADDI H,(W) ; Get addr of start of IP data + HRLZM H,PK.TCP(R) ; Set that too. + + ; Do initial vectoring test. + SKIPE IPUQUS ; Check Queue 0 (SysIn) + JRST IPRDG2 ; It exists!! Always vector for it. + + ; Perform initial checking for address, checksum, and so forth + ; to verify datagram is good; also dispatch to handle fragments. + ; This is entry point for re-vectors from SysIn IP queue. +IPRDGV: CALL IPCKSM ; Compute checksum for IP header + LDB B,[IP$CKS (W)] ; and get what the datagram had, + CAIE A,(B) ; in order to compare them... + JRST [ METER("IP: Ifl bad cksm") + AOS IPMCKF ; Bump two meters + JRST IPRD90] ; Go flush it forthwith. + MOVE B,IP$DST(W) ; Get destination host, should be us +IFE IPUNCP, CAME B,[IMPUS3_4] + CAMN B,[IMPUS4_4] + JRST IPRD10 + ; Packet is to be forwarded + METER("IP: Packets forwarded") + LDB B,[IP$TTL(W)] ; Decrement time to live + SOJLE B,[ METER("IP: Packets expired") + JRST IPRD90 ] +ICMEK1: DPB B,[IP$TTL(W)] + CALL IPCKSM ; Update the checksum + DPB A,[IP$CKS(W)] + MOVEI A,(R) ; Transmit it + CALRET IPKSNQ + +IPRD10: HRRE B,IP$FRG(W) ; HACK! Get both IP%FMF and IP%FRG! + JUMPN B,IPRD50 ; Jump if this is a fragment. + + ; Do datagram vectoring. This code is temporarily (?) crude, + ; it just scans the whole Internet Queue table. + ; This is entry point for re-vectoring. W must point to IP + ; header, and H to IP data. I should point at 1st queue entry + ; to start checking at. +IPRD20: MOVEI I,2 ; If drop in, start at 2 (leave 0+1 alone) + LDB B,[IP$PTC (W)] ; Get protocol number + CAIN B,%PTCTC ; Is it TCP? + JRST TCPIS ; Yes, go process TCP input segment. + CAIN B,%PTCUD ; Well, is it UDP? + JRST IPRD30 ; Yeah, can handle that one. + CAIN B,%PTCIC ; Maybe ICMP? + JRST ICMP ; Yup, hack it. +IPRD90: MOVEI A,(R) + CALL PKTRT ; Bah, nothing we handle, flush it. + AOS IPMDFL ; Bump count of flushed dgms. + RET + + ; Here to dispatch a UDP datagram +IPRD30: LDB A,[IP$TOL (W)] ; Make sure it's long enough! Find dgm length + LDB B,[IP$IHL (W)] ; and get IP header length + IMULI B,4 ; in octets + SUBI A,(B) ; to subtract from dgm length. + CAIGE A,2*4 ; Must have enough data for UDP header! + JRST [ METER("IP: Ifl bad UDP len") + JRST IPRD90] ; Flush this dgm. +IPRD31: CAIL I,NIPUQ + JRST [ METER("IP: Ifl no UDP port") ; Didn't find any queues, + JRST IPRD90] ; so flush it. + SKIPN IPUQUS(I) ; Check each active UDP queue + AOJA I,IPRD31 + LDB B,[UD$DST (H)] ; Get UDP dest port number + HRRZ T,IPUQCT(I) ; and port # we're watching for + CAIE B,(T) + AOJA I,IPRD31 ; No match, try another. + METER("IP: # UDP dgms queued") + CAIA +IPRDG2: SETZ I, ; Entry point for SysIn queueing + MOVEI Q,IPUQHD(I) ; Hurray, got it! Add to queue + MOVE B,(Q) ; Save prev contents of header + MOVEI A,(R) + CALL PKQPL(PK.IP) ; Put at end of input IP queue + JUMPE B,IPQUSI ; If nothing previously there, give user int. + RET + +IPRDG9: BUG INFO,[IP: Netin dgm too small, size ],OCT,B,[ offset ],OCT,C + JRST IPRD90 ; Try flushing the packet buffer. + +; IP Datagram Reassembly - Handle received fragment. + +IPRD50: AOS IPMFRG ; Bump count of fragments received + + LDB D,[IP$ID (W)] ; Get datagram ID field + LDB C,[IP$PTC (W)] ; Then protocol field + HRLI D,(C) ; Make ,, + MOVE E,IP$SRC(W) ; Then source address + MOVEI I,NIPF-1 +IPRD51: CAME D,IPFDID(I) +IPRD52: SOJGE I,.-1 + JUMPL I,IPRD70 ; If no more, must add to table. + MOVE B,IPFDPE(I) ; Matching ID! Get buffer ptr + HLRZ T,PK.IP(B) ; Get IP header ptr for existing fragment + CAME E,IP$SRC(T) ; Ensure same source host + JRST IPRD52 ; Nope, go check next entry. + HLRZ H,PK.TCP(B) ; Get ptr to start of data in reassembly buff + + ; OK, we matched up a fragment! Now start reassembly procedure. + ; If fragment is first one (offset 0) then must copy IP header, + ; unless already done. Safe to BLT since we always reserve + ; enough room for a full 15-word IP header. + ; If fragment is last one (IP%FMF 0) then must set IP$TOL to + ; the total # octets in full datagram. This gets fixed + ; to include the IP header length when datagram is complete. + ; I/ idx of reassembly entry + ; T/ ptr to IP header in reassembly buff + ; H/ ptr to data in reassembly buff + ; R, W as for entry to IPRD50 +IPRD55: LDB A,[IP$IHL (W)] ; Get IP header length in 4-octet wds + LDB E,[IP$TOL (W)] ; Get total length of this dgm in octets + HRRE D,IP$FRG(W) ; Hack - get frag offset and more-frag flag + TRNN D,IP%FRG ; Is frag offset 0 - 1st part of dgm? + JRST [ LDB C,[IP$FRG (T)] ; Yeah. Already copied header? + JUMPE C,.+1 ; Jump if so, don't do again. + MOVEI B,(T) + HRLI B,(W) ; Set up BLT from,,to + MOVEI C,(T) + ADDI C,(A) ; Get to+IHL + MOVE Q,IP$CKS(T) ; Save ptr to hole list + LDB TT,[IP$TOL (T)] ; Save TOL, might already be set. + BLT B,-1(C) ; Copy the IP header + HRRM Q,IP$CKS(T) ; Restore hole list head + DPB TT,[IP$TOL (T)] + JRST .+1] + ASH D,-3 ; Get frag.first in terms of 4-octet words + JUMPGE D,[ ; Jump for special processing if last frag + MOVNI B,(A) + ASH B,2 ; Get -<# octets in header> + ADDI B,(E) ; Find # octets of data in this fragment + MOVEI C,(D) + LSH C,2 ; Get # octets data is offset + ADDI B,(C) ; Finally get total # data octets of full dgm + DPB B,[IP$TOL (T)] + ADDI E,3 ; Okay, round UP to full word + LSH E,-2 ; Get rounded-up length in terms of 4-octet wds + SUBI E,1(A) ; Get # whole wds of data (minus 1) + JRST IPRD56] ; Go rejoin normal processing + + ; Not last frag. Only special check is to ensure length of data + ; is rounded down to a fragment boundary (frags are 8-octet chunks). + TRZ D,-1# ; Not last frag, clean up RH of frag.first + LSH E,-2 ; Get rounded length in terms of 4-octet words + SUBI E,1(A) ; Get # whole words of data, minus 1 + TRNN E,1 ; Paranoia: ensure # wds of data was EVEN + SUBI E,1 ; If not, round DOWN to ensure 8-octet boundary + +IPRD56: JUMPL E,IPRD80 ; Flush if bad length + ADDI E,(D) ; Get frag.last + CAIL E, ; Make sure datagram won't be too big. + JRST [ METER("IP: Ifl huge dgm") + CALL IPFDFL ; Ugh, must flush whole datagram entry! + JRST IPRD90] ; Would it be better instead to just + ; truncate it, and accept anyway since TCP + ; can ACK up to that much? Probably not. + + ; Each hole descriptor is 1 word of format + ; hole.first: ,, + ; + ; During re-configuration of the hole descriptor list, following + ; ACs are used + ; A/ scratch + ; B/ hole.first (wd offset) + ; C/ hole.last + ; D/ ,,frag.first ; lastflg is 0 if last fragment. + ; E/ frag.last + ; Q/ ptr to current hole descriptor + ; TT/ ptr to previous hole descriptor + ; H/ ptr to start of data in reassembly buffer (base for offsets) + ; W/ ptr to IP header of just-arrived fragment + ; T/ ptr to IP header of reassembly buffer + ; R/ ptr to packet entry of just-arrived fragment + MOVEI Q,IP$CKS(T) ; Get ptr to 1st hole descriptor +IPRD61: MOVEI TT,(Q) ; Save old ptr + HRRE Q,(Q) ; Get next descriptor + JUMPL Q,IPRD68 ; Jump if end of list + MOVEI B,(Q) ; Set hole.first + ADDI Q,(H) ; Make ptr to hole descriptor + HLRZ C,(Q) ; Get hole.last + CAIGE C,(D) ; If hole.last < frag.first, + JRST IPRD61 ; back to try next hole farther on. + CAIGE E,(B) ; If frag.last < hole.first, + JRST IPRD68 ; passed affected area, so can stop now. + + ; New fragment interacts with current hole in some way! + ; Remove current hole from the list, but keep Q pointing to + ; start of hole. TT points to the last valid hole descriptor. + MOVE A,(Q) ; Get hole.first of next hole + HRRM A,(TT) ; Store in prev hole, so current is skipped. + CAIL B,(D) ; If hole.first < frag.first, skip. + JRST IPRD66 + + ; Create new hole descriptor at start of old hole + ; with new.first = hole.first and new.last = frag.first-1 + ; i.e. hole.first: ,, + ; First get ptr to new hole and put it on list. + HRRM B,(TT) ; Point prev hole to new hole. + HRLI A,-1(D) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + MOVEI TT,(Q) ; Make prev be current, in case test below wins + ; Drop thru to check high bound of old hole + +IPRD66: CAIL E,(C) ; If frag.last < hole.last then hole not all filled + JRST IPRD61 ; (hole all filled, so go check further holes) + CAIL D, ; Some hole left; is this the last fragment? + JRST [ HLLOS (TT) ; Yes! Zap prev hole to ensure list ends. + JRST IPRD68] ; and get out of loop now. + + ; Fragment didn't fill last part of hole, so need to create + ; new hole descriptor for it, + ; with new.first = frag.last+1 and new.last = hole.last + ; i.e. frag.last+1: ,, + MOVEI Q,1(E) ; Get frag.last+1 + HRRM Q,(TT) ; Point previous to new hole + ADDI Q,(H) ; Make abs ptr to new hole + HRLI A,(C) ; Make ,, + MOVEM A,(Q) ; Store new hole descriptor. + ; Can drop through to end loop, since no further holes + ; are affected. + + ; No more holes on list, we can copy the data now! +IPRD68: HLL D,PK.TCP(R) ; Get ,, + ADDI D,(H) ; Now have BLT pointer + ADDI E,(H) ; and now have terminating address + CAIN E,(D) ; But if only moving 1 word, + JRST [ HLRZ D,D ; Can't use BLT? + MOVE A,(D) ; So just move by hand + MOVEM A,(E) + JRST .+2] ; Skip over it. + BLT D,(E) ; Here we go! + + ; Now see if any holes left... + MOVEI W,(T) ; Save ptr to reassembly IP hdr (H already set) + MOVEI A,(R) ; No need for arrived dgm any more, + CALL PKTRTA ; so flush it now. + HRRE A,IP$CKS(W) ; See if any holes left + JUMPGE A,CPOPJ ; Jump if some left, nothing else to do. + + HRRZ R,IPFDPE(I) ; Win!!! Get back packet-entry ptr + LDB A,[IP$IHL (W)] ; Must perform final TOL fixup. Get IHL + LSH A,2+4 ; in octets, shifted to TOL field + ADDM A,IP$TOL(W) ; Now have proper length! + SETZM IPFDPE(I) + SETOM IPFDID(I) + HRLOI A,377777 + MOVEM A,IPFTTL(I) + AOS IPMFRD ; Bump cnt of # datagrams reassembled! + JRST IPRD20 ; Go dispatch the datagram! + + + ; Create entry in table to store 1st fragment in. +IPRD70: MOVEI I,NIPF-1 + SKIPE IPFDPE(I) + SOJGE I,.-1 + JUMPL I,[METER("IP: Ifls Fragtab full") ; Barf, fragment table full. + JRST IPRD90] + LDB A,[IP$TTL (W)] ; Get time-to-live + JUMPE A,IPRD90 ; Might as well hack zero case + IMULI A,30. ; Turn into 30ths + ADD A,TIME + MOVEM A,IPFTTL(I) ; Store timeout value + MOVEM D,IPFDID(I) ; Store ptcl,,ID + HRRZM R,IPFDPE(I) ; Store PE ptr + + ; Messy stuff, must get data set up into right place in buffer. + ; If this is the 1st fragment we are OK, and can use original + ; datagram buffer, else we have to shuffle data. Simplest way + ; to handle latter case is to just get a new buffer and copy + ; it over. + LDB A,[IP$FRG (W)] ; Get fragment offset field + JUMPN A,IPRD75 ; If not zero, jump to do copy. + LDB A,[IP$TOL (W)] ; Hurray, 1st fragment! Get total length + LSH A,-2 ; Round down to # words + LDB B,[IP$IHL (W)] + SUBI A,(B) ; Find # words that fragment uses + TRZ A,1 ; Ensure # wds is rounded down to 8-octet chunk + JUMPLE A,[CALL IPFDFL ; Sigh, flush entry. + RET] ; Just return, only flushing one PE. + HRRM A,IP$CKS(W) ; Store first hole.next in header. + MOVEI B,(A) + ADDI B,(H) ; Get addr of start of hole + SETOM (B) ; Make it an infinite hole. + RET + + ; Fragment entry must be stored, but it isn't the 1st thing in + ; the datagram. We must cons up a fake initial fragment and + ; then copy normally into that fragment. + ; Note that this fake fragment must be carefully initiallized + ; since certain IP fields are referred to in the reassembly code + ; (via pointer in T) +IPRD75: CALL PKTGFI ; Get a PE ptr at PI lvl + JRST IPFDFL ; Failed, must flush entry + TRCPKT A,"Reassembly alloc" + MOVEM A,IPFDPE(I) ; Store it + HRRZ T,PK.BUF(A) + HRLM T,PK.IP(A) ; Say IP header at start of buffer. + MOVEI H,15. ; Use maximum IHL for offset + HRRZM H,IP$CKS(T) ; Store this offset as ptr to 1st hole desc + ADDI H,(T) ; and make data start at end of max IP hdr. + HRLM H,PK.TCP(A) + SETOM (H) ; Make 1st hole descriptor be infinite + SETOM IP$FRG(T) ; Put crap in frag offset field + MOVE B,IP$SRC(W) ; and ensure source host copied too. + MOVEM B,IP$SRC(T) + JRST IPRD55 ; Now go do the copy... + +IPRD80: METER("IP: Ifl bad len") ; Bad IP length field + JRST IPRD90 ; Go flush the dgm. + +; IPFCLK - Called every few seconds at clock level to check +; reassembly tables and flush any partially filled datagrams +; which have timed out. + +IPFCLK: MOVEI I,NIPF-1 + MOVE B,TIME + CONO PI,NETOFF ; Hack with net ints deferred. + CAML B,IPFTTL(I) + CALL IPFDFL ; Flush the partial dgm + SOJGE I,.-2 + CONO PI,NETON ; Done, re-enable net ints. + RET + +; IPFDFL - Flush reassembly entry in I +; Clobbers A, Q, T + +IPFDFL: SKIPE A,IPFDPE(I) + CALL PKTRTA ; Flush the packet buffer + SETZM IPFDPE(I) + SETOM IPFDID(I) ; Clear out other table stuffs. + HRLOI A,377777 + MOVEM A,IPFTTL(I) + RET + + +; Datagram Fragment table. +; Free entries have IPFDPE 0, IPFDID -1, and IPFTTL SETZ-1 (max pos time) +EBLK +NIPF==:30 ; Max # of outstanding IP datagram reassembly buffers +IPFDPE: BLOCK NIPF ; +IPFDID: REPEAT NIPF,-1 ; ,, +IPFTTL: REPEAT NIPF,SETZ-1 ; Sys time after which entry flushed. +BBLK + +SUBTTL IP Output Interrupt Level + +IFE IPUNCP,[ + +EBLK +IPOUTQ: 0 +IPOBLQ: 0 +BBLK + +; IPGIOQ - Get IP Output Queue entry for IMP +; Returns .+1 if nothing in queue +; Returns .+2 +; A/ Pointer to datagram structure +; B/ Output BLKO pointer to buffer, -<# wds>,, +; C/ Arpanet host address +; H/ host-table index +; Clobbers Q,T,W,D,E + +IPGOQ1: METER("IP: ODs flushed") + CALL PKTRT ; Internal looping point + +IPGIOQ: MOVEI Q,IPOUTQ + CALL PKQGF(PK.IP) ; Get first thing off IP output list + JUMPE A,IPGOQ9 ; Jump and return if nothing there. + MOVE T,PK.FLG(A) ; Get packet flags + TLNE T,(%PKFLS) ; Should we flush this one? + JRST IPGOQ1 ; Yes, down the drain it goes. + TLO T,(%PKPIL) + IORM T,PK.FLG(A) ; Say packet locked at PI level. + + SKIPLE C,PK.BUF(A) + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm on queue] +IFE KS10P,[ + ;KS doesn't care, save 2 usec.. + MOVN B,C ; Straightforward way to put together AOBJN ptr. + HRRI B,-1(C) ; Now have BLKO +] + MOVE C,PK.DST(A) ; Get destination address + + ; IMP-specific!!! + ; Ask interface if it wants this particular datagram right now. + ; + CALL IMPCTS + JRST IPGOQ5 ; Can't send, requeue + + ; Got valid dgm, must ensure that block queue is merged back + ; onto beginning of output queue. +IPGOQ6: METER("IP: ODs sent") + SKIPN D,IPOBLQ ; See if anything was blocked + JRST POPJ1 ; Nope, just take win return. + SETZM IPOBLQ ; Yes, block queue exists! + SKIPN T,IPOUTQ ; Get ptr to 1st node on output queue + JRST [ MOVEM D,IPOUTQ ; If nothing was left on output queue, + JRST POPJ1] ; can simply move the list. + HLRZ E,D ; Get ptr to last node on blocked queue + HRRM T,PK.IP(E) ; Point end of blocked Q to start of output Q + HRRM D,IPOUTQ ; and point start of output Q to start of block Q + JRST POPJ1 ; and return with nice winning dgm. + + ; Come here to handle blockage of IP datagram. +IPGOQ5: MOVSI T,(%PKPIL) + ANDCAM T,PK.FLG(A) ; Say not locked at PI after all + MOVEI Q,IPOBLQ + CALL PKQPL(PK.IP) ; Put blocked dgm onto block queue + JRST IPGIOQ ; Now go try next dgm. + + ; Output queue empty, just shift block queue back. +IPGOQ9: SKIPN A,IPOBLQ ; See if anything was put on block queue + RET ; Nope, all's clear. + MOVEM A,IPOUTQ ; Aha, move it to standard output queue + SETZM IPOBLQ ; and clear the block-queue ptr. + RET ; Nothing to send from IP at moment. + +] ;IFE IPUNCP + +; IPIODN - Output of IP datagram complete, wrap up. +; Called by all device drivers. +; A/ pointer to datagram structure +; Clobbers T,Q +; Returns .+1 always + +IPIODN: TRCPKT A,"IPIODN Packet output complete" + MOVE T,PK.FLG(A) ; Get flags for packet + TLO T,(%PKODN) ; Say output done, + TLZ T,(%PKPIL) ; and unlock PI level output flag. + MOVEM T,PK.FLG(A) ; Store flags back. + CALRET PKTRT ; Return to freelist if not otherwise queued + + +SUBTTL ICMP - Internet Control Message Protocol + +; ICMP called at NET interrupt level to process just-received ICMP +; datagram. + +ICMP: + + ; First compute and verify checksum for ICMP data. + + ; Then dispatch on type for processing. + LDB E,[IP$SRC (W)] ; Load up source addr (commonly needed) + LDB A,[IC$TYP (H)] ; Get ICMP type field + CAIL A,NICMPT + JRST ICMP19 + AOS ICMPCT(A) ; Bump count of types + JRST @ICMPTB(A) ; Dispatch on type + + ; Bad type +ICMP19: BUG INFO,[ICMP: Bad type ],DEC,A,[from ],OCT,E +ICMP90: MOVEI A,(R) + CALL PKTRTA + RET + +ICMPTB: ICMP90 ; 0 Echo Reply (ignored) + ICMP19 ; 1 - + ICMP19 ; 2 - + ICMP90 ; 3 Destination Unreachable (ignored) + ICMP90 ; 4 Source Quench (ignored) + ICMRD ; 5 Re-direct + ICMP19 ; 6 - + ICMP19 ; 7 - + ICMEK ; 8 Echo + ICMP19 ; 9 - + ICMP19 ; 10 - + ICMP90 ; 11 Time Exceeded (ignored) + ICMPP ; 12 Parameter Problem + ICMP90 ; 13 TimeStamp (ignored) + ICMP90 ; 14 TimeStamp Reply (ignored) + ICMP90 ; 15 Information Request (ignored) + ICMP90 ; 16 Information Reply (ignored) +NICMPT==.-ICMPTB +EBLK +IPMICM: 0 ; # of ICMP datagrams +ICMPCT: BLOCK NICMPT ; # of ICMP datagrams, by type +BBLK + +; Type 8 - Echo + +ICMEK: MOVEI A,0 ; Set type to Echo Reply + DPB A,[IC$TYP (H)] + LDB A,[IC$CKS (H)] ; Fix checksum for change of 8 to 0 + ADDI A,8_8 + TRNE A,1_16. + ADDI A,1 + DPB A,[IC$CKS (H)] + MOVE A,IP$SRC(W) ; Exchange source and destination + EXCH A,IP$DST(W) + MOVEM A,IP$SRC(W) + MOVEI B,60. ; Reset time to live + JRST ICMEK1 ; Go send packet + +; Type 12 - Parameter Problem. + +ICMPP: LDB B,[IC$COD (H)] ; Get code field + JUMPE B,ICMPP2 + BUG INFO,[ICMP: Param err, code ],OCT,B,[from ],OCT,E + JRST ICMP90 +ICMPP2: LDB A,[341000,,1(H)] ; Get pointer into bad IP header + MOVEI B,(A) + LSH B,-2 ; Find word # error is in + ADDI B,IC$IPH(H) ; Make addr to word + BUG INFO,[ICMP: Param err, ptr ],OCT,A,[wd ],OCT,(B),[from ],OCT,E + JRST ICMP90 + +; ICMP type 5 - Redirect + +ICMRD: MOVEI D,IC$IPH(H) + MOVE A,IP$SRC(D) ; Get source addr of alleged IP header + CAME A,[IMPUS4_4] ; Must be a datagram WE sent. +IFE IPUNCP,[ + CAMN A,[IMPUS3_4] + CAIA + ] + JRST ICMP90 ; Bah, flush. Probably should log it. + LDB A,[IP$DST (D)] ; Get dest addr we used + GETNET A ; Derive net number + LDB B,[IC$GWA (H)] ; Get gateway addr recommended for this net + MOVEI C,NIPGW-1 ; Scan backwards thru gateway table + SETOB T,TT ; Index of free slot, index of oldest slot +ICMRD2: CAMN A,IPGWTN(C) + JRST [ SKIPN IPGWTG(C) ; Don't change a direct-route entry! + JRST ICMP90 + JRST ICMRD3 ] + CAIL C,NIPPGW ; Skip if prime gateway, not replaceable + JRST [ SKIPN IPGWTN(C) + MOVEI T,(C) ; Save index of last free slot found + SKIPL TT + CAML D,IPGWTM(C) + MOVEI TT,(C) ; Save index of least recently used slot + MOVE D,IPGWTM(TT) + SOJA C,ICMRD2 ] + SOJGE C,ICMRD2 + + ; Network not found in gateway table, must make new entry. + SKIPL C,T ; If there was one free, + JRST ICMRD3 ; go use that one. + MOVE C,TT ; Otherwise use least recently used entry + MOVE T,TIME + SUB T,IPGWTM(C) + CAIGE T,60.*60.*30. ; Flushing entry less than 1 hour old? + BUG INFO,[ICMP: GW table full, net/gw ],OCT,IPGWTN(C),OCT,IPGWTG(C),[=>],OCT,A,OCT,B +ICMRD3: GETNET D,B ; Figure out which interface this gateway is on + MOVEI T,NIPPGW-1 + SKIPN IPGWTG(T) + CAME D,IPGWTN(T) + SOJGE T,.-2 + JUMPL T,ICMP90 ; I can't figure out how to get to this gateway anyway + MOVEM A,IPGWTN(C) ; Set network number + MOVEM B,IPGWTG(C) ; and its corresponding gateway addr + MOVE T,IPGWTI(T) ; and its interface + MOVEM T,IPGWTI(C) + MOVE T,TIME ; Pretend it was used so it + MOVEM T,IPGWTM(C) ; stays around for a while + JRST ICMP90 ; Done! + +SUBTTL IPQ Device - Internet Protocol Queues + +; Internet Protocol User Datagram Queue stuff, manipulated with +; IPKIOT system call. +; Queue 0 is special: +; Must be asked for explicitly +; All Input datagrams are vectored through it. +; No limit on input queue length +; Can put datagrams back into system for further processing +; Can send datagrams (like ordinary queue actually in this respect) +; Queue 1 is also special: +; Must be asked for explicitly +; All output datagrams are vectored through it. +; No limit on queue length +; Can put datagrams back onto device output queue. + +IFNDEF NIPUQ,NIPUQ==10 ; # User queues allowed +EBLK +IPUQUS: BLOCK NIPUQ ; ,, + IQ%CH==<77,,> ; Field for channel # + IQ$CH==<.BP IQ%CH,IPUQUS> ; BP to channel # +IPUQHD: BLOCK NIPUQ ; Input queue header +IPUQCT: BLOCK NIPUQ ; # datagrams on input queue,,vector args + +IPQOSW: -1 ? 0 ; IP Queue assignment lock + BBLK + +; IPQO - IPQ OPEN routine +; Control bits currently defined are + %IQSYS==100 ; Set up System Queue (0 or 1) + %IQSOU==200 ; System Queue 1 if set, otherwise 0 + %IQUDP==400 ; Set up random queue for UDP (port # in FN1) + +IPQO: CALL SWTL ; Only one job at a time hacking IQ allocation. + IPQOSW + SETZB E,I ; Set up convenient zeros + TLNE C,%IQSYS ; Asking for system queue? + JRST [ TLNE C,%IQSOU ; Yes, want input or output? + MOVEI I,1 ; Output, use queue 1 + SKIPE IPUQUS(I) ; Skip if it's free + JRST OPNL23 ; Nope, say "file locked". + JRST IPQO2] ; Can grab it, do so! + MOVE I,[-,,2] ; Scan tables, skipping 0'th entry + SKIPE IPUQUS(I) ; Look for free slot + AOBJN I,.-1 + JUMPGE I,OPNL6 ; If none available, claim "device full" + TLNN C,%IQUDP ; Got it. If will use UDP vectoring, + JRST OPNL33 ; No, complain "meaningless args" + ; since nothing else understood yet. + TLO E,%IQUDP ; then set flag for IPUQUS. + HRRZM A,IPUQCT(I) ; Store FN1 as UDP port number + CAIA +IPQO2: SETZM IPUQCT(I) + SETZM IPUQHD(I) ; Clear input queue + MOVEI A,IPQDN ; IOCHNM device index to use + HRLI A,(I) ; Save IQ index in LH + MOVEM A,(R) + MOVEI A,-IOCHNM(R) ; Start putting together the IPUQUS entry. + SUBI A,(U) ; Get channel # + DPB A,[.BP IQ%CH,E] ; Remember it in IPUQUS word + HRRI E,(U) ; Put user index in RH + MOVEM E,IPUQUS(I) ; Store, queue is now activated! + ; Note this must be last thing, to avoid + ; timing errors. + CALRET LSWPJ1 ; Unlock switch and return! + +; IPQCLS - IPQ CLOSE routine + +IPQCLS: HLRZ I,(R) ; Get IQ idx + CAILE I,1 ; Is it the Sys In or Out queue? + JRST IPQCL5 ; Nope, can handle normal case. + CONO PI,NETOFF ; Keep anything from being added meanwhile + SETZM IPUQUS(I) ; Mark queue not active, to avoid revector loops. + SETZM IPUQCT(I) ; Be tidy and clear other stuff too. + JUMPE I,IPQCL3 + + ; Close down System Output queue. This means all output + ; on this queue gets moved directly onto the real output + ; queue. +IPQCL1: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Get first thing queued up + JUMPE A,[CONO PI,NETON ; Exit if no more. + CALRET IPOGO] ; Ensure output fired up. + MOVEI Q,IPOUTQ + CALL PKQPL(PK.IP) ; Put at end of real output queue + JRST IPQCL1 + + ; Close down System Input queue. This means all currently + ; queued input gets processed immediately. Note I gets + ; clobbered, but isn't necessary since we know this is queue 0. +IPQCL3: MOVEI Q,IPUQHD ; Get header for queue 0 + CALL PKQGF(PK.IP) ; Get A/ packet ptr + JUMPE A,NETONJ + HLRZ B,PK.BUF(A) ; Get B/ # words in packet + SETZ C, ; Get C/ # wds offset to IP header + CALL IPRDGM ; Process and vector it. + JRST IPQCL3 ; Get next + + + ; Normal datagram input queue. Doesn't need NETOFF since + ; PI level ignores the queue entry if it's inactive. Just + ; need to keep another job from assigning it... +IPQCL5: CONO PI,CLKOFF + SETZM IPUQUS(I) ; Clear its "active" entry word to stop queueing + CALL IPQRS2 ; Flush its input queue (clears IPUQHD) + SETZM IPUQCT(I) + CONO PI,CLKON + RET + +; IPQRST - IPQ RESET routine. Clears queue for channel. +; This is pretty drastic for the System I/O queues. + +IPQRST: HLRZ I,(R) ; Get IQ idx + CONO PI,NETOFF ; Prevent new dgms from arriving meanwhile. + CALL IPQRS2 ; Flush the queue + JRST NETONJ + +IPQRS2: MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Pull off 1st thing + JUMPE A,CPOPJ ; Return when no more + MOVE T,PK.FLG(A) + CAIN I,1 ; If queue is the Sys Output queue + JRST [ TLNE T,(%PKFLS) ; Then do special stuff. + JRST IPQRS3 ; Flush only if explicitly requested + TLZ T,(%PKPIL) ; Otherwise clear PI-Locked bit + TLO T,(%PKODN) ; and claim "output done" (ha ha) + MOVEM T,PK.FLG(A) + JRST IPQRS2] +IPQRS3: CALL PKTRT ; Put all stuff on freelist. + JRST IPQRS2 + +; IPQIO - IPQ I/O routine (if anything actually tries using this) + +IPQIO: JRST OPNL34 ; Say "Wrong Type Device" + POPJ P, + +; IPQSTA - IPQ STATUS routine + +IPQSTA: + POPJ P, + +; IPQWHY - IPQ WHYINT routine + +IPQWHY: + JRST POPJ1 + +; IPQRCH - IPQ RFNAME/RCHST routine + +IPQRCH: + POPJ P, + +; IPQRFP - IPQ RFPNTR routine + +IPQRFP: JRST OPNL34 + +; IPQIOP - IPQ IOPUSH/IOPOP routine + +IPQIOP: MOVEI T,(R) + SUBI T,IOCHNM(U) + CAIN I, + MOVEI T,77 ; IOPUSH, use 77 + HLRZ I,(R) ; Get IPQ index + DPB T,[IQ$CH (I)] ; Deposit channel # + POPJ P, + +; IPQFRC - IPQ FORCE routine + +IPQFRC: + JRST POPJ1 + +; IPQFIN - IPQ FINISH routine + +IPQFIN: + JRST POPJ1 + +; IPQUSI - Give User Interrupt on I/O channel. Not a system call, +; but called by PI level routines when input arrives for +; a previously empty queue. +; Clobbers T,Q +; I/ index to IP Queue + +IPQUSI: LDB Q,[IQ$CH (I)] ; Get channel # + CAIN Q,77 ; If IOPUSHed, no interrupt. + RET + PUSH P,U + HRRZ U,IPUQUS(I) ; Get user index + CAIN U, + BUG +; MOVSI T,(SETZ) ; Needn't force PCLSR'ing. +; IORM T,PIRQC(U) + MOVE T,CHNBIT(Q) + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + + +SUBTTL .CALL IPKIOT - IPQ data transfer + +; .CALL IPKIOT - Internet Protocol Packet Transfer. +; Arg 1 is channel (must be open on IPQ:, specifies queue #) +; Arg 2 is address of buffer +; Arg 3 is count of words +; Val 1 is count of words read into user space (if any) +; Control bits specify function. If none, "read" is assumed. +; Get datagram from: + %IPIUS==100 ; 1 = Get datagram from user space, not from a queue + %IPNOC==200 ; Global input no-check flag, suppresses normal check. + ; For User Space, "check" means verify, set cksum. + ; For Input Queue, "check" means verify IP header. + ; For SysIn Queue, "check" means verify IP hdr. + ; For SysOut Queue, means nothing. + %IPNOH==400 ; Don't Hang waiting for datagram (Queues only) + %IPIQK==1000 ; Keep on queue, don't remove (only for %IPOUS) +; Put datagram to: + %IPOUS==0 ; User space + %IPOUT==1 ; Output to network (bypasses SysOut queue) + %IPOFL==2 ; Flush it + %IPORV==3 ; Re-vector to input queues past this one + +IPKIOT: + HRRZ A,(R) + CAIE A,IPQDN ; Must be right type device (IPQ) + JRST OPNL34 ; Wrong device + HLRZ I,(R) ; Get IP input queue index + CAIL I,NIPUQ ; Ensure it's valid. + BUG HALT,[Bad IPUQ idx in IOCHNM] + MOVE E,CTLBTS(U) ; Get control bits for this call + MOVEI J,(E) + ANDI J,3 ; Get output type in J + + TRNN E,%IPIUS ; Getting datagram from user? + JRST [ CAIN J,%IPOUS ; Giving datagram to user? + CAIL W,3 ; Yes, ensure at least 3 args. + JRST IPKIO2 ; All's OK, go check input queue. + JRST OPNL30] ; Will write to user, but too few args! + CAIGE W,3 ; Must have at least 3 args for this one. + JRST OPNL30 ; Too few args. + + ; Get datagram from user. + ; B/ user addr of buffer + ; C/ # of 32-bit words in buffer + TRZ E,%IPIQK ; Flush "keep" bit since won't be on any list! + CAIL C,5 ; Must have at least 5 words for IP + CAIL C,%IMXLN ; Must be less or eq to maximum datagram size + JRST OPNL33 ; Too big, say meaningless args. + CAIN J,%IPOUS ; Outputting back to self? + JRST POPJ1 ; Yeah, just turn into a NOP. + CALL PKTGF ; Get a free packet buffer (hangs until got it) + PUSHJ P,LOSSET ; Must put back on freelist if we PCLSR on BLT fault + PKTPCL ; Standard routine expects ptr in A + TRCPKT A,"IPKIOT Alloc" + MOVSI B,(B) + HRR B,PK.BUF(A) + MOVEI D,(C) + ADDI D,-1(B) ; Find last address copying into + XCTR XBR,[BLT B,(D)] ; Gobble up user's buffer! May fault. + PUSHJ P,LSWDEL ; Made it through, can flush PCLSR protection + HRLM C,PK.BUF(A) ; Set # words used in buffer + MOVE B,PK.BUF(A) ; Find addr of start of buffer + HRLZM B,PK.IP(A) ; and set start of IP header. + LDB D,[IP$IHL (B)] ; Find claimed length of IP header + ADDI D,(B) ; Get addr of start of IP data + HRLZM D,PK.TCP(A) ; Set that too. + JRST IPKIO3 ; Now decide about checking datagram! + + ; Get datagram from input queue. +IPKIO2: CONO PI,NETOFF + SKIPN A,IPUQHD(I) ; Anything in the queue? + JRST [ CONO PI,NETON + TRNE E,%IPNOH ; No, see if ok to hang. + JRST POPJ1 ; Don't hang, win-return zero wds-read in A. + SKIPN IPUQHD(I) ; Hang, here we go. + CALL UFLS + JRST IPKIO2] + TRNN A,-1 ; Make sure something was there! + BUG + CAIN I,1 ; Is this SysOut queue? + JRST [ MOVE T,PK.FLG(A) ; Yes, get flags + TLNN T,(%PKFLS) ; Actually wants to flush now? + JRST .+1 ; No, let's go with it. + MOVEI Q,IPUQHD(I) + CALL PKQGF(PK.IP) ; Remove from queue + CAIN A, + BUG + CALL PKTRT ; Flush it. + JRST IPKIO2] + CONO PI,NETON + MOVE T,PK.BUF(A) ; Verify that something exists + TLNE T,-1 ; in both <# wds> field + TRNN T,-1 ; and field. + BUG HALT,[IPQ: Null dgm found on queue] + HLRZ T,PK.IP(A) ; Should also be an IP pointer + CAIN T, + BUG HALT,[IPQ: IP-less dgm on queue] + + ; Now have pointer in A to a datagram. It is still linked + ; on the input queue, unless %IPIUS is set. +IPKIO3: TRNE E,%IPNOC ; Should we check the contents at all? + JRST IPKIO5 ; Nope, just go straight ahead. + JFCL ; Here we should verify/set checksum, but... + + ; Now figure out where datagram wants to go! +IPKIO5: JRST @.+1(J) ; Only have 4 possibilities so far. + IQIO70 ; %IPOUS Output to user + IQIO60 ; %IPOUT Output to network + IQIO55 ; %IPOFL Flush it + IQIO80 ; %IPORV Re-vector through input queues + + ; %IPOFL Flush datagram. +IQIO55: TRNN E,%IPIUS ; Is it from input queue list? + CALL IPIQGF ; Yes, take it off input queue list + CALL PKTRT ; Now can return to packet freelist! + JRST POPJ1 ; Win return. + + ; %IPOUT Output datagram to network. +IQIO60: TRNN E,%IPIUS ; Is it still on an input list? + CALL IPIQGF ; Yes, take it off input queue list + CAILE I,1 ; If not from Sys I/O queue, + JRST [ CALL IPKSNQ ; Possibly send onto SysOut queue. + JRST POPJ1] + CALL IPKSNI ; Dgm from Sys queue, never goes back to SysOut + JRST POPJ1 + + + ; %IPOUS Output datagram to user (a "read" from user viewpoint) + ; This is the only place where we can PCLSR on "output". Note + ; that we cannot get here if datagram came from user, so the + ; datagram we point to is always still on input queue, and + ; we can safely PCLSR without any special backup. +IQIO70: HLRZ D,PK.BUF(A) ; Find # words available + JUMPLE C,OPNL33 ; Neg or zero count -> meaningless arg error + CAILE C,(D) ; If asking for more wds than exist, + MOVEI C,(D) ; only furnish what we've got. + MOVEI D,(B) + ADDI D,-1(C) ; Find last user word to write + HRL B,PK.BUF(A) + XCTR XBW,[BLT B,(D)] ; Shove it at him; can PCLSR here. + TRNE E,%IPIQK ; Done! Should we keep datagram around? + JRST IQIO75 ; Yes, don't flush it. + CALL IPIQGF ; Take datagram off the input queue. + CALL PKTRT ; Return entry/buffer to freelist. +IQIO75: MOVEI A,(C) ; Return count as 1st val! + JRST POPJ1 + + ; Must re-vector through stuff... + ; Note that it is illegal to re-vector a datagram from the SysOut + ; queue, because it still shares pointers and stuff with + ; (for example) TCP retransmit queues. Later, could add code to + ; get another packet buffer and copy it over, but this is better + ; done at the device driver level probably. +IQIO80: TRNN E,%IPIUS ; Came from user? + JRST [ CAIN I,1 ; No, from a queue; is it the SysOut queue? + JRST OPNL2 ; Yes, illegal. Say "Wrong direction". + CALL IPIQGF ; No, is OK. Take it off input list. + JRST .+1] + MOVEI R,(A) + HLRZ W,PK.IP(R) ; Get pointer to IP header + HLRZ H,PK.TCP(R) ; and to IP data. + SETZ J, + CONO PI,NETOFF + CALL IPRDGV ; Go vector and process the datagram. + CONO PI,NETON + JRST POPJ1 + + ; Auxiliary, clobbers D to do checking. +IPIQGF: MOVEI D,(A) + MOVEI Q,IPUQHD(I) ; Is from list, must take it off. + CALL PKQGF(PK.IP) ; Remove from IP queue list + CAME A,D + BUG ; Something added in meantime??? + RET + +SUBTTL IP TCP Interface Routines + +; IPMTU - Size of largest datagram we want to send to a given destination +; A/ Destination address +; Returns T/ MTU + +SUBN27==: ; Damn macro generates an error inside literal +NW%CHW==: ; Old CHAOS-wrapping scheme, probably unused + +IPMTU: +IFE IPUNCP,[ + PUSH P,A ; Save address for a bit + MOVEI T,576. ; Default value + GETNET A ; Network part only + CAMN A,[NW%ARP] ; Arpanet? + MOVEI T,%IMMTU ; MTU of IMP + CAMN A,[NW%AI] + MOVEI T,%IMMTU ; AI net. We know we have a good path + CAMN A,[NW%CHW] ; Wrapped chaos packets + MOVEI T,488. ; Smaller MTU + CAME A,[NW%LCS] ; Net 18 is ugly, must check subnets + JRST IPMTU1 + MOVE A,(P) ; Get full address back + TRZ A,177777 ; Mask off all but 18. + CAMN A,[SUBN27] ; Subnet 27 is fed by chaos-wrapping. + SKIPA T,[488.-40.] ; Giving it a very small MTU + MOVEI T,%IMMTU ; Good path to all others +IPMTU1: POP P,A +] ;IFE IPUNCP +IFN IPUNCP, MOVEI T,488.-40. ; This should be small enough... + RET + +IF1,.ERR Amazing MIT-Specific crocks near IPMTU... + +; IPBSLA - Best Local Address for a given destination +; A/ Destination IP Address +; Return A/ Local Address to use + +IPBSLA: +IFE IPUNCP,[ + GETNET A + CAMN A,NW%CHW + SKIPA A,[IMPUS4] ; Local Address on wrapped-chaos net + MOVE A,[IMPUS3] ; Default local host address to IMP +] ;IFE IPUNCP +IFN IPUNCP, MOVE A,[IMPUS4] + RET + +; IPLCLH - Skip return if address in A is one of us. +; Called with JSP T,IPLCLH + +IPLCLH: +IFE IPUNCP, CAME A,[IMPUS3] + CAMN A,[IMPUS4] + JRST 1(T) + JRST (T) + +; IPKSND - Invoked by TCP to send off a segment. +; Fills in the IP header fields, checksums, and puts on output queue. +; R, W, H set up pointing to segment +; The out-of-TCP information is contained in the "IP header" that +; W points to: +; IP$SRC - Source addr +; IP$DST - Dest Addr +; IP$TOL - Length of segment in bytes (must add IP header length) +; Clobbers A,B,C,D,E,Q,T +EBLK +IPIDCT: 0 ; IP identification #, incremented for each datagram +BBLK + +IPKHDR: MOVE A,IP$VER(W) ; Get first word + ADDI A,<5*4>_4 ; Add length of IP header (5 wds for now) + HRLI A,212000 ; Fill in Ver, IHL, TOS + MOVEM A,IP$VER(W) ; Set 1st wd + ADDI A,3_4 ; Now, to get # of words, round up + LSH A,-<4+2> ; (note flush 4 spare bits then divide by 4) + ANDI A,37777 ; 14 bit field now + HRLM A,PK.BUF(R) ; Store # of words, for device driver. + MOVSI A,170030 ; TTL and PTC (TCP) + MOVEM A,IP$TTL(W) ; Set 3rd wd + +IPKHD2: AOS A,IPIDCT ; Get new ID number + LSH A,<16.+4> ; Left justify it + MOVEM A,IP$ID(W) ; Use to set up 2nd wd (no flags/frags) + CALL IPCKSM ; Get IP header checksum + DPB A,[IP$CKS (W)] ; In it goes! + RET + +IPKSND: TRCPKT R,"IPKSND output call" + CALL IPKHDR + MOVEI A,(R) ; Set up PE ptr arg for following stuff. + +; IPKSNQ - entry point from IPKIOT, to send a datagram. +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q + +IPKSNQ: MOVSI T,(%PKODN) ; Clear the "output-done" flag. + ANDCAM T,PK.FLG(A) + TRCPKT A,"IPKSNQ output call" + SKIPE IPUQUS+1 ; Check - have System Output queue? + JRST IPKSN5 ; Yes, put on that queue. + ; No, drop into IPKSNI + +; IPKSNI - Route packet to appropriate gateway and interface +; A/ PE ptr to datagram - PK.BUF must be set up. +; Clobbers A,B,T,Q +IPKSNI: PUSH P,C + SKIPLE C,PK.BUF(A) ; Get the packet buffer from the PE + CAMG C,[2,,0] + BUG HALT,[IP: Null dgm being sent] + LDB C,[IP$DST(C)] ; Get destination address + + ;; This is where to apply final gateway routing code, based on Internet address in C. + GETNET T,C ; Get network # into T + MOVSI Q,-NIPGW ; Search table of gateways and direct routes + CAME T,IPGWTN(Q) ; Skip if network # matches + AOBJN Q,.-1 + JUMPL Q,IPSNI1 ; Jump if found entry in table + AOS Q,IPGWPG ; No gateway known for this network, so try a + CAIL Q,NIPMGW ; prime gateway and hope for an ICMP redirect! + SETZB Q,IPGWPG ; Try a different prime gateway each time +IPSNI1: MOVE T,TIME ; Remember that this gateway entry was used + MOVEM T,IPGWTM(Q) + SKIPE IPGWTG(Q) ; Skip if this is a direct route + MOVE C,IPGWTG(Q) ; Get gateway address + MOVEM C,PK.DST(A) ; Save gateway address for interface to use + CALL @IPGWTI(Q) ; Dispatch to interface + POP P,C + RET + +EBLK +IPGWPG: 0 ; Index of current prime gateway + + ; Network number +IPGWTN: + NW%LCS ; LCS net + NW%AI ; MIT-AI-NET +NIPMGW==<.-IPGWTN> ; Number of prime gateways +IFE IPUNCP, NW%ARP ; ARPA Net + HOSTN 128,31,0,0 ; MIT Chaosnet +NIPPGW==<.-IPGWTN> ; Number of permanent gateways + BLOCK 64. ; Extra stuff to patch in and for redirects +NIPGW==<.-IPGWTN> + +; Internet address of gateway servicing given net number +IPGWTG: +IFE IPUNCP,[ + HOSTN 10,0,0,77 ; MIT-GW + HOSTN 10,3,0,6 ; MIT-AI-GW +] ;IFE IPUNCP +IFN IPUNCP,[ + HOSTN 128,31,6,1 ; ??? + HOSTN 128,31,6,2 ; ??? +] ;IFN IPUNCP +IFE IPUNCP, 0 ; Send direct to Arpanet + 0 ; Send direct to Chaosnet +IFN .-IPGWTG-NIPPGW, .ERR Permanent gateway table at IPGWTG wrong size +LOC IPGWTG+NIPGW + +IPGWTI: +IFE IPUNCP,[ + IPKSNA ; MIT-GW + IPKSNA ; MIT-AI-GW +] ;IFE IPUNCP +IFN IPUNCP,[ + IPKSNC ; ??? + IPKSNC ; ??? +] ;IFN IPUNCP +IFE IPUNCP, IPKSNA ; direct to Arpanet + IPKSNC ; direct to Chaosnet +IFN .-IPGWTI-NIPPGW, .ERR Permanent gateway table at IPGWTI wrong size +REPEAT NIPGW-NIPPGW,IPKSNA + +IPGWTM: BLOCK NIPGW ; TIME entry last used + +BBLK + +IFE IPUNCP,[ + +; Queue packet for Arpanet interface +IPKSNA: MOVEI Q,IPOUTQ ; Otherwise use direct IP output queue. + MOVE B,(Q) ; Save previous contents of queue header + CALL PKQPL(PK.IP) ; Put on IP output queue + CAIE B,0 ; Kick off IP output if necessary. + RET ; Not necessary, queue was not empty +IPOGO: CALRET IMPIOS ; Just means kicking IMP for now. + +] ;IFE IPUNCP + +; Queue packet for Chaosnet interface +; A has the pe +; PK.DST(A) has the Internet address to send to, 128.31.subnet.host +; The low 16 bits are Chaosnet address to send an UNC to +IPKSNC: PUSH P,H + PUSH P,J + PUSH P,E + PUSH P,W + MOVE J,A ;J has address of PE + MOVE H,PK.BUF(A) ;H has address of IP header + MOVEI E,0 ;E has number of bytes sent so far +IPKSC1: CALL CHABGI ;Get a Chaosnet buffer in A + JRST IPKSC9 ;Give up if can't get one + MOVSI T,-%CPKDT ;Zero out the Chaosnet header + HRRI T,(A) + SETZM (T) + AOBJN T,.-1 + MOVEI T,%COUNC + DPB T,[$CPKOP(A)] + MOVE C,PK.DST(J) + DPB C,[$CPKDA(A)] + MOVEI T,MYCHAD + DPB T,[$CPKSA(A)] + MOVEI T,8_8 ;DOD Internet #x0800 + DPB T,[$CPKAN(A)] ;Protocol number + AOS CHNIPO ;Meter Internet packets out to Chaosnet + LDB Q,[IP$IHL(H)] ;Internet header length in words + MOVE T,Q ;Save header length for later + MOVSI B,(H) ;BLT IP header into Chaos packet + HRRI B,%CPKDT(A) + ADDI Q,(B) + BLT B,-1(Q) ;Q saves address of first data word + LDB B,[IP$TOL(H)] ;Total length in octets including header + SUB B,E ;Number of bytes remaining to be sent + MOVEI C,IPKSC9 ;Continuation if no more fragments needed + CAIG B,%CPMXC ;Skip if need to fragment + JRST IPKSC2 + MOVEI B,%CPMXC/4 ;Compute number of 32-bit data words in fragment + SUB B,T + TRZ B,1 ;Round down to even multiple of 8 octets + ADD B,T + LSH B,2 ;Number of bytes in this fragment including header + MOVEI W,IP%FMF ;Set more-fragments flag + IORM W,IP$FLG+%CPKDT(A) + MOVEI C,IPKSC1 ;Continuation sends another fragment +IPKSC2: DPB B,[IP$TOL+%CPKDT(A)] ;Total length of this fragment + DPB B,[$CPKNB(A)] + PUSH P,C ;Save continuation address + MOVE W,E ;Get fragment offset + LSH W,-3 ;8-octet units + LSH T,2 ;Number of bytes in header + SUB B,T ;Number of data bytes + LDB C,[IP$FRG+%CPKDT(A)];Set fragment offset + ADD C,W + DPB C,[IP$FRG+%CPKDT(A)] + ADD T,E ;Byte offset of start of data to send + LSH T,-2 ;Word offset + ADD T,H ;Word address + HRL Q,T ;BLT pointer to copy data + MOVEI T,3(B) + LSH T,-2 ;Number of words to copy + ADDI T,-1(Q) ;Address of last word to store + BLT Q,(T) ;Copy the data + ADD E,B ;Offset for next fragment + MOVEI W,%CPKDT(A) + CALL IPCKSM ;Compute header checksum + DPB A,[IP$CKS (W)] ;Store header checksum + MOVEI A,-%CPKDT(W) ;Restore address of chaos packet + SETOM -2(A) ;Not on any packet lists + PUSH P,J ;Save registers clobbered by CHAXMT + PUSH P,D + PUSH P,E + PUSH P,TT + CALL CHAXMT ;Launch packet into Chaosnet + POP P,TT + POP P,E + POP P,D + POP P,J + POPJ P, ;Take continuation + +IPKSC9: MOVE A,J ; The PE + CALL IPIODN ; Say we're done transmitting this packet, + POP P,W ; although it's still in Chaos NCP somewhere + POP P,E + POP P,J + POP P,H + POPJ P, + +IPKSN5: MOVEI Q,IPUQHD+1 ; Put on System Output queue + MOVE B,(Q) ; Save prev contents of header + CALL PKQPL(PK.IP) + CAIE B, ; If stuff already there, + RET ; Just return, else + PUSH P,I ; Nothing there before, give user interrupt. + MOVEI I,1 ; On IPQ SysOut queue. + CALL IPQUSI + POP P,I + RET + +; IPCKSM - Computes checksum for IP header. +; W/ points to IP header. +; Clobbers B,C +; Returns A/ checksum + +IFNDEF JCRY0,JCRY0==: ; Jump on Carry from bit 0 (and clear flag) + +IPCKSM: SETZ A, + LDB C,[IP$IHL (W)] ; Get IP header length + MOVE B,IP$CKS(W) ; Get 3rd word + ANDCM B,[IP%CKS] ; Mask out the checksum field + JFCL 17,.+1 ; Clear flags + ADD B,IP$VER(W) ; Add 1st wd + JCRY0 [AOJA A,.+1] + ADD B,IP$ID(W) ; Add 2nd + JCRY0 [AOJA A,.+1] + ADD B,IP$SRC(W) ; Add 4th + JCRY0 [AOJA A,.+1] + ADD B,IP$DST(W) ; Add 5th + JCRY0 [AOJA A,.+1] + CAILE C,5 + JRST IPCKS4 ; Longer than 5 words, must hack options. +IPCKS2: LSHC A,16. ; Get high 2 bytes (plus carries) in A + LSH B,-<16.+4> ; Get low 2 bytes in B +IPCKS3: ADDI A,(B) ; Get total sum + CAILE A,177777 ; Fits? + JRST [ LDB B,[202400,,A] ; No, must get overflow bits + ANDI A,177777 ; then clear them + JRST IPCKS3] ; and add in at low end. + ANDCAI A,177777 ; Return ones complement + RET + +IPCKS4: SUBI C,5 ; C has a 4 bit value. + MOVN C,C ; Get neg of # words left + LSH C,1 ; Double it + JUMPL C,IPCKS5(C) + RET ; Something is wrong, so just return bad val. + +REPEAT 10.,[ + ADD B,5+<10.-.RPCNT>(W) + JCRY0 [AOJA A,.+1] +] +IPCKS5: JRST IPCKS2 ; Options all added, now go fold sum. + +IFN 0,[ ; Old version +IPCKSM: MOVEI C,(W) + HRLI C,442000 ; Gobble 16-bit bytes + ILDB A,C ; wd 0 byte 1 + ILDB B,C + ADDI A,(B) ; Add 2nd byte of 1st wd + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 1 ID,frag + ILDB B,C ? ADDI A,(B) ? IBP C ; 2 Skip chksum field + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 3 source addr + ILDB B,C ? ADDI A,(B) ? ILDB B,C ? ADDI A,(B) ; 4 dest addr +IPCKS8: CAIG A,177777 + JRST IPCKS9 + LDB B,[202400,,A] ; Get any overflow + ANDI A,177777 + ADDI A,(B) + JRST IPCKS8 +IPCKS9: ANDCAI A,177777 + RET + +] ;IFN 0 diff --git a/system/ioelev.430 b/system/ioelev.430 new file mode 100644 index 0000000..fd0e2ee --- /dev/null +++ b/system/ioelev.430 @@ -0,0 +1,4960 @@ +;;; -*-Midas-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + .TITLE IOELEVEN + + .SBTTL DEFINITIONS + +;;; note that the .IFM macro must be used only at toplevel +;;; (non-conditionalized) in PALX because it doesn't do the expansion of .IFM +;;; when conditionalized out, therefore it doesn't match it with the +;;; following .ENDC and the .ENDC will be seen at toplevel and end the +;;; conditionalization one is in. This will screw the code running on +;;; another one of the machines even if it doesn't signal an error in your +;;; assembly. --PGS + +.LIF NZ 0 + .FATAL USE PALX DUMMY!! + +;NOTE THAT THIS PROGRAM IS DESIGNED FOR 11/40'S. TO RUN ON AN +;11/10, MACRO OUT THE SOB INSTRUCTIONS. DOES NOT USE EIS NOR FIS. + +A=%0 ;TEMP/ARG/CHAR +B=%1 ;TEMP/ARG +C=%2 ;TEMP/ARG +D=%3 ;TEMP/ARG +H=%4 ;USUALLY INDEX IN HARDWARE UNIT TABLES +I=%5 ;USUALLY LINE NUMBER TIMES 2 +SP=%6 ;STACK POINTER +PC=%7 ;PROGRAM POINTER +PS=177776 ;PROGRAM STATUS +SWR=177570 ;SWITCHES + +.MACRO RTI +.ENDM ;FUCKING PALX! + +RTI=RTT ;11/40 HARDWARE MISFEATURE + +.IF P1 +.PRINT /MACHINE NAME = / +.TTYMAC MNAM +%TTYFLG==%TTYFLG+1 +.PRINT /MNAM +/ +%TTYFLG==%TTYFLG-1 +.MACRO .IFM MCHN ;REFERS TO PDP11 NAME +.IF IDN MCHN,MNAM +.ENDM .IFM +.MACRO MCONDX MCHN ;REFERS TO ITS SYSTEM NAME, USUALLY THE SAME +.IF IDN MCHN,MNAM +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY ;INSERT ITS SYSTEM NAME INTO BODY IN PLACE OF "MCHN" +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME +.ENDM ;TTYMAC +.ENDC ;P1 + +VERSION==%FNAM2 + +.IFM MC-DL ;MC'S DL-10 PDP11 +.MACRO MCONDX MCHN +.IF IDN MCHN,MC +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME + +DL10P==1 ;HAS DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==0 ;HAS DDT +NFTTY==102 ;2 * # OF FIRST TTY THIS 11 +NDHS==1 ;NUMBER OF DH11'S +NDHUN==15 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE (REST IN PEACE) +;MPXIDX==2*27 ;TTY INDEX OF LINE THAT MULTIPLEXED TTYS RUN OVER +NDMS==0 ;HAS DM11BB MODEM SCANNER (BUT IT'S NOT CONNECTED TO ANYTHING) +GOULDP==0 ;DOESN'T HAVE GOULD LPT (ANYMORE) +T300P==1 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB=0 ;CHAOSNET INTERFACE IS NEW, DOESN'T GET HUNG ANY MORE +CHAD0==440 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF +DLCADR==1440 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA DL10 (MC) +CHAD1==3040 ;SECOND INTERFACE +TEN11P==0 ;NO TEN-11 INTERFACE +ETHERP==0 ;NO ETHERNET +FTPULS==0 ;INITIALLY, MC DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;SAVE LAST GARBAGE PACKET RECEIVED +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;MC-DL + +.IFM MC ;MC CONSOLE 11 +DL10P==0 ;DOES NOT HAVE DL10 +DTE20P==1 ;HAS DTE20 +NODDT==0 ;HAS DDT AND KLDCP +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==2 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==310 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==1 ;FIRST DL11 IS T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS THAT GO THROUGH MULTIPLEXED LINE (NONE) +NDMS==2 ;has 2 DM11BB modem scanners (really DH11AD) +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==0 ;NO CHAOS NET INTERFACE +TEN11P==0 ;NO TEN-11 CHAOS INTERFACE +ETHERP==0 ;NO ETHERNET +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE + +.MACRO ASPIRP BODY ;DEFINE LINE #S WITH AUTOSPEED +.IRP N,<1,3,4,5,6,7,10,11,12,13,14,15,16,17> + BODY +.ENDM +.ENDM ASPIRP + +TKS==177560 +TKB==177562 +TPS==177564 +TPB==177566 +.ENDC ;MC + +.IFM AI ;AI'S CHAOS-ETHER-GATEWAY PDP11 + +;THIS IS A PDP11/10, WE HAVE TO REDEFINE A FEW THINGS +.MACRO RTT +.ENDM +RTI==2 +RTT==2 +.MACRO SOB REG,TAG + DEC REG + BNE TAG +.ENDM SOB + +DL10P==0 ;HAS NO DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==1 ;DOESN'T HAVE DDT (USE CARPET) +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==0 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==0 ;NUMBER OF DL11'S (ACTUALLY HAS ONE, BUT WE'RE NOT USING IT NOW) +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE +NDMS==0 ;HAS NO DM11BB MODEM SCANNERS +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB==0 ;CHAOSNET INTERFACE IS NEW-STYLE, DOES NOT GET HUNG +;CHAD0==426 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF (AI-MC-CROSS-STREET SUBNET) +;CHAD1==3072 ;SECOND INTERFACE (9TH FLOOR LISP MACHINE SUBNET) +CHAD0==3072 ;Change these two around because subnet 1 is dying of old age. +CHAD1==426 ;Note that with current code AI-11 can only do DOVER on CHAD0!! +TEN11P==0 ;USES TEN-11 INTERFACE FOR CHAOS NET TO AI-10 (NOT ANY MORE!) +T11ADR==2026 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA TEN-11 INTERFACE (AI) +NT11BF==3 ;THREE BUFFERS IN EACH DIRECTION FOR TEN-11 INTERFACE +ETHERP==1 ;ETHERNET +ETHHSN==6 ;MY HOST NUMBER BYTE, JNC SAYS I SHOULD USE 6 +NDVRBF==6 ;6 DOVER BUFFERS +DVRADR==1002 ;PUP ADDRESS OF DOVER +FTPULS==0 ;INITIALLY, AI DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;DON'T SAVE LAST GARBAGE PACKET RECEIVED (LOW ON CORE) (not that low) +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;AI + +.IIF NDF NDHS, .ERROR MACHINE NAME NOT RECOGNIZED + +.IIF NZ DL10P, .IIF Z NFTTY, .ERROR TTY # 0 DOESN'T WORK WITH DL10 PROTOCOL + +;ASSIGN TTY INDICES, HARDWARE INDICES, ETC. + +TX==NFTTY ;TTY INDEX +HX==0 ;HARDWARE INDEX +NCT==0 ;NUMBER OF TTYS + +;SYSTEM CONSOLE (OUT OF ORDER) +.IFNZ CTYP + TX==TX+2 + NCT==NCT+1 +.ENDC + +;DH11 LINES + NFDHTY==TX + TX==TX+<32.*NDHS> + NCT==NCT+<16.*NDHS> + HX==HX+<2*NDHS> + NLDHHX==HX-2 ;UNITS 0-NLDHHX INCLUSIVE ARE DH11S + + TX==TX-<2*NDHUN> ;COMPENSATE FOR UNUSED LINES + NLDHTY==TX-2 ;LAST DH11 LINE INCLUSIVE + NCT==NCT-NDHUN + +;DL11 LINES + NFDLTY==TX + NFDLHX==HX + TX==TX+<2*NDLS>-<2*CTYP> + HX==HX+<2*NDLS> + NLDLHX==HX-2 + NCT==NCT+NDLS-CTYP + +;MULTIPLEXOR LINES + NFMPTY==TX + MPKHWR==HX + TX==TX+<2*NMPTYS> + HX==HX+2 + NCT==NCT+NMPTYS + +NLTTY==NFTTY+<2*NCT> ;2 * # OF FIRST TTY NOT THIS 11 +LASTTY==NLTTY-2 ;LAST VALID TTY INDEX + +.IFNZ NDMS ;DM11-BB MODEM SCANNER + + ;1.1-1.4 MODEM CHANNEL # + DMBSY==20 ;1.5 SCAN BUSY (R.O.) + DMSCN==40 ;1.6 SCANNER ON + DMIEN==100 ;1.7 INTERRUPT ENABLE + DMDON==200 ;1.8 DONE - SCANNER HAS FOUND SOMETHING + DMSTP==400 ;1.9 STEP SCANNER TO NEXT LINE (W.O.) 1.2 USEC. + ;2.1 MAINTENANCE MODE + DMCLR==2000 ;2.2 CLEAR RTS, DTR, SEC TX, LINE EN FOR ALL LINES (W.O.) + DMCSN==4000 ;2.3 CLEAR SCAN - CLEAR CSR AND MODEM STATUS MEMORY (W.O.) 19 USEC + DM2RX==10000 ;2.4 SECONDARY RECIEVE CHANGED ON SELECTED MODEM (R.O.) + DMCTS==20000 ;2.5 CLEAR TO SEND CHANGED ON SELECTED MODEM (R.O.) + DMCAR==40000 ;2.6 CARRIER DETECT CHANGED ON SELECTED MODEM (R.O.) + DMRNG==100000 ;2.7 RING CHANGED ON SELECTED MODEM (R.O.) + + LINENB==1 ;1.1 ENABLE SCANNING OF LINE + LINDTR==2 ;1.2 DATA TERMINAL READY + LINRQS==4 ;1.3 REQUEST TO SEND (FORCE BUSY ON 103E) + LIN2TX==10 ;1.4 SECONDARY TRANSMIT + LIN2RX==20 ;1.5 SECONDARY RECEIVE (R.O.) + LINCTS==40 ;1.6 CLEAR TO SEND (R.O.) + LINCAR==100 ;1.7 CARRIER DETECT (R.O.) + LINRNG==200 ;1.8 RING (R.O.) +.ENDC ;NDMS + +; KW11-L LINE FREQ CLOCK + +LKS=177546 ;1.8 CLOCK FLAG + ;1.7 INTER ENB +HNGDLY==3*60. ;CLEAR TO SEND OFF FOR 3 SECONDS => HANGUP + +.IFNZ GOULDP +;DEFINITIONS FOR GOULD LPT + +GLPCSR=166000 ;COMMAND STATUS REGISTER (NONSTANDARD) + ;COMMAND CODES + %GCFF==0 ;TOP-OF-FORM COMMAND + %GCGRF==1 ;GRAPHIC MODE COMMAND + %GCCUT==2 ;CUT COMMAND (NO CUTTER ON THIS MACHINE, THOUGH) + %GCON==3 ;TURN PRINTER ON + %GCOFF==4 ;TURN PRINTER OFF + %GCLSL==5 ;LAST LINE (GRAPHIC MODE). => 2 MORE SCAN LINES. + %GCION==6 ;INTERRUPT ON + %GCIOF==7 ;INTERRUPT OFF + %GCADV==201 ;ADVANCE ONE LINE + ;STATUS BITS + %GSNRD==400 ;NOT READY + %GSDON==2000 ;TRANSFER COMPLETE + %GSBSY==4000 ;BUSY + %GSVAC==10000 ;VACUUM FAULT + %GSPAP==20000 ;PAPER LOW + %GSTIM==40000 ;TIMEOUT + %GSERR==50400 ;ALL ERROR BITS + +GLPWC=166002 ;NEGATIVE WORD COUNT REG + +GLPCA=166004 ;CURRENT ADDRESS REG + +GLPBSZ==132. ;BUFFER SIZE (# CHARS PER LINE) + +NGLPBF==7 ;NUMBER OF BUFFERS + GB.STA==0 ;BUFFER STATE - DON'T CHANGE ORDER OF %GB CODES + %GBIDL==0 ;0 IDLE + %GBMP==2 ;2 ACTIVE AT M.P. LEVEL + %GBWRT==4 ;4 IN WRITE QUEUE + %GBPI==6 ;6 ACTIVE AT P.I. LEVEL + %GBDMA==8 ;8 ACTIVE AT D.M.A. LEVEL + GB.NXT==2 ;CIRC POINTER TO NEXT BUFFER + GB.FF==4 ;IF NON-ZERO, FF BEFORE THIS BUFFER + GB.NL==6 ;NUMBER OF BLANK LINES BEFORE THIS BUFFER + GB.PNT==10 ;-> NEXT BYTE TO INSERT + GB.DAT==12 ;DATA BEGINS HERE + GB.LEN==GB.DAT+GLPBSZ ;TOTAL NUMBER OF BYTES PER BUFFER + +.ENDC ;GOULDP + +.IFNZ CHAOSP +;DEFINITIONS OF CHAOS NET HARDWARE + +;USUAL ADDRESS IS 764140 . USUAL INTERRUPT VECTOR IS 270 . + +CAICSR=164140 ;COMMAND STATUS REG +CH%CSR==0 + %CABSY==1 ;0 XMT BUSY (RO) + %CALUP==2 ;1 LOOP BACK (R/W) + %CASPY==4 ;2 RECIEVE MSGS FOR ANY DESTINATION (R/W) + %CARCL==10 ;3 CLEAR THE RECEIVER, IT CAN NOW GOBBLE ANOTHER MSG (WO) + %CAREN==20 ;4 RCV INT ENB (R/W) + %CATEN==40 ;5 XMT INT ENB (R/W) + %CATAB==100 ;6 TRANSMIT ABORTED BY ETHER CONFLICT (RO) + %CATDN==200 ;7 TRANSMIT DONE. SET WHEN TRANSMITTER IS DONE + %CATCL==400 ;8 CLEAR THE TRANSMITTER, MAKING IT READY (WO) + ;9-12 LOST COUNT (RO) [# MSGS RCVED WITH RCV BFR FULL] + ; WHEN MSG IS WAITING IN BUFFER, THIS COUNTS + ; THE MESSAGES THAT MATCHED OUR DESTINATION OR + ; WERE BROADCAST, BUT COULDN'T BE RECIEVED. + ; WHEN RECEIVER IS RE-ENABLED (WRITE 1 INTO %CARDN) + ; THE COUNT IS THEN CLEARED. + ; WHEN A MESSAGE IS LOST, RECEIVER ZAPS ETHER + ; SO TRANSMITTER WILL ABORT (IF MESSAGE WAS DESTINED + ; TO US.) + %CARST==20000 ;13 I/O RESET (WO) + %CAERR==40000 ;14 CRC ERROR (RO) + %CARDN==100000 ;15 RCV DONE. + +CAIMYN=164142 ;MY # (READ ONLY) +CH%MYN==2 ;RETURNS THE [SOURCE] HOST# OF THIS INTERFACE. + +CAIWBF=164142 ;WRITE BUFFER (WRITE ONLY) +CH%WBF==2 ;FIRST WAIT FOR TDONE. (OR SET IT VIA CSR) + ;FIRST WORD IN RESETS TRANSMITTER AND CLEARS TDONE. + ;STORE INTO THIS REGISTER TO WRITE WORDS OF MESSAGE, + ;LAST WORD IN IS DESTINATION ADDRESS, THEN READ CAIXMT. + ;SOURCE ADDRESS AND CHECK WORD PUT IN BY HARDWARE. + +CAIRBF=164144 ;READ BUFFER (READ ONLY) +CH%RBF==4 ;THE FIRST WORD READ WILL BE FILLED TO THE LEFT + ;TO MAKE THE MESSAGE RECIEVED A MULTIPLE OF 16 BITS. + ;IF THE NUMBER OF DATA BITS IN THE MESSAGE WAS A + ;MULTIPLE OF 16, THIS WORD WILL BE THE FIRST WORD PUT + ;INTO THE BUFFER BY THE TRANSMITTING HOST. + ;THE LAST 3 WORDS READ ARE DESTINATION, SOURCE, CHECK. + +CAIRBC=164146 ;RECEIVE BIT COUNTER (READ ONLY) +CH%RBC==6 ;WHEN A MESSAGE HAS BEEN RECEIVED THIS IS ONE LESS THAN + ;THE NUMBER OF BITS IN THE MESSAGE (16 X THE + ;NUMBER OF WORDS INCLUDING THE THREE OVERHEAD WORDS.) + ;AFTER THE LAST WORD (THE CRC WORD) HAS BEEN READ, IT IS 7777 + ;BITS 10 AND 11 ARE THE HIGH ORDER BITS, AND IF THEY ARE ONE, + ;THEN THERE WAS A BUFFER OVERFLOW + +CAIXMT=164152 ;READING THIS INITIATES TRANSMISSION (!!) +CH%XMT==12 ;THE VALUE READ IS ONE'S OWN HOST#. + +;REFERENCING ADDRESSES IN THE GROUP OF 8 WORDS NOT LISTED HERE, OR +;USING COMBINATIONS OF READ/WRITE NOT LISTED HERE, WILL TYPICALLY CAUSE +;STRANGE AND BIZARRE EFFECTS. + +;PACKET DEFINITIONS +;THESE ARE FOR 4K PACKET BUFFERS AND FOR THE ORIGINAL CHAOSNET PROTOCOL + +PKMAX==256. ;MAXIMUM LENGTH OF PACKET (INCLUDING ALL HARDWARE WORDS) +DATMAX==488. ;MAXIMUM NUMBER OF DATA BYTES +PKHDW==8 ;NUMBER OF HEADER WORDS +PKTMXW==+PKHDW ;MAX WORDS THROUGH PACKET SWITCH (SEE MOVDH ETC.) + +PKOP==1 ;BYTE INDEX OF THE OPCODE OF THE PACKET + %CORFC==1 + %COOPN==2 + %COCLS==3 + %COANS==5 + %COSNS==6 + %COSTS==7 + %CORUT==10 + %COLOS==11 + %COEOF==14 + %COUNC==15 +PKNBYT==2 ;WORD INDEX OF NUMBER OF BYTES IN PACKET +PKNBMS==170000 ;MASK FOR THE NUMBER OF BYTES +PKFC==2 ;WORD INDEX FOR THE FORWARD COUNT +PKFCMS==7777 ;IT IS THE TOP 4 BITS +PKDHST==4 ;DESTINATION HOST +PKDIND==6 ; " " " INDEX +PKSHST==10 ;SOURCE HOST +PKSIND==12 ;SOURCE INDEX +PKPKN==14 ;THE PACKET NUMBER +PKACN==16 ;THE ACK PACKET NUMBER +PKDAT==20 ;THE START OF THE DATA +.ENDC ;CHAOSP + +;STANDARD MACROS + +.MACRO PUSH X +.IRP Y, + MOV Y,-(SP) +.ENDM +.ENDM + +.MACRO POP X +.IRP Y, + MOV (SP)+,Y +.ENDM +.ENDM + +.MACRO CALL X + JSR PC,X +.ENDM + +.MACRO RET + RTS PC +.ENDM + +.MACRO SETOM LOC + ZZ===%COMPAT ;DON'T CARE WHETHER .+2 OR .+4 GETS STORED + %COMPAT===0 + MOV PC,LOC + %COMPAT===ZZ +.ENDM + +.MACRO MASK LEVEL + PUSH PS + MOV #_5,PS +.ENDM + +.MACRO UNMASK + POP PS +.ENDM + +.MACRO W +.=.+2 +.ENDM + +.MACRO T TAG ;usage is T TAG: STMNT +.=.-NFTTY +TAG +.=.+NFTTY +.ENDM + +.MACRO CONC A,B,C,D,E,F,G +A'B'C'D'E'F'G +.ENDM + +.MACRO INFORM A,B,C,D,E,F,G +.IF P1 +.PRINT /A'B'C'D'E'F'G +/ +.ENDC +.ENDM + +.MACRO MSG X +.NCHR ZZ,^\X\ + .WORD ZZ + .ASCII \X\ + .EVEN +.ENDM + +.MACRO .IREPT N,BOD +.REPT N +BOD +.ENDR +.ENDM + .IFNZ DL10P + .SBTTL DL10 CONTROL AREA + +ZZ==. +.=100000 + +DLXCSR: W ;DL10 11-SIDE CONTROL & STATUS REG + ;1.1-1.2 PIA + DLXIEN==4 ;1.3 ENABLE DLX11I TO INTERRUPT + DLXEEN==10 ;1.4 ENABLE ERRORS TO INTERRUPT + ;1.5 UNUSED + DLXPRT==40 ;1.6 PORT ENABLE (R.O.) + DLXZWC==100 ;1.7 CLEAR DLXWCO (W.O.) + DLXWCO==200 ;1.8 WORD COUNT OVERFLOW + DLXZPA==400 ;1.9 CLEAR DLXPAR (W.O.) + DLXPAR==1000 ;2.1 PAR ERR IN 10 MEM + DLXZNX==2000 ;2.2 CLEAR DLXNXM (W.O.) + DLXNXM==4000 ;2.3 NXM IN 10 MEM + DLXZ10==10000 ;2.4 CLEAR DLX10I (W.O.) + DLX10I==20000 ;2.5 INTERRUPT PDP10 + DLXZ11==40000 ;2.6 CLEAR DLX11I (W.O.) + DLX11I==100000 ;2.7 INTERRUPT PDP11 + +VERS: W ;.BYTE FIRST LINE, # OF LINES + ;SET BY -10. USED TO CHECK CONSISTENCY. + +DLXUP: W ;CHECK FOR UP-NESS IN BOTH DIRECTIONS + ;INCREMENTED BY 11 EVERY 1/60 SECOND, SETOM'ED BY 10 EVERY 1/2 SEC. + +TTYST: W ;LINE# TO START OUTPUT ON (I.E. SET OUTPUT DONE) + ;SET BY 10, CLEARED BY 11 + +TYILIN: W ;TYPEIN STATUS WORD - LINE NUMBER + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYICHR: W ;TYPEIN CHARACTER - GOES WITH PRECEDING WORD + +TYOSTS: W ;STATUS WORD (OUTPUT DONE LINE #) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYOBSZ: W ;BUFFER SIZE FOR LINE WITH OUTPUT DINE (SET BY 11) + +TYOPNT: W ;BUFFER POINTER FOR TTY OUTPUT + ;SET BY 10 +TYOCNT: W ;BUFFER LENGTH FOR TTY OUTPUT + ;SET BY 10 +TYOLIN: W ;LINE NUMBER FOR TTY OUTPUT + ;SET BY 10, CLEARED BY 11 + +HNGLIN: W ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 + +LPRLIN: W ;LINE NUMBER FOR SETTING LINE PARAMETERS + ;SET BY 10, CLEARED BY 11 +LPRLPR: W ;DH11 LPR REGISTER FOR SETTING LINE PARAMETERS + ;SET BY 10 +LPRBSZ: W ;BUFFER SIZE FOR SETTING LINE PARAMETERS + ;SET BY 10 + +EXDSTS: W ;STATUS WORD (EXAMINE/DEPOSIT 11 CORE) + ;1 = EXAMINE, 2 = DEPOSIT + ;SET BY 10, CLEARED BY 11 +EXDADR: W ;ADDRESS FOR ABOVE + ;SET BY 10 +EXDDAT: W ;DATA WORD FOR ABOVE + ;SET BY 10 (DEPOSIT) OR 11 (EXAMINE) + +GLPPTR: W ;BUFFER POINTER FOR GOULD OUTPUT +GLPCTR: W ;NUMBER OF BYTES YET TO BE GOBBLED +GLPTER: W ;ERROR STATUS, SET BY 11 +GLPGRF: W ;GRAPHIC MODE IF NON-ZERO, SET BY 10 + +;CHAOS NET SHARED VARIABLES +DLCINI: W ;WHEN THIS IS NON-ZERO, 11 RESETS ITS POINTERS AND CLEARS IT +DLCSP1: W ;SEND PACKET 1 (ILDB POINTER) +DLCSP2: W ;SEND PACKET 2 +DLCSS1: W ;SEND STATE 1 (0 IDLE, 1 TO 11, 2 OUTPUT DONE) +DLCSS2: W ;SEND STATE 2 +DLCRP1: W ;RECEIVE PACKET 1 (ILDB POINTER) +DLCRP2: W ;RECEIVE PACKET 2 +DLCRS1: W ;RECEIVE STATE 1 (0 IDLE, 1 READY FOR INPUT FROM 11, 2 INPUT DONE) +DLCRS2: W ;RECEIVE STATE 2 + +;^ ADD MORE HERE, E.G. IMP + +.IFNZ T300P +;DISK AREA. 14. WORDS 48. WORDS INTO THE DL-10 AREA. +.=100000+<60*2> + +DSCCHK: W ;MUST BE 2561 OCTAL TO MAKE SURE WE HAVE CORRECT PDP-10 PROGRAM +DSCREQ: W ;0 MEANS NO REQUEST. NON-ZERO MEANS 10 HAS PENDING REQUEST TO 11. +DSCDON: W ;0 MEANS NOT DONE, NON-ZERO MEANS 11 IS TELLING 10 IT'S DONE. +;NEXT 2 WORDS WRITTEN BY 11 TO TELL STATUS OF OPERATION +DSCFLT: W ;0 NO FAULT + %DFRST==100000 ; BIT 15=POWER CYCLED OR UNIBUS HUNG, SO CONTROLLER WAS RESET + ; BIT 12=Q ERROR, BIT 11=CMD NXM, BIT 10=CMD PAR + ; IF ONE OF THESE BITS IS ON, BITS 1-0 AND DSCSTS ARE THE ERROR ADDRESS + ; BITS 7-0 SYSTEM FAULT CODE IF LEFT BYTE IS ZERO + ; SEE THE 2561 OEM MANUAL FOR MEANING OF FAULT CODES +DSCSTS: W ;STATUS FROM 2561: + %DSRTR==100000 ;COMMAND WAS RETRIED + %DSECH==40000 ;UNCORRECTABLE DATA ERROR (ECC HARD) + %DSECC==20000 ;CORRECTED DATA ERROR + %DSIDE==10000 ;ID ERROR + %DSHCE==4000 ;ADDRESS ERROR (HEADER COMPARE ERROR) + %DSPRT==2000 ;WRITE-PROTECT STATUS OF SECTOR (ABORTS WRITE COMMAND) + %DSALT==1000 ;ALTERNATE-SECTOR STATUS (ABORTS READ, WRITE, AND CHECK) + %DSOVR==400 ;FIFO OVER-RUN, NOT CORRECTED BY 1 RETRY + %DSSKE==200 ;SEEK ERROR FROM DRIVE + %DSOFL==100 ;DRIVE OFF-LINE OR FAULT + %DSFLT==20 ;DRIVE FAULT + %DSNXM==10 ;NXM ON PDP11 MEMORY + %DSPAR==4 ;PARITY ERROR IN PDP11 MEMORY + %DSSFL==2 ;SYSTEM FAULT, SEE LOW BYTE OF DSCFLT + %DSWLK==1 ;DRIVE WRITE-LOCKED, WRITE ABORTED + +;FOLLOWING WORDS ARE WRITTEN BY 10 TO TELL WHAT TO DO +DSCCMD: W ;COMMAND OPCODE: + ;%DMNOP==0 ;DO NOTHING + ;%DMCST==1 ;READ OUT CONTROLLER STATE (NOT USEFUL SINCE NOT RETURNED TO 10) + %DMSNS==2 ;SENSE DRIVE STATE. DSCSTS GETS CODE FOR DRIVE TYPE IN + ; BITS 14-8 (10 FOR T-300), AND %DSWLK, %DSFLT, %DSOFL, %DSSKE + %DMTST==3 ;TEST SPECIFIED DRIVE (RUNS DIAGNOSTICS) + %DMREC==4 ;RECALIBRATE + %DMSEK==5 ;SEEK + %DMWRT==6 ;WRITE DATA + ;%DMFMT==7 ;WRITE FORMAT + ;%DMPWT==10 ;WRITE AND SET WRITE-PROTECT BIT + ;%DMAWT==11 ;WRITE AND SET ALTERNATE-SECTOR BIT + ;%DMCHK==12 ;READ AND CHECK ECC BUT DON'T STORE DATA + ;%DMLWT==14 ;LONG WRITE, WILL WRITE ECC AS WELL AS DATA + %DMRED==20 ;READ DATA. ADD 1-10 FOR VARIOUS RECOVERY FEATURES AS + ; DOCUMENTED IN THE 2561 OEM MANUAL. + ;%DMRID==40 ;READ IF FIELD, NOT USEFUL SINCE NOT RETURNED TO 10 +DSCDRV: W ;UNIT NUMBER +DSCCYL: W ;CYLINDER ADDRESS (THESE ARE COPIED BACK BY THE 11 IN CASE OF ERROR) +DSCHED: W ;HEAD ADDRESS +DSCSEC: W ;SECTOR ADDRESS +;WORD COUNT IS ALWAYS 12.*256. +;IF WE PUT IN SEEK-OVERLAP AN ATTENTION FEATURE WILL BE NEEDED +;THAT WOULD ALSO BE USED FOR DISK POWER-UP SIGNALLING +;THESE WORDS ARE SET UP BY THE 10 AS BYTE-POINTERS TO THE DATA +;TO BE TRANSFERRED. EACH BYTE POINTER CAN TRANSFER AT MOST 256 PDP10 WORDS +;DUE TO BRAIN-DAMAGE IN THE DL10, SO THERE ARE 4 OF THEM +DSCPNT: .BLKW 4 +.ENDC ;T300P + +DLXHGH:: +.=ZZ +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL DTE20 CONTROL AREA + +;LOCATIONS 400-437 ARE JUST BETWEEN US AND ITS +;LOCATIONS 440-457 ARE KNOWN ABOUT BY KLDCP ALSO + +;EPTDDT==441 ;START ADDRESS OF PDP10 NON TIME SHARING DDT +DTEFLG==444 ;NON TIME SHARING TYPEIN/TYPEOUT DONE FLAG (SET BY 11, CLEARED BY 10) +DTEF11==450 ;USED BY NON TIMESHARING TYPEIN COMMAND TO RETURN THE CHAR (SET BY 11) +DTECMD==451 ;NON TIME SHARING COMMAND (SET BY 10) +;COMMANDS THAT CAN GO IN DTECMD: + ;0-377 CHAR TO BE TYPED OUT + %DTTYI==3400 ;TYPE IN, CHAR RETURNED IN DTEF11 + %DTCLN==1001 ;60 CYCLE CLOCK ON + %DTCLF==1000 ;60 CYCLE CLOCK OFF + ;THERE ARE MILLIONS OF OTHERS, BUT WHO NEEDS 'EM? +DTECLK==445 ;60 CYCLE CLOCK FLAG (SET BY 11, CLEARED BY 10) +;DTESWR==457 ;SIMULATED SWITCH REGISTER (SET BY 11) + +;THE FOLLOWING LOCATIONS ARE ONLY USED IN TIME SHARING AND NOT KNOWN ABOUT BY KLDCP + +DTEVER==400 ;I/O VERSION NUMBER. .BYTE FIRST LINE, NUMBER OF LINES. + ;SET BY 10, CHECKED BY 11 + +DTECHK==401 ;INCREMENTED BY 11 60 TIMES PER SECOND, SETOMED BY 10 EVERY 1/2 SECOND + ;USED TO CHECK THAT 10 IS GETTING INTERRUPTS OK + +DTEINP==402 ;CONTROLS "BYTE TRANSFERS" FROM 11 TO 10 (INPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN XFER COMPLETE. + ;10 SHOULD SET UP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING DTEINP. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES IN DTEINP. +DTEOUT==403 ;CONTROLS "BYTE TRANSFERS" FROM 10 TO 11 (OUTPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN TRANSFER STARTS. + ;EACH SIDE KNOWS WHEN TRANSFER IS IN PROGRESS, DOESN'T TRY TO START + ; ANOTHER UNTIL IT HAS RECEIVED HARDWARE TRANSFER-DONE INTERRUPT. + ;10 SHOULD SET UP DTEBPO IN EPT BEFORE SETTING DTEOUT. + ;RH IS #BYTES EXPECTED, LH IS COMMAND+LINE#. COMMANDS ARE: + %DTTYO==1000 ;TELETYPE OUTPUT + ;%DTETI==2000 ;ETHERNET INPUT + ;%DTETO==3000 ;ETHERNET OUTPUT + ;^ ADD MORE COMMANDS HERE. NOTE: THE 4.1 BIT IS 1 FOR OUTPUT, 0 FOR INPUT. + +DTELSP==404 ;LINE# TO SET SPEED OF (SET BY 10, SETOMED BY 11) +DTELPR==405 ;DH11 LINE-PARAMETER-REGISTER,,BUFFER SIZE + +DTEOST==406 ;LINE# TO START OUTPUT ON (SET OUTPUT DONE). (SET BY 10, SETOMED BY 11) + + ;407 NOT USED + +DTETYI==410 ;TELETYPE INPUT + ;LH=LINE#, RH=CHAR RECEIVED. (SET BY 11, SETOM'ED BY 10) + +DTEODN==411 ;TELETYPE OUTPUT DONE + ;LH=LINE#, RH=BUFFER SIZE. (SET BY 11, SETOM'ED BY 10) + +DTEHNG==412 ;HANGUP/DIALIN WORD (SET BY 11, SETOM'ED BY 10) + ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + +;^ ADD MORE HERE, NOT TO EXCEED LOCATION 437 + ;.IFNZ DTE20P + +;IOELEVEN RESIDES IN THE BOTTOM 14K OF THE CONSOLE PDP11, ALONG WITH 11DDT. +;I.E. LOCATIONS 0-70000. BE SURE TO USE .;11DDT 14K VERSION OF DDT. +;THE UPPER 14K CONTAIN KLDCP. THE FOLLOWING CALLS TO KLDCP ARE USED. +;THEY RETURN WITH C-BIT SET IF THEY LOSE (MICROCODE HUNG). + +;NOTE: KLDCP ENJOYS CLOBBERING REGISTER 0 (A). I DON'T +;KNOW IF ALL THESE CALLS DO, BUT WE'LL ASSUME THAT THEY DO. + +TENSW=EMT!145 ;UPDATE LOCATION DTESWR FROM THE SWITCHES + +EXAM=EMT!103 ;EXAMINE PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 BYTES CONTAINING PDP10 ADDRESS (LOW BITS FIRST) + ;AFTER CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS (LOW BITS FIRST) + +EXAMT=EMT!104 ;EXAMINE PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +DPOS=EMT!105 ;DEPOSIT PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS + ;AND REGISTER B HAS ADDRESS OF 3 BYTES CONTAINING ADDRESS + +DPOST=EMT!106 ;DEPOSIT PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +D10MON=EMT!111 ;DEPOSIT PDP10 MEMORY, -1 + ;.WORD PDP10-ADDRESS + +$PMSG=EMT!25 ;PRINT MESSAGE ON TTY + ;.WORD ADDRESS OF ASCIZ MESSAGE + +$CNTLC=100004 ;JUMP HERE TO "CONTROL C" BACK TO KLDCP + +;WHEN KLDCP IS IDLE, AND IN "ITS MODE", IT DOES JSR PC,3000 +;WHICH CALLS IOELEVEN'S MAIN PROGRAM. RETURN WITH "C" SET +;TO READ AND EXECUTE ONE KLDCP COMMAND LINE. RETURN WITH "C" +;CLEAR TO PRINT KL10 HALTED OR CLOCK ERROR STOP MESSAGE. +;LOCATIONS 3004, 3006 MUST CONTAIN .RAD50/IOELEV/ +;IOELEV WILL RUN ON KLDCP'S STACK. + ;.IFNZ DTE20P +;INFORMATION ABOUT THE DTE20. +;EXCEPT FOR BYTE TRANSFER, WE USE THE TIME-TESTED SUBROUTINES PROVIDED BY KLDCP. + +;THE INTERRUPT VECTOR IS AT 774, BUT WE CAN'T USE IT BECAUSE WOULD HAVE +;TO COORDINATE THINGS WITH KLDCP, WHICH IS OBVIOUSLY IMPOSSIBLE. + +DLYCNT=174400 ;2.6-2.7 UNIBUS ADDRESS EXTENSION FOR BYTE TRANSFER DMA + ;1.1-2.5 14-BIT 2'S COMPLEMENT OF NUMBER OF HALF-MICROSECONDS + ; TO DELAY BETWEEN PI0 INTERRUPTS IN BYTE TRANSFER + +TO10AD=174420 ;ADDRESS (WORD OR BYTE) OF TO-10 BYTE TRANSFER DATA + +TO10BC=174414 ;1.1-2.3 NEGATIVE BYTE COUNT, 2.7 LAST XFER + ;NORMALLY SET BY 10 WITH DATAO DTE, + ;TO10 XFER STARTS WHEN BOTH TO10AD AND TO10BC HAVE BEEN LOADED + +TO11AD=174422 ;ADDRESS (WORD OR BYTE) OF TO-11 BYTE TRANSFER DATA + +TO11BC=174416 ;1.1-2.3 NEGATIVE BYTE COUNT FOR TO-11 BYTE TRANSFER + ;2.5=1 => TO-11 TRANSFER IS 8-BIT BYTES, =0 => 16-BIT WORDS + ;2.6=1 => "ASCIZ" MODE (WHICH WE DON'T USE, OF COURSE) + ;2.7=1 => LAST XFER, UPON COMPLETION INTERRUPT BOTH 10 AND 11 + ; =0 => ONLY INTERRUPT 11. 11 CAN CHANGE TO11AD, TO11BC, CONTINUE. + ;TO11 XFER STARTS WHEN BOTH TO11AD AND TO11BC HAVE BEEN LOADED + ;THE TRANSFER HAPPENS USING DMA (NPR) IN 11, PI LEVEL 0 IN 10. + +STATUS=174434 ;DTE20 STATUS REGISTER + ;READS: + %STDNI==100000 ;2.7 TO10 XFER DONE WITHOUT ERROR + %STERI==20000 ;2.5 TO10 XFER ABORTED BY ERROR + ;2.4 DATA OUT OF DTE RAM IS ALL ZERO (MAINT) + %STINV==4000 ;2.3 PDP10 IS INTERRUPTING PDP11 + ;2.2 DEPOST OR EXAMINE WORD ONE (MAINT) + ;2.1 PDP11 MEMORY PARITY ERROR IN TO10 XFER + ;1.9 PDP11 IS INTERRUPTING PDP10 + %STDNO==200 ;1.8 TO11 XFER DONE WITHOUT ERROR + ;1.7 E BUFFER SELECT (MAINT) + ;1.6 TO11 XFER STOPPED DUE TO ZERO BYTE (IN ASCIZ MODE) + ;1.5 TO11 XFER OR PDP10 EXAMINE ENCOUNTERED EBUS PARITY ERROR + ;1.4 1 => RESTRICTED MODE + ;1.3 0 => EXAMINE/DEPOSIT IN PROGRESS, 1 => DONE + %STERO==2 ;1.2 TO11 XFER ABORTED BY ERROR + ;1.1 1 => DTE ENABLED TO INTERRUPT PDP11 + ;WRITES: + %STCLI==51000 ;2.6+2.4+2.1 CLEAR TO10 XFER DONE AND ERROR FLAGS + %STUNV==2000 ;2.2 CLEAR PDP10 INTERRUPTING PDP11 + %STINX==400 ;1.9 SET PDP11 INTERRUPTING PDP10 + %STCLO==121 ;1.7+1.5+1.1 CLEAR TO11 XFER DONE AND ERROR FLAGS + ;1.6 ENABLE INTERRUPTS + ;1.4 DISABLE INTERRUPTS + +DIAG1=174430 ;DIAGNOSTIC WORD 1, INCLUDES FLAGS + %D1ERR==4000 ;2.3 KL10 CLOCK ERROR STOP + %D1RUN==2000 ;2.2 KL10 RUN INDICATOR (1 IF 11 WANTS 10 TO RUN) + %D1HLT==1000 ;2.1 KL10 HALT INDICATOR (1 IF 10 DOES A JRST 4) + +DIAG3=174436 ;DIAGNOSTIC WORD 3, INCLUDES FLAGS + %D3BYT==1 ;1.1 WRITING 0 SETS TO10 XFER IN WORD MODE, 1 BYTE MODE + ;THERE'S NOTHING ELSE OF THE SLIGHTEST USE IN THIS REGISTER, + ;SO IT'S OK TO WRITE IT AT ANY TIME. +.ENDC ;DTE20P + + .SBTTL LOW CORE + +.IFZ DTE20P ;IF USING DTE20, THESE ARE SET UP BY KLDCP +.=4 + TRAP4 + 340 + TRAP10 + 340 +; TRAP14 ;SET UP BY 11DDT +; 340 +.=20 + TRAP10 ;IOT + 340 + PWRFAL + 340 + TRAP10 ;EMT + 340 + TRAP10 ;TRAP + 340 +.ENDC ;DTE20P + +;CHAOS NET INTERRUPT VECTORS ARE UNFORTUNATELY NOT IN A REASONABLE ARRAY +.IFGE CHAOSP-1 +.=270 + .WORD CHS0BK,5_5 + ;274 IS INTERVAL TIMER +.ENDC ;CHAOSP-1 +.IFGE CHAOSP-2 +.=230 + .WORD CHS1BK,5_5 + ;234 IS INTERVAL TIMER +.ENDC ;CHAOSP-2 +.IFGE CHAOSP-3 +.=240 + .WORD CHS2BK,5_5 + ;244 IS INTERVAL TIMER +.ENDC ;CHAOSP-3 +.IFGE CHAOSP-4 + .ERROR WHERE DOES THE FOURTH CHAOSNET INTERRUPT VECTOR GO? +.ENDC ;CHAOSP-4 + +.IFNZ ETHERP +.=400 + ETHOBK + 5_5 + ETHIBK + 5_5 + ETHOBK ;COLLISION + 5_5 +.ENDC ;ETHERP + +.IFNZ T300P +.=254 + DSKBRK + 240 ;BR5 +.ENDC ;T300P + +.=300 +.REPT NDMS ;DM11s go in floating vectors +CONC DM,\.RPCNT+1,BRK + 240 ;INTERRUPTS ON BR4 BUT WE MASK TO BR5 ANYWAY +.ENDR ;NDMS + +.IFNZ NDLS +.=60 + DL1IBK ;FIRST DL11 LINE IS PDP11'S CONSOLE TTY, DIFFERENT ADDRESS + 240 ;AGAIN INTERRUPTS ON BR4 BUT MASK TO BR5 SO CAN USE DH11 ROUTINES W/O FEAR + DL1OBK + 240 +.ENDC ;NDLS +.=310 +.REPT NDLS-1 ;DL11S AFTER THE FIRST ARE IN FLOATING VECTORS +CONC DL,\.RPCNT+2,IBK + 240 +CONC DL,\.RPCNT+2,OBK + 240 +.ENDR + +.=DHIBAS ;DON'T RELY ON RANDOM FLOATING VECTOR TO + ;COME OUT RIGHT, E.G. IF THERE IS A DL11 + ;THERE WHICH WE AREN'T USING. +.REPT NDHS ;DH11S ARE IN FLOATING VECTOR AFTER DL11[E]S +CONC DH,\.RPCNT+1,IBK ;DH11 #n RECEIVE + 240 +CONC DH,\.RPCNT+1,OBK ;DH11 #n TRANSMIT & ERROR + 240 +.ENDR ;NDHS +.=100 + CLKBRK ;KW11-L 60-CYCLE CLOCK + 300 ;ON BR6 + +.IFNZ GOULDP +.=174 + GLPBRK + 300 ;BR5 BUT NEED TO LOCK OUT CLOCK SO MASK 6 +.ENDC ;GOULDP + +.IFG NMPTYS +.=56 +MPXENB::0 ;NONZERO TO ENABLE MULTISCHLUNKER +.ENDC + +.IFZ DTE20P ;IF DTE20, KLDCP SUPPLIES THE STACK +.=1000 +STKBAS:: + JMP INIT ;START AT 1000 IS CONVENTIONAL +.IFF ;DTE20P +.=3000 ;ENTRY VECTOR + JMP @#INIT +SADR=.-2 ;ARG OF THE JMP@# IS CHANGED AFTER INITIALIZATION + .RAD50 /IOELEV/ +.ENDC ;DTE20P + + .SBTTL TEN-11 CHAOSNET COMMUNICATION AREA + +.IFNZ TEN11P +T11BFL==8+<2*PKTMXW> ;BYTE LENGTH OF A PACKET BUFFER + ;FIRST 8 BYTES ARE BUFFER-FULL FLAG AND CKSM +.IIF NE T11BFL-<*4>, .ERROR T11BFL NOT MULTIPLE OF 4 + +.IIF NE .-1004, .ERROR CHAOSNET TEN-11 COMMUNICATION AREA NOT AT RIGHT ADDRESS + +;THIS AREA IS SHARED WITH THE PDP10 VIA TEN-11 INTERFACE. + + .WORD "CH,1 ;ERROR CHECK AND VERSION NUMBER +T11I10: .WORD 0,0 ;SET NON-ZERO BY 11 TO REINITIALIZE 10 +T11I11: .WORD 0,0 ;SET NON-ZERO BY 10 TO REINITIALIZE 11 + .WORD T11BFL,NT11BF ;BUFFER SIZE, NUMBER OF BUFFERS + .BLKW 8 ;SPARE WORDS +T11OBF: .BLKB T11BFL*NT11BF ;TO-10 BUFFERS + T11OBE==. ;END OF TO-10 BUFFERS +T11IBF: .BLKB T11BFL*NT11BF ;FROM-10 BUFFERS + T11IBE==. ;END OF FROM-10 BUFFERS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +.ENDC ;TEN11P + + .SBTTL CONFIGURATION + +; TABLES INDEXED BY H (PER HARDWARE UNIT) + +.MACRO DHTE AD ;DH11 REGISTER ADDRESS GENERATOR +.REPT NDHS + +<20*.RPCNT> +.ENDR +.ENDM + +.MACRO DLTE AD ;DL11 REGISTER ADDRESS GENERATOR, FIRST IS WIERD +.IFNZ NDLS + 177560+<&7> +.REPT NDLS-1 + +<10*.RPCNT> +.ENDR +.ENDC ;NDLS +.ENDM + +.MACRO DMTE AD ;DM11 register address generator + .REPT NDMS + +<10*.RPCNT> ;a DM11 eats 8 locations + .ENDR +.ENDM + +DMCSR: DMTE 170500 ;first DM11 is at 170500 + +DMLSR: DMTE 170502 ;selected line status at 170502 + +DHSCR: DHTE DHCBAS ;SYSTEM CONTROL REGISTER + ;1.1-1.4 LINE NUMBER + ;1.5-1.6 MEMORY ADDRESS EXTENSION + DHRENB==100 ;1.7 RECEIVER INTERRUPT ENABLE + ;1.8 RECEIVER INTERRUPT + ;1.9 CLEAR NXM FLAG + ;2.1 MAINTENANCE MODE + DHSNXM==2000 ;2.2 NXM FLAG (GENERATES XMT INTERRUPT) + ;2.3 MASTER CLEAR + DHSENB==10000 ;2.4 STORAGE SILO FULL INTERRUPT ENABLE + DHTENB==20000 ;2.5 TRANSMITTER & NXM INTERRUPT ENABLE + ;2.6 STOARGE FULL INTERRUPT + DHTDON==100000 ;2.7 TRANSMITTER DONE INTERRUPT + +DLKS==DHSCR + DLTE 175610 ;KEYBOARD STATUS REGISTER + ;1.1 PAPER TAPE READER ENABLE (WO) + ;1.2 DATA TERMINAL READY (RW) + ;1.3 REQUEST TO SEND (RW) + ;1.4 SECONDARY TRANSMIT DATA [OR MAKE BUSY] (RW) + ;1.5 UNUSED + ;1.6 DATASET INTERRUPT ENABLE (RW) + ;1.7 RECEIVE INTERRUPT ENABLE (RW) + ;1.8 RECEIVE DATA READY (RO) + ;1.9 UNUSED + ;2.1 UNUSED + ;2.2 SECONDARY RECEIVE DATA (RO) + ;2.3 RECEIVE ACTIVE (RO) + ;2.4 CARRIER DETECT (RO) + ;2.5 CLEAR TO SEND (RO) + ;2.6 RING INDICATOR (RO) + ;2.7 DATASET STATUS CHANGE (RO) + +DHNRC: DHTE DHCBAS+2 ;NEXT RECEIVED CHARACTER + ;1.1-1.8 THE CHARACTER + ;1.9-2.3 LINE NUMBER + %DXPAR==10000 ;2.4 CHAR HAS WRONG PARITY + %DXBRK==20000 ;2.5 FRAMING ERROR (BREAK) + %DXOVR==40000 ;2.6 OVERRUN, PREVIOUS CHARS LOST + ;2.7 1 => THIS WORD VALID +DLKB==DHNRC + DLTE 175612 ;KEYBOARD INPUT REGISTER + ;1.1-1.8 RECEIVED DATA + ;2.4 PARITY ERROR (RO) + ;2.5 FRAMING ERROR (RO) + ;2.6 OVERRUN (RO) + ;2.7 OR OF ERROR BITS (RO) + +DHLPR: DHTE DHCBAS+4 ;LINE PARAMETER REGISTER + ;1.1-1.2 CHARACTER LENGTH 0=5, 1=6, 2=7, 3=8 (PARITY BIT EXTRA) + ;1.3 1 => EXTRA STOP BIT + ;1.5 ENABLE PARITY + ;1.6 0 -> EVEN PARITY, 1 => ODD + ;1.7-2.1 RECEIVER SPEED + ; 0 OFF, 1 50, 2 75, 3 110, 4 134.5, 5 150, 6 200, 7 300 + ; 10 600, 11 1200, 12 1800, 13 2400, 14 4800, 15 9600, 16 A, 17 B + ;2.2-2.5 TRANSMITTER SPEED, SAME CODES AS RECEIVER + ;2.6 HALF DUPLEX + ;2.7 ECHOPLEX + +DHCA: DHTE DHCBAS+6 ;CURRENT ADDRESS +DLCA==DHCA + .IREPT NDLS,0 + +DHBC: DHTE DHCBAS+10 ;BYTE COUNT (MINUS) +DLBC==DHBC + .IREPT NDLS,0 ;POSITIVE FOR DLS + +DHBAR: DHTE DHCBAS+12 ;BUFFER ACTIVE REGISTER + ;BIT = 1 IF XMT ACTIVE ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPS==DHBAR + DLTE 175614 ;PRINTER STATUS + ;1.1 SEND BREAK (RW) + ;1.3 LOOP BACK (RW) + ;1.6 INTERRUPT ENABLE (RW) + ;1.7 TRANSMITTER READY (RO) + +DHBCR: DHTE DHCBAS+14 ;BREAK CONTROL REGISTER + ;BIT = 1 => SEND BREAK ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPB==DHBCR + DLTE 175616 ;PRINTER BUFFER + ;1.1-1.8 DATA TO TRANSMIT + +DHSSR: DHTE DHCBAS+16 ;SILO STATUS REGISTER + ;1.1-1.6 SILO ALARM LEVEL + ;1.7-1.8 READ EXTENDED ADDRESS (R.O.) + ;1.9-2.5 SILO FILL LEVEL (R.O.) + ;2.7 MAINTENANCE PATTERN (W.O.) + +DHOAC: .IREPT NDHS,0 ;BIT ON IF SOFTWARE THINKS LINE'S TRANSMITTER IS ACTIVE +DLOAC==DHOAC + .IREPT NDLS,0 ;NON-ZERO IF LINE'S TRANSMITTER IS ACTIVE + +DHTYNO: .IREPT NDHS, NFDHTY+<32.*.RPCNT> ;TTY INDEX OF FIRST LINE ON THIS DH11 +DLTYNO==DHTYNO +.IIF NZ CTYP,0 ;TTY INDEX OF LINE ON THIS DL11 +.IREPT NDLS-CTYP,NFDLTY+<2*.RPCNT> + +STROUT: .IREPT NDHS, STRDH ;OUTPUT-START ROUTINES + .IREPT NDLS, STRDL +.IIF NZ NMPTYS, STRMPK + + .BLKB NFTTY ;AVOID LABEL OVERLAPPAGE + +;TABLES INDEXED BY I (PER LINE) + +T HDWR: ;HARDWARE UNIT INDEX, GOES IN H +.IIF NZ CTYP, NFDLHX + .REPT NDHS + ZZ==.RPCNT*2 + .REPT 16. + ZZ ;16 LINES ON EACH DH-11 + .ENDR + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,NFDLHX+<2*.RPCNT>+<2*CTYP> +.IREPT NMPTYS, MPKHWR ;MULTIPLEXOR-KLUDGE TTYS + +T DHLSEL: ;DH11 LINE SELECT WORDS +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + DHTENB+DHRENB+.RPCNT + .ENDR + .ENDR + +T DHLBIT: ;BIT CORRESPONDING TO THIS LINE IN DHBAR, ETC. +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + 1_.RPCNT + .ENDR + .ENDR + +T BUFPNT: ;BUFFER POINTERS + .IREPT NCT, BUFFRS+<.RPCNT*MAXBSZ> + +T BUFSIZ: ;BUFFER SIZES (I.E. AMOUNT TO USE AT CURRENT SPEED) + .REPT NCT + 0 ;SET DURING INITIALIZATION + .ENDR + +T NRMIPC: ;NORMAL INPUT CHARACTER PROCESSING ROUTINES +.IIF NZ CTYP, RCV ;CTY NORMAL INPUT + .REPT 16.*NDHS + DHNRMI ;DH11 TTY NORMAL INPUT + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,RCV ;DL11 NORMAL INPUT +.IREPT NMPTYS, RCV ;NORMAL INPUT FOR TTYS ON MULTIPLEXOR-KLUDGE +.IIF NE .-NRMIPC-NLTTY, .ERROR BARF AT NRMIPC +.IFNZ NMPTYS + .=NRMIPC+MPXIDX + MPXINP ;INPUT FROM THE MULTIPLEXED LINE IS SPECIAL + .=NRMIPC+NLTTY +.ENDC + +T TTYIPC: ;CURRENT INPUT CHAR PROCESSING ROUTINES + .BLKW NCT ;SET UP AT INIT TIME +.IIF NE .-TTYIPC-NLTTY, .ERROR BARF AT TTYIPC + +T AUTOSP: ;IF NON-ZERO, LINE GOES INTO AUTOSPEED WHEN DIALED UP + .REPT NCT ;IF MINUS ALSO WHEN BREAK SEEN + ZZ===. + ASPIRP ^\ + .IIF EQ .RPCNT+-N,+1 ;THIS LINE AUTOSPEED ON DIALUP + .IIF EQ .RPCNT++N,-1 ;ALSO ON BREAK + \ + .IIF EQ .-ZZ, 0 ;THIS LINE NOT AUTOSPEED + .ENDR +.IIF NE .-AUTOSP-NLTTY, .ERROR BARF AT AUTOSP + +.IFM MC +M2LMAP: ;MAP FROM DM11-BB CHANNEL NUMBERS TO TTY INDICES + 2*1 ;0 T01 + 0 ;1 NONE + 0 ;2 NONE + 2*4 ;3 T04 + 2*5 ;4 T05 + 2*6 ;5 T06 + 2*7 ;6 T07 + 2*10 ;7 T10 + 2*11 ;10 T11 + 2*12 ;11 T12 + 2*13 ;12 T13 + 2*14 ;13 T14 + 2*15 ;14 T15 + 2*16 ;15 T16 + 2*17 ;16 T17 + 0 ;17 NONE + 2*21 ;20 T21 + 2*22 ;21 T22 + 2*23 ;22 T23 + 2*24 ;23 T24 + 2*25 ;24 T25 + 2*26 ;25 T26 + 2*27 ;26 T27 + 2*30 ;27 T30 + 2*31 ;30 T31 + 2*32 ;31 T32 + 2*33 ;32 T33 + 2*34 ;33 T34 + 2*35 ;34 T35 + 2*36 ;35 T36 + 2*37 ;36 T37 + 2*40 ;37 T40 +.ENDC ;MC + +.IIF NE NDMS, .IIF NE .-M2LMAP-<40*NDMS>, .ERROR Too few M2LMAP entries for DM11s. + +.IFNZ NDMS + +T DIALED: ;0 IF LINE NOT DIALED UP (OR NO MODEM CONTROL ON THIS LINE) + .REPT NCT ;+ IF DIALED UP (CLEAR TO SEND IS ON) + 0 ;- IF CLEAR TO SEND DROPPED, INC EACH TICK, REACHES 0 => HUNG UP + .ENDR + +.ENDC ;NDMS + +T TTYHNG: ;DIALUP/HANGUP STATUS WAITING TO BE SENT TO 10 (0 IF NONE) + .REPT NCT + 0 + .ENDR + +T TYPING: ;POSITIVE IF LINE IS TYPING OUT FOR 10 + .REPT NCT ; WHICH MEANS -10 SHOULD BE INFORMED WHEN TYPEOUT IS FINISHED + 0 ;0 FOR NO -10 TYPEOUT, MINUS TO SEND AFTER TYPEOUT + .ENDR + +;MISC VARIABLES + +DLXOFF: -1 ;NON-ZERO IF DL10 PORT TURNED OFF BY 10 +NO.ITS: -1 ;NON-ZERO IF HAVEN'T ESTABLISHED COMMUNICATION WITH ITS YET +VERSN: .BYTE NFTTY/2,NCT ;I/O VERSION NUMBER +DMINI: 0 ;NON-ZERO => MODEM SCANNER JUST TURNED ON, GETTING INITIAL STS +WAKE: 0 ;CLOCK INTERRUPT WAKE UP MAIN PROGRAM FLAG +HNGSIG: 0 ;NUMBER OF NON-ZERO TTYHNG WORDS +10RQ: 0 ;LIGHT HACKS +LITHSE: 7 +.IFNZ DTE20P +CLKENB: 0 ;KL10 WANTS 11 TO RELAY CLOCK INTERRUPTS +KLDCPF: 0 ;NON-ZERO => USER WANTS TO GIVE A COMMAND TO KLDCP +DDTMOD: 0 ;NON-ZERO => DDT MODE TTY INPUT +DDTCHR: -1 ;NON-NEGATIVE => CHAR TYPED FOR DDT +CURSWR: 52525 ;LAST SWITCHES SENT TO -10 +OUTCMD: 0 ;0 IF OUTPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +OUTSVI: -1 ;LINE# OF CURRENT OUTPUT TRANSFER +OUTSVC: -1 ;#BYTES OF CURRENT OUTPUT TRANSFER +INPCMD: 0 ;0 IF INPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +INPSVI: -1 ;LINE# OF CURRENT INPUT TRANSFER +INPSVC: -1 ;#BYTES OF CURRENT INPUT TRANSFER +.ENDC ;DTE20P +.IFNZ NMPTYS +MPXOAC: 0 ;0 IDLE, -1 SENDING HEADER, 1 SENDING DATA +MPXOLN: 0 ;2 x MPXK# OUTPUTTING FOR +MPXSEL: NFMPTY ;TTY INDEX SELECTED FOR MPX INPUT +MPXPNT: .IREPT NMPTYS,0 ;POINTER TO CRUFT TO SEND TO EACH MPXED LINE +MPXNBT: .IREPT NMPTYS,0 ;# BYTES TO SEND, 0 IF IDLE +MPXHED: .BYTE 0,0 ;MPX OUTPUT HEADER: 200+MPXK#, BYTE COUNT +.ENDC ;NMPTYS + + .SBTTL CHAOSNET VARIABLES & TABLES + +.IFNZ CHAOSP + +NSUBNT==80. ;MAXIMUM CAPACITY 80. SUBNETS + +.IFNZ DL10P ;DL10 UNSHARED +DLCRBN: 0 ;CURRENT RECEIVE (11 to 10) BUFFER (0 OR 2) +DLCNXT: .WORD 2,0 ;FOR SWITCHING BUFFERS +DLCIBF: .BLKW PKMAX ;DL10 INPUT BUFFER +.ENDC ;DL10P + +.IFNZ TEN11P ;TEN11 UNSHARED +T11OBP: T11OBF ;NEXT BUFFER TO 10 +T11IBP: T11IBF ;NEXT BUFFER FROM 10 +T11IBA: 0 ;NON-ZERO MEANS INPUT BUFFER ACTIVE, T11IBP NEEDS ADVANCING + ;THIS IS SEPARATE FROM CHISTS+CHXT11 FOR GOOD REASONS +T11CKE: 0 ;COUNT OF TEN-11 CHECKSUM ERRORS +T11TIM: 0 ;TIMEOUT ON TRANSMISSION OF PACKET TO 10 +.ENDC ;TEN11P + +.IFNZ ETHERP +ETHSBN==2 ;SUBNET WHICH IS THE ETHERNET +.SEE ETHHSN ;MY HOST NUMBER BYTE (DEFINED IN MACHINE CONFIGURATION AREA) +ETHMXH==15.-1 ;MAXIMUM NUMBER OF HOPS (-1 => BUG IN XEROX PROGRAMS) +ETHIBF: .BLKW PKTMXW+1 ;INPUT FROM ETHERNET BUFFERED HERE (+1 HARDWARE BUG?) +ETHHDW==PKHDW-2 ;ALLOW FOR OVERLAP OF CHAOSNET HEADER AND 2-WORD ETHERNET HEADER + ;THIS IS THE OFFSET (IN WORDS) WHERE THE ETHERNET PACKET STARTS + +;HERE IS A PACKET USED TO BUILD THE ETHERNET BROADCAST GATEWAY INFO. WHAT A CROCK. +EGTBUF: .BLKW PKHDW ;SPACE FOR CHAOSNET HEADER +EGTPLN: 0 ;PUP LENGTH + 201 ;PUP TYPE 201 +EGTPID: .WORD 0,0 ;PUP IDENTIFIER + 0 ;DESTINATION (BROADCAST) + .WORD 0,2 ;DEST SOCKET 2 +EGTSRC: .BYTE ETHHSN,ETHSBN ;SOURCE (ME) + .WORD 0,2 ;SOURCE SOCKET 2 +EGTSBN: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + .BLKW 2*NSUBNT + 0 ;PUP CHECKSUM + +.IF DF NDVRBF +DVRHST: 0 ;ZERO IF IDLE, OR FOREIGN HOST USING +DVRIDX: 0 ;FOREIGN INDEX +DVRLIX: 0 ;LOCAL INDEX (AOS EACH TIME) +DVRTIM: 0 ;COUNTS UP TO IDLE THE FOREIGN HOST +DVRRTR: 0 ;COUNTS UP FOR RETRANSMISSION + +DVRBFL==2*+1> ;NUMBER OF BYTES IN A DOVER BUFFER (HOLDS PUP IN CHAOSNET PACKET) +DVRBUF: .BLKB DVRBFL*NDVRBF ;RING OF BUFFERS HERE +DVRBF2: .BLKW PKHDW+2 ;BUFFER FOR SENDING STS/OPN/CLS BACK (ALSO END OF RING) +DVRBFP: DVRBUF ;POINTER TO NEXT BUFFER TO GO OUT TO DOVER +DVRMSK: 0 ;MASK OF WHICH BUFFERS CONTAIN PACKETS (MSB = DVRBFP PKT) + .IIF GT NDVRBF-16., .ERROR NDVRBF MAXIMUM OF 16. ALLOWED +DVRPKP: 0 ;IF NON-ZERO, POINTER TO SPECIAL PACKET TO SEND +DVRID: 0 ;ID FOR NEXT PACKET EXPECTED BY DOVER, THIS PACKET IS OR + ; WILL BE IN THE BUFFER DVRBFP POINTS AT +DVROFS: 0 ;ID OFFSET, SUBTRACT FROM CHAOS ID TO GET PUP ID +NDVRFK: 0 ;*** TEMPORARY KLUDGE *** +.ENDC ;NDVRBF +.ENDC ;ETHERP + +PULSAR: 0 ;COUNTS DOWN TO 0 THEN TRIGGERS TRANSMISSION OF A "TEST MESSAGE" +PULSON: FTPULS ;IF THIS IS NON-ZERO, FEATURE IS ENABLED, VALUE IS TICKS BETWEEN PULSES +USECBL: 0 ;IF NON-ZERO, 10 TALKING TO SELF STILL GOES THROUGH CABLE + +NCHX==DL10P+TEN11P+CHAOSP+<2*ETHERP> ;NUMBER OF ENTRIES IN SOURCE AND SINK TABLES +.IIF DF NDVRBF, NCHX==NCHX+1 + +;METERS ETC. +.IFNZ FTGARB +CHSGBF: .BLKW PKMAX ;HOLDS LAST PACKET THAT CAME IN WITH A CHECKSUM ERROR +CHSGBH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE CAME IN ON +CHSGBS: 0 ;STATUS REGISTER THAT GOES WITH ABOVE +CHSGBC: 0 ;BIT COUNT THAT GOES WITH ABOVE +.ENDC ;FTGARB + +;FOLLOWING HAVE SEPARATE ENTRIES FOR EACH CABLE +NPKSGB: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RECEIVED WITH CHECKSUM ERRORS +HPKSGB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRL: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RAM LOST, + ; I.E. DIDN'T COME IN WITH A CHECKSUM ERROR BUT AFTER + ; READING IT OUT HAD ONE. EITHER THE PACKET WAS THE + ; WRONG LENGTH, OR THE RAM IS LOSING, OR HARDWARE + ; CLOBBERAGE. FOR ETHERNET IS PUP CKSM ERR COUNT + ;THIS WORD ALSO IS WHERE BIT COUNT ERRORS WOULD END UP +HPKSRL: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +CHSRLH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE LAST HAPPENED ON. +CHSRLC: 0 ;RESIDUAL BIT COUNT FOR ABOVE +NPKSLS: .IREPT CHAOSP,0 ;NUMBER OF PACKETS LOST ACCORDING TO LOSS COUNT IN HARDWARE +HPKSLS: .IREPT CHAOSP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSAB: .IREPT CHAOSP+ETHERP,0 ;NUMBER OF TRANSMISSIONS ABORTED (BY COLLISION OR RECEIVE-BUSY) +HPKSAB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSI: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS IN ON EACH SOURCE +HPKSI: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSO: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS OUT ON EACH SINK +HPKSO: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSIG: 0 ;NUMBER OF PACKETS IGNORED AT CHIFLS +NPKSBD: .IREPT NCHX,0 ;NUMBER OF PACKETS BAD AT CHSIHB +HPKSBD: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRF: 0 ;NUMBER OF PACKETS FOR WHICH ROUTING FAILED +RFSBNT: -1 ;2* SUBNET# OF LAST ROUTING FAILURE + +;"INTERFACE ADDRESSES" +; A NEGATIVE INTERFACE ADDRESS IS THE UNIBUS ADDRESS OF A CHAOS INTERFACE. +; A ZERO INTERFACE ADDRESS MEANS THE DL10 +; A POSITIVE INTERFACE ADDRESS MEANS THE TEN-11, VALUE BETTER BE OCTAL 1011. + +CHSIBF: .BLKW PKMAX*CHAOSP ;INPUT BUFFER FOR PACKETS IN FROM CHAOS HDWR + +;THIS IS WHAT IS SENT BACK IN RESPONSE TO RFC TO "STATUS". +;FOR NOW, JUST THE NAME OF THE MACHINE. +HSTNAM: +.ENDC ;CHAOSP ;FUCK A DOG, PALX! +.IFM MC-DL + .ASCII \MC-IO/11\ +.ENDC +.IFM AI + .ASCII \AI-CHAOS-11\ +.ENDC +.IFNZ CHAOSP ;FUCK A DOG, PALX! +.IIF GE .-HSTNAM-32., .ERROR HSTNAM TOO LONG +.IREPT 32.-<.-HSTNAM>, .BYTE 0 ;PAD ON THE RIGHT WITH 0'S + +;CHAOSNET INPUT SOURCE AND OUTPUT SINK TABLES + + ;NOTE WELL, THE CODE RELIES ON THE ORDER OF THESE INDICES +.IIF NZ DL10P, CHXDLC==0 ;DL10 INDEX +.IIF NZ TEN11P, CHXT11==2*DL10P ;TEN11 INDEX +CHXCHS==2* ;FIRST CHAOS INDEX +.IIF NZ ETHERP, CHXETH==CHXCHS+<2*CHAOSP> ;ETHERNET INDEX +.IIF NZ ETHERP, CHXEGT==CHXETH+2 ;ETHERNET GATEWAY-INFO-BROADCAST KLUDGE INDEX +.IIF DF NDVRBF, CHXDVR==CHXEGT+2 ;DOVER PROTOCOL TRANSLATOR +.MACRO CHXCHK TAG +.IIF NE .-TAG-NCHX-NCHX, .ERROR TAG WRONG LENGTH TABLE +.ENDM CHXCHK + +;CHAOSNET INPUT SOURCE TABLES + +CHIBFP: ;BUFFER POINTER +.IIF NZ DL10P, DLCIBF ;DL10 INPUT BUFFER +.IIF NZ TEN11P, 0 ;CURRENT TEN11 INPUT BUFFER (SET FROM T11IBP+8) +.IREPT CHAOSP, CHSIBF+ ;CHAOS INPUT BUFFER +.IIF NZ ETHERP, ETHIBF ;ETHERNET +.IALSO EGTBUF ;.. +.IIF DF NDVRBF, 0 ;CURRENT DOVER BUFFER, COULD BE CHAOS OR PUP +CHXCHK CHIBFP + +CHIHDL: .IREPT NCHX, 0 ;LENGTH OF HEADER IN WORDS, PACKET CURRENTLY IN BFR + +CHISTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 HAS INPUT, -1 BEING OUTPUT) + +CHILNG: .IREPT NCHX, 0 ;LENGTH OF CONTAINED PACKET IN WORDS + +CHIOUX: .IREPT NCHX, 1 ;DESTINATION OUTPUT SINK INDEX (-1 IF DIRECTED TO PDP11 ITSELF) + +CHICBA: .IREPT NCHX, 0 ;DESTINATION CABLE ADDRESS + +CHIRFL: ;ADDRESS OF REFILL ROUTINE +.IIF NZ DL10P, DLCRFL +.IIF NZ TEN11P, T11RFL +.IREPT CHAOSP, CHSRFL +.IIF NZ ETHERP, ETHRFL ;ETHERNET +.IALSO CPOPJ ;.. +.IIF DF NDVRBF, DVRRFL +CHXCHK CHIRFL + +CHIHWR: ;POINTER TO HARDWARE +.IIF NZ DL10P, 1 ;NOT USED +.IIF NZ TEN11P, 3 ;NOT USED +.IREPT CHAOSP, CAICSR+<400*.RPCNT> ;QUAD-CHAOS INTERFACES HAVE TO BE 200 APART +.IIF NZ ETHERP, 164200 ;AND WE MAKE IT 400 BECAUSE ETHERNET GETS IN WAY +.IALSO 5 ;NOT USED +.IIF DF NDVRBF, 7 ;NOT USED + +;CHAOSNET OUTPUT SINK TABLES + +CHOHWR==CHIHWR ;POINTER TO HARDWARE + +CHOSTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 TRANSMITTING, -1 RETRANSMITTING + ; AFTER TRANS ABORT, +2 DELAYING AFTER TRANSMIT ABORT BEFORE RETRANSM) +CHOINX: .IREPT NCHX, 1 ;CURRENTLY-ACTIVE CHIxxx INDEX + +CHOXMT: ;START TRANSMISSION ROUTINE +.IIF NZ DL10P, DLCXMT +.IIF NZ TEN11P, T11XMT +.IREPT CHAOSP, CHSXMT +.IIF NZ ETHERP, ETHXMT ;ETHERNET +.IALSO 1 ;NOT USED (CHXEGT) +.IIF DF NDVRBF, DVRPKT ;DOVER +CHXCHK CHOXMT + +CHXSBN: ;SUBNET NUMBER +400 FOR STATUS SERVER +.IIF NZ DL10P, DLCADR/400+400 +.IIF NZ TEN11P, T11ADR/400+400 +.REPT CHAOSP + CONC CHAD,\.RPCNT,/400+400 +.ENDR ;CHAOSP +.IIF NZ ETHERP, ETHSBN+400 ;ETHERNET +.IALSO 776 ;NOT REAL (ETHERNET GATEWAY) +.IIF DF NDVRBF, 777 ;NOT REAL (DOVER) +CHXCHK CHXSBN + +CHXRTF: .IREPT NCHX, 0 ;NON-ZERO MEANS BROADCAST ROUTING INFO TO THIS GUY + +.IFNZ CHSBTB +CHSIDL: .IREPT NCHX, 0 ;NUMBER OF TICKS WAITING FOR TRANSMIT-DONE +CHSRST: .IREPT NCHX, 0 ;NUMBER OF TIMES HAD TO RESET HUNG INTERFACE +.ENDC ;CHSBTB + +;;; SUBNET/ROUTING TABLES + +;INDEX BY TWICE SUBNET NUMBER +SBNTYP: .IREPT NSUBNT, 0 ;TYPE OF CONNECTION TO THIS SUBNET: + ; 0 VIA GATEWAY, WITH AUTOMATIC ROUTING + ; -1 VIA GATEWAY, PATCHED IN BY HUMAN, DON'T CHANGE + ; 1 HARDWARE CONNECTION + +SBNADR: ;ADDRESS OF CONNECTION TO THIS SUBNET + ;NETWORK ADDRESS IF SBNTYP NEGATIVE OR ZERO + ;INDEX IN SOURCE/SINK TABLES IF SBNTYP GREATER THAN ZERO + 0 ;0 USED FOR UNKNOWN SUBNETS. WHEN IN DOUBT, BROADCAST. + 0 ;1 9TH FLOOR CABLE + 0 ;2 (NOT CURRENTLY USED) + 440 ;3 MC, ASSUME VIA MC-IO-11 + 426 ;4 AI, ASSUME VIA AI-CHAOS-11 + .IREPT NSUBNT-5, 0 ; WHEN IN DOUBT, BROADCAST + +SBNCST: .IREPT NSUBNT, 1000 ;COST OF ROUTING VIA CURRENT GATEWAY, SEE CHAORD + +;NOW FILL IN TABLES FOR HARDWARE CONNECTIONS THAT EXIST ON THIS MACHINE +;INCLUDING TRANSFINITE HAIR FOR ETHERNET GATEWAY INFO PACKET +ZZ==. +.IFNZ DL10P +DLCSBN==DLCADR/400 ;SUBNET PDP10 ON OTHER END OF DL10 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXDLC +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;DL10P +.IFNZ TEN11P +T11SBN==T11ADR/400 ;SUBNET PDP10 ON OTHER END OF TEN11 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXT11 +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;TEN11P +.ENDC ;CHAOSP + +.IFM MC-DL + CBLCST=11. ;CABLE CONNECTION COSTS 11. +.ENDC +.IFM AI + CBLCST=22. ;AI COSTS MORE 'CAUSE IT'S SICK +.ENDC + +.IFNZ CHAOSP ;sweet fucking jesus, palx +;HAIR FOR MULTIPLE CABLE INTERFACES +.REPT CHAOSP + CONC IZZZ==CHAD,\.RPCNT + IZZ==*2 + .=SBNTYP+IZZ + 1 + .=SBNADR+IZZ + CHXCHS+<.RPCNT*2> + .=SBNCST+IZZ + CBLCST ;THE CABLE COST +.ENDR ;CHAOSP + +.IFNZ ETHERP +.=SBNTYP+ + 1 +.=SBNADR+ + CHXETH +.=SBNCST+ + 11. +.ENDC ;ETHERP + +.=ZZ + +;;; CLOCKS +4SEC: 0 ;4-SECOND CLOCK COUNTER +15SEC: 0 ;15-SECOND CLOCK COUNTER + +.ENDC ;CHAOSP + +;PATCH AREA + +PAT: PATCH: .BLKW 100 + + .SBTTL RING BUFFERS + +.MACRO RING SIZE + 99$ ;IN-POINTER + 99$ ;OUT-POINTER + 0 ;NUMBER OF WORDS IN RING + ;MAX NUMBER ALLOWED + <2*>+99$ ;MAX ADDRESS ALLOWED + 99$ ;MIN ADDRESS ALLOWED +99$: .BLKW ;BUFFER +.ENDM + +RINGIN==0 +RINGOT==2 +RINGCT==4 +RINGSZ==6 +RINGTP==10 +RINGBT==12 +RINGBF==14 + +; DEFINE THE RING BUFFERS + +TYORNG: RING ;OUTPUT-DONE RING, CONTENTS = LINE NUMBER PDP10 STYLE + ;HAS TO BE EXTRA BIG BECAUSE THE OUTPUT DONES PUT IN ON + ;STARTUP FILL IT UP, THEN SOMETIMES ITS PUTS ONE IN + ;BEFORE IT TAKES ANY OUT. + +TYIRSZ==NCT*20 ;8 CHARS PER TTY (2 WORDS PER CHAR) +TYIRNG: RING TYIRSZ ;TTY INPUT RING, FIRST WORD IS CHARACTER, SECOND LINE NUMBER + + + +;MOV #RING,B +;MOV WORD,A +;CALL PUT + +PUT: CMP RINGCT(B),RINGSZ(B) + BLT 1$ + BPT ;BLOATED +1$: PUSH C + MOV RINGIN(B),C + MOV A,(C)+ + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGIN(B) + POP C + INC RINGCT(B) + RET + +;MOV #RING,B +;CALL GET +;WORD RETURNED IN A +; IT IS AN ERROR TO CALL THIS IF RING IS EMPTY + +GET: TST RINGCT(B) + BGT 1$ + BPT ;EMPTY +1$: PUSH C + MOV RINGOT(B),C + MOV (C)+,A + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGOT(B) + POP C + DEC RINGCT(B) + RET + +CLRING: CLR RINGCT(B) ;CLEAR A RING + MOV RINGBT(B),RINGIN(B) + MOV RINGBT(B),RINGOT(B) + RET + .IFNZ DTE20P + .SBTTL DTE20 SUBROUTINES + +;THE DTE20 MUST NOT BE HACKED AT INTERRUPT LEVEL, BECAUSE KLDCP USES IT TOO. +;THE FOLLOWING THREE LOCATIONS ARE ARGS TO/FROM THE FOLLOWING TWO SUBROUTINES. + +LH: 0 ;LOW 16 BITS OF LEFT HALF +RH: 0 ;LOW 16 BITS OF RIGHT HALF +SNB: 0 ;SIGN BIT (0 IF +, NON-0 IF -) + +;JSR B,HWEXAM +; .WORD ADDR +;EXAMINE PDP10 LOC, SPLIT INTO HALFWORDS, SET LH, RH, SNB +;RETURNS WITH "Z" SET IF LOCATION HAS POSITIVE SIGN, "Z" CLEAR IF MINUS SIGN + +HWEXAM: PUSH ;SAVE REGS + PUSH <#0,(B)+> ;PUT PDP10 ADDRESS ONTO PDL + MOV SP,A ;SET UP POINTER TO ADDRESS + EXAM ;EXAMINE LOCATION, SET A TO POINT TO 3-WORD RESULT BUFFER + BCS UHUNG ;BRANCH IF UCODE HUNG + MOV (A)+,RH ;LOW 16 BITS => RH + MOV (A)+,C ;PICK UP MIDDLE 16 BITS + MOV (A)+,A ;PICK UP HIGH 4 BITS + ROR A ;LSHC ,-2 TO GET PDP10 LH INTO C + ROR C + ROR A + ROR C + MOV C,LH + BIC #177775,A ;LEAVE SIGN BIT IN 1.2 OF A + MOV A,SNB + ADD #4,SP ;POP ADDRESS OFF PDL + POP ;RESTORE REGS + TST SNB + RTS B ;RETURN SKIPPING IN-LINE PARAMETER + +;JSR B,HWDEP +; .WORD ADDR +;ASSEMBLE LH, RH, SNB INTO PDP10 AND DEPOSIT IN ADDR + +HWDEP: PUSH + MOV LH,C + CLR A + TST SNB + BEQ 1$ + MOV #2,A +1$: ASL C + ROL A + ASL C + ROL A + PUSH ;PUSH HIGH, MIDDLE, AND LOW BITS + MOV SP,A ;POINTER TO DATA + PUSH <#0,(B)> ;PUSH HIGH AND LOW ADDRESS + MOV SP,B ;POINTER TO ADDRESS + DPOS ;DO THE DEPOSIT + BCS UHUNG ;BRANCH IF UCODE HUNG + ADD #10.,SP ;POP ADDRESS AND DATA OFF PDL + POP + TST (B)+ ;SKIP TRAILING PARAMETER + RTS B + +UHUNG: $PMSG + .WORD 1$ + SETOM NO.ITS ;GIVING UP + JMP $CNTLC + +1$: .ASCIZ/?MICROCODE HUNG/ + +.ENDC ;DTE20P + .IFNZ DL10P + .SBTTL MAIN LOOP FOR DL10 + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + BIT #DLXPRT,DLXCSR ;PORT TO 10 ENABLED? + BNE 1$ ;YES + SETOM NO.ITS ;NO, FLAG THERE IS NO ITS + SETOM DLXOFF ;AND THAT WE THINK DL10 PORT IS OFF + BR MAIN ;AND WAIT FOR IT TO TURN ON + +1$: TST DLXOFF ;DID DL10 JUST TURN ON? + BEQ 4$ ;NO, IT WAS ON BEFORE + CLR DLXOFF ;YES, SO REMEMBER THAT + MOV VERS,A ;CHECK VERSION SUPPLIED BY -10 + BEQ 2$ ;ZERO OK (MUST BE SALVAGER) + CMP A,VERSN + BEQ 2$ + BPT ;-10 AND -11 PROGRAMS NOT SAME CONFIG +2$: + +4$: BIT #DLXPAR+DLXNXM,DLXCSR ;ERROR ACCESSING MEMORY? + BEQ 5$ ;NO + BPT ;DON'T GO OFF DESTROYING PEOPLE'S FILES + +;WAIT FOR -10 TO REQUEST SERVICE, OR CLOCK TO TICK + +5$: CLR 10RQ + BIT #DLX11I,DLXCSR ;10 REQUESTING SERVICE? + BEQ 10$ + SETOM 10RQ + BIS #DLXZ11,DLXCSR ;YES, CLEAR FLAG + BR CHKOST ;AND GO CHECK FOR THINGS TO DO + +10$: TST WAKE ;NO, CHECK ANYWAY IF 60 CYCLE CLOCK HAS TICKED + BEQ MAIN ;NEITHER, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + INC DLXUP ;AND INCREMENT COUNTER 10 IS SUPPOSED + BEQ 11$ ; TO SETOM EVERY 1/2 SEC + CMP DLXUP,#15.*60. ;IF IT DOESN'T TOUCH IT FOR 15 SECONDS, + BLE 12$ ; CONSIDER IT DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ; THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS + MOV #15.*60.,DLXUP ;DON'T LET COUNTER OVERFLOW + BR 12$ ;BUT CHECK FOR COMMANDS ANYWAY (SALVAGER DISK) + +11$: CLR NO.ITS ;-10 HAS SETOMED COUNTER, IT'S UP +12$: ;FALL INTO CHKOST + +; CHECK FOR OUTPUT-START FROM -10 + +CHKOST: MOV TTYST,A ;LINE# TO START OUTPUT + BEQ CHKOUT ;NONE. + CLR TTYST ;TELL -10 IT'S BEEN PICKED UP + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT ;PUT IN RING, LATER WILL SEND IT BACK TO 10 + UNMASK + +; CHECK FOR TTY OUTPUT SENT BY -10 + +CHKOUT: MOV TYOLIN,I ;OUTPUT TO BE DONE? + BEQ CHKIN ;NO. + MOV TYOCNT,C ;YES, GET NUMBER OF CHARS + CALL TYOSER ;CALL OUTPUT HANDLER + CLR TYOLIN ;TELL 10 WE'VE GOBBLED THE OUTPUT + BIS #DLX10I,DLXCSR ;GIVE TRANSFER-COMPLETE INTERRUPT + +; CHECK FOR TTY INPUT TO BE SENT TO -10 + +CHKIN: TST TYIRNG+RINGCT + BEQ CHKDON ;NO STATUS TO BE STORED + TST TYILIN + BNE CHKDON ;PREVIOUS STATUS NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,TYICHR ;GIVE INPUT CHARACTER TO 10 + CALL GET + MOV A,TYILIN ;GIVE LINE NUMBER TO 10 + BIS #DLX10I,DLXCSR ;SEND INTERRUPT TO 10 + +; CHECK FOR OUTPUT-DONE TO BE SENT TO -10 + +CHKDON: TST TYORNG+RINGCT + BEQ CHKHNG ;NO STATUS TO BE STORED + TST TYOSTS + BNE CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET + MOV A,I + ASL I + MOV BUFSIZ(I),TYOBSZ ;TELL -10 HOW MANY CHARS TO GIVE + MOV A,TYOSTS ;GIVE OUTPUT DONE TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR HANGUPS TO BE SENT TO -10 + +CHKHNG: TST HNGSIG ;ANY HANGUPS TO BE REPORTED? + BEQ CHKLPR ;NO + TST HNGLIN + BNE CHKLPR ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,HNGLIN ;GIVE LINE NUMBER AND OTHER DATA TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR REQUEST FROM -10 TO SET LINE PARAMETERS + +CHKLPR: MOV LPRLIN,I ;LINE PARAMETERS TO BE SET? + BEQ CHKCHS ;NO. + ASL I ;YES, GET LINE INDEX + MOV LPRLPR,A ;AND DH11 PARAMETER REGISTER VALUE + MOV LPRBSZ,B ;AND BUFFER SIZE + CALL SPARAM ;CALL PARAMETER SETTER + CLR LPRLIN ;TELL 10 IT IS DONE + +; CHECK FOR CHAOS NET ACTIVITY + +CHKCHS: +.IFNZ CHAOSP + CALL DLCWAK ;WAKEUP DL10-CHAOSNET STUFF +.ENDC ;CHAOSP +.IFNZ T300P + CALL DSKSTR ;CHECK FOR DISK REQUEST +.ENDC ;T300P + +; CHECK FOR EXAMINE/DEPOSIT REQUEST FROM -10 + +CHKEXD: TST EXDSTS ;EXAMINE/DEPOSIT? + BEQ CHKGLD ;NO. + MOV EXDADR,A ;GET ADDRESS + CMP EXDSTS,#2 + BNE 21$ + MOV EXDDAT,(A) ;DEPOSIT +21$: MOV (A),EXDDAT ;EXAMINE + CLR EXDSTS ;IT IS DONE + +;CHECK FOR GOULD LPT OUTPUT + +CHKGLD: +.IF EQ GOULDP +; CLR GLPCTR ;IF NO GOULD, FLUSH OUTPUT FOR IT +; SETOM GLPTER ;AND SAY "NOT READY" + TST 10RQ + BEQ 20$ + ;10 WANTED US TO DO SOMETHING, PLAY WITH THE LIGHTS + MOV LITHSE,A + ROL A + ROL LITHSE +20$: MOV LITHSE,GLPTER +.IFF + TST GLPCTR ;ANY BYTES IN BUFFER? + BEQ 1$ + CALL GLPTYO ;YES, OUTPUT THEM +1$: MOV GLPERR,GLPTER ;COPY ERROR STATUS FROM P.I. LEVEL TO -10 +.ENDC ;DONE HERE SO NO USE OF DL10 AT P.I. LEVEL +; BR MAINX + +MAINX: JMP MAIN ;THAT'S IT +MAINE:: +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL MAIN LOOP FOR DTE20 + +MAIN: BIT #%D1RUN,DIAG1 ;IS KL10 RUNNING? + BEQ TENDED ;NO, LOSE! + BIT #%D1ERR+%D1HLT,DIAG1 ;HAS KL10 CLOCK STOPPED FOR HARDWARE ERROR? OR JRST 4 + BNE TENDED ;YES, LOSE! + TST KLDCPF ;MAYBE USER WANTS TO GIVE A KLDCP COMMAND? + BNE KLDCPR ;YES, RETURN TO KLDCP + TSTB @DLKS+NFDLHX ;CTY INPUT? + BPL 10$ ;TEST KBD BEFORE CLK SINCE MIGHT BE MORE THAN + ; 1/60'TH SECOND PER TRIP AROUND THE LOOP. + MASK 5 ;YES, SIMULATE INTERRUPT + CALL DL1IBK ;CAN'T USE REAL INTS BECAUSE WOULD INTERFERE WITH KLDCP +10$: TSTB LKS ;60 CYCLE CLOCK TICK? + BMI CLKSER ;YES + BIT #%STINV,STATUS ;REQUEST FROM 10? + BNE TENSER ;YES, SERVICE IT. + BIT #%STDNI,STATUS ;TO10 XFER COMPLETE? + BNE INPDON ;YES, SERVICE IT. + BIT #%STDNO,STATUS ;TO11 XFER COMPLETE? + BNE OUTDON ;YES, SERVICE IT. + BIT #%STERI+%STERO,STATUS + BNE LOSSAG ;BYTE TRANSFER LOST + BR MAIN ;CLOSE LOOP + +;60-CYCLE CLOCK SERVICE + +CLKSER: CLR LKS ;CLEAR CLOCK FLAG + TST CLKENB ;DOES 10 WANT CLOCK INTERRUPTS? + BEQ 1$ + D10MON ;YES, GIVE ONE + DTECLK ;SET CLOCK FLAG IN LOW CORE + BCS UHUNG + MOV #%STINX,STATUS ;AND SEND INTERRUPT +1$: CMP SWR,CURSWR ;MAYBE NEED TO UPDATE 10'S SWITCHES + BEQ 2$ + MOV SWR,CURSWR + TENSW ;LET KLDCP DO IT + BCS UHUNG +2$: JSR B,HWEXAM ;INCREMENT COUNTER -10 IS SUPPOSED + DTECHK ; TO SETOM EVERY HALF-SECOND + CLR LH + CLR SNB + INC RH + BEQ 3$ + CMP RH,#15.*60. ;IF IT DOESN'T SETOM IT FOR 15 SECONDS + BLE 4$ ;THEN IT IS DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ;THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS. + MOV #15.*60.,RH ;DON'T LET COUNTER OVERFLOW + BR 4$ + +3$: CLR NO.ITS ;IT SETOMED COUNTER, IT'S UP. +4$: JSR B,HWDEP ;PUT COUNTER BACK + DTECHK + MASK 6 ;NOW SIMULATE BR6 CLOCK INTERRUPT + CALL CLKBRK + BR TENSER ;AND GO SERVICE 10 (IN CASE LOST INTERRUPT) + +; HERE IF KL10 HALTS + +TENDED: SETOM NO.ITS + CLC + RET ;LET KLDCP PRINT THE MESSAGE + +; BYTE TRANSFER ENCOUNTERED HARDWARE LOSSAGE + +LOSSAG: BPT + BR LOSSAG + +; USER WANTS TO GIVE A KLDCP COMMAND + +KLDCPR: CLR KLDCPF + SEC + RET + +TENSER: JMP TENSR0 + +; HERE WHEN TO10 BYTE TRANSFER COMPLETE + +INPDON: MOV #%STCLI,STATUS ;CLEAR FLAGS IN DTE20 + MOV INPCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WOOPS, NO XFER IN PROGRESS +1$: CLR INPCMD ;NO XFER IN PROGRESS NOW + MOV INPSVI,I + MOV INPSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAIN + +; HERE WHEN TO11 BYTE TRANSFER COMPLETE + +OUTDON: MOV #%STCLO,STATUS ;CLEAR FLAG + MOV OUTCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WHOOPS, NO XFER IN PROGRESS +1$: CLR OUTCMD ;NO XFER IN PROGRESS NOW + MOV OUTSVI,I + MOV OUTSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAINJ + +; HERE TO START TO10 BYTE TRANSFER. HWEXAM OF DTEINP HAS BEEN DONE. + +INPSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEINP + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BEQ OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +; HERE TO START TO11 BYTE TRANSFER. HWEXAM OF DTEOUT HAS BEEN DONE. + +OUTSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEOUT + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BNE OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +OUTSR1: MOV RH,C ;GET BYTE COUNT + MOVB LH,I ;GET LINE# + MOVB LH+1,A ;GET COMMAND TIMES 2 + BEQ MAINJ ;CLEARING CORE? IGNORE ZERO COMMAND + BLE OUTSR2 + CMP A,#LBEGIN + BGT OUTSR2 + CALL @BEGIN-2(A) ;CALL APPROPRIATE BEGIN-XFER ROUTINE + BIT #2,A + BNE 1$ + MOV A,INPCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,INPSVI + MOV C,INPSVC + BR MAINJ + +1$: MOV A,OUTCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,OUTSVI + MOV C,OUTSVC +MAINJ: JMP MAIN + +OUTSR2: BR MAINJ ;BAD COMMAND FROM 10 (USED TO BE BPT) JUST IGNORE IT + +;TABLE OF ROUTINES TO PROCESS DATA TRANSFER COMMANDS FROM -10 + +BEGIN: TYOSER ;%DTTYO + ;ETHISR ;%DTETI + ;ETHOSR ;%DTETO +LBEGIN==.-BEGIN + +;TABLE OF ROUTINES TO FINISH UP DATA TRANSFERS + +FINAL: TYOFIN ;%DTTYO + ;ETHIFN ;%DTETI + ;ETHOFN ;%DTETO + +;CHECK FOR COMMANDS FROM 10, STORE STATUS IN ANY STATUS WORDS +;THAT 10 HAS SET BACK TO -1 + +TENSR0: MOV #%STUNV,STATUS ;CLEAR 10 INTERRUPTING 11 FLAG + JSR B,HWEXAM ;CHECK FOR A NON-TIMESHARING COMMAND + DTECMD + MOV RH,A ;IS THERE ONE? + BEQ TENSR1 ;NO, GO CHECK FOR TIMESHARING STUFF + CLR LH + CLR SNB + CMP A,#377 + BHI 2$ +1$: TSTB TPS ;CHAR TO BE TYPED, WAIT FOR READY + BPL 1$ + MOVB A,TPB ;TYPE IT OUT +9$: CLR RH ;CLEAR OUT THE COMMAND + JSR B,HWDEP + DTECMD + D10MON ;TELL 10 IT'S DONE + DTEFLG + JMP MAIN + +2$: CMP A,#%DTTYI + BNE 5$ + CLR RH ;SNB,LH,RH NOW HAS ZERO + SETOM DDTMOD ;KEYBOARD INPUT WANTED + TST DDTCHR ;TEST IF READY + BMI 3$ ;IF NO INPUT, GIVE ZERO + MASK 5 + MOV DDTCHR,RH ;GIVE THE CHAR + COM DDTCHR ;MAKE NEGATIVE + UNMASK +3$: JSR B,HWDEP + DTEF11 + BR 9$ + +5$: CMP A,#%DTCLN + BNE 6$ + SETOM CLKENB + BR 9$ + +6$: CMP A,#%DTCLF + BNE 7$ + CLR CLKENB + BR 9$ + +7$: BPT ;SOME COMMAND WE DON'T IMPLEMENT + BR 9$ ;IF CONTINUED, IGNORE IT + +;CHECK FOR ITS UP/DOWN + +TENSR1: TST NO.ITS ;IF SYSTEM ISN'T UP, + BNE MAINJ ;DON'T TRY TO HACK TS STUFF + INC DLXOFF ;OTHERWISE, FIRST TIME THROUGH HERE + BNE CHKOST ;WE CHECK THE VERSION + JSR B,HWEXAM + DTEVER + TST RH ;STORED? + BNE 1$ + DEC DLXOFF ;NO, DON'T LOOK AT IT + BR MAINJ ;PROBABLY CORE BEING CLEARED + +1$: CMP RH,VERSN + BEQ CHKOST + BPT ;-10 AND -11 PROGRAMS NOT SAME VERSION + +CHKOST: JSR B,HWEXAM ;CHECK FOR 10 WANTING OUTPUT START + DTEOST + BNE CHKTRN ;BRANCH IF LOCATION DTEOST IS -1 + D10MON ;HAVING PICKED IT UP, SET BACK TO -1 + DTEOST + MOV RH,A + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT + UNMASK + CLR DDTMOD ;SYSTEM UP, TURN OFF DDT MODE + MOV #-1,DDTCHR ;.. + +CHKTRN: TST INPCMD + BNE 1$ ;INPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEINP + BNE 1$ ;DTEINP -1, NO REQUEST + JMP INPSER + +1$: TST OUTCMD + BNE CHKLSP ;OUTPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEOUT + BNE CHKLSP ;DTEOUT -1, NO REQUEST + JMP OUTSER + +CHKLSP: JSR B,HWEXAM ;CHECK FOR SET LINE SPEED COMMAND + DTELSP + BNE CHKTYI + MOV RH,I ;GET LINE# + ASL I + CMP I,#NFTTY ;VALIDATE IT + BLO 1$ ;IGNORE IF BAD + CMP I,#LASTTY + BHI 1$ + JSR B,HWEXAM ;GET LPR,,BUFFERSIZE + DTELPR + MOV LH,A + MOV RH,B + CALL SPARAM ;DO IT +1$: D10MON ;DONE, SETOM + DTELSP + +CHKTYI: TST TYIRNG+RINGCT + BEQ CHKODN ;NO TTY INPUT WAITING + JSR B,HWEXAM + DTETYI + BEQ CHKODN ;PREVIOUS CHAR NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,RH ;CHAR + CALL GET + MOV A,LH ;LINE# + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,CHAR + DTETYI + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKODN: TST TYORNG+RINGCT + BEQ CHKHNG ;NO OUTPUT DONES WAITING + JSR B,HWEXAM + DTEODN + BEQ CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET ;GET LINE# WITH OUTPUT DONE + MOV A,LH + ASL A + MOV BUFSIZ(A),RH + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,BUFFERSIZE + DTEODN + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKHNG: TST HNGSIG + BEQ MAINX ;NO HANGUPS/DIALINS WAITING + JSR B,HWEXAM + DTEHNG + BEQ MAINX ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,RH ;GIVE LINE NUMBER AND OTHER DATA TO 10 + CLR LH + CLR SNB + JSR B,HWDEP + DTEHNG + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +MAINX: JMP MAIN +.ENDC ;DTE20P + +.IFZ DL10P+DTE20P + .SBTTL MAIN LOOP FOR AI + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IIF Z TEN11P, CALL CHSRUN ;DAMNED THING GETS WEDGED +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + TST WAKE ;CLOCK TICK? + BEQ MAIN ;NO, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + BR MAIN ;NOT MUCH TO DO, NO TTYS +.ENDC ;DL10P+DTE20P + + .SBTTL OUTPUT HANDLERS + +TYOSER: ASL I ;CONVERT -10 LINE# TO -11 TTY INDEX + CMP I,#NFTTY + BLO 11$ + CMP I,#LASTTY + BLOS 12$ +11$: BPT ;10 GAVE BAD LINE# +12$: MOV HDWR(I),H ;GET HARDWARE INDEX + MOV BUFPNT(I),D ;AND ADDRESS OF TYPEOUT BUFFER + CMP BUFSIZ(I),C ;MAKE SURE THERE IS ROOM IN BUFFER + BHIS 2$ + BPT ;THERE ISN'T +2$: MOV C,B ;MUSTN'T CLOBBER BYTE COUNT IN C +.IFNZ DL10P + MOV #TYOPNT,A ;GET CRUFT FROM DL10 +3$: MOVB @A,(D)+ ;COPY BUFFER + SOB B,3$ +.ENDC ;DL10P +.IFNZ DTE20P + MOV D,TO11AD ;SET UP BYTE TRANSFER + NEG B + BIC #050000,B ;SET LAST, BYTE; CLEAR ASCIZ, 2.4 + MOV B,TO11BC ;START XFER + RET + +TYOFIN: MOV HDWR(I),H ;COMES BACK WHEN XFER COMPLETE +.ENDC ;DTE20P + +;BUFFER HAS BEEN LOADED, START DEVICE + + MASK 5 ;DON'T LET DEVICE INTERRUPT + MOV BUFPNT(I),D + CALL @STROUT(H) ;CALL DEVICE-DEPENDENT ROUTINE + MOV #40000,TYPING(I) ;TELL 10 WHEN OUTPUT FINISHES (LARGE POSITIVE NUMBER) + UNMASK + RET + +;GIVE MESSAGE. A -> .WORD LENGTH,MSG. I HAS LINE NUMBER. + +GIVMSG: PUSH + MOV (A)+,C ;C HAS BYTE COUNT, A HAS ADDRESS + MOV A,D ;PUT ADDRESS IN D + MOV HDWR(I),H + MASK 5 + CALL @STROUT(H) ;START OUTPUT TO LINE + UNMASK + POP + RET + +ASPACK: MNAME ^% + MSG ^\ +‡Connected to MCHN'.\% +DWNMSG: MSG ^\ +‡ITS is down.\ +IBOMSG: MSG ^\IBO\ + +;DEVICE-DEPENDENT OUTPUT START ROUTINES (CALL AT PI LEVEL 5) +;H HDWR IDX, I TTY IDX, D BUFFER POINTER, C NUMBER OF BYTES + +STRDH: BIC DHLBIT(I),@DHBAR(H) ;IF LINE ALREADY TRANSMITTING, STOP IT + ;IT SHOULDN'T OUGHT TO BE... + MOV DHLSEL(I),@DHSCR(H) ;HARDWARILY SELECT THIS LINE + MOV D,@DHCA(H) ;SET XMT ADDRESS + NEG C ;HARDWARE LIKES NEGATIVE BYTE COUNTS + MOV C,@DHBC(H) ;SET XMT COUNT + BIS DHLBIT(I),@DHBAR(H) ;START TRANSMISSION HARDWARILY + BIS DHLBIT(I),DHOAC(H) ;SOFTWARILY ALSO + RET + +STRDL: MOV D,DLCA(H) + MOV C,DLBC(H) + CLR @DLPS(H) + MOV #300,@DLPS(H) ;CAUSE INTERRUPT + SETOM DLOAC(H) +CPOPJ: RET + +.IFNZ NMPTYS +STRMPK: TST MPXENB + BEQ CPOPJ + MOV D,MPXPNT-NFMPTY(I) ;QUEUE OUTPUT + MOV C,MPXNBT-NFMPTY(I) +STRMPX: PUSH I + TST MPXOAC ;START THE MPXR + BNE 10$ ;ALREADY BUSY + CLR I + MOV #NMPTYS,D +2$: MOV MPXNBT(I),C ;FIND MPX KLUDGE LINE WANTS TO OUTPUT + BNE 15$ + TST (I)+ + SOB D,2$ +10$: POP I + RET + +15$: MOV I,MPXOLN ;SAVE LINE# OUTPUT ON + ASR I ;SET UP HEADER + ADD #200,I + MOVB I,MPXHED + MOVB C,MPXHED+1 + MOV #-1,MPXOAC ;SEND HEADER + MOV #MPXIDX,I + MOV HDWR(I),H + MOV #MPXHED,D + MOV #2,C + CALL @STROUT(H) + BR 10$ +.ENDC ;NMPTYS + +.IFNZ GOULDP +.SBTTL GOULD LPT OUTPUT (M.P. LEVEL) +.IIF Z DL10P, .ERROR GOULD LPT ONLY CODED FOR DL10 +.ERR BY THE WAY, THESE ROUTINES DON'T WORK WORTH GUBBISH + +GLPTYO: MOV GLPOIP,H ;GET NEXT BUFFER + CMP GB.STA(H),#%GBMP + BEQ 2$ ;BRANCH IF M.P. ACTIVE + BLT 1$ ;BRANCH IF IDLE BUFFER AVAIL + RET ;NO FREE BUFFERS + +1$: CALL GLPBGB ;GOBBLE A BUFFER +2$: MOV GB.PNT(H),D + MOV GLPCTR,C ;SET UP BYTE COUNTER + MOV GLPGRF,GLPGF1 ;COPY ARG FROM 0 FOR SPEED + TST GLIMBF ;CHAR SAVED FROM LAST TIME? + BEQ GLPNCL + CLR GLIMBF ;YES, PRINT IT + MOVB GLIMBO,A + CALL GLPPUT + MOVB GLIMBO+1,A ;SECOND CHAR? + BEQ GLPNCL + CLR GLIMBO + CALL GLPPUT + +;CHARACTER PROCESSING LOOP +;C HAS # CHARS YET TO GO, D HAS WHERE TO PUT THEM, H -> BUFFER +;A WILL HAVE CHAR + +GLPNCL: MOV GLPPTR,A ;GET NEXT CHAR + TST GLPGF1 + BNE GLPNRM ;GRAPHIC MODE, NO CHARACTER PROCESSING + CMP A,#177 ;ESCAPE? + BEQ GLPESC + CMP A,#40 ;CONTROL? + BGE GLPNRM ;NO, NORMAL PRINTING + CMP A,#14 ;CHECK FOR SPECIAL CONTROLS + BNE 10$ +8$: CLR GLPROW ;START NEW PAGE + TST GLPCOL ;IN MIDDLE OF LINE? + BEQ 9$ ;NO, OK + CALL GLPBWW ;OTHERWISE, HAIR + CLR GLPFIL ;HACK HACK MAKE FF NEXT LINE + BR GLPNB1 + +9$: SETOM GB.FF(H) + BR GLPNXC + +10$: CMP A,#12 + BNE 12$ + INC GLPROW + CMP GLPROW,#GLPRMX + BHIS 8$ ;SKIP OVER PERFORATION + TST GLPCOL + BNE GLPNBF ;IF NOT A BLANK LINE, FINISH BUFFER + INC GB.NL(H) + BR GLPNXC + +12$: CMP A,#11 + BNE 15$ +13$: MOV #40,A ;TAB - SPACE OVER + CALL GLPPUT + BIT #7,GLPCOL + BNE 13$ + BR GLPNXC + +15$: CMP A,#15 + BEQ GLPNXC ;IGNORE CR + CMP A,#33 + BNE 16$ + MOV #'$,A ;PRINT ALTMODE AS DOLLAR + BR GLPNRM + +16$: BIS #100,A ;RANDOM CONTROL AS UPARROW, LETTER + MOVB A,GLIMBO+1 + MOV #'^,A + CALL GLPPUT + MOVB GLIMBO+1,A + CLR GLIMBO +GLPNRM: CALL GLPPUT ;HERE FOR NORMAL CHARACTER +GLPNXC: DEC C ;HERE TO GOBBLE CHARACTER + BGT GLPNCL ;BRANCH IF MORE CHARS TO GO + BR GLPEND ;BUFFER EMPTIED + +GLPNBF: CALL GLPBWW ;HERE TO ADVANCE TO NEXT BUFFER +GLPNB1: CMP GB.STA(H),#%GBIDL ;NEXT BUFFER AVAIL? + BNE GLPEN1 ;NO, STOP + CALL GLPBGB ;YES, GOBBLE IT + BR GLPNXC + +GLPESC: DEC C ;HERE FOR TWO CHAR ESC SEQ + BEQ GLPEND ;-10 FORGOT 2ND CHAR, FLUSH + MOV GLPPTR,A ;GET & DECODE 2ND CHAR + CMP A,#105 ;EOF + BEQ GLPEOF + BR GLPNXC ;OTHER CHARS ARE IGNORED + +GLPEOF: CLR GLPFIL + CLR GLPROW + CALL GLPBWW ;EOF, WRITE LAST BUFFER +GLPEN1: DEC C ;GOBBLE A CHARACTER +GLPEND: MOV C,GLPCTR ;HERE WHEN DONE, RELEASE 10'S BUFFER + CMP GB.STA(H),#%GBMP ;BUFFER ACTIVE AT M.P. LEVEL? + BNE 1$ ;IF NOT, DON'T CLOBBER GB.PNT + MOV D,GB.PNT(H) ;IF SO, REMEMBER AMT OF STUFF IN CURRENT BUFFER +1$: RET ;RETURN TO MAIN LOOP + +;OUTPUT PRINTING CHAR IN A + +GLPPUT: CMP D,GLPLIM ;LINE OVERFLOW? + BLO 5$ ;NO + CALL GLPBWW ;YES, DONE WITH THIS BUFFER + INC GLPROW ;OUGHT TO CHECK FOR PERFORATION, BUT... + CMP GB.STA(H),#%GBIDL ;MORE BUFFERS? + BNE 6$ ;NO + CALL GLPBGB +5$: MOVB A,(D)+ ;DROP CHAR IN BUFFER + INC GLPCOL ;AND ADVANCE COLUMN + RET + +6$: MOVB A,GLIMBO ;NO BUFFERS, SAVE CHAR BEING PRINTED + SETOM GLIMBF ;SET FLAG SO WILL BE PRINTED NEXT TIME + TST (SP)+ ;STOP THE WORLD + BR GLPEN1 + +;GOBBLE IDLE BUFFER H -> FOR M.P. RETURNS GB.PNT(H) IN D. + +GLPBGB: MOV #%GBMP,GB.STA(H) ;ACTIVATE AT M.P. LEVEL + CLR GB.FF(H) ;INIT THE BUFFER + CLR GB.NL(H) + CLR GLPCOL ;START LINE IN COLUMN 0 + MOV H,D ;INIT INSERT POINTER + ADD #GB.DAT,D + MOV D,GB.PNT(H) + MOV H,GLPLIM ;SET UP MAX. VALUE OF GB.PNT + ADD #GB.LEN,GLPLIM + RET + +;GIVE BUFFER H -> TO P.I. LEVEL + +GLPBWW: BIT #1,D ;MUST BE EVEN NUMBER OF BYTES + BEQ 1$ + CLRB (D)+ + +1$: PUSH A ;INTERFACE GETS BYTES IN WRONG ORDER + MOV P,A ;COMPUTE NUMBER OF WORDS IN LINE + SUB H,A + SUB #GB.DAT,A + ASR A + BNE 4$ + CLR (D)+ ;CAN'T HAVE ZERO-LENGTH LINE + INC A +4$: MOV A,GB.PNT(H) ;SAVE WORD COUNT FOR P.I. LEVEL +2$: SWAB -(D) + SOB A,2$ + POP A + TST GLPFIL ;IF STARTING NEW FILE, + BNE 5$ + SETOM GLPFIL + SETOM GB.FF(H) ; BE SURE TO GET NEW PAGE +5$: MOV #%GBWRT,GB.STA(H) ;QUEUE TO P.I. LEVEL + MOV GB.NXT(H),H ;ADVANCE TO NEXT BUFFER + MOV H,GLPOIP + MASK 6 ;STOP P.I. LEVEL (HAVE TO LOCK OUT GLPBRK & CLKBRK) + TST GLPOAC ;PRINTER ON? + BNE 3$ ;YUP + MOV #%GCOFF,@#GLPCSR ;NO, CLEAR OLD STUFF IN INTERFACE + TST GLPGF1 ;AND PUT IN LOW-SPEED GRAPHIC MODE IF NECC + BEQ 6$ + MOV #%GCGRF,@#GLPCSR + MOV #%GCLSL,@#GLPCSR ;LOW SPEED (COME ON, THIS IS ONLY A KL10!) +6$: MOV #%GCON,@#GLPCSR ;TURN IT ON + MOV #%GCION,@#GLPCSR ;TURN ON INTERRUPTS + SETOM GLPOAC +; PUSH @#PS ;FAKE AN INTERRUPT +; CALL GLPBRK ;IS THIS NECESSARY? +3$: UNMASK + RET + +;GOULD LPT VARIABLES + +GLPCOL: 0 ;CURRENT COLUMN NUMBER +GLPROW: 0 ;CURRENT ROW NUMBER + GLPRMX==67. ;NUMBER OF LINES PER PAGE +GLPLIM: 0 ;ADDRESS OF END OF CURRENT BUFFER +GLPOAC: 0 ;NON-ZERO => GOULD LPT P.I. ACTIVE +GLPGF1: 0 ;NON-ZERO => GOULD LPT IN GRAPHIC MODE +GLIMBO: 0 ;SAVE CHAR HERE WHEN RUN OUT OF BUFFERS +GLIMBF: 0 ;NON-ZERO => CHAR IN GLIMBO +GLPFIL: 0 ;NON-ZERO => IN MIDDLE OF A FILE +GLPTIM: 10. ;COUNT DOWN WHEN LOSING +GLPERR: 0 ;NON-ZERO => ERROR STATUS FROM P.I. +.ENDC ;GOULDP + + .SBTTL T-300 DISK + +.IFNZ T300P + +;DISK UNIBUS REGISTERS + +DSKCRA=176700 ;COMPLETION REGISTER A + %DAPON==100000 ;SPONTANEOUS COMPLETION DUE TO POWER-ON. DISK NUMBER + ; IN LOW BITS OF COMMAND-COMPLETION REGISTER B + %DACQE==10000 ;CONSISTENCY ERROR IN COMMAND QUEUE + %DANXM==4000 ;NXM ERROR IN COMMAND QUEUE + %DAPAR==2000 ;PARITY ERROR IN COMMAND QUEUE + ;LOW 2 BITS OF COMMAND COMPLETION REGISTER A AND + ;COMMAND COMPLETION REGISTER B CONTAIN THE ADDRESS + ;OF THE PARITY OR NXM ERROR +DSKCRB=176702 ;COMPLETION REGISTER B +DSKCSR=176704 ;COMMAND/STATUS REGISTER + %DCCPL==100000 ;COMMAND IS COMPLETE, RESET BY %DCACK. READ-ONLY + %DCDER==40000 ;"DMA ERROR", RESET ONLY BY SYSTEM RESET. + ;1=NORMAL, 0=ERROR + ;BITS 30004 ALWAYS ON + %DCMNT==4000 ;HOST-ADAPTOR MAINTENANCE MODE + %DCRST==2000 ;RESET. WRITE-ONLY. + %DCACK==1000 ;ACKNOWLEDGE COMMAND COMPLETION. WRITE-ONLY + %DCCMD==400 ;TAKE COMMAND FROM CTRA/CTRB. WRITE-ONLY + %DCRDY==200 ;READY TO TAKE A COMMAND. READ-ONLY + %DCTIE==100 ;COMMAND TRANSMISSION (%DCRDY) INTERRUPT ENABLE + %DCCIE==40 ;COMMAND COMPLETION (%DCCPL) INTERRUPT ENABLE + %DCPCY==20 ;POWER JUST CYCLED ON OR OFF. READ-ONLY + %DCPON==10 ;POWER ON. READ-ONLY + %DCDMA==2 ;DMA IN PROGRESS. READ-ONLY + %DCBOT==1 ;BOOT (READ DRIVE 0 SECTOR 0 INTO MEMORY 0). WRITE-ONLY +DSKCTA=176706 ;COMMAND TRANSMISSION A (ADDRESS OF RQB HIGH BITS) +DSKCTB=176710 ;COMMAND TRANSMISSION B (ADDRESS OF RQB LOW BITS) +;176714 DUPLICATES DSKCSR FOR UNKNOWN REASONS + +;DISK REQUEST BLOCK. WE ONLY HAVE ONE SINCE NO SEEK OVERLAP. + +RQBACT: 0 ;NON-ZERO IF REQUEST ACTIVE AND EXPECTING COMPLETION + +RQBID: 0 ;RETURNED IN CCRB WHEN COMMAND COMPLETES +RQBSTS: 0 ;STATUS STORED BY 2561, COPIED INTO DSCSTS +RQBFLT: 0 ;FAULT CODE IN HIGH BYTE, BITS 1-0 HIGH BITS OF LINK ADDRESS +RQBLNK: 0 ;LINK ADDRESS TO NEXT RQB (MUST BE ZERO) +RQBCMD: 0 ;COMMAND CODE, COPIED FROM DSCCMD +RQBDRV: 0 ;UNIT NUMBER, COPIED FROM DSCDRV +RQBCYL: 0 ;CYLINDER NUMBER, COPIED FROM DSCCYL +RQBHED: 0 ;HEAD NUMBER, COPIED FROM DSCHED +RQBSEC: 0 ;SECTOR NUMBER, COPIED FROM DSCSEC +RQBWC: 0 ;POSITIVE WORD COUNT (ALWAYS 12.*256.) +RQBMA: 0 ;MEMORY ADDRESS (ALWAYS DSKBUF) +RQBMAH: 0 ;MEMORY ADDRESS HIGH (ALWAYS 0) + ; BITS 1-0 BITS 17-16 OF ADDRESS. BIT 6 MA INCR INH +RQBID1: 0 ;RETURNS RECORD ID 1 +RQBID2: 0 ;RETURNS RECORD ID 2 +RQBMNT: .BLKW 27. ;DIAGNOSTIC DATA MAY BE RETURNED + +;DISK BUFFER. HOLDS ENOUGH 12-BIT BYTES IN 16-BIT WORDS TO MAKE 1024. 36-BIT WORDS +DSKBUF: .BLKW 3.*1024. + +;ROUTINE TO START DISK IF IT IS READY AND THERE IS A REQUEST. +DSKSTR: TST DSCREQ ;ANY REQUEST FROM 10? + BEQ 99$ ;NO, EXIT + CMP DSCCHK,#2561 + BNE 99$ ;CHECK WORD WRONG, DON'T TOUCH DISK + TST RQBACT ;PREVIOUS OPERATION FINISHED? + BEQ 10$ + BPT ;NO, MUST BE BUG IN 10? +10$: TSTB DSKCSR ;TEST IF READY FOR COMMAND TRANSMISSION + BPL 99$ ;NO, WAIT + CLR DSCDON ;YES, CLEAR 10/11 COMMUNICATION FLAGS + CLR DSCREQ + CLR RQBLNK ;SET UP RQB FROM 10'S PARAMETERS + MOV DSCCMD,RQBCMD + MOV DSCDRV,RQBDRV + MOV DSCCYL,RQBCYL + MOV DSCHED,RQBHED + MOV DSCSEC,RQBSEC + MOV #12.*256.,RQBWC + MOV #DSKBUF,RQBMA + CLR RQBMAH + CMP RQBCMD,#%DMWRT ;IF A WRITE COMMAND, MUST COPY DATA BUFFER + BNE 30$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVHD + .ENDR + .ENDR +30$: CLR DSKCTA ;GIVE ADDRESS OF RQB TO 2561 + MOV #RQBID,DSKCTB + SETOM RQBACT ;TELL INTERRUPT LEVEL INTERRUPT EXPECTED + MOV #%DCCMD+%DCCIE,DSKCSR ;GIVE COMMAND, ENABLE COMPLETION INTERRUPT +99$: RET ;DONE + +;CALL HERE WHEN DISK INTERRUPTS +DSKBRK: PUSH ;SAVE ALL REGISTERS + MOV DSKCSR,A + BIT #%DCPCY,A ;POWER CYCLED? + BNE 5$ ;YES, RESET CONTROLLER AND IGNORE INTERRUPT + BIT #%DCMNT,A ;NO, MAINTAINENCE MODE + BEQ 4$ ;OK + BPT ;BLEAH, MUST BE BROKEN + BR 5$ + +4$: BIT #%DCDER,A ;WHAT ABOUT UNIBUS ERROR + BNE 10$ + BPT +5$: MOV #%DCRST,DSKCSR ;RESET THE CONTROLLER AND TURN OFF INTERRUPTS + TST RQBACT ;DID THIS LOSE IN THE MIDDLE OF A DISK OPERATION? + BEQ 99$ ;NO, DISMISS + MOV #%DFRST,A ;YES, GIVE ERROR STATUS + CLR B + BR 20$ + +10$: BIT #%DCCPL,A ;TEST FOR COMMAND COMPLETION + BPL 99$ ;NO, IGNORE INTERRUPT + MOV DSKCRA,A ;GET COMPLETION STATUS + MOV DSKCRB,B + MOV #%DCACK+%DCCIE,DSKCSR ;ACKNOWLEDGE COMPLETION, ENABLE MORE INTERRUPTS + TST RQBACT ;EXPECTED? + BEQ 99$ ;NO, IGNORE + BIT #%DAPON,A ;POWER-UP INDICATION? + BNE 99$ ;FOR NOW, IGNORE IT + BIT #%DACQE+%DANXM+%DAPAR,A + BEQ 30$ ;OK, NO COMMAND-QUEUE ERROR + MOV #%DCRST,DSKCSR ;RESET CONTROLLER (I DON'T KNOW IF IT NEEDS IT) +20$: MOV A,DSCFLT ;COMMAND-QUEUE ERROR, GIVE STATUS TO PDP10 + MOV B,DSCSTS + BR 80$ + +30$: CLR DSCFLT ;CLEAR HIGH BYTE + MOVB RQBFLT+1,DSCFLT ;PICK UP FAULT CODE, PUT IN LOW BYTE + BEQ 35$ ;IF FAULT CODE IS NON-ZERO, THE THING MAY BE FROZEN, + MOV #%DCRST,DSKCSR ;SO RESET IT. OTHERWISE ERROR SEEMS TO HAPPEN OVER AND OVER +35$: MOV RQBSTS,DSCSTS ;GIVE STATUS TO PDP10 + MOV RQBCYL,DSCCYL ;STORE BACK DISK ADDRESS, MAY BE USEFUL TO PDP10 + MOV RQBHED,DSCHED + MOV RQBSEC,DSCSEC + BIT #%DMRED,RQBCMD ;IF COMMAND WAS READ, COPY BUFFER BACK + BEQ 80$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVDH + .ENDR + .ENDR +80$: SETOM DSCDON ;SIGNAL PDP10 OPERATION IS COMPLETE + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + CLR RQBACT ;NO LONGER EXPECTING COMPLETION ON THE RQB +99$: POP ;RESTORE REGISTERS AND EXIT INTERRUPT + RTI +.ENDC ;T300P + + .SBTTL SET LINE PARAMETERS + +;LINE INDEX IN I +;DH11 PARAM REG IN A +;BUFFER SIZE IN B + +SPARAM: CMP I,#NFTTY + BGE 1$ + BPT +1$: CMP I,#LASTTY + BLE 2$ + BPT +2$: CMP B,#1. ;MINIMUM BUFFER SIZE ONE CHARACTER + BGE 3$ + MOV #1.,B +3$: CMP B,#MAXBSZ ;MAXIMUM BUFFER SIZE CHARACTERS + BLE 4$ + MOV #MAXBSZ,B +4$: MOV B,BUFSIZ(I) ;SET AMOUNT OF BUFFER TO BE USED FROM NOW ON + MOV HDWR(I),H ;(BUT NO LONGER DO WE ATTEMPT DYNAMIC BUFFER ALLOCATION) + CMP H,#NLDHHX + BHI 5$ + MASK 5 ;LINE IS A DH11, HAVE TO SET LINE PARAM REG + MOV DHLSEL(I),@DHSCR(H) ;SELECT THE LINE + MOV A,@DHLPR(H) ;GIVE LINE-PARAMETER REG TO DH11 + UNMASK +5$: MOV A,LPRVAL(I) ;STORE LPR IN CASE SOMEONE IS CURIOUS + RET + + .SBTTL DH11 INPUT INTERRUPT + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHIBK: MOV (H),H ;PICK UP HARDWARE INDEX + PUSH +1$: MOV @DHNRC(H),A ;RECIEVE A CHARACTER + BPL DHIEX ;EXIT INTERRUPT IF NO MORE CHARS + MOV A,I ;EXTRACT LINE NUMBER + SWAB I + BIC #177760,I + ASL I + ADD DHTYNO(H),I +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 1$ +.ENDC + CALL @TTYIPC(I) ;CALL LINE HACKER + BR 1$ ;AND CHECK FOR MORE + +DHIEX: POP + RTI + +;NORMAL DH11 INPUT + +DHNRMI: BIT #%DXPAR,A + BEQ 1$ ;IGNORE IF PARITY ERROR +10$: RET +1$: BIT #%DXBRK,A ;IF BREAK, + BEQ RCV + TST AUTOSP(I) ;AND LINE WANTS AUTOSPEED-ON-BREAK FEATURE + BPL 10$ +ASPMD: MOV #DHASP,TTYIPC(I) ;PUT IT IN AUTOSPEED MODE + MOV DHLSEL(I),@DHSCR(H) ;AND SET HARDWARE TO 1200 BAUD + MOV #023103,@DHLPR(H) + RET + +;CHAR IN A RECEIVED FROM LINE IN I +RCV: BIC #177400,A ;8-BIT CHAR RECEIVE +RCV.FW: TST NO.ITS ;ENTER HERE FOR FULL WORD RECEIVE + BEQ 10$ +21$: MOV #DWNMSG,A ;ITS DOWN, GIVE MESSAGE +12$: CALL GIVMSG + RET + +10$: MOV #TYIRNG,B + CMP RINGCT(B),#TYIRSZ-2 + BGT 11$ + CALL PUT ;FIRST PUT THE CHARACTER + MOV I,A + ASR A + CALL PUT ;THEN THE TENNISH LINE NUMBER + RET + +11$: MOV #IBOMSG,A ;INPUT BUFFER OVERFLOW + BR 12$ + +.IFNZ NMPTYS ;HANDLE INPUT FROM THE MULTIPLEXOR LINE +MPXINP: TST MPXENB + BEQ RCV + MOV MPXSEL,I ;CURRENT INPUT LINE + TSTB A ;SPECIAL CHAR? + BMI 1$ + JMP @TTYIPC(I) ;NO, RECEIVE ON APPROP LINE + +1$: MOV A,I ;SPECIAL CHAR, EXTRACT LINE# + BIC #177700,I +;FOLLOWING FEATURE COMMENTED OUT SINCE IT CAUSES 11 TO LOOP +; WHEN NEXT INPUT ARRIVES -- NOT OBVIOUS HOW TO FIX. +; CMP I,#77 ;SELECT NON-MULTIPLEX INPUT? +; BEQ 3$ ;YES, DO SO + ASL I + ADD #NFMPTY,I + CMP I,#LASTTY + BHI 2$ ;OUT OF RANGE, IGNORE + MOV I,MPXSEL ;INPUT SELECT, SAVE LINE# +2$: RET + +3$: MOV #MPXIDX,MPXSEL ;SELECT PASS THROUGH + RET +.ENDC ;NMPTYS + +;AUTOSPEED MODE COMES HERE WHEN CHAR RECIEVED + +DHASP: BIC #177400,A ;CLEAR FRAMING ERR, ETC. + BEQ ASP10 ;11 0'S = 110 BAUD + CMP A,#200 ;7 0'S, 1 = 150 BAUD + BEQ ASP15 + CMP A,#170 ;3 0'S, 4 1'S, 0 = 300 BAUD + BEQ ASP30 + CMP A,#370 ;300/600 IS NOW RUBOUT, NOT I + BEQ ASP36 + CMP A,#146 ;1 0, 2 1'S, 2 0'S, ... = 600 + BEQ ASP60 + CMP A,#340 ;5 0'S, 3 1'S ? MYSTERY TO ME + BEQ ASP60 + CMP A,#015 ;CR = 1200 + BEQ ASP120 + CMP A,#215 ;CR WITH EITHER PARITY + BEQ ASP120 + MOV A,#. ;SAVE GARBAGE FOR DEBUGGING + RET ;SOMETHING ELSE, IGNORE + +ASP10: MOV #006307,A ;110 IN, 110 OUT, NO PARITY, 8 BITS, EXTRA STPBT + MOV #5,B + MOV #12200,-(SP) + BR ASPX + +ASP15: MOV #012503,A ;150 IN, 150 OUT, NO PARITY, 8 BITS + MOV #7,B + MOV #13300,-(SP) + BR ASPX + +ASP30: MOV #016703,A ;300 IN, 300 OUT, NO PARITY, 8 BITS + MOV #15.,B + MOV #14400,-(SP) + BR ASPX + +ASP36: MOV #020703,A ;300 IN, 600 OUT, NO PARITY, 8 BITS + MOV #30.,B + MOV #14100,-(SP) + BR ASPX + +ASP60: MOV #021003,A ;600 BAUD, NO PARITY, 8 BITS + MOV #30.,B + MOV #11100,-(SP) + BR ASPX + +ASP120: MOV #023103,A ;1200 IN, 1200 OUT, NO PAR, 8 BITS + MOV #60.,B + MOV #15500,-(SP) + BR ASPX + +ASPX: CALL SPARAM ;SET BUFFER SIZE AND HARDWARE SPEED + MOV I,A ;SET UP SET-SPEED COMMAND TO -10 + ASR A + BIS (SP)+,A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 11$ + INC HNGSIG ;INDICATE STATUS WAITING +11$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS + MOV #ASPACK,A ;ACKNOWLEDGE TO USER THAT HE WON + CALL GIVMSG + DEC TYPING(I) ;IF NO WAKEUP FOR 10, HIT CALL WHEN TYPING DONE + MOV NRMIPC(I),TTYIPC(I) ;AND TAKE LINE OUT OF AUTOSPEED MODE + RET + + .SBTTL DH11 OUTPUT INTERRUPTS + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHOBK: MOV (H),H ;GET HARDWARE UNIT NUMBER + BIT #DHSNXM,@DHSCR(H) ;IS THIS INTERRUPT DUE TO NXM? + BEQ 1$ + BPT ;YES +1$: BIC #DHTDON,@DHSCR(H) ;HARDWARE KLUDGE TO MAKE INTERRUPTS WIN + PUSH + MOV DHOAC(H),C ;SEE WHICH BAR BITS HAVE TURNED OFF + BIC @DHBAR(H),C + BIC C,DHOAC(H) + MOV DHTYNO(H),I + ADD #15.*2,I +2$: BIT DHLBIT(I),C + BEQ 4$ +.IFNZ NMPTYS + CMP I,#MPXIDX + BNE 3$ + CALL MPXDON +.ENDC ;NMPTYS +3$: +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 4$ +.ENDC + CALL XMTDON +4$: SUB #2,I + CMP I,DHTYNO(H) + BGE 2$ +DHOEX: POP + RTI + +XMTDON: TST TYPING(I) ;HERE WHEN OUTPUT FINISHES + BGT 1$ ;BRANCH IF -10 WANTS TO KNOW ABOUT IT + BEQ 3$ ;BRANCH IF NOTHING TO DO + MOV #32,A ;SEND A CALL + CALL RCV + BR 3$ + +1$: MOV I,A + ASR A ;PUT TENNISH LINE NUMBER INTO RING + MOV #TYORNG,B ;MAIN PROG LEVEL WILL LATER TELL -10 + CALL PUT +3$: CLR TYPING(I) + RET + +.IFNZ NMPTYS ;OUTPUT DONE ON MULTIPLEXED LINE +MPXDON: PUSH + TST MPXOAC + BGE 1$ + NEG MPXOAC ;SENT HEADER, NOW SEND DATA + MOV MPXOLN,A + MOV MPXPNT(A),D + MOV MPXNBT(A),C + CLR MPXNBT(A) + CALL @STROUT(H) + BR 9$ + +1$: MOV MPXOLN,I ;OUTPUT IS DONE ON THAT LINE NOW + ADD #NFMPTY,I + CALL XMTDON + CLR MPXOAC ;MPX IDLE + CALL STRMPX ;LOOK FOR NEW STUFF TO DO +9$: POP + RET +.ENDC ;NMPTYS + + .SBTTL DL11 INTERRUPTS + +.REPT NDLS +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +.ENDR + +DLIBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + PUSH + MOV @DLKB(H),A ;GET RECEIVED CHARACTER + MOV DLTYNO(H),I ;GET LINE NUMBER RECEIVED ON +.IFNZ DTE20P + BNE 2$ ;ONLY T00 CAN RETURN TO KLDCP + BIT #20000,A ;IF BREAK KEY IS HIT + BEQ 1$ + SETOM KLDCPF ;USER WANTS TO RETURN TO KLDCP + BR DLBKEX ;FOR ONE COMMAND LINE + +1$: TST DDTMOD ;IF IN DDT MODE, + BEQ 2$ + BIC #-200,A ; HANDLE INPUT DIFFERENTLY + MOV A,DDTCHR + BR DLBKEX + +2$: +.ENDC ;DTE20P + CALL @TTYIPC(I) +DLBKEX: POP + RTI + +DLOBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + TST DLOAC(H) + BEQ DLBKX1 ;NOT SUPPOSED TO BE TYPING OUT, IGNORE INT + DEC DLBC(H) ;GOT ANY MORE CHARACTERS? + BLT DLBKX2 ;NO, GO GIVE OUTPUT DONE + MOV DLCA(H),-(SP) ;YES, GIVE NEXT CHARACTER + MOVB @(SP)+,@DLPB(H) + INC DLCA(H) +DLBKX1: POP H + RTI + +DLBKX2: PUSH ;OUTPUT DONE + MOV DLTYNO(H),I ;GET TTY INDEX OF INTERRUPTING LINE + CLR DLOAC(H) ;OUTPUT NO LONGER ACTIVE ON THIS LINE + CALL XMTDON + BR DLBKEX + + .SBTTL CLOCK INTERRUPT + +;NOTE - IT IS IMPORTANT THAT THIS BE AT A HIGHER INTERRUPT LEVEL THAN THE CHAOS NET +CLKBRK: SETOM WAKE ;WAKE UP MAIN LOOP +.IFNZ GOULDP + PUSH @#PS ;CHECK GOULD LPT + CALL GLPBRK ;(LOSES INTERRUPTS) + DEC GLPTIM ;TIME TO CHECK GOULD LPT? + BGT 13$ ;NOT YET + MOV #10.*60.,GLPTIM + BIT #%GSNRD,@#GLPCSR ;YES, LOSING? + BNE 14$ ;PROBABLY + CLR GLPERR ;PROBABLY NOT + BR 13$ ;(CAN'T TELL FOR SURE IF %GCON NOT DONE) + +14$: MOV @#GLPCSR,GLPERR ;LPT LOSING, TELL 10 + CALL GLPRST ;AND MAKE SURE BUFFERS DON'T CHOKE UP +.ENDC ;GOULDP +13$: PUSH +.IFNZ NDMS ;MODEM SCANNER GETS SHUT OFF SOMEHOW + CLR A ;loop over the DM11s, turning them on + MOV #NDMS,B +259$: BIT #DMSCN,@DMCSR(A) + BEQ 14$ + BIT #DMIEN,@DMCSR(A) + BNE 15$ +14$: MOV #DMSCN+DMIEN,@DMCSR(A) ;ENABLE SCANNER INTERRUPTS +15$: TST (A)+ ;next DM11 + SOB B,259$ ;until all DM11s done + +.ENDC ;NDMS +.IFNZ CHAOSP ;WAKE-UP OUTPUT LINKS IN RE-TRANSMIT DELAY + MOV #CHXCHS,I +50$: MOV CHOHWR(I),A ;ADDRESS OF HARDWARE CSR + TST CHOSTS(I) ;IF ZERO, IS IDLE, DON'T WANT INTERRUPT ENABLE + BEQ 51$ ;NOTE THAT THIS RUNS MASKED HIGHER THAN CHAOS INT LVL + BIS #%CATEN,(A) ;RE-ENABLE INTERRUPT IF OFF +51$: +.IFNZ CHSBTB + BIT #%CATDN,(A) ;TRANSMIT-DONE? + BNE 59$ + INC CHSIDL(I) ;NO, KEEP TIME-OUT + CMP CHSIDL(I),#60. ;IF TRANSMIT-DONE STUCK OFF FOR 1 SECOND, + BLO 59$ + MOV #%CARST,(A) ; THEN RESET THE INTERFACE +; MOV #%CAREN+%CATEN,(A) ;INTERRUPT ENABLES WILL TURN THEMSELVES BACK ON IF NECESSARY! + INC CHSRST(I) ;COUNT NUMBER OF TIMES HAD TO DO THIS +59$: +.ENDC ;CHSBTB +.IFG CHAOSP-1 + TST (I)+ + CMP I,#CHXCHS+CHAOSP+CHAOSP + BLO 50$ +.ENDC ;CHAOSP-1 + DEC PULSAR ;TIME TO GENERATE TEST PACKET TO CHAOS NET? + BGT 66$ ;NOT YET + MOV PULSON,PULSAR ;RE-INITIALIZE COUNTER +.REPT CHAOSP ;YES, AWAKEN ALL TRANSMIT INTERRUPT SIDES + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IFNZ TEN11P + TST CHOSTS+CHXT11 ;AWAITING BUFFER FROM 10? + BNE 65$ ;YES, COUNT TIMEOUT + CLR T11TIM ;NO, RESET TIMEOUT +65$: INC T11TIM +.ENDC ;TEN11P +66$: DEC 4SEC ;TIME FOR 4-SECOND CLOCK? + BGT 90$ + MOV #4*60.,4SEC ;YES + MOV #*2,I ;INCREMENT ROUTING COSTS +71$: TST SBNTYP(I) ;THIS GUY'S COSTS SUPPOSED TO INCREMENT? + BNE 72$ ;NOPE + CMP SBNCST(I),#1000 ;DON'T INCREMENT TOO HIGH AND OVERFLOW + BHIS 72$ + INC SBNCST(I) ;YEP +72$: SUB #2,I + BPL 71$ + DEC 15SEC ;TIME FOR 15-SECOND CLOCK? (REALLY 16) + BGT 90$ + MOV #4,15SEC ;YES +.REPT CHAOSP ;TELL CABLES TO BROADCAST %CORUT PACKETS + SETOM CHXRTF+CHXCHS+<2*.RPCNT> + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ ETHERP, SETOM CHXRTF+CHXETH ;TELL ETHERNET TO BROADCAST ROUTING +90$: ;CAN'T DO IT NOW BECAUSE WRONG INTERRUPT LEVEL +.ENDC ;CHAOSP +.IF DF NDVRBF + INC DVRTIM ;TIME OUT DOVER CONNECTION + CMP DVRTIM,#15.*60. ;IF IDLE FOR 15 SECONDS, FLUSH + BLO 15$ + CLR DVRHST + CLR DVRMSK +15$: INC DVRRTR ;COUNT UP RETRANSMISSION COUNTER +.ENDC ;NDVRBF +.IFNZ NDMS ;GOT ANY TTYS WITH MODEM CONTROL? + MOV #NFTTY,I ;CHECK FOR HANGUPS +16$: TST DIALED(I) ;HANGUP IN PROGRESS ON THIS LINE? + BPL 17$ ;NO + INC DIALED(I) ;YES, TIMED OUT? + BMI 17$ + CLR DIALED(I) ;YUP, LINE IS HUNG UP + MOV I,A ;TELL -10 ABOUT IT + ASR A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 18$ + INC HNGSIG ;INDICATE STATUS WAITING +18$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS +17$: ADD #2,I + CMP I,#LASTTY + BLO 16$ +.ENDC ;NDMS + POP + + ROR SWR ;LOW BIT OF SWITCHES => DDT + BCC CLKEX + BPT +CLKEX: RTI + .IFNZ NDMS + .SBTTL MODEM CONTROL + +;;; hack multiple DM interrupt vectors +.REPT NDMS +CONC DM,\.RPCNT+1, + 2*.RPCNT +.ENDR ;NDMS + + +DMBRK: PUSH + MOV (H),A ;get the device offset in A + MOV @DMCSR(A),I ;GET ASSOCIATED TTY INDEX + BIC #177760,I ;gives us channel (0-17) on this DM11 + ;; now add to get offset into table for any DM + MOV A,B ;device offset in B, is 2*device number + ASL B + ASL B + ASL B ;multiply by 8 for offset in B + ADD B,I ;add to I for offset for this channel + ASL I ;now get word offset in I by shifting + ;; get index into map between DM channels and TTY indices + MOV M2LMAP(I),I + BEQ 90$ ;EXIT IF THIS LINE NOT UNDER MODEM CONTROL +; TST @DMCSR(A) .SEE DMRNG +; BPL 10$ +; TST DIALED(I) ;RINGING. IS LINE DIALED UP ALREADY? +; BNE 10$ ;YES, NOT SUPPOSED TO BE RINGING +; MOV #LINENB+LINDTR,@DMLSR(A) ;ANSWER THE PHONE + +10$: BIT #LINCTS,@DMLSR(A) ;DO WE HAVE CLEAR-TO-SEND? + BEQ 20$ ;NO + TST DIALED(I) ;YES, WHAT WAS PREVIOUS STATE? + BEQ 13$ ;WAS OFF, THIS IS A DIALUP + BPL 90$ ;WAS ON, IGNORE + NEG DIALED(I) ;WAS HANGING UP, ABORT IT + BR 90$ + +13$: INC DIALED(I) ;LINE IS NOW DIALED UP + TST DMINI ;IF GETTING INITIAL STATE, + BNE 90$ ;DON'T HACK AUTOSPEED + TST AUTOSP(I) ;IF IT HAS AUTOSPEED, + BEQ 90$ + MOV HDWR(I),H ;HACK THAT + CALL ASPMD + BR 90$ + +20$: TST DIALED(I) ;CTS DROPPED + BMI 90$ ;ALREADY KNOWN ABOUT, IGNORE + MOV #-HNGDLY,DIALED(I) ;OTHERWISE START HANGUP TIMEOUT + +90$: BIC #DMDON,@DMCSR(A) ;RESTART SCANNER + POP + POP H + RTI +.ENDC ;NDMS + +.IFNZ GOULDP +.SBTTL GOULD PRINTER P.I. LEVEL + +GLPBRK: BIT #%GSBSY,@#GLPCSR + BEQ 1$ + RTI ;LPT BUSY, WAIT + +1$: BIT #%GSDON,@#GLPCSR + BNE 2$ + RTI ;LPT BUSY OTHER FLAVOR + +2$: PUSH + BIT #%GSERR,@#GLPCSR ;LPT LOSING? + BEQ GLPBR1 + CALL GLPRST ;YUP, RESET THE BUFFERS + MOV @#GLPCSR,GLPERR ;AND TELL 10 + +GLPOFF: CLR GLPOAC ;HERE TO STOP P.I. + MOV #%GCIOF,@#GLPCSR + MOV #5000.,A ;LPT SOMETIMES BUSY FOR A WHILE +1$: BIT #%GSBSY,@#GLPCSR ;HAVE TO WAIT SO TONER PUMPS WILL + BEQ 2$ ;REALLY TURN OFF + SOB A,1$ +2$: MOV #%GCOFF,@#GLPCSR +GLPEX: POP + RTI + +GLPFIN: MOV #%GBIDL,GB.STA(H) ;DONE WITH THIS BUFFER + MOV GB.NXT(H),H ;CHECK NEXT + MOV H,GLPOOP + +GLPBR1: MOV GLPOOP,H ;CHECK ON BUFFERS + CMP GB.STA(H),#%GBDMA ;FINISH DMA XFER? + BEQ GLPFIN ;YES + CMP GB.STA(H),#%GBWRT ;QUEUED OR ALREADY ACTIVE AT P.I.? + BLT GLPOFF ;NO, STOP + MOV #%GBPI,GB.STA(H) ;YES, ACTIVATE IT AT P.I. + TST GB.FF(H) ;NEED FF? + BEQ 1$ + MOV #%GCFF,@#GLPCSR ;YES + CLR GB.FF(H) + BR GLPEX + +1$: TST GB.NL(H) ;NEED BLANK LINES? + BEQ 2$ + DEC GB.NL(H) ;YES, GIVE ONE + MOV #%GCADV,@#GLPCSR + BR GLPEX + +2$: MOV H,B ;SET UP TEXT ADDR + ADD #GB.DAT,B + MOV GB.PNT(H),A ;SET UP TEXT WORD COUNT + NEG A + MOV A,@#GLPWC + MOV B,@#GLPCA ;START XFER + MOV #%GBDMA,GB.STA(H) ;FLAG BUFFER ACTIVE AT DMA LEVEL + BR GLPEX + +GLPRST: PUSH H + MOV #GLPBFF,H ;FLUSH ALL BUFFERS + MOV H,GLPOOP + MOV H,GLPOIP +3$: CLR (H)+ + MOV (H),H + CMP H,#GLPBFF + BNE 3$ + MOV #60.*10.,GLPTIM ;SET TIMEOUT + POP H + RET + +.ENDC ;GOULDP + +.IFNZ CHAOSP + + .SBTTL CHAOSNET ROUTINES + +;ALL ROUTINES ON THIS PAGE CALLED WITH INTERRUPTS MASKED, INDEX IN I. + +;REFILL FROM CHAOS INTERFACE +CHSRFL: BIS #%CAREN,@CHIHWR(I) ;TURN ON RECEIVER INTERRUPTS + RET ;WILL NOTICE INPUT LATER + +.IFNZ DL10P +;LOOPS BACK TO HERE WHEN DISCARDING A PACKET +DLCRF1: CMP (SP)+,(SP)+ ;POP + POP A + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + ;DROP INTO DLCRFL +;REFILL FROM DL10 +DLCRFL: CALL DLCCHK ;SEE IF DL10 IS DISABLED + BNE 99$ ;BRANCH IF YES + MOV #2,A ;CHECK BOTH 10 TO 11 BUFFERS SO CAN'T GET OUT OF PHASE WITH 10 +10$: CMP DLCSS1(A),#1 ;10 SAYS BUFFER READY? + BEQ 11$ ;YES + SUB #2,A ;NO, TRY NEXT + BPL 10$ + BR 99$ ;NONE READY + +11$: PUSH A ;SAVE CURRENT 10 TO 11 BUFFER + ADD #DLCSP1,A ;OUTPUT READY, GET IT + MOV #DLCIBF,B ;COPY INTO BUFFER +.REPT PKHDW ;FIRST GET HEADER + MOV (A),(B)+ +.ENDR + PUSH + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS DLCRF1 ;BRANCH IF PACKET NO GOOD + POP + PUSH C + SUB CHIHDL(I),C ;GET NUMBER OF DATA WORDS TO FOLLOW + CALL MOVHD ;MOVE THOSE WORDS + POP ;RESTORE LENGTH, 10 TO 11 BUFFER NUMBER + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +;TRANSMIT TO DL10 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +DLCXMT: CALL DLCCHK ;DL10 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + MOV DLCRBN,A ;GET CURRENT 11 TO 10 BUFFER NUMBER + CMP DLCRS1(A),#1 ;BUFFER READY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXDLC,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHILNG(D),C ;AND LENGTH + MOV CHIBFP(D),D + MOV A,H ;GET POINTER TO DL10 MAGIC IDPB WORD + ADD #DLCRP1,H + CALL MOVDH ;COPY WORDS INTO PDP10 + INC DLCRS1(A) ;SIGNAL DATA AVAILABLE TO PDP10 + BIS #DLX10I,DLXCSR ;AND INTERRUPT IT + MOV DLCNXT(A),DLCRBN ;SWITCH BUFFERS +70$: JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXDLC ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;CALL HERE WHEN DL10 INTERRUPTS, CLOBBERS ALL. +DLCWAK: MASK 5 + TST CHOSTS+CHXDLC ;DL10 HUNG ON TRANSMIT? + BEQ 10$ + MOV #CHXDLC,I ;YES, WAKE IT UP + CALL DLCXMT +10$: TST CHISTS+CHXDLC ;DL10 INPUT ACTIVE? + BNE 20$ + MOV #CHXDLC,I ;NO, TRY TO GET SOME + CALL DLCRFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +;RETURN 'NE' IF DL10 IS DISABLED, BASHES NOTHING. +DLCCHK: TST DLXOFF + BNE 99$ + TST NO.ITS + BNE 99$ + TST DLCINI ;RE-INITIALIZE? + BEQ 99$ ;NO, EVERYTHING IS OK. + CLR DLCRBN ;YES + TST CHOSTS+CHXDLC ;WAS OUTPUT HUNG ON DL10? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON DL10 + MOV #CHXDLC,I + CALL CHSODN + POP +90$: CLR DLCINI ;SIGNAL INIT DONE, RETURN 'EQ' +99$: RET +.ENDC ;DL10P + +;FAST BLOCK MOVE +;THESE CAN MOVE AT MOST 256. WORDS + +;MOV (H),(D)+ +;SOB C,.-2 +MOVHD: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (H),(D)+ + .ENDR + RET + +;MOV (D)+,(H) +;SOB C,.-2 +MOVDH: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (D)+,(H) + .ENDR + RET + +.IFNZ TEN11P +;REFILL FROM TEN-11 INTERFACE +T11RFL: CALL T11CHK ;CHECK FOR DISABLE + BNE 99$ ;BRANCH IF DISABLED + MOV T11IBP,A + TST T11IBA ;WAS INPUT BUFFER IN USE? + BEQ 10$ + CLR (A)+ ;YES, INDICATE BUFFER IS NOW EMPTY + CLR (A) + CLR T11IBA + ADD #T11BFL-2,A ;ADVANCE POINTER + CMP A,#T11IBE + BLO 7$ + MOV #T11IBF,A +7$: MOV A,T11IBP +10$: TST (A) ;INPUT BUFFER CONTAIN A PACKET? + BEQ 99$ ;NO + SETOM T11IBA ;YES, INPUT BUFFER NOW ACTIVE + ADD #8,A ;GET INPUT FROM PDP10 + MOV A,CHIBFP+CHXT11 ;AS CURRENT INPUT BUFFER + CALL CHSIHD ;PROCESS THE HEADER + BVS T11RFL ;BRANCH IF PACKET NO GOOD + PUSH ;COMPUTE CHECKSUM BEFORE SWABBING + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + SUB #PKFCMS+1,PKFC(A) ;DECREMENT FWD COUNT (IS HIGH END OF WORD) + ;FWD COUNT HAS TO BE PUT BACK FOR CHECKSUM COMPUTATION +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11IBP,A ;NOW COMPARE CHECKSUM + CMP H,4(A) + BNE 30$ + CMP D,6(A) + BNE 30$ + POP + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +30$: POP ;CHECKSUM ERROR + INC T11CKE ;COUNT CHECKSUM ERRORS + BR T11RFL ;AND IGNORE PACKET + +;TRANSMIT TO TEN11 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +T11XMT: CALL T11CHK ;TEN11 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + TST @T11OBP ;OUTPUT BUFFER EMPTY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXT11,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHIBFP(D),B + MOV CHILNG(D),C ;AND LENGTH + MOV PKNBYT(B),A + BIT #1,A ;IF ODD NUMBER OF BYTES, CLEAR THE EXTRA ONE + BEQ 5$ + BIC #PKNBMS,A + ADD B,A + CLRB PKDAT-1(A) ;NOTE, AT THIS POINT BYTES ARE SWAPPED +5$: MOV T11OBP,A ;COPY INTO TEN11 OUTPUT BUFFER + ADD #8,A + PUSH +10$: MOV (B)+,(A)+ + SOB C,10$ + MOV (SP),C ;NOW COMPUTE CHECKSUM + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + BCS 11$ + CLR (A)+ ;IF ODD NUMBER OF 16-BIT WORDS, CLEAR THE EXTRA ONE +11$: CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + MOV T11OBP,A + ADD #8,A +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11OBP,A ;STORE CHECKSUM INTO OUTPUT BUFFER + MOV H,4(A) + MOV D,6(A) + POP + SETOM (A) ;SIGNAL PRESENCE OF PACKET TO PDP10 + ADD #T11BFL,A ;ADVANCE POINTER + CMP A,#T11OBE + BLO 30$ + MOV #T11OBF,A +30$: MOV A,T11OBP +70$: CLR T11TIM ;NO TIMEOUT, 10 IS TAKING PACKETS + JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXT11 ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;WHACK YOUR TEN11 +T11WAK: MASK 5 + MOV #CHXT11,I + CALL T11CHK ;IS 10 UP? + BNE 30$ ;IT'S DOWN, PUNT IT + TST CHOSTS(I) ;TEN11 HUNG ON TRANSMIT? + BEQ 10$ + CALL T11XMT ;YES, WAKE IT UP +10$: TST CHISTS+CHXT11 ;TEN11 INPUT ACTIVE? + BNE 20$ + MOV #CHXT11,I ;NO, TRY TO GET SOME + CALL T11RFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +30$: TST CHOSTS(I) ;TRANSMITTING TO DEAD TEN-11? + BEQ 20$ + CLR T11TIM ;YES, FLUSH IT + CALL CHSODN + BR 20$ + +;CHECK TEN-11 INTERFACE, DO RESET IF NECESSARY, RETURN 'NE' IF DISABLED. +;SMASHES NOTHING. +T11CHK: CMP T11TIM,#5*60. ;10 TAKING 5 SECONDS TO RESPOND? + BLO 5$ + SETOM T11I10 ;YES, DECLARE IT DOWN, REINITIALIZE PROTOCOL +5$: TST T11I10 ;IS 10 DONE INITIALIZING? + BNE 99$ ;NO, DO NOTHING + TST T11I11 ;ARE WE SUPPOSED TO INITIALIZE? + BEQ 99$ ;NO, IT'S OK + MOV #T11OBF,T11OBP ;YES, REINITIALIZE POINTERS + MOV #T11IBF,T11IBP + PUSH A + MOV #T11OBF,A ;INITIALIZE INPUT AND OUTPUT BUFFER HEADERS +10$: CLR (A)+ ;CLEAR INTER-MACHINE SIGNAL WORD + CLR (A)+ + ADD #T11BFL-4,A ;SKIP THE REMAINING WORDS + CMP A,#T11IBE + BLO 10$ + CLR T11IBA ;IDLE THE INPUT + POP A + TST CHOSTS+CHXT11 ;WAS OUTPUT HUNG ON TEN11? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON TEN11 + MOV #CHXT11,I + CALL CHSODN + POP +90$: CLR T11I11 ;SIGNAL INIT DONE, RETURN 'EQ' + CLR T11I11+2 +99$: RET +.ENDC ;TEN11P + +;THIS ROUTINE PROCESSES THE HEADER OF PACKET IN INPUT BUFFER FOR SOURCE I +;RETURN DESTINATION OUTPUT SINK INDEX IN B (-1 IF THIS IS FOR US (PDP11 ITSELF)), +;PACKET BUFFER POINTER IN A, AND LENGTH IN WORDS IN C. +;RETURNS WITH OVERFLOW SET IF PACKET IS DISCARDED BECAUSE OF +;TOO MUCH FORWARDING, BAD ADDRESS, TOO BIG, CRUFTY, ETC. +;OTHERWISE RETURNS WITH MINUS INDICATOR SET IF PACKET DIRECTED TO 11. +CHSIHD: ADD #1,NPKSI(I) ;COUNT PACKETS IN FROM THIS SOURCE + ADC HPKSI(I) + MOV CHIBFP(I),A ;POINTER TO PACKET + TSTB (A) ;CHECK FOR MUPPET + BNE CHSIHB ;DISCARD, WE DON'T SUPPORT THEM + MOV #PKHDW,CHIHDL(I) ;SET HEADER LENGTH + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + BCS CHSIHB ;BRANCH IF FORWARDING LOOP + MOV PKNBYT(A),C ;GET BYTE COUNT + BIC #PKNBMS,C + CMP C,#DATMAX + BHI CHSIHB ;TOO LONG, LOSES + INC C ;MAKE WORD COUNT + ASR C + ADD CHIHDL(I),C ;ADD IN LENGTH OF HEADER + MOV C,CHILNG(I) ;SAVE FOR LATER USE + ;; NOW ROUTE THIS PACKET + MOV #-1,B ;MAGIC INDEX MEANING "MYSELF" + MOV PKDHST(A),D ;GET DESTINATION ADDRESS + ;HERE WE HAVE HAIR FOR MULTIPLE CHAOSNETS +.REPT CHAOSP + CONC ,\.RPCNT ;ADDRESSED TO PDP11 ITSELF? + BEQ 50$ ;YES, LET CHSRUN HANDLE IT LATER +.ENDR ;CHAOSP + CMPB PKOP(A),#%CORUT ;ROUTING INFO PACKET? + BEQ 40$ ;YES, ADDRESS TO PDP11 + TST USECBL ;SUPPOSED TO USE CABLE EVEN TO TALK TO SELF? + BEQ 20$ + CMP I,#CHXCHS ;YES, IS THIS COMING FROM CABLE? + BHIS 20$ ;YES, ROUTE REGULAR WAY + MOV #CHXCHS,B ;NO, SEND TO SELF ON FIRST CABLE + MOV #CHAD0,D + BR 39$ + +20$: MOVB PKDHST+1(A),B ;GET SUBNET ADDRESSED TO + CMP B,#NSUBNT + BLO 21$ + CLR B ;OUT OF RANGE, USE 0 +21$: ASL B ;MAKE INDEX INTO SUBNET TABLES + TST SBNTYP(B) ;IS THIS A DIRECT HARDWARE CONNECTION? + BGT 38$ ;YES, SEND TO IT + MOV SBNADR(B),D ;NO, GO VIA GATEWAY + BEQ CHSIRF ;HAVEN'T GOT A GATEWAY, AND BROADCAST CODE NOT WORKING YET + MOVB SBNADR+1(B),B ;GET SUBNET GATEWAY IS ON + ASL B ;MAKE INDEX INTO TABLES + CMP B,#NSUBNT*2 + BHIS CHSIRF ;OUT OF RANGE, CAN'T GET THERE FROM HERE + TST SBNTYP(B) ;IS THIS A DIRECT CONNECTION? + BLE CHSIRF ;NO, CAN'T GET THERE FROM HERE (SHOULDN'T HAPPEN!) +38$: MOV SBNADR(B),B ;GET SINK INDEX +39$: MOV D,CHICBA(I) ;STORE CABLE ADDRESS OF IMMEDIATE DEST (GATEWAY) +.IIF NDF NDVRBF, 50$: ;IF NO DOVER, ALL TO-11 PACKETS COME HERE +40$: MOV B,CHIOUX(I) ;STORE SINK INDEX, SET INDICATORS + RET ;NOTE THAT MOV CLEARS OVERFLOW + +.IF DF NDVRBF +50$: CMP PKDIND(A),DVRLIX ;DIRECTED TO DOVER? + BNE 40$ ;NO, TO 11 + CMP PKSHST(A),DVRHST + BNE 40$ ;NOT DOVER-CONNECTED HOST + CMP PKSIND(A),DVRIDX + BNE 40$ ;RIGHT HOST, WRONG PROCESS + MOV #CHXDVR,B ;ROUTE PACKET TO DOVER GATEWAY + BR 40$ +.ENDC ;NDVRBF + +;HERE FOR ROUTING FAILURE. METER, RETURN WITH OVERFLOW SET. +CHSIRF: INC NPKSRF + MOV B,RFSBNT ;SAVE 2* SUBNET TRYING TO GET TO + ;FALL INTO CHSIHB +;HERE WHEN CHSIHD SEES A GARBAGE PACKET. RETURN WITH OVERFLOW SET. +CHSIHB: ADD #1,NPKSBD(I) ;GOD-DAMN BRAIN-DAMAGE + ADC HPKSBD(I) + SEV + RET + +;SWAB PACKET COMING FROM PDP-10 OR ETHERNET (BYTES LEFT TO RIGHT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB10: BMI CHSSWB ;SWAB IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ CHSSWB ;PDP11 OR CHAOSNET, SWAB IT OUT +5$: RET ;PDP10 OR ETHERNET, LEAVE ALONE + +;SWAB PACKET COMING FROM PDP-11 OR CHAOSNET (BYTES RIGHT TO LEFT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB11=. + BMI 5$ ;RETURN IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ 5$ ;PDP11 OR CHAOSNET, LEAVE ALONE + ;PDP10 OR ETHERNET, SWAB IT OUT + ;DROPS THROUGH INTO CHSSWB +;THIS ROUTINE SWABS THE PACKET FOR THE SOURCE IN I. +;CALLED WITH NUMBER OF WORDS IN PACKET IN C. +;CLOBBERS A, C, AND D. +;SUITABLE FOR CALLING RIGHT AFTER CHSIHD RETURNS. +CHSSWB: MOV CHIBFP(I),A ;ADDRESS OF PACKET + SUB CHIHDL(I),C ;GET LENGTH OF DATA AREA IN WORDS + BLE 99$ ;EMPTY + MOVB PKOP(A),D ;GET OPCODE + BPL 5$ ;BRANCH IF NON-DATA + BIT #100,D ;CHECK FOR BINARY DATA + BEQ 10$ ;NO, GO SWAB +99$: RET + +5$: TSTB CHSBIN(D) ;CONTROL, LOOK UP OPCODE + BNE 99$ ;BINARY, NO SWAB +10$: ADD CHIHDL(I),A ;POINT TO DATA AREA OF BUFFER + ADD CHIHDL(I),A ;BYTES, WATSON, BYTES! + SUB #PKTMXW,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO SWAB TABLE + .REPT PKTMXW + SWAB (A)+ + .ENDR + RET + +;BYTE TABLE INDEXED BY OPCODE, NON-ZERO IF BINARY +;BINARY OPERATIONS ARE 2 (%COOPN), 7 (%COSTS), 10 (%CORUT) +CHSBIN: .BYTE 0,0,2,0,0,0,0,7,10,0,0,0,0,0 + .BYTE 0,0 ;SPARES IN CASE MORE OPCODES ADDED + .EVEN + +;TRANSMIT PACKET FROM INPUT SOURCE I TO OUTPUT SINK, IN B. +;SMASHES ALL REGISTERS. CHISTS(I), CHIOUX(I), CHICBA(I) MUST BE ALREADY SET UP. +CHSOUT: TST B ;THIS DESTINED TO PDP11? + BMI CHSOUX ;YES, LET CHSRUN PICK IT UP LATER + TST CHOSTS(B) ;IS SINK BUSY? + BNE CHSOUX ;YES, CAN'T SEND NOW, WILL TRY AGAIN LATER + NEG CHISTS(I) ;NO, SET SOURCE STATUS TO CONNECTED + MOV I,CHOINX(B) ;CONNECT SINK TO SOURCE + MOV B,I ;SET UP SINK INDEX + ADD #1,NPKSO(I) + ADC HPKSO(I) + JMP @CHOXMT(I) ;GO START TRANSMISSION TO SINK + +;CALL HERE WHEN OUTPUT IS DONE ON SINK I. +CHSODN: CLR CHOSTS(I) ;IDLE THE SINK + PUSH I + MOV CHOINX(I),I ;GET CORRESPONDING SOURCE + CLR CHISTS(I) ;IDLE IT + CALL @CHIRFL(I) ;TELL SOURCE IT'S DONE, TRY TO GET MORE INPUT + POP I +CHSOUX: RET + +;CALL HERE AFTER EACH PACKET TRANSFER TO INITIATE AS MANY ADDITIONAL TRANSFERS +;AS POSSIBLE. BASHES ALL REGISTERS. ON DL10 AND TEN11, WE COULD ACTUALLY DO SEVERAL +;TRANSFERS BEFORE RETURNING. +CHSRUN: +.IF DF NDVRBF + CALL DVRRFL ;WAKE UP DOVER, MIGHT BE TIME TO RETRANSMIT +.ENDC ;NDVRBF + MOV #*2,I ;SCAN ALL INPUT SOURCES +CHSRN1: TST WAKE ;GIVE UP IF CLOCK HAS TICKED, LET TTYS RUN + BNE CHSOUX + TST CHISTS(I) ;IS THIS SOURCE LOOKING FOR A SINK? + BLE CHSRN3 +CHSRN2: MOV CHIOUX(I),B ;GET SINK IT WANTS TO SEND TO + BMI FOR11 ;BRANCH IF FOR PDP11 + TST CHOSTS(B) ;SINK AVAILABLE? + BNE CHSRN3 ;NO, LET INPUT SIT + CALL CHSOUT ;YES, ATTEMPT TO TRANSMIT + BR CHSRUN ;LOOK FOR MORE WORK + +CHSRN3: SUB #2,I ;NEXT INPUT SOURCE + BGE CHSRN1 + RET ;NOTHING LEFT TO DO + +FOR11: MOV CHIBFP(I),A ;PACKET FOR PDP11, CHECK IT OUT + MOVB PKOP(A),B ;GET OPCODE + CMP B,#%CORUT ;IF ROUTING INFO, GOBBLE IT + BEQ CHARUT + CMP B,#%CORFC ;ALL WE KNOW IS RFC TO CERTAIN CONTACT NAMES + BNE FOR11J ;BARF AT JUNK PACKETS + CALL SERVE ;RUN THE SERVER + BEQ FOR11X ;IT DIDN'T LIKE IT +FOR11R: PUSH ;INTERCHANGE SOURCE AND DESTINATION + MOV PKSHST(A),PKDHST(A) + MOV PKSIND(A),PKDIND(A) + POP + CALL CHSIHD ;ROUTE + BVS FOR11X ;NO GOOD, FLUSH (SOURCE IN PACKET WAS WRONG) + CALL SWAB11 ;SWAB IF GOING TO 11-INCOMPATIBLE DEST + BR CHSRN2 ;FIRE IT OFF (CHISTS IS ALREADY 1) + +FOR11X: CLR CHISTS(I) ;DISCARD THIS PACKET + CALL @CHIRFL(I) + BR CHSRUN ;LOOK FOR MORE WORK + +;PACKET FROM RANDOM PLACE DIRECTED TO 11, TELL HIM TO GO AWAY +FOR11J: CMP B,#%COLOS ;DON'T BARF AT LOS PACKETS + BEQ FOR11X + MOV #<%COLOS*400>,(A) + MOV #6$-5$-1,PKNBYT(A) + MOV #5$,B + MOV A,C + ADD #PKDAT,C +1$: MOVB (B)+,(C)+ + BNE 1$ + BR FOR11R ;SEND OFF THE LOS +5$: .ASCIZ /Packet unrecognized by gateway-11/ +6$: .EVEN + +;ROUTING PACKET +CHARUT: MOV CHILNG(I),C ;GET NUMBER OF DATA WORDS + SUB #PKHDW,C + ASR C ;MAKE NUMBER OF 2 WORD PAIRS + BEQ FOR11X ;MIGHT BE ZERO-LENGTH + MOV A,D + ADD #PKDAT,D ;POINT TO START OF PACKET'S DATA +61$: MOV (D)+,B ;GET SUBNET BEING TALKED ABOUT + CMP B,#NSUBNT ;ONE WE KNOW ABOUT? + BHIS 62$ ;NO, FORGET IT + ASL B ;MAKE WORD INDEX + TST SBNTYP(B) ;IS THIS AN AUTO ROUTING TYPE SUBNET? + BNE 62$ ;NO, DON'T MUNG OUR FIXED ROUTING INFO + CMP (D),SBNCST(B) ;COMPARE COSTS + BHI 62$ ;NEW ONE WORSE (IF EQUAL, SWITCH TO EQUALIZE LOAD) + MOV (D),SBNCST(B) ;SAVE BEST COST + MOV PKSHST(A),SBNADR(B) ;AND HOST ADDRESS THIS CAME FROM AS BEST BET +62$: TST (D)+ ;SKIP COST + SOB C,61$ + BR FOR11X ;DONE WITH PACKET + + .SBTTL CHAOS NET SERVERS + +;CALLED WITH PACKET IN A. +;MUST PRESERVE A,I. +;RETURN 'EQ' IF NO GOOD, 'NE' IF MODIFIED PACKET TO BE RETURNED TO SOURCE + +;CURRENTLY WE SERVE THE FOLLOWING CONTACT NAMES: +; STATUS - RETURNS ANS WITH THE NAME OF THE MACHINE, LATER WILL HAVE OTHER DATA +; PULSAR - RETURNS ANS WITH DATA OF 1 BYTE, VALUE OF PULSON AS AN ASCII DIGIT, +; I.E. "0" MEANS OFF, "1" MEANS 60 PER SECOND, ETC. +; IF CONTACT NAME IN RFC IS FOLLOWED BY A SPACE AND AN ASCII DIGIT, +; SETS PULSON TO THAT STATUS. +; DOVER - DOVER PROTOCOL TRANSLATOR + +;NOTE THAT WE DON'T USE THE MOST WINNING STRING COMPARE IN THE WORLD, +;THIS CODE ASSUMES IT DOESN'T MATTER WHAT HAPPENS IF AN RFC TO +;AN UNKNOWN CONTACT NAME IS DONE, AS LONG AS THE 11 DOESN'T CRASH. + +SERVE: MOV #SRVTBL,B ;ADDRESS OF SERVER TABLE +10$: MOV (B)+,D ;ADDRESS OF CONTACT NAME FOR THAT SERVER + BEQ 99$ ;EXIT IF TABLE EXHAUSTED, 'EQ' IN COND CODE + MOV A,C + ADD #PKDAT,C ;ADDRESS OF CONTACT NAME IN THIS RFC +11$: TSTB (D) ;END OF STRING? + BEQ 20$ ;YUP, RUN THIS SERVER + CMPB (C)+,(D)+ ;DO STRING COMPARE + BEQ 11$ ;MATCHES + TST (B)+ ;DOESN'T MATCH, TRY NEXT + BR 10$ + +99$: RET + +20$: JMP @(B)+ ;CALL SERVER, IT CAN RETURN EQ OR NE + +SRVTBL: .WORD 1$,STSSRV ;STATUS - RETURN HOST NAME AND METERS + .WORD 2$,PLSSRV ;PULSAR - SET AND GET PULSAR RATE +.IIF DF NDVRBF, .WORD 3$,DVROPN ;DOVER - DOVER PROTOCOL TRANSLATOR + .WORD 0 ;END OF TABLE +1$: .ASCIZ /STATUS/ +2$: .ASCIZ /PULSAR/ +3$: .IIF DF NDVRBF, .ASCIZ /DOVER/ + .EVEN + +;SERVERS MUST PRESERVE A (PACKET), AND I, AND RETURN 'NE' IF TO BE SENT BACK TO SOURCE. +;NOTE THAT C POINTS AT THE NEXT BYTE AFTER THE CONTACT NAME + +STSSRV: MOV A,B ;RFC TO "STATUS", CHANGE INTO ANS CARRYING APPROPRIATE DATA. + MOV #32.+<12.*NCHX>+<24.*CHAOSP>+<12.*ETHERP>,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + ADD #PKDAT,B + MOV #HSTNAM,D ;SEND NAME OF HOST + MOV #32.,C +45$: MOVB (D)+,(B)+ + SOB C,45$ + CLR D ;NOW STORE METERING INFO FOR EACH SUBNET +50$: MOV CHXSBN(D),(B)+ ;STORE SUBNET NUMBER+400 + MOV #4,(B)+ ;ASSUME NOT A CABLE + MOV NPKSI(D),(B)+ + MOV HPKSI(D),(B)+ + MOV NPKSO(D),(B)+ + MOV HPKSO(D),(B)+ +.IFNZ ETHERP + CMP D,#CHXETH ;ETHERNET HAS SOME OF THESE COUNTERS + BNE 55$ + MOV #12.,-10.(B) ;THERE ARE 4 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + CLR (B)+ + CLR (B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + BR 59$ +.ENDC ;ETHERP +55$: CMP CHIRFL(D),#CHSRFL ;CHAOSNET CABLE? + BNE 59$ ;NO, THAT'S ALL + MOV #16.,-10.(B) ;YES, THERE ARE 6 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + MOV NPKSLS-CHXCHS(D),(B)+ + MOV HPKSLS-CHXCHS(D),(B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + CLR (B)+ ;I DON'T KEEP TRACK OF BIT COUNT ERRS SEPARATELY + CLR (B)+ + MOV NPKSBD(D),(B)+ + MOV HPKSBD(D),(B)+ +59$: TST (D)+ + CMP D,#2*NCHX + BLO 50$ +RETANS: MOVB #%COANS,PKOP(A) ;RETURN THIS PACKET TO SOURCE AS AN 'ANS' + RET ;NOTE CONDITION CODES HAVE 'NE' + +PLSSRV: MOVB PKNBYT(A),C ;GET BYTE COUNT, SHOULD BE SMALL + CMP C,#8 ;6 FOR PULSAR, 1 FOR SPACE, 1 FOR CHARACTER + BLO 20$ ;NOT GIVEN AN ARGUMENT, JUST READ STATUS + MOVB PKDAT+7(A),C ;YES, GET THE ARGUMENT + SUB #'0,C ;CONVERT TO BINARY (CHEAPO!) + MOV C,PULSON ;CHANGE PULSON STATUS +20$: MOV #1,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + MOV PULSON,C ;RETURN PULSAR STATUS + ADD #'0,C ;IN ASCII + MOVB C,PKDAT(A) + BR RETANS + + .SBTTL CHAOSNET INTERRUPT HANDLER + +;INTERRUPT HANDLER ENTRIES +.REPT CHAOSP +CONC CHS,\.RPCNT,BK: + JSR I,CHSBRK + CHXCHS+<.RPCNT*2> +.ENDR + +;SUBROUTINE TO ENABLE CHAOSNET INTERFACE IN H,I TO RECEIVE NEXT PACKET +CHINXT: MOVB 1(H),A ;GET CSR BITS 9-12 (LOST COUNT) + ASR A + BIC #-20,A + ADD A,NPKSLS-CHXCHS(I) + ADC HPKSLS-CHXCHS(I) + BIS #%CARCL+%CAREN,(H) ;MAKE READY TO RECEIVE ANOTHER MESSAGE + RET + +;COMMON CHAOS INTERRUPT ROUTINE +CHSBRK: MOV (I),I ;GET SOURCE/SINK INDEX + PUSH ;SAVE ALL REGISTERS + MOV CHIHWR(I),H ;GET HARDWARE ADDRESS + MOV (H),A .SEE CH%CSR ;GET CSR + BPL CHSBK1 ;TEST RECEIVE DONE, BRANCH IF NOT + .SEE %CARDN ;PALX SCREWS UP IF THIS IS ON PREVIOUS LINE! + TST CHISTS(I) ;MAKE SURE INPUT BUFFER IS IDLE + BNE CHSBK1 ;BUSY, DON'T LOOK AT RECEIVE DONE NOW + BIT #%CAERR,A ;CRC ERROR? + BNE CHICRC ;JUMP IF YES + MOV CH%RBC(H),C ;BIT COUNT -1 + SUB #47.,C ;ADD 1, THEN SUBTRACT 3*16. FOR HARDWARE WORDS + .IREPT 4, ASR C ;CONVERT TO NUMBER OF WORDS + CMP C,#256. + BHI CHIFLS ;THIS CAN ONLY HAPPEN IF HARDWARE BROKEN + ADD #CH%RBF,H ;POINT H TO RECEIVE DATA REG + MOV CHIBFP(I),D ;COPY PACKET INTO BUFFER + CALL MOVHD + TST (H) ;READ OUT THE 3 HARDWARE LEADER WORDS + CMP (H),(H) + SUB #CH%RBF,H ;RESTORE H + BIT #%CAERR,(H) ;WAS IT READ CORRECTLY OUT OF RAM? + BNE CHIGBG ;NO, GARBAGE + CMP CH%RBC(H),#7777 ;WAS PACKET CORRECT LENGTH? + BNE CHIGBG ;NO, GARBAGE + CALL CHINXT ;DONE WITH HARDWARE, ENABLE FOR NEXT + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS CHIFL0 ;BRANCH IF NO GOOD + CALL SWAB11 ;SWAB IF NOT GOING TO 11-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + PUSH I + CALL CHSOUT ;SEND IT OUT + POP I + MOV CHIHWR(I),H ;RESTORE H + TST CHISTS(I) ;INPUT BUFFER STILL BUSY? + BEQ CHSBK1 + BIC #%CAREN,(H) ;YES, CLEAR RECEIVE INTERRUPT ENABLE + BR CHSBK1 ;GO CHECK ON OUTPUT SIDE + +;HERE WHEN A PACKET WAS RECEIVED WITHOUT ERROR, BUT AFTER +;READING OUT OF THE RAM, CRC ERROR WAS SET. EITHER THE +;PACKET WAS THE WRONG LENGTH, OR THE RAM FAILED, OR THE +;HARDWARE RANDOMLY CLOBBERED IT. +;WE ALSO GET HERE IF THE BIT COUNT WAS NOT -1 AFTER ALL WORDS WERE READ. +CHIGBG: ADD #1,NPKSRL-CHXCHS(I) ;LOG THE ERROR + ADC HPKSRL-CHXCHS(I) + MOV H,CHSRLH + MOV CH%RBC(H),CHSRLC + BR CHIFLS ;GO RESET RECEIVER AND CHECK OUTPUT STATUS + +;HERE WHEN A PACKET IS RECEIVED WITH A CRC ERROR. DISCARD IT, +;BUT ALSO SAVE IT IN CHSGBF, CHSGBH, CHSGBS, CHSGBC FOR DEBUGGING (IF FTGARB). +CHICRC: ADD #1,NPKSGB-CHXCHS(I) + ADC HPKSGB-CHXCHS(I) +.IFNZ FTGARB + MOV H,CHSGBH + MOV (H),CHSGBS + MOV CH%RBC(H),CHSGBC + ADD #CH%RBF,H + MOV #CHSGBF,D + MOV #PKMAX,C + CALL MOVHD + SUB #CH%RBF,H ;DROP INTO CHIFLS +.ENDC ;FTGARB +;HERE TO IGNORE AN INPUT PACKET AND ENABLE HARDWARE FOR NEXT +CHIFLS: CALL CHINXT +CHIFL0: INC NPKSIG +;HERE TO CHECK ON TRANSMIT SIDE +CHSBK1: TSTB (H) .SEE %CATDN ;TRANSMIT DONE? + BPL CHSBKX ;NO, EXIT +.IFNZ CHSBTB + CLR CHSIDL(I) ;CLEAR TRANSMIT-DONE TIME-OUT +.ENDC ;CHSBTB + MOV CHOSTS(I),A ;WAS OUTPUT IN PROGRESS? + BEQ CHSBK6 ;NO, LOOK FOR OUTPUT + CMP A,#2 ;TRANSMIT ABORT DELAY COMPLETED? + BEQ 10$ + BIT #%CATAB,(H) ;NO, TRANSMIT ABORTED? + BEQ CHSBK4 ;NO + ADD #1,NPKSAB-CHXCHS(I) ;YES, METER IT, AND SET CHOSTS TO + ADC HPKSAB-CHXCHS(I) + INC CHOSTS(I) ;2 IF THIS IS FIRST TIME, OR 0 IF SECOND TIME + BEQ CHSBK4 ;LOST TWICE IN A ROW, GIVE UP + BR CHSBK5 ;TURN OFF INTERRUPT, DELAY FOR A WHILE + +10$: MOV #-1,CHOSTS(I) ;TRANSMIT ABORT DELAY COMPLETED, SET CHOSTS TO -1 + CALL CHSXM0 ;INITIATE RE-TRANSMISSION (CHOSTS ALREADY SET) + BR CHSBKX ;DISMISS + +CHSBK4: CALL CHSODN ;OUTPUT DONE +CHSBK6: PUSH I + CALL CHSRUN ;INITIATE MORE TRANSFERS + POP I + TST CHOSTS(I) ;DID IT INITIATE TRANSMISSION? + BNE CHSBKX ;YES, LEAVE INTERRUPT ENABLED. + MOV CHOHWR(I),H ;RESTORE H + TST CHXRTF(I) ;TIME TO BROADCAST ROUTING INFO? + BNE CHORUT ;YES + TST PULSON ;IS THIS FEATURE TURNED ON? + BEQ CHSBK5 ;NO, FLUSH + CMP PULSAR,PULSON ;NOTHING TO DO. TIME FOR A TEST MESSAGE? + BNE CHSBK5 ;NOPE, GO IDLE + MOV #52525,CH%WBF(H) ;WRITE A PACKET OF 3 HEADER WORDS, 0, 52525 + CLR CH%WBF(H) + MOV #-1,CH%WBF(H) ;TO HOST -1, WHICH IS NON-EXISTENT +CHSBK7: TST CH%XMT(H) ;INITIATE TRANSMISSION, DON'T ENABLE INTERRUPT +CHSBK5: BIC #%CATEN,(H) ;GO IDLE, CLEAR TRANSMIT INTERRUPT ENABLE +;HERE TO EXIT FROM CHAOS INTERRUPT. RESTORE REGS AND RETURN FROM INT +CHSBKX: POP + RTI + +.IIF NZ CH%WBF-CH%MYN, .ERR FOO CODE ASSUMES CH%WBF = CH%MYN + +;BROADCAST A PACKET FULL OF ROUTING INFO, SINCE WE ARE MORE OR LESS A GATEWAY +CHORUT: MASK 6 ;INHIBIT CLOCK INTERRUPTS SO COSTS DON'T CHANGE + ADD #CH%WBF,H ;ADDRESS WRITE BUFFER + MOV #%CORUT*400,(H) ;OPCODE + MOV #2*,A ;COUNT SUBNETS WHICH WE KNOW ANYTHING ABOUT (REASONABLE COST) + CLR B +5$: CMP SBNCST(A),#1000 + BHIS 6$ + ADD #4,B ;THIS ONE WILL GENERATE 2 WORDS +6$: SUB #2,A + BPL 5$ + MOV B,(H) ;BYTE COUNT + CLR (H) ;DESTINATION + CLR (H) ;.. + MOV (H),(H) ;SOURCE = CH%MYN + CLR (H) ;SOURCE INDEX + CLR (H) ;PACKET NUMBER + CLR (H) ;ACK NUMBER + MOV #2*,A ;GO THROUGH SUBNET TABLES + MOVB 1(H),C ;GET SUBNET THIS IS GOING OUT ON + ASL C + MOV SBNCST(C),C ;GET COST OF GETTING TO US FROM GUY WHO RECEIVES THIS +10$: CMP SBNCST(A),#1000 ;WAS THIS ONE INCLUDED IN BYTE COUNT? + BHIS 11$ ;NO, DON'T PUT IT IN PACKET + MOV A,B ;FIRST WORD IS SUBNET NUMBER + ASR B + MOV B,(H) + MOV SBNCST(A),B ;SECOND WORD IS COST + ADD C,B ;WHICH MUST INCLUDE COST OF GETTING TO US + MOV B,(H) +11$: SUB #2,A ;NEXT SUBNET + BPL 10$ + CLR (H) ;BROADCAST THIS PACKET + SUB #CH%WBF,H ;RESTORE H + CLR CHXRTF(I) ;CLEAR REQUEST FOR ROUTING PACKET + UNMASK + BR CHSBK7 ;FIRE IT OFF, DON'T ENABLE TRANSMIT-DONE INTERRUPT + +;INITIATE TRANSMISSION ON CHAOS INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +CHSXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING +CHSXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #CH%WBF,H ;ADDRESS THE WRITE BUFFER + MOV CHILNG(B),C ;GET WORD COUNT + CALL MOVDH ;COPY INTO HARDWARE + MOV CHICBA(B),(H) ;STORE CABLE DESTINATION + SUB #CH%WBF,H ;RESTORE H + TST CH%XMT(H) ;TRIGGER TRANSMISSION + BIS #%CATEN,(H) ;ENABLE DONE INTERRUPT + RET ;PI LEVEL WILL PICK UP OUTPUT + +.ENDC ;CHAOSP + +.IFNZ ETHERP + .SBTTL ETHERNET SUPPORT + +;ENABLE NEXT ETHERNET PACKET TO COME IN. +;SINCE WE ONLY HAVE ONE BUFFER, THIS SETS UP THE TRANSFER RATHER +;THAN JUST ENABLING THE INTERRUPT AS THE CHAOSNET DOES. +;THAT WOULDN'T WORK ANYWAY, BECAUSE THE HARDWARE IS SO TOTALLY BRAIN-DAMAGED. +ETHRFL: MOV CHIHWR(I),H + ADD #10,H + MOV #-,(H)+ ;- WORD COUNT, +1 FOR HARDWARE BUG + MOV #ETHIBF+,(H)+ ;BUFFER ADDRESS + MOV #101,(H) ;START, INTERRUPT-ENABLE + RET + +;INCOMING PUP TOO BIG. WE DON'T HAVE FRAGMENTATION, SO SEND A PUP ERROR REPORT +ETHBIG: MOV #ETHIBF+PKDAT,A ;COPY PUP HEADER INTO DATA FIELD + MOV A,C + MOV #ETHIBF+PKDAT+20.,B + .IREPT 10.,< MOV (A)+,(B)+ > + MOV #517.,(B)+ ;PACKET TOO LARGE ERROR + MOV #DATMAX,(B)+ ;MAX NUMBER OF BYTES ALLOWED + MOV #50$,A +5$: MOVB (A)+,(B)+ ;ASCII MESSAGE + BNE 5$ + INC B ;MESSAGE LENGTH IS EVEN. INCLUDE CHECKSUM IN COUNT. + SUB #ETHIBF+PKDAT,B ;GET PUP LENGTH + MOV B,(C)+ ;BUILD PUP HEADER NOW + MOV #4,(C)+ ;PUP TYPE = ERROR + CMP (C)+,(C)+ ;PUP ID SAME + .IREPT 3,< MOV 6(C),(C)+ > ;DESTINATION = ORIGINAL SOURCE + MOV #,(C)+ ;SOURCE = ME + .IREPT 2,< CLR (C)+ > ;SOURCE PORT ZERO + CALL ETHOUT ;TRANSMIT + JMP ETHINX ;DISMISS + +;The ascii message. This isn't as destroyed as it looks. +50$: .ASCIZ/UP Pot oalgr eotf tii n ahCoanstep caek.t/ + .EVEN + +;INPUT INTERRUPT +ETHIBK: PUSH + MOV #CHXETH,I + MOV CHIHWR(I),H + MOV 14(H),A ;PICK UP STATUS + CLR 14(H) ;CLEAR RECEIVE INTERRUPT ENABLE + CMP ETHIBF+PKDAT-2,#1000 ;TYPE = PUP? + BNE ETHIIX ;NO, IGNORE PACKET + TST 10(H) ;CHECK RESIDUAL WORD COUNT + BEQ ETHBIG ;PACKET TOO BIG, RESPOND WITH PUP ERROR + TST A ;CHECK COMBINED INPUT ERRORS BIT + BMI 70$ ;ERROR, IGNORE PACKET + MOV ETHIBF+PKDAT+10,A ;GET DESTINATION HOST + BEQ 5$ ;AND SEE IF BROADCAST OR SELF + CMP A,# + BNE 11$ ;NO, ROUTE AS REGULAR MESSAGE +5$: CMPB ETHIBF+PKDAT+2,#1 ;PUP TYPE = ECHO-ME? + BEQ ETHECO ;YES, ECHO IT (MAYBE TAKE THIS OUT AFTER 11 DEBUGGED) + CMPB ETHIBF+PKDAT+2,#200 ;GATEWAY INFORMATION REQUEST? + BNE 10$ + TST ETHIBF+PKDAT+12 ;NOT REALLY UNLESS DESTINATION SOCKET IS 2 + BNE 10$ + CMP ETHIBF+PKDAT+14,#2 + BNE 10$ + TST CHISTS+CHXEGT ;PSEUDO DEVICE AVAILABLE? + BNE ETHIIX + MOV #ETHIBF+PKDAT+4,A ;YES, SEND HIM SOME INFO + MOV #EGTPID,B + .IREPT 2,< MOV (A)+,(B)+ > ;COPY PUP ID + ADD #6,A ;COPY SOURCE HOST AND SOCKET INTO DESTINATION + .IREPT 3,< MOV (A)+,(B)+ > + CALL ETHRT1 + MOV #CHXETH,I ;I CLOBBERED BY ETHRT1 + BR ETHIIX + +10$: TST A ;DON'T HARASS REST OF NET WITH BROADCASTS + BEQ ETHIIX +11$: MOV #ETHIBF+PKDAT,A ;CHECK THE CHECKSUM + CALL PUPCKT + BNE 60$ ;BAD, COUNT AS RAM ERROR +.IF DF NDVRBF + CMP ETHIBF+PKDAT+10,DVRHST ;SEE IF ADDRESSED TO DOVER USER + BNE 12$ + CMP ETHIBF+PKDAT+14,DVRIDX + BNE 12$ + CALL DVRPUP ;YES, PROCESS + MOV #CHXETH,I + BR ETHIIX + +.ENDC ;NDVRBF +;TRANSLATE PUP AND SEND TO CHAOSNET +12$: MOV #ETHIBF,A ;FILL IN CHAOSNET HEADER + MOV #<%COUNC*400>,(A)+ ;PKOP + MOV ETHIBF+PKDAT+0,B ;PKNBYT (TOTAL PUP LENGTH = CHAOS DATA LENGTH) + INC B ;ROUND UP TO AN EVEN NUMBER + ASR B + ASL B + MOV B,(A)+ + MOV ETHIBF+PKDAT+10,(A)+ ;PKDHST + MOV ETHIBF+PKDAT+14,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+16,(A)+ ;PKSHST + MOV ETHIBF+PKDAT+22,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+6,(A)+ ;PKPKN (LOW HALF OF PUP ID) + MOV #100001,(A)+ ;PKACN = PROTOCOL NUMBER + CALL CHSIHD ;PROCESS THIS HEADER, GET LENGTH, DEST + BVS ETHIIX ;IGNORE IF NO GOOD + CALL SWAB10 ;SWAB IF NOT GOING TO 10-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + CALL CHSOUT ;SEND IT OUT + BR ETHINX ;ETHRFL WILL BE CALLED WHEN NECESSARY + +60$: ADD #1,NPKSRL-CHXCHS(I) ;COUNT ERRORS (SOFTWARE CHECKSUM) + ADC HPKSRL-CHXCHS(I) + BR ETHIIX + +70$: ADD #1,NPKSGB-CHXCHS(I) ;COUNT ERRORS (HARDWARE CHECKSUM) + ADC HPKSGB-CHXCHS(I) +ETHIIX: CALL ETHRFL ;AND READ ANOTHER PACKET +ETHINX: POP + RTI + +;ETHERNET PUP ECHO PROTOCOL +ETHECO: MOV #ETHIBF+PKDAT+10,A ;INTERCHANGE SOURCE AND DESTINATION + MOV A,B ;I DON'T BOTHER CHECKING CHECKSUM, BUT I DO GENERATE IT + .IREPT 3, PUSH (A)+ + .IREPT 3,< MOV (A)+,(B)+ > + .IREPT 3, POP -(A) + MOV #,(A) ;FIX SOURCE TO BE ME + INCB ETHIBF+PKDAT+2 ;SET PUP TYPE = 2 (I AM AN ECHO) + CALL ETHOUT ;SEND BACK OUT ON THE ETHERNET + BR ETHINX + +;GENERAL PURPOSE ROUTINE FOR TRANSMITTING INTERNALLY-GENERATED PUPS TO +;THE ETHERNET. FIXES THE DESTINATION ADDRESS (THIS IS HOW OTHER +;HOSTS FIGURE OUT WHAT SUBNET THEY ARE ON!), COMPUTES THE PUP CHECKSUM, +;AND INTERFACES TO THE PACKET SWITCH. CALLED WITH SOURCE INDEX IN I. +;CALL THIS WITH A PACKET THAT ALREADY HAS ITS BYTES IN ETHERNET ORDER. +;BASHES ALL REGISTERS. +ETHOUT: MOV CHIBFP(I),A + ADD #PKDAT,A ;ADDRESS OF PUP + TST 10(A) ;ONLY IF NOT BROADCASTING, + BEQ 10$ + TSTB 11(A) ;DESTINATION ADDRESS HAVE NETWORK NUMBER? + BNE 10$ + MOVB #ETHSBN,11(A) ;NO, PUT IT IN +10$: CALL PUPCKS ;INSERT CHECKSUM + MOV #CHXETH,B + MOV B,CHIOUX(I) + INC CHISTS(I) + JMP CHSOUT + +;INITIATE TRANSMISSION ON ETHER INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +;PACKET IS ALREADY SWABBED INTO ETHERNET BYTE ORDER (REVERSE OF CHAOSNET). +ETHXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING + CLR A ;NO OUTPUT START DELAY +ETHXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #PKDAT,D ;GET PUP ADDRESS + MOV #1000,-(D) ;SMASH LAST 2 WORDS OF CHAOS HEADER. TYPE=PUP + MOV #ETHHSN,-(D) ;STORE SOURCE ADDRESS + MOVB 14(D),1(D) ;STORE DESTINATION ADDRESS + MOV 4(D),B ;GET PUP SIZE IN BYTES + ADD #5,B ;CONVERT TO WORDS, ALLOW FOR ETHERNET HEADER + ASR B + NEG B ;HARDWARE WANTS IT NEGATIVE + MOV B,(H)+ ;OUTPUT WORD COUNT + MOV D,(H)+ ;OUTPUT BUFFER ADDRESS + MOV A,2(H) ;OUTPUT START DELAY + MOV #101,(H) ;START OUTPUT, ENABLE INTERRUPT + RET ;PI LEVEL WILL FINISH + +;OUTPUT DONE/ABORTED INTERRUPT +ETHOBK: PUSH + MOV #CHXETH,I + MOV CHOHWR(I),H + MOV 4(H),A ;PICK UP STATUS BEFORE WRITING IT + CLR 4(H) ;CLEAR INTERRUPT ENABLE + TST A ;CHECK FOR ERROR + BPL 10$ + ADD #1,NPKSAB-CHXCHS(I) + ADC HPKSAB-CHXCHS(I) + NEG CHOSTS(I) ;ERROR, ENTER RETRANSMIT MODE + BPL 10$ ;ALREADY RETRANSMITTED ONCE, PUNT + MOV #25.,A ;WAIT 1 MS (DON'T BOTHER BEING RANDOM) + CALL ETHXM0 ;START TRANSMISSION AGAIN + BR ETHINX ;AND EXIT + +10$: CALL CHSODN ;TRANSMISSION FINISHED + CALL CHSRUN ;FIND MORE WORK TO DO + BR ETHINX ;DISMISS + +;CHECKSUM PUP ADDRESSED BY A. BASHES A,B,C. +PUPCKS: CALL PUPCK1 ;COMPUTE CHECKSUM + MOV B,(A) ;STORE CHECKSUM + RET + +;RETURN 'EQ' IF CHECKSUM MATCHES +PUPCKT: CALL PUPCK1 ;COMPUTE CHECKSUM + CMP (A),#-1 ;PACKET CHECKSUMMED? + BEQ 5$ ;NO, ALWAYS MATCH + CMP B,(A) ;RETURN WITH CC SET FROM NEW AND OLD CKSMS +5$: RET + +;A POINTS AT PACKET, RETURN WITH A -> CHECKSUM AND CHECKSUM IN B. BASH C. +PUPCK1: MOV (A),C ;GET LENGTH + DEC C ;IN WORDS NOT COUNTING CHECKSUM + ASR C + CLR B ;BUILD CHECKSUM IN B +10$: ADD (A)+,B ;ONE'S COMPLEMENT ADD + ADC B + BPL 11$ ;TRANSFER SIGN BIT INTO CARRY + SEC +11$: ROL B ;AND LEFT CYCLE + SOB C,10$ + INC B ;GRONK MINUS ZERO + BEQ 15$ + DEC B +15$: RET + +;BROADCAST ETHERNET GATEWAY INFO +ETHRUT: MASK 5 ;ENTER SUITABLE LEVEL FOR HACKING NET + TST CHISTS+CHXEGT ;IS THE PSEUDO SOURCE THAT EMITS THE + BNE 99$ ; PACKET AVAILABLE? IF NOT, PUNT. + CLR CHXRTF+CHXETH ;CLEAR REQUEST FLAG + MOV #EGTPID,A + CLR (A)+ ;PUP ID ZERO + CLR (A)+ + CLR (A)+ ;BROADCAST DESTINATION + CLR (A)+ ;TO SOCKET 2 + MOV #2,(A)+ + CALL ETHRT1 ;BUILD AND SEND GATEWAY INFO +99$: UNMASK + RET + +BADSBP: .WORD BADSUB ;POINTER INTO BAD SUBNETS +BADSUB: ;SUBNETS THAT SHOULD NOT HAVE INFORMATION SENT + ;ABOUT. THIS LIST MUST BE IN INCREASING ORDER + ;AND MUST END IN 377. + .BYTE 004 ;AI CHAOS 11 pseudo subnet (only AI PDP-10 (RIP) is on this) + .BYTE 010 ;Tech Square LCSnet (unused) + .BYTE 011 ;Tech Square LCS asynchronous line net (IP) + .BYTE 012 ;Tech Square VII LCSnet (IP) + .BYTE 014 ;Symbolics: Los Angeles-Chatsworth land line + .BYTE 020 ;CHAOS MIT IN subnet (ask JNC) + .BYTE 027 ;Experimental asynchronous line net + .BYTE 030 ;Experimental radio broadcast net + .BYTE 040 ;Symbolics: Tech Square-Vassar St. microwave link + .BYTE 041 ;Symbolics: Cambridge-Palo Alto land line + .BYTE 042 ;Symbolics: Palo Alto-Chatsworth land line + .BYTE 047 ;Symbolics: Cambridge-Chatsworth land line + .BYTE 054 ;S-1: 10Mb Ethernet + .BYTE 055 ;S-1: Pronet ring + .BYTE 056 ;S-1: serial line subnet + .BYTE 057 ;S-1: serial line subnet + .BYTE 061 ;Symbolics: Cambridge-Cambridge land line + .BYTE 062 ;Symbolics: Cambridge-Washington land line + .BYTE 064 ;Symbolics: Cambridge-Houston land line + .BYTE 070 ;Symbolics: Chatsworth-Westwood land line + .BYTE 072 ;Atari: Cambridge-MIT land line + .BYTE 073 ;Atari: Cambridge-Sunnyvale land line + .REPT 8 + .BYTE 377 ;SPARES + .ENDR + .BYTE 377 +.EVEN + +ETHRT1: MOV #BADSUB,BADSBP ;INITIAL BAD SUBNET POINTER + MOV #EGTSBN,A ;FILL IN GATEWAY INFORMATION IN THE PUP + CLR I ;I SUBNET*2, A EGTSBN POINTER +10$: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + CLR B ;FOR NON-GATEWAY, USE 0 AS GATEWAY ADDRESS + TST SBNTYP(I) ;HARDWARE CONNECTION? + BGT 11$ + MOV SBNADR(I),B ;NO, GET GATEWAY ADDRESS +11$: cmpb i,#60 + bhi 20$ ;dover, as of 1-Dec-83 can't handle more than 60 + ;; FILTER OUT KNOWN BAD SUBNETS + CMPB I,@BADSBP ;MAYBE UPDATE POINTER + BHI 115$ ; NO UPDATE NEEDED + INC BADSBP +115$: CMPB I,@BADSBP ;THIS TIME, CHECK FOR EQUALITY + BEQ 20$ ;PUNT + ;; END FILTER + MOV SBNCST(I),C ;GET COST + CMP C,#1000 ;IF NOT REACHABLE, DON'T PUT IN PACKET + BHIS 20$ + .IREPT 3, ASR C ;DIVIDE BY 8 TO GET APPROXIMATE HOP COUNT + CMP C,#ETHMXH ;DON'T PUT MORE THAN MAXHOPS + BLOS 12$ + MOV #ETHMXH,C +12$: MOV I,D ;GET TARGET-NET + ASR D + SWAB B + MOVB B,(A)+ ;STORE IN WIERD XEROX BYTE ORDER + MOVB D,(A)+ + MOV B,(A)+ + MOVB C,-2(A) +20$: TST (I)+ ;NEXT SUBNET + CMP I,#NSUBNT*2 + BLO 10$ + SUB #EGTSBN,A ;NUMBER OF DATA BYTES IN PUP + ADD #22.,A ;FOR HEADER AND CHECKSUM + MOV A,EGTPLN ;SET PUP LENGTH + MOV #CHXEGT,I ;SET UP TO TRANSMIT TO ETHERNET + JMP ETHOUT +.ENDC ;ETHERP + +.IF DF NDVRBF + .SBTTL DOVER PROTOCOL TRANSLATOR + +;RFC PACKET IN A. MUST PRESERVE I, AND RETURN 'EQ'. +DVROPN: MOV PKPKN(A),C + MOV PKSIND(A),B + MOV PKSHST(A),A + PUSH I + CALL 5$ + POP I + SEZ + RET + +;SET UP DOVER TO TALK TO HOST IN A, INDEX IN B, PKT# IN C, SENDING BACK AN OPN +;OR SENDING A LOS IF BUSY. MUST WATCH FOR DUPLICATE RFC'S +;MUST BE CALLED WITH CHAOS AND ETHER INTERRUPTS MASKED +5$: TST DVRHST ;BUSY? + BEQ 10$ ;NO + CMP A,DVRHST + BNE DVRBSY ;YES, TALKING TO ANOTHER HOST + CMP B,DVRIDX + BNE DVRBSY ;YES, TALKING TO ANOTHER GUY SAME HOST + BR 11$ ;DUPLICATE RFC + +10$: CLR DVRTIM ;FLUSH TIMEOUT + MOV A,DVRHST + MOV B,DVRIDX + INC DVRLIX ;ESTABLISH UNIQUE LOCAL INDEX + BNE 11$ + INC DVRLIX ;DON'T USE 0 +11$: CLR DVRMSK ;CLEAR THE BUFFER RING + CLR DVRID ;FIRST PACKET TO SEND TO DOVER IS PACKET 0 + INC C ;C := FIRST PACKET ID THAT WILL COME IN FROM CHAOS + MOV C,DVROFS + MOV #%COOPN*400,B ;SEND AN OPN + BR DVRST1 ;REST IS LIKE STS + +DVRBSY: TST DVRPKP ;SPECIAL BUFFER BUSY? + BNE CPOPJ0 ;YES, PUNT + MOV #DVRBF2,C ;SEND A CLS + MOV #%COCLS*400,(C)+ + MOV #4,(C)+ + MOV A,(C)+ + MOV B,(C)+ + MOV #CHAD0,(C)+ + CLR (C)+ + CLR (C)+ + CLR (C)+ + MOV #"BU,(C)+ + MOV #"SY,(C)+ + MOV #DVRBF2,DVRPKP + BR DVRRFL + +;HERE TO SEND STS TO GUY CONNECTED TO DOVER +;MUST BE MASKED AGAINST CHAOS INTERRUPTS +DVRSTS: MOV #%COSTS*400,B +DVRST1: MOV #DVRBF2,A ;USE THIS BUFFER + MOV #4,D ;NUMBER OF BYTES +DVRST2: MOV A,C + MOV B,(A)+ ;OPCODE + MOV D,(A)+ ;NUMBER OF BYTES + MOV DVRHST,(A)+ ;DESTINATION HOST + MOV DVRIDX,(A)+ ;DESTINATION INDEX + MOV #CHAD0,(A)+ ;SOURCE HOST + MOV DVRLIX,(A)+ ;SOURCE INDEX + CLR (A)+ ;NO PACKET NUMBER + CMP B,#%COLOS*400 ;IF SENDING LOS, PUNT THE REST + BEQ 20$ + MOV DVRID,B + DEC B ;LAST PACKET ACKNOWLEDGED BY DOVER + ADD DVROFS,B ;CONVERT TO CHAOSNET ID + MOV B,(A)+ ;ACKNOWLEDGE PACKET NUMBER + MOV B,(A)+ ;RECEIPT + MOV #NDVRBF,(A)+ ;WINDOW SIZE +20$: MOV C,DVRPKP ;CAUSE PACKET TO GET SENT + ;DROP INTO DVRRFL + +;HERE TO GET ANOTHER PACKET FROM THE DOVER. THIS CAN BE EITHER A CHAOSNET +;PACKET TO BE SENT BACK TO THE APPROPRIATE GUY, OR A PUP TO GO TO THE DOVER +DVRRFL: MOV #CHXDVR,I ;THIS MIGHT NOT BE SET UP WHEN CALLED + TST CHISTS(I) ;PACKET SOURCE ONLY EMANATES ONE AT A TIME + BNE CPOPJ0 + CMP CHIBFP(I),DVRPKP ;FINISHED SENDING SPECIAL PACKET? + BNE 10$ + CLR DVRPKP ;YES, MAKE READY FOR ANOTHER +10$: CLR CHIBFP(I) ;THIS PACKET NO LONGER BEING SENT + MOV DVRPKP,A ;GOT SPECIAL PACKET TO SEND? + BNE 30$ ;YES, SEND IT + TST DVRMSK ;GOT NEXT BUFFER TO SEND TO DOVER? + BPL CPOPJ0 ;NO + CMP DVRRTR,#60. ;1-SECOND RETRANSMISSION INTERVAL ELAPSED? + BLO CPOPJ0 ;NO, DON'T SEND YET + CLR DVRRTR ;SENDING, RESET RETRANSMISSION TIMER + MOV DVRBFP,A + BIC #PKFCMS,PKFC(A) ;CLEAR FORWARDING COUNT SINCE SENDING AGAIN +30$: MOV A,CHIBFP(I) ;SEND THIS PACKET + CALL CHSIHD ;ROUTE HIM + BVS DVRRFL ;BAD, IGNORE + CMP B,#CHXCHS ;SWAB IF SENDING TO 10, BUT NOT ETHERNET + BHIS 35$ + CALL CHSSWB +35$: INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + RET + +;CALLED WITH A PUP IN ETHIBF WHICH IS FROM THE DOVER AND ADDRESSED +;TO THE GUY WHO'S TRYING TO PRINT ON IT. MUST BE MASKED AGAINST ETHER & CHAOS INTERRUPTS. +DVRPUP: MOVB ETHIBF+PKDAT+2,B + CMP B,#31 ;EFTP ACKNOWLEDGE? + BNE DVRPP1 + CMP ETHIBF+PKDAT+6,DVRID ;ACKNOWLEDGING EXPECTED PACKET? + BNE CPOPJ0 ;NO, IGNORE IT + INC DVRID ;YES, ADVANCE ID, POINTER, AND PACKET-PRESENCE MASK + MOV DVRBFP,A + ADD #DVRBFL,A + CMP A,#DVRBF2 + BLO 11$ + MOV #DVRBUF,A +11$: MOV A,DVRBFP + ASL DVRMSK + SETOM DVRRTR ;FAKE RETRANSMIT TIMER TO SEND NEXT PUP RIGHT AWAY + TST CHISTS+CHXDVR ;PACKET SOURCE BUSY? + BEQ DVRSTS ;NO, SEND AN ACKNOWLEDGEMENT TO THE CHAOSNET +CPOPJ0: RET + +DVRPP1: MOV #22.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#33 ;EFTP ABORT? + BEQ DVRERR + MOV #44.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#4 ;PUP ERROR? + BNE CPOPJ0 ;IGNORE ANYTHING ELSE +DVRERR: CLR DVRMSK ;DON'T SEND ANYTHING MORE TO THE DOVER + MOV ETHIBF+PKDAT,C ;PUP LENGTH + SUB A,C + SUB #2,C ;GET LENGTH OF ASCII STRING + ADD #ETHIBF+PKDAT,A ;GET ADDRESS OF ASCII STRING + MOV #DVRBUF+PKDAT,B ;BUILD A LOS PACKET TO SEND BACK + MOV C,D ;SAVE BYTE LENGTH + INC C + ASR C ;WORD COUNT + BEQ 11$ +10$: MOV (A)+,(B) + SWAB (B)+ ;ALTO HAS BYTES IN THE WRONG ORDER + SOB C,10$ +11$: MOV #%COLOS*400,B ;SEND A LOS + MOV #DVRBUF,A + CALL DVRST2 + CLR DVRHST ;KILL CONNECTION + RET + +;HERE IS A PACKET DIRECTED TO THE DOVER. DO GOOD THINGS WITH IT. +;NOTE, IT HAS ALREADY BEEN SWABBED INTO ETHERNET BYTE ORDER. +DVRPKT: MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),A ;GET ADDRESS OF PACKET + CLR DVRTIM ;FOREIGN HOST IS NOT IDLE + MOVB PKOP(A),B ;DATA PACKET? + BMI 50$ ;YES + CMP B,#%COSNS + BNE 11$ + TST CHISTS+CHXDVR + BNE 90$ + CALL DVRSTS ;SNS => STS + BR 90$ + +11$: CMP B,#%COCLS + BEQ 12$ ;CLS OR LOS PUNTS THE CONNECTION + CMP B,#%COLOS + BNE 13$ +12$: CLR DVRHST + BR 90$ + +13$: CMP B,#%COEOF ;NOTE THAT EOF IS TREATED VERY MUCH LIKE DATA! + BNE 90$ ;IGNORE ANYTHING RANDOM +50$: MOV PKPKN(A),B ;GET ID OF DATA PACKET + SUB DVROFS,B + MOV DVRBFP,D ;FIND WHERE IN THE BUFFER IT GOES + MOV #100000,C ;AND GET MASK BIT FOR IT + SUB DVRID,B ;B := ID RELATIVE TO NEXT EXPECTED + BEQ 53$ + CMP B,#NDVRBF + BHIS 90$ ;IGNORE DUPLICATE OR NOT IN WINDOW +51$: ADD #DVRBFL,D + CMP D,#DVRBF2 + BLO 52$ + MOV #DVRBUF,D +52$: CLC + ROR C + SOB B,51$ +53$: BIT C,DVRMSK ;ALREADY HAVE PACKET? + BNE 90$ ;YES, IGNORE + BIS C,DVRMSK ;NO, STORE IT AWAY + MOV D,C + ADD #PKDAT,D ;BUILD PUP + MOV PKNBYT(A),B + BIC #PKNBMS,B + MOV B,(D) + ADD #22.,(D)+ ;PUP LENGTH + MOV #30,(D)+ ;PUP TYPE + TST (A) ;WAS THIS DATA OR EOF? + BMI 54$ ;DATA + SUB (PC),-2(D) ;EOF, SET PUP TYPE TO 32 +54$: CLR (D)+ ;PUP ID HIGH + MOV PKPKN(A),(D) ;PUP ID LOW + SUB DVROFS,(D)+ ; CORRECTED + MOV #DVRADR,(D)+ ;DESTINATION HOST + CLR (D)+ ;DESTINATION SOCKET HIGH + MOV #20,(D)+ ;DESTINATION SOCKET LOW + MOV DVRHST,(D)+ ;SOURCE HOST + CLR (D)+ ;SOURCE SOCKET HIGH + MOV DVRIDX,(D)+ ;SOURCE SOCKET LOW + ADD #PKDAT,A + INC B + ASR B ;NUMBER OF DATA WORDS +;*** TEMPORARY KLUDGE *** + PUSH ;PUSH B LAST!! +;*** END TEMPORARY KLUDGE *** + BEQ 56$ +55$: MOV (A)+,(D)+ ;MOVE THE DATA + SOB B,55$ +56$: MOV C,A + ADD #PKDAT,A + MOV #<%COUNC*400>,(C) ;PKOP + MOV 10(A),PKDHST(C) + MOV (A),PKNBYT(C) ;SHOULD BE ENOUGH TO GET IT ROUTED TO ETHERNET + CALL PUPCKS ;STORE APPROPRIATE CHECKSUM +;*** TEMPORARY KLUDGE *** + POP ;LOOK FOR SOME KIND OF MACHINE FAILURE + TST B + BEQ 79$ +70$: CMP (D)+,(A)+ + BNE 75$ + SOB B,70$ + BR 79$ + +75$: DVRFKT=. + NOP ;PUT A BPT HERE IF YOU LIKE + INC NDVRFK + CLR DVRMSK ;DO IT ALL OVER AGAIN +79$: +;*** END TEMPORARY KLUDGE *** + CALL DVRRFL ;SEND THIS PACKET MAYBE +90$: MOV #CHXDVR,I + JMP CHSODN ;THIS PACKET HANDLED +.ENDC ;NDVRBF + .IFNZ DL10P + .SBTTL TRAP HANDLING + +TRAP14: HALT ;BPT WITH NO RUG IN CORE + +TRAP10: BPT ;ILLEGAL INSTRUCTION + +TRAP4: NOP ;PATCH BPT HERE IF YOU WANT + CMP (SP),#MAIN ;IF TRAP4 IN MAIN LOOP... + BLO CRASH + CMP (SP),#MAINE + BHIS CRASH + BIT #DLXPRT,DLXCSR ;AND DL10 PORT TURNED OFF + BNE CRASH + TST DLXOFF ;AND WE THOUGHT IT WAS ON + BNE CRASH +RESTRT: MOV #STKBAS,SP ;THEN RESTART MAIN LOOP + CLR -(SP) ;WHICH WILL WAIT FOR DL10 PORT TO TURN ON + MOV #MAIN,-(SP) + RTI + +CRASH: BPT ;OTHERWISE, CRASH + +PWRFAL: RESET ;POWER FAIL OR UP - IF FAIL, HALT DURING RESET + MOV #20,B ;WAIT 2 SECONDS TO +1$: CLR A ; MAKE SURE POWER IS REALLY ON + SOB A,. + SOB B,1$ + JMP INIT ;POWER SEEMS UP, RESTART PROGRAM +.ENDC ;DL10P + +.IFNZ NODDT ;IF NO DDT OR OTHER "OPERATING SYSTEM", SET UP TRAP HANDLERS +TRAP4: + .=4 + .WORD TRAP4,340,TRAP10,340,TRAP14,340,TRAP10,340,PWRFAL,340,TRAP10,340,TRAP10,340 + .=TRAP4 + +;ILLEGAL ADDRESS, UNIBUS NXM, STACK OVERFLOW +TRAP4: BPT + 0 + +;ILLEGAL INSTRUCTION, IOT, EMT +TRAP10: BPT + 0 + +;POWER FAILURE OR RESTORE +PWRFAL: HALT + 0 + +;BPT (OR TRACE) +TRAP14: .REPT 7 ;SAVE REGISTERS WHERE CARPET CAN FIND THEM + MOV %0+.RPCNT,BPTACS+<.RPCNT*2> + .ENDR + CLR BPTGO + SETOM BPTFLG +5$: TST BPTGO + BEQ 5$ + CLR BPTFLG + .REPT 7 + MOV BPTACS+<.RPCNT*2>,%0+.RPCNT + .ENDR + RTI + +BPTFLG: 0 ;NON-ZERO IF GOT A BPT +BPTGO: 0 ;NON-ZERO TO PROCEED +BPTACS: .BLKW 7 ;REGS EXCEPT PC + +.ENDC ;NODDT + + .SBTTL INITIALIZATION +GO:: +INIT: CLR PS +.IFNZ DL10P + RESET + MOV #STKBAS,SP + TST 14 + BNE 1$ ;BPT ALREADY SET UP BY RUG + MOV #TRAP14,14 + MOV #340,16 +1$: +.ENDC ;DL10P +.IFNZ NODDT ;NO OPERATING SYSTEM + RESET + MOV #STKBAS,SP +.ENDC ;NODDT + SETOM DLXOFF ;REINITIALIZE VARIOUS VARIABLES + SETOM NO.ITS +.REPT CHAOSP ;IDLE CHAOS NET INTERFACES + CLR CHISTS+CHXCHS+<2*.RPCNT> + CLR CHOSTS+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ T300P, CLR RQBACT +.IFNZ NCT + MOV #NFTTY,I +76$: MOV NRMIPC(I),TTYIPC(I) + ADD #2,I + CMP I,#LASTTY + BLE 76$ + MOV #TYORNG,B ;CLEAR THE TYPOUT-DONE RING + CALL CLRING + MOV #,A ;GIVE OUTPUT DONE ON ALL LINES +78$: CALL PUT + INC A + CMP A,#+NCT + BLO 78$ +.ENDC ;NCT +.IFNZ NDMS +;;; Turn on DM11-BBs + CLR B ;iterated over DM11 units + MOV #NDMS,H +5$: MOV #DMCLR+DMCSN,@DMCSR(B) ;CLEAR SCANNER MEMORY +2$: BIT #DMBSY,@DMCSR(B) + BNE 2$ + CLR I ;iterated over modem channels + ;; turn on connected modem channels for one DM11 + CLR A ;counter for channels per unit +3$: TST M2LMAP(I) + BEQ 4$ + MOV A,@DMCSR(B) + MOV #LINENB,@DMLSR(B) +4$: TST (I)+ + INC A + CMP A,#16. + BLT 3$ + TST (B)+ + SOB H,5$ ;next DM11 + ;; treat first-time interrupts differently + SETOM DMINI + CLR B + MOV #NDMS,A +6$: MOV #DMSCN+DMIEN,@DMCSR(B) ;enable scanner interrupts + TST (B)+ + SOB A,6$ ;on all DMs + MOV #20000.,A + SOB A,. ;DELAY 50 MILLISECONDS + CLR DMINI ;WHILE P.I. LEVEL GETS INITIAL STATUS +.ENDC ;NDMS + +.IFG NDHS +;TURN ON DH11'S + MOV #NLDHHX,H +DHINIL: MOV DHSCR(H),A ;DEVICE ADDRESS + MOV #100000,16(A) ;TURN ON SILO MAINTENANCE MODE, SUSPECTED OF + ;LOSING + MOV #4000,(A) ;RESET DH11 + MOV 16(A),B ;CHECK SILO STATUS + BIC #300,B ;THESE BITS ARE IN RAM & DON'T CLEAR + BEQ DHSWIN ;SHOULD HAVE CLEARED MAINTENANCE MODE AND OTHER CRUD +DHSLUZ: BPT ;LOSE +DHSWIN: MOV #DHRENB+DHTENB,(A) ;NOW ENABLE INTERRUPTS ON DH11 + SUB #2,H + BGE DHINIL +.ENDC ;NDHS + +;TURN ON DL11S +.IFG NDLS + MOV #NLDLHX,H + MOV #NDLS-1,A +21$: +.IIF NZ DTE20P, BEQ 22$ ;NO KBD INT ON KL10 CTY DUE TO KLDCP LOSSAGE + MOV #103,@DLKS(H) ;ACTIVATE KEYBOARD INTERRUPT, D.T.R., READER +22$: MOV #100,@DLPS(H) ;ACTIVATE PRINTER INTERRUPT + SUB #2,H + DEC A + BPL 21$ +.ENDC ;NDLS + +;SET LINE PARAMETERS AND ALLOCATE BUFFERS +.IFNZ NCT + MOV #NFTTY,I +10$: MOV LPRVAL(I),A + MOV BUFSIZ(I),B + CALL SPARAM + ADD #2,I + CMP I,#LASTTY + BLE 10$ +.ENDC ;NCT + +;TURN ON CLOCK +.IIF Z DTE20P, MOV #100,@#LKS ;NO CLOCK INTERRUPTS IF KLDCP IS HACKING CLOCK TOO + +.IFNZ DTE20P +;INITIALIZE DTE20 + MOV #37774,DLYCNT ;DMA TO BANK 0, 2 USEC DELAY + MOV #%D3BYT,DIAG3 ;DO TO10 TRANSFERS IN BYTE MODE + MOV #MAIN,SADR ;ONLY DO INIT ONCE +.ENDC ;DTE20P +.IIF NZ TEN11P, SETOM T11I10 ;CAUSE 10 TO REINITIALIZE TEN-11 CHAOS +.REPT CHAOSP + MOV CHIHWR+CHXCHS+<2*.RPCNT>,H ;ADDRESS THE INTERFACE + CONC ,\.RPCNT ;CHECK THE HOST NUMBER SWITCHES AGAINST THE PROGRAM + BEQ .+4 + BPT + BIS #%CAREN,(H) ;ENABLE CHAOS NET INPUT INT +.ENDR ;CHAOSP +.IFNZ ETHERP + MOV CHIHWR+CHXETH,H ;ADDRESS THE INTERFACE + MOV 16(H),A ;GET HOST NUMBER SWITCHES + COMB A ;FIX XEROX MISTAKE + CMPB A,#ETHHSN ;CHECK HOST NUMBER SWITCHES + BEQ .+4 + BPT + MOV #CHXETH,I ;ENABLE TO RECEIVE FIRST ETHERNET PACKET + CALL ETHRFL +.ENDC ;ETHERP +;GO + JMP MAIN + +.IFNZ GOULDP +.SBTTL GOULD PRINTER BUFFERS + +GLPOIP: GLPBFF ;NEXT BUFFER IN AT M.P. LEVEL +GLPOOP: GLPBFF ;NEXT BUFFER OUT AT P.I. LEVEL + + .REPT NGLPBF ;ASSEMBLE THE BUFFERS + 0 .SEE GB.STA + GLPBFF ;DUE TO PALX BUG, LEAVE .SEE ON NEXT LINE + .SEE GB.NXT +GLPBFF==.-4 + 0 .SEE GB.FF + 0 .SEE GB.NL + 0 .SEE GB.PNT + .BLKB GLPBSZ + .ENDR +.ENDC ;GOULDP + + .SBTTL "TTYTYP" PARAMETER FILE + +T LPRVAL: + .BLKW NCT ;DH11 PARAMETER REG + +BUFFRS: ;BEGIN ALLOCATING BUFFERS HERE + +.IIF NZ NCT, INFORM ,\BUFFRS +ZZ===+3777>/4000 ;NUMBER OF K USED +.IRP ZZZZ,<0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16> +.LIF EQ ZZ-.IRPCNT ;THIS IS A CRETINOUS CROCK TO GET IT COME OUT IN DECIMAL +INFORM ,\BUFFRS+,< (>,ZZZZ, +.ENDR + +.IFNZ NCT ;TTYTYP FILE ONLY IF WE HAVE TTYS +.IF P2 ;SPEED UP THE ASSEMBLY +OFF==69105 ;KLUDGES SO I DON'T HAVE TO PUT KEYWORD PARAMETERS INTO PALX +40K==40000 +80K==80000 + +.MACRO SPEED BAUD +ZZ==-1 +.IIF EQ BAUD-OFF, ZZ==0 +.IIF EQ BAUD-50, ZZ==1 +.IIF EQ BAUD-75, ZZ==2 +.IIF EQ BAUD-110, ZZ==3 +.IIF EQ BAUD-134, ZZ==4 +.IIF EQ BAUD-150, ZZ==5 +.IIF EQ BAUD-200, ZZ==6 +.IIF EQ BAUD-300, ZZ==7 +.IIF EQ BAUD-600, ZZ==10 +.IIF EQ BAUD-1200, ZZ==11 +.IIF EQ BAUD-1800, ZZ==12 +.IIF EQ BAUD-2400, ZZ==13 +.IIF EQ BAUD-4800, ZZ==14 +.IIF EQ BAUD-9600, ZZ==15 +.IIF EQ BAUD-80K, ZZ==16 +.IIF EQ BAUD-40K, ZZ==17 +.IIF LT ZZ, .ERROR UNRECOGNIZED SPEED "BAUD" +.ENDM SPEED + +.MACRO IPARM N,ODFLT,IDFLT,MUMLST +.IF GE <2*N>-NFTTY +.IF LE <2*N>-LASTTY +%%.ISPEED==-1 +%%.SPEED==-1 +.IRP MUM, +.IF NB + ZZ==0 + .IRPC MUMB, + .IIF GE .IRPCNT-2, .MEXIT + .IIF IDN MUMB,S, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,P, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .IIF IDN MUMB,I, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,S, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .ENDM + .IIF EQ ZZ-2, %%.'MUM + .ENDC +.ENDM +.IF LT %%.ISPEED + .IIF LT %%.SPEED, %%.ISPEED==IDFLT + .IELSE %%.ISPEED==%%.SPEED +.ENDC +.IIF LT %%.SPEED, %%.SPEED==ODFLT +SPEED %%.ISPEED +IZZ==ZZ +SPEED %%.SPEED +; BUFFER SIZE IS 1/2 SECOND'S TYPING +; BUT WILL BE SUBJECT TO LIMIT OF MAXBSZ +.IIF LT ZZ-7, BZZ==5. +.IIF EQ ZZ-7, BZZ==15. +.IIF EQ ZZ-10, BZZ==30. +.IIF EQ ZZ-11, BZZ==60. +.IIF EQ ZZ-12, BZZ==90. +.IIF EQ ZZ-13, BZZ==120. +.IIF EQ ZZ-14, BZZ==240. +.IIF EQ ZZ-15, BZZ==480. +.IIF GT ZZ-15, BZZ==1000. +.=LPRVAL+<2*N> ;ASSEMBLE LINE PARAMETER WORD +.IIF NE ZZ-3, ++3 ;ISPEED, OSPEED, NO PARITY, 8 BITS, FULL DUPLEX +.IELSE ++3+4 ;110 BAUD EXTRA STOP BIT +.=BUFSIZ+<2*N> +BZZ ;ASSEMBLE BUFFER SIZE +.ENDC +.ENDC +.ENDM IPARM + +;MACROS USED IN THE TTYTYP FILE: + +.MACRO TTDPRT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDPRT + +.MACRO TTDMRX TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,600,600, +.ENDM TTDMRX + +.MACRO TTDTRM TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTRM + +.MACRO TTDLPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDLPT + +.MACRO TTDLA36 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDLA36 + +.MACRO TTDIML TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,50K,25K, +.ENDM TTDIML + +.MACRO TTDVT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDVT + +.MACRO TTDTEK TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTEK + +.MACRO TTDLSR TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDLSR + +.MACRO TTDDPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDDPT + +.MACRO TTDGT40 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTDGT40 + +.MACRO TTDRAY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTDH19 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTD11 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTD11 + +.MACRO TTDRAN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDRAN + +.MACRO TTDTV TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDTV + +.MACRO TTDGRN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDGRN + +.MACRO TTDSTY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDSTY + +.MACRO REPEAT N,FOO +FAKOUT: .REPT N +FAKOUT===0 +.ENDM + +NSTTYS==0 ;WE'RE NOT INTERESTED IN PSEUDO-TTYS +N11TYS==0 ;NOR IN PDP11 TVS + +.INSRT SYSTEM;TTYTYP > + +.EXPUNGE ZZ,IZZ,IZZZ,BZZ,OFF,40K,80K,%%.ISPEED,%%.SPEED +.EXPUNGE TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED + +.ENDC ;P2 + +.ENDC ;NCT + +.END INIT diff --git a/system/ioelev.431 b/system/ioelev.431 new file mode 100644 index 0000000..d7a7ba3 --- /dev/null +++ b/system/ioelev.431 @@ -0,0 +1,4960 @@ +;;; -*-PALX-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + .TITLE IOELEVEN + + .SBTTL DEFINITIONS + +;;; note that the .IFM macro must be used only at toplevel +;;; (non-conditionalized) in PALX because it doesn't do the expansion of .IFM +;;; when conditionalized out, therefore it doesn't match it with the +;;; following .ENDC and the .ENDC will be seen at toplevel and end the +;;; conditionalization one is in. This will screw the code running on +;;; another one of the machines even if it doesn't signal an error in your +;;; assembly. --PGS + +.LIF NZ 0 + .FATAL USE PALX DUMMY!! + +;NOTE THAT THIS PROGRAM IS DESIGNED FOR 11/40'S. TO RUN ON AN +;11/10, MACRO OUT THE SOB INSTRUCTIONS. DOES NOT USE EIS NOR FIS. + +A=%0 ;TEMP/ARG/CHAR +B=%1 ;TEMP/ARG +C=%2 ;TEMP/ARG +D=%3 ;TEMP/ARG +H=%4 ;USUALLY INDEX IN HARDWARE UNIT TABLES +I=%5 ;USUALLY LINE NUMBER TIMES 2 +SP=%6 ;STACK POINTER +PC=%7 ;PROGRAM POINTER +PS=177776 ;PROGRAM STATUS +SWR=177570 ;SWITCHES + +.MACRO RTI +.ENDM ;FUCKING PALX! + +RTI=RTT ;11/40 HARDWARE MISFEATURE + +.IF P1 +.PRINT /MACHINE NAME = / +.TTYMAC MNAM +%TTYFLG==%TTYFLG+1 +.PRINT /MNAM +/ +%TTYFLG==%TTYFLG-1 +.MACRO .IFM MCHN ;REFERS TO PDP11 NAME +.IF IDN MCHN,MNAM +.ENDM .IFM +.MACRO MCONDX MCHN ;REFERS TO ITS SYSTEM NAME, USUALLY THE SAME +.IF IDN MCHN,MNAM +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY ;INSERT ITS SYSTEM NAME INTO BODY IN PLACE OF "MCHN" +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME +.ENDM ;TTYMAC +.ENDC ;P1 + +VERSION==%FNAM2 + +.IFM MX-DL ;MX'S DL-10 PDP11 +.MACRO MCONDX MCHN +.IF IDN MCHN,MX +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME + +DL10P==1 ;HAS DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==0 ;HAS DDT +NFTTY==102 ;2 * # OF FIRST TTY THIS 11 +NDHS==1 ;NUMBER OF DH11'S +NDHUN==15 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE (REST IN PEACE) +;MPXIDX==2*27 ;TTY INDEX OF LINE THAT MULTIPLEXED TTYS RUN OVER +NDMS==0 ;HAS DM11BB MODEM SCANNER (BUT IT'S NOT CONNECTED TO ANYTHING) +GOULDP==0 ;DOESN'T HAVE GOULD LPT (ANYMORE) +T300P==1 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB=0 ;CHAOSNET INTERFACE IS NEW, DOESN'T GET HUNG ANY MORE +CHAD0==440 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF +DLCADR==1440 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA DL10 (MX) +CHAD1==3040 ;SECOND INTERFACE +TEN11P==0 ;NO TEN-11 INTERFACE +ETHERP==0 ;NO ETHERNET +FTPULS==0 ;INITIALLY, MX DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;SAVE LAST GARBAGE PACKET RECEIVED +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;MX-DL + +.IFM MX ;MX CONSOLE 11 +DL10P==0 ;DOES NOT HAVE DL10 +DTE20P==1 ;HAS DTE20 +NODDT==0 ;HAS DDT AND KLDCP +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==2 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==310 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==1 ;FIRST DL11 IS T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS THAT GO THROUGH MULTIPLEXED LINE (NONE) +NDMS==2 ;has 2 DM11BB modem scanners (really DH11AD) +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==0 ;NO CHAOS NET INTERFACE +TEN11P==0 ;NO TEN-11 CHAOS INTERFACE +ETHERP==0 ;NO ETHERNET +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE + +.MACRO ASPIRP BODY ;DEFINE LINE #S WITH AUTOSPEED +.IRP N,<1,3,4,5,6,7,10,11,12,13,14,15,16,17> + BODY +.ENDM +.ENDM ASPIRP + +TKS==177560 +TKB==177562 +TPS==177564 +TPB==177566 +.ENDC ;MX + +.IFM AI ;AI'S CHAOS-ETHER-GATEWAY PDP11 + +;THIS IS A PDP11/10, WE HAVE TO REDEFINE A FEW THINGS +.MACRO RTT +.ENDM +RTI==2 +RTT==2 +.MACRO SOB REG,TAG + DEC REG + BNE TAG +.ENDM SOB + +DL10P==0 ;HAS NO DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==1 ;DOESN'T HAVE DDT (USE CARPET) +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==0 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==0 ;NUMBER OF DL11'S (ACTUALLY HAS ONE, BUT WE'RE NOT USING IT NOW) +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE +NDMS==0 ;HAS NO DM11BB MODEM SCANNERS +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB==0 ;CHAOSNET INTERFACE IS NEW-STYLE, DOES NOT GET HUNG +;CHAD0==426 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF (AI-MC-CROSS-STREET SUBNET) +;CHAD1==3072 ;SECOND INTERFACE (9TH FLOOR LISP MACHINE SUBNET) +CHAD0==3072 ;Change these two around because subnet 1 is dying of old age. +CHAD1==426 ;Note that with current code AI-11 can only do DOVER on CHAD0!! +TEN11P==0 ;USES TEN-11 INTERFACE FOR CHAOS NET TO AI-10 (NOT ANY MORE!) +T11ADR==2026 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA TEN-11 INTERFACE (AI) +NT11BF==3 ;THREE BUFFERS IN EACH DIRECTION FOR TEN-11 INTERFACE +ETHERP==1 ;ETHERNET +ETHHSN==6 ;MY HOST NUMBER BYTE, JNC SAYS I SHOULD USE 6 +NDVRBF==6 ;6 DOVER BUFFERS +DVRADR==1002 ;PUP ADDRESS OF DOVER +FTPULS==0 ;INITIALLY, AI DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;DON'T SAVE LAST GARBAGE PACKET RECEIVED (LOW ON CORE) (not that low) +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;AI + +.IIF NDF NDHS, .ERROR MACHINE NAME NOT RECOGNIZED + +.IIF NZ DL10P, .IIF Z NFTTY, .ERROR TTY # 0 DOESN'T WORK WITH DL10 PROTOCOL + +;ASSIGN TTY INDICES, HARDWARE INDICES, ETC. + +TX==NFTTY ;TTY INDEX +HX==0 ;HARDWARE INDEX +NCT==0 ;NUMBER OF TTYS + +;SYSTEM CONSOLE (OUT OF ORDER) +.IFNZ CTYP + TX==TX+2 + NCT==NCT+1 +.ENDC + +;DH11 LINES + NFDHTY==TX + TX==TX+<32.*NDHS> + NCT==NCT+<16.*NDHS> + HX==HX+<2*NDHS> + NLDHHX==HX-2 ;UNITS 0-NLDHHX INCLUSIVE ARE DH11S + + TX==TX-<2*NDHUN> ;COMPENSATE FOR UNUSED LINES + NLDHTY==TX-2 ;LAST DH11 LINE INCLUSIVE + NCT==NCT-NDHUN + +;DL11 LINES + NFDLTY==TX + NFDLHX==HX + TX==TX+<2*NDLS>-<2*CTYP> + HX==HX+<2*NDLS> + NLDLHX==HX-2 + NCT==NCT+NDLS-CTYP + +;MULTIPLEXOR LINES + NFMPTY==TX + MPKHWR==HX + TX==TX+<2*NMPTYS> + HX==HX+2 + NCT==NCT+NMPTYS + +NLTTY==NFTTY+<2*NCT> ;2 * # OF FIRST TTY NOT THIS 11 +LASTTY==NLTTY-2 ;LAST VALID TTY INDEX + +.IFNZ NDMS ;DM11-BB MODEM SCANNER + + ;1.1-1.4 MODEM CHANNEL # + DMBSY==20 ;1.5 SCAN BUSY (R.O.) + DMSCN==40 ;1.6 SCANNER ON + DMIEN==100 ;1.7 INTERRUPT ENABLE + DMDON==200 ;1.8 DONE - SCANNER HAS FOUND SOMETHING + DMSTP==400 ;1.9 STEP SCANNER TO NEXT LINE (W.O.) 1.2 USEC. + ;2.1 MAINTENANCE MODE + DMCLR==2000 ;2.2 CLEAR RTS, DTR, SEC TX, LINE EN FOR ALL LINES (W.O.) + DMCSN==4000 ;2.3 CLEAR SCAN - CLEAR CSR AND MODEM STATUS MEMORY (W.O.) 19 USEC + DM2RX==10000 ;2.4 SECONDARY RECIEVE CHANGED ON SELECTED MODEM (R.O.) + DMCTS==20000 ;2.5 CLEAR TO SEND CHANGED ON SELECTED MODEM (R.O.) + DMCAR==40000 ;2.6 CARRIER DETECT CHANGED ON SELECTED MODEM (R.O.) + DMRNG==100000 ;2.7 RING CHANGED ON SELECTED MODEM (R.O.) + + LINENB==1 ;1.1 ENABLE SCANNING OF LINE + LINDTR==2 ;1.2 DATA TERMINAL READY + LINRQS==4 ;1.3 REQUEST TO SEND (FORCE BUSY ON 103E) + LIN2TX==10 ;1.4 SECONDARY TRANSMIT + LIN2RX==20 ;1.5 SECONDARY RECEIVE (R.O.) + LINCTS==40 ;1.6 CLEAR TO SEND (R.O.) + LINCAR==100 ;1.7 CARRIER DETECT (R.O.) + LINRNG==200 ;1.8 RING (R.O.) +.ENDC ;NDMS + +; KW11-L LINE FREQ CLOCK + +LKS=177546 ;1.8 CLOCK FLAG + ;1.7 INTER ENB +HNGDLY==3*60. ;CLEAR TO SEND OFF FOR 3 SECONDS => HANGUP + +.IFNZ GOULDP +;DEFINITIONS FOR GOULD LPT + +GLPCSR=166000 ;COMMAND STATUS REGISTER (NONSTANDARD) + ;COMMAND CODES + %GCFF==0 ;TOP-OF-FORM COMMAND + %GCGRF==1 ;GRAPHIC MODE COMMAND + %GCCUT==2 ;CUT COMMAND (NO CUTTER ON THIS MACHINE, THOUGH) + %GCON==3 ;TURN PRINTER ON + %GCOFF==4 ;TURN PRINTER OFF + %GCLSL==5 ;LAST LINE (GRAPHIC MODE). => 2 MORE SCAN LINES. + %GCION==6 ;INTERRUPT ON + %GCIOF==7 ;INTERRUPT OFF + %GCADV==201 ;ADVANCE ONE LINE + ;STATUS BITS + %GSNRD==400 ;NOT READY + %GSDON==2000 ;TRANSFER COMPLETE + %GSBSY==4000 ;BUSY + %GSVAC==10000 ;VACUUM FAULT + %GSPAP==20000 ;PAPER LOW + %GSTIM==40000 ;TIMEOUT + %GSERR==50400 ;ALL ERROR BITS + +GLPWC=166002 ;NEGATIVE WORD COUNT REG + +GLPCA=166004 ;CURRENT ADDRESS REG + +GLPBSZ==132. ;BUFFER SIZE (# CHARS PER LINE) + +NGLPBF==7 ;NUMBER OF BUFFERS + GB.STA==0 ;BUFFER STATE - DON'T CHANGE ORDER OF %GB CODES + %GBIDL==0 ;0 IDLE + %GBMP==2 ;2 ACTIVE AT M.P. LEVEL + %GBWRT==4 ;4 IN WRITE QUEUE + %GBPI==6 ;6 ACTIVE AT P.I. LEVEL + %GBDMA==8 ;8 ACTIVE AT D.M.A. LEVEL + GB.NXT==2 ;CIRC POINTER TO NEXT BUFFER + GB.FF==4 ;IF NON-ZERO, FF BEFORE THIS BUFFER + GB.NL==6 ;NUMBER OF BLANK LINES BEFORE THIS BUFFER + GB.PNT==10 ;-> NEXT BYTE TO INSERT + GB.DAT==12 ;DATA BEGINS HERE + GB.LEN==GB.DAT+GLPBSZ ;TOTAL NUMBER OF BYTES PER BUFFER + +.ENDC ;GOULDP + +.IFNZ CHAOSP +;DEFINITIONS OF CHAOS NET HARDWARE + +;USUAL ADDRESS IS 764140 . USUAL INTERRUPT VECTOR IS 270 . + +CAICSR=164140 ;COMMAND STATUS REG +CH%CSR==0 + %CABSY==1 ;0 XMT BUSY (RO) + %CALUP==2 ;1 LOOP BACK (R/W) + %CASPY==4 ;2 RECIEVE MSGS FOR ANY DESTINATION (R/W) + %CARCL==10 ;3 CLEAR THE RECEIVER, IT CAN NOW GOBBLE ANOTHER MSG (WO) + %CAREN==20 ;4 RCV INT ENB (R/W) + %CATEN==40 ;5 XMT INT ENB (R/W) + %CATAB==100 ;6 TRANSMIT ABORTED BY ETHER CONFLICT (RO) + %CATDN==200 ;7 TRANSMIT DONE. SET WHEN TRANSMITTER IS DONE + %CATCL==400 ;8 CLEAR THE TRANSMITTER, MAKING IT READY (WO) + ;9-12 LOST COUNT (RO) [# MSGS RCVED WITH RCV BFR FULL] + ; WHEN MSG IS WAITING IN BUFFER, THIS COUNTS + ; THE MESSAGES THAT MATCHED OUR DESTINATION OR + ; WERE BROADCAST, BUT COULDN'T BE RECIEVED. + ; WHEN RECEIVER IS RE-ENABLED (WRITE 1 INTO %CARDN) + ; THE COUNT IS THEN CLEARED. + ; WHEN A MESSAGE IS LOST, RECEIVER ZAPS ETHER + ; SO TRANSMITTER WILL ABORT (IF MESSAGE WAS DESTINED + ; TO US.) + %CARST==20000 ;13 I/O RESET (WO) + %CAERR==40000 ;14 CRC ERROR (RO) + %CARDN==100000 ;15 RCV DONE. + +CAIMYN=164142 ;MY # (READ ONLY) +CH%MYN==2 ;RETURNS THE [SOURCE] HOST# OF THIS INTERFACE. + +CAIWBF=164142 ;WRITE BUFFER (WRITE ONLY) +CH%WBF==2 ;FIRST WAIT FOR TDONE. (OR SET IT VIA CSR) + ;FIRST WORD IN RESETS TRANSMITTER AND CLEARS TDONE. + ;STORE INTO THIS REGISTER TO WRITE WORDS OF MESSAGE, + ;LAST WORD IN IS DESTINATION ADDRESS, THEN READ CAIXMT. + ;SOURCE ADDRESS AND CHECK WORD PUT IN BY HARDWARE. + +CAIRBF=164144 ;READ BUFFER (READ ONLY) +CH%RBF==4 ;THE FIRST WORD READ WILL BE FILLED TO THE LEFT + ;TO MAKE THE MESSAGE RECIEVED A MULTIPLE OF 16 BITS. + ;IF THE NUMBER OF DATA BITS IN THE MESSAGE WAS A + ;MULTIPLE OF 16, THIS WORD WILL BE THE FIRST WORD PUT + ;INTO THE BUFFER BY THE TRANSMITTING HOST. + ;THE LAST 3 WORDS READ ARE DESTINATION, SOURCE, CHECK. + +CAIRBC=164146 ;RECEIVE BIT COUNTER (READ ONLY) +CH%RBC==6 ;WHEN A MESSAGE HAS BEEN RECEIVED THIS IS ONE LESS THAN + ;THE NUMBER OF BITS IN THE MESSAGE (16 X THE + ;NUMBER OF WORDS INCLUDING THE THREE OVERHEAD WORDS.) + ;AFTER THE LAST WORD (THE CRC WORD) HAS BEEN READ, IT IS 7777 + ;BITS 10 AND 11 ARE THE HIGH ORDER BITS, AND IF THEY ARE ONE, + ;THEN THERE WAS A BUFFER OVERFLOW + +CAIXMT=164152 ;READING THIS INITIATES TRANSMISSION (!!) +CH%XMT==12 ;THE VALUE READ IS ONE'S OWN HOST#. + +;REFERENCING ADDRESSES IN THE GROUP OF 8 WORDS NOT LISTED HERE, OR +;USING COMBINATIONS OF READ/WRITE NOT LISTED HERE, WILL TYPICALLY CAUSE +;STRANGE AND BIZARRE EFFECTS. + +;PACKET DEFINITIONS +;THESE ARE FOR 4K PACKET BUFFERS AND FOR THE ORIGINAL CHAOSNET PROTOCOL + +PKMAX==256. ;MAXIMUM LENGTH OF PACKET (INCLUDING ALL HARDWARE WORDS) +DATMAX==488. ;MAXIMUM NUMBER OF DATA BYTES +PKHDW==8 ;NUMBER OF HEADER WORDS +PKTMXW==+PKHDW ;MAX WORDS THROUGH PACKET SWITCH (SEE MOVDH ETC.) + +PKOP==1 ;BYTE INDEX OF THE OPCODE OF THE PACKET + %CORFC==1 + %COOPN==2 + %COCLS==3 + %COANS==5 + %COSNS==6 + %COSTS==7 + %CORUT==10 + %COLOS==11 + %COEOF==14 + %COUNC==15 +PKNBYT==2 ;WORD INDEX OF NUMBER OF BYTES IN PACKET +PKNBMS==170000 ;MASK FOR THE NUMBER OF BYTES +PKFC==2 ;WORD INDEX FOR THE FORWARD COUNT +PKFCMS==7777 ;IT IS THE TOP 4 BITS +PKDHST==4 ;DESTINATION HOST +PKDIND==6 ; " " " INDEX +PKSHST==10 ;SOURCE HOST +PKSIND==12 ;SOURCE INDEX +PKPKN==14 ;THE PACKET NUMBER +PKACN==16 ;THE ACK PACKET NUMBER +PKDAT==20 ;THE START OF THE DATA +.ENDC ;CHAOSP + +;STANDARD MACROS + +.MACRO PUSH X +.IRP Y, + MOV Y,-(SP) +.ENDM +.ENDM + +.MACRO POP X +.IRP Y, + MOV (SP)+,Y +.ENDM +.ENDM + +.MACRO CALL X + JSR PC,X +.ENDM + +.MACRO RET + RTS PC +.ENDM + +.MACRO SETOM LOC + ZZ===%COMPAT ;DON'T CARE WHETHER .+2 OR .+4 GETS STORED + %COMPAT===0 + MOV PC,LOC + %COMPAT===ZZ +.ENDM + +.MACRO MASK LEVEL + PUSH PS + MOV #_5,PS +.ENDM + +.MACRO UNMASK + POP PS +.ENDM + +.MACRO W +.=.+2 +.ENDM + +.MACRO T TAG ;usage is T TAG: STMNT +.=.-NFTTY +TAG +.=.+NFTTY +.ENDM + +.MACRO CONC A,B,C,D,E,F,G +A'B'C'D'E'F'G +.ENDM + +.MACRO INFORM A,B,C,D,E,F,G +.IF P1 +.PRINT /A'B'C'D'E'F'G +/ +.ENDC +.ENDM + +.MACRO MSG X +.NCHR ZZ,^\X\ + .WORD ZZ + .ASCII \X\ + .EVEN +.ENDM + +.MACRO .IREPT N,BOD +.REPT N +BOD +.ENDR +.ENDM + .IFNZ DL10P + .SBTTL DL10 CONTROL AREA + +ZZ==. +.=100000 + +DLXCSR: W ;DL10 11-SIDE CONTROL & STATUS REG + ;1.1-1.2 PIA + DLXIEN==4 ;1.3 ENABLE DLX11I TO INTERRUPT + DLXEEN==10 ;1.4 ENABLE ERRORS TO INTERRUPT + ;1.5 UNUSED + DLXPRT==40 ;1.6 PORT ENABLE (R.O.) + DLXZWC==100 ;1.7 CLEAR DLXWCO (W.O.) + DLXWCO==200 ;1.8 WORD COUNT OVERFLOW + DLXZPA==400 ;1.9 CLEAR DLXPAR (W.O.) + DLXPAR==1000 ;2.1 PAR ERR IN 10 MEM + DLXZNX==2000 ;2.2 CLEAR DLXNXM (W.O.) + DLXNXM==4000 ;2.3 NXM IN 10 MEM + DLXZ10==10000 ;2.4 CLEAR DLX10I (W.O.) + DLX10I==20000 ;2.5 INTERRUPT PDP10 + DLXZ11==40000 ;2.6 CLEAR DLX11I (W.O.) + DLX11I==100000 ;2.7 INTERRUPT PDP11 + +VERS: W ;.BYTE FIRST LINE, # OF LINES + ;SET BY -10. USED TO CHECK CONSISTENCY. + +DLXUP: W ;CHECK FOR UP-NESS IN BOTH DIRECTIONS + ;INCREMENTED BY 11 EVERY 1/60 SECOND, SETOM'ED BY 10 EVERY 1/2 SEC. + +TTYST: W ;LINE# TO START OUTPUT ON (I.E. SET OUTPUT DONE) + ;SET BY 10, CLEARED BY 11 + +TYILIN: W ;TYPEIN STATUS WORD - LINE NUMBER + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYICHR: W ;TYPEIN CHARACTER - GOES WITH PRECEDING WORD + +TYOSTS: W ;STATUS WORD (OUTPUT DONE LINE #) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYOBSZ: W ;BUFFER SIZE FOR LINE WITH OUTPUT DINE (SET BY 11) + +TYOPNT: W ;BUFFER POINTER FOR TTY OUTPUT + ;SET BY 10 +TYOCNT: W ;BUFFER LENGTH FOR TTY OUTPUT + ;SET BY 10 +TYOLIN: W ;LINE NUMBER FOR TTY OUTPUT + ;SET BY 10, CLEARED BY 11 + +HNGLIN: W ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 + +LPRLIN: W ;LINE NUMBER FOR SETTING LINE PARAMETERS + ;SET BY 10, CLEARED BY 11 +LPRLPR: W ;DH11 LPR REGISTER FOR SETTING LINE PARAMETERS + ;SET BY 10 +LPRBSZ: W ;BUFFER SIZE FOR SETTING LINE PARAMETERS + ;SET BY 10 + +EXDSTS: W ;STATUS WORD (EXAMINE/DEPOSIT 11 CORE) + ;1 = EXAMINE, 2 = DEPOSIT + ;SET BY 10, CLEARED BY 11 +EXDADR: W ;ADDRESS FOR ABOVE + ;SET BY 10 +EXDDAT: W ;DATA WORD FOR ABOVE + ;SET BY 10 (DEPOSIT) OR 11 (EXAMINE) + +GLPPTR: W ;BUFFER POINTER FOR GOULD OUTPUT +GLPCTR: W ;NUMBER OF BYTES YET TO BE GOBBLED +GLPTER: W ;ERROR STATUS, SET BY 11 +GLPGRF: W ;GRAPHIC MODE IF NON-ZERO, SET BY 10 + +;CHAOS NET SHARED VARIABLES +DLCINI: W ;WHEN THIS IS NON-ZERO, 11 RESETS ITS POINTERS AND CLEARS IT +DLCSP1: W ;SEND PACKET 1 (ILDB POINTER) +DLCSP2: W ;SEND PACKET 2 +DLCSS1: W ;SEND STATE 1 (0 IDLE, 1 TO 11, 2 OUTPUT DONE) +DLCSS2: W ;SEND STATE 2 +DLCRP1: W ;RECEIVE PACKET 1 (ILDB POINTER) +DLCRP2: W ;RECEIVE PACKET 2 +DLCRS1: W ;RECEIVE STATE 1 (0 IDLE, 1 READY FOR INPUT FROM 11, 2 INPUT DONE) +DLCRS2: W ;RECEIVE STATE 2 + +;^ ADD MORE HERE, E.G. IMP + +.IFNZ T300P +;DISK AREA. 14. WORDS 48. WORDS INTO THE DL-10 AREA. +.=100000+<60*2> + +DSCCHK: W ;MUST BE 2561 OCTAL TO MAKE SURE WE HAVE CORRECT PDP-10 PROGRAM +DSCREQ: W ;0 MEANS NO REQUEST. NON-ZERO MEANS 10 HAS PENDING REQUEST TO 11. +DSCDON: W ;0 MEANS NOT DONE, NON-ZERO MEANS 11 IS TELLING 10 IT'S DONE. +;NEXT 2 WORDS WRITTEN BY 11 TO TELL STATUS OF OPERATION +DSCFLT: W ;0 NO FAULT + %DFRST==100000 ; BIT 15=POWER CYCLED OR UNIBUS HUNG, SO CONTROLLER WAS RESET + ; BIT 12=Q ERROR, BIT 11=CMD NXM, BIT 10=CMD PAR + ; IF ONE OF THESE BITS IS ON, BITS 1-0 AND DSCSTS ARE THE ERROR ADDRESS + ; BITS 7-0 SYSTEM FAULT CODE IF LEFT BYTE IS ZERO + ; SEE THE 2561 OEM MANUAL FOR MEANING OF FAULT CODES +DSCSTS: W ;STATUS FROM 2561: + %DSRTR==100000 ;COMMAND WAS RETRIED + %DSECH==40000 ;UNCORRECTABLE DATA ERROR (ECC HARD) + %DSECC==20000 ;CORRECTED DATA ERROR + %DSIDE==10000 ;ID ERROR + %DSHCE==4000 ;ADDRESS ERROR (HEADER COMPARE ERROR) + %DSPRT==2000 ;WRITE-PROTECT STATUS OF SECTOR (ABORTS WRITE COMMAND) + %DSALT==1000 ;ALTERNATE-SECTOR STATUS (ABORTS READ, WRITE, AND CHECK) + %DSOVR==400 ;FIFO OVER-RUN, NOT CORRECTED BY 1 RETRY + %DSSKE==200 ;SEEK ERROR FROM DRIVE + %DSOFL==100 ;DRIVE OFF-LINE OR FAULT + %DSFLT==20 ;DRIVE FAULT + %DSNXM==10 ;NXM ON PDP11 MEMORY + %DSPAR==4 ;PARITY ERROR IN PDP11 MEMORY + %DSSFL==2 ;SYSTEM FAULT, SEE LOW BYTE OF DSCFLT + %DSWLK==1 ;DRIVE WRITE-LOCKED, WRITE ABORTED + +;FOLLOWING WORDS ARE WRITTEN BY 10 TO TELL WHAT TO DO +DSCCMD: W ;COMMAND OPCODE: + ;%DMNOP==0 ;DO NOTHING + ;%DMCST==1 ;READ OUT CONTROLLER STATE (NOT USEFUL SINCE NOT RETURNED TO 10) + %DMSNS==2 ;SENSE DRIVE STATE. DSCSTS GETS CODE FOR DRIVE TYPE IN + ; BITS 14-8 (10 FOR T-300), AND %DSWLK, %DSFLT, %DSOFL, %DSSKE + %DMTST==3 ;TEST SPECIFIED DRIVE (RUNS DIAGNOSTICS) + %DMREC==4 ;RECALIBRATE + %DMSEK==5 ;SEEK + %DMWRT==6 ;WRITE DATA + ;%DMFMT==7 ;WRITE FORMAT + ;%DMPWT==10 ;WRITE AND SET WRITE-PROTECT BIT + ;%DMAWT==11 ;WRITE AND SET ALTERNATE-SECTOR BIT + ;%DMCHK==12 ;READ AND CHECK ECC BUT DON'T STORE DATA + ;%DMLWT==14 ;LONG WRITE, WILL WRITE ECC AS WELL AS DATA + %DMRED==20 ;READ DATA. ADD 1-10 FOR VARIOUS RECOVERY FEATURES AS + ; DOCUMENTED IN THE 2561 OEM MANUAL. + ;%DMRID==40 ;READ IF FIELD, NOT USEFUL SINCE NOT RETURNED TO 10 +DSCDRV: W ;UNIT NUMBER +DSCCYL: W ;CYLINDER ADDRESS (THESE ARE COPIED BACK BY THE 11 IN CASE OF ERROR) +DSCHED: W ;HEAD ADDRESS +DSCSEC: W ;SECTOR ADDRESS +;WORD COUNT IS ALWAYS 12.*256. +;IF WE PUT IN SEEK-OVERLAP AN ATTENTION FEATURE WILL BE NEEDED +;THAT WOULD ALSO BE USED FOR DISK POWER-UP SIGNALLING +;THESE WORDS ARE SET UP BY THE 10 AS BYTE-POINTERS TO THE DATA +;TO BE TRANSFERRED. EACH BYTE POINTER CAN TRANSFER AT MOST 256 PDP10 WORDS +;DUE TO BRAIN-DAMAGE IN THE DL10, SO THERE ARE 4 OF THEM +DSCPNT: .BLKW 4 +.ENDC ;T300P + +DLXHGH:: +.=ZZ +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL DTE20 CONTROL AREA + +;LOCATIONS 400-437 ARE JUST BETWEEN US AND ITS +;LOCATIONS 440-457 ARE KNOWN ABOUT BY KLDCP ALSO + +;EPTDDT==441 ;START ADDRESS OF PDP10 NON TIME SHARING DDT +DTEFLG==444 ;NON TIME SHARING TYPEIN/TYPEOUT DONE FLAG (SET BY 11, CLEARED BY 10) +DTEF11==450 ;USED BY NON TIMESHARING TYPEIN COMMAND TO RETURN THE CHAR (SET BY 11) +DTECMD==451 ;NON TIME SHARING COMMAND (SET BY 10) +;COMMANDS THAT CAN GO IN DTECMD: + ;0-377 CHAR TO BE TYPED OUT + %DTTYI==3400 ;TYPE IN, CHAR RETURNED IN DTEF11 + %DTCLN==1001 ;60 CYCLE CLOCK ON + %DTCLF==1000 ;60 CYCLE CLOCK OFF + ;THERE ARE MILLIONS OF OTHERS, BUT WHO NEEDS 'EM? +DTECLK==445 ;60 CYCLE CLOCK FLAG (SET BY 11, CLEARED BY 10) +;DTESWR==457 ;SIMULATED SWITCH REGISTER (SET BY 11) + +;THE FOLLOWING LOCATIONS ARE ONLY USED IN TIME SHARING AND NOT KNOWN ABOUT BY KLDCP + +DTEVER==400 ;I/O VERSION NUMBER. .BYTE FIRST LINE, NUMBER OF LINES. + ;SET BY 10, CHECKED BY 11 + +DTECHK==401 ;INCREMENTED BY 11 60 TIMES PER SECOND, SETOMED BY 10 EVERY 1/2 SECOND + ;USED TO CHECK THAT 10 IS GETTING INTERRUPTS OK + +DTEINP==402 ;CONTROLS "BYTE TRANSFERS" FROM 11 TO 10 (INPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN XFER COMPLETE. + ;10 SHOULD SET UP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING DTEINP. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES IN DTEINP. +DTEOUT==403 ;CONTROLS "BYTE TRANSFERS" FROM 10 TO 11 (OUTPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN TRANSFER STARTS. + ;EACH SIDE KNOWS WHEN TRANSFER IS IN PROGRESS, DOESN'T TRY TO START + ; ANOTHER UNTIL IT HAS RECEIVED HARDWARE TRANSFER-DONE INTERRUPT. + ;10 SHOULD SET UP DTEBPO IN EPT BEFORE SETTING DTEOUT. + ;RH IS #BYTES EXPECTED, LH IS COMMAND+LINE#. COMMANDS ARE: + %DTTYO==1000 ;TELETYPE OUTPUT + ;%DTETI==2000 ;ETHERNET INPUT + ;%DTETO==3000 ;ETHERNET OUTPUT + ;^ ADD MORE COMMANDS HERE. NOTE: THE 4.1 BIT IS 1 FOR OUTPUT, 0 FOR INPUT. + +DTELSP==404 ;LINE# TO SET SPEED OF (SET BY 10, SETOMED BY 11) +DTELPR==405 ;DH11 LINE-PARAMETER-REGISTER,,BUFFER SIZE + +DTEOST==406 ;LINE# TO START OUTPUT ON (SET OUTPUT DONE). (SET BY 10, SETOMED BY 11) + + ;407 NOT USED + +DTETYI==410 ;TELETYPE INPUT + ;LH=LINE#, RH=CHAR RECEIVED. (SET BY 11, SETOM'ED BY 10) + +DTEODN==411 ;TELETYPE OUTPUT DONE + ;LH=LINE#, RH=BUFFER SIZE. (SET BY 11, SETOM'ED BY 10) + +DTEHNG==412 ;HANGUP/DIALIN WORD (SET BY 11, SETOM'ED BY 10) + ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + +;^ ADD MORE HERE, NOT TO EXCEED LOCATION 437 + ;.IFNZ DTE20P + +;IOELEVEN RESIDES IN THE BOTTOM 14K OF THE CONSOLE PDP11, ALONG WITH 11DDT. +;I.E. LOCATIONS 0-70000. BE SURE TO USE .;11DDT 14K VERSION OF DDT. +;THE UPPER 14K CONTAIN KLDCP. THE FOLLOWING CALLS TO KLDCP ARE USED. +;THEY RETURN WITH C-BIT SET IF THEY LOSE (MICROCODE HUNG). + +;NOTE: KLDCP ENJOYS CLOBBERING REGISTER 0 (A). I DON'T +;KNOW IF ALL THESE CALLS DO, BUT WE'LL ASSUME THAT THEY DO. + +TENSW=EMT!145 ;UPDATE LOCATION DTESWR FROM THE SWITCHES + +EXAM=EMT!103 ;EXAMINE PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 BYTES CONTAINING PDP10 ADDRESS (LOW BITS FIRST) + ;AFTER CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS (LOW BITS FIRST) + +EXAMT=EMT!104 ;EXAMINE PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +DPOS=EMT!105 ;DEPOSIT PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS + ;AND REGISTER B HAS ADDRESS OF 3 BYTES CONTAINING ADDRESS + +DPOST=EMT!106 ;DEPOSIT PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +D10MON=EMT!111 ;DEPOSIT PDP10 MEMORY, -1 + ;.WORD PDP10-ADDRESS + +$PMSG=EMT!25 ;PRINT MESSAGE ON TTY + ;.WORD ADDRESS OF ASCIZ MESSAGE + +$CNTLC=100004 ;JUMP HERE TO "CONTROL C" BACK TO KLDCP + +;WHEN KLDCP IS IDLE, AND IN "ITS MODE", IT DOES JSR PC,3000 +;WHICH CALLS IOELEVEN'S MAIN PROGRAM. RETURN WITH "C" SET +;TO READ AND EXECUTE ONE KLDCP COMMAND LINE. RETURN WITH "C" +;CLEAR TO PRINT KL10 HALTED OR CLOCK ERROR STOP MESSAGE. +;LOCATIONS 3004, 3006 MUST CONTAIN .RAD50/IOELEV/ +;IOELEV WILL RUN ON KLDCP'S STACK. + ;.IFNZ DTE20P +;INFORMATION ABOUT THE DTE20. +;EXCEPT FOR BYTE TRANSFER, WE USE THE TIME-TESTED SUBROUTINES PROVIDED BY KLDCP. + +;THE INTERRUPT VECTOR IS AT 774, BUT WE CAN'T USE IT BECAUSE WOULD HAVE +;TO COORDINATE THINGS WITH KLDCP, WHICH IS OBVIOUSLY IMPOSSIBLE. + +DLYCNT=174400 ;2.6-2.7 UNIBUS ADDRESS EXTENSION FOR BYTE TRANSFER DMA + ;1.1-2.5 14-BIT 2'S COMPLEMENT OF NUMBER OF HALF-MICROSECONDS + ; TO DELAY BETWEEN PI0 INTERRUPTS IN BYTE TRANSFER + +TO10AD=174420 ;ADDRESS (WORD OR BYTE) OF TO-10 BYTE TRANSFER DATA + +TO10BC=174414 ;1.1-2.3 NEGATIVE BYTE COUNT, 2.7 LAST XFER + ;NORMALLY SET BY 10 WITH DATAO DTE, + ;TO10 XFER STARTS WHEN BOTH TO10AD AND TO10BC HAVE BEEN LOADED + +TO11AD=174422 ;ADDRESS (WORD OR BYTE) OF TO-11 BYTE TRANSFER DATA + +TO11BC=174416 ;1.1-2.3 NEGATIVE BYTE COUNT FOR TO-11 BYTE TRANSFER + ;2.5=1 => TO-11 TRANSFER IS 8-BIT BYTES, =0 => 16-BIT WORDS + ;2.6=1 => "ASCIZ" MODE (WHICH WE DON'T USE, OF COURSE) + ;2.7=1 => LAST XFER, UPON COMPLETION INTERRUPT BOTH 10 AND 11 + ; =0 => ONLY INTERRUPT 11. 11 CAN CHANGE TO11AD, TO11BC, CONTINUE. + ;TO11 XFER STARTS WHEN BOTH TO11AD AND TO11BC HAVE BEEN LOADED + ;THE TRANSFER HAPPENS USING DMA (NPR) IN 11, PI LEVEL 0 IN 10. + +STATUS=174434 ;DTE20 STATUS REGISTER + ;READS: + %STDNI==100000 ;2.7 TO10 XFER DONE WITHOUT ERROR + %STERI==20000 ;2.5 TO10 XFER ABORTED BY ERROR + ;2.4 DATA OUT OF DTE RAM IS ALL ZERO (MAINT) + %STINV==4000 ;2.3 PDP10 IS INTERRUPTING PDP11 + ;2.2 DEPOST OR EXAMINE WORD ONE (MAINT) + ;2.1 PDP11 MEMORY PARITY ERROR IN TO10 XFER + ;1.9 PDP11 IS INTERRUPTING PDP10 + %STDNO==200 ;1.8 TO11 XFER DONE WITHOUT ERROR + ;1.7 E BUFFER SELECT (MAINT) + ;1.6 TO11 XFER STOPPED DUE TO ZERO BYTE (IN ASCIZ MODE) + ;1.5 TO11 XFER OR PDP10 EXAMINE ENCOUNTERED EBUS PARITY ERROR + ;1.4 1 => RESTRICTED MODE + ;1.3 0 => EXAMINE/DEPOSIT IN PROGRESS, 1 => DONE + %STERO==2 ;1.2 TO11 XFER ABORTED BY ERROR + ;1.1 1 => DTE ENABLED TO INTERRUPT PDP11 + ;WRITES: + %STCLI==51000 ;2.6+2.4+2.1 CLEAR TO10 XFER DONE AND ERROR FLAGS + %STUNV==2000 ;2.2 CLEAR PDP10 INTERRUPTING PDP11 + %STINX==400 ;1.9 SET PDP11 INTERRUPTING PDP10 + %STCLO==121 ;1.7+1.5+1.1 CLEAR TO11 XFER DONE AND ERROR FLAGS + ;1.6 ENABLE INTERRUPTS + ;1.4 DISABLE INTERRUPTS + +DIAG1=174430 ;DIAGNOSTIC WORD 1, INCLUDES FLAGS + %D1ERR==4000 ;2.3 KL10 CLOCK ERROR STOP + %D1RUN==2000 ;2.2 KL10 RUN INDICATOR (1 IF 11 WANTS 10 TO RUN) + %D1HLT==1000 ;2.1 KL10 HALT INDICATOR (1 IF 10 DOES A JRST 4) + +DIAG3=174436 ;DIAGNOSTIC WORD 3, INCLUDES FLAGS + %D3BYT==1 ;1.1 WRITING 0 SETS TO10 XFER IN WORD MODE, 1 BYTE MODE + ;THERE'S NOTHING ELSE OF THE SLIGHTEST USE IN THIS REGISTER, + ;SO IT'S OK TO WRITE IT AT ANY TIME. +.ENDC ;DTE20P + + .SBTTL LOW CORE + +.IFZ DTE20P ;IF USING DTE20, THESE ARE SET UP BY KLDCP +.=4 + TRAP4 + 340 + TRAP10 + 340 +; TRAP14 ;SET UP BY 11DDT +; 340 +.=20 + TRAP10 ;IOT + 340 + PWRFAL + 340 + TRAP10 ;EMT + 340 + TRAP10 ;TRAP + 340 +.ENDC ;DTE20P + +;CHAOS NET INTERRUPT VECTORS ARE UNFORTUNATELY NOT IN A REASONABLE ARRAY +.IFGE CHAOSP-1 +.=270 + .WORD CHS0BK,5_5 + ;274 IS INTERVAL TIMER +.ENDC ;CHAOSP-1 +.IFGE CHAOSP-2 +.=230 + .WORD CHS1BK,5_5 + ;234 IS INTERVAL TIMER +.ENDC ;CHAOSP-2 +.IFGE CHAOSP-3 +.=240 + .WORD CHS2BK,5_5 + ;244 IS INTERVAL TIMER +.ENDC ;CHAOSP-3 +.IFGE CHAOSP-4 + .ERROR WHERE DOES THE FOURTH CHAOSNET INTERRUPT VECTOR GO? +.ENDC ;CHAOSP-4 + +.IFNZ ETHERP +.=400 + ETHOBK + 5_5 + ETHIBK + 5_5 + ETHOBK ;COLLISION + 5_5 +.ENDC ;ETHERP + +.IFNZ T300P +.=254 + DSKBRK + 240 ;BR5 +.ENDC ;T300P + +.=300 +.REPT NDMS ;DM11s go in floating vectors +CONC DM,\.RPCNT+1,BRK + 240 ;INTERRUPTS ON BR4 BUT WE MASK TO BR5 ANYWAY +.ENDR ;NDMS + +.IFNZ NDLS +.=60 + DL1IBK ;FIRST DL11 LINE IS PDP11'S CONSOLE TTY, DIFFERENT ADDRESS + 240 ;AGAIN INTERRUPTS ON BR4 BUT MASK TO BR5 SO CAN USE DH11 ROUTINES W/O FEAR + DL1OBK + 240 +.ENDC ;NDLS +.=310 +.REPT NDLS-1 ;DL11S AFTER THE FIRST ARE IN FLOATING VECTORS +CONC DL,\.RPCNT+2,IBK + 240 +CONC DL,\.RPCNT+2,OBK + 240 +.ENDR + +.=DHIBAS ;DON'T RELY ON RANDOM FLOATING VECTOR TO + ;COME OUT RIGHT, E.G. IF THERE IS A DL11 + ;THERE WHICH WE AREN'T USING. +.REPT NDHS ;DH11S ARE IN FLOATING VECTOR AFTER DL11[E]S +CONC DH,\.RPCNT+1,IBK ;DH11 #n RECEIVE + 240 +CONC DH,\.RPCNT+1,OBK ;DH11 #n TRANSMIT & ERROR + 240 +.ENDR ;NDHS +.=100 + CLKBRK ;KW11-L 60-CYCLE CLOCK + 300 ;ON BR6 + +.IFNZ GOULDP +.=174 + GLPBRK + 300 ;BR5 BUT NEED TO LOCK OUT CLOCK SO MASK 6 +.ENDC ;GOULDP + +.IFG NMPTYS +.=56 +MPXENB::0 ;NONZERO TO ENABLE MULTISCHLUNKER +.ENDC + +.IFZ DTE20P ;IF DTE20, KLDCP SUPPLIES THE STACK +.=1000 +STKBAS:: + JMP INIT ;START AT 1000 IS CONVENTIONAL +.IFF ;DTE20P +.=3000 ;ENTRY VECTOR + JMP @#INIT +SADR=.-2 ;ARG OF THE JMP@# IS CHANGED AFTER INITIALIZATION + .RAD50 /IOELEV/ +.ENDC ;DTE20P + + .SBTTL TEN-11 CHAOSNET COMMUNICATION AREA + +.IFNZ TEN11P +T11BFL==8+<2*PKTMXW> ;BYTE LENGTH OF A PACKET BUFFER + ;FIRST 8 BYTES ARE BUFFER-FULL FLAG AND CKSM +.IIF NE T11BFL-<*4>, .ERROR T11BFL NOT MULTIPLE OF 4 + +.IIF NE .-1004, .ERROR CHAOSNET TEN-11 COMMUNICATION AREA NOT AT RIGHT ADDRESS + +;THIS AREA IS SHARED WITH THE PDP10 VIA TEN-11 INTERFACE. + + .WORD "CH,1 ;ERROR CHECK AND VERSION NUMBER +T11I10: .WORD 0,0 ;SET NON-ZERO BY 11 TO REINITIALIZE 10 +T11I11: .WORD 0,0 ;SET NON-ZERO BY 10 TO REINITIALIZE 11 + .WORD T11BFL,NT11BF ;BUFFER SIZE, NUMBER OF BUFFERS + .BLKW 8 ;SPARE WORDS +T11OBF: .BLKB T11BFL*NT11BF ;TO-10 BUFFERS + T11OBE==. ;END OF TO-10 BUFFERS +T11IBF: .BLKB T11BFL*NT11BF ;FROM-10 BUFFERS + T11IBE==. ;END OF FROM-10 BUFFERS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +.ENDC ;TEN11P + + .SBTTL CONFIGURATION + +; TABLES INDEXED BY H (PER HARDWARE UNIT) + +.MACRO DHTE AD ;DH11 REGISTER ADDRESS GENERATOR +.REPT NDHS + +<20*.RPCNT> +.ENDR +.ENDM + +.MACRO DLTE AD ;DL11 REGISTER ADDRESS GENERATOR, FIRST IS WIERD +.IFNZ NDLS + 177560+<&7> +.REPT NDLS-1 + +<10*.RPCNT> +.ENDR +.ENDC ;NDLS +.ENDM + +.MACRO DMTE AD ;DM11 register address generator + .REPT NDMS + +<10*.RPCNT> ;a DM11 eats 8 locations + .ENDR +.ENDM + +DMCSR: DMTE 170500 ;first DM11 is at 170500 + +DMLSR: DMTE 170502 ;selected line status at 170502 + +DHSCR: DHTE DHCBAS ;SYSTEM CONTROL REGISTER + ;1.1-1.4 LINE NUMBER + ;1.5-1.6 MEMORY ADDRESS EXTENSION + DHRENB==100 ;1.7 RECEIVER INTERRUPT ENABLE + ;1.8 RECEIVER INTERRUPT + ;1.9 CLEAR NXM FLAG + ;2.1 MAINTENANCE MODE + DHSNXM==2000 ;2.2 NXM FLAG (GENERATES XMT INTERRUPT) + ;2.3 MASTER CLEAR + DHSENB==10000 ;2.4 STORAGE SILO FULL INTERRUPT ENABLE + DHTENB==20000 ;2.5 TRANSMITTER & NXM INTERRUPT ENABLE + ;2.6 STOARGE FULL INTERRUPT + DHTDON==100000 ;2.7 TRANSMITTER DONE INTERRUPT + +DLKS==DHSCR + DLTE 175610 ;KEYBOARD STATUS REGISTER + ;1.1 PAPER TAPE READER ENABLE (WO) + ;1.2 DATA TERMINAL READY (RW) + ;1.3 REQUEST TO SEND (RW) + ;1.4 SECONDARY TRANSMIT DATA [OR MAKE BUSY] (RW) + ;1.5 UNUSED + ;1.6 DATASET INTERRUPT ENABLE (RW) + ;1.7 RECEIVE INTERRUPT ENABLE (RW) + ;1.8 RECEIVE DATA READY (RO) + ;1.9 UNUSED + ;2.1 UNUSED + ;2.2 SECONDARY RECEIVE DATA (RO) + ;2.3 RECEIVE ACTIVE (RO) + ;2.4 CARRIER DETECT (RO) + ;2.5 CLEAR TO SEND (RO) + ;2.6 RING INDICATOR (RO) + ;2.7 DATASET STATUS CHANGE (RO) + +DHNRC: DHTE DHCBAS+2 ;NEXT RECEIVED CHARACTER + ;1.1-1.8 THE CHARACTER + ;1.9-2.3 LINE NUMBER + %DXPAR==10000 ;2.4 CHAR HAS WRONG PARITY + %DXBRK==20000 ;2.5 FRAMING ERROR (BREAK) + %DXOVR==40000 ;2.6 OVERRUN, PREVIOUS CHARS LOST + ;2.7 1 => THIS WORD VALID +DLKB==DHNRC + DLTE 175612 ;KEYBOARD INPUT REGISTER + ;1.1-1.8 RECEIVED DATA + ;2.4 PARITY ERROR (RO) + ;2.5 FRAMING ERROR (RO) + ;2.6 OVERRUN (RO) + ;2.7 OR OF ERROR BITS (RO) + +DHLPR: DHTE DHCBAS+4 ;LINE PARAMETER REGISTER + ;1.1-1.2 CHARACTER LENGTH 0=5, 1=6, 2=7, 3=8 (PARITY BIT EXTRA) + ;1.3 1 => EXTRA STOP BIT + ;1.5 ENABLE PARITY + ;1.6 0 -> EVEN PARITY, 1 => ODD + ;1.7-2.1 RECEIVER SPEED + ; 0 OFF, 1 50, 2 75, 3 110, 4 134.5, 5 150, 6 200, 7 300 + ; 10 600, 11 1200, 12 1800, 13 2400, 14 4800, 15 9600, 16 A, 17 B + ;2.2-2.5 TRANSMITTER SPEED, SAME CODES AS RECEIVER + ;2.6 HALF DUPLEX + ;2.7 ECHOPLEX + +DHCA: DHTE DHCBAS+6 ;CURRENT ADDRESS +DLCA==DHCA + .IREPT NDLS,0 + +DHBC: DHTE DHCBAS+10 ;BYTE COUNT (MINUS) +DLBC==DHBC + .IREPT NDLS,0 ;POSITIVE FOR DLS + +DHBAR: DHTE DHCBAS+12 ;BUFFER ACTIVE REGISTER + ;BIT = 1 IF XMT ACTIVE ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPS==DHBAR + DLTE 175614 ;PRINTER STATUS + ;1.1 SEND BREAK (RW) + ;1.3 LOOP BACK (RW) + ;1.6 INTERRUPT ENABLE (RW) + ;1.7 TRANSMITTER READY (RO) + +DHBCR: DHTE DHCBAS+14 ;BREAK CONTROL REGISTER + ;BIT = 1 => SEND BREAK ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPB==DHBCR + DLTE 175616 ;PRINTER BUFFER + ;1.1-1.8 DATA TO TRANSMIT + +DHSSR: DHTE DHCBAS+16 ;SILO STATUS REGISTER + ;1.1-1.6 SILO ALARM LEVEL + ;1.7-1.8 READ EXTENDED ADDRESS (R.O.) + ;1.9-2.5 SILO FILL LEVEL (R.O.) + ;2.7 MAINTENANCE PATTERN (W.O.) + +DHOAC: .IREPT NDHS,0 ;BIT ON IF SOFTWARE THINKS LINE'S TRANSMITTER IS ACTIVE +DLOAC==DHOAC + .IREPT NDLS,0 ;NON-ZERO IF LINE'S TRANSMITTER IS ACTIVE + +DHTYNO: .IREPT NDHS, NFDHTY+<32.*.RPCNT> ;TTY INDEX OF FIRST LINE ON THIS DH11 +DLTYNO==DHTYNO +.IIF NZ CTYP,0 ;TTY INDEX OF LINE ON THIS DL11 +.IREPT NDLS-CTYP,NFDLTY+<2*.RPCNT> + +STROUT: .IREPT NDHS, STRDH ;OUTPUT-START ROUTINES + .IREPT NDLS, STRDL +.IIF NZ NMPTYS, STRMPK + + .BLKB NFTTY ;AVOID LABEL OVERLAPPAGE + +;TABLES INDEXED BY I (PER LINE) + +T HDWR: ;HARDWARE UNIT INDEX, GOES IN H +.IIF NZ CTYP, NFDLHX + .REPT NDHS + ZZ==.RPCNT*2 + .REPT 16. + ZZ ;16 LINES ON EACH DH-11 + .ENDR + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,NFDLHX+<2*.RPCNT>+<2*CTYP> +.IREPT NMPTYS, MPKHWR ;MULTIPLEXOR-KLUDGE TTYS + +T DHLSEL: ;DH11 LINE SELECT WORDS +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + DHTENB+DHRENB+.RPCNT + .ENDR + .ENDR + +T DHLBIT: ;BIT CORRESPONDING TO THIS LINE IN DHBAR, ETC. +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + 1_.RPCNT + .ENDR + .ENDR + +T BUFPNT: ;BUFFER POINTERS + .IREPT NCT, BUFFRS+<.RPCNT*MAXBSZ> + +T BUFSIZ: ;BUFFER SIZES (I.E. AMOUNT TO USE AT CURRENT SPEED) + .REPT NCT + 0 ;SET DURING INITIALIZATION + .ENDR + +T NRMIPC: ;NORMAL INPUT CHARACTER PROCESSING ROUTINES +.IIF NZ CTYP, RCV ;CTY NORMAL INPUT + .REPT 16.*NDHS + DHNRMI ;DH11 TTY NORMAL INPUT + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,RCV ;DL11 NORMAL INPUT +.IREPT NMPTYS, RCV ;NORMAL INPUT FOR TTYS ON MULTIPLEXOR-KLUDGE +.IIF NE .-NRMIPC-NLTTY, .ERROR BARF AT NRMIPC +.IFNZ NMPTYS + .=NRMIPC+MPXIDX + MPXINP ;INPUT FROM THE MULTIPLEXED LINE IS SPECIAL + .=NRMIPC+NLTTY +.ENDC + +T TTYIPC: ;CURRENT INPUT CHAR PROCESSING ROUTINES + .BLKW NCT ;SET UP AT INIT TIME +.IIF NE .-TTYIPC-NLTTY, .ERROR BARF AT TTYIPC + +T AUTOSP: ;IF NON-ZERO, LINE GOES INTO AUTOSPEED WHEN DIALED UP + .REPT NCT ;IF MINUS ALSO WHEN BREAK SEEN + ZZ===. + ASPIRP ^\ + .IIF EQ .RPCNT+-N,+1 ;THIS LINE AUTOSPEED ON DIALUP + .IIF EQ .RPCNT++N,-1 ;ALSO ON BREAK + \ + .IIF EQ .-ZZ, 0 ;THIS LINE NOT AUTOSPEED + .ENDR +.IIF NE .-AUTOSP-NLTTY, .ERROR BARF AT AUTOSP + +.IFM MX +M2LMAP: ;MAP FROM DM11-BB CHANNEL NUMBERS TO TTY INDICES + 2*1 ;0 T01 + 0 ;1 NONE + 0 ;2 NONE + 2*4 ;3 T04 + 2*5 ;4 T05 + 2*6 ;5 T06 + 2*7 ;6 T07 + 2*10 ;7 T10 + 2*11 ;10 T11 + 2*12 ;11 T12 + 2*13 ;12 T13 + 2*14 ;13 T14 + 2*15 ;14 T15 + 2*16 ;15 T16 + 2*17 ;16 T17 + 0 ;17 NONE + 2*21 ;20 T21 + 2*22 ;21 T22 + 2*23 ;22 T23 + 2*24 ;23 T24 + 2*25 ;24 T25 + 2*26 ;25 T26 + 2*27 ;26 T27 + 2*30 ;27 T30 + 2*31 ;30 T31 + 2*32 ;31 T32 + 2*33 ;32 T33 + 2*34 ;33 T34 + 2*35 ;34 T35 + 2*36 ;35 T36 + 2*37 ;36 T37 + 2*40 ;37 T40 +.ENDC ;MX + +.IIF NE NDMS, .IIF NE .-M2LMAP-<40*NDMS>, .ERROR Too few M2LMAP entries for DM11s. + +.IFNZ NDMS + +T DIALED: ;0 IF LINE NOT DIALED UP (OR NO MODEM CONTROL ON THIS LINE) + .REPT NCT ;+ IF DIALED UP (CLEAR TO SEND IS ON) + 0 ;- IF CLEAR TO SEND DROPPED, INC EACH TICK, REACHES 0 => HUNG UP + .ENDR + +.ENDC ;NDMS + +T TTYHNG: ;DIALUP/HANGUP STATUS WAITING TO BE SENT TO 10 (0 IF NONE) + .REPT NCT + 0 + .ENDR + +T TYPING: ;POSITIVE IF LINE IS TYPING OUT FOR 10 + .REPT NCT ; WHICH MEANS -10 SHOULD BE INFORMED WHEN TYPEOUT IS FINISHED + 0 ;0 FOR NO -10 TYPEOUT, MINUS TO SEND AFTER TYPEOUT + .ENDR + +;MISC VARIABLES + +DLXOFF: -1 ;NON-ZERO IF DL10 PORT TURNED OFF BY 10 +NO.ITS: -1 ;NON-ZERO IF HAVEN'T ESTABLISHED COMMUNICATION WITH ITS YET +VERSN: .BYTE NFTTY/2,NCT ;I/O VERSION NUMBER +DMINI: 0 ;NON-ZERO => MODEM SCANNER JUST TURNED ON, GETTING INITIAL STS +WAKE: 0 ;CLOCK INTERRUPT WAKE UP MAIN PROGRAM FLAG +HNGSIG: 0 ;NUMBER OF NON-ZERO TTYHNG WORDS +10RQ: 0 ;LIGHT HACKS +LITHSE: 7 +.IFNZ DTE20P +CLKENB: 0 ;KL10 WANTS 11 TO RELAY CLOCK INTERRUPTS +KLDCPF: 0 ;NON-ZERO => USER WANTS TO GIVE A COMMAND TO KLDCP +DDTMOD: 0 ;NON-ZERO => DDT MODE TTY INPUT +DDTCHR: -1 ;NON-NEGATIVE => CHAR TYPED FOR DDT +CURSWR: 52525 ;LAST SWITCHES SENT TO -10 +OUTCMD: 0 ;0 IF OUTPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +OUTSVI: -1 ;LINE# OF CURRENT OUTPUT TRANSFER +OUTSVC: -1 ;#BYTES OF CURRENT OUTPUT TRANSFER +INPCMD: 0 ;0 IF INPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +INPSVI: -1 ;LINE# OF CURRENT INPUT TRANSFER +INPSVC: -1 ;#BYTES OF CURRENT INPUT TRANSFER +.ENDC ;DTE20P +.IFNZ NMPTYS +MPXOAC: 0 ;0 IDLE, -1 SENDING HEADER, 1 SENDING DATA +MPXOLN: 0 ;2 x MPXK# OUTPUTTING FOR +MPXSEL: NFMPTY ;TTY INDEX SELECTED FOR MPX INPUT +MPXPNT: .IREPT NMPTYS,0 ;POINTER TO CRUFT TO SEND TO EACH MPXED LINE +MPXNBT: .IREPT NMPTYS,0 ;# BYTES TO SEND, 0 IF IDLE +MPXHED: .BYTE 0,0 ;MPX OUTPUT HEADER: 200+MPXK#, BYTE COUNT +.ENDC ;NMPTYS + + .SBTTL CHAOSNET VARIABLES & TABLES + +.IFNZ CHAOSP + +NSUBNT==80. ;MAXIMUM CAPACITY 80. SUBNETS + +.IFNZ DL10P ;DL10 UNSHARED +DLCRBN: 0 ;CURRENT RECEIVE (11 to 10) BUFFER (0 OR 2) +DLCNXT: .WORD 2,0 ;FOR SWITCHING BUFFERS +DLCIBF: .BLKW PKMAX ;DL10 INPUT BUFFER +.ENDC ;DL10P + +.IFNZ TEN11P ;TEN11 UNSHARED +T11OBP: T11OBF ;NEXT BUFFER TO 10 +T11IBP: T11IBF ;NEXT BUFFER FROM 10 +T11IBA: 0 ;NON-ZERO MEANS INPUT BUFFER ACTIVE, T11IBP NEEDS ADVANCING + ;THIS IS SEPARATE FROM CHISTS+CHXT11 FOR GOOD REASONS +T11CKE: 0 ;COUNT OF TEN-11 CHECKSUM ERRORS +T11TIM: 0 ;TIMEOUT ON TRANSMISSION OF PACKET TO 10 +.ENDC ;TEN11P + +.IFNZ ETHERP +ETHSBN==2 ;SUBNET WHICH IS THE ETHERNET +.SEE ETHHSN ;MY HOST NUMBER BYTE (DEFINED IN MACHINE CONFIGURATION AREA) +ETHMXH==15.-1 ;MAXIMUM NUMBER OF HOPS (-1 => BUG IN XEROX PROGRAMS) +ETHIBF: .BLKW PKTMXW+1 ;INPUT FROM ETHERNET BUFFERED HERE (+1 HARDWARE BUG?) +ETHHDW==PKHDW-2 ;ALLOW FOR OVERLAP OF CHAOSNET HEADER AND 2-WORD ETHERNET HEADER + ;THIS IS THE OFFSET (IN WORDS) WHERE THE ETHERNET PACKET STARTS + +;HERE IS A PACKET USED TO BUILD THE ETHERNET BROADCAST GATEWAY INFO. WHAT A CROCK. +EGTBUF: .BLKW PKHDW ;SPACE FOR CHAOSNET HEADER +EGTPLN: 0 ;PUP LENGTH + 201 ;PUP TYPE 201 +EGTPID: .WORD 0,0 ;PUP IDENTIFIER + 0 ;DESTINATION (BROADCAST) + .WORD 0,2 ;DEST SOCKET 2 +EGTSRC: .BYTE ETHHSN,ETHSBN ;SOURCE (ME) + .WORD 0,2 ;SOURCE SOCKET 2 +EGTSBN: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + .BLKW 2*NSUBNT + 0 ;PUP CHECKSUM + +.IF DF NDVRBF +DVRHST: 0 ;ZERO IF IDLE, OR FOREIGN HOST USING +DVRIDX: 0 ;FOREIGN INDEX +DVRLIX: 0 ;LOCAL INDEX (AOS EACH TIME) +DVRTIM: 0 ;COUNTS UP TO IDLE THE FOREIGN HOST +DVRRTR: 0 ;COUNTS UP FOR RETRANSMISSION + +DVRBFL==2*+1> ;NUMBER OF BYTES IN A DOVER BUFFER (HOLDS PUP IN CHAOSNET PACKET) +DVRBUF: .BLKB DVRBFL*NDVRBF ;RING OF BUFFERS HERE +DVRBF2: .BLKW PKHDW+2 ;BUFFER FOR SENDING STS/OPN/CLS BACK (ALSO END OF RING) +DVRBFP: DVRBUF ;POINTER TO NEXT BUFFER TO GO OUT TO DOVER +DVRMSK: 0 ;MASK OF WHICH BUFFERS CONTAIN PACKETS (MSB = DVRBFP PKT) + .IIF GT NDVRBF-16., .ERROR NDVRBF MAXIMUM OF 16. ALLOWED +DVRPKP: 0 ;IF NON-ZERO, POINTER TO SPECIAL PACKET TO SEND +DVRID: 0 ;ID FOR NEXT PACKET EXPECTED BY DOVER, THIS PACKET IS OR + ; WILL BE IN THE BUFFER DVRBFP POINTS AT +DVROFS: 0 ;ID OFFSET, SUBTRACT FROM CHAOS ID TO GET PUP ID +NDVRFK: 0 ;*** TEMPORARY KLUDGE *** +.ENDC ;NDVRBF +.ENDC ;ETHERP + +PULSAR: 0 ;COUNTS DOWN TO 0 THEN TRIGGERS TRANSMISSION OF A "TEST MESSAGE" +PULSON: FTPULS ;IF THIS IS NON-ZERO, FEATURE IS ENABLED, VALUE IS TICKS BETWEEN PULSES +USECBL: 0 ;IF NON-ZERO, 10 TALKING TO SELF STILL GOES THROUGH CABLE + +NCHX==DL10P+TEN11P+CHAOSP+<2*ETHERP> ;NUMBER OF ENTRIES IN SOURCE AND SINK TABLES +.IIF DF NDVRBF, NCHX==NCHX+1 + +;METERS ETC. +.IFNZ FTGARB +CHSGBF: .BLKW PKMAX ;HOLDS LAST PACKET THAT CAME IN WITH A CHECKSUM ERROR +CHSGBH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE CAME IN ON +CHSGBS: 0 ;STATUS REGISTER THAT GOES WITH ABOVE +CHSGBC: 0 ;BIT COUNT THAT GOES WITH ABOVE +.ENDC ;FTGARB + +;FOLLOWING HAVE SEPARATE ENTRIES FOR EACH CABLE +NPKSGB: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RECEIVED WITH CHECKSUM ERRORS +HPKSGB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRL: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RAM LOST, + ; I.E. DIDN'T COME IN WITH A CHECKSUM ERROR BUT AFTER + ; READING IT OUT HAD ONE. EITHER THE PACKET WAS THE + ; WRONG LENGTH, OR THE RAM IS LOSING, OR HARDWARE + ; CLOBBERAGE. FOR ETHERNET IS PUP CKSM ERR COUNT + ;THIS WORD ALSO IS WHERE BIT COUNT ERRORS WOULD END UP +HPKSRL: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +CHSRLH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE LAST HAPPENED ON. +CHSRLC: 0 ;RESIDUAL BIT COUNT FOR ABOVE +NPKSLS: .IREPT CHAOSP,0 ;NUMBER OF PACKETS LOST ACCORDING TO LOSS COUNT IN HARDWARE +HPKSLS: .IREPT CHAOSP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSAB: .IREPT CHAOSP+ETHERP,0 ;NUMBER OF TRANSMISSIONS ABORTED (BY COLLISION OR RECEIVE-BUSY) +HPKSAB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSI: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS IN ON EACH SOURCE +HPKSI: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSO: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS OUT ON EACH SINK +HPKSO: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSIG: 0 ;NUMBER OF PACKETS IGNORED AT CHIFLS +NPKSBD: .IREPT NCHX,0 ;NUMBER OF PACKETS BAD AT CHSIHB +HPKSBD: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRF: 0 ;NUMBER OF PACKETS FOR WHICH ROUTING FAILED +RFSBNT: -1 ;2* SUBNET# OF LAST ROUTING FAILURE + +;"INTERFACE ADDRESSES" +; A NEGATIVE INTERFACE ADDRESS IS THE UNIBUS ADDRESS OF A CHAOS INTERFACE. +; A ZERO INTERFACE ADDRESS MEANS THE DL10 +; A POSITIVE INTERFACE ADDRESS MEANS THE TEN-11, VALUE BETTER BE OCTAL 1011. + +CHSIBF: .BLKW PKMAX*CHAOSP ;INPUT BUFFER FOR PACKETS IN FROM CHAOS HDWR + +;THIS IS WHAT IS SENT BACK IN RESPONSE TO RFC TO "STATUS". +;FOR NOW, JUST THE NAME OF THE MACHINE. +HSTNAM: +.ENDC ;CHAOSP ;FUCK A DOG, PALX! +.IFM MX-DL + .ASCII \MX-IO/11\ +.ENDC +.IFM AI + .ASCII \AI-CHAOS-11\ +.ENDC +.IFNZ CHAOSP ;FUCK A DOG, PALX! +.IIF GE .-HSTNAM-32., .ERROR HSTNAM TOO LONG +.IREPT 32.-<.-HSTNAM>, .BYTE 0 ;PAD ON THE RIGHT WITH 0'S + +;CHAOSNET INPUT SOURCE AND OUTPUT SINK TABLES + + ;NOTE WELL, THE CODE RELIES ON THE ORDER OF THESE INDICES +.IIF NZ DL10P, CHXDLC==0 ;DL10 INDEX +.IIF NZ TEN11P, CHXT11==2*DL10P ;TEN11 INDEX +CHXCHS==2* ;FIRST CHAOS INDEX +.IIF NZ ETHERP, CHXETH==CHXCHS+<2*CHAOSP> ;ETHERNET INDEX +.IIF NZ ETHERP, CHXEGT==CHXETH+2 ;ETHERNET GATEWAY-INFO-BROADCAST KLUDGE INDEX +.IIF DF NDVRBF, CHXDVR==CHXEGT+2 ;DOVER PROTOCOL TRANSLATOR +.MACRO CHXCHK TAG +.IIF NE .-TAG-NCHX-NCHX, .ERROR TAG WRONG LENGTH TABLE +.ENDM CHXCHK + +;CHAOSNET INPUT SOURCE TABLES + +CHIBFP: ;BUFFER POINTER +.IIF NZ DL10P, DLCIBF ;DL10 INPUT BUFFER +.IIF NZ TEN11P, 0 ;CURRENT TEN11 INPUT BUFFER (SET FROM T11IBP+8) +.IREPT CHAOSP, CHSIBF+ ;CHAOS INPUT BUFFER +.IIF NZ ETHERP, ETHIBF ;ETHERNET +.IALSO EGTBUF ;.. +.IIF DF NDVRBF, 0 ;CURRENT DOVER BUFFER, COULD BE CHAOS OR PUP +CHXCHK CHIBFP + +CHIHDL: .IREPT NCHX, 0 ;LENGTH OF HEADER IN WORDS, PACKET CURRENTLY IN BFR + +CHISTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 HAS INPUT, -1 BEING OUTPUT) + +CHILNG: .IREPT NCHX, 0 ;LENGTH OF CONTAINED PACKET IN WORDS + +CHIOUX: .IREPT NCHX, 1 ;DESTINATION OUTPUT SINK INDEX (-1 IF DIRECTED TO PDP11 ITSELF) + +CHICBA: .IREPT NCHX, 0 ;DESTINATION CABLE ADDRESS + +CHIRFL: ;ADDRESS OF REFILL ROUTINE +.IIF NZ DL10P, DLCRFL +.IIF NZ TEN11P, T11RFL +.IREPT CHAOSP, CHSRFL +.IIF NZ ETHERP, ETHRFL ;ETHERNET +.IALSO CPOPJ ;.. +.IIF DF NDVRBF, DVRRFL +CHXCHK CHIRFL + +CHIHWR: ;POINTER TO HARDWARE +.IIF NZ DL10P, 1 ;NOT USED +.IIF NZ TEN11P, 3 ;NOT USED +.IREPT CHAOSP, CAICSR+<400*.RPCNT> ;QUAD-CHAOS INTERFACES HAVE TO BE 200 APART +.IIF NZ ETHERP, 164200 ;AND WE MAKE IT 400 BECAUSE ETHERNET GETS IN WAY +.IALSO 5 ;NOT USED +.IIF DF NDVRBF, 7 ;NOT USED + +;CHAOSNET OUTPUT SINK TABLES + +CHOHWR==CHIHWR ;POINTER TO HARDWARE + +CHOSTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 TRANSMITTING, -1 RETRANSMITTING + ; AFTER TRANS ABORT, +2 DELAYING AFTER TRANSMIT ABORT BEFORE RETRANSM) +CHOINX: .IREPT NCHX, 1 ;CURRENTLY-ACTIVE CHIxxx INDEX + +CHOXMT: ;START TRANSMISSION ROUTINE +.IIF NZ DL10P, DLCXMT +.IIF NZ TEN11P, T11XMT +.IREPT CHAOSP, CHSXMT +.IIF NZ ETHERP, ETHXMT ;ETHERNET +.IALSO 1 ;NOT USED (CHXEGT) +.IIF DF NDVRBF, DVRPKT ;DOVER +CHXCHK CHOXMT + +CHXSBN: ;SUBNET NUMBER +400 FOR STATUS SERVER +.IIF NZ DL10P, DLCADR/400+400 +.IIF NZ TEN11P, T11ADR/400+400 +.REPT CHAOSP + CONC CHAD,\.RPCNT,/400+400 +.ENDR ;CHAOSP +.IIF NZ ETHERP, ETHSBN+400 ;ETHERNET +.IALSO 776 ;NOT REAL (ETHERNET GATEWAY) +.IIF DF NDVRBF, 777 ;NOT REAL (DOVER) +CHXCHK CHXSBN + +CHXRTF: .IREPT NCHX, 0 ;NON-ZERO MEANS BROADCAST ROUTING INFO TO THIS GUY + +.IFNZ CHSBTB +CHSIDL: .IREPT NCHX, 0 ;NUMBER OF TICKS WAITING FOR TRANSMIT-DONE +CHSRST: .IREPT NCHX, 0 ;NUMBER OF TIMES HAD TO RESET HUNG INTERFACE +.ENDC ;CHSBTB + +;;; SUBNET/ROUTING TABLES + +;INDEX BY TWICE SUBNET NUMBER +SBNTYP: .IREPT NSUBNT, 0 ;TYPE OF CONNECTION TO THIS SUBNET: + ; 0 VIA GATEWAY, WITH AUTOMATIC ROUTING + ; -1 VIA GATEWAY, PATCHED IN BY HUMAN, DON'T CHANGE + ; 1 HARDWARE CONNECTION + +SBNADR: ;ADDRESS OF CONNECTION TO THIS SUBNET + ;NETWORK ADDRESS IF SBNTYP NEGATIVE OR ZERO + ;INDEX IN SOURCE/SINK TABLES IF SBNTYP GREATER THAN ZERO + 0 ;0 USED FOR UNKNOWN SUBNETS. WHEN IN DOUBT, BROADCAST. + 0 ;1 9TH FLOOR CABLE + 0 ;2 (NOT CURRENTLY USED) + 440 ;3 MX, ASSUME VIA MX-IO-11 + 426 ;4 AI, ASSUME VIA AI-CHAOS-11 + .IREPT NSUBNT-5, 0 ; WHEN IN DOUBT, BROADCAST + +SBNCST: .IREPT NSUBNT, 1000 ;COST OF ROUTING VIA CURRENT GATEWAY, SEE CHAORD + +;NOW FILL IN TABLES FOR HARDWARE CONNECTIONS THAT EXIST ON THIS MACHINE +;INCLUDING TRANSFINITE HAIR FOR ETHERNET GATEWAY INFO PACKET +ZZ==. +.IFNZ DL10P +DLCSBN==DLCADR/400 ;SUBNET PDP10 ON OTHER END OF DL10 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXDLC +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;DL10P +.IFNZ TEN11P +T11SBN==T11ADR/400 ;SUBNET PDP10 ON OTHER END OF TEN11 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXT11 +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;TEN11P +.ENDC ;CHAOSP + +.IFM MX-DL + CBLCST=11. ;CABLE CONNECTION COSTS 11. +.ENDC +.IFM AI + CBLCST=22. ;AI COSTS MORE 'CAUSE IT'S SICK +.ENDC + +.IFNZ CHAOSP ;sweet fucking jesus, palx +;HAIR FOR MULTIPLE CABLE INTERFACES +.REPT CHAOSP + CONC IZZZ==CHAD,\.RPCNT + IZZ==*2 + .=SBNTYP+IZZ + 1 + .=SBNADR+IZZ + CHXCHS+<.RPCNT*2> + .=SBNCST+IZZ + CBLCST ;THE CABLE COST +.ENDR ;CHAOSP + +.IFNZ ETHERP +.=SBNTYP+ + 1 +.=SBNADR+ + CHXETH +.=SBNCST+ + 11. +.ENDC ;ETHERP + +.=ZZ + +;;; CLOCKS +4SEC: 0 ;4-SECOND CLOCK COUNTER +15SEC: 0 ;15-SECOND CLOCK COUNTER + +.ENDC ;CHAOSP + +;PATCH AREA + +PAT: PATCH: .BLKW 100 + + .SBTTL RING BUFFERS + +.MACRO RING SIZE + 99$ ;IN-POINTER + 99$ ;OUT-POINTER + 0 ;NUMBER OF WORDS IN RING + ;MAX NUMBER ALLOWED + <2*>+99$ ;MAX ADDRESS ALLOWED + 99$ ;MIN ADDRESS ALLOWED +99$: .BLKW ;BUFFER +.ENDM + +RINGIN==0 +RINGOT==2 +RINGCT==4 +RINGSZ==6 +RINGTP==10 +RINGBT==12 +RINGBF==14 + +; DEFINE THE RING BUFFERS + +TYORNG: RING ;OUTPUT-DONE RING, CONTENTS = LINE NUMBER PDP10 STYLE + ;HAS TO BE EXTRA BIG BECAUSE THE OUTPUT DONES PUT IN ON + ;STARTUP FILL IT UP, THEN SOMETIMES ITS PUTS ONE IN + ;BEFORE IT TAKES ANY OUT. + +TYIRSZ==NCT*20 ;8 CHARS PER TTY (2 WORDS PER CHAR) +TYIRNG: RING TYIRSZ ;TTY INPUT RING, FIRST WORD IS CHARACTER, SECOND LINE NUMBER + + + +;MOV #RING,B +;MOV WORD,A +;CALL PUT + +PUT: CMP RINGCT(B),RINGSZ(B) + BLT 1$ + BPT ;BLOATED +1$: PUSH C + MOV RINGIN(B),C + MOV A,(C)+ + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGIN(B) + POP C + INC RINGCT(B) + RET + +;MOV #RING,B +;CALL GET +;WORD RETURNED IN A +; IT IS AN ERROR TO CALL THIS IF RING IS EMPTY + +GET: TST RINGCT(B) + BGT 1$ + BPT ;EMPTY +1$: PUSH C + MOV RINGOT(B),C + MOV (C)+,A + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGOT(B) + POP C + DEC RINGCT(B) + RET + +CLRING: CLR RINGCT(B) ;CLEAR A RING + MOV RINGBT(B),RINGIN(B) + MOV RINGBT(B),RINGOT(B) + RET + .IFNZ DTE20P + .SBTTL DTE20 SUBROUTINES + +;THE DTE20 MUST NOT BE HACKED AT INTERRUPT LEVEL, BECAUSE KLDCP USES IT TOO. +;THE FOLLOWING THREE LOCATIONS ARE ARGS TO/FROM THE FOLLOWING TWO SUBROUTINES. + +LH: 0 ;LOW 16 BITS OF LEFT HALF +RH: 0 ;LOW 16 BITS OF RIGHT HALF +SNB: 0 ;SIGN BIT (0 IF +, NON-0 IF -) + +;JSR B,HWEXAM +; .WORD ADDR +;EXAMINE PDP10 LOC, SPLIT INTO HALFWORDS, SET LH, RH, SNB +;RETURNS WITH "Z" SET IF LOCATION HAS POSITIVE SIGN, "Z" CLEAR IF MINUS SIGN + +HWEXAM: PUSH ;SAVE REGS + PUSH <#0,(B)+> ;PUT PDP10 ADDRESS ONTO PDL + MOV SP,A ;SET UP POINTER TO ADDRESS + EXAM ;EXAMINE LOCATION, SET A TO POINT TO 3-WORD RESULT BUFFER + BCS UHUNG ;BRANCH IF UCODE HUNG + MOV (A)+,RH ;LOW 16 BITS => RH + MOV (A)+,C ;PICK UP MIDDLE 16 BITS + MOV (A)+,A ;PICK UP HIGH 4 BITS + ROR A ;LSHC ,-2 TO GET PDP10 LH INTO C + ROR C + ROR A + ROR C + MOV C,LH + BIC #177775,A ;LEAVE SIGN BIT IN 1.2 OF A + MOV A,SNB + ADD #4,SP ;POP ADDRESS OFF PDL + POP ;RESTORE REGS + TST SNB + RTS B ;RETURN SKIPPING IN-LINE PARAMETER + +;JSR B,HWDEP +; .WORD ADDR +;ASSEMBLE LH, RH, SNB INTO PDP10 AND DEPOSIT IN ADDR + +HWDEP: PUSH + MOV LH,C + CLR A + TST SNB + BEQ 1$ + MOV #2,A +1$: ASL C + ROL A + ASL C + ROL A + PUSH ;PUSH HIGH, MIDDLE, AND LOW BITS + MOV SP,A ;POINTER TO DATA + PUSH <#0,(B)> ;PUSH HIGH AND LOW ADDRESS + MOV SP,B ;POINTER TO ADDRESS + DPOS ;DO THE DEPOSIT + BCS UHUNG ;BRANCH IF UCODE HUNG + ADD #10.,SP ;POP ADDRESS AND DATA OFF PDL + POP + TST (B)+ ;SKIP TRAILING PARAMETER + RTS B + +UHUNG: $PMSG + .WORD 1$ + SETOM NO.ITS ;GIVING UP + JMP $CNTLC + +1$: .ASCIZ/?MICROCODE HUNG/ + +.ENDC ;DTE20P + .IFNZ DL10P + .SBTTL MAIN LOOP FOR DL10 + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + BIT #DLXPRT,DLXCSR ;PORT TO 10 ENABLED? + BNE 1$ ;YES + SETOM NO.ITS ;NO, FLAG THERE IS NO ITS + SETOM DLXOFF ;AND THAT WE THINK DL10 PORT IS OFF + BR MAIN ;AND WAIT FOR IT TO TURN ON + +1$: TST DLXOFF ;DID DL10 JUST TURN ON? + BEQ 4$ ;NO, IT WAS ON BEFORE + CLR DLXOFF ;YES, SO REMEMBER THAT + MOV VERS,A ;CHECK VERSION SUPPLIED BY -10 + BEQ 2$ ;ZERO OK (MUST BE SALVAGER) + CMP A,VERSN + BEQ 2$ + BPT ;-10 AND -11 PROGRAMS NOT SAME CONFIG +2$: + +4$: BIT #DLXPAR+DLXNXM,DLXCSR ;ERROR ACCESSING MEMORY? + BEQ 5$ ;NO + BPT ;DON'T GO OFF DESTROYING PEOPLE'S FILES + +;WAIT FOR -10 TO REQUEST SERVICE, OR CLOCK TO TICK + +5$: CLR 10RQ + BIT #DLX11I,DLXCSR ;10 REQUESTING SERVICE? + BEQ 10$ + SETOM 10RQ + BIS #DLXZ11,DLXCSR ;YES, CLEAR FLAG + BR CHKOST ;AND GO CHECK FOR THINGS TO DO + +10$: TST WAKE ;NO, CHECK ANYWAY IF 60 CYCLE CLOCK HAS TICKED + BEQ MAIN ;NEITHER, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + INC DLXUP ;AND INCREMENT COUNTER 10 IS SUPPOSED + BEQ 11$ ; TO SETOM EVERY 1/2 SEC + CMP DLXUP,#15.*60. ;IF IT DOESN'T TOUCH IT FOR 15 SECONDS, + BLE 12$ ; CONSIDER IT DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ; THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS + MOV #15.*60.,DLXUP ;DON'T LET COUNTER OVERFLOW + BR 12$ ;BUT CHECK FOR COMMANDS ANYWAY (SALVAGER DISK) + +11$: CLR NO.ITS ;-10 HAS SETOMED COUNTER, IT'S UP +12$: ;FALL INTO CHKOST + +; CHECK FOR OUTPUT-START FROM -10 + +CHKOST: MOV TTYST,A ;LINE# TO START OUTPUT + BEQ CHKOUT ;NONE. + CLR TTYST ;TELL -10 IT'S BEEN PICKED UP + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT ;PUT IN RING, LATER WILL SEND IT BACK TO 10 + UNMASK + +; CHECK FOR TTY OUTPUT SENT BY -10 + +CHKOUT: MOV TYOLIN,I ;OUTPUT TO BE DONE? + BEQ CHKIN ;NO. + MOV TYOCNT,C ;YES, GET NUMBER OF CHARS + CALL TYOSER ;CALL OUTPUT HANDLER + CLR TYOLIN ;TELL 10 WE'VE GOBBLED THE OUTPUT + BIS #DLX10I,DLXCSR ;GIVE TRANSFER-COMPLETE INTERRUPT + +; CHECK FOR TTY INPUT TO BE SENT TO -10 + +CHKIN: TST TYIRNG+RINGCT + BEQ CHKDON ;NO STATUS TO BE STORED + TST TYILIN + BNE CHKDON ;PREVIOUS STATUS NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,TYICHR ;GIVE INPUT CHARACTER TO 10 + CALL GET + MOV A,TYILIN ;GIVE LINE NUMBER TO 10 + BIS #DLX10I,DLXCSR ;SEND INTERRUPT TO 10 + +; CHECK FOR OUTPUT-DONE TO BE SENT TO -10 + +CHKDON: TST TYORNG+RINGCT + BEQ CHKHNG ;NO STATUS TO BE STORED + TST TYOSTS + BNE CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET + MOV A,I + ASL I + MOV BUFSIZ(I),TYOBSZ ;TELL -10 HOW MANY CHARS TO GIVE + MOV A,TYOSTS ;GIVE OUTPUT DONE TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR HANGUPS TO BE SENT TO -10 + +CHKHNG: TST HNGSIG ;ANY HANGUPS TO BE REPORTED? + BEQ CHKLPR ;NO + TST HNGLIN + BNE CHKLPR ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,HNGLIN ;GIVE LINE NUMBER AND OTHER DATA TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR REQUEST FROM -10 TO SET LINE PARAMETERS + +CHKLPR: MOV LPRLIN,I ;LINE PARAMETERS TO BE SET? + BEQ CHKCHS ;NO. + ASL I ;YES, GET LINE INDEX + MOV LPRLPR,A ;AND DH11 PARAMETER REGISTER VALUE + MOV LPRBSZ,B ;AND BUFFER SIZE + CALL SPARAM ;CALL PARAMETER SETTER + CLR LPRLIN ;TELL 10 IT IS DONE + +; CHECK FOR CHAOS NET ACTIVITY + +CHKCHS: +.IFNZ CHAOSP + CALL DLCWAK ;WAKEUP DL10-CHAOSNET STUFF +.ENDC ;CHAOSP +.IFNZ T300P + CALL DSKSTR ;CHECK FOR DISK REQUEST +.ENDC ;T300P + +; CHECK FOR EXAMINE/DEPOSIT REQUEST FROM -10 + +CHKEXD: TST EXDSTS ;EXAMINE/DEPOSIT? + BEQ CHKGLD ;NO. + MOV EXDADR,A ;GET ADDRESS + CMP EXDSTS,#2 + BNE 21$ + MOV EXDDAT,(A) ;DEPOSIT +21$: MOV (A),EXDDAT ;EXAMINE + CLR EXDSTS ;IT IS DONE + +;CHECK FOR GOULD LPT OUTPUT + +CHKGLD: +.IF EQ GOULDP +; CLR GLPCTR ;IF NO GOULD, FLUSH OUTPUT FOR IT +; SETOM GLPTER ;AND SAY "NOT READY" + TST 10RQ + BEQ 20$ + ;10 WANTED US TO DO SOMETHING, PLAY WITH THE LIGHTS + MOV LITHSE,A + ROL A + ROL LITHSE +20$: MOV LITHSE,GLPTER +.IFF + TST GLPCTR ;ANY BYTES IN BUFFER? + BEQ 1$ + CALL GLPTYO ;YES, OUTPUT THEM +1$: MOV GLPERR,GLPTER ;COPY ERROR STATUS FROM P.I. LEVEL TO -10 +.ENDC ;DONE HERE SO NO USE OF DL10 AT P.I. LEVEL +; BR MAINX + +MAINX: JMP MAIN ;THAT'S IT +MAINE:: +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL MAIN LOOP FOR DTE20 + +MAIN: BIT #%D1RUN,DIAG1 ;IS KL10 RUNNING? + BEQ TENDED ;NO, LOSE! + BIT #%D1ERR+%D1HLT,DIAG1 ;HAS KL10 CLOCK STOPPED FOR HARDWARE ERROR? OR JRST 4 + BNE TENDED ;YES, LOSE! + TST KLDCPF ;MAYBE USER WANTS TO GIVE A KLDCP COMMAND? + BNE KLDCPR ;YES, RETURN TO KLDCP + TSTB @DLKS+NFDLHX ;CTY INPUT? + BPL 10$ ;TEST KBD BEFORE CLK SINCE MIGHT BE MORE THAN + ; 1/60'TH SECOND PER TRIP AROUND THE LOOP. + MASK 5 ;YES, SIMULATE INTERRUPT + CALL DL1IBK ;CAN'T USE REAL INTS BECAUSE WOULD INTERFERE WITH KLDCP +10$: TSTB LKS ;60 CYCLE CLOCK TICK? + BMI CLKSER ;YES + BIT #%STINV,STATUS ;REQUEST FROM 10? + BNE TENSER ;YES, SERVICE IT. + BIT #%STDNI,STATUS ;TO10 XFER COMPLETE? + BNE INPDON ;YES, SERVICE IT. + BIT #%STDNO,STATUS ;TO11 XFER COMPLETE? + BNE OUTDON ;YES, SERVICE IT. + BIT #%STERI+%STERO,STATUS + BNE LOSSAG ;BYTE TRANSFER LOST + BR MAIN ;CLOSE LOOP + +;60-CYCLE CLOCK SERVICE + +CLKSER: CLR LKS ;CLEAR CLOCK FLAG + TST CLKENB ;DOES 10 WANT CLOCK INTERRUPTS? + BEQ 1$ + D10MON ;YES, GIVE ONE + DTECLK ;SET CLOCK FLAG IN LOW CORE + BCS UHUNG + MOV #%STINX,STATUS ;AND SEND INTERRUPT +1$: CMP SWR,CURSWR ;MAYBE NEED TO UPDATE 10'S SWITCHES + BEQ 2$ + MOV SWR,CURSWR + TENSW ;LET KLDCP DO IT + BCS UHUNG +2$: JSR B,HWEXAM ;INCREMENT COUNTER -10 IS SUPPOSED + DTECHK ; TO SETOM EVERY HALF-SECOND + CLR LH + CLR SNB + INC RH + BEQ 3$ + CMP RH,#15.*60. ;IF IT DOESN'T SETOM IT FOR 15 SECONDS + BLE 4$ ;THEN IT IS DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ;THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS. + MOV #15.*60.,RH ;DON'T LET COUNTER OVERFLOW + BR 4$ + +3$: CLR NO.ITS ;IT SETOMED COUNTER, IT'S UP. +4$: JSR B,HWDEP ;PUT COUNTER BACK + DTECHK + MASK 6 ;NOW SIMULATE BR6 CLOCK INTERRUPT + CALL CLKBRK + BR TENSER ;AND GO SERVICE 10 (IN CASE LOST INTERRUPT) + +; HERE IF KL10 HALTS + +TENDED: SETOM NO.ITS + CLC + RET ;LET KLDCP PRINT THE MESSAGE + +; BYTE TRANSFER ENCOUNTERED HARDWARE LOSSAGE + +LOSSAG: BPT + BR LOSSAG + +; USER WANTS TO GIVE A KLDCP COMMAND + +KLDCPR: CLR KLDCPF + SEC + RET + +TENSER: JMP TENSR0 + +; HERE WHEN TO10 BYTE TRANSFER COMPLETE + +INPDON: MOV #%STCLI,STATUS ;CLEAR FLAGS IN DTE20 + MOV INPCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WOOPS, NO XFER IN PROGRESS +1$: CLR INPCMD ;NO XFER IN PROGRESS NOW + MOV INPSVI,I + MOV INPSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAIN + +; HERE WHEN TO11 BYTE TRANSFER COMPLETE + +OUTDON: MOV #%STCLO,STATUS ;CLEAR FLAG + MOV OUTCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WHOOPS, NO XFER IN PROGRESS +1$: CLR OUTCMD ;NO XFER IN PROGRESS NOW + MOV OUTSVI,I + MOV OUTSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAINJ + +; HERE TO START TO10 BYTE TRANSFER. HWEXAM OF DTEINP HAS BEEN DONE. + +INPSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEINP + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BEQ OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +; HERE TO START TO11 BYTE TRANSFER. HWEXAM OF DTEOUT HAS BEEN DONE. + +OUTSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEOUT + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BNE OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +OUTSR1: MOV RH,C ;GET BYTE COUNT + MOVB LH,I ;GET LINE# + MOVB LH+1,A ;GET COMMAND TIMES 2 + BEQ MAINJ ;CLEARING CORE? IGNORE ZERO COMMAND + BLE OUTSR2 + CMP A,#LBEGIN + BGT OUTSR2 + CALL @BEGIN-2(A) ;CALL APPROPRIATE BEGIN-XFER ROUTINE + BIT #2,A + BNE 1$ + MOV A,INPCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,INPSVI + MOV C,INPSVC + BR MAINJ + +1$: MOV A,OUTCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,OUTSVI + MOV C,OUTSVC +MAINJ: JMP MAIN + +OUTSR2: BR MAINJ ;BAD COMMAND FROM 10 (USED TO BE BPT) JUST IGNORE IT + +;TABLE OF ROUTINES TO PROCESS DATA TRANSFER COMMANDS FROM -10 + +BEGIN: TYOSER ;%DTTYO + ;ETHISR ;%DTETI + ;ETHOSR ;%DTETO +LBEGIN==.-BEGIN + +;TABLE OF ROUTINES TO FINISH UP DATA TRANSFERS + +FINAL: TYOFIN ;%DTTYO + ;ETHIFN ;%DTETI + ;ETHOFN ;%DTETO + +;CHECK FOR COMMANDS FROM 10, STORE STATUS IN ANY STATUS WORDS +;THAT 10 HAS SET BACK TO -1 + +TENSR0: MOV #%STUNV,STATUS ;CLEAR 10 INTERRUPTING 11 FLAG + JSR B,HWEXAM ;CHECK FOR A NON-TIMESHARING COMMAND + DTECMD + MOV RH,A ;IS THERE ONE? + BEQ TENSR1 ;NO, GO CHECK FOR TIMESHARING STUFF + CLR LH + CLR SNB + CMP A,#377 + BHI 2$ +1$: TSTB TPS ;CHAR TO BE TYPED, WAIT FOR READY + BPL 1$ + MOVB A,TPB ;TYPE IT OUT +9$: CLR RH ;CLEAR OUT THE COMMAND + JSR B,HWDEP + DTECMD + D10MON ;TELL 10 IT'S DONE + DTEFLG + JMP MAIN + +2$: CMP A,#%DTTYI + BNE 5$ + CLR RH ;SNB,LH,RH NOW HAS ZERO + SETOM DDTMOD ;KEYBOARD INPUT WANTED + TST DDTCHR ;TEST IF READY + BMI 3$ ;IF NO INPUT, GIVE ZERO + MASK 5 + MOV DDTCHR,RH ;GIVE THE CHAR + COM DDTCHR ;MAKE NEGATIVE + UNMASK +3$: JSR B,HWDEP + DTEF11 + BR 9$ + +5$: CMP A,#%DTCLN + BNE 6$ + SETOM CLKENB + BR 9$ + +6$: CMP A,#%DTCLF + BNE 7$ + CLR CLKENB + BR 9$ + +7$: BPT ;SOME COMMAND WE DON'T IMPLEMENT + BR 9$ ;IF CONTINUED, IGNORE IT + +;CHECK FOR ITS UP/DOWN + +TENSR1: TST NO.ITS ;IF SYSTEM ISN'T UP, + BNE MAINJ ;DON'T TRY TO HACK TS STUFF + INC DLXOFF ;OTHERWISE, FIRST TIME THROUGH HERE + BNE CHKOST ;WE CHECK THE VERSION + JSR B,HWEXAM + DTEVER + TST RH ;STORED? + BNE 1$ + DEC DLXOFF ;NO, DON'T LOOK AT IT + BR MAINJ ;PROBABLY CORE BEING CLEARED + +1$: CMP RH,VERSN + BEQ CHKOST + BPT ;-10 AND -11 PROGRAMS NOT SAME VERSION + +CHKOST: JSR B,HWEXAM ;CHECK FOR 10 WANTING OUTPUT START + DTEOST + BNE CHKTRN ;BRANCH IF LOCATION DTEOST IS -1 + D10MON ;HAVING PICKED IT UP, SET BACK TO -1 + DTEOST + MOV RH,A + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT + UNMASK + CLR DDTMOD ;SYSTEM UP, TURN OFF DDT MODE + MOV #-1,DDTCHR ;.. + +CHKTRN: TST INPCMD + BNE 1$ ;INPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEINP + BNE 1$ ;DTEINP -1, NO REQUEST + JMP INPSER + +1$: TST OUTCMD + BNE CHKLSP ;OUTPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEOUT + BNE CHKLSP ;DTEOUT -1, NO REQUEST + JMP OUTSER + +CHKLSP: JSR B,HWEXAM ;CHECK FOR SET LINE SPEED COMMAND + DTELSP + BNE CHKTYI + MOV RH,I ;GET LINE# + ASL I + CMP I,#NFTTY ;VALIDATE IT + BLO 1$ ;IGNORE IF BAD + CMP I,#LASTTY + BHI 1$ + JSR B,HWEXAM ;GET LPR,,BUFFERSIZE + DTELPR + MOV LH,A + MOV RH,B + CALL SPARAM ;DO IT +1$: D10MON ;DONE, SETOM + DTELSP + +CHKTYI: TST TYIRNG+RINGCT + BEQ CHKODN ;NO TTY INPUT WAITING + JSR B,HWEXAM + DTETYI + BEQ CHKODN ;PREVIOUS CHAR NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,RH ;CHAR + CALL GET + MOV A,LH ;LINE# + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,CHAR + DTETYI + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKODN: TST TYORNG+RINGCT + BEQ CHKHNG ;NO OUTPUT DONES WAITING + JSR B,HWEXAM + DTEODN + BEQ CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET ;GET LINE# WITH OUTPUT DONE + MOV A,LH + ASL A + MOV BUFSIZ(A),RH + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,BUFFERSIZE + DTEODN + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKHNG: TST HNGSIG + BEQ MAINX ;NO HANGUPS/DIALINS WAITING + JSR B,HWEXAM + DTEHNG + BEQ MAINX ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,RH ;GIVE LINE NUMBER AND OTHER DATA TO 10 + CLR LH + CLR SNB + JSR B,HWDEP + DTEHNG + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +MAINX: JMP MAIN +.ENDC ;DTE20P + +.IFZ DL10P+DTE20P + .SBTTL MAIN LOOP FOR AI + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IIF Z TEN11P, CALL CHSRUN ;DAMNED THING GETS WEDGED +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + TST WAKE ;CLOCK TICK? + BEQ MAIN ;NO, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + BR MAIN ;NOT MUCH TO DO, NO TTYS +.ENDC ;DL10P+DTE20P + + .SBTTL OUTPUT HANDLERS + +TYOSER: ASL I ;CONVERT -10 LINE# TO -11 TTY INDEX + CMP I,#NFTTY + BLO 11$ + CMP I,#LASTTY + BLOS 12$ +11$: BPT ;10 GAVE BAD LINE# +12$: MOV HDWR(I),H ;GET HARDWARE INDEX + MOV BUFPNT(I),D ;AND ADDRESS OF TYPEOUT BUFFER + CMP BUFSIZ(I),C ;MAKE SURE THERE IS ROOM IN BUFFER + BHIS 2$ + BPT ;THERE ISN'T +2$: MOV C,B ;MUSTN'T CLOBBER BYTE COUNT IN C +.IFNZ DL10P + MOV #TYOPNT,A ;GET CRUFT FROM DL10 +3$: MOVB @A,(D)+ ;COPY BUFFER + SOB B,3$ +.ENDC ;DL10P +.IFNZ DTE20P + MOV D,TO11AD ;SET UP BYTE TRANSFER + NEG B + BIC #050000,B ;SET LAST, BYTE; CLEAR ASCIZ, 2.4 + MOV B,TO11BC ;START XFER + RET + +TYOFIN: MOV HDWR(I),H ;COMES BACK WHEN XFER COMPLETE +.ENDC ;DTE20P + +;BUFFER HAS BEEN LOADED, START DEVICE + + MASK 5 ;DON'T LET DEVICE INTERRUPT + MOV BUFPNT(I),D + CALL @STROUT(H) ;CALL DEVICE-DEPENDENT ROUTINE + MOV #40000,TYPING(I) ;TELL 10 WHEN OUTPUT FINISHES (LARGE POSITIVE NUMBER) + UNMASK + RET + +;GIVE MESSAGE. A -> .WORD LENGTH,MSG. I HAS LINE NUMBER. + +GIVMSG: PUSH + MOV (A)+,C ;C HAS BYTE COUNT, A HAS ADDRESS + MOV A,D ;PUT ADDRESS IN D + MOV HDWR(I),H + MASK 5 + CALL @STROUT(H) ;START OUTPUT TO LINE + UNMASK + POP + RET + +ASPACK: MNAME ^% + MSG ^\ +‡Connected to MCHN'.\% +DWNMSG: MSG ^\ +‡ITS is down.\ +IBOMSG: MSG ^\IBO\ + +;DEVICE-DEPENDENT OUTPUT START ROUTINES (CALL AT PI LEVEL 5) +;H HDWR IDX, I TTY IDX, D BUFFER POINTER, C NUMBER OF BYTES + +STRDH: BIC DHLBIT(I),@DHBAR(H) ;IF LINE ALREADY TRANSMITTING, STOP IT + ;IT SHOULDN'T OUGHT TO BE... + MOV DHLSEL(I),@DHSCR(H) ;HARDWARILY SELECT THIS LINE + MOV D,@DHCA(H) ;SET XMT ADDRESS + NEG C ;HARDWARE LIKES NEGATIVE BYTE COUNTS + MOV C,@DHBC(H) ;SET XMT COUNT + BIS DHLBIT(I),@DHBAR(H) ;START TRANSMISSION HARDWARILY + BIS DHLBIT(I),DHOAC(H) ;SOFTWARILY ALSO + RET + +STRDL: MOV D,DLCA(H) + MOV C,DLBC(H) + CLR @DLPS(H) + MOV #300,@DLPS(H) ;CAUSE INTERRUPT + SETOM DLOAC(H) +CPOPJ: RET + +.IFNZ NMPTYS +STRMPK: TST MPXENB + BEQ CPOPJ + MOV D,MPXPNT-NFMPTY(I) ;QUEUE OUTPUT + MOV C,MPXNBT-NFMPTY(I) +STRMPX: PUSH I + TST MPXOAC ;START THE MPXR + BNE 10$ ;ALREADY BUSY + CLR I + MOV #NMPTYS,D +2$: MOV MPXNBT(I),C ;FIND MPX KLUDGE LINE WANTS TO OUTPUT + BNE 15$ + TST (I)+ + SOB D,2$ +10$: POP I + RET + +15$: MOV I,MPXOLN ;SAVE LINE# OUTPUT ON + ASR I ;SET UP HEADER + ADD #200,I + MOVB I,MPXHED + MOVB C,MPXHED+1 + MOV #-1,MPXOAC ;SEND HEADER + MOV #MPXIDX,I + MOV HDWR(I),H + MOV #MPXHED,D + MOV #2,C + CALL @STROUT(H) + BR 10$ +.ENDC ;NMPTYS + +.IFNZ GOULDP +.SBTTL GOULD LPT OUTPUT (M.P. LEVEL) +.IIF Z DL10P, .ERROR GOULD LPT ONLY CODED FOR DL10 +.ERR BY THE WAY, THESE ROUTINES DON'T WORK WORTH GUBBISH + +GLPTYO: MOV GLPOIP,H ;GET NEXT BUFFER + CMP GB.STA(H),#%GBMP + BEQ 2$ ;BRANCH IF M.P. ACTIVE + BLT 1$ ;BRANCH IF IDLE BUFFER AVAIL + RET ;NO FREE BUFFERS + +1$: CALL GLPBGB ;GOBBLE A BUFFER +2$: MOV GB.PNT(H),D + MOV GLPCTR,C ;SET UP BYTE COUNTER + MOV GLPGRF,GLPGF1 ;COPY ARG FROM 0 FOR SPEED + TST GLIMBF ;CHAR SAVED FROM LAST TIME? + BEQ GLPNCL + CLR GLIMBF ;YES, PRINT IT + MOVB GLIMBO,A + CALL GLPPUT + MOVB GLIMBO+1,A ;SECOND CHAR? + BEQ GLPNCL + CLR GLIMBO + CALL GLPPUT + +;CHARACTER PROCESSING LOOP +;C HAS # CHARS YET TO GO, D HAS WHERE TO PUT THEM, H -> BUFFER +;A WILL HAVE CHAR + +GLPNCL: MOV GLPPTR,A ;GET NEXT CHAR + TST GLPGF1 + BNE GLPNRM ;GRAPHIC MODE, NO CHARACTER PROCESSING + CMP A,#177 ;ESCAPE? + BEQ GLPESC + CMP A,#40 ;CONTROL? + BGE GLPNRM ;NO, NORMAL PRINTING + CMP A,#14 ;CHECK FOR SPECIAL CONTROLS + BNE 10$ +8$: CLR GLPROW ;START NEW PAGE + TST GLPCOL ;IN MIDDLE OF LINE? + BEQ 9$ ;NO, OK + CALL GLPBWW ;OTHERWISE, HAIR + CLR GLPFIL ;HACK HACK MAKE FF NEXT LINE + BR GLPNB1 + +9$: SETOM GB.FF(H) + BR GLPNXC + +10$: CMP A,#12 + BNE 12$ + INC GLPROW + CMP GLPROW,#GLPRMX + BHIS 8$ ;SKIP OVER PERFORATION + TST GLPCOL + BNE GLPNBF ;IF NOT A BLANK LINE, FINISH BUFFER + INC GB.NL(H) + BR GLPNXC + +12$: CMP A,#11 + BNE 15$ +13$: MOV #40,A ;TAB - SPACE OVER + CALL GLPPUT + BIT #7,GLPCOL + BNE 13$ + BR GLPNXC + +15$: CMP A,#15 + BEQ GLPNXC ;IGNORE CR + CMP A,#33 + BNE 16$ + MOV #'$,A ;PRINT ALTMODE AS DOLLAR + BR GLPNRM + +16$: BIS #100,A ;RANDOM CONTROL AS UPARROW, LETTER + MOVB A,GLIMBO+1 + MOV #'^,A + CALL GLPPUT + MOVB GLIMBO+1,A + CLR GLIMBO +GLPNRM: CALL GLPPUT ;HERE FOR NORMAL CHARACTER +GLPNXC: DEC C ;HERE TO GOBBLE CHARACTER + BGT GLPNCL ;BRANCH IF MORE CHARS TO GO + BR GLPEND ;BUFFER EMPTIED + +GLPNBF: CALL GLPBWW ;HERE TO ADVANCE TO NEXT BUFFER +GLPNB1: CMP GB.STA(H),#%GBIDL ;NEXT BUFFER AVAIL? + BNE GLPEN1 ;NO, STOP + CALL GLPBGB ;YES, GOBBLE IT + BR GLPNXC + +GLPESC: DEC C ;HERE FOR TWO CHAR ESC SEQ + BEQ GLPEND ;-10 FORGOT 2ND CHAR, FLUSH + MOV GLPPTR,A ;GET & DECODE 2ND CHAR + CMP A,#105 ;EOF + BEQ GLPEOF + BR GLPNXC ;OTHER CHARS ARE IGNORED + +GLPEOF: CLR GLPFIL + CLR GLPROW + CALL GLPBWW ;EOF, WRITE LAST BUFFER +GLPEN1: DEC C ;GOBBLE A CHARACTER +GLPEND: MOV C,GLPCTR ;HERE WHEN DONE, RELEASE 10'S BUFFER + CMP GB.STA(H),#%GBMP ;BUFFER ACTIVE AT M.P. LEVEL? + BNE 1$ ;IF NOT, DON'T CLOBBER GB.PNT + MOV D,GB.PNT(H) ;IF SO, REMEMBER AMT OF STUFF IN CURRENT BUFFER +1$: RET ;RETURN TO MAIN LOOP + +;OUTPUT PRINTING CHAR IN A + +GLPPUT: CMP D,GLPLIM ;LINE OVERFLOW? + BLO 5$ ;NO + CALL GLPBWW ;YES, DONE WITH THIS BUFFER + INC GLPROW ;OUGHT TO CHECK FOR PERFORATION, BUT... + CMP GB.STA(H),#%GBIDL ;MORE BUFFERS? + BNE 6$ ;NO + CALL GLPBGB +5$: MOVB A,(D)+ ;DROP CHAR IN BUFFER + INC GLPCOL ;AND ADVANCE COLUMN + RET + +6$: MOVB A,GLIMBO ;NO BUFFERS, SAVE CHAR BEING PRINTED + SETOM GLIMBF ;SET FLAG SO WILL BE PRINTED NEXT TIME + TST (SP)+ ;STOP THE WORLD + BR GLPEN1 + +;GOBBLE IDLE BUFFER H -> FOR M.P. RETURNS GB.PNT(H) IN D. + +GLPBGB: MOV #%GBMP,GB.STA(H) ;ACTIVATE AT M.P. LEVEL + CLR GB.FF(H) ;INIT THE BUFFER + CLR GB.NL(H) + CLR GLPCOL ;START LINE IN COLUMN 0 + MOV H,D ;INIT INSERT POINTER + ADD #GB.DAT,D + MOV D,GB.PNT(H) + MOV H,GLPLIM ;SET UP MAX. VALUE OF GB.PNT + ADD #GB.LEN,GLPLIM + RET + +;GIVE BUFFER H -> TO P.I. LEVEL + +GLPBWW: BIT #1,D ;MUST BE EVEN NUMBER OF BYTES + BEQ 1$ + CLRB (D)+ + +1$: PUSH A ;INTERFACE GETS BYTES IN WRONG ORDER + MOV P,A ;COMPUTE NUMBER OF WORDS IN LINE + SUB H,A + SUB #GB.DAT,A + ASR A + BNE 4$ + CLR (D)+ ;CAN'T HAVE ZERO-LENGTH LINE + INC A +4$: MOV A,GB.PNT(H) ;SAVE WORD COUNT FOR P.I. LEVEL +2$: SWAB -(D) + SOB A,2$ + POP A + TST GLPFIL ;IF STARTING NEW FILE, + BNE 5$ + SETOM GLPFIL + SETOM GB.FF(H) ; BE SURE TO GET NEW PAGE +5$: MOV #%GBWRT,GB.STA(H) ;QUEUE TO P.I. LEVEL + MOV GB.NXT(H),H ;ADVANCE TO NEXT BUFFER + MOV H,GLPOIP + MASK 6 ;STOP P.I. LEVEL (HAVE TO LOCK OUT GLPBRK & CLKBRK) + TST GLPOAC ;PRINTER ON? + BNE 3$ ;YUP + MOV #%GCOFF,@#GLPCSR ;NO, CLEAR OLD STUFF IN INTERFACE + TST GLPGF1 ;AND PUT IN LOW-SPEED GRAPHIC MODE IF NECC + BEQ 6$ + MOV #%GCGRF,@#GLPCSR + MOV #%GCLSL,@#GLPCSR ;LOW SPEED (COME ON, THIS IS ONLY A KL10!) +6$: MOV #%GCON,@#GLPCSR ;TURN IT ON + MOV #%GCION,@#GLPCSR ;TURN ON INTERRUPTS + SETOM GLPOAC +; PUSH @#PS ;FAKE AN INTERRUPT +; CALL GLPBRK ;IS THIS NECESSARY? +3$: UNMASK + RET + +;GOULD LPT VARIABLES + +GLPCOL: 0 ;CURRENT COLUMN NUMBER +GLPROW: 0 ;CURRENT ROW NUMBER + GLPRMX==67. ;NUMBER OF LINES PER PAGE +GLPLIM: 0 ;ADDRESS OF END OF CURRENT BUFFER +GLPOAC: 0 ;NON-ZERO => GOULD LPT P.I. ACTIVE +GLPGF1: 0 ;NON-ZERO => GOULD LPT IN GRAPHIC MODE +GLIMBO: 0 ;SAVE CHAR HERE WHEN RUN OUT OF BUFFERS +GLIMBF: 0 ;NON-ZERO => CHAR IN GLIMBO +GLPFIL: 0 ;NON-ZERO => IN MIDDLE OF A FILE +GLPTIM: 10. ;COUNT DOWN WHEN LOSING +GLPERR: 0 ;NON-ZERO => ERROR STATUS FROM P.I. +.ENDC ;GOULDP + + .SBTTL T-300 DISK + +.IFNZ T300P + +;DISK UNIBUS REGISTERS + +DSKCRA=176700 ;COMPLETION REGISTER A + %DAPON==100000 ;SPONTANEOUS COMPLETION DUE TO POWER-ON. DISK NUMBER + ; IN LOW BITS OF COMMAND-COMPLETION REGISTER B + %DACQE==10000 ;CONSISTENCY ERROR IN COMMAND QUEUE + %DANXM==4000 ;NXM ERROR IN COMMAND QUEUE + %DAPAR==2000 ;PARITY ERROR IN COMMAND QUEUE + ;LOW 2 BITS OF COMMAND COMPLETION REGISTER A AND + ;COMMAND COMPLETION REGISTER B CONTAIN THE ADDRESS + ;OF THE PARITY OR NXM ERROR +DSKCRB=176702 ;COMPLETION REGISTER B +DSKCSR=176704 ;COMMAND/STATUS REGISTER + %DCCPL==100000 ;COMMAND IS COMPLETE, RESET BY %DCACK. READ-ONLY + %DCDER==40000 ;"DMA ERROR", RESET ONLY BY SYSTEM RESET. + ;1=NORMAL, 0=ERROR + ;BITS 30004 ALWAYS ON + %DCMNT==4000 ;HOST-ADAPTOR MAINTENANCE MODE + %DCRST==2000 ;RESET. WRITE-ONLY. + %DCACK==1000 ;ACKNOWLEDGE COMMAND COMPLETION. WRITE-ONLY + %DCCMD==400 ;TAKE COMMAND FROM CTRA/CTRB. WRITE-ONLY + %DCRDY==200 ;READY TO TAKE A COMMAND. READ-ONLY + %DCTIE==100 ;COMMAND TRANSMISSION (%DCRDY) INTERRUPT ENABLE + %DCCIE==40 ;COMMAND COMPLETION (%DCCPL) INTERRUPT ENABLE + %DCPCY==20 ;POWER JUST CYCLED ON OR OFF. READ-ONLY + %DCPON==10 ;POWER ON. READ-ONLY + %DCDMA==2 ;DMA IN PROGRESS. READ-ONLY + %DCBOT==1 ;BOOT (READ DRIVE 0 SECTOR 0 INTO MEMORY 0). WRITE-ONLY +DSKCTA=176706 ;COMMAND TRANSMISSION A (ADDRESS OF RQB HIGH BITS) +DSKCTB=176710 ;COMMAND TRANSMISSION B (ADDRESS OF RQB LOW BITS) +;176714 DUPLICATES DSKCSR FOR UNKNOWN REASONS + +;DISK REQUEST BLOCK. WE ONLY HAVE ONE SINCE NO SEEK OVERLAP. + +RQBACT: 0 ;NON-ZERO IF REQUEST ACTIVE AND EXPECTING COMPLETION + +RQBID: 0 ;RETURNED IN CCRB WHEN COMMAND COMPLETES +RQBSTS: 0 ;STATUS STORED BY 2561, COPIED INTO DSCSTS +RQBFLT: 0 ;FAULT CODE IN HIGH BYTE, BITS 1-0 HIGH BITS OF LINK ADDRESS +RQBLNK: 0 ;LINK ADDRESS TO NEXT RQB (MUST BE ZERO) +RQBCMD: 0 ;COMMAND CODE, COPIED FROM DSCCMD +RQBDRV: 0 ;UNIT NUMBER, COPIED FROM DSCDRV +RQBCYL: 0 ;CYLINDER NUMBER, COPIED FROM DSCCYL +RQBHED: 0 ;HEAD NUMBER, COPIED FROM DSCHED +RQBSEC: 0 ;SECTOR NUMBER, COPIED FROM DSCSEC +RQBWC: 0 ;POSITIVE WORD COUNT (ALWAYS 12.*256.) +RQBMA: 0 ;MEMORY ADDRESS (ALWAYS DSKBUF) +RQBMAH: 0 ;MEMORY ADDRESS HIGH (ALWAYS 0) + ; BITS 1-0 BITS 17-16 OF ADDRESS. BIT 6 MA INCR INH +RQBID1: 0 ;RETURNS RECORD ID 1 +RQBID2: 0 ;RETURNS RECORD ID 2 +RQBMNT: .BLKW 27. ;DIAGNOSTIC DATA MAY BE RETURNED + +;DISK BUFFER. HOLDS ENOUGH 12-BIT BYTES IN 16-BIT WORDS TO MAKE 1024. 36-BIT WORDS +DSKBUF: .BLKW 3.*1024. + +;ROUTINE TO START DISK IF IT IS READY AND THERE IS A REQUEST. +DSKSTR: TST DSCREQ ;ANY REQUEST FROM 10? + BEQ 99$ ;NO, EXIT + CMP DSCCHK,#2561 + BNE 99$ ;CHECK WORD WRONG, DON'T TOUCH DISK + TST RQBACT ;PREVIOUS OPERATION FINISHED? + BEQ 10$ + BPT ;NO, MUST BE BUG IN 10? +10$: TSTB DSKCSR ;TEST IF READY FOR COMMAND TRANSMISSION + BPL 99$ ;NO, WAIT + CLR DSCDON ;YES, CLEAR 10/11 COMMUNICATION FLAGS + CLR DSCREQ + CLR RQBLNK ;SET UP RQB FROM 10'S PARAMETERS + MOV DSCCMD,RQBCMD + MOV DSCDRV,RQBDRV + MOV DSCCYL,RQBCYL + MOV DSCHED,RQBHED + MOV DSCSEC,RQBSEC + MOV #12.*256.,RQBWC + MOV #DSKBUF,RQBMA + CLR RQBMAH + CMP RQBCMD,#%DMWRT ;IF A WRITE COMMAND, MUST COPY DATA BUFFER + BNE 30$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVHD + .ENDR + .ENDR +30$: CLR DSKCTA ;GIVE ADDRESS OF RQB TO 2561 + MOV #RQBID,DSKCTB + SETOM RQBACT ;TELL INTERRUPT LEVEL INTERRUPT EXPECTED + MOV #%DCCMD+%DCCIE,DSKCSR ;GIVE COMMAND, ENABLE COMPLETION INTERRUPT +99$: RET ;DONE + +;CALL HERE WHEN DISK INTERRUPTS +DSKBRK: PUSH ;SAVE ALL REGISTERS + MOV DSKCSR,A + BIT #%DCPCY,A ;POWER CYCLED? + BNE 5$ ;YES, RESET CONTROLLER AND IGNORE INTERRUPT + BIT #%DCMNT,A ;NO, MAINTAINENCE MODE + BEQ 4$ ;OK + BPT ;BLEAH, MUST BE BROKEN + BR 5$ + +4$: BIT #%DCDER,A ;WHAT ABOUT UNIBUS ERROR + BNE 10$ + BPT +5$: MOV #%DCRST,DSKCSR ;RESET THE CONTROLLER AND TURN OFF INTERRUPTS + TST RQBACT ;DID THIS LOSE IN THE MIDDLE OF A DISK OPERATION? + BEQ 99$ ;NO, DISMISS + MOV #%DFRST,A ;YES, GIVE ERROR STATUS + CLR B + BR 20$ + +10$: BIT #%DCCPL,A ;TEST FOR COMMAND COMPLETION + BPL 99$ ;NO, IGNORE INTERRUPT + MOV DSKCRA,A ;GET COMPLETION STATUS + MOV DSKCRB,B + MOV #%DCACK+%DCCIE,DSKCSR ;ACKNOWLEDGE COMPLETION, ENABLE MORE INTERRUPTS + TST RQBACT ;EXPECTED? + BEQ 99$ ;NO, IGNORE + BIT #%DAPON,A ;POWER-UP INDICATION? + BNE 99$ ;FOR NOW, IGNORE IT + BIT #%DACQE+%DANXM+%DAPAR,A + BEQ 30$ ;OK, NO COMMAND-QUEUE ERROR + MOV #%DCRST,DSKCSR ;RESET CONTROLLER (I DON'T KNOW IF IT NEEDS IT) +20$: MOV A,DSCFLT ;COMMAND-QUEUE ERROR, GIVE STATUS TO PDP10 + MOV B,DSCSTS + BR 80$ + +30$: CLR DSCFLT ;CLEAR HIGH BYTE + MOVB RQBFLT+1,DSCFLT ;PICK UP FAULT CODE, PUT IN LOW BYTE + BEQ 35$ ;IF FAULT CODE IS NON-ZERO, THE THING MAY BE FROZEN, + MOV #%DCRST,DSKCSR ;SO RESET IT. OTHERWISE ERROR SEEMS TO HAPPEN OVER AND OVER +35$: MOV RQBSTS,DSCSTS ;GIVE STATUS TO PDP10 + MOV RQBCYL,DSCCYL ;STORE BACK DISK ADDRESS, MAY BE USEFUL TO PDP10 + MOV RQBHED,DSCHED + MOV RQBSEC,DSCSEC + BIT #%DMRED,RQBCMD ;IF COMMAND WAS READ, COPY BUFFER BACK + BEQ 80$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVDH + .ENDR + .ENDR +80$: SETOM DSCDON ;SIGNAL PDP10 OPERATION IS COMPLETE + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + CLR RQBACT ;NO LONGER EXPECTING COMPLETION ON THE RQB +99$: POP ;RESTORE REGISTERS AND EXIT INTERRUPT + RTI +.ENDC ;T300P + + .SBTTL SET LINE PARAMETERS + +;LINE INDEX IN I +;DH11 PARAM REG IN A +;BUFFER SIZE IN B + +SPARAM: CMP I,#NFTTY + BGE 1$ + BPT +1$: CMP I,#LASTTY + BLE 2$ + BPT +2$: CMP B,#1. ;MINIMUM BUFFER SIZE ONE CHARACTER + BGE 3$ + MOV #1.,B +3$: CMP B,#MAXBSZ ;MAXIMUM BUFFER SIZE CHARACTERS + BLE 4$ + MOV #MAXBSZ,B +4$: MOV B,BUFSIZ(I) ;SET AMOUNT OF BUFFER TO BE USED FROM NOW ON + MOV HDWR(I),H ;(BUT NO LONGER DO WE ATTEMPT DYNAMIC BUFFER ALLOCATION) + CMP H,#NLDHHX + BHI 5$ + MASK 5 ;LINE IS A DH11, HAVE TO SET LINE PARAM REG + MOV DHLSEL(I),@DHSCR(H) ;SELECT THE LINE + MOV A,@DHLPR(H) ;GIVE LINE-PARAMETER REG TO DH11 + UNMASK +5$: MOV A,LPRVAL(I) ;STORE LPR IN CASE SOMEONE IS CURIOUS + RET + + .SBTTL DH11 INPUT INTERRUPT + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHIBK: MOV (H),H ;PICK UP HARDWARE INDEX + PUSH +1$: MOV @DHNRC(H),A ;RECIEVE A CHARACTER + BPL DHIEX ;EXIT INTERRUPT IF NO MORE CHARS + MOV A,I ;EXTRACT LINE NUMBER + SWAB I + BIC #177760,I + ASL I + ADD DHTYNO(H),I +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 1$ +.ENDC + CALL @TTYIPC(I) ;CALL LINE HACKER + BR 1$ ;AND CHECK FOR MORE + +DHIEX: POP + RTI + +;NORMAL DH11 INPUT + +DHNRMI: BIT #%DXPAR,A + BEQ 1$ ;IGNORE IF PARITY ERROR +10$: RET +1$: BIT #%DXBRK,A ;IF BREAK, + BEQ RCV + TST AUTOSP(I) ;AND LINE WANTS AUTOSPEED-ON-BREAK FEATURE + BPL 10$ +ASPMD: MOV #DHASP,TTYIPC(I) ;PUT IT IN AUTOSPEED MODE + MOV DHLSEL(I),@DHSCR(H) ;AND SET HARDWARE TO 1200 BAUD + MOV #023103,@DHLPR(H) + RET + +;CHAR IN A RECEIVED FROM LINE IN I +RCV: BIC #177400,A ;8-BIT CHAR RECEIVE +RCV.FW: TST NO.ITS ;ENTER HERE FOR FULL WORD RECEIVE + BEQ 10$ +21$: MOV #DWNMSG,A ;ITS DOWN, GIVE MESSAGE +12$: CALL GIVMSG + RET + +10$: MOV #TYIRNG,B + CMP RINGCT(B),#TYIRSZ-2 + BGT 11$ + CALL PUT ;FIRST PUT THE CHARACTER + MOV I,A + ASR A + CALL PUT ;THEN THE TENNISH LINE NUMBER + RET + +11$: MOV #IBOMSG,A ;INPUT BUFFER OVERFLOW + BR 12$ + +.IFNZ NMPTYS ;HANDLE INPUT FROM THE MULTIPLEXOR LINE +MPXINP: TST MPXENB + BEQ RCV + MOV MPXSEL,I ;CURRENT INPUT LINE + TSTB A ;SPECIAL CHAR? + BMI 1$ + JMP @TTYIPC(I) ;NO, RECEIVE ON APPROP LINE + +1$: MOV A,I ;SPECIAL CHAR, EXTRACT LINE# + BIC #177700,I +;FOLLOWING FEATURE COMMENTED OUT SINCE IT CAUSES 11 TO LOOP +; WHEN NEXT INPUT ARRIVES -- NOT OBVIOUS HOW TO FIX. +; CMP I,#77 ;SELECT NON-MULTIPLEX INPUT? +; BEQ 3$ ;YES, DO SO + ASL I + ADD #NFMPTY,I + CMP I,#LASTTY + BHI 2$ ;OUT OF RANGE, IGNORE + MOV I,MPXSEL ;INPUT SELECT, SAVE LINE# +2$: RET + +3$: MOV #MPXIDX,MPXSEL ;SELECT PASS THROUGH + RET +.ENDC ;NMPTYS + +;AUTOSPEED MODE COMES HERE WHEN CHAR RECIEVED + +DHASP: BIC #177400,A ;CLEAR FRAMING ERR, ETC. + BEQ ASP10 ;11 0'S = 110 BAUD + CMP A,#200 ;7 0'S, 1 = 150 BAUD + BEQ ASP15 + CMP A,#170 ;3 0'S, 4 1'S, 0 = 300 BAUD + BEQ ASP30 + CMP A,#370 ;300/600 IS NOW RUBOUT, NOT I + BEQ ASP36 + CMP A,#146 ;1 0, 2 1'S, 2 0'S, ... = 600 + BEQ ASP60 + CMP A,#340 ;5 0'S, 3 1'S ? MYSTERY TO ME + BEQ ASP60 + CMP A,#015 ;CR = 1200 + BEQ ASP120 + CMP A,#215 ;CR WITH EITHER PARITY + BEQ ASP120 + MOV A,#. ;SAVE GARBAGE FOR DEBUGGING + RET ;SOMETHING ELSE, IGNORE + +ASP10: MOV #006307,A ;110 IN, 110 OUT, NO PARITY, 8 BITS, EXTRA STPBT + MOV #5,B + MOV #12200,-(SP) + BR ASPX + +ASP15: MOV #012503,A ;150 IN, 150 OUT, NO PARITY, 8 BITS + MOV #7,B + MOV #13300,-(SP) + BR ASPX + +ASP30: MOV #016703,A ;300 IN, 300 OUT, NO PARITY, 8 BITS + MOV #15.,B + MOV #14400,-(SP) + BR ASPX + +ASP36: MOV #020703,A ;300 IN, 600 OUT, NO PARITY, 8 BITS + MOV #30.,B + MOV #14100,-(SP) + BR ASPX + +ASP60: MOV #021003,A ;600 BAUD, NO PARITY, 8 BITS + MOV #30.,B + MOV #11100,-(SP) + BR ASPX + +ASP120: MOV #023103,A ;1200 IN, 1200 OUT, NO PAR, 8 BITS + MOV #60.,B + MOV #15500,-(SP) + BR ASPX + +ASPX: CALL SPARAM ;SET BUFFER SIZE AND HARDWARE SPEED + MOV I,A ;SET UP SET-SPEED COMMAND TO -10 + ASR A + BIS (SP)+,A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 11$ + INC HNGSIG ;INDICATE STATUS WAITING +11$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS + MOV #ASPACK,A ;ACKNOWLEDGE TO USER THAT HE WON + CALL GIVMSG + DEC TYPING(I) ;IF NO WAKEUP FOR 10, HIT CALL WHEN TYPING DONE + MOV NRMIPC(I),TTYIPC(I) ;AND TAKE LINE OUT OF AUTOSPEED MODE + RET + + .SBTTL DH11 OUTPUT INTERRUPTS + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHOBK: MOV (H),H ;GET HARDWARE UNIT NUMBER + BIT #DHSNXM,@DHSCR(H) ;IS THIS INTERRUPT DUE TO NXM? + BEQ 1$ + BPT ;YES +1$: BIC #DHTDON,@DHSCR(H) ;HARDWARE KLUDGE TO MAKE INTERRUPTS WIN + PUSH + MOV DHOAC(H),C ;SEE WHICH BAR BITS HAVE TURNED OFF + BIC @DHBAR(H),C + BIC C,DHOAC(H) + MOV DHTYNO(H),I + ADD #15.*2,I +2$: BIT DHLBIT(I),C + BEQ 4$ +.IFNZ NMPTYS + CMP I,#MPXIDX + BNE 3$ + CALL MPXDON +.ENDC ;NMPTYS +3$: +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 4$ +.ENDC + CALL XMTDON +4$: SUB #2,I + CMP I,DHTYNO(H) + BGE 2$ +DHOEX: POP + RTI + +XMTDON: TST TYPING(I) ;HERE WHEN OUTPUT FINISHES + BGT 1$ ;BRANCH IF -10 WANTS TO KNOW ABOUT IT + BEQ 3$ ;BRANCH IF NOTHING TO DO + MOV #32,A ;SEND A CALL + CALL RCV + BR 3$ + +1$: MOV I,A + ASR A ;PUT TENNISH LINE NUMBER INTO RING + MOV #TYORNG,B ;MAIN PROG LEVEL WILL LATER TELL -10 + CALL PUT +3$: CLR TYPING(I) + RET + +.IFNZ NMPTYS ;OUTPUT DONE ON MULTIPLEXED LINE +MPXDON: PUSH + TST MPXOAC + BGE 1$ + NEG MPXOAC ;SENT HEADER, NOW SEND DATA + MOV MPXOLN,A + MOV MPXPNT(A),D + MOV MPXNBT(A),C + CLR MPXNBT(A) + CALL @STROUT(H) + BR 9$ + +1$: MOV MPXOLN,I ;OUTPUT IS DONE ON THAT LINE NOW + ADD #NFMPTY,I + CALL XMTDON + CLR MPXOAC ;MPX IDLE + CALL STRMPX ;LOOK FOR NEW STUFF TO DO +9$: POP + RET +.ENDC ;NMPTYS + + .SBTTL DL11 INTERRUPTS + +.REPT NDLS +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +.ENDR + +DLIBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + PUSH + MOV @DLKB(H),A ;GET RECEIVED CHARACTER + MOV DLTYNO(H),I ;GET LINE NUMBER RECEIVED ON +.IFNZ DTE20P + BNE 2$ ;ONLY T00 CAN RETURN TO KLDCP + BIT #20000,A ;IF BREAK KEY IS HIT + BEQ 1$ + SETOM KLDCPF ;USER WANTS TO RETURN TO KLDCP + BR DLBKEX ;FOR ONE COMMAND LINE + +1$: TST DDTMOD ;IF IN DDT MODE, + BEQ 2$ + BIC #-200,A ; HANDLE INPUT DIFFERENTLY + MOV A,DDTCHR + BR DLBKEX + +2$: +.ENDC ;DTE20P + CALL @TTYIPC(I) +DLBKEX: POP + RTI + +DLOBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + TST DLOAC(H) + BEQ DLBKX1 ;NOT SUPPOSED TO BE TYPING OUT, IGNORE INT + DEC DLBC(H) ;GOT ANY MORE CHARACTERS? + BLT DLBKX2 ;NO, GO GIVE OUTPUT DONE + MOV DLCA(H),-(SP) ;YES, GIVE NEXT CHARACTER + MOVB @(SP)+,@DLPB(H) + INC DLCA(H) +DLBKX1: POP H + RTI + +DLBKX2: PUSH ;OUTPUT DONE + MOV DLTYNO(H),I ;GET TTY INDEX OF INTERRUPTING LINE + CLR DLOAC(H) ;OUTPUT NO LONGER ACTIVE ON THIS LINE + CALL XMTDON + BR DLBKEX + + .SBTTL CLOCK INTERRUPT + +;NOTE - IT IS IMPORTANT THAT THIS BE AT A HIGHER INTERRUPT LEVEL THAN THE CHAOS NET +CLKBRK: SETOM WAKE ;WAKE UP MAIN LOOP +.IFNZ GOULDP + PUSH @#PS ;CHECK GOULD LPT + CALL GLPBRK ;(LOSES INTERRUPTS) + DEC GLPTIM ;TIME TO CHECK GOULD LPT? + BGT 13$ ;NOT YET + MOV #10.*60.,GLPTIM + BIT #%GSNRD,@#GLPCSR ;YES, LOSING? + BNE 14$ ;PROBABLY + CLR GLPERR ;PROBABLY NOT + BR 13$ ;(CAN'T TELL FOR SURE IF %GCON NOT DONE) + +14$: MOV @#GLPCSR,GLPERR ;LPT LOSING, TELL 10 + CALL GLPRST ;AND MAKE SURE BUFFERS DON'T CHOKE UP +.ENDC ;GOULDP +13$: PUSH +.IFNZ NDMS ;MODEM SCANNER GETS SHUT OFF SOMEHOW + CLR A ;loop over the DM11s, turning them on + MOV #NDMS,B +259$: BIT #DMSCN,@DMCSR(A) + BEQ 14$ + BIT #DMIEN,@DMCSR(A) + BNE 15$ +14$: MOV #DMSCN+DMIEN,@DMCSR(A) ;ENABLE SCANNER INTERRUPTS +15$: TST (A)+ ;next DM11 + SOB B,259$ ;until all DM11s done + +.ENDC ;NDMS +.IFNZ CHAOSP ;WAKE-UP OUTPUT LINKS IN RE-TRANSMIT DELAY + MOV #CHXCHS,I +50$: MOV CHOHWR(I),A ;ADDRESS OF HARDWARE CSR + TST CHOSTS(I) ;IF ZERO, IS IDLE, DON'T WANT INTERRUPT ENABLE + BEQ 51$ ;NOTE THAT THIS RUNS MASKED HIGHER THAN CHAOS INT LVL + BIS #%CATEN,(A) ;RE-ENABLE INTERRUPT IF OFF +51$: +.IFNZ CHSBTB + BIT #%CATDN,(A) ;TRANSMIT-DONE? + BNE 59$ + INC CHSIDL(I) ;NO, KEEP TIME-OUT + CMP CHSIDL(I),#60. ;IF TRANSMIT-DONE STUCK OFF FOR 1 SECOND, + BLO 59$ + MOV #%CARST,(A) ; THEN RESET THE INTERFACE +; MOV #%CAREN+%CATEN,(A) ;INTERRUPT ENABLES WILL TURN THEMSELVES BACK ON IF NECESSARY! + INC CHSRST(I) ;COUNT NUMBER OF TIMES HAD TO DO THIS +59$: +.ENDC ;CHSBTB +.IFG CHAOSP-1 + TST (I)+ + CMP I,#CHXCHS+CHAOSP+CHAOSP + BLO 50$ +.ENDC ;CHAOSP-1 + DEC PULSAR ;TIME TO GENERATE TEST PACKET TO CHAOS NET? + BGT 66$ ;NOT YET + MOV PULSON,PULSAR ;RE-INITIALIZE COUNTER +.REPT CHAOSP ;YES, AWAKEN ALL TRANSMIT INTERRUPT SIDES + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IFNZ TEN11P + TST CHOSTS+CHXT11 ;AWAITING BUFFER FROM 10? + BNE 65$ ;YES, COUNT TIMEOUT + CLR T11TIM ;NO, RESET TIMEOUT +65$: INC T11TIM +.ENDC ;TEN11P +66$: DEC 4SEC ;TIME FOR 4-SECOND CLOCK? + BGT 90$ + MOV #4*60.,4SEC ;YES + MOV #*2,I ;INCREMENT ROUTING COSTS +71$: TST SBNTYP(I) ;THIS GUY'S COSTS SUPPOSED TO INCREMENT? + BNE 72$ ;NOPE + CMP SBNCST(I),#1000 ;DON'T INCREMENT TOO HIGH AND OVERFLOW + BHIS 72$ + INC SBNCST(I) ;YEP +72$: SUB #2,I + BPL 71$ + DEC 15SEC ;TIME FOR 15-SECOND CLOCK? (REALLY 16) + BGT 90$ + MOV #4,15SEC ;YES +.REPT CHAOSP ;TELL CABLES TO BROADCAST %CORUT PACKETS + SETOM CHXRTF+CHXCHS+<2*.RPCNT> + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ ETHERP, SETOM CHXRTF+CHXETH ;TELL ETHERNET TO BROADCAST ROUTING +90$: ;CAN'T DO IT NOW BECAUSE WRONG INTERRUPT LEVEL +.ENDC ;CHAOSP +.IF DF NDVRBF + INC DVRTIM ;TIME OUT DOVER CONNECTION + CMP DVRTIM,#15.*60. ;IF IDLE FOR 15 SECONDS, FLUSH + BLO 15$ + CLR DVRHST + CLR DVRMSK +15$: INC DVRRTR ;COUNT UP RETRANSMISSION COUNTER +.ENDC ;NDVRBF +.IFNZ NDMS ;GOT ANY TTYS WITH MODEM CONTROL? + MOV #NFTTY,I ;CHECK FOR HANGUPS +16$: TST DIALED(I) ;HANGUP IN PROGRESS ON THIS LINE? + BPL 17$ ;NO + INC DIALED(I) ;YES, TIMED OUT? + BMI 17$ + CLR DIALED(I) ;YUP, LINE IS HUNG UP + MOV I,A ;TELL -10 ABOUT IT + ASR A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 18$ + INC HNGSIG ;INDICATE STATUS WAITING +18$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS +17$: ADD #2,I + CMP I,#LASTTY + BLO 16$ +.ENDC ;NDMS + POP + + ROR SWR ;LOW BIT OF SWITCHES => DDT + BCC CLKEX + BPT +CLKEX: RTI + .IFNZ NDMS + .SBTTL MODEM CONTROL + +;;; hack multiple DM interrupt vectors +.REPT NDMS +CONC DM,\.RPCNT+1, + 2*.RPCNT +.ENDR ;NDMS + + +DMBRK: PUSH + MOV (H),A ;get the device offset in A + MOV @DMCSR(A),I ;GET ASSOCIATED TTY INDEX + BIC #177760,I ;gives us channel (0-17) on this DM11 + ;; now add to get offset into table for any DM + MOV A,B ;device offset in B, is 2*device number + ASL B + ASL B + ASL B ;multiply by 8 for offset in B + ADD B,I ;add to I for offset for this channel + ASL I ;now get word offset in I by shifting + ;; get index into map between DM channels and TTY indices + MOV M2LMAP(I),I + BEQ 90$ ;EXIT IF THIS LINE NOT UNDER MODEM CONTROL +; TST @DMCSR(A) .SEE DMRNG +; BPL 10$ +; TST DIALED(I) ;RINGING. IS LINE DIALED UP ALREADY? +; BNE 10$ ;YES, NOT SUPPOSED TO BE RINGING +; MOV #LINENB+LINDTR,@DMLSR(A) ;ANSWER THE PHONE + +10$: BIT #LINCTS,@DMLSR(A) ;DO WE HAVE CLEAR-TO-SEND? + BEQ 20$ ;NO + TST DIALED(I) ;YES, WHAT WAS PREVIOUS STATE? + BEQ 13$ ;WAS OFF, THIS IS A DIALUP + BPL 90$ ;WAS ON, IGNORE + NEG DIALED(I) ;WAS HANGING UP, ABORT IT + BR 90$ + +13$: INC DIALED(I) ;LINE IS NOW DIALED UP + TST DMINI ;IF GETTING INITIAL STATE, + BNE 90$ ;DON'T HACK AUTOSPEED + TST AUTOSP(I) ;IF IT HAS AUTOSPEED, + BEQ 90$ + MOV HDWR(I),H ;HACK THAT + CALL ASPMD + BR 90$ + +20$: TST DIALED(I) ;CTS DROPPED + BMI 90$ ;ALREADY KNOWN ABOUT, IGNORE + MOV #-HNGDLY,DIALED(I) ;OTHERWISE START HANGUP TIMEOUT + +90$: BIC #DMDON,@DMCSR(A) ;RESTART SCANNER + POP + POP H + RTI +.ENDC ;NDMS + +.IFNZ GOULDP +.SBTTL GOULD PRINTER P.I. LEVEL + +GLPBRK: BIT #%GSBSY,@#GLPCSR + BEQ 1$ + RTI ;LPT BUSY, WAIT + +1$: BIT #%GSDON,@#GLPCSR + BNE 2$ + RTI ;LPT BUSY OTHER FLAVOR + +2$: PUSH + BIT #%GSERR,@#GLPCSR ;LPT LOSING? + BEQ GLPBR1 + CALL GLPRST ;YUP, RESET THE BUFFERS + MOV @#GLPCSR,GLPERR ;AND TELL 10 + +GLPOFF: CLR GLPOAC ;HERE TO STOP P.I. + MOV #%GCIOF,@#GLPCSR + MOV #5000.,A ;LPT SOMETIMES BUSY FOR A WHILE +1$: BIT #%GSBSY,@#GLPCSR ;HAVE TO WAIT SO TONER PUMPS WILL + BEQ 2$ ;REALLY TURN OFF + SOB A,1$ +2$: MOV #%GCOFF,@#GLPCSR +GLPEX: POP + RTI + +GLPFIN: MOV #%GBIDL,GB.STA(H) ;DONE WITH THIS BUFFER + MOV GB.NXT(H),H ;CHECK NEXT + MOV H,GLPOOP + +GLPBR1: MOV GLPOOP,H ;CHECK ON BUFFERS + CMP GB.STA(H),#%GBDMA ;FINISH DMA XFER? + BEQ GLPFIN ;YES + CMP GB.STA(H),#%GBWRT ;QUEUED OR ALREADY ACTIVE AT P.I.? + BLT GLPOFF ;NO, STOP + MOV #%GBPI,GB.STA(H) ;YES, ACTIVATE IT AT P.I. + TST GB.FF(H) ;NEED FF? + BEQ 1$ + MOV #%GCFF,@#GLPCSR ;YES + CLR GB.FF(H) + BR GLPEX + +1$: TST GB.NL(H) ;NEED BLANK LINES? + BEQ 2$ + DEC GB.NL(H) ;YES, GIVE ONE + MOV #%GCADV,@#GLPCSR + BR GLPEX + +2$: MOV H,B ;SET UP TEXT ADDR + ADD #GB.DAT,B + MOV GB.PNT(H),A ;SET UP TEXT WORD COUNT + NEG A + MOV A,@#GLPWC + MOV B,@#GLPCA ;START XFER + MOV #%GBDMA,GB.STA(H) ;FLAG BUFFER ACTIVE AT DMA LEVEL + BR GLPEX + +GLPRST: PUSH H + MOV #GLPBFF,H ;FLUSH ALL BUFFERS + MOV H,GLPOOP + MOV H,GLPOIP +3$: CLR (H)+ + MOV (H),H + CMP H,#GLPBFF + BNE 3$ + MOV #60.*10.,GLPTIM ;SET TIMEOUT + POP H + RET + +.ENDC ;GOULDP + +.IFNZ CHAOSP + + .SBTTL CHAOSNET ROUTINES + +;ALL ROUTINES ON THIS PAGE CALLED WITH INTERRUPTS MASKED, INDEX IN I. + +;REFILL FROM CHAOS INTERFACE +CHSRFL: BIS #%CAREN,@CHIHWR(I) ;TURN ON RECEIVER INTERRUPTS + RET ;WILL NOTICE INPUT LATER + +.IFNZ DL10P +;LOOPS BACK TO HERE WHEN DISCARDING A PACKET +DLCRF1: CMP (SP)+,(SP)+ ;POP + POP A + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + ;DROP INTO DLCRFL +;REFILL FROM DL10 +DLCRFL: CALL DLCCHK ;SEE IF DL10 IS DISABLED + BNE 99$ ;BRANCH IF YES + MOV #2,A ;CHECK BOTH 10 TO 11 BUFFERS SO CAN'T GET OUT OF PHASE WITH 10 +10$: CMP DLCSS1(A),#1 ;10 SAYS BUFFER READY? + BEQ 11$ ;YES + SUB #2,A ;NO, TRY NEXT + BPL 10$ + BR 99$ ;NONE READY + +11$: PUSH A ;SAVE CURRENT 10 TO 11 BUFFER + ADD #DLCSP1,A ;OUTPUT READY, GET IT + MOV #DLCIBF,B ;COPY INTO BUFFER +.REPT PKHDW ;FIRST GET HEADER + MOV (A),(B)+ +.ENDR + PUSH + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS DLCRF1 ;BRANCH IF PACKET NO GOOD + POP + PUSH C + SUB CHIHDL(I),C ;GET NUMBER OF DATA WORDS TO FOLLOW + CALL MOVHD ;MOVE THOSE WORDS + POP ;RESTORE LENGTH, 10 TO 11 BUFFER NUMBER + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +;TRANSMIT TO DL10 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +DLCXMT: CALL DLCCHK ;DL10 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + MOV DLCRBN,A ;GET CURRENT 11 TO 10 BUFFER NUMBER + CMP DLCRS1(A),#1 ;BUFFER READY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXDLC,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHILNG(D),C ;AND LENGTH + MOV CHIBFP(D),D + MOV A,H ;GET POINTER TO DL10 MAGIC IDPB WORD + ADD #DLCRP1,H + CALL MOVDH ;COPY WORDS INTO PDP10 + INC DLCRS1(A) ;SIGNAL DATA AVAILABLE TO PDP10 + BIS #DLX10I,DLXCSR ;AND INTERRUPT IT + MOV DLCNXT(A),DLCRBN ;SWITCH BUFFERS +70$: JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXDLC ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;CALL HERE WHEN DL10 INTERRUPTS, CLOBBERS ALL. +DLCWAK: MASK 5 + TST CHOSTS+CHXDLC ;DL10 HUNG ON TRANSMIT? + BEQ 10$ + MOV #CHXDLC,I ;YES, WAKE IT UP + CALL DLCXMT +10$: TST CHISTS+CHXDLC ;DL10 INPUT ACTIVE? + BNE 20$ + MOV #CHXDLC,I ;NO, TRY TO GET SOME + CALL DLCRFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +;RETURN 'NE' IF DL10 IS DISABLED, BASHES NOTHING. +DLCCHK: TST DLXOFF + BNE 99$ + TST NO.ITS + BNE 99$ + TST DLCINI ;RE-INITIALIZE? + BEQ 99$ ;NO, EVERYTHING IS OK. + CLR DLCRBN ;YES + TST CHOSTS+CHXDLC ;WAS OUTPUT HUNG ON DL10? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON DL10 + MOV #CHXDLC,I + CALL CHSODN + POP +90$: CLR DLCINI ;SIGNAL INIT DONE, RETURN 'EQ' +99$: RET +.ENDC ;DL10P + +;FAST BLOCK MOVE +;THESE CAN MOVE AT MOST 256. WORDS + +;MOV (H),(D)+ +;SOB C,.-2 +MOVHD: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (H),(D)+ + .ENDR + RET + +;MOV (D)+,(H) +;SOB C,.-2 +MOVDH: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (D)+,(H) + .ENDR + RET + +.IFNZ TEN11P +;REFILL FROM TEN-11 INTERFACE +T11RFL: CALL T11CHK ;CHECK FOR DISABLE + BNE 99$ ;BRANCH IF DISABLED + MOV T11IBP,A + TST T11IBA ;WAS INPUT BUFFER IN USE? + BEQ 10$ + CLR (A)+ ;YES, INDICATE BUFFER IS NOW EMPTY + CLR (A) + CLR T11IBA + ADD #T11BFL-2,A ;ADVANCE POINTER + CMP A,#T11IBE + BLO 7$ + MOV #T11IBF,A +7$: MOV A,T11IBP +10$: TST (A) ;INPUT BUFFER CONTAIN A PACKET? + BEQ 99$ ;NO + SETOM T11IBA ;YES, INPUT BUFFER NOW ACTIVE + ADD #8,A ;GET INPUT FROM PDP10 + MOV A,CHIBFP+CHXT11 ;AS CURRENT INPUT BUFFER + CALL CHSIHD ;PROCESS THE HEADER + BVS T11RFL ;BRANCH IF PACKET NO GOOD + PUSH ;COMPUTE CHECKSUM BEFORE SWABBING + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + SUB #PKFCMS+1,PKFC(A) ;DECREMENT FWD COUNT (IS HIGH END OF WORD) + ;FWD COUNT HAS TO BE PUT BACK FOR CHECKSUM COMPUTATION +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11IBP,A ;NOW COMPARE CHECKSUM + CMP H,4(A) + BNE 30$ + CMP D,6(A) + BNE 30$ + POP + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +30$: POP ;CHECKSUM ERROR + INC T11CKE ;COUNT CHECKSUM ERRORS + BR T11RFL ;AND IGNORE PACKET + +;TRANSMIT TO TEN11 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +T11XMT: CALL T11CHK ;TEN11 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + TST @T11OBP ;OUTPUT BUFFER EMPTY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXT11,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHIBFP(D),B + MOV CHILNG(D),C ;AND LENGTH + MOV PKNBYT(B),A + BIT #1,A ;IF ODD NUMBER OF BYTES, CLEAR THE EXTRA ONE + BEQ 5$ + BIC #PKNBMS,A + ADD B,A + CLRB PKDAT-1(A) ;NOTE, AT THIS POINT BYTES ARE SWAPPED +5$: MOV T11OBP,A ;COPY INTO TEN11 OUTPUT BUFFER + ADD #8,A + PUSH +10$: MOV (B)+,(A)+ + SOB C,10$ + MOV (SP),C ;NOW COMPUTE CHECKSUM + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + BCS 11$ + CLR (A)+ ;IF ODD NUMBER OF 16-BIT WORDS, CLEAR THE EXTRA ONE +11$: CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + MOV T11OBP,A + ADD #8,A +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11OBP,A ;STORE CHECKSUM INTO OUTPUT BUFFER + MOV H,4(A) + MOV D,6(A) + POP + SETOM (A) ;SIGNAL PRESENCE OF PACKET TO PDP10 + ADD #T11BFL,A ;ADVANCE POINTER + CMP A,#T11OBE + BLO 30$ + MOV #T11OBF,A +30$: MOV A,T11OBP +70$: CLR T11TIM ;NO TIMEOUT, 10 IS TAKING PACKETS + JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXT11 ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;WHACK YOUR TEN11 +T11WAK: MASK 5 + MOV #CHXT11,I + CALL T11CHK ;IS 10 UP? + BNE 30$ ;IT'S DOWN, PUNT IT + TST CHOSTS(I) ;TEN11 HUNG ON TRANSMIT? + BEQ 10$ + CALL T11XMT ;YES, WAKE IT UP +10$: TST CHISTS+CHXT11 ;TEN11 INPUT ACTIVE? + BNE 20$ + MOV #CHXT11,I ;NO, TRY TO GET SOME + CALL T11RFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +30$: TST CHOSTS(I) ;TRANSMITTING TO DEAD TEN-11? + BEQ 20$ + CLR T11TIM ;YES, FLUSH IT + CALL CHSODN + BR 20$ + +;CHECK TEN-11 INTERFACE, DO RESET IF NECESSARY, RETURN 'NE' IF DISABLED. +;SMASHES NOTHING. +T11CHK: CMP T11TIM,#5*60. ;10 TAKING 5 SECONDS TO RESPOND? + BLO 5$ + SETOM T11I10 ;YES, DECLARE IT DOWN, REINITIALIZE PROTOCOL +5$: TST T11I10 ;IS 10 DONE INITIALIZING? + BNE 99$ ;NO, DO NOTHING + TST T11I11 ;ARE WE SUPPOSED TO INITIALIZE? + BEQ 99$ ;NO, IT'S OK + MOV #T11OBF,T11OBP ;YES, REINITIALIZE POINTERS + MOV #T11IBF,T11IBP + PUSH A + MOV #T11OBF,A ;INITIALIZE INPUT AND OUTPUT BUFFER HEADERS +10$: CLR (A)+ ;CLEAR INTER-MACHINE SIGNAL WORD + CLR (A)+ + ADD #T11BFL-4,A ;SKIP THE REMAINING WORDS + CMP A,#T11IBE + BLO 10$ + CLR T11IBA ;IDLE THE INPUT + POP A + TST CHOSTS+CHXT11 ;WAS OUTPUT HUNG ON TEN11? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON TEN11 + MOV #CHXT11,I + CALL CHSODN + POP +90$: CLR T11I11 ;SIGNAL INIT DONE, RETURN 'EQ' + CLR T11I11+2 +99$: RET +.ENDC ;TEN11P + +;THIS ROUTINE PROCESSES THE HEADER OF PACKET IN INPUT BUFFER FOR SOURCE I +;RETURN DESTINATION OUTPUT SINK INDEX IN B (-1 IF THIS IS FOR US (PDP11 ITSELF)), +;PACKET BUFFER POINTER IN A, AND LENGTH IN WORDS IN C. +;RETURNS WITH OVERFLOW SET IF PACKET IS DISCARDED BECAUSE OF +;TOO MUCH FORWARDING, BAD ADDRESS, TOO BIG, CRUFTY, ETC. +;OTHERWISE RETURNS WITH MINUS INDICATOR SET IF PACKET DIRECTED TO 11. +CHSIHD: ADD #1,NPKSI(I) ;COUNT PACKETS IN FROM THIS SOURCE + ADC HPKSI(I) + MOV CHIBFP(I),A ;POINTER TO PACKET + TSTB (A) ;CHECK FOR MUPPET + BNE CHSIHB ;DISCARD, WE DON'T SUPPORT THEM + MOV #PKHDW,CHIHDL(I) ;SET HEADER LENGTH + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + BCS CHSIHB ;BRANCH IF FORWARDING LOOP + MOV PKNBYT(A),C ;GET BYTE COUNT + BIC #PKNBMS,C + CMP C,#DATMAX + BHI CHSIHB ;TOO LONG, LOSES + INC C ;MAKE WORD COUNT + ASR C + ADD CHIHDL(I),C ;ADD IN LENGTH OF HEADER + MOV C,CHILNG(I) ;SAVE FOR LATER USE + ;; NOW ROUTE THIS PACKET + MOV #-1,B ;MAGIC INDEX MEANING "MYSELF" + MOV PKDHST(A),D ;GET DESTINATION ADDRESS + ;HERE WE HAVE HAIR FOR MULTIPLE CHAOSNETS +.REPT CHAOSP + CONC ,\.RPCNT ;ADDRESSED TO PDP11 ITSELF? + BEQ 50$ ;YES, LET CHSRUN HANDLE IT LATER +.ENDR ;CHAOSP + CMPB PKOP(A),#%CORUT ;ROUTING INFO PACKET? + BEQ 40$ ;YES, ADDRESS TO PDP11 + TST USECBL ;SUPPOSED TO USE CABLE EVEN TO TALK TO SELF? + BEQ 20$ + CMP I,#CHXCHS ;YES, IS THIS COMING FROM CABLE? + BHIS 20$ ;YES, ROUTE REGULAR WAY + MOV #CHXCHS,B ;NO, SEND TO SELF ON FIRST CABLE + MOV #CHAD0,D + BR 39$ + +20$: MOVB PKDHST+1(A),B ;GET SUBNET ADDRESSED TO + CMP B,#NSUBNT + BLO 21$ + CLR B ;OUT OF RANGE, USE 0 +21$: ASL B ;MAKE INDEX INTO SUBNET TABLES + TST SBNTYP(B) ;IS THIS A DIRECT HARDWARE CONNECTION? + BGT 38$ ;YES, SEND TO IT + MOV SBNADR(B),D ;NO, GO VIA GATEWAY + BEQ CHSIRF ;HAVEN'T GOT A GATEWAY, AND BROADCAST CODE NOT WORKING YET + MOVB SBNADR+1(B),B ;GET SUBNET GATEWAY IS ON + ASL B ;MAKE INDEX INTO TABLES + CMP B,#NSUBNT*2 + BHIS CHSIRF ;OUT OF RANGE, CAN'T GET THERE FROM HERE + TST SBNTYP(B) ;IS THIS A DIRECT CONNECTION? + BLE CHSIRF ;NO, CAN'T GET THERE FROM HERE (SHOULDN'T HAPPEN!) +38$: MOV SBNADR(B),B ;GET SINK INDEX +39$: MOV D,CHICBA(I) ;STORE CABLE ADDRESS OF IMMEDIATE DEST (GATEWAY) +.IIF NDF NDVRBF, 50$: ;IF NO DOVER, ALL TO-11 PACKETS COME HERE +40$: MOV B,CHIOUX(I) ;STORE SINK INDEX, SET INDICATORS + RET ;NOTE THAT MOV CLEARS OVERFLOW + +.IF DF NDVRBF +50$: CMP PKDIND(A),DVRLIX ;DIRECTED TO DOVER? + BNE 40$ ;NO, TO 11 + CMP PKSHST(A),DVRHST + BNE 40$ ;NOT DOVER-CONNECTED HOST + CMP PKSIND(A),DVRIDX + BNE 40$ ;RIGHT HOST, WRONG PROCESS + MOV #CHXDVR,B ;ROUTE PACKET TO DOVER GATEWAY + BR 40$ +.ENDC ;NDVRBF + +;HERE FOR ROUTING FAILURE. METER, RETURN WITH OVERFLOW SET. +CHSIRF: INC NPKSRF + MOV B,RFSBNT ;SAVE 2* SUBNET TRYING TO GET TO + ;FALL INTO CHSIHB +;HERE WHEN CHSIHD SEES A GARBAGE PACKET. RETURN WITH OVERFLOW SET. +CHSIHB: ADD #1,NPKSBD(I) ;GOD-DAMN BRAIN-DAMAGE + ADC HPKSBD(I) + SEV + RET + +;SWAB PACKET COMING FROM PDP-10 OR ETHERNET (BYTES LEFT TO RIGHT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB10: BMI CHSSWB ;SWAB IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ CHSSWB ;PDP11 OR CHAOSNET, SWAB IT OUT +5$: RET ;PDP10 OR ETHERNET, LEAVE ALONE + +;SWAB PACKET COMING FROM PDP-11 OR CHAOSNET (BYTES RIGHT TO LEFT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB11=. + BMI 5$ ;RETURN IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ 5$ ;PDP11 OR CHAOSNET, LEAVE ALONE + ;PDP10 OR ETHERNET, SWAB IT OUT + ;DROPS THROUGH INTO CHSSWB +;THIS ROUTINE SWABS THE PACKET FOR THE SOURCE IN I. +;CALLED WITH NUMBER OF WORDS IN PACKET IN C. +;CLOBBERS A, C, AND D. +;SUITABLE FOR CALLING RIGHT AFTER CHSIHD RETURNS. +CHSSWB: MOV CHIBFP(I),A ;ADDRESS OF PACKET + SUB CHIHDL(I),C ;GET LENGTH OF DATA AREA IN WORDS + BLE 99$ ;EMPTY + MOVB PKOP(A),D ;GET OPCODE + BPL 5$ ;BRANCH IF NON-DATA + BIT #100,D ;CHECK FOR BINARY DATA + BEQ 10$ ;NO, GO SWAB +99$: RET + +5$: TSTB CHSBIN(D) ;CONTROL, LOOK UP OPCODE + BNE 99$ ;BINARY, NO SWAB +10$: ADD CHIHDL(I),A ;POINT TO DATA AREA OF BUFFER + ADD CHIHDL(I),A ;BYTES, WATSON, BYTES! + SUB #PKTMXW,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO SWAB TABLE + .REPT PKTMXW + SWAB (A)+ + .ENDR + RET + +;BYTE TABLE INDEXED BY OPCODE, NON-ZERO IF BINARY +;BINARY OPERATIONS ARE 2 (%COOPN), 7 (%COSTS), 10 (%CORUT) +CHSBIN: .BYTE 0,0,2,0,0,0,0,7,10,0,0,0,0,0 + .BYTE 0,0 ;SPARES IN CASE MORE OPCODES ADDED + .EVEN + +;TRANSMIT PACKET FROM INPUT SOURCE I TO OUTPUT SINK, IN B. +;SMASHES ALL REGISTERS. CHISTS(I), CHIOUX(I), CHICBA(I) MUST BE ALREADY SET UP. +CHSOUT: TST B ;THIS DESTINED TO PDP11? + BMI CHSOUX ;YES, LET CHSRUN PICK IT UP LATER + TST CHOSTS(B) ;IS SINK BUSY? + BNE CHSOUX ;YES, CAN'T SEND NOW, WILL TRY AGAIN LATER + NEG CHISTS(I) ;NO, SET SOURCE STATUS TO CONNECTED + MOV I,CHOINX(B) ;CONNECT SINK TO SOURCE + MOV B,I ;SET UP SINK INDEX + ADD #1,NPKSO(I) + ADC HPKSO(I) + JMP @CHOXMT(I) ;GO START TRANSMISSION TO SINK + +;CALL HERE WHEN OUTPUT IS DONE ON SINK I. +CHSODN: CLR CHOSTS(I) ;IDLE THE SINK + PUSH I + MOV CHOINX(I),I ;GET CORRESPONDING SOURCE + CLR CHISTS(I) ;IDLE IT + CALL @CHIRFL(I) ;TELL SOURCE IT'S DONE, TRY TO GET MORE INPUT + POP I +CHSOUX: RET + +;CALL HERE AFTER EACH PACKET TRANSFER TO INITIATE AS MANY ADDITIONAL TRANSFERS +;AS POSSIBLE. BASHES ALL REGISTERS. ON DL10 AND TEN11, WE COULD ACTUALLY DO SEVERAL +;TRANSFERS BEFORE RETURNING. +CHSRUN: +.IF DF NDVRBF + CALL DVRRFL ;WAKE UP DOVER, MIGHT BE TIME TO RETRANSMIT +.ENDC ;NDVRBF + MOV #*2,I ;SCAN ALL INPUT SOURCES +CHSRN1: TST WAKE ;GIVE UP IF CLOCK HAS TICKED, LET TTYS RUN + BNE CHSOUX + TST CHISTS(I) ;IS THIS SOURCE LOOKING FOR A SINK? + BLE CHSRN3 +CHSRN2: MOV CHIOUX(I),B ;GET SINK IT WANTS TO SEND TO + BMI FOR11 ;BRANCH IF FOR PDP11 + TST CHOSTS(B) ;SINK AVAILABLE? + BNE CHSRN3 ;NO, LET INPUT SIT + CALL CHSOUT ;YES, ATTEMPT TO TRANSMIT + BR CHSRUN ;LOOK FOR MORE WORK + +CHSRN3: SUB #2,I ;NEXT INPUT SOURCE + BGE CHSRN1 + RET ;NOTHING LEFT TO DO + +FOR11: MOV CHIBFP(I),A ;PACKET FOR PDP11, CHECK IT OUT + MOVB PKOP(A),B ;GET OPCODE + CMP B,#%CORUT ;IF ROUTING INFO, GOBBLE IT + BEQ CHARUT + CMP B,#%CORFC ;ALL WE KNOW IS RFC TO CERTAIN CONTACT NAMES + BNE FOR11J ;BARF AT JUNK PACKETS + CALL SERVE ;RUN THE SERVER + BEQ FOR11X ;IT DIDN'T LIKE IT +FOR11R: PUSH ;INTERCHANGE SOURCE AND DESTINATION + MOV PKSHST(A),PKDHST(A) + MOV PKSIND(A),PKDIND(A) + POP + CALL CHSIHD ;ROUTE + BVS FOR11X ;NO GOOD, FLUSH (SOURCE IN PACKET WAS WRONG) + CALL SWAB11 ;SWAB IF GOING TO 11-INCOMPATIBLE DEST + BR CHSRN2 ;FIRE IT OFF (CHISTS IS ALREADY 1) + +FOR11X: CLR CHISTS(I) ;DISCARD THIS PACKET + CALL @CHIRFL(I) + BR CHSRUN ;LOOK FOR MORE WORK + +;PACKET FROM RANDOM PLACE DIRECTED TO 11, TELL HIM TO GO AWAY +FOR11J: CMP B,#%COLOS ;DON'T BARF AT LOS PACKETS + BEQ FOR11X + MOV #<%COLOS*400>,(A) + MOV #6$-5$-1,PKNBYT(A) + MOV #5$,B + MOV A,C + ADD #PKDAT,C +1$: MOVB (B)+,(C)+ + BNE 1$ + BR FOR11R ;SEND OFF THE LOS +5$: .ASCIZ /Packet unrecognized by gateway-11/ +6$: .EVEN + +;ROUTING PACKET +CHARUT: MOV CHILNG(I),C ;GET NUMBER OF DATA WORDS + SUB #PKHDW,C + ASR C ;MAKE NUMBER OF 2 WORD PAIRS + BEQ FOR11X ;MIGHT BE ZERO-LENGTH + MOV A,D + ADD #PKDAT,D ;POINT TO START OF PACKET'S DATA +61$: MOV (D)+,B ;GET SUBNET BEING TALKED ABOUT + CMP B,#NSUBNT ;ONE WE KNOW ABOUT? + BHIS 62$ ;NO, FORGET IT + ASL B ;MAKE WORD INDEX + TST SBNTYP(B) ;IS THIS AN AUTO ROUTING TYPE SUBNET? + BNE 62$ ;NO, DON'T MUNG OUR FIXED ROUTING INFO + CMP (D),SBNCST(B) ;COMPARE COSTS + BHI 62$ ;NEW ONE WORSE (IF EQUAL, SWITCH TO EQUALIZE LOAD) + MOV (D),SBNCST(B) ;SAVE BEST COST + MOV PKSHST(A),SBNADR(B) ;AND HOST ADDRESS THIS CAME FROM AS BEST BET +62$: TST (D)+ ;SKIP COST + SOB C,61$ + BR FOR11X ;DONE WITH PACKET + + .SBTTL CHAOS NET SERVERS + +;CALLED WITH PACKET IN A. +;MUST PRESERVE A,I. +;RETURN 'EQ' IF NO GOOD, 'NE' IF MODIFIED PACKET TO BE RETURNED TO SOURCE + +;CURRENTLY WE SERVE THE FOLLOWING CONTACT NAMES: +; STATUS - RETURNS ANS WITH THE NAME OF THE MACHINE, LATER WILL HAVE OTHER DATA +; PULSAR - RETURNS ANS WITH DATA OF 1 BYTE, VALUE OF PULSON AS AN ASCII DIGIT, +; I.E. "0" MEANS OFF, "1" MEANS 60 PER SECOND, ETC. +; IF CONTACT NAME IN RFC IS FOLLOWED BY A SPACE AND AN ASCII DIGIT, +; SETS PULSON TO THAT STATUS. +; DOVER - DOVER PROTOCOL TRANSLATOR + +;NOTE THAT WE DON'T USE THE MOST WINNING STRING COMPARE IN THE WORLD, +;THIS CODE ASSUMES IT DOESN'T MATTER WHAT HAPPENS IF AN RFC TO +;AN UNKNOWN CONTACT NAME IS DONE, AS LONG AS THE 11 DOESN'T CRASH. + +SERVE: MOV #SRVTBL,B ;ADDRESS OF SERVER TABLE +10$: MOV (B)+,D ;ADDRESS OF CONTACT NAME FOR THAT SERVER + BEQ 99$ ;EXIT IF TABLE EXHAUSTED, 'EQ' IN COND CODE + MOV A,C + ADD #PKDAT,C ;ADDRESS OF CONTACT NAME IN THIS RFC +11$: TSTB (D) ;END OF STRING? + BEQ 20$ ;YUP, RUN THIS SERVER + CMPB (C)+,(D)+ ;DO STRING COMPARE + BEQ 11$ ;MATCHES + TST (B)+ ;DOESN'T MATCH, TRY NEXT + BR 10$ + +99$: RET + +20$: JMP @(B)+ ;CALL SERVER, IT CAN RETURN EQ OR NE + +SRVTBL: .WORD 1$,STSSRV ;STATUS - RETURN HOST NAME AND METERS + .WORD 2$,PLSSRV ;PULSAR - SET AND GET PULSAR RATE +.IIF DF NDVRBF, .WORD 3$,DVROPN ;DOVER - DOVER PROTOCOL TRANSLATOR + .WORD 0 ;END OF TABLE +1$: .ASCIZ /STATUS/ +2$: .ASCIZ /PULSAR/ +3$: .IIF DF NDVRBF, .ASCIZ /DOVER/ + .EVEN + +;SERVERS MUST PRESERVE A (PACKET), AND I, AND RETURN 'NE' IF TO BE SENT BACK TO SOURCE. +;NOTE THAT C POINTS AT THE NEXT BYTE AFTER THE CONTACT NAME + +STSSRV: MOV A,B ;RFC TO "STATUS", CHANGE INTO ANS CARRYING APPROPRIATE DATA. + MOV #32.+<12.*NCHX>+<24.*CHAOSP>+<12.*ETHERP>,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + ADD #PKDAT,B + MOV #HSTNAM,D ;SEND NAME OF HOST + MOV #32.,C +45$: MOVB (D)+,(B)+ + SOB C,45$ + CLR D ;NOW STORE METERING INFO FOR EACH SUBNET +50$: MOV CHXSBN(D),(B)+ ;STORE SUBNET NUMBER+400 + MOV #4,(B)+ ;ASSUME NOT A CABLE + MOV NPKSI(D),(B)+ + MOV HPKSI(D),(B)+ + MOV NPKSO(D),(B)+ + MOV HPKSO(D),(B)+ +.IFNZ ETHERP + CMP D,#CHXETH ;ETHERNET HAS SOME OF THESE COUNTERS + BNE 55$ + MOV #12.,-10.(B) ;THERE ARE 4 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + CLR (B)+ + CLR (B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + BR 59$ +.ENDC ;ETHERP +55$: CMP CHIRFL(D),#CHSRFL ;CHAOSNET CABLE? + BNE 59$ ;NO, THAT'S ALL + MOV #16.,-10.(B) ;YES, THERE ARE 6 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + MOV NPKSLS-CHXCHS(D),(B)+ + MOV HPKSLS-CHXCHS(D),(B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + CLR (B)+ ;I DON'T KEEP TRACK OF BIT COUNT ERRS SEPARATELY + CLR (B)+ + MOV NPKSBD(D),(B)+ + MOV HPKSBD(D),(B)+ +59$: TST (D)+ + CMP D,#2*NCHX + BLO 50$ +RETANS: MOVB #%COANS,PKOP(A) ;RETURN THIS PACKET TO SOURCE AS AN 'ANS' + RET ;NOTE CONDITION CODES HAVE 'NE' + +PLSSRV: MOVB PKNBYT(A),C ;GET BYTE COUNT, SHOULD BE SMALL + CMP C,#8 ;6 FOR PULSAR, 1 FOR SPACE, 1 FOR CHARACTER + BLO 20$ ;NOT GIVEN AN ARGUMENT, JUST READ STATUS + MOVB PKDAT+7(A),C ;YES, GET THE ARGUMENT + SUB #'0,C ;CONVERT TO BINARY (CHEAPO!) + MOV C,PULSON ;CHANGE PULSON STATUS +20$: MOV #1,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + MOV PULSON,C ;RETURN PULSAR STATUS + ADD #'0,C ;IN ASCII + MOVB C,PKDAT(A) + BR RETANS + + .SBTTL CHAOSNET INTERRUPT HANDLER + +;INTERRUPT HANDLER ENTRIES +.REPT CHAOSP +CONC CHS,\.RPCNT,BK: + JSR I,CHSBRK + CHXCHS+<.RPCNT*2> +.ENDR + +;SUBROUTINE TO ENABLE CHAOSNET INTERFACE IN H,I TO RECEIVE NEXT PACKET +CHINXT: MOVB 1(H),A ;GET CSR BITS 9-12 (LOST COUNT) + ASR A + BIC #-20,A + ADD A,NPKSLS-CHXCHS(I) + ADC HPKSLS-CHXCHS(I) + BIS #%CARCL+%CAREN,(H) ;MAKE READY TO RECEIVE ANOTHER MESSAGE + RET + +;COMMON CHAOS INTERRUPT ROUTINE +CHSBRK: MOV (I),I ;GET SOURCE/SINK INDEX + PUSH ;SAVE ALL REGISTERS + MOV CHIHWR(I),H ;GET HARDWARE ADDRESS + MOV (H),A .SEE CH%CSR ;GET CSR + BPL CHSBK1 ;TEST RECEIVE DONE, BRANCH IF NOT + .SEE %CARDN ;PALX SCREWS UP IF THIS IS ON PREVIOUS LINE! + TST CHISTS(I) ;MAKE SURE INPUT BUFFER IS IDLE + BNE CHSBK1 ;BUSY, DON'T LOOK AT RECEIVE DONE NOW + BIT #%CAERR,A ;CRC ERROR? + BNE CHICRC ;JUMP IF YES + MOV CH%RBC(H),C ;BIT COUNT -1 + SUB #47.,C ;ADD 1, THEN SUBTRACT 3*16. FOR HARDWARE WORDS + .IREPT 4, ASR C ;CONVERT TO NUMBER OF WORDS + CMP C,#256. + BHI CHIFLS ;THIS CAN ONLY HAPPEN IF HARDWARE BROKEN + ADD #CH%RBF,H ;POINT H TO RECEIVE DATA REG + MOV CHIBFP(I),D ;COPY PACKET INTO BUFFER + CALL MOVHD + TST (H) ;READ OUT THE 3 HARDWARE LEADER WORDS + CMP (H),(H) + SUB #CH%RBF,H ;RESTORE H + BIT #%CAERR,(H) ;WAS IT READ CORRECTLY OUT OF RAM? + BNE CHIGBG ;NO, GARBAGE + CMP CH%RBC(H),#7777 ;WAS PACKET CORRECT LENGTH? + BNE CHIGBG ;NO, GARBAGE + CALL CHINXT ;DONE WITH HARDWARE, ENABLE FOR NEXT + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS CHIFL0 ;BRANCH IF NO GOOD + CALL SWAB11 ;SWAB IF NOT GOING TO 11-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + PUSH I + CALL CHSOUT ;SEND IT OUT + POP I + MOV CHIHWR(I),H ;RESTORE H + TST CHISTS(I) ;INPUT BUFFER STILL BUSY? + BEQ CHSBK1 + BIC #%CAREN,(H) ;YES, CLEAR RECEIVE INTERRUPT ENABLE + BR CHSBK1 ;GO CHECK ON OUTPUT SIDE + +;HERE WHEN A PACKET WAS RECEIVED WITHOUT ERROR, BUT AFTER +;READING OUT OF THE RAM, CRC ERROR WAS SET. EITHER THE +;PACKET WAS THE WRONG LENGTH, OR THE RAM FAILED, OR THE +;HARDWARE RANDOMLY CLOBBERED IT. +;WE ALSO GET HERE IF THE BIT COUNT WAS NOT -1 AFTER ALL WORDS WERE READ. +CHIGBG: ADD #1,NPKSRL-CHXCHS(I) ;LOG THE ERROR + ADC HPKSRL-CHXCHS(I) + MOV H,CHSRLH + MOV CH%RBC(H),CHSRLC + BR CHIFLS ;GO RESET RECEIVER AND CHECK OUTPUT STATUS + +;HERE WHEN A PACKET IS RECEIVED WITH A CRC ERROR. DISCARD IT, +;BUT ALSO SAVE IT IN CHSGBF, CHSGBH, CHSGBS, CHSGBC FOR DEBUGGING (IF FTGARB). +CHICRC: ADD #1,NPKSGB-CHXCHS(I) + ADC HPKSGB-CHXCHS(I) +.IFNZ FTGARB + MOV H,CHSGBH + MOV (H),CHSGBS + MOV CH%RBC(H),CHSGBC + ADD #CH%RBF,H + MOV #CHSGBF,D + MOV #PKMAX,C + CALL MOVHD + SUB #CH%RBF,H ;DROP INTO CHIFLS +.ENDC ;FTGARB +;HERE TO IGNORE AN INPUT PACKET AND ENABLE HARDWARE FOR NEXT +CHIFLS: CALL CHINXT +CHIFL0: INC NPKSIG +;HERE TO CHECK ON TRANSMIT SIDE +CHSBK1: TSTB (H) .SEE %CATDN ;TRANSMIT DONE? + BPL CHSBKX ;NO, EXIT +.IFNZ CHSBTB + CLR CHSIDL(I) ;CLEAR TRANSMIT-DONE TIME-OUT +.ENDC ;CHSBTB + MOV CHOSTS(I),A ;WAS OUTPUT IN PROGRESS? + BEQ CHSBK6 ;NO, LOOK FOR OUTPUT + CMP A,#2 ;TRANSMIT ABORT DELAY COMPLETED? + BEQ 10$ + BIT #%CATAB,(H) ;NO, TRANSMIT ABORTED? + BEQ CHSBK4 ;NO + ADD #1,NPKSAB-CHXCHS(I) ;YES, METER IT, AND SET CHOSTS TO + ADC HPKSAB-CHXCHS(I) + INC CHOSTS(I) ;2 IF THIS IS FIRST TIME, OR 0 IF SECOND TIME + BEQ CHSBK4 ;LOST TWICE IN A ROW, GIVE UP + BR CHSBK5 ;TURN OFF INTERRUPT, DELAY FOR A WHILE + +10$: MOV #-1,CHOSTS(I) ;TRANSMIT ABORT DELAY COMPLETED, SET CHOSTS TO -1 + CALL CHSXM0 ;INITIATE RE-TRANSMISSION (CHOSTS ALREADY SET) + BR CHSBKX ;DISMISS + +CHSBK4: CALL CHSODN ;OUTPUT DONE +CHSBK6: PUSH I + CALL CHSRUN ;INITIATE MORE TRANSFERS + POP I + TST CHOSTS(I) ;DID IT INITIATE TRANSMISSION? + BNE CHSBKX ;YES, LEAVE INTERRUPT ENABLED. + MOV CHOHWR(I),H ;RESTORE H + TST CHXRTF(I) ;TIME TO BROADCAST ROUTING INFO? + BNE CHORUT ;YES + TST PULSON ;IS THIS FEATURE TURNED ON? + BEQ CHSBK5 ;NO, FLUSH + CMP PULSAR,PULSON ;NOTHING TO DO. TIME FOR A TEST MESSAGE? + BNE CHSBK5 ;NOPE, GO IDLE + MOV #52525,CH%WBF(H) ;WRITE A PACKET OF 3 HEADER WORDS, 0, 52525 + CLR CH%WBF(H) + MOV #-1,CH%WBF(H) ;TO HOST -1, WHICH IS NON-EXISTENT +CHSBK7: TST CH%XMT(H) ;INITIATE TRANSMISSION, DON'T ENABLE INTERRUPT +CHSBK5: BIC #%CATEN,(H) ;GO IDLE, CLEAR TRANSMIT INTERRUPT ENABLE +;HERE TO EXIT FROM CHAOS INTERRUPT. RESTORE REGS AND RETURN FROM INT +CHSBKX: POP + RTI + +.IIF NZ CH%WBF-CH%MYN, .ERR FOO CODE ASSUMES CH%WBF = CH%MYN + +;BROADCAST A PACKET FULL OF ROUTING INFO, SINCE WE ARE MORE OR LESS A GATEWAY +CHORUT: MASK 6 ;INHIBIT CLOCK INTERRUPTS SO COSTS DON'T CHANGE + ADD #CH%WBF,H ;ADDRESS WRITE BUFFER + MOV #%CORUT*400,(H) ;OPCODE + MOV #2*,A ;COUNT SUBNETS WHICH WE KNOW ANYTHING ABOUT (REASONABLE COST) + CLR B +5$: CMP SBNCST(A),#1000 + BHIS 6$ + ADD #4,B ;THIS ONE WILL GENERATE 2 WORDS +6$: SUB #2,A + BPL 5$ + MOV B,(H) ;BYTE COUNT + CLR (H) ;DESTINATION + CLR (H) ;.. + MOV (H),(H) ;SOURCE = CH%MYN + CLR (H) ;SOURCE INDEX + CLR (H) ;PACKET NUMBER + CLR (H) ;ACK NUMBER + MOV #2*,A ;GO THROUGH SUBNET TABLES + MOVB 1(H),C ;GET SUBNET THIS IS GOING OUT ON + ASL C + MOV SBNCST(C),C ;GET COST OF GETTING TO US FROM GUY WHO RECEIVES THIS +10$: CMP SBNCST(A),#1000 ;WAS THIS ONE INCLUDED IN BYTE COUNT? + BHIS 11$ ;NO, DON'T PUT IT IN PACKET + MOV A,B ;FIRST WORD IS SUBNET NUMBER + ASR B + MOV B,(H) + MOV SBNCST(A),B ;SECOND WORD IS COST + ADD C,B ;WHICH MUST INCLUDE COST OF GETTING TO US + MOV B,(H) +11$: SUB #2,A ;NEXT SUBNET + BPL 10$ + CLR (H) ;BROADCAST THIS PACKET + SUB #CH%WBF,H ;RESTORE H + CLR CHXRTF(I) ;CLEAR REQUEST FOR ROUTING PACKET + UNMASK + BR CHSBK7 ;FIRE IT OFF, DON'T ENABLE TRANSMIT-DONE INTERRUPT + +;INITIATE TRANSMISSION ON CHAOS INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +CHSXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING +CHSXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #CH%WBF,H ;ADDRESS THE WRITE BUFFER + MOV CHILNG(B),C ;GET WORD COUNT + CALL MOVDH ;COPY INTO HARDWARE + MOV CHICBA(B),(H) ;STORE CABLE DESTINATION + SUB #CH%WBF,H ;RESTORE H + TST CH%XMT(H) ;TRIGGER TRANSMISSION + BIS #%CATEN,(H) ;ENABLE DONE INTERRUPT + RET ;PI LEVEL WILL PICK UP OUTPUT + +.ENDC ;CHAOSP + +.IFNZ ETHERP + .SBTTL ETHERNET SUPPORT + +;ENABLE NEXT ETHERNET PACKET TO COME IN. +;SINCE WE ONLY HAVE ONE BUFFER, THIS SETS UP THE TRANSFER RATHER +;THAN JUST ENABLING THE INTERRUPT AS THE CHAOSNET DOES. +;THAT WOULDN'T WORK ANYWAY, BECAUSE THE HARDWARE IS SO TOTALLY BRAIN-DAMAGED. +ETHRFL: MOV CHIHWR(I),H + ADD #10,H + MOV #-,(H)+ ;- WORD COUNT, +1 FOR HARDWARE BUG + MOV #ETHIBF+,(H)+ ;BUFFER ADDRESS + MOV #101,(H) ;START, INTERRUPT-ENABLE + RET + +;INCOMING PUP TOO BIG. WE DON'T HAVE FRAGMENTATION, SO SEND A PUP ERROR REPORT +ETHBIG: MOV #ETHIBF+PKDAT,A ;COPY PUP HEADER INTO DATA FIELD + MOV A,C + MOV #ETHIBF+PKDAT+20.,B + .IREPT 10.,< MOV (A)+,(B)+ > + MOV #517.,(B)+ ;PACKET TOO LARGE ERROR + MOV #DATMAX,(B)+ ;MAX NUMBER OF BYTES ALLOWED + MOV #50$,A +5$: MOVB (A)+,(B)+ ;ASCII MESSAGE + BNE 5$ + INC B ;MESSAGE LENGTH IS EVEN. INCLUDE CHECKSUM IN COUNT. + SUB #ETHIBF+PKDAT,B ;GET PUP LENGTH + MOV B,(C)+ ;BUILD PUP HEADER NOW + MOV #4,(C)+ ;PUP TYPE = ERROR + CMP (C)+,(C)+ ;PUP ID SAME + .IREPT 3,< MOV 6(C),(C)+ > ;DESTINATION = ORIGINAL SOURCE + MOV #,(C)+ ;SOURCE = ME + .IREPT 2,< CLR (C)+ > ;SOURCE PORT ZERO + CALL ETHOUT ;TRANSMIT + JMP ETHINX ;DISMISS + +;The ascii message. This isn't as destroyed as it looks. +50$: .ASCIZ/UP Pot oalgr eotf tii n ahCoanstep caek.t/ + .EVEN + +;INPUT INTERRUPT +ETHIBK: PUSH + MOV #CHXETH,I + MOV CHIHWR(I),H + MOV 14(H),A ;PICK UP STATUS + CLR 14(H) ;CLEAR RECEIVE INTERRUPT ENABLE + CMP ETHIBF+PKDAT-2,#1000 ;TYPE = PUP? + BNE ETHIIX ;NO, IGNORE PACKET + TST 10(H) ;CHECK RESIDUAL WORD COUNT + BEQ ETHBIG ;PACKET TOO BIG, RESPOND WITH PUP ERROR + TST A ;CHECK COMBINED INPUT ERRORS BIT + BMI 70$ ;ERROR, IGNORE PACKET + MOV ETHIBF+PKDAT+10,A ;GET DESTINATION HOST + BEQ 5$ ;AND SEE IF BROADCAST OR SELF + CMP A,# + BNE 11$ ;NO, ROUTE AS REGULAR MESSAGE +5$: CMPB ETHIBF+PKDAT+2,#1 ;PUP TYPE = ECHO-ME? + BEQ ETHECO ;YES, ECHO IT (MAYBE TAKE THIS OUT AFTER 11 DEBUGGED) + CMPB ETHIBF+PKDAT+2,#200 ;GATEWAY INFORMATION REQUEST? + BNE 10$ + TST ETHIBF+PKDAT+12 ;NOT REALLY UNLESS DESTINATION SOCKET IS 2 + BNE 10$ + CMP ETHIBF+PKDAT+14,#2 + BNE 10$ + TST CHISTS+CHXEGT ;PSEUDO DEVICE AVAILABLE? + BNE ETHIIX + MOV #ETHIBF+PKDAT+4,A ;YES, SEND HIM SOME INFO + MOV #EGTPID,B + .IREPT 2,< MOV (A)+,(B)+ > ;COPY PUP ID + ADD #6,A ;COPY SOURCE HOST AND SOCKET INTO DESTINATION + .IREPT 3,< MOV (A)+,(B)+ > + CALL ETHRT1 + MOV #CHXETH,I ;I CLOBBERED BY ETHRT1 + BR ETHIIX + +10$: TST A ;DON'T HARASS REST OF NET WITH BROADCASTS + BEQ ETHIIX +11$: MOV #ETHIBF+PKDAT,A ;CHECK THE CHECKSUM + CALL PUPCKT + BNE 60$ ;BAD, COUNT AS RAM ERROR +.IF DF NDVRBF + CMP ETHIBF+PKDAT+10,DVRHST ;SEE IF ADDRESSED TO DOVER USER + BNE 12$ + CMP ETHIBF+PKDAT+14,DVRIDX + BNE 12$ + CALL DVRPUP ;YES, PROCESS + MOV #CHXETH,I + BR ETHIIX + +.ENDC ;NDVRBF +;TRANSLATE PUP AND SEND TO CHAOSNET +12$: MOV #ETHIBF,A ;FILL IN CHAOSNET HEADER + MOV #<%COUNC*400>,(A)+ ;PKOP + MOV ETHIBF+PKDAT+0,B ;PKNBYT (TOTAL PUP LENGTH = CHAOS DATA LENGTH) + INC B ;ROUND UP TO AN EVEN NUMBER + ASR B + ASL B + MOV B,(A)+ + MOV ETHIBF+PKDAT+10,(A)+ ;PKDHST + MOV ETHIBF+PKDAT+14,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+16,(A)+ ;PKSHST + MOV ETHIBF+PKDAT+22,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+6,(A)+ ;PKPKN (LOW HALF OF PUP ID) + MOV #100001,(A)+ ;PKACN = PROTOCOL NUMBER + CALL CHSIHD ;PROCESS THIS HEADER, GET LENGTH, DEST + BVS ETHIIX ;IGNORE IF NO GOOD + CALL SWAB10 ;SWAB IF NOT GOING TO 10-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + CALL CHSOUT ;SEND IT OUT + BR ETHINX ;ETHRFL WILL BE CALLED WHEN NECESSARY + +60$: ADD #1,NPKSRL-CHXCHS(I) ;COUNT ERRORS (SOFTWARE CHECKSUM) + ADC HPKSRL-CHXCHS(I) + BR ETHIIX + +70$: ADD #1,NPKSGB-CHXCHS(I) ;COUNT ERRORS (HARDWARE CHECKSUM) + ADC HPKSGB-CHXCHS(I) +ETHIIX: CALL ETHRFL ;AND READ ANOTHER PACKET +ETHINX: POP + RTI + +;ETHERNET PUP ECHO PROTOCOL +ETHECO: MOV #ETHIBF+PKDAT+10,A ;INTERCHANGE SOURCE AND DESTINATION + MOV A,B ;I DON'T BOTHER CHECKING CHECKSUM, BUT I DO GENERATE IT + .IREPT 3, PUSH (A)+ + .IREPT 3,< MOV (A)+,(B)+ > + .IREPT 3, POP -(A) + MOV #,(A) ;FIX SOURCE TO BE ME + INCB ETHIBF+PKDAT+2 ;SET PUP TYPE = 2 (I AM AN ECHO) + CALL ETHOUT ;SEND BACK OUT ON THE ETHERNET + BR ETHINX + +;GENERAL PURPOSE ROUTINE FOR TRANSMITTING INTERNALLY-GENERATED PUPS TO +;THE ETHERNET. FIXES THE DESTINATION ADDRESS (THIS IS HOW OTHER +;HOSTS FIGURE OUT WHAT SUBNET THEY ARE ON!), COMPUTES THE PUP CHECKSUM, +;AND INTERFACES TO THE PACKET SWITCH. CALLED WITH SOURCE INDEX IN I. +;CALL THIS WITH A PACKET THAT ALREADY HAS ITS BYTES IN ETHERNET ORDER. +;BASHES ALL REGISTERS. +ETHOUT: MOV CHIBFP(I),A + ADD #PKDAT,A ;ADDRESS OF PUP + TST 10(A) ;ONLY IF NOT BROADCASTING, + BEQ 10$ + TSTB 11(A) ;DESTINATION ADDRESS HAVE NETWORK NUMBER? + BNE 10$ + MOVB #ETHSBN,11(A) ;NO, PUT IT IN +10$: CALL PUPCKS ;INSERT CHECKSUM + MOV #CHXETH,B + MOV B,CHIOUX(I) + INC CHISTS(I) + JMP CHSOUT + +;INITIATE TRANSMISSION ON ETHER INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +;PACKET IS ALREADY SWABBED INTO ETHERNET BYTE ORDER (REVERSE OF CHAOSNET). +ETHXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING + CLR A ;NO OUTPUT START DELAY +ETHXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #PKDAT,D ;GET PUP ADDRESS + MOV #1000,-(D) ;SMASH LAST 2 WORDS OF CHAOS HEADER. TYPE=PUP + MOV #ETHHSN,-(D) ;STORE SOURCE ADDRESS + MOVB 14(D),1(D) ;STORE DESTINATION ADDRESS + MOV 4(D),B ;GET PUP SIZE IN BYTES + ADD #5,B ;CONVERT TO WORDS, ALLOW FOR ETHERNET HEADER + ASR B + NEG B ;HARDWARE WANTS IT NEGATIVE + MOV B,(H)+ ;OUTPUT WORD COUNT + MOV D,(H)+ ;OUTPUT BUFFER ADDRESS + MOV A,2(H) ;OUTPUT START DELAY + MOV #101,(H) ;START OUTPUT, ENABLE INTERRUPT + RET ;PI LEVEL WILL FINISH + +;OUTPUT DONE/ABORTED INTERRUPT +ETHOBK: PUSH + MOV #CHXETH,I + MOV CHOHWR(I),H + MOV 4(H),A ;PICK UP STATUS BEFORE WRITING IT + CLR 4(H) ;CLEAR INTERRUPT ENABLE + TST A ;CHECK FOR ERROR + BPL 10$ + ADD #1,NPKSAB-CHXCHS(I) + ADC HPKSAB-CHXCHS(I) + NEG CHOSTS(I) ;ERROR, ENTER RETRANSMIT MODE + BPL 10$ ;ALREADY RETRANSMITTED ONCE, PUNT + MOV #25.,A ;WAIT 1 MS (DON'T BOTHER BEING RANDOM) + CALL ETHXM0 ;START TRANSMISSION AGAIN + BR ETHINX ;AND EXIT + +10$: CALL CHSODN ;TRANSMISSION FINISHED + CALL CHSRUN ;FIND MORE WORK TO DO + BR ETHINX ;DISMISS + +;CHECKSUM PUP ADDRESSED BY A. BASHES A,B,C. +PUPCKS: CALL PUPCK1 ;COMPUTE CHECKSUM + MOV B,(A) ;STORE CHECKSUM + RET + +;RETURN 'EQ' IF CHECKSUM MATCHES +PUPCKT: CALL PUPCK1 ;COMPUTE CHECKSUM + CMP (A),#-1 ;PACKET CHECKSUMMED? + BEQ 5$ ;NO, ALWAYS MATCH + CMP B,(A) ;RETURN WITH CC SET FROM NEW AND OLD CKSMS +5$: RET + +;A POINTS AT PACKET, RETURN WITH A -> CHECKSUM AND CHECKSUM IN B. BASH C. +PUPCK1: MOV (A),C ;GET LENGTH + DEC C ;IN WORDS NOT COUNTING CHECKSUM + ASR C + CLR B ;BUILD CHECKSUM IN B +10$: ADD (A)+,B ;ONE'S COMPLEMENT ADD + ADC B + BPL 11$ ;TRANSFER SIGN BIT INTO CARRY + SEC +11$: ROL B ;AND LEFT CYCLE + SOB C,10$ + INC B ;GRONK MINUS ZERO + BEQ 15$ + DEC B +15$: RET + +;BROADCAST ETHERNET GATEWAY INFO +ETHRUT: MASK 5 ;ENTER SUITABLE LEVEL FOR HACKING NET + TST CHISTS+CHXEGT ;IS THE PSEUDO SOURCE THAT EMITS THE + BNE 99$ ; PACKET AVAILABLE? IF NOT, PUNT. + CLR CHXRTF+CHXETH ;CLEAR REQUEST FLAG + MOV #EGTPID,A + CLR (A)+ ;PUP ID ZERO + CLR (A)+ + CLR (A)+ ;BROADCAST DESTINATION + CLR (A)+ ;TO SOCKET 2 + MOV #2,(A)+ + CALL ETHRT1 ;BUILD AND SEND GATEWAY INFO +99$: UNMASK + RET + +BADSBP: .WORD BADSUB ;POINTER INTO BAD SUBNETS +BADSUB: ;SUBNETS THAT SHOULD NOT HAVE INFORMATION SENT + ;ABOUT. THIS LIST MUST BE IN INCREASING ORDER + ;AND MUST END IN 377. + .BYTE 004 ;AI CHAOS 11 pseudo subnet (only AI PDP-10 (RIP) is on this) + .BYTE 010 ;Tech Square LCSnet (unused) + .BYTE 011 ;Tech Square LCS asynchronous line net (IP) + .BYTE 012 ;Tech Square VII LCSnet (IP) + .BYTE 014 ;Symbolics: Los Angeles-Chatsworth land line + .BYTE 020 ;CHAOS MIT IN subnet (ask JNC) + .BYTE 027 ;Experimental asynchronous line net + .BYTE 030 ;Experimental radio broadcast net + .BYTE 040 ;Symbolics: Tech Square-Vassar St. microwave link + .BYTE 041 ;Symbolics: Cambridge-Palo Alto land line + .BYTE 042 ;Symbolics: Palo Alto-Chatsworth land line + .BYTE 047 ;Symbolics: Cambridge-Chatsworth land line + .BYTE 054 ;S-1: 10Mb Ethernet + .BYTE 055 ;S-1: Pronet ring + .BYTE 056 ;S-1: serial line subnet + .BYTE 057 ;S-1: serial line subnet + .BYTE 061 ;Symbolics: Cambridge-Cambridge land line + .BYTE 062 ;Symbolics: Cambridge-Washington land line + .BYTE 064 ;Symbolics: Cambridge-Houston land line + .BYTE 070 ;Symbolics: Chatsworth-Westwood land line + .BYTE 072 ;Atari: Cambridge-MIT land line + .BYTE 073 ;Atari: Cambridge-Sunnyvale land line + .REPT 8 + .BYTE 377 ;SPARES + .ENDR + .BYTE 377 +.EVEN + +ETHRT1: MOV #BADSUB,BADSBP ;INITIAL BAD SUBNET POINTER + MOV #EGTSBN,A ;FILL IN GATEWAY INFORMATION IN THE PUP + CLR I ;I SUBNET*2, A EGTSBN POINTER +10$: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + CLR B ;FOR NON-GATEWAY, USE 0 AS GATEWAY ADDRESS + TST SBNTYP(I) ;HARDWARE CONNECTION? + BGT 11$ + MOV SBNADR(I),B ;NO, GET GATEWAY ADDRESS +11$: cmpb i,#60 + bhi 20$ ;dover, as of 1-Dec-83 can't handle more than 60 + ;; FILTER OUT KNOWN BAD SUBNETS + CMPB I,@BADSBP ;MAYBE UPDATE POINTER + BHI 115$ ; NO UPDATE NEEDED + INC BADSBP +115$: CMPB I,@BADSBP ;THIS TIME, CHECK FOR EQUALITY + BEQ 20$ ;PUNT + ;; END FILTER + MOV SBNCST(I),C ;GET COST + CMP C,#1000 ;IF NOT REACHABLE, DON'T PUT IN PACKET + BHIS 20$ + .IREPT 3, ASR C ;DIVIDE BY 8 TO GET APPROXIMATE HOP COUNT + CMP C,#ETHMXH ;DON'T PUT MORE THAN MAXHOPS + BLOS 12$ + MOV #ETHMXH,C +12$: MOV I,D ;GET TARGET-NET + ASR D + SWAB B + MOVB B,(A)+ ;STORE IN WIERD XEROX BYTE ORDER + MOVB D,(A)+ + MOV B,(A)+ + MOVB C,-2(A) +20$: TST (I)+ ;NEXT SUBNET + CMP I,#NSUBNT*2 + BLO 10$ + SUB #EGTSBN,A ;NUMBER OF DATA BYTES IN PUP + ADD #22.,A ;FOR HEADER AND CHECKSUM + MOV A,EGTPLN ;SET PUP LENGTH + MOV #CHXEGT,I ;SET UP TO TRANSMIT TO ETHERNET + JMP ETHOUT +.ENDC ;ETHERP + +.IF DF NDVRBF + .SBTTL DOVER PROTOCOL TRANSLATOR + +;RFC PACKET IN A. MUST PRESERVE I, AND RETURN 'EQ'. +DVROPN: MOV PKPKN(A),C + MOV PKSIND(A),B + MOV PKSHST(A),A + PUSH I + CALL 5$ + POP I + SEZ + RET + +;SET UP DOVER TO TALK TO HOST IN A, INDEX IN B, PKT# IN C, SENDING BACK AN OPN +;OR SENDING A LOS IF BUSY. MUST WATCH FOR DUPLICATE RFC'S +;MUST BE CALLED WITH CHAOS AND ETHER INTERRUPTS MASKED +5$: TST DVRHST ;BUSY? + BEQ 10$ ;NO + CMP A,DVRHST + BNE DVRBSY ;YES, TALKING TO ANOTHER HOST + CMP B,DVRIDX + BNE DVRBSY ;YES, TALKING TO ANOTHER GUY SAME HOST + BR 11$ ;DUPLICATE RFC + +10$: CLR DVRTIM ;FLUSH TIMEOUT + MOV A,DVRHST + MOV B,DVRIDX + INC DVRLIX ;ESTABLISH UNIQUE LOCAL INDEX + BNE 11$ + INC DVRLIX ;DON'T USE 0 +11$: CLR DVRMSK ;CLEAR THE BUFFER RING + CLR DVRID ;FIRST PACKET TO SEND TO DOVER IS PACKET 0 + INC C ;C := FIRST PACKET ID THAT WILL COME IN FROM CHAOS + MOV C,DVROFS + MOV #%COOPN*400,B ;SEND AN OPN + BR DVRST1 ;REST IS LIKE STS + +DVRBSY: TST DVRPKP ;SPECIAL BUFFER BUSY? + BNE CPOPJ0 ;YES, PUNT + MOV #DVRBF2,C ;SEND A CLS + MOV #%COCLS*400,(C)+ + MOV #4,(C)+ + MOV A,(C)+ + MOV B,(C)+ + MOV #CHAD0,(C)+ + CLR (C)+ + CLR (C)+ + CLR (C)+ + MOV #"BU,(C)+ + MOV #"SY,(C)+ + MOV #DVRBF2,DVRPKP + BR DVRRFL + +;HERE TO SEND STS TO GUY CONNECTED TO DOVER +;MUST BE MASKED AGAINST CHAOS INTERRUPTS +DVRSTS: MOV #%COSTS*400,B +DVRST1: MOV #DVRBF2,A ;USE THIS BUFFER + MOV #4,D ;NUMBER OF BYTES +DVRST2: MOV A,C + MOV B,(A)+ ;OPCODE + MOV D,(A)+ ;NUMBER OF BYTES + MOV DVRHST,(A)+ ;DESTINATION HOST + MOV DVRIDX,(A)+ ;DESTINATION INDEX + MOV #CHAD0,(A)+ ;SOURCE HOST + MOV DVRLIX,(A)+ ;SOURCE INDEX + CLR (A)+ ;NO PACKET NUMBER + CMP B,#%COLOS*400 ;IF SENDING LOS, PUNT THE REST + BEQ 20$ + MOV DVRID,B + DEC B ;LAST PACKET ACKNOWLEDGED BY DOVER + ADD DVROFS,B ;CONVERT TO CHAOSNET ID + MOV B,(A)+ ;ACKNOWLEDGE PACKET NUMBER + MOV B,(A)+ ;RECEIPT + MOV #NDVRBF,(A)+ ;WINDOW SIZE +20$: MOV C,DVRPKP ;CAUSE PACKET TO GET SENT + ;DROP INTO DVRRFL + +;HERE TO GET ANOTHER PACKET FROM THE DOVER. THIS CAN BE EITHER A CHAOSNET +;PACKET TO BE SENT BACK TO THE APPROPRIATE GUY, OR A PUP TO GO TO THE DOVER +DVRRFL: MOV #CHXDVR,I ;THIS MIGHT NOT BE SET UP WHEN CALLED + TST CHISTS(I) ;PACKET SOURCE ONLY EMANATES ONE AT A TIME + BNE CPOPJ0 + CMP CHIBFP(I),DVRPKP ;FINISHED SENDING SPECIAL PACKET? + BNE 10$ + CLR DVRPKP ;YES, MAKE READY FOR ANOTHER +10$: CLR CHIBFP(I) ;THIS PACKET NO LONGER BEING SENT + MOV DVRPKP,A ;GOT SPECIAL PACKET TO SEND? + BNE 30$ ;YES, SEND IT + TST DVRMSK ;GOT NEXT BUFFER TO SEND TO DOVER? + BPL CPOPJ0 ;NO + CMP DVRRTR,#60. ;1-SECOND RETRANSMISSION INTERVAL ELAPSED? + BLO CPOPJ0 ;NO, DON'T SEND YET + CLR DVRRTR ;SENDING, RESET RETRANSMISSION TIMER + MOV DVRBFP,A + BIC #PKFCMS,PKFC(A) ;CLEAR FORWARDING COUNT SINCE SENDING AGAIN +30$: MOV A,CHIBFP(I) ;SEND THIS PACKET + CALL CHSIHD ;ROUTE HIM + BVS DVRRFL ;BAD, IGNORE + CMP B,#CHXCHS ;SWAB IF SENDING TO 10, BUT NOT ETHERNET + BHIS 35$ + CALL CHSSWB +35$: INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + RET + +;CALLED WITH A PUP IN ETHIBF WHICH IS FROM THE DOVER AND ADDRESSED +;TO THE GUY WHO'S TRYING TO PRINT ON IT. MUST BE MASKED AGAINST ETHER & CHAOS INTERRUPTS. +DVRPUP: MOVB ETHIBF+PKDAT+2,B + CMP B,#31 ;EFTP ACKNOWLEDGE? + BNE DVRPP1 + CMP ETHIBF+PKDAT+6,DVRID ;ACKNOWLEDGING EXPECTED PACKET? + BNE CPOPJ0 ;NO, IGNORE IT + INC DVRID ;YES, ADVANCE ID, POINTER, AND PACKET-PRESENCE MASK + MOV DVRBFP,A + ADD #DVRBFL,A + CMP A,#DVRBF2 + BLO 11$ + MOV #DVRBUF,A +11$: MOV A,DVRBFP + ASL DVRMSK + SETOM DVRRTR ;FAKE RETRANSMIT TIMER TO SEND NEXT PUP RIGHT AWAY + TST CHISTS+CHXDVR ;PACKET SOURCE BUSY? + BEQ DVRSTS ;NO, SEND AN ACKNOWLEDGEMENT TO THE CHAOSNET +CPOPJ0: RET + +DVRPP1: MOV #22.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#33 ;EFTP ABORT? + BEQ DVRERR + MOV #44.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#4 ;PUP ERROR? + BNE CPOPJ0 ;IGNORE ANYTHING ELSE +DVRERR: CLR DVRMSK ;DON'T SEND ANYTHING MORE TO THE DOVER + MOV ETHIBF+PKDAT,C ;PUP LENGTH + SUB A,C + SUB #2,C ;GET LENGTH OF ASCII STRING + ADD #ETHIBF+PKDAT,A ;GET ADDRESS OF ASCII STRING + MOV #DVRBUF+PKDAT,B ;BUILD A LOS PACKET TO SEND BACK + MOV C,D ;SAVE BYTE LENGTH + INC C + ASR C ;WORD COUNT + BEQ 11$ +10$: MOV (A)+,(B) + SWAB (B)+ ;ALTO HAS BYTES IN THE WRONG ORDER + SOB C,10$ +11$: MOV #%COLOS*400,B ;SEND A LOS + MOV #DVRBUF,A + CALL DVRST2 + CLR DVRHST ;KILL CONNECTION + RET + +;HERE IS A PACKET DIRECTED TO THE DOVER. DO GOOD THINGS WITH IT. +;NOTE, IT HAS ALREADY BEEN SWABBED INTO ETHERNET BYTE ORDER. +DVRPKT: MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),A ;GET ADDRESS OF PACKET + CLR DVRTIM ;FOREIGN HOST IS NOT IDLE + MOVB PKOP(A),B ;DATA PACKET? + BMI 50$ ;YES + CMP B,#%COSNS + BNE 11$ + TST CHISTS+CHXDVR + BNE 90$ + CALL DVRSTS ;SNS => STS + BR 90$ + +11$: CMP B,#%COCLS + BEQ 12$ ;CLS OR LOS PUNTS THE CONNECTION + CMP B,#%COLOS + BNE 13$ +12$: CLR DVRHST + BR 90$ + +13$: CMP B,#%COEOF ;NOTE THAT EOF IS TREATED VERY MUCH LIKE DATA! + BNE 90$ ;IGNORE ANYTHING RANDOM +50$: MOV PKPKN(A),B ;GET ID OF DATA PACKET + SUB DVROFS,B + MOV DVRBFP,D ;FIND WHERE IN THE BUFFER IT GOES + MOV #100000,C ;AND GET MASK BIT FOR IT + SUB DVRID,B ;B := ID RELATIVE TO NEXT EXPECTED + BEQ 53$ + CMP B,#NDVRBF + BHIS 90$ ;IGNORE DUPLICATE OR NOT IN WINDOW +51$: ADD #DVRBFL,D + CMP D,#DVRBF2 + BLO 52$ + MOV #DVRBUF,D +52$: CLC + ROR C + SOB B,51$ +53$: BIT C,DVRMSK ;ALREADY HAVE PACKET? + BNE 90$ ;YES, IGNORE + BIS C,DVRMSK ;NO, STORE IT AWAY + MOV D,C + ADD #PKDAT,D ;BUILD PUP + MOV PKNBYT(A),B + BIC #PKNBMS,B + MOV B,(D) + ADD #22.,(D)+ ;PUP LENGTH + MOV #30,(D)+ ;PUP TYPE + TST (A) ;WAS THIS DATA OR EOF? + BMI 54$ ;DATA + SUB (PC),-2(D) ;EOF, SET PUP TYPE TO 32 +54$: CLR (D)+ ;PUP ID HIGH + MOV PKPKN(A),(D) ;PUP ID LOW + SUB DVROFS,(D)+ ; CORRECTED + MOV #DVRADR,(D)+ ;DESTINATION HOST + CLR (D)+ ;DESTINATION SOCKET HIGH + MOV #20,(D)+ ;DESTINATION SOCKET LOW + MOV DVRHST,(D)+ ;SOURCE HOST + CLR (D)+ ;SOURCE SOCKET HIGH + MOV DVRIDX,(D)+ ;SOURCE SOCKET LOW + ADD #PKDAT,A + INC B + ASR B ;NUMBER OF DATA WORDS +;*** TEMPORARY KLUDGE *** + PUSH ;PUSH B LAST!! +;*** END TEMPORARY KLUDGE *** + BEQ 56$ +55$: MOV (A)+,(D)+ ;MOVE THE DATA + SOB B,55$ +56$: MOV C,A + ADD #PKDAT,A + MOV #<%COUNC*400>,(C) ;PKOP + MOV 10(A),PKDHST(C) + MOV (A),PKNBYT(C) ;SHOULD BE ENOUGH TO GET IT ROUTED TO ETHERNET + CALL PUPCKS ;STORE APPROPRIATE CHECKSUM +;*** TEMPORARY KLUDGE *** + POP ;LOOK FOR SOME KIND OF MACHINE FAILURE + TST B + BEQ 79$ +70$: CMP (D)+,(A)+ + BNE 75$ + SOB B,70$ + BR 79$ + +75$: DVRFKT=. + NOP ;PUT A BPT HERE IF YOU LIKE + INC NDVRFK + CLR DVRMSK ;DO IT ALL OVER AGAIN +79$: +;*** END TEMPORARY KLUDGE *** + CALL DVRRFL ;SEND THIS PACKET MAYBE +90$: MOV #CHXDVR,I + JMP CHSODN ;THIS PACKET HANDLED +.ENDC ;NDVRBF + .IFNZ DL10P + .SBTTL TRAP HANDLING + +TRAP14: HALT ;BPT WITH NO RUG IN CORE + +TRAP10: BPT ;ILLEGAL INSTRUCTION + +TRAP4: NOP ;PATCH BPT HERE IF YOU WANT + CMP (SP),#MAIN ;IF TRAP4 IN MAIN LOOP... + BLO CRASH + CMP (SP),#MAINE + BHIS CRASH + BIT #DLXPRT,DLXCSR ;AND DL10 PORT TURNED OFF + BNE CRASH + TST DLXOFF ;AND WE THOUGHT IT WAS ON + BNE CRASH +RESTRT: MOV #STKBAS,SP ;THEN RESTART MAIN LOOP + CLR -(SP) ;WHICH WILL WAIT FOR DL10 PORT TO TURN ON + MOV #MAIN,-(SP) + RTI + +CRASH: BPT ;OTHERWISE, CRASH + +PWRFAL: RESET ;POWER FAIL OR UP - IF FAIL, HALT DURING RESET + MOV #20,B ;WAIT 2 SECONDS TO +1$: CLR A ; MAKE SURE POWER IS REALLY ON + SOB A,. + SOB B,1$ + JMP INIT ;POWER SEEMS UP, RESTART PROGRAM +.ENDC ;DL10P + +.IFNZ NODDT ;IF NO DDT OR OTHER "OPERATING SYSTEM", SET UP TRAP HANDLERS +TRAP4: + .=4 + .WORD TRAP4,340,TRAP10,340,TRAP14,340,TRAP10,340,PWRFAL,340,TRAP10,340,TRAP10,340 + .=TRAP4 + +;ILLEGAL ADDRESS, UNIBUS NXM, STACK OVERFLOW +TRAP4: BPT + 0 + +;ILLEGAL INSTRUCTION, IOT, EMT +TRAP10: BPT + 0 + +;POWER FAILURE OR RESTORE +PWRFAL: HALT + 0 + +;BPT (OR TRACE) +TRAP14: .REPT 7 ;SAVE REGISTERS WHERE CARPET CAN FIND THEM + MOV %0+.RPCNT,BPTACS+<.RPCNT*2> + .ENDR + CLR BPTGO + SETOM BPTFLG +5$: TST BPTGO + BEQ 5$ + CLR BPTFLG + .REPT 7 + MOV BPTACS+<.RPCNT*2>,%0+.RPCNT + .ENDR + RTI + +BPTFLG: 0 ;NON-ZERO IF GOT A BPT +BPTGO: 0 ;NON-ZERO TO PROCEED +BPTACS: .BLKW 7 ;REGS EXCEPT PC + +.ENDC ;NODDT + + .SBTTL INITIALIZATION +GO:: +INIT: CLR PS +.IFNZ DL10P + RESET + MOV #STKBAS,SP + TST 14 + BNE 1$ ;BPT ALREADY SET UP BY RUG + MOV #TRAP14,14 + MOV #340,16 +1$: +.ENDC ;DL10P +.IFNZ NODDT ;NO OPERATING SYSTEM + RESET + MOV #STKBAS,SP +.ENDC ;NODDT + SETOM DLXOFF ;REINITIALIZE VARIOUS VARIABLES + SETOM NO.ITS +.REPT CHAOSP ;IDLE CHAOS NET INTERFACES + CLR CHISTS+CHXCHS+<2*.RPCNT> + CLR CHOSTS+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ T300P, CLR RQBACT +.IFNZ NCT + MOV #NFTTY,I +76$: MOV NRMIPC(I),TTYIPC(I) + ADD #2,I + CMP I,#LASTTY + BLE 76$ + MOV #TYORNG,B ;CLEAR THE TYPOUT-DONE RING + CALL CLRING + MOV #,A ;GIVE OUTPUT DONE ON ALL LINES +78$: CALL PUT + INC A + CMP A,#+NCT + BLO 78$ +.ENDC ;NCT +.IFNZ NDMS +;;; Turn on DM11-BBs + CLR B ;iterated over DM11 units + MOV #NDMS,H +5$: MOV #DMCLR+DMCSN,@DMCSR(B) ;CLEAR SCANNER MEMORY +2$: BIT #DMBSY,@DMCSR(B) + BNE 2$ + CLR I ;iterated over modem channels + ;; turn on connected modem channels for one DM11 + CLR A ;counter for channels per unit +3$: TST M2LMAP(I) + BEQ 4$ + MOV A,@DMCSR(B) + MOV #LINENB,@DMLSR(B) +4$: TST (I)+ + INC A + CMP A,#16. + BLT 3$ + TST (B)+ + SOB H,5$ ;next DM11 + ;; treat first-time interrupts differently + SETOM DMINI + CLR B + MOV #NDMS,A +6$: MOV #DMSCN+DMIEN,@DMCSR(B) ;enable scanner interrupts + TST (B)+ + SOB A,6$ ;on all DMs + MOV #20000.,A + SOB A,. ;DELAY 50 MILLISECONDS + CLR DMINI ;WHILE P.I. LEVEL GETS INITIAL STATUS +.ENDC ;NDMS + +.IFG NDHS +;TURN ON DH11'S + MOV #NLDHHX,H +DHINIL: MOV DHSCR(H),A ;DEVICE ADDRESS + MOV #100000,16(A) ;TURN ON SILO MAINTENANCE MODE, SUSPECTED OF + ;LOSING + MOV #4000,(A) ;RESET DH11 + MOV 16(A),B ;CHECK SILO STATUS + BIC #300,B ;THESE BITS ARE IN RAM & DON'T CLEAR + BEQ DHSWIN ;SHOULD HAVE CLEARED MAINTENANCE MODE AND OTHER CRUD +DHSLUZ: BPT ;LOSE +DHSWIN: MOV #DHRENB+DHTENB,(A) ;NOW ENABLE INTERRUPTS ON DH11 + SUB #2,H + BGE DHINIL +.ENDC ;NDHS + +;TURN ON DL11S +.IFG NDLS + MOV #NLDLHX,H + MOV #NDLS-1,A +21$: +.IIF NZ DTE20P, BEQ 22$ ;NO KBD INT ON KL10 CTY DUE TO KLDCP LOSSAGE + MOV #103,@DLKS(H) ;ACTIVATE KEYBOARD INTERRUPT, D.T.R., READER +22$: MOV #100,@DLPS(H) ;ACTIVATE PRINTER INTERRUPT + SUB #2,H + DEC A + BPL 21$ +.ENDC ;NDLS + +;SET LINE PARAMETERS AND ALLOCATE BUFFERS +.IFNZ NCT + MOV #NFTTY,I +10$: MOV LPRVAL(I),A + MOV BUFSIZ(I),B + CALL SPARAM + ADD #2,I + CMP I,#LASTTY + BLE 10$ +.ENDC ;NCT + +;TURN ON CLOCK +.IIF Z DTE20P, MOV #100,@#LKS ;NO CLOCK INTERRUPTS IF KLDCP IS HACKING CLOCK TOO + +.IFNZ DTE20P +;INITIALIZE DTE20 + MOV #37774,DLYCNT ;DMA TO BANK 0, 2 USEC DELAY + MOV #%D3BYT,DIAG3 ;DO TO10 TRANSFERS IN BYTE MODE + MOV #MAIN,SADR ;ONLY DO INIT ONCE +.ENDC ;DTE20P +.IIF NZ TEN11P, SETOM T11I10 ;CAUSE 10 TO REINITIALIZE TEN-11 CHAOS +.REPT CHAOSP + MOV CHIHWR+CHXCHS+<2*.RPCNT>,H ;ADDRESS THE INTERFACE + CONC ,\.RPCNT ;CHECK THE HOST NUMBER SWITCHES AGAINST THE PROGRAM + BEQ .+4 + BPT + BIS #%CAREN,(H) ;ENABLE CHAOS NET INPUT INT +.ENDR ;CHAOSP +.IFNZ ETHERP + MOV CHIHWR+CHXETH,H ;ADDRESS THE INTERFACE + MOV 16(H),A ;GET HOST NUMBER SWITCHES + COMB A ;FIX XEROX MISTAKE + CMPB A,#ETHHSN ;CHECK HOST NUMBER SWITCHES + BEQ .+4 + BPT + MOV #CHXETH,I ;ENABLE TO RECEIVE FIRST ETHERNET PACKET + CALL ETHRFL +.ENDC ;ETHERP +;GO + JMP MAIN + +.IFNZ GOULDP +.SBTTL GOULD PRINTER BUFFERS + +GLPOIP: GLPBFF ;NEXT BUFFER IN AT M.P. LEVEL +GLPOOP: GLPBFF ;NEXT BUFFER OUT AT P.I. LEVEL + + .REPT NGLPBF ;ASSEMBLE THE BUFFERS + 0 .SEE GB.STA + GLPBFF ;DUE TO PALX BUG, LEAVE .SEE ON NEXT LINE + .SEE GB.NXT +GLPBFF==.-4 + 0 .SEE GB.FF + 0 .SEE GB.NL + 0 .SEE GB.PNT + .BLKB GLPBSZ + .ENDR +.ENDC ;GOULDP + + .SBTTL "TTYTYP" PARAMETER FILE + +T LPRVAL: + .BLKW NCT ;DH11 PARAMETER REG + +BUFFRS: ;BEGIN ALLOCATING BUFFERS HERE + +.IIF NZ NCT, INFORM ,\BUFFRS +ZZ===+3777>/4000 ;NUMBER OF K USED +.IRP ZZZZ,<0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16> +.LIF EQ ZZ-.IRPCNT ;THIS IS A CRETINOUS CROCK TO GET IT COME OUT IN DECIMAL +INFORM ,\BUFFRS+,< (>,ZZZZ, +.ENDR + +.IFNZ NCT ;TTYTYP FILE ONLY IF WE HAVE TTYS +.IF P2 ;SPEED UP THE ASSEMBLY +OFF==69105 ;KLUDGES SO I DON'T HAVE TO PUT KEYWORD PARAMETERS INTO PALX +40K==40000 +80K==80000 + +.MACRO SPEED BAUD +ZZ==-1 +.IIF EQ BAUD-OFF, ZZ==0 +.IIF EQ BAUD-50, ZZ==1 +.IIF EQ BAUD-75, ZZ==2 +.IIF EQ BAUD-110, ZZ==3 +.IIF EQ BAUD-134, ZZ==4 +.IIF EQ BAUD-150, ZZ==5 +.IIF EQ BAUD-200, ZZ==6 +.IIF EQ BAUD-300, ZZ==7 +.IIF EQ BAUD-600, ZZ==10 +.IIF EQ BAUD-1200, ZZ==11 +.IIF EQ BAUD-1800, ZZ==12 +.IIF EQ BAUD-2400, ZZ==13 +.IIF EQ BAUD-4800, ZZ==14 +.IIF EQ BAUD-9600, ZZ==15 +.IIF EQ BAUD-80K, ZZ==16 +.IIF EQ BAUD-40K, ZZ==17 +.IIF LT ZZ, .ERROR UNRECOGNIZED SPEED "BAUD" +.ENDM SPEED + +.MACRO IPARM N,ODFLT,IDFLT,MUMLST +.IF GE <2*N>-NFTTY +.IF LE <2*N>-LASTTY +%%.ISPEED==-1 +%%.SPEED==-1 +.IRP MUM, +.IF NB + ZZ==0 + .IRPC MUMB, + .IIF GE .IRPCNT-2, .MEXIT + .IIF IDN MUMB,S, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,P, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .IIF IDN MUMB,I, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,S, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .ENDM + .IIF EQ ZZ-2, %%.'MUM + .ENDC +.ENDM +.IF LT %%.ISPEED + .IIF LT %%.SPEED, %%.ISPEED==IDFLT + .IELSE %%.ISPEED==%%.SPEED +.ENDC +.IIF LT %%.SPEED, %%.SPEED==ODFLT +SPEED %%.ISPEED +IZZ==ZZ +SPEED %%.SPEED +; BUFFER SIZE IS 1/2 SECOND'S TYPING +; BUT WILL BE SUBJECT TO LIMIT OF MAXBSZ +.IIF LT ZZ-7, BZZ==5. +.IIF EQ ZZ-7, BZZ==15. +.IIF EQ ZZ-10, BZZ==30. +.IIF EQ ZZ-11, BZZ==60. +.IIF EQ ZZ-12, BZZ==90. +.IIF EQ ZZ-13, BZZ==120. +.IIF EQ ZZ-14, BZZ==240. +.IIF EQ ZZ-15, BZZ==480. +.IIF GT ZZ-15, BZZ==1000. +.=LPRVAL+<2*N> ;ASSEMBLE LINE PARAMETER WORD +.IIF NE ZZ-3, ++3 ;ISPEED, OSPEED, NO PARITY, 8 BITS, FULL DUPLEX +.IELSE ++3+4 ;110 BAUD EXTRA STOP BIT +.=BUFSIZ+<2*N> +BZZ ;ASSEMBLE BUFFER SIZE +.ENDC +.ENDC +.ENDM IPARM + +;MACROS USED IN THE TTYTYP FILE: + +.MACRO TTDPRT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDPRT + +.MACRO TTDMRX TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,600,600, +.ENDM TTDMRX + +.MACRO TTDTRM TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTRM + +.MACRO TTDLPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDLPT + +.MACRO TTDLA36 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDLA36 + +.MACRO TTDIML TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,50K,25K, +.ENDM TTDIML + +.MACRO TTDVT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDVT + +.MACRO TTDTEK TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTEK + +.MACRO TTDLSR TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDLSR + +.MACRO TTDDPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDDPT + +.MACRO TTDGT40 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTDGT40 + +.MACRO TTDRAY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTDH19 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTD11 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTD11 + +.MACRO TTDRAN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDRAN + +.MACRO TTDTV TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDTV + +.MACRO TTDGRN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDGRN + +.MACRO TTDSTY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDSTY + +.MACRO REPEAT N,FOO +FAKOUT: .REPT N +FAKOUT===0 +.ENDM + +NSTTYS==0 ;WE'RE NOT INTERESTED IN PSEUDO-TTYS +N11TYS==0 ;NOR IN PDP11 TVS + +.INSRT SYSTEM;TTYTYP > + +.EXPUNGE ZZ,IZZ,IZZZ,BZZ,OFF,40K,80K,%%.ISPEED,%%.SPEED +.EXPUNGE TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED + +.ENDC ;P2 + +.ENDC ;NCT + +.END INIT diff --git a/system/ioelev.432 b/system/ioelev.432 new file mode 100644 index 0000000..b387595 --- /dev/null +++ b/system/ioelev.432 @@ -0,0 +1,4960 @@ +;;; -*-PALX-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + .TITLE IOELEVEN + + .SBTTL DEFINITIONS + +;;; note that the .IFM macro must be used only at toplevel +;;; (non-conditionalized) in PALX because it doesn't do the expansion of .IFM +;;; when conditionalized out, therefore it doesn't match it with the +;;; following .ENDC and the .ENDC will be seen at toplevel and end the +;;; conditionalization one is in. This will screw the code running on +;;; another one of the machines even if it doesn't signal an error in your +;;; assembly. --PGS + +.LIF NZ 0 + .FATAL USE PALX DUMMY!! + +;NOTE THAT THIS PROGRAM IS DESIGNED FOR 11/40'S. TO RUN ON AN +;11/10, MACRO OUT THE SOB INSTRUCTIONS. DOES NOT USE EIS NOR FIS. + +A=%0 ;TEMP/ARG/CHAR +B=%1 ;TEMP/ARG +C=%2 ;TEMP/ARG +D=%3 ;TEMP/ARG +H=%4 ;USUALLY INDEX IN HARDWARE UNIT TABLES +I=%5 ;USUALLY LINE NUMBER TIMES 2 +SP=%6 ;STACK POINTER +PC=%7 ;PROGRAM POINTER +PS=177776 ;PROGRAM STATUS +SWR=177570 ;SWITCHES + +.MACRO RTI +.ENDM ;FUCKING PALX! + +RTI=RTT ;11/40 HARDWARE MISFEATURE + +.IF P1 +.PRINT /MACHINE NAME = / +.TTYMAC MNAM +%TTYFLG==%TTYFLG+1 +.PRINT /MNAM +/ +%TTYFLG==%TTYFLG-1 +.MACRO .IFM MCHN ;REFERS TO PDP11 NAME +.IF IDN MCHN,MNAM +.ENDM .IFM +.MACRO MCONDX MCHN ;REFERS TO ITS SYSTEM NAME, USUALLY THE SAME +.IF IDN MCHN,MNAM +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY ;INSERT ITS SYSTEM NAME INTO BODY IN PLACE OF "MCHN" +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME +.ENDM ;TTYMAC +.ENDC ;P1 + +VERSION==%FNAM2 + +.IFM MX-DL ;MX'S DL-10 PDP11 +.MACRO MCONDX MCHN +.IF IDN MCHN,MX +.ENDM MCONDX +.MACRO FUBAR +.ENDC +.ENDM FUBAR +.MACRO MNAME BODY +.IRP MCHN, +BODY +.ENDM +.ENDM MNAME + +DL10P==1 ;HAS DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==0 ;HAS DDT +NFTTY==102 ;2 * # OF FIRST TTY THIS 11 +NDHS==1 ;NUMBER OF DH11'S +NDHUN==15 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE (REST IN PEACE) +;MPXIDX==2*27 ;TTY INDEX OF LINE THAT MULTIPLEXED TTYS RUN OVER +NDMS==0 ;HAS DM11BB MODEM SCANNER (BUT IT'S NOT CONNECTED TO ANYTHING) +GOULDP==0 ;DOESN'T HAVE GOULD LPT (ANYMORE) +T300P==1 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB=0 ;CHAOSNET INTERFACE IS NEW, DOESN'T GET HUNG ANY MORE +CHAD0==440 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF +DLCADR==1440 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA DL10 (MX) +CHAD1==3040 ;SECOND INTERFACE +TEN11P==0 ;NO TEN-11 INTERFACE +ETHERP==0 ;NO ETHERNET +FTPULS==0 ;INITIALLY, MX DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;SAVE LAST GARBAGE PACKET RECEIVED +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;MX-DL + +.IFM MX ;MX CONSOLE 11 +DL10P==0 ;DOES NOT HAVE DL10 +DTE20P==1 ;HAS DTE20 +NODDT==0 ;HAS DDT AND KLDCP +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==2 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==310 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==1 ;NUMBER OF DL11'S +CTYP==1 ;FIRST DL11 IS T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS THAT GO THROUGH MULTIPLEXED LINE (NONE) +NDMS==2 ;has 2 DM11BB modem scanners (really DH11AD) +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==0 ;NO CHAOS NET INTERFACE +TEN11P==0 ;NO TEN-11 CHAOS INTERFACE +ETHERP==0 ;NO ETHERNET +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE + +.MACRO ASPIRP BODY ;DEFINE LINE #S WITH AUTOSPEED +.IRP N,<1,3,4,5,6,7,10,11,12,13,14,15,16,17> + BODY +.ENDM +.ENDM ASPIRP + +TKS==177560 +TKB==177562 +TPS==177564 +TPB==177566 +.ENDC ;MX + +.IFM AI ;AI'S CHAOS-ETHER-GATEWAY PDP11 + +;THIS IS A PDP11/10, WE HAVE TO REDEFINE A FEW THINGS +.MACRO RTT +.ENDM +RTI==2 +RTT==2 +.MACRO SOB REG,TAG + DEC REG + BNE TAG +.ENDM SOB + +DL10P==0 ;HAS NO DL10 +DTE20P==0 ;DOES NOT HAVE DTE20 +NODDT==1 ;DOESN'T HAVE DDT (USE CARPET) +NFTTY==0 ;2 * # OF FIRST TTY THIS 11 +NDHS==0 ;NUMBER OF DH11'S +NDHUN==0 ;NUMBER OF UNUSED DH11 LINES +DHIBAS==320 ;DH11 INTERRUPT VECTOR BASE +DHCBAS==160020 ;CSR of first DH11 +NDLS==0 ;NUMBER OF DL11'S (ACTUALLY HAS ONE, BUT WE'RE NOT USING IT NOW) +CTYP==0 ;FIRST DL11 NOT T00 (CTY) +NMPTYS==0 ;NUMBER OF TTYS ON MULTIPLEXED LINE +NDMS==0 ;HAS NO DM11BB MODEM SCANNERS +GOULDP==0 ;DOESN'T HAVE GOULD LPT +T300P==0 ;TRIDENT T-300 AND 2561 CONTROLLER +CHAOSP==2 ;HAS TWO CHAOS NET INTERFACES +CHSBTB==0 ;CHAOSNET INTERFACE IS NEW-STYLE, DOES NOT GET HUNG +CHAD0==426 ;CHAOSNET ADDRESS OF THIS PDP11 ITSELF (AI-MC-CROSS-STREET SUBNET) +CHAD1==3072 ;SECOND INTERFACE (9TH FLOOR LISP MACHINE SUBNET) +CHADD==426 ;The DOVER protocol translator only works for this address +TEN11P==0 ;USES TEN-11 INTERFACE FOR CHAOS NET TO AI-10 (NOT ANY MORE!) +T11ADR==2026 ;CHAOSNET ADDRESS OF PDP10 CONNECTED VIA TEN-11 INTERFACE (AI) +NT11BF==3 ;THREE BUFFERS IN EACH DIRECTION FOR TEN-11 INTERFACE +ETHERP==1 ;ETHERNET +ETHHSN==6 ;MY HOST NUMBER BYTE, JNC SAYS I SHOULD USE 6 +NDVRBF==6 ;6 DOVER BUFFERS +DVRADR==1002 ;PUP ADDRESS OF DOVER +FTPULS==0 ;INITIALLY, AI DOES NOT GENERATE TEST PACKETS +FTGARB==1 ;DON'T SAVE LAST GARBAGE PACKET RECEIVED (LOW ON CORE) (not that low) +MAXBSZ==250. ;MAXIMUM TYPEOUT BUFFER SIZE +.MACRO ASPIRP BODY ;DEFINE LINE NUMBERS WITH AUTOSPEED +.ENDM ASPIRP +.ENDC ;AI + +.IIF NDF NDHS, .ERROR MACHINE NAME NOT RECOGNIZED + +.IIF NZ DL10P, .IIF Z NFTTY, .ERROR TTY # 0 DOESN'T WORK WITH DL10 PROTOCOL + +;ASSIGN TTY INDICES, HARDWARE INDICES, ETC. + +TX==NFTTY ;TTY INDEX +HX==0 ;HARDWARE INDEX +NCT==0 ;NUMBER OF TTYS + +;SYSTEM CONSOLE (OUT OF ORDER) +.IFNZ CTYP + TX==TX+2 + NCT==NCT+1 +.ENDC + +;DH11 LINES + NFDHTY==TX + TX==TX+<32.*NDHS> + NCT==NCT+<16.*NDHS> + HX==HX+<2*NDHS> + NLDHHX==HX-2 ;UNITS 0-NLDHHX INCLUSIVE ARE DH11S + + TX==TX-<2*NDHUN> ;COMPENSATE FOR UNUSED LINES + NLDHTY==TX-2 ;LAST DH11 LINE INCLUSIVE + NCT==NCT-NDHUN + +;DL11 LINES + NFDLTY==TX + NFDLHX==HX + TX==TX+<2*NDLS>-<2*CTYP> + HX==HX+<2*NDLS> + NLDLHX==HX-2 + NCT==NCT+NDLS-CTYP + +;MULTIPLEXOR LINES + NFMPTY==TX + MPKHWR==HX + TX==TX+<2*NMPTYS> + HX==HX+2 + NCT==NCT+NMPTYS + +NLTTY==NFTTY+<2*NCT> ;2 * # OF FIRST TTY NOT THIS 11 +LASTTY==NLTTY-2 ;LAST VALID TTY INDEX + +.IFNZ NDMS ;DM11-BB MODEM SCANNER + + ;1.1-1.4 MODEM CHANNEL # + DMBSY==20 ;1.5 SCAN BUSY (R.O.) + DMSCN==40 ;1.6 SCANNER ON + DMIEN==100 ;1.7 INTERRUPT ENABLE + DMDON==200 ;1.8 DONE - SCANNER HAS FOUND SOMETHING + DMSTP==400 ;1.9 STEP SCANNER TO NEXT LINE (W.O.) 1.2 USEC. + ;2.1 MAINTENANCE MODE + DMCLR==2000 ;2.2 CLEAR RTS, DTR, SEC TX, LINE EN FOR ALL LINES (W.O.) + DMCSN==4000 ;2.3 CLEAR SCAN - CLEAR CSR AND MODEM STATUS MEMORY (W.O.) 19 USEC + DM2RX==10000 ;2.4 SECONDARY RECIEVE CHANGED ON SELECTED MODEM (R.O.) + DMCTS==20000 ;2.5 CLEAR TO SEND CHANGED ON SELECTED MODEM (R.O.) + DMCAR==40000 ;2.6 CARRIER DETECT CHANGED ON SELECTED MODEM (R.O.) + DMRNG==100000 ;2.7 RING CHANGED ON SELECTED MODEM (R.O.) + + LINENB==1 ;1.1 ENABLE SCANNING OF LINE + LINDTR==2 ;1.2 DATA TERMINAL READY + LINRQS==4 ;1.3 REQUEST TO SEND (FORCE BUSY ON 103E) + LIN2TX==10 ;1.4 SECONDARY TRANSMIT + LIN2RX==20 ;1.5 SECONDARY RECEIVE (R.O.) + LINCTS==40 ;1.6 CLEAR TO SEND (R.O.) + LINCAR==100 ;1.7 CARRIER DETECT (R.O.) + LINRNG==200 ;1.8 RING (R.O.) +.ENDC ;NDMS + +; KW11-L LINE FREQ CLOCK + +LKS=177546 ;1.8 CLOCK FLAG + ;1.7 INTER ENB +HNGDLY==3*60. ;CLEAR TO SEND OFF FOR 3 SECONDS => HANGUP + +.IFNZ GOULDP +;DEFINITIONS FOR GOULD LPT + +GLPCSR=166000 ;COMMAND STATUS REGISTER (NONSTANDARD) + ;COMMAND CODES + %GCFF==0 ;TOP-OF-FORM COMMAND + %GCGRF==1 ;GRAPHIC MODE COMMAND + %GCCUT==2 ;CUT COMMAND (NO CUTTER ON THIS MACHINE, THOUGH) + %GCON==3 ;TURN PRINTER ON + %GCOFF==4 ;TURN PRINTER OFF + %GCLSL==5 ;LAST LINE (GRAPHIC MODE). => 2 MORE SCAN LINES. + %GCION==6 ;INTERRUPT ON + %GCIOF==7 ;INTERRUPT OFF + %GCADV==201 ;ADVANCE ONE LINE + ;STATUS BITS + %GSNRD==400 ;NOT READY + %GSDON==2000 ;TRANSFER COMPLETE + %GSBSY==4000 ;BUSY + %GSVAC==10000 ;VACUUM FAULT + %GSPAP==20000 ;PAPER LOW + %GSTIM==40000 ;TIMEOUT + %GSERR==50400 ;ALL ERROR BITS + +GLPWC=166002 ;NEGATIVE WORD COUNT REG + +GLPCA=166004 ;CURRENT ADDRESS REG + +GLPBSZ==132. ;BUFFER SIZE (# CHARS PER LINE) + +NGLPBF==7 ;NUMBER OF BUFFERS + GB.STA==0 ;BUFFER STATE - DON'T CHANGE ORDER OF %GB CODES + %GBIDL==0 ;0 IDLE + %GBMP==2 ;2 ACTIVE AT M.P. LEVEL + %GBWRT==4 ;4 IN WRITE QUEUE + %GBPI==6 ;6 ACTIVE AT P.I. LEVEL + %GBDMA==8 ;8 ACTIVE AT D.M.A. LEVEL + GB.NXT==2 ;CIRC POINTER TO NEXT BUFFER + GB.FF==4 ;IF NON-ZERO, FF BEFORE THIS BUFFER + GB.NL==6 ;NUMBER OF BLANK LINES BEFORE THIS BUFFER + GB.PNT==10 ;-> NEXT BYTE TO INSERT + GB.DAT==12 ;DATA BEGINS HERE + GB.LEN==GB.DAT+GLPBSZ ;TOTAL NUMBER OF BYTES PER BUFFER + +.ENDC ;GOULDP + +.IFNZ CHAOSP +;DEFINITIONS OF CHAOS NET HARDWARE + +;USUAL ADDRESS IS 764140 . USUAL INTERRUPT VECTOR IS 270 . + +CAICSR=164140 ;COMMAND STATUS REG +CH%CSR==0 + %CABSY==1 ;0 XMT BUSY (RO) + %CALUP==2 ;1 LOOP BACK (R/W) + %CASPY==4 ;2 RECIEVE MSGS FOR ANY DESTINATION (R/W) + %CARCL==10 ;3 CLEAR THE RECEIVER, IT CAN NOW GOBBLE ANOTHER MSG (WO) + %CAREN==20 ;4 RCV INT ENB (R/W) + %CATEN==40 ;5 XMT INT ENB (R/W) + %CATAB==100 ;6 TRANSMIT ABORTED BY ETHER CONFLICT (RO) + %CATDN==200 ;7 TRANSMIT DONE. SET WHEN TRANSMITTER IS DONE + %CATCL==400 ;8 CLEAR THE TRANSMITTER, MAKING IT READY (WO) + ;9-12 LOST COUNT (RO) [# MSGS RCVED WITH RCV BFR FULL] + ; WHEN MSG IS WAITING IN BUFFER, THIS COUNTS + ; THE MESSAGES THAT MATCHED OUR DESTINATION OR + ; WERE BROADCAST, BUT COULDN'T BE RECIEVED. + ; WHEN RECEIVER IS RE-ENABLED (WRITE 1 INTO %CARDN) + ; THE COUNT IS THEN CLEARED. + ; WHEN A MESSAGE IS LOST, RECEIVER ZAPS ETHER + ; SO TRANSMITTER WILL ABORT (IF MESSAGE WAS DESTINED + ; TO US.) + %CARST==20000 ;13 I/O RESET (WO) + %CAERR==40000 ;14 CRC ERROR (RO) + %CARDN==100000 ;15 RCV DONE. + +CAIMYN=164142 ;MY # (READ ONLY) +CH%MYN==2 ;RETURNS THE [SOURCE] HOST# OF THIS INTERFACE. + +CAIWBF=164142 ;WRITE BUFFER (WRITE ONLY) +CH%WBF==2 ;FIRST WAIT FOR TDONE. (OR SET IT VIA CSR) + ;FIRST WORD IN RESETS TRANSMITTER AND CLEARS TDONE. + ;STORE INTO THIS REGISTER TO WRITE WORDS OF MESSAGE, + ;LAST WORD IN IS DESTINATION ADDRESS, THEN READ CAIXMT. + ;SOURCE ADDRESS AND CHECK WORD PUT IN BY HARDWARE. + +CAIRBF=164144 ;READ BUFFER (READ ONLY) +CH%RBF==4 ;THE FIRST WORD READ WILL BE FILLED TO THE LEFT + ;TO MAKE THE MESSAGE RECIEVED A MULTIPLE OF 16 BITS. + ;IF THE NUMBER OF DATA BITS IN THE MESSAGE WAS A + ;MULTIPLE OF 16, THIS WORD WILL BE THE FIRST WORD PUT + ;INTO THE BUFFER BY THE TRANSMITTING HOST. + ;THE LAST 3 WORDS READ ARE DESTINATION, SOURCE, CHECK. + +CAIRBC=164146 ;RECEIVE BIT COUNTER (READ ONLY) +CH%RBC==6 ;WHEN A MESSAGE HAS BEEN RECEIVED THIS IS ONE LESS THAN + ;THE NUMBER OF BITS IN THE MESSAGE (16 X THE + ;NUMBER OF WORDS INCLUDING THE THREE OVERHEAD WORDS.) + ;AFTER THE LAST WORD (THE CRC WORD) HAS BEEN READ, IT IS 7777 + ;BITS 10 AND 11 ARE THE HIGH ORDER BITS, AND IF THEY ARE ONE, + ;THEN THERE WAS A BUFFER OVERFLOW + +CAIXMT=164152 ;READING THIS INITIATES TRANSMISSION (!!) +CH%XMT==12 ;THE VALUE READ IS ONE'S OWN HOST#. + +;REFERENCING ADDRESSES IN THE GROUP OF 8 WORDS NOT LISTED HERE, OR +;USING COMBINATIONS OF READ/WRITE NOT LISTED HERE, WILL TYPICALLY CAUSE +;STRANGE AND BIZARRE EFFECTS. + +;PACKET DEFINITIONS +;THESE ARE FOR 4K PACKET BUFFERS AND FOR THE ORIGINAL CHAOSNET PROTOCOL + +PKMAX==256. ;MAXIMUM LENGTH OF PACKET (INCLUDING ALL HARDWARE WORDS) +DATMAX==488. ;MAXIMUM NUMBER OF DATA BYTES +PKHDW==8 ;NUMBER OF HEADER WORDS +PKTMXW==+PKHDW ;MAX WORDS THROUGH PACKET SWITCH (SEE MOVDH ETC.) + +PKOP==1 ;BYTE INDEX OF THE OPCODE OF THE PACKET + %CORFC==1 + %COOPN==2 + %COCLS==3 + %COANS==5 + %COSNS==6 + %COSTS==7 + %CORUT==10 + %COLOS==11 + %COEOF==14 + %COUNC==15 +PKNBYT==2 ;WORD INDEX OF NUMBER OF BYTES IN PACKET +PKNBMS==170000 ;MASK FOR THE NUMBER OF BYTES +PKFC==2 ;WORD INDEX FOR THE FORWARD COUNT +PKFCMS==7777 ;IT IS THE TOP 4 BITS +PKDHST==4 ;DESTINATION HOST +PKDIND==6 ; " " " INDEX +PKSHST==10 ;SOURCE HOST +PKSIND==12 ;SOURCE INDEX +PKPKN==14 ;THE PACKET NUMBER +PKACN==16 ;THE ACK PACKET NUMBER +PKDAT==20 ;THE START OF THE DATA +.ENDC ;CHAOSP + +;STANDARD MACROS + +.MACRO PUSH X +.IRP Y, + MOV Y,-(SP) +.ENDM +.ENDM + +.MACRO POP X +.IRP Y, + MOV (SP)+,Y +.ENDM +.ENDM + +.MACRO CALL X + JSR PC,X +.ENDM + +.MACRO RET + RTS PC +.ENDM + +.MACRO SETOM LOC + ZZ===%COMPAT ;DON'T CARE WHETHER .+2 OR .+4 GETS STORED + %COMPAT===0 + MOV PC,LOC + %COMPAT===ZZ +.ENDM + +.MACRO MASK LEVEL + PUSH PS + MOV #_5,PS +.ENDM + +.MACRO UNMASK + POP PS +.ENDM + +.MACRO W +.=.+2 +.ENDM + +.MACRO T TAG ;usage is T TAG: STMNT +.=.-NFTTY +TAG +.=.+NFTTY +.ENDM + +.MACRO CONC A,B,C,D,E,F,G +A'B'C'D'E'F'G +.ENDM + +.MACRO INFORM A,B,C,D,E,F,G +.IF P1 +.PRINT /A'B'C'D'E'F'G +/ +.ENDC +.ENDM + +.MACRO MSG X +.NCHR ZZ,^\X\ + .WORD ZZ + .ASCII \X\ + .EVEN +.ENDM + +.MACRO .IREPT N,BOD +.REPT N +BOD +.ENDR +.ENDM + .IFNZ DL10P + .SBTTL DL10 CONTROL AREA + +ZZ==. +.=100000 + +DLXCSR: W ;DL10 11-SIDE CONTROL & STATUS REG + ;1.1-1.2 PIA + DLXIEN==4 ;1.3 ENABLE DLX11I TO INTERRUPT + DLXEEN==10 ;1.4 ENABLE ERRORS TO INTERRUPT + ;1.5 UNUSED + DLXPRT==40 ;1.6 PORT ENABLE (R.O.) + DLXZWC==100 ;1.7 CLEAR DLXWCO (W.O.) + DLXWCO==200 ;1.8 WORD COUNT OVERFLOW + DLXZPA==400 ;1.9 CLEAR DLXPAR (W.O.) + DLXPAR==1000 ;2.1 PAR ERR IN 10 MEM + DLXZNX==2000 ;2.2 CLEAR DLXNXM (W.O.) + DLXNXM==4000 ;2.3 NXM IN 10 MEM + DLXZ10==10000 ;2.4 CLEAR DLX10I (W.O.) + DLX10I==20000 ;2.5 INTERRUPT PDP10 + DLXZ11==40000 ;2.6 CLEAR DLX11I (W.O.) + DLX11I==100000 ;2.7 INTERRUPT PDP11 + +VERS: W ;.BYTE FIRST LINE, # OF LINES + ;SET BY -10. USED TO CHECK CONSISTENCY. + +DLXUP: W ;CHECK FOR UP-NESS IN BOTH DIRECTIONS + ;INCREMENTED BY 11 EVERY 1/60 SECOND, SETOM'ED BY 10 EVERY 1/2 SEC. + +TTYST: W ;LINE# TO START OUTPUT ON (I.E. SET OUTPUT DONE) + ;SET BY 10, CLEARED BY 11 + +TYILIN: W ;TYPEIN STATUS WORD - LINE NUMBER + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYICHR: W ;TYPEIN CHARACTER - GOES WITH PRECEDING WORD + +TYOSTS: W ;STATUS WORD (OUTPUT DONE LINE #) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 +TYOBSZ: W ;BUFFER SIZE FOR LINE WITH OUTPUT DINE (SET BY 11) + +TYOPNT: W ;BUFFER POINTER FOR TTY OUTPUT + ;SET BY 10 +TYOCNT: W ;BUFFER LENGTH FOR TTY OUTPUT + ;SET BY 10 +TYOLIN: W ;LINE NUMBER FOR TTY OUTPUT + ;SET BY 10, CLEARED BY 11 + +HNGLIN: W ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + ;SET BY 11, CLEARED BY 10 - INTERRUPTS 10 + +LPRLIN: W ;LINE NUMBER FOR SETTING LINE PARAMETERS + ;SET BY 10, CLEARED BY 11 +LPRLPR: W ;DH11 LPR REGISTER FOR SETTING LINE PARAMETERS + ;SET BY 10 +LPRBSZ: W ;BUFFER SIZE FOR SETTING LINE PARAMETERS + ;SET BY 10 + +EXDSTS: W ;STATUS WORD (EXAMINE/DEPOSIT 11 CORE) + ;1 = EXAMINE, 2 = DEPOSIT + ;SET BY 10, CLEARED BY 11 +EXDADR: W ;ADDRESS FOR ABOVE + ;SET BY 10 +EXDDAT: W ;DATA WORD FOR ABOVE + ;SET BY 10 (DEPOSIT) OR 11 (EXAMINE) + +GLPPTR: W ;BUFFER POINTER FOR GOULD OUTPUT +GLPCTR: W ;NUMBER OF BYTES YET TO BE GOBBLED +GLPTER: W ;ERROR STATUS, SET BY 11 +GLPGRF: W ;GRAPHIC MODE IF NON-ZERO, SET BY 10 + +;CHAOS NET SHARED VARIABLES +DLCINI: W ;WHEN THIS IS NON-ZERO, 11 RESETS ITS POINTERS AND CLEARS IT +DLCSP1: W ;SEND PACKET 1 (ILDB POINTER) +DLCSP2: W ;SEND PACKET 2 +DLCSS1: W ;SEND STATE 1 (0 IDLE, 1 TO 11, 2 OUTPUT DONE) +DLCSS2: W ;SEND STATE 2 +DLCRP1: W ;RECEIVE PACKET 1 (ILDB POINTER) +DLCRP2: W ;RECEIVE PACKET 2 +DLCRS1: W ;RECEIVE STATE 1 (0 IDLE, 1 READY FOR INPUT FROM 11, 2 INPUT DONE) +DLCRS2: W ;RECEIVE STATE 2 + +;^ ADD MORE HERE, E.G. IMP + +.IFNZ T300P +;DISK AREA. 14. WORDS 48. WORDS INTO THE DL-10 AREA. +.=100000+<60*2> + +DSCCHK: W ;MUST BE 2561 OCTAL TO MAKE SURE WE HAVE CORRECT PDP-10 PROGRAM +DSCREQ: W ;0 MEANS NO REQUEST. NON-ZERO MEANS 10 HAS PENDING REQUEST TO 11. +DSCDON: W ;0 MEANS NOT DONE, NON-ZERO MEANS 11 IS TELLING 10 IT'S DONE. +;NEXT 2 WORDS WRITTEN BY 11 TO TELL STATUS OF OPERATION +DSCFLT: W ;0 NO FAULT + %DFRST==100000 ; BIT 15=POWER CYCLED OR UNIBUS HUNG, SO CONTROLLER WAS RESET + ; BIT 12=Q ERROR, BIT 11=CMD NXM, BIT 10=CMD PAR + ; IF ONE OF THESE BITS IS ON, BITS 1-0 AND DSCSTS ARE THE ERROR ADDRESS + ; BITS 7-0 SYSTEM FAULT CODE IF LEFT BYTE IS ZERO + ; SEE THE 2561 OEM MANUAL FOR MEANING OF FAULT CODES +DSCSTS: W ;STATUS FROM 2561: + %DSRTR==100000 ;COMMAND WAS RETRIED + %DSECH==40000 ;UNCORRECTABLE DATA ERROR (ECC HARD) + %DSECC==20000 ;CORRECTED DATA ERROR + %DSIDE==10000 ;ID ERROR + %DSHCE==4000 ;ADDRESS ERROR (HEADER COMPARE ERROR) + %DSPRT==2000 ;WRITE-PROTECT STATUS OF SECTOR (ABORTS WRITE COMMAND) + %DSALT==1000 ;ALTERNATE-SECTOR STATUS (ABORTS READ, WRITE, AND CHECK) + %DSOVR==400 ;FIFO OVER-RUN, NOT CORRECTED BY 1 RETRY + %DSSKE==200 ;SEEK ERROR FROM DRIVE + %DSOFL==100 ;DRIVE OFF-LINE OR FAULT + %DSFLT==20 ;DRIVE FAULT + %DSNXM==10 ;NXM ON PDP11 MEMORY + %DSPAR==4 ;PARITY ERROR IN PDP11 MEMORY + %DSSFL==2 ;SYSTEM FAULT, SEE LOW BYTE OF DSCFLT + %DSWLK==1 ;DRIVE WRITE-LOCKED, WRITE ABORTED + +;FOLLOWING WORDS ARE WRITTEN BY 10 TO TELL WHAT TO DO +DSCCMD: W ;COMMAND OPCODE: + ;%DMNOP==0 ;DO NOTHING + ;%DMCST==1 ;READ OUT CONTROLLER STATE (NOT USEFUL SINCE NOT RETURNED TO 10) + %DMSNS==2 ;SENSE DRIVE STATE. DSCSTS GETS CODE FOR DRIVE TYPE IN + ; BITS 14-8 (10 FOR T-300), AND %DSWLK, %DSFLT, %DSOFL, %DSSKE + %DMTST==3 ;TEST SPECIFIED DRIVE (RUNS DIAGNOSTICS) + %DMREC==4 ;RECALIBRATE + %DMSEK==5 ;SEEK + %DMWRT==6 ;WRITE DATA + ;%DMFMT==7 ;WRITE FORMAT + ;%DMPWT==10 ;WRITE AND SET WRITE-PROTECT BIT + ;%DMAWT==11 ;WRITE AND SET ALTERNATE-SECTOR BIT + ;%DMCHK==12 ;READ AND CHECK ECC BUT DON'T STORE DATA + ;%DMLWT==14 ;LONG WRITE, WILL WRITE ECC AS WELL AS DATA + %DMRED==20 ;READ DATA. ADD 1-10 FOR VARIOUS RECOVERY FEATURES AS + ; DOCUMENTED IN THE 2561 OEM MANUAL. + ;%DMRID==40 ;READ IF FIELD, NOT USEFUL SINCE NOT RETURNED TO 10 +DSCDRV: W ;UNIT NUMBER +DSCCYL: W ;CYLINDER ADDRESS (THESE ARE COPIED BACK BY THE 11 IN CASE OF ERROR) +DSCHED: W ;HEAD ADDRESS +DSCSEC: W ;SECTOR ADDRESS +;WORD COUNT IS ALWAYS 12.*256. +;IF WE PUT IN SEEK-OVERLAP AN ATTENTION FEATURE WILL BE NEEDED +;THAT WOULD ALSO BE USED FOR DISK POWER-UP SIGNALLING +;THESE WORDS ARE SET UP BY THE 10 AS BYTE-POINTERS TO THE DATA +;TO BE TRANSFERRED. EACH BYTE POINTER CAN TRANSFER AT MOST 256 PDP10 WORDS +;DUE TO BRAIN-DAMAGE IN THE DL10, SO THERE ARE 4 OF THEM +DSCPNT: .BLKW 4 +.ENDC ;T300P + +DLXHGH:: +.=ZZ +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL DTE20 CONTROL AREA + +;LOCATIONS 400-437 ARE JUST BETWEEN US AND ITS +;LOCATIONS 440-457 ARE KNOWN ABOUT BY KLDCP ALSO + +;EPTDDT==441 ;START ADDRESS OF PDP10 NON TIME SHARING DDT +DTEFLG==444 ;NON TIME SHARING TYPEIN/TYPEOUT DONE FLAG (SET BY 11, CLEARED BY 10) +DTEF11==450 ;USED BY NON TIMESHARING TYPEIN COMMAND TO RETURN THE CHAR (SET BY 11) +DTECMD==451 ;NON TIME SHARING COMMAND (SET BY 10) +;COMMANDS THAT CAN GO IN DTECMD: + ;0-377 CHAR TO BE TYPED OUT + %DTTYI==3400 ;TYPE IN, CHAR RETURNED IN DTEF11 + %DTCLN==1001 ;60 CYCLE CLOCK ON + %DTCLF==1000 ;60 CYCLE CLOCK OFF + ;THERE ARE MILLIONS OF OTHERS, BUT WHO NEEDS 'EM? +DTECLK==445 ;60 CYCLE CLOCK FLAG (SET BY 11, CLEARED BY 10) +;DTESWR==457 ;SIMULATED SWITCH REGISTER (SET BY 11) + +;THE FOLLOWING LOCATIONS ARE ONLY USED IN TIME SHARING AND NOT KNOWN ABOUT BY KLDCP + +DTEVER==400 ;I/O VERSION NUMBER. .BYTE FIRST LINE, NUMBER OF LINES. + ;SET BY 10, CHECKED BY 11 + +DTECHK==401 ;INCREMENTED BY 11 60 TIMES PER SECOND, SETOMED BY 10 EVERY 1/2 SECOND + ;USED TO CHECK THAT 10 IS GETTING INTERRUPTS OK + +DTEINP==402 ;CONTROLS "BYTE TRANSFERS" FROM 11 TO 10 (INPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN XFER COMPLETE. + ;10 SHOULD SET UP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING DTEINP. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES IN DTEINP. +DTEOUT==403 ;CONTROLS "BYTE TRANSFERS" FROM 10 TO 11 (OUTPUT DIRECTION). + ;SET BY 10 TO REQUEST A TRANSFER, SETOM'ED BY 11 WHEN TRANSFER STARTS. + ;EACH SIDE KNOWS WHEN TRANSFER IS IN PROGRESS, DOESN'T TRY TO START + ; ANOTHER UNTIL IT HAS RECEIVED HARDWARE TRANSFER-DONE INTERRUPT. + ;10 SHOULD SET UP DTEBPO IN EPT BEFORE SETTING DTEOUT. + ;RH IS #BYTES EXPECTED, LH IS COMMAND+LINE#. COMMANDS ARE: + %DTTYO==1000 ;TELETYPE OUTPUT + ;%DTETI==2000 ;ETHERNET INPUT + ;%DTETO==3000 ;ETHERNET OUTPUT + ;^ ADD MORE COMMANDS HERE. NOTE: THE 4.1 BIT IS 1 FOR OUTPUT, 0 FOR INPUT. + +DTELSP==404 ;LINE# TO SET SPEED OF (SET BY 10, SETOMED BY 11) +DTELPR==405 ;DH11 LINE-PARAMETER-REGISTER,,BUFFER SIZE + +DTEOST==406 ;LINE# TO START OUTPUT ON (SET OUTPUT DONE). (SET BY 10, SETOMED BY 11) + + ;407 NOT USED + +DTETYI==410 ;TELETYPE INPUT + ;LH=LINE#, RH=CHAR RECEIVED. (SET BY 11, SETOM'ED BY 10) + +DTEODN==411 ;TELETYPE OUTPUT DONE + ;LH=LINE#, RH=BUFFER SIZE. (SET BY 11, SETOM'ED BY 10) + +DTEHNG==412 ;HANGUP/DIALIN WORD (SET BY 11, SETOM'ED BY 10) + ;0000NN - LINE # NN HUNG UP + ;01RTNN - LINE # NN HAS SPEED RCV=R, XMT=T (SEE TTYTYP FOR CODES) + +;^ ADD MORE HERE, NOT TO EXCEED LOCATION 437 + ;.IFNZ DTE20P + +;IOELEVEN RESIDES IN THE BOTTOM 14K OF THE CONSOLE PDP11, ALONG WITH 11DDT. +;I.E. LOCATIONS 0-70000. BE SURE TO USE .;11DDT 14K VERSION OF DDT. +;THE UPPER 14K CONTAIN KLDCP. THE FOLLOWING CALLS TO KLDCP ARE USED. +;THEY RETURN WITH C-BIT SET IF THEY LOSE (MICROCODE HUNG). + +;NOTE: KLDCP ENJOYS CLOBBERING REGISTER 0 (A). I DON'T +;KNOW IF ALL THESE CALLS DO, BUT WE'LL ASSUME THAT THEY DO. + +TENSW=EMT!145 ;UPDATE LOCATION DTESWR FROM THE SWITCHES + +EXAM=EMT!103 ;EXAMINE PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 BYTES CONTAINING PDP10 ADDRESS (LOW BITS FIRST) + ;AFTER CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS (LOW BITS FIRST) + +EXAMT=EMT!104 ;EXAMINE PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +DPOS=EMT!105 ;DEPOSIT PDP10 MEMORY + ;BEFORE CALL, REGISTER A HAS ADDRESS OF 3 WORDS CONTAINING CONTENTS + ;AND REGISTER B HAS ADDRESS OF 3 BYTES CONTAINING ADDRESS + +DPOST=EMT!106 ;DEPOSIT PDP10 MEMORY + ;.WORD PDP10-ADDRESS + ;.WORD ADDRESS OF 3-WORD DATA BLOCK + +D10MON=EMT!111 ;DEPOSIT PDP10 MEMORY, -1 + ;.WORD PDP10-ADDRESS + +$PMSG=EMT!25 ;PRINT MESSAGE ON TTY + ;.WORD ADDRESS OF ASCIZ MESSAGE + +$CNTLC=100004 ;JUMP HERE TO "CONTROL C" BACK TO KLDCP + +;WHEN KLDCP IS IDLE, AND IN "ITS MODE", IT DOES JSR PC,3000 +;WHICH CALLS IOELEVEN'S MAIN PROGRAM. RETURN WITH "C" SET +;TO READ AND EXECUTE ONE KLDCP COMMAND LINE. RETURN WITH "C" +;CLEAR TO PRINT KL10 HALTED OR CLOCK ERROR STOP MESSAGE. +;LOCATIONS 3004, 3006 MUST CONTAIN .RAD50/IOELEV/ +;IOELEV WILL RUN ON KLDCP'S STACK. + ;.IFNZ DTE20P +;INFORMATION ABOUT THE DTE20. +;EXCEPT FOR BYTE TRANSFER, WE USE THE TIME-TESTED SUBROUTINES PROVIDED BY KLDCP. + +;THE INTERRUPT VECTOR IS AT 774, BUT WE CAN'T USE IT BECAUSE WOULD HAVE +;TO COORDINATE THINGS WITH KLDCP, WHICH IS OBVIOUSLY IMPOSSIBLE. + +DLYCNT=174400 ;2.6-2.7 UNIBUS ADDRESS EXTENSION FOR BYTE TRANSFER DMA + ;1.1-2.5 14-BIT 2'S COMPLEMENT OF NUMBER OF HALF-MICROSECONDS + ; TO DELAY BETWEEN PI0 INTERRUPTS IN BYTE TRANSFER + +TO10AD=174420 ;ADDRESS (WORD OR BYTE) OF TO-10 BYTE TRANSFER DATA + +TO10BC=174414 ;1.1-2.3 NEGATIVE BYTE COUNT, 2.7 LAST XFER + ;NORMALLY SET BY 10 WITH DATAO DTE, + ;TO10 XFER STARTS WHEN BOTH TO10AD AND TO10BC HAVE BEEN LOADED + +TO11AD=174422 ;ADDRESS (WORD OR BYTE) OF TO-11 BYTE TRANSFER DATA + +TO11BC=174416 ;1.1-2.3 NEGATIVE BYTE COUNT FOR TO-11 BYTE TRANSFER + ;2.5=1 => TO-11 TRANSFER IS 8-BIT BYTES, =0 => 16-BIT WORDS + ;2.6=1 => "ASCIZ" MODE (WHICH WE DON'T USE, OF COURSE) + ;2.7=1 => LAST XFER, UPON COMPLETION INTERRUPT BOTH 10 AND 11 + ; =0 => ONLY INTERRUPT 11. 11 CAN CHANGE TO11AD, TO11BC, CONTINUE. + ;TO11 XFER STARTS WHEN BOTH TO11AD AND TO11BC HAVE BEEN LOADED + ;THE TRANSFER HAPPENS USING DMA (NPR) IN 11, PI LEVEL 0 IN 10. + +STATUS=174434 ;DTE20 STATUS REGISTER + ;READS: + %STDNI==100000 ;2.7 TO10 XFER DONE WITHOUT ERROR + %STERI==20000 ;2.5 TO10 XFER ABORTED BY ERROR + ;2.4 DATA OUT OF DTE RAM IS ALL ZERO (MAINT) + %STINV==4000 ;2.3 PDP10 IS INTERRUPTING PDP11 + ;2.2 DEPOST OR EXAMINE WORD ONE (MAINT) + ;2.1 PDP11 MEMORY PARITY ERROR IN TO10 XFER + ;1.9 PDP11 IS INTERRUPTING PDP10 + %STDNO==200 ;1.8 TO11 XFER DONE WITHOUT ERROR + ;1.7 E BUFFER SELECT (MAINT) + ;1.6 TO11 XFER STOPPED DUE TO ZERO BYTE (IN ASCIZ MODE) + ;1.5 TO11 XFER OR PDP10 EXAMINE ENCOUNTERED EBUS PARITY ERROR + ;1.4 1 => RESTRICTED MODE + ;1.3 0 => EXAMINE/DEPOSIT IN PROGRESS, 1 => DONE + %STERO==2 ;1.2 TO11 XFER ABORTED BY ERROR + ;1.1 1 => DTE ENABLED TO INTERRUPT PDP11 + ;WRITES: + %STCLI==51000 ;2.6+2.4+2.1 CLEAR TO10 XFER DONE AND ERROR FLAGS + %STUNV==2000 ;2.2 CLEAR PDP10 INTERRUPTING PDP11 + %STINX==400 ;1.9 SET PDP11 INTERRUPTING PDP10 + %STCLO==121 ;1.7+1.5+1.1 CLEAR TO11 XFER DONE AND ERROR FLAGS + ;1.6 ENABLE INTERRUPTS + ;1.4 DISABLE INTERRUPTS + +DIAG1=174430 ;DIAGNOSTIC WORD 1, INCLUDES FLAGS + %D1ERR==4000 ;2.3 KL10 CLOCK ERROR STOP + %D1RUN==2000 ;2.2 KL10 RUN INDICATOR (1 IF 11 WANTS 10 TO RUN) + %D1HLT==1000 ;2.1 KL10 HALT INDICATOR (1 IF 10 DOES A JRST 4) + +DIAG3=174436 ;DIAGNOSTIC WORD 3, INCLUDES FLAGS + %D3BYT==1 ;1.1 WRITING 0 SETS TO10 XFER IN WORD MODE, 1 BYTE MODE + ;THERE'S NOTHING ELSE OF THE SLIGHTEST USE IN THIS REGISTER, + ;SO IT'S OK TO WRITE IT AT ANY TIME. +.ENDC ;DTE20P + + .SBTTL LOW CORE + +.IFZ DTE20P ;IF USING DTE20, THESE ARE SET UP BY KLDCP +.=4 + TRAP4 + 340 + TRAP10 + 340 +; TRAP14 ;SET UP BY 11DDT +; 340 +.=20 + TRAP10 ;IOT + 340 + PWRFAL + 340 + TRAP10 ;EMT + 340 + TRAP10 ;TRAP + 340 +.ENDC ;DTE20P + +;CHAOS NET INTERRUPT VECTORS ARE UNFORTUNATELY NOT IN A REASONABLE ARRAY +.IFGE CHAOSP-1 +.=270 + .WORD CHS0BK,5_5 + ;274 IS INTERVAL TIMER +.ENDC ;CHAOSP-1 +.IFGE CHAOSP-2 +.=230 + .WORD CHS1BK,5_5 + ;234 IS INTERVAL TIMER +.ENDC ;CHAOSP-2 +.IFGE CHAOSP-3 +.=240 + .WORD CHS2BK,5_5 + ;244 IS INTERVAL TIMER +.ENDC ;CHAOSP-3 +.IFGE CHAOSP-4 + .ERROR WHERE DOES THE FOURTH CHAOSNET INTERRUPT VECTOR GO? +.ENDC ;CHAOSP-4 + +.IFNZ ETHERP +.=400 + ETHOBK + 5_5 + ETHIBK + 5_5 + ETHOBK ;COLLISION + 5_5 +.ENDC ;ETHERP + +.IFNZ T300P +.=254 + DSKBRK + 240 ;BR5 +.ENDC ;T300P + +.=300 +.REPT NDMS ;DM11s go in floating vectors +CONC DM,\.RPCNT+1,BRK + 240 ;INTERRUPTS ON BR4 BUT WE MASK TO BR5 ANYWAY +.ENDR ;NDMS + +.IFNZ NDLS +.=60 + DL1IBK ;FIRST DL11 LINE IS PDP11'S CONSOLE TTY, DIFFERENT ADDRESS + 240 ;AGAIN INTERRUPTS ON BR4 BUT MASK TO BR5 SO CAN USE DH11 ROUTINES W/O FEAR + DL1OBK + 240 +.ENDC ;NDLS +.=310 +.REPT NDLS-1 ;DL11S AFTER THE FIRST ARE IN FLOATING VECTORS +CONC DL,\.RPCNT+2,IBK + 240 +CONC DL,\.RPCNT+2,OBK + 240 +.ENDR + +.=DHIBAS ;DON'T RELY ON RANDOM FLOATING VECTOR TO + ;COME OUT RIGHT, E.G. IF THERE IS A DL11 + ;THERE WHICH WE AREN'T USING. +.REPT NDHS ;DH11S ARE IN FLOATING VECTOR AFTER DL11[E]S +CONC DH,\.RPCNT+1,IBK ;DH11 #n RECEIVE + 240 +CONC DH,\.RPCNT+1,OBK ;DH11 #n TRANSMIT & ERROR + 240 +.ENDR ;NDHS +.=100 + CLKBRK ;KW11-L 60-CYCLE CLOCK + 300 ;ON BR6 + +.IFNZ GOULDP +.=174 + GLPBRK + 300 ;BR5 BUT NEED TO LOCK OUT CLOCK SO MASK 6 +.ENDC ;GOULDP + +.IFG NMPTYS +.=56 +MPXENB::0 ;NONZERO TO ENABLE MULTISCHLUNKER +.ENDC + +.IFZ DTE20P ;IF DTE20, KLDCP SUPPLIES THE STACK +.=1000 +STKBAS:: + JMP INIT ;START AT 1000 IS CONVENTIONAL +.IFF ;DTE20P +.=3000 ;ENTRY VECTOR + JMP @#INIT +SADR=.-2 ;ARG OF THE JMP@# IS CHANGED AFTER INITIALIZATION + .RAD50 /IOELEV/ +.ENDC ;DTE20P + + .SBTTL TEN-11 CHAOSNET COMMUNICATION AREA + +.IFNZ TEN11P +T11BFL==8+<2*PKTMXW> ;BYTE LENGTH OF A PACKET BUFFER + ;FIRST 8 BYTES ARE BUFFER-FULL FLAG AND CKSM +.IIF NE T11BFL-<*4>, .ERROR T11BFL NOT MULTIPLE OF 4 + +.IIF NE .-1004, .ERROR CHAOSNET TEN-11 COMMUNICATION AREA NOT AT RIGHT ADDRESS + +;THIS AREA IS SHARED WITH THE PDP10 VIA TEN-11 INTERFACE. + + .WORD "CH,1 ;ERROR CHECK AND VERSION NUMBER +T11I10: .WORD 0,0 ;SET NON-ZERO BY 11 TO REINITIALIZE 10 +T11I11: .WORD 0,0 ;SET NON-ZERO BY 10 TO REINITIALIZE 11 + .WORD T11BFL,NT11BF ;BUFFER SIZE, NUMBER OF BUFFERS + .BLKW 8 ;SPARE WORDS +T11OBF: .BLKB T11BFL*NT11BF ;TO-10 BUFFERS + T11OBE==. ;END OF TO-10 BUFFERS +T11IBF: .BLKB T11BFL*NT11BF ;FROM-10 BUFFERS + T11IBE==. ;END OF FROM-10 BUFFERS +;THE FIRST 32-BIT WORD OF A BUFFER IS 0 IF IDLE, OR +;NON-ZERO IF BUFFER IS TO BE SENT TO OTHER MACHINE. +;THE SECOND 32-BIT WORD IS THE CHECKSUM, WHICH IS +;COMPUTED BY ADDING ALL THE 32-BIT WORDS, IGNORING OVERFLOW, +; AND LOGICALLY SHIFTING RIGHT ONE BIT AFTER EACH ADD; BITS SHIFTED +; OUT ON THE RIGHT ARE BROUGHT BACK IN ON THE LEFT. +;IF THE NUMBER OF 16-BIT WORDS IS ODD, THE LEFT-OVER ONE BETTER BE 0. +.ENDC ;TEN11P + + .SBTTL CONFIGURATION + +; TABLES INDEXED BY H (PER HARDWARE UNIT) + +.MACRO DHTE AD ;DH11 REGISTER ADDRESS GENERATOR +.REPT NDHS + +<20*.RPCNT> +.ENDR +.ENDM + +.MACRO DLTE AD ;DL11 REGISTER ADDRESS GENERATOR, FIRST IS WIERD +.IFNZ NDLS + 177560+<&7> +.REPT NDLS-1 + +<10*.RPCNT> +.ENDR +.ENDC ;NDLS +.ENDM + +.MACRO DMTE AD ;DM11 register address generator + .REPT NDMS + +<10*.RPCNT> ;a DM11 eats 8 locations + .ENDR +.ENDM + +DMCSR: DMTE 170500 ;first DM11 is at 170500 + +DMLSR: DMTE 170502 ;selected line status at 170502 + +DHSCR: DHTE DHCBAS ;SYSTEM CONTROL REGISTER + ;1.1-1.4 LINE NUMBER + ;1.5-1.6 MEMORY ADDRESS EXTENSION + DHRENB==100 ;1.7 RECEIVER INTERRUPT ENABLE + ;1.8 RECEIVER INTERRUPT + ;1.9 CLEAR NXM FLAG + ;2.1 MAINTENANCE MODE + DHSNXM==2000 ;2.2 NXM FLAG (GENERATES XMT INTERRUPT) + ;2.3 MASTER CLEAR + DHSENB==10000 ;2.4 STORAGE SILO FULL INTERRUPT ENABLE + DHTENB==20000 ;2.5 TRANSMITTER & NXM INTERRUPT ENABLE + ;2.6 STOARGE FULL INTERRUPT + DHTDON==100000 ;2.7 TRANSMITTER DONE INTERRUPT + +DLKS==DHSCR + DLTE 175610 ;KEYBOARD STATUS REGISTER + ;1.1 PAPER TAPE READER ENABLE (WO) + ;1.2 DATA TERMINAL READY (RW) + ;1.3 REQUEST TO SEND (RW) + ;1.4 SECONDARY TRANSMIT DATA [OR MAKE BUSY] (RW) + ;1.5 UNUSED + ;1.6 DATASET INTERRUPT ENABLE (RW) + ;1.7 RECEIVE INTERRUPT ENABLE (RW) + ;1.8 RECEIVE DATA READY (RO) + ;1.9 UNUSED + ;2.1 UNUSED + ;2.2 SECONDARY RECEIVE DATA (RO) + ;2.3 RECEIVE ACTIVE (RO) + ;2.4 CARRIER DETECT (RO) + ;2.5 CLEAR TO SEND (RO) + ;2.6 RING INDICATOR (RO) + ;2.7 DATASET STATUS CHANGE (RO) + +DHNRC: DHTE DHCBAS+2 ;NEXT RECEIVED CHARACTER + ;1.1-1.8 THE CHARACTER + ;1.9-2.3 LINE NUMBER + %DXPAR==10000 ;2.4 CHAR HAS WRONG PARITY + %DXBRK==20000 ;2.5 FRAMING ERROR (BREAK) + %DXOVR==40000 ;2.6 OVERRUN, PREVIOUS CHARS LOST + ;2.7 1 => THIS WORD VALID +DLKB==DHNRC + DLTE 175612 ;KEYBOARD INPUT REGISTER + ;1.1-1.8 RECEIVED DATA + ;2.4 PARITY ERROR (RO) + ;2.5 FRAMING ERROR (RO) + ;2.6 OVERRUN (RO) + ;2.7 OR OF ERROR BITS (RO) + +DHLPR: DHTE DHCBAS+4 ;LINE PARAMETER REGISTER + ;1.1-1.2 CHARACTER LENGTH 0=5, 1=6, 2=7, 3=8 (PARITY BIT EXTRA) + ;1.3 1 => EXTRA STOP BIT + ;1.5 ENABLE PARITY + ;1.6 0 -> EVEN PARITY, 1 => ODD + ;1.7-2.1 RECEIVER SPEED + ; 0 OFF, 1 50, 2 75, 3 110, 4 134.5, 5 150, 6 200, 7 300 + ; 10 600, 11 1200, 12 1800, 13 2400, 14 4800, 15 9600, 16 A, 17 B + ;2.2-2.5 TRANSMITTER SPEED, SAME CODES AS RECEIVER + ;2.6 HALF DUPLEX + ;2.7 ECHOPLEX + +DHCA: DHTE DHCBAS+6 ;CURRENT ADDRESS +DLCA==DHCA + .IREPT NDLS,0 + +DHBC: DHTE DHCBAS+10 ;BYTE COUNT (MINUS) +DLBC==DHBC + .IREPT NDLS,0 ;POSITIVE FOR DLS + +DHBAR: DHTE DHCBAS+12 ;BUFFER ACTIVE REGISTER + ;BIT = 1 IF XMT ACTIVE ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPS==DHBAR + DLTE 175614 ;PRINTER STATUS + ;1.1 SEND BREAK (RW) + ;1.3 LOOP BACK (RW) + ;1.6 INTERRUPT ENABLE (RW) + ;1.7 TRANSMITTER READY (RO) + +DHBCR: DHTE DHCBAS+14 ;BREAK CONTROL REGISTER + ;BIT = 1 => SEND BREAK ON CORRESP LINE, NUMBERED RIGHT TO LEFT +DLPB==DHBCR + DLTE 175616 ;PRINTER BUFFER + ;1.1-1.8 DATA TO TRANSMIT + +DHSSR: DHTE DHCBAS+16 ;SILO STATUS REGISTER + ;1.1-1.6 SILO ALARM LEVEL + ;1.7-1.8 READ EXTENDED ADDRESS (R.O.) + ;1.9-2.5 SILO FILL LEVEL (R.O.) + ;2.7 MAINTENANCE PATTERN (W.O.) + +DHOAC: .IREPT NDHS,0 ;BIT ON IF SOFTWARE THINKS LINE'S TRANSMITTER IS ACTIVE +DLOAC==DHOAC + .IREPT NDLS,0 ;NON-ZERO IF LINE'S TRANSMITTER IS ACTIVE + +DHTYNO: .IREPT NDHS, NFDHTY+<32.*.RPCNT> ;TTY INDEX OF FIRST LINE ON THIS DH11 +DLTYNO==DHTYNO +.IIF NZ CTYP,0 ;TTY INDEX OF LINE ON THIS DL11 +.IREPT NDLS-CTYP,NFDLTY+<2*.RPCNT> + +STROUT: .IREPT NDHS, STRDH ;OUTPUT-START ROUTINES + .IREPT NDLS, STRDL +.IIF NZ NMPTYS, STRMPK + + .BLKB NFTTY ;AVOID LABEL OVERLAPPAGE + +;TABLES INDEXED BY I (PER LINE) + +T HDWR: ;HARDWARE UNIT INDEX, GOES IN H +.IIF NZ CTYP, NFDLHX + .REPT NDHS + ZZ==.RPCNT*2 + .REPT 16. + ZZ ;16 LINES ON EACH DH-11 + .ENDR + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,NFDLHX+<2*.RPCNT>+<2*CTYP> +.IREPT NMPTYS, MPKHWR ;MULTIPLEXOR-KLUDGE TTYS + +T DHLSEL: ;DH11 LINE SELECT WORDS +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + DHTENB+DHRENB+.RPCNT + .ENDR + .ENDR + +T DHLBIT: ;BIT CORRESPONDING TO THIS LINE IN DHBAR, ETC. +.IIF NZ CTYP, 0 ;NONE FOR CTY + .REPT NDHS + .REPT 16. + 1_.RPCNT + .ENDR + .ENDR + +T BUFPNT: ;BUFFER POINTERS + .IREPT NCT, BUFFRS+<.RPCNT*MAXBSZ> + +T BUFSIZ: ;BUFFER SIZES (I.E. AMOUNT TO USE AT CURRENT SPEED) + .REPT NCT + 0 ;SET DURING INITIALIZATION + .ENDR + +T NRMIPC: ;NORMAL INPUT CHARACTER PROCESSING ROUTINES +.IIF NZ CTYP, RCV ;CTY NORMAL INPUT + .REPT 16.*NDHS + DHNRMI ;DH11 TTY NORMAL INPUT + .ENDR + .=.-<2*NDHUN> +.IREPT NDLS-CTYP,RCV ;DL11 NORMAL INPUT +.IREPT NMPTYS, RCV ;NORMAL INPUT FOR TTYS ON MULTIPLEXOR-KLUDGE +.IIF NE .-NRMIPC-NLTTY, .ERROR BARF AT NRMIPC +.IFNZ NMPTYS + .=NRMIPC+MPXIDX + MPXINP ;INPUT FROM THE MULTIPLEXED LINE IS SPECIAL + .=NRMIPC+NLTTY +.ENDC + +T TTYIPC: ;CURRENT INPUT CHAR PROCESSING ROUTINES + .BLKW NCT ;SET UP AT INIT TIME +.IIF NE .-TTYIPC-NLTTY, .ERROR BARF AT TTYIPC + +T AUTOSP: ;IF NON-ZERO, LINE GOES INTO AUTOSPEED WHEN DIALED UP + .REPT NCT ;IF MINUS ALSO WHEN BREAK SEEN + ZZ===. + ASPIRP ^\ + .IIF EQ .RPCNT+-N,+1 ;THIS LINE AUTOSPEED ON DIALUP + .IIF EQ .RPCNT++N,-1 ;ALSO ON BREAK + \ + .IIF EQ .-ZZ, 0 ;THIS LINE NOT AUTOSPEED + .ENDR +.IIF NE .-AUTOSP-NLTTY, .ERROR BARF AT AUTOSP + +.IFM MX +M2LMAP: ;MAP FROM DM11-BB CHANNEL NUMBERS TO TTY INDICES + 2*1 ;0 T01 + 0 ;1 NONE + 0 ;2 NONE + 2*4 ;3 T04 + 2*5 ;4 T05 + 2*6 ;5 T06 + 2*7 ;6 T07 + 2*10 ;7 T10 + 2*11 ;10 T11 + 2*12 ;11 T12 + 2*13 ;12 T13 + 2*14 ;13 T14 + 2*15 ;14 T15 + 2*16 ;15 T16 + 2*17 ;16 T17 + 0 ;17 NONE + 2*21 ;20 T21 + 2*22 ;21 T22 + 2*23 ;22 T23 + 2*24 ;23 T24 + 2*25 ;24 T25 + 2*26 ;25 T26 + 2*27 ;26 T27 + 2*30 ;27 T30 + 2*31 ;30 T31 + 2*32 ;31 T32 + 2*33 ;32 T33 + 2*34 ;33 T34 + 2*35 ;34 T35 + 2*36 ;35 T36 + 2*37 ;36 T37 + 2*40 ;37 T40 +.ENDC ;MX + +.IIF NE NDMS, .IIF NE .-M2LMAP-<40*NDMS>, .ERROR Too few M2LMAP entries for DM11s. + +.IFNZ NDMS + +T DIALED: ;0 IF LINE NOT DIALED UP (OR NO MODEM CONTROL ON THIS LINE) + .REPT NCT ;+ IF DIALED UP (CLEAR TO SEND IS ON) + 0 ;- IF CLEAR TO SEND DROPPED, INC EACH TICK, REACHES 0 => HUNG UP + .ENDR + +.ENDC ;NDMS + +T TTYHNG: ;DIALUP/HANGUP STATUS WAITING TO BE SENT TO 10 (0 IF NONE) + .REPT NCT + 0 + .ENDR + +T TYPING: ;POSITIVE IF LINE IS TYPING OUT FOR 10 + .REPT NCT ; WHICH MEANS -10 SHOULD BE INFORMED WHEN TYPEOUT IS FINISHED + 0 ;0 FOR NO -10 TYPEOUT, MINUS TO SEND AFTER TYPEOUT + .ENDR + +;MISC VARIABLES + +DLXOFF: -1 ;NON-ZERO IF DL10 PORT TURNED OFF BY 10 +NO.ITS: -1 ;NON-ZERO IF HAVEN'T ESTABLISHED COMMUNICATION WITH ITS YET +VERSN: .BYTE NFTTY/2,NCT ;I/O VERSION NUMBER +DMINI: 0 ;NON-ZERO => MODEM SCANNER JUST TURNED ON, GETTING INITIAL STS +WAKE: 0 ;CLOCK INTERRUPT WAKE UP MAIN PROGRAM FLAG +HNGSIG: 0 ;NUMBER OF NON-ZERO TTYHNG WORDS +10RQ: 0 ;LIGHT HACKS +LITHSE: 7 +.IFNZ DTE20P +CLKENB: 0 ;KL10 WANTS 11 TO RELAY CLOCK INTERRUPTS +KLDCPF: 0 ;NON-ZERO => USER WANTS TO GIVE A COMMAND TO KLDCP +DDTMOD: 0 ;NON-ZERO => DDT MODE TTY INPUT +DDTCHR: -1 ;NON-NEGATIVE => CHAR TYPED FOR DDT +CURSWR: 52525 ;LAST SWITCHES SENT TO -10 +OUTCMD: 0 ;0 IF OUTPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +OUTSVI: -1 ;LINE# OF CURRENT OUTPUT TRANSFER +OUTSVC: -1 ;#BYTES OF CURRENT OUTPUT TRANSFER +INPCMD: 0 ;0 IF INPUT TRANSFER IDLE + ;ELSE CURRENT COMMAND / 400 +INPSVI: -1 ;LINE# OF CURRENT INPUT TRANSFER +INPSVC: -1 ;#BYTES OF CURRENT INPUT TRANSFER +.ENDC ;DTE20P +.IFNZ NMPTYS +MPXOAC: 0 ;0 IDLE, -1 SENDING HEADER, 1 SENDING DATA +MPXOLN: 0 ;2 x MPXK# OUTPUTTING FOR +MPXSEL: NFMPTY ;TTY INDEX SELECTED FOR MPX INPUT +MPXPNT: .IREPT NMPTYS,0 ;POINTER TO CRUFT TO SEND TO EACH MPXED LINE +MPXNBT: .IREPT NMPTYS,0 ;# BYTES TO SEND, 0 IF IDLE +MPXHED: .BYTE 0,0 ;MPX OUTPUT HEADER: 200+MPXK#, BYTE COUNT +.ENDC ;NMPTYS + + .SBTTL CHAOSNET VARIABLES & TABLES + +.IFNZ CHAOSP + +NSUBNT==80. ;MAXIMUM CAPACITY 80. SUBNETS + +.IFNZ DL10P ;DL10 UNSHARED +DLCRBN: 0 ;CURRENT RECEIVE (11 to 10) BUFFER (0 OR 2) +DLCNXT: .WORD 2,0 ;FOR SWITCHING BUFFERS +DLCIBF: .BLKW PKMAX ;DL10 INPUT BUFFER +.ENDC ;DL10P + +.IFNZ TEN11P ;TEN11 UNSHARED +T11OBP: T11OBF ;NEXT BUFFER TO 10 +T11IBP: T11IBF ;NEXT BUFFER FROM 10 +T11IBA: 0 ;NON-ZERO MEANS INPUT BUFFER ACTIVE, T11IBP NEEDS ADVANCING + ;THIS IS SEPARATE FROM CHISTS+CHXT11 FOR GOOD REASONS +T11CKE: 0 ;COUNT OF TEN-11 CHECKSUM ERRORS +T11TIM: 0 ;TIMEOUT ON TRANSMISSION OF PACKET TO 10 +.ENDC ;TEN11P + +.IFNZ ETHERP +ETHSBN==2 ;SUBNET WHICH IS THE ETHERNET +.SEE ETHHSN ;MY HOST NUMBER BYTE (DEFINED IN MACHINE CONFIGURATION AREA) +ETHMXH==15.-1 ;MAXIMUM NUMBER OF HOPS (-1 => BUG IN XEROX PROGRAMS) +ETHIBF: .BLKW PKTMXW+1 ;INPUT FROM ETHERNET BUFFERED HERE (+1 HARDWARE BUG?) +ETHHDW==PKHDW-2 ;ALLOW FOR OVERLAP OF CHAOSNET HEADER AND 2-WORD ETHERNET HEADER + ;THIS IS THE OFFSET (IN WORDS) WHERE THE ETHERNET PACKET STARTS + +;HERE IS A PACKET USED TO BUILD THE ETHERNET BROADCAST GATEWAY INFO. WHAT A CROCK. +EGTBUF: .BLKW PKHDW ;SPACE FOR CHAOSNET HEADER +EGTPLN: 0 ;PUP LENGTH + 201 ;PUP TYPE 201 +EGTPID: .WORD 0,0 ;PUP IDENTIFIER + 0 ;DESTINATION (BROADCAST) + .WORD 0,2 ;DEST SOCKET 2 +EGTSRC: .BYTE ETHHSN,ETHSBN ;SOURCE (ME) + .WORD 0,2 ;SOURCE SOCKET 2 +EGTSBN: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + .BLKW 2*NSUBNT + 0 ;PUP CHECKSUM + +.IF DF NDVRBF +DVRHST: 0 ;ZERO IF IDLE, OR FOREIGN HOST USING +DVRIDX: 0 ;FOREIGN INDEX +DVRLIX: 0 ;LOCAL INDEX (AOS EACH TIME) +DVRTIM: 0 ;COUNTS UP TO IDLE THE FOREIGN HOST +DVRRTR: 0 ;COUNTS UP FOR RETRANSMISSION + +DVRBFL==2*+1> ;NUMBER OF BYTES IN A DOVER BUFFER (HOLDS PUP IN CHAOSNET PACKET) +DVRBUF: .BLKB DVRBFL*NDVRBF ;RING OF BUFFERS HERE +DVRBF2: .BLKW PKHDW+2 ;BUFFER FOR SENDING STS/OPN/CLS BACK (ALSO END OF RING) +DVRBFP: DVRBUF ;POINTER TO NEXT BUFFER TO GO OUT TO DOVER +DVRMSK: 0 ;MASK OF WHICH BUFFERS CONTAIN PACKETS (MSB = DVRBFP PKT) + .IIF GT NDVRBF-16., .ERROR NDVRBF MAXIMUM OF 16. ALLOWED +DVRPKP: 0 ;IF NON-ZERO, POINTER TO SPECIAL PACKET TO SEND +DVRID: 0 ;ID FOR NEXT PACKET EXPECTED BY DOVER, THIS PACKET IS OR + ; WILL BE IN THE BUFFER DVRBFP POINTS AT +DVROFS: 0 ;ID OFFSET, SUBTRACT FROM CHAOS ID TO GET PUP ID +NDVRFK: 0 ;*** TEMPORARY KLUDGE *** +.ENDC ;NDVRBF +.ENDC ;ETHERP + +PULSAR: 0 ;COUNTS DOWN TO 0 THEN TRIGGERS TRANSMISSION OF A "TEST MESSAGE" +PULSON: FTPULS ;IF THIS IS NON-ZERO, FEATURE IS ENABLED, VALUE IS TICKS BETWEEN PULSES +USECBL: 0 ;IF NON-ZERO, 10 TALKING TO SELF STILL GOES THROUGH CABLE + +NCHX==DL10P+TEN11P+CHAOSP+<2*ETHERP> ;NUMBER OF ENTRIES IN SOURCE AND SINK TABLES +.IIF DF NDVRBF, NCHX==NCHX+1 + +;METERS ETC. +.IFNZ FTGARB +CHSGBF: .BLKW PKMAX ;HOLDS LAST PACKET THAT CAME IN WITH A CHECKSUM ERROR +CHSGBH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE CAME IN ON +CHSGBS: 0 ;STATUS REGISTER THAT GOES WITH ABOVE +CHSGBC: 0 ;BIT COUNT THAT GOES WITH ABOVE +.ENDC ;FTGARB + +;FOLLOWING HAVE SEPARATE ENTRIES FOR EACH CABLE +NPKSGB: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RECEIVED WITH CHECKSUM ERRORS +HPKSGB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRL: .IREPT CHAOSP+ETHERP,0 ;COUNTS THE NUMBER OF PACKETS RAM LOST, + ; I.E. DIDN'T COME IN WITH A CHECKSUM ERROR BUT AFTER + ; READING IT OUT HAD ONE. EITHER THE PACKET WAS THE + ; WRONG LENGTH, OR THE RAM IS LOSING, OR HARDWARE + ; CLOBBERAGE. FOR ETHERNET IS PUP CKSM ERR COUNT + ;THIS WORD ALSO IS WHERE BIT COUNT ERRORS WOULD END UP +HPKSRL: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +CHSRLH: 0 ;UNIBUS ADDRESS OF INTERFACE THAT ABOVE LAST HAPPENED ON. +CHSRLC: 0 ;RESIDUAL BIT COUNT FOR ABOVE +NPKSLS: .IREPT CHAOSP,0 ;NUMBER OF PACKETS LOST ACCORDING TO LOSS COUNT IN HARDWARE +HPKSLS: .IREPT CHAOSP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSAB: .IREPT CHAOSP+ETHERP,0 ;NUMBER OF TRANSMISSIONS ABORTED (BY COLLISION OR RECEIVE-BUSY) +HPKSAB: .IREPT CHAOSP+ETHERP,0 ;HIGH-ORDER WORD OF COUNTER +NPKSI: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS IN ON EACH SOURCE +HPKSI: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSO: .IREPT NCHX,0 ;TOTAL NUMBER OF PACKETS OUT ON EACH SINK +HPKSO: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSIG: 0 ;NUMBER OF PACKETS IGNORED AT CHIFLS +NPKSBD: .IREPT NCHX,0 ;NUMBER OF PACKETS BAD AT CHSIHB +HPKSBD: .IREPT NCHX,0 ;HIGH-ORDER WORD OF COUNTER +NPKSRF: 0 ;NUMBER OF PACKETS FOR WHICH ROUTING FAILED +RFSBNT: -1 ;2* SUBNET# OF LAST ROUTING FAILURE + +;"INTERFACE ADDRESSES" +; A NEGATIVE INTERFACE ADDRESS IS THE UNIBUS ADDRESS OF A CHAOS INTERFACE. +; A ZERO INTERFACE ADDRESS MEANS THE DL10 +; A POSITIVE INTERFACE ADDRESS MEANS THE TEN-11, VALUE BETTER BE OCTAL 1011. + +CHSIBF: .BLKW PKMAX*CHAOSP ;INPUT BUFFER FOR PACKETS IN FROM CHAOS HDWR + +;THIS IS WHAT IS SENT BACK IN RESPONSE TO RFC TO "STATUS". +;FOR NOW, JUST THE NAME OF THE MACHINE. +HSTNAM: +.ENDC ;CHAOSP ;FUCK A DOG, PALX! +.IFM MX-DL + .ASCII \MX-IO/11\ +.ENDC +.IFM AI + .ASCII \AI-CHAOS-11\ +.ENDC +.IFNZ CHAOSP ;FUCK A DOG, PALX! +.IIF GE .-HSTNAM-32., .ERROR HSTNAM TOO LONG +.IREPT 32.-<.-HSTNAM>, .BYTE 0 ;PAD ON THE RIGHT WITH 0'S + +;CHAOSNET INPUT SOURCE AND OUTPUT SINK TABLES + + ;NOTE WELL, THE CODE RELIES ON THE ORDER OF THESE INDICES +.IIF NZ DL10P, CHXDLC==0 ;DL10 INDEX +.IIF NZ TEN11P, CHXT11==2*DL10P ;TEN11 INDEX +CHXCHS==2* ;FIRST CHAOS INDEX +.IIF NZ ETHERP, CHXETH==CHXCHS+<2*CHAOSP> ;ETHERNET INDEX +.IIF NZ ETHERP, CHXEGT==CHXETH+2 ;ETHERNET GATEWAY-INFO-BROADCAST KLUDGE INDEX +.IIF DF NDVRBF, CHXDVR==CHXEGT+2 ;DOVER PROTOCOL TRANSLATOR +.MACRO CHXCHK TAG +.IIF NE .-TAG-NCHX-NCHX, .ERROR TAG WRONG LENGTH TABLE +.ENDM CHXCHK + +;CHAOSNET INPUT SOURCE TABLES + +CHIBFP: ;BUFFER POINTER +.IIF NZ DL10P, DLCIBF ;DL10 INPUT BUFFER +.IIF NZ TEN11P, 0 ;CURRENT TEN11 INPUT BUFFER (SET FROM T11IBP+8) +.IREPT CHAOSP, CHSIBF+ ;CHAOS INPUT BUFFER +.IIF NZ ETHERP, ETHIBF ;ETHERNET +.IALSO EGTBUF ;.. +.IIF DF NDVRBF, 0 ;CURRENT DOVER BUFFER, COULD BE CHAOS OR PUP +CHXCHK CHIBFP + +CHIHDL: .IREPT NCHX, 0 ;LENGTH OF HEADER IN WORDS, PACKET CURRENTLY IN BFR + +CHISTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 HAS INPUT, -1 BEING OUTPUT) + +CHILNG: .IREPT NCHX, 0 ;LENGTH OF CONTAINED PACKET IN WORDS + +CHIOUX: .IREPT NCHX, 1 ;DESTINATION OUTPUT SINK INDEX (-1 IF DIRECTED TO PDP11 ITSELF) + +CHICBA: .IREPT NCHX, 0 ;DESTINATION CABLE ADDRESS + +CHIRFL: ;ADDRESS OF REFILL ROUTINE +.IIF NZ DL10P, DLCRFL +.IIF NZ TEN11P, T11RFL +.IREPT CHAOSP, CHSRFL +.IIF NZ ETHERP, ETHRFL ;ETHERNET +.IALSO CPOPJ ;.. +.IIF DF NDVRBF, DVRRFL +CHXCHK CHIRFL + +CHIHWR: ;POINTER TO HARDWARE +.IIF NZ DL10P, 1 ;NOT USED +.IIF NZ TEN11P, 3 ;NOT USED +.IREPT CHAOSP, CAICSR+<400*.RPCNT> ;QUAD-CHAOS INTERFACES HAVE TO BE 200 APART +.IIF NZ ETHERP, 164200 ;AND WE MAKE IT 400 BECAUSE ETHERNET GETS IN WAY +.IALSO 5 ;NOT USED +.IIF DF NDVRBF, 7 ;NOT USED + +;CHAOSNET OUTPUT SINK TABLES + +CHOHWR==CHIHWR ;POINTER TO HARDWARE + +CHOSTS: .IREPT NCHX, 0 ;STATUS (0 IDLE, +1 TRANSMITTING, -1 RETRANSMITTING + ; AFTER TRANS ABORT, +2 DELAYING AFTER TRANSMIT ABORT BEFORE RETRANSM) +CHOINX: .IREPT NCHX, 1 ;CURRENTLY-ACTIVE CHIxxx INDEX + +CHOXMT: ;START TRANSMISSION ROUTINE +.IIF NZ DL10P, DLCXMT +.IIF NZ TEN11P, T11XMT +.IREPT CHAOSP, CHSXMT +.IIF NZ ETHERP, ETHXMT ;ETHERNET +.IALSO 1 ;NOT USED (CHXEGT) +.IIF DF NDVRBF, DVRPKT ;DOVER +CHXCHK CHOXMT + +CHXSBN: ;SUBNET NUMBER +400 FOR STATUS SERVER +.IIF NZ DL10P, DLCADR/400+400 +.IIF NZ TEN11P, T11ADR/400+400 +.REPT CHAOSP + CONC CHAD,\.RPCNT,/400+400 +.ENDR ;CHAOSP +.IIF NZ ETHERP, ETHSBN+400 ;ETHERNET +.IALSO 776 ;NOT REAL (ETHERNET GATEWAY) +.IIF DF NDVRBF, 777 ;NOT REAL (DOVER) +CHXCHK CHXSBN + +CHXRTF: .IREPT NCHX, 0 ;NON-ZERO MEANS BROADCAST ROUTING INFO TO THIS GUY + +.IFNZ CHSBTB +CHSIDL: .IREPT NCHX, 0 ;NUMBER OF TICKS WAITING FOR TRANSMIT-DONE +CHSRST: .IREPT NCHX, 0 ;NUMBER OF TIMES HAD TO RESET HUNG INTERFACE +.ENDC ;CHSBTB + +;;; SUBNET/ROUTING TABLES + +;INDEX BY TWICE SUBNET NUMBER +SBNTYP: .IREPT NSUBNT, 0 ;TYPE OF CONNECTION TO THIS SUBNET: + ; 0 VIA GATEWAY, WITH AUTOMATIC ROUTING + ; -1 VIA GATEWAY, PATCHED IN BY HUMAN, DON'T CHANGE + ; 1 HARDWARE CONNECTION + +SBNADR: ;ADDRESS OF CONNECTION TO THIS SUBNET + ;NETWORK ADDRESS IF SBNTYP NEGATIVE OR ZERO + ;INDEX IN SOURCE/SINK TABLES IF SBNTYP GREATER THAN ZERO + 0 ;0 USED FOR UNKNOWN SUBNETS. WHEN IN DOUBT, BROADCAST. + 0 ;1 9TH FLOOR CABLE + 0 ;2 (NOT CURRENTLY USED) + 440 ;3 MX, ASSUME VIA MX-IO-11 + 426 ;4 AI, ASSUME VIA AI-CHAOS-11 + .IREPT NSUBNT-5, 0 ; WHEN IN DOUBT, BROADCAST + +SBNCST: .IREPT NSUBNT, 1000 ;COST OF ROUTING VIA CURRENT GATEWAY, SEE CHAORD + +;NOW FILL IN TABLES FOR HARDWARE CONNECTIONS THAT EXIST ON THIS MACHINE +;INCLUDING TRANSFINITE HAIR FOR ETHERNET GATEWAY INFO PACKET +ZZ==. +.IFNZ DL10P +DLCSBN==DLCADR/400 ;SUBNET PDP10 ON OTHER END OF DL10 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXDLC +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;DL10P +.IFNZ TEN11P +T11SBN==T11ADR/400 ;SUBNET PDP10 ON OTHER END OF TEN11 IS ON +.=SBNTYP+ + 1 +.=SBNADR+ + CHXT11 +.=SBNCST+ + 10. ;DIRECT 10/11 CONNECTION COSTS 10. +.ENDC ;TEN11P +.ENDC ;CHAOSP + +.IFM MX-DL + CBLCST=11. ;CABLE CONNECTION COSTS 11. +.ENDC +.IFM AI + CBLCST=22. ;AI COSTS MORE 'CAUSE IT'S SICK +.ENDC + +.IFNZ CHAOSP ;sweet fucking jesus, palx +;HAIR FOR MULTIPLE CABLE INTERFACES +.REPT CHAOSP + CONC IZZZ==CHAD,\.RPCNT + IZZ==*2 + .=SBNTYP+IZZ + 1 + .=SBNADR+IZZ + CHXCHS+<.RPCNT*2> + .=SBNCST+IZZ + CBLCST ;THE CABLE COST +.ENDR ;CHAOSP + +.IFNZ ETHERP +.=SBNTYP+ + 1 +.=SBNADR+ + CHXETH +.=SBNCST+ + 11. +.ENDC ;ETHERP + +.=ZZ + +;;; CLOCKS +4SEC: 0 ;4-SECOND CLOCK COUNTER +15SEC: 0 ;15-SECOND CLOCK COUNTER + +.ENDC ;CHAOSP + +;PATCH AREA + +PAT: PATCH: .BLKW 100 + + .SBTTL RING BUFFERS + +.MACRO RING SIZE + 99$ ;IN-POINTER + 99$ ;OUT-POINTER + 0 ;NUMBER OF WORDS IN RING + ;MAX NUMBER ALLOWED + <2*>+99$ ;MAX ADDRESS ALLOWED + 99$ ;MIN ADDRESS ALLOWED +99$: .BLKW ;BUFFER +.ENDM + +RINGIN==0 +RINGOT==2 +RINGCT==4 +RINGSZ==6 +RINGTP==10 +RINGBT==12 +RINGBF==14 + +; DEFINE THE RING BUFFERS + +TYORNG: RING ;OUTPUT-DONE RING, CONTENTS = LINE NUMBER PDP10 STYLE + ;HAS TO BE EXTRA BIG BECAUSE THE OUTPUT DONES PUT IN ON + ;STARTUP FILL IT UP, THEN SOMETIMES ITS PUTS ONE IN + ;BEFORE IT TAKES ANY OUT. + +TYIRSZ==NCT*20 ;8 CHARS PER TTY (2 WORDS PER CHAR) +TYIRNG: RING TYIRSZ ;TTY INPUT RING, FIRST WORD IS CHARACTER, SECOND LINE NUMBER + + + +;MOV #RING,B +;MOV WORD,A +;CALL PUT + +PUT: CMP RINGCT(B),RINGSZ(B) + BLT 1$ + BPT ;BLOATED +1$: PUSH C + MOV RINGIN(B),C + MOV A,(C)+ + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGIN(B) + POP C + INC RINGCT(B) + RET + +;MOV #RING,B +;CALL GET +;WORD RETURNED IN A +; IT IS AN ERROR TO CALL THIS IF RING IS EMPTY + +GET: TST RINGCT(B) + BGT 1$ + BPT ;EMPTY +1$: PUSH C + MOV RINGOT(B),C + MOV (C)+,A + CMP C,RINGTP(B) + BLO 2$ + MOV RINGBT(B),C +2$: MOV C,RINGOT(B) + POP C + DEC RINGCT(B) + RET + +CLRING: CLR RINGCT(B) ;CLEAR A RING + MOV RINGBT(B),RINGIN(B) + MOV RINGBT(B),RINGOT(B) + RET + .IFNZ DTE20P + .SBTTL DTE20 SUBROUTINES + +;THE DTE20 MUST NOT BE HACKED AT INTERRUPT LEVEL, BECAUSE KLDCP USES IT TOO. +;THE FOLLOWING THREE LOCATIONS ARE ARGS TO/FROM THE FOLLOWING TWO SUBROUTINES. + +LH: 0 ;LOW 16 BITS OF LEFT HALF +RH: 0 ;LOW 16 BITS OF RIGHT HALF +SNB: 0 ;SIGN BIT (0 IF +, NON-0 IF -) + +;JSR B,HWEXAM +; .WORD ADDR +;EXAMINE PDP10 LOC, SPLIT INTO HALFWORDS, SET LH, RH, SNB +;RETURNS WITH "Z" SET IF LOCATION HAS POSITIVE SIGN, "Z" CLEAR IF MINUS SIGN + +HWEXAM: PUSH ;SAVE REGS + PUSH <#0,(B)+> ;PUT PDP10 ADDRESS ONTO PDL + MOV SP,A ;SET UP POINTER TO ADDRESS + EXAM ;EXAMINE LOCATION, SET A TO POINT TO 3-WORD RESULT BUFFER + BCS UHUNG ;BRANCH IF UCODE HUNG + MOV (A)+,RH ;LOW 16 BITS => RH + MOV (A)+,C ;PICK UP MIDDLE 16 BITS + MOV (A)+,A ;PICK UP HIGH 4 BITS + ROR A ;LSHC ,-2 TO GET PDP10 LH INTO C + ROR C + ROR A + ROR C + MOV C,LH + BIC #177775,A ;LEAVE SIGN BIT IN 1.2 OF A + MOV A,SNB + ADD #4,SP ;POP ADDRESS OFF PDL + POP ;RESTORE REGS + TST SNB + RTS B ;RETURN SKIPPING IN-LINE PARAMETER + +;JSR B,HWDEP +; .WORD ADDR +;ASSEMBLE LH, RH, SNB INTO PDP10 AND DEPOSIT IN ADDR + +HWDEP: PUSH + MOV LH,C + CLR A + TST SNB + BEQ 1$ + MOV #2,A +1$: ASL C + ROL A + ASL C + ROL A + PUSH ;PUSH HIGH, MIDDLE, AND LOW BITS + MOV SP,A ;POINTER TO DATA + PUSH <#0,(B)> ;PUSH HIGH AND LOW ADDRESS + MOV SP,B ;POINTER TO ADDRESS + DPOS ;DO THE DEPOSIT + BCS UHUNG ;BRANCH IF UCODE HUNG + ADD #10.,SP ;POP ADDRESS AND DATA OFF PDL + POP + TST (B)+ ;SKIP TRAILING PARAMETER + RTS B + +UHUNG: $PMSG + .WORD 1$ + SETOM NO.ITS ;GIVING UP + JMP $CNTLC + +1$: .ASCIZ/?MICROCODE HUNG/ + +.ENDC ;DTE20P + .IFNZ DL10P + .SBTTL MAIN LOOP FOR DL10 + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + BIT #DLXPRT,DLXCSR ;PORT TO 10 ENABLED? + BNE 1$ ;YES + SETOM NO.ITS ;NO, FLAG THERE IS NO ITS + SETOM DLXOFF ;AND THAT WE THINK DL10 PORT IS OFF + BR MAIN ;AND WAIT FOR IT TO TURN ON + +1$: TST DLXOFF ;DID DL10 JUST TURN ON? + BEQ 4$ ;NO, IT WAS ON BEFORE + CLR DLXOFF ;YES, SO REMEMBER THAT + MOV VERS,A ;CHECK VERSION SUPPLIED BY -10 + BEQ 2$ ;ZERO OK (MUST BE SALVAGER) + CMP A,VERSN + BEQ 2$ + BPT ;-10 AND -11 PROGRAMS NOT SAME CONFIG +2$: + +4$: BIT #DLXPAR+DLXNXM,DLXCSR ;ERROR ACCESSING MEMORY? + BEQ 5$ ;NO + BPT ;DON'T GO OFF DESTROYING PEOPLE'S FILES + +;WAIT FOR -10 TO REQUEST SERVICE, OR CLOCK TO TICK + +5$: CLR 10RQ + BIT #DLX11I,DLXCSR ;10 REQUESTING SERVICE? + BEQ 10$ + SETOM 10RQ + BIS #DLXZ11,DLXCSR ;YES, CLEAR FLAG + BR CHKOST ;AND GO CHECK FOR THINGS TO DO + +10$: TST WAKE ;NO, CHECK ANYWAY IF 60 CYCLE CLOCK HAS TICKED + BEQ MAIN ;NEITHER, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + INC DLXUP ;AND INCREMENT COUNTER 10 IS SUPPOSED + BEQ 11$ ; TO SETOM EVERY 1/2 SEC + CMP DLXUP,#15.*60. ;IF IT DOESN'T TOUCH IT FOR 15 SECONDS, + BLE 12$ ; CONSIDER IT DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ; THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS + MOV #15.*60.,DLXUP ;DON'T LET COUNTER OVERFLOW + BR 12$ ;BUT CHECK FOR COMMANDS ANYWAY (SALVAGER DISK) + +11$: CLR NO.ITS ;-10 HAS SETOMED COUNTER, IT'S UP +12$: ;FALL INTO CHKOST + +; CHECK FOR OUTPUT-START FROM -10 + +CHKOST: MOV TTYST,A ;LINE# TO START OUTPUT + BEQ CHKOUT ;NONE. + CLR TTYST ;TELL -10 IT'S BEEN PICKED UP + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT ;PUT IN RING, LATER WILL SEND IT BACK TO 10 + UNMASK + +; CHECK FOR TTY OUTPUT SENT BY -10 + +CHKOUT: MOV TYOLIN,I ;OUTPUT TO BE DONE? + BEQ CHKIN ;NO. + MOV TYOCNT,C ;YES, GET NUMBER OF CHARS + CALL TYOSER ;CALL OUTPUT HANDLER + CLR TYOLIN ;TELL 10 WE'VE GOBBLED THE OUTPUT + BIS #DLX10I,DLXCSR ;GIVE TRANSFER-COMPLETE INTERRUPT + +; CHECK FOR TTY INPUT TO BE SENT TO -10 + +CHKIN: TST TYIRNG+RINGCT + BEQ CHKDON ;NO STATUS TO BE STORED + TST TYILIN + BNE CHKDON ;PREVIOUS STATUS NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,TYICHR ;GIVE INPUT CHARACTER TO 10 + CALL GET + MOV A,TYILIN ;GIVE LINE NUMBER TO 10 + BIS #DLX10I,DLXCSR ;SEND INTERRUPT TO 10 + +; CHECK FOR OUTPUT-DONE TO BE SENT TO -10 + +CHKDON: TST TYORNG+RINGCT + BEQ CHKHNG ;NO STATUS TO BE STORED + TST TYOSTS + BNE CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET + MOV A,I + ASL I + MOV BUFSIZ(I),TYOBSZ ;TELL -10 HOW MANY CHARS TO GIVE + MOV A,TYOSTS ;GIVE OUTPUT DONE TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR HANGUPS TO BE SENT TO -10 + +CHKHNG: TST HNGSIG ;ANY HANGUPS TO BE REPORTED? + BEQ CHKLPR ;NO + TST HNGLIN + BNE CHKLPR ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,HNGLIN ;GIVE LINE NUMBER AND OTHER DATA TO 10 + BIS #DLX10I,DLXCSR ;WITH INTERRUPT + +; CHECK FOR REQUEST FROM -10 TO SET LINE PARAMETERS + +CHKLPR: MOV LPRLIN,I ;LINE PARAMETERS TO BE SET? + BEQ CHKCHS ;NO. + ASL I ;YES, GET LINE INDEX + MOV LPRLPR,A ;AND DH11 PARAMETER REGISTER VALUE + MOV LPRBSZ,B ;AND BUFFER SIZE + CALL SPARAM ;CALL PARAMETER SETTER + CLR LPRLIN ;TELL 10 IT IS DONE + +; CHECK FOR CHAOS NET ACTIVITY + +CHKCHS: +.IFNZ CHAOSP + CALL DLCWAK ;WAKEUP DL10-CHAOSNET STUFF +.ENDC ;CHAOSP +.IFNZ T300P + CALL DSKSTR ;CHECK FOR DISK REQUEST +.ENDC ;T300P + +; CHECK FOR EXAMINE/DEPOSIT REQUEST FROM -10 + +CHKEXD: TST EXDSTS ;EXAMINE/DEPOSIT? + BEQ CHKGLD ;NO. + MOV EXDADR,A ;GET ADDRESS + CMP EXDSTS,#2 + BNE 21$ + MOV EXDDAT,(A) ;DEPOSIT +21$: MOV (A),EXDDAT ;EXAMINE + CLR EXDSTS ;IT IS DONE + +;CHECK FOR GOULD LPT OUTPUT + +CHKGLD: +.IF EQ GOULDP +; CLR GLPCTR ;IF NO GOULD, FLUSH OUTPUT FOR IT +; SETOM GLPTER ;AND SAY "NOT READY" + TST 10RQ + BEQ 20$ + ;10 WANTED US TO DO SOMETHING, PLAY WITH THE LIGHTS + MOV LITHSE,A + ROL A + ROL LITHSE +20$: MOV LITHSE,GLPTER +.IFF + TST GLPCTR ;ANY BYTES IN BUFFER? + BEQ 1$ + CALL GLPTYO ;YES, OUTPUT THEM +1$: MOV GLPERR,GLPTER ;COPY ERROR STATUS FROM P.I. LEVEL TO -10 +.ENDC ;DONE HERE SO NO USE OF DL10 AT P.I. LEVEL +; BR MAINX + +MAINX: JMP MAIN ;THAT'S IT +MAINE:: +.ENDC ;DL10P + .IFNZ DTE20P + .SBTTL MAIN LOOP FOR DTE20 + +MAIN: BIT #%D1RUN,DIAG1 ;IS KL10 RUNNING? + BEQ TENDED ;NO, LOSE! + BIT #%D1ERR+%D1HLT,DIAG1 ;HAS KL10 CLOCK STOPPED FOR HARDWARE ERROR? OR JRST 4 + BNE TENDED ;YES, LOSE! + TST KLDCPF ;MAYBE USER WANTS TO GIVE A KLDCP COMMAND? + BNE KLDCPR ;YES, RETURN TO KLDCP + TSTB @DLKS+NFDLHX ;CTY INPUT? + BPL 10$ ;TEST KBD BEFORE CLK SINCE MIGHT BE MORE THAN + ; 1/60'TH SECOND PER TRIP AROUND THE LOOP. + MASK 5 ;YES, SIMULATE INTERRUPT + CALL DL1IBK ;CAN'T USE REAL INTS BECAUSE WOULD INTERFERE WITH KLDCP +10$: TSTB LKS ;60 CYCLE CLOCK TICK? + BMI CLKSER ;YES + BIT #%STINV,STATUS ;REQUEST FROM 10? + BNE TENSER ;YES, SERVICE IT. + BIT #%STDNI,STATUS ;TO10 XFER COMPLETE? + BNE INPDON ;YES, SERVICE IT. + BIT #%STDNO,STATUS ;TO11 XFER COMPLETE? + BNE OUTDON ;YES, SERVICE IT. + BIT #%STERI+%STERO,STATUS + BNE LOSSAG ;BYTE TRANSFER LOST + BR MAIN ;CLOSE LOOP + +;60-CYCLE CLOCK SERVICE + +CLKSER: CLR LKS ;CLEAR CLOCK FLAG + TST CLKENB ;DOES 10 WANT CLOCK INTERRUPTS? + BEQ 1$ + D10MON ;YES, GIVE ONE + DTECLK ;SET CLOCK FLAG IN LOW CORE + BCS UHUNG + MOV #%STINX,STATUS ;AND SEND INTERRUPT +1$: CMP SWR,CURSWR ;MAYBE NEED TO UPDATE 10'S SWITCHES + BEQ 2$ + MOV SWR,CURSWR + TENSW ;LET KLDCP DO IT + BCS UHUNG +2$: JSR B,HWEXAM ;INCREMENT COUNTER -10 IS SUPPOSED + DTECHK ; TO SETOM EVERY HALF-SECOND + CLR LH + CLR SNB + INC RH + BEQ 3$ + CMP RH,#15.*60. ;IF IT DOESN'T SETOM IT FOR 15 SECONDS + BLE 4$ ;THEN IT IS DOWN. NOTE THAT PARITY SWEEPS + SETOM NO.ITS ;THROUGH LARGE MEMORY CAN TAKE SEVERAL SECONDS. + MOV #15.*60.,RH ;DON'T LET COUNTER OVERFLOW + BR 4$ + +3$: CLR NO.ITS ;IT SETOMED COUNTER, IT'S UP. +4$: JSR B,HWDEP ;PUT COUNTER BACK + DTECHK + MASK 6 ;NOW SIMULATE BR6 CLOCK INTERRUPT + CALL CLKBRK + BR TENSER ;AND GO SERVICE 10 (IN CASE LOST INTERRUPT) + +; HERE IF KL10 HALTS + +TENDED: SETOM NO.ITS + CLC + RET ;LET KLDCP PRINT THE MESSAGE + +; BYTE TRANSFER ENCOUNTERED HARDWARE LOSSAGE + +LOSSAG: BPT + BR LOSSAG + +; USER WANTS TO GIVE A KLDCP COMMAND + +KLDCPR: CLR KLDCPF + SEC + RET + +TENSER: JMP TENSR0 + +; HERE WHEN TO10 BYTE TRANSFER COMPLETE + +INPDON: MOV #%STCLI,STATUS ;CLEAR FLAGS IN DTE20 + MOV INPCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WOOPS, NO XFER IN PROGRESS +1$: CLR INPCMD ;NO XFER IN PROGRESS NOW + MOV INPSVI,I + MOV INPSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAIN + +; HERE WHEN TO11 BYTE TRANSFER COMPLETE + +OUTDON: MOV #%STCLO,STATUS ;CLEAR FLAG + MOV OUTCMD,A ;GET COMMAND FOR XFER THAT JUST FINISHED + BNE 1$ + BPT ;WHOOPS, NO XFER IN PROGRESS +1$: CLR OUTCMD ;NO XFER IN PROGRESS NOW + MOV OUTSVI,I + MOV OUTSVC,C + CALL @FINAL-2(A) ;CALL APPROPRIATE FINISHER ROUTINE + BR MAINJ + +; HERE TO START TO10 BYTE TRANSFER. HWEXAM OF DTEINP HAS BEEN DONE. + +INPSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEINP + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BEQ OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +; HERE TO START TO11 BYTE TRANSFER. HWEXAM OF DTEOUT HAS BEEN DONE. + +OUTSER: D10MON ;VALUE HAS BEEN PICKED UP, SETOM IT + DTEOUT + BIT #1000,LH ;RIGHT GENDER OF COMMAND? + BNE OUTSR1 ;YES + BR MAINJ ;(USED TO BE BPT) NO, IGNORE, MAYBE ITS BEING RELOADED + +OUTSR1: MOV RH,C ;GET BYTE COUNT + MOVB LH,I ;GET LINE# + MOVB LH+1,A ;GET COMMAND TIMES 2 + BEQ MAINJ ;CLEARING CORE? IGNORE ZERO COMMAND + BLE OUTSR2 + CMP A,#LBEGIN + BGT OUTSR2 + CALL @BEGIN-2(A) ;CALL APPROPRIATE BEGIN-XFER ROUTINE + BIT #2,A + BNE 1$ + MOV A,INPCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,INPSVI + MOV C,INPSVC + BR MAINJ + +1$: MOV A,OUTCMD ;REMEMBER CRUFT FOR XFER IN PROGRESS + MOV I,OUTSVI + MOV C,OUTSVC +MAINJ: JMP MAIN + +OUTSR2: BR MAINJ ;BAD COMMAND FROM 10 (USED TO BE BPT) JUST IGNORE IT + +;TABLE OF ROUTINES TO PROCESS DATA TRANSFER COMMANDS FROM -10 + +BEGIN: TYOSER ;%DTTYO + ;ETHISR ;%DTETI + ;ETHOSR ;%DTETO +LBEGIN==.-BEGIN + +;TABLE OF ROUTINES TO FINISH UP DATA TRANSFERS + +FINAL: TYOFIN ;%DTTYO + ;ETHIFN ;%DTETI + ;ETHOFN ;%DTETO + +;CHECK FOR COMMANDS FROM 10, STORE STATUS IN ANY STATUS WORDS +;THAT 10 HAS SET BACK TO -1 + +TENSR0: MOV #%STUNV,STATUS ;CLEAR 10 INTERRUPTING 11 FLAG + JSR B,HWEXAM ;CHECK FOR A NON-TIMESHARING COMMAND + DTECMD + MOV RH,A ;IS THERE ONE? + BEQ TENSR1 ;NO, GO CHECK FOR TIMESHARING STUFF + CLR LH + CLR SNB + CMP A,#377 + BHI 2$ +1$: TSTB TPS ;CHAR TO BE TYPED, WAIT FOR READY + BPL 1$ + MOVB A,TPB ;TYPE IT OUT +9$: CLR RH ;CLEAR OUT THE COMMAND + JSR B,HWDEP + DTECMD + D10MON ;TELL 10 IT'S DONE + DTEFLG + JMP MAIN + +2$: CMP A,#%DTTYI + BNE 5$ + CLR RH ;SNB,LH,RH NOW HAS ZERO + SETOM DDTMOD ;KEYBOARD INPUT WANTED + TST DDTCHR ;TEST IF READY + BMI 3$ ;IF NO INPUT, GIVE ZERO + MASK 5 + MOV DDTCHR,RH ;GIVE THE CHAR + COM DDTCHR ;MAKE NEGATIVE + UNMASK +3$: JSR B,HWDEP + DTEF11 + BR 9$ + +5$: CMP A,#%DTCLN + BNE 6$ + SETOM CLKENB + BR 9$ + +6$: CMP A,#%DTCLF + BNE 7$ + CLR CLKENB + BR 9$ + +7$: BPT ;SOME COMMAND WE DON'T IMPLEMENT + BR 9$ ;IF CONTINUED, IGNORE IT + +;CHECK FOR ITS UP/DOWN + +TENSR1: TST NO.ITS ;IF SYSTEM ISN'T UP, + BNE MAINJ ;DON'T TRY TO HACK TS STUFF + INC DLXOFF ;OTHERWISE, FIRST TIME THROUGH HERE + BNE CHKOST ;WE CHECK THE VERSION + JSR B,HWEXAM + DTEVER + TST RH ;STORED? + BNE 1$ + DEC DLXOFF ;NO, DON'T LOOK AT IT + BR MAINJ ;PROBABLY CORE BEING CLEARED + +1$: CMP RH,VERSN + BEQ CHKOST + BPT ;-10 AND -11 PROGRAMS NOT SAME VERSION + +CHKOST: JSR B,HWEXAM ;CHECK FOR 10 WANTING OUTPUT START + DTEOST + BNE CHKTRN ;BRANCH IF LOCATION DTEOST IS -1 + D10MON ;HAVING PICKED IT UP, SET BACK TO -1 + DTEOST + MOV RH,A + MOV #TYORNG,B + MASK 5 ;DON'T INTERFERE WITH P.I. LEVEL + CALL PUT + UNMASK + CLR DDTMOD ;SYSTEM UP, TURN OFF DDT MODE + MOV #-1,DDTCHR ;.. + +CHKTRN: TST INPCMD + BNE 1$ ;INPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEINP + BNE 1$ ;DTEINP -1, NO REQUEST + JMP INPSER + +1$: TST OUTCMD + BNE CHKLSP ;OUTPUT IN PROGRESS, DON'T START AGAIN + JSR B,HWEXAM ;CHECK FOR DATA TRANSFER COMMAND + DTEOUT + BNE CHKLSP ;DTEOUT -1, NO REQUEST + JMP OUTSER + +CHKLSP: JSR B,HWEXAM ;CHECK FOR SET LINE SPEED COMMAND + DTELSP + BNE CHKTYI + MOV RH,I ;GET LINE# + ASL I + CMP I,#NFTTY ;VALIDATE IT + BLO 1$ ;IGNORE IF BAD + CMP I,#LASTTY + BHI 1$ + JSR B,HWEXAM ;GET LPR,,BUFFERSIZE + DTELPR + MOV LH,A + MOV RH,B + CALL SPARAM ;DO IT +1$: D10MON ;DONE, SETOM + DTELSP + +CHKTYI: TST TYIRNG+RINGCT + BEQ CHKODN ;NO TTY INPUT WAITING + JSR B,HWEXAM + DTETYI + BEQ CHKODN ;PREVIOUS CHAR NOT PICKED UP + MOV #TYIRNG,B + CALL GET + MOV A,RH ;CHAR + CALL GET + MOV A,LH ;LINE# + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,CHAR + DTETYI + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKODN: TST TYORNG+RINGCT + BEQ CHKHNG ;NO OUTPUT DONES WAITING + JSR B,HWEXAM + DTEODN + BEQ CHKHNG ;PREVIOUS STATUS NOT PICKED UP + MOV #TYORNG,B + CALL GET ;GET LINE# WITH OUTPUT DONE + MOV A,LH + ASL A + MOV BUFSIZ(A),RH + CLR SNB + JSR B,HWDEP ;GIVE 10 LINE#,,BUFFERSIZE + DTEODN + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +CHKHNG: TST HNGSIG + BEQ MAINX ;NO HANGUPS/DIALINS WAITING + JSR B,HWEXAM + DTEHNG + BEQ MAINX ;PREVIOUS STATUS NOT PICKED UP + MOV #LASTTY,I ;SCAN OVER ALL LINES +1$: MASK 5 + MOV TTYHNG(I),A ;GET HANG-UP STATUS + BNE 2$ ;BRANCH IF FOUND SOMETHING TO REPORT + UNMASK + TST -(I) + CMP I,#NFTTY + BHIS 1$ + BPT ;HNGSIG OUT OF PHASE WITH TTYHNG + +2$: CLR TTYHNG(I) ;GOT STATUS, CLEAR IT + DEC HNGSIG ;DECREASE COUNT OF FROBS WAITING TO BE SIGNALLED + UNMASK ;NOW IT'S OK TO INTERRUPT AND SET TTYHNG + MOV A,RH ;GIVE LINE NUMBER AND OTHER DATA TO 10 + CLR LH + CLR SNB + JSR B,HWDEP + DTEHNG + MOV #%STINX,STATUS ;INTERRUPT THE 10 + +MAINX: JMP MAIN +.ENDC ;DTE20P + +.IFZ DL10P+DTE20P + .SBTTL MAIN LOOP FOR AI + +MAIN: +.IIF NZ TEN11P, CALL T11WAK ;CHECK UP ON TEN-11 INTERFACE +.IIF Z TEN11P, CALL CHSRUN ;DAMNED THING GETS WEDGED +.IFNZ ETHERP + TST CHXRTF+CHXETH ;NEED TO BROADCAST ROUTING INFO TO ETHERNET? + BEQ 666$ + CALL ETHRUT +666$: +.ENDC ;ETHERP + TST WAKE ;CLOCK TICK? + BEQ MAIN ;NO, JUST WAIT + CLR WAKE ;CLOCK HAS TICKED, CLEAR FLAG + BR MAIN ;NOT MUCH TO DO, NO TTYS +.ENDC ;DL10P+DTE20P + + .SBTTL OUTPUT HANDLERS + +TYOSER: ASL I ;CONVERT -10 LINE# TO -11 TTY INDEX + CMP I,#NFTTY + BLO 11$ + CMP I,#LASTTY + BLOS 12$ +11$: BPT ;10 GAVE BAD LINE# +12$: MOV HDWR(I),H ;GET HARDWARE INDEX + MOV BUFPNT(I),D ;AND ADDRESS OF TYPEOUT BUFFER + CMP BUFSIZ(I),C ;MAKE SURE THERE IS ROOM IN BUFFER + BHIS 2$ + BPT ;THERE ISN'T +2$: MOV C,B ;MUSTN'T CLOBBER BYTE COUNT IN C +.IFNZ DL10P + MOV #TYOPNT,A ;GET CRUFT FROM DL10 +3$: MOVB @A,(D)+ ;COPY BUFFER + SOB B,3$ +.ENDC ;DL10P +.IFNZ DTE20P + MOV D,TO11AD ;SET UP BYTE TRANSFER + NEG B + BIC #050000,B ;SET LAST, BYTE; CLEAR ASCIZ, 2.4 + MOV B,TO11BC ;START XFER + RET + +TYOFIN: MOV HDWR(I),H ;COMES BACK WHEN XFER COMPLETE +.ENDC ;DTE20P + +;BUFFER HAS BEEN LOADED, START DEVICE + + MASK 5 ;DON'T LET DEVICE INTERRUPT + MOV BUFPNT(I),D + CALL @STROUT(H) ;CALL DEVICE-DEPENDENT ROUTINE + MOV #40000,TYPING(I) ;TELL 10 WHEN OUTPUT FINISHES (LARGE POSITIVE NUMBER) + UNMASK + RET + +;GIVE MESSAGE. A -> .WORD LENGTH,MSG. I HAS LINE NUMBER. + +GIVMSG: PUSH + MOV (A)+,C ;C HAS BYTE COUNT, A HAS ADDRESS + MOV A,D ;PUT ADDRESS IN D + MOV HDWR(I),H + MASK 5 + CALL @STROUT(H) ;START OUTPUT TO LINE + UNMASK + POP + RET + +ASPACK: MNAME ^% + MSG ^\ +‡Connected to MCHN'.\% +DWNMSG: MSG ^\ +‡ITS is down.\ +IBOMSG: MSG ^\IBO\ + +;DEVICE-DEPENDENT OUTPUT START ROUTINES (CALL AT PI LEVEL 5) +;H HDWR IDX, I TTY IDX, D BUFFER POINTER, C NUMBER OF BYTES + +STRDH: BIC DHLBIT(I),@DHBAR(H) ;IF LINE ALREADY TRANSMITTING, STOP IT + ;IT SHOULDN'T OUGHT TO BE... + MOV DHLSEL(I),@DHSCR(H) ;HARDWARILY SELECT THIS LINE + MOV D,@DHCA(H) ;SET XMT ADDRESS + NEG C ;HARDWARE LIKES NEGATIVE BYTE COUNTS + MOV C,@DHBC(H) ;SET XMT COUNT + BIS DHLBIT(I),@DHBAR(H) ;START TRANSMISSION HARDWARILY + BIS DHLBIT(I),DHOAC(H) ;SOFTWARILY ALSO + RET + +STRDL: MOV D,DLCA(H) + MOV C,DLBC(H) + CLR @DLPS(H) + MOV #300,@DLPS(H) ;CAUSE INTERRUPT + SETOM DLOAC(H) +CPOPJ: RET + +.IFNZ NMPTYS +STRMPK: TST MPXENB + BEQ CPOPJ + MOV D,MPXPNT-NFMPTY(I) ;QUEUE OUTPUT + MOV C,MPXNBT-NFMPTY(I) +STRMPX: PUSH I + TST MPXOAC ;START THE MPXR + BNE 10$ ;ALREADY BUSY + CLR I + MOV #NMPTYS,D +2$: MOV MPXNBT(I),C ;FIND MPX KLUDGE LINE WANTS TO OUTPUT + BNE 15$ + TST (I)+ + SOB D,2$ +10$: POP I + RET + +15$: MOV I,MPXOLN ;SAVE LINE# OUTPUT ON + ASR I ;SET UP HEADER + ADD #200,I + MOVB I,MPXHED + MOVB C,MPXHED+1 + MOV #-1,MPXOAC ;SEND HEADER + MOV #MPXIDX,I + MOV HDWR(I),H + MOV #MPXHED,D + MOV #2,C + CALL @STROUT(H) + BR 10$ +.ENDC ;NMPTYS + +.IFNZ GOULDP +.SBTTL GOULD LPT OUTPUT (M.P. LEVEL) +.IIF Z DL10P, .ERROR GOULD LPT ONLY CODED FOR DL10 +.ERR BY THE WAY, THESE ROUTINES DON'T WORK WORTH GUBBISH + +GLPTYO: MOV GLPOIP,H ;GET NEXT BUFFER + CMP GB.STA(H),#%GBMP + BEQ 2$ ;BRANCH IF M.P. ACTIVE + BLT 1$ ;BRANCH IF IDLE BUFFER AVAIL + RET ;NO FREE BUFFERS + +1$: CALL GLPBGB ;GOBBLE A BUFFER +2$: MOV GB.PNT(H),D + MOV GLPCTR,C ;SET UP BYTE COUNTER + MOV GLPGRF,GLPGF1 ;COPY ARG FROM 0 FOR SPEED + TST GLIMBF ;CHAR SAVED FROM LAST TIME? + BEQ GLPNCL + CLR GLIMBF ;YES, PRINT IT + MOVB GLIMBO,A + CALL GLPPUT + MOVB GLIMBO+1,A ;SECOND CHAR? + BEQ GLPNCL + CLR GLIMBO + CALL GLPPUT + +;CHARACTER PROCESSING LOOP +;C HAS # CHARS YET TO GO, D HAS WHERE TO PUT THEM, H -> BUFFER +;A WILL HAVE CHAR + +GLPNCL: MOV GLPPTR,A ;GET NEXT CHAR + TST GLPGF1 + BNE GLPNRM ;GRAPHIC MODE, NO CHARACTER PROCESSING + CMP A,#177 ;ESCAPE? + BEQ GLPESC + CMP A,#40 ;CONTROL? + BGE GLPNRM ;NO, NORMAL PRINTING + CMP A,#14 ;CHECK FOR SPECIAL CONTROLS + BNE 10$ +8$: CLR GLPROW ;START NEW PAGE + TST GLPCOL ;IN MIDDLE OF LINE? + BEQ 9$ ;NO, OK + CALL GLPBWW ;OTHERWISE, HAIR + CLR GLPFIL ;HACK HACK MAKE FF NEXT LINE + BR GLPNB1 + +9$: SETOM GB.FF(H) + BR GLPNXC + +10$: CMP A,#12 + BNE 12$ + INC GLPROW + CMP GLPROW,#GLPRMX + BHIS 8$ ;SKIP OVER PERFORATION + TST GLPCOL + BNE GLPNBF ;IF NOT A BLANK LINE, FINISH BUFFER + INC GB.NL(H) + BR GLPNXC + +12$: CMP A,#11 + BNE 15$ +13$: MOV #40,A ;TAB - SPACE OVER + CALL GLPPUT + BIT #7,GLPCOL + BNE 13$ + BR GLPNXC + +15$: CMP A,#15 + BEQ GLPNXC ;IGNORE CR + CMP A,#33 + BNE 16$ + MOV #'$,A ;PRINT ALTMODE AS DOLLAR + BR GLPNRM + +16$: BIS #100,A ;RANDOM CONTROL AS UPARROW, LETTER + MOVB A,GLIMBO+1 + MOV #'^,A + CALL GLPPUT + MOVB GLIMBO+1,A + CLR GLIMBO +GLPNRM: CALL GLPPUT ;HERE FOR NORMAL CHARACTER +GLPNXC: DEC C ;HERE TO GOBBLE CHARACTER + BGT GLPNCL ;BRANCH IF MORE CHARS TO GO + BR GLPEND ;BUFFER EMPTIED + +GLPNBF: CALL GLPBWW ;HERE TO ADVANCE TO NEXT BUFFER +GLPNB1: CMP GB.STA(H),#%GBIDL ;NEXT BUFFER AVAIL? + BNE GLPEN1 ;NO, STOP + CALL GLPBGB ;YES, GOBBLE IT + BR GLPNXC + +GLPESC: DEC C ;HERE FOR TWO CHAR ESC SEQ + BEQ GLPEND ;-10 FORGOT 2ND CHAR, FLUSH + MOV GLPPTR,A ;GET & DECODE 2ND CHAR + CMP A,#105 ;EOF + BEQ GLPEOF + BR GLPNXC ;OTHER CHARS ARE IGNORED + +GLPEOF: CLR GLPFIL + CLR GLPROW + CALL GLPBWW ;EOF, WRITE LAST BUFFER +GLPEN1: DEC C ;GOBBLE A CHARACTER +GLPEND: MOV C,GLPCTR ;HERE WHEN DONE, RELEASE 10'S BUFFER + CMP GB.STA(H),#%GBMP ;BUFFER ACTIVE AT M.P. LEVEL? + BNE 1$ ;IF NOT, DON'T CLOBBER GB.PNT + MOV D,GB.PNT(H) ;IF SO, REMEMBER AMT OF STUFF IN CURRENT BUFFER +1$: RET ;RETURN TO MAIN LOOP + +;OUTPUT PRINTING CHAR IN A + +GLPPUT: CMP D,GLPLIM ;LINE OVERFLOW? + BLO 5$ ;NO + CALL GLPBWW ;YES, DONE WITH THIS BUFFER + INC GLPROW ;OUGHT TO CHECK FOR PERFORATION, BUT... + CMP GB.STA(H),#%GBIDL ;MORE BUFFERS? + BNE 6$ ;NO + CALL GLPBGB +5$: MOVB A,(D)+ ;DROP CHAR IN BUFFER + INC GLPCOL ;AND ADVANCE COLUMN + RET + +6$: MOVB A,GLIMBO ;NO BUFFERS, SAVE CHAR BEING PRINTED + SETOM GLIMBF ;SET FLAG SO WILL BE PRINTED NEXT TIME + TST (SP)+ ;STOP THE WORLD + BR GLPEN1 + +;GOBBLE IDLE BUFFER H -> FOR M.P. RETURNS GB.PNT(H) IN D. + +GLPBGB: MOV #%GBMP,GB.STA(H) ;ACTIVATE AT M.P. LEVEL + CLR GB.FF(H) ;INIT THE BUFFER + CLR GB.NL(H) + CLR GLPCOL ;START LINE IN COLUMN 0 + MOV H,D ;INIT INSERT POINTER + ADD #GB.DAT,D + MOV D,GB.PNT(H) + MOV H,GLPLIM ;SET UP MAX. VALUE OF GB.PNT + ADD #GB.LEN,GLPLIM + RET + +;GIVE BUFFER H -> TO P.I. LEVEL + +GLPBWW: BIT #1,D ;MUST BE EVEN NUMBER OF BYTES + BEQ 1$ + CLRB (D)+ + +1$: PUSH A ;INTERFACE GETS BYTES IN WRONG ORDER + MOV P,A ;COMPUTE NUMBER OF WORDS IN LINE + SUB H,A + SUB #GB.DAT,A + ASR A + BNE 4$ + CLR (D)+ ;CAN'T HAVE ZERO-LENGTH LINE + INC A +4$: MOV A,GB.PNT(H) ;SAVE WORD COUNT FOR P.I. LEVEL +2$: SWAB -(D) + SOB A,2$ + POP A + TST GLPFIL ;IF STARTING NEW FILE, + BNE 5$ + SETOM GLPFIL + SETOM GB.FF(H) ; BE SURE TO GET NEW PAGE +5$: MOV #%GBWRT,GB.STA(H) ;QUEUE TO P.I. LEVEL + MOV GB.NXT(H),H ;ADVANCE TO NEXT BUFFER + MOV H,GLPOIP + MASK 6 ;STOP P.I. LEVEL (HAVE TO LOCK OUT GLPBRK & CLKBRK) + TST GLPOAC ;PRINTER ON? + BNE 3$ ;YUP + MOV #%GCOFF,@#GLPCSR ;NO, CLEAR OLD STUFF IN INTERFACE + TST GLPGF1 ;AND PUT IN LOW-SPEED GRAPHIC MODE IF NECC + BEQ 6$ + MOV #%GCGRF,@#GLPCSR + MOV #%GCLSL,@#GLPCSR ;LOW SPEED (COME ON, THIS IS ONLY A KL10!) +6$: MOV #%GCON,@#GLPCSR ;TURN IT ON + MOV #%GCION,@#GLPCSR ;TURN ON INTERRUPTS + SETOM GLPOAC +; PUSH @#PS ;FAKE AN INTERRUPT +; CALL GLPBRK ;IS THIS NECESSARY? +3$: UNMASK + RET + +;GOULD LPT VARIABLES + +GLPCOL: 0 ;CURRENT COLUMN NUMBER +GLPROW: 0 ;CURRENT ROW NUMBER + GLPRMX==67. ;NUMBER OF LINES PER PAGE +GLPLIM: 0 ;ADDRESS OF END OF CURRENT BUFFER +GLPOAC: 0 ;NON-ZERO => GOULD LPT P.I. ACTIVE +GLPGF1: 0 ;NON-ZERO => GOULD LPT IN GRAPHIC MODE +GLIMBO: 0 ;SAVE CHAR HERE WHEN RUN OUT OF BUFFERS +GLIMBF: 0 ;NON-ZERO => CHAR IN GLIMBO +GLPFIL: 0 ;NON-ZERO => IN MIDDLE OF A FILE +GLPTIM: 10. ;COUNT DOWN WHEN LOSING +GLPERR: 0 ;NON-ZERO => ERROR STATUS FROM P.I. +.ENDC ;GOULDP + + .SBTTL T-300 DISK + +.IFNZ T300P + +;DISK UNIBUS REGISTERS + +DSKCRA=176700 ;COMPLETION REGISTER A + %DAPON==100000 ;SPONTANEOUS COMPLETION DUE TO POWER-ON. DISK NUMBER + ; IN LOW BITS OF COMMAND-COMPLETION REGISTER B + %DACQE==10000 ;CONSISTENCY ERROR IN COMMAND QUEUE + %DANXM==4000 ;NXM ERROR IN COMMAND QUEUE + %DAPAR==2000 ;PARITY ERROR IN COMMAND QUEUE + ;LOW 2 BITS OF COMMAND COMPLETION REGISTER A AND + ;COMMAND COMPLETION REGISTER B CONTAIN THE ADDRESS + ;OF THE PARITY OR NXM ERROR +DSKCRB=176702 ;COMPLETION REGISTER B +DSKCSR=176704 ;COMMAND/STATUS REGISTER + %DCCPL==100000 ;COMMAND IS COMPLETE, RESET BY %DCACK. READ-ONLY + %DCDER==40000 ;"DMA ERROR", RESET ONLY BY SYSTEM RESET. + ;1=NORMAL, 0=ERROR + ;BITS 30004 ALWAYS ON + %DCMNT==4000 ;HOST-ADAPTOR MAINTENANCE MODE + %DCRST==2000 ;RESET. WRITE-ONLY. + %DCACK==1000 ;ACKNOWLEDGE COMMAND COMPLETION. WRITE-ONLY + %DCCMD==400 ;TAKE COMMAND FROM CTRA/CTRB. WRITE-ONLY + %DCRDY==200 ;READY TO TAKE A COMMAND. READ-ONLY + %DCTIE==100 ;COMMAND TRANSMISSION (%DCRDY) INTERRUPT ENABLE + %DCCIE==40 ;COMMAND COMPLETION (%DCCPL) INTERRUPT ENABLE + %DCPCY==20 ;POWER JUST CYCLED ON OR OFF. READ-ONLY + %DCPON==10 ;POWER ON. READ-ONLY + %DCDMA==2 ;DMA IN PROGRESS. READ-ONLY + %DCBOT==1 ;BOOT (READ DRIVE 0 SECTOR 0 INTO MEMORY 0). WRITE-ONLY +DSKCTA=176706 ;COMMAND TRANSMISSION A (ADDRESS OF RQB HIGH BITS) +DSKCTB=176710 ;COMMAND TRANSMISSION B (ADDRESS OF RQB LOW BITS) +;176714 DUPLICATES DSKCSR FOR UNKNOWN REASONS + +;DISK REQUEST BLOCK. WE ONLY HAVE ONE SINCE NO SEEK OVERLAP. + +RQBACT: 0 ;NON-ZERO IF REQUEST ACTIVE AND EXPECTING COMPLETION + +RQBID: 0 ;RETURNED IN CCRB WHEN COMMAND COMPLETES +RQBSTS: 0 ;STATUS STORED BY 2561, COPIED INTO DSCSTS +RQBFLT: 0 ;FAULT CODE IN HIGH BYTE, BITS 1-0 HIGH BITS OF LINK ADDRESS +RQBLNK: 0 ;LINK ADDRESS TO NEXT RQB (MUST BE ZERO) +RQBCMD: 0 ;COMMAND CODE, COPIED FROM DSCCMD +RQBDRV: 0 ;UNIT NUMBER, COPIED FROM DSCDRV +RQBCYL: 0 ;CYLINDER NUMBER, COPIED FROM DSCCYL +RQBHED: 0 ;HEAD NUMBER, COPIED FROM DSCHED +RQBSEC: 0 ;SECTOR NUMBER, COPIED FROM DSCSEC +RQBWC: 0 ;POSITIVE WORD COUNT (ALWAYS 12.*256.) +RQBMA: 0 ;MEMORY ADDRESS (ALWAYS DSKBUF) +RQBMAH: 0 ;MEMORY ADDRESS HIGH (ALWAYS 0) + ; BITS 1-0 BITS 17-16 OF ADDRESS. BIT 6 MA INCR INH +RQBID1: 0 ;RETURNS RECORD ID 1 +RQBID2: 0 ;RETURNS RECORD ID 2 +RQBMNT: .BLKW 27. ;DIAGNOSTIC DATA MAY BE RETURNED + +;DISK BUFFER. HOLDS ENOUGH 12-BIT BYTES IN 16-BIT WORDS TO MAKE 1024. 36-BIT WORDS +DSKBUF: .BLKW 3.*1024. + +;ROUTINE TO START DISK IF IT IS READY AND THERE IS A REQUEST. +DSKSTR: TST DSCREQ ;ANY REQUEST FROM 10? + BEQ 99$ ;NO, EXIT + CMP DSCCHK,#2561 + BNE 99$ ;CHECK WORD WRONG, DON'T TOUCH DISK + TST RQBACT ;PREVIOUS OPERATION FINISHED? + BEQ 10$ + BPT ;NO, MUST BE BUG IN 10? +10$: TSTB DSKCSR ;TEST IF READY FOR COMMAND TRANSMISSION + BPL 99$ ;NO, WAIT + CLR DSCDON ;YES, CLEAR 10/11 COMMUNICATION FLAGS + CLR DSCREQ + CLR RQBLNK ;SET UP RQB FROM 10'S PARAMETERS + MOV DSCCMD,RQBCMD + MOV DSCDRV,RQBDRV + MOV DSCCYL,RQBCYL + MOV DSCHED,RQBHED + MOV DSCSEC,RQBSEC + MOV #12.*256.,RQBWC + MOV #DSKBUF,RQBMA + CLR RQBMAH + CMP RQBCMD,#%DMWRT ;IF A WRITE COMMAND, MUST COPY DATA BUFFER + BNE 30$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVHD + .ENDR + .ENDR +30$: CLR DSKCTA ;GIVE ADDRESS OF RQB TO 2561 + MOV #RQBID,DSKCTB + SETOM RQBACT ;TELL INTERRUPT LEVEL INTERRUPT EXPECTED + MOV #%DCCMD+%DCCIE,DSKCSR ;GIVE COMMAND, ENABLE COMPLETION INTERRUPT +99$: RET ;DONE + +;CALL HERE WHEN DISK INTERRUPTS +DSKBRK: PUSH ;SAVE ALL REGISTERS + MOV DSKCSR,A + BIT #%DCPCY,A ;POWER CYCLED? + BNE 5$ ;YES, RESET CONTROLLER AND IGNORE INTERRUPT + BIT #%DCMNT,A ;NO, MAINTAINENCE MODE + BEQ 4$ ;OK + BPT ;BLEAH, MUST BE BROKEN + BR 5$ + +4$: BIT #%DCDER,A ;WHAT ABOUT UNIBUS ERROR + BNE 10$ + BPT +5$: MOV #%DCRST,DSKCSR ;RESET THE CONTROLLER AND TURN OFF INTERRUPTS + TST RQBACT ;DID THIS LOSE IN THE MIDDLE OF A DISK OPERATION? + BEQ 99$ ;NO, DISMISS + MOV #%DFRST,A ;YES, GIVE ERROR STATUS + CLR B + BR 20$ + +10$: BIT #%DCCPL,A ;TEST FOR COMMAND COMPLETION + BPL 99$ ;NO, IGNORE INTERRUPT + MOV DSKCRA,A ;GET COMPLETION STATUS + MOV DSKCRB,B + MOV #%DCACK+%DCCIE,DSKCSR ;ACKNOWLEDGE COMPLETION, ENABLE MORE INTERRUPTS + TST RQBACT ;EXPECTED? + BEQ 99$ ;NO, IGNORE + BIT #%DAPON,A ;POWER-UP INDICATION? + BNE 99$ ;FOR NOW, IGNORE IT + BIT #%DACQE+%DANXM+%DAPAR,A + BEQ 30$ ;OK, NO COMMAND-QUEUE ERROR + MOV #%DCRST,DSKCSR ;RESET CONTROLLER (I DON'T KNOW IF IT NEEDS IT) +20$: MOV A,DSCFLT ;COMMAND-QUEUE ERROR, GIVE STATUS TO PDP10 + MOV B,DSCSTS + BR 80$ + +30$: CLR DSCFLT ;CLEAR HIGH BYTE + MOVB RQBFLT+1,DSCFLT ;PICK UP FAULT CODE, PUT IN LOW BYTE + BEQ 35$ ;IF FAULT CODE IS NON-ZERO, THE THING MAY BE FROZEN, + MOV #%DCRST,DSKCSR ;SO RESET IT. OTHERWISE ERROR SEEMS TO HAPPEN OVER AND OVER +35$: MOV RQBSTS,DSCSTS ;GIVE STATUS TO PDP10 + MOV RQBCYL,DSCCYL ;STORE BACK DISK ADDRESS, MAY BE USEFUL TO PDP10 + MOV RQBHED,DSCHED + MOV RQBSEC,DSCSEC + BIT #%DMRED,RQBCMD ;IF COMMAND WAS READ, COPY BUFFER BACK + BEQ 80$ + MOV #DSKBUF,D + .REPT 4 ;TAKES 4 BYTE POINTERS TO DO IT + MOV #DSCPNT+<2*.RPCNT>,H + .REPT 3 ;EACH BYTE POINTER HAS 768 12-BIT BYTES + MOV #256.,C + CALL MOVDH + .ENDR + .ENDR +80$: SETOM DSCDON ;SIGNAL PDP10 OPERATION IS COMPLETE + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + CLR RQBACT ;NO LONGER EXPECTING COMPLETION ON THE RQB +99$: POP ;RESTORE REGISTERS AND EXIT INTERRUPT + RTI +.ENDC ;T300P + + .SBTTL SET LINE PARAMETERS + +;LINE INDEX IN I +;DH11 PARAM REG IN A +;BUFFER SIZE IN B + +SPARAM: CMP I,#NFTTY + BGE 1$ + BPT +1$: CMP I,#LASTTY + BLE 2$ + BPT +2$: CMP B,#1. ;MINIMUM BUFFER SIZE ONE CHARACTER + BGE 3$ + MOV #1.,B +3$: CMP B,#MAXBSZ ;MAXIMUM BUFFER SIZE CHARACTERS + BLE 4$ + MOV #MAXBSZ,B +4$: MOV B,BUFSIZ(I) ;SET AMOUNT OF BUFFER TO BE USED FROM NOW ON + MOV HDWR(I),H ;(BUT NO LONGER DO WE ATTEMPT DYNAMIC BUFFER ALLOCATION) + CMP H,#NLDHHX + BHI 5$ + MASK 5 ;LINE IS A DH11, HAVE TO SET LINE PARAM REG + MOV DHLSEL(I),@DHSCR(H) ;SELECT THE LINE + MOV A,@DHLPR(H) ;GIVE LINE-PARAMETER REG TO DH11 + UNMASK +5$: MOV A,LPRVAL(I) ;STORE LPR IN CASE SOMEONE IS CURIOUS + RET + + .SBTTL DH11 INPUT INTERRUPT + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHIBK: MOV (H),H ;PICK UP HARDWARE INDEX + PUSH +1$: MOV @DHNRC(H),A ;RECIEVE A CHARACTER + BPL DHIEX ;EXIT INTERRUPT IF NO MORE CHARS + MOV A,I ;EXTRACT LINE NUMBER + SWAB I + BIC #177760,I + ASL I + ADD DHTYNO(H),I +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 1$ +.ENDC + CALL @TTYIPC(I) ;CALL LINE HACKER + BR 1$ ;AND CHECK FOR MORE + +DHIEX: POP + RTI + +;NORMAL DH11 INPUT + +DHNRMI: BIT #%DXPAR,A + BEQ 1$ ;IGNORE IF PARITY ERROR +10$: RET +1$: BIT #%DXBRK,A ;IF BREAK, + BEQ RCV + TST AUTOSP(I) ;AND LINE WANTS AUTOSPEED-ON-BREAK FEATURE + BPL 10$ +ASPMD: MOV #DHASP,TTYIPC(I) ;PUT IT IN AUTOSPEED MODE + MOV DHLSEL(I),@DHSCR(H) ;AND SET HARDWARE TO 1200 BAUD + MOV #023103,@DHLPR(H) + RET + +;CHAR IN A RECEIVED FROM LINE IN I +RCV: BIC #177400,A ;8-BIT CHAR RECEIVE +RCV.FW: TST NO.ITS ;ENTER HERE FOR FULL WORD RECEIVE + BEQ 10$ +21$: MOV #DWNMSG,A ;ITS DOWN, GIVE MESSAGE +12$: CALL GIVMSG + RET + +10$: MOV #TYIRNG,B + CMP RINGCT(B),#TYIRSZ-2 + BGT 11$ + CALL PUT ;FIRST PUT THE CHARACTER + MOV I,A + ASR A + CALL PUT ;THEN THE TENNISH LINE NUMBER + RET + +11$: MOV #IBOMSG,A ;INPUT BUFFER OVERFLOW + BR 12$ + +.IFNZ NMPTYS ;HANDLE INPUT FROM THE MULTIPLEXOR LINE +MPXINP: TST MPXENB + BEQ RCV + MOV MPXSEL,I ;CURRENT INPUT LINE + TSTB A ;SPECIAL CHAR? + BMI 1$ + JMP @TTYIPC(I) ;NO, RECEIVE ON APPROP LINE + +1$: MOV A,I ;SPECIAL CHAR, EXTRACT LINE# + BIC #177700,I +;FOLLOWING FEATURE COMMENTED OUT SINCE IT CAUSES 11 TO LOOP +; WHEN NEXT INPUT ARRIVES -- NOT OBVIOUS HOW TO FIX. +; CMP I,#77 ;SELECT NON-MULTIPLEX INPUT? +; BEQ 3$ ;YES, DO SO + ASL I + ADD #NFMPTY,I + CMP I,#LASTTY + BHI 2$ ;OUT OF RANGE, IGNORE + MOV I,MPXSEL ;INPUT SELECT, SAVE LINE# +2$: RET + +3$: MOV #MPXIDX,MPXSEL ;SELECT PASS THROUGH + RET +.ENDC ;NMPTYS + +;AUTOSPEED MODE COMES HERE WHEN CHAR RECIEVED + +DHASP: BIC #177400,A ;CLEAR FRAMING ERR, ETC. + BEQ ASP10 ;11 0'S = 110 BAUD + CMP A,#200 ;7 0'S, 1 = 150 BAUD + BEQ ASP15 + CMP A,#170 ;3 0'S, 4 1'S, 0 = 300 BAUD + BEQ ASP30 + CMP A,#370 ;300/600 IS NOW RUBOUT, NOT I + BEQ ASP36 + CMP A,#146 ;1 0, 2 1'S, 2 0'S, ... = 600 + BEQ ASP60 + CMP A,#340 ;5 0'S, 3 1'S ? MYSTERY TO ME + BEQ ASP60 + CMP A,#015 ;CR = 1200 + BEQ ASP120 + CMP A,#215 ;CR WITH EITHER PARITY + BEQ ASP120 + MOV A,#. ;SAVE GARBAGE FOR DEBUGGING + RET ;SOMETHING ELSE, IGNORE + +ASP10: MOV #006307,A ;110 IN, 110 OUT, NO PARITY, 8 BITS, EXTRA STPBT + MOV #5,B + MOV #12200,-(SP) + BR ASPX + +ASP15: MOV #012503,A ;150 IN, 150 OUT, NO PARITY, 8 BITS + MOV #7,B + MOV #13300,-(SP) + BR ASPX + +ASP30: MOV #016703,A ;300 IN, 300 OUT, NO PARITY, 8 BITS + MOV #15.,B + MOV #14400,-(SP) + BR ASPX + +ASP36: MOV #020703,A ;300 IN, 600 OUT, NO PARITY, 8 BITS + MOV #30.,B + MOV #14100,-(SP) + BR ASPX + +ASP60: MOV #021003,A ;600 BAUD, NO PARITY, 8 BITS + MOV #30.,B + MOV #11100,-(SP) + BR ASPX + +ASP120: MOV #023103,A ;1200 IN, 1200 OUT, NO PAR, 8 BITS + MOV #60.,B + MOV #15500,-(SP) + BR ASPX + +ASPX: CALL SPARAM ;SET BUFFER SIZE AND HARDWARE SPEED + MOV I,A ;SET UP SET-SPEED COMMAND TO -10 + ASR A + BIS (SP)+,A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 11$ + INC HNGSIG ;INDICATE STATUS WAITING +11$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS + MOV #ASPACK,A ;ACKNOWLEDGE TO USER THAT HE WON + CALL GIVMSG + DEC TYPING(I) ;IF NO WAKEUP FOR 10, HIT CALL WHEN TYPING DONE + MOV NRMIPC(I),TTYIPC(I) ;AND TAKE LINE OUT OF AUTOSPEED MODE + RET + + .SBTTL DH11 OUTPUT INTERRUPTS + +.REPT NDHS +CONC DH,\.RPCNT+1, + 2*.RPCNT +.ENDR + +DHOBK: MOV (H),H ;GET HARDWARE UNIT NUMBER + BIT #DHSNXM,@DHSCR(H) ;IS THIS INTERRUPT DUE TO NXM? + BEQ 1$ + BPT ;YES +1$: BIC #DHTDON,@DHSCR(H) ;HARDWARE KLUDGE TO MAKE INTERRUPTS WIN + PUSH + MOV DHOAC(H),C ;SEE WHICH BAR BITS HAVE TURNED OFF + BIC @DHBAR(H),C + BIC C,DHOAC(H) + MOV DHTYNO(H),I + ADD #15.*2,I +2$: BIT DHLBIT(I),C + BEQ 4$ +.IFNZ NMPTYS + CMP I,#MPXIDX + BNE 3$ + CALL MPXDON +.ENDC ;NMPTYS +3$: +.IFNZ NDHUN + CMP I,#NLDHTY ;IGNORE NON-EXISTENT LINES + BHI 4$ +.ENDC + CALL XMTDON +4$: SUB #2,I + CMP I,DHTYNO(H) + BGE 2$ +DHOEX: POP + RTI + +XMTDON: TST TYPING(I) ;HERE WHEN OUTPUT FINISHES + BGT 1$ ;BRANCH IF -10 WANTS TO KNOW ABOUT IT + BEQ 3$ ;BRANCH IF NOTHING TO DO + MOV #32,A ;SEND A CALL + CALL RCV + BR 3$ + +1$: MOV I,A + ASR A ;PUT TENNISH LINE NUMBER INTO RING + MOV #TYORNG,B ;MAIN PROG LEVEL WILL LATER TELL -10 + CALL PUT +3$: CLR TYPING(I) + RET + +.IFNZ NMPTYS ;OUTPUT DONE ON MULTIPLEXED LINE +MPXDON: PUSH + TST MPXOAC + BGE 1$ + NEG MPXOAC ;SENT HEADER, NOW SEND DATA + MOV MPXOLN,A + MOV MPXPNT(A),D + MOV MPXNBT(A),C + CLR MPXNBT(A) + CALL @STROUT(H) + BR 9$ + +1$: MOV MPXOLN,I ;OUTPUT IS DONE ON THAT LINE NOW + ADD #NFMPTY,I + CALL XMTDON + CLR MPXOAC ;MPX IDLE + CALL STRMPX ;LOOK FOR NEW STUFF TO DO +9$: POP + RET +.ENDC ;NMPTYS + + .SBTTL DL11 INTERRUPTS + +.REPT NDLS +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +CONC DL,\.RPCNT+1, + NFDLHX+<2*.RPCNT> +.ENDR + +DLIBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + PUSH + MOV @DLKB(H),A ;GET RECEIVED CHARACTER + MOV DLTYNO(H),I ;GET LINE NUMBER RECEIVED ON +.IFNZ DTE20P + BNE 2$ ;ONLY T00 CAN RETURN TO KLDCP + BIT #20000,A ;IF BREAK KEY IS HIT + BEQ 1$ + SETOM KLDCPF ;USER WANTS TO RETURN TO KLDCP + BR DLBKEX ;FOR ONE COMMAND LINE + +1$: TST DDTMOD ;IF IN DDT MODE, + BEQ 2$ + BIC #-200,A ; HANDLE INPUT DIFFERENTLY + MOV A,DDTCHR + BR DLBKEX + +2$: +.ENDC ;DTE20P + CALL @TTYIPC(I) +DLBKEX: POP + RTI + +DLOBK: MOV (H),H ;GET HARDWARE INDEX OF INTERRUPTING UNIT + TST DLOAC(H) + BEQ DLBKX1 ;NOT SUPPOSED TO BE TYPING OUT, IGNORE INT + DEC DLBC(H) ;GOT ANY MORE CHARACTERS? + BLT DLBKX2 ;NO, GO GIVE OUTPUT DONE + MOV DLCA(H),-(SP) ;YES, GIVE NEXT CHARACTER + MOVB @(SP)+,@DLPB(H) + INC DLCA(H) +DLBKX1: POP H + RTI + +DLBKX2: PUSH ;OUTPUT DONE + MOV DLTYNO(H),I ;GET TTY INDEX OF INTERRUPTING LINE + CLR DLOAC(H) ;OUTPUT NO LONGER ACTIVE ON THIS LINE + CALL XMTDON + BR DLBKEX + + .SBTTL CLOCK INTERRUPT + +;NOTE - IT IS IMPORTANT THAT THIS BE AT A HIGHER INTERRUPT LEVEL THAN THE CHAOS NET +CLKBRK: SETOM WAKE ;WAKE UP MAIN LOOP +.IFNZ GOULDP + PUSH @#PS ;CHECK GOULD LPT + CALL GLPBRK ;(LOSES INTERRUPTS) + DEC GLPTIM ;TIME TO CHECK GOULD LPT? + BGT 13$ ;NOT YET + MOV #10.*60.,GLPTIM + BIT #%GSNRD,@#GLPCSR ;YES, LOSING? + BNE 14$ ;PROBABLY + CLR GLPERR ;PROBABLY NOT + BR 13$ ;(CAN'T TELL FOR SURE IF %GCON NOT DONE) + +14$: MOV @#GLPCSR,GLPERR ;LPT LOSING, TELL 10 + CALL GLPRST ;AND MAKE SURE BUFFERS DON'T CHOKE UP +.ENDC ;GOULDP +13$: PUSH +.IFNZ NDMS ;MODEM SCANNER GETS SHUT OFF SOMEHOW + CLR A ;loop over the DM11s, turning them on + MOV #NDMS,B +259$: BIT #DMSCN,@DMCSR(A) + BEQ 14$ + BIT #DMIEN,@DMCSR(A) + BNE 15$ +14$: MOV #DMSCN+DMIEN,@DMCSR(A) ;ENABLE SCANNER INTERRUPTS +15$: TST (A)+ ;next DM11 + SOB B,259$ ;until all DM11s done + +.ENDC ;NDMS +.IFNZ CHAOSP ;WAKE-UP OUTPUT LINKS IN RE-TRANSMIT DELAY + MOV #CHXCHS,I +50$: MOV CHOHWR(I),A ;ADDRESS OF HARDWARE CSR + TST CHOSTS(I) ;IF ZERO, IS IDLE, DON'T WANT INTERRUPT ENABLE + BEQ 51$ ;NOTE THAT THIS RUNS MASKED HIGHER THAN CHAOS INT LVL + BIS #%CATEN,(A) ;RE-ENABLE INTERRUPT IF OFF +51$: +.IFNZ CHSBTB + BIT #%CATDN,(A) ;TRANSMIT-DONE? + BNE 59$ + INC CHSIDL(I) ;NO, KEEP TIME-OUT + CMP CHSIDL(I),#60. ;IF TRANSMIT-DONE STUCK OFF FOR 1 SECOND, + BLO 59$ + MOV #%CARST,(A) ; THEN RESET THE INTERFACE +; MOV #%CAREN+%CATEN,(A) ;INTERRUPT ENABLES WILL TURN THEMSELVES BACK ON IF NECESSARY! + INC CHSRST(I) ;COUNT NUMBER OF TIMES HAD TO DO THIS +59$: +.ENDC ;CHSBTB +.IFG CHAOSP-1 + TST (I)+ + CMP I,#CHXCHS+CHAOSP+CHAOSP + BLO 50$ +.ENDC ;CHAOSP-1 + DEC PULSAR ;TIME TO GENERATE TEST PACKET TO CHAOS NET? + BGT 66$ ;NOT YET + MOV PULSON,PULSAR ;RE-INITIALIZE COUNTER +.REPT CHAOSP ;YES, AWAKEN ALL TRANSMIT INTERRUPT SIDES + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IFNZ TEN11P + TST CHOSTS+CHXT11 ;AWAITING BUFFER FROM 10? + BNE 65$ ;YES, COUNT TIMEOUT + CLR T11TIM ;NO, RESET TIMEOUT +65$: INC T11TIM +.ENDC ;TEN11P +66$: DEC 4SEC ;TIME FOR 4-SECOND CLOCK? + BGT 90$ + MOV #4*60.,4SEC ;YES + MOV #*2,I ;INCREMENT ROUTING COSTS +71$: TST SBNTYP(I) ;THIS GUY'S COSTS SUPPOSED TO INCREMENT? + BNE 72$ ;NOPE + CMP SBNCST(I),#1000 ;DON'T INCREMENT TOO HIGH AND OVERFLOW + BHIS 72$ + INC SBNCST(I) ;YEP +72$: SUB #2,I + BPL 71$ + DEC 15SEC ;TIME FOR 15-SECOND CLOCK? (REALLY 16) + BGT 90$ + MOV #4,15SEC ;YES +.REPT CHAOSP ;TELL CABLES TO BROADCAST %CORUT PACKETS + SETOM CHXRTF+CHXCHS+<2*.RPCNT> + BIS #%CATEN,@CHOHWR+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ ETHERP, SETOM CHXRTF+CHXETH ;TELL ETHERNET TO BROADCAST ROUTING +90$: ;CAN'T DO IT NOW BECAUSE WRONG INTERRUPT LEVEL +.ENDC ;CHAOSP +.IF DF NDVRBF + INC DVRTIM ;TIME OUT DOVER CONNECTION + CMP DVRTIM,#15.*60. ;IF IDLE FOR 15 SECONDS, FLUSH + BLO 15$ + CLR DVRHST + CLR DVRMSK +15$: INC DVRRTR ;COUNT UP RETRANSMISSION COUNTER +.ENDC ;NDVRBF +.IFNZ NDMS ;GOT ANY TTYS WITH MODEM CONTROL? + MOV #NFTTY,I ;CHECK FOR HANGUPS +16$: TST DIALED(I) ;HANGUP IN PROGRESS ON THIS LINE? + BPL 17$ ;NO + INC DIALED(I) ;YES, TIMED OUT? + BMI 17$ + CLR DIALED(I) ;YUP, LINE IS HUNG UP + MOV I,A ;TELL -10 ABOUT IT + ASR A + TST TTYHNG(I) ;IF THIS IS NEW STATUS FOR 10, + BNE 18$ + INC HNGSIG ;INDICATE STATUS WAITING +18$: MOV A,TTYHNG(I) ;SAVE THIS LINE'S LATEST STATUS +17$: ADD #2,I + CMP I,#LASTTY + BLO 16$ +.ENDC ;NDMS + POP + + ROR SWR ;LOW BIT OF SWITCHES => DDT + BCC CLKEX + BPT +CLKEX: RTI + .IFNZ NDMS + .SBTTL MODEM CONTROL + +;;; hack multiple DM interrupt vectors +.REPT NDMS +CONC DM,\.RPCNT+1, + 2*.RPCNT +.ENDR ;NDMS + + +DMBRK: PUSH + MOV (H),A ;get the device offset in A + MOV @DMCSR(A),I ;GET ASSOCIATED TTY INDEX + BIC #177760,I ;gives us channel (0-17) on this DM11 + ;; now add to get offset into table for any DM + MOV A,B ;device offset in B, is 2*device number + ASL B + ASL B + ASL B ;multiply by 8 for offset in B + ADD B,I ;add to I for offset for this channel + ASL I ;now get word offset in I by shifting + ;; get index into map between DM channels and TTY indices + MOV M2LMAP(I),I + BEQ 90$ ;EXIT IF THIS LINE NOT UNDER MODEM CONTROL +; TST @DMCSR(A) .SEE DMRNG +; BPL 10$ +; TST DIALED(I) ;RINGING. IS LINE DIALED UP ALREADY? +; BNE 10$ ;YES, NOT SUPPOSED TO BE RINGING +; MOV #LINENB+LINDTR,@DMLSR(A) ;ANSWER THE PHONE + +10$: BIT #LINCTS,@DMLSR(A) ;DO WE HAVE CLEAR-TO-SEND? + BEQ 20$ ;NO + TST DIALED(I) ;YES, WHAT WAS PREVIOUS STATE? + BEQ 13$ ;WAS OFF, THIS IS A DIALUP + BPL 90$ ;WAS ON, IGNORE + NEG DIALED(I) ;WAS HANGING UP, ABORT IT + BR 90$ + +13$: INC DIALED(I) ;LINE IS NOW DIALED UP + TST DMINI ;IF GETTING INITIAL STATE, + BNE 90$ ;DON'T HACK AUTOSPEED + TST AUTOSP(I) ;IF IT HAS AUTOSPEED, + BEQ 90$ + MOV HDWR(I),H ;HACK THAT + CALL ASPMD + BR 90$ + +20$: TST DIALED(I) ;CTS DROPPED + BMI 90$ ;ALREADY KNOWN ABOUT, IGNORE + MOV #-HNGDLY,DIALED(I) ;OTHERWISE START HANGUP TIMEOUT + +90$: BIC #DMDON,@DMCSR(A) ;RESTART SCANNER + POP + POP H + RTI +.ENDC ;NDMS + +.IFNZ GOULDP +.SBTTL GOULD PRINTER P.I. LEVEL + +GLPBRK: BIT #%GSBSY,@#GLPCSR + BEQ 1$ + RTI ;LPT BUSY, WAIT + +1$: BIT #%GSDON,@#GLPCSR + BNE 2$ + RTI ;LPT BUSY OTHER FLAVOR + +2$: PUSH + BIT #%GSERR,@#GLPCSR ;LPT LOSING? + BEQ GLPBR1 + CALL GLPRST ;YUP, RESET THE BUFFERS + MOV @#GLPCSR,GLPERR ;AND TELL 10 + +GLPOFF: CLR GLPOAC ;HERE TO STOP P.I. + MOV #%GCIOF,@#GLPCSR + MOV #5000.,A ;LPT SOMETIMES BUSY FOR A WHILE +1$: BIT #%GSBSY,@#GLPCSR ;HAVE TO WAIT SO TONER PUMPS WILL + BEQ 2$ ;REALLY TURN OFF + SOB A,1$ +2$: MOV #%GCOFF,@#GLPCSR +GLPEX: POP + RTI + +GLPFIN: MOV #%GBIDL,GB.STA(H) ;DONE WITH THIS BUFFER + MOV GB.NXT(H),H ;CHECK NEXT + MOV H,GLPOOP + +GLPBR1: MOV GLPOOP,H ;CHECK ON BUFFERS + CMP GB.STA(H),#%GBDMA ;FINISH DMA XFER? + BEQ GLPFIN ;YES + CMP GB.STA(H),#%GBWRT ;QUEUED OR ALREADY ACTIVE AT P.I.? + BLT GLPOFF ;NO, STOP + MOV #%GBPI,GB.STA(H) ;YES, ACTIVATE IT AT P.I. + TST GB.FF(H) ;NEED FF? + BEQ 1$ + MOV #%GCFF,@#GLPCSR ;YES + CLR GB.FF(H) + BR GLPEX + +1$: TST GB.NL(H) ;NEED BLANK LINES? + BEQ 2$ + DEC GB.NL(H) ;YES, GIVE ONE + MOV #%GCADV,@#GLPCSR + BR GLPEX + +2$: MOV H,B ;SET UP TEXT ADDR + ADD #GB.DAT,B + MOV GB.PNT(H),A ;SET UP TEXT WORD COUNT + NEG A + MOV A,@#GLPWC + MOV B,@#GLPCA ;START XFER + MOV #%GBDMA,GB.STA(H) ;FLAG BUFFER ACTIVE AT DMA LEVEL + BR GLPEX + +GLPRST: PUSH H + MOV #GLPBFF,H ;FLUSH ALL BUFFERS + MOV H,GLPOOP + MOV H,GLPOIP +3$: CLR (H)+ + MOV (H),H + CMP H,#GLPBFF + BNE 3$ + MOV #60.*10.,GLPTIM ;SET TIMEOUT + POP H + RET + +.ENDC ;GOULDP + +.IFNZ CHAOSP + + .SBTTL CHAOSNET ROUTINES + +;ALL ROUTINES ON THIS PAGE CALLED WITH INTERRUPTS MASKED, INDEX IN I. + +;REFILL FROM CHAOS INTERFACE +CHSRFL: BIS #%CAREN,@CHIHWR(I) ;TURN ON RECEIVER INTERRUPTS + RET ;WILL NOTICE INPUT LATER + +.IFNZ DL10P +;LOOPS BACK TO HERE WHEN DISCARDING A PACKET +DLCRF1: CMP (SP)+,(SP)+ ;POP + POP A + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + ;DROP INTO DLCRFL +;REFILL FROM DL10 +DLCRFL: CALL DLCCHK ;SEE IF DL10 IS DISABLED + BNE 99$ ;BRANCH IF YES + MOV #2,A ;CHECK BOTH 10 TO 11 BUFFERS SO CAN'T GET OUT OF PHASE WITH 10 +10$: CMP DLCSS1(A),#1 ;10 SAYS BUFFER READY? + BEQ 11$ ;YES + SUB #2,A ;NO, TRY NEXT + BPL 10$ + BR 99$ ;NONE READY + +11$: PUSH A ;SAVE CURRENT 10 TO 11 BUFFER + ADD #DLCSP1,A ;OUTPUT READY, GET IT + MOV #DLCIBF,B ;COPY INTO BUFFER +.REPT PKHDW ;FIRST GET HEADER + MOV (A),(B)+ +.ENDR + PUSH + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS DLCRF1 ;BRANCH IF PACKET NO GOOD + POP + PUSH C + SUB CHIHDL(I),C ;GET NUMBER OF DATA WORDS TO FOLLOW + CALL MOVHD ;MOVE THOSE WORDS + POP ;RESTORE LENGTH, 10 TO 11 BUFFER NUMBER + INC DLCSS1(A) ;2 ;INDICATE BUFFER HAS BEEN COPIED + BIS #DLX10I,DLXCSR ;AND INTERRUPT THE PDP10 + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +;TRANSMIT TO DL10 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +DLCXMT: CALL DLCCHK ;DL10 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + MOV DLCRBN,A ;GET CURRENT 11 TO 10 BUFFER NUMBER + CMP DLCRS1(A),#1 ;BUFFER READY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXDLC,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHILNG(D),C ;AND LENGTH + MOV CHIBFP(D),D + MOV A,H ;GET POINTER TO DL10 MAGIC IDPB WORD + ADD #DLCRP1,H + CALL MOVDH ;COPY WORDS INTO PDP10 + INC DLCRS1(A) ;SIGNAL DATA AVAILABLE TO PDP10 + BIS #DLX10I,DLXCSR ;AND INTERRUPT IT + MOV DLCNXT(A),DLCRBN ;SWITCH BUFFERS +70$: JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXDLC ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;CALL HERE WHEN DL10 INTERRUPTS, CLOBBERS ALL. +DLCWAK: MASK 5 + TST CHOSTS+CHXDLC ;DL10 HUNG ON TRANSMIT? + BEQ 10$ + MOV #CHXDLC,I ;YES, WAKE IT UP + CALL DLCXMT +10$: TST CHISTS+CHXDLC ;DL10 INPUT ACTIVE? + BNE 20$ + MOV #CHXDLC,I ;NO, TRY TO GET SOME + CALL DLCRFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +;RETURN 'NE' IF DL10 IS DISABLED, BASHES NOTHING. +DLCCHK: TST DLXOFF + BNE 99$ + TST NO.ITS + BNE 99$ + TST DLCINI ;RE-INITIALIZE? + BEQ 99$ ;NO, EVERYTHING IS OK. + CLR DLCRBN ;YES + TST CHOSTS+CHXDLC ;WAS OUTPUT HUNG ON DL10? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON DL10 + MOV #CHXDLC,I + CALL CHSODN + POP +90$: CLR DLCINI ;SIGNAL INIT DONE, RETURN 'EQ' +99$: RET +.ENDC ;DL10P + +;FAST BLOCK MOVE +;THESE CAN MOVE AT MOST 256. WORDS + +;MOV (H),(D)+ +;SOB C,.-2 +MOVHD: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (H),(D)+ + .ENDR + RET + +;MOV (D)+,(H) +;SOB C,.-2 +MOVDH: SUB #256.,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO MOVE TABLE + .REPT 256. + MOV (D)+,(H) + .ENDR + RET + +.IFNZ TEN11P +;REFILL FROM TEN-11 INTERFACE +T11RFL: CALL T11CHK ;CHECK FOR DISABLE + BNE 99$ ;BRANCH IF DISABLED + MOV T11IBP,A + TST T11IBA ;WAS INPUT BUFFER IN USE? + BEQ 10$ + CLR (A)+ ;YES, INDICATE BUFFER IS NOW EMPTY + CLR (A) + CLR T11IBA + ADD #T11BFL-2,A ;ADVANCE POINTER + CMP A,#T11IBE + BLO 7$ + MOV #T11IBF,A +7$: MOV A,T11IBP +10$: TST (A) ;INPUT BUFFER CONTAIN A PACKET? + BEQ 99$ ;NO + SETOM T11IBA ;YES, INPUT BUFFER NOW ACTIVE + ADD #8,A ;GET INPUT FROM PDP10 + MOV A,CHIBFP+CHXT11 ;AS CURRENT INPUT BUFFER + CALL CHSIHD ;PROCESS THE HEADER + BVS T11RFL ;BRANCH IF PACKET NO GOOD + PUSH ;COMPUTE CHECKSUM BEFORE SWABBING + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + SUB #PKFCMS+1,PKFC(A) ;DECREMENT FWD COUNT (IS HIGH END OF WORD) + ;FWD COUNT HAS TO BE PUT BACK FOR CHECKSUM COMPUTATION +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11IBP,A ;NOW COMPARE CHECKSUM + CMP H,4(A) + BNE 30$ + CMP D,6(A) + BNE 30$ + POP + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + TST B ;SWAB IF NOT TO 10-COMPATIBLE DEST + CALL SWAB10 + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND +99$: RET + +30$: POP ;CHECKSUM ERROR + INC T11CKE ;COUNT CHECKSUM ERRORS + BR T11RFL ;AND IGNORE PACKET + +;TRANSMIT TO TEN11 OUTPUT SINK +;REQUIRES I TO BE SET UP, SMASHES ALL REGS. +T11XMT: CALL T11CHK ;TEN11 DISABLED? + BNE 70$ ;YES, DISCARD PACKET + TST @T11OBP ;OUTPUT BUFFER EMPTY? + BNE 80$ ;NO, WAIT + MOV CHOINX+CHXT11,D ;GET ADDRESS OF BUFFER TO BE SENT OVER + MOV CHIBFP(D),B + MOV CHILNG(D),C ;AND LENGTH + MOV PKNBYT(B),A + BIT #1,A ;IF ODD NUMBER OF BYTES, CLEAR THE EXTRA ONE + BEQ 5$ + BIC #PKNBMS,A + ADD B,A + CLRB PKDAT-1(A) ;NOTE, AT THIS POINT BYTES ARE SWAPPED +5$: MOV T11OBP,A ;COPY INTO TEN11 OUTPUT BUFFER + ADD #8,A + PUSH +10$: MOV (B)+,(A)+ + SOB C,10$ + MOV (SP),C ;NOW COMPUTE CHECKSUM + INC C ;C GETS NUMBER OF 32-BIT WORDS + ASR C + BCS 11$ + CLR (A)+ ;IF ODD NUMBER OF 16-BIT WORDS, CLEAR THE EXTRA ONE +11$: CLR D ;CLEAR LOW WORD OF CHECKSUM + CLR H ;CLEAR HIGH WORD OF CHECKSUM + MOV T11OBP,A + ADD #8,A +21$: ADD (A)+,H ;ADD HIGH HALFWORD TO HIGH SUM + ADD (A)+,D ;ADD LOW HALFWORD TO LOW SUM + ADC H ;CARRY INTO HIGH SUM + MOV D,B ;NOW ROTATE RIGHT DOUBLE + ROR B + ROR H + ROR D + SOB C,21$ + MOV T11OBP,A ;STORE CHECKSUM INTO OUTPUT BUFFER + MOV H,4(A) + MOV D,6(A) + POP + SETOM (A) ;SIGNAL PRESENCE OF PACKET TO PDP10 + ADD #T11BFL,A ;ADVANCE POINTER + CMP A,#T11OBE + BLO 30$ + MOV #T11OBF,A +30$: MOV A,T11OBP +70$: CLR T11TIM ;NO TIMEOUT, 10 IS TAKING PACKETS + JMP CHSODN ;TRANSMISSION IS DONE ALREADY + +80$: MOV #1,CHOSTS+CHXT11 ;TRANSMISSION AWAITING BUFFER FROM 10 + RET + +;WHACK YOUR TEN11 +T11WAK: MASK 5 + MOV #CHXT11,I + CALL T11CHK ;IS 10 UP? + BNE 30$ ;IT'S DOWN, PUNT IT + TST CHOSTS(I) ;TEN11 HUNG ON TRANSMIT? + BEQ 10$ + CALL T11XMT ;YES, WAKE IT UP +10$: TST CHISTS+CHXT11 ;TEN11 INPUT ACTIVE? + BNE 20$ + MOV #CHXT11,I ;NO, TRY TO GET SOME + CALL T11RFL + TST CHISTS(I) ;GOT SOME? + BLE 20$ + CALL CHSOUT ;YES, START TRANSMISSION +20$: CALL CHSRUN ;DO ANYTHING ELSE REQUIRED + UNMASK + RET + +30$: TST CHOSTS(I) ;TRANSMITTING TO DEAD TEN-11? + BEQ 20$ + CLR T11TIM ;YES, FLUSH IT + CALL CHSODN + BR 20$ + +;CHECK TEN-11 INTERFACE, DO RESET IF NECESSARY, RETURN 'NE' IF DISABLED. +;SMASHES NOTHING. +T11CHK: CMP T11TIM,#5*60. ;10 TAKING 5 SECONDS TO RESPOND? + BLO 5$ + SETOM T11I10 ;YES, DECLARE IT DOWN, REINITIALIZE PROTOCOL +5$: TST T11I10 ;IS 10 DONE INITIALIZING? + BNE 99$ ;NO, DO NOTHING + TST T11I11 ;ARE WE SUPPOSED TO INITIALIZE? + BEQ 99$ ;NO, IT'S OK + MOV #T11OBF,T11OBP ;YES, REINITIALIZE POINTERS + MOV #T11IBF,T11IBP + PUSH A + MOV #T11OBF,A ;INITIALIZE INPUT AND OUTPUT BUFFER HEADERS +10$: CLR (A)+ ;CLEAR INTER-MACHINE SIGNAL WORD + CLR (A)+ + ADD #T11BFL-4,A ;SKIP THE REMAINING WORDS + CMP A,#T11IBE + BLO 10$ + CLR T11IBA ;IDLE THE INPUT + POP A + TST CHOSTS+CHXT11 ;WAS OUTPUT HUNG ON TEN11? + BEQ 90$ + PUSH ;YES, SIGNAL OUTPUT DONE ON TEN11 + MOV #CHXT11,I + CALL CHSODN + POP +90$: CLR T11I11 ;SIGNAL INIT DONE, RETURN 'EQ' + CLR T11I11+2 +99$: RET +.ENDC ;TEN11P + +;THIS ROUTINE PROCESSES THE HEADER OF PACKET IN INPUT BUFFER FOR SOURCE I +;RETURN DESTINATION OUTPUT SINK INDEX IN B (-1 IF THIS IS FOR US (PDP11 ITSELF)), +;PACKET BUFFER POINTER IN A, AND LENGTH IN WORDS IN C. +;RETURNS WITH OVERFLOW SET IF PACKET IS DISCARDED BECAUSE OF +;TOO MUCH FORWARDING, BAD ADDRESS, TOO BIG, CRUFTY, ETC. +;OTHERWISE RETURNS WITH MINUS INDICATOR SET IF PACKET DIRECTED TO 11. +CHSIHD: ADD #1,NPKSI(I) ;COUNT PACKETS IN FROM THIS SOURCE + ADC HPKSI(I) + MOV CHIBFP(I),A ;POINTER TO PACKET + TSTB (A) ;CHECK FOR MUPPET + BNE CHSIHB ;DISCARD, WE DON'T SUPPORT THEM + MOV #PKHDW,CHIHDL(I) ;SET HEADER LENGTH + ADD #PKFCMS+1,PKFC(A) ;INCREMENT FWD COUNT (IS HIGH END OF WORD) + BCS CHSIHB ;BRANCH IF FORWARDING LOOP + MOV PKNBYT(A),C ;GET BYTE COUNT + BIC #PKNBMS,C + CMP C,#DATMAX + BHI CHSIHB ;TOO LONG, LOSES + INC C ;MAKE WORD COUNT + ASR C + ADD CHIHDL(I),C ;ADD IN LENGTH OF HEADER + MOV C,CHILNG(I) ;SAVE FOR LATER USE + ;; NOW ROUTE THIS PACKET + MOV #-1,B ;MAGIC INDEX MEANING "MYSELF" + MOV PKDHST(A),D ;GET DESTINATION ADDRESS + ;HERE WE HAVE HAIR FOR MULTIPLE CHAOSNETS +.REPT CHAOSP + CONC ,\.RPCNT ;ADDRESSED TO PDP11 ITSELF? + BEQ 50$ ;YES, LET CHSRUN HANDLE IT LATER +.ENDR ;CHAOSP + CMPB PKOP(A),#%CORUT ;ROUTING INFO PACKET? + BEQ 40$ ;YES, ADDRESS TO PDP11 + TST USECBL ;SUPPOSED TO USE CABLE EVEN TO TALK TO SELF? + BEQ 20$ + CMP I,#CHXCHS ;YES, IS THIS COMING FROM CABLE? + BHIS 20$ ;YES, ROUTE REGULAR WAY + MOV #CHXCHS,B ;NO, SEND TO SELF ON FIRST CABLE + MOV #CHADD,D + BR 39$ + +20$: MOVB PKDHST+1(A),B ;GET SUBNET ADDRESSED TO + CMP B,#NSUBNT + BLO 21$ + CLR B ;OUT OF RANGE, USE 0 +21$: ASL B ;MAKE INDEX INTO SUBNET TABLES + TST SBNTYP(B) ;IS THIS A DIRECT HARDWARE CONNECTION? + BGT 38$ ;YES, SEND TO IT + MOV SBNADR(B),D ;NO, GO VIA GATEWAY + BEQ CHSIRF ;HAVEN'T GOT A GATEWAY, AND BROADCAST CODE NOT WORKING YET + MOVB SBNADR+1(B),B ;GET SUBNET GATEWAY IS ON + ASL B ;MAKE INDEX INTO TABLES + CMP B,#NSUBNT*2 + BHIS CHSIRF ;OUT OF RANGE, CAN'T GET THERE FROM HERE + TST SBNTYP(B) ;IS THIS A DIRECT CONNECTION? + BLE CHSIRF ;NO, CAN'T GET THERE FROM HERE (SHOULDN'T HAPPEN!) +38$: MOV SBNADR(B),B ;GET SINK INDEX +39$: MOV D,CHICBA(I) ;STORE CABLE ADDRESS OF IMMEDIATE DEST (GATEWAY) +.IIF NDF NDVRBF, 50$: ;IF NO DOVER, ALL TO-11 PACKETS COME HERE +40$: MOV B,CHIOUX(I) ;STORE SINK INDEX, SET INDICATORS + RET ;NOTE THAT MOV CLEARS OVERFLOW + +.IF DF NDVRBF +50$: CMP PKDIND(A),DVRLIX ;DIRECTED TO DOVER? + BNE 40$ ;NO, TO 11 + CMP PKSHST(A),DVRHST + BNE 40$ ;NOT DOVER-CONNECTED HOST + CMP PKSIND(A),DVRIDX + BNE 40$ ;RIGHT HOST, WRONG PROCESS + MOV #CHXDVR,B ;ROUTE PACKET TO DOVER GATEWAY + BR 40$ +.ENDC ;NDVRBF + +;HERE FOR ROUTING FAILURE. METER, RETURN WITH OVERFLOW SET. +CHSIRF: INC NPKSRF + MOV B,RFSBNT ;SAVE 2* SUBNET TRYING TO GET TO + ;FALL INTO CHSIHB +;HERE WHEN CHSIHD SEES A GARBAGE PACKET. RETURN WITH OVERFLOW SET. +CHSIHB: ADD #1,NPKSBD(I) ;GOD-DAMN BRAIN-DAMAGE + ADC HPKSBD(I) + SEV + RET + +;SWAB PACKET COMING FROM PDP-10 OR ETHERNET (BYTES LEFT TO RIGHT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB10: BMI CHSSWB ;SWAB IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ CHSSWB ;PDP11 OR CHAOSNET, SWAB IT OUT +5$: RET ;PDP10 OR ETHERNET, LEAVE ALONE + +;SWAB PACKET COMING FROM PDP-11 OR CHAOSNET (BYTES RIGHT TO LEFT) +;IF GOING TO INCOMPATIBLE DESTINATION. CALL RIGHT AFTER CHSIHD. +SWAB11=. + BMI 5$ ;RETURN IF TO-11 + CMP CHOXMT(B),#CHSXMT ;CHECK DESTINATION TYPE + BEQ 5$ ;PDP11 OR CHAOSNET, LEAVE ALONE + ;PDP10 OR ETHERNET, SWAB IT OUT + ;DROPS THROUGH INTO CHSSWB +;THIS ROUTINE SWABS THE PACKET FOR THE SOURCE IN I. +;CALLED WITH NUMBER OF WORDS IN PACKET IN C. +;CLOBBERS A, C, AND D. +;SUITABLE FOR CALLING RIGHT AFTER CHSIHD RETURNS. +CHSSWB: MOV CHIBFP(I),A ;ADDRESS OF PACKET + SUB CHIHDL(I),C ;GET LENGTH OF DATA AREA IN WORDS + BLE 99$ ;EMPTY + MOVB PKOP(A),D ;GET OPCODE + BPL 5$ ;BRANCH IF NON-DATA + BIT #100,D ;CHECK FOR BINARY DATA + BEQ 10$ ;NO, GO SWAB +99$: RET + +5$: TSTB CHSBIN(D) ;CONTROL, LOOK UP OPCODE + BNE 99$ ;BINARY, NO SWAB +10$: ADD CHIHDL(I),A ;POINT TO DATA AREA OF BUFFER + ADD CHIHDL(I),A ;BYTES, WATSON, BYTES! + SUB #PKTMXW,C ;GET -#WDS LESS THAN MAXIMUM + ADD C,C ;CONVERT TO BYTES + SUB C,PC ;JUMP INTO SWAB TABLE + .REPT PKTMXW + SWAB (A)+ + .ENDR + RET + +;BYTE TABLE INDEXED BY OPCODE, NON-ZERO IF BINARY +;BINARY OPERATIONS ARE 2 (%COOPN), 7 (%COSTS), 10 (%CORUT) +CHSBIN: .BYTE 0,0,2,0,0,0,0,7,10,0,0,0,0,0 + .BYTE 0,0 ;SPARES IN CASE MORE OPCODES ADDED + .EVEN + +;TRANSMIT PACKET FROM INPUT SOURCE I TO OUTPUT SINK, IN B. +;SMASHES ALL REGISTERS. CHISTS(I), CHIOUX(I), CHICBA(I) MUST BE ALREADY SET UP. +CHSOUT: TST B ;THIS DESTINED TO PDP11? + BMI CHSOUX ;YES, LET CHSRUN PICK IT UP LATER + TST CHOSTS(B) ;IS SINK BUSY? + BNE CHSOUX ;YES, CAN'T SEND NOW, WILL TRY AGAIN LATER + NEG CHISTS(I) ;NO, SET SOURCE STATUS TO CONNECTED + MOV I,CHOINX(B) ;CONNECT SINK TO SOURCE + MOV B,I ;SET UP SINK INDEX + ADD #1,NPKSO(I) + ADC HPKSO(I) + JMP @CHOXMT(I) ;GO START TRANSMISSION TO SINK + +;CALL HERE WHEN OUTPUT IS DONE ON SINK I. +CHSODN: CLR CHOSTS(I) ;IDLE THE SINK + PUSH I + MOV CHOINX(I),I ;GET CORRESPONDING SOURCE + CLR CHISTS(I) ;IDLE IT + CALL @CHIRFL(I) ;TELL SOURCE IT'S DONE, TRY TO GET MORE INPUT + POP I +CHSOUX: RET + +;CALL HERE AFTER EACH PACKET TRANSFER TO INITIATE AS MANY ADDITIONAL TRANSFERS +;AS POSSIBLE. BASHES ALL REGISTERS. ON DL10 AND TEN11, WE COULD ACTUALLY DO SEVERAL +;TRANSFERS BEFORE RETURNING. +CHSRUN: +.IF DF NDVRBF + CALL DVRRFL ;WAKE UP DOVER, MIGHT BE TIME TO RETRANSMIT +.ENDC ;NDVRBF + MOV #*2,I ;SCAN ALL INPUT SOURCES +CHSRN1: TST WAKE ;GIVE UP IF CLOCK HAS TICKED, LET TTYS RUN + BNE CHSOUX + TST CHISTS(I) ;IS THIS SOURCE LOOKING FOR A SINK? + BLE CHSRN3 +CHSRN2: MOV CHIOUX(I),B ;GET SINK IT WANTS TO SEND TO + BMI FOR11 ;BRANCH IF FOR PDP11 + TST CHOSTS(B) ;SINK AVAILABLE? + BNE CHSRN3 ;NO, LET INPUT SIT + CALL CHSOUT ;YES, ATTEMPT TO TRANSMIT + BR CHSRUN ;LOOK FOR MORE WORK + +CHSRN3: SUB #2,I ;NEXT INPUT SOURCE + BGE CHSRN1 + RET ;NOTHING LEFT TO DO + +FOR11: MOV CHIBFP(I),A ;PACKET FOR PDP11, CHECK IT OUT + MOVB PKOP(A),B ;GET OPCODE + CMP B,#%CORUT ;IF ROUTING INFO, GOBBLE IT + BEQ CHARUT + CMP B,#%CORFC ;ALL WE KNOW IS RFC TO CERTAIN CONTACT NAMES + BNE FOR11J ;BARF AT JUNK PACKETS + CALL SERVE ;RUN THE SERVER + BEQ FOR11X ;IT DIDN'T LIKE IT +FOR11R: PUSH ;INTERCHANGE SOURCE AND DESTINATION + MOV PKSHST(A),PKDHST(A) + MOV PKSIND(A),PKDIND(A) + POP + CALL CHSIHD ;ROUTE + BVS FOR11X ;NO GOOD, FLUSH (SOURCE IN PACKET WAS WRONG) + CALL SWAB11 ;SWAB IF GOING TO 11-INCOMPATIBLE DEST + BR CHSRN2 ;FIRE IT OFF (CHISTS IS ALREADY 1) + +FOR11X: CLR CHISTS(I) ;DISCARD THIS PACKET + CALL @CHIRFL(I) + BR CHSRUN ;LOOK FOR MORE WORK + +;PACKET FROM RANDOM PLACE DIRECTED TO 11, TELL HIM TO GO AWAY +FOR11J: CMP B,#%COLOS ;DON'T BARF AT LOS PACKETS + BEQ FOR11X + MOV #<%COLOS*400>,(A) + MOV #6$-5$-1,PKNBYT(A) + MOV #5$,B + MOV A,C + ADD #PKDAT,C +1$: MOVB (B)+,(C)+ + BNE 1$ + BR FOR11R ;SEND OFF THE LOS +5$: .ASCIZ /Packet unrecognized by gateway-11/ +6$: .EVEN + +;ROUTING PACKET +CHARUT: MOV CHILNG(I),C ;GET NUMBER OF DATA WORDS + SUB #PKHDW,C + ASR C ;MAKE NUMBER OF 2 WORD PAIRS + BEQ FOR11X ;MIGHT BE ZERO-LENGTH + MOV A,D + ADD #PKDAT,D ;POINT TO START OF PACKET'S DATA +61$: MOV (D)+,B ;GET SUBNET BEING TALKED ABOUT + CMP B,#NSUBNT ;ONE WE KNOW ABOUT? + BHIS 62$ ;NO, FORGET IT + ASL B ;MAKE WORD INDEX + TST SBNTYP(B) ;IS THIS AN AUTO ROUTING TYPE SUBNET? + BNE 62$ ;NO, DON'T MUNG OUR FIXED ROUTING INFO + CMP (D),SBNCST(B) ;COMPARE COSTS + BHI 62$ ;NEW ONE WORSE (IF EQUAL, SWITCH TO EQUALIZE LOAD) + MOV (D),SBNCST(B) ;SAVE BEST COST + MOV PKSHST(A),SBNADR(B) ;AND HOST ADDRESS THIS CAME FROM AS BEST BET +62$: TST (D)+ ;SKIP COST + SOB C,61$ + BR FOR11X ;DONE WITH PACKET + + .SBTTL CHAOS NET SERVERS + +;CALLED WITH PACKET IN A. +;MUST PRESERVE A,I. +;RETURN 'EQ' IF NO GOOD, 'NE' IF MODIFIED PACKET TO BE RETURNED TO SOURCE + +;CURRENTLY WE SERVE THE FOLLOWING CONTACT NAMES: +; STATUS - RETURNS ANS WITH THE NAME OF THE MACHINE, LATER WILL HAVE OTHER DATA +; PULSAR - RETURNS ANS WITH DATA OF 1 BYTE, VALUE OF PULSON AS AN ASCII DIGIT, +; I.E. "0" MEANS OFF, "1" MEANS 60 PER SECOND, ETC. +; IF CONTACT NAME IN RFC IS FOLLOWED BY A SPACE AND AN ASCII DIGIT, +; SETS PULSON TO THAT STATUS. +; DOVER - DOVER PROTOCOL TRANSLATOR + +;NOTE THAT WE DON'T USE THE MOST WINNING STRING COMPARE IN THE WORLD, +;THIS CODE ASSUMES IT DOESN'T MATTER WHAT HAPPENS IF AN RFC TO +;AN UNKNOWN CONTACT NAME IS DONE, AS LONG AS THE 11 DOESN'T CRASH. + +SERVE: MOV #SRVTBL,B ;ADDRESS OF SERVER TABLE +10$: MOV (B)+,D ;ADDRESS OF CONTACT NAME FOR THAT SERVER + BEQ 99$ ;EXIT IF TABLE EXHAUSTED, 'EQ' IN COND CODE + MOV A,C + ADD #PKDAT,C ;ADDRESS OF CONTACT NAME IN THIS RFC +11$: TSTB (D) ;END OF STRING? + BEQ 20$ ;YUP, RUN THIS SERVER + CMPB (C)+,(D)+ ;DO STRING COMPARE + BEQ 11$ ;MATCHES + TST (B)+ ;DOESN'T MATCH, TRY NEXT + BR 10$ + +99$: RET + +20$: JMP @(B)+ ;CALL SERVER, IT CAN RETURN EQ OR NE + +SRVTBL: .WORD 1$,STSSRV ;STATUS - RETURN HOST NAME AND METERS + .WORD 2$,PLSSRV ;PULSAR - SET AND GET PULSAR RATE +.IIF DF NDVRBF, .WORD 3$,DVROPN ;DOVER - DOVER PROTOCOL TRANSLATOR + .WORD 0 ;END OF TABLE +1$: .ASCIZ /STATUS/ +2$: .ASCIZ /PULSAR/ +3$: .IIF DF NDVRBF, .ASCIZ /DOVER/ + .EVEN + +;SERVERS MUST PRESERVE A (PACKET), AND I, AND RETURN 'NE' IF TO BE SENT BACK TO SOURCE. +;NOTE THAT C POINTS AT THE NEXT BYTE AFTER THE CONTACT NAME + +STSSRV: MOV A,B ;RFC TO "STATUS", CHANGE INTO ANS CARRYING APPROPRIATE DATA. + MOV #32.+<12.*NCHX>+<24.*CHAOSP>+<12.*ETHERP>,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + ADD #PKDAT,B + MOV #HSTNAM,D ;SEND NAME OF HOST + MOV #32.,C +45$: MOVB (D)+,(B)+ + SOB C,45$ + CLR D ;NOW STORE METERING INFO FOR EACH SUBNET +50$: MOV CHXSBN(D),(B)+ ;STORE SUBNET NUMBER+400 + MOV #4,(B)+ ;ASSUME NOT A CABLE + MOV NPKSI(D),(B)+ + MOV HPKSI(D),(B)+ + MOV NPKSO(D),(B)+ + MOV HPKSO(D),(B)+ +.IFNZ ETHERP + CMP D,#CHXETH ;ETHERNET HAS SOME OF THESE COUNTERS + BNE 55$ + MOV #12.,-10.(B) ;THERE ARE 4 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + CLR (B)+ + CLR (B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + BR 59$ +.ENDC ;ETHERP +55$: CMP CHIRFL(D),#CHSRFL ;CHAOSNET CABLE? + BNE 59$ ;NO, THAT'S ALL + MOV #16.,-10.(B) ;YES, THERE ARE 6 MORE DOUBLE-WORDS + MOV NPKSAB-CHXCHS(D),(B)+ + MOV HPKSAB-CHXCHS(D),(B)+ + MOV NPKSLS-CHXCHS(D),(B)+ + MOV HPKSLS-CHXCHS(D),(B)+ + MOV NPKSGB-CHXCHS(D),(B)+ + MOV HPKSGB-CHXCHS(D),(B)+ + MOV NPKSRL-CHXCHS(D),(B)+ + MOV HPKSRL-CHXCHS(D),(B)+ + CLR (B)+ ;I DON'T KEEP TRACK OF BIT COUNT ERRS SEPARATELY + CLR (B)+ + MOV NPKSBD(D),(B)+ + MOV HPKSBD(D),(B)+ +59$: TST (D)+ + CMP D,#2*NCHX + BLO 50$ +RETANS: MOVB #%COANS,PKOP(A) ;RETURN THIS PACKET TO SOURCE AS AN 'ANS' + RET ;NOTE CONDITION CODES HAVE 'NE' + +PLSSRV: MOVB PKNBYT(A),C ;GET BYTE COUNT, SHOULD BE SMALL + CMP C,#8 ;6 FOR PULSAR, 1 FOR SPACE, 1 FOR CHARACTER + BLO 20$ ;NOT GIVEN AN ARGUMENT, JUST READ STATUS + MOVB PKDAT+7(A),C ;YES, GET THE ARGUMENT + SUB #'0,C ;CONVERT TO BINARY (CHEAPO!) + MOV C,PULSON ;CHANGE PULSON STATUS +20$: MOV #1,PKNBYT(A) ;SET BYTE LENGTH, CLEAR FORWARDING COUNT + MOV PULSON,C ;RETURN PULSAR STATUS + ADD #'0,C ;IN ASCII + MOVB C,PKDAT(A) + BR RETANS + + .SBTTL CHAOSNET INTERRUPT HANDLER + +;INTERRUPT HANDLER ENTRIES +.REPT CHAOSP +CONC CHS,\.RPCNT,BK: + JSR I,CHSBRK + CHXCHS+<.RPCNT*2> +.ENDR + +;SUBROUTINE TO ENABLE CHAOSNET INTERFACE IN H,I TO RECEIVE NEXT PACKET +CHINXT: MOVB 1(H),A ;GET CSR BITS 9-12 (LOST COUNT) + ASR A + BIC #-20,A + ADD A,NPKSLS-CHXCHS(I) + ADC HPKSLS-CHXCHS(I) + BIS #%CARCL+%CAREN,(H) ;MAKE READY TO RECEIVE ANOTHER MESSAGE + RET + +;COMMON CHAOS INTERRUPT ROUTINE +CHSBRK: MOV (I),I ;GET SOURCE/SINK INDEX + PUSH ;SAVE ALL REGISTERS + MOV CHIHWR(I),H ;GET HARDWARE ADDRESS + MOV (H),A .SEE CH%CSR ;GET CSR + BPL CHSBK1 ;TEST RECEIVE DONE, BRANCH IF NOT + .SEE %CARDN ;PALX SCREWS UP IF THIS IS ON PREVIOUS LINE! + TST CHISTS(I) ;MAKE SURE INPUT BUFFER IS IDLE + BNE CHSBK1 ;BUSY, DON'T LOOK AT RECEIVE DONE NOW + BIT #%CAERR,A ;CRC ERROR? + BNE CHICRC ;JUMP IF YES + MOV CH%RBC(H),C ;BIT COUNT -1 + SUB #47.,C ;ADD 1, THEN SUBTRACT 3*16. FOR HARDWARE WORDS + .IREPT 4, ASR C ;CONVERT TO NUMBER OF WORDS + CMP C,#256. + BHI CHIFLS ;THIS CAN ONLY HAPPEN IF HARDWARE BROKEN + ADD #CH%RBF,H ;POINT H TO RECEIVE DATA REG + MOV CHIBFP(I),D ;COPY PACKET INTO BUFFER + CALL MOVHD + TST (H) ;READ OUT THE 3 HARDWARE LEADER WORDS + CMP (H),(H) + SUB #CH%RBF,H ;RESTORE H + BIT #%CAERR,(H) ;WAS IT READ CORRECTLY OUT OF RAM? + BNE CHIGBG ;NO, GARBAGE + CMP CH%RBC(H),#7777 ;WAS PACKET CORRECT LENGTH? + BNE CHIGBG ;NO, GARBAGE + CALL CHINXT ;DONE WITH HARDWARE, ENABLE FOR NEXT + CALL CHSIHD ;PROCESS HEADER, GET LENGTH, DEST + BVS CHIFL0 ;BRANCH IF NO GOOD + CALL SWAB11 ;SWAB IF NOT GOING TO 11-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + PUSH I + CALL CHSOUT ;SEND IT OUT + POP I + MOV CHIHWR(I),H ;RESTORE H + TST CHISTS(I) ;INPUT BUFFER STILL BUSY? + BEQ CHSBK1 + BIC #%CAREN,(H) ;YES, CLEAR RECEIVE INTERRUPT ENABLE + BR CHSBK1 ;GO CHECK ON OUTPUT SIDE + +;HERE WHEN A PACKET WAS RECEIVED WITHOUT ERROR, BUT AFTER +;READING OUT OF THE RAM, CRC ERROR WAS SET. EITHER THE +;PACKET WAS THE WRONG LENGTH, OR THE RAM FAILED, OR THE +;HARDWARE RANDOMLY CLOBBERED IT. +;WE ALSO GET HERE IF THE BIT COUNT WAS NOT -1 AFTER ALL WORDS WERE READ. +CHIGBG: ADD #1,NPKSRL-CHXCHS(I) ;LOG THE ERROR + ADC HPKSRL-CHXCHS(I) + MOV H,CHSRLH + MOV CH%RBC(H),CHSRLC + BR CHIFLS ;GO RESET RECEIVER AND CHECK OUTPUT STATUS + +;HERE WHEN A PACKET IS RECEIVED WITH A CRC ERROR. DISCARD IT, +;BUT ALSO SAVE IT IN CHSGBF, CHSGBH, CHSGBS, CHSGBC FOR DEBUGGING (IF FTGARB). +CHICRC: ADD #1,NPKSGB-CHXCHS(I) + ADC HPKSGB-CHXCHS(I) +.IFNZ FTGARB + MOV H,CHSGBH + MOV (H),CHSGBS + MOV CH%RBC(H),CHSGBC + ADD #CH%RBF,H + MOV #CHSGBF,D + MOV #PKMAX,C + CALL MOVHD + SUB #CH%RBF,H ;DROP INTO CHIFLS +.ENDC ;FTGARB +;HERE TO IGNORE AN INPUT PACKET AND ENABLE HARDWARE FOR NEXT +CHIFLS: CALL CHINXT +CHIFL0: INC NPKSIG +;HERE TO CHECK ON TRANSMIT SIDE +CHSBK1: TSTB (H) .SEE %CATDN ;TRANSMIT DONE? + BPL CHSBKX ;NO, EXIT +.IFNZ CHSBTB + CLR CHSIDL(I) ;CLEAR TRANSMIT-DONE TIME-OUT +.ENDC ;CHSBTB + MOV CHOSTS(I),A ;WAS OUTPUT IN PROGRESS? + BEQ CHSBK6 ;NO, LOOK FOR OUTPUT + CMP A,#2 ;TRANSMIT ABORT DELAY COMPLETED? + BEQ 10$ + BIT #%CATAB,(H) ;NO, TRANSMIT ABORTED? + BEQ CHSBK4 ;NO + ADD #1,NPKSAB-CHXCHS(I) ;YES, METER IT, AND SET CHOSTS TO + ADC HPKSAB-CHXCHS(I) + INC CHOSTS(I) ;2 IF THIS IS FIRST TIME, OR 0 IF SECOND TIME + BEQ CHSBK4 ;LOST TWICE IN A ROW, GIVE UP + BR CHSBK5 ;TURN OFF INTERRUPT, DELAY FOR A WHILE + +10$: MOV #-1,CHOSTS(I) ;TRANSMIT ABORT DELAY COMPLETED, SET CHOSTS TO -1 + CALL CHSXM0 ;INITIATE RE-TRANSMISSION (CHOSTS ALREADY SET) + BR CHSBKX ;DISMISS + +CHSBK4: CALL CHSODN ;OUTPUT DONE +CHSBK6: PUSH I + CALL CHSRUN ;INITIATE MORE TRANSFERS + POP I + TST CHOSTS(I) ;DID IT INITIATE TRANSMISSION? + BNE CHSBKX ;YES, LEAVE INTERRUPT ENABLED. + MOV CHOHWR(I),H ;RESTORE H + TST CHXRTF(I) ;TIME TO BROADCAST ROUTING INFO? + BNE CHORUT ;YES + TST PULSON ;IS THIS FEATURE TURNED ON? + BEQ CHSBK5 ;NO, FLUSH + CMP PULSAR,PULSON ;NOTHING TO DO. TIME FOR A TEST MESSAGE? + BNE CHSBK5 ;NOPE, GO IDLE + MOV #52525,CH%WBF(H) ;WRITE A PACKET OF 3 HEADER WORDS, 0, 52525 + CLR CH%WBF(H) + MOV #-1,CH%WBF(H) ;TO HOST -1, WHICH IS NON-EXISTENT +CHSBK7: TST CH%XMT(H) ;INITIATE TRANSMISSION, DON'T ENABLE INTERRUPT +CHSBK5: BIC #%CATEN,(H) ;GO IDLE, CLEAR TRANSMIT INTERRUPT ENABLE +;HERE TO EXIT FROM CHAOS INTERRUPT. RESTORE REGS AND RETURN FROM INT +CHSBKX: POP + RTI + +.IIF NZ CH%WBF-CH%MYN, .ERR FOO CODE ASSUMES CH%WBF = CH%MYN + +;BROADCAST A PACKET FULL OF ROUTING INFO, SINCE WE ARE MORE OR LESS A GATEWAY +CHORUT: MASK 6 ;INHIBIT CLOCK INTERRUPTS SO COSTS DON'T CHANGE + ADD #CH%WBF,H ;ADDRESS WRITE BUFFER + MOV #%CORUT*400,(H) ;OPCODE + MOV #2*,A ;COUNT SUBNETS WHICH WE KNOW ANYTHING ABOUT (REASONABLE COST) + CLR B +5$: CMP SBNCST(A),#1000 + BHIS 6$ + ADD #4,B ;THIS ONE WILL GENERATE 2 WORDS +6$: SUB #2,A + BPL 5$ + MOV B,(H) ;BYTE COUNT + CLR (H) ;DESTINATION + CLR (H) ;.. + MOV (H),(H) ;SOURCE = CH%MYN + CLR (H) ;SOURCE INDEX + CLR (H) ;PACKET NUMBER + CLR (H) ;ACK NUMBER + MOV #2*,A ;GO THROUGH SUBNET TABLES + MOVB 1(H),C ;GET SUBNET THIS IS GOING OUT ON + ASL C + MOV SBNCST(C),C ;GET COST OF GETTING TO US FROM GUY WHO RECEIVES THIS +10$: CMP SBNCST(A),#1000 ;WAS THIS ONE INCLUDED IN BYTE COUNT? + BHIS 11$ ;NO, DON'T PUT IT IN PACKET + MOV A,B ;FIRST WORD IS SUBNET NUMBER + ASR B + MOV B,(H) + MOV SBNCST(A),B ;SECOND WORD IS COST + ADD C,B ;WHICH MUST INCLUDE COST OF GETTING TO US + MOV B,(H) +11$: SUB #2,A ;NEXT SUBNET + BPL 10$ + CLR (H) ;BROADCAST THIS PACKET + SUB #CH%WBF,H ;RESTORE H + CLR CHXRTF(I) ;CLEAR REQUEST FOR ROUTING PACKET + UNMASK + BR CHSBK7 ;FIRE IT OFF, DON'T ENABLE TRANSMIT-DONE INTERRUPT + +;INITIATE TRANSMISSION ON CHAOS INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +CHSXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING +CHSXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #CH%WBF,H ;ADDRESS THE WRITE BUFFER + MOV CHILNG(B),C ;GET WORD COUNT + CALL MOVDH ;COPY INTO HARDWARE + MOV CHICBA(B),(H) ;STORE CABLE DESTINATION + SUB #CH%WBF,H ;RESTORE H + TST CH%XMT(H) ;TRIGGER TRANSMISSION + BIS #%CATEN,(H) ;ENABLE DONE INTERRUPT + RET ;PI LEVEL WILL PICK UP OUTPUT + +.ENDC ;CHAOSP + +.IFNZ ETHERP + .SBTTL ETHERNET SUPPORT + +;ENABLE NEXT ETHERNET PACKET TO COME IN. +;SINCE WE ONLY HAVE ONE BUFFER, THIS SETS UP THE TRANSFER RATHER +;THAN JUST ENABLING THE INTERRUPT AS THE CHAOSNET DOES. +;THAT WOULDN'T WORK ANYWAY, BECAUSE THE HARDWARE IS SO TOTALLY BRAIN-DAMAGED. +ETHRFL: MOV CHIHWR(I),H + ADD #10,H + MOV #-,(H)+ ;- WORD COUNT, +1 FOR HARDWARE BUG + MOV #ETHIBF+,(H)+ ;BUFFER ADDRESS + MOV #101,(H) ;START, INTERRUPT-ENABLE + RET + +;INCOMING PUP TOO BIG. WE DON'T HAVE FRAGMENTATION, SO SEND A PUP ERROR REPORT +ETHBIG: MOV #ETHIBF+PKDAT,A ;COPY PUP HEADER INTO DATA FIELD + MOV A,C + MOV #ETHIBF+PKDAT+20.,B + .IREPT 10.,< MOV (A)+,(B)+ > + MOV #517.,(B)+ ;PACKET TOO LARGE ERROR + MOV #DATMAX,(B)+ ;MAX NUMBER OF BYTES ALLOWED + MOV #50$,A +5$: MOVB (A)+,(B)+ ;ASCII MESSAGE + BNE 5$ + INC B ;MESSAGE LENGTH IS EVEN. INCLUDE CHECKSUM IN COUNT. + SUB #ETHIBF+PKDAT,B ;GET PUP LENGTH + MOV B,(C)+ ;BUILD PUP HEADER NOW + MOV #4,(C)+ ;PUP TYPE = ERROR + CMP (C)+,(C)+ ;PUP ID SAME + .IREPT 3,< MOV 6(C),(C)+ > ;DESTINATION = ORIGINAL SOURCE + MOV #,(C)+ ;SOURCE = ME + .IREPT 2,< CLR (C)+ > ;SOURCE PORT ZERO + CALL ETHOUT ;TRANSMIT + JMP ETHINX ;DISMISS + +;The ascii message. This isn't as destroyed as it looks. +50$: .ASCIZ/UP Pot oalgr eotf tii n ahCoanstep caek.t/ + .EVEN + +;INPUT INTERRUPT +ETHIBK: PUSH + MOV #CHXETH,I + MOV CHIHWR(I),H + MOV 14(H),A ;PICK UP STATUS + CLR 14(H) ;CLEAR RECEIVE INTERRUPT ENABLE + CMP ETHIBF+PKDAT-2,#1000 ;TYPE = PUP? + BNE ETHIIX ;NO, IGNORE PACKET + TST 10(H) ;CHECK RESIDUAL WORD COUNT + BEQ ETHBIG ;PACKET TOO BIG, RESPOND WITH PUP ERROR + TST A ;CHECK COMBINED INPUT ERRORS BIT + BMI 70$ ;ERROR, IGNORE PACKET + MOV ETHIBF+PKDAT+10,A ;GET DESTINATION HOST + BEQ 5$ ;AND SEE IF BROADCAST OR SELF + CMP A,# + BNE 11$ ;NO, ROUTE AS REGULAR MESSAGE +5$: CMPB ETHIBF+PKDAT+2,#1 ;PUP TYPE = ECHO-ME? + BEQ ETHECO ;YES, ECHO IT (MAYBE TAKE THIS OUT AFTER 11 DEBUGGED) + CMPB ETHIBF+PKDAT+2,#200 ;GATEWAY INFORMATION REQUEST? + BNE 10$ + TST ETHIBF+PKDAT+12 ;NOT REALLY UNLESS DESTINATION SOCKET IS 2 + BNE 10$ + CMP ETHIBF+PKDAT+14,#2 + BNE 10$ + TST CHISTS+CHXEGT ;PSEUDO DEVICE AVAILABLE? + BNE ETHIIX + MOV #ETHIBF+PKDAT+4,A ;YES, SEND HIM SOME INFO + MOV #EGTPID,B + .IREPT 2,< MOV (A)+,(B)+ > ;COPY PUP ID + ADD #6,A ;COPY SOURCE HOST AND SOCKET INTO DESTINATION + .IREPT 3,< MOV (A)+,(B)+ > + CALL ETHRT1 + MOV #CHXETH,I ;I CLOBBERED BY ETHRT1 + BR ETHIIX + +10$: TST A ;DON'T HARASS REST OF NET WITH BROADCASTS + BEQ ETHIIX +11$: MOV #ETHIBF+PKDAT,A ;CHECK THE CHECKSUM + CALL PUPCKT + BNE 60$ ;BAD, COUNT AS RAM ERROR +.IF DF NDVRBF + CMP ETHIBF+PKDAT+10,DVRHST ;SEE IF ADDRESSED TO DOVER USER + BNE 12$ + CMP ETHIBF+PKDAT+14,DVRIDX + BNE 12$ + CALL DVRPUP ;YES, PROCESS + MOV #CHXETH,I + BR ETHIIX + +.ENDC ;NDVRBF +;TRANSLATE PUP AND SEND TO CHAOSNET +12$: MOV #ETHIBF,A ;FILL IN CHAOSNET HEADER + MOV #<%COUNC*400>,(A)+ ;PKOP + MOV ETHIBF+PKDAT+0,B ;PKNBYT (TOTAL PUP LENGTH = CHAOS DATA LENGTH) + INC B ;ROUND UP TO AN EVEN NUMBER + ASR B + ASL B + MOV B,(A)+ + MOV ETHIBF+PKDAT+10,(A)+ ;PKDHST + MOV ETHIBF+PKDAT+14,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+16,(A)+ ;PKSHST + MOV ETHIBF+PKDAT+22,(A)+ ;PKDIND (LOW HALF OF PUP PORT) + MOV ETHIBF+PKDAT+6,(A)+ ;PKPKN (LOW HALF OF PUP ID) + MOV #100001,(A)+ ;PKACN = PROTOCOL NUMBER + CALL CHSIHD ;PROCESS THIS HEADER, GET LENGTH, DEST + BVS ETHIIX ;IGNORE IF NO GOOD + CALL SWAB10 ;SWAB IF NOT GOING TO 10-COMPATIBLE DEST + INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + CALL CHSOUT ;SEND IT OUT + BR ETHINX ;ETHRFL WILL BE CALLED WHEN NECESSARY + +60$: ADD #1,NPKSRL-CHXCHS(I) ;COUNT ERRORS (SOFTWARE CHECKSUM) + ADC HPKSRL-CHXCHS(I) + BR ETHIIX + +70$: ADD #1,NPKSGB-CHXCHS(I) ;COUNT ERRORS (HARDWARE CHECKSUM) + ADC HPKSGB-CHXCHS(I) +ETHIIX: CALL ETHRFL ;AND READ ANOTHER PACKET +ETHINX: POP + RTI + +;ETHERNET PUP ECHO PROTOCOL +ETHECO: MOV #ETHIBF+PKDAT+10,A ;INTERCHANGE SOURCE AND DESTINATION + MOV A,B ;I DON'T BOTHER CHECKING CHECKSUM, BUT I DO GENERATE IT + .IREPT 3, PUSH (A)+ + .IREPT 3,< MOV (A)+,(B)+ > + .IREPT 3, POP -(A) + MOV #,(A) ;FIX SOURCE TO BE ME + INCB ETHIBF+PKDAT+2 ;SET PUP TYPE = 2 (I AM AN ECHO) + CALL ETHOUT ;SEND BACK OUT ON THE ETHERNET + BR ETHINX + +;GENERAL PURPOSE ROUTINE FOR TRANSMITTING INTERNALLY-GENERATED PUPS TO +;THE ETHERNET. FIXES THE DESTINATION ADDRESS (THIS IS HOW OTHER +;HOSTS FIGURE OUT WHAT SUBNET THEY ARE ON!), COMPUTES THE PUP CHECKSUM, +;AND INTERFACES TO THE PACKET SWITCH. CALLED WITH SOURCE INDEX IN I. +;CALL THIS WITH A PACKET THAT ALREADY HAS ITS BYTES IN ETHERNET ORDER. +;BASHES ALL REGISTERS. +ETHOUT: MOV CHIBFP(I),A + ADD #PKDAT,A ;ADDRESS OF PUP + TST 10(A) ;ONLY IF NOT BROADCASTING, + BEQ 10$ + TSTB 11(A) ;DESTINATION ADDRESS HAVE NETWORK NUMBER? + BNE 10$ + MOVB #ETHSBN,11(A) ;NO, PUT IT IN +10$: CALL PUPCKS ;INSERT CHECKSUM + MOV #CHXETH,B + MOV B,CHIOUX(I) + INC CHISTS(I) + JMP CHSOUT + +;INITIATE TRANSMISSION ON ETHER INTERFACE +;CALL WITH SINK NUMBER IN I, AT PI LEVEL OR MASKED. BASHES ALL REGS. +;PACKET IS ALREADY SWABBED INTO ETHERNET BYTE ORDER (REVERSE OF CHAOSNET). +ETHXMT: INC CHOSTS(I) ;SET CHOSTS TO 1, TRANSMIT STARTING + CLR A ;NO OUTPUT START DELAY +ETHXM0: MOV CHOHWR(I),H ;GET HARDWARE ADDRESS + MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),D ;GET PACKET ADDRESS + ADD #PKDAT,D ;GET PUP ADDRESS + MOV #1000,-(D) ;SMASH LAST 2 WORDS OF CHAOS HEADER. TYPE=PUP + MOV #ETHHSN,-(D) ;STORE SOURCE ADDRESS + MOVB 14(D),1(D) ;STORE DESTINATION ADDRESS + MOV 4(D),B ;GET PUP SIZE IN BYTES + ADD #5,B ;CONVERT TO WORDS, ALLOW FOR ETHERNET HEADER + ASR B + NEG B ;HARDWARE WANTS IT NEGATIVE + MOV B,(H)+ ;OUTPUT WORD COUNT + MOV D,(H)+ ;OUTPUT BUFFER ADDRESS + MOV A,2(H) ;OUTPUT START DELAY + MOV #101,(H) ;START OUTPUT, ENABLE INTERRUPT + RET ;PI LEVEL WILL FINISH + +;OUTPUT DONE/ABORTED INTERRUPT +ETHOBK: PUSH + MOV #CHXETH,I + MOV CHOHWR(I),H + MOV 4(H),A ;PICK UP STATUS BEFORE WRITING IT + CLR 4(H) ;CLEAR INTERRUPT ENABLE + TST A ;CHECK FOR ERROR + BPL 10$ + ADD #1,NPKSAB-CHXCHS(I) + ADC HPKSAB-CHXCHS(I) + NEG CHOSTS(I) ;ERROR, ENTER RETRANSMIT MODE + BPL 10$ ;ALREADY RETRANSMITTED ONCE, PUNT + MOV #25.,A ;WAIT 1 MS (DON'T BOTHER BEING RANDOM) + CALL ETHXM0 ;START TRANSMISSION AGAIN + BR ETHINX ;AND EXIT + +10$: CALL CHSODN ;TRANSMISSION FINISHED + CALL CHSRUN ;FIND MORE WORK TO DO + BR ETHINX ;DISMISS + +;CHECKSUM PUP ADDRESSED BY A. BASHES A,B,C. +PUPCKS: CALL PUPCK1 ;COMPUTE CHECKSUM + MOV B,(A) ;STORE CHECKSUM + RET + +;RETURN 'EQ' IF CHECKSUM MATCHES +PUPCKT: CALL PUPCK1 ;COMPUTE CHECKSUM + CMP (A),#-1 ;PACKET CHECKSUMMED? + BEQ 5$ ;NO, ALWAYS MATCH + CMP B,(A) ;RETURN WITH CC SET FROM NEW AND OLD CKSMS +5$: RET + +;A POINTS AT PACKET, RETURN WITH A -> CHECKSUM AND CHECKSUM IN B. BASH C. +PUPCK1: MOV (A),C ;GET LENGTH + DEC C ;IN WORDS NOT COUNTING CHECKSUM + ASR C + CLR B ;BUILD CHECKSUM IN B +10$: ADD (A)+,B ;ONE'S COMPLEMENT ADD + ADC B + BPL 11$ ;TRANSFER SIGN BIT INTO CARRY + SEC +11$: ROL B ;AND LEFT CYCLE + SOB C,10$ + INC B ;GRONK MINUS ZERO + BEQ 15$ + DEC B +15$: RET + +;BROADCAST ETHERNET GATEWAY INFO +ETHRUT: MASK 5 ;ENTER SUITABLE LEVEL FOR HACKING NET + TST CHISTS+CHXEGT ;IS THE PSEUDO SOURCE THAT EMITS THE + BNE 99$ ; PACKET AVAILABLE? IF NOT, PUNT. + CLR CHXRTF+CHXETH ;CLEAR REQUEST FLAG + MOV #EGTPID,A + CLR (A)+ ;PUP ID ZERO + CLR (A)+ + CLR (A)+ ;BROADCAST DESTINATION + CLR (A)+ ;TO SOCKET 2 + MOV #2,(A)+ + CALL ETHRT1 ;BUILD AND SEND GATEWAY INFO +99$: UNMASK + RET + +BADSBP: .WORD BADSUB ;POINTER INTO BAD SUBNETS +BADSUB: ;SUBNETS THAT SHOULD NOT HAVE INFORMATION SENT + ;ABOUT. THIS LIST MUST BE IN INCREASING ORDER + ;AND MUST END IN 377. + .BYTE 004 ;AI CHAOS 11 pseudo subnet (only AI PDP-10 (RIP) is on this) + .BYTE 010 ;Tech Square LCSnet (unused) + .BYTE 011 ;Tech Square LCS asynchronous line net (IP) + .BYTE 012 ;Tech Square VII LCSnet (IP) + .BYTE 014 ;Symbolics: Los Angeles-Chatsworth land line + .BYTE 020 ;CHAOS MIT IN subnet (ask JNC) + .BYTE 027 ;Experimental asynchronous line net + .BYTE 030 ;Experimental radio broadcast net + .BYTE 040 ;Symbolics: Tech Square-Vassar St. microwave link + .BYTE 041 ;Symbolics: Cambridge-Palo Alto land line + .BYTE 042 ;Symbolics: Palo Alto-Chatsworth land line + .BYTE 047 ;Symbolics: Cambridge-Chatsworth land line + .BYTE 054 ;S-1: 10Mb Ethernet + .BYTE 055 ;S-1: Pronet ring + .BYTE 056 ;S-1: serial line subnet + .BYTE 057 ;S-1: serial line subnet + .BYTE 061 ;Symbolics: Cambridge-Cambridge land line + .BYTE 062 ;Symbolics: Cambridge-Washington land line + .BYTE 064 ;Symbolics: Cambridge-Houston land line + .BYTE 070 ;Symbolics: Chatsworth-Westwood land line + .BYTE 072 ;Atari: Cambridge-MIT land line + .BYTE 073 ;Atari: Cambridge-Sunnyvale land line + .REPT 8 + .BYTE 377 ;SPARES + .ENDR + .BYTE 377 +.EVEN + +ETHRT1: MOV #BADSUB,BADSBP ;INITIAL BAD SUBNET POINTER + MOV #EGTSBN,A ;FILL IN GATEWAY INFORMATION IN THE PUP + CLR I ;I SUBNET*2, A EGTSBN POINTER +10$: ;; FOR EACH SUBNET, .BYTE GATE-NET, TARGET-NET, HOP-COUNT, GATE-HOST + CLR B ;FOR NON-GATEWAY, USE 0 AS GATEWAY ADDRESS + TST SBNTYP(I) ;HARDWARE CONNECTION? + BGT 11$ + MOV SBNADR(I),B ;NO, GET GATEWAY ADDRESS +11$: cmpb i,#60 + bhi 20$ ;dover, as of 1-Dec-83 can't handle more than 60 + ;; FILTER OUT KNOWN BAD SUBNETS + CMPB I,@BADSBP ;MAYBE UPDATE POINTER + BHI 115$ ; NO UPDATE NEEDED + INC BADSBP +115$: CMPB I,@BADSBP ;THIS TIME, CHECK FOR EQUALITY + BEQ 20$ ;PUNT + ;; END FILTER + MOV SBNCST(I),C ;GET COST + CMP C,#1000 ;IF NOT REACHABLE, DON'T PUT IN PACKET + BHIS 20$ + .IREPT 3, ASR C ;DIVIDE BY 8 TO GET APPROXIMATE HOP COUNT + CMP C,#ETHMXH ;DON'T PUT MORE THAN MAXHOPS + BLOS 12$ + MOV #ETHMXH,C +12$: MOV I,D ;GET TARGET-NET + ASR D + SWAB B + MOVB B,(A)+ ;STORE IN WIERD XEROX BYTE ORDER + MOVB D,(A)+ + MOV B,(A)+ + MOVB C,-2(A) +20$: TST (I)+ ;NEXT SUBNET + CMP I,#NSUBNT*2 + BLO 10$ + SUB #EGTSBN,A ;NUMBER OF DATA BYTES IN PUP + ADD #22.,A ;FOR HEADER AND CHECKSUM + MOV A,EGTPLN ;SET PUP LENGTH + MOV #CHXEGT,I ;SET UP TO TRANSMIT TO ETHERNET + JMP ETHOUT +.ENDC ;ETHERP + +.IF DF NDVRBF + .SBTTL DOVER PROTOCOL TRANSLATOR + +;RFC PACKET IN A. MUST PRESERVE I, AND RETURN 'EQ'. +DVROPN: MOV PKPKN(A),C + MOV PKSIND(A),B + MOV PKSHST(A),A + PUSH I + CALL 5$ + POP I + SEZ + RET + +;SET UP DOVER TO TALK TO HOST IN A, INDEX IN B, PKT# IN C, SENDING BACK AN OPN +;OR SENDING A LOS IF BUSY. MUST WATCH FOR DUPLICATE RFC'S +;MUST BE CALLED WITH CHAOS AND ETHER INTERRUPTS MASKED +5$: TST DVRHST ;BUSY? + BEQ 10$ ;NO + CMP A,DVRHST + BNE DVRBSY ;YES, TALKING TO ANOTHER HOST + CMP B,DVRIDX + BNE DVRBSY ;YES, TALKING TO ANOTHER GUY SAME HOST + BR 11$ ;DUPLICATE RFC + +10$: CLR DVRTIM ;FLUSH TIMEOUT + MOV A,DVRHST + MOV B,DVRIDX + INC DVRLIX ;ESTABLISH UNIQUE LOCAL INDEX + BNE 11$ + INC DVRLIX ;DON'T USE 0 +11$: CLR DVRMSK ;CLEAR THE BUFFER RING + CLR DVRID ;FIRST PACKET TO SEND TO DOVER IS PACKET 0 + INC C ;C := FIRST PACKET ID THAT WILL COME IN FROM CHAOS + MOV C,DVROFS + MOV #%COOPN*400,B ;SEND AN OPN + BR DVRST1 ;REST IS LIKE STS + +DVRBSY: TST DVRPKP ;SPECIAL BUFFER BUSY? + BNE CPOPJ0 ;YES, PUNT + MOV #DVRBF2,C ;SEND A CLS + MOV #%COCLS*400,(C)+ + MOV #4,(C)+ + MOV A,(C)+ + MOV B,(C)+ + MOV #CHADD,(C)+ + CLR (C)+ + CLR (C)+ + CLR (C)+ + MOV #"BU,(C)+ + MOV #"SY,(C)+ + MOV #DVRBF2,DVRPKP + BR DVRRFL + +;HERE TO SEND STS TO GUY CONNECTED TO DOVER +;MUST BE MASKED AGAINST CHAOS INTERRUPTS +DVRSTS: MOV #%COSTS*400,B +DVRST1: MOV #DVRBF2,A ;USE THIS BUFFER + MOV #4,D ;NUMBER OF BYTES +DVRST2: MOV A,C + MOV B,(A)+ ;OPCODE + MOV D,(A)+ ;NUMBER OF BYTES + MOV DVRHST,(A)+ ;DESTINATION HOST + MOV DVRIDX,(A)+ ;DESTINATION INDEX + MOV #CHADD,(A)+ ;SOURCE HOST + MOV DVRLIX,(A)+ ;SOURCE INDEX + CLR (A)+ ;NO PACKET NUMBER + CMP B,#%COLOS*400 ;IF SENDING LOS, PUNT THE REST + BEQ 20$ + MOV DVRID,B + DEC B ;LAST PACKET ACKNOWLEDGED BY DOVER + ADD DVROFS,B ;CONVERT TO CHAOSNET ID + MOV B,(A)+ ;ACKNOWLEDGE PACKET NUMBER + MOV B,(A)+ ;RECEIPT + MOV #NDVRBF,(A)+ ;WINDOW SIZE +20$: MOV C,DVRPKP ;CAUSE PACKET TO GET SENT + ;DROP INTO DVRRFL + +;HERE TO GET ANOTHER PACKET FROM THE DOVER. THIS CAN BE EITHER A CHAOSNET +;PACKET TO BE SENT BACK TO THE APPROPRIATE GUY, OR A PUP TO GO TO THE DOVER +DVRRFL: MOV #CHXDVR,I ;THIS MIGHT NOT BE SET UP WHEN CALLED + TST CHISTS(I) ;PACKET SOURCE ONLY EMANATES ONE AT A TIME + BNE CPOPJ0 + CMP CHIBFP(I),DVRPKP ;FINISHED SENDING SPECIAL PACKET? + BNE 10$ + CLR DVRPKP ;YES, MAKE READY FOR ANOTHER +10$: CLR CHIBFP(I) ;THIS PACKET NO LONGER BEING SENT + MOV DVRPKP,A ;GOT SPECIAL PACKET TO SEND? + BNE 30$ ;YES, SEND IT + TST DVRMSK ;GOT NEXT BUFFER TO SEND TO DOVER? + BPL CPOPJ0 ;NO + CMP DVRRTR,#60. ;1-SECOND RETRANSMISSION INTERVAL ELAPSED? + BLO CPOPJ0 ;NO, DON'T SEND YET + CLR DVRRTR ;SENDING, RESET RETRANSMISSION TIMER + MOV DVRBFP,A + BIC #PKFCMS,PKFC(A) ;CLEAR FORWARDING COUNT SINCE SENDING AGAIN +30$: MOV A,CHIBFP(I) ;SEND THIS PACKET + CALL CHSIHD ;ROUTE HIM + BVS DVRRFL ;BAD, IGNORE + CMP B,#CHXCHS ;SWAB IF SENDING TO 10, BUT NOT ETHERNET + BHIS 35$ + CALL CHSSWB +35$: INC CHISTS(I) ;INDICATE BUFFER READY TO SEND + RET + +;CALLED WITH A PUP IN ETHIBF WHICH IS FROM THE DOVER AND ADDRESSED +;TO THE GUY WHO'S TRYING TO PRINT ON IT. MUST BE MASKED AGAINST ETHER & CHAOS INTERRUPTS. +DVRPUP: MOVB ETHIBF+PKDAT+2,B + CMP B,#31 ;EFTP ACKNOWLEDGE? + BNE DVRPP1 + CMP ETHIBF+PKDAT+6,DVRID ;ACKNOWLEDGING EXPECTED PACKET? + BNE CPOPJ0 ;NO, IGNORE IT + INC DVRID ;YES, ADVANCE ID, POINTER, AND PACKET-PRESENCE MASK + MOV DVRBFP,A + ADD #DVRBFL,A + CMP A,#DVRBF2 + BLO 11$ + MOV #DVRBUF,A +11$: MOV A,DVRBFP + ASL DVRMSK + SETOM DVRRTR ;FAKE RETRANSMIT TIMER TO SEND NEXT PUP RIGHT AWAY + TST CHISTS+CHXDVR ;PACKET SOURCE BUSY? + BEQ DVRSTS ;NO, SEND AN ACKNOWLEDGEMENT TO THE CHAOSNET +CPOPJ0: RET + +DVRPP1: MOV #22.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#33 ;EFTP ABORT? + BEQ DVRERR + MOV #44.,A ;RELATIVE ADDRESS OF ASCII STRING + CMP B,#4 ;PUP ERROR? + BNE CPOPJ0 ;IGNORE ANYTHING ELSE +DVRERR: CLR DVRMSK ;DON'T SEND ANYTHING MORE TO THE DOVER + MOV ETHIBF+PKDAT,C ;PUP LENGTH + SUB A,C + SUB #2,C ;GET LENGTH OF ASCII STRING + ADD #ETHIBF+PKDAT,A ;GET ADDRESS OF ASCII STRING + MOV #DVRBUF+PKDAT,B ;BUILD A LOS PACKET TO SEND BACK + MOV C,D ;SAVE BYTE LENGTH + INC C + ASR C ;WORD COUNT + BEQ 11$ +10$: MOV (A)+,(B) + SWAB (B)+ ;ALTO HAS BYTES IN THE WRONG ORDER + SOB C,10$ +11$: MOV #%COLOS*400,B ;SEND A LOS + MOV #DVRBUF,A + CALL DVRST2 + CLR DVRHST ;KILL CONNECTION + RET + +;HERE IS A PACKET DIRECTED TO THE DOVER. DO GOOD THINGS WITH IT. +;NOTE, IT HAS ALREADY BEEN SWABBED INTO ETHERNET BYTE ORDER. +DVRPKT: MOV CHOINX(I),B ;GET SOURCE SUPPLYING THE PACKET + MOV CHIBFP(B),A ;GET ADDRESS OF PACKET + CLR DVRTIM ;FOREIGN HOST IS NOT IDLE + MOVB PKOP(A),B ;DATA PACKET? + BMI 50$ ;YES + CMP B,#%COSNS + BNE 11$ + TST CHISTS+CHXDVR + BNE 90$ + CALL DVRSTS ;SNS => STS + BR 90$ + +11$: CMP B,#%COCLS + BEQ 12$ ;CLS OR LOS PUNTS THE CONNECTION + CMP B,#%COLOS + BNE 13$ +12$: CLR DVRHST + BR 90$ + +13$: CMP B,#%COEOF ;NOTE THAT EOF IS TREATED VERY MUCH LIKE DATA! + BNE 90$ ;IGNORE ANYTHING RANDOM +50$: MOV PKPKN(A),B ;GET ID OF DATA PACKET + SUB DVROFS,B + MOV DVRBFP,D ;FIND WHERE IN THE BUFFER IT GOES + MOV #100000,C ;AND GET MASK BIT FOR IT + SUB DVRID,B ;B := ID RELATIVE TO NEXT EXPECTED + BEQ 53$ + CMP B,#NDVRBF + BHIS 90$ ;IGNORE DUPLICATE OR NOT IN WINDOW +51$: ADD #DVRBFL,D + CMP D,#DVRBF2 + BLO 52$ + MOV #DVRBUF,D +52$: CLC + ROR C + SOB B,51$ +53$: BIT C,DVRMSK ;ALREADY HAVE PACKET? + BNE 90$ ;YES, IGNORE + BIS C,DVRMSK ;NO, STORE IT AWAY + MOV D,C + ADD #PKDAT,D ;BUILD PUP + MOV PKNBYT(A),B + BIC #PKNBMS,B + MOV B,(D) + ADD #22.,(D)+ ;PUP LENGTH + MOV #30,(D)+ ;PUP TYPE + TST (A) ;WAS THIS DATA OR EOF? + BMI 54$ ;DATA + SUB (PC),-2(D) ;EOF, SET PUP TYPE TO 32 +54$: CLR (D)+ ;PUP ID HIGH + MOV PKPKN(A),(D) ;PUP ID LOW + SUB DVROFS,(D)+ ; CORRECTED + MOV #DVRADR,(D)+ ;DESTINATION HOST + CLR (D)+ ;DESTINATION SOCKET HIGH + MOV #20,(D)+ ;DESTINATION SOCKET LOW + MOV DVRHST,(D)+ ;SOURCE HOST + CLR (D)+ ;SOURCE SOCKET HIGH + MOV DVRIDX,(D)+ ;SOURCE SOCKET LOW + ADD #PKDAT,A + INC B + ASR B ;NUMBER OF DATA WORDS +;*** TEMPORARY KLUDGE *** + PUSH ;PUSH B LAST!! +;*** END TEMPORARY KLUDGE *** + BEQ 56$ +55$: MOV (A)+,(D)+ ;MOVE THE DATA + SOB B,55$ +56$: MOV C,A + ADD #PKDAT,A + MOV #<%COUNC*400>,(C) ;PKOP + MOV 10(A),PKDHST(C) + MOV (A),PKNBYT(C) ;SHOULD BE ENOUGH TO GET IT ROUTED TO ETHERNET + CALL PUPCKS ;STORE APPROPRIATE CHECKSUM +;*** TEMPORARY KLUDGE *** + POP ;LOOK FOR SOME KIND OF MACHINE FAILURE + TST B + BEQ 79$ +70$: CMP (D)+,(A)+ + BNE 75$ + SOB B,70$ + BR 79$ + +75$: DVRFKT=. + NOP ;PUT A BPT HERE IF YOU LIKE + INC NDVRFK + CLR DVRMSK ;DO IT ALL OVER AGAIN +79$: +;*** END TEMPORARY KLUDGE *** + CALL DVRRFL ;SEND THIS PACKET MAYBE +90$: MOV #CHXDVR,I + JMP CHSODN ;THIS PACKET HANDLED +.ENDC ;NDVRBF + .IFNZ DL10P + .SBTTL TRAP HANDLING + +TRAP14: HALT ;BPT WITH NO RUG IN CORE + +TRAP10: BPT ;ILLEGAL INSTRUCTION + +TRAP4: NOP ;PATCH BPT HERE IF YOU WANT + CMP (SP),#MAIN ;IF TRAP4 IN MAIN LOOP... + BLO CRASH + CMP (SP),#MAINE + BHIS CRASH + BIT #DLXPRT,DLXCSR ;AND DL10 PORT TURNED OFF + BNE CRASH + TST DLXOFF ;AND WE THOUGHT IT WAS ON + BNE CRASH +RESTRT: MOV #STKBAS,SP ;THEN RESTART MAIN LOOP + CLR -(SP) ;WHICH WILL WAIT FOR DL10 PORT TO TURN ON + MOV #MAIN,-(SP) + RTI + +CRASH: BPT ;OTHERWISE, CRASH + +PWRFAL: RESET ;POWER FAIL OR UP - IF FAIL, HALT DURING RESET + MOV #20,B ;WAIT 2 SECONDS TO +1$: CLR A ; MAKE SURE POWER IS REALLY ON + SOB A,. + SOB B,1$ + JMP INIT ;POWER SEEMS UP, RESTART PROGRAM +.ENDC ;DL10P + +.IFNZ NODDT ;IF NO DDT OR OTHER "OPERATING SYSTEM", SET UP TRAP HANDLERS +TRAP4: + .=4 + .WORD TRAP4,340,TRAP10,340,TRAP14,340,TRAP10,340,PWRFAL,340,TRAP10,340,TRAP10,340 + .=TRAP4 + +;ILLEGAL ADDRESS, UNIBUS NXM, STACK OVERFLOW +TRAP4: BPT + 0 + +;ILLEGAL INSTRUCTION, IOT, EMT +TRAP10: BPT + 0 + +;POWER FAILURE OR RESTORE +PWRFAL: HALT + 0 + +;BPT (OR TRACE) +TRAP14: .REPT 7 ;SAVE REGISTERS WHERE CARPET CAN FIND THEM + MOV %0+.RPCNT,BPTACS+<.RPCNT*2> + .ENDR + CLR BPTGO + SETOM BPTFLG +5$: TST BPTGO + BEQ 5$ + CLR BPTFLG + .REPT 7 + MOV BPTACS+<.RPCNT*2>,%0+.RPCNT + .ENDR + RTI + +BPTFLG: 0 ;NON-ZERO IF GOT A BPT +BPTGO: 0 ;NON-ZERO TO PROCEED +BPTACS: .BLKW 7 ;REGS EXCEPT PC + +.ENDC ;NODDT + + .SBTTL INITIALIZATION +GO:: +INIT: CLR PS +.IFNZ DL10P + RESET + MOV #STKBAS,SP + TST 14 + BNE 1$ ;BPT ALREADY SET UP BY RUG + MOV #TRAP14,14 + MOV #340,16 +1$: +.ENDC ;DL10P +.IFNZ NODDT ;NO OPERATING SYSTEM + RESET + MOV #STKBAS,SP +.ENDC ;NODDT + SETOM DLXOFF ;REINITIALIZE VARIOUS VARIABLES + SETOM NO.ITS +.REPT CHAOSP ;IDLE CHAOS NET INTERFACES + CLR CHISTS+CHXCHS+<2*.RPCNT> + CLR CHOSTS+CHXCHS+<2*.RPCNT> +.ENDR +.IIF NZ T300P, CLR RQBACT +.IFNZ NCT + MOV #NFTTY,I +76$: MOV NRMIPC(I),TTYIPC(I) + ADD #2,I + CMP I,#LASTTY + BLE 76$ + MOV #TYORNG,B ;CLEAR THE TYPOUT-DONE RING + CALL CLRING + MOV #,A ;GIVE OUTPUT DONE ON ALL LINES +78$: CALL PUT + INC A + CMP A,#+NCT + BLO 78$ +.ENDC ;NCT +.IFNZ NDMS +;;; Turn on DM11-BBs + CLR B ;iterated over DM11 units + MOV #NDMS,H +5$: MOV #DMCLR+DMCSN,@DMCSR(B) ;CLEAR SCANNER MEMORY +2$: BIT #DMBSY,@DMCSR(B) + BNE 2$ + CLR I ;iterated over modem channels + ;; turn on connected modem channels for one DM11 + CLR A ;counter for channels per unit +3$: TST M2LMAP(I) + BEQ 4$ + MOV A,@DMCSR(B) + MOV #LINENB,@DMLSR(B) +4$: TST (I)+ + INC A + CMP A,#16. + BLT 3$ + TST (B)+ + SOB H,5$ ;next DM11 + ;; treat first-time interrupts differently + SETOM DMINI + CLR B + MOV #NDMS,A +6$: MOV #DMSCN+DMIEN,@DMCSR(B) ;enable scanner interrupts + TST (B)+ + SOB A,6$ ;on all DMs + MOV #20000.,A + SOB A,. ;DELAY 50 MILLISECONDS + CLR DMINI ;WHILE P.I. LEVEL GETS INITIAL STATUS +.ENDC ;NDMS + +.IFG NDHS +;TURN ON DH11'S + MOV #NLDHHX,H +DHINIL: MOV DHSCR(H),A ;DEVICE ADDRESS + MOV #100000,16(A) ;TURN ON SILO MAINTENANCE MODE, SUSPECTED OF + ;LOSING + MOV #4000,(A) ;RESET DH11 + MOV 16(A),B ;CHECK SILO STATUS + BIC #300,B ;THESE BITS ARE IN RAM & DON'T CLEAR + BEQ DHSWIN ;SHOULD HAVE CLEARED MAINTENANCE MODE AND OTHER CRUD +DHSLUZ: BPT ;LOSE +DHSWIN: MOV #DHRENB+DHTENB,(A) ;NOW ENABLE INTERRUPTS ON DH11 + SUB #2,H + BGE DHINIL +.ENDC ;NDHS + +;TURN ON DL11S +.IFG NDLS + MOV #NLDLHX,H + MOV #NDLS-1,A +21$: +.IIF NZ DTE20P, BEQ 22$ ;NO KBD INT ON KL10 CTY DUE TO KLDCP LOSSAGE + MOV #103,@DLKS(H) ;ACTIVATE KEYBOARD INTERRUPT, D.T.R., READER +22$: MOV #100,@DLPS(H) ;ACTIVATE PRINTER INTERRUPT + SUB #2,H + DEC A + BPL 21$ +.ENDC ;NDLS + +;SET LINE PARAMETERS AND ALLOCATE BUFFERS +.IFNZ NCT + MOV #NFTTY,I +10$: MOV LPRVAL(I),A + MOV BUFSIZ(I),B + CALL SPARAM + ADD #2,I + CMP I,#LASTTY + BLE 10$ +.ENDC ;NCT + +;TURN ON CLOCK +.IIF Z DTE20P, MOV #100,@#LKS ;NO CLOCK INTERRUPTS IF KLDCP IS HACKING CLOCK TOO + +.IFNZ DTE20P +;INITIALIZE DTE20 + MOV #37774,DLYCNT ;DMA TO BANK 0, 2 USEC DELAY + MOV #%D3BYT,DIAG3 ;DO TO10 TRANSFERS IN BYTE MODE + MOV #MAIN,SADR ;ONLY DO INIT ONCE +.ENDC ;DTE20P +.IIF NZ TEN11P, SETOM T11I10 ;CAUSE 10 TO REINITIALIZE TEN-11 CHAOS +.REPT CHAOSP + MOV CHIHWR+CHXCHS+<2*.RPCNT>,H ;ADDRESS THE INTERFACE + CONC ,\.RPCNT ;CHECK THE HOST NUMBER SWITCHES AGAINST THE PROGRAM + BEQ .+4 + BPT + BIS #%CAREN,(H) ;ENABLE CHAOS NET INPUT INT +.ENDR ;CHAOSP +.IFNZ ETHERP + MOV CHIHWR+CHXETH,H ;ADDRESS THE INTERFACE + MOV 16(H),A ;GET HOST NUMBER SWITCHES + COMB A ;FIX XEROX MISTAKE + CMPB A,#ETHHSN ;CHECK HOST NUMBER SWITCHES + BEQ .+4 + BPT + MOV #CHXETH,I ;ENABLE TO RECEIVE FIRST ETHERNET PACKET + CALL ETHRFL +.ENDC ;ETHERP +;GO + JMP MAIN + +.IFNZ GOULDP +.SBTTL GOULD PRINTER BUFFERS + +GLPOIP: GLPBFF ;NEXT BUFFER IN AT M.P. LEVEL +GLPOOP: GLPBFF ;NEXT BUFFER OUT AT P.I. LEVEL + + .REPT NGLPBF ;ASSEMBLE THE BUFFERS + 0 .SEE GB.STA + GLPBFF ;DUE TO PALX BUG, LEAVE .SEE ON NEXT LINE + .SEE GB.NXT +GLPBFF==.-4 + 0 .SEE GB.FF + 0 .SEE GB.NL + 0 .SEE GB.PNT + .BLKB GLPBSZ + .ENDR +.ENDC ;GOULDP + + .SBTTL "TTYTYP" PARAMETER FILE + +T LPRVAL: + .BLKW NCT ;DH11 PARAMETER REG + +BUFFRS: ;BEGIN ALLOCATING BUFFERS HERE + +.IIF NZ NCT, INFORM ,\BUFFRS +ZZ===+3777>/4000 ;NUMBER OF K USED +.IRP ZZZZ,<0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16> +.LIF EQ ZZ-.IRPCNT ;THIS IS A CRETINOUS CROCK TO GET IT COME OUT IN DECIMAL +INFORM ,\BUFFRS+,< (>,ZZZZ, +.ENDR + +.IFNZ NCT ;TTYTYP FILE ONLY IF WE HAVE TTYS +.IF P2 ;SPEED UP THE ASSEMBLY +OFF==69105 ;KLUDGES SO I DON'T HAVE TO PUT KEYWORD PARAMETERS INTO PALX +40K==40000 +80K==80000 + +.MACRO SPEED BAUD +ZZ==-1 +.IIF EQ BAUD-OFF, ZZ==0 +.IIF EQ BAUD-50, ZZ==1 +.IIF EQ BAUD-75, ZZ==2 +.IIF EQ BAUD-110, ZZ==3 +.IIF EQ BAUD-134, ZZ==4 +.IIF EQ BAUD-150, ZZ==5 +.IIF EQ BAUD-200, ZZ==6 +.IIF EQ BAUD-300, ZZ==7 +.IIF EQ BAUD-600, ZZ==10 +.IIF EQ BAUD-1200, ZZ==11 +.IIF EQ BAUD-1800, ZZ==12 +.IIF EQ BAUD-2400, ZZ==13 +.IIF EQ BAUD-4800, ZZ==14 +.IIF EQ BAUD-9600, ZZ==15 +.IIF EQ BAUD-80K, ZZ==16 +.IIF EQ BAUD-40K, ZZ==17 +.IIF LT ZZ, .ERROR UNRECOGNIZED SPEED "BAUD" +.ENDM SPEED + +.MACRO IPARM N,ODFLT,IDFLT,MUMLST +.IF GE <2*N>-NFTTY +.IF LE <2*N>-LASTTY +%%.ISPEED==-1 +%%.SPEED==-1 +.IRP MUM, +.IF NB + ZZ==0 + .IRPC MUMB, + .IIF GE .IRPCNT-2, .MEXIT + .IIF IDN MUMB,S, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,P, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .IIF IDN MUMB,I, .IIF EQ .IRPCNT, ZZ==1 + .IIF IDN MUMB,S, .IIF EQ .IRPCNT-1, ZZ==ZZ+1 + .ENDM + .IIF EQ ZZ-2, %%.'MUM + .ENDC +.ENDM +.IF LT %%.ISPEED + .IIF LT %%.SPEED, %%.ISPEED==IDFLT + .IELSE %%.ISPEED==%%.SPEED +.ENDC +.IIF LT %%.SPEED, %%.SPEED==ODFLT +SPEED %%.ISPEED +IZZ==ZZ +SPEED %%.SPEED +; BUFFER SIZE IS 1/2 SECOND'S TYPING +; BUT WILL BE SUBJECT TO LIMIT OF MAXBSZ +.IIF LT ZZ-7, BZZ==5. +.IIF EQ ZZ-7, BZZ==15. +.IIF EQ ZZ-10, BZZ==30. +.IIF EQ ZZ-11, BZZ==60. +.IIF EQ ZZ-12, BZZ==90. +.IIF EQ ZZ-13, BZZ==120. +.IIF EQ ZZ-14, BZZ==240. +.IIF EQ ZZ-15, BZZ==480. +.IIF GT ZZ-15, BZZ==1000. +.=LPRVAL+<2*N> ;ASSEMBLE LINE PARAMETER WORD +.IIF NE ZZ-3, ++3 ;ISPEED, OSPEED, NO PARITY, 8 BITS, FULL DUPLEX +.IELSE ++3+4 ;110 BAUD EXTRA STOP BIT +.=BUFSIZ+<2*N> +BZZ ;ASSEMBLE BUFFER SIZE +.ENDC +.ENDC +.ENDM IPARM + +;MACROS USED IN THE TTYTYP FILE: + +.MACRO TTDPRT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDPRT + +.MACRO TTDMRX TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,600,600, +.ENDM TTDMRX + +.MACRO TTDTRM TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTRM + +.MACRO TTDLPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDLPT + +.MACRO TTDLA36 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,300,300, +.ENDM TTDLA36 + +.MACRO TTDIML TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,50K,25K, +.ENDM TTDIML + +.MACRO TTDVT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDVT + +.MACRO TTDTEK TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,1200,1200, +.ENDM TTDTEK + +.MACRO TTDLSR TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDLSR + +.MACRO TTDDPT TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,2400,2400, +.ENDM TTDDPT + +.MACRO TTDGT40 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTDGT40 + +.MACRO TTDRAY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTDH19 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDRAY + +.MACRO TTD11 TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,4800,4800, +.ENDM TTD11 + +.MACRO TTDRAN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDRAN + +.MACRO TTDTV TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDTV + +.MACRO TTDGRN TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,9600,9600, +.ENDM TTDGRN + +.MACRO TTDSTY TN,A,B,C,D,E,F,G,H,I,J +IPARM TN,FOO,FOO, +.ENDM TTDSTY + +.MACRO REPEAT N,FOO +FAKOUT: .REPT N +FAKOUT===0 +.ENDM + +NSTTYS==0 ;WE'RE NOT INTERESTED IN PSEUDO-TTYS +N11TYS==0 ;NOR IN PDP11 TVS + +.INSRT SYSTEM;TTYTYP > + +.EXPUNGE ZZ,IZZ,IZZZ,BZZ,OFF,40K,80K,%%.ISPEED,%%.SPEED +.EXPUNGE TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED + +.ENDC ;P2 + +.ENDC ;NCT + +.END INIT + \ No newline at end of file diff --git a/system/its.1622 b/system/its.1622 new file mode 100644 index 0000000..0b5de66 --- /dev/null +++ b/system/its.1622 @@ -0,0 +1,21721 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: IOCR10 +DNTRAP:: TRPDEV +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. +IFE MCOND MC,[ ; When MC and MX swap names, these names will stay +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MC +IFE MCOND MX,[ +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MX + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN+%DVDIR + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,

+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +LOC .BAS.+.VEC. + REST +IFG .VEC.-.MAX., .MAX.==.VEC. +IFL .VEC.-.MIN., .ERR Unibus interrupt table lossage. +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.MIN.==53 ; Guess smallest interrupt vector on Unibus Q +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAQIB==:.BAS. + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +LOC .BAS.+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.MIN.==45 ; Guess smallest interrupt vector on Unibus I +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAIIB==:.BAS. + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +IFN DZ11P,[ +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +]];DZ11P + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +LOC .BAS.+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; Note that these pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on each Unibus. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1632 b/system/its.1632 new file mode 100644 index 0000000..360c588 --- /dev/null +++ b/system/its.1632 @@ -0,0 +1,21783 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. +IFE MCOND MC,[ ; When MC and MX swap names, these names will stay +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MC +IFE MCOND MX,[ +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MX + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +LOC .BAS.+.VEC. + REST +IFG .VEC.-.MAX., .MAX.==.VEC. +IFL .VEC.-.MIN., .ERR Unibus interrupt table lossage. +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.MIN.==53 ; Guess smallest interrupt vector on Unibus Q +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAQIB==:.BAS. + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +LOC .BAS.+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.MIN.==45 ; Guess smallest interrupt vector on Unibus I +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAIIB==:.BAS. + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +IFN DZ11P,[ +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +]];DZ11P + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +LOC .BAS.+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; Note that these pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on each Unibus. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1633 b/system/its.1633 new file mode 100644 index 0000000..7499000 --- /dev/null +++ b/system/its.1633 @@ -0,0 +1,21838 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. +IFE MCOND MC,[ ; When MC and MX swap names, these names will stay +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MC +IFE MCOND MX,[ +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MX + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +LOC .BAS.+.VEC. + REST +IFG .VEC.-.MAX., .MAX.==.VEC. +IFL .VEC.-.MIN., .ERR Unibus interrupt table lossage. +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.MIN.==53 ; Guess smallest interrupt vector on Unibus Q +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAQIB==:.BAS. + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +LOC .BAS.+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.MIN.==45 ; Guess smallest interrupt vector on Unibus I +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAIIB==:.BAS. + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +IFN DZ11P,[ +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +]];DZ11P + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +LOC .BAS.+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; All of the Q UBA is statically assigned. The lower half of the I +;;; UBA is statically assigned, while slots in the upper half of the I UBA +;;; are assigned dynamically by the UBAASL routine and freed by the +;;; UBAFSL routine below. +;;; +;;; Note that static pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on the Q Unibus and 16. +;;; such pages on the I unibus. +;;; +;;; Slots handed out by UBAASL are good for mapping 1000 PDP-10 words +;;; (one DEC page, and coincidentally the size of a network buffer). +;;; The number obtained from UBAASL is a direct index into the UBA +;;; paging RAM, and will range from 32. to 63. +;;; +;;; This two different page size thing is all a mess and I should fix it +;;; sometime. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: + +;;; Static pages +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +;;; Dynamic pages + +EBLK +UBAIFS: 777777777760 ;Slot map, bit on if free +BBLK + +; Allocate a UBA I slot +; Return +1, A/ slot index + +UBAASL: PUSH P,B + CONO PI,PIOFF + MOVE A,UBAIFS + JFFO A,UBASL1 + CONO PI,PION + POP P,B ;Clean up for no good reason + BUG HALT,[Out of UBA slots] + +UBASL1: MOVNS B + MOVSI A,400000 + LSH A,B ;A/ bit to snarf + ANDCAM A,UBAIFS + CONO PI,PION + MOVN A,B + ADDI A,32. ;First dynamic slot + POP P,B + POPJ P, + +; Deallocate the UBA slot in A +; A/ UBA index to free. Bashes A,TT +UBAFSL: CAIL A,32. + CAIL A,64. + BUG HALT,[Bad UBA index],OCT,A ;Paranoid for now + MOVEI A,-32.(A) + MOVNS A + MOVSI TT,400000 + LSH TT,A + IORM TT,UBAIFS + POPJ P, + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1634 b/system/its.1634 new file mode 100644 index 0000000..7499000 --- /dev/null +++ b/system/its.1634 @@ -0,0 +1,21838 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. +IFE MCOND MC,[ ; When MC and MX swap names, these names will stay +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MC +IFE MCOND MX,[ +IFN KL10P, DV KL,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN KS10P, DV KS,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +] ;MX + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +LOC .BAS.+.VEC. + REST +IFG .VEC.-.MAX., .MAX.==.VEC. +IFL .VEC.-.MIN., .ERR Unibus interrupt table lossage. +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.MIN.==53 ; Guess smallest interrupt vector on Unibus Q +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAQIB==:.BAS. + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +LOC .BAS.+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.MIN.==45 ; Guess smallest interrupt vector on Unibus I +.MAX.==.MIN.-1 +.BAS.==.-.MIN. +UBAIIB==:.BAS. + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +IFN DZ11P,[ +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +]];DZ11P + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +LOC .BAS.+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; All of the Q UBA is statically assigned. The lower half of the I +;;; UBA is statically assigned, while slots in the upper half of the I UBA +;;; are assigned dynamically by the UBAASL routine and freed by the +;;; UBAFSL routine below. +;;; +;;; Note that static pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on the Q Unibus and 16. +;;; such pages on the I unibus. +;;; +;;; Slots handed out by UBAASL are good for mapping 1000 PDP-10 words +;;; (one DEC page, and coincidentally the size of a network buffer). +;;; The number obtained from UBAASL is a direct index into the UBA +;;; paging RAM, and will range from 32. to 63. +;;; +;;; This two different page size thing is all a mess and I should fix it +;;; sometime. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: + +;;; Static pages +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +;;; Dynamic pages + +EBLK +UBAIFS: 777777777760 ;Slot map, bit on if free +BBLK + +; Allocate a UBA I slot +; Return +1, A/ slot index + +UBAASL: PUSH P,B + CONO PI,PIOFF + MOVE A,UBAIFS + JFFO A,UBASL1 + CONO PI,PION + POP P,B ;Clean up for no good reason + BUG HALT,[Out of UBA slots] + +UBASL1: MOVNS B + MOVSI A,400000 + LSH A,B ;A/ bit to snarf + ANDCAM A,UBAIFS + CONO PI,PION + MOVN A,B + ADDI A,32. ;First dynamic slot + POP P,B + POPJ P, + +; Deallocate the UBA slot in A +; A/ UBA index to free. Bashes A,TT +UBAFSL: CAIL A,32. + CAIL A,64. + BUG HALT,[Bad UBA index],OCT,A ;Paranoid for now + MOVEI A,-32.(A) + MOVNS A + MOVSI TT,400000 + LSH TT,A + IORM TT,UBAIFS + POPJ P, + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1641 b/system/its.1641 new file mode 100644 index 0000000..216bdce --- /dev/null +++ b/system/its.1641 @@ -0,0 +1,21941 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +IFN KS10P,SNUBI==36 ; Unibus interrupt +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN KS10P,DNUBI:: UBICL ;UNIBUS INTERRUPT +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN KS10P,[ +DNUBI:: %IOTUI,,IOCR10 +];KS10P +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: CPOPJ,,OPNL34 +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: UBIRCH,,OPNL34 +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN KS10P, XX 1,UBI,DNUBI,SNUBI,%%UBI ;UBIBUS INTERRUPT +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%UBI,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: UBIIOP,,CPOPJ +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: OPNL34,,OPNL34 +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN KS10P, %%UBI ;UNIBUS INTERRUPT +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%UBI,%%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV UBI,UBIO,%DVIN + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +IFL .VEC.-.MIN., .MIN.==.VEC. +IFG .VEC.-.MAX., .MAX.==.VEC. +IF2,[ +LOC .BAS.+.VEC. + REST +];IF2 +TERMIN + +NUBIDV==0 + +DEFINE UBIDV VEC +NUBIDV==NUBIDV+1 +.VEC.== +CONC [UB]\NUBIDV,NM==:<.UBA.,,.VEC.> +CONC [UBINT .VEC., JSR UB]\NUBIDV,BK +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.UBA.==UBAQ +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAQIB + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +UBAQIB==:UBAQIT-.MIN. +LOC UBAQIB+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.UBA.==UBAI +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAIIB + +IFE TM03S, UBIDV 224 ; Tape +UBIDV 300 ; NI1010 In +UBIDV 304 ; NI1010 Out +IFL DZ11NB-4,[ +REPEAT 4-DZ11NB,[ +UBIDV 340+<10*> ; DZ In +UBIDV 344+<10*> ; DZ Out +]] + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +];REPEAT DZ11NB + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +UBAIIB==:UBAIIT-.MIN. +LOC UBAIIB+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; All of the Q UBA is statically assigned. The lower half of the I +;;; UBA is statically assigned, while slots in the upper half of the I UBA +;;; are assigned dynamically by the UBAASL routine and freed by the +;;; UBAFSL routine below. +;;; +;;; Note that static pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on the Q Unibus and 16. +;;; such pages on the I unibus. +;;; +;;; Slots handed out by UBAASL are good for mapping 1000 PDP-10 words +;;; (one DEC page, and coincidentally the size of a network buffer). +;;; The number obtained from UBAASL is a direct index into the UBA +;;; paging RAM, and will range from 32. to 63. +;;; +;;; This two different page size thing is all a mess and I should fix it +;;; sometime. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: + +;;; Static pages +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +;;; Dynamic pages + +EBLK +UBAIFS: 777777777760 ;Slot map, bit on if free +BBLK + +; Allocate a UBA I slot +; Return +1, A/ slot index + +UBAASL: PUSH P,B + CONO PI,PIOFF + MOVE A,UBAIFS + JFFO A,UBASL1 + CONO PI,PION + POP P,B ;Clean up for no good reason + BUG HALT,[Out of UBA slots] + +UBASL1: MOVNS B + MOVSI A,400000 + LSH A,B ;A/ bit to snarf + ANDCAM A,UBAIFS + CONO PI,PION + MOVN A,B + ADDI A,32. ;First dynamic slot + POP P,B + POPJ P, + +; Deallocate the UBA slot in A +; A/ UBA index to free. Bashes A,TT +UBAFSL: CAIL A,32. + CAIL A,64. + BUG HALT,[Bad UBA index],OCT,A ;Paranoid for now + MOVEI A,-32.(A) + MOVNS A + MOVSI TT,400000 + LSH TT,A + IORM TT,UBAIFS + POPJ P, + +SUBTTL UBI DEVICE + +UBIDVS:: +REPEAT NUBIDV,[ +EBLK + 0 ; Bit in -7(I) + -1 ; User or -1 in -6(I) + 0 ; Count in -5(I) + 0 ; Saved I in -4(I) +CONC UB,\.RPCNT,BK: + 0 +BBLK + MOVEM I,.-2 + JSP I,UBIBRK +CONC UBI,\.RPCNT,: + JRST 12,@ + CONC UB,\.RPCNT,NM ; Name in 1(I) +IFE .RPCNT, LUBIDV==:.-UBIDVS +];REPEAT NUBIDV + +UBINAM==:1 +UBISVI==:-4 +UBICNT==:-5 +UBIUSR==:-6 +UBIBIT==:-7 + +UBIBRK: AOS UBICNT(I) + EXCH U,UBIUSR(I) + JUMPL U,UBIBK9 + EXCH T,UBIBIT(I) + TDNE T,MSKST2(U) + IORM T,IFPIR(U) + EXCH T,UBIBIT(I) +UBIBK9: EXCH U,UBIUSR(I) + HRLI I,UBISVI(I) + JRA I,(I) + +EBLK +UBISW: -1 ? 0 +BBLK + +; .OPEN +UBIO: MOVEI T,NUBIDV + SKIPA I,[UBI0] +UBIO1: MOVEI I,LUBIDV(I) + CAME A,UBINAM(I) + SOJG T,UBIO1 + JUMPLE T,OPNL4 ; FILE NOT FOUND + PUSHJ P,SWTL + UBISW + SKIPE UBIUSR(I) + JRST OPNL23 ; FILE LOCKED + MOVEI T,(R) + SUBI T,IOCHNM(U) + MOVE T,CHNBIT(T) + MOVEM T,UBIBIT(I) + HRRZM U,UBIUSR(I) + HRLZI T,(I) + HRRI T,DNUBI + MOVEM T,(R) + JRST LSWPJ1 + +; .IOPUSH/.IOPOP +UBIIOP: HLRZ A,(R) + JUMPE I,UBIOP7 + SUBI R,IOCHNM(U) + SKIPA R,CHNBIT(R) +UBIOP7: SETZI R, + MOVEM R,UBIBIT(A) + POPJ P, + +; .CALL RFNAME +UBIRCH: MOVE B,UBINAM(A) + POPJ P, + +; .CLOSE +UBICL: SETOM UBIUSR(A) + POPJ P, + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1642 b/system/its.1642 new file mode 100644 index 0000000..280bbf6 --- /dev/null +++ b/system/its.1642 @@ -0,0 +1,21941 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +IFN KS10P,SNUBI==36 ; Unibus interrupt +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN KS10P,DNUBI:: UBICL ;UNIBUS INTERRUPT +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN KS10P,[ +DNUBI:: %IOTUI,,IOCR10 +];KS10P +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: CPOPJ,,OPNL34 +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: UBIRCH,,OPNL34 +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN KS10P, XX 1,UBI,DNUBI,SNUBI,%%UBI ;UBIBUS INTERRUPT +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%UBI,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: UBIIOP,,CPOPJ +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: OPNL34,,OPNL34 +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN KS10P, %%UBI ;UNIBUS INTERRUPT +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%UBI,%%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV UBI,UBIO,%DVIN + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +IFL .VEC.-.MIN., .MIN.==.VEC. +IFG .VEC.-.MAX., .MAX.==.VEC. +IF2,[ +LOC .BAS.+.VEC. + REST +];IF2 +TERMIN + +NUBIDV==0 + +DEFINE UBIDV VEC +.VEC.== +CONC [UB]\NUBIDV,NM==:<.UBA.,,.VEC.> +CONC [UBINT .VEC., JSR UB]\NUBIDV,BK +NUBIDV==NUBIDV+1 +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.UBA.==UBAQ +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAQIB + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +UBAQIB==:UBAQIT-.MIN. +LOC UBAQIB+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.UBA.==UBAI +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAIIB + +IFE TM03S, UBIDV 224 ; Tape +UBIDV 300 ; NI1010 In +UBIDV 304 ; NI1010 Out +IFL DZ11NB-4,[ +REPEAT 4-DZ11NB,[ +UBIDV 340+<10*> ; DZ In +UBIDV 344+<10*> ; DZ Out +]] + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +];REPEAT DZ11NB + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +UBAIIB==:UBAIIT-.MIN. +LOC UBAIIB+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; All of the Q UBA is statically assigned. The lower half of the I +;;; UBA is statically assigned, while slots in the upper half of the I UBA +;;; are assigned dynamically by the UBAASL routine and freed by the +;;; UBAFSL routine below. +;;; +;;; Note that static pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on the Q Unibus and 16. +;;; such pages on the I unibus. +;;; +;;; Slots handed out by UBAASL are good for mapping 1000 PDP-10 words +;;; (one DEC page, and coincidentally the size of a network buffer). +;;; The number obtained from UBAASL is a direct index into the UBA +;;; paging RAM, and will range from 32. to 63. +;;; +;;; This two different page size thing is all a mess and I should fix it +;;; sometime. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: + +;;; Static pages +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +;;; Dynamic pages + +EBLK +UBAIFS: 777777777760 ;Slot map, bit on if free +BBLK + +; Allocate a UBA I slot +; Return +1, A/ slot index + +UBAASL: PUSH P,B + CONO PI,PIOFF + MOVE A,UBAIFS + JFFO A,UBASL1 + CONO PI,PION + POP P,B ;Clean up for no good reason + BUG HALT,[Out of UBA slots] + +UBASL1: MOVNS B + MOVSI A,400000 + LSH A,B ;A/ bit to snarf + ANDCAM A,UBAIFS + CONO PI,PION + MOVN A,B + ADDI A,32. ;First dynamic slot + POP P,B + POPJ P, + +; Deallocate the UBA slot in A +; A/ UBA index to free. Bashes A,TT +UBAFSL: CAIL A,32. + CAIL A,64. + BUG HALT,[Bad UBA index],OCT,A ;Paranoid for now + MOVEI A,-32.(A) + MOVNS A + MOVSI TT,400000 + LSH TT,A + IORM TT,UBAIFS + POPJ P, + +SUBTTL UBI DEVICE + +UBIDVS:: +REPEAT NUBIDV,[ +EBLK + 0 ; Bit in -7(I) + -1 ; User or -1 in -6(I) + 0 ; Count in -5(I) + 0 ; Saved I in -4(I) +CONC UB,\.RPCNT,BK: + 0 +BBLK + MOVEM I,.-2 + JSP I,UBIBRK +CONC UB,\.RPCNT,DV: + JRST 12,@ + CONC UB,\.RPCNT,NM ; Name in 1(I) +IFE .RPCNT, LUBIDV==:.-UBIDVS +];REPEAT NUBIDV + +UBINAM==:1 +UBISVI==:-4 +UBICNT==:-5 +UBIUSR==:-6 +UBIBIT==:-7 + +UBIBRK: AOS UBICNT(I) + EXCH U,UBIUSR(I) + JUMPL U,UBIBK9 + EXCH T,UBIBIT(I) + TDNE T,MSKST2(U) + IORM T,IFPIR(U) + EXCH T,UBIBIT(I) +UBIBK9: EXCH U,UBIUSR(I) + HRLI I,UBISVI(I) + JRA I,(I) + +EBLK +UBISW: -1 ? 0 +BBLK + +; .OPEN +UBIO: MOVEI T,NUBIDV + SKIPA I,[UB0DV] +UBIO1: MOVEI I,LUBIDV(I) + CAME A,UBINAM(I) + SOJG T,UBIO1 + JUMPLE T,OPNL4 ; FILE NOT FOUND + PUSHJ P,SWTL + UBISW + SKIPE UBIUSR(I) + JRST OPNL23 ; FILE LOCKED + MOVEI T,(R) + SUBI T,IOCHNM(U) + MOVE T,CHNBIT(T) + MOVEM T,UBIBIT(I) + HRRZM U,UBIUSR(I) + HRLZI T,(I) + HRRI T,DNUBI + MOVEM T,(R) + JRST LSWPJ1 + +; .IOPUSH/.IOPOP +UBIIOP: HLRZ A,(R) + JUMPE I,UBIOP7 + SUBI R,IOCHNM(U) + SKIPA R,CHNBIT(R) +UBIOP7: SETZI R, + MOVEM R,UBIBIT(A) + POPJ P, + +; .CALL RFNAME +UBIRCH: MOVE B,UBINAM(A) + POPJ P, + +; .CLOSE +UBICL: SETOM UBIUSR(A) + POPJ P, + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.1644 b/system/its.1644 new file mode 100644 index 0000000..d4c7b7c --- /dev/null +++ b/system/its.1644 @@ -0,0 +1,21946 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SYMTAB 12003.,5500. +TITLE ITS + +SUBTTL DEFINITIONS + +.NSTGWD .SEE PATB ;NO STORAGE WORDS ALLOWED UNTIL PATB + +IF1 [ PRINTX \MACHINE NAME = \ +;WELL-KNOWN MACHINE NAMES ARE: +; AIKA AI LAB KA10 (R.I.P.) +; MLKA MATHLAB KA10 (R.I.P.) +; DM DYNAMIC MODELING KA10 (R.I.P.) +; MC Mail Computer KS10 +; AI AI Lab KS10 +; MX The ex-MC KL10 +; ML Math Lab KS10 +; MD Mostly Development KS10 +; SI Stacken ITS KS10 +; FU Australian KS10 +; PM PandaMonium KS10 +; DX DigeX KS10 +;THE FILE "CONFIG" HAS ASSEMBLY SWITCHES AS A FUNCTION OF MACHINE. + +.TTYMAC A +IFN ASCII/A/&ASCII/ /,.FATAL USE UPPER CASE! +DEFINE MCOND X ;0 IFF THIS IS MACHINE X. +,TERMIN +DEFINE MNAME X ;USED TO SUBSTITUTE IN THIS MACHINE'S NAME. +X!!A!!TERMIN +FOO==.TTYFLG ;MAKE ERR FILE LOOK NICE +.TTYFLG==1 +PRINTX/A +/ +.TTYFLG==FOO +TERMIN ];IF1 + +IFNDEF PCLSW,PCLSW==1 ;1 => ASSEMBLE PCLSR TEST FEATURE +IFNDEF TT11BY,TT11BY==8 ;PDP11-TV OUTPUT BUFFER BYTE SIZE. +.MLLIT==1 ;MULTI-LINE LITERAL MODE +ASTIME==.OP .OPER+@,0,.RTIME ;GET ASSEMBLY TIME AND DATE IN SIXBIT. +ASDATE==.OP .OPER+@,0,.RDATE ;RH OF INSN MUST BE 0, SO MIDAS WILL PUT IN PROPER AC FLD. + +;AC DEFS + +A=1 +B=2 +C=3 +D=4 +E=5 +TT=6 +I=7 +Q=10 +J=11 +R=12 +W=13 +H=14 +P=15 ;DO NOT CHANGE! ;PDL POINTER +T=16 ;" +U=17 ;" ;USER INDEX + +.XCREF A,B,C,D,E,TT,I,Q,J,R,W,H,P,T,U + +IF1 EXPUNGE APR,OCT,DEC ;FOR NEW CALENDAR HACK + +NULBLK==4 ;NUMBER OF LOCKED SWITCH BLKS IN USR VARIABLES + ;USES 2 WDS OF USER VAR PER + +NPVSEC==30. ;NUMBER OF SECONDS A USER IS ALLOWED TO BE IN THE PRIVILEDGED SWAPPING CLASS +IF2 LIOBLK==_-10. ;LOWEST BLOCK NEVER TO BE SHUFFLED + ;ALSO MAX # OF BLOCKS SYS JOB MAY HAVE +IF2 MAXJ==/LUBLK ;ROUND UP TO ACTUAL MAX #JOBS + +DIRMAP==1 ;ENABLE DIRECT MAPPING OF HIGH HALF + ;I DON'T THINK IT WORKS TO TURN THIS OFF. +NIOCHN==20 ;NUMBER OF I/O CHANNELS PER USER + +DEFINE $INSRT $%$%$% ;PRINTX MESSAGE WHEN FILE GETS INSERTED + .INSRT $%$%$% > + PRINTX \ ==> INSERTED: \ + .TYO6 .IFNM1 + .TYO 40 + .TYO6 .IFNM2 +PRINTX \ +\ +TERMIN + +;;; CONFIG uses this macro... +DEFINE CONC A,B +A!B!TERMIN + +$INSRT CONFIG ;CONFIGURATION SWITCHES FOR ALL KNOWN MACHINES + +$INSRT BITS ;DEFINITIONS OF MANY BIT NAMES + +;IN BADBTS => CLASS 2 OR 1 INTERRUPT ;IN VBDBTS=> CLASS 1 INTERRUPT +VBDBTS==%PIB42\%PIVAL\%PIBRK\%PIC.Z\%PI1PR\%PITRP\%PIDCL +BADBTS==VBDBTS\%PIMPV\%PIIOC\%PIILO\%PIMAR\%PIDIS\%PIOOB\%PILOS\%PIFET\%PIWRO\%PIPAR\%PITTY\%PIPDL\%PINXI + +UUOMIN==40000,, ;SMALLEST NUM THAT COULD BE A SYSTEM CALL +UUOMAX==50000,, ;ONE GREATER THAN LARGEST NUM " +UIOT=UUOMAX ;USE FOR USER I/O INST TRAP + + ;MAX DYN ALLOC ALLOC IO BUFFERS +MXIOB==100 ;MAX POSSIBLE + +SIOMT==50 ;MAX SIZE TRANSLATION TABLE + +LUPDL==50 ;LENGTH USER PDL MUST BE >= 40 FOR 2311 GC +LUIOP==20 ;LENGTH OF USER IO PDL +CPDLL==40 ;LENGTH CLOCK CHANNEL PDL +LUTCP==40 ;LENGTH UTC PDL (NETWORKS AND DISKS) +LSYSP==100 ;SYSTEM JOB PDL +LTTYP==40 ;LENGTH OF TTY (INTERRUPT LEVEL) PDL + +DMNSZ==20 ;# ENTRIES IN DEMON BUFFER (DMNBF) + +MXCZS==5 ;MAX NUMBER ^Z'S PER CLOCK BREAK + +SCLKI==30. ;60'THS PER SLOW CLOCK +VSCLKI==2*60.*60. ;60'THS PER VERY SLOW CLOCK TICK +MXOPT==8. ;SLOW CLOCK MAX UT OP CAN TAKE +NINFP==8. .SEE UFIN ;MAX # OF DIRECT INFERIORS A PROCEDURE MAY HAVE + +SSCHDB==100 ;LENGTH OF SCHEDULER HISTORY BUFFER + +SPD==60.*60.*24. ;# SECS IN A DAY (FITS IN A HALFWORD) + PDUPS==60. ;# PDCLK INCREMENTS/SEC + +OPNCOM==410300 ;COMMAND FIELD IN LH OF FIRST OPEN WORD + +IFN 340P,N340PB==10. ;# EXEC PGS USED FOR 340 DATA MUST BE EVEN +IFN N11TYS,[ + NTTPG==6 ;# EXEC PGS FOR PDP11 TV TTYS. + NTVBP==11 ;THESE PAGES ADDRESS THE WHOLE VIDEO BUFFER MEMORY ADDRESS + ;SPACE OF THE TV 11. THE LAST OF THESE ADDRESSES THE + ;TV CONSOLE REGISTER +] +NUVPG==256. ;NUMBER OF VIRTUAL PAGES PER USER. SIZE OF PAGE TABLE VARS. + ;DON'T TRY TO CHANGE THIS. +;CIRCULAR PAGE LINK FORM +;2.9=0 +;1.1-1.8 PAGE # +;2.8-1.9 USER # +;2.9=1 +;2.8=0 2.7-1.1 LINK TO MMP TABLE +;2.8=1 2.7-1.1 LINK TO MEM PNT TABLE +;EXCEPT 2.9-1.1=777777 => ABSOLUTE PAGE, NOT LINKED + +SUBTTL GOBBLE TTYTYP FILE + +IFN XGP\N11TYS,[IFE TEN11P,[ + .ERR XGP OR N11TYS WITHOUT TEN11P + N11TYS==0 + XGP==0 +] +] +IFNDEF UNSPLP,UNSPLP==*DEMON*<1-TPLP> + ;1 IF THE "UNSPOO" PROGRAM DOES LPT SPOOLING. + +IFNDEF TSYSM,[ +MNAME PRINTX \NO PARAMS KNOWN FOR , MACHINE. +\ +.INSRT TTY: +] + +IF2,[ +;TTY LINES DEFINITIONS + +;MACRO WHICH RETURNS THE %TY BIT FOR THE CONTROLLER ACCORDING TO THE LINE NUMBER + +DEFINE CNTRLR +IRPS F,,[0 NFKSTY NFETY NFNTY NFNVTY NFDZTY NFDPTY NFMTY NFDLTY NFSTTY NF11TY + ]NT,,[NOTYS NKSTYS NETYS NNTYS NNVTTS NDZTYS NDPTYS NMTYS NDLTYS NSTTYS N11TYS + ]FG,,[%TYOTY %TYKST %TYETY %TYNTY %TYNVA %TYDZT %TYDPK %TYMTY %TYDL %TYSTY %TY11T] + IFGE -F,[IFL -,[FG]]TERMIN TERMIN + +;MACRO WHICH RETURNS $TTISP, $TTOSP BITS GIVEN BAUD RATES + +DEFINE SPEEDC +*%TTISP+*%TTOSP!TERMIN + +DEFINE SPEED1 +IRPS BD,,[0 600 110 150 300 1200 1800 2400 4800 9600 25K 40K 50K 80K + ]CD,,[0 1 2 3 4 5 6 7 10 11 12 13 14 15 ] +IFSE BAUD,BD,[CD] TERMIN TERMIN + +;KEYWORD PARAMETERS TO TTY DEFINITION MACROS +; FOR OVER-RIDING DEFAULTS +;SPEED NUMBER OF BAUDS OUTPUT +;ISPEED NUMBER OF BAUDS INPUT IF DIFFERENT +;TT LH(TTTYP) IN ADDITION TO SPEED CODE +;TY RH(TTYTYP) IN ADDITION TO CONTROLLER BIT +;TO LH(TTYOPT) IN ADDITION TO USUAL CODES FOR TERMINAL TYPE +;TP RH(TTYOPT) IN ADDITION TO PAD CODES +;TCT TCTYP +;HOR SCREEN WIDTH +;VER SCREEN HEIGHT +;ROL LINES PER GLITCH WHEN SCROLLING + +;DEFINE TTY AS PRINTING. +;IF SPEED IS 110, ASSUME TTY IS TELETYPE, +;MEANING CAN'T BS, STANDARDIZE ALTMODES. +;IF KA10 CONSOLE TTY OR TK10 TTY, NEED PARITY +DEFINE TTDPRT N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==80.-IFE 110-SPEED,8 +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOALT+IFN 110-SPEED,[%TOMVB+%TOLWR-%TOALT],,<1+IFE 300-SPEED,[IFE TY&<%TYDIL\%TYRLM>,[3]]>*%TPPCR+TP +T!N!$TYP==TT+\\,[%TTPAR]]>,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS MEMOREX +DEFINE TTDMRX N,+SPEED=600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,4*%TPPLF+6*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNMEM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS TERMINET. +DEFINE TTDTRM N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=120.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOOVR+%TOMVB+%TOLWR,,5*%TPPLF+TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNTRM +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A LPT. +DEFINE TTDLPT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=0,HOR=200.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS AN LA36 DECWRITER. +DEFINE TTDLA36 N,+SPEED=300,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=132.,TCT=%TNPRT,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==MOVE +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS IMLAC. (RUNNING SOFTWARE-TTY PROGRAM) +DEFINE TTDIML N,+SPEED=50K,ISPEED=25K,TT=0,TY=0,TO=0,TP=0,HOR=90.,VER=44.,TCT=%TNSFW,ROL=10.,SMARTS=%TQIM1 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOOVR+%TOLWR+%TOMVB+%TOMVU+%TOERS+%TOLID+%TOCID,,TP +T!N!$TYP==%TTDDI+TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS VT52 +DEFINE TTDVT N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNESC,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS,,TP+%TPPTB* + ;DIRECT POSITIONING LOSES AT 9600 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS H19 +DEFINE TTDH19 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,VER=24.,TCT=%TNH19,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS AAA +DEFINE TTDAAA N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+%TPMTA,HOR=80.,VER=48.,TCT=%TNAAA,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*2 +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS C100 +DEFINE TTDC100 N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=79.,VER=24.,TCT=%TNHDS,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOLWR+%TOERS+%TOLID+%TOCID,,TP+%TPPTB*3+ +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE TTY AS TEKTRONIX. +DEFINE TTDTEK N,+SPEED=1200,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNTEK,HOR=73.,VER=35.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVU+%TOOVR+%TOMVB+%TOLWR+%TOMOR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==0 +TERMIN + +;DEFINE TTY AS A LOSING DATAPOINT +DEFINE TTDLSR N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNODP +T!N!$HOR==71.-IFN MCOND AIKA,1 ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS DATAPOINT. +DEFINE TTDDPT N,+SPEED=2400,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=[72.-IFN MCOND AIKA,[1]],SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNDP +T!N!$HOR==HOR ;OTHER DATAPOINTS HAVE SHORTER SCREENS. +T!N!$VER==25. +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS,,4*%TPPCR+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE TTY AS A TELERAY 1061 +DEFINE TTDRAY N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,HOR=80.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$TCT==%TNRAY +T!N!$HOR==HOR +T!N!$VER==24. +T!N!$OPT==TO+%TOMVU+%TOMVB+%TOERS+%TOLWR+%TOLID+%TOCID,,3*%TPPTB+TP +T!N!$TYP==TT+,,TY+ +T!N!$ROL==1 +TERMIN + +;DEFINE A TTY THAT IS A GT40. +DEFINE TTDGT40 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS,TCT=%TNDP,HOR=72.,VER=32.,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOOVR+%TOLWR,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS A LINE TO A PDP11. +DEFINE TTD11 N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=0,TCT=%TNPRT,HOR=72.,VER=MOVE,ROL=1,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOOVR+%TOALT,,TP +T!N!$TYP==TT+%TTDDI+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE A TTY THAT IS RANDOM. +DEFINE TTDRAN N,+SPEED=FOO.,ISPEED=,TT=0,TY=0,TO=FOO.,TP=FOO.,TCT=FOO.,HOR=FOO.,VER=FOO.,ROL=FOO.,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DATAMEDIA +DEFINE TTDDTM N,+SPEED=4800,ISPEED=,TT=0,TY=0,TO=0,TP=%TPORS+3*%TPPCR,HOR=80.,VER=24. +T!N!$SMT==0 +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOERS+%TOMVU+%TOLWR+%TOLID+%TOCID,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==%TNDTM +T!N!$ROL==1 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING VIA TEN-11 INTERFACE. NO OPTIONS. +DEFINE TTDTV N +T!N!$SMT==%TQGRF+%TQVIR+%TQREC+%TQXOR+<.DPB 14,<.BP %TQHGT>>+<.DPB 6,<.BP %TQWID>>,,%TRSCN +T!N!$HOR==96. +T!N!$VER==45 +T!N!$OPT==%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC +T!N!$TYP==%TTLCL+,,%TY11T +T!N!$TCT==%TNTV +T!N!$ROL==4 +TERMIN + +;DEFINE A PDP11 TV COMMUNICATING AS A SOFTWARE TTY. TYPICALLY A GRINNELL (512x512). +DEFINE TTDGRN N,+SPEED=9600,ISPEED=,TT=0,TY=0,TO=0,TP=%TPCBS+%TPORS,HOR=86.,VER=50.,TCT=%TNSFW,ROL=0,SMARTS=0 +T!N!$SMT==SMARTS,, +T!N!$HOR==HOR +T!N!$VER==VER +T!N!$OPT==TO+%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI,,TP +T!N!$TYP==TT+,,TY+ +T!N!$TCT==TCT +T!N!$ROL==ROL +TERMIN + +;DEFINE AN STY LINE. NO OPTIONS. +DEFINE TTDSTY N +T!N!$SMT==0,, +T!N!$HOR==81. +T!N!$VER==MOVE +T!N!$OPT==%TOMVB+%TOOVR+%TOLWR+%TORAW,,%TPORS +T!N!$TYP==%TYSTY +T!N!$TCT==%TNPRT +T!N!$ROL==1 +TERMIN + +DEFINE MCONDX MCHN +IFE MCOND MCHN,TERMIN + +;;; THE NEXT TWO MACROS CAUSE TTYTYP FILE TO BE INSERTABLE BY BOTH +;;; PDP-10 AND PDP-11 PROGRAMS. + +DEFINE .ENDC +TERMIN + +DEFINE .ENDR +TERMIN + + .CRFOFF +$INSRT TTYTYP + .CRFON +EXPUNGE TTDPRT,TTDTRM,TTDDPT,TTDMRX,TTDGT40,TTD11,TTDRAN,TTDGRN,TTDVT,TTDTEK +EXPUNGE TTDTV,TTD2741,TTDSTY,TTDLPT,TTDIML,TTDLA36,TTDLSR +EXPUNGE SPEEDC,SPEED1,CNTRLR,MCONDX,.ENDC,.ENDR +] ;END OF IF2 + +SUBTTL BUG MACROLOGY + +;Macro for reporting a bug or other interesting condition +;Use this in place of JRST 4, especially when condition is automatically +;recoverable or wants explanation typed out for benefit of loser. +; +;First argument is one of the following symbols: +; INFO - just print on the system console +; CHECK - same as INFO unless SYSDBG non-zero or buffer full, then same as PAUSE +; PAUSE - print message, go to DDT, allow alt-P +; HALT - print message, go to DDT, do not allow alt-P +; DDT - PAUSE but not because of a bug (shorter message), allow alt-P +; AWFUL - same as HALT but usable when there is no pdl in P +; Should there be a combination of AWFUL and PAUSE? +; That would require restoring P upon attempt to continue +;Arguments after the first are either strings to be printed +;(enclose in brackets), or format,value pairs. Value is any +;address; indexing and indirection are allowed, however registers +;P and TT may not be referenced. +;A format is one of the following symbols: +; OCT - octal number, with ,, if bits on in the left halt +; DEC - decimal number +; THOU - decimal number with commas every three digits +; CR - print a carriage return (unfortunately swallows and ignores an arg) +; SIXBIT - sixbit word +; ASCIZ - asciz string +;Undefined formats will be taken as strings to be printed. +;The maximum number of value arguments is 6 +;A space is printed after each formatted value. A space is also +;printed after the last string and before any additional formatted values. +; +;With no arguments, BUG may be used in place of JRST 4,. +;It uses the same amount of storage but has the advantage of going +;straight to DDT. In this case there won't be a specific message +;about what the bug was, of course. +; +;Note that the BUG macro always generates one word of code, and hence +;may be skipped over. +;All registers are preserved. +;P must point at a valid PDL. +; +;Due to Midas inadequacy, the BUG macro may not be used from inside +;a literal. You will get an error (label inside brackets) if you try it. +; +;Example: +; BUG PAUSE,[DSK: DRIVE NUMBER ],OCT,Q,[IS OFF-LINE.] +; +DEFINE BUG FLAVOR,ARGS/ +IFNB [FLAVOR][ + ;Make sure we are not in a literal, since cannot get value of "." +BUGBUG: EXPUNGE BUGBUG + ;Generate call to appropriate flavour of subroutine + ZZ==0 + IRPS FLA,,[INFO,CHECK,PAUSE,HALT,DDT]SUB,,[BUGINF,BUGCHK,BUGPSE,BUGHLT,BUGDDT] + IFSE [FLAVOR]FLA,[ + PUSHJ P,SUB + ZZ==1 ] + TERMIN + IFSE [FLAVOR]AWFUL, JSR BUGAWF + .ELSE IFE ZZ, .ERR "FLAVOR" UNKNOWN FLAVOUR OF BUG + + BUGB==0 ;Initialize formatting bits + + ;Initialize remote macros +DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!ZZ003!TERMIN + +DEFINE BUGMC4 ZZ001 +ZZ001 +TERMIN + + BUGN==0 ;number of accumulated arguments + BUGNN==0 ;total number of arguments + BUGF==0 ;next thing not argument + IRP ARG,,[ARGS] + ;; Processing "ARG" + IFN BUGF,[ ;Address of word to print + BUGN==BUGN+1 + BUGNN==BUGNN+1 + BUGMC5 [ARG] + BUGF==0 + ] + .ELSE [ ;Name of format in which to print? + IRPS FMT,,OCT DEC THOU CR UNUSED5 SIXBIT ASCIZ + IFSE [ARG]FMT,[ + BUGF==1 + BUGB==BUGB+<<.IRPCNT+1>_<<5-BUGNN>*3>> + ] + TERMIN + IFE BUGF,[ ;Just a string to be printed + IFN BUGN,[ ;Say to output some arguments before this string + BUGMC3 BUGN + BUGN==0 + ] + BUGMC2 [ARG] + ] ] + TERMIN + IFG BUGNN-6, .ERR MORE THAN 6 WORDS TO BE PRINTED IN BUG MACRO + ;Make bug table entry: length,,pc ? bits,,string ? args + IF1, BUGMC1 'ZZ==[ASCIZ|',,'|]' + IF2,[ + ZZ==. + LOC BUGTAB+LBUGTB + BUGNN+2,,ZZ + BUGMC1 'BUGB,,[ASCIZ|',,'|]' + BUGMC4 + LOC ZZ + ] + LBUGTB==LBUGTB+BUGNN+2 +];end IFNB +.ELSE PUSHJ P,BUGNIL +TERMIN + +LBUGTB==0 ;Initialize length of bug table + +;This support macro appends a string to the middle argument of BUGMC1 +DEFINE BUGMC2 STRING +BUGMC1 //,[DEFINE BUGMC1 *ZZ001*ZZ002*ZZ003* +ZZ001!ZZ002!]//,STRING!!ZZ003!TERMIN +TERMIN + +;This support macro appends a character, given by number, to the middle +;argument of BUGMC1 +;Only for characters 0 through 7 +DEFINE BUGMC3 #N +IRPC C,,.QUOTE// + IFE .IRPCNT-N,{ + BUGMC2 C + .ISTOP } +TERMIN +TERMIN + +;This one is a simple remote macro +DEFINE BUGMC5 STR +BUGMC4 [DEFINE BUGMC4 ZZ001 +ZZ001]STR +TERMIN +TERMIN + +SUBTTL DEFINE PI CHANNELS + +LPTP==OLPTP+NLPTP+GLPTP ;ANY KIND OF LPT EXCEPT A TTY LPT +IFE NMTCS,[ ;IF NO MAG TAPES AT ALL +TM10A==0 ; CAN'T HAVE ANY KIND! +TM10B==0 +TM03S==0 +] ;IFE NMTCS +TM10P==TM10A+TM10B ;SOME KIND OF A TM10 MAGTAPE PRESENT +IFN TABP,TABCLK==0 ;1=>PUT TABLET ON CLOCK CHNL + +;PRIORITY INTERRUPT CHANNEL ASSIGNMENTS + DCCHN==1 ;DC CHANNEL + DCLOC=40+2*DCCHN ;DC INTERRUPT LOCATION +IFN IMPP, IMPCHN==1 ;IMP STUFF +IFN NETP, NETCHN==2 ;SOFTWARE ACTIVATED... + UTCCHN==2 ;UTC CHANNEL + DSKCHN==UTCCHN ;2314 CHANNEL + MTCCHN==UTCCHN ;MAG TAPE CONTROL CHANNEL + LPTCHN==4 ;LINE PRINTER, PAPER TAPE, ETC. CHANNEL + TTYCHN==3 ;TTY CHANNEL +IFN PLTP, PLTCHN==4 ;PLOTTER CHANNEL +IFN PTRP, PCHCHN==4 ;PTP CHANNEL +IFN PTRP, PTRCHN==4 ;PAPER TAPE READER CHANNEL +IFN NTYP, NTYCHN==4 ;NTY 11 KLUDGE +IFN 340P, SDCHN==4 ;DISPLAY SPECIAL CHANNEL +IFN DSDP, DSDCHN==4 ;INTERRUPT FROM OTHER PROCESSOR +IFN ARMP, TIPBCH==5 ;ARM TIP BREAK CHNL +IFN OMXP, OMPCHN==5 ;OUTPUT MULTIPLEXOR +IFN VIDP, NVDCHN==5 ;NEW VIDI +IFN TABP, IFE TABCLK, TABCHN==5 ;TABLET +IFN 340P\E.SP, DISCHN==6 ;DISPLAY DATA CHNL +IFN CH10P, CHXCHN==5 ;CHAOSNET + ;WOULD BE 6 BUT PI 6 BROKEN IN ML-KA TTLIOB +IFN CH11P, CHXCHN==6 ;UNIBUS CHAOSNET PACKET COPYING +IFN TABP, IFN TABCLK, TABCHN==7 ;TABLET + APRCHN==7 ;DO NOT CHANGE + + PIOFF==400 ;TURN OFF PI SYSTEM + PION==200 ;TURN ON PI SYSTEM + PICOFF==1200 ;TURN OFF PI CHANNEL + PICON==2200 ;TURN ON PI CHANNEL + PICIRQ==4200 ;REQUEST INTERRUPT ON PI CHANNEL + CLKON==2201 ;ABSOLUTE + CLKOFF==1201 +IFN OMXP, OMXON==CLKON\<400_-OMPCHN-1> +IFN OMXP, OMXOFF==CLKOFF\<400_-OMPCHN-1> + LPTON==CLKON\<400_-LPTCHN-1> + LPTOFF==CLKOFF\<400_-LPTCHN-1> +IFN PTRP, PTPON==CLKON\<400_-PCHCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PCHCHN-1> +IFN PTRP, PTRON==CLKON\<400_-PTRCHN-1> +IFN PTRP, PTROFF==CLKOFF\<400_-PTRCHN-1> + TTYON==CLKON\<400_-TTYCHN-1> + TTYOFF==CLKOFF\<400_-TTYCHN-1> + UTCON==CLKON\<400_-UTCCHN-1> + UTCOFF==CLKOFF\<400_-UTCCHN-1> +IFN NETP, NETON==UTCON +IFN NETP, NETOFF==UTCOFF +IFN KL10P, DTEON==CLKON +IFN KL10P, DTEOFF==CLKOFF + + DSKRQ==PICIRQ\PICON\<200_-DSKCHN> ;RQ INT + TURN ON FOR SAKE OF KL + MTCRQ==PICIRQ\PICON\<200_-MTCCHN> + UTCRQ==PICIRQ\PICON\<200_-UTCCHN> + TTYRQ==PICIRQ\PICON\<200_-TTYCHN> + CLKRQ==PICIRQ\PICON\<200_-APRCHN> +IFN NETP,NETRQ==PICIRQ\PION\<200_-NETCHN> +IFN CH11P,CHXRQ==PICIRQ\PICON\<200_-CHXCHN> + +IFN TABP,[ +IFN TABCLK,[ +TABON==CLKON +TABOFF==CLKOFF +] +IFE TABCLK,[ +TABON==CLKON\<400_-TABCHN-1> +TABOFF==CLKOFF\<400_-TABCHN-1> +] +] + +IFN NUNITS, IFE NEWDTP, CUINT==5000+UTCCHN ;CONO TO UTC TO ACTIVATE UTAPE INTERRUPT + +PMLCAD==(.BP ) ;BYTE POINTER TO L.H. REAL CORE ADR +PMRCAD==(.BP PMRCM) ;BYTE POINTER TO R.H. REAL CORE ADR + +SUBTTL DEFINE DEVICE CODES, IOBFT CHNL NUMBERS + +IFN STKP, STK==70 ;STANFORD KEYBOARD +IFN OLPTP, OLPT==124 ;LINE PRINTER +IFN NLPTP, NLPT==464 +IFN TM10P, MTC==340 ;MAG TAPE CONTROL +IFN TM10P, MTS==344 ;MAG TAPE STATUS +IFN VIDP, NVDX==620 ;NEW VIDI X +IFN VIDP, NVDY==624 ;NEW VIDI Y +IFN VIDP, NVDT==630 ;NEW VIDI T (DEFLECTION DELAY) +IFN PLTP, PLT==654 ;CAL COMP PLOTTER +IFN HCLKP, CLK1==710 ;HOLLOWAY CLOCK +IFN HCLKP, CLK2==714 ; " +IFN IMXP, MPX==574 ;INPUT MULTIPLEXOR +IFN OMXP, OMPX==570 ;OUTPUT MULTIPLEXOR +IFN TK10P\NTYP, NTY==600 ;KNIGHT TTY KLUDGE +IFN MTYP, MTY==400 +IFN DL10P, DLB==60 ;DL10 BASE +.ALSO DLC==64 ;DL10 CONTROL +IFN PDCLKP, PDCLK==500 ;DE-CORIOLIS CLOCK (FOR ML-KA AND DM, CALENDAR CLOCK) +IFN DSDP, DSDEV==20 ;DE SELECTION AND INTER COM DEVICE +IFN DSDP, DSDEVN==24 ;DE SELECTION DEV (FOR DEVICES YOU DATAO DEV CODE TO DSDEVN) +IFN ARMP, TIPDEV==504 ;TIP BREAK DEVICE +IFN RBTCP, RBTCON==514 ;ROBOT CONSOLE +IFN DPKPP, DPK==604 ;DATA POINT KLUDGE +IFN DC10P, DC0==610 ;2314 DISK CONTROL +IFN DC10P, DC1==614 ;2314 DISK CONTROL +IFN RP10P, DPC==250 ;RP10 DISK CONTROL +IFN RH10P, DSK==270 ;RH10 DISK CONTROL +IFN KAIMP, IMP==460 ; AI-KA/ML-KA/MC-KL IMP interface +IFN DMIMP, FI==424 ; DM IMP hardware +IFN NUNITS,[ +IFN NEWDTP,[ + DTC==320 + DTS==324 +] ;END OF IFN NEWDTP +] ;END OF IFN NUNITS + + +;IOBFT CHANNEL NUMBERS - 77 MEANS "FREE" + +IFN NUNITS, NUTIC==8 ;NUMBER UT IN CHNLS +.ELSE NUTIC==0 +IFN NUNITS, NUTOC==8 ;NUMBER UT OUT CHNLS +.ELSE NUTOC==0 + NFCLC==NUTIC+NUTOC+1 ;# OF FIRST CORE LINK CHNL + NCLCH==14 ;NUMBER CORE LINK CHNLS + NFNETC==NFCLC+NCLCH ;# OF FIRST NCP NET CHNL (if any) + ;NNETCH DEFINED IN CONFIG +IFG NFNETC+NNETCH-77, .ERR TOO MANY IOBFT CHANNELS + +SUBTTL RANDOM DEFINITIONS FOR I/O DEVICES + +IFN DSDP, IFN VIDP, DSNVID==200000,, ;DEASSIGN BIT FOR NVD +IFN DSDP, IFN 340P, DSNDIS==4000,, ;DEASSIGN BIT FOR DIS +IFN DSDP, IFN NMTCS, DSMTC==1,, ;DEASSIGN BIT FOR MAG TAPE + +IFN RBTCP, RLTSWC==17 ;ROBOT CONSOLE SELECT FOR LIGHTS AND SWITCHES +IFN RBTCP, IFN TABP, RTABC==16 ;ROBOT CONSOLE SELECT FOR TABLET + +IFN IMXP, LCHN==177 ;MULTIPLEXOR LIMIT ON READ IN + + NUDCH==14 ;NUMBER DIRECTORY CHNLS +IFN IMXP, NPOTCH==20. ;NUMBER POT CHANNELS +IFG NQCHN+1+NQS-77, .ERR MORE THAN 6 BITS OF DISK CHANNEL NUMBER + +IFN CODP, CODBFL==5 ;CODE BUFFER +IFN PTRP, PUNSIZ==20 ;PTP BUF SIZ +IFN PTRP, REDSIZ==200 ;PTR BUF SIZ +IFN PLTP, LPLBUF==200 ;PLT BUF SIZ +IFN LPTP, LPTBSZ==1000 ;LPT BUF SIZ +IFN VIDP, NVDLNG==340 ;NVD BUF SIZE +IFN TPLP, TPLBSZ==100 ;TPL BUFFER SIZE IN SYS JOB +IFN TABP, LTABBF==100 ;TABLET BUFFER +IFN N11TYS, TT11CR==764044 ;UNIBUS ADR OF TV11 CONSOLE REG + +EOFCH==3 ;SYSTEM END OF FILE CHR +EOFWRD=REPEAT 5,[EOFCH_<.RPCNT*7+1>\]0 ;WORD OF EOFCH'S + +IFN 340P, DVEF==4000 ;DISPLAY VERTICAL EDGE FLAG +IFN 340P, DHEF==1000 ;DISPLAY HOR EDGE FLAG + +IFN 340P, EWRT==400./12. ;EQIV "COST" IN DISPLAY WRDS FOR TRIP THRU RECYC +IFN 340P, MDISWD=70000 ;MAX # WDS SENT TO SCOPE IN 1/2 SEC + +NSWPV==E.SP\340P+VIDP+IMXP ;# OF DEVICES THAT CAN SWAPIN PAGES + +IFN C1MXP,[ +IFN NMTCS, MAGLOC==76 ;INTERRUPT LOCS FOR MAGTAPE +IFN NUNITS, DCMLOC==74 ;" " FOR DC +IFN IMXP, IMXLC==66 ;" " IMX +IFN IMPP,[ + IMPILC==70 ;INPUT FROM IMP + IMPOLC==72 ;OUTPUT TO IMP +] +] + +IFE C1MXP,[ +IFN NMTCS, MAGLOC==42 +IFN NUNITS, DCMLOC==42 +] +IFN PLTP,[ +;PLOTTER CONTROL BITS +SD==4000 +PD==10000 +PUP==200 +PDN==400 +SDC==20000 +PDC==40000 +SDS==1000 +PDS==2000 +] + IFN KA10P,[ + +SUBTTL STUFF PECULIAR TO KA-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +LPM=102000,, ;LOAD PG MEM STATE VECTOR DONT CLR ASSOC MEM +LPMR= LPM 2, ;CLEAR ASSOC MEM AND LOAD +SPM= LPM 1, ;STORE PG MEM STATE VECTOR +LPMRI=LPM 6, ;LOAD PM, CLEAR ASSOC REG, AND CAUSE INTERRUPT +EXPGNG==4 .SEE UPQUAN ;4 TO TURN ON EXEC PAGING +XCTR=103000,, ;EXECUTE INSTRUCTION WITH MAPPING CONTROLLED BY AC FIELD + ;VIOLATION CAUSES USER MEM PROTECT INTERRUPT UNLESS INHIBITED + ;VIOLATION ALSO SKIPS BUT THIS IS OF NO CONSEQUENCE UNLESS + ;INTERRUPT IS INHIBITED SINCE PC WILL BE RESET FROM OPC +XCTRI= XCTR 4, ;XCTR WITH PAGE FAULT INHIBITED (SKIPS ON FAULT) + ; AC FIELD VALUES FOR XCTR AND XCTRI + XR==1 ;MAP READ MAIN OPERAND OF SIMPLE INSTRUCTION (MOVE, SKIPL, HLL) + XW==2 ;MAP WRITE MAIN OPERAND OF SIMPLE INSTRUCTION (MOVEM) + XRW==3 ;MAP READ/WRITE OPERAND OF SIMPLE INSTRUCTION (E.G. IORM) + XBYTE==3;MAP BYTE DATA AND BYTE POINTER (ILDB, IDPB) + XBR==1 ;MAP BLT READ + XBW==2 ;MAP BLT WRITE + XBRW==3 ;MAP BOTH OPERANDS OF BLT + ;KA10 PAGING BOX GOES BY WHETHER IT'S A READ OR WRITE (OR RW) CYCLE + ;KL10 PAGING BOX WORKS DIFFERENTLY (SEE BELOW) + ;DO NOT USE MULTI-OPERAND INSTRUCTIONS (DMOVE, PUSH, ETC.) WITH XCTR + +DEFINE CLRPGM U ;CLEAR PAGER ASSOCIATIVE MEMORY. ARG IS USUALLY "(U)". + SPM UPGML!U ;STORE SO DON'T LOSE QUANTUM TIMER + LPMR UPGML!U +TERMIN + +;;; MISCELLANEOUS BUILTIN I/O DEVICES + +PI==4 ;INTERRUPT SYSTEM +LIGHTS==PI ;DEVICE CODE FOR DATAO THAT SETS CONSOLE LIGHTS. +CLK==0 ;DEVICE CODE FOR 60 HZ CLOCK INTERRUPT (APR) +CLKINT==1000 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. +PTR==104 ;PAPER TAPE READER +PTP==100 ;PAPER TAPE PUNCH +TTY==120 ;CONSOLE TTY +DTC==320 ;DECTAPE CONTROL +IFN 340P, DIS==130 ;340 DISPLAY + +PI0LOC==40 ;INTERRUPT VECTOR BASE + +OIPBIT==%PC1PR ;PC BITS FOR 1-PROCEED. +BADPC==%PCUIO+%PCSPC+37 ;BITS IN PC USER NOT ALLOWED TO TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONMS ARE REFERENCED THROUGH THESE MACROS +XUUOH!TERMIN + +DEFINE FORTY +40!TERMIN + +DEFINE SYSCTX ;SET UUO LEVEL AC BLOCKS +TERMIN + +DEFINE USRCTX ;SET USER-MODE AC BLOCKS +TERMIN + +DEFINE OVHMTR NAME ;OVERHEAD METERING DOESN'T WORK ON KA'S +TERMIN +] ;END OF IFN KA10P + IFN KL10P,[ + +SUBTTL STUFF PECULIAR TO KL-10 PROCESSOR + +;;;PAGING BOX INSTRUCTIONS + +XCTR=074000,, ;EXECUTE INSTRUCTION WITH MAPPING, PAGE FAILS ENABLED +XCTRI=075000,, ;SAME BUT SKIPS IF THERE IS PAGE FAIL (DONE SNEAKILY BY SOFTWARE) +LPMR=076000,, ;LOAD PAGER MEMORY (JPC, DBRS) AND CLEAR PT DIR +SPM=077000,, ;STORE PAGER MEMORY + ;AC FIELD VALUES FOR XCTR AND XCTRI + XR==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING) + XW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR WRITING) + XRW==4 ;MAP MAIN OPERAND OF SIMPLE INSTRUCTION (FOR READING AND WRITING) + XBYTE==5;MAP BYTE DATA AND BYTE POINTER + XBR==1 ;MAP BLT SOURCE + XBW==4 ;MAP BLT DESTINATION + XBRW==5 ;MAP BOTH BLT OPERANDS + XEA==16 ;MAP EFFECTIVE ADDRESS COMPUTATION + ;IN KL10 BITS ARE: 14 INDIRECT WORDS + ; 10 XR UNDER SOME RANDOM WIERD CONDITIONS (?) + ; 4 MAIN OPERAND " " " ALSO BYTE WRITE + ; 2 INDEX REGISTER, @ AND XR IN BYTE PTRS + ; 1 2ND OPND - BLT SOURCE, BYTE READ, STACK DATA + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + CONO PAG,660000+ +TERMIN + +;;; INTERNAL "I/O" DEVICES + +PI==4 ;INTERRUPT SYSTEM +PAG==10 ;CONO, DATAO PAG SET UP PAGING + ..D010==0 ;FOR DDT +CCA==14 ;CACHE OPERATIONS +TIM==20 ;TIMER DEVICE +MTR==24 ;METERS DEVICE + +IFN PDCLKP,[ ;IF THIS KL-10 HAS FREEMAN KL-UDGE BOARD, +LIGHTS==500 ;DATAO LIGHTS, SETS CONSOLE LIGHTS. +CLK==500 ;60 HZ CLOCK INTERRUPT (ON KL-UDGE BOARD) +CLKINT==10 ;CONI CLK, BIT FOR INTERRUPT. ALSO CONO BIT TO CLEAR. + ;ALSO DATAI 500, IS THE DECORIOLIS CLOCK. + ;AND CONO 500,400000 TURNS CLOCK BACK ON AFTER POWER FAIL. +] + +OIPBIT==%PS1PR ;1-PROCEED BITS IN THE PC. +BADPC==%PSUIO+37 ;%PSPUB IS OK? + +;;; SPECIAL INSTRUCTIONS + +SWPIA=DATAI CCA, ;INVALIDATE WHOLE CACHE +SWPIO=CONI CCA, ;INVALIDATE ONE PAGE OF CACHE +SWPUO=CONSO CCA, ;UNLOAD ONE PAGE OF CACHE +SWPUA=DATAO CCA, ;UNLOAD WHOLE CACHE +WRPAE=702100,, ;WRITE PERFORMANCE-COUNTER ENABLES +APRID==BLKI ;READ CPU SERIAL NUMBER AND OPTIONS +RDERA=BLKI PI, ;READ ERROR ADDRESS +RCCL=DATAI TIM, ;READ CALENDAR CLOCK (DOUBLE WORD) +RPERFC=BLKI TIM, ;READ PERFORMANCE COUNTER (DOUBLE WORD) +REBOXC=DATAI MTR, ;READ EBOX CYCLE COUNTER (DOUBLE WORD) +RMBOXC=BLKI MTR, ;READ MBOX CYCLE COUNTER (DOUBLE WORD) + +;;;EPT LOCATIONS + +$INSRT EPT + +;;;PAGE FAIL WORD - UPFW(U) + + %PF==1,,405000 + %PFUSR==400000 ;USER PAGE + %PFCOD==370000 ;FAILURE CODE: + %PFPRO==210000 ;PROPRIETARY VIOLATION + %PFMAR==230000 ;MAR BREAK + %PFILW==240000 ;ILLEGAL WRITE IN READ ONLY + %PFPNA==330000 ;PAGE NO ACCESS + %PFPTP==250000 ;PAGE TABLE PARITY + %PFPAR==360000 ;PARITY ERROR, DATA IN AR + %PFPRX==370000 ;PARITY ERROR, DATA IN ARX + %PFPUB==4000 ;PUBLIC PAGE + %PFCCH==2000 ;CACHED + %PFPAG==1000 ;PAGED + $PFPNO==121000 ;VIRTUAL PAGE NUMBER + ;1.1-3.5 VIRTUAL ADDRESS + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) OLDACS, +; UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME FOR UPT. +; DISABLE, IF NONBLANK, CAUSES ACCOUNTING UPDATING NOT TO BE DONE EVEN THOUGH +; UPT IS BEING SET. +DEFINE SPCCTX CURACS,OLDACS,UPT,DISABLE +DATAO PAG,[IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+2^13+CURACS_33+OLDACS_30+UPT/1000+400000-IFNB UPT,[IFB DISABLE,[400000]]] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-5 NOT USED +; BLOCKS 2 & 3 ARE USED BY THE UNFINISHED MUSIC MICROCODE +; BLOCKS 4 & 5 ARE USED BY THE UNFINISHED JPC RING FEATURE +; 6-7 USED BY MICROCODE +] ;END OF IFN KL10P + IFN KS10P,[ + +SUBTTL STUFF PECULIAR TO THE KS-10 PROCESSOR + +EPT==:0 ; This MUST agree with the Salvager! +HSB==:500 +$INSRT KSDEFS + +DEFINE CLRPGM U ;CLEAR PT DIR WITHOUT SWITCHING USERS. ARG IS USUALLY "(U)". + WREBR 20000+ +TERMIN + +OIPBIT==1000 ;BIT 8 (SYMBOLIC NAME %PSINH) +BADPC==%PSUIO+37 ;BITS IN PC THAT USER CANNOT TURN ON + +DEFINE UUOH ;UUO HANDLER LOCATIONS REFERENCED THROUGH THESE MACROS +XUUOH(U)TERMIN + +DEFINE FORTY +MUUODP(U)TERMIN + +;SET SPECIAL CONTEXT: CURRENT AC BLOCK CURACS, PREVIOUS BLOCK (FOR XCTR) +; OLDACS, UPT AS SPECIFIED. IF NO ACS SPECIFIED, THEY DON'T CHANGE; SAME +; FOR UPT. +DEFINE SPCCTX CURACS,OLDACS,UPT +WRUBR [IFNB CURACS OLDACS,[SETZ]+IFNB UPT,[1^13]+CURACS_33+OLDACS_30+UPT] +TERMIN + +SYSCTX=SPCCTX 0,1 ;UUO LEVEL CONTEXT: CURRENT AC BLOCK 0, PREVIOUS = 1. +USRCTX=SPCCTX 1,1 ;USERS RUN IN BLOCK 1. +IRPC N,,[234567] + AC!N!CTX=SPCCTX 0,N ;CUR AC 0, PREV N. USE XCTR TO ACCESS SPECIAL ACS +TERMIN + +;AC BLOCK USAGE: +; 0 ACCUMULATORS FOR SYSTEM (AT UUO LEVEL) +; 1 ACCUMULATORS FOR USER +; 2 USED TEMPORARILY BY TTY INPUT INTERRUPTS +; 3-6 NOT USED +; 7 USED BY MICROCODE (AC0 GETS BAD DATA WHEN MEMORY ERROR OCCURS, THIS +; COULD BE FIXED IF ANYONE THINKS IT IS WORTH IT...) +] ;END OF IFN KS10P + +IFE KS10P,[ ; For the benefit of processors without UMOVE and UMOVEM. + +DEFINE UMOVE (AC,ADDR) +XCTR XR,[MOVE AC,ADDR] +TERMIN + +DEFINE UMOVEM (AC,ADDR) +XCTR XW,[MOVEM AC,ADDR] +TERMIN + +] ;IFE KS10P + +SUBTTL SYS IOC STATUS WORD FORMAT + +;RIGHT HALF WORD DEVICE STATUS +;1.1-1.6 SYS PHYSICAL DEVICE CODE +;1.7-1.9 OPEN MODE +;2.1 SYS BUFF CAP FULL +;2.2 " " " EMPTY +;2.9-2.3 DEVICE DEPENDANT + +;LEFT HALF WORD CHANNEL STATUS +;3.6-3.1 SET BY OPENS THAT DONT SKIP +;4.5-3.7 SET BY IOC ERRORS (INTERRUPTS) AT IOT OR OPER TIME + ;3.9-3.7 ARE FOR 340 OR E&S ERRORS + ;4.5-4.1 ARE FOR OTHER DEVICES +;A LIST OF ERROR CODES FOR OPEN FAILURES ARE IN THE FILE BITS. + +NDOPL==7 ;NUM OF DIS OPNL + +;4.5-3.7 SET BY IOC ERRORS AT IOT OR OPER TIME + +;3.9-3.7 SET BY 340 ROUTINES +;1 ILLEGAL SCOPE MODE +;2 SCOPE HUNG +;3 MORE THAN 1K SYS SCOPE BUF +;4 MEMORY PROTECT +;5 ILLEGAL SCOPE OP +;6 MEMORY PROTECT ON PDL POINTER +;7 ILLEGAL PARAMETER SET + +;4.5-4.1 +;DECIMAL CODE +;13 DIRECTORY'S ALLOCATION EXHAUSTED +;12 DIRECTORY FULL +;11 ILLEGAL CHR AFTER ^P ON TTY DISPLAY +;10 CHNL IN ILLEGAL MODE WHEN .IOT ATTEMPTED +;9 DEVICE FULL +;8 CHANNEL NOT OPEN +;7 USR OP CHNL DOES NOT HAVE USR OPEN +;6 ATTEMPT TO OVER IOPUSH +;5 ATTEMPT TO OVER IOPOP +;4 NON-EXISTANT SUB DEVICE +;3 NON-RECOVERABLE DATA ERROR ;NON-EX-MEM ON PDP6 REF +;2 END OF FILE +;1 DEVICE HUNG OR REPORTING NON-DATA ERROR + +MIOTER==1 ;LOWEST IOCERR CODE USED +NIOTER==13. ;NUMBER " " + +;4.9-4.5 ALWAYS ZERO (USED BY IOPUSH FOR CHNL NUM) + +;SYS PERIPHERAL DEVICE CODES + +;1.6 INDICATES DIRECTORY DEVICE +;1.5 INDICATES NON PHYSICAL DEVICE + +SNTTY==1 +SNTDS==2 ;TERMINAL DISPLAY +SNLPD==3 ;DATA PRODUCTS LPT +SNVID==4 +SNBAT==5 +SNPLT==6 +SNPTP==7 +SNIMPX==10 +SNOMPX==11 +SNPTR==12 +SN340==13 ;340 AS ASCII DEVICE +;SN340I==14 ;INTERPRETED DISPLAY ON 340 +SNMTC==15 ;MAGTAPE +SNCOD==16 ;CODE DEVICE +SNTAB==17 +SNNUL==21 +SNJOB==22 +SNBOJ==23 +SNSPY==24 +SNSTY==25 +SNNET==26 ; Arpanet NCP +SNLPV==27 ;VOGUE LPT +SNSTK==30 ;STANFORD KEYBOARD +SNMSP==31 ;CROCK "IPC" FOR NOW +IFN CHAOSP,SNCHA==32 ;CHAOS NET +IFN TCPP,SNTCP==33 ; Internet TCP/IP network device +SNTRAP==34 ;TRAP "DEVICE" +IFN INETP,SNIPQ==35 ; Internet Queue +IFN KS10P,SNUBI==36 ; Unibus interrupt +SNUTC==41 +SN2311==43 +SNFUSR==60 +SNUSR==61 +SNCLK==62 ;CLO, CLU, & CLI +SNDIR==63 +SNPDP==64 ;PDP6 +SNDIRH==65 ;DIRHNG "DEVICE" +SNLCK==66 ;LOCK "DEVICE" + +SUBTTL SYSTEM VERSION NUMBER & MISC MACROS + +ITSMCH==: ; Define SIXBIT machine name symbol +ITSVRS==:.FNAM2 ; Preserve SIXBIT symbol value of ITS version # +FNM==ITSVRS ;SRI GETS VERSION NUMBER + ;WORKS FOR DECIMAL IGNORES LOW ORDER NON-NUMERIC CHRS +DEFINE VNAM +.TAG FOO + ZZZQ==FNM&77 + IFGE ZZZQ-'0,IFLE ZZZQ-'9,.GO BAR + FNM==FNM_-6 + .GO FOO +.TAG BAR + ZZZQ==1 + SRI==0 +.TAG MUM + IFE FNM,.GO END + ZCHR==FNM&77-'0 + IFL ZCHR,.GO END + IFG ZCHR-9,.GO END + SRI==SRI+ZZZQ*ZCHR + ZZZQ==ZZZQ*10. + FNM==FNM_-6 + .GO MUM +.TAG END + TERMIN + +IF1 VNAM + +DEFINE SRITYP A +ZZZ==10 ;SAVE OLD RADIX +RADIX 10. + MOVEI I,[MNAME [.ASCII ? +] ITS !SRI A?] +RADIX ZZZ + TERMIN + + ;"MONTHS OF THE YEAR" MACRO + +DEFINE MNIRP A +IRPS M,,[JAN:FEB:MAR:APR: +MAY:JUN:JUL:AUG: +SEP:OCT:NOV:DEC:]L,,[31. 29. 31. 30. +31. 30. 31. 31. +30. 31. 30. 31.] +A +TERMIN +TERMIN + +FOO==-1 ;ACCUMULATED VALUE FOR FOLLOWING DEFINITION: + +MNIRP [M==FOO +FOO==FOO+L] ;JAN=-1, FEB=30., MAR=59., ETC. + +DEFINE INFORM A,B +IF1,[PRINTX \A = B +\]TERMIN + +ZZZ==10 +RADIX 10. +INFORM VERSION,\SRI +RADIX ZZZ + +SSYS==0 ;LENGTH OF SYS CODE + +DEFINE EBLK +IFN CKPAR,.ERR LOSS AT EBLK +CKPAR==1 +IFE .-CKZZ,.STOP ;NO WORDS BETWEEN BBLK AND EBLK +CONC CK,\CKNUM,==CKZZ-.,,CKZZ +CKNUM==CKNUM+1 +SSYS==SSYS+.-CKZZ +TERMIN + +DEFINE BBLK +CKZZ==. +IFE CKPAR,.ERR LOSS AT BBLK +CKPAR==0 +TERMIN + +CKPAR==1 +CKNUM==0 + + +;INSERT CALL TO THIS MACRO AT ANY PLACE IT IS POSSIBLE TO PCLSR +;(IF IT IS DESIRED FOR PCLSR TEST FEATURE TO TEST THAT SECTION) + +DEFINE PCLT +IFN PCLSW,[ + SKIPE PCLDBM + PUSHJ P,PCLTST +] +TERMIN + +DEFINE PCLTH A +IFN PCLSW,[ + SKIPN PCLDBM + JRST .+3 + PUSHJ P,PCLTSH + A +] +TERMIN + +DEFINE PI2SAF + CONSO PI,20000 + CONSO PI,40 + CAIA + JRST 4,. ;PI 2 NOT OFF AND NOT IN PROGRESS +TERMIN + +SUBTTL DEFINE EXEC PAGES + +EXPGN==0 + +DEFINE EXECPG X +X==EXPGN +EXPGN==EXPGN+1 +ZZQ==&1 +ZZQQ==X_-1 +.!X==220000*ZZQ+2200,,ZZQQ +TERMIN + +;EXEC MAP ASSIGNMENTS +IFN 340P,[ +EXECPG 340P1, ;USED TO FETCH + TRACE 340 PNTRS +EXECPG 340P2, +REPEAT N340PB,CONC [EXECPG DPG]\.RPCNT,; ;DATA AREA PNTRS FOR 340 DATA +] +EXECPG CORJF, ;CORE JOB FROM PAGE +EXECPG CORJT, ;CORE JOB TO PAGE +IFN VIDP,[ +EXECPG VSB1, ;.VSCAN B1 +EXECPG VSB2, ;.VSCAN B2 +] +IFN TEN11P,[ +EXECPG T11CP, ;TEN11 CONTROL PAGE +] +EXECPG PAREP, ;USED BY SYSTEM IN ITS DILIGENT EFFORTS TO FIX PARITY ERRORS + +IFN ECCMEM, EXECPG ECCPG, ;PAGE USED TO ACCESS ECC HISTORY + +IFN XGP,[ +EXECPG XGPC, ;LOW 2K OF XGP PDP-11 (USED TO TRACE BUFF POINTERS) +EXECPG XGPB, ;2K BUFFER IN PDP-11 (CHANGES LOCATION) +EXECPG XGPUB, ;XGP USER CORE EXEC PG SETUP TO POINT TO USER CORE DURING XGPIM SYSTEM CALL +] +IFN N11TYS,[ +REPEAT NTTPG,[CONC [EXECPG TTPG]\.RPCNT, +] +REPEAT NTVBP,[CONC [EXECPG TTR]\.RPCNT, +]] +IFN CHAOSP,[ IFN T11CHP,[ +EXECPG CHSPG ;CHAOS NET 10-11 COMMUNICATION PAGE +T11CHS=400000+CHSPG*2000 +]] ;CHAOSP, T11CHP +;^ INSERT NEW EXEC PAGES HERE +;EXEC PAGES BELOW THIS POINT WILL BE COPYABLE BY USERS +REPEAT NMMP,CONC [EXECPG MMP]\.RPCNT,; ;MMP TABLE + MMP=MMP0*2000+400000 ;VIRTUAL ADDRESS OF MMP +EXPUNGE EXECPG +NEXPGS==EXPGN ;# EXEC PGS USED + +SUBTTL LOW CORE + +.YSTGWD ;STORAGE WORDS OKAY NOW + +IFN KL10P, LOC EPT+1000 ;KL needs a full DEC page for EPT +IFN KS10P,[ + IFE KSIMP, LOC EPT+1000 ;KS needs a full DEC page, too, + IFN KSIMP, LOC EPT+2000 ; unless you are losing even worse. +] + +PATB=. +LOC 20 + BBLK + +IFN KS10P,[ +LOC 30 ; 8080 communications area + EBLK +] ;IFN KS10P + +IFN TM10B,[ + LOC 30 + EBLK +MICWA: MIOWD + 0 +IFE RP10P+RH10P,BBLK +] +IFN RP10P+RH10P,[ + LOC 32 +IFE TM10B,EBLK +QICWA: QIOWD + 0 +IFN QRDCMP,[ +RCICWA: 0 + 0 +];QRDCMP + BBLK +] +IFN E.SP,[ + LOC 34 + E.SPM ;POINTER , NEVER CHANGES +] + +IFE KS10P,[ +LOC 37 + EBLK +] ;IFE KS10P + +LOC 41 +IFN KA10P, JSR UUOH ;UUO TRAP +IFE KA10P, JSR LUUOEX ;USER UUO IN EXEC MODE (ERROR) + +LOC PI0LOC+2 + REPEAT 2, JSR RINT1 + REPEAT 6*2, JSR RINT ;INITIALIZE ANY UNUSED PI LOCNS + +LOC 61 +IFN KA10P, JSR 60H ;60 TRAP +IFN C1MXP, REPEAT 2*7., JSR RINT1 ;INITIALIZE C1MPX LOCNS + +LOC PI0LOC+2*APRCHN + JSR CLKBRK ;PROCESSOR OR CLOCK INTERRUPT + JRST 4,. + +LOC PI0LOC+2*LPTCHN + JSR LPTBRK ;LPT,DISPLAY,PTP,PTR,OTHER PROCESSOR +IFN 340P, JSR DRECYC ;HACK HACK + +LOC PI0LOC+2*TTYCHN + JSR TTYBRK ;TTY,DATAPOINT KLUDGE + JRST 4,. + +LOC PI0LOC+2*UTCCHN + JSR UTCBRK ;MICRO TAPE OR DISK (S) + JRST 4,. + +IFN E.SP,[ +LOC PI0LOC+2*DISCHN + JSR ESBRK + JRST 4,. +] +IFN 340P,[ +LOC PI0LOC+2*DISCHN + JSR DIGNOR ;340 DISPLAY BLKO GETS PATCHED IN HERE + CONO PI,4000+200_<-SDCHN> ;HACK HACK +] +IFN CH10P+CH11P,[ +LOC PI0LOC+2*CHXCHN + JSR CHXBRK + JRST 4,. +];CH10P + +IFN VIDP,[ +LOC PI0LOC+2*OMPCHN + JSR OMPXBK ;OUTPUT MPXR, NVID, ETC. + JRST 4,. +] +IFN KAIMP,[ +LOC PI0LOC+2*IMPCHN + JSR IMPBRK +LOC IMPILC + JSR IMPIBK + 0 +LOC IMPOLC + JSR IMPOBK + 0 +] ; IFN KAIMP + +IFN KL10P,[ +LOC PFOPC +PFOPC: 0 ;PAGE FAIL OLD PC STORED HERE +PFNPC: PFAIL ;WHERE TO GO FOR PAGE FAIL + +LOC EPTDIA +EPTDIA: JRST SALV ;STD COMMAND START ADDRESS ("DIAGNOSTIC") +EPTDDT: JRST DDT ;DDT COMMAND START ADDRESS +EPTSTL: JRST DSKDMP ;STL COMMAND START ADDRESS ("LOADER") +EPTITS: JRST BEG ;STM COMMAND START ADDRESS ("MONITOR") + ;SALV THEN GO +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;ONE PROC CODE? + +LOC DTEBPO +DTEBPO: 0 ;BYTE TRANSFER NOT USED +DTEBPI: 0 ;BYTE TRANSFER NOT USED +DTELOC: ;INTERRUPT FROM CONSOLE 11 +IFE PDCLKP, JSR DTEBRK ;IF USING 11 FOR CLOCK, FIRST CHECK FOR CLOCK INTR +.ELSE JSR TTYBRK ;OTHERWISE JUST USING 11 FOR TTYS. + 0 ;UNUSED WORD +DTEPRO: 0 ;NO PROTECTED EXAMINES +DTERLO: 0 ;.. +DTEPRI: 0 ;NOR PROTECTED DEPOSITS +DTERLI: 0 ;.. + +LOC EPT+430 +REPEAT 8,MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES + +LOC EPTEBC +EPTEBC: 0 ? 0 ;EBOX COUNT FOR PROC BRK ROUTINES AND NULL JOB +EPTMBC: 0 ? 0 ;MBOX DITTO + +LOC TIMLOC + JSR OVHBRK ;INTERVAL TIMER INTERRUPT, EVERY 39 MILLISEC ON CHANNEL 1 + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KL10 OVHBRK CHECKS WHERE THE PC IS IF IT IS IN EXEC MODE. + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] <(SIXBIT/NAME/)>,,POINT ? 0 +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KL10P + +IFN KS10P,[ + +LOC EPTUIT+UBAQ + UBAQIB ; Pointer to interrupt table for Unibus Q (dsk) + +LOC EPTUIT+UBAI + UBAIIB ; Pointer to interrupt table for Unibus I (other) + +LOC EPTPFW +EPTPFW: 0 ; Page fail word +EPTPFO: 0 ; Page fail old PC +EPTPFN: PFAIL ; Page fail new PC + +IRP I,,[1,2,3,4,5,6,7] +LOC EPTP!I!W +EPTP!I!W: 0 ; Page fail word +EPTP!I!O: 0 ; Page fail old PC +EPTP!I!N: PF!I!AIL ; Page fail new PC at PI level I +TERMIN + +LOC EPTTR1 +EPTTR1: CAI ;ARITH OVERFLOW EXEC MODE IGNORED +EPTTR2: JSR ILLTRP ;PDL OVERFLOW EXEC MODE IS AN ERROR +EPTTR3: JSR ILLTRP ;TRAP 3 SHOULD NOT HAPPEN + +LOC EPT1PO +EPT1PO: 0 ;ONE-PROCEED OLD-PC +EPT1PN: MUUOEX ;ONE-PROCEED SHOULD NOT HAPPEN IN UPT=EPT MODE + +LOC EPTUEN +EPTUEN: MUUOEX ;HALT IF UUO IN PROCESSOR BREAK ROUTINES +EPTUET: MUUOEX +LOC EPTUUN +EPTUUN: MUUOEX +EPTUUT: MUUOEX + +IFN KSIMP,[ +;Here because with EPT at 0, this is the second half of physical +; page 0, which is uncached, which we want, and otherwise unused. +; +LOC EPT+1000 ; IMP data reformatting buffers +IMPIBF: BLOCK 400 +IMPBFS==.-IMPIBF +IMPOBF: BLOCK 400 +] + +;OVHMTR MACRO IS USED TO CONSTRUCT TABLE OF AREAS OF EXEC CORE TO BE METERED +;ON KS10 PC SAMPLING FACILITY IS USED, 60-CYCLE CLOCK COLLECTS THAT DATA +;NOTE THAT THE TABLE FORMAT IS NOT THE SAME AS ON KL10, FOR SPEED REASONS + +DEFINE OVHMTR NAME ;NAME IS 3 CHARACTERS NAMING THE REGION THAT BEGINS HERE +OVHMT1 NAME,\. ;EVALUATE "." AT THIS POINT IN TIME +TERMIN + +;KLUDGE MACRO +DEFINE OVHMT1 NAME,POINT +OVHTAB [DEFINE OVHTAB FOO +FOO] POINT,,<(SIXBIT/NAME/)> +TERMIN +TERMIN + +;THIS IS THE CORRESPONDING REMOTE MACRO +DEFINE OVHTAB FOO +FOO +TERMIN +] ;END OF IFN KS10P + +IFN DL10P,[ ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +IFN KL10P, LOC 500 ;500-777 RESERVED FOR DL10 AREA AND BUFFERS +IFN KA10P, LOC 100 ;IF KA10, PUT DL10 AREA JUST BELOW START OF SYSTEM +IFN KS10P, .ERR DL10 on KS10 system? + +DL10AR: JSR TTYBRK ;INTERRUPT INSTRUCTION (NOT ACTUALLY USED) + +;FOLLOWING LOCATIONS MUST AGREE WITH IOELEVEN PROGRAM + +DL10VR: NDLTYS_8+NFDLTY ;"I/O VERSION NUMBER" +DL10UP: 0 ;INCREMENTED BY -11 EVERY 1/60 SECOND. + ;SETOM'ED BY 10 EVERY 1/2 SECOND. DETECTS UP/DOWNNESS. + +DL10SO: 0 ;LINE # TO SET OUTPUT DONE FOR, SET BY -10, CLEARED BY -11. + +DL10IL: 0 ;LINE # WITH INPUT AVAILABLE. CLEARED BY -10 AFTER CHAR READ. +DL10IC: 0 ;CHARACTER RECEIVED FROM THAT LINE. + +DL10OD: 0 ;LINE # WITH OUTPUT DONE. CLEARED BY -10 WHEN PROCESSED. +DL10BS: 0 ;BUFFER SIZE FOR THAT LINE. + +DL10BP: 0 ;WIERD DL10 BYTE POINTER TO TTY OUTPUT BUFFER. +DL10CC: 0 ;NUMBER OF CHARACTERS BEING OUTPUT TO TTY. +DL10LN: 0 ;LINE # OUTPUT BEING SENT TO. CLEARED BY -11 WHEN GOBBLED. + +DL10CL: 0 ;DIALUP LINE CONNECT OR DISCONNECT INFO. SET BY 11, 0'D BY 10. + ;0000NN => LINE # NN DISCONNECTED. + ;01RTNN => LINE # NN CONNECTED, %TTISP=R, %TTOSP=T. + +DL10PL: 0 ;LINE # TO SET PARAMETERS OF. CLEARED BY -11 WHEN PROCESSED. +DL10PR: 0 ;VALUE OF DH11 LPR REGISTER. +DL10PS: 0 ;NUMBER OF BYTES OF OUTPUT BUFFERING DESIRED. + +DL10XD: 0 ;1=EXAMINE -11 CORE, 2=DEPOSIT. CLEARED BY -11 WHEN DONE. +DL10XA: 0 ;EXAMINE/DEPOSIT ADDRESS +DL10XW: 0 ;EXAMINE/DEPOSIT WORD + +GLPTBP: 0 ;BYTE POINTER TO BUFFER FOR GOULD LPT +GLPTBC: 0 ;BYTE COUNT " " - IF NONZERO BUFFER IS ACTIVE BY PDP11. +GLPTER: 0 ;NONZERO => PDP11 CLAIMS PRINTER IS BROKEN. +GLPGRF: 0 ;NONZERO => GRAPHICS MODE (SET BY 10). + +;CHAOS NET SHARED VARIABLES +DLCINI: 1 ;THE COMMENTS ARE IN THE CHAOS FILE +DLCSP1: 0 +DLCSP2: 0 +DLCSS1: 0 +DLCSS2: 0 +DLCRP1: 0 +DLCRP2: 0 +DLCRS1: 0 +DLCRS2: 0 + +;^ ADD MORE HERE + +DLXEND:: ;END OF ASSIGNED DL10 AREA + +IFG .-DL10AR-100, .ERR DL-10 AREA TOO BIG, CHANGE CONO IN TSS INITIALIZATION +LOC DL10AR+100 ;SKIP OVER 11-ACCESSIBLE AREA + +DL10BF: BLOCK <261.+3>/4 ;OUTPUT BUFFER, 8-BIT BYTES. HAS TO BE NON-ENCACHED. + +IFN GLPTP,[ +GLPBSZ==255. ;BUFFER SIZE IN WORDS. MAXIMUM POSSIBLE WITHOUT MODIFYING (ELIMINATING) + ;"WORD COUNT" HARDWARE IN DL-10. +GLPMPP: 0 ;MAIN PROGRAM POINTER - IF NONZERO BUFFER IS ACTIVE BY M.P. LEVEL (PDP10) +GLPMPC: 0 ;MAIN PROGRAM COUNTER +GLPTBF: BLOCK GLPBSZ ;ONE BUFFER FOR NOW +] ;END IFN GLPTP + +IFN KL10P, IFG .-1000,.ERR DL10 STORAGE TOO BIG, DOESN'T FIT IN UNENCACHED PAGE +IFN KA10P, PATB=. ;MOVE ORIGIN OF SYSTEM UP +] ;END IFN DL10P + +IFN NETYS,[ ;ASSEMBLE DTE20 CONTROL AREA +IFE KL10P, .ERR DTE20 WITHOUT KL10? +LOC 400 + +DTEVER: NETYS_8+NFETY ;400 I/O VERSION NUMBER, SET BY 10, CHECKED BY 11 + +DTECHK: 0 ;401 INCREMENTED BY 11 60 TIMES PER SECOND + ;SETOMED BY 10 EVERY HALF SECOND. + ;USED TO TELL 11 THAT 10 IS UP. + +DTEINP: -1 ;402 -1 IF IDLE, ELSE INPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPI IN EPT AND DO DATAO DTE, BEFORE SETTING THIS. + ;SEE COMMENTS BELOW DTEOUT FOR WHAT GOES HERE +DTEOUT: -1 ;403 -1 IF IDLE, ELSE OUTPUT REQUEST FROM 10 TO 11 + ;SETUP DTEBPO IN EPT BEFORE SETTING THIS. + ;CONTENTS OF DTEINP AND DTEOUT ARE DESCRIBED BELOW. + ;THESE ARE SET BY THE 10, SETOMED BY 11 WHEN TRANSFER STARTS. + ;RH # BYTES EXPECTED. LH COMMAND+LINE#. COMMANDS ARE: + %DCTYO==1000 ;TELETYPE OUTPUT (NOTE 4.1=0 INPUT, =1 OUTPUT) + %DCETI==2000 ;ETHERNET INPUT (N.Y.I.) + %DCETO==3000 ;ETHERNET OUTPUT (N.Y.I.) + +DTELSP: -1 ;404 LINE # WHOSE SPEED IS TO BE SET, SET BY 10, SETOMED BY 11 +DTELPR: -1 ;405 CORRESPONDING DH11 LINE PARAMETER REGISTER,,BUFFER SIZE + +DTEOST: -1 ;406 LINE# TO START OUTPUT ON (SET OUTPUT DONE). + ;SET BY 10, SETOMED BY 11 + + BLOCK 1 ;407 NOT USED + +DTETYI: -1 ;410 TELETYPE INPUT. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH CHAR RCVED. + +DTEODN: -1 ;411 TELETYPE OUTPUT DONE. SET BY 11, SETOMED BY 10. + ;LH LINE#,,RH BUFFER SIZE. + +DTEHNG: -1 ;412 HANGUP/DIALIN WORD. SET BY 11, SETOMED BY 10. + ;0000NN LINE # NN HUNG UP. + ;01RTNN LINE # NN HAS SPEED RCV=R, XMT=T (CODES AS IN TTYTYP) + +;^ ADD MORE LOCATIONS HERE, NOT TO EXCEED 437 + +;LOCATIONS 440-457 ARE KNOWN ABOUT BY BOTH IOELEV AND KLDCP, +;USED MOSTLY FOR NON-TIMESHARING PROGRAMS. +];NETYS + +LOC PATB + + ;FOR VARIABLES (MONITORABLE WITH KEYS) +NSKED: 0 ;# TIMES NON-NULL JOB IS RUN +NNSKED: 0 ;# TIMES NULL JOB IS RUN +NRSKED: 0 ;# OF FULL SCHEDULES (MUST SCAN ALL JOBS) +NSSKED: 0 ;# OF SCHEDULES SAVED BY SCHBLN FEATURE. +NRESKED:0 ;# TIMES A JOB SCHEDULED JUST AFTER IT RAN. +NSCHDU: 0 ;TOTAL NUMBER OF JOBS FOUND RUNNABLE IN FULL SCHEDULES +NNULBK: 0 ;# OF CONSECUTIVE BLOCKS OF NULLTIME. +NUINT: 0 ;# TIMES USER GIVEN INTERRUPT +NAUINT: 0 ;# ATTEMPTED USER INT (POSSIBLY UNSUCCESSFUL DUE TO PG FAULT) +NPCLSR: 0 ;# ATT TO PCLSR +NEPCLS: 0 ;# PCLSRS WHERE JOB WAS IN EXEC MODE +NFPCLS: 0 ;# OF PCLSRS THAT FAILED (JOB WAS IN EXEC MODE AND NOT BLOCKED) +NSOUSR: 0 ;# ATT TO SWAP OUT USR +NSOPGS: 0 ;# TIMES THRU LOOP LOOKING FOR PG TO SWAP OUT +NPGSO: 0 ;# TIMES AT SWOPG +NAGEAB: 0 ;# TIMES SWAP OUT ABORTED BY AGE BITS +NSHRAB: 0 ;# TIMES SWAP OUT ABORTED BY SHARING +NPGFLT: 0 ;# PAGE FAULT (ALL CAUSES) +NCLKI: 0 ;# CHNL 7 INTS (ALL CAUSES) +NPGLD: 0 ;# TIMES AT PGLDU +NUFLS: 0 ;# TIMES AT UFLS +NTUSB: 0 ;# TIMES USER SWAP BLOCKED +NTSBUP: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND LET IN +NTSBUB: 0 ;# TIMES SWAP BLOCKED USER TOOK PAGE FAULT AND BLOCKED +NTSBUU: 0 ;# TIMES SWAP BLOCKED USER UNBLOCKED BEFORE TIME (MEM APPARENTLY AVAIL) +NAGES: 0 ;# TIMES AROUND PAGE-AGEING LOOP + +;THE FOLLOWING FOUR MUST BE CONSECUTIVE +NRPI: 0 ;# REFS TO PAGE IN (BUT MAP WAS NOT SET UP, ETC) +NRPCI: 0 ;# PAGE FAULTS REFS TO PAGE COMMING IN +NRPO: 0 ;# REFS TO PAGE OUT +NRPGO: 0 ;# TO PAGES GOING OUT +CLKBRS: 0 ;CLKBRK COPIED INTO HERE (SINCE CLKBRK GETS CHANGED) + +PAT: IFG .-PATB-40,.ERR PAT TOO HIGH + +LOC PATB+40 + +BBLK + +PATCH: BLOCK 140 ;PATCH SPACE CODE AND CONSTANTS + +EBLK + +VPATCH: +VPAT: +BLOCK 40 ;PATCH SPACE VARIABLES + +SUBTTL PROCESSOR BREAK ROUTINES + +DEFINE CLKSAV BRK=CLKBRK +IFE KA10P, XCT CLCXSV ;DATAI PAG,CLCX(U) + XCT CLUSAV ;STORE U IN AC17S FOR CURRENT USER (UNLESS NULL JOB) + MOVE U,BRK ;SAVE AWAY BRK + MOVEM U,CLKBRS +IFSN BRK,CLKBRK, MOVEM U,CLKBRK ;SAVE IN CLKBRK IF NOT CLKBRK +TERMIN + +IFE KA10P,[ +DEFINE CLKLEV ;ENTER CLOCK-LEVEL CONTEXT + SPCCTX 0,1,EPT ;UPT = EPT; CLOCK LEVEL CONTEXT. + MOVE U,USER + JRST 2,@.+1 ;MAKE XCTR WORK RIGHT + %PSPCU,,.+1 + MOVE P,CPDLP +TERMIN +] ;IFE KA10P +IFN KA10P,[ +DEFINE CLKLEV + MOVE U,USER + MOVE P,CPDLP +TERMIN +] ;IFN KA10P + +IFN KL10P,[ ;CODE USED IF GETTING 60-CYCLE CLOCK FROM PDP11 (IN CASE MAIN CLOCK DOWN) + +;HACKING THE DTE: + +;THE TTY CODE ASSUMES, SINCE THE DTE20 IS USED BY ITS SOLELY AS +;THE INTERFACE TO THE CONSOLE TTY AND THE LINE-FREQUENCY CLOCK, +;THAT IT MAY FREELY GIVE THE "MONITOR TTY OUTPUT" COMMAND WHEN +;THE "MONITOR TTY OUTPUT DONE" INTERRUPT IS RECEIVED. ANY CODE +;WHICH HACKS THE DTE OTHER THAN AT PI LEVEL OR IN ITS INITIALIZATION +;MUST THEREFORE OBSERVE THE FOLLOWING PROTOCOL: +; CONO PI,DTEOFF +; SKIPN DTEFLG ;WAIT FOR MONITOR TTY OUTPUT TO GO THROUGH +; JRST .-1 +; SETZM DTEFLG +; ;HERE SET DTECMD +; CONO DTE,%DBL11 +; SKIPN DTEFLG ;WAIT FOR THIS COMMAND TO GO THROUGH +; JRST .-1 +; CONO PI,DTEON +; + +DTEBRK: 0 +BBLK + CONSO PI,1_<7-APRCHN> ;TEMPORARY (I HOPE) HARDWARE BUG IN KL10 PI HARDWARE + JRST 4,. ;ALLEGEDLY FIXED + CONO PI,TTYRQ ;REALLY WANTED TO INTERRUPT ON TTY CHANNEL, + JFCL ; BUT HAVE TO DO IT THIS WAY DUE TO + JFCL ; MISFEATURES IN THE PI HARDWARE + SKIPN DTECLK ;DON'T TAKE OUT THE JFCLS!! + JRST 12,@DTEBRK + CLKSAV DTEBRK ;TAKE CLOCK INTERRUPT + JRST CLKB2A +EBLK +];KL10P + +CLKBRK: 0 ;PC SAVED HERE BY JSR FOR CLOCK INT. + +BBLK +IFN KL10P,[ + CONSO PI,1_<7-APRCHN> ;HARDWARE BUG IN KL10 PI SYSTEM + JRST 4,. ;ALLEGEDLY FIXED +] +IFE KA10P, CONO PI,020000+200_<-APRCHN> ;BAG-BITING DEC LOSERS CHANGED + ;FUNCTIONAL SPECIFICATION OF + ;PROGRAMMED REQUESTS +CLKBR2: CLKSAV ;SAVE AC BLK STATUS AND U. +CLKB2A: AOS NCLKI + SKIPGE U,USER ;PICK UP INDEX OF CURRENT USER, SKIP UNLESS NULL JOB + JRST [ SPM UPGML ;JUMP IF NULL JOB WAS RUNNING + JRST CLKBKR ] + SPM UPGML(U) ;STORE PAGE MAP AWAY + AOSN UFLSF ;SKIP UNLESS GOT HERE FROM UFL6 + JRST CLUFLS + MOVEM T,AC16S(U) ;STORE AWAY T + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS +CLKBKR: CLKLEV ;SET UP CROCK-LEVEL CONTEXT HARDWARE + +;;; CHECK FOR THINGS OTHER THAN CLOCK TICKS (PAR ERR, PG FAULT, NXM, PDLOV, +;;; AROV AND ARFOV ARE POSSIBLE ON ONE MACHINE OR THE OTHER). + +IFN KA10P,[ + CONSZ 270220 ;CHECK PDL OV, MEM PROTECT, NXM, FOV, AR OV + JRST CLKB1 ;JUMP ON LOSSAGE +CLKB1D: CONSZ PI,200000 + JRST CLKB1E ;PARITY +] ;KA10P + +IFN KL10P,[ + AOSG PFAILF + JRST PFA6 ;PAGE FAULT + CONSZ 7740 ;This is all but the cache sweep done bit (=20). + JRST CLKB2 ;APR ERROR INTERRUPT +] ;KL10P + +IFN KS10P,[ + AOSG PFAILF + JRST PFLU2 + CONSZ 7620 ;This is all but the interval timer's bit (=40). + JRST CLKBKS ; (Memory ECC (=100) doesn't interrupt) + CONSO 40 + JRST CLK1F +] ;KS10P + +IFN PDCLKP\KA10P,[ ;IF 60 HZ CLOCK IS IN HARDWARE + CONSO CLK,CLKINT + JRST CLK1F ;INTERRUPT NOT FROM CLOCK, MUST BE SPURIOUS (OR + ;PREEMPT) +] ;PDCLKP\KA10P + +;DROP THROUGH FOR PLAIN CLOCK-TICK. + ; +; 60-CYCLE CLOCK INTERRUPT +; +CLKTIC: +;IFN 340P, DATAI CLK1,LQTIM + SOSG @CLROOT ;COUNT DOWN, SKIP IF NOT YET TO NEXT REQUEST + JRST CLQBRK ;SERVICE CLOCK QUEUE REQUEST +CLQBRT: +IFN KS10P, CONO 020040+APRCHN ;Clear interval flag +IFN PDCLKP\KA10P, CONO CLK,CLKINT+APRCHN ;Clear hardware clock flag +IFE PDCLKP\KA10P\KS10P, SETZM DTECLK ;Clear software clock flag +IFN KA10P,[ + DATAI CLKBSW + SKIPGE CLKBSW +] ;KA10P +IFN KL10P, SKIPGE DTESWR +IFN KS10P, SKIPE 8SWIT0 + BUG DDT,[SWITCH 0 IS UP] +IFN KS10P, SETZM 8SWIT0 ; Allow hacker to P +IFN CHAOSP, IFN T11CHP, PUSHJ P,T11WAK ;RUN TEN-11 CHAOS NET INTERFACE +IFN XGP,[ + SKIPL XGPUSR + PUSHJ P,XGPCLK +] +IFN 340P,[ + AOSGE T,DTIME + JRST DSTPD ;WAIT IF DTIME CLOBERED DUE TO RATE EXCEEDED + CAILE T,2 + MOVEI T,2 + MOVEM T,DTIME + SKIPL CDISOF + SKIPGE DISOFF + JRST DSTPD + AOSG DISON + CONO DIS,1100\SDCHN_3\DISCHN ;RESTART DISPLAY +DSTPD: +] +IFN E.SP,[ + SKIPN T,E.SPGW ; E&S WAITING FOR PAGE + JRST E.SOK + HRRZM T,DISSPG ; SAVE FOR SWPPIN + SKIPL T,DISUSR ; -1 IMPLIES NO USER + MOVEM T,DISSWI ; USER INDEX FOR SWPPIN +E.SOK: +] +IFN N11TYS,[ + SKIPE @TT11HD ;ANY INPUT FROM PDP11? + PUSHJ P,TT11IN ;YES, DO INPUT INT LVL STUFF FOR IT,. +] +IFN DZ11P,[ + PUSHJ P,DZSCAN ;SCAN DZ'S FOR INPUT +] + MOVS T,TTERQS + CAIE T,(MOVE) + PUSHJ P,TTECH ;CHARACTERS TO BE ECHO ED +IFN NETP,[ + SKIPE STYNTA ;IF THERE ARE STY'S CONNECTED TO NETWORK I/O, + PUSHJ P,STYNTC ;XFER BETWEEN THEM. +] +IFN KS10P, PUSHJ P,OVHCLK + SETCMM CLKFL1 + SKIPL CLKFL1 + AOS TIME ;GET HERE EVERY THIRTIETH OF A SECOND +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT + JRST PRESCD +];PAGPRE + AOSG SCHFLG + JRST CLKB5 ;TIME NOT UP + AOS NLPCLK + JRST SCHED ;SCHEDULE + +CLK1F: +IFN PAGPRE,[ + SKIPE PREEMP ;CHECK FOR PRE-EMPTION INTERRUPT. THIS IS HERE + JRST PRESCD ; BECAUSE OF SCREW CASE WHEREBY DLSRCH PREVENTS + ; PREEMP FROM DOING ANYTHING, AND PREEMP WOULD + ; PREVENT CLOCK FLAG FROM GETTING CLEARED IF IT WAS + ; TESTED BEFORE CLOCK. +];PAGPRE +; MOVEI J,APRCHN ;DO NOT TAKE THESE OUT WITHOUT SEEING RG!!!! +; JSP E,SPUR +; JRST SCHED + AOS CHSPUR+APRCHN ;COUNT SPURIOUS INT + JRST SCHED ;(MIGHT HAVE BEEN RUNNING NULL JOB) + +IFN PAGPRE,[ +PRESCD: AOS NLPPRE + JRST SCHED +];PAGPRE + +IFN KL10P,[ +CLKB2: CONSZ 2000 ;NXM + PUSHJ P,MEMHNG + CONSZ 1040 ;POWER FAIL OR I/O PAGE FAIL + BUG HALT,[KL: POWER FAIL OR I/O PAGE FAIL] + CONSZ 300 ;CACHE DIR OR PT DIR PAR ERR. + BUG HALT,[KL: CACHE OR MAP DIR PAR ERR] + CONSO 4400 ;SBUS ERR OR MB PAR ERR + JRST SCHED ;CALLED MEMHNG, AND NOTHING ELSE => SCHEDULE. + SETOM PARRSN ;TEL PAR ERR SCANNER THIS IS AN INTERRUPT, NOT A PG FAIL. + RDERA PARERA ;STORE ADDR OF PAR ERR. + JRST CLKB1E +] ;IFN KL10P + +IFN KS10P,[ +CLKBKS: CONSZ 7600 ; Any bad guys? (8080 -> KS is 20, Interval is 40, + JRST CLKKS1 ; Memory ECC is 100.) + CONO 020020+APRCHN ; 8080 wants service. Clear the bit. + MOVEI I,NFKSTY ; TTY # (fancy name for 0) + CONO PI,TTYOFF ; Pretend this is TTY interrupt level. + SKIPN A,8CTYIN ; Any input from 8080? + JRST CLKKS2 + SETZM 8CTYIN ; Yes: Make room for more. + PUSHJ P,NTYI1 ; Stuff it into the tty. + MOVEI I,NFKSTY ; Just in case... +CLKKS2: SKIPN 8CTYOT ; Room for output yet? + PUSHJ P,TYPSC ; Yes: Get some now. + CONO PI,TTYON ; No: 8080 will wake us up later. + JRST SCHED ; Null job might have been running. + +CLKKS1: CONSZ 1000 ;Power failure + BUG HALT,[KS: POWER FAIL] + CONSZ 6000 ;KS -> 8080 or Flag 24 + BUG HALT,[KS: KS->8080 FLAG OR FLAG 24 SET] + CONSZ 400 ;NXM + PUSHJ P,MEMHNG + CONSO 200 ;Bad memory data + JRST SCHED + IORD B,[KSECCS] + MOVEM B,PARERA + JRST CLKB1E + +] ;IFN KS10P + +CLUFLS: CONO PI,CLKON ;FROM UFLS + CLKLEV + MOVE T,UPC(U) + MOVEM T,CLKBRK + AOS NUFLS + AOS NLPUFL + JRST SCHED2 + + ;CLOCK QUEUE SERVICE +CLQBRK: SKIPG U,CLROOT ;GET POINTER TO CURRENT BLOCK + BUG ;CLK QUEUE SCREWED + SKIPG T,1(U) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + MOVEM T,CLROOT ;SET UP POINTER FOR NEXT BLOCK + SETOM 1(U) ;INDICATE CURRENT BLOCK IDLE + XCT 2(U) ;EXECUTE REQUEST (PROBABLY A JRST) + ;FALL THROUGH IF SINGLE INST RQ +CLQRET: ;RETURN FROM REQUEST + SKIPN @CLROOT ;SKIP IF TIME TILL NEXT RQ NONZERO + JRST CLQBRK ;ZERO TIME DELTA, DO NEXT RQ + JRST CLQBRT ;RETURN TO CLOCK ROUTINE + +CLQTTR: JUMPE TT,CLQRET ;COMMON RETURN FOR TT IDLE FLAG +CLQREE: MOVEI E,CLQRET ;RE ENTER RQ + +;CLOCK OFF OR IN PROGRESS LEVEL ADD TO CLOCK QUEUE, CALL BY JSP E, + ; T HAS TIME TILL RQ IN 60'THS + ; C POINTS TO THREE WORD BLOCK, RQ'ED INST IS IN THIRD +CLQPUT: MOVEI B,CLROOT-1 +CLQPU2: MOVE A,B ;REPLACE POINTER TO PREV BLOCK WITH CURRENT + SKIPG B,1(B) ;GET LINK TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + SUB T,(B) ;SUBTRACT TIME DELTA FOR NEXT BLOCK + JUMPG T,CLQPU2 ;JUMP IF RQ LATER THAN CURRENT BLOCK + JUMPE T,CLQPU6 ;JUMP IF RQ SAME AS " " (COULD USE PU2 BUT THIS FASTER) + ADD T,(B) ;RQ EARLIER, ADD BACK + MOVEM T,(C) ;SET DELTA OF BLOCK BEING ADDED + SUB T,(B) ;COMPUTE NEG OF DELTA FOR NEXT BLOCK + MOVNM T,(B) ;SET TIME DELTA FOR NEXT BLOCK + MOVEM B,1(C) ;SET LINK OF NEW BLOCK TO NEXT + MOVEM C,1(A) ;SET LINK OF PREV BLOCK TO NEW + JRST (E) + +CLQPU6: SETZM (C) ;SET TIME DELTA OF NEW BLOCK TO ZERO + MOVE A,1(B) ;GET POINTER TO NEXT BLOCK + MOVEM A,1(C) ;SET POINTER OF NEW TO NEXT BLOCK + MOVEM C,1(B) ;SET POINT OF CURRENT TO NEW BLOCK + JRST (E) + +;MAIN PROG LEVEL ADD TO CLOCK QUEUE +;CALL BY PUSHJ P,CLQADD +;WITH POINTER TO BLOCK IN NEXT WORD AND TIME TILL RQ IN T IN 60'THS +;POINTER TO BLOCK SHOULD NOT BE INDEXED BY C + +CLQAD1: MOVEI T,1 ;RQ IN ONE TICK +CLQADD: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + SKIPL 1(C) ;SKIP IF IDLE + JRST POPCJ1 ;IGNORE THIS RQ, BLOCK ALREADY ACTIVE + PUSH P,A + PUSH P,B + PUSH P,E + SKIPN (C) ;DELTA WORD OF IDLE BLOCK SHOULD BE ZERO + SKIPG T ;TIME SHOULD BE NON-ZERO + BUG ;CLK QUEUE SCREWED + CONO PI,CLKOFF + JSP E,CLQPUT ;ADD RQ +CLQDE4: CONO PI,CLKON + POP P,E + POP P,B + POP P,A + JRST POPCJ1 + +;DELETE CLOCK QUEUE ENTRY +;CALL BY PUSHJ P,CLQDEL WITH POINTER TO BLOCK IN NEXT WORD +CLQDEL: PUSH P,C + MOVE C,@-1(P) ;GET BLOCK POINTER + MOVEI C,@C + CONO PI,CLKOFF + SKIPGE 1(C) ;IGNORE RQ TO DELETE IF IDLE + JRST CKOCJ1 + PUSH P,A + PUSH P,B + PUSH P,E + JSP E,CLQCLR + JRST CLQDE4 + +CLQCLR: MOVEI B,CLROOT-1 ;CLOCK OFF OR IN PROGRESS VERSION +CLQDE2: MOVE A,B + SKIPG B,1(B) ;GET POINTER TO NEXT BLOCK + BUG ;CLK QUEUE SCREWED + CAME B,C ;SKIP IF FOUND BLOCK TO DELETE + JRST CLQDE2 + SKIPG B,1(B) ;GET POINTER TO BLOCK AFTER ONE TO DELETE + BUG ;CLK QUEUE SCREWED + MOVEM B,1(A) ;PATCH AROUND DELETED BLOCK + MOVE A,(C) + ADDM A,(B) ;ADD DELTA OF DELETED BLOCK TO NEXT + SETZM (C) ;CLEAR DEL + SETOM 1(C) ;MARK IDLE + JRST (E) + +OVHMTR PGF ;PAGE FAULT + +IFN KL10P,[ +EBLK +PFAILU: 0 ;SAVED U AS OF A PAGE FAILURE +PFINST: 0 ;PF INSTRUCTION IF XCT +PFOPC1: 0 ;SAVE PFOPC WHILE SWITCHING TO CLK LEVEL (PROTECT AGAINST XCTRI) +BBLK + +;PAGE FAULTS COME HERE, WITH PC IN PFOPC, AND PI SYSTEM TURNED OFF. + +PFAIL: MOVEM U,PFAILU + HLRZ U,EPTPFW + ANDI U,%PFCOD ;GET THE PFAIL CODE FROM THE PFW + CAIE U,%PFPAR + CAIN U,%PFPRX + JRST PFA2 ;IT'S A PAR ERR; BYPASS XCTR HACKS + MOVE U,PFOPC + TLNE U,%PCUSR + JRST PFA2 + LDB U,[331100,,(U)] ;GET OPCODE OF LOSING INSTRUCTION. + ;ASSUME THAT IN EXEC MODE VIRTUAL + ; AND PHYSICAL ADDRESSES ARE IDENTICAL + ; FOR INSTRUCTION FETCHES. ALSO ASSUME + ; THAT NOBODY DOES XCT OF XCT OF XCTR. +PFA4: CAIE U,XCTRI_-33 ;SKIP IF "XCTR WITH INHIBIT" + JRST PFA1 +REPEAT 2, AOS PFOPC ;ONCE COMPENSATING FOR INSTR ABORT, AND ONCE TO SKIP + MOVE U,PFAILU + JRST 17,@PFOPC ;KL-10 CROCK: JRST 17, TURNS ON PI SYSTEM + +PFA1: CAIE U,XCTR_-33 ;SKIP IF "XCTR WITH NO INHIBIT" + JRST PFA3 +PFA2: CONSO PI,77400 ;PI IN PROGRESS? + CONSO PI,1 ;CHANNEL 7 ENABLED? + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS OR CLKOFF] + SKIPGE USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE U,PFOPC + MOVEM U,PFOPC1 + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT +TPFLT1: SETOM PFAILF + CONO PI,CLKRQ ;CAUSE CLK BREAK AND PI SYSTEM ON + JRST . ;TAKES A WHILE TO GO OFF + +;COME BACK HERE PI IN PROGRESS ON CLK CHANNEL +PFA6: MOVE T,PFOPC1 + MOVEM T,CLKBRK ;SAVE PC AS OF PAGE FAULT AS PLACE INTERRUPTED FROM + AOSN PFAILF ;IF INTERRUPTED FROM INTPFL, + JRST PFA9 ; PC DOESN'T POINT TO FAULTING INSTRUCTION + TLNE T,%PSUSR ;MAYBE SPURIOUS MPV ON IOT IN USER MODE? + TLNE T,%PSUIO + JRST PFA9 ;CAN'T BE, I/O IS LEGAL + HLRZ TT,UPFW(U) + ANDI TT,%PFCOD + CAIE TT,%PFPNA ;CAN'T BE IF PAGE FAULT IS REALLY SOME OTHER RANDOM BREAK + CAIN TT,%PFILW ;SUCH AS A PARITY ERROR + JRST PFA11 +PFA9: +; MOVE T,PFOPC +; MOVEM T,UPOPC(U) ;SOLELY FOR THE .OPC USER VARIABLE + LDB E,[$PFPNO,,UPFW(U)] ;FAILING PAGE NO + HLRZ D,UPFW(U) + ANDI D,%PFCOD ;GET THE PAGE-FAULT CODE. + MOVEI A,0 ;INIT USER INT BITS + CAIE D,%PFPNA + CAIN D,%PFILW + JRST PFA5 ;REAL PAGE FAULT OR RWF + CAIN D,%PFMAR + JRST PFA7A + CAIN D,%PFPRO + JRST PFA7 ;OTHER RANDOM BREAKS + CAIE D,%PFPAR + CAIN D,%PFPRX + JRST PFA14 ;PARITY ERROR + MOVSI D,SCLBPF ;UNKNOWN PFW, GET SYSTEM JOB TO BARF ABOUT IT + TDNE D,SUPCOR + BUG PAUSE,[BAD PAGE FAIL WORD ],OCT,BPFPFW ;LOSING IN REAL TIME + IORM D,SUPCOR + AOS BPFERR + MOVEM U,BPFUSR + MOVE D,UPFW(U) + MOVEM D,BPFPFW + MOVE D,CLKBRK + MOVEM D,BPFPC + JRST SCHED ;IGNORE THE FAULT (BUT DO A FULL SCHEDULE SO SYS JOB WAKES) + +PFA14: SETZM PARRSN ;SAY THIS IS PAR ERR TRAP, NOT PAR ERR INTERRUPT. + MOVE D,UPFW(U) + MOVEM D,PARPFW ;SAVE PFW OF PAR ERR FOR ERROR MESSAGE + AC7CTX ;SELECT AC BLOCK 7, USED BY UCODE. + UMOVE D,0 ;SAVE THE AC THAT HOLDS THE BAD WORD + MOVEM D,PARWRD + SYSCTX ;AND RESET THE DATAO PAG TO NORMAL VALUE + JRST CLKB1E ;GO SCAN FOR THE ERROR. + +PFA3: CAIE U,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT ],OCT,PFOPC ;BARF! + MOVE U,@PFOPC ;QUUX! LET ONE LEVEL OF XCT WIN + MOVEM U,PFINST + MOVE U,PFAILU + LDB U,[331100,,@PFINST] + JRST PFA4 + +PFA11: XCTRI XR,[MOVE T,(T)] ;GET INSTRUCTION IN WHICH PAGE FAIL OCCURRED + TLCA T,700000 ;AND CHECK HIGH THREE BITS OF OPCODE + JRST PFA9 ;JUMP IF FAULT WAS ON INSTRUCTION FETCH + TLCE T,700000 + JRST PFA12 ;JUMP IF INSTRUCTION NOT AN IOT +PFA13: MOVSI TT,(HRRI T,) + DPB T,[2700,,TT] + XCTRI XEA,TT ;COMPUTE ITS EFFECTIVE ADDRESS + TLZA T,37 ;CLEAR @+XR, BUT LEAVE OPCODE AND AC + JRST PFA9 ;JUMP IF FAULT ON INDIRECT WORD + MOVEM T,MUUODP(U) ;IT WAS A SPURIOUS MPV, SO + MOVE T,CLKBRK ; SIMULATE TRAPPING AS A UUO + HRRI T,1(T) + MOVEM T,XUUOH(U) ;STORE OLD PC + MOVE T,CLCX(U) + MOVEM T,MUUOCX(U) ;AND OLD CONTEXT + MOVE T,MUUOCN(U) + MOVEM T,CLKBRK ;GET NEW PC + JRST CLKB5 ;AND RESTART USER AT UUOH0 + +PFA12: TLNN T,700000 ;MAYBE AN INSTRUCTION OVERLAYED ON AN MUUO, E.G. LPMR + TLNN T,040000 ;OPCODES 040-077 QUALIFY. + TLCA T,(XCT) + JRST PFA13 ;YUP. + TLNE T,777000 ;SKIP IF OPCODE WAS XCT + JRST PFA9 +; TLZ T,777740 +; TLO T,(MOVEI T,) +;Following instruction is suspected of not working (sometimes using wrong AC block) +; XCTRI XEA,T ;COMP EFFECTIVE ADDRESS OF XCT IN USER CONTEXT +;; JRST PFA11 ;AND GO PROCESS INSTRUCTION AT THAT ADDRESS +; JRST [ MOVEM T,TRMNAM(U) ;TEMPORARY FOR DEBUGGING +; JRST PFA11 ] +; JRST PFA9 ;HERE IF FAULT WAS IN INDIRECT CYCLE +;Replacement code: +PFA15: DATAI PAG,TT ;HMM, SEE IF WRONG AC BLOCK SELECTED + TLNN TT,100 + BUG + LDB TT,[220400,,T] ;CHECK FOR NEED TO SIMULATE INDEXING + JUMPE TT,PFA16 + UMOVE TT,(TT) + ADD TT,T + HRR T,TT +PFA16: TLNN T,(@) ;CHECK FOR NEED TO SIMULATE INDIRECT + JRST PFA11 + XCTRI XR,[MOVE T,(T)] + JRST PFA15 ;PROCESS INDIRECT WORD + JRST PFA9 ;TAKE FAULT ON INDIRECT WORD +;End replacement code. +];KL10P + +IFN KS10P,[ + +EBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!SVU: 0 ;Saved U at PI level I page fail +PF!I!SVT: 0 ;Saved T at PI level I page fail +PF!I!INS: 0 ;Instruction at PI level I page fail +TERMIN +IFN .-PF1SVU-21., .ERR Wrong length PFXSVU block. + +BBLK + +IRP I,,[1,2,3,4,5,6,7] +PF!I!AIL: ;;PI level I page fail comes here. + MOVEM T,PF!I!SVT ;Save T + MOVEM U,PF!I!SVU ;Save U + JSP U,PIFAIL ;Set up U and join common code +TERMIN +IFN .-PF1AIL-21., .ERR Wrong length PFXAIL block. +PFXSVT==:0,,> +PFXINS==:0,,> +PFXWRD==:0,,> +PFXOPC==:0,,> + +PIFAIL: MOVE T,PFXWRD(U) ;Check page fail word + TLNE T,%PFNXI + BUG AWFUL,[NON-EX IO REG WITH PI IN PROGRESS ],OCT,PFXWRD(U),[PC=],OCT,PFXOPC(U) + TLNE T,%PFNXM\%PFPAR + BUG AWFUL,[NXM OR PARITY ERROR WITH PI IN PROGRESS] + MOVE T,PFXOPC(U) ;Check for user mode. + TLNE T,%PSUSR + BUG AWFUL,[PAGE FAULT IN USER MODE WITH PI IN PROGRESS] + SKIPA T,(T) ;We assume that it wasn't the instruction + ;fetch itself that caused the fault. +PIFL2: MOVEI U,PF7AIL-PF7XCT(U) ;Correct U on return from PFXXCT + MOVEM T,PFXINS(U) ;Save instruction that caused fault + LSH T,-33 ;Look at opcode + CAIE T,XCTRI_-33 ;XCTRI gets special treatment: + JRST PIFL1 +REPEAT 2, AOS PFXOPC(U) ;Arrange for it to skip. + JRST PFXRET(U) ;And return. + +IRP I,,[1,2,3,4,5,6,7] +PF!I!RET: + MOVE T,PF!I!SVT ;Restore T + MOVE U,PF!I!SVU ;Restore U + JRST 2,@EPTP!I!O ;Return +TERMIN +IFN .-PF1RET-21., .ERR Wrong length PFXRET block. +PFXRET==:0,,> + +;;;Let XCT chains that end in XCTRI win. We assume that none of the +;;;fetches along the way to the XCTRI itself caused the fault. +PIFL1: CAIE T,XCT_-33 + BUG AWFUL,[PAGE FAULT WITH PI IN PROGRESS] + MOVE T,PFXSVT(U) ;Restore T + JRST PFXXCT(U) ;Go pick up word XCT'ed + +IRP I,,[1,2,3,4,5,6,7] +PF!I!XCT: + MOVE U,PF!I!SVU ;Restore U + MOVE T,@PF!I!INS ;Pick up XCTed instruction + JSP U,PIFL2 ;Set up U again and rejoin common code +TERMIN +IFN .-PF1XCT-21., .ERR Wrong length PFXXCT block. +PFXXCT==:0,,> + +EBLK + +PFLCLK: 0 ; Did page fault happen with CLKOFF? +PFLSVU: 0 ; Saved U during page fail +PFLSVT: 0 ; Saved T during page fail +PFLINS: 0 ; Faulting instruction + +BBLK + +;;; Note! +;;; If we are swapped out while running with Exec mode PC between PFAIL and +;;; PFAILE inclusive, EPTPFO is saved as our PC. (There are actually only +;;; a few PC's for which this is possible given that we mostly run CLKOFF.) + +PFAIL: SETZM PFLCLK + CONSO PI,1 + SETOM PFLCLK + CONO PI,CLKOFF ; Don't bother me + MOVEM U,PFLSVU ; Save U + MOVEM T,PFLSVT ; Save T + SKIPGE U,USER + BUG AWFUL,[PAGE FAULT IN NULL JOB] + MOVE T,EPTPFW ; Get the explanation + MOVEM T,UPFW(U) ; Save it for others + MOVE U,PFLSVU ; Restore U, only needed it for a moment. + TLNE T,%PFNXM\%PFPAR ; Bad stuff should interrupt us, right? + BUG AWFUL,[NXM OR PARITY ERROR DIDN'T INTERRUPT] + MOVE T,EPTPFO + TLNE T,%PSUSR ; In Exec mode? + JRST PFLUSR + MOVE T,(T) ; We assume that it wasn't the instruction + ; fetch itself that caused the fault. +PFLOOP: MOVEM T,PFLINS ; Save instruction that caused fault. + LSH T,-33 ; Check opcode for XCTRI + CAIN T,XCTRI_-33 ; Should we skip? + JRST PFLSKP + CAIN T,XCTR_-33 ; Touching user address? + JRST PFLUSR + CAIE T,UMOVE_-33 ; These guys are just like XCTR + CAIN T,UMOVEM_-33 + JRST PFLUSR + ;; Let XCT chains win. We assume that none of the fetches along + ;; the way caused the fault. + CAIE T,XCT_-33 + BUG HALT,[PAGE FAULT IN SYSTEM AT],OCT,EPTPFO + MOVE T,PFLSVT ; Restore T for a moment + MOVE T,@PFLINS ; Pick up XCTed instruction + JRST PFLOOP + +;;; Come here to cause faulting instruction to skip. +PFLSKP: MOVE T,PFLSVT ; Restore T +REPEAT 2, AOS EPTPFO + SKIPL PFLCLK ; Unless clock was already off + CONO PI,CLKON ; turn it back on +PFAILE: JRST 2,@EPTPFO + +;;; Come here on NXI error. +PFLNXI: + +;;; We come here when the page fault is "soft" and it happened in user mode +;;; or while using XCTR, UMOVE, or UMOVEM. +PFLUSR: MOVE T,EPTPFW + TLNN T,%PFNXI ; Non-existent IO Register? + JRST PFLU1 ; Nope + MOVE T,EPTPFO + TLNE T,%PSUSR ; NXI in User IOT mode is not fatal. + TLNN T,%PSUIO + BUG AWFUL,[NON-EX IO REG ],OCT,EPTPFW,[PC=],OCT,EPTPFO +PFLU1: MOVE T,PFLSVT ; Restore T + SKIPGE PFLCLK ; Check for lossage + BUG AWFUL,[PAGE FAULT WITH CLKOFF AT],OCT,EPTPFO +TPFLT1: SETOM PFAILF ; Cause CLK level to go to PFLU2 +CCLKRQ: CONO PI,CLKRQ + JRST . ; Takes a while to go off... + +;;;CLKBRK comes back here at CLK level. +PFLU2: MOVE T,EPTPFO + MOVEM T,CLKBRK ;Save PC of page fault as place interrupted + ;from. + LDB E,[$PFPNO,,UPFW(U)] ;E: Virtual page number + HLRZ D,UPFW(U) + ANDI D,%PFNXI\%PFWRT\%PF2.9\%PF2.8 ;D: Page fault code + MOVEI A,0 ;A: User interrupt bits + TRNE D,%PFNXI ;NXI in User IOT mode. + JRST PFA7A + +;Drops through into PFA5 + +] ;KS10P + +IFN KA10P,[ +CLKB1: MOVE T,CLKBRK + CONSZ 200 + JRST CLKFO1 ;FLOATING OVERFLOW ENABLED +CLKFO2: CONSZ 20 ;SKIP IF AR OV INT NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP IF OV + CONSZ 270000 ;NOT OV, CHECK PDL OV, MEM PROTECT, NXM + JRST CLKB1C ;PDL OV, NXM, ETC + JRST CLKB1D ;ONLY CLOCK BREAK, AR OV JUST ENABLED + +CLKFO1: CONSO 100 ;SKIP ON FLOATING OVERFLOW + JRST CLKFO2 ;NOT REALLY FLOATING OVERFLOW +CLKB1C: JUMPL U,CNLJL ;NULL JOB LOST + MOVEI A,0 ;SET UP INTERRUPT BITS FOR USER + CONSZ 20 ;SKIP IF OV NOT ENABLED + CONSO 10 ;OV ENABLED, SKIP ON OV + JRST CLB1A ;NOT AROV + PUSHJ P,AROV +CLB1A: CONSZ 200 ;SKIP IF FL OV NOT ENABLED + CONSO 100 ;FL OV ENABLED, SKIP ON FL OV + JRST CLB1B ;NOT FLOATING OVERFLOW + PUSHJ P,ARFOV +CLB1B: CONSO 270000 ;SKIP IF PDL OV, NXM, OR MEM PROTECT + JRST CLB1X + CONSZ 10000 ;NON EX MEM + PUSHJ P,MEMHNG + CONSO 200000 + JRST CLKB1H + TRO A,%PIPDL ;PDL OVFLO + TLNN T,%PCUSR ;SKIP IF IN USER MODE + BUG HALT,[PDL OVERFLOW IN EXEC MODE] +CLKB1H: CONSO 20000 ;MEM PROTECT + JRST CLKB1G + HLLZ D,UPQUAN(U) ;PICK UP FAULT BITS + TLNE D,1000 + TLNN D,770 ;ALL CONDITIONS WHICH ABORT INSTRUCTION + JRST CLKB1J ;(PLUS PAGE NXM FOR RANDOMNESS) + TRZ A,%PIPDL ;INSTRUCTION ABORTED, DON'T SET PDL OV + HLLZ T,UPOPC(U) + LSH T,5 + HRR T,UPOPC(U) ;FIX UP OPC + MOVEM T,CLKBRK ;RESET PC FROM OPC + AOS NPGFLT + HLRZ E,UPJPC(U) ;GET VIRTUAL PAGE # (LH OF JPC) + TRNN E,400 + JRST CFHFPF + ANDI E,377 ;FLUSH AGE ETC +] ;KA10P + ;DROP THROUGH INTO PFA5 + +IFE KA10P,[ +PFA5: AOS NPGFLT +] ;IFE KA10P + MOVE TT,LUMPS + HRRZ W,USER +IFN KA10P,[ + TLNE D,320 ;SKIP IF REALLY PAGE FAULT + JRST CFH4 ;OTHERWISE WRITE IN READ ONLY OR EXECUTING IMPURE PAGE +] ;KA10P + +;COME HERE WITH +; A BITS FOR USER'S PIRQC +; D PAGE FAULT BITS OR CODE +; E VIRTUAL PAGE NUMBER OF PAGE FAILURE +; TT THE UMAPS SETTING +;THE MYSTERIES OF W: +; RH IS A USER INDEX +; LH 0 => NORMAL PAGE FAULT +; NON0 => SWAP IN REQUEST FOR OTHER REASON. D,TT SHOULD BE 0. +; SPECIFICALLY, +; 4.9 => DMA DEVICE SWAP-IN, SEE SWIRQB, SWPPIN +; 4.8 => FROM SCHEDULER, TO GIVE INTERRUPT (?) THIS IS NO LONGER USED, +; PROBABLY. +; 4.7 => FROM CFHAHD, TO PAGE AHEAD. THIS IS ONE LEVEL OF RECURSIVE +; USE OF CFHSW1. +; FOR A NORMAL PAGE FAULT, THE USER PC IS IN CLKBRK. + +CFHSW1: HRRZM E,CFHUVP ;USER'S VIRTUAL PAGE NUMBER + TRZN E,200 + JRST CFH1 + MOVEI C,UPGCPH(W) ;VIRTUAL ADDRESS IN USER'S HIGH SEG + TLNN TT,%UMMPU ;IS MY UPPER NORMAL? + JRST CFH2 ;YES, USE MY UPPER CPB + MOVEI C,UPGCPH(TT) ;NO, TRY HIS UPPER. + TLNE TT,%UMUTL ;IS MY UPPER GOING TO HIS LOWER? + MOVEI C,UPGCP(TT) ;YES, TRY HIS LOWER. + JRST CFH2 + +CFH1: MOVEI C,UPGCP(W) ;VIRT ADDRESS IN USER'S LOW SEG + TLNN TT,%UMMPL + JRST CFH2 ;MY LOWER DBR NOT HACKED + MOVEI C,UPGCP(TT) + TLNE TT,%UMLTU ;WAS MY LOWER HACKED TO POINT TO UPPER? + MOVEI C,UPGCPH(TT) ;YES. +CFH2: ROT E,-1 + ADD C,E + HRLI C,222200 + SKIPGE E + HRLI C,2200 + MOVE T,C ;CALCULATE MAP ENTRY B.P. FROM CIRC PTR B.P. + ADD T,[(200000-2000)UPGMP-UPGCP] + LDB E,C ;CIRC MEM USE POINTER FOR PAGE FAULT + JUMPE E,CFH4 ;ADDRESS IS IN REAL ILM + CAIN E,-1 + JRST CFH4 ;ON REFERENCE TO ABS PAGE ALSO ILM +IFN KL10P,[ CAIE D,%PFILW + JRST CFHW1 + LDB I,T + JRST .+1(I) + BUG ;? + JRST CFH4 ;WRITE IN READ ONLY? + JRST CFHRWF ;READ WRITE FIRST + BUG ;? +] ;KL10P +IFN KS10P,[ CAIN D,%PFWRT\%PF2.8 ;WRITE IN READ ONLY + JRST CFH4 + CAIN D,%PFWRT\%PF2.9 ;READ WRITE FIRST + JRST CFHRWF + TRNE D,%PF2.8\%PF2.9 ;PAGE NOT IN MAP + BUG HALT,[BOGUS PAGE FAIL CODE] +] ;KS10P +IFN KA10P,[ + TLNE D,40 + JRST CFHRWF +] ;KA10P +;REFERENCE TO PAGE WITH NO ACCESS IN MAP. +CFHW1: SKIPGE RPCL(W) + JUMPGE W,CFF1 ;BEING RPCLSRED? + MOVEM A,CFHAS + AOSE CIRPSW + JRST CFH5 ;CIRPSW NOT AVAILABLE + TRZE E,400000 + TRNE E,200000 + JRST CFHSW3 + CAML E,MMPMX + BUG ;MMP OUT OF RANGE + MOVE C,E ;CIRC PNTR ALREADY POINTS TO MMP + ADD C,MMPEAD + JRST CFHSW4 + +CFHSW3: PUSHJ P,UCPRL ;FIND MMP + 200000,,.+2 + BUG ;NONE? + SUB P,[4,,4] +CFHSW4: LDB D,[410200,,(C)] ;TWO BITS OF MMP ENTRY GIVES DISPOSITION OF PAGE + AOS NRPI(D) + JRST @CFHDT(D) + +CFHDT: CFHPI ;IN + CFHPCI ;COMING IN + CFHPO ;OUT + CFHPGO ;GOING OUT + +;PAGE FAULT IN JOB BEING PCLSR'D. +CFF1: MOVE C,CLKBRK + TLNE C,%PCUSR + BUG ;BEING RPCLSRED IN USER MODE +IFN KA10P,[ + MOVSI D,1770 + ANDCAM D,UPQUAN(W) ;CLR PG FLT + LPMR UPGML(W) + CONO 470000+APRCHN ;CLR PDL OV + QT OV + MPV + NXM +] ;KA10P + MOVE T,[BADBTS] + IOR T,MSKST(W) + AND T,A + IORM T,PIRQC(W) +IFE KA10P,[ + MOVE T,CLCX(W) ;RESTORE UPT BUT NOT ACS + HRLI T,300000 + DATAO PAG,T +] ;IFE KA10P + CONO PI,CLKOFF ;GO ALLOW SELF TO GET RPCLSRED + JRST 10,UFL1 ;GO INTO UFLS WITH CLK OFF RATHER THAN + ;IN PROGRESS + +CFHRWF: ;HANDLE "WRITE IN READ-WRITE-FIRST PAGE" PAGE FAULT. +IFN KA10P,[ + TLNE D,10 + JRST CFHW1 ;SOMETIMES NO ACCESS SEEMS TO BE ON TOO + LDB I,T + CAIE I,2 + BUG ;GOT "WRITE IN R-W-F PAGE" BUT PAGE ISN'T R-W-F. +] ;KA10P + MOVEI I,3 + DPB I,T + MOVEM A,CFHAS + JRST CFHX1 + +;; EXIT FROM PAGE FAULT HANDLING FOR NON-ERROR FAULT. +;; C SHOULD CONTAIN 0 IF CAN CONTINUE NOW, OR A FLSINS TO WAIT WITH. +;; A SHOULD CONTAIN -1 IF FAULT HANDLED SUCCESFULLY (PAGE IN OR ON ITS WAY), ELSE 0. +CFHX: SETOM CIRPSW + TLNN W,200000 + JUMPL W,CPOPJ +CFH5A: JUMPE C,CFHX1 ;IF NOT GOING TO WAIT, SKIP NPGWTU CODE + MOVSI D,%SWPGW + IORM D,USWST(W) ;WAITING FOR PAGE + AOS NPGWTU ;KEEP COUNT OF USERS WAITING FOR A PAGE + SKIPN FLSINS(W) + MOVEM C,FLSINS(W) + SKIPE FLSINS(W) + CLEARM DLSRCH +CFHX1: MOVE A,CFHAS +IFN KA10P, MOVSI D,1770 ;CLEAR FAULT STATUS BITS + MOVE U,USER + JRST CFH6 + +;; WAIT FOR CIRPSW TO BE AVAILABLE. +CFH5: SETZ A, + JUMPL W,CPOPJ + MOVE C,[SKIPL CIRPSW] + AOS NLPPGC + JRST CFH5A + +;PAGE FAULT ON PAGE THAT'S REALLY IN CORE. +CFHPI: PUSHJ P,CFHAHC ;SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. + MOVSI D,MMPPGA + TDNE D,(C) + AOS NPGAHR ;COUNT NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. + ANDCAB D,(C) + MOVSI D,MMPPGB + TDNE D,(C) + AOS NPGBHR ;COUNT NUMBER OF PAGES AGED BY PAGE-BEHIND WHICH WERE USED AGAIN. + ANDCAB D,(C) + HRLI C,2200 + PUSH P,C ;SAVE MMP ENTRY ADDRESS FOR PPIUM. + PUSHJ P,UCPRL + 100000,,.+2 ;RETURN ON MEMPNT + BUG ;NO MEMORY LINKED IN? + SUB P,[4,,4] ;FIND MEMBLT INDEX + POP P,C + TLNE D,MMPBAD ;WAS THIS PAGE RECENTLY A PAR ERR VICTIM? + JRST CFHPB ;YES; READ IT BACK OFF THE DISK IF POSSIBLE. +IFN E.SP,[ + JUMPGE W,E.SBAR ;IF NOT CALLED FROM SWPPIN + HRRZ H,DISUSR ;CHECK TO SEE IF SERVICING E&S + CAIN H,(W) ;NOT DISPLAY, THEN SKIP + PUSHJ P,E.SPGI ;ELSE TIE DOWN PAGE +E.SBAR: +] + MOVE A,T + HLLZS MMSWP(A) ;CLEAR LENGTH OF CIRC LIST (BUT NOT EXEC PGS COUNT) + MOVE D,C + HRLI D,(TDNE T,) + PUSHJ P,PPIUM ;PUT PAGE INTO USERS' MAPS +IFN E.SP,SETZM E.SPGH ; CLEAR QSWI1 FLAG + MOVEI C,0 + MOVNI A,1 + JRST CFHX + +;COME HERE FOR PAGE WHICH SEEMS TO BE IN CORE, BUT HAD A PAR ERR RECENTLY. +;"SWAP IT OUT", SO IF IT'S PURE IT WILL JUST BE READ BACK FROM DISK. +CFHPB: PUSH P,W + MOVE A,T + SETOM CIRPSW ;UNLOCK, SO SWPOPG CAN RE-LOCK. + MOVE C,USER ;TELL SWPOPG WHICH JOB SHOULDN'T BE PCLSR'ED. + PUSHJ P,SWPOPL ;"SWAP OUT" THE PAGE (EVEN IF LOCKED DOWN) + JRST [ POP P,W ;FAILED TO GO OUT. COULD BE EXEC PAGE POINTING TO IT, + SETZ A, ;OR A JOB THAT CAN'T BE PCLSRED RIGHT NOW. + MOVSI C,(CAIA) ;WAIT A LITTLE AND TRY AGAIN (HOPE FOR THE BEST) + JRST CFHX ] + POP P,W + AOSE CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + JRST CFH5 ;OR ELSE GO INTO PAGE-WAIT TILL CIRPSW FREE. + MOVE C,SWOMMP + JRST CFHSW4 ;TRY AGAIN TO REFERENCE PAGE, SWAPPING IT BACK IN. + +;ON A RANDOM PAGE FAULT, SEE IF WE WANT PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES W SET UP AS FOR CFHSW1, AND TT +CFHAHC: MOVE D,CFHUVP ;GET USER'S VIRTUAL PAGE NUMBER. + TLNN W,-1 ;PAGE AHEAD ONLY FOR NORMAL PAGE FAULT (SO PC IS IN CLKBRK). + SKIPN PAGAHD(W) ;IS PAGE-AHEAD WANTED FOR THIS JOB? + POPJ P, + MOVSI T,%UMMPU + TRNN D,200 + MOVSI T,%UMMPL + TDNE TT,T ;NO PAGE-AHEAD ON PAGE NOT MAPPED NORMALLY. + POPJ P, + HLRZ H,PAGRAN(W) + HRRZ T,PAGRAN(W) + CAML D,H ;IS PAGE IN RANGE FOR AUTOMATIC PAGE-AHEAD? + CAML D,T ;IF SO, GO DO IT. + POPJ P, + PUSH P,C + PUSHJ P,CFHAHD + POP P,C + POPJ P, + +;AUTOMATIC PAGE-AHEAD AND PAGE-BEHIND. +;WHEN PAGE N IS PUT INTO THE MAP, PAGE N+1 IS SWAPPED IN +;AND PAGE N-1 IS SWAPPED OUT. +;(ACTUALLY, 1 IS A PARAMETER, IN THE PAGAHD VARIABLE) +CFHAHD: PUSH P,CFHUVP +;LOOP, REQUESTING SWAP-IN FOR THE NEXT N PAGES. E HAS PAGE NUMBER TO SWAP IN. +CFHAH1: MOVE E,CFHUVP + HLRE A,PAGAHD(W) + MOVE T,A + ADD A,(P) + CAMN A,E ;DETECT END OF LOOP. + JRST CFHAH2 + SKIPL T ;ELSE INCREMENT OR DECREMENT PAGE NUMBER. + AOSA E + SOS E + PUSHJ P,CFHRNG ;IS PAGE NUMBER IN RANGE FOR PAGE-AHEAD? + JRST CFHAH2 + PUSH P,W + HRLI W,500000 ;PAGE AHEAD THE PAGE. 100000 MEANS PAGE-AHEAD. + SETZB D,TT + SETOM CIRPSW ;ALLOW CFHSW1 TO LOCK CIRPSW. + PUSH P,CFHAS + PUSHJ P,CFHSW1 + POP P,CFHAS + SETZM CIRPSW ;BUT REALLY IT'S ALREADY LOCKED SO KEEP IT SO. + POP P,W + SKIPN A + AOS NPGAH1 ;COUNT NUMBER OF TIMES AN ATTEMPT FAILS. + JRST CFHAH1 + +;NOW IT'S TIME FOR PAGE-BEHIND. E HAS PAGE NUMBER TO SWAP OUT. +CFHAH2: MOVE E,(P) +;???? IS THERE ANY NEED TO PRESERVE U, EVER, INSIDE CFHSW1? + PUSH P,U + HRRE A,PAGAHD(W) ;GET PAGE-BEHIND DISTANCE. + JUMPE A,CFHAH4 + ADDB A,E ;COMPUTE WHICH PAGE TO PAGE OUT. + PUSHJ P,CFHRNG ;SKIP IF PAGE IS IN RANGE FOR PAGE-BEHIND. + JRST CFHAH4 + MOVE U,W + PUSHJ P,UPLC ;LOOK UP THE PAGE IN THE MAP. + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,CFHAH4 ;NO PAGE THERE + CAIN D,-1 + JRST CFHAH4 ;ABSOLUTE PAGE, DO NOTHING. + LDB D,T + TRO D,PMAGEM ;AGE THE PAGE, IF THE PAGE IS REALLY IN THE MAP, + TRNE D,600000 + DPB D,T + AOS NPGBHA ;COUNT PAGES AHED FOR PAGE-BEHIND. + MOVE D,T ;SAVE B.P. TO PAGE MAP HALFWORD, FOR CFHAH6. + MOVE C,Q ;STARTING FROM CIRC PTR, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + MOVSI T,MMPTMP\MMPOUT ;IF PAGE IS IN TRANSIT OR OUT, DO NOTHING TO IT. + TDNE T,(C) + JRST CFHAH6 + MOVE T,CLKBRK + TLNN T,%PCUSR ;IF JOB IN EXEC MODE, CAN'T SWAP OUT PAGE, SO JUST LEAVE AGED. + JRST CFHAH6 + MOVE T,MEMFR + SUB T,NCBCOM ;IF LOTS OF FREE MEM, DON'T SWAP OUT. + SUB T,SILNG + CAML T,CFHAHS + JRST CFHAH6 + PUSHJ P,UCPRL ;GET CORE PAGE NUMBER IN T. + 100000,,.+2 + BUG + SUB P,[4,,4] + HLRZ A,MMSWP(T) + JUMPN A,CFHAH6 ;POINTED TO BY AN EXEC PAGE, E.G. 340, CAN'T SWAP OUT. + PUSH P,E + PUSH P,D + PUSH P,W + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + HRRZ C,W ;DON'T PCLSR ME + SETOM CIRPSW ;SWPOPG WILL WANT TO RE-LOCK CIRPSW. + PUSHJ P,SWPOPG ;SWAP OUT + JRST CFHAH5 ;CAN'T SWAP OUT => LEAVE JUST AGED. + AOS NPGBHD ;COUNT PAGES SWAPPED OUT BY PAGE-BEHIND. +CFHAH5: POP P,W + POP P,D + POP P,E + POP P,U + POP P,CFHUVP + AOS CIRPSW ;SWPOPG UNLOCKS; RE-LOCK. + POPJ P, ;CAN'T GET LOCKED BY SOMEONE ELSE, WE ARE AT CLOCK LEVEL + +;HERE FOR PAGE-BEHIND PAGE WHICH WE CAN'T OR DON'T WANT TO SWAP OUT. +CFHAH6: MOVSI T,MMPPGB ;IT HAS ALREADY BEEN AGED. MARK IT FOR METERING PURPOSES. + IORM T,(E) ;E POINTS TO MMP ENTRY. +CFHAH4: POP P,U + POP P,CFHUVP + POPJ P, + +;SKIP IF PAGE NUMBER IN E IS IN RANGE FOR PAGE-AHEAD OR PAGE-BEHIND. +;ASSUMES USER INDEX IN W. CLOBBERS T. +CFHRNG: CAIL E,400 + POPJ P, + HLRZ T,PAGRAN(W) + CAIGE E,(T) + POPJ P, + HRRZ T,PAGRAN(W) + CAIL E,(T) + POPJ P, + JRST POPJ1 + +EBLK + +CFHAHS: 20 ;IF LESS THAN THIS MUCH FREE MEM, PAGE-BEHIND SHOULD SWAP OUT. + +NPGAHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED IN FOR PAGE-AHEAD. +NPGAH1: 0 ;NUMBER OF TIMES WE WERE UNABLE TO PAGE AHEAD. +NPGBHD: 0 ;NUMBER OF PAGES WE ACTUALLY SWAPPED OUT FOR PAGE-BEHIND. +NPGBHA: 0 ;NUMBER OF PAGES WE DID PAGE-BEHIND. +NPGAHR: 0 ;NUMBER OF PAGED-AHEAD PAGES ACTUALLY USED. +NPGBHR: 0 ;NUMBER OF PAGES AGED FOR PAGE BEHIND AND USED AGAIN. + +BBLK + +;REFERENCE TO SWAPPED OUT PAGE, MMP ADDRESS IN C. SWAP IN THE PAGE. +;W HAS THE USER INDEX AND FLAGS. +CFHPO: PUSHJ P,CFHPOA + JRST [ SETZ A, ;FAILED. RETURN CODE FOR FAILURE, IF THIS IS FOR DEVICE (W<0). + JRST CFHX] + TLNN W,100000 ;IF THIS IS A PAGE-AHEAD REQUEST, + JRST CFHPOB + MOVSI A,MMPPGA ;MARK THE MMP ENTRY SO, + IORM A,(C) + AOS NPGAHD ;AND COUNT IT AS A SUCCESSFUL ATTEMPT TO PAGE AHEAD. +CFHPOB: TLNN W,200000 + JUMPL W,CFHPO2 + PUSHJ P,CFHAHC ;ORDINARY PG FAULT => MAYBE PAGE AHEAD. + MOVSI D,%SWBEM +IFN SWPWSP,[ ;SWAPPING IN A PAGE FOR THIS GUY + ANDCAM D,USWST(W) ;SO CLEAR BEST EFFORT MADE TO SWAP OUT BIT +];SWPWSP +IFE SWPWSP,[ + TDNN D,USWST(W) ;IF JOB IS BRINGING IN FIRST PAGE + JRST CFHPO2 ; SINCE BEING SWAPPED OUT, + ANDCAM D,USWST(W) ;CLEAR BEST EFFOR MADE TO SWAP OUT BIT + EXCH U,W ;AND MAKE SWAP HISTORY TABLE ENTRY + MOVSI T,0 ;FOR "BEGIN LOADING" + PUSHJ P,SWPKHT + EXCH U,W +];SWPWSP +CFHPCI: +CFHPGO: +CFHPO2: MOVNI A,1 ;SIGNAL "SUCCESS" + TLNN W,200000 + JUMPL W,CFHX + MOVSI D,MMPTMP ;BIT ON IF PAGE "IN TRANSIT" + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) ;HANG USER UNTIL PAGE GETS WHERE IT'S GOING + HRLI C,(TDNE T,) ;COMBINE WITH ADDRESS OF MMP + AOS NLPPAG + JRST CFHX + +;SWAP IN PAGE. W HAS USER INDEX AND FLAGS. C HAS MMP ADDRESS. +;SKIPS IF SUCCESSFUL. OTHERWISE RETURNS FLSINS IN C. +;SIGN BIT IN W IS SET FOR SWAP IN FOR DEVICE OR FOR PAGE-AHEAD +;(THAT IS, NOT ONE WHICH A JOB MUST WAIT FOR) +;SO DON'T INCREMENT SOME COUNTERS AND DON'T BOTHER WITH FLSINS IN C. +CFHPOA: +IFE SWPWSP,[ + SKIPGE USWSCD(W) ;IF SWAP BLOCKED, EITHER UNBLOCK OR GIVE UP. + JRST CFBO1 +CFBO2: +];SWPWSP +IFN SWPWSP,[ + MOVE E,USWST(W) ;IF SWAPPED OUT, WE ARE EITHER GOING TO ENTER + TLNE E,%SWOUT ;THE LOADING STATE OR THE SWAP BLOCKED STATE + JRST CFSB +CFSB1: +];SWPWSP + MOVSI E,MMPISW + AND E,(C) + CONO PI,UTCOFF-1 + JUMPN E,CFHPO5 ;INITIAL SWAPIN; GIVE UP AND WAIT NOW IF TUT IS LOCKED. +CFHPO7: PUSHJ P,HMRQC ;GET PHYS MEM BLOCK, NUMBER IN A. + JRST CFHPO1 ;MEM NOT AVAILABLE + MOVEI B,1 + DPB B,[410200,,(C)] ;INDICATE COMING IN + HRRZ B,(C) ;OLD CP OF MMP + MOVEM B,MEMPNT(A) ;BECOMES LINK OUT OF CORE BLOCK + HLRZ B,1(C) ;B := DISK ADDRESS + LDB I,[$MMPUN,,(C)] ;I := DISK NUMBER + CAIL I,NQS + BUG + HRLM B,MEMPNT(A) ;SET DISK ADDRESS CORE BLOCK COMING FROM +IFN SWPWSP,[ + MOVE D,USWST(W) + TLNN D,%SWLOD + AOSA NPLBNL + AOS NPLBLJ +];SWPWSP + SKIPE E ;IF INITIAL SWAP IN PAGE, SOS THE TUT NOW + PUSHJ P,CFHPO8 ;SINCE WE ARE DISSOCIATING THE PAGE FROM THE DISK BLOCK. + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;SHOULDN'T HAVE TO SWAP IN THE SYSTEM + CONO PI,UTCON-1 ;LEAVE CLKCHN OFF. + SOS NPGSWO + AOS SWIPRQ ;TOTAL SWAP IN REQUESTS +;; MARK THE PHYSICAL MEMORY BLOCK AS BEING SWAPPED INTO BY THIS PAGE. + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,600000(A) + HRRM B,(C) ;MAKE CP OF MMP POINT TO MEMPNT + MOVE TT,C + SUB TT,MMPEAD + DPB TT,[MMMPX,,MEMBLT(A)] ;STORE MMP INDEX IN MEMBLT + MOVEI TT,.BM MLO + ANDCAM TT,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK +;; PUT THE TRANSFER ON THE SWAP IN LIST. + CONO PI,UTCOFF-1 + HLRZ TT,SINLST(I) ;GET PREV BLOCK + SKIPE TT + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN TO PREV BLOCK + SKIPN TT + MOVEM A,SINLST(I) ;OR TO HEADER IF FIRST + HRLM A,SINLST(I) ;AND SET NEW LAST BLOCK + AOS SILNG ;AOS NUMBER OF PENDING SWAP IN RQS. + PUSHJ P,QSTRT1 ;WAKE UP DISK INTERRUPT LEVEL. + CONO PI,UTCON-1 +;; UPDATE SWAP HISTORY TABLE. + HRLZ TT,W + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS USER NUMBER, BASHES I +IFN SWPWSP,[ + MOVSI T,%SWLOD + TDNE T,USWST(W) + TLO TT,(SETZ) +];SWPWSP + MOVE T,CFHUVP + DPB T,[321000,,TT] + HRR TT,TIME + MOVEM TT,@PGIHTP + AOS T,PGIHTP + MOVE TT,UTRNTM(W) + MOVEM TT,PGIHTL-1(T) + MOVEI TT,PGIHTB + CAIL T,PGIHTB+PGIHTL + MOVEM TT,PGIHTP + TLNN W,200000 + JUMPL W,POPJ1 + AOS USIPRQ(W) + JRST POPJ1 ;HANG USER UNTIL PAGE IN + +;IF SWAPPNG IN "INITIAL SWAP IN" PAGE, CHECK TO SEE WHETHER TUT IS AVAILABLE. +;WE CAN'T SWAP THE PAGE IN IF NOT. +CFHPO5: LDB I,[$MMPUN,,(C)] ;GET DSK # + CAIL I,NQS + BUG + SKIPL QTUTO(I) + JRST CFHPO7 ;DISK TUT AVAIL + CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ ;NO COUNTER AOS IF SWAPIN FOR DEVICE OR PAGE AHEAD. + MOVE C,[SKIPGE QTUTO] ;ALSO MUSTN'T SMASH C + ADD C,I + AOS NLPPGT + POPJ P, + +;LATER ON, COME HERE TO SOS THE TUT, AFTER GETTING THE MEM, WHEN WE CAN NO LONGER BLOCK. +CFHPO8: ANDCAM E,(C) ;CLEAR INITIAL SWAPIN BIT + MOVE D,B ;GET TRK # + PUSHJ P,TUTPNT + CAIGE B,TUTMNY + SOJL B,[JRST 4,.] + DPB B,D + HRRZS 1(C) ;CLEAR ASSIGNED TRACK NUMBER SO NEW SPACE ASSIGNED ON SWAPOUT + POPJ P, + +;HERE IF NO MEMORY TO SWAP PAGE INTO. +CFHPO1: CONO PI,UTCON-1 + TLNN W,200000 + JUMPL W,CPOPJ + SKIPGE MEMFRZ ;IF BECAUSE MEMFRZ LOCKED, MAKE JOB WAIT FOR MEMFRZ. + JRST CFHPO4 + MOVE C,[SKIPL MEMFRZ] + AOS NLPPGM + POPJ P, + +CFHPO4: MOVE C,[PUSHJ P,CFHPO3] + MOVN D,SOLNG + SUB D,SWPOPR ;- # PGS GOING OUT + ADDI D,10. ;MAKE SURE AT LEAST 10. GOING OUT + JUMPLE D,.+2 + ADDM D,SWPOPR + MOVEI D,1 + SKIPN FLSINS(W) + MOVEM D,EPDL2(W) + AOS NLPPG3 + POPJ P, + +CFHPO3: PUSH P,A ;FLSINS ROUTINE (NEEDED MEM) + MOVE A,MEMFR + SUB A,NCBCOM + CAIL A,5(T) + JRST POPAJ1 ;NEEDED MEM AVAILABLE + ADD A,SOLNG + ADD A,SWPOPR + SUBI A,10.(T) + JUMPGE A,POPAJ ;WILL EVENTUALLY WIN + MOVNS A + ADDM A,SWPOPR ;LOSING - SWAP SOME MORE STUFF OUT + JRST POPAJ + +IFE SWPWSP,[ +;HERE IF TRYING TO SWAP IN A PAGE BUT SWAP BLOCKED +CFBO1: MOVE E,MEMFR ;GUY SWAPPED BLOCKED + SUB E,NCBCOM + SUB E,AUSOPG + SUB E,SILNG + ADD E,SOLNG + JUMPGE E,CFBO3 ;SEEMS TO BE ROOM SO LET IT COME IN + TLNN W,200000 + JUMPL W,CPOPJ ;HANG GUY UNTIL SWAP BLOCK GOES AWAY + MOVE C,[SKIPGE USWSCD] + ADDI C,(W) + AOS NTSBUB + AOS NLPPGB + POPJ P, + +CFBO3: AOS NTSBUP + JRST CFBO2 +];SWPWSP + +OVHMTR WS ;WORKING-SET COMPUTATIONS + +IFN SWPWSP,[ +;HERE WHEN A SWAPPED OUT OR SWAP BLOCKED JOB TRIES TO SWAP IN A PAGE. +;JOB IN W, C -> MMP, USWST(W) IN E. RETURN TO CFSB1. +;WE DECIDE WHETHER ENOUGH CORE CAN BE GARNERED TO LET HIM IN, AND PUT +;HIM INTO THE LOADING STATE, OR ELSE PUT HIM INTO THE SWAP BLOCKED STATE. + +CFSB: PUSH P,C + TLNN E,%SWSB ;ALREADY SWAP BLOCKED? + PUSHJ P,WSRCM ;NO, RECOMPUTE WORKING SET + POP P,C + MOVE B,USWPRI(W) ;FIND SUM OF WS'S OF SWAPPED IN GUY'S WITH BIGGER USWPRI + PUSHJ P,WSAVL + MOVE D,USVWRK(W) ;COMPUTE AMT OF WS NOT ALREADY IN CORE + SUB D,UWRKST(W) +IFL TSYSM-356.,[ + CAML D,[TSYSM-100.,,] + JRST .+3 ;WS > PHYSICAL MEM, ALLOW IN ANYWAY, FOO! +];TSYSM + CAMGE A,D ;WILL IT FIT IN AVAILABLE MEM? + JRST CFSB2 ;NO, SWAP BLOCK + PUSHJ P,CFELD ;YES, ENTER 'LOADING' STATE + JRST CFSB1 ;AND GO AHEAD AND BRING IN THE PAGE + +CFSB2: TLNN W,200000 ;IF PAGE-AHEAD, JUST RETURN. + JUMPL W,CPOPJ + MOVE T,TIME + MOVSI A,%SWSB ;ALREADY SWAP BLOCKED? + TDNE A,USWST(W) + JRST CFSB3 + IORM A,USWST(W) ;NO, ENTER SWAP BLOCKED STATE + AOS NUSWB + MOVEM T,USWTIM(W) +CFSB3: MOVE U,W + MOVSI T,3_16. ;MAKE SWAP HISTORY TABLE ENTRY FOR SWP BLK + PUSHJ P,SWPKHT + MOVE T,TIME + SUB T,USWTIM(W) ;HOW LONG SWAP BLOCKED + CAIGE T,20.*30. ;IF LESS THAN 20 SECONDS, + SKIPA T,[15.] ; SLEEP FOR 1/2 SECOND, + MOVEI T,5*30. ; OTHERWISE SLEEP FOR 5 SECONDS + ADD T,TIME + SKIPN FLSINS(W) + MOVEM T,EPDL2(W) + MOVEI A,0 ;WILL THEN TAKE FAULT AGAIN AND + MOVE C,[CAMLE T,TIME] ;CHECK AVAILABLE MEMORY AGAIN + AOS NLPPGB + POPJ P, + +;ROUTINE TO FIND MEMORY AVAILABLE TO A JOB WHOSE USWPRI IS IN B +;RETURNS IN LH(A) SUITABLE FOR COMPARING TO UWRKST. SMASHES T,TT,J + +WSAVL: MOVEI J,2*LUBLK ;DON'T LOOK AT SYS NOR CORE JOB + MOVSI T,%SWOUT+%SWLOD ;IF THESE BITS CLEAR, JOB IS SWAPPED IN + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG ;.. + ADD A,NLOOSP ;LOOSE PAGES ARE EVICTABLE + SUB A,SWPOPR ;DON'T COUNT PAGES ALREADY COMMITTED TO EVICT + HRLZI A,-4(A) ;ALIGN AS UWRKST AND ALLOW 4 PAGES OF SLOP + SKIPA TT,TIME ;TO SEE IF PROTECTED AGAINST MEMORY PREEMPTION +WSAVL1: ADDI J,LUBLK + CAML J,USRHI + POPJ P, + SKIPE UNAME(J) + TDNE T,USWST(J) + JRST WSAVL1 ;DOESN'T EXIST, OR NOT SWAPPED IN, OR LOADING + CAMGE B,USWPRI(J) + CAMGE TT,USWTIM(J) + JRST WSAVL1 ;HIGHER PRIORITY OR PROTECTED + ADD A,UWRKST(J) ;THIS GUY'S WORKING SET IS PREEMPTABLE + JRST WSAVL1 + +;Routine to re-compute working set, also re sets up map +;to point to any pages which are swapped in but not mapped in. +;This is necessary in order to get the proper estimate of +;how much core is going to have to be swapped out to make +;this job fit. Called when a job leaves the swapped-out state, +;to enter either Loading or Swap-blocked. +;Job is in W, smashes A,B,C,D,E,T,TT,H,I,U. +;Call with CIRPSW locked and clk in progress. +WSRCM: SETZM UWRKST(W) + MOVEI E,UPGMP(W) ;SET UP SCAN OF USER'S MAP + HRLI E,442200 + MOVEI C,UPGCP(W) ;AND OF CIRCULAR POINTERS + HRLI C,442200 + LDB D,[121100,,HUSRAD(W)] ;# OF USER PAGES +WSRCM1: ILDB A,E ;GET PAGE MAP ENTRY + ILDB B,C ;AND CIRCULAR POINTER + JUMPE A,WSRCM2 ;JUMP IF PAGE DOESN'T EXIST + CAIN B,-1 + JRST WSRCM2 ;ABS PAGE, DON'T COUNT + TRNN A,600000 ;ALREADY SWAPPED IN? + JRST WSRCM3 ;NO, GO PONDER + ANDI A,PMRCM ;GET PAGE MAPPED TO + HRRZ B,MMSWP(A) ;GET # SHARERS + MOVSI A,1 ;COMPUTE WS ADJUSTMENT + IDIV A,B + ADDM A,UWRKST(W) +WSRCM2: SOJG D,WSRCM1 ;LOOP + POPJ P, + +WSRCM3: PUSH P,C ;PAGE NOT MAPPED, SEE IF IT'S IN + PUSHJ P,UCPRL + 100000,,WSRCM4 ;RETURN WITH 4 PUSHES IF MEMORY IN LOOP + POP P,C ;NO MEMORY, LEAVE ALONE + SOJG D,WSRCM1 + POPJ P, + +WSRCM4: SUB P,[4,,4] ;FOUND MEMORY, IN T + TRNE A,2 + MOVEI A,2 ;USE READ/WRITE/FIRST RATHER THAN READ/WRITE + LSH A,20 + IORI A,PMCSHM(T) ;SET UP MAP + DPB A,E + AOS C,MMSWP(T) ;ONE MORE USER POINTING TO PAGE + MOVSI A,1 + MOVEI B,-1(C) + IDIVM A,B ;ADJUST WS AS IF WAS ALREADY POINTING TO PAGE + ADDM B,UWRKST(W) ;ADDM DOES NOTHING IF THERE WAS DIVIDE BY ZERO + IMULI C,-1(C) ;COMPUTE WS DECREASE DUE TO ADDITIONAL SHARING + MOVNI C,(C) + IDIV A,C ;IF DIVIDE BY ZERO, A GETS RIGHT THING! + MOVE C,(P) ;ADJUST ALL SHARER'S WS'S + PUSHJ P,UCPRL + SETZ WSRCM5 + POP P,C + SOJG D,WSRCM1 + POPJ P, + +WSRCM5: ADDM A,UWRKST(U) + POPJ P, + +;LEAVE LOADING STATE IF IN IT. JOB IN U, SMASH C,TT,T,I +LVLOAD: MOVE C,USWST(U) + TLZN C,%SWLOD + POPJ P, ;NOT IN LOADING STATE +LVLOA0: MOVEM C,USWST(U) ;TURN OFF LOADING STATE + MOVE T,TIME + SUB T,USWTIM(U) ;TIME IT TOOK TO LOAD + IMUL T,LODFCT ;COMPUTE PROTECT TIME + HLRZS T + ADD T,TIME + MOVEM T,USWTIM(U) + MOVSI T,1_16. ;MAKE SWAP HISTORY TABLE ENTRY + JRST SWPKHT + +;PUT JOB IN W INTO THE 'LOADING' STATE. CALL WITH D CONTAINING USVWRK-UWRKST. +;WSRCM MUST HAVE BEEN CALLED ALREADY ON THIS JOB. SMASHES A,D,T,TT,I + +CFELD: MOVE T,USWST(W) + TLNE T,%SWSB + SOS NUSWB ;CEASES TO BE SWAP-BLOCKED + TLZ T,%SWOUT+%SWSB+%SWDSO+%SWBEM + TLO T,%SWLOD + MOVEM T,USWST(W) + MOVE T,TIME ;SAVE TIME STARTED TO LOAD + MOVEM T,USWTIM(W) + MOVE U,W + MOVSI T,0 ;MAKE SWAP HISTORY TABLE ENTRY + PUSHJ P,SWPKHT + JUMPLE D,CPOPJ + HLRZ D,D ;NUMBER OF PAGES GOING TO NEED, PROBABLY + MOVE A,MEMFR ;FREE CORE + SUB A,NCBCOM ;FUDGE FOR THINGS IN PROCESS + SUB A,SILNG ;.. + ADD A,SOLNG + SUB D,A ;NUMBER OF PAGES GOING TO HAVE TO SWAP OUT + SKIPLE D + ADDM D,SWPOPR ;START THEM GOING OUT NOW + POPJ P, +];SWPWSP + +OVHMTR FLT ;MISC FAULTS + +CFH4: TLNE W,100000 ;PAGE-AHEAD OF NON-EX PAGE: DO NOTHING. + POPJ P, + JUMPL W,SWIILM ;IF FROM DMA DEVICE, GIVE ERROR +;HERE FOR FAULTS WHICH ABORT THE INSTRUCTION. +PFA7: MOVE T,OPTION(U) ;IF USER WANTS IT, + TLNN T,%OPOPC ;GIVE HIM THE OPC RATHER THAN + AOSA T,CLKBRK ;THE INCREMENTD PC. +PFA7A: MOVE T,CLKBRK ;HERE FOR KL10 MAR BREAK AND KS10 NXI + ;ERROR, ALWAYS GIVE ORIGINAL PC, INST + ;ABORTED + TLNE T,%PCUSR + JRST CLKB1J + MOVEI C,IOADCR ;FROM EXEC MODE SO RESET PC TO IOADCR + EXCH C,CLKBRK + HRRM C,LEXFDR(U) ;AND SAVE FAULT EXEC ADR FOR DEBUGGING + CLEARM DLSRCH ;IN CASE IT WAS SET + CLEARM UMAPS(U) ;RESTORE NORMAL MAP IN CASE RANDOM ONE WAS + ;IN USE + +CLKB1J: HRLM D,LEXFDR(U) ;SAVE PF BITS FOR DEBUGGING PURPOSES + +IFN KS10P,[ TRNE D,%PFNXI ;Non-existent IO register in KS10 Unibus. + TLO A,(%PINXI) +] ;KS10P + +IFN KS10P, TRNN D,%PFNXI\%PF2.9\%PF2.8 +IFN KA10P, TLZE D,210 ;NO ACCESS OR DBL +IFN KL10P, CAIN D,%PFPNA + TRO A,%PIMPV ;ILM + +IFE KS10P,[ +IFN KA10P, TLZE D,20 ;PURE +IFN KL10P, CAIN D,%PFPRO + TLO A,(%PIFET) +] ;IFE KS10P + +IFN KS10P, CAIN D,%PFWRT\%PF2.8 +IFN KA10P, TLZE D,100 ;W IN RD ONLY +IFN KL10P, CAIN D,%PFILW + TLO A,(%PIWRO) + + TDNE A,[%PIMPV\%PIWRO\%PINXI] + PUSHJ P,MPVMAS ;SAVE FAULT PAGE # FOR DEBUGGING + +;;; NO ABORT-TYPE FAULTS, CHECK OTHERS: + +IFE KS10P,[ +IFN KL10P, CAIN D,%PFMAR +IFN KA10P, TLZE D,2 + PUSHJ P,PCMARB +] ;IFE KS10P + +IFN KA10P,[ TLZE D,2000 + PUSHJ P,CPROC1 ;ONE PROCEED + ANDCA D,UPQUAN(U) ;GET BITS FLUSHED BY TLZE'S +] ;KA10P + +CFH6: +IFN KA10P,[ + ANDCMI D,-1 ;DON'T CLOBBER USER'S RUNTIME. + TLZ D,4 ;DON'T CLOBBER EXEC PAGING FLAG. + TLO D,1 ;IGNORE QUANTUM-TIMEOUT INT. + ANDCAM D,UPQUAN(U) +] ;KA10P +CLKB1K: LPMR UPGML(U) +CLKB1G: IFN KA10P, CONO 470000+APRCHN ;RESET +CLB1X: MOVE T,CLKBRK ;PUT USER'S PC WHERE IT BELONGS + MOVEM T,UPC(U) + MOVE B,[BADBTS] + IOR B,MSKST(U) ;GET OR OF ENABLED AND BAD BITS + AND B,A ;GET AND WITH BITS ACTUALLY ON + JUMPE B,CLB1XA ;NOT BAD OR ENABLED, FORGET ABOUT IT + IORM B,PIRQC(U) ;GIVE INTERRUPT + CAIN T,IOADCR ;READY TO BE INTERRUPTED? + JRST CLKB5 ;NOT QUITE, RUN MOMENTARILY AND WILL UFLS +IFN SCHBLN,SETZM SCHMNY ;DO FULL SCHEDULE TO DELIVER THE INTERRUPT + JRST SCHED2 + +CLB1XA: MOVSI T,%SWINT .SEE INTPFL ;IF PAGE FAULT DUE TO USER TRYING TO + TDNN T,USWST(U) ;INTERRUPT, BETTER SCHED SO HE GETS THE INT. + SKIPE FLSINS(U) ;ELSE PROCEED THE USER IF HE HAS GOT WHAT HE WANTED. + JRST SCHED2 ;OR IF HE'S WAITING, GO SCHEDULE. + JRST CLKB5 + +IFN KA10P,[ ;NULL JOB LOST +CNLJL: CONSZ 230220 ;SKIP ON JUST "ADDR BREAK" (QUANTUM OVERFLOW) + BUG PAUSE,[KA: APR ERROR IN NULL JOB] + CONO 470000+APRCHN + JRST SCHED + +CFHFPF: BUG PAUSE,[PAGE FAULT IN SYSTEM, PC=],OCT,CLKBRK,[PAGE=],OCT,E + MOVSI D,1770 ;FALSE PAGE FAULT + MOVEI A,0 + JRST CFH6 +] ;KA10P + +EBLK +RINT: 0 +BBLK + CONI RINTAP ;SAVE STATUS IN CASE SOMEONE DUMPS IT + CONI PI,RINTPI + BUG AWFUL,[RANDOM INTERRUPT, APR ],OCT,RINTAP,[PI ],OCT,RINTPI + JRST 12,@RINT ;YOU CAN TRY PROCEEDING + +EBLK +RINTAP: 0 ;APR STATUS AT RINT +RINTPI: 0 ;PI STATUS AT RINT + +IFN KS10P,[ ; On KS, all random interrupts are created equal. +BBLK +RINT1==:RINT +] ;IFN KS10P + +IFE KS10P,[ +R1NTAC: BLOCK 20 +RINT1: 0 +BBLK + MOVEM 17,R1NTAC+17 + MOVEI 17,R1NTAC + BLT 17,R1NTAC+16 + MOVEI J,1 + JSP E,SPUR + MOVSI 17,R1NTAC + BLT 17,17 + JRST 12,@RINT1 +] ;IFE KS10P + +IFE KS10P,[ ;KS10 HAS NO MAR + +PCMARB: +IFN KA10P,[ + HLLZ B,UPOPC(U) ;FLAGS + LSH B,5 + HRR B,UPOPC(U) ;PC + MOVE T,B + XOR T,CLKBRK ;DID PC CHANGE FROM START OF INST TO PLACE TRAPPED? + TDNE T,[#<%PCFPD,,>] + TLO B,(@) ;YES, INSTRUCTION COMPLETED, FLAG FOR USER +] ;KA10P ;LOSES FOR JSR .-1 WITH MAR AT .-1, BUT OTHERWISE OK +IFN KL10P,[ + MOVE B,CLKBRK ;PC OF FAULTING INST IF USER, OR IOADCR IF EXEC +; MOVEM B,UPOPC(U) ;SOLELY FOR .OPC USER VAR +;NOTE- ON KL10 THE INSTRUCTION IS NEVER COMPLETED, DON'T SET 3.5 +] ;KL10P + TLNE B,%PCUSR + JRST PCMAR1 ;USR MODE, USE PC FROM PAGER + MOVE B,UUOH ;EXEC MODE, USE USER PC (UUO) + HRRI B,-1(B) +IFN KL10P,[ ;ON KL10 AVOID DOING AOS UUOH AT IOADCR + MOVEM U,AC0S+U(U) + MOVEI T,UUOER2 + MOVEM T,CLKBRK +];KL10P +PCMAR1: MOVEM B,UMARPC(U) + TRO A,%PIMAR + MOVEI B,0 +IFN KA10P, DPB B,[220300,,UPMAR(U)] ;DISABLE MAR +IFN KL10P, DPB B,[270400,,UPMAR(U)] ;DISABLE MAR + POPJ P, + +] ;IFE KS10P + +IFN KA10P,[ +CPROC1: MOVE T,CLKBRK + TLNN T,%PCUSR ;SKIP IF FROM USER MODE + JRST CPRUUO + TRO A,%PI1PR ;GIVE USER INTERRUPT + POPJ P, + +CPRUUO: MOVE T,[JRST ONEPROC] ;ONE PROCEED INT. FROM EXEC. MODE + MOVEM T,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + POPJ P, + +AROV: TLZE T,400000 + TLNN T,%PCUSR + JRST AROV2 ;NOT REALLY SET OR SET BY SYS + MOVEM T,CLKBRK + SKIPE PICLR(U) ;SKIP IF INTERRUPTS TO USER NOT ENABLED + TRO A,%PIARO ;GIVE USER INTERRUPT + POPJ P, + +AROV2: MOVEM T,CLKBRK + POPJ P, + +ARFOV: TLZE T,40000 + TLNN T,%PCUSR + JRST AROV2 + MOVEM T,CLKBRK + SKIPE PICLR(U) + TLO A,(%PIFOV) + POPJ P, +] ;KA10P + +;;; HANDLE PARITY ERRORS. + +CLKB1E: SETZM PARDIE ;AT FIRST ASSUME THE PAR ERR ISN'T FATAL. + CONO PI,PIOFF ;TURN OFF WORLD +IFN KA10P, CONO PI,240000 ;RESET +IFN KL10P,[ ;CLEAR THE CACHE + SWPUA + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + CLRCSH ;Clear the cache +] ;KS10P + MOVSI B,SCLPAR + TDNE B,SUPCOR ;IF PREV ERROR NOT PRINTED, PRINT IT NOW AND PAUSE + BUG PAUSE,[TOO MANY PARITY ERRORS. PREV STATUS=],DEC,PARCNT,OCT,PARAAN,OCT,PARAOR,OCT,PARAND,OCT,PARIOR + IORM B,SUPCOR ;TELL SYS JOB TO PRINT OUR DATA WHEN WE FINISH. + AOS PARERR ;COUNT # OF PAR ERRS SINCE SYSTEM STARTED. + SETOM PARAND ;INIT LOGAND AND LOGOR OF ALL BAD DATA WORDS + SETZM PARIOR + SETOM PARAAN ;AND SIMILAR FOR ADDRESSES OF PAR ERRS. + SETZM PARAOR + MOVE T,CLKBRK + MOVEM T,PARPC + MOVE T,USER + MOVEM T,PARUSR ;REMEMBER WHICH JOB GOT THE PAR ERR. + JUMPL T,PARSCJ ;PAR ERR IN NULL JOB? OR WHAT? +IFN KL10P,[ + SKIPE PARRSN ;PAR ERR IN WORD NOT REFERENCED + JRST PARSCJ ; SHOULDN'T SCREW THE RUNNING JOB +] ;KL10P + CAIG T,LUBLK + SETOM PARDIE ;PAR ERR IN A SUPERVISOR-MODE JOB IS HOPELESS. + MOVSI TT,(%PIPAR) + IORM TT,PIRQC(T) ;GIVE RUNNING USER A PARITY ERROR (CLASS 1 INT) +PARSCJ: SPM PARPG +IFN KL10P,[ + PUSH P,PFNPC ;MAKE SURE THE PAR ERRS WE DETECT WHILE SCANNING DON'T + MOVEI D,PARFX4 ;CALL US RECURSIVELY (ON KA, THAT'S DONE BY HAVING + MOVEM D,PFNPC ;CLKCHN OFF) +] ;KL10P +IFN KS10P,[ + PUSH P,EPTP7N ;Same hack for the KS except page fails trap + MOVEI D,PARFX4 ;as a function of current PI level. + MOVEM D,EPTP7N +] ;KS10P + MOVEI D,0 ;POINTER TO ERROR BUFFER + MOVSI TT,-TSYSM + PUSHJ P,PARSCN ;SCAN MAIN MEM BLOCKS +IFN PDP6P,[ + MOVE TT,[-LPDP6M,,PDP6BM_-10.] ;SCAN PDP6 MEM FOR PARITY ERRORS + SKIPGE PDP6UP ;BUT NOT IF PDP6 IS DOWN. + PUSHJ P,PARSCN +] +IFN KL10P,[ + POP P,PFNPC + CONO 024400+APRCHN ;CLEAR PAR ERR FLAGS. +] ;KL10P +IFN KS10P,[ + POP P,EPTP7N + CONO 020200+APRCHN ;CLEAR FLAG + MOVSI A,%KEHLD+%KEREF ;CLEAR STATUS AND ERROR ADDR + IOWR A,[KSECCS] +] ;KS10P + MOVEI A,0 + DPB A,[.PAREP+EXEUMP] + LPMR PARPG ;SET UP MAP WITH PARPG SET TO MPV. + MOVEM D,PARCNT ;SAVE AWAY COUNT OF ERRORS IN BUFFER + SKIPE PARDIE + BUG HALT,[PARITY ERROR IN SYSTEM MEMORY. CNT=],DEC,PARCNT,[ADR AND ],OCT,PARAAN,CR,0,[ ADR IOR ],OCT,PARAOR,[DATA AND ],OCT,PARAND,[DATA IOR ],OCT,PARIOR + ;FATAL ERROR (DONT ALLOW CONTINUE SINCE ERR IS + ;KNOWN TO BE A LOSER) + CONO PI,PION ;TURN WORLD BACK ON + JRST SCHED + +PARSCN: +PARFX3: HRRZ T,TT ;SCAN AOBJN POINTER IN TT + CAIL T,TSYSM + JRST PARFX7 + LDB T,[MUR,,MEMBLT(TT)] + CAIN T,MUHOLE + JRST PARFX8 ;HOLE THERE +PARFX7: MOVEI T,600000(TT) ;NOTE THAT WE ARE NOT ENABLING THE CACHE. + DPB T,[.PAREP+EXEUMP] ;ON KL10 THIS WILL CAUSE A 1-WORD READ. + LPMR PARPG ;SET UP TO CHECK PAGE # IN TT + MOVEI B,0 ;ADDRESS WITHIN PAGE +PARFX1: +IFN KA10P, CONO PI,200000 ;CLEAR PAR ERR +PARFX5: MOVE C,400000+PAREP*2000(B) ;REFERENCE EVERY MEMORY LOCATION +IFN KA10P,[ + ;;ON KA, MUST CHECK EXPLICITLY. + ;;ON KL AND KS, PAR ERR WILL TRAP RIGHT TO PARFX4. + CONSZ PI,200000 ;PARITY ERR? + JRST PARFX4 ;YES. +] ;KA10P + CAIGE B,1777 ;SKIP ON FINISHED WITH BLOCK + AOJA B,PARFX5 +PARFX8: AOBJN TT,PARFX3 ;CHECK NEXT PAGE + POPJ P, ;DONE + +PARFX4: ;HERE WHEN THE SCAN FINDS A WORD WITH BAD PARITY +IFN KL10P, HRRZ T,PFOPC +IFN KS10P, HRRZ T,EPTP7O +IFE KA10P,[ + ;;DID THIS TRAP COME FROM SCAN LOOP WHERE WE EXPECT THEM? + CAIE T,PARFX5 + JRST 4,. + AC7CTX + UMOVE C,0 ;GET CONTENTS OF LOCATION WITH BAD PARITY + SYSCTX +] ;IFE KA10P + SETO T, ;MAKE SURE T ISN'T ACCIDENTALLY 0 AT PARFX6. + HRRZ E,TT + LSH E,10. + IOR E,B ;MAKE MEM ADR + CAIGE E,20 ;PAR ERR IN SHADOW ACS ISN'T SERIOUS. + JRST PARFX6 + ANDM E,PARAAN ;UPDATE ANDS AND ORS OF DATA AND ADRS + IORM E,PARAOR + ANDM C,PARAND + IORM C,PARIOR + MOVE A,USRHI + CAIGE E,USRSTG(A) + SETOM PARDIE ;PARITY ERROR IN EXEC CORE + HRRZ T,TT + CAIL T,TSYSM + JRST PARFX6 + LDB T,[MUR,,MEMBLT(TT)] + CAIE T,MUFR + CAIN T,MUINP + JRST PARFX6 + CAIE T,MUDISB + CAIN T,MUFRT + JRST PARFX6 + CAIN T,MUDDT + JRST PARFX6 + SOJE T,PARFX6 ;USER + SETOM PARDIE ;ERR IN CRITICAL MEMORY (DISK DIR, ETC) +PARFX6: MOVEM C,400000+PAREP*2000(B) ;FIX UP MEMORY AS BEST WE CAN + MOVEM C,PARCON(D) ;SAVE LOSING CONTENTS + MOVEM E,PARADR(D) ;SAVE LOSING ADDRESS + CAIL D,MXPARS-1 ;OVERFLOWING BUFFER? + SOS D ;JUST DON'T CLOBBER STUFF. AT LEAST PARAND, ETC. WILL BE VALID. + JUMPN T,PARFX9 + PUSH P,D ;PAR. ERR IN USER MEMORY, + HRRZ D,TT + CAIL D,TSYSM + JRST PARFXA + PUSHJ P,UCPRL4 ;HAS ANY JOB WRITTEN IN THIS PAGE? + 400000,,PARFU1 + JUMPL D,PARFXB ;SOMEONE HAS; JUST GIVE EVERYONE AN INTERRUPT. + PUSHJ P,UCPRL4 ;DOES MMP SAY PAGE WAS WRITTEN? IF SO, SET SIGN(D); + 200000,,PARFU2 ;OTHERWISE, SET MMPBAD, CAUSING PAGE TO BE RELOADED FROM DISK. + JUMPGE D,PARFXA +PARFXB: PUSHJ P,UCPRL4 ;PAGE HAS BEEN WRITTEN SINCE LAST ON DISK, SO WE CAN'T ESCAPE + 400000,,PARFU3 ;GIVING EVERY JOB AN INTERRUPT. +PARFXA: POP P,D +PARFX9: AOS B ;INCREMENT B HERE SO YOU DON'T HACK THE SAME + ; WORD AGAIN. IF THAT WORD WAS SOLIDLY BAD, + ; THIS CODE WOULD LOOP + CAIG B,1777 ;MIGHT BE DONE WITH PAGE + AOJA D,PARFX1 + AOJA D,PARFX8 + +PARFU1: CAIG U,LUBLK + SETOM PARDIE ;SYS JOB OR CORE JOB HAS PAGE + PUSH P,Q + MOVE A,I ;FIND PAGE-MAP HALFWORD FOR THIS PAGE + PUSHJ P,UPLC + POP P,Q + LDB A,T + LSH A,-20 + CAIE A,1 ;MAP SET UP TO A PAGE, AND IN READ-ONLY MODE? + JRST PARFU5 + DPB A,T ;YES, UNMAP IT SO THAT NEXT ACCESS WILL TRAP AND GO TO CFHPB + SOS MMSWP(D) ; IN CASE WE WILL SET MMPBAD. + ;NOTE, THIS MAY CRASH THE SYSTEM IF THE JOB WAS RUNNING IN A UUO, + ;HAD CHECKED ACCESS TO THE PAGE, AND WAS ASSUMING IT COULD ACCESS + ;IT AGAIN SAFELY. USUALLY THIS ONLY HAPPENS WHEN WRITING, HOWEVER. +IFN SWPWSP, ;DON'T BOTHER ADJUSTING WORKING SET. WILL BE FIXED ON NEXT SWAPIN. +PARFU5: CAIL A,3 +PARFU4: TLO D,400000 ;IF THIS JOB HAS WRITTEN THE PAGE, SET SIGN (D) + POPJ P, ;TO SIGNAL THAT SETTING MMPBAD IS NO USE. + +PARFU2: MOVE T,(C) ;C HAS ADDR OF MMP ENTRY; HAS PAGE BEEN WRITTEN BY A JOB + TLNN T,MMPWRT ;THAT NO LONGER HAS IT IN MAP? + TLNN T,MMPWOD ;OR HAS IT NEVER BEEN ON DISK? + JRST PARFU4 ;IF SO, AVOID SETTING MMPBAD, AND INTERRUPT EVERYONE. + HLRZ T,1(C) + JUMPE T,PARFU4 ;DITTO IF THERE IS NO DISK SPACE ASSIGNED. + MOVSI T,MMPBAD + IORM T,(C) + POPJ P, + +PARFU3: MOVSI T,(%PIPAR) + IORM T,PIRQC(U) + POPJ P, + +MEMHNG: +IFN PDP6P,[ + LDB B,[221100,,UPJPC(U)] ;FAULT ADDR + TRZN B,400 ;SKIP IF REFERENCE WAS VIA USER MAP + JRST MEMHN1 + MOVEI C,UPGMP(U) + ROT B,-1 + ADDI C,(B) + HRLI C,PMLCAD ;POINTER TO CORE ADR FIELD OF LH PAGE IN MAP WD + SKIPGE B + HRLI C,PMRCAD ;RH MAP WD + LDB C,B ;C GETS PAGE # + CAIGE C,+LPDP6M + CAIGE C,PDP6BM_-10. + JRST MEMHN1 + MOVE B,CLKBRK + TLNE B,%PCUSR + JRST MEMHN3 ;USER MODE PDP6 NXM + MOVEI B,IOCER3 ;PDP6 MEM + HRRM B,CLKBRK + JRST MEMHN2 +] + +MEMHN1: ;NXM + ; JRST 4,.+1 ;COMMENTED OUT SINCE NXM STOP SHOULD ALWAYS BE SET. +MEMHN2: +IFN KA10P,CONO 10000+APRCHN ;CLEAR NON EX MEM AFTER HALT TO RESET MEMORY +IFN KL10P,CONO 22000+APRCHN +IFN KS10P,[ + CONO 20400+APRCHN ;Clear APR flag + MOVSI B,%KEHLD+%KEREF ;Clear saved error address + IOWR B,[KSECCS] +] ;KS10P + MOVSI B,SCLNXM + TDNE B,SUPCOR ;Haven't printed previous error? + BUG PAUSE,[TOO MANY NXM ERRORS.] + IORM B,SUPCOR + MOVE T,CLKBRK + MOVEM T,NXMPC + MOVE T,USER + MOVEM T,NXMUSR + AOS NXMERR + POPJ P, + +IFN PDP6P,[ +MEMHN3: MOVSI B,%PIMPV ;PDP6 NXM GIVE MPV INTERRUPT + IORM B,PIRQC(U) + JRST MEMHN2 +] + SUBTTL SLOW CLOCK SERVICE ROUTINE + +OVHMTR SLW ;SLOW CLOCK + +SSLCK: SKIPGE SHUTDN ;SYSTEM "DEAD" => + PUSHJ P,COFFIN ;GO TO DDT AFTER RIGOR MORTIS SETS IN. + SETCMB A,SCKPHS ;CHECK SYSTEM CHECKSUMS EVERY OTHER SLOW CLOCK TICK + MOVE T,SUPCOP ;WHICH IS ONCE PER SECOND. + SKIPE A + IORM T,SUPCOR +IFN KS10P,[ + CONSO 100 ; Check for memory ECC corrected errors + JRST SSLCK0 + IORD A,[KSECCS] ; A: status and error addr + MOVEM A,ECCERA ; Remember most recent one + AOS ECCERR ; Also count 'em + CONO 20100+APRCHN ; Clear memory ECC APR flag + MOVSI T,%KEHLD+%KEREF ; Clear status and error addr + IOWR T,[KSECCS] + MOVE T,A + AND A,ECCAND ; A: AND of previous errors + IOR T,ECCIOR ; T: IOR of previous errors + CAMN A,ECCAND ; If either changes, this is news. + CAME T,ECCIOR + BUG INFO,[MEMORY: ECC CORRECTED ERROR],OCT,ECCERA + MOVEM A,ECCAND + MOVEM T,ECCIOR +SSLCK0: ] ;IFN KS10P +IFN NETP,PUSHJ P,NETCLK ; Run 1/2 sec clock routines for various net stuff +IFN NETYS, SETOM DTECHK ;TELL 11 WE'RE ALIVE +IFN DPKPP,[ + CONSO DPK,7 + CONO DPK,TTYCHN ;CROCK - IF DPK LOSES ITS PIA, GIVE IT BACK. +] + MOVE A,UTTBF + CAIGE A,30 + JRST SSLCK2 + SETOM UTBFLF ;SIGNAL CORE JOB TO FLUSH UTAPE BUFFERS + AOS NCORRQ +SSLCK2: SKIPE UTTYCT ;SKIP IF NO NEW USERS + SKIPL TREESW ;SKIP UNLESS SOMEBODY'S MUNGING THE TREE STRUCTURE. + CAIA + PUSHJ P,USTART ;NEW USER TO START +IFN 340P,[ + SKIPL T,DWDS + MOVEI T,0 + ADDI T,MDISWD + MOVEM T,DWDS ;RESET DISPLAY RATE COUNTER +] + CONO PI,UTCOFF ;UTC OFF WHILE HACKING UTAPE, MTAPE, DISK, ETC. +IFN RH10P+RH11P,[ + SKIPLE USFHLT + SOS USFHLT +];RH10P+RH11P +IFN NUNITS,[ +IFE NEWDTP,[ + MOVE T,TIME + AOSN UIDLE ;SKIP IF DEC TAPE NOT IDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] ;DEC TAPE IDLE + SUB T,LUTOTM ;SUBTRACT LAST UTC OPERATION TIME + CONSO UTC,4000 + CAIGE T,MXOPT*SCLKI ;SKIP IF DEC TAPE HUNG TOO LONG ON ONE OPERATION + JRST SSLCK3 ;OK + SETOM UTHERR ;SET UTC HUNG ERR FLAG +SSLCK1: CONO UTC,CUINT ;CAUSE DEC TAPE INTERRUPT ROUTINE TO RUN +SSLCK3: +] +IFN NEWDTP,[ + MOVE T,TIME + AOSN UIDLE + JRST [MOVEM T,LUTOTM ? JRST SSLCK1] + SUB T,LUTOTM + CAIGE T,MXOPT*SCLKI + JRST SSLCK3 + SETOM UTHERR +SSLCK1: SETOM CUINT + CONO PI,UTCRQ +SSLCK3: +]] ;END IFN NUNITS + SKIPL QSDU ;IF DISK TRANSFER IN PROGRESS + JRST [ MOVE T,LQTM ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG ;YES, UNHANG THE DISK + JRST .+1 ] +IFN T300P,[ + SKIPL QSDU1 ;IF TRANSFER IN PROGRESS ON OTHER CONTROLLER + JRST [ MOVE T,LQTM1 ;SEE IF IT'S TAKING UNREASONABLY LONG TIME + ADDI T,5*30. + CAMGE T,TIME + PUSHJ P,QHUNG1 ;YES, UNHANG THE DISK + JRST .+1 ] +];T300P +IFN DC10P, PUSHJ P,QRCTMO ;RECALIBRATE TIMEOUT + CONO PI,UTCON + PUSHJ P,QSTRTR ;WAKE UP DISK ROUTINES +IFN NMTCS, PUSHJ P,MSTRTR ;WAKE UP MAG TAPE ROUTINES (MUST BE SEPARATE INTR) +;DROPS THROUGH + +;DROPS IN +IFG NMTYS,[ ;TRY TO UNHANG MORTON TTY CARDS + MOVE I,[-NMTYS,,NFMTY] + MOVE T,TIME + SUBI T,60. ;IF HAVEN'T TYPED FOR 2 SECONDS +SSLCM1: SKIPL TTYOAC(I) ;YET SUPPOSED TO BE TYPING + CAMGE T,TTLTM(I) + JRST SSLCM2 + CONO PI,TTYOFF-1 + CONO MTY,@TTYLT(I) ;SELECT THE LINE + DATAO MTY,[0] ;AND BANG ON IT + CONO PI,TTYON-1 ;MAYBE IF WE'RE LUCKY ITS DONE FLAG WILL COME ON +SSLCM2: AOBJN I,SSLCM1 +] ;END IFG NMTYS +IFN IMPP,[ +IFN KAIMP, CONI IMP,IMPCNI ;KEEPS HOST READY ON +IFE KSIMP,[ + ;KS doesn't drop interrupts, I hope + PUSHJ P,IMPOST ;START UP OUTPUT +] +IFN NCPP,[ + SKIPLE IMNCS + PUSHJ P,IMPCCL ;CLOSE NETWORK CHANNELS + SKIPLE IMNAS + PUSHJ P,IMPAAA ;WAKE UP STYS THAT NEED IT +];NCPP + SKIPGE IMPTCU ;IF IMP IS TRYING TO COME UP + AOSE IMPUCT ;AND UP-COMING TIMEOUT EXHAUSTED + JRST SSLCK8 + BUG INFO,[NET: TIMED OUT TRYING TO COME UP] + MOVEI A,1 ;THEN MAKE IT STAY DOWN + MOVEM A,IMPUP ;IF THIS IS ML-KA THE IMP CABLE PROBABLY BROKE AGAIN +SSLCK8: +];IMPP +IFN PDP6P,[ + SKIPL PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPTS FROM 6 +];PDP6P +IFN NETYS,[ + SKIPE DTEBBY + SOSL DTEBBT + JRST .+3 + BUG CHECK,[TTY: TIMEOUT ON OUTPUT XFER TO DTE, DTEBBY],OCT,DTEBBY + SETZM DTEBBY +];NETYS +IFN N11TYS,[ +;SEE IF THE TV PDP11 WANTS TO GO DOWN. + SKIPN TEN11F ;PROVIDED THE PDP11 IS THERE, + SKIPN TT11P ;AND WE'RE TRYING TO USE IT, + JRST SSLCK5 + LDB A,[061600,,TT11HA] ;DOES 11 WANT WHO LINES UPDATED? + CAIL A,2000*NTTPG ;RANGE CHECK SO CLOBBERED 11 MEMORY DOESN'T CAUSE ILL MEM REF + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + SKIPGE 1+400000+TTPG0*2000(A) + JRST [ MOVEI T,SCRWHO ;YES + IORM T,SUPCOR + CLEARM 1+400000+TTPG0*2000(A) + JRST .+1] + SKIPE TT11DN ;IF IT IS REQUESTING TO GO DOWN, + JRST SSLCK5 + SETZM TT11P ;DON'T USE IT & WAIT FOR IT TO RE-INIT, + MOVSI T,1 + MOVEM T,TT11DN ;GIVE IT OUR PERMISSION TO GO DOWN. + MOVEI T,SCR11D ;CAUSE "11 DOWN" MESSAGE + IORM T,SUPCOR +SSLCK5: SKIPN TEN11F + SKIPG TT11P ;WAITING FOR 11 TO BE UP? + JRST SSLCK6 + SKIPN TT11UP ;SKIP ON 11 UP + JRST SSLCK6 + MOVEI T,SCR11U + IORM T,SUPCOR ;INIT THE TTYS +SSLCK6: +] + SKIPLE T,AGERTE ;IF IT'S ENABLED, AGE SOME PAGES + PUSHJ P,AGE +;DROPS THROUGH + +;DROPS IN +IFN DL10P,[ + SKIPN DL10F + JRST SSLCKA + SETOM DL10UP ;COULD ALSO CHECK WHETHER PDP11 IS INCREMENTING THIS. + DATAI DLC,A + TRNE A,20 ;SEE IF PDP11 HALTED. + JRST SSLCKA + BUG INFO,[I/O PDP11 WENT DOWN] + SETZM DL10F + MOVEI T,%TYDL + MOVSI A,-NCT + TDNE T,TTYTYP(A) + SETOM TTYOAC(A) + AOBJN A,.-2 +SSLCKA: ] + AOS QACTTM ;Bump this for benefit of QSK dir writers. + SKIPN SWPOPR ;If there is a request to swap out pages + SKIPE SOLNG ; or if there are pages now going out + JRST SSKQ2 ; do not bother with LMEMFR, warnings. + MOVN A,LMEMFR ;See how many free low-memory pages. + ADD A,MINCOR + JUMPLE A,SSRCK ;Okay + AOS NCORRQ ;Wake up core job to do some shuffling + SUB A,MEMFR + ADD A,LMEMFR ;Core wanted minus high free + SKIPLE A + ADDM A,SWPOPR ;Swap out to make room. +;Check to see if we are running out of various resources. +;RSWTIM is a timestamp of last warning, initialized by DATIM6 and PDDCHK. +SSRCK: MOVE A,RSWTIM ;Get time we last checked. + ADDI A,2*30. + CAML A,TIMOFF ;If we checked less then 30 secs ago + JRST SSKQ2 ; don't deluge the console. + MOVE A,TIMOFF ;Else remember that we are cheking now. + MOVEM A,RSWTIM + MOVEI A,5 ;There should be at least 5 free low pages. + CAMLE A,LMEMFR ;If there are not, print warning. + BUG INFO,[Warning: Just ],DEC,LMEMFR,[ free pages in low core.] + SKIPN QFCHN ;Check disk channels. + BUG INFO,[Warning: No free qsk channels.] + MOVN A,USRHI ;Check job slots. + IDIVI A,LUBLK + ADDI A,MAXJ + SKIPN A + BUG INFO,[Warning: System full - no job slots.] +SSKQ2: +IFN 340P,[ + SKIPL DISUSR + PUSHJ P,DISCHK ;CHECK FOR 340 DEATH +] + PUSHJ P,PDCCHK ;CHECK ON REAL-TIME HACKS +IFN PTRP,[ + PUSHJ P,PTRCHK ;CHECK ON PAPER TAPE READER + PUSHJ P,PTPCHK ;CHECK ON PAPER TAPE PUNCH +] ;PTRP +IFE KS10P,[ ; Silly KS10 doesn't have devices... + SKIPN CCSDEV + JRST SCDCK3 + SETZM CCSDEV + MOVSI I,-128. +SCDCK1: SKIPGE A,DCHNTC(I) + TLNE A,300000 + JRST SCDCK2 + AOS CCSDEV + SUB A,[1,,] + TLNN A,777 + TLZ A,400000 + MOVEM A,DCHNTC(I) +SCDCK2: AOBJN I,SCDCK1 +SCDCK3:; JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES +] ;IFE KS10P +IFN NLPTP,[ + CONO PI,LPTOFF + MOVE A,NLPTBR ;IF LPT OUTPUT BUFFER NOT EMPTY + CAIN A,LPTBSZ + JRST [ CONSZ NLPT,100 ;AND LPT IS READY + CONSZ NLPT,7 ;BUT HAS NO PIA + JRST .+1 + CONO NLPT,LPTCHN ;THEN IT LOST AGAIN + AOS NTNLPL ;COUNT NUMBER OF TIMES NEW LPT LOST + JRST .+1 ] + CONO PI,LPTON +] +IFN ECCMEM,[ +;THIS ASSUMES THAT THE PDP-10/XBUS ADDRESS OFFSET IS ZERO +ECCLOG: MOVE B,400000+ECCPG*2000+1760 + LSH B,-32. + CAMN B,ECCIDX ;DID ECC HISTORY POINTER ADVANCE? + JRST ECCLG9 + AOS A,ECCIDX ;YES, GET NEXT WORD FROM ECC HISTORY + MOVE B,400000+ECCPG*2000+1760-1(A) + ANDI A,17 ;ADVANCE OUR COPY OF POINTER + MOVEM A,ECCIDX + LDB A,[240700,,B] ;SYNDROME BITS + TLZ B,777774 ;REDUCE B TO ADDRESS BITS + BUG INFO,[MEM: ECC ERROR, ADDRESS ],OCT,B,[SYNDROME],OCT,A + JRST ECCLOG ;LOOK FOR MORE HISTORY + +ECCLG9: +];ECCMEM + PUSHJ P,GPDTIM ;WHAT CALENDAR TIME IS IT? + SETOB A,LPDTIM + EXCH A,LPDTIM ;REMEMBER IT FOR NEXT CLOCK TICK. + JUMPL A,ALCR0 ;TIME NOT KNOWN THIS AND/OR LAST TICK => DO NOTHING + SUB A,LPDTIM ;ELSE HOW LONG HAS IT BEEN SINCE PREVIOUS TICK? + CAML A,[-5*PDUPS] ;MORE THAN 5 SECONDS? SHOULD ONLY BE 1/60 + JRST ALCR0 ;ONLY EXPLANATION IS ITS WAS STOPPED AND CONTINUED. + SKIPL SYSDBG ;SO UNLESS THAT'S NORMALLY EXPECTED + PUSHJ P,DEATHM ;TELL THE WORLD "ITS REVIVED" + MOVE T,TIME ;REMEMBER WHEN THIS LAST HAPPENED + MOVEM T,RVVTIM + +;DROPS THROUGH + +;DROPS IN +;DECAY VARIOUS EXPONENTIAL AVERAGES. ON KA10, RUN IN ACS SINCE IT'S FASTER. +;ON KL10, DON'T, SINCE IT'S SLOWER. ON KS10, DON'T, BECAUSE IT IS +;JUST AS FAST TO RUN IN THE ACS BUT IT WASTES TIME TO MOVE THE CODE +;INTO THEM. +ALCR0: MOVSI U,-NCT + SETZM SLOADU +IFN KA10P,[ + MOVE I,[ALCR1,,A] + BLT I,I + JRST A +] ;KA10P + +ALCR1: MOVN T,USRRCE(U) ;A ;DECAY USRRCE AVERAGES + ASH T,-4 ;B + ADDB T,USRRCE(U) ;C + CAMLE T,SLOADU ;D ;AND SET SLOADU TO HIGHEST USRRCE + MOVEM T,SLOADU ;E +IFN KA10P,[ + AOBJN U,A ;TT + JRST .+1 ;I +] ;KA10P +IFE KA10P, AOBJN U,ALCR1 + + MOVN T,USRRCE+NCT + ASH T,-4-2 ;DISOWNED JOBS (DECAY SLOWER) + ADDB T,USRRCE+NCT + IMULI T,1999. ;MAKE COMMENSURATE WITH REGULAR USRRCE'S + ASH T,-13. ; (You might think that you could just + ; divide by 4, but in fact the ratio + ; between the two decay rates is + ; ln(64/63)/ln(16/15) = .24401474) + ADDM T,SLOADU ;DISOWNED TIME COULD HAVE BEEN USED BY REAL + ; USERS + MOVN T,USRRCE+NCT+1 + ASH T,-4+1 ;SYS, CORE, AND SOME DAEMON JOBS (DECAY FASTER) + ADDM T,USRRCE+NCT+1 + IRPS RCE,,LOSRCE IDLRCE + MOVN T,RCE ;LOST TIME AND IDLE TIME + ASH T,-4 + ADDB T,RCE + TERMIN + ADDM T,SLOADU ;IDLE TIME COULD HAVE BEEN USED BY USERS + +IFE KS10P, MOVE A,[193682794.] ; = 100. * 250000. * .5 / ln(16/15) + ; (100% of 250000. four usec ticks per second, + ; decaying by 16/15 every .5 second.) +IFN KS10P, MOVE A,[198524864.] ; = 100. * 256250. * .5 / ln(16/15) + ; (256250. 3.9 usec ticks per second.) +; Used to be: +; MOVE A,[100.*15.*125000.] ;100% DIVIDED BY MAXIMUM SINGLE TREE % + ADD A,LOSRCE ;WITH FUDGE FACTOR FOR LOST TIME + IDIVM A,SLOADU ;GIVES EFFECTIVE # OF COMPETITORS FOR MACHINE. +; It is possible for SLOADU to drop below 100. (giving a fair share greater +; than 100%). This happens because the decay rate for disowned jobs is +; less than the decay rate for consoles. If the load switches abruptly +; from the disowned jobs to some console, the resource word for the console +; fills up quicker than the disowned resource word decays, causing their +; sum to briefly exceed the maximum. This would be hard to fix without +; introducing additional resource words just for better maintaining SLOADU. +; +; An additional odd effect: If only disowned jobs are running, and a +; network server starts up, the fair share drops almost to zero. This is +; because when such jobs are created, their resource word is zeroed to +; given them an initial priority boost. + + MOVEI T,0 +IFN KA10P,[ + MOVE W,[ALCR4,,A] + BLT W,W + JRST A +] ;KA10P + +ALCR4: MOVN H,JTMU(T) ;A + ASH H,-4 + ADDM H,JTMU(T) + MOVE H,MSKST(T) + ANDI H,%PICLK ;E + SKIPE UNAME(T) ;TT + IORM H,PIRQC(T);I + ADDI T,LUBLK ;Q + CAMGE T,USRHI ;J +IFN KA10P,[ + JRST A ;R + JRST .+1 ;W +] ;KA10P +IFE KA10P, JRST ALCR4 +;DROPS THROUGH + ;DROPS IN +IFN SWPWSP,[ + MOVE U,USRHI + SUBI U,LUBLK ;ACCOUNT FOR I/O WAIT TIME IN USWPRI + MOVSI T,%SWOUT+%SWPGW +IFN KA10P,[ + MOVE J,[ALCR5,,A] + BLT J,J + JRST A +] ;KA10P +ALCR5: SKIPE UNAME(U) ;A ;IGNORE JOBS WHICH DON'T EXIST OR + TDNE T,USWST(U) ;B ;ARE SWAPPED-OUT OR IN PAGE-WAIT +IFN KA10P, JRST I ;C +IFE KA10P, JRST ALCR6 + SKIPN USTP(U) ;D ;CHARGE JOBS WHICH ARE STOPPED + SKIPE FLSINS(U) ;E ;OR BLOCKED + JRST ALCR7 ;TT +ALCR6: SUBI U,LUBLK ;I ;NEXT JOB +IFN KA10P,[ + JUMPG U,A ;Q + JRST .+1 ;J +] ;KA10P +IFE KA10P, JUMPG U,ALCR5 +];SWPWSP + SKIPGE 37 ;CHECK FOR PLANNED SYSTEM DEATH + PUSHJ P,DEATH ;ABOUT TO START DYING + JFCL + IRPS 4US,,[IDLTM1 LOSTM1 USRTM1 NULTM1]SEC,,[IDLTIM LOSTIM USRTIM NULTM3] + MOVE A,4US ;KEEP SYSTEM WIDE USAGES AS TWO WORDS + IDIVI A,250000. ;ONE IN 4.069 USEC UNITS + ADDM A,SEC ;AND ONE IN SECONDS + MOVEM B,4US ;SO NO OVERFLOW + TERMIN + IMULI A,60. ;CONVERT TO 60THS + ADDM A,NULTIM ;ADD TO 60THS USED (OBSOLETE) + MOVEI T,SCLKI + MOVEI C,SSLCKB + JRST CLQREE ;RE-ENTER RQ FOR SLOW CLOCK BREAK + +IFN SWPWSP,[ ;JOB IN U NEEDS TO BE CHARGED FOR MEMORY USED WHILE BLOCKED OR STOPPED +ALCR7: HLLO W,UWRKST(U) + JFFO W,.+1 ;H GETS 19 - LOG(WORKING SET SIZE + 1/2) + SUBI H,19. + IMUL H,[-125000.] ;CHARGE FOR 1/2 SECOND OF MEMORY USAGE + ADDM H,USWPRI(U) +IFN KA10P, JRST I +IFE KA10P, JRST ALCR6 +];SWPWSP + +;SYSTEM IN FINAL THROES OF COMING DOWN, SEE IF IT'S OVER YET + +COFFIN: MOVE T,NLOOSP ;MUST SWAP OUT ALL LOOSE PAGES + ADDB T,SWPOPR + JUMPN T,CPOPJ ;SWAPPAGE OUT STILL GOING ON + MOVEI T,NQCHN+1+NQS-1 + SKIPGE QSGL(T) + SOJG T,.-1 + SKIPL QSGL(T) ;NOT OVER IF ANY DISK CHANNELS ARE ACTIVE + POPJ P, + MOVSI T,040000 + MOVE TT,QACTB ;SEE IF DISK STUFF NOT OUT YET + TDNE TT,QMDRO + POPJ P, ;MFD NOT OUT + MOVSI A,-NQS +COFFI8: TDNE T,QTUTO(A) + JRST COFFI9 ;TUT NEVER CAME IN + TDNE TT,QTUTO(A) + POPJ P, ;TUT NOT OUT +COFFI9: AOBJN A,COFFI8 + MOVSI A,-QNUD +COFFI1: SKIPN QSNUD(A) + JRST COFFI2 + TDNE TT,QSNLCN(A) + POPJ P, ;UFD NOT WRITTEN +COFFI2: AOBJN A,COFFI1 + +IFN NUNITS,[ + MOVSI A,-NUNITS + SKIPGE UFLAPF(A) + POPJ P, ;TAPE STILL FLAPPING + AOBJN A,.-2 +] + MOVE A,DTHTIM + ADDI A,15.*30. ;DON'T WAIT FOR CONSOLES MORE THAN 15 SECONDS + CAMGE A,TIME ;BECAUSE %TCHNG ISN'T NECESSARILY SET + JRST COFFI3 + MOVEI A,NFSTTY-1 ;CHECK FOR REAL CONSOLES STILL TYPING OUT + MOVSI T,%TCHNG ;AND NOT HUNG (NEVER GOING TO FINISH TYPING OUT) + TDNN T,TTYCOM(A) + SKIPGE TTYOAC(A) + SOJGE A,.-2 + JUMPGE A,CPOPJ ;A CONSOLE IS STILL TYPING, DON'T GO DOWN YET +COFFI3: SKIPL A,SYSCN + SKIPGE TTYOAC(A) + CAIA + POPJ P, ;SYSTEM CONSOLE HAS A LOT OF TYPING TO DO + MOVEI A,2*LUBLK +COFFI7: CAML A,USRHI + JRST COFFI4 + SKIPE UNAME(A) + POPJ P, ;JOBS STILL EXIST + ADDI A,LUBLK + JRST COFFI7 + +;SYSTEM FULLY DOWN; GO TO DDT. +COFFI4: BUG DDT,[SHUTDOWN COMPLETE] + SETZM SHUTDN ;IF USER PROCEEDS, BRING SYSTEM BACK UP + SETZM DEDTIM ;ARRANGE TO RELOAD ATSIGN DRAGON + SETZM FLSINS ;BY RESTARTING SYS JOB WHERE IT DOES THAT + MOVEI A,ISYS + MOVEM A,UPC + POPJ P, + +;ROUTINE TO AGE SOME PAGES. THIS ROUTINE SLOWLY CIRCULATES THROUGH +;CORE. IF IT TOUCHES A PAGE TWICE, AND NO USER HAS TOUCHED IT, +;THE PAGE GETS SWAPPED OUT. ALSO FLUSHES PAGES NOT IN ANY USER'S MAP. +;ENTER WITH VALUE OF AGERTE IN T. + +AGE: MOVE TT,MEMFR + CAIL TT,100 + POPJ P, ;NO MEMORY COMPETITION, DON'T BOTHER + ADD T,AGEREQ ;INCREASE NUMBER OF PAGES NEEDING TO BE AGED + CAIGE T,100 ; BUT DON'T LET IT GET INFINITELY HUGE + MOVEM T,AGEREQ ; IF CIRPSW IS LOCKED FOR A LONG TIME + SKIPN DLSRCH ;IF MUSTN'T PCLSR ANYONE, OR + SKIPL CIRPSW ; IF CIRPSW LOCKED, HAVE TO WAIT UNTIL NEXT SLOW CLOCK + POPJ P, + LDB W,[121000,,HUSRAD] ;DON'T AGE SYSTEM JOB (CIRC PNTRS NOT CONNECTED) + MOVE A,AGEPOS ;CONTINUE AGEING FROM WHERE LEFT OFF LAST TIME + SKIPGE U,USER ;CHECK FOR NULJOB + JRST AGE0 + MOVE T,CLKBRK ;PC FOR USER WHO MAY GET PCLSR'D + MOVEM T,UPC(U) .SEE SWOP2 + LPMR UPGML(U) ;DON'T LEAVE SWAPPED OUT PAGES IN ASSOC MEM +AGE0: CAIGE A,TSYSM + CAMGE A,W + MOVE A,W + SOSGE AGEREQ + JRST [ MOVEM A,AGEPOS ? SETZM AGEREQ ? POPJ P, ] + AOS NAGES + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MURUSR + AOJA A,AGE0 + MOVE D,A + PUSHJ P,UCPRL4 + SETZ AGE1 + MOVNI C,1 ;NO USERS ACTIVELY USING THIS PAGE, SWAP IT OUT + PUSHJ P,SWPOPG + JFCL + AOJA A,AGE0 + +AGE1: MOVEI C,UPGMP(U) + MOVE T,I ;DON'T CLOBBER I + ROT T,-1 + ADD C,T + HRLI C,222200 + SKIPGE T + HRLI C,2200 + LDB T,C ;GET PAGE MAP WORD + TRNN T,600000 + POPJ P, ;USER NOT CONNECTED TO THIS PAGE + TROE T,PMAGEM + POPJ P, ;HASN'T TOUCHED THIS PAGE SINCE AGE BITS LAST SET + DPB T,C ;HAS TOUCHED PAGE, TURN AGE BITS BACK ON + SUB P,[4,,4] ;AND BACK OUT OF UCPRL + AOJA A,AGE0 + +IFN 340P,[ + +DISCHK: SKIPGE DISOFF + POPJ P, + AOSLE DISDIE + SKIPGE CDISOFF + POPJ P, + MOVEI T,1 + MOVEM T,DTIME +DISZAP: MOVE T,[JSR DBLKPB] + MOVEM T,40+2*DISCHN + MOVEI T,DIS300-1 ;CAUSE 340 TO STOP AND INTERRUPT SOON + MOVEM T,DBLKOP + CLEARM DISOFF + CONO DIS,5100+SDCHN_3+DISCHN + POPJ P, +] + +DEATH: SKIPL SHUTLK + POPJ P, + SETZM 37 ;CLEAR START DYING FLAG + MOVEI T,60.*5.*60. ;5 MIN + MOVEM T,DEDTIM + LSH T,-1 + ADD T,TIME + MOVEM T,SHUTDN + PUSHJ P,CLQDEL + DEDBLK +DEATHX: SKIPN T,DEDTIM + POPJ P, + AOS (P) + MOVEI TT,0 + CAIGE T,40.*60. + JRST DEATHY + MOVE TT,T + LSH TT,-2 +DEATHY: MOVEM TT,DEDTIM + SUB T,TT + PUSHJ P,CLQADD + DEDBLK +DEATHM: MOVEI A,%PIDWN + PUSHJ P,INTALL ;TELL THE WORLD + MOVSI T,SCLSHD ;CAUSE TYPE OUT ON UNLOGGED-IN CONSOLES +SUPSET: IORM T,SUPCOR + POPJ P, + +VSSLCK: MOVSI T,SCLVSK + IORM T,SUPCOR ;CAUSE VERY SLOW CLOCK TO RUN + MOVEI T,VSCLKI + MOVEI C,VSLCKB + JRST CLQREE + +IFN CCLKP,[ +RCCLK: DATAI 374,T ;HACK CHESS CLOCK + TRNE T,4000 + AOSA CCLK1 + AOS CCLK2 + MOVEI T,6 + MOVEI C,CCLKB + JRST CLQREE +] + +IFN N11TYS,[ +WHOSET: MOVEI T,SCRWHO ;CAUSE SYS TO UPDATE WHO LINES + IORM T,SUPCOR + MOVEI T,5.*60.-5 ;5 SECONDS MINUS A LITTLE SO DOESN'T SYNC WITH OTHER CLOCKS + MOVEI C,WHOCLB + JRST CLQREE +] + +SUBTTL SWAP SCHEDULER + +OVHMTR SWS ;SWAP SCHEDULER + +;15 SECOND CLOCK +15SCLK: +IFN IMPP, PUSHJ P,IMRSTO ;RESET CONTROL LINK RFNM WAIT FOR LOSING IMP. + +;RECOMPUTE SWAP BLOCK DATA. +;DECAY SWAP PRIORITIES (USWPRI AND SWRCE) +;RESET BEST-EFFORT-HAS-BEEN-MADE TO SWAP OUT BITS + + MOVSI B,%SWBEM ;SET UP TO CLEAR "BEST EFFORT TO SWAP OUT BIT" + SETOM SBEFLG ;NOT YET DESPERATE ENOUGH TO TRY USERS WHOSE BEST EFFORT BITS ARE SET +IFE SWPWSP,[ + CLEARB T,NUSWB ;# USERS LOCKED OUT + SETOM BUSR ;SMALLEST SWAPPED BLOCKED USER + MOVE D,[37777,,777777] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + CLEARM ASBUM ;REAL MEM OCC BY ACTIVE SWAPPED BLOCKED LOSERS + MOVSI D,400000 ;TO CLEAR SWAPPED BLOCKED BIT +];SWPWSP +.ELSE MOVEI T,LUBLK*2 +15S1: CAML T,USRHI + JRST 15S2 + SKIPN UNAME(T) + JRST 15S3 + MOVN C,USWPRI(T) + ASH C,-2 + ADDM C,USWPRI(T) ;DECAY JOB SWAP PRI'S + MOVE C,NMPGS(T) +IFE SWPWSP,[ + SKIPE ENPZRO + SUBI C,1 ;COMPENSATE FOR PAGE ZERO ALWAYS IN +];SWPWSP + CAMLE C,NSWPGS(T) ;SKIP ON NOT COMPLETELY OUT + ANDCAM B,USWST(T) .SEE %SWBEM +IFE SWPWSP,[ + SKIPGE USWSCD(T) + JRST 15S4 ;CLEAR SWAPPED BLOCK BIT AND MAYBE ADD TO AUSOPG AND TRUMM (IF HE WAS HUNG ON IT) +];SWPWSP +15S3: ADDI T,LUBLK + JRST 15S1 + +15S2: +IFE SWPWSP,[ + SKIPE ENSWSC + PUSHJ P,SWSCD ;SWAP BLOCK LOSERS IF NECESSARY +];SWPWSP + MOVSI T,-NCT-2 +15S5: MOVN C,SWRCE(T) ;DECAY TREE SWAP PRI'S + ASH C,-2 + ADDM C,SWRCE(T) + AOBJN T,15S5 + MOVEI T,15.*60. + MOVEI C,15SCLB + JRST CLQREE + +IFE SWPWSP,[ +15S4: ANDCAM D,USWSCD(T) ;CLEAR SWAP BLOCK BIT + SKIPN TT,FLSINS(T) ;WAS HE HUNG TESTING IT + JRST 15S3 + SUBI TT,(T) + CAME TT,[SKIPGE USWSCD] + JRST 15S3 ;HE WASN'T HUNG ON THIS + CLEARM FLSINS(T) ;HE WAS SO NOW HES ACTIVE + MOVE TT,USWST(T) + TLZE TT,%SWPGW + SOS NPGWTU ;FLSINS WAS SET BY PAGE FAULT, SO CONSIDERED + TLZ TT,%SWBEM ;TO BE WAITING FOR A PAGE + MOVEM TT,USWST(T) + MOVE TT,NMPGS(T) + ADDM TT,TRUMM ;GUY IS NOW RUNNABLE + SUB TT,NSWPGS(T) ;ANY PAGES HE MAY HAVE IN MEM NO LONGER BELONG TO A BLOCKED USER + MOVNS TT + ADDB TT,BUMPGS + SKIPGE TT + CLEARB TT,BUMPGS + MOVE TT,NSWPGS(T) ;ANY SWAPPED OUT PAGES BELONG TO AN ACTIVE USER + ADDM TT,AUSOPG + JRST 15S3 +];SWPWSP + +IFE SWPWSP,[ + +PRVCLK: SKIPN ENPVCL + JRST PRVCK4 + MOVSI B,%SWPRV + SKIPL U,PRVUSR + ANDCAM B,USWST(U) + SETOM PRVUSR ;TURN OFF CURRENT PRIVILEDGED USER + MOVEI J,2*LUBLK +PRVCK1: CAML J,USRHI + JRST PRVCK2 + SKIPN UNAME(J) + JRST PRVCK3 + MOVE B,UTRNTM(J) ;GET USER RUN TIME + SUB B,LTRNTM(J) + MOVE A,USIPRQ(J) + SUB A,LSIPRQ(J) + IMUL A,[NPVSEC*125000.] ;1/2 NUMBER OF 4 MICROSECOND INTERVALS IN THE PRIV INTERVAL + SKIPE B + IDIV A,B + MOVE B,UPGSEC(J) + LSH B,-1 ;DIVIDE LAST VALUE BY TWO + ADD A,B + MOVEM A,UPGSEC(J) ; LAST/2 + CURRENT + MOVE A,UTRNTM(J) + MOVEM A,LTRNTM(J) + MOVE A,USIPRQ(J) + MOVEM A,LSIPRQ(J) ;SAVE OLD VARIABLES +PRVCK3: ADDI J,LUBLK + JRST PRVCK1 + +PRVCK2: PUSHJ P,NPRVUS ;GET NEXT PRIV USR +PRVCK4: MOVEI T,NPVSEC*60. + MOVEI C,PRVCLB + JRST CLQREE + +NPRVUS: MOVEI J,2*LUBLK + SETOM U + MOVNI T,30.*2 ;DON'T LET A BLOCKED OR STOPPED PERSON BE PRIVILEDGED + ADD T,TIME + MOVE B,PRVCUT + HRLOI E,377777 +NPVUS1: CAML J,USRHI + JRST NPVUS2 + CAMGE T,LUBTM(J) ;BLOCKED TOO LONG? + SKIPN UNAME(J) + JRST NPVUS3 + CAMG B,UPGSEC(J) + CAMG E,LPRVTM(J) + JRST NPVUS3 + MOVE U,J + MOVE E,LPRVTM(J) +NPVUS3: ADDI J,LUBLK + JRST NPVUS1 + +NPVUS2: MOVEM U,PRVUSR + SKIPG U + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + MOVE T,TIME + MOVEM T,LPRVTM(U) + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +IFNDEF MEMSYS,MEMSYS==50 ;GUESS AT AMOUNT OF MEM SYSTEM NEEDS +IFNDEF MEMSY1,MEMSY1==50 ;AMOUNT OF MEM ANY ONE USER MUST LEAVE TO "FIT". + +SWSCD: MOVE E,TRUMM ;SEE IF NECESSARY TO SWAP BLOCK SOMEONE + CAIGE E,TSYSM-SYSB-MEMSYS + POPJ P, ;NO SHOULD FIT + MOVE E,MEMFR + SUB E,NCBCOM + ADD E,SOLNG + SUB E,SILNG + SUB E,AUSOPG + ADD E,BUMPGS ;WILL SWAP OUT BLOCKED USERS FIRST + ADD E,ASBUM + SUBI E,20 ;SLOP + JUMPGE E,CPOPJ ;SHOULD HAVE ROOM FOR EVERYBODY + MOVMM E,SWSCT1 ;SAVE # PGS REQ + MOVNI E,1 ;NEED TO GRONK USER (MAYBE) + CLEARB T,TT ;TT SWP PRI OF PROCESS + MOVEI R,0 ;R SWP PRI OF TREE +SWSCP1: CAML T,USRHI + JRST SWSCP2 + SKIPE UNAME(T) + SKIPE USTP(T) + JRST SWSCP7 + SKIPGE USWSCD(T) + JRST SWSCP7 ;GUY ALREADY LOCKED OUT + SKIPE FLSINS(T) + JRST SWSCP4 ;SEE IF REALLY BLOCKED OR JUST PAGE WAIT +SWSCP5: MOVE B,UTMPTR(T) + CAML R,SWRCE-USRRCE(B) + CAMG TT,USWPRI(T) + JRST SWSCP6 ;THIS GUY A BIGGER LOSER THAT PREV BIGGEST +SWSCP7: ADDI T,LUBLK + JRST SWSCP1 + +SWSCP6: MOVE E,T + MOVE R,SWRCE-USRRCE(B) + MOVE TT,USWPRI(T) + JRST SWSCP7 ;GUY REALLY BLOCKED + +SWSCP4: MOVE B,USWST(T) + TLNE B,%SWPGW + JRST SWSCP5 + JRST SWSCP7 + + +SWSCP2: JUMPL E,CPOPJ ;NO VICTIM + MOVE B,NMPGS(E) + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWSCP9 ;"SMALL LOSER" + SUB B,NSWPGS(E) + CAMLE B,SWSCT1 ;SKIP ON WILL STILL NEED TO BLOCK MORE LOSERS + POPJ P, +SWSCP9: MOVSI B,400000 + IORM B,USWSCD(E) ;SWAP BLOCK LOSER + AOS NUSWB + AOS NTUSB + MOVE TT,NMPGS(E) + CAMLE TT,BUSIZ + JRST SWSCP8 + MOVEM TT,BUSIZ + MOVEM E,BUSR +SWSCP8: SUB TT,NSWPGS(E) + SOSGE TT + MOVEI TT,0 + ADDM TT,ASBUM ;THIS GUY SWAPPED BLOCKED + MOVN TT,NMPGS(E) + ADDM TT,TRUMM ;DOESNT COUNT ANY MORE + SKIPGE TRUMM + CLEARM TRUMM + MOVN TT,NSWPGS(E) + ADDM TT,AUSOPG ;NOT REALLY ACTIVE ANY MORE + JRST SWSCD ;SEE IF THATS ENUF +];SWPWSP + +OVHMTR PPI ;PPIUM + +;PUT PAGE INTO USERS' MAPS (OF ALL USERS THAT ARE CONNECTED VIA CIRCULAR POINTERS) +;ALSO UPDATES THE WORKING SETS. +;CALL WITH PAGE NUMBER IN A, STARTING BYTE POINTER IN C, AND TDNE T,MMP IN D. +;SMASHES T,H,I,U,E,TT,C +PPIUM: AOS NPPIUM +IFN SWPWSP,[ + MOVEI E,0 ;COUNT USERS OF THE PAGE + PUSHJ P,UCPRL + 400000,,[AOJA E,CPOPJ] + HRRM E,MMSWP(A) ;ALL THESE SHARERS WILL BE CONNECTED TO THE PAGE + MOVSI T,1 ;COMPUTE WORKING SET ADJUSTMENT + IDIVM T,E ;I.E. 1 OVER NUMBER OF SHARERS +];SWPWSP + PUSHJ P,UCPRL ;GIVE PAGE TO ALL USERS WAITING FOR IT + 400000,,PPIUM1 + POPJ P, + +;SET UP MAP TO MEMBLT INDEX IN A +PPIUM1: AOS NPPIU1 + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB + PUSH P,I + MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + JUMPE I,[JRST 4,.] ;DOESN'T REALLY EXIST? + MOVSI T,MMPPGA ;DON'T REALLY PUT IN MAP IF PAGE-AHEAD PAGE. + TDNE T,(D) ;JUST PRE-EMPT. + JRST QSWI2A + TRNE I,600000 ;DO NOTHING IF ALREADY IN MAP. +IFE E.SP,[ + JRST QSWI2 ;ALREADY IN MAP, POSSIBLE AS A RESULT OF RIDICULOUS TIMING ERROR +] +IFN E.SP,[ + JRST E.SPGJ ; CHECK E&S WANTS READ/WRITE FIRST FIX +] + SOS NSWPGS(U) ; NUMBER OF SWAPPED-OUT PAGES + SOS SNSWPG ;DECR CNT OF SWAPPED OUT FOR SYS + SKIPN (P) ;DON'T SET UP PG 0 AS R-W-F. + JRST QSWI3 + TRNE I,2 + MOVEI I,2 ;SET READ/WRITE TO READ/WRITE/FIRST +QSWI3: LSH I,16. + IORI I,PMCSHM(A);BRING IN ADDRESS AND CACHE BITS + DPB I,C +QSWI2: +IFE SWPWSP,[ + AOS MMSWP(A) ;INCREMENT COUNT OF USERS IN RING +];SWPWSP +IFN SWPWSP,[ + ADDM E,UWRKST(U) ;ADJUST WORKING SET +];SWPWSP +QSWI2A: +IFN PAGPRE,[ +;IF THIS USER IS WAITING FOR THIS PAGE, MAKE HIM RUNNABLE BY PUTTING +;HIM ON THE SCHMNY LIST, AND PRE-EMPT THE CURRENTLY-RUNNING USER. +;THE IDEAS ARE TO START THIS USER'S NEXT PAGE READ AS SOON AS POSSIBLE, +;AND TO ELIMINATE THE SCHEDULING THAT WOULD OTHERWISE BE NECESSARY TO RUN THIS GUY. + AOS NPREE1 + CONSZ PI,200_-APRCHN ;CAN'T PREEMPT IF CLKOFF + CONSZ PI,100000_-APRCHN ;OR IN PROGRESS, BECAUSE + JRST POPIJ ;MIGHT ZERO FLSINS WHILE SCHEDULER + ;IS EXECUTING IT & SIMILAR NASTIES + AOS NPREE2 + CAME D,FLSINS(U) ;IF JOB THAT JUST GOT PAGE IS WAITING FOR IT + JRST POPIJ + AOS NPREE3 + SETZM FLSINS(U) ;THEN THAT JOB PREEMPTS CURRENT ONE + MOVSI T,%SWPGW + TDNE T,USWST(U) + SOS NPGWTU ;FLSINS WAS DUE TO PAGE FAULT (MIGHT BE IN .CALL CORBLK) + ANDCAM T,USWST(U) + HRRZ I,U + PUSHJ P,SCHSB + SETOM PREEMP + CONO PI,CLKRQ ;REQUEST INT TO SCHEDULER +];PAGPRE +IFE PAGPRE,[ + SKIPE ENPREE + CAME D,FLSINS(U) + JRST POPIJ + MOVE TT,PRVCUT + CAME U,PRVUSR + CAMLE TT,UPGSEC(U) + SETZM SCHFLG +];PAGPRE +POPIJ: POP P,I + POPJ P, + +IFN E.SP,[ +E.SPGJ: SKIPE E.SPGH ; FLAG FROM E.SPGI + CAME U,DISUSR + JRST QSWI2 ; LEAVE AS IS + TRNN I,400000 + JRST QSWI2 + MOVEI I,3 + JRST QSWI3 ; GO MAKE READ/WRITE + ; DON'T SOS NSWPGS, SINCE PAGE IS ALREADY HERE +];E.SP + +SUBTTL USER SCHEDULER + +OVHMTR SC1 ;SCHEDULER 1 - ENTRY + +IFN KL10P, IFNDEF SCCOST, SCCOST==250. ;CHARGE 1 MILLISEC FOR SCHEDULING +IFN KA10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING +IFN KS10P, IFNDEF SCCOST, SCCOST==1000. ;CHARGE 4 MILLISEC FOR SCHEDULING + +SCHED: SKIPGE U,USER + JRST SCHED9 + MOVE T,CLKBRK +IFN KS10P,[ + ;; If user is swapped out while running in the page fail code, then + ;; EPTPFO is used as the PC. Either he is on his way in, in which + ;; case he will come back when restarted, or he is on his way out, + ;; in which case this just pushes him on his way. + TLNE T,%PSUSR + JRST SCHED0 + HRRZ T,T + CAIL T,PFAIL ; First instruction inclusive + CAILE T,PFAILE ; Last instruction inclusive + SKIPA T,CLKBRK + MOVE T,EPTPFO +SCHED0: ] ;IFN KS10P + MOVEM T,UPC(U) +IFN SCHBLN,SETZM SCHMNY ;ENTERED FROM QUANTUM RUNOUT, TIME TO CHECK ALL USERS +SCHED2: ;ENTERED FROM UFLS OR PAGE FAULT, CHECK FOR AUXIL PERSON TO RUN + ;IF SCHMNY IS STILL -1 + AOS NSKED + MOVSI T,UEXIT ;GET HERE FROM CLUFLS + HRRI T,UUO(U) + BLT T,SUEXND-1(U) +IFN KL10P,[ + AC7CTX + XCTR XR,[HRRZ A,13] ;GCSTBR + XCTR XR,[HRL A,14] ;STBR + SYSCTX + MOVEM A,ULSPBR(U) + SKIPL MTRUSR ;SKIP IF PERF COUNTER AVAILABLE + JRST [ DMOVE A,MBOXCT(U) ;COMPUTE EQV CPU TIME FROM MBOX+EBOX ACCT + DSUB A,STMBOX ;AS INCREMENTAL RUNTIME + DMUL A,KLMBCC + DADD B,EBOXCT(U) + DSUB B,STEBOX + DMUL B,KLEBCC + MOVE A,D + JRST SCHD2A ] + RPERFC A + DSUB A,STPERF ;USER RUN TIME IN 80 NS UNITS LEFT 12 + DIVI A,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS IN A +SCHD2A: +] ;KL10P +IFN KS10P, LDB A,[044000,,UPQUAN(U)] ;GET TIME USED IN 3.9 USEC UNITS +IFN KA10P, LDB A,[022100,,UPQUAN(U)] ;GET TIME USED IN 4.069 USEC UNITS + ADDM A,USRTM1 ;SYSTEM TOTAL USER RUN TIME + ADDM A,UTRNTM(U) ;INCREASE RUN TIME + ADDM A,JTMU(U) ;DECREASE PROCEDURE PRIORITY + MOVEI B,SCCOST(A) ;ACCOUNT FOR OVERHEAD IN STARTING UP + ADDM B,@UTMPTR(U) ;DECREASE PROCEDURE TREE PRIORITY +IFE SWPWSP,[ + MOVE T,NMPGS(U) ;USWPRI IS PAGES IN CORE X CPU TIME + SUB T,NSWPGS(U) +];SWPWSP +IFN SWPWSP,[ + HLLO B,UWRKST(U) ;USWPRI IS LOG(WORKING SET SIZE) X (CPU TIME + IO WAIT TIME) + JFFO B,.+1 ;C GETS 19 - LOG(WORKING SET SIZE + 1/2) + MOVEI T,19. + SUB T,C +];SWPWSP + IMUL T,A + MOVE Q,UTMPTR(U) + ADDM T,USWPRI(U) ;CHARGE AGAINST SWAPPINNG PRI + ADDM T,SWRCE-USRRCE(Q) ;AND FOR TREE + MOVE B,A + LSH B,-7 ;GET RUNTIME IN 512 USEC UNITS + CAILE B,777 + MOVEI B,777 ;TO FIT IN SCHEDULER HISTORY TBL + MOVE C,USWST(U) + SKIPE FLSINS(U) + TLNN C,%SWPGW + JRST SCHED8 + TRO B,1000 ;BLOCKAGE DUE TO PAGE FAULT +IFN SWPWSP,[ + CAML A,LODQNT ;CHECK FOR LEAVING LOADING STATE +SCHED8: TLZN C,%SWLOD ;DUE TO RUNNING FOR MORE THAN LODQNT BETWEEN PAGE FAULTS + JRST .+2 ;OR DUE TO BLOCKAGE FOR REASON OTHER THAN A PAGE FAULT + PUSHJ P,LVLOA0 ;LEAVE LOADING STATE +];SWPWSP +.ELSE SCHED8: + DPB B,[311200,,@SCHHP] ;COMPLETE SCHEDULER HISTORY TBL ENTRY + SKIPL Q,RTIMER(U) ;SKIP UNLESS RUNTIME INT ACTIVE + JRST SEARRT +SCHED3: SKIPGE DLSRCH + JRST SEAREP ;DELETE SEARCH, EXIT +IFN PAGPRE,[ + SKIPE PREEMP ;PRE-EMPT? + JRST SCHEDP ;YES, AVOID DOING FULL SCHEDULE +];PAGPRE +IFN SCHBLN,[ + SKIPN SCHMNY ;IF NOT YET TIME TO DO A FULL SCHEDULE, + JRST SEARL0 +SCHED4: HLRZ U,UREALT ;THEN CHECK LIST OF JOBS SCHEDULED BEFORE + JUMPE U,SEARL0 ;ALWAYS SCHEDULE IF HIGH PRIORITY REAL TIME USER ACTIVE + PUSHJ P,SCHGB ;POP NEXT JOB OFF LIST + JUMPL U,SEARL0 ;EMPTY + PUSHJ P,SCHACK + JRST SCHED4 ;JOB CEASED TO BE RUNNABLE + AOS NSSKED ;OK, RUN THIS ONE + JRST SCHED6 +];SCHBLN + +SEARRT: SUB Q,A + MOVEM Q,RTIMER(U) + JUMPGE Q,SCHED3 + MOVSI T,(%PIRUN) ;GIVE RUNTIME INTERRUPT + IORM T,PIRQC(U) + JRST SCHED3 + ; +; HERE TO DO A FULL SCHEDULE (LOOK AT ALL JOBS) +; + +OVHMTR SC2 ;SCHEDULER 2 - SEARCH + +SEARL0: AOS NRSKED ;1 MORE REAL SCHED (ACTUALLY SEARCHES JOBS) + CLEARM TRUMM ;TOTAL RUNNABLE USER MEM + CLEARM AUSOPG ;ACTIVE USER SWAPPED OUT PAGES + CLEARM BUMPGS ;PAGES IN REAL CORE BELONGING TO BLOCKED USERS +IFE SWPWSP, CLEARM ASBUM ;PGS IN REAL MEM OCC BY SWAPPED BLOCKED LOSERS + SKIPN SWPOPB + SKIPE SWPOPR + PUSHJ P,SWPON ;SWAP OUT STUFF +IFN NSWPV,[ + SKIPGE CIRPSW + PUSHJ P,SWPPIN ;SERVICE SWAPPING REQUESTS FROM OTHER PROCESSORS (DISPLAY) +] + SETZB U,J ;JOB BEING SCHEDULED + SETZM RNABLU ;NUM RUNABLE USERS +IFN SCHBLN,[ + SETZM SCHBNJ ;GOT NO RUNNABLE JOBS YET + SETOM SCHMNY ;ALLOW ALL THE RUNNABLES WE FIND TO RUN +];SCHBLN +.ELSE SETOM I ;BEST USER SO FAR + MOVNI T,7 + MOVEM T,SCHFLG ;DONT SCHED AGAIN FOR 1/7.5 SEC + JRST SEARL1 + +;HERE IF NULL JOB HAD BEEN RUNNING + +SCHED9: AOS NNSKED ;1 MORE TIME NULL JOB WAS RUN +IFN KA10P, LDB C,[022100,,UPQUAN] ;GET TIME NULL JOB RAN IN 4.069 USEC UNITS +IFN KS10P, LDB C,[044000,,UPQUAN] ;GET TIME NULL JOB RAN IN 3.9 USEC UNITS +IFN KL10P,[ + CAMN U,MTRJOB ;IF METERING ONLY NULL JOB, STOP METERS NOW + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + REBOXC A ;COMPUTE NULL JOB'S EQUIVALENT RUNTIME IN 4 USEC UNITS + DSUB A,NULEBC + RMBOXC C + DSUB C,NULMBC + DMUL C,KLMBCC ;CONVERT MBOX COUNT TO EBOX COUNTER UNITS, + DADD A,D ;ADD TO EBOX COUNT + DMUL A,KLEBCC ;CONVERT TO 4 USEC UNITS. + SKIPGE MTRUSR + JRST [ RPERFC C ;PERFORMANCE METER AVAILABLE, USE IT INSTEAD + DSUB C,NULPRF + DIVI C,50.*4096. ;CONVERT TO 4 MICROSECOND UNITS + JRST .+1 ] +];KL10P + ADDM C,NULTM1 ;ACCUMULATE TOTAL NULL TIME IN 4 USEC UNITS + SKIPE NPGWTU ;IF SOMEONE WOULD HAVE BEEN RUNNING IF THEY + ADDM C,LOSTM1 ; WEREN'T WAITING FOR A PAGE, THIS WAS LOST TIME + SKIPN NPGWTU ;BUT OTHERWISE + ADDM C,IDLTM1 ;IT WAS COMPLETE IDLE TIME + SKIPE NPGWTU ;NOW COMPUTE % TIME IDLE AND LOST + ADDM C,LOSRCE + SKIPN NPGWTU + ADDM C,IDLRCE +IFN PAGPRE,SKIPN PREEMP ;CHECK FOR PRE-EMPT + JRST SEARL0 ;NOW GO DO A FULL SCHEDULE +IFN PAGPRE,[ +SCHEDP: SETZM PREEMP + AOS NPREEL + PUSHJ P,SCHGB ;U GETS USER TO PRE-EMPT THIS ONE (LAST INTO SCHMNY LIST) + JUMPL U,SCHDP1 ;NO ONE TO PRE-EMPT, RUN SAME USER AGAIN + PUSHJ P,SCHACK ;MAKE SURE PRE-EMPTING JOB IS RUNNABLE + JRST SCHEDP ;AFRAID NOT + AOS NPREEM ;OK, RUN THIS ONE + SKIPL I,USER + PUSHJ P,SCHSB ;PRE-EMPTED JOB IS STILL A CANDIDATE FOR RUNNING + JRST SCHED6 + +SCHDP1: SKIPGE U,USER ;TRY TO RUN SAME USER AGAIN + JRST SCHED1 ;RUN NULL JOB AGAIN + PUSHJ P,SCHACK ;MAKE SURE THIS JOB IS STILL RUNNABLE (COULD HAVE UFLSED) + JRST SEARL0 ;FOO, BETTER DO A FULL SCHEDULE + JRST SCHED6 ;OK, RUN THIS GUY +];PAGPRE + +;MAIN SEARCH LOOP, RETURN HERE TO EXAMINE NEXT PROCEDURE +SEARL: MOVEI U,LUBLK ;LENGTH OF USER VAR BLOCK + ADDB U,J ;STEP TO NEXT USER + CAML U,USRHI ;SKIP IF EXISTS + JRST SEAREN ;ALL PROCEDURES HAVE BEEN EXAMINED +SEARL1: SKIPE T,USTP(U) + JRST SEARS1 ;EMPTY OR STOPPED JOB SLOT + SKIPE A,PIRQC(U) + JRST SEAR2A ;FIRST WORD INTERRUPT PENDING +SEARL2: SKIPE B,IFPIR(U) + JRST INTWD2 ;SECOND WORD INTERRUPT PENDING +SEARL3: SKIPN FLSINS(U) + JRST SEARC ;NOT BLOCKED +SEARL4: MOVE T,EPDL2(U) + XCT FLSINS(U) ;TEST BLOCKING CONDITION (MAY SKIP ONCE OR TWICE) + JRST SEARLB ;UNRUNABLE + JRST SEARC ;LOW PRIORITY UNBLOCK + SKIPA Q,[-1] ;HIGH PRIORITY UNBLOCK + MOVEI Q,3 ;EXTRA LOW PRIORITY + JRST SEARC2 + +SEARC: SETZM Q ;SET TO NORMAL PRIORITY + PUSHJ P,UPRIVL ;COMPUTE PRIVELEGE LEVEL (MAY SKIP ONCE OR TWICE) + SOJA Q,SEARC2 ;HIGH-PRIORITY + JRST SEARC2 + SKIPGE APRC(U) + ADDI Q,2 ;DISOWNED JOB IN USER MODE +SEARC2: AOS RNABLU ;ANOTHER RUNABLE USER + MOVE T,TIME + MOVEM T,LUBTM(U) ;RECORD LAST TIME UNBLOCKED +IFE SWPWSP,[ + SKIPGE USWSCD(U) + JRST SEARC7 ;HE'S SWAPPED BLOCKED SO HE DOESNT COUNT +];SWPWSP + JUMPE U,SEARC4 ;DON'T FIGURE SYSTEM JOB. + MOVSI T,%SWDSO + ANDCAM T,USWST(U) ;RUNNABLE SO NOT DESIRED OUT + MOVE T,NMPGS(U) + ADDM T,TRUMM ;TOTAL RUNNABLE USER MEM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG ;TOTAL PAGES OF RUNNABLE USERS SWAPPED OUT +SEARC4: CAMN U,UREALT ;IF THIS IS REAL TIME USER IN HIGH PRIORITY + JRST [ MOVEI A,0 ; PHASE, SCHEDULE WITH INFINITE PRIORITY + JRST SEARP2 ] + SKIPLE T,URTIME(U) ;NON SKIP IF POSSIBLE REAL TIME BLOCK + TLNN T,1 ;SKIP IF REAL TIME BLOCK UNLESS PI IN PROGRESS + JRST SEARC6 + SKIPGE PICLR(U) ;SKIP IF PI IN PROGRESS + JRST SEARL ;REAL TIME BLOCKED +SEARC6: MOVE A,@UTMPTR(U) ;GET AMOUNT OF MACHINE TIME USED RECENTLY BY TREE PROCEDURE IS IN + LSH A,3 ;COMBINE WITH TIME FOR JUST THIS PROCEDURE + ADD A,JTMU(U) ;TO GET PRIORITY FIGURE (SMALLER NUMBER IS HIGHER PRI) + LSH A,(Q) ;ADJUST PRIORITY BY MULTIPLICATIVE FACTOR IN Q +;THE EFFECT OF THIS PRIORITY COMPUTATION IS THAT JOBS IN THE SAME TREE +;ARE COMPARED BY JTMU, WHILE JOBS IN DIFFERENT TREES ARE COMPARED MAINLY +;BY USRRCE, ALTHOUGH A MUCH SMALLER JTMU CAN OVERRIDE A SOMEWHAT LARGER +;USRRCE. THIS IS SOMEWHAT DIFFERENT THAN THE COMPUTATION THAT WAS HERE +;BEFORE MAY 1980, BUT THAT COMPUTATION'S RESULTS EVEN DEPENDED ON THE +;ORDER THAT JOBS HAPPENED TO BE INSPECTED, AND ALLOWED A TREE WITH +;A LARGE NUMBER OF RUNNING JOBS TO GET AN UNFAIR SHARE OF THE MACHINE. +SEARP2: +IFN SCHBLN, PUSHJ P,SCHSJB ;INSERT JOB INTO PRIORITY-SORTED LIST +.ELSE [ JUMPL I,SEARP5 + CAML A,U0P ;SKIP IF IS BETTER THAN BEST SO FAR + JRST SEARL +SEARP5: MOVEM U,I ;I GETS NEW BEST USER SO FAR + MOVEM A,U0P ;U0P GETS PRIORITY OF THAT USER +];SCHBLN + JRST SEARL ;TRY NEXT + +IFE SWPWSP,[ +SEARC7: MOVE T,NMPGS(U) ;RUNNABLE AND SWAPPED BLOCKED + SUB T,NSWPGS(U) + SOSL T + ADDM T,ASBUM + JRST SEARC4 +];SWPWSP + +;JOB IS NOT RUNNABLE +SEARLB: JUMPE U,SEARL ;DON'T FIGURE SYSTEM JOB + MOVE T,USWST(U) +IFE SWPWSP, SKIPL USWSCD(U) ;IF LOCKED OUT, DONT COUNT +IFN SWPWSP, TLNN T,%SWSB + TLNN T,%SWPGW + JRST SEARB1 ;NOT WAITING FOR PAGE + MOVE T,NMPGS(U) ;USER IS WAITING FOR PAGE SO COUNT FOR ACTIVE + ADDM T,TRUMM + MOVE T,NSWPGS(U) + ADDM T,AUSOPG + JRST SEARL + +SEARB1: TLNE T,%SWBEM + JRST SEARL ;HAVE MADE BEST SWAPOUT EFFORT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + SOSL T + ADDM T,BUMPGS ;REAL MEM PGS BELONGING TO BLOCKED USERS + JRST SEARL + +SEARS1: SKIPN UNAME(U) + JRST SEARL + MOVE T,USWST(U) ;GUY STOPPED, DOES HE HAVE PAGES IN REAL MEM? + TLNE T,%SWBEM + JRST SEARL ;HAVE TRIED BEST EFFORT TO SWAP OUT + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) + ADDM T,BUMPGS + JRST SEARL + +IFN SCHBLN,[ +;TEST ALL THINGS THAT MAKE A PERSON UNRUNNABLE, OR AT LEAST +;REQUIRE THE ATTENTION OF THE SCHEDULER +;SKIP-RETURN IF JOB IS RUNNABLE, BASHES T, A +SCHACK: CAMGE U,USRHI ;NON-EXISTENT + SKIPE USTP(U) ;STOPPED + POPJ P, + SKIPE T,PIRQC(U) + JRST [ TDNE T,[BADBTS] + JRST SCHACI ;NON-DEFERRABLE + SKIPN PICLR(U) + JRST .+3 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF1(U) + TDNE T,MSKST(U) + JRST SCHACI + JRST .+1 ] + SKIPE T,IFPIR(U) + JRST [ SKIPN PICLR(U) + JRST .+1 ;ALL INTERRUPTS DEFERRED + ANDCM T,IDF2(U) + TDNE T,MSKST2(U) + JRST SCHACI + JRST .+1 ] + SKIPE FLSINS(U) ;FLUSH INSTRUCTION NOT SATISFIED + JRST [ MOVE T,EPDL2(U) + XCT FLSINS(U) ;IT MAY BE SATISFIED BUT NOT CLEARED YET + POPJ P, ;STILL BLOCKED + JRST .+1 ;CAN SKIP VARIOUS RANDOM NUMBERS OF TIMES + JRST .+1 + JRST .+1 ] +SCHAC1: SKIPLE T,URTIME(U) ;REAL-TIME BLOCKED + TLNN T,1 + SKIPA + SKIPLE PICLR(U) + AOS (P) + POPJ P, + +SCHACI: MOVE T,UPC(U) ;TRYING TO INTERRUPT, NEEDS SCHEDULER + TLNN T,%PCUSR ;ATTENTION UNLESS RUNNING IN EXEC MODE + SKIPE FLSINS(U) ;IN WHICH CASE NEED TO LET IT FINISH + POPJ P, ;SO IT CAN BE PCLSRED + JRST SCHAC1 + +;PUT JOB IN U, PRIORITY IN A, INTO STACK IN PRIORITY ORDER. BASH T,TT,B. +SCHSJB: SKIPG T,SCHBNJ ;FIRST SEARCH FOR SLOT IN WHICH TO INSERT + JRST SCHSJ1 ;BUFFER NOW EMPTY, SKIP SEARCH + MOVE TT,T + CAML A,SCHBPR-1(T) + SOJG T,.-1 ;LOOP TERMINATES WITH T SLOT WHERE IT BELONGS + CAIL TT,SCHBLN + SOJA T,SCHSJ3 ;BUFFER FULL, WORK DIFFERENTLY +SCHSJ0: MOVE B,SCHBTB-1(TT) ;MOVE STUFF UP TO ADD ANOTHER ENTRY + MOVEM B,SCHBTB(TT) + MOVE B,SCHBPR-1(TT) + MOVEM B,SCHBPR(TT) + CAILE TT,1(T) + SOJA TT,SCHSJ0 +SCHSJ1: AOS SCHBNJ +SCHSJ5: MOVEM U,SCHBTB(T) + MOVEM A,SCHBPR(T) + POPJ P, + +SCHSJ3: AOS NSCHOV ;BUFFER NOT BIG ENOUGH FOR ALL RUNNABLE JOBS + JUMPL T,CPOPJ ;THIS JOB IS LOWEST PRIORITY, FORGET IT + JUMPE T,SCHSJ5 ;THIS JOB IS SECOND-LOWEST PRIORITY, FORGET LOWEST + MOVE TT,[SCHBTB+1,,SCHBTB] + BLT TT,SCHBTB-1(T) ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE TT,[SCHBPR+1,,SCHBPR] + BLT TT,SCHBPR-1(T) + JRST SCHSJ5 + +;PUSH JOB IN I ONTO STACK OF RUNNABLE JOBS +SCHSB: AOS T,SCHBNJ + CAILE T,SCHBLN + JRST [ SOS SCHBNJ ;BUFFER OVERFLOW + AOS NSCHOV ;MOVE LOWER PRIORITY JOBS DOWN, FORGET LOWEST + MOVE T,[SCHBTB+1,,SCHBTB] + BLT T,SCHBTB+SCHBLN-2 + MOVEM I,SCHBTB+SCHBLN-1 + POPJ P, ] + MOVEM I,SCHBTB-1(T) + POPJ P, + +;POP STACK OF RUNNABLE JOBS INTO U (RETURNS -1 IF STACK EMPTY) +SCHGB: SOSL U,SCHBNJ + SKIPA U,SCHBTB(U) + SETZM SCHBNJ ;BUFFER EMPTY, U HAS -1 + POPJ P, +];SCHBLN + +.ALSKF==0 +DEFINE ALTSKP A +IFE .ALSKF,[ + DEFINE .ALSKS +A TERMIN +] +IFN .ALSKF,[ + CAME U,.ALSKS + CAMN U,A + POPJ P, +] +.ALSKF==.ALSKF#1 +TERMIN + +;DETERMINES USER PRIVILEGE LEVEL FOR SCHEDULING AND SWAPPING +UPRIVL: SKIPN RPCL(U) ;BEING RPCLSR'ED? + CAMN U,UMASTER ;MASTER? + POPJ P, ;HIGHLY PRIVILEGED + AOS (P) ;SKIP AT LEAST ONCE +IFN 340P\E.SP, ALTSKP DISUSR +IFN VIDP, ALTSKP NVDUSR +IFN TABP, ALTSKP TABUSR +IFN ARMP, ALTSKP ARMUSR +IFN LPTP, ALTSKP LPTUSR +IFG LPTP-1, ALTSKP OLPUSR +IFN PLTP, ALTSKP PLTUSR +IFN .ALSKF,[ + CAMN U,.ALSKS + POPJ P, ;DON'T FIGURE DISOWNED IF USING ABOVE DEVICES +] + MOVE T,UPC(U) + TLNE T,%PCUSR + AOS (P) ;SKIP TWICE + POPJ P, + +OVHMTR SC3 ;SCHEDULER 3 - EXIT + +;SEARCH END (EXIT) +SEAREN: +IFE SWPWSP,[ + SKIPE NUSWB + PUSHJ P,SSWC1 ;SEE IF ENUF CORE TO UNBLOCK A SWAPPED BLOCKED LOSER +];SWPWSP +IFE SCHBLN,[ + SKIPGE U,I ;SKIP IF NON-NULL JOB BEST + JRST SCHED1 + AOS NSCHDU +];SCHBLN +IFN SCHBLN,[ + MOVE T,SCHBNJ + ADDM T,NSCHDU + PUSHJ P,SCHGB ;GET HIGHEST-PRIORITY JOB + JUMPL U,SCHED1 ;NONE, RUN NULL JOB +];SCHBLN +SCHED6: SKIPE FLSINS(U) + JRST SCHED5 +SCHED1: EXCH U,USER + JUMPL U,SCHDN ;JUMP IF SWITCHING FROM NULL JOB + CAMN U,USER ;SKIP UNLESS RUNNING SAME JOB AGAIN + JRST SEAREP ;JUMP ON SAME JOB +IFN KL10P,[ + CAMN U,MTRJOB ;IF LEAVING JOB BEING METERED, STOP METER AND + WRPAE PAEOFF + CAMN U,MTRJOB + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 +] +;SWAP OUT THE OLD JOB'S CONSOLE REGISTER, AND CLEAR ITS BLINKER. +IFN N11TYS,[ + SKIPGE TT11P + SKIPE TEN11F + JRST SSTVR1 ;DONT HACK 11 + SKIPL TVCREG(U) ;DO WE WANT TO SAVE TV CONSOLE REG FOR THIS GUY? + SKIPN T,400000+TTR10*2000 ;0 IS NOT A (VERY) LEGITIMATE CONSOLE REG FCN + JRST SSTVR2 ;SO ASSUME 11 STOPPED, DONT CLOBBER PREV THING + MOVEM T,TVCREG(U) +SSTVR2: SKIPGE T,TVVBN(U) ;DID WE SET RUNNING BLINKER FOR THIS GUY? + JRST SSTVR1 ;NO + MOVEM T,400000+TTR10*2000 ;SET TO VIDEO BUFFER WE SET IT IN + MOVE A,TVBLAD ;ADDR IN VIDEO BUFFER WE FLASHED + CLEARM 400000+TTR0*2000(A) ;CLEAR IT +SSTVR1:] +IFN KA10P,[ + MOVE T,40 + MOVEM T,SV40(U) ;SAVE LAST UUO EXECUTED FOR THIS USER + MOVE T,UPC(U) ;IF USER HAS JUST TRAPPED TO 60, + TLNE T,%PCUSR + JRST SCHDN + ANDI T,-1 + CAIL T,60H0 + CAILE T,60HE + JRST SCHDN + MOVNI T,60H0-UUOH0 + ADDM T,UPC(U) ;THEN MOVE HIM INTO UUOH INSTEAD + MOVE T,60 ;AND MOVE 60H'S VARIABLES INTO UUOH'S VARS + MOVEM T,SV40(U) ;(THAT'S ALL 60H DOES ANYWAY). + MOVE T,60H + MOVEM T,SUUOH(U) +] ;KA10P +;DROPS THROUGH. + ;DROPS IN +;COME HERE TO SET UP A JOB THAT WASN'T ALREADY RUNNING. + +SCHDN: MOVE A,U + SKIPGE U,USER + JRST SCHDN2 ;JUMP IF SWITCHING TO NULL JOB +IFN KA10P,[ + MOVE T,SV40(U) ;LOAD NEW KRUFT + MOVEM T,40 +] ;KA10P +IFN N11TYS,[ + SKIPGE TT11P ;DONT HACK 11 IF ITS DOWN (MOSTLY IN CASE ITS BEING HACKED + ;HARDWARILY + SKIPE TEN11F + JRST SLTVR1 ;DONT HACK 11 + SKIPGE T,TVVBN(U) ;BLINK RUNNING FROB? + JRST SLTVR2 + MOVEM T,400000+TTR10*2000 + MOVE A,TVBLAD + MOVNI T,20 + MOVEM T,400000+TTR0*2000(A) + SKIPA T,TVVBN(U) +SLTVR2: MOVSI T,12_<8+4+16.-18.> ;ALU NOP + SKIPL TVCREG(U) + MOVE T,TVCREG(U) + MOVEM T,400000+TTR10*2000 +SLTVR1:] +IFN KL10P,[ + CAMN U,MTRJOB ;IF THIS JOB'S BEING METERED, TURN ON METER AND TIME BASE. + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 +];KL10P + SOS NRESKED ;COMPENSATE FOR EXTRA AOS ON NEXT PAGE + +;DROPS THROUGH + ;DROPS IN +;COME HERE TO START UP A JOB EVEN IF IT WAS ALREADY RUNNING BEFORE THIS SCHEDULE. + +SEAREP: AOS NRESKED +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN(U) ;RESET QUANTUM TIMER +] ;KA10P +IFN KL10P,[ + RPERFC STPERF ;SAVE PERF METERS FOR LATER USE + DMOVE A,EBOXCT(U) ;COMPUTING RUN TIME EFFECTIVELY RESETS + DMOVEM A,STEBOX ;QUANTUM TIMER + DMOVE A,MBOXCT(U) + DMOVEM A,STMBOX +] ;KL10P +IFN KS10P, SETZM UPQUAN(U) ;RESET QUANTUM TIMER + PUSHJ P,PGLDU + MOVN A,U + IDIVI A,LUBLK + SKIPE B + BUG +IFE KS10P,[ ; KS has no lights. + MOVSI B,400000 + LSH B,(A) + SKIPN MIPGDS + DATAO LIGHTS,B ;LIGHTS HAVE ONE BIT, SHOWING WHICH JOB IS RUNNING. +] ;IFE KS10P + MOVN B,A ;GET JOB'S NUMBER IN B + MOVE T,UPC(U) ;USER'S PC WORD + MOVEM T,CLKBRK + AOS A,SCHHP ;SET UP SCHEDULER HISTORY TBL + CAIL A,SCHHB+SSCHDB + MOVEI A,SCHHB + MOVEM A,SCHHP + HRRM T,(A) ;STORE PC + TLNN T,%PCUSR + TRO B,400000 + HRLM B,(A) ;STORE USER INDEX AND USER BIT + MOVSI T,UUO(U) + HRRI T,UEXIT + BLT T,UEXND-1 ;BLT IN UEXIT BLOCK +IFN KL10P,[ + MOVE T,ULSPBR(U) + AC7CTX + XCTR XW,[HRRZM T,13] ;GCSTBR + XCTR XW,[HLRZM T,14] ;STBR +] ;KL10P ;CONTEXT WILL BE RESTORED AT CLKB5 BELOW +IFN KA10P, CONO @APRC(U) + +; +; THIS IS THE ONE PLACE WHERE CLOCK LEVEL RETURNS TO THE USER JOB +; +CLKB5: +IFE KA10P, DATAO PAG,@CLCXSV ;RESTORE CONTEXT + MOVE U,USER + MOVSI U,AC0S(U) ;RESTORE AC BLOCK 0 + BLT U,U + JRST 12,@CLKBRK ;RESTORE PC, FLAGS, AND PI + +;HERE WHEN STARTING A USER WHO HAD BEEN FLSING + +SCHED5: MOVE T,USWST(U) +IFN SWPWSP,[ + TLNN T,%SWPGW ;PAGE WAITS DON'T COUNT AS BLOCKING + TLNN T,%SWOUT ;IF SWAPPED-OUT, UNBLOCKING BUMPS SWAP-IN PRIORITY + JRST SCHD5A + MOVE TT,USWPRI(U) ; (A SOMEWHAT QUESTIONABLE FEATURE) + LSH TT,-1 + MOVEM TT,USWPRI(U) +SCHD5A: +];SWPWSP + TLNE T,%SWPCL + JRST SCHED7 ;JUMP IF PAGES SWAPPED OUT WHILE BLOCKED IN EXEC MODE + TLNE T,%SWPGW + SOS NPGWTU ;NOT WAITING FOR A PAGE ANY MORE + MOVSI T,%SWPGW+%SWRUN+%SWINT ;NOT WAITING FOR PAGE,NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ;NOT WAITING FOR INTERRUPT PAGE + SETZM FLSINS(U) ;NOT WAITING FOR ANYTHING + JRST SCHED1 + +SCHED7: PUSHJ P,PCLSR ;PAGES WERE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + BUG ;SO PCLSR JOB SINCE IT MIGHT BE COUNTING ON THOSE PAGES + JRST SCHED1 ;PCLSR MUST SUCCEED. JOB WAS BLOCKED WITH EMPTY LSWPR. + + +;COME HERE TO RUN THE NULL JOB. + +SCHDN2: SKIPL A ;WERE RUNNING IT ALREADY? + AOS NNULBK ;NO, INCREMENT # CONSECUTIVE BLOCKS OF NULLTIME. + MOVSI T,(JFCL) + MOVEM T,CLUSAV ;AVOID LOSSAGE AT CLKBRK+1 NEXT CLOCK INT +IFE KA10P, MOVEM T,CLCXSV +IFE KS10P,[ ; KS has no lights. + SKIPN MIPGDS + DATAO LIGHTS,[0] ;LOAD LIGHTS WITH JOB RUNNING (NONE) +] ;IFE KS10P +IFN KA10P,[ + HRLOI T,1 + ANDCAM T,UPQUAN +] ;KA10P +IFN KL10P,[ + CAMN U,MTRJOB + WRPAE PAEON + CAMN U,MTRJOB + CONO MTR,2001 ;TIME-BASE ON, INTERVAL PIA=1 + REBOXC NULEBC + RMBOXC NULMBC + RPERFC NULPRF +] ;KL10P +IFN KS10P, SETZM UPQUAN + CLEARM SCHFLG ;RESCHEDULE ON NEXT CLK INT + LPMR UPGML + JRST 12,@[%PSPCU,,NULJOB] ;DISMISS INT AND GO TO NULL JOB + +NULJOB: MOVSI (JRST 4,) + MOVEI 17,1 ;SET ACS 0 TO 16 TO JRST 4,0 + BLT 17,16 ;TO CATCH SPURIOUS TRANFERS TO ACS + MOVE 17,[AOJA 17] ;RUNS IN ACS TO FREE MEMORY FOR OTHER PROCESSORS + JRST 2,@[%PCUSR,,17] ;RUNS IN USER MODE FOR SAKE OF RANDOMNESS + +IFE SWPWSP,[ +OVHMTR SC4 ;SCHEDULER 4 - UNSWAPBLOCKER + +;SEE IF THERE IS ENOUGH CORE TO UNBLOCK A SWAP-BLOCKED JOB. +SSWC1: SKIPGE U,BUSR + POPJ P, + MOVN T,NSWPGS(U) + ADD T,MEMFR + SUB T,NCBCOM + ADD T,SOLNG + SUB T,SILNG + SUB T,AUSOPG + ADD T,ASBUM + ADD T,BUMPGS + CAIGE T,20 + POPJ P, ;THERE ISN'T ENOUGH ROOM. + MOVSI T,400000 + ANDCAM T,USWSCD(U) ;CLEAR SWAP BLOCKED + SETOM BUSR + MOVE T,[-1_-1] + MOVEM D,BUSIZ ;SIZE OF SMALLEST SWAP-BLOCKED USER. + AOS NTSBUU + SOSN NUSWB + JRST SSWSC3 + MOVEI U,0 + MOVNI R,1 + MOVSI T,200000 +SSWSC4: CAML U,USRHI + JRST SSWSC6 + SKIPGE USWSCD(U) + SKIPN UNAME(U) + JRST SSWSC5 + CAMGE T,NMPGS(U) + JRST SSWSC5 + MOVE R,U + MOVE T,NMPGS(U) +SSWSC5: ADDI U,LUBLK + JRST SSWSC4 + +SSWSC6: MOVEM R,BUSR ;STORE NEW SMALLEST SWAPPED BLOCKED LOSER + SKIPGE R + MOVEI T,0 + MOVEM T,BUSIZ +SSWSC3: JUMPL I,SEARL0 ;MAYBE CAN RUN THIS GUY NOW + POPJ P, +];SWPWSP + +OVHMTR SWU ;SWAP USER + +;SWAP OUT N PAGES (N IS IN SWPOPR) +SWPON: MOVE C,SOLNG + SKIPGE CIRPSW ;CAN'T DO ANYTHING WITHOUT CIRPSW + CAILE C,2*NQS + POPJ P, ;ALREADY STUFF ON WAY OUT + SKIPL U,PSWOUS ;SEE IF CONTINUING TO SWAP OUT A USER + CAML U,USRHI + JRST SWPON1 + MOVE C,PSWCLS + SKIPE LSWPR(U) ;PREFER NOT TO SWAP OUT + JRST SWPON1 ;USER WHO HAS SWITCHES LOCKED + SKIPE UNAME(U) ;SKIP ON USER KILLED + SKIPL USWST(U) .SEE %SWDSO ;OR NOT DESIRED OUT ANY MORE +SWPON1: PUSHJ P,SWPON2 ;FIND NEW USER TO FLUSH + JUMPL U,SWUP8 +SWPON6: MOVSI A,%SWDSO ;THIS USER NOW DESIRED OUT + IORM A,USWST(U) + MOVEM C,PSWCLS + MOVEM U,PSWOUS + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWPU1 ;OK TO SWAP USER + SKIPN LSWPR(U) ;PCLSR IF HAS LOCKS, OR AT JBFLS, + SKIPN FLSINS(U) ;OR IF NOT BLOCKED + JRST SWPON8 + MOVSI T,%SWPCL ;OTHERWISE, DON'T PCLSR NOW, BUT + IORM T,USWST(U) ;WHEN IT UNBLOCKS + JRST SWPU1 ;AND START SWAPPING OUT ITS PAGES + +SWPON8: PUSHJ P,PCLSR ;GET OUT OF SYS BEFORE SWAPPING OUT + POPJ P, + JRST SWPU1 + +;FOUND NO USER TO SWAP OUT +SWUP8: SKIPE NLOOSP + JRST SWOL1 ;SWAP OUT SOME LOOSE PAGES + AOSE SBEFLG ;HAVE WE COME HERE TWICE? + JRST SWUP6 ;YES, GIVE UP + MOVSI B,%SWBEM ;NO, TURN OFF EVERYONE'S BEST EFFORT BIT + MOVEI J,2*LUBLK ;AND LOOK AT EVERYONE AGAIN SINCE WE'RE DESPERATE +SWUP9: CAML J,USRHI ;TO FIND A PAGE TO SWAP OUT + JRST SWUP7 + ANDCAM B,USWST(J) + ADDI J,LUBLK + JRST SWUP9 + +SWUP7: PUSHJ P,SWPON2 ;HAVING TURNED OFF %SWBEM, FIND A USER TO SWAP OUT + JUMPG U,SWPON6 ;GO SOMEONE, GO DO +SWUP6: SETZM SWPOPR ;CAN'T FIND ANYONE TO SWAP OUT, GIVE UP + SETOM PSWOUS + POPJ P, + +SWOL1: SKIPN A,FLOOSP ;SWAP OUT SOME LOOSE PAGES + BUG ;NLOOSP WAS TOO HIGH? + MOVNI C,1 + PUSHJ P,SWPOPG + BUG ;CIRPSW, EXEC PAGE COUNT ALREADY CHECKED + SETOM SBEFLG ;WE FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, + SKIPE NLOOSP ;SWAP OUT MORE PAGES + JRST SWOL1 + JRST SWPON + ;START SWAPPING OUT THIS USER'S PAGES +SWPU1: AOS NSOUSR + MOVSI A,%SWRUN + CAILE C,1 ;CLASS + IORM A,USWST(U) ;INDICATE USER WAS RUNNABLE AT TIME OF SWAP OUT +IFE SWPWSP,[ + SETZM SWUPC + SKIPN ENUPC + JRST SWPU1B + MOVE T,UPC(U) ;CALCULATE WHAT PAGE HIS PC IS ON + LDB C,[121000,,UPC(U)] + ROT C,-1 + ADDI C,UPGMP(U) + MOVE A,[222200,,(C)] + SKIPGE C + IBP A + LDB A,A + TRNN A,600000 + SETZM A + ANDI A,PMRCM ;MASK TO REAL CORE ADR BITS + SKIPN USTP(U) ;ONLY IF RUNNING + TLNN T,%PCUSR ;AND IN USR MODE + CAIA + MOVEM A,SWUPC ;THEN DON'T ALLOW UPC PAGE TO BE SWAPPED OUT +SWPU1B: +];SWPWSP + MOVE B,PSWLC + AOSE PSWSFL + JRST SWPU3A ;PICK UP FROM WHERE LEFT OFF +IFE SWPWSP,[ + SKIPE ENPZRO + SETOM SWPP0F +];SWPWSP + MOVEI C,UPGMP(U) ;ADDRESS OF PAGE MAP (START FROM PG 0) + MOVEI J,UPGCP(U) + HRLI C,442200 ;CNVRT TO BYTE PNTR TO MAP + HRLI J,442200 + MOVEM C,SWPMBP + MOVEM J,SWPCBP + LDB B,[121100,,HUSRAD(U)] ;DO ALL PAGES THAT MIGHT EXIST +SWPU2: ILDB D,SWPCBP ;CIRC PNTR ENTRY + ILDB A,SWPMBP ;PAGE MAP ENTRY + AOS NSOPGS + JUMPE D,SWPU3A ;DOESN'T HAVE PAGE +IFE SWPWSP,[ + AOSN SWPP0F + SKIPE USTP(U) ;DON'T SWAP OUT PAGE 0 IF NOT STOPPED + CAIN D,-1 ;PAGE IS ABSOLUTE + JRST SWPU3A + TRNN A,600000 ;NO ACCESS + JRST SWPU3A + SKIPN ENAGE + JRST SWPU2A + TRON A,PMAGEM ;HAS PAGE BEEN REFERENCED? (AGE MASK) + JRST [ DPB A,SWPMBP + AOS NAGEAB + JRST SWPU3A ] +SWPU2A: ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + CAMN A,SWUPC ;DON'T SWAP OUT PAGE WHERE PC IS IF RUNNING + JRST SWPU3A +];SWPWSP +IFN SWPWSP,[ ;I DOUBT THAT MOST OF THAT NONSENSE DOES ANYTHING + TRNE A,600000 ;NO ACCESS + CAIN D,-1 ;OR PAGE IS ABSOLUTE + JRST SWPU3A ;MEANS DON'T SWAP OUT + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # +];SWPWSP + HRRZ D,MMSWP(A) ;NUMBER OF USERS WHO HAVE THIS PAGE MAPPED + SOJN D,SWPU4 ;PAGE IS SHARED +SWPU6: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + MOVE C,PSWOUS + PUSHJ P,SWPOPG ;SWAP OUT THIS PAGE + JRST SWPU3 + SETOM SBEFLG ;FOUND A PAGE TO SWAP OUT, NOT DESPERATE + MOVE C,SOLNG + SOSLE SWPOPR ;ENOUGH + CAIL C,20. ;ENOUGH FOR NOW + POPJ P, +SWPU3: MOVE B,PSWLC + MOVE U,PSWOUS +SWPU3A: SOJG B,SWPU2 + SETOM PSWOUS + MOVSI B,%SWBEM + IORM B,USWST(U) ;SET BEST EFFORT BIT +IFN SWPWSP,[ + SKIPL APRC(U) ;IF DISOWNED, + JRST SWPON + MOVE B,USWPRI(U) ;DECREASE PRIORITY TO COME BACK IN + LSH B,2 + MOVEM B,USWPRI(U) +];SWPWSP + JRST SWPON + ;TRYING TO SWAP OUT A SHARED PAGE +SWPU4: MOVEM B,PSWLC ;SAVE HOW FAR SWAP-OUT SCAN GOT + AOSE CIRPSW + BUG ;CIRPSW LOCKED IN SWAP OUT CODE + MOVE C,[2200,,MEMPNT(A)] + MOVEM A,SWOBK + PUSHJ P,UCPRL + 400000,,SWPU5 ;CONSULT THE OTHER USERS OF THE PAGE + SETOM CIRPSW + MOVE A,SWOBK + JRST SWPU6 ;OK TO SWAP IT OUT + +SWPU5: SKIPGE TT,USWST(U) .SEE %SWDSO + POPJ P, ;USER DESIRED OUT, CAN'T HOLD PAGE IN +IFN SWPWSP, TLNN TT,%SWLOD ;IF USER IS LOADING, HOLDS PAGE IN + SKIPN AGERTE + JRST SWPU5A + MOVE TT,I + LSH TT,-1 + ADDI TT,UPGMP(U) + HRLI TT,2200 + TRNN I,1 + HRLI TT,222200 + LDB TT,TT + TRNE TT,600000 ;SKIP IF NO ACCESS, IGNORE AGE + TRNE TT,PMAGEM ;HAS SHE USED THIS PAGE? + POPJ P, ;NO, CAN'T HOLD PAGE IN +SWPU5A: SUB P,[4,,4] + SETOM CIRPSW ;SHARED W/USER WHO IS WANTED IN CORE + AOS NSHRAB ;SO DON'T SWAP IT OUT + JRST SWPU3 + +;COME HERE WITH BEST USER TO SWAP OUT IN U, CLASS IN C +SWPONX: JUMPL U,CPOPJ ;NO SWAP OUTTABLE LOSER +IFN SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + JRST SWPNX2 + SETO U, ;WOULD RATHER SWAP OUT LOOSE PAGES + POPJ P, + +SWPNX2: MOVSI T,%SWOUT ;MAKE USER SWAPPED OUT + TDNE T,USWST(U) + JRST SWPNX3 ;ALREADY IS? + IORM T,USWST(U) + MOVE T,UWRKST(U) + MOVEM T,USVWRK(U) + MOVE T,TIME + MOVEM T,USWTIM(U) ;DROPS INTO SWPNX3 +];SWPWSP +IFE SWPWSP,[ + CAILE C,1 + SKIPN NLOOSP + SKIPA B,USWST(U) + JRST [ SETO U, ? POPJ P, ] ;WOULD RATHER SWAP OUT LOOSE PAGES + SKIPGE USWSCD(U) + JRST SWPNX3 ;HE'S ALREADY SWAP BLOCKED + TLNN B,%SWPGW ;IS HE RUNNABLE? + SKIPN FLSINS(U) + SKIPE USTP(U) + JRST SWPNX3 + MOVE B,NMPGS(U) ;HE'S RUNNABLE + CAIGE B,TSYSM-SYSB-MEMSY1 + JRST SWPNX1 ;SMALL, NO THRASH + SUB B,NSWPGS(U) + ADD B,MEMFR + SUB B,NCBCOM + ADD B,SOLNG + SUB B,SILNG + SUB B,AUSOPG + JUMPG B,SWPNX3 ;LET THIS GUY THRASH +SWPNX1: SKIPN ENSWBK + JRST SWPNX3 + MOVSI B,(SETZ) ;SWAP BLOCK THIS LOSER + IORM B,USWSCD(U) + AOS NTUSB + AOS NUSWB + MOVE B,NMPGS(U) ;SMALLEST SWAP BLOCKED LOSER? + CAML B,BUSIZ + JRST SWPNX3 + MOVEM U,BUSR ;YES + MOVEM B,BUSIZ ;DROP INTO SWPNX3 +];SWPWSP +;HAVING DECIDED TO SWAP OUT JOB IN U, MAKE SWAP HISTORY TABLE ENTRY +SWPNX3: MOVSI T,2_16. +;GENERAL SWAP HISTORY TABLE KEEPER. ENTER WITH JOB IN U, EVENT IN T, BASHES TT,I,T +SWPKHT: HRLZ TT,U + IDIVI TT,LUBLK ;TT 3.1-3.8 GETS JOB NUMBER, BASHES I + IOR TT,T + HRR TT,TIME +IFN SWPWSP, HLRZ T,UWRKST(U) +IFE SWPWSP,[ + MOVE T,NMPGS(U) + SUB T,NSWPGS(U) +];SWPWSP + SOSL T + DPB T,[321000,,TT] + MOVEM TT,@SWPHTP + AOS T,SWPHTP + MOVE TT,UTRNTM(U) + MOVEM TT,SWPHTL-1(T) + MOVEI TT,SWPHTB + CAIL T,SWPHTB+SWPHTL + MOVEM TT,SWPHTP + POPJ P, + +OVHMTR SWF ;SWAP FIND USER + +;FIND A USER TO SWAP OUT, RETURN IN U, -1 IF NONE +SWPON2: SETOM PSWSFL ;START FROM BEG OF USER +IFE SWPWSP,[ + SKIPL U,PRVUSR + PUSHJ P,CKPRUS ;MAKE SURE PRIV USER EXISTS AND HAS NOT BEEN BLOCKED FOR A LONG TIME +];SWPWSP + MOVNI T,30.*60. + ADD T,TIME ;A MINUTE AGO + MOVNI U,1 + MOVEI J,2*LUBLK + MOVEI C,NSSCDC ;# SWAP OUT CLASSES +SWPON4: CAML J,USRHI ;C HAS INDEX OF MAX CLASS INTERESTED IN + JRST SWPONX ;LOOKED AT ALL USERS, GO PONDER RESULTS + SKIPE UNAME(J) ;SEE IF FOR REAL + SKIPN NMPGS(J) ;DON'T BOTHER IF HAS NO MEMORY + JRST SWPON3 +IFN SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM+%SWLOD ;DON'T SWAP OUT IF BEST EFFORT ALREADY MADE, + JRST SWPON3 ; OR STILL LOADING IN + MOVEI I,7 + MOVE TT,USWTIM(J) + CAMLE TT,TIME ;IF PROTECT TIME HASN'T ELAPSED YET, GETS HIGHER PRIORITY + JRST SWPTK ;TO PREVENT THRASHING +];SWPWSP +IFE SWPWSP,[ + MOVE B,USWST(J) + TLNE B,%SWBEM + JRST SWPON3 ;BEST EFFORT ALREADY MADE +];SWPWSP + SKIPE LSWPR(J) + JRST SWPON7 ;PREFER NOT TO SWAP OUT LOSER WITH SWITCHES LOCKED + MOVEI I,1 + TLNE B,%SWPGW + JRST SWPON5 ;FLSINS IS WAITING FOR A PAGE (NOT REALLY BLOCKED) + CAML T,LUBTM(J) + SOJA I,SWPTK ;BLOCKED FOR A LONG TIME (CLASS 0) + SKIPN FLSINS(J) +SWPON5: SKIPE USTP(J) + JRST SWPTK ;CLASS 1 (BLOCKED) +IFE SWPWSP,[ + TLNE B,%SWPRV + JRST [ MOVEI I,7 ;CLASS 7 (PRIV USER) + JRST SWPTK ] +];SWPWSP + JUMPL B,[AOJA I,SWPTK] .SEE %SWDSO ;DESIRED OUT (CLASS 2) + MOVEI I,4 + SKIPGE APRC(J) + SOJA I,SWPTK ;DISOWNED (CLASS 3) +IFE SWPWSP,[ + SKIPGE USWSCD(J) + JRST SWPTK ;SWAP BLOCKED (CLASS 4) +];SWPWSP + SKIPGE TTYTBL(J) + AOJA I,SWPTK ;DOESNT HAVE TTY (CLASS 5) +SWPON7: MOVEI I,6 ;OTHERWISE.... + +SWPTK: CAMGE C,I + JRST SWPON3 ;THIS GUY IN MORE WINNING CLASS +IFE SWPWSP,[ + MOVE A,NMPGS(J) + SUB A,NSWPGS(J) +];SWPWSP +.ELSE MOVE A,UWRKST(J) + CAME C,I + JRST SWPTK2 + XCT SWPTT(C) ;IN SAME CLASS, COMPARE CLASS-DEPENDENT PRIORITY MEASURES + JRST SWPON3 +SWPTK2: MOVE E,@SWPTT(I) ;MAKE THIS GUY BEST VICTIM + MOVE C,I + MOVE U,J +SWPON3: ADDI J,LUBLK + JRST SWPON4 + +;SKIP IF THIS GUY (J) IS BETTER LOSER TO FLUSH THAN PREV BEST (IN E) +SWPTT: CAMG E,LUBTM(J) ;BLOCKED FOR A LONG TIME (0) - LATER LUBTM WINS + CAMG E,LUBTM(J) ;BLOCKED (1) - LATER LUBTM WINS + CAML E,A ;DESIRED OUT (2) - SMALLER WORKING SET WINS + CAML E,A ;DISOWNED (3) - SMALLER WORKING SET WINS + CAML E,A ;RUNNABLE, SWAP BLOCK SET (4) - SMALLER WORKING SET WINS + CAML E,USWPRI(J) ;RUNNABLE, W/O TTY (5) - GO BY PRIORITY + CAML E,USWPRI(J) ;OTHERWISE (6) - GO BY PRIORITY +IFE SWPWSP, BUG ;PRIVELEGED USER (7) - SHOULD ONLY BE ONE +IFN SWPWSP, CAMG E,USWTIM(J);PROTECTED (7) - LATER UNPROTECT TIME WINS +NSSCDC==.-SWPTT + +IFE SWPWSP,[ +CKPRUS: MOVSI B,%SWPRV + CAMGE U,USRHI + ANDCAM B,USWST(U) ;TURN OFF PRIV USER BIT + MOVNI TT,30.*2 + ADD TT,TIME ;TWO SECONDS AGO + SKIPE UNAME(U) + CAML TT,LUBTM(U) + PUSHJ P,NPRVUSR + SKIPG U,PRVUSR + POPJ P, + MOVSI B,%SWPRV + IORM B,USWST(U) + POPJ P, +];SWPWSP + +OVHMTR UUO ;RANDOM UUOS + +;AC: A.9 =>1 SWAP OUT USER +;4.8 => 1 ALL PAGES +;4.7=1 => LOOP FOR A WHILE +;3.9-3.1 USER # SELF IF 0 +;RH => USER VIRTUAL PG # +;OR 4.9=0, 4.8=0, 4.7=0 SWAP OUT RH # OF PAGES +;IF 4.9=0, 4.8=1 AND 4.7=0, HACK PCLSR TEST FEATURE ON CURRENT USER +;RH =0 LEAVE PCLSR TEST MODE =1 ENTER IN ADVANCE MODE =-1 ENTER IN HOLD MODE +; =2 ENTER IN ADVANCE BUT DON'T ^Z + +ASWAP: SKIPN SYSDBG + JRST ILUUO + UMOVE A,(J) + TLNE A,100000 + JRST ASWAP3 + JUMPL A,ASWAP1 + TLNE A,200000 + JRST ASWPCL ;PC LSR TEST MODE. + HRRZM A,SWPOPR ;CLOBBER CLOBBER + POPJ P, + +ASWAP1: HLRZ B,A + ANDI B,777 .SEE MAXJ ;FIELD SHOULD BE BIG ENOUGH + IMULI B,LUBLK + SKIPE B + MOVE U,B + TLNN A,200000 + JRST ASWAP2 + MOVE D,NMPGS(U) + SUB D,NSWPGS(U) + JUMPL D,[JRST 4,.] + JUMPE D,CPOPJ + CONO PI,CLKOFF + MOVEM U,PSWOUS + SETOM PSWSFL + ADDM D,SWPOPR + MOVSI D,%SWDSO + IORM D,USWST(U) + CONO PI,CLKON + POPJ P, + +ASWAP2: PUSHJ P,CWAIT ;RETURNS WITH CLKOFF AND CIRPSW AVAILABLE + SKIPL CIRPSW + HRRZS A ;A HAS VIRTUAL PAGE # + PUSHJ P,UPLC ;RETURN POINTERS IN T AND Q + LDB A,T ;GET MAP ENTRY + LDB C,Q ;GET CIRC PNTR + CAIE C,-1 ;DON'T SWAP OUT ABS PAGE + TRNN A,600000 + POPJ P, ;ALREADY OUT OR DOESN'T HAVE PAGE + ANDI A,PMRCM ;MASK TO REAL CORE PAGE # + MOVNI C,1 + PUSHJ P,SWPOPG + JFCL + JRST CLKONJ + +ASWAP3: MOVE B,[1250000.] + SOJG B,. + UMOVE A,2000 + JRST ASWAP3 + +ASWPCL: MOVEM U,PCLUSR + CLEARM PCLL + CLEARM PCLHSH + SETOM PCLNXT + HRRES A + MOVEM A,PCLDBM + POPJ P, + +;.CALL PGWRIT +; ARG 1 - A +; ARG 2 - PAGE NUMBER IN 'S ADDRESS SPACE +;IF ONLY ONE ARGUMENT IS GIVEN, IT IS ARG 2, AND ARG 1 DEFAULTS TO CURRENT USER + +;THE PAGE IS SWAPPED OUT. THE CALL DOESN'T RETURN UNTIL THE SWAP IS COMPLETED. +; THIS ALLOWS USER TO BE SURE THAT THE COPY ON DISK IS UP TO DATE. +;CONTROL BIT 1.1 => RETURN IMMEDIATELY, NO WAITING. TO WAIT LATER, JUST DO +; ANOTHER PGWRIT WITHOUT SETTING 1.1. +;CONTROL BIT 1.2 => UNLOCK PAGE. IF YOU CALL THIS ON A LOCKED PAGE, +; WITHOUT SETTING BIT 1.2, THE PAGE WILL BE SWAPPED OUT, BUT THE NEXT +; TIME IT IS SWAPPED IN IT WILL BE LOCKED AGAIN. THIS IS USEFUL FOR +; CONTROLLING EXACTLY WHEN A DATA BASE PAGE GETS WRITTEN TO DISK. + +NPGWRT: CAIGE W,2 + JRST [ MOVE J,U ? JRST NPGWR1 ] + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC + JRST NPGWR0 + JSP T,NCORWR ;WHICH MUST BE WRITABLE + JRST OPNL31 +NPGWR0: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;CAN'T HACK PDP6 +];PDP6P + MOVE A,B ;NOTE: SWPOPG TAKES CARE OF THE PCLSR'ING + PUSHJ P,NPGWR1 ;CALL MAIN ROUTINE + POPJ P, ;LOST, OPNL CLEARED LSWPR + JRST LSWPJ1 ;WON, UNLOCK DIELOK + +;USER INDEX IN J, PAGE NUMBER IN A +NPGWR1: TDNE A,[-1,,-400] + JRST OPNL32 ;PAGE NUMBER NOT VALID + PUSHJ P,CWAIT ;DON'T ALLOW PAGE MAPS TO CHANGE, AND TURN CLK OFF + SKIPL CIRPSW ;DON'T NEED UTCOFF BECAUSE UTC LEVEL CAN ONLY PUT PAGES INTO MAPS + EXCH U,J + PUSHJ P,UPLC + EXCH U,J + LDB D,Q ;D GETS CIRC PNTR + JUMPE D,OPNL32 ;NO PAGE THERE + CAIN D,-1 + JRST OPNL12 ;ABSOLUTE PAGE + PUSH P,U + MOVE C,Q ;STARTING FROM UPGCP, FIND MMP + PUSHJ P,UCPRL + 200000,,.+2 + BUG ;IF NONE FOUND + SUB P,[4,,4] ;FOUND MMP, C POINTS TO IT + MOVSI T,MMPTMP ;IF PAGE IS IN TRANSIT + TDNE T,(C) + JRST [ POP P,U + TDNE T,(C) ;AWAIT COMPLETION + PUSHJ P,UFLS + JRST NPGWR1 ] ;THEN TRY AGAIN + MOVE E,C ;SAVE ADDRESS OF MMP ENTRY + PUSHJ P,UCPRL ;SEE IF PAGE IS IN MEMORY + 100000,,NPGWR3 + POP P,U ;NOT SWAPPED IN, BYPASS SWAP-OUT CODE + JRST NPGWR2 + +NPGWR3: SUB P,[4,,4] ;IT'S SWAPPED-IN TO CORE PAGE IN T + POP P,U + HLRZ D,MMSWP(T) + JUMPN D,OPNL12 ;POINTED TO BY AN EXEC PAGE, E.G. 340, SHOULDN'T MESS. + PUSH P,A ;SAVE USER'S VIRTUAL PAGE # + PUSH P,J ;SAVE WHAT JOB THAT IS + PUSH P,E ;SAVE ADDRESS OF MMP ENTRY + MOVE A,T ;PHYSICAL PAGE # TO SWAP OUT + MOVE C,USER ;DON'T PCLSR ME + PUSHJ P,SWPOPL ;SWAP OUT, EVEN IF LOCKED + JRST NPGWR4 ;NO DISK SPACE, OR SOME JOB NOT PCLSRABLE + POP P,E + POP P,J + POP P,A +NPGWR2: MOVE T,CTLBTS(U) + MOVSI D,MMPLOK + TRNE T,2 ;CONTROL BIT 1.2 UNLOCKS + ANDCAM D,(E) + TRNE T,1 ;CONTROL BIT 1.1 INHIBITS WAITING FOR SWAP TO FINISH. + JRST CLKOJ1 + MOVSI T,MMPTMP ;PAGE IN TRANSIT BIT + TDNE T,(E) ;WAIT FOR BIT TO TURN OFF + PUSHJ P,UFLS + JRST CLKOJ1 + +;COULDN'T SWAP OUT, WAIT A WHILE AND TRY AGAIN +NPGWR4: PUSHJ P,UDELAY ;UDELAY TURNS CLKON + POP P,E + POP P,J + POP P,A + JRST NPGWR1 + +EBLK + +;SWAP IN RQ BLOCKS +SWIRQB: +IFN 340P\E.SP, DISSWI: -1 ;USER +IFN VIDP, VIDSWI: -1 +IFN IMXP, POTSWI: -1 +IFN NSWPV-.+SWIRQB,.ERR NSWPV ERR + +SWIVPN: +IFN 340P\E.SP, DISSPG: 0 ;VIRTUAL PAGE NUMBER +IFN VIDP, VIDSPG: 0 +IFN IMXP, POTSPG: 0 + +SWPNTB: ;SIGNAL BITS IN LH OF W TO CFHSW1 +IFN 340P\E.SP, 400000 ;DISPLAY +IFN VIDP, 400000 ;VID +IFN IMXP, 400000 ;POTS + +SWILMT: ;PIRQC BIT TO SET ON ILM +IFN 340P\E.SP, %PIDIS +IFN VIDP, %PIMPV +IFN IMXP, %PIMPV + +PSWOUS: -1 ;INDEX OF PARTIALLY SWAPPED OUT USER +PSWCLS: 0 ;CLASS OF PARTIALLY SWAPPED OUT USER +PSWSFL: 0 ;-1 START FROM BEG OF USER, ELSE PICK UP WHERE LEFT OFF +SWPMBP: 0 ;PNTR TO MAP +SWPCBP: 0 ;PNTR TO CIRC DESC SPACE +PSWLC: 0 ;LOOP COUNT +SBEFLG: -1 ;0 => ALREADY ONCE WANTED TO CLEAR ALL "BEST EFFORT" BITS. +SWPOPR: 0 ;NUMBER OF PAGES DESIRED TO BE SWAPPED OUT +SWPOPB: 0 ;SWAP OUT REQUEST BUT ONLY SWAP OUT NON-RUNNING USERS TO MEET (UNUSED?) +SILNG: 0 ;TOTAL LENGTH OF SWAP IN LISTS +SOLNG: 0 ;TOTAL LENGTH OF SWAP OUT LISTS + ;SINLST AND SOUTLS ARE IN DISK CODE. VARIATION ON QBFP. +SWODSK: NQS-1 ;UNIT TO SWAP OUT ON NEXT +SWOBK: 0 ;MEMBLT BEING SWAPPED OUT +SWOMMP: 0 ;MMP ADDRESS (NOT INDEX) +SPGNMF: 0 ;-1 => PAGE NOT MODIFIED +CFHAS: 0 ;TEMP FOR A AT CFH +SWPIQS: 0 ;SAVE Q AT SWPPIN +CFHUVP: 0 ;USER'S VIRTUAL PAGE NUMBER TOOK FAULT ON +LUMPS: 0 ;UMAPS USED FOR CURRENT USER, MAY DIFFER FROM + ;UMAPS(U) IF TOOK FAULT TRYING TO CAUSE INTERRUPT +TRUMM: 0 ;TOTAL USER MEM ACTIVE USERS +NPGSWO: 0 ;NUMBER OF CURRENTLY SWAPPED OUT PAGES +AUSOPG: 0 ;ACTIVE USER SWAPPED OUT PAGES +BUMPGS: 0 ;REAL CORE PAGES OCC BY BLOCKED + STOPPED LOSERS +NUSWB: 0 ;# LOSERS SWAP BLOCKED +SWPOPU: 0 ;USER PG "BELONGS" TO (IE NOT NECC TO PCLSR THIS GUY, + ;BUT PCLSR ANYONE ELSE LINKED TO PG.) +AGEREQ: 0 ;NUMBER OF PAGES BEING AGED AT SLOW CLOCK +AGEPOS: 0 ;LAST PAGE # AGED + +IFE SWPWSP,[ +PRVUSR: -1 ;PRIV USR +PRVCUT: 1500 ;CUT OFF FOR PRIV USR +SWUPC: 0 ;ABSOLUTE PAGE NUMBER OF USER MODE PC DURNING SWAP OUT +SWPP0F: -1 ;-1 IF CONSIDERING PAGE 0 +ASBUM: 0 ;REAL MEM OCC BY ACTIVE "SWAPPED BLOCKED" LOSERS +SWSCT1: 0 ;TEM AT SWSCD +BUSR: 0 ;INDEX OF SMALLEST SWAP BLOCKED LOSER +BUSIZ: 0 ;SIZE OF BUSR +];SWPWSP + +IFN PAGPRE,[ +PREEMP: 0 ;IF NON-ZERO, A PRE-EMPT IS IN PROGRESS (WHEN WE NEXT GET TO CLK LVL) +NPREEL: 0 ;NUMBER OF LOOPS AT SCHEDP (ATTEMPTED PREEMPTS) +NPREEM: 0 ;NUMBER OF SUCCESSFULL PREEMPTS +NPREE1: 0 ;NUMBER OF TIMES A PAGE CAME IN AND WE STARTED TO THINK ABOUT PREEMPTION +NPREE2: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE OF CLKOFF OR IN PROGRESS +NPREE3: 0 ;NUMBER OF TIMES WE DIDN'T PUNT BECAUSE FLSINS WAS WRONG +];PAGPRE + +;COUNTS OF REASONS FOR ENTRY TO SCHED +;THESE METERS MAY BE TEMPORARY - SOME OF THEM ARE REDUNDANT +;REASONS NOT COUNTED - VARIOUS PARITY, NXM, AND OTHER ERROR CASES +NLPPRE: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PREEMPT +NLPCLK: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO CLOCK +NLPUFL: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO UFLS +NLPPAG: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE-IN +NLPPGT: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND TUT LOCKED +NLPPGC: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CIRPSW LOCKED +NLPPGM: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND MEMFRZ LOCKED +NLPPG3: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND CALLED CFHPO3 (NO MEM) +NLPPGB: 0 ;NUMBER OF TIMES LOST PROCESSOR DUE TO PAGE FAULT AND SWAP-BLOCKED +NPPIUM: 0 ;NUMBER OF TIMES PAGE PUT INTO BUNCHA USERS' MAPS +NPPIU1: 0 ;NUMBER OF USERS PAGES PUT INTO MAPS OF (RATIO OF THESE 2 IS SHARING) + +IFN SWPWSP,[ +LODQNT: ;RUN TIME IN 4-USEC UNITS BETWEEN PG FAULTS TO LEAVE + ;LOADING STATE + IFN KL10P, 3000. ;12 MS + IFN KA10P, 9000. ;36 MS + IFN KS10P, 3000. .ERR Guessed LODQNT on KS10? +LODFCT: 3,,0 ;MULTIPLY LOADING TIME BY THIS TO GET PROTECT TIME (INT,,FRAC) +NUPTAW: 0 .SEE SWOP6 ;NUMBER OF USERS PAGE TAKEN AWAY FROM + +;METERS + +NPLBLJ: 0 ;NUMBER OF PAGE LOADS BY LOADING JOBS +NPLBNL: 0 ;NUMBER OF PAGE LOADS BY NON-LOADING JOBS + +;Still to be done +; 1-, 5-, 15- minute average population of each state, +; also avg of NPGWTU and RNABLU (for load avg) +; avg of core occupied by jobs in each state, +; i.e. UWRKST for load, pro, sw in. +; Relationship of sum of UWRKST's of loading and swapped in +; versus total core occupied by user pages. +; Average time spent in each state before moving on, +; versus size of job. Maybe cpu time as well as +; real time? + +];SWPWSP +BBLK + + +OVHMTR SWP ;SWAP PAGE + +;SWAP OUT PAGE WHOSE MEMBLT INDEX IS IN A +;SKIP IF SUCCESSFUL +;C IS USER WHO DOESN'T NEED TO BE PCLSRED BEFORE HIS PAGES CAN BE SWAPPED. +SWPOPL: TDZA B,B ;THIS ENTRY IGNORES LOCK BIT +SWPOPG: MOVSI B,MMPLOK ;THIS ENTRY RESPECTS LOCK BIT + MOVEM C,SWPOPU + MOVEM A,SWOBK + CAIGE A,TSYSM + CAIGE A,SYSB + BUG ;DON'T SWAP OUT PART OF SYSTEM + AOSE CIRPSW + POPJ P, + LDB C,[MMMPX,,MEMBLT(A)] + ADDI C,MMP + HRRZM C,SWOMMP ;STORE ADDRESS OF FIRST WORD OF MMP ENTRY + TDNE B,(C) .SEE MMPLOK ;LOCKED IN CORE? + JRST [ CAIGE A,256. ;IF SO, DON'T SWAP OUT UNLESS IN "LOW" MEMORY + CAIGE A,LIOBLK ;IN WHICH CASE MUST GO OUT TO AVOID SYSTEM DEADLOCK + JRST SCRPSJ ;SEE CODE AT CIMEMR + CAIGE A,128. + JRST .+1 + CAIL A,128.+NEXPGS ;SHADOWS OF EXEC PAGES + SKIPN USEMDM + JRST SCRPSJ + JRST .+1 ] + SOS CIRPSW ;RELEASE SWITCH + HLRZ B,1(C) + JUMPN B,SWOP1 ;JUMP IF DISK SPACE ALREADY ASSIGNED +SWODF3: MOVSI B,-NQS +SWODF6: AOS I,SWODSK + CAIL I,NQS + SUBI I,NQS ;WRAP AROUND + MOVEM I,SWODSK ;CURRENT SWAPPING DSK + CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + SKIPGE QTUTO(I) ;TUT LOCKED + JRST SWODF7 + SKIPL QACT(I) + SKIPG QSFTS(I) ;DSK FULL IN SWAPPING AREA + JRST SWODF7 + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL. + MOVEI A,NQCHN+1(I) ;QMFTP(A) CONTAINS TRACK TO START FROM + PUSHJ P,QGTK4 ; RETURNS TRACK IN D + SOS QSFTS(I) +SWODF5: MOVSI A,(SETZ) + ANDCAM A,QTUTO(I) + MOVE A,SWOMMP + HRLM D,1(A) ;STORE DISK ADDRESS IN MMP ENTRY + DPB I,[$MMPUN,,(A)] + JRST SWOP1 + +SWODF7: AOBJN B,SWODF6 ;TRY NEXT DSK FOR SWAPPING AREA + CONO PI,UTCON-1 ;NON FOUND FIND FILE SPACE + MOVNI D,1 + MOVNI I,1 + MOVSI E,-NQS +SWODF2: SKIPL QTUTO(E) ;FIND WHICH DISK HAS MOST FREE SPACE + SKIPGE QACT(E) + JRST SWODF4 + CAMGE D,QSFT(E) + HRRZ I,E + CAMGE D,QSFT(E) + MOVE D,QSFT(E) +SWODF4: AOBJN E,SWODF2 + JUMPL I,CPOPJ ;NO DSK SPACE AVAIL + HRRZM I,SWODSK ;LAST DSK HACKED + JUMPLE D,CPOPJ ; NO ROOM ANYWHERE + CONO PI,UTCOFF-1 + SKIPGE QTUTO(I) + JRST UTCNJ ;TUT LOCKED + MOVSI A,(SETZ) + IORM A,QTUTO(I) + CONO PI,UTCON-1 + MOVEI D,NBLKS/2 ;STARTING POINT + MOVEI A,NQCHN+1(I) ;DISK CHANNEL + MOVEM D,QMFTP(A) + PUSHJ P,QGTK4 ;RETURNS TRACK IN D + MOVEI E,NUDSL + MOVEM E,QMFTP(A);DON'T LEAVE SWAPPING CHNL POINTING INTO FILE SPACE + SOS QSFT(I) + JRST SWODF5 + +SCRPSJ: SETOM CIRPSW + POPJ P, + +SWOP1: AOSE CIRPSW + POPJ P, + AOS NPGSO + +;COME HERE FROM SWPOPG AND MMPRTN TO SWAP OUT A PAGE. +;CLOCK OFF OR IN PROGRESS AND ARGUMENTS IN SWOBK AND SWOMMP. +;PUTS BLOCK ON SWAPOUT LIST IF DISK COPY NEEDS TO BE UPDATED, ELSE +;JUST DELETES MEMORY. IF NO USERS ARE USING THE PAGE, +;RETURNS THE MMP ENTRY OR ARRANGES FOR THE DISK ROUTINES TO. + +SWOP1A: CONO PI,UTCOFF-1 ;DON'T CHANGE STATE OF CLOCK CHNL. + MOVE A,SWOBK ;CORE BLOCK # CONTAINING PAGE TO BE SWAPPED OUT + HLRZ C,MMSWP(A) ;NUMBER OF EXEC PAGES POINTING TO THIS PAGE + JUMPN C,SWOP5 ;POINTED TO BY EXEC PAGE, CAN'T SWAP OUT +IFN 340P,[ + MOVSI C,-N340PB-2 +SWOPT2: LDB I,DPEP(C) + TRZN I,600000 + JRST SWOPT1 + ANDI I,PMRCM ;MASK TO REAL CORE PAGE # + CAIN I,(A) + BUG ;DISPLAY STILL SET UP TO PAGE BEING SWAPPED OUT +SWOPT1: AOBJN C,SWOPT2 +] + MOVSI C,MMPPGA + ANDCAM C,@SWOMMP + MOVSI C,(SETZ) + IORM C,MEMBLT(A) ;PREVENT NEW EXEC PAGES FROM BEING SET UP POINTING HERE + CONO PI,UTCON-1 + MOVE C,[2200,,MEMPNT] + ADD C,SWOBK + SETOB B,SPGNMF ;INITIALIZE PAGE NOT MODIFIED FLAG, AND COUNT USERS IN B +IFN SWPWSP,[ + LDB I,C + PUSH P,I + SETZM NUPTAW + MOVSI D,-1 ;COMPUTE WORKING SET CONTRIBUTION TO BE TAKEN AWAY + IDIV D,MMSWP(A) ;LH(MMSWP) KNOWN TO BE ZERO! + PUSHJ P,UCPRL ;CHECK ALL USERS, TAKE PAGE AWAY FROM SOME + 400000,,SWOP6 ;ALSO COUNTS USERS IN B + POP P,I + AOJE B,SWOP7 ;JUMP IF NO USERS USING PAGE, RETURN MMP ENTRY + CAMN B,NUPTAW ;ANY USERS STILL MAPPED TO PAGE? + JRST SWOP8 ;NO, GO SWAP IT OUT + MOVSI D,1 ;YES, COMPUTE WORKING SET ADJUSTMENT + IDIV D,MMSWP(A) ;TO BE ADDED BACK IN TO THEM + PUSHJ P,UCPRL ;GO BACK AND FIX WORKING SETS + 400000,,SWOP6B + JRST SWOP6E ;ABORT SWAP OUT +];SWPWSP +IFE SWPWSP,[ + LDB I,C + PUSH P,I ;NOTE: CAN BACK OUT OF THIS PUSH AT SWOP2B + PUSHJ P,UCPRL + 400000,,SWOP2 ;RETURN ON USERS (CAN BACK OUT AT SWOP2B) + POP P,I + JUMPGE B,SWOP8 +];SWPWSP +SWOP7: MOVSI B,MMPGON ;NO USERS USING PAGE, SO MMP ENTRY WILL BE RETURNED + IORM B,@SWOMMP ;FLAG THAT MMP ENTRY WILL SOON GO AWAY + MOVEI A,0 ;REMOVE FROM LOOSE PAGE LIST + MOVE T,FLOOSP +SWOP7A: MOVE B,A ;B PREDECESSOR + SKIPN A,T ;T SUCCESSOR + BUG ;NOT IN LIST? + LDB T,[MLO,,MEMBLT(A)] + CAME A,SWOBK + JRST SWOP7A + SKIPE B ;FOUND, PATCH OUT OF LIST + DPB T,[MLO,,MEMBLT(B)] + SKIPN B + MOVEM T,FLOOSP + SKIPN T + MOVEM B,LLOOSP + SOSL NLOOSP + JRST SWOP8 + BUG ;NLOOSP TOO LOW. + +IFN SWPWSP,[ + +;THIS UCPRL ROUTINE SCANS ALL USERS, COUNTS THEM IN B, +;USES D TO ADJUST WORKING SETS OF USERS WHICH ARE MAPPED TO +;THE PAGE, AND TAKES THE PAGE AWAY FROM ANY USERS IT CAN, +;COUNTING THEM IN NUPTAW. +SWOP6: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + CAMN U,SWPOPU + JRST SWOP6A ;DON'T CONSIDER PCLSRING SWPOPU + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP6A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP6D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP6A + +SWOP6D: PUSH P,D + PUSH P,C + PUSH P,I + PUSHJ P,PCLSR ;BETTER NOT CLOBBER U OR H OR A + JRST [ SUB P,[2,,2] + POP P,D + JRST SWOP6C ] + POP P,I + POP P,C + POP P,D +;WHEN WE GET HERE, THIS JOB CAN'T HOLD THIS PAGE IN +SWOP6A: TRNN I,600000 + JRST SWOP6C ;NOT SET UP SINCE PREV SWAPPED OUT + AOS NUPTAW ;TAKE IT AWAY + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + SOS MMSWP(A) ;DECR COUNT OF PAGE SHARERS +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP6C: POP P,I + POPJ P, + +SWOP6F: CAMN U,-4(P) ;DON'T LOOK AT USER TAKING PAGE AWAY FROM + POPJ P, ;ELSE DROP INTO SWOP6B +;THIS UCPRL ROUTINE ADJUSTS WORKING SETS OF JOBS THAT +;ARE MAPPED TO THE PAGE USING D. +SWOP6B: PUSH P,I + MOVEI C,UPGMP(U) ;MAKE C POINT TO UPGMP ENTRY (PTW) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNE I,600000 + ADDM D,UWRKST(U) ;IS MAPPED TO PAGE, ADJUST WORKING SET + POP P,I + POPJ P, +];SWPWSP + +IFE SWPWSP,[ +;COME HERE VIA UCPRL FOR ALL USERS OF PAGE BEING SWAPPED OUT + +SWOP2: AOS B ;COUNT USERS OF THIS PAGE + CAIG U,LUBLK + BUG ;SYS JOB OR CORE JOB? + PUSH P,I + CAMN U,SWPOPU + JRST SWOP2A + MOVE T,UPC(U) + TLNE T,%PCUSR + JRST SWOP2A + SKIPN LSWPR(U) ;PCLSR IF HAS SWITCHES LOCKED + SKIPN FLSINS(U) + JRST SWOP2D + MOVSI T,%SWPCL ;DONT PCLSR NOW, BUT WHEN UNBLOCKS + IORM T,USWST(U) + JRST SWOP2A + +SWOP2D: PUSHJ P,PCLSR + JRST SWOP2B +SWOP2A: MOVEI C,UPGMP(U) + ROT I,-1 + ADDI C,(I) + HRLI C,222200 + SKIPGE I + HRLI C,2200 + LDB I,C + SKIPN I + BUG ;NO ACCESS? + TRNN I,600000 + JRST SWOP2C ;NOT SET UP SINCE PREV SWAPPED OUT + LSH I,-16. ;SAVE ACCESS MODE IN LOW ADR BITS + CAILE I,2 ;SKIP ON READ ONLY OR READ/WRITE/FIRST + CLEARM SPGNMF ;PAGE HAS BEEN MODIFIED + CAIN I,2 ;FLUSH R.W.F. + MOVEI I,3 + DPB I,C ;STORE PROTECTION BITS BACK IN LOWER TWO BITS OF ENTRY + AOS NSWPGS(U) ;INCR COUNT OF SWAPPED OUT PGS OF USER + AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + MOVE I,SWOBK + SOS MMSWP(I) ;KEEP ACCURATE COUNT OF UPGMP'S POINTING AT THIS PAGE +IFN E.SP,[ + CAMN U,DISUSR ;IF USER OF E&S + PUSHJ P,E.SLPM ;LOAD ITS MAP +] +SWOP2C: POP P,I + POPJ P, + +SWOP2B: SUB P,[6,,6] ;2 PUSHES OF I AND 4 FOR UCPRL +];SWPWSP +SWOP6E: MOVE A,SWOBK ;ABORT SWAP-OUT + MOVSI I,(SETZ) + ANDCAM I,MEMBLT(A) + SOS CIRPSW + POPJ P, + +SWOP8: DPB I,C ;DELINK MEMPNT + MOVEI I,3 .SEE MMPOUT .SEE MMPTMP + DPB I,[410200,,@SWOMMP] ;INDICATE ON THE WAY OUT + MOVSI I,MMPBAD + ANDCAM I,@SWOMMP + MOVE A,SWOBK + MOVSI B,(SETZ) + CONO PI,UTCOFF-1 + ANDCAM B,MEMBLT(A) + MOVE C,@SWOMMP + TLNN C,MMPGON ;UNLESS PAGE WILL BE FORGOTTEN AFTER SWAP OUT, + AOS NPGSWO ; KEEP COUNT OF PAGES CURRENTLY SWAPPED OUT + TLNE C,MMPWRT ;IF WAS WRITTEN BY USER WHO LATER DELETED IT, + JRST SWOP3 + SKIPGE SPGNMF ;OR IF PAGE MODIFIED, + TLNN C,MMPWOD + JRST SWOP3 ;OR IF HASN'T BEEN WRITTEN TO DISK, MUST WRITE OUT. + MOVEI I,2 ;NO NEED TO WRITE OUT. INDICATE OUT. + DPB I,[410200,,@SWOMMP] + PUSHJ P,IMEMR ;RETURN THE MEMORY + MOVE A,SWOMMP + TLNE C,MMPGON + PUSHJ P,RETMMP ;ALSO RETURN THE MMP ENTRY IF NECESSARY + JRST SWOP4 + +SWOP5: SOS CIRPSW +UTCNJ: CONO PI,UTCON-1 ;DON'T TURN ON CLOCK CHNL + POPJ P, + +SWOP3: CAIGE A,TSYSM ;HAVE TO WRITE THIS PAGE OUT + CAIGE A,SYSB + BUG + HRRZ B,SWOMMP + LDB I,[$MMPUN,,(B)] + CAIL I,NQS + BUG ;DISK NUMBER NOT LEGITIMATE + MOVEI C,.BM MLO + ANDCAM C,MEMBLT(A) ;SET END OF LIST IN THIS BLOCK + HLRZ C,SOUTLS(I) ;GET PREV BLOCK + SKIPE C + DPB A,[MLO,,MEMBLT(C)] ;CHAIN TO PREV BLOCK + SKIPN C + MOVEM A,SOUTLS(I) ;OR TO HEADER IF FIRST + HRLM A,SOUTLS(I) ;AND SET NEW LAST BLOCK + AOS SOLNG + HLRZ C,1(B) + HRLM C,MEMPNT(A) ;STORE DISK ADDRESS + MOVEI B,MUSWPG + DPB B,[MUR,,MEMBLT(A)] + PUSHJ P,QSTRT1 +SWOP4: SOS CIRPSW +UTCNJ1: CONO PI,UTCON-1 + JRST POPJ1 + +IFN NSWPV,[ +SWPPIN: MOVSI Q,-NSWPV ;# OF DEVICES THAT CAN SWAP IN PAGES +SWPPI4: SKIPGE W,SWIRQB(Q) ;USER INDEX + JRST SWPPI6 + MOVE E,SWIVPN(Q) ;VIRTUAL PAGE NUMBER + HRL W,SWPNTB(Q) + CLEARB TT,D + MOVEM Q,SWPIQS + PUSHJ P,CFHSW1 + MOVE Q,SWPIQS + SETOM SWIRQB(Q) +SWPPI6: AOBJN Q,SWPPI4 + POPJ P, +] + +SWIILM: +IFN E.SP,[ + TRNN Q,-1 ; IS DEVICE DIS? (E&S IS INDEX 0 IN SWIRQB) + SETZM E.SPGW ; IF SO, CLEAR PAGE WAIT. +] + SKIPGE E,SWILMT(Q) + BUG + IORM E,PIRQC(W) + MOVEI A,0 + POPJ P, + +SUBTTL LOAD USER PAGE MAP + +OVHMTR UUO ;RANDOM UUOS (WELL, SOME MINOR SCHED STUFF, TOO) + +;SET PAGE MAP AT M.P. LEVEL, ASSUMING UMAPS HAS BEEN ALTERED. +;UMAPS EXISTS SO SCHEDULER CAN RESTORE THE MAP AFTER OTHER JOBS RUN. +;FORMAT OF A MAP SPECIFICATION IS: +%UM==1,,525252 +%UMMPL==200000 ;1 => MAP LOWER HALF TO SPEC'D JOB'S; 0 => USE LOWER OF JOB IN U. +%UMMPU==100000 ;1 => MAP UPPER HALF TO SPEC'D JOB'S; 0 => USE UPPER OF JOB IN U. +%UMALL==300000 ;SET => SELECT WHOLE MAP OF SPEC'D JOB. +%UMUTL==40000 ;IGNORED IF %UMMPU=0. IF %UMMPU=1, MEANS USE SPEC'D JOB'S LOWER + ;INSTEAD OF ITS UPPER, AS OUR UPPER HALF. READ "%UM UPPER-TO-LOWER". +%UMLTU==20000 ;"%UM-LOWER-TO-UPPER". WITH %UMMPL, MAKES LOWER -> SPEC'D JOB'S UPPER. +%UMSOA==4000 ;1 => USE AC0S AS THE USER'S ACS, INSTEAD OF UUOACS. + ;NOTE IF %UMLTU=1, OR IF LOWER -> PDP6, THE GARBAGS ACS ARE USED. + ;ELSE, THE ACS COME FROM THE JOB WHICH OUR LOWER HALF COMES FROM. +;RH ;JOB INDEX OF THE "SPECIFIED JOB". -1 => PDP6. + ;NOT NEEDED IF %UMMPL=%UMMPU=0. + +PGLDU: MOVE R,UMAPS(U) +;SET PAGE MAP AT INT. LEVEL, NOT CLOBBERING JOB'S UMAPS. ARG IN R. +PGLD: MOVEM R,LUMPS ;LAST UMAPS ACTUALLY USED + AOS NPGLD ;COUNT # CALLS TO PGLD + PUSH P,A ;R HAS UMAPS CODE + PUSH P,B + PUSH P,C + HRRZ C,U +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP NORMAL DBL, MIGHT BE CHANGED IF PDP6 +IFE KA10P, MOVSI B,0 ;ONLY KA10 HAS DBL + TLNN R,%UMMPL + JRST PGLD3A ;USE NORMAL LOW SEG +IFN PDP6P,[ + TRNE R,400000 + JRST PGLD3B ;USE PNTR TO PDP6 +] + HRRZ C,R + TLNE R,%UMLTU ;SKIP ON USE HIS LOWER + JRST PGLD3D ;USE HIS UPPER +PGLD3A: HRRI B,UDBR1A(C) + TLNE R,%UMSOA + JRST PGLD3G ;MAKE AC'S POINT AT SWAP OUT AC'S + MOVEI A,UUOACS(C) +PGLD3F: MOVEM B,UPDBR1(U) +IFN KA10P, DPB A,[2300,,UPACP(U)] ;STORE AC PNTR +IFE KA10P,[ + CAMN A,AC1PTR ;IF CHANGING AC BLOCK 1 + JRST PGLD3H + EXCH A,AC1PTR ;STORE OLD BLOCK 1 + MOVE B,A + XCTR XBR,[BLT B,17(A)] + MOVS A,AC1PTR ;AND LOAD NEW BLOCK 1 + XCTR XBW,[BLT A,17] +PGLD3H: ] ;IFE KA10P +IFN KA10P, MOVSI B,NUVPG/2 ;SET UP DBL FOR DBR2 +IFE KA10P, MOVSI B,0 + HRRI B,UDBR2A(U) + TLNN R,%UMMPU + JRST PGLD6 ;USE NORMAL UPPER SEG + HRRI B,UDBR2A(R) + TLNE R,%UMUTL + HRRI B,UDBR1A(R) +IFN PDP6P,[ + TRNE R,400000 + MOVE B,PDP6MP +] +PGLD6: MOVEM B,UPDBR2(U) +PGLDR1: LPMR UPGML(U) + POP P,C + POP P,B + POP P,A + POPJ P, + +IFN PDP6P, PGLD3B: SKIPA B,PDP6MP +PGLD3D: HRRI B,UDBR2A(R) + MOVEI A,GACS + JRST PGLD3F + +PGLD3G: MOVEI A,AC0S(C) + JRST PGLD3F + +GACS: BLOCK 20 ;GARBAGE AC'S POINTED TO BY ACPNTR WHEN ITS REALLY POINTING + ;AT UPPER PAGES OR PDP6 SHOULD HOPEFULLY NEVER GET REFERENCED + +;MAIN PROGRAM MAP-SETTING ROUTINES. +IFN PDP6P,[ +MP6LD: SKIPA J,[%UMMPU,,-1] ;LOAD UPPER DBR TO PNT TO 6 +];PDP6P +MPLDZ: MOVEI J,0 ;SET NORMAL MAP - OUR OWN CORE. +MPLD1: CAMN J,UMAPS(U) ;SET UMAPS AS SPEC'D + JRST CLKONJ + MOVEM J,UMAPS(U) +MPLD: CONO PI,CLKOFF + PUSHJ P,PLD + JRST CLKONJ + +;SET MAP TO JOB # IN J; MIGHT OR MIGHT NOT BE THE CURRENT JOB. SAVES RH(J) +MPLDJ: CAME J,USER + TLOA J,%UMSOA+%UMALL ;OTHER JOB'S ACS ARE IN ITS AC0S. + TLO J,%UMALL ;THIS JOB => WANT UUOACS. + JRST MPLD1 + +;SIMILAR ROUTINES, BUT FOR USE WHEN CLKCHN IS OFF AND SHOULD STAY OFF. +IFN PDP6P,[ +PLD6: SKIPA J,[%UMMPU,,-1] ;MAKE UPPER DBR POINT TO PDP6. +];PDP6P +PLDZ: MOVEI J,0 ;NORMAL MAP +PLD1: MOVEM J,UMAPS(U) +PLD: SPM UPGML(U) ;IF ANY INHIBITED FAULT PRESENT, CAUSE IT TO GET STORED AWAY + PUSH P,R + PUSHJ P,PGLDU ;CAUSE ACTUAL PG LOAD TO HAPPEN + POP P,R + POPJ P, + +SUBTTL GIVING THE USER INTERRUPTS + +SEAR2E: MOVE A,PIRQC(U) + +;ROUTINE TO HANDLE FIRST WORD (PIRQC) INTS +SEAR2A: JUMPL A,SEAR2B ;REQUEST TO PCLSR + SKIPN PICLR(U) + JRST SEAR2C ;PI IN PROG, ONLY LOOK FOR FATAL INTS. + SETCM Q,IDF1(U) + AND Q,MSKST(U) ;ENABLED UNDEFERRED INTS. + TDNN A,Q ;ANY OF THOSE PENDING, + TDNE A,[BADBTS] ;OR ANY CLASS 1 OR 2 => INTERRUPT. + CAIA + JRST SEARL2 + ANDCA Q,A ;GET DISABLED OR DEFERRED PENDING INTS. + TDNN Q,[BADBTS] ;ANY CLASS 1 OR 2 DISABLED OR DEFERRED + JRST INTWD1 ;NO, INT. THIS JOB. + JRST SEAR2D ;YES, INT. SUPERIOR. + +SEAR2C: TDNN A,[BADBTS] ;PI IN PROG: ANY CLASS 1 OR 2 ? + JRST SEARL2 ;NO, NOTHING TO DO. +SEAR2D: PUSHJ P,PCLSR ;INT. THE SUPERIOR: PCLSR FIRST. + JRST SEARC ;CAN'T STOP THIS JOB IN EXEC MODE. + SETZ B, ;OK, HANDLE FATAL 1ST WORD INTS IN A, AND NO 2ND WORD INTS. + +;HANDLE A FATAL INTERRUPT BY INTERRUPTING THE SUPERIOR. +;FATAL 1ST WORD INTERRUPTS IN A, FATAL 2ND WORD INTS IN B. +INTSUP: MOVEM A,SRN4(U) ;.FTL1 + MOVEM B,SRN5(U) ;.FTL2 ;PUT THE FATAL INTERRUPTS WHERE SUPERIOR CAN READ THEM. + MOVSI T,BUSRC + IORM T,USTP(U) ;STOP INFERIOR +IFN SWPWSP, PUSHJ P,LVLOAD + MOVSI T,BULGOS ;IF LOST TRYING TO LOG OUT, ABORT LOGOUT + ANDCAM T,APRC(U) + MOVE Q,U ;SAVE USER INTERRUPTING + SKIPGE U,SUPPRO(U) ;SKIP UNLESS TOP LEVEL + JRST INTTOP ;REALLY TOP LEVEL + HLLZ T,U ;GET INT BIT + IORM T,IFPIR(U) ;TURN ON INTERRUPT BIT IN SUPERIOR + HRRZS U ;CLEAR LEFT HALF OF U + CAIL J,(U) ;SKIP IF SUPERIOR HAS NOT YET BEEN SCHEDULED + JRST SEARL1 ;RESCHEDULE SUPERIOR + JRST SEARL ;HAVEN'T GOT TO HIM YET SO CONTINUE + +INTTOP: MOVEI T,SCRDET + SKIPL APRC(Q) ;IF JOB ISN'T ALREADY DISOWNED + IORM T,SUPCOR ;SAY SOMEONE WANTS TO BE DETACHED. + JRST SEARL ;LEAVE STOPPED, SYS JOB WILL DETACH SOMEDAY. + +SEAR2B: PUSHJ P,PCLSR ;PCLSR THE JOB, E.G. SO IT CAN GET AN IOC ERROR + JRST SEARC ;RUNNING IN EXEC MODE, GO RUN IT + MOVSI A,(SETZ) ;CLEAR REQUEST + ANDCAM A,PIRQC(U) + JRST SEARL1 ;INSPECT THIS JOB AGAIN + +;IFPIR IS NONZERO BUT PIRQC IS ZERO. +INTWD2: SKIPN PICLR(U) + JRST SEARL3 ;IGNORE 2ND WD INTS IF PI IN PROG. + AND B,MSKST2(U) + ANDCM B,IDF2(U) ;GET ENABLED UNDEFERRED INTS. + JUMPE B,SEARL3 ;ALL DISABLED OR DEFERRED. + JSP T,INTPAG ;MAKE SURE NOT WAITING FOR PAGE NEEDED FOR INT. + PUSHJ P,PCLSR ;DON'T INT. EXCEPT IN USER MODE. + JRST SEARC + SETZ A, ;1ST WD INTS TO GIVE = 0. + JRST INTSRC ;2ND WD INTS TO GIVE ALREADY IN B. + +;PIRQC WAS NONZERO BUT NO FATAL INTS. +INTWD1: JSP T,INTPAG ;IF TRIED BEFORE & WENT TO INTPFL, WAIT FOR PAGE. + PUSHJ P,PCLSR ;CAN INT. ONLY IN USER MODE. + JRST SEARC + MOVE B,IFPIR(U) + AND B,MSKST2(U) ;GET PENDING ENABLED UNDEFERRED 2ND WD INTS IN B. + ANDCM B,IDF2(U) + AND A,MSKST(U) + ANDCM A,IDF1(U) ;PENDING ENABLED UNDEFERRED 1ST WD INTS IN A. +INTSRC: AOS NAUINT ;ELSE 1 MORE ATTEMPT TO INTERRUPT. + MOVSI R,%UMSOA ;LOAD ORDINARY MAP FOR THIS USER. + PUSHJ P,PGLD ;BUT ACS -> SWAP OUT ACS. + HRRZ T,40ADDR(U) ;GET ADDR OF USER'S LOCATION "40" + XCTRI XR,[MOVE T,2(T)] ;TRY TO GET CONTENTS OF "42" (..I SO STOP ON EXEC PG FAULT DOESNT) + SKIPA R,T + JRST INTPFL ;PAGE FAULT IN XCTR, GIVE UP & WAIT FOR PAGE. + ANDI R,-1 + JUMPE R,INTBAD ;42 POINTS TO 0 => BADPI ERROR. + MOVE TT,OPTION(U) + TLNN TT,%OPINT ;NEW STYLE INTERRUPTS? + JRST INTOLD ;NO, OLD STYLE. + XCTRI XR,[MOVE R,(R)] ;GET ADDR OF HIS INT PDL PTR. + CAIA + JRST INTPFL + JUMPGE T,INTBAD + CAMGE T,[-72.*5-1,,] + JRST INTBAD + XCTRI XR,[MOVE H,(R)] ;GET CONTENTS OF INT PDL PTR. + JRST INTSR2 ;ADVANCE T PAST INT PDL PTR ADDR. + JRST INTPFL + +INTSR0: XCTRI XR,[MOVE C,(T)] ;GET THE INTS NEXT INT TABLE ENTRY + SKIPA D,B + JRST INTPFL ;APPLIES TO. + XCTRI XR,[AND D,1(T)] + CAIA + JRST INTPFL + AND C,A ;WHICH OF THEM ARE WE TRYING TO GIVE? + JUMPN C,.+2 + JUMPE D,INTSR1 ;NOT GIVING ANY OF THEM, TRY NEXT ENTRY. + MOVE Q,IDF1(U) ;GET CURRENT SETTINGS OF DEFER WORDS. + XCTRI XW,[MOVEM Q,3(H)] + SKIPA Q,IDF2(U) ;AND PUT INTO NEXT INT PDL FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,4(H)] + SKIPA Q,UPC(U) ;ALSO PUT CURRENT PC IN FRAME. + JRST INTPFL + XCTRI XW,[MOVEM Q,5(H)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE E,2(T)] ;NOW SEE WHICH DEFER BITS TO TURN ON NOW. + CAIA + JRST INTPFL + XCTRI XR,[MOVE TT,3(T)] + CAIA + JRST INTPFL + XCTRI XR,[MOVE Q,4(T)] ;AND THE NEW PC. + TLOA Q,%PCUSR + JRST INTPFL + TLZ Q,BADPC + SKIPGE IOTLSR(U) + TLO Q,%PCUIO ;DON'T CHANGE HIS IOTLSR STATUS. + XCTRI XW,[MOVEM C,1(H)] + CAIA ;PUT INTS BEING GIVEN IN + JRST INTPFL ;INT. PDL FRAME. + XCTRI XW,[MOVEM D,2(H)] + TDZA B,D + JRST INTPFL + MOVE W,H ;REMEMBER PDL PTR BEFORE INCREMENT, FOR PDL OV TESTING + ADD H,[5,,5] + LDB J,[220500,,R] ;HOW MANY ACS SHOULD WE SAVE? + JUMPE J,INTSR5 ;NONE? + HRLS J + ADD H,J ;ADVANCE THE PDL PTR OVER WHERE THEY'LL GO. + SUBM H,J ;GET BACK THE OLD UN-ADVANCED PDL PTR IN J. + ROT R,14 + HRLI J,(R) ;PUT 3.7-4.1 OF R INTO LH(J) CIRCUITOUSLY + TLZ J,777760 + ROT R,-14 + AOS J ;MAKE J POINT AT 1ST UNUSED PDL WORD. + XCTRI XBRW,[BLT J,(H)] + CAIA + JRST INTPFL +INTSR5: JUMPGE R,INTSR4 ;SAVE DEBUGGING INFO ON INT PDL IF USER WISHES + HRRZ J,UPJPC(U) + XCTRI XW,[MOVEM J,1(H)] + SKIPA J,SUUOH(U) + JRST INTPFL + XCTRI XW,[MOVEM J,2(H)] + SKIPA J,LSPCL(U) + JRST INTPFL + XCTRI XW,[MOVEM J,3(H)] + CAIA + JRST INTPFL + ADD H,[3,,3] +INTSR4: MOVE J,U ;MAYBE? SCHED LOOP WANTS USER IDX IN J? + XCTRI XW,[MOVEM H,(R)] ;STORE BACK THE PDL POINTER, THUS FINALIZING ALL + TDZA A,C ;INTS HAVE BEEN GIVEN; NOW WE CAN CHANGE THE USER VARS. + JRST INTPFL + ANDCAM C,PIRQC(U) + ANDCAM D,IFPIR(U) + IORM E,IDF1(U) ;SET THE DEFER BITS SPEC'D IN TABLE ENTRY. + IORM TT,IDF2(U) + MOVEM Q,UPC(U) ;START USER AT INT HANDLER. + JUMPL H,INTSR3 ;NOW CHECK FOR INT PDL OVFLO. + JUMPGE W,INTSR3 + MOVEI TT,%PIPDL ;THERE WAS OVFLO, SET PDL OV INT + TDNN TT,MSKST(U) ;IF ENABLED. + JRST INTSR3 + IORM TT,PIRQC(U) + JRST SEAR2E ;RE-TRY THE INTERRUPT. + +INTSR3: JUMPN A,SEAR2E ;MORE INTS TO GIVE => RETRY. + JUMPN B,SEAR2E +INTSRX: AOS NUINT ;1 MORE INT GIVEN SUCESSFULLY. + SPM UPGML(U) + JRST SEARC ;SCHEDULE. + +INTSR1: ADD T,[4,,4] ;NO INTS GIVEN, TRY NEXT ENTRY. +INTSR2: AOBJN T,INTSR0 + JRST INTSUP ;ENABLED INTS BUT NO ENTRIES FOR THEM. + +;GIVE INTS THE OLD WAY. +INTOLD: SKIPN C,A ;GIVE INTS OF 1 WD AT A TIME. + SKIPA C,B ;(NO 1ST WD, GIVE ALL 2ND WD) + TDZA B,B ;(SOME 1ST WD INTS, GIVE NO 2ND WD INTS) + TLO C,4^5 ;(GIVING 2ND WD, SET SIGN TO SAY SO) + XCTRI XW,[MOVEM C,(T)] + SKIPA Q,UPC(U) ;STORE INTS BEING GIVEN, + JRST INTPFL + MOVEI T,2(T) ;ADVANCE -> PLACE TO START USER. + XCTRI XW,[MOVEM Q,-1(T)] + TLOA T,%PCUSR ;OLD PC STORED, SET UP NEW. + JRST INTPFL + ANDCAM A,PIRQC(U) ;SAY THESE INTS NOW GIVEN. + ANDCAM B,IFPIR(U) + SKIPGE IOTLSR(U) + TLO T,%PCUIO + MOVEM T,UPC(U) ;SET HIS PC -> TSINT+2 + SETZM PICLR(U) + JRST INTSRX + +;IF WE ARE WAITING FOR A PAGE NEEDED FOR TAKING AN INTERRUPT, +;GIVE UP ON TRYING TO TAKE TE INT. UNLESS PAGE HAS COME IN SINCE LAST TRY. +INTPAG: MOVSI E,%SWPGW + SKIPE FLSINS(U) + TDNN E,USWST(U) + JRST (T) ;JOB NOT WAITING FOR PAGE + MOVSI E,%SWINT + TDNN E,USWST(U) + JRST (T) ;NOT WAITING FOR INTERRUPT PAGE + MOVE E,T + MOVE T,EPDL2(U) + XCT FLSINS(U) + JRST SEARL ;PAGE NOT IN + MOVSI T,%SWPGW+%SWINT ;PAGE IN + ANDCAM T,USWST(U) + SETZM FLSINS(U) + SOS NPGWTU + JRST (E) + +;COME HERE WHEN AN XCTRI TAKES FAULT WHILE TRYING TO STORE AN INTERRUPT. +INTPFL: MOVE J,U ;MAYBE? SCHED MAIN LOOP WANTS USR IDX IN J. + SPM UPGML(U) ;STORE MAP IN INTERRUPTING STATE +IFN KA10P, LDB T,[221000,,UPJPC(U)] ;FAULT ADDRESS +IFN KL10P, LDB T,[$PFPNO,,UPFW(U)] +IFN KS10P, LDB T,[$PFPNO,,EPTP7W] ; Fault happened at PI level 7. + ROT T,-1 + ADDI T,UPGCP(U) + SKIPL T + TLOA T,222200 + HRLI T,2200 + LDB E,T + JUMPE E,INTBAD ;DON'T HAVE PAGE +IFN KA10P,[ + HLLZ T,UPQUAN(U) + TLNE T,100 + JRST INTBAB ;WRITE IN RD ONLY +INTBAC: HLLZ T,UPC(U) ;SIMULATE SETUP OF OPC + LSH T,-5 + HRR T,UPC(U) + MOVEM T,UPOPC(U) ;FAULT STATUS + MOVSI T,1000 + IORM T,UPQUAN(U) ;BIT NOT SET BY XCTRI + MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATT + LPMRI UPGML(U) ;SET MPV FLAG, WILL CAUSE INT. LATER LPMR'S WON'T + ; CLEAR IT. + JRST SCHED6 ;"RUN" USER, TAKING PAGE FAULT IMMEDIATELY + +INTBAB: TLNE T,50 ;NO ACCESS OR W IN RWF + JRST INTBAC ;PAGING BOX BUG? IGNORE RD ONLY + JRST INTBAD ;REALLY IS READ-ONLY. +] ;KA10P +IFN KL10P,[ + SUBI T,UPGCP-UPGMP + LDB E,T + TRNE E,600000 + LSH E,-20 + CAIN E,2 ;RWF + JRST INTBAB + MOVS T,UPFW(U) + ANDI T,%PFCOD + CAIE T,%PFPNA + JRST INTBAD ;REAL VIOLATION +;DROPS THROUGH + ;DROPS IN +;KL10P ;PF OR RWF, TAKE THE FAULT, READ IN THE PAGE, THEN TRY TO INTERRUPT AGAIN + +INTBAB: MOVSI T,%SWINT + IORM T,USWST(U) ;PAGE FAULT RESULT OF INTERRUPT ATTEMPT + SETOM DLSRCH ;DON'T INTERRUPT AT INTBA1, SCHEDULE, TRY TO PCLSR + ; WITH WRONG PC + MOVEI T,INTBA1 + EXCH T,UPC(U) ;HACK USER'S PC + MOVEM T,EPDL3(U) + JRST SCHED6 ;RUN USER, RETURNING IMMEDIATELY TO INTBA1 + +INTBA1: CONO PI,PIOFF + SETZM DLSRCH + MOVEM U,PFAILU ;SIMULATE A PAGE FAULT ON THE INTERRUPT WORD + MOVE U,USER + MOVE U,EPDL3(U) + MOVEM U,PFOPC1 ;RESTORE USER'S PC + MOVNI U,2 + MOVEM U,PFAILF ;FLAG FAULT FROM INTPFL + MOVE U,PFAILU ;RESTORE U SO CLKSAV CAN RE-SAVE IT + CONO PI,CLKRQ ;TURN PI SYSTEM ON AND CAUSE CLOCK BREAK + JRST . ;TAKES A WHILE TO GO OFF +] ;KL10P +IFN KS10P,[ + MOVE T,EPTP7W + TLNE T,%PF2.8 ; Write in read only? + JRST INTBAD ; Yes: %PIB42 + MOVEM T,UPFW(U) ; No: Set up for a simulated fault + MOVSI T,%SWINT + IORM T,USWST(U) ; Signal fault as result of interrupt attempt + SETOM PFAILF ; Cause CLK level to go to PFLU2 at + ; first opportunity. + MOVEI T,CCLKRQ ; Make sure that happens real fast + EXCH T,UPC(U) ; by setting his PC thusly. + MOVEM T,EPTPFO ; Save old PC as location of fault. + JRST SCHED6 ; Go run this user. +] ;KS10P + +INTBAD: MOVEI A,%PIB42 ;TURN ON BAD PI LOC INT BIT + IORB A,PIRQC(U) ;GIVE USER INTERRUPT(MUST IORM TO AVOID TIMING ERR) + JRST SEAR2A ;RE-PERFORM ACTIONS FOR NON-ZERO PIRQC + ;WILL CAUSE AN INTERRUPT TO SUPERIOR + +;INTERRUPT ALL USERS THAT WANT IT +; C(A) IS BIT IN PIRQC TO TURN ON +DBGINT: MOVSI A,(%PIDBG) ;"SYS BEING DEBUGGED" INT +INTALL: MOVEI U,0 ;ENTRY INITIALIZE +INTA2: ADDI U,LUBLK ;ADVANCE TO NEXT BLOCK OF USER VARIABLES + CAML U,USRHI ;SKIP UNLESS AT END + POPJ P, ;THROUGH, RETURN + SKIPN UNAME(U) ;SKIP IF BLOCK IN USE + JRST INTA2 ;IDLE, IGNORE + LDB T,[410100,,USTP(U)] ;GET BUCSTP OF USERS STOP WORD + JUMPN T,INTA2 ;IF USER CONTROL STOPPED, JUMP TO IGNORE + MOVE B,MSKST(U) ;PICK UP INTERRUPT MASK + AND B,A ;MASK C(B) TO APPROPRIATE BIT + IORM B,PIRQC(U) ;GIVE INT TO USER + JRST INTA2 ;LOOP + +SUBTTL PCLSR ROUTINES + +; PUT PC OF USER WHOSE INDEX IS IN U IN USER MODE +; (CALL ONLY WITH CLOCK OFF OR CLOCK BREAK IN PROGRESS) +;SKIPS IF SUCCESSFUL, FAILS IF USER RUNNING IN EXEC CODE OR HAS TO BE FINALIZED +; +PCLSR: AOS NPCLSR + CAIG U,L + BUG ;PCLSR'ING NULL, SYS OR CORE JOB? + MOVEI T,L + IDIVM U,T + IMULI T,L + CAMN T,U ;IS U REALLY A MULTIPLE OF LUBLK? + SKIPN UNAME(U) ;SHOULD NOT HAPPEN TO NONEXTANT JOB + BUG + SKIPE USTP(U) + JRST POPJ1 ;USER STOPPED (MUST ALREADY BE IN USER MODE) + AOS NEPCLS + SKIPLE T,RPCL(U) + JRST PCLSR2 ;LOSER IS RPCLSR'ING SOMEONE +PCLSR3: MOVE T,SUEXIT(U) +IFE KA10P,SUB T,U + CAME T,[JRST 2,@XUUOH] + JRST PCLSR5 ;EXIT ALREADY CLOBBERED + MOVE T,UPC(U) ;PICK UP PROGRAM COUNTER (FLAGS IN L.H.) + TLNN T,%PCUSR ;SKIP IF USER MODE ON + JRST PCLSR8 ;JOB CURRENTLY IN EXEC MODE + SOS NEPCLS ;WAS WRONGLY AOS'ED + CLEARM FLSINS(U) ;IN CASE HE WAS WAITING FOR A PAGE OR CIRPSW + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWINT + ANDCAM T,USWST(U) + AOS (P) + POPJ P, + +PCLSR8: SKIPE FLSINS(U) ;SKIP IF UNBLOCKED + JRST PCLSR1 ;HUNG, TRY TO BACK UP TO UUO +PCLSR4: MOVE T,[JRST ONEFLS] + MOVEM T,SUEXIT(U) ;MUNG EXIT OF UUO, COME BACK LATER +PCLSRF: AOS NFPCLS + POPJ P, + +PCLSR2: SETZM RPCL(U) ;CLEAR OUT POINTERS IN BOTH DIRECTIONS + SETZM RPCL(T) + JRST PCLSR3 + +PCLSR5: SKIPN FLSINS(U) + JRST PCLSRF ;NOT HUNG, LET RUN TO COMPLETION +IFN KA10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPROC] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,%PC1PR + IORM T,SUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KA10P +IFN KS10P,[ ;HUNG, UNCLOBBER EXIT AND BACK UP TO UUO + CAME T,[JRST ONEPR4] ;SKIP IF ONE PROCEEDING A SYS CALL + JRST PCLSR6 + MOVSI T,OIPBIT + IORM T,XUUOH(U) ;RESET SINGLE INSTRUCTION PROCEED +PCLSR6:] ;KS10P + MOVE T,UPC(U) + TLNE T,%PCUSR + BUG +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,SUEXIT(U) ;UNCLOBBER EXIT +PCLSR1: HLRZ T,LSPCL(U) ;SAVE LAST TWO DISTINCT LOCS PCLSR'ED FROM + CAIN T,@UPC(U) + JRST PCLSR9 + HRL T,UPC(U) + MOVEM T,LSPCL(U) +PCLSR9: SOS T,SUUOH(U) ;GET USER LOCATION OF HIS CURRENT UUO +UFL5: +IFN KL10P,[ + TLC T,%PS1PR-%PSINH + TLCN T,%PS1PR-%PSINH + TLO T,%PSINH ;ONE PROCEEDING AND INSTR NOT COMPLETE +] ;KL10P + MOVEM T,UPC(U) ;SET USERS PROGRAM COUNTER +IFE KA10P,[ + MOVSI T,701100 ;RESTORE PAGE-CONTEXT TO USER MODE + HLLM T,CLCX(U) +] ;IFE KA10P + CLEARM UMAPS(U) ;RESTORE TO NORMAL MAP + SETZM FLSINS(U) ;CLEAR OUT ANY BLOCKING CONDITION + MOVE T,USWST(U) + TLNE T,%SWPGW + SOS NPGWTU + MOVSI T,%SWPGW+%SWRUN+%SWPCL+%SWINT ;NOT BLOCKED ON PAGE, NOT UNBLOCKED SWAPOUT, + ANDCAM T,USWST(U) ; NOT INTERRUPT PAGE, NOT SWAPPED OUT WHILE BLOCKED + SKIPE T,LSWPR(U) + JRST LSWZAP ;REQUIRED TO UNLOCK SWITCHES +PCLSR7: +IFE KA10P,[ + MOVEI T,UUOACS(U) ;IF JOB U'S ACS ARE IN HARDWARE AC BLOCK 1, + CAMN T,AC1PTR ;COPY THEM INTO UUOACS WHERE THEY BELONG. + XCTR XBR,[BLT T,UUOACS+17(U)] +] ;IFE KA10P + MOVEI T,AC0S(U) + HRLI T,UUOACS(U) + BLT T,AC17S(U) + JRST POPJ1 ;EXIT AFTER BACKING UP TO UUO + ; +; AOS USTP OF USER IN A +; +NJRPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +RPCLSR: CAMN A,USER ;NORMAL ENTRY + POPJ P, ;TRYING TO RPCLSR SELF OR NULL JOB + PCLT + PUSH P,U ;SAVE U + MOVE U,A ;GET INDEX OF RPCLSRED JOB IN U + MOVE A,USER ;GET RPCLSRING USER INDEX IN A + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + PUSHJ P,PCLSR ;PUT USER IN USER MODE + JRST RPCLOS ;JUMP IF CAN'T DO IT RIGHT NOW + AOS USTP(U) ;WIN,STOP USER + CONO PI,CLKON ;RE-ENABLE CLOCK BREAKS +RPCLS1: MOVE A,U ;RESTORE A + POP P,U ;RESTORE U + POPJ P, +; +RPCLOS: SKIPE RPCL(U) ;SKIP IF ZERO RPCL FOR USER BEING RPCLSRED + JRST RPCLS2 ;SOMEONE GOT THERE FIRST + SKIPE RPCL(A) ;SKIP IF ZERO RPCL FOR RPCSRING USER + JRST UDELAY ;YOU ARE BEING RPCLSR'ED, SURRENDER + HRROM A,RPCL(U) ;SET UP RPCL IN VARS OF RPCLSRED USER + HRRM U,RPCL(A) ;" OF RPCLSRING USER + PCLT + SKIPE RPCL(A) ;WILL NOT SKIP AT FIRST + PUSHJ P,UFLS ;WAIT FOR PERSON BEING RPCLSRED TO GET TO ONEFL2 + JRST RPCLS1 +; +RPCLS2: MOVE A,U ;RESTORE A AND U + POP P,U + PCLT + SKIPE RPCL(A) ;WAIT FOR OTHER GUY TO WIN + PUSHJ P,UFLS + JRST RPCLSR ;THEN TRY AGAIN + +; +; UNDO AN RPCLSR +; +NJUPCL: CAIE A,-1 ;ENTRY TO IGNORE IF NULL JOB +UPCLSR: CAMN A,USER ;REGULAR ENTRY + POPJ P, ;TRYING TO UPCLSR SELF OR NULL JOB + SOSGE USTP(A) + BUG + POPJ P, + +IFN KA10P,[ +; +; RETURN FROM SYSTEM CALL IN ONE PROCEED MODE +; +ONEPROC:CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEPR2 +] + +SUBTTL KS-10 ONE-PROCEED + +IFN KS10P,[ +ONEPRO: SYSCTX ;SWITCH TO SYSTEM AC BLOCK + SKIPGE U,USER + BUG AWFUL,[ONE-PROCEED IN NULL JOB] + MOVE T,1PROPC(U) ;PC OF NEXT INSTRUCTION TO EXECUTE + TLNE T,%PSUSR ;NORMALLY USER MODE IS EXPECTED + JRST ONEPR3 + HRRZ T,T ;SEE IF IT'S FIRST INSTRUCTION OF EXEC ENTRY + CAIE T,UUOH0 + CAIN T,MUUOTR + SKIPA TT,[JRST ONEPR4] + BUG AWFUL,[ONE-PROCEED IN EXEC MODE],OCT,1PROPC(U) + MOVEM TT,UEXIT ;CLOBBER EXIT TO RUN SYS CALL TO COMPLETION + CAIE T,UUOH0 ;AND RESUME PROCESSING UUO + JRST [ USRCTX + JRST MUUOTR ] + USRCTX + JRST UUOH0 + +ONEPR3: MOVEM T,UUOH ;PUT USER PC WHERE ONEFLS WANTS IT +ONEPR4: SYSCTX ;COME HERE WHEN ONE-PROC'D UUO FINISHES + MOVE U,USER ;BE SURE U HAS RUNNING USER INDEX IN IT + MOVEI T,%PI1PR + IORM T,PIRQC(U) ;GIVE USER INTERRUPT + JRST ONEFLS +];KS10P + +SUBTTL USER START ROUTINES +; +; CALLED EVERY SLOW CLOCK TICK WHEN TTY WANTING TOP PROCEDURE LOADED +; +USTART: PUSH P,U +USTRT1: SKIPL T,@UTTYO ;GET TTY TO BE STARTED + JRST [ MOVE U,MMPFR ;WHEN STARTING A HACTRN, MAKE SURE CORE IS AVAILABLE + CAIGE U,100 + JRST USTRTL ;IT'S NOT, SAY SYSTEM FULL + JRST .+2 ] ;T HAS INITIAL TTYTBL + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;NOT A REAL TTY, INITIALIZE TTYTBL TO NO TTY + PUSHJ P,USTRA ;CREATE NEW USER SLOT ENTRY + JRST USTSC1 ;LOSE, HAVE TO WAIT + SKIPGE T,@UTTYO ;SKIP IF REALLY A TTY + JRST USTRTS ;DONT LOAD A HACTRN + MOVE T,[SIXBIT /HACTRN/] ;LOAD HACKTRN +USTRT2: MOVEM T,JNAME(U) ;SET JOB NAME + MOVEM T,XJNAME(U) + HRLZI T,%PCUSR + HRRI T,1 + MOVEM T,UPC(U) + MOVEI T,AC0S(U) + HRLI T,NUSTCD + BLT T,AC17S(U) + MOVE T,JNAME(U) + MOVEM T,AC0S+11(U) + SETZM @UTMPTR(U) ;GIVE TEMPORARY HIGH PRIORITY + SETZM USTP(U) ;START UP +USTSC2: AOS T,UTTYO ;AOS RING BUFF + CAIL T,UTTYS+MXCZS + MOVEI T,UTTYS + MOVEM T,UTTYO + SOSE UTTYCT + JRST USTRT1 ;MORE JOBS TO SET UP + JRST POPUJ + +USTRTS: MOVEM U,1(T) ;STORE USER'S INDEX IN SECOND WORD + MOVE T,(T) ;GET JNAME FROM FIRST WORD (POINTED TO BY RH OF @UTTYO) +IFN DEMON,[ + CAME T,[SIXBIT /LDRDEM/] + CAMN T,[SIXBIT /UNSPOO/] + AOS UTMPTR(U) ;LOADER, UNSPOOLER -> SYSTEM TREE +] + JRST USTRT2 + +USTSC1: MOVE U,USRHI ;IF A USER IS ^Z'ING AND THERE IS NO POSSIBILITY + SKIPL T,@UTTYO ;OF GETTING MORE JOB SLOTS, + CAIGE U,LUBLK*MAXJ + JRST POPUJ +USTRTL: MOVSI U,%TANJS ;THEN MARK THE TTY AS IN NEED OF A "SYSTEM FULL" MESSAGE + IORM U,TTYSTA(T) + MOVEI U,SCRCFM ;AND WAKE UP THE SYS JOB. + IORM U,SUPCOR + JRST USTSC2 ;REMOVE THIS TTY FROM LIST OF THOSE NEEDING A ^Z. + +;GOBBLE NEW USER SLOT, RESET VARIABLES (SKIPS IF IT WINS) +;RETURNS INDEX IN U. IF FAILS, CLOBBERS U! +USTRA: MOVEI U,0 +USTR3: CAML U,USRHI + JRST USTR1 ;ASSIGN MORE CORE TO USER STORAGE + SKIPN UNAME(U) + JRST USTR2 ;HAVE FOUND FREE USER SLOT (IN U) + ADDI U,LUBLK + JRST USTR3 + +USTR1: SKIPGE SJCFF + POPJ P, ;SYSTEM JOB FLUSHING CORE, WAIT UNTIL IT STABILIZES + MOVEI U,LUBLK ;MOVE UP USRHI IF SYS HAS ENOUGH CORE + ADD U,USRHI + PUSH P,T + MOVE T,HUSRAD ;LENGTH OF SYS + CAIGE T,USRSTG(U) + JRST MORCOR ;SYS NEEDS MORE CORE FOR USER VARIABLES + POP P,T +USSINI: SETOM USTP-LUBLK(U) ;SYS INITIALIZATION ENTRY + EXCH U,USRHI +USTR2: PUSHJ P,USTR4 ;RESET USER VARIABLES + MOVEI T,SIOCHN-1(U) + MOVEM T,SIOCP(U) + CLEARM IOCHNM(U) + HRLI T,IOCHNM(U) + HRRI T,IOCHNM+1(U) + BLT T,IOCHNM+17(U) ;CLEAR ALL I/O CHANNELS +USRST4: HRLI T,AC0S(U) + HRRI T,AC0S+1(U) + SETZM AC0S(U) + BLT T,AC17S(U) ;CLEAR AC'S & RETURN HAPPY + JRST POPJ1 + +MORCOR: SUB P,[1,,1] + MOVSI T,SCLDEC + ANDCAM T,SUPCOR ;CLEAR ANY SYS CORE DECREASE REQ + MOVSI T,SCLEX + JRST SUPSET ;REQUEST MORE CORE FROM SYS JOB + ; +; INITIALIZE A SET OF USER VARIABLES +; T HAS INITIAL TTYTBL, POSITIVE IT IS TTY # ELSE NO TTY +USTR4: MOVEM T,TTYTBL(U) + JUMPL T,USTR4B + PUSH P,U + HRRM U,TTYSTS(T) ;TELL TTY IT NOW BELONGS TO NEW JOB, + MOVSI U,%TSCNS ;AND IS NOW A CONSOLE. + IORM U,TTYSTS(T) + MOVSI U,%TSFRE + ANDCAM U,TTYSTS(T) ;AND IS NO LONGER FREE + MOVSI U,%TACFM+%TACTZ + ANDCAM U,TTYSTA(T) ;AND WILL NEED CONSOLE FREE MESSAGE + POP P,U + ADDI T,USRRCE +USTR4A: MOVEM T,UTMPTR(U) + HRROI T,'000 + MOVEM T,UNAME(U) + PUSH P,U + MOVE T,U + IDIVI T,LUBLK + POP P,U + DPB T,[000300,,UNAME(U)] + LSH T,-3 + DPB T,[060300,,UNAME(U)] + LSH T,-3 + DPB T,[140300,,UNAME(U)] + MOVE T,UNAME(U) + MOVEM T,XUNAME(U) + MOVEM T,HSNAME(U) + MOVE T,JNAME(U) + MOVEM T,XJNAME(U) + MOVEI T,(U) + HRLI T,%TSCNS + MOVEM T,TTSTSV+2(U) + SETZM USWST(U) +IFN SWPWSP,[ + SETZM UWRKST(U) + SETZM USVWRK(U) + MOVE T,TIME + ADDI T,2*30. ;PROTECT FROM SWAPOUT FOR 2 SECONDS (RANDOMLY) + MOVEM T,USWTIM(U) +];SWPWSP + SETZM NSWPGS(U) + SETZM NMPGS(U) + SETOM JBI(U) ;NOT JOB DEVICE HANDLER (NOT YET, ANYWAY) + SETZM OPTION(U) + SETZM STTYOP(U) + SETOM TRNLST(U) ;INIT TRANSL LISTS TO NIL + SETOM TRNLS1(U) + SETZM HUSRAD(U) + JUMPE U,.+5 ;SYSTEM JOB DOESN'T HAVE A MAP + CLEARM UPGMP(U) + MOVSI T,UPGMP(U) + HRRI T,UPGMP+1(U) + BLT T,UPGCP+NUVPG/2-1(U) + MOVSI T,(MOVEM U,) + HRRI T,AC17S(U) + MOVEM T,SCLUSV(U) +IFE KA10P,[ + MOVSI T,(DATAI PAG,) + HRRI T,CLCX(U) + MOVEM T,SCLCXS(U) + MOVEI T,USRSTG(U) +IFN KL10P, LSH T,-9 + HRLI T,701100 + MOVEM T,CLCX(U) + MOVSI T,(JRST 2,@) + HRRI T,XUUOH(U) + MOVEM T,SUEXIT(U) + MOVSI T,(CAI) ;INITIALLY IGNORE TRAPS 1 AND 2 + MOVEM T,TR1INS(U) + MOVEM T,TR2INS(U) +IFE KS10P,MOVEI T,%PI1PR ;TRAP 3 IS IGNORED TOO ON KS + MOVEM T,TR3INS(U) ;TRAP 3 GIVES ONE-PROCEED INTERRUPT ON KL +] ;IFE KA10P +IFN KL10P,[ + SETZM ULSPBR(U) + MOVSI T,MUUOKN ;UUO NEW PC'S ARE SAME AS SYS JOB'S, + HRRI T,MUUOKN(U) ; EXCEPT THAT UUO IN EXEC MODE IS AN ERROR + BLT T,MUUOPT(U) + MOVEI T,MUUOEX + HRRM T,MUUOKN(U) +] ;KL10P +IFN KS10P,[ + MOVE T,[%PSPCU,,MUUOEX] + MOVEM T,MUUOKN(U) ; UUO in Exec mode is an error + MOVEM T,MUUOKT(U) ; (either case) + HRRI T,UUOH0 + MOVEM T,MUUOCN(U) ; Normal UUO + HRRI T,MUUOTR + MOVEM T,MUUOCT(U) ; UUO as trap instruction + HRRI T,ONEPRO + MOVEM T,1PRNPC(U) ; One-proceed jumps to ONEPRO +] ;KS10P +IFN KA10P,[ + MOVE T,[JRST 2,@UUOH] + MOVEM T,SUEXIT(U) +] ;KA10P + MOVSI T,BUSRC + MOVEM T,USTP(U) + SETOM SUPPRO(U) + SETZM UCLBLK(U) + SETOM UCLBLK+1(U) + MOVE T,[JRST UREALB] + MOVEM T,UCLBLK+2(U) + CLEARM UPGML(U) ;CLEAR USER PG MAP VARIABS + MOVEI T,UPGML+1(U) + HRLI T,-1(T) + BLT T,UPGMLE(U) +IFN KA10P,[ + MOVSI T,1+EXPGNG ;DONT ENABLE QUAN COUNTER FOR NOW (BUT SET + ; EXEC PAGING) + MOVEM T,UPQUAN(U) + MOVE T,EXECMP + MOVEM T,UPDBR3(U) ;SET UP EXEC DBR + MOVSI T,IFN MCOND DM,[1040] .ELSE [0] ;ON DM, B+C MEMORIES DON'T WORK + MOVEM T,UPACP(U) ;SET UP B+C MEMORY PTRS +] ;KA10P +IFN KS10P, SETZM UPQUAN(U) ; Clear quantum counter. + +;DROPS THROUGH + +;DROPS THROUGH, AND .RESET OF USR DEVICE COMES HERE. +USRST2: MOVE T,UNAME(U) + MOVEM T,USYSNM(U) ;CLOCK MUST BE OFF OR PI IN PROG ON 7 + MOVE T,TIME ;DON'T SWAP JOB OUT RIGHT AWAY + MOVEM T,LUBTM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,E + MOVEI C,UCLBLK(U) + SKIPL 1(C) + JSP E,CLQCLR + SETOM SERVER(U) + SETZM PAGAHD(U) + SETZM PAGRAN(U) + SETZM UWHO1(U) + SETZM UWHO2(U) + SETZM UWHO3(U) +IFN N11TYS,[ + SETZM NVDBA(U) ;0 VIDEO BUFFERS ASSIGNED BY JOB. + SETOM TVCREG(U) + SKIPL T,TTYTBL(U) + PUSHJ P,USTTV0 + SETOM TVVBN(U) +USTTV1: ];N11TYS + POP P,E + POP P,C + POP P,B + POP P,A + SETZM URTIME(U) + SETZM UTIME(U) + SETOM RTIMER(U) + MOVSI T,%PCUSR + MOVEM T,UPC(U) + HRLI T,-LUPDL + HRRI T,UPDL-1(U) + MOVEM T,USRPDL(U) + SETZM MSKST(U) + SETZM MSKST2(U) + MOVE T,[20,,40] + MOVEM T,40ADDR(U) + MOVEI T,APRCHN+440 + MOVEM T,APRC(U) + SETZM USTYN(U) + SETZM PIRQC(U) + SETZM IFPIR(U) + SETZM IDF1(U) + SETZM IDF2(U) + SETOM PICLR(U) + SETZM FLSINS(U) + SETZM UTRNTM(U) +IFN KL10P,[ + SETZM EBOXCT(U) + SETZM EBOXCT+1(U) + SETZM MBOXCT(U) + SETZM MBOXCT+1(U) +] + SETZM USIPRQ(U) + SETZM TRUNTM(U) + SETZM TSIPRQ(U) +IFE SWPWSP,[ + SETZM LTRNTM(U) + SETZM LSIPRQ(U) + SETZM UPGSEC(U) +];SWPWSP + SETZM IOTLSR(U) + MOVSI T,%OPOJB ;USR RESET DOESN'T CLEAR OJB OPTION BIT + ANDM T,OPTION(U) + SETOM CORRQ(U) + POPJ P, + +USTR4B: MOVEI T,USRRCE+NCT + JRST USTR4A + +IFN N11TYS,[ +;SET UP THE BLINKER FOR THE JOB IN U. +USTTV0: SKIPN TEN11F + SKIPL TT11P + POPJ P, + HRL T,TTYTYP(T) + TLNN T,%TY11T + POPJ P, ;NOT A TV + MOVE A,TT11HD ;11 HEADER ADR + ADDI A,-NF11TY(T) + LDB B,[141000,,1(A)] ;VIDEO BUFFER # + TRO B,17_8 ;CSET ALU FCTN + LSH B,4+16. ;INTO POSITION FOR MOVEMING INTO CONSOLE REG + MOVEM B,TVVBN(U) + JRST POPJ1 +] ;END IFN N11TYS + +; USER START CODE + +NUSTCD: JFCL ;0 + .OPEN 1,7 + .LOGOUT ;2 + .CALL 12 + .LOGOUT + .IOT 1,2 + JRST (2) + .UII,,(SIXBIT/SYS/) ;7 + SIXBIT /ATSIGN/ + SIXBIT /HACTRN/ + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 + 1 ;17 + +USTCDR: SYSCTX ;GOT HERE FROM ULEAVE WHICH SELECTED THE USER ACS, + MOVE U,USER ; SELECT SYSTEM ACS INSTEAD. + MOVEI A,USTCDR+1 ;COME BACK HERE IN CASE OF PCLSR + MOVEM A,UUOH + MOVE P,USRPDL(U) + PUSHJ P,UBLAM + MOVE U,USER + MOVSI T,NUSTCD + XCTR XBW,[BLT T,17] + MOVE T,JNAME(U) + UMOVEM T,11 + MOVE T,[%PCUSR,,1] + MOVEM T,UUOH + JRST URET + +SUBTTL USER KILL ROUTINES + +; +; CLOSE ALL DEVICES AND INFERIOR PROCEDURES OF A JOB (INDEX IN U) +; +IODCL: MOVNI I,1 ;SET TO STOP + PUSHJ P,IODCL3 ;STOP ALL INFERIOR JOBS (RECURSIVE) + MOVEI I,0 ;THEN KILL. +IODCLA: PUSH P,I + MOVE A,OPTION(U) + TLNE A,%OPLOK ;IF USER HAS ENABLED THE SWITCH-UNLOCK FEATURE, + PUSHJ P,IODCSW ;UNLOCK HIS LOCKED SWITCHES. +IFN 340P\E.SP, PUSHJ P,ADCLOSE ;FLUSH DISPLAY +IFN IMXP, PUSHJ P,POTCLS ;DISCONNECT HIS POTS +IFN VIDP,[ + CAMN U,SCNUSR + PUSHJ P,SCNSTP ;KILL SCANNER IF HIS +] +IFN ARMP, PUSHJ P,AARMOFF ;FLUSH ARM +IFN DEMON, PUSHJ P,DEMOUT ;FLUSH EXISTANCE (CURRENT OR FORMER) AS DAEMON. +IFN N11TYS,[ + SKIPE NVDBA(U) + PUSHJ P,VBDFLS ;DEASSIGN ALL VIDEO BUFFERS. +] +IFN KL10P,[ + CAMN U,MTRUSR ;DEASSIGN THE PERFORMANCE COUNTER + PUSHJ P,PRFOFF +];KL10P + PUSHJ P,CLQDEL ;RELEASE AND STOP CLOCK QUEUE BLOCK + UCLBLK(U) + HRRZ A,UREALT + CAMN A,U + SETOM UREALT ;UN REAL TIME + CAMN U,UMASTER ;UNMASTER + SETOM UMASTER + PUSHJ P,AIOPDL ;POP UP ALL OF IO PDL (CLOSING CHNLS POPPED INTO) + MOVEI R,IOCHNM(U) +IODCL1: PUSHJ P,CCLOSE ;CLOSE ALL CHANNELS + CAIGE R,IOCHNM+NIOCHN-1(U) + AOJA R,IODCL1 + PUSH P,U + SKIPGE T,JBI(U) ;IF THIS JOB IS A JOB-DEVICE, + JRST IODCL2 + HRROS JBCJUI(T) ;TELL THE JOB CHANNEL THAT THE HANDLER IS GONE. + CONO PI,CLKOFF + SKIPGE JBCG(T) ;IF OUR CREATOR STILL HAS A JOB CHANNEL, + JRST IODCL6 + MOVE A,JBCUI(T) ;FLUSH THE CREATOR'S JOB CHANNELS, + CONO PI,CLKON + PUSHJ P,RPCLSR ;STOPPING THE CREATOR IN CASE HE'S USING THEM NOW. + MOVE T,JBI(U) ;RPCLSR CLOBBERS T. + MOVSI C,%CLSJ + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + TDNN C,CLSTB(B) + POPJ P, + HLRZ B,(R) + CAMN B,T + SETZM (R) + POPJ P,] + PUSHJ P,UPCLSR ;ALLOW THE CREATOR TO CONTINUE AND GET IOC ERROR OR RETRY OPEN +IODCL6: CONO PI,CLKON + SETOM JBCUI(T) ;FLUSH THE JOB-DEVICE SLOT. + SETOM JBI(U) ;SAY THIS JOB NO LONGER A JOB-DEVICE. + JRST IODCL2 + +IODCL3: PUSH P,I ;I=0 KILL I=-1 STOP I=1 JUST CLOSE CHANNELS. + PUSH P,U +IODCL2: MOVEI A,0 +IODCL4: HRRZ E,SUPPRO(A) + SKIPE UNAME(A) ;SKIP IF VARIABLES BLOCK IDLE + CAIE E,(U) ;SKIP ONLY IF IT IS A DIRECT INF. + JRST IODCL5 ;TRY NEXT SET OF VARS + PUSH P,A + MOVE U,A + PUSHJ P,1USTOP ;STOP (WITH BUSRC BIT) + MOVE R,P + MOVE P,USRPDL(U) + PUSH P,R + SKIPGE I,-2(R) + JRST IODCL8 ;STOP + PUSHJ P,IODCLA ;KILL OR CLOSE CHNLS, RECURSE +IODCL9: MOVE P,(P) + SKIPE -2(P) ;KILLING? + JRST IODCL7 ;JUST CLOSING CHNLS. + MOVE A,U ;KILLING; WAIT TILL NO OTHER JOB + PUSHJ P,AUCL3 ;IS LOOKING AT THE ONE THAT WE'RE KILLING. + PUSHJ P,UBLST2 ;FLUSH CORE + SETZ R, + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON +IODCL7: POP P,A + HRRZ U,(P) +IODCL5: ADDI A,LUBLK + CAMGE A,USRHI + JRST IODCL4 ;LOOP FOR ALL SETS OF USER VARIABLES + POP P,U + SUB P,[1,,1] + POPJ P, + +IODCL8: PUSHJ P,IODCL3 + JRST IODCL9 + +;SYSTEM CALL UNLOCK. 1 ARG, A JOB SPEC. +;THAT JOB'S LOCKS ARE ALL UNLOCKED. +NUNLOCK: + MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NUNLO1 ;WE'RE CERTAINLY ALLOWED TO WRITE THIS JOB. + JUMPE U,NUNLO1 ;SYSTEM JOB CAN DO IT TO ANYBODY + JSP T,NCORWR ;NOT SURE, SO CHECK. + JRST OPNL31 ;NO, NOT ALLOWED. +NUNLO1: +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + ;THE CALL IS ALLOWED, SO UNLOCK THAT JOB'S LOCKS + CAMN J,USER + JRST NUNLO2 + MOVE A,J ; If not self, + PUSHJ P,RPCLSR ; assure a User mode PC + PUSHJ P,SOSSET + USTP(A) + JRST NUNLO3 + +NUNLO2: MOVE A,UUOH ; If we are asked to unlock + SUBI A,1 ; our own locks, put our PC in + MOVEM A,SRN3(U) ; SRN3 where IODCSW will look for it +NUNLO3: MOVE U,J + MOVE A,OPTION(U) + TLNE A,%OPLOK ; Provided it is using locks at all... + PUSHJ P,IODCSW + CAME U,USER + PUSHJ P,LSWPOP ; USTP + JRST LSWPJ1 ; DIELOK + ; Returns with U clobbered, which seems to be OK for .CALL's? + + +;CALL HERE TO UNLOCK THE SWITCHES A JOB HAS LOCKED (USER IDX IN U). +;LOCATION 43 (ACTUALLY, 3+C(40ADDR)) HAS THE LIST POINTER. 0 IS NIL. +;ANYTHING ELSE POINTS TO 2-WORD BLOCK; THE 1ST WORD IS THE SWITCH OR THE +;ADDRESS OF THE SWITCH. THE RH OF THE SECOND IS THE CDR OF THE LIST. +;THE LH OF THE SECOND IS THE UNLOCK INTRUCTION. THE INDEX FIELD IS IGNORED, +;ONE LEVEL OF INDIRECTION IS PERMITTED, AND THE INSN MUST BE EITHER +;AOS OR SOS WITH 0 IN AC FLD, A LOGICAL INSTRUCTION (TOP 3 BITS = 4), +;A HALFWORD INSTRUCTION, OR A MOVE,MOVN,MOVS,MOVN,ADD OR SUB SERIES INSN, +;OR 0 WHICH MEANS SETOM. ONLY INSNS THAT MODIFY MEMORY ARE USEFUL. +;44 IS AN AOBJN POINTER TO THE CRITICAL RTNS TABLE, OF 2-WORDS ENTRIES. +;THE 1ST WORD EACH IS ,,+1. +;THE SECOND IS THE UNLOCK INSTRUCTION, WITH THE ADDRESS OF THE SWITCH +;IN THE RH (AGAIN, 1 LEVEL OF INDIRECTION IS PERMITTED). +;IF THE PC IS IN THAT RANGE, THE UNLOCK INSN IS EXECUTED. +;43 AND 44 ARE UPDATED DURING PROCESSING TO PREVENT PCLSR LOSSAGE. +;SEE .INFO.;ITS LOCKS + + +;MACRO TO DO XCTR, OR POPJ IF THAT WOULD CAUSE INTERRUPT. +DEFINE XCTRIJ + JSP TT,IODCXC + XCTR!TERMIN + +; IODCSW: Unlock locks for user in U +; User should be stopped so that he is in user mode. +; The only exception is if we are unlocking the locks of the running job, +; in which case the contents of SRN3 will be used as our PC. +; Clobbers just about everything except U. +IODCSW: PUSH P,U + PUSHJ P,IODCS0 ; Do actual work, if any... + MOVE U,USER ; But be sure to always + PUSHJ P,MPLDZ ; restore normal page map of running user. + JRST POPUJ ; And U + +IODCS0: HRRZ J,U + MOVE U,USER ;SET UP MAP TO USER BEING HACKED (IDX IN J). + PUSHJ P,MPLDJ ;LH(J) CLOBBERED, RH SAVED. + HRRZ U,J ;U HAS WHAT IT HAD AT CALL (USR BEING HACKED). + MOVEI C,1000 ;COUNT LENGTH OF LIST SO CIRCULAR LISTS DON'T HANG US UP. + HRRZ E,40ADDR(U) + XCTRIJ XRW,[MOVES B,3(E)] ;GET HIS "43" (AND MAKE SURE IT'S WRITABLE) +IODCS1: JUMPE B,IODCS2 ;REACHED END OF LOCKED SWITCH LIST, MAYBE? + XCTRIJ XR,[HLL B,1(B)] ;MERGE LOCK INSN WITH ADDR OF SWITCH. + PUSHJ P,IODCDO ;EXECUTE THE UNLOCK INSN + POPJ P, ;IODCDO DETECTED MPV OR PUR INTERRUPT. + XCTR XR,[HRRZ B,1(B)] ;REPLACE LIST BY ITS CDR. + UMOVEM B,3(E) + SOJG C,IODCS1 + +IODCS2: XCTRIJ XRW,[MOVES E,4(E)] ;GET JOB'S "44", AND MAKE SURE IT'S WRITEABLE. + HRRZ C,UPC(U) ;GET ITS PC, FOR COMPARISON. + CAMN U,USER ; Except if this is us, + HRRZ C,SRN3(U) ; then unlock PC is in SRN3 + JUMPGE E,CPOPJ ;THERE ARE NO PROTECTED RANGES => DONE. +IODCS3: XCTRIJ XR,[MOVS B,(E)] ;GET BOUNDS OF NEXT PROTECTED RANGE. + CAIGE C,(B) ;IS PC ABOVE LOWER BOUND? + JRST IODCS4 + MOVSS B + CAIL C,(B) ;IS IT BELOW UPPER? + JRST IODCS4 + XCTRIJ XR,[MOVE B,1(E)] ;PC IS IN THIS RANGE; GET UNLOCK INSN + PUSHJ P,IODCDO ;EXECUTE IT + POPJ P, ;NO SKIP => MPV OR PUR INTERRUPT DETECTED. +IODCS4: ADD E,[2,,2] ;CHECK ALL ENTRIES IN CRITICAL RTN TABLE, 1 BY 1. + HRRZ B,40ADDR(U) ;UPDATE 44 SO ENTRIES ALREADY PROCESSED ARE + UMOVEM E,4(B) ;ACTUALLY IN THE TABLE. THIS IS IN CASE PCLSR. + JUMPL E,IODCS3 + POPJ P, + +;PRECEDE AN XCTR WITH JSP TT,IODCXC TO POPJ IF THE XCTR WOULD +;CAUSE AN INTERRUPT (MPV OR PUR). CLOBBERS A,T,Q. +IODCXC: MOVEI A,@(TT) ;GET EFFECTIVE ADDR OF XCTR. + MOVEI A,@(A) ;GET EFFECTIVE ADDR OF XCTR'ED INSN. + LSH A,-10. ;GET PAGE # BEING REFERENCED. + PUSHJ P,UPLC ;SET T = B.P. TO PAGE MAP HALFWORD. CLOBBERS Q. + LDB T,T + TRNE T,600000 ;IF PAGE IS SWAPPED IN, PUT ACCESS BITS IN + LSH T,-20 ;SAME PLACE THEY ARE WHEN SWAPPED OUT (LOW 2 BITS). +;FOLLOWING CODE COMMENTED OUT BECAUSE IT DOESN'T WORK ON THE KL10 XCTR +; TRNE T,2 ;CHANGE CODE 2 (READ-WRITE, NOT WRITTEN) TO 3 (READ-WRITE). +; IORI T,1 +; LSH T,27 ;PUT ACCESS CODE IN AC FIELD, AND TEST +; ANDCA T,(TT) ;AGAINST WHAT THE XCTR WILL TRY TO DO. +; TLNN T,(0 3,) ;ALL DESIRED ACCESS AVAILABLE => +; JRST (TT) ;WE WIN. +; POPJ P, ;ELSE QUIT OUT OF CALLING ROUTINE. +; +;FOLLOWING CODE INSERTED INSTEAD. THIS RELIES ON THE FACT +;THAT ONLY THE FOLLOWING INSTRUCTIONS ARE XCTRIJ'ED: +; BOOLE,HWT,MOVXX,ADDX,SUBX,AOSX,SOSX + MOVE A,@(TT) ;GET INSTRUCTION XCTR'ED + TLC A,300000 + TLCE A,300000 ;SKIP IF AOS OR SOS + TLNE A,002000 ;SKIP IF DOESN'T WRITE IN MEMORY + TRNE T,2 ;INSTRUCTION WRITES, SKIP IF RW OR RWF ACCESS NOT PRESENT + TRNN T,3 ;INSTRUCTION READS, SKIP IF ANY ACCESS PRESENT + POPJ P, ;INSUFFICIENT ACCESS, QUIT OUT OF CALLING ROUTINE + JRST (TT) ;WINNING, GO DO THE XCTR + +;PUSHJ P,IODCDO WITH INSN IN B TO XCTRIJ IT, CHECKING FOR LEGALITY +;AND PERFORMING ONE LEVEL OF INDIRECTION IF THE @ BIT IS SET. +;(WE CAN'T AFFORD AN INFINITE LOOP WHILE KILLING A JOB EVEN IF IT IS +;INTERRUPTABLE) +;INDEX FIELD IS IGNORED. IF THE OPCODE IS 0, SETOM IS USED INSTEAD. +;SKIPS IF INSN IS LEGAL AND DOESN'T CAUSE MPV OR PUR INTERRUPT. +;CLOBBERS A,D,J,T,TT,Q +IODCDO: MOVE J,B ;B IS NOT CLOBBERED. + TLZN J,(@) + JRST IODCD1 + XCTRIJ XR,[HRR J,(J)] ;INDIRECTION IS WANTED; DO IT. +IODCD1: TLNN J,-1 ;IF LH IS 0, REPLACE BY (SETOM) + HRLI J,(SETOM) + LDB A,[271500,,J] + CAIE A,AOS_-27 ;AOS AND SOS ARE LEGAL WITH 0 IN AC FIELD. + CAIN A,SOS_-27 + JRST IODCD2 + LDB A,[410300,,J] + CAIE A,4 ;ALL INSNS WITH 4 IN TOP 3 BITS (LOGICAL INSNS) ARE OK. + CAIN A,5 ;HALFWORD INSTRUCTIONS ALSO OK. + JRST IODCD3 + LDB A,[360600,,J] + CAIE A,MOVE_-36 ;ALL FORMS OF MOVE, MOVS, MOVN AND MOVM OK + CAIN A,MOVN_-36 + JRST IODCD3 + CAIE A,ADD_-36 ;ADD & SUB OK. (OF COURSE, ONLY TO-MEMORY INSNS MAKE SENSE) + POPJ P, +IODCD3: LDB A,[270400,,J] ;AC FIELD NEED NOT BE 0, SO GET CONTENTS OF SPEC'D AC, + UMOVE D,(A) + MOVEI A,D + DPB A,[270400,,J] ;AND MAKE THE INSN USE AC D, WHERE THE VALUE IS. +IODCD2: TLZ J,17 + XCTRIJ XRW,J ;EXECUTE INSN, CHECKING FOR INTERRUPTS. + AOS (P) + POPJ P, + +; FLUSH LAST VESTIGES OF USER +; ELIMINATES ALL POINTERS TO USER & FREES USER VARIABLES (CLOBBERS U TO "USER") +; R, IF NON-ZERO, IS ADDRESS OF CHANNEL NOT TO BE CLOSED UNTIL LAST MINUTE +; (IN CASE PCLSR OUT OF .UCLOSE) + +ZUSER: MOVEI A,(U) ;CLEAR BOTH TRANSLATION LISTS + HRLI A,300000 ;FOR THIS JOB. + PUSHJ P,NTRNC + JFCL + MOVEI A,0 ;AND GET RID OF EXISTING FOREIGN-USER CHANNELS. +ZUSER2: SKIPE UNAME(A) + PUSHJ P,ZUSES ;SEE IF THIS USER HAS ANY POINTERS TO BE FLUSHED + CAMN U,SERVER(A) ; If we were a server for this guy, + SETOM SERVER(A) ; clear it out. + ADDI A,LUBLK + CAMGE A,USRHI + JRST ZUSER2 ;LOOP FOR ALL SETS OF USER VARIABLES + SKIPE R + SETZM (R) + CONO PI,CLKOFF + SKIPE NMPGS(U) ;USER SHOULD HAVE NO MEMORY BY NOW + BUG + SETZM UNAME(U) ;ONLY PLACE THAT UNAME IS ZEROED + SETOM USTP(U) ;SET USTP TO SPEED SEARCH + MOVE A,U ;USER FLUSHED + MOVE U,USER + MOVSI T,SCLDEC + IORM T,SUPCOR ;CAUSE USER VARIABLE BLOCKS DECREASE PROGRAM TO RUN + POPJ P, ;RETURN WITH CLOCK OFF + + +;CALLED BY ADISOWN, NATTACH, NDETACH, ETC. +ZUSES: MOVEI D,%CLSU\%CLSFU\%CLSJI\%CLSJO ;CLSTB BITS FOR CHANNELS TO CLOSE +ZUSES1: PUSH P,B + PUSH P,R + PUSH P,C + MOVE C,R + SETZM B ;CLEAR STOPPED PROC FLAG + PUSHJ P,CHSCAA ;EXECUTE FOLLOWING INST FOR EACH CHANNEL AND I/O PDL SLOT + PUSHJ P,ZACHEK + POP P,C + POP P,R + SKIPE B ;SKIP UNLESSS YOU STOPPED THE PROC + PUSHJ P,UPCLSR ;RESTART USER + JRST POPBJ + +ZACHEK: HLRZ T,(R) ;CHECK FOR CHANNEL TO ZAP + CAME T,U + POPJ P, +ZACHK4: HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,(D) + POPJ P, ;IS IT EITHER TYPE OF USER CHANNEL? OR JOB CHNL? + TRON B,-1 ;SET FLAG + PUSHJ P,RPCLSR ;STOP USER + HRRZ T,(R) + HLRZ T,CLSTB(T) + TRNN T,%CLSFU ;IS IT A FOREIGN USR CHNL? + JRST ZACHK2 ;NO, SUPERIOR OR JOB CHNL. + JUMPG R,ZACHK1 ;IOPDL CHANNEL + MOVEI T,LUBLK ;SEE IF A HAS BEEN CLOBBERED + IDIVM A,T ;(AT LEAST MAKE SURE IT'S A VALID USER INDEX) + IMULI T,LUBLK + CAMN T,A + CAML A,USRHI + BUG + HRRZ T,R ;NORMAL CHANNEL, INTERRUPT ON IT. + SUBI T,IOCHNM(A) + MOVE T,CHNBIT(T) + AND T,MSKST2(A) + IORM T,IFPIR(A) +ZACHK2: CAIE C,(R) ;UNLESS THE ONE NOT TO BE CLOSED UNTIL LAST MINUTE, + SETZM (R) ;FOR ANY KIND OF CHANNEL, CLEAR IT OUT. + POPJ P, + +ZACHK1: MOVEI T,IIOPOP ;FOREIGN USR IN IOPDL SLOT: INTERRUPT WHEN IOPOPPED. + MOVEM T,(R) + POPJ P, + +ZUSLOG: PUSH P,[ZUSER] ;DO LOGUSE THEN ZUSER + +;LOG RUNTIME AND SWAPIN REQUESTS USED BY JOB IN U +;JOB CALLED FOR SHOULD NOT BE CURRENT OR ABLE TO RUN DURING CALL +;JOB SHOULD NOT BE TOP LEVEL EXCEPT WHEN DMNPLO CALLS +; HERE JUST BEFORE SENDING THE USAGE TO THE DEMON +;CLOBBERS T,TT,I + +LOGUSE: MOVN TT,UTRNTM(U) + MOVN T,USIPRQ(U) + EXCH TT,TRUNTM(U) ;AVOID CHARGING FOR THIS USAGE TWICE + EXCH T,TSIPRQ(U) + SUB TT,TRUNTM(U) ;COMPUTE TOTAL USAGE NOT YET CHARGED + SUB T,TSIPRQ(U) + SKIPGE I,SUPPRO(U) ;FIND HIGHEST JOB IN TREE + POPJ P, ;BUT IF TOP LEVEL RETURN WITH USAGE IN TT, T +;THIS IS TO FIND A BUG. -- CStacy, 4/30/82 + CAME I,U ;IS THIS JOB ITS OWN SUPERIOR? + JRST LOGUS1 + BUG PAUSE,[SOME JOB IS ITS OWN SUPERIOR, U AND I=],OCT,U +LOGUS1: SKIPL SUPPRO(I) + JRST [ MOVE I,SUPPRO(I) ? JRST .-1 ] + ADDM TT,TRUNTM(I) ;ADD CHARGES TO TREE'S ACCOUNT + ADDM T,TSIPRQ(I) + POPJ P, + +;DO LOGOUT FOR TREE HEADED BY JOB IN U +;CALLER SHOULD THEN PUSHJ P,DMNPLI TO LOG JOB BACK IN +;THIS IS USED TO KEEP ACCOUNTING STRAIGHT WHEN DETACH, CHUNAME, RELOAD (SIGH) +;IF JOB IS CURRENTLY RUNNING, TIME USED IN CURRENT QUANTUM +;WON'T GET CHARGED THIS TIME AROUND. TOO BAD. +;CLOBBERS T,TT,I,J,D. CALL WITH CLKOFF OR IN PROGRESS. + +LOGUPD: PUSH P,U + MOVE J,UTMPTR(U) + MOVEI U,LUBLK +LOGUP1: ADDI U,LUBLK + CAML U,USRHI + JRST LOGUP2 + CAMN J,UTMPTR(U) ;SKIP JOBS IN OTHER TREES (FOR SPEED) + SKIPGE SUPPRO(U) ;AND SKIP TOP LEVEL JOBS + JRST LOGUP1 + SKIPE UNAME(U) ;DON'T GET CONFUSED BY EMPTY SLOTS + PUSHJ P,LOGUSE ;PROBABLY AN INFERIOR IN TREE LOGGING OUT, UPDATE ACCT + JRST LOGUP1 + +LOGUP2: POP P,U + JRST DMNPLO ;TELL DEMON ABOUT TREE'S USAGE + +SUBTTL USER UUO WAIT (HANG UP) ROUTINE +; DOES NOT WORK FOR XCT T OR FOR X (T) +; THE INSTRUCTION BEFORE THE PUSHJ P,UFLS GETS EXECUTED WITH AN +; ARGUMENT PASSED IN T AND ITS USER INDEX IN U. I BELIEVE IT +; IS ONLY ALLOWED TO BASH T AND A. +; +UFLS: CONSZ PI,77400 + BUG HALT,[UFLS WITH PI IN PROGRESS] + CONO PI,CLKOFF ;DOES NOT ALLOW CLOCK INTS + XCT CLUSAV + SKIPGE U,USER ;GET INDEX OF USER BEING BLOCKED + JRST 4,. ;NULL JOB SHOULD NOT GET BLOCKED + MOVEM T,EPDL2(U) ;SAVE C(T) FOR FLSINS AT PCLSR + MOVEM T,AC16S(U) ;SAVE IN SWAP OUT AC ALSO + POP P,UPC(U) ;WORK FOR INST INDEX OF P + MOVEI T,AC0S(U) + BLT T,AC15S(U) ;STORE REST OF ACS + MOVE T,UPC(U) ;GET PC AT CALL (=CALL+1 ; =SKIP +2) + SKIPA T,-2(T) ;GET POINTER TO SKIP +UFL3: MOVE T,(T) ;GET CONTENTS OF E (WAS AN XCT) + MOVE U,AC17S(U) ;WIN FOR INSNS INDEX OF U. + HRRI T,@T ;CALCULATE E + TLZ T,37 ;CLEAR OUT @ AND INDEX BITS + MOVE U,USER + MOVEM T,FLSINS(U) ;STORE AS BLOCKING CONDITION + TLC T,(XCT) + TLNN T,777740 + JRST UFL3 ;JUMP IF INSTRUCTION WAS XCT + CONO PI,UTCON-1 ;TURN ON ALL PIS EXCEPT CLOCK + MOVSI T,%SWPGW+%SWINT + ANDCAM T,USWST(U) ;CLEAR WAITING FOR PAGE TYPE FLSINS + SKIPGE RPCL(U) ;SKIP IF NOT BEING RPCLSRED + JRST UFL1 ;LOSER IS BEING RPCLSRED +UFL6: MOVE U,AC17S(U) ;FOR CLUSAV TO STORE + SETOM UFLSF + CONO PI,CLKRQ ;CAUSE INTERRUPT TRANSFERING TO CLOCK ROUTINE PI IN + ; PROGRESS +IFE KA10P, JRST . ;ON KL AND KS SEEMS TO TAKE A WHILE TO GO OFF ("I + ; CAN WAIT FOREVER, YOU KNOW") +IFN KA10P, JRST 4,. ;ON KA SHOULD GO OFF RIGHT AWAY + +UFL1: MOVE P,CPDLP ;MUST NOT USE USR PDL SINCE THAT CAN + ;GET CLOBBERED BY LSWDIS VIA UFL5 + ;CLOCK IS OFF, SO CPDLP IS OK +IFN KA10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPROC] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,%PC1PR ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KA10P +IFN KS10P,[ + MOVE T,UEXIT ;PICK UP EXIT INSTR + CAME T,[JRST ONEPR4] ;SKIP IF WAS TRYING TO ONE PROCEED THE UUO + ; THAT HUNG + JRST UFL1A ;NOT ONE PROCEEDING + MOVSI T,OIPBIT ;GET ONE PROCEED BIT + IORM T,UUOH ;TURN IT ON IN PC +UFL1A:] ;KS10P + SOS T,UUOH ;UUOH HAS REAL PC IF UFL5 SKIPS. WILL GET SET BY ONEPR1 + PUSHJ P,UFL5 ;BACK UP TO UUO + JRST UFL6 ;FINALIZATION REQUIRED + MOVE T,RPCL(U) + JRST ONEFL2 ;WIN + +SUBTTL VARIOUS WAIT & LOCK-SWITCH ROUTINES +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH UTCCHN OFF +; +LWAIT1: CONO PI,UTCON ;TURN INTERRUPTS ON +LWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,UTCOFF ;TURN INTERRUPTS OFF + XCT @(P) ;TRY AGAIN + JRST LWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE -1 AND SEIZE IT +; +SWTL: PCLT + MOVEI T,(@) ;ENTRY + HRLM T,(P) ;MAKE PC STORED ON PDL INDIRECT + SKIPGE @(P) ;SKIP IF ALREADY LOCKED + JRST SWTL1 ;NOT LOCKED SO TRY TO GRAB IT + MOVEI T,@(P) ;ADDRESS OF SWITCH + HLRZ T,1(T) ;USER THAT HAS SWITCH + ANDI T,777 + IMULI T,LUBLK + CAMN T,USER ;SKIP IF THIS USER DOESN'T HAVE IT + BUG ;THIS USER ALREADY HAS THAT SWITCH +SWTL1: SKIPL @(P) ;(DO NOT CHANGE TO AOSE) + PUSHJ P,UFLS ;HANG TILL NEGATIVE + CONO PI,CLKOFF + AOSE @(P) + JRST SWTL1 +SWTL2: MOVEI T,@(P) +SWTL3: PUSH P,U + PUSH P,T + MOVE T,USER + IDIVI T,LUBLK + ADDI T,600000 + MOVE U,USER + HRL T,LSWPR(U) + POP P,U + MOVSM T,1(U) + MOVE T,USER + HRRZM U,LSWPR(T) + POP P,U + JRST CLKOJ1 +; +;IF LOCK ALREADY SEIZED, JUST SET UP POINTERS +SWTLZ: MOVEI T,(@) + HRLM T,(P) + JRST SWTL2 + +SWTAD: PCLT ;TRY TO LOCK SWITCH (@NEXT LOCN). IF SUCEED, SKIP EXTRA TIME. + MOVE T,@(P) ;IF FAIL, DO N LSWPOPS (AS SPEC IN 4.6-4.1 OF NEXT WORD) + SKIPGE (T) ;AND WAIT FOR SWITCH TO SEEM TO BE AVAILABLE. + JRST SWTAD1 ;THEN RETURN (NOTE: NOT LOCKING IT). +SWTAD2: TLNN T,77000 + JRST SWTAD3 + PUSH P,T + PUSHJ P,LSWPOP + POP P,T + SUB T,[1000,,] + JRST SWTAD2 + +SWTAD3: SKIPL (T) + PUSHJ P,UFLS + JRST POPJ1 + +SWTAD1: CONO PI,CLKOFF + AOSE (T) + JRST [ CONO PI,CLKON + JRST SWTAD2 ] + AOS (P) ;SKIP OVER FAILURE RETURN + JRST SWTL3 + +; +;WAIT FOR INSTRUCTION AFTER CALL TO SKIP WITH CLKCHN OFF +CWAIT1: CONO PI,CLKON ;TURN CLOCK ON +CWAIT: PCLT + XCT @(P) ;ENTRY, EXECUTE INSTRUCTION + PUSHJ P,UFLS ;HANG TILL INSTRUCTION SKIPS + CONO PI,CLKOFF ;TURN CLOCK OFF + XCT @(P) ;TRY AGAIN + JRST CWAIT1 ;LOSE + JRST POPJ1 ;WIN, RETURN SKIPPING OVER ARG + +; +;WAIT FOR LOCK VAR (@ NEXT LOC) TO BE NON-NEGATIVE AND SEIZE IT +LSWTL: PCLT + MOVEI T,(@) ;IF 4.9 OF NEXT LOCN =1, RETURN WITH UTCOFF + HRLM T,(P) + MOVSI T,400000 + PUSHJ P,LWAIT + SKIPGE @-1(P) + IORM T,@(P) + MOVE T,(P) + SKIPL (T) + CONO PI,UTCON + MOVEI T,@(P) +LSWTL2: PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SWITCH LIST LOCK, DOES NOT WORK FOR SWITCHES POINTED TO INDEX OF A, B, OR D +;FOLLOW BY LIST OF SWITCHES +;4.9-4.4=0 4.3-4.1 0 AOSE SWITCH 1 SIGN SWITCH +SLUGH: PCLT + PUSH P,A + PUSH P,B + PUSH P,D + MOVEI T,AC0S(U) + BLT T,AC0S+17(U) ;FOR SLWAIT FIRST TIME +SLUGH1: HRRZ T,-3(P) ;POINTER TO SWITCH LIST + PUSHJ P,SLWAIT + PUSHJ P,UFLS + HRRZ T,-3(P) +SLUGH2: MOVE A,(T) ;TRY TO LOCK LIST + TLNE A,770000 + JRST SLUWIN ;REACHED END OF LIST + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] + SKIPE B + ADD A,(B) + HRRZS A + CAIL D,2 + BUG + XCT SLLOCK(D) + JRST SLULOS + AOBJP T,SLUGH2 ;LH COUNTS SWITCHES SUCCESSFULLY SEIZED + ;SHOULD NVERE FALL THROUGH +SLWAIT: MOVE A,(T) + TLNE A,770000 + JRST POPJ1 ;WIN + LDB B,[220400,,A] ;INDEX + LDB D,[330300,,A] ;TYPE CODE + JUMPE B,SLWT1 + ADD B,U + ADD A,AC0S(B) +SLWT1: CAIL D,2 + BUG + XCT SLWATT(D) + POPJ P, ;LOSE + AOJA T,SLWAIT ;THAT SWITCH OK, TRY OTHERS + +SLWATT: SKIPL (A) ;WAIT FOR NEG (AOSE SW) + SKIPGE (A) ;WAIT FOR POS (SIGN SW) + +SLUWIN: POP P,D + POP P,B + POP P,A + SUB P,[1,,1] ;"RETURN" BUT NOT INCREMENTED + JRST (T) + +SLLOCK: PUSHJ P,SWTLX + PUSHJ P,LSWTLX + +SLULOS: HLRZ A,T +SLULO2: JUMPE A,SLUGH1 ;NONE SEIZED TRY AGAIN + PUSHJ P,LSWPOP ;RELEASE THOSE SEIZED + SOJA A,SLULO2 + +SWTLX: CONO PI,CLKOFF ;DON'T GO OFF HALF-LOCKED + AOSE (A) + JRST CLKONJ + EXCH A,T + PUSHJ P,SWTL3 + BUG +SWTLX1: EXCH A,T + JRST POPJ1 + +LSWTLX: CONO PI,UTCOFF + SKIPGE (A) + JRST UTCONJ + MOVSI B,400000 + IORM B,(A) + CONO PI,UTCON + EXCH A,T + PUSH P,TT + MOVEI TT,601000 + PUSHJ P,LSWSET + POP P,TT + JRST SWTLX1 + +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING SWITCH +STMSET: PUSH P,TT + MOVEI TT,606000 + JRST COMSET + +IFN 0,[ +;SET UP ROUTINE TO BE CALLED ON PCLSR'ING OUT +FINSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,402000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 +] + +;SET UP ROUTINE TO AOS VARIABLE UPON UNLOCKING SWITCH +AOSSET: PUSH P,TT + MOVEI TT,605000 + JRST COMSET + +;SET UP ROUTINE TO SOS VARIABLE UPON UNLOCKING SWITCH +SOSSET: PUSH P,TT + MOVEI TT,603000 + JRST COMSET + +;SET UP ROUTINE TO SOS LH UPON UNLOCKING SWITCH +;HALT IF SWITCH'S LH EVER BECOMES NEGATIVE +SOLSET: PUSH P,TT + MOVEI TT,607000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING SWITCH +;THAT ROUTINE MAY ONLY CLOBBER A AND T!! IT GETS CALLED +;WITH USER IN U, AND THE JOB'S ACS IN AC0S(U)-AC17S(U) +LOSSET: MOVE T,@(P) + HRLI T,-1(P) + PUSH P,TT + MOVEI TT,602000 + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET UP ROUTINE TO CLEAR SIGN BIT OF VARIABLE UPON UNLOCKING SWITCH +SGNSET: PUSH P,TT + MOVEI TT,601000 + JRST COMSET + +;SET UP ROUTINE TO DO NOTHING UPON UNLOCKING SWITCH +NULSET: PUSH P,TT + MOVEI TT,0 + PUSHJ P,LSWSET + POP P,TT + POPJ P, + +;ROUTINE TO ADD THIS PROCEDURE TO A LIST POINTED TO +;BY THE WORD AFTER THE CALL. UNLOCKING REMOVES IT FROM THE LIST +LSTSET: PUSH P,TT ;LEAVES CLKON + MOVEI TT,604000 + PUSHJ P,LSTST3 + POP P,TT + JRST POPJ1 + +LSTST3: PUSH P,U + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[ +IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSTST2 +] + BUG ;NOT ENOUGH BLOCKS +LSTST2: MOVE T,@-4(P) ;ADDRESS OF HEAD OF LIST + CONO PI,CLKOFF + PUSH P,(T) ;PUSH HEAD OF LIST + POP P,(Q) ;POP INTO LSWB BLOCK + MOVEM Q,(T) + HRLM T,(Q) + MOVE T,(Q) + TRNE T,-1 + HRLM Q,(T) + CONO PI,CLKON + JRST LSWSE3 + +IFN 0,[ +;SET UP ROUTINE TO SETOM VARIABLE UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +STMNPS: PUSH P,TT + MOVEI TT,206000 + JRST COMSET + +;SET UP ROUTINE TO BE CALLED UPON UNLOCKING OF SWITCH +;BY OTHER THAN PCLSRING OUT +LNPSET: PUSH P,TT + MOVEI TT,202000 + JRST COMSET +];END IFN 0 + +COMSET: EXCH TT,(P) + MOVE T,@-1(P) + MOVEI T,@T + EXCH TT,(P) + PUSHJ P,LSWSET + POP P,TT + JRST POPJ1 + +;SET USER LOCK SWITCH BLOCK, WD1 IN T, MODE IN TT +LSWSET: PUSH P,U + MOVE U,USER + PUSH P,Q + MOVEI Q,LSWB0(U) +REPEAT NULBLK,[IFN .RPCNT,ADDI Q,2 + SKIPN 1(Q) + JRST LSWSE2 +] + BUG ;NOT ENOUGH BLOCKS + +LSWSE2: MOVEM T,(Q) +LSWSE3: MOVE T,U + IDIVI T,LUBLK + MOVE U,USER + HRL T,LSWPR(U) + IOR T,TT ;GET TYPE + MOVSM T,1(Q) + HRRZM Q,LSWPR(U) + JRST POPQUJ + +LSWCJ1: AOS (P) ;EXIT TO DO LSWCLR AND SKIP-RETURN. + +;UNLOCK ALL SWITCHES, CALLED BY OPENL, ADISOWN, IOADCR +LSWCLR: PUSH P,T +LSWCL1: +;TEMPORARY CODE ADDED 1/22/80 TO SEE IF THERE ARE ANY MORE OF +;THIS CLASS OF BUGS + CAME U,USER + BUG +;END TEMPORARY CODE + SKIPN T,LSWPR(U) ;MUST HAVE USER IN U + JRST POPTJ + PUSHJ P,LSWPOP + JRST LSWCL1 + +LSWPJ1: AOS (P) +LSWPOP: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWPPP + JRST POPUJ + +LSWPPP: PUSH P,A + PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + POP P,A + POPJ P, + +LSWZAP: PUSH P,U ;FROM PCLSR + PUSH P,A +LSWZP1: PUSH P,T + MOVE A,1(T) + HRRZM A,LSWPR(U) + CAIL T,USRSTG + SETZM 1(T) + PUSHJ P,LSWDIS + POP P,T + HRR U,-1(P) + SKIPE T,LSWPR(U) + JRST LSWZP1 + POP P,A + SUB P,[1,,1] + TLZN U,200000 ;HAS PC BEEN CLOBBERED? ;THIS IS ONLY FOR FINSET R.I.P. + JRST PCLSR7 ;NO + SKIPLE PCLDBM + SETZM LSUUO(U) ;INDICATE OCCURRENCE OF FINSET (WILL MEAN WE HAVEN'T MISSED MARK) + JRST PCLSR4 ;REQUIRED TO START UP ROUTINE + +;-1(P) HAS POINTER TO SWITCH BLOCK TO UNDO. +;A HAS SECOND WORD OF THAT BLOCK. +; 4.9=1 => PERFORM FUNCTION ON PCLSR +; 4.8=1 => PERFORM FUNCTION ON ANY LSWPOP OTHER THAN PCLSR +; 4.1-4.3 => FUNCTION +; 3.1-3.9 USER # LAST LOCKED BY +; 1.1-2.9 LSWPR THREAD + +LSWDIS: LDB T,[330300,,A] ;FUNCTION + TLNE A,400000 ;SKIP IF NOT FOR PCLSR + JUMPGE U,LSWDS1 ;PCLSRED AND 4.9=1 + TLNN A,200000 ;NOT FOR PCLSR OR FOR PCLSR BUT NOT PCLSRED + POPJ P, ;NOT FOR EITHER LSWPOP + JUMPGE U,CPOPJ ;FOR OTHER LSWPOP BUT PCLSRED +LSWDS1: JRST LSWTAB(T) + +LSWTAB: JRST UNSWTL ;0 (AOSE) ALSO USED FOR QUSR + JRST UNLSWT ;1 (SIGN) + JRST ULROUT ;2 (GO TO ROUTINE) + JRST ULAOS ;3 (AOS, SOS) + JRST UNLST ;4 (UNLOCK FROM LIST) + JRST ULSOS ;5 (SOS, AOS) + JRST ULSTM ;6 (SETOM) + JRST ULAOSL ;7 (AOS,SOS LEFT HALF) + +UNSWTL: MOVE T,-1(P) + SETOM (T) + POPJ P, + +ULSTM: MOVE T,@-1(P) + SETOM (T) + POPJ P, + +UNLSWT: MOVE T,@-1(P) + MOVSI A,400000 + ANDCAM A,(T) + POPJ P, + +ULAOSL: MOVE T,@-1(P) + MOVSI A,-1 + ADDB A,(T) + JUMPGE A,CPOPJ + BUG ;OVER-SOS'ED + +ULAOS: MOVE T,@-1(P) + SOS (T) + POPJ P, + +UNLST: SETOM DLSRCH + MOVS T,@-1(P) + HLRM T,(T) + MOVSS T + TRNE T,-1 + HLLM T,(T) + SETZM DLSRCH + POPJ P, + +ULSOS: MOVE T,@-1(P) + AOS (T) + POPJ P, + +ULROUT: MOVE T,@-1(P) + TLNE A,200000 + JRST ULROU1 ;A LOSSET - MAY CLOBBER A OR T; USR INDEX IN U + HRRZM T,UPC(U) ;IT'S A FINSET, EXPECTS THE OLD METHOD OF CALL. + TLNE T,-1 + HLRM T,AC15S(U) +IFE KA10P,[ + MOVSI T,%PSPCU ;IT MIGHT TRY AN XCTR + HLLM T,UPC(U) +] ;IFE KA10P + TLOE U,200000 ;SIGNAL PC CLOBBERED + BUG ;PC TRIED TO BE CLOBBERED TWICE + POPJ P, + +ULROU1: JUMPGE U,(T) ;IF LOSSET, AND LSWPOPPING, + MOVE A,[B,,AC0S+B] + ADDI A,(U) ;PUT THE ACS IN THE AC0S, SINCE + BLT A,AC0S+H(U) ;THAT'S WHERE THEY'LL BE IF CALL LOSSET ROUTINE WHILE PCLSRING. + JRST (T) + +;FIND SWITCH POINTED TO BY WORD AFTER +;PUSHJ P,LSWREM AND UNLOCK IT +LSWREM: PUSH P,T + PUSH P,U + PUSH P,Q + MOVE U,USER + SKIPN U,LSWPR(U) + BUG + HRRZ Q,@-3(P) + MOVEI T,1 +LSWRM1: CAMN U,Q + JRST LSWRM2 + HRRZ U,1(U) + SKIPN U + BUG + AOJA T,LSWRM1 +LSWRM2: POP P,Q + POP P,U + PUSHJ P,LSWPON + AOS -1(P) + JRST POPTJ + +LSWDEL: PUSH P,U ;REMOVE SWITCH FROM HEAD OF LIST + MOVE U,USER ;DO NOT ATTEMPT TO UNLOCK IT + PUSH P,T + SKIPN T,LSWPR(U) + BUG + PUSHJ P,LSWDDD + JRST POPTUJ + +LSWDDD: PUSH P,Q + HRRZ Q,1(T) + HRRZM Q,LSWPR(U) + CAILE T,USRSTG + SETZM 1(T) + POP P,Q + POPJ P, + +;POP C(T)'TH FROB BACK +LSWPON: PUSHJ P,LSWBAK + PUSHJ P,LSWPPP + POPJ P, + +;DELETE C(T)'TH FROB BACK +LSWDLN: PUSHJ P,LSWBAK + PUSHJ P,LSWDDD + POPJ P, + +LSWBAK: PUSH P,U + MOVE U,USER + TLO U,400000 ;SIGNAL NOT PCLSR IN CASE OF LSWPPP + PUSH P,Q + MOVE Q,T + MOVEI T,LSWPR-1(U) + SOJE Q,LSWBA3 ;UNLOCKING FIRST FROB + MOVE T,1(T) + SOJG Q,.-1 +LSWBA2: MOVE Q,T + HRRZ T,1(T) + PUSH P,LSWPR(U) ;DON'T WORRY, YOU CAN'T GET PCLSR'ED JUST BELOW + XCT @-3(P) + HRRZ T,LSWPR(U) + HRRM T,1(Q) + POP P,LSWPR(U) + JRST POPQU1 + +LSWBA3: MOVE T,LSWPR(U) + XCT @-2(P) + JRST POPQU1 + +SUBTTL VARIOUS RETURNS + +PPBAJ1: POP P,B +POPAJ1: AOSA -1(P) +POPBAJ: POP P,B +POPAJ: POP P,A +CPOPJ: POPJ P, + +POPQJ: POP P,Q + POPJ P, + +POPBJ1: AOSA -1(P) +POPCBJ: POP P,C +POPBJ: POP P,B + POPJ P, + +POPJ3: AOS (P) +POPJ2: AOSA (P) +POPCJ1: POP P,C +POPJ1: AOSA (P) +POPCJ: POP P,C + POPJ P, + +POPJJ1: AOS -1(P) +POPJJ: POP P,J + POPJ P, + +POPUJ1: AOSA -1(P) +POPTUJ: POP P,T +POPUJ: POP P,U + POPJ P, + +POPTJ: POP P,T + POPJ P, + +POPTTJ: POP P,TT + POPJ P, + +POPWJ2: AOS -1(P) +POPWJ1: AOS -1(P) +POPWJ: POP P,W + POPJ P, + +PIONJ: CONO PI,PION + POPJ P, + +CKOCJ1: CONO PI,CLKON + JRST POPCJ1 + +CLKOJ1: AOS (P) +CLKONJ: CONO PI,CLKON + POPJ P, + +CKOPJ1: AOS (P) +CLKOPJ: CONO PI,CLKON + JRST LSWPOP + +IFN OMXP,[ +OMXONJ: CONO PI,OMXON + POPJ P, +] + +TTYOJ1: AOS (P) +TTYONJ: CONO PI,TTYON + POPJ P, + +IFN PTRP, PTRONJ:: PTPONJ:: +LPTONJ: CONO PI,LPTON + POPJ P, + +IFN NETP,NETOJ1: +UTCOJ1: AOSA (P) +UTCOAJ: POP P,A +IFN NETP,NETONJ: +UTCONJ: CONO PI,UTCON + POPJ P, + +POPQU1: AOS -2(P) +POPQUJ: POP P,Q + POP P,U + POPJ P, + +POP1J1: AOS -1(P) +POP1J: SUB P,[1,,1] + POPJ P, + +POP2J: SUB P,[2,,2] + POPJ P, + +POP3J1: AOS -3(P) +POP3J: SUB P,[3,,3] + POPJ P, + +POP4J: SUB P,[4,,4] + POPJ P, + +POP7J: SUB P,[2,,2] +POP5J: SUB P,[5,,5] + POPJ P, + +SUBTTL UUO PROCESSOR + +.IOT=UUOMIN +.OPEN=UUOMIN+1_27. +.OPER=UUOMIN+2_27. +.CALL=UUOMIN+3_27. +.USET=UUOMIN+4_27. +.BREAK=UUOMIN+5_27. +.STATUS=UUOMIN+6_27. +.ACCESS=UUOMIN+7_27. + +DEFINE GLOSYM X + IRP Y,,[X] + SQUOZE 4,.!Y + .!Y + TERMIN + TERMIN + +;REPEAT OVER USET NAMES FROM 0 TO 77. + DEFINE USTIRP A + IRPS X,,[UPC VAL TTY FLS UNAME JNAME MASK USTP +PIRQC INTB MEMT SV40 IPIRQ APIRQ SNAME PICLR +MARA MARPC UUOH UIND RUNT MSK2 IFPIR APRC +CNSL UTRP IIFPI AIFPI IMASK AMASK IMSK2 AMSK2 +JPC OPC RTMR HSNAME BCHN MPVA IDF1 ADF1 +IDF2 ADF2 DF1 DF2 OPTION 40ADDR TVCREG +TTST TTS1 TTS2 WHO1 WHO2 WHO3 SUPPRO TR1INS +TR2INS MBOX MBO1 EBOX EBO1 XUNAME XJNAME FTL1 FTL2] +A +TERMIN +TERMIN + +;REPEAT OVER USET NAMES 600 AND UP. + DEFINE USTIR1 A + IRPS X,,[PAGRAN PAGAHD SERVER] + A + TERMIN TERMIN + +;NOTE: OPER'S BELOW ARE 8 PER LINE +; USE UP ILUUO'S BEFORE ADDING TO END +; THE FOLLOWING SHOULD GO AWAY EVENTUALLY +; ITYI (=ITYIC) +; SETMSK (=SUSET) +; WSNAME (=SUSET) +; UPISET (=SUSET) +; RDSW (=DATAI) +; EOFC (OBSOLETE) +DEFINE OPRIRP A + IRPS X,,[ITYI LISTEN SLEEP SETMSK SETM2 DEMON CLOSE +UCLOSE ATTY DTTY IOPUSH IOPOP DCLOSE DSTOP RDTIME +RDSW GUN UDISMT GETSYS IPDP GETLOC SETLOC DISOWN +DWORD DSTEP GENSYM LOGOUT REALT WSNAME UPISET RESET +ARMOVE DCONTIN CBLK ASSIGN DESIGN RTIME RDATE HANG +EOFC IOTLSR RSYSI SUPSET PDTIME ARMRS UBLAT IOPDL +ITYIC MASTER VSTST NETAC NETS REVIVE DIETIM SHUTDN +ARMOFF NDIS FEED EVAL REDEF IFSET UTNAM UINIT +RYEAR RLPDTM RDATIM RCHST RBTC DMPCH SWAP MTAPE +GENNUM NETINT] + A +TERMIN +TERMIN + +DEFINE CALIRP A +IRPS X,,[DISMIS LOSE TRANAD VALUE UTRAN CORE TRAND +DSTART FDELE DSTRTL SUSET LTPEN VSCAN POTSET] +A TERMIN TERMIN + +;THESE ARE THE SYMBOLS USED BY MIDAS AND DDT. THEY ALSO +;EXIST IN SYS:ITS DEFS. +;SYMBOLS SHOULD BE LEFT IN CURRENT ORDER OR DDT WILL LOSE +SYSYMB: USTIRP [SQUOZE 44,.R!X + .IRPCNT] + SQUOZE 44,.RIOC + 100 + SQUOZE 44,.RIOS + 120 + SQUOZE 44,.RIOP + 140 + SQUOZE 44,.RPMAP + 200 + USTIR1 [SQUOZE 44,.R!X + 600+.IRPCNT] + USTIRP [SQUOZE 44,.S!X + 400000+.IRPCNT] + USTIR1 [SQUOZE 44,.S!X + 400600+.IRPCNT] + + GLOSYM [IOT,OPEN,OPER] + +DEFINE DEFSYM X/ +IRPS Z,,[X] +SQUOZE 44,Z +Z +.ISTOP +TERMIN TERMIN + +.INSRT BITS > + +EXPUNG DEFSYM + + ZZ=1 + OPRIRP [IFSN X,ILUUO,[.!X=.OPER ZZ + SQUOZE 4,.!X + .!X] + ZZ==ZZ+1] + +MXOPR==ZZ + + SQUOZE 4,.CALL + .CALL + +CALIRP [ +IFSN X,UNUSD,[ + .!X=.CALL .IRPCNT+1, + SQUOZE 4,.!X + .!X +]] + + GLOSYM [USET,BREAK,STATUS,ACCESS] +SYSYME==.-1 + +;THESE SYMBOLS ARE USED BY DDT, SO THE USER CAN OPEN .PIRQC, ETC. + ;BEGINNING FOR .GETSYS (USYMS) +SYSUSB: +USTIRP [ + SQUOZE 4,.!X + .IRPCNT +] + SQUOZE 4,.IOC + 100 + SQUOZE 4,.IOS + 120 + SQUOZE 4,.IOP + 140 + SQUOZE 4,.PMAP + 200 +USTIR1 [ + SQUOZE 4,.!X + 600+.IRPCNT +] +SYSUSE==.-1 ;END FOR .GETSYS (USYMS) + +;SIXBIT NAME TABLES FOR WHO LINE GENERATION. +;ALSO USED BY PEEK FOR PRINTING OUT JOBS' STATUS. + +OPRSXB: SIXBIT/OPER/ +OPRIRP [ +.1STWD SIXBIT/X/ +] + +CALSXB: SIXBIT/CALL/ +CALIRP [ +.1STWD SIXBIT/X/ +] + SIXBIT/UNUSD/ + +UUOSXB: +IRPS X,,IOT OPEN OPER CALL USET BREAK STATUS ACCESS +.1STWD SIXBIT/X/ +TERMIN +NUUOSX==.-UUOSXB + +;MACRO TO SAVE ACS AS APPROPRIATE FOR OUR CPU, LOAD UP U, +;CHECK VARIOUS ERROR CONDITIONS. + +DEFINE UUOSAV + CONSZ PI,77400 + BUG AWFUL,[UUO WITH PI IN PROGRESS] +IFN KA10P,[ + UMOVEM U,17 ;SAVE 17 + SKIPGE U,USER ;LOAD CURRENT USERS INDEX, + BUG AWFUL,[UUO IN NULL JOB] + UMOVEM T,16 ;SAVE LOC 16 FOR USER + MOVEI T,0 ;HA HA + XCTR XBW,[BLT T,15] ;SAVE REST OF ACS IN USERS SHADOW 0-15 +] ;KA10P +IFE KA10P,[ + SYSCTX + SKIPGE U,USER + BUG AWFUL,[UUO IN NULL JOB] + LDB T,[330300,,MUUOCX(U)] + CAIE T,1 + BUG AWFUL,[UUO WHILE IN AC BLK ],DEC,T +] ;IFE KA10P +TERMIN + +; UUO AND ILLOP TRAP HANDLER +; +;EITHER DISPATCHES TO APPROPRIATE UUO ROUTINE, +; RETURNS CONTROL TO USERS UUO ROUTINE, GOES TO ILLOP, USRTRP, OR USRIOT. +;CODE ON THIS PAGE IS INTERRUPTABLE AT ANY POINT + +;COME HERE TO RETURN A UUO TO THE USER. RESTORES USER ACS W THROUGH U ONLY. +USRUUO: CAIG U,LUBLK + BUG AWFUL,[RETURNABLE UUO FROM SYS OR CORE JOB,PC=],OCT,UUOH + MOVE W,UUOH + TLNN W,%PCUSR + BUG AWFUL,[RETURNABLE UUO FROM EXEC MODE,PC=],OCT,UUOH + HRRZ W,40ADDR(U) + MOVE P,USRPDL(U) ;IN CASE AN XCTR FAULTS. + XCTR XR,[HLRZ H,1(W)] + CAIE H,(JSR) ;ELSE OK ONLY IF OPCODE IN 41 IS 0 OR JSR. + JUMPN H,ILUUO ;THIS IS IN CASE USER IS HANDLING USER-UUO'S WITH PUSHJ + ;AND HIS UUOH ISN'T ABLE TO BE JSR'D TO. + XCTR XR,[HRRZ H,1(W)] + JUMPE H,ILUUO ;0 ISN'T ACCEPTABLE AS UUOH ADDRESS. + MOVE T,FORTY + UMOVEM T,(W) ;ALL IS LEGAL; PLANT UUO INTO USERS "40". + MOVE T,UUOH ;SIMULATE A JSR AT USER'S "41" + UMOVEM T,(H) + AOS H + HRRM H,UUOH ;SET TO RETURN TO USER AT FIRST INSTRUCTION OF UUO HANDLER +IFN KA10P,[ + MOVE U,[W,,W] + XCTR XBR,[BLT U,U] +] ;KA10P +ULEAVE: USRCTX ;SELECT USER MODE AC BLOCK IF NEC. + +EBLK + +;THE FOLLOWING BLOCK OF LOCATIONS IS SWITCHED WITH SOME USER VARS + +UEXIT: JRST 2,@XUUOH ;EXIT FROM UUO (FOR KL-10, POINTS TO APPROPRIATE + ;UPT LOC) + +CLUSAV: MOVEM U,AC17S ;CLOCK SAVE OF U + +IFE KA10P,[ +CLCXSV: DATAI PAG,CLCX ;CLOCK LEVEL CONTEXT SAVE +] ;IFE KA10P + +IFN KA10P,[ +XUUOH: 0 ;UUO AND ILLOP TRAP GETS HERE - UUOH0 MUST BE . + 1. +] ;KA10P + +UEXND:: ;END OF SWAPPED UEXIT BLOCK. + +BBLK + +UUOH0: UUOSAV +MUUOT1: SKIPGE UTRAPM(U) ;IF SUPERIOR WANTS TO CATCH UUOS, THIS IS FATAL INT. + JRST USRTRP + SKIPGE T,FORTY ;PICK UP THE UUO OR ILLOP + JRST USRIOT + CAML T,[UUOMIN] + CAML T,[UUOMAX] + JRST USRUUO ;NOT A SYSTEM CALL, GIVE TO USER +;DROPS THROUGH + ;DROPS IN +;HERE WITH UUO TO BE HANDLED BY SYSTEM IN T +ILLOP1: JUMPN U,UUOH1 + MOVEI Q,0 ;SAVE SYS JOB EXEC MODE LSWPR PNTR + EXCH Q,LSWPR + MOVEM Q,SLSWPR +UUOH1: SKIPE LSWPR(U) + JRST 4,. + MOVEM T,LSUUO(U) ;SAVE UUO FOR DEBUGGING PURPOSES + LSH T,-27. ;RIGHT JUSTIFY OP CODE + SKIPL UUODSP-UUOMIN_-27.(T) + JRST UUOTR3 + MOVE H,OPTION(U) + TLNE H,%OPDEC + JRST USRUUO +UUOTR3: SETZM SYSCVL(U) ;DIDN'T GET INTO SYSTEM VIA .CALL + MOVE P,USRPDL(U) ;SET UP USER PDL + HRRZ C,FORTY ;PICK UP EFFECTIVE ADDRESS OF UUO + LDB R,[270400,,FORTY] ;PICK UP AC FIELD OF UUO + MOVEM R,UUAC(U) ;SAVE AC FLD + PUSHJ P,@UUODSP-UUOMIN_-27.(T) ;DISPATCH ON UUO TYPE + JRST URET ;NORMAL RETURN (NON SKIP) +URETJ1: +IFE KA10P, MOVE U,USER ;(SINCE UUOH IS IN THE USER VARIABLES) + AOS UUOH ;UUO ROUTINE SKIPPED, AOS USER RETURN POINT +URET: MOVE U,USER + MOVE A,PIRQC(U) ;CHECK FOR RETURNING TO USER WITH PCLSR'ING FATAL + ; INT SET. + TDNE A,[BADBTS&#<%PIC.Z\%PIDIS>] ;A FEW BITS ARE FATAL BUT SET + ; ASYNCHRONOUSLY. + JRST [ HRRZ A,UEXIT ;INT SET, MAKE SURE UEXIT IS CLOBBERED + IFN KA10P, CAIE A,ONEPRO ;TO A LOCATION WHICH WILL CHECK PIRQC. + IFN KS10P, CAIE A,ONEPR4 + CAIE A,ONEFLS + BUG + JRST .+1] + SKIPE UMAPS(U) + PUSHJ P,MPLDZ + CAMN U,PCLUSR + SKIPG PCLDBM + JRST URET2 + SKIPL PCLNXT + JRST URPCL1 +URET2: SKIPE LSWPR(U) + BUG + JUMPN U,URETC + MOVEI T,0 ;RESTORE SYS JOB EXEC LSWPR + EXCH T,SLSWPR + MOVEM T,LSWPR +URET1: CONSO PI,1 + BUG ;RETURNING TO USER MODE WITH CLOCK OFF +IFN KA10P,[ + MOVEI U,0 + XCTR XBR,[BLT U,U] ;RESTORE USERS ACS FROM USERS SHADOW 0-17 +] ;KA10P + JRST ULEAVE + +URETC: REPEAT NULBLK/2,[ + SKIPN CONC LSWB,\<2*.RPCNT>,+1(U) + SKIPE CONC LSWB,\<2*.RPCNT+1>,+1(U) + BUG +] + REPEAT NULBLK&1,[ + SKIPE CONC LSWB,\,+1(U) + BUG +] + JRST URET1 + +URPCL1: SKIPN LSUUO(U) + JRST URET2 ;DIDN'T REALLY MISS MARK (DUE TO FINSET) + SETOM PCLNXT ;MISSED MARK, REINITIALIZE + SETZM PCLL + SETZM PCLHSH + JRST URET2 + +UUOTRO: MOVE T,FORTY + JRST UUOH1 + +USRIOT: MOVSI T,(UIOT) ;I/O INST TURNS INTO PSEUDO UUO TO DISPATCH ON + JRST ILLOP1 + +IFE KA10P,[ + +;HANDLE UUOS EXECUTED FOR TRAPS (PDL OV, ARITH OV, ONE PROCEED). +;MOST ARE AS USUAL, BUT OPCODE 0 IORM'S ADDRESS INTO PIRQC. +;NOTE: LOSER IS NOT PERMITTED TO USE OPCODE 0 - SEE USTR1I, ETC. + +MUUOTR: UUOSAV + MOVE T,FORTY + TLNE T,-1 + JRST MUUOT1 ;IF OPCODE ISN'T 0, TREAT UUO NORMALLY (STARTING A + ; ONE PROCEED) + MOVSI A,%PSTR1+%PSTR2 + ANDCAB A,UUOH ;TURN OFF TRAP FLAGS, GET PC + TRNN T,%PIARO + JRST MUUOT2 + TLNE A,%PCFOV ;DISTINGUISH FIXED AND FLOATING OVERFLOW. + TLO T,(%PIFOV) +MUUOT2: MOVE A,MSKST(U) + IOR A,[BADBTS] + AND T,A ;INTS SETTING WHICH AREN'T DISABLED + IORM T,PIRQC(U) + SKIPN PICLR(U) + TDZA A,A + SETCM A,IDF1(U) + IOR A,[BADBTS] ;MASK FOR INTS WHICH AREN'T DEFERRED + TDNE T,A + JRST ONEPR1 ;TAKE INT + JRST URET ;IGNORE INT + +MUUOEX: BUG AWFUL,[MUUO IN EXEC MODE, PC=],OCT,EPT+425 + ;UUO IN EXEC MODE NOT IN SYS JOB + +LUUOEX: 0 + BUG AWFUL,[LUUO IN EXEC MODE,PC=],OCT,LUUOEX + +ILLTRP: 0 + BUG AWFUL,[TRAP IN EXEC MODE,PC=],OCT,ILLTRP +] ;IFE KA10P + +IFN KA10P,[ +EBLK +60H: 0 ;TRAPS FROM 60 +BBLK +60H0: UUOSAV ;IF WE LOSE PROCESSOR HERE, 60 GETS COPIED INTO 40, + ; 60H IS COPIED INTO UUOH, AND UPC GETS MOVED INTO + ; UUOH0. +60HE: CONO PI,CLKOFF + MOVE T,60H + MOVEM T,UUOH + MOVE T,60 + MOVEM T,FORTY + CONO PI,CLKON + JRST MUUOT1 +] ;KA10P + +;COME HERE FROM UEXIT WHEN USER IS BEING PCLSR'ED +; KA10 - ALL USER ACS ARE IN MACHINE ACS AND IN UUOACS +; KL10 & KS10 - ALL USERS ACS ARE IN AC BLOCK 1 + +ONEFLS: CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SYSCTX + MOVE U,USER ;GET INDEX OF CURRENT USER +ONEPR2: SKIPE T,RPCL(U) ;SKIP IF NO RPCLSRING OCCURING + JRST ONEFL2 ;RPCLSRING GOING ON +ONEPR1: MOVE U,USER ;GET INDEX OF CURRENT USER + CONO PI,CLKOFF ;TURN OFF CLOCK BREAKS + SKIPE LSWPR(U) + JRST 4,. + MOVEI T,AC0S(U) ;PUT USER ACS INTO SWAP OUT ACS + XCTR XBR,[BLT T,AC17S(U)] + MOVE T,UUOH + MOVEM T,UPC(U) ;SIMULATE JRST 2,@UUOH +IFN KA10P, MOVE T,[JRST 2,@UUOH] +IFE KA10P,[ + MOVSI T,(JRST 2,@) + HRRI T,UUOH +] ;IFE KA10P + MOVEM T,UEXIT ;RESTORE UEXIT + USRCTX + MOVE U,USER ;AS IF HAD RETURNED TO USER THEN CLKBRK + ;EXCEPT THAT AC'S ARE ALREADY STORED IN AC0S + JRST UFL6 ;RESCHEDULE, ETC + +ONEFL2: JUMPG T,[JRST 4,.] ;LOSEY LOSEY (SHOULD NOT TRY TO EXIT WHILE TRYING TO RPCLSR SOMEONE) + MOVE A,FLSINS(T) ;GET FLSINS OF USER SUPPOSEDLY RPCLSRING YOU + SUBI A,RPCL(T) ;HIS FLSINS SHOULD BE A SKIPE OF HIS RPCL + CAME A,[SKIPE] ;SKIP IF HE HAS THE RIGHT FLSINS + JRST 4,. ;LOSEY LOSEY + CLEARM FLSINS(T) ;ASSURE NO INTERRUPT + SETZM RPCL(U) ;ACS IN UUO ACS CLOCK OFF + AOS USTP(U) ;STOP SELF + SETZM RPCL(T) ;UNHANG LOSER RPCLSR'ING YOU + JRST ONEPR1 + +;ROUTINES TO GIVE THE RUNNING JOB AN INTERRUPT AND ABORT THE CURRENT INSTRUCTION + +TTYLOS: SKIPA T,[%PITTY] ;JOB WHOSE %TBINT IS SET TRIED TO USE ITS TTY WHEN DIDN'T OWN IT +IOADC: MOVEI T,%PIMPV ;I/O UUO MEMORY PROTECT VIOLATION + JRST UUOERR + +ABREAK: MOVEI T,%PIBRK ;.BREAK - INTERRUPT TO SUPERIOR +ILLOP4: IORM T,PIRQC(U) + JRST ONEPR1 + + RADIX 10. +IOCERF: ;ADDRESS OF FIRST IO CHANNEL ERROR +ZZ==NIOTER +IFG ZZ-9,ZZ==9 +REPEAT ZZ,CONC IOCER,\.RPCNT+MIOTER,: JSP T,IOCERX +IFG NIOTER-9,[REPEAT NIOTER-9,CONC IOCR,\.RPCNT+MIOTER+9,: JSP T,IOCERX +] +IFN 0, IOCER1: IOCER2: IOCER3: IOCER4: IOCER5: IOCER6: IOCER7: ;FOR @ +.ALSO IOCER8: IOCER9: IOCR10: IOCR11: IOCR12: IOCR13: IOCR14: + + RADIX 8 +IOCERX: CONSZ PI,77400 + JRST 4,. ;ERR WITH PI IN PROGRESS + SUBI T,IOCER9-9+1 + MOVE U,USER + HRRZ TT,UUAC(U) + DPB TT,[BCHPTR] ;STORE LAST CHNL IN ERROR + ADD TT,U + DPB T,[330600,,IOCHST(TT)] +IOCERR: MOVEI T,%PIIOC + JRST UUOERR + +AILUUO:: +ILUUO: SKIPA T,[%PIILO] ;ILLEGAL SYSTEM UUO +TRPDEV: ;ATTEMPTED USE OF TRAP DEVICE +USRTRP: MOVSI T,(%PITRP) ;SYSTEM UUO IN TRAP MODE + +UUOERR: MOVE U,USER + IORM T,PIRQC(U) ;GIVE USER INT BIT +IOADCR: MOVE U,USER + MOVE T,OPTION(U);PC CLOBBERED TO HERE IF MPV IN EXEC MODE - INTR OUT OF UUO + TLNN T,%OPOPC ;UNLESS USER HAS SAID NOT TO, + AOS UUOH ;UNDO SOS THAT PCLSR'ING WILL DO; PC SHOULD END UP -> AFTER UUO. +UUOER2: CONO PI,CLKON ;THERE HAD BETTER BE A CLASS 1 OR 2 INT. PENDING. + MOVE P,USRPDL(U) + SETZM SCHMNY ;CAUSE FULL SCHEDULE SO INTERRUPT WILL BE SEEN + JFCL ; (IT'S A CROCK TO HAVE TO DO THIS, BUT HARD TO FIX) + PUSHJ P,UFLS ;LET THE INTERRUPT PCLSR US. + JRST 4,. + +UUOER1: MOVE U,USER ;UUOERR ASSUMING %OPOPC + IORM T,PIRQC(U) + JRST UUOER2 + +IFN KA10P,[ +ILEXPF: CONO PI,CLKOFF ;GET HERE AFTER EXEC PAGE FAULT TAKEN ON XCTRI + SPM UPGML(U) + MOVSI A,1770 ;CLEAR FAULT REASON BITS + ANDCAM A,UPQUAN(U) + LPMR UPGML(U) + JRST ILUUO +] ;KA10P +IFE KA10P, ILEXPF==ILUUO ;NO CLEANUP NECESSARY + +;UUO DISPATCH + +;AT DISPATCH TIME, P HAS UPDL, C HAS RH OF 40 +;R HAS AC FIELD OF UUO, U HAS USER INDEX + +UUODSP: SETZ AIOT ;SETZ FLAGS UUO'S TO REFLECT TO USER WHEN %OPDEC OPTIONS + SETZ AOPEN ;IN EFFECT. THEY ARE THE UUOS WHICH OVERLAP DEC + AOPER + ACALL + AUSET + ABREAK + ASTATUS + SETZ AACCESS + SETZ AUIOT +IF2,IFN _-27.+UUODSP-.+1,.ERR LOSE AT UUODSP + +;.CALL IOT +NIOT: CAIL W,3 ;SET IOTBTS TO USER'S 3RD ARG, OR TO 0. + SETZ C, + MOVEM C,IOTBTS(U) + HRRZ C,B ;ADDRESS OF 2ND ARG + SKIPGE SYSCVL(U) + SKIPA C,[SETZ] ;USING OUTPUT ARG INSTEAD OF INPUT, FOR UNIT INPUT MODE + CAIL W,2 + AOSA (P) ;GOING TO SUCCEED NOW + JRST OPNL30 ;NOT ENOUGH ARGS + JRST AIOT1 + +;.IOT +AIOT: SETZM CTLBTS(U) + SETZM IOTBTS(U) + ADDI R,IOCHNM(U) ;GET IOCHNM WD ADDR IN R. +AIOT1: MOVE A,U + IDIVI A,LUBLK + SKIPE B + BUG + HLRZ A,(R) ;PICK UP LEFT HALF (DEVICE DEPENDENT) + HRRZ B,(R) ;PICK UP RIGHT HALF (INDEX INTO IOTTB, ETC.) + MOVE D,IOTTB(B) ;GO TO ROUTINE FOR PARTICULAR DEV AND MODE + TLNE D,%IOTOT+%IOTBK+%IOTSP ;BUT FOR "NORMAL" UNIT MODE INPUT, SPECIAL: + JRST (D) + XCTR XRW,[MOVES (C)] ;MAKE SURE XCTR XW, BELOW WON'T PCLSR. + PUSH P,C + PUSHJ P,(D) ;CALL IOT ROUTINE, EXPECTING VALUE IN W. +AIOT3: JRST AIOT2 ;NOTE AIOT3 MAY BE CHECKED FOR ON PDL. + JRST AIOT2 + +AIOT2: POP P,C + SKIPGE C + SKIPA A,W ;RETURNING IN NEW SYSTEM-CALL STYLE + UMOVEM W,(C) + POPJ P, + +;RANDOM ACCESS + +AACCES: HRRZ A,UUAC(U) + UMOVE B,(C) + MOVE T,['ACCESS] + MOVEM T,LSCALL(U) ;IN CASE PASSED TO JOB DEVICE + MOVEI W,2 + PUSHJ P,NACCES + JRST IOCER8 ;FOR .ACCESS, SIGNAL FAILURE WITH IOC ERROR. + POPJ P, ;ONLY POSSIBLE FAILURE IS CHANNEL NOT OPEN. + +NACCES: MOVEI T,AIOCAL ;GET ,, IN R + MOVSI J,NACCE1 + JRST CHNDCD + +NACCE1: TLNN R,%CLSQ\%CLSU\%CLSFU + JRST OPNL34 + HRRM B,IOCHST-IOCHNM(R) ;STORE USR .ACCESS POINTER + TLNN R,%CLSQ + JRST POPJ1 ;NOT DISK + HLRZ I,(R) + MOVEM B,QRADAD(I) ;STORE ACCESS POINTER FOR DSK + MOVSI D,%QAACC + IORM D,QSRAC(I) ;SET ADR HAS BEEN HACKED FLAG + JRST POPJ1 + +;SIOT SYMBOLIC SYSTEM CALL - IOT A STRING. +; 1ST ARG CHANNEL NUMBER. +; 2ND ARG BYTE POINTER +; 3RD ARG STRING LENGTH +; 4TH (OPTIONAL) ARG DEVICE-INDEPENDENT CONTROL BITS +; CTLBTS DEVICE DEPENDENT CONTROL BITS + +NSIOT: TLNN B,1000 ;OBJECT IF B.P. OR COUNT IS IMMEDIATE. + TLNE C,1000 + JRST OPNL33 + CAIGE W,4 + SETZ D, + MOVEM D,IOTBTS(U) + MOVE D,IOTTB(H) + TLNE D,%IOTBK+%IOTSP ;SIOT ALLOWED ONLY ON UNIT MODE CHANNELS. + JRST OPNL12 ;"MODE NOT AVAILABLE". + XCTR XRW,[MOVES A,(B)] ;ENSURE BYTE POINTER WRITABLE + TLNE A,(@) ;CAN'T HACK BYTE POINTER WITH INDIRECT ADDRESSING + JRST OPNL33 ;MEANINGLESS ARGS + TLNE A,17 + PUSHJ P,NSIOT9 ;HACK INDEXING + XCTR XRW,[MOVES A,(C)] ;ENSURE BYTE COUNT WRITABLE + JUMPLE A,POPAJ1 ;0 BYTES TO BE XFERED => SUCCEED IMMEDIATELY. + HLRZ A,(R) + MOVE TT,B ;IN CASE SPECIAL ROUTINE WANTS TO CALL SIOKT + TLNE D,%IOTBP ;IF THERE'S A SPECIAL DEVICE ROUTINE FOR SIOT, + JRST -1(D) ;GO TO IT. +;THIS CALL IS LEGAL AND ORDINARY. LOOP, CALLING THE UNIT MODE ROUTINE. +NSIOT1: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D ;PUT ALL IMPORTANT INFO ON STACK FOR MAIN LOOP + HRRZS (P) ;TO LOOK AT. + PUSH P,R + TLNN D,%IOTOT + JRST NSIOIL ;INPUT AND OUTPUT PART HERE +NSIOOL: UMOVE A,@-3(P) + IBP A ;THIS HAIR IS TO AVOID INCREMENTING THE USER'S COPY + UMOVE D,(A) ;OF THE BYTE POINTER BEFORE THE BYTE HAS BEEN + HRRI A,D ;FINALLY TAKEN WITH NO POSSIBILITY OF PCLSR'ING OUT. + LDB D,A ;CAN'T USE XCTR XR,[LDB D,A] BECAUSE ON THE KA10 + MOVE C,[SETZ D] ;THAT WOULD USE THE LOSER'S AC A. + MOVE R,(P) + MOVE A,-4(P) ;SET UP ARGS FOR IOT ROUTINE; C HAS ADDR OF VALUE. + PUSHJ P,@-1(P) ;CALL THE IOT ROUTINE. + XCTR XRW,[IBP @-3(P)] ;NOW STEP THE B.P. AND COUNT. + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOOL + JRST NSIOTX + +NSIOIL: UMOVE A,@-3(P) + IBP A ;MAKE SURE NO FAULT IDPB'ING THE BYTE + XCTR XRW,[MOVES (A)] + MOVE R,(P) ;NOW GET THE ARGS FOR THE IOT ROUTINE, + MOVE A,-4(P) + PUSHJ P,@-1(P) ;AND CALL IT, WITH VALUE COMING IN W. + JRST NSIOI3 ;NO SKIP => WE WIN. + JRST NSIOTX ;1 SKIP => THERE'S NO INPUT; RETURN WITHOUT STEPPING B.P. + ;2 SKIPS => THIS BYTE IS THE LAST ONE AVAILABLE. + XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS @-2(P)] + JRST NSIOTX + +NSIOI3: XCTR XBYTE,[IDPB W,@-3(P)] + XCTR XRW,[SOS A,@-2(P)] + JUMPG A,NSIOIL +NSIOTX: SUB P,[5,,5] + JRST POPJ1 + +NSIOT9: EXCH A,R ;INDEXED BYTE POINTER, EVAL INDEX ONCE AND WRITE BACK + PUSHJ P,ASCIND + EXCH A,R + UMOVEM A,(B) + POPJ P, + ; +; ROUTINES TO SIMULATE SOME I/O INSTRUCTIONS WHEN EXECUTED BY USER + +IFE KS10P,[ ; KS10 will never have any devices so we might as well punt + ; this sham right from the start. + +AUIOT: MOVE I,FORTY ;GET I/O INST + ANDI R,7 ;GET IOT TYPE FIELD + LDB J,[320700,,FORTY] + LDB D,[420200,,IOTTYP(R)] + JRST @IOTTYP(R) ;DISPATCH ON TYPE + +IOTTYP: 000000,,IOTTY3 ;BLKI + 000000,,IOTTY2 ;DATAI + 200000,,IOTTY3 ;BLKO + 200000,,IOTTY2 ;DATAO + 600000,,IOTTY2 ;CONO + 400000,,IOTTY2 ;CONI + 400000,,IOTTY1 ;CONSZ + 400000,,IOTTY1 ;CONSO + +IOTTY1: CAIN J,177 ;IF EQ INST WAS 7777XX,,XXXXXX + JRST ILUUO ;USER HAS EXECUTED A SMALL NEGATIVE NUMBER + JRST IOTTY2 + +IOTTY3: +IFN KL10P,[ + MOVE C,DCHNTB(J) + TRNE C,10000 + JRST IOTTY2 ;SPECIAL BLKI THAT IS TREATED LIKE DATAI +] + TLO I,40 ;BLOCK TYPE, TURN ON BIT TO CONVERT TO UNIT + UMOVE C,(I) ;GET BLOCK POINTER + ADD C,[1,,1] ;ADVANCE + TLNE C,-1 ;SKIP IF OVERFLOW + AOS (P) ;CAUSE RETURN TO SKIP + UMOVEM C,(I) ;STORE BACK + HRR I,C ;MODIFY INST ADR TO RH OF BLOCK POINTER +IOTTY2: SKIPL C,DCHNTB(J) + JRST IOTTYA + LSH C,19.(D) + SKIPL C + JRST ILUUO +IOTTYB: XCTR XRW,I ;DO IOT + POPJ P, ;NORMAL RETURN + JRST POPJ1 ;IOT SKIPPED RETURN + +IOTTYA: SKIPGE DCHNTC(J) + JRST ILUUO ;SUSPICIOUS DEVICE + JRST IOTTYB + +] ;IFE KS10P + +IFN KS10P, AUIOT==:ILUUO ; For now. + +IFN 0,[ ; Simple IO instruction simulating for the KS should look + ; like this. Unfortunately XCTR XRW,[APRID 100] clobbers + ; exec location 100. Further investigation is needed + ; before figuring out how to deal with this. + +AUIOT: LDB R,[271500,,FORTY] ; Get opcode and AC. + CAIE R,APRID_-27 ; For now this is the only instruction we + ; simulate on the KS + JRST ILUUO + XCTR XRW,FORTY ; Do it + POPJ P, ; Return normally + JRST POPJ1 ; It skipped (well APRID can't, but perhaps + ; someday something else will) +] ;IFN 0 + +SUBTTL .SUSET, .USET, .CALL USRVAR + +;COMMON CODE FOR USRVAR, TTYVAR, ETC. SYMBOLIC SYSTEM CALLS +;PUSHJ P,VARCAL WITH FIRST ARG DECODED INTO H,I,J,R; B,C,W,U SET UP AS IN .CALL +;NOTE B IS A POINTER TO THE SECOND ARG (IN BLOCK MODE IS WRITTEN BACK) +;POPJS (OR PUSHJS IN THE CASE OF BLOCK MODE) BACK WITH E CONTAINING +;VARIABLE SPEC, D INPUT DATA, W INSTRUCTION TO HACK IT (0 TO READ INTO A, +;OTHERWISE OP D, WITH RH CLEAR WHERE OP IS MOVEM, ANDCAM, ADDM, ETC.) + +VARCAL: HRRZ E,B ;USE 2ND ARG AND NUM OF ARGS TO DETERMINE TYPE OF OPERATION + TLNE B,1000 + JRST VARCA1 ;IMMEDIATE 2ND ARG + UMOVE E,(B) ;GET VALUE OF 2ND ARG + TLC E,777000 + TLCN E,777000 + JRST VARCBL ;BLOCK MODE (2ND ARG LOOKS LIKE AOBJN POINTER) +VARCA1: EXCH D,C ;D GETS 3RD ARG, INPUT DATA + CAIL W,4 + JRST VARCA2 ;JUMP IF IMMEDIATE INSTRUCTION MODE + CAIGE W,3 ;SKIP IF WRITING + TDZA W,W ;W 0 FOR READING + MOVSI W,(MOVEM D,) ;SIMPLE CASE OF WRITING (SEE VARCBL FOR HAIR) + POPJ P, ;CALLER WILL DO OPERATION AND POPJ1 OR OPEN-LOSS + +VARCA2: ADD P,[2,,2] ;IMMEDIATE INSTRUCTION MODE. MAKE STACK SAME AS AT VARCAL. + TLNN C,-1 ;E HAS VARIABLE SPEC + MOVSS C ;C GETS INSTRUCTION + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + JRST POP3J1 ;TAKE GOOD RETURN FROM THE CALL + +VARCBL: PUSH P,J ;BLOCK MODE. SAVE J WHICH SOME SUSETS CLOBBER + PUSH P,B ;SAVE POINTER TO AOBJN POINTER TO SPEC,INSN PAIR LIST + XCTR XRW,[MOVES B,@(P)] ;GET AOBJN POINTER, TEST WRITEABILITY +VARCB1: UMOVE E,(B) ;GET VARIABLE SPEC + UMOVE C,1(B) ;GET "INSTRUCTION" + MOVE J,-1(P) ;GET DECODED FIRST ARG OR WHATEVER (SOME USRVAR ROUTINES CLOBBER J) + PUSHJ P,VARCA3 ;PERFORM THE INSTRUCTION + MOVE B,[2,,2] + XCTR XRW,[ADDB B,@(P)] ;ADVANCE AOBJN POINTER + JUMPL B,VARCB1 ;MORE STUFF TO DO + JRST POP3J1 ;POINTER COUNTED OUT, POP B, J, PUSHJ TO VARCAL + +VARCA3: EXCH C,R ;HERE TO PERFORM INSTRUCTION IN C + TLNE R,37 + PUSHJ P,ASCIND ;EVALUATE INSTRUCTION'S EFFECTIVE ADDRESS + EXCH C,R + LDB B,[410300,,C] ;GET MAJOR PDP10 OPCODE CLASS + JRST @.+1(B) + VARCBE ;0 UUO ILLEGAL + VARCBE ;1 FP/BYTE ILLEGAL + VARCB2 ;2 MOVE/ADD/SUB + VARCBE ;3 CAM ETC. RESERVED FOR .HANGING IN THE FUTURE + VARCB4 ;4 BOOLE + VARCBE ;5 HWT ILLEGAL + VARCB6 ;6 TEST + VARCBE ;7 IOT ILLEGAL + +VARCBE: SUB P,[4,,4] ;POP PUSHJ TO VARCA3, B, J, PUSHJ TO VARCAL + JRST OPNL33 ;BAD ARG + +VARCB6: TLNE C,006000 ;TEST INSTRUCTION - SKIP IF NO SKIP + JRST VARCBE ;SKIPPING TESTS RESERVED FOR FUTURE .HANGS + TLNE C,010000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + TLNE C,001000 ;SKIP IF TDX OR TRX + MOVSS D ;TSX OR TLX + LDB C,[370200,,C] ;GET MODIFICATION TYPE + XCT (C)[JRST VARCBE ;NO MODIFICATION OBVIOUSLY AN ERROR + MOVSI W,(ANDCAM D,) ;TXZ + MOVSI W,(XORM D,) ;TXC + MOVSI W,(IORM D,)] ;TXO + JRST VARCBA + +VARCB4: TLNE C,002000 ;BOOLEAN INSTRUCTION - OK IF RESULT TO AC + JRST VARCBE + TLNN C,001000 ;SKIP IF IMMEDIATE + XCTR XR,[SKIPA D,(C)] + HRRZ D,C + HLLZ W,C ;SET UP OPCODE TO HAVE A+M EXCHANGED + TLZ W,003777 ;AND RESULT TO BE SENT TO MEMORY + TLCE W,030000 + TLCE W,030000 + TLC W,030000 + TLO W,(<002000,,> D,) + JRST VARCBA + +VARCB2: SETZB W,D ;MOVE/ADD/SUB GROUP + HLRZ B,C + CAIN B,(MOVEM) + JRST VARCBB ;SIMPLY READING + TLNE C,002000 + JRST VARCBE ;RESULT MUST BE TO AC + TLZ C,(0 17,) ;CHANGE AC FIELD TO D + TLO C,(0 D,) + TLNE C,060000 ;SKIP IF MOVE GROUP + JRST VARCB5 + XCTR XR,C ;FETCH OPERAND, DO MODIFICATION IF CALLED FOR (MOVN) + MOVSI W,(MOVEM D,) ;OPERATION WILL BE SIMPLE STORE + JRST VARCBA + +VARCB5: TLC C,070000 + TLCE C,070000 + JRST VARCBE ;NOT ADD/SUB + XCTR XR,C ;ADD TO/SUBTRACT FROM ZERO IN D + MOVSI W,(ADDM D,) ;DROP INTO VARCBA + +;HERE WITH E, W, D ALL SET UP FOR WRITING. +VARCBA: PUSHJ P,@-3(P) ;CALL BACK TO CALLER OF VARCAL + JRST POP4J ;LOST, POP PUSHJ TO VARCA3, B, J, VARCAL, TAKE ERR RETURN + POPJ P, ;WON, RETURN FROM VARCA3 + +;HERE WITH E AND W SET UP FOR READING. +VARCBB: PUSH P,C ;SAVE ADDRESS TO BE READ INTO + XCTR XRW,[MOVES (C)] ;NO FAULT. INSURANCE OF WRITEABILITY. + PUSHJ P,@-4(P) ;GET VALUE OF VARIABLE INTO A + JRST POP5J ;LOST POP C, VARCA3, B, J, VARCAL, TAKE ERR RETURN TO USER + POP P,C ;WON, STORE RESULT INTO USER + UMOVEM A,(C) + POPJ P, ;AND RETURN FROM VARCA3 + +USETBT: 420200,,USETL(E) ;BYTE POINTER TO UENTRY FIELD A + 400200,,USETL(E) ; " B + 200200,,USETL(E) ; " C + 160200,,USETL(E) ; " D + +USETRL: 221600,,USETL(E) ;BYTE POINTER TO UENTRY FIELD E + 001600,,USETL(E) ; " F + +;IN EACH UENTRY ENTRY: A IS THE METHOD FOR USET READ +; B IS THE METHOD FOR SUSET READ +; C IS THE METHOD FOR USET SET +; D IS THE METHOD FOR SUSET SET +; E & F ARE USED BY THE METHODS AS LISTED BELOW +;METHOD 0 = ILLEGAL MODE +;METHOD 1 = USE F AS RELATIVE LOC OF VAR +;METHOD 2 = USE E AS ROUTINE TO TRANSFER TO +;METHOD 3 = USE F AS ROUTINE TO TRANSFER TO + +DEFINE UENTRY A,B,C,D,E,F + ZZ==.SUCCESS + A_20+B_16+E,,C_20+D_16+F + IF2 [ + IFN 777774&,[PRINTX /UENTRY A,B,C,D TOO BIG +/] IFN 740000&,[PRINTX /UENTRY E,F TOO BIG +/] IFSE [E!F],[PRINTX /UENTRY E,F NULL +/] ] + .SUCCESS==ZZ + TERMIN + +USETL: UENTRY 1,1,2,0,UPCSET,UPC-USRSTG ;.UPC + UENTRY 1,1,1,1,,VALUE-USRSTG ;.VAL + UENTRY 3,3,2,2,USTTY,URTTY ;.TTY + UENTRY 1,1,0,0,,FLSINS-USRSTG ;.FLS + UENTRY 1,1,0,2,UUNAME,UNAME-USRSTG ;.UNAME + UENTRY 1,1,2,2,UJNAME,JNAME-USRSTG ;.JNAME + UENTRY 1,1,2,2,USMASK,MSKST-USRSTG ;.MASK + UENTRY 1,1,2,0,USTOP,USTP-USRSTG ;.USTP + + UENTRY 1,1,2,2,USPIRQ,PIRQC-USRSTG ;.PIRQC + UENTRY 2,2,0,0,UGSUPR, ;.INTB + UENTRY 1,1,2,2,USMEMT,HUSRAD-USRSTG ;.MEMT + UENTRY 1,1,0,0,,SV40-USRSTG ;.SV40 +REPEAT 2,UENTRY 1,1,2,2,IAPIRQ,PIRQC-USRSTG ;.IPIRQ/.APIRQ + UENTRY 1,1,2,2,USYNST,USYSNM-USRSTG ;.SNAME + UENTRY 1,1,2,2,UPISET,PICLR-USRSTG ;.PICLR + + UENTRY 2,2,3,3,URMAR,USMAR ;.MARA + UENTRY 1,1,1,1,,UMARPC-USRSTG ;.MARPC + UENTRY 1,1,0,0,,SUUOH-USRSTG ;.UUOH + UENTRY 2,2,0,0,UINDEX, ;.UIND + UENTRY 1,2,0,0,UTRNTR,UTRNTM-USRSTG ;.RUNT + UENTRY 1,1,2,2,USMSK2,MSKST2-USRSTG ;.MSK2 + UENTRY 1,1,2,2,USIFPI,IFPIR-USRSTG ;.IFPIR + UENTRY 1,1,0,0,,APRC-USRSTG ;.APRC + + UENTRY 3,3,0,0,,URCNSL ;.CNSL + UENTRY 2,0,3,0,RUTRAP,SUTRAP ;.UTRP +REPEAT 2,UENTRY 1,1,2,2,IAIFPI,IFPIR-USRSTG ;.IIFPI/.AIFPI +REPEAT 2,UENTRY 1,1,2,2,IAMASK,MSKST-USRSTG ;.IMASK/.AMASK +REPEAT 2,UENTRY 1,1,2,2,IAMSK2,MSKST2-USRSTG ;.IMSK2/.AMSK2 + + UENTRY 3,3,2,2,UJPCS,UJPCR, ;.JPC + UENTRY 2,2,0,0,UROPC, ;.OPC + UENTRY 1,1,1,1,,RTIMER-USRSTG ;.RTMR + UENTRY 1,1,1,1,,HSNAME-USRSTG ;.HSNAME +;IFN KL10P,UENTRY 1,1,1,1,,ULSPBR-USRSTG ;.LSPBR +;.ELSE UENTRY 1,1,1,1,,SRN3-USRSTG + UENTRY 2,2,3,3,RUBCHN,SUBCHN, ;.BCHN + UENTRY 2,2,0,0,MPVARD ;.MPVA +REPEAT 2,UENTRY 1,1,2,2,IADF1,IDF1-USRSTG ;.IDF1, .ADF1 + +REPEAT 2,UENTRY 1,1,2,2,IADF2,IDF2-USRSTG ;.IDF2, .ADF2 + UENTRY 1,1,2,2,USDF1,IDF1-USRSTG ;.DF1 + UENTRY 1,1,2,2,USDF2,IDF2-USRSTG ;.DF2 + UENTRY 1,1,1,1,,OPTION-USRSTG ;.OPTION + UENTRY 1,1,1,1,,40ADDR-USRSTG ;.40ADDR +IFE N11TYS, UENTRY 1,1,1,1,,SRN3-USRSTG ;.TVCREG - JOB'S CONSOLE REGISTER CONTENTS +IFN N11TYS, UENTRY 1,1,1,2,STVCRG,TVCREG-USRSTG + UENTRY 1,1,1,1,,TTSTSV+2-USRSTG ;.TTST + + UENTRY 1,1,1,1,,TTSTSV-USRSTG ;.TTS1 + UENTRY 1,1,1,1,,TTSTSV+1-USRSTG ;.TTS2 + UENTRY 1,1,1,1,,UWHO1-USRSTG ;.WHO1 + UENTRY 1,1,1,1,,UWHO2-USRSTG ;.WHO2 + UENTRY 1,1,1,1,,UWHO3-USRSTG ;.WHO3 + UENTRY 3,3,0,0,,RUSUPP ;.SUPPRO +IFN KA10P, UENTRY 2,2,0,0,URTR1I ;.TR1INS +IFE KA10P, UENTRY 1,1,1,1,,TR1INS-USRSTG +IFN KA10P, UENTRY 2,2,0,0,URTR2I ;.TR2INS +IFE KA10P, UENTRY 1,1,1,1,,TR2INS-USRSTG + +IFE KL10P,[ +REPEAT 4,UENTRY 1,1,0,0,,SRN3-USRSTG +] ;IFE KL10P +IFN KL10P,[ + UENTRY 1,0,0,0,,MBOXCT-USRSTG ;.MBOX + UENTRY 1,0,0,0,,MBOXCT+1-USRSTG ;.MBO1 + UENTRY 1,0,0,0,,EBOXCT-USRSTG ;.EBOX + UENTRY 1,0,0,0,,EBOXCT+1-USRSTG ;.EBO1 +] ;KL10P + UENTRY 1,1,1,1,,XUNAME-USRSTG ;.XUNAME (USER'S REAL NAME) + UENTRY 1,1,1,1,,XJNAME-USRSTG ;.XJNAME + UENTRY 1,1,1,1,,SRN4-USRSTG ;.FTL1 + UENTRY 1,1,1,1,,SRN5-USRSTG ;.FTL2 + UENTRY 1,1,1,1,,PAGRAN-USRSTG ;.PAGRANGE + UENTRY 1,1,1,1,,PAGAHD-USRSTG ;.PAGAHEAD + UENTRY 2,2,3,3,URSERV,USSERV ;.SERVER +MXVAL==.-USETL +EXPUNGE UENTRY ;NO MORE UENTRY'S + +MXVAL2==.RADIX 2,CONC [.LENGTH/]\MXVAL-1,/ ;BASE 2 LOG OF TABLE SIZE + +;SIXBIT TABLE OF USER VARIABLE NAMES. MUST BE IN CORRECT ORDER, +;SAME AS SYSCTB. + +USETTB: SIXBIT/ADF1/ + SIXBIT/ADF2/ + SIXBIT/AIFPIR/ + SIXBIT/AMASK/ + SIXBIT/AMSK2/ + SIXBIT/APIRQC/ + SIXBIT/APRC/ + SIXBIT/BCHN/ + SIXBIT/CNSL/ + SIXBIT/DF1/ + SIXBIT/DF2/ + SIXBIT/EBO1/ + SIXBIT/EBOX/ + SIXBIT/FLS/ + SIXBIT/FTL1/ + SIXBIT/FTL2/ + SIXBIT/HSNAME/ + SIXBIT/IDF1/ + SIXBIT/IDF2/ + SIXBIT/IFPIR/ + SIXBIT/IIFPIR/ + SIXBIT/IMASK/ + SIXBIT/IMSK2/ + SIXBIT/INTB/ + SIXBIT/IPIRQC/ + SIXBIT/JNAME/ + SIXBIT/JPC/ + SIXBIT/MARA/ + SIXBIT/MARPC/ + SIXBIT/MASK/ + SIXBIT/MBO1/ + SIXBIT/MBOX/ + SIXBIT/MEMT/ + SIXBIT/MPVA/ + SIXBIT/MSK2/ + SIXBIT/OPC/ + SIXBIT/OPTION/ + SIXBIT/PAGAHE/ + SIXBIT/PAGRAN/ + SIXBIT/PICLR/ + SIXBIT/PIRQC/ + SIXBIT/RTMR/ + SIXBIT/RUNT/ + SIXBIT/SERVER/ + SIXBIT/SNAME/ + SIXBIT/SUPPRO/ + SIXBIT/SV40/ + SIXBIT/TR1INS/ + SIXBIT/TR2INS/ + SIXBIT/TTS1/ + SIXBIT/TTS2/ + SIXBIT/TTST/ + SIXBIT/TTY/ + SIXBIT/TVCREG/ + SIXBIT/UIND/ + SIXBIT/UNAME/ + SIXBIT/UPC/ + SIXBIT/USTP/ + SIXBIT/UTRP/ + SIXBIT/UUOH/ + SIXBIT/VAL/ + SIXBIT/WHO1/ + SIXBIT/WHO2/ + SIXBIT/WHO3/ + SIXBIT/XJNAME/ + SIXBIT/XUNAME/ + SIXBIT/40ADDR/ +IFN .-USETTB-MXVAL, .ERR USETTB INCONSISTENT WITH USETL +REPEAT 1_--1, -1 ;PAD TO POWER OF 2 WITH PLUS INFINITY + +;THE FOLLOWING TABLE IS PARALLEL TO USETTB AND GIVES THE NUMERIC USET CODE +;WHICH SHOULD BE IN THE RANGE 0 - 77 OR 600 AND UP. +USETBN: 47 ;.ADF1 + 51 ;.ADF2 + 33 ;.AIFPI + 35 ;.AMASK + 37 ;.AMSK2 + 15 ;.APIRQ + 27 ;.APRC + 44 ;.BCHN + 30 ;.CNSL + 52 ;.DF1 + 53 ;.DF2 + 73 ;.EBO1 + 72 ;.EBOX + 3 ;.FLS + 76 ;.FTL1 + 77 ;.FTL2 + 43 ;.HSNAME + 46 ;.IDF1 + 50 ;.IDF2 + 26 ;.IFPIR + 32 ;.IIFPI + 34 ;.IMASK + 36 ;.IMSK2 + 11 ;.INTB + 14 ;.IPIRQ + 5 ;.JNAME + 40 ;.JPC + 20 ;.MARA + 21 ;.MARPC + 6 ;.MASK + 71 ;.MBO1 + 70 ;.MBOX + 12 ;.MEMT + 45 ;.MPVA + 25 ;.MSK2 + 41 ;.OPC + 54 ;.OPTION + 601 ;.PAGAHE + 600 ;.PAGRAN + 17 ;.PICLR + 10 ;.PIRQC + 42 ;.RTMR + 24 ;.RUNT + 602 ;.SERVER + 16 ;.SNAME + 65 ;.SUPPRO + 13 ;.SV40 + 66 ;.TR1INS + 67 ;.TR2INS + 60 ;.TTS1 + 61 ;.TTS2 + 57 ;.TTST + 2 ;.TTY + 56 ;.TVCREG + 23 ;.UIND + 4 ;.UNAME + 0 ;.UPC + 7 ;.USTP + 31 ;.UTRP + 22 ;.UUOH + 1 ;.VAL + 62 ;.WHO1 + 63 ;.WHO2 + 64 ;.WHO3 + 75 ;.XJNAME + 74 ;.XUNAME + 55 ;.40ADDR +IFN .-USETBN-MXVAL, .ERR USETBN INCONSISTENT WITH USETL + +;.CALL USRVAR HACK USER VARIABLES. +;ARG 1 - SPEC +;ARG 2 - AOBJN PNTR FOR BLOCK MODE OR 0,,USER-VAR-NUMBER OR SIXBIT/USER-VAR-NAME/ +;ARG 3 - DATA IF WRITING AND NOT IN BLOCK MODE. (OPTIONAL) +;ARG 4 - IMMEDIATE INSTRUCTION, OVERRIDES ARG 3. (OPTIONAL) +;VAL 1 - DATA IF READING AND NOT IN BLOCK MODE + +NUSRVA: MOVE J,A ;DECODE FIRST ARG + JSP T,NCORUI ;GET JOB AND LOCK ITS DIELOK + JRST NUSRV0 ;DEFINITELY WRITEABLE + JSP T,NCORWR ;NOT SURE, CHECK FURTHER + TLO J,(SETZ) ;SET WRITE PROTECT BIT +NUSRV0: +IFN PDP6P,[ + TRNE J,400000 + PUSHJ P,NULSET +] + PUSHJ P,NUSRV5 ;DO IT + POPJ P, ;LOST + JRST LSWPJ1 ;WON, UNLOCK DIELOK AND TAKE SUCCESS RETURN + +NUSRV5: PUSHJ P,VARCAL ;DECODE ARGS, HACK BLOCK MODE, SET E, W, D. +NUSRV3: SETZB B,I ;ENTER HERE FROM .USET AND .SUSET + TLNN E,-1 ;NOW DECODE USER VARIABLE SPEC + JRST NUSRV1 ;JUMP IF OLD STYLE NUMERIC SPEC +REPEAT MXVAL2,[ ;SIXBIT SPEC LOOK UP IN TABLE + CAML E,USETTB+1_(B) + ADDI B,1_ +] + CAMN E,USETTB(B) + CAIL B,MXVAL + JRST OPNL11 ;ILLEGAL USER VARIABLE NAME + MOVE E,USETBN(B) ;TRANSLATE TO NUMERIC SPEC +NUSRV1: JUMPE W,NUSRV2 ;READING + JUMPL J,OPNL31 ;WRITING AND WRITE PROTECTED + MOVEI I,2 ;MAGIC INDEX 1.2=R/W 1.1=OTHER/SELF +NUSRV2: CAIN U,(J) + IORI I,1 +IFN PDP6P,[ + HRRE B,J + AOJE B,PDPPMT ;USER IS PDP6 +] + CAIL E,600 + JRST [ SUBI E,500 + JRST NUSRV4] + CAIL E,100 + JRST AUSET2 ;100 TO 577 ARE .IOC, .IOS, .IOP, .PMAP VARS. +NUSRV4: CAIL E,MXVAL ;DETECT USET CODE BEYOND 6XX MAXIMUM. + JRST OPNL11 + LDB B,USETBT(I) ;GET METHOD BITS + SOJL B,OPNL12 ;VARIABLE NOT AVAILABLE THIS MODE (WRITE PROTECT?) + SOJL B,AUSVAR ;SIMPLE VARIABLE + LDB B,USETRL(B) ;GET ADDRESS OF ROUTINE TO CALL + HRRZ A,J ;SOME ROUTINES WANT USER INDEX IN A + JUMPE W,(B) + CAMN W,[MOVEM D,] + JRST (B) + PUSH P,D ;READ/ALTER/REWRITE + PUSH P,E + PUSH P,I + PUSH P,W + PUSH P,J + TRZ I,2 ;FIRST READ IT + MOVEI W,0 + PUSHJ P,NUSRV4 + JRST POP5J ;READ LOST + POP P,J + POP P,W + POP P,I + POP P,E + POP P,D + HRRI W,A + XCT W ;MODIFY THE VALUE IN A + MOVE D,A + MOVSI W,(MOVEM D,) + JRST NUSRV4 ;THEN WRITE IT BACK + +; +; .SUSET [N,,LOC] ;SAME AS .USET (SEE BELOW) BUT REFERS TO SELF +; +ASUSET: HRRZ J,U ;JOB TO BE HACKED IS SELF + SETZM UUAC(U) ;IF ERROR, RETURN LOSS IN .IOS+0 + JRST AUSET0 + +; ;IF N&200000=1, BLOCK MODE +; .USET CH,[N,,LOC] ;IF N&400000=0, READS USER VAR SPECIFIED BY REST OF N + ; FOR INFERIOR OR FOREIGN USER OPEN ON CHANNEL CH + ; INTO USER LOCATION LOC + ;IF N&400000.NE.0, SETS USER VAR SPECIFIED BY REST OF N + ; FOR DIRECTLY INFERIOR USER OPEN ON CHANNEL CH + ; FROM USER LOCATION LOC +AUSET: MOVE J,R ;DECODE AC FIELD AS CHANNEL NUMBER + PUSHJ P,AUSETJ + JRST IOCER7 ;USR OP CHNL DOES NOT HAVE USR OPEN +AUSET0: XCTR XR,[HRRZ B,(C)] ;GET ADDRESS READING INTO OR WRITING FROM + XCTR XR,[HLRZ E,(C)] ;GET VARIABLE AND DIRECTION + TRNE E,200000 + JRST ABUSET ;BLOCK MODE + TRZN E,400000 + JRST AUSET1 ;JUMP IF READING + JUMPL J,IOCER7 ;WRITE PROTECT VIOLATION + MOVSI W,(MOVEM D,) ;FLAG WRITING + UMOVE D,(B) ;GET DATA TO WRITE + PUSHJ P,NUSRV3 ;DO THE WRITE + JRST ILUUO ;LOST + POPJ P, + +;BLOCK-MODE .USET +ABUSET: TRNE E,400000 + TLOE J,(MOVE) ;SET BLOCK BIT + JRST ILUUO ;BLOCK IN BLOCK LOSES + UMOVE Q,(C) ;GET AOBJN PTR AGAIN +ABUST2: UMOVEM Q,(C) ;STORE AWAY UPDATED POINTER + PUSH P,C + PUSH P,J + MOVE C,Q + PUSHJ P,AUSET0 + POP P,J + POP P,C + UMOVE Q,(C) + AOBJN Q,ABUST2 + POPJ P, + +AUSET1: MOVEI W,0 ;FLAG READING + XCTR XRW,[MOVES (B)] ;ENSURE WRITEABILITY + PUSH P,B + PUSHJ P,NUSRV3 ;GET VALUE OF VARIABLE INTO A + JRST ILUUO ;LOST + POP P,J +APTUAJ: UMOVEM A,(J) + POPJ P, + +;DECODE ARG FOR USET +AUSETJ: JSP T,NCRUI2 + JRST POPJ1 + JSP T,NCORWR + TLO J,(SETZ) + JRST POPJ1 + +AUSVAR: LDB C,USETRL+1 ;GET ADDRESS OF VARIABLE + ADDI C,USRSTG(J) + JUMPE W,[MOVE A,(C) + JRST POPJ1] + HRR W,C + XCT W + JRST POPJ1 + +IFN PDP6P,[ +PDPPMT: MOVEI A,%JSSIX#%JSNUM ;PDP6 HAS ONLY A FEW VARIABLES, WHICH ARE READ-ONLY + CAIN E,.RUIND + JRST POPJ1 + MOVEI A,LPDP6M*2000 ;FIXED MEM BOUND FOR PDP-6 + CAIN E,.RMEMT + JRST POPJ1 + JRST POPJ1 ;IGNORE OTHER VARIABLES +] + +;VARIABLES 100 - 577 (.IOC, .IOS, .IOP, .PMAP) +AUSET2: JUMPN W,OPNL31 ;JUMP IF TRYING TO WRITE + SUBI E,100 + CAIL E,40 + JRST AUSET4 ;>140=>.RIOP+M + TRZE E,20 + JRST AUSET3 ;117.RIOS+M + ADDI E,IOCHNM(J) ;77.RIOC+M +AUSETX: MOVE A,(E) ;GET VAR + JRST POPJ1 + +AUSET3: MOVE R,J ;INFERIOR USER INDEX + ADDI R,IOCHNM(E) ;GET CHANNEL POINTER + MOVE H,(R) + JRST NSTATUS ;DO A .CALL STATUS + +AUSET4: CAIL E,40+LUIOP ;COMPARE AGAINST LAST IO PDL LOC + JRST AUSET5 ;READ MAP ENTRY + ADDI E,SIOCHN-40(J) ;MAKE UP POINTER TO VAR + JRST AUSETX + +;USET VARIABLE 200+N -- READ MAP VARIABLE FOR PAGE N. +; (0 <= N < 400) E CONTAINS N+100. + +;VALUE OF MAP WORD READ: + +;4.9 - PAGE WRITEABLE. +;4.8 - PAGE EXISTS (IF THIS OFF, WHOLE WORD IS 0) +;4.7 - PAGE IS IN CORE. +;4.6 - PAGE IS PUBLIC (ANYONE CAN WRITE IT) + +;3.1 - 3.9 - # TIMES PAGE SHARED (LIKE CORTYP'S 4TH VALUE'S RH) +;2.1 - 2.9 - ABS PAGE # OR PAGE # IN NEXT SHARER +; (LIKE CORTYP'S 3RD VALUE) +;1.1 - 1.9 - 0 => ABS PAGE (OR NO PAGE, OF COURSE) +; -1 => UNSHARED PAGE, +; ELSE USR NUM. OF NEXT SHARER. + +AUSET5: CAIGE E,100 + JRST OPNL11 + PUSHJ P,SWTL + CIRPSW ;DON'T LET PAGE TABLES CHANGE. + MOVEI A,-100(E) ;PAGE NUMBER IN JOB. + PUSH P,J + PUSHJ P,NCORT0 ;PUT CORTYP'S VALUES IN A THRU D. + POP P,J + PUSHJ P,LSWPOP ;FREE CIRPSW. + ANDI B,777 ;CORTYP'S 2ND VALUE IN 1.1 - 1.9 + DPB C,[111100,,B] ;3RD VALUE IN 2.1 - 2.9 + TLO B,(D) ;4TH VALUE RH INTO 3.1-3.9 + LSH D,-20. + TLO B,(D) ;4TH VAL BITS 4.8-4.9 INTO 4.6-4.7 + IOR A,B ;TOGETHER WITH 1ST VALUE'S 4.8, 4.9. + JRST POPJ1 + +USTOP: AOS (P) ;GOING TO WIN + JUMPN D,1USTOP ;NONZERO VALUE => STOP THE JOB. + MOVE B,APRC(A) ;ZERO => START. + TLNE B,BULGOS ;BUT DON'T EVER START A JOB THAT'S BEING KILLED. + POPJ P, + JRST 1USTRT + +1USTOP: MOVNI D,1 ;SET TO STOP +1USTRT: PUSHJ P,RPCLSR ;STOP USER IN A + DPB D,[.BP BUSRC_22,USTP(A)] ;BUSRC +IFN SWPWSP,[ + EXCH U,A + PUSHJ P,LVLOAD + EXCH U,A +];SWPWSP + JRST UPCLSR + +;SET INFERIOR'S PC +UPCSET: PUSHJ P,RPCLSR ;STOP USER IN USER MODE + TLO D,%PCUSR ;BE SURE USER MODE IS ON IN NEW PC + TLZ D,BADPC ;BE SURE PRIVILEGED BITS ARE OFF + SKIPGE IOTLSR(A) ;SKIP UNLESS USER IS SUPPOSED TO BE IN IOT-USER MODE + TLO D,%PCUIO ;TURN ON IOT-USER MODE + MOVEM D,UPC(A) ;SET PC + PUSHJ P,UPCLSR ;RESTART + JRST POPJ1 + +UJPCS: CAIN U,(A) ;SET .JPC, WITH CARE IF SETTING OWN + SPM UPGML(U) + HRRM D,UPJPC(A) + CAIN U,(A) + LPMR UPGML(U) + JRST POPJ1 + +UJPCR: CAIN U,(A) ;READ .JPC: + SPM UPGML(U) ;IF READING ONE'S OWN, MAKE SURE IT'S UP TO DATE. + HRRZ A,UPJPC(A) + JRST POPJ1 + +IFN KA10P,[ +UROPC: HLLZ A,UPOPC(J) + LSH A,5 + HRR A,UPOPC(J) + JRST POPJ1 +] ;KA10P +IFE KA10P, UROPC: JRST OPNL12 ;.OPC NOT SUPPORTED ON KL AND KS ((CAN'T + ; USE == DUE TO FWD REF)) + +IFN N11TYS,[ ;SET OWN TV CONSOLE REGISTER +STVCRG: MOVEM D,TVCREG(U) ;ENABLE TVCREG TO BE SWAPPED IN AND OUT OF HARDWARE + JUMPL D,POPJ1 ;IF TURNING ON; OR, IF TURNING OFF, ALL DONE + SKIPGE TT11P ;ALLOWED TO TOUCH HARDWARE? + SKIPE TEN11F + CAIA + MOVEM D,400000+TTR10*2000 ;UPDATE REG IN HARDWARE + MOVEM D,TVCREG(U) ;AND UPDATE AGAIN IN SOFTWARE IN CASE CLOBBERED AT SSTVR2 + JRST POPJ1 +] + +IFE KS10P,[ ; KS10 doesn't have a MAR and it never will... + +;READ MAR +URMAR: MOVE A,UPMAR(J) +IFN KA10P, TLZ A,777770 +IFN KL10P, LDB B,[270400,,A] +IFN KL10P, HRL A,MARPTB(B) + JRST POPJ1 + +;SET MAR +USMAR: CONO PI,CLKOFF ;TURN OFF CLOCK INTERRUPTS + CAMN J,USER + SPM UPGML(J) ;STORE PG VARIABLES IF HACKING CURRENT USER +IFN KA10P,[ + TLZ D,777770 + TLO D,4 ;SET USER MODE +] ;KA10P +IFN KL10P,[ + LDB B,[220400,,D] + HLL D,MARPTB(B) +] ;KL10P + MOVEM D,UPMAR(J) + CAMN J,USER + LPMR UPGML(J) ;USE LPMR BECAUSE KL10 DOESN'T HAVE VANILLA LPM + JRST CLKOJ1 + +IFN KL10P,[ ;MAR PERMUTATION TABLE. MAYBE CAN DO BETTER???? ***** + +MARPTB: 0 1, 0 ;OFF ;NONE (EXEC) + 0 11, 0 ;FETCH ;NONE (USER) + 0 3, 2 ;WRITE ;WRITE(EXEC) + 0 17, 6 ;ANY ;WRITE (USER) + 0 1, 10 ;OFF ;READ (EXEC) + 0 11, 14 ;FETCH ;READ (USER) + 0 3, 12 ;WRITE ;NOT FETCH (EXEC) + 0 17, 16 ;ANY ;NOT FETCH (USER) + 0 5, 1 ;READ ;FETCH (EXEC) + 0 15, 5 ;READ+FETCH ;FETCH (USER) + 0 7, 13 ;NOT FETCH ;NOT READ (EXEC) + 0 13, 17 ;NOT READ ;NOT READ (USER) + 0 5, 11 ;READ ;READ+FETCH (EXEC) + 0 15, 15 ;READ+FETCH ;READ+FETCH (USER) + 0 7, 3 ;NOT FETCH ;ANY (EXEC) + 0 13, 7 ;NOT READ ;ANY (USER) +] ;KL10P +] ;IFE KS10P + +IFN KS10P,[ +URMAR: +USMAR: JRST OPNL12 +] ;KS10P + +RUSUPP: HRRE A,SUPPRO(J) ;READ SUPERIOR'S USER INDEX + JUMPL A,POPJ1 ;-1 => TOP LEVEL +UINDEX: IDIVI A,LUBLK ;GET INDEX NUMBER + JRST POPJ1 ;GIVE TO USER + +;READ OWN RUN TIME +UTRNTR: CONO PI,CLKOFF +IFN KA10P,[ + SPM UPGML(U) + LDB A,[2300,,UPQUAN(U)] + LSH A,-2 ;SIMULATE 4.069 USEC CLOCK +] ;KA10P +IFN KL10P,[ + SKIPL MTRUSR ;SKIP IF PERFORMANCE METER AVAILABLE + JRST [ RMBOXC A ;REQUIRES AC ORDER - A,B,C,D,E + DSUB A,STMBOX + DMUL A,KLMBCC ;BECAUSE DMUL PRODUCES FOUR WORD RESULT + REBOXC D + DSUB D,STEBOX + DADD B,D + DMUL B,KLEBCC + MOVE A,D + JRST UTRNT1 ] + RPERFC A + DSUB A,STPERF + DIVI A,50.*4096. +UTRNT1: +] ;KL10P +IFN KS10P,[ + SPM UPGML(U) + LDB A,[400400,,UPQUAN(U)] ; 3.9 USEC CLOCK +] ;KS10P + ADD A,UTRNTM(U) + JRST CLKOJ1 + +;SET JOB'S TTYTBL (.TTY VARIABLE). +USTTY: CONO PI,CLKOFF ;PREVENT TIMING ERROR. + HLLZ E,TTYTBL(J) ;GET CURRENT VALUE + XOR E,D ;GET WHICH BITS USER WANTS TO CHANGE + AND E,[%TBNVR+%TBINT+%TBWAT+%TBOUT+%TBINF+%TBIIN+%TBOIG,,] ;GET BITS USER IS ALLOWED TO CHANGE + TRNE I,1 + TLZ E,%TBWAT ;THESE BITS CAN BE ALTERED ONLY BY THE SUPERIOR + XORM E,TTYTBL(J) ;ALTER THE USER-CONTROLLED BITS WITHOUT WRITING THE OTHERS. + JRST CLKOJ1 + +;READ JOB'S TTYTBL (.TTY) VARIABLE +URTTY: CONO PI,CLKOFF + HRRZ A,TTYTBL(J) + SKIPGE TTYTBL(J) + IDIVI A,LUBLK + HLL A,TTYTBL(J) + JRST CLKOJ1 + +;READ JOB'S .CNSL VARIABLE - TTY# OF TREE'S CONSOLE +URCNSL: MOVE A,UTMPTR(J) + SUBI A,USRRCE + CAIL A,NCT + SUBI A,NCT+2 ;DISOWNED -1 SYS -2 + JRST POPJ1 + +UJNAME: JUMPE D,OPNL33 ;SET INFERIOR'S JNAME + CAME D,[SIXBIT/PDP6/] + CAMN D,[SIXBIT/PDP10/] + JRST OPNL33 ;CHANGING TO ILLEGAL NAME + CAIN I,3 ;.SUSET? + JRST UJNAMS ;YES... + PUSHJ P,RPCLSR + PUSHJ P,UJNAMU ;IS NEW JNAME UNIQUE? + JRST UJNAMG ;NO + MOVEM D,JNAME(A) ;YES + CONO PI,CLKON + PUSHJ P,UPCLSR + JRST POPJ1 + +UJNAMU: MOVE B,UNAME(A) + MOVEI E,0 + CONO PI,CLKOFF +UJNAM1: CAME B,UNAME(E) + JRST UJNAMF + CAMN D,JNAME(E) + POPJ P, +UJNAMF: ADDI E,LUBLK + CAMGE E,USRHI + JRST UJNAM1 + JRST POPJ1 + +UJNAMG: PUSHJ P,UPCLSR + CAME A,E + JRST OPNL13 ;DUPLICATE NAME + JRST CLKOJ1 ;WASN'T REALLY CHANGING THE NAME + +UUNAME: HLRE I,D ;SET OWN UNAME + AOJE I,OPNL33 ;CHECK FOR ILLEGAL ___nnn UNAME + SKIPA I,U +UJNAMS: SETO I, ;SET OWN JNAME + JUMPE D,OPNL33 ;CHECK FOR EVIL NAMES + CAME A,U ;SELF? + BUG ;SOMETHING SCREWED + SKIPL SUPPRO(U) + JRST OPNL40 ;MUST BE TOP LEVEL + CONO PI,CLKOFF ;TURN CLOCK OFF NOW SO WE DON'T GET REOWNED OR SOMETHING + SKIPL I + SKIPA C,JNAME(U) ;CHANGING UNAME, KEEPING JNAME + SKIPA C,UNAME(U) ;VICE VERSA + EXCH D,C ;NOW C=UNAME, D=JNAME + MOVEI E,0 ;CHECK FOR DUPLICATE NAMES +UUNAM0: SKIPE UNAME(E) + CAMN E,U ;ALLOW SETTING TO SAME NAME AS BEFORE + JRST UUNAM1 + HRRZ A,SUPPRO(E) + CAMN C,UNAME(E) + CAME D,JNAME(E) + CAMN A,I ;JOB CAN'T HAVE INFERIORS IF SETTING UNAME + JRST OPNL13 ;OR DUPLICATE U-JNAME IF SETTING EITHER +UUNAM1: ADDI E,LUBLK + CAMGE E,USRHI + JRST UUNAM0 + CAMN C,UNAME(U) + CAME D,JNAME(U) + SKIPA A,D ;D GETS CLOBBERED + JRST CLKOJ1 ;THE NAMES WEREN'T ACTUALLY CHANGED! (SYNCOM DOES IT). + CAME C,UNAME(U) ;IF NOT LOGGED IN, AND CHANGING UNAME, + SKIPGE TTYTBL(U) ; AND CONSOLE-CONTROLLED, + JRST UUNAM3 + HLLO J,UNAME(U) + AOJN J,UUNAM2 + AOS SUSRS ;DISGUST! SHOULD BE USING LOGIN +UUNAM2: HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / CHUNAM /] + PUSHJ P,SGWAIT ;REQUEST SYSTEM JOB TO PRINT OUR MSG + MOVEM C,SLGIV+2 ;INCLUDE NEW UNAME AS SECOND NAME +UUNAM3: PUSHJ P,LOGUPD ;CHARGE OLD NAME FOR USAGE SO FAR + MOVEM C,UNAME(U) ;THEN SWITCH NAMES + MOVEM A,JNAME(U) + PUSHJ P,DMNPLI ;LOG BACK IN UNDER NEW NAMES + JRST CLKOJ1 + +;WAIT FOR SLGIV VARIABLES TO BECOME FREE, AND REQUEST THE +;SYSTEM JOB TO PROCESS THEM. TAKES STRING,,TTY IN T, AND +;PLACES UNAME(U) IN SLGIV, AND T INTO SLGIV+1. THE CALLER +;IS RESPONSIBLE FOR FILLING IN SLGIV+2 + +SGWAIT: PUSH P,T + MOVSI T,SCLLGI ;SOMEBODY ELSE IS USING THOSE VARIABLES + PUSHJ P,CWAIT ;WAIT FOR THE SYSTEM JOB TO FINISH WITH + TDNE T,SUPCOR ;THEM. + IORM T,SUPCOR ;REQUEST THE SYSTEM JOB TO PRINT OUR MSG + POP P,SLGIV+1 ;STRING,,TTY # + MOVE T,UNAME(U) ;STORE AWAY THE UNAME + MOVEM T,SLGIV + POPJ P, + +RUTRAP: LDB A,[430100,,UTRAPM(J)] ;GET SPECIAL TRAP MODE INDICATOR + JRST POPJ1 + +SUTRAP: DPB D,[430100,,UTRAPM(J)] ;SET " " " " + JRST POPJ1 + +IFN KA10P,[ +URTR1I: SKIPA A,[0,,%PIARO] ;READ "TRAP 1 INSTRUCTION" FOR KA-10 +URTR2I: MOVEI A,%PIPDL ;TRAP 2 + JRST POPJ1 +] ;KA10P + +;SET MEMORY BOUND +USMEMT: CAMN U,A + JRST USMEM2 + PUSHJ P,RPCLSR + MOVSI B,BSSTP + IORM B,USTP(A) + PUSHJ P,UPCLSR +USMEM2: ADDI D,1777 + LSH D,-10. + MOVE B,D + MOVEM A,SRN5(U) ;ARGUMENT TO NCORFS + PUSHJ P,LOSSET + NCORFS ;CLEARS BSSTP IN USTP(A). + EXCH U,A + PUSHJ P,ACORE + JRST OPNL33 ;LOST + EXCH U,A + JRST LSWPJ1 + +;SET SYSTEM NAME (ZERO IGNORED) +USYNST: SKIPE D + MOVEM D,USYSNM(J) + JRST POPJ1 + +;SET INFERIOR'S INTERRUPT MASK +USMASK: SKIPA E,[2] ;MOVEM +IAMASK: ANDI E,1 ;ANDCAM OR IORM + ANDCM D,[VBDBTS] ;BITS FOR CLASS 1 INTS CAN'T BE CHANGED. + XCT (E)[ IORB D,MSKST(A) + ANDCAB D,MSKST(A) + MOVEM D,MSKST(A)] +IFN KA10P,[ + MOVEI B,440+APRCHN ;NOW UPDATE JOB'S APRC VARIABLE. + TRNE D,%PIARO + TRC B,60 + TLNE D,(%PIFOV) + TRC B,600 + HRRM B,APRC(A) + TRNE I,1 + CONO @APRC(A) +] ;KA10P +IFE KA10P, PUSHJ P,TRINST + JRST UPISE1 + +IFE KA10P,[ +;SET THE AROV AND PDLOV TRAP INSNS ACCORDING TO WHETHER THE +;INTERRUPTS ARE ENABLED; BUT DON'T OVERRIDE AN EXPLICIT SPECIFICATION +;BY THE USER, WHICH IS ANYTHING OTHER THAN 0 OR (CAI) IN THE LH. + +TRINST: MOVE D,MSKST(A) + MOVSI B,(CAI) ;CAI IS FASTER THAN JFCL - NO AC DECODE + TDNE D,[%PIFOV+%PIARO] ;AND OVERFLOW GOES OFF A LOT + MOVEI B,%PIARO + HLRZ C,TR1INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR1INS(A) +; MOVSI B,(CAI) ;THESE LINES COMMENTED OUT TO MAKE +; TRNE D,%PIPDL ; PDL OVERFLOW CLASS 2 INSTEAD OF CLASS 3 + MOVEI B,%PIPDL + HLRZ C,TR2INS(A) + SKIPE C + CAIN C,(CAI) + MOVEM B,TR2INS(A) + POPJ P, +] ;IFE KA10P + +;SET INFERIOR'S PI IN PROGRESS FLAG +UPISET: ASH D,-35. ;SHIFT SIGN BIT TO BOTTOM BIT + MOVEM D,PICLR(A) ;SET VARIABLE +;COME HERE WHEN ANY INTERRUPT VARIABLE'S VALUE IS CHANGED +;BY A .USET OR .SUSET; TAKE ANY INTS THAT ARE NOW PENDING. +UPISE1: HRRZ A,J ;IAMASK, ETC. MODIFY A. RESTORE IT. + AOS (P) ;GOING TO WIN + TRNN I,1 ;SKIP IF A SUSET + JRST APISE6 + JRST APISE1 ;SEE IF SHOULD REINTERRUPT + +IAMSK2: ADDI A,MSKST2-IDF1 +IADF1: ADDI A,IDF1-IDF2 +IADF2: ADDI A,IDF2-PIRQC ;IORM OR ANDCAM INTO IDF2. +IAPIRQ: ADDI A,PIRQC-IFPIR +IAIFPI: ANDI E,1 ;GET USET PARITY (0=IORM, 1=ANDCAM) + XCT IAINS(E) ;DO APPRO OP + JRST UPISE1 + +IAINS: IORB D,IFPIR(A) ;SET BITS + ANDCAB D,IFPIR(A) ;FLUSH BITS + +USMSK2: ADDI A,MSKST2-IDF1 ;SET .MSK2, ETC. +USDF1: ADDI A,IDF1-IDF2 +USDF2: ADDI A,IDF2-PIRQC +USPIRQ: ADDI A,PIRQC-IFPIR +USIFPI: MOVEM D,IFPIR(A) + JRST UPISE1 + +;.RBCHN, .SBCHN READ/SET NUMBER OF LAST CHANNEL ON WHICH ERROR OCCURRED +RUBCHN: LDB A,[BCHPTR#(A#U)] + JRST POPJ1 + +SUBCHN: DPB D,[BCHPTR#(A#U)] + JRST POPJ1 + +;GET INT BIT +UGSUPR: HLLZ A,SUPPRO(J) + JRST POPJ1 + +;SAVE AWAY MA (HIGH BITS) ON LAST MPV OR WIRO +;CALLED FROM CLKBRK, DONT CLOBBER A OR D + +MPVMAS: +IFN KA10P,[ + HLRZ T,UPJPC(U) + LSH T,10. ;HIGH BITS ONLY ON KA +] ;KA10P +IFE KA10P, HRRZ T,UPFW(U) + HRRM T,IOTLSR(U) + POPJ P, + +;.RMPVA READ VIRTURAL PAGE # (8 BITS) OF LAST MPV OR WIRO + +MPVARD: HRRZ A,IOTLSR(J) + JRST POPJ1 + +;.RSERVER Read server user number, or -1 if none. +URSERV: SKIPL A,SERVER(J) + IDIVI A,LUBLK + JRST POPJ1 + +;.SSERVER Set server user number, or clear if negative. +; (To prevent timing screws, you should really use the SSERVE call to set +; this variable, but for debugging convenience...) +USSERV: IMULI D,LUBLK + SKIPGE D + SETOI D, + MOVEM D,SERVER(J) + JRST POPJ1 + +SUBTTL USER INSTRUCTION HANG ROUTINE (.HANG) + +; .HANG was rewritten by Alan Feb 87: +; +; The general theory is that .HANG should behave -exactly- like JRST .-1 as +; much as possible. Thus, it is considered to make sense to put any +; skipping or jumping instruction before a .HANG. We are always careful to +; return from the .HANG by jumping to the previous instruction, so any side +; effects (such as clearing bits or incrementing accumulators or memory) are +; always performed, and jumps will be correctly taken. +; +; There are two ways to leave a .HANG, either the job can get PCLSR'ed, or +; the awaited condition can become true. We arrange for -both- cases to +; return the job to the previous instruction by SOSing UUOH -once- before +; calling UFLS, and once more if UFLS returns. +; +; As an additional feature, .HANG with a non-zero accumulator behaves like +; the disjunction of ordinary .HANG and .SLEEP, allowing the user to do a +; timeout. The accumulator should initially contain an argument, as for +; .SLEEP, that indicates when .HANG should timeout. In that case only, +; .HANG returns to the following instruction and the designated accumulator +; will contain zero. If such a .HANG is interrupted, or if it returns +; because the awaited condition is now true, that accumulator will contain +; the correct negative number indicating the absolute time it would have +; timed out. +; +; Accepted instructions are: +; Any CAI, CAM, JUMP, SKIP, AOJ, AOS, SOJ, or SOS class instruction. +; Any test instruction. +; JFFO. +; JFCL with 0 in the AC field. +; Or an XCT that eventually fetches one of the above. +; +; As special cases SKIPA 0, and CAIA 0, are taken to request a schedule, +; and JFCL 0, and SKIP 0, set %SWDSO. +; +; As before, it is a limitation that changes to memory referenced by .HANG +; when computing effective addresses and fetching XCT'ed instructions will +; not cause the job to wake up. But how could it be otherwise? Changes to +; the accumulators will of course cause the job to be PCLSR'ed. + +AHANG: MOVE R,UUOH + UMOVE R,-2(R) ; Get user's flush instruction + HRLOI A,377777 ; A: most positive fixnum + JUMPE J,AHANG2 ; No AC => timeout when hell freezes over + XCTR XR,[MOVN A,(J)] ; A: argument as for .SLEEP + JUMPG A,AHANG2 ; 'twas already neg., so wait 'til then + SUB A,TIME ; else compute time + UMOVEM A,(J) ; store back negative for PCLSRing + MOVN A,A ; A: time to wait for +AHANG2: PUSHJ P,ASCIND ; Compute E for instruction + HLRZ C,R ; C: Opcode and AC + CAIE C,(JFCL) + CAIN C,(SKIP) + JRST AHANGI ; User might be waiting for a while + CAIE C,(SKIPA) + CAIN C,(CAIA) + JRST AHANGF ; User is just trying to cause a schedule + LSH C,-9 ; C: 9-bit opcode + CAIN C,XCT_-33 + JRST AHANG1 ; XCT - Go loop + CAIN C,JFFO_-33 + JRST AHANGO ; JFFO is like JUMPN + LSH C,-6 ; C: First 3 bits of opcode + CAIN C,CAI_-41 + JRST AHANGC ; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS + CAIN C,TRN_-41 + JRST AHANGT ; Txxx +IFN KS10P, JRST ILUUO +IFE KS10P,[ +;CODE TO ALLOW CONSO, CONSZ AS .HANG INSTRUCTIONS + HLRZ C,R ;CHECK FOR CONSO, CONSZ + TRZ C,077477 + LDB B,[320700,,R] ;GET DEVICE CODE/4 + SKIPGE T,DCHNTB(B) + TRNE T,40000 + CAIE C,(CONSZ\CONSO) + JRST ILUUO ;UNRECOGNIZED INSTRUCTION, OR USER CONI NOT + ; ALLOWED + MOVEM R,EPDL(U) + MOVE T,A + SOS UUOH + PUSHJ P,AHANG9 + PUSHJ P,UFLS + JRST AHANGX + +AHANG9: XCT EPDL(U) + CAMGE T,TIME + AOS (P) + POPJ P, + +] ;IFE KS10P + +; XCT ? .HANG +AHANG1: PUSHJ P,OPBRK ; Don't let "XCT ." hang you up + UMOVE R,(R) ; Get new instruction + JRST AHANG2 ; And start over + +; CAI, CAM, JUMP, SKIP, AOJ, SOJ, AOS, SOS ? .HANG +AHANGC: TLNN R,040000 + JRST AHANG3 ; CAI, CAM, JUMP, SKIP + TLNN R,010000 + JRST AHANGJ ; AOJ, SOJ + TLNN R,020000 + SKIPA T,[-1] ; AOS: Compare with -1 + MOVEI T,1 ; SOS: Compare with 1 + TLZ R,770777 ; Clear all but last 3 bits of opcode + TLO R,(CAM T,) ; Build a CAM instruction + TLNE R,001000 ; With the opposite sense + TLC R,006000 + JRST AHANGM + +AHANG3: TLNN R,020000 + JRST AHANG4 ; CAI, CAM + TLNN R,010000 + JRST AHANGJ ; JUMP + TLZ R,(0 17,) ; SKIP + JRST AHANGM + +; JFFO ? .HANG +AHANGO: TLC R,(JFFO#JUMPN) +AHANGJ: HRRI R,AHANGX + JRST AHANGA + +; SKIPA ? .HANG -- just flush once (ignores timeout) +AHANGF: SOSA UUOH + SKIPA + PUSHJ P,UFLS + JRST AHANGX + +; JFCL ? .HANG -- hang infinitely (or until timeout) +AHANGI: MOVE B,TIME + ADDI B,60.*30. ; If sleeping for more than a minute + MOVSI C,%SWDSO ; Desire swap out + CAML A,B ; (just like .SLEEP) + IORM C,USWST(U) + SOS UUOH +AHANG5: MOVE T,A + CAML T,TIME + PUSHJ P,UFLS + JRST AHANGX + +; Txxx ? .HANG +AHANGT: TLZ R,060000 ; Make opcode be TRN or TDN series + TLNE R,010000 ; If TRN, only AC matters + JRST AHANGB ; TDN: Both AC and memory matter +; Wait for something that only references the user's accumulators. +; (Instruction in R might be some kind of jump to AHANGX.) +AHANGA: PUSHJ P,AHANGG ; Get contents of user's AC into T + SOS UUOH + XCT R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + +AHANG4: TLNN R,010000 ; If CAM, both AC and memory matter + JRST AHANGA ; CAI: Only AC matters +; Wait for something that references memory. +; (Instruction in R better not be a jump!) +AHANGB: PUSHJ P,AHANGG ; Get contents of user's AC into T +AHANGM: MOVEM R,EPDL(U) + SOS UUOH + TRNE R,-20 ; Memory reference really only AC? + JRST AHANG6 ; No, real memory, go wait + XCTR XRW,R ; Must try it once to prevent timing screw + JRST AHANG5 ; OK, wait forever for PCLSR + JRST AHANGX + + PUSHJ P,UHANG +AHANG6: PUSHJ P,UFLS +AHANGX: ;; Everyone exits here after SOSing UUOH once (before hanging). + ;; Thus we always exit to the previous instruction (just like being + ;; PCLSRed), unless we timeout instead. + CAMGE A,TIME ; Timeout? + JRST AHANGY ; Yes + SOS UUOH + POPJ P, + +AHANGY: XCTR XW,[SETZM (J)] ; Let user know we timed out + AOS UUOH ; And fall through instead of backing out + POPJ P, + +;.HANG flush instruction routine, called with PUSHJ only on clock level +UHANG: +IFE KS10P,[ + MOVEI TT,0 ; Save MAR word + EXCH TT,UPMAR(U) ; so will not MAR + LPMR UPGML(U) + MOVEM TT,UPMAR(U) ; Restore MAR +] ;IFE KS10P +IFN KS10P, LPMR UPGML(U) + MOVE TT,AC0S+A(U) + XCTRI XRW,EPDL(U) + CAMGE TT,TIME + AOS (P) ; Might be because location swapped out or + POPJ P, ; missing, but that's OK because we always + ; exit to the previous instruction! + +; Kind of like ASCIND for the accumulators... +AHANGG: LDB T,[270400,,R] + UMOVE T,(T) ; Get contents of AC from user + TLZ R,(0 17,) ; Clear out AC field in instruction + TLO R,(0 T,) ; Replace AC field with T + POPJ P, + +; Allow interrupt if being PCLSRed +OPBRK: PUSH P,T + MOVE T,UEXIT + CAMN T,[JRST ONEFLS] + PUSHJ P,UDELAY + POP P,T + POPJ P, + +SUBTTL .OPEN AND FRIENDS + +; +;.FDELE FILBLK ;DELETE OR RENAME FILE SPECIFIED AT FILBLK +; +AFDELE: SETZM UUAC(U) + UMOVE A,(C) ;GET DEVICE + MOVEI W,4 + DPB W,[OPNCOM,,A] ;SET OP TO SPECIFY AN .FDELE + JRST AFDEL1 +; +;OPEN SET UP AND DISPATCH +;3.1=0 => INPUT =1 OUTPUT +;3.2=0 => UNITS =1 BLOCK +;3.3=0 => ASCII =1 IMAGE +;4.9-4.7 OPERATION FIELD +; 0=> NORMAL READ OR WRITE +; 1=> WRITE OVER MODE +; 2=> MAKE LINK +; 4=> DELETE OR RENAME (INTERNAL) +; +;.OPEN CH,FILBLK ;OPEN FILE SPECIFIED AT FILBLK ON LOGICAL CHANNEL CH +; +AOPEN: ;C HAS EFF ADR OF UUO AND R ITS AC FIELD + ADDI R,IOCHNM(U) ;MAKE R POINT TO SPECIFIED I/O CHANNEL WORD + PUSH P,C + PUSHJ P,ACLOSE ;CLOSE PREV + POP P,C + UMOVE A,(C) ;GET DEV AND MODE BITS + LDB W,[OPNCOM,,A] + CAIN W,4 + JRST OPNL23 ;BARF IF TRY TO DELETE WITH .OPEN +AFDEL1: MOVEI TT,SRN3(U) ;MOVE 4TH-6HT ARGS + HRLI TT,3(C) ;TO SRN3 THRU SRN5 + MOVEI Q,3(TT) + XCTR XBR,[BLT TT,-1(Q)] + UMOVE B,1(C) ;GET 2ND, 3RG ARGS (FILENAMES) + UMOVE C,2(C) + MOVE D,USYSNM(U) ;USE DEFAULT SNAME. + HLRZ E,A ;GET MODE BITS. + HRLZI A,(A) ;LEFT-JUSTIFY DEVICE NAME. + SETZM EPDL(U) + SETZM EPDL3(U) +NOPNE: CAIN W,4 ;SKIP ON NOT .FDELE (ENTRY FOR NCALL TYPE OPEN, ETC COMMANDS) + SKIPN SRN3(U) ;SKIP ON RENAME + JRST AOPEN3 ;JUMP IF A .OPEN OR DELETING .FDELE + JUMPN B,AOPEN3 ;JUMP UNLESS RENAME WHILE OPEN. + MOVE TT,C ;GET CH ON WHICH FILE IS SUPPOSIDLY OPEN + TDNE TT,[-NIOCHN] ;SKIP IF CH LOGICALLY LESS THAN 20 + JRST OPNL14 ;BAD CHANNEL NUM + ADDI TT,IOCHNM(U) ;RELOCATE TO POINT TO CH WORD FOR USER + MOVE Q,(TT) ;GET CH WORD + JUMPE Q,OPNL44 ;CHNL NOT OPEN + HLRZ Q,CLSTB(Q) ;GET LEFT HALF OF CLOSE TABLE ENTRY FOR INDEX IN I/O CH WORD + TRNE Q,%CLSJI\%CLSJO + JRST JFDEL4 ;JOB DEVICE CHNL + TRNN Q,%CLSDO\%CLSQ ;SKIP IF A DIRECTORY DEVICE + JRST POPJ1 ;JUMP IF NOT DIRECTORY DEVICE + HLRZ J,(TT) ;PICK UP DEV CHNL NO + EXCH A,B ;PUT FN1, FN2 IN A, B. + EXCH B,C +IFN NUNITS,[ + TRNN Q,%CLSDO ;SKIP IF DEC TAPE + JRST NOPNE1 + MOVSI C,'UT0 ;GET DUMMY UT DEV NAME. + HRRZ I,UTTNO(J) ;GET POSSIBLE (?) TAPE NUM + TLO C,(I) ;STORE IN DEV NAME + MOVE TT,DVAUT ;WILL EXIT TO UTAPE OPEN RTN. + JRST OPEN2B +NOPNE1: +] + MOVSI C,'DSK ;NOT UT, MUST BE DSK. + MOVE TT,DVAQSK ;NOBODY ELSE HANDLES RENAME WHILE OPEN. + JRST OPEN2B + +AOPEN3: PUSHJ P,TRAN ;PERFORM I/O TRANSLATIONS + JRST OPNL3 ;TOO MANY TRANSLATIONS. + MOVEM D,USYSN1(U);SAVE TRAN'D SNAME FOR OPEN RTN. + PUSH P,A ;PUT NAMES ON STACK. + PUSH P,B + PUSH P,C + MOVSI B,-NDEVS ;LOAD LENGTH OF FIRST DEV NAME TABLE + CAME A,DEVTAB(B);SEARCH FIRST DEV NAME TABLE + AOBJN B,.-1 ;LOOP TILL FOUND OR COUNTED OUT + JUMPG B,OPEN1 ;JUMP IF NOT FOUND +OPEN2: MOVE TT,DEVADR(B) ;LOAD BITS,,OPEN-ROUTINE-ADDRESS +OPEN21: POP P,B ;UNSAVE SECOND FILE NAME + POP P,A ;UNSAVE FIRST FILE NAME + POP P,C ;UNSAVE DEVICE NAME + CAIN W,4 + JRST [ TLNN TT,%DVDEL + JRST OPNL34 ;DEVICE DOES NOT ALLOW DELETE + JRST OPEN2B ] + CAIN W,2 + JRST [ TLNN TT,%DVLNK + JRST OPNL34 ;DEVICE DOES NOT ALLOW LINK + JRST OPEN2B ] +OPEN2B: HRRZ D,E ;MODE BITS + EXCH E,C ;SAVE DEVICE IN E + HLL C,E ;SET UP OLD-STYLE C: MODE,,DEV + MOVSS C +; +;AT THIS POINT: A & B HAVE FILE NAMES, C HAS MAPPED DEV AND MODE BITS, D HAS MODE BITS, +;W HAS OPEN COMMAND, E HAS DEVICE NAME, TT HAS DEVADR WORD (BITS,,ROUTINE) +; + ROT D,-1 ;ROTATE IN/OUT BIT TO SIGN + CAIN W,4 ;SKIP IF NOT A .FDELE + TDZ D,[400000,,7] ;A .FDELE, MAKE LOOK LIKE OPEN FOR READ + PUSHJ P,FLDRCK + JRST OPEN2D ;NORMAL OPEN + JUMPL D,OPNL2 ;WRITING DIRECTORY? + JUMPN W,OPNL12 ;DELETING, RENAMING, LINKING, WRITING OVER DIRECTORY? + TLNE TT,%DVDIR + JRST (TT) ;OPEN DEVICE FOR DIRECTORY +;ASKING FOR DIR OF DEVICE SYSTEM DOESN'T HAVE DIR ROUTINE FOR. +;PASS IT OFF TO THE UNKNOWN-DEVICE HANDLER. + PUSH P,E ;PUSH DEVICE NAME + PUSH P,A ;PUSH FN1 + PUSH P,B ;PUSH FN2 + HLRZ E,C ;GET MODE BITS + JRST OPEN22 ;PASS TO UNKNOWN DEVICE JOB + +OPEN2D: TLNE TT,%DVIN + JUMPGE D,(TT) ;OPENING FOR INPUT AND DEVICE CAN DO INPUT + TLNE TT,%DVOUT + JUMPL D,(TT) ;OPENING FOR OUTPUT AND DEVICE CAN DO OUTPUT + JRST OPNL2 ;DEVICE DOESN'T GO THAT DIRECTION + +;CHECK FOR NUMBERED DEV +OPEN1: MOVE B,[-NDV1,,DVT1-DEVTAB] ;LOAD AOBJN POINTER WITH COUNT FOR 2ND DEV TABLE +OPEN1A: MOVEI I,0 ;INITIALIZE NUMBERED DEV NUM TO ZERO + MOVE D,[440600,,-2(P)] ;GET BYTE POINTER INTO DEV REQUESTED + MOVE C,[440600,,DEVTAB(B)] ;GET BYTE POINTER INTO CURRENT TABLE ENTRY +OPENA1: ILDB A,C ;GET CHAR FROM TABLE + ILDB J,D ;GET CHAR FROM DEV + JUMPE A,OPEN1B ;JUMP ON SPACE IN TABLE, "MATCHES" DIGIT IN DEV + CAIN A,(J) ;SKIP IF CHAR DIFFER + JRST OPEN1C ;SAME, TRY FOR NEXT CHAR +OPENZ1: AOBJN B,OPEN1A ;LOOP TO NEXT TABLE ENTRY OR COUNT OUT +;CHECK FOR NAMED SECONDARY PACK +;FIND THE ONE WITH THIS NAME AND THE BIGGEST QSFT. +;ASSUME THAT BY THE TIME WE GET HERE TUTS HAVE BEEN READ IN AND SO FORTH + SKIPE A,-2(P) ;GET DEVICE NAME AGAIN + CAMN A,[-1] ;0 OR -1 ARE NOT LEGAL PACK NAMES + JRST OPEN22 + MOVEI C,NQS-1 ;SEARCH NAMES OF SECONDARY PACKS + SETOB TT,I ;I BEST DRIVE SO FAR, TT BEST QSFT SO FAR +OPENZ2: CAMN A,QRESRV(C) + JRST [ CAML TT,QSFT(C) + JRST .+1 + MOVE TT,QSFT(C) + MOVE I,C + JRST .+1 ] + SOJGE C,OPENZ2 + MOVE TT,[%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,,QSKOB] + JUMPGE I,OPEN21 +; +;"UNKNOWN DEVICE" HANDLER. FOO DEVICE IS LOADED BY +;SYS;ATSIGN DEVICE FROM FILE DEVICE;JOBDEV FOO +; +OPEN22: POP P,EPDLT2(U) ;WHEN WE USE SYS:ATSIGN DEVICE AS A JOB DEVICE, + POP P,EPDLT1(U) ;SET UP THE "NAMES BEFORE LAST TRANSLATION" TO BE + POP P,EPDLT4(U) ;THE NAMES BEING USED, INCLUDING "FOO" AS THE DEVICE. + MOVE A,USYSN1(U) + MOVEM A,EPDLT3(U) + MOVSI C,'JOB + MOVE TT,DVAJOB ;DEVADR ENTRY FOR JOB: + MOVSI A,'SYS + MOVEM A,USYSN1(U) + MOVE A,['ATSIGN] + MOVE B,['DEVICE] + JRST OPEN2B + +OPEN1B: JUMPE J,OPEN1C ;JUMP IF DEV ARG EXHAUSTED + SUBI J,'0 ;CONVERT SIXBIT DIGIT TO NUMBER + JUMPL J,OPENZ1 ;JUMP IF TOO SMALL, NOT A DIGIT + CAILE J,9 ;SKIP IF LESS THAN 10. + JRST OPENZ1 ;LOSE, TRY NEXT + ASH I,3 ;MULTIPLY NUM SO FAR BY 8 + ADD I,J ;ADD NEW DIGIT +OPEN1C: TLNE C,770000 ;SKIP IF ALL SIX CHAR POSITIONS COMPARED + JRST OPENA1 ;GO TO NEXT POSITION + JRST OPEN2 + +NSOPEN: HRRZ R,A ;Args: 1 mode (LH) chnl (RH), 2 BP or aobjn -> block of BPs. + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A ;Save channel number. + PUSH P,B ;Save BP or BP block ptr. + PUSHJ P,CCLOSE + POP P,R ;Get back the BP or aobjn pointer. + MOVEM R,EPDL(U) ;Save where job device can get it. + PUSHJ P,FNPRS ;Parse into DEV, FN1, FN2, SNM in A, B, C, D. + MOVEM D,SRN3(U) ;Make symbolic open of network win using 5th arg as foreign host. + POP P,R ;Pop back channel number argument. + MOVE E,CTLBTS(U) + TSC E,E + TRZ E,-1 + XOR R,E + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + HLRZ E,R + JRST NDEL1 + +;Given in R a BP into user memory, or an aobjn -> of BPs block in user memory, +;parse filenames into A, B, C, D. Clobbers Q, T, R, H, I. +FNPRS: SETZ Q, ;Guess that it is a BP, not a block of them. + SETZ A, ;Clear out the old-fashioned filename words. + SETZ B, + SETZ C, + SETZ D, + SETCM T,R ;Is our "BP" realy an aobjn pointer to fewer than 64 things? + TLNE R,-1 ;If LH is 0, treat as BP and replace with 440700 later. + TLNE T,777700 + JRST FNPRS8 + MOVE Q,R ;Put the aobjn pointer in Q and get the first BP in R. + UMOVE R,(Q) +FNPRS8: PUSHJ P,ASCIND +FNPRS7: PUSHJ P,FNPRS4 ; Read a sixbit word + JUMPL I,FNPRS9 ; Nothing there at all! + CAIN H,"; ; Directory? + JRST FNPRS0 ; Go do special hack + MOVEI I,B ; assume FN1 + SKIPE B ; unless we already have a FN1 + MOVEI I,C ; in which case assume FN2 + CAIN H,": + MOVEI I,A ; unless it was a device + SKIPN (I) ;Put it there, unless already something there. + MOVEM T,(I) + JUMPN H,FNPRS7 ;H=0 means end of last arg string. +FNPRS9: ;; Supply default values for all components except FN1. + SKIPN A + MOVSI A,(SIXBIT /DSK/) + SKIPN D + MOVE D,USYSNM(U) + SKIPN C + MOVSI C,(SIXBIT />/) + POPJ P, + +FNPRS0: SKIPN I,D + JRST FNPRS2 + LSH T,-6 + TLO T,(SIXBIT /./) +FNPRS1: LSH T,-6 + LSH I,6 + JUMPN I,FNPRS1 +FNPRS2: IOR D,T + JRST FNPRS7 + +;;; Extract in T the next SIXBIT word from user memory off bp in R, +;;; clobbering I (test 4.9 to see if there was no word read at all). +;;; Terminating character returned in H (0 means we got to the end of the +;;; string). Q should be an aobjn pointer to a block in user memory of +;;; additional BPs. +FNPRS4: SETZ T, + MOVE I,[440600,,T] +FNPRS6: PUSHJ P,FNPRS3 + JUMPE H,CPOPJ ; that was the end of the string + CAIE H,": + CAIN H,"; + JRST FNPRS5 ; done? + CAIN H,40 + JRST FNPRS5 ; done? + CAIN H,^Q + PUSHJ P,FNPRS3 + CAIL H,140 + SUBI H,40 + SUBI H,40 + TLNE I,770000 + IDPB H,I + JRST FNPRS6 + +FNPRS5: JUMPL I,FNPRS6 ; keep looking if we haven't seen anything yet. + POPJ P, + +;Extract in H the next character from user memory off the byte pointer in R. +;Q should be an aobjn pointer to a block of further BPs +;(in user memory) to use after this one is exhausted. +FNPRS3: TLNN R,-1 + HRLI R,440700 + IBP R + UMOVE H,(R) ;Fetch the word the BP points to. + PUSH P,R + HRRI R,H ;Change the BP to point to H. + LDB H,R ;Extract the desired byte. + POP P,R + JUMPN H,CPOPJ + AOBJP Q,CPOPJ ;When one BP is exhausted, go to the next (if any). + UMOVE R,(Q) + PUSHJ P,ASCIND + JRST FNPRS3 + +NOPEN: HRRZ R,A ;ARGS 1 MODE (LH) CHNL (RH) 2-5 LIKE NOPEN1 1-4 + CAIL R,NIOCHN + JRST OPNL14 + ADDI R,IOCHNM(U) + PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,W + PUSHJ P,CCLOSE + POP P,W + SOS W ;STRIP OF FIRST ARG + POP P,D ;B-E POPPED INTO A-D + POP P,C + POP P,B + POP P,A + POP P,R ;A POPPED INTO R + TLC R,@CTLBTS(U) + LDB E,[OPNCOM,,R] + CAIE E,2 + CAIN E,4 + JRST OPNL12 ;COMMAND CANT BE LINK OR FDELE FOR "NEW" CALL + JSP T,NOPEN1 + MOVEM D,SRN3(U) ;MAKE SYMBOLIC OPEN OF NETWORK WIN USING 5TH ARG AS FOREIGN HOST. +NDEL1: CLEARM SRN4(U) +NRN2: CLEARM SRN5(U) +NOPENX: TRNE R,-NIOCHN + BUG ;BAD CHANNEL # + HRRZM R,UUAC(U) ;CHNL # (MAYBE ONLY FOR ERRS) IN R + ADDI R,IOCHNM(U) + LDB W,[OPNCOM,,R] + JRST NOPNE + +;DEFAULT THE ARGS FOR .CALL OPEN, ETC,; PUT MODE IN E. +NOPEN1: SETZM EPDL(U) + SETZM EPDL3(U) + CAIGE W,2 + MOVSI B,(SIXBIT /@/) + CAIGE W,3 + MOVSI C,(SIXBIT /@/) + CAIGE W,4 + MOVE D,USYSNM(U) ;SYSTEM NAME + HLRZ E,R ;GET MODE BITS FOR TRAN. + JRST (T) + +;MAKE LINK 1-4 AS NOPEN1, 5 SNAME 2 6,7 FN1,2(2) +NMLINK: MOVSI R,200000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NOPENX] + CAIGE W,7 ;Otherwise, must be seven word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVEM I,SRN5(U) + JSP T,NOPEN1 + JRST NOPENX + +NDEL: SETZM SRN3(U) + CAIN W,2 + JRST OPNL33 + CAIN W,1 ;If it's just a BP (or block of them), + JRST [ MOVE R,A ;Parse it into filenames in A-D. + MOVEM R,EPDL(U) + PUSHJ P,FNPRS + JRST .+2] + JSP T,NOPEN1 + MOVSI R,400000 ;DELETE, ARGS AS NOPEN1 + SETZ E, + JRST NDEL1 + +NRNAM: MOVSI R,400000 + CAIN W,2 ;Only 2 args are BPs. + JRST [ PUSHJ P,2FNPRS + JRST NRN2] + CAIGE W,6 ;Otherwise, must be six word of sixbit. + JRST OPNL33 + MOVEM E,SRN3(U) + MOVEM TT,SRN4(U) + MOVSI R,400000 ;RENAME 1-4 AS NOPEN1 5,6 NEW FN1,2 + JSP T,NOPEN1 + JRST NRN2 + +;Parse two BPs (or aobjn pointers to blocks of BPs) into user memory +;into filenames. The second bunch go in SRN3 - SRN5; the first in A - D. +;The two args are saved in EPDL and EPDL3. Clears E, preserves R. +2FNPRS: PUSH P,R + MOVEM A,EPDL(U) ;Save two BPs for job device. + MOVEM B,EPDL3(U) + PUSH P,A ;Decode the second BP first, to get the new names. + MOVE R,B + PUSHJ P,FNPRS + MOVEM B,SRN3(U) ;Stick them where RENAME looks. + MOVEM C,SRN4(U) + MOVEM D,SRN5(U) + POP P,R ;Parse the first BP, to get the old file filenames. + PUSHJ P,FNPRS + SETZ E, + POP P,R + POPJ P, + +;Takes either channel, FN1 (sixbit) and FN2 (sixbit) +;or channel and BP (or aobjn -> block of BPs). +NRNWO: SETZM EPDL(U) + SETZM EPDL3(U) + PUSH P,A + CAIN W,2 + PUSHJ P,[MOVE R,B ;If channel and BP, parse the BP into filenames. + MOVEM R,EPDL3(U) ;But also save it for job device. + JRST FNPRS] + MOVEM B,SRN3(U) ;PUT AWAY NEW NAMES. + MOVEM C,SRN4(U) + POP P,C + ANDI C,-1 ;We call "RENAME" with old fn2 = channel number. + SETZB A,B + MOVEI D,0 + MOVSI R,400000 ;OPNCOM IS .FDELE . + MOVEI E,400000 + JRST NRN2 + +SUBTTL HACKS FOR OPENS THAT LOSE + + +IFN 0,[ ;THESE "DEFNS" EXIST ONLY SO @ WILL CREF THEM + OPNL1: OPNL2: OPNL3: OPNL4: OPNL5: OPNL6: OPNL7: +OPNL10: OPNL11: OPNL12: OPNL13: OPNL14: OPNL15: OPNL16: OPNL17: +OPNL20: OPNL21: OPNL22: OPNL23: OPNL24: OPNL25: OPNL26: OPNL27: +OPNL30: OPNL31: OPNL32: OPNL33: OPNL34: OPNL35: OPNL36: OPNL37: +OPNL40: OPNL41: OPNL42: OPNL43: OPNL44: OPNL45: OPNL46: OPNL47: +OPNL50: OPNL51: OPNL52: OPNL53: OPNL54: OPNL55: OPNL56: OPNL57: +OPNL60: OPNL61: OPNL62: OPNL63: OPNL64: OPNL65: OPNL66: OPNL67: +OPNL70: OPNL71: OPNL72: OPNL73: OPNL74: OPNL75: OPNL76: OPNL77: +] ;END OF IFN 0 + +;HERE ARE THE REAL DEFNS +REPEAT NOPNLS,CONC OPNL,\.RPCNT+1,: JSP D,OPENL +; +OPENL: CONSZ PI,77400 + BUG ;ERROR WITH PI IN PROGRESS + MOVE U,USER ;BE SURE U=CURRENT USER'S INDEX + MOVEI D,-OPNL1(D) ;GET LOSSAGE NUMBER + MOVE R,SYSCVL(U);POSSIBLY RETURN IN ERROR-CODE ARG TO .CALL + TLNE R,%SCVER + UMOVEM D,(R) + HRRZ R,UUAC(U) ;GET CH NUM + CAILE R,NIOCHN-1 + BUG ;UUAC BAD + PUSHJ P,LSWCLR ;UNLOCK SWITCHES + DPB R,[BCHPTR] ;SAVE AS MOST RECENT CHANNEL IN ERR + ADD R,U ;RELOCATE TO POINT TO USER VARS + DPB D,[220600,,IOCHST(R)] ;STORE IN STATUS WORD + JRST CLKONJ + +SUBTTL RCHST, STATUS, RFNAME, RFPNTR, WHYINT CALLS + +;.CALL RFNAME +;1ST ARG IS A , WHOSE CHANNEL IS TO BE LOOKED AT. +;2ND ARG IS A CHANNEL NUMBER. +;3RD ARG IS BP TO STORE ASCIZ FILENAME STRING THROUGH. +;4TH ARG IS MAXIMUM NUMBER OF CHARACTERS TO STORE (DEFAULTS TO 1,,0). +;ONLY 1 ARG => IT IS CHANNEL #, AND JOB IS "SELF". +;FIRST 4 VALUES ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;FIFTH VALUE IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN + +NRFNAM: MOVE J,A ;FIRST ARG IS JOB SPEC + CAIL W,2 + SKIPA A,B ;GET CHANNEL # INTO A IN EITHER CASE + MOVEI J,%JSELF ;IF ONLY ONE ARG, JOB SPEC IS SELF + MOVE Q,C ;SAVE BP FOR STORING ASCIZ FILENAME STRING - IF ANY. + CAIGE W,3 + SETZ Q, + CAIGE W,4 + MOVSI D,1 + JSP T,NCORUI ;DECODE JOB SPEC + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;PDP6 DOESN'T HAVE CHANNELS +] + PUSH P,D + PUSH P,Q + MOVE W,D + MOVE U,J ;LOOK IN THAT JOB'S CHANNELS + PUSHJ P,NRFNM1 ;GET THE CRUFT + JRST POP2J + PUSHJ P,LSWPOP ;UNSOS DIELOK. + MOVE T,Q + POP P,Q + POP P,I ;I GETS 4TH ARG: MAX NUMBER OF CHARS TO STORE IN STRING. + JUMPE T,POPJ1 ;IF DEVICE ROUTINE HAS CLEARED Q, IT HAS STORED THE STRING. + ;NOTE NETRCH PUTS AN EXTRA VALUE FOR .RCHST (GARBAGE, TO US) IN Q! + JUMPE Q,POPJ1 ;IF BP ARG WAS 0, CALLER DOESN'T WANT A STRING. + MOVE R,Q + PUSHJ P,ASCIND + MOVE Q,R + MOVE J,A ;IF SO, STORE ALL 4 FILENAMES DOWN IT, ONE BY ONE. + MOVEI T,": + PUSHJ P,NRFNS1 + MOVE J,D + MOVEI T,"; + PUSHJ P,NRFNS1 + MOVE J,B + MOVEI T,40 + PUSHJ P,NRFNS1 + MOVE J,C + MOVEI T,0 + PUSHJ P,NRFNS1 + JRST POPJ1 + +;STORE THE SIXBIT WORD IN J FOLLOWED BY THE ASCII CHAR IN T +;INTO USER ADDRESS SPACE DOWN THE BP IN Q. +NRFNS1: JUMPE J,CPOPJ ;OUTPUT NOTHING AT ALL IF THE SIXBIT WORD IS EMPTY. + CAIGE I,4 ;GIVE UP NOW IF TOO CLOSE TO END OF ALLOCATED SPACE. + POPJ P, + SETZ R, + ROTC J,6 ;ELSE GET NEXT CHAR IN R, AND CONVERT TO ASCII AND STORE. + ADDI R,40 + SETZ TT, + CAIE R,": ;PRECEDE ANY SPECIAL CHARACTERS WITH ^Q. + CAIN R,"; + MOVEI TT,^Q + CAIN R,40 + MOVEI TT,^Q + JUMPE TT,NRFNS2 + SOS I + PUSHJ P,NRFNSB +NRFNS2: SOS I + MOVE TT,R + PUSHJ P,NRFNSB + JUMPN J,NRFNS1 + SOS I + MOVE TT,T + PUSHJ P,NRFNSB ;IF NAME FINISHED BUT NOT EMPTY, FOLLOW BY TERMINATOR. + JUMPE T,CPOPJ + CAIN T,40 + POPJ P, + MOVEI TT,40 + PUSHJ P,NRFNSB ;IF TERMINATOR IS : OR ;, FOLLOW IT WITH A SPACE. + SOJA I,CPOPJ + +;STORE A BYTE IN TT DOWN BP IN Q TO USER SPACE, INCREMENTING FIRST. +;XCTR XBYTE LOSES BECUSE IT GETS THE BP FROM USER SPACE. +NRFNSB: IBP Q + PUSH P,T + PUSH P,Q + UMOVE T,(Q) + HRRI Q,T + DPB TT,Q + POP P,Q + UMOVEM T,(Q) + POP P,T + POPJ P, + +;GET THE FILENAMES FOR THE CHANNEL IN A OF JOB IN U INTO A THRU D. +;IF Q IS NONZERO, IT IS A BP TO STORE AN ASCIZ STRING, AND W IS THE +;MAX NUMBER OF CHARACTERS TO STORE. +;THE DEVICE DEPENDENT ROUTINE CAN STORE THE STRING ITSELF +;AND SET Q TO ZERO SO THAT IT WILL NOT BE STORED THE STANDARD WAY. +NRFNM1: MOVE T,[4,,NRFNM2] + JRST CHNDCD ;R GETS ADDR OF IOCHNM WD, H GETS CONTENTS. +NRFNM2: HLRZ A,H ;PUT LH(IOCHNM WD) WHERE DEVICE RTN LOOKS + HLLZ J,DCHSTB(H) + JUMPG J,[ ;IF 6-LETTER DEVICE NAME, LH IS POSITIVE ADDRESS + HLRZS J ;OF FULL NAME. NOTE THERE BETTER BE NO + MOVE J,(J) ;3-CHAR DEVICES WHOSE NAME DOES NOT START + JRST .+1 ] ;WITH A LETTER. + PUSH P,J ;SAVE THE PROBABLE VALUE OF DEVICE NAME + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DRFNTB(J) ;GET RFNAME ROUTINE POINTER + SETZB B,C ;FN1, FN2 ARE 0 FOR NON-DIR-DEV + SETZ D, ;SNAME IS 0 FOR NON-MULTI-DIR-DEV + LDB E,[.BP (%IOTOM),IOTTB(H)] ;PROBABLE VALUE OF MODE + PUSHJ P,(J) ;CALL DEVICE-SPECIFIC ROUTINE + SKIPA A,(P) ;NO SKIP => USE DEVICE NAME FROM DCHSTB + MOVE A,J ;SKIP => USE DEVICE NAME RETURNED IN J + JRST POP1J1 + +;.CALL RFPNTR +;ARG 1 - CHANNEL NUMBER +;VAL 1 - ACCESS POINTER OF CHANNEL +;VAL 2 - BYTE SIZE OF CHANNEL. +;FAILS IF NOT A RANDOM-ACCESS DEVICE + +NRFPNT: HLRZ A,H ;CHANNEL ALREADY DECODED, SET UP LH(IOCHNM) FOR DEV RTN + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;GET RFPNTR ROUTINE POINTER + JRST (J) ;IT SHOULD PUT POINTER IN A AND POPJ1, OR OPNL34 + +;SYMBOLIC CALL "RCHST" +;1ST ARG IS A CHANNEL NUMBER. +;6 OR MORE VALUES. THE FIRST 4 ARE THE DEVICE, FN1, FN2 AND SNAME +; AS LEFT-JUSTIFIED SIXBIT WHOLEWORDS. +;THE 5TH IS THE ACCESS POINTER, OR -1 IF NOT RANDOM ACCESS. +;THE 6TH IS THE MODE THE CHANNEL MIGHT BE RE-OPENED IN. +;MORE VALUES ARE RETURNED ONLY FOR NET:, AT THE MOMENT. +;THE DEV SUBROUTINE MAY PUT EXTRA RESULTS IN TT, I, AND Q, AND PUT # RESULTS INTO W + +NRCHST: SETO I, ;DEFAULT POSSIBLE EXTRA RESULTS + SETO TT, ;DEFAULT ACCESS POINTER TO -1 + MOVEI W,6 ;NORMAL NUMBER OF RESULTS IS 6 + SETZ Q, + PUSHJ P,NRFNM1 ;GET RESULTS 1 THROUGH 4 AND 6, AND SET UP R AND H + POPJ P, ;CHANNEL NUMBER MUST HAVE BEEN BAD + PUSH P,A + PUSH P,B ;SAVE THE AC THAT RFPNTR CLOBBERS. + HLRZ A,H ;GET ROUTINE TO GET ACCESS POINTER + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DRFNTB(J) ;ROUTINE BETTER PRESERVE B,C,D,E,TT,I,Q + CAIL J,OPENL ;KLUDGILY SKIP IF WOULD OPEN-LOSS + PUSHJ P,(J) ;GET ACCESS POINTER IN A, ALWAYS SKIPS + MOVE A,TT ;NOT RANDOM ACESS, USE DEFAULT VALUE + MOVE TT,E ;OPEN MODE IS 6TH RESULT + MOVE E,A ;ACCESS POINTER IS 5TH RESULT + JRST PPBAJ1 + +;.RCHST AC, WITH AC/ CH,,ADDR +;RETURNS, IN THE 5 OR MORE WORDS STARTING AT ADDR, +;THE RESULTS OF A SYMBOLIC RCHST ON CHANNEL CH. +;EXCEPTION - THE DEVICE NAME IS RETURNED IN THE RH +;OF THE FIRST WORD , SO IT IS TRUNCATED TO 18 BITS. +;EXCEPTION - THE OPEN MODE VALUE IS NOT RETURNED. LATER VALUES +;ARE SHIFTED DOWN ONE WORD. +;NEVER SKIPS. + +ARCHST: UMOVE J,(J) ;GET CONTENTS OF AC + HLRZ A,J + CAIL A,NIOCHN + JRST ILUUO ;BAD CHANNEL NUMBER + PUSH P,J + PUSHJ P,NRCHST ;DO THE REAL WORK. + BUG ;ONLY ERROR RETURN SHOULD BE BAD CHANNEL NUMBER + HLRZS A ;PUT DEV NAME IN RH FOR HISTORY'S SAKE + POP P,J ;RH(J) HAS PLACE TO STORE DATA + MOVE TT,I + MOVE I,Q ;SHIFT DOWN LAST 2 VALS OVER THE OPEN MODE. + HRLI J,A + ADDI W,-2(J) ;W HAD 1+ # VALS, NOW HAS PLACE TO PUT LAST ONE + XCTR XBW,[BLT J,(W)] + POPJ P, + +;.STATUS CH,LOC ;STORE IN LOC THE STATUS OF CHANNEL CH + ;AND OF THE DEV OPEN ON IT IF ANY +;1.1-1.6 SYS PERIPHERAL DEVICE CODE +;1.7-2.9 DEVICE DEPENDENT +;3.1-4.9 LH(IOCHST) + +ASTATUS:ADDI R,IOCHNM(U) ;SET UP AC'S LIKE CHNDCD +ASTAT1: MOVE H,(R) ;ENTER HERE FROM .USET [.RIOS,,] + HLL R,CLSTB(H) + PUSHJ P,NSTATUS ;CALL NEW SYSTEM CALL VERSION + BUG + UMOVEM A,(C) ;GIVE TO USER + POPJ P, + +;.CALL STATUS +;ARG 1 - CHANNEL NUMBER +;VAL 1 - SAME AS .STATUS + +NSTATUS:HLRZ A,H ;SET UP LH(IOCHNM) + LDB D,[140600,,DCHSTB(H)] ;GET SYS PERIPHERAL DEVICE CODE + LDB J,[340300,,IOTTB(H)] ;GET I/O CHANNEL MODE FROM 4.5-4.2 + DPB J,[060300,,D] ;RETURN IN BITS 1.9-1.7 + LDB J,[1400,,DCHSTB(H)] + HLRZ J,DSTSTB(J) ;GET STATUS ROUTINE POINTER + PUSHJ P,(J) ;ROUTINE FILLS OUT STATUS WORD IN D + HLL D,IOCHST-IOCHNM(R) ;FILL IN LEFT HALF FROM IOCHST + TLZ D,740000 ;CLEAR BITS USED FOR CHANNEL NUM ON IO PDL + MOVE A,D ;RETURN VALUE IN A + JRST POPJ1 ;THIS CALL ALWAYS SUCCEEDS + +;.CALL WHYINT +;ARG 1 - CHANNEL NUMBER +;VAL 1 - %WY CODE FOR TYPE OF DEVICE +;ADDITIONAL VALUES DEVICE-DEPENDENT +;THIS IS THE USUAL CALL TO GIVE IN RESPONSE TO A SECOND WORD INTERRUPT + +NWHYINT:HLRZ A,H ;SET UP LH(IOCHNM) + LDB J,[1400,,DCHSTB(H)] + HRRZ J,DSTSTB(J) ;GET WHYINT ROUTINE POINTER + JRST (J) + +;DEVICE-SPECIFIC RFNAME/RCHST ROUTINES +;CALLED WITH STANDARD CHNDCD STUFF IN H AND R, LH(IOCHNM) IN A +;MUST PRESERVE H AND R; CAN CLOBBER W TO INDICATE EXTRA STUFF FOR RCHST + +RCHUSR: MOVE B,UNAME(A) ;GET UNAME + MOVE C,JNAME(A) ;GET JNAME + POPJ P, + +IFN NUNITS,[ ;UTAPE .RCHST +RCHUTP: HRRZ C,UTTNO(A) + MOVSI J,'UT0(C) ;GET REAL DEV NAME "UTN" IN J + AOS (P) ;SKIP TO RETURN CHANGED DEV NAME + MOVE D,UTASS(C) ;THE "SNAME" IS THE USER TAPE IS ASSIGNED TO. + CAIGE A,NUTIC + JRST RCHUTI ;INPUT + MOVE B,UTN1(A) ;OUTPUT, GET FN1 + MOVE C,UTN2(A) ;NOW FN2 + POPJ P, + + ;UTAPE INPUT .RCHST +RCHUTI: LDB T,[220500,,UTDBC(A)] ;GET FILE NUMBER + SUBI T,1 + LSH T,1 ;TURN INTO INDEX INTO DIRECTORY + CONO PI,CLKOFF + ADD T,UDIRO(C) ;GET POINTER TO FILE NAMES + MOVE B,(T) ;GET FN1 + MOVE C,(T) ;GET FN2 + JRST CLKONJ +] + +;RCHST ROUTINE FOR TTY +RCHTTY: MOVE J,A + ANDI J,#%TICNS#(.BM $TIIDX) + IOR E,J ;MERGE TTY OPEN MODE BITS WITH THE GENERAL ONES. + TRNE A,%TICNS + POPJ P, + ANDI A,7 + MOVEI J,'T00(A) + HLRZ A,(R) +RCHST1: ANDI A,70 + LSH A,3 + ADD J,A + HRLZS J ;J NOW HAS SIXBIT/TNM/, NM = TTY #. + JRST POPJ1 ;SKIP TO SAY DEV NAME IS IN J. + +;RCHST ROUTINE FOR STY +RCHSTY: MOVE J,TTYOPT(A) + TLNE J,%TOHDX + IORI E,4 ;STY BIT 1.3 => TTY IS HALF-DUPLEX. + MOVE J,STYSTS-NFSTTY(A) + TLNE J,%SSORS + IORI E,20 ;BIT 1.5 => WANT TO RECEIVE %TDORS ON .RESET OF TYOC, + TRNN E,1 ;FIND THE DON'T-HANG-BIT FOR THIS DIRECTION. + TLZA J,#%SSOHG ;AND FLUSH THE ONE FOR THE OTHER DIRECTION. + TLZ J,#%SSHNG + TLNE J,-1 ;THEN TESTING BOTH TESTS ONLY THE RELEVANT ONE. + IORI E,10 + SUBI A,NFSTTY + ANDI A,7 + MOVEI J,'S00(A) + HLRZ A,(R) + SUBI A,NFSTTY + JRST RCHST1 + +RCHDRH: HRRZ A,IOCHST-IOCHNM(R) ;TRACK NUMBER + IMULI A,LMNBLK ;DIRHNG DEVICE RFNAME + ADDI A,2000-LMNBLK*NUDSL + ADD A,QMDRO + MOVE D,MNUNAM(A) + POPJ P, + +;RCHST ROUTINE FOR DIRECTORY CHANNELS AND THE ERR DEVICE. +RCHDIR: MOVE T,DSKLST(A) ;GET THE TYPE OF DIRECTORY CODE. + SKIPE J,UDUSR(A) ;IF DEVICE # IS NONZERO, ADD IT TO DEV NAME + HRLZS J ;(ONLY HAPPENS FOR UTAPE) + ADD J,RCHDRD-1(T) ;DETERMINE DEV NAME FROM DIRECTORY TYPE + MOVE B,RCHDR1-1(T) ;SAME FOR FN1 + SKIPN C,RCHDR2-1(T) ;AND FN2, EXCEPT 0 FOR ERR DEVICES + MOVE C,UUDPP(A) ; SO WE WILL GET THE STATUS WORD BEING DECODED. + CAIN T,3 + MOVE D,UDSYSN(A) ;FOR DISK UFD'S, GET THE SNAME + JRST POPJ1 ;RETURN, SAYING WE HAVE SPEC'D THE DEVICE NAME. + +.SEE UDT ;THESE TABLES ARE IN PARALLEL WITH UDT +RCHDRD: 'UT0,, ? 'CLU,, ? 'DSK,, ? 'DSK,, + 'ERR,, ? 'TTY,, ? 'COR,, +IF2 IFN .-UDTLN-RCHDRD,.ERR RCHDRD WRONG LENGTH + +RCHDR1: '.FILE. ? '.FILE. ? '.FILE. ? 'M.F.D. + 3 ? '.FILE. ? '.FILE. +IF2 IFN .-UDTLN-RCHDR1,.ERR RCHDR1 WRONG LENGTH + +RCHDR2: SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ ? SIXBIT /(FILE)/ + 0 ? SIXBIT /(DIR)/ ? SIXBIT /(DIR)/ +IF2 IFN .-UDTLN-RCHDR2,.ERR RCHDR2 WRONG LENGTH + + + +;CORE LINK .RCHST ROUTINE + +RCHCLO: CONO PI,CLKOFF + MOVE B,CLN1(A) ;GET FN1 + MOVE C,CLN2(A) ;GET FN2 + MOVE D,CLSYN(A) ;GET SYSTEM NAME + JRST CLKONJ + +;RFNAME ROUTINE FOR DSK + +RCHQSK: MOVE H,QUDPR(A) ;FILE STATUS FOR DISK PICKUP USER DIR POINTER + PUSHJ P,QUDLK ;LOCK DIRECTORY + MOVE C,QSNLCN(H) ;LOCATION OF DIRECTORY + MOVE D,UDNAME(C) + ADD C,QUDFPR(A) ;ADD LOCN OF FILE WITHIN DIRECTORY + MOVE B,(C) ;GET FIRST FILE NAME + MOVE C,1(C) ;GET SECOND FILE NAME + PUSHJ P,QUDULK + MOVE H,QSRAC(A) + TLNE H,%QALNK + TRO E,20 ;LINK MODE + MOVE H,(R) ;PRESERVE H + POPJ P, + +;RFNAME ROUTINE FOR BOJ: + +RCHBOJ: CONO PI,CLKOFF ;BOJ DEVICE .RCHST ROUTINE + MOVE T,JBCUI(A) ;RETURNS CREATOR'S NAME + MOVE B,UNAME(T) + MOVE C,JNAME(T) + SKIPGE JBCG(A) + SETZB B,C ;CREATOR GONE, RETURN BLANK NAMES + JRST CLKONJ + +;RFNAME ROUTINE FOR JOB: + +RFNJOB: SKIPE Q + PUSHJ P,RFNJ1 + CONO PI,CLKOFF + MOVE B,JBFN1(A) + MOVE C,JBFN2(A) + MOVE D,JBSYS(A) + MOVE E,JBOPNM(A) + MOVE J,JBDEV(A) + JRST CLKOJ1 + +;COPY THE BOJ JOB'S ASCIZ FILENAME STRING INTO OUR CALLER'S STRING. +;THE CALLER'S BP IS IN Q, AND HIS MAX CHARS TO STORE IS IN W. +RFNJ1: SKIPN B,JBFNP(A) + POPJ P, + PUSH P,TT + PUSH P,T + MOVE J,JBCJUI(A) + AOS DIELOK(J) ;PREVENT THE JOB FROM DIEING. + PUSHJ P,SOSSET + DIELOK(J) + TLZ B,37 + MOVE D,B + PUSHJ P,RFNJ3 + MOVEI TT,1 +;D HAS BP TO FETCH WITH, POINTING INTO C, WHICH CONTAINS WORD FETCHED FROM BOJ JOB. +;RH(B) HAS ADDR OF NEXT WORD TO FETCH FROM THE BOJ JOB. +;TT CONTAINS THE PREVIOUS CHARACTER TRANSFERRED, OR 1 +;IF THE PREVIOUS CHARACTER WAS QUOTED WITH A ^Q. +RFNJ2: ILDB E,D + TRNN D,#C ;IF THE BP IN D ADVANCES PAST C, + JRST RFNJ4 + PUSHJ P,RFNJ3 ;FETCH ANOTHER WORD INTO C, MAKE D POINT THERE AGAIN, + LDB E,D ;AND FETCH THE SAME BYTE OVER AGAIN. +RFNJ4: SOJL W,RFNJ5 + EXCH TT,E + PUSHJ P,NRFNSB ;STORE BYTE INTO CALLER, UNLESS HIS STRING IS FULL. + EXCH TT,E + CAIN TT,^Q ;A QUOTED CHAR DOES NOT TERMINATE AND DOES NOT QUOTE. + MOVEI E,1 + MOVE TT,E + JUMPN E,RFNJ2 ;STOP STORING AFTER A NULL WHICH ISN'T QUOTED. +RFNJ5: SETZ Q, + POP P,T + POP P,TT + JRST LSWPOP + +;READ THE NEXT WORD (ADDR IN B) FROM THE BOJ JOB. +RFNJ3: SETZ C, + PUSH P,U + PUSH P,A + PUSH P,Q + MOVE U,JBCJUI(A) + LDB A,[121000,,B] + PUSHJ P,UPLC ;LOOK UP THE BOJ JOB'S PAGE. + POP P,Q + POP P,A + POP P,U + LDB J,T ;IF IT DOESN'T EXIST, LOAD A ZERO, + JUMPE J,RFNJ6 ;AVOID GETTING MPV. + MOVE J,JBCJUI(A) + PUSHJ P,MPLDJ + UMOVE C,(B) +RFNJ6: HRRI D,C + AOJA B,MPLDZ + +;RFPNTR FOR USR: + +RFPUSR: HRRZ A,IOCHST-IOCHNM(R) ;GET THE ACCESS PTR + MOVEI B,36. ;BYTE SIZE IS ALWAYS FULL WORD. + JRST POPJ1 + +;RFPNTR FOR DISK + +RFPQSK: LDB B,[QSBSIZ(A)] ;GET FILE BYTE SIZE + MOVSI T,%QAACC + TDNN T,QSRAC(A) ;IF .ACCESS WAS DONE AND NOT HANDLED, + JRST RFPQS1 + MOVE A,QRADAD(A) ;GET WHAT THE .ACCESS SPECIFIED. + JRST POPJ1 + +RFPQS1: MOVE J,QFBLNO(A) ;GET BYTE # OF STRAT OF CURRENT BLOCK. + SKIPGE QSMDN(A) ;SKIP ON A BUFFER ACTIVE + JRST RFPQS2 ;NONE ACTIVE => QFBLNO POINTS TO NEXT BLOCK TO BE READ. + ADD J,QMPBSZ(A) ;ELSE CORRECT FOR THE NUMBER OF BYTES WE'VE PROCESSED + SUB J,QSMPRC(A) ;IN THE ACTIVE BLOCK (QFBLNO -> 1ST WD OF BLOCK). +RFPQS2: MOVE A,J + JRST POPJ1 + +SUBTTL RESET,IOPUSH,IOPOP,IOPDL,FORCE,FLUSH .CALLS + +;.RESET CH, ;RESET BUFFERED INFO ON CHANNEL CH + ;NOT IMPLEMENTED FOR MANY DEVICES + ;HAS SPECIAL EFFECTS ON "USR" DEVICE +;.CALL RESET +;ARG 1 - CHANNEL NUMBER + +NRESET: HRRZ A,H + AOSA (P) +ARESET: HRRZ A,(R) ;PICK UP INDEX FROM I/O CH WORD + SKIPA T,[HRRZ T,RSTB1(A)] ;.RESET USES RH OF TABLE +AIOPP1: MOVE T,[HLRZ T,RSTB1(A)] ;.IOPUSH, .IOPOP USE LH OF TABLE + IDIVI A,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD A,[440500,,RSTB] + IBP A + SOJGE B,.-1 + LDB A,A ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;IO CHANNEL PUSH DOWN LIST ROUTINES +;C(I) =0 AT DSP => IOPUSH =1 => IOPOP + +NIOPUS: AOS (P) +AIOPUSH:MOVE T,SIOCP(U) ;PICK UP PDL POINTER + CAML T,[LUIOP-1,,0] ;LUIOP-2,, is OK, leaves room for 1 more. + JRST IOCER6 ;OVER PUSH ERROR + PUSH T,(R) ;PUSH CURRENT IOCHNM + PUSH T,IOCHST-IOCHNM(R) ;&IOCHST + HRRZ A,(R) + HRRZ J,UUAC(U) + DPB J,[400400,,(T)] ;STORE CHANNEL NUM FOR POSSIBLE USE BY AIOPDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,0 ;INDICATE IOPUSH + PUSH P,R + PUSHJ P,AIOPP1 ;CALL DEVICE'S IOPDL HANDLER. SHOULD NOT HANG + POP P,R + SETZM (R) ;CLEAR OUT IOCHNM + SETZM IOCHST-IOCHNM(R) ;&IOCHST + POPJ P, + +NIOPOP: AOS (P) +AIOPOP: PUSHJ P,ACLOSE ;CLOSE WHATEVER MAY BE OPEN ON CHANNEL POPPING INTO + MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 + JRST IOCER5 ;OVER POP ERROR + POP T,IOCHST-IOCHNM(R) ;POP BACK IOCHST + POP T,(R) ;&IOCHNM + HRRZ A,(R) + SETZM 1(T) ;CLEAR OUT PDL WORD TO AVOID CONFUSION IN + ;ROUTINES THAT GROVEL OVER I/O PDL + MOVEM T,SIOCP(U) ;STORE BACK PDL POINTER + MOVEI I,1 ;INDICATE IOPOP + JRST AIOPP1 ;CALL DEVICE'S IOPDL HANDLER + +AIOPDL: MOVE T,SIOCP(U) ;PICK UP PDL POINTER + TLNN T,-1 ;SKIP UNLESS IO PDL EMPTY + POPJ P, + LDB R,[400400,,(T)] ;FIND OUT WHAT CHNL TOP ENTRY WAS PUSHED FROM + ADDI R,IOCHNM(U) + PUSHJ P,AIOPOP ;POP BACK INTO CHNL PUSHED FROM + JRST AIOPDL + +IIOPPR: JUMPE I,[JRST 4,CPOPJ] ;IOPUSH + SETZM (R) ;CLOSE CHANNEL + SUBI R,IOCHNM(U) ;GET CHANNEL NUMBER + MOVE R,CHNBIT(R) ;SECOND WORD INTERRUPT BIT + IORM R,IFPIR(U) ;GIVE TO USER + POPJ P, + +;.CALL FORCE +;ARG 1 - CHANNEL NUMBER +;IF ANY OUTPUT IS BUFFERED UP, CAUSES IT TO BE SENT TO THE DEVICE +;(IF FORCE WAS NOT DONE, IT MIGHT NOT BE SENT UNTIL A COMPLETE +;BUFFERFULL HAD BEEN OUTPUT BY THE USER.) + +NFORCE: SKIPA T,[HLRZ T,DFRCTB(D)] ;FORCE USES LH OF TABLE +NFINI1: MOVE T,[HRRZ T,DFRCTB(D)] ;FINISH USES RH OF TABLE + HLRZ A,(R) ;PASS LH(IOCHNM) TO DEVICE ROUTINES + HRRZ D,(R) ;USE RH(IOCHNM) AS BYTE INDEX INTO RSTB + IDIVI D,7 ;TABLE IS IN 5-BIT BYTES TO SAVE SPACE + ADD D,[440500,,RSTB] + IBP D + SOJGE E,.-1 + LDB D,D ;GET BYTE FROM TABLE + XCT T ;GET REAL TABLE ENTRY IN T + JRST (T) ;DISPATCH + +;.CALL FINISH +;ARG 1 - CHANNEL NUMBER +;FIRST DOES A FORCE, THEN WAITS FOR ALL OUTPUT TO GET TO THE DEVICE + +NFINIS: PUSHJ P,NFORCE ;CALL DEV ROUTINE FOR FORCING + POPJ P, + JRST NFINI1 ;THEN CALL DEV ROUTINE FOR WAITING + +;.NETS CH, - UUO VERSION OF .CALL FORCE. +ANETS: PUSHJ P,NFORCE + JRST IOCER1 ;ILLEGAL HARDWARE OPERATION + POPJ P, + +SUBTTL I/O DEVICE DISPATCH TABLES + +COMMENT | + This page tries to document the ITS I/O device dispatch tables and +dispatch environment. It is not completed yet. + +The tables use several different indices, which are: + opnidx - result of device name lookup in DEVTAB + ioidx - result of OPEN; has symbolic values. This is the index + stored in RH of IOCHNM (per-job channel table) + sidx - secondary index from DCHSTB(ioidx) + ridx - secondary index from RSTB(ioidx) + +The following system calls are dispatched through these tables. +There are 11 dispatch routines that each device must specify. +The format is "CALL [table name(index-used) -> device-routine]" + +OPEN [DEVADR(opnidx) -> devO] + "opnidx" is looked up from DEVTAB which holds the device names. + The device's OPEN routine is in the RH of DEVADR. + It must set up the user's IOCHNM word for the channel, + by setting the RH to the right "ioidx" and the LH to whatever + the device wants. + + Context: + +CLOSE [CLSTB(ioidx) -> devCLS] + The device's CLOSE routine is in the RH of CLSTB. + It must zero the user's IOCHNM word for the channel. + + Context: + +IOT, SIOT [IOTTB(ioidx) -> devVarious] + These routines do I/O transfers. The main reason "ioidx" + has so many possible values (causing IOTTB to be large) is + because lots of devices specify different ioidx's for different + modes - input/output, block/unit, image/ascii, etc - in order + to speed up actual I/O transfers, which are probably the most + common device-related system calls. + + Context: + +STATUS [LH(DTSTB(sidx)) -> devSTA] + +WHYINT [RH(DTSTB(sidx)) -> devWHY] + +RCHST, RFNAME [LH(DRFNTB(sidx)) -> devRCH] + +RFPNTR [RH(DRFNTB(sidx)) -> devRFP] + +IOPUSH, IOPOP [LH(RSTBI(ridx)) -> devIOP] + +RESET [RH(RSTBI(ridx)) -> devRST] + +FORCE [LH(DFRCTB(ridx)) -> devFRC] + +FINISH [RH(DFRCTB(ridx)) -> devFIN] + +| + +;DISPATCH TABLE FOR .CLOSE UUO +;TRANSFERED THROUGH USING RIGHT HALF OF IOCHNM WORD AS AN INDEX +;R HAS THE ADDRESS OF THE IOCHNM WORD. +; +;VARIOUS ROUTINES USE THE BITS IN THE L.H. TO DECIDE WHETHER +;A CHANNEL IS ACCEPTABLE FOR SOME OPERATION. +%CLS==1,,525252 +%CLSU==400000 ;USR DEVICE (INFERIOR) +%CLSDO==200000 ;DECTAPE OUTPUT +%CLSJI==100000 ;JOB INPUT +%CLSDI==40000 ;DECTAPE INPUT +%CLSTI==20000 ;TTY INPUT +%CLSCL==10000 ;CORE-LINK DEVICE +%CLSBJ==4000 ;BOJ DEVICE +%CLSQO==2000 ;DISK OUTPUT +%CLSFU==1000 ;NON-INFERIOR USR +%CLSNRM==400 ;STANDARD CLOSE ROUTINE USED FOR THIS DEVICE. + ;RH SHOULD POINT, NOT AT THEROUTINE, BUT AT THE USR-USE PAIR +%CLSQ==200 ;DISK +%CLS6==100 ;PDP6 +%CLSJO==40 ;JOB OUTPUT +%CLSST==20 ;STY DEVICE +%CLST==10 ;TRAP DEVICE + +%CLSJ==%CLSJI\%CLSJO ;EITHER DIRECTION OF JOB DEVICE +%CL1QO==%CLSQO\%CLSQ ;BOTH BITS FOR DISK OUTPUT + +CLSTB: CPOPJ + OFFSET -CLSTB +TYIDN:: REPEAT 2, %CLSTI,,TYICLS ;TYI +TYODN:: REPEAT 2, TYOCLS ;TYO +NLIDN:: REPEAT 4, CPOPJ ;NULL +UWIDN:: REPEAT 4, %CLSU ,,CPOPJ ;USER +FUWIDN:: REPEAT 2, %CLSFU,,CPOPJ ;FOREIGN USER +DNDIRH:: DIRHCL ;DIRHNG +DNTRAP:: %CLST,,CPOPJ ;TRAP +DNLCK:: LCKCL ;LOCK +IFN KS10P,DNUBI:: UBICL ;UNIBUS INTERRUPT +IFN CHAOSP,CHAIDN:: REPEAT 2, CHACLS ;CHAOS NET +IFN NUNITS,[ +DNUACII:: REPEAT 3,[ + %CLSDI,,UTICL ;UTAPE. + %CLSDO,,UTOCL +]] +IFN OLPTP,LPTDN:: REPEAT 2, LPTCLS ;LPT +IFN NLPTP,[ +NLPTDN:: NLPDCL + NLPTCL +] +IFN GLPTP,GLPTDN:: REPEAT 2, GLPCLS +DIRCHN:: REPEAT 4, UTDCLS ;DIRECTORY DEVICE +IFN VIDP,NVIDOP:: REPEAT 2, NVDCLS ;NVIDI +IFN PLTP,PLTDN:: REPEAT 2, %CLSNR,,PLTUSR ;PLOTTER +IFN PTRP,[ +PTPI:: REPEAT 5, %CLSNR,,PTPUSR ;PAPER TAPE PUNCH +] +IFN IMXP,IMPXDN:: REPEAT 4, IMPXCL ;IMX +IFN OMXP,OMPXDN:: REPEAT 4, OMPXCL ;OMX +DCLUAI:: %CLSCL,,CLCLRA ;CORE LINK + %CLSCL,,CLCLWU + REPEAT 2,[ + %CLSCL,,CLCLRB + %CLSCL,,CLCLWB + ] +IFN PTRP,[ +REDUAI:: REPEAT 5, PTRCLS ;PAPER TAPE READER +] +IFN 340P,[ +DN340B:: REPEAT 4, ADCL1 ;340 +; ADCL1 ;IDS +] +IFN CODP,[ +CODDN:: REPEAT 2, CODCLS ;CODE DEV +] +DQUAI:: %CLSQ ,,QICL ;DISK + %CL1QO,,QOCLR + %CLSQ ,,QICL + %CL1QO,,QOCL + %CLSQ ,,QICL + %CL1QO,,QOCL +IFN VIDP,DNVDIU:: REPEAT 4, TVCCLS ;TVC +IFN PDP6P,PDPUIO:: REPEAT 4, %CLS6 ,,PDPCLS ;USR IN PDP10 MODE +IFN TABP,DTABUI:: REPEAT 2, %CLSNR,,TABUSR ;TABLET +IFN NMTCS,[ +MTUAIX:: REPEAT 3, MTICL ;MAG TAPE + REPEAT 3, MTOCL + ] +JDUAI:: REPEAT 3,[ + %CLSJI,,JOBCLS ;JOB DEVICE + %CLSJO,,JOBCLS + ] +BDUAI:: REPEAT 6, %CLSBJ,,CPOPJ ;BOJ +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: CPOPJ ;SPY +STYDUI:: REPEAT 2,[ ;PSEUDO TTY + %CLSST,,STYICL + %CLSST,,STYOCL + ] +IFN NCPP,NETDUI:: REPEAT 4, NETCLS ; Arpanet NCP +IFN TCPP,TCPDUI:: REPEAT 4, TCPCLS ; Internet TCP +IFN INETP,IPQDN:: IPQCLS ; Internet Queue +IFN MSPP,MSPIO:: MSCLOS ;MESS SWITCHER (DM) +IFN STKP,STKDP:: STKCLS ;STANFORD KEYBOARD +IFN NTYP,NTYIT:: REPEAT 4, NTYCLS ;A KLUDGE ON THE NTY + OFFSET 0 +IF2,IFN .-CLSTB-LIOTTB,.ERR BARF AT CLSTB + +;DISPATCH TABLE FOR .IOT UUO +;TRANSFERED THROUGH USING RIGHT HALF OF I/O CHANNEL WORD AS AN INDEX +%IOT==1,,525252 +%IOTBK==400000 ;4.9 = 1 => BLOCK = 0 => UNIT +%IOTOT==200000 ;4.8 = 1 => OUTPUT = 0 => INPUT " +%IOTBP==100000 ;4.7 = 1 => THERE IS A SPECIAL ROUTINE FOR SIOT, + ;AND ITS ADDRESS IS -1 + RH(IOTTB WORD). +%IOTSP==40000 ;4.6 => THIS DEVICE IS FUNNY. SIOT ISN'T ALLOWED, + ;AND IOT LETS THE DEVICE RTN DO ALL THE WORK. + ;PRESENT ONLY FOR UNIT INPUT MODES. +%IOT10==20000 ;4.5 => THIS CHANNEL WAS OPENED WITH BIT 1.4 SET IN MODE +%IOTIM==10000 ;4.4 => THIS CHANNEL WAS OPENED WITH BIT 1.3 (IMAGE MODE) SET IN MODE +; 4000 ;4.3 COPIES %IOTBK. THUS, BITS 4.5-4.2 REFLECT THE BOTTOM 4 BITS +; 2000 ;4.2 COPIES %IOTOT. OF THE OPEN-MODE. +%IOTOM==36000 ;BITS 4.5 - 4.2 + +%IOTBO==606000 ;BLOCK OUTPUT. +%IOTBI==404000 ;BLOCK INPUT. +%IOTUO==202000 ;UNIT OUTPUT. +%IOTUI==000000 ;UNIT INPUT. + +IOTTB: IOCER8 + OFFSET -IOTTB +TYIDN:: %IOTUI,,TYI ;TTY ENTRIES MUST BE COMPACT +TYIBN:: %IOTBI,,TTYBI +TYODN:: %IOTUO,,TYO (%IOTBP) +TYOBN:: %IOTBO,,TTYBO ;LAST TTY DEVICE +NLIDN:: %IOTUI,,NULI +NLBIDN:: %IOTBI,,NULBI +NLODN:: %IOTUO,,CPOPJ +NLBDN:: %IOTBO,,NULBOD +UWIDN:: %IOTUI,,UWI (%IOTIM) +UBIDN:: %IOTBI,,UBI +UWODN:: %IOTUO,,UWO (%IOTIM) +UBODN:: %IOTBO,,UBO +FUWIDN:: %IOTUI,,UWI (%IOT10) +FUBIDN:: %IOTBI,,UBI (%IOT10) +DNDIRH:: %IOTUI,,IOCR10 +DNTRAP:: TRPDEV +DNLCK:: %IOTUO,,IOCR10 +IFN KS10P,[ +DNUBI:: %IOTUI,,IOCR10 +];KS10P +IFN CHAOSP,[ +CHAIDN:: %IOTUI+%IOTBP,,CHAUI +CHAODN:: %IOTUO+%IOTBP,,CHAUO +];CHAOSP +IFN NUNITS,[ +DNUACII:: %IOTUI,,UASCII +DNUACCO:: %IOTUO,,UASCCO +DNUBKI:: %IOTBI,,UBLKI +DNUBKO:: %IOTBO,,UBLKO +DNUDTI:: %IOTUI,,UDATAI (%IOTIM) +DNUDTO:: %IOTUO,,UDATAO (%IOTIM) +] +IFN OLPTP,[ +LPTDN:: %IOTUO,,PILPT1 +LPTBN:: %IOTBO,,BLPTO +] +IFN NLPTP,[ +NLPTDN:: %IOTUO,,NLPT1 +NLPTBN:: %IOTBO,,BNLPTO +] +IFN GLPTP,[ +GLPTDN:: %IOTUO,,GLPTDO (%IOTBP) +GLPTBN:: %IOTBO,,GLPTBO +] +DIRCHN:: %IOTUI,,DIRCH +DIRBN:: %IOTBI,,DIRB +NDATAI:: %IOTUI,,DDATAI (%IOTIM+%IOTBP) +NBLKI:: %IOTBI,,DBLKI (%IOTIM) +IFN VIDP,[ +NVIDOP:: %IOTUI,,NVIDIT (%IOTSP) +BNVIDO:: %IOTBI,,BNVIDI +] +IFN PLTP,[ +PLTDN:: %IOTUO,,PLOT +PLTBN:: %IOTBO,,BPLOT +] +IFN PTRP,[ +PTPI:: %IOTUO,,PIPUN (%IOT10) +PTPA:: %IOTUO,,APIPUN +PTPB:: %IOTBO,,BPIPUN +PTPWA:: %IOTUO,,WAPIPN (%IOTIM) +PTPWB:: %IOTBO,,WBPIPN (%IOTIM) +] +IFN IMXP,[ +IMPXDN:: %IOTUI,,IMPXS (%IOTSP) +IMXDN:: %IOTUI,,IMPXS1 (%IOTSP) +BIMXDN:: %IOTBI,,BIMXS1 (%IOTSP) +BIMPXD:: %IOTBI,,BIMPXS (%IOTSP) +] +IFN OMXP,[ +OMPXDN:: %IOTUO,,OMPXS (%IOTSP) +OMXDN:: %IOTUO,,OMXDS (%IOTSP) +BOMXDN:: %IOTBO,,BOMXDS (%IOTSP) +BOMPXD:: %IOTBO,,BOMPXS (%IOTSP) +] +DCLUAI:: %IOTUI,,CLUAI +DCLUAO:: %IOTUO,,CLUAO +DCLBI:: %IOTBI,,CLBI +DCLBO:: %IOTBO,,CLBO +DCLUBI:: %IOTUI,,CLUBI (%IOTIM) +DCLUBO:: %IOTUO,,CLUBO (%IOTIM) +IFN PTRP,[ +REDUAI:: %IOTUI,,PTRUAI +REDBAI:: %IOTBI,,PTRBAI +REDUII:: %IOTUI,,PTRUII (%IOTIM) +REDBII:: %IOTBI,,PTRBII (%IOTIM) +REDUTI:: %IOTUI,,PTRUTI (%IOT10) +] +IFN 340P,[ +DN340B:: %IOTBO,,340B ;340 ENTRIES MUST BE COMPACT; BLOCK FIRST, THEN UNIT +DN340W:: %IOTUO,,340W (%IOTSP) +DN340C:: %IOTUO,,340C (%IOTSP) +DN340H:: %IOTUO,,340H (%IOTSP) +;DN340I:: %IOTUO,,340I (%IOTSP) +DN340L:: ;LAST 340 DEVICE ENTRY +] +IFN CODP,[ +CODDN:: %IOTUO,,SEND +CODBN:: %IOTBO,,BSEND +] +DQUAI:: %IOTUI,,QUAI (%IOTBP) +DQUAO:: %IOTUO,,QUAO (%IOTBP) +DQBI:: %IOTBI,,QBI +DQBO:: %IOTBO,,QBO +DQUII:: %IOTUI,,QUII (%IOTIM %IOTBP) +DQUIO:: %IOTUO,,QUIO (%IOTIM %IOTBP) +IFN VIDP,[ +DNVDIU:: %IOTUI,,RNVDIU (%IOTSP) +DNVDIB:: %IOTBI,,RNVDIB (%IOTSP) +DNVDOU:: %IOTUO,,RNVDOU (%IOTSP) +DNVDOB:: %IOTBO,,RNVDOB (%IOTSP) +] +IFN PDP6P,[ +PDPUIO:: %IOTUO,,UWO ;BUT JOB WILL BE -1 TO INDICATE PDP6 +PDPBIO:: %IOTBO,,UBO +PDPUII:: %IOTUI,,UWI +PDPBII:: %IOTBI,,UBI +] +IFN TABP,[ +DTABUI:: %IOTUI,,UTABI +DTABBI:: %IOTBI,,BTABI +] +IFN NMTCS,[ +MTUAIX:: %IOTUI,,MTUAI (%IOTBP) ;MAGTAPE +MTUIIX:: %IOTUI,,MTUII (%IOTIM %IOTBP) +MTBIX:: %IOTBI,,MTBI +MTUAOX:: %IOTUO,,MTUAO (%IOTBP) +MTUIOX:: %IOTUO,,MTUIO (%IOTIM %IOTBP) +MTBOX:: %IOTBO,,MTBO +] +JDUAI:: %IOTUI,,JBUI(%IOTBP) +JDUAO:: %IOTUO,,JBUI(%IOTBP) +JDBI:: %IOTBI,,JBBI +JDBO:: %IOTBO,,JBBI +JDUII:: %IOTUI,,JBUI (%IOTBP %IOTIM) +JDUIO:: %IOTUO,,JBUI (%IOTBP %IOTIM) +BDUAI:: %IOTUI,,BJUI +BDUAO:: %IOTUO,,BJUO +BDBI:: %IOTBI,,BJBI +BDBO:: %IOTBO,,BJBO +BDUII:: %IOTUI,,BJUI (%IOTIM) +BDUIO:: %IOTUO,,BJUO (%IOTIM) +IIOPOP:: [JRST 4,CPOPJ] ;INTERRUPT ON IOPOP DEVICE +ISPY:: %IOTUI,,SPYI +STYDUI:: %IOTUI,,STTYI ;PSEUDO TTY +STYDUO:: %IOTUO,,STTYW +STYDBI:: %IOTBI,,STTBI +STYDBO:: %IOTBO,,STTBO +IFN NCPP,[ +NETDUI:: %IOTUI,,NETI +NETDUO:: %IOTUO,,NETW (%IOTBP) +NETDBI:: %IOTBI,,NETBI +NETDBO:: %IOTBO,,NETBO +] +IFN TCPP,[ +TCPDUI:: %IOTUI,,TCPI (%IOTBP) +TCPDUO:: %IOTUO,,TCPW (%IOTBP) +TCPDBI:: %IOTBI,,TCPBI +TCPDBO:: %IOTBO,,TCPBO +] +IFN INETP,[ +IPQDN:: IPQIO ; No I/O calls used on this dev! +] +IFN MSPP,[ +MSPIO:: IOCR10 +] +IFN STKP,[ +STKDP:: STKI +] +IFN NTYP,[ +NTYIT:: %IOTUI,,NTYTI ;KLUDGE FOR FAST, LARGE BUFFER ON NTY +NTYOT:: %IOTUO,,NTYTO +NTYBIT:: %IOTBI,,NTYBI +NTYBOT:: %IOTBO,,NTYBO +] + OFFSET 0 +LIOTTB==.-IOTTB + +;TABLES FOR VARIOUS CHANNEL STATUS CALLS + +;DCHSTB - INDEXED BY IOTTB INDEX (RH OF IOCHNM) +;LH SIXBIT MAIN DEVICE NAME +;1.1-2.3 INDEX INTO THE NEXT TWO TABLES +;2.4-2.9 SYSTEM PERIPHERAL DEVICE CODE (FOR .STATUS) +.SEE DCHSTB ;ASSEMBLED SECOND TO GET VALUES OF THE TEMPORARY %%dev SYMBOLS. + +;DSTSTB - INDEX FROM DCHSTB +;LH STATUS ROUTINE, RH WHYINT ROUTINE (OPNL34 IF DEVICE DOESN'T GIVE 2ND WD INTS) + +DSTSTB: CPOPJ,,OPNL44 ;0 CHANNEL NOT OPEN + STDSTA,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + STATYI,,TYIWHY ;3 TTY INPUT + STATYO,,TYOWHY ;4 TTY OUTPUT + CPOPJ,,OPNL34 ;5 USR DEVICE + CPOPJ,,OPNL34 ;6 DIR "DEVICE" + CLISTA,,OPNL34 ;7 CORE LINK INPUT + STDSTA,,OPNL34 ;10 CORE LINK OUTPUT + CPOPJ,,OPNL34 ;11 DISK + JBSTAT,,OPNL22 ;12 JOB DEVICES (WHYINT SHOULDN'T GET HERE) + CPOPJ,,OPNL34 ;13 BOJ DEVICE + STASTI,,STIWHY ;14 STY INPUT + STASTO,,STOWHY ;15 STY OUTPUT + CPOPJ,,TRPDEV ;16 TRAP DEVICE + CPOPJ,,OPNL34 ;17 DIRHNG DEVICE + CPOPJ,,OPNL34 ;20 SPY DEVICE + CPOPJ,,OPNL34 ;21 LOCK DEVICE +OFFSET -DSTSTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: CPOPJ,,UBIWHY +IFN NMTCS, %%MT:: STAMTC,,OPNL34 +IFN NUNITS,%%UTP:: CPOPJ,,OPNL34 +IFN OLPTP, %%OLP:: STALPT,,OPNL34 +IFN NCPP, %%NET:: STANET,,NETWHY +IFN TCPP, %%TCP:: TCPSTA,,TCPWHY +IFN INETP, %%IPQ:: IPQSTA,,IPQWHY +IFN CHAOSP,%%CHA:: CPOPJ,,CHAWHY +OFFSET 0 + +;DRFNTB - INDEX FROM DCHSTB +;LH RFNAME ROUTINE, RH RFPNTR ROUTINE OR OPNL34 IF NOT RANDOM ACCESS + +DRFNTB: CPOPJ,,OPNL44 ;0 CHNL NOT OPEN + CPOPJ,,OPNL34 ;1 RANDOM DEVICE + CPOPJ,,OPNL34 ;2 OTHER KIND OF RANDOM DEVICE + RCHTTY,,OPNL34 ;3 TTY INPUT + RCHTTY,,OPNL34 ;4 TTY OUTPUT + RCHUSR,,RFPUSR ;5 USR DEVICE + RCHDIR,,OPNL34 ;6 DIR "DEVICE" + RCHCLO,,OPNL34 ;7 CORE LINK INPUT + RCHCLO,,OPNL34 ;10 CORE LINK OUTPUT + RCHQSK,,RFPQSK ;11 DISK + RFNJOB,,RFPJOB ;12 JOB DEVICES + RCHBOJ,,OPNL34 ;13 BOJ DEVICE + RCHSTY,,OPNL34 ;14 STY INPUT + RCHSTY,,OPNL34 ;15 STY OUTPUT + CPOPJ,,CPOPJ ;16 TRAP DEVICE + RCHDRH,,OPNL34 ;17 DIRHNG DEVICE + SPYRCH,,OPNL34 ;20 SPY DEVICE + LCKRCH,,OPNL34 ;21 LOCK DEVICE +OFFSET -DRFNTB ;BEGIN OPTIONAL DEVICES +IFN KS10P, %%UBI:: UBIRCH,,OPNL34 +IFN NMTCS, %%MT:: RCHMGT,,OPNL34 +IFN NUNITS,%%UTP:: RCHUTP,,OPNL34 +IFN OLPTP, %%OLP:: CPOPJ,,OPNL34 +IFN NCPP, %%NET:: NETRCH,,OPNL34 +IFN TCPP, %%TCP:: TCPRCH,,TCPRFP +IFN INETP, %%IPQ:: IPQRCH,,IPQRFP +IFN CHAOSP,%%CHA:: CHARCH,,OPNL34 +OFFSET 0 +IFN <.-DRFNTB>-, .ERR DRFNTB & DSTSTB NOT SAME LENGTH + +DEFINE XX NTIMES,DEVNAM,DN,SNXXX,IDX +IFNB DN, DN==:.-DCHSTB ;CHECK THAT DCHSTB IS IN SAME ORDER AS IOTTB +IFG SIXBIT/DEVNAM/, ZZ==[SIXBIT/DEVNAM/] ;DECIDE WHETHER FITS IN LH +.ELSE [ +IFE SIXBIT/DEVNAM/&777777, ZZ==(SIXBIT/DEVNAM/) +.ELSE ZZ==[SIXBIT/DEVNAM/] +] +REPEAT NTIMES, ZZ,,SNXXX_14+IDX +TERMIN + +DCHSTB: XX 1,,,,0 ;CHNL NOT OPEN + XX 2,TTY,TYIDN,,3 ;TTY INPUT + XX 2,TTY,TYODN,,4 ;TTY OUTPUT + XX 4,NUL,NLIDN,SNNUL,1 ;NUL DEVICE + XX 4,USR,UWIDN,SNUSR,5 ;USR DEVICE + XX 2,USR,FUWIDN,SNFUSR,5 ;FOREIGN USR + XX 1,DIRHNG,DNDIRH,SNDIRH,17 ;DIRHNG + XX 1,TRAP,DNTRAP,SNTRAP,16 ;TRAP + XX 1,LOCK,DNLCK,SNLCK,21 ;LOCK +IFN KS10P, XX 1,UBI,DNUBI,SNUBI,%%UBI ;UBIBUS INTERRUPT +IFN CHAOSP, XX 2,CHAOS,CHAIDN,SNCHA,%%CHA ;CHAOS NET +IFN NUNITS, XX 6,UT,DNUACII,SNUTC,%%UTP ;MICRO TAPE +IFG LPTP-1, XX 2,OLP,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT IN 2-LPT SYSTEM +.ELSE IFN OLPTP, XX 2,LPT,LPTDN,SNLPD,%%OLP ;DATA PRODUCTS LPT +IFN NLPTP, XX 2,LPT,NLPTDN,SNLPV,1 ;"VOGUE" LPT (ACTUALLY ODEC) +IFN GLPTP, XX 2,LPT,GLPTDN,SNLPV,1 ;GOULD LPT + XX 4,DIR,DIRCHN,SNDIR,6 ;DIR "DEVICE" +IFN VIDP, XX 2,NVD,NVIDOP,SNBAT,2 ;VIDISSECTOR +IFN PLTP, XX 2,PLT,PLTDN,SNPLT,1 ;PLOTTER +IFN PTRP, XX 5,PTP,PTPI,SNPTP,1 ;PAPER TAPE PUNCH +IFN IMXP, XX 4,IMX,IMPXDN,SNIMPX,1 ;INPUT A/D MULTIPLEXOR +IFN OMXP, XX 4,OMX,OMPXDN,SNOMPX,1 ;OUTPUT A/D MULTIPLEXOR + XX 3,CLO,DCLUAI,SNCLK,7 ;CORE LINK INPUT + XX 3,CLO,DCLBO,SNCLK,10 ;CORE LINK OUTPUT +IFN PTRP, XX 5,PTR,REDUAI,SNPTR,1 ;PAPER TAPE READER +IFN 340P, XX 4,DIS,DN340B,SN340,2 ;340 DISPLAY +;IFN 340P, XX 1,IDS,DN340I,SN340I,2 ;340 INTERPRETIVE DISPLAY +IFN CODP, XX 2,COD,CODDN,SNCOD,1 ;CODE + XX 6,DSK,DQUAI,SN2311,11 ;DISK +IFN VIDP, XX 4,TVC,DNVDIU,SNBAT,2 ;TV CAMERA +IFN PDP6P, XX 4,PDP,PDPUIO,SNPDP,5 ;PDP-6 DEVICE +IFN TABP, XX 2,TAB,DTABUI,SNTAB,2 ;TABLET +IFN NMTCS, XX 6,MT0,MTUAIX,SNMTC,%%MT ;MAGTAPE + XX 6,JOB,JDUAI,SNJOB,12 ;JOB DEVICES + XX 6,BOJ,BDUAI,SNBOJ,13 ;BOJ DEVICE + XX 1,IIP,IIOPOP,0,2 ;INTERRUPT-ON-IOPOP DEVICE + XX 1,SPY,ISPY,SNSPY,20 ;SPY +REPEAT 2,[ + XX 1,STY,,SNSTY,14 ;STY INPUT + XX 1,STY,,SNSTY,15 ;STY OUTPUT +] +IFN NCPP, XX 4,NET,NETDUI,SNNET,%%NET ; Arpanet NCP +IFN TCPP, XX 4,TCP,TCPDUI,SNTCP,%%TCP ; Internet TCP +IFN INETP, XX 1,IPQ,IPQDN,SNIPQ,%%IPQ ; Internet Queue +IFN MSPP, XX 1,MSP,MSPIO,SNMSP,2 ;MS SWITCH HACK +IFN STKP, XX 1,STK,STKDP,SNSTK,2 ;STANFORD KEYBOARD +IFN NTYP, XX 4,NTY,NTYIT,SNNUL,2 ;NTY 11 KLUDGE + +IFN .-DCHSTB-LIOTTB,.ERR BARF AT DCHSTB +EXPUNGE XX,%%UBI,%%MT,%%UTP,%%OLP,%%NET,%%TCP,%%CHA,%%IPQ + +DCHSTE==.-1 ;END FOR GETSYS (CHDEVS) + +;RSTB - INDEXED BY IOTTB INDEX FROM RH(IOCHNM) +;THIS TABLE IS IN 5-BIT BYTES; THE VALUES ARE THE INDICES +;INTO THE RSTB1 AND DFRCTB TABLES. +.SEE RSTB ;ASSEMBLED SECOND TO GET VALUES OF TEMPORARY %%dev SYMBOLS. + +;RSTB1 - INDEX FROM RSTB (BELOW) +;LH IOPUSH/POP ROUTINE, RH RESET ROUTINE +RSTB1: CPOPJ,,CPOPJ ;0 RANDOM DEVICE + TYIIOP,,TYIRS ;1 TTY INPUT + TYOIOP,,TYORS ;2 TTY OUTPUT + CPOPJ,,USRST ;3 USR DEVICE + CPOPJ,,JBIRS ;4 JOB INPUT + CPOPJ,,JBORS ;5 JOB OUTPUT + IIOPPR,,[JRST 4,CPOPJ] ;6 INTERRUPT ON IOPOP DEVICE + STYIIP,,STYIRS ;7 STY INPUT + STYOIP,,STYORS ;10 STY OUTPUT + CPOPJ,,CPOPJ ;11 DISK OUTPUT + DIRHIP,,CPOPJ ;12 DIRHNG + CPOPJ,,TRPDEV ;13 TRAP + OFFSET -RSTB1 ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: UBIIOP,,CPOPJ +IFN OLPTP, %%LPT:: CPOPJ,,LPTRS +IFN NLPTP, %%NLP:: CPOPJ,,NLPTRS +IFN PLTP, %%PLT:: CPOPJ,,PLTRS +IFN PTRP, %%PTR:: CPOPJ,,PTRRS +IFN PTRP, %%PTP:: CPOPJ,,PUNCLR +IFN IMXP, %%IMX:: CPOPJ,,IMPXRS +IFN 340P, %%340:: CPOPJ,,DSIZAP +IFN CODP, %%COD:: CODIOP,,CODRS +IFN PDP6P, %%PDP:: PDPIOP,,PDPRST +IFN TABP, %%TAB:: CPOPJ,,TABCLR +IFN NCPP, %%NET:: NETIOP,,NETRS +IFN TCPP, %%TCP:: TCPIOP,,TCPRST +IFN INETP, %%IPQ:: IPQIOP,,IPQRST +IFN STKP, %%STK:: CPOPJ,,STKRS +IFN CHAOSP,%%CHA:: CHAIOP,,CPOPJ + OFFSET 0 + +;DFRCTB - INDEX FROM RSTB (BELOW) +;LH FORCE ROUTINE, RH FINISH ROUTINE +DFRCTB: OPNL34,,OPNL34 ;0 RANDOM DEVICE + OPNL2,,OPNL2 ;1 TTY INPUT (ILLEGAL) + POPJ1,,TTYFIN ;2 TTY OUTPUT + OPNL34,,OPNL34 ;3 USR + OPNL2,,OPNL2 ;4 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;5 JOB (SHOULDN'T GET HERE?) + OPNL22,,OPNL22 ;6 IIP (SHOULDN'T GET HERE) + OPNL2,,OPNL2 ;7 STY INPUT (ILLEGAL) + POPJ1,,STYFIN ;10 STY OUTPUT + QSKFRC,,QSKFIN ;11 DISK OUTPUT + OPNL34,,OPNL34 ;12 DIRHNG + TRPDEV,,TRPDEV ;13 TRAP + OFFSET -DFRCTB ;OPTIONAL DEVICES BEGIN HERE +IFN KS10P, %%UBI:: OPNL34,,OPNL34 +IFN OLPTP, %%LPT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN NLPTP, %%NLP:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PLTP, %%PLT:: POPJ1,,POPJ1 ;NEED TO WRITE THESE +IFN PTRP, %%PTR:: OPNL34,,OPNL34 +IFN PTRP, %%PTP:: POPJ1,,PUNFIN +IFN IMXP, %%IMX:: OPNL34,,OPNL34 +IFN 340P, %%340:: OPNL34,,OPNL34 +IFN CODP, %%COD:: POPJ1,,CODFIN +IFN PDP6P, %%PDP:: OPNL34,,OPNL34 +IFN TABP, %%TAB:: OPNL34,,OPNL34 +IFN NCPP, %%NET:: NETFRC,,NETFIN +IFN TCPP, %%TCP:: TCPFRC,,TCPFIN +IFN INETP, %%IPQ:: IPQFRC,,IPQFIN +IFN STKP, %%STK:: OPNL34,,OPNL34 +IFN CHAOSP,%%CHA:: CHAFRC,,CHAFIN + OFFSET 0 + +;TABLE OF INDICES INTO THE RSTB1, DFRCTB TABLES ON THE PRECEDING PAGE +;THESE INDICES ARE UNRELATED TO THE INDICES IN DCHSTB A COUPLE PAGES BACK. +;NOTE THAT THE %% SYMBOLS ARE PURELY TEMPORARY AND EXPUNGED AT THE BOTTOM OF THIS PAGE. + +RSTB: .BYTE 5 + + 0 ;CHNL NOT OPEN + REPEAT 2,1 ;TTY INPUT + REPEAT 2,2 ;TTY OUTPUT + REPEAT 4,0 ;NUL DEVICE + REPEAT 4,3 ;USR DEVICE + REPEAT 2,0 ;FOREIGN USR + 12 ;DIRHNG + 13 ;TRAP + 0 ;LOCK +IFN KS10P, %%UBI ;UNIBUS INTERRUPT +IFN CHAOSP, REPEAT 2,%%CHA +IFN NUNITS, REPEAT 6,0 ;DEC TAPE +IFN OLPTP, REPEAT 2,%%LPT +IFN NLPTP, REPEAT 2,%%NLP +IFN GLPTP, REPEAT 2,0 + REPEAT 4,0 ;DIR "DEVICE" +IFN VIDP, REPEAT 2,0 +IFN PLTP, REPEAT 2,%%PLT +IFN PTRP, REPEAT 5,%%PTP +IFN IMXP, REPEAT 4,%%IMX +IFN OMXP, REPEAT 4,0 + REPEAT 6,0 ;CORE LINK. +IFN PTRP, REPEAT 5,%%PTR +IFN 340P, REPEAT 4,%%340 +;IFN 340P, 0 +IFN CODP, REPEAT 2,%%COD ;CODE + REPEAT 3, 0 ? 11 ;DISK IN, DISK OUT +IFN VIDP, REPEAT 4,0 +IFN PDP6P, REPEAT 4,%%PDP ;PDP-6 DEVICE +IFN TABP, REPEAT 2,%%TAB +IFN NMTCS, REPEAT 6,0 ;MAGTAPE + REPEAT 3,[4 + 5 + ] ;JOB + REPEAT 3,[0 ;BOJ INPUT + 0 ;BOJ OUTPUT + ] ;BOJ + 6 ;INTERRUPT ON IOPOP DEVICE + 0 ;SPY + 7 ? 10 ? 7 ? 10 ;PSEUDO-TTY +IFN NCPP, REPEAT 4,%%NET ;NET RESET INR/INS +IFN TCPP, REPEAT 4,%%TCP ; TCP RESET +IFN INETP, %%IPQ ; Internet Queue +IFN MSPP, 0 ;MS SWITCH HACK +IFN STKP, %%STK ;STANFORD KEYBOARD +IFN NTYP, REPEAT 4,0 ;NTY 11 KLUDGE + +IFN LIOTTB-.BYTC,.ERR BARF AT RSTB + .BYTE +EXPUNGE %%UBI,%%LPT,%%NLP,%%PLT,%%PTR,%%PTP,%%IMX,%%340,%%COD,%%PDP,%%TAB,%%NET,%%TCP,%%STK,%%CHA,%%IPQ + +DEFINE DVHR X,Y +X!Y!TERMIN + +DEFINE DV NAME,OPNRTE,BITS,TAG + SIXBIT/NAME/ +DVHR [DEFINE DVHR X,Y +X!][TAG BITS,,OPNRTE +Y!TERMIN] +TERMIN + +;DEVICE TABLES FOR AOPEN +; +;DEVTAB SIXBIT NAME +;DEVADR + %DVIN==400000 ;4.9 DEVICE CAN DO INPUT + %DVOUT==200000 ;4.8 DEVICE CAN DO OUTPUT + %DVDIR==100000 ;4.7 DEVICE CAN GIVE DIRECTORY + %DVDEL==40000 ;4.6 ALLOW DELETE/RENAME + %DVLNK==20000 ;4.5 ALLOW MLINK + ;RIGHT HALF, OPEN ROUTINE ADDRESS +%DV==1,,520000 ;BIT TYPEOUT MASK + +DEVTAB: +IFN NLPTP, DV LPT,NLPTO,%DVOUT +IFG OLPTP-NLPTP,DV LPT,LPTO,%DVOUT +IFG LPTP-1, DV OLP,LPTO,%DVOUT +IFN GLPTP, DV LPT,GLPTO,%DVOUT +IFN TTLPTP, DV LPT,LPTO,%DVOUT + + DV DSK,QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAQSK: + DV COM,COMO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + MNAME [ DV ],QSKO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;"AI:" ON + ; AI, ETC. + DV SYS,SYSO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV DNRF,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DNR,DNRFO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;DSK NO REF DATE + DV DIRHNG,DIRHO,%DVIN + DV TRAP,TRPDEV,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK + DV LOCK,LCKO,%DVOUT + DV UBI,UBIO,%DVIN + DV TTY,TTYO1,%DVIN+%DVOUT+%DVDIR + DV NUL,NULO,%DVIN+%DVOUT + DV USR,USRO,%DVIN+%DVOUT +IFN VIDP, DV NVD,NVIDI,%DVIN+%DVOUT +IFN CHAOSP, DV CHAOS,CHASO,%DVIN+%DVOUT +IFN NCPP, DV NET,NETO,%DVIN+%DVOUT +IFN TCPP, DV TCP,TCPO,%DVIN+%DVOUT +IFN INETP, DV IPQ,IPQO,%DVIN+%DVOUT +IFN MSPP, DV IPC,IPCO,%DVIN+%DVOUT + DV STY,STTYO,%DVIN+%DVOUT + DV JOB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK,DVAJOB: + DV BOJ,BOJO,%DVIN+%DVOUT + DV OJB,JOBO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN STKP, DV STK,STKO,%DVIN +IFN PLTP, DV PLT,PLOTO,%DVOUT +IFN PLTP, DV IPL,IPLO,%DVOUT ;INTERPRETED PLOTTER +IFN XGP, DV XPL,XPLO,%DVOUT +IFN IMXP, DV IMX,IMPXO,%DVIN +IFN OMXP, DV OMX,OMPXO,%DVOUT +IFN PTRP, DV PTR,PTRO,%DVIN +IFN PTPP, DV PTP,PTPO,%DVOUT +IFN 340P, DV DIS,DISO,%DVOUT ;340 AS OUTPUT DEVICE +;IFN 340P, DV IDS,IDISO,%DVOUT ;340 AS INTERPRETED DISPLAY + DV CLU,CLUO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLO,CLOO,%DVIN+%DVOUT+%DVDIR+%DVDEL + DV CLI,CLIO,%DVOUT+%DVDIR+%DVDEL + DV CLA,CLAO,%DVIN+%DVDIR+%DVDEL +IFN CODP, DV COD,CODO,%DVOUT +IFN VIDP, DV TVC,TVCO,%DVIN+%DVOUT + DV ERR,ERRO,%DVIN +IFN TPLP+TTLPTP&DEMON, DV TPL,TPLO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK +IFN TABP, DV TAB,TABO,%DVIN + DV SPY,SPYO,%DVIN + DV COR,CORO,%DVDIR ;DIR=LAST LINE OF TTY^F +IFN NTYP, DV NTY,NTYOPN,%DVIN+%DVOUT ;NTY 11 KLUDGE + +NDEVS==.-DEVTAB + +DVT1: DV TTY,TTYO,%DVIN+%DVOUT+%DVDIR + DV TY,TTYO,%DVIN+%DVOUT+%DVDIR + DV T,TTYO,%DVIN+%DVOUT+%DVDIR +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT: + DV STY,STTYOA,%DVIN+%DVOUT + DV ST,STTYOA,%DVIN+%DVOUT + DV S,STTYOA,%DVIN+%DVOUT + DV DSK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV DK,QSKUO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR UNIT + DV PK,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK + DV P,QSKPO,%DVIN+%DVOUT+%DVDIR+%DVDEL+%DVLNK ;PARTICULAR PACK +IFN NMTCS, DV MT,MAGTO,%DVIN+%DVOUT ;MAGTAPE + +NDV1==.-DVT1 +EDEVS==.-1 ;END FOR GETSYS (DEVS) + +DEVADR: DVHR +IFN .-DEVADR-NDEVS-NDV1,.ERR DVHR LOST + +SUBTTL .OPER, .CALL DISPATCH + +AOPER: MOVE J,R ;AC FIELD OF UUO + ADDI R,IOCHNM(U) ;SET UP IO CHANNEL REFERENCE POINTER + CAIL C,MXOPR ;SKIP IF UUO E FIELD IS LESS THAN MAX OPR + JRST ILUUO ;ILLEGAL OPER + JRST @OPRDSP(C) ;LEGAL OPER-- DISPATCH ON E FIELD OF UUO + +OPRDSP: ILUUO + OPRIRP A!X ;AITYI,ALISTEN,ASLEEP,ETC. + +; +;CALL DISPATCH +; +ACALL: MOVE B,C ;SET UP COPY OF ERR ADR NOT TO BE RELOCATED + JRST @CALDIS(R) ;DISPATCH INDEX OF UUO'S AC FIELD + +CALDIS: ASYSC + ADISMIS + ALOSE + ATRANAD + AVALRET ;4 + AUTRAN + UACORE + ATRNDL + ADSTART ;10 + AFDELE + ADSTL + ASUSET + ALTPEN ;14 + AVSCAN + APOTSET +REPEAT 20-.+CALDIS,ILUUO + +SUBTTL MISCELLANEOUS UUO'S + +;SHUT DOWN SYSTEM + +ASHUTD: UMOVE C,(J) ;Arg is time to down in thirtieths. + JUMPL C,AREVIV ;Negative time means REVIVE. + CAMG C,[43200.*30.*60.] ;If time is longer than thirty days + CAIGE C,5*60.*30. ; or less than five minutes + POPJ P, ; Fail (prevent clock delta-T from losing). + ADD C,TIME ;Interval+now is when we will die. + PUSHJ P,SWTL ;Seize shutdown lock. + SHUTLK + SKIPGE SHUTDN ;Already down? + JRST LSWPOP ; Yes. + PUSHJ P,CLQDEL ;Flush obsolete clock queue entry, if any. + DEDBLK + MOVEM C,SHUTDN ;Remember time we will die. + SUB C,TIME ;Interval until death. + LSH C,1 ;Time till death after next clock-queue int. + MOVEM C,DEDTIM ;Remember time until death. + PUSHJ P,DEATHX ;Make DEATH entry on clock queue. + BUG ; DEDTIM says time to die already? + JRST LSWPJ1 ;Unlock shutdowns. + +;READ TIME TILL SYSTEM DOWN + +ADIETI: XCTR XW,[SETOM (J)] ;READ -1 IF NOT GOING DOWN + SKIPG A,SHUTDN + POPJ P, ;NOT DYING + SUB A,TIME + JRST APTUAJ ;GIVE TO USER + +;REVIVE SYS + +AREVIV: PUSHJ P,SWTL + SHUTLK + SKIPN SHUTDN + JRST LSWPOP ;NOT DYING + PUSHJ P,CLQDEL + DEDBLK + SETZM SHUTDN + SETZM DEDTIM + PUSHJ P,DEATHM + JRST LSWPOP + +;FROM CLOCK QUEUE BLOCK + +DEATHZ: PUSHJ P,DEATHX + SKIPA + JRST CLQRET + MOVSI T,SCLOUT + PUSHJ P,SUPSET ;DIE + SETOM DEDTIM + JRST CLQRET + +;GET VARIOUS SYS STATUS + +ASSTAT: CONO PI,CLKOFF + SKIPLE A,SHUTDN + SUB A,TIME + SKIPG SHUTDN + SUBI A,1 ;TIME TILL DOWN IF > 0, -1 IF UP, -2 IF DOWN + CONO PI,CLKON + MOVE B,SYSDBG + MOVE C,SUSRS + MOVE D,PARERR + ADD D,NXMERR + MOVE E,TIME + MOVE TT,[ITSMCH] ;SIXBIT NAME OF THIS MACHINE. + MOVE I,[ITSVRS] + MOVN Q,USRHI ;Q GETS NUMBER OF FREE JOB SLOTS + IDIVI Q,LUBLK + ADDI Q,MAXJ + MOVE J,USRHI +ASSTT1: SUBI J,LUBLK + SKIPN UNAME(J) + ADDI Q,1 + JUMPG J,ASSTT1 + JRST POPJ1 + +SUBTTL SYMBOLIC SYSTEM CALL HANDLER + +;IN ORDER @A...Z[\]^_ !".../0...9:;,=.? (THAT IS IN NUMERICAL ORDER) + +SYSCTB: SIXBIT /ACCESS/ ;IOCHNL, ADR + SIXBIT /ATTACH/ + SIXBIT /ATTY/ + SIXBIT /CALL/ ;SIXBIT // +IFN CHAOSP,[ + SIXBIT /CHAOSO/ + SIXBIT /CHAOSQ/ +];CHAOSP + SIXBIT /CLOSE/ ;IOCHNL + SIXBIT /CNSGET/ ;GET SEMIPERMANENT TTY INFO + SIXBIT /CNSSET/ ;SET SEMIPERMANENT INFO (TCMXH, TCTYP, TTYOPT, TTYCOM, ETC) + SIXBIT /CORBLK/ ;HACK PAGE MAP + SIXBIT /CORTYP/ ;READ STATUS OF PAGE. + SIXBIT /DELETE/ ;FILE DELETE + SIXBIT /DELEWO/ ;DELETE FILE OPEN ON SPEC'D CHANNEL +IFN DEMON,SIXBIT /DEMSIG/ ;SIGNAL DAEMON + SIXBIT /DETACH/ ;DISOWN ENTIRE TREE + SIXBIT /DIRSIZ/ + SIXBIT /DISMIS/ + SIXBIT /DISOWN/ ;DISOWN AN INFERIOR JOB +IFN DL10P, SIXBIT /DL10MP/ + SIXBIT /DSKUPD/ ;SIMULATE REFERENCE OF FILE + SIXBIT /ECHOIN/ ;ECHO-NEGOTIATE + SIXBIT /FILBLK/ ; READ NAME AREA OF FILE + SIXBIT /FILLEN/ ;READ FILE LENGTH + SIXBIT /FINISH/ + SIXBIT /FLAP/ ;TAPE # + SIXBIT /FLUSH/ ;OLD NAME FOR FINISH, EVENTUALLY " + SIXBIT /FORCE/ + SIXBIT /IOPOP/ + SIXBIT /IOPUSH/ + SIXBIT /IOT/ ;IOCHNL, QUAN OR BLK POINTER +IFN INETP,SIXBIT /IPKIOT/ + SIXBIT /ITYIC/ + SIXBIT /JOBCAL/ ;GENERAL JOBGET + SIXBIT /JOBGET/ ;JOB CHNL + SIXBIT /JOBINT/ ;JOB CHNL + SIXBIT /JOBIOC/ + SIXBIT /JOBRET/ ;JOB CHNL + SIXBIT /JOBREU/ + SIXBIT /JOBSTS/ ;SET JOB CHNL STATUS +IFN KL10P,SIXBIT /KLPERF/ ;ACTIVATE & CONTROL PERFORMANCE METER + SIXBIT /LISTEN/ ;IOCHNL, ADR + SIXBIT /LNKEDP/ ;DISK CH. RETURNS NONZERO IF LINKS WERE TRACED TO OPEN IT. + SIXBIT /LOAD/ ;USER CH, I/O CH, VARBLK + SIXBIT /LOGIN/ ;SIXBIT // + SIXBIT /LOGOUT/ ;. . . + SIXBIT /LOSE/ + SIXBIT /MLINK/ ;MAKE LINK +IFN NCPP, SIXBIT /NETAC/ + SIXBIT /NETBLK/ ;HANG ON NCP STATE +IFN IMPP,[ + SIXBIT /NETHST/ ;GETS STATUS OF HOST + SIXBIT /NETIMP/ ;GETS STATUS OF IMP +];IMPP +IFN NCPP, SIXBIT /NETINT/ +IFN INETP,[ ; A temporary cond, should become permanent. + SIXBIT /NETRFC/ ; Get pending request for connection +] + SIXBIT /OPEN/ ;FILE OPEN + SIXBIT /PDUMP/ ;USER CH, I/O CH, VARBLK + SIXBIT /PGDUMP/ ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + SIXBIT /PGWRIT/ ;DUMP PAGE OUT OF CORE +IFN CHAOSP, SIXBIT /PKTIOT/ +IFN QAUTHP, SIXBIT /RAUTH/ ;READ AUTHOR OF FILE + SIXBIT /RCHST/ ;READ OPENED FILENAMES & ACCESS POINTER + SIXBIT /RCPOS/ ;READ CURSOR POS +IFN DEMON,SIXBIT /RDDMST/ ;READ DEAMON STATUS + SIXBIT /RDMPBT/ ;READ FILE DUMPED BIT IOCHN, ADR + SIXBIT /RELOAD/ + SIXBIT /RENAME/ ;FILE RENAME + SIXBIT /RENMWO/ ;RENAME WHILE OPEN + SIXBIT /REOWN/ + SIXBIT /RESET/ + SIXBIT /RESRDT/ ;RESTORE REFERENCE DATE + SIXBIT /RFDATE/ ;READ TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /RFNAME/ ;READ FILE NAME AND MODE CHANNEL OPEN TO + SIXBIT /RFPNTR/ ;READ ACCESS POINTER + SIXBIT /RQDATE/ ;READ DSK DATE + SIXBIT /RSSIZE/ ;READ SCREEN SIZE +IFN QAUTHP, SIXBIT /SAUTH/ ;SET AUTHOR OF FILE + SIXBIT /SCML/ ;SET # COMMAND LINES + SIXBIT /SCPOS/ ;SET TTY CURSOR POSITION + SIXBIT /SDMPBT/ ;SET FILE DUMPED BIT IOCHN, ADR + SIXBIT /SETIOC/ ;CAUSE IO CHANNEL ERROR IN JOB/BOJ CHANNEL + SIXBIT /SFDATE/ ;SET TIME OF CREATION OF FILE IOCHN, ADR + SIXBIT /SIOT/ ;IOT A STRING GIVEN B.P. AND LENGTH + SIXBIT /SOPEN/ ;OPEN, TAKING MODE,,CHNL AND BP. + SIXBIT /SRDATE/ ;SET REFERENCE DATE + SIXBIT /SREAPB/ ;SET THE DO NOT REAP BIT + SIXBIT /SSERVE/ ;Set .SERVER without timing errors + SIXBIT /SSTATU/ ;READS VARIOUS SYSTEM STATUS + SIXBIT /STATUS/ +IFN DEMON,SIXBIT /STDMST/ ;SET DEAMON STATUS + SIXBIT /STLGET/ ;GET INFO ON SERVER TELNET CONTROLLING A STY + SIXBIT /STYGET/ ;GET INFO ABOUT SPECIFIED STY +IFN NETP,SIXBIT /STYNET/ ;CONNECT STY TO NETWORK SOCKETS, FOR TELNET SERVERS. + SIXBIT /T11MP/ ;TEMP ? TEN11 HACKER +IFN TCPP,SIXBIT /TCPOPN/ ; Open TCP Internet connection + SIXBIT /TRANAD/ ;CREATE TRANSLATION ENTRY + SIXBIT /TRANCL/ ;CLEAR TRANSL. LIST(S) FOR A JOB. + SIXBIT /TRANDL/ ;DELETE A TRANSL. ENTRY. + SIXBIT /TRANEX/ ;READ A JOB'S TRANSL. LIST. + SIXBIT /TRANS/ ;TRANSLATE A FILENAME. + SIXBIT /TRPOPN/ ;OPEN TRAP DEVICE FOR AN INFERIOR + SIXBIT /TTYESC/ ;SIMULATE TYPING OF ^_ + SIXBIT /TTYFLS/ ;FLUSH ITYIC'ED INPUT + SIXBIT /TTYGET/ ;SUPPLY TTY CH, RETURNS THREE WORDS OF TTY STATUS + SIXBIT /TTYSET/ ;SUPPLY TTY CH AND THREE WORDS OF TTY STATUS + SIXBIT /TTYVAR/ ;HACK TTY VARIABLES + SIXBIT /TVWHER/ + SIXBIT /UNLOCK/ ;UNLOCK A SPEC'D JOBS LOCKS. + SIXBIT /USRMEM/ ;READ OR WRITE A JOB'S MEMORY. + SIXBIT /USRVAR/ ;HACK USER VARIABLES + SIXBIT /VIDBUF/ ;ASSIGN/DEASSIGN VIDEO BUFFER. + SIXBIT /VIDSW/ ;SET VIDEO SWITCH. + SIXBIT /WHOLIN/ ;GET OR SET WHO-LINE MODE AND JOB. + SIXBIT /WHYINT/ ;FIND OUT WHY AN I/O CHANNEL INTERRUPTED + SIXBIT /XGPIM/ ;OUTPUT TO XGP IN IMAGE MODE +LSYSCT==:.-SYSCTB + +ZZ==.-SYSCTB-1 +RADIX 2 +ZZ2==CONC [.LENGTH /]\ZZ,/ +RADIX 8 +REPEAT 1_-ZZ-1,377777,,-1 +;4.X BIT IMPLIES SUPPLY ROUTINE WITH POINTER TO X'TH ARG, NOT ARG ITSELF +;3.9-3.7 = MINIMUM NUMBER OF ARGS +;3.1 => DECODE 1ST ARG AS IO CHNL, LEAVING IOCHNM WD ADDR IN RH(R), +; IOCHNM WD CONTENTS IN H, CLSTB ENTRY'S LH IN LH(R). +;3.2 => NEVER PASS TO SPECIAL CHECKER FOR JOB CHNL +;3.3 => DON'T BARF IF CHNL NOT OPEN, CALLED ROUTINE WILL HANDLE IT + +;# ARGS ACTUALLY SUPPLIED IN W WHEN DISPATCHING THRU SYSCTD, ARGS IN A...J +SYSCTD: 200,,NACCES + 100,,NATTAC + 100,,NATTY + 100,,NCALL +IFN CHAOSP,[ + 200,,CHAOSO + 100,,CHAOSQ +];CHAOSP + 100,,NCLOSE(7) + 100,,NCNSGET + 100,,NCNSSET + 24300,,NCORBL + 100,,NCORTY + 100,,NDEL + 100,,DELEWO(1) +IFN DEMON,100,,ADEMSIG + NDETAC + 100,,NDIRSIZ(1) + 1100,,NDISMIS + 100,,NDISOWN +IFN DL10P, 100,,DL10MP + 100,,ADSKUP(1) + 6500,,NECHOIN(1) + 100,,NFILBLK(1) + 100,,NFILLEN(1) + 100,,NFINIS(1) +IFN NUNITS, 100,,NFLAP +IFE NUNITS, 100,,OPNL1 + 100,,NFINIS(1) ;OLD NAME FOR FINISH, EVENTUALLY FLUSH + 100,,NFORCE(1) + 100,,NIOPOP(7) + 100,,NIOPUS(7) + 2100,,NIOT(7) ;(7) FOR CHNL NOT OPEN TO BE IOC ERROR, (3) TO BE OPEN LOSS +IFN INETP, 100,,IPKIOT(1) ; Requires at least 1 arg + 100,,NITYIC + 100,,NJBCL(1) + 100,,NJBGT(1) + 100,,NJBINT(1) + 100,,NSTIOC(1) + 100,,NJBRT(1) + 20500,,NJBREU + 100,,NJBSTS(1) +IFN KL10P,KLPERF + 100,,NLISTE + 100,,NLNKEDP(1) + 200,,NLOAD + 200,,NLOGIN + ALOGOU + 100,,NLOSE + 200,,NMLINK +IFN NCPP, 100,,ANETAC(1) +IFE INETP,[ +IFE CHAOSP, 4200,,ANETBLK(1) +IFN CHAOSP, 4200,,CHANBK(1) +] +IFN INETP, 4200,,NETBLK(1) ; Block (.hang) on net I/O channel +IFN IMPP,[ + 100,,ANETHST + ANETIMP +];IMPP +IFN NCPP, 100,,NNETINT(1) +IFN INETP, 100,,NETRFC + 200,,NOPEN + 4300,,PDUMP + 100,,NPGWRT ;OLD NAME FOR PGWRIT, EVENTUALLY DELETE + 100,,NPGWRT +IFN CHAOSP, 200,,PKTIOT(1) +IFN QAUTHP, 100,,ARAUTH(1) + 100,,NRCHST + 100,,ARCPOS +IFN DEMON,100,,ARDDMST + 100,,NRDMPBT(1) + 000,,NRELOAD + 200,,NRNAM + 200,,NRNWO + 100,,NREOWN(3) + 100,,NRESET(7) + 100,,NRESRDT(1) + 100,,NRFDATE(1) + 100,,NRFNAM + 100,,NRFPNT(3) + ARQDAT + 100,,ARSSIZ +IFN QAUTHP, 200,,ASAUTH(1) + 200,,ASCML + 100,,NSCPOS + 200,,NSDMPBT(1) + 200,,NSTIOC(1) + 200,,NSFDATE(1) + 6300,,NSIOT(7) ;(7) FOR IOC ERROR IF CHNL NOT OPEN, (3) FOR OPEN LOSS + 200,,NSOPEN + 200,,NSRDATE(1) + 100,,ASREAP(1) + 100,,NSSERV + ASSTAT + 100,,NSTATUS(7) +IFN DEMON,100,,ASTDMST + 100,,NSTLGT + 100,,NSTYGT +IFN NETP,200,,NSTYNT(3) + 200,,NT11M +IFN TCPP,500,,TCPOPN + 300,,NTRNAD + 100,,NTRNCL + 200,,NTRNDL + 200,,NTRNEX + 100,,NTRNS + 200,,TRPOPN + 100,,NTTYESC + 100,,NTTYFLS + 100,,ATTYGT + 300,,ATTYST + 2200,,NTTYVA + 100,,NTVWHERE + 100,,NUNLOCK + 2200,,NUSRME + 2200,,NUSRVA + 100,,NVDBF + 200,,NVIDSW + 100,,NWHOLI + 100,,NWHYINT(1) + 1100,,NXGPIM + +IFN .-SYSCTD-1-ZZ,.ERR NEW SYS CALL DISPATCH LOSES!!! + +REPEAT 1_-ZZ-1,ILUUO + +;.CALL ADR1 SKIPS UNLESS SOMETHING WRONG +;ADR1: SETZ +; SIXBIT // +; REPEAT #ARGS,BITS,,
+; BITS= 4.9 => LAST ARG +; 4.3 - 4.1 0 = NORMAL ARG +; 1 = IMMEDIATE +; 2 = OUTPUT ARG +; 3 = RETURN THE FAILURE CODE IF FAIL +; 4 = WORD OF CONTROL BITS +; 5 = IMMEDIATE CONTROL BITS + +ASYSC: PUSHJ P,ASCGRG ;B HAS E OF UUO + JRST OPNL43 ;CALL NAME UNKNOWN. + JRST OPNL15 ;MORE THAN 8 ARGS + JRST OPNL30 ;TOO FEW ARGS + PUSHJ P,ASYSC1 ;DISPATCH TO ROUTINE. + POPJ P, ;NO SKIP - OPENL HAS ALREADY BEEN CALLED. + AOS (P) ;SKIP - PROPAGATE THE SKIP UP THE PDL + MOVE U,USER ;!! + MOVE R,SYSCVL(U);SUCCESS RETURN, ZERO ERROR CODE ARG IF ANY + TLNE R,%SCVER + XCTR XW,[SETZM (R)] + JUMPGE R,CPOPJ ;JUMP IF NO OUTPUT VALUES WANTED +SYSCPT: HRRZ W,FORTY ;VALUES WANTED, PUT INTO USER MEMORY FROM ACS + ADDI W,2 + MOVSI T,-8 +SYSCP2: UMOVE R,(W) + TLNN R,1000 + TLNN R,2000 + JRST SYSCP3 + PUSHJ P,ASCIND + MOVE J,1(T) + UMOVEM J,(R) + AOBJP T,CPOPJ +SYSCP3: JUMPL R,CPOPJ + AOJA W,SYSCP2 + +ASYSC1: MOVE T,SYSCTD(H) + TLNN T,1 ;DECODE 1ST ARG AS IO CHNL? + JRST (T) ;NO, DISPATCH TO CALL. + TLNE T,2 ;OK TO GIVE TO JOB CHNL CHECKER? + JRST CHNDCD ;NO - GO DECODE CHANNEL + HRL J,T ;SAVE DISPATCH ADDR + HRRI T,AIOCAL ;MAKE DECODER RETURN TO CHECK FOR JOB DEVICE + JRST CHNDCD + +NCALL: MOVE T,A + MOVE R,[B,,A] + BLT R,A+6 + SETZM A+7 ;MAX 8 ARGS, 1 USED FOR NAME + SOS W + PUSHJ P,ASCRCH + JRST OPNL43 + MOVEI J,ASYSC+2 ;LOOK LIKE PUSHJ'ED FROM ASYSC + MOVEM J,(P) + LDB J,[331000,,SYSCTD(H)] + JUMPE J,NCALL2 + AOS B,FORTY + JRST NCALL3 ;HE WANTS POINTERS, WE HAVE JUST VALUES. + ;MUST GET ARGS AGAIN + +ASCRCH: MOVEI H,0 + REPEAT ZZ2,[CAML T,SYSCTB+1_(H) + ADDI H,1_ + ] + CAMN T,SYSCTB(H) + AOS (P) + POPJ P, + +;JSP T,HERE TO DECODE IO CHNL IN A, MODIFIERS IN 3.1-3.3 OF T. +;IF RH(T) = AIOCAL, LH(J) IS REAL RETURN ADDRESS. +;RETURNS IOCHNM ADDR IN RH(R), IOCHNM WD CONTENTS IN H, CLSTB BITS IN LH(R) +;CAN POPJ OUT FOR INVALID CHANNEL. + +CHNDCD: TRNE A,-NIOCHN ;IS 1ST ARG A LEGAL CHNL NUM? + JRST OPNL14 + CAMN U,USER + HRROM A,UUAC(U);REMEMBER CHNL # FOR IOC ERRORS, ETC. + MOVEI R,(A) + ADDI R,IOCHNM(U) ;YES, COMPUTE IOCHNM WD ADDR + MOVE H,(R) ;RETURN CONTENTS IN H. + HLL R,CLSTB(H) ;RETURN CLSTB BITS IN LH(R). + TLNE R,%CLST + JRST [ CAME U,USER ;TRAP DEVICE + JRST .+1 ;IF CHANNEL BELONGS TO THIS USER, TRAP + JRST TRPDEV ] ;OTHERWISE, IS PROBABLY RFNAME, LET IT THROUGH + TRNN H,-1 ;IF CHNL NOT OPEN + TLNE T,4 ;AND NOT SPECIALLY OK FOR THIS SYSTEM CALL + JRST (T) + JRST OPNL44 ;THEN BARF + +;JOB DEVICE CHECKER - PUT AIOCAL IN RH(T), JRST CHNDCD + +AIOCAL: HLRZ T,J ;GET DISPATCH ADR BACK + TLNN R,%CLSJ ;IS CHANNEL JOB DEVICE? + JRST (T) ;NO - DISPATCH + HLRZS H ;ISOLATE JOB DEVICE INDEX + DPB W,[230400,,JBSTS(H)] ;SAVE ARG COUNT + MOVNS W + HRLZS W + HRRI W,1 ;NOW HAVE AOBJN PNTR TO DATA + MOVE T,(W) ;COPY ARGS TO JOB AC TABLES + MOVEM T,@JBACTB-1(W) + AOBJN W,.-2 + MOVEI W,10 ;SET NON-STANDARD OP-CODE + HRRM W,JBSTS(H) + MOVE E,H ;PUT JOB INDEX IN E FOR JBWT + CONO PI,CLKOFF +AIOCA1: PUSHJ P,JBWT ;WAIT FOR JOB TO ANSWER + MOVE H,E ;GET JOB INDEX BACK IN H (FOR JBACTB) + MOVE W,[-8,,1] ;LOAD ANSWERS INTO ACS + MOVE T,@JBACTB-1(W) + MOVEM T,(W) + AOBJN W,.-2 + LDB T,[350400,,JBSTS(H)] ;GET SKIP COUNT + JUMPN T,POPJ1 ;SKIP COUNT NOT ZERO - SKIP + LDB C,[270600,,JBSTS(H)] ;GET OPEN LOSS CODE + SKIPE C ;MAKE SURE IN BOUNDS + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) ;GO REPORT LOSSAGE AND DON'T SKIP + +;SYSTEM CALL GET ARGS +ASCGRG: UMOVE T,(B) + CAME T,[SETZ] + JRST ILUUO + UMOVE T,1(B) + MOVEM T,LSCALL(U) + PUSHJ P,ASCRCH + POPJ P, ;CALL NAME UNRECOGNIZED. + AOS (P) + LDB J,[331000,,SYSCTD(H)] ;GET BITS CORRESP TO ARGS WHICH SAY SUPPLY PNTR TO NTH ONE +NCALL3: MOVEI W,2(B) + MOVE T,[-9,,A] + SETZM CTLBTS(U) +ASYSC2: UMOVE R,(W) + TLNE R,37 + PUSHJ P,ASCIND ;CALC EFFECTIVE ADDRESS + TLNE R,2000 + JRST ASYSC3 ;OUTPUT OR ERRORCODE ARG + TLNE R,4000 + JRST ASYSC5 ;CONTROL BITS + AOBJP T,CPOPJ + ROT J,-1 + JUMPL J,ASYSC7 ;J IF WANT ADDRESS, NOT VALUE + TLNE R,1000 + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + UMOVE R,(R) ;ELSE GET WORD POINTED TO +ASYSC7: MOVEM R,-1(T) ;PUT INTO AC + JRST ASYSC4 + +ASYSC5: TLNE R,1000 ;CTL BITS + TLZA R,-1 ;IMMEDIATE, GET 0,,ADR + XCTR XR,[HRRZ R,(R)] ;ELSE WORD ADDRESS + XORM R,CTLBTS(U) ;XOR ALL THESE ARGS TOGETHER +ASYSC4: XCTR XR,[SKIPL (W)] ;SKIP IF TERMINATE BIT ON + AOJA W,ASYSC2 + HLRE W,T + ADDI W,9 ;COMPUTE NUMBER OF ARGUMENTS SUPPLIED +NCALL2: LDB T,[300300,,SYSCTD(H)] + SUB T,W + JUMPG T,POPJ1 ;NOT ENOUGH ARGS + JRST POPJ2 ;OK + +ASYSC3: TLNE R,1000 + JRST ASYSC8 ;ERROR CODE ARG + XCTR XRW,[MOVES (R)] ;OUTPUT ARG, JUST MAKE SURE IT'S THERE + MOVSI R,%SCVOT ;AND FLAG PRESENCE +ASYSC9: IORM R,SYSCVL(U) + JRST ASYSC4 + +ASYSC8: HRLI R,%SCVER ;ERROR-CODE ARG + TDNE R,SYSCVL(U);CAN'T HAVE MORE THAN ONE ERRORCODE ARG + JRST CPOPJ ;SAY "TOO MANY ARGS" + XCTR XRW,[MOVES (R)] ;MAKE SURE IT'S THERE; MUSTN'T PCLSR OUT OF OPENL + JRST ASYSC9 + +;PERFORM INDEXING AND INDIRECTION ON ADDRESS WORD IN R. +;DON'T CLOBBER BITS 3.6 - 4.9. SET BITS 3.1 - 3.5 TO ZERO +;PUT ADDR IN RH. +ASCIND: TLNN R,37 + POPJ P, +ASCIN1: PUSH P,R + LDB R,[220400,,R] + CAIE R,0 + XCTR XR,[HRRZ R,(R)] + ADD R,(P) + HLL R,(P) ;GET ORIG @, MAY HAVE BEEN CARRIED INTO BY -1(17) + TLZ R,17 + TLZE R,(@) + UMOVE R,(R) + DPB R,[2700,,(P)] + POP P,R + TLNN R,37 + POPJ P, + PUSHJ P,OPBRK ;ALLOW PCLSR + JRST ASCIN1 + +TPFLT: CONO PI,CLKOFF ;PREVENT INTERRUPT AFTER IORM SPM ING BACK + ; ON TOP OF 1000 BIT +IFN KA10P,[ + SPM UPGML(U) + PUSH P,B + MOVSI B,1000 + IORM B,UPQUAN(U) + POP P,B + LPMRI UPGML(U) ;TAKE TRAP, MAYBE DONT COME BACK + JRST CLKONJ +] ;KA10P +IFN KL10P,[ + POP P,PFOPC1 ;IF RESTART FAULT, RETURN FROM TPFLT + JRST TPFLT1 ;JOIN REGULAR PAGE FAIL CODE +] ;KL10P +IFN KS10P,[ + POP P,EPTPFO ; If fault returns, just return from TPFLT + JRST TPFLT1 +] ;KS10P + +SUBTTL PURE DUMP + +;`PDUMP' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE DUMPED +; ARG 2 - DISK CHANNEL TO DUMP ONTO +; ARG 3 - STATE WORD (MODIFIED) INITIALLY 0, THEN 4.9 + PAGE # ABOUT TO DUMP + +PDUMP: MOVE J,A + JSP T,NCRUI2 ;DECODE JOB SPEC (1ST ARG) + JFCL + MOVE A,J + JUMPL J,OPNL31 ;CAN'T PDUMP THE PDP6. + MOVE D,B + JSP T,PDUMDC ;DECODE 2ND ARG, B-> IOCHNM WORD. + TLNN J,%CLSQO + JRST OPNL34 ;NOT DISK WRITE CHANNEL. + HRRZM D,UUAC(U) ;SO SET IN CASE OF ERROR + HLRZ D,(B) + MOVEM D,SRN3(U) ;REMEMBER DISK CHANNEL NUMBER FOR LATER. + PCLT + XCTR XRW,[MOVES D,(C)] + MOVEM C,SRN4(U) ;REMEMBER STATE WORD ADDRESS FOR LATER + MOVEM A,EPDL(U) ;USER INDEX +PDUMA: CAIN A,(U) ;IF PDUMP'ING SELF, MUSTN'T PCLSR, + PUSHJ P,NULSET ;SO DO A NULSET INSTEAD OF THE SOSSET + CAIN A,(U) + JRST PDUMP9 ;SO THAT A LSWPOP CAN BE DEON AT THE END IN EITHER CASE. + PUSHJ P,RPCLSR ;HACKING ANOTHER JOB: STOP IT. + PUSHJ P,SOSSET + USTP(A) +PDUMP9: MOVE A,SRN3(U) ;GET DISK CHANNEL NUMBER + MOVE C,SRN4(U) + UMOVE D,(C) ;PICK UP STATE WORD + JUMPN D,PDUMP5 ;JUMP IF ALREADY WROTE MAP PAGE + PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK FOR MAP PAGE + SETZM (E) ;CLEAR FIRST WORD OF MAP + ;AND DROP INTO PDUMP4 +;HANDLE THE NEXT PAGE. +PDUMP4: PUSHJ P,PUPLC ;GET BYTE POINTERS + LDB W,Q ;CIRC POINTER ENTRY + LDB R,T ;PAGE MAP ENTRY + ANDCMI R,PMAGEM ;CLEAR AGE BITS + CAIN W,-1 + TLO R,(SETZ) ;ABS PAGE + SKIPN W + MOVEI R,0 ;PAGE NON-EXISTANT + TRNN R,600000 + LSH R,16. ;SWAPPED OUT + MOVE W,D ;VIRTUAL PAGE NUMBER + ADDI W,1(E) ;ADDRESS OF ENTRY IN BLOCK + MOVEM R,(W) ;STORE ENTRY + CAIGE D,377 + AOJA D,PDUMP4 + HRLI W,1(W) + SETZM 1(W) + HRRI W,2(W) + BLT W,1777(E) + MOVE D,EPDL(U) + MOVEI W,1000(E) ;1000-1017 ACS + CAMN D,U + JRST [ XCTR XBR,.+2 + JRST .+3] + HRLI W,AC0S(D) + BLT W,1017(E) + PUSHJ P,QSBWW + SETZM QSMPRC(A) ;SO NEXT IOT GETS A NEW BUFFER + MOVSI D,(SETZ) ;SET STATE WORD TO `DUMPING PAGE 0' +;DROPS THROUGH + ;DROPS IN +;DUMP NEXT PAGE +PDUMP5: MOVE C,SRN4(U) ;STORE BACK STATE WORD + UMOVEM D,(C) +PDUMP8: PUSHJ P,PUPLC + LDB W,Q + CAIE W,-1 + SKIPN W + AOJA D,PDUMP6 ;PAGE ABSOLUTE OR NONEXISTANT +PDUMP3: PUSHJ P,PDBWG ;GET BUFFER AND COMMIT DISK TRACK TO DUMP THIS PAGE INTO + MOVE J,EPDL(U) ;SET UP MAP TO POINT TO USER BEING DUMPED + PUSHJ P,MPLDJ + HRLZ J,D ;GET VIRTUAL ADDRESS OF PAGE BEING DUMPED + LSH J,10. + HRR J,E ;BLT POINTER TO COPY THE PAGE + XCTR XBR,[BLT J,1777(E)] ;COPY PAGE INTO DISK BUFFER + PUSHJ P,MPLDZ ;RESTORE TO NORMAL MAP + PUSH P,D + PUSHJ P,QSBWW ;WRITE OUT THE COPIED PAGE + SETZM QSMPRC(A) ;SO NEXT IOT GETS NEW BUFFER + POP P,D + AOS D ;DONE WITH THIS PAGE +PDUMP6: TRNN D,400 ;SKIP IF FINISHED WHOLE ADDRESS SPACE + JRST PDUMP5 + JRST LSWPJ1 ;UNSTOP USER AND POPJ1 + +;ROUTINE TO GET DISK BUFFER AND COMMIT TRACK (FOR PDUMP) +;RETURNS BUFFER ADDRESS IN E. PRESERVES D. + +PDBWG: SKIPL E,QSMDN(A) ;GET CORE BLOCK # OF DISK BUFFER + JRST [ LSH E,10. ;CONVERT TO ADDRESS + POPJ P, ] + MOVE E,[444400,,1] ;NO BUFFER, GET ONE + MOVEI B,QBOV + PUSHJ P,QSBWG + PUSHJ P,UDELAY ;CAN'T GET MEMORY, WAIT A WHILE + JRST PDBWG + +;ROUTINE TO LOOK UP PAGE (FOR PDUMP AND PURE LOAD) +;PAGE# IN RH(D), USER# IN EPDL(U). RESULTS FROM UPLC IN Q AND T. + +PUPLC: PUSH P,A + PUSH P,U + MOVE U,EPDL(U) + MOVE A,D + ANDI A,377 + PUSHJ P,UPLC + POP P,U + JRST POPAJ + +;DECODE 2ND ARG TO PDUMP & LOAD. +;B GETS IOCHNM WORD ADDR, LH OF J GETS LH OF CLSTB ENTRY, RH GETS LH(IOCHNM). + +PDUMDC: TRNE B,-NIOCHN + JRST OPNL14 + ADDI B,IOCHNM(U) + HRRZ J,(B) + HLLZ J,CLSTB(J) + HLR J,(B) + JRST (T) + +SUBTTL PURE AND SBLK LOAD + +;`LOAD' SYMBOLIC SYSTEM CALL +; ARG 1 - JOB SPEC FOR JOB TO BE LOADED +; ARG 2 - DISK CHANNEL TO LOAD FROM +; ARG 3 - (OPTIONAL) FIRST ADDR,,LAST ADDR TO BE LOADED +; OR ZERO => LOAD ONLY PURE PAGES +; WHEN LOADING A PDUMPED FILE, FIRST,,LAST ROUNDED OFF TO PAGES +; DEFAULT 3RD ARG IS 0,,-1 NORMALLY, 20,,-1 LOADING SELF, 20,,37777 LOADING PDP6 + +;PAGE WORD +;4.9=1 ABSOLUTE, 1.1-2.9 = PTW +;4.8=1 SHARED WITH OTHER PAGES AT LEAST ONE OF WHICH IS WRITE +;4.7=1 LINK WITH VIRT PG IN RH 1.8-1.1 +;2.9-2.8 0 NXM, 1 RD ONLY, 2 OR 3 READ/WRITE +;2.7=1 WORD ALREADY PROCESSED + +NLOAD: MOVE J,A + JSP T,NCORUI ;DECODE THE JOB SPEC. + JRST NLOAD6 ;JOB GUARANTEED WRITEABLE. + JSP T,NCORWR ;ELSE CHECK IF WRITEABLE. + CAIN J,-1 ;BUT CAN WRITE PDP6. + CAIA + JRST OPNL31 ;NOT WRITEABLE. +NLOAD6: HRREI A,(J) ;MAKE SURE EXTEND SIGN IF PDP6. + JSP T,PDUMDC ;DECODE 2ND ARG. + TLNN J,%CLSQO + TLNN J,%CLSQ + JRST OPNL34 ;NOT DISK READ CHANNEL. + LDB J,[QSBSIZ(J)] + CAIE J,36. + JRST OPNL12 ;"MODE NOT AVAILABLE" IF CHANNEL NOT 36-BIT BYTES. + MOVE R,B ;IOCHNM ADDRESS IN CASE WE GET TO QICL + JUMPL A,NLOADE ;DONT STOP THE 6 + CAMN A,U + JRST NLOADA ;DONT STOP IF LOADING INTO SELF + PUSHJ P,RPCLSR + PUSHJ P,LSWPOP ;SOS JOB'S DIELOK - IT CAN'T DIE WHILE STOPPED. + MOVSI T,BSSTP ;STOPPING WITH BSSTP INSTEAD OF RH OF USTP + IORM T,USTP(A) ;AVOIDS DEADLY EMBRACE WITH CORE JOB (SEE CUSTOP) + SOS USTP(A) + PUSHJ P,LOSSET ;ARRANGE TO CLEAR BSSTP ON PCLSR. + NLUPCL + CAIGE W,3 + HRLOI C,0 ;DEFAULT 3RD ARG + JRST NLOADE + +NLOADA: PUSHJ P,LSWPOP ;DIELOK + CAIGE W,3 + HRLOI C,20 ;DEFAULT 3RD ARG +NLOADE: MOVEM A,SRN3(U) ;SAVE USER INDEX (-1 => PDP6) +IFN PDP6P,[ + JUMPL A,[HLRZ A,C ;PDP6, ENSURE LIMITS SMALL ENOUGH + CAIGE A,20 + HRLI C,20 ;ACS NOT ACCESSIBLE + MOVEI A,LPDP6M*2000-1 + CAIGE A,(C) + HRR C,A ;HAS ONLY 16K MEMORY + JRST .+1] +] + HLRZ A,(B) + MOVEM A,SRN4(U) ;SAVE # OF DISK CHANNEL + SETZM SRN5(U) ;START LOADING AT VIR PG #0 + MOVEM C,EPDLT1(U) ;SAVE LOAD LIMITS + HLRZ D,C + CAILE D,(C) + JRST OPNL33 ;FIRST > LAST + HLRZ C,QPCLSR(A) + JUMPE C,NLOADD + HRRZ Q,SRN3(U) + CAIN C,(Q) + JRST NLDSBB ;(COMING BACK AFTER PCLSR) + SETZM QPCLSR(A) +;DROPS THROUGH + ;DROPS IN +;GET FIRST BLOCK OF FILE BEING LOADED +NLOADD: CAMN U,PCLUSR + SETZM PCLIDX + SKIPL TT,QSMDN(A) + JRST NLOADB + PCLT + SKIPG QSBFS(A) + PUSHJ P,UFLS ;HANG UNTIL A BLOCK IS READ IN + MOVE Q,QSRAC(A) + TLNE Q,%QAACC+%QAMPU+%QAPAR + JRST OPNL7 ;LOST ONE WAY OR ANOTHER + MOVE E,[444400,,1] + MOVEI B,QBIV + PUSHJ P,QSBGB ;SET UP CHNL AREA. TT ADDR OF FIRST WORD OF BLOCK + BUG + JRST NLOADC ;QSBGB SKIPS FOR NORMAL RETURN + JRST OPNL46 ;SKIPPED TWICE => EOF + +NLOADB: MOVE J,QMPBSZ(A) + LSH TT,10. +NLOADC: SKIPE (TT) ;SKIP IF PURE DUMPED FILE + JRST NLDSB ;SBLK + SKIPGE SRN3(U) + JRST OPNL34 ;TRYING TO PURE LOAD PDP6 + MOVSI Q,%QAACC ;WILL GO RANDOM ACCESSING THROUGH FILE + IORM Q,QSRAC(A) ;THIS ALSO INHIBITS ACTIVATION AT PI LEVEL + HLRZ H,EPDLT1(U);LOW LOAD BOUNDARY + SKIPE EPDLT1(U) + CAIL H,20 + JRST NLOADH ;ACS NOT BE LOADED + MOVSI Q,1000(TT);ADDRESS OF DUMPED ACS + HRLS H + ADD Q,H + HRRZ H,EPDLT1(U);HIGH LOAD BOUNDARY + CAILE H,17 + MOVEI H,17 + HRRZ J,SRN3(U) ;JOB TO BE LOADED + PUSHJ P,MPLDJ + XCTR XBW,[BLT Q,(H)] ;LOAD UP HIS ACS + PUSHJ P,MPLDZ +NLOADH: MOVEI R,1(TT) ;ADDRESS OF FIRST WORD OF DUMPED MAP + MOVEM R,EPDL3(U) ;SAVE + MOVEI Q,2000 + PUSHJ P,QFNTR ;FIND DISK ADDRESS OF SECOND BLOCK + JRST OPNL46 ;OFF END OF FILE + SOS QSBI(A) ;UNDO QFNTR HACK + AOS QSLGL(A) + PUSHJ P,QUDULK ;UNLOCK USER DIRECTORY + PUSHJ P,SWTL ;LOCK CIRPSW + CIRPSW +;DROPS THROUGH + ;DROPS IN +;HERE TO DO NEXT PAGE (WHEN LOADING PDUMPED FILE) +NLOAD0: PUSHJ P,OPBRK + MOVE A,@EPDL3(U) + TRNE A,600000 ;SKIP IF NO ACCESS (IGNORE) + TRNE A,100000 + JRST NLD14 ;THIS PAGE ALREADY DONE OR NO ACCESS + MOVE Q,EPDLT1(U) + TRNE A,400000 ;SKIP IF READ ONLY + JUMPE Q,NLD14 ;IMPURE NOT BE LOADED + MOVE A,SRN5(U) ;VIRTUAL PAGE NUMBER + JUMPE Q,NLD16 + AND Q,[-2000,,-2000] + LSH Q,-10. ;FIRST PAGE,,LAST PAGE + HLRZ T,Q + CAIL A,(T) + CAILE A,(Q) + JRST NLD14 ;PAGE OUTSIDE OF RANGE TO BE LOADED +NLD16: MOVE U,SRN3(U) ;USER INDEX + PUSHJ P,UPLC + LDB R,Q ;LOOK IN CIRCULAR POINTER ENTRY FOR THIS PAGE + JUMPE R,NLOAD1 ;DOESN'T ALREADY HAVE THIS VIRTUAL PAGE + PUSH P,T ;SAVE BYTE POINTER TO PAGE MAP FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE BYTE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + PUSHJ P,PAGERT ;FLUSH THE ALREADY EXISTING VIRTUAL PAGE + POP P,Q + POP P,T +NLOAD1: MOVE U,USER + MOVE R,@EPDL3(U) ;PICK UP DUMPED PAGE MAP WORD + ANDCMI R,PMAGEM ;CLEAR AGE BITS (WOULD LOSE AT NLOAD4+4) + JUMPGE R,NLOAD3 ;NOT ABSOLUTE PAGE + ANDI R,PMRCM ;ABS PG # + CAIL R,TSYSM +IFE PDP6P, JRST OPNL32 +.ELSE [ + JRST [ CAIGE R, + CAIGE R, + JRST OPNL32 + HRRZ R,@EPDL3(U) ;ALLOW USER TO LOAD WRITABLE PDP6 PAGES. + ANDCMI R,PMAGEM\PMUNSD ;GIVE HIM WHATEVER ACCESS HE RQ'S. + JRST NLOAD5]] +;IFN TEN11P,[ ;NOT NECESSARY SINCE 10-11 PAGES ABOVE TSYSM NOW +; TRNN R,400 +; JRST .+3 +; MOVE E,T11MP-400(R) +; AOJN E,NLOAD2 ;DONT ALLOW PAGE TO POINT TO TEN11 +;] + + LDB E,[MUR,,MEMBLT(R)] + CAIN E,MUHOLE + TDZA R,R ;IF PAGE NXM TODAY, DON'T ACTUALLY GIVE ACCESS + +NLOAD5: TRO R,200000 ;RD ONLY + DPB R,T ;STORE ENTRY IN PAGE MAP + MOVEI R,-1 + DPB R,Q ;STORE -1 IN CIRCULAR POINTER +NLOAD2: MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,GHUSRA ;RECOMPUTE HUSRAD +NLD14: MOVE U,USER + MOVEI R,100000 + IORB R,@EPDL3(U) ;MARK DUMPED PAGE WORD AS ALREADY DONE + MOVE A,SRN4(U) ;DISK CHANNEL + TLNN R,500000 ;SKIP IF NO CORRESPONDING BLOCK IN FILE + TRNN R,600000 ;SKIP IF MUST ADVANCE ONE BLOCK + JRST .+3 ;DON'T ADVANCE FILE POINTER + PUSHJ P,QFNTN ;ADVANCE TO NEXT DISK ADDRESS + JRST OPNL46 ;PREMATURE EOF + AOS R,SRN5(U) ;NEXT VIRTUAL PAGE + CAMN U,PCLUSR + MOVEM R,PCLIDX + AOS EPDL3(U) ;NEXT MAP WORD + CAIGE R,400 + JRST NLOAD0 ;LOOP + PUSHJ P,LSWPOP ;RELEASE CIRPSW + MOVE B,SRN3(U) ;USER INDEX LOADING INTO + CAME B,U ;SKIP IF LOADING INTO SELF + PUSHJ P,LSWPOP ;UNSTOP USER + MOVE B,QFBLNO(A) + SETZM QFBLNO(A) + MOVEM B,QRADAD(A) + JRST POPJ1 + +NLOAD3: TLNN R,100000 ;SKIP IF LINK WITH PAGE IN RH OF R + JRST NLOAD4 + PUSH P,T ;SAVE BYTE POINTER TO MAP ENTRY FOR THIS VIRTUAL PAGE + PUSH P,Q ;SAVE POINTER TO CIRCULAR POINTER ENTRY FOR THIS PAGE + LDB A,[1700,,R] ;VIRTUAL PAGE NUMBER BEING LINKED TO + CAIL A,400 + JRST NLOAD8 ;BAD VIRT PAGE # + MOVE E,SRN5(U) ;VIRTUAL PAGE NUMBER OF PAGE BEING LINKED + MOVE U,SRN3(U) ;USER INDEX LOADING INTO + PUSHJ P,UPLC + LDB W,Q ;CIRCULAR POINTER OF OTHER ENTRY + JUMPE W,NLOAD8 ;DIDN'T EXIST + CAIN W,-1 + JRST NLOAD8 ;POINTS TO AN ABSOLUTE PAGE + MOVE C,U + IDIVI C,LUBLK + SKIPE D + BUG ;L DOESN'T DIVIDE U + LSH C,10 ;USER NUMBER _ 8 + TRZE C,400000 + BUG ;USER INDEX WAS TOO LARGE + IOR C,E ;NEW CIRCULAR POINTER + POP P,D ;NEW CIRCULAR POINTER BYTE POINTER + DPB W,D ;STORE OTHER ENTRY AS NEW CIRCULAR POINTER ENTRY + DPB C,Q ;MAKE OTHER CIRCULAR POINTER ENTRY POINT TO NEW ONE + LDB E,T ;OTHER MAP ENTRY + POP P,T ;POINTER TO NEW MAP ENTRY + ANDI R,600000 ;PROTECTION BITS + TRZN E,600000 + JRST NLD11 + IOR E,R + JRST NLD10 +NLD11: LSH R,-20 + DPB R,T +NLOAD9: AOS SNSWPG ;INCR CNT OF SWAPPED OUT FOR SYS + AOSA NSWPGS(U) ;USER LOADING INTO HAS ONE MORE SWAPPED OUT PAGE +NLD10: DPB E,T +NLD13: AOS NMPGS(U) ;USER HAS ONE MORE PAGE + AOS SNMPGS ;SYSTEM HAS 1 MORE PAGE +NLD15: MOVE U,USER + JRST NLOAD2 ;RECOMPUTE HUSRAD AND LOOP + +NLOAD4: MOVE A,SRN4(U) ;DISK CHANNEL + MOVEI TT,(R) ;PUT DESIRED ACCESS IN RH(TT), + ANDI TT,600000 + TDNE R,[200000,,400000] + IORI TT,%CBCPY ;ALONG WITH INITIAL-SWAPIN BIT IF NEC. + PUSHJ P,NCORQ7 ;FIND OR CREATE MMP ENTRY. + JRST OPNL37 ;MMP FULL + MOVE E,SRN5(U) ;GET PAGE # IN JOB BEING LOADED + MOVE U,SRN3(U) ;TARGET USER. + PUSHJ P,NCORR1 ;INSERT THE PAGE. + JRST NLD15 + +NLOAD8: SUB P,[2,,2] + JRST OPNL46 + +NLOADZ: PUSHJ P,LSWPOP ;FREE CIRPSW + MOVEI T,3 + CAMLE T,LMEMFR + PUSHJ P,UFLS + PUSHJ P,SWTL + CIRPSW +POPSM2: SOS (P) ;RETURN TO LOCN BEFORE PUSHJ + SOS (P) + POPJ P, + +;QTAOS: PUSHJ P,QTLOCK ;LOCK TUT +QTAOS1: MOVE D,QSLGL(A) ;DISK TRACK + PUSHJ P,TUTPNT + SKIPG B + BUG ;NOT PART OF ANY FILE + CAIGE B,TUTMNY + AOS B + DPB B,D ;ADD ONE TO TUT ENTRY FOR THIS TRACK + JRST QTULK + +NLUPCL: MOVSI T,BSSTP ;THIS IS THE LOSSET ROUTINE TO CLEAR BSSTP. + SKIPGE A,SRN3(U) + BUG + ANDCAM T,USTP(A) + POPJ P, + +NLDSBB: HRRZ J,SRN3(U) ; (COMING BACK AFTER PCLSRING OUT) A HAS DSK CHNL #) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + SKIPL C,SRN3(U) + CAIN U,(C) + JRST NLDSBH + PUSHJ P,LSWPOP + PUSHJ P,LOSSET + NLUPCL + MOVSI B,BSSTP + IORM B,USTP(C) +NLDSBH: HRRZ B,QPCLSR(A) + JRST (B) + +NLDSB: SKIPN EPDLT1(U) + JRST OPNL12 ;LOAD ONLY PURE FROM SBLK FILE LOSES + HRLZ B,SRN3(U) + HRRI B,NLDSBD + MOVEM B,QPCLSR(A) ;RESTART POINT IN CASE OF PCLSR + MOVEM J,QSMPRC(A) + MOVEM TT,QSMPRP(A) + HRRZ J,SRN3(U) + PUSHJ P,MPLDJ ;LOAD MAP (ALSO CLOBBER UMAPS) + +;DROPS THROUGH + +;DROPS IN +NLDSB1: HRROI I,EPDL3(U) + MOVEM I,SRN4(U) ;SET UP AOBJN PTR TO READ INTO EPDL3 +NLDSBD: MOVEI C,SRN4(U) ;SET C UP TO POINT TO AOBJN PTR + HRLI C,(TRN) ;INDICATE EXEC MODE ADR + PUSHJ P,QBI + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + MOVE I,EPDL3(U) + CAME I,[JRST 1] + JRST NLDSB1 ;IGNORE INITIAL STUFF UNTIL JRST 1 +NLDSBK: MOVEI B,NLDSBE + HRRM B,QPCLSR(A) +NLDSBE: HRROI I,QLDPTR(A) + MOVEM I,SRN4(U) + MOVEI C,SRN4(U) + HRLI C,(TRN) + PUSHJ P,QBI ;GET AN AOBJN POINTER + SKIPGE SRN4(U) + JRST NLDSB9 ;PREMATURE EOF + SKIPL B,QLDPTR(A) + JRST NLDSB6 ;NOT AN AOBJN POINTER + HLRZ C,EPDLT1(U);FIRST ADDRESS TO BE LOADED + SUBI C,(B) + JUMPLE C,NLDSB3 + HLROS B ;SKIP # WDS IN C + ADD B,C ;-# WDS REMAINING IN BLOCK + SKIPLE B + SUB C,B ;FLUSH WHOLE BLOCK + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,C ;ADVANCE ACC PTR TO SKIP PART OR ALL OF BLOCK + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JUMPGE B,[AOS QRADAD(A) ;SKIPPING WHOLE BLOCK, ALSO SKIP CHECKSUM + JRST NLDSBK] ;AND GO READ NEXT BLOCK + HRLS C + ADDM C,QLDPTR(A) ;UPDATE AOBJN POINTER +NLDSB3: MOVEI B,NLDSBF ;MAYBE FLUSH EXISTING MEMORY AND GET NEW + HRRM B,QPCLSR(A) +NLDSBF: HRRZ E,QLDPTR(A) ;START ADR OF BLOCK + HLRE C,QLDPTR(A) ;-LENGTH OF BLOCK + SUB E,C ;DON'T COMBINE THIS INSN WITH NEXT, MIGHT BE MOBY BLOCK + SUBI E,1 ;GET END ADR OF BLOCK + HRRZ T,EPDLT1(U);HIGH LOAD LIMIT + SUBM E,T ;NUMBER OF WORDS OF EXCESS IN BLOCK + MOVEM T,EPDLT2(U) ;SAVE FOR LATER USE + JUMPLE T,NLDSB7 ;JUMP IF BLOCK HAS NO EXCESS + SUB E,T ;ADJUST END ADDRESS + HRLZS T + ADDM T,QLDPTR(A);DECREASE COUNT IN AOBJN POINTER +NLDSB7: LSH E,-10. ;LAST PAGE NEEDED + PUSH P,A + PUSH P,R ;R HAS IOCHNM WD, NEEDED IF REACH QICL VIA QBI. + PUSH P,E ;PAGE NO. OF LAST PAGE NEEDED +NLDSB4: MOVE E,(P) + CAMGE E,SRN5(U) + JRST NLDSB5 ;ALREADY HAVE NEEDED PAGES + MOVE A,SRN5(U) + PUSH P,U + MOVE U,SRN3(U) ;LOOK UP THIS PAGE IN MAP OF USER WE'RE HACKING. + PUSHJ P,UPLC ;IF THERES A WRITABLE PAGE + POP P,U + LDB A,T ;IN THE SLOT ALREADY, KEEP IT. + TRNN A,600000 + TRNN A,2 + TRNE A,400000 + JRST NLDSBM + CAME U,SRN3(U) ;IF NOT HACKING SELF, NCORLL WILL LSWPOP + PUSHJ P,NULSET ;WHAT IT THINKS IS A LOSSET LIKE NLUPCL + PUSHJ P,SWTL + CIRPSW + MOVEI R,%JSNEW ;GET FRESH PAGE + MOVE TT,SRN3(U) ;INTO THE JOB WE'RE HACKING. + MOVE C,SRN5(U) ;PAGE # TO GIVE IT. + MOVSI A,%CBRED+%CBWRT+%CBNDW ;WANT WRITE ACCESS. + PUSHJ P,NCORL ;UNDOES NULSET AND SWTL. + JRST NLSBPL ;COULDNT GET PAGE (CALLED LSWCLR) +NLDSBM: AOS SRN5(U) + JRST NLDSB4 ;CHECK WHETHER WE NEED MORE PAGES. + +NLDSB5: SUB P,[1,,1] ;NOW WE HAVE ALL PAGES NEEDED TO LOAD THIS BLOCK. + POP P,R + POP P,A +NLDSBQ: MOVEI B,NLDSBC + HRRM B,QPCLSR(A) +NLDSBC: HRRZI C,QLDPTR(A) + HRLI C,(SETZ) + PUSHJ P,QBI ;DO A BLOCK IOT, USING THAT AOBJN POINTER. + AOSG B,EPDLT2(U);SKIP RESIDUE OF BLOCK AND CHECKSUM + MOVEI B,1 ;NO RESIDUE, JUST SKIP CHECKSUM + LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + ADD D,B + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) + JRST NLDSBK + +NLDSB6: LDB D,[1200,,QSMPRP(A)] + SKIPGE QSMDN(A) + MOVEI D,0 + ADD D,QFBLNO(A) + SUBI D,1 + MOVEM D,QRADAD(A) + MOVSI D,%QAACC + IORM D,QSRAC(A) +NLDSB8: CAME U,SRN3(U) ;UNLESS HACKING SELF OR PDP6, WE HAVE A SOSSET OF USTP TO POP. + SKIPGE SRN3(U) + CAIA + PUSHJ P,LSWPOP + AOSA (P) +NLDSB9: PUSHJ P,OPNL46 ;LOAD FILE NOT IN VALID SBLK FORMAT +NLSBP1: PUSHJ P,MPLDZ + SETZM QPCLSR(A) + POPJ P, + +NLSBPL: SUB P,[2,,2] ;FLUSH PUSHES OF E AND R. + POP P,A + JRST NLSBP1 + +SUBTTL .GUN, .LOGOUT + +;DESTROY PROCEDURE TREE WHOSE TOP INDEX SUPPLIED BY USER +AGUN: XCTR XR,[SKIPG A,(J)] + POPJ P, ;LOSE, NEG OR SYSTEM JOB + IMULI A,LUBLK + CONO PI,CLKOFF + CAMGE A,USRHI ;USER INDEX UNREASONABLE => LOSE. + CAIG A,LUBLK + JRST CLKONJ + JRST ALOGO6 + +ALOGOU: SKIPL SUPPRO(U) + JUMPN J,ABREAK ;.LOGOUT N, TURNS INTO .BREAK N,33 IF NOT TOP LEVEL + MOVE A,U ;.LOGOUT, AND STY CLOSE. + CONO PI,CLKOFF +;A HAS JOB BEING LOGGED OUT; U HAS JOB THAT'S DOING IT. +;.GUN AND .LOGOUT ACT BY PUTTING THE JOB IN SUCH A STATE THAT +;IT CAN DO NOTHING BUT TRY TO DISAPPEAR. IF THE JOB IS ALREADY +;IN THAT STATE, THIS ROUTINE DOES NOTHING. THAT PREVENTS +;RECURSION LOOPS WHEN KILLING CYCLIC STRUCTURES INVOLVING STY'S. +;EXCEPTION: IF THE JOB TO BE LOGGED OUT IS THE RUNNING JOB, +;WE DO THE REAL WORK BY GOING TO ALOGO1. +ALOGO6: SKIPE UNAME(A) ;JOB TO BE LOGGED OUT IS GONE. + SKIPL SUPPRO(A) ;CAN'T LOG OUT UNLESS TOP LEVEL. + JRST CLKONJ + CAME A,U + AOS (P) ;IF .GUN GETS THIS FAR, IT HAS "SUCCEEDED". + MOVSI T,BULGOS+BULGO + TDNE T,APRC(A) ;IF JOB IS ALREADY LOGGING OUT, + JRST ALOGO7 ; SEE IF IT IS THE RUNNING JOB + MOVSI B,%PCUSR + CAMN A,USER + AOJA B,ALOGO5 + PUSH P,U + MOVE U,USER + MOVEM A,SRN3(U) ;AUCL4 FINDS USR IDX TO HACK HERE. + PUSHJ P,LOSSET + AUCL4 ;CLEAR BULGOS IF AUCL3 PCLSR'S + PUSHJ P,AUCL3 ;SET BULGOS AND WAIT FOR DIELOK TO CLEAR. + POP P,U + CONO PI,CLKOFF + PUSHJ P,LSWDEL + EXCH B,UPC(A) ;SET HIM UP TO LOG OUT. +ALOGO4: MOVEM B,SRN3(A) ; Remember old PC for unlocking locks. + MOVE B,[.LOGOUT] ;PUT THE FOLLOWING ROUTINE IN JOB'S AC'S: + MOVEM B,AC0S(A) ; 0/ .LOGOUT + CAMN A,USER ; 1/ .VALUE + UMOVEM B,0 ; 2/ JRST 0 + MOVSI B,(.VALUE) + MOVEM B,AC0S+1(A) + CAMN A,USER + UMOVEM B,1 + MOVSI B,(JRST) + MOVEM B,AC0S+2(A) + CAMN A,USER + UMOVEM B,2 + MOVSI B,BULGOS + IORM B,APRC(A) ;SAY HE'S DIEING SO NO-ONE WILL HACK HIM. + MOVEM U,EPDL(A) ;RECORD WHO IS KILLING HIM. + MOVE B,UNAME(U) + MOVEM B,SRN4(A) + MOVE B,JNAME(U) + MOVEM B,SRN5(A) + SETZM PICLR(A) ;PREVENT INTERRUPTS. + SETZM MSKST(A) + SETZM PIRQC(A) + MOVSI B,BUSRC + ANDCAM B,USTP(A) ;MAKE SURE HE CAN RUN - ELSE HE WOULDN'T LOG OUT. +ALOGO7: CONO PI,CLKON + CAME A,USER + POPJ P, + JRST ALOGO1 ;IF JOB IS RUNNING JOB, MUST HACK AROUND + +ALOGO5: EXCH B,UUOH ;LOGGING OUT SELF - MAKE OUR PC LOOK + SOJA B,ALOGO4 ; AS IF WE HAD EXECUTED THE .LOGOUT IN AC 0 + +;COME HERE IF LOGGING OUT ONESELF (A=USER). +ALOGO1: MOVE U,A + PUSHJ P,AUCL3 ;WAIT TILL NO-ONE IS LOOKING AT ME, + PUSHJ P,UBLAM ;CLOSE MY CHANNELS AND KILL MY INFERIORS AND CORE. + MOVE A,USER + CONO PI,CLKOFF ;DON'T SCHEDULE WHILE GOING AWAY + MOVSI T,BULGO + IORM T,APRC(A) ;SYS JOB KILLS ANY TREES WITH BULGO SET. + MOVSI T,SCLGUN + IORM T,SUPCOR ;TELL SYS JOB TO LOOK AROUND FOR TREES TO KILL. + MOVSI T,BUSRC ;SUICIDE: MAKE SURE WE DON'T RUN ANY MORE. + IORM T,USTP(A) + JRST UDELAY ;CAUSE A SCHEDULE + +;COME WITH JOB INDEX IN A. INDICATE THAT JOB IS ABOUT TO DIE, +;THEN WAIT TILL IT'S SAFE TO KILL IT. +;TURNS CLOCK ON. +AUCL3: MOVSI T,BULGOS + IORM T,APRC(A) ;SAY THIS JOB STARTING TO GO AWAY. + CONO PI,CLKON ;NOONE CAN START HACKING US NOW; SAFE. + CAME A,USER ;IF NOT LOGGING OUT RUNNING USER, + PUSHJ P,1USTOP ;STOP THE JOB BEING KILLED. + SKIPE DIELOK(A) ;WAIT TILL NO-ONE IS LOOKING AT THAT JOB. + PUSHJ P,UFLS + HRLOI T,#BUSRC ;AND NO-ONE ELSE HAS HIM PCLSR'ED. + TDNE T,USTP(A) + PUSHJ P,UFLS + POPJ P, ;WE SUCCEEDED, BUT CALLER HAS WORK TO DO. + +SUBTTL REAL TIME USER FEATURE +; +;.REALT AC, SKIPS ONLY IF REAL TIME FACILITY REQUESTED AND SEIZED +;AC= 4.9=>TURN OFF OLD CLOCK RATE, FLUSHING REAL TIME FACILITY AND +; REMAINDER OF CURRENT TICK AND ZEROING TICK COUNT +; 4.8=>TURN ON NEW CLOCK RATE +; 4.7=>TRY TO SEIZE REAL TIME USER FACILITY +; 4.6=>DON'T SETTLE FOR PSEUDO-REAL TIME STATUS +; 4.5 =>ONLY WANT PSEUDO +; 4.4=>PROGRAM TO BE BLOCKED EXCEPT FOR HIGH PRIORITY PHASE OR INT. LEVEL +; 4.3=>READ INTO WD3+4 AS DESCRIBED BELOW (BEFORE ANY OTHER BITS INTERPRETED) +; 3.1-4.2=RESERVED FOR EXPANSION, SHOULD BE ZERO +; 1.1-2.9=RH=POINTER TO 4 WORD BLOCK +; WD1=FRAME TIME IN 60'THS (MUST BE <2**18.) +; WD2=PRIORITY TIME IN 60'THS (MUST BE <7 AND .CALL [SETZ ? SIXBIT/LOSE/ ? 401000,,X ] + +;.CALL LOSE +; USED TO REPORT LOSSAGE TO SUPERIOR PROCEDURE +;ARG 1 - LOSING INSTRUCTION ADDR,,LOSSAGE CODE (CODES DEFINED BY DDT) +;ARG 2 - NEW PC (DEFAULT = PC-2 SO CAN USE AS A NON-SKIP-RETURN HANDLER) +;CTL 1.1 - DEFAULT ARG 2 TO PC INSTEAD OF PC-2 +;CTL 1.2 - SETZM @.40ADDR +;CTL 1.3 - DON'T USE THE NEW PC AS THE LOSING INSTRUCTION ADDR + +ALOSE: HRRZ A,FORTY ;ARG 1 = EFF ADDR OF UUO + MOVEI W,1 + TDZA T,T +NLOSE: MOVE T,CTLBTS(U) + MOVE D,40ADDR(U) + TRNE T,2 + XCTR XRW,[MOVES (D)] + TLZ B,BADPC ;COMPUTE NEW PC FROM ARG 2 OR UUOH + SKIPGE IOTLSR(U) + TLO B,%PCUIO + TLO B,%PCUSR + MOVE C,UUOH + TRNN T,1 + HRRI C,-2(C) + CAIGE W,2 + MOVE B,C + TRNN T,4 + HRL A,B + HRRI B,1(B) ;PCLSR'ING WILL SOS + MOVEM A,VALUE(U) ;PASS TO SUPERIOR + MOVEM B,UUOH + TRNE T,2 + XCTR XW,[SETZM (D)] + MOVSI T,%PJLOS + JRST UUOERR + +AUCLOSE: +IFN PDP6P,[ + MOVE A,(R) ;OPER 10 + MOVE A,CLSTB(A) + TLNE A,%CLS6 + JRST PDPUCL +] + PUSHJ P,AUCL2 + POPJ P, + PUSHJ P,1USTOP + MOVEM A,SRN3(U) + PUSHJ P,LOSSET + AUCL4 + PUSHJ P,AUCL3 ;STOP JOB, AND WAIT TILL SAFE TO KILL IT + ;(TURNS CLOCK ON) + EXCH U,A + PUSH P,A + HLLZ T,SUPPRO(U) + PUSH P,T + PUSH P,R + PUSHJ P,UBLAST + POP P,R + PUSHJ P,ZUSLOG ;ACCOUNT FOR USAGE THEN FLUSH LAST VESTIGES + CONO PI,CLKON + POP P,T + POP P,U + ANDCAM T,IFPIR(U) + JRST LSWDEL + +AUCL4: HRRZ A,SRN3(U) + MOVSI T,BULGOS + ANDCAM T,APRC(A) + POPJ P, + +AUCL2: HLRZ A,(R) ;GUY BEING CLOSED + HRRZ B,(R) + LDB TT,[.BP (%CLSFU),CLSTB(B)] + JUMPN TT,OPNL31 ;FOREIGN JOB => .UCLOSE ISCAN'T MODIFY JOB + SKIPL CLSTB(B) .SEE %CLSU + JRST OPNL34 ;NOT A JOB AT ALL? + CONO PI,CLKOFF + MOVE TT,TTYTBL(U) + JUMPGE TT,AUCL1 ;HAVE TTY NOW + TLNN TT,%TBDTY ;NOT GIVING IT AWAY. + CAIE A,(TT) ;SKIP IF GAVE IT TO GUY WE'RE KILLING + JRST AUCL1 + PUSHJ P,SDTTY ;TAKE IT BACK FROM HIM. + JFCL +AUCL1: HLRZ A,(R) + JRST POPJ1 + +;DISMIS SYSTEM CALL. 1ST ARG INT PDL PTR (WILL BE DECREMENTED +;IF NOT AN IMMEDIATE ARG) +;2ND ARG OPTIONAL PC TO DISMIS TO (OVERRIDES THAT IN INT PDL) +;3RD ARG OPTIONAL NEW .DF1 VALUE " " " " +;4TH ARG OPTIONAL NEW .DF2 VALUE ... +;5TH ARG OPTIONAL ERROR CODE AS IN LOSE. IF PRESENT WILL LOSE RIGHT AFTER DISMISSING. +;IF 4 ARGS GIVEN, 1ST IGNORED EXCEPT FOR POSSIBLY DECREMENTING, OR POPPING OF ACS. +;CTL BITS (SAME FORMAT AS LH OF 1ST WORD OF INTERRUPT DISPATCH TABLE) +;SPECIFY POPPING OF SAME EXTRA INFO THAT INTERRUPTS CAN PUSH. + +NDISMIS:CAIL W,5 + MOVEM E,VALUE(U) + MOVE E,A ;GET IN E THE INT PDL PTR. + TLNN E,1000 ;IF 1ST ARG IMMEDIATE, IT IS PTR, + UMOVE E,(A) ;ELSE IT PTS TO PTR. + MOVE H,E ;SAVE UNPOPPED PDL POINTER FOR PDL OV CHECKING. + TLNE A,1000 ;IF PDL PTR ISN'T IMMEDIATE, POP IT ACC. TO CTL BITS. + JRST NDISM2 + MOVE T,CTLBTS(U) + TRNE T,400000 + SUB E,[3,,3] ;POP OFF DEBUGGING INFO IF IT WAS PUSHED. + LDB TT,[000500,,T] + JUMPE TT,NDISM2 ;IF ACS WERE PUSHED, POP THEM TOO. + HRLS TT + SUB E,TT ;DECREMENT THE PDL POINTER ENOUGH + LDB I,[060500,,T] + HRLI I,1(E) ;AND COPY FROM THE PDL TO THE ACS. + ADDI TT,-1(I) + XCTR XBRW,[BLT I,(TT)] +NDISM2: CAIGE W,2 ;IF NO 2ND ARG, GET PC FROM INT PDL + UMOVE B,(E) + CAIGE W,3 ;IF NO 3RD ARG, GET .DF1 FROM INT PDL + UMOVE C,-2(E) + CAIGE W,4 ;IF NO 4TH ARG GET .DF2 FROM INT PDL + UMOVE D,-1(E) + TLNE A,1000 ;IF 1ST ARG NOT IMMED, DECREMENT IT + JRST NDISM3 + SUB E,[5,,5] + UMOVEM E,(A) + JUMPGE E,NDISM3 ;AND CHECK FOR PDL OVFLO. + SKIPL H + PUSHJ P,NDISMP ;PDL OVFLO, SET INT BIT IF INT ENABLED. +NDISM3: MOVEM C,IDF1(U) ;RESTORE THE PC, .DF1, .DF2 + MOVEM D,IDF2(U) + MOVSI T,%PJLOS + CAIL W,5 + IORM T,PIRQC(U) + JRST NDISM1 + +NDISMP: MOVEI TT,%PIPDL ;PDL OV INT BIT. + TDNE TT,MSKST(U) + IORM TT,PIRQC(U) + POPJ P, + +;OLD-STYLE DISMISS JOINS HERE +ADISMIS:UMOVE B,(B) ;CALL 1, +NDISM1: TLO B,%PCUSR + TLZ B,BADPC + SKIPGE IOTLSR(U) + TLO B,%PCUIO +IFN KL10P,[ + SETCM A,UUOH ;IF ONE-PROCEEDING THE .DISMISS + TLNN A,%PS1PR-%PSINH + TLO B,%PS1PR-%PSINH ;TRAP IMMEDIATELY AT THE NEW PC +] + MOVEM B,UUOH + SETOM PICLR(U) + +;CHECK FOR PENDING INTERRUPTS AND TAKE THEM RIGHT AWAY +APISE1: +IFN PDP6P,[ + CAMN U,PDPISR + CONO DSDEV,DSDCHN ;ENABLE INTERRUPT FROM 6 +] + MOVE A,U + PUSHJ P,APISE6 ;SEE IF ANY DEVICES WANT TO RE-INTERRUPT. + MOVEI C,%PIARO + ANDCAB C,PIRQC(U) + SETCM D,MSKST(U) + IOR D,IDF1(U) ;FIND ALL DISABLED OR DEFERRED + SKIPN PICLR(U) ;(ALL ARE DEFERRED WHEN PI IS OFF). + SETO D, + AND D,[BADBTS] ;BAD + TDNE C,D ;PENDING INTERRUPTS + JRST ADISM7 ;IF THERE ARE ANY, LET THEM HAPPEN. + AND C,MSKST(U) + ANDCM C,IDF1(U) + JUMPN C,ADISM7 ;1ST WD INT. PENDING. + MOVE C,IFPIR(U) + AND C,MSKST2(U) + ANDCM C,IDF2(U) + JUMPE C,CPOPJ ;JUMP IF NO 2ND WORD INT PENDING. +ADISM7: MOVE C,[JRST ONEFLS] + MOVEM C,UEXIT + POPJ P, + +APISE6: MOVE D,MSKST(A) ;IF INTERRUPT FROM CONSOLE ENDBLED, + TRNN D,%PITYI + JRST APISE7 + SKIPL T,TTYTBL(A) ;IF THIS JOB HAS ITS CONSOLE + SKIPN TINTC(T) ;AND THE CONSOLE HAS INT. CHARS, + JRST APISE7 + MOVEI D,%PITYI ;GENERATE AN INTERRUPT. + IORM D,PIRQC(A) +APISE7: MOVE D,MSKST2(A) ;LOOK AT HIS ENABLED IO CHANNELS. + ANDI D,177777 +APISE0: JFFO D,APISE9 ;CHECK EACH ONE. + JRST APISE8 ;ALL CHECKED. + +APISE9: MOVNS E ;CHECK ONE IO CHNL THAT'S ENABLED TO INT. + ANDCM D,CHNBIT+35.(E) ;MARK THIS CHNL AS HANDLED. + ADDI E,35.+IOCHNM(A) ;GET ADDR OF IOCHNM WD FOR CHANNEL. + HRRZ T,(E) ;IS IT A TTY INPUT CHANNEL? + CAIL T,TYIDN + CAILE T,TYIBN + JRST APISE2 + LDB T,[$TIIDX,,(E)] ;YES, GET THE TTY NUMBER. + HRRZ C,TTYSTS(T) + CAIE T,%TINON ;IF IT ISN'T A DISOWNED TY CHANNEL, + CAIE C,(A) ;AND THE TTY BELONGS TO THIS JOB, + JRST APISE0 + SKIPN TINTC(T) ;AND IT HAS AN INT. CHAR WAITING, + JRST APISE0 + MOVE C,TYIMSK(T) +APISE4: AND C,MSKST2(A) ;GIVE AN INT. ON ONE OF THE CHANNELS IT'S OPEN ON. + MOVN T,C + AND C,T + IORM C,IFPIR(A) + JRST APISE0 + +APISE2: CAIN T,STYDUI ;NOT A TTY CHNL. IS IT A STY CHNL? + JRST APISE3 + CAIE T,STYDBI + JRST APISE0 +APISE3: LDB T,[$TIIDX,,(E)] ;YES, GET TTY #. + SKIPL C,STYSTS-NFSTTY(T) ;STY IN USE BY THIS JOB? + CAIE C,(A) + JRST APISE0 + SKIPGE TTYOAC(T) ;TTY OUTPUT PENDING? + JRST APISE0 + MOVE C,STYMSK-NFSTTY(T) ;YES, INT. ON ONE CHANNEL. + JRST APISE4 + +APISE8: +IFN STKP,[ + SKIPL C,STKUSR + CAIE C,(A) + POPJ P, + HRRZ C,STKMSK + AND C,MSKST2(A) + SKIPLE STKBC + IORM C,IFPIR(A) +] + POPJ P, + +;.SLEEP AC, ;IF C(AC) + OR ZERO: ;BECOME DORMANT FOR C(AC) 1/30'THS OF A SEC + ;IF C(AC) -: ;BECOME DORMANT TILL MAGNITUDE OF C(AC) > C(TIME) +ASLEEP: XCTR XR,[MOVN T,(J)] ;PICK UP NEGATIVE OF C(AC) + JUMPGE T,ASLP1 ;JUMP IF C(AC) WAS NEG + SUB T,TIME ;COMPUTE NEG OF TIME SLEEP SHOULD RUN OUT + UMOVEM T,(J) ;STORE BACK SO YOU WILL WIN IF PCLSR'ED OUT +ASLP1: MOVMS A,T ;MAKE POSITIVE + SUBI A,60.*30. ;IF SLEEPING FOR MORE THAN A MINUTE + MOVSI B,%SWDSO + CAMLE A,TIME + IORM B,USWST(U) ;PUT RIP VAN WINKLE ON ICE + PCLT + JRST ASLP2 ;ALWAYS GO TO UFLS AT LEAST ONCE + + CAMLE T,TIME ;HANG TILL C(T) LESS THAN C(TIME) +ASLP2: PUSHJ P,UFLS + XCTR XW,[SETZM (J)] ;CLEAR OUT ARG (FOR COMPATIBILITY WITH WHEN AC WAS COUNTED OUT) + JRST CLKONJ ;MAKE SURE CLKCHN ON IN CASE SLEEP WAS 0 & SKIPPED UFLS ENTIRELY + +;RELOAD CALL - IGNORE ARGS +;MUST BE FROM TOP LEVEL NON-DISOWNED JOB +;RELOADS AND STARTS SYS: ATSIGN WHATEVER + +NRELOAD:SKIPGE SUPPRO(U) + SKIPGE APRC(U) + JRST OPNL40 ;NOT TOP LEVEL + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;LOG OUT + PUSHJ P,DMNPLI ;AND IN AGAIN + PUSHJ P,USRST2 ;RESET USER VARS + CONO PI,CLKON + SETZM @UTMPTR(U) ;TEMPORARY HIGH PRIORITY + JRST USTCDR ;LOAD FILE AND START IT + +AMASTER:UMOVE J,(J) + CONO PI,CLKOFF ;OPER 61 + SKIPL A,UMASTER + JRST AMAST2 + SKIPGE J +AMAST1: HRRZM U,UMASTER + JRST CLKOJ1 + +AMAST2: CAME U,A + JRST AMAST3 + SKIPL J + SETOM UMASTER + JRST CLKOJ1 + +AMAST3: JUMPGE J,CLKOJ1 + SKIPGE TTYTBL(U) + JRST CLKONJ ;LOSEY + PUSHJ P,RPCCK + CAME A,UMASTER + JRST AMASTER + JRST AMAST1 + +;.CALL SSERVE - Set .SERVER variable without timing screw. +; ARG1: , the client whose .SERVER variable is to be munged +; ARG2: , the server to be stored in the variable +; If one arg is given, it is the server and the client defaults to %JSELF +NSSERVER: + MOVE J,A + CAIL W,2 + SKIPA A,B + MOVEI J,%JSELF + JSP T,NCORUI ; Decode client and AOS his DIELOK + JRST NSSRV1 ; OK to write + JSP T,NCORWR ; Check further + JRST OPNL31 ; CAN'T MODIFY JOB +NSSRV1: +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + EXCH J,A ; A: client J: server + JSP T,NCORUI ; Decode server and AOS his DIELOK + JFCL ; Don't give a damn about writability +IFN PDP6P,[ + CAIN J,-1 ; PDP6? + JRST OPNL34 ; WRONG TYPE DEVICE +];PDP6P + MOVEM J,SERVER(A) ; Safe to set it now + PUSHJ P,LSWPOP ; Server's DIELOK + JRST LSWPJ1 ; Client's DIELOK + + + SUBTTL LOGIN/ATTACH/DETACH/DISOWN CODE + +;SYMBOLIC CALL LOGIN: LOG A TREE IN. MUST BE GIVEN BY TOP-LEVEL NON-LOGGED-IN JOB +;WITH NO INFERIORS. +;ARG 1 - DESIRED UNAME +;ARG 2 - "TERMINAL NAME", PUT IN TRMNAM USER VARIABLE AND PRINTED AS SIXBIT ON SYSCON. +;ARG 3 - DESIRED XUNAME, FOR DEMON TO KNOW WHO TO ACCOUNT. + +NLOGIN: HLRE T,UNAME(U) + AOJN T,OPNL31 ;JUMP ON ALREADY LOGGED IN + SKIPL SUPPRO(U) + JRST OPNL40 ;CAN'T LOG IN IF NOT TOP LEVEL + JUMPE A,OPNL11 + HLRE T,A + AOJE T,OPNL11 ;BAD NAME + CAIGE W,3 + MOVE C,A ;IF XUNAME (ARG 3) MISSING, DEFAULT TO UNAME. + MOVEI D,0 + CONO PI,CLKOFF +ALOG2: SKIPN UNAME(D) + JRST ALOG4 + MOVE T,JNAME(D) + CAMN T,JNAME(U) + CAME A,UNAME(D) + JRST ALOG3 + JRST OPNL13 ;CONSOLE CONTROLLED TREE ALREADY LOGGED IN THAT NAME + +ALOG3: HRRZ T,SUPPRO(D) + CAMN T,U ;CAN'T LOGIN IF HAVE INFERIOR. RESTRICTION IMPOSED HERE + JRST OPNL12 ;SINCE WE NO CODE HERE TO SET INFERIOR'S UNAME. +ALOG4: ADDI D,LUBLK + CAMGE D,USRHI + JRST ALOG2 ;LOOP FOR ALL SETS OF PROCEDURE VARIABLES + HRRZ T,TTYTBL(U) + HRLI T,[ASCIZ / LOGIN /] + PUSHJ P,SGWAIT ;ASK THE SYSTEM JOB TO PRINT OUT THE RELEVANT INFO + SKIPL TTYTBL(U) ;SKIP IF NOT CONSOLE CONTROLLED + AOS SUSRS ;INCREMENT COUNT OF LOGGED IN CONSOLE CONTROLLED TREES + MOVEM A,UNAME(U) ;SET UNAME TO WHAT LOGGED IN AS + MOVEM A,SLGIV + MOVEM A,USYSNM(U) ;SET SNAME " + MOVEM A,HSNAME(U) ;SET HOME SNAME " + MOVEM C,XUNAME(U) ;SET XUNAME " " (USER MAY MUNG LATER) + MOVEM B,TRMNAM(U) + MOVEM B,SLGIV+2 ;INCLUDE TRMNAM AS SECOND NAME PRINTED + PUSHJ P,DMNPLI ;GIVE INFO TO DEMON + JRST CLKOJ1 ;TURN CLK ON AND SKIP RETURN + +ASETM2: UMOVE A,1(J) ;.OPER 5 + MOVEM A,MSKST2(U) +ASETMSK: UMOVE D,(J) ;OPER 4 + MOVE A,U + MOVEI I,1 + SOS (P) ;WILL SKIP RETURN + JRST USMASK ;ACT LIKE .SUSET. + +ARSYSI: SKIPA A,[ITSVRS] ;OPER 52 +ARDTIME:MOVE A,TIME ;OPER 17 + JRST APTUAJ + +IFE KS10P,[ ; On the KS10 they made DATAI 0, a UUO! +ARDSW: DATAI A ;OPER 20 + JRST APTUAJ +] ;IFE KS10P +IFN KS10P, ARDSW==:ILUUO + +ASUPSET:MOVEI C,003777 ;OPER 53 + XCTR XR,[AND C,(J)] + MOVE D,SUPCOR ;SAVE OLD CONTENTS + XORB C,SUPCOR + UMOVEM C,(J) + HRROI A,SUPCOR + JRST ASPST2 + +; .CALL DET +; ERROR RETURN +; NORMAL RETURN + +;DET: SETZ +; SIXBIT /DETACH/ +; SETZ [] ;SEE NCORUI + +;DISOWN JOB'S ENTIRE TREE AND FREE CONSOLE. IF TREE HAS NO +;CONSOLE, JUST MAKES IT DISOWNED. NO ARG => THIS JOB'S TREE +;ALWAYS SKIPS IF THE JOB SPEC IS REASONABLE. + +;CTL BIT 1.1 => DON'T SET SIGN OF APRC (DON'T MAKE TREE "DISOWNED"). +;CTL BIT 1.2 => USE SYSTEM TREE'S RESOURCE WORD +;CTL BIT 1.4 => KILL TREE AN HOUR FROM NOW IF IT ISN'T REOWNED +;CTL BIT 1.5 => SUPPRESS THE CONSOLE-FREE MESSAGE ON THE TTY + +NDETAC: HLRZ B,A ;XOR LH OF 1ST ARG INTO CTL BITS + XORM B,CTLBTS(U) + PUSHJ P,SWTL ;MAKE SURE NOBODY ELSE IS REARRANGING TREES. + TREESW + MOVEI J,(U) ;DEFAULT TO OUR TREE + JUMPE W,NDETA0 ;JUMP IF NO ARGS SUPPLIED + MOVE J,A ;JOB SPEC + JSP T,NCORUI ;DECODE ARG, GET USER INDEX IN J + JFCL ;IGNORE INFO ON WRITEABILITY + CAIG J,LUBLK ;DONT DETACH SYSJOB OR CORE JOB + JRST OPNL31 +NDETA0: SKIPL T,SUPPRO(J) ;FIND TOP LEVEL JOB OF TREE (IN J) + JRST [ MOVE J,T + JRST NDETA0 ] + HRRZ A,J ;TOP OF TREE + SKIPGE APRC(A) + JRST LSWCJ1 ;TREE IS ALREADY DISOWNED. + MOVEI Q,NDETA8 + PUSHJ P,IFPLUP ;STOP ALL BUT THIS JOB + PUSHJ P,NDETA7 ;DO THE WORK + JRST LSWCJ1 ;UNSTOP THE TREE + +NDETA7: PUSH P,U ;US + PUSH P,A ;TOP LEVEL + MOVEI U,(A) + CONO PI,CLKOFF + PUSHJ P,LOGUPD ;FOR ACCOUNTING PURPOSES, THIS IS LIKE A LOGOUT + CONO PI,CLKON +NDETA1: MOVEI U,(A) ;GET IN U USER INDEX OF OWNER OF TTY + MOVE A,TTYTBL(U) ;GET IN A TTY NUMBER + TLNE A,%TBDTY ;TREE HAS NO TTY => + JRST [ POP P,A ;JUST MAKE IT DISOWNED. + POP P,U + JRST NDETA5 ] + JUMPL A,NDETA1 ;GAVE TTY AWAY + MOVE T,(P) ;TOP-LEVEL JOB OF TREE SAVES USER TTY OPTIONS IN + MOVE B,TTYOPT(A) ;HIS STTYOP VARIABLE + AND B,[%TOUSR,,%TPUSR] + MOVEM B,STTYOP(T) + LDB B,[.BP (%TCRFS+%TCQRY),TTYCOM(A)] + IORI B,4 ;MAKE STTYOP NON-ZERO TO SHOW IT WAS STORED + DPB B,[170300,,STTYOP(T)] ;OVERLAPS PADLF FIELD + HRRZS A + PUSH P,TTYSTS(A) ;SAVE THIS TTY INFO + PUSH P,TTYST1(A) ;WILL PUT INTO TTY OWNER'S USER VARS + PUSH P,TTYST2(A) ;AFTER SUCCEED IN FREEING THE TTY + MOVE B,A + IMULI B,TPLEN*2 + MOVN B,TPVB+TPLEN(B) + ADD B,TCMXV(A) + PUSH P,B + MOVSI B,%TCDET ;IF TREE DETACHED DUE TO TOP LVL INT, + SKIPN USER ;THE CONSOLE FREE MESSAGE SHOULD SAY SO. + IORM B,TTYCOM(A) .SEE SYSCFM + ;THIS ALSO HAPPENS IF DIALUP LINE HUNG UP, OS'ERS BEWARE! +;DROPS THROUGH + ;DROPS IN +IFN N11TYS,[ + CONO PI,CLKOFF + PUSHJ P,TVBNCL ;CLEAR VIDEO BUFFER # + CONO PI,CLKON +];N11TYS + MOVE B,-5(P) ;GET BACK IDX OF RUNNING JOB + MOVE B,CTLBTS(B) + MOVSI T,%TACFM + TRNE B,20 ;CTL BIT 1.5 => MARK THE TTY AS NOT NEEDING CNSL FREE MSG. + IORM T,TTYSTA(A) + PUSHJ P,TTYLO1 ;NOW MAKE CONSOLE FREE. + POP P,B ;CAN'T PCLSR AFTER THIS POINT + DPB B,[$TBECL,,TTYTBL(U)] + POP P,TTSTSV+1(U) ;STORE INTO TTY'S OLD OWNER + POP P,TTSTSV(U) ;OLD TTY VARS FROM BEFORE FREEING IT + POP P,B + MOVEM B,TTSTSV+2(U) + SKIPA A,(P) ;TOP LEVEL JOB +NDETAA: HRRZ A,T + SKIPGE T,TTYTBL(A) ;SKIP IF HE HAS IT + JRST NDETAA ;NOW DO GUY HE GAVE IT TO + CAIE A,(U) + BUG ;BUT. BUT. BUT. + MOVSI B,%TBNOT+%TBDTY ;TAKEN FROM --ME-- AND DOESN'T HAVE IT + IORM B,TTYTBL(A) + HLLZS TTYTBL(A) + POP P,A ;TOP LEVEL + POP P,U ;US + HLRO B,UNAME(A) + AOSE B ;IF DETACHED TREE WAS LOGGED IN + SOS SUSRS ;ONE LESS CONSOLE CONTROLLED TREE +NDETA5: MOVSI B,BUMRTL ;IF REQUESTED, MARK TREE AS DUE TO DIE + MOVE D,CTLBTS(U) ;IN AN HOUR. + ANDCAM B,APRC(A) + TRNE D,10 + IORM B,APRC(A) + CONO PI,CLKOFF ;PERFORM ACCOUNTING FOR THIS USER AS IF HE WERE LOGGING OUT. + EXCH U,A + PUSHJ P,LOGUPD + EXCH U,A + MOVE D,JNAME(A) ;IF TOP LEVEL JOB ... + CAME D,[SIXBIT /HACTRN/] ;IS A HACTRN, + JRST NDETA3 +NDETA2: AOS D ;AOS ITS NAME LEVEL UNTIL ... + PUSHJ P,UJNAMU ;IT IS UNIQUE + JRST NDETA2 ;(UJNAMU TURNS OFF CLOCK) + MOVEM D,JNAME(A) +NDETA3: EXCH U,A + PUSHJ P,DMNPLI ;LOG BACK IN, NAME MAY HAVE CHANGED FROM HACTRN TO HACTRO + EXCH U,A + CONO PI,CLKON + MOVEI Q,NDETA9 ;NOW SAY ALL JOBS IN TREE + JRST IFPLUP ;ARE DISOWNED + +NDETA8: CAIE A,(U) ;IF JOB ISN'T SELF, STOP IT + JRST IFSTOP + POPJ P, + +;"ATTACH" SYSTEM CALL: +;1ST ARG - JOB SPEC -> OUR INFERIOR, OR TOP OF A DISOWNED TREE. +;2ND ARG - TTY SPEC (OF A TTY WHICH MUST BE FREE) + ;2ND ARG ABSENT => USE OUR CONSOLE, AND GUN OUR TREE +;CONTROL BIT 400000 => CHANGE JOB'S NAME TO HACTRN (IF 2 ARGS) +; 4 => START JOB AFTER ATTACHING (JUST LIKE DETACH) + +;CONNECTS THE SPECIFIED JOB TO THE SPECIFIED TTY, AS A CONSOLE CONTROLLED TREE. +;IF THE TTY IS OUR CONSOLE, WE ARE LOGGED OUT. +;IF THE JOB IS OUR INFERIOR, IT IS FIRST DISOWNED. + +NATTAC: PUSHJ P,SWTL + TREESW + SOJE W,NATTAN + EXCH A,B ;2ND ARG => IT IS TTY SPEC, SO DECODE IT. + JSP J,ATTYCI + MOVE A,B + MOVE B,I ;AND PUT IT IN B. + JRST NATTA6 + +NATTAN: SKIPL B,SUPPRO(U) ;NO 2ND ARG => WE MUST BE TOP LEVEL, SINCE WE'LL HAVE + JRST OPNL40 ;TO LOG OUT. B GETS NEGATIVE. +NATTA6: MOVE J,A + JSP T,NCRUI2 ;DECODE 1ST ARG, GET USR IDX IN J. + JFCL + SKIPGE A,SUPPRO(J) + JRST NATTA5 ;JOB SPEC'D MUST BE EITHER + CAIE U,(A) ;OUR INFERIOR, OR + JRST OPNL31 + JRST NATTA7 + +NATTA5: SKIPL APRC(J) ;THE TOP OF A DISOWNED TREE. + JRST OPNL31 +;NOW IF TTY IS OUR CONSOLE, B IS NEGATIVE; OTHERWISE, B HAS TTY #. +NATTA7: PUSH P,CTLBTS(U) + SETZM CTLBTS(U) ;DON'T GET FAKED OUT AT NATTA1, NATTA2, DSWNTY. + PUSH P,J + MOVE A,J + MOVEI Q,NDETA8 ;STOP SPEC'D JOB AND ITS INFERIORS. + PUSHJ P,IFPLUP + JUMPL B,NATTAG +NATTAM: CONO PI,TTYOFF + SKIPL T,TTYSTA(B) ;SEE IF TTY IS FREE + JRST NATTAL + MOVSI T,(SETZ) ;IT IS, GRAB IT + ANDCAM T,TTYSTA(B) .SEE %TACFM + ANDCAM T,TTYSTS(B) .SEE %TSFRE + CONO PI,TTYON + JRST NATTA8 ;SINCE NO PCLSR POSSIBLE, DON'T BOTHER WITH A LOSSET OF THESE + +NATTAL: HRRE Q,TTYSTS(B) + CONO PI,TTYON + SKIPG Q ;IF TTY IS IN USE + TLNE T,%TACTZ ;OR BEING ^Z'ED, DEVICE NOT AVAIL + JRST [ SUB P,[2,,2] ? JRST OPNL10 ] + MOVSI T,%TACFM+%TACTZ ;OTHERWISE JUST WAIT FOR CONSOLE FREE + TDNN T,TTYSTA(B) ;MESSAGE TO FINISH COMING OUT + PUSHJ P,UFLS + JRST NATTAM + +NATTAG: MOVE A,U ;IF HACKING OUR CONSOLE, MUST STOP OUR WHOLE TREE + MOVEI Q,NDETA8 ;(EXCEPT US, OF COURSE - NDETA8 CHECKS THAT). + PUSHJ P,IFPLUP + MOVEI B,(U) +NATTA4: MOVE B,TTYTBL(B) ;FIND THE TTY'S NUMBER. + TLNE B,%TBDTY + JRST NATTAL ;THIS TREE HAS NO TTY? + JUMPL B,NATTA4 .SEE %TBNOT + PUSHJ P,SDTTY ;GET TTY BACK TO TOP OF TREE FOR AGBLT3 LATER. + BUG + HRRO B,TTYTBL(U) +;I BELIEVE THAT NOTHING CAN PCLSR BEYOND THIS POINT. +;RH OF B HAS TTY #; SIGN IS SET IF TTY IS OUR CONSOLE. +NATTA8: AOS TTNTO(B) ;KEEP DSWNTZ FROM HALTING (WILL UNDO THIS LATER) + PUSH P,B ;PUSH ,, + HRRZ A,-1(P) ;LEGALITY OF CALL FULLY CHECKED; CAN START ALTERING. + SKIPGE APRC(A) ;IF SPEC'D JOB IS OUR INFERIOR, DISOWN IT. + JRST NATTA9 + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;IF THE INFERIOR HAS THE TTY, TAKE IT AWAY. + JRST NATTAF + PUSHJ P,SDTTY + BUG +NATTAF: HRRZ A,-1(P) + MOVEI Q,DSWNTY ;JUST LIKE .DISOWN, BUT KNOW JOBS ARE ALREADY STOPPED. + PUSHJ P,IFPLUP + PUSHJ P,NATTA1 +NATTA9: MOVEI Q,NATTA2 + MOVE A,U + SKIPGE (P) ;IF HACKING OUR CONSOLE, DISOWN OUR TREE SO IT IS FREE. + PUSHJ P,IFPLUP + ;OUR TTY NOW IN INCONSISTENT STATE SINCE WE ARE DISOWNED + ;BUT TTY STILL BELONGS TO US. AGBLT3 FIXES THAT. + MOVE B,(P) + SOSGE TTNTO(B) + BUG + MOVE TT,-1(P) ;NOW "RE-OWN" THE SPEC'D JOB + MOVE A,UNAME(TT);NOT CHANGING ITS UNAME + HRRZ J,B ;TO THE DESIRED TTY, WITH APPRO. RESOURCE WORD. + MOVEI D,USRRCE(B) + TLO D,400000 ;TELLS UFN2A THE TREE SHOULD BECOME UN-DISOWNED. + SETZ B, ;NO INTERRUPT BIT NEEDED. + SETOM DLSRCH ;INHIBIT SCHEDULING (UFN2A UNDOES THIS) + PUSH P,U + PUSHJ P,UFN2A + POP P,U + HRRZ A,-1(P) + SKIPA C,A +NATTAH: MOVE C,D ;FIND THE JOB IN THE TREE BEING ATTACHED + MOVE D,TTYTBL(C) + TLNN D,%TBDTY ;THAT IS SUPPOSED TO GET CONTROL OF THE TTY. + JRST NATTAH + SETOM SUPPRO(A) ;BUT DON'T LEAVE IT THINKING IT IS OUR INFERIOR. + SKIPGE I,(P) + JRST NATTAD + HLRE B,UNAME(A) ;ATTACHING JOB TO FREE TTY: + AOSE B + AOS SUSRS ;THIS MAY MEAN 1 MORE LOGGED IN CONSOLE-CTL'ED TREE. + CONO PI,TTYOFF + PUSHJ P,TTYINI ;INIT TTYOPT, ECHO AREA, TTYCOM, TTYSTA. + MOVSI B,%TSFRE ;NOW MAKE TTY'S TTYSTS HAPPY + ANDCAM B,TTYSTS(I) + MOVSI B,%TSCNS + IORM B,TTYSTS(I) + HRRM A,TTYSTS(I) + CONO PI,TTYON#1 ;TTYCHN ON, BUT NOT CLKCHN. + PUSH P,U + PUSH P,I ;IF THE JOB BEING ATTACHED IS LOGGED IN, + MOVE U,-3(P) ;PERFORM ACCOUNTING FOR IT. + HLRO T,UNAME(U) + AOSE T + PUSHJ P,LOGUPD + POP P,I + POP P,U +;DROPS THROUGH + ;DROPS IN + MOVE D,['HACTRN] + PUSHJ P,UJNAMU + JRST NATTAI + MOVE B,-2(P) ;SAVED CTLBTS(U) AT ENTRY + TRNE B,400000 + MOVEM D,JNAME(A) +NATTAI: MOVE B,-2(P) ;CTLBTS + MOVSI D,%USTSP ;BUSRC + TRNE B,4 + ANDCAM D,USTP(A) ;START JOB BEING ATTACHED, IF REQUESTED TO + PUSH P,U + HRRZ U,C ;GET USR IDX GIVING TTY TO IN U, +IFN N11TYS,[ + HRRZ T,I ;TTY # IN T FOR USTTV0 + PUSHJ P,USTTV0 ;GIVE THE JOB A BLINKER IF IT DESERVES ONE. + JFCL +] + POP P,A ;USR IDX TAKING TTY FROM (BUT NOT REALLY TAKING). I AND U STILL SET. + PUSHJ P,AGBLT4 ;MOVE HIS PER-JOB VARIABLES INTO THE TTY'S VARIABLES, ETC. + JRST NATTAE ;CLOCK IS NOW BACK ON. + +NATTAD: CONO PI,CLKOFF + MOVE J,JNAME(U) ;ATTACHING OUR TTY TO JOB: + MOVEM J,JNAME(A) ;GIVE JOB OUR JNAME ALONG WITH OUR TTY. + MOVE A,U + HRRZ U,C + PUSHJ P,AGBLT6 ;TRANSFER TTY TO HIM, SAVING OUR TTY STATE AND LOADING HIS. +NATTAE: MOVE U,A + POP P,B + EXCH U,(P) ;U := USER INDEX OF TOP OF TREE BEING ATTACHED + MOVSI T,BUMRTL ;SINCE TREE HAS BEEN ATTACHED, IT SHOULDN'T + ANDCAM T,APRC(U) ;DIE AN HOUR AFTER IT WAS DETACHED. + SKIPN STTYOP(U) ;RESTORE SAVED TTY OPTIONS, IF ANY + JRST NATTAP + LDB T,[170200,,STTYOP(U)] + DPB T,[.BP (%TCRFS+%TCQRY),TTYCOM(I)] + MOVE T,[%TOUSR,,%TPUSR] + ANDCAM T,TTYOPT(I) + AND T,STTYOP(U) + IORM T,TTYOPT(I) +NATTAP: HLRE T,UNAME(U) + CONO PI,CLKOFF + AOSE T + PUSHJ P,DMNPLI ;LOG HIM IN + CONO PI,CLKON + POP P,U + SUB P,[1,,1] ;FLUSH SAVED CTLBTS + PUSHJ P,LSWCLR ;UNSTOP THE JOBS AND FREE TREESW + JUMPGE B,POPJ1 ;RETURN IF WE DIDN'T GIVE AWAY OUR CONSOLE. + SETOM TTYTBL(U) ;DON'T WANT ALOGOU TO TYPE LOGOUT MESSAGE. + JRST ALOGOUT ;LOG THIS JOB OUT. + +;.CALL DISOWN +; RH OF ARG IS JOB SPEC, OF OUR INFERIOR. +; LH OF ARG XOR CONTROL BITS: +; 1.1 => RETAIN PRIORITY (DON'T SET APRC) +; 1.2 => USE SYSTEM RESOURCE +; 1.3 => CLEAR .USTP AFTER DISOWNING (THUS AVOIDING TIMING ERROR) +; 1.4 => SET BUMRTL SO THAT JOB WILL BE GUNNED IF IT IS STOPPED FOR A WHOLE HOUR +; AND NOT REOWNED OR ATTACHED. + +NDISOWN:HLRZ J,A + XORM J,CTLBTS(U) ;XOR LH OF 1ST ARG INTO CTL BITS. + HRRZ J,A + JSP T,NCRUI2 ;DECODE JOB SPEC; DON'T SET DIELOK. + JFCL + CAIN J,-1 + JRST OPNL31 ;PDP6 NO GOOD. + MOVEI R,IOCHNM(U) + ADD R,A ; R GETS ADDR OF IOCHNM WORD IF ARG WAS CHANNEL #, + TRNE A,400000 ;GET S0 IF ARG WAS OTHER SORT OF JOB SPEC. + SETZ R, + HRRZ A,J + HRRZ J,SUPPRO(A) + CAME J,U + JRST OPNL31 ;NO GOOD IF NOT OUR INFERIOR. + JRST NDISO1 ;JOIN OLD-STYLE DISOWN + +;.DISOWN CH, ;MAKES DIRECTLY INFERIOR PROCEDURE OPEN ON CHANNEL CH + ;THE TOP LEVEL JOB OF A DISOWNED JOB + +ADISOWN:HRRZ B,(R) ;PICK UP CH TYPE INDEX + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF AN INF. USER CHANNEL + JRST IOCER7 ;OTHER TYPE, GIVE IOC ERROR + HLRZ A,(R) ;PICK UP INF.'S INDEX + SETZM CTLBTS(U) +NDISO1: PUSHJ P,SWTL + TREESW + SETZM STTYOP(A) + MOVE B,TTYTBL(A) + TLNE B,%TBDTY ;SKIP IF TTY TAKEN AWAY + JRST ADISO1 + PUSH P,R + PUSH P,A ;JOB TO BE DISOWNED HAS THE TTY: TAKE IT AWAY. + PUSHJ P,SDTTY + BUG + POP P,A + POP P,R +ADISO1: MOVEI Q,DSWNTY + PUSHJ P,IFPHAK ;HACK INFERIORS + CAME U,USER + BUG + PUSHJ P,NATTA1 ;FLUSH OUR POINTERS TO INFERIOR, AND SET FLAGS + CAME U,USER + BUG + JRST LSWCJ1 ;UNSTOP HIS TREE AND FREE TREESW + +;FLUSH INFERIOR-JOB CHANNELS FROM JOB IN U TO JOB IN A +;CANNOT PCLSR BECAUSE JOB IS CURRENT OR STOPPED ALREADY +NATTA1: MOVEI R,0 ;NO PROTECTED CHANNEL + MOVEI D,%CLSU + EXCH U,A + PUSHJ P,ZUSES1 ;FLUSH POINTERS TO INFERIOR + EXCH U,A + SETOM SUPPRO(A) ;MARK AS TOP LEVEL + MOVE W,CTLBTS(U) + MOVSI TT,BUSRC ;CLEAR .USTP IF REQUESTED + TRNE W,4 + ANDCAM TT,USTP(A) + MOVSI TT,BUMRTL + TRNE W,10 + IORM TT,APRC(A) + POPJ P, + +DSWNTY: SKIPL TTYTBL(A) + BUG ;CHECKED AT HIGHER LEVEL, DATA INCONSISTENT +NATTA2: TDZA T,T ;DO SOS TTNTO OF CONSOLE TTY. +NDETA9: SETO T, ;DON'T. + PUSHJ P,CHSCAA ;LOOK AT ALL CNHLS + PUSHJ P,DSWNTZ ;BLESSING CONSOLE TTY CHNLS + MOVEI TT,SYSRCE ;SET RESOURCE POINTER TO SYSTEM OR DISOWNED + MOVE W,CTLBTS(U);DEPENDING ON CTLBTS + TRNN W,2 + MOVEI TT,USRRCE+NCT + MOVEM TT,UTMPTR(A) + MOVSI T,400000 + TRNN W,1 + IORM T,APRC(A) ;MARK AS DISOWNED + POPJ P, + +;BLESS CONSOLE TTY CHANNELS. IF T NONZERO, DON'T SOS TTNTO. +DSWNTZ: HLRZ B,(R) ;GET LH OF IOCHNM WORD + HRRZ J,(R) ;GET DEV TYPE INDEX + CAIL J,TYIDN ;SKIP IF LESS THAN LEAST TTY INDEX + CAILE J,TYOBN ;SKIP UNLESS .LTEQ. HIGHEST + POPJ P, ;NOT A TTY CHANNEL + TRZ B,#%TICNS#(.BM $TIIDX) + TRZE B,%TICNS ;SKIP IF NOT A CONSOLE TTY + CAIN B,%TINON ;DO NOTHING TO "DISOWNED" TTY CHNLS + POPJ P, + MOVEI J,%TINON ;CHANGE OTHER TTY CHNLS TO DISOWNED + DPB J,[$TIIDX,,(R)] ;CHNLS. + JUMPN T,CPOPJ ;IN NDETAC, TTNTO ALREADY SETZM'D. + SOSLE TTNTO(B) ;DECREMENT OPEN COUNT + POPJ P, + BUG ;SHOULD BE OPEN AT HIGHER LEVELS + +;ROUTINE TO SCAN ALL I/O CHANNEL AND I/O PDL SLOTS OF A PROCEDURE +;R 4.9=1 => REGULAR CHANNEL 4.9=0 => IOPUSHED CHANNEL +CHSCAA: MOVEI R,IOCHNM(A) +CHSCAN: HRLI R,-20 +CHSCA2: XCT @(P) + AOBJN R,CHSCA2 + HRLI R,-+400000 +CHSCA4: XCT @(P) + ADD R,[1,,2] + JUMPG R,CHSCA4 + JRST POPJ1 + ; +;IFPHAK AND IFPLUP TAKE A USER INDEX IN A AND THE ADDRESS OF A ROUTINE +; IN Q. THEY CALL THE ROUTINE FOR THE PROCEDURE AND ALL OF ITS +; INFERIORS BUT IFPHAK ALSO STOPS THE SPECIFIED PROCEDURE AND +; ALL ITS INFERIORS STRINGING THEIR USTP'S INTO THE CURRENT USER'S +; LSWPR. +; +IFPHAK: PUSH P,U + PUSH P,Q + MOVE U,USER ;MADE SURE YOU USE THE RIGHT LSWPR + MOVEI Q,IFSTOP ;SET UP TO STOP + PUSHJ P,IFPLUP + POP P,Q + POP P,U +IFPLUP: PUSH P,E ;SAVE E + PUSH P,H ; " H + SKIPA H,A +IFPLU5: MOVE A,E ;RECURSE + PUSH P,H + PUSH P,Q + PUSHJ P,(Q) ;CALL ROUTINE + POP P,Q + POP P,H + MOVEI E,LUBLK*2 ;INITIALIZE TO INDEX OF JOB AFTER CORE JOB +IFPLU2: SKIPN UNAME(E) + JRST IFPLU3 + HRRZ T,SUPPRO(E) + CAIN T,(A) + JRST IFPLU5 +IFPLU3: ADDI E,LUBLK ;STEP TO NEXT VAR BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST IFPLU2 ;NOT ALL, CONTINUE + CAME H,A ;ALL, SKIP IF BACK TO TOP LEVEL + JRST IFPLU4 ;NOT AT TOP LEVEL, POP UP + POP P,H ;RESTORE H + POP P,E ; " E + POPJ P, ;RETURN FROM CALL TO IFPLUP + +IFPLU4: MOVE E,A ;POP + HRRZ A,SUPPRO(A) ;UP + JRST IFPLU3 ;AND CONTINE + +IFSTOP: PUSHJ P,RPCLSR ;STOP ROUTINE WHOSE INDEX IS IN A + HRRZ T,USTP(A) + SOJE T,IFSTP1 + SKIPE LSWB0+1(A) + JRST UPCLSR ;HAVE ALREADY HACKED THIS GUY +IFSTP1: MOVEI T,USTP(A) ;GET LOC OF USTP (WAS AOSED BY RPCLSR) + MOVEI H,LSWB0(A) ;GET LOC OF A LOCKED SWITCH BLOCK OF PROC STOPPED + MOVEM T,(H) ;SET WD1 + PUSH P,U + HRRZ T,U + IDIVI T,LUBLK + POP P,U + HRL T,LSWPR(U) + IORI T,603000 ;SOS WHEN UNLOCKED + MOVSM T,1(H) + MOVEM H,LSWPR(U) ;ADD TO LOCKED SWITCH LIST OF USER + POPJ P, + +UBLAM: SKIPL APRC(U) ;SKIP IF DISOWNED + PUSHJ P,SDTTY ;GET TTY UP TO THIS LEVEL + JFCL +UBLAST: PUSHJ P,IODCL ;CLOSE IO DEVICES ETC +UBLST2: SETZ B, + PUSH P,U ;DO NOT USE THIS ROUTINE FOR CORING UP. + HRRZ Q,U +IFE SWPWSP,[ + CAME Q,BUSR + JRST UBLST4 + SETOM BUSR ;SWAP-BLOCKED NO MORE + SOS NUSWB + MOVSI TT,(SETZ) + ANDCAM TT,USWSCD(U) +];SWPWSP +UBLST4: MOVE U,USER + PUSHJ P,ACRF1 ;CORE DOWN TO NUM OF BLOCKS IN B + BUG + MOVE U,USER ;;CHECK FOR ALLEGED BUG SOMEPLACE IN ACRF1 + SKIPL CORRQ(U) ; + BUG ;;NOT SUPPOSED TO RETURN UNTIL CORE REQUEST SATISFIED + POP P,U + SKIPE NMPGS(U) ; + BUG ;;THUS GUY'S CORE SHOULD BE GONE BY NOW + POPJ P, + + +AEOFC: UMOVE B,(J) + LDB B,[400,,B] ;OPER 50 + ADDI B,IOCHNM(U) + MOVE A,(B) + MOVE A,CLSTB(A) + HLR A,(B) +IFN NUNITS, TLNE A,%CLSDI +.ALSO SKIPA A,UTEOF(A) + MOVEI A,EOFCH + JRST APTUAJ + +;OPER TO REQUEST OR FLUSH RUNNING IN IOT USER MODE +AIOTLS: MOVSI A,400000 + MOVSI B,%PCUIO + XCTR XR,[SKIPGE (J)] + JRST AIOTL1 ;JUMP IF WANT TO ENTER IOTLSR MODE + ANDCAM A,IOTLSR(U) + ANDCAM B,UUOH + POPJ P, + +AIOTL1: SKIPGE IOTLSR(U) + JRST AIOTL2 ;ALREADY IN IOTLSR, JUST TURN THE BIT ON AGAIN FOR HIM + BUG INFO,SIXBIT,UNAME(U),SIXBIT,JNAME(U),[IOTLSR] + MOVEI T,SCRMSG ;WAIT FOR IT TO BE PRINTED (HA HA WHAT ABOUT BUFFERING?) + TDNE T,SUPCOR + PUSHJ P,UFLS + IORM A,IOTLSR(U) +AIOTL2: IORM B,UUOH + JRST CLKONJ + +SUBTTL FILENAME TRANSLATION + +;ROUTINE TO TRANSLATE A FILENAME. +;WANTS DEV, FN1, FN2, SNAME IN A, B, C, D RESP. LEFT-JUST. +;WANTS MODE IN RH OF E. +;RETURNS TRANSLATED NAMES IN SAME PLACE. +TRAN: SKIPN D ;MAYBE DEFAULT THE SNAME. +TRAN6: MOVE D,USYSNM(U) + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) + SKIPN TRNCNT ;IF NO TRANSL. ENTRIES IN USE, + JRST POPJ1 ;SHORT CUT. + PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + LDB I,[100,,E] ;GET INPUT/OUTPUT BIT. + MOVEI H,10 ;MAX. NUM. TRANSLS ALLOWED. +TRAN0: HRROI Q,(U) ;1ST TRY THIS JOB'S TRNLST. + MOVE J,TRNLST(U) + JRST TRAN5 +TRAN1: SKIPGE Q,SUPPRO(Q) ;MOVE UP TREE TO TRNLS1. + SETZ Q, ;AFTER TOP OF TREE, USE SYS. +TRAN2: MOVE J,TRNLS1(Q) ;USE THIS GUY'S TRNLS1. + MOVEI Q,(Q) ;INDICATE THAT FACT IN SIGN. + JRST TRAN5 +TRAN3: CAME B,TRANI1(J) ;ENTRY'S FN1 MATCHES + SKIPN TRANI1(J) ;OR IS NULL? + SKIPA TT,TRANI2(J) ;YES, GET FN2. + JRST TRAN4 ;NO, TRY NEXT ENTRY. + CAME TT,C ;FN2 MTCHES OR NULL. + JUMPN TT,TRAN4 + CAME D,TRANIS(J) ;SNAME ? + SKIPN TRANIS(J) + SKIPA TT,TRANID(J) ;YES, GET DEV. + JRST TRAN4 + CAME A,TT + JUMPN TT,TRAN4 ;TEST DEV. + HLRZ TT,TRANLK(J) ;GET ENTRY'S MODE BITS. + TRNN TT,1(I) ;TRANSLATE OUR MODE? + JRST TRAN4 ;NO. + MOVEM B,EPDLT1(U) + MOVEM C,EPDLT2(U) + MOVEM D,EPDLT3(U) + MOVEM A,EPDLT4(U) +IRPS X,,OD O1 O2 OS + SKIPE TRAN!X(J) + MOVE A+.IRPCN,TRAN!X(J) +TERMIN ;REPLACE NAMES FROM ENTRY. + TRNE TT,400000 ;ATOMIC? + JRST TRANX3 ;YES, EXIT. + SOJG H,TRAN0 ;ELSE RETRANSL. + JRST TRANX2 ;IF TOO MANY TRANSL., DON'T SKIP. + +TRAN4: HRRE J,TRANLK(J) ;CDR DOWN LIST. +TRAN5: JUMPGE J,TRAN3 ;TRY NEXT UNLESS AT END. + JUMPL Q,TRAN2 ;IF DID TRNLST, DO SAME JOB'S TRNLS1. + JUMPN Q,TRAN1 ;ELSE DO SUPPRO'S TRNLS1. +TRANX3: AOS (P) ;EXIT IF DID SYS. +TRANX2: SOS TRNREF ;NO LONGER USING TRANSL. LISTS. + POPJ P, + +TRANRF: AOS TRNREF ;SAY USING TRANSL. LISTS. + SKIPGE TRANSW + POPJ P, ;OK IF NOT BEING CHANGED. + SOS TRNREF ;NOT REFERENCING AFTER ALL. + SKIPL TRANSW ;WAIT TILL FREE. + PUSHJ P,UFLS + JRST TRANRF ;TRY AGAIN. + ;TRANS SYSTEM CALL. +NTRNS: JSP T,DEFARG ;DEFAULT 5 ARGS TO 0. + 5 + XOR E,CTLBTS(U) ;XOR CTL BITS WITH ARG S + PUSHJ P,TRAN ;TRANSLATE NAME. + JRST OPNL3 ;FAIL IF TOO MANY TRANSL. + JRST POPJ1 ;ELSE GIVE BACK TRANSL'D NAMES. + + +DEFARG: CAML W,(T) ;IF NOT ALL SPEC'D, + JRST 1(T) + SETZM A(W) ;DEFAULT ONE AND RETRY. + AOJA W,DEFARG + +;LOCK TRANSW, AND SET UP 1ST ARG FOR NTRNAD, NTRNDL, NTRNCL. +;RH OF A HAS JOB SPEC; CONTROL BIT ARGS XOR'D INTO LH. +;THE 4.8 BIT, IF SET, INDICATES TRNLS1 RATHER THAN TRNLST. +;OTHER LH BITS IGNORED,, NOT CHANGED BY NTRNUI. +;ON RETURN, A'S LH IS UNCHANGED, RH IS SUCH THAT +; TRANLK(A) IS THE ADDR OF THE SPECIFIED TRNLS VAR. +NTRNUI: PUSHJ P,SWTL + TRANSW + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB-SPEC. + JRST NTRNU1 ;JOB GUARANTEED WRITEABLE. + JUMPE J,NTRNU1 ;ALLOW JOBS TO MUNG THE SYSTEM TRANSLATION LIST. + JSP T,NCORWR ;ELSE CHECK. + JRST OPNL31 ;NOT WRITEABLE. +NTRNU1: CAIN J,-1 + JRST OPNL34 ;PDP6?? + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;4.8 BIT SAYS WHICH TRNLS TO USE. + ADDI A,TRNLS1-TRNLST + JRST (Q) + +;GET UP TO 4 ARGS INTO D ... D+3, FROM AOBJN PTR IN B. +NTRNGA: MOVSI H,-4 ;UP TO 4 ARGS. + JUMPGE B,NTRNG3 +NTRNG0: UMOVE J,(B) + JUMPGE W,NTRNG2 ;W IS -1 FOR .TRANA, .TRAND; + TRNN H,-1 ;IN THAT CASE LEFT-JUST. DEV. (1ST ARG) + HRLZI J,(J) +NTRNG2: CAMN J,[SIXBIT/*/] + MOVEI J,0 ;REPLACE * BY BLANK. + MOVEM J,D(H) ;STORE AWAY. + AOBJP H,CPOPJ ;DONE AFTER 4TH ARG. + AOBJN B,NTRNG0 ;ELSE GET NEXT. +NTRNG3: SETZM D(H) ;ZERO REMAINING ARGS. + AOBJN H,NTRNG3 + POPJ P, + ;TRANEX CALL -- READ IN A JOB'S TRANSL LIST. +;1ST ARG RH - JOB SPEC. BIT 4.8 - IF SET, TRNLS1 NOT TRNLST. +;2ND ARG AOBJN -> PLACE TO STORE LIST INTO. +;UPDATED AOBJN PTR IS OUTPUT ARG. +;SKIPS IF ENTIRE LIST FIT IN BUFFER. +;EACH ENTRY TAKES 9 WDS OF SPACE: MODE,, IN 1ST, +;INPUT DEV, FN1, FN2, SNAME; THEN OUTPUT DEV, FN1, FN2, SNAME. +NTRNEX: PUSHJ P,TRANRF ;GET READ ACCESS TO TRANSL LISTS. + PUSHJ P,SOSSET ;RELINQUISH IF BLOCKED. + TRNREF + TSC A,CTLBTS(U) + MOVEI J,(A) + JSP T,NCRUI2 ;DECODE THE JOB SPEC. + JFCL ;NOT TRYING TO WRITE. + HRRI A,TRNLST-TRANLK(J) + TLNE A,200000 ;MAKE TRANLK(A) BE TRNLS VAR. + ADDI A,TRNLS1-TRNLST + SUB B,[1,,1] ;SINCE WE AOBJ BEFORE ACTING. +NTRNE1: HRRE T,TRANLK(A) ;AT END -> RETURN SKIPPING. + JUMPL T,NTRNE8 + HLLZ D,TRANLK(T) ;RETURN LH ONLY OF 1ST WD. + TLOA T,-9 +NTRNE2: MOVE D,TRANLK(T) ;ALL OF OTHER 8 WDS. + AOBJP B,[ PUSHJ P,OPNL37 + JRST NTRNE9] + ;FAIL IF NO ROOM. + UMOVEM D,(B) + ADDI T,SIOMT-1 + AOBJN T,NTRNE2 ;STORE ALL 9. + MOVEI A,-9*SIOMT(T) ;GO TO NEXT. + JRST NTRNE1 + +NTRNE8: AOS (P) + AOBJP B,.+1 ;COMPENSATE FOR SUB . + PUSHJ P,LSWPOP ;RELEASE READ ACCESS. +NTRNE9: MOVE A,B + JRST SYSCPT ;RETURN AOBJN PTR. + ;TRANDL CALL -- DELETE ENTRY FROM TRANSL LIST. +;1ST ARG RH JOB SPEC. OF JOB WHICH IS OK TO MODIFY. +;1ST ARG LH MODE BITS AS FOR .TRANAD, ALSO 4.8 BIT SAYS TRNLS1 +; (SPEC'D JOB AND INFS, RATHER THAN JUST SPEC'D JOB) +;2ND ARG AOBJN -> INPUT DEV, FN1, FN2, SNAME. (ONLY DEV NEC.). +;SKIPS IF SOMETHING WAS DELETED. +NTRNDL: JSP Q,NTRNUI ;PROCESS 1ST ARG., LOCK TRANSW. +NTRND: PUSHJ P,NTRNDA ;ACTUALLY DELETE. + JRST OPNL4 ;NOTHING TO DELETE => FILE NOT FOUND + JRST LSWPJ1 ;SKIP IF NTRNDA DID. + +NTRNDA: TLZ A,-1#400003 + PUSHJ P,NTRNGA ;ELSE GET INPUT NAMES. + SKIPGE TRANLK(A) + POPJ P, + HRRZS (P) ;CLEAR SKIP FLAG. + SKIPA T,A +NTRND2: MOVEI T,(H) ;CDR DOWN BOTH PTRS. +NTRND0: HRRE H,TRANLK(T) ;LOOK AT NEXT ENTRY. + JUMPL H,NTRNDX ;EXIT IF END. + CAMN D,TRANID(H) ;ALL 4 INPUT NAMES MUST MATCH. + CAME E,TRANI1(H) + JRST NTRND2 ;ELSE NOT TO BE DELETED. + CAMN TT,TRANI2(H) + CAME I,TRANIS(H) + JRST NTRND2 + HLLZ R,A ;GET MODE FROM ARG. + TLZ R,400000 ;DONT CLOBBER ATOM BIT + ANDCA R,TRANLK(H) ;TURN OFF IN MODE FROM ENTRY. + CAME R,TRANLK(H) ;IF DELETED ONE, CALL WILL SKIP. + HRROS (P) + MOVEM R,TRANLK(H) + TLNE R,3 ;IF NEITHER DIRECTION LEFT, SPLICE OUT. + JRST NTRND2 + SKIPE TRNREF ;WAIT TILL NOONE READING TRANSL LISTS. + PUSHJ P,UFLS + SOS TRNCNT ;ONE LESS ENTRY IN USE. + HRRZ R,TRANFL ;MAKE LINK -> CURRENT FREE LIST. + EXCH R,TRANLK(H) + HRRM R,TRANLK(T) ;REST OF TRNLS INTO PREDECESSOR'S LINK. + HRRZM H,TRANFL ;ADD THIS ONE TO FREE LIST. + JRST NTRND0 + +NTRNDX: HRRES TRANLK(A) ;IN CASE DELETED 1ST ENTRY. + SKIPGE (P) + AOS (P) ;SKIP IF SET FLAG. + POPJ P, + ;TRANAD CALL. -- ADD AN ENTRY TO A TRANSL LIST. +;1ST 2 ARGS AS FOR TRANDL. +;3RD ARG LIKE 2ND BUT GIVES OUTPUT NAMES. +;SKIPS UNLESS ALL ENTRIES WERE IN USE. +NTRNAD: JSP Q,NTRNUI +NTRNA: TLNN A,3 ;IF RELLY NOTHING WOULD BE TRANSL'D, + JRST LSWPJ1 ;DON'T BOTHER ADDING.. + PUSHJ P,NTRNDA ;DELETE ANY EXISTING TRANSL. FOR THESE INPUT NAMES. + JFCL ;IF WERE NONE. + SKIPGE T,TRANFL + JRST OPNL5 ;NO FREE ENTRIES - DIRECTORY FULL. + AOS TRNCNT ;1 MORE ENTRY IN USE. +IRPS X,,ID I1 I2 IS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;PUT INPUT NAMES INTO ENTRY. + MOVE B,C + PUSHJ P,NTRNGA ;GET OUTPUT NAMES. +IRPS X,,OD O1 O2 OS + MOVEM D+.IRPCN,TRAN!X(T) +TERMIN ;STORE OUTPUT NAMES. + MOVE H,TRANLK(A) ;PUT CURRENT TRNLS INTO LINK. + EXCH H,TRANLK(T) + HRREM H,TRANFL ;STORE BACK REST OF FREE LIST. + MOVEM T,TRANLK(A) ;TRNLS NOW STARTS WITH THSI ONE. + HLLM A,TRANLK(T) ;STORE MODE BITS. + JRST LSWPJ1 + ;TRANCL CALL -- RESET A ONE OR BOTH TRANSL LISTS FOR A JOB. +;1ST ARG RH HAS JOB SPEC OF MODIFYABLE JOB. +; BIT 4.8 CLEAR TRNLS1 VAR. (TRANSL FOR THIS JOB & INFS). +; BIT 4.7 CLEAR TRNLST VAR. (TRANSL FOR THIS JOB ONLY). +; ALWAYS SKIPS IF VALID. +NTRNCL: JSP Q,NTRNUI ;RH(A) -> TRNLST OR TRNLS1 VAR. + TLNE A,200000 + SUBI A,TRNLS1-TRNLST ;MAKE -> TRNLST VAR. + SUBI A,TRNLST-TRANLK + JRST NTRNC4 + +NTRNCA: SUBI A,TRNLST-TRANLK ;MAKE HOLD USR IDX. +NTRNC: PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW +NTRNC4: AOS (P) + SKIPE TRNREF ;WAIT FOR READ REFS TO FINISH. + PUSHJ P,UFLS + TLNN A,100000 ;IF 4.7, HANDLE TRNLST. + JRST NTRNC0 + HRRE T,TRNLST(A) + SETOM TRNLST(A) ;SET LIST TO NIL. + JUMPGE T,NTRNC1 ;IF WASN'T NIL, FREE ENTRIES ON IT. +NTRNC0: TLZN A,200000 ;MAYBE HANDLE TRNLS1. + JRST LSWPOP + HRRE T,TRNLS1(A) + SETOM TRNLS1(A) + JUMPL T,LSWPOP ;NOTHING TO DO IF ALREADY NIL. +NTRNC1: MOVEI C,(T) ;SAVE START OF LIST. +NTRNC2: SOS TRNCNT ;UPDATE NUM ENTRIES IN USE. + HRRES H,TRANLK(T) + JUMPL H,NTRNC3 ;AT END, SPLICE INTO FREELIST. + MOVEI T,(H) ;ELSE CDR DOWN. + JRST NTRNC2 +NTRNC3: EXCH C,TRANFL + HRRZM C,TRANLK(T) + JRST NTRNC0 ;MAYBE CONSIDER THE OTHER LIST. + ;.TRANA, .TRAND CALLS. +ATRANA: UMOVE E,(B) + JSP T,ATRNDT ;SET UP ARGS FOR NTRNA . + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRNA + +ATRNDL: +ATRAND: XCTR XR,[SKIPN E,(B)] + JRST ATRND0 ;ZERO UNAME -> TRANCL . + JSP T,ATRNDT ;SET UP ARGS. + PUSHJ P,SWTL ;GET WRITE ACCESS. + TRANSW + JRST NTRND + +ATRND0: JSP T,ATRNDT + TLO A,300000 ;SAY CLEAR BOTH LISTS. + CAMN D,[SIXBIT/*/] + SUBI A,TRNLS1-TRNLST ;NAKE SURE -> TRNLST VAR. + JRST NTRNCA + +ATRNDT: MOVE C,JNAME(U) + MOVEM C,ATRNJN ;WHO THE HELL'S USING THESE? + CAME E,UNAME(U) ;UNAME MUST BE 0 OR THSI JOB'S. + JUMPN E,CPOPJ ;ELSE MAKE UUO FAIL. + MOVNI W,1 ;SIGNAL TO NTRNGA. + MOVEI C,5(B) ;SET UP 2 AOBJN PTRS + MOVEI B,2(B) + HRLI C,-3 ;-> INPUT NAMES (B), OUTPUT NAMES (C). + HRLI B,-3 + XCTR XR,[HLL A,(B)] ;GET MODE BITS. + UMOVE D,-1(B) + JUMPE D,CPOPJ ;JNAME MUSTN'T BE 0. + CAME D,[SIXBIT/*/] ;IF *, USE THIS JOB'S TRNLS1. + JRST ATRND2 + HRRI A,TRNLS1-TRANLK(U) + JRST (T) + +ATRND2: MOVEI H,0 ;ELSE FIND JOB WITH THAT JNAME. + MOVE E,UNAME(U) ;THIS JOB'S UNAME. +ATRND1: CAMN E,UNAME(H) + CAME D,JNAME(H) + JRST ATRND3 ;NOT THE ONE WE'RE LOOKING FOR. + HRRE E,SUPPRO(H) + CAIE U,(E) ;IS THIS OUR INF. + CAIN U,(H) ;IS IT THE CURRENT JOB? + CAIA + POPJ P, ;NO, CAN'T SET ITS TRANSL LIST. + HRRI A,TRNLST-TRANLK(H) + JRST (T) ;OK, SET ITS TRNLST VAR. +ATRND3: ADDI H,LUBLK + CAMGE H,USRHI ;LOOK AT ALL JOBS. + JRST ATRND1 + POPJ P, ;CAN'D TRANAD NON EX JOB. + +SUBTTL JOB, BOJ DEVICE ROUTINES + +EBLK +JBMN==10 ;MAXIMUM NUMBER OF JOBS ON JOB DEVICE + +JBCUI: REPEAT JBMN,-1 ;-1 => CHNL FREE, ELSE (IF JBCG POSITIVE) CREATOR'S USR IDX. +JBCG: BLOCK JBMN ;-1 IF CREATOR GONE AWAY +JBWST: REPEAT JBMN,SNJOB ;CREATED JOB'S WAIT STATUS (CREATED JOB=HANDLER JOB) +%JB==1,,525252 +%JBWIN==400000 ;4.9 => CREATED JOB HAS DONE A SUCCESSFUL JOBRET +%JBREU==200000 ;4.8 => JOB CLOSED AND MADE ITSELF AVAILABLE FOR REUSE +%JBVAL==020000 ;4.5 => VALID BIT (CREATOR CAME IN, NO JOBRET YET) +%JBSTR==010000 ;4.4 => STORED BIT (CREATOR CAME IN, NO JOBGET YET) +%JBUNH==004000 ;4.3 => BOJ BLK UNHANG BIT +%JBSIO==001000 ;4.1 => IF DOING AN IOT, THIS BITS SAYS ITS REALLY A SIOT +%JBLOS==000400 ;3.9 => CREATED JOB WAS CLOSED AND KNOWS IT, SO DON'T REUSE + ;1.1-2.9 => LAST STATUS SET BY BOJ + +JBDEV: BLOCK JBMN ;DEVICE NAME, USER-SETTABLE (MOSTLY FOR PEEK AND WHO LINES) +JBFN1: BLOCK JBMN ;FN1 +JBFN2: BLOCK JBMN ;FN2 +JBSYS: BLOCK JBMN ;SYSNAME +JBOPNM: BLOCK JBMN ;OPEN MODE +JBFNP: BLOCK JBMN ;BP TO ASCIZ FILENAME STRING IN USER ADDRESS SPACE (OR 0 IF NONE). +JBCJUI: BLOCK JBMN ;RH = CREATED JOB'S USER INDEX. + ;LH = -1 IFF CREATED JOB GOING AWAY. JOB MUST EXIST + ;SINCE WHEN IT DIES IT FLUSHES THE JOB CHANNEL + ;AND ITS CREATOR'S CHANNELS. +JBSTS: BLOCK JBMN ;STATUS OF JOB-BOJ INTERACTIONS +;4.9=1 => IMAGE =0 => ASCII +;4.8=1 => BLOCK =0 => UNIT +;4.7=1 => WRITE =0 => READ +;4.6-4.3 => NUMBER OF TIMES TO SKIP +;4.2-3.6 => OPEN LOSS +;3.5-3.2 => # OF ARGS ON LAST .CALL +;1.4 => SYSTEM CALL OTHER THAN THOSE BELOW. +;1.3-1.1 => SYSTEM CALL + ;0 OPEN + ;1 IOT OR SIOT + ;2 MLINK + ;3 RESET + ;4 RCHST + ;5 ACCESS + ;6 FDELE (DELETE OR RENAME) + ;7 FDELE (RENAME WHILE OPEN) + +JBST2: BLOCK JBMN ;SECOND WORD OF JOBGET INFO + ;FOR UNIT IOT, 1 + ;FOR SIOT, THE BYTE COUNT + ;FOR BLOCK IOT, THE BLOCK POINTER + ;NEW FN1 FOR RENAME, MLINK. +JBOFN1: BLOCK JBMN ;FN1 BEFORE LAST TRANS +JBOFN2: BLOCK JBMN ;FN2 "" "" +JBOSYN: BLOCK JBMN ;SYSNAM "" +JBODEV: BLOCK JBMN ;DEV " " +JBNFN2: BLOCK JBMN ;NEW FN2 FOR FDELE. +JBAC7: BLOCK JBMN ;7TH ARG TO .CALL, NEW SNAME FOR MLINK. +JBAC10: BLOCK JBMN ;TABLE FOR .CALL ARG 10, FIRST BP ARG TO SOPEN/RENAME/MLINK/DELETE. +JBAC11: BLOCK JBMN ;TABLE FOR .CALL ARG 11, SECOND BP ARG TO RENAME, MLINK OR RENMWO. + +JBACTB: JBST2(H) ;TABLE OF POINTERS TO .CALL ARG TABLES + JBOFN1(H) + JBOFN2(H) + JBOSYN(H) + JBODEV(H) + JBNFN2(H) + JBAC7(H) + JBAC10(H) + JBAC11(H) + +JBIOCJ: BLOCK JBMN ;IO CHNL ERROR WORD. 4.9 => IOCER ON NEXT JOB IOT + ;RH = IOCER TYPE + +JBSW: -1 ;LOCK ON ASSIGNMENT OF INDEX IN ABOVE TABLES + 0 +BBLK + +;OPEN ON BOJ: DEVICE + +;3.5 = 1 => UNHANG ON BLK IOT AFTER EACH XFER OF MAXIMAL SIZE +BOJO: JUMPN W,OPNL12 ;NO SUCH MODE + SKIPGE E,JBI(U) ;JOB CHANNEL INDEX + JRST [ MOVE E,OPTION(U) ;IF THIS JOB ISN'T A JOB DEVICE, + TLNN E,%OPOJB ;IF IT'S EXPECTING TO BE AN OJB DEVICE, OK. + JRST OPNL10 ;OTHERWISE IT CAN'T WIN. + SKIPGE JBI(U) ;IF IT CAN WIN, WAIT TILL IT HAS. + PUSHJ P,UFLS + JRST BOJO] ;THEN TRY AGAIN. + CAIL E,JBMN + BUG ;JOB CHANNEL INDEX TOO BIG + CAME U,JBCJUI(E) + BUG + HRLZ A,E + HLRZS C + MOVSI TT,%JBUNH + TRNE C,20 + IORM TT,JBWST(E) + JSP Q,OPSLC7 + BDUAI,,BDUAO + BDBI,,BDBO + BDUII,,BDUIO + BDBI,,BDBO + +;OPEN ON JOB: DEVICE +;MODE BITS: +;3.1-3.3 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT +;A,B HAVE FILENAMES, RH(C) HAS DEVICE (JOB OR OJB) +;RH(D) AND LH(C) BOTH HAVE OPEN-MODE. + +JOBO: PUSHJ P,FLDRCK + JRST JOBO3 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO3: CAMN A,[SIXBIT /M.F.D./] + CAME B,[SIXBIT /(FILE)/] + JRST JOBO2 + JRST OPNL11 ;ILLEGAL FILE NAME +JOBO2: MOVEI J,0 ;SET J TO JOBGET "COMMAND" NUMBER + CAIN W,2 + MOVEI J,2 ;MLINK, MOSTLY JUST LIKE FDELE, BUT SEE JOBOF3 + CAIN W,4 + MOVEI J,6 ;FDELE + MOVNI E,1 + MOVSI Q,-JBMN + PUSHJ P,SWTL ;LOCK JOB CHNL ASSIGN SWITCH + JBSW +JOBO5: SKIPGE TT,JBCUI(Q) ;SKIP IF NOT FREE + JRST JOBO4 + MOVE T,UUOH + TLNN T,%PCFPD + JRST JOBORU ;JUMP IF THIS IS FIRST ATTEMPT TO OPEN + HRRZ H,C + CAIN H,'OJB + JRST JOBO6 + SKIPGE JBCG(Q) ;LOOK FOR CHANNEL ON WHICH THIS USER + CAIE TT,(U) ;PREVIOUSLY ATTEMPTED TO OPEN, BUT PCLSRED + JRST JOBO6 + MOVE T,EPDLT1(U) + MOVE TT,EPDLT2(U) + CAMN T,JBFN1(Q) + CAME TT,JBFN2(Q) + JRST JOBO6 ;NOT OPENING SAME FILE + MOVE TT,EPDLT4(U) + MOVE T,EPDLT3(U) + CAMN TT,JBDEV(Q) + CAME T,JBSYS(Q) + JRST JOBO6 ;NOT FOR SAME FILE + CONO PI,CLKOFF + HLRZ H,C + HRRZ T,JBSTS(Q) + CAIN T,(J) + CAME H,JBOPNM(Q) + JRST JOBO6 ;NOT FOR SAME OPEN TYPE AND MODE + MOVE TT,JBWST(Q) + TLNE TT,%JBLOS+%JBWIN+%JBREU + JRST JOBO6 ;HANDLER JOB NOT IN CORRECT STATE + HRRZ E,Q ;REUSE SAME HANDLER JOB AS IN PREVIOUS ATTEMPT TO OPEN + SETZM JBCG(E) ;I'M BACK + PUSHJ P,LSWPOP ;FREE JBSW + TLO TT,%JBVAL + MOVEM TT,JBWST(E) ;RE-GIVE OPEN COMMAND STILL SITTING IN JBSTS ETC. + HRLI E,400000 ;OPEN-TYPE WAIT + PUSHJ P,JBWT2 ;WAIT FOR HANDLER JOB TO PROCESS IT + JRST JOBO8 ;FINISH OFF THEN OPEN + +;FIRST ATTEMPT TO OPEN, CHECK FOR REUSEABLE HANDLER JOBS BEFORE CREATING NEW +JOBORU: CONO PI,CLKOFF + MOVE TT,JBWST(Q) + SKIPGE JBCG(Q) + TLZN TT,%JBREU + JRST JOBO6 ;IN USE ALREADY OR NOT WILLING TO BE REUSED + MOVE T,EPDLT4(U) + CAMN T,JBODEV(Q) + JRST JOBOR1 ;IF SAME SIMULATED DEVICE, OK TO SIEZE + CAMN A,JBOFN1(Q) + CAME B,JBOFN2(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME + MOVE T,USYSN1(U) + CAME T,JBOSYN(Q) + JRST JOBO6 ;DIFFERENT HANDLER NAME +JOBOR1: MOVEM TT,JBWST(Q) ;THIS ONE OK, SIEZE IT + HRRZ E,Q + MOVEM U,JBCUI(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + PUSHJ P,LSWPOP ;FREE JBSW + JRST JOBO7 + +JOBO4: HRRZ E,Q ;REMEMBER FREE JOB CHNL IN CASE NEEDED +JOBO6: CONO PI,CLKON + AOBJN Q,JOBO5 ;SCAN REST OF JOB CHANNELS + JUMPL E,OPNL6 ;DEVICE FULL + MOVEM U,JBCUI(E);STORE CREATOR'S USER INDEX + PUSHJ P,LSWPOP ;FREE JOBSW + PUSHJ P,STMSET ;SETOM JBCUI(E) ON LOSSAGE + JBCUI(E) + SETZM JBDEV(E) + SETZM JBFNP(E) + HLRZM C,JBOPNM(E) + SETZM JBCG(E) + SETZM JBIOCJ(E) + MOVEI T,SNJOB ;INITIALIZE STATUS + MOVEM T,JBWST(E) + PUSH P,R + PUSH P,U + PUSH P,J + PUSH P,D + PUSH P,E + PUSH P,A + PUSH P,B + ANDI C,-1 ;FOR OJB DEVICE, LOOK FOR EXISTING JOB. + CAIN C,'OJB + JRST JOBO6B + MOVE A,UNAME(U) ;FOR JOB DEVICE, CREATE NEW JOB. + IDIVI E,10. + MOVEI B,'0(E) + LSH B,6 + ADDI B,'0(TT) + ADD B,[SIXBIT /JOB./] ;CREATE JNAME = 'JOB.MN' + MOVE C,[7,,(SIXBIT /USR/)] + MOVE D,[SETZ 3] + PUSHJ P,USROJ ;GENERATE USER(CAN ONLY PCLSR BEFORE CREATING INFERIOR) + JRST POP7J ;USER OPEN FAILED, MUST HAVE GONE TO OPNL ALREADY + CONO PI,CLKOFF + POP P,B + POP P,A + POP P,E + SETOM SUPPRO(TT) + MOVE T,[JBSTCD,,AC0S] + ADDI T,(TT) + BLT T,AC17S(TT) + HRLZI T,%PCUSR + MOVEM T,UPC(TT) + MOVEM A,AC0S+10(TT) + MOVEM B,AC0S+11(TT) + MOVE T,USYSN1(U) + MOVEM T,USYSNM(TT) ;SET CREATED JOB'S SYS NAME TO OURS + SETZM USTP(TT) ;START JOB AS SOON AS CLK BACK ON + JRST JOBO6C + +;OJB: DEVICE, LOOK FOR JOB WHOSE NAMES ARE THE FILENAMES SPECIFIED IN THE OJB OPEN. +JOBO6B: MOVE C,[7+UBPFJ,,'USR] ;DON'T EVER CREATE JOB FOR OJB. + MOVE D,[SETZ 3+UBPFJ_<-1>] + PUSHJ P,USROOJ + JRST POP7J + SUB P,[2,,2] + POP P,E +;TT HAS USER IDX OF JOB TO BE USED; CAN'T PCLSR AFTER THIS POINT. +JOBO6C: PUSHJ P,LSWDEL ;SETOM JBCUI(E) + POP P,D + POP P,J + POP P,U + POP P,R + HRRZM TT,JBCJUI(E) + MOVEM E,JBI(TT) +JOBO7: CONO PI,CLKOFF + MOVE TT,EPDLT1(U) + MOVEM TT,JBOFN1(E) + MOVEM TT,JBFN1(E) + MOVE TT,EPDLT2(U) + MOVEM TT,JBOFN2(E) + MOVEM TT,JBFN2(E) + MOVE TT,EPDLT3(U) + MOVEM TT,JBOSYN(E) + MOVEM TT,JBSYS(E) + MOVE TT,EPDLT4(U) + MOVEM TT,JBODEV(E) + MOVEM TT,JBDEV(E) + MOVE TT,EPDL(U) + MOVEM TT,JBAC10(E) + MOVE TT,EPDL3(U) + MOVEM TT,JBAC11(E) + JUMPN J,[PUSHJ P,JFDEL5 ;DELETE/RENAME/MLINK + JRST JOBO9] + LDB TT,[000300,,JBOPNM(E)] + ROT TT,-3 + MOVEM TT,JBSTS(E) + HRRZ C,JBOPNM(E) ;GET ALL OF OPEN MODE + MOVEM C,JBNFN2(E) ;GIVE IT +JOBO9: PUSHJ P,JBWT1 ;STORE STUFF AND HANG +JOBO8: LDB TT,[350400,,JBSTS(E)] + JUMPE TT,JOBOPL ;OPEN LOST + LDB C,[000400,,JBSTS(E)] + JUMPN C,[ SETOM JBCG(E) ;DELETE/RENAME/MLINK + JRST POPJ1 ] + MOVE C,JBOPNM(E) + SETZM IOCHST-IOCHNM(R) + HRLZ A,E + JSP Q,OPSLC7 + JDUAI,,JDUAO + JDBI,,JDBO + JDUII,,JDUIO + JDBI,,JDBO + +JOBOPL: LDB C,[270600,,JBSTS(E)] + SETOM JBCG(E) + SKIPE C + CAILE C,NOPNLS + MOVEI C,22 + JRST OPNL1-1(C) + +;RENAME WHILE OPEN ON JOB CHNL +JFDEL4: HLRZ E,(TT) ;JOB CHNL INDEX + MOVEI J,7 + PUSHJ P,JFDEL5 ;DO "FDELE" + MOVE TT,EPDL3(U) ;PASS ALONG THE BP ARG IF THERE WAS ONE. + MOVEM TT,JBAC11(E) + SETZM JBAC10(E) + JRST AIOCA1 ;GET RESULTS + +;FDELE/RENMWO/MLINK ON JOB CHANNEL +JFDEL5: MOVEM J,JBSTS(E) + MOVE TT,SRN3(U) ;REMEMBER NAMES TO RENAME AS + MOVEM TT,JBST2(E) ;FOR JOBGET TO RETURN. + MOVE TT,SRN4(U) + MOVEM TT,JBNFN2(E) + MOVE TT,SRN5(U) ;IN CASE THIS IS MLINK, MAKE SURE THE "TO" SNAME + MOVEM TT,JBAC7(E) ;IS GIVEN TO JOBGET. + CONO PI,CLKOFF + POPJ P, + +;GIVE AN INTERRUPT TO THE JOB DEVICE HANDLER. +;JOB CHNL INDEX IN E, CLOBBERS TT,J,Q,H +;CALL WITH CLKOFF + +JBINT: HRRZ TT,JBCJUI(E) + MOVEI J,IOCHNM(TT) + HRLI J,-20 + MOVSI H,%CLSBJ +JBINT1: MOVE Q,(J) + TDNN H,CLSTB(Q) ;SKIP IF BOJ +JBINT2: AOBJN J,JBINT1 + JUMPGE J,CPOPJ + SUBI J,IOCHNM(TT) + MOVE Q,CHNBIT(J) + IORM Q,IFPIR(TT) + ADDI J,IOCHNM(TT) + JRST JBINT2 + +;THIS IS THE CODE PUT IN THE ACS TO LOAD IN THE JOB DEVICE HANDLER + +JBSTCD: .OPEN 1,7 ;0 + .LOGOUT + .CALL 12 + .LOGOUT + .IOT 1,2 + .CLOSE 1, + JRST (2) + 4,,(SIXBIT /DSK/) ;7 + 0 ;10 FN1 + 0 ;11 FN2 + SETZ ;12 + SIXBIT /LOAD/ + 16 + SETZ 17 + -1 ;16 (LOAD INTO SELF) + 1 ;17 + +;HAND THE JOB DEVICE HANDLER A SYSTEM CALL AND WAIT FOR IT TO BE HANDLED. +;CALL WITH CLOCK OFF, JOB CHNL IN E +JBWT1: TLOA E,400000 ;OPEN/FDELE/MLINK, CLOSE CHANNEL IF PCLSR +JBWT: TLZ E,400000 ;NORMAL ENTRY POINT, DON'T CLOSE IF PCLSR + TLZA E,200000 +JBWTI: HRLI E,200000 ;ENTER HERE TO INHIBIT SETTING %PCFPD IF PCLSR + MOVSI TT,%JBVAL+%JBSTR + IORM TT,JBWST(E) ;TURN ON VALID AND STORED +JBWT2: PUSHJ P,JBINT ;GIVE INT + PUSHJ P,LOSSET + JBPCL ;CLEAR VALID AND STORED IF PCLSR + MOVE T,E ;CAUSES EPDL2 TO HAVE JOB INDEX + PCLT +JBFLS: SKIP JBFLS + PUSHJ P,UFLS ;AWAIT RESULTS FROM HANDLER JOB + MOVSI TT,%PCFPD + ANDCAM TT,UUOH ;NOW WE KNOW WE'LL RETURN TO USER WITHOUT PCLSRING FIRST + JRST LSWDEL + +JBPCL: MOVE A,AC0S+E(U) ;HERE IF PCLSR OUT + SKIPL JBCJUI(A) ;UNLESS HANDLER GOING AWAY + TLNE A,200000 ;OR THIS SYSTEM CALL DOESN'T WANT IT, + JRST JBPCL1 + MOVSI T,%PCFPD ;SET FIRST PART DONE FLAG + IORM T,UPC(U) ;NOTE PCLSR HAS ALREADY MOVED UUOH INTO UPC +JBPCL1: MOVSI T,%JBVAL+%JBSTR ;NOT VALID, NOT STORED + ANDCAM T,JBWST(A) + JUMPGE A,CPOPJ + SETOM JBCG(A) ;SAY THE CREATOR HAS CLOSED IT +IRPS X,,E TT J Q H + PUSH P,X +TERMIN + MOVE E,A ;AND GIVE THE HANDLER AN INTERRUPT + PUSHJ P,JBINT +IRPS X,,H Q J TT E + POP P,X +TERMIN + POPJ P, + +;JOB DEVICE BLOCK MODE IOT EITHER DIRECTION +JBBI: XCTR XRW,[MOVES D,(C)] ;REFERENCE POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + MOVEM D,JBST2(A) + MOVE B,C + HRRZ T,D ;-> FIRST WORD TO TRANSFER + HLROS D ;MINUS WORD COUNT + IORI D,700000 ;FLUSH CHAR COUNT + SUBM T,D ;D -> LAST WORD + 1 TO TRANSFER + JRST JBIPG ;SWAP IN BUFFER THEN DO IOT + +;JOB DEVICE UNIT MODE IOT EITHER DIRECTION + JRST JBSI ;SIOT +JBUI: MOVSI T,%JBSIOT + ANDCAM T,JBWST(A) + MOVEI T,1 + MOVEM T,JBST2(A) + UMOVE W,(C) ;FOR UNIT OUTPUT +JBIOT1: HRRZ TT,JBOPNM(A) + ROT TT,-3 ;MODE + HRRI TT,1 ;IOT CMD + HRRZ E,A ;JOB CHNL INDEX + MOVEM TT,JBSTS(E) + MOVEM C,SRN3(U) ;MAY BE ADDRESS OF BLOCK IOT POINTER + CONO PI,CLKOFF + SKIPL TT,JBIOCJ(E) + JRST JBWTI ;GO SIGNAL HANDLER JOB + SETZM JBIOCJ(E) ;TAKE IOC ERROR INSTEAD + JRST IOCERF-MIOTER(TT) + +;JOB DEVICE SIOT EITHER DIRECTION +JBSI: AOS (P) ;SIOT SHOULD SKIP RETURN + MOVSI T,%JBSIOT + IORM T,JBWST(A) + XCTR XRW,[MOVES T,(B)] ;BYTE PNTR ARG + LDB E,[300600,,T] ;BYTE SIZE + MOVEI D,36. + IDIVM D,E ;E := # BYTES PER WORD + XCTR XRW,[MOVES D,(C)] ;BYTE COUNT ARG + MOVEM D,JBST2(A) + IDIV D,E ;D := WORD COUNT, E := EXCESS BYTES + IBP T ;-> FIRST WORD TO TRANSFER + ADD D,T + SOJLE E,JBIPG +JBSI1: IBP D + SOJG E,JBSI1 +JBIPG: HRRZS D ;-> LAST WORD TO TRANSFER + 1 + ANDI T,-2000 ;-> FIRST PAGE INVOLVED IN TRANSFER + LDB E,[.BP .UII#.UIO,JBOPNM(A)] ;0 INPUT 1 OUTPUT +JBIPG1: SKIPE E ;SWAP IN THE NECESSARY PAGES + XCTR XR,[SKIPA 20(T)] + XCTR XRW,[MOVES 20(T)] + ADDI T,2000 + CAMGE T,D + JRST JBIPG1 + JRST JBIOT1 + +;FLSINS ROUTINE TO WAIT FOR CREATOR TO BE HUNG AT JBFLS +;4.9 OF SRN3 = 1 => WAIT FOR WRITE 0 => READ +;1.1-1.4 => CODE OF UUO TO WAIT FOR + +BJWAIT: SKIPE B,FLSINS(T) + CAME B,JBFLS + POPJ P, ;NOT HUNG AT JBFLS + HRRZ B,EPDL2(T) ;JOB INDEX THAT CREATOR IS HACKING + HLRZ E,T ;JOB INDEX OF BOJ USER + CAME B,E + POPJ P, ;CREATOR HACKING JOB DEVICE ON SOME OTHER CHANNEL + MOVE TT,JBSTS(B) + LSH TT,2 ;4.9 => READ/WRITE BIT NOW + EQV TT,SRN3(U) ;4.9 OF SRN3 => WHAT TO LOOK FOR + JUMPGE TT,CPOPJ ;DOESN'T MATCH + MOVE TT,JBSTS(B) ;INSN CREATOR IS DOING + XOR TT,SRN3(U) ;INSN LOOKING FOR + TRNN TT,17 + AOS (P) ;THEY MATCH, AWAKEN BOJ JOB + POPJ P, + +;BOJ DEVICE UNIT MODE OUTPUT +BJUO: SKIPGE C + SKIPA H,(C) + UMOVE H,(C) + MOVEI B,1 ;WAIT FOR INPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO BE IN IOT, RETURN WITH CLK OFF + PUSHJ P,BJWAIT + PUSHJ P,BJUO1 + JRST CLKONJ + +BJUO1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUOB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUOS ;CREATOR SIOT + MOVEM H,AC0S+W(T) +BJIUNH: MOVSI D,%JBWIN + IORM D,JBWST(A) ;SET SUCCESSFUL JOBRET BIT + MOVSI D,%JBVAL+%JBSTR + ANDCAM D,JBWST(A) + MOVEI D,0 + DPB D,[350400,,JBSTS(A)] ;DON'T SKIP + EXCH D,FLSINS(T) ;RESTART CREATOR + CONSO PI,1 + CAME D,JBFLS + BUG ;HE WASNT WHERE HE BELONGED + POPJ P, ;NEED NOT CLKON, CALLER WILL TURN IT ON + +;BOJ UNIT OUTPUT TO JOB SIOT +BJUOS: PUSHJ P,BJBINI + XCTRI XBYTE,[IDPB H,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +BJBINI: HRLI T,%UMALL + MOVE J,T + PUSHJ P,PLD1 + MOVE B,AC0S+B(T) + XCTRI XRW,[MOVE D,(B)] + POPJ P, + BUG + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT +BJUOB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUOBA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT OUTPUT TO JOB BLOCK IOT, ASCII MODE +BJUOBA: LDB E,[410300,,D] ;CHAR COUNT + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNE D,700000 + JRST PLDZ +BJIUNP: PUSHJ P,BJIUNH ;UNHANG CREATOR + JRST PLDZ + +;BOJ DEVICE BLOCK OUTPUT +BJBO: SKIPGE JBCG(A) + POPJ P, + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB E,[410300,,D] + CAIGE E,3 + POPJ P, + HLRO B,D + IORI B,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,B + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND (WHY NOT?) + UMOVE H,(D) ;H GETS FIRST WORD + MOVEI B,1 + PUSHJ P,BJBWT ;WAIT FOR JOB INPUT IOT, COME BACK WITH CLK OFF. + JRST CLKONJ ;UNHANG + MOVEI I,1 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + JUMPGE TT,BJBOA ;CREATOR IOT IS ASCII + ADD D,[1,,1] +BJBO1: PUSH P,C + PUSH P,D + PUSHJ P,BJUO1 + POP P,D + POP P,C + XCTRI XW,[MOVEM D,(C)] + SKIPA T,IOTTB+BDBO + BUG +BJBEX: TLNN D,700000 + JRST CLKONJ ;BOJ BLOCK POINTER EXHAUSTED + MOVE E,JBWST(A) + CONO PI,CLKON + TLNN E,%JBVAL ;SKIP IF JOB IOT STILL WAITING FOR MORE + TLNN E,%JBUNH + JRST (T) ;TRANSFER MORE + POPJ P, ;UNHANG BOJ IOT PREMATURELY + +;BOJ BLOCK ASCII OUTPUT FETCH CHARACTER +BJBOA: MOVE E,BTOCHT-3(E) + MOVE W,H + ILDB H,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + JRST BJBO1 + +;BOJ BLOCK IOT WAIT. AWAITS JOB IOT, UNLESS UNHANGING. +;TURNS CLKOFF. SKIPS UNLESS SUPPOSED TO UNHANG. +BJBWT: MOVEM B,SRN3(U) ;SAVE WHAT JOB UUO TO WAIT FOR + HRLZ T,A ;SET UP ARG FOR BJWAIT FLSINS + HRR T,JBCUI(A) + MOVE TT,JBWST(A) ;CHECK FOR DON'T HANG MODE + TLNE TT,%JBUNH + JRST BJBWT1 + PUSHJ P,CWAIT ;WAIT FOR JOB IOT + PUSHJ P,BJWAIT + JRST POPJ1 + +BJBWT1: CONO PI,CLKOFF ;IF NOT ALREADY IN JOB IOT, DON'T WAIT + JRST BJWAIT ;TEST CREATOR STATUS, POPJ OR POPJ1 + +;BOJ DEVICE UNIT MODE INPUT +BJUI: MOVE B,[SETZ 1] ;WAIT FOR OUTPUT IOT + MOVEM B,SRN3(U) + HRLZ T,A ;JOB INDEX + HRR T,JBCUI(A) ;CREATOR'S USER INDEX + PUSHJ P,CWAIT ;WAIT FOR CREATOR TO IOT, RETURN WITH CLKOFF + PUSHJ P,BJWAIT + PUSHJ P,BJUI1 + JRST CLKONJ + +BJUI1: MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJUIB ;BLOCK MODE CREATOR IOT + LDB D,[.BP (%JBSIOT),JBWST(A)] + JUMPN D,BJUIS + MOVE W,AC0S+W(T) + JRST BJIUNH ;SUCCESSFUL + +;BOJ UNIT INPUT FROM JOB SIOT +BJUIS: PUSHJ P,BJBINI + XCTRI XBYTE,[ILDB W,(B)] + SKIPA C,AC0S+C(T) + BUG + XCTR XRW,[SOSG (C)] + JRST BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT +BJUIB: PUSHJ P,BJBINI + SKIPL JBSTS(A) + JRST BJUIBA + XCTRI XR,[MOVE W,(D)] + CAIA + BUG + ADD D,[1,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + JUMPGE D,BJIUNP + JRST PLDZ + +;BOJ UNIT INPUT FROM JOB BLOCK IOT, ASCII MODE +BJUIBA: LDB E,[410300,,D] ;CHAR COUNT + MOVEI W,0 + CAIGE E,3 + JRST BJIUNP + XCTRI XR,[MOVE W,(B)] + SKIPA E,BTOCHT-3(E) + BUG + ILDB W,E + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] + XCTRI XW,[MOVEM D,(B)] + CAIA + BUG + TLNN D,700000 + JRST BJIUNP + JRST PLDZ + +;BOJ DEVICE BLOCK MODE INPUT +BJBI: SKIPGE JBCG(A) + POPJ P, ;EOF + XCTR XRW,[MOVES D,(C)] ;D GETS IOT POINTER + LDB B,[410300,,D] + CAIGE B,3 + POPJ P, + HLRO E,D + IORI E,700000 ;FLUSH CHAR CNT + HRRZ T,D + SUB T,E + CAILE T,-1 + JRST IOADC ;DON'T WRAP AROUND + MOVE B,[SETZ 1] + PUSHJ P,BJBWT ;WAIT FOR JOB OUTPUT IOT, COME BACK WITH CLK OFF + JRST CLKONJ ;UNHANG + MOVEI I,0 ;FOR BJBB + MOVE TT,JBSTS(A) + TLNE TT,200000 + JRST BJBB ;CREATOR IOT IS IN BLOCK MODE + PUSH P,C + PUSH P,D + PUSHJ P,BJUI1 ;GET DATA OUT OF CREATOR UNIT MODE IOT + POP P,D + POP P,C + MOVE H,W + MOVEI T,BJBI + JUMPGE TT,BJBIA ;ASCII + XCTRI XW,[MOVEM H,(D)] + CAIA + BUG + ADD D,[1,,1] + JRST BJBIX + +;BOJ BLOCK ASCII INPUT STORE CHAR +BJBIA: LDB E,[410300,,D] + CAIGE E,3 + JRST CLKONJ + XCTRI XR,[MOVE W,(D)] + SKIPA E,BTOCHT-3(E) + BUG + IDPB H,E + XCTRI XW,[MOVEM W,(D)] + CAIA + BUG + ADD D,[700000,,] + TLNN D,500000 + ADD D,[500001,,1] +BJBIX: MOVEI T,BJBI + XCTRI XW,[MOVEM D,(C)] + JRST BJBEX + BUG + +BJOV: BJBI + BJBO + +;BOJ BLOCK IOT TO/FROM JOB BLOCK IOT +BJBB: MOVE J,T + HRLI J,%UMALL ;UMAPS FOR PURELY CREATOR IOT + MOVEM J,SRN4(U) +BJBBL: MOVE J,SRN4(U) + PUSHJ P,PLD1 + MOVE E,SRN3(T) + XCTRI XRW,[MOVES H,(E)] + CAIA ;H HAS JOB BLOCK IOT POINTER + BUG + PUSHJ P,PLDZ + XCTRI XRW,[MOVES D,(C)] + CAIA ;D HAS BOJ BLOCK IOT POINTER + BUG + JUMPGE H,[PUSHJ P,BJIUNH + MOVE T,BJOV(I) + JRST BJBEX] + JUMPGE D,CLKONJ + HLRE B,H + CAML D,H + HLRE B,D ;CHOOSE SMALLER OF TWO BLOCK SIZES + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,H ;JOB ADDRESS + HRR E,D ;JOB,,BOJ (FROM,,TO FOR BOJ INPUT) + HLRZ Q,E ;JOB ADDRESS + CAIGE Q,20 + JRST BJBB1 ;JOB ADDR IS AN AC + HRRZ J,T ;SET UP UMAPS (JOB USER INDEX IN RH) + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LO PAGE + TLO J,%UMMPU ;TO LO PG, HACK OUR HI PAGE + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER FROM OUR LOWER? + JRST BJBB3 ;YES. MAKE SURE NOT SCREWED BY AC PNTR +BJBB3A: PUSHJ P,PLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q ;AND DIST OF FROM ADR FROM SEG BOUNDARY + HRRZ B,Q + MOVNI Q,(E) ; - BOJ ADDR + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET JOB ADDR TO HI SEG + TRO E,400000 ;SET BOJ ADDR TO HI SEG + SKIPE I + MOVSS E ;XFER OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT POINTER + ADDI B,(E) ;GET LA + 1 + XCTRI XBRW,[BLT E,-1(B)] ;XFER DATA + HRRZS E,B ;NO FAULT. SIMULATE STORE BACK OF POINTER (CAN BE 1,,0) + PUSH P,J + PUSHJ P,PLDZ + SUBM E,Q +BJBB2: HRLS Q ;NUMBER OF WORDS ACTUALLY XFERRED IN BOTH HALVES + XCTRI XRW,[ADDM Q,(C)] ;UPDATE BOJ BLK PNTR + JRST .+2 + BUG + MOVE J,SRN4(U) + PUSHJ P,PLD1 ;MAP TO CREATOR + POP P,J + MOVE W,SRN3(T) + XCTRI XRW,[ADDM Q,(W)] ;UPDATE JOB BLK PNTR + JRST .+2 + BUG + CAIN B,(E) + JRST BJBBL ;NO FAULT, LOOP BACK + PUSHJ P,PLD1 ;RESTORE TO FROB AT TIME OF FAULT +BJBBF: PUSHJ P,TPFLT ;TAKE FAULT (TURNS CLK ON) + PUSHJ P,MPLDZ ;RESTORE NORMAL MAP + JRST @BJOV(I) ;RESTART THE IOT + +;JOB ADDR IS AN AC +BJBB1: ADDI Q,UUOACS(T) + JUMPN I,BJBB1A + MOVE B,(Q) ;READ JOB WORD +BJBB3C: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST BJBBF +BJBB2A: MOVEI Q,1 ;1 WORD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + PUSH P,J + JRST BJBB2 + +BJBB1A: XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST BJBBF + MOVEM B,(Q) + JRST BJBB2A + +BJBB3: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST BJBB3A ;NO. OK TO DO BLT + JUMPN I,BJBB3B + HRLI J,%UMALL ;HACK OUR HI TO POINT TO HIS HI + PUSHJ P,PLD1 + XCTRI XR,[MOVE B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + HRRZ E,D ;TO ADDRESS + JRST BJBB3C + +BJBB3B: XCTRI XR,[MOVE B,(D)] + JRST .+2 + JRST BJBBF + HRLI J,%UMALL + PUSHJ P,PLD1 ;HACK OUR HI TO POINT TO HIS HI + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + BUG + PUSHJ P,PLDZ + JRST BJBB2A + +;.CALL JOBGET +;ARG 1 - BOJ CHNL +;UP TO SIX WDS RETURNED +;WD1 BITS: +%JG==1,,525252 + ;4.9-4.7 => IMAGE/ASCII, BLOCK/UNIT, OUTPUT/INPUT + ; 4.9-4.7 SHOULDN'T BE USED, SINCE THE FULL MODE IS IN WD7 ON AN OPEN +%JGCLS==40000 ;4.6 => CLOSE (NOTE 4.5 USED TO BE A CLS BIT ALSO) +%JGSIO==1000 ;4.1 => SIOT (ONLY IF OPCODE = 1) +%JGFPD==200 ;3.8 => THIS CALL WAS PCLSRED AND IS RESTARTING +;1.4-1.1 => TYPE OF OPERATION +%JO==,,-1 +%JOOPN==0 ;OPEN +%JOIOT==1 ;IOT/SIOT +%JOLNK==2 ;MLINK +%JORST==3 ;RESET +%JORCH==4 ;RCHST +%JOACC==5 ;ACCESS +%JORNM==6 ;FDELE (DELETE OR RENAME) +%JORWO==7 ;FDELE (RENAME WHILE OPEN) +%JOCAL==10 ;SYMBOLIC .CALL + +;WD2 SET ONLY FOR BLOCK IOT POINTER, ACCESS POINTER, NEW FN1 FOR FDELE +;WD3 FN1 +;WD4 FN2 +;WD5 SYS NAME +;WD6 LEFT ADJUSTED DEVICE NAME +;WD7 NEW FN2 FOR FDELE. +;IGNORE ALL RETURNED INFO ON AN ERROR RETURN +;IF 4.5 OR 4.6 IS SET THEN ALL ELSE IS MEANINGLESS + +NJBGT: SETZM T ;INDICATE JOBGET, NOT JOBCAL +NJBCL0: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT A BOJ CHANNEL => WRONG TYPE DEVICE + JRST OPNL34 + CONO PI,CLKOFF + MOVE C,JBWST(E) + TLNN C,%JBVAL + JRST NJBGTE ;FAIL IF VALID NOT SET + TLZ C,%JBSTR + MOVEM C,JBWST(E) ;CLEAR STORED BIT + MOVE B,JBCUI(E) + MOVE B,SUUOH(B) + CONO PI,CLKON + MOVE A,JBSTS(E) + TLZ A,077777 ;FLUSH RANDOM BITS FROM LH + TLNE B,%PCFPD + TLO A,%JGFPD + TLNE C,%JBSIOT + TLO A,%JGSIO + JUMPN T,NJBCL1 ;BRANCH IF JOBCAL +NJBGT0: MOVE B,JBST2(E) + MOVE C,JBOFN1(E) + MOVE D,JBOFN2(E) + MOVE TT,JBODEV(E) + MOVE I,JBNFN2(E) + MOVE E,JBOSYN(E) + CONO PI,CLKON + JRST POPJ1 + +NJBGTE: SKIPL JBCG(E) ;HAS CREATOR GONE AWAY? + JRST OPNL36 ;NO, VALID CLEAR + CONO PI,CLKON ;YES, GIVE CLOSE + MOVSI A,%JBLOS + IORM A,JBWST(E) + MOVSI A,%JGCLS ;GIVE CLOSE BITS + JRST POPJ1 ;DON'T GIVE ANYTHING ELSE WHETHER JOBGET OR JOBCAL + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBCAL/ +; [BOJCHNL] +; [-N,,ADR OF DATA BUFFER] ;OPTIONAL +; SETZM OPCODE +; OPCODE WILL BE THE SAME AS RETURNED IN WD1 BY JOBGET +; IF OPCODE<10 THEN WD2-WD7 OF JOBGET WILL BE WRITTEN INTO DATA BUFFER +; FOLLOWED BY JOB'S EPDL AND EPDL3 (THE BPS FOR BP-STYLE OPENS, ETC). +;IF OPCODE=10 THEN JOB'S LAST .CALL WILL BE DESCRIBED: +; WORD 1 OF DATA BUFFER => SIXBIT OF OPERATION (I.E. THE NAME +; OF THE .CALL) +; WORD 2 OF DATA BUFFER => FLAG BITS OF .CALL +; WORD 3 OF DATA BUFFER => # OF ARGS TO .CALL +; WORDS 4-12 => INPUT ARGS TO .CALL + +NJBCL: CAIL W,2 ;DID CALLER SUPPLY AOBJN POINTER? + SKIPN T,B ;IF SO AND NON-ZERO USE IT + MOVEI T,1 ;OTHERWISE SET T NONZERO + JRST NJBCL0 ;GO JOIN JOBGET CODE FOR ERROR CHECKING + +NJBCL1: JUMPGE T,POPJ1 ;BACK FROM JOBGET - ANY AOBJN PNTR? + MOVEI C,9 ;YES - OPCODE 10? + TRNN A,10 + JRST NJBCL2 ;NO - JUST COPY 9 STANDARD ARGS + HLRE D,T ;GET LENGTH OF USERS DATA BUFFER + MOVE B,JBCUI(E) ;GET JOB'S USER INDEX + MOVE C,LSCALL(B) ;GET NAME OF JOB'S LAST CALL + UMOVEM C,(T) ;PUT INTO CALLERS BUFFER + AOJE D,POPJ1 ;IF NO MORE ROOM - DONE + MOVE C,CTLBTS(B) ;GET USER'S .CALL FLAG BITS + UMOVEM C,1(T) + AOJE D,POPJ1 + LDB C,[230400,,JBSTS(E)] ;GET # OF ARGS + UMOVEM C,2(T) + JUMPE C,POPJ1 ;ANY ARGS TO PASS? + ADD T,[3,,3] ;YES - COPY INTO BUFFER +NJBCL2: JUMPGE T,POPJ1 ;ANY ROOM LEFT? + MOVNS C ;GET SMALLEST WORD COUNT + HLRE B,T + CAMLE C,B + HRL T,C ;MAKE AOBJN PNTR AS SMALL AS POSSIBLE + MOVE H,E ;JOB INDEX IN H FOR USING JBACTB + MOVEI B,JBACTB ;GET PNTR TO ARG TABLES +NJBCL3: MOVE C,@(B) ;GET NEXT ARG + UMOVEM C,(T) ;GIVE TO CALLER + AOS B + AOBJN T,NJBCL3 + JRST POPJ1 ;DONE - GO SKIP + +; .CALL ADR +; ERROR RETURN +; NORMAL RETURN + +;ADR: SETZ +; SIXBIT /JOBRET/ +; [BOJCHNL] +; [OPEN LOSS #(IF RH = 0),,# TIMES FOR CREATING JOB TO SKIP] +; SETZ [-N,,ADR OF DATA BUFFER] + +;RETURN DATA (E.G. RETURN TO RCHST,STATUS OR THE RETURN ARGS TO A .CALL) +;WILL BE COPIED FROM THE CALLER'S DATA BUFFER + +NJBRT: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD + TLNN R,%CLSBJ ;NOT BOJ CHNL => WRONG TYPE DEVICE. + JRST OPNL34 + CAIGE W,3 ;RETURN ARGS PROVIDED? + SETZM C ;NO - ZERO IT + JUMPGE C,NJBRT1 ;DO NOTHING IF NO RETURNS OR NO AOBJN + HLRE D,C ;GET LENGTH OF BUFFER + CAMGE D,[-8.] ;MAKE SURE AREA AT MOST 8 LONG + MOVNI D,8 ;OVER 8 - USE 8 + HRL C,D ;FIX AOBJN PNTR + MOVMS D + ADDI D,-1(C) ;GET ADDRESS OF LAST WORD NEEDED + XCTR XR,[SKIP (C)] ;MAKE SURE PAGES ARE IN + XCTR XR,[SKIP (D)] +NJBRT1: CONO PI,CLKOFF ;NOW OK TO TURN CLOCK OFF + MOVE A,JBWST(E) + TLNE A,%JBVAL + TLNE A,%JBSTR + JRST OPNL36 ;FAIL IF STORED IS SET OR IF VALID IS CLEARED + SKIPGE JBCG(E) + JRST OPNL41 + HRRZ TT,JBCUI(E) + MOVE D,FLSINS(TT) + CAME D,JBFLS + BUG + TLO A,%JBWIN + TLZ A,%JBVAL+%JBSTR + MOVEM A,JBWST(E) ;SET SUCCESSFUL JOBRET BIT, CLEAR VALID AND STORED + DPB B,[350400,,JBSTS(E)] ;NUMBER OF TIMES TO SKIP + MOVSS B + DPB B,[270600,,JBSTS(E)] ;OPEN LOSS + MOVSI B,-6 ;DEFAULT # WDS TO RETURN FOR .RCHST IS 6. + MOVEM B,JBAC11(E) + JUMPGE C,NJBRT3 ;ANY RETURN ARGS? + MOVEM C,JBAC11(E) ;REMEMBER HOW MANY, FOR .RCHST TO RETURN THAT MANY. + MOVE H,E ;YES - COPY THEM + MOVEI D,JBACTB +NJBRT2: XCTRI XR,[MOVE B,(C)] ;GET IT + AOSA D + BUG ;PAGE IS TIED - NO? + MOVEM B,@-1(D) ;PUT INTO ARG TABLE + AOBJN C,NJBRT2 +NJBRT3: SETZM FLSINS(TT) ;RESTART CREATOR + JRST CLKOJ1 + +;JOB DEVICE CLOSE ROUTINE +JOBCLS: SETOM JBCG(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBINT ;INTERRUPT POOR BOJ GUY + JRST CLKONJ ;SINCE HE HAS NO CREATOR + +; ROUTINES FOR JOB ACCESS, RFPNTR, RESET, AND STATUS + +RFPJOB: MOVEI J,4 ;USE OLD .RCHST OPERATION, OPCODE 4 + HRRM J,JBSTS(A) + MOVE E,A + CONO PI,CLKOFF + PUSHJ P,JBWT ;SIGNAL JOB, WAIT FOR ANSWER + HLRE TT,JBAC11(E) ;GET # VALUES RETURNED + MOVNS TT + CAIL TT,5 + SKIPA A,JBODEV(E) ;GET ACCESS POINTER RETURNED + SETO A, ;NO ACCESS POINTER RETURNED, USE -1 + CAIL TT,6 ;UP TO TWO MORE EXTRA RCHST RESULTS MIGHT BE RETURNED + MOVE Q,JBNFN2(E) + CAIL TT,7 + MOVE I,JBAC7(E) + CAIL TT,5 + MOVEI W,1(TT) ;# RESULTS FOR RCHST + MOVEI B,36. ;ALWAYS RETURN 36. AS BYTE SIZE UNTIL MORE WINNING + JRST POPJ1 ;CONVENTIONS EXIST. + +JBSTAT: HLRZ A,(R) ;GET JOB INDEX + HRRZ D,JBWST(A) ;GET MOST RECENT STATUS + POPJ P, + +JBORS: +JBIRS: MOVEI D,3 ;RESET IS OPCODE 3 + HLRZ A,(R) + HRRM D,JBSTS(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT ;WAIT FOR IT TO GET PROCESSED + POPJ P, + +JBACCS: MOVEI D,5 ;ACCESS IS OPCODE 5 + HLRZ A,(R) + HRRM D,JBSTS(A) + MOVEM B,JBST2(A) + CONO PI,CLKOFF + MOVE E,A + PUSHJ P,JBWT + JRST POPJ1 + +;.CALL JOBIOC (OLD NAME SETIOC STILL WORKS) +;ARG1: CHANNEL BOJ DEVICE IS OPEN ON +;ARG2: TYPE OF IOCER TO CAUSE + +;THIS CALL CAUSES THE NEXT IOT EXECUTED BY THE +;PROCEDURE ON THE OTHER END OF THE CHANNEL TO GET +;THE SPECIFIED IO CHANNEL ERROR + +NSTIOC: HLRZ E,H ;GET JOB CHNL IDX FROM LH OF IOCHNM WD. + CAIL B,MIOTER + CAILE B,NIOTER + JRST OPNL33 ;BAD ARG. (NOT LEGAL IOCER) + TLO B,(SETZ) ;IN CASE IOCER 0 EVER EXISTS + TLNN R,%CLSBJ + JRST OPNL34 ;NOT BOJ CHANNEL + CONO PI,CLKOFF + MOVE A,JBCUI(E) ;PREPARE TO STOP CREATOR. + SKIPGE JBCG(E) + JRST OPNL41 ;CREATOR WENT AWAY + MOVE H,APRC(A) + TLNE H,BULGOS + JRST OPNL41 ;HE'S BEING KILLED NOW. + PUSHJ P,RPCLSR ;STOP + MOVEM B,JBIOCJ(E) + AOS (P) + JRST UPCLSR + + +;.CALL JOBSTS +;ARG1 - CHANNEL BOJ IS OPEN ON - REMAINING ARGS ARE OPTIONAL - +;ARG2 - NEW STATUS (RIGHT HALF OF STATUS WORD ONLY - I.E. DEVICE DEPENDENT STUFF) +;ARG3 - NEW DEVICE NAME FOR PEEK, WHO-LINE STATUS, RFNAME/RCHST +;ARG4 - NEW FN1 FOR .. +;ARG5 - NEW FN2 FOR .. +;ARG6 - NEW SNAME FOR .. +;ARG7 - NEW OPEN MODE FOR .. +;ARG8 - BP TO ASCIZ STRING IN USER ADDRESS SPACE CONTAINING FULL FILENAMES. + +NJBSTS: TLNN R,%CLSBJ + JRST OPNL34 + HLRZ A,(R) ;GET JOB INDEX + CAIGE W,2 ;DID HE SUPPLY STATUS? + MOVEI B,SNJOB ;NO - RESET TO INITIAL + HRRM B,JBWST(A) ;REMEMBER WHAT HE SAYS + MOVEI B,8 + SUB B,W + JUMPGE B,.+1(B) ;STORE WHATEVER ADDITIONAL ARGS WERE GIVEN + JSP B,NJBST2 ;8 + JSP B,NJBST1 ;7 + MOVEM TT,JBSYS(A) ;6 + MOVEM E,JBFN2(A) ;5 + MOVEM D,JBFN1(A) ;4 + MOVEM C,JBDEV(A) ;3 + JRST POPJ1 ;2 + JRST POPJ1 ;1 (DON'T TAKE THIS INSN OUT) + +NJBST1: XOR I,JBOPNM(A) + TRNE I,.BAO#.UAI + JRST OPNL12 ;NOT ALLOWED TO CHANGE BLOCK VS UNIT, IN VS OUT + XORM I,JBOPNM(A) + JRST (B) + +NJBST2: MOVE R,Q ;STORE BP IN Q INTO JBFNP WORD, + PUSHJ P,ASCIND ;AFTER DOING INDEXING AND INDIRECT. + MOVEM R,JBFNP(A) + JRST (B) + +; .CALL ADR ;SKIPS UNLESS JOB END OF CHNL NOT THERE + +;ADR: SETZ +; SIXBIT /JOBINT/ +; 401000,,BOJCH + +;GIVE CREATOR A SECOND WORD INT ON CHANNEL CORRESP TO BOJCH + +NJBINT: TLNN R,%CLSBJ ;ERROR IF NOT BOJ CHNL. + JRST OPNL34 + CONO PI,CLKOFF + HLRZ E,H + SKIPGE JBCG(E) + JRST OPNL41 + MOVE A,JBCUI(E) + MOVSI D,%CLSJ + SETZ C, + PUSHJ P,CHSCAA + PUSHJ P,[HRRZ B,(R) + SKIPGE R ;IOPDL CHNLS DON'T INTERRUPT + TDNN D,CLSTB(B) + POPJ P, + HRRZ B,R + SUBI B,IOCHNM(A) + IOR C,CHNBIT(B) + POPJ P,] + AND C,MSKST2(A) + JUMPE C,OPNL41 ;I CAN'T + MOVN B,C + AND C,B ;INT ONLY ONCE, ON HIGHEST NUMBERED CHANNEL + IORM C,IFPIR(A) + JRST CLKOJ1 + + +;.CALL JOBREU +;ARG 1 - SIMULATED DEVICE NAME +;ARG 2 - FN1 OF .. +;ARG 3 - FN2 OF .. +;ARG 4 - SNAME OF FILE WHICH HANDLER LOADED FROM +;ARG 5 - AMOUNT OF TIME TO SLEEP WAITING FOR SOMEONE TO OPEN + +;THIS CALL, WHEN EXECUTED BY A JOB DEVICE HANDLER JOB, MAKES +;THE HANDLER AVAILABLE FOR RE-USE. TAKES SUCCESS RETURN IF +;SOMEONE REUSES YOU; YOU SHOULD THEN DO THE "INITIAL JOBGET" + +NJBREU: SKIPGE H,JBI(U) + JRST OPNL10 ;NOT A BOJ HANDLER JOB + SKIPL JBCG(H) + PUSHJ P,UFLS ;WAIT FOR CLOSE TO FINISH HAPPENING + MOVEM A,JBODEV(H) + MOVEM B,JBOFN1(H) + MOVEM C,JBOFN2(H) + MOVEM D,JBOSYN(H) + TLNE E,1000 + JRST [ MOVNI E,(E) ;IMMEDIATE TIME, LOSE ON PCLSR + SUB E,TIME ;BUT ACCEPT ANYWAY SINCE NETBLK DOES + JRST NJBRU1 ] + MOVE TT,E + UMOVE E,(TT) ;GET TIME ARGUMENT + JUMPL E,NJBRU1 + MOVNS E + SUB E,TIME + UMOVEM E,(TT) ;POS REL TIME GIVEN, MAKE NEG ABS AND WRITE BACK +NJBRU1: MOVSI TT,%JBREU ;E NOW HAS NEGATIVE TIME TO SLEEP UNTIL + IORM TT,JBWST(H) + PUSHJ P,LOSSET + NJBRUL ;TURN OFF %JBREU WHEN CALL EXITED FOR WHATEVER REASON + SKIPA T,H + PUSHJ P,NJBRUW + PUSHJ P,UFLS + SKIPGE JBCG(H) + JRST OPNL41 ;TIMED OUT + JRST LSWPJ1 + +;FLSINS ROUTINE TO WAIT UNTIL TIMED OUT OR OPENED BY SOMEONE +NJBRUW: MOVN A,AC0S+E(U) + CAML A,TIME + SKIPL JBCG(T) + AOS (P) + POPJ P, + +;LOSSET ROUTINE TO LEAVE AWAITING-REUSE STATE +NJBRUL: MOVSI A,%JBREU + MOVE T,AC0S+H(U) + ANDCAM A,JBWST(T) + POPJ P, + +SUBTTL PERIPHERAL DEVICE ROUTINES IN SEPARATE FILES + +IFN NMTCS,[ + IFN TM10P,[ +$INSRT MTAPE + ] + IFN TM03S,[ +$INSRT NMTAPE +] +] +IFN NUNITS,[ +$INSRT UTAPE +] + +$INSRT DISK + +IFN NETP,[ ; General ITS network code, includes specific nets +OVHMTR NET +$INSRT NET +] + +IFN E.SP,[ +$INSRT ITSDIS +] + +IFN MSPP,[ +$INSRT ITSMSP +] + +$INSRT TS3TTY + +$INSRT ITSDEV + +.BYTE 0 ;RECORD THE SYMS .EVAL'ED BY USER PROGRAMS +$INSRT EVSYMS +.BYTE + +SUBTTL DM DAEMON UUO'S + +IFE DEMON,ADEMON==ILUUO + +IFN DEMON,[ +ADEMON: JUMPE J,[AOJA J,.+2] ;IF J = 0 THEN SUBTRACT ONE + UMOVE J,(J) ;GET VALUE HERE + PUSHJ P,LSWTL + 400000,,DEMSW + PUSHJ P,DEMUSR ;FIND CURRENT USER IN DEMON TABLE + JRST UTOLKJ ;FAIL, JUST RETURN, NOT DEMON + HRRE TT,DMTTBL+2(B) + SUB TT,J + HRRM TT,DMTTBL+2(B) ;PUT NEW COUNT IN DEMON TABLE + SKIPLE TT +UTOLJ1: AOS (P) +UTOLKJ: CONO PI,UTCON + JRST LSWPOP + +ADEMSIG:MOVE D,B + CONO PI,CLKOFF ;DON'T LET SYS JOB LOOK TILL WE'RE READY. + MOVSI T,SCLDMN ;TELL IT TO LOOK FOR US, AFTER UFLS TURNS CLOCK ON. + IORM T,SUPCOR + SETZB T,SRN3(U) ;SYS JOB WILL SETOM SRN3 TO RESTART US + SKIPN SRN3(U) ;WITH 0 IN T => FILE EXISTS, OR OPNL CODE. + PUSHJ P,UFLS ;SYS JOB DETECTS US BY PC=ADEMS1. + ;DEMON NAME IS EXPECTED TO BE IN A. +ADEMS1: JUMPN T,OPNL1-1(T) + CAIGE W,2 ;NO SECOND ARG, JST SIGNAL + JRST ADEMS3 + JUMPL D,NUDMTB ;IF 2ND ARG < MERELY CALL NUJBST, NO DEMON ENTRY + TDZA TT,TT ;ZERO OUT TT +ADEMS3: SETOM TT ;SET FLAG + PUSHJ P,LSWTL ;SIEZE SWITCH + DEMSW + PUSHJ P,DEMSIG + JRST LSWPOP ;SIGNAL FAILED + SKIPN TT ;FLAG NOT SET + HRLM D,DMTTBL +2(B) ;SET TIME RQ + JRST CKOPJ1 ;RELEASE SWITCH + +NUDMTB: PCLT + PUSHJ P,DMBLK1 ;WAIT TILL DEMON BLOCK IS CLEARED + PUSHJ P,UFLS + HRROI T,DMBLK + MOVEM A,DMBLK ;SAVE IN BLOCK NOW + PUSHJ P,NUJBST + JRST NUDMTB ;IF FAILURE AFTER WAIT LOOP BACK + JRST POPJ1 ;SUCCESS + +DMBLK1: SKIPGE DMBLK+1 ;FOR DEMON BLOCK TEST + POPJ P, ;RETURN, NOT FINISHED LOADING + MOVE T,UTTYCT + CAIGE T,MXCZS ;ROOM IN RING BUFFER + AOS (P) + POPJ P, ;SKIP IF ROOM + ;UTILITY ROUTINES FOR DEAMONS + +DEMSIG: PUSHJ P,DEMNAM ;LOOK FOR NAME + JRST DEMSG2 ;HAVE TO MAKE NEW ENTRY +DEMSG1: AOS (P) + HLLZ E,DMTTBL+2(B) ;18 BITS 2'S COMPLEMENT + AOS DMTTBL+2(B) + HLLM E,DMTTBL+2(B) ;MUST DO THIS WAY TO FIT ABOVE + SKIPE DMTTBL+1(B) ;DOWN, WANT SYS JOB TO LOOK AT + POPJ P, + MOVSI E,SCLDMN + IORM E,SUPCOR + AOS REQCNT ;ONLY SIGNAL IF NECESSARY + POPJ P, + +DEMSG2: SOSGE DEMCNT ;IF NO ROOM FLUSH + POPJ P, + PUSH P,A + MOVEI A,DMTLL ;BUMP POINTER + ADDB A,DMTPTR + IDIVI A,DMLNG ;TRUNCATE TO LENGNTH OF TABLE + SKIPE DMTTBL(B) + JRST .-4 ;SEARCH FOR NEW ENTRY + POP P,DMTTBL(B) ;SET NAME IN TABLE + JRST DEMSG1 + +;ROUTINES TO FIND ENTRY IN TABLE. +;DEMNAM TAKES NAME IN A, DEMUSR TAKES USER INDEX IN U +;THEY SKIP RETURN IF SUCCESSFUL, RETURN OTHERWISE +;IF SUCCESSFUL DEMON TABLE INDEX IS IN B + +DEMUSR: JUMPL U,CPOPJ + MOVSI B,-DMLNG + CAMN U,DMTTBL+1(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMNAM: MOVSI B,-DMLNG ;SEARCH BY NAME + CAMN A,DMTTBL(B) + JRST POPJ1 + ADD B,[DMTLL,,DMTLL] + JUMPL B,.-3 + POPJ P, + +DEMOUT: PUSHJ P,LSWTL ;CALLED BY KILLING JOB (IN CASE OWNED) + 400000,,DEMSW + PUSHJ P,DEMUSR + JRST UTOLKJ + SETZM DMTTBL+1(B) ;MARK AS DOWN,SYSTEM JOB DECIDES WHAT TO DO + AOS REQCNT + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLKJ + +DEMMRV: SETZM DMTTBL+2(B) ;CALL WITH UTCOFF (SYS JOB) REMOVES ENTRY FROM TBL + SETZM DMTTBL+3(B) ;WITH INDEX OF DEMON IN B + SETZM DMTTBL(B) + MOVEI B,1 + AOSGE DEMCNT + MOVEM B,DEMCNT + JRST UTCONJ + + +;DEAMON READ AND SET STATUS ROUTINES + +ARDDMST: PUSHJ P,LSWTL ;READ DEAMON STATUS + DEMSW + PUSHJ P,DEMNAM + JRST RDDMS1 ;LOST TRY USER INDEX + MOVE A,DMTTBL+1(B) + MOVEI C,L + IDIVM C,A ;DIVIDE BY L, DON'T CLOBBER B +RDDMS2: MOVE C,DMTTBL+3(B) + MOVE B,DMTTBL+2(B) + PUSHJ P,LSWPOP + JRST POPJ1 + +RDDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR ;BAD USER + JRST LKUPOP + POP P,U + MOVE A,DMTTBL(B) + JRST RDDMS2 +LKUPOP: POP P,U + JRST LSWPOP + +ASTDMST: PUSHJ P,LSWTL ;SET DEAMON STATUS + 400000,,DEMSW + MOVE D,B + PUSHJ P,DEMNAM + JRST STDMS1 +STDMS2: JUMPL D,STDMS4 +STDMS3: SOSLE W + MOVEM D,DMTTBL+2(B) + SOSLE W + MOVEM C,DMTTBL+3(B) + JRST UTOLJ1 +STDMS1: PUSH P,U + MOVE U,A + PUSHJ P,DEMUSR + JRST UTULKP + POP P,U + JUMPGE D,STDMS2 +STDMS4: SKIPGE DMTTBL+1(B) ;REMOVE FROM TABLE IF POSSIBLE + JRST UTOLKJ ;CAN'T DELETE, LOADING + SETZM DMTTBL+1(B) ;DOWN + SETZM DMTTBL+2(B) ;REMOVE REQUESTS + AOS REQCNT ;SIGNAL SYS JOB + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST UTOLJ1 +UTULKP: POP P,U + JRST UTOLKJ +] + + +SUBTTL .GETSYS UUO + +;.GETSYS AC, ;TRANSFERS SYSTEM AREA SPECIFIED BY C(AC+1) + ;TO USER AREA STARTING AT R.H. C(AC) OF LENGTH MINUS L.H. C(AC) + +AGETSYS: +; Alan 4/2/86: Took this out because people don't use .GETSYS this way +; anymore: +; PUSHJ P,UDELAY ;CAUSE A SCHEDULE TO STOP GETSYSER FROM +; ; MONOPOLIZING SYSTEM + MOVSI A,-LGSNAM ;NEGATIVE OF TABLE LENGTH + UMOVE B,1(J) ;LOOK AT USERS AC+1, THE 6BIT NAME + CAME B,GSNAME(A) ;CYCLE THROUGH TABLE + AOBJN A,.-1 ;OF NAMES, POINTER IN RIGHT HALF OF A + JUMPGE A,AGETSL ;JUMP IF NOT IN TABLE + UMOVE B,(J) ;GET POINTER TO USERS RECEPTACLE BLOCK +AGETS1: HLRZ C,GSYS1(A) ;GET LOW END OF BLOCK + HRRZS A ;CLEAR COUNT IN L.H. OF A + CAIGE A,NUTCFN ;SKIP IF UTC OFF NOT REQUIRD + CONO PI,UTCOFF ;TURN OFF ALL CHANNELS BUT CH 1 + skipn c ; If LH contains 0, RH is routine to call. + jrst @gsys1(a) ; (JUMPE C,@GSYS1(A) generates spurious + ; page faults, so don't "fix" this.) + HRRZ D,GSYS1(A) ;GET HIGH END OF BLOCK +;AT THIS POINT: ;B USER'S POINTER (UNRELOCATED) + ;C BEGINNING OF AREA IN SYS + ;D END OF AREA +agets2: SUBI D,-1(C) ;BLOCK LENGTH TO BE SENT + HLRZ E,B ;GET NEG BLK LENGTH FROM USERS PNTR + ADDI E,-1(D) ;-1 CAUSES CARRY BIT IF .GT. + TLNE E,-1 ;CARRY INDICATES LOSS + JRST AGETS5 ;MORE THAN USER WANTS + HRLS D ;BLOCK LENGTH IN BOTH HALVES + HRRZ E,B ;FIRST WORD (UNRELOCATED) + HRL E,C ;SOURCE ADDRESS FOR BLT + HRRZ C,E ;DESTINATION INTO C + ADD C,D ;FINAL ADDRESS +1 +AGETS7: XCTRI XBW,[BLT E,-1(C)] ;BLT IT TO HIM + AOSA (P) ;INCREMENT RETURN, INDICATE SUCCESS + JRST AGETS6 + CONO PI,UTCON + ADD B,D + UMOVEM B,(J) ;TELL USER HOW MUCH HE GOT +AGETS4: POPJ P, + +AGETSL: XCTR XW,[SETZM 1(J)] ;INDICATE BAD SIXBIT + POPJ P, + +AGETS5: MOVNS D ;TELL USER HOW MUCH HE NEEDS + CONO PI,UTCON ;NEGATIVE OF RIGHT BLOCK LENGTH + XCTR XRW,[HRLM D,(J)] ;SET UP PROPER BLOCK LENGTH IN HIS AC + JRST AGETS4 + +AGETS6: CONO PI,UTCON ;ONE PAGE WASN'T THERE + XCTR XRW,[MOVES (E)] ;SO TOUCH IT (TAKE MPV INTERRUPT IF REAL MPV) + JRST AGETS1 ;AND TRY AGAIN (BLT WILL GET FARTHER THIS TIME) + ;HAD TO RETRY FROM BEGINNING SINCE THIS MAY BE + ;ONE THAT HAS TO BE TRANSFERRED INTACT WITH UTCOFF + +GSNAME: SIXBIT /MEMORY/ +IFN NUNITS,SIXBIT /UTAPE/ +IFN NCPP,[SIXBIT /NCPSM/ + SIXBIT /NCPPQ/ + SIXBIT /NCPHT/ +] +NUTCFN==.-GSNAME ;NUMBER TO GET WITH UTCOFF (same as NETOFF) + SIXBIT /USERS/ + SIXBIT /USER/ + SIXBIT /GETS/ + SIXBIT /DEVS/ + SIXBIT /CALLS/ +IFN IMXP, SIXBIT /IMPX/ + SIXBIT /CLINK/ + SIXBIT /DSYMS/ + SIXBIT /USYMS/ ;.UPC, .VAL, .TTY, ETC. + SIXBIT /CHDEVS/ + SIXBIT /NCALLS/ + SIXBIT /TTYVAR/ + SIXBIT /USRVAR/ + SIXBIT /ITSNMS/ +LGSNAM==:.-GSNAME + +;ENTRIES ARE: BOTTOM,,TOP OF AREA TO BE TRANSMITTED OR INST TO EXECUTE +GSYS1: IOBFTL,,EMEMTL ;lh zero => jrst to THIS ENTRY +IFN NUNITS, UTCHNT,,UTCHE ;UTAPE +IFN NCPP,[IMSOKB,,IMSOKE ;NCP SOCKET MAP + IMPBPQ-1,,IMPEPQ ;NCP PENDING RFC QUEUE + IMPHTB,,IMPHTB+255. ;NCP HOST TABLE +] + 0,,USRSV ;USERS + 0,,USR1V ;USER + GSNAME,,GSNAME+LGSNAM-1 ;GETS + DEVTAB,,EDEVS ;DEVS + SYSYMB,,SYSYME ;CALLS +IFN IMXP, IMXTBB,,IMXTBE ;IMPX + CLVBEG,,CLVEND ;CLINK + 0,,DSYMS ;DSYMS + SYSUSB,,SYSUSE ;USYMS + DCHSTB,,DCHSTE ;CHDEVS + SYSCTB,,SYSCTB+LSYSCT-1 ;NCALLS + TYVTAB,,TYVTAB+LTYVTA-1 ;TTYVAR + USETTB,,USETTB+MXVAL-1 ;USRVAR + ITSNMS,,ITSNMS+LITSNM-1 ;ITSNMS +IFN LGSNAM-<.-GSYS1>, .ERR GSNAME and GSYS1 don't match. + +ITSNMS: ITSIRP [ + SIXBIT /ITS/ + ] +LITSNM==:.-ITSNMS + 0 + 0 ; Make it easy to add more. + +USRSV: MOVEI C,USRSTG + MOVE D,USRHI + ADDI D,USRSTG-1 + JRST agets2 + +USR1V: UMOVE C,2(J) + IMULI C,LUBLK + CAML C,USRHI + JRST USR1VL + ADDI C,USRSTG + MOVE D,C + ADDI D,LUBLK-1 + JRST agets2 + +USR1VL: XCTR XW,[SETOM 2(J)] + JRST AGETS4 + +DSYMS: HRRZ C,DDT-2 + HLRE D,DDT-2 + SETCMM D ;OFFSET BY ONE + ADD D,C + JRST agets2 + +SUBTTL .GETLOC, .EVAL, ETC. + +;GET AN ABSOLUTE LOCATION ;.GETLOC AC, ;C(A)=FROM(ABS),,TO(RELATIVE) +; +AGETLOC:UMOVE A,(J) ;GET TO ADDRESS + HLRZ B,A ;GET FROM ADDRESS + XCTRI [MOVE C,(B)] + JRST .+2 + JRST ILEXPF ;ILLEGAL EXEC PAGE FAULT + UMOVEM C,(A) ;GIVE TO USER + POPJ P, + +;SET AN ABSOLUTE LOCATION ;.SETLOC AC, ;C(AC)=FROM(RELATIVE),,TO(ABS) +; +ASETLOC:TDZA D,D ;CLEAR COND FLAG, SKIP + +;SET AN ABSOLUTE LOCATION ONLY IF C(ABS)=C(TEST) & SKIP IF SUCCESSFUL +;.IFSET AC, ;C(AC)=,,TO ADR(ABS) +;WORD 1=TEST ;WORD 2=NEW C(ABS) + +AIFSET: MOVNI D,1 ;SET COND FLAG + XCTR XR,[HRRZ A,(J)] ;GET TO ADDRESS (ABSOLUTE) + XCTR XR,[HLRZ B,(J)] + UMOVE C,(B) ;GET WORD + XCTRI [MOVES (A)] + JRST .+2 + JRST ILEXPF + JUMPE D,ASPST1 ;NORMAL SETLOC + UMOVE D,1(B) ;GET NEW VALUE + CONO PI,CLKOFF ;PREVENT INTERRUPTS + CAME C,(A) ;CHECK WORD AGAINST TEST WORD + JRST CLKONJ ;NOT EQUAL => IGNORE + MOVE C,D + AOS (P) ;CAUSE RETURN TO SKIP + CAIG A,SYSB_10. ;CHECK IF IN SYS + JRST ASPST1 ;YES SO DO REG SETLOC + EXCH D,(A) ;NO SO DO NOW BEFORE SHUFFLE & GET OLD +ASPST2: MOVE C,D + HRROS A ;LET SYS JOB KNOW ALREADY DONE +ASPST1: CAMN C,(A) ;SKIP IF DIFFERENT FROM C(TO ADR) + JRST CLKONJ ;SAME + MOVE D,SYSITM ;IF SYSTEM JOB HAS BEEN HUNG OR LOOPING FOR 30 SEC, + ADDI D,30.*30. + CAMGE D,TIME + JUMPGE A,ASPST3 ;GO DO THE WORK OURSELVES (BUT DON'T DO IT TWICE). +ASPST4: MOVE D,UNAME(U) ;GET UNAME OF SETLOCER + MOVSI T,SCLSET + PUSHJ P,CWAIT ;WAIT TILL VARIABLES TO COMMUNICATE WITH SYS JOB ARE FREE + TDNE T,SUPCOR ;ARG TO CALL IN .-1 + MOVEM A,SETSLC ;REMEMBER ABS LOCATION + MOVEM C,SETSLQ ; " NEW CONTENTS (OR OLD IF LH(SETSLC)=-1) + MOVEM D,SETSU ; " USER +CSPST: IORM T,SUPCOR ;TELL SYS JOB TO DO IT + JRST CLKONJ + +ASPST3: HRRZ D,UPC ;SYS JOB HAS BEEN HANGING FOR 30 SEC. + CAIN D,SCOR1 ;WHY? JUST SLEEPING? + JRST ASPST4 ;YES => SIGNAL IT TO DO THE WORK + MOVEM C,(A) ;ELSE GIVE UP ON IT AND DO IT NOW + JRST CLKONJ + +;LOOK UP ITS SYMBOL ;.EVAL AC, ;C(AC)=SQUOZE SYMBOL +;REPLACES SYMBOL BY VALUE & SKIPS IF SUCCESSFUL +;IF YOU WANT TO .EVAL A SYMBOL IN A PROGRAM HABITUALLY AND IMPLICITLY, +;AND WANT IT TO CONTINUE TO WORK, YOU HAD BETTER ADD AN ENTRY TO THE FILE +;AI:SYSTEM;EVSYMS > SAYING WHAT PROGRAM AND WHAT SYMBOL. THEN, ITS HACKERS +;CAN AVOID SCREWING YOU WITHOUT WARNING. + +AEVAL: PUSHJ P,SWTL + ARDFSW + UMOVE B,(J) ;GET SYM + PUSHJ P,SYMLK ;LOOK UP + JRST LSWPOP ;NOT FOUND + MOVE A,(C) ;GET VALUE + PUSHJ P,LSWPOP + AOS (P) ;CAUSE UUO TO SKIP + JRST APTUAJ ;RETURN VALUE + +;REDEFINE ITS SYMBOL ;.REDEF AC, ;C(AC)=POINTER TO 2 WORD BLOCK +;WORD 1 = SYMBOL ;WORD 2 = VALUE +;DELETE SYM IF ALL 4 FLAG BITS SET +; OTHERWISE SET SYMBOL FLAGS TO THOSE SPECIFIED, EXCEPT REJECT ANY ATTEMPT TO +; ADD A PROGRAM NAME +;ADD SYM IF NOT FOUND ;FAIL ONLY IF NOT ENOUGH ROOM +;SKIPS IF SUCCESSFUL + +AREDEF: PUSHJ P,SWTL + ARDFSW + XCTR XR,[HRRZ D,(J)] ;GET POINTER FROM AC + UMOVE B,(D) ;GET SYMBOL + PUSHJ P,SYMLK ;LOOK UP + JRST ARDF2 ;NOT FOUND, CREATE + XCTR XR,[SETCM A,(D)] ;GET SYM (COMPLEMENTED) + TLNN A,740000 ;SKIP IF ANY FLAGS NOT SET + JRST ARDF3 ;ALL SET => DELETE + SETCA A, + TLNN A,740000 + JRST LSWPOP + MOVEM A,-1(C) + UMOVE A,1(D) ;GET VALUE + MOVEM A,(C) ;STORE IN SYMTAB + JRST ARDF4 ;SORT AND SKIP-RETURN. + +ARDF2: MOVE C,DDT-2 ;GET POINTER + SUB C,[2,,2] ;DECREMENT FOR NEW ENTRY + MOVEI A,-1(C) ;FUDGE FOR BLOCK CALC + LSH A,-10. ;CONVERT TO # OF BLOCKS UP TO SYMTAB -1 + UMOVE B,(D) ;GET SYM + MOVE T,FDDTPG + LSH T,10. + TLNE B,740000 ;LOSE IF PROG NAME + CAMLE A,T ;CHECK FOR LOSSAGE + JRST LSWPOP ;DON'T OVERWRITE ITS + EXCH B,2(C) ;STORE OVER GLOBAL BLOCK HEADER, + MOVEM B,(C) ;MOVE THAT HEADER DOWN 2 WDS. + UMOVE A,1(D) ;GET VALUE + EXCH A,3(C) + ADD A,[-2,,] ;1 MORE SYM IN GLOBAL BLOCK. + MOVEM A,1(C) ;STORE + MOVEM C,DDT-2 ;UPDATE POINTER + JRST ARDF4 ;GO SORT AND SKIP-RETURN. + +ARDF3: MOVE B,DDT-2 ;GET POINTER + MOVE A,(B) ;MOVE THE GLOBAL HEADER + EXCH A,2(B) ;UP OVER 1ST SYM + MOVEM A,-1(C) ;WHICH GOES INTO FREE SLOT. + MOVE A,1(B) + ADD A,[2,,] ;GLOBAL BLOCK 1 SYM SHORTER. + EXCH A,3(B) + MOVEM A,(C) + MOVE A,[2,,2] + ADDM A,DDT-2 ;UPDATE POINTER +ARDF4: MOVSI E,(SETZ) ;TELL DDT ITS SYMTAB WAS ALTERED. + IORM E,DDT-1 + PUSHJ P,SBUBL ;DO 1 BUBBLE-SORT UP AND 1 DOWN. + JRST LSWPJ1 ;FREE ARDFSW AND EXIT. + +;DO ONE BUBBLE SORT PASS UP, ONE DOWN; LEAVE J <0 IFF DID AN EXCHANGE. +;CLOBBER A-E. +SBUBL: MOVE E,DDT-2 + HLL E,1(E) + ADD E,[2,,2] ;AOBJN -> SYMS IN GLOBAL BLOCK. +SBUBL0: SETZ J, + MOVE B,[2,,2] ;INCREMENT FOR UPWARD PASS. + MOVE C,[JUMPL A,SBUBL1] + SUBI E,2 ;(WILL INCREMENT BEFORE ACTING) + MOVE A,E + PUSHJ P,SBUBL2 + MOVNS B ;DECREMENT FOR DOWNWARD PASS. + MOVE C,[CAMN A,E] + JRST SBUBL2 + +SBUBL1: MOVE D,1(A) ;CHECK NEXT PAIR OF ENTRIES. + CAMG D,3(A) + JRST SBUBL2 ;IN CORRECT ORDER. + EXCH D,3(A) + MOVEM D,1(A) ;WRONG ORDER, EXCHANGE. + MOVE D,(A) + EXCH D,2(A) + MOVEM D,(A) + SETO J, ;SAY DID AN EXCHANGE. +SBUBL2: ADD A,B ;MOVE TO NEXT ENTRY. + XCT C ;TEST IF FINISHED. + POPJ P, + JRST SBUBL1 ;(NOT FINISHED) + +;LOOK UP SYMBOL IN B IN ITS SYMBOL TABLE (CLOBBERS A,B,C) +;RETURN WITH POINTER TO VALUE WORD IN C +;SKIPS IF SUCCESSFUL + +SYMLK: TLZ B,740000 ;FLUSH FLAGS + MOVE C,774000-2 ;PICK UP AOBJN POINTER TO SYMTAB FROM EXEC DDT +SYMLK2: MOVE A,(C) ;GET SYM + AOBJP C,[JRST 4,.+1] ;INCREMENT POINTER + TLNE C,376 ;GO THROUGH HAIR EVERY 200 SYMS + JRST SYMLK3 ;NOT THIS TIME + PUSHJ P,OPBRK +SYMLK3: TLNN A,200000 ;SKIP IF DELETE INPUT (FLAG PREVENTS MATCH) + TLZE A,740000 ;FLUSH FLAGS & CAUSE LOSS IF ALL 0 (PROG NAME) + CAME A,B ;COMPARE + AOBJN C,SYMLK2 ;LOSS, TRY ANOTHER + JUMPL C,POPJ1 ;SKIP RETURN IF FOUND + POPJ P, ;NOT SO IF LOSS + +AWSNAME:XCTR XR,[SKIPE B,(J)] ;OPER 35 + MOVEM B,USYSNM(U) + POPJ P, + +AUPISET:UMOVE B,(J) ;OPER 36 + ASH B,-35. + EXCH B,PICLR(U) + UMOVEM B,(J) + SKIPN PICLR(U) + POPJ P, + JRST APISE1 + +;GENERATE A UNIQUE SYM ;.GENSYM AC, ;LOADS AC WITH SYM +; +AGENSYM:PUSHJ P,SWTL ;WAIT TILL INTERLOCK FREE THEN SEIZE IT + GENSSW + MOVEI TT,IGNSYM + PUSHJ P,SIXAOS ;INCREMENT SYM + MOVE A,IGNSYM ;GET SYM + PUSHJ P,LSWPOP ;UNLOCK FOR NEXT USER + JRST APTUAJ ;GIVE USER GENERATED SYMBOL + +;GENERATE A UNIQUE NUM ;.GENNUM AC, ;LOADS AC WITH NUMBER +; +AGENNUM:AOS A,IGNNUM ;INCREMENT NUMBER + JRST APTUAJ ;AND GIVE IT TO USER + +EBLK + +GENSSW: -1 + 0 +IGNSYM: SIXBIT /SYS/ + +IGNNUM: 0 + +BBLK + +SIXAOS: PUSH P,I + PUSH P,J + AOS (TT) ;INCREMENT SYM + MOVE I,[440600,,(TT)] ;GET POINTER TO FIRST CHAR +SIXAS2: ILDB J,I ;GET FIRST (NEXT) CHAR + SKIPN J ;SKIP IF NOT ZERO + MOVEI J,1 ;REPLACE EMBEDDED SPACE WITH "!" + DPB J,I ;PUT BACK + CAME I,[60600,,(TT)] ;SKIP IF FIRST FIVE CHARS HAVE BEEN EXAMINED + JRST SIXAS2 ;GO TO NEXT CHAR + POP P,J + POP P,I + POPJ P, + +IFN KL10P,[ + +SUBTTL KL10 PERFORMANCE COUNTER + +;KLPERF SYMBOLIC SYSTEM CALL +;ARG 1: TO MEASURE PERFORMANCE DURING; + ;-3 => NULL JOB, -4 => ALL JOBS +;ARG 2: P.A. ENABLES WORD (SEE NON-EXISTENT KL10 SYS REF MAN) + ;0 => FREE THE FACILITY, ELSE TRIES TO GRAB IT +;NO ARGS => JUST READS THE VALUES WITHOUT CHANGING THE ENABLING CONDITIONS. + ;IN THAT CASE, IT IS OK IF FACILITY IS OWNED BY SOMEONE ELSE +;VAL 1: PREVIOUS SETTING +;VAL 2: PREVIOUS P.A. ENABLE WORD +;VAL 3: TIME BASE HIGH WORD +;VAL 4: TIME BASE LOW WORD +;VAL 5: PERF CTR HIGH WORD +;VAL 6: PERF CTR LOW WORD + +KLPERF: CONO PI,CLKOFF + JUMPN W,KLPER1 +KLPER0: MOVE J,MTRJOB ;NO ARGS => DONT CHANGE SETTINGS, + MOVE B,PAEON ;JUST RETURN CURRENT COUNT. + JRST KLPER3 + +KLPER1: JUMPN B,KLPER2 ;TRYING TO TURN IT ON? + CAME U,MTRUSR + JRST KLPER0 ;FREEING THE FACILITY WHEN DON'T OWN IT? + PUSHJ P,PRFOFF ;NO, TRYING TO FREE IT - DO SO. + MOVEI J,-2 + JRST KLPER3 + +KLPER2: SKIPGE MTRUSR ;IF FACILITY IS FREE, SIEZE IT. + MOVEM U,MTRUSR + CAME U,MTRUSR + JRST OPNL10 ;ALREADY BELONGS TO SOME OTHER JOB. + MOVEI J,2(A) + CAIN J,-2 ;ALL JOBS? + JRST KLPER4 + CAIN J,-1 ;NULL JOB? + JRST KLPER3 + MOVE J,A + JSP T,NCRUI2 ;ELSE DECODE JOB SPEC; OBJECT TO PDP6 + JFCL + CAME J,U + JRST KLPER3 +;TRYING TO TURN ON FOR SELF OR ALL JOBS - IT OUGHT TO BE ON RIGHT NOW! +KLPER4: CONO MTR,2001 ;TURN ON TIME BASE, INTERVAL PIA=1 + WRPAE B ;SET ENABLES +KLPER3: EXCH B,PAEON + SKIPGE A,MTRJOB + TRZA A,2 ;UN CONVERT -1 => -3, -2 => -4 + LSH A,-9 ;IDIVI A,LUBLK +IF2 IFN LUBLK-1000,.ERR NO DIVIDE + HRREM J,MTRJOB + RCCL C ;C,D GET TIME BASE + RPERFC E ;E,TT GET PERFC + JRST CLKOJ1 + +;TURN OFF THE PERFORMANCE COUNTER. PUT BACK IN RUN-TIME MEASURING MODE +PRFOFF: MOVNI A,2 ;NOT ATTACHED TO ANY JOB + MOVEM A,MTRJOB + WRPAE [1576,,1200] ;MEASURE MAIN-PROGRAM TIME IN 80 NS UNITS (MODEL A) + CONO MTR,4001 ;TIME-BASE OFF, INTERVAL PIA=1 + RPERFC STPERF ;START-OF-QUANTUM TIME IS NOW + RPERFC NULPRF ;ALSO FOR NULL-JOB + SETOM MTRUSR ;NO LONGER IN USE + POPJ P, +] ;END IFN KL10P + +$INSRT CORE ;CORE JOB AND MEMORY MANAGEMENT ROUTINES + +SUBTTL NULL DEVICE +; IMMEDIATE EOF ON INPUT, HAS NO EFFECT ON OUTPUT +; +NULO: HLRS A,C ;REMEMBER MODE FOR .STATUS + JSP Q,OPSLC3 ;SET UP IOCHNM WORD AND EXIT + NLIDN,,NLODN ;ARG + NLBIDN,,NLBDN ;ARG + +;UNIT NULL DEVICE INPUT +NULI: JRST UNIEOF + +;BLOCK NULL DEVICE INPUT +NULBI: POPJ P, + +;BLOCK NULL DEVICE OUTPUT ENTRY +;ADVANCE BLOCK MODE .IOT POINTER +NULBOD: XCTR XR,[HLRE A,(C)] ;GET NEG LENGTH FROM LEFT HALF + MOVNS A ;GET POSITIVE LENGTH + XCTR XR,[ADD A,(C)] ;ADD STARTING LOC (R.H.) + XCTR XW,[HRRZM A,(C)] ;STORE BACK "COUNTED OUT" POINTER + POPJ P, + +;STANDARD DEVICE .STATUS ROUTINE +STDSTA: DPB A,[60300,,D] ;A HAS LH OF IOC WORD + TRO D,1_9 ;SYS BUF CAP FULL + TRNE D,1_6 ;SKIP IF INPUT + TRC D,3_9 ;TURN OFF SYS BUF CAP FULL, SET EMPTY + POPJ P, + +SUBTTL USER DEVICE + +UBPFJ==10 ;DEMAND FOREIGN JOB (BIT IN LH (DEV) FOR .OPEN (USR)) + +USROJ: TDZA J,J ;ENTRY FROM JOB DEVICE DONT GET CORE. +USRO: MOVNI J,1 ;INDICATE NOT FROM JOB OPEN + CAIA +USROOJ: MOVEI J,1 ;OJB DEVICE; EXISTING JOB OK ONLY IF %OPOJB BIT SET. + PCLT + SKIPL CORRQ(U) + PUSHJ P,UFLS ;PREVENT ATTEMPT TO CORE, PCLSR OUT, AND THINK YOU'VE WON AT SETBF1, ETC + PUSHJ P,SWTL + TREESW + JUMPE B,USRO4 ;JNAME = 0 => UNAME IS JOB SPEC. + SKIPN A ;IF UNAME=0 + MOVE A,UNAME(U) ;MAKE IT THIS JOB'S UNAME + CAME A,UNAME(U) ;SKIP IF FIRST FILE NAME IS UNAME OF OPENER + JRST USROA + CAME B,[SIXBIT /PDP10/] ;SKIP IF SECOND FILE NAME IS "PDP10" + CAMN B,[SIXBIT /PDP6/] ;OR PDP6 +IFN PDP6P,JRST PDPO + .ELSE JRST OPNL1 +USROA: CONO PI,CLKOFF + PUSHJ P,LSWPOP ;TREESW +USROB: SETZ TT, +USRO3: CAME A,UNAME(TT) + JRST AGIN + CAMN B,JNAME(TT) + JRST UFN1 ;FOUND UNAME JNAME PAIR +AGIN: ADDI TT,LUBLK + CAMGE TT,USRHI + JRST USRO3 + TLNE C,UBPFJ ;JOB MUST EXIST TO WIN IF UBPFJ SET + JRST OPNL4 + CAME A,UNAME(U) ;INFERIOR PROCEDURE MUST HAVE SAME UNAME + JRST OPNL20 + PUSH P,U +TCORS: MOVSI T,%TBNOT+%TBDTY ;DOESN'T HAVE TTY, ISN'T GIVING IT AWAY + PUSHJ P,USTRA + JRST TCORS1 ;USTRA FAILED - SEE WHY, MAYBE RETRY (U CLOBBERED) + MOVEM A,UNAME(U) + MOVEM B,JNAME(U) + MOVEM A,USYSNM(U) + MOVE TT,U + POP P,U + MOVE A,UTMPTR(U) + MOVEM A,UTMPTR(TT) + MOVE A,HSNAME(U) + MOVEM A,HSNAME(TT) + MOVE A,XUNAME(U) + MOVEM A,XUNAME(TT) + MOVEM B,XJNAME(TT) + PUSHJ P,USRST5 ;SET UP TTY STUFF + MOVSI A,400000 + SKIPGE APRC(U) + IORM A,APRC(TT) ;NEW INFERIOR IS DISOWNED IF CREATOR IS. + JUMPE J,CLKOJ1 ;RETURN HERE FOR JOB DEVICE (INDEX IN TT) + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR THE JOB. + JRST NOGO1 ;NONE => GO KILL THE JOB AND RETURN FAILURE. + CONO PI,CLKON ;NOW CAN'T FAIL TO CREATE THE JOB FOR GOOD. + HRLZ B,B + HRR B,U + MOVEM B,SUPPRO(TT) + MOVE U,TT + PUSHJ P,UFOUND ;SET UP THE OPENER'S CHANNEL. + JFCL + MOVE Q,TT + MOVEI B,1 + PUSHJ P,ACORE1 ;MAY PCLSR OUT, BUT CORE JOB WILL DO WORK ANYWAY. + SKIPA R,UUAC(U);NO CORE AVAILABLE, KILL THE JOB + JRST POPJ1 ;SUCCESS + ADDI R,IOCHNM(U) + PUSHJ P,AUCLOSE + JRST OPNL37 ;NO CORE AVAILABLE + +ULUP1: CLEARB A,T +ULUP: HRRZ E,SUPPRO(T) + SKIPN UNAME(T) ;SKIP IF VARIABLE BLOCK IN USE + JRST ULUP2 + CAIN E,(U) ;SKIP IF NOT AN INFERIOR + IOR A,SUPPRO(T) ;IOR IN INTERRUPT BIT OF INFERIOR +ULUP2: ADDI T,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE T,USRHI ;SKIP IF ALL EXAMINED + JRST ULUP ;LOOP +UFIN: MOVEI B,1 ;SELECT INT BIT +UFIN2: TLON A,(B) + JRST POPJ1 + LSH B,1 + CAIGE B,1_ + JRST UFIN2 + POPJ P, + +NOGO1: MOVSI T,BULGO+BULGOS + IORM T,APRC(TT) ;TELL THE SYS JOB TO KILL THE JOB WE JUST GOT + MOVSI T,SCLGUN + IORM T,SUPCOR + JRST OPNL5 ;DIREC FULL (TOO MANY LOSERS) + +NOGO4: SUB P,[1,,1] + JRST OPNL6 + +TCORS1: PCLT ;COME HERE FROM TCORS IF ATTEMPT TO FIND FREE JOB SLOT FAILED. + SKIPGE SJCFF ;IF THIS IS NEGATIVE, USTRA DIDN'T EVEN REQUEST MORE + JRST [ SKIPGE SJCFF + PUSHJ P,UFLS + JRST TCORS2] + MOVE TT,USRHI + CAIL TT,MAXJ*LUBLK + JRST NOGO4 ;USER MEM EXPANDED TO MAX + SKIPGE SUPCOR .SEE SCLEX ;PRESUMABLY USTRA ASKED SYS JOB FOR MORE JOB SLOTS + PUSHJ P,UFLS ;SO WAIT TILL SYS JOB ANSWERS THE REQUEST +TCORS2: CONO PI,CLKOFF ;AND SEE IF THERE ARE NOW ENOUGH SLOTS. + JRST TCORS + +USRO4: EXCH J,A ;USR: OPEN WITH JNAME=0: USE UNAME AS JOB SPEC. + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 ;SPEC'D JOB IS PDP6 => OK, + JRST PDPO +] + CONO PI,CLKOFF + PUSHJ P,LSWPOP ;SOS DIELOK(J) + PUSHJ P,LSWPOP ;TREESW + MOVE TT,J + MOVE J,A +;COME HERE WHEN JOB ALREADY EXISTS, WITH CLOCK OFF AND USR IDX IN TT. +;A, B, C STILL HAVE UNAME, JNAME AND OPEN MODE. +UFN1: JUMPE J,[ADDI B,10000 ;OPENING JOB-DEVICE AND JOB EXISTS?? + JRST USROB] ;KEEP CHANGING JNAME UNTIL WE CREATE A JOB. + CAIG TT,LUBLK + JUMPL J,UFNDF ;SKIP SOME CHECKS ON SYS & CORE + JUMPG J,[MOVSI T,%OPOJB ;OJB DEVICE OPEN; IF JOB DOESN'T HAVE %OPOJB SET, + TDNE T,OPTION(TT) ;THEN IT HASN'T GIVEN PERMISSION TO BE HACKED. + SKIPL JBI(TT) ;IF IT'S ALREADY A JOB DEVICE DON'T HACK IT. + JRST [CONO PI,CLKON ;IN EITHER CASE, WAIT TILL ALL'S OK, + SKIPL JBI(TT) + PUSHJ P,UFLS + TDNN T,OPTION(TT) + PUSHJ P,UFLS + JRST USROOJ] ;THEN RE-TRY THE OPEN. + LDB T,[.BP BULGOS_22,APRC(TT)] + JUMPN T,OPNL42 + JRST CLKOJ1] ;RETURN SUCCESS TO JOBO6C. + TLNE C,UBPFJ + JRST UFNDF ;USER WANTS IT AS FOREIGN JOB + HRRZ E,SUPPRO(TT) + CAIN E,(U) + JRST UFN1C ;OPENING UP INFERIOR + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) ;UNLESS IT'S A TOP-LEVEL DISOWNED JOB, + JRST UFNDF ;THEN FOREIGN JOB + PUSHJ P,UFN2B ;REOWN DISOWNED TREE + POPJ P, ;CAN'T + JRST UFOUND ;DID + +UFN1C: MOVE U,TT ;OPENING PROCEDURE IMMEDIATE SUPERIOR OF PROCEDURE BEING OPENED + JRST UFOUND + +; +; REOWN A DISOWNED PROCEDURE TREE +; + +NREOWN: TLNN R,%CLSFU ;MUST BE A FOREIGN USER CHANNEL + JRST OPNL34 + CONO PI,CLKOFF + HLRZ TT,H + SKIPGE T,APRC(TT) + SKIPL SUPPRO(TT) + JRST OPNL31 ;TO A TOP-LEVEL DISOWNED JOB + HRLM R,(P) + PUSHJ P,UFN2B ;REOWN THE JOB (TURNS CLOCK ON) + POPJ P, ;FAILED + HLRZ R,(P) ;TURN THE CHANNEL INTO AN INFERIOR CHANNEL. + MOVNI T,FUWIDN-UWIDN + ADDM T,(R) + JRST POPJ1 + +;REOWN JOB TT POINTS TO, ITS APRC IS IN T. SKIPS IF SUCCESSFUL. +;CALL WITH CLKOFF, WILL TURN IT ON. +UFN2B: TLNE T,BULGOS + JRST OPNL42 ;CAN'T REOWN JOB WHICH IS LOGGING OUT. + SKIPGE APRC(U) ;IF REOWNING JOB IS DISOWNED, PROHIBIT SO THAT + JRST OPNL31 ;IT DOESN'T REOWN ITSELF AND SCREW THINGS UP + PUSHJ P,ULUP1 ;FIND AN INTERRUPT BIT FOR IT. (IN B) + JRST OPNL5 ;WE HAVE 8 INFERIORS ALREADY. + AOS (P) ;GOING TO WIN + SETOM DLSRCH ;INHIBIT SCHEDULING + CONO PI,CLKON ;TURN CLOCK BACK ON, THIS MAY TAKE A WHILE + MOVSI A,BUMRTL ;DOOMED DETACHED JOBS ARE RESCUED BY REOWNING. + ANDCAM A,APRC(TT) + MOVE A,UNAME(U) ;PICK UP NEW UNAME + SETCM D,APRC(U) + TLZ D,#400000 ;SIGN OF D SET IFF REOWNER ISN'T DISOWNED. + MOVE J,UTMPTR(U) ;PICK UP NEW USER RESOURCE POINTER + HRR D,J + SUBI J,USRRCE ;GET NEW CONSOLE # + CAIL J,NCT ;IF NEW TREE STILL HAS NO TTY, + MOVEI J,%TINON ;"DISOWNED" TTY CHNLS SHOULD REMAIN SUCH +;HERE, A HAS UNAME, D HAS ,,UTMPTR, J HAS CONSOLE # OR %TINON, +;U HAS REOWNER, TT HAS JOB BEING REOWNED. +UFN2A: PUSH P,B ;SAVE INTERRUPT BIT +UFN3: MOVEM A,UNAME(TT) ;SET TO NEW UNAME + HRRZM D,UTMPTR(TT) ;SET TO NEW USER RESOURCE POINTER + MOVEI R,IOCHNM(TT) + PUSHJ P,CHSCAN + PUSHJ P,UFN3ZZ + HLLZ T,D ;LH(D) HAS 0 IF REOWNER DISOWNED, ELSE 400000 + ANDCAM T,APRC(TT) ;MARK AS NOT DISOWNED IF REOWNER ISN'T DISOWNED. +UFNL3: MOVE B,JNAME(TT) ;PICK UP CURRENT JNAME + MOVEI E,0 ;LOOP ON ALL USERS +UFNL1: CAMN A,UNAME(E) ;SKIP ON NOT SAME UNAME + CAME B,JNAME(E) ;SKIP ON SAME UNAME-JNAME + JRST UFNL2 ;NOT SAME NAME AND/OR VAR BLK NOT IN USE + JRST UFN7 ;NAME CONFLICT, RESOLVE +UFNL2: ADDI E,LUBLK + CAMGE E,USRHI + JRST UFNL1 + MOVEI E,0 ;INITIALIZE FOR LOOP TO LOOK FOR INFERIORS AND DUPLICATE NAMES +UFN4: SKIPN UNAME(E) ;SKIP IF VAR BLOCK IN USE + JRST UFN5 ;TRY NEXT + HRRZ I,SUPPRO(E) ;PICK UP SUPERIOR POINTER OF BLOCK BEING EXAMINED + CAIN I,(TT) ;SKIP IF NOT INFERIOR + JRST UFN6 ;INFERIOR, PSEUDO-RECURSE +UFN5: ADDI E,LUBLK ;ADVANCE TO NEXT BLOCK + CAMGE E,USRHI ;SKIP IF ALL EXAMINED + JRST UFN4 ;LOOP + SKIPGE SUPPRO(TT) ;SKIP IF NOT BACK TO TOP + JRST UFNX ;BACK TO TOP LEVEL + MOVE E,TT ;POP BACK UP + HRRZ TT,SUPPRO(E) ;TO PREVIOUS LEVEL + MOVE B,JNAME(TT) ;RESTORE B + JRST UFN5 ;PROCEED AT PREVIOUS LEVEL + +UFNX: POP P,B + HRLM B,SUPPRO(TT) + HRRM U,SUPPRO(TT) ;SET UP SUPERIOR POINTER IN TO LEVEL DISOWNED + SETZM DLSRCH ;RE-ENABLE SCHEDULING + MOVE U,TT + POPJ P, + +UFN6: MOVE TT,E ;PSEUDO-RECURSE + JRST UFN3 ;START UP ON LOWER LEVEL + +UFN7: CAMN E,TT ;SKIP UNLESS FOUND SELF + JRST UFNL2 + ADDI TT,JNAME ;SET UP ARG TO SIXAOS + PUSHJ P,SIXAOS ;INCREMENT JNAME + SUBI TT,JNAME ;RESTORE TT + JRST UFNL3 ;RESTART LOOP + +;RESUSCITATE TTY CHNLS +UFN3ZZ: HRRZ Q,(R) + CAIL Q,TYIDN + CAILE Q,TYOBN + POPJ P, ;NOT A TTY CH + HLRZ Q,(R) + TRNN Q,%TICNS + POPJ P, ;NOT CONSOLE + CAIE J,%TINON + AOS TTNTO(J) + DPB J,[$TIIDX,,(R)] + POPJ P, + +UFOUND: HLRZS C ;U HAS INF PROC + HRL A,U + MOVE U,USER + HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) ;CLOBBERED BY CORE + JSP Q,OPSLC3 + UWIDN,,UWODN + UBIDN,,UBODN + +UFNDF: TLNE C,1 + JRST OPNL12 ;ATTEMPTED OUTPUT + LDB A,[.BP BULGOS_22,APRC(TT)] + JUMPN A,OPNL42 ;USER GOING AWAY + HRL A,TT + JSP Q,OPSLD1 + FUWIDN,,FUBIDN + +USRST: PUSHJ P,AUCL2 ;.RESET SIMULATES CLOSING AND REOPENING + POPJ P, + CONO PI,CLKON + PUSHJ P,1USTOP + EXCH U,A ;BUT WITH LESS OVERHEAD + PUSH P,A + PUSHJ P,IODCL + MOVEI B,BULGOS ;WE'RE NOT REALLY TRYING TO KILL THE INFERIOR, + ANDCAM B,APRC(U) ;SO DON'T LET OTHERS THINK HE'S BEING KILLED. + MOVE Q,U + SETZ B, + EXCH U,(P) + PUSHJ P,ACRF1 ;FLUSH ALL OF CORE + BUG +USRST1: MOVEI B,1 + MOVE Q,(P) + PUSHJ P,ACRF1 ;THEN GET 1 PAGE + JRST [ PUSHJ P,UDELAY + JRST USRST1] + EXCH U,(P) + MOVSI T,%TBNOT+%TBDTY + MOVEM T,TTYTBL(U) + MOVE J,U + EXCH U,(P) + PUSHJ P,MPLDJ + XCTR XW,[CLEARM 0] + MOVEI T,1 + XCTR XBRW,[BLT T,1777] + PUSHJ P,MPLDZ + EXCH U,(P) + PUSHJ P,LOGUSE + CONO PI,CLKOFF + PUSHJ P,USRST2 + CONO PI,CLKON + PUSHJ P,USRST4 ;SHOULD SKIP + BUG + POP P,A + EXCH U,A + MOVE TT,A +USRST5: MOVE A,TTSTSV(U) ;INITIALIZE SAVED TTYSET OF NEW JOB EQUAL TO CREATOR'S. + SKIPL B,TTYTBL(U) ;NOTE THAT THE WHEREABOUTS OF THE CREATOR'S TTYSET + MOVE A,TTYST1(B) ;DEPENDS ON WHETHER HE HAS THE TTY NOW. + MOVEM A,TTSTSV(TT) + MOVE A,TTSTSV+1(U) + SKIPL B + MOVE A,TTYST2(B) + MOVEM A,TTSTSV+1(TT) + MOVEI A,(TT) ;RH OF NEW JOB'S SAVED TTYSTS IS HIS INDEX. + HRLI A,%TSCNS ;NOW CONSTRUCT THE LH. + MOVE B,UTMPTR(TT) ;TO DO THAT, FIND THE TREE'S TTY NUMBER + MOVE B,TTYOPT-USRRCE(B) ;TO FIND THE TTY'S TTYOPT WORD, + TLNE B,%TOROL ;WHICH TELLS HOW TO INIT THE BITS IN THE TTYSTS. + TLO A,%TSROL + TLNN B,%TOMOR + TLO A,%TSMOR + TLNE B,%TOSA1 + TLO A,%TSSAI + MOVEM A,TTSTSV+2(TT) + POPJ P, + +;.CALL USRMEM +; ARG 1 JOB WHOSE MEMORY SHOULD BE READ OR WRITTEN +; ARG 2 ADDRESS TO READ OR WRITE +; ARGS 3,4 LIKE USRVAR, TTYVAR +; VAL 1 PREVIOUS CONTENTS OF LOCATION +; VAL 2 NEW CONTENTS OF LOCATION (SAME AS PREVIOUS IF NOT WRITING). +; (NOT VALID IN BLOCK MODE) + +; BIT 1.1 IF SET, THEN IF PAGE ISN'T READABLE OR WRITEABLE, GIVE AN MPV +; OR PURE INTERRUPT TO THE JOB BEING REFERENCED. +; BIT 2.9 IF SET, ALLOWS US TO WRITE IN ANY JOB. + +NUSRMEM: + MOVE J,A + JSP T,NCORUI + JRST NUSRM1 ;WE CAN SURELY WRITE. + MOVE H,CTLBTS(U) + CAIGE W,3 ;ELSE, IF WE WANT TO WRITE, + TRNE H,1 ;OR WANT TO GIVE THE REFERENCED JOB INTERRUPTS, + TRNE H,400000 ;THEN UNLESS WE ARE FORCING IT, + JRST NUSRM1 + JSP T,NCORWR ;SEE IF IT IS A JOB WE ARE ALLOWED TO WRITE IN. + JRST OPNL31 +NUSRM1: MOVE H,CTLBTS(U) + CAIE J,-1 + CAIG J,LUBLK ;CAN'T GIVE SYS OR CORE JOBS INTERRUPTS, OR PDP6. + TRNN H,1 + CAIA + JRST OPNL31 +IFN PDP6P,[ + CAIN J,-1 + JRST NUSRMS +];PDP6P + CAILE J,LUBLK + CAMN J,U + JRST NUSRMS + MOVE A,J ;IF TARGET JOB ISN'T SELF OR PDP6 + PUSHJ P,RPCLSR ; OR SYS OR CORE, STOP IT. + PUSHJ P,SOSSET + USTP(J) +NUSRMS: PUSHJ P,NUSRM2 ;DO THE WORK + POPJ P, ;LOST, OPNL HAS LSWCLR'ED + JRST LSWCJ1 ;POSSIBLY UNLOCK USTP, DIELOK AND TAKE SUCCESS RETURN + +NUSRM2: PUSHJ P,VARCAL ;E:=ADDR, D:=DATA, W:=INSTRUCTION + HRRZS E + CAIGE E,20 + JRST NUSRM6 ;ACS ALWAYS SWAPPED-IN AND ACCESSIBLE + PUSH P,U + MOVE U,J + LDB A,[121000,,E] ;GET PAGE # IN A AND REF'D JOB IN U. +IFE PDP6P, PUSHJ P,UPLC +IFN PDP6P,[ + PUSHJ P,[ CAIE J,-1 ;SKIP IF PDP6 + JRST UPLC ;DECODE THEM FOR ORDINARY JOB. + CAIL A,LPDP6M + TDZA T,T ;FOR PDP6, MOST PAGES DON'T EXIST, + MOVE T,[002200,,[600000]] ;AND THE REST ARE WRITABLE. + POPJ P,] +];PDP6P + POP P,U + LDB A,T ;GET PAGE ACCESS HALFWORD. + TRNN A,600000 ;IF PAGE SWAPPED OUT, PUT ACCESS BITS IN PLACE THEY WOULD BE + LSH A,16. ; FOR AN IN-CORE PAGE. + JUMPE A,NUSRM9 ;LOSE IF NO PAGE THERE + TRNN A,400000 ;OR IF WE ARE TRYING TO WRITE THE WORD AND PAGE IS READ-ONLY. + JUMPN W,NUSRM8 +NUSRM6: PUSHJ P,MPLDJ ;NOW LOAD MAP OF JOB IN J + HRLI E,(SKIP) ;GET ACCESS TO DATA WORD, SWAP IN PAGE + SKIPE W + HRLI E,(MOVES) +NUSRM4: CONO PI,CLKOFF ;CLK OFF SO ONCE IN CAN'T SWAP OUT AGAIN + XCTRI XRW,E ;NOT GETTING BENEFIT OF USUAL PCLSR BEFORE + JRST NUSRM5 ;SWAP OUT FEATURE SINCE IT'S ANOTHER JOB + PUSHJ P,TPFLT + JRST NUSRM4 + +NUSRM5: UMOVE B,(E) ;NOW THAT PAGE IS IN, GET OLD CONTENTS + MOVE A,B ;IN A AND B + JUMPE W,NUSRM3 + HRRI W,B ;IF WRITING, + XCT W ;EXECUTE USER'S INSN., MODIFYING 2ND VALUE IN B, + TRNN J,-1 ;SYSTEM JOB? + JRST OPNL31 ;******* WRITING SYS, TURN INTO .SETLOC ******* + UMOVEM B,(E) ;AND STORE IT BACK INTO REF'D JOB. +NUSRM3: PUSHJ P,MPLDZ ;RESTORE NORMAL PAGE MAP, TURN CLKON. + JRST POPJ1 ;SUCCESS + +NUSRM8: SKIPA T,[%PIWRO] ;HERE IF TRYING TO WRITE IN READ ONLY PAGE. +NUSRM9: MOVEI T,%PIMPV ;HERE IF ACCESSING NONEXISTENT PAGE. + TRNN H,1 ;SKIP IF TO GIVE INTERRUPT + JRST OPNL32 + CAMN J,USER + JRST UUOERR ;INTERRUPT TO SELF + IORM T,PIRQC(J) ;INTERRUPT OTHER USER + JRST OPNL32 ;CAN'T GET THAT ACCESS TO PAGE. + +;COMMENTS BELOW APPLY TO UBI IN MANY CASES. FOR UBO, TRANSFER GOES THE +;OTHER DIRECTION + +UBO: MOVNI I,1 + JRST UBIL + +UBI: MOVEI I,0 ;SIGNAL UBI + +UBIL: JUMPL C,UBIA + XCTR XRW,[MOVES TT,(C)] ;MAKE SURE WRITE CYCLES WILL WIN +UBIB: TRNE A,200000 ;SKIP UNLESS 6 + MOVNI A,1 ;SO CAILE BELOW WILL SKIP OVER SUSTPR AMONG OTHER REASONS + CAILE A,LUBLK ;SKIP ON SYS JOB, CORE JOB, PDP6 OR JOB ALREADY STOPPED + PUSHJ P,SUSTPR ;RANDOM JOB STOP + JUMPGE TT,UBI4 ;THRU + TLO A,400000 ;INDICATE ALREADY STOPPED SO WONT TRY IT AGAIN + HLRO B,TT + MOVNS B ;COUNT TO BE XFERRED + HRLZ E,IOCHST-IOCHNM(R) ;EXAMINED USER ADDRESS + HRR E,TT ;FROM,,TO (INFERIOR ADR,,SUPERIOR ADR) + HLRZ Q,E + TLNE A,200000 + JRST UBI5A ;PDP6 +UBI5: CAIGE Q,20 ;INF ADR IN Q + JRST UBI3 ;READ AC + HRRZ J,A ;SET UP UMAPS WORD + TRZE E,400000 + TLOA J,%UMMPL ;TO HI PG, HACK OUR LOW PG + TLO J,%UMMPU ;TO LOW PG, HACK OUR HI PG + TLZE E,400000 + TLOA J,%UMLTU ;TO POINT TO HIS UPPER + TLO J,%UMUTL ;TO POINT TO HIS LOWER + TLNN J,%UMMPU+%UMUTL ;MAPPING HIS UPPER WITH OUR LOWER? + JRST UBI3A ;YES MAKE SURE NOT SCREWED BY AC PNTR +UBI3B: PUSHJ P,MPLD1 + TRZ Q,400000 + MOVNS Q ;LIMIT SIZE OF XFER TO MIN OF DESIRED + ADDI Q,400000 ;DIST OF TO ADR FROM SEG BOUNDARY + CAMLE B,Q + HRRZ B,Q + MOVNI Q,(E) ;AND DIST OF FROM ADR FROM SEQ BOUNDARY + ADDI Q,400000 + CAMLE B,Q + HRRZ B,Q + TLNN J,%UMMPL ;BUGGER ADDRESSES SO RIGHT DBRS WILL BE USED + TLOA E,400000 ;SET FROM ADR TO HI PG + TRO E,400000 ;SET TO ADR TO HI PG + SKIPE I ;SKIP ON UBI + MOVSS E ;UBO, XFERR OTHER DIRECTION + MOVE Q,E ;SAVE COPY OF BLT PNTR + ADDI B,(E) ;GET LA +1 +UBI3H: XCTRI XBRW,[BLT E,-1(B)] ;XFERR DATA +UBI3K: MOVEI E,(B) ;NO FAULT, SIMULATE STORE BACK OF BLT PNTR AFTER COMP OF BLT (RH ANYWAY) +UBI3L: PUSH P,J + PUSHJ P,MPLDZ ;RETURN TO NORMAL MAP TO STORE BACK USER PNTR + POP P,J ;SAVE PREV MAP FOR EVENTUAL USE + SUBM E,Q ;FIGURE OUT HOW MANY WDS ACTUALLY XFERRED + HRRZS Q +UBI3E: HRLS Q ;# WDS TRANSFERRED,,SAME + JUMPL C,UBIC ;UPDATE USER PNTR + XCTRI XRW,[ADDM Q,(C)] + JRST .+2 + BUG ;SHOULD HAVE ALREADY CHECKED THIS +UBID: ADD Q,IOCHST-IOCHNM(R) ;UPDATE INFERIOR PNTR + HRRM Q,IOCHST-IOCHNM(R) ;WRAPPING AROUND IF PASS 1,,0 + TLZ B,-1 + CAIN B,(E) ;WAS THERE A FAULT? + JRST UBIL ;NO, LOOP + PUSHJ P,UBI4 ;UNSTOP THE JOB. + PUSHJ P,MPLD1 ;RESTORE TO FROB AT TIME OF FAULT +UBI3C: PUSHJ P,TPFLT + PUSHJ P,MPLDZ + JRST UBIL + +UBI4: TLNN A,200000 ;SKIP ON REALLY PDP6 + TLZ A,400000 ;FLUSH RANDOM BIT SO COMPARE WILL WORK + CAILE A,LUBLK + JRST UPCLSR + POPJ P, + +UBMCK1: PUSHJ P,UBI4 + JRST IOADC + +UBIA: TRNE C,777760 + BUG + MOVE TT,(C) + JRST UBIB + +UBIC: TRNE C,777760 + BUG + ADDM Q,(C) + JRST UBID + +UBI5A: CAIL Q,400000 + JRST UBMCK1 + JRST UBI5 + +UWO: SKIPGE C + SKIPA D,(C) + UMOVE D,(C) + TDZA I,I +UWI: SETO I, ;0 FOR OUTPUT, -1 FOR INPUT. + TRNE A,200000 + MOVNI A,1 ;-1 MEANS PDP6. + CAMN A,USER + HRLI A,-1 ;DON'T STOP SELF + CAIG A,LUBLK + JRST UWI1 ;SYS, CORE, SELF, OR PDP6 + PUSHJ P,SUSTPR + PUSHJ P,SOSSET ;MIGHT TAKE PAGE FAULT AND GET PCLSRED + USTP(A) +UWI1: HRRZ E,IOCHST-IOCHNM(R) + HRRZ J,A + PUSHJ P,MPLDJ ;MAP JOB BEING IOT'ED FROM. + XCTR XRW,[ MOVE W,(E) + MOVEM D,(E)]+1(I) + AOS IOCHST-IOCHNM(R) ;ADVANCE ACCESS POINTER + CAILE A,LUBLK + PUSHJ P,LSWPOP + JRST MPLDZ + +UBI3A: TLNE E,777760 ;SKIP ON XFERRING FROM AC AREA, HI TO HI + JRST UBI3B ;NO OK + JUMPN I,UBO3A ;UBO + PUSHJ P,MPLDJ + XCTRI XR,[MOVE B,(Q)] ;PICK UP WD + JRST .+2 ;OK + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDZ ;BACK TO NORMAL MAP + HRRZ E,TT ;TO ADR + JRST UBI3D + +;USR DEV IOT STOP ROUTINE +USUSTP: SOS USTP(A) +SUSTPR: MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) ;WAIT TILL NOT BEING SHUFFLED + PUSHJ P,UFLS + PUSHJ P,RPCLSR ;AOS'ES USTP + MOVSI T,BCSTOP+BUCSTP + TDNE T,USTP(A) + JRST USUSTP + POPJ P, + +UBI3: ADDI Q,AC0S(A) + JUMPN I,UBO3 ;UBO + TLNE A,200000 + TDZA B,B ;READ PDP6 AC + MOVE B,(Q) ;READ NORMAL AC +UBI3D: XCTRI XW,[MOVEM B,(E)] + JRST .+2 + JRST UBI3C ;TAKE FAULT +UBI3G: MOVEI Q,1 ;1 WD XFERRED + HRRZ B,E ;FAKE OUT FAULT TEST + JRST UBI3E + +UBO3: TLNE A,200000 + JRST UBI3G ;TRYING TO WRITE PDP6 AC IGNORE + XCTRI XR,[MOVE B,(E)] + JRST .+2 + JRST UBI3C + MOVEM B,(Q) + JRST UBI3G + + +UBO3A: XCTRI XR,[MOVE B,(TT)] + JRST .+2 + JRST UBI3C ;TAKE FAULT + PUSHJ P,MPLDJ ;MAP HIM. + XCTRI XW,[MOVEM B,(Q)] + JRST .+2 + JRST UBI3C + PUSHJ P,MPLDZ ;BACK TO NORMAL + JRST UBI3G + +SUBTTL CORE LINK DEVICE + +EBLK +CLVBEG: NCLCH +CLSYN: BLOCK NCLCH ;SYSTEM NAME ;0=>VARIABLES FREE +CLN1: BLOCK NCLCH ;FN1 +CLN2: BLOCK NCLCH ;FN2 +CLUSR: REPEAT NCLCH,-1 ;LH=WRITING USER ;RH=READING USER ;-1=>NOT OPEN THAT HALF +CLRAC: BLOCK NCLCH ;4.9=LOCKED BY CORE ALLOCATOR + ;4.8=VERY SLOW CLOCK ROUTINE CONSIDERING FLUSHING THIS BUFFER + %CAFLS==100000 ;4.7=INPUT CLOSED, TURN OUTPUT INTO NUL DEVICE + %CA==1,,500000 ;RH=UT BUFFER NUMBER (IOBFT ADR) + +CLOSW: -1 ;USER LOCK TO STOP MORE THAN ONE PERSON FROM SIMULTANEOUSLY MODIFYING + 0 ;THE CORE LINK VARIABLES +CLVEND==.-1 +BBLK + +;FORMAT OF CORE LINK 200 WORD BUFFER +; +CLBVSP==8 +CLBCHS==100. +CLBEOF==/5 +IFG CLBVSP+CLBCHS+CLBEOF-128.,.ERR CLBXXX LOSSAGE + +; +;0: CHARACTER COUNT +;1&2: READ AND WRITE CHARACTER OR WORD POINTERS +;3&4: READ AND WRITE EOF POINTERS +;CLBVSP TO CLBVSP+CLBCHS-1: CHARACTERS OR WORDS +;CLBVSP+CLBCHS UP: EOF BITS STORED AS SEVEN FIVE BIT BYTES PER WORD, +; EACH BIT CORRESPONDING TO A CHARACTER POSITION. + +CLAO: SKIPA J,[2] ;CLA .OPEN (TO ANSWER A CLI INTERRUPT) +CLIO: MOVNI J,1 ;CLI .OPEN (INTERRUPTS USER SPECIFIED BY FILE NAME) + JRST CLI2 + +CLUO: TDZA J,J ;CLU .OPEN +CLOO: MOVEI J,1 ;CLO .OPEN +CLI2: JUMPL C,CLFDEL ;JUMP IF AN .FDELE + PUSHJ P,FLDRCK + JRST CLO1 ;NOT FILE DIRECTORY + MOVEI J,2 + JRST LISTF7 + +CLFDEL: MOVEI J,3 +CLO1: PUSHJ P,SWTL ;SEIZE SWITCH TO STOP VARIABLES FROM CHANGING UNDER YOU + CLOSW + LDB H,[220100,,C] ;DIRECTION BIT + JUMPL J,CLOO5 +CLOO5B: MOVE Q,USYSN1(U) ;PICK UP SNAME + MOVSI I,-NCLCH + CAIN J,2 ;SKIP UNLESS CLA + JRST CLO1A ;JUMP IF CLA .OPEN + CAIGE J,0 +CLO1A1: MOVE Q,[SIXBIT/_CLI_/] +CLOL: CAMN Q,CLSYN(I) ;LOOK FOR SNAME, FN1, & FN2 + CAME A,CLN1(I) + JRST CLOO1 + CAME B,CLN2(I) + JRST CLOO1 + JUMPL J,OPNL23 ;"FILE LOCKED" IF ALREADY EXISTS, FOR CLI:. + CAIN J,3 ;SKIP UNLESS DELETE + JRST CLO1D ;FOUND FILE TO DELETE +CLO1A6: LDB TT,CLOOT1(H) + CAIE TT,-1 + JRST OPNL23 ;ALREADY OPEN THIS DIRECTION (FILE LOCKED) + HRRZ TT,CLRAC(I) + LDB Q,[IOSA,,IOBFT(TT)] + LSH Q,6 +CLOX: DPB U,CLOOT1(H) ;STORE USER INDEX + MOVSI TT,200000 + ANDCAM TT,CLRAC(I) ;CLEAR VERY SLOW CLOCK BIT + PUSHJ P,LSWPOP ;RELEASE SWITCH + HRL A,I + LDB C,[220300,,C] + SKIPGE J + PUSHJ P,CLOX1 ;FOR CLI:, PUT OUR UNAME AND JNAME INTO BUFFER. + MOVEI TT,44 ;WORD + TRNN C,6 + MOVEI TT,7 ;UNIT ASCII + ADD Q,H ;OFFSET FOR DIRECTION + DPB TT,[300600,,1(Q)] ;SET UP ITEM POINTER + MOVEI TT,5 ;WORD + TRNN C,6 + MOVEI TT,1 ;UNIT ASCII + DPB TT,[300600,,3(Q)] ;SETUP EOF POINTER + JSP Q,OPSLC7 ;SET UP IOCHNM OF USER + DCLUAI,,DCLUAO ;UNIT ASCII INPUT ;UNIT ASCII OUTPUT + DCLBI,,DCLBO ;BLOCK INPUT ;BLOCK OUTPUT + DCLUBI,,DCLUBO ;UNIT BINARY INPUT ;UNIT BINARY OUTPUT + DCLBI,,DCLBO + +CLOX1: MOVEI TT,44 ;CHANGE OUTPUT BYTE SIZE TO 36. + DPB TT,[300600,,2(Q)] + MOVEI TT,5 ;WHICH INVOLVES STORING 5 CHARACTERS OF EOF BITS AT ONCE. + DPB TT,[300600,,4(Q)] + PUSH P,C + HRROI C,TT + MOVE TT,UNAME(U) + PUSHJ P,CLOXO ;NOW WE CAN IOT WORDS OUT, EVEN IF CHANNEL IS ASCII MODE. + SUBI Q,1 + MOVE TT,JNAME(U) + PUSHJ P,CLOXO + SOJA Q,POPCJ ;NOW RETURN, AND SET UP THE CORRECT BYTE SIZES. + +CLOO1: AOBJN I,CLOL ;LOOP FOR ALL SETS OF CORE LINK VARIABLES + CAIE J,1 + JUMPGE J,OPNL4 ;CLA, CLU DELETE LOSE + MOVSI I,-NCLCH +CLOO3: SKIPN CLSYN(I) ;LOOK FOR FREE VARIABLES TO CREATE FILE + JRST CLOO2 + AOBJN I,CLOO3 + JRST OPNL5 ;GIVE DIREC FULL ERROR + +CLOOT1: 2200,,CLUSR(I) ;READING + 222200,,CLUSR(I) ;WRITING + +CLOO2: MOVEM A,CLN1(I) ;SET UP VARIABLES + MOVEM B,CLN2(I) + MOVEI D,SCNCLO(I) ;SYS CHNL NO + PUSHJ P,TCALL ;GET 200 WORD BUFFER + JRST IUTCONS + JRST CLOO4 ;NO MEM AVAIL + MOVEM Q,CLSYN(I) ;DONT SET UP SYS UNTIL MEM AVAIL + HRRM A,CLRAC(I) + LDB Q,[IOSA,,IOBFT(A)] ;SET UP BUFFER + LSH Q,6 + SETZM (Q) ;CHAR COUNT + MOVE TT,Q + ADDI TT,CLBVSP ;SET UP BUF POINTERS + MOVEM TT,1(Q) + MOVEM TT,2(Q) + HRLI TT,440000 + ADDI TT,CLBCHS ;SET UP EOF POINTERS + MOVEM TT,3(Q) + MOVEM TT,4(Q) + JRST CLOX + +;NO MEMORY AVAILABLE FOR 200-WD BUFFERS +CLOO4: AOS SWPOPR ;MAYBE SWAPPING SOMETHING OUT WILL HELP + PUSHJ P,LSWPOP ;UNLOCK CLOSW + PUSHJ P,UDELAY ;WAIT A WHILE + JRST CLO1 ;TRY AGAIN + +CLOO5: CONO PI,CLKOFF ;TURN OFF CLOCK TO STOP U&J NAMES FROM CHANGING + MOVEI Q,2*LUBLK +CLOO5A: CAMN A,UNAME(Q) ;LOOK FOR USER WHOSE NAMES MATCH THE SPECIFIED FILE NAMES + CAME B,JNAME(Q) + JRST CLOO6 + MOVEI T,%PICLI ;IF GET TO HERE, HAVE FOUND USER WITH RIGHT NAMES + TDNN T,MSKST(Q) ;SKIP IF HE HAS CLI INT DISABLED + JRST OPNL11 + IORM T,PIRQC(Q) ;GIVE USER INT + CONO PI,CLKON + JRST CLOO5B + +CLOO6: ADDI Q,LUBLK ;GO TO NEXT USER SLOT + CAMGE Q,USRHI ;SKIP IF ALL EXAMINED + JRST CLOO5A + JRST OPNL11 + +CLO1D: MOVE T,CLUSR(I) + AOJN T,OPNL23 ;FILE LOCKED + AOS (P) + MOVE A,I + PUSHJ P,CLIOTB ;NO TIMING ERROR SINCE CORE JOB WILL PCLSR USR ON + SKIPN B,SRN3(U) ;CORE LINK BEFORE MOVING BUFFER + JRST CLO1D2 + MOVEM B,CLN1(A) + MOVE B,SRN4(U) + MOVEM B,CLN2(A) + JRST LSWPOP ;CLOSW + +CLO1A: MOVE A,UNAME(U) + MOVE B,JNAME(U) + JRST CLO1A1 + +;CORE LINK .IOT SET UP ROUTINE + +CLIOTB: SKIPGE CLRAC(A) ;WAIT IF BUFFER LOCKED BY CORE ALLOCATOR + PUSHJ P,UFLS ;(DO NOT CHANGE ABOVE TO "SKIPGE TT,CLRAC(A)") + HRRZ TT,CLRAC(A) + LDB Q,[IOSA,,IOBFT(TT)] ;GET POINTER TO BUFFER + LSH Q,6 + POPJ P, + + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII INPUT + +CLUAI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + SKIPN (Q) ;WAIT TILL CHAR COUNT NON-ZERO + PUSHJ P,UFLS +CLUAI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BIT + JUMPN I,UNIEOF +CLUAIE: ILDB W,1(Q) ;GET CHARACTER + SOS (Q) ;DECREMENT BUF COUNT +CLFAXP: LDB TT,[700,,1(Q)] ;FIX UP POINTERS + CAIN TT,CLBVSP+CLBCHS-1 + PUSHJ P,CLFAX2 ;MAYBE TIME TO RING BUFFER + HLRZ TT,J ;GET BYTE POSITION AND SIZE + CAIN TT,010100 ;IF TO END OF 35-BIT WORD, ADVANCE + IBP J ;TO NEXT WORD (5-BIT BYTES 1 BIT AT A TIME) + MOVEM J,3(Q) + POPJ P, + +UNIEOF: HRROI W,EOFCH + JRST POPJ1 + +CLFAX2: LDB TT,[370500,,1(Q)] ;PICK UP TOP 5 BITS OF BYTE POSITION + JUMPN TT,CPOPJ ;NOT QUITE YET +CLFBX2: MOVEI TT,CLBVSP ;J HAS NEW EOF PNTR + DPB TT,[700,,1(Q)] ;RING CHAR POINTER + MOVEM J,3(Q) + MOVEI J,44 + DPB J,[360600,,1(Q)] + MOVEI TT,CLBVSP+CLBCHS + DPB TT,[700,,3(Q)] ;RING EOF POINTER + DPB J,[360600,,3(Q)] + MOVE J,3(Q) + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT ASCII OUTPUT + +CLUAO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE IN BUF + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET CHAR FROM EXEC + UMOVE B,(C) ;GET CHAR FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF + MOVEI TT,1 ;GET MASK FOR LOW ORDER BIT + ANDCAM TT,@2(Q) ;FLUSH IN CURRENT WORD +CLCWU2: AOS (Q) ;INCREMENT BUF COUNT + MOVEI I,0 ;FAKE OUT EOF TEST + AOJA Q,CLFAXP ;FAKE OUT CLFAXP AND FIX UP POINTERS + + +CLBI: JSP W,WRDBTI ;BLOCK INPUT. + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY INPUT + +CLUBI: PUSHJ P,CLIOTB ;SETUP + MOVSI T,%CAFLS + TDNE T,CLRAC(A) + PUSHJ P,UFLS + MOVEI T,5 + CAMLE T,(Q) ;WAIT TILL A WORD IS AVAILABLE + PUSHJ P,UFLS +CLUBI1: MOVE J,3(Q) + ILDB I,J ;GET EOF BITS + JUMPN I,CLUBIF ;JUMP ON EOF +CLUBIE: ILDB W,1(Q) ;GET WORD +CLCRB2: MOVNI T,5 + ADDB T,(Q) ;DECREMENT COUNT + JUMPGE T,CLFBXP + SETZM (Q) ;CAME FROM CLCLRL WITH PARTIAL WORD IN BUFFER +CLFBXP: JRST CLFAXP + +CLUBIF: TROE I,20 ;SKIP IF EOF NOT ON FIRST CHAR OF WORD + JRST POPJ1 + DPB I,J ;SET EOF ON FIRST CHAR + MOVE J,1(Q) + ILDB W,J ;PICK UP WORD WITH EOF IN MIDDLE + POPJ P, + +;CORE LINK .IOT ROUTINE FOR UNIT BINARY OUTPUT + +CLUBO: MOVE T,CLRAC(A) + TLNE T,%CAFLS + POPJ P, + PUSHJ P,CLIOTB ;SETUP +;CLI: OPEN CALLS HERE TO OUTPUT UNAME AND JNAME. +CLOXO: MOVEI T,CLBCHS*5-11. + CAMGE T,(Q) ;WAIT TILL THERE IS SPACE FOR A WORD + PUSHJ P,UFLS + MOVE J,4(Q) + SKIPGE C + SKIPA B,(C) ;GET WORD FROM EXEC + UMOVE B,(C) ;GET WORD FROM USER + MOVEI TT,0 + IDPB TT,J ;INDICATE NOT AN EOF + IDPB B,2(Q) ;STORE IN BUF +CLCWB2: MOVEI TT,5 + ADDM TT,(Q) ;INCREMENT COUNT + AOJA Q,CLFAXP ;FAKE OUT CLFBXP AND FIX UP POINTERS + + +;CORE LINK .IOT ROUTINE FOR BLOCK OUTPUT + +CLBO: MOVE I,C ;SAVE A POINTER TO USERS BLKO POINTER + XCTR XR,[SKIPL H,(I)] ;PICKUP BLKO POINTER + POPJ P, + SKIPA E,H ;SECOND COPY, ALSO FLAG TO CLBIN +CLBI2: UMOVEM E,(I) ;TO INFORM USER & IN CASE YOU ARE PCLSR'ED + HRRZ C,E + PUSHJ P,CLUBO ;TRANSFER ONE WORD + AOBJN E,CLBI2 ;TRY FOR NEXT +CLBI3: UMOVEM E,(I) ;COUNT EXHAUSTED OR EOF + POPJ P, + +;CORE LINK .CLOSE ROUTINE FOR BINARY OR BLOCK OUTPUT + +CLCLWB: PUSHJ P,CLCWC ;STORE EOF BITS FOR WORD + JRST CLCWU6 ;NO ROOM SO LAST MUST HAVE BEEN EOF HACK SO FLUSH + IBP 2(Q) ;KEEP WORD POINTER IN STEP + PUSHJ P,CLCWB2 ;FIX UP COUNT AND POINTERS +CLCWU6: MOVNI B,1 + DPB B,[222200,,CLUSR(A)] ;OBLITERATE USER INDEX + MOVSI B,%CAFLS + ANDCAM B,CLRAC(A) + JRST LSWPOP ;RELEASE SWITCH + +;CORE LINK .CLOSE ROUTINE FOR UNIT ASCII OUTPUT + +CLCLWU: PUSHJ P,CLCWC ;STORE EOF BIT FOR CHAR + JRST CLCWU6 + MOVEI TT,EOFCH + IDPB TT,2(Q) ;STORE AN EOF CHAR + PUSHJ P,CLCWU2 ;FIX UP COUNT AND POINTERS + SOS Q ;CLCWU2 AOJAS + LDB TT,[360600,,2(Q)] + SOJE TT,CLCWU6 ;JUST FILLED A WHOLE WORD => STOP PADDING. + PUSHJ P,LSWPOP ;ELSE PAD ONCE MORE. + JRST CLCLWU + + +;COMMON SUBROUTINE FOR CORE LINK OUTPUT .CLOSE ROUTINES + +CLCWC: PUSHJ P,SWTL ;LOCK SWITCH (IF SIGN OF CLRAC IS EVER REALLY USED, + CLOSW ;THIS MIGHT CAUSE A DEADLY EMBRACE). + PUSHJ P,CLIOTB ;SETUP + MOVEI T,CLBCHS*5-5. + CAMGE T,(Q) ;WAIT FOR THERE TO BE ROOM + POPJ P, + MOVE J,4(Q) + MOVNI TT,1 + IDPB TT,J ;SET EOF BIT(S) + JRST POPJ1 + +;CORE LINK .CLOSE ROUTINE FOR INPUT + +CLO1D2: SETZM CLSYN(A) ;FREE VARIABLES + HRRZS A,CLRAC(A) ;CORE LINK NO LONGER IN USE + PUSHJ P,BRTN ;RETURN BUFFER TO FREE STATE + JRST LSWPOP + +CLISTA: PUSHJ P,CLIOTB ;CORE LINK INPUT STATUS + SKIPN J,(Q) ;COUNT + TRO D,1_10. ;SYS BUF CAP EMPTY + CAIL J,CLBCHS*5-5 + TRO D,1_9 ;SYS BUF CAP EMPTY + POPJ P, + +CLCLRA: TDZA C,C ;UNIT ASCII +CLCLRB: MOVNI C,1 ;IMAGE OR BLOCK (I.E. WORDS) + PUSHJ P,CLIOTB + PUSHJ P,SWTL + CLOSW +;FLUSH ALL REAL DATA +CLCLRL: SKIPN (Q) ;SKIP IF BUFFER CONTAINS DATA, READ IT UNTIL EOF + JRST CLCLR1 + PUSHJ P,[JUMPE C,CLUAI1 ? JRST CLUBI1] + JRST CLCLRL +CLCLR2: MOVE J,3(Q) ;FOUND AN EOF, FLUSH THE EOF WORD + ILDB I,J + PUSHJ P,[JUMPE C,CLUAIE ? JRST CLUBIE] + MOVE T,1(Q) + TLNE T,760000 + JRST CLCLR2 ;NOT YET TO WORD BOUNDARY + JRST CLCLR3 + +CLCLR1: MOVSI B,%CAFLS + IORM B,CLRAC(A) + PUSH P,A + PUSH P,Q + HLRZ A,CLUSR(A) + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL + POP P,Q + POP P,A +CLCLR3: HLLOS B,CLUSR(A) ;NO LONGER OPEN FOR INPUT + SKIPN (Q) ;IF NO DATA IN BUFFER + AOJE B,CLO1D2 ;AND NOT OPEN FOR OUTPUT, GO FREE THE BUFFER AND VARS + JRST LSWPOP + +SUBTTL LOCK DEVICE + +NLCKCH==:8 ; Should be enough. + +EBLK + +LCKNAM: REPEAT NLCKCH, 0 ; 0 => free lock channel, else contains + ; name of lock held by this channel. +LCKUSR: REPEAT NLCKCH, 0 ; Job that holds the lock. Nothing looks + ; at this currently. +LCKSW: -1 ? 0 ; Prevent more than one user from trying to + ; lock a lock at the same time. +BBLK + +; LCKO is .OPEN routine for LOCK device. First filename is name of lock to +; seize. 0 is illegal. Only opens for output are permitted (some day we +; might allow multiple opens for input). +; +; Bit 1.4 controls what happens if lock is already held: +; 0 => error: %ENAFL +; 1 => Hang until you can seize it +LCKO1: PUSHJ P,LSWPOP ; We lose this time + TLNN C,10 ; 1.4 => HANG MODE + JRST OPNL23 ; FILE LOCKED + MOVE T,A + CAMN T,LCKNAM(I) ; Wait for unlock, then try again + PUSHJ P,UFLS +LCKO: JUMPE A,OPNL11 ; ILLEGAL FILE NAME + PUSHJ P,SWTL ; One potential locker at a time + LCKSW + MOVSI I,-NLCKCH ; Check if it is already locked + CAME A,LCKNAM(I) + AOBJN I,.-1 + JUMPL I,LCKO1 ; Already held + MOVSI I,-NLCKCH ; Search for free lock channel + SKIPE LCKNAM(I) + AOBJN I,.-1 + JUMPGE I,OPNL6 ; DEVICE FULL + HRRZM U,LCKUSR(I) + MOVEM A,LCKNAM(I) + HRLZI T,(I) + HRRI T,DNLCK + MOVEM T,(R) ; Set up channel + JRST LSWPJ1 ; And return + +; .CALL RFNAME returns name of lock: +LCKRCH: MOVE B,LCKNAM(A) + POPJ P, + +; .CLOSE releases the lock: +LCKCL: SETZM LCKNAM(A) + POPJ P, + +SUBTTL COMMON I/O ROUTINES + +;STANDARD DEVICE OPEN + +STDOP1: MOVEI R,R ;ENTRY TO NOT CLOBBER IOCHNM +STDOPN: HLRZ A,(Q) ;LH MASK ON 4.9-3.2 OF LH OPEN WRD + AND D,A ;RH POINTER TO ..USR,..USE PAIR + ROT D,-1 ;FOLLOWING WORDS CONTAIN LIST FOR ALL MASKED STATES + ADDI D,(Q) ;LH MSKED STATE =0, RH =1, IOTTB ENTRY NUMBERS + HRRZ A,1(D) + SKIPL D + HLRZ A,1(D) + JUMPE A,OPNL12 ;MODE NOT AVAIL + HRRZ E,(Q) + CONO PI,CLKOFF + CAME U,(E) + SKIPGE 1(E) + AOSA 1(E) + JRST OPNL10 ;DEVICE NOT AVAIL + MOVEM U,(E) + HLL A,C + JRST OPNSLT + +OPSLD1: ANDI D,1 ;ENTRY TO USE BOTTOM BIT OF AC D +OPSLD3: ANDI D,3 ;ENTRY TO USE BOTTOM TWO BIT OF AC D + MOVE C,D +OPSLC3: ANDI C,3 ;ENTRY TO USE BOTTOM TWO BITS OF AC C +OPSLC7: ANDI C,7 ;ENTRY TO USE BOTTOM THREE BITS OF AC C + ROT C,-1 + ADDI C,(Q) + HRR A,(C) + SKIPL C + HLR A,(C) +OPNSLT: MOVEM A,(R) ;SET USERS IOCHNM + JRST CLKOJ1 + +;BLOCK OUTPUT TO CHARACTER DEVICE +;ADR OF CHR ROUTINE IN E +; THAT ROUTINE MUST NOT CLOBBER C, D, E, OR TT +;C POINTS TO AOBJN POINTER IN USER SPACE +;MUSTN'T CLOBBER J (TTY OUTPUT ASSUMES). + +NBTOCH: XCTR XRW,[MOVES D,(C)] ;CHECK WRITEABILITY OF AOBJN PTR + LDB TT,[410300,,D] ;USE HIGH 3 BITS OF USER PNTR AS CHR CNT + CAIGE TT,3 + POPJ P, ;USER TRYING TO XFER >32K FLUSH + SKIPA TT,BTOCHT-3(TT) ;PICK UP APPROPRIATE BYTE PTR (WORD IN W) +NBTO1: UMOVEM D,(C) ;UPDATE USER'S AOBJN PTR + UMOVE W,(D) ;FETCH CURRENT WORD FROM USER + ILDB A,TT ;FETCH CURRENT CHARACTER + PUSHJ P,(E) ;SEND TO DEVICE + ADD D,[700000,,] ;UPDATE PTR + TLNE D,500000 + JRST NBTO1 ;GO TO NEXT CHR + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WORD + JUMPL D,NBTO1 + UMOVEM D,(C) ;COUNTED OUT, UPDATE FINAL TIME & RETURN + POPJ P, + +BTOCHT: REPEAT 5,<44-<4-.RPCNT>*7>_14+700,,W + +;BLOCK INPUT FROM CHARACTER DEVICE +;E AND C SET UP LIKE NBTOCH +;INTERNALLY LH OF E USED FOR FLAGS: +; 4.9 EOF FLAG (SIGN) +; 4.8 => JUST RETURN WITHOUT ERROR IF AT BEGINNING OF WORD, +; OTHERWISE IGNORE BIT. +; 4.7 => RETURN WITHOUT ERROR EVEN IF NOT AT BEGINNING OF WORD. + +INBTCH: HRRZS E ;CLEAR GARBAGE IN LH + XCTR XRW,[MOVES D,(C)] ;SET UP LIKE NBTOCH + LDB TT,[410300,,D] + CAIGE TT,3 + POPJ P, + SKIPA TT,BTOCHT-3(TT) +INBTO1: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] ;CHECK WRITABILITY OF CURRENT WORD + JUMPL E,INBTO2 ;JUMP IF EOF + PUSH P,C + PUSH P,D + PUSH P,TT + PUSH P,R + HLRZ A,(R) + PUSHJ P,(E) ;RETN CHR IN W + JRST .+3 + TLO E,200000 + TLO E,400000 + MOVE I,W + POP P,R + POP P,TT + POP P,D + POP P,C + LDB W,[410300,,D] + TLNN E,100000 + CAIN W,7 ;SKIP IF NOT AT 1ST CHAR. + TLNN E,300000 + JRST INBTO3 + POPJ P, + +INBTO3: UMOVE W,(D) ;PICK UP CURRENT WORD + IDPB I,TT ;INSERT CHARACTER + UMOVEM W,(D) ;PUT WORD BACK + ADD D,[700000,,] + TLNE D,500000 + JRST INBTO1 ;DO ANOTHER CHR THIS WORD + MOVE TT,BTOCHT+4 + ADD D,[500001,,1] ;INCR TO NEXT WD + SKIPL E ;SKIP IF EOF + JUMPL D,INBTO1 + UMOVEM D,(C) ;DONE, UPDATE POINTER AND RETURN + POPJ P, + +INBTO2: MOVEI I,EOFCH ;EOF, STORE EOF CHARACTER + JRST INBTO3 + +;BLOCK IO TO WORD DEVICE +;C POINTS TO AOBJN POINTER IN USER SPACE +;Q POINTS TO WORD HANDLING ROUTINE (POINTER WILL BE IN C) +;MUST NOT CLOBBER Q OR H (PTR ROUTINES DO POPJ2 SOMETIMES) +;WRDBRT CHECKED FOR ON PDL BY TVC ROUTINES + +WRDBT: MOVE H,C + UMOVE C,(H) ;FETCH USER'S AOBJN POINTER + JUMPGE C,CPOPJ + JRST WRDBT3 + +WRDBT2: PUSHJ P,OPBRK +WRDBT3: ANDI C,-1 + PUSHJ P,(Q) +WRDBRT: JRST WRDBT5 ;NO SKIP - WORD XFERRED + SKIPA C,[1,,1] ;1 SKIP - LAST WORD XFERRED + POPJ P, ;2 SKIPS - EOF, NO WORD XFERRED + XCTR XRW,[ADDM C,(H)] + POPJ P, + +WRDBT5: MOVE C,[1,,1] + XCTR XRW,[ADDB C,(H)] + JUMPL C,WRDBT2 + POPJ P, + +;JSP W,WRDBTI TO DO WRDBT FOR A UNIT MODE INPUT ROUTINE SATISFYING NEW +;CALLING CONVENTION FOR THOSE. +WRDBTI: JSP Q,WRDBT + XCTR XRW,[MOVES (C)] + PUSH P,W + PUSHJ P,(W) + JRST WRDBT4 + JRST POPWJ2 + AOS -1(P) +WRDBT4: UMOVEM W,(C) + MOVEI Q,WRDBTI+1 + POP P,W + POPJ P, + +;CHANGED CONVENTIONS: + ;1) EOF IS NO LONGER CHECKED FOR CHARACTER BY CHARACTER. + ; INSTEAD, THE GET-BUFFER ROUTINE SHOULD SET UP THE BYTE COUNT + ; TO A SMALLER VALUE THAN USUAL. + ; AN ATTEMPT TO GET ANOTHER BUFFER AFTER REACHING EOF + ; SHOULD CAUSE THE GET-BUFFER ROUTINE TO SKIP TWICE. + ;2) THE THE BUFFER POINTER IS NOW A B.P. EVEN IN IMAGE MODE. + ; ALSO, THE L.H. OF THE B.P. IS NOT INITTED HERE. + ; IT MUST BE SET UP BY THE OPEN ROUTINE. ALSO, ACCESS ROUTINES + ; FOR DSK MUST KNOW HOW TO SET IT UP. + ; ALSO, THE BUFFER GET ROUTINE SHOULD SET IT UP, + ; INSTEAD OF RETURNING THE BUFFER ADDRESS IN TT. + ;3) THE BYTE SIZE THE FILE IS OPEN ON IS PASSED AS AN ARGUMENT. + ; THIS ROUTINE WORKS FOR ANY CHANNEL BYTE SIZE WITH ANY + ; SIOT BYTE SIZE. + +;GENERAL BLOCK I/O +;RH OF E HAS # BYTES/WORD OF FILE BYTE SIZE. LH OF E HAS B.P. 44NN00. +;RH(C) = ADDR OF COUNT, IN USER MEMORY +;RH(TT) = ADDR OF USER'S B.P. +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER BYTE POINTER ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +; WHEN THIS ROUTINE IS CALLED, E CONTAINS THE +; NUMBER OF BYTES/WORD (GOOD FOR DETERMINING CHANNEL MODE). +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO, +; IN WHICH CASE IT SHOULD CONTAIN THE NEW NUMBER OF BYTES. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;SIOKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +SIOKT: PUSH P,E + PUSH P,TT + PUSH P,C + JRST SIOKT1 + +;NEXT BUFFER + +SIOKNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST SIOKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST SIOKF1 ;NO. +SIOKN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST SIOKW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +SIOKF: PUSHJ P,UFLS + +SIOKF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST SIOKN1 ;HMM, HAVE TO WAIT + JRST SIOKT1 ;BUFFER HAS BEEN GOT. + JRST POP3J1 ;EOF, TRANSFER IS COMPLETE + +SIOKT1: UMOVE TT,@(P) ;GET COUNT OF BYTES TO TRANSFER + JUMPLE TT,POP3J1 ;COUNT DECREMENTED TO 0; TRANSFER DONE. + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST SIOKNB ;NEW BUFFER NEEDED + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + UMOVE J,@-1(P) + IBP J + LDB D,[301400,,J] + MOVE C,@(B) + IBP C ;TO TRANSFER WORD-WISE, BOTH B.P.'S MUST + HRL J,C + LDB C,[301400,,C] + CAIE C,(D) ;HAVE SAME BYTE SIZE, + JRST SIOKS1 + LDB D,[060600,,C] + ANDI C,77 + ADDI C,(D) +;DROPS THROUGH + ;DROPS IN + CAIGE TT,@-2(P) ;THERE MUST BE AT LEAST 1 WORD TO TRANSFER, + JRST SIOKS1 + CAIE C,44 ;AND MUST BE ABOUT TO START THE NEXT WORD. + JRST SIOKSL + PUSH P,TT+1 + IDIVI TT,@-3(P) ;GET # WDS TO BLT + POP P,TT+1 + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + SKIPGE (B) + JRST SIOKN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +SIOKN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +SIOKN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + XCTR XRW,[ADDM J,@-1(P)] + IMULI J,@-2(P) + MOVNS J + XCTR XRW,[ADDM J,@(P)] + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT +SIOKN3: SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, DISCARD (MAY COME BACK TO LIFE). + JRST SIOKT1 ;TRY AGAIN TO TRANSFER. + +SIOKW1: PUSHJ P,UDELAY + JRST SIOKF1 + +SIOKN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST SIOKN7 + JRST SIOKN8 + +;COME HERE FOR SLOW (BYTE AT A TIME) SIOT TO BLOCK MODE DEVICE. +;TT HAS NUMBER OF BYTES TO TRANSFER - IT IS KNOWN THAT THE DEVICE +;CAN SUPPLY THAT MANY FROM ITS CURRENT BUFFER. +SIOKSL: SUBM C,D ;D GETS SIZE; C HAS # BITS REMAINING TO BE HANDLED + IDIV C,D ;C GETS # BYTES TO XFER TILL REACH WORD BOUNDARY. + MOVE TT,C ;XFER THAT MANY, THEN TRY AGAIN, SO WILL USE FAST MODE. +SIOKS1: SKIPL (B) + JRST SIOKSI ;INPUT AND OUTPUT PART HERE + LDB D,[300600,,@(B)] ;BYTE SIZE IN THE BUFFER + MOVEI C,36. + IDIV C,D ;D := # EXTRA BITS AT RIGHT END OF WORD + MOVEI J,1 + LSH J,(D) + SOS J ;J := MASK FOR THEM + UMOVE C,@-1(P) ;GET COPY OF USER'S B.P. FOR SWAPPING IN PAGES. +SIOKS3: IBP C ;IF NOT FOR THESE 2 INSNS, ILDB MIGHT GET PAGE FAULT + UMOVE (C) ;WHICH WOULD CAUSE EXTRA INCREMENTING OF B.P. + XCTR XBYTE,[ILDB D,@-1(P)] ;FETCH NEXT BYTE, + IDPB D,@(B) + MOVE D,@(B) + ANDCAM J,(D) ;TURN OFF EXTRA BITS IN THIS WORD OF BUFFER + SOS @1(B) + XCTR XRW,[SOS @(P)] + SOJG TT,SIOKS3 + JRST SIOKN3 + +SIOKSI: UMOVE C,@-1(P) ;GET COPY OF USER'S B.P., FOR WRITEABILITY TESTING. +SIOKS2: IBP C + XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE IN NEXT BYTE. + ILDB D,@(B) ;GET NEXT BYTE FROM DEVICE BUFFER + XCTR XBYTE,[IDPB D,@-1(P)];GIVE IT TO USER. + XCTR XRW,[SOS @(P)] ;UPDATE USER'S COUNT + SOS @1(B) ;AND THE SYSTEM'S COUNT. + SOJG TT,SIOKS2 + JRST SIOKN3 + +;CONVENIENT EXIT ROUTINE FOR BUFFER-GET ROUTINES. +;ASSUMES ADDR OF START OF BUFFER IN TT, +;SIZE (IN WORDS) OF DATA AREA IN J. +;E SHOULD HAVE WHAT IT HAD WHEN SIOKT WAS CALLED. +SIOBGX: IMULI J,(E) +SIOBG1: HLL TT,E +SIOBG2: MOVEM TT,@(B) + MOVEM J,@1(B) + JRST POPJ1 + +;BYTE AT A TIME I/O TO BLOCK MODE DEVICE +;SEE PRECEDING PAGE (SIOKT) FOR COMMENTS ON CALLING SEQUENCE +;EXCEPT: ON INPUT, VALUE RETURNED IN W, AND C,D HAVE NO SIGNIFICANCE; +;ON OUTPUT, RH(C) HAS ADDRESS OF ARG, SIGN(C) SET IFF ADDRESS IS EXEC-MODE, +; AND D HAS NO SIGNIFICANCE. + +CHRKT: SKIPGE (B) + JRST CHRKTO ;WRITING + JRST CHRKTI ;READING + +CHRKTI: SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + ILDB W,@(B) ;READ - GET NEXT CHAR + POPJ P, + +CHRKTO: SKIPGE C ;USED WHEN FILLING OUT BLOCK AT CLOSE, AND ELSEWHERE. + SKIPA J,(C) + UMOVE J,(C) ;GET CHAR. FROM USER + SOSGE @1(B) ;DECREMENT ACTIVE CHAR COUNT + JRST CHRKT1 ;GET NEW BUFFER + IDPB J,@(B) ;DEPOSIT IN BUFFER + CAIE E,5 ;SKIP IF ASCII + POPJ P, + MOVEI J,1 + MOVE D,@(B) + ANDCAM J,(D) ;CLEAR EXTRA BIT + POPJ P, + +CHRKT1: AOS @1(B) ;COMPENSATE FOR OVER-SOS + PUSHJ P,@3(B) ;GET RID OF THIS BUFFER + SKIPLE J,@1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST CHRKT ;SPRUNG BACK TO LIFE (LAST BLOCK OF FILE WRITE OVER) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST CHRKF1 ;NO. +CHRKN1: SKIPG 5(B) ;HAVE TO WAIT + JRST [ PUSHJ P,UDELAY + JRST CHRKF1 ] + XCT 5(B) ;DEVICE WAIT + PUSHJ P,UFLS + +CHRKF1: PUSHJ P,@2(B) ;GOBBLE NEW BLOCK + JRST CHRKN1 ;NOT READY, WAIT + JRST CHRKT + CAME E,[444400,,1] + JRST UNIEOF ;READING PAST EOF IN ASCII MODE. + JRST IOCER2 ;READING PAST EOF IN IMAGE MODE. + +;GENERAL BLOCK I/O +;E HAS BPLH,,# BYTES/WORD OF FILE BYTE SIZE - MUST BE 444400,,1 +;RH(C) = ADDR OF AOBJN POINTER +; AND 4.9 => AOBJN PTR IS IN EXEC ADDRESS SPACE, +; 4.8 => BLOCK IT POINTS TO IS IN EXEC ADDRESS SPACE. (INPUT ONLY) +; ARGUMENTS B -> +;0(B) ADDR OF ACTIVE BUFFER BYTE PTR, 4.9=0 => INPUT, =1 => OUTPUT +;1(B) ADDR OF COUNT OF BYTES REMAINING IN CURRENT BUFFER +;2(B) ROUTINE TO GET NEXT BUFFER. NO SKIP IF NO MEMORY +; OTHERWISE SKIP; BUFFER BYTE COUNT IN @1(B) +; AND BUFFER B.P. IN @(B) ALREADY SET UP. +; 2 SKIPS => THERE IS NO BUFFER, DUE TO EOF. +;3(B) ROUTINE TO PUT BUFFER (OUTPUT) OR DISCARD (INPUT) +; MAY REACTIVATE CURRENT BUFFER BY SETTING @1(B) TO NONZERO. +;4(B) NOT USED +;5(B) IF POSITIVE, INSTRUCTION TO WAIT FOR I/O +; IF NEGATIVE, ROUTINE ASSUMES 2(B) AND 3(B) WILL WAIT + +;RELOADING ROUTINES MUST NOT CLOBBER B,E,A,C,I +;BLKT CLOBBERS C,D,J,TT, AND WHATEVER THE RELOADING ROUTINES CLOBBER. + +;CODE IS ON NEXT PAGE + +BLKT: CAME E,[444400,,1] + BUG ;BLKT CALLED ON UNIT ASCII MODE CHANNEL?? + SKIPL C ;SKIP IF POINTER IN USER SPACE + XCTR XRW,[MOVES (C)] ;USER SPACE, MAKE SURE WRITE CYCLE WILL WIN + JRST BLKT1 + +;NEXT BUFFER + +BLKTNB: PUSHJ P,@3(B) ;"DISCARD" BUFFER + SKIPE @1(B) ;CHECK AMOUNT REMAINING ONE MORE TIME + JRST BLKT1 ;IT SPRUNG BACK TO LIFE (WRITE OVER MODE LAST BLOCK OF FILE) + SKIPG 5(B) ;NEED TO WAIT FOR DEVICE? + JRST BLKTF1 ;NO. +BLKTN1: SKIPG 5(B) ;COME HERE IF MUST WAIT FOR SOME REASON OR OTHER + JRST BLKTW1 ;DEVICE CAN'T WAIT SO UDELAY + XCT 5(B) ;DEVICE WAIT +BLKTF: PUSHJ P,UFLS + +BLKTF1: PUSHJ P,@2(B) ;NOW GET NEXT BUFFER + JRST BLKTN1 ;HMM, HAVE TO WAIT + JRST BLKT1 + POPJ P, ;EOF, TRANSFER FINISHED + +BLKT1: SKIPGE C ;SET UP FOR TRANSFER + SKIPA J,(C) ;GET EXEC MODE BLOCK .IOT (AOBJN) POINTER + UMOVE J,(C) ;GET USER MODE AOBJN POINTER + JUMPGE J,CPOPJ ;POINTER COUNTED OUT, TRANSFER DONE + SKIPG D,@1(B) ;CHECK AMOUNT LEFT IN BUFFER + JRST BLKTNB ;NEW BUFFER NEEDED + HLRE TT,J + MOVNS TT ;DESIRED SIZE OF BLOCK + CAMLE TT,D ;AMT OF ROOM LEFT IN CURRENT BUFFER + MOVE TT,D ;TRANSFER ONLY AMT LEFT IN BUFFER + MOVE D,@(B) ;CANONICALIZE THE BUFFER B.P. SO RH => NEXT WORD TO XFER + IBP D + HRL J,D ;MERGE WITH USER'S BLOCK ADDR TO GET BLT AC. + SKIPGE (B) + MOVSS J ;WRITING, SWAP BLT POINTER + MOVE D,J + ADDI TT,(D) ;1+LAST WORD TO BLT INTO + TLNE C,200000 + JRST BLKTN9 ;JUMP IF EXEC AOBJN POINTER + SKIPGE (B) + JRST BLKTN6 ;JUMP IF WRITING + XCTRI XBW,[BLT D,-1(TT)] ;READING +BLKTN7: MOVEI D,(TT) ;NO FAULT, UPDATE PTR TO LAST WORD + 1 (LIKE KL10) +BLKTN8: SUBM D,J + HRRZS J ;# WDS ACTUALLY XFERRED + ADDM J,@(B) ;INCR BUFFER PNTR + HRLS J ;PUT # WDS IN BOTH HALVES + JUMPL C,BLKTN3 ;UPDATE AOBJN PTR IN EXEC SPACE + XCTRI XRW,[ADDM J,(C)] ;UPDATE AOBJN PTR IN USER SPACE + JRST .+2 + BUG ;MUMBLE. THIS WAS SUPPOSED TO BE THERE. + +BLKTN4: MOVNI J,(J) + ADDM J,@1(B) ;DECREMENT COUNT LEFT IN BUFFER + CAIE D,(TT) ;SKIP IF TRANSFERRED ALL WE COULD + PUSHJ P,TPFLT ;TAKE FAULT IF ANY + SKIPN @1(B) + PUSHJ P,@3(B) ;BUFFER EXHAUSTED, "DISCARD" + JRST BLKT1 ;GO TRANSFER ANOTHER CHUNK + +BLKTN3: ADDM J,(C) ;UPDATE EXEC AOBJN POINTER + JRST BLKTN4 + +BLKTW1: PUSHJ P,UDELAY + JRST BLKTF1 + +BLKTN6: XCTRI XBR,[BLT D,-1(TT)] ;WRITING TRANSFER + JRST BLKTN7 + JRST BLKTN8 + +BLKTN9: BLT D,-1(TT) ;READING INTO EXEC SPACE + JRST BLKTN7 + +SUBTTL DIRECTORY AND ERR DEVICES + +QMLSTF: MOVEI J,4 ;ENTRY TO GET MASTER 2314 DIRECTORY + JRST LISTF7 + +QLISTF: MOVEI J,3 ;ENTRY FOR 2314 USER DIRECTORY +LISTF7: MOVEI I,0 +LISTFE: PUSHJ P,SWTL ;ENTER HERE FOR ALL KINDS OF DIRECTORIES. + UDCSW + MOVSI TT,-NUDCH +UD1: SKIPGE UDUSR(TT) + JRST UD2 + AOBJN TT,UD1 + PUSHJ P,LSWPOP + PUSHJ P,UDELAY ;DIRECTORY NOT AVAILABLE NOW, WAIT + JRST LISTFE + +UD2: MOVEM J,DSKLST(TT) + MOVEM I,UDUSR(TT) + MOVEM U,UDUIND(TT) + PUSHJ P,LSWPOP + MOVE Q,USYSN1(U) + MOVEM Q,UDSYSN(TT) + JUMPG J,UDIF ;JUMP IF NOT UTAPE DIR. +IFE NUNITS, BUG ;HOW DID UTAPE GET HERE? +IFN NUNITS,[ + CONO PI,CLKOFF + MOVE Q,UDIRO(I) + MOVEM Q,DIRPT(TT) + CONO PI,CLKON + MOVEI J,200 + TRNE D,2 + JRST UDBIN ;IMAGE MODE UTAPE DIR + MOVEI Q,LISTF ;ASCII MODE UTAPE DIR +] +UDIF1: MOVEM Q,DIRPC(TT) + HRL A,TT + JSP Q,OPSLD1 + DIRCHN,,DIRBN + +UDIF: HLRZ Q,UDT-1(J) ;INITIAL COROUTINE PC + HRRZ T,UDT-1(J) ;PLACE TO FINISH OPENING - USUALLY UDIF1. + JRST (T) + +UQL1: HRRZM H,UUDPP(TT) ;2314 MFD (FROM UDIF) + MOVEI J,2000 + TRNE D,2 + JRST QUDBIN + JRST UDIF1 + +UQL1A: PUSHJ P,STMSET ;DISK UFD (FROM UDIF). WE CAN STILL PCLSR, + UDUSR(TT) ;ARRANGE TO GIVE BACK THE DIRECTORY CHANNEL. +UQL1B: PUSH P,TT + PUSHJ P,QUDLK + PUSHJ P,TCALL ;GET A LOW-HALF PAGE TO COPY UFD INTO. + JRST IOMQ ;GET LOW HALF PAGE + JRST UQL1W ;NOT AVAIL NOW + MOVEI T,MU23LS + DPB T,[MUR,,MEMBLT(A)] ;MARK THE PAGE AS A UFD COPY. + LSH A,10. + MOVEM A,DIRPT(TT) + MOVEM A,UUDPP(TT) + HRL A,QSNLCN(H) + HRRI T,2000(A) + BLT A,-1(T) ;COPY UFD + PUSHJ P,QUDULK + PUSHJ P,LSWDEL ;STMSET OF UDUSR. + SKIPG QSNNR(H) + BUG ;WE ALWAYS GET OUR MAN + PUSHJ P,LSWPOP ;SOS QSNNR + POP P,TT + MOVEI J,2000 + TRNE D,2 + JRST UDBIN + JRST UDIF1 + +UQL1W: PUSHJ P,QUDULK + POP P,TT + PUSHJ P,UDELAY + JRST UQL1B + +;LH INITIAL PC RH DISP ADR AT OPEN TIME +UDT: NDLF,,UDIF1 ;NON DIR DEVICE + UCL1,,UDIF1 ;CORE LINK + UQL2,,UQL1A ;2314 UFD + QMLS1,,UQL1 ;2314 MFD + ERR1,,ERR2 ;ERR DEVICE + TTYFLD,,UDIF1 ;TTY DIR + TTYF99,,UDIF1 ;COR DIR (LAST LINE OF TTY DIR) +UDTLN==.-UDT + +QUDBIN: HRRZ T,QMDRO + MOVEM T,DIRPT(TT) +UDBIN: MOVEM J,NUM(TT) ;DOESN'T USE DIRPC THIS PC + MOVEM J,ENDT(TT) + MOVEI J,444400 + HRLM J,DIRPT(TT) + HRL A,TT + JSP Q,OPSLD1 + NDATAI,,NBLKI + +UTDCLS: MOVE B,DSKLST(A) + CAIN B,3 + JRST UTDCL1 +UTDCLX: SETOM UDUSR(A) + POPJ P, + +UTDCL1: PUSH P,A + MOVE A,UUDPP(A) + LSH A,-10. + PUSHJ P,MEMR + POP P,A + JRST UTDCLX + +;UNIT MODE IOT ON DIR DEVICE COMES HERE (RETURN CHAR IN W) +DIRCH: SETOM SRN3(U) ;SAY WE WANT ONLY 1 CHARACTER. + PUSHJ P,DIRCHR + HRRZ W,I + CAIN W,^C + JRST UNIEOF + POPJ P, + +;BLOCK MODE IOT ON DIR DEVICE. +DIRB: JSP Q,WRDBT ;PUSHJ'S TO .+1 FOR EACH WORD. +DIRB1: XCTR XRW,[MOVES (C)] ;MAKE SURE WE CAN WRITE. + PUSH P,C + PUSH P,H + SETZM SRN3(U) ;SAY WE WANT A WHOLE WORD OF CHARS. + PUSHJ P,DIRCHR + POP P,H + POP P,C + LDB Q,[350700,,SRN3(U)] + CAIN Q,^C ;IF THE WORD STARTS WITH ^C, + JRST POPJ2 ;IT IS EOF; DON'T RETURN IT, UNHANG IOT. + MOVE Q,SRN3(U) + UMOVEM Q,(C) + MOVEI Q,DIRB1 ;FASTER THAN PUSHING AND POPPING Q. + POPJ P, ;RETURN INTO WRDBT + + SKIPA T,[SIOKT] +DDATAI: MOVEI T,CHRKTI ;UNIT IMAGE INPUT FROM DIRECTORY. + CAIA +DBLKI: MOVEI T,BLKT ;BLOCK IMAGE INPUT FROM DIRECTORY + MOVE E,[444400,,1] + JSP B,(T) ;TO BLKT, SIOKT, OR CHRKTI + DIRPT(A) + NUM(A) + POPJ2 ;EOF IF TRY TO GET ANOTHER BUFFER + CPOPJ ;BUFFER DISCARD ROUTINE + BUG + SKIPA + +;ERR DEVICE AND ERROR MESSAGE TABLES +; ERR DEVICE WORKS MUCH LIKE DIR DEVICE + +ERRO: MOVEI J,5 + JRST LISTF7 + +ERR2: SOJE A,ERR21 ;LAST ERRONEOUS CHANNEL + SOJE A,ERR22 ;CHANNEL SPECIFIED IN B + SOJE A,ERR23 ;STATUS WORD IN B + SOJE A,ERR24 ;.CALL ERROR ARG IN B + SETOM UDUSR(TT) + JRST OPNL11 + +ERR21: LDB B,[BCHPTR] +ERR22: ANDI B,17 + ADDI B,IOCHST(U) + SKIPA B,(B) +ERR24: MOVSS B +ERR23: MOVEM B,UUDPP(TT) + JRST UDIF1 + +CORO: PUSHJ P,FLDRCK + JRST OPNL11 + MOVEI J,7 + JRST LISTF7 + +ERR1: SKIPN I,UUDPP(A) + JRST ERR3 + LDB B,[220600,,UUDPP(A)] ;OPEN LOSS FIELD + JUMPE B,ERR1B + CAIL B,NERMES+1 + MOVEI B,NERMES+1 + MOVE TT,ERMST1-1(B) + JSP B,MESPNT +ERR1B: LDB B,[300300,,UUDPP(A)] ;IDS ERROR FIELD + JUMPE B,ERR1C + MOVE TT,ERMST2-1(B) + JSP B,MESPNT +ERR1C: LDB B,[330400,,UUDPP(A)] ;IOCERR FIELD + JUMPE B,UCL7 + CAIL B,MIOTER + CAIL B,NERM1+MIOTER + MOVEI B,NERM1+MIOTER + MOVE TT,ERMST3-MIOTER(B) + JSP B,MESPNT + JRST UCL7 + +ERR3: MOVEI TT,[ASCIZ /ISE0 +/] + JSP B,MESPNT + JRST UCL7 + +;LISP ASSUMES THAT NO "ERR" DEVICE MESSAGE WILL EVER CONTAIN +; !, #, ^, OR LOWER CASE LETTERS. PLEASE MAINTAIN THIS STATE +; GLS (GUY STEELE) + +ERMST1: [ASCIZ /NO SUCH DEVICE +/] + [ASCIZ /WRONG DIRECTION +/] + [ASCIZ /TOO MANY TRANSLATIONS +/] + [ASCIZ /FILE NOT FOUND +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /DEVICE NOT READY +/] + [ASCIZ /DEVICE NOT AVAILABLE +/] + [ASCIZ /ILLEGAL FILE NAME +/] + [ASCIZ /MODE NOT AVAILABLE +/] + [ASCIZ /FILE ALREADY EXISTS +/] + [ASCIZ /BAD CHANNEL NUMBER +/] + [ASCIZ /TOO MANY ARGUMENTS (CALL) +/] + [ASCIZ /PACK NOT MOUNTED +/] + [ASCIZ /DIRECTORY NOT AVAIL +/] + [ASCIZ /NON-EXISTENT DIRECTORY +/] + [ASCIZ /LOCAL DEVICE ONLY +/] + [ASCIZ /SELF-CONTRADICTORY OPEN +/] + [ASCIZ /FILE LOCKED +/] + [ASCIZ /M.F.D. FULL +/] + [ASCIZ /DEVICE NOT ASSIGNABLE TO THIS PROCESSOR +/] + [ASCIZ /DEVICE WRITE-LOCKED +/] + [ASCIZ /LINK DEPTH EXCEEDED +/] + [ASCIZ /TOO FEW ARGUMENTS (CALL) +/] + [ASCIZ /CAN'T MODIFY JOB +/] + [ASCIZ /CAN'T GET THAT ACCESS TO PAGE +/] + [ASCIZ /MEANINGLESS ARGS +/] + [ASCIZ /WRONG TYPE DEVICE +/] + [ASCIZ /NO SUCH JOB +/] + [ASCIZ /VALID CLEAR OR STORED SET +/] + [ASCIZ /NO CORE AVAILABLE +/] + [ASCIZ /NOT TOP LEVEL +/] + [ASCIZ /OTHER END OF PIPELINE GONE OR NOT OPEN +/] + [ASCIZ /JOB GONE OR GOING AWAY +/] + [ASCIZ /ILLEGAL SYSTEM CALL NAME +/] + [ASCIZ /CHANNEL NOT OPEN +/] + [ASCIZ /INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL +/] + [ASCIZ /UNRECOGNIZABLE FILE +/] + [ASCIZ /LINK TO NON-EXISTENT FILE +/] +IFN .-ERMST1-NOPNLS,.ERR WRONG TABLE LENGTH +;ADD NEW MESSAGES HERE + +IFN 0,[ A CLASSIFICATION OF OPEN-LOSS MESSAGES + +FULL - NO CORE (MMP FULL) + DIR NOT AVAIL (DIR CHNL TABLE FULL) + DEVICE FULL + DIR FULL + MFD FULL + INPUT BUFFER EMPTY OR OUTPUT BUFFER FULL + +NO SUCH - DEVICE, FILE, JOB, DIRECTORY, PAGE (CAN'T GET ACCESS) + ILLEGAL SYSTEM CALL NAME + +ALREADY ONE SUCH - FILE (FILE ALREADY EXISTS - RENAME) + +WRITING - CAN'T MODIFY JOB + DEVICE WRITE-LOCKED + WRONG DIRECTION + MODE NOT AVAILABLE + CAN'T GET ACCESS TO PAGE + +ARGS (THE PARAMETERS ARE RIDICULOUS) - + SELF-CONTRADICTORY OPEN COMMAND + ILLEGAL FILE NAME + BAD CHANNEL NUMBER + TOO FEW ARGS + TOO MANY ARGS + MEANINGLESS ARGS + CHANNEL NOT OPEN + +NOT AVAILABLE (IT EXISTS BUT YOU CAN'T USE IT) - + DEVICE NOT READY + DEVICE NOT AVAILABLE + NOT ASSIGNABLE TO THIS PROCESSOR + LOCAL DEVICE + PACK NOT MOUNTED + FILE LOCKED + OTHER END OF PIPELINE GONE + JOB GONE OR GOING AWAY + +DEPTH - LINK DEPTH EXCEEDED + TOO MANY TRANSLATIONS + +OTHER - NOT TOP LEVEL + VALID CLEAR OR STORED SET +] + +NERMES==.-ERMST1 + [ASCIZ /OPEN TYPE NOT DETERMINED +/] + +ERMST2: [ASCIZ /IDS ILLEGAL SCOPE MODE +/] + [ASCIZ /IDS SCOPE HUNG +/] + [ASCIZ /MORE THAN 1K SCOPE BUFFER +/] + [ASCIZ /IDS MEM PROTECT +/] + [ASCIZ /IDS ILLEGAL SCOPE OP +/] + [ASCIZ /IDS MEM PROTECT ON PDL PNTR +/] + [ASCIZ /IDS ILLEGAL PARAMETER SET +/] + +ERMST3: [ASCIZ /DEVICE HUNG OR REPORTING NON-DATA ERROR +/] + [ASCIZ /END OF FILE +/] + [ASCIZ /NON-RECOVERABLE DATA ERROR +/] + [ASCIZ /NON-EXISTENT SUB DEVICE +/] + [ASCIZ /OVER IOPOP +/] + [ASCIZ /OVER IOPUSH +/] + [ASCIZ /USR OP CHNL DOES NOT HAVE USR OPEN +/] + [ASCIZ /CHNL NOT OPEN +/] + [ASCIZ /DEVICE FULL +/] + [ASCIZ /CHNL IN ILLEGAL MODE ON IOT +/] + [ASCIZ /ILLEGAL CHR AFTER CNTRL P ON TTY DISPLAY +/] + [ASCIZ /DIRECTORY FULL +/] + [ASCIZ /DIRECTORY'S ALLOCATION EXHAUSTED +/] +;INSERT NEW MESSAGES HERE +NERM1==.-ERMST3 + [ASCIZ /IOT OR OPR TYPE NOT DETERMINED +/] + +;DIRECTORY LISTING ROUTINES + +UQL3C: SKIPA I,["*] +UQL3: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL3A + +UQL2: MOVEI TT,[MNAME ASCIZ /, /] ;GENERATE USER DIRECTORY + JSP B,MESPNT + MOVE I,UUDPP(A) + MOVEI J,UDNAME(I) + JSP B,SIXTYC ;SEND DIRECTORY NAME + MOVEI TT,[ASCIZ / +FREE BLOCKS /] + JSP B,MESPNT + MOVSI E,-NQS +UQL2A: SKIPGE QACT(E) + JRST UQL3 ;UNIT NOT ENGAGED + MOVE J,QTUTO(E) + TLNE J,40000 + JRST UQL3C ;TUT FOR UNIT NOT IN + MOVEI I,"# + PUSHJ P,OUTC + MOVE TT,QPKID(E) + JSP B,GDPT ;AND # + MOVEI I,"= + PUSHJ P,OUTC + MOVE TT,QSFT(E) + JSP B,GDPT ;AND # FREE TRACKS +UQL3A: PUSHJ P,OUTCS + AOBJN E,UQL2A + JSP B,MESPCR + MOVE I,UUDPP(A) + MOVEM I,DIRPT(A) + MOVE Q,UDNAMP(I) +UQL4: CAIL Q,2000 + JRST UCL7 + HRLI I,440600+Q + HLLM I,DIRPT(A) + +UQLP: ADDI Q,2 ;MOVE PNTR TO 3RD WRD OF FILE DESC + MOVE I,@DIRPT(A) + MOVEI TT,[ASCIZ /* /] ;DELETED OR BEING WITTEN + TLNN I,UNIGFL + MOVEI TT,[ASCIZ / /] + JSP B,MESPNT + MOVE I,@DIRPT(A) + TLNE I,UNLINK + JRST UQLL1 ;LINK + LDB TT,[UNPKN+@DIRPT(A)] + JSP B,GDPT ;PRINT PACK # + LDB TT,[UNPKN+@DIRPT(A)] + CAIG TT,9 +UQLL2: PUSHJ P,OUTCS + PUSHJ P,OUTCS + SUBI Q,2 ;BACK TO FIRST WD + JSP B,SIXTYA ;SEND FIRST FILE NAME + JSP B,SIXTYB ;AND SECOND (AOSES Q) + PUSHJ P,OUTCS + AOS Q ;SET Q TO POINT TO FILE DESC PNTR + LDB E,[UNDSCP+@DIRPT(A)] ;PICK UP FILE DESC PNTR + IDIVI E,UFDBPW + ADDI E,UDDESC ;COMPUTE WORD ADDRESS + MOVE I,@DIRPT(A) ;SAVE STATUS WORD + EXCH E,Q ;MOVE INTO PNTR + MOVE TT,QBTBLI(TT) + TLO TT,Q + HLLM TT,DIRPT(A) ;SET UP DIRPT TO POINT TO FILE DESC + TLNE I,UNLINK + JRST QLL1 ;LINK + MOVEI TT,0 +UQL5: JSP B,UQL5R ;CHECK IF ABOUT TO INCREMENT OFF WORD + ILDB I,DIRPT(A) + JUMPE I,UQL5A ;STOP + CAILE I,UDTKMX + JRST UQL5B + ADD TT,I + JRST UQL5 + +UQLL1: MOVEI I,"L + PUSHJ P,OUTC + JRST UQLL2 + +QLL1: CLEARM ENDT(A) ;CNTS TO 3 FOR USER NAME AND 2 FILE NAMES +QLL3: CLEARM NUM(A) ;CHR CNTR +QLLIST: JSP B,UQL5R + ILDB I,DIRPT(A) + JUMPE I,QLL4 + CAIN I,'; + JRST QLL2 + CAIN I,': + JRST QLL5 +QLL5A: ADDI I,40 + PUSHJ P,OUTC + AOS I,NUM(A) + CAIGE I,6 + JRST QLLIST +QLL2: PUSHJ P,OUTCS + AOS I,ENDT(A) + CAIGE I,3 + JRST QLL3 +QLL4: JSP B,MESPCR + MOVEI Q,3(E) ;ADVANCE Q + JRST UQL4 + +QLL5: JSP B,UQL5R + ILDB I,DIRPT(A) + JRST QLL5A + +UQL5R: MOVE I,DIRPT(A) ;CHECK IF ABOUT TO ILDB OFF WORD + TLNE I,770000 + JRST (B) ;NO + MOVEI I,440600+Q ;YES INCREMENT Q INSTEAD + HRLM I,DIRPT(A) + AOJA Q,(B) + +UQL5B: CAIGE I,UDWPH ;PLACE HOLDER + AOJA TT,UQL5 ;SKIP AND TAKE + CAIN I,UDWPH + JRST UQL5 ;NULL + REPEAT NXLBYT,[JSP B,UQL5R + IBP DIRPT(A) +] + AOJA TT,UQL5 ;SPACE OVER 2ND HALF OF LOAD ADDRESS + +UQL5A: JSP B,GDPT ;TYPE OUT # BLOCKS + PUSHJ P,OUTCS + MOVE Q,E ;FILE POINTER + MOVEI I,"! + SKIPGE B,@DIRPT(A) ;SKIP ON NOT DUMPED + MOVEI I,40 + PUSHJ P,OUTC ;HAS NOT BEEN BACKED UP + MOVEI I,"$ + TLNN B,UNREAP ;SKIP ON DON'T-REAP + MOVEI I,40 + PUSHJ P,OUTC + MOVEI Q,1(E) + LDB E,[1200,,DIRPT(A)] + JUMPN E,[JRST 4,.] + MOVE TT,@DIRPT(A) + AOJE TT,UQL5C ;DATE NOT KNOWN + LDB TT,[UNMON+@DIRPT(A)] + JSP B,GDPT ;TYPE MONTH + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNDAY+@DIRPT(A)] + JSP B,GDPT ;TYPE DAY + MOVEI I,"/ + PUSHJ P,OUTC + LDB TT,[UNYRB+@DIRPT(A)] + JSP B,GDPT ;TYPE YEAR + PUSHJ P,OUTCS + HRRZ TT,@DIRPT(A) + IDIVI TT,60.*60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + IDIVI TT,60.*2 + MOVE E,I + JSP B,G2DPT + MOVEI I,": + PUSHJ P,OUTC + MOVE TT,E + LSH TT,-1 + JSP B,G2DPT +UQL5D: JSP B,MESPCR + ADDI Q,2 ;ADVANCE Q + JRST UQL4 + +UQL5C: MOVEI I,"- + PUSHJ P,OUTC + JRST UQL5D + +;GENERATE MFD LISTING +QMLS1: CONO PI,CLKOFF + MOVE Q,QMDRO + HRLI Q,440600+Q + MOVEM Q,DIRPT(A) + MOVE Q,MDNAMP(Q) + CONO PI,CLKON +QMLS2: CAIL Q,1777 + JRST UCL7 + SKIPN @DIRPT(A) + JRST QMLS3 + JSP B,SIXTYA + JSP B,MESPCR +QMLS3: ADDI Q,LMNBLK + JRST QMLS2 + +;DIRECTORY LISTING ROUTINES FOR UTAPE + +IFN NUNITS,[ +LISTF: MOVEI Q,220600+Q + HRLM Q,DIRPT(A) + MOVEI Q,177 + MOVE TT,@DIRPT(A) + AOJE TT,LISTF1 + JSP B,SIXTYP +LISTF1: MOVEI TT,[ASCIZ / +FREE FILES /] + JSP B,MESPNT + MOVSI Q,-23. + MOVEI TT,0 +LISTF4: SKIPE @DIRPT(A) + AOJA Q,LISTF8 + AOS Q + SKIPN @DIRPT(A) + AOS TT +LISTF8: AOBJN Q,LISTF4 + JSP B,GDPT + MOVEI TT,[ASCIZ / FREE BLOCKS /] + JSP B,MESPNT + SETZB J,TT + JSP B,BLKPNT +LISTD2: JSP B,MESPCR + MOVSI Q,-23. +LISTF2: MOVEI I,440600+Q + HRLM I,DIRPT(A) + MOVE I,@DIRPT(A) + JUMPE I,LISTF5 +LISTF6: PUSHJ P,OUTCS + JSP B,SIXTYA + JSP B,SIXTYB + PUSHJ P,OUTCS + MOVEI J,1(Q) + JSP B,BLKPNN +LISTD4: JSP B,MESPCR +LISTF3: AOBJN Q,LISTF2 +];END IFN NUNITS + +UCL7: MOVEI I,14 ;END DIR WITH FORMFEED AND EOF CHARS + PUSHJ P,OUTC + HRROI I,EOFCH + JRST .-2 + +IFN NUNITS, LISTF5: AOJA Q,LISTF3 + +; DIRECTORY LISTING ROUTINES FOR MISC. DEVICES + CORE LINK + +NDLF: MOVEI TT,[ASCIZ / +NON-DIRECTORY DEVICE/] + JSP B,MESPNT + JRST UCL7 + +;DIRECTORY OF CORE LINK DEVICE +UCL1: MOVSI Q,-NCLCH +UCL6: SKIPN CLSYN(Q) + JRST UCL5A + MOVEI J,CLSYN(Q) + JSP B,SIXTYC + MOVEI J,CLN1(Q) + JSP B,SIXTYC + MOVEI J,CLN2(Q) + JSP B,SIXTYC + HLRE B,CLUSR(Q) + AOJE B,UCL2 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL3: MOVEI TT,[ASCIZ /->/] + JSP B,MESPNT + HRRE B,CLUSR(Q) + AOJE B,UCL4 + MOVEI J,UNAME-1(B) + MOVEM B,NUM(A) + JSP B,SIXTYC + MOVE B,NUM(A) + MOVEI J,JNAME-1(B) + JSP B,SIXTYC +UCL5: JSP B,MESPCR +UCL5A: AOBJN Q,UCL6 + JRST UCL7 + +UCL4: MOVEI B,UCL5 + JRST .+2 +UCL2: MOVEI B,UCL3 + MOVEI J,[SIXBIT /CLOSED/] +SIXTYC: HRLI J,440600 + MOVEM J,DIRPT(A) + PUSHJ P,OUTCS + JRST SIXTYP + +; DIRECTORY LISTING ROUTINES FOR TTY + +TTYFLD: MOVEI TT,[ASCIZ / +TTY UNAME JNAME CORE TOTAL IDX +/] + JSP B,MESPNT + MOVSI Q,-NCT +TTYF1: HRRE E,TTYSTS(Q) + AOJE E,TTYF5 ;JUMP IF NOT IN USE + MOVE E,TTYSTS(Q) + MOVEI I,"T ;TTY + TLNN E,%TSCNS + MOVEI I,"D ;"DEVICE" + PUSHJ P,OUTC + HRRZ TT,Q + JSP B,G2OPT + HRRZS E +TTYF11: MOVEI J,UNAME(E) + JSP B,SIXTYC + MOVEI J,JNAME(E) + JSP B,SIXTYC + PUSHJ P,OUTCS + MOVE TT,NMPGS(E) + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + MOVEM E,DIRPT(A) + MOVE E,UTMPTR(E) + SETZB B,TT +TTYF3: SKIPE UNAME(B) + CAME E,UTMPTR(B) + JRST TTYF4 + ADD TT,NMPGS(B) +TTYF4: ADDI B,LUBLK + CAMGE B,USRHI + JRST TTYF3 + JSP B,G4SDPT + PUSHJ P,OUTCS + PUSHJ P,OUTCS + HRRZ TT,DIRPT(A) + SKIPL SUPPRO(TT) + JRST [ HRRZ TT,SUPPRO(TT) ? JRST .-1 ] + IDIVI TT,LUBLK + JSP B,GOPT + JSP B,MESPCR +TTYF5: AOBJN Q,TTYF1 +TTYF99: MOVEI TT,[ASCIZ /FREE CORE /] + JSP B,MESPNT + MOVE TT,MEMFR + SUB TT,NCBCOM + JSP B,GDPT + MOVEI TT,[ASCIZ / OUT /] + JSP B,MESPNT + MOVE TT,NPGSWO + JSP B,GDPT + JSP B,MESPCR + JRST UCL7 + +SIXTYB: AOS Q +SIXTYA: PUSHJ P,OUTCS + MOVEI I,440600+Q + HRLM I,DIRPT(A) + +SIXTYP: ILDB I,DIRPT(A) + ADDI I,40 + PUSHJ P,OUTC + MOVE I,DIRPT(A) + TLNE I,770000 + JRST SIXTYP + JRST (B) + +MESP3S: SKIPA TT,[[ASCIZ / /]] +MESPCR: MOVEI TT,[ASCIZ / +/] +MESPNT: HRLI TT,440700 + MOVEM TT,NUM(A) + ILDB I,NUM(A) + JUMPE I,(B) + PUSHJ P,OUTC + JRST .-3 + +OUTCS: MOVEI I,40 +OUTC: SKIPL TT,SRN3(U) ;IF WANT 1 CHAR, RETURN WITH IT, SAVING ACS. + JRST OUTC1 ;IF WANT WHOLE WORD, SEE IF WORD IS FULL. +OUTC2: MOVEM E,SAVE(A) + MOVEM Q,SAVQ(A) + MOVEM B,SAVB(A) + POP P,DIRPC(A) + POPJ P, + +OUTC1: LSH TT,6 + ADDI TT,(I) ;MERGE THIS CHAR (IN I) INTO WORD BEING ACCUMULATED. + LSH TT,1 + MOVEM TT,SRN3(U) + TLNE TT,774000 ;IF THE WORD IS FULL, RETURN TO DIRB. + JRST OUTC2 + POPJ P, ;ELSE POPJ FROM OUTC, TO GET MORE CHARS. + +;NUMERIC PRINTOUT ROUTINES FOR FILE DIRECTORIES. +;ALL CALLED WITH JSP B,. ALL TAKE ARG IN TT. + +;PRINT NUMBER IN TT IN DECIMAL, RIGHT-ADJUSTED IN FOUR COLUMNS. +G4SDPT: CAIL TT,1000. + JRST GDPT ;IF IT NEEDS 4 DIGITS, JUST PRINT IT. + MOVEM TT,NUM(A) + CAIL TT,100. ;ELSE FIGURE OUT HOW MANY LEADING SPACES ARE NEEDED + JRST G4SDP1 + CAIL TT,10. + JRST G4SDP2 + PUSHJ P,OUTCS ;AND PRINT THAT MANY. +G4SDP2: PUSHJ P,OUTCS +G4SDP1: PUSHJ P,OUTCS + MOVE TT,NUM(A) + JRST GDPT + +;PRINT CONTENTS OF TT AS TWO OCTAL DIGITS. +G2OPT: IDIVI TT,8 + JRST G2DPT2 + +;PRINT CONTENTS OF TT AS THREE DECIMAL DIGITS. +G3DPT: IDIVI TT,100. + MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE TT,NUM(A) +G2DPT: IDIVI TT,10. +G2DPT2: MOVEM I,NUM(A) + MOVEI I,"0(TT) + PUSHJ P,OUTC + MOVE I,NUM(A) + ADDI I,"0 + PUSHJ P,OUTC + JRST (B) + +;PRINT ARG IN TT IN DECIMAL USING AS MANY DIGITS AS IT NEEDS. +GDPT: HRLI B,10. + JRST GDPT0 + +;PRINT ARG IN TT IN OCTAL USING AS MANY DIGITS AS NECESSARY. +GOPT: HRLI B,8 +GDPT0: MOVSS B + SETZM ENDT(A) + MOVEM TT,NUM(A) +GDPT1: PUSH P,Q + MOVE Q,TT + IDIVI TT,(B) + CAME TT,ENDT(A) + JRST .-3 + MOVEM Q,ENDT(A) + POP P,Q + ADDI I,"0 + PUSHJ P,OUTC + MOVE TT,NUM(A) + CAME TT,ENDT(A) + JRST GDPT1 + MOVSS B + JRST (B) + +;ROUTINE TO CALL A DIRECTORY COROUTINE +DIRCHR: MOVE E,SAVE(A) + MOVE B,SAVB(A) + MOVE Q,SAVQ(A) + JRST @DIRPC(A) + +IFN NUNITS,[ +BLKPNA: MOVEI J,1(I) + LSH J,-1 + JRST BLKPNT+1 + +BLKPNN: LSH J,-1 +BLKPNT: MOVEI TT,0 + MOVEI I,56 +BLKPN2: MOVEI E,440500+I + HRLM E,DIRPT(A) +BLKPN1: ILDB E,DIRPT(A) + CAIN E,37 + JRST BLKPN3 + CAMN E,J + AOS TT + HLRZ E,DIRPT(A) + TRNE E,760000 + JRST BLKPN1 + AOJA I,BLKPN2 +BLKPN3: JUMPE J,GDPT + MOVSI I,-23. +BLKPN4: MOVE E,@DIRPT(A) + AOS I + CAMN J,@DIRPT(A) + JUMPE E,BLKPNA + AOBJN I,BLKPN4 + JRST GDPT +];NUNITS +EBLK + +UDUSR: REPEAT NUDCH,-1 ;-1 => FREE, ELSE UTAPE # IF UTAPE DIR, ELSE 0. +UDUIND: BLOCK NUDCH ;IF DIR CHANNEL IN USE, HOLDS JOB # OF JOB USING IT. + +IRPS X,,DIRPC:DIRPT:NUM:ENDT:SAVB:SAVQ:UDSYSN:UUDPP:SAVE: +X: REPEAT NUDCH,-1 + TERMIN +UDCSW: -1 + 0 + +DSKLST: BLOCK NUDCH ;0 LISTING UTAPE 1 NON-DIR DEVICE + ;2 CORE LINK 3 2311 +;NO BBLK SINCE VARIABLES ON NEXT PAGE + +SUBTTL UTC LEVEL INTERRUPT + +;NO EBLK SINCE VARIABLES ON PREVIOUS PAGE + +UTCPDP: -LUTCP,,UTCP-1 ;UTC-LEVEL PDL +UTCP: BLOCK LUTCP +UTACS: BLOCK 20 ;UTC-LEVEL AC SAVE + +IFE KS10P,[ ; On the KS10 we can take advantage of the Unibus interrupt + ; vectoring scheme to dispatch quicker, so this code was + ; reorganized somewhat. +UTCBRK: 0 +BBLK +IFN KL10P,[ + CONSO PI,1_<7-UTCCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP +IFN NUNITS,[ +IFE NEWDTP,[ + CONSZ DC,6 + JRST PIPOS ;HAS CHNL >1 +PIPX: +] +IFN NEWDTP,[ + SKIPGE CUINT + JRST UTCB0 +] +];IFN NUNITS +IFN IMPP,[ ; See if it's an IMP interface interrupt +IFN KAIMP,[ + CONI IMP,TT + LDB A,[000300,,TT] + CAIE A,NETCHN + JRST UTCB2 + TRNE TT,IMPLW+IMPHER+IMPERR+IMPOD+IMPID +] +IFN DMIMP,[ + CONI FI,TT + TRNN TT,70 ;CHECK PIA + JRST UTCB2 ;DO NOT PROCESS IF NO PIA + TRNE TT,FILW+FIDOWN+FIWASD+FIOD+FIID +] + JRST IMPINT +UTCB2:] ;IFN IMPP + +IFN DC10P,[ + CONI DC0,TT + TRNE TT,DPIRQC + JRST QINT +] +IFE KA10P, CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN T300P,[ + SKIPE DSCDON + JRST T3INT +];T300P +IFN RP10P,[ + CONI DPC,TT + TRNE TT,7 + TRNN TT,10 ;IF BIT IS ON IT IS INTERRUPTING - LET QINT HAVE IT + SKIPGE QGTBZY + JRST QINT +] +IFN RH10P,[ + CONI DSK,TT + TRNN TT,%HIDON+%HIATN ;INTERRUPTING HARDWARILY + SKIPGE QGTBZY ;INTERRUPTING SOFTWARILY + JRST QINT +] +IFN TM10P,[ + CONI MTC,A + CONI MTS,C + LDB TT,[030300,,A] + CAIE TT,MTCCHN + JRST UTCBK2 + TRNN C,100 ;IF NOT JOB DONE + TRZ C,30000 ; THEN DON'T BELIEVE PAR ERR OF EOF + TRNN A,400 ;IF NEXT UNIT NOT ENABLED + TRZ C,2 ;THEN TURN OFF NEXT UNIT FLAG + TRNE C,440302 ; UNIT HUNG, ILLEGAL, BAD TAPE (UGH), LOAD NEXT UNIT, JOB DONE + JRST MGHBRK +UTCBK2: SKIPN MGTBZY ; SOFT WARE CALL + JRST MGSBRK +] +IFN NUNITS, JRST UTCB0 + +POPRET: +IFN NUNITS,[ + MOVE A,TIME + MOVEM A,LUTOTM +] +DSKEX: +IMPEX: +MGEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +] ;IFE KS10P + +IFN KS10P,[ + +UTCBRK: 0 ; Still EBLK'ed from previous page... +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + CONO PI,020000+200_<-UTCCHN> ;BAG-BITING DEC LOSERS +IFN KSIMP,[ + AOSN IMPBZY ;-1 if IMP wants a jump-start + PUSHJ P,IMPINT +] +IFN RH11P,[ + SKIPGE QGTBZY + JRST QINT +] ;RH11P +IFN TM03S,[ + SKIPN MGTBZY + JRST MGSBRK +] +IMPEX: +MGEX: +DSKEX: MOVSI U,UTACS + BLT U,U + JRST 12,@UTCBRK + +;;; Interrupt routines that are directly dispatched to by the KS10/Unibus +;;; interrupt kludge should do JSR UTCSAV as their very first instruction. +;;; The word before the JSR is expected to contain the interrupted PC. +;;; They should then exit through DSKEX just like everybody else. + +EBLK +UTCSAV: 0 +BBLK + MOVEM U,UTACS+U + MOVEI U,UTACS + BLT U,UTACS+U-1 + MOVE P,UTCPDP + MOVE U,UTCSAV + MOVE TT,-2(U) + MOVEM TT,UTCBRK + JRST (U) + +] ;KS10P + +$INSRT SYSJOB ;SYSTEM JOB AND RELATED STUFF + + +SUBTTL DCHNTB AND DCHNTC + +EBLK +CHSPUR: BLOCK 8 ;NUM OF SPURIOUS INTS PER CH (ZERO = DCHK) +BBLK + +IFE KS10P,[ ; KS10 doesn't even pretend to have devices. + +;***** DCHNTB ***** +;4.9 = KNOWN DEVICE +;4.8 = HAS PIA 2 +;4.7-4.4 PIA 2 SHIFT +;4.3-4.1 PIA 2 ACTIVE VALUE +;3.9 = PIA 2 MAY BE ZERO +;3.8 = HAS PIA 1 +;3.7-3.4 PIA 1 SHIFT +;3.3-3.1 PIA 1 ACTIVE VALUE +;2.9 = PIA 1 MAY BE ZERO +;2.8 = ALLOW USER DATAI, BLKI +;2.7 DATAO, BLKO +;2.6 CONI, CONSO, CONSZ +;2.5 CONO +;2.4 SPECIAL KL10 DEVICE, BLKI/BLKO ARE DATAI/DATAO TO A SECOND DEVICE REGISTER +;1.6-1.1=N, IF NON ZERO: IGNORE DEV UNLESS CONI BIT N-1 IS ON + ;(IF DSDEV PRESENT) + +;***** DCHNTC ***** +;4.9 = SUSPICIOUS DEVICE +;4.8 = FOUND CLOBBERED +;4.7 = SUSPECTED OF CAUSING SPURIOUS INTS +;4.6-4.4 = CHANNEL CAUSING INTS ON +;3.9-3.1 = SUSPICION COUNT +;2.9-1.1 = CONI + +DCHNTB: +IFE KL10P,[ + 400200+APRCHN,,240000 ;0 APR + SETZ ;4 PI +] +IFN KL10P,[ + 400200+APRCHN,,250000 ;0 APR (ALLOW DATAI, "BLKI", CONI) + SETZ 010000 ;4 PI (ALLOW NOTHING) +] + +DEFINE DCHENT D,W +LOC DCHNTB+D_-2 + W + TERMIN + +IFN KL10P,[ + DCHENT PAG,SETZ 240000 ;ALLOW DATAI, CONI, BUT NOT "BLKI" + DCHENT CCA,SETZ ;ALLOW NOTHING +;XCTR of some of the instructions for these devices fails to relocate +;the address to user space, due to bugs in the hardware. Flush 'em. +; DCHENT TIM,SETZ 250000 ;ALLOW DATAI, "BLKI", CONI +; DCHENT MTR,[400201,,250000] ;INTERVAL TIMER PIA=1. ALLOW DI,BI,CI + DCHENT TIM,SETZ ;20 ALLOW NOTHING + DCHENT MTR,SETZ ;24 ALLOW NOTHING + DCHENT 30,SETZ ;30 RESERVED +] +IFN DSDP, DCHENT DSDEV,[REPEAT 2,400200+DSDCHN,,440000] ;20,24 +IFN DL10P,[ DCHENT DLB,SETZ 240000 ;60 DL10 + DCHENT DLC,[400200+TTYCHN,,240000] ;64 DL10 +] +IFN STKP, DCHENT STK,[400200+LPTCHN,,440000] ;70 STK +IFN PTRP, DCHENT PTP,[400200+PCHCHN,,440000] ;100 PTP +IFN PTRP, DCHENT PTR,[400200+PTRCHN,,440000] ;104 PTR +IFN NOTYS, DCHENT TTY,[400200+TTYCHN,,40000] ;120 TTY +IFN OLPTP, DCHENT OLPT,[400200+LPTCHN,,440000] ;124 OLPT +IFN 340P, DCHENT DIS,[630600+DISCHN+SDCHN_9,,440001] ;130 DIS +IFN E.SP, DCHENT DIS,[400200+DISCHN,,440000] ;130 E&S +IFN KL10P, DCHENT DTE,[400200+IFE PDCLKP,[APRCHN].ELSE [TTYCHN],,240000] ;200 DTE20 +IFN RP10P, DCHENT DPC,[400200+DSKCHN,,440000] ;250 DPC +IFN RH10P, DCHENT DSK,[400200+DSKCHN,,040000] ;270 RH10 +IFN NUNITS,[ +IFE NEWDTP,[ + DCHENT DC,[400000,,440000] ;200 DC + DCHENT UTC,[400200+UTCCHN,,440000] ;210 UTC + DCHENT UTS,[SETZ 40000] ;214 UTS +] +IFN NEWDTP,[ + DCHENT DTC,[630600+UTCCHN+DCCHN_9.,,440000] ;320 + DCHENT DTS,[SETZ 40000] ;324 +] +] ;END OF IFN NUNITS +IFN TM10P,[ + DCHENT MTC,[400230+MTCCHN,,440001] ;340 MTC + DCHENT MTS,[SETZ 40001] ;344 MTS +] +IFN MTYP, DCHENT MTY,[400200+TTYCHN,,40000] ;400 MORTON BOX + ;420 SPACEWAR CONSOLES +IFN DMIMP, DCHENT FI,[400230+NETCHN,,400000] ;424 DM IMP HARDWARE +IFN NDAP, DCHENT 454,[400200,,760000] ;454 D/A +IFN KAIMP, DCHENT IMP,[400000,,400001] ;460 AI-KA/ML-KA/MC-KL IMP + ; HARDWARE THIS SAYS IMP + ; HAS NO PIA BECAUSE IT + ; CHANGES +IFN NLPTP, DCHENT NLPT,[400200+LPTCHN,,440000] ;464 NEW LPT +IFN CH10P, DCHENT CHX,[400200+CHXCHN,,040000] ;470 CHAOSNET +IFE KL10P, DCHENT 500,[400000,,240000] ;500 ML-KA, DM CALENDAR; AI-KA R CLK +IFN KL10P&PDCLKP,DCHENT 500,[400200+APRCHN,,240000] ;500 MC-KL F CLK +IFN ARMP, DCHENT TIPDEV,[400200+TIPBCH,,440000] ;504 ARM TIP BREAK +IFE MCOND AIKA, DCHENT 510,[400000,,360000] ;510 ANOTHER D/A?? + ;DOES ANYONE KNOW WHAT DEVICE 510 IS?? +IFN RBTCP, DCHENT RBTCON,[400200+TABCHN,,440001] ;514 ROBOT CONSOLE +IFN ARMP, DCHENT 564,[400200,,440000] ;564 ARM TACTILE SENSE +IFN OMXP, DCHENT OMPX,[400200+OMPCHN,,440001] ;570 OMX +IFN IMXP, DCHENT MPX,[SETZ 40001] ;574 IMX +;Comment this out since the AI-KA one is no longer on the bus +;IFN TK10P, DCHENT NTY,[400200+TTYCHN,,40000] ;600 NTY +IFN NTYP, DCHENT NTY,[400200+NTYCHN,,40000] ; NTY FOR 11 KLUDGE +IFN DPKPP, DCHENT DPK,[400200+TTYCHN,,40000] ;604 DATAPOINT KLUDGE +IFN DC10P,[ + DCHENT DC0,[400200+DSKCHN,,40000] ;610 DC0 + DCHENT DC1,[400000,,] ;614 DC1 +] +IFN VIDP, DCHENT NVDX,[REPEAT 4,400200+NVDCHN,,440001] ;620-634 BAT +IFN PLTP, DCHENT PLT,[400200+PLTCHN,,440000] ;654 PLT + DCHENT 704,[400000,,440000] ;704 ??? +IFN HCLKP,[ + DCHENT CLK1,[400200,,240000] ;710 CLK1 + DCHENT CLK2,[SETZ 40000] ;714 CLK2 +] +LOC DCHNTB+127. +EBLK +DCHNTC: BLOCK 128. +DCACS: BLOCK 20 ;SAVE ACS +CCSDEV: 0 ;+ => SOME SUSPICIOUS DEVICES +BBLK + +DCHK: 0 ;TO CALL FROM DDT + MOVEM 17,DCACS+17 + MOVEI 17,DCACS + BLT 17,DCACS+16 + MOVEI J,0 + JSP E,SPUR + SKIPN W + AOS DCHK + MOVEI 17,DCACS + BLT 17,17 + JRST @DCHK + +;CHECK FOR CLOBBERED DEVS, CALL WITH JSP E, +CHECK: JSP H,DCSTUP +CHECK1: SKIPL TT,DCHNTB(I) + JRST CHECK4 ;UNKNOWN DEVICE +IFN DSDP,[ + TRNN TT,77 + JRST CHECK2 + ANDI TT,77 + JSP H,DCCONI + LSH B,-1(TT) + JUMPGE B,CHECK4 + MOVE TT,DCHNTB(I) +] +CHECK2: JSP H,DCCONI + TLNN TT,200 ;SKIP IF PI TO TEST + JRST CHECK4 + LDB T,[250400,,TT] ;GET SKIP + MOVEI Q,7 + LSH Q,(T) + AND B,Q + LDB Q,[220300,,TT] ;GET CHANNEL + LSH Q,(T) + CAME B,Q + JRST CHECK5 +CHECK3: LSH TT,-9 ;SHIFT TO PIA2 + JRST CHECK2 + +CHECK5: JUMPN B,CHECKL ;JUMP IF NONZERO AND WRONG + TRNE TT,400000 ;SKIP IF CAN NOT BE ZERO + JRST CHECK3 ;ZERO OK + JRST CHECKL + +CHECK4: ADD A,[400,,] ;INCREMENT DEVICE CODE + AOBJN I,CHECK1 +SPURCX: SKIPE C + BUG PAUSE,[BITS ],OCT,C,[MAY BE STUCK ON IN I/O BUS] + MOVSI T,SCLCK5 + SKIPE W ;SKIP IF NO TROUBLE DETECTED + IORM T,SUPCOR + JRST (E) + +DCSTUP: MOVE A,[CONI B] ;SET UP + MOVEI W,0 + MOVNI C,1 + MOVSI I,-128. + JRST (H) + +DCCONI: XCT A + AND C,B + SKIPL DCHNTC(I) ;SKIP IF DEVICE ALREADY SUSPICIOUS,SAVES FIRST SUSPICIOUS + HRRM B,DCHNTC(I) ;STORE AWAY CONI + JRST (H) + +CHECKL: JSP H,DCSAOS + MOVSI T,600000 ;CLOB + IORM T,DCHNTC(I) + JRST CHECK3 + +DCSAOS: MOVE D,A ;MAKE A CONO + TDZ D,[40,,-1] + SKIPL T,DCHNTB(I) ;SKIP IF KNOWN DEV + JRST DCSAS2 ;JUST RESET UNKNOWN TO ZERO + TLNE T,200000 ;SKIP IF NO PIA2 + TLNE T,400 ;SKIP IF PIA2 CAN NOT BE ZERO + JRST DCSAS1 + LDB TT,[330300,,T] ;GET PIA2 + LDB T,[360400,,T] ;GET PIA2 SHIFT + LSH TT,(T) + IOR D,TT ;ADD CORRECT CANNEL TO CONO + MOVE T,DCHNTB(I) ;SKIP IF NO PIA1 +DCSAS1: TLNE T,200 ;SKIP IF PIA1 CANNOT BE ZERO + TRNE T,400000 + JRST DCSAS2 + LDB TT,[220300,,T] ;GET P1A 1 + LDB T,[250400,,T] ;GET PIA 1 SHIFT + LSH TT,(T) ;OR IN PIA 1 + IOR D,TT ;ZAP +DCSAS2: XCT D + HLRZ T,DCHNTC(I) + TLNN T,300000 + AOS W ;THIS MAY BE THE CAUSE OF OUR TROUBLES + ANDI T,777 + AOS T + AOS CCSDEV + CAILE T,777 + SOJA T,[JRST 4,.+1] ;LOSEY LOSEY + DPB T,[221100,,DCHNTC(I)] + JRST (H) + +;CHANNEL IN J SPURIOUS INTERRUPT ON, CALL WITH JSP E, +SPUR: SKIPL J + CAIL J,10 + JRST 4,SPUR1 + AOS U,CHSPUR(J) +SPUR1: MOVE U,E + JSP E,CHECK + MOVE E,U + JSP H,DCSTUP +SPUR2: SKIPGE TT,DCHNTB(I) + JRST SPUR4 + JSP H,DCCONI + JUMPGE B,SPUR4 + JSP H,DCSAOS + MOVSI T,500000 + IORM T,DCHNTC(I) + DPB J,[360300,,DCHNTC(I)] +SPUR4: ADD A,[400,,] + AOBJN I,SPUR2 + JRST SPURCX + +] ;IFE KS10P + +IFN KS10P,[ + +SUBTTL KS10 UNIBUS + +DEFINE UBINT VEC,-REST +.VEC.== +IFN .VEC.&3, .ERR Bogus interrupt vector: VEC +.VEC.==.VEC./4 +IFL .VEC.-.MIN., .MIN.==.VEC. +IFG .VEC.-.MAX., .MAX.==.VEC. +IF2,[ +LOC .BAS.+.VEC. + REST +];IF2 +TERMIN + +NUBIDV==0 + +DEFINE UBIDV VEC +.VEC.== +CONC [UB]\NUBIDV,NM==:<.UBA.,,.VEC.> +CONC [UBINT .VEC., JSR UB]\NUBIDV,BK +NUBIDV==NUBIDV+1 +TERMIN + +;;; +;;; Interrupt table for Unibus Q. +;;; +UBAQIT: +.UBA.==UBAQ +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAQIB + +UBINT PHVEC, JSR DSKBRK ; RH11 FOR DISK + +UBAQIB==:UBAQIT-.MIN. +LOC UBAQIB+.MAX.+1 + +;;; +;;; Interrupt table for Unibus I. +;;; +UBAIIT: +.UBA.==UBAI +.MIN.==777777 +.MAX.==0 +IF2, .BAS.==UBAIIB + +IFE TM03S, UBIDV 224 ; Tape +UBIDV 300 ; NI1010 In +UBIDV 304 ; NI1010 Out +IFL DZ11NB-4,[ +REPEAT 4-DZ11NB,[ +UBIDV 340+<10*> ; DZ In +UBIDV 344+<10*> ; DZ Out +]] + +IFN TM03S,[ +UBINT %TMVEC, JSR MGHBRK ;RH11 FOR TAPE +] + +REPEAT DZ11NB,[ +UBINT 340+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,RB ; DZ receive +UBINT 344+<10*.RPCNT>, CONC JSR DZ,\.RPCNT,XB ; DZ transmit +];REPEAT DZ11NB + +IFN KSIMP,[ +UBINT %LHVEC, JSR IMPIBK ;IMP Input side break +UBINT %LHVEC+4, JSR IMPOBK ;IMP output side break +] + +IFN CH11P,[ +UBINT 270, JSR CHXBKH ; Usual Chaosnet vector +UBINT 230, JSR CHXBKH ; Except some interrupt here instead +];CH11P + +UBAIIB==:UBAIIT-.MIN. +LOC UBAIIB+.MAX.+1 + +;;; Assignment of pages in Unibus pager for DMA devices. +;;; All of the Q UBA is statically assigned. The lower half of the I +;;; UBA is statically assigned, while slots in the upper half of the I UBA +;;; are assigned dynamically by the UBAASL routine and freed by the +;;; UBAFSL routine below. +;;; +;;; Note that static pages are 2000 PDP-10 words long (ITS sized) rather +;;; than 1000 (DEC sized). Each page here thus occupies -two- locations in +;;; the Unibus pager. There are 32. such pages on the Q Unibus and 16. +;;; such pages on the I unibus. +;;; +;;; Slots handed out by UBAASL are good for mapping 1000 PDP-10 words +;;; (one DEC page, and coincidentally the size of a network buffer). +;;; The number obtained from UBAASL is a direct index into the UBA +;;; paging RAM, and will range from 32. to 63. +;;; +;;; This two different page size thing is all a mess and I should fix it +;;; sometime. +;;; +;;; Unibus Q: +QUBPG==:5 ; Chosen at random. + +;;; Unibus I: + +;;; Static pages +IFN TM03S,[ +IUTPG==:5 ;Magtape IO page. well, 5 worked last time +] + +IFN KSIMP,[ +IUIMPG==:6 ;IMP Data transfer page +] + +;;; Dynamic pages + +EBLK +UBAIFS: 777777777760 ;Slot map, bit on if free +BBLK + +; Allocate a UBA I slot +; Return +1, A/ slot index + +UBAASL: PUSH P,B + CONO PI,PIOFF + MOVE A,UBAIFS + JFFO A,UBASL1 + CONO PI,PION + POP P,B ;Clean up for no good reason + BUG HALT,[Out of UBA slots] + +UBASL1: MOVNS B + MOVSI A,400000 + LSH A,B ;A/ bit to snarf + ANDCAM A,UBAIFS + CONO PI,PION + MOVN A,B + ADDI A,32. ;First dynamic slot + POP P,B + POPJ P, + +; Deallocate the UBA slot in A +; A/ UBA index to free. Bashes A,TT +UBAFSL: CAIL A,32. + CAIL A,64. + BUG HALT,[Bad UBA index],OCT,A ;Paranoid for now + MOVEI A,-32.(A) + MOVNS A + MOVSI TT,400000 + LSH TT,A + IORM TT,UBAIFS + POPJ P, + +SUBTTL UBI DEVICE + +UBIDVS:: +REPEAT NUBIDV,[ +EBLK + 0 ; Bit in -7(I) + -1 ; User or -1 in -6(I) + 0 ; Count in -5(I) + 0 ; Saved I in -4(I) +CONC UB,\.RPCNT,BK: + 0 +BBLK + MOVEM I,.-2 + JSP I,UBIBRK +CONC UB,\.RPCNT,DV: + JRST 12,@ + CONC UB,\.RPCNT,NM ; Name in 1(I) +IFE .RPCNT, LUBIDV==:.-UBIDVS +];REPEAT NUBIDV + +UBINAM==:1 +UBISVI==:-4 +UBICNT==:-5 +UBIUSR==:-6 +UBIBIT==:-7 + +UBIBRK: AOS UBICNT(I) + EXCH U,UBIUSR(I) + JUMPL U,UBIBK9 + EXCH T,UBIBIT(I) + TDNE T,MSKST2(U) + IORM T,IFPIR(U) + EXCH T,UBIBIT(I) +UBIBK9: EXCH U,UBIUSR(I) + HRLI I,UBISVI(I) + JRA I,(I) + +EBLK +UBISW: -1 ? 0 +BBLK + +; .OPEN +UBIO: MOVEI T,NUBIDV + SKIPA I,[UB0DV] +UBIO1: MOVEI I,LUBIDV(I) + CAME A,UBINAM(I) + SOJG T,UBIO1 + JUMPLE T,OPNL4 ; FILE NOT FOUND + PUSHJ P,SWTL + UBISW + SKIPL UBIUSR(I) + JRST OPNL23 ; FILE LOCKED + MOVEI T,(R) + SUBI T,IOCHNM(U) + MOVE T,CHNBIT(T) + MOVEM T,UBIBIT(I) + HRRZM U,UBIUSR(I) + HRLZI T,(I) + HRRI T,DNUBI + MOVEM T,(R) + JRST LSWPJ1 + +; .IOPUSH/.IOPOP +UBIIOP: HLRZ A,(R) + JUMPE I,UBIOP7 + SUBI R,IOCHNM(U) + SKIPA R,CHNBIT(R) +UBIOP7: SETZI R, + MOVEM R,UBIBIT(A) + POPJ P, + +; .CALL WHYINT +UBIWHY: MOVE B,UBICNT(A) + MOVEI A,%WYUBI + JRST POPJ1 + +; .CALL RFNAME +UBIRCH: MOVE B,UBINAM(A) + POPJ P, + +; .CLOSE +UBICL: SETOM UBIUSR(A) + POPJ P, + +] ;KS10P + +SUBTTL OVERHEAD METERING ROUTINE + +IFN KL10P,[ + +EBLK +;TABLE OF OVERHEAD REGIONS. ENTRY IS SIXBITNAME,,PC ? COUNT + 0 ;COUNTS STUFF BEFORE FIRST OVHMTR MACRO +OVHTBL: OVHTAB + 'USR,,-1 + 0 ;COUNTS USER-MODE PC'S +LOVHTB==.-OVHTBL + +;COME HERE ON PI CHANNEL 1 EVERY 39 MILLISECONDS +OVHSVA: 0 +OVHSVB: 0 +OVHBRK: 0 +BBLK + CONO TIM,060000+3900. ;CLEAR DONE + EXCH T,OVHBRK ;GET PC INTERRUPTED OUT OF + TLNE T,%PSUSR ;ONLY METER IF EXEC MODE + JRST OVHBRX + MOVEM A,OVHSVA + MOVEM B,OVHSVB + MOVSI A,-LOVHTB +OVHBR1: HRRZ B,OVHTBL(A) + AOBJN A,.+1 ;2-WORD ENTRIES + CAIG B,(T) ;SKIP IF PC LIES IN PREVIOUS REGION + AOBJN A,OVHBR1 + SKIPGE A ;IN CASE T = 777777 + AOS OVHTBL-2(A) ;AOS PREVIOUS REGION'S COUNT + MOVE B,OVHSVB + SKIPA A,OVHSVA +OVHBRX: AOS OVHTBL+LOVHTB-1 ;AOS COUNT OF USER-MODE PC's + EXCH T,OVHBRK + JRST 12,@OVHBRK +];KL10P + +IFN KS10P,[ +RDPCST=DATAI 14, ;INSTRUCTIONS FOR PC SAMPLING TABLE +WRPCST=DATAO 14, + +;TABLE OF OVERHEAD REGIONS. ENTRY IS PC,,SIXBITNAME +OVHTB1: 0,,'LOW ;LOWER FENCE + OVHTAB + 377777,,'USR ;UPPER FENCE +LOVHTB==.-OVHTB1 +REPEAT <1_<36.-<.LZ >>>-LOVHTB, 377777,,-1 ;PAD TO POWER OF TWO SIZE + +EBLK + +OVHTB2: BLOCK LOVHTB ;CORRESPONDING COUNTS (LAST IS FOR USER MODE) + +OVHCNT: 28. ;COUNTER TO SLOW THINGS DOWN TO CUT OVERHEAD + +LOVHPC==100 ;64 SAMPLES SHOULD BE ENOUGH +OVHPCS: BLOCK LOVHPC + +BBLK + +;CALCULATE OVERHEAD USING PC SAMPLE TABLE +;CLOBBERS A,B,C +OVHCLK: SOSL OVHCNT ;TIME TO DO IT YET? + JRST OVHCL9 ;NO, IGNORE THESE SAMPLES + MOVEI A,28. ;SEE ONLY ONE SAMPLE OUT OF EVERY 29 ON AVERAGE + MOVEM A,OVHCNT ;SO TIME SPENT IN THIS ROUTINE IS NOT EXCESSIVE + RDPCST C ;SEE HOW FULL THE PC SAMPLING TABLE IS + HRLOI C,-OVHPCS-1(C) + EQVI C,OVHPCS ;AOBJN POINTER TO SAMPLES ACTUALLY TAKEN + JUMPGE C,OVHCL9 ;NONE + CAMGE C,[-LOVHPC,,OVHPCS] + JRST OVHCL9 ;BOGUS AOBJN POINTER, MAYBE PCST NOT TURNED ON +OVHCL1: MOVE A,(C) ;NEXT SAMPLED PC + TLNE A,%PSUSR ;ONLY SEARCH TABLE IF EXEC MODE + JRST OVHCL8 ;ALL USER MODE PC'S ARE COUNTED IN LAST BUCKET + HRLO A,A ;-1 IN RH IS GREATER THAN ANY SIXBIT + MOVEI B,1_<35.-<.LZ >> ;HALF THE SIZE OF THE TABLE +REPEAT <36.-<.LZ >>,[ ;LOG SEARCH + CAMG A,OVHTB1(B) ;NOT CAMGE BECAUSE OF PADDING AT END + SUBI B,1_<35.-.RPCNT-<.LZ >> + ADDI B,1_<34.-.RPCNT-<.LZ >> +] + LOC .-1 ;OPTIMIZE OUT ADDI B,0 + AOSA OVHTB2(B) +OVHCL8: AOS OVHTB2+LOVHTB-1 + AOBJN C,OVHCL1 +OVHCL9: WRPCST [-LOVHPC,,OVHPCS] ;TURN ON / RESTART PC SAMPLING + POPJ P, +];KS10P + +;HERE IS A TABLE OF REGISTERED 3-LETTER OVERHEAD REGION CODES + +;ALC - ALLOCATE CORE PAGE FRAME +;CHx - CHAOSNET STUFF (VARIOUS VALUES OF x) +;FLT - MISCELLANEOUS FAULTS +;IMP - ARPANET INTERRUPT (NOT STYNET) +;LOW - LOW CORE, BEFORE FIRST OVHMTR MACRO & PCS IN UPPER HALF OF EXEC SPACE +;NET - ALL NETWORKS, ALL PI LEVELS, NOT OTHERWISE ACCOUNTED FOR +;PGF - PAGE FAULT +;PPI - PPIUM +;QIN - DISK INTERRUPT LOW LEVEL +;QSC - DISK INTERRUPT HIGH LEVEL, DISK SCHEDULER +;SC1 - SCHEDULER 1 - ENTRY +;SC2 - SCHEDULER 2 - SEARCH +;SC3 - SCHEDULER 3 - EXIT +;SC4 - SCHEDULER 4 - UNSWAPBLOCK +;SLW - SLOW CLOCK +;SWF - SWAP FIND NEW USER (SWAPOUT SCHEDULER) +;SWP - SWAP PAGE +;SWS - SWAP SCHEDULER +;SWU - SWAP USER +;TTI - TTY INPUT INTERRUPT LEVEL +;TTO - TTY OUTPUT INTERRUPT LEVEL +;TTY - MISC TTY CODE +;USR - USER MODE +;UUO - UUO LEVEL, MISCELLANEOUS ROUTINES, AND TOTAL MISCELLANY +;WS - WORKING SET & SWAP-BLOCK ENTRY CODE + +SUBTTL PC LSR TEST FEATURE + +;CALLED BY PCLT MACRO +;WHICH ASSEMBLES +;SKIPE PCLDBM +;PUSHJ P,PCLTST + +PCLTST: PUSH P,U + MOVE U,PCLIDX + MOVEM U,PCLHT + MOVE U,USER + CAME U,PCLUSR + JRST POPUJ +PCLX: CAIA ;PATCH IN OTHER CHECKS (SHOULD JRST POPUJ TO IGNORE) + MOVE U,USER ;PATCH ROUTINE MAY CLOBBER U + AOSN PCLNXT + JRST PCLT1 ;FOUND PLACE, CAUSE PCLSR + HRRZ U,-1(P) + CAME U,PCLL + JRST POPUJ ;NOT MARK (NOT AT RIGHT LOCN) + HRRO U,USER ;4.9 U FLAG +PCLT1: PUSH P,A ;COMPUTE HASH ADR OF RETURNS ON PDL + PUSH P,B + PUSH P,C + HRREI A,-USRSTG(P) + JUMPL A,PCLT1A ;SYS JOB'S PDL? + IDIVI A,LUBLK + IMULI A,LUBLK + MOVEI A,USRPDL(A) ;GET START OF USERS PDL IN A +PCLT3: HRRZ B,(A) + JUMPE B,PCLT2 + CAIL B,HSYSCD + JRST PCLT2 + HLRZ C,-1(B) + TRZ C,37 + CAIE C,(PUSHJ P,) + JRST PCLT2 + XOR B,PCLHT + ROT B,1 + MOVEM B,PCLHT +PCLT2: CAIGE A,-2-3(P) + AOJA A,PCLT3 + MOVE A,PCLHT ;COMPUTED HASH + JUMPGE U,PCLT4 ;GOING TO PCLSR HERE, STORE HASH AS MARK FOR NEXT TIME + CAME A,PCLHSH + JRST PCLT5 + SKIPGE PCLDBM + JRST PCLT6 ;IN HOLD MODE, PCLSR HERE + SETOM PCLNXT ;FOUND MARK, PCLSR NEXT TIME +PCLT5: POP P,C + POP P,B + POP P,A + JRST POPUJ + +PCLT4: MOVEM A,PCLHSH ;STORE HASH FOR NEXT TIME + HRRZ A,-3-1(P) + MOVEM A,PCLL +PCLT6: CONO PI,CLKOFF + MOVE B,PCLDBM + MOVEI A,%PIC.Z + CAIN B,1 ;DON'T ^Z. + IORM A,PIRQC(U) + POP P,C + POP P,B + POP P,A + POP P,U + JRST PCLME + + PUSHJ P,PCLME1 +PCLME: PUSHJ P,UFLS + JRST 4,. + +PCLME1: PUSHJ P,PCLSR + JFCL + JRST POPJ1 + +PCLT1A: TRNE U,-1 + JRST 4,. + JRST 4,. ;TEMP MODIFY END CHECK IF WANT TO WIN FOR SYS JOB + +SUBTTL ILLUO NON-RELEVANT SYSTEM CALLS +IFE E.SP,[ + ADSTEP==URET + ADCONT==URET + ADWORD==URET +] +IFE 340P\E.SP,[ + ADSTAR==URET + ADCLOS==URET + ADSTOP==URET + ADSTL==URET +] +IFE 340P,[ + ALTPEN==URET + ANDIS==URET +] +IFE VIDP,[ + AVSCAN==ILUUO + AVSTST==ILUUO +] +IFE IMXP,[ + APOTSET==ILUUO +] +IFE PDP6P,[ + AIPDP==ILUUO +] +IFE NMTCS,[ + AMTAPE==ILUUO +] + +IFE ARMP,[ + AARMOV==ILUUO + AARMRS==ILUUO + AARMOF==ILUUO +] +IFE PTRP,[ + AFEED==CPOPJ +] +IFE RBTCP,[ + ARBTC==ILUUO +] +IFE NETP,[ + ANETIM==OPNL1 ;NO SUCH DEVICE ERROR FOR SYMBOLIC SYSTEM CALLS. + ANETBL==OPNL1 + ANETHS==OPNL1 +];NETP +IFE NCPP,[ + ANETAC==CPOPJ ;MAKE OLD UUOS FAIL + ANETIN==CPOPJ +];NCPP + +IFE NUNITS,[ + AUBLAT==URET + AUTNAM==URET + AUINIT==URET + AUDISM==URET + AASSIGN==URET + ADESIGN==URET +] + +;Here generate the table for the BUG macro. Note that entries for +;bugs in the initialization code will appear here also! That's +;why we have the kludgey add 10 +BUGTAB: BLOCK LBUGTB+10 +LBUGT2==.-BUGTAB + 0 ;Marks end of table + +CONSTANTS +HSYSCD:: ;HIGHEST SYSTEM CODE + +SUBTTL RANDOM STORAGE +EBLK + +SCHHP: SCHHB ;PNTR TO SCHED HIST BUFFER +SCHHB: BLOCK SSCHDB ;SCHED HIST BUFFER + ;4.9 =1 EXEC + ;4.8 =1 QUANT TERMINATED BY PG FAULT + ;4.7-3.8 LENGTH OF RUN TIME IN 512 USEC UNITS + ; MUST ACCOMODATE 150 MILLISECOND QUANTA + ;3.7-3.1 USER ("NUMERIC INDEX) + ;RH PC QUANT STARTED AT +SWPHTP: SWPHTB +SWPHTL==200 +SWPHTB: BLOCK SWPHTL ;SWAPPING HISTORY TABLE + ;4.9-4.8 EVENT: 0=START LOADING, 1=FINISH LOADING, + ; 2=SWAP OUT, 3=SWAP BLOCK + ;4.7-3.9 WORKING SET SIZE MINUS ONE (0=0) + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK SWPHTL ;CORRESPONDING UTRNTM + +PGIHTP: PGIHTB +PGIHTL==200 +PGIHTB: BLOCK PGIHTL ;PAGE-IN HISTORY TABLE + ;4.9 1 IF JOB WAS LOADING + ;4.7-3.9 USER VIRTUAL PAGE NUMBER + ;3.8-3.1 USER NUMBER + ;2.9-1.1 RH(TIME) + BLOCK PGIHTL ;CORRESPONDING UTRNTM + +IFN SCHBLN,[ +SCHMNY: 0 ;0 DO FULL SCHEDULE, -1 NEXT "SCHEDULE" SHOULD LOOK IN SCHBTB +SCHBNJ: 0 ;NUMBER OF VALID ENTRIES IN SCHBTB +SCHBTB: BLOCK SCHBLN ;RUNNABLE JOB BUFFER +SCHBPR: BLOCK SCHBLN ;PRIORITIES OF THOSE +NSCHOV: 0 ;COUNT OF BUFFER OVERFLOWS +] +;TRANSLATION ENTRY _ T +;TRANLK(T) IS MODE,,NEXT ENTRY +;MODE IS 0 IF ENTRY ON FREE LIST, ELSE NOT 0, AND + ;BITS 3.1 => INPUT, 3.2 => OUTPUT, 4.9 => ATOMIC TRANSLATION (DON'T RETRANSLATE) +;NEXT-ENTRY IS -1 FOR NIL, ELSE IDX REL TRAN!X +;TRANID(T) THRU TRANIS(T) - FROM-NAMES +;TRANOD(T) THRU TRANOS(T) - TO-NAMES + +TRANLK: REPEAT SIOMT,,,.RPCNT-1 ;GENERATE 1ST WDS, LINKED TOGETHER. +TRANID: BLOCK SIOMT +TRANI1: BLOCK SIOMT +TRANI2: BLOCK SIOMT +TRANIS: BLOCK SIOMT +TRANOD: BLOCK SIOMT +TRANO1: BLOCK SIOMT +TRANO2: BLOCK SIOMT +TRANOS: BLOCK SIOMT + +TRANFL: SIOMT-1 ;TRANSL ENTRY FREE LIST. +TRNCNT: 0 ;NUM ENTRIES IN USE. +TRNREF: 0 ;NUM. READ-ONLY ACCESSES TO TRANSL LISTS. +TRANSW: -1 ;SWITCH FOR WRITE REF. + 0 + +IFE SCHBLN, U0P: 0 ;PRIORITY OF BEST USER SO FAR + +USER: -1 ;USER # OF CURRENT LOSER +SYSL: SYSB*2000 +LITM: 0 ;LAST TIME SYS INCREASED CORE + +SLGIV: BLOCK 3 ;LOGIN + +SETSLC: 0 ;SETLOC VARIABLES +SETSLQ: 0 +SETSU: -1 + +SWUNAM: 0 ;SYS WRITE VARIABLES +SWJNAM: 0 +SWFN1: 0 +SWFN2: 0 +SWFN3: 0 +SWMOD: 0 + +DMON: SIXBIT /DRAGON/ + -1 ;USER INDEX OF DEMON JOB + +NQMFWR: 0 ;COUNT OF FILES WRITTEN ON .MAIL. - FOR MAILER DEMON TO HANG ON. +IFN XGP,[ +NXGPFW: 0 ;COUNT OF FILES WRITTEN ON .XGPR. - FOR XGPSPL +] + +;DEAMON VARIABLES +;VARIABLES FOR DEAMON CODE HACK +IFN DEMON,[ + +IFN TTLPTP,TPLFLG: 1 ;FLAG FOR TPL + +DMTLL==4 ;LEGNTH OF DEAMON TABLE SLOT +NODEAM==20. ;NUMBER OF SLOTS +DMLNG==NODEAM*DMTLL + +DEMSW: 0 + 0 ;MAIN PROG SWITCH FOR DEMON +REQCNT: 1 ;COUNT OF REQUEST'S FOR SYS JOB +DMTPTR: 0 ;POINTER FOR DEMSIG TO DEM TBL, AN INDEX INTO IT, TAKEN MODULO DMLNG +DMLSEX: -DMLNG,,0 ;POINTER TO DEAMON TABLE AOBJN +DEMCNT: ;AMOUNT OF SLOTS REMAINING IN THE TABLE + +DMBLK: 0 + 0 ;SLOT FOR NON DEAMON LOAD VIA NUJBST + +DMOBLK: SIXBIT / SYS/ + SIXBIT /ATSIGN/ + 0 ;BLOCK USED BY SYSTEM JOB TO CHECK OPEN + +;DEAMON TABLE--CONSISTS OF SLOTS OF FOUR WORDS FOR EACH DEMON +;WORD 1 CONTAINS ITS SIXIT NAME +;WORD 2 CONTAINS THE USER INDEX,-1 IF LOADING, 0 IF DOWN +;WORD 3 2 QUANTITIES IN 18 BIT 2'S COMPLEMENT-- +;LH ALWAYS > = 0, IF 0 ONLY TAKES EXPLICIT REQUESTS IN > 0 A REQUEST +;RH CONTAINS THE NUMBER OF REQUESTS PENDING FOR THE DEAMON +;FOR THE DEAMON WILL BE GENERATED EVERY 2 MINUTES +;WORD 4 CONTAINS THE TIME TILL THE NEXT IMPLICIT REQUEST WILL BE GENERATED. + + +DMTTBL: SIXBIT /DEMSTR/ + 0 + 1 ;STARTUP DEAMON + 0 + +BLOCK *DMTLL +] +TIMOFF: -1 ;TIME SINCE MIDNIGHT IN HALF SECONDS ("TIME IN DSK FORMAT"). +QDATE: -1 ;DISK FORMAT DATE: -1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;BITS 3.1-3.5 HAVE DAY OF MONTH, 3.6-3.9 HAVE MONTH OF YEAR, + ;4.1-4.7 HAVE YEAR MOD 100. . +QDATEI: -1 ;-1 => SYSTEM DOESN'T KNOW DATE, ELSE + ;DATE AND TIME THE DATE AND TIME WERE FIRST DETERMINED, IN DSK FORMAT. +PDYTIM: -1 ;TIME SINCE BEGINNING OF YEAR IN HALF-SECONDS (BACKUP TO PDCLK) +FYEAR: 0 ;YEAR (E.G. 1969.) +PDTIME: 0 ;NON-ZERO => OFFSET FOR PDCLK + ;WHEN SUBTRACTED FROM PDCLK DATAI GIVES # PD-UNITS SINCE + ; BEGINNING OF YEAR + ;ONE SECOND = 60. PD-UNITS + ; Also contains similar offset for KS-10 clock in 60ths. +LPDTIM: -1 ;LAST PD CLK TIME, -1 IF PD CLK NOT RUNNING OR JUST PDSET'ED + +SUPCOR: 0 ;CONTROLS SYS JOB, SEE SYSDTB, SCOR, ETC + ;EACH BIT REQUESTS ONE FUNCTION IF SET. +SUPCOP: SCLDAT+IFN DEMON,[SCLDMN],,SCRCKS + ;THIS WORD OR'D INTO SUPCOR EVERY SECOND. +SCKPHS: 0 ;USED FOR COUNTING EVERY SECOND 1/2 SECOND CLOCK + ;TO SET SUPCOP BITS EVERY SECOND +SYSITM: 0 ;TIME SYS JOB LAST STARTED WAITING ON SUPCOR +LNETIM: 0 ;TIME AT WHICH NETWORK WAS LAST BROUGHT UP +RSWTIM: 1 ;Time (in DSK format) when last checked system resources. + +MXPARS==10. ;MAX # PAR ERRS TO PRINT OUT +PARPG: BLOCK 8 ;STORAGE OF PAGE MAP WHILE HACKING PARITY ERROR CHECK +PARCNT: 0 ;# OF PAR ERROR ENTRIES IN TABLE +PARCON: BLOCK MXPARS ;CONTENTS OF BAD PARITY LOCATIONS +PARADR: BLOCK MXPARS ;ADDRESSES OF BAD PARITY LOCATIONS +PARAND: -1 ;QND OF ALL BAD WORDS +PARIOR: 0 ;IOR OF ALL BAD WORDS +PARAAN: -1 ;AND F ALL BAD ADDRS +PARAOR: 0 ;IOR OF ALL BAD ADDRS +IFE KA10P,[ +PARPFW: 0 ;PAGE FAIL WORD +PARERA: 0 ;ADDRESS OF PAR ERR +PARWRD: 0 ;BAD DATA +] ;IFE KA10P +IFN KL10P,[ +PARRSN: 0 ;0 => PAR ERR PAGE FAULT IN PROG + ;-1 => PAR ERR INTERRUPT; NEEDN'T STOP + ;THE RUNNING JOB. +] ;KL10P +PARDIE: 0 ;-1 => FATAL PARITY ERROR +TPLSWP: 0 ;-1 => USE OLP FOR TPL +IFN PDP6P,[ +PDP6UP: 0 ;0 => PDP6 IS DOWN. (AS USUAL) +] +IFN ECCMEM,[ +IFE MCOND AIKA,[ +ECCADR: 1,,777760 ;ECC HISTORY STARTS HERE +ECCLEN==16. ;16 LOCATIONS OF ECC HISTORY +ECCIDX: 0 ;LAST LOCATION ACCESSED +]] +IFN TEN11P,[ +TEN11F: 0 ;0 -> NORMAL + ;-1 -> COMPLETELY IGNORE 10-11 INTERFACE + ; 1 -> RESET 10-11 INTERFACE, OTHERWISE IGNORE +T11ERC: 0 ;COUNT OF CONTROL PAGE RAM ERRORS +T11CCN: 0 ;CORRECT CONTENTS +T11WCN: 0 ;WRONG CONTENTS +T11PG: 0 ;PAGE # INVOLVED +] +IFN N11TYS,[ +TVBLAD: 17742 ;VIDEO BUFFER TO FLASH WHEN JOB RUNNING (PDP10 VIDEO BUFFER ADDR) +] +IFN DL10P,[ +DL10F: -1 ;-1 NORMAL, 0 => 11 DOWN +DL10HC: 0 .SEE TTDLBRK ;NUMBER OF LOOPS WHEN HUNG UP WAITING FOR 11 TO GOBBLE BUFFER +] + +DLSRCH: 0 ;-1 => DON'T RUN ANY USER BUT THE ONE ALREADY RUNNING + ;(UNLESS WE TAKE A PAGE FAULT). +CPDLP: -CPDLL,,LCPDL-1 ;CLOCK PDL POINTER +LCPDL: BLOCK CPDLL ;CLOCK INT LEVEL PDL + +CLKBSW: 0 ;READ SWITCHES INTO HERE TO DECIDE WHETHER TO GO TO DDT. + +CLROOT: SSLCKB ;CLOCK QUEUE ROOT + +SSLCKB: SCLKI ;SLOW CLOCK RQ BLOCK + .+2 .SEE CHA5CK ;OR 15SCLB + JRST SSLCK + +IFN CHAOSP,[ +CHA5CK: 5*60.-SCLKI ;5-SECOND CLOCK FOR CHAOS NET + 15SCLB ;NOTE INITIAL TRIGGERING OF CLOCKS BELOW DELAYED AN EXTRA 5 SECONDS + JRST CHA5CL +];CHAOSP + +15SCLB: 15.*60.-SCLKI + .+2 .SEE PRVCLB ;OR VSLCKB + JRST 15SCLK + +IFE SWPWSP,[ +PRVCLB: NPVSEC*60.-15.*60.-SCLKI ;PRIVILEDGED USER VARIABLE CHECK + VSLCKB + JRST PRVCLK +];SWPWSP + +VSLCKB: 0 ;VERY SLOW CLOCK BLOCK + CLINFB ;CAUSE SLOW CLOCK TICK SOON AFTER SYS COMES UP + JRST VSSLCK + +CLINFB: 377777,,-1 ;ABOUT 15 YEARS + 0 + BUG ;? + +IFN CCLKP,[ +CCLKB: 0 ;FOR CHESS CLOCK HACK + -1 + JRST RCCLK +CCLK1: 0 +CCLK2: 0 +] + +IINTIC==60. ;# TWO-MINUTE TICKS PER VERY VERY SLOW CLOCK TICK (2 HOURS) +IINCNT: 0 ;# TWO-MINUTE TICKS REMAINING UNTIL NEXT VERY VERY SLOW CLOCK TICK +.SEE VSCLK + +IFN N11TYS,[ +WHOCLB: 0 ;WHO LINE TIMER + -1 + JRST WHOSET +] + +UTTYS: BLOCK MXCZS ;RING BUFFER FOR JOBS TO BE STARTED +UTTYI: UTTYS +UTTYO: UTTYS +UTTYCT: 0 + +PCLDBM: 0 ;.NE. 0 ACTIVATE PC LSR DEBUG MODE + ;1 => ADVANCE PLACE WHERE PCLSR + ;2 => ADVANCE BUT DON'T ^Z. + ;- HOLD +PCLUSR: -1 ;USER PCLSR MODE ACTIVE FOR +PCLL: 0 ;PLACE WHERE LAST PCLSR TESTED +PCLHSH: 0 ;HASH OF RETURNS ON PDL AT LAST PLACE TRAPPED OUT OF +PCLNXT: -1 ;-1 => FROB NEXT TIME IN ADVANCE MODE +PCLHT: 0 ;TEMP +PCLIDX: 0 ;INITIALIZE PCLT TO THIS (SET TO LOOP COUNT IF NECESSARY) + +CORRNR: 0 ;LAST USER TO RUN CORE +SJSPG: 0 ;-1 => LAST FREE PG RESERVED FOR SYS JOB; DON'T GIVE IT TO ANYONE ELSE. +UTBFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH I/O BLOCKS +UFDFLF: 0 ;-1 SIGNAL TO TRY TO FLUSH 2311 UFDS +CORCNT: 0 +UFLSF: 0 ;FLAG FROM UFLS TO CLKBRK +CLKFL1: 0 ;FLAG COUNTER TO CONTROL CLOCK LEVEL +SCHFLG: 0 ;SCHEDULE TIMER (DIVIDES 60 CPS) +27FCLK: 0 ;-1 IF FAST CLOCK SHOULD CALL TYP27S +SCITM: 0 ;SEE SYSEX, SYSDEC +LCLK1: 0 +SYSCKP: -LTSTB,,TSTB ;SYSTEM CHECKSUMS CHECKER POINTER +SYSPDP: -LSYSP,,SYSPDL-1 ;PDL POINTER FOR SYSTEM JOB +SYSPDL: BLOCK LSYSP ;PDL FOR SYS JOB +IFN TPLP,TPLBUF: BLOCK TPLBSZ ;PSEUDO LPT BUFFER - MUST BE ABOVE SUACS +IFN TPLP\DEMON,TPLFNO: SIXBIT /!/ ;UNIQUE TPL FIRST FILE NAME +SJCFF: 0 ;-1 WHEN SYS JOB IN PROCESS OF FLUSHING CORE + ;AVOIDS TIMING ERROR DUE TO HUSRAD NOT REALLY REFLECTING WHAT ITS GOING TO BE +SLSWPR: 0 ;STORE SYS JOB'S LSWPR WHILE HACKING UUOS + +BBLK + +IFN TPLP, TPLFN: 2,,(SIXBIT /TPL/) +IFN KL10P,[ +KLEBCC: 0 ? <1_23.>/<4*25./2> ;EBOX COUNTER CONVERSION TO 4 USEC CONSTANT (FOR 25 MHZ) + ;RESULT IS IN AC+2 AFTER DMUL AC,KLEBCC +KLMBCC:; 1 ? 110000,, ;FOR CONVERTING AN MBOX COUNT TO THE TIME (IN EBOX UNITS) + ;IT SUPPOSEDLY AMOUNTS TO. + ;WE ASSUME 102.5 NANOSEC OD WAITING TIME PER MBOX CYCLE + ;THIS NUMBER IS 102.5/80. + ;DMUL AC,KLMBCC PUTS ANSWER IN AC+1, AC+2 + ;WITH BINARY POINT BETWEEN THE WORDS. + 0 ? 0 ;M8538 MODIFIED SO EBOX COUNTER CONTINUES TO COUNT + ;DURING MBOX WAIT TIME, SO SET KLMBCC = ZERO. +EBLK + +MTRUSR: -1 ;USER TO WHOM PERF CTR IS ASSIGNED +MTRJOB: -2 ;USER BEING MEASURED BY PERF CTR, + ;OR -1 => NULL JOB, OR -2 => ALL JOBS. + +PAEON: 0 ;SELECTED PERF CTR ENABLE WORD +PAEOFF: 0 ;DISABLE THE PERF CTR (WHEN WRONG JOB IS RUNNING) +STPERF: 0 ? 0 ;VALUE OF PERF COUNTER AT START OF QUANTUM +STEBOX: 0 ? 0 ;VALUE OF EBOX COUNTER AT START OF QUANTUM +STMBOX: 0 ? 0 ;VALUE OF MBOX COUNTER AT START OF QUANTUM +] ;KL10P +IFE KL10P, EBLK +IFN TPLP,[ +TPLFN1: 0 +TPLFN2: 0 +TPLFN3: 0 +] +IFN NLPTP, NTNLPL: 0 ;NUMBER OF TIMES NLPT LOST PIA +VARIABLES + + +TSTB: REPEAT CKNUM,CONC CK,\.RPCNT, +LTSTB==.-TSTB + +CKSUMS: BLOCK CKNUM +CKXORS: BLOCK 36. ;XOR OF ALL ADRS IN PURE AREAS IN SYS WITH CORRESP + ;BIT SET (RH) +TCKXOR: BLOCK 36. ;TEST XORS + +SSYSCL==SSYS +SYSCLB==SSYSCL_-10.+IFN 1777&SSYSCL,1 + +IFE KA10P,[ +AC1PTR: UUOACS ;-> WHERE AC BLOCK 1 IS CURRENTLY LOADED FROM +] ;IFE KA10P + +USRHI: 0 ;HIGHEST LOC USED FOR USER STORAGE + +SUBTTL LOCATIONS TO PATCH WHEN DEBUGGING + +SYSDBG: 0 ;0 NORMAL TIMESHARING + ;+ GIVE "ITS BEING DEBUGGED" MESSAGE + ;-N ALSO ALLOW ONLY CONSOLE #N AND T00 TO CTRL/Z. + ;-512.*N => ALLOW ONLY HOST N TO TELNET IN. + ;-512.*N+M => ALLOW HOST N AND TTY M. +DMLLDF: -1 ;-1 => START DAEMONS AUTOMATICALLY, 0 DON'T. +IFN DEMON,DMNFLG: 1 ;1 => START DM-STYLE DAEMONS, 0 DON'T. + +IFN NETP,NETUSW: 0 ;-1 => DON'T START UP A JOB IN ANSWER TO A CONNECT REQUEST + ;FROM A HOST OTHER THAN OURSELVES + +SYSCN: SYSCON ;NUMBER OF TTY TO RECEIVE SYSTEM CONSOLE OUTPUT. + ;-1 TO THROW IT AWAY. YOU CAN CHANGE THIS ANY TIME. + +SUPPLG: 0 ;-1 => SUPPRESS LOGIN/LOGOUT MESSAGES ON SYSTEM CONSOLE. + +IFE KS10P,[ ; KS has no lights. +MIPGDS: 0 ;-1 => DON'T LIGHT LIGHTS (KA HAS HARDWARE SWITCH, KL NEEDS + ; THIS) +] ;IFE KS10P + +IFN RH10P+RH11P,[ +USFHLT: 0 ;-1 => HALT ON DISK UNSAFES AND OTHER BAD ERRORS + ;0 => RETRY. NOTE SET POSITIVE FOR 1/2 SECOND AFTER + ; A RETRY TO AVOID LOOPING, DETECT SOLID ERRORS. +] ;RH10P+RH11P + +.SEE USEHM ;NONZERO => USE HIGH MOBY, ELSE ONLY 256K + +.SEE USEMDM ;NONZERO => USE MEDIUM MEMORY AS ADDITIONAL "LOW HALF" PAGES + +IFN N11TYS,[ +TT11P: 1 ;0 => PDP11-TTYS ARE NOT IN USE + ;1 => SYSTEM SHOULD INITIALIZE THEM + ;-1 => INITIALIZED AND IN USE + ;TO BRING THE TV'S DOWN, ZEROING TT11P ISN'T ENOUGH + ;EITHER DO WHAT TT11LS DOES, OR JUST SET SCR11D IN SUPCOR + ;(THE LATTER MAY NOT TAKE EFFECT INSTANTLY, HOWEVER) + ;TO BRING THE TV'S UP, JUST SET TT11P TO 1 AND WAIT 2 SECONDS +] + +.SEE IMPUP ;0 UP, -1 DOWN, 1 DOWN AND DON'T TRY TO BRING BACK UP + +.SEE TEN11F ;0 UP, -1 TOTALLY DOWN, 1 RESET PLEASE + +.SEE DL10F ;0 PDP11 DOWN, -1 UP + +.SEE PDP6UP ;0 PDP6 DOWN, -1 UP + +.SEE LASTGC ;NAME OF LAST DISK DIRECTORY GARBAGE COLLECTED + + +SUBTTL SWAPPING ALGORITHM CONTROL SWITCHES + +IFE SWPWSP,[ ;THESE AREN'T LOOKED AT IN SWPWSP SYSTEM +ENSWSC: SWBLK ;ENABLE CALLING OF SWSCD FROM 15 SEC CLOCK +ENUPC: 1-SWBLK ;ENABLE USER-PC PAGE OF RUNNING USER NOT BE SWAPPED OUT +ENPZRO: SWBLK ;ENABLE PAGE-ZERO OF RUNNING USER NOT BE SWAPPED OUT +ENSWBK: SWBLK ;ENABLE SWPNX1 TO SWAP BLOCK A USER +ENPVCL: 1-SWBLK ;ENABLE PRVCLK ROUTINE +ENPREE: 1-SWBLK ;ENABLE PREEMPTION ON PAGE SWAP IN (SEE QSWI1) +ENAGE: 1-SWBLK ;ENABLE AGE BITS TO ABORT SWAP OUT IF PAGE IS USED +];SWPWSP +AGERTE: 8 ;NUMBER OF PAGES TO AGE EACH 1/2 SECOND. + ;IN A 512K SYSTEM, LAP TIME IS ABOUT 200/AGERTE SECONDS. + +SUBTTL SYSTEM LOCKS + +CIRPSW: -1 ;CIRCULAR POINTER SWITCH + 0 + +MEMFRZ: -1 ;MEMORY FROZE + 0 + +CASW: -1 ;CORE ALLOCATE INTERLOCK SWITCH (REQUESTS TO CORE JOB) + 0 + +SHUTLK: -1 ;LOCK VAR FOR SHUTDN + 0 ;USED TO TELL WHO CAUSED SYS DOWN + +TREESW: -1 ;LOCK MANIPULATION OF JOB TREE STRUCTURE + 0 ;ATTACH, DETACH, DISOWN, REOWN ALL LOCK. + +CUSER: -1 ;CORE ALLOCATOR USER + 0 ;DUMMY CORE ALOC USE VAR + +ARDFSW: -1 ;LOCK VAR FOR .REDEF + 0 + +IFN 340P\E.SP,[ +DISUSR: -1 ;340 USER + 0 ;DUMMY 340 USE VAR +] + +IFN CODP,[ +CODUSR: -1 ;CODE SENDER +CODUSE: -1 +] + +IFN PLTP,[ +PLTUSR: -1 ;PLOTTER USER +PLTUSE: -1 +] + +IFN LPTP\TTLPTP,[ +LPTUSR: -1 ;LINE PRINTER USER +LPTUSE: -1 +] +IFG LPTP-1,[ +OLPUSR: -1 +OLPUSE: -1 +] +IFN LPTP,[ + IFE LPTP-1,[ + IFN NLPTP,[ + NLUSR==LPTUSR + NLUSE==LPTUSE + ] + IFN OLPTP,[ + OLUSR==LPTUSR + OLUSE==LPTUSE + ] + ] + IFG LPTP-1,[ + OLUSR==OLPUSR + OLUSE==OLPUSE + NLUSR==LPTUSR + NLUSE==LPTUSE + ] +] + +IFN PTRP,[ +PTPUSR: -1 +PTPUSE: -1 + +PTRUSR: -1 +PTRUSE: -1 +] + +IFN VIDP,[ +NVDUSR: -1 +NVDUSE: -1 +] + +IFN PDP6P,[ +PDPUSR: -1 ;PDP-6 USER +PDPUSE: -1 +PDPISR: -1 ;PDP6 AS INFERIOR (INTS ON IO CHANNEL) +PDPISE: -1 ;PDP6 USE VAR +] + +IFN TABP,[ +TABUSR: -1 ;TABLET USER +TABUSE: -1 +] + +IFN STKP,[ + STKUSR: -1 + STKUSE: -1 +] + +TIME: 0 ;TIME SINCE SYSTEM START IN 1/30'THS +SUSRS: 0 ;NUMBER USERS ON SYS +RVVTIM: 0 ;VALUE OF TIME WHEN SYSTEM WAS LAST REVIVED FROM A CRASH +USRRCE: BLOCK NCT+1 ;USER RESOURCE +1 FOR DISOWNED JOBS +SYSRCE: 0 ;SYS JOB RESOURCE +SLOADU: 0 ;100. * , IN FIXED POINT. +RNABLU: 0 ;RUNNABLE USERS +NPGWTU: 0 ;NUMBER OF JOBS CURRENTLY WAITING FOR A PAGE +LOUTIM: 0 ;TOTAL TIME USED BY LOGGED OUT USERS +UMASTER: -1 ;INDEX OF MASTER USER +SWRCE: BLOCK NCT+2 ;SWAP SCHED RESOURCE +SWIPRQ: 0 ;TOTAL # SWAP IN REQUESTS +SHUTDN: 0 ;"TIME" SYS WILL DIE, 0 IF NOT DYING, -1 IF DEAD +DEDTIM: 0 ;TIME TILL DEATH AFTER NEXT CLK QUEUE INT + ; < 0 => SYSTEM ACTUALLY DOWN (CHECKED BY ^Z, NUJBST, %OPLIV JOBS) +DTHTIM: 0 ;TIME SYSTEM DIED +DEDBLK: 0 + -1 + JRST DEATHZ + +ATRNJN: 0 ;JNAME OF LAST JOB TO DO A .TRANAD OR .TRANDL + ;(SO I CAN SEE IF THEY'RE USED AT ALL). + +IFN DZ11P,[ +DZXSPR: 0 ;Count of spurious DZ-11 transmitter interrupts. +DZRSPR: 0 ;Count of spurious DZ-11 receiver interrupts. +];DZ11P + +NCORRQ: 0 ;NUMBER CORE RQS HERE SO TRANSFERRED TO PEEK +NCBCOM: 0 ;NUMBER CORE BLOCKS COMMITTED TO CORGP + +NQDE: BLOCK NQS ;NUMBER OF 2314 DATA ERRORS +NQHE: BLOCK NQS ;NUMBER OF 2314 HARDWARE ERRORS + BLOCK 1 ;NQSE-1 COUNTS SPUR INTS WHILE NO XFER (QSDU -1) +NQSE: BLOCK NQS ;NUMBER OF SPURIOUS 2314 ERROR INTERRUPTS +NQCMPE: BLOCK NQS ;NUMBER OF 2314 READ/COMPARE ERRORS +NQWDE: BLOCK NQS ;# DATA ERRS ON WRITE +NQRDE: BLOCK NQS ;# DATA ERRS ON READS +NIRSWE: 0 ;# IRRCV ERRS ON SWAPPING XFERS +QIRRCV: 0 ;IRRECOVERABLE DISK ERRORS +QIRCBK: 0 ;BLOCK # W/ IRRCV ERROR +QIRUNT: 0 ;UNIT OF ABOVE +NQWRE: 0 ;# WRITE ERRS RCC OK +NQWIRE: 0 ;# WRITE ERRS RCC LOST +NWXFR: 0 ;NUMBER WRITE TRANSFERS (FILE, DIR, ETC.) +NRXFR: 0 ;NUMBER READ +NSWXFR: 0 ;NUMBER WRITE SWAPS +NSRXFR: 0 ;NUMBER READ SWAPS + +;DON'T CHANGE ORDER .SEE MEMTYP +PARERR: 0 ;COUNT OF CORE PARITY ERRORS +NXMERR: 0 ;COUNT OF NXMS +IFE KA10P, BPFERR: 0 ;COUNT OF BAD PAGE FAILS +PARPC: 0 ;PC ON CORE PARITY INTERRUPT +NXMPC: 0 ;PC ON NXM +IFE KA10P, BPFPC: 0 ;PC ON BAD PAGE FAIL +PARUSR: -1 ;USER ON PAR ERR +NXMUSR: -1 ;USER ON NXM +IFE KA10P, BPFUSR: -1 ;USER ON BAD PAGE FAIL +IFE KA10P, BPFPFW: 0 ;PFW ON BAD PAGE FAIL + +IFN KS10P,[ +ECCERR: 0 ;COUNT OF ECC CORRECTED ERRORS LOGGED +ECCERA: 0 ;MEMORY STATUS AND ADDRESS OF MOST RECENT +ECCAND: -1 ;AND OF ALL ERRORS +ECCIOR: 0 ;IOR OF ALL ERRORS +] ;IFN KS10P + +IFN DPKPP, NDPKPE: 0 ;# PARITY ERRS FROM DATAPOINT KLUDGE + +SNMPGS: 0 ;SYSTEM, NUMBER OF VIRTUAL USER PAGES +SNSWPG: 0 ;SYS, NUM OF SWAPPED OUT VIR. PGS + +USRTM1: 0 ;4USEC TICKS USED BY USERS SINCE LAST (1/2 SEC) UPDATE TO USRTIM +USRTIM: 0 ;TIME USED BY ALL USERS 1 SEC UNITS +NULTM1: 0 ;4USEC TICKS USED BY NULJOB SINCE LAST (1/2 SEC) UPDATE TO NULTM3 +NULTM3: 0 ;NUMBER OF SECONDS USED BY NULJOB +NULTIM: 0 ;TIME USED BY NULL JOB (60'THS) - OBSOLETE BUT STILL MAINTAINED +IFN KL10P,[ +NULEBC: 0 ? 0 ;EBOX COUNT WHEN NULL JOB ENTERED +NULMBC: 0 ? 0 ;MBOX COUNT WHEN NULL JOB ENTERED +NULPRF: 0 ? 0 ;PERF COUNT WHEN NULL JOB ENTERED +] ;KL10P +IFE KA10P,[ +PFAILF: 0 ; KL: -1 => ENTRY TO CLOCK LEVEL WAS VIA PFAIL + ; -2 => VIA INTPFL + ; KS: -1 => BOTH CASES +] ;IFE KA10P +LOSTM1: 0 ;4USEC TICKS LOST SINCE LAST (1/2 SEC) UPDATE TO LOSTIM +LOSTIM: 0 ;SECONDS OF LOST TIME (ALL OTHERWISE RUNNABLE JOBS WAITING FOR PAGES) +IDLTM1: 0 ;4 USEC TICKS IDLE SINCE LAST (1/2 SEC) UPDATE TO IDLTIM +IDLTIM: 0 ;SECONDS OF IDLE TIME (NO JOBS WANT TO RUN) +LOSRCE: 0 ;USRRCE WORD FOR LOST TIME +IDLRCE: 0 ;USRRCE WORD FOR IDLE TIME + +UREALT: -1 ;RH=INDEX OF THE REAL TIME USER + ;LH=0=> THIS USER HAS HIGHEST PRIORITY + ;LH>0=> USER NOT IN HIGH PRIORITY PHASE + ;LH<0=> FACILITY IDLE +INFORM [HIGHEST USED]\<.-1> + SUBTTL USER VARIABLES + +;ONE COPY FOR EACH PROCEDURE +;FOR KL AND KS, THIS IS THE UPT + +IFN KL10P,[ +DEFINE KLUPT N,NAME/ ;CHECKS "HARD-WIRED" UPT LOCATIONS +IFN .-USRSTG-,[ +.ERR "NAME" LOST IN UPT +LOC USRSTG+ +] +TERMIN +] ;KL10P + +IFE KL10P,[ +DEFINE KLUPT N,NAME/ +TERMIN +] ;IFE KL10P + +IFN KL10P, LOC <.+777>&-1000 ;KL UPT MUST START AT HARDWARE PAGE BOUNDARY + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +USRSTG:: KLUPT 0,;USER PAGE MAP + +UPGMP: BLOCK NUVPG/2 ;PAGE MAP STORAGE (PROGRAMS UP TO NUVPG LONG) +; 2.9-2.8 ACCESS RIGHTS +; 00 NO ACCESS (BY SOFTWARE CONVENTION, 1.2-1.1 +; HAVE THE "REAL" ACCESS BITS, WHICH MAY BE 00, +; BUT MAY NOT, E.G. FOR A SWAPPED OUT PAGE). +; 01 READ ONLY +; 10 READ/WRITE/FIRST +; 11 READ/WRITE +.SEE PMCSHM ;CACHE BIT +.SEE PMAGEM ;AGE BITS +.SEE PMRCM ;LOW N BITS ARE PHYSICAL CORE PAGE NUMBER (IN 1K PAGES) +UPGCP: BLOCK NUVPG/2 ;CIRCULAR POINTERS (CORRESPONDS 1-1 WITH UPGMP) +; IF -1, ABSOLUTE PAGE, NOT LINKED. OTHERWISE: +; 2.9 IF 0: +; 2.8-1.9 USER INDEX +; 1.8-1.1 PAGE NUMBER IN THAT USER'S UPGCP +; IF 1: +; 2.8 IF 0: +; 2.7-1.1 LINK TO MMP TABLE +; IF 1: +; 2.7-1.1 LINK TO MEM PNT TABLE +UMAPS: 0 ;USER MAP STATUS + .SEE %UM +UDBR1A==UPGMP ;ADDRESS TO PUT IN DBR1 +UDBR2A==UPGMP+ ;ADDR FOR DBR2 +UPGCPH==UPGCP+ ;ADDR OF HIGH HALF OF CIRC PNTRS + +TTYTBL: 0 ;TTY ASSIGNED THIS USER OR INDICATION THAT THERE IS NONE +%TBNOT==400000 ;4.9 DOES NOT HAVE TTY NOW +%TBNVR==200000 ;4.8 IF JOB DOESN'T HAVE TTY, OPENS SHOULD FAIL. +%TBINT==100000 ;4.7 IF JOB DOESN'T HAVE TTY, ATTEMPT TO USE TTY SHOULD INTERRUPT. + ;JOB CAN SET BITS 4.8 AND 4.7. +%TBWAT==40000 ;4.6 IF 1, %TBINT AND %TBNVR ARE OVERRIDDEN AND TTY USE ATTEMPTS + ; ALWAYS HANG. SET BY DDT FOR $P, CLEARED BY ^P. ONLY SUPERIOR CAN SET. +%TBDTY==010000 ;4.4 TTY TAKEN FROM --ME--. WHEN GIVEN BACK, + ;DON'T PASS IT ON TO MY INFERIOR. +%TBOUT==004000 ;4.3 ALLOW THIS JOB TO OUTPUT WHETHER OWNS TTY OR NOT +%TBINF==002000 ;4.2 ALLOW MY INFERIORS TO OUTPUT IF THEY HAVE %TBOUT. +%TBOIG==001000 ;4.1 IGNORE MY OUTPUT +%TBIIN==000400 ;3.9 INTERRUPT IF I TRY TO DO INPUT +$TBECL==220600 ;3-6-3.1 # ECHO LINES IF I DONT HAVE DISPLAY + ;RH USER NUM GAVE TTY AWAY TO OR TTY NUM IF HAS IT +%TBCLR==410077 ;CLEAR THESE BITS IN TTYTBL OF A JOB RECEIVING THE TTY + +TTSTSV: BLOCK 3 ;JOB'S SAVED TTYST1,TTYST2,TTYSTS, WHEN JOB DOESN'T HAVE THE TTY. + +NMPGS: 0 ;NUMBER OF NON-ABSOLUTE PAGES (INCLUDES PURE) +NSWPGS: 0 ;NUMBER SWAPPED OUT PAGES (AOSED FOR EACH USER OF SHARED PAGE SWAPPED OUT) +HUSRAD: 0 ;MEM ADR OF PAGE ABOVE HIGHEST THAT EXISTS (MAX 1,,0) +UPC: 0 ;USER PC STORAGE +LUBTM: 0 ;TIME LAST UNBLOCKED (FOR IDENTIFYING INACTIVE JOBS) +JBI: -1 ;JOB DEVICE INDEX. IF NOT -1, THIS JOB IS A JOB-DEVICE, + ;AND JBI HAS INDEX INTO JOB DEVICE TABLES. + +UPGML: ;USER PAGE MAP LOAD (EIGHT WORDS FOR LPM AND SPM INSTRUCTIONS) +IFE KS10P,[ ; KS10 version given below. + UPJPC: 0 ;JPC. KA HAS FAULT ADDRESS IN LH. +IFE KL10P, UPOPC: 0 ;OLD PC FLAGS,,OPC (UNUSED ON KL-10) + UPMAR: 0,,0 ;MAR ADDRESS AND CONDITION + ;FOR KA-10: + ; 3.3 0=EXEC, 1=USER + ; 3.2-3.1 MAR CONDITION: + ; 0 NEVER + ; 1 INSTR FETCH + ; 2 WRITE + ; 3 ALWAYS + ; 2.9-1.1 VIRTUAL ADDRESS + ;FOR KL-10: + ; 3.9-3.7 ADDRESS BREAK CONDITIONS: + ; 3.9 FETCH + ; 3.8 READ + ; 3.7 WRITE + ; 3.6 0=EXEC, 1=USER + ; 3.5-1.1 VIRTUAL ADDRESS +IFE KL10P, UPQUAN: EXPGNG+1,,0 ;F.S. QUAN AND FAULT BITS +IFN KL10P, UPFW: 0 ;PAGE FAIL WORD +IFE KL10P,DBL==100_1 +IFN KL10P,DBL==0 + UPDBR1: DBL,,UPGMP ;DBR1 + UPDBR2: DBL,,UPGMP+100 ;DBR2 +IFE KL10P, UPDBR3: DBL,,EXEUMP ;DBR3 +IFE KL10P, UPACP: 1040,,UUOACS ;B KEY,C KEY,,AC POINTER +] ;IFE KS10P + +IFN KS10P,[ +UPDBR1: UPGMP ; DBR1 +UPDBR2: UPGMP+100 ; DBR2 +UPQUAN: 0 ; Runtime counter +UPJPC: 0 ; User mode JPC if microcode supports +UPEJPC: 0 ; Exec mode JPC if microcode supports +] ;KS10P + +UPGMLE:: ;END OF PAGE MAP (+1) + +IFN KL10P,[ + KLUPT 420, ;RESERVED UPT 420 +UPT420: 0 + KLUPT 421, ;TRAP 1 INSN ;ARITHMETIC OVERFLOW +TR1INS: JSR ILLTRP ;FOR ITS-STYLE INTERRUPT, CONTAINS 0,,%PIARO + KLUPT 422, ;TRAP 2 INSN ;PDL OVERFLOW +TR2INS: JSR ILLTRP ;SYS JOB SHOULDN'T OVERFLOW ;FOR ITS-STYLE, 0,,%PIPDL + KLUPT 423, ;TRAP 3 INSN ;USED FOR ONE-PROCEED +TR3INS: JSR ILLTRP ;SYS JOB SHOULDN'T ONE-PROCEED ;FOR ITS-STYLE, 0,,%PI1PR + KLUPT 424, ;MUUO DEPOSIT LOCATION +SV40:: +MUUODP: 0 .SEE FORTY + KLUPT 425, ;MUUO OLD PC STORAGE +SUUOH:: +XUUOH: 0 + KLUPT 426, ;MUUO PAGING AND CONTEXT WORD +MUUOCX: 0 + KLUPT 427, ;RESERVED UPT 427 +UPT427: 0 + KLUPT 430, ;MUUO NEW PC WORDS +MUUOKN: %PSPCU,,UUOH0 ;FOR OTHER JOBS, MUUOEX (A JRST 4,). +MUUOKT: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER TRAP IN EXEC MODE. +MUUOSN: %PSPCU,,MUUOEX ;NO JOB SHOULD EVER RUN IN SUPERV. STATE. +MUUOST: %PSPCU,,MUUOEX ;.. +MUUOCN: %PSPCU,,UUOH0 ;NORMAL UUOS +MUUOCT: %PSPCU,,MUUOTR ;UUOS AS TRAP INSN +MUUOPN: %PSPCU,,UUOH0 ;PUBLIC MODE IDENTICAL TO CONCEALED MODE, +MUUOPT: %PSPCU,,MUUOTR ; ALTHOUGH IT'S A SCREW FOR A LOSER TO BECOME PUBLIC +] ;END OF IFN KL10P + +IFN KS10P,[ +DEFINE KSUPT UPTNAM +IFN .-USRSTG-,[ +.ERR UPTNAM lost in UPT +LOC USRSTG+ +] +TERMIN + +UPFW: 0 ; Saved page fail word from last fault. Copied from EPTPFW + ; at time of fault usually. + +KSUPT UPTTR1 +TR1INS: JSR ILLTRP + +KSUPT UPTTR2 +TR2INS: JSR ILLTRP + +KSUPT UPTTR3 +TR3INS: JSR ILLTRP + +KSUPT UPTUUO +SV40:: +MUUODP: 0 + +KSUPT UPTUPC +SUUOH:: +XUUOH: 0 + +KSUPT UPTUCX +MUUOCX: 0 + +KSUPT 427 +UPT427: 0 + +KSUPT UPTUEN +MUUOKN: %PSPCU,,UUOH0 ;UUO in Exec mode new PC + ;For other jobs: %PSPCU,,MUUOEX +KSUPT UPTUET +MUUOKT: %PSPCU,,MUUOEX ;UUO as trap instruction in Exec mode new PC + +KSUPT UPT1PO ;PC saved here after one-proceed +1PROPC: 0 + +KSUPT UPT1PN ;One-proceed sets PC to this +1PRNPC: %PSPCU,,ONEPRO + +KSUPT UPTUUN +MUUOCN: %PSPCU,,UUOH0 ;Normal UUO new PC + +KSUPT UPTUUT +MUUOCT: %PSPCU,,MUUOTR ;UUO as trap instruction new PC + +EXPUNGE KSUPT + +] ;KS10P + +UUOACS: BLOCK 20 +AC0S: BLOCK 15 ;SWAP OUT AC S +AC15S: 0 +AC16S: 0 +AC17S: 0 + +IFN KL10P,[ +;KLUPT 500, ;PAGE FAIL WORD STORAGE ;MICROCODE MOD PUTS +;KLUPT 501, ;PAGE FAIL OLD PC STORAGE ; THESE LOCATIONS IN +;KLUPT 502, ;PAGE FAIL NEW PC ; THE EPT FOR ITS +] ;END OF IFN KL10P + +UUO:: ;THE FOLLOWING LOCATIONS (UP TO SUEXND) ARE SWAPPED IN & OUT OF + ;UEXIT ETC. WITH THE USER +SUEXIT: JRST 2,@XUUOH ;USER UUO EXIT INS +SCLUSV: MOVEM U,AC17S ;CLOCK U SAVE + +IFN KA10P,[ +SUUOH: 0 ;C(@41) (ABSOLUTE) +SUEXND:: + +SV40: 0 ;C(40) WHEN USER OUT (SEE SWITCH) +] ;KA10P + +IFE KA10P,[ +SCLCXS: DATAI PAG,CLCX ;CLOCK SAVE OF CONTEXT +SUEXND:: +] ;IFE KA10P + +IFN -, .ERR SUEXIT BLOCK LOST + +IFE KA10P,[ +CLCX: 0 ;SAVED CONTEXT (DATAI PAG,) AT CLKBRK AND PFAIL +] ;IFE KA10P + +IFN KL10P,[ +KLUPT 504, ;EBOX COUNT +EBOXCT: 0 ? 0 ;NUMBER OF EBOX TICKS (25 MHZ) OVER 2 LEFT 12. THAT EBOX + ;RAN FOR THIS USER +KLUPT 506, ;CACHE COUNT +MBOXCT: 0 ? 0 ;NUMBER OF MBOX CYCLES REQUESTED BY EBOX FOR THIS USER LEFT 12. + +EXPUNGE KLUPT +] ;KL10P + +UTIME: 0 ;RH=CLOCK INTERVAL IN 60'THS, LH=COUNT OF TICKS SINCE READ +UTRNTM: 0 ;TOTAL RUN TIME IN 4 MICROSEC UNITS +USIPRQ: 0 ;# SWAPIN REQUESTS + +USWST: 0 ;SWAPPING STATUS BITS. +%SW==525252(1) ;IN THE LEFT HALF +%SWDSO==400000 ;4.9 => DESIRED TO BE SWAPPED OUT (MUST BE SIGN BIT). +%SWPGW==200000 ;4.8 => FLSINS IS WAITING FOR A PAGE +%SWBEM==100000 ;4.7 => BEST EFFORT MADE TO SWAP OUT, DON'T LOOK AT JOB AGAIN +%SWRUN==040000 ;4.6 => SWAPPED OUT WHILE RUNNABLE, SO CONSIDER MEM STATUS BEFORE REACTIVATION + ; THIS BIT IS NEVER LOOKED AT. +%SWPCL==020000 ;4.5 => PAGE SWAPPED OUT WHILE BLOCKED IN EXEC MODE + ; SO WHEN FLSINS SKIPS DON'T CLEAR IT BUT PCLSR INSTEAD. +%SWINT==010000 ;4.4 => IF WAITING FOR PAGE, NEED IT TO INTERRUPT +%SWPRV==004000 ;4.3 => "PRIVELEGED USER" +IFN SWPWSP,[ +EXPUNGE %SWPRV +%SWOUT==000400 ;3.9 => JOB IS SWAPPED OUT OR SWAP BLOCKED +%SWSB== 000200 ;3.8 => JOB IS SWAP BLOCKED +%SWLOD==000100 ;3.7 => JOB IS LOADING + ;VALID STATES OF ABOVE 3 BITS: 0=SWAPPED IN, 1=LOADING, 4=SWAPPED OUT, 6=SWAP BLOCKED + +UWRKST: 0 ;WORKING SET. 2**18 TIMES SUM(ALL THIS JOB'S PAGES) 1 OVER # SHARERS + ;INCREMENTALLY MAINTAINED WHILE JOB IS LOADING OR SWAPPED IN. + ;NOTE # SHARERS IS IN RH(MMSWP) +USVWRK: 0 ;SAVES UWRKST AS OF LAST TIME SWAPPED IN +USWTIM: 0 ;TIME ENTERED LOADING, SWAPPED OUT, OR SWAP BLOCKED STATE. + ;WHILE SWAPPED IN, HAS THE TIME AT WHICH IT CEASES TO BE PROTECTED + ;AGAINST MEMORY PREEMPTION. +];SWPWSP +USWPRI: 0 ;JOB SWAP PRIORITY. LOWER NUMBER MEANS MORE LIKELY TO STAY IN + ; AND MORE LIKELY TO COME IN. SEE ALSO SWRCE, WHICH IS SIMILAR. +IFE SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE PRODUCT + ;OF THE WORKING SET TIMES THE FRACTION OF CPU USED + ;WHICH IS A MEASURE OF MEMORY USE WITH INTERACTIVE JOBS GIVEN AN ADVANTAGE. +IFN SWPWSP, ;THIS IS THE AVERAGE (DECAYS BY 1/2 IN 30 SECONDS) OF THE "ADJUSTED + ;MEMORY USAGE", WHICH IS THE (LOGARITHM OF THE WORKING SET SIZE) + ;MULTIPLIED BY THE SUM OF CPU TIME AND I/O WAIT TIME. ALSO, WHEN + ;A DISOWNED JOB IS SWAPPED OUT, USWPRI IS MULTIPLIED BY 4 TO PREVENT + ;IT FROM COMING BACK IN FOR A WHILE UNLESS THERE IS REALLY NO + ;COMPETITION FOR MEMORY. ALSO, WHEN A SWAPPED-OUT JOB WAKES UP FROM + ;AN I/O WAIT, USWPRI IS DIVIDED BY 2 TO GIVE INTERACTIVE JOBS AN + ;ADVANTAGE. THE SWPWSP SYSTEM DOES NOT CURRENTLY LOOK AT SWRCE. +IFE SWPWSP,[ +USWSCD: 0 ;SWAP SCHEDULING WORD 4.9=1 SWAPIN INHIBITED THIS JOB (SWAP BLOCKED) +LTRNTM: 0 ;SAVED RUN TIME FOR PRIV USR +LSIPRQ: 0 ;SAVED SWAP IN REQ FOR PRIV USER +UPGSEC: 0 ;NUMBER OF PAGE FAULTS PER RUN TIME SECONDS +LPRVTM: 0 ;LAST TIME PRIV USER +];SWPWSP +PAGRAN: 0 ;.PAGRANGE. 1ST PG #,,LAST PG # INCLUSIVE RANGE OF PAGES TO BE PAGED AHEAD. +PAGAHD: 0 ;.PAGAHEAD. 0, OR PAGE-AHEAD-DISTANCE,,PAGE-BEHIND-DISTANCE + +TRUNTM: 0 ;IF NOT TOP LEVEL, MINUS RUNTIME (4.069 US) ALREADY SENT TO SUPERIOR + ;IF TOP LEVEL, RUNTIME USED BY SUBTREE MINUS TIME SENT TO DEMON ALREADY +TSIPRQ: 0 ;DITTO FOR SWAPIN REQUESTS +UTMPTR: SYSRCE ;POINTER TO RESOURCE WORD FOR THIS LOSER (JTMU FOR TREE) +JTMU: 0 ;REDUCED BY 1/16 EVERY 1/2 SEC + ;INCREMENTED BY TIME RUN IN 4 USEC + ;MAX EQV VAL 1000000/8-1/16X=0 + ;EQV VAL=2X10^6 + ;AMONG JOBS WITH EQUAL RESOURSE + ;LOWEST JTMU HAS HIGHEST PRIORITY + +IOCHNM: REPEAT NIOCHN,0 ;IO CHANNEL ASSIGNMENT + ;RH INDEX INTO IOTTB AND CLSTB + ;LH DEV CHNL AND/OR OTHER +SIOCHN: BLOCK LUIOP ;MUST FOLLOW IOCHNM + ;I/O CHANNEL PDL +SIOCP: SIOCHN-1 ;POINTER INTO I/O CHANNEL PDL +IOCHST: BLOCK NIOCHN ;I/O CHANNEL STATUS FOR CH'S AT IOCHNM + ;3.1-4.9 IO STATUS + ;1.1-2.9 .ACCESS POINTER + +CORRQ: -1 ;RQ TO CORE JOB + ;4.9=1=>NO REQUEST + ;4.8=0 OLD TYPE RQ,1.1-1.9 # BLKS,3.1-3.8=USR NUMBER RQ'ED FOR + ;4.8=1 NEW TYPE + ;4.3 ADD FRESH BLOCK (IGNORE 4.2,4.1) + ;4.1=1=> ADDING ABSOLUTE BLOCK + ;3.9=1=>REQUEST WRITE ABILITY + ;2.9=1 INSERT, =0 DELETE ONLY IGNORE 4.1-4.3 + ;2.1-2.8 VIRTUAL PAGE AFFECTED + ;1.1-1.9 USER RQ IS FOR + +APRC: APRCHN ;R.H. CONO TO APR WHEN USER STARTS (HAS AR OV ENABLE, ETC.) + ;4.9=1=> PROCEDURE IS IN A DISOWNED TREE +BUMRTL==100000 ;4.7 => GUN TREE IF HASN'T RUN FOR AN HOUR + ;(MEANINGFUL ONLY IN TOP LEVEL JOB). + ;CLEARED BY REOWNING OR ATTACHING. +BUSRCR==40000 ;4.6 CORE RQ PENDING ON THIS JOB +BULGO==20000 .SEE SYSGUN ;USER IS DISABLED, WAITING TO BE FLUSHED BY SYS JOB. +BCHPTR==330400,,APRC(U) ;4.1-4.4 LAST CH ON WHICH AN ERR OCCURED (SEE ERR DEV) +BULGOS==400 ;AN ATTEMPT IS BEING MADE TO DELETE OR LOG OUT THIS JOB + ;SO NO-ONE ELSE SHOULD START TO. THIS BIT ALSO LOCKS OUT + ;MOST WAYS OF HACKING THE JOB (INCL. THOSE THAT SET DIELOK). + ;3.1-3.5 MUST BE ZERO + +DIELOK: 0 ;NUMBER OF JOBS LOOKING AT OR HACKING THIS JOB. + ;BEFORE KILLING A JOB, WAIT FOR ITS DIELOK TO BECOME 0. + +USTP: 0 ;0 RUNNABLE, (IS SET NON ZERO FOR IDLE SETS OF VARS TO SPEED SEARCH) +%UST==1,,537777 +%USTCM==400000 ;CORE BEING SHUFFLED (SHOULD ACTUALLY BE OBSOLETE). +%USTCJ==200000 ;CORE BEING GIVEN BY CORE JOB. +%USTSP==100000 ;STOPPED BY SUPERIOR +%USTCG==40000 ;STOPPED BY SUPERIOR TO GIVE IT CORE (CORBLK, OR .USET OF .MEMT). + +BCSTOP==400000 ;BIT IN USTP FOR CORE MOVAGE +BUCSTP==200000 ;CORE STOPPING LOSER TO GIVE MORE CORE RQSTED BY ANOTHER LOSER +BUSRC==100000 ;USER CONTROL BIT, SET & CLEARED BY SUPERIOR PROCEDURE +BSSTP==40000 ;SET BY SUPERIOR WHEN HACKING MEM BOUND AT URMEMT OR UMEMEX +;1.1-2.9 ;USED BY UBO AND FRIENDS INHIBITS RELOCATION BY CORE ALLOCATOR + ;MUST BE MODIFIED WITH CLKOFF MUST NOT BE SET IF CSTOP IS SET + ;IS A COUNTER OF TRANSIENT REASONS FOR PROCEDURE BEING STOPPED + +PIRQC: 0 ;INT REQ AWAITING SERVICE (SOFTWARE INTS EFFECTED BY SEARCH) +MSKST: 0 ;INT MASK REGISTER FOR BITS IN PIRQC +IFPIR: 0 ;SECOND WORD OF INTERRUPT REQUESTS + ;3.8-3.1 INF PROC INT + ;2.7-1.1 IO CHANNEL INT + ;1.1= CHANNEL 0 +MSKST2: 0 ;INT MASK FOR IFPIR +IDF1: 0 ;DEFER BITS FOR 1ST WD INTERRUPTS. +IDF2: 0 ;FOR 2ND WORD INTERRUPTS. + ;IF AN INTERRUPT IS DEFERRED, IT IS TREATED AS + ;IF THE JOB'S PICLR VAR HELD 0. +PICLR: 0 ;INT IN PROGRESS FLAG, -1=>ENABLED, 0=>IN PROGRESS + +SUPPRO: 0 ;-1 => TOP LEVEL PROCEDURE + ;OTHERWISE: INT BIT,,PNTR TO SUPERIOR PROCEDURE + +FLSINS: 0 ;USER BLOCKING INSTRUCTION; STATE: + ; 0 => RUNABLE (UNLESS USTP .NE. 0) + ; OTHERWISE HUNG, IF NO SKIP SAFE TO RESTART AT UUO (UNLESS UFINAL .NE. 0) +RPCL: 0 ;0,,N RPCLSR'ING N + ;-1,,N BEING RPCLSR'ED BY N + +UNAME: 0 ;USER NAME + ;THIS WORD FOR EACH PROCEDURE IS COPIED FROM THE UNAME OF THE PROCEDURE + ;THAT CREATES IT (SEE USR DEV). FOR AN INITIAL TOP LEVEL PROCEDURE IT + ;IS INITIALLY -1 BUT IS MODIFIED BY ALOGIN. IT IS THE SAME FOR ALL + ;PROCEDURES IN A TREE. +JNAME: 0 ;JOB NAME + ;EACH LOGGED IN PROCEDURE HAS A UNIQUE UNAME, JNAME PAIR. THE JNAME + ;OF AN INITIAL TOP LEVEL JOB IS "HACTRN". FOR OTHER JOBS IT IS THE SECOND + ;FILE NAME SPECIFIED IN THE .OPEN ON THE USR DEVICE THAT CREATES THEM. +USYSNM: 0 ;USER SYSTEM NAME + ;THIS VARIABLE IS INITIALLY SET TO THE SAME VALUE AS UNAME FOR + ;A PROCEDURE. IT CAN BE READ OR WRITTEN BY THE PROCEDURE (ASUSET) + ;OR BY ITS SUPERIOR (AUSET). ITS ONLY USE IS AS THE DEFAULT THIRD FILE NAME ON + ;USER SHARED DEVICES (2311'S (SEE QSKO), AND CORE + ;LINK (SEE CLOO)). +USYSN1: 0 ;3RD NAME FOR QSKO, CLOO (AFTER DEFAULTING AND TRANSLATION) +HSNAME: 0 ;HOME SNAME + +IOTLSR: 0 ;4.9 IOT USER MOD (=1 ENABLES USER TO DO DIRECT I/O + ; INSTRUCTIONS) + ;RH VIRTUAL PAGE # OF LAST MPV, WIRO OR NXI (SHIFTED TO + ; ADDRESS SIZE) +UMARPC: 0 ;PC AT MAR INTERRUPT +LSWPR: 0 ;LOCKED SWITCH POINTER +UCLBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST UREALB +URTIME: 0 ;LH=0=>LOW PRIORITY PHASE 1=> LOW PRIORITY WITH BLOCKING + ;LH=-1=>HIGH PRIORITY PHASE 2=> HIGH PRIORITY WITH BLOCKING + ;RH=LENGTH OF HIGH PRIOITY IN 60'THS +RTIMER: -1 ;POSITIVE => MICROSEC RUNTIME TILL RUNTIME INT + +LSPCL: 0 ;UPC AT LAST PCLSR,,DIFFERENT UPC AT PREVIOUS PCLSR +LEXFDR: 0 ;DEBUGGING INFO FOR PAGE FAULTS WHICH SIGNAL AN INTERRUPT + ; TO THE LOSER + ;LH FAULT BITS OF LAST SUCH FAULT + ;RH PC OF LAST SUCH FAULT THAT WAS FROM EXEC MODE (WENT TO + ; IOADCR) + ;PAGE FAULTS WHICH JUST SWAP IN A PAGE DON'T SET THIS. +LSUUO: 0 ;LAST SYS UUO (FOR DEBUGGING PURPOSE) +LSCALL: 0 ;SIXBIT NAME OF LAST .CALL 0, (FOR PEEK) +CTLBTS: 0 ;CTL BITS TO .CALL 0, XORED TOGETHER IN HERE (RIGHT HALF) +SYSCVL: 0 ;CONTROLS OUTPUT ARGS FROM SYSTEM .CALL + %SCV==1,,525252 + %SCVOT==400000 ;4.9 CALL HAS OUTPUT ARGS FLAG (TO SAVE TIME) + %SCVER==200000 ;4.8 CALL HAS ERROR CODE ARG FLAG + ;3.6-4.7 UNUSED 3.1-3.5 MUST BE ZERO + ;1.1-2.9 ADDRESS OF ERROR CODE ARG +IOTBTS: 0 ;DEVICE-INDEPENDENT IOT CONTROL BITS GO HERE, IN IOT AND SIOT +USTYN: 0 ;TTY NO OF THE STY WHICH THIS JOB KNOWS AS "STY:" (WITHOUT + ; NUMBER). +UUAC: 0 ;AC FLD OF LAST UUO OR DESIRED CHANNEL IN CASE OF NOPEN ETC + ;SELECTS CHNL FOR ALL IOTS, OPENS ETC + ;LH -1 IF STORED BY CHNDCD, ELSE ZERO (SEE WHO LINE ROUTINES) +TRMNAM: 0 ;TERMINAL IDENTIFICATION +TRNLST: 0 ;TRANSL LIST FOR THIS JOB. -1 => NIL, OR IDX INTO TRAN!X +TRNLS1: 0 ;TRANSL LIST FOR THIS JOB & INFERS. +UTRAPM:: ;SIGN BIT OF OPTIONS IS UUO-TRAP-TO-SUPERIOR MODE +OPTION: 0 ;OPTIONS WORD, SETTABLE BY USER + ;EACH BIT CONTROLS SOME SYSTEM ACTION FOR THIS JOB + .SEE %OP +XUNAME: 0 ;"WHO I REALLY AM" AS OPPOSED TO "WHO I AM LOGGED IN AS" +XJNAME: 0 ;JOB NAME USER SPEC'ED AS OPPOSED TO UNIQUIZED VERSION + +40ADDR: 20,,40 ;RH=ADDRESS OF USER'S 6-WORD BLOCK FOR UUO'S, INTS, SWITCHES, LOCKING. + ;LH=ADDRESS OF USER'S 20-WORD BLOCK FOR SUPERIOR'S USE. 0=20. +IFN N11TYS,[ +TVCREG: -1 ;TV CONSOLE REG FOR THIS USER OF -1 NONE +TVVBN: -1 ;-1 OR CONSOLE REG FOR RUN BLINKING +NVDBA: 0 ;# VIDEO BUFFERS ASSIGNED (WITH NVDBA SYSTEM CALL). +];N11TYS +UWHO1: 0 ;WHOLINE FLAGS +UWHO2: 0 ;TWO HALFWORDS, PRINTING CONTROLLED BY UWHO1 4.9-3.3 +UWHO3: 0 ;TWO MORE HALF WORDS, CONTROLLED BY UWHO1 3.2-1.5 +IFN KL10P,[ +ULSPBR: 0 ;STBR,,GCSTBR FOR SPECIAL LISP INSTRUCTIONS +] +SERVER: -1 ;User index of server job who is allowed write access to + ; this job to implement some oddball protocol. -1 if none. +;INSERT NEW USER VARIABLES HERE^ + +USRPDL: -LUPDL,,UPDL-1 ;USER PDL +UPDL: BLOCK LUPDL-1 +EPDL2: 0 ;SAVES C(T) FOR FLSINS +QLD: 0 ;LINK DEPTH +VALUE:: ;PROCEDURE "VALUE" RETURN +SRN3: 0 ;SAVED N3, N4 FOR RENAMES AT AOPEN ALSO USER INDEX AT NLOAD + ;SRN3, SRN4 USED BY CORBLK .CALL +.SEE IODCS2 ;SRN3 contains saved user mode PC for unlocking own locks. +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE SRN4 OR SRN5 +SRN4: 0 ;ALSO DEVICE CHNL IOCHNM POINTER AT NLOAD +SRN5: 0 ;SAVED N5 FOR LINK ALSO VIRTUAL PAGE NUMBER AT NLOAD +EPDL3: 0 ;USED BY 2311 ROUTINES (QFNG) ALSO QSMDN ADDR AT NLOAD ALSO BY TYOW2 +.SEE ALOGO4 ;NO CLOSE ROUTINE MAY USE EPDL + ;FOR BP-STYLE RENAME, RENMWO AND MLINK, + ;HOLDS BP (OR BP BLK PTR) TO NAMES TO RENAME OR LINK TO. +EPDL: 0 ;USED BY 2311 ROUTINES. + ;FOR SOPEN AND BP-STYLE RENAME, DELETE, HOLDS BP OR BP BLOCK PTR. +EPDLT1: 0 ;FN1 BEFORE LAST TRANSLATION, USED BY NLOAD +EPDLT2: 0 ;FN2 " " " , USED BY NLOAD +EPDLT3: 0 ;SYS NAME " " " +EPDLT4: 0 ;LEFT ADJ DEVICE NAME " " " + +STTYOP: 0 ;IN THE TOP OF A DETACHED TREE, THIS CONTAINS THE SAVED USER TTY + ; OPTIONS. 2.9=1 IF IT IS VALID, 2.7-2.8 ARE QUERY AND REFUSE MODE, + ; THE REST ARE TTYOPT BITS. + +IFN 0,[ ;FAKE OUT @ +LSWB0: +] +REPEAT NULBLK,[ +CONC LSWB,\.RPCNT,: BLOCK 2 +] ;SWITCH BLOCK FORMAT + ;WD1 ASSOCIATED ADDRESS OR QUANTITY + ;3.6-3.1 USER NUMBER OF SWITCH HOLDER + ;2.9-1.1 PNTR TO NEXT SWITCH ON LIST OR 0 IF NONE + ;FOR REMAINDER OF FORMAT SEE LSWDIS + +IFN KL10P,[ +IFGE USRSTG+1000-., INFORM SPACE LEFT IN UPT,\1000-<.-USRSTG> +IFL USRSTG+1000-., .ERR USER VARS TOO BIG FOR UPT! +.ELSE LOC USRSTG+1000 +] ;IFN KL10P + +IFN KS10P, LOC <.+7>&-10 ; KS UPT must be 0 mod 8 (see UUOPCW) + +LUBLK==.-USRSTG +L==LUBLK +INFORM [STORAGE PER LOSER]\LUBLK + BLOCK LUBLK ;USER VARIABLES FOR CORE JOB +SYSB==<1777+.>_-10. +MXC==SYSUSB-SYSB ;AVAIL BLOCKS AFTER SYS+DDT + + SUBTTL TSS INITIALIZATION +;NEXT LINE COMMENTED OUT BECAUSE IT CAUSES MORE TROUBLE THAN IT SAVES +;.HKALL==1 ;(THE FOLLOWING CODE IS WIPED OUT AT ICLR) +EXEUMP=UPGMP+100 ;EXEC UPPER MAP LIVES IN SYSTEM JOB'S PAGE TABLE + ;SYMBOL IS DEFINED HERE SINCE UPGMP WAS JUST DEFINED 6 PGS AGO + +BEG: SKIPN SALV ;SEE IF LOSER FORGOT TO LOAD SALV WHEN BUILDING SYSTEM, + ;OR SALV MEM IS NXM. EVIL! EVIL! + BUG AWFUL,[HEY! WHERE'S THE SALVAGER?] + JSR SALV+1 ;CALL NO-QUESTIONS-ASKED SALVAGER +GO: JFCL 17,.+1 + JRST .+1 + JFCL 1,[JRST 4,.] ;SYSTEM WONT RUN ON 6 +IFN KL10P,[ + CONSO PAG,600000 + SWPIA ;IF CACHE OFF, FLUSH CRUFT THAT MAY BE IN IT + CONSZ PAG,600000 + SWPUA ;IF CACHE ON, UPDATE CORE SO DDT IS GOOD + CONSZ 200000 + JRST .-1 + SPCCTX 0,1,USRSTG,DISABLE ;SET UP UPT ADDR, BUT NO ACCTING TILL + MOVEI T,0 ;MORE INIT IS DONE. + XCTR XBW,[BLT T,17] ;CLEAR BLK 1 TO AVOID RANDOM PARITY + ; ERRORS +] ;KL10P +IFN KS10P,[ + CONO 20700+APRCHN ; Clear memory related APR flags + ; (ECC, Bad, NXM) + MOVSI TT,%KEHLD+%KEREF+%KEPWR + IOWR TT,[KSECCS] ; Reset memory status register. + MOVEI TT,%UBTIM+%UBBAD+%UBPAR+%UBNXD+%UBINI + IOWRQ TT,UBASTA ; Reset both Unibus's and both adaptors. + IOWRI TT,UBASTA + MOVEI TT,DSKCHN_3 ; Set PI level for RH11. (No, you can't do + IOWRQ TT,UBASTA ; this at the same time you reset the Unibus.) + MOVEI TT,MTCCHN_3+TTYCHN ; PI for Tape, for Chaos and TTYs. + IOWRI TT,UBASTA + WRHSB [HSB] ; Set halt status block location. + CLRCSH ; Reset cache once for good measure. + SPCCTX 0,1,USRSTG ; Set up UPT and AC blocks. +] ;KS10P +IFN TEN11P,[ + MOVEI TT,600000+ + SKIPGE TEN11F + MOVEI TT,0 + DPB TT,[.T11CP+EXEUMP] + SETOM T11MP+_-10. ;DONT USE MAP PAGE AS 10-11 PAGE +;IFN PDP6P,[ ;THESE ARE IN SEPARATE MOBIES NOW +; MOVE TT,[-LPDP6M,,_-10.] +; SETOM T11MP(TT) ;CONFLICTS WITH PDP-6 MEM +; AOBJN TT,.-1 +;] +;IFG TSYSM-256.,[ +; MOVSI TT,-TSYSM+256. +; SETOM T11MP(TT) ;CONFLICT PAGES +; AOBJN TT,.-1 +;] +] + MOVE P,SYSPDP + +;INIT THE EXEC PAGE MAP'S DDT PAGES. + HRRZ A,DDT-2 ;LOWEST ADDR IN SYMBOL TABLE + SUBI A,100 ;LEAVE ROOM FOR EXTRA SYMS, 340 ROUTINES' LOSSAGE, ETC. + LSH A,-10. ;GET PAGE SYMTAB STARTS IN + MOVEM A,FDDTPG + MOVEI Q,NQS-1 ;PUT THE TUTS JUST BELOW THE DDT PAGES +BEGTT1: SKIPE QACT(Q) + JRST BEGTT3 ;UNIT NOT IN USE + MOVE T,NTBL(Q) ;NUMBER OF PAGES IN THIS TUT +BEGTT2: SUBI A,1 + MOVE B,[MU23TT_<.TZ .BM >] + MOVEM B,MEMBLT(A) + DPB Q,[MNUMB,,MEMBLT(A)] + SOJG T,BEGTT2 + MOVE B,A + LSH B,10. + HRLI B,640000 + MOVEM B,QTUTO(Q) +BEGTT3: SOJGE Q,BEGTT1 + MOVEM A,FTUTPG + ;NOW MAKE SURE ALL THOSE PAGES ARE MAPPED + MOVEI B,-200(A) ;ASSUMING TSYSM AT LEAST 128K + LSH B,-1 ;GET A B.P. TO IDPB MAP HWD OF 1ST DDT PAGE + ADD B,[442200,,EXEUMP] + TRNE A,1 + IBP B + MOVEI C,600000+PMCSHM(A) ;COMPUTE CONTENTS OF THAT MAP WORD. + MOVE D,[MUDDT_<.TZ .BM >] +BEG3: CAML A,FDDTPG + MOVEM D,MEMBLT(A) +IFG TSYSM-128., IDPB C,B + AOS C +IFG TSYSM-400, CAIE A,400 +.ELSE CAIE A,TSYSM ;STORE THAT MAP WORD AND ALL REST THERE ARE. + AOJA A,BEG3 + +;INITIALIZE REST OF EXEC PAGE MAP +IFN DIRMAP,[ + MOVE Q,[222200,,EXEUMP] + SETZB A,B + SKIPE USEMDM ;MAKE MEDIUM MEM NXM IF DIRMAP NOT TURNED ON + MOVEI B,600200+PMCSHM ;THIS MAY BE USEFUL FOR DEBUGGING + MOVE T,FTUTPG + SUBI T,201 ;STOP AT 1ST TUT PAGE. +BEG2: CAIL A,NEXPGS + DPB B,Q + IBP Q + ADDI B,1 + CAMGE A,T + AOJA A,BEG2 +];END IFN DIRMAP +;DROPS THROUGH + ;DROPS IN + +;SET UP EXEC LOWER MAP (EVEN ON KA, WILL BE LOOKED AT BY .CALL CORBLK) + MOVE A,[600000,,600001+PMCSHM] ;PAGE 0 IS NOT CACHED + MOVSI B,-100 + MOVEM A,EXELMP(B) + TLO A,PMCSHM + ADD A,[2,,2] + AOBJN B,.-3 + +;SET UP SYS JOB'S CIRCULAR POINTERS SO ALL THE PAGES IT HAS ARE ABSOLUTE + + MOVE A,[442200,,UPGMP] + MOVE B,[442200,,UPGCP] + MOVEI D,0 +BEG6: ILDB T,A + MOVEI E,-1 + JUMPN T,BEG7 + CAIL D,200+MMP0 ;ALLOW USERS TO COPY MMP EXEC PGS + CAILE D,200+NEXPGS + MOVEI E,0 ;PG IT DOESN'T HAVE, AND NOT COPYABLE EXEC PG +BEG7: IDPB E,B + CAIGE D,377 + AOJA D,BEG6 + +;EXEC MAP PREPARED, NOW TURN ON PAGING + +IFN KA10P,[ + LPMR UPGML + CONO 633550 +] ;KA10P +IFN KS10P,[ + CONO 67760 ; Disable and Clear all flags + CONO 127660 ; Enable and Clear all flags except memory ECC + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + LDBR3 EXEUMP ; Load exec DBRs. + LDBR4 EXELMP + LPMR UPGML + SPCCTX 1,1,USRSTG ; Select AC blocks and set UBR. + WREBR 020000+ ; Paging on and set EBR. +] ;KS10P +IFN KL10P,[ + CONO 327740 ;ENABLE AND CLEAR ALL FLAGS EXCEPT SWEEP DONE + APRID A + TLNN A,%UCITS + BUG AWFUL,[ITS WON'T RUN WITH THE DEC MICROCODE] + SPCCTX 6,6 ;LOAD MICROCODE CONSTANTS NEEDED BY PAGEING INTO + ; BLOCK 6. + MOVEI 3,EXEUMP ;DBR3 + MOVEI 4,EXELMP ;DBR4 + MOVSI 5,PMAGEM ;LH.AGE + MOVEI 6,PMAGEM ;RH.AGE + MOVEI 7,1000 ;CN1000 + MOVEI 10,100 ;CN100 + CONO PAG,660000+ ;CACHE ON, ITS PAGER, TRAP ENB, EPT ADDR + SPCCTX 1,1,USRSTG,DISABLE + LPMR UPGML +] ;END IFN KL10P + MOVE P,SYSPDP + +;INITIALIZE FREE LISTS IN MEMBLT + + MOVEI A,1 ;A PG NO - NOTE: DON'T DO PAGE ZERO +BEGF0: CAML A,FTUTPG ;IF THIS ISN'T A DDT OR TUT PAGE, THEN + CAIL A,400 + PUSHJ P,CIMEMR ;PUT THIS PAGE ON THE RIGHT FREE LIST + CAIGE A,TSYSM-1 + AOJA A,BEGF0 +IFN TEN11P,[ + SKIPGE TEN11F + JRST BEG4 + MOVSI A,-256. ;CLEAR THE INTERFACE'S "VALID" BITS. + SETZM 400000+T11CP*2000(A) + AOBJN A,.-1 +BEG4:] +IFN XGP,[ + SKIPE TEN11F + JRST BEGX1 + MOVE A,[600000+,,1777] + PUSHJ P,T11AD + BUG ;NO 10-11 PAGES AVAILABLE? + MOVEI TT,600000+<_8>(B) ;GET CORRESP EXEC MAP PG SETUP + DPB TT,[.XGPC+EXEUMP] + MOVEI TT,600000+<_8>+XGPTP + DPB TT,[.XGPB+EXEUMP] ;SETUP PAGE FOR PDP-11 BUFFER +BEGX1:] + +;CHECK AVAIL MEM FOR EXISTANCE + +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + IORI TT,200000 ;GRANT READ ACCESS + DPB TT,[.ECCPG+EXEUMP] + LPMR UPGML + MOVE A,400000+ECCPG*2000+1760 ;GET CURRENT HISTORY POINTER + LSH A,-32. + MOVEM A,ECCIDX +];ECCMEM + MOVEI A,TSYSM-1 +CKML: MOVEI TT,600000(A) + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN ECCMEM,[ + LDB TT,[121200,,ECCADR] ;GET PAGE THAT ECC HISTORY IS ON + CAMN A,TT ;THIS PAGE? + JRST CKML1A ;YES, TREAT AS IF OFFLINE, THOUGH WILL ACCESS IT + ; DIRECTLY FROM TIME TO TIME +] + MOVE TT,A + LSH TT,10. + MOVSI T,-8 + CAML TT,MEMLZL(T) + CAML TT,MEMLZH(T) + AOBJN T,.-2 + JUMPL T,CKML1A ;THIS BLOCK KNOWN TO BE LOSING + SKIPL USEHM + CAIGE A,256. + JRST .+2 + JRST CKML1A ;HIGH MOBY NOT TO BE USED +IFN KL10P,[ + MOVEI TT,CKML1 ;KL10 CAN GET PARITY FAULT ON REFERENCE TO NXM + MOVEM TT,PFNPC + HRRM TT,MUUOKN ;IT CAN ALSO GET A UUO +] ;KL10P +IFN KS10P,[ + MOVEI TT,CKML1 + MOVEM TT,EPTPFN +] ;KS10P + CAIL A,256. ;IF NOT IN BOTTOM 256K, DON'T ASSUME GOOD DATA + SETZM 400000+PAREP*2000+20 ;STORE ZERO SO DON'T GET PARITY ERROR + MOVE 0,400000+PAREP*2000+20 ;IF THIS NXMS, MEM THE SYS THINKS + ; IT HAS IS NON EXISTANT +IFN KA10P,[ + CONSZ 10000 + JRST CKML1 ;THAT MEM NXM +] ;KA10P +IFN KL10P,[ + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN + CONSZ 2000 + JRST CKML1 ;THAT MEM NXM +] ;KL10P +IFN KS10P,[ + MOVEI TT,PFAIL + MOVEM TT,EPTPFN + CONSZ 400 + JRST 4,. ; This can't happen, right? (If we got a NXM, we + ; would have trapped to CKML1 already.) +] ;KS10P + SKIPL CKMBLK ;WINS + JRST CKML6 ;THUS ENDING BLOCK OF LOSERS +CKML2: SOJGE A,CKML + AOSN CKMFLG ;ANY MEM OFF UNEXPECTEDLY? + JRST CKML5 ;NO + MOVEI TT,[ASCIZ/ +IS THIS OK? /] ;YES, MAKE SURE SOMEBODY KNOWS ABOUT IT. MAY BE SERIOUS SCREW. + PUSHJ P,T00ASZ + PUSHJ P,T00TYI + ANDI A,137 + CAIE A,"Y + JRST DDT + MOVEI TT,[ASCIZ/ +/] + PUSHJ P,T00ASZ ;CRLF +CKML5: +IFN KL10P,[ + CONO 26400 ;CLEAR ANY NXM AND PARITY INTERRUPTS + CONI MTS,TT + TLNN TT,400 + BUG PAUSE,[TAPE DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] + CONI DSK,TT + TLNN TT,4000 + BUG PAUSE,[DISK DF-10 IS IN KA MODE, PLEASE FLIP THE SWITCH] +] ;KL10P +IFN KS10P, CONO 20400 ; Clear NXM flag +;DROPS THROUGH + ;DROPS IN + +IFN RP10P,[ + DATAI DPC,A + TLNN A,NOWRIH ;CHECK FOR FORMAT SWITCH ON RP10 + BUG PAUSE,[RP-10 WRITE HEADERS ENABLED, PLEASE FLIP THE SWITCH] +];RP10P + +IFE &,[ ;CHECK FOR LOSING SWITCHES ON MEMORY ON ML-KA AND DM + + MOVSI D,(DWRITC) ;MAKE COMMAND FOR VERY LAST BLOCK ON DISK + MOVEI A,NCYLS+XCYLS-1 + DATAO DPC,[DNOOPC] ;DETERMINE TYPE OF DRIVE 0 + DATAI DPC,B + TRNE B,RP03BT + MOVEI A,MCYLS+XCYLS-1 ;RP03 + DPB A,[DCYL D] + LSH A,-8 + DPB A,[DCYLXB D] + MOVEI A,NHEDS-1 + DPB A,[DSURF D] + ADDI D,QICWA + MOVEM D,CKMSWC + SUB D,[DWRITC-DREADC] + MOVEM D,CKMSRC + SUB D,[DREADC-DSEEKC] + MOVEM D,CKMSSC + MOVEI A,0 +CKMS1: LDB TT,[MUR,,MEMBLT(A)] ;MEM EXIST? + CAIE TT,MUFR ;AND NOT DDT? + JRST CKMS2 + MOVEI B,600000(A) + DPB B,[.PAREP+EXEUMP] + LPMR UPGML + CAIGE A,CKMSZZ ;MEM LOADED? + JRST CKMS3 ;YES + MOVSI B,'FOO ;NO, LOAD IT + MOVEM B,CKMSBF + MOVE B,[CKMSBF,,CKMSBF+1] + BLT B,CKMSBF+177 + MOVEI B,'BAR + HRRM B,CKMSBF+69. + HRRM A,CKMSBF+6 ;MAKE DIFF FROM OTHER SUCH PAGES + MOVEI C,1 + MOVE B,A + LSH B,-4 ;16K BLOCK # IN B + LSH C,(B) ;GET UNIQUE BIT SO PARITY ERR IF TWO AT SAME ADDR + MOVEM C,CKMSBF+35 + MOVE B,[CKMSBF,,400000+PAREP*2000] + BLT B,400000+PAREP*2000+177 +CKMS3: MOVE B,A ;MAKE IOWD + LSH B,10. + SOS B + HRLI B,-200 + LDB C,[100300,,A] ;MA 15-17 + TRC C,7 + DPB C,[410300,,B] + MOVEM B,QICWA + SETZM QICWA+1 + CONO DPC,175700 + DATAO DPC,CKMSSC ;POSITION HEADS + CONSO DPC,10 + JRST .-1 + DATAO DPC,CKMSWC ;WRITE OUT SECTOR + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS4 ;CHANNEL ERROR MEM LOSING + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVE B,[-200,,CKMSBF-1] ;READ IT BACK + MOVEM B,QICWA + SETZM QICWA+1 + SETZM CKMSBF+69. + CONO DPC,175700 + DATAO DPC,CKMSRC + CONSZ DPC,20 + JRST .-1 + CONI DPC,B + TLNE B,17 + JRST CKMS2 ;MEM LOSS IN CKMSBF? + TRNE B,177700 + JRST CKMS2 ;FOO, DISK LOSING + MOVSI B,-200 ;COMPARE + MOVE C,CKMSBF(B) + CAME C,400000+PAREP*2000(B) + JRST CKMS4 ;NOT SAME SWITCHES LOSING + AOBJN B,.-3 +CKMS2: +IFE MCOND DM, ADDI A,16. ;MA10'S !! +IFE MCOND MLKA, ADDI A,32. ;ML-KA MEM IS IN 32K MODULES + CAIGE A,TSYSM + JRST CKMS1 + CONO DPC,175700 ;RESET THE DISK CONTROL + DATAO DPC,[DEASEC+776] ;AT EASE! + CONO PI,20000 ;TURN OFF IOB PI REQ LIGHT + JRST CKMSX ;DONE WITH THIS, CONTINUE INITIALIZATION + +CKMSBF: BLOCK 200 + +CKMS4: MOVEI TT,[ASCIZ/MEM ADDR SWITCHES DISAGREE CPU VS DSK AT LOC /] + PUSHJ P,T00ASZ + PUSHJ P,T00BKO + MOVEI TT,[ASCIZ/0000/] + PUSHJ P,T00ASZ + JRST DDT + +CKMSZZ==./2000+2 ;ABOVE HIGHEST CODE + +CKMSX: +] ;END IFE MCOND MLKA & DM + ;DROPS IN + MOVEI TT,0 + DPB TT,[.PAREP+EXEUMP] + LPMR UPGML +IFN KA10P, CONO PI,240000+11577+IFN C1MXP,20000 +IFE KA10P, CONO PI,11577 +IFN NOTYS, CONO TTY,TTYCHN +IFN NETYS,[ + SETOM DTEODN ;CAN GET SET ON WHILE LOADING, BUT INTR GETS LOST +IFE PDCLKP, CONO DTE,1170+APRCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +IFN PDCLKP, CONO DTE,1170+TTYCHN ;CLEAR ALL FLAGS AND ASSIGN PI CHANNEL +] ;END OF IFN NETYS +IFN E.SP,[ + CONO DIS,515330 ;RESET E&S + MOVEI TT,E.SPM + MOVEM TT,34 ;SET PAGER LOC (USED BY DSKDUMP) +] +IFN TM10B,[ + MOVEI TT,MIOWD + MOVEM TT,MICWA ;SETUP LOC FOR MEM CHAN TAPE +] +IFN RP10P+RH10P,[ + MOVEI TT,QIOWD + MOVEM TT,QICWA ;SETUP FOR DEC DISK CHANNEL +] +IFN ARMP, DATAO 760,[0] ;RESET LITE ON ARM +IFN DSDP, CONO DSDEV,10 ;RESET INT RQ FROM PDP10 +IFN RBTCP, CONO RBTCON,0 ;RESET TABLET + + MOVE A,DDT-2 ;PUT GLOBAL BLOCK HEADER AT BEGINNING + MOVE B,[SQUOZE 0,GLOBAL] + CAME B,(A) ;SEARCH FOR GLOBAL BLOCKS + AOBJN A,[ AOBJN A,.-1 + JRST BEGS1] + MOVE C,DDT-2 + MOVEI D,(C) + SUBI D,(A) ;GET ,,-#WDS BEFORE GLOBAL BLOCK + MOVSI D,(D) + ADDM D,1(A) ;GLOBAL BLOCK NOW LARGER + EXCH B,(C) ;EXCHANGE IT WITH FIRST SYM + MOVEM B,(A) + MOVE B,1(A) + EXCH B,1(C) + MOVEM B,1(A) +BEGS1: PUSHJ P,SBUBL + JUMPL J,BEGS1 ;KEEP SORTING UNTIL SYMS IN ORDER + MOVSI A,400000 + IORM A,DDT-1 + +; SORT THE UUO/SUSET/BIT SYMBOL TABLE BY VALUE + + MOVE E,[SYSYMB-SYSYME-1,,SYSYMB] + PUSHJ P,SBUBL0 + JUMPL J,.-2 + + MOVE A,[-LTSTB,,TSTB] +BEG1: MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + MOVEM C,CKSUMS-TSTB(A) + MOVE B,(A) +CKXC2: MOVE C,(B) +REPEAT 36.,[ + IFL .RPCNT-18., TLNE C,400000_<-.RPCNT> + .ELSE TRNE C,400000_<18.-.RPCNT> + XORM B,CKXORS+.RPCNT +] + AOBJN B,CKXC2 + AOBJN A,BEG1 + HRRZS 37 ;MAKE SURE SYS DOESNT IMMEDIATELY COME DOWN +;DROPS THROUGH + ;DROPS IN + MOVEI A,0 + CLEARM QACTB +QSETUP: MOVE B,DCHBT(A) + SKIPN QACT(A) + IORM B,QACTB + CAIGE A,NQS-1 + AOJA A,QSETUP +IFN DC10P, CONO DC0,DCCSET+DCDENB+DSKCHN ;RESET 2314 AND SET DATA ERROR ENABL +IFN 340P, CONO DIS,100 +IFN TK10P, CONO NTY,TTYCHN +IFN MTYP, CONO MTY,TTYCHN + CLEARM USRHI + CLEARB U,USER + MOVE P,SYSPDP +IFN DPKPP,[ + CONO DPK,400070+TTYCHN ;INITIALIZE DP KLUDGE + DATAO DPK,[4,,DPKBAS] + MOVE T,[-NDPTYS,,NFDPTY] + MOVEI B,0 ;LINE # +DPIL: LDB A,[$TTOSP,,TTYTYP(T)] ;OUTPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] ;LINE # + CONO DPK,500+TTYCHN(A) ;LOAD OUT SPEED + LDB A,[$TTISP,,TTYTYP(T)] ;INPUT SPEED + MOVE A,DPSP(A) ;MAP TO DPK SPEED CODE + DPB B,[140400,,A] + CONO DPK,700+TTYCHN(A) ;LOAD IN SPEED + AOS B + AOBJN T,DPIL +] +IFN DZ11P,[ + PUSHJ P,DZINIT +];DZ11P +IFN N11TYS,[ + SKIPE TEN11F + JRST BEG5 + MOVSI R,-NTTPG-NTVBP+1 + MOVE T,[.TTPG0+EXEUMP] +BEG9: MOVEI A,(R) ;SET UP 1 MORE TEN-11 MAP ENTRY + LSH A,20. + IORI A,1777 ;A FULL PAGE + TLO A,600000+TT11NM*400 + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> ;READ-WRITE, IN HIGH MOBY. + DPB B,T + IBP T + AOBJN R,BEG9 + MOVE A,[(600000+TT11NM*400)TT11CR_8] ;POINTER TO CONSOLE REG + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,T + LPMR UPGML + SKIPE TT11P ;IF WE'RE SUPPOSED TO USE THE TV 11, + SETZM TT11UP ;REQUEST IT TO RE-INIT. + ;IF TT11UP BECOMES NONZERO, THE 11 IS UP. +BEG5: ];END IFN N11TYS +IFN CH11P,[ + XCTRI [IORDI A,CAIMYN] + CAIA + BUG HALT,[CHAOSNET INTERFACE NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS)] +] ;CH11P +IFN CHAOSP,[ IFN T11CHP,[ + SKIPE TEN11F ;SET UP TEN-11 CHAOS NET INTERFACE PAGE + JRST BEG8 + MOVE A,[(600000+CH11NM*400)1004_8+1777] + PUSHJ P,T11AD + BUG + ADDI B,600000+<_8> + DPB B,[.CHSPG+EXEUMP] +BEG8: ]] ;CHAOSP, T11CHP +IFN DL10P,[ ;INITIALIZE DL10 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + SKIPE DL10F + CONO DLC,100020+TTYCHN ;ENB PDP11 PORT #0 AND ENB INTR + MOVSI T,1 + SKIPN DL10UP + SOJG T,.-1 + SKIPGE T ;IF THE 11 DIDN'T SAY IT WAS UP, + SETZM DL10F ;MARK IT NON-FUNCTIONAL. +] +IFN KL10P,[ + CONO TIM,460000+3900. ;SET INTERVAL TIMER TO 39 MILLISECONDS FOR OVHMTR + CONO MTR,433001 ;TIME BASE ON, ACCOUNT FOR USER + EXEC NO PI, INTERVAL PIA=1 + PUSHJ P,PRFOFF ;INIT PERFORMANCE COUNTER +] ;KL10P + +;DROPS IN + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;SYS JOB HAS NO CONSOLE ALL TO ITSELF + MOVEI U,LUBLK + PUSHJ P,USSINI ;INITIALIZE SYS JOB VARIABLES BLOCK + JRST .-1 + AOS NMPGS +IFE KA10P,[ + MOVEI T,UUOH0 ;CLOBBERED BY USSINI + HRRM T,MUUOKN +] ;IFE KA10P + MOVSI T,600000 + HLLM T,UPGMP ;GIVE PG 0 TO SYS JOB + MOVSI T,-1 + HLLM T,UPGCP + MOVEI T,2000 + MOVEM T,HUSRAD + MOVEI T,SYSRCE ;SET SYS JOB RESOURCE POINTER + MOVEM T,UTMPTR + MOVSI A,(SIXBIT /SYS/) ;""" NAMES + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + SETZM USTP(U) + MOVSI T,%TBNOT+%TBDTY+%TBNVR ;CORE JOB HAS NO CONSOLE + MOVEI U,2*LUBLK + PUSHJ P,USSINI ;SET UP CORE JOB VARIABLES BLOCK + JRST .-1 + MOVE A,[SIXBIT /CORE/] + MOVEM A,USYSNM(U) + MOVEM A,UNAME(U) + MOVEM A,XUNAME(U) + MOVSI A,(SIXBIT /JOB/) + MOVEM A,JNAME(U) + MOVEM A,XJNAME(U) + MOVEI T,SYSRCE + MOVEM T,UTMPTR+LUBLK + SETZM USTP(U) + MOVEI A,CORJI +IFE KA10P, HRLI A,%PSPCU ;DOES CORE JOB XCTR? + MOVEM A,UPC(U) +IFE KA10P,[ + MOVE T,[JSR ILLTRP] ;SYS AND CORE JOBS SHOULDN'T TRAP + MOVEM T,TR1INS ;THESE WON'T BE USED ANYWAY UNLESS + MOVEM T,TR2INS ;SOMEDAY THEY SHOULD RUN IN USED MODE + MOVEM T,TR3INS + MOVEM T,TR1INS+L + MOVEM T,TR2INS+L + MOVEM T,TR3INS+L +] ;IFE KA10P + MOVEI A,SYSB+2 ;GIVE SYSTEM CORE TO SYS JOB, WITH A COUPLE + MOVEM A,CORRQ ; SPARE JOB SLOTS + AOS NCORRQ + SOS A + ADDM A,NCBCOM +; DATAI CLK1,LCLK1 + CONO PI,100+UTCON-1 ;ALL EXCEPT 7 +IFN KA10P, CONO 3000+APRCHN +IFN KL10P,[ +IFN PDCLKP, CONO CLK,APRCHN +.ELSE [ MOVEI A,%DTCLN ;TURN ON 60-CYCLE CLOCK + MOVEM A,DTECMD + SETZM DTEFLG + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] + CONO APRCHN ;ENABLE APR FAULT INTERRUPTS + SWPUA ;UPDATE MEMORY AGAIN TO MAKE SURE DDT + SYMBOL + ; TABLE OUT OF CACHE + CONSZ 200000 + JRST .-1 +] ;KL10P +IFN KS10P,[ + WRINT [KSFREQ] ; 60 cycle clock. + CONO APRCHN ; Enable APR faults and clock ints. + CLRCSH ; Is this necessary? What the heck... +] ;KS10P +IFN CH10P,[ + CONI CHX,T ;CHECK CHAOS ADDRESS SWITCHES + LDB T,[$CHXAD,,T] + CAIE T,MYCHAD + JRST [ MOVEI TT,[ASCIZ/CHAOSNET ADDRESS SWITCHES ARE SET WRONG/] + PUSHJ P,T00ASZ + JRST DDT ] + CONO CHX,@CHXCNO ;ENABLE INTERRUPTS +];CH10P + JRST ICLR + +CKML1: ;MEM NON-EXISTANT PATCH OUT +IFN KA10P, CONO 10000 ;TURN OFF NXM FLAG +IFN KL10P,[ + CONO 22000 + MOVEI TT,PFAIL + MOVEM TT,PFNPC + MOVEI TT,UUOH0 + HRRM TT,MUUOKN +] ;KL10P +IFN KS10P,[ + CONO 20400 + MOVEI TT,PFAIL + MOVEM TT,EPTPFN +] ;KS10P + SKIPGE CKMBLK + MOVEM A,CKMBLK ;HIGHEST IN BLOCK OF LOSERS +CKML1A: LDB TT,[MUR,,MEMBLT(A)] + CAIE TT,MUFR + BUG ;? + CAIG A,SYSB+1 + JRST 4,. ;SYS MEM NON EX? (BUG PROBABLY WON'T WORK) + PUSHJ P,MPOUT2 ;FLUSH THAT BLOCK + MOVEI TT,MUHOLE + DPB TT,[MUR,,MEMBLT(A)] + CAIL A,400 ;IF NXM IN LOW MOBY + JRST CKML2 + MOVEI U,0 + PUSHJ P,UPLC + LDB TT,T + ANDI TT,PMRCM + CAIE TT,(A) + JRST CKML2 + DPB U,T ;PATCH THIS BLOCK OUT OF EXEC MAP + DPB U,Q + JRST CKML2 + +; REPORT A BLOCK OF LOSING MEMORY + +CKML6: PUSH P,A + MOVEI TT,[ASCIZ/MEM OFF /] + AOSN CKMFLG + PUSHJ P,T00ASZ + ADDI A,1 ;LOWEST LOSER = HIGHEST WINNER + 1 PAGE + PUSHJ P,T00BKO + MOVEI A,"- + PUSHJ P,T00TYO + MOVE A,CKMBLK + PUSHJ P,T00BKO + MOVEI A,40 + PUSHJ P,T00TYO + SETOM CKMBLK + POP P,A + JRST CKML2 + +USEHM: -1 ;-1 => USE MEM IN HIGH MOBY (IF PRESET) + +CKMBLK: -1 ;IF + HIGHEST LOSING BLOCK IN CONTIG RANGE +CKMFLG: -1 ;IF + PRINTED MESSAGE ALREADY +CKMSWC: 0 ;WRITE CMD +CKMSRC: 0 ;READ CMD. +CKMSSC: 0 ;SEEK CMD. +;UP TO 8 RANGES OF ADDRESSES THAT SHOULD NOT BE USED BECAUSE THEY +;DON'T WORK BUT AREN'T NXM. +MEMLZL: BLOCK 8 ;LOWEST LOC +MEMLZH: BLOCK 8 ;HIGHEST LOC+1 +FTUTPG: 0 ;FIRST PAGE USED FOR TUTS + +;INPUT CHAR FROM CONSOLE TTY AND ECHO + +T00TYI: +IFN KA10P,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A + ANDI A,177 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPN A,DTEF11 + JRST T00TYI +] ;KL10P +IFN KS10P,[ + SKIPN A,8CTYIN + JRST .-1 + ANDI A,177 +] ;KS10P + +; TYPE CHAR IN A ON CONSOLE TTY + +T00TYO: +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + PUSH P,A + ANDI A,177 + IORI A,400 + MOVEM A,8CTYOT + CONI A + IORI A,80INT + CONO (A) + SKIPE 8CTYOT + JRST .-1 + POP P,A +] ;KS10P + POPJ P, + +; TYPE BLOCK NO IN A AS HIGH 3 OCTAL DIGITS OF ADDR +; (ALL MEMORIES MULTIPLE OF 4K. MAX MEMORY 2M WORDS.) + +T00BKO: PUSH P,A + PUSH P,B + LSHC A,-8 +REPEAT 3,[ + ADDI A,"0 + PUSHJ P,T00TYO + MOVEI A,0 + LSHC A,3 +] + JRST POPBAJ + +; TYPE ASCIZ IN TT ON T00 + +T00ASZ: PUSH P,A + HRLI TT,440700 +T00AZ1: ILDB A,TT + JUMPE A,POPAJ + PUSHJ P,T00TYO + JRST T00AZ1 + +IFN DPKPP,[ ;MAP SYSTEM SPEED CODES TO DATAPOINT KLUDGE CODES +DPSP: 0_9 ;134 + 1_9 ;600 + 2_9 ;110 + 3_9 ;150 + 4_9 ;300 + 5_9 ;1200 + 5_9 ;1800 * + 6_9 ;2400 + 7_9 ;4800 +REPEAT 20-<.-DPSP>, 7_9 ;FAST * +];DPKPP + +CONSTANTS +VARIABLES + +IEND: +.HKALL==0 + +; Define location known as start of SALV disk salvager. If system overruns +; this address, must either reduce system size or increase the SALV start +; address. If SALV is changed, the SALV program must also be changed to +; start at the right place. There is a limit to how high it can go, +; however. +IFN KL10P, SALV==:105*2000 ; MC-KL is getting huge +.ELSE SALV==:100*2000 +IFG IEND-SALV,.FATAL System overruns SALV start addr! + +IFGE TSYSM-256.,DDT=774000 +.ELSE DDT=TSYSM*2000-4000 +DSKDMP==DDT+3700 + +IFG LBUGTB-LBUGT2,[ +.ERR MAKE THE BUGTAB BIGGER +INFORM LBUGTB-LBUGT2,\LBUGTB-LBUGT2 +.FATAL FATAL ERROR, RUNNING THIS WOULD CAUSE TOTALLY WEIRD BUGS +] + +IF2 EXPUNGE FOO,ZZZQ,FNM,ZCHR,ZZ,ZZZ,BUGB,BUGF,BUGN,BUGNN + +END BEG ;START AT BEG TO SALVAGE AND RUN ITS, START AT GO TO JUST ITS diff --git a/system/its.notags b/system/its.notags new file mode 100644 index 0000000..b1a5c40 --- /dev/null +++ b/system/its.notags @@ -0,0 +1,145 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SYSTEM;BITS +0,xmidas + +SYSTEM;FSDEFS +0,xmidas + +SYSTEM;DC10 +0,xmidas + +SYSTEM;RP10 +0,xmidas + +SYSTEM;RH10 +0,xmidas + +SYSTEM;RH11 +0,xmidas + +SYSTEM;RP06 +0,xmidas + +SYSTEM;RM03 +0,xmidas + +SYSTEM;T300 +0,xmidas + +SYSTEM;DZ11 +0,xmidas + +SYSTEM;EPT +0,xmidas + +SYSTEM;KSDEFS +0,xmidas + +SYSTEM;ITS +0,xmidas + +SYSTEM;CONFIG +0,xmidas + +SYSTEM;TTYTYP +0,xmidas + +SYSTEM;TIME +0,xmidas + +SYSTEM;TM03S +0,xmidas + +SYSTEM;NMTAPE +0,xmidas + +SYSTEM;UTAPE +0,xmidas + +SYSTEM;DISK +0,xmidas + +SYSTEM;ITSDIS +0,xmidas + +SYSTEM;ITSMSP +0,xmidas + +SYSTEM;TS3TTY +0,xmidas + +SYSTEM;ITSDEV +0,xmidas + +SYSTEM;NET +0,xmidas + +SYSTEM;KAIMP +0,xmidas + +SYSTEM;LHDH +0,xmidas + +SYSTEM;IMP +0,xmidas + +SYSTEM;NCP +0,xmidas + +SYSTEM;INET +0,xmidas + +SYSTEM;TCPBUF +0,xmidas + +SYSTEM;TCP +0,xmidas + +SYSTEM;CHSDEF +0,xmidas + +SYSTEM;KSNET +0,xmidas + +SYSTEM;CHAOS +0,xmidas + +SYSTEM;SYSJOB +0,xmidas + +SYSTEM;CORE +0,xmidas + +SYSTEM;EVSYMS +0,xmidas + +SYSTEM;WHOVAR +0,xmidas + +SYSTEM;DDT +0,xmidas + +SYSTEM;DDTDSK +0,xmidas + +SYSTEM;DSKDMP +0,xmidas + +SYSTEM;IOELEV +0,xmidas + diff --git a/system/its.tags b/system/its.tags new file mode 100644 index 0000000..65e0aa9 --- /dev/null +++ b/system/its.tags @@ -0,0 +1,13937 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SYSTEM; BITS +12744,XMIDAS +DEFINE DEFSYM´345 +.MLLIT=´581 +$$TEMP=´592 +.ELSE $$TEMP=´612 +DEFSYM %E=µ018 +DEFSYM %ENSDV=µ060 +DEFSYM %ENSIO=µ095 +DEFSYM %ETMTR=µ131 +DEFSYM %ENSFL=µ173 +DEFSYM %EFLDR=µ208 +DEFSYM %EFLDV=µ243 +DEFSYM %ENRDV=µ275 +DEFSYM %ENADV=µ312 +DEFSYM %EBDFN=µ354 +DEFSYM %ENSMD=µ393 +DEFSYM %EEXFL=µ433 +DEFSYM %EBDCH=µ474 +DEFSYM %ETMRG=µ514 +DEFSYM %ENAPK=µ561 +DEFSYM %ENSDR=µ641 +DEFSYM %ELCDV=µ685 +DEFSYM %ESCO=µ723 +DEFSYM %ENAFL=µ769 +DEFSYM %ETMDR=µ802 +DEFSYM %EMCHN=µ835 +DEFSYM %ERODV=µ896 +DEFSYM %ETMLK=µ937 +DEFSYM %ETFRG=µ978 +DEFSYM %EROJB=¶024 +DEFSYM %EROPG=¶062 +DEFSYM %EBDRG=¶113 +DEFSYM %EBDDV=¶151 +DEFSYM %ENSJB=¶190 +DEFSYM %EBOJ=¶222 +DEFSYM %ENACR=¶270 +DEFSYM %ETOP=¶308 +DEFSYM %ENAPP=¶344 +DEFSYM %ENAJB=¶404 +DEFSYM %ENSCL=¶448 +DEFSYM %ENSCH=¶494 +DEFSYM %ENRBF=¶532 +DEFSYM %EBDFL=¶594 +DEFSYM %EBDLK=¶642 +NOPNLS=¶684 +DEFSYM %PI=·108 +DEFSYM %PIRLT=·163 +DEFSYM %PIRUN=·219 +DEFSYM %PINXI=·274 +DEFSYM %PIJST=·332 +DEFSYM %PIDCL=·393 +DEFSYM %PIATY=·439 +DEFSYM %PITTY=·493 +DEFSYM %PIPAR=·551 +DEFSYM %PIFOV=·602 +DEFSYM %PIWRO=·650 +DEFSYM %PIFET=·703 +DEFSYM %PITRP=·762 +DEFSYM %PIDBG=·814 +DEFSYM %PILOS=·872 +DEFSYM %PICLI=·926 +DEFSYM %PIPDL=·986 +DEFSYM %PILTP=¸040 +DEFSYM %PIMAR=¸082 +DEFSYM %PIMPV=¸129 +DEFSYM %PICLK=¸186 +DEFSYM %PI1PR=¸237 +DEFSYM %PIBRK=¸292 +DEFSYM %PIOOB=¸348 +DEFSYM %PIIOC=¸399 +DEFSYM %PIVAL=¸445 +DEFSYM %PIDWN=¸500 +DEFSYM %PIILO=¸558 +DEFSYM %PIDIS=¸615 +DEFSYM %PIARO=¸665 +DEFSYM %PIB42=¸712 +DEFSYM %PIC.Z=¸754 +DEFSYM %PITYI=¸797 +DEFSYM %PJ=¸843 +DEFSYM %PJRLT=¸890 +DEFSYM %PJRUN=¸945 +DEFSYM %PJNXI=¸999 +DEFSYM %PJJST=¹056 +DEFSYM %PJDCL=¹116 +DEFSYM %PJATY=¹161 +DEFSYM %PJTTY=¹213 +DEFSYM %PJPAR=¹269 +DEFSYM %PJFOV=¹318 +DEFSYM %PJWRO=¹364 +DEFSYM %PJFET=¹415 +DEFSYM %PJTRP=¹472 +DEFSYM %PJDBG=¹522 +DEFSYM %PJLOS=¹578 +DEFSYM %PC=¹658 +DEFSYM %PCARO=¹708 +DEFSYM %PCCR0=¹754 +DEFSYM %PCCR1=¹799 +DEFSYM %PCFOV=¹844 +DEFSYM %PCFPD=¹888 +DEFSYM %PCUSR=¹983 +DEFSYM %PCUIO=±0019 +DEFSYM %PCPUR=±0054 +DEFSYM %PCSPC=±0146 +DEFSYM %PC1PR=±0193 +DEFSYM %PCX17=±0265 +DEFSYM %PCFXU=±0315 +DEFSYM %PCDIV=±0369 +DEFSYM %PS=±0443 +DEFSYM %PSARO=±0493 +DEFSYM %PSPCP=±0539 +DEFSYM %PSCR0=±0718 +DEFSYM %PSCR1=±0763 +DEFSYM %PSFOV=±0808 +DEFSYM %PSFPD=±0852 +DEFSYM %PSUSR=±0946 +DEFSYM %PSUIO=±0994 +DEFSYM %PSPUB=±1064 +DEFSYM %PSPCU=±1141 +DEFSYM %PSINH=±1222 +DEFSYM %PSTR2=±1334 +DEFSYM %PSTR1=±1406 +DEFSYM %PSFXU=±1523 +DEFSYM %PSDIV=±1577 +DEFSYM %PS1PR=±1618 +DEFSYM %NQ=±1723 +DEFSYM %NQREF=±1788 +DEFSYM %NO=±1912 +DEFSYM %NOLSN=±1977 +DEFSYM %NS=±2045 +DEFSYM %NSCLS=±2100 +DEFSYM %NSLSN=±2175 +DEFSYM %NSRFC=±2213 +DEFSYM %NSRCL=±2271 +DEFSYM %NSRFS=±2332 +DEFSYM %NSOPN=±2361 +DEFSYM %NSRFN=±2397 +DEFSYM %NSCLW=±2441 +DEFSYM %NSCLI=±2497 +DEFSYM %NSINP=±2557 +DEFSYM %NT=±2593 +DEFSYM %NTCLS=±3006 +DEFSYM %NTLSN=±3070 +DEFSYM %NTSYR=±3116 +DEFSYM %NTCLU=±3155 +DEFSYM %NTSYN=±3206 +DEFSYM %NTOPN=±3263 +DEFSYM %NTWRT=±3295 +DEFSYM %NTCLX=±3341 +DEFSYM %NTCLI=±3388 +DEFSYM %NTINP=±3453 +DEFSYM %NC=±3503 +DEFSYM %NCNTO=±3570 +DEFSYM %NCUSR=±3603 +DEFSYM %NCFRN=±3637 +DEFSYM %NCRST=±3679 +DEFSYM %NCDED=±3703 +DEFSYM %NCINC=±3733 +DEFSYM %NCBYT=±3777 +DEFSYM %NCNCP=±3817 +DEFSYM %NCRFS=±3856 +DEFSYM .XC=±4009 +DEFSYM .XCNTO=±4179 +DEFSYM .XCUSR=±4213 +DEFSYM .XCFRN=±4249 +DEFSYM .XCRST=±4293 +DEFSYM .XCDED=±4354 +DEFSYM .XCINC=±4404 +DEFSYM .XCNCP=±4620 +DEFSYM .XCRFS=±4676 +DEFSYM %NX=±4775 +DEFSYM %NXNTO=±4945 +DEFSYM %NXUSR=±4979 +DEFSYM %NXFRN=±5015 +DEFSYM %NXRST=±5059 +DEFSYM %NXDED=±5120 +DEFSYM %NXINC=±5170 +DEFSYM %NXNCP=±5386 +DEFSYM %NXRFS=±5442 +DEFSYM %UC=±5606 +DEFSYM $UCOPT=±5656 +DEFSYM %UCKLP=±5701 +DEFSYM %UCITS=±5747 +DEFSYM %UCTRK=±5790 +DEFSYM $UCVRS=±5830 +DEFSYM %UCVRS=±5881 +DEFSYM %HW=±5897 +DEFSYM $HWOPT=±5947 +DEFSYM $HWSER=±5990 +DEFSYM %CL=±6067 +DEFSYM %CLIN=±6093 +DEFSYM %CLIMM=±6129 +DEFSYM %CLOUT=±6172 +DEFSYM %CLERR=±6212 +DEFSYM %CLBTW=±6263 +DEFSYM %CLBIT=±6307 +DEFSYM %CB=±6412 +DEFSYM %CBWRT=±6463 +DEFSYM %CBRED=±6530 +DEFSYM %CBNDW=±6596 +DEFSYM %CBPUB=±6662 +DEFSYM %CBPRV=±6728 +DEFSYM %CBNDR=±6795 +DEFSYM %CBCPY=±6860 +DEFSYM %CBLOK=±6916 +DEFSYM %CBULK=±6961 +DEFSYM %CBSLO=±7016 +DEFSYM %CBUSL=±7076 +DEFSYM %JS=±7216 +DEFSYM %JSELF=±7238 +DEFSYM %JSTVB=±7285 +DEFSYM %JSNUL=±7330 +DEFSYM %JSALL=±7372 +DEFSYM %JSNEW=±7414 +DEFSYM %JSABS=±7458 +DEFSYM %JSNUM=±7505 +DEFSYM %JSSIX=±7574 +DEFSYM %JSSUP=±7624 +DEFSYM %RL=±7840 +DEFSYM %RLFLS=±7890 +DEFSYM %RLSET=±7932 +DEFSYM %RLUSR=±7977 +DEFSYM %RLPSD=±8040 +DEFSYM %RLNPS=±8093 +DEFSYM %RLBLK=±8150 +DEFSYM %RLGET=±8255 +DEFSYM OPTTRP=±8402 +DEFSYM OPTDEC=±8470 +DEFSYM OPTCMD=±8623 +DEFSYM OPTBRK=±8705 +DEFSYM OPTDDT=±8770 +DEFSYM OPTINT=±8854 +DEFSYM OPTOJB=±8906 +DEFSYM OPTLOK=±9047 +DEFSYM OPTLIV=±9157 +DEFSYM OPTOPC=±9240 +DEFSYM OPTLSP=±9393 +DEFSYM OPTLKF=±9443 +DEFSYM %OP=±9588 +DEFSYM %OPTRP=±9638 +DEFSYM %OPDEC=±9706 +DEFSYM %OPCMD=±9859 +DEFSYM %OPBRK=±9941 +DEFSYM %OPDDT=²0006 +DEFSYM %OPINT=²0090 +DEFSYM %OPOJB=²0142 +DEFSYM %OPLOK=²0283 +DEFSYM %OPLIV=²0393 +DEFSYM %OPOPC=²0476 +DEFSYM %OPLSP=²0629 +DEFSYM %OPLKF=²0679 +DEFSYM %LS=²0809 +DEFSYM %LSINT=²0859 +DEFSYM %LSSYS=²0878 +DEFSYM %LSFIL=²0945 +DEFSYM %WY=²1051 +DEFSYM %WYTYI=²1072 +DEFSYM %WYTYO=²1103 +DEFSYM %WYSTI=²1135 +DEFSYM %WYSTO=²1166 +DEFSYM %WYNET=²1198 +DEFSYM %WYCHA=²1233 +DEFSYM %WYTCP=²1264 +DEFSYM .UAI=²1326 +DEFSYM .UAO=²1363 +DEFSYM .BAI=²1401 +DEFSYM .BAO=²1439 +DEFSYM .UII=²1478 +DEFSYM .UIO=²1515 +DEFSYM .BII=²1553 +DEFSYM .BIO=²1591 +DEFSYM %DO=²1662 +DEFSYM %DOOUT=²1707 +DEFSYM %DOBLK=²1725 +DEFSYM %DOIMG=²1743 +DEFSYM %DONRF=²1761 +DEFSYM %DONLK=²1808 +DEFSYM %DORWT=²1848 +DEFSYM %DOWOV=²1934 +..R=²2183 +DEFSYM ..RSTART=²2218 +DEFSYM ..RLFILE=²2262 +DEFSYM ..RSTP=²2307 +DEFSYM ..RSYM=²2353 +DEFSYM ..RJCL=²2395 +DEFSYM ..RPFILE=²2440 +DEFSYM ..RSTB=²2491 +DEFSYM ..RCONV=²2537 +DEFSYM ..RLJB=²2615 +DEFSYM ..RRND=²2672 +DEFSYM ..RPUR=²2724 +DEFSYM ..RHSNAME=²2762 +DEFSYM ..RMAIL=²2830 +..S=²2890 +DEFSYM ..SSTART=²2925 +DEFSYM ..SLFILE=²2972 +DEFSYM ..SSYM=²3020 +DEFSYM ..SJCL=²3066 +DEFSYM ..SPFILE=²3117 +DEFSYM ..SSTB=²3171 +DEFSYM ..SRND=²3233 +DEFSYM ..SPUR=²3288 +DEFSYM %JG=²3398 +DEFSYM %JGCLS=²3562 +DEFSYM %JGSIO=²3636 +DEFSYM %JGFPD=²3692 +DEFSYM %JO=²3789 +DEFSYM %JOOPN=²3811 +DEFSYM %JOIOT=²3836 +DEFSYM %JOLNK=²3865 +DEFSYM %JORST=²3891 +DEFSYM %JORCH=²3917 +DEFSYM %JOACC=²3943 +DEFSYM %JORNM=²3970 +DEFSYM %JORWO=²4015 +DEFSYM %JOCAL=²4061 +DEFSYM %TI=²5070 +DEFSYM %TJ=²5113 +DEFSYM %TICNS=²5161 +DEFSYM %TJCNS=²5214 +DEFSYM %TJCP1=²5330 +DEFSYM %TJCP2=²5383 +DEFSYM %TJECH=²5460 +DEFSYM %TJCTN=²5575 +DEFSYM %TJSTP=²5634 +DEFSYM %TJDIS=²5699 +DEFSYM %TJSIO=²5748 +DEFSYM %TJMOR=²5823 +DEFSYM %TJPP2=²5883 +DEFSYM %TJINK=²5949 +DEFSYM %TJHDE=²6033 +DEFSYM %TIECH=²6146 +DEFSYM %TIPEK=²6210 +DEFSYM %TIACT=²6265 +DEFSYM %TIINT=²6332 +DEFSYM %TINWT=²6434 +DEFSYM %TIFUL=²6521 +DEFSYM $TIIDX=²6600 +DEFSYM %TIIDX=²6822 +DEFSYM %TJIDX=²6863 +DEFSYM %TINON=²6904 +DEFSYM %TX=²7140 +DEFSYM %TXMPE=²7183 +DEFSYM %TXPIE=²7236 +DEFSYM %TXINT=²7525 +DEFSYM %TXECI=²7592 +DEFSYM %TXTOP=²7709 +DEFSYM %TXSFT=²7753 +DEFSYM %TXSUP=²7819 +DEFSYM %TXMTA=²7886 +DEFSYM %TXCTL=²7920 +DEFSYM %TXASC=²7957 +DEFSYM %TD=²8107 +DEFSYM %TDMOV=²8131 +DEFSYM %TDMV1=²8165 +DEFSYM %TDEOF=²8315 +DEFSYM %TDEOL=²8356 +DEFSYM %TDDLF=²8397 +DEFSYM %TDMTF=²8455 +DEFSYM %TDMTN=²8503 +DEFSYM %TDCRL=²8550 +DEFSYM %TDNOP=²8600 +DEFSYM %TDBS=²8653 +DEFSYM %TDLF=²8713 +DEFSYM %TDRCR=²8749 +DEFSYM %TDORS=²8783 +DEFSYM %TDQOT=²8846 +DEFSYM %TDFS=²8937 +DEFSYM %TDMV0=²8985 +DEFSYM %TDCLR=²9058 +DEFSYM %TDBEL=²9097 +DEFSYM %TDINI=²9133 +DEFSYM %TDILP=²9217 +DEFSYM %TDDLP=²9277 +DEFSYM %TDICP=²9337 +DEFSYM %TDDCP=²9402 +DEFSYM %TDBOW=²9467 +DEFSYM %TDRST=²9515 +DEFSYM %TDGRF=²9590 +DEFSYM %TDRSU=²9632 +DEFSYM %TDRSD=²9671 +DEFSYM %TDSYN=²9956 +DEFSYM %TDECO=³0018 +DEFSYM %TDEDF=³0102 +DEFSYM %TDNLE=³0254 +DEFSYM %TDTSP=³0302 +DEFSYM %TDCTB=³0464 +DEFSYM %TDCTE=³0527 +DEFSYM %TDMLT=³0585 +DEFSYM %TDSVL=³0753 +DEFSYM %TDRSL=³0865 +DEFSYM %TDSSR=³0952 +DEFSYM %TDSLL=³1042 +DEFSYM %TDMAX=³1131 +DEFSYM %TN=³1312 +DEFSYM %TNPRT=³1336 +DEFSYM %TNDP=³1369 +DEFSYM %TNODP=³1426 +DEFSYM %TNIML=³1473 +DEFSYM %TNTEK=³1522 +DEFSYM %TNTV=³1563 +DEFSYM %TNMEM=³1611 +DEFSYM %TNSFW=³1651 +DEFSYM %TNTRM=³1725 +DEFSYM %TNESC=³1765 +DEFSYM %TNDTM=³1841 +DEFSYM %TNRAY=³1872 +DEFSYM %TNHDS=³1906 +DEFSYM %TNH19=³1943 +DEFSYM %TNAAA=³1968 +DEFSYM %TNMAX=³2010 +DEFSYM %TO=³2147 +DEFSYM %TOALT=³2193 +DEFSYM %TOCLC=³2247 +DEFSYM %TOERS=³2308 +DEFSYM %TOHDX=³2371 +DEFSYM $TOHDX=³2427 +DEFSYM %TOMVB=³2451 +DEFSYM %TOSAI=³2506 +DEFSYM %TOSA1=³2574 +DEFSYM %TOOVR=³2626 +DEFSYM %TOMVU=³2693 +DEFSYM %TOMOR=³2779 +DEFSYM %TOROL=³2899 +DEFSYM %TORAW=³2962 +DEFSYM %TOLWR=³3027 +DEFSYM %TOFCI=³3089 +DEFSYM %TOIML=³3165 +DEFSYM %TOLID=³3249 +DEFSYM %TOCID=³3322 +DEFSYM %TP=³3419 +DEFSYM %TPPLF=³3462 +DEFSYM $TPPLF=³3486 +DEFSYM %TPPCR=³3597 +DEFSYM $TPPCR=³3620 +DEFSYM %TPPCW=³4001 +DEFSYM %TPPTB=³4037 +DEFSYM $TPPTB=³4059 +DEFSYM %TPMTA=³4369 +DEFSYM %TPPRN=³4429 +DEFSYM %TPTEL=³4490 +DEFSYM %TPCBS=³4574 +DEFSYM %TP11T=³4708 +DEFSYM %TPORS=³4797 +DEFSYM %TPRSC=³4884 +DEFSYM %TOUSR=³4983 +DEFSYM %TPUSR=³5028 +DEFSYM %TQ=³5102 +DEFSYM %TQIM1=³5161 +DEFSYM %TQIM4=³5199 +DEFSYM %TQP11=³5237 +DEFSYM %TQMCH=³5276 +DEFSYM %TQGRF=³5343 +DEFSYM %TQGPH=³5396 +DEFSYM %TQSET=³5465 +DEFSYM %TQREC=³5513 +DEFSYM %TQXOR=³5559 +DEFSYM %TQBNK=³5596 +DEFSYM %TQVIR=³5633 +DEFSYM %TQHGT=³5677 +DEFSYM %TQWID=³5733 +DEFSYM %TR=³5786 +DEFSYM %TRGIN=³5821 +DEFSYM %TRGHC=³5867 +DEFSYM %TRLED=³5917 +DEFSYM %TRSCN=³5973 +DEFSYM %TRLSV=³6021 +DEFSYM %TRTIM=³6109 +DEFSYM $TRTIM=³6132 +DEFSYM %TG=³6775 +DEFSYM %TGINT=³6818 +DEFSYM %TGACT=³6869 +DEFSYM %TGSPC=³6934 +DEFSYM %TGIMG=³7027 +DEFSYM %TGPIE=³7142 +DEFSYM %TGMPE=³7207 +DEFSYM %TS=³7362 +DEFSYM %TSFRE=³7408 +DEFSYM %TSCLE=³7449 +DEFSYM %TSHDX=³7563 +DEFSYM %TSFCO=³7613 +DEFSYM %TSALT=³7709 +DEFSYM %TSROL=³7768 +DEFSYM %TSSAI=³7813 +DEFSYM %TSACT=³7891 +DEFSYM %TSNEA=³7978 +DEFSYM %TSINT=³8053 +DEFSYM %TSMOR=³8113 +DEFSYM %TSATY=³8163 +DEFSYM %TSNOE=³8263 +DEFSYM %TSLCZ=³8357 +DEFSYM %TSSII=³8445 +DEFSYM %TSCNS=³8523 +DEFSYM $TSCNS=³8597 +DEFSYM %TC=³8715 +DEFSYM %TCLFT=³8761 +DEFSYM %TCRFT=³8854 +DEFSYM %TCICO=³8948 +DEFSYM %TCOCO=³9107 +DEFSYM %TCRFS=³9313 +DEFSYM %TCQRY=³9352 +DEFSYM %TCMTR=³9395 +DEFSYM %TCECH=³9572 +DEFSYM %TCLED=³9768 +DEFSYM %TCDET=³9915 +DEFSYM %TCDNG=´0058 +DEFSYM %TCCBK=´0130 +DEFSYM %TCCBS=´0192 +DEFSYM %TCFPD=´0254 +DEFSYM %TCTPN=´0329 +DEFSYM %TCPAD=´0423 +DEFSYM %TCHNG=´0485 +DEFSYM %TT=´0742 +DEFSYM %TTLCL=´0788 +DEFSYM %TT340=´0838 +DEFSYM %TT3HP=´0913 +DEFSYM %TTPAR=´0967 +DEFSYM %TTDDI=´1000 +DEFSYM $TTISP=´1059 +DEFSYM %TTISP=´1109 +DEFSYM $TTOSP=´1129 +DEFSYM %TTOSP=´1180 +DEFSYM %TY=´1214 +DEFSYM %TYDPK=´1257 +DEFSYM %TYSTY=´1318 +DEFSYM %TYNVA=´1362 +DEFSYM %TYMTY=´1404 +DEFSYM %TYDIL=´1448 +DEFSYM %TY11T=´1489 +DEFSYM %TYDL=´1536 +DEFSYM %TYOTY=´1579 +DEFSYM %TYETY=´1630 +DEFSYM %TYNTY=´1673 +DEFSYM %TYMDM=´1716 +DEFSYM %TYKST=´1782 +DEFSYM %TYDZT=´1833 +DEFSYM %TYRLM=´1885 +DEFSYM %GO=´2038 +DEFSYM %GODLR=´2063 +DEFSYM %GODPR=´2135 +DEFSYM %GODRR=´2192 +DEFSYM %GODCH=´2305 +DEFSYM %GODSC=´2430 +DEFSYM %GODRN=´2679 +DEFSYM %GODLA=´2864 +DEFSYM %GODPA=´2994 +DEFSYM %GODRA=´3050 +DEFSYM %GOELR=´3165 +DEFSYM %GOEPR=´3237 +DEFSYM %GOERR=´3294 +DEFSYM %GOECH=´3408 +DEFSYM %GOESC=´3531 +DEFSYM %GOERN=´3651 +DEFSYM %GOELA=´3775 +DEFSYM %GOEPA=´3847 +DEFSYM %GOERA=´3904 +DEFSYM %GOMVR=´4020 +DEFSYM %GOMVA=´4072 +DEFSYM %GOXOR=´4143 +DEFSYM %GOIOR=´4216 +DEFSYM %GOSET=´4262 +DEFSYM %GOMSR=´4354 +DEFSYM %GOMSA=´4445 +DEFSYM %GOINV=´4514 +DEFSYM %GOVIS=´4569 +DEFSYM %GOBNK=´4622 +DEFSYM %GOCLR=´4714 +DEFSYM %GOCLS=´4761 +DEFSYM %GOPSH=´4849 +DEFSYM %GOVIR=´4973 +DEFSYM %GOPHY=´5033 +DEFSYM %GOHRD=´5105 +DEFSYM %GOGIN=´5222 +DEFSYM %GOLMT=´5352 +DEFSYM %TB=´5698 +DEFSYM %TBNOT=´5744 +DEFSYM %TBNVR=´5809 +DEFSYM %TBINT=´5882 +DEFSYM %TBWAT=´5979 +DEFSYM %TBDTY=´6129 +DEFSYM %TBOUT=´6310 +DEFSYM %TBINF=´6405 +DEFSYM %TBOIG=´6492 +DEFSYM %TBIIN=´6595 +DEFSYM $TBECL=´6710 +DEFSYM %TBECL=´6779 +DEFSYM %SS=´7072 +DEFSYM %SSHNG=´7119 +DEFSYM %SSUSE=´7181 +DEFSYM %SSINT=´7225 +DEFSYM %SSONT=´7311 +DEFSYM %SSOHG=´7381 + +SYSTEM; FSDEFS +01565,XMIDAS +DEFINE DEFSYM±61 +.MLLIT=³65 +$$TEMP=³76 +.ELSE $$TEMP=³96 +DEFSYM MFDBLK=µ99 +DEFSYM MFDCYL=¶38 +DEFSYM MFDSRF=¶68 +DEFSYM MFDSEC=·20 +DEFSYM MDNUM=¸04 +DEFSYM MDNAMP=¸41 +DEFSYM MDYEAR=¸96 +DEFSYM MPDOFF=¹28 +DEFSYM MPDWDK=¹72 +DEFSYM MDCHK=±032 +DEFSYM MDNUDS=±091 +DEFSYM LMIBLK=±154 +DEFSYM LMNBLK=±248 +DEFSYM MNUNAM=±277 +DEFSYM TUTBLK=±485 +DEFSYM TUTCYL=±528 +DEFSYM TUTSRF=±558 +DEFSYM TUTSEC=±610 +DEFSYM TUTBYT=±672 +DEFSYM TUTBP=±720 +DEFSYM TUTEPW=±756 +DEFSYM TUTMAX=±811 +DEFSYM TUTLK=±835 +DEFSYM TUTMNY=±892 +DEFSYM QPKNUM=±978 +DEFSYM QPAKID=²005 +DEFSYM QTUTP=²032 +DEFSYM QSWAPA=²108 +DEFSYM QFRSTB=²230 +DEFSYM QLASTB=²269 +DEFSYM QTRSRV=²307 +DEFSYM LTIBLK=²468 +DEFSYM UFDBYT=²653 +DEFSYM UFDBPW=²704 +DEFSYM UDESCP=²782 +DEFSYM UDNAMP=²822 +DEFSYM UDNAME=²866 +DEFSYM UDBLKS=²911 +DEFSYM UDALLO=³060 +DEFSYM UDDESC=³178 +DEFSYM UDTKMX=³738 +DEFSYM UDWPH=³781 +DEFSYM UDSKMX=³840 +DEFSYM NXLBYT=³901 +DEFSYM LUNBLK=´025 +DEFSYM UNFN1=´056 +DEFSYM UNFN2=´083 +DEFSYM UNRNDM=´112 +DEFSYM UNDSCP=´157 +DEFSYM UNPKN=´195 +DEFSYM UNLINK=´230 +DEFSYM UNLNKB=´260 +DEFSYM UNREAP=´286 +DEFSYM UNWRIT=´328 +DEFSYM UNMARK=´366 +DEFSYM UNCDEL=´400 +DEFSYM DELBTS=´438 +DEFSYM UNIGFL=´478 +DEFSYM UNWRDC=´520 +DEFSYM UNDUMP=´581 +DEFSYM UNDATE=´622 +DEFSYM UNTIM=´651 +DEFSYM UNYMD=´703 +DEFSYM UNMON=´748 +DEFSYM UNDAY=´781 +DEFSYM UNYRB=´812 +DEFSYM UNREF=´843 +DEFSYM UNREFD=´906 +DEFSYM UNAUTH=´961 +DEFSYM UNBYTE=µ030 + +SYSTEM; DC10 +03396,XMIDAS +DEFINE DEFSYM±61 +.MLLIT=³65 +$$TEMP=³76 +.ELSE $$TEMP=³96 +DEFSYM NCYLS=´69 +DEFSYM XCYLS=µ16 +DEFSYM NHEDS=µ76 +DEFSYM NSECS=¶14 +DEFSYM SECBLK=¶44 +DEFSYM NBLKSC=¶79 +DEFSYM NBLKS=·18 +DEFSYM XBLKS=·64 +DEFSYM TBLKS=¸05 +DEFSYM NTUTBL=¸49 +DEFSYM DECADE=¹20 +DEFSYM XWBWC=±055 +DEFSYM XWBLK=±073 +DEFSYM XWAWC=±127 +DEFSYM XWSYSN=±173 +DEFSYM XWFN1=±190 +DEFSYM XWFN2=±207 +DEFSYM NXWDS=±224 +DEFSYM DC0=±265 +DEFSYM DC1=±301 +DEFSYM DPKID=±402 +DEFSYM DCYL=±441 +DEFSYM DSURF=±488 +DEFSYM DSECT=±533 +DEFSYM DHIND=±589 +DEFSYM DHSPRT=±665 +DEFSYM DHHPRT=±715 +DEFSYM DHNXAD=±760 +DEFSYM DHEPB=±961 +DEFSYM DHOPB=²025 +DEFSYM DHSLNG=²088 +DEFSYM DRC=²178 +DEFSYM DWRITE=²218 +DEFSYM DREAD=²249 +DEFSYM DSEEK=²280 +DEFSYM DRCC=²310 +DEFSYM DWRITC=²361 +DEFSYM DREADC=²404 +DEFSYM DUNENB=²448 +DEFSYM DUNFLD=²497 +DEFSYM DCOPY=²613 +DEFSYM DCCOMP=²644 +DEFSYM DCSKIP=²678 +DEFSYM DCWC=²709 +DEFSYM DCCA=²744 +DEFSYM DCBN=²779 +DEFSYM DHLT=²836 +DEFSYM DXCT=²896 +DEFSYM DJMP=²920 +DEFSYM DJSR=²945 +DEFSYM DAOJNC=³012 +DEFSYM DDOK=³056 +DEFSYM DSRQF=³094 +DEFSYM DSREG=³161 +DEFSYM DSREGS=³219 +DEFSYM DSRDB=³273 +DEFSYM DSRDL=³309 +DEFSYM DSRCC=³349 +DEFSYM DSRPC=³390 +DEFSYM DSRWC=³443 +DEFSYM DSRCA=³481 +DEFSYM DALU=³562 +DEFSYM DALUX=³605 +DEFSYM DALUD=³655 +DEFSYM DASL=³714 +DEFSYM DASE=³747 +DEFSYM DASLE=³783 +DEFSYM DASA=³823 +DEFSYM DASGE=³859 +DEFSYM DASN=³899 +DEFSYM DASG=³938 +DEFSYM DLDB=´022 +DEFSYM DLDL=´066 +DEFSYM DLCC=´109 +DEFSYM DLCA=´153 +DEFSYM DLTDB=´195 +DEFSYM DLDBPC=´250 +DEFSYM DLDBWC=´298 +DEFSYM DLDBM=´345 +DEFSYM DLADD=´456 +DEFSYM DLSOS=´482 +DEFSYM DLLB=´507 +DEFSYM DLSUB=´531 +DEFSYM DLAND=´559 +DEFSYM DLIOR=´586 +DEFSYM DLLA=´616 +DEFSYM DLSETO=´647 +DEFSYM DLSETZ=´674 +DEFSYM DOPR=´714 +DEFSYM DOHXFR=´750 +DEFSYM DOCSRQ=´811 +DEFSYM DOSSRQ=´848 +DEFSYM DOSCFL=´883 +DEFSYM DSDRST=´940 +DEFSYM DSDCNT=µ016 +DEFSYM DDSWC=µ089 +DEFSYM DDSUNS=µ133 +DEFSYM DDSRDO=µ169 +DEFSYM DDSSIC=µ202 +DEFSYM DDSRDY=µ240 +DEFSYM DDSONL=µ274 +DEFSYM DDSSEL=µ310 +DEFSYM DDSCYL=µ350 +DEFSYM DDSLAT=µ393 +DEFSYM DSPC=µ463 +DEFSYM DSWIDX=µ565 +DEFSYM DSWSEC=µ610 +DEFSYM DSWINF=µ656 +DEFSYM DSWHDM=µ734 +DEFSYM DSWAGH=µ778 +DEFSYM DSWAH=µ814 +DEFSYM DSWNUL=µ847 +DEFSYM DSCRDC=µ893 +DEFSYM DSCRIM=µ936 +DEFSYM DSCRHD=µ975 +DEFSYM DSRCAL=¶016 +DEFSYM DSCWDC=¶053 +DEFSYM DSCWIM=¶096 +DEFSYM DSMAIT=¶131 +DEFSYM DASSGN=¶236 +DEFSYM DPIRQC=¶293 +DEFSYM DSSRQ=¶339 +DEFSYM DSDEEB=¶376 +DEFSYM DSSERR=¶450 +DEFSYM DSSAEB=¶483 +DEFSYM DSSATT=¶527 +DEFSYM DSIENB=¶564 +DEFSYM DSSRUN=¶602 +DEFSYM DSSACT=¶627 +DEFSYM DSSCEB=¶655 +DEFSYM DSSCHF=¶690 +DEFSYM DSSCFL=¶723 +DEFSYM DCSET=¶865 +DEFSYM DCCLR=¶901 +DEFSYM DCCSET=¶940 +DEFSYM DCDENB=¶999 +DEFSYM DCERR=·039 +DEFSYM DCATEB=·096 +DEFSYM DCCATT=·135 +DEFSYM DCSSRQ=·173 +DEFSYM DCIENB=·212 +DEFSYM DCSTAR=·245 +DEFSYM DCSSTP=·278 +DEFSYM DCSGL=·311 +DEFSYM DCCENB=·350 +DEFSYM DCCFLG=·385 +DEFSYM DCCPUF=·418 +DEFSYM DSATDN=·529 +DEFSYM DSTMDN=·573 +DEFSYM DSLAT=·612 +DEFSYM DIPE=·688 +DEFSYM DRLNER=·732 +DEFSYM DRCER=·767 +DEFSYM DOVRRN=·808 +DEFSYM DCKSER=·837 +DEFSYM DWTHER=·879 +DEFSYM DFUNSF=·915 +DEFSYM DOFFL=·977 +DEFSYM DPROT=¸017 +DEFSYM DDOBSY=¸067 +DEFSYM DNXM=¸099 +DEFSYM DCPERR=¸130 +DEFSYM LRIBLK=¸167 + +SYSTEM; RP10 +01143,XMIDAS +DEFINE DEFSYM±61 +.MLLIT=³65 +$$TEMP=³76 +.ELSE $$TEMP=³96 +DEFSYM NCYLS=´47 +DEFSYM MCYLS=µ01 +DEFSYM XCYLS=µ55 +DEFSYM NHEDS=¶15 +DEFSYM NSECS=¶53 +DEFSYM SECBLK=¶88 +DEFSYM NBLKSC=·23 +DEFSYM NBLKS=·69 +DEFSYM MBLKS=¸22 +DEFSYM XBLKS=¸75 +DEFSYM TBLKS=¹16 +DEFSYM NTUTBL=¹58 +DEFSYM DECADE=¹94 +DEFSYM DPC=±102 +DEFSYM DREADC=±162 +DEFSYM DWRITC=±198 +DEFSYM DWRITH=±258 +DEFSYM DSEEKC=±320 +DEFSYM DEASEC=±361 +DEFSYM DNOOPC=±404 +DEFSYM DRCALC=±443 +DEFSYM DUNFLD=±526 +DEFSYM DCYL=±576 +DEFSYM DCYLXB=±641 +DEFSYM DSURF=±703 +DEFSYM DSECT=±761 +DEFSYM DUNFLI=±841 +DEFSYM DCYLI=±877 +DEFSYM DCYLXI=±919 +DEFSYM SKINC=±974 +DEFSYM ONCYL=²013 +DEFSYM ONLINE=²048 +DEFSYM FUNSAF=²079 +DEFSYM NSCHDR=²114 +DEFSYM RDONLY=²150 +DEFSYM NOWRIH=²182 +DEFSYM RP03BT=²226 +DEFSYM SECTI=²274 +DEFSYM ALLATT=²301 +DEFSYM DCLEAR=²344 +DEFSYM PARER=²420 +DEFSYM SRCER=²442 +DEFSYM HRDER=²464 +DEFSYM PROER=²486 +DEFSYM WRTER=²508 +DEFSYM ALLER=²530 +DEFSYM DONE=²551 +DEFSYM BUSY=²568 +DEFSYM $DFCAD=²618 +DEFSYM $DFWC=²739 +DEFSYM $DFLAD=²797 +DEFSYM $DFCWA=²864 + +SYSTEM; RH10 +02341,XMIDAS +DEFINE DEFSYM±62 +.MLLIT=³66 +$$TEMP=³77 +.ELSE $$TEMP=´19 +DEFSYM NCYLS=´88 +DEFSYM XCYLS=µ36 +DEFSYM NHEDS=µ99 +DEFSYM NSECS=¶38 +DEFSYM SECBLK=¶76 +DEFSYM NBLKSC=·12 +DEFSYM NBLKS=·65 +DEFSYM XBLKS=¸17 +DEFSYM TBLKS=¸65 +DEFSYM NTUTBL=¹09 +DEFSYM DECADE=¹46 +DEFSYM DSK=±110 +DEFSYM %HID22=±199 +DEFSYM %HIILF=±261 +DEFSYM %HISDE=±330 +DEFSYM %HIDPE=±397 +DEFSYM %HICPE=±448 +DEFSYM %HINXM=±507 +DEFSYM %HIBPE=±574 +DEFSYM %HIEXC=±625 +DEFSYM %HICER=±695 +DEFSYM %HICWW=±758 +DEFSYM %HIOVR=±816 +DEFSYM %HIDRE=±872 +DEFSYM %HIILC=±946 +DEFSYM %HIPWR=²015 +DEFSYM %HICOV=²054 +DEFSYM %HIRAE=²103 +DEFSYM %HIATN=²172 +DEFSYM %HIBSY=²223 +DEFSYM %HIDON=²283 +DEFSYM %HIERR=²373 +DEFSYM %HOWCW=²468 +DEFSYM %HORST=²559 +DEFSYM %HORAE=²648 +DEFSYM %HOATN=²700 +DEFSYM %HOSTP=²758 +DEFSYM %HOCLR=²880 +DEFSYM %HRLOD=²982 +DEFSYM %HRCTL=³045 +DEFSYM $HCDRV=³087 +DEFSYM $HCICWA=³143 +DEFSYM %HRBUF=³309 +DEFSYM %HRIAD=³368 +DEFSYM %HRRAE=³498 +DEFSYM %HRCBF=³622 +DEFSYM %HMNOP=³820 +DEFSYM %HMUNL=³852 +DEFSYM %HMREC=³899 +DEFSYM %HMCLR=³930 +DEFSYM %HMRLS=³982 +DEFSYM %HMSRC=´028 +DEFSYM %HMWCH=´068 +DEFSYM %HMWCF=´135 +DEFSYM %HMWRT=´208 +DEFSYM %HMWHD=´239 +DEFSYM %HMRED=´299 +DEFSYM %HMRHD=´329 +DEFSYM %HMSEK=´370 +DEFSYM %HMOFS=´406 +DEFSYM %HMCEN=´448 +DEFSYM %HMACK=´495 +DEFSYM %HMRDP=´566 +DEFSYM %HDCBT=´680 +DEFSYM %HDPAR=´729 +DEFSYM %HDDLT=´788 +DEFSYM %HDILC=´863 +DEFSYM %HDERR=´908 +DEFSYM %HRDCL=µ072 +DEFSYM %HCDVA=µ159 +DEFSYM %HRSTS=µ204 +DEFSYM %HSVV=µ289 +DEFSYM %HSRDY=µ413 +DEFSYM %HSDPR=µ451 +DEFSYM %HSPGM=µ523 +DEFSYM %HSLST=µ592 +DEFSYM %HSWRL=µ643 +DEFSYM %HSMOL=µ681 +DEFSYM %HSPIP=µ724 +DEFSYM %HSERR=µ776 +DEFSYM %HSATN=µ837 +DEFSYM %HRER1=µ955 +DEFSYM %H1ECH=¶319 +DEFSYM %H1WLK=¶486 +DEFSYM %H1ECC=¶707 +DEFSYM %H1SOF=¶774 +DEFSYM %HRMNT=¶812 +DEFSYM %HRATN=¶881 +DEFSYM %HRADR=·033 +DEFSYM $HATRK=·086 +DEFSYM $HASEC=·132 +DEFSYM %HRLAH=·235 +DEFSYM %HRTYP=·317 +DEFSYM %HRSER=·493 +DEFSYM %HROFS=·543 +DEFSYM %HRCYL=·632 +DEFSYM %HRCCY=·705 +DEFSYM %HRER2=·755 +DEFSYM %HRER3=·834 +DEFSYM %H3SKI=·915 +DEFSYM %H3OFC=·959 +DEFSYM %HRPOS=¸002 +DEFSYM %HRPAT=¸083 +DEFSYM $DFCAD=¸196 +DEFSYM $DFWC=¸259 +DEFSYM $DFLAD=¸317 +DEFSYM $DFCWA=¸384 + +SYSTEM; RH11 +00993,XMIDAS +DEFINE DEFSYM±23 +.ELSE [ $$TEM1=±68 +$$TEMP=²70 +.ELSE, $$TEMP=³06 +IFNDEF RP06P,RP06P=´20 +IFNDEF RM03P,RM03P=´43 +IFNDEF RM80P,RM80P=´66 +DEFSYM PHVEC=¶60 +DEFSYM %HRCS1=·91 +DEFSYM %HMNOP=±369 +DEFSYM %HMUNL=±402 +DEFSYM %HMREC=±471 +DEFSYM %HMCLR=±503 +DEFSYM %HMRLS=±556 +DEFSYM %HMSRC=±603 +DEFSYM %HMWCH=±644 +DEFSYM %HMWCF=±693 +DEFSYM %HMWRT=±766 +DEFSYM %HMWHD=±798 +DEFSYM %HMRED=±859 +DEFSYM %HMRHD=±890 +DEFSYM %HMSEK=±932 +DEFSYM %HMOFS=±969 +DEFSYM %HMCEN=²012 +DEFSYM %HMACK=²060 +DEFSYM %HMRDP=²132 +DEFSYM %HRWC=²169 +DEFSYM %HRBA=²207 +DEFSYM %HRADR=²250 +DEFSYM %HRCS2=²496 +DEFSYM %HRSTS=³206 +DEFSYM %HRER1=³974 +DEFSYM %HRATN=´695 +DEFSYM %HRLAH=´797 +DEFSYM %HRBUF=´911 +DEFSYM %HRMNT=´951 +DEFSYM %HRTYP=´991 +DEFSYM %HRSER=µ271 +DEFSYM %HROFS=µ313 +DEFSYM %HRCYL=µ963 +DEFSYM %HRCCY=¶023 +DEFSYM %HRER2=¶068 +DEFSYM %HRER3=¶192 +DEFSYM %HRER2=¶685 +DEFSYM %HRPOS=·267 +DEFSYM %HRPAT=·308 + +SYSTEM; RP06 +00319,XMIDAS +DEFINE DEFSYM±23 +.ELSE [ $$TEM1=±68 +$$TEMP=²70 +.ELSE, $$TEMP=³06 +DEFSYM NCYLS=³64 +DEFSYM XCYLS=´13 +DEFSYM NHEDS=´83 +DEFSYM NSECS=µ23 +DEFSYM SECBLK=µ60 +DEFSYM NBLKSC=µ97 +DEFSYM NBLKS=¶44 +DEFSYM XBLKS=¶91 +DEFSYM TBLKS=·33 +DEFSYM NTUTBL=±027 +DEFSYM DECADE=±106 + +SYSTEM; RM03 +00319,XMIDAS +DEFINE DEFSYM±23 +.ELSE [ $$TEM1=±68 +$$TEMP=²70 +.ELSE, $$TEMP=³06 +DEFSYM NCYLS=³64 +DEFSYM XCYLS=´13 +DEFSYM NHEDS=´83 +DEFSYM NSECS=µ21 +DEFSYM SECBLK=µ58 +DEFSYM NBLKSC=µ95 +DEFSYM NBLKS=¶42 +DEFSYM XBLKS=¶89 +DEFSYM TBLKS=·31 +DEFSYM NTUTBL=±006 +DEFSYM DECADE=±085 + +SYSTEM; T300 +01073,XMIDAS +DEFINE DEFSYM±62 +.MLLIT=³66 +$$TEMP=³77 +.ELSE $$TEMP=´19 +DEFSYM NCYLS1=µ79 +DEFSYM XCYLS1=¶28 +DEFSYM NHEDS1=¶93 +DEFSYM NSECS1=·33 +DEFSYM SECBL1=·91 +DEFSYM NBLKC1=¸29 +DEFSYM NBLKS1=¸85 +DEFSYM XBLKS1=¹39 +DEFSYM TBLKS1=¹89 +DEFSYM NTUTB1=±035 +DEFSYM TUTBL1=±077 +DEFSYM DSCCHK=±437 +DEFSYM DSCREQ=±482 +DEFSYM DSCDON=±551 +DEFSYM DSCFLT=±617 +DEFSYM %DFRST=±654 +DEFSYM %DFCQE=±727 +DEFSYM %DFNXM=±786 +DEFSYM %DFPAR=±836 +DEFSYM DSCSTS=²086 +DEFSYM %DSRTR=²135 +DEFSYM %DSECH=²180 +DEFSYM %DSECC=²240 +DEFSYM %DSIDE=²285 +DEFSYM %DSHCE=²318 +DEFSYM %DSPRT=²378 +DEFSYM %DSALT=²455 +DEFSYM %DSOVR=²534 +DEFSYM %DSSKE=²596 +DEFSYM %DSOFL=²640 +DEFSYM %DSFLT=²686 +DEFSYM %DSNXM=²719 +DEFSYM %DSPAR=²760 +DEFSYM %DSSFL=²809 +DEFSYM %DSWLK=²866 +DEFSYM DSCCMD=²922 +DEFSYM %DMSNS=²972 +DEFSYM %DMTST=³115 +DEFSYM %DMREC=³175 +DEFSYM %DMSEK=³207 +DEFSYM %DMWRT=³232 +DEFSYM %DMRED=³263 +DEFSYM DSCDRV=³382 +DEFSYM DSCCYL=³446 +DEFSYM DSCHED=³488 +DEFSYM DSCSEC=³526 +DEFSYM DSCPNT=³566 + +SYSTEM; DZ11 +00517,XMIDAS +DZLNLN=´3 +DZNLN=µ3 +DZLNM=±11 +%DZLM=±72 +%DZLS=²05 +%DZRCS=²40 +%DZCMN=³03 +%DZCCL=³30 +%DZCMS=³51 +%DZCRE=³85 +%DZCRD=´27 +%DZCSE=´57 +%DZCSA=´93 +%DZCTE=µ22 +%DZCTR=µ69 +%DZRLP=¶08 +%DZLLM=¶69 +%DZLCL=·00 +%DZLSC=·41 +%DZLPY=·70 +%DZLOP=·97 +%DZLSP=¸24 +%DZLSS=¸60 +%DZLRO=¸92 +%DZRDR=¹24 +%DZDCM=¹80 +%DZDPE=±011 +%DZDFE=±042 +%DZDOR=±084 +%DZDDV=±110 +%DZRTC=±142 +%DZRTD=±204 +%DZTCM=±276 +%DZTBM=±307 +%DZRMS=±339 +%DZMRI=±380 +%DZMCD=±408 + +SYSTEM; EPT +01279,XMIDAS +DEFINE DEFSYM²66 +.MLLIT=´70 +$$TEMP=´81 +.ELSE $$TEMP=µ01 +IFNDEF EPT, EPT=µ28 +DEFSYM PI0LOC=¶56 +DEFSYM DTEBPO=·31 +DEFSYM DTEBPI=·98 +DEFSYM DTELOC=¸64 +DEFSYM DTEPRO=¹17 +DEFSYM DTERLO=¹81 +DEFSYM DTEPRI=±045 +DEFSYM DTERLI=±108 +DEFSYM EPTCLK=±173 +DEFSYM EPTPRF=±241 +DEFSYM EPTEBC=±302 +DEFSYM EPTMBC=±364 +DEFSYM TIMLOC=±426 +DEFSYM EPTTR1=±494 +DEFSYM EPTTR2=±545 +DEFSYM EPTTR3=±592 +DEFSYM EPTPFW=²129 +DEFSYM PFOPC=²198 +DEFSYM PFNPC=²269 +DEFSYM QICWA=²577 +DEFSYM QIOWD=²610 +DEFSYM RCIOWD=²650 +DEFSYM MICWA=²692 +DEFSYM MIOWD=²725 +DEFSYM SLVICW=²805 +DEFSYM SLVIOW=²839 +DEFSYM IMPILC=²965 +DEFSYM IMPOLC=³029 +DEFSYM EPTDIA=³243 +DEFSYM EPTDDT=³296 +DEFSYM EPTSTL=³335 +DEFSYM EPTITS=³386 +DEFSYM DTEFLG=³437 +DEFSYM DTECLK=³515 +DEFSYM DTET11=³667 +DEFSYM DTEF11=³734 +DEFSYM DTECMD=³789 +DEFSYM DTESEQ=³848 +DEFSYM DTEOPR=³913 +DEFSYM DTECHR=³987 +DEFSYM DTEMTO=´062 +DEFSYM DTEMTI=´147 +DEFSYM DTESWR=´231 +DEFSYM DTE=´304 +DEFSYM %DBL11=´348 +DEFSYM %DBL10=´399 +DEFSYM %DTTTI=´521 +DEFSYM %DTTTO=´693 +DEFSYM %DTTYI=´746 +DEFSYM %DTTYO=´829 +DEFSYM %DTMMN=µ007 +DEFSYM %DTMMF=µ067 +DEFSYM %DTMMS=µ139 +DEFSYM %DTCLN=µ282 +DEFSYM %DTCLF=µ341 +DEFSYM %DTHLT=µ537 + +SYSTEM; KSDEFS +02567,XMIDAS +PI=·8 +PAG=±01 +.RD.=±46 +.WR.=±94 +UMOVE=²82 +UMOVEM=³44 +XCTR=´05 +XCTRI=´39 +RDAPR=±692 +WRAPR=±906 +80INT=²652 +RDPI=²694 +WRPI=²927 +APRID=³337 +RDEBR=³888 +WREBR=³930 +RDUBR=´253 +WRUBR=´296 +CLRPT=´576 +CLRCSH=´839 +LDBR1=µ002 +SDBR1=µ043 +LDBR2=µ087 +SDBR2=µ129 +LDBR3=µ174 +SDBR3=µ215 +LDBR4=µ259 +SDBR4=µ301 +LPMR=µ564 +SPM=µ626 +RDTIM=µ947 +WRTIM=µ996 +RDINT=¶608 +WRINT=¶656 +RDHSB=·411 +WRHSB=·468 +IFNDEF HSB, HSB=¸659 +HSBMAG=¸673 +HSBPC=¸687 +HSBHR=¸701 +HSBAR=¸715 +HSBARX=¸730 +HSBBR=¸744 +HSBBRX=¸759 +HSBONE=¸774 +HSBEBR=¸789 +HSBUBR=¸805 +HSBMASK=¸822 +HSBFLG=¸838 +HSBPI=¸853 +HSBXWD1=¸870 +HSBT0=¸885 +HSBT1=¸900 +HSBVMA=¸916 +UBAQ=¸962 +UBAI=¸996 +IORDI=¹045 +IORDQ=¹084 +IORD=¹122 +IOWR=¹157 +IOWRI=¹193 +IOWRQ=¹232 +IORDBI=¹274 +IORDBQ=¹289 +IORDB=¹303 +IOWRB=¹317 +IOWRBI=¹332 +IOWRBQ=¹347 +BLTBU=¹613 +BLTUB=¹676 +%PF=¹937 +%PFUSR=¹977 +%PFNXI=±0030 +%PFNXM=±0078 +%PFPAR=±0121 +%PFWRT=±0248 +%PF2.9=±0312 +%PF2.8=±0381 +%PFPHY=±0411 +%PFIO=±0470 +%PFBYT=±0538 +$PFPNO=±0657 +PMAGEM=±0865 +PMCSHM=±0896 +PMRCM=±0935 +PMUNSD=±1052 +UPTTR1=±1165 +UPTTR2=±1208 +UPTTR3=±1247 +UPTUUO=±1312 +UPTUPC=±1346 +UPTUCX=±1387 +UPTUEN=±1481 +UPTUET=±1622 +UPT1PO=±1713 +UPT1PN=±1791 +UPTUUN=±1878 +UPTUUT=±1971 +IFNDEF EPT, EPT=±2135 +PI0LOC=±2176 +PI!I!LOC=±2270 +EPTUIT=±2302 +EPTTR1=±2441 +EPTTR2=±2487 +EPTTR3=±2529 +EPTUUO=±2645 +EPTUPC=±2665 +EPTUCX=±2685 +EPTUEN=±2705 +EPTUET=±2725 +EPT1PO=±2745 +EPT1PN=±2765 +EPTUUN=±2785 +EPTUUT=±2805 +EPTPFW=±3184 +EPTPFO=±3231 +EPTPFN=±3280 +EPTP!I!W=±3364 +EPTP!I!O=±3388 +EPTP!I!N=±3412 +8SWIT0=±3476 +8KALIV=±3535 +8CTYIN=±3570 +8CTYOT=±3595 +8KLKIN=±3621 +8KLKOT=±3671 +8RHBAS=±3721 +8QNUM=±3758 +8BOOTP=±3790 +%88=±4176 +%88CYL=±4201 +$88CYL=±4217 +%88TRK=±4257 +$88TRK=±4271 +%88SEC=±4308 +$88SEC=±4320 +88RAM=±4978 +88BT=±5081 +88BT1=±5138 +88B2=±5182 +88FI0=±5227 +KSECCS=±6096 +%KE=±6150 +%KEHLD=±6260 +%KEUNC=±6317 +%KEREF=±6365 +%KEPAR=±6409 +%KEENA=±6452 +%KEECC=±6492 +%KEPWR=±6535 +UBAPAG=±7118 +UBALEN=±7181 +%UP=±7235 +%UPPAR=±7274 +%UPRPW=±7313 +%UP16B=±7360 +%UPFST=±7427 +%UPVAL=±7468 +%UPPVL=±7507 +$UPPAG=±7547 +%UQ=±7666 +%UQRPW=±7705 +%UQ16B=±7752 +%UQFST=±7819 +%UQVAL=±7860 +UBASTA=±7989 +%UB=±8123 +%UBTIM=±8163 +%UBBAD=±8208 +%UBPAR=±8321 +%UBNXD=±8373 +%UBHIG=±8431 +%UBLOW=±8498 +%UBPWR=±8564 +%UBDXF=±8604 +%UBINI=±8672 +%UBPIH=±8718 +%UBPIL=±8785 +UBAMNT=±8853 + +SYSTEM; ITS +59354,XMIDAS +DEFINE MCOND¶34 +DEFINE MNAME·00 +FOO=·67 +.TTYFLG=¸11 +.TTYFLG=¸36 +IFNDEF PCLSW,PCLSW=¸78 +IFNDEF TT11BY,TT11BY=¹38 +.MLLIT=¹85 +ASTIME=±023 +ASDATE=±092 +A=±190 +B=±195 +C=±200 +D=±205 +E=±210 +TT=±216 +I=±221 +Q=±226 +J=±232 +R=±238 +W=±244 +H=±250 +P=±256 +T=±291 +U=±300 +NULBLK=±420 +NPVSEC=±511 +IF2 LIOBLK=±605 +IF2 MAXJ=±725 +DIRMAP=±792 +NIOCHN=±884 +DEFINE $INSRT±938 +DEFINE CONC²141 +VBDBTS=²351 +BADBTS=²409 +UUOMIN=²518 +UUOMAX=²577 +UIOT=²624 +MXIOB=²702 +SIOMT=²730 +LUPDL=²771 +LUIOP=²825 +CPDLL=²859 +LUTCP=²896 +LSYSP=²944 +LTTYP=²972 +DMNSZ=³022 +MXCZS=³070 +SCLKI=³115 +VSCLKI=³151 +MXOPT=³202 +NINFP=³245 +SSCHDB=³317 +SPD=³365 +OPNCOM=³463 +IFN 340P,N340PB=³530 +NUVPG=³798 +IFNDEF UNSPLP,UNSPLP=´245 +DEFINE CNTRLR´546 +DEFINE SPEEDC´925 +DEFINE SPEED1µ045 +DEFINE TTDPRTµ832 +N,+SPEED=µ842 +300,ISPEED=µ853 +,TT=µ857 +0,TY=µ862 +0,TO=µ867 +0,TP=µ872 +%TPORS,TCT=µ883 +%TNPRT,SMARTS=µ897 +T!N!$SMT=µ909 +T!N!$HOR=µ929 +T!N!$VER=µ960 +T!N!$OPT=µ976 +T!N!$TYP=¶099 +T!N!$TCT=¶225 +T!N!$ROL=¶240 +DEFINE TTDMRX¶291 +N,+SPEED=¶301 +600,ISPEED=¶312 +,TT=¶316 +0,TY=¶321 +0,TO=¶326 +0,TP=¶331 +%TPORS,HOR=¶342 +120.,SMARTS=¶354 +T!N!$SMT=¶366 +T!N!$HOR=¶386 +T!N!$VER=¶401 +T!N!$OPT=¶417 +T!N!$TYP=¶474 +T!N!$TCT=¶525 +T!N!$ROL=¶543 +DEFINE TTDTRM¶596 +N,+SPEED=¶606 +1200,ISPEED=¶618 +,TT=¶622 +0,TY=¶627 +0,TO=¶632 +0,TP=¶637 +%TPORS,HOR=¶648 +120.,SMARTS=¶660 +T!N!$SMT=¶672 +T!N!$HOR=¶692 +T!N!$VER=¶707 +T!N!$OPT=¶723 +T!N!$TYP=¶771 +T!N!$TCT=¶822 +T!N!$ROL=¶840 +DEFINE TTDLPT¶890 +N,+SPEED=¶900 +9600,ISPEED=¶912 +,TT=¶916 +0,TY=¶921 +0,TO=¶926 +0,TP=¶931 +0,HOR=¶937 +200.,TCT=¶946 +%TNPRT,SMARTS=¶960 +T!N!$SMT=¶972 +T!N!$HOR=¶992 +T!N!$VER=·007 +T!N!$OPT=·023 +T!N!$TYP=·055 +T!N!$TCT=·113 +T!N!$ROL=·128 +DEFINE TTDLA36·191 +N,+SPEED=·201 +300,ISPEED=·212 +,TT=·216 +0,TY=·221 +0,TO=·226 +0,TP=·231 +%TPORS,HOR=·242 +132.,TCT=·251 +%TNPRT,SMARTS=·265 +T!N!$SMT=·277 +T!N!$HOR=·297 +T!N!$VER=·312 +T!N!$OPT=·328 +T!N!$TYP=·367 +T!N!$TCT=·418 +T!N!$ROL=·433 +DEFINE TTDIML·514 +N,+SPEED=·524 +50K,ISPEED=·535 +25K,TT=·542 +0,TY=·547 +0,TO=·552 +0,TP=·557 +0,HOR=·563 +90.,VER=·571 +44.,TCT=·579 +%TNSFW,ROL=·590 +10.,SMARTS=·601 +T!N!$SMT=·618 +T!N!$HOR=·638 +T!N!$VER=·653 +T!N!$OPT=·668 +T!N!$TYP=·735 +T!N!$TCT=·793 +T!N!$ROL=·808 +DEFINE TTDVT·857 +N,+SPEED=·867 +9600,ISPEED=·879 +,TT=·883 +0,TY=·888 +0,TO=·893 +0,TP=·898 +%TPORS,HOR=·909 +80.,VER=·917 +24.,TCT=·925 +%TNESC,ROL=·936 +1,SMARTS=·945 +T!N!$SMT=·957 +T!N!$HOR=·977 +T!N!$VER=·992 +T!N!$OPT=¸007 +T!N!$TYP=¸132 +T!N!$TCT=¸183 +T!N!$ROL=¸198 +DEFINE TTDH19¸247 +N,+SPEED=¸257 +9600,ISPEED=¸269 +,TT=¸273 +0,TY=¸278 +0,TO=¸283 +0,TP=¸288 +%TPORS,HOR=¸299 +80.,VER=¸307 +24.,TCT=¸315 +%TNH19,ROL=¸326 +1,SMARTS=¸335 +T!N!$SMT=¸347 +T!N!$HOR=¸367 +T!N!$VER=¸382 +T!N!$OPT=¸397 +T!N!$TYP=¸466 +T!N!$TCT=¸517 +T!N!$ROL=¸532 +DEFINE TTDAAA¸581 +N,+SPEED=¸591 +9600,ISPEED=¸603 +,TT=¸607 +0,TY=¸612 +0,TO=¸617 +0,TP=¸622 +%TPORS+%TPMTA,HOR=¸640 +80.,VER=¸648 +48.,TCT=¸656 +%TNAAA,ROL=¸667 +1,SMARTS=¸676 +T!N!$SMT=¸688 +T!N!$HOR=¸708 +T!N!$VER=¸723 +T!N!$OPT=¸738 +T!N!$TYP=¸807 +T!N!$TCT=¸858 +T!N!$ROL=¸873 +DEFINE TTDC100¸924 +N,+SPEED=¸934 +9600,ISPEED=¸946 +,TT=¸950 +0,TY=¸955 +0,TO=¸960 +0,TP=¸965 +%TPORS,HOR=¸976 +79.,VER=¸984 +24.,TCT=¸992 +%TNHDS,ROL=¹003 +1,SMARTS=¹012 +T!N!$SMT=¹024 +T!N!$HOR=¹044 +T!N!$VER=¹059 +T!N!$OPT=¹074 +T!N!$TYP=¹167 +T!N!$TCT=¹218 +T!N!$ROL=¹233 +DEFINE TTDTEK¹289 +N,+SPEED=¹299 +1200,ISPEED=¹311 +,TT=¹315 +0,TY=¹320 +0,TO=¹325 +0,TP=¹330 +%TPORS,TCT=¹341 +%TNTEK,HOR=¹352 +73.,VER=¹360 +35.,SMARTS=¹371 +T!N!$SMT=¹383 +T!N!$HOR=¹403 +T!N!$VER=¹418 +T!N!$OPT=¹433 +T!N!$TYP=¹486 +T!N!$TCT=¹537 +T!N!$ROL=¹552 +DEFINE TTDLSR¹614 +N,+SPEED=¹624 +2400,ISPEED=¹636 +,TT=¹640 +0,TY=¹645 +0,TO=¹650 +0,TP=¹655 +%TPORS,SMARTS=¹669 +T!N!$SMT=¹681 +T!N!$TCT=¹701 +T!N!$HOR=¹719 +T!N!$VER=¹791 +T!N!$OPT=¹806 +T!N!$TYP=¹854 +T!N!$ROL=¹905 +DEFINE TTDDPT¹959 +N,+SPEED=¹969 +2400,ISPEED=¹981 +,TT=¹985 +0,TY=¹990 +0,TO=¹995 +0,TP=±0000 +%TPORS,HOR=±0011 +[72.-IFN MCOND AIKA,[1]],SMARTS=±0043 +T!N!$SMT=±0055 +T!N!$TCT=±0075 +T!N!$HOR=±0092 +T!N!$VER=±0148 +T!N!$OPT=±0163 +T!N!$TYP=±0211 +T!N!$ROL=±0262 +DEFINE TTDRAY±0320 +N,+SPEED=±0330 +9600,ISPEED=±0342 +,TT=±0346 +0,TY=±0351 +0,TO=±0356 +0,TP=±0361 +%TPORS,HOR=±0372 +80.,SMARTS=±0383 +T!N!$SMT=±0395 +T!N!$TCT=±0415 +T!N!$HOR=±0433 +T!N!$VER=±0448 +T!N!$OPT=±0463 +T!N!$TYP=±0532 +T!N!$ROL=±0583 +DEFINE TTDGT40±0642 +N,+SPEED=±0652 +4800,ISPEED=±0664 +,TT=±0668 +0,TY=±0673 +0,TO=±0678 +0,TP=±0683 +%TPORS,TCT=±0694 +%TNDP,HOR=±0704 +72.,VER=±0712 +32.,ROL=±0720 +1,SMARTS=±0729 +T!N!$SMT=±0741 +T!N!$HOR=±0761 +T!N!$VER=±0776 +T!N!$OPT=±0791 +T!N!$TYP=±0844 +T!N!$TCT=±0895 +T!N!$ROL=±0910 +DEFINE TTD11±0980 +N,+SPEED=±0990 +4800,ISPEED=±1002 +,TT=±1006 +0,TY=±1011 +0,TO=±1016 +0,TP=±1021 +0,TCT=±1027 +%TNPRT,HOR=±1038 +72.,VER=±1046 +MOVE,ROL=±1055 +1,SMARTS=±1064 +T!N!$SMT=±1076 +T!N!$HOR=±1096 +T!N!$VER=±1111 +T!N!$OPT=±1126 +T!N!$TYP=±1165 +T!N!$TCT=±1223 +T!N!$ROL=±1238 +DEFINE TTDRAN±1298 +N,+SPEED=±1308 +FOO.,ISPEED=±1320 +,TT=±1324 +0,TY=±1329 +0,TO=±1334 +FOO.,TP=±1342 +FOO.,TCT=±1351 +FOO.,HOR=±1360 +FOO.,VER=±1369 +FOO.,ROL=±1378 +FOO.,SMARTS=±1390 +T!N!$SMT=±1402 +T!N!$HOR=±1422 +T!N!$VER=±1437 +T!N!$OPT=±1452 +T!N!$TYP=±1470 +T!N!$TCT=±1521 +T!N!$ROL=±1536 +DEFINE TTDDTM±1577 +N,+SPEED=±1587 +4800,ISPEED=±1599 +,TT=±1603 +0,TY=±1608 +0,TO=±1613 +0,TP=±1618 +%TPORS+3*%TPPCR,HOR=±1638 +80.,VER=±1646 +T!N!$SMT=±1660 +T!N!$HOR=±1673 +T!N!$VER=±1688 +T!N!$OPT=±1703 +T!N!$TYP=±1763 +T!N!$TCT=±1814 +T!N!$ROL=±1832 +DEFINE TTDTV±1927 +T!N!$SMT=±1940 +T!N!$HOR=±2032 +T!N!$VER=±2047 +T!N!$OPT=±2061 +T!N!$TYP=±2150 +T!N!$TCT=±2195 +T!N!$ROL=±2212 +DEFINE TTDGRN±2325 +N,+SPEED=±2335 +9600,ISPEED=±2347 +,TT=±2351 +0,TY=±2356 +0,TO=±2361 +0,TP=±2366 +%TPCBS+%TPORS,HOR=±2384 +86.,VER=±2392 +50.,TCT=±2400 +%TNSFW,ROL=±2411 +0,SMARTS=±2420 +T!N!$SMT=±2432 +T!N!$HOR=±2452 +T!N!$VER=±2467 +T!N!$OPT=±2482 +T!N!$TYP=±2549 +T!N!$TCT=±2600 +T!N!$ROL=±2615 +DEFINE TTDSTY±2679 +T!N!$SMT=±2692 +T!N!$HOR=±2707 +T!N!$VER=±2722 +T!N!$OPT=±2738 +T!N!$TYP=±2785 +T!N!$TCT=±2803 +T!N!$ROL=±2821 +DEFINE MCONDX±2848 +DEFINE .ENDC±2995 +DEFINE .ENDR±3019 +DEFINE BUG±5423 +BUGBUG:±5529 +DEFINE BUGMC1±5923 +DEFINE BUGMC4±5986 +LBUGTB=±7028 +DEFINE BUGMC2±7150 +BUGMC1 //,[DEFINE BUGMC1±7183 +DEFINE BUGMC3±7394 +DEFINE BUGMC5±7534 +BUGMC4 [DEFINE BUGMC4±7561 +SUBTTL DEFINE PI±7615 +LPTP=±7633 +TM10A=±7731 +TM10B=±7765 +TM03S=±7775 +TM10P=±7799 +IFN TABP,TABCLK=±7866 +IFN IMPP, IMPCHN=±8026 +IFN NETP, NETCHN=±8058 +IFN PLTP, PLTCHN=±8283 +IFN PTRP, PCHCHN=±8321 +IFN PTRP, PTRCHN=±8355 +IFN NTYP, NTYCHN=±8403 +IFN 340P, SDCHN=±8438 +IFN DSDP, DSDCHN=±8484 +IFN ARMP, TIPBCH=±8537 +IFN OMXP, OMPCHN=±8578 +IFN VIDP, NVDCHN=±8619 +IFN TABP, IFE TABCLK, TABCHN=±8662 +IFN 340P\E.SP, DISCHN=±8696 +IFN CH10P, CHXCHN=±8737 +IFN CH11P, CHXCHN=±8817 +IFN TABP, IFN TABCLK, TABCHN=±8882 +IFN OMXP, OMXON=±9168 +IFN OMXP, OMXOFF=±9209 +IFN PTRP, PTPON=±9316 +IFN PTRP, PTROFF=±9357 +IFN PTRP, PTRON=±9398 +IFN PTRP, PTROFF=±9439 +IFN NETP, NETON=±9612 +IFN NETP, NETOFF=±9637 +IFN KL10P, DTEON=±9663 +IFN KL10P, DTEOFF=±9689 +IFN NETP,NETRQ=±9928 +IFN CH11P,CHXRQ=±9973 +TABON=²0036 +TABOFF=²0051 +TABON=²0083 +TABOFF=²0114 +IFN NUNITS, IFE NEWDTP, CUINT=²0177 +PMLCAD=²0241 +PMRCAD=²0302 +SUBTTL DEFINE DEVICE²0375 +IFN STKP, STK=²0419 +IFN OLPTP, OLPT=²0460 +IFN NLPTP, NLPT=²0496 +IFN TM10P, MTC=²0517 +IFN TM10P, MTS=²0556 +IFN VIDP, NVDX=²0594 +IFN VIDP, NVDY=²0627 +IFN VIDP, NVDT=²0660 +IFN PLTP, PLT=²0711 +IFN HCLKP, CLK1=²0751 +IFN HCLKP, CLK2=²0789 +IFN IMXP, MPX=²0813 +IFN OMXP, OMPX=²0853 +IFN TK10P\NTYP, NTY=²0899 +IFN MTYP, MTY=²0938 +IFN DL10P, DLB=²0959 +.ALSO DLC=²0987 +IFN PDCLKP, PDCLK=²1025 +IFN DSDP, DSDEV=²1101 +IFN DSDP, DSDEVN=²1158 +IFN ARMP, TIPDEV=²1241 +IFN RBTCP, RBTCON=²1283 +IFN DPKPP, DPK=²1319 +IFN DC10P, DC0=²1359 +IFN DC10P, DC1=²1399 +IFN RP10P, DPC=²1439 +IFN RH10P, DSK=²1479 +IFN KAIMP, IMP=²1519 +IFN DMIMP, FI=²1573 +IFN NUNITS, NUTIC=²1760 +.ELSE NUTIC=²1797 +IFN NUNITS, NUTOC=²1819 +.ELSE NUTOC=²1857 +IFN DSDP, IFN VIDP, DSNVID=²2165 +IFN DSDP, IFN 340P, DSNDIS=²2225 +IFN DSDP, IFN NMTCS, DSMTC=²2283 +IFN RBTCP, RLTSWC=²2336 +IFN RBTCP, IFN TABP, RTABC=²2414 +IFN IMXP, LCHN=²2469 +IFN IMXP, NPOTCH=²2561 +IFN CODP, CODBFL=²2673 +IFN PTRP, PUNSIZ=²2707 +IFN PTRP, REDSIZ=²2742 +IFN PLTP, LPLBUF=²2778 +IFN LPTP, LPTBSZ=²2814 +IFN VIDP, NVDLNG=²2851 +IFN TPLP, TPLBSZ=²2888 +IFN TABP, LTABBF=²2939 +IFN N11TYS, TT11CR=²2979 +EOFCH=²3028 +EOFWRD=²3063 +IFN 340P, DVEF=²3130 +IFN 340P, DHEF=²3180 +IFN 340P, EWRT=²3227 +IFN 340P, MDISWD=²3304 +NSWPV=²3355 +IFN NMTCS, MAGLOC=²3446 +IFN NUNITS, DCMLOC=²3498 +IFN IMXP, IMXLC=²3539 +IFN NMTCS, MAGLOC=²3669 +IFN NUNITS, DCMLOC=²3693 +SD=²3739 +PD=²3749 +PUP=²3761 +PDN=²3771 +SDC=²3781 +PDC=²3793 +SDS=²3805 +PDS=²3816 +LPM=²3920 +LPMR=²3980 +SPM=²4019 +LPMRI=²4061 +EXPGNG=²4123 +XCTR=²4170 +XCTRI=²4429 +DEFINE CLRPGM²5075 +PI=²5253 +LIGHTS=²5283 +CLK=²5341 +CLKINT=²5398 +PTR=²5464 +PTP=²5493 +TTY=²5521 +DTC=²5544 +IFN 340P, DIS=²5581 +PI0LOC=²5609 +OIPBIT=²5646 +BADPC=²5685 +DEFINE UUOH²5757 +DEFINE FORTY²5847 +DEFINE SYSCTX²5875 +DEFINE USRCTX²5925 +DEFINE OVHMTR²5975 +XCTR=²6147 +XCTRI=²6217 +LPMR=²6298 +SPM=²6360 +DEFINE CLRPGM²7073 +PI=²7211 +PAG=²7238 +CCA=²7300 +TIM=²7328 +MTR=²7352 +LIGHTS=²7438 +CLK=²7484 +CLKINT=²7539 +OIPBIT=²7718 +BADPC=²7760 +SWPIA=²7823 +SWPIO=²7865 +SWPUO=²7913 +SWPUA=²7957 +WRPAE=²7995 +APRID=²8047 +RDERA=²8097 +RCCL=²8133 +RPERFC=²8188 +REBOXC=²8246 +RMBOXC=²8304 +DEFINE UUOH²8933 +DEFINE FORTY²9020 +DEFINE SPCCTX²9311 +SYSCTX=²9484 +USRCTX=²9557 +EPT=³0092 +HSB=³0141 +DEFINE CLRPGM³0178 +OIPBIT=³0286 +BADPC=³0330 +DEFINE UUOH³0392 +DEFINE FORTY³0479 +DEFINE SPCCTX³0673 +SYSCTX=³0785 +USRCTX=³0858 +DEFINE UMOVE³1393 +DEFINE UMOVEM³1452 +NDOPL=³1992 +MIOTER=³2717 +NIOTER=³2753 +SNTTY=³2938 +SNTDS=³2948 +SNLPD=³2976 +SNVID=³3005 +SNBAT=³3015 +SNPLT=³3025 +SNPTP=³3035 +SNIMPX=³3046 +SNOMPX=³3058 +SNPTR=³3069 +SN340=³3080 +SNMTC=³3153 +SNCOD=³3173 +SNTAB=³3197 +SNNUL=³3208 +SNJOB=³3219 +SNBOJ=³3230 +SNSPY=³3241 +SNSTY=³3252 +SNNET=³3263 +SNLPV=³3288 +SNSTK=³3310 +SNMSP=³3340 +IFN CHAOSP,SNCHA=³3383 +IFN TCPP,SNTCP=³3414 +SNTRAP=³3459 +IFN INETP,SNIPQ=³3495 +SNUTC=³3523 +SN2311=³3535 +SNFUSR=³3547 +SNUSR=³3558 +SNCLK=³3569 +SNDIR=³3597 +SNPDP=³3608 +SNDIRH=³3626 +SNLCK=³3654 +ITSMCH=³3730 +ITSVRS=³3794 +FNM=³3856 +DEFINE VNAM³3958 +DEFINE SRITYP³4268 +ZZZ=³4276 +DEFINE MNIRP³4418 +IRPS M,,[JAN:³4435 +FEB:³4439 +MAR:³4443 +APR:³4447 +MAY:³4453 +JUN:³4457 +JUL:³4461 +AUG:³4465 +SEP:³4471 +OCT:³4475 +NOV:³4479 +DEC:³4483 +FOO=³4565 +MNIRP [M=³4626 +FOO=³4636 +DEFINE INFORM³4693 +ZZZ=³4735 +SSYS=³4790 +DEFINE EBLK³4827 +CKPAR=³4864 +CKNUM=³4956 +SSYS=³4971 +DEFINE BBLK³5006 +CKZZ=³5013 +CKPAR=³5052 +CKPAR=³5072 +CKNUM=³5082 +DEFINE PCLT³5233 +DEFINE PCLTH³5305 +DEFINE PI2SAF³5395 +SUBTTL DEFINE EXEC³5515 +EXPGN=³5531 +DEFINE EXECPG³5550 +X=³5556 +EXPGN=³5570 +ZZQ=³5584 +ZZQQ=³5599 +.!X=³5610 +T11CHS=³6555 +NEXPGS=³6802 +PATB=³7088 +MICWA:³7217 +QICWA:³7304 +RCICWA:³7337 +PFOPC:³8576 +PFNPC:³8617 +EPTDIA:³8674 +EPTDDT:³8735 +EPTSTL:³8780 +EPTITS:³8839 +EPTTR1:³8926 +EPTTR2:³8974 +EPTTR3:³9030 +DTEBPO:³9080 +DTEBPI:³9116 +DTELOC:³9152 +DTEPRO:³9337 +DTERLO:³9372 +DTEPRI:³9388 +DTERLI:³9424 +EPTEBC:³9528 +EPTMBC:³9591 +DEFINE OVHMTR³9855 +DEFINE OVHMT1´0010 +OVHTAB [DEFINE OVHTAB´0044 +DEFINE OVHTAB´0156 +EPTPFW:´0390 +EPTPFO:´0419 +EPTPFN:´0450 +EPTP!I!W:´0527 +EPTP!I!O:´0558 +EPTP!I!N:´0591 +EPTTR1:´0664 +EPTTR2:´0712 +EPTTR3:´0768 +EPT1PO:´0828 +EPT1PN:´0860 +EPTUEN:´0938 +EPTUET:´0996 +EPTUUN:´1024 +EPTUUT:´1040 +IMPIBF:´1255 +IMPBFS=´1274 +IMPOBF:´1292 +DEFINE OVHMTR´1551 +DEFINE OVHMT1´1706 +OVHTAB [DEFINE OVHTAB´1740 +DEFINE OVHTAB´1848 +DL10AR:´2138 +DL10VR:´2260 +DL10UP:´2307 +DL10SO:´2420 +DL10IL:´2494 +DL10IC:´2569 +DL10OD:´2619 +DL10BS:´2689 +DL10BP:´2731 +DL10CC:´2790 +DL10LN:´2845 +DL10CL:´2919 +DL10PL:´3091 +DL10PR:´3165 +DL10PS:´3206 +DL10XD:´3266 +DL10XA:´3337 +DL10XW:´3374 +GLPTBP:´3410 +GLPTBC:´3460 +GLPTER:´3528 +GLPGRF:´3584 +DLCINI:´3666 +DLCSP1:´3714 +DLCSP2:´3725 +DLCSS1:´3736 +DLCSS2:´3747 +DLCRP1:´3758 +DLCRP2:´3769 +DLCRS1:´3780 +DLCRS2:´3791 +DLXEND:´3824 +DL10BF:´3990 +GLPBSZ=´4085 +GLPMPP:´4208 +GLPMPC:´4293 +GLPTBF:´4326 +IFN KA10P, PATB=´4478 +DTEVER:´4625 +DTECHK:´4700 +DTEINP:´4831 +DTEOUT:´5008 +DTELSP:´5446 +DTELPR:´5522 +DTEOST:´5598 +DTETYI:´5719 +DTEODN:´5812 +DTEHNG:´5912 +NSKED:´6295 +NNSKED:´6335 +NRSKED:´6371 +NSSKED:´6424 +NRESKED:´6477 +NSCHDU:´6531 +NNULBK:´6597 +NUINT:´6645 +NAUINT:´6686 +NPCLSR:´6759 +NEPCLS:´6786 +NFPCLS:´6834 +NSOUSR:´6909 +NSOPGS:´6943 +NPGSO:´6999 +NAGEAB:´7028 +NSHRAB:´7077 +NPGFLT:´7125 +NCLKI:´7162 +NPGLD:´7200 +NUFLS:´7228 +NTUSB:´7255 +NTSBUP:´7293 +NTSBUB:´7358 +NTSBUU:´7424 +NAGES:´7506 +NRPI:´7591 +NRPCI:´7650 +NRPO:´7698 +NRPGO:´7728 +CLKBRS:´7761 +PAT:´7824 +PATCH:´7889 +VPATCH:´7950 +VPAT:´7957 +DEFINE CLKSAV´8043 +BRK=´8048 +DEFINE CLKLEV´8310 +DEFINE CLKLEV´8522 +DTEBRK:´9308 +CLKBRK:´9715 +CLKBR2:µ0008 +CLKB2A:µ0052 +CLKBKR:µ0390 +CLKB1D:µ0691 +CLKTIC:µ1345 +CLQBRT:µ1487 +DSTPD:µ2223 +E.SOK:µ2415 +CLK1F:µ3055 +PRESCD:µ3545 +CLKB2:µ3602 +CLKBKS:µ4077 +CLKKS2:µ4524 +CLKKS1:µ4714 +CLUFLS:µ5011 +CLQBRK:µ5151 +CLQRET:µ5472 +CLQTTR:µ5638 +CLQREE:µ5695 +CLQPUT:µ5892 +CLQPU2:µ5918 +CLQPU6:µ6500 +CLQAD1:µ6889 +CLQADD:µ6924 +CLQDE4:µ7258 +CLQDEL:µ7414 +CLQCLR:µ7619 +CLQDE2:µ7679 +PFAILU:µ8118 +PFINST:µ8159 +PFOPC1:µ8193 +PFAIL:µ8347 +PFA4:µ8789 +PFA1:µ9008 +PFA2:µ9077 +TPFLT1:µ9348 +PFA6:µ9504 +PFA9:µ9981 +PFA14:¶0743 +PFA3:¶1094 +PFA11:¶1295 +PFA13:¶1543 +PFA12:¶2020 +PFA15:¶2622 +PFA16:¶2815 +PF!I!SVU:¶3076 +PF!I!SVT:¶3122 +PF!I!INS:¶3168 +PF!I!AIL:¶3311 +PFXSVT=¶3515 +PFXINS=¶3548 +PFXWRD=¶3581 +PFXOPC=¶3614 +PIFAIL:¶3649 +PIFL2:¶4089 +PF!I!RET:¶4416 +PFXRET=¶4571 +PIFL1:¶4739 +PF!I!XCT:¶4909 +PFXXCT=¶5107 +PFLCLK:¶5151 +PFLSVU:¶5199 +PFLSVT:¶5237 +PFLINS:¶5275 +PFAIL:¶5561 +PFLOOP:¶6173 +PFLSKP:¶6795 +PFAILE:¶6936 +PFLNXI:¶6991 +PFLUSR:¶7123 +PFLU1:¶7358 +TPFLT1:¶7483 +CCLKRQ:¶7539 +PFLU2:¶7644 +CLKB1:¶8011 +CLKFO2:¶8088 +CLKFO1:¶8319 +CLKB1C:¶8410 +CLB1A:¶8602 +CLB1B:¶8744 +CLKB1H:¶8995 +PFA5:¶9515 +CFHSW1:·0322 +CFH1:·0685 +CFH2:·0907 +CFHW1:·1708 +CFHSW3:·2009 +CFHSW4:·2092 +CFHDT:·2205 +CFF1:·2313 +CFHRWF:·2816 +CFHX:·3309 +CFH5A:·3363 +CFHX1:·3605 +CFH5:·3741 +CFHPI:·3870 +E.SBAR:·4653 +CFHPB:·5043 +CFHAHC:·5749 +CFHAHD:·6429 +CFHAH1:·6532 +CFHAH2:·7194 +CFHAH5:·8832 +CFHAH6:·9075 +CFHAH4:·9197 +CFHRNG:·9351 +CFHAHS:·9492 +NPGAHD:·9570 +NPGAH1:·9638 +NPGBHD:·9697 +NPGBHA:·9767 +NPGAHR:·9816 +NPGBHR:·9872 +CFHPO:¸0052 +CFHPOB:¸0360 +CFHPCI:¸0887 +CFHPGO:¸0896 +CFHPO2:¸0905 +CFHPOA:¸1480 +CFBO2:¸1580 +CFSB1:¸1750 +CFHPO7:¸1890 +CFHPO5:¸3924 +CFHPO8:¸4306 +CFHPO1:¸4567 +CFHPO4:¸4759 +CFHPO3:¸4995 +CFBO1:¸5347 +CFBO3:¸5646 +CFSB:¸6017 +CFSB2:¸6574 +CFSB3:¸6810 +WSAVL:¸7409 +WSAVL1:¸7871 +WSRCM:¸8622 +WSRCM1:¸8815 +WSRCM2:¸9190 +WSRCM3:¸9232 +WSRCM4:¸9425 +WSRCM5:¹0035 +LVLOAD:¹0132 +LVLOA0:¹0207 +CFELD:¹0610 +CFH4:¹1228 +PFA7:¹1398 +PFA7A:¹1527 +CLKB1J:¹1923 +CFH6:¹2780 +CLKB1K:¹2962 +CLKB1G:¹2985 +CLB1X:¹3030 +CLB1XA:¹3481 +CNLJL:¹3784 +CFHFPF:¹3929 +RINT:¹4075 +RINTAP:¹4275 +RINTPI:¹4306 +RINT1=¹4406 +R1NTAC:¹4450 +RINT1:¹4467 +PCMARB:¹4663 +PCMAR1:¹5398 +CPROC1:¹5593 +CPRUUO:¹5719 +AROV:¹5854 +AROV2:¹6061 +ARFOV:¹6096 +CLKB1E:¹6250 +PARSCJ:¹7399 +PARSCN:¹8665 +PARFX3:¹8674 +PARFX7:¹8816 +PARFX1:¹9026 +PARFX5:¹9077 +PARFX8:¹9372 +PARFX4:¹9434 +PARFX6:±00350 +PARFXB:±01012 +PARFXA:±01148 +PARFX9:±01165 +PARFU1:±01380 +PARFU5:±02035 +PARFU4:±02053 +PARFU2:±02179 +PARFU3:±02537 +MEMHNG:±02594 +MEMHN1:±03094 +MEMHN2:±03177 +MEMHN3:±03637 +SSLCK:±03788 +SSLCK0:±04606 +SSLCK2:±04956 +SSLCK1:±05679 +SSLCK3:±05744 +SSLCK1:±05903 +SSLCK3:±05940 +SSLCM1:±06743 +SSLCM2:±06990 +SSLCK8:±07586 +SSLCK5:±08551 +SSLCK6:±08723 +SSLCKA:±09135 +SSRCK:±09760 +SSKQ2:±10379 +SCDCK1:±10721 +SCDCK2:±10858 +SCDCK3:±10882 +ECCLOG:±11328 +ECCLG9:±11773 +ALCR0:±12594 +ALCR1:±12694 +ALCR4:±14935 +ALCR5:±15375 +ALCR6:±15643 +ALCR7:±16354 +COFFIN:±16644 +COFFI8:±17005 +COFFI9:±17107 +COFFI1:±17147 +COFFI2:±17234 +COFFI3:±17752 +COFFI7:±17877 +COFFI4:±18023 +AGE:±18505 +AGE0:±19205 +AGE1:±19532 +DISCHK:±19937 +DISZAP:±20040 +DEATH:±20226 +DEATHX:±20406 +DEATHY:±20521 +DEATHM:±20584 +SUPSET:±20698 +VSSLCK:±20733 +RCCLK:±20865 +WHOSET:±21007 +15SCLK:±21268 +15S1:±21938 +15S3:±22396 +15S2:±22430 +15S5:±22542 +15S4:±22697 +PRVCLK:±23414 +PRVCK1:±23574 +PRVCK3:±24048 +PRVCK2:±24086 +PRVCK4:±24129 +NPRVUS:±24190 +NPVUS1:±24341 +NPVUS3:±24535 +NPVUS2:±24573 +IFNDEF MEMSYS,MEMSYS=±24738 +IFNDEF MEMSY1,MEMSY1=±24801 +SWSCD:±24863 +SWSCP1:±25323 +SWSCP5:±25536 +SWSCP7:±25664 +SWSCP6:±25702 +SWSCP4:±25801 +SWSCP2:±25875 +SWSCP9:±26075 +SWSCP8:±26242 +PPIUM:±26773 +PPIUM1:±27175 +QSWI3:±27914 +QSWI2:±27993 +QSWI2A:±28138 +POPIJ:±29186 +E.SPGJ:±29227 +IFN KL10P, IFNDEF SCCOST, SCCOST=±29536 +IFN KA10P, IFNDEF SCCOST, SCCOST=±29610 +IFN KS10P, IFNDEF SCCOST, SCCOST=±29685 +SCHED:±29735 +SCHED0:±30236 +SCHED2:±30354 +SCHD2A:±31026 +SCHED8:±32120 +.ELSE SCHED8:±32328 +SCHED3:±32467 +SCHED4:±32709 +SEARRT:±33026 +SEARL0:±33250 +SCHED9:±34047 +SCHEDP:±35275 +SCHDP1:±35653 +SEARL:±35963 +SEARL1:±36123 +SEARL2:±36254 +SEARL3:±36326 +SEARL4:±36378 +SEARC:±36619 +SEARC2:±36831 +SEARC4:±37278 +SEARC6:±37633 +SEARP2:±38413 +SEARP5:±38575 +SEARC7:±38718 +SEARLB:±38864 +SEARB1:±39196 +SEARS1:±39382 +SCHACK:±39779 +SCHAC1:±40451 +SCHACI:±40567 +SCHSJB:±40867 +SCHSJ0:±41137 +SCHSJ1:±41300 +SCHSJ5:±41320 +SCHSJ3:±41379 +SCHSB:±41773 +SCHGB:±42101 +.ALSKF=±42209 +DEFINE ALTSKP±42226 +.ALSKF=±42337 +UPRIVL:±42427 +SEAREN:±42951 +SCHED6:±43295 +SCHED1:±43335 +SSTVR2:±44017 +SSTVR1:±44257 +SCHDN:±44787 +SLTVR2:±45248 +SLTVR1:±45358 +SEAREP:±45712 +CLKB5:±46886 +SCHED5:±47104 +SCHD5A:±47368 +SCHED7:±47726 +SCHDN2:±47976 +NULJOB:±48667 +SSWC1:±49037 +SSWSC4:±49465 +SSWSC5:±49618 +SSWSC6:±49656 +SSWSC3:±49760 +SWPON:±49895 +SWPON1:±50314 +SWPON6:±50380 +SWPON8:±50792 +SWUP8:±50905 +SWUP9:±51161 +SWUP7:±51274 +SWUP6:±51386 +SWOL1:±51475 +SWPU1:±51882 +SWPU1B:±52434 +SWPU2:±52811 +SWPU2A:±53250 +SWPU6:±53697 +SWPU3:±53959 +SWPU3A:±53997 +SWPU4:±54292 +SWPU5:±54581 +SWPU5A:±54991 +SWPONX:±55171 +SWPNX2:±55334 +SWPNX1:±56047 +SWPNX3:±56379 +SWPKHT:±56487 +SWPON2:±56939 +SWPON4:±57225 +SWPON5:±58094 +SWPON7:±58517 +SWPTK:±58552 +SWPTK2:±58816 +SWPON3:±58891 +SWPTT:±58999 +NSSCDC=±59567 +CKPRUS:±59600 +ASWAP:±60269 +ASWAP1:±60463 +ASWAP2:±60802 +ASWAP3:±61208 +ASWPCL:±61277 +NPGWRT:±62096 +NPGWR0:±62266 +NPGWR1:±62540 +NPGWR3:±63367 +NPGWR2:±63835 +NPGWR4:±64167 +SWIRQB:±64286 +IFN 340P\E.SP, DISSWI:±64310 +IFN VIDP, VIDSWI:±64338 +IFN IMXP, POTSWI:±64360 +SWIVPN:±64409 +IFN 340P\E.SP, DISSPG:±64433 +IFN VIDP, VIDSPG:±64475 +IFN IMXP, POTSPG:±64496 +SWPNTB:±64509 +SWILMT:±64634 +PSWOUS:±64730 +PSWCLS:±64779 +PSWSFL:±64827 +SWPMBP:±64894 +SWPCBP:±64918 +PSWLC:±64953 +SBEFLG:±64976 +SWPOPR:±65047 +SWPOPB:±65101 +SILNG:±65183 +SOLNG:±65224 +SWODSK:±65327 +SWOBK:±65367 +SWOMMP:±65404 +SPGNMF:±65440 +CFHAS:±65475 +SWPIQS:±65505 +CFHUVP:±65534 +LUMPS:±65586 +TRUMM:±65695 +NPGSWO:±65735 +AUSOPG:±65785 +BUMPGS:±65827 +NUSWB:±65886 +SWPOPU:±65920 +AGEREQ:±66027 +AGEPOS:±66080 +PRVUSR:±66125 +PRVCUT:±66147 +SWUPC:±66182 +SWPP0F:±66248 +ASBUM:±66285 +SWSCT1:±66345 +BUSR:±66368 +BUSIZ:±66416 +PREEMP:±66467 +NPREEL:±66548 +NPREEM:±66607 +NPREE1:±66650 +NPREE2:±66734 +NPREE3:±66810 +NLPPRE:±67057 +NLPCLK:±67115 +NLPUFL:±67171 +NLPPAG:±67226 +NLPPGT:±67284 +NLPPGC:±67360 +NLPPGM:±67439 +NLPPG3:±67518 +NLPPGB:±67606 +NPPIUM:±67684 +NPPIU1:±67745 +LODQNT:±67843 +LODFCT:±68027 +NUPTAW:±68104 +NPLBLJ:±68177 +NPLBNL:±68226 +SWPOPL:±68905 +SWPOPG:±68952 +SWODF3:±69673 +SWODF6:±69695 +SWODF5:±70162 +SWODF7:±70308 +SWODF2:±70448 +SWODF4:±70607 +SCRPSJ:±71093 +SWOP1:±71127 +SWOP1A:±71478 +SWOPT2:±71756 +SWOPT1:±71920 +SWOP7:±73019 +SWOP7A:±73208 +SWOP6:±73735 +SWOP6D:±74346 +SWOP6A:±74568 +SWOP6C:±75134 +SWOP6F:±75163 +SWOP6B:±75352 +SWOP2:±75716 +SWOP2D:±76059 +SWOP2A:±76097 +SWOP2C:±76802 +SWOP2B:±76831 +SWOP6E:±76894 +SWOP8:±76994 +SWOP5:±77774 +UTCNJ:±77793 +SWOP3:±77855 +SWOP4:±78400 +UTCNJ1:±78420 +SWPPIN:±78473 +SWPPI4:±78535 +SWPPI6:±78730 +SWIILM:±78769 +%UM=±79220 +%UMMPL=±79239 +%UMMPU=±79321 +%UMALL=±79404 +%UMUTL=±79460 +%UMLTU=±79611 +%UMSOA=±79697 +PGLDU:±79991 +PGLD:±80082 +PGLD3A:±80539 +PGLD3F:±80650 +PGLD3H:±80926 +PGLD6:±81193 +PGLDR1:±81220 +IFN PDP6P, PGLD3B:±81296 +PGLD3D:±81320 +PGLD3G:±81377 +GACS:±81416 +MP6LD:±81611 +MPLDZ:±81677 +MPLD1:±81729 +MPLD:±81808 +MPLDJ:±81937 +PLD6:±82158 +PLDZ:±82226 +PLD1:±82257 +PLD:±82280 +SEAR2E:±82482 +SEAR2A:±82553 +SEAR2C:±83023 +SEAR2D:±83116 +INTSUP:±83412 +INTTOP:±84045 +SEAR2B:±84228 +INTWD2:±84477 +INTWD1:±84914 +INTSRC:±85230 +INTSR0:±86003 +INTSR5:±87485 +INTSR4:±87764 +INTSR3:±88364 +INTSRX:±88434 +INTSR1:±88525 +INTSR2:±88579 +INTOLD:±88683 +INTPAG:±89415 +INTPFL:±89837 +INTBAC:±90296 +INTBAB:±90670 +INTBAB:±91101 +INTBA1:±91396 +INTBAD:±92284 +DBGINT:±92572 +INTALL:±92624 +INTA2:±92660 +PCLSR:±93324 +PCLSR3:±93696 +PCLSR8:±94166 +PCLSR4:±94256 +PCLSRF:±94341 +PCLSR2:±94373 +PCLSR5:±94468 +PCLSR6:±94742 +PCLSR6:±94958 +PCLSR1:±95146 +PCLSR9:±95281 +UFL5:±95342 +PCLSR7:±95979 +NJRPCL:±96301 +RPCLSR:±96349 +RPCLS1:±96737 +RPCLOS:±96801 +RPCLS2:±97231 +NJUPCL:±97397 +UPCLSR:±97445 +ONEPROC:±97629 +ONEPRO:±97846 +ONEPR3:±98399 +ONEPR4:±98457 +USTART:±98758 +USTRT1:±98776 +USTRT2:±99265 +USTSC2:±99535 +USTRTS:±99690 +USTSC1:±99956 +USTRTL:²00109 +USTRA:²00438 +USTR3:²00456 +USTR1:²00620 +USSINI:²00900 +USTR2:²00969 +USRST4:²01159 +MORCOR:²01277 +USTR4:²01529 +USTR4A:²01867 +USRST2:²04478 +USTTV1:²04964 +USTR4B:²05760 +USTTV0:²05857 +NUSTCD:²06213 +USTCDR:²06426 +IODCL:²06876 +IODCLA:²06985 +IODCL1:²07835 +IODCL6:²08580 +IODCL3:²08717 +IODCL2:²08792 +IODCL4:²08811 +IODCL9:²09154 +IODCL7:²09452 +IODCL5:²09482 +IODCL8:²09608 +NUNLOCK:²09729 +NUNLO1:²09966 +NUNLO2:²10217 +NUNLO3:²10366 +DEFINE XCTRIJ²11736 +IODCSW:²12050 +IODCS0:²12237 +IODCS1:²12580 +IODCS2:²12890 +IODCS3:²13162 +IODCS4:²13495 +IODCXC:²13839 +IODCDO:²15474 +IODCD1:²15596 +IODCD3:²16135 +IODCD2:²16312 +ZUSER:²16633 +ZUSER2:²16799 +ZUSES:²17458 +ZUSES1:²17536 +ZACHEK:²17832 +ZACHK4:²17900 +ZACHK2:²18483 +ZACHK1:²18620 +ZUSLOG:²18724 +LOGUSE:²19016 +LOGUS1:²19478 +LOGUPD:²19965 +LOGUP1:²20018 +LOGUP2:²20331 +UFLS:²20646 +UFL3:²21139 +UFL6:²21645 +UFL1:²21945 +UFL1A:²22311 +UFL1A:²22562 +LWAIT1:²22862 +LWAIT:²22904 +SWTL:²23186 +SWTL1:²23538 +SWTL2:²23661 +SWTL3:²23682 +SWTLZ:²23919 +SWTAD:²23967 +SWTAD2:²24226 +SWTAD3:²24334 +SWTAD1:²24384 +CWAIT1:²24573 +CWAIT:²24610 +LSWTL:²24897 +LSWTL2:²25106 +SLUGH:²25341 +SLUGH1:²25448 +SLUGH2:²25542 +SLWAIT:²25849 +SLWT1:²26004 +SLWATT:²26108 +SLUWIN:²26190 +SLLOCK:²26285 +SLULOS:²26327 +SLULO2:²26345 +SWTLX:²26448 +SWTLX1:²26558 +LSWTLX:²26591 +STMSET:²26832 +FINSET:²26941 +AOSSET:²27108 +SOSSET:²27216 +SOLSET:²27362 +LOSSET:²27581 +SGNSET:²27759 +NULSET:²27865 +LSTSET:²28057 +LSTST3:²28151 +LSTST2:²28293 +STMNPS:²28618 +LNPSET:²28755 +COMSET:²28821 +LSWSET:²28982 +LSWSE2:²29138 +LSWSE3:²29159 +LSWCJ1:²29295 +LSWCLR:²29407 +LSWCL1:²29425 +LSWPJ1:²29646 +LSWPOP:²29663 +LSWPPP:²29786 +LSWZAP:²29927 +LSWZP1:²29968 +LSWDIS:²30648 +LSWDS1:²30903 +LSWTAB:²30929 +UNSWTL:²31189 +ULSTM:²31234 +UNLSWT:²31281 +ULAOSL:²31348 +ULAOS:²31436 +UNLST:²31480 +ULSOS:²31592 +ULROUT:²31637 +ULROU1:²32005 +LSWREM:²32287 +LSWRM1:²32395 +LSWRM2:²32475 +LSWDEL:²32546 +LSWDDD:²32710 +LSWPON:²32838 +LSWDLN:²32918 +LSWBAK:²32971 +LSWBA2:²33162 +LSWBA3:²33338 +PPBAJ1:²33419 +POPAJ1:²33436 +POPBAJ:²33456 +POPAJ:²33472 +CPOPJ:²33488 +POPQJ:²33506 +POPBJ1:²33535 +POPCBJ:²33555 +POPBJ:²33571 +POPJ3:²33599 +POPJ2:²33615 +POPCJ1:²33633 +POPJ1:²33649 +POPCJ:²33666 +POPJJ1:²33695 +POPJJ:²33713 +POPUJ1:²33742 +POPTUJ:²33762 +POPUJ:²33778 +POPTJ:²33806 +POPTTJ:²33835 +POPWJ2:²33865 +POPWJ1:²33884 +POPWJ:²33902 +PIONJ:²33930 +CKOCJ1:²33964 +CLKOJ1:²34003 +CLKONJ:²34020 +CKOPJ1:²34055 +CLKOPJ:²34072 +OMXONJ:²34123 +TTYOJ1:²34161 +TTYONJ:²34178 +IFN PTRP, PTRONJ:²34223 +: PTPONJ:²34232 +LPTONJ:²34242 +IFN NETP,NETOJ1:²34286 +UTCOJ1:²34295 +UTCOAJ:²34313 +IFN NETP,NETONJ:²34340 +UTCONJ:²34349 +POPQU1:²34384 +POPQUJ:²34403 +POP1J1:²34442 +POP1J:²34460 +POP2J:²34493 +POP3J1:²34527 +POP3J:²34545 +POP4J:²34578 +POP7J:²34611 +POP5J:²34632 +.IOT=²34689 +.OPEN=²34703 +.OPER=²34723 +.CALL=²34743 +.USET=²34763 +.BREAK=²34784 +.STATUS=²34806 +.ACCESS=²34828 +DEFINE GLOSYM²34857 +DEFINE OPRIRP²35715 +DEFINE CALIRP²36229 +SYSYMB:²36500 +DEFINE DEFSYM²36801 +MXOPR=²36980 +SYSYME=²37133 +SYSUSB:²37250 +SYSUSE=²37428 +OPRSXB:²37567 +CALSXB:²37622 +UUOSXB:²37693 +NUUOSX=²37781 +DEFINE UUOSAV²37903 +USRUUO:²38669 +ULEAVE:²39457 +UEXIT:²39587 +CLUSAV:²39676 +CLCXSV:²39731 +XUUOH:²39809 +UEXND:²39885 +UUOH0:²39933 +MUUOT1:²39949 +ILLOP1:²40260 +UUOH1:²40361 +UUOTR3:²40581 +URETJ1:²40902 +URET:²41027 +URET2:²41533 +URET1:²41651 +URETC:²41831 +URPCL1:²42021 +UUOTRO:²42184 +USRIOT:²42221 +MUUOTR:²42519 +MUUOT2:²42823 +MUUOEX:²43095 +LUUOEX:²43190 +ILLTRP:²43250 +60H:²43340 +60H0:²43371 +60HE:²43506 +ONEFLS:²43787 +ONEPR2:²43886 +ONEPR1:²43979 +ONEFL2:²44506 +TTYLOS:²45060 +IOADC:²45150 +ABREAK:²45225 +ILLOP4:²45281 +IOCERF:²45334 +ZZ=²45374 +IFG ZZ-9,ZZ=²45395 +IFN 0, IOCER1:²45541 +.ALSO IOCER8:²45612 +IOCERX:²45681 +IOCERR:²45878 +AILUUO:²45918 +ILUUO:²45927 +TRPDEV:²45973 +USRTRP:²46015 +UUOERR:²46069 +IOADCR:²46127 +UUOER2:²46349 +UUOER1:²46621 +ILEXPF:²46713 +IFE KA10P, ILEXPF=²46910 +UUODSP:²47058 +NIOT:²47338 +AIOT:²47655 +AIOT1:²47742 +AIOT3:²48176 +AIOT2:²48252 +AACCES:²48376 +NACCES:²48629 +NACCE1:²48727 +NSIOT:²49230 +NSIOT1:²50036 +NSIOOL:²50232 +NSIOIL:²50790 +NSIOI3:²51237 +NSIOTX:²51316 +NSIOT9:²51353 +AUIOT:²51663 +IOTTYP:²51820 +IOTTY1:²52025 +IOTTY3:²52148 +IOTTY2:²52516 +IOTTYB:²52595 +IOTTYA:²52684 +IFN KS10P, AUIOT=²52784 +AUIOT:²53048 +VARCAL:²53833 +VARCA1:²54088 +VARCA2:²54385 +VARCBL:²54621 +VARCB1:²54815 +VARCA3:²55179 +VARCBE:²55615 +VARCB6:²55706 +VARCB4:²56157 +VARCB2:²56496 +VARCB5:²56891 +VARCBA:²57087 +VARCBB:²57296 +USETBT:²57624 +USETRL:²57759 +DEFINE UENTRY²58220 +USETL:²58466 +MXVAL=²61439 +MXVAL2=²61493 +USETTB:²61651 +USETBN:²62966 +NUSRVA:²64174 +NUSRV0:²64375 +NUSRV5:²64538 +NUSRV3:²64607 +NUSRV1:²65000 +NUSRV2:²65130 +NUSRV4:²65345 +ASUSET:²66097 +AUSET:²66542 +AUSET0:²66663 +ABUSET:²67069 +ABUST2:²67196 +AUSET1:²67359 +APTUAJ:²67524 +AUSETJ:²67580 +AUSVAR:²67662 +PDPPMT:²67814 +AUSET2:²68098 +AUSETX:²68287 +AUSET3:²68331 +AUSET4:²68459 +AUSET5:²69154 +USTOP:²69643 +1USTOP:²69849 +1USTRT:²69881 +UPCSET:²70058 +UJPCS:²70379 +UJPCR:²70513 +UROPC:²70656 +IFE KA10P, UROPC:²70741 +STVCRG:²70882 +URMAR:²71316 +USMAR:²71448 +MARPTB:²71884 +URMAR:²72480 +USMAR:²72488 +RUSUPP:²72522 +UINDEX:²72609 +UTRNTR:²72699 +UTRNT1:²73147 +USTTY:²73318 +URTTY:²73756 +URCNSL:²73922 +UJNAME:²74030 +UJNAMU:²74358 +UJNAM1:²74412 +UJNAMF:²74481 +UJNAMG:²74549 +UUNAME:²74666 +UJNAMS:²74761 +UUNAM0:²75181 +UUNAM1:²75440 +UUNAM2:²75838 +UUNAM3:²76000 +SGWAIT:²76399 +RUTRAP:²76717 +SUTRAP:²76800 +URTR1I:²76892 +URTR2I:²76958 +USMEMT:²77037 +USMEM2:²77137 +USYNST:²77384 +USMASK:²77469 +IAMASK:²77497 +TRINST:²78100 +UPISET:²78585 +UPISE1:²78787 +IAMSK2:²78952 +IADF1:²78979 +IADF2:²79004 +IAPIRQ:²79058 +IAIFPI:²79086 +IAINS:²79183 +USMSK2:²79252 +USDF1:²79296 +USDF2:²79321 +USPIRQ:²79348 +USIFPI:²79376 +RUBCHN:²79492 +SUBCHN:²79537 +UGSUPR:²79596 +MPVMAS:²79728 +MPVARD:²79932 +URSERV:²80025 +USSERV:²80269 +AHANG:²82408 +AHANG2:²82809 +AHANG9:²83766 +AHANG1:²83861 +AHANGC:²84040 +AHANG3:²84411 +AHANGO:²84556 +AHANGJ:²84584 +AHANGF:²84677 +AHANGI:²84792 +AHANG5:²84967 +AHANGT:²85047 +AHANGA:²85325 +AHANG4:²85510 +AHANGB:²85699 +AHANGM:²85759 +AHANG6:²86021 +AHANGX:²86044 +AHANGY:²86301 +UHANG:²86497 +AHANGG:²86936 +OPBRK:²87151 +AFDELE:²87341 +AOPEN:²87796 +AFDEL1:²88077 +NOPNE:²88400 +NOPNE1:²89419 +AOPEN3:²89542 +OPEN2:²89916 +OPEN21:²89976 +OPEN2B:²90281 +OPEN2D:²91153 +OPEN1:²91388 +OPEN1A:²91474 +OPENA1:²91665 +OPENZ1:²91873 +OPENZ2:²92303 +OPEN22:²92608 +OPEN1B:²93005 +OPEN1C:²93278 +NSOPEN:²93394 +FNPRS:²94221 +FNPRS8:²94622 +FNPRS7:²94646 +FNPRS9:²95085 +FNPRS0:²95262 +FNPRS1:²95328 +FNPRS2:²95373 +FNPRS4:²95714 +FNPRS6:²95752 +FNPRS5:²96024 +FNPRS3:²96299 +NOPEN:²96626 +NDEL1:²97176 +NRN2:²97198 +NOPENX:²97222 +NOPEN1:²97432 +NMLINK:²97688 +NDEL:²97939 +NRNAM:²98220 +2FNPRS:²98715 +NRNWO:²99191 +OPNL10:²99762 +OPNL20:²99827 +OPNL30:²99892 +OPNL40:²99957 +OPNL50:³00022 +OPNL60:³00087 +OPNL70:³00152 +OPENL:³00315 +NRFNAM:³01307 +NRFNS1:³02509 +NRFNS2:³02918 +NRFNSB:³03337 +NRFNM1:³03758 +NRFNM2:³03844 +NRFPNT:³04705 +NRCHST:³05339 +ARCHST:³06395 +ASTATUS:³07049 +ASTAT1:³07099 +NSTATUS:³07336 +NWHYINT:³08042 +RCHUSR:³08345 +RCHUTP:³08453 +RCHUTI:³08766 +RCHTTY:³09023 +RCHST1:³09200 +RCHSTY:³09356 +RCHDRH:³09854 +RCHDIR:³10073 +RCHDRD:³10627 +RCHDR1:³10748 +RCHDR2:³10870 +RCHCLO:³11068 +RCHQSK:³11222 +RCHBOJ:³11648 +RFNJOB:³11886 +RFNJ1:³12175 +RFNJ2:³12627 +RFNJ4:³12824 +RFNJ5:³13096 +RFNJ3:³13200 +RFNJ6:³13496 +RFPUSR:³13552 +RFPQSK:³13687 +RFPQS1:³13890 +RFPQS2:³14213 +NRESET:³14467 +ARESET:³14496 +AIOPP1:³14602 +NIOPUS:³14935 +AIOPUSH:³14953 +NIOPOP:³15499 +AIOPOP:³15516 +AIOPDL:³15961 +IIOPPR:³16207 +NFORCE:³16619 +NFINI1:³16679 +NFINIS:³17140 +ANETS:³17297 +The tables use several different indices, which are:³17590 +%CLS=³19493 +%CLSU=³19511 +%CLSDO=³19550 +%CLSJI=³19582 +%CLSDI=³19609 +%CLSTI=³19639 +%CLSCL=³19665 +%CLSBJ=³19698 +%CLSQO=³19724 +%CLSFU=³19751 +%CLSNRM=³19784 +%CLSQ=³19906 +%CLS6=³19924 +%CLSJO=³19943 +%CLSST=³19967 +%CLST=³19990 +%CLSJ=³20016 +%CL1QO=³20071 +CLSTB:³20121 +TYIDN:³20156 +TYODN:³20197 +NLIDN:³20231 +UWIDN:³20265 +FUWIDN:³20307 +DNDIRH:³20356 +DNTRAP:³20385 +DNLCK:³20416 +IFN CHAOSP,CHAIDN:³20454 +DNUACII:³20508 +IFN OLPTP,LPTDN:³20591 +NLPTDN:³20637 +IFN GLPTP,GLPTDN:³20685 +DIRCHN:³20714 +IFN VIDP,NVIDOP:³20770 +IFN PLTP,PLTDN:³20813 +PTPI:³20867 +IFN IMXP,IMPXDN:³20935 +IFN OMXP,OMPXDN:³20977 +DCLUAI:³21010 +REDUAI:³21145 +DN340B:³21208 +CODDN:³21274 +DQUAI:³21316 +IFN VIDP,DNVDIU:³21454 +IFN PDP6P,PDPUIO:³21497 +IFN TABP,DTABUI:³21560 +MTUAIX:³21616 +JDUAI:³21678 +BDUAI:³21759 +IIOPOP:³21800 +ISPY:³21853 +STYDUI:³21879 +IFN NCPP,NETDUI:³21972 +IFN TCPP,TCPDUI:³22023 +IFN INETP,IPQDN:³22075 +IFN MSPP,MSPIO:³22120 +IFN STKP,STKDP:³22168 +IFN NTYP,NTYIT:³22215 +%IOT=³22419 +%IOTBK=³22438 +%IOTOT=³22485 +%IOTBP=³22540 +%IOTSP=³22650 +%IOT10=³22804 +%IOTIM=³22876 +%IOTOM=³23085 +%IOTBO=³23118 +%IOTBI=³23149 +%IOTUO=³23179 +%IOTUI=³23209 +IOTTB:³23239 +TYIDN:³23271 +TYIBN:³23322 +TYODN:³23346 +TYOBN:³23377 +NLIDN:³23418 +NLBIDN:³23442 +NLODN:³23465 +NLBDN:³23489 +UWIDN:³23514 +UBIDN:³23545 +UWODN:³23567 +UBODN:³23598 +FUWIDN:³23621 +FUBIDN:³23652 +DNDIRH:³23683 +DNTRAP:³23708 +DNLCK:³23724 +CHAIDN:³23764 +CHAODN:³23795 +DNUACII:³23851 +DNUACCO:³23877 +DNUBKI:³23902 +DNUBKO:³23926 +DNUDTI:³23950 +DNUDTO:³23984 +LPTDN:³24033 +LPTBN:³24058 +NLPTDN:³24099 +NLPTBN:³24123 +GLPTDN:³24164 +GLPTBN:³24198 +DIRCHN:³24226 +DIRBN:³24249 +NDATAI:³24273 +NBLKI:³24313 +NVIDOP:³24359 +BNVIDO:³24393 +PLTDN:³24432 +PLTBN:³24455 +PTPI:³24493 +PTPA:³24525 +PTPB:³24549 +PTPWA:³24574 +PTPWB:³24608 +IMPXDN:³24658 +IMXDN:³24690 +BIMXDN:³24725 +BIMPXD:³24759 +OMPXDN:³24808 +OMXDN:³24840 +BOMXDN:³24874 +BOMPXD:³24908 +DCLUAI:³24945 +DCLUAO:³24969 +DCLBI:³24992 +DCLBO:³25015 +DCLUBI:³25039 +DCLUBO:³25072 +REDUAI:³25117 +REDBAI:³25142 +REDUII:³25167 +REDBII:³25201 +REDUTI:³25235 +DN340B:³25284 +DN340W:³25360 +DN340C:³25392 +DN340H:³25424 +DN340L:³25489 +CODDN:³25536 +CODBN:³25559 +DQUAI:³25586 +DQUAO:³25618 +DQBI:³25649 +DQBO:³25670 +DQUII:³25692 +DQUIO:³25731 +DNVDIU:³25783 +DNVDIB:³25817 +DNVDOU:³25851 +DNVDOB:³25885 +PDPUIO:³25935 +PDPBIO:³25994 +PDPUII:³26016 +PDPBII:³26038 +DTABUI:³26075 +DTABBI:³26099 +MTUAIX:³26139 +MTUIIX:³26181 +MTBIX:³26220 +MTUAOX:³26244 +MTUIOX:³26277 +MTBOX:³26316 +JDUAI:³26342 +JDUAO:³26373 +JDBI:³26403 +JDBO:³26425 +JDUII:³26448 +JDUIO:³26487 +BDUAI:³26526 +BDUAO:³26549 +BDBI:³26571 +BDBO:³26593 +BDUII:³26616 +BDUIO:³26648 +IIOPOP:³26681 +ISPY:³26732 +STYDUI:³26756 +STYDUO:³26792 +STYDBI:³26816 +STYDBO:³26840 +NETDUI:³26876 +NETDUO:³26899 +NETDBI:³26931 +NETDBO:³26955 +TCPDUI:³26994 +TCPDUO:³27026 +TCPDBI:³27058 +TCPDBO:³27082 +IPQDN:³27121 +MSPIO:³27186 +STKDP:³27218 +NTYIT:³27248 +NTYOT:³27310 +NTYBIT:³27335 +NTYBOT:³27359 +LIOTTB=³27397 +DSTSTB:³27827 +IFN NMTCS, %%MT:³28525 +IFN NUNITS,%%UTP:³28561 +IFN OLPTP, %%OLP:³28595 +IFN NCPP, %%NET:³28630 +IFN TCPP, %%TCP:³28665 +IFN INETP, %%IPQ:³28700 +IFN CHAOSP,%%CHA:³28735 +DRFNTB:³28872 +IFN NMTCS, %%MT:³29544 +IFN NUNITS,%%UTP:³29580 +IFN OLPTP, %%OLP:³29615 +IFN NCPP, %%NET:³29649 +IFN TCPP, %%TCP:³29684 +IFN INETP, %%IPQ:³29719 +IFN CHAOSP,%%CHA:³29754 +DEFINE XX³29864 +IFNB DN, DN=³29905 +IFG SIXBIT/DEVNAM/, ZZ=³29985 +IFE SIXBIT/DEVNAM/&777777, ZZ=³30071 +.ELSE ZZ=³30099 +DCHSTB:³30171 +DCHSTE=³32354 +RSTB1:³32686 +IFN OLPTP, %%LPT:³33124 +IFN NLPTP, %%NLP:³33157 +IFN PLTP, %%PLT:³33191 +IFN PTRP, %%PTR:³33224 +IFN PTRP, %%PTP:³33257 +IFN IMXP, %%IMX:³33291 +IFN 340P, %%340:³33325 +IFN CODP, %%COD:³33359 +IFN PDP6P, %%PDP:³33393 +IFN TABP, %%TAB:³33428 +IFN NCPP, %%NET:³33462 +IFN TCPP, %%TCP:³33496 +IFN INETP, %%IPQ:³33531 +IFN STKP, %%STK:³33566 +IFN CHAOSP,%%CHA:³33599 +DFRCTB:³33709 +IFN OLPTP, %%LPT:³34189 +IFN NLPTP, %%NLP:³34243 +IFN PLTP, %%PLT:³34297 +IFN PTRP, %%PTR:³34351 +IFN PTRP, %%PTP:³34386 +IFN IMXP, %%IMX:³34420 +IFN 340P, %%340:³34455 +IFN CODP, %%COD:³34490 +IFN PDP6P, %%PDP:³34524 +IFN TABP, %%TAB:³34559 +IFN NCPP, %%NET:³34594 +IFN TCPP, %%TCP:³34629 +IFN INETP, %%IPQ:³34664 +IFN STKP, %%STK:³34699 +IFN CHAOSP,%%CHA:³34734 +RSTB:³35009 +DEFINE DVHR³36334 +DEFINE DV³36363 +DVHR [DEFINE DVHR³36418 +%DV=³36774 +DEVTAB:³36813 +NDEVS=³39103 +DVT1:³39121 +IFN NUNITS, DV UT,UTO,%DVIN+%DVOUT+%DVDIR+%DVDEL,DVAUT:³39278 +NDV1=³39684 +EDEVS=³39699 +DEVADR:³39737 +AOPER:³39825 +OPRDSP:³40061 +ACALL:³40139 +CALDIS:³40255 +ASHUTD:³40490 +ADIETI:³41343 +AREVIV:³41498 +DEATHZ:³41695 +ASSTAT:³41841 +ASSTT1:³42224 +SYSCTB:³42419 +LSYSCT=³46965 +ZZ=³46982 +ZZ2=³47008 +SYSCTD:³47511 +ASYSC:³50191 +SYSCPT:³50638 +SYSCP2:³50730 +SYSCP3:³50856 +ASYSC1:³50897 +NCALL:³51186 +ASCRCH:³51516 +CHNDCD:³51885 +AIOCAL:³52517 +AIOCA1:³52964 +ASCGRG:³53430 +NCALL3:³53666 +ASYSC2:³53723 +ASYSC7:³54061 +ASYSC5:³54113 +ASYSC4:³54272 +NCALL2:³54404 +ASYSC3:³54501 +ASYSC9:³54651 +ASYSC8:³54693 +ASCIND:³55050 +ASCIN1:³55079 +TPFLT:³55359 +PDUMP:³56035 +PDUMA:³56503 +PDUMP9:³56776 +PDUMP4:³57075 +PDUMP5:³57812 +PDUMP8:³57874 +PDUMP3:³57976 +PDUMP6:³58472 +PDBWG:³58688 +PUPLC:³59058 +PDUMDC:³59283 +NLOAD:³60005 +NLOAD6:³60220 +NLOADA:³60962 +NLOADE:³61037 +NLOADD:³61680 +NLOADB:³62105 +NLOADC:³62144 +NLOADH:³62720 +NLOAD0:³63109 +NLD16:³63559 +NLOAD1:³63936 +NLOAD5:³64669 +NLOAD2:³64792 +NLD14:³64913 +NLOAD3:³65615 +NLD11:³66659 +NLOAD9:³66688 +NLD10:³66806 +NLD13:³66823 +NLD15:³66905 +NLOAD4:³66969 +NLOAD8:³67352 +NLOADZ:³67390 +POPSM2:³67500 +QTAOS1:³67603 +NLUPCL:³67787 +NLDSBB:³67911 +NLDSBH:³68163 +NLDSB:³68201 +NLDSB1:³68500 +NLDSBD:³68581 +NLDSBK:³68824 +NLDSBE:³68867 +NLDSB3:³69616 +NLDSBF:³69700 +NLDSB7:³70144 +NLDSB4:³70293 +NLDSBM:³71024 +NLDSB5:³71097 +NLDSBQ:³71189 +NLDSBC:³71232 +NLDSB6:³71587 +NLDSB8:³71735 +NLDSB9:³71880 +NLSBP1:³71941 +NLSBPL:³71994 +AGUN:³72149 +ALOGOU:³72345 +ALOGO6:³72904 +ALOGO4:³73537 +ALOGO7:³74232 +ALOGO5:³74337 +ALOGO1:³74503 +AUCL3:³75088 +AREALT:³76438 +AREAL1:³76589 +AREAL2:³76794 +AREAL4:³76886 +AREAL7:³77207 +AREAL5:³77241 +AREAL6:³77264 +UREALB:³77406 +URLTB1:³77489 +URLTBX:³77603 +URLTB2:³77694 +URLTB4:³77820 +CCLOSE:³78082 +NCLOSE:³78273 +ACLOSE:³78290 +STDCLX:³78580 +STDCLS:³78688 +AVALRET:³78929 +AUTRAN:³79010 +UTRNL:³79119 +RPCCK:³79348 +ALOSE:³79915 +NLOSE:³79985 +AUCLOSE:³80409 +AUCL4:³80895 +AUCL2:³80966 +AUCL1:³81395 +NDISMIS:³81992 +NDISM2:³82625 +NDISM3:³83035 +NDISMP:³83169 +ADISMIS:³83295 +NDISM1:³83324 +APISE1:³83627 +ADISM7:³84233 +APISE6:³84292 +APISE7:³84557 +APISE0:³84633 +APISE9:³84703 +APISE4:³85228 +APISE2:³85359 +APISE3:³85463 +APISE8:³85713 +ASLEEP:³86002 +ASLP1:³86212 +ASLP2:³86483 +NRELOAD:³86787 +AMASTER:³87073 +AMAST1:³87163 +AMAST2:³87205 +AMAST3:³87281 +NSSERVER:³87672 +NSSRV1:³87883 +NLOGIN:³88622 +ALOG2:³88908 +ALOG3:³89084 +ALOG4:³89240 +ASETM2:³89928 +ASETMSK:³89980 +ARSYSI:³90095 +ARDTIME:³90131 +ARDSW:³90229 +IFN KS10P, ARDSW=³90295 +ASUPSET:³90314 +NDETAC:³91000 +NDETA0:³91390 +NDETA7:³91692 +NDETA1:³91848 +NDETAA:³93388 +NDETA5:³93771 +NDETA2:³94128 +NDETA3:³94265 +NDETA8:³94458 +NATTAC:³95047 +NATTAN:³95222 +NATTA6:³95350 +NATTA5:³95551 +NATTA7:³95686 +NATTAM:³95887 +NATTAL:³96159 +NATTAG:³96463 +NATTA4:³96625 +NATTA8:³96957 +NATTAF:³97329 +NATTA9:³97457 +NATTAH:³98116 +NATTAI:³99060 +NATTAD:³99558 +NATTAE:³99785 +NATTAP:´00209 +NDISOWN:´00913 +ADISOWN:´01483 +NDISO1:´01679 +ADISO1:´01918 +NATTA1:´02243 +DSWNTY:´02559 +NATTA2:´02636 +NDETA9:´02684 +DSWNTZ:´03088 +CHSCAA:´03776 +CHSCAN:´03803 +CHSCA2:´03823 +CHSCA4:´03885 +IFPHAK:´04233 +IFPLUP:´04381 +IFPLU5:´04436 +IFPLU2:´04594 +IFPLU3:´04678 +IFPLU4:´04958 +IFSTOP:´05033 +IFSTP1:´05187 +UBLAM:´05524 +UBLAST:´05617 +UBLST2:´05662 +UBLST4:´05881 +AEOFC:´06186 +AIOTLS:´06431 +AIOTL1:´06594 +AIOTL2:´06867 +TRAN:´07096 +TRAN6:´07138 +TRAN0:´07446 +TRAN1:´07526 +TRAN2:´07618 +TRAN3:´07723 +TRAN4:´08468 +TRAN5:´08509 +TRANX3:´08654 +TRANX2:´08690 +TRANRF:´08754 +NTRNS:´08988 +DEFARG:´09201 +NTRNUI:´09640 +NTRNU1:´09908 +NTRNGA:´10118 +NTRNG0:´10171 +NTRNG2:´10305 +NTRNG3:´10464 +NTRNEX:´10876 +NTRNE1:´11224 +NTRNE2:´11353 +NTRNE8:´11578 +NTRNE9:´11670 +NTRNDL:´12039 +NTRND:´12092 +NTRNDA:´12221 +NTRND2:´12357 +NTRND0:´12399 +NTRNDX:´13201 +NTRNAD:´13468 +NTRNA:´13489 +NTRNCL:´14457 +NTRNCA:´14610 +NTRNC:´14659 +NTRNC4:´14709 +NTRNC0:´14950 +NTRNC1:´15094 +NTRNC2:´15136 +NTRNC3:´15296 +ATRANA:´15410 +ATRNDL:´15529 +ATRAND:´15538 +ATRND0:´15694 +ATRNDT:´15840 +ATRND2:´16338 +ATRND1:´16426 +ATRND3:´16714 +JBMN=´16864 +JBCUI:´16915 +JBCG:´16998 +JBWST:´17042 +%JB=´17119 +%JBWIN=´17138 +%JBREU=´17203 +%JBVAL=´17274 +%JBSTR=´17341 +%JBUNH=´17409 +%JBSIO=´17452 +%JBLOS=´17526 +JBDEV:´17640 +JBFN1:´17719 +JBFN2:´17743 +JBSYS:´17767 +JBOPNM:´17796 +JBFNP:´17826 +JBCJUI:´17913 +JBSTS:´18105 +JBST2:´18543 +JBOFN1:´18712 +JBOFN2:´18755 +JBOSYN:´18786 +JBODEV:´18817 +JBNFN2:´18847 +JBAC7:´18886 +JBAC10:´18946 +JBAC11:´19034 +JBACTB:´19123 +JBIOCJ:´19277 +JBSW:´19369 +BOJO:´19525 +JOBO:´20274 +JOBO3:´20346 +JOBO2:´20455 +JOBO5:´20692 +JOBORU:´21862 +JOBOR1:´22245 +JOBO4:´22422 +JOBO6:´22478 +JOBO6B:´23777 +JOBO6C:´23993 +JOBO7:´24111 +JOBO9:´24651 +JOBO8:´24696 +JOBOPL:´24997 +JFDEL4:´25142 +JFDEL5:´25384 +JBINT:´25790 +JBINT1:´25868 +JBINT2:´25919 +JBSTCD:´26125 +JBWT1:´26450 +JBWT:´26513 +JBWTI:´26593 +JBWT2:´26733 +JBFLS:´26877 +JBPCL:´27051 +JBPCL1:´27319 +JBBI:´27652 +JBUI:´28023 +JBIOT1:´28130 +JBSI:´28475 +JBSI1:´28843 +JBIPG:´28872 +JBIPG1:´29023 +BJWAIT:´29324 +BJUO:´29867 +BJUO1:´30147 +BJIUNH:´30311 +BJUOS:´30659 +BJBINI:´30790 +BJUOB:´30936 +BJUOBA:´31175 +BJIUNP:´31474 +BJBO:´31553 +BJBO1:´32090 +BJBEX:´32209 +BJBOA:´32492 +BJBWT:´32719 +BJBWT1:´32984 +BJUI:´33129 +BJUI1:´33367 +BJUIS:´33574 +BJUIB:´33740 +BJUIBA:´33972 +BJBI:´34287 +BJBIA:´34989 +BJBIX:´35205 +BJOV:´35275 +BJBB:´35334 +BJBBL:´35415 +BJBB3A:´36316 +BJBB2:´36967 +BJBBF:´37336 +BJBB1:´37477 +BJBB3C:´37548 +BJBB2A:´37607 +BJBB1A:´37700 +BJBB3:´37787 +BJBB3B:´38063 +%JG=´38329 +%JGCLS=´38477 +%JGSIO=´38544 +%JGFPD=´38592 +%JO=´38681 +%JOOPN=´38695 +%JOIOT=´38712 +%JOLNK=´38733 +%JORST=´38751 +%JORCH=´38769 +%JOACC=´38787 +%JORNM=´38806 +%JORWO=´38843 +%JOCAL=´38881 +NJBGT:´39174 +NJBCL0:´39221 +NJBGT0:´39702 +NJBGTE:´39854 +NJBCL:´40722 +NJBCL1:´40913 +NJBCL2:´41492 +NJBCL3:´41730 +NJBRT:´42167 +NJBRT1:´42667 +NJBRT2:´43361 +NJBRT3:´43495 +JOBCLS:´43581 +RFPJOB:´43770 +JBSTAT:´44353 +JBORS:´44441 +JBIRS:´44449 +JBACCS:´44603 +NSTIOC:´45002 +NJBSTS:´45898 +NJBST1:´46371 +NJBST2:´46511 +NJBINT:´46817 +NJBREU:´47733 +NJBRU1:´48230 +NJBRUW:´48568 +NJBRUL:´48696 +IFE DEMON,ADEMON=´49259 +ADEMON:´49289 +UTOLJ1:´49601 +UTOLKJ:´49618 +ADEMSIG:´49658 +ADEMS1:´50025 +ADEMS3:´50199 +NUDMTB:´50410 +DMBLK1:´50631 +DEMSIG:´50840 +DEMSG1:´50917 +DEMSG2:´51194 +DEMUSR:´51636 +DEMNAM:´51759 +DEMOUT:´51880 +DEMMRV:´52115 +ARDDMST:´52361 +RDDMS2:´52539 +RDDMS1:´52620 +LKUPOP:´52733 +ASTDMST:´52767 +STDMS2:´52867 +STDMS3:´52891 +STDMS1:´52976 +STDMS4:´53064 +UTULKP:´53299 +AGETSYS:´53488 +AGETS1:´53954 +agets2:´54437 +AGETS7:´54827 +AGETS4:´55009 +AGETSL:´55028 +AGETS5:´55091 +AGETS6:´55266 +GSNAME:´55556 +NUTCFN=´55671 +LGSNAM=´56005 +GSYS1:´56100 +ITSNMS:´56754 +LITSNM=´56791 +USRSV:´56849 +USR1V:´56921 +USR1VL:´57049 +DSYMS:´57094 +AGETLOC:´57289 +ASETLOC:´57548 +AIFSET:´57755 +ASPST2:´58281 +ASPST1:´58341 +ASPST4:´58586 +CSPST:´58889 +ASPST3:´58951 +AEVAL:´59526 +AREDEF:´60046 +ARDF2:´60482 +ARDF3:´61070 +ARDF4:´61348 +SBUBL:´61596 +SBUBL0:´61678 +SBUBL1:´61913 +SBUBL2:´62138 +SYMLK:´62371 +SYMLK2:´62471 +SYMLK3:´62632 +AWSNAME:´62886 +AUPISET:´62959 +AGENSYM:´63140 +AGENNUM:´63434 +GENSSW:´63518 +IGNSYM:´63534 +IGNNUM:´63558 +SIXAOS:´63579 +SIXAS2:´63685 +KLPERF:´64547 +KLPER0:´64588 +KLPER1:´64704 +KLPER2:´64901 +KLPER4:´65302 +KLPER3:´65384 +PRFOFF:´65692 +NULO:´66148 +NULI:´66313 +NULBI:´66361 +NULBOD:´66447 +STDSTA:´66692 +UBPFJ=´66885 +USROJ:´66952 +USRO:´67006 +USROOJ:´67060 +USROA:´67606 +USROB:´67654 +USRO3:´67671 +AGIN:´67764 +TCORS:´67967 +ULUP1:´69047 +ULUP:´69065 +ULUP2:´69241 +UFIN:´69340 +UFIN2:´69374 +NOGO1:´69461 +NOGO4:´69632 +TCORS1:´69669 +TCORS2:´70088 +USRO4:´70169 +UFN1:´70541 +UFN1C:´71531 +NREOWN:´71674 +UFN2B:´72153 +UFN2A:´73107 +UFN3:´73143 +UFNL3:´73424 +UFNL1:´73503 +UFNL2:´73688 +UFN4:´73813 +UFN5:´74028 +UFNX:´74341 +UFN6:´74504 +UFN7:´74576 +UFN3ZZ:´74786 +UFOUND:´74981 +UFNDF:´75148 +USRST:´75315 +USRST1:´75689 +USRST5:´76116 +NUSRMEM:´77286 +NUSRM1:´77627 +NUSRMS:´77988 +NUSRM2:´78135 +NUSRM6:´78926 +NUSRM4:´79060 +NUSRM5:´79273 +NUSRM3:´79600 +NUSRM8:´79687 +NUSRM9:´79757 +UBO:´80104 +UBI:´80134 +UBIL:´80165 +UBIB:´80244 +UBI5:´80733 +UBI3B:´81128 +UBI3H:´81643 +UBI3K:´81688 +UBI3L:´81782 +UBI3E:´81967 +UBID:´82120 +UBI3C:´82378 +UBI4:´82430 +UBMCK1:´82572 +UBIA:´82607 +UBIC:´82663 +UBI5A:´82719 +UWO:´82768 +UWI:´82825 +UWI1:´83100 +UBI3A:´83330 +USUSTP:´83629 +SUSTPR:´83650 +UBI3:´83840 +UBI3D:´83956 +UBI3G:´84026 +UBO3:´84104 +UBO3A:´84254 +CLVBEG:´84484 +CLSYN:´84498 +CLN1:´84549 +CLN2:´84573 +CLUSR:´84598 +CLRAC:´84680 +CLOSW:´84914 +CLVEND=´85025 +CLBVSP=´85087 +CLBCHS=´85098 +CLBEOF=´85112 +CLAO:´85468 +CLIO:´85526 +CLUO:´85610 +CLOO:´85637 +CLI2:´85666 +CLFDEL:´85788 +CLO1:´85805 +CLOO5B:´85946 +CLO1A1:´86077 +CLOL:´86108 +CLO1A6:´86353 +CLOX:´86503 +CLOX1:´87195 +CLOO1:´87595 +CLOO3:´87726 +CLOOT1:´87858 +CLOO2:´87920 +CLOO4:´88465 +CLOO5:´88612 +CLOO5A:´88702 +CLOO6:´89014 +CLO1D:´89126 +CLO1A:´89408 +CLIOTB:´89502 +CLUAI:´89770 +CLUAI1:´89911 +CLUAIE:´89973 +CLFAXP:´90041 +UNIEOF:´90330 +CLFAX2:´90368 +CLFBX2:´90468 +CLUAO:´90766 +CLCWU2:´91180 +CLBI:´91305 +CLUBI:´91391 +CLUBI1:´91546 +CLUBIE:´91622 +CLCRB2:´91653 +CLFBXP:´91778 +CLUBIF:´91801 +CLUBO:´92027 +CLOXO:´92152 +CLCWB2:´92419 +CLBO:´92569 +CLBI2:´92725 +CLBI3:´92866 +CLCLWB:´92981 +CLCWU6:´93176 +CLCLWU:´93365 +CLCWC:´93743 +CLO1D2:´94074 +CLISTA:´94221 +CLCLRA:´94388 +CLCLRB:´94418 +CLCLRL:´94533 +CLCLR2:´94672 +CLCLR1:´94866 +CLCLR3:´95002 +NLCKCH=´95200 +LCKNAM:´95244 +LCKUSR:´95352 +LCKSW:´95445 +LCKO1:´95866 +LCKO:´96051 +LCKRCH:´96558 +LCKCL:´96624 +STDOP1:´96717 +STDOPN:´96765 +OPSLD1:´97197 +OPSLD3:´97248 +OPSLC3:´97314 +OPSLC7:´97370 +OPNSLT:´97486 +NBTOCH:´97738 +NBTO1:´97987 +BTOCHT:´98370 +INBTCH:´98697 +INBTO1:´98850 +INBTO3:´99265 +INBTO2:´99608 +WRDBT:´99906 +WRDBT2:µ00000 +WRDBT3:µ00023 +WRDBRT:µ00056 +WRDBT5:µ00231 +WRDBTI:µ00411 +WRDBT4:µ00522 +SIOKT:µ02403 +SIOKNB:µ02476 +SIOKN1:µ02706 +SIOKF:µ02842 +SIOKF1:µ02866 +SIOKT1:µ03025 +SIOKN7:µ03968 +SIOKN8:µ04042 +SIOKN3:µ04330 +SIOKW1:µ04460 +SIOKN6:µ04500 +SIOKSL:µ04763 +SIOKS1:µ04961 +SIOKS3:µ05254 +SIOKSI:µ05582 +SIOKS2:µ05658 +SIOBGX:µ06123 +SIOBG1:µ06144 +SIOBG2:µ06162 +CHRKT:µ06500 +CHRKTI:µ06569 +CHRKTO:µ06698 +CHRKT1:µ07036 +CHRKN1:µ07301 +CHRKF1:µ07419 +BLKT:µ08591 +BLKTNB:µ08810 +BLKTN1:µ09037 +BLKTF:µ09173 +BLKTF1:µ09197 +BLKT1:µ09326 +BLKTN7:µ10117 +BLKTN8:µ10191 +BLKTN4:µ10482 +BLKTN3:µ10736 +BLKTW1:µ10799 +BLKTN6:µ10839 +BLKTN9:µ10922 +QMLSTF:µ11022 +QLISTF:µ11093 +LISTF7:µ11143 +LISTFE:µ11162 +UD1:µ11249 +UD2:µ11384 +UDIF1:µ11777 +UDIF:µ11846 +UQL1:µ11964 +UQL1A:µ12067 +UQL1B:µ12190 +UQL1W:µ12717 +UDT:µ12823 +UDTLN=µ13030 +QUDBIN:µ13047 +UDBIN:µ13088 +UTDCLS:µ13239 +UTDCLX:µ13290 +UTDCL1:µ13326 +DIRCH:µ13475 +DIRB:µ13626 +DIRB1:µ13677 +DDATAI:µ14099 +DBLKI:µ14164 +ERRO:µ14485 +ERR2:µ14518 +ERR21:µ14706 +ERR22:µ14729 +ERR24:µ14780 +ERR23:µ14797 +CORO:µ14837 +ERR1:µ14901 +ERR1B:µ15073 +ERR1C:µ15176 +ERR3:µ15354 +ERMST1:µ15568 +NERMES=µ18010 +ERMST2:µ18069 +ERMST3:µ18331 +NERM1=µ18850 +UQL3C:µ18946 +UQL3:µ18966 +UQL2:µ19015 +UQL2A:µ19232 +UQL3A:µ19499 +UQL4:µ19607 +UQLP:µ19678 +UQLL2:µ20002 +UQL5:µ20507 +UQLL1:µ20661 +QLL1:µ20710 +QLL3:µ20774 +QLLIST:µ20807 +QLL5A:µ20910 +QLL2:µ20984 +QLL4:µ21046 +QLL5:µ21106 +UQL5R:µ21159 +UQL5B:µ21325 +UQL5A:µ21528 +UQL5D:µ22344 +UQL5C:µ22401 +QMLS1:µ22473 +QMLS2:µ22583 +QMLS3:µ22678 +LISTF:µ22771 +LISTF1:µ22881 +LISTF4:µ22966 +LISTF8:µ23042 +LISTD2:µ23157 +LISTF2:µ23194 +LISTF6:µ23274 +LISTD4:µ23373 +LISTF3:µ23395 +UCL7:µ23437 +IFN NUNITS, LISTF5:µ23550 +NDLF:µ23636 +UCL1:µ23746 +UCL6:µ23768 +UCL3:µ24040 +UCL5:µ24221 +UCL5A:µ24242 +UCL4:µ24276 +UCL2:µ24307 +SIXTYC:µ24357 +TTYFLD:µ24472 +TTYF1:µ24567 +TTYF11:µ24756 +TTYF3:µ24963 +TTYF4:µ25039 +TTYF5:µ25262 +TTYF99:µ25285 +SIXTYB:µ25487 +SIXTYA:µ25502 +SIXTYP:µ25564 +MESP3S:µ25677 +MESPCR:µ25711 +MESPNT:µ25742 +OUTCS:µ25841 +OUTC:µ25859 +OUTC2:µ25985 +OUTC1:µ26074 +G4SDPT:µ26477 +G4SDP2:µ26721 +G4SDP1:µ26744 +G2OPT:µ26841 +G3DPT:µ26924 +G2DPT:µ27012 +G2DPT2:µ27034 +GDPT:µ27207 +GOPT:µ27302 +GDPT0:µ27319 +GDPT1:µ27369 +DIRCHR:µ27616 +BLKPNA:µ27707 +BLKPNN:µ27758 +BLKPNT:µ27776 +BLKPN2:µ27809 +BLKPN1:µ27853 +BLKPN3:µ27988 +BLKPN4:µ28025 +UDUSR:µ28141 +UDUIND:µ28214 +IRPS X,,DIRPC:µ28297 +DIRPT:µ28303 +NUM:µ28307 +ENDT:µ28312 +SAVB:µ28317 +SAVQ:µ28322 +UDSYSN:µ28329 +UUDPP:µ28335 +SAVE:µ28340 +X:µ28344 +UDCSW:µ28377 +DSKLST:µ28395 +UTCPDP:µ28592 +UTCP:µ28629 +UTACS:µ28649 +UTCBRK:µ28848 +PIPX:µ29081 +UTCB2:µ29475 +UTCBK2:µ30296 +POPRET:µ30379 +DSKEX:µ30435 +IMPEX:µ30443 +MGEX:µ30450 +UTCBRK:µ30534 +IMPEX:µ30889 +MGEX:µ30896 +DSKEX:µ30904 +UTCSAV:µ31255 +CHSPUR:µ31500 +DCHNTB:µ32312 +DEFINE DCHENTµ32503 +DCHNTC:µ35840 +DCACS:µ35859 +CCSDEV:µ35887 +DCHK:µ35936 +CHECK:µ36155 +CHECK1:µ36177 +CHECK2:µ36360 +CHECK3:µ36568 +CHECK5:µ36618 +CHECK4:µ36751 +SPURCX:µ36814 +DCSTUP:µ36974 +DCCONI:µ37061 +CHECKL:µ37211 +DCSAOS:µ37291 +DCSAS1:µ37666 +DCSAS2:µ37858 +SPUR:µ38134 +SPUR1:µ38198 +SPUR2:µ38255 +SPUR4:µ38408 +DEFINE UBINTµ38522 +.VEC.=µ38540 +IFN .VEC.&3, .ERR Bogus interrupt vector:µ38589 +.VEC.=µ38601 +IFG .VEC.-.MAX., .MAX.=µ38658 +UBAQIT:µ38783 +.MIN.=µ38791 +.MAX.=µ38848 +.BAS.=µ38864 +UBAQIB=µ38881 +UBAIIT:µ39009 +.MIN.=µ39017 +.MAX.=µ39074 +.BAS.=µ39090 +UBAIIB=µ39107 +QUBPG=µ40555 +IUTPG=µ40638 +IUIMPG=µ40713 +UBAIFS:µ40783 +UBAASL:µ40895 +UBASL1:µ41049 +UBAFSL:µ41282 +OVHTBL:µ41631 +LOVHTB=µ41685 +OVHSVA:µ41755 +OVHSVB:µ41766 +OVHBRK:µ41777 +OVHBR1:µ41983 +OVHBRX:µ42221 +RDPCST=µ42339 +WRPCST=µ42394 +OVHTB1:µ42468 +LOVHTB=µ42538 +OVHTB2:µ42647 +OVHCNT:µ42718 +LOVHPC=µ42780 +OVHPCS:µ42824 +OVHCLK:µ42916 +OVHCL1:µ43377 +OVHCL8:µ43878 +OVHCL9:µ43925 +PCLTST:µ45048 +PCLX:µ45139 +PCLT1:µ45400 +PCLT3:µ45610 +PCLT2:µ45773 +PCLT5:µ46042 +PCLT4:µ46093 +PCLT6:µ46174 +PCLME:µ46342 +PCLME1:µ46377 +PCLT1A:µ46422 +BUGTAB:µ47476 +LBUGT2=µ47501 +HSYSCD:µ47557 +SCHHP:µ47621 +SCHHB:µ47663 +SWPHTP:µ47924 +SWPHTL=µ47940 +SWPHTB:µ47953 +PGIHTP:µ48219 +PGIHTL=µ48235 +PGIHTB:µ48248 +SCHMNY:µ48461 +SCHBNJ:µ48535 +SCHBTB:µ48582 +SCHBPR:µ48625 +NSCHOV:µ48668 +TRANLK:µ49029 +TRANID:µ49098 +TRANI1:µ49119 +TRANI2:µ49140 +TRANIS:µ49161 +TRANOD:µ49182 +TRANO1:µ49203 +TRANO2:µ49224 +TRANOS:µ49245 +TRANFL:µ49268 +TRNCNT:µ49311 +TRNREF:µ49344 +TRANSW:µ49398 +IFE SCHBLN, U0P:µ49449 +USER:µ49490 +SYSL:µ49525 +LITM:µ49542 +SLGIV:µ49584 +SETSLC:µ49610 +SETSLQ:µ49639 +SETSU:µ49649 +SWUNAM:µ49663 +SWJNAM:µ49695 +SWFN1:µ49705 +SWFN2:µ49715 +SWFN3:µ49725 +SWMOD:µ49735 +DMON:µ49747 +NQMFWR:µ49804 +NXGPFW:µ49891 +IFN TTLPTP,TPLFLG:µ50032 +DMTLL=µ50058 +NODEAM=µ50098 +DMLNG=µ50127 +DEMSW:µ50150 +REQCNT:µ50193 +DMTPTR:µ50236 +DMLSEX:µ50316 +DEMCNT:µ50366 +DMBLK:µ50428 +DMOBLK:µ50482 +DMTTBL:µ51036 +TIMOFF:µ51121 +QDATE:µ51193 +QDATEI:µ51358 +PDYTIM:µ51482 +FYEAR:µ51557 +PDTIME:µ51587 +LPDTIM:µ51801 +SUPCOR:µ51876 +SUPCOP:µ51971 +SCKPHS:µ52059 +SYSITM:µ52155 +LNETIM:µ52211 +RSWTIM:µ52265 +MXPARS=µ52337 +PARPG:µ52378 +PARCNT:µ52449 +PARCON:µ52493 +PARADR:µ52549 +PARAND:µ52606 +PARIOR:µ52641 +PARAAN:µ52675 +PARAOR:µ52709 +PARPFW:µ52756 +PARERA:µ52784 +PARWRD:µ52816 +PARRSN:µ52865 +PARDIE:µ52985 +TPLSWP:µ53022 +PDP6UP:µ53069 +ECCADR:µ53146 +ECCLEN=µ53190 +ECCIDX:µ53233 +TEN11F:µ53287 +T11ERC:µ53405 +T11CCN:µ53450 +T11WCN:µ53479 +T11PG:µ53505 +TVBLAD:µ53550 +DL10F:µ53646 +DL10HC:µ53683 +DLSRCH:µ53775 +CPDLP:µ53874 +LCPDL:µ53917 +CLKBSW:µ53961 +CLROOT:µ54032 +SSLCKB:µ54069 +CHA5CK:µ54165 +15SCLB:µ54320 +PRVCLB:µ54403 +VSLCKB:µ54505 +CLINFB:µ54613 +CCLKB:µ54677 +CCLK1:µ54727 +CCLK2:µ54737 +IINTIC=µ54753 +IINCNT:µ54826 +WHOCLB:µ54932 +UTTYS:µ54982 +UTTYI:µ55038 +UTTYO:µ55052 +UTTYCT:µ55067 +PCLDBM:µ55080 +PCLUSR:µ55206 +PCLL:µ55244 +PCLHSH:µ55286 +PCLNXT:µ55350 +PCLHT:µ55399 +PCLIDX:µ55416 +CORRNR:µ55488 +SJSPG:µ55521 +UTBFLF:µ55604 +UFDFLF:µ55653 +CORCNT:µ55701 +UFLSF:µ55711 +CLKFL1:µ55748 +SCHFLG:µ55797 +27FCLK:µ55841 +SCITM:µ55888 +LCLK1:µ55917 +SYSCKP:µ55928 +SYSPDP:µ55984 +SYSPDL:µ56038 +IFN TPLP,TPLBUF:µ56085 +IFN TPLP\DEMON,TPLFNO:µ56163 +SJCFF:µ56210 +SLSWPR:µ56348 +IFN TPLP, TPLFN:µ56420 +KLEBCC:µ56460 +KLMBCC:µ56591 +MTRUSR:µ57005 +MTRJOB:µ57053 +PAEON:µ57144 +PAEOFF:µ57187 +STPERF:µ57249 +STEBOX:µ57308 +STMBOX:µ57367 +TPLFN1:µ57465 +TPLFN2:µ57476 +TPLFN3:µ57487 +IFN NLPTP, NTNLPL:µ57512 +TSTB:µ57567 +LTSTB=µ57605 +CKSUMS:µ57623 +CKXORS:µ57644 +TCKXOR:µ57731 +SSYSCL=µ57763 +SYSCLB=µ57777 +AC1PTR:µ57831 +USRHI:µ57908 +SYSDBG:µ58001 +DMLLDF:µ58215 +IFN DEMON,DMNFLG:µ58282 +IFN NETP,NETUSW:µ58344 +SYSCN:µ58452 +SUPPLG:µ58575 +MIPGDS:µ58678 +USFHLT:µ58795 +TT11P:µ59126 +ENSWSC:µ59840 +ENUPC:µ59897 +ENPZRO:µ59970 +ENSWBK:µ60038 +ENPVCL:µ60089 +ENPREE:µ60129 +ENAGE:µ60192 +AGERTE:µ60270 +CIRPSW:µ60408 +MEMFRZ:µ60451 +CASW:µ60481 +SHUTLK:µ60554 +TREESW:µ60627 +CUSER:µ60726 +ARDFSW:µ60790 +DISUSR:µ60846 +CODUSR:µ60908 +CODUSE:µ60933 +PLTUSR:µ60962 +PLTUSE:µ60988 +LPTUSR:µ61024 +LPTUSE:µ61055 +OLPUSR:µ61084 +OLPUSE:µ61096 +PTPUSR:µ61370 +PTPUSE:µ61382 +PTRUSR:µ61396 +PTRUSE:µ61408 +NVDUSR:µ61437 +NVDUSE:µ61449 +PDPUSR:µ61479 +PDPUSE:µ61503 +PDPISR:µ61515 +PDPISE:µ61566 +TABUSR:µ61609 +TABUSE:µ61634 +TIME:µ61693 +SUSRS:µ61740 +RVVTIM:µ61772 +USRRCE:µ61840 +SYSRCE:µ61897 +SLOADU:µ61926 +RNABLU:µ61995 +NPGWTU:µ62022 +LOUTIM:µ62078 +UMASTER:µ62127 +SWRCE:µ62160 +SWIPRQ:µ62202 +SHUTDN:µ62239 +DEDTIM:µ62299 +DTHTIM:µ62422 +DEDBLK:µ62451 +ATRNJN:µ62483 +DZXSPR:µ62598 +DZRSPR:µ62658 +NCORRQ:µ62726 +NCBCOM:µ62782 +NQDE:µ62832 +NQHE:µ62877 +NQSE:µ62986 +NQCMPE:µ63047 +NQWDE:µ63101 +NQRDE:µ63141 +NIRSWE:µ63182 +QIRRCV:µ63225 +QIRCBK:µ63263 +QIRUNT:µ63298 +NQWRE:µ63323 +NQWIRE:µ63355 +NWXFR:µ63388 +NRXFR:µ63440 +NSWXFR:µ63464 +NSRXFR:µ63495 +PARERR:µ63560 +NXMERR:µ63602 +IFE KA10P, BPFERR:µ63641 +PARPC:µ63676 +NXMPC:µ63717 +IFE KA10P, BPFPC:µ63751 +PARUSR:µ63783 +NXMUSR:µ63814 +IFE KA10P, BPFUSR:µ63852 +IFE KA10P, BPFPFW:µ63898 +ECCERR:µ63946 +ECCERA:µ63995 +ECCAND:µ64048 +ECCIOR:µ64079 +IFN DPKPP, NDPKPE:µ64136 +SNMPGS:µ64186 +SNSWPG:µ64235 +USRTM1:µ64282 +USRTIM:µ64358 +NULTM1:µ64405 +NULTM3:µ64482 +NULTIM:µ64527 +NULEBC:µ64615 +NULMBC:µ64664 +NULPRF:µ64713 +PFAILF:µ64785 +LOSTM1:µ64909 +LOSTIM:µ64976 +IDLTM1:µ65057 +IDLTIM:µ65125 +LOSRCE:µ65180 +IDLRCE:µ65218 +UREALT:µ65258 +DEFINE KLUPTµ65550 +DEFINE KLUPTµ65705 +USRSTG:µ65889 +UPGMP:µ65923 +UPGCP:µ66346 +UMAPS:µ66656 +UDBR1A=µ66695 +UDBR2A=µ66734 +UPGCPH=µ66774 +TTYTBL:µ66834 +%TBNOT=µ66902 +%TBNVR=µ66945 +%TBINT=µ67010 +%TBWAT=µ67127 +%TBDTY=µ67285 +%TBOUT=µ67385 +%TBINF=µ67455 +%TBOIG=µ67526 +%TBIIN=µ67564 +$TBECL=µ67616 +%TBCLR=µ67731 +TTSTSV:µ67804 +NMPGS:µ67888 +NSWPGS:µ67945 +HUSRAD:µ68031 +UPC:µ68093 +LUBTM:µ68120 +JBI:µ68181 +UPGML:µ68297 +IFE KL10P, UPOPC:µ68468 +IFE KL10P, UPQUAN:µ68912 +IFN KL10P, UPFW:µ68969 +IFE KL10P,DBL=µ69005 +IFN KL10P,DBL=µ69027 +IFE KL10P, UPDBR3:µ69111 +IFE KL10P, UPACP:µ69149 +UPDBR1:µ69226 +UPDBR2:µ69249 +UPQUAN:µ69275 +UPJPC:µ69304 +UPEJPC:µ69354 +UPGMLE:µ69416 +UPT420:µ69497 +TR1INS:µ69555 +TR2INS:µ69661 +TR3INS:µ69785 +SV40:µ69897 +MUUODP:µ69907 +SUUOH:µ69962 +XUUOH:µ69971 +MUUOCX:µ70025 +UPT427:µ70067 +MUUOKN:µ70110 +MUUOKT:µ70171 +MUUOSN:µ70235 +MUUOST:µ70302 +MUUOCN:µ70331 +MUUOCT:µ70368 +MUUOPN:µ70412 +MUUOPT:µ70478 +DEFINE KSUPTµ70599 +UPFW:µ70697 +TR1INS:µ70815 +TR2INS:µ70851 +TR3INS:µ70887 +SV40:µ70921 +MUUODP:µ70931 +SUUOH:µ70957 +XUUOH:µ70966 +MUUOCX:µ70993 +UPT427:µ71017 +MUUOKN:µ71044 +MUUOKT:µ71142 +1PROPC:µ71261 +1PRNPC:µ71318 +MUUOCN:µ71358 +MUUOCT:µ71416 +UUOACS:µ71504 +AC0S:µ71520 +AC15S:µ71552 +AC16S:µ71562 +AC17S:µ71572 +UUO:µ71787 +SUEXIT:µ71890 +SCLUSV:µ71932 +SUUOH:µ71983 +SUEXND:µ72013 +SV40:µ72023 +SCLCXS:µ72093 +SUEXND:µ72140 +CLCX:µ72235 +EBOXCT:µ72347 +MBOXCT:µ72466 +UTIME:µ72573 +UTRNTM:µ72643 +USIPRQ:µ72690 +USWST:µ72722 +%SW=µ72753 +%SWDSO=µ72790 +%SWPGW=µ72860 +%SWBEM=µ72913 +%SWRUN=µ72991 +%SWPCL=µ73120 +%SWINT=µ73248 +%SWPRV=µ73314 +%SWOUT=µ73386 +%SWSB=µ73444 +%SWLOD=µ73489 +UWRKST:µ73618 +USVWRK:µ73799 +USWTIM:µ73851 +USWPRI:µ74032 +USWSCD:µ74964 +LTRNTM:µ75044 +LSIPRQ:µ75084 +UPGSEC:µ75128 +LPRVTM:µ75192 +PAGRAN:µ75234 +PAGAHD:µ75322 +TRUNTM:µ75396 +TSIPRQ:µ75551 +UTMPTR:µ75589 +JTMU:µ75660 +IOCHNM:µ75872 +SIOCHN:µ75985 +SIOCP:µ76046 +IOCHST:µ76094 +CORRQ:µ76209 +APRC:µ76561 +BUMRTL=µ76681 +BUSRCR=µ76818 +BULGO=µ76865 +BCHPTR=µ76945 +BULGOS=µ77025 +DIELOK:µ77245 +USTP:µ77363 +%UST=µ77441 +%USTCM=µ77460 +%USTCJ=µ77528 +%USTSP=µ77575 +%USTCG=µ77612 +BCSTOP=µ77695 +BUCSTP=µ77740 +BUSRC=µ77818 +BSSTP=µ77888 +PIRQC:µ78169 +MSKST:µ78240 +IFPIR:µ78287 +MSKST2:µ78404 +IDF1:µ78433 +IDF2:µ78477 +PICLR:µ78598 +SUPPRO:µ78662 +FLSINS:µ78753 +RPCL:µ78917 +UNAME:µ78982 +JNAME:µ79249 +USYSNM:µ79494 +USYSN1:µ79818 +HSNAME:µ79889 +IOTLSR:µ79914 +UMARPC:µ80076 +LSWPR:µ80107 +UCLBLK:µ80141 +URTIME:µ80190 +RTIMER:µ80361 +LSPCL:µ80421 +LEXFDR:µ80484 +LSUUO:µ80740 +LSCALL:µ80789 +CTLBTS:µ80841 +SYSCVL:µ80910 +IOTBTS:µ81171 +USTYN:µ81243 +UUAC:µ81326 +TRMNAM:µ81503 +TRNLST:µ81539 +TRNLS1:µ81607 +UTRAPM:µ81654 +OPTION:µ81714 +XUNAME:µ81822 +XJNAME:µ81890 +40ADDR:µ81959 +TVCREG:µ82126 +TVVBN:µ82178 +NVDBA:µ82225 +UWHO1:µ82297 +UWHO2:µ82322 +UWHO3:µ82385 +ULSPBR:µ82459 +SERVER:µ82517 +USRPDL:µ82685 +UPDL:µ82717 +EPDL2:µ82739 +QLD:µ82770 +VALUE:µ82792 +SRN3:µ82827 +SRN4:µ83056 +SRN5:µ83107 +EPDL3:µ83170 +EPDL:µ83395 +EPDLT1:µ83499 +EPDLT2:µ83554 +EPDLT3:µ83609 +EPDLT4:µ83642 +STTYOP:µ83683 +LSWB0:µ83884 +LUBLK=µ84373 +L=µ84386 +SYSB=µ84476 +MXC=µ84496 +EXEUMP=µ84701 +BEG:µ84834 +GO:µ85036 +BEGTT1:µ86849 +BEGTT2:µ86950 +BEGTT3:µ87123 +BEG3:µ87452 +BEG2:µ87898 +BEG6:µ88375 +BEG7:µ88553 +BEGF0:µ89664 +BEG4:µ89966 +BEGX1:µ90290 +CKML:µ90602 +CKML2:µ91966 +CKML5:µ92263 +CKMS1:µ93246 +CKMS3:µ93825 +CKMS2:µ94634 +CKMSBF:µ94946 +CKMS4:µ94966 +CKMSZZ=µ95128 +CKMSX:µ95168 +BEGS1:µ96412 +BEG1:µ96659 +CKXC2:µ96756 +QSETUP:µ97037 +DPIL:µ97459 +BEG9:µ97915 +BEG5:µ98428 +BEG8:µ98809 +CKML1:¶01711 +CKML1A:¶02029 +CKML6:¶02473 +USEHM:¶02752 +CKMBLK:¶02806 +CKMFLG:¶02861 +CKMSWC:¶02903 +CKMSRC:¶02925 +CKMSSC:¶02947 +MEMLZL:¶03065 +MEMLZH:¶03094 +FTUTPG:¶03126 +T00TYI:¶03207 +T00TYO:¶03544 +T00BKO:¶03989 +T00ASZ:¶04142 +T00AZ1:¶04177 +DPSP:¶04307 +IEND:¶04485 +.HKALL=¶04494 +IFN KL10P, SALV=¶04824 +.ELSE SALV=¶04871 +IFGE TSYSM-256.,DDT=¶04960 +.ELSE DDT=¶04978 +DSKDMP=¶05002 + +SYSTEM; CONFIG +11258,XMIDAS +DEFINE DEFSYM²00 +.MLLIT=´04 +$$TEMP=´15 +.ELSE $$TEMP=´35 +DEFINE DEFOPTµ95 +.MLLIT=·11 +$$TEM2=·22 +.ELSE $$TEM2=·42 +DEFOPT KA10P=·80 +DEFOPT MAXJ=¸23 +DEFOPT SWBLK=¸70 +DEFOPT SWPWSP=¹29 +DEFOPT PAGPRE=¹78 +DEFOPT SCHBLN=±016 +DEFOPT NQS=±072 +DEFOPT NTUTBL=±106 +DEFSYM NUDSL=±187 +DEFOPT NQCHN=±288 +DEFOPT DC10P=±326 +DEFOPT DMDSK=±379 +DEFOPT QRSRVP=±449 +DEFOPT QAUTHP=±509 +DEFOPT C1MXP=±557 +DEFOPT NMTCS=±595 +DEFOPT TM10A=±636 +DEFOPT PTRP=±670 +DEFOPT PTPP=±703 +DEFOPT PDCLKP=±748 +DEFOPT DPKPP=±785 +DEFOPT NETP=±833 +DEFOPT IMPP=±875 +DEFOPT KAIMP=±913 +DEFOPT IMPUS=±930 +DEFOPT IMPUS3=±973 +DEFOPT NCPP=²025 +DEFOPT NNETCH=²063 +DEFOPT INETP=²107 +DEFOPT TCPP=²148 +DEFOPT XBL=²183 +DEFOPT TK10P=²230 +DEFOPT NOTYS=²316 +DEFOPT NNTYS=²358 +DEFOPT NDPTYS=²403 +DEFOPT NSTTYS=²450 +DEFOPT APL=²494 +DEFOPT CODP=²534 +DEFOPT TEN11P=²727 +DEFOPT TSYSM=´062 +DEFOPT ECCMEM=´110 +DEFOPT NMMP=´161 +DEFSYM PMRCM=´227 +DEFSYM PMAGEM=´296 +DEFSYM PMCSHM=´347 +DEFSYM PMUNSD=´379 +IFDEF TEN11P,IFN TEN11P,DEFSYM T11CPA=´441 +IFDEF PDP6P,IFN PDP6P,DEFSYM PDP6BM=´516 +IFDEF PDP6P,IFN PDP6P,DEFSYM LPDP6M=´600 +DEFOPT KA10P=´678 +DEFOPT MAXJ=´719 +DEFOPT SWBLK=´766 +DEFOPT SWPWSP=´821 +DEFOPT PAGPRE=´870 +DEFOPT SCHBLN=´909 +DEFOPT NQCHN=´967 +DEFOPT NQS=µ003 +DEFOPT NTUTBL=µ036 +DEFSYM NUDSL=µ078 +DEFOPT RP10P=µ126 +DEFOPT QRDCMP=µ179 +DEFOPT DMDSK=µ219 +DEFOPT QRSRVP=µ259 +DEFOPT QAUTHP=µ319 +DEFOPT C1MXP=µ367 +DEFOPT NEWDTP=µ409 +DEFOPT NMTCS=µ506 +DEFOPT TM10A=µ550 +DEFOPT NLPTP=µ585 +DEFOPT TPLP=µ622 +DEFOPT PTRP=µ651 +DEFOPT PTPP=µ684 +DEFOPT MTYP=µ720 +DEFOPT PDCLKP=µ765 +DEFOPT NETP=µ803 +DEFOPT IMPP=µ841 +DEFOPT KAIMP=µ879 +DEFOPT IMPUS=µ896 +DEFOPT IMPUS3=µ939 +DEFOPT NCPP=µ991 +DEFOPT NNETCH=¶027 +DEFOPT INETP=¶067 +DEFOPT TCPP=¶108 +DEFOPT XBL=¶143 +DEFOPT CHAOSP=¶189 +DEFOPT MYCHAD=¶218 +DEFOPT NINDX=¶257 +DEFOPT CH10P=¶295 +DEFOPT NOTYS=¶360 +DEFOPT NMTYS=¶450 +DEFOPT NSTTYS=¶491 +DEFOPT TSYSM=¶534 +DEFOPT NMMP=¶580 +DEFSYM PMRCM=¶645 +DEFSYM PMAGEM=¶686 +DEFSYM PMCSHM=¶719 +DEFSYM PMUNSD=¶751 +DEFOPT KA10P=¶814 +DEFOPT MAXJ=¶854 +DEFOPT SWBLK=¶901 +DEFOPT SWPWSP=¶962 +DEFOPT PAGPRE=·011 +DEFOPT SCHBLN=·052 +DEFOPT NQS=·108 +DEFOPT NTUTBL=·144 +DEFSYM NUDSL=·186 +DEFOPT NQCHN=·234 +DEFOPT RP10P=·272 +DEFOPT DMDSK=·324 +DEFOPT QRSRVP=·364 +DEFOPT QAUTHP=·407 +DEFOPT C1MXP=·455 +DEFOPT NMTCS=·500 +DEFOPT TM10B=·541 +DEFOPT TTLPTP=·583 +DEFOPT PTRP=·652 +DEFOPT PTPP=·685 +DEFOPT MTYP=·720 +DEFOPT PDCLKP=·809 +DEFOPT NETP=·847 +DEFOPT IMPP=·885 +DEFOPT DMIMP=·923 +DEFOPT IMPUS=·970 +DEFOPT IMPUS3=¸013 +DEFOPT NCPP=¸065 +DEFOPT NNETCH=¸101 +DEFOPT INETP=¸145 +DEFOPT TCPP=¸186 +DEFOPT XBL=¸221 +DEFOPT MSPP=¸267 +DEFOPT DEMON=¸306 +DEFOPT NOTYS=¸344 +DEFOPT NMTYS=¸386 +DEFOPT NSTTYS=¸428 +DEFOPT TSYSM=¸478 +DEFOPT NMMP=¸524 +DEFSYM PMRCM=¸589 +DEFSYM PMAGEM=¸631 +DEFSYM PMCSHM=¸665 +DEFSYM PMUNSD=¸698 +DEFOPT KL10P=¸760 +DEFOPT MAXJ=¸810 +DEFOPT SWBLK=¸858 +DEFOPT SWPWSP=¸919 +DEFOPT PAGPRE=¸968 +DEFOPT SCHBLN=¹006 +DEFOPT NQS=¹062 +DEFOPT NTUTBL=¹123 +DEFSYM NUDSL=¹166 +DEFOPT NQCHN=¹214 +DEFOPT RH10P=¹252 +DEFOPT T300P=¹304 +DEFOPT QRDCMP=¹367 +DEFOPT DMDSK=¹479 +DEFOPT QRSRVP=¹519 +DEFOPT QAUTHP=¹562 +DEFOPT NMTCS=¹610 +DEFOPT TM10B=¹651 +DEFOPT DL10P=¹699 +DEFOPT PDCLKP=¹748 +DEFOPT NETP=¹790 +DEFOPT INETP=¹829 +DEFOPT TCPP=¹873 +DEFOPT XBL=¹917 +DEFOPT IMPP=¹956 +DEFOPT KAIMP=¹994 +DEFOPT IMPUS=±0011 +DEFOPT IMPUS3=±0054 +DEFOPT NCPP=±0106 +DEFOPT NNETCH=±0142 +DEFOPT CHAOSP=±0187 +DEFOPT MYCHAD=±0220 +DEFOPT NINDX=±0259 +DEFOPT DLCP=±0296 +DEFOPT NOTYS=±0345 +DEFOPT NETYS=±0387 +NEWDTE=±0420 +DEFOPT NDLTYS=±0491 +DEFOPT NSTTYS=±0577 +DEFOPT TSYSM=±0625 +DEFOPT NMMP=±0672 +DEFSYM PMRCM=±0737 +DEFSYM PMCSHM=±0781 +DEFSYM PMAGEM=±0821 +DEFSYM PMUNSD=±0855 +DEFINE ITSIRP±0890 +DEFOPT KS10P=±0974 +DEFOPT MAXJ=±1027 +DEFOPT NQCHN=±1074 +DEFOPT SCHBLN=±1143 +DEFOPT SWBLK=±1199 +DEFOPT SWPWSP=±1261 +DEFOPT PAGPRE=±1314 +DEFOPT DMDSK=±1360 +DEFOPT QRSRVP=±1401 +DEFOPT QAUTHP=±1464 +DEFOPT NQS=±1512 +DEFOPT NTUTBL=±1554 +DEFSYM NUDSL=±1623 +DEFOPT RH11P=±1715 +DEFOPT RP06P=±1755 +DEFOPT NMTCS=±1792 +DEFOPT TM03S=±1855 +DEFOPT NETP=±1908 +DEFOPT CHAOSP=±2358 +DEFOPT MYCHAD=±2391 +DEFOPT NINDX=±2430 +DEFOPT CH11P=±2468 +DEFOPT DZ11P=±2519 +DEFOPT NKSTYS=±2666 +DEFOPT NDZTYS=±2713 +DEFOPT NSTTYS=±2747 +DEFOPT TSYSM=±2795 +DEFOPT NMMP=±2844 +DEFSYM PMAGEM=±2958 +DEFSYM PMCSHM=±2994 +DEFSYM PMRCM=±3038 +DEFSYM PMUNSD=±3160 +DEFINE ITSIRP±3197 +DEFOPT KS10P=±3287 +DEFOPT MAXJ=±3325 +DEFOPT NQCHN=±3372 +DEFOPT SCHBLN=±3441 +DEFOPT SWBLK=±3497 +DEFOPT SWPWSP=±3559 +DEFOPT PAGPRE=±3612 +DEFOPT DMDSK=±3658 +DEFOPT QRSRVP=±3699 +DEFOPT QAUTHP=±3762 +DEFOPT NQS=±3810 +DEFOPT NTUTBL=±3852 +DEFSYM NUDSL=±3921 +DEFOPT RH11P=±4013 +DEFOPT RP06P=±4053 +DEFOPT NETP=±4088 +DEFOPT CHAOSP=±4539 +DEFOPT MYCHAD=±4572 +DEFOPT NINDX=±4611 +DEFOPT CH11P=±4649 +DEFOPT DZ11P=±4700 +DEFOPT NKSTYS=±4870 +DEFOPT NDZTYS=±4917 +DEFOPT NSTTYS=±4950 +DEFOPT TSYSM=±4997 +DEFOPT NMMP=±5046 +DEFSYM PMAGEM=±5160 +DEFSYM PMCSHM=±5196 +DEFSYM PMRCM=±5240 +DEFSYM PMUNSD=±5362 +DEFINE ITSIRP±5399 +DEFOPT KS10P=±5489 +DEFOPT MAXJ=±5527 +DEFOPT NQCHN=±5574 +DEFOPT SCHBLN=±5643 +DEFOPT SWBLK=±5699 +DEFOPT SWPWSP=±5761 +DEFOPT PAGPRE=±5814 +DEFOPT DMDSK=±5860 +DEFOPT QRSRVP=±5901 +DEFOPT QAUTHP=±5964 +DEFOPT NQS=±6012 +DEFOPT NTUTBL=±6054 +DEFSYM NUDSL=±6123 +DEFOPT RH11P=±6215 +DEFOPT RP06P=±6255 +DEFOPT NETP=±6290 +DEFOPT CHAOSP=±6341 +DEFOPT MYCHAD=±6374 +DEFOPT NINDX=±6413 +DEFOPT CH11P=±6451 +DEFOPT DZ11P=±6502 +DEFOPT NKSTYS=±6672 +DEFOPT NDZTYS=±6719 +DEFOPT NSTTYS=±6752 +DEFOPT TSYSM=±6799 +DEFOPT NMMP=±6848 +DEFSYM PMAGEM=±6962 +DEFSYM PMCSHM=±6998 +DEFSYM PMRCM=±7042 +DEFSYM PMUNSD=±7164 +DEFINE ITSIRP±7201 +DEFOPT KS10P=±7293 +DEFOPT MAXJ=±7327 +DEFOPT NQCHN=±7374 +DEFOPT SCHBLN=±7443 +DEFOPT SWBLK=±7499 +DEFOPT SWPWSP=±7561 +DEFOPT PAGPRE=±7614 +DEFOPT DMDSK=±7660 +DEFOPT QRSRVP=±7701 +DEFOPT QAUTHP=±7764 +DEFOPT NQS=±7812 +DEFOPT NTUTBL=±7854 +DEFSYM NUDSL=±7923 +DEFOPT RH11P=±8015 +DEFOPT RM80P=±8055 +DEFOPT NETP=±8090 +DEFOPT CHAOSP=±8141 +DEFOPT MYCHAD=±8174 +DEFOPT NINDX=±8213 +DEFOPT CH11P=±8251 +DEFOPT DZ11P=±8302 +DEFOPT NKSTYS=±8472 +DEFOPT NDZTYS=±8519 +DEFOPT NSTTYS=±8552 +DEFOPT TSYSM=±8599 +DEFOPT NMMP=±8648 +DEFSYM PMAGEM=±8762 +DEFSYM PMCSHM=±8798 +DEFSYM PMRCM=±8842 +DEFSYM PMUNSD=±8964 +DEFINE ITSIRP±9001 +DEFOPT KS10P=±9108 +DEFOPT MAXJ=±9142 +DEFOPT NQCHN=±9189 +DEFOPT SCHBLN=±9258 +DEFOPT SWBLK=±9314 +DEFOPT SWPWSP=±9376 +DEFOPT PAGPRE=±9429 +DEFOPT DMDSK=±9475 +DEFOPT QRSRVP=±9516 +DEFOPT QAUTHP=±9579 +DEFOPT NQS=±9627 +DEFOPT NTUTBL=±9669 +DEFSYM NUDSL=±9738 +DEFOPT RH11P=±9830 +DEFOPT RP06P=±9870 +DEFOPT NMTCS=±9906 +DEFOPT TM03S=±9969 +DEFOPT DZ11P=²0023 +DEFOPT NKSTYS=²0147 +DEFOPT NDZTYS=²0194 +DEFOPT NSTTYS=²0228 +DEFOPT TSYSM=²0275 +DEFOPT NMMP=²0324 +DEFSYM PMAGEM=²0438 +DEFSYM PMCSHM=²0474 +DEFSYM PMRCM=²0518 +DEFSYM PMUNSD=²0640 +DEFINE ITSIRP²0677 +DEFOPT KS10P=²0779 +DEFOPT MAXJ=²0813 +DEFOPT NQCHN=²0860 +DEFOPT SCHBLN=²0929 +DEFOPT SWBLK=²0985 +DEFOPT SWPWSP=²1047 +DEFOPT PAGPRE=²1100 +DEFOPT DMDSK=²1146 +DEFOPT QRSRVP=²1187 +DEFOPT QAUTHP=²1250 +DEFOPT NQS=²1298 +DEFOPT NTUTBL=²1340 +DEFSYM NUDSL=²1409 +DEFOPT RH11P=²1501 +DEFOPT RP06P=²1541 +DEFOPT NMTCS=²1577 +DEFOPT TM03S=²1640 +DEFOPT DZ11P=²1694 +DEFOPT NKSTYS=²1795 +DEFOPT NDZTYS=²1842 +DEFOPT NSTTYS=²1875 +DEFOPT TSYSM=²1922 +DEFOPT NMMP=²1971 +DEFSYM PMAGEM=²2085 +DEFSYM PMCSHM=²2121 +DEFSYM PMRCM=²2165 +DEFSYM PMUNSD=²2287 +DEFINE ITSIRP²2324 +DEFOPT KS10P=²2435 +DEFOPT MAXJ=²2469 +DEFOPT NQCHN=²2516 +DEFOPT SCHBLN=²2585 +DEFOPT SWBLK=²2641 +DEFOPT SWPWSP=²2703 +DEFOPT PAGPRE=²2756 +DEFOPT DMDSK=²2802 +DEFOPT QRSRVP=²2843 +DEFOPT QAUTHP=²2906 +DEFOPT NQS=²2954 +DEFOPT NTUTBL=²2996 +DEFSYM NUDSL=²3065 +DEFOPT RH11P=²3157 +DEFOPT RM03P=²3197 +DEFOPT NMTCS=²3233 +DEFOPT TM03S=²3296 +DEFOPT DZ11P=²3350 +DEFOPT NKSTYS=²3451 +DEFOPT NDZTYS=²3498 +DEFOPT NSTTYS=²3531 +DEFOPT TSYSM=²3578 +DEFOPT NMMP=²3627 +DEFSYM PMAGEM=²3741 +DEFSYM PMCSHM=²3777 +DEFSYM PMRCM=²3821 +DEFSYM PMUNSD=²3943 +DEFINE ITSIRP²3980 +DEFOPT KS10P=²4079 +DEFOPT MAXJ=²4113 +DEFOPT NQCHN=²4160 +DEFOPT SCHBLN=²4229 +DEFOPT SWBLK=²4285 +DEFOPT SWPWSP=²4347 +DEFOPT PAGPRE=²4400 +DEFOPT DMDSK=²4446 +DEFOPT QRSRVP=²4487 +DEFOPT QAUTHP=²4550 +DEFOPT NQS=²4598 +DEFOPT NTUTBL=²4640 +DEFSYM NUDSL=²4709 +DEFOPT RH11P=²4801 +DEFOPT RM03P=²4841 +DEFOPT NMTCS=²4879 +DEFOPT TM03S=²4942 +DEFOPT DZ11P=²4996 +DEFOPT NKSTYS=²5097 +DEFOPT NDZTYS=²5144 +DEFOPT NSTTYS=²5177 +DEFOPT TSYSM=²5224 +DEFOPT NMMP=²5273 +DEFSYM PMAGEM=²5387 +DEFSYM PMCSHM=²5423 +DEFSYM PMRCM=²5467 +DEFSYM PMUNSD=²5589 +DEFINE ITSIRP²5626 +DEFOPT KL10P=²5876 +DEFOPT KS10P=²5913 +DEFOPT KA10P=²5950 +IFN KS10P, DEFOPT KSFREQ=²6080 +DEFOPT C1MXP=²6134 +DEFOPT MAXJ=²6186 +DEFOPT NQCHN=²6234 +DEFOPT SCHBLN=²6304 +DEFOPT SWBLK=²6361 +DEFOPT SWPWSP=²6423 +DEFOPT PAGPRE=²6476 +DEFOPT DC10P=²6819 +DEFOPT RP10P=²6875 +DEFOPT RH10P=²6926 +DEFOPT RH11P=²6977 +DEFOPT RP06P=²7021 +DEFOPT RM03P=²7060 +DEFOPT RM80P=²7099 +DEFOPT T300P=²7138 +DEFOPT QRDCMP=²7186 +DEFOPT DMDSK=²7229 +DEFOPT QRSRVP=²7270 +DEFOPT QAUTHP=²7333 +DEFOPT NMTCS=²7407 +DEFOPT TM10A=²7444 +DEFOPT TM10B=²7487 +DEFOPT TM03S=²7527 +DEFOPT NETP=²7671 +DEFOPT CHAOSP=²7739 +DEFOPT NCPP=²7806 +DEFOPT INETP=²7862 +DEFOPT TCPP=²7914 +DEFOPT NNETCH=²8000 +IFN INETP,IFNDEF IMPUS3,.ERR IMPUS3 must be defined as²8130 +IFN CHAOSP,IFNDEF MYCHAD, .ERR MYCHAD must be defined as²8237 +DEFOPT NINDX=²8271 +DEFOPT CH10P=²8331 +DEFOPT CH11P=²8382 +DEFOPT DLCP=²8444 +DEFOPT T11CHP=²8486 +IFN T11CHP,DEFOPT CH11NM=²8555 +DEFOPT IMPP=²8656 +IFN IMPP,IFNDEF IMPUS, .ERR IMPUS must be defined as²8746 +DEFOPT DMIMP=²8776 +DEFOPT KAIMP=²8819 +DEFOPT KSIMP=²8877 +DEFOPT MTYP=²9034 +DEFOPT DL10P=²9083 +DEFOPT TK10P=²9134 +DEFOPT DPKPP=²9177 +DEFOPT DZ11P=²9229 +DEFOPT NOTYS=²9338 +DEFOPT NETYS=²9381 +DEFOPT NKSTYS=²9431 +DEFOPT NNVTTS=²9479 +DEFOPT NNTYS=²9510 +DEFOPT NDZTYS=²9555 +DEFOPT NDPTYS=²9591 +DEFOPT NMTYS=²9637 +DEFOPT NDLTYS=²9679 +DEFOPT NSTTYS=²9719 +DEFOPT N11TYS=²9765 +DEFOPT NF2741=³0012 +DEFOPT N2741=³0052 +DEFOPT SYSCON=³0112 +DEFOPT APL=³0157 +DEFOPT TEN11P=³0216 +DEFOPT XGP=³0273 +DEFOPT NEWDTP=³0304 +DEFOPT NUNITS=³0353 +DEFOPT OLPTP=³0396 +DEFOPT NLPTP=³0446 +DEFOPT GLPTP=³0487 +DEFOPT TTLPTP=³0524 +DEFOPT PTRP=³0582 +DEFOPT PTPP=³0631 +DEFOPT PDCLKP=³0677 +DEFOPT HCLKP=³0721 +DEFOPT CCLKP=³0780 +DEFOPT 340P=³0848 +DEFOPT TABP=³0885 +DEFOPT PLTP=³0926 +DEFOPT DSDP=³0967 +DEFOPT ARMP=³1011 +DEFOPT IMXP=³1062 +DEFOPT OMXP=³1131 +DEFOPT VIDP=³1201 +DEFOPT NTYP=³1240 +DEFOPT CODP=³1293 +DEFOPT PDP6P=³1363 +DEFOPT RBTCP=³1457 +DEFOPT NDAP=³1496 +DEFOPT STKP=³1558 +DEFOPT E.SP=³1616 +DEFOPT MSPP=³1688 +DEFOPT DEMON=³1731 +DEFOPT TPLP=³1782 +DEFOPT ECCMEM=³1857 +DEFOPT NMMP=³1911 + +SYSTEM; TTYTYP +00033,XMIDAS + +SYSTEM; TIME +00472,XMIDAS +APDTIM:±12 +ARDATE:²30 +ARTIME:´75 +ARDATI:·18 +ARYEAR:±100 +ARLPDT:±247 +RETM1:±398 +GPDTIM:±551 +GPDTM2:²350 +RDATE:²606 +ARTIMX:²855 +RDATE1:³049 +LMNTBL:³362 +RTIME:³491 +RDATM1:³889 +RYEAR:´269 +RYEAR1:´362 +RYEAR2:´763 +NUPDT:µ150 +GLPDTM:¶346 +GLPDT2:·076 +CRDDST:·516 +GLPDT3:·777 +CRDSB:¸673 +CRDTST:¸758 +CMPF29:¸926 +GDWOBY:¹396 +PDCCHK:¹580 +PDCCH1:¹947 +INITIM:±0053 +INITM2:±0686 +CLCQDT:±1630 + +SYSTEM; TM03S +00706,XMIDAS +DEFINE DEFSYM±33 +.ELSE [ $$TEM1=±78 +$$TEMP=²80 +.ELSE, $$TEMP=³16 +DEFSYM %TMVEC=³72 +DEFSYM %TMBAS=´69 +DEFSYM %TMCS1=µ74 +DEFSYM %TMNOP=±115 +DEFSYM %TMUNL=±148 +DEFSYM %TMREW=±175 +DEFSYM %TMCLR=±202 +DEFSYM %TMER3=±259 +DEFSYM %TMWTM=±301 +DEFSYM %TMSPF=±338 +DEFSYM %TMSPR=±373 +DEFSYM %TMWCF=±408 +DEFSYM %TMWCR=±449 +DEFSYM %TMWRT=±490 +DEFSYM %TMRDF=±525 +DEFSYM %TMRDR=±559 +DEFSYM %TMWC=±599 +DEFSYM %TMBA=±639 +DEFSYM %TMFC=±683 +DEFSYM %TMCS2=±729 +DEFSYM %TMFS=²357 +DEFSYM %TMERR=³070 +DEFSYM %TMASN=³953 +DEFSYM %TMCCR=´060 +DEFSYM %TMBUF=´214 +DEFSYM %TMMNT=´264 +DEFSYM %TMTYP=´306 +DEFSYM %TMSER=´544 +DEFSYM %TMTC=´586 + +SYSTEM; NMTAPE +03007,XMIDAS +MSCBL=¸23 +MGQDLL=¸59 +MSEOFP=¹52 +MSCHN=±010 +MTXP=±067 +MUNITF=±131 +MNOPIN=±229 +MWRITE=±275 +MW3IN=±302 +MSPRR=±347 +MREAD=±390 +MSPFR=±416 +MSPFF=±459 +MSPRF=±497 +MREWND=±536 +MRWNDD=±560 +MWEOF=±595 +MGNRTY=±632 +%MMOUT=±700 +%MMBLK=±743 +%MMIMG=±785 +%MMCNK=±823 +%MMNSE=±870 +%MMEP=±923 +%MMDEN=±961 +%MM32B=²098 +%MMRSZ=²184 +MGVTC:²313 +MGJDTI:²362 +MGNWRD:²411 +MGTBZY:²465 +MGSFTI:²510 +MGUNIT:²555 +MGWCW:²594 +LMIOWD:²645 +MSRAC:²671 +MGERRC:³489 +MTCEFW:³524 +MGEOFR:³580 +MTPSAV:³635 +MSCMDC:³686 +MGSPCD:³747 +MGSCNT:³796 +MGEOTT:³843 +MSBUFP:³900 +MSNBOL:³965 +MSCRW:´013 +MSMPRC:´066 +MSMPRP:´110 +MTMDN:´152 +MGCABN:´198 +MTUSE:´250 +MTUSR:´318 +MTBLKS:´374 +MTMFNC:´459 +MTMCNT:´506 +MTMTAP:´542 +MGCMTS:´583 +MGCMTC:´649 +MTCONO:´735 +MTSELW:´829 +MTWTFC:´951 +MGQDLP:µ074 +MTCMBP:µ557 +MGCMBP:µ682 +MGEMTC:µ879 +MGEMTS:µ917 +MIOWD:µ969 +MGDBRK:¶021 +DEFINE MTENQB¶257 +REG,TEMP=¶267 +DEFINE MTDEQB¶715 +REG,TEMP=¶725 +MAGTO:·720 +MTOW1:¹590 +MTOW2:¹961 +MTOW3:±0229 +MTOW4:±0855 +MTODNP:±3019 +MTODOL:±3129 +MTOPTB:±3195 +MTOCL:±3399 +MTOCL3:±4587 +MTICL:±4806 +MTICL2:±6411 +MTCBFF:±6610 +MTUAI:±7073 +MTUII:±7171 +MTBI:±7250 +MTREAD:±7308 +MTRBG:±7879 +MTRBG3:±8404 +MTRBD:±8816 +MOVTWJ:±9260 +MTRBFW:±9576 +MTUAO:²0571 +MTUIO:²0669 +MTBO:²0748 +MTWRIT:²0807 +MTWBFG:²1254 +MTWBFD:²1926 +MTCMD:²3024 +MTCMD1:²3243 +MTCMD2:²3424 +MTIECK:²3734 +STAMTC:²5780 +RCHMGT:²6922 +MSTRTR:²7404 +MGSBRK:²7728 +MGSBK1:²7927 +MGSBK2:²8391 +MGHBRK:²8712 +MGUBRK:²9336 +MGHBRK:²9939 +MGNOUW:³0385 +MGXGO:³2828 +MGOVER:³3279 +MGRCV:³3838 +MGNCM1:³3967 +MGNCMD:³4237 +QPOPJ1:³4383 +QPOPJ:³4399 +MGWTJD:³4841 +MGWJD1:³5003 +MGWTJD:³5995 +MGWJD1:³6005 +MGWJD2:³6415 +MGGXPT:³7045 +MGERR:³8861 +MGWCWC:´1643 +MGWCW1:´1766 +MGWCW2:´1940 +MGDCSI:´2097 +MGDCSO:´2131 +TMINIC:´2295 +MGWRIT:´2718 +MGWRT2:´4192 +MGWRT3:´5130 +MGCMDR:´5936 +MGCMR1:´6565 +MGWERR:´6995 +MGWER1:´8611 +MGREAD:´9447 +MGRD0:´9497 +MGRD1:µ0993 +MGRD1A:µ2336 +MGRD2:µ2717 +MGRD5:µ3970 +MGRD3:µ4149 +MGRD4:µ4370 +MGRERR:µ4569 +MGRER1:µ6150 +MGRER2:µ6360 +MGMRT:µ6428 +MGSPCF:µ7381 +MGSPFR:µ8172 +MGSPFF:µ8629 +MGSPF1:µ9240 +MGSPCR:µ9594 +MGSPRR:¶0393 +MGSPRF:¶0771 +MGSPR1:¶0901 +MGSPR2:¶1142 +MGRWND:¶1447 +MGRWDM:¶1530 +MGRWD1:¶1742 +MGRWD2:¶2384 +MGRWD3:¶2637 +MGRWD4:¶2752 +MGRWD5:¶2902 +MGRWD2:¶3385 +MGRWD3:¶3588 +MGSEOT:¶3723 +MGNVT:¶4161 +MGEOT2:¶4670 +MGVTCK:¶5980 +MGVTC1:¶6311 +MGVTC1:¶6815 +MGVT:¶7520 +MGMEOT:¶7955 +MGWEOF:¶9207 +MGSTAT:·0127 +MGW3IN:·0195 +AMTAPE:·1421 +MTAPDT:·2434 +NMTAPC=·2958 +MTSBKS:·3008 +MTRBKS:·3246 +MTHANG:·3367 +MTRWND:·3550 +MTRWDM:·3607 +MTWEOR:·3961 +MTSOSP:·4124 +MTWEOF:·4218 +MTW3IN:·4595 +MTSPR:·4905 +MTSPR1:·5226 +MTSPFR:·5487 +MTFLRA:·6061 +MTSPF:·6714 +MTSPF1:·6948 +MTSPFF:·7192 +MTCNTR:·7406 +MTSTAT:·7545 +MTSPEOT:·7819 +MTSTOP:·8063 + +SYSTEM; UTAPE +04863,XMIDAS +UTBLKS=´0 +UTCHNT:¸2 +UTBFP:±14 +UTUSR:²17 +UTUL:²50 +UTDIRP:³22 +UTDBC:³71 +UTBFS:µ71 +UTLSTM:¶15 +UTMBN:¶71 +UTRAC:·54 +UTN1=¹89 +UTN2=±020 +UTBKNP=±080 +MPRP:±110 +MPRC:±158 +UTTNO:±199 +UTEOF:±282 +UTLDD:±321 +UTDERR:±558 +NUTCA:±624 +NUWCA:±664 +UPCHFS:±696 +LUTWBF=±734 +UTWBF:±776 +UTWBFS:±893 +IFNDEF MXUTBF,MXUTBF=±934 +DEFINE TAG²003 +TAGX:²032 +UTCH:²065 +TAG ULCTM:²101 +TAG DRTM:²213 +TAG UDIR:²312 +IFN NEWDTP, TAG OUDIR:²376 +TAG UGOAL:²418 +TAG EUPOS:²478 +TAG DCHNT:²558 +TAG UMEMAD:²633 +TAG URDWR:²734 +TAG DG2:²793 +TAG UTASS:²911 +TAG UDIRO:²984 +TAG UFLAPF:³242 +TAG ULDCH:³464 +TAG UDPWF:³607 +TAG UMNFB:³666 +TAG UTERP:³725 +TAG UMNTR:³792 +SUNIT:³857 +IFE NEWDTP, SUNITL:³900 +SMODE:³920 +UIDLE:³948 +IFN NEWDTP, CUINT:´000 +WRITE:´035 +TAPCNT:´063 +TAP1:´072 +TAP2:´081 +TAP3:´090 +UTTM1:´100 +UTTM2:´143 +UTTM3:´180 +UTTM4:´221 +UTTM5:´301 +FLPUNT:´335 +UTENB:´348 +LUTOTM:´359 +UTHERR:´392 +USTSW:´417 +UDCC:´443 +UTCHE=´488 +AUBL2:´567 +AUBLAT:´650 +AUBL1:´980 +AASSIGN:µ089 +ADESIGN:µ299 +AUTNAM:µ545 +AUTN2:¶267 +UDPW:¶331 +UDPW2:¶431 +AUINIT:¶608 +AUDISM:·516 +NFLAP:·555 +AUTDM1:·646 +AUTDM2:·749 +UTOLOS:·879 +UTOF1:¸011 +UTO:¸139 +UTO0:¸249 +UTO4:¸551 +UDPW1:¸985 +UTOBL1:¹222 +UTO5B:¹309 +UTOW2:¹368 +UTO8:¹373 +UTO2:¹602 +UTOW4:¹959 +UTOW1:±0536 +UTSNMK:±0722 +UTOW3:±0855 +UNCA:±1164 +UTWNA:±1185 +NCA:±1204 +UFILDF:±1227 +FILDF:±1248 +S1NL14:±1270 +UDATAI:±1308 +UASCII:±1337 +UBLKI:±1398 +UBLKI2:±1439 +UTBGB:±1563 +UTBWG4:±1874 +UTBGB1:±2102 +UBLKO:±2202 +UBLKO2:±2243 +UASCCO:±2311 +UDATAO:±2340 +UTBWG:±2433 +UTBWG2:±2743 +UTBWG1:±2886 +UTBWG5:±3500 +UTBWG6:±3538 +UTPFUL:±3614 +UTBWW:±3727 +UTBWW2:±4394 +UTBWW1:±4464 +UTOCL:±4504 +UTOCL1:±4633 +UTOCL6:±4723 +UTOCL2:±4815 +UTOCL5:±5210 +UTOCL4:±5297 +UTDEL1:±5566 +UTRN1:±5710 +UTRN4:±5995 +UTRN3:±6052 +UDELETE:±6181 +UDELA:±6237 +UDELE4:±6326 +UDELE3:±6581 +UDELE1:±6605 +UDELE6:±6732 +UDELE2:±6792 +UTICL:±6926 +UTOCL3:±7232 +UTICL2:±7257 +UTICL3:±7358 +UCPAT0:±7470 +UCPAT2:±7555 +UCPAT1:±7647 +UTCOP:±7699 +UDELE5:±7722 +UTBRB1:±7874 +UTBRB:±7891 +UTRL1:±7997 +UTRLDR:±8065 +UTRLD3:±8308 +UTRLD2:±8464 +UTRLD1:±8499 +JDDTA:±8588 +JDDT6:±8978 +JDDT2:±9021 +JDDT4:±9097 +JDDT1:±9214 +JDDT5:±9358 + UTREOF:±9397 +JDB6W:±9580 +JDB6C1:±9686 +JDB6F:²0120 +JDB6E:²0206 +UTRLR1:²0339 +JDB6C2:²0403 +JDB6C:²0411 +JDB6W1:²0468 +ULLP1:²0795 +JDB6A:²1024 +UTRLD:²1534 +UDRR2:²1558 +JDB6:²1744 +UDRDD:²1921 +JDB6W2:²2445 +UDRDD3:²2505 + UDIRAD:²2641 +UDIRR:²2693 +UDOUT2:²2792 +UDOUT7:²2839 +UDIR1:²2956 +UDARET:²3142 +UDBL1:²3163 +UDOUT:²3234 +UDOUT6:²3399 +UDOUT4:²3442 +UDOUT3:²3526 +UDOUT1:²3616 +UDOUT8:²3743 +UDOUT5:²3840 +UTLK3:²3959 +UTLOOK:²3985 +UTLK2:²4054 +UTLK1:²4128 +UITAB:²4186 +UAF:²4221 +UAR:²4256 +TAPE:²4458 +UTP1:²4467 +UTP3:²4567 +PIPOS:²4609 +PIPOSL:²4907 +PIPOS5:²5025 +PIPOS7:²5092 +BDBLKC:²5136 +PIPOS3:²5156 +PIPOS6:²5286 +PIPF2:²5357 +PIPF1:²5534 + PIPOS4:²5624 +PIPOS2:²5732 +TAP4:²6099 +TAPFOR:²6251 + UTERR:²6386 +UTER5:²6464 +UTER6:²6660 +UDATER:²6877 + UTCB0:²7004 +UTCB1:²7097 +JDDT3:²7204 + ILLP:²7473 +UTDC:²7560 +UTDC1:²7634 +UTDC4:²7923 +UTDC2:²8050 +UTDC3:²8156 +JDBRK:²8239 +JDB3:²8389 + JDBRK7:²8564 +JDF2:²8615 +JDS1:²8703 +JDBRK4:²8799 +JDF5:²9125 +JDCV1:²9172 +ULLP:²9243 + JDBRK6:²9521 +JDF6A:²9703 +JDF1:²9835 +JDF1A:²9902 +JDDS:³0328 +JDSTP:³0388 +JDCNN:³0444 +JDSTP1:³0547 +JDF3:³0616 +JDF3A2:³0932 +JDF3A1:³0973 +JDF3A:³1024 +JDF6:³1338 +JDF4:³1383 +JDF4A:³1569 + JDB5:³1655 +JDB7:³1755 +DCGB1:³1962 +DCGB2:³2194 +UTST:³2267 +UTST1:³2379 +UTST2:³2471 +JDENB=³2616 +20MSEN=³2660 +TAPE:³2693 +UTP1:³2702 +UTP3:³2790 +PIPOS:³2868 +PIPOSL:³3388 +PIPOS5:³3473 +PIPOS7:³3494 +BDBLKC:³3538 +PIPOS3:³3560 +PIPF2:³3669 +PIPOS6:³3728 +PIPOS8:³3832 +PIPF1:³3870 +PIPOS4:³3909 +PIPOS2:³3977 +TAP4:³4363 +TAPFOR:³4522 +UTERR:³4644 +UTER6:³5078 +UTER1:³5533 +UDATER:³5571 + UTCB0:³5673 +UTCB1:³5754 +JDDT3:³6007 +ILLP:³6298 +UTDC:³6385 +UTDC4:³6742 +UTDC2:³6869 +UTDC3:³6975 +JDBRK:³7058 +JDBK1:³7124 + JDB3:³7416 +JDBRK7:³7629 +JDF2:³7680 +JDF2A:³7769 +JDS1:³7888 +JDBRK4:³7969 +JDF5:³8323 +JDCV1:³8427 +ULLP:³8480 +JDBRK6:³8732 +JDF6A:³8942 +JDF1:³9120 +JDF1A:³9217 +JDF3:³9580 +JDF3A2:³9801 +JDF3A1:³9842 +JDF3A:³9893 +JDF8:´0120 +JDF6:´0177 +JDF4:´0308 +JDB5:´0376 +JDB7:´0396 +JDB4B:´0603 +JDB4A:´0676 +JDB4A1:´0866 +JDF9:´0938 +USTPF:´1003 +STPUNT:´1014 +JDB7E:´1064 +JDB7D:´1082 +JDB7D1:´1153 +JDB7A:´1265 +JDBK3A:´1507 +JDDT8:´1543 +JDB3A:´1727 +DCGBL2:´1736 +JDB8A:´1756 +JDB3B:´1797 +DCGBL1:´1806 +UTST:´1987 +JDS4:´2050 +JDF6B:´2105 +UTER3:´2139 +URLS:´2246 + +SYSTEM; DISK +12820,XMIDAS +DSKVRS=¶9 +ADMPCH:·63 +NRFDATE:±289 +NRDM1:±361 +NSRDATE:±425 +NRESRDT:±521 +NSFDATE:±674 +NSDM1:±746 +QUDUL1:±789 +NRDMPBT:±825 +NSDMPBT:±915 +NLNKEDP:²004 +NFILBLK:²143 +QCHNLT:²319 +ASAUTH:²509 +ASAUT2:²791 +ASAUT3:²893 +ASAUT4:²914 +ASAUT1:²932 +ARAUTH:²990 +ASREAP:³241 +ARQDAT:³331 +ADSKUP:³510 +DELEWO:³762 +NFILLEN:´453 +NFILL2:´830 +NFILL1:´997 +NFLLN2:¶056 +NFLLN1:¶090 +NDIRSI:¶628 +NDIRS1:¶749 +NDIRS2:¶954 +%DO=·033 +%DOWOV=·087 +%DONRF=·120 +%DONLK=·152 +%DORWT=·215 +TPLO:·306 +COMO:·461 +SYSO:·524 +TPLO2:·578 +QSKPO:·630 +QSKPO1:·902 +QSKUO:·920 +DNRFO:¸373 +QSKO:¸561 +QSKOB:¸615 +QSKOA:¸733 +QSKOL:¸837 +MFDCK:¸985 +SYSDS2:¹073 +QSKDP2:¹315 +QSKDP9:¹488 +QSKDPY:¹605 +QSKDPZ:¹715 +QWROR:¹834 +QSKO2:±0445 +QOEX1:±1369 +QWROR1:±1657 +QROR1A:±1895 +QROR1B:±2052 +QROR1C:±3450 +QROR1E:±3869 +QROR1F:±4165 +QROR1D:±4254 +QSKOB2:±4405 +QSKDP1:±5296 +QSKDP4:±5656 +QSKDP5:±5679 +QSKDP3:±5834 +QSKDP7:±6036 +QSKDPU:±6268 +QSKDPA:±6420 +QSKDPT:±6475 +QSKDPR:±6600 +QSKDP6:±6695 +QSKDP8:±6954 +QSKDPV:±7153 +QSKDPX:±7210 +QSKDPK:±7251 +QSKBK0:±7445 +QSKBK1:±7608 +QSKBK4:±7823 +QSKBK3:±8053 +QSKBK2:±8092 +QSKDPS:±8176 +QSKDPB:±8215 +QSKDPE:±8425 +QSKDPW:±8514 +QSKDPC:±8552 +QSKDPD:±8620 +QSKDPG:±8717 +QSKDPI:±8756 +QSKDPF:±8793 +QSKDPH:±8908 +QSKDPJ:±9021 +QWRO2:±9206 +QWRO2B:±9324 +QWRO2A:²0156 +QWRO2E:²0421 +QWRO2C:²0492 +QWRO2D:²0758 +QWRO:²0967 +MNGDIR:²1530 +SYSDSK:²1992 +QFREEF:²2604 +QFREFA:²2755 +QFREFC:²3188 +QFREFE:²3399 +QFREFF:²3484 +QFREFD:²3541 +QAGARB:²4508 +QINSRT:²4764 +QINSR1:²5016 +QINSR2:²5188 +QSKO1:²5458 +QSKO11:²5700 +QSKON1:²6060 +QNOFRE:²6276 +QPNL24:²6331 +QPNL20:²6369 +AUTOCR:²6493 +NATOCR=²6809 +QSKON:²6829 +QSKONA:²6912 +QSKONB:²7141 +QSKONE:²7245 +QSKONC:²7858 +QSKONF:²7962 +QSKOND:²7999 +QSKONG:²8080 +QALINK:²8498 +LDEP:²9173 +LDEPL:²9227 +LDEPS2:²9358 +LDEPS:²9595 +QLINK:²9711 +QL1:³0062 +QL5:³0193 +QL4:³0223 +QL3:³0278 +QOLINK:³0586 +QMCH1:³0824 +QMCH3:³0910 +QMCH1A:³1138 +QMCH1E:³1323 +QMCH2:³1422 +QTCH1:³1690 +QTCH1A:³1796 +QTCH1D:³2746 +QTCH1F:³2891 +QTCH2:³3003 +TUTPNT:³3590 +QSTRTR:³3799 +QSTRT1:³3821 +QSTRT1:³4119 +QDFLS:³4536 +QDFLS1:³4559 +QDFLS2:³4601 +QDFCHK:³5101 +QDFCH1:³5147 +QDFCH2:³5314 +QFLDF:³5438 +QFLDF1:³5760 +QFLDRT:³6125 +QFLD:³6519 +QFLD1A:³6553 +QFLD1:³6575 +QFLD2A:³6665 +QFL:³7063 +QFL0:³7140 +QFL1:³7207 +QFL2:³7307 +QFL3:³7400 +QCHNF:³7661 +QCH2:³7895 +QCH3:³7973 +QCH1:³8035 +QCHNRT:³8770 +QRNAM:³9020 +QRNAM4:³9478 +QRNAM3:³9583 +QRNAM2:³9795 +QRNAM1:³9838 +QGRLSC:³9937 +QRELOC:´0241 +QRLOCK:´0409 +QRLOCJ:´0582 +QRLOCC:´0756 +QRLOCA:´0865 +QRLOCE:´1060 +QRLOCF:´1085 +QRLOCG:´1280 +QRLOCH:´1305 +QRLOCB:´1395 +QRLOCD:´1485 +QRLOCI:´1565 +QRLOCS:´1609 +QDEL:´1669 +QDELTA:´1800 +QDEL5:´1898 +QDEL5A:´1993 +QPKNF6:´2066 +QDFPK:´2341 +QNFDL2:´2515 +QNFDL3:´2603 +QAUTH:´2668 +QAUTH2:´3185 +QAUTH3:´3298 +QAUTH1:´3472 +.ELSE QAUTH=´3580 +QDELA:´3718 +QDLA1:´3736 +QDLA3:´3899 +QDEL1:´4088 +QDEL4:´4490 +QDEL4B:´4571 +QDLA2:´4642 +QDEL4A:´4754 +QCDLWO:´4788 +QSICLD:´4909 +QDELA1:´5247 +QDELA2:´5330 +QSOCLD:´5458 +QPKNF7:´5589 +QPKNF1:´5628 +QDL2:´5826 +QDLINK:´5905 +QDL1:´6060 +QDEL2:´6291 +QDEL10:´6701 +QDEL11:´6837 +QDEL12:´7399 +QDEL3:´7707 +QDEL8:´7931 +IFN NXLBYT-2, .ERR THIS ROUTINE AND OTHERS KNOW IMPLICITLY THAT NXLBYT=´8489 +QDEL6:´8498 +QDEL7:´8761 +QDEL7A:´8844 +QDFNF:´8927 +QDELB:´8963 +QDLFBT:´9044 +QDLFB1:´9356 +QDLFB2:´9503 +QDLFB3:´9843 +QDLFB9:´9924 +QSQSH:µ0139 +QSQSH1:µ0358 +QSQSH2:µ0476 +QSQSH3:µ0682 +QSQSH4:µ1116 +QSQSH6:µ1193 +QFNG:µ1936 +QLOOK:µ2009 +QLK1:µ2401 +QLK3:µ2610 +QLK2:µ2640 +QFNF2:µ2672 +QFREF:µ2742 +QLOOKA:µ3147 +QLOOK1:µ3246 +QLOOK9:µ3340 +QLOOK4:µ3477 +QLOOK6:µ3789 +QLOOK5:µ3865 +QLOOK8:µ3884 +QLOK5B:µ3962 +QLOK5A:µ4052 +QLOK5D:µ4300 +QLOOK3:µ4354 +QLOK5E:µ4393 +QLOOK7:µ4508 +QLOOK2:µ4732 +QFNG1:µ5054 +QFNG3:µ5162 +QFNG5A:µ5291 +QFNG2:µ5356 +QFNG3A:µ5387 +QFNG5:µ5516 +QFNG4:µ5595 +QFNG4B:µ5696 +QLKI1:µ5760 +QPKNF:µ5815 +QPKNFP:µ6008 +QPKNF3:µ6030 +QPKNF4:µ6169 +QPKNF2:µ6208 +QFDF:µ6257 +QPNL13:µ6318 +QPNL22:µ6356 +QPNLBN:µ6394 +QPNL11:µ6403 +QLGLK:µ6679 +QLGL2:µ7251 +QLGL3:µ7274 +QLGL1:µ7345 +QLGLE:µ7413 +QMLOCK:µ7544 +QMULK:µ7590 +QTLOCK:µ7701 +QTULK:µ7750 +QUDLK:µ7863 +QUDULK:µ7914 +SBTBLI:µ8029 +QBTBLI:µ8038 +SBTBL:µ8073 +QBTBL:µ8081 +TBTBL=µ8155 +TBTBLI:µ8167 +QAPBMN=µ9046 +QAPBMX=µ9253 +QGC:µ9325 +QGC00:µ9477 +QGC10:¶0443 +QGC11:¶0591 +QGC12:¶0705 +QGC13:¶0925 +QGC14:¶1104 +QGC19:¶1403 +QGC20:¶2305 +QGC31:¶2549 +QGC32:¶2842 +QGC39:¶2866 +QGC21:¶3010 +QGC22:¶3212 +QGC23:¶3391 +QGC25:¶3532 +QGC40:¶3706 +QGC41:¶3908 +QGC42:¶4646 +QGC49:¶4747 +QGC50:¶4782 +QGC51:¶5154 +QGC52:¶5273 +QGC53:¶5368 +QGC60:¶5828 +QGC69:¶6026 +QFNTR:¶6252 +QFNT1A:¶6696 +QFNTN:¶6861 +QFNT1:¶7050 +QFNT3:¶7183 +QFNT8:¶7394 +QFNT2:¶7490 +QFNT5:¶7525 +QFNT7:¶7623 +QFNT7A:¶7872 +QFNT4:¶7971 +QFNT6:¶8125 +QBFP:¶8226 +SINLST:¶8324 +SOUTLS:¶8372 +QFCHN:¶8602 +QUSR:¶8687 +DWUSR:¶8717 +SWUSR:¶8751 +QDIRP:¶8796 +QSLBLK:¶8854 +QSLGL:¶8915 +QSGL:¶8945 +QSBI:¶9040 +QSBFS:¶9087 +QPCLSR:¶9164 +QSMDN:¶9233 +OLDRDT:¶9283 +QSRAC:¶9340 +QDSKN:·0623 +DWSKN:·0661 +SWSKN:·0693 +QSCRW:·0735 +QSCABN:·0803 +DWABN:·0868 +SWABN:·0897 +QUDPR:·0929 +QUDFPR:·0986 +QMPTN:·1062 +QMPTC:·1118 +QMTTR:·1161 +QMFTP:·1203 +QERRS:·1324 +QSMPRP:·1381 +QSMPRC:·1426 +QSBYTE:·1482 +QSBSIZ=·1543 +QFBLNO:·1602 +QRADAD:·1685 +QPIBSZ:·1769 +QMPBSZ:·1897 +QLDPTR:·1960 +QSMMP:·2088 +QSDU:·2192 +QSDCH:·2240 +QERS1:·2289 +QDWIP:·2366 +QSDU1:·2439 +QSDCH1:·2479 +QTUNT1:·2512 +QTCHN1:·2548 +NRXFR1:·2587 +NWXFR1:·2607 +NSRXF1:·2618 +NSWXF1:·2629 +LQTM1:·2639 +QMDRO:·2715 +QAMDNO:·2966 +NQFUS:·3028 +QTUTO:·3105 +QDPWF:·3371 +QTWRTM:·3426 +QSFT:·3466 +QSFTS:·3521 +QPKNM:·3576 +QPKID:·3608 +QRESRV:·3671 +NTBL:·3824 +QSKT1:·4032 +QRCAL:·4096 +QSPPS:·4138 +QSEEK:·4204 +QPOS:·4236 +QPOSGL:·4277 +QRCTIM:·4341 +QACT:·4488 +QACTB:·4532 +QWBUFS:·4610 +QWBFMX:·4662 +QHUNGF:·4772 +NTQHNG:·4852 +QTUNT:·4916 +QTCHN:·4952 +QLCHN:·4971 +QWRU:·4992 +MDSK:·5061 +QACTTM:·5096 +QDWFAR:·5247 +LQTM:·5306 +QFTTHR:·5359 +QRDAHD:·5449 +LASTGC:·5517 +QNUD=·5587 +QFUD:·5626 +QSNUD:·5668 +QSNLCN:·5712 +QSNNR:·6017 +QSNMI:·6110 +QSFBT:·6171 +QSALLO:·6738 +UDRSW:·6810 +QCHSW:·6847 +QSKOSW:·6881 +QFBTS:·7094 +QRCSW:·7167 +QCST:·7228 +QERST:·7257 +PKIDM:·7309 +RPKID:·7354 +QDRSTS:·7406 +QXWDS:·7498 +QCHPRG:·7535 +QCHPR2:·7546 +QCHPR4:·7607 +QCHPR3:·7629 +GPKID:·7700 +QRECAL:·7790 +QERST:·7875 +QERDTI:·7906 +QCST:·7936 +QCHPRG:·7966 +IFN KA10P, QIOWD:·7998 +QRECAL:·8107 +QGTBZY:·8125 +QRCSW:·8184 +RDCPHS:·8230 +RCIOWD:·8351 +QRCBUF:·8453 +QCHPRG:·8539 +QCHPGA:·8573 +NCSHI:·8624 +NCSHIL:·8664 +NCSHU:·8721 +NCSHUL:·8757 +QERST:·8810 +QERSTS:·8908 +QERER1:·8941 +QERER2:·8974 +QERER3:·9007 +QERDCL:·9084 +QECPOS:·9117 +QECPAT:·9150 +QCST:·9181 +QGTBZY:·9216 +QECCS:·9262 +QECCAD:·9324 +RHDATO:·9392 +ECCPAG:·9436 +NQDRE:·9503 +NQSATN:·9553 +NQEATN:·9611 +QCHPRG:·9740 +QCHPGA:·9774 +QIOWD:·9825 +QCST:·9852 +QGTBZY:·9886 +QERST:·9934 +QERCS1:·9974 +QERCS2:¸0010 +QERSTS:¸0046 +QERBA:¸0075 +QERWC:¸0118 +QERER1:¸0158 +QERER2:¸0183 +QERER3:¸0208 +QERPOS:¸0233 +QECPOS:¸0243 +QERPAT:¸0273 +QECPAT:¸0283 +QERMAP:¸0312 +QECCS:¸0356 +QECCAD:¸0418 +NQSATN:¸0488 +NQEATN:¸0546 +NQOFFL:¸0596 +DIRHNG:¸0647 +QATTNS:¸0959 +SWAPL:¸1056 +DCHBT:¸1088 +QTRAN:¸1293 +QICL:¸1596 +QICLX:¸1879 +QICLW1:¸1988 +QSICL3:¸2144 +QSICL5:¸2205 +QOCL7:¸2255 +QSICL2:¸2339 +QSICL6:¸2445 +QSICL4:¸2480 +QOCL:¸2658 +QSOCL4:¸2709 +QSOCL6:¸2746 +QSOCL5:¸3293 +QOCL6A:¸3388 +QOCL4:¸3599 +QOCL5:¸3782 +QOCL2:¸3804 +QOCL3:¸4162 +QOCL6:¸4325 +QOCL6B:¸4637 +QOCL1:¸4761 +QSOCL3:¸4891 +QSOC3A:¸5161 +QSOC3C:¸5294 +QSOC3D:¸5483 +QSOC3F:¸5617 +QSOC3E:¸5641 +QSOC3B:¸6285 +QOCLR:¸6323 +QOCLPD:¸6498 +QINT:¸6866 +QINT0:¸7238 +QINTN2:¸7303 +QINTAT:¸7511 +QINTA:¸7864 +QINTE:¸8169 +QINTE1:¸8898 +QIRWRE:¸9158 +QNRDY:¸9221 +QINT:¸9439 +QINTA:¸9639 +QINTE:¹0017 +QINTE1:¹0659 +QINTAT:¹0920 +QRCTMO:¹1200 +QRCTM1:¹1240 +RHSLCT:¹1706 +RHCHEK:¹1730 +RHCLRC:¹1834 +RHCMD:¹1935 +RHCLRD:¹1957 +DSKBRK:¹2027 +QINT:¹2055 +QINT0:¹2287 +QINTAT:¹2707 +QINTA2:¹3799 +QOFFL:¹3892 +QINTE:¹4531 +QINTE1:¹6366 +QINTER:¹6492 +QINTER:¹6641 +UNSAFE:¹7015 +QECC:¹7304 +QINT:¹9809 +QINT0:±00001 +QINTAT:±00401 +QINTA2:±01370 +RHGET:±01488 +RHSET:±01569 +QINTE:±01854 +QINTE0:±03030 +QINTE1:±03967 +QINTER:±04073 +UNSAFE:±04489 +QECC:±04712 +T3INT:±07504 +T3INT2:±08859 +QINTA1:±09172 +QINTI:±09210 +QRC0:±09881 +%QMIDL:±09977 +%QMRD:±10027 +%QMWRT:±10056 +%QMWOV:±10085 +%QMRD1:±10124 +%QMUDR:±10199 +%QMMDR:±10234 +%QMTTR:±10271 +%QMUDW:±10301 +%QMMDW:±10339 +%QMTTW:±10379 +%QMSWP:±10412 +%QMMAX:±10527 +QDFLOS:±10654 +QDFLZ1:±10901 +QRC1:±11236 +QRC2:±12345 +QRC2A:±12865 +QRC3:±12898 +.ELSE BUG INFO,[DSK:±13140 +QRC4:±13216 +QRC5:±13413 +QUFDWF:±13713 +QUDWF1:±14132 +QMFDWF:±14171 +QTUTWF:±14205 +QDWF:±14378 +QUDRIN:±14632 +QINTU4:±15015 +QTUTI1:±15075 +QMDRIN:±15150 +QTUTIN:±15558 +QSWPFN:±15773 +QSWPF2:±16301 +QSWPIF:±16357 +QSWPF3:±16581 +QWOVFN:±17052 +QWRFIN:±17258 +QRD1FN:±17447 +QRDFIN:±17534 +QRDFN1:±17934 +QINT1B:±18100 +QINT1A:±18122 +QINT1E:±18163 +QINT1:±18451 +QINT2L:±18613 +%QMIDL:±19033 +%QMRD:±19077 +%QMWRT:±19106 +%QMWOV:±19135 +%QMRD1:±19169 +%QMUDR:±19232 +%QMMDR:±19264 +%QMTTR:±19296 +%QMUDW:±19328 +%QMMDW:±19398 +%QMTTW:±19438 +%QMSWP:±19499 +%QMMAX:±19608 +SWPACT:±19653 +QRDACT:±20674 +QINT4B:±21102 +QINT4A:±21349 +QINT4G:±21387 +QINT4D:±22369 +QWRACT:±22451 +QDRACT:±22714 +QINT4:±22832 +QINT5A:±22960 +QINT5:±23056 +CSHSWP:±25314 +QINT2F:±25987 +QINT2C:±26166 +QINT2D:±26257 +QINT2E:±26365 +QDE1:±26612 +QINT6A:±26965 +QOVR:±27332 +QINTX:±27947 +QHUNG:±27968 +QINT6A:±28247 +QOVR:±28541 +QECCX:±28665 +QINTX:±29283 +QHUNG:±29304 +QINT6A:±29627 +QOVR:±29881 +QECCX:±30019 +QINTX:±30661 +QHUNG:±30682 +QINT6A:±30986 +QINT6B:±31562 +QINT6C:±31625 +QOVR:±31660 +QOVR1:±31749 +QINTX:±31836 +QINT6S:±31858 +QHUNG:±31960 +QINT6W:±32138 +QNT6W2:±32513 +T3IO:±32665 +T3IO1:±32799 +T3CMD:±33409 +QHUNG1:±33633 +QDE:±33800 +IFN T300P,T3DE:±34047 +QERV2:±34231 +QERV3:±34368 +QERV:±34458 +%QMIDL:±34477 +%QMRD:±34533 +%QMWRT:±34565 +%QMWOV:±34603 +%QMRD1:±34626 +%QMUDR:±34672 +%QMMDR:±34693 +%QMTTR:±34712 +%QMUDW:±34731 +%QMMDW:±34750 +%QMTTW:±34769 +%QMSWP:±34788 +%QMMAX:±34887 +QSWPER:±34907 +QSWER1:±35488 +QERV1:±35569 +QERL2:±35636 +QERL1:±35721 +QEROK:±35783 +QDE2:±35860 +QERSOFT:±35968 +QRECAT:±36305 +QHE:±36438 +IFN T300P,T3HE:±36519 +QREC:±36617 +QREC0:±36863 +QHE2:±37867 +QPE2D:±37977 +QPE2E:±38373 +QUDER1:±38478 +QUDER2:±38534 +QUDER4:±38659 +IFN T300P,T3UDE4:±39001 +QIDRCH:±39078 +QMPDCH:±39295 +QMPDC1:±39407 +QEOF:±39560 +QINT4C:±39770 +QBDCD:±40128 +QBENC:±40373 +QINT3:±40590 +QMDW:±40974 +QMDWA:±41507 +QTDW:±41527 +QTDW1:±41576 +QTDWA1:±42358 +QTDWA:±42384 +QUDW:±42405 +QDW4A:±42427 +QDW4:±42477 +QDW3:±42624 +QINT3X:±42647 +QUDW1:±43095 +QUDW4:±43397 +QUDW3:±43485 +QUDW6:±43521 +QUDW2:±43657 +QUDW2B:±44393 +QUDCLB:±44489 +QDIRCK:±44551 +QDIRC1:±44732 +QDIRC2:±45051 +QPOSR:±45102 +QPOSR:±45660 +QPOSR:±45912 +QPOSRI:±46233 +QSPKID:±46553 +QBO:±46901 +QUIO:±46953 +QUAO:±46960 +QUO1:±46982 +QBOV:±47194 +QBI:±47269 +QUII:±47321 +QUAI:±47328 +QUI1:±47351 +QBIV:±47519 +QBWRA1:±47598 +QBWRA2:±48168 +QBWRA5:±48363 +QBWRA9:±48387 +QBWRA4:±48732 +QBWRA0:±48837 +QBWRA3:±49045 +QBWRA7:±49335 +QBRRA4:±49721 +QSKFRC:±49777 +QSKFIN:±50589 +QBRRA1:±51192 +QBRRA2:±51430 +QBRRA5:±51982 +QBRRA3:±52247 +QWOG1:±52365 +QSBGB:±52666 +QSBWG4:±53153 +QSBGB5:±53790 +QWOG2:±54013 +QLWO:±54151 +QLWO1:±55044 +QSBWG7:±55125 +QSBWG8:±55210 +QSBGB2:±55243 +QSBWG:±55384 +QSBWG1:±55747 +QSTWG:±56075 +QSTWG0:±56468 +QSTWG1:±56788 +QSBWG5:±56933 +QSBWW:±57115 +QTG1:±57426 +QTG3:±57809 +QTG5A:±58118 +QTG5:±58125 +QTG7:±58617 +QTG6:±59112 +QSBWW2:±59358 +QSBWO1:±59500 +QSBWO2:±60099 +QTG4:±60378 +QGTRK:±60557 +QGTK4:±60638 +QGTK4A:±60735 +QGTK3:±60981 +QGTK3A:±61119 +QGTK3D:±61172 +QGTK3B:±61214 +QGTK2:±61468 +QGTK3C:±61648 +QUDS:±61854 +QUDS1:±62730 +QUDSX:±62811 +QSBWW1:±62907 +QSBRB1:±62947 +QSBRB:±62964 +QTG2:±63161 +DIRHO:±63658 +DIRHP1:±63849 +DIRHCL:±64096 +DIRHPS:±64263 +DIRHC1:±64354 +DIRHC2:±64596 +DIRHIP:±64754 +DIRHPP:±65070 +DIRSIG:±65540 +DIRSI0:±65581 + +SYSTEM; ITSDIS +00820,XMIDAS +DIS=²1 +DISMAP=µ3 +LIPSH=¸1 +NWSTK=¹8 +ADSTAR:±18 +NOCLBR:µ33 +RDSCLB:±093 +NOTIED:±366 +RDSTAR:±602 +ADCON1:²160 +ADXIT:²186 +ADSTPX:²250 +ADSTOP:²335 +ADSTPY:²417 +E.SUSM:²702 +ADCONT:²803 +ADSTEP:²956 +ADWORD:³121 +ADCLOS:³307 +DISCHK:³528 +ADRSTA:³600 +ADSSTA:³643 +E.SFU:³736 +E.SFU2:³790 +E.SWT:´113 +ADSTL:´395 +ADSTN=´676 +DSTADD:´701 +E.SPM:´780 +MXDISP=´847 +DISPGP:´891 +DISSWP:´940 +E.SPGW:´983 +E.SPGH:µ028 +E.SCLS:µ056 +E.SSYS:µ108 +E.SIST:µ143 +E.SNTI:µ214 +E.SNUT:µ271 +E.SREL:µ332 +DSTPCT:µ420 +DSCONI:µ472 +EBRKA:µ506 +EBRKU:µ535 +ESBRK:µ555 +E.SUIN:µ886 +E.SPFR:µ928 +E.SFLT:¶005 +E.SILM:¶474 +DCRSTP:¶603 +DISSTQ:¶889 +E.SLPM:·145 +DCRRST:·200 +E.SPCH:·766 +E.SCLB:·893 +UNTIE:¸095 +E.SPG1:¸373 +E.SPGI:¸916 + +SYSTEM; ITSMSP +00426,XMIDAS +MSENTS=µ86 +MSUSER:¶27 +MSCHNL:¶61 +MSBADR:¶98 +MSBCNT:·51 +MSWRIT:·97 +MSWRT2:¸35 +MSREAD:¸73 +MSRED2:¹11 +MSPSW:¹50 + IPCO:±033 +MSRA:±369 +MSRS:±412 +MSR1:±492 +MSR2:±647 +MSR3:²210 +MSSI:²864 +MSSH:²906 +MSS1:³889 +MSDM3:´040 +MSS2:´483 +MSS3:´762 +MSS4:µ213 +MSS5:µ446 +MSS6:µ813 +MSS7:¶859 +MSSTBL:·176 +MSSTB1:·332 +MSSTB3:·567 +MSSTB2:·598 +MSCLOS:·726 + +SYSTEM; TS3TTY +19251,XMIDAS +TTYVRS=²3 +SPYO:±45 +SPYI:³72 +SPYILL:´95 +SPYIL:¶31 +SPYRCH:·62 +STTYO:±198 +STTYO1:±361 +STTYO5:±414 +STTYO4:±796 +STTYO3:²707 +STTYO2:²902 +STTYOA:³377 +STTYI:³758 +STTYIA:³776 +STTYI4:³850 +STTYI2:´097 +STTYI1:´120 +STTYI3:´231 +STTS:´422 +STTSA:´571 +STTS2:´631 +STTS1:´654 +STTS5:µ768 +STTS3:µ920 +STTS4:µ942 +STTS7:¶056 +STTS6:¶070 +STTYW:¶142 +BSTTYW:¶202 +BSTTYX:¶405 +STTYIC:¶497 +STTBI:¶671 +STTBO:¶707 +STYOCL:¶925 +STYICL:·031 +STYCL:·103 +STYCL1:·145 +STYOC3:·460 +STYC4A:·542 +STYOC5:·821 +STYOC9:·871 +STYOC8:¸000 +STYOCF:¸218 +STYFIN:¸387 +STOWHY:¸516 +STIWHY:¸603 +STYIRS:¸738 +STYIR1:¸758 +STYIR4:¹176 +STYIR2:¹321 +STYORS:¹480 +STYOR1:¹500 +STASTO:¹646 +STASTI:¹812 +NSTYGT:±0523 +NSTYG3:±0842 +NSTYG2:±1490 +NSTYG1:±1769 +NSTLGT:±2149 +NATTY:±2536 +AATTY:±2848 +NATTY1:±2983 +AATT1:±3577 +AATT6:±4003 +AATT3:±4272 +AATT8:±4592 +AATT9:±4738 +AATT10:±5067 +ADTTY:±5181 +SDTTY:±5220 +AGBLT3:±5465 +AGBLT6:±6122 +AGBLT4:±7033 +AGBLT2:±7510 +AGBLT1:±7552 +AGBLT5:±7739 +ATTYCI:±8369 +ATTYCW:±8678 +ATTYC:±8900 +ATTYC2:±9020 +ATTYCR:±9169 +ATTYCM:±9300 +ATTYC9:±9404 +ATTYC8:±9666 +ATTYC7:±9783 +ATTYC5:²0031 +ATTYC4:²0336 +ATTYC1:²0648 +ATTYC3:²0781 +ATTYC6:²0946 +ATTYST:²1255 +ATTYS6:²1416 +ATTYS0:²1807 +ATTYS1:²1866 +ATTYS3:²2062 +ATTYS4:²2088 +ATTYS5:²2661 +ATTYGT:²3148 +ATTYG1:²3428 +ATTYG2:²3492 +ASCML:²3953 +ASCML3:²4105 +ASCML1:²4229 +ASCML2:²4528 +ARCPOS:²5026 +NRCPO1:²5120 +NSCPOS:²5972 +NSCPO4:²6142 +NSCPO2:²6410 +NSCPO1:²6859 +NSCPO3:²7021 +NCNSGET:²7372 +ARSSIZ:²7427 +NCNSSET:²7912 +NCNSS0:²8045 +NCNSS3:²8646 +NCNSS1:²9909 +NCNSSH:³0101 +NCNSSV:³0426 +NCNSSP:³0851 +NCNSSG:³1860 +NCNSSF:³2114 +NCNSST:³2225 +NCNSSC:³2546 +TYVSRO:³2682 +TYVTAB:³3240 +LTYVTA=³3491 +TYVTL2=³3510 +TYVGET:³3699 +TYVSET:³4329 +TYVSSM:³4624 +TYSISP:³4727 +TYSOSP:³4764 +BAUDRT:³4965 +NTTYVA:³5134 +NTTYV1:³5595 +NTTYFLS:³6661 +NTTYF1:³6744 +NTTYF2:³6834 +NTTYESC:³6906 +NWHOLI:³7467 +NWHOL2:³8009 +NWHOL3:³8373 +NTVWHE:³8714 +NTVWH1:³8810 +NITYIC:³9096 +AITYI1:³9118 +AITYI2:³9275 +TYIWHY:³9862 +AITYI:´0062 +AITYIC:´0110 +ALISTEN:´0333 +ALIS1:´0416 +TTYFIN:´0510 +NLISTE:´0608 +TTYNGT:´0701 +TTYNG1:´0940 +TTYNG2:´1027 +TYOWHY:´1084 +%TICNS=´1965 +%TJCNS=´2053 +%TJCP1=´2110 +%TJCP2=´2155 +%TJECH=´2224 +%TJCTN=´2329 +%TJSTP=´2380 +%TJDIS=´2437 +%TJSIO=´2478 +%TJMOR=´2545 +%TJPP2=´2597 +%TJINK=´2655 +%TJHDE=´2721 +%TIECH=´2843 +%TIPEK=´2899 +%TIACT=´2946 +%TIINT=´3005 +%TINWT=´3093 +%TIFUL=´3166 +$TIIDX=´3237 +%TINON=´3435 +LPTO:´3552 +TTYO:´3692 +TTYO3C:´3797 +TTYO3A:´4006 +TTYO3B:´4470 +TTYO8:´4777 +TTYFD:´4909 +TTYFD1:´5062 +FLDRCK:´5161 +TTYINI:´5364 +TTYIN1:´6195 +TTYO1:´6478 +TTYO7:´6536 +TTYO2A:´6788 +TTYO2:´6875 +TTYO3:´7024 +TTYO4:´7915 +TTYO5:´8792 +TTYWI:´9078 +TTYWI2:´9239 +TTYWC3:´9395 +TTYWC2:´9659 +TTYWR:´9844 +TTYWO:µ0241 +TTYWO2:µ0388 +TTYWO3:µ0712 +TTYWO1:µ1149 +TTYWO6:µ1448 +TTYWO4:µ1715 +TTYWO5:µ2070 +TTYCMW:µ2260 +TTYSCM:µ2565 +NECHOIN:µ4382 +NECHO1:µ5237 +TTYBI:µ5356 +TYI:µ5463 +TYI0:µ6014 +TYI1B1:µ6416 +TYI1B:µ6586 +TYI1A:µ7096 +TYI1:µ7179 +TYIMP1:µ8049 +TYI2:µ8522 +TYI2Z:µ9285 +TYI3:µ9558 +TYI4:µ9697 +TYINRM:¶0283 +TYINR2:¶0553 +TYIREM:¶1208 +TYIRE1:¶1265 +TYIIWT:¶2230 +TYIFLS:¶3155 +TYIFL2:¶3274 +TYIFL1:¶3813 +TYOPV0=¶4007 +TYOPV2=¶4150 +TYOPV3=¶4199 +TYOSET:¶4601 +TYOSE3:¶4987 +TYOSE4:¶5132 +TYOSE1:¶6096 +TYOSE2:¶6706 +TYOUNS:¶7139 +TYOUN1:¶7229 +TYOUN3:¶7755 +TYOSMR:¶7848 +TTYBO:¶7977 +TTYBO3:¶8029 +TTYBOI:¶8164 +TYO:¶8416 +TTYBO1:¶8572 +TYOBP2:¶8664 +TYO7:¶9142 +TYOBP:¶9536 +TYOBPI:·0708 +TYO6:·1426 +TYO8:·1900 +TYOIG1:·2080 +TYOEO9:·2188 +TYOMT9:·2392 +TYOSIO:·3262 +TYONCC:·3759 +TYOCTP:·3830 +TYOCTS:·4047 +TYOBEL:·4239 +TYOCPP:·4314 +TYOCPQ:·4374 +TYOCTL:·4447 +TYORU2:·4673 +TYOCT1:·4904 +TYOAL1:·5142 +TYOMTA:·5266 +TYOMT3:·5758 +TYOMT5:·5933 +TYOMT1:·5979 +TYOMT2:·6009 +TYOMT6:·6037 +TYOMT4:·6136 +TYOSPC:·6933 +TYONR3:·7639 +TYONRM:·7750 +TYONR0:·7987 +TYONR1:·8176 +TYOCTN:·8763 +TYONR2:·8845 +TYORUB:·9180 +TYORU3:·9350 +TYOLF:·9515 +TYOLF0:·9891 +TYOLF1:¸0172 +TYOLF5:¸0832 +TYOLFE:¸0916 +TYOLF2:¸1141 +TYOLF6:¸1506 +TYOLF7:¸1743 +TYOLF3:¸2021 +TYOLF4:¸2250 +TYOBS:¸2388 +TYOBS2:¸2579 +TYOBS1:¸2724 +TYOBS4:¸2891 +TYOBS3:¸3037 +TYOTAB:¸3314 +TYOTA1:¸3448 +TYOFF:¸3893 +TYOCR:¸4176 +TYOCRL:¸4461 +TYOCR1:¸4517 +TYOALT:¸4605 +TYOAL4:¸4801 +TYOAL3:¸4858 +TYOMVC:¸5263 +TYOASS:¸5794 +TYOAS6:¸6478 +TYOAS7:¸6683 +TYOAS3:¸6861 +TYOAS5:¸6950 +TYOFRC:¸7168 +TYOOUT:¸7336 +TYOOU1:¸7370 +TYOFNX:¸8004 +TYOFND:¸8068 +TYOFNA:¸8130 +TYOFN2:¸8180 +TYOW1:¸8427 +TYOW2:¸8519 +TYOW5:¸8674 +TYOW4:¸8788 +TYOW6:¸8822 +TYOW6A:¸9242 +TYOW6C:¸9418 +TYOW7:¸9580 +TYOW6B:¸9632 +TYOWN:¸9897 +TYOWN2:¹0143 +TYOWN1:¹0491 +TYOIGL:¹0726 +TYOEOP:¹0934 +TYOEO5:¹0970 +TYOEO6:¹1756 +TYOEO7:¹1839 +TYOEO1:¹1988 +TYOEO3:¹2543 +TYOEO4:¹3338 +TYOEO2:¹3840 +TYOCP1:¹3959 +TYOCP4:¹4436 +TYOCPR:¹4771 +TYOCP3:¹4833 +TYOCPV:¹5010 +TYOCPH:¹5047 +TYOFNR:¹5118 +TYOCP2:¹5157 +TYOCH1:¹5563 +TYOCPT:¹5930 +TYOMO1:¹7277 +TYOMOR:¹7341 +TYOCPI:¹7407 +TYOILP:¹7487 +TYODLP:¹7513 +TYOICP:¹7663 +TYODCP:¹7689 +TYOIL1:¹7741 +TYOMVF:¹8015 +TYOMVD:¹8236 +TYOMVB:¹8467 +TYOMVU:¹8670 +TYOSPS:¹8906 +TYORPS:¹9003 +TYOCPA:¹9154 +TYOCLR:¹9428 +TYOCI1:¹9721 +TYOCEF:¹9745 +TYOCEL:¹9786 +TYONMV:¹9863 +TYORU1:±00016 +TYOCIM:±00056 +TYOHMU:±00172 +TYORCR:±00314 +TYOHMD:±00657 +TYOHD1:±00699 +TYODLB:±00797 +TYODLF:±01034 +STATYO:±01736 +STATY1:±01941 +STATYI:±02075 +STATY3:±02306 +STATY2:±02442 +TYOIOP:±02775 +TYIIOP:±02809 +TYIOP1:±03080 +TYIOPT:±03375 +STYOIP:±03492 +STYIIP:±03510 +TYICLS:±03634 +TYCLOS:±03748 +TYOCLS:±04262 +TYICL2:±04437 +TYOWC:±04687 +TTYLO1:±04953 +TTYLO2:±05711 +TTYLO3:±05963 +TTYLFC:±06559 +TTLFC1:±06815 +TYIRS:±06929 +TYIRS0:±06997 +TYIRS1:±07229 +TYORS:±07610 +TYORS1:±08350 +TYORS4:±08640 +TYORS8:±09142 +TYORS5:±09288 +TYORS7:±09357 +TYORS6:±09564 +TYORS2:±10366 +TYORS3:±10556 +TTRSAL:±10735 +TTRSA1:±10757 +TTRSA2:±11008 +TT11IN:±11280 +TT11I1:±11498 +TT11I2:±12242 +TT11I3:±12434 +TT11I4:±12668 +TT11LS:±12791 +TT1LS1:±12985 +TT11D1:±13134 +TTTMNT:±13444 +TTTMN2:±13509 +TTTMN0:±13590 +TTTMN1:±14068 +TTTMTO:±14226 +TTECH:±14596 +TTELUP:±14683 +TTELU4:±14876 +TTEDU2:±15703 +TTELP1:±15880 +TTELP2:±16288 +TTELP5:±17144 +TTELP4:±17615 +TTELU1:±17841 +TTELP3:±18270 +TTELP6:±18503 +TTELBG:±18965 +TTEDUN:±19133 +TTEDU5:±19191 +TTEDU4:±19549 +TTEDU3:±19558 +TTEDU1:±19653 +TTEWAT:±19747 +TTELU3:±20007 +TTEDU6:±20230 +TTEBAK:±20720 +TTEBA1:±21005 +DEFINE TTYSAV±21328 +PCLOC=±21335 +TTYBRK:±21645 +TTYRET:±22509 +TTYRT3:±22518 +DPKPE:±22779 +CONC DZ,\.RPCNT,RB:±22994 +CONC DZ,\.RPCNT,XB:±23144 +DEFINE DZSAV±23293 +DZRBK:±23686 +DZRBK1:±23851 +DZXBK:±24418 +DZXBK1:±24488 +TTDTE1:±25128 +TTDTE2:±25850 +TTDLB0:±26769 +TTDLIN:±27854 +DPTO1:±28062 +DPTI1:±28485 +NTY1:±28569 +TTYRT2:±28993 +MTY1:±29055 +MTY6:±29256 +MTY2:±29555 +MTY3:±29657 +GOTTY:±29752 +NTYI1:±30071 +NTYI3:±30298 +NTYI5:±30555 +NTYI2:±31141 +IFN TTLPTP,[INLPT:±31263 +TYBN:±31556 +TYBPFX:±32293 +TYBRET:±32404 +TYBRT1:±32453 +TYBRT2:±32479 +TYBRT3:±33434 +TYBCTL:±33746 +TYBXIT:±34271 +TYBRED:±34293 +TYBC:±34370 +TYBCR1:±34510 +TYBPRN:±34853 +TYBP:±35217 +TYBR:±35592 +TYBZ:±35702 +TYBI:±35763 +TYBA:±35894 +TYBST:±36055 +TTYI:±36305 +TTYI2:±36373 +TTYI2A:±36429 +TTYI2B:±36891 +TTYI11:±37086 +TTYI15:±37359 +TTYI12:±37665 +TTYI5:±38588 +TTYI13:±38980 +TTYI18:±39119 +TTYI19:±39259 +TTYIS5:±39673 +TTYI7:±39935 +DING1:±40155 +TYCLWR:±40318 +TTYSAM:±40437 +GETGRP:±40741 +GETGR1:±40981 +GETGR2:±41078 +DEFINE GGRPTB±41156 +GRPTBL:±41212 +GRPBPT:±41605 +TTECIN:±42062 +TTECI1:±44622 +TTECI2:±44808 +TTECIL:±45047 +TTECI9:±45071 +TTECIR:±45144 +TTECIM:±45343 +TTECIX:±45473 +ZFLAG:±45543 +ZFLAG7:±46116 +ZFLAG4:±46597 +ZFLAG2:±46622 +ZFLAG3:±47149 +TTYICB:±47288 +TYCGTN:±47655 +TYCI:±47714 +TYCI4:±48186 +TYCI3A:±48334 +TYCI3:±48456 +TYCI22:±48620 +TYCMB:±48833 +TYCMB1:±48930 +TYCMB2:±49044 +TYCI2:±49405 +TYCI17:±49465 +TYCI6:±49621 +TCNRM:±50125 +TYCI7:±50183 +TYCI7D:±50410 +TYCI7A:±50452 +TYCI7F:±50535 +TYCI2A:±50580 +TYCI7B:±50686 +TYIQT:±50822 +TYCD:±51919 +TYCH:±52082 +TYCJ:±52246 +TYCJ1:±52271 +TYCFLS:±52488 +TYCB:±52719 +TYCRFT:±52826 +TYCRFA:±53273 +TYCRF0:±53464 +TYCRF1:±53961 +TYCRF2:±54009 +TYCS1:±54216 +TYCRDE:±54557 +TYCRED:±54649 +TYCI40:±54752 +TYCI39:±54775 +TYCSET:±54905 +TYCI63:±55028 +TYCREP:±55320 +TYCRE0:±55396 +TYCRE2:±55779 +TYCRE1:±55818 +TYCA:±55926 +TYCQA:±56007 +TYCQAC:±56144 +TYCR:±56491 +TYCQR:±56580 +TYCQRF:±56721 +TYCQ:±57041 +TYCQLS:±57304 +TYCQL1:±57443 +TYCQRP:±57839 +TYCQR1:±57856 +TYCQR2:±58012 +TYCC:±58121 +TYCK:±58184 +TYCS:±58243 +TYCI19:±58292 +TYCI27:±58745 +TYCI28:±59357 +TYCI52:±59654 +TYCI29:±59679 +TYCI30:±59766 +TYCI31:±59879 +TYCI53:±60275 +TYCI34:±60966 +TYCI32:±61089 +TYCI33:±62260 +TYCI37:±62450 +TYCI36:±62501 +TYCI44:±62660 +TYCI68:±63419 +TYCI64:±63502 +TYCI62:±63731 +TYCI71:±63776 +TYCI41:±64032 +TYCI66:±64137 +TYCI72:±64277 +TYCI67:±64554 +TYCI91:±64657 +TYCI42:±64699 +TYCI92:±64877 +TYCI43:±65164 +TYCI45:±65921 +TYCI46:±65966 +TYCI69:±66126 +TYCI70:±66235 +TYCRW:±66455 +TYCRW2:±66704 +TYCRW4:±66878 +TYCG:±67182 +TYCG21:±67276 +TYCG5:±67611 +TYCG3:±67766 +TYCG1:±68177 +TYCG2:±68228 +TYCK1:±68489 +TYCK2:±68757 +TYCN:±68948 +TYCGTM:±69264 +TYCGT3:±69401 +TYCGT4:±69559 +TYCGT2:±69863 +TYCGT5:±69997 +TYCI73:±70198 +TYPSC:±70424 +TYP:±70613 +TYP0:±70669 +TYP0F:±71004 +TYP1B:±71153 +TYP1D:±71597 +TYP1E:±71798 +TYP1G:±72107 +TYP1I:±72695 +TYP1H:±72842 +TYPDA1:±73039 +TYP1C:±73108 +TYP1F:±73251 +TYP0N:±73303 +TYP0A:±73409 +TYP0C:±73805 +TYPLUP:±73948 +TYPLU1:±74021 +TYPLU2:±74988 +MNULLO:±75055 +TYPSIO:±75305 +TYPOU2:±75670 +TYPOUT:±75857 +TYPSFW:±75988 +IRPS TYPSF1,,TYPSF4:±76572 +TYPSF3:±76579 +TYPSF2:±76586 +TYPSF1:±76593 +TYPSF1:±76628 +TYPSF0:±76775 +IFE NETP,TYPSFS=±76885 +=,Y!B=±7633 +Z=±7754 +IFE Z-".,Z=±7769 +TBL:±7851 +NUM:²1138 +LE1:²1309 +DOLLAR:²1348 +PERC:²1355 +LET:²1399 +LET1:²1603 +LE1A:²1646 +LE2:²1664 +NUM1:²1756 +NM1:²1858 +NM1A:²1939 +NM1A1:²1975 +NM1B:²2052 +NM1C:²2479 +NM1D:²2581 +POWER:²2638 +POW2:²2838 +PERIOD:²2914 +QUAN:²3311 +PILOC:²3355 +QUAN1:²3378 +QUAN2:²3398 +CONTROL:²3464 +EVAL:²3506 +EVAL0:²3542 +EVAL1:²3606 +EVAL2:²3640 +EVAL3:²3770 +CPOPJ1:²4134 +CPOPJ:²4171 +KILL:²4293 +KILRET:²4479 +KILLA:²4498 +KILL1:²4738 +KILL2:²4798 +REMUN:²4862 +DS:²4992 +TAG:²5109 +DEFIN:²5227 +ADEFIN:²5271 +DEF1:²5381 +DEF2:²5523 +DEF3:²5617 +DEF4:²5850 +LISTF0:²5932 +LOAD0:²5953 +DUMP0:²5973 +LISTF0=²6012 +LOAD0=²6024 +DUMP0=²6036 +SETNAM:²6062 +SET2:²6084 +MULT:²6187 +DIVD:²6212 +ASSEM:²6260 +MINUS:²6281 +PLUS:²6297 +LPRN:²6328 +INDIRECT:²6473 +ACCF:²6530 +COMWD:²6874 +SPACE:²6922 +SPAC1:²6952 +RPRN:²6987 +RPRN1:²7160 +VARRW:²7197 +TAB:²7216 +LI1B:²7236 +LINEF:²7255 +LI1A:²7314 +LI0:²7448 +LI1:²7479 +LI2:²7607 +CARR:²7734 +OCON:²7812 +OSYM:²7852 +SLASH:²7902 +SLAS1:²8041 +ICON:²8075 +PLOC:²8138 +ASLASH:²8307 +IKON:²8402 +DEPRA:²8507 +DEPRA2:²8668 +EQUAL:²8767 +PSYM:²8792 +R50PNT:²8842 +HWRDS:²8958 +SFLOT:²8988 +RATP:²9016 +ASCSET:²9046 +SIXSET:²9077 +SYMBOL:²9106 +CON:²9131 +RELA:²9167 +ABSA:²9221 +BASECH:²9258 +SDEC:²9310 +SOCT:²9329 +SET:²9362 +GO:²9461 +XEC:²9574 +XEC0:²9607 +XECKS:²9847 +XEC1:²9887 +DQUOTE:²9974 +IASCO:³0122 +TEXO1:³0264 +TEXO10:³0283 +TEXO11:³0307 +TEXO12:³0325 +SQUOTE:³0404 +ISIXO:³0551 +SIXO1:³0569 +DQOT2:³0708 +SQOT2:³0913 +ISTRING:³1085 +ISTR1:³1146 +ISTR2:³1249 +SASEM:³1296 +SASME:³1336 +DISF:³1394 +BP0:³1523 +TBP1:³1583 +TBP2:³1628 +BP1=³1683 +B1INS=³1696 +BPN=³1707 +BCOM:³1802 +BCOM3:³2073 +BCOM2:³2161 +LEAV:³2471 +LEAV1:³2546 +BREAK:³2562 +BREAK1:³2945 +PROCEDE:³3091 +PROCD0:³3214 +PROCD1:³3353 +PROC0:³3390 +PROC1:³3548 +PROC2:³3595 +IXCT4:³3660 +IXCT:³3691 +IXCT5:³3738 +IXCT6:³4131 +BPLUP:³4197 +INC1:³4244 +IPUSHJ:³4336 +IJSA:³4410 +IJSR:³4473 +IJSR2:³4507 +IJSR3:³4550 +IJSP:³4585 +INSRTB:³4676 +INSRT1:³4697 +INSRT3:³4991 +REMOVB:³5228 +REMOV1:³5271 +REMOV3:³5458 +BPS:³5733 +BPS1:³5949 +BPS2:³6092 +BPS3:³6452 +BPS4:³6473 +BPS5:³6748 +AUTOP:³6847 +OIPBIT=³7133 +1PRCNT:³7150 +1POADR:³7200 +1PNSV:³7245 +CTLN:³7293 +CTLN1:³8020 +1PRTR1:³8043 +1PRTRP:³8114 +1PRBRK:³8458 +CTLN:³8902 +ONEPRO:³9063 +IFNDEF CTLN, CTLN=³9119 +DEPRS:³9135 +DEPR:³9157 +DEP:³9238 +DEP1:³9332 +FETCH:³9368 +FIRARG:³9476 +ULIM:³9521 +ULIM1:³9556 +LOOK:³9622 +LEND1A:³9781 +ENDT:³9831 +LLUP:³9922 +LLUPI1:³9944 +LLUP1:´0038 +LLUPD:´0226 +CJLP1:´0266 +LEND1:´0297 +LOOK1:´0342 +CONSYM:´0406 +CONSM:´0429 +CONS1:´0448 +PIN:´0492 +PI3.1:´1015 +PI3:´1047 +PI3A:´1124 +PI4:´1141 +PI5:´1236 +PI7:´1343 +PI7.1:´1430 +HLFW:´1507 +SPAD:´1597 +PAD:´1611 +PADSO:´1674 +PADS1:´1712 +PADS2:´1846 +PAD1:´1867 +PADS3:´1892 +PADS3A:´1915 +PADS3B:´1963 +PADS4:´1986 +INOUT:´2020 +INOUT1:´2238 +MASK:´2381 +MASK2:´2473 +MASK1:´2521 +OVRD:´2553 +OVRD1:´2572 +OVRD2:´2655 +MSKTB:´2716 +EFFEC:´2761 +AWORD:´2790 +NWORD:´2823 +SEARC:´2867 +SEAR1:´3118 +SEAR1B:´3221 +SEARMD:´3230 +SEAR2:´3260 +SEAR2A:´3295 +SEAR2E:´3355 +SEAR2C:´3493 +SEAR2D:´3555 +SEAR1A:´3609 +SEAR2B:´3660 +SEAR3:´3741 +SEAR4:´3976 +EFFEC0:´4014 +EFFEC1:´4092 +EFFEC2:´4173 +EFFEC3:´4294 +EFFEC4:´4311 +SETUP:´4344 +SETUP1:´4369 +SETUP2:´4403 +ZERO:´4569 +ZERO1:´4606 +ZERO2:´4804 +FTOC:´5228 +TOC:´5234 +TOCA:´5279 +TOC1:´5317 +TOC3:´5351 +TOC2:´5386 +CJTOUT:´5419 +TOC4:´5465 +TOC5:´5511 +TPER:´5543 +SPT:´5574 +SPT1:´5677 +SPT2:´5775 +BRKRET:´5913 +TTYRET:´5937 +TTYRT:´6079 +TTY1:´6209 +TTYLEV:´6574 +DRESET:´6636 +WRD:´6836 +WRD2:´6845 +PRNC:´6854 +FRASE:´6864 +SYL:´6872 +DEN:´6880 +ZLWT:´6889 +TEM2:´6898 +LPTRST:´6909 +LPTFLG:´6920 +TTYFLG:´6931 +ESTU:´6941 +ESTUT:´6953 +FSV:´6963 +FRACT:´6973 +FPWR:´6982 +FTERM:´6992 +FH:´6999 +SYM:´7015 +DEFV:´7024 +ULIMIT:´7035 +LLOC:´7044 +LLOCO:´7074 +PLCR:´7083 +LOCBF:´7093 +DIS1:´7114 +ACSTG:´7122 +INST:´7138 +LWT:´7146 +TEM:´7154 +TEM1:´7163 +PRGM:´7172 +DSSAV:´7196 +OUTSW:´7208 +SPTS:´7217 +ALTPC:´7235 +ALTPC1:´7280 +DISSW:´7302 +SATPP:´7336 +SATPT:´7348 +DIS2:´7369 +DISACS:´7378 +HIGH:´7481 +SAVPI:´7500 +SAVTTY:´7518 +MSK:´7528 +B0ADR:´7572 +B1ADR:´7674 +B1SKP:´7684 +B1CNT:´7694 +TB1ADR:´7797 +TB2ADR:´7816 +BNADR=´7843 +AUTOPI:´7855 +AC0:´8004 +AC17:´8020 +SWAP,TWENTY:´8036 +SCH:´8083 +AR:´8090 +ODF:´8098 +SCHM:´8107 +ARM:´8182 +ODFM:´8196 +SARS:´8207 +FRASE1:´8258 +TEM3:´8265 +INSW:´8274 +DISCNT:´8297 +DISPN1:´8308 +SAVE:´8345 +SAV1:´8500 +SAV5:´8634 +TATP:´8823 +SATP:´8981 +SATPL:´9061 +SATPC:´9141 +BDISP:´9187 +DISP:´9243 +DEFINE ZD´9265 +DECDMP:µ0179 +IFIX:µ0459 +IFIX1:µ0730 +DDTEND:µ1064 + +SYSTEM; DDTDSK +02650,XMIDAS +da=³6 +db=·9 +dc=¸6 +dd=¹3 +nudsl=±58 +icwa=³50 +lowfix=³93 +blksiz=´34 +maxtry=´72 +maxlnk=µ43 +swpags=¶22 +swpblk=·02 +bootbl=·65 +mfd=¸27 +ufd=¸58 +corbfr=¸90 +iobfr=¹28 +tut=¹65 +lowswp=±014 +maxdmp=±110 +lowclr=±152 +rdatao=±257 +wdatao=±305 +kl, swpua=±358 +define errhlt±471 +define bughlt±507 +dskcod=±537 +pdaccl:±643 +pdacc2:±908 +rp4map:²080 +redblk:²408 +wrtblk:²477 +rwblk:²502 +rwblk0:²572 +rwblk1:²744 +rwblkl:²886 +xfer:²942 +xfer2:³580 +rhset:´040 +rhget:´079 +swpin:´374 +swpout:´643 +swpi1:´760 +swpio:´932 +swpbfp:µ091 +swpbfi:µ428 +swpbfo:µ529 +nxttut:µ807 +redtut:µ899 +wrttut:µ925 +tutio:¶052 +redmfd:¶159 +mfdufd:¶198 +redufd:¶290 +wrtufd:¶359 +wrtuf1:¶497 +reset:¶640 +reset0:¶725 +reset1:·027 +resetl:·066 +reset3:·122 +lookup:·896 +linklk:¸176 +look1a:¸291 +look1b:¸430 +look2:¸529 +look3:¸833 +ulook:¹025 +ulook1:¹182 +ulook2:¹379 +ulook3:¹598 +ulook4:¹727 +ufdbp:¹930 +ulink:±0175 +ulink1:±0312 +redlnk:±0457 +linkl:±0564 +link1:±0804 +links:±0912 +fsdele:±1012 +zapdsc:±1341 +zaplop:±1841 +zapl1:±1972 +zaprf:±2105 +zaprf1:±2405 +outopn:±2709 +outo1:±3070 +outo11:±3190 +pikpak:±3737 +piknxt:±3968 +piknx1:±4339 +piknx2:±4728 +outo0:±5123 +outo01:±5314 +outbuf:±5794 +tutpnt:±5935 +inpopn:±6349 +fsin:±6439 +rfsblk:±6582 +fsbfr:±6779 +fserr:±7026 +advblk:±7347 +fsjmp:±7895 +advb0:±8105 +advb01:±8165 +fsout:±8245 +fsout1:±8293 +fsout2:±9166 +fsout3:±9367 +fsout4:±9633 +outeof:±9841 +outef1:²0272 +ufdput:²0458 +wrdi0:²0811 +wrdi:²0942 +wrdo0:²1101 +dmpo:²1203 +wrdo:²1221 +acsav:²1351 +acrest:²1428 +pushfn:²1535 +popfn:²1595 +dump:²1699 +dump1:²2207 +dump2:²2554 +dump2a:²2783 +dump3:²2806 +dumpb:²3069 +dumpb1:²3133 +wrdoa:²3302 +dumpj:²3396 +dumpj1:²3678 +dskex:²3820 +load:²3917 +load1:²4154 +load2:²4469 +load3:²4542 +load4:²4717 +ckserr:²4965 +loads:²5090 +loadii:²5229 +loadi:²5745 +fd:²5984 +fdhi:²6296 +fdhi1:²6529 +fdswp:²6660 +listf:²7055 +listf1:²7218 +listf3:²7333 +listf2:²7613 +wboot:²7698 +getfil:²8138 +getfl3:²8195 +getfl1:²8219 +getfl2:²8260 +getfl4:²8400 +getfl5:²8569 +drive:²8654 +cylndr:²8665 +sector:²8676 +surfce:²8687 +ioadr:²8697 +dsktmp:²8745 +xfrcnt:²8799 +cu:²8848 +mu:²8869 +ufdblk:²8893 +qact:²8921 +sname:²9140 +fn1:²9172 +fn2:²9197 +wrdcnt:²9264 +wrdptr:²9302 +lblock:²9339 +blkcnt:²9378 +dirpt:²9435 +tutpt:²9475 +lnkcnt:²9504 +lnkptr:²9582 +lnkufd:²9638 +pknum:²9690 +qded:²9712 +dmpnxt:²9737 +blkin:²9811 +swporg:²9880 +swpor1:²9936 +litter:²9994 +vars:³0011 + +SYSTEM; DSKDMP +05162,XMIDAS +.MLLIT=´2 +DEFINE SETFµ9 +FLG=±19 +.TTYFLG=±44 +.TTYFLG=±80 +IFSE FLAG,YES,FLG=²10 +IFSE FLAG,NO,FLG=²31 +IFSE FLAG,Y,FLG=²51 +IFSE FLAG,N,FLG=²71 +IFNDEF FLG,FLG=²90 +IFN RP06P, RM03P=±152 +IFN RP06P+RM03P, RM80P=±179 +IFN RP06P+RM03P+RM80P, RH10P=±212 +IFN RP06P+RM03P+RM80P+RH10P, DC10P=±251 +IFN RP06P+RM03P+RM80P+RH10P+DC10P, RP10P=±296 +IFE RP06P+RM03P+RM80P+RH10P+DC10P, RP10P=±341 +IFE BOOTSW, SETF [Number of dirs? (DM-KA:±388 +IFN KS10P, KL10P=±547 +IFN KS10P+KL10P, KA10P=±574 +IFE KS10P+KL10P, KA10P=±601 +RH11P=±613 +DEFINE RP±645 +DEFINE SC±674 +DEFINE RH±703 +DEFINE PH±732 +DEFINE KA±763 +DEFINE KL±792 +DEFINE KS±821 +C=±906 +A=±930 +B=±935 +D=±940 +BLKIN=±949 +WRITE=±987 +DIFF=²028 +HEAD=²059 +P=²088 +BLOK=²107 +UNIT=²116 +CMD=²147 +T=²169 +TT=²189 +BUFP=²232 +KA, TTY=²631 +MEMSIZ=²680 +IFNDEF DBGSW,DBGSW=²730 +DDT=²764 +IFN DBGSW,MEMSIZ=²795 +CORE=²850 +CORES=²916 +NSWBL=²996 +HIGH=³074 +NDSK=³123 +RP,ICWA=³189 +RH,ICWA=³201 +PH, UBPG=³216 +KA, LPM=³272 +KA, LPMR=³291 +KL, PAG=³307 +DEFINE INFORM³341 +ZZZ:´521 +WBOOT1:µ243 +WBOOT0:µ685 +WBOOT0:¶322 +.....:·104 +......:·172 +....:·307 +PROG:·420 +BEG:·488 +ERROR:¸408 +LOADG1:¸695 +ERMESS:¸889 +XX=¹095 +PD:¹133 +PD2:¹163 +PD1:¹228 +PNO:¹341 +C12:¹347 +WRCB:¹523 +LODUMP:¹672 +LODMP1:¹791 +FD:¹894 +FDX:±0169 +FD4:±0313 +FD3:±0404 +FD3B:±0496 +FD3A:±0553 +GBP:±0759 +WD:±0909 +WD1:±1106 +WD2:±1264 +WD3:±1295 +NXTTUT:±1344 +RDTUT:±1544 +RDTUTX:±1804 +NXTBW3:±1839 +NXTBW:±2023 +NXTBW5:±2184 +NXTBW6:±2395 +NXTBW2:±2442 +NXTBW1:±2594 +NXTBW4:±2910 +NXTBLK:±3042 +NXTB6:±3138 +NXTB1:±3536 +NXTB1A:±3600 +NXTB2:±3824 +NXTB3:±3968 +WRDB1:±3990 +WRDM:±4052 +RDM:±4105 +WRM:±4154 +MU:±4198 +WRDB:±4267 +WRD:±4331 +RD:±4385 +WR:±4434 +CU:±4479 +WRD3A:±4534 +WRD3:±4541 +WRD5:±4853 +WRDX:±5558 +WRD0:±5686 +DBLK:±5803 +SEEK:±5815 +RECAL:±5830 +CLATT:±5845 +WRDM:±5897 +RDM:±5950 +WRM:±5999 +MU:±6043 +WRDB:±6112 +WRD:±6176 +RD:±6230 +WR:±6279 +CU:±6324 +WRD3A:±6379 +WRD3:±6386 +WRD5:±6866 +WRD7:±7290 +WRDX:±7666 +WRD0:±7716 +WRD0A:±8012 +RHCHEK:±8289 +WRDM:±8403 +RDM:±8456 +WRM:±8505 +MU:±8549 +WRDB:±8618 +WRD:±8682 +RD:±8736 +WR:±8785 +CU:±8830 +WRD3A:±8885 +WRD3:±8892 +WRD5:±9250 +WRDX:²0032 +WRD0:²0160 +WRD0A:²0329 +RHSET:²0635 +RHGET:²0660 +DBLK:²0820 +WRDM:²0863 +RDM:²0916 +WRM:²0965 +MU:²1012 +WRDB:²1081 +WRD:²1145 +RD:²1199 +WR:²1248 +CU:²1296 +WRD3A:²1351 +WRD3:²1372 +WRD5:²1618 +WRD4:²2246 +WRD4A:²2472 +WRD0:²2653 +WRD2:²2856 +WRDX:²3063 +DBLK:²3194 +DBLK1:²3265 +GPKID:²3336 +TYI:²3517 +TYI0:²3625 +TYO:²4084 +CRLF:²4656 +TYI1:²4688 +LINK:²4816 +LINKL:²4934 +LINKQ1:²5096 +LINKN1:²5145 +LINKN:²5267 +LINKQ:²5353 +READ:²5427 +READ1A:²5501 +READ1:²5592 +READ3A:²5613 +READ2:²5693 +READ3:²6325 +ONOFF:²6426 +ALT1:²6558 +ALTMOD:²6709 +ALT2:²6932 +DOIT:²7065 +MLOOK2:²7284 +MLOOK:²7636 +MLOOK1:²7779 +ULOOK:²7961 +ULOOK1:²8149 +ULOOK2:²8297 +ULOOK4:²8432 +ULOOK3:²8773 +ULOOK5:²9037 +LOAD:²9147 +ZERO:²9247 +ZERO1:²9774 +ZERO2:²9926 +ZERO3:³0126 +ZERO4:³0394 +LOAD1:³0666 +LOAD2:³0735 +LOAD3:³0900 +LOADB:³1054 +LOAD4:³1064 +LOADS:³1435 +LOADS1:³1934 +LOADBD:³2417 +LOADS2:³2543 +LOADS4:³2595 +LOADJ:³2903 +LOADG0:³2963 +LOADG:³3038 +GO:³3205 +GO1:³3234 +GO1:³3477 +LISTS:³3758 +LISTS2:³3778 +LISTS1:³4006 +LISTFC:³4177 +LISTF1:³4204 +LISTF2:³4600 +KILL:³4637 +KILL1:³4945 +DUMP0:³5171 +DUMP:³5245 +DMP0:³5308 +DMP1:³5362 +DMP2:³5531 +DMP5:³5888 +DMP3:³5959 +DMP4:³6053 +DUMP.5:³7111 +DUMP1:³8079 +DUMP1A:³8286 +DUMP6:³8300 +DUMP7:³8363 +DUMP8:³8439 +DUMP2:³8597 +DUMP2A:³8649 +DUMP3:³8991 +DUMP3B:³9152 +DUMP3A:³9204 +DUMP4:³9420 +DUMPJ:³9574 +DMP9J1:³9733 +DUMP9:³9943 +KILDMP:´0465 +KD1:´0679 +UDBLK:´0780 +KD2:´0865 +GTP:´0908 +QTRAN:´1167 +ERRCT:´1428 +DDTM2:´1454 +DUMP9J:´1492 +DUMP9S:´1534 +DUMP9K:´1579 +LBLOCK:´1629 +BLKCNT:´1669 +DIRPT:´1728 +TUTPT:´1769 +FN1:´1796 +FN2:´1818 +PKNUM:´1842 +QDED:´1901 +XWDS:´1947 +RPKID:´1963 +BOOTNS:´1974 +BADBLK:´2170 +BEG=´2275 +CBOOT:´2315 +BOOT:´2356 +BOOT0:´2596 +BOOT1:´2761 +ERRWD:´2989 +CLATT1:´3011 +SWPSK:´3033 +SWPIN1:´3058 +SWPIN2:´3110 +SWPOU1:´3153 +SWPOU2:´3196 +CBLK:´3292 +RP3ADJ:´3361 +SUNIT0:´3407 +SKWAIT:´3425 +WAIT:´3603 +BOOT:´3880 +BOOT0:´4083 +BOOT1:´4179 +BOOT2:´4223 +ZZ1=´4379 +ZZ2=´4456 +ZZ3=´4501 +ZZ4=´4517 +ZZ1=´4533 +ZZ2=´4592 +SWPADR:´4627 +SWPCS2:´4735 +SWPCS1:´4773 +LSWPADR=´5129 +SWPVAL:´5246 +CBLK:´5839 +WAIT:´5862 +BOOT:´5927 +BOOT0:´6191 +BOOT1:´6405 +ZZ1=´6546 +ZZ2=´6623 +ZZ3=´6668 +ZZ4=´6684 +ZZ1=´6700 +ZZ2=´6759 +ERRWD:´6793 +SWPIN1:´6815 +SWPIN2:´6846 +SWPIN3:´6915 +SWPIN4:´6943 +SWPIN5:´6981 +SWPIN6:´7009 +SWPOU1:´7049 +SWPOU2:´7080 +SWPOU3:´7149 +SWPOU4:´7177 +SWPOU5:´7215 +SWPOU6:´7243 +CBLK:´7281 +WAIT:´7348 +BOOT:´7399 +SWPINJ:´7571 +DADR=´7591 +DADR1=´7673 +SWPIN:´7743 +SWPOUT:´8045 +CBLK:´8317 +WAIT:´8383 +SADR:´8425 +SYSN:´8476 +CBUF:´8734 +DBUF:´8773 +DIR:´8804 +TUT:´8840 + +SYSTEM; IOELEV +13563,XMIDAS +A=¶89 +B=·11 +C=·28 +D=·45 +H=·62 +I=¸08 +SP=¸45 +PC=¸68 +PS=¸93 +SWR=¹21 +RTI=¹81 +%TTYFLG=±072 +%TTYFLG=±109 +VERSION=±486 +DL10P=±684 +DTE20P=±705 +NODDT=±736 +NFTTY=±755 +NDHS=±794 +NDHUN=±823 +DHIBAS=±864 +DHCBAS=±905 +NDLS=±939 +CTYP=±967 +NMPTYS=²005 +NDMS=²131 +GOULDP=²206 +T300P=²250 +CHAOSP=²296 +CHSBTB=²337 +CHAD0=²400 +DLCADR=²452 +CHAD1=²516 +TEN11P=²548 +ETHERP=²580 +FTPULS=²604 +FTGARB=²661 +MAXBSZ=²707 +DL10P=²860 +DTE20P=²891 +NODDT=²912 +NFTTY=²941 +NDHS=²978 +NDHUN=³007 +DHIBAS=³047 +DHCBAS=³088 +NDLS=³122 +CTYP=³150 +NMPTYS=³187 +NDMS=³252 +GOULDP=³309 +T300P=³343 +CHAOSP=³389 +TEN11P=³424 +ETHERP=³462 +MAXBSZ=³486 +TKS=³655 +TKB=³668 +TPS=³681 +TPB=³694 +RTI=³838 +RTT=³846 +DL10P=³909 +DTE20P=³933 +NODDT=³964 +NFTTY=´005 +NDHS=´042 +NDHUN=´071 +DHIBAS=´111 +DHCBAS=´152 +NDLS=´186 +CTYP=´262 +NMPTYS=´300 +NDMS=´345 +GOULDP=´387 +T300P=´421 +CHAOSP=´467 +CHSBTB=´508 +CHAD0=´570 +CHAD1=´649 +CHADD=´712 +TEN11P=´784 +T11ADR=´858 +NT11BF=´935 +ETHERP=µ000 +ETHHSN=µ021 +NDVRBF=µ078 +DVRADR=µ106 +FTPULS=µ142 +FTGARB=µ199 +MAXBSZ=µ280 +TX=µ582 +HX=µ604 +NCT=µ629 +NLTTY=¶203 +LASTTY=¶258 +LKS=·384 +HNGDLY=·433 +GLPCSR=·538 +GLPWC=¸151 +GLPCA=¸192 +GLPBSZ=¸230 +NGLPBF=¸278 +CAICSR=¸933 +CH%CSR=¸969 +CAIMYN=¹982 +CH%MYN=±0016 +CAIWBF=±0079 +CH%WBF=±0122 +CAIRBF=±0407 +CH%RBF=±0448 +CAIRBC=±0784 +CH%RBC=±0834 +CAIXMT=±1181 +CH%XMT=±1239 +PKMAX=±1560 +DATMAX=±1633 +PKHDW=±1678 +PKTMXW=±1715 +PKOP=±1791 +PKNBYT=±1969 +PKNBMS=±2023 +PKFC=±2069 +PKFCMS=±2117 +PKDHST=±2155 +PKDIND=±2186 +PKSHST=±2218 +PKSIND=±2245 +PKPKN=±2272 +PKACN=±2304 +PKDAT=±2340 +.=±2817 +.=±2877 +.=±2893 +ZZ=±3206 +.=±3212 +DLXCSR:±3229 +VERS:±3818 +DLXUP:±3904 +TTYST:±4025 +TYILIN:±4116 +TYICHR:±4206 +TYOSTS:±4264 +TYOBSZ:±4354 +TYOPNT:±4418 +TYOCNT:±4474 +TYOLIN:±4529 +HNGLIN:±4599 +LPRLIN:±4754 +LPRLPR:±4835 +LPRBSZ:±4907 +EXDSTS:±4975 +EXDADR:±5083 +EXDDAT:±5127 +GLPPTR:±5201 +GLPCTR:±5245 +GLPTER:±5291 +GLPGRF:±5327 +DLCINI:±5406 +DLCSP1:±5478 +DLCSP2:±5519 +DLCSS1:±5545 +DLCSS2:±5603 +DLCRP1:±5628 +DLCRP2:±5672 +DLCRS1:±5701 +DLCRS2:±5779 +.=±5902 +DSCCHK:±5926 +DSCREQ:±6001 +DSCDON:±6079 +DSCFLT:±6209 +DSCSTS:±6547 +DSCCMD:±7314 +DSCDRV:±8110 +DSCCYL:±8134 +DSCHED:±8214 +DSCSEC:±8239 +DSCPNT:±8616 +DLXHGH:±8649 +.=±8654 +DTEFLG=±8883 +DTEF11=±8966 +DTECMD=±9050 +DTECLK=±9335 +DTEVER=±9538 +DTECHK=±9639 +DTEINP=±9776 +DTEOUT=²0052 +DTELSP=²0639 +DTELPR=²0702 +DTEOST=²0760 +DTETYI=²0866 +DTEODN=²0958 +DTEHNG=²1054 +TENSW=²1681 +EXAM=²1739 +EXAMT=²1956 +DPOS=²2055 +DPOST=²2224 +D10MON=²2325 +$PMSG=²2391 +$CNTLC=²2464 +DLYCNT=²3122 +TO10AD=²3315 +TO10BC=²3384 +TO11AD=²3550 +TO11BC=²3619 +STATUS=²4080 +DIAG1=²5120 +DIAG3=²5342 +.=²5654 +.=²5723 +.=²5912 +.=²5996 +.=²6080 +.=²6259 +.=²6352 +.=²6395 +.=²6545 +.=²6728 +.=²6864 +.=²7164 +.=²7233 +.=²7327 +MPXENB:²7338 +.=²7436 +STKBAS:²7449 +.=²7511 +SADR=²7550 +T11BFL=²7709 +T11I10:²8069 +T11I11:²8127 +T11OBF:²8263 +T11IBF:²8341 +DMCSR:²9305 +DMLSR:²9352 +DHSCR:²9406 +DLKS=²9913 +DHNRC:³0472 +DLKB=³0739 +DHLPR:³0930 +DHCA:³1387 +DLCA=³1425 +DHBC:³1455 +DLBC=³1497 +DHBAR:³1546 +DLPS=³1659 +DHBCR:³1817 +DLPB=³1930 +DHSSR:³2006 +DHOAC:³2197 +DLOAC=³2275 +DHTYNO:³2350 +DLTYNO=³2430 +STROUT:³2533 +T HDWR:³2708 +T DHLSEL:³2978 +T DHLBIT:³3116 +T BUFPNT:³3265 +T BUFSIZ:³3333 +T NRMIPC:³3452 +T TTYIPC:³3885 +T AUTOSP:³4019 +M2LMAP:³4380 +T DIALED:³5048 +T TTYHNG:³5266 +T TYPING:³5363 +DLXOFF:³5579 +NO.ITS:³5632 +VERSN:³5704 +DMINI:³5750 +WAKE:³5823 +HNGSIG:³5878 +10RQ:³5921 +LITHSE:³5946 +CLKENB:³5971 +KLDCPF:³6024 +DDTMOD:³6087 +DDTCHR:³6131 +CURSWR:³6180 +OUTCMD:³6223 +OUTSVI:³6294 +OUTSVC:³6341 +INPCMD:³6389 +INPSVI:³6459 +INPSVC:³6505 +MPXOAC:³6581 +MPXOLN:³6636 +MPXSEL:³6674 +MPXPNT:³6725 +MPXNBT:³6795 +MPXHED:³6848 +NSUBNT=³6982 +DLCRBN:³7055 +DLCNXT:³7110 +DLCIBF:³7152 +T11OBP:³7238 +T11IBP:³7273 +T11IBA:³7310 +T11CKE:³7438 +T11TIM:³7482 +ETHSBN=³7565 +ETHMXH=³7680 +ETHIBF:³7749 +ETHHDW=³7827 +EGTBUF:³8063 +EGTPLN:³8111 +EGTPID:³8156 +EGTSRC:³8248 +EGTSBN:³8319 +DVRHST:³8450 +DVRIDX:³8500 +DVRLIX:³8528 +DVRTIM:³8570 +DVRRTR:³8619 +DVRBFL=³8664 +DVRBUF:³8766 +DVRBF2:³8817 +DVRBFP:³8897 +DVRMSK:³8958 +DVRPKP:³9088 +DVRID:³9148 +DVROFS:³9264 +NDVRFK:³9326 +PULSAR:³9395 +PULSON:³9471 +USECBL:³9559 +NCHX=³9628 +.IIF DF NDVRBF, NCHX=³9727 +CHSGBF:³9773 +CHSGBH:³9848 +CHSGBS:³9911 +CHSGBC:³9961 +NPKSGB:´0071 +HPKSGB:´0163 +NPKSRL:´0223 +HPKSRL:´0577 +CHSRLH:´0637 +CHSRLC:´0707 +NPKSLS:´0749 +HPKSLS:´0834 +NPKSAB:´0887 +HPKSAB:´0983 +NPKSI:´1042 +HPKSI:´1107 +NPKSO:´1157 +HPKSO:´1221 +NPKSIG:´1272 +NPKSBD:´1321 +HPKSBD:´1377 +NPKSRF:´1428 +RFSBNT:´1484 +CHSIBF:´1758 +HSTNAM:´1934 +.IIF NZ DL10P, CHXDLC=´2327 +.IIF NZ TEN11P, CHXT11=´2366 +CHXCHS=´2396 +.IIF NZ ETHERP, CHXETH=´2457 +.IIF NZ ETHERP, CHXEGT=´2516 +.IIF DF NDVRBF, CHXDVR=´2596 +CHIBFP:´2765 +CHIHDL:´3095 +CHISTS:´3173 +CHILNG:´3247 +CHIOUX:´3310 +CHICBA:´3401 +CHIRFL:´3454 +CHIHWR:´3655 +CHOHWR=´3982 +CHOSTS:´4021 +CHOINX:´4172 +CHOXMT:´4229 +CHXSBN:´4449 +CHXRTF:´4754 +CHSIDL:´4846 +CHSRST:´4914 +SBNTYP:´5062 +SBNADR:´5257 +SBNCST:´5653 +ZZ=´5864 +DLCSBN=´5888 +.=´5944 +.=´5969 +.=´5999 +T11SBN=´6095 +.=´6152 +.=´6177 +.=´6207 +.=´6707 +.=´6732 +.=´6762 +.=´6806 +4SEC:´6829 +15SEC:´6864 +PAT:´6932 +99$:´7165 +RINGIN=´7204 +RINGOT=´7215 +RINGCT=´7226 +RINGSZ=´7237 +RINGTP=´7248 +RINGBT=´7260 +RINGBF=´7272 +TYORNG:´7315 +TYIRSZ=´7539 +TYIRNG:´7592 +PUT:´7717 +1$:´7772 +2$:´7861 +GET:´8011 +1$:´8054 +2$:´8143 +CLRING:´8200 +LH:´8496 +RH:´8529 +SNB:´8564 +HWEXAM:´8776 +HWDEP:´9432 +1$:´9499 +UHUNG:´9851 +1$:´9916 +MAIN:µ0008 +666$:µ0178 +1$:µ0392 +2$:µ0657 +4$:µ0664 +5$:µ0839 +10$:µ1006 +11$:µ1522 +12$:µ1574 +CHKOST:µ1641 +CHKOUT:µ1916 +CHKIN:µ2202 +CHKDON:µ2537 +CHKHNG:µ2882 +1$:µ3042 +2$:µ3229 +CHKLPR:µ3539 +CHKCHS:µ3832 +CHKEXD:µ4029 +21$:µ4166 +CHKGLD:µ4259 +20$:µ4478 +1$:µ4585 +MAINX:µ4720 +MAINE:µ4749 +MAIN:µ4817 +10$:µ5329 +CLKSER:µ5723 +1$:µ5933 +2$:µ6056 +3$:µ6423 +4$:µ6470 +TENDED:µ6665 +LOSSAG:µ6780 +KLDCPR:µ6847 +TENSER:µ6881 +INPDON:µ6947 +1$:µ7096 +OUTDON:µ7281 +1$:µ7421 +INPSER:µ7636 +OUTSER:µ7905 +OUTSR1:µ8102 +1$:µ8457 +MAINJ:µ8546 +OUTSR2:µ8566 +BEGIN:µ8704 +LBEGIN=µ8770 +FINAL:µ8838 +TENSR0:µ9001 +1$:µ9240 +9$:µ9325 +2$:µ9445 +3$:µ9690 +5$:µ9730 +6$:µ9783 +7$:µ9834 +TENSR1:µ9945 +1$:¶0246 +CHKOST:¶0332 +CHKTRN:¶0670 +1$:¶0846 +CHKLSP:¶1033 +1$:¶1317 +CHKTYI:¶1363 +CHKODN:¶1672 +CHKHNG:¶2012 +1$:¶2179 +2$:¶2366 +MAINX:¶2664 +MAIN:¶2745 +666$:¶2969 +TYOSER:¶3175 +11$:¶3278 +12$:¶3310 +2$:¶3490 +3$:¶3591 +TYOFIN:¶3803 +GIVMSG:¶4183 +ASPACK:¶4375 +DWNMSG:¶4427 +IBOMSG:¶4460 +STRDH:¶4608 +STRDL:¶4998 +CPOPJ:¶5106 +STRMPK:¶5135 +STRMPX:¶5232 +2$:¶5326 +10$:¶5420 +15$:¶5440 +GLPTYO:¶5859 +1$:¶6019 +2$:¶6054 +GLPNCL:¶6465 +8$:¶6710 +9$:¶6885 +10$:¶6920 +12$:¶7107 +13$:¶7133 +15$:¶7222 +16$:¶7337 +GLPNRM:¶7469 +GLPNXC:¶7518 +GLPNBF:¶7635 +GLPNB1:¶7689 +GLPESC:¶7809 +GLPEOF:¶8006 +GLPEN1:¶8078 +GLPEND:¶8115 +1$:¶8332 +GLPPUT:¶8400 +5$:¶8615 +6$:¶8696 +GLPBGB:¶8918 +GLPBWW:¶9234 +1$:¶9302 +4$:¶9490 +2$:¶9544 +5$:¶9683 +6$:·0108 +3$:·0272 +GLPCOL:·0320 +GLPROW:·0355 +GLPLIM:·0428 +GLPOAC:·0474 +GLPGF1:·0521 +GLIMBO:·0572 +GLIMBF:·0624 +GLPFIL:·0664 +GLPTIM:·0709 +GLPERR:·0747 +DSKCRA=·0876 +DSKCRB=·1331 +DSKCSR=·1371 +DSKCTA=·2184 +DSKCTB=·2252 +RQBACT:·2434 +RQBID:·2500 +RQBSTS:·2553 +RQBFLT:·2608 +RQBLNK:·2681 +RQBCMD:·2734 +RQBDRV:·2780 +RQBCYL:·2825 +RQBHED:·2874 +RQBSEC:·2919 +RQBWC:·2965 +RQBMA:·3015 +RQBMAH:·3059 +RQBID1:·3160 +RQBID2:·3193 +RQBMNT:·3226 +DSKBUF:·3365 +DSKSTR:·3455 +10$:·3670 +30$:·4275 +99$:·4470 +DSKBRK:·4526 +4$:·4768 +5$:·4829 +10$:·5049 +20$:·5522 +30$:·5611 +35$:·5853 +80$:·6260 +99$:·6419 +SPARAM:·6599 +1$:·6633 +2$:·6668 +3$:·6741 +4$:·6828 +5$:·7153 +CONC DH,\.RPCNT+1, PTP OUT OF TAPE +PUNCC: PUNSIZ*4-4 +PUNIP: (1000)PUNBO-1 +PUNOP: (1000)PUNBO-1 +PUNBO: BLOCK PUNSIZ +PUNBE: + +BBLK + +PUNCLR: MOVEI A,PUNSIZ*4-4 + MOVE B,PUNIP + MOVEM A,PUNCC + MOVEM B,PUNOP + POPJ P, + +PUNFIN: MOVE T,PUNSIZ*4-4 ;.CALL FINISH + CAMLE T,PUNCC + PUSHJ P,UFLS + POPJ P, + +AFEED: HRRZ A,(R) + CAIL A,PTPI ;LOWEST PTP DEV # + CAILE A,PTPWB ;HIGHEST PTP DEV # + POPJ P, ;PTP NOT OPEN ON CHNL + MOVEI A,0 + PUSHJ P,PIPUN3 + JRST POPJ1 + +SUBTTL PAPER TAPE READER ROUTINES + + PTRCHX==10 ;NUMBER OF CHARACTERS IGNORED AT END OF TAPE + +PTRO: PUSH P,[PTRO1] ;SO STDOPN WILL RETURN + JSP Q,STDOPN + 7,,PTRUSR + REDUAI,,REDBAI ;ASCII MODE + REDUII,,REDBII ;IMAGE MODE + REDUTI,,0 ;ALL 8 HOLES MODE + REDUTI,,0 ;" " " " + + ;RETURN FROM STDOPN +PTRO1: POPJ P, ;OPEN LOST + AOS (P) ;OPEN WON, MAKE RETURN SKIP + SKIPE PTRUSE + POPJ P, ;READER ALREADY OPEN, DON'T RESET + ;READER NOT ALREADY OPEN, SO + ;RESET PTR POINTERS AND START UP READER + CONO PI,PTROFF ;INHIBIT INTERRUPTS + MOVEI T,20 ;BUSY FLAG + PUSHJ P,PTRST ;START UP READER IF NOT ALREADY RUNNING + ;RESET PTR BUFFER POINTERS +PTRZAP: MOVE A,[041000,,PTRBUF-1] ;BUFFER BYTE POINTER + MOVEM A,PTRIP ;BUFFER INPUT (INTERRUPT) POINTER + MOVEM A,PTROP ;BUFFER OUTPUT (IOT) POINTER + MOVEI A,PTRCHX ;REINITIALIZE CHARACTER COUNT + MOVNM A,PTRCC ;" " " + CONO PI,PTRON ;RE-ENABLE INTERRUPTS + JRST PTRSIW ;RESET STATUS OF IMAGE WORD AND RETURN + + ;CLOSE CHANNEL ON WHICH PTR OPEN + +PTRCLS: CONO PI,PTROFF ;INHIBIT INTERRUPTS + SOSL PTRUSE ;DECREMENT USE COUNTER + JRST PTRONJ ;PTR OPENED ON MORE CHANNELS + SETOM PTRUSR ;NO MORE OPENS ON READER, INDICATE NO USER + SETOM PTRDIE ;EVENTUALLY TURN OFF READER + JRST PTRZAP ;RESET BUFFER STATUS + +PTRRS: CONO PI,PTROFF ;PTR .RESET ROUTINE + JRST PTRZAP + + ;BLOCK ASCII INPUT + +PTRBAI: JSP E,INBTCH ;DO IT A CHARACTER AT A TIME + + ;GET AN ASCII CHARACTER IN W + +PTRUAI: +PTRCHA: PUSHJ P,PTRCH ;GET CHARACTER - SKIPS IF EOF. + TRZA W,200 ;CLEAR 200 BIT + JRST POPJ1 + JUMPE W,PTRCHA ;IF RESULT ZERO THEN DON'T CALL IT ASCII + CAIN W,177 ;IF RUBOUT, + JRST PTRCHA ;THEN IGNORE IT + POPJ P, ;ASCII, USE IT + +PTRBII: JSP W,WRDBTI ;BLOCK IMAGE INPUT. + + ;UNIT IMAGE INPUT + ;END-OF-FILE GIVES SIXBIT /######/ + +PTRUII: PUSHJ P,PTRCH ;GET CHARACTER + TRNE W,200 + CAIA ;CALL IT BINARY IF 200 SET, OR IF EOF. + JRST PTRUII + IDPB W,PTRIBP + JUMPL W,PTRUI2 ;IF REACHED EOF, SKIP 1 OR 2. + SOSLE PTRICC ;IF WORD NOT FULL, + JRST PTRUII ;THEN GO BACK FOR MORE + JRST PTRUI1 ;ELSE RETURN THE WORD. + +PTRUI2: SOSG B,PTRICC + JRST PTRUI3 + CAIE B,5 + JRST PTRUII + JRST PTRUI4 + +PTRUI3: AOS (P) ;IF WE REACHED EOF, SKIP TWICE. +PTRUI4: AOS (P) ;REACHED EOF BEFORE WORD; SKIP ONCE. +PTRUI1: MOVE W,PTRIW ;WORD FULL, +PTRSIW: MOVEI B,6 ;NOW REINITIALIZE POINTERS TO WORD + MOVEM B,PTRICC ;CHARACTER COUNT OF WORD + MOVE B,[440600,,PTRIW] ;POINTER TO WORD + MOVEM B,PTRIBP + POPJ P, + + ;GET A CHARACTER IN W OR SKIP RETURNING -1,,EOFCH IF NONE AVAILABLE + +PTRUTI: ;UNIT MODE ALL-HOLES INPUT. +PTRCH: MOVEI T,20 ;BUSY FLAG + PUSHJ P,PTRCHW ;WAIT FOR A CHARACTER + PUSHJ P,UFLS + SOSGE I,PTRCC ;DECREMENT CHARACTER COUNT + JRST PTRCH1 ;BUFFER EMPTY + MOVEI T,10 ;DONE FLAG + CAIGE I,REDSIZ-PTRCHX ;IF BUFFER LESS THAN 1/4-FULL, + PUSHJ P,PTRST ;THEN MAKE SURE READER RUNNING + ILDB W,PTROP ;GET CHARACTER + HRRZ B,PTROP ;RING THE BUFFER + CAIL B,PTRBUF+REDSIZ-1 + MOVEI B,PTRBUF + HRRM B,PTROP + POPJ P, + + ;END-OF-FILE ENCOUNTERED DURING PTRCH + +PTRCH1: AOS PTRCC ;RESTORE CHARACTER COUNT TO ITS ORIGINAL STATE + JRST UNIEOF + + ;SKIP IF CHARACTER IN BUFFER OR END-OF-TAPE + +PTRCHW: SKIPG PTRCC ;IF CHARACTER IN BUFFER, + CONSO PTR,400 ;OR POWER IS OFF, + JRST POPJ1 ;THEN EXIT SKIPPING + ;OTHERWISE, + ;MAKE SURE READER RUNNING + +PTRST: CONSZ PTR,7 + CONSO PTR,30 ;IF RUNNING, + JRST .+2 + POPJ P, ;THEN THAT'S ALL + CONO PTR,PTRCHN(T) ;NOT RUNNING, RESTART WITH SELECTED FLAG + SETOM PTRDIE ;LET SLOW CLOCK FIGURE OUT IF THERE'S TAPE + POPJ P, + + ;PTR INTERRUPT ROUTINE + +PTRBRK: AOSN PTRSTP ;IF READER SHOULD BE STOPPED THIS BREAK, + JRST PTRFUL ;THEN STOP IT (BUFFER FULL) + DATAI PTR,A ;GET CHARACTER + SETOM PTRDIE ;TELL SLOW CLOCK THAT BREAK HAS HAPPENED + IDPB A,PTRIP ;PUT IN BUFFER + HRRZ A,PTRIP ;RING THE BUFFER + CAIN A,PTRBUF+REDSIZ-1 + MOVEI A,PTRBUF + HRRM A,PTRIP + AOS A,PTRCC ;TOTAL CHARACTER COUNT-PTRCHX + CAIGE A,REDSIZ*4-10-PTRCHX + JRST LPBKRT + SETOM PTRSTP ;STOP READER AT NEXT BREAK + JRST LPBKRT + +PTRFUL: CONO PTR,PTRCHN ;BUFFER FULL, STOP READER + MOVEI A,1 ;TELL SLOW CLOCK... + MOVEM A,PTRDIE ;NOT TO TURN IT OFF + JRST LPBKRT + + ;SLOW CLOCK ROUTINE + ;CHECKS READER EVERY HALF-SECOND + +PTRCHK: AOS A,PTRDIE + CAIN A,1 ;IF UNINTENTIONALLY STOPPED FOR OVER HALF-SECOND + CONO PTR,400 ;THEN TURN THE READER OFF + POPJ P, + +EBLK + ;PTR VARIABLES + +PTRDIE: -264 ;END-OF-TAPE DETECTION +PTRSTP: 0 ;-1 => STOP READER AT NEXT BREAK (SET DURING BREAK WHEN BUFFER FULL) +PTRIP: 041000,,PTRBUF-1 ;BUFFER INPUT (INTERRUPT) POINTER +PTROP: 041000,,PTRBUF-1 ;BUFFER OUTPUT (IOT) POINTER +PTRBUF: BLOCK REDSIZ ;READER BUFFER +PTRCC: -PTRCHX ;NUMBER OF CHARACTERS IN BUFFER -PTRCHX + +PTRIW: 0 ;CURRENT WORD FOR IMAGE MODE +PTRIBP: 440600,,PTRIW ;POINTER TO CURRENT WORD +PTRICC: 0 ;CHARACTER COUNT TO CURRENT IMAGE MODE WORD + +BBLK + +] ;END OF IFN PTRP + +SUBTTL LINE PRINTER ROUTINES + +IFN NLPTP,[ +NLPTO: MOVE A,UTMPTR(U) + SKIPGE NLUSR + SKIPL TTYTYP-USRRCE(A) + JRST TPLO + SETOM NLFREE + MOVEI T,LPTBSZ + CAME T,NLPTBR ;WAIT TILL LPT BUFFER IS EMPTY. + PUSHJ P,UFLS + CONSZ NLPT,207 ;AND LPT ISN'T STILL PRINTING LAST WD + PUSHJ P,UFLS + PUSH P,[NLPTO1] + JSP Q,STDOPN + 1,,NLUSR + NLPTDN,,NLPTBN + +NLPTO1: POPJ P, ;LPT NOT AVAIL & NOT ASSIGNED. + ;LPT ASSIGNED, INIT IT. + CONO NLPT,1000 ;PUT LPT INTERFACE IN IMAGE MODE, + DATAO NLPT,[23*2] ;TURN ON THE LPT'S MOTOR. + MOVEI I,1000 + CONSZ NLPT,200 ;WAIT TILL IT IS ON. + SOJG I,.-1 + AOS (P) +NLPTO3: HRROI I,NLPTCF + HRROI C,I + PUSHJ P,BNLPTO ;CAN'T PCLSR SINCE BUFFER IS EMPTY. + HRRZ I,NLPTBP + HRLI I,010700 + MOVEM I,NLPTIP + POPJ P, + +NLPTCF: 15_29.+14_22.+177_15.+177_8+177_1 +] + +IFN GLPTP,[ ;GOULD ELECTROSTATIC PRINTER ROUTINES + +IFE DL10P,.ERR GOULD PRINTER WITHOUT A PDP11 TO RUN IT? + +;OPEN ROUTINE + +GLPTO: SKIPE GLPTER + JRST OPNL7 ;DEV NOT READY IF 11 UNHAPPY + MOVEI Q,[1,,LPTUSR + GLPTDN,,GLPTBN] + PUSHJ P,STDOPN + POPJ P, + SETZM GLPGRF + TLNE C,10 ;BIT 3.4 => GRAPHICS MODE. + SETOM GLPGRF + JRST POPJ1 + + + + + + +;IOT ROUTINES + + SKIPA T,[SIOKT] ;SIOT HANDLER = UNIT HANDLER MINUS ONE +GLPTDO: MOVEI T,CHRKTO + MOVE E,[440700,,5] + JRST GLPTOO + +GLPTBO: MOVEI T,BLKT + MOVE E,[444400,,1] +GLPTOO: JSP B,(T) + SETZ GLPMPP + GLPMPC + GLPBGB + GLPBWW + JRST 4,. + SKIPE GLPTBC + +;CLOSE ROUTINE + +GLPCLS: SKIPE GLPMPP ;IF THERE'S AN UN-SENT BUFFER, + PUSHJ P,GLPBWW ;BARK AT THE PDP11 + SKIPE GLPTBC ;WAIT FOR ALL BUFFERED STUFF TO BE SENT + PUSHJ P,UFLS + PUSHJ P,GLPBG0 ;AVOID IOCERR AT NEXT OPEN + IRPS CH,,12 14 177 105 + MOVE C,[SETZ I] ;AT CLOSE SEND FF, EOF + MOVEI I,CH ;THIS CAN'T PCLSR ONCE IT GETS A NEW BUFFER. + PUSHJ P,GLPTDO + TERMIN + SETZM GLPGRF + PUSHJ P,GLPBWW ;WRITE LAST BUFFER + SETOM LPTUSR + SETOM LPTUSE + POPJ P, + +;BUFFER GET ROUTINE + +GLPBGB: SKIPE GLPTER + JRST IOCER1 ;DEV NOT READY IF 11 UNHAPPY ABOU IT. + SKIPE GLPTBC + POPJ P, ;BUFFER BUSY +GLPBG0: MOVEI TT,GLPTBF + MOVEI J,GLPBSZ + JRST SIOBGX + +;BUFFER DISCARD ROUTINE + +GLPBWW: MOVE D,[450000,,GLPTBF-1] ;DL10 BYTE POINTER (7-BIT BYTES) + SKIPE J,GLPGRF + HRLI D,340000 ;GRAPHICS MODE => 8-BIT BYTES + MOVEM D,GLPTBP + SKIPN D,GLPMPP ;COMPUTE # CHARS IN BUFFER + POPJ P, + JUMPL D,[SOJA D,GLPBW1] + MOVEI TT,15 ;INDEPENDENT OF E, BLOCK VS UNIT, ETC. + TLNE D,760000 + JRST [ IDPB TT,D ? JRST .-1 ] +GLPBW1: MOVEI D,-GLPTBF+1(D) + IMUL D,[4 ? 5]+1(J) ;GRAPHICS => 4, ELSE 5. + MOVEM D,GLPTBC ;START THE PDP11 + SETZM GLPMPP ;FLAG THAT BUFFER IS NOT ACTIVE AT M.P. LEVEL + SETZM GLPMPC + POPJ P, + +;NOTE: TPL CODE HAS DELIBERATELY BEEN OMITTED. +;THE DL10 LIMITS THE BUFFER SIZE TO 256 WORDS. WITH THIS SMALL +;A BUFFER THE SYSTEM JOB CAN'T DRIVE THE PRINTER AT FULL SPEED +;BECAUSE IT CAN ONLY IOT ONCE A SECOND OR SO. +;ANYWAY, THE NECESSARY TPL CODE IS HAIRY. +] ;END IFN GLPTP + +IFN OLPTP,[ + +LPTLPP==60. + +LPTO: CAMN U,OLUSR + JRST LPTO2 ;ALREADY HAS IT + MOVE A,UTMPTR(U) ;GET POINTER TO USER RESOURCE + ;(TTY DEPENDANT) + SKIPL TTYTYP-USRRCE(A) + JRST TPLO +LPTO2: PUSH P,[LPTO1] + JSP Q,STDOPN + 1,,OLUSR + LPTDN,,LPTBN + +LPTO1: POPJ P, ;OPEN LOST + SKIPE OLUSE ;OPEN WON + JRST POPJ1 ;NOT FIRST OPEN BY THIS USER + AOS (P) +LPTRS2: MOVEI A,15 ;ENTRY FROM LPTRS, DUMP OUT CRUD ON THIS LINE THEN FORM FEED + PUSHJ P,PILPT + MOVEI A,14 + JRST PILPT + +BLPTO: MOVEI E,PILPT + JRST NBTOCH + +PILPT1: SKIPGE C + SKIPA A,(C) + UMOVE A,(C) + ANDI A,177 +PILPT: CAIN A,177 + POPJ P, ;IGNORE RUBOUTS + MOVEI T,130. ;LPTCC COMPARED WITH 132. BY SYSTEM JOB BEFORE TRY OF .OPEN + CAMLE T,LPTCC + JRST LPTW1 ;WAIT +LPTIM: CAIGE A,40 + JRST LPTRC + CAIL A,140 + SUBI A,40 +LPTIM2: AOSN LPTBSF + PUSHJ P,LPC ;PRINT PREV STUFF AND SPACE OVER + AOS T,LINEPOS +BADCOL: CAIN T,-1 ;PATCH NUM OF BAD COL IN HERE WHEN NECESSARY + JRST LPTBC1 + CAILE T,120. + JRST PILPT2 +LPC1: SUBI A,40 + IDPB A,LPTIP + HRRZ A,LPTIP + CAIN A,LPTBE-1 + MOVEI A,LPTBO + HRRM A,LPTIP + SOS LPTCC + CONSO OLPT,7 + CONO OLPT,LPTCHN + POPJ P, + +LPTBC1: PUSH P,A + MOVEI A,40 + PUSHJ P,LPC1 + POP P,A + JRST LPC1 + +LPTRC: CAIN A,10 + JRST LPTBS ;BACK SPACE + CAIN A,11 + JRST LPTTAB + CAIN A,12 + JRST LPTLF + CAIN A,14 + JRST LPTFF + CAIN A,EOFCH + JRST LPTEOF + SETOM PCL + CAIE A,15 + JRST LPTRCH +LPT.CR: SETZM LINEPOS + SETZM LPTBSF + JRST LPC1 + + PUSHJ P,LPTW2 +LPTW1: PUSHJ P,UFLS + JRST LPTIM + +LPTW2: CAMLE T,LPTCC + POPJ P, + MOVE T,LPTCC + CAIL T,*2 + JRST POPJ1 + JRST POPJ3 + +LPTBS: SKIPG LINEPOS + POPJ P, ;AT BEG OF LINE, IGNORE + SOS LINEPOS + SETOM LPTBSF + POPJ P, + +LPTRCH: CAIN A,33 + JRST LPTALT + MOVE B,A + MOVEI A,"^ + PUSHJ P,LPTIM2 + MOVEI A,100(B) + JRST LPTIM2 + +LPTALT: MOVEI A,"$ + JRST LPTIM2 + +PILPT2: SOS LINEPOS + POPJ P, + +LPTEOF: SKIPE OLUSR + POPJ P, + SUB P,[1,,1] ;SYSTEM JOB HACKING SO CLOBBER TO EOF + XCTR XRW,[CLEARM (C)] + POPJ P, + +LPTCLS: SKIPLE OLUSE ;LPT CLOSE, IS THIS THE ONLY CHANNEL LPT OPEN ON + JRST LPTCL3 + SKIPN LINEPOS ;THIS IS LAST CLOSE, CHECK TO SEE IF LOSER LEFT POSITION SCREWED + SKIPE LPTPPS + PUSHJ P,LPTCL2 ;INCREMENT TO NEXT PAGE + MOVEI T,SCRTPC + IORM T,SUPCOR ;LOOK FOR TPL FILES TO PRINT + SETOM OLUSR ;DO THIS FIRST SO DONT NEED CLOCK OFF LPT HACKED BY ONE JOB AT A TIME +LPTCL3: SOS OLUSE ;DECREMENT USE COUNT + POPJ P, + +LPTCL2: MOVEI A,100. + CAMLE A,LPTCC + POPJ P, ;NO ROOM FORGET IT + MOVEI A,15 + PUSHJ P,LPTIM + MOVEI A,14 + JRST LPTIM + LPTTAB: PUSHJ P,LPTS + LDB J,[300,,LINEPOS] + JUMPE J,CPOPJ + JRST .-3 + +LPTS: MOVEI A,40 + JRST LPTIM2 + +LPTLF: AOS J,LPTPPS ;LINE FEED, INCREMENT LINE # + CAIL J,LPTLPP ;END OF PAGE? +LPTFF: SETZM LPTPPS ;END OF PAGE CLEAR OUT PAGE POS (ENTRY FOR FF) + PUSHJ P,LPC + JRST LPC1 + +LPC: MOVE J,LINEPOS ;CR AND SPACE BACK OVER TO LINPOS + MOVE B,A + MOVEI A,15 + AOSN PCL + SKIPE LINEPOS + PUSHJ P,LPT.CR + CLEARM LPTBSF ;IN CASE WAS ALREADY AT BEG OF LINE + SOJL J,LPC2 + PUSHJ P,LPTS + JRST .-2 + +LPC2: MOVE A,B + POPJ P, + +EBLK + +LPTCC: *5-5 +LINEPOS: 0 ;LINE POSITION # CHARS PRINTED THIS LINE BEFORE CURRENT +LPTPPS: 0 ;PAGE POSITION (# LINES PRINTED BEFORE CURRENT) + +PCL: 0 ;INCREMENTED BY LF OR FF, SETOMED BY OHTER CONTROL CHARS + ;PROBABLY UNNECESSARY BUT NOT WORTH FLUSHING +LPTBSF: 0 ;-1 => BACKSPACES HAVE BEEN TYPED, CR AND SPACE OVER BEFORE MAKING INK + +LPTIP: 700,,LPTBO-1 +LPTOP: 700,,LPTBO-1 + +BBLK + +LPTCN: CAIN A,<15-40>&177 + JRST LPTCR ;CRR + CAIN A,<12-40>&177 + MOVEI A,400 ;LINE FEED + CAIN A,<14-40>&177 + MOVEI A,401 ;FORM FEED + CAIE A,177 ;SKIP IF LOOKS LIKE A LEFT ARROW + JRST LPTCN1 ;GO TO PRINT + HRRZ A,LPTOP ;LOAD OUPUT POINTER + CAIE A,LPTBE-1 ;SKIP IF CURRENT PNTR = END OF BUFFER + JRST LPENT3 ;REAL LEFT ARR + MOVE A,[350700,,LPTBO] + MOVEM A,LPTOP + JRST LPENT2 +] + +IFN NLPTP,[ +NLPT1: SKIPGE C + SKIPA A,(C) + UMOVE A,(C) + MOVE B,NLPTIP + TLNN B,760000 + JRST NLPTW ;MAY NOT BE ROOM +NLPTW1: IDPB A,NLPTIP + MOVE T,NLPTIP + CAMN T,NLPTEP + SUBI T,LPTBSZ + HRRM T,NLPTIP + TLNE T,760000 + POPJ P, + SOSGE NLPTBR + JRST 4,. +NLPTGO: CONO PI,LPTOFF + CONSO NLPT,7 + CONO NLPT,100+LPTCHN ;SET OUTPUT DONE + JRST LPTONJ + +NLPTW: SKIPG NLPTBR + PUSHJ P,UFLS + JRST NLPTW1 + +EBLK + +NLPTIP: 010700,,NLPTBO-1 +NLPTBO: BLOCK LPTBSZ +NLPTEP: 010700,,NLPTBO+LPTBSZ-1 +NLPTPP: NLPTBO ;OUTPUT PNTR (PI) +NLPTBR: LPTBSZ +NLPTBP: 004400,,NLPTBO-1 ;BLKT POINTER +NLPTBC: LPTBSZ ;BLKT CNT = MIN(# WDS TILL END OF BUF,NLPTBR) +NLPTOP: NLPTBO ;VALUE OF NLPTBP BEFORE BLKT CALL +NLFREE: -1 ;-1 => LPT IN USE RECENTLY. + ;0 => NOT IN USE SINCE LAST VSCLK. + ;1 => NOT SINCE NEXT-TO-LAST VSCLK. + ;=>2 => LPT MOTOR NOW OFF. + +BBLK + +BNLPTO: MOVE B,NLPTBP + MOVEM B,NLPTOP + PUSH P,[BNLPT1] + MOVE E,[444400,,1] + JSP B,BLKT + SETZ NLPTBP + NLPTBC + BNLPTG + BNLPT1 + @J + SKIPG NLPTBR + +BNLPT1: MOVE T,NLPTBP + MOVE W,T + CAMN T,[004400,,NLPTBO+LPTBSZ-1] + MOVE T,[004400,,NLPTBO-1] + MOVEM T,NLPTBP + EXCH T,NLPTOP + SUB T,W ;- # WORDS WRITTEN + ADDB T,NLPTBR ;DECREASE ROOM + JUMPL T,[JRST 4,.] + JRST NLPTGO + +BNLPTG: MOVE TT,NLPTBP + MOVE J,NLPTBR + MOVEI T,NLPTBO+LPTBSZ-1 + SUBI T,(TT) ;# WORDS UNTIL END OF BUFFER + CAMLE J,T + MOVE J,T + MOVEM J,NLPTBC + JRST POPJ1 + +NLPTCL: SKIPLE NLPTBR ;ENOUGH ROOM? + PUSHJ P,NLPTO3 + SETOM NLFREE + SETOM NLUSR + SETOM NLUSE + POPJ P, + +NLPDCL: MOVSI H,760000 + SKIPA A,[177] +NLPDC1: PUSHJ P,NLPTW1 + TDNE H,NLPTIP + JRST NLPDC1 + HRRZ A,NLPTIP + CAIN A,NLPTBO+LPTBSZ-1 + MOVEI A,NLPTBO-1 + HRLI A,004400 + MOVEM A,NLPTBP + MOVNI A,(A) + ADDI A,NLPTBO+LPTBSZ-1 + MOVE B,NLPTBR + CAMLE A,B + MOVE A,B + MOVEM A,NLPTBC + JRST NLPTCL +] + +IFN NTYP\OLPTP\NLPTP\PLTP\340P\PDP6P\STKP\PTRP,[ + +EBLK +LPTA: 0 +LPTB: 0 +LPTACS: BLOCK 15 + +LPTBRK: 0 +BBLK + MOVEM A,LPTA +IFN NTYP,[ ;A KLUDGE FOR THE PDP 11 ON DM + CONI NTY,A + TRNE A,7 ;NO PIA + TRNN A,200000 ;NO FLAG + CAIA + JRST NTYBRK ;AHH, FLAG AND PIA +] + +IFN OLPTP,[ + CONSZ OLPT,7 + CONSZ OLPT,10 + JRST .+2 + JRST LPENT1 ;LINE PRINTER +] +IFN NLPTP,[ + CONSZ NLPT,7 + CONSO NLPT,100 ;DONE + JRST .+2 + JRST NLPENT ;NEW LINE PRINTER +] +IFN 340P,[ + CONI DIS,A + TRNN A,77 + JRST LPTBR2 + CONSZ DIS,7400 + JUMPL A,SRECYC ;SPECIAL DISPLAY CHNL +] +LPTBR2: MOVEM B,LPTB +IFN PLTP,[ + CONSZ PLT,SDS+PDS + JRST PLTBRK ;PLOTTER +] +IFN PTRP,[ + CONSZ PTR,7 + CONSO PTR,10 + JRST .+2 + JRST PTRBRK + CONSZ PTP,10 + JRST PBRK1 ;PAPER TAPE PUNCH +] +IFN PDP6P,[ + CONSO DSDEV,7 + JRST .+3 + CONSZ DSDEV,10 + JRST DSDBRK ;INTERRUPT FROM OTHER PROCESSOR +] +IFN STKP,[ + CONSZ STK,7 + CONSO STK,10 + JRST .+2 + JRST STKINT ;STANFORD KEYBOARD +] +LPBKRT: MOVE A,LPTA + JRST 12,@LPTBRK + +LPTRT1: MOVS A,[C,,LPTACS] + BLT A,17 +LPTRT3: MOVE B,LPTB + MOVE A,LPTA + JRST 12,@LPTBRK +] ;END IFN OLPTP\ ETC. +.ELSE [ +EBLK +LPTBRK: 0 +BBLK + JRST 4,. +] + +IFN OLPTP,[ +LPENT3: MOVEI A,177 + JRST LPTCN1 + +LPTCR: CONO OLPT,10+LPTCHN ;PRINT LINE + AOS LPTCC + JRST LPBKRT + +LPENT1: MOVEI A,*5-5 + CAMG A,LPTCC + JRST LPTSTP +LPENT2: ILDB A,LPTOP + TRNE A,100 + JRST LPTCN +LPTCN1: DATAO OLPT,A ;OUTPUT CHARACTER + AOS A,LPTCC + CONSZ OLPT,10 + JRST LPBKRT + CAIGE A,*5-5 + JRST LPENT2 +LPTSTP: CONO OLPT,0 ;CLEAR PIA + MOVEI A,SCRTPC + SKIPGE LPTUSR + IORM A,SUPCOR ;LPT NOW IDLE + JRST LPBKRT + +EBLK + +LPTBO: BLOCK LPTBSZ-1 + -1 +LPTBE: + +BBLK + +STALPT: MOVE E,LINEPOS + DPB E,[130700,,D] + DPB A,[60300,,D] ;MODE + MOVE E,LPTCC + CAIG E,150. + TRO D,1_9. + CAIL E,30000 + TRO D,1_<9.+1> + POPJ P, + +LPTRS: CONO PI,LPTOFF + MOVEI A,5*-5 + MOVEM A,LPTCC + MOVE A,[700,,LPTBO-1] + MOVEM A,LPTIP + MOVEM A,LPTOP + SETZM LINEPOS + CONO PI,LPTON + JRST LPTRS2 + +] + +IFN NLPTP,[ +NLPENT: MOVE A,NLPTBR + CAIN A,LPTBSZ + JRST NLPTST + CAIL A,LPTBSZ + JRST 4,. + DATAO NLPT,@NLPTPP + AOS A,NLPTPP + CAIN A,NLPTBO+LPTBSZ + MOVEI A,NLPTBO + MOVEM A,NLPTPP + AOS NLPTBR + JRST LPBKRT + +NLPTST: CONO NLPT,200 ;CLEAR DONE AND PIA + MOVEI A,SCRTPC + SKIPGE NLUSR + IORM A,SUPCOR ;LPT NOW IDLE + JRST LPBKRT + +NLPTRS: CONO PI,LPTOFF + MOVE A,[010700,,NLPTBO-1] + MOVEM A,NLPTIP + MOVEI A,NLPTBO + MOVEM A,NLPTPP + MOVE A,[004400,,NLPTBO-1] + MOVEM A,NLPTBP + MOVEM A,NLPTOP + MOVEI A,LPTBSZ + MOVEM A,NLPTBR + MOVEM A,NLPTBC + CONO PI,LPTON + JRST NLPTO3 +] + +SUBTTL STANFORD KEYBOARD + +IFN STKP,{ +;3.4 => DON'T HANG ON IOT IF NO CHAR (RETURN -1 INSTEAD) +;3.5 = 1 => DON'T DO CHAR CONVERSION +; = 0 => CONVERT ACCORDING TO OTHER BITS +;3.6 = 1 => ITS MODE (CTRL DOES CTRL AND META IS 8TH BIT) +; = 0 => STANFORD MODE (400 = META, 200 = CTRL, AND ALL THE +; CHARS FROM 1-177 CAN BE GENERATED WITH TOP AND SHIFT.) +;3.7 = 1 => IF 3.5 = 0, 3.6 = 1, THEN DON'T INPUT META BIT + +STKO: TLNE C,3 ;BLOCK OR OUTPUT + JRST OPNL12 ;MODE NOT AVAILABLE + CONO PI,CLKOFF + SKIPL STKUSR + JRST OPNL10 ;DEVICE NOT AVAILABLE + MOVEM U,STKUSR + AOSE STKUSE + JRST 4,. ;CAN ONLY BE OPEN ONCE + CONO PI,CLKON + HRRZ A,UUAC(U) + MOVE A,CHNBIT(A) + ROT D,-2 + DPB D,[220400,,A] + MOVEM A,STKMSK + MOVE A,STKBP + MOVEM A,STKIP + MOVEM A,STKOP + SETZM STKBC + DATAI STK,A ;CLEAR DONE + CONO STK,LPTCHN + MOVEI A,STKDP + MOVEM A,(R) + JRST POPJ1 + +STKCLS: CONO STK,0 ;CLEAR PIA + SOSL STKUSE + JRST 4,. ;CAN ONLY BE OPEN ONCE + SETOM STKUSR + POPJ P, + +STKRS: CONO PI,LPTOFF + MOVE A,STKBP + MOVEM A,STKIP + MOVEM A,STKOP + SETZM STKBC + JRST LPTONJ + +STKI: MOVE TT,STKMSK + TLNE TT,1 + JRST STKI1 + PCLT + SKIPG STKBC + PUSHJ P,UFLS +STKI2: ILDB A,STKOP + SOS STKBC + TLNN TT,2 + JRST STKCV ;DO CONVERSION +STKI3: MOVE W,A + MOVE A,STKOP + CAMN A,STKEP + SUBI A,STKBL + HRRM A,STKOP + POPJ P, + +STKI1: SKIPLE STKBC + JRST STKI2 + JRST STTYI3 + +STKINT: MOVEM B,LPTB + DATAI STK,B + ANDI B,1777 ;CURRENTLY 10 BITS + MOVE A,STKBC + CAIL A,STKBS + JRST LPTRT3 ;NO ROOM. JUST IGNORE CHAR + IDPB B,STKIP + AOS STKBC + MOVE A,STKIP + CAMN A,STKEP + SUBI A,STKBL + HRRM A,STKIP + MOVE A,STKUSR + HRRZ B,STKMSK + AND B,MSKST2(A) + IORM B,IFPIR(A) + JRST LPTRT3 + +EBLK +STKBL==40 +STKBS==STKBL*3 +STKIP: 001400,,STKIB-1 +STKIB: BLOCK STKBL +STKEP: 001400,,STKIB+STKBL-1 +STKBP: 001400,,STKIB-1 +STKOP: 001400,,STKIB-1 +STKBC: 0 +STKMSK: 0 ;BIT FOR CHANNEL STK OPEN ON + ;3.1 => DON'T HANG ON IOTS MODE + ;3.2 => DON'T CONVERT CHARS + ;3.3 => ITS MODE + ;3.4 => DON'T INPUT META IN ITS MODE +BBLK + +STKCV: LDB B,[000600,,A] ;LOW 6 BITS + CAIN B,33 + JRST STKCV1 ;33 + CAIL B,35 + CAILE B,47 + JRST .+2 + JRST STKCV2 ;35-47 + CAIL B,74 + CAILE B,77 + JRST .+2 + JRST STKCV3 ;74-77 + TRNE A,400 + JRST STKCVT ;TOP IS ON + CAIG B,32 + JRST STKCV4 ;0-32 + CAIN B,34 ;SKIP IF 50-73 + JRST STKCVB ;34 +STKCVX: TLNN TT,4 ;SKIP ON ITS MODE + JRST STKCVY ;STANFORD MODE + ANDI A,1000 ;META BIT + LSH A,-2 + TLNN TT,10 ;SKIP ON DON'T INPUT META BIT + IORI B,(A) + MOVE A,B + JRST STKI3 + +STKCVY: LDB D,[110100,,A] ;META BIT + LSH D,8 ;IN 400 POSITION + ANDI A,200 ;CTRL BIT + IORI A,(D) + IORI A,(B) + JRST STKI3 + +STKCV1: MOVEI B,15 + JRST STKCVX + +STKCV2: MOVEI Q,-35(B) ;35-47 (-35) + IDIVI Q,5 + LDB B,STKBPT(J) + JRST STKCVX + +STKCV3: CAIE B,74 + JRST STKCV5 ;75-77 + MOVEI B,177 + JRST STKCVX + +STKCV5: MOVEI B,33 + JRST STKCVX + +STKCVT: CAIG B,32 ;TOP IS ON + JRST STKCT1 ;0-32 + CAIN B,34 + JRST STKCT2 ;34 + MOVEI Q,-50(B) ;50-73 (-50) + MOVE D,B + IDIVI Q,5 + LDB B,STKBP1(J) + TRNE A,200 ;SKIP IF CTRL IS OFF + TLNN TT,4 ;SKIP IF ITS MODE + JRST STKCVX + CAIL D,52 + CAILE D,72 + TRZ B,100 ;50,51,73 + JRST STKCVX + +STKCT1: MOVE Q,B ;0-32 TOP ON + MOVE D,B + IDIVI Q,5 + LDB B,STKBP2(J) + TRNE A,200 ;SKIP IF CTRL IS OFF + TLNN TT,4 ;SKIP IF ITS MODE + JRST STKCVX + CAIN D,12 + TRZ B,100 + JRST STKCVX + +STKCT2: MOVEI B,16 + JRST STKCVX + +STKCV4: TLNN TT,4 ;SKIP IF ITS MODE + JRST STKCV6 + TRNE A,200 + JRST STKCVX ;ITS, CTRL +STKCV6: TRO B,100 + TRNN A,100 + TRO B,40 ;SHIFT WAS OFF + JRST STKCVX + +STKCVB: MOVEI B,134 + TRNE A,200 ;SKIP IF CTRL IS OFF + TLNN TT,4 ;SKIP IF ITS MODE + JRST STKCVX + TRZ B,100 + JRST STKCVX + +DEFINE STKM A,B,C,D,E + A_29.+B_22.+C_15.+D_8+E_1 +TERMIN + +DEFINE STKM1 TBL + 350700,,TBL(Q) + 260700,,TBL(Q) + 170700,,TBL(Q) + 100700,,TBL(Q) + 010700,,TBL(Q) +TERMIN + +STKBPT: STKM1 STKTBL +STKTBL: STKM 12,0,0,40,0 + STKM 33,0,0,11,14 + STKM 13,0,0,0,0 + +STKBP1: STKM1 STKTB1 +STKTB1: STKM 133,135,26,174,41 + STKM 5,77,17,60,36 + STKM 22,23,20,21,44 + STKM 45,32,30,1,136 + +STKBP2: STKM1 STKTB2 +STKTB2: STKM 0,34,7,6,74 + STKM 100,76,33,75,47 + STKM 137,31,27,25,24 + STKM 173,176,4,43,35 + STKM 46,140,10,37,3 + STKM 42,2,0,0,0 +};IFN STKP + +SUBTTL INTERFACE (?) TO DM PDP11 ON NTY (REALLY WANT A CAIOS) +IFN NTYP,[ +IFN TK10P, .ERR YOU REALLY WILL LOSE WITH BOTH TTY AND 11 ON NTY +NTYOPN: PUSHJ P,NTYOP1 ;SET UP OPEN + POPJ P, ;OPEN LOST? + SKIPE NTYUSE ;IF THIS IS FIRST OPEN, DO SOME INITIALIZING + JRST POPJ1 + CONO NTY,0 ;STOP INTS + SETOM NTYOAC + MOVE A,[NTYIOI,,NTYIOR] + BLT A,NTYORM ;INITIALIZE ALL THE POINTERS AND COUNTERS + CONO NTY,620000+NTYCHN + JRST POPJ1 + +NTYOP1: ROT D,1 ;MODE BACK, TO GET INPUT & OUTPUT + JSP Q,STDOPN + 3,,NTYUSR + NTYIT,,NTYOT + 0,,0 ;NTYBIT,,NTYBOT + +NTYRS==CPOPJ + +NTYCLS: SOSL NTYUSE ;-1 MEANS FREE (USE STDCLS?) + POPJ P, + SETOM NTYUSE + SETOM NTYUSR + POPJ P, + +;MAIN PROGRAM ROUTINES FOR IOT/SIOT ... + +NTYBI==IOCR10 +NTYBO==IOCR10 + +NTYTO:: +NTYOPT: PCLT ;PUT OUTPUT INTO BUFFER + SKIPG C + SKIPA A,(C) + UMOVE A,(C) ;FETCH THE USERS BYTE + SKIPG NTYORM ;WAIT FOR ROOM + PUSHJ P,UFLS + IDPB A,NTYOIP + SOSGE A,NTYORM + JRST 4,. ;WENT BELOW ZRO? + AOSN NTYOAC + CONO NTY,10+NTYCHN ;NOT ACTIVE, START PI LEVEL + AOSGE NTYOIR + POPJ P, + MOVE A,[NTYOII,,NTYOIR] ;RING AROUND THE ROSY + BLT A,NTYOIP + POPJ P, +NTYTI:: +NTYIGT: MOVEI T,NTYIBS*4 + PCLT + CAMG T,NTYIRM + PUSHJ P,UFLS ;WAIT UNTIL A BYTE COMES IN + ILDB W,NTYIOP + AOS NTYIRM ;NOW MORE ROOM + AOSGE NTYIOR ;RING? + POPJ P, + MOVE B,[NTYIOI,,NTYIOR] ;REDO POINTERS + BLT B,NTYIOP + POPJ P, + +;INTERRUPT ROUTINES + +NTYBRK: TRC A,2000 ;DEVICE # + TRNE A,7000 + JRST NTYSEL ;STOPPED ON OTHER DEVICE + TRNE A,40 + JRST NTYIPT ;INPUT + TRNE A,20 + JRST NTYOGT ;OUTPUT +NTYRET: CONO NTY,620000+NTYCHN ;RESTART + JRST LPBKRT + +NTYSEL: TRC A,2000 ;HAVE TO KNOCK DOWN SOME OTHER FLAG + ANDI A,7000 + LSH A,3 + CONO NTY,400000+NTYCHN(A) + CONSZ NTY,40 + DATAI NTY,A ;CLEAR INPUT + CONSZ NTY,20 + CONO NTY,20+NTYCHN ;CLEAR OUTPUT + AOS NTYERR + JRST NTYRET + +NTYOGT: MOVEI A,NTYOBS*4 + CAMG A,NTYORM + JRST [SETOM NTYOAC + CONO NTY,20+NTYCHN + JRST NTYRET] + ILDB A,NTYOOP + AOS NTYORM + DATAO NTY,A + AOSGE NTYOOR + JRST NTYRET + MOVE A,[NTYOOI,,NTYOOR] + BLT A,NTYOOP ;ZAP THE POINTER AND COUNT (RING BUF) + JRST NTYRET + +NTYIPT: SOSG NTYIRM + CONO NTY,100+NTYCHN ;IF HDWE NOT IN, BUFFER WILL BE CLOBBERED + ;BUT ALSO, THE COUNT WILL BE NEG!!! + DATAI NTY,A + IDPB A,NTYIIP + AOSGE NTYIIR + JRST NTYRET + MOVE A,[NTYIII,,NTYIIR] + BLT A,NTYIIP ;RING THE BUFFER POINTERS + JRST NTYRET + +;DATA AREAS FOR THE NTY INTERFACE TO DM PDP 11 + +NTYIBS==1000 +NTYOBS==100 + +NTYIOI: -NTYIBS*4 ;STUFF TO INITIALIZE INPUT SIDE + 041000,,NTYIBF-1 +NTYIII: -NTYIBS*4 + 041000,,NTYIBF-1 + NTYIBS*4 + +NTYOOI: -NTYOBS*4 ;INITIALIZES OUTPUT SIDE + 041000,,NTYOBF-1 +NTYOII: -NTYOBS*4 + 041000,,NTYOBF-1 + NTYOBS*4 + +EBLK + +NTYIOR: -NTYIBS*4 ;RING COUNTER, INPUT BUFFER, OUTPUT PART +NTYIOP: 041000,,NTYIBF-1 ;BYTE POINTER, " " +NTYIIR: -NTYIBS*4 ;RING CTR, INPUT BUFFER, INPUT PART +NTYIIP: 041000,,NTYIBF-1 ;BYTE POINTER, " " +NTYIRM: NTYIBS*4 ;ROOM EMPTY IN IN BUFFER + +NTYOOR: -NTYOBS*4 ;RING CTR, OUTPUT BUFF, OUT PART +NTYOOP: 041000,,NTYOBF-1 ; BYT PTR, " " +NTYOIR: -NTYOBS*4 ;RING CTR, OUT BUFF, IN PART +NTYOIP: 041000,,NTYOBF-1 ;BYT PTR, " " +NTYORM: NTYOBS*4 ;ROOM IN THE OUTPUT BUFFER + +NTYIBF: BLOCK NTYIBS ;INPUT BUFFER +NTYOBF: BLOCK NTYOBS ;OUTPUT BUFFER + +NTYOAC: -1 ;FLAG, OUTPUT ACTIVE UNLESS -1 +NTYUSR: -1 +NTYUSE: -1 + +NTYERR: 0 + + BBLK +];NTYP + +SUBTTL PDP-10 TO PDP-11 INTERFACE AND XGP + +IFN TEN11P,[ +EBLK +T11MP: BLOCK 256. ;CONTENTS OF TEN11 MAP, -1 => CONFLICT PAGE +BBLK + ;ELSE 0 => AVAIL + ;4.9=1 => CONTENTS OF MAP WD EXCEPT 4.7-4.3 => USE COUNT +IFN XGP,XGPTP==376 ;PAGE NUMBER IN 10-11 RESERVED FOR CLK LEVEL XGP HACKS + +;PLACE WD IN A IN AVAIL 10-11 MAP ENTRY (RETURN IN RH B) +T11AD: SKIPE TEN11F + POPJ P, + MOVE C,A + JSP Q,T11FND ;SKIP UNLESS NO MAP ENTRIES AVAIL + JRST T11A1 ;WD ALREADY IN PAGE + MOVEI C,0 ;FIND FREE PAGE + JSP Q,T11FND + JRST T11A2 + POPJ P, ;NO FREE PGS AVAIL + +T11A1: LDB E,[350500,,T11MP(B)] + CAIN E,37 + JRST T11FN2 ;USAGE COUNT MAX FOR THAT ENTRY + AOS E + DPB E,[350500,,T11MP(B)] + JRST POPJ1 + + +T11A2: MOVEM A,T11MP(B) + MOVEM A,400000+T11CP*2000(B) ;STORE IN HARDWARE + JRST POPJ1 + +T11FND: MOVSI B,-256. +T11FN1: +IFN XGP,[ CAMN B,[-256.+XGPTP,,XGPTP] ;DON'T ALLOCATE SPECIAL XGP ENTRY TO OTHER USERS + JRST T11FN2 +] + MOVE E,T11MP(B) + TLZ E,174000 ;USE COUNT BITS + CAMN E,C + JRST (Q) ;FOUND IT +T11FN2: AOBJN B,T11FN1 + JRST 1(Q) ;CANT FIND IT + + +;DELETE REF TO T11 PAGE IN B +T11DL: SKIPE TEN11F + POPJ P, + MOVE E,T11MP(B) + AOJE E,CPOPJ ;REALLY CONFLICT PAGE + LDB E,[350500,,T11MP(B)] + SOJL E,T11DL1 ;DELETING LAST REF TO PAGE? + DPB E,[350500,,T11MP(B)] + POPJ P, + +T11DL1: CLEARM T11MP(B) + CLEARM 400000+T11CP*2000(B) + POPJ P, +] + +IFN TEN11P,[ + +;.CALL ADR +; LOSE +; WIN +;ADR/ SETZ +; SIXBIT /T11MP/ +; ARG 1 VIRT PAGE # +; ARG 2 DESIRED T11 MAP WORD + +NT11M: TDNE A,[-400] ;TEMP? TEN11 CALL A HAS USER PG + JRST OPNL33 ;INVALID ARG - BAD USER PAGE #. + SKIPE TEN11F + JRST OPNL7 ;DEVICE NOT READY. + PUSHJ P,UPLC + MOVE W,A + JUMPGE B,OPNL33 + TLZ B,174000 ;DONT ALLOW ANYTHING IN USAGE COUNT BITS + MOVE D,B + LDB E,Q + JUMPE E,NT11M1 ;PAGE MUST BE FREE OR ABS, OTHERWISE ERROR + CAIE E,-1 + JRST OPNL13 ;FILE ALREADY EXISTS + LDB B,T + ANDI B,PMRCM + LDB E,[.BP B] ;GET MOBY # + ANDI B,377 + CAIN E,T11CPA_-18. + PUSHJ P,T11DL + MOVEI B,0 + DPB B,Q + DPB B,T +NT11M1: MOVE R,Q + MOVE A,D + PUSHJ P,T11AD + JRST OPNL37 ;NO CORE AVAILABLE. + ADDI B,200000+<_8> ;ADDRESS CORRECT MOBY + TLNE A,200000 + TRO B,400000 ;WRITE PERMISSION + DPB B,T + MOVEI C,-1 + DPB C,R + LSH W,10. + ADDI W,2000 + CAMLE W,HUSRAD(U) + MOVEM W,HUSRAD(U) + JRST POPJ1 +] +.ELSE NT11M: JRST OPNL1 ;NO SUCH DEVICE. + IFN XGP,[ +;CLOCK LEVEL XGP CODE FOR FILLING IMAGE MODE BUFFERS +;ASSUMES XGP11P IS POINTER TO FIRST 11 RING NODE +;AND THAT THE 11 BUFFER RING STRUCTURE IS: + +; POINTER TO NEXT NODE OF BUFFER +; USE WORD (0=> EMPTY) +; POINTER TO BUFFER (ASSUMED TO BE 1K 10 STYLE, 2K 11 STYLE) + +; +;THE NODES AND THE BUFFERS MUST BEGIN ON EVEN PDP-11 WORDS +;I.E. 11 ADDRESSES ENDING WITH TWO ZEROES. + +;THIS CODE USES A SPECIAL 10-11 INTERFACE ENTRY +;NAMELY, XGPTP, AND THREE EXEC PAGES, XGPC WHICH POINTS TO +;THE LOW 2K OF PDP-11 CORE, USED FOR THE RING NODE POINTERS +;XGPUB WHICH POINTS TO THE CURRENTLY HACKED USER PAGE +;AND XGPB WHICH POINTS PERMANENTLY TO THE 10-11 PAGE CORRESPONDING +;TO XGPTP + +XGP11==1 ;PDP-11 RUNNING XGP +XGPCA==XGPC*2000+400000 ;EXEC ADR OF LOW PDP-11 CORE +XGPBA==XGPB*2000+400000 ;EXEC ADR OF BUFFER IN PDP-11 +XGPUBA==XGPUB*2000+400000 ;EXEC ADR OF CURRENT PAGE IN USER'S MAP +XGNTPG==117. ;MAX # TIED DOWN PAGES (WOULD YOU BELIEVE...) +X11BFP==102 ;LOC OF XGP BUFF HEAD IN 11 (PDP11 ADR 410) + +XGPCLK: PUSH P,A + PUSH P,B + MOVE A,XGPTM1 ;TIME FIRST PAGE LOCKED IN CORE + ADDI A,30.*60. ;1 MINUTE + CAMGE A,TIME ;WIN? + JSP Q,XGPFLS ;LOSE... + SKIPL XGPINI ;DON'T HACK UNTIL MAIN PGM HAS PAGES TIED DOWN + JRST POPBAJ + SPM XGPSPM ;SAVE OLD MAP +XGPC1: MOVE A,XGP11P ;GET POINTER TO FIRST PDP-11 BUFFER + MOVE A,XGPCA(A) ;GET CONTENTS FROM PDP-11 + LDB B,[242000,,A] ;GET NEXT RING POINTER + LDB A,[042000,,A] ;GET USE WORD + JUMPN A,POPBAJ ;BUFFERS FULL + TRNE B,3 + JSP Q,XGPFLS ;NEW BUF POINTER NOT ON EVEN WD BNDY + LSH B,-2 ;CONVERT TO 10 ADDRESS + SKIPE B + CAIL B,2000 ;IS IT WITHIN CONTROL PAGE? + JSP Q,XGPFLS ;FLUSH + EXCH B,XGP11P ;SETUP NEXT POINTER, GET BACK OLD ONE + MOVEM B,XGPOB ;SAVE OLD POINTER FOR HACKING BUFF FULL + MOVE B,XGPCA+1(B) ;GET POINTER TO 11 BUFFER + LDB B,[242000,,B] + TRNE B,3 + JSP Q,XGPFLS + LSH B,8 ;SETUP 10-11 ENTRY + IOR B,[600000+,,1777] ;R/W, PROT INFINITE + MOVEM B,400000+2000*T11CP+XGPTP ;GRONK INTO 10-11 INTERFACE + MOVEM B,T11MP+XGPTP ;FOR DEBUGGING ONLY + ILDB A,XGP10P ;GET POINTER TO NEXT 10 PAGE + CAIL A,TSYSM ;LOSE + JRST 4,. ;MAIN PGM HAS POINTER TO NXM + JUMPE A,XGPFIN ;HERE WE ARE DONE, I HOPE. DEUS GRATIUS + MOVE B,A ;SAVE MMSWP ENTRY # TO CLEAR OUT TIE DOWN + IORI A,600000 ;R/W + DPB A,[.XGPUB+EXEUMP] ;GRONK EXEC MAP + LPMR XGPSPM ;RESET ASSOC REGS + MOVE A,[XGPUBA,,XGPBA] + BLT A,XGPBA+1777 ;DO THE STUFF! + MOVSI A,-1 + ADDM A,MMSWP(B) ;CLEAR TIE DOWN, PHEW! + SKIPGE MMSWP(B) ;STOP BUGGY LOSSAGE + JRST 4,. + PUSHJ P,XGPBIT ;GET TABLE INFO + TDNN A,XGPMTB(B) + JRST 4,. ;UNTIED PAGE NOT TIED DOWN + ANDCAM A,XGPMTB(B) ;CLEAR THE BIT + MOVEI A,0 + DPB A,[.XGPUB+EXEUMP] ;CLEAR EXEC PAGE MAP + MOVE A,XGPOB ;GET OLD RING PTR + MOVEI B,30 ;CHANGE RH ONLY TO A 1 + MOVEM B,XGPCA(A) ;SET BUFFER FULL + JRST XGPC1 ;LOOP TO GET A NEW BUFFER + + + +XGPFIN: SETZM XGPINI + JSP Q,XGPFLS + +;MMSWP ENTRY IN B, +;RETURNS BIT IN A +;WD OF TABLE IN B +XGPBIT: MOVE A,B + IDIVI A,36. + MOVNS B + PUSH P,A + MOVSI A,400000 + LSH A,(B) + JRST POPBJ + +;CALLED FROM CORE ALLOCATOR WHEN FLUSHING PAGES +;OF A JOB WHICH HAVE LH OF MMSWP NON ZERO. + +XGPCFL: CAME U,XGPUSR ;ARE WE CONCERNED? + POPJ P, ;NOPE + PUSH P,A + PUSH P,B + MOVE B,TT ;B GETS MMSWP INDEX + PUSHJ P,XGPBIT ;GET INDEXES INTO XGPMTB + TRNN A,XGPMTB(B) ;IS THIS A PAGE BEING HACKED BY XGP? + JRST POPBAJ ;NOPE + ;FALLS THRU + +;XGPFLS IS CALLED AT THE CLOCK LEVEL IF ANYTHING GOES WRONG WITH ANYTING +;AND AT THE END OF THE RUN. +;IT FREES THE WORLD, AND FLUSHES THE XGP USER + +XGPFLS: MOVEM Q,XFLSPC + SETOM XGPUSR ;FLUSHES XGP, ALSO PREVENTS TIMING ERRORS IF XGPFLS CALLED + ;AT CLOCK LEVEL, SINCE IT WON'T BE ANY MORE + PUSH P,C + PUSH P,D + CLEARB A,B + MOVSI C,400000 + MOVSI D,-1 +XGPFL1: TDNN C,XGPMTB(B) + JRST XGPFL3 ;THIS PAGE NOT HACKED + ADDM D,MMSWP(A) ;UNTIE THIS PAGE + SKIPGE MMSWP(A) + JRST 4,. + ANDCAM C,XGPMTB(B) ;AND FLUSH THIS BIT +XGPFL3: ROT C,-1 ;MOVE ON TO NEXT BIT + SKIPGE C ;BEG OF NEW WORD? + AOS B ;YES, AOS XGPMTB INDEX + CAIGE A,TSYSM-1 ;FINISHED WITH ALL OF MMSWP ENTRIES? +XGPFL2: AOJA A,XGPFL1 ;NOPE, LOOP BACK FOR MORE FUN + POP P,D + POP P,C + JRST POPBAJ + + +;MAIN PROGRAM BUFFER TIE DOWN ROUTINES +;.CALL FOO +;FOO: SETZ +; SIXBIT /XGPIM/ +; SETZ POINTER TO [# OF PAGES,,FIRST PAGE] + +NXGPIM: XCTR XRW,[MOVES B,(A)] ;GET POINTER, AND CHECK FOR WRITE + JUMPL B,XCONT ;CONTINUING A PREVIOUS CALL + SKIPN TEN11F + SKIPL XGPUSR + POPJ P, ;LOSE + MOVEI C,X11BFP ;BUFF HEAD IN 11 DEFINED AS 1000 + MOVEM C,XGP11P + MOVE C,XGPCA(C) ;GET BUFF POINTER FROM 11 + JUMPE C,CPOPJ ;LOSE, THE 10-11 IS LOSING OR PGM LOSING + MOVE C,TIME + MOVEM C,XGPTM1 ;SET UP TIMEOUT ON PAGE LOCK + SETZM XGPINI ;SAY NOT ACTIVE + MOVEM U,XGPUSR ;AND BEING LOADED + SETZM XGPTAB + MOVE C,[XGPTAB,,XGPTAB+1] + BLT C,XGPTAB+LXTAB-1 ;CLEAR OUT OLD PAGE BUF TABLE + MOVE C,[441400,,XGPTAB] + MOVEM C,XGP10P ;SETUP BYTE POINTER TO PAGE LIST +XTIE: TLO B,400000 + UMOVEM B,(A) + HRRZ C,B + HRRZ E,B ;C,E GET PAGE # NEXT TO BE TIED DOWN + HLRZ D,B ;D GETS COUNT OF PAGES LEFT + LSH C,10. + UMOVE B,20(C) ;BRING IN THAT LOSING PAGE + PUSHJ P,SWTL + CIRPSW + TRZ D,400000 + CAIL D,XGNTPG ;MAX # PAGES TIED DOWN + JRST XLOSE + EXCH E,A + CAIL A,400 + JRST XLOSE ;PAGE OUT OF REASONABLE RANGE + PUSH P,A + PUSHJ P,UPLC ;FIND OUT PAGE MAP ENTRY + LDB B,Q + CAIN B,-1 + JRST XLOSE1 + LDB B,T + ANDI B,PMRCM + CAIL B,TSYSM + JRST 4,. + PUSHJ P,XGPBIT + CONO PI,CLKOFF ;CLOCK OFF TO PREVENT PAGES 1/2 TIED DOWN + TDNN A,XGPMTB(B) ;WE HAVE HIT THIS PAGE ALREADY + CAME U,XGPUSR ;TIMEOUT OR OTHER GROSS LOSSAGE + JRST XLOSE1 ;DON'T TIE THIS ONE DOWN, AND FLUSH ALL THE REST + IORM A,XGPMTB(B) ;SET BIT IN XGP MEM TABLE + LDB B,T + ANDI B,PMRCM + IDPB B,XGP10P ;PUT IN BUFFER LIST + MOVSI A,1 + ADDM A,MMSWP(B) ;TIE IT DOWN GOOD (FOR ALL YOU BONDAGE FREAKS) + CONO PI,CLKON + PUSHJ P,LSWPOP ;CIRPSW + POP P,B + SOJLE D,XBFIN ;WE ARE DONE TYING START XGPING + AOS B + HRL B,D + MOVE A,E ;NOW, LOOP FOR MORE CRUFTIES, OR +XCONT: CAME U,XGPUSR ;REENTER HERE IF THE MAD SWAPPER HAD US SWAPPED OUT + POPJ P, + JRST XTIE + +XLOSE1: CONO PI,CLKON ;CLEANUP AFTER LOSSAGE + SUB P,[1,,1] +XLOSE: PUSHJ P,LSWPOP ;CIRPSW + PUSH P,A + PUSH P,B + JSP Q,XGPFLS ;FLUSH THE LAST VESTIGE OF THIS ABORTIVE ATTEMPT TO CAUSE WINNAGE + +XBFIN: SETOM XGPINI ;THE WORST IS OVER, SIT BACK AND RELAX + MOVE A,[441400,,XGPTAB] + MOVEM A,XGP10P + JRST POPJ1 ;TELL HIM HE MAY EVEN WIN SOMEDAY + +XPLO: CONO PI,CLKOFF + PUSHJ P,XPLST + JRST XPLO1 + CONO PI,CLKOFF + PUSHJ P,XPLWT + PUSHJ P,UFLS + MOVE T,XPLU + SKIPE IOCHNM(T) + JRST XPLO2 + MOVE T,SV40(T) + CAME T,[.SLEEP 17,] +XPLO2: JRST OPNL10 + CONO PI,CLKON + MOVNI A,1 + MOVSI B,(SIXBIT /XPL/) + PUSHJ P,CLIO + POPJ P, + MOVE A,UTMPTR(U) + MOVE B,XPLU + MOVEM A,UTMPTR(B) + JRST POPJ1 + +XPLO1: PUSHJ P,UDELAY + JRST XPLO + +XPLST: SKIPL T,XPLU + PUSHJ P,XPLIN + JRST POPJ1 + HRROI A,XPL + CONO PI,UTCOFF + PUSHJ P,NUJBST + JRST UTCONJ + JRST UTCOJ1 + +XPLWT: SKIPGE T,XPLU + POPJ P, + PUSHJ P,XPLIN + SKIPGE IOCHNM(T) + JRST POPJ1 + MOVS Q,SV40(T) + CAIN Q,(.SLEEP 17,) + AOS (P) + POPJ P, + +XPLIN: PUSH P,U + CAML T,USRHI + JRST XPLIN1 + HLRE U,UNAME(T) + AOJN U,XPLIN1 + MOVSI U,(SIXBIT /XPL/) + CAME U,JNAME(T) +XPLIN1: AOS -1(P) + POP P,U + POPJ P, + +;VARIABLES AREA +EBLK + +XGPTAB: BLOCK XGNTPG/3+1 ;PAGE #'S OF XGP BUFS IN 12 BIT BYTES +LXTAB==.-XGPTAB +XGP11P: 0 ;POINTER TO 11 RING STRUCTURE (10 STYLE ADR INTO XGPC) +XGPOB: 0 ;TEMP FOR OLD XGP11P +XGP10P: 0 ;BYTE POINTER INTO XGPTAB FOR GETTING 10 BUFFERS +XGPMTB: BLOCK TSYSM/36.+1 ;BIT TABLE FOR KEEPING + ;TRACK OF AOSES OF MMSWP +XGPUSR: -1 ;XGP USER INDEX, -1 IF NONE +XGPINI: 0 ;IF -1, SIGNAL TO CLK CODE THAT ALL BUFFERS ARE NOW TIED DOWN. +XFLSPC: 0 ;PC OF LAST CALL TO XGPFLS +XGPSPM: BLOCK 8 ;STORAGE FOR PAGE MAP ENTRIES +XGPTM1: 0 ;TIME FIRST PAGE TIED DOWN +XPL: SIXBIT /XPL/ ;FILE + JNAME OF XPL INTERPRETER +XPLU: 0 ;INDEX OF LOADED XPL + +BBLK +] + +IFE XGP,NXGPIM: JRST OPNL1 ;NO SUCH DEVICE + +SUBTTL ROBOT ARM ROUTINES + +IFN ARMP,[ +NARMCH==11. + +AARMOVE: UMOVE A,(J) + JUMPGE A,CPOPJ + CAMGE A,[-100,,] + JRST ILUUO + CONO PI,CLKOFF + CAMN U,ARMUSR + JRST AARM1A + SKIPL ARMUSR + JRST ILUUO +; CONO TIPDEV,0 +; CONI TIPDEV,C +; JUMPE C,ILUUO ;DONT ALLOW ARM TO RUN WITHOUT TIPBRK +; DATAI TIPDEV,C +; TRNN C,1 +; JRST ILUUO ;WRIST DETENT OFF NORMAL- BARF +; CONO TIPDEV,TIPBCH + MOVEM U,ARMUSR +AARM1A: CONO PI,CLKON + MOVSI B,-NARMCH +AARM1: SETZM ARMDF(B) + SKIPN ARMF + SETOM DESTIN(B) ;NOT PREV IN USE, INITIALIZE + AOBJN B,AARM1 + SKIPN ARMF + SETOM OMPXIF + SKIPN ARMF + PUSHJ P,IMXON ;START IMX + SETOM ARMF ;ARM NOW IN USE + SETOM DLSRCH +ARML: UMOVE E,(A) ;PICK UP COMM + LDB C,[220400,,E] + JUMPE C,ARML1 ;NO INDEX + XCTR XRW,[HRRZ Q,(C)] + ADD E,Q + TLZ E,17 +ARML1: TLZE E,20 + XCTR XRW,[HRR E,(E)] + LDB D,[360600,,E] ;CHNL + LDB C,[300600,,E] ;OP + CAIGE D,NARMCH + CAIL C,NARMOP + JRST ARMLOS + PUSHJ P,@ARMOPT(C) + AOBJN A,ARML + ADF1: MOVSI D,-NARMCH +ADFL: SKIPL A,ARMDF(D) + JRST ADF2 + TLNE A,100000 + JRST .+3 + MOVE C,RMAXV(D) + MOVEM C,MAXV(D) +ADF2: AOBJN D,ADFL + SETZM DLSRCH + JUMPL B,POPJ1 + POPJ P, + +ARMLOS: SETZM DLSRCH + JRST ILUUO + +ARMOPT: ASDEST ;0 SET DEST + ASVEL ;1 SET VELOC + ATDEST ;2 COMPARE COMPUTED POSN + ATVEL ;3 COMPARE COMPUTED VELOC + AADST ;4 COMPARE ACTUAL POS + ARPOST ;5 READ CURRENT POSITION +NARMOP==.-ARMOPT + +ARPOST: LDB B,IMPXPP(D) ;READ POSITION + UMOVEM B,(E) + POPJ P, + +ASDEST: ANDI E,7777 + CAMGE E,DESMIN(D) + MOVE E,DESMIN(D) + CAMLE E,DESMAX(D) + MOVE E,DESMAX(D) + MOVEM E,DESTIN(D) + MOVSI E,600000 +ADFSET: IORM E,ARMDF(D) + POPJ P, + +ASVEL: ANDI E,7777 + CAMLE E,RMAXV(D) + MOVE E,RMAXV(D) + MOVEM E,MAXV(D) + MOVSI E,500000 + JRST ADFSET + +AADST: LDB C,IMPXPP(D) ;COMPARE ACTUAL POSITION + SUB C,DESTIN(D) + JRST ATD1 + +ATDEST: SKIPA C,DESTIN(D) ;COMPARE COMPUTED POSITION +ATVEL: SKIPA C,VELOC(D) ;COMPARE COMPUTED VELOCITY + SUB C,POST(D) +ATD1: MOVMS C + CAMLE C,E + TLO B,400000 + POPJ P, + +SERVO: MOVSI A,-NARMCH + AOSN OMPXIF + JRST SERVI +SERV1: MOVE T,DESTIN(A) + SUB T,POST(A) + SKIPN VELOC(A) + JUMPE T,SERVX +SERV1A: MOVN B,MAXV(A) + MOVE C,VELOC(A) + SUB C,MAXA(A) + CAMGE C,B + MOVE C,B + MOVE B,VELOC(A) + ADD B,MAXA(A) + CAMLE B,MAXV(A) + MOVE B,MAXV(A) + CAMG T,B + CAMGE T,C + JRST SERV2 + MOVM D,T + CAMLE D,MAXA(A) + JRST SERV2 +SERV3: MOVEM T,VELOC(A) + ADDB T,POST(A) + IOR T,OMPXP(A) + DATAO OMPX,T +SERVX: AOBJN A,SERV1 +SERVR: JRST ARMSVR + +SERV2: SKIPGE T + SKIPA D,C + MOVE D,B + SUB T,VELOC(A) + MOVM E,D + IMUL D,E + IDIV D,MAXA(A) + ASH D,-1 + CAMGE D,T + SKIPA E,B + MOVE E,C + MOVE C,E + XOR C,VELOC(A) + JUMPGE C,SERV2A + MOVE C,E + XOR C,T + JUMPGE C,SERV2A + SKIPA T,VELOC(A) +SERV2A: MOVE T,E + JRST SERV3 + +SERVI: LDB B,IMPXPP(A) ;INITIALIZE TO CURRENT ARM STATE + MOVEM B,POST(A) + SETZM VELOC(A) + SKIPGE DESTIN(A) + MOVEM B,DESTIN(A) + IOR B,OMPXP(A) + DATAO OMPX,B + AOBJN A,SERVI + JRST SERVR + +AARMOFF: CAME U,ARMUSR + POPJ P, + CONO TIPDEV,0 + SETZM ARMF + PUSHJ P,IMXCL1 + SETOM ARMUSR + POPJ P, + +AARMRS: CAME U,ARMUSR ;RESET ARM LOCK FLAGS + POPJ P, + MOVSI A,-NARMCH +AARMR1: SKIPL ARMLOK(A) + JRST AARMR2 + CONO PI,OMXOFF + SETOM DESTIN(A) ;RELOAD ARM COMM FROM CURRENT POS + CLEARM ARMLOK(A) + SETOM OMPXIF + CONO PI,OMXON +AARMR2: AOBJN A,AARMR1 + POPJ P, + + +TIPBRK: DATAI TIPDEV,B + TRNE B,1 ;WRIST DETENT + JRST TIPBR2 + SETOM ARMLOK+ARMVRT ;UNHAPPINESS +TIPBR2: EXCH B,TIPBR + XOR B,TIPBR + SKIPGE A,ARMUSR + JRST TIPBR1 + ANDI B,7 + LSH B,ATPSFT + IORM B,PIRQC(A) +TIPBR1: JRST OMXRET + + +EBLK + +;JOINT ASSIGN +;0-10 AMF SWING VERT HORIZ YAW TILT GRIP ROTATE EXTEND ROLL +;11-12 NEW VIDI FOCUS IRIS + +ARMVRT==1 ;CHNL # OF ARM VERT + +DESMIN: IRPS A,,0 41 233 0 0 0 0 0 0 0 0 + A +TERMIN +DESMAX: IRPS A,,7777 7777 7323 7777 7777 7777 7777 7777 7777 7777 7777 + A +TERMIN +DESTIN: BLOCK NARMCH ;-1 NOT COMMANDED + VAL OF POSITION COMMAND +POST: BLOCK NARMCH ;POSITION OF ARM AT PI LEVEL +VELOC: BLOCK NARMCH +MAXV: BLOCK NARMCH +ARMDF: BLOCK NARMCH ;4.9 VARIABLE CHANGED 4.5 POS VAR 4.7 VEL 4.6 ACC +ARMLOK: BLOCK NARMCH ;IF -1 AXIS LOCKED DO NOT ALLOW CHNG IN COMMAND + +MAXA: REPEAT NARMCH,14 +RMAXV: REPEAT NARMCH,140 + +OMPXP: IRPS A,,2 3 4 6 7 12 11 10 5 32 31 + A,, + TERMIN + +IMPXPP: IRPS A,,102 103 104 106 107 112 111 110 105 132 131 + 301400-140000*,,MPXBUF+A/3 + TERMIN + +ARMUSR: -1 ;-1 OR INDEX OF USER DOING ARMOVE +OMPXIF: 0 ;-1 => INITIALIZE DESTINS'S TO CURRENT ARM POSITION +ARMF: 0 ;-1 ARM IN USE, 0 NO ARMOV EXECUTED +TIPBR: 0 ;TIP BREAK REG LAST TIME READ IN +BBLK +] + +SUBTTL INPUT MULTIPLEXOR + +IFN IMXP,[ +APOTSE: CONI MPX,T + JUMPE T,ILUUO ;MPX NOT AVAIL + MOVE C,B +APOTS1: UMOVE A,(C) + ANDI A,377 ;GET IMPX CHNL + JUMPE A,CPOPJ ;CHNL 0 = END OF LIST + IDIVI A,3 ;COMPUTE MPXBUF INDEX + ADD A,MPXPT(B) ;FORM BYTE PTR + MOVSI B,-NPOTCH ;SET UP TN DELETE PREVIOUS POT CONN +PTS1: CAMN A,POTBPT(B) ;IS ENTRY FOR SAME CHNL + SKIPG POTUSR(B) ;AND ACTIVE + JRST PTS2 ;NO,KEEP LOOKING + CAME U,POTUSR(B) ;IS THIS USER THE ONE WHO MADE ENTRY + JRST ILUUO ;NO,ILLEGAL + PUSHJ P,NARK ;DEACTIVATE AND FREE ENTRY + +PTS2: AOBJN B,PTS1 ;TRY NEXT ENTRY + MOVEI B,400000 ;MASK FOR DELETE ONLY + XCTR XRW,[TDNE B,(C)] ;SKIP ON NEW ENTRY WANTED + JRST PTSR ;TRY FOR NEXT BLOCK + MOVSI B,-NPOTCH ;SET UP TO FIND FREE ENTRY +PTS3: SKIPL POTUSR(B) ;SKIP ON FREE +PTS4: AOBJN B,PTS3 ;TRY OTHER SLOTS + JUMPGE B,ILUUO ;NO SLOTS AVAIL + CONO PI,CLKOFF ;PREVENT OTHER GRABBERS + SKIPGE POTUSR(B) ;SKIP IF JUST TAKEN + JRST PTS5 ;OKAY FOR SURE + CONO PI,CLKON ;REENABLE + JRST PTS4 ;TRY ANOTHER + +PTS5: SETZM POTUSR(B) ;MARK TAKEN + AOS IMXNTO + AOS POTCON ;INCREMENT NUMBER SLOTS IN USE + PUSHJ P,IMXON ;START IMPX + CONO PI,CLKON ;AND ENABLE +PTS6: MOVEM A,POTBPT(B) ;SAVE PTR TO MPXBUF FOR MPX ROUTINE + XCTR XRW,[HRRZ A,1(C)] ;GET USER ADR + XCTRI XRW,[MOVES (A)] + JRST .+2 + JRST PTSL1 ;NO,LOSE + XCTR XRW,[HLL A,1(C)] ;GET BYTE FIELDS + TLNN A,777700 ;IF NONE SPECIFIED + TLC A,4400 ;ASSUME FULL WORD + TLZ A,77 ;FLUSH INDEX,INDIRECT + MOVEM A,POTVPT(B) ;SAVE AS USER MEM PTR FOR MPX ROUTINE +PTS7: UMOVE A,(C) + ANDI A,3 ;GET FLOAT + ABS BITS + MOVEI D,PUFLI ;ADDR OF FLOATING INCREMENTAL UPDATE + TRNN A,1 ;SKIP ON FLOATING + MOVEI D,PUFXI ;ADDR OF FIXED INCREMENTAL UPDATE + TRNE A,2 ;SKIP ON NOT ABSOLUTE + SOS D ;ABS ROUTINE STARTS ONE BEFORE INCREMENTAL + MOVEM D,POTUPD(B) ;SAVE ROUTINE ADDR FOR MPX ROUTINE +PTS8: XCTR XRW,[MOVN D,2(C)] ;GET LOWER LIMIT + MOVNM D,POTOFS(B) ;SAVE AS OFFSET FOR MPX ROUTINE + TRNE A,1 ;SKIP ON FIXED + JRST PTS9 ;GO SET FLOATING PARAMS + XCTR XRW,[ADD D,3(C)] ;UL-LL + ASH D,-2 ;SCALE MULTIPLIER + +PTS9R: MOVEM D,POTSCL(B) ;STORE SCALE FACTOR FOR MPX ROUTINE + LDB D,POTVPT(B) ;GET CURRENT VARIABLE VALUE + TRNE A,1 ;SKIP ON FIXED + JRST PTS10 ;COMPUTE FLOATING INCR VALUE + SUB D,POTOFS(B) ;D_VAL-LL FIXED + MOVSI E,200000 ;SET TO ROUND VALUE + ASHC D,-25. ;SCALE TO GET 12 BIT VALUE + DIV D,POTSCL(B) ;COMPUTE INCR VAL FOR VAR +PTS10R: HRROM D,POTVAL(B) ;STORE INCR VALUE FOR MPX ROUTINE + MOVEM U,POTUSR(B) ;STORE USER TO ACTIVATE MPX ROUTINE +PTSR: ADDI C,4 ;ADVANCE POINTER TO NEXT 4 WORD BLOCK + JRST APOTS1 ;GO SET MORE TABLE ENTRIES + +PTS9: FADR D,3(C) ;UL-LL IN FLOATING + FSC D,-12. ;SCALE DOWN FOR POT RANGE + JRST PTS9R ;RETURN WITH SCALE FACTOR + +PTS10: FSBR D,POTOFS(B) ;D_VAL-LL FLOATING + FDVR D,POTSCL(B) ;COMPUTE INCR VAL FLOATING + MULI D,400 ;FIX INCR VAL + TSC D,D ;WORK FOR BELOW LOWER LIMIT + ASH E,-243(D) ;VALUE IN E + MOVE D,E ;TO D LIKE FIXED + JRST PTS10R ;RETURN WITH INCR VALUE + + +PTSL1: PUSHJ P,NARK + PUSHJ P,TPFLT + JRST UUOTRO + +;POTS UPDATE CALLED BY MPX ROUTINE + +UPOTS: SPM UPTPGT + MOVSI A,-NPOTCH ;SET UP TO LOOP FOR ALL POT TABLE POSITIONS + SETZM UPUSR ;INDICATE NO USER SET UP +UPOT1: SKIPLE U,POTUSR(A) ;SKIP ON SLOT UNUSED OR IN PROCESS + JRST UPOT2 ;GO TRY TO UPDATE VAR +UPOTR: AOBJN A,UPOT1 ;TRY NEXT POT TABLE ENTRY + LPMR UPTPGT ;RESTORE MAP + JRST UPOTRT ;DONE + +UPOT2: CAMN U,UPUSR ;IS THIS USER LAST UPDATED + JRST UPOT3 ;YES, RELOCATION IS SETUP + MOVE T,USTP(U) ;TEST TO SEE IF + SKIPN UMAPS(U) ;MAP LOADED TO POINT TO OTHER USER + TLNE T,BUCSTP+BCSTOP ;USER BEING MOVED + JRST UPOTR ;YES DON'T UPDATE FOR HIM + MOVEM U,UPUSR ;SAVE AS LAST USER SET UP + LPMR UPGML(U) ;LOAD USERS MAP + UPOT3: LDB B,POTBPT(A) ;GET CURRENT ABS POSITION + HLRZ C,POTVAL(A) ;GET POS LAST TIME + TRNE C,400000 ;SKIP UNLESS FIRST TIME + JRST UPOT3A + MOVE T,B + SUB T,C + MOVMS T + CAMG T,PTNOIS + JRST UPOTR +UPOT3B: HRLM B,POTVAL(A) ;SAVE FOR NEXT TIME + SUB B,C ;GET AMOUNT OF INCREMENT + CAIL C,5252 ;SKIP IF NOT IN UPPER THIRD + JUMPG B,UPOT4 ;JUMP IF IN UPPER THIRD AND GOING UP + CAIGE C,2525 ;SKIP IF NOT IN LOWER THIRD + JUMPL B,UPOT5 ;JUMP IF IN LOWER THIRD AND GOING DOWN +UPOT6: HRRE C,POTVAL(A) ;GET PREV INCREMENTAL VALUE + ADD C,B ;UPDATE BY POT INCR + CAILE C,7777 ;IF NEW VALUE WOULD EXCEED 7777 + MOVEI C,7777 ;CLAMP IT TO 7777 + CAIGE C,0 ;IF NEW VALUE WOULD BE LESS THAN 0 + MOVEI C,0 ;CLAMP IT TO 0 + HRRM C,POTVAL(A) ;STORE NEW INCR VALUE + JSP B,@POTUPD(A) ;CALL ROUTINE TO COMPUTE NEW VARIABLE VALUE + HRRZ T,POTVPT(A) ;STORE VAR IN USER MEM + XCTRI XR,[MOVE B,(T)] + JRST .+2 + JRST INARK + MOVEI D,B + HLL D,POTVPT(A) + DPB C,D + XCTRI XW,[MOVEM B,(T)] ;STORE VAR IN USER MEM + JRST UPOTR + +INARK: SETOM POTUSR(A) ;THIS POT A LOSER, FLUSH + SOS POTCON + SOS IMPXF + SOSGE IMXNTO + DATAO DSDEVN,[MPX] + JRST UPOTR ;RETURN FOR MORE POTS + +UPOT4: HRREI C,-6(B) ;C_DELTA-6 + IMULI C,3 ;C_DELTA*3-22 + CAMLE C,B ;IF POT TURNED UP FAST + MOVEM C,B ;THEN BOOST INCREMENT + JRST UPOT6 ;RETURN TO STORE + +UPOT5: HRREI C,6(B) ;C_DELTA+6 + IMULI C,3 ;C_DELTA*3+22 + CAMGE C,B ;IF POT TURNED DOWN FAST + MOVEM C,B ;THEN DECREASE DECREMENT + JRST UPOT6 ;RETURN TO STORE + +PUFXA: HLRZ C,POTVAL(A) ;ABS ENTRY, USE DIRECT VALUE +PUFXI: MUL C,POTSCL(A) ;INCR ENTRY, SCALE VALUE + ASHC C,25. ;200000,,=FULL WORD + ADD C,POTOFS(A) ;OFFSET VALUE + JRST (B) ;RETURN WITH USER FIELD VALUE + +PUFLA: HLRZ C,POTVAL(A) ;ABS ENTRY FOR FLOAT PT +PUFLI: TLC C,232000 ;FLOAT POT VALUE + FAD C,C ;NORMALIZE + FMPR C,POTSCL(A) ;SCALE FLOATING VALUE + FADR C,POTOFS(A) ;ADD OFFSET + JRST (B) ;RETURN WITH NEW FLOATING VAR VALUE + +UPOT3A: MOVE C,B ;FIRST TIME USE CURRENT VALUE + JRST UPOT3B + + +NARK: SETOM POTUSR(B) ;TURN OFF AND FREE POT CHANNEL + SOS POTCON ;DECREMENT # OF SLOTS IN USE + JRST IMXCL1 ;FLUSH THIS USE OF MPX AND MAYBE DEASSIGN MPXR + +POTCLS: MOVEI A,NARK ;ON CLOSE FLUSH ALL ENTRIES FOR USER +POTCLA: MOVSI B,-NPOTCH ;SET UP TO TEST ALL ENTRIES FOR USER U +POTCL1: CAMN U,POTUSR(B) ;SKIP IF DIFFERENT USER + PUSHJ P,(A) ;FLUSH IT MAYBE + AOBJN B,POTCL1 ;TRY ALL SLOTS + POPJ P, ;DONE + +EBLK +POTUSR: REPEAT NPOTCH,-1 ;-1=FREE, 0=PROCESS, +=USER INDEX +POTBPT: BLOCK NPOTCH ;BYTE PTR INTO MPXBUF +POTVPT: BLOCK NPOTCH ;BYTE PTR INTO USER MEM INDEXED BY R +POTVAL: BLOCK NPOTCH ;DIRECT VALUE,,INCR VALUE +POTUPD: BLOCK NPOTCH ;ADDR OF ROUTINE TO COMPUTE NEW VALUE +POTSCL: BLOCK NPOTCH ;SCALE FACTOR FOR VARIABLE +POTOFS: BLOCK NPOTCH ;OFFSET FOR VARIABLE +MPXPT: REPEAT 3,301400-140000*.RPCNT,,MPXBUF ;POINTERS FOR 12 BIT MPX BYTES +UPUSR: 0 ;USER FOR WHOM RELOC SETUP AND NOT STOPPED +UPTPGT: BLOCK 8 ;SAVE MAP + +POTCON: -1 ;-1 + +PTNOIS: 3 ;IGNORE ANY CHANGE < OR = THIS AS POT NOISE +] + +SUBTTL 340 DISPLAY + +IFN 340P,[ +; +; DISPLAY INTERRUPT ROUTINE +; +DRECYC: 0 +; +BBLK +; + MOVEM A,LPTA + MOVE A,DRECYC + MOVEM A,LPTBRK + MOVE A,[B,,LPTB] + BLT A,LPTB+17-B+1-1 + JRST DRECY1 +SRECYC: MOVE A,[B,,LPTB] + BLT A,LPTB+17-B+1-1 + CONSZ DIS,2000 + JRST DSLTPB ;LIGHT PEN BREAK + SKIPGE 340MD + JRST SRCYRB ;RANDOM BREAK + CONSZ DIS,5000 + JRST SRCY4 +DRECY1: +; DATAI 710,A +; SUB A,LQTIM +; CAIL A,32000./2 +; JRST DISF2 ;MISSING CLOCK BREAK DUE TO DIS + HLRE A,DBLKOP + SKIPL A + TDZA A,A + MOVNS A + ADDB A,DWDS ;CREDIT BACK WDS NOT USED + JUMPL A,DISF2 + HRRZS DBLKOP + SKIPE 340MD + JRST SRCY3 ;IDS OR DIS +SRCY1: HRRZ A,LDISP + JUMPE A,ENDLIS + JSP B,DPFTCH + JUMPL A,SRCY2A ;SINGLE BLKO PNTR + MOVEM A,LDISP ;LIST + HLRZS A + JUMPE A,SRCY5 ;THIS ENTRY NULL + JSP B,DPFTCH + SKIPGE LMODE + JRST SRCY1A ;DSTRT +SRCY1C: JUMPGE A,SRCY5 + MOVEM A,LUBLKP ;SAVE FOR DEBUGGING + HLRO C,A + MOVNS D,C ;+ COUNT + LDB E,[1200,,A] ;WD WITHIN PG + ADD E,D + LSH E,-10. + AOS E + MOVE J,E ;SAVE # EXEC PGS REQD + SUBI E,N340PB + JUMPG E,SRCY2B ;CANT MAKE IT IN ONE WHACK + MOVN Q,E ;SAVE MAX ACCEPT STARTING EXEC PG # + HRLZS E + HRRZ C,A + CAIGE C,20 + JRST DISLOS + ANDI C,776000 ;USER PG # + MOVNI R,1 ;BEST STARTING PLACE SO FAR +SRCY2D: CAMN C,340DA(E) ;LOOK FOR PG SET UP TO RIGHT USER PG + JRST SRCY2F ;FOUND ONE +SRCY2I: AOBJN E,SRCY2D + HRRZ E,R + JUMPGE R,SRCY2C ;PARTIALLY SET UP PLACE FOUND + AOS 340DP + CAML Q,340DP ;NONE AVAIL, IS RING PNTR IN ACCEPTABLE AREA? + SKIPA E,340DP ;YES + CLEARB E,340DP ;NO RESET +SRCY2C: MOVE R,DDAD(E) + LSH R,-10. + DPB R,[121000,,A] ;SWITCH BLKO PNTR TO EXEC MD PG + MOVEM A,LDBLKP + MOVEM A,DBLKOP + HLRES A ;FOR GROSS DISPLAY LISTS + ADDM A,DWDS ;APPROX TO WDS TO DISPLAY + IDIVI A,1000. + SOS A ;QUOTIENT MAY BE ZERO + MOVEM A,DISDIE + MOVNI A,EWRT + ADDM A,DWDS + ADDI E,2 ;OFFSET FOR POINTER PAGES + MOVEI A,0 +SRCY2E: CAME C,A340P1(E) ;PG SET TO RIGHT ADR? + JRST SRCY2J ;NO SET UP +SRCY2K: ADDI C,2000 + AOS E + SOJG J,SRCY2E ;SET UP ALL PGS IN BLOCK + CONSZ DIS,5400 + CONO DIS,100\SDCHN_3\DISCHN + JRST SRCYCX + +SRCY2J: JSP B,DDFTC + MOVEI B,-2(E) + MOVEM B,340DP + JRST SRCY2K + +SRCY2B: JRST DISLOS ;TEMP + +SRCY2F: MOVE D,J ;FIRST PAGE MATCHES, DO ENOUGH ADDITIONAL PAGES MATCH? + SOJLE D,SRCY2C ;ONLY ONE PAGE NEEDED. WINS + MOVEI TT,2000(C) + MOVEI R,1(E) +SRCY2H: CAME TT,340DA(R) + JRST SRCY2G ;NOT SET UP FOR WHOLE BLOCK + ADDI TT,2000 + AOS R + SOJG D,SRCY2H + JRST SRCY2C ;SET UP FOR WHOLE BLOCK. WIN + +SRCY2G: HRRZ R,E ;SAVE BEST SO FAR + JRST SRCY2I + DPFTCH: HRRZ C,A + CAIGE C,20 + JRST DISLOS + TRZ C,1777 + MOVSI E,-N340PB-2 +DPFTC2: CAME C,A340P1(E) ;PG SET UP TO RIGHT ADR? + JRST DPFTC1 ;NO + TRZ A,776000 ;YES RETCH REL ADR + XCTRI [MOVE A,@DPAP(E)] + JRST (B) ;NO FAULT + JRST 4,. ;SHOULD HAVE BEEN VERIFIED WHEN LOADED + +DPFTC1: AOBJN E,DPFTC2 ;LOOP ON ALL EXEC PNTR PAGES + MOVE E,340PP ;NONE SET UP SO SELECT ONE TO SET UP + AOS D,340PP ;INCR IT FOR NEXT TIME + CAILE D,1 + CLEARM 340PP ;RESET +DDFTC: SPM DPBS ;ENTRY FOR DATA PGS STORE MAP + SKIPGE U,DISUSR + JRST 4,. + SKIPL CIRPSW + JRST DDFTC2 ;MAP MIGHT CHANGE + SKIPGE A340P1(E) + JRST DDFTC3 + SETOM A340P1(E) ;WIPE OUT OLD ENTRY + LDB W,DPEP(E) ;PICK UP OLD PAGE + TRZN W,600000 ;NO ACCESS + JRST 4,. + ANDI W,PMRCM + CAIL W,TSYSM + JRST 4,. + MOVEI R,0 + DPB R,DPEP(E) + SKIPGE DDEXCF+340P1(E) + JRST DDFTC3 + LDB R,[MUR,,MEMBLT(W)] + CAIE R,MURUSR + JRST 4,. + MOVSI R,-1 + ADDM R,MMSWP(W) ;REDUCE COUNT OF EXEC REFS +DDFTC3: MOVE W,C ;SET PAGE IN E TO PNT TO ADR IN C + LSH W,-10. ;GET USR PG # + ROT W,-1 ;GET WD # AND SAVE WHICH HALF IN SIGN + ADDI W,UPGMP(U) + HLRZ R,(W) + SKIPGE W + HRRZ R,(W) ;PICKS UP PAGE ENTRY + HLRZ T,UPGCP-UPGMP(W) + SKIPGE W + HRRZ T,UPGCP-UPGMP(W) + TRNN R,600000 + JRST DDFTC1 ;NO ACCESS OR SWAPPED OUT + LDB Q,[PMRCAD,,R] + CAIN T,-1 + JRST DDFTC4 ;ABS PG + CAILE Q,TSYSM + JRST 4,. + SKIPGE MEMBLT(Q) + JRST DDFTC2 ;CAN'T SET UP EXEC PG POINTING TO THIS ONE + LDB TT,[MUR,,MEMBLT(Q)] + CAIE TT,MURUSR + JRST 4,. + CLEARM DDEXCF+340P1(E) + MOVSI TT,1 + ADDM TT,MMSWP(Q) ;AOS COUNT OF EXEC PGS +DDFTC5: MOVEM C,A340P1(E) + DPB R,DPEP(E) ;STORE USERS PG ENTRY IN EXEC MAP + LPMR DPBS ;RESET ASSOC REG + ANDI A,1777 ;FLUSH USER ADR EXCEPT WD IN PAGE + XCTRI [MOVE A,@DPAP(E)] ;REF PAGE TO MAKE SURE ITS THERE, ETC + JRST (B) + JRST 4,. + +DDFTC4: SETOM DDEXCF+340P1(E) ;INDICATE PAGE POINTING TO ABS PAGE + JRST DDFTC5 + +DDFTC1: JUMPE R,DISLOS ;MAP COMPLETELY 0 MUST BE ILM + JUMPE T,DISLOS ;ILM + MOVEM U,DISSWI + LDB W,[121000,,C] + MOVEM W,DISSPG ;RQ PG IN +DDFTC2: MOVNI A,3 ;HANG FOR 3 60THS + JRST DISF2A + +SRCY1A: JUMPGE A,SRCY1B + MOVEI A,-1(A) +SRCY1D: JSP B,DPFTCH + SOJA A,SRCY1C + +SRCY1B: TLNN A,777000 + JRST SRCY5 + HLRZ A,LDISP + JRST SRCY1D + +SRCY3: SOSGE DTIME + JRST DISF ;LIMIT REPETITION RATE + SKIPL NDSFMS ;SKIP ON FRAME HACK NOT ACTIVE + JSP B,ENDFM1 ;MAYBE STOP DISPLAY AFTER SPEC # OF FRAMES + MOVE A,IDBLKP + MOVEM A,DBLKOP + CONO DIS,100\SDCHN_3\DISCHN + SETOM DISDIE + JRST SRCYCX + +SRCY4: CONO DIS,200\SDCHN_3\DISCHN ;EDGE GRONK DIS AND KEEP GOING + JRST SRCYCX + +DISF2: MOVNI A,300. +DISF2A: MOVEM A,DTIME + SETOM DISON + JRST DISF3 + +DISF: SETOM DISON +DISF1: MOVEI A,1 + MOVEM A,DTIME +DISF3: CONO DIS,100 +DISF4: MOVEI A,DIS300-1 + MOVEM A,DBLKOP +SRCYCX: MOVE A,[JSR DBLKPB] +SRCYB1: MOVEM A,40+2*DISCHN +SRCYB2: JRST LPTRT1 + +DIS300: 3000 + 3000 + +DCRSTP: SKIPE 340MD ;STOP DISPLAY FOR CORE SHUFFLING + POPJ P, ;BUFFER NOT IN USER CORE SO NO ACTION +DCRST1: SETOM CDISOF + CONO DIS,0 + POPJ P, + +DCRRST: SKIPE 340MD ;DISPLAY RESTART + POPJ P, + SKIPL DISOFF + CONO DIS,SDCHN_3+DISCHN + CLEARM CDISOF + POPJ P, + +DSLTPB: DATAI DIS,LLTPSN + AOS LTPCNT + HRRZ A,LLTPSN + ADDM A,LTPCY + HLRZ A,LLTPSN + ADDM A,LTPCX + SKIPGE B,DISUSR + JRST 4,. + MOVEI A,%PILTP + AND A,MSKST(B) + IORM A,PIRQC(B) + CONO DIS,@LTPDCN + JRST SRCYCX + +EBLK + +DBLKP1: 0 +DBLKPB: 0 + +BBLK + MOVEM A,DBLKP1 + MOVE A,[BLKO DIS,DBLKOP] + MOVEM A,40+2*DISCHN + MOVE A,DBLKP1 + JRST 12,@DBLKPB + +SRCYRB: CONI DIS,A + SKIPGE A + CONO DIS,100 ;WOULD ASSIGN IF IDLE + MOVE A,[JSR DIGNOR] + JRST SRCYB1 + +EBLK + +DIGNOR: 0 + +BBLK + CONO DIS,0 + DATAO DSDEV,[DSNDIS] + JRST 12,@DIGNOR + +ENDLIS: SETOM DISDIE + MOVE A,DROOT + MOVEM A,LDISP + SOSGE DTIME + JRST DISF ;LIMIT REPETION RATE + SKIPL NDSFMS + JSP B,ENDFM1 ;HACK FRAME HACK + CONO DIS,100\SDCHN_3\DISCHN + JRST SRCY1 + +ENDFM1: SKIPE NDSFMS ;STOP DISPLAY IF SPEC # OF FRAMES UP ELSE RETURN + SOSGE NDSFMS + JRST ENDFM2 ;STOP WORLD + JRST (B) + +ENDFM2: SETOM DISOFF + JRST DISF1 + +SRCY5: MOVNI A,EWRT/2 + ADDB A,DWDS + JUMPGE A,SRCY1 + JRST DISF2 + +DISLOS: SKIPE 340MD + JRST 4,. + SKIPGE A,DISUSR + JRST 4,DISF2A + MOVEI B,%PIDIS + IORM B,PIRQC(A) + MOVSI A,(SETZ) + JRST DISF2A ;DIE FOR A LONG TIME + +SRCY2A: SOSGE DTIME + JRST DISF + SKIPL NDSFMS + JSP B,ENDFM1 + CONO DIS,100\SDCHN_3\DISCHN + JRST SRCY1C + + +SUBTTL 340 DISPLAY - .DSTART, .DSTRTL + +DISACR: CAME U,DISUSR + POPJ P, + SKIPE 340MD ;COME HERE IF PAGE BEING FLUSHED + EXEC PAGE POINTING TO IT + JRST 4,. ;SHOULD NOT BE SET UP TO USER PAGE + CONO PI,UTCOFF + SETOM A340P1-340P1(T) + SKIPGE DDEXCF(T) + JRST DISAC1 + ADDB J,MMSWP(TT) + SKIPGE J + JRST 4,. +DISAC1: SKIPGE DISOFF + JRST POPJ1 + PUSH P,T + PUSHJ P,DISZAP + POP P,T + JRST POPJ1 + +;ROUTINES TO START 340 DISPLAY WITH DIS BUFF IN USERS CORE +ADSTART: TDZA E,E ;CALL 10, +ADSTL: MOVNI E,1 ;CALL 12, + MOVEI A,0 + PUSHJ P,ADSDV + POPJ P, + SETOM DISOFF + CONO DIS,0 + CLEARM 340MD + MOVEM E,LMODE + HRRZ C,40 + MOVEM C,DROOT + MOVEM C,LDISP + SETZM DISOFF + PUSHJ P,DISZAP + JRST CLKOJ1 + +ANDIS: CAME U,DISUSR + POPJ P, + UMOVE A,(J) + JUMPL A,ANDIT1 ;WAIT FOR COMPLETION OF LAST NDIS + JUMPE A,ANDIT2 ;RETURN COUNT LEFT FROM LAST NDIS + MOVEM A,NDSFMS ;DISPLAY N TIMES AND THEN STOP + SKIPL DISOFF + JRST POPJ1 + SETOM DISDIE + CLEARM DISOFF + PUSHJ P,DISZAP + JRST POPJ1 + +ANDIT1: SKIPL DISOFF + PUSHJ P,UFLS + POPJ P, + +ANDIT2: MOVE A,NDSFMS + JRST APTUAJ + +SUBTTL 340 DISPLAY - .DSTOP, .DCLOSE, .LTPEN +ADSTOP: CAMN U,DISUSR ;OPER 16 + SKIPGE DISOFF + POPJ P, +ADCLB: PUSH P,B + PUSH P,C + MOVSI C,-1 + SETOM DISOFF + SETZM DBLINK + CONO DIS,0 + MOVEI A,1 + MOVEM A,DTIME + SETZM DISON + SETOM DISDIE + CONO PI,UTCOFF + MOVSI A,-N340CL +ADCLB1: SETOM A340P1(A) + LDB B,DPEP(A) + ANDI B,600000+PMRCM + SKIPGE DDEXCF+340P1(A) + JRST ADCLB2 ;POINTING TO EXEC PG + TRZE B,600000 + ADDM C,MMSWP(B) +ADCLB2: AOBJN A,ADCLB1 + CLEARM 340PP + CLEARM 340DP + CLEARM EXEUMP+.340P1 + REPEAT N340PB/2,CLEARM EXEUMP+.DPG0+.RPCNT + MOVE A,[JSR DIGNOR] + MOVEM A,40+2*DISCHN + CONO PI,UTCON + POP P,C + JRST POPBJ + +ADCL1: SOSE DISNTO + POPJ P, + JRST AIDS7 + +ADCLOSE: CAME U,DISUSR ;OPER 15 + POPJ P, + SKIPLE 340MD + JRST AIDS8 +AIDS7: PUSHJ P,ADCLB + PUSHJ P,ADCL2 + JFCL +AIDS9: SETOM 340MD + SETOM DISUSR + DATAO DSDEV,[DSNDIS] ;DEASSIGN DIS + POPJ P, + +AIDS8: MOVE A,U ;FLUSH CHNLS IN CASE OF .DCLOSE FROM DIS OR IDS + PUSHJ P,CHSCAA + PUSHJ P,ADSDV4 + JRST AIDS7 + +ALTPEN: MOVE C,B + CAME U,DISUSR ;CALL 14, + JRST ALTPP2 + XCTR XR,[SKIPL A,(C)] + JRST ALTPP1 + TLNN A,377777 + JRST .+3 + SKIPN LTPCNT + PUSHJ P,UFLS +ALTPP1: CONO PI,LPTOFF ;INHIBITS LPEN BREAKS + MOVE A,LDISP + XCTRI XW,[MOVEM A,4(C)] + SKIPA A,DBLKOP + JRST ALTPPL + TRZ A,400000 + LDB B,[121000,,A] + LDB B,[121000,,A340P1-340P1(B)] + DPB B,[121000,,A] + XCTRI XW,[MOVEM A,5(C)] + SKIPA B,C + JRST ALTPPL + HRLI B,LLTPSN + XCTRI XBW,[BLT B,3(C)] + JRST .+2 + JRST ALTPPL + SETZB A,LTPCNT + MOVEM A,LTPCY + MOVEM A,LTPCX + JRST LPTONJ + +ALTPP2: XCTR XW,[SETZM (C)] + XCTR XW,[SETZM 1(C)] + POPJ P, + +ALTPPL: CONO PI,LPTON + PUSHJ P,TPFLT + JRST ALTPEN + +SUBTTL 340 DISPLAY + +ADSDV: ;A HAS NEW 340MD + CONO PI,CLKOFF + CONI DIS,T ;DIS AVAILABLE + JUMPN T,ADSDV1 ;YES + CONO DIS,0 + CONI DIS,T + JUMPE T,ADSDVN ;DIS NOT AVAIABLE +ADSDV1: SKIPL T,DISUSR + CAMN U,DISUSR + JRST ADSDVY ;YES + CAME U,UMASTER + JRST ADSDVM ;MAYBE +ADSDV2: SKIPGE A,DISUSR ;TAKE AWAY DISPLAY + JRST ADSDV3 + PUSHJ P,RPCCK +ADSDV7: SKIPL DISUSR + SKIPG 340MD + JRST ADSDV3 + PUSH P,R + PUSHJ P,CHSCAA ;CHANGE 340 CHANNELS TO NUL DEV + PUSHJ P,ADSDV4 + POP P,R + SETZM DISNTO +ADSDV3: MOVE A,340MD +ADSDVY: SETZM DBLINK + SETOM NDSFMS ;TURN OFF FRAMER HACK + CAME A,340MD + JUMPE A,ADSDV5 ;SAME USER CLOBBERING HIS IDS OR DIS +ADSDV6: PUSHJ P,ADCLB + MOVEM U,DISUSR +ADCL2: SKIPGE A,340BF + JRST CLKOJ1 + LSH A,-10. + PUSHJ P,MEMR + SETOM 340BF + JRST CLKOJ1 + +ADSDV4: HRRZ Q,(R) + CAIG Q,DN340L + CAIGE Q,DN340B + POPJ P, ;NOT A 340 CH + CAIL Q,DN340C + SKIPA T,[NLODN] ;UNIT MODE + MOVEI T,NLBDN ;BLOCK MODE + SOS DISNTO + HRRM T,(R) + POPJ P, + +ADSDV5: SKIPGE 340MD + JRST ADSDV6 + MOVE A,DISUSR + JRST ADSDV7 + +ADSDVM: CAMN T,UMASTER + JRST ADSDVN ;CURRENT USER UMASTER + MOVE T,UTMPTR(U) + MOVE T,TTYTYP-USRRCE(T) ;GET BITS FOR NEW GUY IN LH OF T + HRR T,DISUSR + HRR T,UTMPTR(T) + HLR T,TTYTYP-USRRCE(T) + TRNE T,%TT3HP + JRST ADSEQ1 ;CURRENT USER HAS HIGH PRIORITY + TRNE T,%TT340 + JRST ADSEQ2 ;CURRENT USER NEAR 340 + TLNN T,%TT340+%TT3HP ;GIVE TO NEW GUY IF HE IS EITHER + JRST ADSEQ +ADSWIN: JRST ADSDV2 + +ADSEQ1: TLNN T,%TT3HP + JRST ADSDVN ;NO +ADSEQ: SKIPL TTYTBL(U) ;MAYBE + JRST ADSWIN +ADSDVN: JRST CLKONJ + +ADSEQ2: TLNE T,%TT3HP + JRST ADSWIN + TLNN T,%TT340 + JRST ADSDVN + JRST ADSEQ + +SUBTTL 340 DISPLAY AS ASCII DEVICE + +DISO: PUSHJ P,AIDS1 + JRST OPNL10 ;NOT AVAILABLE + AOS DISNTO + SETOM 340DMD + LDB B,[20200,,D] + AOS B + LSH B,4 + MOVEM B,CSCALE + LDB TT,[40200,,CSCALE] + MOVNS TT + MOVEI T,170. + LSH T,(TT) + TRZ T,7 + MOVEM T,DISCHS ;CHARS THAT WILL FIT THIS SIZE + MOVEI T,88. + LSH T,(TT) + MOVEM T,DISLNL ;LINES THAT WILL FIT + PUSHJ P,DSIZAP + MOVSI T,-1777 + HRR T,340BF + SOS T + MOVEM T,IDBLKP + SETZM DISOFF + PUSHJ P,DISZAP + SETOM 340T + JSP Q,OPSLD3 + DN340C,,DN340B + DN340H,,DN340W + +340FF: SKIPL 340T + JRST 340FF1 + MOVE A,TIME + MOVEM A,340T +340FF1: MOVE T,340T + ADDI T,30.*3 + CAML T,TIME + PUSHJ P,UFLS + SETOM 340T + PUSHJ P,ADCLB + PUSHJ P,DSIZAP + JRST DISZAP + +DSIZAP: SETZM DBLOAT + SETZM 340XMD + SETZM DBLINK + MOVE T,340BF + MOVEI A,34117 + IOR A,CSCALE + MOVEM A,(T) + PUSH T,[221700060000] + HRLI T,0600 + MOVEM T,340BFP + MOVE A,[403737403737] + MOVEI B,1(T) + HRLS B + AOS B + MOVEM A,1(T) + BLT B,1775(T) + MOVE A,DISLNL + MOVEM A,DISLNS + MOVE A,DISCHS + MOVNM A,DISCHC + MOVEI T,(HRRZ I,(A)) + HRLM T,AIDC1 + POPJ P, + + +340B: MOVEI E,340D + JRST NBTOCH + +340C: SKIPGE C + SKIPA A,(C) + UMOVE A,(C) + ANDI A,177 +340D: CAIN A,^C + POPJ P, + CAIN A,^L + JRST 340FF + CAIN A,^T + JRST DSIZAP + SKIPE DISLNS + SKIPGE DBLOAT + POPJ P, + CAIN A,^B + JRST BLNKON + CAIN A,^E + JRST BLNKOF + SKIPE 340XMD + PUSHJ P,340D1 ;ENTER CHR MOD INF NOT ALREADY +340E: EBLK +AIDC1: HRRZ\HLRZ I,DISTBL(A) + BBLK + TRNN I,-100 + JRST 340FC ;NORMAL CHR + TRNN I,-200 + JRST 340K ;FAKE OUT 340 NON-SPACING CHRS + PUSHJ P,(I) ;ROUTINE DISPATCH (MAY SKIP OR SKIP TWICE) + JRST 340E ;WRONG CASE OR SOMETHING, TRY AGAIN +340F: IDPB I,340BFP +340F2: MOVE J,340BFP + ANDI J,1777 + CAIL J,1776 + SETOM DBLOAT + POPJ P, + +340FC1: SKIPL DISCHC ;DISPLAY IF COUNT NOT OUT BUT DONT INCR COUNT +340FC: AOSG DISCHC ;INCR COUNT + DISPLAY IF NOT OUT + JRST 340F + JRST 340F2 + +340HD1: SKIPN 340XMD ;ESCAPE TO PARAM MODE + PUSHJ P,340H1 +340D1: MOVEI I,74117 ;PARAM WD + IOR I,CSCALE + PUSHJ P,340F ;STORE PARAM WD + MOVEI I,6 + DPB I,[300600,,340BFP] ;SWITCH TO CHR MODE + SETZM 340XMD + POPJ P, + +340K: MOVEI I,40 ;SPACE TO MAKE SPACING + PUSHJ P,340FC1 + XCT AIDC1 ;GET NON-SPACING LETTER AND DISPLAY + JRST 340FC + +340W: JSP Q,WRDBT + XCTR XRW,[MOVSS (C)] + PUSHJ P,340H + XCTR XRW,[MOVSS (C)] +340H: SKIPGE DBLOAT + POPJ P, + SKIPN 340XMD + PUSHJ P,340H1 ;ENTER HALF WD MODE IF NOT ALREADY + UMOVE I,(C) ;PICK UP LOSERS HALF WD + JRST 340F + +340H1: MOVEI I,37 ;IN CHR MODE, EXCAPE + PUSHJ P,340F + LDB I,[360600,,340BFP] + JUMPE I,340H2 + CAIE I,22 + JRST 340H1 +340H2: MOVEI A,22 + DPB A,[300600,,340BFP] + SETOM 340XMD + POPJ P, + +BLNKON: MOVE A,DBLINK + CAIL A,DBLNKN + POPJ P, + PUSHJ P,340HD1 + MOVE B,340BFP + AND B,[770060,,1777] ;ADR OF PARAM WD TO BLINK INTEN OF + TLO B,300+B + MOVE A,DBLINK + MOVEM B,DBLNKB(A) + AOS DBLINK + MOVEI T,15. + PUSHJ P,CLQADD + BLINKB + JRST 340F2 + +BLNKOF: PUSHJ P,340HD1 + JRST 340F2 + +BLNKBR: SKIPN A,DBLINK + JRST CLQRET ;BLINKING TURNED OFF + SKIPL B,340BF + SKIPGE CDISOFF + JRST BLNKB3 + MOVE C,DBLNKF +BLNKB2: DPB C,DBLNKB-1(A) + SOJG A,BLNKB2 + SETCMM DBLNKF ;COMPLEMENT FLAG +BLNKB3: MOVEI T,15. ;1/4 SEC + MOVEI C,BLINKB + JRST CLQREE + +SUBTTL 340 DISPLAY + +AIDS1: MOVEI A,2 + PUSHJ P,ADSDV ;DETERMINE IF THIS LOSER SHOULD GET DISPLAY + POPJ P, +AIDS3: PUSHJ P,TCALL + JRST IOMQ + JRST AIDS2 ;NO MEM AVAIL + MOVEI B,MUDISB + MOVE T,A + LSH T,10. + MOVEM T,340BF + DPB B,[MUR,,MEMBLT(A)] + MOVEI B,2 + MOVEM B,340MD + JRST POPJ1 + +AIDS2: SKIPG MEMFR + JRST AIDS9 + PUSHJ P,LOSSET + AIDS9 + PUSHJ P,UDELAY + PUSHJ P,LSWDEL + JRST AIDS3 + +IFN 0,[ +;INTERPRETIVE DISPLAY COMPILER + +IDISO: PUSHJ P,AIDS1 + JRST OPNL10 ;NOT AVAIL + AOS DISNTO + SETZM 340DMD + SETOM AISWS + HRLI T,442200 + MOVEM T,340BFP + MOVEI Q,10135 ;TURN OFF LP SCALE 1 INT 5 + IDPB Q,340BFP + MOVEI T,1_4 + MOVEM T,CSCALE + MOVEM T,VSCALE + MOVEM T,ISCALE + MOVSI A,(MOVE) ;DONT HACK CHR'S PER LINE + MOVEM A,DISCHS + MOVNM A,DISCHC + CONO DIS,500 + MOVEI A,DN340I + JRST OPNSLT + + +340I: MOVEM C,AIDPCP + UMOVE C,(C) + +AIDL: UMOVE R,(C) +AIDL2: TRNE R,1 + JRST AIDL1 ;NOT CHR MODE + MOVEI Q,(HRRZ I,(A)) + HRLM Q,AIDC1 + MOVE Q,CSCALE + IORI Q,60100 + PUSHJ P,AIDPY + MOVE J,[220600,,Q] +AIDCL: MOVE B,[440700,,R] +AIDC3: ILDB A,B +EBLK +AIDC1: HRRZ\HLRZ I,DISTBL(A) +BBLK + TRNN I,-100 + JRST AIDC5 + TRNN I,-200 + JRST AIDC7 + PUSHJ P,(I) + JRST AIDC1 +AIDC5: IDPB I,J + TLNN J,770000 + PUSHJ P,AIDC2 + TLNE B,760000 + JRST AIDC3 + AOS C + UMOVE R,(C) + MOVE I,UEXIT + CAMN I,[JRST ONEFLS] + JRST AIDC6 + TRNN R,1 + JRST AIDCL +AIDC6: MOVEI I,37 + IDPB I,J + TLNE J,770000 + JRST .-2 + PUSHJ P,AIDC2 + +AIDL1: MOVE B,UEXIT + CAMN B,[JRST ONEFLS] + JRST AIDI + LDB B,[30300,,R] + AOJA C,@AIDTB(B) + +AIDC7: MOVEI I,40 + PUSHJ P,AIDC4 + XCT AIDC1 + JRST AIDC5 + +AIDI: MOVE R,AIDPCP + UMOVEM C,(R) + SOS UUOH + JRST UUOE1 + +AIDTB: AIER1 + AIPT + AIVC + AIINC + AIOP + AIVC + REPEAT 2,AIER1 + +AIPT: LDB I,[251600,,R] ;PICK UP Y + SUB I,DWDB + MOVEI TT,220000 + DPB I,[1200,,TT] + LSH I,-10. + ANDI I,17 + MOVEM I,YFLD + LDB I,[61600,,R] ;X + SUB I,DWDL + MOVEI E,0 + TRNE R,2 + TRO E,2000 ;INTENSIFY + DPB I,[1200,,E] + LSH I,-10. + ANDI I,17 + MOVEM I,XFLD + MOVEI Q,20000 + PUSHJ P,AIDPY + MOVE Q,TT + PUSHJ P,AIDPY + MOVE Q,E + PUSHJ P,AIDPY + JRST AIDL + +AIDC4C: SKIPL DISCHC + POPJ P, + JRST AIDC4 +] +AIDC4B: AOSLE DISCHC + POPJ P, +AIDC4: +IFN 0,[ + SKIPGE 340DMD + JRST AIDC4A ;DIS + IDPB I,J + TLNE J,770000 + POPJ P, +AIDC2: PUSHJ P,AIDPY + MOVEI Q,0 + MOVE J,[220600,,Q] + POPJ P, +] +AIDC4A: IDPB I,340BFP + POPJ P, +IFN 0,[ +AIDPY: HRLS Q + DATAI DIS,AIDPIC + DATAO DIS,Q +AIDP1: MOVEI H,50 +AIDP1A: CONSZ DIS,DVEF+DHEF ;EDGE FLAGS + JRST DEGFS + CONSO DIS,200 + SOJG H,AIDP1A + JUMPE H,AIER2 + CONSZ DIS,DVEF+DHEF + JRST DEGFS + SKIPN XFLD + SKIPE YFLD + JRST AIDP2 +DEG4B: HRRZ H,340BFP + SUB H,340BF + CAIL H,1777 + JRST AIER3 + IDPB Q,340BFP +AIDP2: MOVEI Q,0 + POPJ P, + +DEGFS: DATAI DIS,DEGVCC + CONI DIS,H + LSH H,-15. + ANDI H,7 + CAIN H,4 ;VECTOR + JRST DEGVC + SKIPN XFLD + SKIPE YFLD + JRST DEG5A + MOVEI Q,400000 + CAIN H,3 + MOVEI Q,373737 + PUSH P,H + PUSHJ P,DEG4B ;LEAVING INSERT APPROPRIATE ESCAPE INSTEAD + POP P,H +DEG5A: CONO DIS,200 + MOVEI TT,50. + CONSO DIS,DVEF+DHEF+200 + SOJG TT,.-1 + JUMPE TT,AIER2 + CONSO DIS,200 + JRST DEG5A ;RIDE OUT TO FINAL EDGE + DATAI DIS,TT + XOR TT,AIDPIC + TRNN TT,1000 + JRST DEG5B + HRR TT,AIDPIC + TRNE TT,1000 + AOS XFLD + TRNN TT,1000 + SOS XFLD +DEG5B: TLNN TT,1000 + JRST DEG4 + HLL TT,AIDPIC + TLNN TT,1000 + SOS YFLD + TLNE TT,1000 + AOS YFLD + JRST DEG4 + +DEG5: MOVE TT,DEGVCC + CONSZ DIS,DVEF + JRST DEG1 +DEG3: CONSO DIS,DHEF + JRST DEG4 + TRNE TT,1000 + SOS XFLD + TRNN TT,1000 + AOS XFLD +DEG4: MOVEI TT,0 + DPB TT,[44000,,XFLD] + DPB TT,[44000,,YFLD] + CONSO DIS,200 + CONO DIS,200 ;CONTINUE + MOVEI TT,100. + CONSO DIS,200+DVEF+DHEF + SOJG TT,.-1 + JUMPE TT,AIER2 + SKIPN XFLD + SKIPE YFLD + JRST AIDP1 ;NOT COMING ON +DEG4F: DATAI DIS,TT + CAIN H,4 + MOVE TT,DEGVCC + PUSH P,Q ;COMING ON PRODUCE SETPOINT + PUSH P,H + MOVEI Q,20100 + IOR Q,@DEGSCT(H) + PUSHJ P,DEG4B + HLRZ Q,TT + IORI Q,220000 + PUSHJ P,DEG4B + HRRZ Q,TT + CONI DIS,H + LSH H,-15. + DPB H,[150300,,Q] + MOVE TT,(P) + CAIN TT,4 + JRST DEGVC1 +DEG4D: SUB P,[2,,2] + JRST AIDP1 + +DEGSCT: [0] + [0] + [0] + CSCALE + VSCALE + VSCALE + ISCALE + [0] + +DEG1: TLNE TT,1000 + SOS YFLD + TLNN TT,1000 + AOS YFLD + JRST DEG3 + +DEGVC: SETOM DEGVCF + SKIPN XFLD + SKIPE YFLD + JRST DEG5 ;NOT GOING OFF + CLEARM DEGVCF + HRRZ A,AIDPIC + HLRZ B,AIDPIC + PUSHJ P,DEG4C + CONSZ DIS,DVEF + SUBI B,2 + CONSZ DIS,DHEF + SUBI A,2 + SKIPGE A + MOVEI A,0 + SKIPGE B + MOVEI B,0 + DPB B,[100700,,Q] + DPB A,[700,,Q] + TRO Q,400000 + PUSHJ P,DEG4B + JRST DEG5 + +DEGVC1: SKIPN XFLD + SKIPE YFLD + SKIPLE DEGVCF + JRST .+2 + JRST DEG4D ;VECTOR TOTALLY OUT OF IT + IORI Q,100000 + PUSHJ P,DEG4B + POP P,H + POP P,Q + DATAI DIS,A + HLRZ B,A + HRRZS A + PUSHJ P,DEG4C + DPB B,[100700,,Q] + DPB A,[700,,Q] + MOVE A,DEGVCC + MOVEM A,AIDPIC + JRST AIDP1 + +DEG4C: HRRZ I,DEGVCC + SUB A,I + HLRZ I,DEGVCC + SUB B,I + MOVMS A + MOVMS B + CAIGE A,1000 + JRST .+3 + MOVNS A + ADDI A,2000 + CAIGE B,1000 + JRST .+3 + MOVNS B + ADDI B,2000 + LDB I,[40200,,VSCALE] + MOVNS I + ASH A,(I) ;GET X INC IN A + ASH B,(I) ;Y IN B + POPJ P, + +AIINC: MOVE Q,ISCALE + IORI Q,140100 + PUSHJ P,AIDPY + SETOM DDINCI + MOVEI Q,0 + MOVE B,[200400,,Q] +AIIN1: MOVE D,[440600,,R] +AIIN8: ILDB T,D + LDB E,[200,,T] ;LOAD COUNT + JUMPE E,AIIN5 ;NULL INCREMENT +AIIN7: TRNN T,4 ;SKIP ON INTENSIFY + JRST AIIN2 + SKIPG DDINCI ;SKIP ON SET TO INTENSIFY + JRST AIIN3 + +AIIN7A: LDB H,[30300,,T] + MOVE H,DINCT(H) + IDPB H,B + PUSHJ P,AIIN6 ;MAYBE START NEW WORD + SOJG E,AIIN7 + +AIIN5: TLNE D,700000 + JRST AIIN8 + UMOVE R,(C) + LDB H,[30300,,R] + TRNE R,1 + CAIE H,3 ;INC MODE + TROA Q,400000 + AOJA C,AIIN1 + PUSHJ P,AIIN6A + JRST AIDL2 + +AIIN6: TLNE B,770000 + POPJ P, + +AIIN6A: PUSHJ P,AIDPY + MOVEI Q,0 + SETOM DDINCI + MOVE B,[200400,,Q] + POPJ P, + +AIIN2: SKIPN DDINCI + JRST AIIN7A ;INTENSITY AGREES +AIIN3: SKIPL DDINCI + PUSHJ P,AIIN6A + HRRZM P,DDINCI + TRNE T,4 + TROA Q,200000 + CLEARM DDINCI + JRST AIIN7 + +AIVC: MOVE Q,VSCALE + IORI Q,100100 + LDB A,[251700,,R] ;DY + LDB B,[61700,,R] ;DX + TRNE A,40000 + ORCMI A,77777 + TRNE B,40000 + ORCMI B,77777 + MOVM E,A + MOVM TT,B + MOVE H,VSCALE + LSH H,-4 + ANDI H,3 + MOVNS H + LSH E,(H) + LSH TT,(H) + JUMPN E,.+2 + JUMPE TT,AIDL + PUSHJ P,AIDPY +AIVCL: MOVE H,E + MOVE J,TT +AIVC3: CAIG J,177 + CAILE H,177 + JRST AIVC2 + SUB E,H + DPB H,[100700,,Q] + SKIPGE A + TRO Q,1_<8+7> + SUB TT,J + DPB J,[700,,Q] + SKIPGE B + TRO Q,1_7 + TRNE R,1_1 + TRO Q,200000 + JUMPN E,.+3 + JUMPN TT,.+2 + TRO Q,400000 + PUSH P,A + PUSH P,B + PUSH P,E + PUSH P,TT + PUSHJ P,AIDPY + POP P,TT + POP P,E + POP P,B + POP P,A + JUMPN E,AIVCL + JUMPN TT,AIVCL + JRST AIDL + +AIVC2: LSH J,-1 + LSH H,-1 + JRST AIVC3 + +AIOP: LDB B,[60300,,R] + JRST @AIOPT(B) + +AIOPT: AIER5 + AIPSJ + AIPPJ + AIJMP + AIPSH + AIIPOP ;5 + AIPS + AIER5 + AIER5 + +AIPSJ: XCTR XRW,[AOS D,43] ;PICK UP PDL PNTR AND INCR + XCTR XRW,[MOVEM C,(D)] ;STORE RETURN PC +AIJMP: HLRZ C,R + JRST AIDL + +AIPPJ: UMOVE D,43 + XCTR XRW,[HRRZ C,(D)] + JUMPE C,AIEXT ;POPJ INTO 0 START SIGNAL + XCTR XRW,[SOS 43] + JRST AIDL + +AIEXT: SKIPL AISWS + JRST AIDST3 +AIDST: MOVEI Q,3000 + PUSHJ P,DEG4B + MOVE A,340BF + ADD A,[-2000-1,,-1] + MOVEM A,IDBLKP + MOVEM A,DBLKOP + MOVEI A,1 + MOVEM A,DTIME + SETZM DISOFF + CONO DIS,1100\DISCHN\SDCHN_3 +AIDST3: POPJ P, + +AIPSH: HLRZ TT,R + UMOVE TT,(TT) + XCTR XRW,[AOS D,43] + UMOVEM TT,(D) + JRST AIDL + +AIIPOP: HLRZ TT,R + XCTR XRW,[SOS D,43] + UMOVE E,1(D) + UMOVEM E,(TT) + JRST AIDL + +AIPS: LDB A,[140600,,R] + HLRZ B,R + CAIL A,AIMXP + JRST AIER7 + ANDI B,3 + LSH B,4 + XCT AIPST(A) + JRST AIDL + +AIPST: JRST AIER7 + HLLEM R,AISWS ;START MODE + MOVEM B,CSCALE + MOVEM B,ISCALE + MOVEM B,VSCALE + JRST AIPSA + HLRM R,DWDL + HLRM R,DWDB +AIMXP==.-AIPST + +AIPSA: MOVEM B,CSCALE + MOVEM B,ISCALE + MOVEM B,VSCALE + JRST AIDL +] +EBLK +XFLD: 0 ;HIGH ORDER BITS OF X COOR REG (LIGHT=0) +YFLD: 0 ; ... Y +CDISOF: 0 ;DISPLAY OFF IN CORE ALLOC +340BF: -1 ;POINTER TO 1K BLOCK FOR 340 BF (MEM ADR) +340BFP: 0 ;POINTER TO 340BF + DBLNKN==10. +DBLINK: 0 ;0=IDLE ;+N=NUM OF ENTRIES +DBLNKF: 0 ;BLINK FLAG, -1 MEANS START BLINK OFF +DBLNKB: BLOCK DBLNKN ;BYTE POINTER TO PARAMETER HW TO CHANGE +BLINKB: 0 ;CLOCK QUEUE BLOCK + -1 + JRST BLNKBR +AIDPCP: 0 ;USER LOCN WHERE TO STORE BACK PC IF NECC +CSCALE: 0 ;SCALE FOR CHR WRDS +ISCALE: 0 ;SCALE FOR INCREMENT +VSCALE: 0 ;SCALE FOR VECTOR WDS +DWDL: 0 ;14 BIT COOR OF LH 340 +DWDB: 0 ;14 BIT COOD OF BOT 340 +DEGVCF: 0 ;EDGE FLAG FOR VECT -1 UNLESS GOING AWAY +DEGVCC: 0 ;COORD AT EDGE +DDINCI: 0 ;-1 CURRENT INTENSITY NOT COMMITED (IN INCREMENT MODE) + ;+ => 1 - => 0 +AISWS: 0 ;SELECT DISPLAY START MODE -1 STARTS DISPLAY AFTER IOT +AIDPIC: 0 ;COORDINATES AT START OF AIDPY + +LLTPSN: 0 ;. TO .+3 BLTED TO USER +LTPCNT: 0 +LTPCY: 0 +LTPCX: 0 +LTPDCN: 200\SDCHN_3\DISCHN + +LDISP: 0 ;DISPLAY LINK POINTER +LMODE: 0 ;LISP LINK MODE FLAG +DISOFF: -1 ;-1 IF DIS NOT IN USE OR STOPPED DUE TO FRAME HACK +DTIME: 0 + +340MD: -1 ;MODE IN WHICH DISPLAY OPEN + ;-1 NOT DISPLAYING 0 .DSTART ETC 2 AS DIS OR IDS +340DMD: 0 ;0 IDS -1 DIS +340XMD: 0 ;IN DIS, 0=CH 1=IMAGE +DBLOAT: 0 +340T: 0 ;TIMER FOR DIS PAGE +LUBLKP: 0 ;LAST USER BLKO PNTR SET UP AT IN LEVEL, FOR DEBUGGING + +;START 340 EXECPG AREA + +A340P1: -1 ;USER ADR THAT EXEC PG SET UP FOR +A340P2: -1 +340DA: REPEAT N340PB,-1 +N340CL==.-A340P1 ;THIS BLOCK MUST BE CONSEC +340DP: 0 ;0=> N30PB-1 PNTR TO DATA PGS +340PP: 0 ;PNTR TO 340P1 OR P2 ALTNERATELY + +DPAP: 400000+340P1*2000(A) ;EXEC ADR TO REF PAGE + 400000+340P2*2000(A) +DDAD: REPEAT N340PB, 400000+*2000(A) + +DPEP: .340P1+EXEUMP ;BYTE PNTR TO EXEC MAP PAGE ENTRY + .340P2+EXEUMP +DDEP: REPEAT N340PB, CONC .DPG,\.RPCNT,+EXEUMP + +DPBS: BLOCK 8 ;SAVE PAGE BOX AT PI DIS LVL + +DROOT: 0 ;DIS RESTART POINTER TO LOSER CORE +DBLKOP: 0 ;TEMP DIS BLKO PTR +LDBLKP: 0 ;LAST +DISON: 0 ;-1 IF DIS STOPPED AFTER SPECIAL INT OR BLKO OVERFLOW + ;IE RESTART AFTER PASSAGE OF TIME +DISDIE: 0 ;0 ;-1 IF DIS HASNT DIED +DISTPR: 0 ;-1 TO TURN OFF DISPLAY +IDBLKP: 0 ;BLKO PNTR IF IN INTERP DISPLAY MODE +NDSFMS: -1 ;-1 NOT HACKING FRAME HACK ELSE NUMBER OF FRAMES REMAINING +DISNTO: 0 ;# TIMES DIS OR IDS OPEN +DWDS: 0 ;- # WDS SENT TO DIS-EWRT PER TRIP THRU SRECYC + ;RESET TO MDISWD EVERY 1/30 + ;IF <0 DISPLAY STOPS FOR 5 SEC -300.->DTIME + +DISCHS: 0 ;LENGTH OF LINE IN CURRENT SIZE +DISCHC: 0 ;-# CHR POS REMAINING +DISLNL: 0 ;# OF LINES WILL FIT CURRENT SIZE +DISLNS: 0 ;# LINES REMAINING +BBLK + +DEFINE LC A +A,,DISLC +TERMIN + +DEFINE UC A +DISUC,,A +TERMIN + +DEFINE AC A +A,,A +TERMIN + + + +ADISCR: MOVE I,DISCHS + MOVNM I,DISCHC + MOVEI I,34 + JRST POPJ1 + +DISALF: SOS DISLNS + MOVEI I,33 + JRST POPJ1 + +DSATB: MOVEI I,40 ;B + PUSHJ P,AIDC4B + LDB I,[300,,DISCHC] + SKIPG DISCHC + JUMPN I,DSATB + JRST POPJ2 + +DISBLB: MOVEI I,50 ;DOWN ARROW + PUSHJ P,AIDC4B + TRO A,100 ;CONVERT TO UC LETTER +DISUC: SKIPA I,[HRRZ I,35(A)] ;SWITCH TO UC +DISLC: MOVE I,[HLRZ I,36(A)] ;SWITCH TO LC + PUSHJ P,AIDC4 ;STORE CASE CODE + HLLM I,AIDC1 + POPJ P, + +ADISBS: MOVEI I,72 ;BACKSPACE + SOS DISCHC + JRST POPJ1 + +DISRUB: MOVEI I,"X&77 ;LC X + PUSHJ P,AIDC4 + MOVEI I,72 ;340 BACKSPACE + PUSHJ P,AIDC4 + MOVEI A,"O ;YES, A + POPJ P, ;LOOP BACK + +DISTBL: POPJ2,,POPJ2 ;IGNORE 0 + REPEAT 6,LC DISBLB + LC 63 ;BELL + LC ADISBS + AC DSATB + AC DISALF + LC DISBLB + LC DISBLB + AC ADISCR + REPEAT 33-16,LC DISBLB + LC 47 ;ALT MD (RT ARROW) + REPEAT 4,LC DISBLB + AC 40 + REPEAT 133-41,UC <.-DISTBL>&77 + LC 53 + LC 52 ;BACKSLASH + LC 54 + LC 100+67 + LC 60 + LC 100+66 + REPEAT 173-141,LC <.-DISTBL-140> + LC 55 + LC 62 ;VERTICAL BAR=174 + LC 56 + LC 43 ;TILDE=176 + LC DISRUB +IFN .-DISTBL-200,PRINTX /DISTBL LOSS/ + + +DINCT: 10 + 2 + 14 + 3 + 12 + 16 + 17 + 13 + + + +REPEAT NDOPL, CONC AIER,\.RPCNT+1,: JSP D,AIER + +AIER: HRRZ R,UUAC(U) + ADDI R,IOCHNM(U) + MOVEI D,1+1-AIER1(D) + LSH D,6+18. + IORM D,IOCHST-IOCHNM(R) + MOVE T,AIDPCP + UMOVEM C,(T) + JRST IOCERR +] + +IFN VIDP,[ +; +SUBTTL NEW VIDISECTOR ROUTINES +; +TVCO: HLRZ D,C + SKIPA Q,[TVCOBK] +NVIDI: MOVEI Q,NVDOBK + PUSH P,R + PUSH P,[NVIDI2] + JRST STDOP1 + +NVIDI2: JRST POPAJ + POP P,R + PUSHJ P,NVDGET + JRST NVIDI3 +NVIDI1: MOVEM A,(R) + CAIN Q,TVCOBK + AOS NTVCOS + CAIN Q,TVCOBK + TLNE C,1 ;ONLY DO IF TVC OUTPUT OPEN + PUSHJ P,TVCNOS + JRST POPJ1 + +NVIDI3: PUSHJ P,OPNL25 + JRST NVDCLS + +NVDOBK: 1,,NVDUSR + NVIDOP,,BNVIDO + +BNVIDI: JSP Q,WRDBT +NVIDIT: SKIPGE NVDIFL + PUSHJ P,UFLS + UMOVE B,(C) + MOVEM B,NVDCOR + CONO PI,OMXOFF + SETOM NVDIFL + PUSHJ P,NVDVS1 ;TURNS OMPCH ON + SKIPGE NVDIFL + PUSHJ P,UFLS + MOVE B,NVDCOR + UMOVEM B,(C) + POPJ P, + +RNVDIB: JSP Q,WRDBT +RNVDIU: SKIPN NVDCNT ;TVC INPUT + JRST RNVDO2 + XCTR XRW,[MOVES (C)] ;MAKE SURE GOING TO WIN + MOVE T,NVDOPT + CAMN T,NVDVPT + PUSHJ P,UFLS + MOVE B,(T) + SOS NVDCNT + UMOVEM B,(C) + AOS T,NVDOPT + CAIL T,NVDBUF+NVDLNG + MOVEI T,NVDBUF + MOVEM T,NVDOPT + POPJ P, + +TVCOBK: 3,,NVDUSR + DNVDIU,,DNVDOU + DNVDIB,,DNVDOB + +TVCCLS: SOSGE NTVCOS + PUSHJ P,TVCINI ;TRY TO AVOID GARBAGE PNT PART WAY VIDISECTED +NVDCLS: SOSGE NVDUSE + PUSHJ P,VIDFLS + POPJ P, + +TVCNOS: LDB A,[251700,,C] ;TVC OPEN ROUTINE +TVCN1: TRZ A,703000 ;DONT LET LOSER FOOL AROUND + IORI A,NVDCHN_15. + LDB B,[20300,,A] ;DCO + JUMPE B,TVCO3 + CAIN B,7 + JRST TVCO6 ;DCO DISABLED FOR DCL=7 + IMUL B,[-100] +TVCO4: ADDI B,1300 +TVCO7: MOVEM B,NVDDK ;DARK VALUE CORRECT FOR DCO + MOVE TT,A + XOR TT,TVCONO + TRNE T,340 + JRST TVCO5 ;CHANGE IN VIDI SELECTION STATUS +TVCO5A: MOVEM A,TVCONO + POPJ P, + +TVCO3: LDB T,[200,,A] ;CONF + CAIN T,3 + MOVNI B,100 ;IF CONF=3 & DCO=0 VALUE 100 LESS THAN PREDICTED ABOVE + JRST TVCO4 + +TVCO5: TRZ A,700000 ;CLEAR CHNL OUT OF TVCONO + CONO NVDX,(A) ;START RLYS + MOVEI T,2 + SKIPL TVQBLK+1 ;WAIT IF PREV RQ NOT SATISFIED + PUSHJ P,UFLS + PUSHJ P,CLQADD ;RQ LATER TRANSFER TO VIDD1 + TVQBLK + JRST TVCO5A + +TVCO6: LDB T,[200,,A] ;CONF + IMUL T,[-200] ;CALCULATE WHEN OVF HAPPENS + ADDI T,2000 + JRST TVCO7 + +TVCINI: CONO PI,OMXOFF + SETZM NVDCNT + MOVE T,NVDIPT + MOVEM T,NVDVPT + MOVEM T,NVDOPT + MOVE T,NVDBKR + CAIN T,1 + SETOM NVDBKR + JRST OMXONJ + +VIDFLS: SKIPL NVDUSE ;SKIP IF OPENS ON NVD, .VSCAN + POPJ P, + DATAO DSDEV,[DSNVID] ;DEASSIGN VIDI + SETOM NVDUSR + POPJ P, + +NVDGET: CONO NVDX,@TVCONO ;TRY TO ASSIGN BAT + CONI NVDX,TT + JUMPE TT,CPOPJ + JRST POPJ1 + + +NVDBRK: MOVE T,NVDBKR + JRST NVTAB(T) ;DISPATCH ON REASON FOR BREAK + + JRST NEWORK ;STARTUP OF SOME NEW FUNCTION +NVTAB: JRST SCNB1 ;NEW VSCAN POINT + JRST TVB1 ;NEW TVC POINT + JRST INVD1 ;NEW NVD PNT +; JRST DRET ;NEW DAEMON POINT + +TVB1: DATAI NVDX,@NVDVPT ;READ IN OF TV POINT + CONI NVDX,T + LSH T,-11. + DPB T,[220200,,@NVDVPT] ;READ ALL RELAVENT INFO FROM BAT + TRNE T,3 + JRST TVB2 ;DCO OR OVFL + MOVE T,@NVDVPT + ANDI T,1777 + CAMLE T,NVDDK + JRST TVB2 ;DUE TO NOISE/PROB DARKER THAN DCO +TVB3: AOS T,NVDVPT + CAIL T,NVDBUF+NVDLNG + MOVEI T,NVDBUF + MOVEM T,NVDVPT ;INCREMENT TO NEXT POINT + JRST NEWORK + +TVB2: MOVE T,NVDDK + DPB T,[1200,,@NVDVPT] + DPB T,[240600,,@NVDVPT] ;PUT IN FLOATING PART + LSH T,-6 + DPB T,[330400,,@NVDVPT] + JRST TVB3 + +TVNEXT: MOVE T,NVDVPT + CAMN T,NVDIPT + JRST TVCFIN + MOVEI T,1 ;SET UP FOR NEXT TV POINT + MOVEM T,NVDBKR + MOVE T,NVDVPT + HLRZ T,@NVDVPT + CONO NVDX,@TVCONO + DATAO NVDX,T + EXCH T,VIDXOL + SUB T,VIDXOL + MOVMM T,VIDTEM + HRRZ T,@NVDVPT + DATAO NVDY,T + EXCH T,VIDYOL + SUB T,VIDYOL + MOVMS T + CAMGE T,VIDTEM + MOVE T,VIDTEM + CAIL T,1000 + JRST TVB5 + DATAO NVDT,[-4] +NVDBR4: JRST OMXRET + +TVB5: TLC T,232000 ;CALCULATE SETTLING TIME + FAD T,T + LDB T,[330400,,T] + DATAO NVDT,SETLL-10.(T) + JRST NVDBR4 + +SETLL: ;SETTLING TIME IN 10 MICROSEC + -6 ;DEFLECTING 512 - 1023 + -10 ;1024 - 2047 + -16 ;2048 - 4095 + -26 ;4096 - 8191 + -45 ;8192 - 16383 + -70 ;16384 + +RNVDOB: JSP Q,WRDBT +RNVDOU: MOVEI T,NVDLNG-1 ;TO PREVENT HANGUP AT PI ON WRAPAROUND + CAMG T,NVDCNT + JRST RNVDO2 + UMOVE B,(C) + MOVEM B,@NVDIPT + AOS NVDCNT + AOS T,NVDIPT + CAIL T,NVDBUF+NVDLNG + MOVEI T,NVDBUF + MOVEM T,NVDIPT + CONO PI,OMXOFF + SETOM TVFLG +NVDVS1: MOVE T,TVCONO + SKIPGE NVDBKR + CONO NVDX,2000(T) + JRST OMXONJ + +RNVDO2: POP P,T ;CALLED FROM RNVDI ALSO + ANDI T,-1 + CAIE T,WRDBRT + JRST IOCER9 + POPJ P, + +NEWORK:; SKIPGE DAEMFL +; JRST DNEXT + SKIPL SCNUSR ;DEFLECT FOR NEW VSCAN POINT + JRST SCNB2 + SKIPGE NVDIFL ;NVD + JRST INVD2 + SKIPGE TVFLG ;DEFLECT FOR NEW TVC POINT + JRST TVNEXT + SETOM NVDBKR ;NO MORE CROCKS FOR VIDISECTOR TO DO + MOVE T,TVCONO + TRZ T,703000 ;SAVE STATE OF VIDI SELECT + CONI NVDX,A + CONO NVDX,(T) + SKIPN A + DATAO DSDEV,[DSNVID] ;RE DEASSIGN VIDI IF WAS DEASSIGNED + ;(CONO DID CLEAR PIA, DONE, AND SET MODE FLOPS THO) + JRST OMXRET + +TVCFIN: SETZM TVFLG + JRST NEWORK + +INVD1: DATAI NVDX,NVDCOR + CONI NVDX,T + LSH T,-11. + DPB T,[220200,,NVDCOR] + SETZM NVDIFL + JRST NEWORK + +INVD2: MOVEI T,2 + MOVEM T,NVDBKR + CONO NVDX,@TVCONO + HLRZ T,NVDCOR + DATAO NVDX,T + HRRZ T,NVDCOR + DATAO NVDY,T + DATAO NVDT,[-7] + JRST NVDBR4 + +SUBTTL NEW VIDISECTOR ROUTINES - .VSTST + +AVSTST: UMOVE A,(J) + CAME U,NVDUSR + JRST AVST4 + JUMPE A,AVST1 ;READ CURRENT STATE + JUMPL A,AVST2 +AVST3: SKIPL SCNUSR ;HANGUP TILL VSCAN FINISHED + PUSHJ P,UFLS +AVST2: +SCNSTP: CONO PI,OMXOFF ;FLUSH VSCAN ENTIRELY + SKIPGE SCNUSR + JRST OMXONJ ;ALREADY FINISHED + SETOM SCNUSR + SOSGE NVDUSE + SETOM NVDUSR + SKIPN NVDBKR ;IGNORE VSCAN POINT IN PROGRESS IF ANY + SETOM NVDBKR +VSLS2: PUSH P,A + PUSH P,B + PUSH P,W + MOVSI B,-1 + MOVSI W,-2 +SCNS2: LDB A,VEXT(W) + TRNN A,600000 + JRST SCNS4 + ANDI A,PMRCM + ADDM B,MMSWP(A) +SCNS4: MOVEI A,0 + DPB A,VEXT(W) + AOBJN W,SCNS2 + MOVE A,USER + SPM UPGML(A) + LPMR UPGML(A) + POP P,W + POP P,B + POP P,A + PUSHJ P,VIDFLS + JRST OMXONJ + +AVST4: JUMPE A,ILUUO + POPJ P, + +AVST1: SKIPGE SCNUSR + POPJ P, + MOVE A,NVDPTR + SUBI A,400000+VSB1*2000 + JRST APTUAJ + +;CHECK TO SEE IF MEM PROTECT STILL OK +SCNACR: CAMN U,SCNUSR + POPJ P, + AOS (P) + JRST SCNSTP + +;STOP SCAN +SCNSTC: CONO NVDX,0 + POPJ P, + +;RESTART SCAN AFTER STOP FOR SHUFFLING +SCNRST: CONO NVDX,NVDCHN_17 + POPJ P, + + +SUBTTL NEW VIDISECTOR ROUTINES - .VSCAN + +AVSCAN: XCTR XRW,[MOVES (C)] + XCTR XRW,[MOVES 12(C)] + SKIPL SCNUSR + PUSHJ P,UFLS + CONO PI,CLKOFF + CAME U,NVDUSR + SKIPGE NVDUSE + AOSA NVDUSE + JRST ILUUO + MOVEM U,NVDUSR + CONO PI,CLKON + PUSHJ P,NVDGET + JRST VSLOS +A.VS1: SETZM BATMXA + XCTR XRW,[HLRZ A,2(C)] + MOVEM A,NVDCNX + MOVEM A,NVDCN3 + XCTR XRW,[HRRZ A,2(C)] + MOVEM A,NVDCNY +IRPS XY,,X Y P X Y P,A12,,1 1 1 2 2 2,N,,3 6 11 4 7 12,YX,,X X X Y Y Y + UMOVE A,N(C) + IDIV A,NVDCN!YX + MOVEM A,BATD!XY!A12 +TERMIN +IRP XY,,[P,X,Y]ADR,,[[[1,,]],5(C),10(C)] + MOVE A,BATD!XY!1 + ADD A,BATD!XY!2 + ASH A,-1 +IFE .IRPCNT, ADD A,ADR +IFN .IRPCNT, XCTR XRW,[ADD A,ADR] + MOVEM A,BAT!XY!1 + MOVEM A,BAT!XY!2 + IFN .IRPCN,[IDIV A,BATP1 + MOVEM A,NVID!XY] +TERMIN + XCTR XRW,[HRRZ B,1(C)] + LDB A,[121000,,B] + CAIL A,376 + JRST VSLOS + MOVEI W,0 + PUSHJ P,VSMS1 + MOVEI W,1 + PUSHJ P,VSMS1 + SPM UPGML(U) + LPMR UPGML(U) + HRRZ R,B + ANDI R,776000 + ADDI R,4000-2000 + XCTR XRW,[HLRO D,1(C)] + MOVE A,NVDCNX + IMUL A,NVDCNY + JUMPLE A,VSLOS ;SIZE OF RASTOR + MOVNS D ;PLUS COUNT + CAMLE A,D + JRST VSLOS ;WON'T FIT + CAML A,R + JRST VSLOS ;WON'T FIT IN EXEC PGS + ADD A,B + MOVEM A,BATMXA + LDB A,[121000,,A] + PUSHJ P,UPLC + LDB A,T + TRC A,600000 + TRCE A,600000 ;SKIP ON R/W/F + JRST VSLOS ;TOP PAGE LOSES + ANDI B,1777 + ADDI B,400000+VSB1*2000 + MOVEM B,NVDPTR + XCTR XRW,[HRRZ A,(C)] + PUSHJ P,TVCN1 + MOVE A,[JRST SCNG1] + MOVEM A,SCNB1A + CONO PI,OMXOFF + MOVEM U,SCNUSR + MOVE A,TVCONO + SKIPGE NVDBKR + CONO NVDX,2000(A) + CONO PI,OMXON + XCTR XRW,[SKIPL (C)] + POPJ P, + JRST AVST3 + +VSLS3: PUSHJ P,LSWPOP +VSLOS: PUSHJ P,VSLS1 + JRST ILUUO + + +VPGLOS: PUSHJ P,VSLS1 + PUSHJ P,TPFLT + JRST UUOTRO + +VSLS1: SOSGE NVDUSE + SETOM NVDUSR + CONO PI,OMXOFF + JRST VSLS2 + +VSMS1: PUSHJ P,SWTL + CIRPSW + LDB A,[121000,,B] + ADD A,W + MOVEM A,VSMPG + PUSHJ P,UPLC + CONO PI,CLKOFF + LDB A,Q + JUMPE A,VSMS2 ;NO ACCESS + CAIN A,-1 + JRST VSLS3 + LDB A,T + TRNN A,600000 + JRST VSMS3 ;SWAPPED OUT + TRNN A,400000 + JRST VSLS3 ;RD ONLY + TRO A,200000 +VSMS2: DPB A,T ;CHANGE R/W/F TO R/W + LDB TT,VEXT(W) + DPB A,VEXT(W) + MOVSI Q,1 + ANDI A,PMRCM + SKIPE A + ADDM Q,MMSWP(A) + JUMPE TT,VSLS4 + ANDI TT,PMRCM + MOVSI Q,-1 + ADDM Q,MMSWP(TT) +VSLS4: PUSHJ P,LSWPOP + JRST CLKONJ + +VSMS3: PUSHJ P,LSWPOP + MOVE A,VSMPG + SOSGE NVDUSE + SETOM NVDUSR + PUSHJ P,CWAIT + SKIPL VIDSWI + MOVEM U,VIDSWI + MOVEM A,VIDSPG + SKIPL VIDSWI + PUSHJ P,UFLS + SUB P,[1,,1] + JRST AVSCAN + SCNB1: DATAI NVDX,@NVDPTR + CONI NVDX,T + LSH T,-11. + DPB T,[220200,,@NVDPTR] + TRNE T,3 + JRST SCNB1C ;OVF OR DCO? + MOVE T,@NVDPTR + ANDI T,1777 + CAMG T,NVDDK ;OR VALUE GREATER THAN DCO LEVEL + JRST NEWORK +SCNB1C: MOVE T,NVDDK + DPB T,[1200,,@NVDPTR] + DPB T,[240600,,@NVDPTR] ;PUT IN FLOATING PART + LSH T,-6 + DPB T,[330400,,@NVDPTR] + JRST NEWORK + +SCNB2: CONO NVDX,@TVCONO ;SETUP FOR NEXT VSCAN POINT + DATAO NVDX,NVIDX + DATAO NVDY,NVIDY + MOVE T,NVIDX + EXCH T,VIDXOL + SUB T,VIDXOL + MOVMM T,VIDTEM + MOVE T,NVIDY + EXCH T,VIDYOL + SUB T,VIDYOL + MOVMS T + CAMGE T,VIDTEM + MOVE T,VIDTEM + CAIL T,1000 + JRST SCNT5 + DATAO NVDT,[-4] +SCNT4: CLEARM NVDBKR + EBLK +SCNB1A: JRST SCNG1 ;OR AOS (AOSA) NVDPTR + BBLK + JRST SCNS1 ;HOMO LINEAR FROB +SCNB1B: SOSG NVDCNX ;SIMPLE MINDED + JRST SCNB3 +IRPC X,,XY + MOVE T,BATD!X!1 + ADDB T,BAT!X!1 + HLRZM T,NVID!X +TERMIN +SCNBX: JRST OMXRET + +SCNT5: TLC T,232000 ;CALCULATE SETTLING TIME + FAD T,T + LDB T,[330400,,T] + DATAO NVDT,SETLL-10.(T) + JRST SCNT4 + +SCNB3: SOSG NVDCNY + JRST SCNB4 +IRPC X,,XY + MOVE T,BATD!X!2 + ADDB T,BAT!X!2 + MOVEM T,BAT!X!1 + HLRZM T,NVID!X +TERMIN + + MOVE T,NVDCN3 + MOVEM T,NVDCNX + JRST SCNBX + +SCNB4: SKIPL NVDCNY ;WAIT FOR LAST DATAO TO RETURN A POINT + JRST SCNBX + SETOM SCNUSR + SOSL NVDUSE + JRST NEWORK + SETOM NVDUSR + DATAO DSDEV,[DSNVID] ;DEASSIGN BAT + MOVSI B,-1 + MOVSI W,-2 +SCNB4B: LDB A,VEXT(W) + TRNN A,600000 + JRST SCNB4A + ANDI A,PMRCM + ADDM B,MMSWP(A) +SCNB4A: MOVEI A,0 + DPB A,VEXT(W) + AOBJN W,SCNB4B + JRST NEWORK + +SCNS1: MOVEM U,NVDTMU + SOSG NVDCNX + JRST SCNS3 +IRPC X,,PXY + MOVE T,BATD!X!1 + ADDB T,BAT!X!1 + IFN .IRPCN,[IDIV T,BATP1 + MOVEM T,NVID!X] +TERMIN + +SCNBX1: MOVE U,NVDTMU + JRST SCNBX + +SCNS3: SOSG NVDCNY + JRST SCNB4 +IRPC X,,PXY + MOVE T,BATD!X!2 + ADDB T,BAT!X!2 + MOVEM T,BAT!X!1 + IFN .IRPCN,[IDIV T,BATP1 + MOVEM T,NVID!X] +TERMIN + MOVE T,NVDCN3 + MOVEM T,NVDCNX + JRST SCNBX1 + +SCNG1: MOVSI T,(AOSA) + SKIPN BATDP1 + SKIPE BATDP2 + MOVSI T,(AOS) + HRRI T,NVDPTR + MOVEM T,SCNB1A + TLNN T,(AOSA-AOS) + JRST SCNS1 + JRST SCNB1B + + +SUBTTL NEW VIDISECTOR ROUTINES + +EBLK + +NVDIPT: NVDBUF ;POINTER TO INSERT IN BUF +NVDVPT: NVDBUF ;POINTER TO WORD BEING VIDISECTED +NVDOPT: NVDBUF ;POINTER TO WITHDRAW FROM BUF +NVDCNT: 0 ;NUMBER PTS IN BUF +NVDBUF: BLOCK NVDLNG +VIDSTRT: 0 +LBTCNO: 0 ;LAST CONO TO BAT +NVDIFL: 0 ;+=> RQ TO READ NVD PNT +NVDCOR: 0 ;NVD DEV, COORDINATES TO PI, READ DATA FROM PI +NTVCOS: -1 ;# TVC OPENS + +IRPC X,,XYP + IRPC N,,12 + BAT!X!!N: 0 + BATD!X!!N: 0 + TERMIN +TERMIN + +NVDCNX: 0 +NVDCNY: 0 +NVDCN3: 0 +NVIDX: 0 +NVIDY: 0 +BATMXA: 0 +NVDPTR: 0 +NVDTMU: 0 +SCNUSR: -1 ;USER IN CURRENT .VSCAN, -1 .VSCAN FREE +SCNREL: 0 +TVCONO: 0 ;CONO FOR TVC DEVICE AND VSCAN (NORM HAS CHNL BUT NOT IF IN VIDDLY) +NVDDK: 0 ;-1=>VID VALUE CORRESP TO DCO +TVFLG: 0 ;-1=>TVC WORK IN PROGRESS +NVDBKR: -1 ;REASON LAST POINT READ IN, DISPATCH ADDRESS FOR INTS + ;-1 NONE 0 VSCAN 1 TVC 2 NVD +TVQBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST VIDD1 +VIDXOL: 0 ;OLD VIDI CORDS +VIDYOL: 0 ;OLD VIDI CORDS +VIDTEM: 0 ;LARGEST DELTA +VSMPG: 0 +VEXT: .VSB1+EXEUMP + .VSB2+EXEUMP + +BBLK + +VIDD1: MOVEI A,NVDCHN_15. + IORB A,TVCONO ;RESTORE CHNLS TO TVCONO + CONO NVDX,2000(A) ;CAUSE EVENTUAL VIDI INT TO SEE IF ANYTHING YO DO + JRST CLQRET ;RETURN TO CLOCK ROUTINE +] + +SUBTTL VIDEO SWITCH AND VIDEO BUFFER ROUTINES + +;SYSTEM CALLS FOR HACKING THE VIDEO SWITCH AND VIDEO BUFFERS. + +IFE N11TYS,[ +NVDBF==OPNL1 +NVIDSW==OPNL1 +] + +IFN N11TYS,[ + +VBDFLS: PUSH P,B + PUSH P,T + PUSH P,I + PUSH P,Q + PUSH P,C + MOVSI B,-MXVBN ;FLUSH ALL BUFFERS ASSIGNED TO JOB IN U +VBDFL3: CAMN U,VBAST(B) + JRST VBDFL1 +VBDFL2: AOBJN B,VBDFL3 + SKIPE NVDBA(U) + JRST 4,. +VBDFL6: POP P,C + POP P,Q + POP P,I + POP P,T + POP P,B + POPJ P, + +VBDFL1: JSP Q,11CM1 + JRST VBDFL4 ;LOST.. + PUSH P,B + JSP Q,NVDBU2 ;FLUSH BUFFER + JFCL ;PDP11 TIMED OUT + JFCL ;PDP11 GAVE NEGATIVE REPLY + POP P,B + JRST VBDFL2 + +VBDFL5: CAMN U,VBAST(B) +VBDFL4: SETOM VBAST(B) + AOBJN B,VBDFL5 + CLEARM NVDBA(U) + JRST VBDFL6 + +;VIDBUF SYSTEM CALL - ASSIGN OR DEASSIGN VIDEO BUFFERS +NVDBF: JSP Q,11CM1 ;SET UP ACS, LOCK SWITCH. + JRST OPNL7 ;LOST + JUMPGE A,NVDBU1 ;JUMP IF DEASSIGN COMMAND + MOVSI C,2_<16.+4-18.> + JSP Q,NVDCMD ;TELL PDP11 TO ASSIGN BUFFER. + JRST OPNL7 ;PDP11 TIMED OUT + JRST OPNL6 ;PDP11 GAVE NEGATIVE REPLY + HRRZ A,C + CAIL A,MXVBN + JRST OPNL6 ;PDP11 HAS MORE VIDEO BUFFERS THAN WE DO + AOS NVDBA(U) ;WON + MOVEM U,VBAST(A) + JRST POPJ1 + +NVDBU1: MOVE B,A ;DEASSIGN VIDEO BUFFER + CAIGE B,MXVBN ;CHECK THAT VIDEO BUFFER IS LEGAL + CAME U,VBAST(B) ;AND BELONGS TO THIS JOB + JRST OPNL33 ;NOT LEGAL VIDEO BUFFER NO + JSP Q,NVDBU2 ;TELL PDP11 TO FREE THE BUFFER. + JRST OPNL7 ;TIMED OUT + JRST OPNL23 ;GAVE NEG REPLY + JRST POPJ1 ;WON + +EBLK +;TABLE OF VIDEO BUFFER ASSIGNMENTS. +VBAST: REPEAT MXVBN,-1 ;-1 => FREE, ELSE USR IDX. +11CVSR: -1 ? 0 ;SWITCH TO LOCK TO PROTECT 10-TO-11 COMMAND VARS. +BBLK + +;VIDSW SYSTEM CALL - SET VIDEO SWITCH. +NVIDSW: JSP Q,11CM1 ;LOCK SWITCH, ETC. + JRST OPNL7 + LSH A,4.+16. + LSH B,4.+16. + MOVEM A,1(I) + MOVEM B,2(I) + MOVSI C,1_<16.+4-18.> + JSP Q,NVDCMD + JRST OPNL7 ;TIMED OUT + JRST OPNL23 ;PDP11 DIDN'T FEEL LIKE SWITCHING THE SWITCH + JRST POPJ1 + +NVDBU2: SETOM VBAST(B) ;GIVE DEASSIGN COMMAND TO 11 + LSH B,4.+16. + MOVEM B,1(I) ;WHICH ONE TO DEASSIGN + SOSGE NVDBA(U) + JRST 4,. + MOVSI C,3_<16.+4-18.> +;GIVE COMMAND IN C TO PDP11, WAIT, RETURN (Q) IF 11 TIMES OUT, +;1(Q) IF 11 GIVES NEGATIVE REPLY AND 2(Q) IF SUCESSFUL +;IN ANY CASE, SWITCH IS UNLOCKED +;ASSUMES ARGS ALREADY SET UP, AND 11CVSR LOCKED. +NVDCMD: MOVEM C,(I) ;STORE COMMAND-TYPE, TELLING PDP11 TO GO. +NVDCM1: CAME C,(I) + JRST NVDCM2 ;IT'S FINISHED, WE WIN. + SOJG T,NVDCM1 ;LOOP FOR A WHILE, + PUSHJ P,LSWPOP + JRST (Q) ;FAIL - 11 TIMED OUT + +NVDCM2: MOVE C,1(I) ;RETURNED ARG IN CASE OF ASSIGN VIDEO BUFFER + LSH C,-4.-16. + SKIPGE (I) ;PDP11 FINISHED: DID COMMAND SUCCEED? + AOS Q ;YES SKIP EXTRA TIME + SETZM (I) + PUSHJ P,LSWPOP + JRST 1(Q) + +;LOCK SWITCH AND SET UP.. RETURN TO (Q) IF FAILS (SWITCH NOT LOCKED IN THAT CASE) +;RETURN TO 1(Q) IF SUCEEDS + +11CM1: SKIPL TT11P + JRST (Q) + PUSHJ P,SWTL + 11CVSR + LDB T,[061600,,TT11HA] + LDB I,[061600,,400000+TTPG0*2000(T)] + ADDI I,400000+TTPG0*2000 ;I HAS 10-TO-11 COMMAND BFR ADDR. + MOVSI T,1 ;# TIMES TO LOOP WAITING FOR 11 TO ACKNOWLEDGE +11CM2: SKIPG (I) + JRST 1(Q) ;11 READY FOR COMMAND. + SOJG T,11CM2 + PUSHJ P,LSWPOP + JRST (Q) ;TIMED OUT +] + +SUBTTL TABLET AND ROBOT CONSOLE + +IFN TABP,[ + +ITAB: IFE TABCLK,[ + SOSLE TABRTC + JRST ITAB6 + SKIPGE TABUSR + JRST ITAB7 + MOVE A,TABRTE + MOVEM A,TABRTC + CONO RBTCON,RTABC_3+TABCHN +] IFN TABCLK, CONO RBTCON,RTABC_3 + ROT A,36.*2 + DATAI RBTCON,A + JUMPL A,ITAB ;TRY AGAIN + LDB B,[400300,,A] + CAME B,TABLSZ + JRST ITAB2 + CAIN B,7 + JRST ITAB3 ;PEN OUT OF CONTACT + LDB B,[221400,,A] ;X + SUB B,TABLSX + MOVMS B + CAML B,TABDTA + JRST ITAB2 + LDB B,[1400,,A] + SUB B,TABLSY + MOVMS B + CAML B,TABDTA + JRST ITAB2 +ITAB3: AOS B,TABSMC + CAIL B,77 + JRST ITAB2 +ITAB5: IFN TABCLK,[ + MOVE T,TABRTE + MOVEI C,TABQBK + SKIPL TABUSR + JRST CLQREE + JRST CLQRET +] IFE TABCLK,[ + JRST OMXRET + +ITAB6: DATAI RBTCON,A ;FLUSH DATA + JRST OMXRET + +ITAB7: CONO RBTCON,0 + JRST OMXRET +] +ITAB2: MOVE B,TABSMC + DPB B,[140600,,TABLST] + SETZM TABSMC + HRRZM A,TABLSY + LDB B,[221400,,A] + MOVEM B,TABLSX + LDB B,[400300,,A] + MOVEM B,TABLSZ + EXCH A,TABLST + JUMPE A,ITAB5 ;JUST STARTING UP + MOVE B,TABCC + CAIL B,LTABBF + JRST ITAB4 ;FULL + MOVEM A,@TABIP + AOS TABCC + AOS B,TABIP + CAIL B,TABBFE + MOVEI B,TABBUF + MOVEM B,TABIP + JRST ITAB5 + +ITAB4: MOVSI B,(SETZ) ;SET DATA LOST + IORM B,TABLST + JRST ITAB5 + +] + +IFN RBTCP,[ + + ;ROBOT CONSOLE READ SWITCHES +ARBTC: UMOVE A,(J) + CONO PI,TABOFF + CONO RBTCON,RLTSWC_3+IFE TABCLK,TABCHN + ROT A,36.*2 + DATAO RBTCON,A + ROT A,36.*2 + DATAI RBTCON,A + CONO PI,TABON + UMOVEM A,(J) + POPJ P, + +;DATA FORM +;4.9 DATA LOST BEFORE THIS +;4.8-4.6 TAB "Z" +;4.5-4.4 USUSED +;4.3-3.1 TABLET X +;2.9-2.4 REPEAT COUNT +;2.4-1.1 TABLET Y + +TABO: PUSH P,[TABO1] + JSP Q,STDOPN + 1,,TABUSR + DTABUI,,DTABBI + +TABO1: POPJ P, ;OPEN LOST + SKIPE TABUSE ;OPEN WON + JRST POPJ1 ;NOT FIRST OPEN + LDB T,[250300,,C] + AOS T + MOVEM T,TABRTE ;TABLET RATE (IGNORE THIS MANY BETWEEN TAKES) + LDB T,[300600,,C] + MOVEM T,TABDTA ;DELTA FOR COORD TO BE DIFFERENT + PUSHJ P,TABCLR +IFE TABCLK, CONO RBTCON,RTABC_3+TABCHN +IFN TABCLK,[ PUSHJ P,CLQAD1 ;START UP CLOCK LEVEL + TABQBK +] JRST POPJ1 + +BTABI: UMOVE J,(C) ;INITIAL AOBJN PNT + JSP Q,WRDBT +UTABI: SKIPG TABCC ;TABLET .IOT + JRST TABI1 ;NO DATA AVAIL, SEE IF BEING ACCUMULATED +UTABI1: MOVE A,@TABOP + UMOVEM A,(C) + AOS T,TABOP + CAIL T,TABBFE + MOVEI T,TABBUF + MOVEM T,TABOP + SOS TABCC + POPJ P, + +TABI1: HRRZ T,(P) + CAIN T,WRDBRT + JRST TABI2 +TABI3: SKIPG TABCC + PUSHJ P,UFLS + JRST UTABI1 + +TABI2: XCTR XRW,[CAMN J,(H)] + JRST TABI3 ;NO WDS TRANSFERRED + SUB P,[1,,1] ;RETURN TO USER SOME HAVE BEEN TRANSFERRED + POPJ P, + +TABCLR: CONO PI,TABOFF + SETZM TABCC + MOVEI T,TABBUF + MOVEM T,TABIP + MOVEM T,TABOP + SETZM TABSMC + SETZM TABLST + CLEARM TABLSX + CLEARM TABLSY + CLEARM TABLSZ +IFE TABCLK, SETZM TABRTC + CONO PI,TABON + POPJ P, +EBLK + +TABBUF: BLOCK LTABBF +TABBFE: +TABOP: TABBUF ;OUTPUT PNTR (MP) +TABIP: TABBUF ;INPUT PNTR (PI) +TABCC: 0 ;ACTIVE WDS IN TAB BUFFER +TABSMC: 0 ;COUNT OF TIMES "SAME" DATA RECEIVED FOR TAB +TABLST: 0 ;LAST DATA +TABLSZ: 0 ;Z OF LAST DATA +TABLSX: 0 ;X +TABLSY: 0 ;Y +TABDTA: 0 ;DELTA FOR COORD TO BE DIFFERENT +TABRTE: 0 ;TABLET RATE (TAKE EVERY N'TH ONE) +IFN TABCLK,[TABQBK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST ITAB +] +IFE TABCLK,[ +TABRTC: 0 ;COUNT WITHIN TABRTE +] + BBLK +] + IFN IMXP,[ + +SUBTTL INPUT MULTIPLEXOR ROUTINES + +IMPXO: CONI MPX,T + JUMPE T,OPNL25 + TRNN D,2 + JRST IMPXO2 ;READ AT MN PRGM + SKIPGE IMPXF ;IMAGE (READ AT PI) + SETOM MPXWF + PUSHJ P,IMXON +IMPXO2: AOS IMXNTO + HLL A,C + JSP Q,OPSLD3 + IMXDN,,BIMXDN + IMPXDN,,BIMPXD + +IMXON: AOSGE IMPXF + JRST 4,. ;SHOULD NOT HAVE BEEN LESS THAN -1 + PUSHJ P,CLQAD1 ;START CLOCK LEVEL + MPXBLK + POPJ P, + +BIMPXS: JSP Q,WRDBT +IMPXS: SKIPGE MPXWF + PUSHJ P,UFLS + UMOVE A,(C) + ANDI A,377 + CAILE A,LCHN + JRST IMPXS1 +AIMXW5: IDIVI A,3 + LDB A,IMPXT(B) + UMOVEM A,(C) + POPJ P, + +IMPXCL: TRNE A,4 ;SKIP ON WAS READING AT MP +IMXCL1: SOS IMPXF ;WAS READING AT PI + SOSGE IMXNTO + DATAO DSDEVN,[MPX] + POPJ P, + +IMPXRS: SETOM MPXWF + POPJ P, + +IMPXT: 301400,,MPXBUF(A) + 141400,,MPXBUF(A) + 1400,,MPXBUF(A) + +BIMXS1: JSP Q,WRDBT +IMPXS1: UMOVE A,(C) + TDZE A,[-400] + JRST IOCER4 +AIMXW4: MOVE T,MPXWF + CAILE A,LCHN + MOVNI T,2 ;CHNL NOT READ IN BY PI HACK +AIMXW2: SKIPL IMXSW + PUSHJ P,UFLS + CAME T,MPXWF + AOJGE T,AIMXW3 ;PI FROB HAS CYCLED (MAYBE) + AOSE IMXSW + JRST AIMXW2 ;READING IMX AT PI + DATAO MPX,A ;SELECT CHNL + CONO MPX,0 ;START CONVERSION + MOVEI B,62 + CONSO MPX,10 + SOJG B,.-1 + JUMPE B,IMPXFE + XCTR XRW,[DATAI MPX,(C)] +IMX1: SETOM IMXSW + POPJ P, + +AIMXW3: SKIPGE MPXWF + JRST AIMXW4 ;IT WAS JUST SETOMMED + JRST AIMXW5 ;HAS BEEN READ IN BY PI HACK SO GOBBLE DATA + +IMPXFE: XCTR XRW,[SETOM (C)] + JRST IMX1 + +IMPXSR: AOSE IMXSW + JRST MPXRT1 ;USING IMX AT MN PRGM LVL + MOVE T,[<-LCHN>/3-1,,MPXBUF-1] + MOVEM T,MPXPTR ;SET UP BLKI POINTER + MOVE T,[BLKI MPX,MPXPTR] + MOVEM T,IMXLC ;SET UP DC INTERUPT LOCN + MOVE T,[JSR MPXCYC] + MOVEM T,IMXLC+1 ;SET UP DC INT LOC+1 + DATAO MPX,[0] ;READ STARTING WITH CHNL 0 + CONO MPX,140+DCCHN + MOVEI T,5 ;12TH SEC +IFN ARMP,SKIPN ARMF + SKIPL POTCON + MOVEI T,2 ;1/30 SEC, HAIRY POTS + JRST .+2 +MPXRT1: MOVEI T,1 ;LOST RETRY IN 1/60 + MOVEI C,MPXBLK + SKIPL IMPXF + JRST CLQREE ;RE-ENTER RQ + JRST CLQRET ;RETURN + +EBLK + +OMXNTO: -1 +IMXNTO: -1 +IMPXF: -1 ;-1 IF MPX NOT RUNNING +MPXWF: 0 +MPXBLK: 0 ;CLOCK QUEUE BLOCK + -1 + JRST IMPXSR +MPXPTR: 0 +IMXST: 0 +IMXSW: -1 ;-1 IF IMX AVAIL +IMXTBB: LCHN +MPXBUF: BLOCK /3+1 +IMXTBE==.-1 + +IMXACS: BLOCK 20 +MPXCYC: 0 + +BBLK + + CONO MPX,0 + SETOM IMXSW + AOS MPXWF + MOVEM T,IMXST + MOVE T,[JSR MPXCYC] + MOVEM T,IMXLC + MOVE T,IMXST +; SKIPGE POTCON +; SKIPE ARMF +; JRST MPXCYG + JRST 12,@MPXCYC + +MPXCYG: MOVEM 17,IMXACS+17 + MOVEI 17,IMXACS + BLT 17,IMXACS+16 +IFN ARMP,[ + SKIPE ARMF + JRST SERVO +ARMSVR:] + SKIPL POTCON + JRST UPOTS +UPOTRT: MOVSI 17,IMXACS + BLT 17,17 + JRST 12,@MPXCYC +] + IFN OMXP,[ + +SUBTTL OUTPUT MULTIPLEXOR ROUTINES + +OMPXO: CONI OMPX,T + JUMPE T,OPNL25 + AOS OMXNTO + HLL A,C + JSP Q,OPSLD3 + OMPXDN,,BOMPXDN + OMXDN,,BOMXDN + +BOMXDS: +BOMPXS: JSP Q,WRDBT +OMXDS: +OMPXS: XCTR XRW,[DATAO OMPX,(C)] ;ZAP CHNL + POPJ P, + +OMPXCL: SOSGE OMXNTO + DATAO DSDEVN,[OMPX] + POPJ P, + +EBLK +OMXACS: BLOCK 20 + +OMPXBK: 0 +BBLK + MOVEM 17,OMXACS+17 + MOVEI 17,OMXACS + BLT 17,OMXACS+16 +IFN VIDP,[ + CONSZ NVDX,700000 + CONSO NVDX,1000 + JRST .+2 + JRST NVDBRK +] +IFN ARMP,[ + CONSZ TIPDEV,10 + JRST TIPBRK +] +IFN TABP,[ + CONSZ RBTCON,7 + CONSO RBTCON,10 + JRST .+2 + JRST ITAB +] +; MOVEI J,OMPCHN +; JSP E,SPUR ;SPURIOUS INT +OMXRET: MOVSI 17,OMXACS + BLT 17,17 + JRST 12,@OMPXBK +] + +SUBTTL MORSE CODE SENDER (COD DEVICE) + +IFN CODP,[ +; CODITC==CODBFL*5-1 ;WHEN TO TRY TO INTERRUPT + +CLKCOD: SETOM TT ;USED AS A FLAG + MOVE B,CODWD + LSH B,-1 +CLKCC3: CAIN B,1 + JRST CLKCC1 + LDB A,[100,,B] + EXCH A,LSTBIT + CAME A,LSTBIT + DATAO 70,LSTBIT + MOVEM B,CODWD + MOVE T,CODSPD + MOVEI C,CODTIM + JRST CLQTTR ;RE-ENTER OR NOT DEPENDING ON TT + +CLKCC1: MOVE A,CODCC + CAIL A,CODBFL*5 + JRST CLKCC5 +CLKCC8: AOS CODCC + ILDB B,CODPTR + MOVE A,CODPTR + CAMN A,[10700,,CODBUF+CODBFL-1] + HRRI A,CODBUF-1 + HRRM A,CODPTR + CAIL B,140 + JRST CLKCC2 + CAIGE B,40 + JRST CLKCC1 + MOVE B,CODTBL-40(B) + JRST CLKCC3 +CLKCC6: MOVE B,CDRUB + JRST CLKCC3 +CLKCC2: CAIN B,177 + JRST CLKCC6 + SUBI B,137 + MOVEM B,CODSPD + JRST CLKCC1 + +CLKCC5: +; CAIN A,CODITC +; JRST CLKCC7 + MOVEI B,2 + SETZM TT ;INDICATE IDLE + JRST CLKCC3 + +;CLKCC7: MOVE A,CODUSR ;GET INDEX OF USER +; MOVE B,CODITB ;GET CHANNELS OPEN MASK +; AND B,MSKST2(A) ;FIND OUT WHAT CODE CHANNELS ENABLED, +; MOVNM B,CODITD +; AND B,CODITD +; IORM B,IFPIR(A) ;AND REQUEST INTERRUPT ON LOWEST NUMBERED ONE +; JRST CLKCC8 ;SEND REMAINING CHARACTER(S) IN BUFFER + + ;RETURN HERE FROM STDOPN +CODO1: POPJ P, ;NON-SKIP RETURN + AOS (P) ;DO NOT CHANGE TO JRST POPJ1 AT END + MOVEI I,1 ;INDICATE "IOPOP" + + ;CODE DEVICE IOPUSH AND IOPOP ROUTINE (SETS INTERRUPT MASK) + +CODIOP: SUBI R,IOCHNM(U) ;GET "AC FIELD" (ROUTINES THAT NEED IT RESTORE R) + MOVE A,CHNBIT(R) ;SET UP INTERRUPT BIT + XCT CDPTBL(I) ;IORM OR ANDCAM TO CODITB + POPJ P, + +CDPTBL: ANDCAM A,CODITB ;IOPUSH AND CLOSE + IORM A,CODITB ;IOPOP AND OPEN + + ;COD CLOSE ROUTINE +CODCLS: MOVEI I,0 ;TO SIMULATE IOPUSH + PUSHJ P,CODIOP ;CLEAR RELEVANT INTERRUPT BIT + CONO PI,CLKOFF ;CLOSE, USE STANDARD SEQUENCE + SOSGE CODUSE + SETOM CODUSR + JRST CLKONJ + +SEND: SKIPGE C + SKIPA A,(C) + XCTR XRW,[MOVE A,(C)] ;UNIT OUTPUT + CAIA +BSEND: JSP E,NBTOCH ;BLOCK OUTPUT + ANDI A,177 + CAIN A,"S-100 + JRST CODSSS + SKIPE CODSSF + JRST CODSST + SKIPG CODCC ;WAIT FOR ROOM + PUSHJ P,UFLS + IDPB A,CODIPT + MOVE A,CODIPT + CAMN A,[10700,,CODBUF+CODBFL-1] + HRRI A,CODBUF-1 + HRRM A,CODIPT + SOS CODCC + MOVE T,CODSPD + PUSHJ P,CLQADD ;START UP CLOCK LEVEL + CODTIM + POPJ P, + +CODO: PUSH P,[CODO1] ;CODO1 SETS UP INTERRUPT BIT + JSP Q,STDOPN + 1,,CODUSR + CODDN,,CODBN + + +CODSSS: SETOM CODSSF + POPJ P, + +CODSST: SETZM CODSSF + SUBI A,137 + JUMPLE A,CPOPJ + MOVEM A,CODSPD + POPJ P, + +CODRS: CONO PI,CLKOFF + MOVEI A,CODBFL*5 + MOVEM A,CODCC + MOVE A,CODIPT + MOVEM A,CODPTR + JRST CLKONJ + +CODFIN: MOVE T,CODBFL*5 ;.CALL FINISH + CAMLE T,CODCC + PUSHJ P,UFLS + POPJ P, + +EBLK +CODITB: 0 ;MASK OF CHANNELS OPEN, 1.1=>0 +CODITD: 0 ;RANDOM SCRATCH LOCATION +CODWD: 2 ;CURRENT WORD +CODTIM: 0 ;CLOCK QUEUE BLOCK + -1 + JRST CLKCOD +CODSPD: 3 ;CODE SPEED (SET FROM CHARS >=140) WPM= 75./(CODSPD) +CODCC: CODBFL*5 +CODPTR: 440700,,CODBUF +CODIPT: 440700,,CODBUF +LSTBIT: 0 ;FLUSH 60 CPS CHIRPS +CODSSF: 0 + +CODBUF: BLOCK CODBFL +BBLK + +DEFINE GCODE A +BIT=1 +WRD=0 +IRPC B,,[A] +IFSE B,-,[WRD=WRD+7*BIT +BIT=BIT_4] +IFSE B,.,[WRD=WRD+BIT +BIT=BIT_2] +IFSE B, ,[BIT=BIT_2] +TERMIN +WRD+4*BIT +TERMIN + +CODTBL: 20 + GCODE -.-.- + GCODE .-..-. + GCODE -. .-. + REPEAT 2,1 + GCODE . ... + GCODE .----. + REPEAT 2,GCODE -.--.- + GCODE .-.- + GCODE . ... + GCODE --..-- + GCODE -....- + GCODE .-.-.- + GCODE -..-. + IRP A,,[-----,.----,..---,...--,....-,.....,-....,--...,---..,----.] + GCODE A + TERMIN + GCODE ---... + GCODE -.-.-. + 27727 ;K WITH LONG LAST DAH + GCODE -...- + GCODE ...-.- + GCODE ..--.. + GCODE ...-. + IRP A,,[.-,-...,-.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..,--,-.,---,.--.,--.- +.-.,...,-,..-,...-,.--,-..-,-.--,--..] + GCODE A + TERMIN + GCODE -.--. + GCODE -.-..-.. + GCODE .-.-. + GCODE .-... + GCODE -.. . + +CDRUB: GCODE ........ + +EXPUNGE WRD,BIT + +] + IFN PLTP,[ + +SUBTTL CALCOMP PLOTTER ROUTINES + +PLOT: SKIPGE C + SKIPA A,(C) + UMOVE A,(C) +PLOT1: SKIPE A + CAIN A,EOFCH + POPJ P, + SKIPG PLBFS + JRST PLOTW1 +PLOTW2: IDPB A,PLPTR + MOVE A,PLPTR + CAMN A,[600,,PLBUF+LPLBUF-1] + HRRI A,PLBUF-1 + HRRM A,PLPTR + SOS PLBFS + AOSN PLON + CONO PLT,SDS+PLTCHN + POPJ P, + + PUSHJ P,PLOTW3 +PLOTW1: PUSHJ P,UFLS + JRST PLOTW2 + +PLOTW3: SKIPG T,PLBFS + POPJ P, + CAIL T,LPLBUF*5 + JRST POPJ1 + JRST POPJ3 + +BPLOT: MOVEI E,PLOT1 + JRST NBTOCH + +PLOTO: MOVEI Q,PLOTOC + PUSHJ P,STDOPN + POPJ P, + AOS (P) +PLOTEL: ;TELL WHO'S USING THE PLOTTER + BUG INFO,[PLOTTER USER],SIXBIT,UNAME(U),SIXBIT,JNAME(U) + POPJ P, + +PLOTOC: 1,,PLTUSR + PLTDN,,PLTBN + +PLTRS: MOVEI A,LPLBUF*6 + MOVE B,PLPTR + CONO PI,LPTOFF + MOVEM A,PLBFS + MOVEM B,PLIPTR + JRST LPTONJ + +PLTBRK: MOVE A,PLBFS + CAIN A,LPLBUF*6 + JRST PLSTP + AOS PLBFS + ILDB A,PLIPTR + MOVE B,PLIPTR + CAMN B,[600,,PLBUF+LPLBUF-1] + HRRI B,PLBUF-1 + HRRM B,PLIPTR + ANDI A,77 + LSH A,3 + TRO A,SDC+PDC+SD+PLTCHN + TRNE A,PUP+PDN + TRC A,SD#PD + CONO PLT,(A) + JRST LPTRT3 + + +PLSTP: CONO PLT,SDC+PDC + SETOM PLON + JRST LPTRT3 + +EBLK +PLBUF: BLOCK LPLBUF +PLON: -1 +PLPTR: 440600,,PLBUF +PLIPTR: 440600,,PLBUF +PLBFS: LPLBUF*6 +IPL: SIXBIT /IPL/ ;FILE NAME 2 OF IPL JOB (USED FOR LOADING ASO JNAME OF IPL JOB) +IPLU: 0 ;USER INDEX OF IPL JOB IF IT EXISTS OR -1 IF IPL BEING LOADED + +;INTERPRET PLOTTER OPEN ROUTINE +BBLK +IPLO: CONO PI,CLKOFF + PUSHJ P,IPLST ;INITIATE LOADING OF IPL JOB + JRST IPLO1 + PUSHJ P,PLOTEL + CONO PI,CLKOFF + PUSHJ P,IPLWT ;WAIT FOR IPL JOB TO FINISH LOADING + PUSHJ P,UFLS + MOVE T,IPLU ;INDEX OF IPL JOB + SKIPE IOCHNM(T) + JRST IPLO2 ;IPL JOB OPNS CLA ON CNNL 0 + MOVE T,SV40(T) + CAME T,[.SLEEP 17,] ;IPL JOB DOES SLEEP 17, WHEN READY +IPLO2: JRST OPNL10 ;DEVICE NOT AVAILABLE + CONO PI,CLKON + MOVE T,IPLU + MOVE A,UNAME(T) ;SET UP CLI OPEN + MOVSI B,(SIXBIT /IPL/) + PUSHJ P,CLIO + POPJ P, + MOVE A,UTMPTR(U) + MOVE B,IPLU + MOVEM A,UTMPTR(B) + JRST POPJ1 + +IPLO1: PUSHJ P,UDELAY + JRST IPLO + +IPLST: SKIPL T,IPLU ;MAKE SURE IPL JOB NOT ALREADY BEING LOADED + PUSHJ P,IPLIN ;MAKE SURE IPL JOB NOT ALREADY IN + JRST POPJ1 ;DONT LOAD + HRROI T,IPL + CONO PI,UTCOFF + PUSHJ P,NUJBST + JRST UTCONJ + JRST UTCOJ1 + +;ROUTINE TO SEE IF IPL JOB WINS. CLKOFF OR CLKBRK IN PROGRESS +IPLWT: SKIPGE T,IPLU ;CHECK IPL JOB LOADING FLAG + POPJ P, ;IPL JOB STILL LOADING WAIT + PUSHJ P,IPLIN ;SEE IF IPL JOB IN CORE + SKIPE IOCHNM(T) ;SEE IF IPL JOB IN USE + JRST POPJ1 ;LOSE + MOVE T,SV40(T) ;SEE IF IPL JOB READY + CAMN T,[.SLEEP 17,] ;IPL JOB DOES .SLEEP 17, WHEN READY + AOS (P) ;READY WIN + POPJ P, ;NOT READY YET, WAIT + +IPLIN: PUSH P,U ;ROUTINE TO SEE IF IPL JOB IN. C(T)=C(IPLU), CLKOFF OR CLKBRK IN PROGRESS + CAML T,USRHI + JRST IPLIN1 ;USER VARIABLES SLOT FLUSHED + HLRO U,UNAME(T) + AOJN U,IPLIN1 ;UNAME OF IPL JOB IS -1 (IN LH) + MOVSI U,(SIXBIT /IPL/) + CAME U,JNAME(T) +IPLIN1: AOS -1(P) ;IPL JOB NOT IN, SO SKIP + POP P,U + POPJ P, + +] +;UTC MUST BE OFF! +NUJBST: MOVEI TT,MXCZS ;ENTRY FROM ELSEWHERE TO DO SIMILAR THINGS + SKIPL DEDTIM ;SKIP IF SYS DEAD + CAMG TT,UTTYCT + POPJ P, ;RING BUFFER FULL, WAIT + MOVEM T,@UTTYI + AOS UTTYCT + AOS TT,UTTYI + CAIL TT,UTTYS+MXCZS + MOVEI TT,UTTYS + MOVEM TT,UTTYI + SETOM 1(T) ;SET JOB LOADING FLAG + JRST POPJ1 + +SUBTTL PDP-6 AS INFERIOR + +IFN PDP6P,[ +;.IPDP CH, +;INTERRUPT THE PDP6, I/O CH SHOULD HAVE PDP6 OPEN AS INFERIOR +;THIS CALL DOESNT SKIP OR INTERRUPT TO THE USER + +AIPDP: MOVSI T,%CLS6 + SKIPGE A,(R) + TDNN T,CLSTB(A) + POPJ P, + CONO PI,LPTOFF + CONI DSDEV,T + ANDI T,7 + CONO DSDEV,20(T) + JRST LPTONJ + +;PDP-6 DEVICE +;INTERRUPT FROM PDP6, MAYBE GENERATE IO CHANNEL USER INTERRUPT + +DSDBRK: CONO DSDEV,10 ;TURN OFF FLAG + ;ALSO KEEP IT FROM INTERRUPTING FOR A WHILE + ;GETS TURNED ON AT DISMISS, SETOM PICLR AND SLOW CLK + SKIPGE A,PDPISR + JRST LPTRT3 ;NO ONE WANTS AN INT + MOVE B,PDPMSK + AND B,MSKST2(A) + MOVNM B,PDPTMP + AND B,PDPTMP + IORM B,IFPIR(A) ;GENERATE USER INT + JRST LPTRT3 + + ;PDP6 .OPEN ROUTINE (GET HERE FROM USR OPEN) + +PDPO: SKIPL PDP6UP ;MAKE IT EASY TO MARK PDP6 AS DOWN. + JRST OPNL10 + TLNN C,20 + JRST PDPO1 ;DON'T TRY TO ENABLE INTERRUPTS + TLO C,400000 ;TRY TO ENABLE INTERRUPTS + SKIPL PDPISR + CAMN U,PDPISR + JRST PDPO1 + JRST OPNL12 + +PDPO1: PUSH P,U + PUSHJ P,PDPO2 + JRST POPUJ + AOS -1(P) + POP P,U + SKIPL (R) + JRST .+3 + AOS PDPISE + MOVEM U,PDPISR;GOT IT AS INFERIOR + PUSHJ P,LSWPOP ;RELEASE TREESW + MOVEI I,1 ;DO "IOPOP" INTO CHNL + +PDPIOP: SKIPL (R) + POPJ P, ;NOT OPEN TO INTERRUPT + SUBI R,IOCHNM(U) + MOVE A,CHNBIT(R) + ADDI R,IOCHNM(U) ;RESTORE R + XCT PDPIOT(I) + POPJ P, + +PDPIOT: ANDCAM A,PDPMSK + IORM A,PDPMSK + +PDPCLS: MOVEI I,0 ;CLOSE + PUSHJ P,PDPIOP ;=> DO "IOPUSH" +PDPCL1: CONO PI,CLKOFF + SOSGE PDPUSE + SETOM PDPUSR ;LAST CHANNEL CLOSED + SKIPL (R) + JRST CLKONJ ;NOT INTERRUPT ENABLED THIS CHNL + SOSGE PDPISE + SETOM PDPISR ;LAST CHANNEL CLOSED + JRST CLKONJ + + +PDPO3: MOVEI U,(A) ;MAKE U INDEX OF SUPERIOR +PDPO2: SKIPL A,SUPPRO(U) ;GET POINTER TO SUPERIOR, SKIP IF TOP LEVEL + JRST PDPO3 ;TRY AGAIN + HLRZ D,C + TLO C,200000 ;SIGNAL PDP6 TO UBI ETC + JSP Q,STDOPN + 3,,PDPUSR + PDPUII,,PDPUIO + PDPBII,,PDPBIO + +;.UCLOSE PDP6 +PDPUCL: MOVSI C,%CLS6 ;GET PDP6 CLSTB BIT + MOVEI R,IOCHNM(U) ;GET PNTR TO USER'S IO CHNL AREA + HRLI R,-20 ;MAKE AOBJN PNTR TO ALL CHNLS + PUSHJ P,PDPCCK ;CHECK CHNL + PUSHJ P,PDPCZP ;CLOSE CHNL IF PDP6 OPEN ON IT + AOBJN R,.-2 ;REPEAT FOR ALL CHNLS + HRLI R,-LUIOP/2 ;MAKE AOBJN PNTR TO IO PDL (ADR ALREADY THERE) + PUSHJ P,PDPCCK ;CHECK ENTRY FOR PDP6 + PUSHJ P,PDPPZP ;CLEAR ENTRY IF PDP6 CHNL + AOJ R, ;INCR TO SKIP IOCHST ENTRY + AOBJN R,.-3 ;REPEAT FOR WHOLE IO PDL + POPJ P, ;ALL PDP6 CHNLS THIS JOB SHOULD NOW BE CLOSED + +PDPCCK: HRRZ B,(R) ;GET CLSTB INDEX FROM IOCHNM + TDNN C,CLSTB(B) ;IF NOT PDP6 CHNL + AOS (P) ;SKIP CLOSING CHNL + POPJ P, + +;CLOSE PDP6 USER CHNL +PDPCZP: PUSHJ P,PDPCLS ;ADJUST PDP6 VARS + JRST STDCLX ;CLOBBER CHNL & RETURN + +;CLEAR PDP6 IO PDL ENTRY +PDPPZP: PUSHJ P,PDPCL1 ;ADJUST PDP6 VARS (EXCEPT PDPMSK) + SETZB A,(R) ;CLEAR SAVED IOCHNM + DPB A,[4000,,1(R)] ;CLEAR SAVED IOCHST (SAVING CHNL # FOR .IOPDL) + POPJ P, + PDPCLR: OFFSET 20-. ;ROUTINE TO BE MOVED + CONO PI,11577 ;CLEAR PI + CONO 655550 ;CLEAR PROCESSOR + DATAO 20,.+1 ;RELEASE DEVICES + SETZ ;CLEAR 0, ALSO BIT FOR DEASSIGNMENT (^) + HRRZI 1,1 ;BLT POINTER 0,,1 + BLT 1,41 ;CLEAR AC'S, SELF, AND 41 +PDPCLE==. + OFFSET 0 ;BACK TO NORMAL +EBLK + +PDPTMP: 0 ;TEMP FOR INT +PDPMSK: 0 ;MASK OF INT BITS OF CHNLS OPEN + +BBLK + +PDPRST: PUSHJ P,MP6LD + MOVE C,[400020,,400021] + XCTR XW,[CLEARM 400020] + XCTR XBRW,[BLT C,437777] + MOVE C,[PDPCLR,,400020] + XCTR XBW,[BLT C,400000+PDPCLE-1] + MOVE C,[JRST 20] + UMOVEM C,400041 + PUSHJ P,UDELAY + UMOVE A,400041 + JUMPE A,PDPRS2 ;JUMP ON ROUTINE WON, DON'T HAVE TO CLEAR IT OUT + XCTR XW,[CLEARM 400020] + MOVE C,[400020,,400021] + XCTR XBRW,[BLT C,400041] +PDPRS2: JRST MPLDZ +];IFN PDP6P + +SUBTTL DL10MP SYSTEM CALL + +IFN DL10P,[ +;.CALL DL10MP +; ARG 1 - PAGE # +;CREATES A READ/WRITE, UNENCACHED, ABSOLUTE PAGE AT THAT POINT +;IN THE USER'S MAP. THE PAGE CONTAINS THE DL10 CONTROL AREA. +; VAL 1 - AOBJN POINTER TO DL10 CONTROL AREA WITHIN PAGE +; VAL 2 - POINTER TO 3 WORDS USED FOR PDP11 EXAMINE/DEPOSIT COMMANDS +; VAL 3 - POINTER TO FIRST FREE WORD WITHIN DL10 CONTROL AREA + +DL10MP: TDNE A,[-400] + JRST OPNL33 ;PAGE NUMBER TOO BIG + PUSHJ P,UPLC + LDB C,Q ;GET CIRC POINTER + CAIE C,-1 + JUMPN C,OPNL13 ;PAGE SLOT ALREADY IN USE + BUG INFO,[DL10MP BY],SIXBIT,UNAME(U),SIXBIT,JNAME(U) + MOVEI C,600000+ ;SUITABLE PTW + DPB C,T + MOVEI C,-1 ;ABS CIRC PNTR + DPB C,Q + CLRPGM (U) + LSH A,10. ;USER'S VIRTUAL ADDRESS + ADDI A,2000 + CAMLE A,HUSRAD(U) + MOVEM A,HUSRAD(U) + SUBI A,2000- ;VIR ADDR OF START OF DL10 CONTROL AREA + HRLI A,-100 ;SIZE OF DL10 CONTROL AREA + MOVEI B,DL10XD-DL10AR(A) + MOVEI C,DLXEND-DL10AR(A) + JRST POPJ1 +];DL10P + +SUBTTL TRAP DEVICE + +;.CALL TRPOPN +; ARG 1 - SPEC +; ARG 2 - CHANNEL NUMBER IN THAT JOB TO BE OPENED AS TRAP DEVICE +; ARG 3 - IOCHNM WORD (ONLY LH IS USED) +; ARG 4 - IOCHST WORD +;THIS GIVES THE INFERIOR A TRAP DEVICE CHANNEL, WHICH GIVES +;A %PITRP INTERRUPT ON MOST OPERATIONS. THE INFERIOR SIGNALS +;ITS DESIRE TO GET SUCH A CHANNEL BY OPENING THE TRAP DEVICE, +;WHICH ALSO GIVES A %PITRP INTERRUPT. +;TRPOPN IS ALSO USEFUL FOR STORING ERROR CODES INTO IOCHST OF AN ALREADY-OPEN TRAP CHANNEL + +TRPOPN: TDNE B,[-NIOCHN] + JRST OPNL14 ;BAD CHANNEL NUMBER + MOVE J,A + JSP T,NCORUI + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 +];PDP6P + JSP T,NCORWR + JRST OPNL31 ;CAN'T MODIFY JOB + ADDI B,IOCHNM(J) ;GET IOCHNM WORD ADDRESS + HRRZ T,(B) + CAIE T,DNTRAP + JUMPN T,OPNL13 ;FILE ALREADY EXISTS (YOU MUST CLOSE THE CHANNEL FIRST) + HRRI C,DNTRAP + MOVEM C,(B) + MOVEM D,IOCHST-IOCHNM(B) + JRST LSWPJ1 ;UNLOCK DIELOK, TAKE SUCCESS RETURN diff --git a/system/itsdis.50 b/system/itsdis.50 new file mode 100644 index 0000000..074fff9 --- /dev/null +++ b/system/itsdis.50 @@ -0,0 +1,336 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;DEVICE CODES +DIS==130 ;DISPLAY PROCESSOR +DISMAP==134 ;MEM PROT & REL +LIPSH==(040000) +NWSTK==LIPSH 3, + +ADSTAR: CONO PI,CLKOFF ;TURN OFF CLOCK TO PREVENT POSSIBLE GOBBLING BY ANOTHER USER + PUSHJ P,DISCHK ;CHECK IF THIS USER OWNS THE DISPLAY + JRST CLKONJ ;RESTART THE CLOCK + SETZM E.SPGH ; QSWI1 switch + SETZM E.SCLS ; clear clobber switch + SKIPL DISUSR ; no user + CAMN U,DISUSR ; skips if different index + JRST NOCLBR ; dont untie pages + MOVEM U,E.SCLS ; else remember to untie + SKIPA ; and dont hack disusr +NOCLBR: MOVEM U,DISUSR ;GIVE IT TO HIM IF NO ONE ELSE OWNS IT + CONO PI,CLKON ;RESTORE THE CLOCK + CONO DIS,5010 ;SET STOP, CLEAR PIA + XCTR XR,[HRRZ A,(C)] ; causes pg ld, fetches droot + HRRM A,DSTADD ; remember for restarts + XCTR XR,[MOVE B,(A)] ; load display page + PUSHJ P,SWTL ; circular switch gobble + CIRPSW + LSH A,-10. ; page number + SKIPN E.SCLS ; clobbering old user index ? + JRST RDSCLB ; if not, skip it + MOVE U,DISUSR ; old useri + PUSHJ P,E.SCLB ; untie pages + MOVEI U,0 + EXCH U,E.SCLS ; clear switch, fetch new usri + MOVEM U,DISUSR +RDSCLB: PUSHJ P,UPLC ; users pg n into circular pointer + PUSHJ P,CHACK ; go in circles + SKIPL C ; 4.9 implies real core in loop + JRST NOTIED ; if not, dont tie down -- still swapped out + MOVE T,J ; MEMPNT INDEX + MOVE E,D ; MMP INDEX + PUSHJ P,E.SPG1 ; go tie it down +NOTIED: PUSHJ P,LSWPOP ; clear switch + ; now set up E&S dbrs + MOVEI T,UDBR1A(U) + HRLI T,_1 ;DBL left 1 relative to 10 + MOVEM T,E.SPM+2 + HRRI T,UDBR2A(U) + MOVEM T,E.SPM+3 + + ; now start (or restart if from E.SPGI) E&S + +RDSTAR: CONO DIS,515330 ;RESET THE WORLD + SETOM E.SSYS ;FLAG=MAP ON (USER MODE) + CONO DIS,515330 ;CLEAR 3D CLIPPER + MOVEI I,1000 ;SET COUNT FOR TIMEOUT + MOVE H,DSTADD ; fetch c(0) + MOVEM H,E.SPM ; store in status block + MOVSI H,140000 ; status bits -- map high and low + MOVEM H,E.SPM+1 ; set status + SKIPA H,[-ADSTN,,ADSTL-1] + BLKO DIS,H + CONSO DIS,604000 ;SKIP IF DONE OR ERROR + SOJG I,.-1 + JUMPL H,.-3 + JUMPE I,CPOPJ ;FAIL IF TIME OUT ON START + CONSZ DIS,600000 ;CHECK FOR EXECUTIVE ERRORS + JRST ADXIT ;GIVE INTERRUPT, NO SKIP + + AOS (P) +ADCON1: CONO DIS,400 ;RUN +ADXIT: CONO DIS,222010+DISCHN ;ALARM+MPV+STOP+PIA + POPJ P, + +ADSTPX: CONSZ DIS,1040 ;FAIL TO SKIP IF MEM OR SEL STOP + JRST ILUUO ;ERROR IF STOP +ADSTOP: CAME U,DISUSR ;SKIP IF USER OF SCOPE + JRST URET ;EXIT IF NOT SCOPE USER +ADSTPY: CONO DIS,5000 ; IOSTOP+STOP.INT.OFF + CONO DIS,300 ;LR.PROG+CLR.HIT + CONSO DIS,640000 ;SKIP IF PARITY, NXM, MPV ON + JRST E.SUSM ;MAP IS STILL ON + CONO DIS,400000 ;CLEAR MASTER STUFF (TURNS OFF MAP) + CONO DIS,400000 ;CLEAR 3D CLIPPER + + AOS E.SSYS ;REMEMBER PAGING IS OFF +E.SUSM: CONSO DIS,4000 ;SKIP IF STOPPED AND READY + PUSHJ P,UFLS ;ELSE WAIT UNTIL READY + POPJ P, + +ADCONT: PUSHJ P,ADSTPX ;ILLEGAL IF MEM OR SEL STOP + PUSHJ P,E.SFU ; force user mode if necessary + POPJ P,0 ; gross lossage (hardware) + JRST ADCON1 + +ADSTEP: PUSHJ P,ADSTPX ;ILLEGAL IF MEM OR SEL STOP + PUSHJ P,E.SFU ; Force User mode (reloads map and skips) + POPJ P,0 ; lossage if here + CONO DIS,40 + POPJ P, + +ADWORD: XCTR XR,[MOVE J,(J)] ; fetch c(AC) + PUSHJ P,ADSTOP ;MAKE SURE IT IS STOPPED + PUSHJ P,E.SFU ;RELOAD MAP IF NECESSARY + POPJ P,0 ;MAP NOT IN USER MODE + DATAO DIS,J + POPJ P, + +ADCLOS: CAME U,DISUSR + POPJ P, + CONO DIS,5010 ;STOP, PI OFF + SETZM E.SPGW ;CLEAR PAGE WAIT + PUSHJ P,SWTL ;LOCK CIRCULAR SWITCH + CIRPSW + PUSHJ P,E.SCLB + PUSHJ P,LSWPOP ;RESTORE SWITCH + SETOM DISUSR + POPJ P, + +DISCHK: MOVE B,UNAME(U) + SKIPL T,DISUSR + CAMN B,UNAME(T) + AOS (P) + +ADRSTA: ;READ STATE, WRITE STATE NOT IN. +ADSSTA: POPJ P, + +;E&S PAGER HAS TO REFERENCE 0 TO INITIALLIZE MAP. +;E&S FORCE USER MODE + +E.SFU: SKIPGE E.SSYS + JRST POPJ1 ;SKIP IF MAP OFF +E.SFU2: MOVSI T,140000 ;ENTRY FOR DCRRST + MOVEM T,E.SPM+1 ;RESETS STATUS + DATAO DIS,[NWSTK 1] ;STORE SP AT 0 + PUSHJ P,E.SWT ;CANNOT UFLS -- NWSTK MIGHT BE REISSUED + POPJ P,0 ;HARDWARE LOSSAGE + DATAO DIS,E.SPM ;OUTPUTS C(0) (RELOADS SP) + PUSHJ P,E.SWT + POPJ P,0 ;LOST + SETOM E.SSYS ;REMEMBER MAP ON + JRST POPJ1 + +E.SWT: PUSH P,J + MOVEI J,100 ;COUNT FOR TIMEOUT + CONSZ DIS,4000 ;STOPPED AND READY? ELSE SKIP + JRST POPJJ1 ;SKIP RET IF READY + CONSO DIS,640000 ;OTHER FLAVORS OF LOSSAGE + SOJG J,E.SWT+2 ;COUNT IF STILL OK + CONO DIS,10 ;STOP FOR GOOD + JRST POPJJ ;LOSES, NO SKIP RETURN + +ADSTL: 000501052405 ;LI DIR,052405(PROGM) + 300541,,[-1,,] ;LOCLA SELINT,[-1,,](1) + 300441,,[102521,,] ;LOCLA CDIR,[102521,,](1) + 302641,,[3777,,3777] ;LOCLSA VIEW,[3777,,3777](1) + 302701,,[377777377777] ;LOCLSA WIND,[377777377777](1) + 100,,0 ; (JMP 0) load page map and go +ADSTN==.-ADSTL +EBLK + +DSTADD: 000100,, ;JMP TO CODE (FILL IN ADDRESS) + +; E&S PAGE MAP STATUS BLOCK +E.SPM: 0 ; c(0) + 0 ; status word + 0 ; dbr low + 0 ; dbr high + +MXDISP==16. ; maximum number of tied pages +DISPGP: -MXDISP,,0 ; page pointer for mmp pages +DISSWP: BLOCK MXDISP ; MMSWP INDICES TIED +E.SPGW: 0 ; if non zero, E&S page wait page +E.SPGH: 0 ; flag for QSWI1 +E.SCLS: 0 ; if non zero, new userI flushing disusr +E.SSYS: 0 ; flag for pager on/off +E.SIST: 0 ; ststus word at last interrupt + +; counts for debugging + +E.SNTI: 0 ; # pages tied down (total during system run) +E.SNUT: 0 ; # pages untied (should = .-1 after dclose) + +E.SREL: 0 ; # times pages in DISSWP table were relocated + +; end of debug counts + + +DSTPCT: -1 ; STOP COUNT TO HANDLE REDUNDANT STOPS +DSCONI: 0 ;LAST CONI FROM DISPLAY +EBRKA: 0 ;INTERRUPT SAVE AC +EBRKU: 0 ; DITTO + +ESBRK: 0 ;HANDLE E&S INTERRUPT + +BBLK + + CONSO DIS,7 ;PI CHAN ASSIGNED? + JRST 12,@ESBRK ;NO, CANNOT INTERRUPT + CONI DIS,DSCONI + CONO DIS,10 ;DEASSIGN PI CHANNEL + MOVEM U,EBRKU ;SAVE AC'S + MOVEM A,EBRKA + MOVEI A,%PILTP ;GIVE "LTPEN" INT (CLASS 3) + CONSZ DIS,640040 ;PAR, NXM, MPV, SELECT + JRST E.SFLT ; check page fault +E.SUIN: SKIPL U,DISUSR + IORM A,PIRQC(U) +E.SPFR: MOVE A,EBRKA ;UNSAVE AC'S + MOVE U,EBRKU + JRST 12,@ESBRK ;RETURN + +E.SFLT: CONSZ DIS,200000 ; skip if not NXM (ie not fault) + SKIPL E.SPM+1 ; error bit set in status word ? + JRST E.SILM ; if not, real illegal mem + LDB U,[121000,,E.SPM+1] ; get page # + HRROM U,E.SPGW ; save for loading (LH is flag) + MOVE U,E.SPM+1 ; get status + MOVEM U,E.SIST ; save status for later (debugging) + LDB U,[330300,,U] ; access and pgerr + CAIE U,2 ; read write/first error + SKIPN U ; no access -- page fault + JRST E.SPFR ; gives a page fault +E.SILM: SETZM E.SPGW ; if not page fault, don't rq load + MOVEI A,%PIDIS; mem fault bits + JRST E.SUINT ; give user interrupt + +DCRSTP: CAMN U,DISUSR ;IS THIS U ON DIS + AOSE DSTPCT ; HERE IF THIS USER, SKIP IF FIRST CALL TO STOP + POPJ P, ;RETURN IF NOT + CONSO DIS,7 ; SKIP IF CURRENTLY RUNNING + POPJ P, ; RETURN IF NOT RUNNING NOW + CONI DIS,DSCONI ;SAVE STATE FOR RESTART + CONO DIS,5000 ;OTHERWISE STOP IT +DISSTQ: MOVEI TT,100 + CONSO DIS,4000 ;SKIP IF STOP ACTUALLY TAKES HOLD + SOJG TT,.-1 ;TIME-OUT LOOP + JUMPG TT,CPOPJ ;DID NOT TIME OUT, OK + CONO DIS,10 ;DISABLE DISPLAY (CLEAR PIA) + AOS DISSTQ ;CAUSE "SYSTEM CLOBBERED" ... ON SYS CONSOLE + POPJ P, + + +E.SLPM: PUSHJ P,DCRSTP ; stop before loading page map +DCRRST: CAMN U,DISUSR ;IS THE CURRENT U ON DISPLAY? + SOSL T,DSTPCT ; SKIP IF LAST START CALL, (FROM MORE THAN 1 STOP) + POPJ P, ;NO + AOSE T ;SKIP IF ONLY ONE STOP + JRST 4,. ;SOME ONE IS OUT OF PHASE! + MOVE T,DSCONI + CONSZ DIS,7 ;SKIP IF NOT RUNNABLE + TRNE T,4000 ;1=> WAS STOPPED + POPJ P, ;SO QUIT + PUSHJ P,E.SFU2 ; load E&S page map + POPJ P,0 ; lost somehow + CONO DIS,400 ;ELSE SET RUN + CONO DIS,2000 ;THEN ALLOW STOP INT + POPJ P, + + ; tie down hacks + +;E.SPCH checks MMSWP ind in T against DISSWP +; R0 if already there, R1 if not. ret index in H + +E.SPCH: MOVSI H,-MXDISP + CAMN T,DISSWP(H) + POPJ P,0 ; found + AOBJN H,.-2 ; look some more + JRST POPJ1 ; not found, skip + +E.SCLB: MOVSI H,-MXDISP + SKIPE T,DISSWP(H) ; VALID IF NON-ZERO + PUSHJ P,UNTIE ; UNTIE PAGE IN T (MMSWP INDEX) + AOBJN H,E.SCLB+1 + POPJ P,0 + +; UNTIE PG T/ MMSWP index +; H/ display table index + +UNTIE: AOS E.SNUT ; count unties + PUSH P,H + MOVSI H,-1 + ADDB H,MMSWP(T) ; sos # exec pgs + SKIPGE H ; if less than zero, untied an untied page + JRST 4,. ; exec pg count < 0 + POP P,H + SETZM DISSWP(H) ; clear table entries + POPJ P,0 + +; ties down page. T/ MMSWP ind. + +E.SPG1: SKIPL MEMBLT(T) ; frozen, so dont tie + PUSHJ P,E.SPCH ; skips if not there + POPJ P,0 ; dont tie + AOS E.SNTI ; count number of ties. + MOVSI H,1 + ADDM H,MMSWP(T) ; aos # exec pgs + MOVE H,DISPGP ; fetch dis pg pointer + AOBJN H,.+2 + MOVSI H,-MXDISP ; reset pointer if table full + MOVEM H,DISPGP ; update pointer + PUSH P,T ; now checks if slot in use + SKIPE T,DISSWP(H) + PUSHJ P,UNTIE ; untie page in T + POP P,T + MOVEM T,DISSWP(H) ; remember mmswp ind + POPJ P,0 + +; E.SPGI called from CFHPI on page in core after fault + +E.SPGI: SKIPGE U,DISUSR + JRST 4,. ; why here ? + HRRO I,CFHUVP ; user virtul page from CFH... + CAME I,E.SPGW ; is the sam as E&S rq ? + POPJ P,0 ; no, return + SETOM E.SPGH ; set flag for QSWI1 (read/write/first hack) + PUSHJ P,E.SPG1 ; tie down + SETZM E.SPGW ; clear page wait + PUSHJ P,RDSTART ; restart display + POPJ P,0 + POPJ P,0 ; skip return from rdstart if wins + \ No newline at end of file diff --git a/system/itsmsp.30 b/system/itsmsp.30 new file mode 100644 index 0000000..6a731be --- /dev/null +++ b/system/itsmsp.30 @@ -0,0 +1,331 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;.OPEN CHNL,PNTR1 + +;PNTR1: MODE,,(SIXBIT /NET/) +; PNTR2 +; MYNAME1 +; MYNAME2 + +;PNTR2: HISNAME1 +; HISNAME2 +; COUNT +; buffer + +;MODES=> BITS 3.1== READ FROM ANY +; 3.2== READ FROM SPECIFIC +; 3.3== SEND AND HANG +; 3.4== SEND IMMEDIATE +; 3.5== USE UNAME JNAME AS MY1 AND MY2 +; 3.6== USE UNAME AS HIS1 + +;OPEN FAILURES: +; 4 HIS NAME 1 & HIS NAME 2 WERE ZERO +; 6 TABLE FULL +; 7 ON WRITE, RELOCATION OF READ BUFFER FAILED +; 11 ATTEMPT TO SEND TO SELF +; 12 NOT A LEGAL MODE +; 20 SEND IMMEDIATE, GUY WASN'T THERE +; 22 BUFFER NOT IN YOUR CORE IMAGE + + +EBLK + +MSENTS==40 ;# OF ENTRIES IN THE TABLE + +MSUSER: BLOCK MSENTS ;USER INDEX +MSCHNL: BLOCK MSENTS ;USERS CHANNEL +MSBADR: BLOCK MSENTS ;RELATIVE ADDRR OF USER'S BUFR +MSBCNT: BLOCK MSENTS ;SIZE OF USERS BUFFER + +MSWRIT: BLOCK MSENTS ;SENDING NAME 1 +MSWRT2: BLOCK MSENTS ;SENDING NAME 2 +MSREAD: BLOCK MSENTS ;READING NAME 1 +MSRED2: BLOCK MSENTS ;READING NAME 2 + +MSPSW: -1 ;SWITCH FOR MSP VARIABLES + 0 ;EXTRA WORD, FOR SWTL ROUTINE + +BBLK + + IPCO: PUSHJ P,SWTL ;LOCK THE MSP SWITCH + MSPSW + TLNE C,1 ; read from any? + JRST MSRA ; yes + TLNE C,2 ; read from specific? + JRST MSRS ; yes + TLNE C,4 ; send and hang? + JRST MSSH ; yes + TLNE C,8 ; send immediate? + JRST MSSI ; yes + JRST OPNL12 ; none of the above + +; read from any (RA) and read from specific (RS) +MSRA: SETOM H ; H/-1 =>RA 0=>RS + SKIPA +MSRS: SETZM H + +; find first free user slot + MOVSI W,-MSENTS ; W/ slot index +MSR1: SKIPG MSUSER(W) ; is this slot free? + JRST MSR2 ; yes + AOBJN W,MSR1 + JRST OPNL6 ; no free slots, device full + +; W/ slot index of a free slot +MSR2: MOVEM U,MSUSER(W) ; occupies this slot +; make sure we have a legal buffer + HRRZ D,A ; relative address of second buffer + MOVEI E,3(D) ; E/ relative address of data area + XCTR XRW,[MOVES (D)] ;CHECK COUNT FETCH? + XCTR XRW,[MOVES TT,2(D)] ;CHECK ACTUAL COUNT PLACE + +; bufr ok, now put data in table + MOVEM E,MSBADR(W) ; stores buffer address + MOVEM TT,MSBCNT(W) + +; store sender name only if RS + JUMPL H,MSR3 + XCTR XR,[MOVE TT,(D)] ; his name 1 + XCTR XR,[MOVE I,1(D)] ; his name 2 + TLNE C,40 ; his1 = UNAME? + MOVE TT,UNAME(U) ; yes + SKIPA +MSR3: SETZB TT,I ; zero if RA + MOVEM TT,MSWRIT(W) + MOVEM I,MSWRT2(W) + +; 3.5 bit in C means use UNAME JNAME as myname1 and myname2 + TLNN C,20 ; skips if want default + JRST .+4 + MOVE TT,UNAME(U) + MOVE I,JNAME(U) + JRST .+3 + ; else me1 is in B and me2 is in SRN3(U) + MOVE TT,B + MOVE I,SRN3(U) + MOVEM TT,MSREAD(W) + MOVEM I,MSRED2(W) + + MOVEI TT,(R) ;GET CHANNEL + SUBI TT,IOCHNM(U) + MOVEM TT,MSCHNL(W) ;STORE FOR LATER INTERRUPT + + PUSHJ P,LSWPOP ;UNLOCK MSP SWITCH + +; now put tabl index in lh of IOCHNM(U)(R) + HRLZ A,W + JSP Q,OPSLD1 + MSPIO,,MSPIO ; attempted IOT will get IOCER 10. + ; send and hang (SH) and send immediate (SI) +MSSI: SETOM H ; H/-1=>SI 0=>SH + SKIPA +MSSH: SETZM H + +; validate his buffer specs + HRRZ D,A ; relative buffer address + MOVEI E,3(D) ; E/ relative data addr + XCTR XRW,[MOVES (D)] ;CHECK NAME + XCTR XRW,[MOVES Q,2(D)] ;CHECK COUNT + +; other data + ; E/ absolute data addr + ; Q/ count + XCTR XR,[MOVE T,(D)] ; T/ his name 1 + TLNE C,40 ; 3.6 bit means use UNAME + MOVE T,UNAME(U) ; yes + XCTR XR,[MOVE TT,1(D)] ; TT/ his name 2 + JUMPN T,.+3 ; T and TT can not both be zero + SKIPN TT + JRST OPNL4 + MOVEM TT,EPDL(U) ; EPDL(U)/ hisname2 + +; 3.5 bit in C means use UNAME JNAME as myname1 and myname2 + TLNN C,20 ; skips if wants default + JRST .+4 + MOVE TT,UNAME(U) + MOVE I,JNAME(U) + JRST .+3 + ; else myname1 is in B and myname2 is in SRN(U) + MOVE TT,B + MOVE I,SRN3(U) + MOVEM TT,EPDL3(U) ; EPDL3/ myname1 + MOVEM I,SRN4(U) ; SRN4/ myname2 + +; see if entry is in the table + PUSHJ P,MSSTBL + SKIPA ; no, will havee to wait + JRST MSS2 ; yes, service the transfer + JUMPL H,OPNL20 ; was an SI, lose +MSS1: XCTR XR,[MOVE T,(D)] ; in case it got munged + TLNE C,40 ; 3.6 bit means use UNAME + MOVE T,UNAME(U) + + +; wait for entry to appear in table +MSDM3: PUSH P,T ;LSWPOP CLOBBERS T + PUSHJ P,LSWPOP ;UNLOCK MSPSW FOR WAITING + MOVE T,(P) ;RESTOR T + SKIPA ; forces a call to ufls + PUSHJ P,MSSTBL + PUSHJ P,UFLS ; hang . . . . + PUSHJ P,SWTL ;RELOCK SWITCH NOW + MSPSW + POP P,T ;RESTORE T AFTER CLOBBERING BY SWTL + PUSHJ P,MSSTBL ; read has been done, get details + JRST MSS1 ; oops, must have been aborted + +; FALLS THRU IF MSSTBL SKIPS +; table index of the user is now in T +MSS2: MOVE H,T ; H/ table index + MOVE A,MSUSER(H) ; A/ user index + CAMN A,U + JRST [PUSHJ P,LSWPOP ;POP MSPSW + JRST OPNL11] + PUSHJ P,RPCLSR ; stop or i'll shoot + PUSHJ P,SOSSET ;SET TO SOS USTP(A) ON PCLSR + USTP(A) + +; get the absolute address of the read data buffer +MSS3: MOVE A,MSBADR(H) ; relative +;SET UP PAGE MAP FOR RECEIVER (USER IN MSUSER(H)) + PUSH P,R + MOVE J,MSUSER(H) ;USER TO RECEIVE + PUSHJ P,MPLDJ ;LOAD MAP +; fix count (sender cnt in Q, receiver cnt in MSBCNT(H)) + CAMG Q,MSBCNT(H) ; will it fit? + JRST MSS4 ; yes + XCTRI XRW,[SETOM -1(A)] ; no, indicate overflow will be lost + CAIA ;REFERENCE WORKED, SKIP + JRST MSS7 ;FAIL, RESTORE STOPS ETC. + MOVE B,MSBCNT(H) ; B/ count + JRST MSS5 +MSS4: MOVE B,Q ; B/ count + MOVE TT,MSBCNT(H) + SUB TT,B + XCTRI XRW,[MOVEM TT,-1(A)] ; amount that will be xfered + CAIA ;REFERENCE WORKED, SKIP + JRST MSS7 ;FAIL, RESTORE STOPS ETC. + +; if MSWRIT was zero (RA), fill it in +MSS5: SKIPN MSWRIT(H) + SKIPE MSWRT2(H) + JRST MSS6 + MOVE TT,EPDL3(U) + XCTRI XRW,[MOVEM TT,-3(A)] ; read's him1 + CAIA ;REFERENCE WORKED, SKIP + JRST MSS7 ;FAIL, RESTORE STOPS ETC. + MOVE TT,SRN4(U) ; + XCTRI XRW,[MOVEM TT,-2(A)] ; read's him2 + CAIA ;REFERENCE WORKED, SKIP + JRST MSS7 ;FAIL, RESTORE STOPS ETC. + +; RESTORE USER MAP TO CURRENT USER +MSS6: PUSHJ P,MPLDZ + POP P,R +; XFER => B/ CNT A/READ BUFR E/WRIT BUFR J/UNRELOCATED BUFFER (READ) + HRRM A,IOCHST-IOCHNM(R) ;STORE RECEIVER ADDRESS FOR UBO + MOVN W,B ;-COUNT + MOVSS W ;-COUNT,, + HRR W,E ;-COUNT,,ADR + MOVE C,[SETZ W] ;POINTER FOR UBO + MOVE A,MSUSER(H) ;GET OTHER USERS NUMBER FOR UBO + PUSHJ P,UBO ;USER BLOCK OUTPUT - DO WRITE TRANSFER + +; RESTART THE LOSER + PUSHJ P,LSWPOP ;UNDO RPCLSR (SOS USTP(MSUSR(H))) + MOVE A,MSUSER(H) ;GET TARGET USER + MOVE B,MSCHNL(H) ;CHANNEL HE OPENED + MOVE B,CHNBIT(B) ;BIT CORRESPONDING TO CHAN + TDNE B,MSKST2(A) ;SKIP IF NOT ENABLED + IORM B,IFPIR(A) ;SET HIS INTERRUPT + +; flush read entry from the table + SETZM MSCHNL(H) + SETZM MSREAD(H) + SETZM MSRED2(H) + SETZM MSWRIT(H) + SETZM MSWRT2(H) + SETZM MSBADR(H) + SETZM MSBCNT(H) + SETZM MSUSER(H) + + PUSHJ P,LSWPOP ;UNLOCK MSPSW + +; end open + SETOM A ; LH IOCHNM==-1 MEANS SEND (FOR CLOS) + JSP Q,OPSLD1 ;DOES POPJ BACK TO UUOH + MSPIO,,MSPIO +; (DOES NOT COME BACK) + +;HERE FOR FAILURE OF XCTRI WHILE MAP SET TO RECEIVER +MSS7: POP P,R ;RESTORE STACK + PUSHJ P,LSWPOP ;RESTART USER (SOS USTP) + PUSHJ P,TPFLT ;TAKE PAGE FAULT, CAUSE PAGE LOAD + PUSHJ P,MPLDZ ;RESTORE MY PAGE MAP + JRST MSS1 ;TRY AGAIN + +; FIND LOSER IN TABLE SKIP IF WINS +; IN => T/READ1 EPDL/READ2 EPDL3/WRITE1 SRN4/WRITE2 +; OUT => IF WINS, T/TABLE OFFSET +MSSTBL: PUSH P,A + PUSH P,B + PUSH P,C + PUSH P,D + MOVSI A,-MSENTS + MOVE B,EPDL(U) ; B/ READ2 + MOVE C,EPDL3(U) ; C/ WRITE1 + MOVE D,SRN4(U) ; D/ WRITE2 +MSSTB1: CAMN T,MSREAD(A) + CAME B,MSRED2(A) + JRST MSSTB2 + SKIPN MSWRIT(A) ; if it was read from any + SKIPE MSWRT2(A) ; win if WRIT and WRT2 are both zero + JRST .+2 + JRST MSSTB3 + CAMN C,MSWRIT(A) + CAME D,MSWRT2(A) + JRST MSSTB2 +MSSTB3: HRRZ T,A + AOSA -4(P) +MSSTB2: AOBJN A,MSSTB1 + POP P,D + POP P,C + JRST POPBAJ + +; close routine +; A/ lf IOCHNM +; R/ addr of IOCHNM(USER)(CHNL) + +MSCLOS: TRNE A,400000 ; -1 means write + POPJ P, + CAIL A,MSENTS ; in bounds of table? + POPJ P, ; no + CAME U,MSUSER(A) ; is this still me? + POPJ P, + +; yes, make this a free slot + SETZM MSCHNL(A) + SETZM MSREAD(A) + SETZM MSRED2(A) + SETZM MSWRIT(A) + SETZM MSWRT2(A) + SETZM MSBADR(A) + SETZM MSBCNT(A) + SETZM MSUSER(A) + POPJ P, +  \ No newline at end of file diff --git a/system/kaimp.defs1 b/system/kaimp.defs1 new file mode 100644 index 0000000..633720c --- /dev/null +++ b/system/kaimp.defs1 @@ -0,0 +1,79 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Hardware description of AI-KA/ML/MC IMP interface, device "IMP". +; For a more detailed description, see AI Hardware Memo #10, +; "ARPA Network Interface". +; In particular, the "channel 1 multiplexing" feature of the ITS KA's +; is used, so that: +; When PI level 2 (NETCHN) is assigned, the IMP interface takes +; all interrupts on the normal channel (goes to IMPINT). +; When PI level 1 (IMPCHN) is assigned, +; IMPID+(-IMPLIW) => Pseudo channel 4, location 70 (IMPILC)-> various +; IMPOD => Pseudo channel 5, location 72 (IMPOLC)-> various +; else normal PI channel 1 (PI0LOC+2)-> IMPBRK + +; CONI bits - starred items cause interrupt on PIA channel + ; 1.1-1.3 => PIA +DEFSYM IMPID==10 ;* INPUT DONE - on when word avail for DATAI +DEFSYM IMPI32==20 ; Input in 32 bit mode +;DEFSYM IMPIB==40 ; Input Busy +DEFSYM IMPOD==100 ;* OUTPUT DONE - Word sent to IMP +;DEFSYM IMPO32==200 ; Output in 32 bit mode +;DEFSYM IMPOB==400 ; Output Busy +DEFSYM IMPERR==1000 ;* Imp Error (interrupt if IMPIC zero) +DEFSYM IMPR==2000 ;* Imp Ready (interrupt if IMPIC set) +;DEFSYM IMPIC==4000 ; Imp interrupt condition + ; (0 = int on IMPERR, 1= int on IMPR) +DEFSYM IMPHER==10000 ;* Host Error (interrupt if IMPIHE zero) +;DEFSYM IMPHR==20000 ; Host Ready +;DEFSYM IMPIHE==40000 ; Inhibit interrupt on Host Error (IMPHER) +DEFSYM IMPLW==100000 ;* Last Imp Word + +; CONO bits - starred flags are always copied directly to set states + ;* 1.1-1.3 => PIA set from these bits +DEFSYM IMPIDC==10 ; Clear Input Done +DEFSYM IMI32S==20 ; Set input to 32 bit mode +DEFSYM IMI32C==40 ; Clear input in 32 bit mode +DEFSYM IMPODC==100 ; Clear Output Done +DEFSYM IMO32S==200 ; Set output to 32 bit mode +DEFSYM IMO32C==400 ; Clear output in 32 bit mode +DEFSYM IMPODS==1000 ; Set Output Done +DEFSYM IMPIR==4000 ;* Copied to IMPIC; 1= Enable int on imp ready +DEFSYM IMPHEC==10000 ; Clear Host Error +;DEFSYM IMIIHE==40000 ;* Copied to IMPIHE + ; 1= Inhibit int on host error +DEFSYM IMPLHW==200000 ; Set Last Host Word + ; (do this before last DATAO of msg) +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/ksnet.1 b/system/ksnet.1 new file mode 100644 index 0000000..f5d61b5 --- /dev/null +++ b/system/ksnet.1 @@ -0,0 +1,74 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;;; Chaosnet interface on Unibus + +CAICSR=3,,764140 ;COMMAND STATUS REG +CH%CSR==0 + %CABSY==1 ;0 XMT BUSY (RO) + %CALUP==2 ;1 LOOP BACK (R/W) + %CASPY==4 ;2 RECIEVE MSGS FOR ANY DESTINATION (R/W) + %CARCL==10 ;3 CLEAR THE RECEIVER, IT CAN NOW GOBBLE ANOTHER MSG (WO) + %CAREN==20 ;4 RCV INT ENB (R/W) + %CATEN==40 ;5 XMT INT ENB (R/W) + %CATAB==100 ;6 TRANSMIT ABORTED BY ETHER CONFLICT (RO) + %CATDN==200 ;7 TRANSMIT DONE. SET WHEN TRANSMITTER IS DONE + %CATCL==400 ;8 CLEAR THE TRANSMITTER, MAKING IT READY (WO) + $CALOS==110400 ;9-12 LOST COUNT (RO) [# MSGS RCVED WITH RCV BFR FULL] + ; WHEN MSG IS WAITING IN BUFFER, THIS COUNTS + ; THE MESSAGES THAT MATCHED OUR DESTINATION OR + ; WERE BROADCAST, BUT COULDN'T BE RECIEVED. + ; WHEN RECEIVER IS RE-ENABLED (WRITE 1 INTO %CARDN) + ; THE COUNT IS THEN CLEARED. + ; WHEN A MESSAGE IS LOST, RECEIVER ZAPS ETHER + ; SO TRANSMITTER WILL ABORT (IF MESSAGE WAS DESTINED + ; TO US.) + %CARST==20000 ;13 I/O RESET (WO) + %CAERR==40000 ;14 CRC ERROR (RO) + %CARDN==100000 ;15 RCV DONE. + +CAIMYN==3,,764142 ;MY # (READ ONLY) +CH%MYN==2 ;RETURNS THE [SOURCE] HOST# OF THIS INTERFACE. + +CAIWBF=3,,764142 ;WRITE BUFFER (WRITE ONLY) +CH%WBF==2 ;FIRST WAIT FOR TDONE. (OR SET IT VIA CSR) + ;FIRST WORD IN RESETS TRANSMITTER AND CLEARS TDONE. + ;STORE INTO THIS REGISTER TO WRITE WORDS OF MESSAGE, + ;LAST WORD IN IS DESTINATION ADDRESS, THEN READ CAIXMT. + ;SOURCE ADDRESS AND CHECK WORD PUT IN BY HARDWARE. + +CAIRBF=3,,764144 ;READ BUFFER (READ ONLY) +CH%RBF==4 ;THE FIRST WORD READ WILL BE FILLED TO THE LEFT + ;TO MAKE THE MESSAGE RECIEVED A MULTIPLE OF 16 BITS. + ;IF THE NUMBER OF DATA BITS IN THE MESSAGE WAS A + ;MULTIPLE OF 16, THIS WORD WILL BE THE FIRST WORD PUT + ;INTO THE BUFFER BY THE TRANSMITTING HOST. + ;THE LAST 3 WORDS READ ARE DESTINATION, SOURCE, CHECK. + +CAIRBC=3,,764146 ;RECEIVE BIT COUNTER (READ ONLY) +CH%RBC==6 ;WHEN A MESSAGE HAS BEEN RECEIVED THIS IS ONE LESS THAN + ;THE NUMBER OF BITS IN THE MESSAGE (16 X THE + ;NUMBER OF WORDS INCLUDING THE THREE OVERHEAD WORDS.) + ;AFTER THE LAST WORD (THE CRC WORD) HAS BEEN READ, IT IS 7777 + ;BITS 10 AND 11 ARE THE HIGH ORDER BITS, AND IF THEY ARE ONE, + ;THEN THERE WAS A BUFFER OVERFLOW + +CAIXMT=3,,764152 ;READING THIS INITIATES TRANSMISSION (!!) +CH%XMT==12 ;THE VALUE READ IS ONE'S OWN HOST#. + +;REFERENCING ADDRESSES IN THE GROUP OF 8 WORDS NOT LISTED HERE, OR +;USING COMBINATIONS OF READ/WRITE NOT LISTED HERE, WILL TYPICALLY CAUSE +;STRANGE AND BIZARRE EFFECTS. diff --git a/system/lhdh.defs4 b/system/lhdh.defs4 new file mode 100644 index 0000000..37a9a72 --- /dev/null +++ b/system/lhdh.defs4 @@ -0,0 +1,96 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; The ACC IMP interface on the KS implements two separate Unibus IO +; devices, for input and output. Both of these devices transfer data in +; 32-bit mode only over the Unibus via DMA. Because of the DMA data +; transfer the interrupt structure is trivial, and uses NETCHN only. +; +; Apparently the reset bits in the two CSRs are wired together, so +; resetting one side of the machine resets both. This action also drops +; the HOST READY line to the IMP. +; +; You must set %LHSE whenever hte HOST READY line is high, or the IMP +; will be allowed to freely throw away data. This is true across IMP +; message boundaries, and even if no input request is active. +; + +;ACC LH-DH IMP Interface Bits + +;Interrupt information +DEFSYM %LHVEC==250 ;Input side interrupt vector (non-standard) + ;Output side assumed to be %LHVEC+4 +DEFSYM %LHPRI==6 ;Interrupt priority (non-standard) + +DEFSYM %LHBAS==767600 ;Base of LH/DH Unibus register address space + +;Unibus Registers +DEFSYM %LHICS==%LHBAS ;Control and Status, Input side +DEFSYM %LHIDB==%LHBAS+2 ;Data Buffer, Input +DEFSYM %LHICA==%LHBAS+4 ;Current Word Address, Input +DEFSYM %LHIWC==%LHBAS+6 ;Word Count, Input + +DEFSYM %LHOCS==%LHBAS+10 ;Control and Status, Output side +DEFSYM %LHODB==%LHBAS+12 ;Data Buffer, Output +DEFSYM %LHOCA==%LHBAS+14 ;Current Word Address, Output +DEFSYM %LHOWC==%LHBAS+16 ;Word Count, Output + +;Bits in CSRs +; Bits common to input and output +DEFSYM %LHERR==1_15. ;Error present +DEFSYM %LHNXM==1_14. ;Non Existant Memory on DMA +DEFSYM %LHMRE==1_9. ;Master Ready Error (ready bounce during xfr) +DEFSYM %LHRDY==1_7. ;Device Ready (modifying LHDH regs allowed) +DEFSYM %LHIE==1_6. ;Interrupt Enable +DEFSYM %LHA17==1_5. ;Address bit 17 for extended unibus xfrs +DEFSYM %LHA16==1_4. ;Address bit 16 for extended unibus xfrs +DEFSYM %LHRST==1_1. ;Interface Reset +DEFSYM %LHGO==1 ;GO - Start DMA Transfer + +; Input side +DEFSYM %LHEOM==1_13. ;End-of-Message received from IMP +DEFSYM %LHHR==1_11. ;Host Ready (ACC's relay closed, debounced) +DEFSYM %LHINR==1_10. ;IMP not ready +DEFSYM %LHIBF==1_8. ;Input Buffer Full +DEFSYM %LHSE==1_3. ;Store Enable (0 == flush data instead) +DEFSYM %LHHRC==1_2. ;Host Ready Relay Control (1 to close relay) + +; Output side +DEFSYM %LHWC0==1_13. ;Output Word Count is zero +DEFSYM %LHOBE==1_8. ;Output Buffer Empty +DEFSYM %LHBB==1_3. ;Bus Back (loopback enable for testing) +DEFSYM %LHELB==1_2. ;Send EOM indication to IMP at end of xfr + ; (enable Last Bit Flag) +IFN $$TEMP,EXPUNG DEFSYM + diff --git a/system/lhdh.defs5 b/system/lhdh.defs5 new file mode 100644 index 0000000..7f741a1 --- /dev/null +++ b/system/lhdh.defs5 @@ -0,0 +1,96 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; The ACC IMP interface on the KS implements two separate Unibus IO +; devices, for input and output. Both of these devices transfer data in +; 32-bit mode only over the Unibus via DMA. Because of the DMA data +; transfer the interrupt structure is trivial, and uses NETCHN only. +; +; Apparently the reset bits in the two CSRs are wired together, so +; resetting one side of the machine resets both. This action also drops +; the HOST READY line to the IMP. +; +; You must set %LHSE whenever hte HOST READY line is high, or the IMP +; will be allowed to freely throw away data. This is true across IMP +; message boundaries, and even if no input request is active. +; + +;ACC LH-DH IMP Interface Bits + +;Interrupt information +DEFSYM %LHVEC==250 ;Input side interrupt vector (non-standard) + ;Output side assumed to be %LHVEC+4 +DEFSYM %LHPRI==6 ;Interrupt priority (non-standard) + +DEFSYM %LHBAS==767600 ;Base of LH/DH Unibus register address space + +;Unibus Registers +DEFSYM %LHICS=:%LHBAS ;Control and Status, Input side +DEFSYM %LHIDB=:%LHBAS+2 ;Data Buffer, Input +DEFSYM %LHICA=:%LHBAS+4 ;Current Word Address, Input +DEFSYM %LHIWC=:%LHBAS+6 ;Word Count, Input + +DEFSYM %LHOCS=:%LHBAS+10 ;Control and Status, Output side +DEFSYM %LHODB=:%LHBAS+12 ;Data Buffer, Output +DEFSYM %LHOCA=:%LHBAS+14 ;Current Word Address, Output +DEFSYM %LHOWC=:%LHBAS+16 ;Word Count, Output + +;Bits in CSRs +; Bits common to input and output +DEFSYM %LHERR==1_15. ;Error present +DEFSYM %LHNXM==1_14. ;Non Existant Memory on DMA +DEFSYM %LHMRE==1_9. ;Master Ready Error (ready bounce during xfr) +DEFSYM %LHRDY==1_7. ;Device Ready (modifying LHDH regs allowed) +DEFSYM %LHIE==1_6. ;Interrupt Enable +DEFSYM %LHA17==1_5. ;Address bit 17 for extended unibus xfrs +DEFSYM %LHA16==1_4. ;Address bit 16 for extended unibus xfrs +DEFSYM %LHRST==1_1. ;Interface Reset +DEFSYM %LHGO==1 ;GO - Start DMA Transfer + +; Input side +DEFSYM %LHEOM==1_13. ;End-of-Message received from IMP +DEFSYM %LHHR==1_11. ;Host Ready (ACC's relay closed, debounced) +DEFSYM %LHINR==1_10. ;IMP not ready +DEFSYM %LHIBF==1_8. ;Input Buffer Full +DEFSYM %LHSE==1_3. ;Store Enable (0 == flush data instead) +DEFSYM %LHHRC==1_2. ;Host Ready Relay Control (1 to close relay) + +; Output side +DEFSYM %LHWC0==1_13. ;Output Word Count is zero +DEFSYM %LHOBE==1_8. ;Output Buffer Empty +DEFSYM %LHBB==1_3. ;Bus Back (loopback enable for testing) +DEFSYM %LHELB==1_2. ;Send EOM indication to IMP at end of xfr + ; (enable Last Bit Flag) +IFN $$TEMP,EXPUNG DEFSYM + diff --git a/system/meter.tecmac b/system/meter.tecmac new file mode 100644 index 0000000..45b2c52 --- /dev/null +++ b/system/meter.tecmac @@ -0,0 +1,21 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +0j +[1[2 +0u2 +<:s;;; METER :::; 0l .u1 1l q1,.@x2 > +hk g2 0j ]2]1 diff --git a/system/mtape.196 b/system/mtape.196 new file mode 100644 index 0000000..597c9a1 --- /dev/null +++ b/system/mtape.196 @@ -0,0 +1,1472 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;******************************** +;** +;** TO BE DONE: +;** +;** RECORDS LONGER THAN 1K +;** AUTOMTAIC DETERMINATION OF DENSITY AND RECORD LENGTH WHEN READING +;** ALLOW CLOSE WHEN TAPE HAS BEEN TAKEN OFF +;** BE MORE FORGIVING OF CONTROLLER LOSSAGE +;** PASS .MTAPE TO JOB DEVICE +;** HAVE AN IGNORE ERRORS SWITCH +;** THIS HORRIBLE BLETCHEROUS IOT CODE SHOULD BE REDESIGNED +;** +;******************************** + + +IFN TM10A,TM10B==0 +IFE TM10A,TM10B==1 +IFN TM10A,INFORM IO BUSS MAG TAPE,1 +IFN TM10B,INFORM DATA CHANNEL MAG TAPE,1 +MSCBL==8 ; COMMAND BUFFER LENGTH +MGQDLL==6 ; INTERUPT LEVEL PDL +IF2 IFN MNUMB-140600, .ERR IMPLICIT DEPENDENCY ON MNUMB +MSEOFP==210100 ;HIGH BIT OF MNUMB IN MEMBLT IS EOF FLAG +MSCHN==140500 ;OTHER 5 BITS OF MNUMB IN MEMBLT IS DRIVE NUMBER + +MTXP==410300,, ;XPORT NUMBER +MUNITF==170300 ; UNIT FIELD IN MTC CONI +MNOPIN==10000 +MWRITE==4000 +MW3IN==14000 +MSPRR==7000 +MREAD==2000 +MSPFR==6000 +MSPFF==16000 +MSPRF==17000 +MREWND==1000 +MRWNDD==11000 +MWEOF==5000 +MGNRTY==10. ;NUMBER OF READ RETRIES + +SUBTTL MAG TAPE OPEN ROUTINE + +; C/ MODE,,DEV +; D/ MODE (ROT 1) 4.9=1=>OUTPUT +; I/ DEVICE NUMBER +; R/ IOCHNM WORD POINTER + +MAGTO: SKIPL W,I ; GET DEVICE + CAIL W,NMTCS ; TO BIG? + JRST OPNL1 ; NO SUCH DEVICE + MOVSI T,%MAREW + TDNE T,MSRAC(W) ; REWINDING + PUSHJ P,UFLS ; YES, THEN WAIT + CONO PI,CLKOFF ; DON'T WANT STATUS CHANGED FROM UNDER ME + SKIPGE MTUSE(W) ; CHECK FOR FIRST USER + JRST MAGTU1 ; FIRST + CAME U,MTUSR(W) ;SAME USER + JRST OPNL10 ; DIFFERENT USER IS ERROR + MOVE B,D + EQV B,MSCRW(W) + SKIPL B ; CHECK FOR SECOND OPEN IN SAME DIRECTION + JRST OPNL2 ; WRONG DIRECTION +MAGTU: MOVEM U,MTUSR(W) ; STORE USER + SETZM MSCRW(W) ; INDICATE READ UNTIL FOUND TO BE OTHERWISE + TLNE C,1 ; READ OR WRITE + SETOM MSCRW(W) ;INDICATE WRITE + AOS MTUSE(W) ;INDICATE 1 MORE USER + PUSHJ P,SOSSET + MTUSE(W) ; SOS IF PCLSRED + CONO PI,CLKON ; LET UM GET ME + PUSHJ P,MTSTAT ; GET CONIS OF 340 AND 344 IN I AND J + MOVE A,MSRAC(W) + TLNE A,%MAERR ; PI ERROR MEANS DEVICE NOT THERE + JRST MTOL1 + TRNN J,200040 + JRST OPNL7 ; DEVICE NOT ONLINE + SKIPN MSCRW(W) ;WRITING? + JRST MTOW1 + TRNE J,10 ; AND WRITE LOCKED + JRST OPNL26 ; DEVICE WRITELOCKED + SKIPE MSRAC(W) ; WRITING + TRNN J,4000 ;EOT? + JRST MTOW1 ; NO + MOVSI A,%MAETW+%MAERR ; IF WRITE AND EOT,MAKE .IOT GIVE IOC ERROR BUT LET OPEN WIN + IORM A,MSRAC(W) +MTOW1: TRNN J,400000 ; XPORT HUNG + JRST MTOW2 ; OK + TRNN J,20000 ; OK IF REWINDING + JRST OPNL7 ;DEVICE NOT WORKING +MTOW2: TLNN C,400 ; GET CORE DUMP MODE + JRST MTOW3 + TLNN C,300 + JRST MTOW3 + TLC C,300 + TLCE C,300 ; IBM AND DENSITY 800 BPI OK + JRST OPNL12 ; MODE NOT AVAILABLE +MTOW3: ;BY THIS POINT OPEN WILL WIN + PUSHJ P,LSWDEL ; RELEASE MTUSE SWITCH + MOVEI A,MTCCHN_3 ;SET UP MAG TAPE CONO +IFN TM10A, TRO A,1 ; DATA PI CHANNEL + LDB B,[300200,,C] ; GET DENSITY FROM OPEN + SKIPN B + MOVEI B,3 + SUBI B,1 ; CONVERT TO PROPER PARITY + DPB B,[060200,,A] + TLNN C,400 ; CORE DUMP + TRO A,20000 ; YES + TLNN C,40 ; PARITY CHECK + TRO A,40000 ; SET ODD PARITY + DPB W,[170300,,A] ; SET UNIT NUMBER + MOVEM A,MTCONO(W) ; STORE IT + LDB B,[330300,,C] ; GET WORDS PER BLOCK + TRC B,7 + MOVEI A,10 + LSH A,(B) ;NUMBER OF WORDS PER RECORD + MOVEM A,MTBLKS(W) ;BLOCKSIZE + LDB A,[230200,,C] ; GET MODE (BUT NOT READ/WRITE BIT) + HLR C,MTOPTB(A) ; GET INPUT DISPATCH + TLNE D,400000 ; OPEN FOR OUTPUT? + HRR C,MTOPTB(A);CHANGE TO OUTPUT IF SO + MOVEM C,(R) ;STORE IN IOCHNM + DPB W,[MTXP(R)] ; STORE XPORT NUMBER + JRST POPJ1 ; SKIP RETURN + +MTOPTB: MTUAIX,,MTUAOX + MTBIX,,MTBOX + MTUIIX,,MTUIOX + MTBIX,,MTBOX + +MAGTU1: SETZM MSBUFP(W) ; INDICATE NO BUFFERS ON CHAIN + SETZM MSNBOL(W) ; ANOTHER WAY OF SAYING ABOVE + SETZM MSMPRC(W) ; BUFFER WORDS REMAINING + SETZM MSMPRP(W) ; POINTER TO BUFFERS + SETOM MTMDN(W) ;NO BUFFER AT MP + SETOM MGCABN(W) ;NONE AT PI + SETZM MSRAC(W) + MOVEI A,2 + MOVEM A,MTCEFW(W) ; NUMBER OF EOF'S WRITTEN + MOVSI A,%MANWT + IORM A,MSRAC(W) ; INDICATE NOTHING WRITTEN ON TAPE + JRST MAGTU + +MTOL1: SETZM MSRAC(W) + JRST OPNL1 + +SUBTTL MAG TAPE INPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAI: MOVEI B,CHRKTI ;UNIT ASCII INPUT + MOVE E,[440700,,5] + JRST MTREAD + + SKIPA B,[SIOKT] +MTUII: MOVEI B,CHRKTI ;UNIT IMAGE + MOVE E,[444400,,1] + JRST MTREAD + +MTBI: MOVE E,[444400,,1] ;BLOCK INPUT + MOVEI B,BLKT +MTREAD: LDB W,[MTXP(R)] ; W <= XPT # + PUSHJ P,MTIECK + MOVEM P,MTPSAV(W) ; SAVE P FOR EOF RETURN + JSP B,(B) ;BLKT,CHRKT,SIOKT + MSMPRP(W) ;LOC OF NEXT WORD + MSMPRC(W) ;COUNT REMAINING + SETZ MTRBG ; GET NEW BUFFER (SETZ FOR CHRKT RETURN ON EOF) + MTRBD ; DISCARD BUFFER + JRST 4,. + PUSHJ P,MTRBFW ; FLUSH INSTRUCTION WAIT FOR BUFFERS TO COME FROM PI + +;MAG TAPE READ BUFFER GET ROUTINE +; BUFFER ASSUMED TO HAVE COME IN FROM PI LEVEL. (I.E. MTRBFW WAS CALLED) + +MTRBG: SKIPG MSNBOL(W) ;ANY BUFFER AVAILABLE? + JRST MTRBG3 ;NO, MUST BE ERROR OR EOF + CONO PI,UTCOFF + HLRZ A,MSBUFP(W) ; GET IN POINTER + HRRZ TT,MSBUFP(W) ; GET OUT POINTER + MOVEM TT,MTMDN(W) ; STORE BUFFER ACTIVE AT MP + CAMN A,TT ;IN = OUT? + JRST MTRBG1 ; YES + LDB T,[MLO,,MEMBLT(TT)] ; BACK POINTER TO NEXT BLOCK + HRRM T,MSBUFP(W) ;STORE NEW OUT POINTER + JRST MTRBG2 + +MTRBG1: SETZM MSBUFP(W) ;EMPTY BUFFER LIST +MTRBG2: SOS MSNBOL(W) ; ONE LESS BUFFER ON LIST + CONO PI,UTCON + LDB J,[MWC,,MEMBLT(TT)] ;WORD COUNT OF BLOCK + MOVEM J,MTBLKS(W) ;SAVE FOR MTAPE 13 + LSH TT,10. ;MAKE BLOCK NUMBER AN ADDRESS + MOVEM TT,MSMPRP(W) + JRST SIOBGX + +MTRBG3: SKIPGE MSRAC(W) .SEE %MAEOF + JRST [ MOVSI T,%MAEFA ;THE EOF IS NOW NO LONGER READ-AHEAD + ANDCAM T,MSRAC(W) ;TELL THE USER ABOUT IT + JRST POPJ2 ] + PUSHJ P,MTIECK + JRST 4,. ;BULLSHIT, WHY DID MTRBFW SKIP? + +;MAG TAPE READ BUFFER DISCARD ROUTINE +MTRBD: SKIPGE A,MTMDN(W) ; ANY BUFFERS + JRST MOVTWJ ;SET UP T FOR BUFFER WAIT,RETURN + CONO PI,UTCOFF ; SHUT UP WORLD + SETOM MTMDN(W) ; NO BUFFER ACTIVE AT M.P. + SETZM MSMPRC(W) + LDB TT,[MSEOFP,,MEMBLT(A)] ;GET EOF FLAG FROM PI + PUSHJ P,MGMEMR ;RETURN MEM, TURN UTCON + JUMPN TT,MTRBD2 ;EOF? +MOVTWJ: MOVE T,W ; T NEEDS CHANNEL NUMBER FOR BUFFER WAIT UFLUSH + POPJ P, ;ALSO MTRBG, MTRBFW RELY ON THIS SETTING T + +MTRBD2: MOVSI A,%MAEOF ; SET EOF + IORM A,MSRAC(W) + JRST MOVTWJ + +;MAG TAPE READ WAIT FOR DATA ROUTINE +MTRBFW: SKIPG MSNBOL(T) ; ANY FREE BUFFERS ON LIST? + SKIPGE MSRAC(T) .SEE %MAEOF + JRST POPJ1 ;INPUT AVAILABLE, OR AT EOF, UNHANG + MOVE TT,MSRAC(T) + TLNE TT,%MAERR ; CHECK FOR ERRORS + JRST POPJ1 ;WAKE UP SO YOU CAN GET YOUR IOC ERROR + TLNE TT,%MARAC ; IF NOT ALREADY DONE SO, SEND OUT A CALL FOR TAPE READ + POPJ P, + PUSH P,W ;THIS BEING DONE UNDER A UFLS. ONLY T GOOD + PUSH P,B + MOVE W,T + MOVEI B,MGREAD ;WHERE TO GO AT PI LEVEL + MOVEI T,MSCBL ;MAKE SURE THAT THERE IS ROOM IN THE RING BUFFER + CAMG T,MSCMDC(W) + JRST MTRBW2 ; NO ROOM, GO AWAY + MOVSI TT,%MARAC + IORM TT,MSRAC(W) ;READ IS ACTIVE NOW, OR WILL BE SHORTLY + PUSHJ P,MTCMD1 +MTRBW2: MOVE T,W + POP P,B + POP P,W + POPJ P, + +SUBTTL MAG TAPE OUTPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAO: MOVEI B,CHRKT ;UNIT ASCII OUTPUT + MOVE E,[440700,,5] + JRST MTWRIT + + SKIPA B,[SIOKT] +MTUIO: MOVEI B,CHRKT ;UNIT IMAGE OUTPUT + MOVE E,[444400,,1] + JRST MTWRIT + +MTBO: MOVE E,[444400,,1] ; BLOCK OUT + MOVEI B,BLKT +MTWRIT: LDB W,[MTXP(R)] ; GET XPORT NUMBER + PUSHJ P,MTIECK + HRLZI A,%MAETW ; END OF TAPE CHECK + TDNE A,MSRAC(W) + JRST IOCER9 + JSP B,(B) + SETZ MSMPRP(W) ;LOC OF WORD + MSMPRC(W) ; COUNT + SETZ MTWBFG ; GET NEW BUFFER + MTWBFD ; WRITE OUT BUFFERS + JRST 4,. + TRNA ;NO WAIT FOR BUFFER + +;MAG TAPE WRITE BUFFER GET ROUTINE + +MTWBFG: PUSHJ P,MTIECK + PUSHJ P,TCALL ; TURN OFF UTC + JRST IOMQ + POPJ P, ;GO BACK NO SKIP IF NO CORE + MOVEM A,MTMDN(W) ; STORE ACTIVE BUFFER NUMBER + MOVEI T,MUMGB + DPB T,[MUR,,MEMBLT(A)] ; TELL WORLD THAT IT IS A MAG TAPE BUFFER + DPB W,[MSCHN,,MEMBLT(A)] ; CHANNEL NUMBER + SETZM TT + DPB A,[121000,,TT] ;CONVERT BLOCK NUMBER TO ADDRESS IN TT + MOVE J,MTBLKS(W) ;GET WRITE BLOCK SIZE + JRST SIOBGX + +;MAG TAPE WRITE BUFFER DISCARD ROUTINE + +MTWBFD: PUSHJ P,MTIECK + SKIPGE A,MTMDN(W) + POPJ P, + MOVEI T,MSCBL + CAMG T,MSCMDC(W) + PUSHJ P,UFLS ; MAKE SURE ROOM IN COMMAND BUFFER EXISTS IN CASE OF PCLSRING + MOVE T,MTBLKS(W) ; DISCARD BUFFER. FIRST SEE HOW BIG IT IS + SUB T,MSMPRC(W) + CONO PI,UTCOFF ;CAN'T TOLERATE ANY HANKY PANKY + SETOM MTMDN(W) ;CLEAR IT + SETZM MSMPRC(W) ; CLEAR COUNT + JUMPE T,MEMR ; DON'T DO ANYTHING BUT RETURN BLOCK IF NO WORDS + DPB T,[MWC,,MEMBLT(A)] ; STORE WORD COUNT + SKIPG MSNBOL(W) ; LIST STARTED YET? + JRST MTWBD1 ;NO + HLRZ TT,MSBUFP(W) ; GET OLD IN POINTER + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN BACK + SKIPA +MTWBD1: HRRM A,MSBUFP(W) ; START NEW LIST + HRLM A,MSBUFP(W) ; IN = OUT = (A) +MTWBD2: SETZM TT + DPB TT,[MLO,,MEMBLT(A)] ; INDICATE END OF LIST + AOS MSNBOL(W) ; ONE MORE BUFFER ON LIST + CONO PI,UTCON + PUSH P,B + MOVEI B,MGWRIT + PUSHJ P,MTCMD + MOVSI B,%MANWT + ANDCAM B,MSRAC(W) + SETZM MTCEFW(W) ; INDICATE SOMETHING WRITTEN + JRST POPBJ ; RETURN + +SUBTTL MTCMD - GIVE COMMAND TO PI LEVEL + +;PUSHJ P,MTCMD + ;RH(W) HAS XPORT NUMBER + ;RH(B) HAS ADDR OF INTERUPT ROUTINE + +MTCMD: MOVEI T,MSCBL ; COMAND BUFFER LENGTH + CAMG T,MSCMDC(W) ;COMAND COUNT + PUSHJ P,UFLS ; WAIT FOR ROOM +MTCMD1: MOVE T,MTCMBP(W) ; GET POINTER TO RING BUFFER + AOBJN T,.+2 + SUB T,[MSCBL,,MSCBL] ; REACHED END OF BUFFER, RING IT + MOVEM B,(T) ; STORE COMMAND + MOVEM T,MTCMBP(W) ; STORE NEW POINTER + CONO PI,UTCOFF + AOS MSCMDC(W) ; INDICATE ONE MORE COMMAND + JRST MSTRTR ; START UP PI ROUTINE + +SUBTTL MTIECK - CHECK FOR IOC ERROR + +MTIECK: PUSH P,A ; CHECK FOR IOTERR + MOVE A,MSRAC(W) + TLNN A,%MAERR ; ERROR AT PI? + JRST POPAJ + SKIPLE MSCMDC(W) + PUSHJ P,UFLS ; LET PI CLEAR BEFORE MUNGING BUFFERS + SKIPL A,MTMDN(W) + PUSHJ P,MEMR + SETOM MTMDN(W) + SETZM MSMPRP(W) + SETZM MSMPRP(W) + PUSHJ P,MTCBFF ; FREE CHAIN + POP P,A + MOVE T,MGCMTS(W) ; GET CONI MTS, + TRNE T,440000 ; XPT HUNG,ILLOP + JRST IOCER1 + TRNE T,23600 ; PAR ERROR,R/C, RLI,DL,BT + JRST IOCER3 ; IRRECORVERABLE DATA ERROR + TRNE T,4000 ; EOT + JRST IOCER9 ; EOT, DEV FULL + MOVE A,MGEOFR(W) ; LOGICAL EOT + CAIL A,2 + JRST IOCER9 + JRST IOCER3 ; UNKNOWN, GIVE IRR DATA + +SUBTTL MAG TAPE .STATUS ROUTINE + +STAMTC: LDB W,[MTXP(R)] ; LOAD W + DPB A,[60300,,D] ; OPEN MODE + PUSHJ P,MTSTAT + LDB A,[.BP %MAETW_22,MSRAC(W)] ; EOT ON WRITE + LDB B,[.BP %MAETR_22,MSRAC(W)] ; EOT ON READ + IOR A,B + DPB B,[140100,,D] ;EOT + LDB A,[20100,,J] + TRC A,1 + DPB A,[150100,,D] ; 7 OR 9 + LDB A,[160100,,MTCONO(W)] + TRC A,1 + DPB A,[200100,,D] ;PARITY + LDB A,[60200,,MTCONO(W)] ; DENSITY + ADDI A,1 + CAIN A,3 + SETZM A ; 800 IS 00 + DPB A,[160200,,D] + LDB A,[.BP %MARCE_22,MSRAC(W)] ; READ COMPARE ERROR + DPB A,[130100,,D] + MOVE A,MTCONO(W) + TRNN J,4 ; 7 TRACK + TRNE A,20000 ; OR CORE DUMP + POPJ P, ; THEN DONE + TRO D,140000 ; IBM, 9 TRACK AND 800 BPI + POPJ P, + + +;RCHST ROUTINE FOR MAG TAPE + +RCHMGT: HLRZ E,(R) ;OPEN-MODE IS KEPT IN LH OF IOCHNM WORD - HOW CONVENIENT! + LDB J,[MTXP(R)] ;GET THE MAG TAPE DRIVE NUMBER + MOVSI J,'MT0(J) ;RETURN THAT DRIVE'S DEVICE NAME. + TRZ E,(.BM MTXP) ;CLEAR THE PLACE IN THE OPEN-MODE THAT HAS THE DRIVE #. + JRST POPJ1 ;SKIP SO THAT J OVERRIDES BUILT-IN DEVICE NAME. + + EBLK + +SUBTTL MAG TAPE STORAGE AREA + +MGVTC: 0 ; 1 SCRATCH WORD FOR VIRGIN TAPE CHECK +MGRWCD: BLOCK NMTCS ; REWIND COMMAND +MGEOTT: BLOCK NMTCS ; TIMEOUT FOR VIRGIN TAPE +MGJDTI: 0 ; WAIT FOR JOB DONE TIME OUT +MGEOFR: BLOCK NMTCS ; NUMBER OF EOFS SINCE LAST READ +MGNWRD: 0 ; NUMBER OF WORDS READ IN A PI LEVEL READ +MTPSAV: BLOCK NMTCS ; STORAGE TO RESTORE P ON EOF +MSRAC: BLOCK NMTCS ; MAG TAPE GENERAL GARBAGE + %MA==1,,525252 + %MAEOF==400000 ; 4.9 EOF ON READ + %MAETR==200000 ; 4.8 EOT ON INTERNAL READ + %MAETW==100000 ; 4.7 EOT ON WRITE + %MAERR==040000 ; 4.6 PI ERROR + %MARCE==020000 ; 4.5 READ COMPARE ERROR + %MACTH==014000 ; 4.4 CORE ALLOCATOR SAYS STOP + ; 4.3 " (WHY 2 BITS?) + %MASTP==002000 ; 4.2 STOP READ AHEAD + %MANWT==001000 ; 4.1 NOTHING WRITTEN ON TAPE YET + %MAEFA==000400 ; 3.9 EOF SEEN ON READ-AHEAD, USER HASN'T SEEN YET + %MAESO==000200 ; 3.8 EOF READ SINCE OPEN + %MAMSO==000100 ; 3.7 TAPE MOVED SINCE FIRST OPEN + %MAREW==000040 ; 3.6 REWINDING FLAG + %MARAC==000020 ; 3.5 READ ACTIVE FLAG +MGTBZY: -1 ; FLAG TO GET INTURPT STARTED +MTCONO: REPEAT NMTCS,\.RPCNT_17+20 ; MAIN CONO STORAGE +MGUNIT: -1 ; UNIT EXPECTING INTERUPT +MGCMTS: BLOCK NMTCS ; PI CONI MTS STORAGE +MGCMTC: BLOCK NMTCS ; PI MTC STORAGE +MGWCW: 0 ; WAIT FOR CONTROL WORD WRITTEN FLAG +LMIOWD: 0 ; LAST MIOWD +MGERRC: BLOCK NMTCS ; ERROR COUNT +MTMFNC: BLOCK NMTCS ; .MTAPE FUNCTION STORAGE +MTMCNT: BLOCK NMTCS ; .MTAPE COUNT +MTMTAP: BLOCK NMTCS ; MTAPE CALL WORD +MTCEFW: BLOCK NMTCS ; NUMBER OF EOF'S WRITTEN AT CLOSE +MSCMDC: REPEAT NMTCS,0 ; NUMBER OF COMMANDS +MSBUFP: REPEAT NMTCS,0 ; MAG TAPE BUFFER POINTER IN,,OUT +MSCRW: BLOCK NMTCS ; -1=>OUTPUT 0=>INPUT +MSMPRC: BLOCK NMTCS ; WORDS LEFT IN BUFFER +MSMPRP: BLOCK NMTCS ;NEXT WORD IN BUFFER +MTMDN: REPEAT NMTCS,-1 ; BLOCK ACTIVE AT MP +MTUSE: REPEAT NMTCS,-1 ; NUMBER OF CHANNELS OPEN ON THIS MTAPE +MTUSR: REPEAT NMTCS,-1 ; USER INDEX OF XPORT +MSNBOL: BLOCK NMTCS ; NUMBER OF BUFFERS ON LIST +MGCABN: REPEAT NMTCS,-1 ; BUFFER ACTIVE AT PI LEVEL +MTBLKS: BLOCK NMTCS ; WRITE, BUFFER SIZE + ; READ, SIZE OF LAST RECORD READ +MGQDLP: REPEAT NMTCS,-MGQDLL,,CONC MGQD,\.RPCNT,-1 ;QDL POINTER +REPEAT NMTCS,[ + CONC MSCB,\.RPCNT,: BLOCK MSCBL ; COMMAND BUFFER + MGRCV ; TO RING BUFFER + + MGNCMD ; GET NEW COMMAND + CONC MGQD,\.RPCNT,: BLOCK MGQDLL + IFE .RPCNT,MSLCTB==.-MSCB0 ; LENGTH OF EACH TABLE +] +MTCMBP: REPEAT NMTCS,-MSCBL-1,,CONC MSCB,\.RPCNT,-1 ; INPUT TO COMMAND TABLE +MGCMBP: REPEAT NMTCS,4400,,CONC MSCB,\.RPCNT,-1 ; OUTPUT FROM COMAND TABLE +IFE KL10P,MIOWD: BLOCK 2 ; CHANNEL PROGRAM +IFN TM10A,[ +MGDBRK: 0 + CONO MTS,1 + JRST 12,@MGDBRK +];TM10A +MGEMTC: 0 ;CONI MTC, AT LAST ERROR +MGEMTS: 0 ;CONI MTS, AT LAST ERROR +BBLK + +SUBTTL MAG TAPE PI LEVEL + +;ROUTINES TO GET INTERUPT ROUTINES STARTED +MGXGO: MOVE Q,MGQDLP(W) ;GET QDLPOINTER + PUSHJ P,QPOPJ ;CALL ROUTINE . SHOULD FINISH WITH POPJ P,OR PUSHJ Q,CPOPJ + ;PUSHJ Q,CPOPJ IF ROUTINE WANTS TO RETURN + ;POPJ P, IF AT END OF COMAND. AND NEW IS TO BE GOTTEN + MOVEM Q,MGQDLP(W) ; STORE NEW QDL + POPJ P, + +MGRCV: MOVNI A,MSCBL+1 ;AT END OF COMAND LIST,RING IT + ADDM A,MGCMBP(W) ;RING THE BUFFER +MGNCM1: ILDB B,MGCMBP(W) ; GET NEW COMMAND + JRST (B) + +MGNCMD: AOBJN Q,MGNCM1 ; AT BOTTOM OF QDL, SIMULATE PUSHJ AND GET NEW COMMAND + JRST 4,. ;QDL POINTER CLOBBERED + +QPOPJ1: AOS (Q) +QPOPJ: POPJ Q, + +MSTRTR: CONO PI,UTCOFF ; GET MAGTAPE INTURPT STARTED + SETZM MGTBZY + CONO PI,MTCRQ + CONO PI,UTCON + POPJ P, + +;HERE FOR MAG TAPE FLAG CHANNEL INTERUPT +MGHBRK: SKIPGE W,MGUNIT ; LOAD UNIT + JRST MGUBRK ;NO ONE WANTS IT + LDB B,[MUNITF,,A] + CAME W,B ; UNITS AGREE + JRST 4,. ; WE MUST NOT MIX UNITS + MOVE J,C + PUSH P,[DSKEX] +IFN TM10B,[ + TLNE C,160 + JRST MGERR +];TM10B + TRNE C,40000 + JRST MGERR + JRST MGXGO + +MGSBRK: SETOM MGTBZY ;HERE FOR ANY RANDOM MP PI STARTUP + MOVEI B,NMTCS-1 + SKIPG MSCMDC(B) ;ANY COMMANDS IN BUFFER +MGSBK1: SOJGE B,.-1 + SKIPGE B ;LAST UNIT? + JRST DSKEX ; THEN GOTO DSKEX + MOVE W,B + PUSH P,B + MOVSI B,%MACTH + TDNN B,MSRAC(W) ; CORE ALLOCATOR SAYING GO AWAY + PUSHJ P,MGXGO ; START UP THAT ROUTINE + POP P,B + JRST MGSBK1 ; ANY MORE? + +MGUBRK: LDB W,[MUNITF,,A] ; WHO CAUSED INTERUPT? + MOVE B,MTCONO(W) + CONO MTC,(B) + CONO MTS,31 ; CLEAR INTERUPT + JRST DSKEX + +; ROUTINE TO WAIT FOR JOB DONE TO SET +MGWTJD: CONI MTS,J + TRNE J,440000 ;SKIP IF STARTED SUCCESSFULLY + JRST MGERR ;JOB-DONE ISN'T EVER GOING TO SET +MGWJD1: CONI MTS,J + SKIPN MGJDTI ; TIME OUT? + JRST MGWJD2 + MOVE T,TIME + CAML T,MGJDTI + JRST MGERR +MGWJD2: TRNN J,100 ; JOB DONE? + JRST MGOVER ; NOT SET + CONI MTS,J + CONI MTC,I ; GET CONI MTC + MOVEM J,MGCMTS(W) + MOVEM I,MGCMTC(W) + SKIPE MGWCW ; SHOULD I WAIT FOR CONTROL WORD WRITTEN + PUSHJ Q,MGWCWC ; CHECK TO SEE IF IT IS WRITTEN + SETZM MGWCW ;CLEAR FLAG + CONO MTS,30 ; CLEAR CHANNEL CONDITIONS + MOVE B,MTCONO(W) + CONO MTC,(B) ; RELESE MTC, CLEAR JOB DONE +IFN TM10B,[ + TLNE J,160 + POPJ Q, ;CHANNEL ERROR +] + TRNE J,463600 + POPJ Q, ; RANDOM OTHER NON PERFECTIONS, NOT NECESSARILY ERRORS + JRST QPOPJ1 ; SUCCESS + +; GET XPORT +MGGXPT: CONSO MTS,2 ; LOAD NEXT UNIT SET? + JRST MGOVER ; NO, WAIT FOR IT + MOVEM W,MGUNIT + MOVE T,TIME + ADDI T,10.*30. ; TIME OUT IN 10. SECONDS + MOVEM T,MGJDTI + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ; SELECT DRIVE + PUSHJ Q,MGWJD1 + JFCL ; WAIT FOR JOB DONE, BUT ALLOW ANY ERRORS + SETZM MGJDTI + POPJ Q, + +MGOVER: CONSZ MTS,440020 ; ANY PROBLEMS? + JRST MGERR ;TAPE HUNG, ILL FUNCTION, CHANNEL ERROR + SOS (Q) + POPJ P, + +;ERROR +MGERR: CONI MTS,MGEMTS + CONI MTC,MGEMTC + MOVSI T,%MARAC ;READ NOT ACTIVE, FOR SURE + ANDCAM T,MSRAC(W) + SETZM MSCMDC(W) ; NO COMMANDS + SETOM MGUNIT ; CLEAR UNIT WAIT FLAG + SETZM MGJDTI +IFN TM10B,[ + TLNE J,160 ; CHANNEL ERROR? + BUG PAUSE,[MTAPE: CHANNEL ERROR, STATUS=],OCT,J,[MICWA+1=],OCT,MICWA+1,[MIOWD=],OCT,MIOWD +];TM10B + SKIPL A,MGCABN(W) ; ANY PI BUFFERS? + PUSHJ P,IMEMR + SETOM MGCABN(W) + HRLZI B,%MAERR ; PI ERROR + IORM B,MSRAC(W) ; STORE IN STATUS WORD + MOVE Q,[-MGQDLL,,MGQD0-1] + MOVE T,MSLCTB + IMUL T,W + ADD Q,T ; RESTORE Q + PUSH P,Q + MOVE Q,[-MSCBL-1,,MSCB0-1] + ADD Q,T + MOVEM Q,MTCMBP(W) ; INITIALIZE MP AND PI COMMND POINTERS + MOVE Q,[4400,,MSCB0-1] + ADD Q,T + MOVEM Q,MGCMBP(W) + MOVSI B,%MAREW + ANDCAM B,MSRAC(W) ; CLEAR REWINDING + SKIPN MSCRW(W) ; DONE IF READING + JRST POPQJ + SKIPN MSNBOL(W) ; ANY BUFFERS ON LIST? + JRST POPQJ +MGERR1: HRRZ A,MSBUFP(W) + PUSHJ P,MTICL1 + PUSHJ P,IMEMR + SOSLE MSNBOL(W) ; ANY MORE + JRST MGERR1 + SETZM MSBUFP(W) ;EMPTY LIST + JRST POPQJ + +MGWCWC: +IFN TM10B,[ + SKIPE MICWA+1 ; CONTROL WORD WRITTEN? + POPJ Q, + CONO MTS,4 ; TELL IT TO WRITE IT +MGWCW1: SKIPE MICWA+1 + JRST MGWCW2 ; DONE + PUSHJ Q,CPOPJ ; WAIT + JRST MGWCW1 + +MGWCW2: MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) ;RESTORE STATUS + TLO J,10 ;SET CONTROL WORD WRITTEN +] ;END OF IFN TM10B + POPJ Q, + +IFN TM10A,[ +MGDCSI: SKIPA A,[BLKI MTC,MIOWD] +MGDCSO: MOVE A,[BLKO MTC,MIOWD] + MOVEM A,MAGLOC + MOVE A,[JSR MGDBRK] + MOVEM A,MAGLOC+1 + POPJ Q, +] ;END OF IFN TM10A + +SUBTTL MAG TAPE PI LEVEL WRITE + +MGWRIT: PUSHJ Q,MGGXPT ; GET XPORT + TRNE J,600010 ; WRITE LOCKED,HUNG OR REWINDING + JRST MGERR + MOVEM W,MGUNIT ; SET UNIT + MOVSI A,%MACTH ; CORE ALLOC WANT QUIT TEMPORARLY + TDNE A,MSRAC(W) + JRST MGWRT4 + HRRZ A,MSBUFP(W) ; GET BUFFER POINTER + HLRZ B,MSBUFP(W) ; IN POINTER + SOS MSNBOL(W) ; ONE LESS BUFFER + MOVEM A,MGCABN(W) ; BUFFER ACTIVE AT PI + SKIPN MSCRW(W) ; WRITING + JRST 4,. + CAME A,B ; IN = OUT + JRST MGWRT1 + SETZM MSBUFP(W) ; EMPTY BUFFER LIST + JRST MGWRT2 + +MGWRT1: LDB B,[MLO,,MEMBLT(A)] ; BACK POINTER + HRRM B,MSBUFP(W) ; NEW OUT POINTER +MGWRT2: LDB B,[MWC,,MEMBLT(A)] ; WORD COUNT + MOVNS B ; NEGATE + HRLZS B ; FORM COUNT +IFN KL10P, LSH B,4 ; SHIFT IF KL10 DATA CHANNEL +IFN KL10P, MOVE R,A ; SAVE CORE PAGE NUMBER FOR CACHE SWEEP + LSH A,10. ; FORM WORD POINTER + SUBI A,1 + HRRM A,B ; CHANNEL POINTER IN B +IFN TM10B, DATAO MTS,[MICWA] ; SET TO GO TO MAG TAPE +IFN TM10A, PUSHJ Q,MGDCSO + MOVEM B,MIOWD + MOVEM B,LMIOWD ; LAST MIOWD + SETZM MIOWD+1 ; TELL CHANNEL TO STOP +IFN KL10P,[ + PUSHJ P,CSHSWP ; UNLOAD BUFFER FROM CACHE INTO CORE + CAI +] + MOVE B,MTCONO(W) + CONO MTC,MWRITE(B) ; DO IT + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGWBT ; WRITE BLANK TAPE AND TRY AGAIN +MGWRT3: MOVE A,MGCABN(W) ; GET BUFFER NUMBER + HRLZI B,%MAETW+%MAERR ; END OF TAPE CHECK + TRNE J,4000 ; END POINT + IORM B,MSRAC(W) ; TELL MP + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MUMGB ; DO I OWN BLOCK + JRST 4,. + SETOM MGCABN(W) ; NO BUFFER ACTIVE AT PI + PUSHJ P,IMEMR ; GIVE BACK BUFFER + MOVSI A,%MAMSO + IORM A,MSRAC(W) ; TAPE MOVEMENT + JRST MGCMDR + +MGWBT: +IFN TM10B, SETZM MIOWD ; WRITE BLANK TAPE OVER POSSIBLE BAD SPOT +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] + TRNE J,644010 ; BAD TYPES OF ERRORS + JRST MGERR + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ; REVERSE 1 RECORD + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGERR ; ERROR + MOVE B,LMIOWD + MOVEM B,MIOWD ; RESTORE MIOWD + MOVE B,MTCONO(W) + CONO MTC,14000(B) ; WRITE WITH EXTENDED EOR + PUSHJ Q,MGWTJD ; WAIT + JRST MGWBT ; INFINITE RETRIES ; JRST MGERR ; ERRORS + JRST MGWRT3 + +MGWRT4: PUSHJ Q,CPOPJ ; WAIT A WHILE + JRST MGWRIT + +SUBTTL MAG TAPE PI LEVEL READ + +MGREAD: PUSHJ Q,MGGXPT ; GET XPORT +MGRD0: TRNE J,600000 ; UNIT HUNG OR REWINDING OR EOT + JRST MGERR + MOVE B,MGEOFR(W) ; EOF'S READ + CAIL B,2 + JRST MGERR + MOVEM W,MGUNIT ; STORE UNIT NUMBER + SKIPE MSCRW(W) ; MAKE SURE READING + JRST 4,. + MOVSI B,%MACTH ; CORE ALLOCATOR WANT OUT + TDNN B,MSRAC(W) + PUSHJ P,IOMQ + JRST MGROVR ; WAIT FOR IT + MOVEM A,MGCABN(W) ; STORE ACTIVE BUFFER AT PI LEVEL + MOVEI B,MUMGB + DPB B,[MUR,,MEMBLT(A)] ; CLAIM BLOCK + HRREI B,-MGNRTY ; NUMBER OF RETRIES + MOVEM B,MGERRC(W) ; STORE ERROR COUNT +IFN KL10P, MOVE R,A + LSH A,10. ; FORM ADDRESS + SUBI A,1 +IFE KL10P, HRLI B,-2000 +IFN KL10P, HRLI B,-2000_4 + HRR B,A + MOVEM B,LMIOWD ; STORE LAST IOWD FOR RETRY +IFN TM10B, DATAO MTS,[MICWA] ; SET CHANNEL STARTING ADDRESS +IFN TM10A, PUSHJ Q,MGDCSI +IFN TM10B, SETZM MICWA+1 + SETZM MIOWD+1 +MGRD1: MOVEM B,MIOWD ; CHANNEL COMMAND + MOVEI B,2000 + MOVEM B,MGNWRD ; ASSUME AT FIRST THAT THE RECORD TO BE READ HAS 2000 WORDS +IFN KL10P,[ + PUSHJ P,CSHSWP ; ENSURE NO RESIDUE OF THIS PAGE IN CACHE + CAIA +] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ; DO IT +IFN TM10B, SETOM MGWCW ; TELL IT TO WAIT FOR CONTROL WORD WRITTEN + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGRERR +MGRD2: SKIPG A,MGCABN(W) + BUG ;BUFFER SHOULDN'T BE -1, WOULD SCREW UP MEMBLT + SETOM MGCABN(W) ; NO BUFFER ACTIVE AT PI + HLRZ T,MSBUFP(W) ;LAST BUFFER IN + SETZM B + DPB B,[MLO,,MEMBLT(A)] ; BACK POINTER IS 0 + SKIPG MSNBOL(W) + HRRM A,MSBUFP(W) ; ONE BUFFER MEANS IN = OUT + HRLM A,MSBUFP(W) ; NEW IN POINTER + SKIPLE MSNBOL(W) + DPB A,[MLO,,MEMBLT(T)] ; CHAIN BACK BUFFERS + AOS C,MSNBOL(W) ; ONE MORE BUFFER ON LIST (COUNT TO C) + MOVE B,MGNWRD + DPB B,[MWC,,MEMBLT(A)] ; NUMBER OF WORDS IN BUFFER + TRNE J,10000 ;EOF? + JRST [ MOVSI B,%MAESO+%MAEFA ;YES + IORM B,MSRAC(W) + SETO B, + DPB B,[MSEOFP,,MEMBLT(A)] + AOS A,MGEOFR(W) + CAIL A,2 + JRST MGRD4 ; LOGICAL EOT, SPACE BACK OVER IT + JRST .+2 ] + SETZM MGEOFR(W) ; NO EOF + MOVSI A,%MAMSO + IORB A,MSRAC(W) ; TAPE MOVEMENT + TRNE J,4000 ; EOT? + JRST MGRD3 + TRNN J,10000 ;IF NO EOF, NOT 6 BUFFERS YET, + CAIL C,6 + JRST MGRD5 + TLNN A,%MASTP + JRST MGRD0 ; AND NO REQUEST TO STOP, KEEP READING +MGRD5: MOVSI A,%MASTP+%MARAC ;GIVE UP FOR NOW, CLEAR READ ACTIVE + ANDCAM A,MSRAC(W) + JRST MGCMDR ;MP LEVEL WILL SEND NEW READ COMMAND WHEN READY + +MGRD3: DPB B,[MSEOFP,,MEMBLT(A)] ;PHYSICAL EOT + DPB B,[420100,,MSRAC(W)] .SEE %MAETR ; INDICATE EOT ON READ + JRST MGRD5 ; RETURN + +MGRD4: MOVSI A,%MAESO+%MARAC+%MASTP ;SECOND EOF, LOGICAL EOT + ANDCAM A,MSRAC(W) + JRST MGSPRF + +MGRERR: +IFN TM10B,[ + TLNE J,160 + JRST MGERR ; CHANNEL ERROR +] + TRNE J,642000 + JRST MGERR + TRNE J,20600 + JRST MGMRT ; DATA TYPE OF ERROR OR OVERRUN, MAYBE TRY AGAIN +;RECORD LENGTH ERROR, ADJUST MGNWRD +IFN TM10B, HRRZ A,MICWA+1 +IFN TM10A, HRRZ A,MIOWD + HRRZ B,LMIOWD + SUB A,B +IFN TM10B, SOS A ; CHANNEL FUNNYNESS + CAIN A,1 ; POS EOF IS ALL + JRST MGRER2 +MGRER1: MOVEM A,MGNWRD + JRST MGRD2 + +MGRER2: TRNE J,14000 ; 1 WORD, EOF? EOT? + SETZM A ; YES, THIS RECORD HAS ZERO LENGTH, IT JUST CARRIES MSEOFP + JRST MGRER1 + +MGMRT: AOSL MGERRC(W) + JRST MGERR ; TOO MANY ERRORS +IFN TM10B, SETZM MIOWD +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ; REVERSE RECORD + PUSHJ Q,MGWTJD + JRST MGERR ; NO ERRORS ALLOWED +IFN TM10A, PUSHJ Q,MGDCSI ; PUT BACK PI 1 BLKI + MOVE B,LMIOWD + JRST MGRD1 ; TRY AGAIN + +MGROVR: PUSHJ Q,CPOPJ + JRST MGREAD + +SUBTTL MAG TAPE PI LEVEL SPACE + +MGSPCF: PUSHJ Q,MGGXPT ; GET XPORT SPACE FORWARD + TRNE J,600000 + JRST MGERR +MGSPC: MOVEM W,MGUNIT + MOVE B,MGRWCD(W) ; GET COMMAND + ADD B,MTCONO(W) +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + CONO MTC,(B) ; DO IT + PUSHJ Q,MGWTJD + JRST MGERR ; NO RETRIES + TRNN J,10000 ; EOF + SETZB B,MGEOFR(W) + TRNE J,10000 + AOS B,MGEOFR(W) + CAIL B,2 ;TOO MANY EOF'S + JRST MGSPRF +MGCMDR: SOS MSCMDC(W) ; GENERAL EXIT ROUTINE + SETOM MGUNIT + SKIPG MSCMDC(W) + POPJ P, ; NO MORE + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ; INTERUPT WHEN UNIT READY + MOVEM W,MGUNIT ; RESTORE UNIT NUMBER + PUSHJ Q,MGWTJD + JRST MGERR + SETOM MGUNIT + POPJ Q, ; MORE + +MGSPFR: MOVEI B,MSPFR ; SPACE FOR RECORD + MOVEM B,MGRWCD(W) + MOVSI B,%MAMSO + IORM B,MSRAC(W) ; TAPE MOVEMENT + JRST MGSPCF + +MGSPFF: MOVSI B,%MAESO + TDZE B,MSRAC(W) + JRST MGCMDR ; EOF ALREADY READ DURING THE READ + AOS MSCMDC(W) ;SO IT WILL RETURN + MOVEI B,MSPFR + MOVEM B,MGRWCD(W) + PUSHJ Q,MGSPCF + SKIPE MGEOFR(W) + JRST MGCMDR ; EOF READ ON SPACE RECORD. DONE + MOVEI B,MSPFF + MOVEM B,MGRWCD(W) + JRST MGSPCF + +MGSPRR: MOVEI B,MSPRR + MOVEM B,MGRWCD(W) + MOVSI B,%MAMSO + IORM B,MSRAC(W) + JRST MGSPCR + +MGSPCR: PUSHJ Q,MGGXPT ; SPACE REVERSE + TRNE J,600000 ; ERR + JRST MGERR + TRNE J,100000 ; BOT + JRST MGCMDR ; THEN DO NOTHING + MOVEM W,MGUNIT + MOVE B,MGRWCD(W) + ADD B,MTCONO(W) +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + CONO MTC,(B) + PUSHJ Q,MGWTJD + JRST MGERR + TRNE J,10000 + SOSGE MGEOFR(W) ; ONE LESS EOF + SETZM MGEOFR(W) + JRST MGCMDR + +MGSPRF: MOVEI B,MSPRF ; REVERSE FILE + MOVEM B,MGRWCD(W) + MOVSI A,%MAESO ; EOF READ IN FORWARD DIRECTION + TDNN A,MSRAC(W) + JRST MGSPCR + AOS MSCMDC(W) ; YES DO IT TWICE + PUSHJ Q,MGSPCR + MOVSI B,%MAESO + ANDCAM B,MSRAC(W) ; TURN OFF FLAG + JRST MGSPCR ; SECOND TIME + +MGRWD1: PUSHJ Q,MGGXPT ; REWIND + MOVEM W,MGUNIT + MOVE B,MGRWCD(W) ; GET COMMAND + ADD B,MTCONO(W) + CONO MTC,(B) + PUSHJ Q,MGWTJD ; WAIT + JRST MGERR + SETZM MGEOFR(W) + MOVSI A,%MAMSO + ANDCAM A,MSRAC(W) ;CLEAR TAPE MOTION +MGRWD2: TRNN J,200000 ; STILL REWINDING? + JRST MGRWD3 ; NO + PUSHJ Q,CPOPJ ; WAIT + CONI MTS,J + MOVEM J,MGCMTS(W) + JRST MGRWD2 + +MGRWD3: MOVE T,TIME ;WAIT 1 SECOND MORE + ADDI T,30. ;THIS IS AN ATTEMPT TO FIX A HARDWARE BUG + MOVEM T,MGJDTI +MGRWD4: MOVE T,TIME + CAML T,MGJDTI + JRST [ SETZM MGJDTI + POPJ Q, ] + PUSHJ Q,CPOPJ + JRST MGRWD4 + +MGRWND: MOVEI B,MREWND ; NORMAL REWIND + CAIA +MGRWDM: MOVEI B,MRWNDD ; REWIND AND DISMOUNT + MOVEM B,MGRWCD(W) + PUSHJ Q,MGRWD1 + MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) + JRST MGCMDR + +MGSEOT: PUSHJ Q,MGGXPT ; SKIP TO LOGICAL EOT + TRNE J,600000 + JRST MGERR + MOVEM W,MGUNIT + TRNE J,100000 ; BOT? + JRST MGVTCK ; VIRGIN TAPE CHECK +MGNVT: MOVE B,MTCONO(W) +IFN TM10A,[ + PUSHJ Q,MGDCSO + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] +IFN TM10B, SETZM MIOWD + CONO MTC,MSPRR(B) ; SPACE REVERSE FIRST + PUSHJ Q,MGWTJD ; WAIT + JRST MGERR + SETZM MGEOFR(W) + AOS MGEOFR(W) +MGEOT2: MOVE B,MTCONO(W) + CONO MTC,MSPFF(B) ; SKIP FORWARD FILE + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAETR ; EOT CHECK + TRNE J,4000 + IORM B,MSRAC(W) ; TELL MP + MOVE B,MTCONO(W) +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] +IFN TM10B, SETZM MIOWD + CONO MTC,MSPFR(B) ; SPACE FORWARD RECORD + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAETR ; EOT AGAIN + TRNE J,4000 + IORM B,MSRAC(W) ; TELL MP + TRNN J,10000 ; EOF ALSO? + JRST MGEOT2 ; NO, TRY AGAIN + MOVE B,MTCONO(W) ; YES, NOW GO BACK OVER LAST + CONO MTC,MSPRF(B) + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAEOF+%MAETR ; TELL MP,EOF + IORM B,MSRAC(W) + JRST MGCMDR + +MGVTCK: MOVE T,TIME + ADDI T,60. ; TWO SECOND TIME OUT + MOVEM T,MGEOTT(W) ; EOT TIME +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ; DO READ, WAIT EITHER FOR JOB DONE OR TIME OUT +MGVTC1: CONI MTS,J + MOVEM J,MGCMTS(W) + TRNE J,100 ; J D? + JRST MGNVT ; NOT VIRGIN TAPE + TRNE J,440000 + JRST MGERR ; ERRORS? + MOVE T,MGEOTT(W) + CAMG T,TIME ; TIME UP? + JRST MGVT ; YES + PUSHJ Q,CPOPJ ; WAIT + JRST MGVTC1 + +MGVT: MOVE B,MTCONO(W) + CONO MTS,31 + CONO MTC,MNOPIN(B) ; NO-OP WAIT FOR JOB DONE + PUSHJ Q,MGWTJD + JFCL ; SEE IF I CARE IF THERE ARE ERRORS + MOVEI B,MREWND + MOVEM B,MGRWCD(W) + PUSHJ Q,MGRWD1 ; REWIND + SETZM MGEOFR(W) + AOS MGEOFR(W) + JRST MGCMDR ; RETURN + +MGMEOT: PUSHJ Q,MGGXPT + TRNE J,600000 + JRST MGERR + MOVEM W,MGUNIT + SKIPE MTCEFW(W) ;HOW MANY EOF WRITTEN? + JRST MGMET1 + AOS MSCMDC(W) ; SO WILL RETURN + AOS MTCEFW(W) + PUSHJ Q,MGWEOF +MGMET1: MOVE A,MTCEFW(W) + SOSLE A + JRST MGMET2 + AOS MSCMDC(W) + AOS MTCEFW(W) + PUSHJ Q,MGWEOF +MGMET2: MOVE A,MSRAC(W) + TLNE A,%MANWT ; BACK OVER LAST? + JRST MGMET3 ; NO + AOS MSCMDC(W) ; SO IT WILL RETURN + PUSHJ Q,MGSPRF +MGMET3: MOVSI A,%MANWT + IORM A,MSRAC(W) + JRST MGCMDR ; DONE + +; WRITE EOF +MGWEOF: PUSHJ Q,MGGXPT + TRNE J,600010 + JRST MGERR + MOVEM W,MGUNIT + MOVE B,MTCONO(W) + CONO MTC,MWEOF(B) + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI A,%MAMSO + IORM A,MSRAC(W) ; TAPE MOVEMENT + JRST MGCMDR ; RETURN + +MGSTAT: PUSHJ Q,MGGXPT ; GETS STATUS + JRST MGCMDR + +MGW3IN: PUSHJ Q,MGGXPT + TRNE J,600010 + JRST MGERR + MOVEM W,MGUNIT +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MW3IN(B) ; WRITE THE RANDOM WORD PRECEEDED BY 3 INCHES OF BLANK TAPE + PUSHJ Q,MGWTJD + JFCL ; ALLOW BAD TAPE ERROR + JRST MGSPRR ; NOW SPACE RECORD REVERSE OVER THE ONE WORD + +SUBTTL .MTAPE UUO + +;.MTAPE AC, +; AC/ CHNM,COMMAND +; COMMAND/ COUNT,,FUNCTION + +AMTAPE: XCTR XR,[HLRZ R,(J)] + TRNE R,-NIOCHN + JRST ILUUO + HRRZM R,UUAC(U) ; SO THAT ERRORS WILL BE REPORTED ON THE CORRECT CHANNEL + ADDI R,IOCHNM(U) ; FORM IOCHNM POINTER + LDB W,[MTXP(R)] ; GET XPORT NUMBER + CAME U,MTUSR(W) ; SAME USER + POPJ P, ; NO + UMOVE J,(J) + MOVEM J,MTMTAP(W) ; SAVE J + HRRZ A,MTMTAP(W) + PUSHJ P,MTIECK + UMOVE A,(A) + HRRZM A,MTMFNC(W) ;STORE FUNCTION + HLREM A,MTMCNT(W) ;AND COUNT + SKIPN MTMCNT(W) ;A COUNT OF ZERO ALWAYS MEANS ONE, FOR COMPATIBILITY + AOS MTMCNT(W) ; WITH THE OLD CODE. + HRRZS A + CAIL A,NMTAPC ; LEGAL COMMAND + POPJ P, ; NO + AOS (P) ; SKIP RETURN + JRST @MTAPDT(A) + +MTAPDT: MTHANG ;0 HANG TILL TAPE MOTION DONE + MTRWND ;1 REWIND + MTRWDM ;2 REWIND AND DISMOUNT + MTWEOR ;3 WRITE EOR IF APPROPRIATE + MTW3IN ;4 WRITE 3 INCHES OF BLANK TAPE + MTWEOF ;5 WRITE EOF + MTSPR ;6 SPACE RECORDS + MTSPF ;7 SPACE FILES + MTSPEOT ;10 SPACE TO EOT + MTSTOP ;11 STOP ALL COMMAND ASSOCIATED WITH THIS COMMAND + MTSBKS ;12 SET BLOCK SIZE (TO COUNT) + MTRBKS ;13 READ BLOCK SIZE (TO AC) +NMTAPC==.-MTAPDT + +MTSBKS: MOVE A,MTMCNT(W) ;DESIRED BLOCKSIZE + CAIL A,4 ;CHECK REASONABLENESS + CAILE A,2000 + SOSA (P) ;FAIL IF TOO BIG OR TOO SMALL + MOVEM A,MTBLKS(W) ;OK, CHANGE WRITE-BUFFER SIZE + POPJ P, + +MTRBKS: MOVE A,MTBLKS(W) + JRST APTUAJ + +MTHANG: SKIPLE MSCMDC(W) ; HANG UNTILL ALL MOTION FINISHED + PUSHJ P,UFLS + JRST MTIECK + +MTRWND: MOVEI B,MGRWND ; REWIND +MTRWD1: SKIPE MSCRW(W) + JRST MTSOSP + MOVSI A,%MAREW + IORM A,MSRAC(W) + JRST MTCMD + +MTRWDM: MOVEI B,MGRWDM ; REWIND AND DISMOUNT + JRST MTRWD1 + +;"WRITE END OF RECORD" - THIS IS REALLY THE FORCE SYSTEM CALL, OR SHOULD BE. +MTWEOR: SKIPG MTMDN(W) ; ANY BUFFERS STARTED + POPJ P, ; NO + SKIPE MSCRW(W) ; WRITING + JRST MTWBFD ; DISCARD BUFFER +MTSOSP: SOS (P) ; NOT WRITING, ERROR + POPJ P, + +MTWEOF: SKIPN MSCRW(W) ; WRITING? + JRST MTSOSP ; NO + PUSHJ P,MTWEOR + MOVEI B,MGWEOF ; WRITE EOF + AOS MTCEFW(W) + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) ; SOMETHING WRITTEN + JRST MTCMD + +MTW3IN: SKIPN MSCRW(W) ; WRITING? + JRST MTSOSP + MOVEI B,MGW3IN + SETZM MTCEFW(W) + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) + JRST MTCMD + +;SPACE RECORDS, +=FORWARD, -=BACK +MTSPR: SKIPE MSCRW(W) ; NOT ALLOWED IF WRITING + JRST MTSOSP + PUSHJ P,MTFLRA ;FLUSH READ-AHEAD, FIND OUT HOW FAR OFF WE ARE + ADD B,C ;NUMBER OF RECORDS TAPE IS AHEAD OF USER (EOF=RECORD) + MOVNS B ;SUBTRACT THIS FROM USER'S REQUEST + ADDB B,MTMCNT(W) + JUMPE B,CPOPJ ;IF COUNT IS NOW ZERO, WE ARE DONE +MTSPR1: PUSHJ P,MTCNTR ;UPDATE USER'S COPY IN CASE PCLSR + JUMPG B,MTSPFR ; SPACE FORWARD + MOVEI B,MGSPRR ; SPACE REVERSE + PUSHJ P,MTCMD + AOSGE B,MTMCNT(W) + JRST MTSPR1 ;MORE + POPJ P, + +MTSPFR: MOVEI B,MGSPFR + PUSHJ P,MTCMD + SOSLE B,MTMCNT(W) + JRST MTSPR1 ;MORE + POPJ P, + +;THIS ROUTINE FLUSHES READAHEAD. CALL BEFORE DOING A SPACING OPERATION +;THIS DOESN'T ACTUALLY UNDO THE EFFECT ON THE DRIVE +;OF THE READ-AHEAD. IT DOES MAKE SURE THAT READ-AHEAD'S EFFECT CAN'T +;CHANGE, THEN RETURNS IN B THE NUMBER OF RECORDS AHEAD (NON-NEGATIVE) +;AND IN C THE NUMBER OF EOF'S AHEAD (0 OR 1). IF CALLED TWICE IT WILL +;RETURN ZERO THE SECOND TIME. BE SURE TO UPDATE YOUR PARAMETERS. +MTFLRA: PUSHJ P,MTCNTR ;FIRST, ENSURE WRITEABILITY, MUSTN'T PCLSR IN MTCNTR LATER + MOVSI B,%MASTP + MOVSI T,%MARAC + IORM B,MSRAC(W) ;IF READ IS ACTIVE, TELL IT TO STOP + TDNE T,MSRAC(W) ;AWAIT CESSATION OF READ + PUSHJ P,UFLS ;IF THIS PCLSR'S OUT WITH %MASTP SET, NO GREAT HARM DONE. + ANDCAM B,MSRAC(W) ;THEN TURN OFF %MASTP, THINGS ARE NOW QUIET + SKIPLE MSCMDC(W) ;BEFORE MESSING WITH BUFFERS, WAIT FOR PI TO QUIESCE + PUSHJ P,UFLS + MOVE B,MSNBOL(W) ;NUMBER OF BUFFERS = NUMBER OF RECORDS + LDB C,[.BP (%MAEFA),MSRAC(W)] ;1 IF PAST EOF WHICH THE USER DOESN'T KNOW ABOUT + MOVSI T,%MAEFA ;NOW GET RID OF THE READ-AHEAD + ANDCAM T,MSRAC(W) + JRST MTCBFF + +MTSPF: SKIPE MSCRW(W) ; NOT ALLOWED IF WRITING + JRST MTSOSP + PUSHJ P,MTFLRA ;FLUSH READ-AHEAD + MOVN B,C ;NUMBER OF FILES TAPE IS AHEAD OF USER + ADDB B,MTMCNT(W) + JUMPE B,CPOPJ ;DONE +MTSPF1: PUSHJ P,MTCNTR ;UPDATE USER'S COUNT IN CASE OF PCLSR + JUMPG B,MTSPFF ; SPACE FORWARD FILES + MOVEI B,MGSPRF + PUSHJ P,MTCMD + AOSGE B,MTMCNT(W) + JRST MTSPF1 ;MORE + POPJ P, + +MTSPFF: MOVEI B,MGSPFF + PUSHJ P,MTCMD + SOSLE B,MTMCNT(W) + JRST MTSPF1 ;MORE + POPJ P, + +MTCNTR: HRRZ A,MTMTAP(W) + MOVE T,MTMFNC(W) + HRL T,MTMCNT(W) + UMOVEM T,(A) + POPJ P, + +MTSTAT: SKIPLE MSCMDC(W) ; WAIT TILL ALL COMMANDS DONE + PUSHJ P,UFLS + MOVEI B,MGSTAT ; GET CONI'S + PUSHJ P,MTCMD ; GIVE TO PI + SKIPLE MSCMDC(W) ; WAIT TILL DONE + PUSHJ P,UFLS + MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) + POPJ P, + +MTSPEOT: MOVEI B,MGSEOT ; SPACE TO LOGICAL EOT + JRST MTCMD ;NOTE THIS IS INDEPENDENT OF READ-AHEAD + +MTSTOP: CONO PI,UTCOFF ;THIS DOESN'T DEAL WITH READ-AHEAD, PROBABLY OK + SETZM MSCMDC(W) ;NO MORE COMANDS + MOVE Q,[-MGQDLL,,MGQD0-1] + MOVE T,MSLCTB + IMUL T,W + ADD Q,T + MOVEM Q,MGQDLP(W) ; RESTORE Q + MOVE Q,[-MSCBL-1,,MSCB0-1] + ADD Q,T + MOVEM Q,MTCMBP(W) ; INITIALIZE MP AND PI COMAND POINTERS + MOVE Q,[4400,,MSCB0-1] + ADD Q,T + MOVEM Q,MGCMBP(W) + SKIPL A,MTMDN(W) + PUSHJ P,IMEMR ; RELEASE MP BUFFER + SETOM MTMDN(W) + SETZM MSMPRP(W) + SETZM MSMPRC(W) ; SO BLKT WON'T GET UNHAPPY + PUSHJ P,MTCBFF ; FLUSH BUFFER LIST + CAME W,MGUNIT ; SAME UNIT? + JRST UTCONJ + SETOM MGUNIT ; SO INTERUPT WILL GO AWAY + CONI MTC,I ; SEE WHAT DRIVE IS BEING TALKED TO + LDB B,[MUNITF,,I] + CAME W,B + JRST UTCONJ ; IF NOT SAME UNIT, DON'T DO ANYTHING + MOVE B,MTCONO(W) + CONO MTS,31 ; STOP THE TAPE + CONO MTC,(B) ; CLEAR INTERUPTS + SKIPGE A,MGCABN(W) ; ANY BUFFERS ACTIVE AT PI + JRST UTCONJ ; NO + PUSHJ P,IMEMR ; RETURN IT + SETOM MGCABN(W) + JRST UTCONJ + +SUBTTL MAG TAPE CLOSE ROUTINES + +MTOCL: LDB W,[MTXP(R)] + SOSL MTUSE(W) + POPJ P, ; NOT ONLY CHANNEL OPEN + AOS MTUSE(W) ; INCASE PCLSRED + MOVSI A,%MAERR ;ERROR? + TDNE A,MSRAC(W) + PUSHJ P,MTOCL3 +; MOVEI T,MSCBL-4 +; CAMG T,MSCMDC(W) +; PUSHJ P,UFLS ; WAIT FOR ROOM FOR THREE COMMANDS + SKIPL MTMDN(W) ; MAG TAPE OUTPUT CLOSE + PUSHJ P,MTWBFD ; WRITE OUT BUFFERS +; MOVEI B,MGWEOF ; WRITE OUT TWO EOF(S) +; SKIPE MTCEFW(W) +; JRST MTOCL2 ; MAY HAVE BEEN PCLSRED +;MTOCL1: PUSHJ P,MTCMD +; AOS MTCEFW(W) ; ONE MORE CLOSE EOF WRITTEN +;MTOCL2: MOVE A,MTCEFW(W) +; SOSG A ; DON'T WRITE EOF IF PCLSRED +; PUSHJ P,MTCMD ; DO IT TWICE +; SKIPG A +; AOS MTCEFW(W) +; MOVEI B,MGSPRF +; MOVE A,MSRAC(W) +; TLNN A,1000 +; PUSHJ P,MTCMD ; NOW BACK UP OVER ONE +; MOVSI A,1000 +; IORM A,MSRAC(W) + MOVEI B,MGMEOT ; MAKE EOT + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) ; NOW WAIT TILL DONE + PUSHJ P,UFLS + MOVEI A,1 + MOVEM A,MGEOFR(W) + SKIPL MTMDN(W) ;ANY ACTIVE BUFFERS + JRST 4,. + SKIPL MGCABN(W) + JRST 4,. + SKIPE MSNBOL(W) + JRST 4,. + SETOM MTUSR(W) + SETOM MTUSE(W) + SETZM MSRAC(W) + POPJ P, + +MTOCL3: SKIPL A,MTMDN(W) + PUSHJ P,MEMR ; IF BUFFER AROUND,FLUSH IT + SETOM MTMDN(W) + SETZM MSMPRC(W) + POPJ P, + +MTICL: LDB W,[MTXP(R)] + SOSL MTUSE(W) ; LAST USER + POPJ P, + AOS MTUSE(W) + MOVEI T,1 + CAMGE T,MSCMDC(W) ; ALLOW ONE COMMAND IF REWINDING + PUSHJ P,UFLS ; ALL COMMANDS DONE + MOVE T,MSRAC(W) + TLNE T,%MAREW ; REWINDING? + JRST MTICL3 ; YES + SKIPLE MSCMDC(W) ; NO, WAIT TILL COMMAND DONE + PUSHJ P,UFLS +MTICL3: SKIPL MGCABN(W) ; ANY PI BUFFERS LEFT + JRST 4,. + PUSHJ P,MTRBD ;GET RID OF M.P. BUF, IF ANY + SETOM MTUSR(W) + PUSHJ P,MTCBFF ; FREE BUFFERS + SOS MTUSE(W) + MOVE T,MSRAC(W) + TLNE T,%MAREW ; DON'T HAVE TO SKIP TO EOF IF REWINDING + JRST MTICL2 + MOVSI A,20 + TDNE A,(R) ;CHECK TO SKIP TO EOF + JRST MTICL2 + MOVSI A,%MAMSO + TDNN A,MSRAC(W) ;TAPE MOVEMENT + JRST MTICL2 ; NO + SKIPE MGEOFR(W) ;NO TIMING CONFLECT HERE SINCE WE WAITED FOR PI TO CLEAR + JRST MTICL2 ;NOTE THAT THIS DISPOSES OF A READ-AHEAD EOF. + PUSHJ P,MTSTAT + MOVE B,MGCMTS(W) + TRNE B,100000 + JRST MTICL2 + MOVEI B,MGSPFF + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) + PUSHJ P,UFLS +MTICL2: MOVSI T,%MAREW + ANDM T,MSRAC(W) ;CLEAR ALL BUT REWINDING + POPJ P, ; NO, DONE + +MTCBFF: SKIPN MSNBOL(W) ;ANY BUFFERS ON CHAIN? + POPJ P, + HRRZ A,MSBUFP(W) ;YES, FREE ONE + PUSHJ P,MTICL1 ; FIX CHAIN + PUSHJ P,MEMR ; RETURN BUFFER + SOSLE MSNBOL(W) ;ANY MORE? + JRST MTCBFF + SETZM MSBUFP(W) ;EMPTY LIST + POPJ P, + +MTICL1: LDB T,[MLO,,MEMBLT(A)] ; GET BACK POINTER + HRRM T,MSBUFP(W) + POPJ P, diff --git a/system/mtape.197 b/system/mtape.197 new file mode 100644 index 0000000..ebcaabe --- /dev/null +++ b/system/mtape.197 @@ -0,0 +1,1477 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;******************************** +;** +;** TO BE DONE: +;** +;** RECORDS LONGER THAN 1K +;** AUTOMTAIC DETERMINATION OF DENSITY AND RECORD LENGTH WHEN READING +;** ALLOW CLOSE WHEN TAPE HAS BEEN TAKEN OFF +;** BE MORE FORGIVING OF CONTROLLER LOSSAGE +;** PASS .MTAPE TO JOB DEVICE +;** HAVE AN IGNORE ERRORS SWITCH +;** THIS HORRIBLE BLETCHEROUS IOT CODE SHOULD BE REDESIGNED +;** +;******************************** + + +IFN TM10A,TM10B==0 +IFE TM10A,TM10B==1 +IFN TM10A,INFORM IO BUSS MAG TAPE,1 +IFN TM10B,INFORM DATA CHANNEL MAG TAPE,1 +MSCBL==8 ; COMMAND BUFFER LENGTH +MGQDLL==6 ; INTERUPT LEVEL PDL +IF2 IFN MNUMB-140600, .ERR IMPLICIT DEPENDENCY ON MNUMB +MSEOFP==210100 ;HIGH BIT OF MNUMB IN MEMBLT IS EOF FLAG +MSCHN==140500 ;OTHER 5 BITS OF MNUMB IN MEMBLT IS DRIVE NUMBER + +MTXP==410300,, ;XPORT NUMBER +MUNITF==170300 ; UNIT FIELD IN MTC CONI +MNOPIN==10000 +MWRITE==4000 +MW3IN==14000 +MSPRR==7000 +MREAD==2000 +MSPFR==6000 +MSPFF==16000 +MSPRF==17000 +MREWND==1000 +MRWNDD==11000 +MWEOF==5000 +MGNRTY==10. ;NUMBER OF READ RETRIES + +SUBTTL MAG TAPE OPEN ROUTINE + +; C/ MODE,,DEV +; D/ MODE (ROT 1) 4.9=1=>OUTPUT +; I/ DEVICE NUMBER +; R/ IOCHNM WORD POINTER + +MAGTO: SKIPL W,I ; GET DEVICE + CAIL W,NMTCS ; TO BIG? + JRST OPNL1 ; NO SUCH DEVICE + MOVSI T,%MAREW + TDNE T,MSRAC(W) ; REWINDING + PUSHJ P,UFLS ; YES, THEN WAIT + CONO PI,CLKOFF ; DON'T WANT STATUS CHANGED FROM UNDER ME + SKIPGE MTUSE(W) ; CHECK FOR FIRST USER + JRST MAGTU1 ; FIRST + CAME U,MTUSR(W) ;SAME USER + JRST OPNL10 ; DIFFERENT USER IS ERROR + MOVE B,D + EQV B,MSCRW(W) + SKIPL B ; CHECK FOR SECOND OPEN IN SAME DIRECTION + JRST OPNL2 ; WRONG DIRECTION +MAGTU: MOVEM U,MTUSR(W) ; STORE USER + SETZM MSCRW(W) ; INDICATE READ UNTIL FOUND TO BE OTHERWISE + TLNE C,1 ; READ OR WRITE + SETOM MSCRW(W) ;INDICATE WRITE + AOS MTUSE(W) ;INDICATE 1 MORE USER + PUSHJ P,SOSSET + MTUSE(W) ; SOS IF PCLSRED + CONO PI,CLKON ; LET UM GET ME + PUSHJ P,MTSTAT ; GET CONIS OF 340 AND 344 IN I AND J + MOVE A,MSRAC(W) + TLNE A,%MAERR ; PI ERROR MEANS DEVICE NOT THERE + JRST MTOL1 + TRNN J,200040 + JRST OPNL7 ; DEVICE NOT ONLINE + SKIPN MSCRW(W) ;WRITING? + JRST MTOW1 + TRNE J,10 ; AND WRITE LOCKED + JRST OPNL26 ; DEVICE WRITELOCKED + SKIPE MSRAC(W) ; WRITING + TRNN J,4000 ;EOT? + JRST MTOW1 ; NO + MOVSI A,%MAETW+%MAERR ; IF WRITE AND EOT,MAKE .IOT GIVE IOC ERROR BUT LET OPEN WIN + IORM A,MSRAC(W) +MTOW1: TRNN J,400000 ; XPORT HUNG + JRST MTOW2 ; OK + TRNN J,20000 ; OK IF REWINDING + JRST OPNL7 ;DEVICE NOT WORKING +MTOW2: TLNN C,400 ; GET CORE DUMP MODE + JRST MTOW3 + TLNN C,300 + JRST MTOW3 + TLC C,300 + TLCE C,300 ; IBM AND DENSITY 800 BPI OK + JRST OPNL12 ; MODE NOT AVAILABLE +MTOW3: ;BY THIS POINT OPEN WILL WIN + PUSHJ P,LSWDEL ; RELEASE MTUSE SWITCH + MOVEI A,MTCCHN_3 ;SET UP MAG TAPE CONO +IFN TM10A, TRO A,1 ; DATA PI CHANNEL + LDB B,[300200,,C] ; GET DENSITY FROM OPEN + SKIPN B + MOVEI B,3 + SUBI B,1 ; CONVERT TO PROPER PARITY + DPB B,[060200,,A] + TLNN C,400 ; CORE DUMP + TRO A,20000 ; YES + TLNN C,40 ; PARITY CHECK + TRO A,40000 ; SET ODD PARITY + DPB W,[170300,,A] ; SET UNIT NUMBER + MOVEM A,MTCONO(W) ; STORE IT + LDB B,[330300,,C] ; GET WORDS PER BLOCK + TRC B,7 + MOVEI A,10 + LSH A,(B) ;NUMBER OF WORDS PER RECORD + MOVEM A,MTBLKS(W) ;BLOCKSIZE + LDB A,[230200,,C] ; GET MODE (BUT NOT READ/WRITE BIT) + HLR C,MTOPTB(A) ; GET INPUT DISPATCH + TLNE D,400000 ; OPEN FOR OUTPUT? + HRR C,MTOPTB(A);CHANGE TO OUTPUT IF SO + MOVEM C,(R) ;STORE IN IOCHNM + DPB W,[MTXP(R)] ; STORE XPORT NUMBER + JRST POPJ1 ; SKIP RETURN + +MTOPTB: MTUAIX,,MTUAOX + MTBIX,,MTBOX + MTUIIX,,MTUIOX + MTBIX,,MTBOX + +MAGTU1: SETZM MSBUFP(W) ; INDICATE NO BUFFERS ON CHAIN + SETZM MSNBOL(W) ; ANOTHER WAY OF SAYING ABOVE + SETZM MSMPRC(W) ; BUFFER WORDS REMAINING + SETZM MSMPRP(W) ; POINTER TO BUFFERS + SETOM MTMDN(W) ;NO BUFFER AT MP + SETOM MGCABN(W) ;NONE AT PI + SETZM MSRAC(W) + MOVEI A,2 + MOVEM A,MTCEFW(W) ; NUMBER OF EOF'S WRITTEN + MOVSI A,%MANWT + IORM A,MSRAC(W) ; INDICATE NOTHING WRITTEN ON TAPE + JRST MAGTU + +MTOL1: SETZM MSRAC(W) + JRST OPNL1 + +SUBTTL MAG TAPE INPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAI: MOVEI B,CHRKTI ;UNIT ASCII INPUT + MOVE E,[440700,,5] + JRST MTREAD + + SKIPA B,[SIOKT] +MTUII: MOVEI B,CHRKTI ;UNIT IMAGE + MOVE E,[444400,,1] + JRST MTREAD + +MTBI: MOVE E,[444400,,1] ;BLOCK INPUT + MOVEI B,BLKT +MTREAD: LDB W,[MTXP(R)] ; W <= XPT # + PUSHJ P,MTIECK + MOVEM P,MTPSAV(W) ; SAVE P FOR EOF RETURN + JSP B,(B) ;BLKT,CHRKT,SIOKT + MSMPRP(W) ;LOC OF NEXT WORD + MSMPRC(W) ;COUNT REMAINING + SETZ MTRBG ; GET NEW BUFFER (SETZ FOR CHRKT RETURN ON EOF) + MTRBD ; DISCARD BUFFER + JRST 4,. + PUSHJ P,MTRBFW ; FLUSH INSTRUCTION WAIT FOR BUFFERS TO COME FROM PI + +;MAG TAPE READ BUFFER GET ROUTINE +; BUFFER ASSUMED TO HAVE COME IN FROM PI LEVEL. (I.E. MTRBFW WAS CALLED) + +MTRBG: SKIPG MSNBOL(W) ;ANY BUFFER AVAILABLE? + JRST MTRBG3 ;NO, MUST BE ERROR OR EOF + CONO PI,UTCOFF + HLRZ A,MSBUFP(W) ; GET IN POINTER + HRRZ TT,MSBUFP(W) ; GET OUT POINTER + MOVEM TT,MTMDN(W) ; STORE BUFFER ACTIVE AT MP + CAMN A,TT ;IN = OUT? + JRST MTRBG1 ; YES + LDB T,[MLO,,MEMBLT(TT)] ; BACK POINTER TO NEXT BLOCK + HRRM T,MSBUFP(W) ;STORE NEW OUT POINTER + JRST MTRBG2 + +MTRBG1: SETZM MSBUFP(W) ;EMPTY BUFFER LIST +MTRBG2: SOS MSNBOL(W) ; ONE LESS BUFFER ON LIST + CONO PI,UTCON + LDB J,[MWC,,MEMBLT(TT)] ;WORD COUNT OF BLOCK + MOVEM J,MTBLKS(W) ;SAVE FOR MTAPE 13 + LSH TT,10. ;MAKE BLOCK NUMBER AN ADDRESS + MOVEM TT,MSMPRP(W) + JRST SIOBGX + +MTRBG3: SKIPGE MSRAC(W) .SEE %MAEOF + JRST [ MOVSI T,%MAEFA ;THE EOF IS NOW NO LONGER READ-AHEAD + ANDCAM T,MSRAC(W) ;TELL THE USER ABOUT IT + JRST POPJ2 ] + PUSHJ P,MTIECK + JRST 4,. ;BULLSHIT, WHY DID MTRBFW SKIP? + +;MAG TAPE READ BUFFER DISCARD ROUTINE +MTRBD: SKIPGE A,MTMDN(W) ; ANY BUFFERS + JRST MOVTWJ ;SET UP T FOR BUFFER WAIT,RETURN + CONO PI,UTCOFF ; SHUT UP WORLD + SETOM MTMDN(W) ; NO BUFFER ACTIVE AT M.P. + SETZM MSMPRC(W) + LDB TT,[MSEOFP,,MEMBLT(A)] ;GET EOF FLAG FROM PI + PUSHJ P,MGMEMR ;RETURN MEM, TURN UTCON + JUMPN TT,MTRBD2 ;EOF? +MOVTWJ: MOVE T,W ; T NEEDS CHANNEL NUMBER FOR BUFFER WAIT UFLUSH + POPJ P, ;ALSO MTRBG, MTRBFW RELY ON THIS SETTING T + +MTRBD2: MOVSI A,%MAEOF ; SET EOF + IORM A,MSRAC(W) + JRST MOVTWJ + +;MAG TAPE READ WAIT FOR DATA ROUTINE +MTRBFW: SKIPG MSNBOL(T) ; ANY FREE BUFFERS ON LIST? + SKIPGE MSRAC(T) .SEE %MAEOF + JRST POPJ1 ;INPUT AVAILABLE, OR AT EOF, UNHANG + MOVE TT,MSRAC(T) + TLNE TT,%MAERR ; CHECK FOR ERRORS + JRST POPJ1 ;WAKE UP SO YOU CAN GET YOUR IOC ERROR + TLNE TT,%MARAC ; IF NOT ALREADY DONE SO, SEND OUT A CALL FOR TAPE READ + POPJ P, + PUSH P,W ;THIS BEING DONE UNDER A UFLS. ONLY T GOOD + PUSH P,B + MOVE W,T + MOVEI B,MGREAD ;WHERE TO GO AT PI LEVEL + MOVEI T,MSCBL ;MAKE SURE THAT THERE IS ROOM IN THE RING BUFFER + CAMG T,MSCMDC(W) + JRST MTRBW2 ; NO ROOM, GO AWAY + MOVSI TT,%MARAC + IORM TT,MSRAC(W) ;READ IS ACTIVE NOW, OR WILL BE SHORTLY + PUSHJ P,MTCMD1 +MTRBW2: MOVE T,W + POP P,B + POP P,W + POPJ P, + +SUBTTL MAG TAPE OUTPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAO: MOVEI B,CHRKT ;UNIT ASCII OUTPUT + MOVE E,[440700,,5] + JRST MTWRIT + + SKIPA B,[SIOKT] +MTUIO: MOVEI B,CHRKT ;UNIT IMAGE OUTPUT + MOVE E,[444400,,1] + JRST MTWRIT + +MTBO: MOVE E,[444400,,1] ; BLOCK OUT + MOVEI B,BLKT +MTWRIT: LDB W,[MTXP(R)] ; GET XPORT NUMBER + PUSHJ P,MTIECK + HRLZI A,%MAETW ; END OF TAPE CHECK + TDNE A,MSRAC(W) + JRST IOCER9 + JSP B,(B) + SETZ MSMPRP(W) ;LOC OF WORD + MSMPRC(W) ; COUNT + SETZ MTWBFG ; GET NEW BUFFER + MTWBFD ; WRITE OUT BUFFERS + JRST 4,. + TRNA ;NO WAIT FOR BUFFER + +;MAG TAPE WRITE BUFFER GET ROUTINE + +MTWBFG: PUSHJ P,MTIECK + PUSHJ P,TCALL ; TURN OFF UTC + JRST IOMQ + POPJ P, ;GO BACK NO SKIP IF NO CORE + MOVEM A,MTMDN(W) ; STORE ACTIVE BUFFER NUMBER + MOVEI T,MUMGB + DPB T,[MUR,,MEMBLT(A)] ; TELL WORLD THAT IT IS A MAG TAPE BUFFER + DPB W,[MSCHN,,MEMBLT(A)] ; CHANNEL NUMBER + SETZM TT + DPB A,[121000,,TT] ;CONVERT BLOCK NUMBER TO ADDRESS IN TT + MOVE J,MTBLKS(W) ;GET WRITE BLOCK SIZE + JRST SIOBGX + +;MAG TAPE WRITE BUFFER DISCARD ROUTINE + +MTWBFD: PUSHJ P,MTIECK + SKIPGE A,MTMDN(W) + POPJ P, + MOVEI T,MSCBL + CAMG T,MSCMDC(W) + PUSHJ P,UFLS ; MAKE SURE ROOM IN COMMAND BUFFER EXISTS IN CASE OF PCLSRING + MOVE T,MTBLKS(W) ; DISCARD BUFFER. FIRST SEE HOW BIG IT IS + SUB T,MSMPRC(W) + CONO PI,UTCOFF ;CAN'T TOLERATE ANY HANKY PANKY + SETOM MTMDN(W) ;CLEAR IT + SETZM MSMPRC(W) ; CLEAR COUNT + JUMPE T,MEMR ; DON'T DO ANYTHING BUT RETURN BLOCK IF NO WORDS + DPB T,[MWC,,MEMBLT(A)] ; STORE WORD COUNT + SKIPG MSNBOL(W) ; LIST STARTED YET? + JRST MTWBD1 ;NO + HLRZ TT,MSBUFP(W) ; GET OLD IN POINTER + DPB A,[MLO,,MEMBLT(TT)] ;CHAIN BACK + SKIPA +MTWBD1: HRRM A,MSBUFP(W) ; START NEW LIST + HRLM A,MSBUFP(W) ; IN = OUT = (A) +MTWBD2: SETZM TT + DPB TT,[MLO,,MEMBLT(A)] ; INDICATE END OF LIST + AOS MSNBOL(W) ; ONE MORE BUFFER ON LIST + CONO PI,UTCON + PUSH P,B + MOVEI B,MGWRIT + PUSHJ P,MTCMD + MOVSI B,%MANWT + ANDCAM B,MSRAC(W) + SETZM MTCEFW(W) ; INDICATE SOMETHING WRITTEN + JRST POPBJ ; RETURN + +SUBTTL MTCMD - GIVE COMMAND TO PI LEVEL + +;PUSHJ P,MTCMD + ;RH(W) HAS XPORT NUMBER + ;RH(B) HAS ADDR OF INTERUPT ROUTINE + +MTCMD: MOVEI T,MSCBL ; COMAND BUFFER LENGTH + CAMG T,MSCMDC(W) ;COMAND COUNT + PUSHJ P,UFLS ; WAIT FOR ROOM +MTCMD1: MOVE T,MTCMBP(W) ; GET POINTER TO RING BUFFER + AOBJN T,.+2 + SUB T,[MSCBL,,MSCBL] ; REACHED END OF BUFFER, RING IT + MOVEM B,(T) ; STORE COMMAND + MOVEM T,MTCMBP(W) ; STORE NEW POINTER + CONO PI,UTCOFF + AOS MSCMDC(W) ; INDICATE ONE MORE COMMAND + JRST MSTRTR ; START UP PI ROUTINE + +SUBTTL MTIECK - CHECK FOR IOC ERROR + +MTIECK: PUSH P,A ; CHECK FOR IOTERR + MOVE A,MSRAC(W) + TLNN A,%MAERR ; ERROR AT PI? + JRST POPAJ + SKIPLE MSCMDC(W) + PUSHJ P,UFLS ; LET PI CLEAR BEFORE MUNGING BUFFERS + SKIPL A,MTMDN(W) + PUSHJ P,MEMR + SETOM MTMDN(W) + SETZM MSMPRP(W) + SETZM MSMPRP(W) + PUSHJ P,MTCBFF ; FREE CHAIN + POP P,A + MOVE T,MGCMTS(W) ; GET CONI MTS, + TRNE T,440000 ; XPT HUNG,ILLOP + JRST IOCER1 + TRNE T,23600 ; PAR ERROR,R/C, RLI,DL,BT + JRST IOCER3 ; IRRECORVERABLE DATA ERROR + TRNE T,4000 ; EOT + JRST IOCER9 ; EOT, DEV FULL + MOVE A,MGEOFR(W) ; LOGICAL EOT + CAIL A,2 + JRST IOCER9 + JRST IOCER3 ; UNKNOWN, GIVE IRR DATA + +SUBTTL MAG TAPE .STATUS ROUTINE + +STAMTC: LDB W,[MTXP(R)] ; LOAD W + DPB A,[60300,,D] ; OPEN MODE + PUSHJ P,MTSTAT + LDB A,[.BP %MAETW_22,MSRAC(W)] ; EOT ON WRITE + LDB B,[.BP %MAETR_22,MSRAC(W)] ; EOT ON READ + IOR A,B + DPB B,[140100,,D] ;EOT + LDB A,[20100,,J] + TRC A,1 + DPB A,[150100,,D] ; 7 OR 9 + LDB A,[160100,,MTCONO(W)] + TRC A,1 + DPB A,[200100,,D] ;PARITY + LDB A,[60200,,MTCONO(W)] ; DENSITY + ADDI A,1 + CAIN A,3 + SETZM A ; 800 IS 00 + DPB A,[160200,,D] + LDB A,[.BP %MARCE_22,MSRAC(W)] ; READ COMPARE ERROR + DPB A,[130100,,D] + MOVE A,MTCONO(W) + TRNN J,4 ; 7 TRACK + TRNE A,20000 ; OR CORE DUMP + POPJ P, ; THEN DONE + TRO D,140000 ; IBM, 9 TRACK AND 800 BPI + POPJ P, + + +;RCHST ROUTINE FOR MAG TAPE + +RCHMGT: HLRZ E,(R) ;OPEN-MODE IS KEPT IN LH OF IOCHNM WORD - HOW CONVENIENT! + LDB J,[MTXP(R)] ;GET THE MAG TAPE DRIVE NUMBER + MOVSI J,'MT0(J) ;RETURN THAT DRIVE'S DEVICE NAME. + TRZ E,(.BM MTXP) ;CLEAR THE PLACE IN THE OPEN-MODE THAT HAS THE DRIVE #. + JRST POPJ1 ;SKIP SO THAT J OVERRIDES BUILT-IN DEVICE NAME. + + EBLK + +SUBTTL MAG TAPE STORAGE AREA + +MGVTC: 0 ; 1 SCRATCH WORD FOR VIRGIN TAPE CHECK +MGRWCD: BLOCK NMTCS ; REWIND COMMAND +MGEOTT: BLOCK NMTCS ; TIMEOUT FOR VIRGIN TAPE +MGJDTI: 0 ; WAIT FOR JOB DONE TIME OUT +MGEOFR: BLOCK NMTCS ; NUMBER OF EOFS SINCE LAST READ +MGNWRD: 0 ; NUMBER OF WORDS READ IN A PI LEVEL READ +MTPSAV: BLOCK NMTCS ; STORAGE TO RESTORE P ON EOF +MSRAC: BLOCK NMTCS ; MAG TAPE GENERAL GARBAGE + %MA==1,,525252 + %MAEOF==400000 ; 4.9 EOF ON READ + %MAETR==200000 ; 4.8 EOT ON INTERNAL READ + %MAETW==100000 ; 4.7 EOT ON WRITE + %MAERR==040000 ; 4.6 PI ERROR + %MARCE==020000 ; 4.5 READ COMPARE ERROR + %MACTH==014000 ; 4.4 CORE ALLOCATOR SAYS STOP + ; 4.3 " (WHY 2 BITS?) + %MASTP==002000 ; 4.2 STOP READ AHEAD + %MANWT==001000 ; 4.1 NOTHING WRITTEN ON TAPE YET + %MAEFA==000400 ; 3.9 EOF SEEN ON READ-AHEAD, USER HASN'T SEEN YET + %MAESO==000200 ; 3.8 EOF READ SINCE OPEN + %MAMSO==000100 ; 3.7 TAPE MOVED SINCE FIRST OPEN + %MAREW==000040 ; 3.6 REWINDING FLAG + %MARAC==000020 ; 3.5 READ ACTIVE FLAG +MGTBZY: -1 ; FLAG TO GET INTURPT STARTED +MTCONO: REPEAT NMTCS,\.RPCNT_17+20 ; MAIN CONO STORAGE +MGUNIT: -1 ; UNIT EXPECTING INTERUPT +MGCMTS: BLOCK NMTCS ; PI CONI MTS STORAGE +MGCMTC: BLOCK NMTCS ; PI MTC STORAGE +MGWCW: 0 ; WAIT FOR CONTROL WORD WRITTEN FLAG +LMIOWD: 0 ; LAST MIOWD +MGERRC: BLOCK NMTCS ; ERROR COUNT +MTMFNC: BLOCK NMTCS ; .MTAPE FUNCTION STORAGE +MTMCNT: BLOCK NMTCS ; .MTAPE COUNT +MTMTAP: BLOCK NMTCS ; MTAPE CALL WORD +MTCEFW: BLOCK NMTCS ; NUMBER OF EOF'S WRITTEN AT CLOSE +MSCMDC: REPEAT NMTCS,0 ; NUMBER OF COMMANDS +MSBUFP: REPEAT NMTCS,0 ; MAG TAPE BUFFER POINTER IN,,OUT +MSCRW: BLOCK NMTCS ; -1=>OUTPUT 0=>INPUT +MSMPRC: BLOCK NMTCS ; WORDS LEFT IN BUFFER +MSMPRP: BLOCK NMTCS ;NEXT WORD IN BUFFER +MTMDN: REPEAT NMTCS,-1 ; BLOCK ACTIVE AT MP +MTUSE: REPEAT NMTCS,-1 ; NUMBER OF CHANNELS OPEN ON THIS MTAPE +MTUSR: REPEAT NMTCS,-1 ; USER INDEX OF XPORT +MSNBOL: BLOCK NMTCS ; NUMBER OF BUFFERS ON LIST +MGCABN: REPEAT NMTCS,-1 ; BUFFER ACTIVE AT PI LEVEL +MTBLKS: BLOCK NMTCS ; WRITE, BUFFER SIZE + ; READ, SIZE OF LAST RECORD READ +MGQDLP: REPEAT NMTCS,-MGQDLL,,CONC MGQD,\.RPCNT,-1 ;QDL POINTER +REPEAT NMTCS,[ + CONC MSCB,\.RPCNT,: BLOCK MSCBL ; COMMAND BUFFER + MGRCV ; TO RING BUFFER + + MGNCMD ; GET NEW COMMAND + CONC MGQD,\.RPCNT,: BLOCK MGQDLL + IFE .RPCNT,MSLCTB==.-MSCB0 ; LENGTH OF EACH TABLE +] +MTCMBP: REPEAT NMTCS,-MSCBL-1,,CONC MSCB,\.RPCNT,-1 ; INPUT TO COMMAND TABLE +MGCMBP: REPEAT NMTCS,4400,,CONC MSCB,\.RPCNT,-1 ; OUTPUT FROM COMAND TABLE +IFE KL10P,MIOWD: BLOCK 2 ; CHANNEL PROGRAM +IFN TM10A,[ +MGDBRK: 0 + CONO MTS,1 + JRST 12,@MGDBRK +];TM10A +MGEMTC: 0 ;CONI MTC, AT LAST ERROR +MGEMTS: 0 ;CONI MTS, AT LAST ERROR +BBLK + +SUBTTL MAG TAPE PI LEVEL + +;ROUTINES TO GET INTERUPT ROUTINES STARTED +MGXGO: MOVE Q,MGQDLP(W) ;GET QDLPOINTER + PUSHJ P,QPOPJ ;CALL ROUTINE . SHOULD FINISH WITH POPJ P,OR PUSHJ Q,CPOPJ + ;PUSHJ Q,CPOPJ IF ROUTINE WANTS TO RETURN + ;POPJ P, IF AT END OF COMAND. AND NEW IS TO BE GOTTEN + MOVEM Q,MGQDLP(W) ; STORE NEW QDL + POPJ P, + +MGRCV: MOVNI A,MSCBL+1 ;AT END OF COMAND LIST,RING IT + ADDM A,MGCMBP(W) ;RING THE BUFFER +MGNCM1: ILDB B,MGCMBP(W) ; GET NEW COMMAND + JRST (B) + +MGNCMD: AOBJN Q,MGNCM1 ; AT BOTTOM OF QDL, SIMULATE PUSHJ AND GET NEW COMMAND + JRST 4,. ;QDL POINTER CLOBBERED + +QPOPJ1: AOS (Q) +QPOPJ: POPJ Q, + +MSTRTR: CONO PI,UTCOFF ; GET MAGTAPE INTURPT STARTED + SETZM MGTBZY + CONO PI,MTCRQ + CONO PI,UTCON + POPJ P, + +;HERE FOR MAG TAPE FLAG CHANNEL INTERUPT +MGHBRK: SKIPGE W,MGUNIT ; LOAD UNIT + JRST MGUBRK ;NO ONE WANTS IT + LDB B,[MUNITF,,A] + CAME W,B ; UNITS AGREE + JRST 4,. ; WE MUST NOT MIX UNITS + MOVE J,C + PUSH P,[DSKEX] +IFN TM10B,[ + TLNE C,160 + JRST MGERR +];TM10B + TRNE C,40000 + JRST MGERR + JRST MGXGO + +MGSBRK: SETOM MGTBZY ;HERE FOR ANY RANDOM MP PI STARTUP + MOVEI B,NMTCS-1 + SKIPG MSCMDC(B) ;ANY COMMANDS IN BUFFER +MGSBK1: SOJGE B,.-1 + SKIPGE B ;LAST UNIT? + JRST DSKEX ; THEN GOTO DSKEX + MOVE W,B + PUSH P,B + MOVSI B,%MACTH + TDNN B,MSRAC(W) ; CORE ALLOCATOR SAYING GO AWAY + PUSHJ P,MGXGO ; START UP THAT ROUTINE + POP P,B + JRST MGSBK1 ; ANY MORE? + +MGUBRK: LDB W,[MUNITF,,A] ; WHO CAUSED INTERUPT? + MOVE B,MTCONO(W) + CONO MTC,(B) + CONO MTS,31 ; CLEAR INTERUPT + JRST DSKEX + +; ROUTINE TO WAIT FOR JOB DONE TO SET +MGWTJD: CONI MTS,J + TRNE J,440000 ;SKIP IF STARTED SUCCESSFULLY + JRST MGERR ;JOB-DONE ISN'T EVER GOING TO SET +MGWJD1: CONI MTS,J + SKIPN MGJDTI ; TIME OUT? + JRST MGWJD2 + MOVE T,TIME + CAML T,MGJDTI + JRST MGERR +MGWJD2: TRNN J,100 ; JOB DONE? + JRST MGOVER ; NOT SET + CONI MTS,J + CONI MTC,I ; GET CONI MTC + MOVEM J,MGCMTS(W) + MOVEM I,MGCMTC(W) + SKIPE MGWCW ; SHOULD I WAIT FOR CONTROL WORD WRITTEN + PUSHJ Q,MGWCWC ; CHECK TO SEE IF IT IS WRITTEN + SETZM MGWCW ;CLEAR FLAG + CONO MTS,30 ; CLEAR CHANNEL CONDITIONS + MOVE B,MTCONO(W) + CONO MTC,(B) ; RELESE MTC, CLEAR JOB DONE +IFN TM10B,[ + TLNE J,160 + POPJ Q, ;CHANNEL ERROR +] + TRNE J,463600 + POPJ Q, ; RANDOM OTHER NON PERFECTIONS, NOT NECESSARILY ERRORS + JRST QPOPJ1 ; SUCCESS + +; GET XPORT +MGGXPT: CONSO MTS,2 ; LOAD NEXT UNIT SET? + JRST MGOVER ; NO, WAIT FOR IT + MOVEM W,MGUNIT + MOVE T,TIME + ADDI T,10.*30. ; TIME OUT IN 10. SECONDS + MOVEM T,MGJDTI + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ; SELECT DRIVE + PUSHJ Q,MGWJD1 + JFCL ; WAIT FOR JOB DONE, BUT ALLOW ANY ERRORS + SETZM MGJDTI + POPJ Q, + +MGOVER: CONSZ MTS,440020 ; ANY PROBLEMS? + JRST MGERR ;TAPE HUNG, ILL FUNCTION, CHANNEL ERROR + SOS (Q) + POPJ P, + +;ERROR +MGERR: CONI MTS,MGEMTS + CONI MTC,MGEMTC + MOVSI T,%MARAC ;READ NOT ACTIVE, FOR SURE + ANDCAM T,MSRAC(W) + SETZM MSCMDC(W) ; NO COMMANDS + SETOM MGUNIT ; CLEAR UNIT WAIT FLAG + SETZM MGJDTI +IFN TM10B,[ + TLNE J,160 ; CHANNEL ERROR? + BUG PAUSE,[MTAPE: CHANNEL ERROR, STATUS=],OCT,J,[MICWA+1=],OCT,MICWA+1,[MIOWD=],OCT,MIOWD +];TM10B + SKIPL A,MGCABN(W) ; ANY PI BUFFERS? + PUSHJ P,IMEMR + SETOM MGCABN(W) + HRLZI B,%MAERR ; PI ERROR + IORM B,MSRAC(W) ; STORE IN STATUS WORD + MOVE Q,[-MGQDLL,,MGQD0-1] + MOVE T,MSLCTB + IMUL T,W + ADD Q,T ; RESTORE Q + PUSH P,Q + MOVE Q,[-MSCBL-1,,MSCB0-1] + ADD Q,T + MOVEM Q,MTCMBP(W) ; INITIALIZE MP AND PI COMMND POINTERS + MOVE Q,[4400,,MSCB0-1] + ADD Q,T + MOVEM Q,MGCMBP(W) + MOVSI B,%MAREW + ANDCAM B,MSRAC(W) ; CLEAR REWINDING + SKIPN MSCRW(W) ; DONE IF READING + JRST POPQJ + SKIPN MSNBOL(W) ; ANY BUFFERS ON LIST? + JRST POPQJ +MGERR1: HRRZ A,MSBUFP(W) + PUSHJ P,MTICL1 + PUSHJ P,IMEMR + SOSLE MSNBOL(W) ; ANY MORE + JRST MGERR1 + SETZM MSBUFP(W) ;EMPTY LIST + JRST POPQJ + +MGWCWC: +IFN TM10B,[ + SKIPE MICWA+1 ; CONTROL WORD WRITTEN? + POPJ Q, + CONO MTS,4 ; TELL IT TO WRITE IT +MGWCW1: SKIPE MICWA+1 + JRST MGWCW2 ; DONE + PUSHJ Q,CPOPJ ; WAIT + JRST MGWCW1 + +MGWCW2: MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) ;RESTORE STATUS + TLO J,10 ;SET CONTROL WORD WRITTEN +] ;END OF IFN TM10B + POPJ Q, + +IFN TM10A,[ +MGDCSI: SKIPA A,[BLKI MTC,MIOWD] +MGDCSO: MOVE A,[BLKO MTC,MIOWD] + MOVEM A,MAGLOC + MOVE A,[JSR MGDBRK] + MOVEM A,MAGLOC+1 + POPJ Q, +] ;END OF IFN TM10A + +SUBTTL MAG TAPE PI LEVEL WRITE + +MGWRIT: PUSHJ Q,MGGXPT ; GET XPORT + TRNE J,600010 ; WRITE LOCKED,HUNG OR REWINDING + JRST MGERR + MOVEM W,MGUNIT ; SET UNIT + MOVSI A,%MACTH ; CORE ALLOC WANT QUIT TEMPORARLY + TDNE A,MSRAC(W) + JRST MGWRT4 + HRRZ A,MSBUFP(W) ; GET BUFFER POINTER + HLRZ B,MSBUFP(W) ; IN POINTER + SOS MSNBOL(W) ; ONE LESS BUFFER + MOVEM A,MGCABN(W) ; BUFFER ACTIVE AT PI + SKIPN MSCRW(W) ; WRITING + JRST 4,. + CAME A,B ; IN = OUT + JRST MGWRT1 + SETZM MSBUFP(W) ; EMPTY BUFFER LIST + JRST MGWRT2 + +MGWRT1: LDB B,[MLO,,MEMBLT(A)] ; BACK POINTER + HRRM B,MSBUFP(W) ; NEW OUT POINTER +MGWRT2: LDB B,[MWC,,MEMBLT(A)] ; WORD COUNT + MOVNS B ; NEGATE + HRLZS B ; FORM COUNT +IFN KL10P, LSH B,4 ; SHIFT IF KL10 DATA CHANNEL +IFN KL10P, MOVE R,A ; SAVE CORE PAGE NUMBER FOR CACHE SWEEP + LSH A,10. ; FORM WORD POINTER + SUBI A,1 + HRRM A,B ; CHANNEL POINTER IN B +IFN TM10B, DATAO MTS,[MICWA] ; SET TO GO TO MAG TAPE +IFN TM10A, PUSHJ Q,MGDCSO + MOVEM B,MIOWD + MOVEM B,LMIOWD ; LAST MIOWD + SETZM MIOWD+1 ; TELL CHANNEL TO STOP +IFN KL10P,[ + PUSHJ P,CSHSWP ; UNLOAD BUFFER FROM CACHE INTO CORE + CAI +] + MOVE B,MTCONO(W) + CONO MTC,MWRITE(B) ; DO IT + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGWBT ; WRITE BLANK TAPE AND TRY AGAIN +MGWRT3: MOVE A,MGCABN(W) ; GET BUFFER NUMBER + HRLZI B,%MAETW+%MAERR ; END OF TAPE CHECK + TRNE J,4000 ; END POINT + IORM B,MSRAC(W) ; TELL MP + LDB T,[MUR,,MEMBLT(A)] + CAIE T,MUMGB ; DO I OWN BLOCK + JRST 4,. + SETOM MGCABN(W) ; NO BUFFER ACTIVE AT PI + PUSHJ P,IMEMR ; GIVE BACK BUFFER + MOVSI A,%MAMSO + IORM A,MSRAC(W) ; TAPE MOVEMENT + JRST MGCMDR + +MGWBT: +IFN TM10B, SETZM MIOWD ; WRITE BLANK TAPE OVER POSSIBLE BAD SPOT +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] + TRNE J,644010 ; BAD TYPES OF ERRORS + JRST MGERR + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ; REVERSE 1 RECORD + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGERR ; ERROR + MOVE B,LMIOWD + MOVEM B,MIOWD ; RESTORE MIOWD + MOVE B,MTCONO(W) + CONO MTC,14000(B) ; WRITE WITH EXTENDED EOR + PUSHJ Q,MGWTJD ; WAIT + JRST MGWBT ; INFINITE RETRIES ; JRST MGERR ; ERRORS + JRST MGWRT3 + +MGWRT4: PUSHJ Q,CPOPJ ; WAIT A WHILE + JRST MGWRIT + +SUBTTL MAG TAPE PI LEVEL READ + +MGREAD: PUSHJ Q,MGGXPT ; GET XPORT +MGRD0: TRNE J,600000 ; UNIT HUNG OR REWINDING OR EOT + JRST MGERR + MOVE B,MGEOFR(W) ; EOF'S READ + CAIL B,2 + JRST MGERR + MOVEM W,MGUNIT ; STORE UNIT NUMBER + SKIPE MSCRW(W) ; MAKE SURE READING + JRST 4,. + MOVSI B,%MACTH ; CORE ALLOCATOR WANT OUT + TDNN B,MSRAC(W) + PUSHJ P,IOMQ + JRST MGROVR ; WAIT FOR IT + MOVEM A,MGCABN(W) ; STORE ACTIVE BUFFER AT PI LEVEL + MOVEI B,MUMGB + DPB B,[MUR,,MEMBLT(A)] ; CLAIM BLOCK + HRREI B,-MGNRTY ; NUMBER OF RETRIES + MOVEM B,MGERRC(W) ; STORE ERROR COUNT +IFN KL10P, MOVE R,A + LSH A,10. ; FORM ADDRESS + SUBI A,1 +IFE KL10P, HRLI B,-2000 +IFN KL10P, HRLI B,-2000_4 + HRR B,A + MOVEM B,LMIOWD ; STORE LAST IOWD FOR RETRY +IFN TM10B, DATAO MTS,[MICWA] ; SET CHANNEL STARTING ADDRESS +IFN TM10A, PUSHJ Q,MGDCSI +IFN TM10B, SETZM MICWA+1 + SETZM MIOWD+1 +MGRD1: MOVEM B,MIOWD ; CHANNEL COMMAND + MOVEI B,2000 + MOVEM B,MGNWRD ; ASSUME AT FIRST THAT THE RECORD TO BE READ HAS 2000 WORDS +IFN KL10P,[ + PUSHJ P,CSHSWP ; ENSURE NO RESIDUE OF THIS PAGE IN CACHE + CAIA +] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ; DO IT +IFN TM10B, SETOM MGWCW ; TELL IT TO WAIT FOR CONTROL WORD WRITTEN + PUSHJ Q,MGWTJD ; WAIT FOR JOB DONE + JRST MGRERR +MGRD2: SKIPG A,MGCABN(W) + BUG ;BUFFER SHOULDN'T BE -1, WOULD SCREW UP MEMBLT + SETOM MGCABN(W) ; NO BUFFER ACTIVE AT PI + HLRZ T,MSBUFP(W) ;LAST BUFFER IN + SETZM B + DPB B,[MLO,,MEMBLT(A)] ; BACK POINTER IS 0 + SKIPG MSNBOL(W) + HRRM A,MSBUFP(W) ; ONE BUFFER MEANS IN = OUT + HRLM A,MSBUFP(W) ; NEW IN POINTER + SKIPLE MSNBOL(W) + DPB A,[MLO,,MEMBLT(T)] ; CHAIN BACK BUFFERS + AOS C,MSNBOL(W) ; ONE MORE BUFFER ON LIST (COUNT TO C) + MOVE B,MGNWRD + DPB B,[MWC,,MEMBLT(A)] ; NUMBER OF WORDS IN BUFFER + TRNE J,10000 ;EOF? + JRST [ MOVSI B,%MAESO+%MAEFA ;YES + IORM B,MSRAC(W) + SETO B, + DPB B,[MSEOFP,,MEMBLT(A)] + AOS A,MGEOFR(W) + CAIL A,2 + JRST MGRD4 ; LOGICAL EOT, SPACE BACK OVER IT + JRST .+2 ] + SETZM MGEOFR(W) ; NO EOF + MOVSI A,%MAMSO + IORB A,MSRAC(W) ; TAPE MOVEMENT + TRNE J,4000 ; EOT? + JRST MGRD3 + TRNN J,10000 ;IF NO EOF, NOT 6 BUFFERS YET, + CAIL C,6 + JRST MGRD5 + TLNN A,%MASTP + JRST MGRD0 ; AND NO REQUEST TO STOP, KEEP READING +MGRD5: MOVSI A,%MASTP+%MARAC ;GIVE UP FOR NOW, CLEAR READ ACTIVE + ANDCAM A,MSRAC(W) + JRST MGCMDR ;MP LEVEL WILL SEND NEW READ COMMAND WHEN READY + +MGRD3: DPB B,[MSEOFP,,MEMBLT(A)] ;PHYSICAL EOT + DPB B,[420100,,MSRAC(W)] .SEE %MAETR ; INDICATE EOT ON READ + JRST MGRD5 ; RETURN + +MGRD4: MOVSI A,%MAESO+%MARAC+%MASTP ;SECOND EOF, LOGICAL EOT + ANDCAM A,MSRAC(W) + JRST MGSPRF + +MGRERR: +IFN TM10B,[ + TLNE J,160 + JRST MGERR ; CHANNEL ERROR +] + TRNE J,642000 + JRST MGERR + TRNE J,20600 + JRST MGMRT ; DATA TYPE OF ERROR OR OVERRUN, MAYBE TRY AGAIN +;RECORD LENGTH ERROR, ADJUST MGNWRD +IFN TM10B, HRRZ A,MICWA+1 +IFN TM10A, HRRZ A,MIOWD + HRRZ B,LMIOWD + SUB A,B +IFN TM10B, SOS A ; CHANNEL FUNNYNESS + CAIN A,1 ; POS EOF IS ALL + JRST MGRER2 +MGRER1: MOVEM A,MGNWRD + JRST MGRD2 + +MGRER2: TRNE J,14000 ; 1 WORD, EOF? EOT? + SETZM A ; YES, THIS RECORD HAS ZERO LENGTH, IT JUST CARRIES MSEOFP + JRST MGRER1 + +MGMRT: AOSL MGERRC(W) + JRST MGERR ; TOO MANY ERRORS +IFN TM10B, SETZM MIOWD +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ; REVERSE RECORD + PUSHJ Q,MGWTJD + JRST MGERR ; NO ERRORS ALLOWED +IFN TM10A, PUSHJ Q,MGDCSI ; PUT BACK PI 1 BLKI + MOVE B,LMIOWD + JRST MGRD1 ; TRY AGAIN + +MGROVR: PUSHJ Q,CPOPJ + JRST MGREAD + +SUBTTL MAG TAPE PI LEVEL SPACE + +MGSPCF: PUSHJ Q,MGGXPT ; GET XPORT SPACE FORWARD + TRNE J,600000 + JRST MGERR +MGSPC: MOVEM W,MGUNIT + MOVE B,MGRWCD(W) ; GET COMMAND + ADD B,MTCONO(W) +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + CONO MTC,(B) ; DO IT + PUSHJ Q,MGWTJD + JRST MGERR ; NO RETRIES + TRNN J,10000 ; EOF + SETZB B,MGEOFR(W) + TRNE J,10000 + AOS B,MGEOFR(W) + CAIL B,2 ;TOO MANY EOF'S + JRST MGSPRF +MGCMDR: SOS MSCMDC(W) ; GENERAL EXIT ROUTINE + SETOM MGUNIT + SKIPG MSCMDC(W) + POPJ P, ; NO MORE + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ; INTERUPT WHEN UNIT READY + MOVEM W,MGUNIT ; RESTORE UNIT NUMBER + PUSHJ Q,MGWTJD + JRST MGERR + SETOM MGUNIT + POPJ Q, ; MORE + +MGSPFR: MOVEI B,MSPFR ; SPACE FOR RECORD + MOVEM B,MGRWCD(W) + MOVSI B,%MAMSO + IORM B,MSRAC(W) ; TAPE MOVEMENT + JRST MGSPCF + +MGSPFF: MOVSI B,%MAESO + TDZE B,MSRAC(W) + JRST MGCMDR ; EOF ALREADY READ DURING THE READ + AOS MSCMDC(W) ;SO IT WILL RETURN + MOVEI B,MSPFR + MOVEM B,MGRWCD(W) + PUSHJ Q,MGSPCF + SKIPE MGEOFR(W) + JRST MGCMDR ; EOF READ ON SPACE RECORD. DONE + MOVEI B,MSPFF + MOVEM B,MGRWCD(W) + JRST MGSPCF + +MGSPRR: MOVEI B,MSPRR + MOVEM B,MGRWCD(W) + MOVSI B,%MAMSO + IORM B,MSRAC(W) + JRST MGSPCR + +MGSPCR: PUSHJ Q,MGGXPT ; SPACE REVERSE + TRNE J,600000 ; ERR + JRST MGERR + TRNE J,100000 ; BOT + JRST MGCMDR ; THEN DO NOTHING + MOVEM W,MGUNIT + MOVE B,MGRWCD(W) + ADD B,MTCONO(W) +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + CONO MTC,(B) + PUSHJ Q,MGWTJD + JRST MGERR + TRNE J,10000 + SOSGE MGEOFR(W) ; ONE LESS EOF + SETZM MGEOFR(W) + JRST MGCMDR + +MGSPRF: MOVEI B,MSPRF ; REVERSE FILE + MOVEM B,MGRWCD(W) + MOVSI A,%MAESO ; EOF READ IN FORWARD DIRECTION + TDNN A,MSRAC(W) + JRST MGSPCR + AOS MSCMDC(W) ; YES DO IT TWICE + PUSHJ Q,MGSPCR + MOVSI B,%MAESO + ANDCAM B,MSRAC(W) ; TURN OFF FLAG + JRST MGSPCR ; SECOND TIME + +MGRWD1: PUSHJ Q,MGGXPT ; REWIND + MOVEM W,MGUNIT + MOVE B,MGRWCD(W) ; GET COMMAND + ADD B,MTCONO(W) + CONO MTC,(B) + PUSHJ Q,MGWTJD ; WAIT + JRST MGERR + SETZM MGEOFR(W) + MOVSI A,%MAMSO + ANDCAM A,MSRAC(W) ;CLEAR TAPE MOTION +MGRWD2: TRNN J,200000 ; STILL REWINDING? + JRST MGRWD3 ; NO + PUSHJ Q,CPOPJ ; WAIT + CONI MTS,J + MOVEM J,MGCMTS(W) + JRST MGRWD2 + +MGRWD3: MOVE T,TIME ;WAIT 1 SECOND MORE + ADDI T,30. ;THIS IS AN ATTEMPT TO FIX A HARDWARE BUG + MOVEM T,MGJDTI +MGRWD4: MOVE T,TIME + CAML T,MGJDTI + JRST [ SETZM MGJDTI + POPJ Q, ] + PUSHJ Q,CPOPJ + JRST MGRWD4 + +MGRWND: MOVEI B,MREWND ; NORMAL REWIND + CAIA +MGRWDM: MOVEI B,MRWNDD ; REWIND AND DISMOUNT + MOVEM B,MGRWCD(W) + PUSHJ Q,MGRWD1 + MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) + JRST MGCMDR + +MGSEOT: PUSHJ Q,MGGXPT ; SKIP TO LOGICAL EOT + TRNE J,600000 + JRST MGERR + MOVEM W,MGUNIT + TRNE J,100000 ; BOT? + JRST MGVTCK ; VIRGIN TAPE CHECK +MGNVT: MOVE B,MTCONO(W) +IFN TM10A,[ + PUSHJ Q,MGDCSO + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] +IFN TM10B, SETZM MIOWD + CONO MTC,MSPRR(B) ; SPACE REVERSE FIRST + PUSHJ Q,MGWTJD ; WAIT + JRST MGERR + SETZM MGEOFR(W) + AOS MGEOFR(W) +MGEOT2: MOVE B,MTCONO(W) + CONO MTC,MSPFF(B) ; SKIP FORWARD FILE + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAETR ; EOT CHECK + TRNE J,4000 + IORM B,MSRAC(W) ; TELL MP + MOVE B,MTCONO(W) +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ; ONE RECORD +] +IFN TM10B, SETZM MIOWD + CONO MTC,MSPFR(B) ; SPACE FORWARD RECORD + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAETR ; EOT AGAIN + TRNE J,4000 + IORM B,MSRAC(W) ; TELL MP + TRNN J,10000 ; EOF ALSO? + JRST MGEOT2 ; NO, TRY AGAIN + MOVE B,MTCONO(W) ; YES, NOW GO BACK OVER LAST + CONO MTC,MSPRF(B) + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI B,%MAEOF+%MAETR ; TELL MP,EOF + IORM B,MSRAC(W) + JRST MGCMDR + +MGVTCK: MOVE T,TIME + ADDI T,60. ; TWO SECOND TIME OUT + MOVEM T,MGEOTT(W) ; EOT TIME +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ; DO READ, WAIT EITHER FOR JOB DONE OR TIME OUT +MGVTC1: CONI MTS,J + MOVEM J,MGCMTS(W) + TRNE J,100 ; J D? + JRST MGNVT ; NOT VIRGIN TAPE + TRNE J,440000 + JRST MGERR ; ERRORS? + MOVE T,MGEOTT(W) + CAMG T,TIME ; TIME UP? + JRST MGVT ; YES + PUSHJ Q,CPOPJ ; WAIT + JRST MGVTC1 + +MGVT: MOVE B,MTCONO(W) + CONO MTS,31 + CONO MTC,MNOPIN(B) ; NO-OP WAIT FOR JOB DONE + PUSHJ Q,MGWTJD + JFCL ; SEE IF I CARE IF THERE ARE ERRORS + MOVEI B,MREWND + MOVEM B,MGRWCD(W) + PUSHJ Q,MGRWD1 ; REWIND + SETZM MGEOFR(W) + AOS MGEOFR(W) + JRST MGCMDR ; RETURN + +MGMEOT: PUSHJ Q,MGGXPT + TRNE J,600000 + JRST MGERR + MOVEM W,MGUNIT + SKIPE MTCEFW(W) ;HOW MANY EOF WRITTEN? + JRST MGMET1 + AOS MSCMDC(W) ; SO WILL RETURN + AOS MTCEFW(W) + PUSHJ Q,MGWEOF +MGMET1: MOVE A,MTCEFW(W) + SOSLE A + JRST MGMET2 + AOS MSCMDC(W) + AOS MTCEFW(W) + PUSHJ Q,MGWEOF +MGMET2: MOVE A,MSRAC(W) + TLNE A,%MANWT ; BACK OVER LAST? + JRST MGMET3 ; NO + AOS MSCMDC(W) ; SO IT WILL RETURN + PUSHJ Q,MGSPRF +MGMET3: MOVSI A,%MANWT + IORM A,MSRAC(W) + JRST MGCMDR ; DONE + +; WRITE EOF +MGWEOF: PUSHJ Q,MGGXPT + TRNE J,600010 + JRST MGERR + MOVEM W,MGUNIT + MOVE B,MTCONO(W) + CONO MTC,MWEOF(B) + PUSHJ Q,MGWTJD + JRST MGERR + MOVSI A,%MAMSO + IORM A,MSRAC(W) ; TAPE MOVEMENT + JRST MGCMDR ; RETURN + +MGSTAT: PUSHJ Q,MGGXPT ; GETS STATUS + JRST MGCMDR + +MGW3IN: PUSHJ Q,MGGXPT + TRNE J,600010 + JRST MGERR + MOVEM W,MGUNIT +IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] +] +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO +] + MOVE B,MTCONO(W) + CONO MTC,MW3IN(B) ; WRITE THE RANDOM WORD PRECEEDED BY 3 INCHES OF BLANK TAPE + PUSHJ Q,MGWTJD + JFCL ; ALLOW BAD TAPE ERROR + JRST MGSPRR ; NOW SPACE RECORD REVERSE OVER THE ONE WORD + +SUBTTL .MTAPE UUO + +;.MTAPE AC, +; AC/ CHNM,COMMAND +; COMMAND/ COUNT,,FUNCTION + +AMTAPE: XCTR XR,[HLRZ R,(J)] + TRNE R,-NIOCHN + JRST ILUUO + HRRZM R,UUAC(U) ; SO THAT ERRORS WILL BE REPORTED ON THE + ; CORRECT CHANNEL + ADDI R,IOCHNM(U) ; FORM IOCHNM POINTER + HRRZ A,(R) ; A: CLSTB/IOTTB index + CAIL A,MTUAIX ; Min index for tape + CAILE A,MTBOX ; Max + POPJ P, ; Laconic error reportage. + LDB W,[MTXP(R)] ; GET XPORT NUMBER + CAME U,MTUSR(W) ; SAME USER + POPJ P, ; NO + UMOVE J,(J) + MOVEM J,MTMTAP(W) ; SAVE J + HRRZ A,MTMTAP(W) + PUSHJ P,MTIECK + UMOVE A,(A) + HRRZM A,MTMFNC(W) ;STORE FUNCTION + HLREM A,MTMCNT(W) ;AND COUNT + SKIPN MTMCNT(W) ;A COUNT OF ZERO ALWAYS MEANS ONE, FOR COMPATIBILITY + AOS MTMCNT(W) ; WITH THE OLD CODE. + HRRZS A + CAIL A,NMTAPC ; LEGAL COMMAND + POPJ P, ; NO + AOS (P) ; SKIP RETURN + JRST @MTAPDT(A) + +MTAPDT: MTHANG ;0 HANG TILL TAPE MOTION DONE + MTRWND ;1 REWIND + MTRWDM ;2 REWIND AND DISMOUNT + MTWEOR ;3 WRITE EOR IF APPROPRIATE + MTW3IN ;4 WRITE 3 INCHES OF BLANK TAPE + MTWEOF ;5 WRITE EOF + MTSPR ;6 SPACE RECORDS + MTSPF ;7 SPACE FILES + MTSPEOT ;10 SPACE TO EOT + MTSTOP ;11 STOP ALL COMMAND ASSOCIATED WITH THIS COMMAND + MTSBKS ;12 SET BLOCK SIZE (TO COUNT) + MTRBKS ;13 READ BLOCK SIZE (TO AC) +NMTAPC==.-MTAPDT + +MTSBKS: MOVE A,MTMCNT(W) ;DESIRED BLOCKSIZE + CAIL A,4 ;CHECK REASONABLENESS + CAILE A,2000 + SOSA (P) ;FAIL IF TOO BIG OR TOO SMALL + MOVEM A,MTBLKS(W) ;OK, CHANGE WRITE-BUFFER SIZE + POPJ P, + +MTRBKS: MOVE A,MTBLKS(W) + JRST APTUAJ + +MTHANG: SKIPLE MSCMDC(W) ; HANG UNTILL ALL MOTION FINISHED + PUSHJ P,UFLS + JRST MTIECK + +MTRWND: MOVEI B,MGRWND ; REWIND +MTRWD1: SKIPE MSCRW(W) + JRST MTSOSP + MOVSI A,%MAREW + IORM A,MSRAC(W) + JRST MTCMD + +MTRWDM: MOVEI B,MGRWDM ; REWIND AND DISMOUNT + JRST MTRWD1 + +;"WRITE END OF RECORD" - THIS IS REALLY THE FORCE SYSTEM CALL, OR SHOULD BE. +MTWEOR: SKIPG MTMDN(W) ; ANY BUFFERS STARTED + POPJ P, ; NO + SKIPE MSCRW(W) ; WRITING + JRST MTWBFD ; DISCARD BUFFER +MTSOSP: SOS (P) ; NOT WRITING, ERROR + POPJ P, + +MTWEOF: SKIPN MSCRW(W) ; WRITING? + JRST MTSOSP ; NO + PUSHJ P,MTWEOR + MOVEI B,MGWEOF ; WRITE EOF + AOS MTCEFW(W) + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) ; SOMETHING WRITTEN + JRST MTCMD + +MTW3IN: SKIPN MSCRW(W) ; WRITING? + JRST MTSOSP + MOVEI B,MGW3IN + SETZM MTCEFW(W) + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) + JRST MTCMD + +;SPACE RECORDS, +=FORWARD, -=BACK +MTSPR: SKIPE MSCRW(W) ; NOT ALLOWED IF WRITING + JRST MTSOSP + PUSHJ P,MTFLRA ;FLUSH READ-AHEAD, FIND OUT HOW FAR OFF WE ARE + ADD B,C ;NUMBER OF RECORDS TAPE IS AHEAD OF USER (EOF=RECORD) + MOVNS B ;SUBTRACT THIS FROM USER'S REQUEST + ADDB B,MTMCNT(W) + JUMPE B,CPOPJ ;IF COUNT IS NOW ZERO, WE ARE DONE +MTSPR1: PUSHJ P,MTCNTR ;UPDATE USER'S COPY IN CASE PCLSR + JUMPG B,MTSPFR ; SPACE FORWARD + MOVEI B,MGSPRR ; SPACE REVERSE + PUSHJ P,MTCMD + AOSGE B,MTMCNT(W) + JRST MTSPR1 ;MORE + POPJ P, + +MTSPFR: MOVEI B,MGSPFR + PUSHJ P,MTCMD + SOSLE B,MTMCNT(W) + JRST MTSPR1 ;MORE + POPJ P, + +;THIS ROUTINE FLUSHES READAHEAD. CALL BEFORE DOING A SPACING OPERATION +;THIS DOESN'T ACTUALLY UNDO THE EFFECT ON THE DRIVE +;OF THE READ-AHEAD. IT DOES MAKE SURE THAT READ-AHEAD'S EFFECT CAN'T +;CHANGE, THEN RETURNS IN B THE NUMBER OF RECORDS AHEAD (NON-NEGATIVE) +;AND IN C THE NUMBER OF EOF'S AHEAD (0 OR 1). IF CALLED TWICE IT WILL +;RETURN ZERO THE SECOND TIME. BE SURE TO UPDATE YOUR PARAMETERS. +MTFLRA: PUSHJ P,MTCNTR ;FIRST, ENSURE WRITEABILITY, MUSTN'T PCLSR IN MTCNTR LATER + MOVSI B,%MASTP + MOVSI T,%MARAC + IORM B,MSRAC(W) ;IF READ IS ACTIVE, TELL IT TO STOP + TDNE T,MSRAC(W) ;AWAIT CESSATION OF READ + PUSHJ P,UFLS ;IF THIS PCLSR'S OUT WITH %MASTP SET, NO GREAT HARM DONE. + ANDCAM B,MSRAC(W) ;THEN TURN OFF %MASTP, THINGS ARE NOW QUIET + SKIPLE MSCMDC(W) ;BEFORE MESSING WITH BUFFERS, WAIT FOR PI TO QUIESCE + PUSHJ P,UFLS + MOVE B,MSNBOL(W) ;NUMBER OF BUFFERS = NUMBER OF RECORDS + LDB C,[.BP (%MAEFA),MSRAC(W)] ;1 IF PAST EOF WHICH THE USER DOESN'T KNOW ABOUT + MOVSI T,%MAEFA ;NOW GET RID OF THE READ-AHEAD + ANDCAM T,MSRAC(W) + JRST MTCBFF + +MTSPF: SKIPE MSCRW(W) ; NOT ALLOWED IF WRITING + JRST MTSOSP + PUSHJ P,MTFLRA ;FLUSH READ-AHEAD + MOVN B,C ;NUMBER OF FILES TAPE IS AHEAD OF USER + ADDB B,MTMCNT(W) + JUMPE B,CPOPJ ;DONE +MTSPF1: PUSHJ P,MTCNTR ;UPDATE USER'S COUNT IN CASE OF PCLSR + JUMPG B,MTSPFF ; SPACE FORWARD FILES + MOVEI B,MGSPRF + PUSHJ P,MTCMD + AOSGE B,MTMCNT(W) + JRST MTSPF1 ;MORE + POPJ P, + +MTSPFF: MOVEI B,MGSPFF + PUSHJ P,MTCMD + SOSLE B,MTMCNT(W) + JRST MTSPF1 ;MORE + POPJ P, + +MTCNTR: HRRZ A,MTMTAP(W) + MOVE T,MTMFNC(W) + HRL T,MTMCNT(W) + UMOVEM T,(A) + POPJ P, + +MTSTAT: SKIPLE MSCMDC(W) ; WAIT TILL ALL COMMANDS DONE + PUSHJ P,UFLS + MOVEI B,MGSTAT ; GET CONI'S + PUSHJ P,MTCMD ; GIVE TO PI + SKIPLE MSCMDC(W) ; WAIT TILL DONE + PUSHJ P,UFLS + MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) + POPJ P, + +MTSPEOT: MOVEI B,MGSEOT ; SPACE TO LOGICAL EOT + JRST MTCMD ;NOTE THIS IS INDEPENDENT OF READ-AHEAD + +MTSTOP: CONO PI,UTCOFF ;THIS DOESN'T DEAL WITH READ-AHEAD, PROBABLY OK + SETZM MSCMDC(W) ;NO MORE COMANDS + MOVE Q,[-MGQDLL,,MGQD0-1] + MOVE T,MSLCTB + IMUL T,W + ADD Q,T + MOVEM Q,MGQDLP(W) ; RESTORE Q + MOVE Q,[-MSCBL-1,,MSCB0-1] + ADD Q,T + MOVEM Q,MTCMBP(W) ; INITIALIZE MP AND PI COMAND POINTERS + MOVE Q,[4400,,MSCB0-1] + ADD Q,T + MOVEM Q,MGCMBP(W) + SKIPL A,MTMDN(W) + PUSHJ P,IMEMR ; RELEASE MP BUFFER + SETOM MTMDN(W) + SETZM MSMPRP(W) + SETZM MSMPRC(W) ; SO BLKT WON'T GET UNHAPPY + PUSHJ P,MTCBFF ; FLUSH BUFFER LIST + CAME W,MGUNIT ; SAME UNIT? + JRST UTCONJ + SETOM MGUNIT ; SO INTERUPT WILL GO AWAY + CONI MTC,I ; SEE WHAT DRIVE IS BEING TALKED TO + LDB B,[MUNITF,,I] + CAME W,B + JRST UTCONJ ; IF NOT SAME UNIT, DON'T DO ANYTHING + MOVE B,MTCONO(W) + CONO MTS,31 ; STOP THE TAPE + CONO MTC,(B) ; CLEAR INTERUPTS + SKIPGE A,MGCABN(W) ; ANY BUFFERS ACTIVE AT PI + JRST UTCONJ ; NO + PUSHJ P,IMEMR ; RETURN IT + SETOM MGCABN(W) + JRST UTCONJ + +SUBTTL MAG TAPE CLOSE ROUTINES + +MTOCL: LDB W,[MTXP(R)] + SOSL MTUSE(W) + POPJ P, ; NOT ONLY CHANNEL OPEN + AOS MTUSE(W) ; INCASE PCLSRED + MOVSI A,%MAERR ;ERROR? + TDNE A,MSRAC(W) + PUSHJ P,MTOCL3 +; MOVEI T,MSCBL-4 +; CAMG T,MSCMDC(W) +; PUSHJ P,UFLS ; WAIT FOR ROOM FOR THREE COMMANDS + SKIPL MTMDN(W) ; MAG TAPE OUTPUT CLOSE + PUSHJ P,MTWBFD ; WRITE OUT BUFFERS +; MOVEI B,MGWEOF ; WRITE OUT TWO EOF(S) +; SKIPE MTCEFW(W) +; JRST MTOCL2 ; MAY HAVE BEEN PCLSRED +;MTOCL1: PUSHJ P,MTCMD +; AOS MTCEFW(W) ; ONE MORE CLOSE EOF WRITTEN +;MTOCL2: MOVE A,MTCEFW(W) +; SOSG A ; DON'T WRITE EOF IF PCLSRED +; PUSHJ P,MTCMD ; DO IT TWICE +; SKIPG A +; AOS MTCEFW(W) +; MOVEI B,MGSPRF +; MOVE A,MSRAC(W) +; TLNN A,1000 +; PUSHJ P,MTCMD ; NOW BACK UP OVER ONE +; MOVSI A,1000 +; IORM A,MSRAC(W) + MOVEI B,MGMEOT ; MAKE EOT + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) ; NOW WAIT TILL DONE + PUSHJ P,UFLS + MOVEI A,1 + MOVEM A,MGEOFR(W) + SKIPL MTMDN(W) ;ANY ACTIVE BUFFERS + JRST 4,. + SKIPL MGCABN(W) + JRST 4,. + SKIPE MSNBOL(W) + JRST 4,. + SETOM MTUSR(W) + SETOM MTUSE(W) + SETZM MSRAC(W) + POPJ P, + +MTOCL3: SKIPL A,MTMDN(W) + PUSHJ P,MEMR ; IF BUFFER AROUND,FLUSH IT + SETOM MTMDN(W) + SETZM MSMPRC(W) + POPJ P, + +MTICL: LDB W,[MTXP(R)] + SOSL MTUSE(W) ; LAST USER + POPJ P, + AOS MTUSE(W) + MOVEI T,1 + CAMGE T,MSCMDC(W) ; ALLOW ONE COMMAND IF REWINDING + PUSHJ P,UFLS ; ALL COMMANDS DONE + MOVE T,MSRAC(W) + TLNE T,%MAREW ; REWINDING? + JRST MTICL3 ; YES + SKIPLE MSCMDC(W) ; NO, WAIT TILL COMMAND DONE + PUSHJ P,UFLS +MTICL3: SKIPL MGCABN(W) ; ANY PI BUFFERS LEFT + JRST 4,. + PUSHJ P,MTRBD ;GET RID OF M.P. BUF, IF ANY + SETOM MTUSR(W) + PUSHJ P,MTCBFF ; FREE BUFFERS + SOS MTUSE(W) + MOVE T,MSRAC(W) + TLNE T,%MAREW ; DON'T HAVE TO SKIP TO EOF IF REWINDING + JRST MTICL2 + MOVSI A,20 + TDNE A,(R) ;CHECK TO SKIP TO EOF + JRST MTICL2 + MOVSI A,%MAMSO + TDNN A,MSRAC(W) ;TAPE MOVEMENT + JRST MTICL2 ; NO + SKIPE MGEOFR(W) ;NO TIMING CONFLECT HERE SINCE WE WAITED FOR PI TO CLEAR + JRST MTICL2 ;NOTE THAT THIS DISPOSES OF A READ-AHEAD EOF. + PUSHJ P,MTSTAT + MOVE B,MGCMTS(W) + TRNE B,100000 + JRST MTICL2 + MOVEI B,MGSPFF + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) + PUSHJ P,UFLS +MTICL2: MOVSI T,%MAREW + ANDM T,MSRAC(W) ;CLEAR ALL BUT REWINDING + POPJ P, ; NO, DONE + +MTCBFF: SKIPN MSNBOL(W) ;ANY BUFFERS ON CHAIN? + POPJ P, + HRRZ A,MSBUFP(W) ;YES, FREE ONE + PUSHJ P,MTICL1 ; FIX CHAIN + PUSHJ P,MEMR ; RETURN BUFFER + SOSLE MSNBOL(W) ;ANY MORE? + JRST MTCBFF + SETZM MSBUFP(W) ;EMPTY LIST + POPJ P, + +MTICL1: LDB T,[MLO,,MEMBLT(A)] ; GET BACK POINTER + HRRM T,MSBUFP(W) + POPJ P, diff --git a/system/ncp.9 b/system/ncp.9 new file mode 100644 index 0000000..24406b8 --- /dev/null +++ b/system/ncp.9 @@ -0,0 +1,2777 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SUBTTL ARPANET NCP variables and tables + +EBLK +IMPMQS==13. ;MESSAGE QUEUE SIZE (LENGTH WORD, 6-WORD LEADER, 6-WORD TEXT) +;MAIN PROGRAM CONTROL MESSAGE VARIABLES +IMPMPU: -1 ;-1 => FREE + 0 ;SWTL THREAD +IMPMPL: -1 ;LINK WORD FOR CONTROL LINK QUEUE +IMPMPC: BLOCK IMPMQS ;FIRST WORD HAS IMPHTB INDEX,,LENGTH OF TEXT + +;PI CONTROL MESSAGE VARIABLES +IMNPIC==NNETCH+3 ;NUMBER OF BLOCKS IN PI CONTROL QUEUE +;HOPEFULLY THIS IS ENOUGH. THE CODE RESPONDS VERY UNGRACEFULLY TO THIS +;QUEUE FILLING UP. IN PARTICULAR, WHEN IT HOLDS UP INPUT IT CAN CAUSE +;A DEADLOCK BY PREVENTING ITSELF FROM SEEING A CONTROL-LINK RFNM IT +;NEEDS IN ORDER TO SEND SOMETHING THAT'S IN THE QUEUE AND FREE UP SOME +;SPACE. FURTHERMORE THE IMP IS UNGRACEFUL AND WILL SOMETIMES REFUSE TO +;READ INPUT FROM US (EVEN IN THE MIDDLE OF A MESSAGE) UNTIL WE READ +;INPUT FROM IT. BUT WE DO THE SAME THING WHEN THIS QUEUE FILLS UP. +;FURTHERMORE SOMETIMES THE CORE JOB WILL WAIT FOR A NETWORK +;TRANSMISSION TO COMPLETE SO IT CAN MOVE A NETWORK BUFFER, HANGING THE +;ENTIRE SYSTEM. THE CORE-JOB WILL UNHANG AFTER THE IMP TIMES OUT AND +;FLASHES ITS READY LINE (SEE IMPBER). +;** BUT SOMETIMES THE IMP NEVER TIMES OUT AND SO THE SYSTEM IS HUNG ** + +IMPCQ: REPEAT IMNPIC-1,[ + .+IMPMQS+1 ;POINTER TO NEXT FREE OR NEXT IN QUEUE + BLOCK IMPMQS ;FIRST WORD HAS IMPHTB INDEX,,LENGTH OF TEXT +] + -1 + BLOCK IMPMQS +IMPNCQ: -1 ;NEXT ENTRY TO BE SENT. -1 IF NONE +IMPLCQ: -1 ;POINTER TO LAST ENTRY IN CONTROL QUEUE +IMFFCQ: IMPCQ ;POINTER TO FIRST FREE. -1 IF NONE +IMFCQL: IMNPIC ;NUMBER FREE CONTROL QUEUE ENTRIES LEFT + +;PENDING RFC QUEUE +IMNPQ==20 ;NUMBER OF PENDING QUEUE ENTRIES +;(0) POINTER TO NEXT IN CHAIN OR NEXT FREE. -1 IF NONE +;(1) LOCAL SOCKET NUMBER +;(2) FOREIGN SOCKET NUMBER +;(3) 4.9 = 1 => RTS = 0 => STR +; 1.1-1.8 = LINK NUMBER OR BYTE SIZE +; 1.9-2.7 = FOREIGN HOST NUMBER +; 3.1-3.9 = TIME RFC RECEIVED, IN SECONDS MOD 512. + IMPPQ ;IMPBPQ-1 IS BEGINNING OF GETSYS BLOCK, THIS WORD FOR UNRELOCATION +IMPBPQ: -1 ;BEGINNING OF PENDING QUEUE. -1 IF EMPTY +IMPPQ: REPEAT IMNPQ-1,[ + .+4 + BLOCK 3 +] + -1 + BLOCK 3 +IMPEPQ: -1 ;END OF PENDING QUEUE. -1 IF EMPTY (IMPEPQ IS END FOR GETSYS BLOCK) +IMFFPQ: IMPPQ ;FIRST FREE PENDING QUEUE ENTRY. -1 IF NONE + +;SOCKET TABLE + +IMSOKB: IMPSTL ;BEGIN OF GETSYS BLOCK, LENGTH STORED HERE + +IMSOC1: REPEAT IMPSTL,0 ;0 => FREE + ;>0 MEANS ALLOCATED, NOT SET UP YET + ;4.9 = 1 => SOCKET IN USE + ;4.8 = 1 => CHNL TRYING TO BE CLOSED + ;3.1-4.7 = MASK FOR CHANNEL SOCKET IS OPEN ON. + ;RH = USER INDEX + +IMSOC2: BLOCK IMPSTL ;1.1-4.5 = LOCAL SOCKET NUMBER + ;4.6-4.9 0 (MAKES COMPARISONS EASIER) +IMSOC3: BLOCK IMPSTL ;1.1-4.5 = FOREIGN SOCKET NUMBER + ;4.6-4.9 = 0 +IMSOC4: BLOCK IMPSTL ;3.1-3.8 = LINK NUMBER + ;3.9-4.7 = FOREIGN HOST NUMBER (IMPHTB INDEX) + ; 377 MEANS NOT USING ANY HOST + ;4.8 = SET BY RCV CLS - MAKES MATCH USING IMSCHD FAIL + ;4.9 = SEND THIS BUFFER NOW + .SEE %NS ;RH = SOCKET STATE +IMSOC5: BLOCK IMPSTL ;1.1 - 1.9 => TTY # OF STY, IF CONNECTED TO ONE. + ;2.1-2.9 = CLOSE-REASON + ;3.1-3.8 = CONNECTION BYTE SIZE + ;3.9 => ASCII MODE - 7 BIT + ;4.1 => ASCII MODE - 8 BIT + ;4.2 => 1 BIT BYTES + ;4.3 => NET INT (INR\INS) RECEIVED + ;4.4 => HAVE BEGUN COUNTING THE CLOSE TIME-OUT. + ;4.5 => CLOSED WHILE IN RFNM WAIT, EXPECT ANOTHER RFNM + ;4.6 => CONNECTED DIRECTLY TO A STY. + ;4.7 => DON'T BUFFER MORE OUTPUT THAN ALLOCATION + ;4.8 => STY WANTS WAKEUP AT 1/2 SEC CLK + ;4.9 => TRANSFER IN 32 BIT MODE +IMSOC6: BLOCK IMPSTL ;RH => BUFFER ADDRESS + ;4.9 => LOCKED BY CORE JOB + ;4.8 => ACTIVE AT PI LEVEL + ;4.7 => INPUT OCCURRED WHILE BUFFER LOCKED + ;3.1-3.8 => IOBFT INDEX (377 IF USING BIG BUFFER) +IMSOC7: BLOCK IMPSTL ;BIT ALLOCATION +IMSOC8: BLOCK IMPSTL ;MESSAGE ALLOCATION +IMSC7I: BLOCK IMPSTL ;AMT TO INCREASE BIT ALLOCATION BY IN NEXT ALLOC MSG (INPUT) + ;FOR OUTPUT, HAS NUMBER OF BITS IN BUFFER +IMSC8I: BLOCK IMPSTL ;AMT TO INCREASE MESSAGE ALLOCATION BY NEXT ALLOC MSG (INPUT) +IMSOCT: BLOCK IMPSTL ;TIME WHEN FIRST MESS PUT INTO BUF + ;(DURING INPUT HAS NUMBER OF DATA BYTES LEFT IN CUR MSG) + ;(DURING CLOSE HAS TIME TIME-OUT STARTED) +IMSMPP: BLOCK IMPSTL ;MAIN PROGRAM POINTER, ILDB OR IDPB FOR NEXT BYTE +IMSMPC: BLOCK IMPSTL ;MAIN PROGRAM COUNTER, FOR OUTPUT HAS NUMBER OF DATA + ; BYTES OF ROOM LEFT IN BUFFER. FOR INPUT HAS TOTAL + ; NUMBER OF DATA BYTES IN BUFFER. +IMSPIP: BLOCK IMPSTL ;INTERRUPT LEVEL POINTER, FOR OUTPUT ILDB TO GET NEXT + ; BYTE OUT AT P.I. LEVEL. FOR INPUT POINTS TO WHERE + ; HEADER WORD OF NEXT MESSAGE IN WILL BE STORED. +IMSBFE: BLOCK IMPSTL ;BYTE POINTER TO LAST BYTE IN BUFFER + ;USE CAILE X,@IMSBFE(I) TO CHECK A WORD ADDRESS +IMSOKE==.-1 ;END OF BLOCK FOR GETSYS CALL + +BBLK + +IMSCLN: 221000,,IMSOC4(I) ;LINK NUMBER +IMSCBS: 221000,,IMSOC5(I) ;BYTE SIZE +IMSCLS: 111100,,IMSOC5(I) ;CLOSE REASON +IMSCFH: 321000,,IMSOC4(I) ;FOREIGN HOST +IMSCHD: 222100,,IMSOC4(I) ;FOREIGN HOST AND LINK NUMBER + ; EXTRA BIT, SET WHEN RCV CLS +IMSCHL: 222000,,IMSOC4(I) ;FOREIGN HOST AND LINK WITHOUT EXTRA BIT + +NTRFCL: SIXBIT /NETRFC/ ;FOR ICP ON ANY SOCKET < 1000 +EBLK + 0 + +NETSRS==1000 ;SMALLEST USER RECEIVE SOCKET NUMBER +NRSOC: NETSRS ;NUMBER OF NEXT RECEIVE SOCKET TO BE GENERATED +NETOSW: -1 ;SWITCH LOCKED AT NET OPEN + 0 +NETHSW: -1 ;SWITCH LOCKED IF HACKING HOST TABLE (IMPHTB) + 0 +NETLST: 0 ;LIST OF USERS IN NETWORK OPEN CODE + +;INPUT BUFFER FORMAT: +;THE BUFFER IS CIRCULAR, AND EITHER 200 OR 2000 WORDS LONG. +;MAY CONTAIN SEVERAL MESSAGES. EACH CONSISTS OF A HEADER WORD CONTAINING +; THE NUMBER OF BYTES IN THE MESSAGE, FOLLOWED BY THE BYTES, FOLLOWED BY +; UNUSED BITS UP TO THE NEXT WORD BOUNDARY. THIS WEIRD FORMAT IS USED +; TO AVOID HAVING TO DO BYTE OPERATIONS AT P.I. LEVEL. +;A HEADER WORD OF -1 MEANS THAT THAT MESSAGE HAS NOT YET BEEN STORED. +;IMSPIP(I) ALWAYS CONTAINS THE ADDRESS OF A HEADER WORD OF -1. +;IMSMPP(I) HAS A BYTE POINTER TO THE NEXT DATA BYTE TO BE READ. +;P.I. LEVEL CAN STORE A MESSAGE INTO THE PART OF THE BUFFER FROM +;@IMSPIP TO @IMSMPP-1. +;IMSOCT(I) HAS THE NUMBER OF BYTES THAT MAIN PROGRAM LEVEL CAN +; READ BEFORE IT GETS TO THE END OF THE CURRENT MESSAGE AND HAS +; TO CHECK THE NEXT HEADER. +;IMSMPC(I) HAS THE TOTAL NUMBER OF DATA BYTES IN ALL THE MESSAGES +; IN THE BUFFER. + +;OUTPUT BUFFER FORMAT: +;THE BUFFER IS CIRCULAR, AND EITHER 200 OR 2000 WORDS LONG. +;IT SIMPLY CONTAINS A STRING OF BYTES. +;IMSMPP(I) HAS A BYTE POINTER TO WHERE THE NEXT BYTE TO BE OUTPUT WILL BE DEPOSITED. +;IMSPIP(I) HAS A BYTE POINTER TO WHERE THE NEXT BYTE TO BE SENT OUT AT P.I. +; LEVEL WILL COME FROM. P.I. LEVEL TRIES TO KEEP EVERYTHING ALIGNED ON +; WORD BOUNDARIES SO THAT IT DOESN'T HAVE TO DO BYTE OPERATIONS. +;IMSMPC(I) HAS THE NUMBER OF BYTES THAT MP LEVEL MAY STORE BEFORE RUNNING +; INTO OLD BYTES THAT HAVEN'T YET BEEN TRANSMITTED. +;IMSOCT(I) IS SET TO THE TIME THE FIRST BYTE IS PUT INTO THE BUFFER. +; IT IS CLEARED WHENEVER THE BUFFER GETS EMPTIED. + +BBLK + +SUBTTL ARPANET NCP Main Prog system call routines + +;NET .CALL RCHST/RFNAME +NETRCH: MOVEI W,8 ;WE RETURN 8 VALUES. + HRRE I,A + JUMPL I,NETRC3 ;NET WENT DOWN AFTER THIS CHANNEL WAS OPENED. + MOVE B,IMSOC2(I) ;LOCAL SOCKET NUMBER + MOVE C,IMSOC3(I) ;FOREIGN SOCKET NUMBER + LDB TT,IMSCFH ;FOREIGN HOST FOR 4TH WORD. + CAIN TT,377 + TDZA D,D ; 377 MEANS NOT USING ANY HOST +IFN 1,[ + JRST [MOVE D,A + MOVE A,IMPHTN(TT) ; Get host addr + TLO A,(NW%ARP) ; Make full HOSTS3 format + CALL CVH2NA ; Convert to HOSTS2 for compatibility + EXCH A,D + JRST .+1] +] ;IFN 1 +IFN 0,[ + TDZA Q,Q + MOVE Q,IMPHTN(TT) + LDB D,[112000,,Q] ;TRANSLATE NEW HOST NUMBER TO OLD + ANDI Q,377 ;IF IT WILL FIT IN OLD NOTATION + CAIGE D,100 + CAIL Q,4 + SKIPA D,IMPHTN(TT) + DPB Q,[060200,,D] +] ;IFN 0 + + LDB Q,IMSCBS ;GET BYTE SIZE FOR HERE AND BELOW +;FOLLOWING LINE HAS BEEN PUNTED, AN INCOMPATIBLE CHANGE +; DPB Q,[111100,,D] ;INTO 2.9-2.1 OF 4TH WORD + MOVE A,IMSOC5(I) ;RANDOM WORD + TLNE A,4000 ;SKIP IF 4.3 BIT OFF (NETWRK INT) + TLO D,400000 ;SET FOR USER + PUSHJ P,NETRC1 ;GET TIME IMP GOING DOWN, + HRR TT,IMSOC4(I) ;MERGE IN SOCKET STATE. + IMUL Q,IMSMPC(I) ;MULTIPLY BYTE SIZE BY BYTES AVAIL TO GET BITS AVAIL + LDB I,IMSCLS ;CLS REASON + POPJ P, + +NETRC3: MOVEI I,%NCNCP ;GIVE CLOSE REASON THAT OUR NCP WENT DOWN. +NETRC1: SKIPG TT,IMPDWN+1 ;SYS TIME AT WHICH IMP IS GOING DOWN + JRST NETRC2 + SUB TT,TIME ;(TIME TIL IMP DOWN -1=NOT. 0=DOWN, +=GOING DOWN, N/30. SEC) + SKIPG TT + MOVEI TT,1 ;IF SET TO GO DOWN, AND TIME "PASSED", SAY SOON IF NOT ALREADY DOWN +NETRC2: HRLZS TT + POPJ P, + +;NET .CALL STATUS - SOCKET STATE IN BITS 2.4-2.9 +STANET: TRNN A,400000 ;SKIP IF NET WENT DOWN ON THIS LOSER + SKIPA E,IMSOC4(A) ;GET STATE + MOVEI E,0 ;IF NCP WENT DOWN, STATE IS "CLOSED" + DPB E,[140600,,D] + POPJ P, + +;NET .CALL RESET - ONLY RESETS "INT FM NETWORK" BIT (INR/INS) +NETRS: HLRZ A,(R) ;GET LH IOCHNM + MOVSI B,4000 ;4.3 BIT + TRNN A,400000 ;SKIP IF SET TO -1 (NET WENT DOWN ON THIS CHAN) + ANDCAM B,IMSOC5(A) ;CLEAR BIT + POPJ P, + +;NET .CALL IOPUSH/IOPOP - ALTER THE CHANNEL-OPEN MASK IN IMSOC1. +NETIOP: HRRZ T,UUAC(U) + IMUL I,CHNBIT(T) ;PUSHING => 0; ELSE BIT FOR CHANNEL BEING POPPED. + HLRZ T,(R) ;GET SOCKET TABLE IDX + TRNN T,400000 ;SKIP IF NET WENT DOWN ON THIS LOSER + DPB I,[222000,,IMSOC1(T)] ;STORE MASK AWAY. + POPJ P, + +;NET .CALL WHYINT +;RESULTS ARE %WYNET, SOCKET STATE, BYTES AVAIL, CLS REASON +NETWHY: HRRE I,A ;GET IMSOC INDEX + MOVEI A,%WYNET ;FIRST RESULT IS DEVICE CODE + SETZB B,C ;SET UP RESULTS 2-4 IN CASE NCP WENT DOWN + MOVEI D,%NCNCP + JUMPL I,POPJ1 ;RETURN IF NCP WENT DOWN ON THIS LOSER + HRRZ B,IMSOC4(I) ;SECOND RESULT IS SOCKET STATE + MOVE Q,IMSOC5(I) + TLNE Q,4000 + TLO B,400000 ;SIGN OF SECOND RESULT SET IF NETWRK INT + TLNE Q,40000 ;DIRECT CONNECTED? + TDZA C,C ;YES, NO BYTES AVAILABLE FOR INPUT + MOVE C,IMSMPC(I) ;THIRD RESULT IS BYTES AVAILABLE + LDB D,IMSCLS ;FOURTH RESULT IS CLOSE REASON + JRST POPJ1 + +;AIDS TO NETWORK OPEN AND NETHST CALLS + +;SET THINGS UP AND ALLOCATE AN IMSOC INDEX. +;SKIP RETURNS WITH NETLST AND IMSOC1(I) LOCKED. +;OR, RETURNS NO-SKIP WITH NOTHING LOCKED AND AN ERROR SIGNALLED. +NETO00: PUSHJ P,LSTSET ;ADD THIS JOB TO LIST OF NET OPENERS + NETLST + PUSHJ P,SWTL ;GET AN IMSOC ENTRY TO GC-PROTECT OUR IMPHTB ENTRY + NETOSW + MOVSI I,-IMPSTL + SKIPE IMSOC1(I) + AOBJN I,.-1 + JUMPG I,OPNL6 ;DEVICE FULL + MOVEI H,377 ;NO HOST YET + DPB H,IMSCFH + HRRZM U,IMSOC1(I) ;IMSOC1 POSITIVE MEANS ALLOCATED BUT NOT INITED YET + PUSHJ P,LSWPOP ;NETOSW + PUSHJ P,LOSSET ;RETURN IMSOC ENTRY IF PCLSR + NETIRT + JRST POPJ1 + +;LOSSET ROUTINE TO RETURN IMSOC ENTRY +NETIRT: MOVE T,AC0S+I(U) + HRRZ A,U + CAME A,IMSOC1(T) + JRST 4,. + SETZM IMSOC1(T) + POPJ P, + +;SUBROUTINE TO OPEN UP COMMUNICATIONS WITH THE DESIRED HOST. +;ENTER WITH HOST NUMBER IN SRN3(U), SKIP-RETURN WITH HOST +;UP AND IMPHTB INDEX IN H AND IMSCFH. OR NON-SKIP RETURN WITH ERROR SIGNALLED. +NETOR: MOVE T,SRN3(U) ;USER-SPECIFIED HOST NUMBER + JSP J,STDHST ;STANDARDIZE, OPNL25 IF IT IS NO GOOD + CONO PI,NETOFF + PUSHJ P,FNDHST ;H GETS HOST TABLE INDEX + JRST OPNL6 ;DEVICE FULL (HOST TABLE FULL) + DPB H,IMSCFH ;PROTECT IN IMSOC4 + CONO PI,NETON + PUSHJ P,SWTL ;POSSIBLY SEND RST TO HOST OPENING CONNECTION TO + NETHSW + LDB J,IMHSBT ;GET STATUS + SOJG J,NETORS ;-1 => DOWN, 0 => RST SENT, 1 => UP + JUMPE J,NETOR1 ;WAIT FOR REPLY + PUSHJ P,NETOW ;WAIT FOR IMPMPC TO BE FREE + LDB W,[051100,,TIME] + DPB W,[221100,,IMPHTB(H)] + MOVEI J,1 + DPB J,IMHSBT ;MARK AS SENT + AOS IMRFCT + PUSHJ P,STHSTM ;STORE HOST#, LINK 0 , MESSAGE TYPE 0 + MOVE W,[8_24.+1_8] ;BYTE SIZE = 8, BYTE COUNT = 1 + MOVEM W,IMPMPC+6 + MOVE W,[12._28.] ;RST + MOVEM W,IMPMPC+7 + MOVEI W,1 + HRRM W,IMPMPC ;MESSAGE LENGTH + PUSHJ P,IMPMPQ ;SEND IT OUT +NETOR1: PUSHJ P,LSWPOP ;NETHSW + PCLT + MOVSI T,1000 + TDNE T,IMPHTB(H) ;RRP -> 2000, DOWN -> 0000 + PUSHJ P,UFLS + LDB J,IMHSBT ;GET STATUS + SOJL J,OPNL41 ;HOST DOWN + JUMPE J,NETOR ;TRY ALL THIS AGAIN + JRST POPJ1 ;HOST UP + +NETORS: PUSHJ P,LSWPOP ;NETHSW + JRST POPJ1 ;HOST IS UP + +;NETWORK OPEN + +; .OPEN CH,BLK +; ERROR RETURN +; NORMAL RETURN + +;BLK: MODE BITS,,(SIXBIT /NET/) +; LOCAL SOCKET NUMBER (1.1-4.5) +; FOREIGN SOCKET NUMBER (1.1-4.5) +; FOREIGN HOST NUMBER + +;BLK: 3.1-3.3 => STANDARD ASCII/IMAGE, UNIT/BLOCK, INPUT/OUTPUT +; 3.4 = 1 => GENERATE UNIQUE LOCAL RECEIVE (SEND) SOCKET NUMBER +; 3.4 = 0 => USE LOCAL SOCKET NUMBER SPECIFIED IN BLK+1 +; 3.5 => OPEN SOCKET IN LISTEN MODE +; 3.6 => IF IMAGE MODE, USE BYTE SIZE IN 4.1-4.6 +; IF ASCII MODE, USE 8 BIT BYTES RATHER THAN 7 +; 3.7 => USE BIG BUFFER (2000 WORDS INSTEAD OF 200) +; 3.8 => DON'T BUFFER MORE OUTPUT THAN ALLOCATION +; 4.1-4.6 = BYTE SIZE IN IMAGE MODE + + +;OPEN CODE +NETO: SKIPN IMPUP + JRST NETOUP + SKIPL IMPUP + JRST OPNL7 ;DEVICE NOT READY + CONO PI,NETOFF + SKIPN IMPTCU + AOS IMPTCU + CONO PI,NETON + MOVSI I,SCLIMP + IORM I,SUPCOR ;HAVE SYS JOB BRING UP THE NETWORK + PCLT + SKIPE IMPTCU ;WAIT WHILE IT TRIES TO COME UP + PUSHJ P,UFLS + SKIPE IMPUP + JRST OPNL7 ;LOSE IF NOT UP BY NOW +NETOUP: TLZ A,740000 ;IGNORE EXTRA BITS IN SOCKET NUMBERS + TLZ B,740000 + PUSHJ P,NETO00 ;INITIALIZE THINGS + POPJ P, ;NETWORK NOT UP OR FULL + TLNE C,20 ;SKIP IF NOT LISTEN + JRST NETO10 + PUSHJ P,NETOR ;DO RESET STUFF, OPEN COMMUNICATIONS WITH HOST + POPJ P, ;HOST DOWN OR ILLEGAL + MOVE J,B ;CHECK GENDER OF FOREIGN SOCKET + ROT J,-1 + XOR J,D + JUMPGE J,OPNL2 ;WRONG DIRECTION +;DROPS THROUGH + ;DROPS IN +NETO10: PUSHJ P,SWTL ;ONLY ONE PROCESS AT A TIME COMPARING SOCKET NUMBERS + NETOSW + TLNN C,20 ;SKIP IF LISTEN + PUSHJ P,NETOW ;GOBBLE MP CONTROL LINK BLOCK (FOR NETOS) + TLNN C,10 + JRST NETO1 ;USE SOCKET NUMBER GIVEN IN WORD 2 + MOVEI A,10 ;ADVANCE SYSTEM UNIQUE SOCKET NUMBER + ADDB A,NRSOC + SUBI A,10 ;UNIQUE RECEIVE SOCKET NUMBER + SKIPGE D ;SKIP IF OPEN IS FOR READ (RECEIVE) + IORI A,1 ;MAKE INTO SEND SOCKET + JRST NETO6 + +NETO1: MOVE J,A ;USER SPECIFIED SOCKET NUMBER + ROT J,-1 ;J 4.9: 0 => RECEIVE 1 => SEND + EQV J,D ;D 4.9: 0 => READ 1 => WRITE + JUMPGE J,OPNL2 ;WRONG DIRECTION + MOVE J,A + CAIL A,NETSRS ;SKIP IF SPECIAL SOCKET + TRZA J,7 ;J HAS BASE OF SOCKET GROUP + MOVNI J,1 ; OR -1 IF NOT IN A GROUP + MOVSI Q,-IMPSTL + MOVEI E,0 +NETO2: SKIPL W,IMSOC1(Q) + JRST NETO3 ;NOT HOOKED UP + CAMN A,IMSOC2(Q) + JRST NETO2A ;DUPLICATE LOCAL SOC # + MOVE T,IMSOC2(Q) + TRZ T,7 + CAMN J,T + JRST NETO4 ;JUMP IF PART OF SOCKET GROUP +NETO3: AOBJN Q,NETO2 + SKIPL J ;SKIP IF NOT PART OF A SOCKET GROUP + JUMPE E,OPNL23 ;FOUND NO EVIDENCE THAT THIS GUY OWNS THIS GROUP + JRST NETO6 ;WINNING + +NETO2A: TLNN W,200000 ;SKIP IF BEING CLOSED + JRST OPNL13 ;NO, GIVE ERROR + TLNN C,20 + PUSHJ P,LSWPOP ;POP MP CONTROL LINK BLOCK + PUSHJ P,LSWPOP ;NETOSW + MOVSI T,200000 + PCLT + TDNE T,IMSOC1(Q) + PUSHJ P,UFLS ;WAIT TILL CLOSED + JRST NETO10 ;TRY AGAIN + +NETO4: CAIE U,(W) + JRST OPNL23 ;SOMEONE ELSE HAS IT + MOVNI E,1 ;OK IF NO OTHER CONFLICTS + JRST NETO3 + +;HERE WITH SUITABLE LOCAL SOCKET IN A +NETO6: TLNN C,4 ;SKIP IF IMAGE MODE + JRST NETOC ;ASCII MODE + MOVEI TT,36. + TLNN C,40 ;SKIP IF BYTE SIZE SUPPLIED + JRST NETOB + LDB E,[330600,,C] ;USE USER SUPPLIED BYTE SIZE + IDIVI E,36. ;TT GETS BYTE SIZE MOD 36. + JUMPN TT,NETOB + MOVEI TT,36. ;36 BITS ANYWAY +NETOB: PUSH P,TT + MOVEI E,36. + IDIV E,TT ;36/BS + JUMPE TT,NETOB1 ;EXACT + MOVEI E,32. + IDIV E,(P) ;32/BS + JUMPE TT,[MOVEI TT,400000 ;32BIT MODE FLAG + JRST NETOB1] + MOVEI TT,2000 ;FUNNY BYTESIZE FLAG +NETOB1: POP P,E ;BS + ADD TT,E ;FLAGS+BS + JRST NETOA + +NETOC: MOVEI TT,400410 ;7 BIT + TLNE C,40 + MOVEI TT,401010 ;8 BIT +NETOA: TLNE C,200 + TRO TT,100000 ;DON'T BUFFER MORE OUTPUT THAN ALLOCATION + HRLZM TT,IMSOC5(I) ;STORE FLAGS AND BC, CLEAR CLOSE REASON + MOVEM A,IMSOC2(I) ;LOCAL SOCKET NUMBER + MOVEM B,IMSOC3(I) ;FOREIGN SOCKET NUMBER + SETZM IMSOCT(I) ;IF INPUT, NOT IN MIDDLE OF A MESSAGE + MOVEI W,%NSRFS + TLNE C,20 ;3.5 LISTEN + MOVEI W,%NSLSN + DPB H,[321000,,W] ;DON'T CHANGE HOST NUMBER FIELD OF IMSOC4 + MOVEM W,IMSOC4(I) ;SET INITIAL STATE, CLEAR FLAGS + SKIPE IMSOC6(I) ;SKIP IF HAVEN'T ASSIGNED BUFFER YET + JRST 4,. + PUSH P,A + PUSH P,B + PUSH P,D +NETOE1: TLNN C,100 ;LAST PLACE TO PCLSR (REALLY NETMW) + JRST NETOE7 + PUSHJ P,TCALL ;GET FULL-PAGE BUFFER + JRST IOMQ + JRST NETMW + MOVEI W,MUNET + DPB W,[MUR,,MEMBLT(A)] + DPB I,[MNUMB,,MEMBLT(A)] + LSH A,10. + MOVE W,A ;BUFFER START ADDRESS + HRLI W,377 ;NOT AN IOBFT-TYPE BUFFER + MOVEI A,1777(A) ;BUFFER END ADDRESS + JRST NETOE4 + +NETOE7: MOVEI D,NFNETC(I) + PUSHJ P,TCALL + JRST IUTCO1 ;GET 200-WD BUFFER + JRST NETMW ;NO MEM AVAIL + LDB W,[IOSA,,IOBFT(A)] + LSH W,6 ;STARTING ADDRESS + HRL W,A ;IOBFT INDEX + MOVEI A,177(W) ;BUFFER END ADDRESS +NETOE4: MOVEM A,IMSBFE(I) ;(LH WILL BE STORED LATER) + MOVEM W,IMSOC6(I) +;CLEAR THE BUFFER FOR EASE IN DEBUGGING. COMMENT USED TO CLAIM +;THAT CLEARING IT WAS NECESSARY IN ORDER TO OUTPUT CORRECT HEADERS, +;BUT THAT WAS FRAUDULENT SINCE HEADERS NEVER COME FROM THE BUFFER. + MOVEI D,1(W) + HRLI D,(W) + SETZM (W) + BLT D,(A) + POP P,D + POP P,B + POP P,A +;DROPS THROUGH + ;DROPS IN + + MOVSI Q,000100 ;SET UP THE VARIOUS BYTE POINTERS + LDB TT,IMSCBS ;TO POINT TO END OF BUFFER + MOVE E,IMSOC5(I) ;SO ILDB WILL GET FIRST BYTE IN BUFFER + TLNN E,2000 ;SKIP IF ONE BIT BYTES + DPB TT,[300600,,Q] ;OTHERWISE USE USER BYTE SIZE + SKIPGE E + TLO Q,040000 ;32 BIT WORD ENDS 4 BITS OVER + HRR Q,IMSBFE(I) + MOVEM Q,IMSMPP(I) + MOVEM Q,IMSPIP(I) + MOVEM Q,IMSBFE(I) + MOVE T,C ;GET 3.5 BIT OF C INTO + LSH T,13. ;4.9 OF T + JUMPL D,NETOE5 ;JUMP IF SENDER + SETOM (W) ;NULL FIRST HEADER WORD + TLO Q,440000 ;-> LEFT END OF WORD + HRR Q,W + MOVEM Q,IMSPIP(I) ;SET PI PNTR TO POINT TO FIRST MESSAGE HEADER + SETZM IMSMPC(I) ;NO INPUT BYTES AVAILABLE YET + MOVEI TT,20. ;MESSAGE ALLOCATION ALWAYS 20 + MOVEM TT,IMSOC8(I) + HRRZ TT,IMSBFE(I) ;COMPUTE BIT ALLOCATION + SUBI TT,2*20.(W) ;TT := # WORDS IN BUFFER, -1 FOR LUCK, -2 FOR EACH MSG + SKIPGE IMSOC5(I) ; (-1 FOR HEADER WORD, AND -1 FOR BREAKAGE) + IMULI TT,32. ;CONVERT TO # BITS + SKIPL IMSOC5(I) + IMULI TT,36. + LDB Q,IMSCBS ;BREAKAGE WAS OVER-ESTIMATED BY 1 BYTE PER MSG + IMULI Q,20. + ADD TT,Q + MOVEM TT,IMSOC7(I) ;STORE CORRECT BIT ALLOCATION + SETZM IMSC8I(I) + SETZM IMSC7I(I) + MOVEI Q,2(I) ;LINK # + DPB Q,IMSCLN ;STORE IN LINK # FIELD + JRST NETOE6 + +NETOE5: SETZM IMSOC7(I) ;INITIALIZE SENDER'S ALLOCATIONS + SETZM IMSC7I(I) + SETZM IMSOC8(I) + HRRZ TT,IMSBFE(I) + SUBI TT,(W) ;# BUFFER WORDS, -1 FOR LUCK + SKIPGE IMSOC5(I) ;SKIP IF 36BIT + IMULI TT,32. ;ALLOW 32 BITS PER WORD + SKIPL IMSOC5(I) + IMULI TT,36. ;OR 36 BITS PER WORD + LDB E,IMSCBS + IDIVM TT,E ;CONVERT TO NUMBER OF BYTES + MOVEM E,IMSMPC(I) ;THAT MANY ARE FREE AT FIRST +NETOE6: PUSHJ P,IMPSPQ ;SEARCH PENDING QUEUE (LEAVES UTCOFF) + JRST NETOG ;NOTHING THERE + JUMPGE T,NETOH ;JUMP IF NOT LISTENING STATE + MOVE W,2(Q) ;FOREIGN SOCKET NUMBER + MOVEM W,IMSOC3(I) + LDB H,[101000,,3(Q)] ;FOREIGN HOST IMPHTB INDEX + DPB H,IMSCFH + SKIPA W,[%NSRFC] +NETOH: MOVEI W,%NSOPN + HRRM W,IMSOC4(I) + JUMPGE D,NETOD1 ;JUMP IF RECEIVER + SKIPL W,3(Q) ;SKIP IF RTS, GET LINK # + JRST 4,. ;HE SENT STR + DPB W,IMSCLN ;STORE LINK NUMBER +NETOD: HRRZ Q,UUAC(U) ;CHANNEL OPEN ON + MOVE Q,CHNBIT(Q) + PUSHJ P,IMPUIM ;INTERRUPT SELF + JRST NETOG ;GO FINISH THE OPEN + +NETOD1: SKIPGE W,3(Q) ;SKIP IF STR, GET BYTE SIZE + JRST 4,. ;HE SENT RTS + ANDI W,377 + LDB Q,IMSCBS + CAMN W,Q + JRST NETOD ;BYTE SIZES DIFFER, LOSE + PUSHJ P,IMPBRT ;RETURN THE BUFFER + JRST OPNL22 ;SELF-CONTRADICTORY OPEN? + +NETOG: HRRZ W,UUAC(U) + MOVS W,CHNBIT(W) + TLO W,400000 ;IN USE + HRR W,U ;SETZ+<,,> + MOVEM W,IMSOC1(I) ;WE ARE NOW FULLY SET UP TO THIS SOCKET + CONO PI,NETON + TLNN C,20 ;SKIP IF LISTENING TYPE SOCKET + PUSHJ P,NETOS ;SEND RFC (CAN'T HANG, ALREADY GOT NETOW) + PUSHJ P,LSWPOP ;UNLOCK NETOSW, NOW THAT IMSOC1 4.9 IS SET + PUSHJ P,LSWDEL ;UNLOCK IMSOC1(I) + PUSHJ P,LSWPOP ;REMOVE FROM LIST OF NETWORK OPENS IN PROGRESS + HRLZ A,I ;LEFT HALF OF IOCHNM GETS SOCKET INDEX + HLRZS C + JSP Q,OPSLC7 + NETDUI,,NETDUO + NETDBI,,NETDBO + NETDUI,,NETDUO + NETDBI,,NETDBO + +;GOBBLE MAIN PROGRAM CONTROL LINK BLOCK + +NETOW: JUMPL U,NETOW1 ;FROM STYNET CLOCK LEVEL + PCLT + SKIPGE IMPHTB(H) ;SKIP IF NOT RFNM WAIT ON LINK 0 + PUSHJ P,UFLS + PUSHJ P,SWTL ;GRAB CONTROL LINK BLOCK + IMPMPU + SKIPL IMPHTB(H) ;DID CTL LINK TO THIS HOST GET BACK INTO RFNM WAIT? + POPJ P, ;NO, OK + PUSHJ P,LSWPOP ;YES, RELEASE RESOURCE WHILE AWAITING RFNM + JRST NETOW + +;FROM NETIDC (AT CLOCK INTERRUPT LEVEL) +NETOW1: SKIPL IMPHTB(H) + AOSE IMPMPU + CAIA ;INPUT CAN'T BE READ YET. + POPJ P, + CONO PI,NETOFF + PUSHJ P,IMPUIN ;REACTIVATE SO WILL CHECK AGAIN + SUB P,[2,,2] ;THROW THROUGH NETI6, NETID + JRST NETOJ1 ;TAKE NO-INPUT-AVAILABLE EXIT + +;WAIT FOR MEMORY SO CAN ALLOCATE BUFFER + +NETMW: PCLT + MOVEI T,3 + CAMG T,LMEMFR + JRST [ PUSHJ P,UDELAY ;MAYBE MEMORY FROZEN, GIVE CORE JOB + JRST NETOE1 ] ;A CHANCE TO PCLSR US, THEN TRY AGAIN + CAMLE T,LMEMFR ;SKIP WHEN MORE THAN 3K FREE + PUSHJ P,UFLS + JRST NETOE1 + +;SEND RFC AND MAYBE ALLOCATE. IMSOC INDEX IN I, HOST INDEX IN H. + +NETOS: PUSHJ P,STHSTM ;STORE HOST ADDRESS IN IMPMPC+n, ALSO MESSAGE TYPE + MOVE J,[8_24.+13._8] ;BYTE SIZE = 8, BYTE COUNT = 13. + MOVEM J,IMPMPC+6 + MOVEI J,1_4 ;3 NOPS + RTS + SKIPGE D ;SKIP IF INPUT + MOVEI J,2_4 ;3 NOPS + STR + MOVEM J,IMPMPC+7 + LSH A,4 ;LOCAL SOCKET NUMBER + MOVEM A,IMPMPC+10 + LSH B,4 ;FOREIGN SOCKET NUMBER + MOVEM B,IMPMPC+11 + MOVEI TT,2(I) ;LINK NUMBER FOR RECEIVE SOCKET + SKIPGE D + LDB TT,IMSCBS ;BYTE SIZE FOR SEND SOCKET + LSH TT,28. + HRRZ J,IMSOC4(I) + CAIE J,%NSRFC + CAIN J,%NSOPN ;SKIP IF CONNECTION NOT YET OPEN + JUMPGE D,NETOS2 ;JUMP IF CONNECTION OPEN AND READ + MOVEM TT,IMPMPC+12 + MOVEI TT,4 ;TEXT LENGTH +NETOS3: HRRM TT,IMPMPC + JRST IMPMPQ + +NETOS2: MOVEI J,<4_8>+2(I) ;NOP + ALL + LINK # + LSH J,4 + IOR TT,J + MOVEM TT,IMPMPC+12 + MOVE TT,IMSOC8(I) ;SEND MESSAGE ALLOC + LSH TT,16.+4 + MOVEM TT,IMPMPC+13 + MOVE TT,IMSOC7(I) ;SEND BIT ALLOC + LSH TT,16.+4 + MOVEM TT,IMPMPC+14 + MOVE TT,[8_24.+22._8] ;BYTE COUNT = 22. + MOVEM TT,IMPMPC+6 + MOVEI TT,6 ;MESSAGE LENGTH + JRST NETOS3 + +;.NETAC CH, ;ACCEPT CONNECTION +;ERROR RETURN +;NORMAL RETURN + +ANETAC: JSP T,NETCHK + HRRZ T,IMSOC4(I) ;SOCKET STATE + CAIE T,%NSRFC + JRST OPNL41 ;NOT IN RFC RECEIVED STATE + LDB H,IMSCFH + PUSHJ P,NETOW ;GET IMPMPC + MOVE A,IMSOC2(I) ;LOCAL SOCKET NUMBER + MOVE B,IMSOC3(I) ;FOREIGN SOCKET NUMBER + MOVE D,A + ROT D,-1 + PUSHJ P,NETOS ;SEND RFC (AND MAYBE ALL) + CONO PI,NETOFF + HRRZ T,IMSOC4(I) + MOVEI TT,%NSOPN + CAIN T,%NSRFC + HRRM TT,IMSOC4(I) ;CONNECTION OPEN + JRST NETOJ1 + +NETCHK: HRRZ A,(R) + CAIL A,NETDUI + CAILE A,NETDBO + JRST OPNL34 ;NOT A NETWORK CHANNEL + HLRE I,(R) ;SOCKET TABLE INDEX + JUMPGE I,(T) + JRST OPNL41 ;OTHER END OF PIPELINE GONE (NET WENT DOWN) + +;.NETS CH, ;SEND BUFFER NOW +;RETURN + +NETFRC: JSP T,NETCHK ;ENTRY FROM .CALL FORCE + MOVE T,IMSOC2(I) + TRNN T,1 + JRST OPNL2 ;NOT SEND SOCKET + CONO PI,NETOFF + MOVE T,IMSMPP(I) + CAMN T,IMSPIP(I) + JRST NETOJ1 ;BUF EMPTY + MOVSI TT,400000 ;TURN ON SEND BUFFER BIT + IORM TT,IMSOC4(I) + PUSHJ P,IMPOST ;TURNS NETON + JRST POPJ1 + +NETFIN: HRRZ TT,IMSBFE(I) ;ENTRY FROM .CALL FINISH (NETFRC HAS BEEN CALLED) + SUB TT,IMSOC6(I) .SEE NETOE5 ;FOR COMMENTS FOR THIS CODE + HRRZS TT + SKIPGE IMSOC5(I) + IMULI TT,32. + SKIPL IMSOC5(I) + IMULI TT,36. + LDB T,IMSCBS + IDIVM TT,T ;T NOW HAS SIZE OF OUTPUT BUFFER IN BYTES + CAME T,IMSMPC(I) ;WAIT FOR BUFFER TO EMPTY OUT + PUSHJ P,UFLS + MOVEI T,%NSRFN ;WAIT FOR RFNM + HLL T,IMSOC4(I) ;4.9 IS KNOWN TO BE OFF NOW! + CAMN T,IMSOC4(I) + PUSHJ P,UFLS + JRST POPJ1 + +;.NETINT CH, ;SEND NETWORK INTERRUPT "INR" OR "INS" + ;INR FROM RECEIVER TO SENDER (LOCAL SOCKET EVEN, FOREIGN ODD) + ;INS FROM SND TO RCV ( -", -") +;ALSO .CALL NETINT, ARG 1 IS CH + +NNETINT:JSP T,NETCHK + AOSA (P) ;GOING TO WIN, SKIP RETURN +ANETINT: JSP T,NETCHK ;I<- SOCKET TABLE INDEX + LDB H,IMSCFH ;HOST INDEX FOR NETOW + PUSHJ P,NETOW ;WAIT FOR IMPMPU + MOVEI A,1 ;SET COUNT + MOVEM A,IMPMPC + PUSHJ P,STHSTM ;STORE HOST ADDRESS + MOVE A,[8_24.+2_8] ;BYTE SIZE 8, COUNT 2 + MOVEM A,IMPMPC+6 + MOVE A,IMSOC2(I) ;LCL SOCK # + MOVSI B,7_10. ;INR + TRNE A,1 ;SKIP IF RCV + MOVSI B,8_10. ;INS + LDB A,IMSCLN ;LINK # + DPB A,[241000,,B] + MOVEM B,IMPMPC+7 + JRST IMPMPQ ;QUE IT, START OUTPUT (IMPOST) + +;STORE HOST ADDRESS FROM H INTO LEADER IN IMPMPC. BASHES W, Q. +STHSTM: MOVEI Q,IMPMPL + HRLM H,IMPMPC ;ALSO SAVE HOST INDEX FOR PI LEVEL +;STORE HOST ADDRESS FROM H INTO LEADER IN (Q), BASHES W. +STHSTP: MOVE W,IMPHTN(H) ;FOREIGN HOST NUMBER +IFN 1, DPB W,[103000,,3(Q)] ; Store host address +IFN 0,[ DPB W,[301000,,3(Q)] ;STORE HOST NUMBER + LSH W,-9 + DPB W,[102000,,3(Q)] ;STORE IMP NUMBER +] ;IFN 0 + MOVSI W,17_10. ;NEW-FORMAT FLAG + MOVEM W,2(Q) ;MESSAGE TYPE 0 (LINK, ETC. ARE ALWAYS ZERO) + POPJ P, + +;.CALL NETBLK ;WAIT FOR STATE TO CHANGE OR TIME OUT +; ARG 1 - CHANNEL +; ARG 2 - STATE +; ARG 3 - TIME, AS IN .SLEEP (OPTIONAL) (WRITTEN BACK) +; VAL 1 - NEW STATE +; VAL 2 - TIME LEFT + +ANETBLK:JSP T,NETCHK + MOVE T,I ;SAVE INDEX IN T + HRL T,B ;STATE ALSO + CAIGE W,3 ;SKIP IF 3 ARGS (TIME GIVEN) + JRST ANETB3 ;USE DEFAULT TIME + TLNE C,1000 ;SKIP IF POINTER, RATHER THAN IMMEDIATE + JRST ANETB5 + XCTR XRW,[MOVES B,(C)] ;GET TIME FROM USER (CHECK WRITE ALSO) + JUMPL B,ANETB1 ;NEG MEANS ALREADY ABS TIME + MOVNS B ;MAKE NEG + SUB B,TIME ;-TIME TO GO TO +ANETB1: UMOVEM B,(C) ;STORE NEG TIME FOR PCLSR + MOVNS B ;MAKE + +ANETB4: MOVEM B,EPDL(U) ;ALSO USED IN B LATER + PUSHJ P,ANETB2 ;SKIP IF STATE CHANGE OR TIMEOUT + PUSHJ P,UFLS + SUB B,TIME ;HOW MUCH USED? + HRRZ A,IMSOC4(I) ;RETURN STATE + JRST POPJ1 + +ANETB2: HLR A,T ;DESIRED STATE + XOR A,IMSOC4(T) ;CURRENT STATE + TRNE A,-1 ;SKIP IF STILL MATCH + JRST POPJ1 + MOVE A,EPDL(U) ;SAVED TIME HERE + CAMG A,TIME + AOS (P) ;TIME OUT! + POPJ P, + +ANETB3: HRLOI B,377777 ;NO TIME SUPPLIED, USE INFINITY + JRST ANETB4 + +ANETB5: HRRZ B,C ;IMMEDIATE TIME SUPPLIED + ADD B,TIME ;(TIMEOUT WILL RESTART ON EACH PCLSR, TOO BAD) + JRST ANETB4 + +IFE INETP,[ +;.CALL STYNET +;ARG 1 - STY CHANNEL +;ARG 2 - NET INPUT CHANNEL TO CONNECT STY OUTPUT TO, OR -1 TO DISCONNECT +;ARG 3 - NET OUTPUT CHANNEL TO CONNECT STY INPUT TO +;ARG 4 - CHARS TO SEND WHEN OUTPUT .RESET HAPPENS ON STY'S TTY +; UP TO 3 8-BIT CHARACTERS, LEFT JUSTIFIED. + +NSTYNT: TLNN R,%CLSST + JRST OPNL34 ;1ST ARG NOT A STY CHANNEL. + HLRZ I,(R) ;GET TTY # OF STY + HRRES B ;ALLOW IMMEDIATE -1 + JUMPGE B,NSTYN2 ;JUMP IF CONNECTING. + PUSHJ P,NSTYN0 ;DISCONNECT + JRST OPNL41 ;WASN'T CONNECTED + JRST POPJ1 + +;VARIOUS ROUTINES CALL HERE WITH THE TTY# OF A STY IN I, TO DISCONNECT THE +; STY FROM THE NETWORK. NOTE THIS ROUTINE MUST NOT CHANGE U AND MUST NOT +; LSWCLR, SINCE IT COULD BE CALLED FROM IODCL VIA STYCLS OR NETCLS. + +NSTYN0: MOVSI B,%SSNET ;DISCONNECTING BOTH SIDES. + CONO PI,NETOFF + TDNN B,STYSTS-NFSTTY(I) + POPJ P, ;THIS STY NOT CONNECTED? + ANDCAB B,STYSTS-NFSTTY(I) ;MARK AS NO LONGER CONNECTED + MOVE C,STYNTL-NFSTTY(I) ;REMOVE THIS STY FROM ACTIVATION LIST + MOVEI D,STYNTA-STYNTL+NFSTTY +NSTYN1: CAMN I,STYNTL-NFSTTY(D) ;FIND THE STY THAT POINTS TO THIS ONE, + MOVEM C,STYNTL-NFSTTY(D) ;AND PATCH US OUT OF THE LIST. + SKIPE D,STYNTL-NFSTTY(D) ;SEARCH WHOLE LIST TILL FIND WHO POINTS TO US. + JRST NSTYN1 + SETOB C,STYNTL-NFSTTY(I) + EXCH C,STYNTI-NFSTTY(I) ;MARK THIS STY AS HAVING NO CONNECTION, GET SOCKET INDICES +IFN CHAOSP,[ + TLNE B,%SSCHA + JRST [ MOVSI B,%SSCHA ;DISCONNECT FROM CHAOS NET + ANDCAM B,STYSTS-NFSTTY(I) + MOVSI B,%CFSTY + TDNN B,CHSSTA(C) + JRST 4,. ;CHAOS DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,CHSSTA(C) + JRST NETOJ1 ] +];CHAOSP + MOVE B,[40000,,777] + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) ;AND MARK SOCKETS WE WERE CONNECTED TO AS DISCONNECTED + MOVSS C + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) + JRST NETOJ1 + +NSTYN2: MOVE Q,I ;SAVE TTY # OF STY + MOVEI E,1 + MOVE A,B ;DECODE THE NETWORK INPUT CHANNEL + JSP T,CHNDCD +IFN CHAOSP,[ + HRRZ A,(R) + CAIE A,CHAIDN + CAIN A,CHAODN + JRST [ HLRZ I,(R) ;CONNECT TO CHAOS NET + CONO PI,NETOFF + MOVSI B,%CFSTY + TDNE B,CHSSTA(I) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + MOVSI C,%SSNET+%SSCHA + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + IORM B,CHSSTA(I) ;OK, HOOK UP + DPB Q,[$CFTTN,,CHSSTA(I)] + JRST NSTYN3 ] +];CHAOSP + JSP T,NETCHK ;TEST LEGALITY; OPNL IF LOSES + TDNE E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF IT'S AN OUTPUT CHANNEL + MOVE B,I ;SAVE INPUT IMSOC INDEX + MOVE A,C ;DECODE OUTPUT CHANNEL + JSP T,CHNDCD + JSP T,NETCHK + TDNN E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF INPUT SOCKET + CONO PI,NETOFF + MOVE E,[40000,,777] + TDNN E,IMSOC5(B) ;ERROR IF EITHER CHANNEL ALREADY CONNECTED + TDNE E,IMSOC5(I) + JRST OPNL23 ;"FILE LOCKED" + MOVSI C,%SSNET + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;SIMILAR ERROR IF STY ALREADY CONNECTED + HRR E,Q ;GET 40000,,TTY # + IORM E,IMSOC5(I) + IORM E,IMSOC5(B) ;MARK SOCKETS AS CONNECTED +NSTYN3: SKIPGE STYNTL-NFSTTY(Q) ;HALT IF STY'S VARS ARE NOT CORRECT FOR A + SKIPL STYNTI-NFSTTY(Q) ;NON-CONNECTED STY. + JRST 4,. + IORM C,STYSTS-NFSTTY(Q) ;ALL ERROR CAUGHT, SO MARK STY CONNECTED. + HRL B,I ;PUT INPUT IMSOC IDX,, OUTPUT IMSOC IDX + MOVSM B,STYNTI-NFSTTY(Q) ;INTO THE STY + TRZ D,7777 ;STORE THE OUTPUT RESET CHARACTERS - AT MOST 3 + MOVEM D,STYORC-NFSTTY(Q) +IFN CHAOSP,[ ;ACTIVATE IN CASE HAS UNREAD INPUT + TLNN C,%SSCHA + PUSHJ P,IMPUIN + TLNE C,%SSCHA + PUSHJ P,CHINTI +];CHAOSP +.ELSE PUSHJ P,IMPUIN + JRST NETOJ1 +] ;IFE INETP + +SUBTTL ARPANET MP I/O ROUTINES + +IFE INETP,[ +;CALL STYNTC AT CLOCK LEVEL TO PROCESS ALL NECESSARY TRANSFERS OF DATA +;BETWEEN CONNECTED STYS AND NET SOCKETS + +STYNTC: CONO PI,NETOFF + SKIPN I,STYNTA ;GET HEAD OF ACTIVATE LIST + JRST NETONJ ;EMPTY + SETZM STYNTA ;COPY LIST IN CASE A STY IS PUT BACK ON + CONO PI,NETON +STYNT7: MOVE A,STYNTL-NFSTTY(I) ;GET NEXT ON LIST + MOVEM A,STYNTB ;SAVE FOR NEXT TIME AROUND LOOP + SETOM STYNTL-NFSTTY(I) ;THIS ONE IS NO LONGER ON ACTIVATE LIST + MOVE A,STYSTS-NFSTTY(I) + TLNN A,%SSNET + JRST 4,. ;STY CLAIMS NOT TO BE CONNECTED?? + MOVE R,I ;SAVE TTY # +IFN CHAOSP,[ + TLNE A,%SSCHA + JRST STYCHA ;CONNECTED TO CHAOS NET +];CHAOSP +] ;IFE INETP +IFN INETP,STYNCP: + + SKIPGE TTYOAC(I) + JRST STYNT1 ;NO OUTPUT, CHECK FOR INPUT +;HANDLE OUTPUT TO NET + HRRZ I,STYNTI-NFSTTY(I) ;GET IMSOC IDX OF OUTPUT CHANNEL + MOVSI A,40000 + TDNN A,IMSOC5(I) + JRST 4,. ;SOCKET CLAIMS NOT TO BE CONNECTED?? +STYNT5: CONO PI,NETOFF ;INCLUDES TTYOFF + PUSHJ P,NSOSE0 ;CAN WE OUTPUT TO NET NOW? + JRST STYNT6 ;NO, WAIT TILL LATER, PI LVL WILL REACTIVATE WHEN STATE CHANGES + LDB T,IMSCBS ;SINCE THIS IS PI LEVEL, + MOVE Q,IMSOC7(I) ;NO POINT IN SENDING MORE OUTPUT THAN ALLOCATED + SUB Q,IMSC7I(I) + IDIVM Q,T ;T GETS NUMBER OF BYTES ALLOCATED AND NOT BUFFERED + CAMLE E,T + MOVE E,T + JUMPLE E,STYNT6 ;NO ALLOC, SEND NOTHING + EXCH R,I ;BEFORE EXCH, R HAS TTY #, I HAS NET IMSOC IDX + MOVEM D,DBBBP ;SET UP BUFFER-POINTING VARS FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;OUTPUT THROUGH THOSE POINTERS, INTO THE NET CHNL BUFFER + SETZM TYPNTF + POP P,R + EXCH I,R + MOVE D,DBBBP + MOVE E,DBBCC + MOVE Q,DBBCC1 + PUSHJ P,NSOFIN ;FIGURE OUT HOW MANY CHARS WERE TYPED, AND UPDATE SOCKET. + JRST STYNT4 ;MORE ROOM IN BUFFER => MAYBE TYPE SOME MORE. + JRST STYNT6 ;ELSE TRY INPUT FROM NET, BUT SEND WHATEVER WE GOT + +STYNT4: SKIPL TTYOAC(R) ;MORE OUTPUT IN TTY BUFFER? + JRST STYNT5 ;YES, PROCESS IT +STYNT6: PUSHJ P,NSOFN1 ;NO, BE SURE NET BUFFER GETS SENT SOON + +;HERE TO TRY TO HANDLE INPUT FROM NET +STYNT1: HLRZ I,STYNTI-NFSTTY(R) ;INPUT IMSOC INDEX + MOVSI A,40000 + TDNN A,IMSOC5(I) + JRST 4,. ;SOCKET CLAIMS NOT TO BE CONNECTED? +STYNT2: PUSHJ P,NETIDC ;GET CHAR FROM NET SOCKET + JRST STYNT3 ;GOT CHAR IN W + JRST STYNT8 ;NO CHAR AVAIL, HANDLE OTHER STYS + ;2 SKIPS => GIVE UP, SPECIAL CHARACTER SEEN, OR BAD STATE + PUSHJ P,IMPUIP ;WAKE UP THE TELNET SERVER + MOVE I,R ;DISCONNECT THE STY AND SOCKETS + PUSHJ P,NSTYN0 + JRST 4,. +IFE INETP,[ +STYNT8: SKIPE I,STYNTB ;GET NEXT STY FROM COPIED ACTIVATION LIST + JRST STYNT7 + POPJ P, +] ;IFE INETP +.ELSE JRST STYNT8 + +STYNT3: EXCH I,R ;HERE IF GET CHAR FROM NET IN W. I GETS TTY #. + PUSH P,R + PUSH P,I + MOVE A,W + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL. + CONO PI,TTYON + POP P,R ;TTY #; POP IN REVERSE ORDER TO UNDO THE EXCH + POP P,I ;IMSOC IDX + JRST STYNT2 ;TRY TO GET ANOTHER INPUT CHARACTER. + +;STYNTC'S INTERFACE TO NET INPUT IOT. +;I HAS IMSOC IDX OF INPUT SOCKET. +;1 SKIP => NO DATA AVAILABLE. +;2 SKIPS => TELNET CONTROL CHARACTER FOUND, SO DISCONNECT STY AND +;INTERRUPT THE USER PROGRAM. +NETIDC: MOVNI U,1 ;U=-1 TELLS NETI IT CAME FROM HERE + HRRZ H,IMSOC4(I) ;CHECK SOCKET STATE + CAIN H,%NSOPN + JRST POPJ1 ;NO DATA + CAIGE H,%NSCLI ;SKIP IF IN ONE OF THE TWO INPUT AVAILABLE STATES + JRST POPJ2 ;STATE IS ABNORMAL, SO DISCONNECT FROM STY. + JRST NETID ;ELSE TRY AN IOT. + +;NETWORK UNIT INPUT. +NETI: HRRE I,A ;SOCKET TABLE INDEX + JUMPL I,IOCER1 +NETIB: MOVE A,IMSOC5(I) ;ENTER HERE FROM BLOCK-MODE INPUT + TLNE A,40000 + JRST IOCR10 ;CAN'T IOT AT M.P. LEVEL WHILE SOCKET CONNECTED TO A STY. +NETID: MOVE A,IMSC8I(I) + LDB B,IMSCBS + IMUL B,IMSMPC(I) + ADD B,IMSOC7(I) ;TOTAL NUMBER OF BITS YET TO BE READ + CAIGE A,8. ;IF MESS REALL OF 8 OR MORE + CAMG B,IMSC7I(I) ;OR BIT REALL SATISFIES "DOUBLE BUFFERING" CRITERION + PUSHJ P,NETI6 ;THEN SEND ALLOCATE + JUMPL U,NETI4 ;JUMP IF READING INPUT TO GIVE DIRECTLY TO A STY +NETI0: CONO PI,NETOFF ;DON'T ALLOW INTO IMPUIN WHILE CHECKING STATE, #BITS + HRRZ A,IMSOC4(I) + JUMPE A,NETIB1 ;CONNECTION CLOSED + CAIE A,%NSINP + CAIN A,%NSCLI + JRST .+3 + CAIE A,%NSOPN + JRST IOCR10 ;SOCKET IN BAD STATE + PCLT + SKIPG IMSMPC(I) ;WAIT FOR BITS TO ARRIVE + PUSHJ P,UFLS + CONO PI,NETON ;NETON IN CASE DIDN'T UFLS + SKIPG IMSMPC(I) ;DID THEY? + JRST NETI0 ;NO, STATE MUST HAVE CHANGED, CHECK IT AGAIN + +NETI4: SOSL IMSOCT(I) ;TAKE BYTE + JRST NETI4A + MOVE A,IMSMPP(I) ;END OF MESSAGE, FIND ADDRESS OF NEXT HEADER WORD + MOVEI A,1(A) ;WHICH IS IN NEXT WORD AFTER LAST BYTE LOADED + CAILE A,@IMSBFE(I) + HRRZ A,IMSOC6(I) ;WRAP AROUND + SOSGE B,(A) ;GET HEADER WORD, COUNT DOWN FOR BYTE ABOUT TO TAKE + JRST 4,. ;NO MESSAGE, ALTHOUGH IMSMPC > 0 + MOVEM B,IMSOCT(I) ;SAVE # BYTES LEFT IN THIS MESSAGE + HLL A,IMSBFE(I) ;SET UP BYTE POINTER LH TO LAST BYTE IN WORD + MOVEM A,IMSMPP(I) ; SO ILDB WILL GET FIRST DATA BYTE OF THIS MSG + AOS IMSC8I(I) ;INCREASE MESSAGE ALLOCATION +NETI4A: MOVE TT,IMSMPP(I) ;CHECK FOR WRAP-AROUND + MOVE H,IMSOC5(I) + TLNE H,2000 + JRST NETI2 ;JUMP IF ONE BIT BYTES + CAMN TT,IMSBFE(I) + JRST [ HRRZ TT,IMSOC6(I) + HLL TT,IMSPIP(I) ;B.P. TO FIRST BYTE IN BUFFER + JRST .+1 ] + ILDB W,TT + JRST NETI3 + +NETI2: LDB E,IMSCBS ;BITS PER BYTE + MOVEI W,0 +NETI1: CAME TT,IMSBFE(I) + JRST NETI1A + HRRZ TT,IMSOC6(I) ;WRAP AROUND + HLL TT,IMSPIP(I) +NETI1A: ILDB A,TT + LSH W,1 + IORI W,(A) + SOJG E,NETI1 +;DROPS THROUGH + ;DROPS IN + +NETI3: TRNN W,200 ;IS THIS A TELNET CONTROL CHAR (>= 200)? + JRST NETI3A + JUMPL U,[AOS IMSOCT(I) ;YES; IF DIRECT-CONNECTED TO A STY, BREAK CONNECTION. + JRST POPJ2] ; WITHOUT GOBBLING THAT CHARACTER + TLNE H,400 ;IF 7-BIT ASCII MODE, REPLACE CHARACTER BY ^@. + SETZ W, +NETI3A: MOVEM TT,IMSMPP(I) + LDB TT,IMSCBS + ADDM TT,IMSC7I(I) ;INCREASE BIT ALLOCATION + CONO PI,NETOFF ;WHILE CHANGING STATE + SOSLE IMSMPC(I) ;ONE LESS BYTE IN BUFFER + JRST NETONJ ;OK, THERE IS MORE IN BUFFER + MOVNI E,1 ;YES, STATE IS CHANGING. + HRRZ A,IMSOC4(I) + CAIN A,%NSCLI + MOVEI E,%NSCLS + CAIN A,%NSINP + MOVEI E,%NSOPN ;NO INPUT AVAILABLE + JUMPL E,[JRST 4,.] ;WAS IN SOME RANDOM STATE + CAIN E,%NSCLS + PUSHJ P,IMPUIP ;IF STATE CHANGING TO "CLOSED", GIVE USER AN INTERRUPT. + HRRM E,IMSOC4(I) + JRST NETONJ + +;COME HERE WHEN INPUT IOT FINDS THAT CONNECTION IS CLOSED +NETIB1: CONO PI,NETON + LDB D,IMSCLS + CAIE D,%NCFRN + JRST IOCR10 ;ABNORMAL CLOSURE, GIVE IOCER INSTEAD OF EOF + MOVE TT,IMSOC5(I) + POP P,D ;GET OUR RETURN ADDRESS. + ANDI D,-1 + CAIE D,AIOT3 ;IF WE ARE NOT DOING A UNIT MODE IOT, + JRST 1(D) ;JUST RETURN WITH 1 SKIP. + TLNN TT,1400 ;SKIP IF ASCII MODE + JRST IOCER2 ;EOF IN IMAGE MODE IS IOCERROR. + HRROI W,EOFCH ;EOF IN ASCII MODE RETURNS ^C. + JRST 1(D) + +NETI6: HRRZ H,IMSOC4(I) ;SEND ALL MSG + CAIE H,%NSINP + CAIN H,%NSOPN + CAIA + POPJ P, ;CLOSED, DON'T SEND ALLOCATE + LDB H,IMSCFH ;HOST INDEX FOR NETOW + PUSHJ P,NETOW ;GOBBLE MAIN PROG CONTROL LINK BLOCK + MOVEI J,2(I) ;LINK # + IORI J,<4_8> ;SEND ALLOC + LSH J,16. + ADD J,IMSC8I(I) + LSH J,4 + MOVEM J,IMPMPC+7 + MOVE J,IMSC7I(I) + LSH J,4 + MOVEM J,IMPMPC+10 + PUSHJ P,STHSTM ;STORE HOST ADDRESS, MESSAGE TYPE + MOVE J,[8_24.+8_8] + MOVEM J,IMPMPC+6 + MOVEI J,2 + HRRM J,IMPMPC ;TEXT LENGTH + SETZB A,TT + EXCH A,IMSC8I(I) + EXCH TT,IMSC7I(I) + ADDM A,IMSOC8(I) + ADDM TT,IMSOC7(I) + JRST IMPMPQ + +;UNIT MODE NETWORK OUTPUT (DOESN'T CLOBBER C) + JRST NETSIO ;SIOT VECTOR +NETW: HRRE I,A ;SOCKET TABLE INDEX + JUMPL I,IOCER1 + SKIPGE C + SKIPA A,(C) + UMOVE A,(C) +NETWB: CONO PI,NETOFF ;BYTE TO OUTPUT IN A. HERE FROM BLOCK MODE. + HRRZ B,IMSOC4(I) + CAIE B,%NSOPN + CAIN B,%NSRFN + JRST .+2 + JRST IOCR10 + SKIPG IMSMPC(I) ;SKIP IF ROOM TO PUT BYTE IN BUF + JRST [ MOVSI B,400000 + IORM B,IMSOC4(I) ;SET TO SEND IT NOW + IFN DMIMP,CONSZ FI,70 + PUSHJ P,IMPIOS + SKIPG IMSMPC(I) ;WAIT FOR AT LEAST ONE BYTE OF ROOM + PUSHJ P,UFLS + CONO PI,NETON + SKIPG IMSMPC(I) + JRST NETWB ;NO ROOM, STATE MUST HAVE CHANGED + JRST .+1] + MOVE E,IMSOC5(I) + MOVE T,IMSOC7(I) + TLNE E,100000 + CAML T,IMSC7I(I) + JRST NETW4 + MOVSI B,400000 ;ALLOCATION USED UP (AND FEATURE ENABLED) + IORM B,IMSOC4(I) ;SEND BUFFER NOW + PUSHJ P,IMPOST + CAMN T,IMSOC7(I) ;WAIT FOR DATA TO GO OUT OR ALLOC TO COME IN + PUSHJ P,UFLS + JRST NETWB ;TRY AGAIN + +NETW4: MOVE T,IMSMPP(I) ;GET POINTER + MOVE E,TIME + CAMN T,IMSPIP(I) ;SKIP UNLESS BUFFER EMPTY + MOVEM E,IMSOCT(I) ;SET TIME FOR FIRST BITS INTO BUF + LDB B,IMSCBS ;BYTE SIZE + MOVE E,IMSOC5(I) ;FLAGS + CONO PI,NETOFF ;WANT TO MUNG POINTERS WITHOUT PI INTERFERENCE + TLNE E,2000 ;SKIP IF BYTES FIT EXACTLY IN WORD + TLNN T,770000 ;SKIP IF NOT AT RIGHT END OF WORD + JRST NETW2 ;IDPB, CHECK FOR POINTER WRAP + LDB TT,[360600,,T] ;GET BYTE POS + CAML TT,B ;SKIP IF BYTE SPLITS ACROSS WORDS + JRST NETW1 ;JUST DO IDPB + DPB TT,[301400,,T] ;SET BYTE TO STORE IN RIGHT OF THIS WORD + SUB TT,B ;=> -(# OVERFLOW BITS) + ROT A,(TT) ;HIGH PART OF BYTE IN RIGHT END OF A + DPB A,T ;STORE PART BYTE + AOS T,IMSMPP(I) ;INCR TO NEXT WORD + MOVEI E,(T) + CAILE E,@IMSBFE(I) + HRR T,IMSOC6(I) ;WRAP + MOVEM A,@T ;STASH REST OF BYTE IN LEFT PART OF NEXT WORD + ADDI TT,36. ;SET TO NEW POSITION + DPB TT,[360600,,T] ;NEW BYT POS + MOVEM T,IMSMPP(I) ;STORE UPDATED PTR + JRST NETW3 ;WRAP UP + +;DEPOSIT A BYTE WHICH MAY WRAP AROUND + +NETW2: CAME T,IMSBFE(I) + JRST NETW1 ;NO WRAP + HRR T,IMSOC6(I) + TLO T,440000 + MOVEM T,IMSMPP(I) + +;DEPOSIT BYTE KNOWN TO FIT IN WORD + +NETW1: IDPB A,IMSMPP(I) ;STORE IT + +;COUNT THE BITS NOW + +NETW3: SOS IMSMPC(I) ;1 BYTE LESS FREE + LDB T,IMSCBS + ADDM T,IMSC7I(I) + JRST NETONJ + +;NETWORK OUTPUT SIOT +NETSIO: CONO PI,NETOFF + PUSHJ P,NSOSET ;SET UP FOR FAST SIOT + JRST NSIOT1 ;CHANNEL ISN'T SET UP FOR IT => USE NORMAL SIOT LOOP. + PUSH P,B + PUSH P,C +NETSO0: XCTR XRW,[MOVES B,@-1(P)] ;COPY ARGS + XCTR XRW,[MOVES C,@(P)] +NETSO1: IBP B .SEE NSIOOL ;FOR WHY THIS HAIR IS NEEDED + XCTRI XR,[MOVE TT,(B)] + SKIPA T,B + JRST NETSO3 ;PAGE FAULT, CLEAN UP IMSMPP BEFORE TAKING IT + HRRI T,TT + LDB TT,T + IDPB TT,D + SOS E + UMOVEM B,@-1(P) ;UPDATE USER'S ARGS + XCTR XRW,[SOSLE C,@(P)] + JUMPG E,NETSO1 ;LOOP IF BOTH USER AND SYSTEM WILLING + SKIPL E + SKIPGE C + JRST 4,. ;WENT TOO FAR!! + PUSHJ P,NSOFIN ;FINISH UP HACKING NET CHANNEL. + JRST NETSO2 ;OUTPUT BUFFER HAS MORE ROOM + JUMPLE C,PPBAJ1 ;NO ROOM BUT DON'T WANT ANY MORE ANYWAY, SO RETURN + SKIPG IMSMPC(I) ;NO ROOM, WAIT FOR SOME + PUSHJ P,UFLS ;NOTE ANY STATE CHANGE WILL UNHANG + POP P,C ;NOW TRY TO SIOT SOME MORE + POP P,B + MOVE D,IOTTB(H) ;RESTORE D IN CASE GOES TO NSIOT1 + JRST NETSIO + +NETSO3: PUSHJ P,NSOFIN ;TOOK PAGE FAULT, CLEAN UP + JFCL + PUSHJ P,TPFLT +NETSO2: JUMPLE C,PPBAJ1 ;BUFFER HAS ROOM BUT NO DESIRE TO SEND ANY MORE, RETURN + CONO PI,NETOFF + PUSHJ P,NSOSE0 ;SET UP TO SEND MORE + JRST IOCR10 ;STATE MUST HAVE GONE BAD + JRST NETSO0 ;OK, SEND MORE + +;SET UP FOR NET OUTPUT SIOT, OR (NSOSE0) FOR DIRECT OUTPUT FROM STY. +;AT ENTRY, A HAS LH(IOCHNM). +;CALL WITH NETOFF, AND DON'T TURN IT BACK ON BEFORE CALLING NSOFIN, +;BECAUSE WE HAVE A COPY OF IMSMPP IN D, AND PI LEVEL MIGHT BE TRYING TO MUNG IT. +;SETS D TO POINTER, E TO COUNT OF CHARS OF SPACE, AND Q TO COPY OF COUNT. +;SETS I TO IMSOC IDX. CLOBBERS T AND TT. +;NO SKIP => CAN'T USE FAST SIOT, OR CAN'T DO DIRECT OUTPUT AT THIS MOMENT. +;IN THAT CASE, D HASN'T BEEN CLOBBERED YET. +NSOSET: HRRE I,A + JUMPL I,IOCER1 +NSOSE0: MOVE E,IMSOC5(I) + HRRZ T,IMSOC4(I) + CAIE T,%NSOPN + CAIN T,%NSRFN ;STATE BAD, OR BYTES CROSS WORD BOUNDARIES, + TLNE E,2000 + JRST NETONJ ;IMPLIES CAN'T WIN THIS WAY. + SKIPG E,IMSMPC(I) + JRST NSOFN1 ;JUMP IF BUFFER FULL, SET SEND BUFFER AND NETONJ + MOVE D,IMSMPP(I) + CAME D,IMSBFE(I) + JRST NSOSE2 + HRR D,IMSOC6(I) ;IF BUFFER STORING PTR POINTS AT END OF BUFFER, + TLO D,440000 ;WRAP AROUND. +NSOSE2: LDB Q,IMSCBS + MOVEI TT,36. + SKIPGE IMSOC5(I) + MOVEI TT,32. + IDIVM TT,Q ;GET # BYTES/WD OF CONNECTION. + HRRZ TT,IMSBFE(I) + SUBI TT,(D) + IMUL TT,Q ;# BYTES BETWEEN POINTER AND END OF BUFFER. + LDB T,[360600,,D] + LDB Q,IMSCBS + IDIVM T,Q ;# BYTES NOT STORED IN WORD POINTER POINTS AT + ADD TT,Q ;THEY ARE AVAILABLE, TOO. + CAML E,TT + MOVE E,TT ;GET MINIMUM OF FULL BYTES AND BYTES AFTER THE POINTER. + MOVE T,TIME + MOVE Q,IMSMPP(I) + CAMN Q,IMSPIP(I) ;SKIP IF BUFFER NOT EMPTY + MOVEM T,IMSOCT(I) ;TIME FOR FIRST BITS INTO BUF. + CAILE E,600 ;DON'T LEAVE NETOFF FOR MORE THAN ONE CLOCK TICK OR SO + MOVEI E,600 + MOVE Q,E ;ORIGINAL E. (FOR NSOFIN) + JRST POPJ1 + +;FINISH UP AFTER NET OUTPUT SIOT OR DIRECT OUTPUT FROM STY. +;SKIP IF BUFFER FULL +;ASSUME Q,I LEFT OVER FROM NSOSET, AND D,E ADVANCED BY STORING CHARS. +NSOFIN: PI2SAF ;NETOFF SHOULD STILL BE IN EFFECT FROM NSOSET + SUBM E,Q ;- <# BYTES XFERED> + JUMPE Q,NETONJ ;IF OUTPUT NO BYTES, DON'T CHANGE IMSMPP (IMPORTANT!) + MOVEM D,IMSMPP(I) ;UPDATE STORING POINTER OF SOCKET BUFFER + LDB TT,IMSCBS + IMUL TT,Q + MOVNS TT + ADDM TT,IMSC7I(I) ;INCREASE COUNT OF BITS IN BUFFER + ADDB Q,IMSMPC(I) ;UPDATE COUNT OF FREE SPACE IN BUFFER. + JUMPG Q,.+2 ;ANY SPACE LEFT => NO SKIP. + AOS (P) + JUMPG E,NETONJ ;ONLY SEND BUFFER IF CALL OUTPUT ALL IT COULD +NSOFN1: MOVSI TT,400000 ;SEND BUFFER NOW. + IORM TT,IMSOC4(I) + JRST IMPOST ;TURNS NETON + +NETBO: HRRE I,A + JUMPL I,IOCER1 + XCTR XRW,[MOVES D,(C)] ;TAKE TRAP GETTING POINTER IF SWAPPED OUT + MOVE E,IMSOC5(I) + TLNE E,1400 ;SKIP IF IMAGE MODE + JRST NETBOA ;ASCII MODE + JUMPGE D,CPOPJ ;TRANSFER NO WORDS +NETBO1: UMOVEM D,(C) + UMOVE A,(D) + PUSHJ P,NETWB + UMOVE D,(C) + AOBJN D,NETBO1 + UMOVEM D,(C) + POPJ P, + +NETBOA: TLNN E,400 ;SKIP IF 7 BIT + JRST NETBA8 + MOVEI E,NETBOR + JRST NBTOCH + +NETBOR: PUSH P,D + PUSH P,TT + PUSHJ P,NETWB + POP P,TT + POP P,D + MOVEI E,NETBOR + POPJ P, + +NETBA8: XCTR XRW,[MOVES D,(C)] + LDB TT,[410300,,D] + CAIGE TT,4 ;ONLY 4 BYTES PER WORD (3 < CNT < 8) + POPJ P, + SKIPA TT,NETCHT-4(TT) +NTBA8A: UMOVEM D,(C) + UMOVE W,(D) + ILDB A,TT + PUSH P,TT + PUSHJ P,NETWB + POP P,TT + UMOVE D,(C) + ADD D,[700000,,] ;ADVANCE CHAR CNT + JUMPL D,NTBA8A ;GO TO NEXT CHAR + MOVE TT,NETCHT+3 + ADD D,[400001,,1] ;INCR TO NEXT WORD + JUMPL D,NTBA8A + UMOVEM D,(C) + POPJ P, + +NETCHT: REPEAT 4,<44-<3-.RPCNT>*10>_12.+1000,,W + +NETBI: HRRE I,A + JUMPL I,IOCER1 + XCTR XRW,[MOVES D,(C)] ;ENSURE POINTER WILL BE WRITABLE + MOVE E,IMSOC5(I) + TLNE E,1400 ;SKIP IF IMAGE MODE + JRST NETBIA ;ASCII MODE +NETBI1: UMOVEM D,(C) ;STORE BACK POINTER + XCTR XRW,[MOVES (D)] ;ENSURE BYTE WILL BE WRITABLE + PUSH P,C + PUSHJ P,NETIB ;GET NEXT BYTE + CAIA ;NORMAL RETURN. + JRST POP1J ;NO INPUT AVAIL. + POP P,C + UMOVE D,(C) + UMOVEM W,(D) + AOBJN D,NETBI1 + UMOVEM D,(C) + POPJ P, + +NETBIA: TLNN E,400 ;SKIP IF 7 BIT ASCII + JRST NTBIA8 + MOVEI E,NETBIR + JRST INBTCH + +NETBIR: PUSHJ P,NETI + JRST [ MOVEI E,NETBIR ;INPUT IN W + POPJ P, ] + MOVE E,[600000,,NETBCC] ;NO INPUT AVAIL + JRST POPJ1 + +NETBCC: MOVEI H,EOFCH + JRST POPJ2 + +NTBIA8: HRRZS E ;8-BIT ASCII BLOCK MODE + XCTR XRW,[MOVES D,(C)] + LDB TT,[410300,,D] + CAIGE TT,4 + POPJ P, + SKIPA TT,NETCHT-4(TT) +NTBI8A: UMOVEM D,(C) + XCTR XRW,[MOVES (D)] + JUMPL E,NTBI8B + PUSH P,C + PUSH P,TT + PUSHJ P,NETIB + JRST [ MOVEI E,0 + JRST NETBI5 ] ;NORMAL RETURN - BYTE IN W. + MOVSI E,600000 ;NO BYTES AVAIL - SOCKET CLOSED. +NETBI5: MOVE H,W + POP P,TT + POP P,C + UMOVE D,(C) + LDB W,[410300,,D] + CAIN W,7 + TLNN E,200000 + JRST NTBI8C + POPJ P, +NTBI8C: UMOVE W,(D) + IDPB H,TT + UMOVEM W,(D) + ADD D,[700000,,] + JUMPL D,NTBI8A + MOVE TT,NETCHT+3 + ADD D,[400001,,1] + SKIPL E + JUMPL D,NTBI8A + UMOVEM D,(C) + POPJ P, + +NTBI8B: MOVEI H,EOFCH + UMOVE D,(C) + JRST NTBI8C + +NETCLS: HRRE I,A ;SOCKET TABLE INDEX + JUMPL I,CPOPJ + MOVE T,IMSOC2(I) + TRNN T,1 ;SKIP IF SEND SOCKET + JRST NETCL2 + MOVSI T,400000 + IORM T,IMSOC4(I) ;CAUSE BUFFER TO BE SENT + PUSHJ P,IMPOST +NETCL2: MOVSI B,600000 + CONO PI,CLKOFF + IORM B,IMSOC1(I) ;MARK CHANNEL TO BE CLOSED + AOS IMNCS + HRRZ R,UUAC(U) + MOVE A,CHNBIT(R) + TDNE A,MSKST2(U) + ANDCAM A,IFPIR(U) + MOVE I,IMSOC5(I) ;IF CHANNEL CONNECTED TO A STY, + TLNN I,40000 + JRST CLKONJ + ANDI I,777 ;DISCONNECT THEM. + PUSHJ P,NSTYN0 + JRST 4,. + JRST CLKONJ + +;SEARCH PENDING QUEUE FOR LOCAL SOCKET NUMBER IN A, +;T 4.9 = 1 => LISTENING, 4.9 => 0 => ALSO CHECK +;FOREIGN SOCKET NUMBER IN B AND FOREIGN HOST NUMBER (IMPHTB INDEX) IN H +;SKIPS IF ENTRY IS FOUND. RETURNS ENTRY TO FREE LIST. +;Q GETS ADDRESS OF ENTRY BLOCK. RETURN WITH NETOFF + +IMPSPQ: CONO PI,NETOFF +IMSPQP: SKIPGE Q,IMPBPQ ;BEGINNING OF QUEUE + POPJ P, ;QUEUE EMPTY + MOVNI J,1 ;PREVIOUS ENTRY +IMSPQL: CAME A,1(Q) ;SKIP IF SAME LOCAL SOCKET NUMBER + JRST IMSPQ1 ;TRY NEXT + JUMPL T,IMSPQW ;WIN IF LISTENING SOCKET + LDB W,[101000,,3(Q)] ;FOREIGN HOST IMPHTB INDEX + CAMN W,H ;SKIP IF WRONG FOREIGN HOST + CAME B,2(Q) ;SKIP IF FOREIGN SOCKET NUMBER AGREES + JRST IMSPQ1 ;TRY NEXT +IMSPQW: SKIPGE W,(Q) ;FOUND IT + MOVEM J,IMPEPQ ;PATCH OUT OF THE QUEUE + SKIPGE J + MOVEI J,IMPBPQ + MOVEM W,(J) + MOVE W,IMFFPQ ;ADD TO FREE LIST + MOVEM W,(Q) + MOVEM Q,IMFFPQ + JRST POPJ1 + +IMSPQ1: MOVE J,Q ;PREVIOUS ENTRY + SKIPL Q,(Q) ;NEXT ENTRY + JRST IMSPQL ;LOOP + POPJ P, ;NOT FOUND + +SUBTTL ARPANET CLOCK LEVEL + +OVHMTR IMP ;NETWORK INTERRUPT LEVEL (NOT STYNET STUFF) + +;HERE TO TIME OUT THE RFC QUEUE +IMFCT1: CONO PI,NETOFF + SKIPGE Q,IMPBPQ + JRST NETONJ ;... IF QUEUE IS EMPTY + MOVNI J,1 ;J HAS PTR TO PREV ELT OF LIST, FOR IMSPQW TO PATCH (DELQ). +IMFCT2: LDB E,[221100,,3(Q)] ;TIME IN 16/15'THS, MOD 512., THAT RFC WAS RECEIVED + LDB TT,[051100,,TIME] ;TIME, IN SAME UNITS, NOW. + CAMLE E,TT ;MAKE SURE THE SUB TT,E GIVES A POSITIVE ANSWER. + ADDI TT,1_9 ;WE ASSUME THAT TIME >= TIME OF RECEIPT. + SUB TT,E + CAIGE TT,IMFCTO_<-5> + JRST IMFCT3 ;THIS RFC HASN'T TIMED OUT - LOOK AT NEXT + PUSHJ P,IMSPQW ;IT HAS - FLUSH IT + JFCL + JRST IMFCT1 ;AND START AGAIN LOOKING FOR RFC'S TO FLUSH + +IMFCT3: MOVE J,Q + SKIPL Q,(Q) + JRST IMFCT2 + JRST NETONJ ;END OF QUEUE + +;FLUSH CLOSED NETWORK CHANNELS (CALLED AT HALF SEC CLOCK) +IMPCCL: MOVSI I,-IMPSTL +IMPCCR: CONO PI,NETON + MOVSI T,200000 +IMPCCZ: TDNN T,IMSOC1(I) ;LOOK FOR CHANNELS NO LONGER OPEN. + AOBJN I,IMPCCZ + JUMPL I,IMPCCA + POPJ P, + +IMPCCA: CONO PI,NETOFF + MOVE B,IMSOC6(I) + TLNE B,600000 ;ACTIVE AT PI LEVEL OR LOCKED BY CORE JOB + JRST IMPCCS + HRRZ B,IMSOC4(I) ;DISPATCH ON SOCKET STATE. + JRST @IMPCCT(B) + +IMPCCT: OFFSET -. +%NSCLS::IMPCC1 +%NSLSN::IMPCC1 +%NSRFC::IMPCC2 +%NSRCL::IMPCC1 +%NSRFS::IMPCC2 +%NSOPN::IMPCC5 +%NSRFN::IMPCC6 +%NSCLW::IMPCC7 +%NSCLI::IMPCC1 +%NSINP::IMPCC2 + OFFSET 0 + +;IMP BUFFER RETURN +IMPBRT: SKIPN IMSOC6(I) + POPJ P, ;NO BUF?? + LDB A,[221000,,IMSOC6(I)] + CAIE A,377 + JRST IMBRT1 + LDB A,[121000,,IMSOC6(I)] + PUSHJ P,IMEMR + CAIA +IMBRT1: PUSHJ P,IBRTN + SETZM IMSOC6(I) + POPJ P, + +IMPCC1: PUSHJ P,IMPBRT + MOVSI A,20000 + TDNE A,IMSOC5(I) + JSP T,IMPC5D ;WAITING FOR FINAL RFNM + SETZM IMSOC1(I) + SOS IMNCS ;WE HAVE FINISHED CLOSING ONE SOCKET +IMPCCS: AOBJN I,IMPCCR ;WE CLOSED ONE, OR GAVE UP ON ONE; LOOK AT NEXT + JRST NETONJ ;OR WE'RE FINISHED LOOKING AT ALL. + +IMPCC2: PUSHJ P,IMPBRT + SKIPLE T,IMFCQL + CAIG T,2 ;SKIP IF MORE THAN 2 FREE + JRST IMPCCS ;NOT ENUF PI CONTROL QUEUE BLOCKS AVAIL + LDB A,IMSCFH ;GET HOST# + SKIPGE IMPHTB(A) ;SKIP IF NO RFNM WAIT ON LINK 0 + JRST IMPCCS ;NOT NOW! + PUSH P,IMPCSH + MOVEM A,IMPCSH + JSP T,IMSTCM + 12.,,3 ;12. BYTES, 3 WORDS + JRST 4,. ;NO SLOTS AVAIL. CHECKED BEFORE + MOVEI H,3_4 ;3 NOPS + CLS + MOVEM H,10(Q) + MOVE H,IMSOC2(I) ;LOCAL SOCKET + LSH H,4 ;MOVE INTO 32 BIT FIELD + MOVEM H,11(Q) + MOVE H,IMSOC3(I) ;FOREIGN SOCKET + LSH H,4 + MOVEM H,12(Q) + PUSHJ P,IMWCQ ;SEND CLS + POP P,IMPCSH + MOVEI H,%NSCLW + HRRM H,IMSOC4(I) + MOVE H,TIME + MOVEM H,IMSOCT(I) ;TIME CLS SENT + JRST IMPCCS + +IMPCC5: MOVE H,IMSOC2(I) + TRNN H,1 ;SKIP IF SEND SOCKET + JRST IMPC5B ;RECEIVE SOCKET + MOVE A,IMSPIP(I) + CAMN A,IMSMPP(I) ;IS THERE STILL DATA TO SEND? AT MP LEVEL + CAMN I,IMPOPI ;OR PI LEVEL? OR RFNM WAIT? +IMPCC6: JSP T,IMPC5D ;YES, SEND IT AND GET RFNM BEFORE SENDING CLS +IMPC5B: MOVEI H,%NSRFS ;NO, OK TO SEND A CLS NOW. + HRRM H,IMSOC4(I);SET STATE SO WILL LOOP BACK TO IMPCC2 + JRST @IMPCCT(H) + +IMPC5A: IORM H,IMSOC5(I) + MOVE H,TIME + MOVEM H,IMSOCT(I) + JRST IMPCCS + +IMPC5D: MOVSI H,10000 + TDNN H,IMSOC5(I) + JRST IMPC5A ;TIME-OUT NOT ALREADY STARTED - START IT. +IMPC7A: MOVE H,TIME ;ALREADY STARTED, OVER YET? + SUB H,IMSOCT(I) + CAIG H,IMPCTO ;SKIP IF TIMED OUT + JRST IMPCCS ;NOT YET + JRST (T) + +IMPCC7: JSP T,IMPC7A ;IF CLOSE TIME-OUT ISN'T UP, GIVE UP TO IMPCCS. + JRST IMPCC1 ;ELSE FLUSH. + +;HERE FROM 1/2 SECOND CLOCK IF IMNAS IS NON-ZERO. +;WE WAKE UP ANY STYNET CHANNELS THAT NEED IT. +IMPAAA: SOS IMNAS ;DECREASE NEED-THIS-ROUTINE COUNT + MOVSI I,-IMPSTL +IMPAA1: MOVSI T,200000 + TDNN T,IMSOC5(I) + AOBJN I,.-1 + JUMPGE I,CPOPJ + CONO PI,NETOFF + ANDCAM T,IMSOC5(I) + PUSHJ P,IMPUIN + CONO PI,NETON + JRST IMPAA1 + +SUBTTL ARPANET NCP INPUT INTERRUPT LEVEL + +;GET HERE PI IN PROG ON NETCHN +;IMP HAS NETCHN PIA, TT HAS CONI WORD, A HAS LAST WD OF CONTROL LINK MSG +;PROCESS THE CONTROL LINK HOST-HOST PROTOCOL OPCODES. +IMPBK3: AOS B,IMBLKI ;STORE LAST WORD AS IF BLKI HAD + MOVEM A,(B) + MOVEI B,-IMPINB+1(B) ;B HAS NUMBER OF WORDS READ + CAMGE B,IMPNIW + JRST IMPCIS ;MESSAGE IS SHORT + MOVE A,IMPCBC ;NUMBER OF BYTES + MOVE B,[441000,,IMPINB] ;8 BIT BYTE POINTER TO MESSAGE + SETZM IMPNEA + SETZM IMPNRA +IMPBKL: SOJL A,IMPIR1 ;LOOP HERE TO PROCESS CONTROL MESSAGE + MOVE H,IMPCSH ;RESTORE HOST INDEX + ILDB C,B + CAIL C,IMPCDL + JRST IMPCIG ;ILLEGAL OPCODE + AOS IMPCMR(C) ;COUNT CTL MSG RCD + JRST @IMPCDT(C) ;DISPATCH ON OPCODE + +IMPCIG: BUG INFO,[NET: NEW CTL MSG FM HST ],OCT,IMPHTN(H),[COD=],OCT,C,[CT=],OCT,A + JRST IMPIR1 + +IMPCIS: MOVE H,IMPCSH + BUG INFO,[NET: SHORT CTL MSG FM HST ],OCT,IMPHTN(H) + AOS IMNSCM + JRST IMPIR1 + +IMPCDT: IMPBKL ;NOP ( 0) + IMPRFC ;RTS ( 1) + IMPRFC ;STR ( 2) + IMPCLS ;CLS ( 3) + IMPALL ;ALL ( 4) + IMPCIG ;GVB ( 5) + IMPCIG ;RET ( 6) + IMPINR ;INR ( 7) + IMPINS ;INS (10) + IMPECO ;ECO (11) + IMPCIG ;ERP (12) + IMPERM ;ERR (13) + IMPRST ;RST (14) + IMPRRP ;RRP (15) + IMPCIG ;RAR (16) + IMPCIG ;RAS (17) + IMPCIG ;RAP (20) + IMPNXR ;NXR (21) + IMPNXR ;NXS (22) +IMPCDL==.-IMPCDT + +IMSHRT: MOVNS A + BUG INFO,[NET: SHORT CTL MSG HST ],OCT,IMPHTN(H),[COD=],OCT,C,[MISSING],OCT,A + JRST IMPIR1 + +IMPNXR: ILDB C,B ;LINK NUMBER FOR NXR OR NXS + SOJA A,IMPBKL ;JUST IGNORE IT, USELESS ANYWAY + +;RFC RECEIVED C HAS OPCODE +IMPRFC: SUBI A,9 ;MUST BE AT LEAST 9 MORE BYTES + JUMPL A,IMSHRT ;MESSAGE IS SHORT + ILDB D,B ;D GETS 32 BIT FOREIGN SOCKET NUMBER +REPEAT 3,[ + LSH D,8 + ILDB T,B + IORI D,(T) +] + ILDB E,B ;E GETS 32 BIT LOCAL SOCKET NUMBER +REPEAT 3,[ + LSH E,8 + ILDB T,B + IORI E,(T) +] + ILDB R,B ;LINK NUMBER OR BYTE SIZE + MOVE Q,E + EQVI Q,(C) ;Q 1.1 = 1 IF E 1.1 = C 1.1 + ANDI Q,1 + JUMPE Q,IMPRF3 ;WRONG DIRECTION RFC + CAIE C,2 ;SKIP IF STR + JRST IMPRF5 + CAILE R,36. ;SKIP IF STR AND BYTE SIZE < 37 + JRST IMREFU ;REFUSE CONNECTION +IMPRF5: PUSHJ P,IMPLLS ;LOOK FOR LOCAL SOCKET (RET INDEX IN I) + JRST IMPRFQ ;NO SUCH SOCKET. QUEUE IT + HRRZ W,IMSOC4(I) ;SOCKET STATE + CAIE W,%NSLSN ;SKIP IF LISTENING + JRST IMPRF4 + MOVEM D,IMSOC3(I) ;STORE FOREIGN SOCKET NUMBER + DPB H,IMSCFH ;STORE FOREIGN HOST INDEX + MOVEI Q,%NSRFC + HRRM Q,IMSOC4(I) ;RFC RECEIVED STATE + CAIN C,2 ;SKIP IF RTS + JRST [ LDB Q,IMSCBS ;STR, CHECK CONNECTION BYTE SIZE + CAME Q,R + JRST IMCLDA + JRST .+2 ] + DPB R,IMSCLN ;RTS, STORE LINK # + PUSHJ P,IMPUIN ;INTERRUPT USER +IMRFCX: LDB Q,IMHSBT + CAIN Q,1 + SOS IMRFCT + MOVEI Q,2 + DPB Q,IMHSBT ;MARK HOST UP + JRST IMPBKL + +IMPRF3: BUG INFO,[NET: WRONG DIR RFC HST ],OCT,IMPHTN(H),[OP ],SIXBIT,[(C)[SIXBIT /RTS STR/]-1],[SOK],OCT,E + JRST IMPBKL + +IMPRF4: CAIE W,%NSRFS ;SKIP IF IN RFC SENT STATE + JRST IMPRFQ ;QUEUE IT + LDB Q,IMSCFH + CAMN Q,IMPCSH + CAME D,IMSOC3(I) ;FROM CORRECT FOREIGN SOCKET? + JRST IMREFU ;NO, REFUSE + AOS IMSOC4(I) ;PUT INTO STATE 5 - OPEN + CAIE C,1 ;SKIP IF RTS + JRST IMPRF2 ;STR + DPB R,IMSCLN ;STORE LINK # +IMPRF1: PUSHJ P,IMPUIN ;INTERRUPT USER + JRST IMPBKL + +IMPRF2: LDB Q,IMSCBS + CAME Q,R + JRST IMCLDA ;BYTE SIZES DIFFER, REFUSE + JSP T,IMSTCM + 8,,2 ;TEXT: 8 BYTES, 2 WORDS + JRST [ AOS IMNANS + JRST IMPRF1 ] + MOVEI H,2(I) + LSH H,16. ;LINK # + IOR H,IMSOC8(I) ;MSG ALLOC + LSH H,4 + TLO H,(4_28.) ;ALL + MOVEM H,10(Q) + MOVE H,IMSOC7(I) ;BIT ALLOC + LSH H,4 + MOVEM H,11(Q) + PUSHJ P,IMWCQ ;SEND IT OUT + JRST IMPRF1 + +IMPRFQ: CAIL E,NETSRS ;IF < 1000, START JOB "NETRFC" + JRST IMRFQ5 + MOVE T,IMPHTN(H) +; CAIE T,+_9 + CAME T,[IMPUS3-NW%ARP] ; Compare with our own host (minus net #) + SKIPL NETUSW + CAIA + JRST IMREFU ;REFUSE CONNECTION + HRROI T,NTRFCL + PUSHJ P,NUJBST ;LOAD SERVER + JRST IMREFU ;RING BUFFER FULL +IMRFQ5: SKIPGE Q,IMFFPQ ;SKIP IF ANY FREE SLOTS + JRST IMRFQ1 ;CLS OLDEST + MOVE W,(Q) + MOVEM W,IMFFPQ ;NEW FIRST FREE +IMRFQ9: SETOM (Q) ;END OF QUEUE + MOVEM E,1(Q) ;LOCAL SOCKET NUMBER + MOVEM D,2(Q) ;FOREIGN SOCKET NUMBER + CAIE C,2 ;SKIP IF STR + TLO R,400000 ;MARK AS RTS + MOVEM R,3(Q) ;LINK NUMBER OR BYTE SIZE + DPB H,[101000,,3(Q)] ;FOREIGN HOST INDEX + LDB W,[051100,,TIME] ;STORE TIME OF RECEIPT, IN 16/15 MOD 512. + DPB W,[221100,,3(Q)] + SKIPGE W,IMPEPQ ;END OF QUEUE + JRST IMRFQ2 ;QUEUE EMPTY + MOVEM Q,(W) ;PUT IN AT END OF QUEUE + MOVEM Q,IMPEPQ ;NEW END OF QUEUE + JRST IMRFCX + +IMRFQ2: MOVEM Q,IMPEPQ ;END OF QUEUE + MOVEM Q,IMPBPQ ;AND BEGINNING OF QUEUE + JRST IMRFCX + +IMRFQ1: MOVE J,IMPBPQ ;BEGINNING OF PENDING QUEUE + MOVE E,1(J) ;LOCAL SOCKET + MOVE D,2(J) ;FOREIGN SOCKET + PUSH P,IMPCSH + LDB H,[101000,,3(J)] ;FOREIGN HOST INDEX + MOVEM H,IMPCSH + PUSHJ P,IMPSCL ;SEND CLS + JRST IMRFQ3 ;NO BUFFERS AVAILABLE + AOSA IMNRFC ;# RFCS CLOSED +IMRFQ3: AOS IMNRFI ;# RFCS IGNORED + POP P,IMPCSH + MOVE H,IMPCSH + MOVE Q,IMPBPQ ;FLUSH FIRST ENTRY ON PENDING QUEUE + MOVE W,(Q) + MOVEM W,IMPBPQ + JRST IMRFQ9 + +IMREFU: PUSHJ P,IMPSCL ;SEND CLS + AOS IMNCNS ;CAN'T + AOS IMNRFI + JRST IMPBKL + +IMPCLS: SUBI A,8 ;MUST BE AT LEAST 8 MORE BYTES + JUMPL A,IMSHRT ;MESSAGE IS SHORT + ILDB D,B ;D GETS 32 BIT FOREIGN SOCKET NUMBER +REPEAT 3,[ + LSH D,8 + ILDB T,B + IORI D,(T) +] + ILDB E,B ;E GETS 32 BIT LOCAL SOCKET NUMBER +REPEAT 3,[ + LSH E,8 + ILDB T,B + IORI E,(T) +] + PUSHJ P,IMPLC ;LOOK FOR CONNECTION + JRST IMCLSQ ;LOOK IN QUEUE + MOVSI W,200000 ;SET CLS RCD BIT + IORB W,IMSOC4(I) ;RH IS STATE FOR DISPATCH + JRST @IMCLDT(W) + +IMCLDT: OFFSET -. +%NSCLS::IMPCLI +%NSLSN::IMPCLI +%NSRFC::IM2CLS +%NSRCL::IMPCLI +%NSRFS::IM4CLS +%NSOPN::IM5CLS +%NSRFN::IM6CLS +%NSCLW::IM7CLS +%NSCLI::IMPCLI +%NSINP::IMECLS + OFFSET 0 + +IM4CLS: HLLZS IMSOC4(I) .SEE %NSCLS + MOVEI W,%NCRFS + JRST IMCLDB + +IMECLS: MOVEI W,%NSCLI + JRST IMCCLS + +IMCLDA: HLLZS IMSOC4(I) .SEE %NSCLS + MOVEI W,%NCBYT ;BYTE MISMATCH + JRST IMCLDB + +IM6CLS: MOVSI W,20000 ;CLSED DURING RFNM WAIT + IORM W,IMSOC5(I) +IM5CLS: TDZA W,W .SEE %NSCLS +IM2CLS: MOVEI W,%NSRCL +IMCCLS: HRRM W,IMSOC4(I) ;CHANGE STATE + MOVEI W,%NCFRN +IMCLDB: DPB W,IMSCLS ;CLS REASON + PUSHJ P,IMPUIN ;INTERRUPT USER +IMCLQ2: PUSHJ P,IMPSCL ;SEND CLS + AOS IMNCNS + JRST IMPBKL + +IMPSCL: JSP T,IMSTCM ;SEND A CLS TO LOCAL SOCKET IN E AND FOREIGN SOCKET IN D (CLOBBERS D AND E) + 12.,,3 ;TEXT: 12 BYTES, 3 WORDS + POPJ P, + MOVEI H,3_4 ;3 NOPS + CLS + MOVEM H,10(Q) + LSH E,4 + MOVEM E,11(Q) ;LOCAL SOCKET NUMBER + LSH D,4 + MOVEM D,12(Q) ;FOREIGN SOCKET NUMBER + PUSHJ P,IMWCQ ;SEND CLS + JRST POPJ1 + +IMPCLI: AOS IMNCLI + JRST IMPBKL + +IM7CLS: HLLZS IMSOC4(I) .SEE %NSCLS + JRST IMPBKL + +IMCLSQ: PUSH P,A + PUSH P,B + MOVE A,E ;LOCAL SOCKET NUMBER + MOVEI T,0 + MOVE B,D ;FOREIGN SOCKET NUMBER + PUSHJ P,IMSPQP ;SEARCH PENDING QUEUE + JRST IMCLQ1 ;NOT THERE + MOVE E,A + POP P,B + POP P,A + JRST IMCLQ2 ;SEND HIM A CLS + +IMCLQ1: POP P,B + POP P,A + JRST IMPCLI ;CAN'T FIND HIM. IGNORE + +IMPALL: SUBI A,7 ;MUST BE AT LEAST 7 MORE BYTES + JUMPL A,IMSHRT ;MESSAGE IS SHORT + ILDB R,B ;LINK # + ILDB D,B + LSH D,8 + ILDB T,B + IORI D,(T) ;D GETS MESSAGE ALLOCATION + ILDB E,B ;E GETS BIT ALLOCATION +REPEAT 3,[ + LSH E,8 + ILDB T,B + IORI E,(T) +] + MOVE T,IMPCSH ;FOREIGN HOST + LSH T,8 + IOR R,T ;HEADER (HOST AND LINK #) + MOVEI W,1 ;TO TEST DIRECTION OF SOCKET + MOVSI I,-IMPSTL +IMPAL2: LDB T,IMSCHD ;FOREIGN HOST AND LINK NUMBER + SKIPGE IMSOC1(I) ;SKIP IF SLOT NOT IN USE + CAME T,R ;SKIP IF HEADER AGREES + JRST IMPAL1 + TDNE W,IMSOC2(I) ;SKIP IF NOT SEND + JRST IMPAL3 +IMPAL1: AOBJN I,IMPAL2 + ANDI R,377 + BUG INFO,[NET: IGNORED ALLOC HST ],OCT,IMPHTN(H),[LNK],OCT,R + AOS IMNALI + JRST IMPBKL ;IGNORE + +IMPAL3: SKIPL D + SKIPGE E + JRST 4,. + LDB T,IMSCBS ;GET BYTESIZE + IDIV E,T ;TRUNCATE TO 0 MODULO BYTESIZE + IMUL E,T ;(CLOBBER TT) + SKIPL IMSOC8(I) + SKIPGE IMSOC7(I) + JRST 4,. + ADDB D,IMSOC8(I) ;INCREASE ALLOCATIONS + ADDB E,IMSOC7(I) + MOVE Q,IMSOC5(I) + TLNE Q,140000 ;ACTIVATE IF USER (OR DIRECT CONN) CHECKING ALLOC + PUSHJ P,IMPUIN + MOVE T,IMSPIP(I) + CAME T,IMSMPP(I) ;SKIP IF OUTPUT BUFFER EMPTY + PUSHJ P,IMPIOS ;THIS GUY MAY HAVE STUFF TO GO OUT + JRST IMPBKL + +IMPLLS: MOVSI I,-IMPSTL ;LOOK FOR SOCKET IN E + MOVSI W,200000 +IMPLL2: TDNN W,IMSOC1(I) + SKIPL IMSOC1(I) ;NOT IN USE + JRST IMPLL1 + CAME E,IMSOC2(I) ;SKIP IF RIGHT LOCAL SOCKET NUMBER +IMPLL1: AOBJN I,IMPLL2 + JUMPL I,POPJ1 ;RETURN SOCKET TABLE INDEX IN RH OF I + POPJ P, ;NOT FOUND + +;INTERRUPT USER ASSOCIATED WITH CHANNEL IN I +IMPUIN: MOVSI U,200000 + TDNE U,IMSOC1(I) + POPJ P, ;CHNL BEING CLOSED + MOVE U,IMSOC5(I) + TLNE U,40000 + JRST IMPUIS ;JUMP IF SOCKET IS CONNECTED TO A STY. +IMPUIP: HRRZ U,IMSOC1(I) ;USER INDEX + LDB Q,[222000,,IMSOC1(I)] ;MASK FOR CHANNEL OPEN ON +IMPUIM: AND Q,MSKST2(U) ;ONLY ENABLED CHANNELS. + PUSH P,T ;VALIDATE THE USER INDEX + MOVEI T,LUBLK + IDIVM U,T + IMULI T,LUBLK + CAMN T,U + CAML U,USRHI + JRST 4,. + MOVSI T,(SETZ) ;PCLSR SO IT GETS IOC ERROR IF NEEDFUL + IORM T,PIRQC(U) ; EVEN IF IT DOESN'T HAVE NORMAL INTERRUPTS ENABLED + POP P,T + IORM Q,IFPIR(U) ;GEN SECOND WORD INTERRUPT + POPJ P, + +IMPUIS: PI2SAF ;HERE FOR INT. ON SOCKET CONNECTED TO A STY: + ANDI U,777 + SKIPL STYNTL-NFSTTY(U) + POPJ P, ;ALREADY ACTIVATED + MOVE Q,STYNTA ;PUT THAT STY ON THE XFER ACTIVATION LIST. + MOVEM Q,STYNTL-NFSTTY(U) + MOVEM U,STYNTA ;THEN RETURN. DON'T ACTUALLY INTERRUPT THE JOB; + POPJ P, ;IF ANYTHING FUNNY HAS HAPPENED, STYNTC WILL INTERRUPT. + +;LOOK FOR CONNECTION: LOCAL SOCKET IN E, FOREIGN SOCKET IN D, FOREIGN HOST IN H +IMPLC: MOVSI I,-IMPSTL +IMPLC2: SKIPGE IMSOC1(I) ;NOT IN USE + CAME E,IMSOC2(I) ;LOCAL SOCKET NUMBER + JRST IMPLC1 + LDB T,IMSCFH + CAMN D,IMSOC3(I) ;FOREIGN SOCKET NUMBER + CAME H,T +IMPLC1: AOBJN I,IMPLC2 + JUMPL I,POPJ1 + POPJ P, + +IMPINR: SOJL A,IMSHRT ;SHORT COUNT + ILDB D,B ;LINK # + DPB H,[101000,,D] ;CONCAT HOST&LINK + MOVSI I,-IMPSTL + LDB E,IMSCHD ;GET HOST FOR SOCKET + CAME D,E + AOBJN I,.-2 ;SEARCH FOR MATCHING HOST&LINK + JUMPGE I,IMPILS ;NOT FOUND +NCPIRS: HRRZ E,IMSOC4(I) ;STATE + MOVE E,CHNBIT(E) ;BIT TO CORRESPOND + TRNN E,1_%NSRFC+1_%NSRFS+1_%NSOPN+1_%NSRFN+1_%NSCLW+1_%NSINP + ;OK STATES RFCRCV, RFCSNT, OPEN, RNMWT, CLSSNT, DATA + JRST IMPILS ;IN BAD STATE + TRNE E,1_%NSCLW ;IGNORE INT IF CLSSNT STATE (NOT ERROR) + JRST IMPBKL + MOVSI D,4000 + IORM D,IMSOC5(I) ;INT FLAG 4.3 BIT OF IMSOC5(SOCK) + PUSHJ P,IMPUIN ;INT TO USER + JRST IMPBKL + +IMPINS: SOJL A,IMSHRT ;SHORT + ILDB D,B ;LINK + MOVEI I,-2(D) ;0,1 -> 777776,777777 ILLEGAL LINKS + CAIGE I,IMPSTL ;CHECK IN RANGE 2 TO IMPSTL+1 + SKIPL IMSOC1(I);AND IN USE + JRST IMPILS ;BAD LINK + LDB T,IMSCFH + CAMN T,IMPCSH ;SKIP IF HOST NOT MATCHED BY MSG + JRST NCPIRS +IMPILS: BUG INFO,[NET: BAD INT CTL MSG HST ],OCT,IMPHTN(H),[LNK ],OCT,D,[IMSOC4],OCT,IMSOC4(I) + JRST IMPBKL ;NOTE- I MAY BE -1 OR -2 OR UP TO 256, IF LNK BAD, IGNORE + +IMPECI: AOS IMPNEI ;WILL EVENTUALLY GIVE JOB TO MAIN PROG + JRST IMPBKL + +IMPECO: ILDB D,B ;GET 8 BIT DATA TO ECHO + SOJL A,IMSHRT + SKIPE IMPNEA + JRST IMPECI ;ONLY ONE TO A CUSTOMER + JSP T,IMSTCM + 2,,1 ;TEXT: 2 BYTES, 1 WORD + JRST IMPECI + LSH D,20. ;DATA TO BE ECHOED + TLO D,(10._28.) ;ERP + MOVEM D,10(Q) + PUSHJ P,IMWCQ ;SEND IT OUT + AOS IMPNEA + JRST IMPBKL + +IMPERM: SUBI A,11. ;COUNT BYTES + MOVE C,TIME + MOVEM C,IMPERB + MOVE C,IMPHTN(H) ;REAL HOST NUMBER + MOVEM C,IMPERB+1 + MOVE C,[441100,,IMPERB+2] + MOVEI D,11. ;BYTES TO COPY + ILDB T,B ;COPY BYTES FROM THEIR MSG + IDPB T,C + SOJG D,.-2 + BUG INFO,[NET: ERR MSG FM HST ],OCT,IMPERB+1,[MSG],OCT,IMPERB+2,OCT,IMPERB+3 + ;ONLY PRINTS FIRST 8 BYTES OF ERR INFO + JUMPGE A,IMPBKL ;IF COUNT OK, GET MORE + JRST IMSHRT ;SHORT COUNT + +IMPRSI: AOS IMPNRI + JRST IMPBKL + +IMPRST: MOVE T,IMPHTN(H) +; CAIE T,+_9 ;IF RST FROM OURSELVES, JUST SEND RRP + CAME T,[IMPUS3-NW%ARP] + PUSHJ P,IMPRSR + SKIPE IMPNRA + JRST IMPRSI + JSP T,IMSTCM + 1,,1 ;TEXT: 1 BYTE, 1 WORD + JRST IMPRSI + MOVSI D,(13._28.) ;RRP + MOVEM D,10(Q) + PUSHJ P,IMWCQ ;SEND IT OUT + PUSHJ P,IMPIOS + AOS IMPNRA + JRST IMPBKL + +IMPRSR: MOVSI I,-IMPSTL ;LOOK FOR USERS OF THIS HOST + MOVSI TT,200000 +IMPRS2: TDNN TT,IMSOC1(I) ;GUY GOING AWAY ANYHOW + SKIPL IMSOC1(I) + JRST IMPRS1 + LDB C,IMSCFH ;FOREIGN HOST + CAME C,IMPCSH + JRST IMPRS1 ;WRONG HOST + HRRZ C,IMSOC4(I) + MOVEI D,%NSCLS + CAIN C,%NSINP + MOVEI D,%NSCLI ;INPUT STILL AVAILABLE + HRRM D,IMSOC4(I) + MOVEI D,%NCRST + DPB D,IMSCLS ;CLS REASON IS RST + PUSHJ P,IMPUIN ;INTERRUPT USER +IMPRS1: AOBJN I,IMPRS2 + ;IF HOST CAN SEND A RST, IT IS UP, BUT DON'T + ;REALLY CONSIDER IT UP UNTIL RRP, RTS, OR STR IS RECEIVED + ;I DON'T KNOW WHY IT'S DONE THIS WAY + POPJ P, + +IMPRRP: LDB J,IMHSBT + SOJL J,IMPRR1 + JUMPG J,IMPBKL ;ALREADY UP, MAYBE BECAUSE OF PRIOR RTS,STR + MOVEI J,2 + DPB J,IMHSBT ;MARK HIM UP + SOS IMRFCT + JRST IMPBKL + +IMPRR1: BUG INFO,[NET: RRP W-O RST HST],OCT,IMPHTN(H) + JRST IMPBKL + +;GET CONTROL QUEUE SLOT +IMGCQS: SKIPG IMFCQL ;SKIP IF ANY LEFT + JRST IMGCQL ;NONE + SKIPG Q,IMFFCQ ;POINTER TO SLOT + JRST 4,. + MOVE W,(Q) + MOVEM W,IMFFCQ ;PATCH OUT OF FREE LIST + SETOM (Q) + SOS W,IMFCQL ;NUMBER FREE LEFT + CAIN W,1 ;SKIP IF MORE THAN ONE LEFT + SETOM IMPHI ;SET FLAG TO HOLD UP INPUT + JRST POPJ1 + +IMGCQL: AOS IMNPIL + POPJ P, + +IMWCQ: PUSHJ P,IMWPCQ + JRST IMPIOS ;START OUTPUT + +;ADD BLOCK IN Q TO OUTPUT CONTROL QUEUE, BASHES W +IMWPCQ: SETOM (Q) + SKIPGE W,IMPLCQ + JRST IMWCQ1 ;CONTROL QUEUE EMPTY + AOSE (W) + JRST 4,. ;END OF QUEUE DIDN'T POINT TO -1 + MOVEM Q,(W) + MOVEM Q,IMPLCQ + POPJ P, + +IMWCQ1: MOVEM Q,IMPLCQ + MOVEM Q,IMPNCQ + POPJ P, + +;ADD MAIN PROGRAM BLOCK TO PI QUEUE (CALL AT MP LEVEL) +IMPMPQ: MOVSI Q,777 + IORM Q,IMPMPU+1 ;NOT LOCKED BY THIS JOB ANY MORE + SKIPL U ;SKIP IF CALLED FROM DIRECT-CONNECT CLOCK LEVEL + PUSHJ P,LSWDEL ;PI LEVEL WILL UNLOCK + CONO PI,NETOFF + MOVEI Q,IMPMPL + PUSHJ P,IMWPCQ + CONO PI,NETON + JRST IMPOST + +;CALL BY JSP T,IMSTCM +;SET UP STANDARD PI CONTROL MESSAGE +;BYTE COUNT,,TEXT LENGTH +;ERROR RETURN + +IMSTCM: PUSHJ P,IMGCQS ;GET CONTROL QUEUE SLOT IN Q + JRST 1(T) ;NONE AVAILABLE + MOVSI H,17_10. ;MESSAGE TYPE = 0, LINK # = 0, NEW FMT + MOVEM H,2(Q) + MOVE H,IMPCSH ;GET IMP AND HOST + MOVE H,IMPHTN(H) +IFN 1, DPB H,[103000,,3(Q)] ; Store host addr +IFN 0,[ DPB H,[301000,,3(Q)] ;STORE HOST + LSH H,-9 + DPB H,[102000,,3(Q)] ;STORE IMP +] ;IFN 0 + HLRZ H,(T) ;BYTE COUNT + LSH H,8 + IOR H,[8_24.] ;BYTE SIZE = 8 + MOVEM H,7(Q) + HRLZ H,(T) + HRR H,IMPCSH + MOVSM H,1(Q) ;HOST INDEX,,TEXT LENGTH + JRST 2(T) ;NORMAL RETURN (NOTE THAT H HAS BEEN RESTORED TO IMPCSH) + +;RECEIVED LEADER OF REGULAR MESSAGE NOT ON CONTROL LINK +;THE HOST-HOST LEADER WORD (WD 6) HAS NOT YET BEEN DATAI'ED. +;SWITCH TO 32-BIT MODE FIRST IF NECESSARY. +IMPRMD: +IFN INETP,[ + CAIE B,IMPILB+4 ; Verify that NCP leader is next word + JRST IMPLD3 ; Barf... +] + MOVE D,IMPCSH + LSH D,8 + MOVE I,IMPCLN + IOR D,I ;HEADER + SUBI I,2 ;SOCKET TABLE INDEX + JUMPL I,IMPRM7 ;BAD LINK # + SKIPGE A,IMSOC1(I) + TLNE A,200000 ;SKIP IF NOT BEING CLOSED + JRST IMPRM7 ;SOCKET DOESNT EXIST OR BEING CLOSED + MOVEI A,1 + CAIGE I,IMPSTL + TDNE A,IMSOC2(I) ;SKIP IF RECEIVER + JRST IMPRM7 ;BAD LINK # OR MESSAGE FOR A SENDER + LDB C,IMSCHD ;HEADER + CAME D,C ;SEE IF HEADERS AGREE + JRST IMPRM7 ;NOPE, I.E. FROM WRONG HOST OR CLOSED + HRRZ D,IMSOC4(I) + CAIE D,%NSOPN + CAIN D,%NSINP + JRST IMPRMA + JRST IMPRM7 +IMPRMA: SKIPGE IMSOC6(I) ;SKIP IF NOT LOCKED BY CORE JOB + JRST IMPRMP ;LOCKED, COME BACK LATER +IFN KAIMP,[ + SKIPL IMSOC5(I) ;SKIP IF 32 BIT TRANSFER + CONO IMP,IMI32C ;SET 36 BIT INPUT + SKIPGE IMSOC5(I) ;SKIP IF NOT 32 BIT TRANSFER + CONO IMP,IMI32S ;SET 32 BIT INPUT +]IFN DMIMP,[ + SKIPL IMSOC5(I) ;SKIP IF 32BIT + CONO FI,FII32C ;SET 36BIT + SKIPGE IMSOC5(I) ;SKIP IF 36 BIT + CONO FI,FII32S ;SET 32 BIT +] + DATAI IMP,IMPILB+5 ;GET THE HEADER WORD + LDB A,IMCBBP + MOVEM A,IMPCBS + LDB B,IMSCBS ;Check for fraudulent byte size + CAME A,B + JRST IMPRMZ ;Discard message + LDB B,IMBCBP + MOVEM B,IMPCBC + MOVEM B,IMPNBI ;SAVE BYTE COUNT FOR LATER + SOSGE IMSOC8(I) + JRST IMRMAF ;MESSAGE ALLOCATION EXCEEDED + JUMPE B,IMPIRT ;ZERO LENGTH MESSAGE + IMUL A,B ;BIT COUNT + MOVN D,A + ADDB D,IMSOC7(I) ;REMAINING BIT ALLOCATION + JUMPL D,IMRMAH ;BIT ALLOCATION EXCEEDED + TRNE TT,IMPLW + JRST IMRMAG ;MESSAGE IS SHORT + MOVSI D,200000 + IORB D,IMSOC6(I) ;ACTIVE AT PI LEVEL + SKIPGE IMSOC5(I) + IDIVI A,32. + SKIPL IMSOC5(I) + IDIVI A,36. + SKIPE B + ADDI A,1 ;NUMBER OF WORDS MESSAGE WILL TAKE + HRRZ B,IMSPIP(I) ;ADDRESS WHERE MESSAGE HEADER WILL GO + SKIPL (B) + JRST 4,. ;HEADER WORD SHOULD BE -1 + HRRZ C,IMSBFE(I) ;GET ADDRESS OF LAST WORD IN BUFFER + CAML B,C + MOVEI B,-1(D) ;HEADER IS LAST IN BUFFER, SO DATA IS FIRST + MOVE E,B ;RH(BLKI POINTER) IN E + ADD A,B ;ADDRESS WHERE LAST WORD OF MESSAGE WILL GET STORED + SETZM IMNWSI ;ASSUME WILL ONLY NEED ONE BLKI + CAMG A,C + JRST IMPRM8 ;JUMP IF NO WRAP +;DROPS THROUGH + ;DROPS IN + SUB B,C ;- # WDS TO READ FIRST TIME + SUB A,C ;+ # WDS TO READ SECOND TIME + SKIPGE B + SKIPG A + JRST 4,. ;SCREW + MOVN C,A ;NEG OF REMAINING WORD COUNT + MOVSS C ;TO LEFT HALF FOR BLKI POINTER + HRRI C,-1(D) ;RING AROUND TO BEGIN OF BUFFER + MOVEM C,IMNWSI ;STORE FOR INTCHN BLKI RUNOUT (FLAG IF -) + ADD C,A ;ADR+COUNT + HRRZM C,IMPNIW ;EXPECTED END OF BLKI + SKIPA A,B +IMPRM8: SUBM B,A ;A GETS - # WORDS TO READ + MOVE B,E + HRL B,A ;BLKI POINTER + SUB E,A ;EXPECTED LAST WORD + SKIPE IMNWSI ;IF DOING 2 BLKIS, EXPECTED END ALREADY STORED + SKIPA E,IMPNIW + MOVEM E,IMPNIW ;EXPECTED LAST BLKI ADDRESS + HRRZ A,IMSPIP(I) ;SEE IF CLOBBERING GOOD-DATA PART OF BUFFER + CAIL A,@IMSMPP(I) ;SKIP IF MPP > PIP + JRST [ CAIG E,(A) + CAIGE E,@IMSMPP(I) + JRST IMPRMT + JRST 4,. ] + CAIGE E,@IMSMPP(I) + CAIG E,(A) + JRST 4,. +IMPRMT: HRRZ A,IMSOC6(I) ;SEE IF CLOBBERING CORE NOT PART OF BUFFER + CAIL E,(A) + CAILE E,@IMSBFE(I) + JRST 4,. + HRRZM I,IMPIPI ;THIS SOCKET NOW ACTIVE AT P.I. LEVEL + MOVEI C,%ISIND ; New state = reading NCP data message + JRST IMPRM9 ; Start reading + +IMPRMP: MOVSI D,100000 ;SET INPUT HELD UP BY CORE JOB + IORM D,IMSOC6(I) +IFN KAIMP,[ + MOVE D,IMPPIA + MOVEM D,IMPSVP + SETZM IMPPIA ;TURN OFF NETWORK FOR A WHILE +] +IFN DMIMP,CONO FI,FIIN+0 ;SET PIA TO 0 FOR A WHILE, CORE JOB WILL GET BACK + JRST IMPRET + +IMRMAH: AOSA IMNBAE +IMRMAF: AOS IMNMAE + JRST IMPIRT + +IMPRM7: AOSA IMNMNC +IMRMAG: AOS IMNMSS + JRST IMPIRT + +; Got Last Imp Word (in A) of regular NCP data message +; Comes here from IMPBKX. + +IMPRMB: MOVE I,IMPIPI + MOVE B,IMBLKI + CAMN B,IMPNIW + JRST IMPRMC ;ONE EXTRA WORD OF IMP PADDING, IGNORE IT + ADD B,[1,,1] ;ADDR TO NEXT WORD, COUNT TO ZERO + CAME B,IMPNIW + JRST IMPRMY + MOVEM A,(B) ;STORE LAST WORD +IMPRMC: MOVE E,IMPNBI ;# BYTES IN + ADDM E,IMSMPC(I) ;MAKE AVAIL TO M.P. + MOVEM E,@IMSPIP(I) ;STORE HEADER + AOS E,IMPNIW ;WORD AFTER MSG WILL BE NEXT HEADER + CAILE E,@IMSBFE(I) + HRRZ E,IMSOC6(I) ;WRAP + HRRM E,IMSPIP(I) ;LEAVE LH OF IMSPIP ALONE + CAIN E,@IMSMPP(I) + JRST 4,. ;BUFFER 1 WORD TOO SMALL? + SETOM (E) + MOVEI E,%NSINP + HRRM E,IMSOC4(I) ;INPUT AVAILABLE + PUSHJ P,IMPUIN ;INTERRUPT USER + MOVSI D,200000 ;CLEAR ACTIVE AT P.I. LEVEL + ANDCAM D,IMSOC6(I) + SETOM IMPIPI + JRST IMPIR1 + +IMPRMY: HRRZ E,IMPNIW ;NOT ENDING WHERE IT'S SUPPOSED TO + SUBI E,(B) ;E GETS NUMBER OF MISSING WORDS + MOVE H,IMPCSH + BUG INFO,[NET: MSG FM HST ],OCT,IMPHTN(H),[SHORT ],DEC,E,[WDS, BC],DEC,IMPCBC + JRST IMPRMC ;PRETEND HOST TRANSMITTING GARBAGE + +IMPRMZ: MOVE H,IMPCSH + BUG INFO,[NET: HST ],OCT,IMPHTN(H),[SENT BYTE SIZE ],DEC,A,[SHOULD BE],DEC,B + JRST IMPIRT ;Discard message + +SUBTTL ARPANET NCP OUTPUT INTERRUPT LEVEL + +;HERE ON COMPLETION OF TRANSMISSION OF CONTROL MESSAGE + +IMPOB6: SETZM IMPOS + SKIPN A,IMPSVQ + JRST IMPRET ;THAT WAS A NOP + HLRZ B,1(A) ;HOST TABLE INDEX + MOVSI D,400000 + IORM D,IMPHTB(B) ;SET RFNM WAIT BIT + AOS IMRFCT + LDB D,[051100,,TIME] + DPB D,[221100,,IMPHTB(B)] ;STORE TIME TOO + HLRZ T,A + HRRZS A + MOVE B,(A) + MOVEM B,(T) + JUMPGE B,IMOB7A + CAME A,IMPLCQ + JRST 4,. ;IMPLCQ GAVE WRONG LAST MESS NO. + MOVEM T,IMPLCQ + CAIN T,IMPNCQ + SETOM IMPLCQ +IMOB7A: CAIN A,IMPMPL ;SKIP IF NOT MAIN PROG BLOCK + JRST [ SETOM IMPMPU + JRST IMPRET ] + MOVE B,IMFFCQ + CAIN B,(A) + JRST 4,. ;MAKING INFINITE LOOP + MOVEM B,(A) + MOVEM A,IMFFCQ + AOS A,IMFCQL + SKIPGE B,IMPHI ;RETURN IF INPUT NOT HELD UP + CAIG A,1 ;SKIP IF INPUT HELD UP AND NOW ENOUGH FREE + JRST IMPRET + SETZM IMPHI + AOJE B,IMPRET ;INPUT WAS NOT YET SUCCESSFULLY HELD UP + AOJN B,[JRST 4,.] ;IMPHI SHOULD HAVE BEEN -2 + AOS IMPNUH + MOVE TT,IMSTAS ;GET OLD CONI + TRNE TT,IMPLW +IFN KAIMP,[ + CONO IMP,IMI32C + DATAI IMP,A +];KAIMP +IFN DMIMP,[ + CONO FI,FII32C + MOVE A,IMPSUS +];DMIMP + TRNE TT,IMPLW ;RESUME INPUT + JRST IMPBKV + SKIPE IMPIS + JRST 4,. + JRST IMSTRT + +;HERE ON COMPLETION OF TRANSMISSION OF DATA MESSAGE + +IMPOBG: SETZM IMPOS + MOVE I,IMPOPI + HRRZ Q,IMSOC4(I) + CAIN Q,%NSOPN + AOS IMSOC4(I) .SEE %NSRFN ;PUT INTO RFNM WAIT STATE + MOVSI A,20000 + CAIN Q,%NSCLS + IORM A,IMSOC5(I) + MOVSI Q,200000 + ANDCAB Q,IMSOC6(I) ;NO LONGER ACTIVE AT P.I. LEVEL + SETOM IMPOPI + MOVN A,IMPNBT ;BITS SENT + ADDM A,IMSC7I(I) ;DECREASE BITS IN BUFFER + ADDB A,IMSOC7(I) ;DECREASE ALLOCATION + SKIPL A ;SKIP IF ALLOC LOST + SOSGE IMSOC8(I) ;SKIP IF MSG ALLOC DIDN'T LOSE + JRST 4,. ;LOST + MOVE Q,IMSOC5(I) + TLNN Q,140000 ;INTERRUPT USER IF DIRECT CONNECT (CHEAP), DEPEND ON ALLOC, + SKIPN IMSMPC(I) ; OR IF OUTPUT BUFFER WAS FULL, + PUSHJ P,IMPUIN ; SINCE HE MAY WANT TO SEND MORE + MOVE A,IMPNBO ;# BYTES FREED IN BUFFER BY REMOVAL OF MSG + ADDM A,IMSMPC(I) ;SPACE USED BY MESSAGE NOW FREE + MOVE A,IMPNPT ;UPDATE IMSPIP + HRRZ Q,IMSOC6(I) ;VALIDATE THIS + CAILE Q,(A) + JRST 4,. ;POINTS BEFORE BUFFER + HRRZ Q,IMSBFE(I) + CAIGE Q,(A) + JRST 4,. ;POINTS AFTER BUFFER + MOVEM A,IMSPIP(I) ;.. + JRST IMPRET + +;OUTPUT A DATA MESSAGE. + +IMPOBD: MOVE T,TIME + SUB T,IMSOCT(I) + SKIPL IMSOC4(I) ;SKIP IF WANT TO SEND THIS BUFFER + CAIL T,30.*2 ;SKIP IF BUFFER FIRST WRITTEN LESS THAN 2 SEC AGO + JRST IMOBD1 + JRST IMPOBA ;DON'T SEND NOW, GO BACK AND LOOK FOR OTHERS + +IMOBD1: MOVE TT,IMSPIP(I) + CAMN TT,IMSMPP(I) ;SKIP IF ANY BITS TO SEND + JRST IMPOBA ;NO + SKIPE IMSOC7(I) ;SKIP IF NO BITS ALLOCATED + SKIPN IMSOC8(I) ;SKIP IF MSG ALLOCATED + JRST IMPOBA ;NO BITS OR NO MSGS ALLOWED + MOVSI Q,200000 + IORB Q,IMSOC6(I) ;ACTIVE AT PI LEVEL + +;CODE TO SEND OUT A BUFFER OR PARTIAL BUFFER +;ON ENTRY - I/ SOCKET TABLE INDEX +; Q/ BUFFER POINTER FROM IMSOC6 +; TT/ BYTE POINTER TO FIRST BYTE TO SEND +;SETS UP - T/ WORD SIZE (32 OR 36) +; E/ FLAGS FROM IMSOC5 +; B/ BYTE SIZE +; C/ # BITS TO SEND + + SETZM IMPNBO + MOVE T,IMSMPP(I) + MOVEM T,IMOB0Z ;SAVE FOR DEBUGGING + MOVEI T,32. + SKIPL E,IMSOC5(I) ;SKIP IF IN 32BIT MODE + MOVEI T,36. ;SET 36BIT + LDB B,IMSCBS ;BYTE SIZE + HRRZ C,IMSMPP(I) ;COMPUTE # OF BYTES TO SEND + SUBI C,(TT) + JUMPL C,[MOVE D,IMSBFE(I) ;WRAPS AROUND + SUB D,Q + ADDI C,1(D) ;SO ADD # WDS IN BUFFER + JRST .+1] + IMUL C,T ;FIRST GUESS AT NUMBER OF BITS + LDB A,[360600,,TT] ;GETS POSITION FIELD OF BYTE PTR + LDB D,[360600,,IMSMPP(I)] + SUBM A,D ;CORRECTION TO NUMBER OF BITS + ADD C,D ;C NOW HAS NUMBER OF SENDABLE BITS IN BUFFER + SKIPL E ;SKIP IF 32BIT + JUMPN A,IMOB5A ;36BIT - JUMP IF NOT 0 (MIDDLE OF WORD) + CAILE A,4 ;32BIT - SKIP IF 4, OR 36BIT 0 - SKIP IF NOT MID-WORD + JRST IMOB5B ;32BIT MID-WORD - SEND PART OR REST OF WORD + CAME TT,IMSBFE(I) ;AT RIGHT OF WORD, IS IT LAST WORD? + AOSA TT ;NO, ADVANCE TO NEXT + HRR TT,Q ;YES, WRAP AROUND TO FIRST + TLO TT,440000 ;SWITCH FROM RIGHT OF WORD TO LEFT OF WORD + CAMG C,IMSOC7(I) ;SKIP IF TOO BIG FOR ALLOCATE + CAILE C,8000. ;FITS IN ALLOCATE, SKIP IF FITS IN IMP MESSAGE + JRST IMOB1 ;MUST SEND LESS THAN ALL THE BITS IN BUFFER +IMOB0F: MOVE D,IMSMPP(I) ;SENDING WHOLE BUFFER + LDB J,[360600,,D] ;ADVANCE IMSMPP TO NEXT WORD BOUNDARY + ADDI J,-36.(T) ;RH(J) := # BITS TO ADVANCE TO WORD BOUNDARY + MOVNI J,(J) + IDIV J,B + ADDM J,IMSMPC(I) ;SUBTRACT FROM FREE THE BYTES SKIPPED OVER + MOVNM J,IMPNBO ;BUT RETURN TO FREE AFTER TRANSMISSION + HLL D,IMSBFE(I) ;NOW ADVANCE IMSMPP TO RIGHT END OF WORD + MOVEM D,IMSMPP(I) ;AND IMSPIP WILL GET SET EQUAL TO IMSMPP +IMOB0A: MOVEM D,IMPNPT ;ILDB -> FIRST BYTE TO SEND OUT NEXT TIME + JUMPLE C,[JRST 4,.] ;SOMEBODY COMPUTED BAD # BITS + MOVE A,C + IDIV C,B ;C := # BYTES GETTING SENT + JUMPN D,[JRST 4,.] ;LOSS, TRYING TO SEND PARTIAL BYTE + ADDM C,IMPNBO ;# BYTES TO RETURN TO FREE AFTER MSG SENT + MOVEM A,IMPNBT ;# BITS TO SUBTRACT FROM ALLOCATION THEN +;DROPS THROUGH + ;DROPS IN +;NOW SET UP BUFFER HEADER FOR IMP MESSAGE IN IMOLDR +; TT -> FIRST WORD TO SEND +; A NUMBER OF BITS TO SEND +; C NUMBER OF BYTES +; B BYTE SIZE +; T WORD SIZE +; E FLAGS + + LDB H,IMSCFH ;HOST TABLE INDEX + MOVEI Q,IMOLDR-2 ;HACK HACK + PUSHJ P,STHSTP ;STORE HOST NUMBER, MESSAGE TYPE 0 + LDB Q,IMSCLN ;LINK NUMBER + DPB Q,[001000,,IMOLDR+1] + LDB Q,[221000,,IMSOC6(I)] ;GET BUFFER TYPE + MOVEI D,4 + CAIN Q,377 + MOVEI D,7 + DPB D,[400400,,IMOLDR+1] ;STORE HANDLING TYPE, DEPENDING ON BUFFER SIZE + DPB B,[201000,,C] ;STORE SIZE IN SAME WD AS COUNT + LSH C,8 + MOVEM C,IMOLDR+5 ;HOST-HOST HEADER - 00,SIZE,BYTE-COUNT,0000 +IFN KAIMP,CONO IMP,IMO32C +IFN DMIMP,CONO FI,FIO32C ;36BIT MODE FOR HEADER, AND NO PIA YET + DATAO IMP,IMOLDR ;OUTPUT THE FIRST LEADER WORD + SETZM IMOPNT ;START AT BEGINNING OF IMOLST + MOVE B,[-5,,IMOLDR] ;SEND REST OF LEADER + MOVEM B,IMOLST + MOVEI B,3 + SKIPGE E + MOVEI B,2 + MOVEM B,IMOMOD ;SEND DATA IN 32 OR 36 BIT MODE AS APPROPRIATE + ADDI A,-1(T) ;ROUND UP IF NOT EXACT + IDIV A,T ;# WDS TO SEND + MOVEI D,-1(TT) ;FIRST WORD TO SEND MINUS ONE + ADDI D,(A) ;LAST WORD TO SEND + CAIG D,@IMSBFE(I) ;SKIP IF WRAP + JRST IMOB7 + HRRZ B,IMSBFE(I) ;COMPUTE # TO SEND FIRST TIME + SUBI B,-1(TT) ;B GETS PLUS NUMBER TO SEND FIRST TIME + SUBM B,A ;A GETS MINUS NUMBER TO SEND SECOND TIME + MOVNI C,(B) + HRLI C,-1(TT) ;C GETS SWAPPED BLKO POINTER FOR FIRST TIME + MOVE Q,IMSOC6(I) ;POINTER TO BUFFER +IFN KAIMP,[ + MOVEI B,3 ;SEND LAST WORD SEPARATELY + MOVEM B,IMOBK2 + AOJE A,.+3 +] HRLI A,-1(Q) ;BLKO POINTER FOR SECOND TIME + MOVSM A,IMOBK2 +IFN KAIMP,[ + MOVNI A,(A) + ADDI A,-1(Q) + HRROM A,IMOBK3 ;STORE BLKO POINTER TO LAST WORD +] + JRST IMOB8 + +IMOB7: MOVSI C,3 ;NO WRAP, SO NO SECOND BLKO + MOVSM C,IMOBK2 +IFN KAIMP,[ + SOS D + HRROM D,IMOBK3 ;DO LAST WORD SEPARATELY + SOJE A,IMOB8 ;SPECIAL CASE LAST WORD IS ONLY WORD +] + MOVNI C,(A) ;MAKE BLKO POINTER + HRLI C,-1(TT) +IMOB8: MOVSM C,IMOBK1 + MOVSI TT,400000 ;TURN OFF "SEND ME" + ANDCAM TT,IMSOC4(I) + HRRZM I,IMPOPI ;SAVE INDEX FOR BLKO RUNOUT + AOS IMPMSS+0 + MOVEI C,%ISOND ;STATE FOR "END OF DATA" + JRST IMOB9 + +;BUFFER CANNOT BE SENT AS 1 MSG. GRT ALLOC OR 8000 BITS. + +IMOB1: MOVE C,IMSOC7(I) ;ALLOC + CAILE C,8000. + MOVEI C,8000. ;C := MIN(BITS IN BUFFER, ALLOC, MAX IMP MSG SIZE) + TLNE E,2000 ;SKIP IF BYTES EXACTLY FIT IN WORD + JRST IMOB3 ;MUST SEND MULTI WORDS + CAMGE C,T ;SKIP IF ALLOC GEQ WDSIZ + JRST IMOB2 ;MUST SEND PART WORD + IDIV C,T ;#WDS + MOVE D,C + IMUL C,T ;#BITS IN THOSE WDS +IMOB1A: ADDI D,-1(TT) ;LAST WORD OUTPUT + CAIG D,@IMSBFE(I) + JRST .+3 + SUBI D,@IMSBFE(I) ;WRAP AROUND + ADDI D,-1(Q) + HLL D,IMSBFE(I) ;PUT IN BYTE PART (RIGHT END OF WORD) + JRST IMOB0A ;BUILD HEADER AND OUTPUT + +;SEND PART OF WORD BECAUSE ALLOC IS TOO SMALL + +IMOB2: MOVE D,TT ;-> FIRST BYTE TO BE SENT + MOVNI A,-36.(C) ;36-BITS SENT + DPB A,[360600,,D] ;IS NEXT BYTE TO GO + JRST IMOB0A + +;SEND PARTIAL BUFFER OF BYTES WHICH DO NOT FIT EXACTLY IN WORDS (E.G. 7BIT BYTES) +;MUST SEND A "QUANTUM" WHICH FOR LAZINESS' SAKE IS 36 BYTES + +IMOB3: MOVEI A,36. ;#BITS IN A WORD + IMUL A,B ;#BITS IN A QUANTUM + IDIV C,A ;# QUANTA + JUMPE C,IMOB4 ;NOT ENOUGH ALLOC FOR EVEN 1 QUANTUM, SORRY CHARLIE + MOVE D,C + IMUL C,A ;#BITS TO SEND + IMUL D,B ;#WDS TO SEND (36 BYTES TAKE WDS) + JRST IMOB1A + +;NEED MORE ALLOCATE TO SEND A BUFFER FOR THIS ODD-SIZE CONNECTION + +IMOB4: MOVSI T,200000 + ANDCAM T,IMSOC6(I) ;CLEAR "ACTIVE AT PI LEVEL" BIT + JRST IMPOBA ;MAYBE TRY ANOTHER ONE + +;SENDING REST OF PARTIAL WORD (PI PTR NOT AT WORD BOUNDARY) +;A/ BITS LEFT IN WORD + +IMOB5A: SKIPA C,A ;36BIT GETS WHOLE WD +IMOB5B: HRREI C,-4(A) ;32BIT GETS 4 LESS + MOVNI J,-36.(A) ;# BITS SHIFT TO LEFT JUSTIFY + HRRZ D,TT + CAIN D,@IMSMPP(I) ;IF WHOLE REST OF BUFFER IS IN THIS WORD + JRST [ LDB D,[360600,,IMSMPP(I)] + SUB A,D ;A := NUMBER OF BITS TO SEND + MOVE C,(TT) ;ALIGN BITS TO BE SENT IN LEFT OF WORD + LSH C,(J) + MOVEM C,(TT) + MOVE C,A + JRST IMOB0F ] ;RE-ALIGN POINTERS TO WORD BOUNDARY + CAMLE C,IMSOC7(I) ;SKIP IF WILL FIT IN ALLOC + JRST IMOB6 ;MUST SEND BYTES NOT LEFT JUST IN WD, AND MORE TO RIGHT + MOVE D,(TT) ;GET WORD + LSH D,(J) ;LEFT JUSTIFY + MOVEM D,(TT) + MOVE D,TT + HLL D,IMSBFE(I) ;ADVANCE PI POINTER TO END OF THIS WORD + JRST IMOB0A ;BUILD HDR & SEND + +;SEND MIDDLE PART OF WORD. BECAUSE OF SMALL ALLOCATES, THE LEFT END OF THE +; WORD WAS SENT AND ALSO THERE IS NOT ENOUGH ALLOCATE TO SEND THE REST +; OF THE ONE WORD. THIS MIGHT NEVER OCCUR EXCEPT FOR 8 BIT BYTES. +;MUST MOVE GOOD BITS TO LEFT END OF WORD, WITHOUT DISTURBING BITS TO THE RIGHT + +IMOB6: MOVE C,IMSOC7(I) ;CAN ONLY SEND ALLOC BITS + SUB A,C ;POS OF LO BIT TO PICK UP + DPB A,[360600,,TT] ;POS IN BYTE PTR + MOVE D,TT ;SAVE ADVANCED PI PNTR + DPB C,[300600,,TT] ;STORE AS SIZE OF BYTE + LDB R,TT ;GET BYTE + MOVNI A,-36.(C) ;POS OF LO BIT TO STORE + DPB A,[360600,,TT] ;POS IN B PTR + DPB R,TT ;STORE BYTE AWAY + JRST IMOB0A ;SEND THE BYTE(S) + +OVHMTR UUO ;YET MORE RANDOM UUOS diff --git a/system/net.31 b/system/net.31 new file mode 100644 index 0000000..02eee3f --- /dev/null +++ b/system/net.31 @@ -0,0 +1,507 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;; For ITS network stuff, the following parameters are defined: +; +; NETP - General network code (net independent, both CHAOS, NCP, TCP, etc) +; INETP - Internet Protocol code. Must have IMPP or some other device. +; NCPP - Include NCP code (IMPP must be on) +; TCPP - Include TCP code (INETP must be on) + +; CHAOSP - Include CHAOS net code +; - other CHAOS stuff, all independent of internet stuff. + +NE%UNT==:<1_32.> ; Escape bit indicating non-Internet address +NW$BYT==:301400 ; Byte pointer to network number (approx!) +NE%STR==:<1_33.> ; Escape bit indicating string-type address + +DEFINE HOSTN A,B,C,D +.RADIX 10.,<<<<+B>_8>+C>_8>+D,!TERMIN + +; HOSTS3 full word network # values for certain networks + +NW%CHS==:> +NW%ARP==:<12_24.> +NW%LCS==:<22_24.> +NW%AI==:HOSTN 128,52,0,0 + +DEFINE GETNET AC,(ADDR) ; Macro to extract net number +IFNB [ADDR] MOVE AC,ADDR + TLNN AC,(17_32.) ; Check for non-Internet type addrs + TLNN AC,(1_31.) ; Internet address, see if class A net + TDZA AC,[77,,-1] ; Unternet or class A, zap low 3 octets + TLNN AC,(1_30.) ; Class B or C, see which. + TRZA AC,177777 ; Class B network, zap low 2 octets + TRZ AC,377 ; Class C net, only zap 1 low octet +TERMIN + +;;; Misc defs +CALL== +RET== +CALRET== + +IFN IMPP,[ ; ARPAnet IMP interface code +IFN KAIMP,[ +$INSRT IMPOLD +] +IFN KSIMP,[ +$INSRT IMP +] +] + +IFN NCPP,[ ; Old Arpanet NCP protocol code +$INSRT NCP +] + +IFN INETP,[ ; Internet Protocol code +$INSRT INET +] + +IFN TCPP,[ ; Transmission Control Protocol code +$INSRT TCP +] + +IFN CHAOSP,[ ; CHAOSnet interface and protocol code +$INSRT CHAOS +] + +SUBTTL General Network System Calls + +; .CALL NETRFC - Get a pending Request For Connection for a specific network +; Arg 1 - SIXBIT name of network +; Arg 2 - optional network-dependent arg +; (for CHAOS, points to packet buffer) +; Val 1 - network-dependent value +; For TCP and ARPNCP, this is ,, +; Control bits: + %NQREF==:1 ; Arg 2 is previously returned identifier, + ; refuse connection and flush from queue. + +NETRFC: MOVE C,CTLBTS(U) ; Set up control bits in C +IFN TCPP,[ + CAMN A,[SIXBIT /TCP/] + JRST TCPRQ +] +IFN CHAOSP,[ + CAMN A,[SIXBIT /CHAOS/] + JRST [ TRNE C,%NQREF ; If refusing conn, + JRST OPNL12 ; Ignore, can't handle yet. "Mode not avail" + CAIGE W,2 ; Must have a 2nd arg + JRST OPNL30 ; "Too few args" + MOVE A,B ; Fake out old CHAOSQ call + JRST CHAOSQ] +] +IFN NCPP,[ ; NOP for now +; CAMN A,[SIXBIT /ARPNCP/] +; JRST IMPRQ +] + JRST OPNL33 ; No match, say "meaningless args". + +; .CALL NETBLK - Wait for net channel state to change, or time out. +; Arg 1 - Channel (comes in R) +; Arg 2 - Undesired state +; Arg 3 - Optional timeout (as in .SLEEP), written back unless immediate +; Val 1 - New state +; Val 2 - Time left + +NETBLK: HRRZ T,(R) ; Get IOCHNM RH = device index + HLRZ I,(R) ; Get LH = often connection index +IFN NCPP,[ + CAIL T,NETDUI + CAILE T,NETDBO + CAIA + JRST [MOVE T,[HRRZ A,IMSOC4] + JRST NETBLI] +] ;NCPP +IFN CHAOSP,[ + CAIE T,CHAIDN + CAIN T,CHAODN + JRST [MOVE T,[HRRZ A,CHSSTA] + JRST NETBLI] +] ;CHAOSP +IFN TCPP,[ + CAIN T,TCPDUI + JRST [ MOVE T,[HLRZ A,XBSTAU] + JRST NETBLI] + CAIN T,TCPDUO + JRST [ MOVE T,[HRRZ A,XBSTAU] + JRST NETBLI] +] ;TCP + JRST OPNL34 ; Not a net chan, say "Wrong Type Device". + + +; T/ Instruction to XCT (not indexed) to get state in A +; Entry at NETBLI adds (I) to the instruction. + +NETBLI: ADDI T,(I) ; Provide "index" for instruction. +NETBL0: CAIGE W,3 + JRST [ HRLOI D,377777 ; No time given, use infinity + JRST NETBL4 ] + TLNE C,1000 ; Skip if pointer rather than immediate + JRST [ HRRZ D,C ; Get immediate time + ADD D,TIME + JRST NETBL4 ] + XCTR XRW,[MOVES D,(C)] ; Get time, check writeability + JUMPGE D,[ MOVNS D ; Relative time, make negative absolute + SUB D,TIME + JRST .+1 ] + UMOVEM D,(C) ; Store back absolute time + MOVNS D ; Make positive +NETBL4: MOVEM D,AC0S+D(U) ; Save absolute time to wait until + MOVEM B,AC0S+B(U) ; Save undesired state + PUSHJ P,NETBL2 ; Skip if state change or timeout + PUSHJ P,UFLS + MOVE B,D + SUB B,TIME ; How much used? + XCT T ; Return new state + JRST POPJ1 + +NETBL2: XCT T ; Get current state + CAME A,AC0S+B(U) ; Skip if still match + JRST POPJ1 + MOVE A,AC0S+D(U) ; Timeout time + CAMG A,TIME + AOS (P) + POPJ P, + +SUBTTL Utilities - CVTH2A, CVTH3A + + +; CVH2NA - Convert network host address in A to HOSTS2 format. +; A/ net address (any format) +; Returns A + +CVH2NA: PUSH P,B + LDB B,[301400,,A] ; Get high 12 bits of net address + CAIGE B,70 ; If less than lowest HOSTS2-fmt value + JUMPN B,CVH2N3 ; then must be HOSTS3, go convert. + CAIL B,1000 ; If any of high 3 bits set, + JRST CVH2N3 ; then it's a HOSTS3 strange-fmt number. + JUMPN B,CVH2N2 + CAILE A,377 ; Zero network, so must be ARPA net + JRST CVH2N1 ; Not just 8 bits, just add net number. + + ; Old-style 8-bit Arpanet host number + LSHC A,-6. + ROT B,6. + DPB B,[112000,,A] +CVH2N1: TLO A,(12_33) + JRST POPBJ + + ; Probably HOSTS2 format number +CVH2N2: JRST POPBJ ; For now, that's good enough. + + ; HOSTS3 format number, convert it. +CVH2N3: CAIN B,12 ; Arpa net? + JRST [ LSHC A,-16. + ANDI A,377 + ROT B,16. + DPB B,[112000,,A] + TLO A,(12_33) + JRST POPBJ] + CAIN B,7+ ; Chaos net? + JRST [ ANDI A,177777 ; Yup, fix it up. + TLO A,(7_33) + JRST POPBJ] + CAIN B,22 ; LCS net? + JRST [ LSHC A,-8. + ANDI A,-1 + LSH A,2 + LSHC A,8. + TLO A,(22_33) + JRST POPBJ] + + ; Not a known net, but try to do something plausible. + ANDCM A,[-1_24.] ; Preserve low 24 bits + DPB B,[331100,,A] ; put net # into HOSTS2 field. + POP P,B + RET + +; CVH3NA - Convert network host address in A to HOSTS3 (Internet) format. +; A/ net address (any format) +; Returns A + +CVH3NA: PUSH P,B + LDB B,[301400,,A] ; Get high 12 bits of net address + CAIGE B,70 ; If less than lowest HOSTS2 value, + JUMPN B,CVH3N3 ; it's already HOSTS3 format! (unless zero) + CAIL B,1000 ; If any of high 3 bits were set, + JRST CVH3N3 ; it must be a HOSTS3 strange-fmt addr. + JUMPN B,CVH3N2 ; If not zero, then must assume HOSTS2 fmt. + + ; Old-format 8-bit Arpanet host number, or HOSTS2 with zero net. + CAILE A,377 + JRST CVH3N6 ; If greater than 8 bits, assume HOSTS2, zero net. + LSHC A,-6 ; Put 10 bits spacing between host/imp #s. + LSH B,-<2+8.> + LSHC A,<2+8.+6> + TLO A,(12_24.) ; and add ARPA network number. + JRST CVH3N3 + + ; HOSTS2 format number +CVH3N2: TRZE B,7 ; Zap low 3 bits to ensure correct comparison + JRST CVH3N5 ; If any were set, can't be Chaosnet. + CAIN B,7_3 ; Chaos net? + JRST [ ANDI A,177777 ; Yes, kill all but bottom 16 bits + TLO A,(NE%UNT+<7_24.>) ; Add Chaos net # + JRST CVH3N3] +CVH3N5: CAIN B,12_3 ; Arpa net? +CVH3N6: JRST [ LSHC A,-9. + ANDI A,177777 + ROT B,9. + DPB B,[201000,,A] + TLO A,(12_24.) + JRST CVH3N3] + CAIN B,22_3 ; LCS net? + JRST [ LSHC A,-8. + LSH A,-2 + ANDI A,377 + LSHC A,-8. + TLO A,(22_24.) + JRST CVH3N3] + + ; No match, assume it's HOSTS3. + +CVH3N3: POP P,B + RET + +;.CALL STYNET +;ARG 1 - STY CHANNEL +;ARG 2 - NET INPUT CHANNEL TO CONNECT STY OUTPUT TO, OR -1 TO DISCONNECT +;ARG 3 - NET OUTPUT CHANNEL TO CONNECT STY INPUT TO +;ARG 4 - CHARS TO SEND WHEN OUTPUT .RESET HAPPENS ON STY'S TTY +; UP TO 3 8-BIT CHARACTERS, LEFT JUSTIFIED. + +NSTYNT: TLNN R,%CLSST + JRST OPNL34 ;1ST ARG NOT A STY CHANNEL. + HLRZ I,(R) ;GET TTY # OF STY + HRRES B ;ALLOW IMMEDIATE -1 + JUMPGE B,NSTYN2 ;JUMP IF CONNECTING. + PUSHJ P,NSTYN0 ;DISCONNECT + JRST OPNL41 ;WASN'T CONNECTED + JRST POPJ1 + +;VARIOUS ROUTINES CALL HERE WITH THE TTY# OF A STY IN I, TO DISCONNECT THE +; STY FROM THE NETWORK. NOTE THIS ROUTINE MUST NOT CHANGE U AND MUST NOT +; LSWCLR, SINCE IT COULD BE CALLED FROM IODCL VIA STYCLS OR NETCLS. + +NSTYN0: MOVSI B,%SSNET ;DISCONNECTING BOTH SIDES. + CONO PI,NETOFF + TDNN B,STYSTS-NFSTTY(I) + POPJ P, ;THIS STY NOT CONNECTED? + ANDCAB B,STYSTS-NFSTTY(I) ;MARK AS NO LONGER CONNECTED + MOVE C,STYNTL-NFSTTY(I) ;REMOVE THIS STY FROM ACTIVATION LIST + MOVEI D,STYNTA-STYNTL+NFSTTY +NSTYN1: CAMN I,STYNTL-NFSTTY(D) ;FIND THE STY THAT POINTS TO THIS ONE, + MOVEM C,STYNTL-NFSTTY(D) ;AND PATCH US OUT OF THE LIST. + SKIPE D,STYNTL-NFSTTY(D) ;SEARCH WHOLE LIST TILL FIND WHO POINTS TO US. + JRST NSTYN1 + SETOB C,STYNTL-NFSTTY(I) + EXCH C,STYNTI-NFSTTY(I) ;MARK THIS STY AS HAVING NO CONNECTION, GET SOCKET INDICES +IFN CHAOSP,[ + TLNE B,%SSCHA + JRST [ MOVSI B,%SSCHA ;DISCONNECT FROM CHAOS NET + ANDCAM B,STYSTS-NFSTTY(I) + MOVSI B,%CFSTY + TDNN B,CHSSTA(C) + JRST 4,. ;CHAOS DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,CHSSTA(C) + JRST NETOJ1 ] +];CHAOSP +IFN TCPP,[ + TLNE B,%SSTCP + JRST [ MOVSI B,%SSTCP ; Disconnect from TCP connection + ANDCAM B,STYSTS-NFSTTY(I) ; Flush STY's "connect" bit + MOVSI B,(XB%STY) + TDNN B,XBUSER(C) ; Make sure TCP thinks connected + BUG ; It isn't?? + ANDCAM B,XBUSER(C) + JRST NETOJ1] +] ;TCPP +IFN NCPP,[ + MOVE B,[40000,,777] + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) ;AND MARK SOCKETS WE WERE CONNECTED TO AS DISCONNECTED + MOVSS C + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) + JRST NETOJ1 +] ;NCPP +.ELSE BUG + +; Here to set up STY connection. + +NSTYN2: MOVE Q,I ;SAVE TTY # OF STY + MOVEI E,1 + MOVE A,B ;DECODE THE NETWORK INPUT CHANNEL + JSP T,CHNDCD + HRRZ A,(R) +IFN CHAOSP,[ + CAIE A,CHAIDN + CAIN A,CHAODN + JRST [ HLRZ I,(R) ;CONNECT TO CHAOS NET + CONO PI,NETOFF + MOVSI B,%CFSTY + TDNE B,CHSSTA(I) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + MOVSI C,%SSNET+%SSCHA + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + IORM B,CHSSTA(I) ;OK, HOOK UP + DPB Q,[$CFTTN,,CHSSTA(I)] + JRST NSTYN3 ] +];CHAOSP +IFN TCPP,[ + CAIE A,TCPDUI + CAIN A,TCPDUO + JRST [HLRZ I,(R) ; Connect to TCP, get TCB index + CONO PI,NETOFF + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) + JRST OPNL23 ; TCB Already connected, say "File Locked" + MOVSI C,%SSNET+%SSTCP + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ; STY already connected, say "File Locked" + DPB Q,[XB$STY (I)] ; Store TTY # to connect TCB. + JRST NSTYN3] +] ;TCPP +IFN NCPP,[ + JSP T,NETCHK ;TEST LEGALITY; OPNL IF LOSES + TDNE E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF IT'S AN OUTPUT CHANNEL + MOVE B,I ;SAVE INPUT IMSOC INDEX + MOVE A,C ;DECODE OUTPUT CHANNEL + JSP T,CHNDCD + JSP T,NETCHK + TDNN E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF INPUT SOCKET + CONO PI,NETOFF + MOVE E,[40000,,777] + TDNN E,IMSOC5(B) ;ERROR IF EITHER CHANNEL ALREADY CONNECTED + TDNE E,IMSOC5(I) + JRST OPNL23 ;"FILE LOCKED" + MOVSI C,%SSNET + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;SIMILAR ERROR IF STY ALREADY CONNECTED + HRR E,Q ;GET 40000,,TTY # + IORM E,IMSOC5(I) + IORM E,IMSOC5(B) ;MARK SOCKETS AS CONNECTED +] ;NCPP + +NSTYN3: SKIPGE STYNTL-NFSTTY(Q) ;HALT IF STY'S VARS ARE NOT CORRECT FOR A + SKIPL STYNTI-NFSTTY(Q) ;NON-CONNECTED STY. + JRST 4,. + IORM C,STYSTS-NFSTTY(Q) ;ALL ERROR CAUGHT, SO MARK STY CONNECTED. + HRL B,I ;PUT INPUT IMSOC IDX,, OUTPUT IMSOC IDX + MOVSM B,STYNTI-NFSTTY(Q) ;INTO THE STY + TRZ D,7777 ;STORE THE OUTPUT RESET CHARACTERS - AT MOST 3 + MOVEM D,STYORC-NFSTTY(Q) + + ;ACTIVATE IN CASE HAS UNREAD INPUT +IFN NCPP,[ + TLNN C,%SSCHA+%SSTCP + PUSHJ P,IMPUIN +] ;NCPP +IFN CHAOSP,[ + TLNE C,%SSCHA + PUSHJ P,CHINTI +];CHAOSP +IFN TCPP,[ + TLNE C,%SSTCP + PUSHJ P,TCPUII +] ;TCPP + JRST NETOJ1 + +SUBTTL Clock interrupt level code + +; NETCLK - Slow net clock. Called at clock level every 1/2 sec. +; Can clobber all ACs + +NETCLK: +IFN CHAOSP, PUSHJ P,CHACLK ; Run Chaos net 1/2-second clock +IFN TCPP, PUSHJ P,TCPCLK ; Run TCP 1/2-sec clock + SETCMB A,NETCL1 ; Flip the 1 sec switch + JUMPE A,CPOPJ ; Return unless time for 1-sec clock +IFN INETP,CALL IPFCLK ; Run IP reassembly timeout every 1 sec + RET +EBLK +NETCL1: 0 ; Flip-flop to get 1-sec ticks +BBLK + +; STYNTC - Called at clock level every 1/60 sec to process all +; necessary transfers of data between STYs and associated +; net connections + +STYNTC: CONO PI,NETOFF + SKIPN I,STYNTA ;GET HEAD OF ACTIVATE LIST + JRST NETONJ ;EMPTY + SETZM STYNTA ;COPY LIST IN CASE A STY IS PUT BACK ON + CONO PI,NETON +STYNT7: MOVE A,STYNTL-NFSTTY(I) ;GET NEXT ON LIST + MOVEM A,STYNTB ;SAVE FOR NEXT TIME AROUND LOOP + SETOM STYNTL-NFSTTY(I) ;THIS ONE IS NO LONGER ON ACTIVATE LIST + MOVE A,STYSTS-NFSTTY(I) + TLNN A,%SSNET + JRST 4,. ;STY CLAIMS NOT TO BE CONNECTED?? + MOVE R,I ;SAVE TTY # + +IFN CHAOSP,[ + TLNE A,%SSCHA + JRST STYCHA ;CONNECTED TO CHAOS NET +];CHAOSP +IFN TCPP,[ + TLNE A,%SSTCP + JRST STYTCP +] ;TCPP +IFN NCPP,[ + JRST STYNCP +];NCPP + +STYNT8: SKIPE I,STYNTB ;GET NEXT STY FROM COPIED ACTIVATION LIST + JRST STYNT7 + POPJ P, + +;SUBROUTINE TO STANDARDIZE HOST NUMBER, OPNL25 IF NO GOOD +;PROCESSES HOST NUMBER IN T, MUNGS H, CALLED BY JSP J,STDHST +STDHST: +IFN 1,[ + EXCH A,T + CALL CVH3NA ; Convert # to HOSTS3 fmt + EXCH A,T + LDB H,[301400,,T] ; Get high 12 bits (net #) + CAIE H,12 ; Should be ARPA net + JRST OPNL25 + TDZ T,[NW%ARP+<377_8.>] ; Flush the net # and logical host field + JRST (J) +] ;IFN 1 +IFN 0,[ + LDB H,[331000,,T] ;GET NETWORK-NUMBER FIELD + CAIE H,12 ;ONLY 12 OR 0 IS ACCEPTABLE + JUMPN H,OPNL25 + TDNE T,[400600,,400] ;MAKE SURE OTHER RANDOM BITS AREN'T ON + JRST OPNL25 + TLZ T,777000 ;CLEAR NETWORK NUMBER + JUMPE T,OPNL25 ;0 IS NOT ACCEPTABLE + CAIL T,400 ;SKIP IF OLD-STYLE HOST NUMBER + JRST (J) + LDB H,[060200,,T] ;GET HOST FIELD + ANDI T,77 ;GET IMP FIELD + EXCH H,T + DPB H,[112000,,T] ;RECOMBINE + JRST (J) +] ;IFN 0 diff --git a/system/net.32 b/system/net.32 new file mode 100644 index 0000000..64f702e --- /dev/null +++ b/system/net.32 @@ -0,0 +1,517 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;; For ITS network stuff, the following parameters are defined: +; +; NETP - General network code (net independent, both CHAOS, NCP, TCP, etc) +; INETP - Internet Protocol code. Must have IMPP or some other device. +; NCPP - Include NCP code (IMPP must be on) +; TCPP - Include TCP code (INETP must be on) + +; CHAOSP - Include CHAOS net code +; - other CHAOS stuff, all independent of internet stuff. + +NE%UNT==:<1_32.> ; Escape bit indicating non-Internet address +NW$BYT==:301400 ; Byte pointer to network number (approx!) +NE%STR==:<1_33.> ; Escape bit indicating string-type address + +DEFINE HOSTN A,B,C,D +.RADIX 10.,<<<<+B>_8>+C>_8>+D,!TERMIN + +; HOSTS3 full word network # values for certain networks + +NW%CHS==:> +NW%ARP==:<12_24.> +NW%LCS==:<22_24.> +NW%AI==:HOSTN 128,52,0,0 + +DEFINE GETNET AC,(ADDR) ; Macro to extract net number +IFNB [ADDR] MOVE AC,ADDR + TLNN AC,(17_32.) ; Check for non-Internet type addrs + TLNN AC,(1_31.) ; Internet address, see if class A net + TDZA AC,[77,,-1] ; Unternet or class A, zap low 3 octets + TLNN AC,(1_30.) ; Class B or C, see which. + TRZA AC,177777 ; Class B network, zap low 2 octets + TRZ AC,377 ; Class C net, only zap 1 low octet +TERMIN + +;;; Misc defs +CALL== +RET== +CALRET== + + OVHMTR NET + +IFN IMPP,[ ; ARPAnet IMP interface code +IFN KAIMP,[ +$INSRT IMPOLD +] +IFN KSIMP,[ +$INSRT IMP +] +] + + OVHMTR NET + +IFN NCPP,[ ; Old Arpanet NCP protocol code +$INSRT NCP +] + OVHMTR NET + +IFN INETP,[ ; Internet Protocol code +$INSRT INET +] + + OVHMTR NET + +IFN TCPP,[ ; Transmission Control Protocol code +$INSRT TCP +] + + OVHMTR UUO + +IFN CHAOSP,[ ; CHAOSnet interface and protocol code +$INSRT CHAOS +] + OVHMTR UUO + +SUBTTL General Network System Calls + +; .CALL NETRFC - Get a pending Request For Connection for a specific network +; Arg 1 - SIXBIT name of network +; Arg 2 - optional network-dependent arg +; (for CHAOS, points to packet buffer) +; Val 1 - network-dependent value +; For TCP and ARPNCP, this is ,, +; Control bits: + %NQREF==:1 ; Arg 2 is previously returned identifier, + ; refuse connection and flush from queue. + +NETRFC: MOVE C,CTLBTS(U) ; Set up control bits in C +IFN TCPP,[ + CAMN A,[SIXBIT /TCP/] + JRST TCPRQ +] +IFN CHAOSP,[ + CAMN A,[SIXBIT /CHAOS/] + JRST [ TRNE C,%NQREF ; If refusing conn, + JRST OPNL12 ; Ignore, can't handle yet. "Mode not avail" + CAIGE W,2 ; Must have a 2nd arg + JRST OPNL30 ; "Too few args" + MOVE A,B ; Fake out old CHAOSQ call + JRST CHAOSQ] +] +IFN NCPP,[ ; NOP for now +; CAMN A,[SIXBIT /ARPNCP/] +; JRST IMPRQ +] + JRST OPNL33 ; No match, say "meaningless args". + +; .CALL NETBLK - Wait for net channel state to change, or time out. +; Arg 1 - Channel (comes in R) +; Arg 2 - Undesired state +; Arg 3 - Optional timeout (as in .SLEEP), written back unless immediate +; Val 1 - New state +; Val 2 - Time left + +NETBLK: HRRZ T,(R) ; Get IOCHNM RH = device index + HLRZ I,(R) ; Get LH = often connection index +IFN NCPP,[ + CAIL T,NETDUI + CAILE T,NETDBO + CAIA + JRST [MOVE T,[HRRZ A,IMSOC4] + JRST NETBLI] +] ;NCPP +IFN CHAOSP,[ + CAIE T,CHAIDN + CAIN T,CHAODN + JRST [MOVE T,[HRRZ A,CHSSTA] + JRST NETBLI] +] ;CHAOSP +IFN TCPP,[ + CAIN T,TCPDUI + JRST [ MOVE T,[HLRZ A,XBSTAU] + JRST NETBLI] + CAIN T,TCPDUO + JRST [ MOVE T,[HRRZ A,XBSTAU] + JRST NETBLI] +] ;TCP + JRST OPNL34 ; Not a net chan, say "Wrong Type Device". + + +; T/ Instruction to XCT (not indexed) to get state in A +; Entry at NETBLI adds (I) to the instruction. + +NETBLI: ADDI T,(I) ; Provide "index" for instruction. +NETBL0: CAIGE W,3 + JRST [ HRLOI D,377777 ; No time given, use infinity + JRST NETBL4 ] + TLNE C,1000 ; Skip if pointer rather than immediate + JRST [ HRRZ D,C ; Get immediate time + ADD D,TIME + JRST NETBL4 ] + XCTR XRW,[MOVES D,(C)] ; Get time, check writeability + JUMPGE D,[ MOVNS D ; Relative time, make negative absolute + SUB D,TIME + JRST .+1 ] + UMOVEM D,(C) ; Store back absolute time + MOVNS D ; Make positive +NETBL4: MOVEM D,AC0S+D(U) ; Save absolute time to wait until + MOVEM B,AC0S+B(U) ; Save undesired state + PUSHJ P,NETBL2 ; Skip if state change or timeout + PUSHJ P,UFLS + MOVE B,D + SUB B,TIME ; How much used? + XCT T ; Return new state + JRST POPJ1 + +NETBL2: XCT T ; Get current state + CAME A,AC0S+B(U) ; Skip if still match + JRST POPJ1 + MOVE A,AC0S+D(U) ; Timeout time + CAMG A,TIME + AOS (P) + POPJ P, + +SUBTTL Utilities - CVTH2A, CVTH3A + + +; CVH2NA - Convert network host address in A to HOSTS2 format. +; A/ net address (any format) +; Returns A + +CVH2NA: PUSH P,B + LDB B,[301400,,A] ; Get high 12 bits of net address + CAIGE B,70 ; If less than lowest HOSTS2-fmt value + JUMPN B,CVH2N3 ; then must be HOSTS3, go convert. + CAIL B,1000 ; If any of high 3 bits set, + JRST CVH2N3 ; then it's a HOSTS3 strange-fmt number. + JUMPN B,CVH2N2 + CAILE A,377 ; Zero network, so must be ARPA net + JRST CVH2N1 ; Not just 8 bits, just add net number. + + ; Old-style 8-bit Arpanet host number + LSHC A,-6. + ROT B,6. + DPB B,[112000,,A] +CVH2N1: TLO A,(12_33) + JRST POPBJ + + ; Probably HOSTS2 format number +CVH2N2: JRST POPBJ ; For now, that's good enough. + + ; HOSTS3 format number, convert it. +CVH2N3: CAIN B,12 ; Arpa net? + JRST [ LSHC A,-16. + ANDI A,377 + ROT B,16. + DPB B,[112000,,A] + TLO A,(12_33) + JRST POPBJ] + CAIN B,7+ ; Chaos net? + JRST [ ANDI A,177777 ; Yup, fix it up. + TLO A,(7_33) + JRST POPBJ] + CAIN B,22 ; LCS net? + JRST [ LSHC A,-8. + ANDI A,-1 + LSH A,2 + LSHC A,8. + TLO A,(22_33) + JRST POPBJ] + + ; Not a known net, but try to do something plausible. + ANDCM A,[-1_24.] ; Preserve low 24 bits + DPB B,[331100,,A] ; put net # into HOSTS2 field. + POP P,B + RET + +; CVH3NA - Convert network host address in A to HOSTS3 (Internet) format. +; A/ net address (any format) +; Returns A + +CVH3NA: PUSH P,B + LDB B,[301400,,A] ; Get high 12 bits of net address + CAIGE B,70 ; If less than lowest HOSTS2 value, + JUMPN B,CVH3N3 ; it's already HOSTS3 format! (unless zero) + CAIL B,1000 ; If any of high 3 bits were set, + JRST CVH3N3 ; it must be a HOSTS3 strange-fmt addr. + JUMPN B,CVH3N2 ; If not zero, then must assume HOSTS2 fmt. + + ; Old-format 8-bit Arpanet host number, or HOSTS2 with zero net. + CAILE A,377 + JRST CVH3N6 ; If greater than 8 bits, assume HOSTS2, zero net. + LSHC A,-6 ; Put 10 bits spacing between host/imp #s. + LSH B,-<2+8.> + LSHC A,<2+8.+6> + TLO A,(12_24.) ; and add ARPA network number. + JRST CVH3N3 + + ; HOSTS2 format number +CVH3N2: TRZE B,7 ; Zap low 3 bits to ensure correct comparison + JRST CVH3N5 ; If any were set, can't be Chaosnet. + CAIN B,7_3 ; Chaos net? + JRST [ ANDI A,177777 ; Yes, kill all but bottom 16 bits + TLO A,(NE%UNT+<7_24.>) ; Add Chaos net # + JRST CVH3N3] +CVH3N5: CAIN B,12_3 ; Arpa net? +CVH3N6: JRST [ LSHC A,-9. + ANDI A,177777 + ROT B,9. + DPB B,[201000,,A] + TLO A,(12_24.) + JRST CVH3N3] + CAIN B,22_3 ; LCS net? + JRST [ LSHC A,-8. + LSH A,-2 + ANDI A,377 + LSHC A,-8. + TLO A,(22_24.) + JRST CVH3N3] + + ; No match, assume it's HOSTS3. + +CVH3N3: POP P,B + RET + +;.CALL STYNET +;ARG 1 - STY CHANNEL +;ARG 2 - NET INPUT CHANNEL TO CONNECT STY OUTPUT TO, OR -1 TO DISCONNECT +;ARG 3 - NET OUTPUT CHANNEL TO CONNECT STY INPUT TO +;ARG 4 - CHARS TO SEND WHEN OUTPUT .RESET HAPPENS ON STY'S TTY +; UP TO 3 8-BIT CHARACTERS, LEFT JUSTIFIED. + +NSTYNT: TLNN R,%CLSST + JRST OPNL34 ;1ST ARG NOT A STY CHANNEL. + HLRZ I,(R) ;GET TTY # OF STY + HRRES B ;ALLOW IMMEDIATE -1 + JUMPGE B,NSTYN2 ;JUMP IF CONNECTING. + PUSHJ P,NSTYN0 ;DISCONNECT + JRST OPNL41 ;WASN'T CONNECTED + JRST POPJ1 + +;VARIOUS ROUTINES CALL HERE WITH THE TTY# OF A STY IN I, TO DISCONNECT THE +; STY FROM THE NETWORK. NOTE THIS ROUTINE MUST NOT CHANGE U AND MUST NOT +; LSWCLR, SINCE IT COULD BE CALLED FROM IODCL VIA STYCLS OR NETCLS. + +NSTYN0: MOVSI B,%SSNET ;DISCONNECTING BOTH SIDES. + CONO PI,NETOFF + TDNN B,STYSTS-NFSTTY(I) + POPJ P, ;THIS STY NOT CONNECTED? + ANDCAB B,STYSTS-NFSTTY(I) ;MARK AS NO LONGER CONNECTED + MOVE C,STYNTL-NFSTTY(I) ;REMOVE THIS STY FROM ACTIVATION LIST + MOVEI D,STYNTA-STYNTL+NFSTTY +NSTYN1: CAMN I,STYNTL-NFSTTY(D) ;FIND THE STY THAT POINTS TO THIS ONE, + MOVEM C,STYNTL-NFSTTY(D) ;AND PATCH US OUT OF THE LIST. + SKIPE D,STYNTL-NFSTTY(D) ;SEARCH WHOLE LIST TILL FIND WHO POINTS TO US. + JRST NSTYN1 + SETOB C,STYNTL-NFSTTY(I) + EXCH C,STYNTI-NFSTTY(I) ;MARK THIS STY AS HAVING NO CONNECTION, GET SOCKET INDICES +IFN CHAOSP,[ + TLNE B,%SSCHA + JRST [ MOVSI B,%SSCHA ;DISCONNECT FROM CHAOS NET + ANDCAM B,STYSTS-NFSTTY(I) + MOVSI B,%CFSTY + TDNN B,CHSSTA(C) + JRST 4,. ;CHAOS DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,CHSSTA(C) + JRST NETOJ1 ] +];CHAOSP +IFN TCPP,[ + TLNE B,%SSTCP + JRST [ MOVSI B,%SSTCP ; Disconnect from TCP connection + ANDCAM B,STYSTS-NFSTTY(I) ; Flush STY's "connect" bit + MOVSI B,(XB%STY) + TDNN B,XBUSER(C) ; Make sure TCP thinks connected + BUG ; It isn't?? + ANDCAM B,XBUSER(C) + JRST NETOJ1] +] ;TCPP +IFN NCPP,[ + MOVE B,[40000,,777] + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) ;AND MARK SOCKETS WE WERE CONNECTED TO AS DISCONNECTED + MOVSS C + TDNN B,IMSOC5(C) + JRST 4,. ;SOCKET DOESN'T THINK IT WAS CONNECTED? + ANDCAM B,IMSOC5(C) + JRST NETOJ1 +] ;NCPP +.ELSE BUG + +; Here to set up STY connection. + +NSTYN2: MOVE Q,I ;SAVE TTY # OF STY + MOVEI E,1 + MOVE A,B ;DECODE THE NETWORK INPUT CHANNEL + JSP T,CHNDCD + HRRZ A,(R) +IFN CHAOSP,[ + CAIE A,CHAIDN + CAIN A,CHAODN + JRST [ HLRZ I,(R) ;CONNECT TO CHAOS NET + CONO PI,NETOFF + MOVSI B,%CFSTY + TDNE B,CHSSTA(I) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + MOVSI C,%SSNET+%SSCHA + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;ALREADY CONNECTED, FILE LOCKED + IORM B,CHSSTA(I) ;OK, HOOK UP + DPB Q,[$CFTTN,,CHSSTA(I)] + JRST NSTYN3 ] +];CHAOSP +IFN TCPP,[ + CAIE A,TCPDUI + CAIN A,TCPDUO + JRST [HLRZ I,(R) ; Connect to TCP, get TCB index + CONO PI,NETOFF + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) + JRST OPNL23 ; TCB Already connected, say "File Locked" + MOVSI C,%SSNET+%SSTCP + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ; STY already connected, say "File Locked" + DPB Q,[XB$STY (I)] ; Store TTY # to connect TCB. + JRST NSTYN3] +] ;TCPP +IFN NCPP,[ + JSP T,NETCHK ;TEST LEGALITY; OPNL IF LOSES + TDNE E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF IT'S AN OUTPUT CHANNEL + MOVE B,I ;SAVE INPUT IMSOC INDEX + MOVE A,C ;DECODE OUTPUT CHANNEL + JSP T,CHNDCD + JSP T,NETCHK + TDNN E,IMSOC2(I) + JRST OPNL2 ;WRONG DIRECTION IF INPUT SOCKET + CONO PI,NETOFF + MOVE E,[40000,,777] + TDNN E,IMSOC5(B) ;ERROR IF EITHER CHANNEL ALREADY CONNECTED + TDNE E,IMSOC5(I) + JRST OPNL23 ;"FILE LOCKED" + MOVSI C,%SSNET + TDNE C,STYSTS-NFSTTY(Q) + JRST OPNL23 ;SIMILAR ERROR IF STY ALREADY CONNECTED + HRR E,Q ;GET 40000,,TTY # + IORM E,IMSOC5(I) + IORM E,IMSOC5(B) ;MARK SOCKETS AS CONNECTED +] ;NCPP + +NSTYN3: SKIPGE STYNTL-NFSTTY(Q) ;HALT IF STY'S VARS ARE NOT CORRECT FOR A + SKIPL STYNTI-NFSTTY(Q) ;NON-CONNECTED STY. + JRST 4,. + IORM C,STYSTS-NFSTTY(Q) ;ALL ERROR CAUGHT, SO MARK STY CONNECTED. + HRL B,I ;PUT INPUT IMSOC IDX,, OUTPUT IMSOC IDX + MOVSM B,STYNTI-NFSTTY(Q) ;INTO THE STY + TRZ D,7777 ;STORE THE OUTPUT RESET CHARACTERS - AT MOST 3 + MOVEM D,STYORC-NFSTTY(Q) + + ;ACTIVATE IN CASE HAS UNREAD INPUT +IFN NCPP,[ + TLNN C,%SSCHA+%SSTCP + PUSHJ P,IMPUIN +] ;NCPP +IFN CHAOSP,[ + TLNE C,%SSCHA + PUSHJ P,CHINTI +];CHAOSP +IFN TCPP,[ + TLNE C,%SSTCP + PUSHJ P,TCPUII +] ;TCPP + JRST NETOJ1 + +SUBTTL Clock interrupt level code + +; NETCLK - Slow net clock. Called at clock level every 1/2 sec. +; Can clobber all ACs + +NETCLK: +IFN CHAOSP, PUSHJ P,CHACLK ; Run Chaos net 1/2-second clock +IFN TCPP, PUSHJ P,TCPCLK ; Run TCP 1/2-sec clock + SETCMB A,NETCL1 ; Flip the 1 sec switch + JUMPE A,CPOPJ ; Return unless time for 1-sec clock +IFN INETP,CALL IPFCLK ; Run IP reassembly timeout every 1 sec + RET +EBLK +NETCL1: 0 ; Flip-flop to get 1-sec ticks +BBLK + +; STYNTC - Called at clock level every 1/60 sec to process all +; necessary transfers of data between STYs and associated +; net connections + +STYNTC: CONO PI,NETOFF + SKIPN I,STYNTA ;GET HEAD OF ACTIVATE LIST + JRST NETONJ ;EMPTY + SETZM STYNTA ;COPY LIST IN CASE A STY IS PUT BACK ON + CONO PI,NETON +STYNT7: MOVE A,STYNTL-NFSTTY(I) ;GET NEXT ON LIST + MOVEM A,STYNTB ;SAVE FOR NEXT TIME AROUND LOOP + SETOM STYNTL-NFSTTY(I) ;THIS ONE IS NO LONGER ON ACTIVATE LIST + MOVE A,STYSTS-NFSTTY(I) + TLNN A,%SSNET + JRST 4,. ;STY CLAIMS NOT TO BE CONNECTED?? + MOVE R,I ;SAVE TTY # + +IFN CHAOSP,[ + TLNE A,%SSCHA + JRST STYCHA ;CONNECTED TO CHAOS NET +];CHAOSP +IFN TCPP,[ + TLNE A,%SSTCP + JRST STYTCP +] ;TCPP +IFN NCPP,[ + JRST STYNCP +];NCPP + +STYNT8: SKIPE I,STYNTB ;GET NEXT STY FROM COPIED ACTIVATION LIST + JRST STYNT7 + POPJ P, + +;SUBROUTINE TO STANDARDIZE HOST NUMBER, OPNL25 IF NO GOOD +;PROCESSES HOST NUMBER IN T, MUNGS H, CALLED BY JSP J,STDHST +STDHST: +IFN 1,[ + EXCH A,T + CALL CVH3NA ; Convert # to HOSTS3 fmt + EXCH A,T + LDB H,[301400,,T] ; Get high 12 bits (net #) + CAIE H,12 ; Should be ARPA net + JRST OPNL25 + TDZ T,[NW%ARP+<377_8.>] ; Flush the net # and logical host field + JRST (J) +] ;IFN 1 +IFN 0,[ + LDB H,[331000,,T] ;GET NETWORK-NUMBER FIELD + CAIE H,12 ;ONLY 12 OR 0 IS ACCEPTABLE + JUMPN H,OPNL25 + TDNE T,[400600,,400] ;MAKE SURE OTHER RANDOM BITS AREN'T ON + JRST OPNL25 + TLZ T,777000 ;CLEAR NETWORK NUMBER + JUMPE T,OPNL25 ;0 IS NOT ACCEPTABLE + CAIL T,400 ;SKIP IF OLD-STYLE HOST NUMBER + JRST (J) + LDB H,[060200,,T] ;GET HOST FIELD + ANDI T,77 ;GET IMP FIELD + EXCH H,T + DPB H,[112000,,T] ;RECOMBINE + JRST (J) +] ;IFN 0 diff --git a/system/ni1010.defs1 b/system/ni1010.defs1 new file mode 100644 index 0000000..311059d --- /dev/null +++ b/system/ni1010.defs1 @@ -0,0 +1,114 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Junk for Interlan NI1010A Unibus Ethernet Interface + +;Interrupt information +DEFSYM %ILVEC==300 ;Input side interrupt vector (non-standard) + ;Output side assumed to be %LHVEC+4 +DEFSYM %ILPRI==5 ;Interrupt priority (should be 6, but + ; hard to change to anything but 4!) + +DEFSYM %ILBAS==764000 ;Base of NI1010A Registers in UB space + +;Unibus Registers +DEFSYM %ILCSR==%ILBAS ;Control and Status Register +DEFSYM %ILBAR==%ILBAS+2 ;Buffer Address Register +DEFSYM %ILBCR==%ILBAS+4 ;Byte COunt Register + +;Bitz +;CSR bits +DEFSYM %ILEUA==:140000 ;Extended UB address field +DEFSYM %ILCMD==:37400 ;Command Function Code +DEFSYM %ILCD==:200 ;Command Done +DEFSYM %ILCIE==:100 ;Command Interrupt Enable +DEFSYM %ILRD==:40 ;Receive DMA done +DEFSYM %ILRIE==:20 ;Receive Interrupt Enable +DEFSYM %ILSTS==:17 ;Command Status Code + +;Commands (in %ILCMD field of CSR) +DEFSYM %ILSML==400 ;Module Loopback (through interface) +DEFSYM %ILSIL==1000 ;Set Internal Loopback +DEFSYM %ILCLM==1400 ;Clear loopback mode +DEFSYM %ILSPR==2000 ;Promiscuous Receive Mode +DEFSYM %ILCPR==2400 ;Clear Promiscuous Receive Mode +DEFSYM %ILSRE==3000 ;Set Receive-on-error bit +DEFSYM %ILCRE==3400 ;Clear Receive-on-error bit +DEFSYM %ILOFL==4000 ;Go Offline +DEFSYM %ILONL==4400 ;Go Online +DEFSYM %ILROD==5000 ;Run onboard diagnostics +DEFSYM %ILSIS==6000 ;Set Insert-source-address mode +DEFSYM %ILCIS==7000 ;Clear Insert-source-address mode +DEFSYM %ILDPA==7400 ;Set physical address to default +DEFSYM %ILSRM==10000 ;Receive all multicast packets +DEFSYM %ILCRM==10400 ;Clear Receive all multicast packets +DEFSYM %ILRRS==14000 ;Report and reset statistics +DEFSYM %ILRCD==14400 ;Report Collision Delay Times +DEFSYM %ILRCV==20000 ;Supply Receive Buffer +DEFSYM %ILLXD==24000 ;Load Transmit Data +DEFSYM %ILLXS==24400 ;Load Transmit Data and Send +DEFSYM %ILLGA==25000 ;Load Group Addreses +DEFSYM %ILDGA==25400 ;Delete Group Adresses +DEFSYM %ILLPA==26000 +DEFSYM %ILFRQ==30000 ;Flush Receive BAR/BCR Queue +DEFSYM %ILRST==37400 ;Reset + +;Error codes. Found in %ILSTS field of CSR +DEFSYM %ILEOK==0 ;Success +DEFSYM %ILERT==1 ;Success, with retries +DEFSYM %ILEBC==2 ;Illegal Command +DEFSYM %ILEIC==3 ;Invalid Command +DEFSYM %ILERE==4 ;Receiver Error +DEFSYM %ILEBB==5 ;Buffer Size Too Big +DEFSYM %ILEFS==6 ;Frams Size Too Small +DEFSYM %ILEEC==10 ;Excessive Collisions +DEFSYM %ILEBA==12 ;Buffer Not Word Aligned +DEFSYM %ILENX==17 ;Non-eXistant Memory + +;Diagnostic codes. Results from %ILROD command +DEFSYM %ILDOK==0 ;No Problem +DEFSYM %ILDCE==1 ;ROM/RAM Checksum Error +DEFSYM %ILDDE==2 ;DMA Circuitry Failed +DEFSYM %ILDXE==3 ;Transmit Circuitry Failed +DEFSYM %ILDRE==4 ;Receive Circuitry Failed +DEFSYM %ILDLE==5 ;Loopback checks failed + +;Frame status bits, returned in frame status byte +; at the top of each received packet. +DEFSYM %ILFCE==1 ;CRC Error in packet +DEFSYM %ILFAE==2 ;Alignment Error +DEFSYM %ILFFL==4 ;1+ frames lost just before + +IFN $$TEMP,EXPUNG DEFSYM + \ No newline at end of file diff --git a/system/ni1010.defs2 b/system/ni1010.defs2 new file mode 100644 index 0000000..a203a02 --- /dev/null +++ b/system/ni1010.defs2 @@ -0,0 +1,114 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Junk for Interlan NI1010A Unibus Ethernet Interface + +;Interrupt information +DEFSYM %ILVEC==300 ;Input side interrupt vector (non-standard) + ;Output side assumed to be %LHVEC+4 +DEFSYM %ILPRI==5 ;Interrupt priority (should be 6, but + ; hard to change to anything but 4!) + +DEFSYM %ILBAS==764000 ;Base of NI1010A Registers in UB space + +;Unibus Registers +DEFSYM %ILCSR=:%ILBAS ;Control and Status Register +DEFSYM %ILBAR=:%ILBAS+2 ;Buffer Address Register +DEFSYM %ILBCR=:%ILBAS+4 ;Byte COunt Register + +;Bitz +;CSR bits +DEFSYM %ILEUA==:140000 ;Extended UB address field +DEFSYM %ILCMD==:37400 ;Command Function Code +DEFSYM %ILCD==:200 ;Command Done +DEFSYM %ILCIE==:100 ;Command Interrupt Enable +DEFSYM %ILRD==:40 ;Receive DMA done +DEFSYM %ILRIE==:20 ;Receive Interrupt Enable +DEFSYM %ILSTS==:17 ;Command Status Code + +;Commands (in %ILCMD field of CSR) +DEFSYM %ILSML==400 ;Module Loopback (through interface) +DEFSYM %ILSIL==1000 ;Set Internal Loopback +DEFSYM %ILCLM==1400 ;Clear loopback mode +DEFSYM %ILSPR==2000 ;Promiscuous Receive Mode +DEFSYM %ILCPR==2400 ;Clear Promiscuous Receive Mode +DEFSYM %ILSRE==3000 ;Set Receive-on-error bit +DEFSYM %ILCRE==3400 ;Clear Receive-on-error bit +DEFSYM %ILOFL==4000 ;Go Offline +DEFSYM %ILONL==4400 ;Go Online +DEFSYM %ILROD==5000 ;Run onboard diagnostics +DEFSYM %ILSIS==6000 ;Set Insert-source-address mode +DEFSYM %ILCIS==7000 ;Clear Insert-source-address mode +DEFSYM %ILDPA==7400 ;Set physical address to default +DEFSYM %ILSRM==10000 ;Receive all multicast packets +DEFSYM %ILCRM==10400 ;Clear Receive all multicast packets +DEFSYM %ILRRS==14000 ;Report and reset statistics +DEFSYM %ILRCD==14400 ;Report Collision Delay Times +DEFSYM %ILRCV==20000 ;Supply Receive Buffer +DEFSYM %ILLXD==24000 ;Load Transmit Data +DEFSYM %ILLXS==24400 ;Load Transmit Data and Send +DEFSYM %ILLGA==25000 ;Load Group Addreses +DEFSYM %ILDGA==25400 ;Delete Group Adresses +DEFSYM %ILLPA==26000 +DEFSYM %ILFRQ==30000 ;Flush Receive BAR/BCR Queue +DEFSYM %ILRST==37400 ;Reset + +;Error codes. Found in %ILSTS field of CSR +DEFSYM %ILEOK==0 ;Success +DEFSYM %ILERT==1 ;Success, with retries +DEFSYM %ILEBC==2 ;Illegal Command +DEFSYM %ILEIC==3 ;Invalid Command +DEFSYM %ILERE==4 ;Receiver Error +DEFSYM %ILEBB==5 ;Buffer Size Too Big +DEFSYM %ILEFS==6 ;Frams Size Too Small +DEFSYM %ILEEC==10 ;Excessive Collisions +DEFSYM %ILEBA==12 ;Buffer Not Word Aligned +DEFSYM %ILENX==17 ;Non-eXistant Memory + +;Diagnostic codes. Results from %ILROD command +DEFSYM %ILDOK==0 ;No Problem +DEFSYM %ILDCE==1 ;ROM/RAM Checksum Error +DEFSYM %ILDDE==2 ;DMA Circuitry Failed +DEFSYM %ILDXE==3 ;Transmit Circuitry Failed +DEFSYM %ILDRE==4 ;Receive Circuitry Failed +DEFSYM %ILDLE==5 ;Loopback checks failed + +;Frame status bits, returned in frame status byte +; at the top of each received packet. +DEFSYM %ILFCE==1 ;CRC Error in packet +DEFSYM %ILFAE==2 ;Alignment Error +DEFSYM %ILFFL==4 ;1+ frames lost just before + +IFN $$TEMP,EXPUNG DEFSYM + \ No newline at end of file diff --git a/system/nmtape.27 b/system/nmtape.27 new file mode 100644 index 0000000..4205f5f --- /dev/null +++ b/system/nmtape.27 @@ -0,0 +1,2449 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;******************************** +;** +;** TO BE DONE: +;** +;** RECORDS LONGER THAN 1K +;** AUTOMATIC DETERMINATION OF DENSITY AND RECORD LENGTH WHEN READING +;** ALLOW CLOSE WHEN TAPE HAS BEEN TAKEN OFF +;** BE MORE FORGIVING OF CONTROLLER LOSSAGE +;** PASS .MTAPE TO JOB DEVICE +;** HAVE AN IGNORE ERRORS SWITCH +;** THIS HORRIBLE BLETCHEROUS IOT CODE SHOULD BE REDESIGNED +;** +;******************************** + + +IFE TM10A+TM10B+TM03S,.ERR NO MAGTAPE CONTROLLER TYPE SELECTED +IFN TM10A,INFORM IO BUSS MAG TAPE,1 +IFN TM10B,INFORM DATA CHANNEL MAG TAPE,1 +IFN TM03S,INFORM RH11/TM03 MAG TAPE,1 + +IFN TM10P,[ +$INSRT TM10 +] +IFN TM03S,[ +$INSRT TM03S +] +$INSRT JTWMAC + +MSCBL==8 ;Command buffer length +MGQDLL==10. ;PI level PDL length +IF2 IFN MNUMB-140600, .ERR IMPLICIT DEPENDENCY ON MNUMB +MSEOFP==210100 ;High bit of MNUMB in MEMBLT is EOF flag +MSCHN==140500 ;Other 5 bits of MNUMB is drive number + +MTXP==410300,, ;BP to set/get transport number from IOCHNM +MUNITF==170300 ;BP to set/get unit field in MTC CONI + +IFN TM10P,[ +;Tape controller commands +MNOPIN==10000 ;NOP and interrupt when idle +MWRITE==4000 ;Write data +MW3IN==14000 ;Write data and long EOR gap +MSPRR==7000 ;Space in reverse direction +MREAD==2000 ;Read data +MSPFR==6000 ;Space in forward direction +MSPFF==16000 ;Space forward to EOF +MSPRF==17000 ;Space reverse to EOF +MREWND==1000 ;Rewind +MRWNDD==11000 ;Rewind and unload +MWEOF==5000 ;Write EOF mark +] + +MGNRTY==10. ;Number of retries on read + +;Modes in OPEN call +; +%MMOUT==1,,0 ;Open for output, 0=>input +%MMBLK==2,,0 ;Block mode, 0=>unit mode +%MMIMG==4,,0 ;Image mode, 0=>Ascii +%MMCNK==10,,0 ;"Chunk" mode, 0=>stream mode +%MMNSE==20,,0 ;No skip to EOF on close, 0=>do skip +%MMEP==40,,0 ;Even parity, 0=>odd +%MMDEN==300,,0 ;Density select + ; 00=> "Default" - 1600 for KS/TU77 + ; 01=> 800 BPI + ; 10=> 1600 BPI + ; 11=> 6250 BPI +%MM32B==400,,0 ;"IBM" mode, write 8-bit bytes from LH 32 bits + ; 0=> core dump +%MMRSZ==7000,,0 ;Record Size + ; Ranging binarily from 0=>1024. to 7=>8. bytes + + +EBLK + +SUBTTL MAG TAPE STORAGE AREA + +MGVTC: 0 ;Scratch word for virgin tape check +MGJDTI: 0 ;"Wait for job done" time out value +MGNWRD: 0 ;Number of words read in a PI level read +MGTBZY: -1 ;Flag to get interrupt started +MGSFTI: 0 ;Software interrupt in progress +MGUNIT: -1 ;Unit expecting interrupt +MGWCW: 0 ;"Wait for control word written" flag +LMIOWD: 0 ;Last MIOWD + +MSRAC: BLOCK NMTCS ;Transport software status flags + %MA==1,,525252 + %MAEOF==400000 ;4.9 EOF seen on read - must be 4.9 + %MAETR==200000 ;4.8 EOT on internal read + %MAETW==100000 ;4.7 EOT on write + %MAERR==040000 ;4.6 PI level got an error + %MARCE==020000 ;4.5 Read compare error + %MACTH==014000 ;4.4 Core allocator says stop + ;4.3 " (WHY 2 BITS?) + %MASTP==002000 ;4.2 Stop read ahead + %MANWT==001000 ;4.1 Nothing written on tape yet + %MAEFA==000400 ;3.9 EOF seen on read-ahead, user hasn't seen + %MAESO==000200 ;3.8 EOF read since open + %MAMSO==000100 ;3.7 Tape moved since first open + %MAREW==000040 ;3.6 "Tape is rewinding" flag + %MARAC==000020 ;3.5 Read active flag + %MAMOL==000010 ;3.4 Transport on line + %MAWSW==000004 ;3.3 Wants software (timing) interrupts +MGERRC: BLOCK NMTCS ;Error count +MTCEFW: BLOCK NMTCS ;Number of EOF's written at close +MGEOFR: BLOCK NMTCS ;Number of EOF's since last read +MTPSAV: BLOCK NMTCS ;Storage to restore P on EOF +MSCMDC: REPEAT NMTCS,0 ;Number of commands in command list +MGSPCD: BLOCK NMTCS ;Spacing operation command +MGSCNT: BLOCK NMTCS ;Spacing operation count +MGEOTT: BLOCK NMTCS ;Timeout for detecting virgin tape +MSBUFP: REPEAT NMTCS,0 ;Mag tape MP<->PI buffer queue in,,out +MSNBOL: BLOCK NMTCS ;Number of buffers on list +MSCRW: BLOCK NMTCS ;R/W flag, -1=>output 0=>input +MSMPRC: BLOCK NMTCS ;Words left in buffer +MSMPRP: BLOCK NMTCS ;Next word in buffer +MTMDN: REPEAT NMTCS,-1 ;Block active at MP +MGCABN: REPEAT NMTCS,-1 ;Buffer active at PI level +MTUSE: REPEAT NMTCS,-1 ;Number of channels open on this transport +MTUSR: REPEAT NMTCS,-1 ;User index of transport user +MTBLKS: BLOCK NMTCS ;If write, buffer size + ;If read, size of last record read +MTMFNC: BLOCK NMTCS ;.MTAPE function storage +MTMCNT: BLOCK NMTCS ;.MTAPE count +MTMTAP: BLOCK NMTCS ;MTAPE call word + +MGCMTS: BLOCK NMTCS ;PI level status info (CONI MTS or similar) +MGCMTC: BLOCK NMTCS ;PI level controller info (CONI MTC or similar) + + IFN TM10P,[ +MTCONO: REPEAT NMTCS,\.RPCNT_17+20 ;Prototype CONO word for each transport + ] + IFN TM03S,[ +MTSELW: BLOCK NMTCS ;Select word (TC reg val) for each transport + MTSELM==3777 ;density/format/parity/unit bits mask +MTWTFC: BLOCK NMTCS ;-10 word count to tape frame conversion factor + ] + +;Build table of QDL (PI level stack) pointers +MGQDLP: REPEAT NMTCS,-MGQDLL,,CONC MGQD,\.RPCNT,-1 + +;Built storage for command lists and PI level stacks +REPEAT NMTCS,[ + CONC MSCB,\.RPCNT,: + BLOCK MSCBL ;Space for command list + MGRCV ;Fake "command", causes list to wrap around + + MGNCMD ;Function on botton of Q PDL, gets new command + CONC MGQD,\.RPCNT,: + BLOCK MGQDLL ;Space for PI level stack + + IFE .RPCNT,MSLCTB==.-MSCB0 ;Length of each table +] + +;Build table of pointers for adding commands to command list +MTCMBP: REPEAT NMTCS,-MSCBL-1,,CONC MSCB,\.RPCNT,-1 + +;Build table of bytepointers for removing commands from command list +MGCMBP: REPEAT NMTCS,4400,,CONC MSCB,\.RPCNT,-1 + +;It is depressing to discover that the DUMP program sucks these directly +; out of the running ITS. If you change what's in here fix DUMP too. + +MGEMTC: 0 ;CONI MTC, at last error +MGEMTS: 0 ;CONI MTS, at last error + +IFE TM10B,[ +MIOWD: BLOCK 2 ;Channel program +] +IFN TM10A,[ +MGDBRK: 0 + CONO MTS,1 + JRST 12,@MGDBRK +];TM10A + +BBLK + + +;Random Macros + +;Enqueue and Dequeue buffers from the lists used to pass buffers between +; main program and PI level. Assumes W has a valid transport number... + +DEFINE MTENQB REG,TEMP=TT + SKIPG MSNBOL(W) ;;Any buffers on list already? + IFSKP. + HLRZ TEMP,MSBUFP(W) ;;Yes, get old tail pointer + DPB REG,[MLO,,MEMBLT(TEMP)] ;;Add new one onto end of list + ELSE. + HRRM REG,MSBUFP(W) ;;No, make new buffer head of list + ENDIF. + HRLM REG,MSBUFP(W) ;;New buffer is tail in any event + SETZM TEMP + DPB TEMP,[MLO,,MEMBLT(REG)] ;;Indicate end of list + AOS MSNBOL(W) ;;Increment count of buffers on list +TERMIN + +DEFINE MTDEQB REG,TEMP=TT + HRRZ REG,MSBUFP(W) ;;Get head of buffer list + HLRZ TEMP,MSBUFP(W) ;;Get tail + CAMN REG,TEMP ;;Tail == head? + IFSKP. + LDB TEMP,[MLO,,MEMBLT(REG)] ;;No, get next buffer on list + HRRM TEMP,MSBUFP(W) ;;Make it the new head of list + ELSE. + SETZM MSBUFP(W) ;;Only one buffer, list is now empty + ENDIF. + SOS MSNBOL(W) ;;Decrement count of buffers on list +TERMIN + +IFN TM03S,[ +;Macros for testing various status bits as set up by MGGXPT and friends +IRP OP,,[NN,NE,NA,O,OE,ON,OA,Z,ZE,ZN,ZA,C,CE,CN,CA] + DEFINE TT!OP REG,#MSK + ...TSF==0 + IFSE REG,CS1,[ + TL!OP I,MSK + ...TSF==-1 + ] + IFSE REG,CS2,[ + TR!OP I,MSK + ...TSF==-1 + ] + IFSE REG,FS,[ + TL!OP J,MSK + ...TSF==-1 + ] + IFSE REG,ERR,[ + TR!OP J,MSK + ...TSF==-1 + ] + IFE ...TSF,.ERR Invalid register name REG given in TTxxx macro + TERMIN +TERMIN +];IFN TM03S + SUBTTL MAG TAPE OPEN ROUTINE + +; C/ MODE,,DEV +; D/ MODE (ROT 1) 4.9=1=>OUTPUT +; I/ DEVICE NUMBER +; R/ IOCHNM WORD POINTER + +MAGTO: SKIPL W,I ;Get device + CAIL W,NMTCS ;Too big? + JRST OPNL1 ;No such device + MOVSI T,%MAREW + TDNE T,MSRAC(W) ;Rewinding? + PUSHJ P,UFLS ;Yes, wait for completion + CONO PI,CLKOFF ;Don't want transport status changed under me + SKIPL MTUSE(W) ;See if we are the first opener + IFSKP. ;First opener. Initialize database for device + SETZM MSBUFP(W) ;Indicate no buffers on chain + SETZM MSNBOL(W) ;Another way of saying above + SETZM MSMPRC(W) ;Buffer words remaining + SETZM MSMPRP(W) ;Pointer to buffers + SETOM MTMDN(W) ;No buffer at MP level + SETOM MGCABN(W) ;No buffer owned by PI code + SETZM MSRAC(W) ;Initialize transport software status word + MOVEI A,2 + MOVEM A,MTCEFW(W) ;Number of EOF's written + MOVSI A,%MANWT + IORM A,MSRAC(W) ;Indicate nothing written on tape + ELSE. ;Not first opener. Check legality of this open + CAME U,MTUSR(W) ;Same user as previous open? + JRST OPNL10 ;Different user, report error + MOVE B,D ;Check direction of open + EQV B,MSCRW(W) ;Same as previous direction? + SKIPL B ;Yes, OK + JRST OPNL2 ;No, wrong direction + ENDIF. + MOVEM U,MTUSR(W) ;Store user + SETZM MSCRW(W) ;Indicate read until found to be otherwise + TLNE C,1 ;Read or write? + SETOM MSCRW(W) ;Indicate write + AOS MTUSE(W) ;Indicate 1 more user + PUSHJ P,SOSSET + MTUSE(W) ;SOS if PCLSR'd + CONO PI,CLKON ;Let um (em?) get me (who's em?) + PUSHJ P,MTSTAT ;Get transport status in standard form + MOVE A,MSRAC(W) + TLNE A,%MAERR ;PI error means device not there + JRST MTODNP ;Go report error +IFN TM03S,[ + TTNN FS,%TMSFP ;Formatter present? + JRST MTODNP ;No, can't win + ;Should check for slave present too. +] +IFN TM10P,[ + TXNN J,%T1STH ;Transport hung, by chance? + JRST MTOW1 ;No, proceed + TXNN J,%T1SRW ;OK if rewinding + JRST OPNL7 ;Device not working +] +MTOW1: SKIPN MSCRW(W) ;Writing? + JRST MTOW2 ;No... +IFN TM10P,TXNE J,%T1SWL ;Yes. Write locked? +IFN TM03S,TTNE FS,%TMSWL + JRST OPNL26 ;Yes, device writelocked error +IFN TM10P, TXNN J,%T1SET ;At EOT? +IFN TM03S, TTNN FS,%TMSET + JRST MTOW2 ;No + MOVSI A,%MAETW+%MAERR ;If write and EOT, make .IOT give IOC error, + ; but let open win + IORM A,MSRAC(W) + +MTOW2: TXNE C,%MMDEN ;Density specified explicitly? + JRST MTOW3 ;Yes, go check for validity +IFN TM10P,MOVEI A,1 ;No, pick one. Use 800 for TM10 +IFN TM03S,MOVEI A,2 ;Use 1600 for TM03 + DPB A,[.BP %MMDEN,C] ;Set value + JRST MTOW4 ;Done and assumed correct + +MTOW3: LDB A,[.BP %MMDEN,C] ;Get density from open +IFN TM10P,[ + CAIE A,1 ;800 is the only currently OK speed for TM10 + JRST OPNL12 + IFN 0,[ +;You need something like this if you arrange to allow non-800 TM10 speeds + TXNN C,%MM32B ;32-bit compatible mode requested? + JRST MTOW4 ;No, core dump + CAIN A,1 ;Density specified as 800? + JRST MTOW4 ;Yes, we can do that + JRST OPNL12 ;32-bit and not 800BPI, controller can't do it + ] +];IFN TM10P +IFN TM03S,[ + CAIN A,3 ;Specified 6250? + JRST OPNL12 ;Yep, loser. Else OK +] + +;Here on successful open. +; Set up CONO or select word, IOCHNM word, blocksize +; +MTOW4: PUSHJ P,LSWDEL ;Release MTUSE switch +IFN TM10P,[ + MOVEI A,MTCCHN_3 ;Start building CONO word. Set control PI level +IFN TM10A,TRO A,1 ;Add in data PI level for non-DF10 controller + LDB B,[.BP %MMDEN,C] ;Get density from open + CAIE B,1 ;800 BPI + BUG INFO,[ILLEGAL TM10 TAPE SPEED SETTING, USING 800BPI] + MOVEI B,%T1D80 ; Yep. + DPB B,[.BP %T1CDS,A] ;Set density field of CONO word + TXNN C,%MM32B ;32-bit mode specified? + TXO A,%T1CCD ;No, set core dump mode in CONO + TXNN C,%MMEP ;User wants even parity? + TXO A,%T1COP ;No, set odd parity + DPB W,[.BP %T1CNU,A] ;Set unit number field of CONO + MOVEM A,MTCONO(W) ;Save assembled CONO word +];IFN TM10P +IFN TM03S,[ + MOVE A,W ;Get unit number being initialized + TXNN C,%MM32B ;User asked for industry compatible? + IFSKP. ;Yes... + MOVEI B,4 ;Set word-to-frame conversion factor + MOVEM B,MTWTFC(W) + MOVEI B,%TMFIC ;Set mode in budding select word + ELSE. ;Core dump... + MOVEI B,5 ; takes 5 tape frames per word + MOVEM B,MTWTFC + MOVEI B,%TMFCD ;Set CD format in select word + ENDIF. + DPB B,[.BP %TMTFS,A] ;Set format in select word + TXNE C,%MMEP ;User wants even parity? + TXO A,%TMTEP ;Yes, set even parity flag + LDB B,[.BP %MMDEN,C] ;Get density from open + CAIE B,1 ;800 BPI specified? + SKIPA B,[%TMD16] ;Anything else, use 16 + MOVEI B,%TMD08 ;800, use that + DPB B,[.BP %TMTDS,A] ;Set density in select word + MOVEM A,MTSELW(W) ;Set select word for this unit +];IFN TM03S + LDB B,[.BP %MMRSZ,C] ;Get record size from open call + TRC B,7 ;Convert to power of two + MOVEI A,10 ;Minimum record size is 10 (8.) words + LSH A,(B) ;Blocksize = minimum * 2^power + MOVEM A,MTBLKS(W) ;Save blocksize in words + LDB A,[.BP <%MMBLK\%MMIMG>,C] + ;Use unit/block and ascii/image bits as index + HLR C,MTOPTB(A) ;Get input dispatch routine from table + TLNE D,400000 ;Remember D? Skip if user opened in input mode + HRR C,MTOPTB(A) ;OK, get output dispatch routine instead + MOVEM C,(R) ;Save routine in IOCHNM word + DPB W,[MTXP(R)] ;Set transport number in IOCHNM word + JRST POPJ1 ;Skip return means success + +;Here if device is not present +MTODNP: SETZM MSRAC(W) ;Too bad. Clear status word and report error + JRST OPNL1 + + +;Table of I/O routines +; +MTOPTB: MTUAIX,,MTUAOX ;Unit Ascii + MTBIX,,MTBOX ;Block Ascii + MTUIIX,,MTUIOX ;Unit Image + MTBIX,,MTBOX ;Block Image + + + +SUBTTL MAG TAPE CLOSE ROUTINES + +;MTOCL - CLOSE TAPE OPEN FOR OUTPUT + +MTOCL: LDB W,[MTXP(R)] ;Set up transport number + SOSL MTUSE(W) ;Decrement transport use counter + POPJ P, ;Not only channel open, all done + AOS MTUSE(W) ;Consistant state in case PCLSR'd + MOVSI A,%MAERR + TDNE A,MSRAC(W) ;See if error has occurred + PUSHJ P,MTOCL3 ;Yes, clean up a few things + + SKIPL MTMDN(W) ;Is there a partially processed buffer? + PUSHJ P,MTWBFD ;Yes, write it to tape + + MOVEI B,MGMEOT ;Queue a "Write EOT" command to PI level + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) + PUSHJ P,UFLS ;Wait till done. + MOVEI A,1 + MOVEM A,MGEOFR(W) + SKIPGE MTMDN(W) ;Active buffer at MP level? + IFSKP. + MOVE A,MTMDN(W) + BUG PAUSE,[MT: MP BUF REMAINS AT CLOSE],OCT,A + PUSHJ P,MEMR + ENDIF. + SKIPGE MGCABN(W) ;Active buffer at PI level? + IFSKP. + MOVE A,MGCABN(W) + BUG PAUSE,[MT: PI BUF REMAINS AT CLOSE],OCT,A + PUSHJ P,MEMR + ENDIF. + SKIPN MSNBOL(W) ;Any buffers on buffer queue? + IFSKP. + BUG PAUSE,[MT:],DEC,MSNBOL(W),[BFRS QUEUED AT CLOSE] + PUSHJ P,MTCBFF + ENDIF. + SETOM MTUSE(W) ;Nobody is using this transport + SETOM MTUSR(W) ;No user associated with this transport + SETZM MSRAC(W) ;reset transport software status word + POPJ P, + +MTOCL3: SKIPL A,MTMDN(W) ;Have a buffer active at MP level? + PUSHJ P,MEMR ;Flush it if so + SETOM MTMDN(W) + SETZM MSMPRC(W) ;Say no words left in current buffer + POPJ P, + +;Close routine for MT open for input + +MTICL: LDB W,[MTXP(R)] ;Set up channel data pointer + SOSL MTUSE(W) ;Last user? + POPJ P, ;No, nothing to do + AOS MTUSE(W) ;Yes, save state for possible PCLSR + MOVEI T,1 ;This crock is because we want to allow + CAMGE T,MSCMDC(W) ; one outstanding command if rewinding + PUSHJ P,UFLS ;Wait till one or less outstanding command + MOVE T,MSRAC(W) ;Get transport software status + TLNE T,%MAREW ;Is it rewinding? + IFSKP. + SKIPLE MSCMDC(W) ;No, wait till no outstanding commands + PUSHJ P,UFLS + ENDIF. + SKIPGE MGCABN(W) ;Any PI-level buffers left? + IFSKP. + MOVE A,MGCABN(W) + BUG PAUSE,[MT: PI INPUT BUF LEFT AT CLOSE],OCT,A + PUSHJ P, MEMR + ENDIF. + PUSHJ P,MTRBD ;Release any MP-level buffers + SETOM MTUSR(W) ;Reset user identifier + PUSHJ P,MTCBFF ;Free some buffers ?whose+++ + SOS MTUSE(W) ;Decrement use count + MOVE T,MSRAC(W) ;Get transport software status again + TLNE T,%MAREW ;Are we rewinding? + JRST MTICL2 ;Yes, don't have to skip to EOF + MOVSI A,(%MMNSE) + TDNE A,(R) ;Check if user wants skip to EOF + JRST MTICL2 ;No, forget it + MOVSI A,%MAMSO + TDNN A,MSRAC(W) ;Has tape moved at all since open? + JRST MTICL2 ;No... + SKIPE MGEOFR(W) ; + JRST MTICL2 ;Note that this disposes of a read-ahead EOF. + PUSHJ P,MTSTAT +IFN TM10P,[ + MOVE B,MGCMTS(W) + TXNE B,%T1SBT ;BOT? + JRST MTICL2 +] +IFN TM03S,[ + TTNN FS,%TMSOL ;Still online? + JRST MTICL2 ;No, can't very well skip to EOF + TTNE FS,%TMSBT + JRST MTICL2 +] + MOVEI B,MGSPFF ;Space forward to end of file + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) ;Wait till command done + PUSHJ P,UFLS + +MTICL2: MOVSI T,%MAREW + ANDM T,MSRAC(W) ;Clear all software status except rewinding + POPJ P, ;Done + +;Free a chain of IO buffers pointed to by MSBUFP(W) +; Count of buffers is in MSNBOL(W) +; +MTCBFF: SKIPN MSNBOL(W) ;Any buffers on chain? + POPJ P, ;No, fine + DO. + HRRZ A,MSBUFP(W) ;Yes, get pointer + LDB T,[MLO,,MEMBLT(A)] ;Get pointer to next buffer + HRRM T,MSBUFP(W) ;Write that in chain header + PUSHJ P,MEMR ;Return buffer to IO pool + SOSLE MSNBOL(W) ;Any more to do? + JRST TOP. ;Yes, loop back for more + ENDDO. + SETZM MSBUFP(W) ;Zero buffer list pointer + POPJ P, + + + +SUBTTL MAG TAPE INPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAI: MOVEI B,CHRKTI ;Unit ASCII input + MOVE E,[440700,,5] + JRST MTREAD + + SKIPA B,[SIOKT] +MTUII: MOVEI B,CHRKTI ;Unit image input + MOVE E,[444400,,1] + JRST MTREAD + +MTBI: MOVE E,[444400,,1] ;Block input + MOVEI B,BLKT + +MTREAD: LDB W,[MTXP(R)] ;W <= Transport number + PUSHJ P,MTIECK ;Check for tape errors first + MOVEM P,MTPSAV(W) ;Save P for EOF return + JSP B,(B) ;IO Routine. BLKT,CHRKT,SIOKT + MSMPRP(W) ;Pointer to next word + MSMPRC(W) ;Count of words remaining + SETZ MTRBG ;Get new buffer (SETZ for CHRKT return on EOF) + MTRBD ;Discard buffer + JRST 4,. ;Unused + PUSHJ P,MTRBFW ;Code to wait for new buffer from PI level + +;Get a new buffer for I/O code. +; This routine assumes that there is a buffer ready to get +; (i.e. MTRBFW was called) +; +MTRBG: SKIPG MSNBOL(W) ;Any buffers on list? + JRST MTRBG3 ;No, must be error or EOF + CONO PI,UTCOFF ;Stop I/O for a bit + MTDEQB TT,A ;Dequeue buffer into TT using A as temp + MOVEM TT,MTMDN(W) ;Remember buffer active at MP level + CONO PI,UTCON ;Turn I/O back on + LDB J,[MWC,,MEMBLT(TT)] ;Get word count from buffer + MOVEM J,MTBLKS(W) ;Save for .MTAPE 13 + LSH TT,10. ;Convert buffer number into address + JRST SIOBGX ;TT/address, J/word count /E unchanged + +;Here if no buffer ready, error or EOF assumed +; +MTRBG3: SKIPL MSRAC(W) .SEE %MAEOF ;EOF flag set in transport status? + IFSKP. + MOVSI T,%MAEFA ;The EOF is now no longer read-ahead + ANDCAM T,MSRAC(W) ;So remember that fact + JRST POPJ2 ;Double skip to tell I/O code about EOF + ENDIF. + PUSHJ P,MTIECK ;Not EOF. Check for error conditions + BUG HALT,[TAPE READ BUFFER VANISHED] ;No error, shoulda been a buffer + +;MAG TAPE READ BUFFER DISCARD ROUTINE +MTRBD: SKIPGE A,MTMDN(W) ;Have an active MP buffer? + JRST MOVTWJ ;Set up T for buffer wait, return + CONO PI,UTCOFF ;Stop IO for a bit + SETOM MTMDN(W) ;No active MP buffer + SETZM MSMPRC(W) ;No data in nonexistant buffer + LDB TT,[MSEOFP,,MEMBLT(A)] ;Get EOF flag from PI level + PUSHJ P,MGMEMR ;Return buffer, enable UTC + JUMPN TT, [ MOVSI A,%MAEOF ;EOF seen? + IORM A,MSRAC(W) ;Record EOF in software status + JRST .+1 ] +MOVTWJ: MOVE T,W ;T gets transport number for bfr wait UFLS + POPJ P, ;Also MTRBG, MTRBFW rely on this setting T + + +;MAG TAPE READ WAIT FOR DATA ROUTINE +; Called under a UFLS by system IO code to wait for data to arrive. +; Note T, not W, has transport number. T must be set up by some +; previous routine +; +MTRBFW: MOVE TT,MSRAC(T) ;Get software status of transport + TLNN TT,%MAEOF\%MAERR ;PI code reports EOF or error? + SKIPLE MSNBOL(T) ;Or are any buffers available for reading? + JRST POPJ1 ;SOme interesting condition, unhang + TLNE TT,%MARAC ;Have we asked for a tape read yet? + POPJ P, ;Yes, nothing to do but wait, wait, wait + PUSH P,W ;This being done under a UFLS. only T good + PUSH P,B + MOVE W,T ;Set up transport number in usual place + MOVEI B,MGREAD ;What we want the PI level to do + MOVEI T,MSCBL ;Make sure that there is room in command list + CAMG T,MSCMDC(W) ;If there is room, + IFSKP. ; we will request a read operation + MOVSI TT,%MARAC + IORM TT,MSRAC(W) ;Read is active now, or will be shortly + PUSHJ P,MTCMD1 ;Queue up command request for PI level + ENDIF. ;If no room for command, all we can do is wait + MOVE T,W ;Fix up T for UFLS + POP P,B ;Clean up everything else + POP P,W + POPJ P, + +SUBTTL MAG TAPE OUTPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAO: MOVEI B,CHRKT ;Unit ASCII output + MOVE E,[440700,,5] + JRST MTWRIT + + SKIPA B,[SIOKT] +MTUIO: MOVEI B,CHRKT ;Unit image output + MOVE E,[444400,,1] + JRST MTWRIT + +MTBO: MOVE E,[444400,,1] ;Block output + MOVEI B,BLKT + +MTWRIT: LDB W,[MTXP(R)] ;Get transport number + PUSHJ P,MTIECK ;Check for tape errors first + HRLZI A,%MAETW + TDNE A,MSRAC(W) ;PI code think it hit EOT? + JRST IOCER9 ;Yep, go lose + JSP B,(B) + SETZ MSMPRP(W) ;Pointer to next word + MSMPRC(W) ;Count + SETZ MTWBFG ;Get new buffer + MTWBFD ;Write out buffer to tape + JRST 4,. + TRNA ;No wait for buffer routine needed + +;MAG TAPE WRITE - BUFFER GET ROUTINE + +MTWBFG: PUSHJ P,MTIECK ;Check for tape errors + PUSHJ P,TCALL ;Turn off UTC + JRST IOMQ ;Try to get buffer + POPJ P, ;Return noskip if no buffers available + MOVEM A,MTMDN(W) ;Store active buffer number + MOVEI T,MUMGB + DPB T,[MUR,,MEMBLT(A)] ;Tell world that it is a mag tape buffer + DPB W,[MSCHN,,MEMBLT(A)] ;Store channel number in buffer header + SETZM TT + DPB A,[121000,,TT] ;Convert block number in A to address in TT + MOVE J,MTBLKS(W) ;Get block size of write + JRST SIOBGX + +;MAG TAPE WRITE - BUFFER FINISHED ROUTINE +; General IO code has filled a buffer or otherwise finished with it. +; Queue the buffer for writing if there is anything in it. + +MTWBFD: PUSHJ P,MTIECK ;Check for tape errors + SKIPGE A,MTMDN(W) ;Have an active buffer? + POPJ P, ;No, nothing to do + MOVEI T,MSCBL ;See if there is any room in command list + CAMG T,MSCMDC(W) + PUSHJ P,UFLS ;Wait for room in command list + MOVE T,MTBLKS(W) ;Get blocksize we are writing + SUB T,MSMPRC(W) ;Subtract number of words remaining in buffer + CONO PI,UTCOFF ;Lock up while frobbing buffer lists + SETOM MTMDN(W) ;Clear active buffer + SETZM MSMPRC(W) ;Clear free word in buffer count + JUMPE T,MEMR ;Nothing in buffer, just return block + DPB T,[MWC,,MEMBLT(A)] ;Store word count + MTENQB A ;Queue buffer on to-PI list + CONO PI,UTCON ;Finished mucking with buffer list + PUSH P,B + MOVEI B,MGWRIT ;Issue a write request to PI level + PUSHJ P,MTCMD + MOVSI B,%MANWT + ANDCAM B,MSRAC(W) ;Note that we have written something to tape + SETZM MTCEFW(W) ;Note no EOF's written at end of tape + JRST POPBJ ;Restore B and return + +SUBTTL MTCMD - GIVE COMMAND TO PI LEVEL + +;PUSHJ P,MTCMD + ;RH(W) has transport number + ;RH(B) has address of PI level routine to execute + +MTCMD: MOVEI T,MSCBL ;Pending command list length + CAMG T,MSCMDC(W) ;Count of commands currently in list + PUSHJ P,UFLS ;Wait for room in pending command list + CONO PI,UTCOFF ;Grab machine, keep count accurate +MTCMD1: MOVE T,MTCMBP(W) ;Get pointer to next slot in command list + AOBJN T,MTCMD2 ;Increment slot and check for wraparound + SUB T,[MSCBL,,MSCBL] ;Reached end of list, ring it +MTCMD2: MOVEM B,(T) ;Store new command + MOVEM T,MTCMBP(W) ;Store new pointer + AOS MSCMDC(W) ;Indicate one more command in list + JRST MSTRTR ;Go start up PI routine + +SUBTTL MTIECK - CHECK FOR IOC ERROR + +;PUSHJ P,MTIECK + ;Returns +1 if no error + ;Gives IOC error to user if error - never returns. + +MTIECK: PUSH P,A + MOVE A,MSRAC(W) ;Get transport software status + TLNN A,%MAERR ;PI level report an error? + JRST POPAJ ;No, all is OK + SKIPLE MSCMDC(W) ;Wait for PI level to finish cleaning up + PUSHJ P,UFLS ; before throwing away buffers + SKIPL A,MTMDN(W) ;Have an active MP-level buffer? + PUSHJ P,MEMR ;Yes, throw it away + SETOM MTMDN(W) ;No active MP buffer + SETZM MSMPRP(W) ;No place to get/put next character + SETZM MSMPRC(W) ;No room to do it anyway + PUSHJ P,MTCBFF ;Free any buffers waiting for MP processing + POP P,A + MOVE T,MGCMTS(W) ;Get transport status data from PI level +IFN TM10P,[ + TRNE T,%T1STH\%T1SIO ;Transport hung or illegal operation? + JRST IOCER1 ;Yes, report device error + TRNE T,%T1SPE\%T1SRC\%T1SRL\%T1SDL\%T1SBT ;Gruesome errors + JRST IOCER3 ;Report irrecoverable data error + TRNE T,%T1SET ;(Real) End of Tape? + JRST IOCER9 ;Device Full error +];IFN TM10P +IFN TM03S,[ + MOVE I,MGCMTC(W) ;Get controller transport status from PI level + MOVE J,MGCMTS(W) + TTNE CS1,%TM1MP ;Control bus parity error? + JRST IOCER1 + TTNN CS1,%TM1TE ;Transfer error? Could be TM03 or RH11 + IFSKP. + TTNE CS2,%TM2DL\%TM2UP\%TM2NF\%TM2NM\%TM2PE\%TM2MT\%TM2MP + JRST IOCER1 ;Non-data errors + TTNN FS,%TMSES ;Formatter error? + IFSKP. + TTNE ERR,%TMEUS\%TMECT\%TMENX\%TMEMD\%TMEFS\%TMEMC\%TMERM\%TMEIR\%TMEIF + JRST IOCER1 ;Fatal formatter errors + TTNE ERR,%TMECE\%TMECS\%TMEFC\%TMENG\%TMEFL\%TMEIC + JRST IOCER3 ;Non-recoverable data errors + ENDIF. + ENDIF. + TTNE FS,%TMSET ;End of tape? + JRST IOCER9 +];IFN TM03S + MOVE A,MGEOFR(W) ;Check for logical EOT + CAIL A,2 ;Read two EOF's since last record? + JRST IOCER9 ;Yes, report EOT + JRST IOCER3 ;No, give irrecoverable data error for now + +SUBTTL MAG TAPE .STATUS ROUTINE +;Building a status word in D. +;Routine sets: +; 1.7-1.9 open modes +; 2.3 BOT +; 2.4 EOT +; 2.5 9 track (0 = 7 track) +; 2.6 IBM mode (0 = coredump) +; 2.7 Transport idle (no pending command) +; 2.8 EOF (last thing seen was a tape mark) +; +STAMTC: +;Open modes + LDB W,[MTXP(R)] ;Get transport number + DPB A,[60300,,D] ;Open mode + PUSHJ P,MTSTAT ;Get tape status from transport +;EOT? + LDB A,[.BP %MAETW_22,MSRAC(W)] ;EOT on write + LDB B,[.BP %MAETR_22,MSRAC(W)] ;EOT on read + IOR A,B + DPB B,[140100,,D] ;Tape at EOT? +IFN TM10P,[ +;7 or 9 track drive? + LDB A,[20100,,J] ;Get 7/9 track bit + TRC A,1 + DPB A,[150100,,D] ;7 or 9 track drive + .ERR Missing TM10 .STATUS code at STAMTC +] +IFN TM03S,[ +;A bunch of new stuff. BOT? + SETZ A, + TTNE FS,%TMSBT ;Transport is at BOT? + SETO A, + DPB A,[130100,,D] ;BOT. +;7 or 9 track drive? + SETOM A ;TM03 is always 9-track + DPB A,[150100,,D] ;7 or 9 track drive +;Core dump or 32 bit mode? + MOVE A,MTWTFC(W) ;Get word to frame conversion. 4 or 5 + TRC A,1 ;Flip last bit. Last bit now on iff 32bit mode + DPB A,[160100,,D] ;Sorry. +;Formatter busy? + SETO A, + SKIPLE MSCMDC(W) ;Idle if no pending commands + SETZ A, + DPB A,[170100,,D] +;EOF last thing seen? + SETZ A, + TTNE FS,%TMSTM ;Last thing seen was a tape mark? + SETO A, + DPB A,[200100,,D] ;EOF. +];IFN TM03S + POPJ P, + +;RCHST ROUTINE FOR MAG TAPE + +RCHMGT: HLRZ E,(R) ;Get open mode from IOCHNM word + LDB J,[MTXP(R)] ;Get the mag tape drive number + MOVSI J,'MT0(J) ;Return that drive's device name + TRZ E,(.BM MTXP) ;Clear drive # field in OPEN modes + JRST POPJ1 ;Skip so that J overrides built-in device name + + +SUBTTL MAG TAPE PI LEVEL + +;Request magtape interrupt from MP-level software +; Must be called with I/O interrupts off (CONO PI,UTCOFF) +; This is called every 1/2 second by the ITS slow clock routine +; +MSTRTR: SETZM MGTBZY ;No busy tapes, flag software interrupt + CONO PI,MTCRQ ;Request interrupt on magtape channel + CONO PI,UTCON ;Reenable IO interrupt system + POPJ P, ;That is all + +;Handle tape interrupt requested by software or other nonspecific cause +; Get here via non-vectored MTCCHN interrupt on the KS +; +MGSBRK: AOS MGTBZY ;Note interrupt level is busy + SETOM MGSFTI ;Note software interrupt in progress + MOVEI B,NMTCS-1 ;Loop over all transports + SKIPG MSCMDC(B) ;Any commands in command list? +MGSBK1: SOJGE B,.-1 ;No, try next transport + SKIPGE B ;Found command or finished scan. Which? + JRST MGSBK2 ;Finished scanning. Go check other things + MOVE W,B ;Have a command. Set up transport number + PUSH P,B ;Save B over call to command routine + MOVSI B,%MACTH + TDNN B,MSRAC(W) ;Core allocator saying go away? + PUSHJ P,MGXGO ;No, go start requested routine + POP P,B ;Restore transport count + JRST MGSBK1 ;Loop back for another transport + +MGSBK2: SETZM MGSFTI ;Clear software interrupt flag + JRST MGEX ;That's all for now +;This probably should check for lost IE bits on TM03 + +;Handle interrupt caused by specific hardware conditions +; Get here via vectored interrupt on the KS +; + +IFN TM10P,[ +; A - result of CONI MTC, +; C - result of CONI MTS, +; +MGHBRK: SKIPGE W,MGUNIT ;Get unit we are expecting interrupt on + JRST MGUBRK ;None? Probably MP level bailed out. Punt. + LDB B,[MUNITF,,A] ;Get unit that controller is squacking about + CAME W,B ;Same unit? + BUG HALT,[MT PI CODE LOST TRANSPORT] + MOVE J,C + PUSH P,[MGEX] ;Cause POPJ P, in handler to dismiss interrupt +IFN TM10B,[ + TXNE C,%T1SCP\%T1SNM\%T1SDP ;Check for DF10 errors + JRST MGERR ;Yes, go to error routine +];TM10B + TXNE C,%T1SIO ;Illegal operation error? + JRST MGERR ;Yes, go to error routine + JRST MGXGO ;No, go handle interrupt + +;Here to unbreak on unexpected hardware interrupt +; +MGUBRK: LDB W,[MUNITF,,A] ;Who's the loser, anyway + MOVE B,MTCONO(W) ;Get prototype CONO word for that transport + CONO MTC,(B) ;Select offending unit + CONO MTS,31 ;Clear interrupt, DF10, stop any op in progress + JRST MGEX ;Go dismiss interrupt +];IFN TM10P + +IFN TM03S,[ +;Check for active unit. If none, go directly to inactive slave +;polling code. If active unit,check that controller is talking about +;this unit, then jump to its routine (MGXGO). When that finishes, +;see if controller is still showing attention, and check status +;of other transports if so. +; +;Well, almost. + + EBLK +MGHBRK: 0 + BBLK + JSR UTCSAV ;Save AC,s set up interrupt P PDL + AOS MGTBZY ;Note interrupt level is alive + SKIPGE W,MGUNIT ;Some transport waiting for an interrupt? + JRST MGNOUW ;Nope, either Slave Status Change or lossage + IORDI B,%TMTC ;Get transport the TM03 is thinking about + ANDI B,7 + CAME B,W ;Same as the one we were waiting for? + BUG HALT,[MT PI CODE LOST TRANSPORT] + PUSHJ P,MGXGO ;Go jump into this unit's handler + +MGNOUW: +IFN NMTCS-1,[ +.ERR Missing multi-transport code at MGNOUW! +If more than one unit, have to see if this is an interrupt caused by a +SSC (slave status change), and if so poll all the inactive units and +update their software status (rewinding, on/off line, etc.) With only +one transport we currently avoid this by keeping the unit active +(MGUNIT set) as long as it is doing *anything*, and giving it all the +hardware interrupts. See rewind code, too. +];IFN NMTCS-1 + JRST MGEX ;Go dismiss interrupt +];IFN TM03S + +;Interrupt level control flow +; +; Each transport maintains the current state of its PI-level action +; routines on a seperate (per-transport) PDL with its SP in Q. This +; allows you to save the current state, dismiss the interrupt, and +; resume where you left off when the next interrupt for this transport +; arrives. +; +; Subroutine linkage between routines handling a per-drive PI-level +; action is with PUSHJ Q,xxx and POPJ Q, +; +; The MP level queues commands for the PI level to process on a per- +; transport queue at MGSBx (x=unit number) +; +; Ths general interrupt code transfers to the per-drive actions by +; jumping to MGXGO, which will load Q from the saved state of the +; current drive and start up whatever it finds there. This may be +; the MGNCMD routine, which will start a new command, or it may be +; the middle of an in-progress PI-level command handler. +; +; PI-level action routines can relinquish control in several ways: +; +; PUSHJ Q, CPOPJ will dismiss the current interrupt, arranging for +; control to return to the instruction following the PUSHJ when the +; next interrupt for this unit occurs. +; +; JRST MGOVER will dismiss the current interrupt, arranging for the +; currently executing subroutine to be restarted "from the top" when +; the next interrupt for this unit occurs. +; +; A simple POPJ P, will dismiss the current interrupt, arranging for +; the routine that called this one to be started at the point immediately +; after the call when the next interrupt comes in. This is generally not +; useful except from first-level action routines, where a POPJ P, will +; indicate that you have finished handling the current command and cause +; the next interrupt to fetch and start execution of a new command from the +; queued command list by transferring to MGNCMD. Got that? + +;Transfer control to whatever the per-transport code wants to do. +; +MGXGO: MOVE Q,MGQDLP(W) ;Getsaved Q PDL pointer for current transport + PUSHJ P,QPOPJ ;"Return" to whatever is on top of Q PDL, + ; arranging for POPJ P, to return to here + + MOVEM Q,MGQDLP(W) ;Save current Q PDL for next time + POPJ P, ;Return, dismissing this interrupt + +;Dismiss interrupt, arranging for next interrupt to restart routine +; we are currently executing (rather than either continuing here or +; starting a new command) +; +MGOVER: +IFN TM10P,[ + CONSZ MTS,%T1STH\%T1SIO\%T1SCE ;Tape hung/ill op/DF10 error, + JRST MGERR ; go handle error condition +] + SOS (Q) ;Decrement address at top of Q PDL, now + ; points to PUSHJ Q, instruction so + ; that we will get called again from MGXGO + ; at next interrupt dispatch + POPJ P, ;Return to P PDL caller, dismissing interrupt + + +;This routine is always the last "command" in a transport command list +; Wraps the command list BP around the the beginning of the list, +; then gets and executes the next command. +; +MGRCV: MOVNI A,MSCBL+1 ;Get negative length of command list + ADDM A,MGCMBP(W) ;Wrap command extraction pointer back to start +MGNCM1: ILDB B,MGCMBP(W) ;Get new command from list + JRST (B) ;And jump to it + +;This code is always the first (bottom) thing in a transport's Q PDL +; It is therefore executed whenever MGXGO transfers control to the +; Q PDL and there is no command in progress. +; +MGNCMD: AOBJN Q,MGNCM1 ;Got here w/ POPJ Q,. Fake PUSHJ to restore Q, + ; then go get the next command + + BUG ;Q PDL pointer clobbered + +QPOPJ1: AOS (Q) +QPOPJ: POPJ Q, + + +;WAIT FOR JOB DONE BIT TO SET +; Called from PI-level command routines to wait for end of command. +; Called with PUSHJ Q,MGWTJD +; +; Returns +1 to caller if unusual termination +; +2 to caller if operation terminated normally +; +; I,J contain tape status: +; On TM10, I=CONI MTC, +; J=CONI MTS +; On TM03S, I=%TMCS1,,%TMCS2 (controller status), +; J=%TMFS,,%TMERR (formatter status) + +IFN TM10P,[ +MGWTJD: CONI MTS,J ;Get transport status + TXNE J,%T1STH\%T1SIO ;Transport hung or Illegal operation? + JRST MGERR ;Yes, job-done isn't ever going to get set +MGWJD1: CONI MTS,J ;Get status again + SKIPN MGJDTI ;Is there a time out set? + IFSKP. + MOVE T,TIME ;Yes, check it. Get current time + CAML T,MGJDTI ;Smaller than specified timeout time? + JRST MGERR ;No, lose + ENDIF. + TXNN J,%T1SJD ;JOB-DONE bit set? + JRST MGOVER ;No, we want to wait for it + CONI MTS,J ;Job Done. Get status + CONI MTC,I ;Get CONI MTC + MOVEM J,MGCMTS(W) ;Save for MP level + MOVEM I,MGCMTC(W) +IFN TM10B,[ + SKIPE MGWCW ;Want to wait for control word? + PUSHJ Q,MGWCWC ;Check to see if it is written + SETZM MGWCW ;Clear wait-for-control-word request flag +] + CONO MTS,30 ;Clear channel conditions + MOVE B,MTCONO(W) + CONO MTC,(B) ;Release mtc, clear job done bit +IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP ;Check for channel errors + POPJ Q, ;Channel error, return nonskip +] + TXNE J,%T1STH\%T1SIO\%T1SPE\%T1SRC%\T1SRL\%T1SDL\%T1SBT + POPJ Q, ;Random other things, not necessarily errors + JRST QPOPJ1 ;Success +];IFN TM10P +IFN TM03S,[ +MGWTJD: +MGWJD1: IORDI T,%TMCS1 ;Get controller status + TXNN T,%TM1GO ;Go bit still set? + JRST MGWJD2 ;No, command is finished. Go check errors + SKIPE T,MGJDTI ;Is there a time out set? Get it if so. + CAML T,TIME ;Past timeout time + JRST MGOVER ;No timeout or not timed out yet, go wait + JRST MGERR ;Timed out. Go check transport + +;Here if action has terminated. Set up status bits before returning +MGWJD2: HRLZ I,T ;%TMCS1,,? + IORDI T,%TMCS2 + HRR I,T ;I = %TMCS1,,%TMCS2 + IORDI J,%TMERR + IORDI T,%TMFS + HRL J,T ;J = %TMFS,,%TMERR - I,J now in standard form + MOVEM J,MGCMTS(W) ;Save for MP level + MOVEM I,MGCMTC(W) + TTNE CS1,%TM1MP ;Massbus control parity error + JRST MGERR ;Who knows what the transport is doing + TTNN CS1,%TM1TE ;Controller error? + TTNE FS,%TMSES ;Formatter error? + POPJ Q, ;Yes, return +1 for closer examination + JRST QPOPJ1 ;Success +];IFN TM03S + +;Select the transport given by W +; Returns +1 with transport selected, status in I,J +; May dismiss and wait for a while first +; +MGGXPT: +IFN TM10P,[ + CONSO MTS,%T1SNU ;Can controller select new unit right now? + JRST MGOVER ;No, wait for it + MOVE T,TIME + ADDI T,10.*30. ;Time out in 10. seconds + MOVEM T,MGJDTI ;Set up job-done timeout + MOVEM W,MGUNIT ;Note unit waiting for hardware interrupt + MOVE B,MTCONO(W) ;Get CONO word for new unit + CONO MTC,MNOPIN(B) ;NOP, but interrupt when new drive is ready + PUSHJ Q,MGWJD1 ;Wait for job done + JFCL ;Ignore any errors + SETZM MGJDTI ;No more timeout + SETOM MGUNIT ;Not waiting any more + POPJ Q, ;Return to caller +];IFN TM10P +IFN TM03S,[ + IORDI T,%TMFS ;Get current formatter status + TXNN T,%TMSES\%TMSSC ;Showing error or slave status change? + IFSKP. ;Yes, clear errors before going ahead + IOWRI W,%TMTC ;Select slave + MOVEI A,10. ;Try 10 times to clear drive + MOVEI B,%TMCLR + DO. + IOWRI B,%TMCS1 ;Write drive clear command + IORDI T,%TMFS ;Get status + TXNN T,%TMSES ;Still have error + JRST ENDLP. ;No, done + SOJG A,TOP. ;Retry up to 10 times + JRST MGERR ;Else give up + ENDDO. + ENDIF. + MOVE T,MTSELW(W) ;Get desired settings + IOWRI T,%TMTC ;Tell TM03 + MOVEI T,%TMNOP ;You may need this to set status values + IOWRI T,%TMCS1 ; but I'm not really sure + IORDI T,%TMCS1 + PUSHJ Q,MGWJD2 ;Go set status registers appropriately + JFCL ;Maybe should check non-existant slave? + POPJ Q, +];IFN TM03S + +;MGERR - HANDLE TAPE ERROR +; +;Called from PI level command routines which detect a tape or controller error +; Flags error in software status word, records error status in MGExxx. +; Flushes command in progress by resetting Q PDL to base. +; Flushes commands in PI-level command queue by resetting queue pointers. +; Flushes any buffers which might be queued for writing. +; Returns to P PDL, to wait for new commands. + +MGERR: +IFN TM10P,[ + CONI MTS,MGEMTS ;Get transport status for MP level analysis + CONI MTC,MGEMTC +] +IFN TM03S,[ + IORDI T,%TMCS1 ;Get controller and transport status into + HRLM T,MGEMTC ; standard form + IORDI T,%TMCS2 + HRRM T,MGEMTC + IORDI T,%TMFS + HRLM T,MGEMTS + IORDI T,%TMERR + HRRM T,MGEMTS + MOVE I,MGEMTC ;Get status to standard place for macros + MOVE J,MGEMTS +];IFN TM03S + MOVSI T,%MARAC ;Read not active, for sure + ANDCAM T,MSRAC(W) + SETZM MSCMDC(W) ;No commands active + SETOM MGUNIT ;Clear unit wait flag + SETZM MGJDTI ;No job-done timeout +IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP ;Channel error? + BUG PAUSE,[MTAPE: CHANNEL ERROR, STATUS=],OCT,J,[MICWA+1=],OCT,MICWA+1,[MIOWD=],OCT,MIOWD +];TM10B +IFN TM03S,[ + .ERR UBA errors? More gentle cleanup? + TTNE CS1,%TM1MP\%TM1TE ;Cbus parity or transfer error? + TTNE FS,%TMSES ;And no formatter error? + SKIPA ;Yes and yes (no) (what?). Controller error + BUG INFO,[MTAPE: RH11 ERROR, STATUS=],OCT,MGEMTC,[TM STATUS=],OCT,MGEMTS + TTNE FS,%TMSES ;Formatter error? + BUG INFO,[MTAPE: FORMATTER ERROR, STATUS=],OCT,MGEMTS + PUSHJ P,TMINIC ;Go reinit controller +];IFN TM03S + SKIPL A,MGCABN(W) ;Any buffers owned by PI routines? + PUSHJ P,IMEMR ;Yes, give them back to system + SETOM MGCABN(W) ;No PI buffer any more + HRLZI B,%MAERR ;Flag error detected by PI level + IORM B,MSRAC(W) ;Store in transport status word + MOVE Q,[-MGQDLL,,MGQD0-1];Reset Q PDL to base of this unit's stack, + MOVE T,MSLCTB ; thus flushing whatever command is in progress + IMUL T,W ;Find offset to base of Q PDL for this unit + ADD Q,T ;Add to prototype unit 0 QDP pointer, + PUSH P,Q ; and save it away + MOVE Q,[-MSCBL-1,,MSCB0-1] ;Get command list input pointer + ADD Q,T ;Offset it to this unit's command queue, + MOVEM Q,MTCMBP(W) ;And save it as new MP (input) queue pointer + MOVE Q,[4400,,MSCB0-1] ;Get new command list output pointer + ADD Q,T ;Offset correctly for this unit, + MOVEM Q,MGCMBP(W) ;And save as PI (output) command queue pointer + MOVSI B,%MAREW ;Does initting xport stop TM03 rewind? + ANDCAM B,MSRAC(W) ;Say not rewinding + SKIPN MSCRW(W) ;If reading, + JRST POPQJ ; we're done. Restore Q and exit + SKIPN MSNBOL(W) ;Writing. Any buffers on list? + JRST POPQJ ;No, restore Q and exit + DO. ;Here to free buffers on IO list + HRRZ A,MSBUFP(W) ;Get buffer pointer from head of chain + LDB T,[MLO,,MEMBLT(A)] ;Get back pointer (next buffer) + HRRM T,MSBUFP(W) ;Make next buffer head of chain + PUSHJ P,IMEMR ;Free current buffer + SOSLE MSNBOL(W) ;Decrement count, check for more + JRST TOP. ;More, loop back + ENDDO. + SETZM MSBUFP(W) ;Mark list as empty + JRST POPQJ ;Restore Q and return + +IFN TM10B,[ +;Wait for control word to get written +; +MGWCWC: SKIPE MICWA+1 ;Control word written? + POPJ Q, ;Yes, return to caller + CONO MTS,4 ;No, tell DF10 to write it +MGWCW1: SKIPE MICWA+1 ;Written yet? + JRST MGWCW2 ;Good, done + PUSHJ Q,CPOPJ ;Not written. Dismiss interrupt and wait + JRST MGWCW1 ;We're back. See if written yet. + +MGWCW2: MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) ;Restore status + TLO J,10 ;Set control word written + POPJ Q, ;Return to caller +];IFN TM10B + +IFN TM10A,[ +MGDCSI: SKIPA A,[BLKI MTC,MIOWD] +MGDCSO: MOVE A,[BLKO MTC,MIOWD] + MOVEM A,MAGLOC + MOVE A,[JSR MGDBRK] + MOVEM A,MAGLOC+1 + POPJ Q, +];IFN TM10A + +IFN TM03S,[ +;Note this one's called on P PDL +TMINIC: IORDI A,%TMTC ;Get TC reg value + ANDI A,MTSELM ;Keep interesting bits only + IORDI B,%TMCS2 ;Get CS2 + ANDI B,7 ;Keep selected "drive" (TM03) number only + MOVEI T,%TM2CC + IOWRI T,%TMCS2 ;Clear controller logic + IOWRI B,%TMCS2 ;Reselect TM03 + IOWRI A,%TMTC ;Reselect transport + MOVX T,%TMCLR ;Do a formatter clear command + IOWRI T,%TMCS1 + POPJ P, +];IFN TM03S + + +SUBTTL MAG TAPE PI LEVEL WRITE + +MGWRIT: PUSHJ Q,MGGXPT ;Select desired transport +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Write locked, hung or rewinding? + JRST MGERR ;Not a good thing +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line? + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +] + MOVSI A,%MACTH + TDNE A,MSRAC(W) ;Core alloc want quit temporarly? + JRST [ PUSHJ Q,CPOPJ ;OK, wait a while + JRST MGWRIT ] ;Then go back and try again + MOVEM W,MGUNIT ;Set unit + HRREI B,-MGNRTY ;Number of retries + MOVEM B,MGERRC(W) ;Store error count + MTDEQB A ;Get buffer to write off list + MOVEM A,MGCABN(W) ;Note this buffer active at PI + LDB B,[MWC,,MEMBLT(A)] ;Get word count from buffer + MOVNS B ;B -> -COUNT + HRLZS B ;B -> -COUNT,,0 +IFN KL10P,LSH B,4 ;Shift if KL10 data channel +IFN KL10P,MOVE R,A ;Save core page number for cache sweep +IFE TM03S,[ ;TM03S IOWD is -COUNT,,ITS PAGE + LSH A,10. ;Convert buffer number to memory address + SUBI A,1 ;Address - 1 +] + HRRM A,B ;B -> -COUNT,,ADDRESS-1; an IO word +IFN TM10B,DATAO MTS,[MICWA] ;Tell DF10 where IO channel program is +IFN TM10A,PUSHJ Q,MGDCSO ; + MOVEM B,MIOWD ;Put IO word where controller looks + MOVEM B,LMIOWD ;Remember what we're about to do +IFN TM10P,SETZM MIOWD+1 ;Stop after one operation +IFN KL10P,[ + PUSHJ P,CSHSWP ;Unload buffer from cache into core + CAI +] +MGWRT2: +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get prototype CONO word + CONO MTC,MWRITE(B) ;Perform WRITE operation +] +IFN TM03S,[ + HLRE A,MIOWD ;Get PDP10 word count + ASH A,1 ; * 2 + IOWRI A,%TMWC ; = number of unibus words to transfer + HLRE A,MIOWD ;Get PDP10 word count again + IMUL A,MTWTFC(W) ;Convert to tape frame count + IOWRI A,%TMFC ;Set tape frames to write + HRRZ A,MIOWD ;Get ITS page to transfer to + LSH A,1 ;Convert ITS pg # to DEC pg # + TXO A,%UQVAL ;Valid mapping, I should hope + IOWRI A,UBAPAG+IUTPG_1 ;Set up first half of UBA mapping + TXO A,1 ;Next DEC page number + IOWRI A,UBAPAG+IUTPG_1+1 ;Set second half of UBA mapping + MOVEI A,IUTPG_14 ;Unibus address to DMA to + IOWRI A,%TMBA ;Tell controller + MOVX A,%TM1IE\%TMWRT ;Write, enable interrupts + IOWRI A,%TMCS1 ;Start controller +] + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGWERR ;Error, go attempt to repair + +;Here if tape written OK +MGWRT3: MOVE A,MGCABN(W) ;Get buffer number + HRLZI B,%MAETW+%MAERR ;End of tape check +IFN TM10P,TXNE J,%T1SET ;Controller says we're at EOT? +IFN TM03S,TTNE FS,%TMSET + IORM B,MSRAC(W) ;Tell MP + LDB T,[MUR,,MEMBLT(A)] ;Get buffer flavor from buffer + CAIE T,MUMGB ;Still a magtape buffer? + BUG HALT,[MT BUF CHANGED INTO SOME OTHER KIND??] + SETOM MGCABN(W) ;No buffer active at PI anymore + PUSHJ P,IMEMR ;Return buffer to system + MOVSI A,%MAMSO ;Note tape has moved since open + IORM A,MSRAC(W) + ;JRST MGCMDR ;Falls through + +;General exit routine for most PI-level command handlers +; Check command queue for more commands. +; If no further commands, dismiss interrupt. +; If further commands queued, wait for this one to finish, then fetch +; and begin processing of next command. +; +MGCMDR: SOS MSCMDC(W) ;Decrement command count + SETOM MGUNIT ;Reset active unit + SKIPG MSCMDC(W) ;Any more commands? + JRST MGCMR1 ;No. Go see about other units +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ;Tell controller to interupt when unit ready + MOVEM W,MGUNIT ;Set up unit number again for MGWTJD + PUSHJ Q,MGWTJD ;Go wait for unit to finish current command + JRST MGERR ;Oops + SETOM MGUNIT ;No unit waiting any more +];IFN TM10P + POPJ Q, ;Return on Q PDL. Most likely this will + ; transfer control to MGNCMD routine at + ; base of PDL, which will fetch and execute + ; next command. + +MGCMR1: +IFN NMTCS-1,[ +;Ought to check other transports for commands to start. +; For now, will get started by 1/2 second timeout, if nothing else. + .ERR Unfinished multi-transport code at MGCMR1 +];IFN NMTCS-1 + POPJ P, ;No more, return on P to dismiss interrupt + + + +;CONTROLLER DETECTED ERROR ON WRITE OPERATION +; Retry, or give up, or write some blank tape and then try again, +; depending on the type of error. +; +MGWERR: +IFN TM10P,[ +IFN TM10B,SETZM MIOWD ;Seems to do one record anyway +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;Specify one record to space back cmd. +] + TXNE J,%T1STH\%T1SRW\%T1SIO\%T1SET\%T1SWL ;Bad types of errors + JRST MGERR ;OK, give up + AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ;Space reverse one record + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGERR ;Error + MOVE B,LMIOWD ;Get last operation's IOWD + MOVEM B,MIOWD ;We're going to try it again + MOVE B,MTCONO(W) ;Get prototype CONO + CONO MTC,14000(B) ;Write with extended EOR gap + PUSHJ Q,MGWTJD ;Wait for completion + JRST MGWBT ;Lost again, retry some more + JRST MGWRT3 ;Worked, return to normal write sequence +];IFN TM10P +IFN TM03S,[ + TTNE ERR,%TMERM\%TMEUS\%TMEFS\%TMEIR\%TMEIF\%TMEMC\%TMECT\%TMENX\%TMEOI + JRST MGERR ;Fatal errors + TTNN FS,%TMSOL ;On line? + JRST MGERR ;This isn't so good either + TTNE ERR,%TMEFC\%TMENG\%TMEMD\%TMEIC\%TMECE\%TMECS\%TMEFL + JRST MGWER1 ;Error which retrying might fix + +;Formatter seems happy. Check channel status before returning +; Currently this only catches the case where there was an RH11 error +; but no TM03 error, and thus should always end up jumping to MGERR. +; Formatter errors on which it might be OK to get here are %TMECE, +; %TMECS, %TMEFL, but someone needs to test this... + TTNE CS1,%TM1TE ;Transfer error? + TTNE FS,%TMSES ;And not formatter error? + CAIA + JRST MGERR ;Just lose for now + BUG INFO,[MT: ACCEPTING QUESTIONABLE WRITE OPERATION] + JRST MGWRT3 + +;Retry errors +MGWER1: AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up + BUG INFO,[MT: RETRYING WRITE OPERATION] + PUSHJ P,TMINIC ;Hit controller with hammer + MOVEI B,1 + MOVEM B,MGSPCD(W) ;1 record + PUSHJ Q,MGSPCR ;Reselect transport space back a record + TTNE FS,%TMSTM ;Stopped on EOF? + SOSGE MGEOFR(W) ;Yes, one less EOF in front of us + SETZM MGEOFR(W) ;But never less than zero + PUSHJ P,TMINIC ;Hit controller with hammer again + PUSHJ Q,MGGXPT ;Set up transport again + MOVEI B,%TMER3\%TM1IE + IOWRI B,%TMCS1 ;Erase a few inches of tape + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGERR ;Can't get anything right... + MOVE B,LMIOWD ;Get last operation's IOWD + MOVEM B,MIOWD ;We're going to try it again + JRST MGWRT2 ;Go back to write code and retry operation +];IFN TM03S + + +SUBTTL MAG TAPE PI LEVEL READ + +MGREAD: PUSHJ Q,MGGXPT ;Select desired transport +MGRD0: +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SET ;Unit hung, rewinding, or EOT + JRST MGERR ;Seems so, report error +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVE B,MGEOFR(W) ;EOF's seen since last read + CAIL B,2 ;Apparent logical EOT? + JRST MGERR ;Yes, can't read anything + SKIPE MSCRW(W) ;Make sure open for reading + BUG HALT,[MT: CHN NOT OPEN FOR READING] + MOVSI B,%MACTH ;Core allocator wants to wait? + TDNN B,MSRAC(W) ;Check in status word + PUSHJ P,IOMQ ;No, get a buffer + JRST [PUSHJ Q,CPOPJ ;Wanted to wait some or failed, + JRST MGREAD ] ; wait a while, then start over + MOVEM A,MGCABN(W) ;Note active buffer at PI level + MOVEI B,MUMGB + DPB B,[MUR,,MEMBLT(A)] ;Note buffer belongs to mag tape code + MOVEM W,MGUNIT ;Set active unit number + HRREI B,-MGNRTY ;Number of retries + MOVEM B,MGERRC(W) ;Store error count +IFN KL10P, MOVE R,A ;Get page for cache flush routine +IFE TM03S,[ ;TM03S IOWD is -COUNT,,ITS PAGE + LSH A,10. ;Convert buffer number to memory address + SUBI A,1 ;address-1 +] +IFE KL10P,HRLI B,-2000 ;Get count half of IOWD +IFN KL10P,HRLI B,-2000_4 ;The KL is, of course, different + HRR B,A ;-count,,address-1 + MOVEM B,LMIOWD ;Remember IOWD for possible retry +IFN TM10B,[ + DATAO MTS,[MICWA] ;Tell DF10 where the channel program is + SETZM MICWA+1 ;Stop after one operation +] +IFN TM10A,PUSHJ Q,MGDCSI +IFN TM10P,SETZM MIOWD+1 +MGRD1: MOVEM B,MIOWD ;Save IOWD where channel expects it + MOVEI B,2000 ;Assume for now that the record has 2K words + MOVEM B,MGNWRD ;Set up word count +IFN KL10P,[ + PUSHJ P,CSHSWP ;Ensure no residue of this page in cache + CAIA +] +IFN KS10P,CLRCSH ;KS needs cache invalidated on read +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get prototype CONO word + CONO MTC,MREAD(B) ;Issue READ command +] +IFN TM03S,[ + HLRE A,MIOWD ;Get PDP10 word count + ASH A,1 ; * 2 + IOWRI A,%TMWC ; = number of unibus words to transfer + SETZ A, ;Set FC to zero + IOWRI A,%TMFC ;Set tape frames to write + HRRZ A,MIOWD ;Get ITS page to transfer to + LSH A,1 ;Convert ITS pg # to DEC pg # + TXO A,%UQVAL + IOWRI A,UBAPAG+IUTPG_1 ;Set up first half of UBA mapping + TXO A,1 ;Next DEC page number + IOWRI A,UBAPAG+IUTPG_1+1 ;Set second half of UBA mapping + MOVEI A,IUTPG_14 ;Unibus address for DMA + IOWRI A,%TMBA ;Tell controller + MOVX A,%TM1IE\%TMRDF ;Read forward, enable interrupts + IOWRI A,%TMCS1 ;Start controller +];IFN TM03S +IFN TM10B,SETOM MGWCW ;Tell MGWTJD to wait for control word written + PUSHJ Q,MGWTJD ;Wait for command to complete + JRST MGRERR ;Error, go do something. May be retry, correct + ; MGNWRD if frame count error, or give up +IFN TM03S,[ +;Get true record size for TM03, which doesn't give a FC error on READ +MGRD1A: TTNE FS,%TMSTM ;Read a tape mark? + JRST [ SETZM MGNWRD ;Read a tape mark. No data, just EOF + JRST MGRD2 ] + IORDI A,%TMFC ;Get record size in tape frames + ADD A,MTWTFC(W) ;Round up to PDP10 words. + SUBI A,1 ;Add frames_per_word - 1 + IDIV A,MTWTFC(W) ;Get record size in PDP10 words + MOVEM A,MGNWRD +];IFN TM03S +;Here if OK or error handler has fixed things up +MGRD2: MOVE A,MGCABN(W) ;Get buffer we just wrote + SETOM MGCABN(W) ;No buffer active at PI level + MTENQB A ;Queue buffer up for MP level + MOVE B,MGNWRD ;Get number of words we read + DPB B,[MWC,,MEMBLT(A)] ;Set number of words in buffer +IFN TM10P,TXNE J,%T1SEF ;Read an EOF? +IFN TM03S,TTNE FS,%TMSTM ; i.e. a tape mark? + IFSKP. + SETZM MGEOFR(W) ;No. Note no EOFs read since last record + ELSE. + MOVSI B,%MAESO+%MAEFA ;EOF seen since open, EOF read ahead + IORM B,MSRAC(W) ;Note this in transport status word + SETO B, + DPB B,[MSEOFP,,MEMBLT(A)] ;Set EOF flag in this buffer + AOS A,MGEOFR(W) ;Count EOFs + CAIL A,2 ;Enough for EOT? + JRST MGRD4 ;Logical EOT, space back over it + ENDIF. + MOVSI A,%MAMSO + IORB A,MSRAC(W) ;Note tape movement +IFN TM10P,TXNE J,%T1SET ;Real EOT reached? +IFN TM03S,TTNE FS,%TMSET + JRST MGRD3 + MOVE C,MSNBOL(W) ;Get count of buffers on list +IFN TM10P,TXNN J,%T1SEF ;EOF? +IFN TM03S,TTNN FS,%TMSTM + +; CAIL C,6 ; or read ahead six records? + JFCL ;Or just for the hell of it + + JRST MGRD5 ;Yes, stop reading + TLNN A,%MASTP ;Somebody request we stop? + JRST MGRD0 ;No, go back and read another record + ;Yes, fall through to terminate read +;Here to terminate read command +; +MGRD5: MOVSI A,%MASTP+%MARAC ;Clear read active, any read stop request + ANDCAM A,MSRAC(W) + JRST MGCMDR ;Go to standard command return routine + +;Controller saw a real EOT +; +MGRD3: DPB B,[MSEOFP,,MEMBLT(A)] ;Fake EOF + DPB B,[420100,,MSRAC(W)] .SEE %MAETR ;Indicate EOT on read + JRST MGRD5 ;Terminate read + +;Here if logical EOT (two EOF's in a row) +; Back up till between the two EOF's +; +MGRD4: MOVSI A,%MAESO+%MARAC+%MASTP ;SECOND EOF, LOGICAL EOT + ANDCAM A,MSRAC(W) + JRST MGSPRF ;Space reverse one file + +;Error detected on read. +; Analyze error, retry read if it might help +; +MGRERR: +IFN TM10P,[ + IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP + JRST MGERR ;Channel error, forget it + ] + TXNE J,%T1STH\%T1SRW\%T1SIO\%T1SRC ;Hard error? + JRST MGERR ;Yes, abandon read + TXNE J,%T1SPE\%T1SDL%T1SBT ;Parity, data-late, or bad tape? + JRST MGMRT ;Yes, a read retry might fix it + TXNN J,%T1SRL ;Record length error? + JRST MGERR ;No, who knows what is going on + +;Here if record length error. Adjust MGNWRD to reflect data actually read +; +IFN TM10B,HRRZ A,MICWA+1 +IFN TM10A,HRRZ A,MIOWD ;Get final control word + HRRZ B,LMIOWD ;Get original IOWD + SUB A,B ;Calculate words read +IFN TM10B,SOS A ;Channel funnyness + CAIE A,1 ;Length of 1 may just be EOF indication + IFSKP. + TXNE J,%T1SEF\%T1SET ;1 word, EOF? EOT? + SETZM A ;Yes, zero length record, just carries MSEOFP + ENDIF. + MOVEM A,MGNWRD ;Save new record length + JRST MGRD2 ;Go process as potentially correctly read data +];IFN TM10P +IFN TM03S,[ + TTNE ERR,%TMERM\%TMEUS\%TMEFS\%TMEIR\%TMEIF\%TMEMC\%TMECT\%TMENX + JRST MGERR ;Fatal errors + TTNN FS,%TMSOL ;On line? + JRST MGERR ;This isn't so good either + TTZ ERR,%TMEFC\%TMENG ;Ignore NSG, Frame count error + TTNE FS,%TMSPE ;Phase encoded (1600BPI) mode? + TTZ ERR,%TMECE\%TMECS ;If so, ignore errors hardware already fixed + TTZN ERR,%TMECE\%TMECS\%TMEFC\%TMENG\%TMEFL\%TMEMD\%TMEIC ;Retryable? + JRST MGRER1 ;Nothing retrying will help + TTNE FS,%TMSTM ;Tape mark? + JRST MGRER2 ;Yes, no point in retrying + JRST MGMRT ;OK, go retry read + +;Formatter seems happy. Check channel status before returning +MGRER1: TTNE ERR,177777 ;Sanity check. Shouldn't be any errors left + JRST MGERR + TTNE CS1,%TM1TE ;Transfer error? + TTNE FS,%TMSES ;And not formatter error? + CAIA + JRST MGERR ;Just lose for now +MGRER2: JRST MGRD1A + +];IFN TM03S + + +;Retry a read operation +; +MGMRT: AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up +IFN TM10P,[ + IFN TM10B,SETZM MIOWD + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + ] + MOVEM A,MIOWD ;One record + PUSHJ Q,MGDCSO + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ;Back up one record + PUSHJ Q,MGWTJD ;Wait till done + JRST MGERR ;No errors allowed + IFN TM10A,PUSHJ Q,MGDCSI ;Put back PI 1 BLKI +];IFN TM10P +IFN TM03S,[ + IORDI T,%TMFS ;Get current formatter status + TXNN T,%TMSES ;Showing error? + IFSKP. ;Have to clear it before backing up + MOVEI A,10. ;Try 10 times to clear drive + MOVEI B,%TMCLR + DO. + IOWRI B,%TMCS1 ;Write drive clear command + IORDI T,%TMFS ;Get status + TXNN T,%TMSES ;Still have error + JRST ENDLP. ;No, done + SOJG A,TOP. ;Retry up to 10 times + JRST MGERR ;Else give up + ENDDO. + ENDIF. + MOVE T,MTSELW(W) ;Get desired settings + IOWRI T,%TMTC ;Tell TM03 + SETO A, + IOWRI A,%TMFC ;1 record + MOVEI A,%TM1IE\%TMSPR ;Space backwards command + IOWRI A,%TMCS1 ;Do it + PUSHJ Q,MGWTJD ;Wait till finished + JRST MGERR ;Give up if error +];IFN TM03S + MOVE B,LMIOWD ;Get IOWD from last command + JRST MGRD1 ;Try operation again + + +SUBTTL MAG TAPE PI LEVEL SPACING COMMANDS +;Space forward and space reverse are completely under conditionals + +IFN TM03S,[ + +;Space forward MGSPCD(W) records +MGSPCF: PUSHJ Q,MGGXPT ;Acquire transport + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + MOVEM W,MGUNIT ;Note active transport + MOVN A,MGSPCD(W) ;Get -count + IOWRI A,%TMFC ;Tell controller + MOVEI A,%TMSPF ;Get command + TXO A,%TM1IE ;Turn on interrupts + IOWRI A,%TMCS1 ;Start controller + PUSHJ Q,MGWTJD ;Wait till command completes + IFNSK. ;Error? + TTNE CS1,%TM1MP ;Control parity err? + JRST MGERR ;Yes, nothing else valid + TTNE FS,%TMSES ;Formatter errors? + IFSKP. + PUSHJ P, TMINIC ;No formatter errors, ignore RH errors + ELSE. + TTNN ERR,%TMEFC ;Frame count error? + JRST MGERR ;Nope, must be important + PUSHJ P,TMINIC + ENDIF. + ENDIF. + POPJ Q, + +;Space forward record +MGSPFR: MOVEI B,1 ;Do one record + MOVEM B,MGSPCD(W) ;Set count + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCF ;Do spacing op + TTNN FS,%TMSTM + SETZB B,MGEOFR(W) ;Count EOFs since last record. None here + TTNE FS,%TMSTM + AOS B,MGEOFR(W) ;Saw one. + CAIL B,2 ;Saw two? + JRST MGSPRR ;Back up over last one... + JRST MGCMDR ;Clean up and leave + +;Space forward file +MGSPFF: MOVSI B,%MAESO ;See if tape has already read ahead to EOF + TDZE B,MSRAC(W) + JRST MGCMDR ;EOF already read during the read, done + MOVEI B,1 ;Do one record + MOVEM B,MGSPCD(W) ;Set count + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCF ;Space forward one record + TTNN FS,%TMSTM + IFSKP. ;Saw a TM + AOS B,MGEOFR(W) ;Saw one. + CAIL B,2 ;Saw two? + JRST MGSPRR ;Yes, back up over last one, and leave + JRST MGCMDR ;No, OK, but we're done + ENDIF. + SETZB B,MGEOFR(W) ;No tape mark, reset count of EOFs seen +MGSPF1: MOVEM B,MGSPCD(W) ;Set count to 0 (B zero from above) + PUSHJ Q,MGSPCF ;Do it + TTNE FS,%TMSTM ;Saw a EOF? + IFSKP. ;No.. + TTNE FS,%TMSET ;Saw an EOT? + JRST MGERR ;Really shouldn't happen + JRST MGSPF1 ;Else go look for TM again + ENDIF. + AOS MGEOFR(W) ;Saw one. + JRST MGCMDR ;EOF read. done + +;Space reverse MGSPCD(W) records +MGSPCR: PUSHJ Q,MGGXPT ;Set up transport and get status + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSBT ;At BOT? + POPJ Q, + MOVEM W,MGUNIT ;Save selected transport + MOVN A,MGSPCD(W) ;Get -count + IOWRI A,%TMFC ;Tell controller + MOVEI A,%TMSPR ;Space Reverse command + TXO A,%TM1IE ;Turn on interrupts + IOWRI A,%TMCS1 ;Start controller + PUSHJ Q,MGWTJD ;Wait till command completes + IFNSK. ;Error? + TTNE CS1,%TM1MP ;Control parity err? + JRST MGERR ;Yes, nothing else valid + TTNE FS,%TMSES + IFSKP. + PUSHJ P,TMINIC + ELSE. + TTNN ERR,%TMEFC ;Frame count error? + JRST MGERR ;Nope, must be important + PUSHJ P,TMINIC + ENDIF. + ENDIF. + POPJ Q, + +;Space reverse one record +MGSPRR: MOVEI B,1 + MOVEM B,MGSPCD(W) ;1 record + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCR + TTNE FS,%TMSTM ;Stopped on EOF? + SOSGE MGEOFR(W) ;Yes, one less EOF in front of us + SETZM MGEOFR(W) ;But never less than zero + JRST MGCMDR ;Leave through general exit + +;Space reverse fill +MGSPRF: MOVSI B,%MAESO ;See if tape has already read ahead to EOF + TDNN B,MSRAC(W) + JRST MGSPR2 ;No, we can just do command +MGSPR1: MOVEI B,1 + MOVEM B,MGSPCD(W) + PUSHJ Q,MGSPCR ;Skip back 1 record, should backup over EOF + TTNN FS,%TMSTM ;Tape mark seen? + JRST MGSPR1 ;Well, apparently not + MOVSI B,%MAESO + ANDCAM B,MSRAC(W) ;Turn off EOF-read-ahead flag +MGSPR2: SETZ B, + MOVEM B,MGSPCD(W) ;Space backwards the maximum number of records + PUSHJ Q,MGSPCR ;Do it + TTNN FS,%TMSBT ;BOT? + TTNE FS,%TMSTM ;Tape mark seen? + JRST MGCMDR ;Yes or Yes, all done + JRST MGSPR2 ;No, go back and try to find one. + +];End TM03S way back + + ;Rewind commands +; +MGRWND: +IFN TM10P,MOVEI B,MREWND ;Normal rewind +IFN TM03S,MOVEI B,%TMREW + CAIA +MGRWDM: +IFN TM10P, MOVEI B,MRWNDD ;Rewind and dismount +IFN TM03S, MOVEI B,%TMUNL + MOVEM B,MGSPCD(W) ;Set up command + PUSHJ Q,MGRWD1 ;Call action routine + JRST MGCMDR + +;Action routine for rewind commands +MGRWD1: PUSHJ Q,MGGXPT +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVEM W,MGUNIT + MOVE B,MGSPCD(W) ;Get desired command +IFN TM10P,[ + ADD B,MTCONO(W) + CONO MTC,(B) +] +IFN TM03S,[ + TXO B,%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD ;Start controller and wait till done + IFNSK. + TTNE FS,%TMSES + JRST MGERR ;Oops. + ENDIF. + SETZM MGEOFR(W) ;Seen no EOFs since last record + +;Here after rewind command has started. +; Two possibilities: Tape is rewound already, or controller is finished +; but tape is still rewinding. +IFN TM10P,[ +MGRWD2: TXNN J,%T1SRW ;Slave still rewinding tape? + JRST MGRWD3 ;No, at BOT + PUSHJ Q,CPOPJ ;Wait some. + CONI MTS,J ;Get status again + MOVEM J,MGCMTS(W) ;Update in memory + JRST MGRWD2 ;Go see if we're done yet. + +;Here when tape has rewound +MGRWD3: MOVE T,TIME ;Wait 1 second more + ADDI T,30. ;This is an attempt to fix a hardware bug + MOVEM T,MGJDTI +MGRWD4: MOVE T,TIME + CAML T,MGJDTI ;Check time + JRST MGRWD5 ;Finished waiting, go clean up + PUSHJ Q,CPOPJ ;No, wait some more + JRST MGRWD4 + +MGRWD5: MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) ;Say not rewinding, hasn't moved + SETZM MGJDTI ;Clear timeout + POPJ Q, +];IFN TM10P +IFN TM03S,[ +;This could be a lot smarter; should dismiss the command completely +; after rewind is started, and just scan for rewinding transports +; when a SSC interrupt is received. This change is also necessary +; to make multiple slaves work right; currently the rewinding unit +; holds active unit (MGUNIT) until the rewind is completed. +MGRWD2: TTNN FS,%TMSPP ;Transport still rewinding? + JRST MGRWD3 ;No, go finish up + PUSHJ Q,CPOPJ ;Dismiss interrupt, wait a while + PUSHJ Q,MGGXPT ;Get right slave, set up status + JRST MGRWD2 + +MGRWD3: MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) ;Say not rewinding, hasn't moved + POPJ Q, +];IFN TM03S + +;SKIP TO LOGICAL EOT +; +MGSEOT: PUSHJ Q,MGGXPT ;Get transport +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW ;Hung or rewinding? + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVEM W,MGUNIT ;Set active unit +IFN TM10P,TXNE J,%T1SBT ;BOT? +IFN TM03S,TTNE FS,%TMSBT + JRST MGVTCK ;Yep, do virgin tape check + +;Not at BOT +; Do we have enough CONDITIONALS yet? +MGNVT: +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get CONO word + IFN TM10A,[ + PUSHJ Q,MGDCSO + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;Tell it to move one record + ] + IFN TM10B,SETZM MIOWD + CONO MTC,MSPRR(B) ;Space reverse first +];IFN TM10P +IFN TM03S,[ + SETO B, ;Space backwards one record + IOWRI B,%TMFC + MOVEI B,%TMSPR\%TM1IE + IOWRI B,%TMCS1 +];IFN TM03S + PUSHJ Q,MGWTJD ;Wait till done + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + SETZM MGEOFR(W) + AOS MGEOFR(W) ;Claim to have seen one EOF +MGEOT2: +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTC,MSPFF(B) ;Skip forward to EOF + PUSHJ Q,MGWTJD + JRST MGERR +] +IFN TM03S,[ + AOS MSCMDC(W) ;Kludge so MGSPFF will return here. + PUSHJ Q,MGSPFF ;Space forward file +] + MOVSI B,%MAETR ;See if we hit real EOT +IFN TM10P, TXNE J,%T1SET +IFN TM03S, TTNE FS,%TMSET + IORM B,MSRAC(W) ;Yep, tell MP +IFN TM10P,[ + MOVE B,MTCONO(W) + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;One record + ] + IFN TM10B,SETZM MIOWD + CONO MTC,MSPFR(B) ;Space forward one record +] +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC + MOVEI B,%TMSPF\%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI B,%MAETR ;Check for real EOT again +IFN TM10P,TXNE J,%T1SET +IFN TM03S,TTNE FS,%TMSET + IORM B,MSRAC(W) +IFN TM10P,TXNN J,%T1SEF ;Is this another EOF? +IFN TM03S,TTNN FS,%TMSTM ;(i.e. a tape mark) + JRST MGEOT2 ;No, not at logical EOT. Go try again +IFN TM10P,[ + MOVE B,MTCONO(W) ;Yes, at logical EOT, Back up over 1 EOF + CONO MTC,MSPRF(B) ;Space back one file +] +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC + MOVEI B,%TMSPR\%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI B,%MAEOF+%MAETR ;Tell MP at EOF, EOT + IORM B,MSRAC(W) + JRST MGCMDR + +;Check for virgin tape +MGVTCK: MOVE T,TIME + ADDI T,60. ;Set a two second timeout + MOVEM T,MGEOTT(W) ; before we must see an EOT +IFN TM10P,[ + IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] + ] + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO + ] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ;Read record. will time out if no EOF marks +MGVTC1: CONI MTS,J + MOVEM J,MGCMTS(W) + TXNE J,%T1SJD ;Job done? + JRST MGNVT ;Yep, not virgin tape + TXNE J,%T1STH\%T1SIO ;Transport hung or illegal operation? + JRST MGERR ;Yes, give up + MOVE T,MGEOTT(W) ;Get the timeout value + CAMG T,TIME ;Time up? + JRST MGVT ;Yes, it's a new tape + PUSHJ Q,CPOPJ ;Wait a while + JRST MGVTC1 ;Go back and check again +];IFN TM10P +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC ;Do one record + MOVEI B,%TMSPF\%TM1IE ;Space forward command + IOWRI B,%TMCS1 + +MGVTC1: IORDI T,%TMCS1 ;Get status + TXNN T,%TM1GO ;Still going? + IFSKP. ;Yep. + MOVE T,MGEOTT(W) ;Get the timeout value + CAMG T,TIME ;Time up? + JRST MGVT ;Yes, it's a new tape + PUSHJ Q,CPOPJ ;Wait a while + JRST MGVTC1 ;Go back and check again + ENDIF. + TXNE T,%TM1TE\%TM1MP ;Controller error? + JRST MGERR ;Yes, bad + IORDI T,%TMFS ;Get formatter status + TXNE T,%TMSES ;Formatter error? + JRST MGNVT ;No error, not a new tape + IORDI T,%TMERR ;Get formatter error register + TXNE T,%TMEFC ;Frame Count error? + JRST MGNVT ;Yes, that is probably an OK tape + JRST MGERR ;Not FC, must be a real problem +];IFN TM03S + +;Virgin tape. Abort operation in progress, rewind tape +MGVT: +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTS,31 ;Clear controller + CONO MTC,MNOPIN(B) ;Start new command to clear things out + PUSHJ Q,MGWTJD + JFCL ;Ignore errors +] +IFN TM03S,[ + PUSHJ P,TMINIC +] +IFN TM10P,MOVEI B,MREWND ;Do a rewind +IFN TM03S,MOVEI B,%TMREW + MOVEM B,MGSPCD(W) + PUSHJ Q,MGRWD1 + SETZM MGEOFR(W) ;No EOFs seen + AOS MGEOFR(W) ;??? + JRST MGCMDR ;Done + +;Write EOT mark (two EOF's) on tape +; +MGMEOT: PUSHJ Q,MGGXPT +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +];IFN TM03S + MOVEM W,MGUNIT ;Note active unit + SKIPE MTCEFW(W) ;Check # of EOF's already written + IFSKP. ;None. Need to write two + AOS MSCMDC(W) ;Kludge so MGWEOF will return here. + AOS MTCEFW(W) ;Increment EOF count + PUSHJ Q,MGWEOF ;Write an EOF + ENDIF. + MOVE A,MTCEFW(W) ;Get EOF count + SOSLE A ;Check for at least two EOF's written + IFSKP. ;No, need one more on tape + AOS MSCMDC(W) ;Again, force MGWEOF to return + AOS MTCEFW(W) ;Incr EOF count + PUSHJ Q,MGWEOF ;Write EOF + ENDIF. + MOVE A,MSRAC(W) ;Get transport software status + TLNE A,%MANWT ;Are we supposed to back up over last EOF? + IFSKP. + AOS MSCMDC(W) ;Yes. Force MGSPRF to return, then... + PUSHJ Q,MGSPRF ; ...do space reverse file command + ENDIF. + MOVSI A,%MANWT ;Note what we've done + IORM A,MSRAC(W) + JRST MGCMDR ;Leave through general exit routine + +;Write one EOF mark on tape +; +MGWEOF: PUSHJ Q,MGGXPT ;Set up transport for IO +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR ; ..lose +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +] + MOVEM W,MGUNIT ;Remember active unit +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get CONO word for this unit + CONO MTC,MWEOF(B) ;Execute Write EOF function +] +IFN TM03S,[ + MOVEI B,%TM1IE\%TMWTM ;Write tape mark, enable interrupts + IOWRI B,%TMCS1 ;Do it +] + PUSHJ Q,MGWTJD ;Wait around till command is complete + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI A,%MAMSO + IORM A,MSRAC(W) ;Note tape movement in software status + JRST MGCMDR ;Return through general exit routine + +;Get transport and controller status +; +MGSTAT: PUSHJ Q,MGGXPT + JRST MGCMDR + +;Write some blank space +; +MGW3IN: PUSHJ Q,MGGXPT +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +];IFN TM03S + MOVEM W,MGUNIT ;Note active transport +IFN TM10P,[ +;TM10 can't just write blank space, it has to write blank space followed +; by a data record + IFN TM10B,[ + SETZM MIOWD ;Tell TM10 to write 1-word record + DATAO MTS,[MICWA] + ] + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] ;1-word record + MOVEM A,MIOWD + PUSHJ Q,MGDCSO + ] + MOVE B,MTCONO(W) + CONO MTC,MW3IN(B) ;Write date record preceeded by 3-in gap +];IFN TM10P +IFN TM03S,[ + MOVEI B,%TM1IE\%TMER3 ;Erase 3 inches command, enable interrupts + IOWRI B,%TMCS1 ;Do it +];IFN TM03S + PUSHJ Q,MGWTJD ;Wait... + JFCL ;Ignore errors (really should check kind) +IFN TM10P,JRST MGSPRR ;Now space record reverse over the bogus record +IFN TM03S,JRST MGCMDR ;TM03 does it right + + +SUBTTL .MTAPE UUO + +;.MTAPE AC, +; AC/ CHNM,COMMAND +; COMMAND/ COUNT,,FUNCTION + +AMTAPE: XCTR XR,[HLRZ R,(J)] ;Get IO channel from user + TRNE R,-NIOCHN ;Legal channel? + JRST ILUUO ;Lose + HRRZM R,UUAC(U) ;Cause errors to report on the correct channel + ADDI R,IOCHNM(U) ;Form IOCHNM pointer + LDB W,[MTXP(R)] ;Get transport number + CAME U,MTUSR(W) ;Same user? + POPJ P, ;No, give up + XCTR XR,[MOVE J,(J)] ;Get Channel,,Command from user + MOVEM J,MTMTAP(W) ;Save it + HRRZ A,MTMTAP(W) ;Get address of Count,,Function word + PUSHJ P,MTIECK ;Check transport for error states + XCTR XR,[MOVE A,(A)] ;Get count,,function from user + HRRZM A,MTMFNC(W) ;Store function + HLREM A,MTMCNT(W) ; and count + SKIPN MTMCNT(W) ;Count of zero always means one, for + AOS MTMCNT(W) ; compatibility with the old code. + HRRZS A + CAIL A,NMTAPC ;Command in range? + POPJ P, ;No... + AOS (P) ;Command OK, skip return + JRST @MTAPDT(A) ;Go do command + +MTAPDT: MTHANG ;0 Hang till tape motion done + MTRWND ;1 Rewind + MTRWDM ;2 Rewind and dismount + MTWEOR ;3 Write EOR if appropriate + MTW3IN ;4 Write 3 inches of blank tape + MTWEOF ;5 Write EOF + MTSPR ;6 Space records + MTSPF ;7 Space files + MTSPEOT ;10 Space to EOT + MTSTOP ;11 Abort all operations immediately + MTSBKS ;12 Set block size (to COUNT) + MTRBKS ;13 Read block size (to AC) +IFN 0,[ + MTRTSW ;14 Read Transport Information (to AC) + MTRTEW ;15 Read Tape Error Word (to AC) +] +NMTAPC==.-MTAPDT + +;Set block size for write +; +MTSBKS: MOVE A,MTMCNT(W) ;Desired blocksize + CAIL A,4 ;Check reasonableness + CAILE A,2000 + SOSA (P) ;Fail if too big or too small + MOVEM A,MTBLKS(W) ;OK, change write-buffer size + POPJ P, + +;Read current write blocksize +; +MTRBKS: MOVE A,MTBLKS(W) ;Get current write block size + JRST APTUAJ ;Return it + +;Hang until all motion finished +; +MTHANG: SKIPLE MSCMDC(W) ;Check count of queued commands + PUSHJ P,UFLS ;Wait if there are any + JRST MTIECK ;Done, check for errors and return + +;Rewind, Rewind and dismount +; +MTRWND: SKIPA B,[MGRWND] ;Get "REWIND" PI level command +MTRWDM: MOVEI B,MGRWDM ; or "REWIND and DISMOUNT" if appropriate + SKIPE MSCRW(W) ;Writing? + JRST MTSOSP ;Yes, error. Go undo skip rtn and exit + MOVSI A,%MAREW ;Note rewinding in software status + IORM A,MSRAC(W) + JRST MTCMD ;Go queue command for PI level + + +;"Write End of Record" +; This is really the FORCE system call, or should be. +; +MTWEOR: SKIPG MTMDN(W) ;MP level have an active buffer? + POPJ P, ;No, nothing to do + SKIPE MSCRW(W) ;Writing? + JRST MTWBFD ;Yes, go write buffer to tape +MTSOSP: SOS (P) ;Not writing, error. Undo skip return + POPJ P, ;Return + +;Write EOF +; +MTWEOF: SKIPN MSCRW(W) ;Writing? + JRST MTSOSP ;No, can't write EOF. Take error exit + PUSHJ P,MTWEOR ;Flush current buffer, if any + MOVEI B,MGWEOF ;Get PI level EOF routine + AOS MTCEFW(W) ;Increment count of EOF's written + MOVSI TT,%MANWT ;Flag something written on tape + ANDCAM TT,MSRAC(W) + JRST MTCMD ;Queue MGWEOF command for PI level + +;Write blank tape +; +MTW3IN: SKIPN MSCRW(W) ;Error if tape not open for write + JRST MTSOSP + MOVEI B,MGW3IN ;Get PI level command + SETZM MTCEFW(W) ;No EOF's since last record + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) ;Note written something to tape + JRST MTCMD ;Go queue command for PI + +;Space records, +=forward, -=back +; +MTSPR: SKIPE MSCRW(W) ;Not allowed if writing + JRST MTSOSP + PUSHJ P,MTFLRA ;Flush read-ahead, find out how far off we are + ADD B,C ;Get records tape is ahead of user (EOF=record) + MOVNS B ;Subtract this from user's request + ADDB B,MTMCNT(W) ;Adjust count + JUMPE B,CPOPJ ;If count is now zero, we are done +MTSPR1: PUSHJ P,MTCNTR ;Update user's copy in case PCLSR + JUMPG B,MTSPFR ;Space forward + MOVEI B,MGSPRR ;Get SPACE REVERSE command + PUSHJ P,MTCMD ;Queue it + AOSGE B,MTMCNT(W) ;Increment count, check if done + JRST MTSPR1 ;More + POPJ P, ;No more + +MTSPFR: MOVEI B,MGSPFR ;Get SPACE FORWARD command + PUSHJ P,MTCMD ;Queue it + SOSLE B,MTMCNT(W) ;Decr count, check if done + JRST MTSPR1 ;More + POPJ P, + +;This routine flushes readahead. Call before doing a spacing operation +; this doesn't actually undo the effect on the drive of the read-ahead. +; It does make sure that read-ahead's effect can't change, then returns +; in B the number of records ahead (non-negative) and in C the number of +; EOF's ahead (0 or 1). If called twice it will return zero the second +; time. Be sure to update your parameters. +; +MTFLRA: PUSHJ P,MTCNTR ;Make sure user space is writable first + MOVSI B,%MASTP + MOVSI T,%MARAC + IORM B,MSRAC(W) ;Tell PI-level read routine to stop reading + TDNE T,MSRAC(W) ;Wait until PI level actually stops + PUSHJ P,UFLS + ANDCAM B,MSRAC(W) ;Turn off %MASTP, things are now quiet + SKIPLE MSCMDC(W) ;Make sure PI level is completely inactive + PUSHJ P,UFLS ;Wait if necessary + MOVE B,MSNBOL(W) ;Get # bufs on read list (='s # records ahead) + LDB C,[.BP (%MAEFA),MSRAC(W)] ;1 if EOF read ahead + MOVSI T,%MAEFA ;Clear read-ahead EOF + ANDCAM T,MSRAC(W) + JRST MTCBFF ;Go flush read-ahead buffers + +;Space files, + = forward, - = back +MTSPF: SKIPE MSCRW(W) ;Not allowed if writing + JRST MTSOSP + PUSHJ P,MTFLRA ;Flush read-ahead + MOVN B,C ;Number of files tape is ahead of user + ADDB B,MTMCNT(W) ;Adjust desired count + JUMPE B,CPOPJ ;If now zero we are done +MTSPF1: PUSHJ P,MTCNTR ;Update user's count in case of PCLSR + JUMPG B,MTSPFF ;Go do forward if needed + MOVEI B,MGSPRF ;Get space reverse file command + PUSHJ P,MTCMD ;Queue it + AOSGE B,MTMCNT(W) ;Done? + JRST MTSPF1 ;Nope + POPJ P, + +MTSPFF: MOVEI B,MGSPFF ;Get space forward file command + PUSHJ P,MTCMD ;Do it + SOSLE B,MTMCNT(W) ;Count down + JRST MTSPF1 ; till done + POPJ P, + +;Update user's FUNCTION,,COUNT word in case he's PCLSR'd +; +MTCNTR: HRRZ A,MTMTAP(W) + MOVE T,MTMFNC(W) + HRL T,MTMCNT(W) + XCTR XW,[MOVEM T,(A)] + POPJ P, + +;Get Controller status words to I,J +; +MTSTAT: SKIPLE MSCMDC(W) ;Wait till commands queued to PI level are done + PUSHJ P,UFLS + MOVEI B,MGSTAT ;GET STATUS command + PUSHJ P,MTCMD ;Give to PI + SKIPLE MSCMDC(W) ;Wait till done + PUSHJ P,UFLS + MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) + POPJ P, + +;Go to EOT +; +MTSPEOT:MOVEI B,MGSEOT ;Get SPACE-TO-LOGICAL-EOT command + JRST MTCMD ;Queue it. Note read-ahead doesn't matter here + +;Stop whatever we are doing right now +; Very brute-force - throws away all pending commands, read-ahead buffers, etc. +; +MTSTOP: CONO PI,UTCOFF ;We are going to mess with buffer lists + SETZM MSCMDC(W) ;Poof, no more commands + MOVE Q,[-MGQDLL,,MGQD0-1] ;Reset Q PDL pointer to base of stack + MOVE T,MSLCTB + IMUL T,W + ADD Q,T + MOVEM Q,MGQDLP(W) + MOVE Q,[-MSCBL-1,,MSCB0-1] ;Reset command queue input pointer + ADD Q,T + MOVEM Q,MTCMBP(W) + MOVE Q,[4400,,MSCB0-1] ;Reset command queue output pointer + ADD Q,T + MOVEM Q,MGCMBP(W) + SKIPL A,MTMDN(W) ;Buffer active at MP level? + PUSHJ P,IMEMR ;Yes, release it + SETOM MTMDN(W) ;No buffer active at MP level + SETZM MSMPRP(W) ;Zero MP pointer into current buffer + SETZM MSMPRC(W) ;Zero count of available words in buffer + PUSHJ P,MTCBFF ;Flush any buffers queued for PI level + CAME W,MGUNIT ;Is interrupt level waiting for this unit? + JRST UTCONJ ;No, all set + SETOM MGUNIT ;Yes, say no unit waiting for interrupt. + ;(Makes interrupt go away w/out doing anything) +IFN TM10P,[ + CONI MTC,I ;See what drive controller thinks it's using + LDB B,[MUNITF,,I] + CAME W,B ;Same as the drive we're clearing? + JRST UTCONJ ;If not same unit, don't do anything + MOVE B,MTCONO(W) ;Yes, abort operation in progress + CONO MTS,31 ;Stop the tape + CONO MTC,(B) ;Clear interupts +];IFN TM10P +IFN TM03S,[ + IORDI B,%TMTC + ANDI B,7 ;Get selected transport + CAME W,B ;Same? + JRST UTCONJ + PUSHJ P,TMINIC ;Yes, go reinit controller +];IFN TM03S + SKIPGE A,MGCABN(W) ;Any buffers active at PI level? + JRST UTCONJ ;No + PUSHJ P,IMEMR ;Yes, return buffer to system + SETOM MGCABN(W) ;Say no buffer active at PI level + JRST UTCONJ ;Leave + + + + diff --git a/system/nmtape.30 b/system/nmtape.30 new file mode 100644 index 0000000..24f6a67 --- /dev/null +++ b/system/nmtape.30 @@ -0,0 +1,2448 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;******************************** +;** +;** TO BE DONE: +;** +;** RECORDS LONGER THAN 1K +;** AUTOMATIC DETERMINATION OF DENSITY AND RECORD LENGTH WHEN READING +;** ALLOW CLOSE WHEN TAPE HAS BEEN TAKEN OFF +;** BE MORE FORGIVING OF CONTROLLER LOSSAGE +;** PASS .MTAPE TO JOB DEVICE +;** HAVE AN IGNORE ERRORS SWITCH +;** THIS HORRIBLE BLETCHEROUS IOT CODE SHOULD BE REDESIGNED +;** +;******************************** + +;Do not be deceived by the TM10 conditionals. This file is only good +; for a TM03/RH11 on a KS10. See MTAPE for anything else. Barf. + +IFE TM10A+TM10B+TM03S,.ERR NO MAGTAPE CONTROLLER TYPE SELECTED +IFN TM10A,INFORM IO BUSS MAG TAPE,1 +IFN TM10B,INFORM DATA CHANNEL MAG TAPE,1 +IFN TM03S,INFORM RH11/TM03 MAG TAPE,1 + +IFN TM10P,[ +$INSRT TM10 +] +IFN TM03S,[ +$INSRT TM03S +] +$INSRT T20MAC + +MSCBL==8 ;Command buffer length +MGQDLL==10. ;PI level PDL length +IF2 IFN MNUMB-140600, .ERR IMPLICIT DEPENDENCY ON MNUMB +MSEOFP==210100 ;High bit of MNUMB in MEMBLT is EOF flag +MSCHN==140500 ;Other 5 bits of MNUMB is drive number + +MTXP==410300,, ;BP to set/get transport number from IOCHNM +MUNITF==170300 ;BP to set/get unit field in MTC CONI + +IFN TM10P,[ +;Tape controller commands +MNOPIN==10000 ;NOP and interrupt when idle +MWRITE==4000 ;Write data +MW3IN==14000 ;Write data and long EOR gap +MSPRR==7000 ;Space in reverse direction +MREAD==2000 ;Read data +MSPFR==6000 ;Space in forward direction +MSPFF==16000 ;Space forward to EOF +MSPRF==17000 ;Space reverse to EOF +MREWND==1000 ;Rewind +MRWNDD==11000 ;Rewind and unload +MWEOF==5000 ;Write EOF mark +] + +MGNRTY==10. ;Number of retries on read + +;Modes in OPEN call +; +%MMOUT==1,,0 ;Open for output, 0=>input +%MMBLK==2,,0 ;Block mode, 0=>unit mode +%MMIMG==4,,0 ;Image mode, 0=>Ascii +%MMCNK==10,,0 ;"Chunk" mode, 0=>stream mode +%MMNSE==20,,0 ;No skip to EOF on close, 0=>do skip +%MMEP==40,,0 ;Even parity, 0=>odd +%MMDEN==300,,0 ;Density select + ; 00=> "Default" - 1600 for KS/TU77 + ; 01=> 800 BPI + ; 10=> 1600 BPI + ; 11=> 6250 BPI +%MM32B==400,,0 ;"IBM" mode, write 8-bit bytes from LH 32 bits + ; 0=> core dump +%MMRSZ==7000,,0 ;Record Size + ; Ranging binarily from 0=>1024. to 7=>8. bytes + + +EBLK + +SUBTTL MAG TAPE STORAGE AREA + +MGVTC: 0 ;Scratch word for virgin tape check +MGJDTI: 0 ;"Wait for job done" time out value +MGNWRD: 0 ;Number of words read in a PI level read +MGTBZY: -1 ;Flag to get interrupt started +MGSFTI: 0 ;Software interrupt in progress +MGUNIT: -1 ;Unit expecting interrupt +MGWCW: 0 ;"Wait for control word written" flag +LMIOWD: 0 ;Last MIOWD + +MSRAC: BLOCK NMTCS ;Transport software status flags + %MA==1,,525252 + %MAEOF==400000 ;4.9 EOF seen on read - must be 4.9 + %MAETR==200000 ;4.8 EOT on internal read + %MAETW==100000 ;4.7 EOT on write + %MAERR==040000 ;4.6 PI level got an error + %MARCE==020000 ;4.5 Read compare error + %MACTH==014000 ;4.4 Core allocator says stop + ;4.3 " (WHY 2 BITS?) + %MASTP==002000 ;4.2 Stop read ahead + %MANWT==001000 ;4.1 Nothing written on tape yet + %MAEFA==000400 ;3.9 EOF seen on read-ahead, user hasn't seen + %MAESO==000200 ;3.8 EOF read since open + %MAMSO==000100 ;3.7 Tape moved since first open + %MAREW==000040 ;3.6 "Tape is rewinding" flag + %MARAC==000020 ;3.5 Read active flag + %MAMOL==000010 ;3.4 Transport on line + %MAWSW==000004 ;3.3 Wants software (timing) interrupts +MGERRC: BLOCK NMTCS ;Error count +MTCEFW: BLOCK NMTCS ;Number of EOF's written at close +MGEOFR: BLOCK NMTCS ;Number of EOF's since last read +MTPSAV: BLOCK NMTCS ;Storage to restore P on EOF +MSCMDC: REPEAT NMTCS,0 ;Number of commands in command list +MGSPCD: BLOCK NMTCS ;Spacing operation command +MGSCNT: BLOCK NMTCS ;Spacing operation count +MGEOTT: BLOCK NMTCS ;Timeout for detecting virgin tape +MSBUFP: REPEAT NMTCS,0 ;Mag tape MP<->PI buffer queue in,,out +MSNBOL: BLOCK NMTCS ;Number of buffers on list +MSCRW: BLOCK NMTCS ;R/W flag, -1=>output 0=>input +MSMPRC: BLOCK NMTCS ;Words left in buffer +MSMPRP: BLOCK NMTCS ;Next word in buffer +MTMDN: REPEAT NMTCS,-1 ;Block active at MP +MGCABN: REPEAT NMTCS,-1 ;Buffer active at PI level +MTUSE: REPEAT NMTCS,-1 ;Number of channels open on this transport +MTUSR: REPEAT NMTCS,-1 ;User index of transport user +MTBLKS: BLOCK NMTCS ;If write, buffer size + ;If read, size of last record read +MTMFNC: BLOCK NMTCS ;.MTAPE function storage +MTMCNT: BLOCK NMTCS ;.MTAPE count +MTMTAP: BLOCK NMTCS ;MTAPE call word + +MGCMTS: BLOCK NMTCS ;PI level status info (CONI MTS or similar) +MGCMTC: BLOCK NMTCS ;PI level controller info (CONI MTC or similar) + + IFN TM10P,[ +MTCONO: REPEAT NMTCS,\.RPCNT_17+20 ;Prototype CONO word for each transport + ] + IFN TM03S,[ +MTSELW: BLOCK NMTCS ;Select word (TC reg val) for each transport + MTSELM==3777 ;density/format/parity/unit bits mask +MTWTFC: BLOCK NMTCS ;-10 word count to tape frame conversion factor + ] + +;Build table of QDL (PI level stack) pointers +MGQDLP: REPEAT NMTCS,-MGQDLL,,CONC MGQD,\.RPCNT,-1 + +;Built storage for command lists and PI level stacks +REPEAT NMTCS,[ + CONC MSCB,\.RPCNT,: + BLOCK MSCBL ;Space for command list + MGRCV ;Fake "command", causes list to wrap around + + MGNCMD ;Function on botton of Q PDL, gets new command + CONC MGQD,\.RPCNT,: + BLOCK MGQDLL ;Space for PI level stack + + IFE .RPCNT,MSLCTB==.-MSCB0 ;Length of each table +] + +;Build table of pointers for adding commands to command list +MTCMBP: REPEAT NMTCS,-MSCBL-1,,CONC MSCB,\.RPCNT,-1 + +;Build table of bytepointers for removing commands from command list +MGCMBP: REPEAT NMTCS,4400,,CONC MSCB,\.RPCNT,-1 + +;It is depressing to discover that the DUMP program sucks these directly +; out of the running ITS. If you change what's in here fix DUMP too. + +MGEMTC: 0 ;CONI MTC, at last error +MGEMTS: 0 ;CONI MTS, at last error + +IFE TM10B,[ +MIOWD: BLOCK 2 ;Channel program +] +IFN TM10A,[ +MGDBRK: 0 + CONO MTS,1 + JRST 12,@MGDBRK +];TM10A + +BBLK + + +;Random Macros + +;Enqueue and Dequeue buffers from the lists used to pass buffers between +; main program and PI level. Assumes W has a valid transport number... + +DEFINE MTENQB REG,TEMP=TT + SKIPG MSNBOL(W) ;;Any buffers on list already? + IFSKP. + HLRZ TEMP,MSBUFP(W) ;;Yes, get old tail pointer + DPB REG,[MLO,,MEMBLT(TEMP)] ;;Add new one onto end of list + ELSE. + HRRM REG,MSBUFP(W) ;;No, make new buffer head of list + ENDIF. + HRLM REG,MSBUFP(W) ;;New buffer is tail in any event + SETZM TEMP + DPB TEMP,[MLO,,MEMBLT(REG)] ;;Indicate end of list + AOS MSNBOL(W) ;;Increment count of buffers on list +TERMIN + +DEFINE MTDEQB REG,TEMP=TT + HRRZ REG,MSBUFP(W) ;;Get head of buffer list + HLRZ TEMP,MSBUFP(W) ;;Get tail + CAMN REG,TEMP ;;Tail == head? + IFSKP. + LDB TEMP,[MLO,,MEMBLT(REG)] ;;No, get next buffer on list + HRRM TEMP,MSBUFP(W) ;;Make it the new head of list + ELSE. + SETZM MSBUFP(W) ;;Only one buffer, list is now empty + ENDIF. + SOS MSNBOL(W) ;;Decrement count of buffers on list +TERMIN + +IFN TM03S,[ +;Macros for testing various status bits as set up by MGGXPT and friends +IRP OP,,[NN,NE,NA,O,OE,ON,OA,Z,ZE,ZN,ZA,C,CE,CN,CA] + DEFINE TT!OP REG,#MSK + ...TSF==0 + IFSE REG,CS1,[ + TL!OP I,MSK + ...TSF==-1 + ] + IFSE REG,CS2,[ + TR!OP I,MSK + ...TSF==-1 + ] + IFSE REG,FS,[ + TL!OP J,MSK + ...TSF==-1 + ] + IFSE REG,ERR,[ + TR!OP J,MSK + ...TSF==-1 + ] + IFE ...TSF,.ERR Invalid register name REG given in TTxxx macro + TERMIN +TERMIN +];IFN TM03S + SUBTTL MAG TAPE OPEN ROUTINE + +; C/ MODE,,DEV +; D/ MODE (ROT 1) 4.9=1=>OUTPUT +; I/ DEVICE NUMBER +; R/ IOCHNM WORD POINTER + +MAGTO: SKIPL W,I ;Get device + CAIL W,NMTCS ;Too big? + JRST OPNL1 ;No such device + MOVSI T,%MAREW + TDNE T,MSRAC(W) ;Rewinding? + PUSHJ P,UFLS ;Yes, wait for completion + CONO PI,CLKOFF ;Don't want transport status changed under me + SKIPL MTUSE(W) ;See if we are the first opener + IFSKP. ;First opener. Initialize database for device + SETZM MSBUFP(W) ;Indicate no buffers on chain + SETZM MSNBOL(W) ;Another way of saying above + SETZM MSMPRC(W) ;Buffer words remaining + SETZM MSMPRP(W) ;Pointer to buffers + SETOM MTMDN(W) ;No buffer at MP level + SETOM MGCABN(W) ;No buffer owned by PI code + SETZM MSRAC(W) ;Initialize transport software status word + MOVEI A,2 + MOVEM A,MTCEFW(W) ;Number of EOF's written + MOVSI A,%MANWT + IORM A,MSRAC(W) ;Indicate nothing written on tape + ELSE. ;Not first opener. Check legality of this open + CAME U,MTUSR(W) ;Same user as previous open? + JRST OPNL10 ;Different user, report error + MOVE B,D ;Check direction of open + EQV B,MSCRW(W) ;Same as previous direction? + SKIPL B ;Yes, OK + JRST OPNL2 ;No, wrong direction + ENDIF. + MOVEM U,MTUSR(W) ;Store user + SETZM MSCRW(W) ;Indicate read until found to be otherwise + TLNE C,1 ;Read or write? + SETOM MSCRW(W) ;Indicate write + AOS MTUSE(W) ;Indicate 1 more user + PUSHJ P,SOSSET + MTUSE(W) ;SOS if PCLSR'd + CONO PI,CLKON ;Let um (em?) get me (who's em?) + PUSHJ P,MTSTAT ;Get transport status in standard form + MOVE A,MSRAC(W) + TLNE A,%MAERR ;PI error means device not there + JRST MTODNP ;Go report error +IFN TM03S,[ + TTNN FS,%TMSFP ;Formatter present? + JRST MTODNP ;No, can't win + TTNN FS,%TMSOL ;Slave on line? + JRST MTODOL ;No, lose +] +IFN TM10P,[ + TXNN J,%T1STH ;Transport hung, by chance? + JRST MTOW1 ;No, proceed + TXNN J,%T1SRW ;OK if rewinding + JRST OPNL7 ;Device not working +] +MTOW1: SKIPN MSCRW(W) ;Writing? + JRST MTOW2 ;No... +IFN TM10P,TXNE J,%T1SWL ;Yes. Write locked? +IFN TM03S,TTNE FS,%TMSWL + JRST OPNL26 ;Yes, device writelocked error +IFN TM10P, TXNN J,%T1SET ;At EOT? +IFN TM03S, TTNN FS,%TMSET + JRST MTOW2 ;No + MOVSI A,%MAETW+%MAERR ;If write and EOT, make .IOT give IOC error, + ; but let open win + IORM A,MSRAC(W) + +MTOW2: TXNE C,%MMDEN ;Density specified explicitly? + JRST MTOW3 ;Yes, go check for validity +IFN TM10P,MOVEI A,1 ;No, pick one. Use 800 for TM10 +IFN TM03S,MOVEI A,2 ;Use 1600 for TM03 + DPB A,[.BP %MMDEN,C] ;Set value + JRST MTOW4 ;Done and assumed correct + +MTOW3: LDB A,[.BP %MMDEN,C] ;Get density from open +IFN TM10P,[ + CAIE A,1 ;800 is the only currently OK speed for TM10 + JRST OPNL12 + IFN 0,[ +;You need something like this if you arrange to allow non-800 TM10 speeds + TXNN C,%MM32B ;32-bit compatible mode requested? + JRST MTOW4 ;No, core dump + CAIN A,1 ;Density specified as 800? + JRST MTOW4 ;Yes, we can do that + JRST OPNL12 ;32-bit and not 800BPI, controller can't do it + ] +];IFN TM10P +IFN TM03S,[ + CAIN A,3 ;Specified 6250? + JRST OPNL12 ;Yep, loser. Else OK +] + +;Here on successful open. +; Set up CONO or select word, IOCHNM word, blocksize +; +MTOW4: PUSHJ P,LSWDEL ;Release MTUSE switch +IFN TM10P,[ + MOVEI A,MTCCHN_3 ;Start building CONO word. Set control PI level +IFN TM10A,TRO A,1 ;Add in data PI level for non-DF10 controller + LDB B,[.BP %MMDEN,C] ;Get density from open + CAIE B,1 ;800 BPI + BUG INFO,[ILLEGAL TM10 TAPE SPEED SETTING, USING 800BPI] + MOVEI B,%T1D80 ; Yep. + DPB B,[.BP %T1CDS,A] ;Set density field of CONO word + TXNN C,%MM32B ;32-bit mode specified? + TXO A,%T1CCD ;No, set core dump mode in CONO + TXNN C,%MMEP ;User wants even parity? + TXO A,%T1COP ;No, set odd parity + DPB W,[.BP %T1CNU,A] ;Set unit number field of CONO + MOVEM A,MTCONO(W) ;Save assembled CONO word +];IFN TM10P +IFN TM03S,[ + MOVE A,W ;Get unit number being initialized + TXNN C,%MM32B ;User asked for industry compatible? + IFSKP. ;Yes... + MOVEI B,4 ;Set word-to-frame conversion factor + MOVEM B,MTWTFC(W) + MOVEI B,%TMFIC ;Set mode in budding select word + ELSE. ;Core dump... + MOVEI B,5 ; takes 5 tape frames per word + MOVEM B,MTWTFC + MOVEI B,%TMFCD ;Set CD format in select word + ENDIF. + DPB B,[.BP %TMTFS,A] ;Set format in select word + TXNE C,%MMEP ;User wants even parity? + TXO A,%TMTEP ;Yes, set even parity flag + LDB B,[.BP %MMDEN,C] ;Get density from open + CAIE B,1 ;800 BPI specified? + SKIPA B,[%TMD16] ;Anything else, use 16 + MOVEI B,%TMD08 ;800, use that + DPB B,[.BP %TMTDS,A] ;Set density in select word + MOVEM A,MTSELW(W) ;Set select word for this unit +];IFN TM03S + LDB B,[.BP %MMRSZ,C] ;Get record size from open call + TRC B,7 ;Convert to power of two + MOVEI A,10 ;Minimum record size is 10 (8.) words + LSH A,(B) ;Blocksize = minimum * 2^power + MOVEM A,MTBLKS(W) ;Save blocksize in words + LDB A,[.BP <%MMBLK\%MMIMG>,C] + ;Use unit/block and ascii/image bits as index + HLR C,MTOPTB(A) ;Get input dispatch routine from table + TLNE D,400000 ;Remember D? Skip if user opened in input mode + HRR C,MTOPTB(A) ;OK, get output dispatch routine instead + MOVEM C,(R) ;Save routine in IOCHNM word + DPB W,[MTXP(R)] ;Set transport number in IOCHNM word + JRST POPJ1 ;Skip return means success + +;Here if device is not present +MTODNP: SETZM MSRAC(W) ;Too bad. Clear status word and report error + JRST OPNL1 + +;Here if device off line +MTODOL: SETZM MSRAC(W) + JRST OPNL7 + +;Table of I/O routines +; +MTOPTB: MTUAIX,,MTUAOX ;Unit Ascii + MTBIX,,MTBOX ;Block Ascii + MTUIIX,,MTUIOX ;Unit Image + MTBIX,,MTBOX ;Block Image + + + +SUBTTL MAG TAPE CLOSE ROUTINES + +;MTOCL - CLOSE TAPE OPEN FOR OUTPUT + +MTOCL: LDB W,[MTXP(R)] ;Set up transport number + SOSL MTUSE(W) ;Decrement transport use counter + POPJ P, ;Not only channel open, all done + AOS MTUSE(W) ;Consistant state in case PCLSR'd + MOVSI A,%MAERR + TDNE A,MSRAC(W) ;See if error has occurred + PUSHJ P,MTOCL3 ;Yes, clean up a few things + + SKIPL MTMDN(W) ;Is there a partially processed buffer? + PUSHJ P,MTWBFD ;Yes, write it to tape + + MOVEI B,MGMEOT ;Queue a "Write EOT" command to PI level + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) + PUSHJ P,UFLS ;Wait till done. + MOVEI A,1 + MOVEM A,MGEOFR(W) + SKIPGE MTMDN(W) ;Active buffer at MP level? + IFSKP. + MOVE A,MTMDN(W) + BUG PAUSE,[MT: MP BUF REMAINS AT CLOSE],OCT,A + PUSHJ P,MEMR + ENDIF. + SKIPGE MGCABN(W) ;Active buffer at PI level? + IFSKP. + MOVE A,MGCABN(W) + BUG PAUSE,[MT: PI BUF REMAINS AT CLOSE],OCT,A + PUSHJ P,MEMR + ENDIF. + SKIPN MSNBOL(W) ;Any buffers on buffer queue? + IFSKP. + BUG PAUSE,[MT:],DEC,MSNBOL(W),[BFRS QUEUED AT CLOSE] + PUSHJ P,MTCBFF + ENDIF. + SETOM MTUSE(W) ;Nobody is using this transport + SETOM MTUSR(W) ;No user associated with this transport + SETZM MSRAC(W) ;reset transport software status word + POPJ P, + +MTOCL3: SKIPL A,MTMDN(W) ;Have a buffer active at MP level? + PUSHJ P,MEMR ;Flush it if so + SETOM MTMDN(W) + SETZM MSMPRC(W) ;Say no words left in current buffer + POPJ P, + +;Close routine for MT open for input + +MTICL: LDB W,[MTXP(R)] ;Set up channel data pointer + SOSL MTUSE(W) ;Last user? + POPJ P, ;No, nothing to do + AOS MTUSE(W) ;Yes, save state for possible PCLSR + MOVEI T,1 ;This crock is because we want to allow + CAMGE T,MSCMDC(W) ; one outstanding command if rewinding + PUSHJ P,UFLS ;Wait till one or less outstanding command + MOVE T,MSRAC(W) ;Get transport software status + TLNE T,%MAREW ;Is it rewinding? + IFSKP. + SKIPLE MSCMDC(W) ;No, wait till no outstanding commands + PUSHJ P,UFLS + ENDIF. + SKIPGE MGCABN(W) ;Any PI-level buffers left? + IFSKP. + MOVE A,MGCABN(W) + BUG PAUSE,[MT: PI INPUT BUF LEFT AT CLOSE],OCT,A + PUSHJ P, MEMR + ENDIF. + PUSHJ P,MTRBD ;Release any MP-level buffers + SETOM MTUSR(W) ;Reset user identifier + PUSHJ P,MTCBFF ;Free some buffers ?whose+++ + SOS MTUSE(W) ;Decrement use count + MOVE T,MSRAC(W) ;Get transport software status again + TLNE T,%MAREW ;Are we rewinding? + JRST MTICL2 ;Yes, don't have to skip to EOF + MOVSI A,(%MMNSE) + TDNE A,(R) ;Check if user wants skip to EOF + JRST MTICL2 ;No, forget it + MOVSI A,%MAMSO + TDNN A,MSRAC(W) ;Has tape moved at all since open? + JRST MTICL2 ;No... + SKIPE MGEOFR(W) ; + JRST MTICL2 ;Note that this disposes of a read-ahead EOF. + PUSHJ P,MTSTAT +IFN TM10P,[ + MOVE B,MGCMTS(W) + TXNE B,%T1SBT ;BOT? + JRST MTICL2 +] +IFN TM03S,[ + TTNN FS,%TMSOL ;Still online? + JRST MTICL2 ;No, can't very well skip to EOF + TTNE FS,%TMSBT + JRST MTICL2 +] + MOVEI B,MGSPFF ;Space forward to end of file + PUSHJ P,MTCMD + SKIPLE MSCMDC(W) ;Wait till command done + PUSHJ P,UFLS + +MTICL2: MOVSI T,%MAREW + ANDM T,MSRAC(W) ;Clear all software status except rewinding + POPJ P, ;Done + +;Free a chain of IO buffers pointed to by MSBUFP(W) +; Count of buffers is in MSNBOL(W) +; +MTCBFF: SKIPN MSNBOL(W) ;Any buffers on chain? + POPJ P, ;No, fine + DO. + HRRZ A,MSBUFP(W) ;Yes, get pointer + LDB T,[MLO,,MEMBLT(A)] ;Get pointer to next buffer + HRRM T,MSBUFP(W) ;Write that in chain header + PUSHJ P,MEMR ;Return buffer to IO pool + SOSLE MSNBOL(W) ;Any more to do? + JRST TOP. ;Yes, loop back for more + ENDDO. + SETZM MSBUFP(W) ;Zero buffer list pointer + POPJ P, + + + +SUBTTL MAG TAPE INPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAI: MOVEI B,CHRKTI ;Unit ASCII input + MOVE E,[440700,,5] + JRST MTREAD + + SKIPA B,[SIOKT] +MTUII: MOVEI B,CHRKTI ;Unit image input + MOVE E,[444400,,1] + JRST MTREAD + +MTBI: MOVE E,[444400,,1] ;Block input + MOVEI B,BLKT + +MTREAD: LDB W,[MTXP(R)] ;W <= Transport number + PUSHJ P,MTIECK ;Check for tape errors first + MOVEM P,MTPSAV(W) ;Save P for EOF return + JSP B,(B) ;IO Routine. BLKT,CHRKT,SIOKT + MSMPRP(W) ;Pointer to next word + MSMPRC(W) ;Count of words remaining + SETZ MTRBG ;Get new buffer (SETZ for CHRKT return on EOF) + MTRBD ;Discard buffer + JRST 4,. ;Unused + PUSHJ P,MTRBFW ;Code to wait for new buffer from PI level + +;Get a new buffer for I/O code. +; This routine assumes that there is a buffer ready to get +; (i.e. MTRBFW was called) +; +MTRBG: SKIPG MSNBOL(W) ;Any buffers on list? + JRST MTRBG3 ;No, must be error or EOF + CONO PI,UTCOFF ;Stop I/O for a bit + MTDEQB TT,A ;Dequeue buffer into TT using A as temp + MOVEM TT,MTMDN(W) ;Remember buffer active at MP level + CONO PI,UTCON ;Turn I/O back on + LDB J,[MWC,,MEMBLT(TT)] ;Get word count from buffer + MOVEM J,MTBLKS(W) ;Save for .MTAPE 13 + LSH TT,10. ;Convert buffer number into address + JRST SIOBGX ;TT/address, J/word count /E unchanged + +;Here if no buffer ready, error or EOF assumed +; +MTRBG3: SKIPL MSRAC(W) .SEE %MAEOF ;EOF flag set in transport status? + IFSKP. + MOVSI T,%MAEFA ;The EOF is now no longer read-ahead + ANDCAM T,MSRAC(W) ;So remember that fact + JRST POPJ2 ;Double skip to tell I/O code about EOF + ENDIF. + PUSHJ P,MTIECK ;Not EOF. Check for error conditions + BUG HALT,[TAPE READ BUFFER VANISHED] ;No error, shoulda been a buffer + +;MAG TAPE READ BUFFER DISCARD ROUTINE +MTRBD: SKIPGE A,MTMDN(W) ;Have an active MP buffer? + JRST MOVTWJ ;Set up T for buffer wait, return + CONO PI,UTCOFF ;Stop IO for a bit + SETOM MTMDN(W) ;No active MP buffer + SETZM MSMPRC(W) ;No data in nonexistant buffer + LDB TT,[MSEOFP,,MEMBLT(A)] ;Get EOF flag from PI level + PUSHJ P,MGMEMR ;Return buffer, enable UTC + JUMPN TT, [ MOVSI A,%MAEOF ;EOF seen? + IORM A,MSRAC(W) ;Record EOF in software status + JRST .+1 ] +MOVTWJ: MOVE T,W ;T gets transport number for bfr wait UFLS + POPJ P, ;Also MTRBG, MTRBFW rely on this setting T + + +;MAG TAPE READ WAIT FOR DATA ROUTINE +; Called under a UFLS by system IO code to wait for data to arrive. +; Note T, not W, has transport number. T must be set up by some +; previous routine +; +MTRBFW: MOVE TT,MSRAC(T) ;Get software status of transport + TLNN TT,%MAEOF\%MAERR ;PI code reports EOF or error? + SKIPLE MSNBOL(T) ;Or are any buffers available for reading? + JRST POPJ1 ;SOme interesting condition, unhang + TLNE TT,%MARAC ;Have we asked for a tape read yet? + POPJ P, ;Yes, nothing to do but wait, wait, wait + PUSH P,W ;This being done under a UFLS. only T good + PUSH P,B + MOVE W,T ;Set up transport number in usual place + MOVEI B,MGREAD ;What we want the PI level to do + MOVEI T,MSCBL ;Make sure that there is room in command list + CAMG T,MSCMDC(W) ;If there is room, + IFSKP. ; we will request a read operation + MOVSI TT,%MARAC + IORM TT,MSRAC(W) ;Read is active now, or will be shortly + PUSHJ P,MTCMD1 ;Queue up command request for PI level + ENDIF. ;If no room for command, all we can do is wait + MOVE T,W ;Fix up T for UFLS + POP P,B ;Clean up everything else + POP P,W + POPJ P, + +SUBTTL MAG TAPE OUTPUT .IOT ROUTINES + + SKIPA B,[SIOKT] +MTUAO: MOVEI B,CHRKT ;Unit ASCII output + MOVE E,[440700,,5] + JRST MTWRIT + + SKIPA B,[SIOKT] +MTUIO: MOVEI B,CHRKT ;Unit image output + MOVE E,[444400,,1] + JRST MTWRIT + +MTBO: MOVE E,[444400,,1] ;Block output + MOVEI B,BLKT + +MTWRIT: LDB W,[MTXP(R)] ;Get transport number + PUSHJ P,MTIECK ;Check for tape errors first + HRLZI A,%MAETW + TDNE A,MSRAC(W) ;PI code think it hit EOT? + JRST IOCER9 ;Yep, go lose + JSP B,(B) + SETZ MSMPRP(W) ;Pointer to next word + MSMPRC(W) ;Count + SETZ MTWBFG ;Get new buffer + MTWBFD ;Write out buffer to tape + JRST 4,. + TRNA ;No wait for buffer routine needed + +;MAG TAPE WRITE - BUFFER GET ROUTINE + +MTWBFG: PUSHJ P,MTIECK ;Check for tape errors + PUSHJ P,TCALL ;Turn off UTC + JRST IOMQ ;Try to get buffer + POPJ P, ;Return noskip if no buffers available + MOVEM A,MTMDN(W) ;Store active buffer number + MOVEI T,MUMGB + DPB T,[MUR,,MEMBLT(A)] ;Tell world that it is a mag tape buffer + DPB W,[MSCHN,,MEMBLT(A)] ;Store channel number in buffer header + SETZM TT + DPB A,[121000,,TT] ;Convert block number in A to address in TT + MOVE J,MTBLKS(W) ;Get block size of write + JRST SIOBGX + +;MAG TAPE WRITE - BUFFER FINISHED ROUTINE +; General IO code has filled a buffer or otherwise finished with it. +; Queue the buffer for writing if there is anything in it. + +MTWBFD: PUSHJ P,MTIECK ;Check for tape errors + SKIPGE A,MTMDN(W) ;Have an active buffer? + POPJ P, ;No, nothing to do + MOVEI T,MSCBL ;See if there is any room in command list + CAMG T,MSCMDC(W) + PUSHJ P,UFLS ;Wait for room in command list + MOVE T,MTBLKS(W) ;Get blocksize we are writing + SUB T,MSMPRC(W) ;Subtract number of words remaining in buffer + CONO PI,UTCOFF ;Lock up while frobbing buffer lists + SETOM MTMDN(W) ;Clear active buffer + SETZM MSMPRC(W) ;Clear free word in buffer count + JUMPE T,MEMR ;Nothing in buffer, just return block + DPB T,[MWC,,MEMBLT(A)] ;Store word count + MTENQB A ;Queue buffer on to-PI list + CONO PI,UTCON ;Finished mucking with buffer list + PUSH P,B + MOVEI B,MGWRIT ;Issue a write request to PI level + PUSHJ P,MTCMD + MOVSI B,%MANWT + ANDCAM B,MSRAC(W) ;Note that we have written something to tape + SETZM MTCEFW(W) ;Note no EOF's written at end of tape + JRST POPBJ ;Restore B and return + +SUBTTL MTCMD - GIVE COMMAND TO PI LEVEL + +;PUSHJ P,MTCMD + ;RH(W) has transport number + ;RH(B) has address of PI level routine to execute + +MTCMD: MOVEI T,MSCBL ;Pending command list length + CAMG T,MSCMDC(W) ;Count of commands currently in list + PUSHJ P,UFLS ;Wait for room in pending command list + CONO PI,UTCOFF ;Grab machine, keep count accurate +MTCMD1: MOVE T,MTCMBP(W) ;Get pointer to next slot in command list + AOBJN T,MTCMD2 ;Increment slot and check for wraparound + SUB T,[MSCBL,,MSCBL] ;Reached end of list, ring it +MTCMD2: MOVEM B,(T) ;Store new command + MOVEM T,MTCMBP(W) ;Store new pointer + AOS MSCMDC(W) ;Indicate one more command in list + JRST MSTRTR ;Go start up PI routine + +SUBTTL MTIECK - CHECK FOR IOC ERROR + +;PUSHJ P,MTIECK + ;Returns +1 if no error + ;Gives IOC error to user if error - never returns. + +MTIECK: PUSH P,A + MOVE A,MSRAC(W) ;Get transport software status + TLNN A,%MAERR ;PI level report an error? + JRST POPAJ ;No, all is OK + SKIPLE MSCMDC(W) ;Wait for PI level to finish cleaning up + PUSHJ P,UFLS ; before throwing away buffers + SKIPL A,MTMDN(W) ;Have an active MP-level buffer? + PUSHJ P,MEMR ;Yes, throw it away + SETOM MTMDN(W) ;No active MP buffer + SETZM MSMPRP(W) ;No place to get/put next character + SETZM MSMPRC(W) ;No room to do it anyway + PUSHJ P,MTCBFF ;Free any buffers waiting for MP processing + POP P,A + MOVE T,MGCMTS(W) ;Get transport status data from PI level +IFN TM10P,[ + TRNE T,%T1STH\%T1SIO ;Transport hung or illegal operation? + JRST IOCER1 ;Yes, report device error + TRNE T,%T1SPE\%T1SRC\%T1SRL\%T1SDL\%T1SBT ;Gruesome errors + JRST IOCER3 ;Report irrecoverable data error + TRNE T,%T1SET ;(Real) End of Tape? + JRST IOCER9 ;Device Full error +];IFN TM10P +IFN TM03S,[ + MOVE I,MGCMTC(W) ;Get controller transport status from PI level + MOVE J,MGCMTS(W) + TTNE CS1,%TM1MP ;Control bus parity error? + JRST IOCER1 + TTNN CS1,%TM1TE ;Transfer error? Could be TM03 or RH11 + IFSKP. + TTNE CS2,%TM2DL\%TM2UP\%TM2NF\%TM2NM\%TM2PE\%TM2MT\%TM2MP + JRST IOCER1 ;Non-data errors + TTNN FS,%TMSES ;Formatter error? + IFSKP. + TTNE ERR,%TMEUS\%TMECT\%TMENX\%TMEMD\%TMEFS\%TMEMC\%TMERM\%TMEIR\%TMEIF + JRST IOCER1 ;Fatal formatter errors + TTNE ERR,%TMECE\%TMECS\%TMEFC\%TMENG\%TMEFL\%TMEIC + JRST IOCER3 ;Non-recoverable data errors + ENDIF. + ENDIF. + TTNE FS,%TMSET ;End of tape? + JRST IOCER9 +];IFN TM03S + MOVE A,MGEOFR(W) ;Check for logical EOT + CAIL A,2 ;Read two EOF's since last record? + JRST IOCER9 ;Yes, report EOT + JRST IOCER3 ;No, give irrecoverable data error for now + +SUBTTL MAG TAPE .STATUS ROUTINE +;Building a status word in D. +;Routine sets: +; 1.7-1.9 open modes +; 2.3 BOT +; 2.4 EOT +; 2.5 9 track (0 = 7 track) +; 2.6 IBM mode (0 = coredump) +; 2.7 Transport idle (no pending command) +; 2.8 EOF (last thing seen was a tape mark) +; +STAMTC: +;Open modes + LDB W,[MTXP(R)] ;Get transport number + DPB A,[60300,,D] ;Open mode + PUSHJ P,MTSTAT ;Get tape status from transport +;EOT? + LDB A,[.BP %MAETW_22,MSRAC(W)] ;EOT on write + LDB B,[.BP %MAETR_22,MSRAC(W)] ;EOT on read + IOR A,B + DPB B,[140100,,D] ;Tape at EOT? +IFN TM10P,[ +;7 or 9 track drive? + LDB A,[20100,,J] ;Get 7/9 track bit + TRC A,1 + DPB A,[150100,,D] ;7 or 9 track drive + .ERR Missing TM10 .STATUS code at STAMTC +] +IFN TM03S,[ +;A bunch of new stuff. BOT? + SETZ A, + TTNE FS,%TMSBT ;Transport is at BOT? + SETO A, + DPB A,[130100,,D] ;BOT. +;7 or 9 track drive? + SETOM A ;TM03 is always 9-track + DPB A,[150100,,D] ;7 or 9 track drive +;Core dump or 32 bit mode? + MOVE A,MTWTFC(W) ;Get word to frame conversion. 4 or 5 + TRC A,1 ;Flip last bit. Last bit now on iff 32bit mode + DPB A,[160100,,D] ;Sorry. +;Formatter busy? + SETO A, + SKIPLE MSCMDC(W) ;Idle if no pending commands + SETZ A, + DPB A,[170100,,D] +;EOF last thing seen? + SETZ A, + TTNE FS,%TMSTM ;Last thing seen was a tape mark? + SETO A, + DPB A,[200100,,D] ;EOF. +];IFN TM03S + POPJ P, + +;RCHST ROUTINE FOR MAG TAPE + +RCHMGT: HLRZ E,(R) ;Get open mode from IOCHNM word + LDB J,[MTXP(R)] ;Get the mag tape drive number + MOVSI J,'MT0(J) ;Return that drive's device name + TRZ E,(.BM MTXP) ;Clear drive # field in OPEN modes + JRST POPJ1 ;Skip so that J overrides built-in device name + + +SUBTTL MAG TAPE PI LEVEL + +;Request magtape interrupt from MP-level software +; Must be called with I/O interrupts off (CONO PI,UTCOFF) +; This is called every 1/2 second by the ITS slow clock routine +; +MSTRTR: SETZM MGTBZY ;No busy tapes, flag software interrupt + CONO PI,MTCRQ ;Request interrupt on magtape channel + CONO PI,UTCON ;Reenable IO interrupt system + POPJ P, ;That is all + +;Handle tape interrupt requested by software or other nonspecific cause +; Get here via non-vectored MTCCHN interrupt on the KS +; +MGSBRK: AOS MGTBZY ;Note interrupt level is busy + SETOM MGSFTI ;Note software interrupt in progress + MOVEI B,NMTCS-1 ;Loop over all transports + SKIPG MSCMDC(B) ;Any commands in command list? +MGSBK1: SOJGE B,.-1 ;No, try next transport + SKIPGE B ;Found command or finished scan. Which? + JRST MGSBK2 ;Finished scanning. Go check other things + MOVE W,B ;Have a command. Set up transport number + PUSH P,B ;Save B over call to command routine + MOVSI B,%MACTH + TDNN B,MSRAC(W) ;Core allocator saying go away? + PUSHJ P,MGXGO ;No, go start requested routine + POP P,B ;Restore transport count + JRST MGSBK1 ;Loop back for another transport + +MGSBK2: SETZM MGSFTI ;Clear software interrupt flag + JRST MGEX ;That's all for now +;This probably should check for lost IE bits on TM03 + +;Handle interrupt caused by specific hardware conditions +; Get here via vectored interrupt on the KS +; + +IFN TM10P,[ +; A - result of CONI MTC, +; C - result of CONI MTS, +; +MGHBRK: SKIPGE W,MGUNIT ;Get unit we are expecting interrupt on + JRST MGUBRK ;None? Probably MP level bailed out. Punt. + LDB B,[MUNITF,,A] ;Get unit that controller is squacking about + CAME W,B ;Same unit? + BUG HALT,[MT PI CODE LOST TRANSPORT] + MOVE J,C + PUSH P,[MGEX] ;Cause POPJ P, in handler to dismiss interrupt +IFN TM10B,[ + TXNE C,%T1SCP\%T1SNM\%T1SDP ;Check for DF10 errors + JRST MGERR ;Yes, go to error routine +];TM10B + TXNE C,%T1SIO ;Illegal operation error? + JRST MGERR ;Yes, go to error routine + JRST MGXGO ;No, go handle interrupt + +;Here to unbreak on unexpected hardware interrupt +; +MGUBRK: LDB W,[MUNITF,,A] ;Who's the loser, anyway + MOVE B,MTCONO(W) ;Get prototype CONO word for that transport + CONO MTC,(B) ;Select offending unit + CONO MTS,31 ;Clear interrupt, DF10, stop any op in progress + JRST MGEX ;Go dismiss interrupt +];IFN TM10P + +IFN TM03S,[ +;Check for active unit. If none, go directly to inactive slave +;polling code. If active unit,check that controller is talking about +;this unit, then jump to its routine (MGXGO). When that finishes, +;see if controller is still showing attention, and check status +;of other transports if so. +; +;Well, almost. + + EBLK +MGHBRK: 0 + BBLK + JSR UTCSAV ;Save AC,s set up interrupt P PDL + AOS MGTBZY ;Note interrupt level is alive + SKIPGE W,MGUNIT ;Some transport waiting for an interrupt? + JRST MGNOUW ;Nope, either Slave Status Change or lossage + IORDI B,%TMTC ;Get transport the TM03 is thinking about + ANDI B,7 + CAME B,W ;Same as the one we were waiting for? + BUG HALT,[MT PI CODE LOST TRANSPORT] + PUSHJ P,MGXGO ;Go jump into this unit's handler + +MGNOUW: +IFN NMTCS-1,[ +.ERR Missing multi-transport code at MGNOUW! +If more than one unit, have to see if this is an interrupt caused by a +SSC (slave status change), and if so poll all the inactive units and +update their software status (rewinding, on/off line, etc.) With only +one transport we currently avoid this by keeping the unit active +(MGUNIT set) as long as it is doing *anything*, and giving it all the +hardware interrupts. See rewind code, too. +];IFN NMTCS-1 + JRST MGEX ;Go dismiss interrupt +];IFN TM03S + +;Interrupt level control flow +; +; Each transport maintains the current state of its PI-level action +; routines on a seperate (per-transport) PDL with its SP in Q. This +; allows you to save the current state, dismiss the interrupt, and +; resume where you left off when the next interrupt for this transport +; arrives. +; +; Subroutine linkage between routines handling a per-drive PI-level +; action is with PUSHJ Q,xxx and POPJ Q, +; +; The MP level queues commands for the PI level to process on a per- +; transport queue at MGSBx (x=unit number) +; +; Ths general interrupt code transfers to the per-drive actions by +; jumping to MGXGO, which will load Q from the saved state of the +; current drive and start up whatever it finds there. This may be +; the MGNCMD routine, which will start a new command, or it may be +; the middle of an in-progress PI-level command handler. +; +; PI-level action routines can relinquish control in several ways: +; +; PUSHJ Q, CPOPJ will dismiss the current interrupt, arranging for +; control to return to the instruction following the PUSHJ when the +; next interrupt for this unit occurs. +; +; JRST MGOVER will dismiss the current interrupt, arranging for the +; currently executing subroutine to be restarted "from the top" when +; the next interrupt for this unit occurs. +; +; A simple POPJ P, will dismiss the current interrupt, arranging for +; the routine that called this one to be started at the point immediately +; after the call when the next interrupt comes in. This is generally not +; useful except from first-level action routines, where a POPJ P, will +; indicate that you have finished handling the current command and cause +; the next interrupt to fetch and start execution of a new command from the +; queued command list by transferring to MGNCMD. Got that? + +;Transfer control to whatever the per-transport code wants to do. +; +MGXGO: MOVE Q,MGQDLP(W) ;Getsaved Q PDL pointer for current transport + PUSHJ P,QPOPJ ;"Return" to whatever is on top of Q PDL, + ; arranging for POPJ P, to return to here + + MOVEM Q,MGQDLP(W) ;Save current Q PDL for next time + POPJ P, ;Return, dismissing this interrupt + +;Dismiss interrupt, arranging for next interrupt to restart routine +; we are currently executing (rather than either continuing here or +; starting a new command) +; +MGOVER: +IFN TM10P,[ + CONSZ MTS,%T1STH\%T1SIO\%T1SCE ;Tape hung/ill op/DF10 error, + JRST MGERR ; go handle error condition +] + SOS (Q) ;Decrement address at top of Q PDL, now + ; points to PUSHJ Q, instruction so + ; that we will get called again from MGXGO + ; at next interrupt dispatch + POPJ P, ;Return to P PDL caller, dismissing interrupt + + +;This routine is always the last "command" in a transport command list +; Wraps the command list BP around the the beginning of the list, +; then gets and executes the next command. +; +MGRCV: MOVNI A,MSCBL+1 ;Get negative length of command list + ADDM A,MGCMBP(W) ;Wrap command extraction pointer back to start +MGNCM1: ILDB B,MGCMBP(W) ;Get new command from list + JRST (B) ;And jump to it + +;This code is always the first (bottom) thing in a transport's Q PDL +; It is therefore executed whenever MGXGO transfers control to the +; Q PDL and there is no command in progress. +; +MGNCMD: AOBJN Q,MGNCM1 ;Got here w/ POPJ Q,. Fake PUSHJ to restore Q, + ; then go get the next command + + BUG ;Q PDL pointer clobbered + +QPOPJ1: AOS (Q) +QPOPJ: POPJ Q, + + +;WAIT FOR JOB DONE BIT TO SET +; Called from PI-level command routines to wait for end of command. +; Called with PUSHJ Q,MGWTJD +; +; Returns +1 to caller if unusual termination +; +2 to caller if operation terminated normally +; +; I,J contain tape status: +; On TM10, I=CONI MTC, +; J=CONI MTS +; On TM03S, I=%TMCS1,,%TMCS2 (controller status), +; J=%TMFS,,%TMERR (formatter status) + +IFN TM10P,[ +MGWTJD: CONI MTS,J ;Get transport status + TXNE J,%T1STH\%T1SIO ;Transport hung or Illegal operation? + JRST MGERR ;Yes, job-done isn't ever going to get set +MGWJD1: CONI MTS,J ;Get status again + SKIPN MGJDTI ;Is there a time out set? + IFSKP. + MOVE T,TIME ;Yes, check it. Get current time + CAML T,MGJDTI ;Smaller than specified timeout time? + JRST MGERR ;No, lose + ENDIF. + TXNN J,%T1SJD ;JOB-DONE bit set? + JRST MGOVER ;No, we want to wait for it + CONI MTS,J ;Job Done. Get status + CONI MTC,I ;Get CONI MTC + MOVEM J,MGCMTS(W) ;Save for MP level + MOVEM I,MGCMTC(W) +IFN TM10B,[ + SKIPE MGWCW ;Want to wait for control word? + PUSHJ Q,MGWCWC ;Check to see if it is written + SETZM MGWCW ;Clear wait-for-control-word request flag +] + CONO MTS,30 ;Clear channel conditions + MOVE B,MTCONO(W) + CONO MTC,(B) ;Release mtc, clear job done bit +IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP ;Check for channel errors + POPJ Q, ;Channel error, return nonskip +] + TXNE J,%T1STH\%T1SIO\%T1SPE\%T1SRC%\T1SRL\%T1SDL\%T1SBT + POPJ Q, ;Random other things, not necessarily errors + JRST QPOPJ1 ;Success +];IFN TM10P +IFN TM03S,[ +MGWTJD: +MGWJD1: IORDI T,%TMCS1 ;Get controller status + TXNN T,%TM1GO ;Go bit still set? + JRST MGWJD2 ;No, command is finished. Go check errors + SKIPE T,MGJDTI ;Is there a time out set? Get it if so. + CAML T,TIME ;Past timeout time + JRST MGOVER ;No timeout or not timed out yet, go wait + JRST MGERR ;Timed out. Go check transport + +;Here if action has terminated. Set up status bits before returning +MGWJD2: HRLZ I,T ;%TMCS1,,? + IORDI T,%TMCS2 + HRR I,T ;I = %TMCS1,,%TMCS2 + IORDI J,%TMERR + IORDI T,%TMFS + HRL J,T ;J = %TMFS,,%TMERR - I,J now in standard form + MOVEM J,MGCMTS(W) ;Save for MP level + MOVEM I,MGCMTC(W) + TTNE CS1,%TM1MP ;Massbus control parity error + JRST MGERR ;Who knows what the transport is doing + TTNN CS1,%TM1TE ;Controller error? + TTNE FS,%TMSES ;Formatter error? + POPJ Q, ;Yes, return +1 for closer examination + JRST QPOPJ1 ;Success +];IFN TM03S + +;Select the transport given by W +; Returns +1 with transport selected, status in I,J +; May dismiss and wait for a while first +; +MGGXPT: +IFN TM10P,[ + CONSO MTS,%T1SNU ;Can controller select new unit right now? + JRST MGOVER ;No, wait for it + MOVE T,TIME + ADDI T,10.*30. ;Time out in 10. seconds + MOVEM T,MGJDTI ;Set up job-done timeout + MOVEM W,MGUNIT ;Note unit waiting for hardware interrupt + MOVE B,MTCONO(W) ;Get CONO word for new unit + CONO MTC,MNOPIN(B) ;NOP, but interrupt when new drive is ready + PUSHJ Q,MGWJD1 ;Wait for job done + JFCL ;Ignore any errors + SETZM MGJDTI ;No more timeout + SETOM MGUNIT ;Not waiting any more + POPJ Q, ;Return to caller +];IFN TM10P +IFN TM03S,[ + IORDI T,%TMFS ;Get current formatter status + TXNN T,%TMSES\%TMSSC ;Showing error or slave status change? + IFSKP. ;Yes, clear errors before going ahead + IOWRI W,%TMTC ;Select slave + MOVEI A,10. ;Try 10 times to clear drive + MOVEI B,%TMCLR + DO. + IOWRI B,%TMCS1 ;Write drive clear command + IORDI T,%TMFS ;Get status + TXNN T,%TMSES ;Still have error + JRST ENDLP. ;No, done + SOJG A,TOP. ;Retry up to 10 times + JRST MGERR ;Else give up + ENDDO. + ENDIF. + MOVE T,MTSELW(W) ;Get desired settings + IOWRI T,%TMTC ;Tell TM03 + MOVEI T,%TMNOP ;You may need this to set status values + IOWRI T,%TMCS1 ; but I'm not really sure + IORDI T,%TMCS1 + PUSHJ Q,MGWJD2 ;Go set status registers appropriately + JFCL ;Maybe should check non-existant slave? + POPJ Q, +];IFN TM03S + +;MGERR - HANDLE TAPE ERROR +; +;Called from PI level command routines which detect a tape or controller error +; Flags error in software status word, records error status in MGExxx. +; Flushes command in progress by resetting Q PDL to base. +; Flushes commands in PI-level command queue by resetting queue pointers. +; Flushes any buffers which might be queued for writing. +; Returns to P PDL, to wait for new commands. + +MGERR: +IFN TM10P,[ + CONI MTS,MGEMTS ;Get transport status for MP level analysis + CONI MTC,MGEMTC +] +IFN TM03S,[ + IORDI T,%TMCS1 ;Get controller and transport status into + HRLM T,MGEMTC ; standard form + IORDI T,%TMCS2 + HRRM T,MGEMTC + IORDI T,%TMFS + HRLM T,MGEMTS + IORDI T,%TMERR + HRRM T,MGEMTS + MOVE I,MGEMTC ;Get status to standard place for macros + MOVE J,MGEMTS +];IFN TM03S + MOVSI T,%MARAC ;Read not active, for sure + ANDCAM T,MSRAC(W) + SETZM MSCMDC(W) ;No commands active + SETOM MGUNIT ;Clear unit wait flag + SETZM MGJDTI ;No job-done timeout +IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP ;Channel error? + BUG PAUSE,[MTAPE: CHANNEL ERROR, STATUS=],OCT,J,[MICWA+1=],OCT,MICWA+1,[MIOWD=],OCT,MIOWD +];TM10B +IFN TM03S,[ + .ERR UBA errors? More gentle cleanup? + TTNE CS1,%TM1MP\%TM1TE ;Cbus parity or transfer error? + TTNE FS,%TMSES ;And no formatter error? + SKIPA ;Yes and yes (no) (what?). Controller error + BUG INFO,[MTAPE: RH11 ERROR, STATUS=],OCT,MGEMTC,[TM STATUS=],OCT,MGEMTS + TTNE FS,%TMSES ;Formatter error? + BUG INFO,[MTAPE: FORMATTER ERROR, STATUS=],OCT,MGEMTS + PUSHJ P,TMINIC ;Go reinit controller +];IFN TM03S + SKIPL A,MGCABN(W) ;Any buffers owned by PI routines? + PUSHJ P,IMEMR ;Yes, give them back to system + SETOM MGCABN(W) ;No PI buffer any more + HRLZI B,%MAERR ;Flag error detected by PI level + IORM B,MSRAC(W) ;Store in transport status word + MOVE Q,[-MGQDLL,,MGQD0-1];Reset Q PDL to base of this unit's stack, + MOVE T,MSLCTB ; thus flushing whatever command is in progress + IMUL T,W ;Find offset to base of Q PDL for this unit + ADD Q,T ;Add to prototype unit 0 QDP pointer, + PUSH P,Q ; and save it away + MOVE Q,[-MSCBL-1,,MSCB0-1] ;Get command list input pointer + ADD Q,T ;Offset it to this unit's command queue, + MOVEM Q,MTCMBP(W) ;And save it as new MP (input) queue pointer + MOVE Q,[4400,,MSCB0-1] ;Get new command list output pointer + ADD Q,T ;Offset correctly for this unit, + MOVEM Q,MGCMBP(W) ;And save as PI (output) command queue pointer + MOVSI B,%MAREW ;Does initting xport stop TM03 rewind? + ANDCAM B,MSRAC(W) ;Say not rewinding + SKIPN MSCRW(W) ;If reading, + JRST POPQJ ; we're done. Restore Q and exit + SKIPN MSNBOL(W) ;Writing. Any buffers on list? + JRST POPQJ ;No, restore Q and exit + DO. ;Here to free buffers on IO list + HRRZ A,MSBUFP(W) ;Get buffer pointer from head of chain + LDB T,[MLO,,MEMBLT(A)] ;Get back pointer (next buffer) + HRRM T,MSBUFP(W) ;Make next buffer head of chain + PUSHJ P,IMEMR ;Free current buffer + SOSLE MSNBOL(W) ;Decrement count, check for more + JRST TOP. ;More, loop back + ENDDO. + SETZM MSBUFP(W) ;Mark list as empty + JRST POPQJ ;Restore Q and return + +IFN TM10B,[ +;Wait for control word to get written +; +MGWCWC: SKIPE MICWA+1 ;Control word written? + POPJ Q, ;Yes, return to caller + CONO MTS,4 ;No, tell DF10 to write it +MGWCW1: SKIPE MICWA+1 ;Written yet? + JRST MGWCW2 ;Good, done + PUSHJ Q,CPOPJ ;Not written. Dismiss interrupt and wait + JRST MGWCW1 ;We're back. See if written yet. + +MGWCW2: MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) ;Restore status + TLO J,10 ;Set control word written + POPJ Q, ;Return to caller +];IFN TM10B + +IFN TM10A,[ +MGDCSI: SKIPA A,[BLKI MTC,MIOWD] +MGDCSO: MOVE A,[BLKO MTC,MIOWD] + MOVEM A,MAGLOC + MOVE A,[JSR MGDBRK] + MOVEM A,MAGLOC+1 + POPJ Q, +];IFN TM10A + +IFN TM03S,[ +;Note this one's called on P PDL +TMINIC: IORDI A,%TMTC ;Get TC reg value + ANDI A,MTSELM ;Keep interesting bits only + IORDI B,%TMCS2 ;Get CS2 + ANDI B,7 ;Keep selected "drive" (TM03) number only + MOVEI T,%TM2CC + IOWRI T,%TMCS2 ;Clear controller logic + IOWRI B,%TMCS2 ;Reselect TM03 + IOWRI A,%TMTC ;Reselect transport + MOVX T,%TMCLR ;Do a formatter clear command + IOWRI T,%TMCS1 + POPJ P, +];IFN TM03S + + +SUBTTL MAG TAPE PI LEVEL WRITE + +MGWRIT: PUSHJ Q,MGGXPT ;Select desired transport +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Write locked, hung or rewinding? + JRST MGERR ;Not a good thing +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line? + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +] + MOVSI A,%MACTH + TDNE A,MSRAC(W) ;Core alloc want quit temporarly? + JRST [ PUSHJ Q,CPOPJ ;OK, wait a while + JRST MGWRIT ] ;Then go back and try again + MOVEM W,MGUNIT ;Set unit + HRREI B,-MGNRTY ;Number of retries + MOVEM B,MGERRC(W) ;Store error count + MTDEQB A ;Get buffer to write off list + MOVEM A,MGCABN(W) ;Note this buffer active at PI + LDB B,[MWC,,MEMBLT(A)] ;Get word count from buffer + MOVNS B ;B -> -COUNT + HRLZS B ;B -> -COUNT,,0 +IFN KL10P,LSH B,4 ;Shift if KL10 data channel +IFN KL10P,MOVE R,A ;Save core page number for cache sweep +IFE TM03S,[ ;TM03S IOWD is -COUNT,,ITS PAGE + LSH A,10. ;Convert buffer number to memory address + SUBI A,1 ;Address - 1 +] + HRRM A,B ;B -> -COUNT,,ADDRESS-1; an IO word +IFN TM10B,DATAO MTS,[MICWA] ;Tell DF10 where IO channel program is +IFN TM10A,PUSHJ Q,MGDCSO ; + MOVEM B,MIOWD ;Put IO word where controller looks + MOVEM B,LMIOWD ;Remember what we're about to do +IFN TM10P,SETZM MIOWD+1 ;Stop after one operation +IFN KL10P,[ + PUSHJ P,CSHSWP ;Unload buffer from cache into core + CAI +] +MGWRT2: +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get prototype CONO word + CONO MTC,MWRITE(B) ;Perform WRITE operation +] +IFN TM03S,[ + HLRE A,MIOWD ;Get PDP10 word count + ASH A,1 ; * 2 + IOWRI A,%TMWC ; = number of unibus words to transfer + HLRE A,MIOWD ;Get PDP10 word count again + IMUL A,MTWTFC(W) ;Convert to tape frame count + IOWRI A,%TMFC ;Set tape frames to write + HRRZ A,MIOWD ;Get ITS page to transfer to + LSH A,1 ;Convert ITS pg # to DEC pg # + TXO A,%UQVAL ;Valid mapping, I should hope + IOWRI A,UBAPAG+IUTPG_1 ;Set up first half of UBA mapping + TXO A,1 ;Next DEC page number + IOWRI A,UBAPAG+IUTPG_1+1 ;Set second half of UBA mapping + MOVEI A,IUTPG_14 ;Unibus address to DMA to + IOWRI A,%TMBA ;Tell controller + MOVX A,%TM1IE\%TMWRT ;Write, enable interrupts + IOWRI A,%TMCS1 ;Start controller +] + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGWERR ;Error, go attempt to repair + +;Here if tape written OK +MGWRT3: MOVE A,MGCABN(W) ;Get buffer number + HRLZI B,%MAETW+%MAERR ;End of tape check +IFN TM10P,TXNE J,%T1SET ;Controller says we're at EOT? +IFN TM03S,TTNE FS,%TMSET + IORM B,MSRAC(W) ;Tell MP + LDB T,[MUR,,MEMBLT(A)] ;Get buffer flavor from buffer + CAIE T,MUMGB ;Still a magtape buffer? + BUG HALT,[MT BUF CHANGED INTO SOME OTHER KIND??] + SETOM MGCABN(W) ;No buffer active at PI anymore + PUSHJ P,IMEMR ;Return buffer to system + MOVSI A,%MAMSO ;Note tape has moved since open + IORM A,MSRAC(W) + ;JRST MGCMDR ;Falls through + +;General exit routine for most PI-level command handlers +; Check command queue for more commands. +; If no further commands, dismiss interrupt. +; If further commands queued, wait for this one to finish, then fetch +; and begin processing of next command. +; +MGCMDR: SOS MSCMDC(W) ;Decrement command count + SETOM MGUNIT ;Reset active unit + SKIPG MSCMDC(W) ;Any more commands? + JRST MGCMR1 ;No. Go see about other units +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTC,MNOPIN(B) ;Tell controller to interupt when unit ready + MOVEM W,MGUNIT ;Set up unit number again for MGWTJD + PUSHJ Q,MGWTJD ;Go wait for unit to finish current command + JRST MGERR ;Oops + SETOM MGUNIT ;No unit waiting any more +];IFN TM10P + POPJ Q, ;Return on Q PDL. Most likely this will + ; transfer control to MGNCMD routine at + ; base of PDL, which will fetch and execute + ; next command. + +MGCMR1: +IFN NMTCS-1,[ +;Ought to check other transports for commands to start. +; For now, will get started by 1/2 second timeout, if nothing else. + .ERR Unfinished multi-transport code at MGCMR1 +];IFN NMTCS-1 + POPJ P, ;No more, return on P to dismiss interrupt + + + +;CONTROLLER DETECTED ERROR ON WRITE OPERATION +; Retry, or give up, or write some blank tape and then try again, +; depending on the type of error. +; +MGWERR: +IFN TM10P,[ +IFN TM10B,SETZM MIOWD ;Seems to do one record anyway +IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;Specify one record to space back cmd. +] + TXNE J,%T1STH\%T1SRW\%T1SIO\%T1SET\%T1SWL ;Bad types of errors + JRST MGERR ;OK, give up + AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ;Space reverse one record + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGERR ;Error + MOVE B,LMIOWD ;Get last operation's IOWD + MOVEM B,MIOWD ;We're going to try it again + MOVE B,MTCONO(W) ;Get prototype CONO + CONO MTC,14000(B) ;Write with extended EOR gap + PUSHJ Q,MGWTJD ;Wait for completion + JRST MGWBT ;Lost again, retry some more + JRST MGWRT3 ;Worked, return to normal write sequence +];IFN TM10P +IFN TM03S,[ + TTNE ERR,%TMERM\%TMEUS\%TMEFS\%TMEIR\%TMEIF\%TMEMC\%TMECT\%TMENX\%TMEOI + JRST MGERR ;Fatal errors + TTNN FS,%TMSOL ;On line? + JRST MGERR ;This isn't so good either + TTNE ERR,%TMEFC\%TMENG\%TMEMD\%TMEIC\%TMECE\%TMECS\%TMEFL + JRST MGWER1 ;Error which retrying might fix + +;Formatter seems happy. Check channel status before returning +; Currently this only catches the case where there was an RH11 error +; but no TM03 error, and thus should always end up jumping to MGERR. +; Formatter errors on which it might be OK to get here are %TMECE, +; %TMECS, %TMEFL, but someone needs to test this... + TTNE CS1,%TM1TE ;Transfer error? + TTNE FS,%TMSES ;And not formatter error? + CAIA + JRST MGERR ;Just lose for now + BUG INFO,[MT: ACCEPTING QUESTIONABLE WRITE OPERATION] + JRST MGWRT3 + +;Retry errors +MGWER1: AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up + BUG INFO,[MT: RETRYING WRITE OPERATION] + PUSHJ P,TMINIC ;Hit controller with hammer + MOVEI B,1 + MOVEM B,MGSPCD(W) ;1 record + PUSHJ Q,MGSPCR ;Reselect transport space back a record + TTNE FS,%TMSTM ;Stopped on EOF? + SOSGE MGEOFR(W) ;Yes, one less EOF in front of us + SETZM MGEOFR(W) ;But never less than zero + PUSHJ P,TMINIC ;Hit controller with hammer again + PUSHJ Q,MGGXPT ;Set up transport again + MOVEI B,%TMER3\%TM1IE + IOWRI B,%TMCS1 ;Erase a few inches of tape + PUSHJ Q,MGWTJD ;Wait for job done + JRST MGERR ;Can't get anything right... + MOVE B,LMIOWD ;Get last operation's IOWD + MOVEM B,MIOWD ;We're going to try it again + JRST MGWRT2 ;Go back to write code and retry operation +];IFN TM03S + + +SUBTTL MAG TAPE PI LEVEL READ + +MGREAD: PUSHJ Q,MGGXPT ;Select desired transport +MGRD0: +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SET ;Unit hung, rewinding, or EOT + JRST MGERR ;Seems so, report error +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVE B,MGEOFR(W) ;EOF's seen since last read + CAIL B,2 ;Apparent logical EOT? + JRST MGERR ;Yes, can't read anything + SKIPE MSCRW(W) ;Make sure open for reading + BUG HALT,[MT: CHN NOT OPEN FOR READING] + MOVSI B,%MACTH ;Core allocator wants to wait? + TDNN B,MSRAC(W) ;Check in status word + PUSHJ P,IOMQ ;No, get a buffer + JRST [PUSHJ Q,CPOPJ ;Wanted to wait some or failed, + JRST MGREAD ] ; wait a while, then start over + MOVEM A,MGCABN(W) ;Note active buffer at PI level + MOVEI B,MUMGB + DPB B,[MUR,,MEMBLT(A)] ;Note buffer belongs to mag tape code + MOVEM W,MGUNIT ;Set active unit number + HRREI B,-MGNRTY ;Number of retries + MOVEM B,MGERRC(W) ;Store error count +IFN KL10P, MOVE R,A ;Get page for cache flush routine +IFE TM03S,[ ;TM03S IOWD is -COUNT,,ITS PAGE + LSH A,10. ;Convert buffer number to memory address + SUBI A,1 ;address-1 +] +IFE KL10P,HRLI B,-2000 ;Get count half of IOWD +IFN KL10P,HRLI B,-2000_4 ;The KL is, of course, different + HRR B,A ;-count,,address-1 + MOVEM B,LMIOWD ;Remember IOWD for possible retry +IFN TM10B,[ + DATAO MTS,[MICWA] ;Tell DF10 where the channel program is + SETZM MICWA+1 ;Stop after one operation +] +IFN TM10A,PUSHJ Q,MGDCSI +IFN TM10P,SETZM MIOWD+1 +MGRD1: MOVEM B,MIOWD ;Save IOWD where channel expects it + MOVEI B,2000 ;Assume for now that the record has 2K words + MOVEM B,MGNWRD ;Set up word count +IFN KL10P,[ + PUSHJ P,CSHSWP ;Ensure no residue of this page in cache + CAIA +] +IFN KS10P,CLRCSH ;KS needs cache invalidated on read +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get prototype CONO word + CONO MTC,MREAD(B) ;Issue READ command +] +IFN TM03S,[ + HLRE A,MIOWD ;Get PDP10 word count + ASH A,1 ; * 2 + IOWRI A,%TMWC ; = number of unibus words to transfer + SETZ A, ;Set FC to zero + IOWRI A,%TMFC ;Set tape frames to write + HRRZ A,MIOWD ;Get ITS page to transfer to + LSH A,1 ;Convert ITS pg # to DEC pg # + TXO A,%UQVAL + IOWRI A,UBAPAG+IUTPG_1 ;Set up first half of UBA mapping + TXO A,1 ;Next DEC page number + IOWRI A,UBAPAG+IUTPG_1+1 ;Set second half of UBA mapping + MOVEI A,IUTPG_14 ;Unibus address for DMA + IOWRI A,%TMBA ;Tell controller + MOVX A,%TM1IE\%TMRDF ;Read forward, enable interrupts + IOWRI A,%TMCS1 ;Start controller +];IFN TM03S +IFN TM10B,SETOM MGWCW ;Tell MGWTJD to wait for control word written + PUSHJ Q,MGWTJD ;Wait for command to complete + JRST MGRERR ;Error, go do something. May be retry, correct + ; MGNWRD if frame count error, or give up +IFN TM03S,[ +;Get true record size for TM03, which doesn't give a FC error on READ +MGRD1A: TTNE FS,%TMSTM ;Read a tape mark? + JRST [ SETZM MGNWRD ;Read a tape mark. No data, just EOF + JRST MGRD2 ] + IORDI A,%TMFC ;Get record size in tape frames + ADD A,MTWTFC(W) ;Round up to PDP10 words. + SUBI A,1 ;Add frames_per_word - 1 + IDIV A,MTWTFC(W) ;Get record size in PDP10 words + MOVEM A,MGNWRD +];IFN TM03S +;Here if OK or error handler has fixed things up +MGRD2: MOVE A,MGCABN(W) ;Get buffer we just wrote + SETOM MGCABN(W) ;No buffer active at PI level + MTENQB A ;Queue buffer up for MP level + MOVE B,MGNWRD ;Get number of words we read + DPB B,[MWC,,MEMBLT(A)] ;Set number of words in buffer +IFN TM10P,TXNE J,%T1SEF ;Read an EOF? +IFN TM03S,TTNE FS,%TMSTM ; i.e. a tape mark? + IFSKP. + SETZM MGEOFR(W) ;No. Note no EOFs read since last record + ELSE. + MOVSI B,%MAESO+%MAEFA ;EOF seen since open, EOF read ahead + IORM B,MSRAC(W) ;Note this in transport status word + SETO B, + DPB B,[MSEOFP,,MEMBLT(A)] ;Set EOF flag in this buffer + AOS A,MGEOFR(W) ;Count EOFs + CAIL A,2 ;Enough for EOT? + JRST MGRD4 ;Logical EOT, space back over it + ENDIF. + MOVSI A,%MAMSO + IORB A,MSRAC(W) ;Note tape movement +IFN TM10P,TXNE J,%T1SET ;Real EOT reached? +IFN TM03S,TTNE FS,%TMSET + JRST MGRD3 + MOVE C,MSNBOL(W) ;Get count of buffers on list +IFN TM10P,TXNN J,%T1SEF ;EOF? +IFN TM03S,TTNN FS,%TMSTM + +; CAIL C,6 ; or read ahead six records? + JFCL ;Or just for the hell of it + + JRST MGRD5 ;Yes, stop reading + TLNN A,%MASTP ;Somebody request we stop? + JRST MGRD0 ;No, go back and read another record + ;Yes, fall through to terminate read +;Here to terminate read command +; +MGRD5: MOVSI A,%MASTP+%MARAC ;Clear read active, any read stop request + ANDCAM A,MSRAC(W) + JRST MGCMDR ;Go to standard command return routine + +;Controller saw a real EOT +; +MGRD3: DPB B,[MSEOFP,,MEMBLT(A)] ;Fake EOF + DPB B,[420100,,MSRAC(W)] .SEE %MAETR ;Indicate EOT on read + JRST MGRD5 ;Terminate read + +;Here if logical EOT (two EOF's in a row) +; Back up till between the two EOF's +; +MGRD4: MOVSI A,%MAESO+%MARAC+%MASTP ;SECOND EOF, LOGICAL EOT + ANDCAM A,MSRAC(W) + JRST MGSPRF ;Space reverse one file + +;Error detected on read. +; Analyze error, retry read if it might help +; +MGRERR: +IFN TM10P,[ + IFN TM10B,[ + TXNE J,%T1SCP\%T1SNM\%T1SDP + JRST MGERR ;Channel error, forget it + ] + TXNE J,%T1STH\%T1SRW\%T1SIO\%T1SRC ;Hard error? + JRST MGERR ;Yes, abandon read + TXNE J,%T1SPE\%T1SDL%T1SBT ;Parity, data-late, or bad tape? + JRST MGMRT ;Yes, a read retry might fix it + TXNN J,%T1SRL ;Record length error? + JRST MGERR ;No, who knows what is going on + +;Here if record length error. Adjust MGNWRD to reflect data actually read +; +IFN TM10B,HRRZ A,MICWA+1 +IFN TM10A,HRRZ A,MIOWD ;Get final control word + HRRZ B,LMIOWD ;Get original IOWD + SUB A,B ;Calculate words read +IFN TM10B,SOS A ;Channel funnyness + CAIE A,1 ;Length of 1 may just be EOF indication + IFSKP. + TXNE J,%T1SEF\%T1SET ;1 word, EOF? EOT? + SETZM A ;Yes, zero length record, just carries MSEOFP + ENDIF. + MOVEM A,MGNWRD ;Save new record length + JRST MGRD2 ;Go process as potentially correctly read data +];IFN TM10P +IFN TM03S,[ + TTNE ERR,%TMERM\%TMEUS\%TMEFS\%TMEIR\%TMEIF\%TMEMC\%TMECT\%TMENX + JRST MGERR ;Fatal errors + TTNN FS,%TMSOL ;On line? + JRST MGERR ;This isn't so good either + TTZ ERR,%TMEFC\%TMENG ;Ignore NSG, Frame count error + TTNE FS,%TMSPE ;Phase encoded (1600BPI) mode? + TTZ ERR,%TMECE\%TMECS ;If so, ignore errors hardware already fixed + TTZN ERR,%TMECE\%TMECS\%TMEFC\%TMENG\%TMEFL\%TMEMD\%TMEIC ;Retryable? + JRST MGRER1 ;Nothing retrying will help + TTNE FS,%TMSTM ;Tape mark? + JRST MGRER2 ;Yes, no point in retrying + JRST MGMRT ;OK, go retry read + +;Formatter seems happy. Check channel status before returning +MGRER1: TTNE ERR,177777 ;Sanity check. Shouldn't be any errors left + JRST MGERR + TTNE CS1,%TM1TE ;Transfer error? + TTNE FS,%TMSES ;And not formatter error? + CAIA + JRST MGERR ;Just lose for now +MGRER2: JRST MGRD1A + +];IFN TM03S + + +;Retry a read operation +; +MGMRT: AOSL MGERRC(W) ;Still retrying? + JRST MGERR ;No, give up +IFN TM10P,[ + IFN TM10B,SETZM MIOWD + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + ] + MOVEM A,MIOWD ;One record + PUSHJ Q,MGDCSO + MOVE B,MTCONO(W) + CONO MTC,MSPRR(B) ;Back up one record + PUSHJ Q,MGWTJD ;Wait till done + JRST MGERR ;No errors allowed + IFN TM10A,PUSHJ Q,MGDCSI ;Put back PI 1 BLKI +];IFN TM10P +IFN TM03S,[ +;This could be more refined + PUSHJ P,TMINIC ;Hit controller with hammer + PUSHJ Q,MGGXPT ;Set up transport again + SETO A, + IOWRI A,%TMFC ;1 record + MOVEI A,%TM1IE\%TMSPR ;Space backwards command + IOWRI A,%TMCS1 ;Do it + PUSHJ Q,MGWTJD ;Wait till finished + JRST MGERR ;Give up if error +];IFN TM03S + MOVE B,LMIOWD ;Get IOWD from last command + JRST MGRD1 ;Try operation again + + +SUBTTL MAG TAPE PI LEVEL SPACING COMMANDS +;Space forward and space reverse are completely under conditionals + +IFN TM03S,[ + +;Space forward MGSPCD(W) records +MGSPCF: PUSHJ Q,MGGXPT ;Acquire transport + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + MOVEM W,MGUNIT ;Note active transport + MOVN A,MGSPCD(W) ;Get -count + IOWRI A,%TMFC ;Tell controller + MOVEI A,%TMSPF ;Get command + TXO A,%TM1IE ;Turn on interrupts + IOWRI A,%TMCS1 ;Start controller + PUSHJ Q,MGWTJD ;Wait till command completes + IFNSK. ;Error? + TTNE CS1,%TM1MP ;Control parity err? + JRST MGERR ;Yes, nothing else valid + TTNE FS,%TMSES ;Formatter errors? + IFSKP. + PUSHJ P, TMINIC ;No formatter errors, ignore RH errors + ELSE. + TTNN ERR,%TMEFC ;Frame count error? + JRST MGERR ;Nope, must be important + PUSHJ P,TMINIC + ENDIF. + ENDIF. + POPJ Q, + +;Space forward record +MGSPFR: MOVEI B,1 ;Do one record + MOVEM B,MGSPCD(W) ;Set count + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCF ;Do spacing op + TTNN FS,%TMSTM + SETZB B,MGEOFR(W) ;Count EOFs since last record. None here + TTNE FS,%TMSTM + AOS B,MGEOFR(W) ;Saw one. + CAIL B,2 ;Saw two? + JRST MGSPRR ;Back up over last one... + JRST MGCMDR ;Clean up and leave + +;Space forward file +MGSPFF: MOVSI B,%MAESO ;See if tape has already read ahead to EOF + TDZE B,MSRAC(W) + JRST MGCMDR ;EOF already read during the read, done + MOVEI B,1 ;Do one record + MOVEM B,MGSPCD(W) ;Set count + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCF ;Space forward one record + TTNN FS,%TMSTM + IFSKP. ;Saw a TM + AOS B,MGEOFR(W) ;Saw one. + CAIL B,2 ;Saw two? + JRST MGSPRR ;Yes, back up over last one, and leave + JRST MGCMDR ;No, OK, but we're done + ENDIF. + SETZB B,MGEOFR(W) ;No tape mark, reset count of EOFs seen +MGSPF1: MOVEM B,MGSPCD(W) ;Set count to 0 (B zero from above) + PUSHJ Q,MGSPCF ;Do it + TTNE FS,%TMSTM ;Saw a EOF? + IFSKP. ;No.. + TTNE FS,%TMSET ;Saw an EOT? + JRST MGERR ;Really shouldn't happen + JRST MGSPF1 ;Else go look for TM again + ENDIF. + AOS MGEOFR(W) ;Saw one. + JRST MGCMDR ;EOF read. done + +;Space reverse MGSPCD(W) records +MGSPCR: PUSHJ Q,MGGXPT ;Set up transport and get status + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSBT ;At BOT? + POPJ Q, + MOVEM W,MGUNIT ;Save selected transport + MOVN A,MGSPCD(W) ;Get -count + IOWRI A,%TMFC ;Tell controller + MOVEI A,%TMSPR ;Space Reverse command + TXO A,%TM1IE ;Turn on interrupts + IOWRI A,%TMCS1 ;Start controller + PUSHJ Q,MGWTJD ;Wait till command completes + IFNSK. ;Error? + TTNE CS1,%TM1MP ;Control parity err? + JRST MGERR ;Yes, nothing else valid + TTNE FS,%TMSES + IFSKP. + PUSHJ P,TMINIC + ELSE. + TTNN ERR,%TMEFC ;Frame count error? + JRST MGERR ;Nope, must be important + PUSHJ P,TMINIC + ENDIF. + ENDIF. + POPJ Q, + +;Space reverse one record +MGSPRR: MOVEI B,1 + MOVEM B,MGSPCD(W) ;1 record + MOVSI B,%MAMSO ;Note this command causes tape movement + IORM B,MSRAC(W) ;Set in transport software status + PUSHJ Q,MGSPCR + TTNE FS,%TMSTM ;Stopped on EOF? + SOSGE MGEOFR(W) ;Yes, one less EOF in front of us + SETZM MGEOFR(W) ;But never less than zero + JRST MGCMDR ;Leave through general exit + +;Space reverse fill +MGSPRF: MOVSI B,%MAESO ;See if tape has already read ahead to EOF + TDNN B,MSRAC(W) + JRST MGSPR2 ;No, we can just do command +MGSPR1: MOVEI B,1 + MOVEM B,MGSPCD(W) + PUSHJ Q,MGSPCR ;Skip back 1 record, should backup over EOF + TTNN FS,%TMSTM ;Tape mark seen? + JRST MGSPR1 ;Well, apparently not + MOVSI B,%MAESO + ANDCAM B,MSRAC(W) ;Turn off EOF-read-ahead flag +MGSPR2: SETZ B, + MOVEM B,MGSPCD(W) ;Space backwards the maximum number of records + PUSHJ Q,MGSPCR ;Do it + TTNN FS,%TMSBT ;BOT? + TTNE FS,%TMSTM ;Tape mark seen? + JRST MGCMDR ;Yes or Yes, all done + JRST MGSPR2 ;No, go back and try to find one. + +];End TM03S way back + + ;Rewind commands +; +MGRWND: +IFN TM10P,MOVEI B,MREWND ;Normal rewind +IFN TM03S,MOVEI B,%TMREW + CAIA +MGRWDM: +IFN TM10P, MOVEI B,MRWNDD ;Rewind and dismount +IFN TM03S, MOVEI B,%TMUNL + MOVEM B,MGSPCD(W) ;Set up command + PUSHJ Q,MGRWD1 ;Call action routine + JRST MGCMDR + +;Action routine for rewind commands +MGRWD1: PUSHJ Q,MGGXPT +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVEM W,MGUNIT + MOVE B,MGSPCD(W) ;Get desired command +IFN TM10P,[ + ADD B,MTCONO(W) + CONO MTC,(B) +] +IFN TM03S,[ + TXO B,%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD ;Start controller and wait till done + IFNSK. + TTNE FS,%TMSES + JRST MGERR ;Oops. + ENDIF. + SETZM MGEOFR(W) ;Seen no EOFs since last record + +;Here after rewind command has started. +; Two possibilities: Tape is rewound already, or controller is finished +; but tape is still rewinding. +IFN TM10P,[ +MGRWD2: TXNN J,%T1SRW ;Slave still rewinding tape? + JRST MGRWD3 ;No, at BOT + PUSHJ Q,CPOPJ ;Wait some. + CONI MTS,J ;Get status again + MOVEM J,MGCMTS(W) ;Update in memory + JRST MGRWD2 ;Go see if we're done yet. + +;Here when tape has rewound +MGRWD3: MOVE T,TIME ;Wait 1 second more + ADDI T,30. ;This is an attempt to fix a hardware bug + MOVEM T,MGJDTI +MGRWD4: MOVE T,TIME + CAML T,MGJDTI ;Check time + JRST MGRWD5 ;Finished waiting, go clean up + PUSHJ Q,CPOPJ ;No, wait some more + JRST MGRWD4 + +MGRWD5: MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) ;Say not rewinding, hasn't moved + SETZM MGJDTI ;Clear timeout + POPJ Q, +];IFN TM10P +IFN TM03S,[ +;This could be a lot smarter; should dismiss the command completely +; after rewind is started, and just scan for rewinding transports +; when a SSC interrupt is received. This change is also necessary +; to make multiple slaves work right; currently the rewinding unit +; holds active unit (MGUNIT) until the rewind is completed. +MGRWD2: TTNN FS,%TMSPP ;Transport still rewinding? + JRST MGRWD3 ;No, go finish up + PUSHJ Q,CPOPJ ;Dismiss interrupt, wait a while + PUSHJ Q,MGGXPT ;Get right slave, set up status + JRST MGRWD2 + +MGRWD3: MOVSI A,%MAMSO+%MAREW + ANDCAM A,MSRAC(W) ;Say not rewinding, hasn't moved + POPJ Q, +];IFN TM03S + +;SKIP TO LOGICAL EOT +; +MGSEOT: PUSHJ Q,MGGXPT ;Get transport +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW ;Hung or rewinding? + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation +] + MOVEM W,MGUNIT ;Set active unit +IFN TM10P,TXNE J,%T1SBT ;BOT? +IFN TM03S,TTNE FS,%TMSBT + JRST MGVTCK ;Yep, do virgin tape check + +;Not at BOT +; Do we have enough CONDITIONALS yet? +MGNVT: +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get CONO word + IFN TM10A,[ + PUSHJ Q,MGDCSO + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;Tell it to move one record + ] + IFN TM10B,SETZM MIOWD + CONO MTC,MSPRR(B) ;Space reverse first +];IFN TM10P +IFN TM03S,[ + SETO B, ;Space backwards one record + IOWRI B,%TMFC + MOVEI B,%TMSPR\%TM1IE + IOWRI B,%TMCS1 +];IFN TM03S + PUSHJ Q,MGWTJD ;Wait till done + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + SETZM MGEOFR(W) + AOS MGEOFR(W) ;Claim to have seen one EOF +MGEOT2: +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTC,MSPFF(B) ;Skip forward to EOF + PUSHJ Q,MGWTJD + JRST MGERR +] +IFN TM03S,[ + AOS MSCMDC(W) ;Kludge so MGSPFF will return here. + PUSHJ Q,MGSPFF ;Space forward file +] + MOVSI B,%MAETR ;See if we hit real EOT +IFN TM10P, TXNE J,%T1SET +IFN TM03S, TTNE FS,%TMSET + IORM B,MSRAC(W) ;Yep, tell MP +IFN TM10P,[ + MOVE B,MTCONO(W) + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD ;One record + ] + IFN TM10B,SETZM MIOWD + CONO MTC,MSPFR(B) ;Space forward one record +] +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC + MOVEI B,%TMSPF\%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI B,%MAETR ;Check for real EOT again +IFN TM10P,TXNE J,%T1SET +IFN TM03S,TTNE FS,%TMSET + IORM B,MSRAC(W) +IFN TM10P,TXNN J,%T1SEF ;Is this another EOF? +IFN TM03S,TTNN FS,%TMSTM ;(i.e. a tape mark) + JRST MGEOT2 ;No, not at logical EOT. Go try again +IFN TM10P,[ + MOVE B,MTCONO(W) ;Yes, at logical EOT, Back up over 1 EOF + CONO MTC,MSPRF(B) ;Space back one file +] +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC + MOVEI B,%TMSPR\%TM1IE + IOWRI B,%TMCS1 +] + PUSHJ Q,MGWTJD + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI B,%MAEOF+%MAETR ;Tell MP at EOF, EOT + IORM B,MSRAC(W) + JRST MGCMDR + +;Check for virgin tape +MGVTCK: MOVE T,TIME + ADDI T,60. ;Set a two second timeout + MOVEM T,MGEOTT(W) ; before we must see an EOT +IFN TM10P,[ + IFN TM10B,[ + SETZM MIOWD + DATAO MTS,[MICWA] + ] + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] + MOVEM A,MIOWD + PUSHJ Q,MGDCSO + ] + MOVE B,MTCONO(W) + CONO MTC,MREAD(B) ;Read record. will time out if no EOF marks +MGVTC1: CONI MTS,J + MOVEM J,MGCMTS(W) + TXNE J,%T1SJD ;Job done? + JRST MGNVT ;Yep, not virgin tape + TXNE J,%T1STH\%T1SIO ;Transport hung or illegal operation? + JRST MGERR ;Yes, give up + MOVE T,MGEOTT(W) ;Get the timeout value + CAMG T,TIME ;Time up? + JRST MGVT ;Yes, it's a new tape + PUSHJ Q,CPOPJ ;Wait a while + JRST MGVTC1 ;Go back and check again +];IFN TM10P +IFN TM03S,[ + SETO B, + IOWRI B,%TMFC ;Do one record + MOVEI B,%TMSPF\%TM1IE ;Space forward command + IOWRI B,%TMCS1 + +MGVTC1: IORDI T,%TMCS1 ;Get status + TXNN T,%TM1GO ;Still going? + IFSKP. ;Yep. + MOVE T,MGEOTT(W) ;Get the timeout value + CAMG T,TIME ;Time up? + JRST MGVT ;Yes, it's a new tape + PUSHJ Q,CPOPJ ;Wait a while + JRST MGVTC1 ;Go back and check again + ENDIF. + TXNE T,%TM1TE\%TM1MP ;Controller error? + JRST MGERR ;Yes, bad + IORDI T,%TMFS ;Get formatter status + TXNE T,%TMSES ;Formatter error? + JRST MGNVT ;No error, not a new tape + IORDI T,%TMERR ;Get formatter error register + TXNE T,%TMEFC ;Frame Count error? + JRST MGNVT ;Yes, that is probably an OK tape + JRST MGERR ;Not FC, must be a real problem +];IFN TM03S + +;Virgin tape. Abort operation in progress, rewind tape +MGVT: +IFN TM10P,[ + MOVE B,MTCONO(W) + CONO MTS,31 ;Clear controller + CONO MTC,MNOPIN(B) ;Start new command to clear things out + PUSHJ Q,MGWTJD + JFCL ;Ignore errors +] +IFN TM03S,[ + PUSHJ P,TMINIC +] +IFN TM10P,MOVEI B,MREWND ;Do a rewind +IFN TM03S,MOVEI B,%TMREW + MOVEM B,MGSPCD(W) + PUSHJ Q,MGRWD1 + SETZM MGEOFR(W) ;No EOFs seen + AOS MGEOFR(W) ;??? + JRST MGCMDR ;Done + +;Write EOT mark (two EOF's) on tape +; +MGMEOT: PUSHJ Q,MGGXPT +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +];IFN TM03S + MOVEM W,MGUNIT ;Note active unit + SKIPE MTCEFW(W) ;Check # of EOF's already written + IFSKP. ;None. Need to write two + AOS MSCMDC(W) ;Kludge so MGWEOF will return here. + AOS MTCEFW(W) ;Increment EOF count + PUSHJ Q,MGWEOF ;Write an EOF + ENDIF. + MOVE A,MTCEFW(W) ;Get EOF count + SOSLE A ;Check for at least two EOF's written + IFSKP. ;No, need one more on tape + AOS MSCMDC(W) ;Again, force MGWEOF to return + AOS MTCEFW(W) ;Incr EOF count + PUSHJ Q,MGWEOF ;Write EOF + ENDIF. + MOVE A,MSRAC(W) ;Get transport software status + TLNE A,%MANWT ;Are we supposed to back up over last EOF? + IFSKP. + AOS MSCMDC(W) ;Yes. Force MGSPRF to return, then... + PUSHJ Q,MGSPRF ; ...do space reverse file command + ENDIF. + MOVSI A,%MANWT ;Note what we've done + IORM A,MSRAC(W) + JRST MGCMDR ;Leave through general exit routine + +;Write one EOF mark on tape +; +MGWEOF: PUSHJ Q,MGGXPT ;Set up transport for IO +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR ; ..lose +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +] + MOVEM W,MGUNIT ;Remember active unit +IFN TM10P,[ + MOVE B,MTCONO(W) ;Get CONO word for this unit + CONO MTC,MWEOF(B) ;Execute Write EOF function +] +IFN TM03S,[ + MOVEI B,%TM1IE\%TMWTM ;Write tape mark, enable interrupts + IOWRI B,%TMCS1 ;Do it +] + PUSHJ Q,MGWTJD ;Wait around till command is complete + IFNSK. + TTNE FS,%TMSES + JRST MGERR + ENDIF. + MOVSI A,%MAMSO + IORM A,MSRAC(W) ;Note tape movement in software status + JRST MGCMDR ;Return through general exit routine + +;Get transport and controller status +; +MGSTAT: PUSHJ Q,MGGXPT + JRST MGCMDR + +;Write some blank space +; +MGW3IN: PUSHJ Q,MGGXPT +IFN TM10P,[ + TXNE J,%T1STH\%T1SRW\%T1SWL ;Hung, rewinding, or write locked... + JRST MGERR +] +IFN TM03S,[ + TTNE FS,%TMSFR ;Formatter ready? + TTNN FS,%TMSOL ;Transport on line + JRST MGERR ;No or no, can't do operation + TTNE FS,%TMSWL ;Transport write locked? + JRST MGERR ;Shouldn't happen, we checked at open. +];IFN TM03S + MOVEM W,MGUNIT ;Note active transport +IFN TM10P,[ +;TM10 can't just write blank space, it has to write blank space followed +; by a data record + IFN TM10B,[ + SETZM MIOWD ;Tell TM10 to write 1-word record + DATAO MTS,[MICWA] + ] + IFN TM10A,[ + MOVE A,[-1,,MGVTC-1] ;1-word record + MOVEM A,MIOWD + PUSHJ Q,MGDCSO + ] + MOVE B,MTCONO(W) + CONO MTC,MW3IN(B) ;Write date record preceeded by 3-in gap +];IFN TM10P +IFN TM03S,[ + MOVEI B,%TM1IE\%TMER3 ;Erase 3 inches command, enable interrupts + IOWRI B,%TMCS1 ;Do it +];IFN TM03S + PUSHJ Q,MGWTJD ;Wait... + JFCL ;Ignore errors (really should check kind) +IFN TM10P,JRST MGSPRR ;Now space record reverse over the bogus record +IFN TM03S,JRST MGCMDR ;TM03 does it right + + +SUBTTL .MTAPE UUO + +;.MTAPE AC, +; AC/ CHNM,,COMMAND +; COMMAND/ COUNT,,FUNCTION + +;Called with J/ AC field from UUO + +AMTAPE: XCTR XR,[HLRZ R,(J)] ;Get IO channel from user + TRNE R,-NIOCHN ;Legal channel? + JRST ILUUO ;Lose + HRRZM R,UUAC(U) ;Cause errors to report on the correct channel + ADDI R,IOCHNM(U) ;Form IOCHNM pointer + HRRZ A,(R) ; A: CLSTB/IOTTB index + CAIL A,MTUAIX ; Min index for tape + CAILE A,MTBOX ; Max + POPJ P, ; Laconic error reportage. + LDB W,[MTXP(R)] ;Get transport number + CAME U,MTUSR(W) ;Same user? + POPJ P, ;No, give up + UMOVE A,(J) ;Get Channel,,Command from user + MOVEM A,MTMTAP(W) ;Save it + HRRZS A ;Get user address of Count,,Function word + PUSHJ P,MTIECK ;Check transport for error states + UMOVE A,(A) ;Get Count,,Function from user + HRRZM A,MTMFNC(W) ;Store function + HLREM A,MTMCNT(W) ; and count + SKIPN MTMCNT(W) ;Count of zero always means one, for + AOS MTMCNT(W) ; compatibility with the old code. + HRRZS A ;Just Function + CAIL A,NMTAPC ;Command in range? + POPJ P, ;No... + AOS (P) ;Command OK, skip return + JRST @MTAPDT(A) ;Go do command + +MTAPDT: MTHANG ;0 Hang till tape motion done + MTRWND ;1 Rewind + MTRWDM ;2 Rewind and dismount + MTWEOR ;3 Write EOR if appropriate + MTW3IN ;4 Write 3 inches of blank tape + MTWEOF ;5 Write EOF + MTSPR ;6 Space records + MTSPF ;7 Space files + MTSPEOT ;10 Space to EOT + MTSTOP ;11 Abort all operations immediately + MTSBKS ;12 Set block size (to COUNT) + MTRBKS ;13 Read block size (to AC) +IFN 0,[ + MTRTSW ;14 Read Transport Information (to AC) + MTRTEW ;15 Read Tape Error Word (to AC) +] +NMTAPC==.-MTAPDT + +;Set block size for write +; +MTSBKS: MOVE A,MTMCNT(W) ;Desired blocksize + CAIL A,4 ;Check reasonableness + CAILE A,2000 + SOSA (P) ;Fail if too big or too small + MOVEM A,MTBLKS(W) ;OK, change write-buffer size + POPJ P, + +;Read current write blocksize +; +MTRBKS: MOVE A,MTBLKS(W) ;Get current write block size + JRST APTUAJ ;Return it + +;Hang until all motion finished +; +MTHANG: SKIPLE MSCMDC(W) ;Check count of queued commands + PUSHJ P,UFLS ;Wait if there are any + JRST MTIECK ;Done, check for errors and return + +;Rewind, Rewind and dismount +; +MTRWND: SKIPA B,[MGRWND] ;Get "REWIND" PI level command +MTRWDM: MOVEI B,MGRWDM ; or "REWIND and DISMOUNT" if appropriate + SKIPE MSCRW(W) ;Writing? + JRST MTSOSP ;Yes, error. Go undo skip rtn and exit + MOVSI A,%MAREW ;Note rewinding in software status + IORM A,MSRAC(W) + JRST MTCMD ;Go queue command for PI level + + +;"Write End of Record" +; This is really the FORCE system call, or should be. +; +MTWEOR: SKIPG MTMDN(W) ;MP level have an active buffer? + POPJ P, ;No, nothing to do + SKIPE MSCRW(W) ;Writing? + JRST MTWBFD ;Yes, go write buffer to tape +MTSOSP: SOS (P) ;Not writing, error. Undo skip return + POPJ P, ;Return + +;Write EOF +; +MTWEOF: SKIPN MSCRW(W) ;Writing? + JRST MTSOSP ;No, can't write EOF. Take error exit + PUSHJ P,MTWEOR ;Flush current buffer, if any + MOVEI B,MGWEOF ;Get PI level EOF routine + AOS MTCEFW(W) ;Increment count of EOF's written + MOVSI TT,%MANWT ;Flag something written on tape + ANDCAM TT,MSRAC(W) + JRST MTCMD ;Queue MGWEOF command for PI level + +;Write blank tape +; +MTW3IN: SKIPN MSCRW(W) ;Error if tape not open for write + JRST MTSOSP + MOVEI B,MGW3IN ;Get PI level command + SETZM MTCEFW(W) ;No EOF's since last record + MOVSI TT,%MANWT + ANDCAM TT,MSRAC(W) ;Note written something to tape + JRST MTCMD ;Go queue command for PI + +;Space records, +=forward, -=back +; +MTSPR: SKIPE MSCRW(W) ;Not allowed if writing + JRST MTSOSP + PUSHJ P,MTFLRA ;Flush read-ahead, find out how far off we are + ADD B,C ;Get records tape is ahead of user (EOF=record) + MOVNS B ;Subtract this from user's request + ADDB B,MTMCNT(W) ;Adjust count + JUMPE B,CPOPJ ;If count is now zero, we are done +MTSPR1: PUSHJ P,MTCNTR ;Update user's copy in case PCLSR + JUMPG B,MTSPFR ;Space forward + MOVEI B,MGSPRR ;Get SPACE REVERSE command + PUSHJ P,MTCMD ;Queue it + AOSGE B,MTMCNT(W) ;Increment count, check if done + JRST MTSPR1 ;More + POPJ P, ;No more + +MTSPFR: MOVEI B,MGSPFR ;Get SPACE FORWARD command + PUSHJ P,MTCMD ;Queue it + SOSLE B,MTMCNT(W) ;Decr count, check if done + JRST MTSPR1 ;More + POPJ P, + +;This routine flushes readahead. Call before doing a spacing operation +; this doesn't actually undo the effect on the drive of the read-ahead. +; It does make sure that read-ahead's effect can't change, then returns +; in B the number of records ahead (non-negative) and in C the number of +; EOF's ahead (0 or 1). If called twice it will return zero the second +; time. Be sure to update your parameters. +; +MTFLRA: PUSHJ P,MTCNTR ;Make sure user space is writable first + MOVSI B,%MASTP + MOVSI T,%MARAC + IORM B,MSRAC(W) ;Tell PI-level read routine to stop reading + TDNE T,MSRAC(W) ;Wait until PI level actually stops + PUSHJ P,UFLS + ANDCAM B,MSRAC(W) ;Turn off %MASTP, things are now quiet + SKIPLE MSCMDC(W) ;Make sure PI level is completely inactive + PUSHJ P,UFLS ;Wait if necessary + MOVE B,MSNBOL(W) ;Get # bufs on read list (='s # records ahead) + LDB C,[.BP (%MAEFA),MSRAC(W)] ;1 if EOF read ahead + MOVSI T,%MAEFA ;Clear read-ahead EOF + ANDCAM T,MSRAC(W) + JRST MTCBFF ;Go flush read-ahead buffers + +;Space files, + = forward, - = back +MTSPF: SKIPE MSCRW(W) ;Not allowed if writing + JRST MTSOSP + PUSHJ P,MTFLRA ;Flush read-ahead + MOVN B,C ;Number of files tape is ahead of user + ADDB B,MTMCNT(W) ;Adjust desired count + JUMPE B,CPOPJ ;If now zero we are done +MTSPF1: PUSHJ P,MTCNTR ;Update user's count in case of PCLSR + JUMPG B,MTSPFF ;Go do forward if needed + MOVEI B,MGSPRF ;Get space reverse file command + PUSHJ P,MTCMD ;Queue it + AOSGE B,MTMCNT(W) ;Done? + JRST MTSPF1 ;Nope + POPJ P, + +MTSPFF: MOVEI B,MGSPFF ;Get space forward file command + PUSHJ P,MTCMD ;Do it + SOSLE B,MTMCNT(W) ;Count down + JRST MTSPF1 ; till done + POPJ P, + +;Update user's FUNCTION,,COUNT word in case he's PCLSR'd +; +MTCNTR: HRRZ A,MTMTAP(W) + MOVE T,MTMFNC(W) + HRL T,MTMCNT(W) + XCTR XW,[MOVEM T,(A)] + POPJ P, + +;Get Controller status words to I,J +; +MTSTAT: SKIPLE MSCMDC(W) ;Wait till commands queued to PI level are done + PUSHJ P,UFLS + MOVEI B,MGSTAT ;GET STATUS command + PUSHJ P,MTCMD ;Give to PI + SKIPLE MSCMDC(W) ;Wait till done + PUSHJ P,UFLS + MOVE I,MGCMTC(W) + MOVE J,MGCMTS(W) + POPJ P, + +;Go to EOT +; +MTSPEOT:MOVEI B,MGSEOT ;Get SPACE-TO-LOGICAL-EOT command + JRST MTCMD ;Queue it. Note read-ahead doesn't matter here + +;Stop whatever we are doing right now +; Very brute-force - throws away all pending commands, read-ahead buffers, etc. +; +MTSTOP: CONO PI,UTCOFF ;We are going to mess with buffer lists + SETZM MSCMDC(W) ;Poof, no more commands + MOVE Q,[-MGQDLL,,MGQD0-1] ;Reset Q PDL pointer to base of stack + MOVE T,MSLCTB + IMUL T,W + ADD Q,T + MOVEM Q,MGQDLP(W) + MOVE Q,[-MSCBL-1,,MSCB0-1] ;Reset command queue input pointer + ADD Q,T + MOVEM Q,MTCMBP(W) + MOVE Q,[4400,,MSCB0-1] ;Reset command queue output pointer + ADD Q,T + MOVEM Q,MGCMBP(W) + SKIPL A,MTMDN(W) ;Buffer active at MP level? + PUSHJ P,IMEMR ;Yes, release it + SETOM MTMDN(W) ;No buffer active at MP level + SETZM MSMPRP(W) ;Zero MP pointer into current buffer + SETZM MSMPRC(W) ;Zero count of available words in buffer + PUSHJ P,MTCBFF ;Flush any buffers queued for PI level + CAME W,MGUNIT ;Is interrupt level waiting for this unit? + JRST UTCONJ ;No, all set + SETOM MGUNIT ;Yes, say no unit waiting for interrupt. + ;(Makes interrupt go away w/out doing anything) +IFN TM10P,[ + CONI MTC,I ;See what drive controller thinks it's using + LDB B,[MUNITF,,I] + CAME W,B ;Same as the drive we're clearing? + JRST UTCONJ ;If not same unit, don't do anything + MOVE B,MTCONO(W) ;Yes, abort operation in progress + CONO MTS,31 ;Stop the tape + CONO MTC,(B) ;Clear interupts +];IFN TM10P +IFN TM03S,[ + IORDI B,%TMTC + ANDI B,7 ;Get selected transport + CAME W,B ;Same? + JRST UTCONJ + PUSHJ P,TMINIC ;Yes, go reinit controller +];IFN TM03S + SKIPGE A,MGCABN(W) ;Any buffers active at PI level? + JRST UTCONJ ;No + PUSHJ P,IMEMR ;Yes, return buffer to system + SETOM MGCABN(W) ;Say no buffer active at PI level + JRST UTCONJ ;Leave + + + + diff --git a/system/rh10.defs26 b/system/rh10.defs26 new file mode 100644 index 0000000..bf4fd4c --- /dev/null +++ b/system/rh10.defs26 @@ -0,0 +1,246 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. +;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. + +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +];IF Not DEFined DEFSYM +.ELSE $$TEMP==0 + + +;DISK PHYSICAL PARAMETERS (RH10 CONTROLLER) + +DEFSYM NCYLS==406. ;# CYLINDERS NORMALLY USED +DEFSYM XCYLS==411.-NCYLS ;# CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==19. ;# TRACKS/CYLINDER +DEFSYM NSECS==20. ;# SECTORS/TRACK +DEFSYM SECBLK==8 ;# SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ;# BLOCKS/CYLINDER +DEFSYM NBLKS==NCYLS*NBLKSC ;# BLOCKS NORMALLY USED +DEFSYM XBLKS==XCYLS*NBLKSC ;# BLOCKS FOR HACKS +DEFSYM TBLKS==NBLKS+XBLKS ;TOTAL BLOCKS + +DEFSYM NTUTBL==2 ;2 BLOCKS PER TUT +DEFSYM DECADE==NBLKSC ;NUMBER OF BLOCKS TO ALLOCATE AT A TIME + ;QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + ;DECADE SIZE = CYLINDER SIZE FOR KLFEDR'S SAKE +DEFSYM DSK=270 ;I/O DEVICE NUMBER OF RH10 + +;CONI - LEFT HALF (ERROR BITS ONLY) + +DEFSYM %HID22==4000,, ;4.3 1=>22-BIT DATA CHANNEL, 0=>18-BIT +DEFSYM %HIILF==400,, ;3.9 ILLEGAL FUNCTION CODE IN CONTROL REGISTER +DEFSYM %HISDE==200,, ;3.8 SELECTED DRIVE PREVIOUS ERROR NOT RESET +DEFSYM %HIDPE==4,, ;3.3 CHANNEL DATA PARITY ERROR +DEFSYM %HICPE==2,, ;3.2 CHANNEL CONTROL WORD PARITY ERROR +DEFSYM %HINXM==1,, ;3.1 CHANNEL NXM ERROR + +;CONI - RIGHT HALF + +DEFSYM %HIBPE==400000 ;2.9 DATA BUSS PARITY ERROR +DEFSYM %HIEXC==200000 ;2.8 "EXCEPTION" IN DRIVE DURING DATA TRANSFER +DEFSYM %HICER==100000 ;2.7 CHANNEL ERROR (OR OF 3 BITS IN LH) +DEFSYM %HICWW==040000 ;2.6 CONTROL WORD HAS BEEN WRITTEN +DEFSYM %HIOVR==020000 ;2.5 OVER-RUN (MEMORY DATA LATE) +DEFSYM %HIDRE==010000 ;2.4 DRIVE RESPONSE ERROR - NO RESPONSE FROM DRIVE +DEFSYM %HIILC==004000 ;2.3 ILLEGAL COMMAND OR REGISTER ACCESS ERROR +DEFSYM %HIPWR==002000 ;2.2 POWER FAIL +DEFSYM %HICOV==000200 ;1.8 CONTROL BUS OVER-RUN +DEFSYM %HIRAE==000100 ;1.7 REGISTER ACCESS ERROR (ONLY IF INTR ENB) +DEFSYM %HIATN==000040 ;1.6 ATTENTION (INTERRUPTS) +DEFSYM %HIBSY==000020 ;1.5 CONTROL BUSY WITH DATA TRANSFER +DEFSYM %HIDON==000010 ;1.4 DATA TRANSFER DONE, NORMAL OR ERROR + ;1.1-1.3 PIA AS USUAL +DEFSYM %HIERR==736300 ;CONI ERROR BITS + +;CONO + + ;2.7-2.9 CLEAR CORRESPONDING ERROR BITS +DEFSYM %HOWCW==040000 ;2.6 WRITE CONTROL WORD + ;2.3-2.5 CLEAR CORRESPONDING ERROR BITS +DEFSYM %HORST==002000 ;2.2 RESET THE CONTROLLER + ;1.8 CLEARS CORRESPONDING ERROR BIT +DEFSYM %HORAE==000100 ;1.7 ENABLE RAE TO INTERRUPT +DEFSYM %HOATN==000040 ;1.6 ENABLE ATTENTION TO INTERRUPT +DEFSYM %HOSTP==000020 ;1.5 STOP DATA TRANSFER, CLR BSY, SET DONE + ;1.4 CLEARS CORRESP BIT (DONE) + ;1.1-1.3 SET PIA +DEFSYM %HOCLR==734210 ;CONO TO CLEAR ALL ERROR BITS + +;CONTROLLER REGISTER NUMBERS (LH OF DATAO) + +DEFSYM %HRLOD==1_13 ;4.3 BIT TO SAY "LOAD SELECTED REGISTER" +DEFSYM %HRCTL==40_14 ;CONTROL REGISTER +DEFSYM $HCDRV==.BP <7,,> ;3.1-3.3 DRIVE SELECT FIELD +DEFSYM $HCICWA==.BP 077700 ;1.7-2.6 INITIAL CONTROL WORD ADDR + ;AS USUAL, 1.7 IS REALLY THE WRITE EVEN PARITY BIT + ;1.1-1.6 FUNCTION CODE (%HMxxx) AND GO BIT +DEFSYM %HRBUF==50_14 ;DATA BUFFER REGISTER (MAINTENANCE) +DEFSYM %HRIAD==44_14 ;INTERRUPT ADDRESS REGISTER + ;3.2 1=>KI-10 MODE, 0=>KA-10 MODE + ;1.1-1.9 9-BIT VECTOR ADDRESS (KI) +DEFSYM %HRRAE==54_14 ;REGISTER ACCESS ERROR REGISTER + ;DATAI 1.1-1.8 RAE DRIVE 0-7 + ;DATAO 1.1-1.8 CLEAR THAT BIT +DEFSYM %HRCBF==74_14 ;CHANNEL BUFFER + +;COMMANDS +; COMMANDS THAT DO I/O ARE PUT IN %HRCTL ALONG WITH $HCICWA +; OTHER COMMANDS ARE STORED INTO %HRDCL +; IN EITHER CASE $HCDRV SAYS WHICH DRIVE + +DEFSYM %HMNOP==0 ;NO OPERATION +DEFSYM %HMUNL==3 ;UNLOAD (DOES PACK FLY OFF?) +DEFSYM %HMREC==7 ;RECALIBRATE +DEFSYM %HMCLR==11 ;DRIVE CLEAR (RESET ERRORS ETC.) +DEFSYM %HMRLS==13 ;DRIVE RELEASE (DUAL PORT) +DEFSYM %HMSRC==31 ;SEARCH (FOR R.P.S.) +DEFSYM %HMWCH==51 ;WRITE CHECK -- DOESN'T WORK (DEC BRAIN DAMAGE) +DEFSYM %HMWCF==53 ;WRITE CHECK FORMAT (HEADER AND DATA) -- DOESN'T WORK +DEFSYM %HMWRT==61 ;WRITE DATA +DEFSYM %HMWHD==63 ;WRITE HEADER AND DATA (FORMAT THE PACK) +DEFSYM %HMRED==71 ;READ DATA +DEFSYM %HMRHD==73 ;READ HEADER AND DATA +DEFSYM %HMSEK==5 ;SEEK TO CYLINDER +DEFSYM %HMOFS==15 ;OFFSET HEADS SLIGHTLY +DEFSYM %HMCEN==17 ;RETURN HEADS TO CENTERLINE +DEFSYM %HMACK==23 ;ACKNOWLEDGE MOUNTING OF PACK (REQUIRED BEFORE I/O) +DEFSYM %HMRDP==21 ;"READ-IN PRESET" + +;STANDARD FIELDS IN DRIVE REGISTERS + + ;3.1-3.3 DRIVE NUMBER ($HCDRV) +DEFSYM %HDCBT==002000 ;4.2 CONTROL BUS TIMEOUT +DEFSYM %HDPAR==001000 ;4.1 MASS BUS CONTROL PARITY ERROR +DEFSYM %HDDLT==000400 ;3.9 DATA LATE (NEED 3 US BETWEEN DATAO AND DATAI) +DEFSYM %HDILC==000200 ;3.8 ILLEGAL COMMAND +DEFSYM %HDERR==003600 ;ALL BITS FOR ERRORS IN TALKING TO DRIVE + ;DRIVE-DEPENDENT DATA IS IN LOW 16 BITS (1.1-2.7) + +;DRIVE REGISTERS (NUMBER IN LH OF DATAO) + +DEFSYM %HRDCL==0_14 ;DRIVE CONTROL REGISTER + ;1.1-1.6 COMMAND (%HMxxx) 1.1=GO BIT +DEFSYM %HCDVA==1_11. ;2.3 DRIVE AVAILABLE + +DEFSYM %HRSTS==1_14 ;STATUS REGISTER + ;1.1-1.6 BITS ON DURING HEAD LOAD SEQUENCE +DEFSYM %HSVV==100 ;1.7 VOLUME VALID. SET BY %HMACK, CLEARED BY + ; DRIVE TURN ON. 0 => PACK MAY HAVE BEEN CHANGED +DEFSYM %HSRDY==200 ;1.8 DRIVE READY +DEFSYM %HSDPR==400 ;1.9 "DRIVE PRESET" = CONNECTED TO THIS CONTROLLER +DEFSYM %HSPGM==1000 ;2.1 "PROGRAMMABLE" = EITHER CTRLR CAN CONNECT +DEFSYM %HSLST==2000 ;2.2 LAST SECTOR TRANSFERRED +DEFSYM %HSWRL==4000 ;2.3 WRITE LOCK +DEFSYM %HSMOL==10000 ;2.4 MEDIUM ON-LINE +DEFSYM %HSPIP==20000 ;2.5 POSITIONING IN PROGRESS +DEFSYM %HSERR==40000 ;2.6 BIT ON %HRER1, %HRER2, OR %HRER3 +DEFSYM %HSATN==100000 ;2.7 ATTENTION - ERROR, POSITIONING COMPLETE, + ; STARTUP COMPLETE, OR DRIVE AVAILABLE + +DEFSYM %HRER1==2_14 ;ERROR REGISTER 1 + ;GENERALLY THESE BITS ARE ONLY RESET BY %HMCLR + ;1.1 ILLEGAL COMMAND IN %HRDCL + ;1.2 ATTEMPT TO ACCESS NON-EXISTENT DRIVE REGISTER + ;1.3 ATTEMPT TO WRITE IN DRIVE REGISTER WHILE DRIVE BUSY + ;1.4 PARITY ERROR ON MASSBUS + ;1.5 FORMAT ERROR (PACK & CPU NOT BOTH 16- OR BOTH 18-BIT) + ;1.6 WRITE CLOCK FAIL +DEFSYM %H1ECH==100 ;1.7 ECC HARD ERROR (NOT 11-BIT BURST) + ;1.8 HEADER COMPARE ERROR + ;1.9 HEADER CRC ERROR + ;2.1 ADDRESS OVERFLOW + ;2.2 INVALID ADDRESS +DEFSYM %H1WLK==4000 ;2.3 ATTEMPT TO WRITE WHILE WRITE-LOCKED + ;2.4 DRIVE TIMING ERROR. MAY DE-FORMAT THE TRACK. + ;2.5 OPERATION NOT COMPLETE (3 REVS NO ACTION) + ;2.6 DRIVE UNSAFE - WRITE LOCK OR FIELD SERVICE +DEFSYM %H1ECC==100000 ;2.7 DATA CHECK, ECC COMPUTATION INITIATED +DEFSYM %H1SOF==110730 ;SOFT ERRORS + +DEFSYM %HRMNT==3_14 ;MAINTENANCE REGISTER (SEE RP04 MAINT MANUAL) + +DEFSYM %HRATN==4_14 ;ATTENTION SUMMARY REGISTER (NOT REALLY PER-DRIVE) + ;1.1-1.8 %HSATN DRIVES 0-7 + ;CLEARED BY ACCESSING DRIVE OR WRITING A 1 + +DEFSYM %HRADR==5_14 ;DESIRED SECTOR/TRACK ADDRESS +DEFSYM $HATRK==.BP 17400 ;TRACK 0-22 OCTAL +DEFSYM $HASEC==.BP 37 ;SECTOR 0-23 OCTAL (128 WORDS EACH) + ;NOTE THESE FIELDS ARE 8-BITS EACH + +DEFSYM %HRLAH==7_14 ;LOOK AHEAD (READ ONLY) + ;NUMBER OF 64'THS OF A SECTOR + +DEFSYM %HRTYP==6_14 ;DRIVE TYPE (RO) + ;1.1-1.9 DRIVE TYPE NUMBER (20 FOR "RP04") + ;2.3 DUAL-PORT DRIVE + ;2.5 MOVING HEAD + ;2.6 TAPE + ;2.7 NOT BLOCK ADDRESSED + +DEFSYM %HRSER==10_14 ;DRIVE SERIAL NUMBER (RO) + +DEFSYM %HROFS==11_14 ;HEAD OFFSET + ;1.1-1.8 OFFSET CODE + ;1.9-2.7 MISC CRUFTIES + +DEFSYM %HRCYL==12_14 ;DESIRED CYLINDER ADDRESS + ; 0 TO 410 DECIMAL + +DEFSYM %HRCCY==13_14 ;CURRENT CYLINDER ADDRESS + +DEFSYM %HRER2==14_14 ;ERROR REGISTER 2 + ;MISC UNSAFE CONDITIONS IN DRIVE + +DEFSYM %HRER3==15_14 ;ERROR REGISTER 3 + ;1.1-1.7 MORE MISC UNSAFES IN DRIVE +DEFSYM %H3SKI==40000 ;2.6 SEEK INCOMPLETE +DEFSYM %H3OFC==100000 ;2.7 OFF CYLINDER + +DEFSYM %HRPOS==16_14 ;ECC POSITION + ;LOCATION OF ERROR BURST WITHIN SECTOR + +DEFSYM %HRPAT==17_14 ;ECC PATTERN + ;11-BIT ERROR BURST + +;DF10-C CHANNEL DEFINITIONS (22-BIT- (KI-) MODE) + +DEFSYM $DFCAD==002600,, ;CURRENT ADDRESS - 1 (IN CONTROL WORD) +DEFSYM $DFWC==261600,, ;- WORD COUNT (IN CONTROL WORD) +DEFSYM $DFLAD==002600,, ;LAST DATA ADDRESS (IN STORED CONTROL WD) +DEFSYM $DFCWA==261600,, ;LAST CONTROL WORD ADDRESS (IN STORED CONTROL WORD) + + + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rh11.defs36 b/system/rh11.defs36 new file mode 100644 index 0000000..c171307 --- /dev/null +++ b/system/rh11.defs36 @@ -0,0 +1,193 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +;;; Disk RH11 Interrupt vector: +DEFSYM PHVEC==254 ; Interrupts occur on level 6 + ; (high priority) on UBA #1. + +;;; Disk RH11 Unibus register addresses: + +DEFSYM %HRCS1=:776700 ;CTRL AND STATUS 1. + DEFSYM %HXSC== 1_15. ; Special Condition + DEFSYM %HXTRE==1_14. ; Transfer Error + DEFSYM %HXMCP==1_13. ; Mass I/O Control Bus Parity Error + DEFSYM %HXDVA==1_11. ; Drive Available + DEFSYM %HXPSE==1_10. ; Port Select + DEFSYM %HXA17==1_9. ; UB Address Extension Bit 17 + DEFSYM %HXA16==1_8. ; UB Address Extension Bit 16 + DEFSYM %HXRDY==1_7. ; Ready + DEFSYM %HXIE== 1_6. ; Interrupt Enable + DEFSYM $HXCMD==.BP 77 ; Bits 1-5 specify commands. + DEFSYM %HXGO== 1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %HMNOP==0 ; No Operation +DEFSYM %HMUNL==3 ; Unload ("Standby" -- the pack doesn't fly off). +DEFSYM %HMREC==7 ; Recalibrate +DEFSYM %HMCLR==11 ; Drive clear (reset errors etc.) +DEFSYM %HMRLS==13 ; Drive release (dual port) +DEFSYM %HMSRC==31 ; Search (for r.p.s.) +DEFSYM %HMWCH==51 ; Write Check (?doesn't work) +DEFSYM %HMWCF==53 ; Write Check Format, Header and Data (?doesn't work) +DEFSYM %HMWRT==61 ; Write Data +DEFSYM %HMWHD==63 ; Write Header And Data (format the pack) +DEFSYM %HMRED==71 ; Read Data +DEFSYM %HMRHD==73 ; Read Header and Data +DEFSYM %HMSEK==5 ; Seek to Cylinder +DEFSYM %HMOFS==15 ; Offset Heads Slightly +DEFSYM %HMCEN==17 ; Return Heads To Centerline +DEFSYM %HMACK==23 ; Acknowledge mounting of pack (required before I/O) +DEFSYM %HMRDP==21 ; Read-In Preset + +DEFSYM %HRWC=:776702 ;WORD COUNT. + +DEFSYM %HRBA=:776704 ;UNIBUS ADDRESS. + +DEFSYM %HRADR=:776706 ;DESIRED ADDRESS. +; DEFSYM $HATRK==.BP 7700 ; Bits 12-8 are track. +; DEFSYM $HASEC==.BP 0077 ; Bits 5-0 are sector. + DEFSYM $HATRK==.BP 17400 ; Track 0-22 + DEFSYM $HASEC==.BP 37 ; Sector 0-23 (128 words each) + +DEFSYM %HRCS2=:776710 ;CTRL AND STATUS 2. + DEFSYM %HYDLT==1_15. ; Data Late + DEFSYM %HYWCE==1_14. ; Write Check Error + DEFSYM %HYPE== 1_13. ; Parity Error + DEFSYM %HYNED==1_12. ; Non-existant Drive + DEFSYM %HYNEM==1_11. ; %HRBA is NXM during DMA + DEFSYM %HYPGE==1_10. ; Program Error + DEFSYM %HYMXF==1_9. ; Missed Transfer + DEFSYM %HYMDP==1_8. ; Mass Data Bus Parity Error + DEFSYM %HYOR== 1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %HYIR== 1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %HYCLR==1_5. ; Controller Clear + DEFSYM %HYPAT==1_4. ; Parity Test + DEFSYM %HYBAI==1_3. ; Unibus Address Increment Inhibit + DEFSYM $HYDSK==.BP 7 ; Bits 2-0 are the Unit Select. + +DEFSYM %HRSTS=:776712 ;DRIVE STATUS. + DEFSYM %HSATN==1_15. ; Attention Active + DEFSYM %HSERR==1_14. ; Error + DEFSYM %HSPIP==1_13. ; Positioning In Progress + DEFSYM %HSMOL==1_12. ; Medium On-Line + DEFSYM %HSWRL==1_11. ; Write Locked + DEFSYM %HSLST==1_10. ; Last Sector Transferred + DEFSYM %HSPGM==1_9. ; Programmable + DEFSYM %HSDPR==1_8. ; Drive Present + DEFSYM %HSRDY==1_7. ; Drive Ready + DEFSYM %HSVV== 1_6. ; Volume Valid +; These are RP04-only bits in %HRSTS +; DEFSYM %HSDE1==1_5. ; Difference Equals 1 +; DEFSYM %HSL64==1_4. ; Difference Less Than 64 +; DEFSYM %HSGRV==1_3. ; Go Reverse +; DEFSYM %HSDIG==1_2. ; Drive To Inner Guard Band +; DEFSYM %HSF20==1_1. ; Drive Forward 20in/sec +; DEFSYM %HSF5== 1_0. ; Drive Forward 5in/sec + +DEFSYM %HRER1=:776714 ;ERROR 1. + DEFSYM %H1ECC==1_15. ; Data Check + DEFSYM %H1UNS==1_14. ; Unsafe + DEFSYM %H1OPI==1_13. ; Operation Incomplete + DEFSYM %H1DTE==1_12. ; Drive Timing Error + DEFSYM %H1WLK==1_11. ; Write Lock Error + DEFSYM %H1IAE==1_10. ; Invalid Address Error + DEFSYM %H1AOE==1_9. ; Address Overflow Error + DEFSYM %H1CRC==1_8. ; Header CRC Error + DEFSYM %H1HCE==1_7. ; Header Compare Error + DEFSYM %H1ECH==1_6. ; ECC Hard Error + DEFSYM %H1WCF==1_5. ; Write Lock Fail + DEFSYM %H1FER==1_4. ; Format Error + DEFSYM %H1PAR==1_3. ; Parity Error + DEFSYM %H1RMR==1_2. ; Register Modification Refused + DEFSYM %H1ILR==1_1. ; Illegal Register + DEFSYM %H1ILF==1_0. ; Illegal Function + +DEFSYM %HRATN=:776716 ;ATTENTION SUMMARY. + ; Each bit 7-0 corresponds to a drive asserting ATA. + +DEFSYM %HRLAH=:776720 ;LOOK AHEAD. + ; 2.2 - 1.7 Sector Count. + ; 1.6 - 1.5 Encoded Extension Field. + +DEFSYM %HRBUF=:776722 ;DATA BUFFER. + +DEFSYM %HRMNT=:776724 ;MAINTENANCE. + +DEFSYM %HRTYP=:776726 ;DRIVE TYPE. + ; 2.7 NOT BLOCK ADDRESSED + ; 2.6 TAPE + ; 2.5 Moving Head (better be a 1!!) + ; 2.3 Drive Request Required + ; 1.9 - 1.1 Drive Type Number: + ; RP04 = 20, RP05 = 21, + ; RP06 = 22, RM03 = 24 + +DEFSYM %HRSER=:776730 ;SERIAL NUMBER. + +DEFSYM %HROFS=:776732 ;OFFSET. + ; 2.7 Sign Change + ; 2.4 Format Bit (1=16, 0=18) + ; 2.3 ECC Inhibit + ; 2.2 Header Compare Inhibit + ; 1.8 - 1.1 Offset Info + ; +400 u" 00010000 + ; -400 u" 10010000 + ; +800 u" 00100000 + ; -800 u" 10100000 + ; +1200 u" 00110000 + ; -1200 u" 10110000 + ; Centerline 00000000 + +DEFSYM %HRCYL=:776734 ;DESIRED CYLINDER. + +DEFSYM %HRCCY=:776736 ;CURRENT CYLINDER. + +DEFSYM %HRER2=:776740 ;ERROR 2. + DEFSYM %H2NHS==1_10. ; No Head Selection + DEFSYM %H2WRU==1_8. ; Write Ready Unsafe + +DEFSYM %HRER3=:776742 ;ERROR 3. + DEFSYM %H3OFC==1_15. ; Off Cylinder + DEFSYM %H3SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H3DCL==1_6. ; DC power low (or perhaps AC?) + DEFSYM %H3ACL==1_5. ; AC power low (or perhaps DC?) + ; (the documentation is confused about + ; which is which.) + +DEFSYM %HRPOS=:776744 ;ECC POSITION. + +DEFSYM %HRPAT=:776746 ;ECC PATTERN. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rh11.defs37 b/system/rh11.defs37 new file mode 100644 index 0000000..2bb8cbe --- /dev/null +++ b/system/rh11.defs37 @@ -0,0 +1,194 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +;;; Disk RH11 Interrupt vector: +DEFSYM PHVEC==254 ; Interrupts occur on level 6 + ; (high priority) on UBA #1. + +;;; Disk RH11 Unibus register addresses: + +DEFSYM %HRCS1=:776700 ;CTRL AND STATUS 1. + DEFSYM %HXSC== 1_15. ; Special Condition + DEFSYM %HXTRE==1_14. ; Transfer Error + DEFSYM %HXMCP==1_13. ; Mass I/O Control Bus Parity Error + DEFSYM %HXDVA==1_11. ; Drive Available + DEFSYM %HXPSE==1_10. ; Port Select + DEFSYM %HXA17==1_9. ; UB Address Extension Bit 17 + DEFSYM %HXA16==1_8. ; UB Address Extension Bit 16 + DEFSYM %HXRDY==1_7. ; Ready + DEFSYM %HXIE== 1_6. ; Interrupt Enable + DEFSYM $HXCMD==.BP 77 ; Bits 1-5 specify commands. + DEFSYM %HXGO== 1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %HMNOP==0 ; No Operation +DEFSYM %HMUNL==3 ; Unload ("Standby" -- the pack doesn't fly off). +DEFSYM %HMREC==7 ; Recalibrate +DEFSYM %HMCLR==11 ; Drive clear (reset errors etc.) +DEFSYM %HMRLS==13 ; Drive release (dual port) +DEFSYM %HMSRC==31 ; Search (for r.p.s.) +DEFSYM %HMWCH==51 ; Write Check (?doesn't work) +DEFSYM %HMWCF==53 ; Write Check Format, Header and Data (?doesn't work) +DEFSYM %HMWRT==61 ; Write Data +DEFSYM %HMWHD==63 ; Write Header And Data (format the pack) +DEFSYM %HMRED==71 ; Read Data +DEFSYM %HMRHD==73 ; Read Header and Data +DEFSYM %HMSEK==5 ; Seek to Cylinder +DEFSYM %HMOFS==15 ; Offset Heads Slightly +DEFSYM %HMCEN==17 ; Return Heads To Centerline +DEFSYM %HMACK==23 ; Acknowledge mounting of pack (required before I/O) +DEFSYM %HMRDP==21 ; Read-In Preset + +DEFSYM %HRWC=:776702 ;WORD COUNT. + +DEFSYM %HRBA=:776704 ;UNIBUS ADDRESS. + +DEFSYM %HRADR=:776706 ;DESIRED ADDRESS. +; DEFSYM $HATRK==.BP 7700 ; Bits 12-8 are track. +; DEFSYM $HASEC==.BP 0077 ; Bits 5-0 are sector. + DEFSYM $HATRK==.BP 17400 ; Track 0-22 + DEFSYM $HASEC==.BP 37 ; Sector 0-23 (128 words each) + +DEFSYM %HRCS2=:776710 ;CTRL AND STATUS 2. + DEFSYM %HYDLT==1_15. ; Data Late + DEFSYM %HYWCE==1_14. ; Write Check Error + DEFSYM %HYPE== 1_13. ; Parity Error + DEFSYM %HYNED==1_12. ; Non-existant Drive + DEFSYM %HYNEM==1_11. ; %HRBA is NXM during DMA + DEFSYM %HYPGE==1_10. ; Program Error + DEFSYM %HYMXF==1_9. ; Missed Transfer + DEFSYM %HYMDP==1_8. ; Mass Data Bus Parity Error + DEFSYM %HYOR== 1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %HYIR== 1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %HYCLR==1_5. ; Controller Clear + DEFSYM %HYPAT==1_4. ; Parity Test + DEFSYM %HYBAI==1_3. ; Unibus Address Increment Inhibit + DEFSYM $HYDSK==.BP 7 ; Bits 2-0 are the Unit Select. + +DEFSYM %HRSTS=:776712 ;DRIVE STATUS. + DEFSYM %HSATN==1_15. ; Attention Active + DEFSYM %HSERR==1_14. ; Error + DEFSYM %HSPIP==1_13. ; Positioning In Progress + DEFSYM %HSMOL==1_12. ; Medium On-Line + DEFSYM %HSWRL==1_11. ; Write Locked + DEFSYM %HSLST==1_10. ; Last Sector Transferred + DEFSYM %HSPGM==1_9. ; Programmable + DEFSYM %HSDPR==1_8. ; Drive Present + DEFSYM %HSRDY==1_7. ; Drive Ready + DEFSYM %HSVV== 1_6. ; Volume Valid +; These are RP04-only bits in %HRSTS +; DEFSYM %HSDE1==1_5. ; Difference Equals 1 +; DEFSYM %HSL64==1_4. ; Difference Less Than 64 +; DEFSYM %HSGRV==1_3. ; Go Reverse +; DEFSYM %HSDIG==1_2. ; Drive To Inner Guard Band +; DEFSYM %HSF20==1_1. ; Drive Forward 20in/sec +; DEFSYM %HSF5== 1_0. ; Drive Forward 5in/sec + +DEFSYM %HRER1=:776714 ;ERROR 1. + DEFSYM %H1ECC==1_15. ; Data Check + DEFSYM %H1UNS==1_14. ; Unsafe + DEFSYM %H1OPI==1_13. ; Operation Incomplete + DEFSYM %H1DTE==1_12. ; Drive Timing Error + DEFSYM %H1WLK==1_11. ; Write Lock Error + DEFSYM %H1IAE==1_10. ; Invalid Address Error + DEFSYM %H1AOE==1_9. ; Address Overflow Error + DEFSYM %H1CRC==1_8. ; Header CRC Error + DEFSYM %H1HCE==1_7. ; Header Compare Error + DEFSYM %H1ECH==1_6. ; ECC Hard Error + DEFSYM %H1WCF==1_5. ; Write Lock Fail + DEFSYM %H1FER==1_4. ; Format Error + DEFSYM %H1PAR==1_3. ; Parity Error + DEFSYM %H1RMR==1_2. ; Register Modification Refused + DEFSYM %H1ILR==1_1. ; Illegal Register + DEFSYM %H1ILF==1_0. ; Illegal Function + +DEFSYM %HRATN=:776716 ;ATTENTION SUMMARY. + ; Each bit 7-0 corresponds to a drive asserting ATA. + +DEFSYM %HRLAH=:776720 ;LOOK AHEAD. + ; 2.2 - 1.7 Sector Count. + ; 1.6 - 1.5 Encoded Extension Field. + +DEFSYM %HRBUF=:776722 ;DATA BUFFER. + +DEFSYM %HRMNT=:776724 ;MAINTENANCE. + +DEFSYM %HRTYP=:776726 ;DRIVE TYPE. + ; 2.7 NOT BLOCK ADDRESSED + ; 2.6 TAPE + ; 2.5 Moving Head (better be a 1!!) + ; 2.3 Drive Request Required + ; 1.9 - 1.1 Drive Type Number: + ; RP04 = 20, RP05 = 21, + ; RP06 = 22, RM03 = 24, + ; RM80 = 26 + +DEFSYM %HRSER=:776730 ;SERIAL NUMBER. + +DEFSYM %HROFS=:776732 ;OFFSET. + ; 2.7 Sign Change + ; 2.4 Format Bit (1=16, 0=18) + ; 2.3 ECC Inhibit + ; 2.2 Header Compare Inhibit + ; 1.8 - 1.1 Offset Info + ; +400 u" 00010000 + ; -400 u" 10010000 + ; +800 u" 00100000 + ; -800 u" 10100000 + ; +1200 u" 00110000 + ; -1200 u" 10110000 + ; Centerline 00000000 + +DEFSYM %HRCYL=:776734 ;DESIRED CYLINDER. + +DEFSYM %HRCCY=:776736 ;CURRENT CYLINDER. + +DEFSYM %HRER2=:776740 ;ERROR 2. + DEFSYM %H2NHS==1_10. ; No Head Selection + DEFSYM %H2WRU==1_8. ; Write Ready Unsafe + +DEFSYM %HRER3=:776742 ;ERROR 3. + DEFSYM %H3OFC==1_15. ; Off Cylinder + DEFSYM %H3SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H3DCL==1_6. ; DC power low (or perhaps AC?) + DEFSYM %H3ACL==1_5. ; AC power low (or perhaps DC?) + ; (the documentation is confused about + ; which is which.) + +DEFSYM %HRPOS=:776744 ;ECC POSITION. + +DEFSYM %HRPAT=:776746 ;ECC PATTERN. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rh11.defs38 b/system/rh11.defs38 new file mode 100644 index 0000000..3a648a8 --- /dev/null +++ b/system/rh11.defs38 @@ -0,0 +1,236 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; For now, must have a disk type defined to get the correct register +; definitions. + +IFNDEF RP06P,RP06P==0 +IFNDEF RM03P,RM03P==0 +IFNDEF RM80P,RM80P==0 + +IFE RP06P+RM03P+RM80P,.FATAL No disk type specified in RH11 DEFS +IFN RP06P,IFN RM03P+RM80P,.FATAL RP/RM Register conflict in RH11 DEFS + + +;;; Disk RH11 Interrupt vector: +DEFSYM PHVEC==254 ; Interrupts occur on level 6 + ; (high priority) on UBA #1. + +;;; Disk RH11 Unibus register addresses: + +DEFSYM %HRCS1=:776700 ;CTRL AND STATUS 1. + DEFSYM %HXSC== 1_15. ; Special Condition + DEFSYM %HXTRE==1_14. ; Transfer Error + DEFSYM %HXMCP==1_13. ; Mass I/O Control Bus Parity Error + DEFSYM %HXDVA==1_11. ; Drive Available + DEFSYM %HXPSE==1_10. ; Port Select + DEFSYM %HXA17==1_9. ; UB Address Extension Bit 17 + DEFSYM %HXA16==1_8. ; UB Address Extension Bit 16 + DEFSYM %HXRDY==1_7. ; Ready + DEFSYM %HXIE== 1_6. ; Interrupt Enable + DEFSYM $HXCMD==.BP 77 ; Bits 1-5 specify commands. + DEFSYM %HXGO== 1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %HMNOP==0 ; No Operation +DEFSYM %HMUNL==3 ; Unload ("Standby" -- the pack doesn't fly off). +DEFSYM %HMREC==7 ; Recalibrate +DEFSYM %HMCLR==11 ; Drive clear (reset errors etc.) +DEFSYM %HMRLS==13 ; Drive release (dual port) +DEFSYM %HMSRC==31 ; Search (for r.p.s.) +DEFSYM %HMWCH==51 ; Write Check (?doesn't work) +DEFSYM %HMWCF==53 ; Write Check Format, Header and Data (?doesn't work) +DEFSYM %HMWRT==61 ; Write Data +DEFSYM %HMWHD==63 ; Write Header And Data (format the pack) +DEFSYM %HMRED==71 ; Read Data +DEFSYM %HMRHD==73 ; Read Header and Data +DEFSYM %HMSEK==5 ; Seek to Cylinder +DEFSYM %HMOFS==15 ; Offset Heads Slightly +DEFSYM %HMCEN==17 ; Return Heads To Centerline +DEFSYM %HMACK==23 ; Acknowledge mounting of pack (required before I/O) +DEFSYM %HMRDP==21 ; Read-In Preset + +DEFSYM %HRWC=:776702 ;WORD COUNT. + +DEFSYM %HRBA=:776704 ;UNIBUS ADDRESS. + +DEFSYM %HRADR=:776706 ;DESIRED ADDRESS. +; DEFSYM $HATRK==.BP 7700 ; Bits 12-8 are track. +; DEFSYM $HASEC==.BP 0077 ; Bits 5-0 are sector. + DEFSYM $HATRK==.BP 17400 ; Track 0-22 + DEFSYM $HASEC==.BP 37 ; Sector 0-23 (128 words each) + +DEFSYM %HRCS2=:776710 ;CTRL AND STATUS 2. + DEFSYM %HYDLT==1_15. ; Data Late + DEFSYM %HYWCE==1_14. ; Write Check Error + DEFSYM %HYPE== 1_13. ; Parity Error + DEFSYM %HYNED==1_12. ; Non-existant Drive + DEFSYM %HYNEM==1_11. ; %HRBA is NXM during DMA + DEFSYM %HYPGE==1_10. ; Program Error + DEFSYM %HYMXF==1_9. ; Missed Transfer + DEFSYM %HYMDP==1_8. ; Mass Data Bus Parity Error + DEFSYM %HYOR== 1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %HYIR== 1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %HYCLR==1_5. ; Controller Clear + DEFSYM %HYPAT==1_4. ; Parity Test + DEFSYM %HYBAI==1_3. ; Unibus Address Increment Inhibit + DEFSYM $HYDSK==.BP 7 ; Bits 2-0 are the Unit Select. + +DEFSYM %HRSTS=:776712 ;DRIVE STATUS. + DEFSYM %HSATN==1_15. ; Attention Active + DEFSYM %HSERR==1_14. ; Error + DEFSYM %HSPIP==1_13. ; Positioning In Progress + DEFSYM %HSMOL==1_12. ; Medium On-Line + DEFSYM %HSWRL==1_11. ; Write Locked + DEFSYM %HSLST==1_10. ; Last Sector Transferred + DEFSYM %HSPGM==1_9. ; Programmable + DEFSYM %HSDPR==1_8. ; Drive Present + DEFSYM %HSRDY==1_7. ; Drive Ready + DEFSYM %HSVV== 1_6. ; Volume Valid +; These are RP04-only bits in %HRSTS +; DEFSYM %HSDE1==1_5. ; Difference Equals 1 +; DEFSYM %HSL64==1_4. ; Difference Less Than 64 +; DEFSYM %HSGRV==1_3. ; Go Reverse +; DEFSYM %HSDIG==1_2. ; Drive To Inner Guard Band +; DEFSYM %HSF20==1_1. ; Drive Forward 20in/sec +; DEFSYM %HSF5== 1_0. ; Drive Forward 5in/sec + +DEFSYM %HRER1=:776714 ;ERROR 1. + DEFSYM %H1ECC==1_15. ; Data Check + DEFSYM %H1UNS==1_14. ; Unsafe + DEFSYM %H1OPI==1_13. ; Operation Incomplete + DEFSYM %H1DTE==1_12. ; Drive Timing Error + DEFSYM %H1WLK==1_11. ; Write Lock Error + DEFSYM %H1IAE==1_10. ; Invalid Address Error + DEFSYM %H1AOE==1_9. ; Address Overflow Error + DEFSYM %H1CRC==1_8. ; Header CRC Error + DEFSYM %H1HCE==1_7. ; Header Compare Error + DEFSYM %H1ECH==1_6. ; ECC Hard Error + DEFSYM %H1WCF==1_5. ; Write Lock Fail + DEFSYM %H1FER==1_4. ; Format Error + DEFSYM %H1PAR==1_3. ; Parity Error + DEFSYM %H1RMR==1_2. ; Register Modification Refused + DEFSYM %H1ILR==1_1. ; Illegal Register + DEFSYM %H1ILF==1_0. ; Illegal Function + +DEFSYM %HRATN=:776716 ;ATTENTION SUMMARY. + ; Each bit 7-0 corresponds to a drive asserting ATA. + +DEFSYM %HRLAH=:776720 ;LOOK AHEAD. + ; 2.2 - 1.7 Sector Count. + ; 1.6 - 1.5 Encoded Extension Field. + +DEFSYM %HRBUF=:776722 ;DATA BUFFER. + +DEFSYM %HRMNT=:776724 ;MAINTENANCE. + +DEFSYM %HRTYP=:776726 ;DRIVE TYPE. + ; 2.7 NOT BLOCK ADDRESSED + ; 2.6 TAPE + ; 2.5 Moving Head (better be a 1!!) + ; 2.3 Drive Request Required + ; 1.9 - 1.1 Drive Type Number: + ; RP04 = 20, RP05 = 21, + ; RP06 = 22, RM03 = 24, + ; RM80 = 26 + +DEFSYM %HRSER=:776730 ;SERIAL NUMBER. + +DEFSYM %HROFS=:776732 ;OFFSET. + ; 2.9-2.8 Unused + ; 2.7 Sign Change (RP06 only) + ; 2.4 Format Bit (1=16, 0=18) + ; 2.3 ECC Inhibit + ; 2.2 Header Compare Inhibit + ; 2.1 Skip Sector Inhibit (RM 16bit only) + ; 1.9 Unused + ; + ; RP06 Offsets + ; 1.8 - 1.1 Offset Info + ; +400 u" 00010000 + ; -400 u" 10010000 + ; +800 u" 00100000 + ; -800 u" 10100000 + ; +1200 u" 00110000 + ; -1200 u" 10110000 + ; Centerline 00000000 + + ; RMxx Offsets + ; 1.1-1.7 Unused + ; 1.8 Offset Direction + ; 0 - Away from spindle + ; 1 - Towards spindle + +DEFSYM %HRCYL=:776734 ;DESIRED CYLINDER. + +IFN RP06P,[ + +DEFSYM %HRCCY=:776736 ;CURRENT CYLINDER. + +DEFSYM %HRER2=:776740 ;ERROR 2. + DEFSYM %H2NHS==1_10. ; No Head Selection + DEFSYM %H2WRU==1_8. ; Write Ready Unsafe + +DEFSYM %HRER3=:776742 ;ERROR 3. + DEFSYM %H3OFC==1_15. ; Off Cylinder + DEFSYM %H3SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H3DCL==1_6. ; DC power low (or perhaps AC?) + DEFSYM %H3ACL==1_5. ; AC power low (or perhaps DC?) + ; (the documentation is confused about + ; which is which.) +] + +IFN RM03P+RM80P,[ +; RM has no Current Cylinder Register, the Error 2 Register is +; in a different place with different bits, and there is no +; Error 3 register + +DEFSYM %HRER2=:776742 ;ERROR 2. + DEFSYM %H2BSE==1_15. ; Bad Sector (sector marked bad on disk) + DEFSYM %H2SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H2OPE==1_13. ; Drive address plug was removed + DEFSYM %H2IVC==1_12. ; Invalid Command (really drive not valid) + DEFSYM %H2LSC==1_11. ; LSC Sucks + DEFSYM %H2LBC==1_10. ; Loss of Bitcheck (hardware lossage) + DEFSYM %H2DVC==1_7 ; Device Check (generic hardware lossage) + DEFSYM %H2SSE==1_5 ; Skip Sector found (can't happen in 18bit) + DEFSYM %H2DPE==1_3 ; Data Parity Error in controller +] + +DEFSYM %HRPOS=:776744 ;ECC POSITION. + +DEFSYM %HRPAT=:776746 ;ECC PATTERN. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rh11.defs48 b/system/rh11.defs48 new file mode 100644 index 0000000..b0f0a5e --- /dev/null +++ b/system/rh11.defs48 @@ -0,0 +1,305 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; For now, must have a disk type defined to get the correct register +; definitions. + +IFNDEF RP06P,RP06P==0 +IFNDEF RP07P,RP07P==0 +IFNDEF RM03P,RM03P==0 +IFNDEF RM80P,RM80P==0 + +IFN RP06P+RP07P+RM03P+RM80P-1,.FATAL Only one disk type allowed in RH11 DEFS + + +;;; Disk RH11 Interrupt vector: +DEFSYM PHVEC==254 ; Interrupts occur on level 6 + ; (high priority) on UBA #1. + +;;; Disk RH11 Unibus register addresses: + +DEFSYM %HRCS1=:776700 ;CTRL AND STATUS 1. + DEFSYM %HXSC== 1_15. ; Special Condition + DEFSYM %HXTRE==1_14. ; Transfer Error + DEFSYM %HXMCP==1_13. ; Mass I/O Control Bus Parity Error + DEFSYM %HXDVA==1_11. ; Drive Available + DEFSYM %HXPSE==1_10. ; Port Select + DEFSYM %HXA17==1_9. ; UB Address Extension Bit 17 + DEFSYM %HXA16==1_8. ; UB Address Extension Bit 16 + DEFSYM %HXRDY==1_7. ; Ready + DEFSYM %HXIE== 1_6. ; Interrupt Enable + DEFSYM $HXCMD==.BP 77 ; Bits 1-5 specify commands. + DEFSYM %HXGO== 1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %HMNOP==0 ; No Operation +DEFSYM %HMUNL==3 ; Unload ("Standby" -- the pack doesn't fly off). +DEFSYM %HMREC==7 ; Recalibrate +DEFSYM %HMCLR==11 ; Drive clear (reset errors etc.) +DEFSYM %HMRLS==13 ; Drive release (dual port) +DEFSYM %HMSRC==31 ; Search (for r.p.s.) +DEFSYM %HMWCH==51 ; Write Check (?doesn't work) +DEFSYM %HMWCF==53 ; Write Check Format, Header and Data (?doesn't work) +DEFSYM %HMWRT==61 ; Write Data +DEFSYM %HMRED==71 ; Read Data +DEFSYM %HMWHD==63 ; Write Header And Data (format the pack) +DEFSYM %HMRHD==73 ; Read Header and Data +IFN RP07P,[ +DEFSYM %HMWTD==65 ; Write Track Descriptor +DEFSYM %HMRTD==75 ; Read Track Descriptor +] +DEFSYM %HMSEK==5 ; Seek to Cylinder +DEFSYM %HMOFS==15 ; Offset Heads Slightly + ; Just sets %HSOFS on RP07 +DEFSYM %HMCEN==17 ; Return Heads To Centerline + ; Just clears %HSOFS on RP07 +DEFSYM %HMACK==23 ; Acknowledge mounting of pack (required before I/O) + ; No-op on RP07 +DEFSYM %HMRDP==21 ; Read-In Preset + +DEFSYM %HRWC=:776702 ;WORD COUNT. + +DEFSYM %HRBA=:776704 ;UNIBUS ADDRESS. + +DEFSYM %HRADR=:776706 ;DESIRED ADDRESS. + DEFSYM $HATRK==.BP 37400 ; Track + DEFSYM $HASEC==.BP 00177 ; Sector + ;; These are the sizes on the RP07 -- other drives are smaller. + ;; This is OK, as most places calculate this as Track_8+Sector + +DEFSYM %HRCS2=:776710 ;CTRL AND STATUS 2. + DEFSYM %HYDLT==1_15. ; Data Late + DEFSYM %HYWCE==1_14. ; Write Check Error + DEFSYM %HYPE== 1_13. ; Parity Error + DEFSYM %HYNED==1_12. ; Non-existant Drive + DEFSYM %HYNEM==1_11. ; %HRBA is NXM during DMA + DEFSYM %HYPGE==1_10. ; Program Error + DEFSYM %HYMXF==1_9. ; Missed Transfer + DEFSYM %HYMDP==1_8. ; Mass Data Bus Parity Error + DEFSYM %HYOR== 1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %HYIR== 1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %HYCLR==1_5. ; Controller Clear + DEFSYM %HYPAT==1_4. ; Parity Test + DEFSYM %HYBAI==1_3. ; Unibus Address Increment Inhibit + DEFSYM $HYDSK==.BP 7 ; Bits 2-0 are the Unit Select. + +DEFSYM %HRSTS=:776712 ;DRIVE STATUS. + DEFSYM %HSATN==1_15. ; Attention Active + DEFSYM %HSERR==1_14. ; Error + DEFSYM %HSPIP==1_13. ; Positioning In Progress + DEFSYM %HSMOL==1_12. ; Medium On-Line + DEFSYM %HSWRL==1_11. ; Write Locked + DEFSYM %HSLST==1_10. ; Last Sector Transferred + DEFSYM %HSPGM==1_9. ; Programmable + DEFSYM %HSDPR==1_8. ; Drive Present + DEFSYM %HSRDY==1_7. ; Drive Ready + DEFSYM %HSVV== 1_6. ; Volume Valid +; These are RP04-only bits in %HRSTS +; DEFSYM %HSDE1==1_5. ; Difference Equals 1 +; DEFSYM %HSL64==1_4. ; Difference Less Than 64 +; DEFSYM %HSGRV==1_3. ; Go Reverse +; DEFSYM %HSDIG==1_2. ; Drive To Inner Guard Band +; DEFSYM %HSF20==1_1. ; Drive Forward 20in/sec +; DEFSYM %HSF5== 1_0. ; Drive Forward 5in/sec +IFN RP07P,[ + DEFSYM %HSILS==1_2. ; Interleaved Sectors + DEFSYM %HSWRN==1_1. ; Early Warning + DEFSYM %HSOFS==1_0. ; Offset Mode +] + +DEFSYM %HRER1=:776714 ;ERROR 1. + DEFSYM %H1ECC==1_15. ; Data Check + DEFSYM %H1UNS==1_14. ; Unsafe + DEFSYM %H1OPI==1_13. ; Operation Incomplete + DEFSYM %H1DTE==1_12. ; Drive Timing Error + DEFSYM %H1WLK==1_11. ; Write Lock Error + DEFSYM %H1IAE==1_10. ; Invalid Address Error + DEFSYM %H1AOE==1_9. ; Address Overflow Error + DEFSYM %H1CRC==1_8. ; Header CRC Error + DEFSYM %H1HCE==1_7. ; Header Compare Error + DEFSYM %H1ECH==1_6. ; ECC Hard Error + DEFSYM %H1WCF==1_5. ; Write Clock Fail + DEFSYM %H1FER==1_4. ; Format Error + DEFSYM %H1PAR==1_3. ; Parity Error + DEFSYM %H1RMR==1_2. ; Register Modification Refused + DEFSYM %H1ILR==1_1. ; Illegal Register + DEFSYM %H1ILF==1_0. ; Illegal Function + +DEFSYM %HRATN=:776716 ;ATTENTION SUMMARY. + ; Each bit 7-0 corresponds to a drive asserting ATA. + +DEFSYM %HRLAH=:776720 ;LOOK AHEAD. + ; 2.2 - 1.7 Sector Count. + ; 1.6 - 1.5 Encoded Extension Field. + +DEFSYM %HRBUF=:776722 ;DATA BUFFER. + +DEFSYM %HRMNT=:776724 ;MAINTENANCE. + +DEFSYM %HRTYP=:776726 ;DRIVE TYPE. + ; 2.7 NOT BLOCK ADDRESSED + ; 2.6 TAPE + ; 2.5 Moving Head (better be a 1!!) + ; 2.3 Drive Request Required + ; 1.9 - 1.1 Drive Type Number: + ; RP04 = 20, RP05 = 21, + ; RP06 = 22, RM03 = 24, + ; RM80 = 26, RP07 = 42 + +DEFSYM %HRSER=:776730 ;SERIAL NUMBER. + +DEFSYM %HROFS=:776732 ;OFFSET. + ; 2.9-2.8 Unused + ; 2.7 Sign Change (RP06 only) + ; 2.7 Command Modifier (RP07 only) + ; Must be set before %HMWHD, %HMWTD or %HMRTD + ; 2.6 Move Track Descriptor (RP07 only) + ; 0 = 128. bit track descriptor + ; 1 = 344. bit track descriptor + ; 2.4 Format Bit (1=16, 0=18) + ; 2.3 ECC Inhibit + ; 2.2 Header Compare Inhibit + ; 2.1 Skip Sector Inhibit (RM 16bit only) + ; 1.9 Unused + ; + ; 1.8 - 1.1 Unused on RP07 + ; RP07 doesn't support offsets + ; + ; RP06 Offsets + ; 1.8 - 1.1 Offset Info + ; +400 u" 00010000 + ; -400 u" 10010000 + ; +800 u" 00100000 + ; -800 u" 10100000 + ; +1200 u" 00110000 + ; -1200 u" 10110000 + ; Centerline 00000000 + ; + ; RMxx Offsets + ; 1.1-1.7 Unused + ; 1.8 Offset Direction + ; 0 - Away from spindle + ; 1 - Towards spindle + +DEFSYM %HRCYL=:776734 ;DESIRED CYLINDER. + +IFN RP06P,[ + +DEFSYM %HRCCY=:776736 ;CURRENT CYLINDER. + +DEFSYM %HRER2=:776740 ;ERROR 2. + DEFSYM %H2NHS==1_10. ; No Head Selection + DEFSYM %H2WRU==1_8. ; Write Ready Unsafe + +DEFSYM %HRER3=:776742 ;ERROR 3. + DEFSYM %H3OFC==1_15. ; Off Cylinder + DEFSYM %H3SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H3DCL==1_6. ; DC power low (or perhaps AC?) + DEFSYM %H3ACL==1_5. ; AC power low (or perhaps DC?) + ; (the documentation is confused about + ; which is which.) + +];RP06P + +IFN RP07P,[ + +DEFSYM %HRCCY=:776736 ;CURRENT CYLINDER. + +DEFSYM %HRER2=:776740 ;ERROR 2. + DEFSYM %H2PRG==1_15. ; Program Error + DEFSYM %H2CRM==1_14. ; Control ROM parity error + DEFSYM %H2H88==1_13. ; 8080 in drive is hung + ;; DEC unimaginatively calls the following three bits + ;; READ/WRITE UNSAFE 1, 2 and 3. + DEFSYM %H2WU3==1_12. ; Write current when no write in progress + DEFSYM %H2WU2==1_11. ; More than one head selected + DEFSYM %H2WU1==1_10. ; No write transitions during a write + DEFSYM %H2WOV==1_9. ; Write Overrun + DEFSYM %H2WRU==1_8. ; Write Ready Unsafe + DEFSYM $H2COD==.BP 377 ; Error Code + ;; Error codes are: + ;; 012 Seek operation too long. + ;; 013 Guard band detected during seek operation. + ;; 014 Seek operation overshoot. + ;; 104 Guard band detection failure during recalibrate operation. + ;; 105 Reference gap or guard band pattern detection failure during + ;; recalibrate operation. + ;; 106 Seek error during recalibrate operation. + ;; 112 Heads have attempted to land on guard band during recalibrate + ;; operation. + +DEFSYM %HRER3=:776742 ;ERROR 3. + DEFSYM %H3BDS==1_15. ; Bad Sector + DEFSYM %H3SKI==1_14. ; Seek Incomplete (see error code in ER2) + DEFSYM %H3DSE==1_13. ; Defect Skip Error + DEFSYM %H3WCF==1_12. ; Write Current Failure + DEFSYM %H3LCF==1_11. ; Logic Control Failure + DEFSYM %H3LBC==1_10. ; Loss of Bit Clock + DEFSYM %H3LCE==1_9. ; Loss of Cylinder Error + DEFSYM %H3X88==1_8. ; 8080 in drive failed to respond to a command + DEFSYM %H3DCK==1_7. ; Device Check + DEFSYM %H3WHD==1_6. ; Index Unsafe (Bad %HMWHD) + DEFSYM %H3DCL==1_5. ; DC Low voltage + DEFSYM %H3SDF==1_4. ; Serdes Data (data buffer timing) Failure + DEFSYM %H3PAR==1_3. ; Data Parity Error during write operation + DEFSYM %H3SYB==1_2. ; Sync Byte error + DEFSYM %H3SYC==1_1. ; Sync Clock failure + DEFSYM %H3RTM==1_0. ; Run timeout + +];RP07P + +IFN RM03P\RM80P,[ +; RM has no Current Cylinder Register, the Error 2 Register is +; in a different place with different bits, and there is no +; Error 3 register + +DEFSYM %HRER2=:776742 ;ERROR 2. + DEFSYM %H2BSE==1_15. ; Bad Sector (sector marked bad on disk) + DEFSYM %H2SKI==1_14. ; Seek Incomplete (also sets UNS+ATA+PIP+RDY) + DEFSYM %H2OPE==1_13. ; Drive address plug was removed + DEFSYM %H2IVC==1_12. ; Invalid Command (really drive not valid) + DEFSYM %H2LSC==1_11. ; LSC Sucks + DEFSYM %H2LBC==1_10. ; Loss of Bitcheck (hardware lossage) + DEFSYM %H2DVC==1_7 ; Device Check (generic hardware lossage) + DEFSYM %H2SSE==1_5 ; Skip Sector found (can't happen in 18bit) + DEFSYM %H2DPE==1_3 ; Data Parity Error in controller + +];RM03P\RM80P + +DEFSYM %HRPOS=:776744 ;ECC POSITION. + +DEFSYM %HRPAT=:776746 ;ECC PATTERN. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rm03.defs5 b/system/rm03.defs5 new file mode 100644 index 0000000..bfcbad1 --- /dev/null +++ b/system/rm03.defs5 @@ -0,0 +1,57 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RM03 + +DEFSYM NCYLS==820. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==823.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==5 ; # TRACKS/CYLINDER +DEFSYM NSECS==30. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 14814, so it takes 2 blocks to TUT an +; RM03. This leaves plenty of room for the extra words at the beginning of +; the TUT. +DEFSYM NTUTBL==2 ; 2 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rm80.defs2 b/system/rm80.defs2 new file mode 100644 index 0000000..4a3e9e6 --- /dev/null +++ b/system/rm80.defs2 @@ -0,0 +1,57 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RM80 + +DEFSYM NCYLS==556. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==561.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==14. ; # TRACKS/CYLINDER +DEFSYM NSECS==30. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 29172, so it takes 3 blocks to TUT an +; RM80. This leaves plenty of room for the extra words at the beginning of +; the TUT. +DEFSYM NTUTBL==3 ; 3 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rm80.defs3 b/system/rm80.defs3 new file mode 100644 index 0000000..b403d31 --- /dev/null +++ b/system/rm80.defs3 @@ -0,0 +1,57 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RM80 + +DEFSYM NCYLS==558. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==561.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==14. ; # TRACKS/CYLINDER +DEFSYM NSECS==30. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 29172, so it takes 3 blocks to TUT an +; RM80. This leaves plenty of room for the extra words at the beginning of +; the TUT. +DEFSYM NTUTBL==3 ; 3 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rm80.defs4 b/system/rm80.defs4 new file mode 100644 index 0000000..aabde04 --- /dev/null +++ b/system/rm80.defs4 @@ -0,0 +1,61 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RM80 + +; The RM80 actually has 561 cylinders, but it appears that the onboard +; microprocessor diagnostics may scribble on the last two cylinders, so +; we just leave them out of this. + +DEFSYM NCYLS==556. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==559.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==14. ; # TRACKS/CYLINDER +DEFSYM NSECS==30. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 29172, so it takes 3 blocks to TUT an +; RM80. This leaves plenty of room for the extra words at the beginning of +; the TUT. +DEFSYM NTUTBL==3 ; 3 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rp06.defs1 b/system/rp06.defs1 new file mode 100644 index 0000000..085ffe5 --- /dev/null +++ b/system/rp06.defs1 @@ -0,0 +1,57 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RP06 + +DEFSYM NCYLS==812. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==815.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==19. ; # TRACKS/CYLINDER +DEFSYM NSECS==20. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 38305, so it takes a little more than 3 +; blocks to TUT an RP06. This leaves plenty of room for the extra words at +; the beginning of the TUT. +DEFSYM NTUTBL==4 ; 4 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rp07.defs1 b/system/rp07.defs1 new file mode 100644 index 0000000..8d8e1eb --- /dev/null +++ b/system/rp07.defs1 @@ -0,0 +1,57 @@ +; -*- Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + +; Disk Physical Parameters for RP07 + +DEFSYM NCYLS==627. ; # CYLINDERS NORMALLY USED +DEFSYM XCYLS==630.-NCYLS ; # EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==32. ; # TRACKS/CYLINDER +DEFSYM NSECS==43. ; # SECTORS/TRK +DEFSYM SECBLK==8 ; # SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ; # BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ; TOTAL # REG BLKS +DEFSYM XBLKS==XCYLS*NBLKSC ; # XTRA BLKS +DEFSYM TBLKS==NBLKS+XBLKS ; TOTAL BLKS + +; TUTs are 3 bits per disk block, or 12*1024=12288 disk blocks per TUT +; block. TBLKS works out to be 108360, so it takes 9 blocks to TUT an +; RP07. This leaves plenty of room for the extra words at the beginning of +; the TUT. +DEFSYM NTUTBL==9 ; 9 BLOCKS PER TUT + +; Allocate whole cylinders at a time. +DEFSYM DECADE==NBLKSC ; NUMBER OF BLOCKS TO ALLOCATE AT A TIME. + ; QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/rp10.defs16 b/system/rp10.defs16 new file mode 100644 index 0000000..d1e7a8f --- /dev/null +++ b/system/rp10.defs16 @@ -0,0 +1,122 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +IFNDEF DEFSYM,[ ;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. + ;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +] +.ELSE $$TEMP==0 + + +;DISK PHYSICAL PARAMETERS + +DEFSYM NCYLS==200. ;# CYLINDERS NORMALLY USED (RP02) +DEFSYM MCYLS==400. ;# CYLINDERS NORMALLY USED (RP03) +DEFSYM XCYLS==3 ;# EXTRA CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS==20. ;# TRACKS/CYLINDER +DEFSYM NSECS==10. ;# SECTORS/TRK +DEFSYM SECBLK==8 ;# SECTORS/BLOCK +DEFSYM NBLKSC==NHEDS*NSECS/SECBLK ;# BLKS/CYL +DEFSYM NBLKS==NCYLS*NBLKSC ;TOTAL # REG BLKS (RP02) +DEFSYM MBLKS==MCYLS*NBLKSC ;TOTAL # REG BLKS (RP03) +DEFSYM XBLKS==XCYLS*NBLKSC ;# XTRA BLKS +DEFSYM TBLKS==MBLKS+XBLKS ;TOTAL BLKS + +DEFSYM NTUTBL==1 ;1 BLOCK PER TUT +DEFSYM DECADE==20. ;NUMBER OF BLOCKS TO ALLOCATE AT A TIME + ;QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS +DEFSYM DPC==250 ;I/O DEVICE NUMBER + +;DISK COMMANDS + +DEFSYM DREADC==000000,, ;READ DATA +DEFSYM DWRITC==100000,, ;WRITE DATA + ;OP CODE 2 UNUSED +DEFSYM DWRITH==300000,, ;WRITE HEADER AND DATA (FORMAT PACK) +DEFSYM DSEEKC==400000,, ;POSITION HEADS +DEFSYM DEASEC==500000,, ;CLEAR ATTENTIONS +DEFSYM DNOOPC==600000,, ;SELECT DRIVE +DEFSYM DRCALC==700000,, ;RECALIBRATE DRIVE + +;BYTE POINTERS FOR ABOVE COMMANDS + +DEFSYM DUNFLD==360300,, ;UNIT FIELD (ALL COMMANDS) +DEFSYM DCYL==261000,, ;CYLINDER FIELD (READ,WRIT,WRITH,SEEK) +DEFSYM DCYLXB==200100,, ;EXTRA BIT OF CYLINDER FIELD FOR RP03 +DEFSYM DSURF==210500,, ;SURFACE FIELD (READ,WRIT,WRITH) +DEFSYM DSECT==140400,, ;SECTOR FIELD (READ,WRIT,WRITH) + + ;DATAI FIELDS + + +DEFSYM DUNFLI==410300,, ;UNIT FIELD +DEFSYM DCYLI==311000,, ;CYLINDER FIELD +DEFSYM DCYLXI==130100,, ;EXTRA BIT OF CYLINDER FIELD + +DEFSYM SKINC==100,, ;SEEK INCOMPLETE +DEFSYM ONCYL==40,, ;ON CYLINDER +DEFSYM ONLINE==20,, ;ON LINE +DEFSYM FUNSAF==10,, ;FILE UNSAFE +DEFSYM NSCHDR==4,, ;NO SUCH DRIVE +DEFSYM RDONLY==2,, ;READ ONLY +DEFSYM NOWRIH==1, ;WRITE HEADER LOCKOUT + +DEFSYM RP03BT==2000 ;SELECTED DRIVE IS AN RP03 +DEFSYM SECTI==140500,, + +DEFSYM ALLATT==776 + +;CONO INFORMATION + +DEFSYM DCLEAR==175710 ;CLEAR ALL ERROR CONDITIONS + + +;CONI INFORMATION + +DEFSYM PARER== 4000 +DEFSYM SRCER== 40000 +DEFSYM HRDER==130000 +DEFSYM PROER==402300 +DEFSYM WRTER== 1000 +DEFSYM ALLER==577300 +DEFSYM DONE==10 +DEFSYM BUSY==20 + +;DF10 CHANNEL INFORMATION + +DEFSYM $DFCAD==002600,, ;CURRENT ADDRESS - 1 (IN CONTROL WORD) + ;ALSO BITS 4.7-4.9 HAVE 1'S COMPLEMENT OF MA 3.1-3.3 +DEFSYM $DFWC==261600,, ;- WORD COUNT (IN CONTROL WORD) +DEFSYM $DFLAD==002600,, ;LAST DATA ADDRESS (IN STORED CONTROL WD) +DEFSYM $DFCWA==261600,, ;LAST CONTROL WORD ADDRESS (IN STORED CONTROL WORD) + + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/salv.311 b/system/salv.311 new file mode 100644 index 0000000..692d253 --- /dev/null +++ b/system/salv.311 @@ -0,0 +1,6701 @@ +;;; -*- Mode:MIDAS -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.SEE COPY ;COPY BLOCK TO BLOCK +.SEE DUP ;DUPLICATE ENTIRE DISC PACK +.SEE TRAN ;LOAD FROM MAG TAPE UNIT 5 +.SEE UCOP ;COPY UDIRS FROM DRIVE TO DRIVE +.SEE ZAP ;ZERO DIR BLOCKS, WRITE OUT EMPTY TUT,MFD, WRITE READIN BLOCK +.SEE SPKID ;SET PACK ID IN TUT +.SEE DSKTST ;SIMPLE DISK TEST (WRITE THEN READ) +.SEE SEKTST ;DISK TEST WHICH SEEKS BACK AND FORTH (DOES NO WRITING) +.SEE MARK ;FORMAT PACK +.SEE MARK69 ;FINISH FORMATTING PACK +.SEE MFDR ;TRY TO RECONSTRUCT MFD FROM USER DIRS +.SEE CHKR ;SALVAGER +.SEE GOGO ;SALVAGER - (AUTO FOR ALL DRIVES) +.SEE GETSTS ;GET CONTROLLER AND CURRENT DRIVE STATUS +.SEE RDHEAD ;READ HEADER FROM TRACK +.SEE LISTF ;PRINT USER DIRECTORY ON LPTR +.SEE UNLOCK ;TEST & UNLOCK A BLOCK +.SEE REMAP ;REMAP PACK #S AND FIX UFDS + +.SEE PUNCH ;VARIABLE TO BE SET NON-ZERO IF COPYING OF TTY OUTPUT TO PAPER TAPE IS WANTED +.SEE HCRASH ;VARIABLE TO BE SET NON-ZERO IF DUP'ING A DISK AFTER HEAD CRASH +.SEE NOQUES ;IF NON-ZERO, NO QUESTIONS IN GOGOX MODE +.SEE FERRS ;COUNT OF CORRECTABLE ERRORS +.SEE CERRS ;COUNT OF ECC-CORRECTED ERRORS (RP04 ONLY) +.SEE DUPRER ;COUNT OF BLOCKS THAT COULDN'T BE READ IN `DUP' +.SEE DUPWER ;COUNT OF BLOCKS THAT COULDN'T BE WRITTEN IN `DUP' + +IF1, TITLE SALVATION +IF2,[ PRINTX/SALVATION / + .TYO6 .FNAM2 + PRINTX/ +/] + +DEFINE SUBTTL A/ +TERMIN + +;AC'S + +ZR=0 +A=1 +B=2 +C=3 +D=4 +N=5 +I=6 +Q=7 +H=10 +TT=11 +T=12 +W=13 +U=14 +J=15 +K=16 +P=17 + +SUBTTL CONFIGURATION + +DEFINE IFCE A,B +IFE SIXBIT/A/-SIXBIT/B/,TERMIN ;SUBSTITUTE FOR IFSE THAT IGNORES CASE + +;OPTIONS + +IF1,[ +PRINTX /Run under time-sharing? / +.TTYMAC TS + IRPS Z,,[YES Y AYE DA JA] + IFCE Z,TS,{ + ITS==1 + IRPS ZZ,,[DC10P RP10P RH10P OLPTP NLPTP TTLPTP KL10P] + ZZ==0 + TERMIN + .ISTOP + } + TERMIN +TERMIN + +IFNDEF ITS,[ ;run stand alone +ITS==0 +PRINTX /Which machine? / +.TTYMAC MCHN + IFCE MCHN,AIKA,[ + FIRSPK==1 ;first pack that must be mounted in gogo mode + LASTPK==5 ;last pack that must be mounted in gogo mode + NUDSL==440. + DC10P==1 + RP10P==0 + RH10P==0 + T300P==0 + KL10P==0 + OLPTP==0 ;R.I.P. + NLPTP==0 + TTLPTP==0 + TCMXH==55. + LIGHTS==4 ;PI + ];AIKA + IFCE MCHN,ML,[ + FIRSPK==2 + LASTPK==3 + NUDSL==250. + DC10P==0 + RP10P==1 + RH10P==0 + T300P==0 + KL10P==0 + OLPTP==0 + NLPTP==0 ;rest in pieces + TTLPTP==0 + TCMXH==55. + LIGHTS==4 ;PI + ];ML + IFCE MCHN,DM,[ + FIRSPK==17. + LASTPK==21. + NUDSL==200. + DC10P==0 + RP10P==1 + RH10P==0 + T300P==0 + KL10P==0 + OLPTP==0 + NLPTP==0 + TTLPTP==100 + TCMXH==55. + LIGHTS==4 ;PI + ];DM + IFCE MCHN,MC,[ + SA==105*2000 ; MC system is big, need to push SALV higher. + FIRSPK==0 + LASTPK==1 + NUDSL==500. + DC10P==0 + RP10P==0 + RH10P==1 + T300P==3 ;UNIT 3 IS FIRST T-300 UNIT + KL10P==1 + OLPTP==0 + NLPTP==0 + TTLPTP==0 ;NO LPT AT ALL + TCMXH==100. ;LA36 + LIGHTS==500 ;KL-UDGE + NDRIVE==6 ;8 DOESN'T FIT IN 128K + NUNITS==6 + ];KL +TERMIN +IFNDEF FIRSPK, .FATAL UNKNOWN MACHINE "MCHN" +];IFNDEF ITS + +;Formerly we knew number of units, now these are set to maximum and at run +; time we find out which units are present and on-line with the right packs. +IFNDEF NDRIVE, NDRIVE==8 ;# physical units +IFNDEF NUNITS, NUNITS==8 ;# virtual units + +IFE NUNITS-NDRIVE,[ ;Hack for virtual units in pre-Calcomp AI-KA system. + DEFINE UNTMES A/ + TYPE A + TERMIN +] +IFN NUNITS-NDRIVE,[ + DEFINE UNTMES A/ + DEFINE ZZQ UNIT + TYPE A + TERMIN + ZZQ [VIRTUAL UNIT] + TERMIN +] + +;MACROS FOR CONDITIONALIZATION + +DEFINE TS +IFN ITS!TERMIN + +DEFINE NTS +IFE ITS!TERMIN + +DEFINE DC +IFN DC10P!TERMIN + +DEFINE RP +IFN RP10P!TERMIN + +DEFINE RH +IFN RH10P!TERMIN + +DEFINE KA +IFE KL10P!TERMIN + +DEFINE KL +IFN KL10P!TERMIN + +DEFINE INSIRP I,[X] +IRPS Z,,X + I,Z +TERMIN +TERMIN + +DEFINE INFORM A,B,C,D,E,F,G +PRINTX \A!B!C!D!E!F!G +\ +TERMIN + +DEFINE CONC A,B +A!B!TERMIN + +DEFINE STRA C/ + MOVE A,[440700,,[ASCIZ \C\]] +TERMIN + +DEFINE LPR B/ + JSR LOUTST + [ASCIZ \B\] +TERMIN + +DEFINE TYPE TXT/ + JSR TOUTST + [ASCIZ \TXT\] +TERMIN + +TS INFORM Runs under time-sharing on any machine +DC INFORM Systems Concepts disk control +RP INFORM DEC RP10 disk control +RH INFORM DEC RH10 disk control + INFORM Number of drives=,\ndrives +; INFORM Number of virtual units=,\nunits +KA INFORM KA-10 +KL INFORM KL-10 +IFN OLPTP, INFORM Old LPT Interface +IFN NLPTP, INFORM New LPT Interface +IFN TTLPTP, INFORM LPT on MTY line number ,\TTLPTP&77 +TS, T300P==0 +IFN T300P, INFORM Support for Trident T-300 via PDP-11 +];IF1 + +MEMSIZ==1000000 +IFNDEF SA,SA==100*2000 + +NLPT=464 ;device code of ML lpt +MTY==400 ;device code of scanner + +APR==0 +PI==4 +KA, TTY==120 +KA, PTP==100 +IFN T300P, DLB==60 ;DL-10 +.ALSO DLC==64 + +X=PUSHJ P, + +NTS,[ LOC SA + JRST GOGO ;make easy to start from ITS core load +SALVRT: 0 ;system may JSR here + JRST SALVAG +];NTS + +;DISK PHYSICAL PARAMETERS + +DC,[ + .INSRT SYSTEM;DC10 > +] +RP,[ + .INSRT SYSTEM;RP10 > +] +RH,[ + .INSRT SYSTEM;RH10 > +] +TS, NTUTBL==4 ;MAXIMUM NUMBER OF BLOCKS PER TUT ON ANY ITS + +;FILE SYSTEM PARAMETERS + +.INSRT SYSTEM;FSDEFS > + +IFN T300P,[ + + ;DL10 COMMUNICATIONS AREA IN NON-ENCACHED LOW CORE +DL10AR==500 ;ACTUAL STORAGE LAYOUT DEFINED IN ITS AND IN T300 DEFS + + .INSRT SYSTEM;T300 > +MXTUTB==NTUTB1 ;MAXIMUM OF NTUTBL AND NTUTB1 +];T300P +.ELSE MXTUTB==NTUTBL + +DC,[ +DEFINE QCOPY A,B +DCOPY A(-_2&37774)!TERMIN +];DC + +;DEFINE CHANNEL PROGRAM AREA + +NTS,[ +KL,[ + .INSRT SYSTEM;EPT > + +ZZ==. + LOC EPTDDT + JRST MEMSIZ-4000 ;FOR 'DDT' COMMAND IN KLDCP +LOC ZZ + +PAG==10 +..D010==0 +SWPIA=701440,,0 +SWPUO=701740,,0 +SWPIO=701640,,0 +SWPUA=701540,,0 +];KL +KA,[ +SLVICWA=20 +SLVIOWD=22 +];KA +];NTS + +TS,[ +TYIC==1 +TYOC==2 +LPTC==3 +QIN==4 +] + +IF2,[ +TS,[ NBLKS==10000. ;FAKE + TBLKS==10000. ;FAKE + MFDBLK==-1 ;JUST TO AVOID UNDEF SYM ERROR, VALUE NEVER USED +; TUTBLK==-1 ;.. +];TS +];IF2 + +SUBTTL COPY BLOCK TO BLOCK + +NTS,[ + +COPY: JSR INIT + PUSHJ P,CRR + UNTMES COPY BLOCK FROM UNIT # + PUSHJ P,NTYI + JRST COPY + CAIL A,NUNITS + JRST COPY + MOVEM A,FROM + MOVE I,A + PUSHJ P,RESET +CP1: PUSHJ P,CRR + TYPE BLOCK # + PUSHJ P,OTYI + CAIL A,TBLKS + JRST CP1 + MOVEM A,FMBLK +CP2: PUSHJ P,CRR + UNTMES ONTO UNIT # + PUSHJ P,NTYI + JRST CP2 + CAIL A,NUNITS + JRST CP2 + MOVEM A,TOU + MOVE I,A + PUSHJ P,RESET + PUSHJ P,CRR +CP3: TYPE BLOCK # + PUSHJ P,OTYI + PUSHJ P,CRR + CAIL A,TBLKS + JRST CP3 + MOVEM A,TOBLK + MOVEI A,TUT + MOVE J,FMBLK + MOVE I,FROM + PUSHJ P,READ + JUMPL T,CPERR +COPYB: MOVEI A,TUT ;HANDY PLACE FOR A BREAKPOINT + MOVE J,TOBLK + PUSHJ P,WRITT + JRST DDT + +DTYI: MOVEI B,0 ;DECIMAL TYPEIN +DTYI1: X NTYI + JRST DTYI2 + IMULI B,10. + ADD B,A + JRST DTYI1 + +DTYI2: MOVE A,B + POPJ P, + +OTYI: MOVEI B,0 ;OCTAL TYPEIN +OTYI1: X NTYI + JRST DTYI2 + LSH B,3 + ADD B,A + JRST OTYI1 + +CPERR: TYPE READ ERROR + X CRR + JRST DDT + + SUBTTL TEST AND UNLOCK SOME BLOCKS + +UNLOCK: JSR INIT + X CRR + UNTMES UNLOCK BLOCKS ON UNIT # + X NTYI + JRST UNLOCK + CAIL A,NUNITS + JRST UNLOCK + MOVEM A,FROM + MOVE I,A + X RESET +UNLK1: X CRR + TYPE BLOCK # + X OTYI + PUSHJ P,UNLOCB + JFCL + JRST UNLK1 ;USE ^Z TO GET OUT + +;UNLOCK A BLOCK, NUMBER IN A, UNIT IN FROM + +UNLOCB: INSIRP PUSH P,[J K Q D B TT] + MOVE J,A + MOVEM J,FMBLK + SETZM CYLBUF ;ZERO OUT IN CASE CAN'T READ + MOVE A,[CYLBUF,,CYLBUF+1] + BLT A,CYLBUF+4000-1 + MOVE I,FROM + MOVEI A,CYLBUF + PUSHJ P,READ + JUMPGE T,UNLK2 + TYPE READ ERROR + X CRR + X GSTS + TYPE PROCEED? + X Y.OR.N + JRST UNLOCX +UNLK2: MOVE A,[RXWDS,,WXWDS] + BLT A,WXWDS+4-1 + MOVEI A,CYLBUF + X WRITE + JUMPL T,WRERR + MOVEI A,CYLBUF+2000 + X READ + JUMPL T,[TYPE READ-BACK ERROR + X CRR + X GSTS + JRST UNLOCX] + MOVSI T,-2000 +UNLK3: MOVE TT,CYLBUF(T) + CAME TT,CYLBUF+2000(T) + JRST [ TYPE READ-BACK COMPARE ERROR + X CRR + JRST UNLOCX] + AOBJN T,UNLK3 + + MOVEI A,TUT + X RDTUT + JUMPL T,CPERR + MOVE J,FMBLK + MOVEI B,TUT + X TUTPNT + JUMPE J,[ TYPE CAN'T ACCESS TUT + X CRR + JRST UNLOCX ] + MOVEI B,1 ;SAFEST ... NEXT SALVAGE WILL PUT CORRECT VALUE + DPB B,J + MOVEI A,TUT + X WRTUT + JUMPL T,WRERR + AOS -6(P) ;WINNING, SKIP RETURN +UNLOCX: INSIRP POP P,[TT B D Q K J] + POPJ P, + +WRERR: TYPE WRITE ERROR + JRST CRDDT + +SUBTTL DUP - COPY ENTIRE PACK + +DUP1A: PUSHJ P,CRR +DUP1: UNTMES FROM UNIT # + PUSHJ P,NTYI + JRST DUP1A + CAIL A,NUNITS + JRST DUP1A + MOVE I,A + PUSHJ P,RESET +DUP2: MOVEM A,FROM +TO: PUSHJ P,CRR + UNTMES ONTO UNIT # + PUSHJ P,NTYI + JRST TO + CAIL A,NUNITS + JRST TO + MOVEM A,TOU + X CRR + UNTMES COPY FROM UNIT # + MOVE A,FROM + X DPT + UNTMES ONTO UNIT # + MOVE A,TOU + X DPT + TYPE , OK? + X Y.OR.N + JRST DDT + MOVE I,TOU + PUSHJ P,RESET + POPJ P, + +DUP: JSR INIT + SETZM USRDS' + SETZM USWRTS' + SETZM DUPRER + SETZM DUPWER +RH, SETZM CERRS + TYPE DUPLICATE DISK + PUSHJ P,DUP1 + MOVE I,FROM +DC, MOVE A,QTRAN(I) +DC, DPB A,[DUNFLD CYLRIR] +RP, MOVE I,TOU +.ELSE [ MOVE A,PKNUM(I) + MOVE I,TOU + CAME A,PKNUM(I) + JRST DUPLUZ +]DC, MOVE A,QTRAN(I) +DC, DPB A,[DUNFLD CYLRIW] + MOVEI J,NCYLS+XCYLS-1 ;DETERMINE HOW MANY CYLINDERS THIS DRIVE +RP,[ MOVSI A,(DNOOPC) + DPB I,[DUNFLD A] ;SELECT DESTINATION DRIVE + DATAO DPC,A + DATAI DPC,B + MOVE I,FROM + DPB I,[DUNFLD A] ;SELECT SOURCE DRIVE + DATAO DPC,A + DATAI DPC,A + XOR A,B + TRNE A,2000 + JRST [ TYPE CAN'T COPY RP02 TO RP03 OR VICE VERSA + JRST CRDDT ] + TRNE B,2000 + MOVEI J,MCYLS+XCYLS-1 ;DRIVES ARE RP03S, MORE CYLINDERS TO COPY +];RP +IFN T300P,[ + CAIL I,T300P + JRST T3DUP ;HAVE TO DO IT THE SLOW WAY + MOVE I,FROM + CAIL I,T300P + JRST [ TYPE CAN ONLY GO T-300 TO T-300 + JRST CRDDT ] +];T300P + MOVEI A,CYLBUF +DLUP: MOVE I,FROM + PUSHJ P,READCY + JUMPL T,DLUP1 ;LOST, TRY BLOCK AT A TIME + MOVE I,TOU + PUSHJ P,WRITCY + JUMPL T,DLUP1 +DLUP2: SOJGE J,DLUP +DC, MOVEI T,CYLRIR ;COPY READ-IN BLOCK +DC, PUSHJ P,RW0 +RH,[ SKIPN A,CERRS + JRST DDT + X TDPT + TYPE ECC-CORRECTED ERRORS. + JRST CRDDT +] +.ELSE JRST DDT + +DUPLUZ: TYPE PACK # DFRS + PUSHJ P,CRR + JRST DDT + +IFN T300P,[ +T3DUP: MOVE I,FROM + CAIGE I,T300P + JRST [ TYPE CAN ONLY GO T-300 TO T-300 + JRST CRDDT ] + TYPE THIS WILL TAKE A WHILE... + X CRR + MOVEI J,NBLKS1+XBLKS1-1 +T3DUP1: MOVEI A,CYLBUF + MOVE I,FROM + X READ + JUMPL T,CPERR + MOVE I,TOU + X WRITE + JUMPL T,WRERR + SOJGE J,T3DUP1 + JRST CRDDT +];T300P + +IFE RH10P,[ ;BLOCK AT A TIME +DLUP1: PUSH P,J + IMULI J,NBLKSC + CLEARM DLUPT +DLUP3: MOVE I,FROM + MOVEI A,CYLBUF + PUSHJ P,READ + JUMPL T,DLUPE1 + MOVE I,[RXWDS,,WXWDS] +DLUPEW: BLT I,WXWDS+4-1 + PUSHJ P,WRITT + JUMPL T,DLUPE2 +DLUPEX: AOS TT,DLUPT + CAIGE TT,NBLKSC + AOJA J,DLUP3 + POP P,J + JRST DLUP2 +] +RH,[ ;SECTOR AT A TIME ON RP04 SO GET EXTRA SECTORS +DLUP1: MOVEI T,NHEDS*NSECS + MOVEM T,DLUPT +DLUP3: SOS W,DLUPT ;NEXT SECTOR (GOING BACKWARDS THROUGH CYLINDER) + IDIVI W,NSECS ;TRACK IN W, SECTOR IN U + LSH W,8 + IOR W,U + HRL W,J ;NOW W HAS DISK ADDRESS + MOVEM W,RHPGA + MOVE U,[-200,,CYLBUF-1] + MOVEM U,RHIOW + MOVE I,FROM + MOVEI TT,%HMRED + MOVEM TT,RHCMD + PUSHJ P,RW1 + JUMPL T,DLUPE1 +DLUPEW: MOVE I,TOU + MOVEI TT,%HMWRT + MOVEM TT,RHCMD + PUSHJ P,RW1 + JUMPL T,DLUPE2 +DLUPEX: SKIPE DLUPT + JRST DLUP3 + JRST DLUP2 +];RH + +DLUPT: 0 + +DLUPE1: AOS DUPRER + SKIPE HCRASH + JRST DLUPE4 ;SPEED IS OF THE ESSENCE, DON'T TYPE ANYTHING + TYPE Read error on block # + PUSHJ P,DLUPE3 +DLUPE4: SETZM CYLBUF ;COULDN'T READ THE BLOCK, SUBSTITUTE ALL ZEROS + MOVE A,[CYLBUF,,CYLBUF+1] + BLT A,CYLBUF+2000-1 + MOVE I,[DLUPE5,,WXWDS] ;WITH SPECIAL EXTRA WORDS + JRST DLUPEW ;RESUME DLUP AT WRITE + +DLUPE3: MOVE A,I + X DPT + MOVEI A,"- + X TYO +IFE RH10P, MOVE A,J +IFN RH10P,[ + HLRZ A,RHPGA ;CYLINDER + IMULI A,NBLKSC + LDB W,[101000,,RHPGA] ;HEAD + IMULI W,NSECS + LDB U,[001000,,RHPGA] ;SECTOR + ADD W,U + IDIVI W,SECBLK + ADD A,W ;INACCURATE IF UNUSED SECTOR AT END OF CYLINDER +];RH10P + PUSHJ P,DPT + PUSHJ P,CRR + JRST GSTS ;HARDWARE STATUS + +DLUPE2: AOS DUPWER + SKIPE HCRASH + JRST DLUPEX ;SPEED IS OF THE ESSENCE, DON'T TYPE ANYTHING + TYPE Write error on block # + PUSHJ P,DLUPE3 + JRST DLUPEX + +;SUITABLE EXTRA WORDS FOR BLOCKS THAT COULDN'T BE READ + +DLUPE5: 0 ;WORD COUNT=2000, LAST BLOCK=0 + SIXBIT /??????/ ;DUMMY DIRECTORY + SIXBIT /(DISK)/ + SIXBIT/LOSSAG/ + +DC,[ SUBTTL CYLINDER I/O, DC10 +READCY: SKIPA T,[DREADC+DUNENB] ;READ CONTINUOUS +WRITCY: MOVSI T,(DWRITC+DUNENB) ;WRITE CONTINUOUS + MOVE TT,QTRAN(I) + DPB TT,[DUNFLD T] + MOVE TT,J + SKIPGE QTRAN(I) + ADDI TT,NCYLS+XCYLS + DPB TT,[DCYL T] + DPB TT,[DCYL CYLCM3] +CYL1: SKIPLE TT,PKNUM(I) + JRST CYL2 + PUSH P,T + PUSHJ P,RESET + POP P,T + JRST CYL1 + +CYL2: CAIL J,NCYLS + MOVEI TT,0 + DPB TT,[DPKID T] + DPB TT,[DPKID CYLCM3] + MOVEM T,CYLCOM + DPB A,[DCCA CYLCM1] + DPB A,[DCCA CYLCM2] + MOVEI T,CYLCOM +RW0: HRRM T,DGO + JRST RW1 ;TRY TRANSFER UNTIL SUCCEEDS + +CYLCOM: 0 + DALU+DLDBWC+DLLB -2004*NBLKSC(3) ;LOAD WORD COUNT WITH -2004*NO. OF BLOCKS/CYL +CYLCM1: DCOPY . +CYLCM3: DRCC ;READ COMPARE CONTINUOUS + DALU+DLDBWC+DLLB -2004*NBLKSC(3) +CYLCM2: DCCOMP . + DHLT + +CYLRIR: DREAD+DUNENB + DCOPY CYLBUF(-LRIBLK_2&37774) +CYLRIW: DWRITE+DUNENB + DCOPY CYLBUF(-LRIBLK_2&37774) + DHLT +];DC + +RP,[ SUBTTL CYLINDER I/O, RP10 & RH10 CONTROLS + +;RP10 CYLINDER I/O ALWAYS SUCCEEDS. IF PROBLEMS OCCUR, GOES SECTOR +;AT A TIME, TYPING OUT WHAT IS GOING ON, ZEROING SECTORS THAT CAN'T BE READ, +;THEN RETURNS CLAIMING TO HAVE WON. +READCY: SKIPA T,DRD +WRITCY: MOVE T,DWR + MOVEM T,RPIOOP + MOVEM J,RPIOCY + SETZM RPIOHD + SETZM RPIOSC + MOVEM A,RPAOBJ + MOVNI T,NBLKSC*2000 + HRLM T,RPAOBJ +RPCY0: PUSHJ P,RPIO + JUMPGE T,CPOPJ ;WON +IFN 0,[ ;I DON'T THINK THIS CODE WORKS + SKIPE HCRASH + POPJ P, + MOVE T,RPIOOP + CAMN T,DWR + JRST [ TYPE WRITE ERROR ON BLOCK + JRST .+3 ] + TYPE READ ERROR ON BLOCK + PUSH P,A + PUSH P,B + MOVE A,I + X DPT + TYPE - + MOVE A,RPIOHD + IMULI A,NSECS + ADD A,RPIOSC + IDIVI A,SECBLK + MOVE B,RPIOCY + IMULI B,NBLKSC + ADD A,B + X DPT + X CRR + POP P,B + POP P,A + PUSHJ P,GSTS ;EXPLAIN WHAT HAPPENED TO THIS SECTOR + MOVE T,RPIOOP ;IF READ, ZERO THE BUFFER + HRLZ TT,RPAOBJ ;IF WAS REALLY IN SECTOR AT A TIME MODE + CAMN T,DRD + CAIE TT,-200 + JRST RPCY1 + MOVE TT,RPAOBJ + SETZM (TT) + HRLZ T,TT + HRRI T,1(TT) + BLT T,177(TT) +RPCY1: AOS T,RPIOSC ;ADVANCE TO NEXT SECTOR + CAIGE T,NSECS + JRST RPCY2 + SETZM RPIOSC + AOS T,RPIOHD + CAIL T,NHEDS + POPJ P, ;MUST BE DONE +RPCY2: MOVE T,[200,,200] + ADDB T,RPAOBJ + JUMPL T,RPCY0 ;GO DO THE REST OF THE CYLINDER +];IFN 0 + POPJ P, ;HMM, MUST BE DONE +];RP + +RH,[ ;CYLINDER I/O, RH10 CONTROL + +READCY: SKIPA TT,[%HMRED] +WRITCY: MOVEI TT,%HMWRT +IFN T300P,[ + CAIL I,T300P + JRST 4,. ;NOT CODED YET + SETZM T3IOP +];T300P + MOVEM TT,RHCMD + HRLZM J,RHPGA ;SET ADDRESS TO START OF CYLINDER + MOVEI T,-1(A) ;SET UP IOWD TO TRANSFER WHOLE CYLINDER + HRLI T,-200*NHEDS*NSECS ;- NUMBER OF WORDS TO TRANSFER + MOVEM T,RHIOW + JRST RW1 +];RH + +SUBTTL TRAN - LOAD FROM MAG TAPE + +MAGOP: AOSE ITAPE + JRST MTR1 + HRROI A,MAGHD + PUSHJ P,MREAD + MOVE A,MAGHD + TRNE A,-1 + JRST MBDTHD + CAMGE A,[-LTHBLK,,] + JRST MBDTHD + ADD A,[1,,THBLK+1] + PUSHJ P,MREAD + TYPE TAPE # + HLRZ A,THTPN + PUSHJ P,TDPT + PUSHJ P,CRR + +MTR1: HRROI A,MAGHD + PUSHJ P,MREAD + JUMPE T,CPOPJ ;EOF + MOVE A,MAGHD + TRNE A,-1 + JRST MBADHD + CAMGE A,[-LMHBLK,,0] + JRST MBADHD + ADD A,[1,,MHBLK+1] + PUSHJ P,MREAD + SETZM LNKFLG + HLRZ B,MHPKN + JUMPE B,POPJ1 ;NOT A LINK + SETOM LNKFLG + MOVE A,[-3,,LNKNM1] ;READ LINK INFO + PUSHJ P,MREAD + JRST POPJ1 + +MBADHD: LPR BAD HEADER + PUSHJ P,LCRR + PUSHJ P,IGFIL + JRST MTR1 + +MBDTHD: TYPE BAD TAPE HEADER + JRST CRDDT + +TRAN: PUSHJ P,REW +TRAN1: JSR INIT + PUSHJ P,CRR + MOVEI I,0 +TRAN2: SKIPGE QACT(I) + PUSHJ P,RESET + CAIGE I,NUNITS-1 + AOJA I,TRAN2 + MOVEI A,5 ;READS FROM TAPE UNIT 5 + PUSHJ P,DUP2 + MOVEI A,TUT + MOVE I,TOU + PUSHJ P,RDTUT + JUMPL T,READC + MOVEI A,MFD + MOVE J,MFDBK + PUSHJ P,READT + +TNAML: PUSHJ P,MAGOP + JRST MREOT + MOVE A,MHFN1 ;DON'T RELOAD DIRECTORIES! + MOVE B,MHFN2 + CAMN A,[SIXBIT/.FILE./] + CAME B,[SIXBIT/(DIR)/] + CAIA + JRST TIGNF + CAMN A,[SIXBIT/M.F.D./] + CAME B,[SIXBIT/(FILE)/] + SKIPA A,MHSNM + JRST TIGNF + PUSHJ P,SIXLPT + PUSHJ P,LSPAC + MOVE A,MHFN1 + PUSHJ P,SIXLPT + PUSHJ P,LSPAC + MOVE A,MHFN2 + PUSHJ P,SIXLPT + PUSHJ P,LSPAC + CLEARM FERRS + MOVE B,MHSNM + MOVE A,MFD+MDNAMP + SETZM IBLK +TMLKP: CAIL A,2000 + JRST TNEWU + SKIPN C,MFD+MNUNAM(A) + JRST TMLKZ + CAMN B,C + JRST TOLDU +TMLKL: ADDI A,LMNBLK + JRST TMLKP + +TMLKZ: MOVEM A,IBLK + JRST TMLKL + +TOLDU: HRREI J,-2000(A) ;CONVERT MFD INDEX TO BLOCK NO + ASH J,-1 + ADD J,NUDS + MOVEM J,UFDTA + MOVEI A,NUSRD + PUSHJ P,READT + CAME B,NUSRD+UDNAME + JRST 4,. + JRST TOLDUR + +TNEWU: MOVE A,[NUSRD,,NUSRD+1] + SETZM NUSRD + BLT A,NUSRD+1777 + MOVEM B,NUSRD+UDNAME + MOVEI A,2000 + MOVEM A,NUSRD+UDNAMP + SKIPE A,IBLK + JRST .+3 + MOVNI A,LMNBLK + ADDB A,MFD+MDNAMP + MOVEM B,MFD+MNUNAM(A) + HRREI J,-2000(A) ;CONVERT MFD INDEX TO BLOCK NO + ASH J,-1 + ADD J,NUDS + MOVEM J,UFDTA +TOLDUR: + MOVE B,MHFN1 + MOVE C,MHFN2 + MOVE A,NUSRD+UDNAMP + SETZM IBLK +TULKP: CAIL A,2000 + JRST TNEWF + MOVSI T,UNCDEL + TDNE T,NUSRD+UNRNDM(A) + JRST TULKD + SKIPN T,NUSRD+UNFN1(A) + JRST TULKZ + CAME B,T + JRST TULKL + CAMN C,NUSRD+UNFN2(A) + JRST TOLDF +TULKL: ADDI A,LUNBLK + JRST TULKP + +TULKZ: SKIPN NUSRD+UNFN2(A) +TULKD: MOVEM A,IBLK + JRST TULKL + +TOLDF: LPR EXISTS + PUSHJ P,LCRR +TIGNF: PUSHJ P,IGFIL + JRST TNAML + +IGFIL: MOVE A,[-2000,,FDBUF] + PUSHJ P,MREAD + SKIPN EOUF + JRST IGFIL + CLEARM EOUF + POPJ P, + +TNEWF: SKIPE A,IBLK + JRST TNEWCK + MOVNI A,LUNBLK + ADDB A,NUSRD+UDNAMP +TNEWCR: MOVE T,NUSRD+UDESCP + IDIVI T,6 + CAIL T,-UDDESC(A) + JRST 4,. + MOVEM B,NUSRD+UNFN1(A) + MOVEM C,NUSRD+UNFN2(A) +DC, MOVEM B,WXWDS+XWFN1 +DC, MOVEM C,WXWDS+XWFN2 + MOVE B,NUSRD+UDNAME +DC, MOVEM B,WXWDS+XWSYSN +DC, SETZM WXWDS+XWBWC + MOVE B,NUSRD+UDESCP + DPB B,[UNDSCP NUSRD+UNRNDM(A)] + MOVE B,MHDATE + MOVEM B,NUSRD+UNDATE(A) + SETOM NUSRD+UNREF(A) + MOVE B,TUT+QPKNUM + DPB B,[UNPKN NUSRD+UNRNDM(A)] + MOVEI A,NUSRD+UNRNDM(A) + HRLI A,(UNWRDC) + MOVEM A,TRNDEP' ;DPB WC OF LAST BLOCK LATER + SETZM CBYT' + SETZM OBLKS' + SETZM IBLK' + SETZM LBLK' + SKIPE LNKFLG + JRST TRNLNK ;JUMP IF APPENDING LINK +TBLKL: +TBLKL1: MOVE A,[-2000,,FDBUF] + PUSHJ P,MREAD + JUMPE T,TBLKL2 +DC, DPB T,[XWAWC WXWDS+XWBWC] + DPB T,TRNDEP ;STORE WORD COUNT IN DIRECTORY + MOVE T,LBLK +DC, DPB T,[XWBLK WXWDS+XWBWC] + AOS IBLK + PUSHJ P,WRBLK +TBLKL2: SKIPN EOUF + JRST TBLKL + SETZM EOUF + JRST TBDON + +TNEWCK: SKIPN NUSRD+UNFN1(A) + SKIPE NUSRD+UNFN2(A) + JRST 4,. + JRST TNEWCR + +TBDON: PUSHJ P,EBYT + MOVEI J,UDWPH + SKIPN LBLK + PUSHJ P,BYDEP +TBDON1: MOVEI J,0 + PUSHJ P,BYDEP + JRST TMDON + +TRNLNK: MOVE A,LNKSNM + PUSHJ P,TRNLK1 + MOVE A,LNKNM1 + PUSHJ P,TRNLK1 + MOVE A,LNKNM2 + PUSHJ P,TRNLK1 + JRST TBDON1 + +TRNLK1: MOVE K,A + MOVEI A,6 +TRNLK2: MOVEI J,0 + LSHC J,6 + JUMPE J,TRNLK4 + CAIE J,': + CAIN J,'; + JRST [ PUSH P,J + MOVEI J,': + PUSHJ P,BYDEP + POP P,J + JRST .+1 ] + PUSHJ P,BYDEP + SOJG A,TRNLK2 + POPJ P, + +TRNLK4: MOVEI J,'; + JRST BYDEP + +READFN: SKIPA I,FROM +READT: MOVE I,TOU + PUSHJ P,READ +READC: JUMPL T,[JRST 4,.] + POPJ P, + +WRBLK: MOVE J,TUT+QTUTP + AOS TUT+QTUTP + CAML J,TUT+QLASTB + JRST WRLUZ + MOVEM J,LBLK + SETZM TUTLUZ + MOVEI B,TUT + PUSHJ P,TUTPNT + LDB B,J + JUMPN B,WRBLK + MOVEI B,1 + DPB B,J + MOVE J,LBLK + MOVEI A,FDBUF + PUSHJ P,WRITT + SUB J,OBLKS + ADDM J,OBLKS + CAIN J,1 + JRST WRBC + PUSHJ P,EBYT + CAIG J,UDWPH-UDTKMX + JRST WRBS + MOVE J,OBLKS + LSHC J,-NXLBYT*6 + MOVEI U,NXLBYT+1 + ADDI J,UDWPH+1 +WRBL: PUSHJ P,BYDEP + LSHC J,6 + SOJG U,WRBL + POPJ P, + +WRLUZ: SETCMB J,TUTLUZ' + JUMPE J,WRLUZ1 + MOVE J,TUT+QSWAPA + CAMGE J,TUT+QFRSTB + MOVE J,TUT+QFRSTB + MOVEM J,TUT+QTUTP + JRST WRBLK + +WRLUZ1: TYPE DISK FULL + SKIPN NOLPT + X LCRR + JRST CRDDT + +WRBS: ADDI J,UDTKMX-1 +BYDEP: MOVE T,NUSRD+UDESCP + AOS NUSRD+UDESCP + IDIVI T,6 + ADDI T,UDDESC + CAML T,NUSRD+UDNAMP + JRST 4,. + ADDI T,NUSRD + HLL T,QBTBL(W) + DPB J,T + POPJ P, + +WRBC: AOS J,CBYT + CAIGE J,UDTKMX + POPJ P, +EBYT: PUSH P,J + SKIPN J,CBYT + JRST POPJJ + PUSHJ P,BYDEP + SETZM CBYT +POPJJ: POP P,J + POPJ P, + + +TMDON: MOVE J,[WXWDS,,WXWDS+1] + SETZM WXWDS + BLT J,WXWDS+3 + MOVE A,TUT+QTUTP + IDIVI A,NBLKSC + IMULI A,NBLKSC + MOVEM A,TUT+QTUTP + MOVEI A,TUT + MOVE I,TOU + PUSHJ P,WRTUT + MOVEI I,0 +TMDON2: SKIPL QACT(I) + JRST TMDON1 + MOVE J,MFDBK + MOVEI A,MFD + PUSHJ P,WRITE + MOVE J,UFDTA + MOVEI A,NUSRD + PUSHJ P,WRITE +TMDON1: CAIGE I,NUNITS-1 + AOJA I,TMDON2 + SKIPN FERRS + LPR OK + PUSHJ P,LCRR + JRST TNAML + +SUBTTL UCOP - COPY DIRECTORIES FROM DRIVE TO DRIVE + +UCOP: JSR INIT + TYPE COPY DIRS + PUSHJ P,DUP1 + MOVEI A,D0 + MOVE J,MFDBK + PUSHJ P,READFN + PUSHJ P,WRITT + MOVEI Q,2000 +UCOPL: SUBI Q,LMNBLK + CAMGE Q,D0+MDNAMP + JRST DDT + SKIPN B,D0(Q) + JRST UCOPL + HRREI J,-2000(Q) ;CONVERT MFD INDEX TO BLOCK NO + ASH J,-1 + ADD J,NUDS + MOVEI A,OUSRD + PUSHJ P,READFN + CAME B,OUSRD+UDNAME + JRST 4,. + PUSHJ P,WRITT + JUMPL T,WRERR + JRST UCOPL + +SUBTTL SPKID - SET PACK ID IN TUT + +SPKID: JSR INIT + CAIA +SPKID0: X CRR + UNTMES SET PACK ID ON UNIT # + X NTYI + JRST SPKID0 + CAIL A,NUNITS + JRST SPKID0 + X CRR + MOVE I,A + PUSHJ P,RESET + MOVEI A,TUT + PUSHJ P,RDTUT + JUMPL T,ZAPLUZ + TYPE PACK NO= + MOVE A,TUT+QPKNUM + X TDPT + TYPE , CHANGE ID FROM + MOVE A,TUT+QPAKID + X T6B + TYPE TO + X SIXIN + X CRR + JUMPE B,ZAPLUZ + MOVEM B,TUT+QPAKID + MOVEI A,TUT + PUSHJ P,WRTUT + JUMPL T,ZAPLUZ + JRST DDT + SUBTTL REMAP - REASSIGN PACK#S AND FIX UFDS + +REMAPP: REPEAT 40, -1 ;INDEX BY PACK #. LH=NEW PACK #, RH=DISK ADDR OFFSET + +REMAP: JSR INIT + UNTMES REMAP THE COPY OF THE UFDS ON UNIT # + PUSHJ P,NTYI + JRST REMAP + X CRR + CAIL A,NUNITS + JRST REMAP + MOVE I,A + MOVEI A,MFD ;GET MFD + MOVE J,MFDBK + PUSHJ P,READ + JUMPL T,ACTUE3 + MOVE Q,MFD+MDNAMP +REMAP1: CAIL Q,2000 ;NEXT UFD + JRST CRDDT + SKIPN B,MFD+MNUNAM(Q) + JRST REMAP9 + MOVEM B,USRNAM + MOVE J,Q + SUBI J,2000 + IDIVI J,LMNBLK + ADD J,NUDS ;UFD BLOCK NUMBER + MOVEI A,OUSRD + PUSHJ P,READ + JUMPL T,CPERR + CAME B,OUSRD+UDNAME + JRST CPERR + MOVE K,OUSRD+UDNAMP +REMAP2: CAIL K,2000 ;NEXT FILE + JRST REMAP6 + MOVSI C,UNLINK + TDNE C,UNRNDM+OUSRD(K) + JRST REMAP5 ;DON'T MANGLE LINKS + LDB C,[UNDSCP UNRNDM+OUSRD(K)] + IDIVI C,UFDBPW + HLL C,QBTBLI(D) + ADDI C,UDDESC+OUSRD ;C HAS DESC POINTER + LDB D,[UNPKN UNRNDM+OUSRD(K)] ;D HAS PK # + SKIPGE A,REMAPP(D) ;GET MAPPING + JRST 4,. ;LOSER FORGOT TO PATCH IT IN + HLRZ D,A ;GET NEW PACK # + DPB D,[UNPKN UNRNDM+OUSRD(K)] ;CHANGE IT + HRRE D,A ;D HAS BLOCK # OFFSET +REMAP3: MOVE H,C + ILDB A,C ;GET DESC + JUMPE A,REMAP5 ;EOF + CAIG A,UDWPH + JRST REMAP3 ;DOESN'T DEPEND ON ABS DISK ADDRESSES + ANDI A,37 ;MASK OUT LOAD-ADDR-BIT +REPEAT NXLBYT,[ + LSH A,UFDBYT + ILDB B,C + ADD A,B +] + ADD A,D ;RELOCATE THE ADDRESS + REPEAT 6,JFCL ;PATCH AREA + MOVE C,H ;GET BACK B.P. TO START OF LOAD-ADDR DESCRIPTOR + MOVE H,[_36+UFDBYT_30+A] +REPEAT NXLBYT+1,[ + ILDB B,H +IFE .RPCNT, ADDI B,40 + IDPB B,C +] + JRST REMAP3 + +REMAP5: ADDI K,LUNBLK + JRST REMAP2 + +REMAP6: MOVEI A,OUSRD + PUSHJ P,WRITE + JUMPL T,WRERR +REMAP9: ADDI Q,LMNBLK + JRST REMAP1 + +SUBTTL ZAP - ZERO DIR BLOCKS, WRITE EMPTY TUT & MFD + +ZAP: JSR INIT + X CRR + UNTMES INIT DIRS ON UNIT # + PUSHJ P,NTYI + JRST ZAP + CAIL A,NUNITS + JRST ZAP + PUSHJ P,CRR + MOVEM A,TOU + MOVE I,A +RP,[ TYPE PACK NO = + X DTYI ;IF RP, NO PK # IN HARDWARE, GET IT FROM HUMAN + X CRR + MOVEM A,PKNUM(I) +] PUSHJ P,RESET ;IF DC OR RH, WILL USE PACK # FROM HARDWARE + MOVE A,[WXWDS-1,,WXWDS] + BLT A,WXWDS+3 + SETZM MFD ;INIT ALL BLOCKS TO ZERO + MOVE A,[MFD,,MFD+1] + BLT A,MFD+1777 + MOVN J,NUDS ;GET AOBJN PTR TO UFD BLOCKS + HRLZ J,J +KL, ADD J,[2,,2] ;PROTECT KLDCP? + MOVEI A,MFD +ZAPL: PUSHJ P,WRITE + JUMPL T,ZAPLUZ + AOBJN J,ZAPL + +DC,[ CONO DC0,DCCSET+DCDENB + DATAO DC0,[DJMP DZAP] + CONSZ DC0,DSSACT + JUMPA .-1 + CONSO DC0,DSSERR +];DC + JRST MARK69 + +ZAPLUZ: TYPE LOSE + JRST CRDDT + +DC,[ +DZAP: DWRITE ;ZERO READ-IN BLOCK + DCSKIP (-LRIBLK_2&37774) + DHLT +];DC + + SUBTTL SIMPLE DISK TESTS + +;THIS ONE JUST WRITES A SINGLE BLOCK, READS IT BACK, AND CHECKS THAT IT'S THE SAME. +DSKTST: JSR INIT + SETOM HCRASH ;DON'T DO ERROR RETRY + TYPE TEST UNIT # + X NTYI + JRST DSKTST + X CRR + CAIL A,NUNITS + JRST DSKTST + MOVE I,A + TYPE GOT A SCRATCH PACK ON UNIT # + X TOPT + TYPE ? + X Y.OR.N + JRST CRDDT +DSKTS0: X RESET + MOVEI J,NBLKSC*15. ;RANDOMLY USE CYLINDER 15. + MOVSI A,-2000 + MOVEI B,1 ;FIRST PART OF PATTERN IS FLOATING 1S +DSKT0A: MOVEM B,D0(A) + LSH B,1 + SKIPE B + AOBJN A,DSKT0A + HRROI B,-2 ;NEXT IS FLOATING 0S +DSKT0B: MOVEM B,D0(A) + JUMPGE B,DSKT0C + LSH B,1 + AOS B + AOBJN A,DSKT0B +DSKT0C: MOVEM A,D0(A) ;REST IS AN ADDRESS PATTERN + AOBJN A,DSKT0C + MOVEI A,D0 + X WRITE + JUMPL T,WRERR +DSKTS1: MOVEI A,D1 + X READ + PUSHJ P,TYIPSE + MOVSI B,-2000 +DSKT1A: MOVE A,D1(B) + CAMN A,D0(B) +DSKTS2: AOBJN B,DSKT1A + JUMP DSKTS4 ;CHANGE TO JUMPA FOR NO TYPEOUT + JUMPGE B,DSKTS3 ;JUMP IF COMPARED ALL + HRRZ A,B + X TOPT + TYPE / + MOVE A,D0(B) + X THWO + X TSPAC + MOVE A,D1(B) + X THWO + X TSPAC + MOVE A,D0(B) + XOR A,D1(B) + X THWO + X CRR + JRST DSKTS2 + +DSKTS3: JUMPGE T,DSKTS1 ;AFTER PRINTING COMPARISON, IF DISK NOTICED ERROR + X GSTS ; ALSO PRINT THAT + JRST DSKTS1 + +DSKTS4: DATAO LIGHTS,[0] + JUMPGE B,DSKTS1 + MOVE A,B + XOR A,CYLBUF(B) + DATAO LIGHTS,A + JRST DSKTS2 + +;SEEK TEST. THIS LOOPS OVER ALL HEADS, AND OPTIONALLY LOOPS OVER DIFFERENT +; LENGTH SEEKS. IT DOESN'T WRITE, BUT IS A TEST OF SEEKING AND SEARCHING. +;SETOM HCRASH IF YOU WANT TO DO NO ERROR RETRIES ON READ/SEARCH ERRORS +;(SEEK INCOMPLETES WILL ALWAYS BE RETRIED.) + +SEKTST: JSR INIT + TYPE SEEK TEST UNIT # + X NTYI + JRST SEKTST + X CRR + CAIL A,NUNITS + JRST SEKTST + MOVE I,A + X RESET + TYPE ALWAYS DO FULL LENGTH SEEKS? + SETZM SEKINC + MOVEI A,10.*NBLKSC + X Y.OR.N + MOVEM A,SEKINC' ;IF NO, DO DECREASING LENGTH SEEKS +SEKTS0: +RP,[ + MOVSI A,(DNOOPC) ;DETERMINE HOW MANY CYLINDERS THIS DRIVE + DPB I,[DUNFLD A] + DATAO DPC,A + DATAI DPC,B + MOVEI A,*NBLKSC ;RP02 + TRNE B,2000 + MOVEI A,*NBLKSC ;RP03 +];RP +.ELSE MOVEI A,*NBLKSC +IFN T300P,[ + CAIL I,T300P + MOVEI A,*NBLKC1 ;T-300 +];T300P + MOVEM A,SEKCY2' + SETZM SEKCY1' +SEKTS1: SETZM SEKHDN' ;RESET HEAD +SEKTS2: MOVE J,SEKCY1 ;BLOCK ADDRESS OF OUTER CYLINDER + ADD J,SEKHDN ;SELECT A BLOCK ON THE DESIRED HEAD + MOVEI A,CYLBUF + X READ ;READ IT + SKIPGE T +SEKTS3: X GSTS ;JFCL THIS IF YOU DON'T WANT ERROR MESSAGES + MOVE J,SEKCY2 ;BLOCK ADDRESS OF INNER CYLINDER + ADD J,SEKHDN ;SELECT SAME HEAD + MOVEI A,CYLBUF + X READ + SKIPGE T + XCT SEKTS3 + PUSHJ P,TYIPSE + MOVEI J,NSECS/SECBLK ;ADVANCE TO NEXT HEAD + ADDB J,SEKHDN + CAIGE J,NBLKSC ;SKIP IF TOUCHED ALL HEADS + JRST SEKTS2 + MOVN B,SEKINC ;YES, CHANGE CYLINDERS + ADDB B,SEKCY2 + MOVE C,SEKINC + ADDB C,SEKCY1 + CAMG C,B + JRST SEKTS1 + JRST SEKTS0 ;RECYCLE + +THWO: PUSH P,A + PUSH P,B + TLNN A,-1 + JRST THWO1 + HLRZS A + X TOPT + TYPE ,, + HRRZ A,-1(P) +THWO1: X TOPT + POP P,B + POP P,A + POPJ P, + DC,[ + SUBTTL DC-10 PACK FORMATTING +MARK: JSR INIT + X CRR + UNTMES FORMAT PACK ON UNIT # + PUSHJ P,NTYI + JRST MARK + CAIL A,NUNITS + JRST MARK + PUSHJ P,CRR + HRRZ TT,QTRAN(A) + CONO DC1,(TT) ;SETUP DRIVE # FOR LATENCY TIMER + MOVEM A,TOU + MOVE I,A + PUSHJ P,RECAL + CONSO DC1,DFUNSF\DOFFL + JRST MARK1 + TYPE DRIVE OK? + JRST CRDDT + +MARK1: MOVE A,[DSPC+DSCWIM+DSWIDX+DSWNUL] + MOVEM A,CYLBUF + MOVEI D,CYLBUF+1 + PUSHJ P,RDLAT ;READ LATENCY TIMER + JUMPE A,.-1 +MARK1A: CONI DC1,A + CONI DC1,C + LDB A,[DSLAT A] + LDB C,[DSLAT C] + CAME A,C + JRST MARK1A + JUMPN A,[MOVE B,A + JRST MARK1A] +IFN 0,[ ;THIS HARDWARE HAS BEEN BROKEN FOR YEARS + PUSH P,B + MOVE A,B + IDIVI A,10. ;NO. OF MILLISECONDS + PUSH P,B + PUSHJ P,TDPT + MOVEI A,". + PUSHJ P,TYO + POP P,A + ADDI A,"0 + PUSHJ P,TYO + TYPE MILLISECONDS ROTATION TIME + PUSHJ P,CRR + POP P,B + CAIGE B,254. ;LIKELY JUST NO INDEX ON THIS PACK + JRST MARK1B + TYPE TOO DAMN LONG TO BE CREDIBLE, USING 24.5 MS. + PUSHJ P,CRR +];IFN 0 + MOVEI B,245. +MARK1B: IMULI B,1000 ;CONVERT TO NUMBER OF BITS/TRACK + IDIVI B,36. ;NO. OF WORDS PER SECTOR + AOJ B, + MOVEM B,MAXT' + SETZ A, + PUSHJ P,STOBLK ;ENOUGH ONES TO WIPE OUT THIS TRACK + MOVE J,MAXT + IDIVI J,NSECS + CAIL K,NSECS/2 + AOJ J, ;INTER-SECTOR GAP LENGTH + SUBI J,3+3+7+3011 ;HEADER CODE+HEADER DATA+"ONES"+BLOCK+CHECKSUM + MOVEI Q,NSECS +MARK1C: MOVEI B,(D) + HRLI B,HBLK ;SETUP COPYS FOR HEADER PREAMBLE,DATA,POSTAMBLE + ADDI D,3 + BLT B,-1(D) + MOVNI B,-NSECS(Q) + IMULI B,3 + ADDI B,DHEDR + HRRM B,-2(D) ;POINT COPY TO THIS SECTORS ENCODED DATA + MOVEI B,103. ;103 BLOCKS OF 10 ZEROS (ENCODED) + MOVE A,[QCOPY EZERS,15.,] + PUSHJ P,STBLK + SOJLE Q,MARK1D + MOVE B,J ;ENOUGH ONES TO FILL OUT REMAINING PART OF SECTOR + PUSHJ P,STOBLK + JRST MARK1C + +;SETUP STUFF FOR POSSIBLY WRITING READIN BLOCK +MARK1D: MOVE A,[QCOPY EONES,3,] + MOVEM A,(D) + AOJ D, + MOVSI A,(DOPR+DOHXFR) + MOVEM A,(D) + MOVEM D,RIWP' + ADDI D,2 + MOVE B,J + SUBI B,3+3+7+LRIBLK*3/2+3 ;HEADER+LRIBLK+CHECKSUM + LSH B,-1 + SUBI B,3*3 + PUSHJ P,STOBLK + MOVEI B,(D) + HRLI B,WRTRI + ADDI D,5 + BLT B,-1(D) + MOVSI A,(DJMP) ;PATCH JUMP AROUND RIBLK CODE, WILL BE CLOBBERED FOR BLOCK 0 ONLY + ADDI A,(D) + MOVE B,RIWP + MOVEM A,1(B) + MOVEI B,(D) + MOVEM B,ENDP' + AOS ENDP + HRLI B,RCBLK + ADDI D,5 + BLT B,-1(D) + MOVEI B,-3(D) ;PATCH AOJN .-1 ADDRESS + HRRM B,-2(D) + TYPE PACK NO = + PUSHJ P,DTYI + PUSHJ P,CRR + MOVE I,TOU + MOVEM A,PKNUM(I) + MOVE I,[440300,,RIHEDR] ;ENCODE READIN HEADER + PUSHJ P,ENCI + MOVEI I,RIHED0 + PUSHJ P,HCOMP + MOVEI J,/NSECS-1 + MOVEM J,TRKN' + ;SO FAR +;WRITE IMAGE COMMAND - (START AT SECTOR PULSE) +;COPY ;ENOUGH TO WIPE OUT FULL TRACK +;(THEN FOR EACH SECTOR): + +;HEADER PREAMBLE +; ONES FOLLWED BY SINGLE ZERO +; 8 BYTES OF 10101 +; TWO 28 BIT HEADER WORDS +; A SERIES OF ONES FOLLWED BY 01 +;ENCODED ZEROS FOR DATA BLOCK (2004) WORDS + 2 WORDS CHECKSUM +;ENOUGH ENCODED ONES TO FILL OUT REST OF SECTOR (EXCEPT ON LAST SECTOR) + +;AFTER LAST SECTOR +;A FEW ONES +; NORMALLY: FOR BLOCK 0: +;RIWP: HANG FOR END OF TRANSFER WRITE ONES +; JUMP AROUND WRITE READIN WRITE ONES +; READIN HEADER PREAMBLE +; READIN HEADER +; READIN HEADER POSTAMBLE +; READIN BLOCK +; ONES TO PAD OUT REST OF TRACK +; DALU SETUP CONTROL COUNTER +;ENDP: READ COMPARE COMMAND +; COPY 4 WORDS ZEROS +; AOJN CC,.-1 +; HALT + +MARK2: MOVEI K,5 + MOVEM K,NTRYS' + SETZM DHED0 + CAIL J,NBLKS/NSECS + JRST MARK2C + MOVE I,TOU + MOVE A,PKNUM(I) + DPB A,[DPKID DHED0] ;PACK ID FOR HEADER + DPB A,[DPKID @ENDP] ;PACK ID FOR READ-COMPARE COMMAND + JUMPN J,MARK2C + MOVE B,RIWP + MOVE A,[QCOPY EONES,3,] + MOVEM A,(B) + MOVEM A,1(B) +MARK2C: IDIVI J,NHEDS + PUSH P,J + MOVE W,TOU + SKIPGE QTRAN(W) + ADDI J,NCYLS+XCYLS ;OFFSET IF DOUBLE SIZE PHYSICAL PACK +IRP A,,[CYLBUF,@ENDP,DHED0] ;SETUP INITIAL WRITE-IMAGE COMMAND + DPB J,[DCYL A] ; " READ-COMPARE COMMAND + DPB K,[DSURF A] ; " HEADER WORD +TERMIN + POP P,J ;VIRTUAL CYLINDER # + MOVEI W,0 + DPB W,[DHNXAD DHED1] + MOVEI W,1 ;END OF TRACK + CAIN K,NHEDS-1 + MOVEI W,2 ;END OF CYLINDER + CAIE J,NCYLS-1 + CAIN J,NCYLS+XCYLS-1 + TRO W,1 ;END OF DISK + MOVE I,[440300,,DHEDR] + PUSHJ P,ENCI + MOVEI I,DHED0 + MOVEI Q,NSECS +MARK2B: CAIN Q,1 ;PUT IN INCREMENT CODE + DPB W,[DHNXAD DHED1] + PUSHJ P,HCOMP ;ENCODE HEADERS + AOS DHED0 + SOJG Q,MARK2B +MARK2A: CONO DC0,DCCSET\DCDENB + DATAO DC0,[DJMP CYLBUF] + MOVE A,[DWLUP,,14] + BLT A,16 + JRST 14 ;WAIT IN AC'S FOR DISC, THEN FALL THRU +MARK2D: CONSO DC0,DSSERR + JRST MARK4 + CONSZ DC1,DCPERR\DNXM\DDOBSY + JRST MARK3A + CONSZ DC1,DPROT + JRST MARK3B + CONSZ DC1,DOFFL\DFUNSF + JRST MARK3C + CONSO DC1,DWTHER\DCKSER\DOVRRN\DRCER\DRLNER + JRST MARK3D +MTROV: SOSLE NTRYS + JRST MARK2A + CONSZ DC1,DOVRRN + JRST MARK3A + TYPE DISK BAD + JRST CRDDT + +DWLUP: CONSZ DC0,DSSACT + JRST 14 + JRST MARK2D + +MARK3A: TYPE MACHINE LOSSAGE + JRST CRDDT + +MARK3B: TYPE NOT WRT ENABLED + JRST CRDDT + +MARK3C: TYPE DRIVE LOSSAGE + JRST CRDDT + +MARK3D: TYPE CONTROLLER LOSSAGE + JRST CRDDT + +MARK4: SOSL J,TRKN + JRST MARK2 +];DC + +;INITIALIZE MFD AND TUT +; TOU AND PKNUM+n MUST BE ALREADY SET UP + +MARK69: MOVE I,TOU + X MFDINN + TYPE SWAPPING ALLOC = + PUSHJ P,OTYI + PUSHJ P,CRR + X TUTINI + MOVE A,PKNUM(I) + MOVEM A,TUT+QPKNUM + TYPE PACK # = + X TDPT + X CRR + TYPE PACK ID = + PUSHJ P,6TYI + PUSHJ P,CRR + MOVEM B,TUT+QPAKID + MOVEI A,MFD + MOVE J,MFDBK + PUSHJ P,WRITT + JUMPL T,WRERR + MOVE A,TUT+QSWAPA ;SET UP FREE SPACE POINTER + CAMGE A,NUDS + MOVE A,NUDS + ADDI A,NBLKSC-1 ;JUST IN CASE QSWAPA NOT ON CYLINDER BOUNDARY + IDIVI A,NBLKSC + IMULI A,NBLKSC + MOVEM A,TUT+QTUTP + MOVEI A,TUT + PUSHJ P,WRTUT + JUMPL T,WRERR + JRST DDT + +6TYI: MOVE C,[440600,,B] + MOVEI B,0 +6TYL: PUSHJ P,TYI + SUBI A,40 + JUMPLE A,CPOPJ + TLNE C,770000 + IDPB A,C + JRST 6TYL + DC,[ +HCOMP: SETOM HPAR' + MOVEI J,(I) + HRLI J,-2 +HCOMP1: MOVEI B,14. + MOVE A,(J) + XORM A,HPAR + LSH A,-2 + SOJG B,.-2 + AOBJN J,HCOMP1 + + MOVE B,(I) + PUSHJ P,ENCH + MOVE B,HPAR + ANDI B,3 + LSH B,20. + XORB B,1(I) + PUSHJ P,ENCH + MOVSI B,770000 +HCOMP2: TDNN B,DSKBP + POPJ P, + PUSHJ P,ENCDO + JRST HCOMP2 + +ENCO: SKIPA A,C1 +ENCZ: MOVEI A,0 +ENC: ANDI A,1 + HRRZ T,ENCS' + JRST @ENCT(T) + +ENCT: ENC1 + ENC2 + ENC1 + ENCZ2 + +ENCDO: SKIPA A,[3] +ENCDZ: MOVEI A,0 +ENCD: ANDI A,3 + HRRZ T,ENCS + JRST @ENCDT(T) + +ENCDT: ENC2A + [JRST 4,.] + ENCZ2A + [JRST 4,.] + +ENC1: HRLM A,ENCS +ENC1A: AOS ENCS + POPJ P, + +ENC2: ROT A,-1 + HLR A,ENCS + ROT A,2 + JRST ENC2B +ENC2A: LSH A,1 + AOS ENCS +ENC2B: JUMPE A,ENC1A +C1: TRO A,1 + IDPB A,DSKBP' +ENC3: SETZM ENCS + POPJ P, + +ENCZ2: ROT A,-1 + HLR A,ENCS + JRST .+2 +ENCZ2A: ROT A,-1 + ASH A,2 + TRO A,2 + IDPB A,DSKBP + ROT A,2 + TRO A,5 + IDPB A,DSKBP + JRST ENC3 + +ENCH: LSH B,36.-28. + SKIPA C,[14.] +ENCW: MOVEI C,18. + LSHC A,2 + PUSHJ P,ENCD + SOJG C,.-2 + POPJ P, + +ENCI: MOVEM I,DSKBP + SETZM ENCS + POPJ P, + +RDLAT: CONI DC1,A ;READ LATENCY TIMER INTO A + LDB A,[DSLAT A] +RDLAT2: MOVEM A,T + CONI DC1,A + LDB A,[DSLAT A] + CAME A,T + JRST RDLAT2 + POPJ P, + +STBLK: MOVEM A,(D) ;STORE C(A) IN B WORDS AT D + SOJLE B,[AOJA D,CPOPJ] + HRLI D,1(D) + ADDI B,1(D) + MOVS D,D + EXCH B,D + BLT B,-1(D) + POPJ P, + +STOBLK: MOVE A,[QCOPY EONES,LOBLK,] + IDIVI B,LOBLK + JUMPE B,STOBL3 ;LESS THAN ONE BLOCK NEEDED?? + JUMPE C,STOBL2 + CAIL C,3 + JRST STOBL2 + SOJ B, + ADDI C,LOBLK +STOBL2: PUSHJ P,STBLK +STOBL3: CAIGE C,3 + MOVEI C,3 + MOVNI C,(C) + DPB C,[DCWC A] + MOVEM A,(D) + AOJA D,CPOPJ + +HBLK: QCOPY PREAMB,3, ;NORMAL HEADER + QCOPY .,3, + QCOPY POSTMB,7, + +WRTRI: QCOPY PREAMB,3, ;READIN HEADER, DATA BLOCK + QCOPY RIHEDR,3, + QCOPY POSTMB,7, + QCOPY EZERS,, + QCOPY EONES,3, + +RCBLK: DALU+DLCC+DLLB -401*NSECS(3) ;READ COMPARE "LOOP" FOR DATA WORDS + DRCC + QCOPY ZERS,4 + DJMP+DAOJNC . + DHLT + +LOBLK==60 + +DHED0: 0 +DHED1: -2004&37777 +DHEDR: BLOCK 3*NSECS + + +RIHED0: 0 +RIHED1: -LRIBLK&37777 +RIHEDR: BLOCK 3 + +EZERS: REPEAT LRIBLK*3/2+3,252525252525 + +EONES: REPEAT LOBLK+3,-1 + +PREAMB: -1 ;ONES + -26 ;ONES...0.1010 + 655326553265 ;1.10101.10101.10101.10101.10101.10101.10101 + +POSTMB: REPEAT 6,-1 ;ONES...01 + -3 + +ZERS: BLOCK 4 +];DC + +RH,[ + SUBTTL RH-10 PACK FORMATTING + +MARK: JSR INIT + SETZM CERRS +KL,[ SWPUA ;TURN THE CACHE OFF + CONSZ APR,200000 + JRST .-1 + CONI PAG,A + TRZ A,600000 + CONO PAG,(A) +];KL + X CRR + UNTMES FORMAT PACK ON UNIT # + X NTYI + JRST MARK + CAIL A,NUNITS + JRST MARK + X CRR + MOVE I,A + MOVEM I,TOU + SETOM MARKF + PUSHJ P,RESET + SETZM MARKF + TYPE ARE YOU SURE YOU WANT TO FORMAT PACK ON DRIVE # + X TOPT + TYPE ? + X TYI + X CRR + CAIE A,"Y + JRST DDT + TYPE PACK NO = + PUSHJ P,DTYI + PUSHJ P,CRR + MOVEM A,PKNUM(I) + MOVSI A,%HRSER ;GET DRIVE SERIAL NUMBER + PUSHJ P,RHGET + JRST RHMKER + HRLZ D,A + TLZ D,600000 ;FIRST "KEY" WORD IS SERIAL NO OF DRIVE FORMATTED ON + HRR D,PKNUM(I) ;SECOND "KEY" WORD IS I.T.S. PACK NUMBER + SETZB A,B ;GENERATE PATTERN FOR SURFACE +RHFMP1: MOVEM B,CYLBUF(A) ;CYL 0 TRACK 0 SECTOR (B) IS FIRST HEADER WORD + MOVEM D,CYLBUF+1(A) ;PUT DRIVE SERIAL NUMBER IN 3.1-4.7 OF HDR WD 2 + ADDI A,2 + SETZB C,H ;FILL SECTOR WITH WORST CASE PATTERN +RHFMP2: MOVE T,RHWC(H) + MOVEM T,CYLBUF(A) + AOS H + CAIL H,RHWCL + MOVEI H,0 + AOS A + CAIGE C,200-1 + AOJA C,RHFMP2 + CAIGE B,NSECS-1 ;DO NEXT SECTOR + AOJA B,RHFMP1 + CAIE A,202*NSECS + JRST 4,. ;WRONG AMOUNT OF CRUFT GENERATED + MOVE A,[-202*NSECS_4,,CYLBUF-1] ;SET UP IOWD + MOVEM A,SLVIOWD + SETZM SLVIOWD+1 + MOVEI A,SLVIOWD + MOVEM A,SLVICWA + JRST RHFMT0 ;GO FORMAT + +RHWC: 726666666676 ;RP04 10-MODE WORST CASE PATTERN + 555555555753 + 333333337266 + 666666765555 + 555557533333 + 333372666666 + 667655555555 + 573333333333 +RHWCL==.-RHWC + +RHMKER: TYPE DISK ERROR + X CRR + PUSHJ P,GSTS + JRST DDT + +RHFMT0: MOVEI J,NCYLS+XCYLS +RHFMT1: SOJL J,RHFMT4 ;LOOP ON CYLINDERS + MOVEI K,NHEDS +RHFMT2: SOJL K,RHFMT1 ;LOOP ON SURFACES + MOVEI B,NSECS ;ADJUST THE HEADER WORDS + MOVEI C,0 +RHFMT3: DPB J,[221100,,CYLBUF(C)] + DPB K,[100500,,CYLBUF(C)] + ADDI C,202 + SOJG B,RHFMT3 + MOVSI A,%HRADR ;SET UP ADDRESS IN DRIVE + DPB K,[$HATRK A] + PUSHJ P,RHSET + JRST RHMKER + MOVSI A,%HRCYL ;LEAVE CYLINDER NUMBER IN RH10 "DIB" LIGHTS + HRR A,J + PUSHJ P,RHSET + JRST RHMKER + SETZM SLVICWA+1 + MOVSI A,%HRCTL ;SET UP WRITE HEADERS AND DATA COMMAND + HRRI A,%HMWHD + MOVEI B,SLVICWA + DPB B,[$HCICWA A] + PUSHJ P,RHSET + JRST RHMKER + CONSO DSK,%HIDONE + JRST .-1 + CONSZ DSK,%HIERR + JRST RHMKER + JRST RHFMT2 + +RHFMT4: TYPE FORMATTING COMPLETE, VERIFICATION BEGINS + X CRR + MOVEI J,NCYLS+XCYLS-1 +RHFMT5: MOVEI A,CYLBUF + PUSHJ P,READCY + JUMPGE T,RHFMT6 + TYPE CYLINDER + MOVE A,J + X TOPT + TYPE IN ERROR + X CRR + X GSTS + X CRR + JRST RHFMT9 + +RHFMT6: SETZB A,H ;VERIFY DATA. RELIES ON SECTOR SIZE BEING +RHFMT7: MOVE B,CYLBUF(A) ; A MULTIPLE OF RHWCL + CAME B,RHWC(H) + PUSHJ P,RHFMT8 + ADDI H,1 + CAIL H,RHWCL + MOVEI H,0 + CAIGE A,200*NSECS + AOJA A,RHFMT7 +RHFMT9: SOJGE J,RHFMT5 + SKIPN A,CERRS + JRST RHFMTX + X TDPT + TYPE ECC-CORRECTED ERRORS DURING VERIFICATION. +RHFMTX: X CRR + JRST MARK69 ;HARDWARE FORMATTED, DO SOFTWARE + +RHFMT8: PUSH P,A + TYPE WORD + X TOPT + TYPE OF CYLINDER + MOVE A,J + X TOPT + TYPE CORRECT + MOVE A,RHWC(H) + X TOPT + TYPE ACTUAL + MOVE A,B + X TOPT + X CRR + JRST POPAJ +];RH + +RP,[ + SUBTTL RP-10 PACK FORMATTING + +MARK: JSR INIT +KL,[ SWPUA ;TURN THE CACHE OFF + CONSZ APR,200000 + JRST .-1 + CONI PAG,A + TRZ A,600000 + CONO PAG,(A) +];KL + X CRR + UNTMES FORMAT PACK ON UNIT # + X NTYI + JRST MARK + CAIL A,NUNITS + JRST MARK + X CRR + MOVE I,A + MOVEM I,TOU + SETOM MARKF + PUSHJ P,RESET + SETZM MARKF + MOVSI A,(DNOOPC) ;DETERMINE TYPE OF DRIVE + DPB I,[DUNFLD A] + DATAO DPC,A + DATAI DPC,A + MOVEI B,"2 + MOVEI C,NCYLS+XCYLS + TRNN A,2000 + JRST .+3 + MOVEI B,"3 + MOVEI C,MCYLS+XCYLS + MOVEM C,LAST + TLNE A,1 + JRST [ TYPE WRITE HEADER LOCKOUT SWITCH IS ON + JRST CRDDT ] + TYPE ARE YOU SURE YOU WANT TO FORMAT PACK ON RP0 + MOVE A,B + X TYO + TYPE # + MOVE A,I + X TOPT + TYPE ? + X TYI + X CRR + CAIE A,"Y + JRST DDT + TYPE PACK NO = + PUSHJ P,DTYI + PUSHJ P,CRR + MOVEM A,PKNUM(I) + SETZB A,B ;GENERATE TEMPLATE TRACK +RPFMP1: MOVEI T,31. ;SYNC ZONE OF 30 ZERO WORDS + SETZM CYLBUF(A) + AOS A + SOJG T,.-2 + AOS CYLBUF-1(A) ;AND ONE WORD CONTAINING 1 IN BIT 35 + MOVEM B,CYLBUF(A) ;THEN ADDRESS WORD +REPEAT 4,SETZM CYLBUF+1+.RPCNT(A) ;THEN ADDR PARITY WORD AND 3 ZERO WORDS SYNC + ADDI A,5 + MOVE T,RPWC ;THEN 128 DATA WORDS OF WORST CASE PATTERN + MOVEM T,CYLBUF(A) + MOVSI T,CYLBUF(A) + HRRI T,CYLBUF+1(A) + BLT T,CYLBUF+177(A) + ADDI A,200 + CAIGE B,NSECS-1 ;DO NEXT SECTOR + AOJA B,RPFMP1 + CAIE A,244*NSECS + JRST 4,. ;WRONG AMOUNT OF CRUFT GENERATED + MOVE A,[-244*NSECS,,CYLBUF-1] ;SET UP IOWD + MOVEM A,SLVIOWD + SETZM SLVIOWD+1 + MOVEI A,SLVIOWD + MOVEM A,SLVICWA + JRST RPFMT0 ;GO FORMAT + +RPMKER: TYPE DISK ERROR + X CRR + PUSHJ P,GSTS + JRST DDT + +RPFMT0: MOVE J,LAST ;HIGHEST CYLINDER # + 1 +RPFMT1: SOJL J,RPFMT4 ;LOOP ON CYLINDERS + MOVEI K,NHEDS +RPFMT2: SOJL K,RPFMT1 ;LOOP ON SURFACES + MOVEI B,NSECS ;ADJUST THE HEADER WORDS + MOVEI C,0 +RPFMT3: DPB J,[121100,,CYLBUF+37(C)] + DPB K,[050500,,CYLBUF+37(C)] + MOVE D,CYLBUF+37(C) ;COMPUTE HEADER PARITY WORD + MOVEI T,36. + MOVSI TT,(SETZ) ;ODD PARITY +RPFMTP: TRNE D,1 + TLC TT,(SETZ) + ROT D,1 + SOJG T,RPFMTP + MOVEM TT,CYLBUF+40(C) + ADDI C,244 + SOJG B,RPFMT3 + MOVSI A,300000 ;WRITE FORMAT + ADDI A,SLVICWA + DPB J,[DCYL A] + ROT J,-8 ;EXTRA BIT FOR RP03 + DPB J,[DCYLXB A] + ROT J,8 + DPB K,[DSURF A] + DPB I,[DUNFLD A] + MOVEM J,RPIOCY + PUSHJ P,SEEK + JRST RPMKER + DATAO DPC,A + CONSO DPC,DONE + JRST .-1 + CONSZ DPC,ALLER + JRST RPMKER + JRST RPFMT2 + +RPFMT4: TYPE FORMATTING COMPLETE, VERIFICATION BEGINS + X CRR + SOS J,LAST +RPFMT5: MOVEI A,CYLBUF + PUSHJ P,READCY + JUMPGE T,RPFMT6 + TYPE CYLINDER + MOVE A,J + X TOPT + TYPE DOESN'T READ -- GIVING UP ON IT. + X CRR + X GSTS + X CRR + JRST RPFMT9 + +RPFMT6: SETZB A,H ;VERIFY DATA. + MOVE D,RPWC + LSH D,1 ;CONTROL DROPS ONE BIT DURING WRITE FORMAT +RPFMT7: MOVE B,CYLBUF(A) + CAME B,D + PUSHJ P,RPFMT8 + CAIGE A,200*NSECS + AOJA A,RPFMT7 +RPFMT9: SOJGE J,RPFMT5 + X CRR + JRST MARK69 ;HARDWARE FORMATTED, DO SOFTWARE + +RPFMT8: PUSH P,A + TYPE WORD + X TOPT + TYPE OF CYLINDER + MOVE A,J + X TOPT + TYPE CORRECT + MOVE A,RPWC + X TOPT + TYPE ACTUAL + MOVE A,B + X TOPT + X CRR + JRST POPAJ + +RPWC: 714533,,462556 ;WORST CASE PATTERN +];RP +CONSTA +];NTS + NTS,[ +SUBTTL MFDR - RECONSTRUCT MFD FROM UFDS + +MFDR: MOVEI P,PDL + PUSHJ P,CRR ;RECONSTRUCT MFD BY GETTING NAMES FROM UFD'S + UNTMES RECONSTRUCT MFD FROM UNIT # + PUSHJ P,NTYI + JRST MFDR + MOVE I,A + PUSHJ P,MFDINN + SETOM IMNFLG + MOVEI J,0 +MFDR1: MOVEI A,TUT + PUSHJ P,READ + JUMPL T,MFDRL + MOVE B,TUT+UDESCP ;LOOK LIKE LEGIT UFD? + TLNE B,-1 + JRST MRUFDL ;SHOULD BE F.S. PNTR + CAIL B,<2000.-11.>*6 + JRST MRUFDL + MOVE B,TUT+UDNAMP + SKIPE TUT+UDNAME ;USER NAME + TLNE B,-1 + JRST MRUFDL ;PNTR TO BEG OF NAME AREA + MOVEI B,(J) ;CONVERT BLOCK NO TO MFD INDEX + SUB B,NUDS + LSH B,1 + ADDI B,2000 + MOVE C,TUT+UDNAME ;USER NAME + MOVEM C,MFD(B) + AOSN IMNFLG + MOVEM B,MFD+MDNAMP + JRST MRUFDW + + +MFDRL: JRST 4,.+1 +MRUFDL: JFCL +MRUFDW: + ADDI J,1 + CAMGE J,NUDS + JRST MFDR1 + TYPE WRITE? + PUSHJ P,TYI + CAIE A,"Y + JRST DDT +MFDWR: MOVEI A,MFD + MOVE J,MFDBK + PUSHJ P,WRITE + JRST DDT +];NTS + +IMNFLG: 0 + +SUBTTL INITIALIZE MFD + +MFDINN: CLEARM MFD + MOVE A,[MFD,,MFD+1] + BLT A,MFD+1777 + MOVE A,[SIXBIT /M.F.D./] + MOVEM A,MFD+MDCHK + MOVE A,NUDS + MOVEM A,MFD+MDNUDS + MOVEI A,2000 + MOVEM A,MFD+MDNAMP + POPJ P, + +SUBTTL INITIALIZE TUT + +;DRIVE NUMBER IN I, SWAPPING ALLOC IN A + +TUTINI: CLEARM TUT + MOVE B,[TUT,,TUT+1] + BLT B,TUT+<2000*MXTUTB>-1 + MOVEM A,TUT+QSWAPA + MOVE K,A + CAMGE K,NUDS + MOVE K,NUDS ;K HAS BASE OF FILE AREA + MOVEI J,NBLKS ;DETERMINE HOW MANY BLOCKS THIS DRIVE +RP,[ MOVSI A,(DNOOPC) + DPB I,[DUNFLD A] ;SELECT DRIVE + DATAO DPC,A + DATAI DPC,A + TRNE A,2000 + MOVEI J,MBLKS ;RP03 HAS MORE BLOCKS +];RP +IFN T300P,[ + CAIL I,T300P + MOVEI J,NBLKS1 +];T300P + MOVEM J,TUT+QLASTB ;LAST REGULAR BLOCK IS LAST TUT'ED +IFN T300P,[ + MOVEI A,<2000*NTUTBL-LTIBLK>*TUTEPW + CAIL I,T300P + MOVEI A,<2000*NTUTB1-LTIBLK>*TUTEPW + SUB J,A +];T300P +.ELSE SUBI J,<2000*NTUTBL-LTIBLK>*TUTEPW ;SUBTRACT MAX NUMBER OF TUTABLE BLOCKS + CAMLE J,K ;IS THERE ROOM FOR ALL OF FILE AREA? + JRST 4,. ;NOPE + SKIPGE J + MOVEI J,0 + MOVEM J,TUT+QFRSTB + MOVEI A,TUT +TUTFIL: MOVEI K,TUTLK ;ENTER HERE FROM SALV1, A -> TUT + MOVSI D,440000+TUTBYT_6 + ADDI D,LTIBLK(A) + MOVE B,NUDS + SUB B,QFRSTB(A) + JUMPLE B,TUTI1A +TUTI1: IDPB K,D ;MARK OUT USER DIR AREA + SOJG B,TUTI1 + +TUTI1A: MOVEI B,(A) + MOVSI D,-LSBTAB +TUTI2: SKIPGE J,SBTAB(D) + JRST TUTI3 ;NOT REALLY THERE + PUSHJ P,TUTPNT + MOVEI K,TUTLK + DPB K,J ;MARK OUT BLOCK +TUTI3: AOBJN D,TUTI2 + MOVE D,NTBL(I) ;MARK OUT TUT (SIZE VARIES) +TUTI4: MOVE J,MFDBK + SUB J,D + PUSHJ P,TUTPNT + MOVEI K,TUTLK + DPB K,J + SOJG D,TUTI4 + POPJ P, + +;TUTPNT - ROUTINE TO ACCESS THE TUT +; CALL WITH BLOCK NUMBER IN J, POINTER TO TUT IN B +; RETURNS WITH BYTE POINTER IN J (0 IF BLOCK NOT TUT'ED) +; K IS CLOBBERED +; +;TUTPNN - SAME BUT CALL WITH DISK NUMBER IN I, CLOBBERS B TO NEW TUT ADDR +; +;TUTPNO - SAME BUT CALL WITH DISK NUMBER IN I, CLOBBERS B TO OLD TUT ADDR + +TUTPNN: SKIPA B,QNTUTO(I) + +TUTPNO: MOVE B,QOTUTO(I) + +TUTPNT: CAMGE J,QLASTB(B) + CAMGE J,QFRSTB(B) + TDZA J,J + CAIA + POPJ P, ;BLOCK NOT TUT'ED, RETURN J=0 + SKIPGE QPKNUM(B) + JRST [ TYPE OLD FORMAT TUT? + JRST ERRDDT ] + SUB J,QFRSTB(B) + IDIVI J,TUTEPW + HLL J,QTTBL(K) + ADDI J,LTIBLK(B) + POPJ P, + SUBTTL MAIN SALVAGER + +GOGO: JRST GOGO0 ;VECTOR OF MYSTERIES +SALVAG: JRST GOGO1 ;(IN CASE UP CREEK WITHOUT SYMBOL TABLE) +CHKR: JRST CHKR0 +NTS,[ + JFCL LPBUST ;-> LPT BUSTED FLAG + JFCL NOQUES ;-> NO QUESTIONS FLAG + JFCL GOODUN ;-> ONLY ROUTINE THAT KNOWS WHICH ARE "RIGHT" PACKS + JFCL GETSTS ;-> ROUTINE TO TYPEOUT CURRENT DISK STATUS + JFCL DSKTST ;-> SIMPLE READ/WRITE TEST + JFCL SEKTST ;-> SIMPLE SEEK TEST (READ ONLY) + JFCL DUP ;-> DISK COPYING ROUTINE + JFCL HCRASH ;-> AS FAST AS POSSIBLE FLAG +];NTS + +GOGO1: JSR INIT + SETOM NOQUES ;IF STARTED BY BEG$G IN ITS, BE FAST. + JRST GOGO2 ;(NO ROUTINE TYPEOUT) + +GOGO0: JSR INIT +GOGO2: SETOM GOGOX ;AUTOMATIC MODE + TYPE SALVAGER. + MOVE A,[.FNAM2] + X T6B + X CRR + MOVEI A,NUNITS-1 + SETOM QACT(A) ;ALL UNITS ACTIVE + SOJGE A,.-1 + PUSHJ P,ACTUN ;ACTIVATE ALL UNITS THAT ARE ON-LINE + PUSHJ P,GOODUN ;MAKE SURE ALL PACKS THAT SHOULD BE MOUNTED ARE + MOVEM I,MDSK ;FIRST ACTIVE UNIT IS DSK TO GET MFD FROM + MOVEM I,UDSK ;.. DSK TO GET UFD'S FROM + PUSHJ P,DRPHAS ;VERIFY THAT DIRECTORIES ON ALL PACKS ARE IN PHASE + SETZM CKFLSW ;DON'T CHECK ALL BLOCKS + JRST SALV1 + +CHKR0: JSR INIT ;ASK QUESTIONS MODE + TYPE SALVAGER. + MOVE A,[.FNAM2] + PUSHJ P,T6B + PUSHJ P,CRR + MOVEI A,NUNITS-1 + SETZM QACT(A) + SOJGE A,.-1 + TYPE ACTIVE UNITS ARE: +CHKR1: PUSHJ P,NTYI + JRST CHKR2 + CAIGE A,NUNITS + SETOM QACT(A) + JRST CHKR1 + +CHKR2: PUSHJ P,CRR + PUSHJ P,ACTUN +CHKR3: UNTMES USE MFD FROM UNIT: + PUSHJ P,NTYI + JRST CHKR3 + CAIGE A,NUNITS + SKIPN QACT(A) + JRST CHKR3 + MOVEM A,MDSK + PUSHJ P,CRR + PUSHJ P,DRPHAS ;VERIFY THAT DIRECTORIES ON ALL PACKS ARE IN PHASE + SETZM CKFLSW + SETZM CKFIX +DC, TYPE CHECK FILES FOR CLOBBERED BLOCKS? +.ELSE TYPE READ ALL BLOCKS OF ALL FILES? + PUSHJ P,TYI + CAIN A,"Y + SETOB A,CKFLSW + PUSHJ P,CRR + JUMPGE A,CHKR4 +DC,[ TYPE FIX POINTERS THEN? + SETOM CKFIX + X Y.OR.N + SETZM CKFIX +];DC +CHKR4: UNTMES GET USR DIRS FROM UNIT: + PUSHJ P,NTYI + JRST CHKR4 + CAIGE A,NUNITS + SKIPN QACT(A) + JRST CHKR4 + PUSHJ P,CRR + MOVEM A,UDSK + JRST SALV1 + +ACTUN: MOVEI C,NUNITS-1 +ACTUN2: SKIPN QACT(C) + JRST ACTUN1 + MOVE I,C + PUSHJ P,RESET + SKIPN QACT(C) ;STILL THERE? + JRST ACTUN1 + MOVE I,C + MOVE A,QOTUTO(I) + PUSHJ P,RDTUT + JUMPL T,ACTUE1 + MOVE I,QOTUTO(C) + MOVE A,QPKNUM(I) + ANDI A,37 + MOVEM A,QPKN(C) + SKIPE NOQUES + JRST ACTUN1 + TYPE UNIT # + MOVE A,C + PUSHJ P,DPT + TYPE ID IS + MOVE A,QPAKID(I) + PUSHJ P,T6B + TYPE PK # + MOVE A,QPKNUM(I) + PUSHJ P,TDPT +IFN DC10P+RH10P,[ + MOVE A,PKNUM(C) + CAMN A,QPKNUM(I) + JRST ACTUN4 +IFN T300P,[ + CAIL C,T300P + JRST ACTUN4 ;PKNUM NOT REALLY SET UP +];T300P + TYPE (HARDWARE SAYS + PUSHJ P,TDPT + TYPE ) +ACTUN4: ] + SKIPN A,QTRSRV(I) + JRST ACTUN5 + CAMN A,[-1] + JRST [ TYPE (RESERVED) + JRST ACTUN5 ] + PUSHJ P,TSPAC + PUSHJ P,SIXTYP + TYPE : +ACTUN5: PUSHJ P,CRR +ACTUN1: SOJGE C,ACTUN2 + SETOM ACTIVE + POPJ P, + +ACTUE1: TYPE Error reading TUT block + PUSHJ P,CRR + PUSHJ P,GSTS + JRST ERRDDT + +ACTUE3: TYPE Error reading MFD block + PUSHJ P,CRR + PUSHJ P,GSTS + JRST ERRDDT +ACTIVE: 0 ;-1 IF ALREADY HAVE RESET DRIVES + +;MAKE SURE ALL NECESSARY PACKS ARE MOUNTED +GOODUN: +NTS,[ MOVEI A,FIRSPK ;AND RETURN MASTER DISK # IN I +GOODN1: MOVEI C,NUNITS-1 +GOODN2: SKIPE QACT(C) + CAME A,QPKN(C) + SOJGE C,GOODN2 + JUMPL C,GOODN3 ;THIS PACK MISSING + CAIGE A,LASTPK + AOJA A,GOODN1 + MOVEI A,LASTPK-FIRSPK+1 ;NUMBER OF PRIMARY PACKS + MOVEI C,NUNITS-1 ;SCAN FOR SECONDARY PACKS +GOODN4: SKIPN QACT(C) + JRST GOODN5 + MOVE B,QOTUTO(C) + SKIPE B,QTRSRV(B) + CAMN B,[-1] + JRST GOODN5 + ADDI A,1 ;THIS SECONDARY PACK IS OK TO HAVE MOUNTED +GOODN5: SOJGE C,GOODN4 +];NTS + MOVEI C,NUNITS-1 ;AND FIND MASTER DISK (LOWEST NUMBERED ACTIVE UNIT) + SKIPE QACT(C) ;ALSO COMPUTE GOOD PACKS - ALL PACKS IN A + JRST [ MOVE I,C + SOJA A,.+1 ] + SOJGE C,.-2 +NTS, JUMPGE A,CPOPJ +NTS, TYPE EXTRA PACKS MOUNTED. +NTS, JRST ERRDDT +TS, POPJ P, + +GOODN3: TYPE PACK # + X TDPT + TYPE NOT MOUNTED + JRST ERRDDT + +TS, DRPHAS: POPJ P, +NTS,[ +;CHECK THAT DIRECTORIES ARE IN PHASE ON ALL PACKS +DRPHAS: MOVEI I,NUNITS-1 +DRPHS1: SKIPN QACT(I) ;FIRST, GET ALL THE MFDS + JRST DRPHS2 + MOVE J,MFDBK + MOVE A,QNTUTO(I) + PUSHJ P,READ + JUMPL T,ACTUE3 +DRPHS2: SOJGE I,DRPHS1 + MOVE I,MDSK ;GET MASTER DISK'S ASCENDING DIRECTORY NUMBER + MOVE A,@QNTUTO(I) .SEE MDNUM + MOVE B,A + SUBI B,1 + MOVEI I,NUNITS-1 ;SEE IF ALL OTHERS ARE THE SAME, OR AT MOST 1 LESS +DRPHS3: SKIPE QACT(I) + JRST [ CAMG B,@QNTUTO(I) .SEE MDNUM + CAMGE A,@QNTUTO(I) .SEE MDNUM + JRST DRPHS6 + JRST .+1 ] + SOJGE I,DRPHS3 + POPJ P, + +DRPHS6: TYPE DIRECTORIES OUT OF PHASE. + X CRR + MOVEI I,0 +DRPHS4: SKIPN QACT(I) + JRST DRPHS5 + UNTMES UNIT # + HRRZ A,I + X TOPT + TYPE PACK # + MOVE A,QPKN(I) + X TDPT + TYPE , MDNUM= + MOVE A,@QNTUTO(I) .SEE MDNUM + X TOPT + X CRR +DRPHS5: CAIGE I,NUNITS-1 + AOJA I,DRPHS4 + TYPE VERIFY THAT THE PROPER PACKS ARE MOUNTED. IF YOU AREN'T SURE, + X CRR + TYPE GET HELP. IF THEY ARE PROPER, AND ONE IS JUST COMING ON-LINE + X CRR + TYPE AFTER BEING OFF FOR A WHILE, YOU WILL HAVE TO UCOP TO IT. + SKIPE GOGOX + JRST ERRDDT + JRST CRR +];NTS + +SALV1: SETZM MFDWRT ;-1 IF MFD MODIFIED (DIRECTORIES DELETED) + SETZM SHARED + MOVEI I,NUNITS-1 +SALV2: SKIPN QACT(I) + JRST SALV3 + HRRZ B,QNTUTO(I) ;ZERO OUT NEW TUT + HRL B,B + SETZM (B) + MOVE A,B + AOS B + BLT B,2000*MXTUTB-1(A) + HRRZ B,QNTUTO(I) ;COPY RANDOM INFO FROM OLD TUT TO NEW + HRL B,QOTUTO(I) + MOVE A,B + BLT A,LTIBLK-1(B) + HRRZ A,QNTUTO(I) + PUSHJ P,TUTFIL ;FILL IN BLOCKS AREA OF TUT +SALV3: SOJGE I,SALV2 + MOVE I,MDSK + MOVEI A,MFD + MOVE J,MFDBK + PUSHJ P,READ + JUMPL T,ACTUE3 + MOVE A,MFD+MDNUDS + CAME A,NUDS + JRST [ TYPE Wrong NUDSL version = + X TDPT + JRST ERRDDT] + MOVE A,MFD+MDCHK + CAME A,[SIXBIT /M.F.D./] + JRST [ TYPE MFD check word garbaged? + X T6B + X CRR + SKIPN GOGOX + X CONTIN + JRST ERRDDT + JRST .+1] + MOVE Q,MFD+MDNAMP + ADDI Q,MFD +MFDLUP: CAIL Q,MFD+2000 + JRST MFDFIN + SKIPN A,MNUNAM(Q) + JRST MFDLU1 + PUSHJ P,USRLUP + SKIPN LFILES + PUSHJ P,DELUSR +MFDLU1: ADDI Q,LMNBLK + JRST MFDLUP + +DELUSR: MOVE A,MNUNAM(Q) + CAMN A,[SIXBIT /.LPTR./] + POPJ P, + PUSHJ P,T6B + TYPE ; NO FILES, USER DIRECTORY DELETED + PUSHJ P,CRR + SETZM MNUNAM(Q) + SETOM MFDWRT + POPJ P, + +USRLUP: MOVEM A,USRNAM + SETZM UFDLOS + SETZM UFDSEE ;-1 IF ANY ERROR OCCURS, PRINT WHOLE UFD + SETZM LFILES + MOVE J,Q + SUBI J,MFD+2000 ;MAP MFD ENTRY INTO UFD BLOCK + IDIVI J,LMNBLK ; -Nth USER DIRECTORY + ADD J,NUDS ;END OF USER DIR AREA - N + PUSH P,Q + PUSH P,UDSK ;SAVE UFD DISK, MIGHT CHANGE IF UFD IS BAD + MOVEM J,DBLK + MOVE I,UDSK +USRLU1: MOVEI A,OUSRD ;COME BACK TO HERE ON TRY NEXT DRIVE + PUSHJ P,READ + JUMPL T,USRLE2 + MOVE Q,OUSRD+UDNAME + CAME Q,USRNAM + JSR USRLE4 + MOVE Q,[OUSRD,,NUSRD] + BLT Q,NUSRD+1777 ;COPY OLD FOR GARBAGE CHECK + MOVEI Q,2000-LUNBLK+OUSRD + MOVEI J,OUSRD + ADD J,UDNAMP(J) ;LOWEST FILE NAME BLOCK + CAIG J,OUSRD+2000 + CAIGE J,OUSRD+UDDESC + JRST USRLE3 ;NAME POINTER OUTSIDE BLOCK! (try next drive) + MOVE T,OUSRD+UDESCP + IDIVI T,6 + ADDI T,OUSRD+UDDESC + CAML T,J + JRST USRLE7 ;NAME AND DESCRIPTOR AREAS OVERLAP (try next drive) + PUSH P,J ; FILE NAME POINTER + +;PER FILE LOOP +DIRL1: CAMGE Q,J + JRST USRFIN + SETOM FILEER ; PRINT FILE NAME ONLY ON FIRST ERROR + SETZM BADFIL ; SET IF BAD RETRIEVAL DISCOVERED + MOVEM Q,LASTQ + SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + CAIA + JRST DIRLUP + AOS LFILES + LDB C,[UNPKN UNRNDM(Q)] + LDB A,[UNDSCP UNRNDM(Q)] + CAML A,OUSRD+UDESCP + JRST DIRLE1 ;POINTS OUTSIDE DESC AREA (ignore) + IDIVI A,6 + ADDI A,OUSRD+UDDESC + HLL A,QBTBLI(B) + TLNE A,400000 + SUB A,[440000,,1] + MOVEI ZR,0 + LDB B,A + JUMPN B,DIRLE2 ;NOT PRECEEDED BY ZERO (ignore) +DIRL2: MOVE N,A + MOVEI J,0 + ILDB B,A + JUMPE B,DIRLE3 ;POINTS TO ZERO (ignore) +DIRL3: MOVE TT,UNRNDM(Q) + TLNE TT,UNLINK + JRST LINK + SETZM NOTUT + PUSHJ P,FINDPK ;FIND WHICH PACK + SKIPL C + SKIPN QACT(C) + SETOM NOTUT ;FILE ON UNMOUNTED PACK, DON'T HACK TUT + MOVEM C,FUNIT + SETZM LSTBLK + SETZM ADRSET +TRLUP: MOVE TT,N + ADDI TT,NUSRD-OUSRD + IDPB ZR,TT + ILDB B,N + JUMPE B,DIRLUP + CAIN B,UDWPH ; WRITE PLACE HOLDER, OR NULL FILE + JRST TRLUP + CAIL B,UDWPH + JRST LOAD + CAILE B,UDTKMX + JRST SKIPF + JRST TLUP + +TLUP: AOS Q +TLUP1: MOVE A,Q + SKIPN ADRSET + JRST DIRLE4 ;NO STARTING BLOCK (ignore untill jmp) + SKIPE NOTUT ;IF NOT ON ACTIVE UNIT, SKIP FILE + JRST CKFL3 + MOVE D,QOTUTO(C) + CAML A,QLASTB(D) + JRST DIRLE5 ;BLOCK OFF DSK (ignore block) + CAMGE A,QFRSTB(D) + JRST DIRLE5 + CAMGE A,NUDS + JRST DIRLE6 ;POINTS TO UFDS (ignore block) +CKFL2A: MOVSI D,-LSBTAB + CAMN A,SBTAB(D) + JRST DIRLE6 ;SPECIAL BLOCK + AOBJN D,.-2 + MOVE D,MFDBK + SUB D,NTBL(C) + CAML A,D + CAMLE A,MFDBK + CAIA + JRST DIRLE6 ;TUT +NTS,[ SKIPGE CKFLSW + PUSHJ P,CKFL +];NTS + MOVEM Q,LSTBLK + SKIPN NOTUT + SKIPN ADRSET + JRST CKFL3 + MOVE D,J ;SEE IF BLOCK LOCKED + SUBI D,NTUT0-OTUT0 ;(LOCK BYTES NOT IN NEW TUT YET) + ILDB D,D + CAIN D,TUTLK + PUSHJ P,DIRLEB + ILDB D,J + SKIPE D + JSR DIRLE7 ;SHARED BLOCK + CAIGE D,TUTMNY + AOS D + DPB D,J + MOVE K,J + SUBI K,NTUT0-OTUT0 + LDB D,K + JUMPE D,DIRLE9 +CKFL3: SOJG B,TLUP + JRST TRLUP + +OLDFIL: SETOM UFDSEE ;PRINT WHOLE UFD LATER + AOSE FILEER + JRST CKFL2A + TYPE !!! Over-writing user-directory area block + MOVE A,Q + X DPT + TYPE , BY + X PNTNAM + JRST CKFL2A + + +CKFL: PUSH P,J + PUSH P,I + SETOM XWDSEE + MOVE J,A + MOVEI A,FDBUF + MOVE I,C + PUSHJ P,READ +CKFLBP: JUMPL T,CKFLE1 +CKFL4: +DC,[ MOVE A,RXWDS+XWSYSN + CAME A,USRNAM + JRST CKFLE2 +CKFL5: LDB A,[XWBLK RXWDS] + CAME A,LSTBLK + JRST CKFL6 +CKFL6A: SKIPE CKFIX ;FIX ERRORS? + SKIPGE XWDSEE ;ANY ERRORS? + JRST CKFL7 + LDB A,[XWAWC RXWDS] + DPB A,[XWAWC WXWDS] + MOVE A,LSTBLK + DPB A,[XWBLK WXWDS] + MOVE A,USRNAM + MOVEM A,WXWDS+XWSYSN + MOVE Q,LASTQ + MOVE A,UNFN1(Q) + MOVEM A,WXWDS+XWFN1 + MOVE A,UNFN2(Q) + MOVEM A,WXWDS+XWFN2 + MOVEI A,FDBUF + PUSHJ P,WRITE + MOVEI A,FDBUF + PUSHJ P,READ + JUMPL T,CKFLE1 + LPR RETRIEVAL NOW: + PUSHJ P,LPTXWD + SETOM XWDSEE + JRST CKFL4 +];DC +CKFL7: POP P,I + POP P,J + POPJ P, + +CKFLE1: PUSHJ P,PNTNAM + TYPE ERROR READING BLOCK +CKFLE3: MOVE A,J + PUSHJ P,DPT + PUSHJ P,CRR + PUSHJ P,PNTXWD + PUSHJ P,GSTS + JRST CKFL4 +DC,[ +CKFLE2: JRST CKFL6A ;JFCL THIS IF YOU HATE ARCHIVES + AOS BADFIL + PUSHJ P,LPTNAM + X LTAB + X LPTXWD + X LTAB + LPR Retrieval User-name differs + LDB A,[XWBLK RXWDS] + CAMN A,LSTBLK + JRST [ X LCRR + JRST CKFL6A] + LPR , + JRST CKFLE4 + +CKFL6: JRST CKFL6A ;JFCL THIS IF YOU HATE ARCHIVES + AOS BADFIL + PUSHJ P,LPTNAM + X LTAB + X LPTXWD + X LTAB +CKFLE4: LPR Chain pointer wrong, Last block= + MOVE A,LSTBLK + PUSHJ P,LOPT + PUSHJ P,LCRR + JRST CKFL6A +];DC + +LOAD: SETOM ADRSET ;B HAS BYTE WHERE UDWPH < BYTE <=77 + ANDCMI B,20 ;DM FUNNY BITS + MOVEI J,-UDWPH-1(B) + MOVEI K,NXLBYT +LOAD1: MOVE TT,N + ADDI TT,NUSRD-OUSRD + IDPB ZR,TT + ILDB B,N + LSH J,6 + ADD J,B + SOJG K,LOAD1 + MOVE Q,J + SKIPE NOTUT + JRST LOAD2 ;THIS DRIVE NOT ACTIVE + MOVE I,C + PUSHJ P,TUTPNN ;GET POINTER TO NEW TUT + ADD J,[TUTBYT_14,,] ;BACK UP FOR ILDB +LOAD2: MOVEI B,1 + JRST TLUP1 + +SKIPF: SUBI B,UDTKMX + IBP J + AOS Q + SOJG B,.-2 + MOVEI B,1 + JRST TLUP + +LINK: MOVE TT,N + ADDI TT,NUSRD-OUSRD + PUSHJ P,LTYPE + JRST DIRLEC + PUSHJ P,LTYPE + JRST DIRLEC + PUSHJ P,LTYPE + JRST DIRLUP + ILDB B,N + JUMPE B,DIRLUP + JRST DIRLE8 ;LINK NOT FOLLOWED BY ZERO (ignore) + +LTYPE: MOVEI B,6 +LTYPE2: IDPB ZR,TT + ILDB A,N + JUMPE A,CPOPJ ;NON SKIP RETURN IF FOLLOWED BY ZERO + CAIN A,': + JRST [ ILDB A,N + IDPB ZR,TT + JRST LTYPE3] + CAIE A,'; +LTYPE3: SOJG B,LTYPE2 + JRST POPJ1 ;SKIP RETURN IF ENDS NATURALLY + +DIRLUP: SKIPN BADFIL + JRST DIRLP1 + TYPE BAD RETRIEVAL: + X PNTNAM +DIRLP1: MOVE Q,LASTQ + MOVE J,(P) + MOVSI A,UNMARK + ANDCAM A,UNRNDM(Q) + SUBI Q,LUNBLK + JRST DIRL1 + +FINDPK: PUSH P,B ;MAP PACK NUMBER IN C, TO UNIT NUMBER + MOVEI B,NUNITS-1 + CAMN C,QPKN(B) + JRST FINDP1 + SOJGE B,.-2 + SETOM C + POP P,B + POPJ P, + +FINDP1: HRRZ C,B + POP P,B + POPJ P, + +USRLE2: TYPE USR DIRECTORY READ ERROR + SETOM FLAG' ;HARDWARE ERROR +USRL2A: PUSHJ P,TSPAC + MOVE A,USRNAM + PUSHJ P,SIXTYP + MOVEI A,"; + PUSHJ P,TYO + PUSHJ P,CRR + SKIPE FLAG + PUSHJ P,GSTS ;PRINT CONTROLLER STATUS + SKIPE GOGOX + JRST ERRDDT + TYPE TRY NEXT DRIVE? + PUSHJ P,TYI + CAIE A,"Y + JRST CRDDT + PUSHJ P,CRR + MOVE I,UDSK +USRL2B: AOS I + CAIL I,NUNITS + SUBI I,NUNITS + SKIPN QACT(I) + JRST USRL2B + MOVEM I,UDSK ;WILL GET POPED BEFORE NEXT USER + SETOM UFDLOS ;CAUSE DIR TO BE WRITTEN ON ALL DRIVES + MOVE J,DBLK + JRST USRLU1 + +USRLE3: TYPE User directory name-pointer scrambled + SETZM FLAG + JRST USRL2A + +USRLE7: TYPE Name area, descriptor area overlap + SETZM FLAG + JRST USRL2A + +USRLE4: 0 ;USR NAME IN DIR DIFFERS + TYPE USER NAME IN DIRECTORY DIFFERS + PUSHJ P,TSPAC + MOVE A,USRNAM + PUSHJ P,T6B + TYPE ; BLOCK + MOVE A,DBLK + X DPT + UNTMES , UNIT + MOVE A,I + PUSHJ P,DPT + TYPE , DIR HAS + X TSPAC + MOVE A,OUSRD+UDNAME + X T6B + PUSHJ P,CRR + SKIPE GOGOX + JRST ERRDDT + TYPE CORRECT IT? (MFD ENTRY TAKEN AS GOOD) + PUSHJ P,TYI + X CRR + CAIE A,"Y + JRST ERRDDT + MOVE A,USRNAM + MOVEM A,OUSRD+UDNAME + MOVEI A,OUSRD + PUSHJ P,WRITE + JRST @USRLE4 + +USRLE5: SETOM UFDSEE + SKIPN GARBF + PUSHJ P,PGARBF + LPR , POINTER= + MOVE A,Q + PUSHJ P,LOPT + LPR , GARBAGE IS + MOVE A,NUSRD(Q) + ANDCAM A,OUSRD(Q) ;CLEAR OUT THE GARBAGE + PUSHJ P,LOPT + PUSHJ P,LCRR + AOJA Q,GARB6 + +PGARBF: LPR GARBAGE IN FREE AREA + PUSHJ P,LCRR + MOVE A,USRNAM + PUSHJ P,L6B + LPR ; Block # + MOVE A,DBLK + PUSHJ P,LOPT + PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDLOS + SETOM GARBF + POPJ P, + +USRLE6: SETOM UFDSEE + SKIPN EXGARB + PUSHJ P,PEXGAR + MOVE A,J + PUSHJ P,LOPT + PUSHJ P,LSPAC + MOVE A,B + PUSHJ P,LOPT + PUSHJ P,LCRR + MOVE TT,Q + SUBI TT,NUSRD-OUSRD + DPB ZR,TT + JRST GARB3 + +PEXGAR: LPR EXTRA GARBAGE IN UFD + PUSHJ P,LCRR + MOVE A,USRNAM + PUSHJ P,L6B + LPR ; Block # + MOVE A,DBLK + PUSHJ P,LOPT + PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDLOS + SETOM EXGARB + POPJ P, + + +PNTNAM: PUSH P,NOLPT + SETOM NOLPT + X LPTNAM + POP P,NOLPT + POPJ P, + +LPTNAM: PUSH P,A ;DIRLE5 ETC. + MOVE A,USRNAM + PUSHJ P,L6B + MOVEI A,"; + PUSHJ P,LTYO + CAIA +LPTFIL: PUSH P,A ;AVOID PDL SCREWAGE + PUSH P,B + PUSH P,C + MOVE B,LASTQ + MOVE A,UNFN1 (B) + PUSHJ P,L6B + PUSHJ P,LSPAC + MOVE A,UNFN2(B) + PUSHJ P,L6B + LDB C,[UNPKN UNRNDM(B)] + LPR PACK + MOVE A,C + X LDPT + X FINDPK ;FIND PACK FILE IS ON + JUMPL C,LPTFI1 + LPR , UNIT # + MOVE A,C + X LDPT +LPTFI1: PUSHJ P,LCRR + INSIRP POP P,[C B A] + POPJ P, + +PNTXWD: PUSH P,NOLPT + SETOM NOLPT + X LPTXWD + POP P,NOLPT + POPJ P, + +LPTXWD: +DC,[ + PUSH P,A + LPR Extra words: Block # + MOVE A,UNIT + X LDPT + MOVEI A,"- + X LTYO + MOVE A,BLK + X LOPT + X LSPAC + MOVE A,RXWDS+XWSYSN + PUSHJ P,L6B + MOVEI A,"; + PUSHJ P,LTYO + MOVE A,RXWDS+XWFN1 + PUSHJ P,L6B + PUSHJ P,LSPAC + MOVE A,RXWDS+XWFN2 + PUSHJ P,L6B + LPR , Chain pointer= + LDB A,[XWBLK RXWDS] + PUSHJ P,LOPT + LPR , active wd cnt= + LDB A,[XWAWC RXWDS] + PUSHJ P,LOPT + PUSHJ P,LCRR + POP P,A +];DC + SETZM XWDSEE .SEE CKFL6A + POPJ P, + DIRLE1: PUSHJ P,LPTNAM + LPR DESC POINTS OUT OF DESC AREA + PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDSEE + JRST DIRLUP + +DIRLE2: PUSHJ P,LPTNAM + LPR FILE NOT PRECEEDED BY ZERO + PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDSEE + JRST DIRL2 + +DIRLE3: PUSHJ P,LPTNAM + LPR FILE POINTS TO ZERO + PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDSEE + JRST DIRL3 + +DIRLE4: PUSHJ P,LPTNAM + LPR STARTING ADDRESS NOT SET +DIRL4A: X LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDSEE + JRST CKFL3 + +DIRLE5: PUSHJ P,LPTNAM + LPR BLOCK POINTS OFF DSK + X LOPT + JRST DIRL4A + +DIRLE6: PUSHJ P,LPTNAM + LPR BLOCK IN RESERVED AREA + X LOPT + JRST DIRL4A + +DIRLE7: 0 + PUSHJ P,LPTNAM + LPR SHARES BLOCK WITH SOME OTHER FILE + X LCRR + AOS SHARED ;SHARED BLOCK FLAG +; SKIPN NOLPT +; SETOM UFDSEE + SETZM SALVRT ;NO AUTOMATIC SYS START + JRST @DIRLE7 + +DIRLEC: PUSHJ P,LPTNAM + LPR LINK NOT THREE NAMES + JRST DIRLED + +DIRLE8: PUSHJ P,LPTNAM + LPR LINK NOT FOLLOWED BY A ZERO +DIRLED: PUSHJ P,LCRR + SKIPE GOGOX + JRST ERRDDT + SETOM UFDSEE + JRST DIRLUP + +DIRLE9: SKIPE NOQUES + JRST CKFL3 + LPR FILE UNPROTECTED IN OLD TUT - + X LPTNAM + LPR Block + MOVE A,Q + X LOPT + X LCRR + JRST CKFL3 + +DIRLEB: PUSHJ P,LPTNAM + LPR FILE CONTAINS LOCKED BLOCK + MOVE A,Q + X LOPT + SETZM SALVRT ;NO AUTO SYS STARTUP + JRST LCRR + +USRFIN: CLEARM GARBF + CLEARM EXGARB + CLEARB ZR,J + MOVE Q,[440600,,NUSRD+UDDESC] +GARB2: CAML J,OUSRD+UDESCP + JRST USRFN2 +GARB4: ILDB B,Q + JUMPN B,USRLE6 ;GARBAGE IN DESCRIPTOR AREA (clear out) +GARB3: AOJA J,GARB2 + +USRFN2: TLNE Q,770000 + JRST GARB4 + MOVEI Q,-NUSRD+1(Q) ;FIRST WORD ABOVE DESCRIPTOR AREA +GARB6: CAML Q,NUSRD+UDNAMP + JRST GARB5 + SKIPN NUSRD(Q) + AOJA Q,GARB6 + JRST USRLE5 ;GARBAGE IN NAME AREA (clear out) + +GARB5: SKIPE UFDSEE + PUSHJ P,UFDPR + SKIPN UFDLOS + JRST USRFN5 + SKIPE NOQUES + JRST GARB5A + TYPE UFD NEEDS UPDATE - WRITE? + X Y.OR.N + JRST USRFN5 +GARB5A: MOVEI A,OUSRD + MOVEI I,NUNITS-1 + MOVE J,DBLK +GARB7: SKIPE QACT(I) + PUSHJ P,WRITE + SOJGE I,GARB7 +USRFN5: POP P,J + POP P,UDSK + POP P,Q + POPJ P, + + +SUBTTL LISTF - DUMP OUT USER DIRECTORY +LISTF: JSR INIT + SKIPL ACTIVE ;ALREADY DID RESET + X ACTUN + X CRR + TYPE USER?= + X SIXIN + X CRR + JUMPE B,DDT + MOVEI I,NUNITS-1 + SETOM FUNIT +LISTF3: SKIPN QACT(I) + JRST LISTF2 + MOVEM I,FUNIT + MOVE A,QNTUTO(I) + PUSHJ P,RDTUT + JUMPL T,[TYPE ERROR READING TUT # + MOVE A,I + X DPT + X CRR + X GSTS + X CONTIN + JRST DDT + JRST .+1] +LISTF2: SOJGE I,LISTF3 + MOVEM B,USRNAM + MOVEI A,MFD + MOVE J,MFDBK + SKIPGE I,FUNIT ;USE FIRST ACTIVE UNIT + JRST LISTF4 ;NO DISKS ACTIVE?? + X READ + JUMPL T,[TYPE ERROR READING MFD + X CRR + X GSTS + X CONTIN + JRST DDT + JRST .+1] + MOVE D,USRNAM + MOVE Q,MFD+MDNAMP +LISTF1: CAIL Q,2000 + JRST [ TYPE USER NOT FOUND - + MOVE A,D + X T6B + JRST CRDDT] + CAME D,MFD(Q) + JRST [ ADDI Q,LMNBLK + JRST LISTF1] + SUBI Q,2000 + IDIVI Q,LMNBLK + HRRZ J,Q + ADD J,NUDS + MOVEM J,DBLK + MOVE I,FUNIT ;USE FIRST ACTIVE UNIT + MOVEI A,OUSRD + X READ + JUMPL T,[TYPE ERROR READING USER DIRECTORY + X CRR + X GSTS + X CONTIN + JRST CRDDT + JRST .+1] + X USEE0 + JRST CRDDT + +CONTIN: TYPE CONTINUE? + X TYI + X CRR + CAIN A,"Y + AOS (P) + POPJ P, + +LISTF4: TYPE NO ACTIVE UNIT TO GET DIR FROM + JRST CRDDT + +UFDPR: SETZM SALVRT ;NO AUTO SYS STARTUP + SKIPN NOLPT + JRST [ TYPE Errors in directory + MOVE A,OUSRD+UDNAME + X T6B + X CRR + JRST .+1 ] +USEE0: MOVE Q,OUSRD+UDNAME + PUSHJ P,LFORM + LPR USER DIRECTORY: + MOVE A,Q + X L6B + MOVEI A,"; + X LTYO + X LCRR + MOVEI J,OUSRD + ADD J,UDNAMP(J) + CAIG J,OUSRD+2000 + CAIGE J,OUSRD+UDDESC + JRST [ LPR UFD NAME AREA POINTER OUT OF RANGE + JRST USEEF ] + MOVE T,OUSRD+UDESCP + IDIVI T,6 + ADDI T,OUSRD+UDDESC + CAML T,J + JRST [ LPR DESCRIPTOR FREE POINTER OVERLAPS NAME AREA + JRST USEEF ] + MOVEM J,LAST + MOVEI Q,OUSRD+2000-LUNBLK +USEE1: CAMGE Q,LAST ;PER FILE LOOP + JRST USEEF + MOVEM Q,LASTQ + SKIPN A,UNFN1(Q) + SKIPE UNFN2(Q) + CAIA + JRST USEELP + X LPTFIL + LDB C,[UNPKN UNRNDM(Q)] + X FINDPK + MOVEM C,FUNIT ;KLUDGE KLUDGE (LOOKS AT TUTS) + LDB A,[UNDSCP UNRNDM(Q)] + CAML A,OUSRD+UDESCP + JRST [ LPR FILE DESCRIPTOR POINTER POINTS OUTSIDE DESCRIPTOR AREA + JRST USEELY ] + IDIVI A,6 + ADDI A,OUSRD+UDDESC + HLL A,QBTBLI(B) + TLNE A,400000 + SUB A,[440000,,1] + LDB B,A + X LTAB + X USBYTE + LPR (INITIAL ZERO) + JUMPN B,[ LPR - IS NOT PRESENT + JRST USEELY ] + X LCRR +USEE2: MOVE N,A + MOVEI J,0 + ILDB B,A ;PEEK AT NEXT BYTE + JUMPE B,[X USBYTE + LPR (FIRST BYTE SHOULD BE NON-ZERO) + JRST USEELY] ;SHOULD BE NON-ZERO + LDB A,[UNDSCP UNRNDM(Q)] + X LOPT ;SHOW DESC ADDR BEFORE FIRST DESC BYTE +USEE3: MOVE TT,UNRNDM(Q) + TLNE TT,UNLINK + JRST USLINK + ;FALLS THROUGH + SETZM ADRSET +USLUP: ILDB B,N + X LTAB + X USBYTE + JUMPE B,[LPR (STOP) + X LCRR + JRST USEELP] + CAIN B,UDWPH + JRST [ LPR (WRITE-PLACE-HOLDER) + X LCRR + JRST USLUP] + CAIL B,UDWPH + JRST USLOAD + CAILE B,UDTKMX + JRST USSKIP + LPR (TAKE-N BLOCKS) +USLP1: AOS Q +USLP2: MOVE A,Q + X LOPT + X LSPAC + SKIPGE TT,FUNIT + JRST USLP3 ;PACK NOT MOUNTED + MOVE TT,QOTUTO(TT) + CAMGE Q,QLASTB(TT) + SKIPN ADRSET + JRST USLPE ;BAD BLOCK + ILDB TT,J ;TUT ENTRY + CAMGE Q,NUDS + JRST USLPE + MOVSI D,-LSBTAB + CAMN Q,SBTAB(D) + JRST USLPE + AOBJN D,.-2 + MOVE A,FUNIT + MOVE D,MFDBK + SUB D,NTBL(A) + CAML Q,MFDBK + CAMLE Q,D + CAIA + JRST USLPE ;OVERLAPS TUT OR MFD + + SKIPL FUNIT ;FILE NOT ON ACTIVE UNIT + CAIN TT,1 + JRST USLP3 + LPR ?? TUT= + MOVE A,TT + X LDPT + LPR ?? +USLP3: SOJG B,USLP1 + X LCRR + JRST USLUP +USLPE: LPR ?? BAD BLOCK # ?? + JRST USLP3 + +USEELP: MOVE Q,LASTQ + SUBI Q,LUNBLK + JRST USEE1 + +USLOAD: SETOM ADRSET + ANDCMI B,20 ;DM FUNNY BITS + MOVEI J,-UDWPH-1(B) + MOVEI K,NXLBYT +USLOD1: ILDB B,N + X USBYTE + LSH J,6 + ADD J,B + SOJG K,USLOD1 + MOVE Q,J + SKIPGE I,FUNIT + TDZA J,J ;NO TUT + PUSHJ P,TUTPNO ;GET POINTER TO OLD TUT + ADD J,[TUTBYT_14,,] ;BACK UP FOR ILDB + LPR (JUMP + MOVE A,Q + X LOPT + LPR ) + MOVEI B,1 + JRST USLP2 + +USSKIP: SUBI B,UDTKMX + LPR (SKIP + MOVE A,B + X LOPT + LPR ) + IBP J + AOS Q + SOJG B,.-2 + MOVEI B,1 + JRST USLP1 + +USLINK: X LTAB + LPR (LINK) + X USLINP + JRST USLIN3 + MOVEI A,"; + X LTYO + X USLINP + JRST USLIN3 + X LSPAC + X USLINP + ADD N,[060000,,] ;ENDS WITH ZERO, RE-READ THE ZERO BYTE + X LCRR + ILDB B,N + X LTAB + X USBYTE + LPR (ZERO) + JUMPE B,USLIN4 + LPR ?? NO END ZERO ?? +USLIN4: X LCRR + JRST USEELP + +USLIN3: LPR ?? ENDS EARLY ?? + JRST USLIN4 + +USLINP: MOVEI B,6 +USLIN2: ILDB A,N + JUMPE A,CPOPJ ;NON SKIP RETURN IF FOLLOWED BY ZERO + CAIN A,'; + JRST POPJ1 ;SKIP RETURN IF ENDS NATURALLY + CAIN A,': ;QUOTE CHAR + ILDB A,N + ADDI A,40 + X LTYO + SOJG B,USLIN2 + JRST POPJ1 ;SKIP RETURN IF ENDS NATURALLY + +USBYTE: PUSH P,A + PUSH P,B + LDB A,[30300,,(P)] + ADDI A,"0 + X LTYO + LDB A,[300,,(P)] + ADDI A,"0 + X LTYO + X LSPAC + POP P,B + POP P,A + POPJ P, + +USEELY: X LCRR +USSELP: MOVE Q,LASTQ + SUBI Q,LUNBLK + JRST USEE1 + +USEEF: X LCRR + X LFORM + POPJ P, + +SUBTTL MAIN SALVAGER - WRITE MFD & TUT + +MFDFIN: MOVEI I,0 +MFDFN0: SKIPE QACT(I) + PUSHJ P,TUTCMP + CAIGE I,NUNITS-1 + AOJA I,MFDFN0 + SKIPN MFDWRT + JRST SHARCK ;MFD DIDN'T HAVE ANY CHANGES +MFDWR0: SKIPE NOQUES + JRST MFDWR1 + TYPE WRITE OUT CHANGES IN MFD? + X Y.OR.N + JRST SHARCK +MFDWR1: MOVE J,MFDBK + MOVEI I,NUNITS-1 +MFDWR2: MOVEI A,MFD + SKIPE T,QACT(I) + PUSHJ P,WRITE + JUMPGE T,MFDWR3 + PUSHJ P,GSTS ;ERROR WRITING MFD + SKIPN GOGOX + JRST MFDWR0 + JRST ERRDDT + +MFDWR3: SOJGE I,MFDWR2 + JRST SHARCK + +TUTCMP: SETZM TUTDFR ;FIRST SEE IF ANY DIFFERENCES + SETZM TTDFPS + SETZM NLKBKS' + SETZM TUTCHG ;MAKE SUMMARY TABLE OF DIFFERENCES + MOVE Q,[TUTCHG,,TUTCHG+1] + BLT Q,TUTCHG+-1 + MOVE Q,QTTBLI + HRR Q,QNTUTO(I) ;NEW B.P. + ADDI Q,LTIBLK + MOVE J,Q + HRR J,QOTUTO(I) ;OLD B.P. + MOVE TT,QFRSTB(J) ;BLOCK NUMBER + MOVE B,QLASTB(J) + SOS B + MOVEM B,TUTHIB' ;HIGHEST BLOCK # + ADDI J,LTIBLK +TUTC1: ILDB B,Q + ILDB D,J + CAMN B,D + JRST TUTC2 + CAIN D,TUTLK + JRST [ MOVE B,D ;IF LOCKED, STAY LOCKED + DPB B,Q + AOS NLKBKS ;COUNT BLOCKS LOCKED DUE TO DISK ERRORS + SKIPN GOGOX + PUSHJ P,LCKRPT ;IN CHKR MODE, REPORT LOCKED BLOCKS + JRST TUTC2 ] + PUSHJ P,TUTC4 +TUTC2: CAMGE TT,TUTHIB + AOJA TT,TUTC1 + SKIPN NOQUES + SKIPN A,NLKBKS + JRST TUTC3 + X TDPT + UNTMES LOCKED BLOCKS ON UNIT # + HRRZ A,I + X DPT + X CRR +TUTC3: SKIPN TUTDFR + POPJ P, ;NO DIFFERENCES THIS TUT + JRST TUTCM0 ;DIFFERENCES, GO HANDLE + +TUTC4: IMULI B,TUTMAX + ADD B,D + MOVE T,QOTUTO(I) ;DON'T LIST TUT CHANGES IN SWAPPING AREA + CAML TT,NUDS + CAML TT,QSWAPA(T) + AOS TUTCHG(B) + AOS TUTDFR + POPJ P, + +TUTCM0: SKIPE NOQUES ;HERE WHEN TUT HAS DIFFERENCES + JRST TUTCM3 ;IF NO QUESTIONS, JUST WRITE + MOVEI A,TUTMAX*TUTMAX-1 ;SEE IF ANY TUT DIFFERENCES NOT IN SWAPPING AREA + SKIPN TUTCHG(A) + SOJGE A,.-1 + JUMPL A,TUTCM4 ;NONE, GO ASK IF SHOULD WRITE + SETZM LINPOS ;OTHERWISE, SUMMARIZE TUT DIFFERENCES + TYPE TUT # + HRRZ A,I + X DPT + MOVEI B,TUTMAX-1 +TUTSM1: MOVEI D,TUTMAX-1 +TUTSM2: MOVE A,B + IMULI A,TUTMAX + ADD A,D + SKIPN A,TUTCHG(A) + JRST TUTSM3 + X TSPAC + X TDPT + X TSPAC + MOVE A,B + X DPT + TYPE _ + MOVE A,D + X DPT + MOVE A,LINPOS + CAIGE A,60. + JRST TUTSM3 + X CRR + SETZM LINPOS +TUTSM3: SOJGE D,TUTSM2 + SOJGE B,TUTSM1 + TYPE , PRINT? + X Y.OR.N + JRST TUTCM4 + +;HERE TO PRINT OUT THE TUT + + SETZM TUTDFR + MOVE Q,QTTBLI + HRR Q,QNTUTO(I) ;NEW B.P. + ADDI Q,LTIBLK + MOVE J,Q + HRR J,QOTUTO(I) ;OLD B.P. + MOVE TT,QFRSTB(J) ;BLOCK NUMBER + MOVE B,QLASTB(J) + SOS B + MOVEM B,TUTHIB' ;HIGHEST BLOCK # + ADDI J,LTIBLK +TUTCM1: ILDB B,Q + ILDB D,J + CAME B,D + JRST TUTDF1 +TUTCM2: CAMGE TT,TUTHIB + AOJA TT,TUTCM1 + + SKIPE TTDFPS + X LCRR + X LFORM ;SOMETHING PRINTED, ADVANCE LPT PAPER +TUTCM4: TYPE TUT # + HRRZ A,I + X DPT + TYPE NEEDS UPDATING - WRITE? + X Y.OR.N + POPJ P, +TUTCM3: + MOVE A,QNTUTO(I) + PUSHJ P,WRTUT + JUMPGE T,CPOPJ + PUSHJ P,GSTS ;ERROR WRITING TUT + SKIPN GOGOX + JRST TUTCM4 + JRST ERRDDT + +TUTMAX=1_TUTBYT + +TUTCHG: BLOCK TUTMAX*TUTMAX + +TUTDF1: MOVE T,QOTUTO(I) + CAML TT,NUDS + CAML TT,QSWAPA(T) + CAIA + JRST TUTCM2 ;IN SWAPPING AREA, IGNORE + PUSHJ P,NEWOLD + PUSH P,[TUTCM2] + AOSL TTDFPS + JRST TUTDF7 ;NO MORE ROOM ON LINE + MOVEI A,40 ;PRINT MULTIPLE FROBS PER LINE + PUSHJ P,LPTR ;SO THE LINE PRINTER WILL GO FASTER + JRST LPTR + +NEWOLD: SKIPN TUTDFR + PUSHJ P,TUTTYP + MOVE A,TT + PUSHJ P,LOPT + PUSHJ P,LSPAC + MOVE A,B + PUSHJ P,LOPT + MOVEI A,"_ + PUSHJ P,LPTR + MOVE A,D + JRST LOPT + +TUTTYP: SETOM TUTDFR + PUSHJ P,LCRR + LPR TUT DIFFERENCES FOR DRIVE # + HRRZ A,I + PUSHJ P,LOPT +TUTDF7: MOVNI A,5 ;START NEW LINE, ROOM FOR 5 BLOCKS IF TTY + SKIPN NOLPT + MOVNI A,9 ;OR 9 IF LPT + MOVEM A,TTDFPS + JRST LCRR + +LCKRPT: TYPE LOCKED BLOCK + HRRZ A,I + X TDPT + MOVEI A,"- + X TYO + MOVE A,TT + X TOPT + X CRR + POPJ P, + +SUBTTL TRACK DOWN SHARED BLOCKS + +SHARCK: SKIPN SHARED + JRST CRDDT ;NO SHARED TRACKS, WE ARE DONE + TYPE SHARED BLOCKS + PUSHJ P,LCRR + LPR LOOKING FOR SHARED BLOCKS + PUSHJ P,LCRR + MOVE I,MDSK + MOVEI A,MFD + MOVE J,MFDBK + PUSHJ P,READ + JUMPL T,ACTUE3 + MOVE Q,MFD+MDNAMP + ADDI Q,MFD +SMFDLP: CAIL Q,MFD+2000 + JRST SHRCKF ;DONE + SKIPN A,MNUNAM(Q) + JRST SMFDL1 + PUSHJ P,SUSRLP +SMFDL1: ADDI Q,LMNBLK + JRST SMFDLP + +SHRCKF: SKIPN GOGOX + JRST CRDDT + JRST ERRDDT + +SUSRLP: HRREI J,-MFD-2000(Q) ;CONVERT MFD INDEX TO BLOCK NUMBER + ASH J,-1 + ADD J,NUDS + MOVEM A,USRNAM + PUSH P,Q + MOVE I,UDSK + PUSH P,UDSK +SUSRL1: MOVEI A,OUSRD + PUSHJ P,READ + JUMPL T,SUSRE2 + MOVEI Q,2000-LUNBLK+OUSRD + MOVEI J,OUSRD + ADD J,UDNAMP(J) + PUSH P,J +SDIRL1: CAMGE Q,J + JRST SUSRFN + MOVEM Q,LASTQ + SKIPE A,UNFN1(Q) + JRST .+3 + SKIPN UNFN2(Q) + JRST SDIRLP + LDB C,[UNPKN UNRNDM(Q)] + LDB A,[UNDSCP UNRNDM(Q)] + IDIVI A,6 + ADDI A,OUSRD+UDDESC + HLL A,QBTBLI(B) + TLNE A,400000 + SUB A,[440000,,1] +SDIRL2: MOVE N,A + MOVEI J,0 + ILDB B,A +SDIRL3: MOVE TT,UNRNDM(Q) + TLNE TT,UNLINK + JRST SDIRLP + PUSHJ P,FINDPK + SKIPL C + SKIPN QACT(C) + JRST SDIRLP + CAIG B,UDWPH ; A LOAD FIRST THING + JRST SDIRLP + +STRLUP: ILDB B,N + JUMPE B,SDIRLP + CAIN B,UDWPH + JRST STRLUP + CAIL B,UDWPH + JRST SLOAD + CAILE B,UDTKMX + JRST SSKIPF + JRST STLUP + +STLUP: AOS Q +STLUP1: ILDB D,J + CAIE D,1 + PUSHJ P,SPNT + SOJG B,STLUP + JRST STRLUP + +SLOAD: ANDCMI B,20 ;DM FUNNY BIT + MOVEI J,-UDWPH-1(B) + MOVEI K,NXLBYT +SLOAD1: ILDB B,N + LSH J,6 + ADD J,B + SOJG K,SLOAD1 + MOVE Q,J + MOVE I,C + PUSHJ P,TUTPNN ;GET PNTR TO TUT + ADD J,[TUTBYT_14,,] ;COMPENSATE FOR ILDB + MOVEI B,1 + JRST STLUP1 + +SSKIPF: SUBI B,UDTKMX + IBP J + AOS Q + SOJG B,.-2 + MOVEI B,1 + JRST STLUP + +SPNT: MOVE A,USRNAM + PUSHJ P,L6B + MOVEI A,"; + PUSHJ P,LTYO + EXCH Q,LASTQ + MOVE A,UNFN1(Q) + PUSHJ P,L6B + PUSHJ P,LSPAC + MOVE A,UNFN2(Q) + PUSHJ P,L6B + PUSHJ P,LSPAC + HRRZ A,C + PUSHJ P,LDPT + MOVEI A,"- + PUSHJ P,LTYO + MOVE A,LASTQ + PUSHJ P,LOPT + LPR , TUT= + MOVE A,D + X LDPT + PUSHJ P,LCRR + EXCH Q,LASTQ + POPJ P, + +SUSRE2: TYPE USER DIRECTORY PARITY ERROR + PUSHJ P,TSPAC + TYPE BLOCK # + MOVEM J,DBLK + MOVE A,J + PUSHJ P,DPT + UNTMES UNIT # + MOVE A,I + PUSHJ P,DPT + PUSHJ P,CRR + PUSHJ P,GSTS + SKIPE GOGOX + JRST ERRDDT + TYPE TRY NEXT DRIVE? + X Y.OR.N + JRST ERRDDT + MOVE I,UDSK +SUSR2B: AOS I + CAIL I,NUNITS + SUBI I,NUNITS + SKIPN QACT(I) + JRST SUSR2B + MOVEM I,UDSK + MOVE J,DBLK + JRST SUSRL1 + +SUSRFN: POP P,J + POP P,UDSK + POP P,Q + POPJ P, + +SDIRLP: MOVE Q,LASTQ + SUBI Q,LUNBLK + MOVE J,(P) + JRST SDIRL1 + +POPBAJ: POP P,B +POPAJ: POP P,A + POPJ P, + +SUBTTL INITIALIZATION + +INIT: 0 + MOVEI P,PDL +NTS,[ KA,[ + CONO 675550 ;RESET APR + CONO PI,710000 ;RESET PI + MOVE TT,[JSR UUOHLT] ;HALT ON UUO + SKIPN 41 + MOVEM TT,41 + MOVEI A,SA ;MAKE SURE ALL NECESSARY MEMORY IS PRESENT +INIT0: MOVE B,(A) + CONSZ 10000 + JRST [ TYPE NXM IN SALV MEM + JRST ERRDDT ] + ADDI A,2000 + CAIGE A,THEEND + JRST INIT0 +];KA +KL,[ + SETZM DTEOPR ;BTB IF QUIT OUT AND RESTART + CONO APR,267760 ;I/O RESET, CLEAR + DISABLE ALL FLAGS + CONO PI,010000 ;CLEAR P.I. SYSTEM + CONSZ PAG,400000 + JRST .+4 ;JUMP IF CACHE LOOK ENABLE + SWPIA ;IF CACHE OFF, INVALIDATE IT BEFORE TURNING ON + CONSZ APR,200000 + JRST .-1 + MOVEI TT,SALVPF ;SET TO HALT ON PAGE FAIL (E.G. PARITY ERROR) + MOVEM TT,PFNPC + CONO PAG,600000+EPT/1000 ;SET UP EPT, ENABLE CACHE, DISABLE PAGING AND TRAPS + DATAO PAG,[100000,,400000+EPT/1000] ;UPT=EPT + MOVEI TT,UUOHLT + SKIPN EPT+430 ;HALT ON KERNEL UUO + MOVEM TT,EPT+430 + MOVEI A,SA ;MAKE SURE ALL NECESSARY MEMORY IS PRESENT +INIT0: MOVE B,(A) + CONSZ 2000 + JRST [ TYPE NXM IN SALV MEM + JRST ERRDDT ] + ADDI A,1000 + CAIGE A,THEEND + JRST INIT0 +RH, CONI DSK,TT +RH, TLNN TT,(%HID22) +RH, JRST [ TYPE DF10 IN KA MODE?? +RH, JRST ERRDDT ] +IFN T300P,[ ;TURN ON DL10 TO ACCESS T-300 + CONO DLC,400000 ;MR CLR + CONO DLB,1 ;TURN OFF EXCESS LIGHTS + CONO DLB,2 ;.. + CONO DLB,3 ;.. + CONO DLB,DL10AR ;64 WORDS FOR PDP11 #0 AT DL10AR + DATAO DLC,[200001,,] ;KA INTERRUPT MODE + CONO DLC,100020 ;ENB PDP11 PORT #0 NO INTERRUPTS +];T300P +];KL +DC, SETZM ENCS +RH, SETZM MARKF +RP,[ DATAI DPC,A + TLNN A,NOWRIH + JRST [ TYPE [WRITE HEADERS ENABLED] + X CRR + JRST .+1 ] +];RP + SETOM DRIVE ;ALL DRIVES ASSUMED TO BE ON-LINE + MOVE A,[DRIVE,,DRIVE+1] + BLT A,DRIVE+NDRIVE-1 + MOVEI A,SLVIOWD ;SET UP CHANNEL PROGRAM AREA + MOVEM A,SLVICWA + SETZM SLVIOWD+1 + SETZM SLVICWA+1 +];NTS + SETZM GOGOX + SETZM NOQUES + MOVEI A,NUNITS-1 + SETOM QPKN(A) ;TUT NOT IN YET + SOJGE A,.-1 +TS,[ + .OPEN TYIC,[SIXBIT / $TTY/] + .VALUE + .OPEN TYOC,[SIXBIT / !TTY/] + .VALUE + .CORE _-10.+1 + .VALUE + MOVE A,[SQUOZE 0,NQS] + .EVAL A, + .VALUE + MOVEM A,NQS + MOVE A,[SQUOZE 0,QACT] + .EVAL A, + .VALUE + MOVEM A,SQACT + MOVE A,[SQUOZE 0,NUDSL] + .EVAL A, + .VALUE + MOVEM A,NUDS + MOVE A,[SQUOZE 0,MFDBLK] + .EVAL A, + .VALUE + MOVEM A,MFDBK + MOVE B,[SQUOZE 0,NTUTBL] + .EVAL B, + .VALUE + MOVEI C,NUNITS-1 + MOVEM B,NTBL(C) + SOJGE C,.-1 + CAILE B,MXTUTB + .VALUE ;NOT ASSEMBLED FOR BIG ENOUGH TUTS + MOVE B,[SQUOZE 0,T300P] ;NEED KLUDGES FOR 2 SIZES OF TUT + .EVAL B, + MOVEI B,0 + JUMPE B,INI03 + MOVE C,[SQUOZE 0,NTUTB1] + .EVAL C, + .VALUE + CAILE C,MXTUTB + .VALUE ;TOO BIG + MOVEM C,NTBL(B) + CAIGE B,NUNITS-1 + AOJA B,.-2 +INI03: MOVE A,[SQUOZE 0,NBLKS] + .EVAL A, + .VALUE + MOVEM A,SNBLKS + SUBI A,1 + MOVEM A,SNBLKS-1 +];TS + + ;BRING UP THE LPT + + SETOM NOLPT ;ASSUME THE WORST + SKIPE LPBUST + JRST LPTDWN + SETOM LPFRST' ;FLAG LPT NOT USED YET + +TS,[ TYPE WANT LPT? + PUSHJ P,TYI + X CRR + SETOM LPBUST ;ASK ONLY ONCE + CAIN A,"Y + .OPEN LPTC,[.UAO,,'LPT] + JRST LPTDWN + SETZM NOLPT + SETZM LPBUST +];TS +;DROPS THROUGH + ;DROPS IN +NTS,[ +IFN OLPTP,[ ;BRING UP AI-KA LPT +LPTUP3: CONO LPT,10 + DATAO LPT,[440] + MOVEI A,200000 +LPTUP1: SOJLE A,LPTUP2 + CONSZ LPT,10 + JRST LPTUP1 + SETZM NOLPT + JRST LPTDWN +];IFN OLPTP + +IFN NLPTP,[ ;BRING UP ML LPT +LPTUP3: SETOM LPTBFC + MOVE A,[<.BYTE 7 ? 15 ? 15 ? 15 ? 15 ? 15>] + MOVEM A,LPTBUF + CONO NLPT,200 + CONO NLPT,1000 ;IMAGE MODE + DATAO NLPT,[23*2] ;MOTOR ON + + MOVEI A,200000 ;1 SECOND +LPTUP1: SOJLE A,LPTUP2 + CONSO NLPT,100 ;IS IT ON? + JRST LPTUP1 + SETZM NOLPT ;WELL, YES + CONO NLPT,200 + CONO NLPT,100 ;SET OUTPUT DONE + JRST LPTDWN ;ITS UP +];IFN NLPTP + +IFN TTLPTP,[ ;BRING UP LPT ATTACHED VIA MTY +LPTUP3: MOVEI A,200000 +LPTUP1: SOJLE A,LPTUP2 + CONI MTY,B + TRNN B,40 ;ANY INPUT? + JRST LPTUP1 + LDB B,[140500,,B] + DATAI MTY,C + CAIE B,TTLPTP&77 + JRST LPTUP1 ;NOT FROM LPT + + SETZM NOLPT ;IS FROM LPT -> WIN + MOVEI B,TTLPTP_14 ;LINE NUMBER IN RIGHT PLACE + CONO MTY,10(B) ;SET OUTPUT DONE + JRST LPTDWN +];IFN TTLPTP + +IFN OLPTP+NLPTP+TTLPTP,[ + ;ROUTINE TO ASK IF UP +LPTUP2: TYPE LPT DOWN (Y OR N) +IFN OLPTP, TYPE [MAYBE NEEDS RESET BUTTON PUSHED] + PUSHJ P,TYI + X CRR + CAIN A,"Y + JRST LPTUP4 + CAIN A,"N + JRST LPTUP3 ;"N", CHECK IT AGAIN + JRST LPTUP2 + +LPTUP4: SETOM LPBUST +];IFN OLPTP+NLPTP+TTLPTP +];NTS + +LPTDWN: JRST @INIT + +NTS,[ +UUOHLT: +KA, 0 + JRST 4,. ;HERE IF UUO IN STAND-ALONE MODE (ELSE HALT IN ITS) +];NTS + +SUBTTL LPT & TTY I/O + +LDPT: PUSH P,A + PUSH P,B + JUMPGE A,LDPT0 + MOVEI A,"- + PUSHJ P,LTYO + MOVN A,-1(P) +LDPT0: PUSHJ P,LDPT1 + JRST POPBAJ + +LDPT1: IDIVI A,10. + HRLM B,(P) + SKIPE A + PUSHJ P,LDPT1 + JRST LDPT2 + +LOPT: PUSH P,A + PUSH P,B + PUSHJ P,LOPT1 + JRST POPBAJ + +LOPT1: LSHC A,-35. ;IN CASE NEGATIVE + LSH B,-1 + DIVI A,8 + HRLM B,(P) + SKIPE A + PUSHJ P,LOPT1 +LDPT2: HLRZ A,(P) + ADDI A,"0 +;DROPS IN +LTYO: +LPTR: +LPTR1: SKIPE NOLPT + JRST TYLPT ;TYPE ON TTY INSTEAD + + PUSH P,A + AOSE LPFRST + JRST LPTR2 + TYPE (INFO ON LPT) + X CRR +LPTR2: + +IFN OLPTP,[ +OLP1: CAIN A,12 ;SUPPRESS LF, MAKE CR=CR-LF + JRST POPAJ + CAIN A,15 + JRST [ CONO LPT,10 + MOVEI A,440 + JRST .+1] + CAIN A,14 + MOVEI A,441 + CAIN A,33 + MOVEI A,"$ + CAIL A,"a + CAILE A,"z + CAIA + SUBI A,40 ;LOWER CASE -> UPPER CASE + SUBI A,40 + PUSH P,B + HRLZI B,2 ;3 SECOND TIMEOUT + CONSZ LPT,10 + SOJG B,.-1 + JUMPLE B,OLP2 +OLP3: DATAO LPT,A + JRST POPBAJ + +OLP2: X CRR + TYPE HIT RESET BUTTON ON LPT + X CRR + HRLZI B,15 ;20 SECOND TIMEOUT + CONSZ LPT,10 + SOJG B,.-1 + JUMPLE B,OLP2 + JRST OLP3 +];IFN OLPTP + +TS,[ .IOT LPTC,A + JRST POPAJ +];TS + +IFN NLPTP,[ ;SEND CHARACTER TO NLPT + PUSH P,B + SOSLE LPTBFC ;MORE TO GO + JRST LPTR0 ;YES +LPTR01: MOVEI B,5 ;NO, NEW WORD + MOVEM B,LPTBFC + MOVE B,[440700,,LPTBUF] + MOVEM B,LPTBFP + MOVEI B,-1 ;TIMEOUT FOR DEAD LPT + CONSO NLPT,100 + SOJG B,.-1 + DATAO NLPT,LPTBUF + +LPTR0: IDPB A,LPTBFP ;BUFFER 5 AT A TIME + CAIL A,12 + CAILE A,14 ;LF OR FF, FORCE BUFFER NOW + JRST POPBAJ + MOVEI A,15 +LPTR00: SOSG LPTBFC + JRST LPTR01 + IDPB A,LPTBFP + JRST LPTR00 + + ;NLPT BUFFERING CRUFT +LPTBUF: -1 ;5 CHAR LPT BUFFER +LPTBFC: 5 ;COUNT OF CHARS LEFT IN BUF +LPTBFP: @. ;BYTE POINTER INTO LPT BUFFER + +LPTFIN: SKIPL LPFRST ;DO NOTHING IF NEVER OUTPUT TO LPT + SKIPGE NOLPT ;WAS LPT INIT'ED? + POPJ P, ;NO, DON'T HANG + MOVE A, [<.BYTE 7 ? 15 ? 14 ? 15 ? 15 ? 15>] + MOVEI B, 15 +LPTFN0: SOSG LPTBFC + JRST LPTFN1 + IDPB B, LPTBFP + JRST LPTFN0 + +LPTFN1: CONSO NLPT,100 ;WAIT FOR THAT TO HAPPEN + JRST .-1 + DATAO NLPT, LPTBUF + CONSO NLPT,100 ;WAIT FOR THAT TO HAPPEN + JRST .-1 + DATAO NLPT, A + POPJ P, +];IFN NLPTP + +IFN TTLPTP,[ +; call with ascii char in A +; saves and restores all AC's + + ANDI A,177 ;MASK TO 7 BIT ASCII + CAIGE A,40 ;SKIP IF NOT CTL CHAR + CAIN A,14 ;SKIP IF NOT FF + JRST LPTOP ;PRINT LITERALLY FF, GRAPHICS + CAIN A,15 ;SKIP IF NOT CR + JRST LPCR ;JUMP TO CR ROUT + CAIN A,12 ;SKIP IF NOT LF + JRST LPLF ;JUMP TO LF ROUT + CAIN A,11 ;SKIP IF NOT TAB + JRST LPTAB ;JUMP TO TAB ROUT + MOVEI A,"^ ;HERE FOR RANDOM CTL CHAR + PUSHJ P,LPTO ;PUT OUT ^FOO + MOVE A,(P) ;RETREIVE CHAR + ADDI A,100 ;MAKE IT A 'LETTER' +LPTOP: PUSHJ P,LPTO + JRST POPAJ + +LPCR: SKIPE LPTPOS ;SKIP IF STILL AT LEFT MARGIN + PUSHJ P,LPTO ;ELSE PUT OUT CR + SETZM LPTPOS ;MARK 'AT LEFT MARGIN' + SETOM LPCRLF ;MARK LF AFTER CR + MOVEI A,12 ;LF + JRST LPTOP ;OUTPUT IT + +LPLF: AOSE LPCRLF ;SKIP IF THIS LF AFTER CR + JRST LPTOP ;ELSE PUT IT OUT + JRST POPAJ + +LPTAB: MOVEI A,40 ;SPACES FOR TAB + PUSHJ P,LPTO + MOVE A,LPTPOS ;CHECK POS + TRNE A,7 ;SKIP IF POS = 0 MOD 8 + JRST LPTAB ;ELSE PUT ANOTHER SPACE + JRST POPAJ + +LPTO: CAIL A,40 ;SKIP FOR CTL CHAR NOT COUNTED + AOS LPTPOS ;COUNT CHAR + PUSH P,A + PUSH P,B + MOVEI A,-1 ;TIMER FOR FLAG +LPWAIT: SOJLE A,LPTOUT + CONI MTY,B ;GET STATUS + TRNE B,40 ;SKIP IF NO INPUT FLAG + JRST FLSINP ;ELSE JUMP TO FLUSH INPUT + TRNN B,10 ;SKIP IF OUTPUT FLAG + JRST LPWAIT ;ELSE LOOP + LDB B,[140500,,B] ;GET SUBDEV # + CAIE B,TTLPTP&77 ;SKIP IF THIS IS LPT # + JRST FLSOUT ;ELSE FLUSH +LPTOUT: MOVEI B,TTLPTP_14 ;GET LPT NO IN SUBDEV POSITION + CONO MTY,(B) ;SELECT SUBDEV + POP P,B ;RESTORE AC + MOVE A,(P) ;GET CHAR + LSH A,35 ;PUT IN FUNNY POSITION + DATAO MTY,A ;PUT OUT 1 CHAR + JRST POPAJ + +FLSINP: DATAI MTY,B ;READ INPUT + JRST LPWAIT ;AND IGNORE + +FLSOUT: LSH B,14 ;SHIFT TO SELECT + CONO MTY,200(B) ;RESET FLAG, IT'S NOT LPT + JRST LPWAIT + +LPTPOS: 0 ;PRINT POSITION FROM LEFT MARGIN +LPCRLF: 0 ;# CHARS AFTER LAST CR, -1 IF TO IGNORE LF +];IFN TTLPTP + +TYLPT: CAIN A,14 + JRST CRR ;NO FF ON TTY + JRST TYO + +SIXTYP: +T6B: PUSH P,B ;OUTPUT SIXBIT IN A + PUSH P,A + LSHC A,-36. +T6B1: LSHC A,6 + ADDI A,40 + PUSHJ P,TYO + MOVEI A,0 + JUMPN B,T6B1 + POP P,A +POPBJ: POP P,B + POPJ P, + +SIXLPT: +L6B: PUSH P,B ;OUTPUT SIXBIT IN A + PUSH P,A + MOVE B,[440600,,(P)] ;ALWAYS OUTPUTS SIX COLUMNS +L6B1: ILDB A,B ;CAN YOU GUESS WHY? WIN A KEWPIE DOLL! + ADDI A,40 + PUSHJ P,LPTR + TLNE B,770000 + JRST L6B1 + POP P,A + POP P,B + POPJ P, + +SLPT: PUSH P,B + MOVE B,A +SL1: ILDB A,B + JUMPE A,POPBJ + PUSHJ P,LPTR + JRST SL1 + +DPT: +TOPT: PUSH P,A + PUSH P,B + MOVEI B,8 + MOVEM B,ORADIX + PUSHJ P,TDPT1 + JRST POPBAJ + +TDPT: PUSH P,A + PUSH P,B + MOVEI B,10. + MOVEM B,ORADIX' + PUSHJ P,TDPT1 + JRST POPBAJ + +TDPT1: LSHC A,-35. ;IN CASE NEGATIVE + LSH B,-1 + DIV A,ORADIX + HRLM B,(P) + SKIPE A + PUSHJ P,TDPT1 + HLRZ A,(P) + ADDI A,"0 + JRST TYO + +LTAB: +IFN OLPTP,[ + PUSHJ P,LSPAC ;OLD LPT LACKS TABS + PUSHJ P,LSPAC + PUSHJ P,LSPAC + JRST LSPAC +];IFN OLPTP + +.ELSE [ PUSH P,A + MOVEI A,11 ;NLPT HAS HARDWARE TABS + JRST L1 +];ELSE + +LCRR: PUSH P,A + MOVEI A,15 + PUSHJ P,LPTR + MOVEI A,12 + PUSHJ P,LPTR + JRST POPAJ + +LSPAC: PUSH P,A + MOVEI A,40 +L1: PUSHJ P,LPTR + POP P,A + POPJ P, + +LFORM: PUSH P,A + MOVEI A,14 + PUSHJ P,LPTR + JRST POPAJ + +LOUTST: 0 + PUSH P,A + PUSH P,B + HRRZ B,@LOUTST + HRLI B,440700 +LOUT2: ILDB A,B + JUMPE A,LOUT1 + X LPTR + JRST LOUT2 + +LOUT1: POP P,B + POP P,A + AOS LOUTST + JRST 2,@LOUTST + +TOUTST: 0 + PUSH P,A + PUSH P,B + HRRZ B,@TOUTST + PUSHJ P,OUTSTR + AOS TOUTST + POP P,B + POP P,A + JRST 2,@TOUTST + +OUTSTR: HRLI B,440700 +OUTST1: ILDB A,B + JUMPE A,CPOPJ + PUSHJ P,TYO + JRST OUTST1 + +ERRDDT: PUSHJ P,CRR + TYPE *** ERROR *** SYSTEM MAY NOT BE BROUGHT BACK UP +CRDDTE: NTS, SETZM SALVRT ;CAN'T RETURN TO SYSTEM +CRDDT: PUSHJ P,CRR + +DDT: +NTS,[ +IFN NLPTP, PUSHJ P,LPTFIN ;UNBUFFER LINE PRINTER + SKIPE SALVRT + JRST @SALVRT + TYPE DDT + SKIPN MEMSIZ-4000 + JRST 4,. ;NO DDT LOADED? + JRST MEMSIZ-4000 +];NTS +TS,[ .VALUE [ASCIZ\:DDT +\] + JRST DDT +];TS + +CRR: PUSH P,A + PUSHJ P,CRR1 + SETZM LINPOS' + JRST POPAJ + +CRR1: MOVEI A,15 + PUSHJ P,TYO + MOVEI A,12 + JRST TYO + +TSPAC: PUSH P,A + MOVEI A,40 + X TYO + JRST POPAJ + +TYO: +TS, .IOT TYOC,A +NTS,[ +KA,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,A + SKIPN PUNCH + JRST TYO0 + CONSZ PTP,20 ;WAIT FOR NOT BUSY + JRST .-1 + DATAO PTP,A +TYO0: +];KA +KL,[ + PUSH P,A + ANDI A,177 + PUSHJ P,DTEXIO + POP P,A +];KL +];NTS + AOS LINPOS + POPJ P, + +KL,[ ;DTE20 COMMUNICATION ROUTINE ... COPIED FROM DEC "SUBRTN" PROGRAM + +DTEXIO: SETZM DTEFLG + MOVEM A,DTECMD + SETZM DTEF11 + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SETZM DTEFLG + MOVE A,DTEF11 + POPJ P, +];KL + +NTYI: PUSHJ P,TYI ;INPUT DIGIT, SKIP IF WIN + CAIL A,"0 + CAILE A,"9 + POPJ P, + SUBI A,"0 +POPJ1: AOS (P) + POPJ P, + +SIXIN: PUSH P,C +SIXI1: MOVE C,[440600,,B] + SETZ B, +SIXIL: X TYI + CAIL A,140 + JRST [ TYPE XXX + JRST SIXI1] + CAIG A,40 + JRST SIXIX + CAIN A,"; + JRST SIXIL + SUBI A,40 + TLNE C,770000 + IDPB A,C + JRST SIXIL + +SIXIX: POP P,C + POPJ P, + +TYI: ;INPUT CHAR INTO A +TS, .IOT TYIC,A +NTS,[ +KA,[ + CONSO TTY,40 + JRST .-1 + DATAI TTY,A +];KA +KL,[ + MOVEI A,3400 ;"DDT MODE" INPUT + PUSHJ P,DTEXIO + JUMPE A,.-2 +];KL +];NTS + ANDI A,177 + CAIL A,"a ;MIGHT NOT BE KSR-35 + CAILE A,"z + CAIA + SUBI A,40 + CAIN A,^Z + JRST CRDDTE + JRST TYO + +;RETURN TO DDT IF CHARACTER TYPED +TYIPSE: PUSHJ P,TYIP + POPJ P, + PUSHJ P,TYI + JRST DDT + +;SKIP IF INPUT AVAILABLE +TYIP: PUSH P,A +TS,[ .LISTEN A, + SKIPE A +];TS +NTS,[ +KA, CONSZ TTY,40 +KL,[ MOVEI A,3400 + PUSHJ P,DTEXIO + SKIPE A +];KL +];NTS + AOS -1(P) + POP P,A + POPJ P, + +Y.OR.N: PUSH P,A ;YES OR NO, SKIP IF YES +YORN1: X TYI + X CRR + CAIE A,"Y + CAIN A,"N + JRST YORN2 + TYPE (Y OR N) + JRST YORN1 ;TELETYPE KEYBOARD LOSSAGE? + +YORN2: CAIN A,"Y + AOS -1(P) + JRST POPAJ + +SUBTTL MAG TAPE I/O + +NTS,[ MTC==340 ;MAG TAPE CHANNEL FOR FUNCTIONS + MTS==344 ;MAG TAPE CHANNEL FOR STOPPING AND STATUS + +;SHIFTS FOR FIELDS IN CONO MTC, + UNITNO==15. + PARITY==14. + CDUMP==13. + FUNC==9. + DENSTY==6. + + 800BPI==2 + + MAGCOM=5_+1_+800BPI_+1_ + +;FUNCTIONS + NOOP1=0_+MAGCOM ;CLEAR INTERRUPT FLAGS + NOOP2=10_+MAGCOM ;INTERRUPT WHEN TRANSPORT IDLE + REWIND=1_+MAGCOM ;REWIND + REED=2_+MAGCOM ;READ + SPACR=7_+MAGCOM ;SPACE REVERSE + +;FLAGS + JOBDON==100 + DATREQ==1 + EOFF==10000 + EOTF==4000 +;NOTE - TM10B HAS DATA PIA (CONI MTC, 1.1-1.3) STUCK AT 7 + +REW: CLEARM EOFCNT + CLEARM MAGBFP + CLEARM SHORTL + CONO MTC,NOOP1 ;CLEAR INTERRRUPT FLAGS + CONO MTC,REWIND ;INITIATE REWIND + CONSO MTS,JOBDON ;WAIT FOR REWIND TO BEGIN + JRST .-1 + CONO MTC,NOOP2 ;SET JOB DONE WHEN TRANSPORT IDLE + CONSO MTS,JOBDON ;WAIT FOR JOB DONE + JRST .-1 + SETOM ITAPE + POPJ P, ;REWIND DONE +ITAPE: 0 + +MREAD: MOVEI T,0 + PUSH P,B +MREAD7: SKIPGE B,MAGBFP + JRST MREAD5 + SKIPN EOFLG + JRST MREAD1 + SETZM EOFLG + SETOM EOUF + JRST POPBJ + +MREAD1: MOVEI B,10. + MOVEM B,MTRYS +MERR2: MOVE B,[-2000,,MAGBUF] + MOVEM B,MAGBFP + SETZM SLVIOWD + CONO MTC,NOOP1 ;CLEAR FLAGS + CONSO MTC,7 ;IS THIS A TM10B? + JRST MREADA ;NO +KA, MOVE B,[-2000,,MAGBUF-1] ;YES SET UP CHANNEL PROGRAM +KL, MOVE B,[-2000_4,,MAGBUF-1] + MOVEM B,SLVIOWD + SETZM SLVICWA+1 + SETZM SLVIOWD+1 + DATAO MTS,[SLVICWA] +KL,[ SWPUA ;UNLOAD THE CACHE + PUSH P,A + MOVE A,[CONSZ APR,200000] + MOVE B,[JRST A] + MOVE C,[POPJ P,] + PUSHJ P,A + POP P,A +] +MREADA: CONO MTC,REED +MREAD2: CONSO MTS,DATREQ+EOFF+JOBDON+EOTF ;WAIT FOR NEXT DATA REQUEST + JRST .-1 + MOVEI C,20. + SOJG C,. + CONI MTS,C + TRNE C,EOTF + JRST MREOT + TRNN C,JOBDON + JRST MREAD3 + TRNN C,EOFF + JRST MREAD6 + AOS EOFCNT + SETOM EOFLG + CLEARM SHORTL + JRST MREAD9 + +MREAD6: SETOM SHORTL +MREAD9: CONSZ MTC,7 ;SKIP IF TM10A + JRST MREADB + HLLZS B + MOVNS B + ADDM B,MAGBFP + JRST MREAD4 + +MREADB: HRRZ B,SLVICWA+1 + JUMPE B,.-1 + MOVNI B,1-MAGBUF(B) + SKIPE EOFLG + MOVSI B,0 ;EOF MARK => NO WORDS READ + HRLM B,MAGBFP + JRST MREAD4 + +MREAD3: TRNE C,DATREQ + CONSZ MTC,7 ;SKIP IF TM10A + JRST MREAD2 ;TM10B OR NO DATA REQUEST + DATAI MTC,(B) + SKIPE SHORTL + JRST 4,. + AOBJN B,MREAD2 +MREAD4: CONO MTS,1 + CONSO MTS,JOBDON + JRST .-1 + CONSZ MTS,440000 ;X HUNG + ILL OP + JRST 4,MERR +MREAD8: CONSO MTS,20600 + JRST MREAD7 +MERR: SOSG MTRYS + JRST MERR1 + SETZM SLVIOWD +KL,[ SWPUO 0 + CONSZ APR,200000 + JRST .-1 +] + CONO MTC,NOOP1 + CONO MTC,SPACR + CONSZ MTC,7 ;SKIP IF TM10A + JRST .+4 + CONSO MTS,DATREQ + JRST .-1 + DATAO MTC, + CONO MTS,1 + CONSO MTS,JOBDON + JRST .-1 + JRST MERR2 + +MERR1: AOS FERRS ;IGNORE ERR + JRST MREAD7 + +MREAD5: HLRE C,B + CAMG B,A + HLRE C,A + HRLZS B + HRR B,A + MOVNS C + HRLS C + ADDI C,-1(A) + BLT B,(C) + HLRS C + ADD A,C + ADDM C,MAGBFP + ADDI T,(C) + JUMPGE A,POPBJ + JRST MREAD7 + +MREOT: CONO MTS,1 ;STOP TAPE IF STILL MOVING + CONO MTC,NOOP1 + LPR EOT + X LCRR + JRST DDT +];NTS + +SUBTTL TYPE CONTROLLER AND DRIVE STATUS +TS,[ +GSTS: POPJ P, +];TS + +DC,[ +GETSTS: MOVEI P,PDL + PUSH P,[DDT] +GSTS: INSIRP PUSH P,[A B C D T] + CONI DC0,D + MOVEI C,DC0STS + TYPE CONTROLLER STATUS: + PUSHJ P,TYPSTS + CONI DC1,D + MOVEI C,DC1STS + PUSHJ P,TYPSTS + CONO DC0,DCCSET+DCDENB + DATAO DC0,[DJMP GETUNT] + CONSZ DC0,DSSACT + JRST .-1 + TYPE CURRENT UNIT= + LDB A,[DUNFLD GOTUNT] + DPB A,[DUNFLD STOSTS] + PUSHJ P,TDPT + TYPE ,DRIVE STATUS: + PUSHJ P,CRR + DATAO DC0,[DJMP STOSTS] + CONSZ DC0,DSSACT + JRST .-1 + MOVE D,STATUS + LSH D,-15. + MOVEI C,DRVSTS + PUSHJ P,TYPSTS + TYPE CYLINDER= + LDB A,[101100,,STATUS] + PUSHJ P,TOPT + PUSHJ P,CRR + INSIRP POP P,[T D C B A] + POPJ P, + +TYPSTS: SETOM FIRST' +TYPST1: SKIPN B,(C) + JRST CRR + HLRZ T,B ;FLAGS TO TEST + TDNN D,T + AOJA C,TYPST1 + MOVEI A,", + AOSE FIRST + PUSHJ P,TYO + MOVE A,LINPOS + CAILE A,TCMXH + PUSHJ P,CRR + PUSHJ P,OUTSTR + AOJA C,TYPST1 + ;DC +DEFINE STS A,B/ +A,,[ASCIZ \B\] +TERMIN + +DC0STS: STS 4000,ERROR-FLG + STS 1000,ATTENTION + STS 200,RUN + STS 100,ACTIVE + 0 + +DC1STS: STS 4000,INTERNAL-PARITY-ERROR + STS 2000,RECORD-LENGTH + STS 1000,READ-COMPARE + STS 400,OVERRUN + STS 200,CHECKSUM/DECODER + STS 100,BARK!! + STS 40,FILE-UNSAFE/SEEK-INCOMPLETE/END-OF-DISC + STS 20,OFF-LINE/MULTIPLE-SELECT + STS 10,RDG-KEY/PROTECT/READONLY + STS 4,DATAO-WHILE-BUSY + STS 2,NON-EX-MEM + STS 1,CORE-PARITY-ERROR + 0 + +DRVSTS: STS 4,UNIT-SELECTED + STS 10,ON-LINE + STS 20,READY + STS 40,SEEK-INCOMPLETE + STS 100,READ-ONLY + STS 200,UNSAFE + STS 400,WRITE-CURRENT-SENSED(?) + 0 + +GETUNT: DJSR .+1 +GOTUNT: 0 + DHLT + +STOSTS: DSDRST+DUNENB STATUS(74) + DHLT +STATUS: 0 +];DC + +RP,[ +GETSTS: MOVEI P,PDL + PUSH P,[DDT] +GSTS: INSIRP PUSH P,[A B C D T] + TYPE DISK STATUS: + CONI DPC,D + MOVEI C,CNLSTS + TLNE D,-1 + PUSHJ P,TYPSTS + MOVSS D + MOVEI C,CNISTS + PUSHJ P,TYPSTS + DATAI DPC,D + TLC D,1 ;REVERSE SENSE OF WRITE HEADER LOCKOUT SWITCH + MOVEI C,DTISTS + PUSHJ P,TYPSTS + TYPE CURRENT UNIT= + LDB A,[DUNFLI D] + PUSHJ P,TDPT + TYPE , CYLINDER= + LDB A,[DCYLI D] + TRNE D,.BM DCYLXI + ADDI A,400 + PUSHJ P,TOPT + TYPE , LAST ADDRESSED CYL= + MOVE A,RPIOCY + X TOPT + TYPE , SURF= + MOVE A,RPIOHD + X TOPT + TYPE , SEC= + MOVE A,RPIOSC + X TOPT + PUSHJ P,CRR + INSIRP POP P,[T D C B A] + POPJ P, + +TYPSTS: SETOM FIRST' +TYPST1: SKIPN B,(C) + JRST CRR + HLLZ T,B ;FLAGS TO TEST + TDNN D,T + AOJA C,TYPST1 + MOVEI A,", + AOSE FIRST + PUSHJ P,TYO + MOVE A,LINPOS + CAILE A,TCMXH + PUSHJ P,CRR + PUSHJ P,OUTSTR + AOJA C,TYPST1 + + ;RP +DEFINE STS A,B/ +A,,[ASCIZ \B\] +TERMIN + +; CONI STATUS TABLE (RH) + +CNISTS: STS 400000,SEARCH DONE + STS 200000,END OF CYLINDER + STS 100000,POWER FAILURE + STS 040000,SEARCH ERROR + STS 020000,OVERRUN + STS 010000,NXM + STS 002000,DRIVE NOT READY + STS 001000,WRITE PROTECT + STS 000400,DATAO WHEN BUSY + STS 000200,SECTOR ADDRESS ERROR + STS 000100,SURFACE ADDRESS ERROR + STS 000020,BUSY + STS 000010,DONE + 0 + +; CONI STATUS TABLE (LH) + +CNLSTS: STS 000010,CONTROL WORD PARITY ERROR + STS 000004,SECTOR PARITY ERROR + STS 000002,MEMORY WORD PARITY ERROR + STS 000001,DISK WORD PARITY ERROR + 0 + +; DATAI STATUS TABLE (LH) + +DTISTS: STS 000100,SEEK INCOMPLETE + STS 000040,ON CYLINDER + STS 000020,DISK ON-LINE + STS 000010,FILE UNSAFE + STS 000004,NON EXISTENT DRIVE + STS 000002,DRIVE IS READ-ONLY + STS 000001,WRITE HEADER LOCKOUT OFF!! + 0 +];RP + +RH,[ +GETSTS: MOVEI P,PDL + PUSH P,[DDT] +GSTS: +IFN T300P,[ + SKIPE T3IOP + JRST T3STS ;LAST OPERATION WAS REALLY TO T-300 +];T300P + INSIRP PUSH P,[A B C D T I K] + TYPE CONTROLLER STATUS: + CONI DSK,D + MOVEI C,CNLSTS + TLNE D,-1 + PUSHJ P,TYPSTS + MOVSS D + MOVEI C,CNISTS + PUSHJ P,TYPSTS + TYPE CURRENT REGISTER: + DATAI DSK,D + PUSHJ P,TYPRGN + MOVE A,D + PUSHJ P,TOPT ;TYPE REG NO, STATUS, AND CONTENTS IN OCTAL + JUMPL D,GSTS0 ;DO FOLLOWING ONLY FOR DRIVE REGS + MOVEI A,", + PUSHJ P,TYO + MOVEI C,DIBSTS + PUSHJ P,TYPSTS + CAIA ;DON'T GIVE BLANK LINE +GSTS0: PUSHJ P,CRR + TYPE CURRENT DRIVE= + LDB A,[$HCDRV D] + PUSHJ P,TDPT + PUSHJ P,CRR + MOVEI I,NUNITS-1 ;CONVERT BACK TO VIRTUAL UNIT + CAME A,QTRAN(I) ;TO MAKE RHGET HAPPY + SOJGE I,.-1 + JUMPL I,GSTS3 ;FOO!! ADDRESSING NON EXISTENT DRIVE + + MOVSI K,-LGSTSR ;DISPLAY DRIVE REGS SPEC'ED IN TABLE +GSTS1: MOVE D,GSTSRT(K) + PUSHJ P,TYPRGN ;TYPE REG NAME + HRRZ C,D ;C -> STATUS BIT TABLE + HLLZ A,D ;A := REG NUMBER + PUSHJ P,RHGET ;GET CONTENTS OF REG + JRST GSTSER ;?? + PUSHJ P,TOPT ;GIVE CONTENTS IN OCTAL + PUSHJ P,TSPAC + MOVS D,A ;AND SYMBOLICLY + PUSHJ P,TYPSTS + AOBJN K,GSTS1 +GSTS3: INSIRP POP P,[K I T D C B A] + POPJ P, + +GSTSER: TYPE BARF: + MOVE D,A + MOVEI C,DIBSTS + PUSHJ P,TYPSTS + JRST GSTS3 ;DON'T TRY ANY MORE REGS + +TYPSTS: SETOM FIRST' +TYPST1: SKIPN B,(C) + JRST CRR + HLLZ T,B ;FLAGS TO TEST + TDNN D,T + AOJA C,TYPST1 + MOVEI A,", + AOSE FIRST + PUSHJ P,TYO + MOVE A,LINPOS + CAILE A,TCMXH + PUSHJ P,CRR + PUSHJ P,OUTSTR + AOJA C,TYPST1 + +TYPRGN: LDB A,[360600,,D] ;TYPE NAME OF REGISTER ADDRESSED BY D + ROT A,-1 + MOVE B,RHRGTB(A) + JUMPL A,.+2 + MOVSS B + PUSHJ P,OUTSTR + MOVEI A,"= + JRST TYO + +;TABLE OF DRIVE REGISTERS THAT NEED TO BE DISPLAYED +; LH = REG ADDR, RH = STATUS BITS TABLE ADDR + +GSTSRT: %HRDCL,,[0] + %HRSTS,,STSSTS + %HRCYL,,[0] + %HRCCY,,[0] + %HRADR,,[0] + %HROFS,,OFSSTS + %HRER1,,ER1STS + %HRER2,,ER2STS + %HRER3,,ER3STS +LGSTSR==.-GSTSRT + ;RH +DEFINE STS A,B/ +A,,[ASCIZ \B\] ? TERMIN + +; CONI STATUS (LH) + +CNLSTS: STS 400000,AR FULL + STS 200000,CB FULL + STS 040000,CC INH + STS 020000,CHANNEL ACTIVE + STS 010000,CHANNEL PULSE + STS 004000,22-BIT CHANNEL + STS 000400,CXR ILL FUNC + STS 000200,CXR DRIVE ACCESS ERR + STS 000004,MEMORY PARITY + STS 000002,CONTROL WORD PARITY + STS 000001,NXM + 0 + +; CONI STATUS (RH) + +CNISTS: STS 400000,DATA BUS PARITY + STS 200000,DRIVE EXCEPTION + STS 100000,CHANNEL ERROR + STS 020000,CHANNEL OVERRUN + STS 010000,DRIVE RESPONSE ERR + STS 004000,CXR ILL CMD + STS 002000,CXR POWER FAIL + STS 000200,CONTROL BUS OVERRUN + STS 000100,RAE INTR + STS 000040,ATTN INTR + STS 000020,BUSY + STS 000010,DONE + 0 + +; REGISTERS + +ZZ==-1 +XX==0 +YY==0 +DEFINE REG N,T/ +IFLE N-ZZ, .ERR REG OUT OF ORDER +REPEAT N-ZZ-1, REGH [ASCIZ\????\] + REGH [ASCIZ\T\] +TERMIN + +DEFINE REGH [A] +ZZ==ZZ+1 +IFE XX, YY==A +IFN XX, YY,,A +XX==1-XX +TERMIN + +RHRGTB: REG 0,DRV CTL + REG 1,DRV STATUS + REG 2,DRV ER1 + REG 3,DRV MAINT + REG 4,ATTENTION + REG 5,DRV TRACK-SECTOR + REG 6,DRV TYPE + REG 7,DRV LOOK-AHEAD + REG 10,DRV SERIAL NO + REG 11,DRV OFFSET + REG 12,DRV DESIRED CYL + REG 13,DRV CURRENT CYL + REG 14,DRV ER2 + REG 15,DRV ER3 + REG 16,DRV ECC POS + REG 17,DRV ECC PAT + REG 40,CONTROL + REG 44,INTR ADDR + REG 50,DATA BUFFER + REG 54,RAE STATUS + REG 74,CHANNEL BUFFER + REG 100,FOO +LOC RHRGTB+40 +EXPUNGE REG,REGH,XX,YY,ZZ + +; BITS IN DIB REGISTER + +DIBSTS: STS 004000,CTL-TO-DRIVE + STS 002000,CTL BUS TIMEOUT + STS 001000,CTL BUS PARITY + STS 000400,DIB DATA LATE + STS 000200,DIB ILL CMD + 0 + +; DRIVE STATUS REGISTER + +STSSTS: STS 1,FWD 5 IPS + STS 2,FWD 20 IPS + STS 4,INNER GUARD BAND + STS 10,GO REVERSE + STS 20,DIFF < 64 + STS 40,DIFF = 1 + STS 100,VOLUME VALID + STS 200,DRIVE READY + STS 400,CONN THIS CTRLR + STS 2000,LAST SECTOR XFERD + STS 4000,WRITE LOCK + STS 10000,MEDIUM ONLINE + STS 20000,POSITIONING IN PROGRESS + STS 40000,ERR + STS 100000,ATTENTION + 0 + +; DRIVE ERROR REGISTER 1 + +ER1STS: STS 1,ILL FUNC + STS 2,ILL REG + STS 4,REG MOD REFUSE + STS 10,BUS PARITY ERR + STS 20,PACK FORMAT ERR + STS 40,WRITE CLOCK FAIL + STS 100,ECC HARD ERR + STS 200,HEADER WRONG + STS 400,HEADER CRC ERR + STS 1000,ADDR OVERFLOW + STS 2000,INVALID ADDR + STS 4000,WRITE LOCK ERR + STS 10000,DRV TIMING ERR + STS 20000,OP NOT COMPLETE + STS 40000,UNSAFE + STS 100000,DATA CHECK + 0 + +; DRIVE ERROR REGISTER 2 + +ER2STS: STS 1,WRITE CURRENT UNSAFE + STS 2,CURRENT SINK FAILURE + STS 4,WRITE SELECT UNSAFE + STS 10,CURRENT SWITCH UNSAFE + STS 20,MOTOR SEQUENCE ERR + STS 40,TRANSITIONS DET FAIL + STS 100,TRANSITIONS UNSAFE + STS 200,"UNSAFE EXCEPT R/W" + STS 400,WRITE READY UNSAFE + STS 1000,MULTIPLE HEAD SELECT + STS 2000,NO HEAD SELECT + STS 4000,INDEX ERROR + STS 10000,30 VOLT UNSAFE + STS 20000,PHASE LK OSC UNSAFE + STS 100000,AC UNSAFE + 0 + +; DRIVE ERROR REGISTER 3 + +ER3STS: STS 1,PACK SPEED UNSAFE + STS 2,VELOCITY UNSAFE + STS 10,UNSAFE EXCEPT R/W + STS 40,AC LOW + STS 100,DC LOW + STS 40000,SEEK INCOMPLETE + STS 100000,OFF CYLINDER + 0 + +; DRIVE OFFSET REGISTER + +OFSSTS: STS 2000,HDR COMPARE INH + STS 4000,ECC INHIBIT + STS 10000,PDP-11 FORMAT + 0 +];RH + +IFN T300P,[ +;PRINT STATUS OF T300 (ERROR FROM LAST COMMAND) +;LATER THIS WILL BE INTEGRATED INTO GSTS +T300ST: MOVEI P,PDL + PUSH P,[DDT] +T3STS: INSIRP PUSH P,[A B C D T I K] + TYPE T-300 AND 2561 STATUS: + SKIPN D,DSCFLT + JRST T3STS2 + TRNN D,%DFRST+%DFCQE+%DFNXM+%DFPAR + JRST T3STS1 + MOVEI C,[ STS %DFRST,CONTROLLER POWER-CYCLED AND RESET + STS %DFCQE,COMMAND-QUEUE ERROR + STS %DFNXM,RQB NXM + STS %DFPAR,RQB PARITY ERROR + 0 ] + MOVSS D ;TYPSTS WANTS BITS IN LEFT HALF + PUSHJ P,TYPSTS + TYPE , PDP-11 ERROR ADDRESS= + LDB A,[000200,,DSCFLT] + LSH A,16. + IOR A,DSCSTS + PUSHJ P,TOPT +T3STS9: PUSHJ P,CRR + JRST GSTS3 + +;FAULT CODE +T3STS1: CAILE D,17 + JRST [ TYPE ILLEGAL FAULT CODE= + MOVE A,D + PUSHJ P,TOPT + JRST T3STS9 ] + MOVE B,(D)[ [ASCIZ/FAULT CODE 0?/] + [ASCIZ/DRIVE NOT READY/] + [ASCIZ/ILLEGAL HEAD OR SECTOR/] + [ASCIZ/SEEK TIMEOUT/] + [ASCIZ/DISK STATUS BAD AFTER ON-CYLINDER (FAULT CODE 4)/] + [ASCIZ/TIME OUT WRITING SECTOR ID (FAULT CODE 5)/] + [ASCIZ/FIFO ERROR IN FORMAT WRITE (FAULT CODE 6)/] + [ASCIZ/WRITE TIMEOUT (FAULT CODE 7)/] + [ASCIZ/SEEK TIMEOUT (FAULT CODE 10)/] + [ASCIZ/HEADS NOT LOADED/] + [ASCIZ/READ TIMEOUT (FAULT CODE 12)/] + [ASCIZ/INDEX TIMEOUT (FAULT CODE 13)/] + [ASCIZ/SECTOR TIMEOUT (FAULT CODE 14)/] + [ASCIZ/FAULT CODE 15?/] + [ASCIZ/DMA TIMEOUT (FAULT CODE 16)/] + [ASCIZ/DMA TIMEOUT IN ECC (FAULT CODE 17)/] ] + PUSHJ P,OUTSTR + PUSHJ P,CRR +;COMMAND OK, CHECK ORDINARY ERROR STATUS +T3STS2: MOVE D,DSCSTS + MOVEI C,[ STS %DSRTR,COMMAND WAS RETRIED + STS %DSECH,UNCORRECTABLE DATA ERROR + STS %DSECC,CORRECTED DATA ERROR + STS %DSIDE,ID ERROR + STS %DSHCE,HEADER COMPARE ERROR + STS %DSPRT,WRITE-PROTECTED SECTOR + STS %DSALT,ALTERNATE-SECTOR FLAG + STS %DSOVR,OVERRUN + STS %DSSKE,SEEK ERROR + STS %DSOFL,DRIVE OFF-LINE OR FAULT + STS %DSFLT,DRIVE FAULT + STS %DSNXM,PDP11 MEMORY NXM + STS %DSPAR,PDP11 MEMORY PARITY ERROR + STS %DSSFL,SYSTEM FAULT + STS %DSWLK,DRIVE WRITE-LOCKED + 0 ] + MOVSS D ;TYPSTS WANTS D IN LEFT HALF + PUSHJ P,TYPSTS + PUSHJ P,CRR ;NOW SHOW DISK COMMAND AND ADDRESS + TYPE DISK COMMAND: + MOVE A,DSCCMD + PUSHJ P,TOPT + PUSHJ P,TSPAC + MOVEI B,[ASCIZ/(UNKNOWN?)/] + CAIN A,%DMSNS + MOVEI B,[ASCIZ/(SENSE)/] + CAIN A,%DMTST + MOVEI B,[ASCIZ/(DIAGNOSTICS)/] + CAIN A,%DMREC + MOVEI B,[ASCIZ/(RECALIBRATE)/] + CAIN A,%DMSEK + MOVEI B,[ASCIZ/(SEEK)/] + CAIN A,%DMWRT + MOVEI B,[ASCIZ/(WRITE)/] + TRNE A,%DMRED + JRST [ CAIG A,%DMRED+10 + MOVE B,(A)[ [ASCIZ/(READ)/] + [ASCIZ/(READ EARLY-DATA-STROBE)/] + [ASCIZ/(READ LATE-DATA-STROBE)/] + [ASCIZ/(READ POSITIVE-CYLINDER-OFFSET)/] + [ASCIZ/(READ NEGATIVE-CYLINDER-OFFSET)/] + [ASCIZ/(READ EARLY-DATA-STROBE POSITIVE-CYLINDER-OFFSET)/] + [ASCIZ/(READ EARLY-DATA-STROBE NEGATIVE-CYLINDER-OFFSET)/] + [ASCIZ/(READ LATE-DATA-STROBE POSITIVE-CYLINDER-OFFSET)/] + [ASCIZ/(READ LATE-DATA-STROBE NEGATIVE-CYLINDER-OFFSET)/] + ]-%DMRED + JRST .+1 ] + PUSHJ P,OUTSTR + TYPE , DRIVE= + MOVE A,DSCDRV + PUSHJ P,TOPT + TYPE , CYL= + MOVE A,DSCCYL + PUSHJ P,TOPT + TYPE , HEAD= + MOVE A,DSCHED + PUSHJ P,TOPT + TYPE , SEC= + MOVE A,DSCSEC + PUSHJ P,TOPT + JRST T3STS9 +];T300P + +SUBTTL READ & TYPE OUT HEADERS + +DC,[ ;FOR NOW, DC10 ONLY +RDHDHD==20 ;2WORDS PER SEC, MANY SECS + +RDHEAD: JSR INIT ;READ ALL HEADERS ON A TRACK + PUSHJ P,CRR + UNTMES UNIT= + PUSHJ P,GETNUM + JRST RDHEAD + CAIL A,NUNITS + JRST RDHEAD + MOVEM A,TOU + MOVE I,A + PUSHJ P,RESET +RDHD1: TYPE CYL= + PUSHJ P,GETNUM + JRST DDT + CAIL A,NCYLS+XCYLS + JRST RDHD1 + SKIPGE QTRAN(I) + ADDI A,NCYLS+XCYLS + DPB A,[DCYL READHD] + TYPE SURF= + PUSHJ P,GETNUM + SETZ A, + CAIL A,NHEDS + JRST RDHD1 + DPB A,[DSURF READHD] + DATAO DC0,[DJMP READHD] + CONSZ DC0,DSSACT + JRST .-1 + CONSZ DC0,DSSERR + JRST [ TYPE ERROR--- + JRST GETSTS] + SETOM SECT0' + SETOM FIRST + SETZ T, +RDHD2: MOVE D,HEADBF(T) + TLZ D,777000 + CAMN D,SECT0 + JRST RDHD1 ;GONE AROUND ONCE + AOSN FIRST + MOVEM D,SECT0 + TYPE PKID= + LDB A,[DPKID HEADBF(T)] + PUSHJ P,TOPT + PUSHJ P,TCOMMA + MOVE D,HEADBF(T) + PUSHJ P,TYPLOC + PUSHJ P,CRR + MOVE A,HEADBF+1(T) + TLNE A,1000 ;INDIRECT BIT OF HEADER + JRST [ MOVEI A,"@ + PUSHJ P,TYO + MOVE D,HEADBF+1(T) + PUSHJ P,TYPLOC + JRST RDHD6] + TYPE LENGTH= + MOVN A,HEADBF+1(T) + LDB A,[1600,,A] ;LENGTH FIELD + PUSHJ P,TOPT + LDB A,[270200,,HEADBF+1(T)] ;ANY NEXT-ADDRESS CODE? + JUMPE A,RDHD3 + MOVE B,NXTADR(A) + PUSHJ P,OUTSTR +RDHD3: MOVE A,HEADBF+1(T) + TLNE A,200 + JRST [ MOVEI B,[ASCIZ /,WRITE PROTECT/] + PUSHJ P,OUTSTR + JRST .+1] +RDHD6: SETO C, ;PARITY + HRLI T,-2 +RDHD4: MOVEI D,14. + MOVE A,HEADBF(T) + XORM A,C + LSH A,-2 + SOJG D,.-2 + AOBJN T,RDHD4 + TRNN C,3 ;BOTH ODD? + JRST RDHD5 + MOVEI B,[ASCIZ /,BAD PARITY!!/] + PUSHJ P,OUTSTR +RDHD5: PUSHJ P,CRR + CAIL T,RDHDHD*NSECS + JRST RDHD1 + JRST RDHD2 + +READHD: DSPC+DSWIDX+DSWNUL+DSCRHD ;WAIT FOR INDEX, THENREAD HEADERS + QCOPY HEADBF,RDHDHD*NSECS + DHLT + +HEADBF: BLOCK RDHDHD*NSECS + +TCOMMA: MOVEI A,", + JRST TYO + +NXTADR: 0 + [ASCIZ /,END-OF-TRACK/] + [ASCIZ /,END-OF-CYLINDER/] + [ASCIZ /,END-OF-DISC/] + +TYPLOC: TYPE CYL= + LDB A,[DCYL D] + PUSHJ P,TOPT + TYPE ,SURF= + LDB A,[DSURF D] + PUSHJ P,TOPT + TYPE ,SECT= + LDB A,[DSECT D] + JRST TOPT + +GETNUM: SETZ C, + SETOM FIRST +GETNM1: PUSHJ P,TYI + CAIL A,"0 + CAILE A,"9 + JRST [ MOVE A,C + SKIPL FIRST + AOS (P) + JRST CRR] + AOS FIRST + IMULI C,10 + ADDI C,-"0(A) + JRST GETNM1 +];DC + +SUBTTL DRIVE RESET + +NTS,[ +DC,[ +RECAL: CONO DC0,DCCSET+DCDENB + MOVE T,QTRAN(I) + SKIPL DRIVE(T) ;SKIP IF DRIVE NOT KNOWN TO BE DEAD ALREADY + JRST [ SETZM QACT(I) + POPJ P,] + DPB T,[DUNFLD DRST] + DPB T,[DUNFLD STOSTS] + DATAO DC0,[DJMP STOSTS] + CONSZ DC0,DSSACT + JRST .-1 + MOVE T,STATUS + TDNN T,[DDSONL] ;ON LINE + JRST OFFL1 + DATAO DC0,DRST + CONSO DC0,DSSATT + JRST .-1 + CONSO DC1,20 ;OFF LINE OR MULTIPLE SELECT + POPJ P, +OFFL1: SETZM QACT(I) + SKIPE GOGOX + POPJ P, ;IN GOGO MODE, WILL CHECK FOR RIGHT PACKS MOUNTED + TYPE Drive off line # + PUSH P,A + HRRZ A,QTRAN(I) + SETZM DRIVE(A) + PUSHJ P,DPT + POP P,A + PUSHJ P,CRR + POPJ P, +];DC + +RP,[ +RESET: PUSH P,A + CONSZ DPC,BUSY + JRST .-1 + DATAO DPC,[DEASEC 776] + DPB I,[DUNFLD DRST] + DATAO DPC,DRST +RESET0: DATAI DPC,T + TLNE T,20 + JRST RESET1 + SKIPE GOGOX + JRST RESET9 ;IN GOGO MODE, WILL CHECK FOR RIGHT PACKS MOUNTED + TYPE OFF LINE # + MOVE A,I + PUSHJ P,DPT + PUSHJ P,CRR + JRST RESET9 + +RESET1: TLNN T,4 + JRST RESET2 + SKIPE GOGOX + JRST RESET9 ;IN GOGO MODE, WILL CHECK FOR RIGHT PACKS MOUNTED + TYPE NO SUCH DRIVE # + MOVE A,I + PUSHJ P,DPT + PUSHJ P,LCRR + JRST RESET9 + +RESET2: TRNN T,776 + JRST RESET0 + DATAO DPC,[DEASEC 776] + JRST POPAJ + +RESET9: SETZM QACT(I) ;THIS DRIVE LOST + JRST POPAJ + +DRST: DRCALC +];RP + +DC,[ +RESET: PUSHJ P,RECAL + MOVE T,QTRAN(I) ;GET PACK ID FROM HARDWARE + DPB T,[DUNFLD GPKID] + MOVEI T,TUTCYL + SKIPGE QTRAN(I) + ADDI T,NCYLS+XCYLS + DPB T,[DCYL GPKID] + CONO DC0,DCCSET+DCDENB + DATAO DC0,[DJMP GPKID] + CONSZ DC0,DSSACT + JRST .-1 + LDB T,[DPKID RPKID] + MOVEM T,PKNUM(I) + POPJ P, + +DRST: DSPC+DSRCAL+DSWINF+DUNENB +GPKID: DSPC+DSCRHD+DSWNUL+DUNENB+TUTCYL_11.+TUTSRF_6+TUTSEC + DCOPY RPKID(37774) + DHLT +];DC +];NTS + +TS,[ +RESET: PUSH P,A + HRRZ A,QTRAN(I) + SKIPL DRIVE(A) + JRST OFFL2 + CAML I,NQS + JRST OFFL2 + HRRZ A,SQACT ;SYSTEM QACT TABLE + ADD A,I + MOVSS A + HRRI A,A + .GETLOC A, ;COPY SYSTEMS QACT + SKIPE A ;0 MEANS ON-LINE TO ITS + JRST OFFLIN + POP P,A + POPJ P, + + +OFFLIN: TYPE Drive off line # + HRRZ A,QTRAN(I) + SETZM DRIVE(A) + PUSHJ P,DPT + PUSHJ P,CRR +OFFL2: SETZM QACT(I) + POP P,A + POPJ P, +];TS + +NTS,[ +RH,[ +RESET: MOVE T,QTRAN(I) ;GET PHYS DRIVE +IFN T300P,[ + CAIL I,T300P + JRST T3RST +];T300P + SKIPL DRIVE(T) + JRST [ SETZM QACT(I) ;DRIVE ALREADY KNOWN TO BE DOWN + POPJ P, ] + PUSH P,A + MOVE A,[%HRDCL,,%HMCLR] ;CLEAR THE DRIVE + PUSHJ P,RHSET + JRST RESETL ;HMM, NO DRIVE + MOVE A,[%HRDCL,,%HMRDP] ;I SAID, "CLEAR THE DRIVE"! + PUSHJ P,RHSET + JRST RESETL + MOVE A,[%HROFS,,0] ;CLEAR THE FRIGGING DRIVE!!! + PUSHJ P,RHSET + JRST RESETL + MOVSI A,%HRTYP ;GET DRIVE TYPE + PUSHJ P,RHGET + JRST RESETL ;?? + TRNE A,140000 + JRST RESETL ;TAPE? + TRNN A,020000 + JRST RESETL ;FIXED HEADS? + MOVE A,[%HRDCL,,%HMACK] ;PACK ACKNOWLEDGE + PUSHJ P,RHSET + JRST RESETL + MOVSI A,%HRSTS + PUSHJ P,RHGET + JRST RESETL + TRNN A,%HSMOL + JRST RESET4 ;PACK NOT MOUNTED + MOVE A,[%HRDCL,,%HMREC] ;RECALIBRATE + PUSHJ P,RHSET + JRST RESETL + MOVEI B,80000. ;A LITTLE OVER 1/2 SEC +RESET0: MOVSI A,%HRSTS ;GET STATUS + PUSHJ P,RHGET + JRST RESETL ;DRIVE VANISHED? + TRNE A,%HSERR + JRST RESETL ;GOT ERROR RECALIBRATING? + TRC A,%HSVV+%HSMOL+%HSRDY ;CHECK FOR GOOD BITS + TRCE A,%HSVV+%HSMOL+%HSRDY + SOJG B,RESET0 ;BITS NOT ALL ON, WAIT MORE + JUMPG B,RESET5 ;WON. + ;TIMED OUT, FALL INTO RESETL + +RESETL: SETZM QACT(I) ;LOST + SKIPE GOGOX + JRST POPAJ ;IN GOGO MODE, WILL CHECK FOR RIGHT PACKS MOUNTED + CONSZ DSK,%HIDRE + JRST RESET1 + CONSZ DSK,%HIILC + JRST RESET2 + TYPE MISC ERROR DRIVE # + MOVEI A,GSTS ;CALL GSTS BEFORE RETURNING + EXCH A,(P) + PUSH P,A + JRST RESET3 + +RESET2: TYPE ILC OR RAE DRIVE # + JRST RESET3 + +RESET1: TYPE DRIVE NOT PRESENT # +RESET3: HRRZ A,QTRAN(I) + X DPT + X CRR + JRST POPAJ + +RESET4: SETZM QACT(I) + SKIPE GOGOX + JRST POPAJ ;IN GOGO MODE, WILL CHECK FOR RIGHT PACKS MOUNTED + TYPE DRIVE OFF LINE # + JRST RESET3 + +RESET5: SKIPE MARKF + JRST POPAJ ;PACK NOT FORMATTED YET + MOVSI A,%HRCYL + HRRI A,TUTCYL + PUSHJ P,RHSET + JRST RESETL + MOVSI A,%HRADR + PUSHJ P,RHSET + JRST RESETL + MOVE A,[-2_4,,SLVIOWD-1] + MOVEM A,SLVICWA + SETZM SLVICWA+1 +KL,[ SWPUO 0 + CONSZ APR,200000 + JRST .-1 +] + MOVE A,[%HRCTL,,SLVICWA_6+%HMRHD] + PUSHJ P,RHSET + JRST RESETL + CONSO DSK,%HIDONE + JRST .-1 + CONSZ DSK,%HIERR + JRST RESETL + HRRZ A,SLVIOWD+1 ;GET I.T.S. PACK NUMBER + MOVEM A,PKNUM(I) + JRST POPAJ +];RH + +IFN T300P,[ +T3RST: PUSH P,D + MOVEI D,%DMSNS ;FIRST, SENSE STATUS (RECALIBRATE HANGS IF + PUSHJ P,T3CMD ; DRIVE OFF LINE, AND TIMEOUT LEAVES 11 WEDGED) + JUMPL T,T3RSTL ;TIMEOUT, 11 MUST BE DOWN + TDNE T,[%DFRST,,%DSOFL+%DSSFL] + JRST T3RSTL ;DRIVE OFF-LINE, LEAVE IT ALONE + MOVEI D,%DMREC ;SEND A RECALIBRATE + PUSHJ P,T3CMD + JUMPN T,T3RSTL ;JUMP IF ERROR + SETOM PKNUM(I) ;PACK NUMBER NOT GOTTEN FROM HARDWARE! + POP P,D + POPJ P, + +T3RSTL: SETZM QACT(I) ;OFF LINE + POP P,D + SKIPN GOGOX + JRST T3STS + POPJ P, + +;DO COMMAND IN D ON DRIVE NUMBER IN I, RETURN STATUS IN T (0 IF OK) +;LH(T) GETS DSCFLT, RH(T) GETS DSCSTS +;YOU MUST SET UP DSCCYL, ETC. BEFORE CALLING +T3CMD: MOVEI T,2561 + MOVEM T,DSCCHK + MOVEM D,DSCCMD + MOVEI T,-T300P(I) + MOVEM T,DSCDRV + SETZM DSCDON +KL,[ SWPUO 0 ;UNLOAD PAGE 0 FROM THE CACHE + CONSZ APR,200000 + JRST .-1 +];KL + MOVEI T,1 + MOVEM T,DSCREQ +KL,[ SWPUO 0 ;UNLOAD PAGE 0 FROM THE CACHE + CONSZ APR,200000 ;AGAIN SO 11 WILL SEE DSCREQ ON IN INTERRUPT + JRST .-1 +];KL + CONO DLC,100040 ;INTERRUPT 11 + MOVEI T,60000. ;I THINK THIS TIMEOUT IS ABOUT 3 SECONDS + ;UNFORTUNATELY, THIS TIMEOUT DOESN'T WORK ANYWAY + ;REALLY, BECAUSE IF DRIVE 0 IS OFFLINE THE + ;CONTROLLER HANGS AND EXECUTES COMMANDS WRONG + ;AND OTHERWISE LOSES ITS ASS. +T3CMD1: +KL,[ SWPUO 0 ;UNLOAD PAGE 0 FROM THE CACHE + CONSZ APR,200000 ;AGAIN SO DSCDON GETS PICKED UP FROM MAIN MEMORY + JRST .-1 +];KL + SKIPN DSCDON + SOJG T,T3CMD1 + JUMPLE T,[ MOVSI T,(SETZ) ;SIGNAL TIMEOUT (DRIVE OFFLINE?) + POPJ P, ] ;DSCFLT & DSCSTS WILL SAY NON-ERROR + SETZM DSCDON + CONO DLC,10 ;11 IS TRYING TO INTERRUPT -10, TURN IT OFF + HRLZ T,DSCFLT + HRR T,DSCSTS + TRZE T,%DSRTR+%DSECC ;THESE ARE NOT ERRORS + AOS CERRS + POPJ P, +];T300P +];NTS + +SUBTTL READ & WRITE TUT + +;DISK NUMBER IN I, CORE ADDR IN A, ERROR RETURN HAS T NEGATIVE + +WRTUT: +TS, JRST SUCCESS +NTS,[ MOVE J,MFDBK + SUB J,NTBL(I) +WRTUT0: PUSHJ P,WRITE + JUMPL T,CPOPJ + ADDI A,2000 + ADDI J,1 + CAMGE J,MFDBK + JRST WRTUT0 + POPJ P, +];NTS + +RDTUT: +NTS,[ MOVE J,MFDBK + SUB J,NTBL(I) +RDTUT0: PUSHJ P,READ + JUMPL T,CPOPJ + ADDI A,2000 + ADDI J,1 + CAMGE J,MFDBK + JRST RDTUT0 + POPJ P, +];NTS +TS,[ TUTPAG==600000 ;READ TUT BY MAPPING IN ABS PAGE + MOVE T,NTBL(I) ;SIZE OF TUT ON THIS DRIVE + MOVE J,[SQUOZE 0,QTUTO] ;AND WHERE ARE THEY LOCATED? + .EVAL J, + .VALUE + PUSH P,A + PUSH P,I + ADD J,I ;-> -> FIRST BLOCK THIS TUT + MOVSS J + HRRI J,J + .GETLOC J, + HRRZS J + LSH J,-10. ;FIRST BLOCK# OF TUT + MOVN I,T + HRL J,I ;AOBJN PTR FOR BLOCKS OF THIS TUT +RDTUT1: .CALL [ SETZ + 'CORBLK + MOVEI 210000 ;READ ONLY + MOVEI -1 ;INTO SELF + MOVEI TUTPAG/2000 + MOVEI 400000 ;FROM SYSTEM + SETZI (J) ] + .VALUE + MOVSI I,TUTPAG + JRST RDTUT3 + +RDTUT3: HRRI I,(A) + BLT I,1777(A) ;COPY IN A BLOCK OF TUT + ADDI A,2000 + AOBJN J,RDTUT1 + POP P,I + POP P,A + SKIPGE QPKNUM(A) + .VALUE ;OLD FORMAT? + SKIPN QLASTB(A) + .VALUE ;OLDER FORMAT? + JRST SUCCESS +];TS + +SUBTTL DISK I/O + +WRITT: MOVE I,TOU +WRITE: HRRZM J,LBLK' +TS,[ HRRZ TT,I + CAML TT,NQS + .VALUE + HRRZ TT,J + CAIGE TT,TBLKS + SKIPGE TT + .VALUE + JRST SUCCESS +];TS +DC,[ SKIPA T,[DWR] +READ: MOVEI T,DRD ;A/ CORE LOCN, I/ DRIVE J/TRACK # + HRRM T,DGO + HRRZM J,BLK + MOVEM I,UNIT + HRRZ TT,I + CAIL TT,NUNITS + JRST 4,. + HRRZ TT,J + CAIGE TT,TBLKS + SKIPGE TT + JRST 4,. + MOVE TT,QTRAN(I) ;GET PHYSICAL DRIVE # + DPB TT,[DUNFLD (T)] + DPB A,[DCCA 1(T)] + DPB A,[DCCA 4(T)] + HRRZ TT,J + CAIL TT,NBLKS+XBLKS + JRST 4,. + IDIVI TT,NSECS + DPB T,[DSECT @DGO] + IDIVI TT,NHEDS + DPB T,[DSURF @DGO] + MOVE T,TT + SKIPGE QTRAN(I) + ADDI T,NCYLS+XCYLS ;MAP INTO 2ND HALF OF CALCOMP + DPB T,[DCYL @DGO] + MOVE T,PKNUM(I) + CAIL TT,NCYLS + MOVEI T,0 + DPB T,[DPKID @DGO] + HRRZ TT,DGO + MOVE T,(TT) + TLZ T,340000 ;CHANGE TO READ COMPARE + MOVEM T,3(TT) +RW1: MOVEI T,30. + SKIPE HCRASH + MOVEI T,0 ;SPEED IS OF THE ESSENCE - TRY ONLY ONCE +RW2: CONO DC0,DCCSET\DCDENB + DATAO DC0,DGO + MOVSI TT,3 ;WAIT AT MOST 3 SECONDS + CONSZ DC0,DSSACT + SOJGE TT,.-1 + JUMPL TT,[ PUSH P,T + X RECAL + POP P,T + JRST .+2 ] + CONSZ DC0,DSSERR + SOJGE T,RW2 + SKIPGE T + AOS FERRS + POPJ P, + +DGO: DJMP . + +DRD: DREAD+DUNENB + DCOPY .(-2000_2&37774) + DCOPY RXWDS(-4_2&37774) + DRC + DCCOMP .(-2000_2&37774) + DCCOMP RXWDS (-4_2&37774) + DHLT + +DWR: DWRITE+DUNENB + DCOPY .(-2000_2&37774) + DCOPY WXWDS(-4_2&37774) + DRC + DCCOMP .(-2000_2&37774) + DCCOMP WXWDS(-4_2&37774) + DHLT +];DC + +TS,[ +READ: HRRZ TT,I + CAIL TT,NUNITS + .VALUE + HRRZ TT,J + CAMN TT,MFDBK + JRST [ .OPEN QIN,[.BII,,'DSK + SIXBIT /M.F.D./ + SIXBIT /(FILE)/] + .VALUE + JRST RDIN] + CAML TT,NUDS + .VALUE ;SOME RANDOM DISK BLOCK + .SUSET [.SSNAM,,USRNAM] + .OPEN QIN,[.BII,,'DSK + SIXBIT /.FILE./ + SIXBIT /(DIR)/] + .VALUE +RDIN: HRLI A,-2000 + .IOT QIN,A + .CLOSE QIN, +SUCCES: MOVEI T,30. + POPJ P, +];TS + RP,[ ;RP10 I/O - FALL IN FROM WRITE + SKIPA T,DWR +READ: MOVE T,DRD + MOVEM T,RPIOOP + HRRZ TT,J + CAIL TT,MBLKS+XBLKS + JRST 4,. + IMULI TT,SECBLK + IDIVI TT,NSECS + MOVEM T,RPIOSC + IDIVI TT,NHEDS + MOVEM T,RPIOHD + MOVEM TT,RPIOCY + MOVEM A,RPAOBJ + MOVNI T,2000 + HRLM T,RPAOBJ + JRST RPIO ;DO IT + +DRD: DREADC+SLVICWA+5000 ;DISABLE PARITY ERROR STOPS +DWR: DWRITC+SLVICWA + +;VARIABLES SET UP TO CONTROL TRANSFER +;WHEN AN ERROR OCCURS, IT GOES INTO SECTOR AT A TIME MODE, AND +;THESE VARIABLES ARE STEPPED ALONG TO REFLECT THAT. +RPAOBJ: 0 ;AOBJN POINTER TO WORDS TO BE TRANSFERRED +RPIOCY: 0 ;CYLINDER TO START AT +RPIOHD: 0 ;HEAD TO START AT +RPIOSC: 0 ;SECTOR TO START AT +RPIOOP: 0 ;COMMAND WORD. SLVICWA ALREADY ADDED IN +;UNIT IS IN I + +;HIGH-LEVEL I/O ROUTINE. TRIES TO DO IT ALL AT ONCE, +;IF THAT LOSES TWICE TRIES IT A SECTOR AT A TIME. +;IF HCRASH IS SET, TRY ONLY ONCE. +;SMASHES T, TT. RETURNS T NEGATIVE IF ERROR. +RPIO: PUSH P,A + SETZM SLVIOWD+1 + MOVE T,RPAOBJ + SOS T + MOVEM T,SLVIOWD + PUSHJ P,RPXIO ;TRY IT + JRST RPIO1 + MOVEI T,102 ;WON + JRST RPIO9 + +RPIO1: SETOM T + SKIPE HCRASH + JRST RPIO9 ;GIVE UP IF HCRASH + PUSHJ P,RPRCAL ;RECALIBRATE, THEN + PUSHJ P,RPXIO ;TRY IT AGAIN + JRST RPIO2 + MOVEI T,101 ;WON +RPIO9: SKIPGE T + AOS FERRS + POP P,A + POPJ P, + +;SECTOR AT A TIME MODE +RPIO2: MOVEI T,100 + SKIPL TT,RPAOBJ + JRST RPIO9 ;TRANSFER EXHAUSTED, WON + SOS TT + HRLI TT,-200 + MOVEM TT,SLVIOWD + MOVEI T,10. ;TRY THIS SECTOR 10 TIMES + PUSHJ P,RPXIO + SOJGE T,.-1 + JUMPL T,RPIO9 ;GIVE UP + MOVE T,[200,,200] ;ADVANCE TO NEXT SECTOR + ADDM T,RPAOBJ + AOS T,RPIOSC + CAIGE T,NSECS + JRST RPIO2 + SETZM RPIOSC + AOS T,RPIOHD + CAIGE T,NHEDS + JRST RPIO2 + SKIPL RPAOBJ + JRST RPIO2 + JRST 4,. ;CYLINDER OVERFLOW? + +;LOW-LEVEL IO, JUST DO THE OPERATION SPECIFIED IN THE VARIABLES. +;CLOBBER A,TT. +;SKIP IF SUCCESS. +RPXIO: MOVEI TT,SLVIOWD ;SET UP DF10 COMMAND + HRRZM TT,SLVICWA + SETZM SLVICWA+1 + PUSH P,T + PUSHJ P,SEEK ;MAKE SURE AT DESIRED CYLINDER + JRST POPTJ ;SEEK FAILED + POP P,T + MOVE A,RPIOOP ;SET UP RP10 DATAO + DPB I,[DUNFLD A] + MOVE TT,RPIOCY + DPB TT,[DCYL A] + LSH TT,-8 ;FOR RP03 + DPB TT,[DCYLXB A] + MOVE TT,RPIOHD + DPB TT,[DSURF A] + MOVE TT,RPIOSC + DPB TT,[DSECT A] + CONO DPC,DCLEAR + SKIPN HCRASH ;IF HCRASH, MAY BE MONITORING SOMETHING IN LIGHTS? + DATAO LIGHTS,A + DATAO DPC,A ;ISSUE COMMAND + CONSO DPC,DONE ;AWAIT DONE + JRST .-1 + CONSZ DPC,ALLER ;SKIP-RETURN UNLESS ERROR + POPJ P, + HLRO TT,RPAOBJ ;SEEMS SUCCESSFUL, CHECK THE CHANNEL CONTROL WORD STORED + HRRZ A,RPAOBJ + SUB A,TT ;SUPPOSED END OF TRANSFER + HRRZ TT,SLVICWA+1 + CAIE A,1(TT) +DF10FK: POPJ P, ;CHANNEL TRYING TO FUCK YOU OVER + JRST POPJ1 + +;RECALIBRATE UNIT IN I, SMASHES T,TT +RPRCAL: CONO DPC,DCLEAR + MOVE T,[DEASEC 776] + DPB I,[DUNFLD T] ;LEAVE PROPER UNIT SELECTED FOR GETSTS + DATAO DPC,T ;CLEAR ATTNS + DPB I,[DUNFLD DRST] + DATAO DPC,DRST +RPRCL1: DATAI DPC,TT + TLNN TT,(ONLINE) + POPJ P, ;OFF LINE + TLNE TT,(NSCHDR) + POPJ P, ;NO SUCH DRIVE + TRNN TT,776 + JRST RPRCL1 ;AWAIT ATTENTION + DATAO DPC,T ;GOT ATTENTION, CLEAR IT +RPRCL2: TLNE TT,(ONCYL+SKINC) + POPJ P, ;DONE + DATAI DPC,TT + JRST RPRCL2 ;ON CYLINDER SOMETIMES TAKES A WHILE TO SET + +;SEEK TO CYLINDER IN RPIOCY ON UNIT I, SMASHES T,TT, SKIPS ON SUCCESS. +SEEK: MOVEI TT,10. + MOVEM TT,SEEKC +SEEK1: CONSZ DPC,BUSY + JRST .-1 + DATAO DPC,[DEASEC 776] + MOVSI TT,(DSEEKC) + DPB I,[DUNFLD TT] + MOVE T,RPIOCY + DPB T,[DCYL TT] + LSH T,-8 ;FOR RP03 + DPB T,[DCYLXB TT] + SKIPN HCRASH + DATAO LIGHTS,TT + CONO DPC,DCLEAR + DATAO DPC,TT + MOVE T,[DEASEC 776] + DPB I,[DUNFLD T] ;LEAVE PROPER UNIT SELECTED FOR GETSTS + PUSHJ P,RPRCL1 ;AWAIT COMPLETION + TLNE TT,(ONCYL) ;SUCCEED IF ON CYLINDER + JRST POPJ1 + SOSGE T,SEEKC ;COUNT FAILURES + POPJ P, ;GIVE UP + PUSHJ P,RPRCAL ;RECALIBRATE + JRST SEEK1 ;AND TRY AGAIN +];RP + RH,[ ;RH10 I/O - FALL IN FROM WRITE + +;ENTER WITH: A ADDRESS, J BLOCK NUMBER, I VIRTUAL UNIT +.SEE RHCMD ;VARIABLES CONTROLLING WHAT GOES ON HERE +;INSIDE RW2 TT GENERALLY HAS THE DISK COMMAND AND T HAS THE RETRY COUNT +;ONLY T AND TT CLOBBERED +;ON RETURN T MINUS IF ERROR + + SKIPA TT,[%HMWRT] +READ: MOVEI TT,%HMRED +IFN T300P,[ + CAIL I,T300P + JRST T3IO + SETZM T3IOP +];T300P + MOVEM TT,RHCMD + HRRZ TT,J + CAIL TT,TBLKS + JRST 4,. + IDIVI TT,NBLKSC ;TT:=CYLINDER, T:=BLOCKS INTO CYLINDER + HRLZM TT,RHPGA ;SAVE CYLINDER + MOVE TT,T ;GET BLOCKS INTO CYLINDER + IMULI TT,SECBLK ;SECTORS INTO CYLINDER + IDIVI TT,NSECS ;TT:=HEAD, T:=SECTOR + LSH TT,8 ;FORM ADDRESS WORD + IOR TT,T + HRRM TT,RHPGA ;COMPLETE THE ADDRESS + MOVEI T,-1(A) ;SET UP IOWD TO TRANSFER ONE BLOCK + HRLI T,-2000 + MOVEM T,RHIOW +;ENTER HERE WITH RHCMD, RHIOW, AND RHPGA SET UP. I HAS UNIT#. +RW1: MOVEI T,5 ;INIT LOSAGE COUNT + PUSHJ P,RW2 ;TRY + JRST RW7 ;FAILED +;HERE TO RETURN. T SAYS WHETHER WINNING OR LOSING. +RW5: MOVE A,[%HRDCL,,%HMCEN] ;RETURN TO CENTER-LINE IF NECESSARY + AOSN OFFSTF + PUSHJ P,RHSET + JFCL + SKIPGE T + AOS FERRS + MOVE A,RHIOW ;RESTORE A + MOVEI A,1(A) + POPJ P, + +;HERE IF LOSING. +RW7: SKIPE HCRASH + JRST RWL0 ;SPEED IS OF THE ESSENCE, TRY ONLY ONCE + PUSHJ P,RW2 ;HMM, TRY AGAIN + JRST RWLOSS ;STILL LOSING, COGITATE + JRST RW5 ;WINNING NOW + +RWLOSS: MOVSI A,%HROFS ;ATTACK OFFSET REGISTER + HRR A,OFFSTB(T) ;SET APPROPRIATE OFFSET VALUE + SETOM OFFSTF' ;REMEMBER TO RETURN TO CENTERLINE LATER + PUSHJ P,RHSET + JRST RWL0 ;WHAT?? + MOVE A,[%HRDCL,,%HMOFS] + PUSHJ P,RHSET + JRST RWL0 + MOVEI A,20000. ;WAIT 10 MS OR SO FOR GOOD LUCK + SOJG A,. + PUSHJ P,RW2 ;TRY IT NOW + SOJGE T,RWLOSS ;LOSE, TRY WITH DIFFERENT OFFSET + JUMPGE T,RW5 ;WON, SO TAKE WIN RETURN +RWL0: SETO T, ;COMPLETE LOSS, RETURN NOW + JRST RW5 + +OFFSTB: 260 + 60 + 240 + 40 + 220 + 20 + ;RH10 I/O ROUTINE PROPER +;FIRST STEP IS TO SET UP CHANNEL COMMAND LIST +RW2: MOVE TT,RHIOW ;SET UP ADDRESSES + MOVEM TT,RHTIOW + MOVE TT,RHPGA + MOVEM TT,RHTPGA +;RE-ENTER HERE AFTER ECC ERROR +RW2OVR: PUSH P,B + PUSH P,C + MOVE A,[-6,,SLVIOWD] ;POINTS TO WHERE CCWS WILL BE STORED + HLRO C,RHTIOW ;MINUS NUMBER OF WORDS TO TRANSFER + MOVNS C ;POSITIVE + HRRZ B,RHTIOW ;ADDRESS MINUS ONE +RW2CC1: MOVN TT,C ;WORDS TO TRANSFER IN THIS CCW + CAIL C,40000-200 ;WC IS ONLY A 14-BIT FIELD + MOVNI TT,40000-200 + MOVEM B,(A) ;STORE CA + DPB TT,[$DFWC (A)] ;STORE WC + ADD C,TT ;LESS WORDS TO DO + SUB B,TT ;ADVANCE ADDRESS + AOBJP A,[JRST 4,.] ;ADVANCE CCW PTR, HALT IF TOO BIG! + JUMPG C,RW2CC1 ;NEED MORE WORDS + SETZM (A) ;END CCW LIST + HRRZI A,SLVIOWD ;POINT CHANNEL AT IT + MOVEM A,SLVICWA + SETZM SLVICWA+1 ;INIT FOR CONTROL WORD WRITING + POP P,C + POP P,B + MOVEI A,SLVICWA ;BUILD DATAO CMD + MOVE TT,RHCMD + DPB A,[$HCICWA TT] + TLO TT,%HRCTL ;FILL OUT COMMAND WORD + ;NOW BEFORE GIVING COMMAND CHECK STATUS + CONSZ DSK,%HIBSY ;WAIT FOR DSK CONTROL + JRST .-1 + CONO DSK,%HOCLR ;CLEAR ANY LEFT-OVER ERROR INDICATORS +RW2A: MOVSI A,%HRSTS ;CHECK DRIVE STATUS + PUSHJ P,RHGET + JRST RW3 ;DRIVE VANISHED?? + TRNE A,%HSPIP ;WAIT FOR POSITIONING + JRST RW2A ;(MIGHT BE OFFSETTING HEADS?) + TRNE A,%HSERR ;ANY ERRORS IN DRIVE? + JRST RW6 ;YES, TRY TO RECOVER + TRC A,%HSVV+%HSMOL+%HSRDY ;CHECK FOR ALL READY BITS ON + TRCE A,%HSVV+%HSMOL+%HSRDY + JRST RW3 ;NOT READY?? + HLRZ A,RHTPGA ;SET CYLINDER + TLO A,%HRCYL + PUSHJ P,RHSET + JRST RW3 + HRRZ A,RHTPGA ;SET TRACK-SECTOR + TLO A,%HRADR + PUSHJ P,RHSET + JRST RW3 +KL,[ MOVE A,RHTIOW ;SWEEP THE CACHE + AOS A ;RH ADDRESS OF BUFFER, LH - # WDS + LSH A,-9. + TRZ A,777000 + TLO A,777000 ;A NOW HAS AOBJN PTR TO PAGES +RWSWP3: TRNE TT,10 ;SWEEP ONE PAGE + SWPIO (A) ;IF READING, INVALIDATE + TRNN TT,10 + SWPUO (A) ;IF WRITING, UNLOAD + CONSZ APR,200000 ;WAIT UNTIL SWEEPER WAKES + JRST .-1 + AOBJN A,RWSWP3 + SWPUO 0 ;STORE CHANNEL PROGRAM IN CORE + CONSZ APR,200000 + JRST .-1 +];KL +;DROPS THROUGH + ;DROPS IN +RWGO: MOVE A,TT ;ISSUE I/O COMMAND + PUSHJ P,RHSET + JRST RW3 + CONSO DSK,%HIDONE ;WAIT FOR COMPLETION + JRST .-1 + MOVSI A,%HRSTS ;CHECK DISK STATUS, ERRORS DON'T ALWAYS SHOW UP IN CONI + PUSHJ P,RHGET + JRST RW3 + TRNN A,%HSERR + CONSZ DSK,%HIERR + CAIA + JRST POPJ1 ;NO ERROR, SKIP RETURN FROM RW2 +;FOLLOWING TWO LINES CAUSE ECC NOT TO WORK +; CONSO DSK,%HIEXC +; POPJ P, ;NOT DRIVE EXCEPTION, PROBABLY CORRIGIBLE BY RETRY + TRNN A,%HSERR ;ANYTHING IN ERR REGS? + JRST RW3 ;FOO, WHAT IS GOING ON?? + MOVSI A,%HRER2 ;MAKE SURE NO UNSAFES + PUSHJ P,RHGET + JRST RW3 + JUMPN A,RW3 + MOVSI A,%HRER3 + PUSHJ P,RHGET + JRST RW3 + JUMPN A,RW3 + MOVSI A,%HRER1 ;GET ERROR1 REG + PUSHJ P,RHGET + JRST RW3 + TRNE A,077067 ;GROSS ERROR? + JRST RW3 ;YES, ABORT + TRZE A,100000 ;SEE IF CORRECTABLE DATA ERROR + JUMPE A,RWECC ;YES, GO FIX IT + POPJ P, ;ERROR, BUT RETRY MAY WIN + +RW6: MOVE A,[%HRDCL,,%HMCLR] ;ERROR IN DRIVE, TRY CLEARING + PUSHJ P,RHSET + JRST RW3 + MOVSI A,%HRSTS + PUSHJ P,RHGET + JRST RW3 + TRNN A,%HSERR + JRST RW2A ;WON + ;LOST, FALL INTO RW3 + +RW3: POP P,(P) ;UNCORRECTABLE ERROR, RW FAILS + JRST RWL0 + +;ERROR CORRECTION CODE -- TAKEN FROM MAINDEC-10-DDRPF +; THAT CODE HAD NO HOPE WHATSOEVER OF WORKING. RETAKEN FROM ITS. +; THAT CODE DIDN'T WORK EITHER. TAKEN FROM NEWER ITS. + +RWECC: TRNN TT,10 ;SKIP IF READ + POPJ P, ;RETRY IF WRITE + INSIRP PUSH P,[B W U J K H] + DW1==W ;FIRST WORD IN ERROR + DW2==U ;SECOND WORD IN ERROR + EP1==J ;FIRST WORD OF ERROR PATTERN + EP2==K ;SECOND WORD OF ERROR PATTERN + ADR==H ;ADDRESS OF LOSING WORDS + ;B ;SO CAN DIVIDE A + SKIPN A,SLVICWA+1 ;GET ADDRESS OF LAST WORD TRANSFERRED + JRST 4,.-1 ;CHANNEL SHOULD HAVE STORED CONTROL WORD + SOS ADR,A ;LAST WORD TRANSFERRED (SUPPOSEDLY) + ANDI ADR,-200 ;IN ANY CASE, THIS MAKES ADR -> START OF SECTOR + HRRZ A,RHTIOW ;ADR-1 OF START OF TRANSFER + SUBM ADR,A + SOS B,A ;NUMBER OF WORDS SUCCESSFULLY TRANSFERRED + MOVEM B,RHSUCC ;SAVE + HLRO K,RHTIOW + MOVNS K + CAIL B,0 ;CHECK FOR CHANNEL LYING + CAILE B,-200(K) + JRST RWECC3 ;FRAUD, TRANSFERRED NEGATIVE OR TOO MANY WORDS + MOVSI A,%HRPOS ;GET ERROR POSITION + PUSHJ P,RHGET + JRST RWECC3 + SOJL A,RWECC3 ;WHICH IS OFF BY 1. IF ZERO, LOSE. + IDIVI A,36. ;CONVERT TO WORD AND BIT + ADD ADR,A + MOVS DW1,(ADR) ;FETCH THE TWO LOSING WORDS + MOVS DW2,1(ADR) + MOVSI A,%HRPAT ;GET ERROR PATTERN + PUSHJ P,RHGET + JRST RWECC3 + MOVE EP1,A + SETZ EP2, + ROTC EP1,(B) ;ALIGN IT + XOR DW1,EP1 ;FIX THE ERRONEOUS BITS + XOR DW2,EP2 +RWECCB: ;SET BREAK HERE IF DON'T TRUST... + MOVSM DW1,(ADR) ;PUT CORRECTED DATA BACK + MOVSM DW2,1(ADR) + INSIRP POP P,[H K J U W] + + AOS CERRS ;COUNT NUMBER OF TIMES ECC DONE + MOVEI A,%HMCLR ;CLEAR THE ECC-ERROR CONDITION + PUSHJ P,RHSET + JFCL + MOVEI A,200 ;ALLOW FOR THE SECTOR WE CORRECTED + ADDB A,RHSUCC ;GET BACK NUMBER OF WORDS TRANSFERRED + IDIVI A,200 ;NUMBER OF SECTORS TRANSFERRED INCLUDING CORRECTED ONE + LDB B,[$HASEC RHTPGA] ;UPDATE DISK ADDRESS + ADD A,B + IDIVI A,NSECS + DPB B,[$HASEC RHTPGA] + LDB B,[$HATRK RHTPGA] + ADD A,B + DPB A,[$HATRK RHTPGA] ;NO NEED TO IDIVI A,NHEDS SINCE ALL XFERS WITHIN CYLINDER + MOVE A,RHSUCC ;NOW ADVANCE CCW + HRL A,A + ADDB A,RHTIOW + POP P,B + TLNE A,-1 + JRST RW2OVR ;NOT EXHAUSTED, CONTINUE DISK XFER + JRST POPJ1 ;ECC IN LAST SECTOR OF XFER, XFER COMPLETED SUCCESSFULLY + +RWECC3: INSIRP POP P,[H K J U W B] + JRST RW3 + +;ROUTINES TO ACCESS RH10 CONTROLLER AND DRIVE REGISTERS +;CALL WITH +; I UNIT NUMBER +; A REGISTER NUMBER IN LH +; NON-SKIP RETURN IF RAE ERROR +; SKIP RETURN IF WIN +;CLOBBERS ONLY A + +;SET REGISTER. TAKES DATA TO GO IN REGISTER IN RH OF A +;CLOBBERS A (PROBABLY) + +RHSET: TLOA A,%HRLOD ;TELL HARDWARE IS SET INSTEAD OF GET + ;AND FALL INTO RHGET + +;GET REGISTER. RETURNS 16 BITS RIGHT-JUSTIFIED IN A + +RHGET: TLZ A,%HRLOD + TLO A,(I) ;INSERT PHYS DRV NO + DATAO DSK,A ;TELL RH10 TO FETCH REGISTER + MOVEM A,RHLAST' ;SAVE FOR REBUGGING + MOVEI A,4 ;ENSURE 3 USEC DELAY BEFORE DATAI + SOJG A,. ;TO ALLOW MASSBUS TRANSACTION TO COMPLETE + DATAI DSK,A ;GET REG CONTENTS AND FLAGS + TLNE A,%HDERR ;ERROR? + JRST RHRAE ;YES, GO REPORT + ANDI A,177777 ;MASK TO 16 BITS + AOS (P) ;AND TAKE SUCCESS RETURN + POPJ P, + +RHRAE: MOVSI A,%HRRAE+%HRLOD(I) + DATAO DSK,A ;CLEAR RAE REGISTER IN CONTROLLER + POPJ P, ;AND TAKE NON-SKIP RETURN + +;DISK ROUTINE VARIABLES + +RHCMD: 0 ;%HMRED OR %HMWRT +RHIOW: 0 ;IOWD -NWDS,,ADR-1 FOR TRANSFER +RHTIOW: 0 ;TEMPORARY IOWD FOR CONTINUING FROM ECC +RHPGA: 0 ;DISK ADDRESS CYL,,HED_8+SEC +RHTPGA: 0 ;TEMPORARY DISK ADDRESS FOR CONTINUING FROM ECC +RHSUCC: 0 ;NUMBER OF WORDS SUCCESSFULLY TRANSFERRED BEFORE ECC +];RH + +IFN T300P,[ ;T-300 I/O - FALL IN FROM WRITE + +;ENTER WITH: A ADDRESS, J BLOCK NUMBER, I VIRTUAL UNIT +; TT %HMWRT OR %HMRED +;ONLY T AND TT CLOBBERED +;ON RETURN T MINUS IF ERROR + +T3IO: INSIRP PUSH P,[A B C D] + SETOM T3IOP' + CAIE TT,%HMRED ;GET READ OR WRITE COMMAND + SKIPA D,[%DMWRT] + MOVEI D,%DMRED +T3IO1: HRRZ A,J ;GUBBISH IN LH + IDIVI A,NBLKC1 ;A CYLINDER, B BLOCK WITHIN CYLINDER + MOVEM A,DSCCYL + IMULI B,SECBL1 ;B SECTOR WITHIN CYLINDER + IDIVI B,NSECS1 ;B HEAD, C SECTOR + MOVEM B,DSCHED + MOVEM C,DSCSEC + MOVE B,-3(P) ;ORIGINAL ADDRESS + HRLI B,730000 ;12-BIT BYTES, START WITH FIRST BYTE IN WORD + MOVE C,[-4,,DSCPNT] ;SET UP BYTE POINTERS + MOVEM B,(C) + ADDI B,400 + AOBJN C,.-2 +KL,[ SWPUA ;DUMP EVERYTHING OUT OF CACHE + CONSZ APR,200000 + JRST .-1 +];KL + PUSHJ P,T3CMD ;PERFORM THE OPERATION + JUMPE T,T3IO2 ;RETURN IF SUCCESS + MOVE A,T ;SEE IF ERROR MAY BE RECOVERABLE + TRZ A,%DSECH+%DSIDE+%DSHCE + JUMPN A,T3IO3 ;IF IRRECOVERABLE + TRNE D,%DMRED ;OR IF NOT A READ COMMAND + CAIN D,%DMRED+10 ;OR IF TRIED ALL RECOVERY FEATURES +T3IO3: TLOA T,(SETZ) ;ENSURE T NEGATIVE TO INDICATE ERROR + AOJA D,T3IO1 ;OTHERWISE RETRY USING NEXT ERROR RECOVERY FEATURE +T3IO2: INSIRP POP P,[D C B A] + POPJ P, +];T300P + +SUBTTL MISCELLANEOUS VARIABLES + +KL,SALVPF: JRST 4,. ;COME HERE IF PAGE FAIL IN SALVAGER + +CONSTANTS +VARIABLES + +POPTJ: POP P,T +CPOPJ: POPJ P, + +THBLK: -LTHBLK,,0 +THTPN: 0 ;TAPE #,,REEL # IN THIS DUMP +THDATE: 0 ;TAPE CREATION DATE +THTYPE: 0 ;0=>RANDOM >0 => FULL <0 => INCR +LTHBLK==.-THBLK + +MHBLK: -LMHBLK,,0 ;FILE HEADER BLOCK +MHSNM: 0 ;SYS NAME +MHFN1: 0 ;FN1 +MHFN2: 0 ;FN2 +MHPKN: 0 ;PACK # +MHDATE: 0 ;CREATION DATE +LMHBLK==.-MHBLK +LNKFLG: 0 ;NONZERO => RELOADING LINK +LNKNM1: 0 ;LINK FN1 +LNKNM2: 0 ;LINK FN2 +LNKSNM: 0 ;LINK SNAME +MAGHD: 0 +EOTFLG: 0 +EOFCNT: 0 +EOUF: 0 +SHORTL: 0 +MTRYS: 0 +MAGBFP: 0 +EOFLG: 0 + +FROM: 0 +TOU: 0 + +SBTAB: -1 ;FOR PATCHING + -1 + -1 + -1 +MFDBK: MFDBLK ;SPECIAL RESERVED BLKS + ;TUT USED TO BE HERE, BUT NO LONGER +LSBTAB==.-SBTAB + +;THIS IS AN ARRAY INDEXED BY UNIT GIVING THE NUMBER +;OF BLOCKS IN THE TUT ON THAT UNIT. +;THESE BLOCKS ARE ALWAYS RIGHT BEFORE THE MFD. +NTBL: +IFE T300P, REPEAT NUNITS, NTUTBL +IFN T300P,[ + REPEAT T300P, NTUTBL + REPEAT NUNITS-T300P, NTUTB1 +];T300P + +RXWDS: BLOCK 4 ;THE EXTRA WORDS + + 0 ;FOR BLT +WXWDS: BLOCK 4 + +NOLPT: 0 ;-1 FOR NO LPT +LPBUST: -1 ;-1 LPT IS BUSTED DON'T KEEP ASKING +PUNCH: 0 ;SET TO -1 WITH DDT IF COPY TTY OUTPUT TO PUNCH +HCRASH: 0 ;SET TO -1 WITH DDT IF EMERGENCY DUP AFTER HEAD CRASH + ;SACRAFICE EVERYTHING FOR SPEED SINCE PACK IS BEING SCRAPED BY HEADS +NUDS: NTS,[NUDSL]+0 ;NUMBER OF USER DIRECTORY BLOCKS +ADRSET: 0 ;ADDRESS SET +FMBLK: 0 ;FROM BLOCK +TOBLK: 0 ;TO BLOCK +LFRMSW: 0 +SEEKC: 0 +SHARED: 0 ;NUMBER OF SHARED BLOCKS +GOGOX: 0 ;-1 FOR AUTOMATIC MODE +NOQUES: 0 ;-1 TO ASK NO QUESTIONS (ONLY EFFECTIVE IN GOGOX MODE) +MDSK: 0 ;DISK TO GET MFD FROM +UDSK: 0 ;DSK TO GET UFD'S FROM +CKFLSW: 0 ;CHECK FILES FOR CLOBBERED BLOCKS +MFDWRT: 0 ;MFD CHANGED +TUTDFR: 0 ;FLAG TO SHOW TUT CHANGED +TTDFPS: 0 ;COUNT FROBS PER LINE WHEN PRINTING TUT +LFILES: 0 ;NUMBER OF FILES IN DIRECTORY +USRNAM: 0 ;M.F.D. USR NAME +UFDLOS: 0 ;SOME GARBAGE IN UFD +UFDSEE: 0 ; -1 IF A STRANGE UFD, PRINT WHOLE THING +FILEPK: 0 ; PACK FILE IS ON +LAST: 0 ; LAST FILE IN UFD +DBLK: 0 ;STORAGE FOR DIRECTORY NUMBER +FILEER: 0 ;ERROR IN FILE +BADFIL: 0 ; BLOCKS IN FILE WITH RETRIEVAL ERRORS +XWDSEE: 0 ; -1 IF HAVENT TYPED EXTRA WORDS YET +LASTQ: 0 ;STORAGE FOR Q +NOTUT: 0 ;TUT NOT ACTIVE FOR THIS FILE +LSTBLK: 0 ;LAST BLOCK STORAGE +BLK: 0 ; LAST BLOCK READ OR WRITTEN FROM +CKFIX: 0 ; -1 IF AUTO FIX RETRIEVAL POINTERS +UNIT: 0 ; UNIT " +FUNIT: 0 ; UNIT FILE IS ON, -1 IF PACK NOT MOUNTED +FERRS: 0 ;TRANSFER ERRORS +CERRS: 0 ;ERRORS CORRECTED BY ECC LOGIC +DUPRER: 0 ;DUP READ ERROR COUNT +DUPWER: 0 ;DUP WRITE ERROR COUNT +UFDTA: 0 +GARBF: 0 ;GARBAGE IN FREE AREA +EXGARB: 0 ;EXTRA GARBAGE IN UFD +MARKF: 0 ;MARKING PACK + +PDL: BLOCK 200 +QBTBLI: 440600,, +QBTBL: 360600,, + 300600,, + 220600,, + 140600,, + 60600,, + 600,, + +QTRAN: +DC,[ 0 ;RH IS PHYSICAL DRIVE + 1 ;4.9 BIT MEANS SECOND HALF + 2 ;(NO LONGER DOES ANYTHING, NOW THAT MEMOWRECKS HAVE BEEN + 3 ; FLUSHED, BUT KEEP AROUND IN CASE EVER NEEDED AGAIN.) + 4 + 5 + 6 + 7 +];DC +.ELSE REPEAT NDRIVE, .RPCNT ;OTHERWISE NOTHING SPECIAL + +IFN .-QTRAN-NUNITS,.ERR BARF AT QTRAN!! + +QTTBLI: REPEAT 36./TUTBYT+1, 440000+TUTBYT_6-TUTBYT_12.*.RPCNT,, +QTTBL=QTTBLI+1 + +TS, NQS: 0 ;SYSTEMS NUMBER OF DRIVES +TS, SQACT: 0 ;LOCATION OF QACT IN SYSTEM +TS, SALVRT: 0 ;DUMMY + + NBLKS-1 ;SNBLKS-1 +SNBLKS: NBLKS ;SYSTEM NBLKS (INIT'ED IN TS) +DRIVE: REPEAT NDRIVE,-1 ;-1 IF DRIVE ON LINE +QACT: REPEAT NUNITS,-1 ;-1 IF UNIT ACTIVE +QPKN: REPEAT NUNITS,-1 ;PACK NUMBER ACCORDING TO TUT +PKNUM: BLOCK NUNITS ;PACK NUMBER ACCORDING TO HARDWARE + +RPKID: 0 + +IRP A,,[OTUT,NTUT] +Q!A!O: REPEAT NUNITS,CONC A,\.RPCNT, +TERMIN + +PAT: +PATCH: BLOCK 100 + +LOC <.+1777>&776000 +CYLBUF: +OUSRD: BLOCK 2000 +NUSRD: BLOCK 2000 +FDBUF: BLOCK 2000 +MFD: BLOCK 2000 +MAGBUF: BLOCK 2000 +IRPS A,,OTUT NTUT +REPEAT NUNITS,CONC A,\.RPCNT,: BLOCK 2000*MXTUTB +TERMIN +D0==OTUT0 +D1==OTUT1 +TUT=NTUT0 +RH, CYLSIZ==200*NHEDS*NSECS +RP, CYLSIZ==NBLKSC*2000 +DC, CYLSIZ==NBLKSC*2004 +NTS, IFL .-CYLBUF-CYLSIZ,LOC CYLBUF+CYLSIZ +THEEND: +CONSTANTS +VARIABLES +IFN .-THEEND, .ERR CRUFT AFTER THEEND + +INFORM HIGHEST USED = ,\THEEND + +IFG THEEND-400000, .ERR TOO MOBY (MUST FIT IN 128K TO AVOID HOLE IF SOME MEM DOWN) +;This error check doesn't really matter for MC much, since memory has +;to be switched out in 128K increments, which means that the system +;can't work with any holes in the low 256K. + +IF2, NTS, KL, PAG=- + +TS, END DDT ;ALWAYS STARTED BY G +NTS,END ;DON'T CLOBBER I.T.S. START ADDR WHEN LOADED TOGETHER diff --git a/system/sysjob.114 b/system/sysjob.114 new file mode 100644 index 0000000..fdc6451 --- /dev/null +++ b/system/sysjob.114 @@ -0,0 +1,2791 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +SUBTTL DEMON JOB INTERFACE ROUTINES + ;GIVE STUFF TO DEMON JOB RUNNING IN USER MODE, WHICH THEN OUTPUTS + ;STUFF IN ITS OWN FORMAT TO THE DISK + ;COMMUNICATION IS VIA DMNBUF (BUFFER) AND POINTERS, + ;DEMON JOB FINDS IT BY LOOKING UP SYSTEM SYMS + + ;USAGE: + ;ROUTINES MUST BE CALLED WITH CLK OFF OR IN PROGRESS + ;FIRST CALL DMNP TO SET UP D AS "PDL POINTER" INTO DMNBF + ;DMNPSH ADR ;PUSH ADR INTO DMNBF (ASSEMBLES INTO A PUSH) + ;FIRST WORD PUSHED SHOULD HAVE ENTRY TYPE DESCRIPTOR IN HIGH SIX BITS + + ;ENTRY TYPE DESCRIPTORS: +DMNELI==10000 ;LOGIN (DMNPLI) +DMNELO==20000 ;LOGOUT (DMNPLO) + ;^ ADD MORE AS NEEDED, NEED NOT BE SYMBOLIC BUT PLEASE COMMENT THEM HERE FOR XREF + + ;DMNRS ;NORMALLIZE POINTER (DUE TO STANDARD LENGTH ENTRY IN TABLE) + ;ASSEMBLES INTO ONE STORAGE WORD + ;THEN CALL (PUSHJ) DMNRT WHICH STORES BACK D + ;ALL DMNPSH'S SHOULD BE ASSEMBLED BEFORE DMNRT; + ;ALL ROUTINES SHOULD BE BETWEEN THIS PAGE AND DMNBUF + +;DMNSZ (# ENTRIES IN DMNBF) DEFINED EARLY IN SYSTEM ENGLISH SO CAN BE CHANGED EASILY + +DMNFMT==2 ;ASCENDING FORMAT NUMBER, SHOULD BE INCREMENTED EACH TIME + ;A CHANGE IS MADE REQUIRING CHANGE IN CODING EITHER OF DEMON JOB + ;OR OF PROGRAMS READING ITS OUTPUT +;DMNFNT 1 -> 2 9/71 SWAPIN RQ INCLUDED W/LOGOUT + +DMNBAC==0 ;DMNPSH COUNTER, AFTER FIRST TIME GETS RE-INITIALIZED TO DMNBLM + +DEFINE DMNPSH ADR + DMNBAC==DMNBAC+1 + PUSH D,ADR +TERMIN + +IF1,DMNBEL==0 ;BECOMES LENGTH PER ENTRY IN DMNBF + +DEFINE DMNRS + ADDI D,DMNBEL-DMNBAC +IF1,IFG DMNBAC-DMNBEL,DMNBEL==DMNBAC +DMNBAC==DMNBLM +TERMIN + + ;PUSHJ P,DMNP ;SET UP D FOR DMNPSH'S INTO DMNBF + +DMNP: MOVE D,DMNBFP ;GET POINTER + CAIL D,DMNBFE-1 ;AT END OF BUFFER? + MOVEI D,DMNBF-1 ;YES, RE-INITIALIZE + AOS DMNBC ;INDICATE ENTRY ABOUT TO BE FILLED, SO DEMON KNOWS IF IT LOST +DMNP0: ;DMNP0 MAY BE CALLED IN USER MODE FROM DEMON JOB + DMNPSH TIME ;FIRST WORD IN BUFFER ALWAYS TIME OF ENTRY + ;^ MAYBE ADD MORE STANDARD PUSHES HERE + POPJ P, + +DMNBLM==DMNBAC ;NUMBER OF INITIAL WORDS PUSHED + + ;PUSHJ P,DMNRT (BUT USUALLY JRST DMNRT FOR RETURN) + ;DMNBF ENTRY COMPLETED, STORE BACK POINTERS + +DMNRT: TLZ D,-1 ;CLEAR OUT LEFT HALF OF POINTER + CAIL D,DMNBFE ;AFTER END OF BUFFER? + JRST 4,.+1 ;DMNBF POINTER INCREMENTED INCORRECTLY SOMEWHERE ALONG THE LINE + ;PROBABLY PROGRAMMER FORGOT TO DO DMNRS; CODING AFTER DMNBF MIGHT BE CLOBBERED + AOS DMNBD ;ENTRY COMPLETE, GIVE IT TO DEMON JOB + MOVEM D,DMNBFP + POPJ P, + + ;NOW FOR INDIVIDUAL ROUTINES + + ;LOGIN + +DMNPLI: PUSHJ P,DMNP ;SET UP + HRLI U,DMNELI ;INDICATE LOGIN + ;PUT FOLLOWING INTO DMNBF: + DMNPSH U ;INDEX OF USER BEING LOGGED IN + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME + DMNPSH JNAME(U) ;JNAME + DMNPSH TRMNAM(U) ;TERMINAL NAME + DMNPSH XUNAME(U) + DMNRS ;THAT'S ALL + JRST DMNRT + + ;LOGOUT + +DMNPLO: PUSHJ P,DMNP ;SET UP D + PUSHJ P,LOGUSE ;GET TREE'S USAGE IN T AND TT + HRLI U,DMNELO ;INDICATE LOGOUT + ;PUT FOLLOWING IN DMNBF FOR DEMON JOB TO DUMP OUT ON DISK: + DMNPSH U ;INDEX OF USER BEING LOGGED OUT + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME OF USER + DMNPSH JNAME(U) ;JNAME + DMNPSH TT ;TIME USED, IN 4.069 USEC UNITS + DMNPSH T ;# SWAPIN REQUESTS (THESE VALID SINCE LOGUSE ALREADY CALLED) + ;^ ADD MORE HERE + ADDM TT,LOUTIM ;COUNT UP TOTAL TIME USED BY ALL LOSERS + DMNRS + JRST DMNRT + +DMNPL0==CPOPJ ;DMNPL0 MAY BE CALLED FROM DEMON JOB IN USER MODE + ;IT IS NO LONGER POSSIBLE TO MAKE THIS WORK RIGHT, + ;SO WE JUST RETURN. PFTHMG DRAGON SHOULD BE FIXED. + +EBLK + ;DEMON VARIABLES, MUST FOLLOW CODING + ;USE CARE IN REDEFINING SYMBOLS ON THIS PAGE; DEMON JOB RUNNING IN USER MODE + ;LOOKS AT SOME OF THEM, EXCEPT AS INDICATED + +DMNBF: BLOCK DMNBEL*DMNSZ ;BUFFER +DMNBFE:: + +DMNBC: 0 ;ENTRY COUNT, INCREMENTED JUST BEFORE ENTRY ADDED TO DMNBF (USED BY DEMON) +DMNBD: 0 ;ENTRY COUNT, INCREMENTED JUST AFTER " " " +DMNBFP: DMNBF-1 ;POINTER INTO BUFFER, HAS ADR OF LAST WORD WRITTEN (NOT USED BY DEMON) +VSCLAU: 0 .SEE VSCLA1 ;LAST JOB TREE ACCOUNTING UPDATE DONE FOR + ;NO MORE CODING ALLOWED AFTER THIS POINT + +DEFINE DMNPSH A +INFORM DMNPSH AT .,\. +TERMIN + +DEFINE DMNRS +INFORM DMNRS AT .,\. +TERMIN + +BBLK + +SUBTTL "SYSTEM" JOBS + +IFN TPLP,[ +TPLI==11 ;PSEUDO LPT IN +PRTO==12 ;REAL LPT OUT +] +IFN DEMON,TPLI==11 ;FOR DEMON HACKER +IFN DEMON,TEMPC==16 ;FOR TESTING WHETHER DEMON FILE EXISTS. +STYOC==17 ;OUTPUT " + +;CODE FROM ICLR TO SCOR EXECUTED ONLY ONCE (SEE BEG) +ICLR: MOVE A,[GO,,GO+1] ;PICK UP BLT POINTER (COPY EXCH WORD INTO NEXT) + SETZM GO ;CLEAR FIRST WORD + BLT A,IEND ;CLEAR OUT INITIALIZING CODE (IN AREA TO BE USER VAR BLOCKS) + SKIPL CORRQ ;SKIP IF CORE RQ FOR SYSTEM'S SPACE PROCESSED + PUSHJ P,UFLS ;WAIT AS NECESSARY + PUSHJ P,SYSCOP ;"OPEN" SYSTEM CONSOLE CHANNEL +IFN CCLKP,[ + JRST .+3 ;JFCL FOR CHESS CLK MODE + PUSHJ P,CLQAD1 + CCLKB +];CCLKP +IFN IMPP,[ + MOVE A,TIME + MOVEM A,LNETIM + PUSHJ P,IMPINI +];IMPP + MOVEI A,IINTIC + MOVEM A,IINCNT +SCOR: MOVE P,SYSPDP + MOVE U,USER + CONO PI,CLKON + MOVE A,TIME + ADDI A,30.*60.*5 ;5 MINUTES BEFORE SHUTDOWN? + SKIPLE SHUTDN + CAMG A,SHUTDN + JRST .+3 + SKIPN SUSRS + JRST SYSOUT ;JUMP IF SYS DYING & NO ONE LOGGED IN + MOVE T,[.HANG] + MOVEM T,FORTY ;TELL PEEK WHAT OUR UFLS REALLY IS. + MOVE T,TIME + MOVEM T,SYSITM + SKIPN SUPCOR ;SKIP IF ANY BITS ON IN SUPCOR + PUSHJ P,UFLS ;HANG TILL A BIT ON +;SYS JOB IS HUNG IF SYSITM IS 30 SEC OLD AND PC ISN'T SCOR1. +SCOR1: MOVSI A,(SETZ) + MOVEI B,0 +SYSDP1: TDNE A,SUPCOR + JRST SYSDP2 +SYSDP3: LSH A,-1 + JUMPE A,SCOR + AOJA B,SYSDP1 + +SYSDP2: SKIPGE SYSDTB(B) ;SKIP UNLESS 4.9 BIT OF ENTRY ON + ANDCAM A,SUPCOR ;4.9 ON, CLEAR SUPCOR BIT + LDB C,[370200,,SYSDTB(B)] + TRNE C,2 ;IF ROUTINE IS GOING TO USE TTY, + PUSHJ P,WARMTTY ;THEN WARM IT UP FOR IT + TRNE C,1 + PUSHJ P,DINGTTY + LDB T,[420100,,SYSDTB(B)] ;GET 4.8 BIT + JUMPE T,@SYSDTB(B) ;IF 4.8 BIT = 0, JUMP TO ROUTINE + PUSH P,A ;4.8 .NE. 0, SAVE A + PUSH P,B ;SAVE B + PUSHJ P,@SYSDTB(B) ;CALL ROUTINE + POP P,B ;RESTORE B + POP P,A ;RESTORE A + LDB T,[410100,,SYSDTB(B)] ;GET 4.7 BIT + JUMPE T,SYSDP3 ;IF ZERO RETURN TO LOOP + ANDCAM A,SUPCOR ;NON-ZERO, CLEAR SUPCOR BIT + JRST SYSDP3 ;LOOP + +SUBTTL SUPCOR DISPATCH TABLE + +;DISPATCH TABLE FOR BITS IN SUPCOR +;4.9 = 1 TO CLEAR SUPCOR BIT BEFORE DISPATCHING +;4.8 = 0, JRST TO ROUTINE ; = 1, PUSHJ +;4.7 = 1 TO CLEAR SUPCOR BIT AFTER (ONLY USEFUL IF PUSHJ) +;4.6 WARM UP TELETYPE BEFORE CALL +;4.5 DING BEFORE CALL + +SCL==1,,525252 ;BIT TYPEOUT MASK FOR SUPCOR +SCR==525252 ; .. + +SYSDTB: +SCLEX==400000 ? 300000,,SYSEX ;INCREASE USER-VAR BLOCK SPACE. +SCLSHD==200000 ? 340000,,SYSSHD ;HANDLE .SHUTDN - PRINT "GOING DOWN" MESSAGES. +SCLOUT==100000 ? 400000,,SYSOUT ;TIME FOR SYSTEM TO GO DOWN. +IFE KS10P,[ 660000,,SYSCK5 ;CHECK FOR DEVICES GIVING SPURIOUS INTERRUPTS. + SCLCK5==040000] +IFN KS10P, 400000,,SYSDP3 +SCLDAT==020000 ? 600000,,DATIME ;CONTINUE TRYING TO DETERMINE DATE AND TIME. +SCLPAR==010000 ? 360000,,PARTYP ;PRINT "PARITY ERROR..." +SCLSET==004000 ? 340000,,SYSSET ;DEPOSIT IN SYSTEM (.SETLOC). +SCLIMP==002000 ? 600000,,SYSIMU ;PRINT "NETWORK UP ..." +SCLWRT==001000 ? 340000,,SYSWRT ;PRINT WRITING-ON-SYS: MESSAGE. +SCLLGI==000400 ? 340000,,SYSLGI ;PRINT LOGIN MESSAGE. +SCLDEC==000200 ? 300000,,SYSDEC ;DECREASE USER-VAR SPACE. +SCLVSK==000100 ? 600000,,VSCLK ;VERY SLOW (2 MINUTE) CLOCK. +SCLGUN==000040 ? 600000,,SYSGUN ;FLUSH TREES THAT ARE TRYING TO LOG OUT. +SCLNET==000020 ? 460000,,SYSNET ;BRING NCP DOWN AND UP. +IFN DEMON,[ 600000,,DEMCHK ;RUN ANY DEMONS WHICH NEED IT. + SCLDMN==000010] +IFE DEMON, 400000,,SYSDP3 +SCLNXM==000004 ? 360000,,NXMTYP ;PRINT "NON-EX MEM ERROR ..." +IFE KA10P,[ +SCLBPF==000002 ? 360000,,BPFTYP ;BAD PAGE FAIL +].ELSE 400000,,SYSDP3 +SCLIDK==000001 ? 600000,,ISYS ;DISK IS INITIALIZED +SCRTPP==400000 ? 600000,,TPLPRT ;TRANSFER DATA TO LPT (FROM TPL) +SCRTPC==200000 ? 600000,,VSCL6 ;SEE IF ANY FILES HAVE BEEN SPOOLED. + 400000,,SYSDP3 +SCRHNG==040000 ? 600000,,SYSDIL ;DIALUP LINE CONNECT OR DISCONNECT +SCRDET==020000 ? 600000,,SYSDT ;DETACH TOP-LEVEL JOBS WITH INTERRUPTS. +SCRCFM==010000 ? 600000,,SYSCFM ;PRINT CONSOLE FREE MSGS +SCRMSG==004000 ? 640000,,SYSMPR ;PRINT RANDOM SYSTEM MESSAG + REPEAT 5,400000,,SYSDP3 ;CAN BE SET BY USER (.SUPSET) +IFN N11TYS,[ 600000,,VWHO ;UPDATE WHO LINES (40) + SCRWHO==000040] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11D ;TV 11 GONE DOWN (20) + SCR11D==000020] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11U ;TV 11 COME UP, INIT IT (10) + SCR11U==000010] +.ELSE 400000,,SYSDP3 +IFE DEMON, 400000,,SYSDP3 ;(4) +IFN DEMON,[ 600000,,DMNOFF + SCRDMF==000004] +SCRTPF==000002 ? 300000,,TPLOFF ;BLOCK TPL. +SCRCKS==000001 ? 600000,,SYSCKS ;PERFORM CHECKSUMMING + +IFN .-SYSDTB-36.,.ERR SYS JOB DISPATCH + +SUBTTL DM DAEMON OVERSEER + +IFN DEMON,[ +DEMCHK: PUSHJ P,SYSDEX ;HANDLE REQUESTS TO KNOW WHETHER A FILE + ;EXISTS TO BE SIGNALLED AS A DEMON. + PUSHJ P,LSWTL ;SYSTEM JOB SIEZES DEMON TABLE SWITCH WITH UTCOFF + 400000,,DEMSW + MOVE B,DMLSEX + CAMN B,[-DMLNG,,0] ;IF AT BEGINNING OF TABLE SET FLAG + TDZA D,D + SETOM D +DMSCN9: SKIPE TT,DMTTBL(B) + SKIPE DMTTBL+1(B) ;ONLY PAY ATTENTION IF NOT DOWN + JRST DMSCN1 ;AND GUY THERE + MOVE T,DMTTBL+2(B) + HRRE C,T + TLNE T,-1 + JRST DMSCN3 + JUMPLE C,DMSC10 +DMSCN0: SKIPG DMNFLG + JRST DMSC11 ;IF FLAG SET CAN'T LOAD EM + CAME TT,[SIXBIT /UNSPOO/] + JRST DMSCN4 ;DON'T BOTHER WITH TPL STUFF, IF NOT TPL + SKIPGE TPLFLG + JRST DMSC10 ;REMOVE FROM WORLD + JRST DMSCN4 + +DMSCN4: HLRM T,DMTTBL+3(B) ;SET UP IMPLICIT REQUEST + CONO PI,UTCON ;ATTEMPT LOAD HERE + MOVE T,DMTTBL(B) + MOVEM T,DMOBLK+2 ;CHECK TO SEE IF FILE EXITS + .IOPUSH TPLI, + .OPEN TPLI,DMOBLK ;DON'T WORRY CAN'T PCLSR + JRST DMSCN5 ;OPEN FAILURE + .IOPOP TPLI, ;GET BACK STUFF + HRROI T,DMTTBL(B) + PUSHJ P,NUJBST ;TRY TO LOAD + JRST DMSCN6 ;COME BACK LATER, NO ENTRY FOR THIS GUY. +DMSCN8: ADD B,[DMTLL,,DMTLL] + SKIPL B + MOVSI B,-DMLNG + MOVEM B,DMLSEX ;FIX UP TABLE +DMSCN7: MOVSI B,SCLDMN + IORM B,SUPCOP ;IF MORE REQUESTS, RUN AGAIN IN 1 SECOND. + SOSLE REQCNT ;NO MORE REQUESTS => + JRST LSWPOP + SETZM REQCNT + ANDCAM B,SUPCOP ;DON'T RUN AGAIN. + ANDCAM B,SUPCOR ;THEN CLEAR OUT SUPCOR BIT + JRST LSWPOP + + +DMSCN5: .IOPOP TPLI, ;FILE DOESN'T EXIST + CONO PI,UTCOFF +DMSC10: PUSHJ P,DEMMRV ;REMOVE DEAMON + JRST DMSCN8 ;AND REQUEST + +DMSCN3: JUMPG C,DMSCN0 ;LOAD + JRST DMSCN1 + +DMSCN2: CONO PI,UTCON ;CONTINUE AROUND LOOP + ADD B,[DMTLL,,DMTLL] +DMSCN6: MOVEM B,DMLSEX + JRST LSWPOP ;COME BACK LATTER WITHOUT FLUSHING REQ + +DMSCN1: ADD B,[DMTLL,,DMTLL] ;ADD ON VAL + JUMPL B,DMSCN9 ;CONTINUE AROUND LOOP + MOVSI B,-DMLNG + MOVEM B,DMLSEX + JUMPE D,UTOLKJ +DMSC11: SETZM REQCNT ;IF RAN THROUGH WHOLE TABLE WITHOUT ANY PROCESS + CONO PI,UTCON + JRST DMSCN7 ;FLUSH ALL REQUESTS AND RETURN + +DMNOFF: MOVNS TT,DMNFLG + JUMPLE TT,DMNOF1 ;DEAMONS OFF + PUSHJ P,LSWTL + DEMSW +DMNOF3: SKIPE DMTTBL(B) + SKIPE DMTTBL+1(B) + JRST DMNOF2 + AOS REQCNT +DMNOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,DMNOF3 + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST LSWPOP + +DMNOF1: MOVSI B,SCLDMN + ANDCAM B,SUPCOR + SETZM REQCNT ;ZERO COUNT + POPJ P, + +;CALL HERE TO HANDLE ALL JOBS THAT ARE WAITING IN .DEMSIG TO +;BE TOLD WHETHER A PURPORTED DEMON REALLY EXISTS. GIVE THEM +;THEIR ANSWERS AND START THEM UP AGAIN. +SYSDEX: SETZ A, + MOVEI C,'SYS + MOVE D,['ATSIGN] +SYSDE1: CONO PI,CLKOFF + SKIPN SRN3(A) ;THIS JOB'S ALREADY BEEN SERVICED?^ + SKIPN UNAME(A) ;OR DOESN'T REALLY EXIST? + JRST SYSDE3 + MOVE B,UPC(A) ;IS IT WAITING FOR SERVICE FROM US? + XORI B,ADEMS1 ;MUST BE IN EXEC MODE AT THE RIGHT PLACE. + TDNE B,[%PCUSR,,-1] + JRST SYSDE3 + MOVE E,AC0S+A(A) ;GET THE FN2 IT WANTS TO CHECK. + CONO PI,CLKON + SETZ T, ;T GETS 0 IFF FILE CAN BE OPENED. + .OPEN TEMPC,C + CAIA + JRST SYSDE2 + LDB T,[220600,,IOCHST+TEMPC] + SKIPN T + MOVEI T,%ENSFL +SYSDE2: .CLOSE TEMPC, + CONO PI,CLKOFF + SKIPN UNAME(A) ;SEE IF JOB IS STILL WAITING FOR SERVICE + JRST SYSDE3 ;SO IT ISN'T CLOBBERED IF IT GOT AN + MOVE B,UPC(A) ;INTERRUPT AND IS DOING SOMETHING ELSE. + XORI B,ADEMS1 + TDNN B,[%PCUSR,,-1] + CAME E,AC0S+A(A) + JRST SYSDE3 + MOVEM T,AC0S+T(A) ;GIVE THE JOB ITS ANSWER IN T, AND + SETOM SRN3(A) ;TELL THE JOB IT HAS BEEN SERVED. +SYSDE3: CONO PI,CLKON + ADDI A,LUBLK + CAMGE A,USRHI + JRST SYSDE1 + POPJ P, +];DEMON + +SUBTTL VERY SLOW CLOCK + +;SUBROUTINES CALLED BY THE VERY SLOW CLOCK. + +;CHECK FOR DEMON REQUESTS WHOSE TIME HAS COME. +IFN DEMON,[ +VSCLDM: PUSHJ P,LSWTL + DEMSW + MOVSI B,-DMLNG +VSCLD2: SKIPG DMTTBL+3(B) ;IF SPECIFIC ENTRY IS < = O, IGNORE + JRST VSCLD1 + SOSE DMTTBL+3(B) + JRST VSCLD1 + HLRZ T,DMTTBL+2(B) ;SIGNAL DEAMON + MOVEM T,DMTTBL+3(B) + MOVE A,DMTTBL(B) + PUSHJ P,DEMSIG ;SIGNAL REQUEST FOR THIS GUY + BUG ;ENTRY IN TABLE NOT FOUND EVEN THOUGH NON ZERO TIME +VSCLD1: ADD B,[DMTLL,,DMTLL] + JUMPL B,VSCLD2 + JRST LSWPOP +] + +;CHECK FOR CLOBBERED TEN-11 INTERFACE CONTROL PAGE WORDS, +;AND RESET THEM TO THEIR CORRECT SETTINGS. +IFN TEN11P,[ +T11CK: SKIPE TEN11F + POPJ P, + MOVSI I,-256. +T11CKL: MOVE A,T11MP(I) + CAMN A,[-1] + MOVEI A,0 ;HARDWARE SHOULD BE 0 ON CONFLICT PAGE + TLZ A,174000 ;USAGE COUNT + MOVE B,400000+T11CP*2000(I) + CAME A,B + JRST T11ERR +T11CL1: AOBJN I,T11CKL + POPJ P, + +T11ERR: AOS T11ERC + MOVEM A,400000+T11CP*2000(I) + MOVEM A,T11CCN + MOVEM B,T11WCN + MOVEM I,T11PG + JRST T11CL1 +] + +;VERY SLOW CLOCK (EVERY 2 MIN). SIGNALLED BY SCLVSK, SET BY A CLOCK-QUEUE ENTRY. +;CALLS THE ULTRA-SLOW CLOCK (EVERY 2 HOURS) WHEN IT'S TIME. + +VSCLK:;JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES (WOULD BE NICE, BUT BUGS...) +IFN DEMON,PUSHJ P,VSCLDM ;DEAMON SLOW CLOCK BREAK ROUTINE +IFN TEN11P,PUSHJ P,T11CK + MOVE U,VSCLAU ;ACCOUNTING UPDATE, FIND A JOB TREE +VSCLA1: ADDI U,LUBLK + CAML U,USRHI + MOVEI U,0 + SKIPE UNAME(U) + SKIPL SUPPRO(U) + JRST VSCLA1 + HRLO TT,UNAME(U) + AOJE TT,VSCLA1 ;DON'T IF NOT LOGGED IN YET + MOVEM U,VSCLAU + CONO PI,CLKOFF + PUSHJ P,LOGUPD + PUSHJ P,DMNPLI + CONO PI,CLKON + MOVE U,USER + SKIPLE CTLCNT ;Time to print date on console log? + JRST VSCLA2 ; No. + PUSHJ P,GLPDTM ;Yes - get localized pdtime. + JRST VSCLA2 ; Can't print time if we don't know it. + PUSHJ P,WARMTTY ;Warm up tty, newline. + PUSHJ P,DATIM6 ;Print what time it is now. + MOVEI TT,CTLMAX ;Restart countdown of lines printed. + MOVEM TT,CTLCNT +VSCLA2: PUSHJ P,VSCOLD ;CHECK FOR OLD DETACHED TREES TO BE KILLED + PUSHJ P,TTTMNT ;TURN OFF MOTORS OF IDLE TERMINETS. +VSCL7: SETOM UFDFLF ;CAUSE CORE JOB TO TRY TO FLUSH 2311 UFDS + AOS NCORRQ + MOVSI I,-NCLCH ;LOOK FOR UNOPEND CORE LINK BUFFERS THAT HAVE BEEN + PUSHJ P,SWTL ;AROUND FOR MORE THAN 2 MINUTES + CLOSW +VSCLCL: SKIPE CLSYN(I) ;SKIP IF VARS UNUSED + SKIPL A,CLUSR(I) + JRST VSCLC2 + AOJN A,VSCLC2 ;JUMP IF OPEN + MOVE TT,CLRAC(I) + TLOE TT,200000 + JRST VSCLCR ;BIT ALREADY ON, BUFFER OLD + MOVEM TT,CLRAC(I) +VSCLC2: AOBJN I,VSCLCL ;LOOP FOR ALL SETS OF VARIABLES + PUSHJ P,LSWPOP ;RELEASE SWITCH + + MOVE A,UTTBF ;IF MANY 200-WORD BUFFERS ARE FREE, + CAIGE A,8 + JRST .+3 + SETOM UTBFLF ;HAVE THE CORE JOB FLUSH THEM + AOS NCORRQ + +IFN IMPP,[ + SKIPGE IMPUP ;SKIP IF IMP UP, OR PERMANENTLY DOWN + PUSHJ P,SYSIMU ;TRY TO BRING IT UP +];IMPP +IFN TPLP,PUSHJ P,VSCL6 ;MAYBE START PRINTING FROM .LPTR. +IFN NLPTP,[ + SKIPL NLUSR ;IF LPT ISN'T IN USE, + JRST VSCNL1 + AOS TT,NLFREE ;KEEP TRACK OF HOW LONG THAT'S BEEN SO. + SOJN TT,VSCNL1 ;IF TRUE FOR >=2 VSCLK INTREVALS (4 MIN) + CONO NLPT,1000 ;TURN LPT MOTOR OFF: 1ST PUT LPT IN IMAGE MODE + DATAO NLPT,[.BYTE 7 ? 24 ? 177 ? 177 ? 177 ? 177] ;THEN TURN OFF. +VSCNL1:] + SOSLE IINCNT + POPJ P, + +;IT'S TIME FOR THE ULTRA-SLOW CLOCK + MOVEI A,IINTIC ;GET HERE EVERY TWO HOURS OR SO + MOVEM A,IINCNT + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + PUSHJ P,WARMTTY + JRST DATIM6 ;TIME KNOWN, TELL SYSTEM CONSOLE + +VSCLCR: HRRZ A,TT + PUSHJ P,BRTN ;RETURN BUFFER + SETZM CLSYN(I) ;FREE VARIABLES + JRST VSCLC2 + +;CHECK FOR TREES WITH BUMRTL SET THAT HAVE NOT RUN FOR +;A WHOLE HOUR, AND GUN THEM. +VSCOLD: SETZB U,J + CONO PI,CLKOFF + MOVSI B,BUMRTL + MOVSI C,BULGOS + MOVE A,TIME + SUBI A,60.*60.*30. ;1 HOUR AGO +VSCOL0: SKIPE UNAME(J) + TDNN B,APRC(J) + JRST VSCOL1 ;JOB NON EX OR DOSN'T HAVE BUMRTL + SKIPGE SUPPRO(J) ;NO GOOD IF NOT TOP LEVEL. + TDNE C,APRC(J) ;IGNORE JOBS THAT ARE ALREADY LOGGING OUT. + JRST VSCOL1 + CAML A,LUBTM(J) ;NOT RUNNING AND HASN'T RUN FOR 1 HOUR => GUN. + JRST VSCOL2 +VSCOL1: ADDI J,LUBLK ;KEEP LOOKING TILL FIND JOB THAT NEEDS GUNING. + CAMGE J,USRHI + JRST VSCOL0 + JRST CLKONJ ;NO TREES NEED TO BE GUNNED. + +VSCOL2: MOVEI I,[ASCIZ /KILLED HOUR-OLD DETACHED JOB, # /] + PUSHJ P,SYSJEX ;PRINT MESSAGE AFTER CALLING ALOGO6 + PUSHJ P,ALOGO6 + JRST VSCOLD ;LOOK FOR ANOTHER TREE TO GUN. + +; MOVEI I,[ASCIZ/DID FOO TO JOB # /] +; PUSHJ P,SYSJEX +; PUSHJ P,FOO +;DOES FOO TO THE JOB WITH IDX IN J, AND PRINTS A SYSTEM MSG. +;FOO WILL FIND THE USR IDX IN A AND J. IT IS OK TO ENTER +;SYSJEX WITH CLOCK OFF BUT FOO MUST TURN IT ON. +SYSJEX: HRRZS A,J + PUSH P,JNAME(A) + PUSH P,UNAME(A) + PUSH P,A ;SAVE ALL THE INFO WE NEED FOR THE MESSAGE. + PUSH P,I + XCT @-4(P) ;DO "FOO" + JFCL ;LET FOO SKIP. + AOS -4(P) ;SKIP OVER THE PUSHJ TO FOO. + PUSHJ P,WARMTTY + HRRZ I,(P) + PUSHJ P,SYSSP ;PRINT THE STRING IN I + POP P,I + HLRZS I + SKIPE I + PUSHJ P,(I) ;IF LH(I) WAS NONZERO, CALL THAT PRINT ROUTINE + POP P,A + IDIVI A,LUBLK + PUSHJ P,SYSOPT ;PRINT THE JOB # + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + POP P,A + PUSHJ P,SYSIXP ;PRINT UNAME, AND SPACE + PUSHJ P,STYOS + POP P,A + PUSHJ P,SYSIXP ;PRINT JNAME + JRST SYSTCR ;SPACE, TIME AND CR. + +SUBTTL TPL + +VSCL6: ;CHECK TPL: SEE IF LPT FREE AND ANY FILE TO PRINT. +IFN UNSPLP,[ + PUSHJ P,LSWTL + DEMSW + MOVE A,[SIXBIT /UNSPOO/] + PUSHJ P,DEMSIG + JRST LSWPOP ;REQUEST FAILED, TOO BAD + JRST LSWPOP +] + +IFE TPLP,POPJ P, +IFN TPLP,[ + MOVEI A,SCRTPP ;ALSO ENTER HERE FOR TPL CHECK + TDNE A,SUPCOR ;SKIP IF NOT ALREADY PRINTING FILE + POPJ P, + IFG LPTP-1,[ + SKIPE TPLSWP + JRST VSCL6A + SKIPLE NLPTBR + SKIPL LPTUSR + POPJ P, +VSCL6B: + ] + IFLE LPTP-1,[ + SKIPL LPTUSR + POPJ P, + ] + IFG OLPTP-NLPTP,[ + MOVEI A,132. + CAMLE A,LPTCC + POPJ P, + ] + IFG NLPTP-OLPTP,[ + CONSO NLPT,207 + SKIPG NLPTBR + POPJ P, ;.OPEN OF LPT WOULD HANG + ] + MOVEI A,SCRTPF + TDNE A,SUPCOR ;BLOCKED + POPJ P, + .OPEN TPLI,[SIXBIT / TPL.FILE.(DIR)/] ;MAKE SURE FILE DIR IN CORE + JRST VSCLX1 + MOVEI B,2 +VSCL2: .IOT TPLI,A + CAIE A,^C + CAIN A,12 + SOJG B,VSCL2 + JUMPN B,VSCL2 + SETOB I,C + SETZM TPLFN1 + SETZM TPLFN2 + MOVEI B,TPLFN1 + HRLI B,440600 +VSCL2A: .IOT TPLI,A + CAIN A,"* + JUMPL I,VSCL4 + CAIE A,^C + CAIN A,14 + JRST VSCLX1 + CAIN A,40 + JUMPL I,VSCL2A ;IGNORE SPACES BEFORE THE PACK NUMBER. + CAIN I,3 ;AFTER 4 CHARS STARTING WITH BEGINNING OF PACK NUMBER + JRST VSCL2E ;COMES THE START OF THE FN1. + CAIN A,"L + MOVEI C,0 ;INDICATE LINK + AOJA I,VSCL2A ;FIRST NON SPACE CRUFTY + +IFG LPTP-1,[ +VSCL6A: MOVEI A,132. + CAMG A,LPTCC + SKIPL OLPUSR + POPJ P, + JRST VSCL6B +] + +VSCL2E: MOVEI TT,6 +VSCL2B: SUBI A,40 + IDPB A,B + .IOT TPLI,A + SOJG TT,VSCL2B + MOVE B,[440600,,TPLFN2] +VSCL2C: .IOT TPLI,A + SUBI A,40 + IDPB A,B + TLNE B,770000 + JRST VSCL2C + .IOPUSH TPLI, + .OPEN TPLI,TPLFN + JRST VSCLL1 ;TRY AGAIN + .IOPOP PRTO, + .CLOSE PRTO, +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST VSCL3A +] + CONSZ NLPT,207 + JRST VSCLX1 + MOVEI T,LPTBSZ + CAMN T,NLPTBR ;SKIP ON OPEN WOULD HANG + .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +IFN OLPTP,[ + JRST VSCL3B +VSCL3A: +]] +IFN OLPTP,[ + MOVEI A,132. + CAMG A,LPTCC ;SKIP IF .OPEN WOULD HANG +IFN NLPTP,.OPEN PRTO,[3,,'OLP] +.ELSE .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +VSCL3B: +] + MOVEI A,SCRTPP + IORM A,SUPCOR ;PRINT THIS FILE + IORM A,SUPCOP ;PRINT MORE EVERY SECOND. + JRST TPLPRT + +VSCLL1: .IOPOP TPLI, + JUMPL C,VSCLX1 + MOVEI B,1 ;LINK THAT DIDN'T EXIST + JRST VSCL2 +] + +IFN TPLP,[ +;COME HERE TO TRANSFER SOME CHARS FROM DSK TO LPT, +;ASSUMING BOTH CHNLS ALREADY OPEN. +TPLPRT: +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST TPLPR3 +] + MOVEI A,TPLBSZ + CAMLE A,NLPTBR + POPJ P, +IFN OLPTP,[ + JRST TPLPR5 +TPLPR3: +]] +IFN OLPTP,[ + MOVEI A,10.*TPLBSZ ;LEAVE SPACE FOR CHARS THAT TAKE MORE THAN 1 CHAR + CAMLE A,LPTCC + POPJ P, +TPLPR5: +] + MOVE A,[-TPLBSZ,,TPLBUF] ;"UN-RELOCATE" + .IOT TPLI,A + MOVE B,A + MOVNI A,-TPLBUF(A) + HRLZS A + JUMPE A,TPLPR1 ;JUMP ON END OF FILE + HRRI A,TPLBUF + .IOT PRTO,A + JUMPL B,TPLPR1 ;LAST BUFFER-FULL PRINTED + JRST TPLPRT + +TPLPR4: CLEARM TPLFN3 + .FDELE TPLFN ;DELETE FILE JUST PRINTED + JFCL + MOVEI A,SCRTPP + ANDCAM A,SUPCOP ;DON'T NEED TO CALL TPLPRT EVERY SECOND. + ANDCAM A,SUPCOR +VSCLX1: .CLOSE PRTO, + .CLOSE TPLI, + POPJ P, + +VSCL4: .IOT TPLI,A + CAIN A,14 + JRST VSCLX1 + CAIN A,12 + JRST VSCL2A + JRST VSCL4 + +TPLPR1: PUSHJ P,TPLPR4 + JRST VSCL6 +] +.ELSE TPLPRT==CPOPJ + +;HANDLE A USER'S REQUEST TO "BLOCK THE TPL" +IFN TPLP,[ +;IF SYS JOB IS SPOOLING, JUST THROW AWAY CURRENT FILE. +TPLOFF: MOVEI A,SCRTPP + TDZN A,SUPCOP + POPJ P, ;NOTHING HAPPENING + PUSHJ P,WARMTTY + .RESET PRTO, + PUSHJ P,TPLPR4 + MOVE A,[SIXBIT /TPLOFF/] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +IFE TPLP+UNSPLP,TPLOFF==CPOPJ + +IFN UNSPLP,[ +TPLOFF: MOVNS B,TPLFLG + JUMPG B,VSCL6 ;IF NOW RUNNING GIVE REQ + MOVSI B,-DMLNG +TPLOF1: SKIPE C,DMTTBL(B) + SKIPG D,DMTTBL+1(B) ;USER INDEX -0 IF NOT YET LOADED + JRST TPLOF2 + CAME C,[SIXBIT /UNSPOO/] + JRST TPLOF2 + PUSH P,U + MOVE U,D + PUSHJ P,ALOGOUT ;DOES ONE USTOP FOR YOU + POP P,U + JRST TPLOF3 + +TPLOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,TPLOF1 +TPLOF3: PUSHJ P,WARMTTY + MOVE A,[SIXBIT /TPLOFF/ ] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +SUBTTL WHO LINES + +IFN N11TYS,[ +;PDP11 COMM AREA (SYSTEM WIDE) +;STARTS AT PDP11 ADDRESS 40 +;PNTR TO TT11HD +;PNTR TO POINTA +;I/O VERSION # +;SORCE FILE VERSION # +;--PDP10 WD BOARDARY-- 0 , INITED +; 0 , GODOWN + +;AT POINTA: +; ADDR OF SYSTEM WHO-LINE VARS +; ADDR OF 10-11 COMMAND BUFFER +; TENWHO , 0 ;PDP10 SETS TO TELL PDP11 TO UPDATE WHO-LINES +; MAXTV , 0 ;MAXTV = # TV'S 11 IS SET UP TO HANDLE +; NF11TY , 0 ;10 TELLS 11 WHAT TTY # OF 1ST BUFFER IS. + +;PDP11 CONSOLE VARS +; EVEN PDP11 WORD ODD PDP11 WORD +;TT11HD - CHAIN OF ACTIVE INPUT BUFFERS 0 +; PNTR TO OUTPUT BUFFER CHNL 0 VIDEO BUFFER,KBD # (377 IF NONE) +; " CHNL 1 " +;... +; OUTPUT BFR EMPTY NOTIFY RQ FLAG TO FREE CHNL +;... +; PNTR TO WHO LINE BLOCK FREE + +;THE 11 HAS COME UP, SO INIT COMMUNICATION VARIABLES AND START USING IT +SYS11U: SKIPG TT11P + POPJ P, + LDB A,[$11AD0,,TT11HA] ;GET PDP10 ADDRESS OF INPUT-BFR-CHAIN PTR + CAIL A,NTTPG*2000 + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + ADDI A,TT11LO + CONO PI,TTYOFF + MOVEM A,TT11HD ;SAVE IT FOR CLOCK LVL TO CHECK. + LDB C,[$11WD0,,TT11HA+1] ;GET PDP11 IO VERSION #. + MOVEI B,12. ;OLD TV PROGRAMS HANDLE 12. BUFFERS + LDB T,[$11AD1,,TT11HA] ;GET ADDR OF POINTA + CAIL C,3 ;VERSION 3 AND UP TV PGM HAS MAXTV - READ IT + LDB B,[$11WD0,,TT11LO+2(T)] + MOVEM B,TT1111 ;THAT'S HOW MANY TV'S THE 11 THINKS TERE ARE + CAIL B,N11TYS + MOVEI B,N11TYS ;MIN OF THAT AND # TEN THINKS THERE ARE + MOVEM B,TT11RL + MOVEI B,NF11TY + CAIL C,3 ;VERSION 3 TV PGM AND UP WANTS NF11TY + DPB B,[$11WD0,,TT11LO+3(T)] + HRLZ I,TT11RL ;GET AOBJN -> TV'S BOTH 10 AND 11 WILL HANDLE. + MOVNS I +VSCL7C: LDB B,[$11AD0,,1(A)] ;GET DPY BUFFER ADRESS FOR THIS TTY + ADDI B,TT11LO+2 ;CONVERT TO PDP10 ADDRESS. + HRLI B,040000+TT11BY_6 ;GET BP TO ILDB 1ST DATA WORD. + MOVEM B,NF11TY+TOBBP(I) ;PNTR TO BEG OF OUTPUT BUFFER + LDB C,[$11AD0,,(B)] ;GET # BYTES IN DATA AREA + ADDI B,(C) ;GET BP TO LAST WORD IN AREA + MOVEM B,NF11TY+TOBEP(I) + MOVEM B,NF11TY+TOIP(I) + ADDI A,1 + AOBJN I,VSCL7C + MOVEM C,TT11OL ;REMEMBER LENGTH OF OUTPUT BUFFERS. + SETOM TT11P ;TV TTYS NOW UP. + CONO PI,TTYON + MOVE A,[-N11TYS,,NF11TY] + MOVSI B,%TACFM ;NOW SAY ALL PDP11 TTYS NEED + ANDCAM B,TTYSTA(A) ;CONSOLE FREE MESSAGES, + AOBJN A,.-1 + MOVEI A,SCRCFM + IORM A,SUPCOR ;TELL SYS JOB TO PRINT THEM. + PUSHJ P,CLQAD1 ;ADD WHO LINE BLOCK TO CLOCK QUEUE IF NOT THERE + WHOCLB + MOVEI I,[ASCIZ /TV 11 IS UP -/] + JRST SYSSTD ;STRING,SPACE TIME AND DATE THEN CR +] + +IFN N11TYS,[ + +$INSRT WHOVAR + +;UPDATE WHO-LINE VARIABLES. +VWHO: SKIPL TT11P ;DON'T SCREW UP IF PDP11 ISN'T UP. + POPJ P, + MOVE A,TT11HD + HRLZ A,TT11RL + MOVNS A + HRR A,TT11HD ;-<# TV'S BEING USED>,,
+ ADD A,TT1111 + ADD A,TT1111 ;NOW RH -> 2 11-WDS BEFORE PTR TO WHOLINE VARS OF 1ST TV +VWHO1: LDB B,[$11AD0,,1(A)] ;GET WHO LINE VAR PDP11-ADDR, SHIFTED 2. + ADDI B,TT11LO ;CONVERT TO PDP10 ADDRESS. + CONO PI,TTYOFF + MOVE TT,WHJOB(B) ;JOB # (SHIFTED 4+16.) + MOVE C,WHMODE(B) ;MODE (SHIFTED 4+16.) + JUMPG C,VWHO3 + CONO PI,TTYON + JUMPL C,VWHO2 ;MODE < 0 => NO WHOLINE. + HLRE I,A ;GET -<# TIMES REMAINING THRU LOOP> + ADD I,TT11RL + HRRZ TT,TTYSTS+NF11TY(I) ;MODE 0, USE JOB WHICH HAS THE TTY. + MOVE Q,TT + IDIVI Q,LUBLK + LSH Q,4.+16. + MOVEM Q,WHJOB(B) +;FOR OTHER MODES, COME BACK HERE, WITH USER IDX IN TT. +VWHO3R: CONO PI,CLKOFF + MOVE C,UNAME(TT) + HLLZM C,WHUNAM(B) + HRLZM C,WHUNM2(B) ;STORE THE JOB'S UNAME + MOVE C,JNAME(TT) + HLLZM C,WHJNAM(B) + HRLZM C,WHJNM2(B) ;AND JNAME. + MOVE C,USYSNM(TT) + HLLZM C,WHSNAM(B) + HRLZM C,WHSNM2(B) ;AND SNAME. + MOVE C,[SIXBIT /STOP/] + SKIPE USTP(TT) ;AND "STATUS": IF NOT RUNNABLE, "STOP". + JRST VWHO4 + MOVE C,[SIXBIT /RUN/] ;IF NOT WAITING, "RUN". + SKIPN FLSINS(TT) + JRST VWHO4A + MOVE C,[SIXBIT /PAGE/] ;DETECT WAITING FOR PAGE. + MOVE Q,USWST(TT) + TLNE Q,200000 + JRST VWHO4 + JRST VWHO4B + +VWHO4A: MOVE E,UPC(TT) ;JOB RUNNING: USER MODE? + TLNE E,%PCUSR ;IF SO, STATUS IS "RUN" (C ALREADY SET UP) + JRST VWHO4 +VWHO4B: MOVE E,SV40(TT) ;ELSE DECODE SYSTEM CALL TO GET STATUS. + HLRZ Q,E + CAIN Q,(.CALL) + JRST VWHO4D ;SYMBOLIC SYSTEM CALL. + TRZ Q,17_5 + MOVE I,OPTION(TT) + TLNN I,%OPDEC + JRST VWHO4E + CAIE Q,40_9 + CAIN Q,41_9 + JRST VWHO4F + CAIN Q,47_9 + JRST VWHO4F +VWHO4E: CAIN Q,(.IOT) ;.IOT => DECODE DEVICE IN USE. + JRST VWHOI1 + CAIN Q,(.OPER) + JRST VWHOO1 ;.OPER => DECODE ADDRESS FIELD. + CAIN Q,(.CALL) + JRST VWHOC1 ;.CALL BUT NOT SYMBOLIC => DECODE AC FIELD. + LSH Q,-9 + CAIL Q,40 + CAIL Q,40+NUUOSX +VWHO4F: SKIPA C,[SIXBIT /UUO/] ;UNRECOGNIZED UUO. + MOVE C,UUOSXB-40(Q) ;ELSE GET SIXBIT NAME OF UUO. + JRST VWHO4C + +;A SYMBOLIC SYSTEM CALL IS IN PROGRESS. +VWHO4D: MOVE C,LSCALL(TT) ;USE SYSTEM CALL NAME AS STATUS + CAME C,[SIXBIT /SIOT/] + CAMN C,[SIXBIT /IOT/] + JRST VWHOI2 ;BUT IF IT'S "IOT", DECODE DEVICE TYPE. +VWHO4C: SKIPE FLSINS(TT) + JRST VWHO4 + LSH C,-6 + TLO C,'+_12. ;STICK "+" ON FRONT IF RUNNING IN SYSTEM +;DROPS THROUGH ;(NOT IF IN USER MODE, OR IF HUNG). + ;DROPS IN +;COME HERE WITH STATUS AS SIXBIT IN C. +VWHO4: +IFE SWPWSP, SKIPL USWSCD(TT) ;SKIP IF SWAP-BLOCKED +IFN SWPWSP,[ MOVE Q,USWST(TT) + TLNN Q,%SWSB +] + JRST .+3 + LSH C,-6 + TLO C,(SIXBIT/>/) + HLLZM C,WHSTAT(B) + HRLZM C,WHSTA2(B) + MOVEI C,WHJ%RT(B) + HRLI C,442000 + MOVE Q,JTMU(TT) ;COMPUTE % RUN TIME FROM SCHEDULER PRIORITY. + MULI Q,100. + DIV Q,[2.^6] + IDPB Q,C + MOVE Q,UTRNTM(TT) + IDIVI Q,25000. + IDPB Q,C ;JOB RUNTIME IN .1 SEC UNITS. + MOVE Q,NMPGS(TT) + MOVE I,NSWPGS(TT) + SUBM Q,I + IDPB I,C ;JOB # REAL PAGES. + IDPB Q,C ;JOB # VIRTUAL PAGES. +;HANDLE THE USER-SPECIFIED FIELDS IN THE WHOLINE. + MOVE Q,UWHO1(TT) + ANDCMI Q,17 + MOVEM Q,1(C) ;STORE JOB'S WHOLINE FLAGS. + MOVE Q,UWHO2(TT) + HLLZM Q,2(C) ;STORE FIRST USER WHO VAR + HRLZM Q,3(C) + MOVE Q,UWHO3(TT) + HLLZM Q,4(C) ;STORE SECOND USER WHO VAR + HRLZM Q,5(C) +VWHO2: CONO PI,CLKON + AOBJN A,VWHO1 + JRST VWSYS + +VWHOO1: HRRZ Q,E ;JOB EXECUTING .OPER. + CAIL Q,MXOPR + SKIPA C,[SIXBIT/UUO/] + MOVE C,OPRSXB(Q) ;GET .OPER NAME AS STATUS + JRST VWHO4C + +VWHOI2: SKIPL Q,UUAC(TT) ;NEW SYS CALL IOT + JRST VWHO4C ;GETTING ARGUMENTS, UUAC NOT SET UP YET + MOVE I,C ;SAVE NAME IN I + JRST VWHOI4 + +VWHOI1: LDB Q,[270400,,E] ;.IOT + SETZ I, +VWHOI4: ADDI Q,IOCHNM(TT) ;Q HAS IOCHNM WORD ADDR FOR CHANNEL. + MOVE Q,(Q) ;GET IOCHNM WORD CONTENTS (RH INDEXES TABLES) + HLRZ C,Q + HLL Q,IOTTB(Q) ;LH GETS BITS SAYING DIRECTION, BLOCK VS UNIT. + HLL C,CLSTB(Q) + TLNE C,%CLSJ ;IF JOB DEVICE + JRST [ MOVE C,JBDEV(C) ;GET NAME OF SIMULATED DEVICE + JRST VWHOI6 ] + HLLZ C,DCHSTB(Q) ;C GETS DEVICE NAME (LEFT-JUST SIXBIT) + JUMPL C,VWHOI6 ;JUMP IF NORMAL 3-CHARACTER NAME + MOVSS C ;NO, IS ADDRESS OF 6-CHARACTER NAME + MOVE C,(C) +VWHOI6: SETZ D, ;EVENTUALLY MAKE STATUS BE 9 CHARS, NOT 6? + MOVE E,[360600,,C] + ILDB J,E ;FIND FIRST SPACE IN THAT DEVICE NAME + JUMPN J,.-1 + JUMPGE Q,VWHOI3 .SEE %IOTBK ;IF BLOCK MODE, PUT A "B" THERE. + MOVEI J,'B + DPB J,E + IBP E +VWHOI3: CAME I,[SIXBIT /SIOT/] + JRST VWHOI5 + MOVEI J,'S + DPB J,E + IBP E +VWHOI5: MOVEI J,'O ;FOLLOW WITH "O" OR "I" SAYING DIRECTION. + TLNN Q,%IOTOT + MOVEI J,'I + DPB J,E + JRST VWHO4C ;COMPLETED STATUS LOOKS LIKE "TTYBO". + +VWHOC1: LDB Q,[270400,,E] ;.CALL: GET AC FIELD, + MOVE C,CALSXB(Q) ;GIVE SIXBIT NAME OF .CALL. + JRST VWHO4C + +;MODE ISN'T 0: FIGURE OUT WHICH JOB TO DISPLAY WHO-LINE FOR, +;AND GO TO VWHO3R WITH JOB'S IDX IN TT. COME HERE WITH TTYCHN OFF. +VWHO3: LSH TT,-16.-4 ;WHAT JOB WAS LAST DISPLAY DONE FOR? + IMULI TT,LUBLK + CAMGE TT,USRHI + SKIPN D,UNAME(TT) + JRST VWHO3B ;JOB WE WERE LOOKING AT HAS VANISHED. + TLNE C,<-4>_<16.+4-18.> + JRST VWHO3B ;THIS TTY IS GETTING SYSTEM WHO-LINE. + TLNN C,2_<16.+4-18.> + JRST VWHO3E ;WANT SAME JOB AS LAST TIME. + +;MODE 2 OR 3: COME HERE TO SEARCH FOR DESIRED JOB. +VWHO3A: MOVSI E,1_<16.+4-18.> + MOVEM E,WHMODE(B) ;SWITCH TO MODE 1. + MOVEI E,MAXJ+5 ;DON'T LOOP FOREVER +VWHO3D: ADDI TT,LUBLK ;ADVANCE TO NEXT JOB UP OR DOWN. + TLNE C,1_<16.+4-18.> + SUBI TT,2*LUBLK + SKIPGE TT ;WRAP AROUND IF NEC GOING DOWN. + ADD TT,USRHI + CAML TT,USRHI ;WRAP AROUND IF NEC. GOING UP. + MOVEI TT,0 + CAMN D,UNAME(TT) ;BELONGS TO SOMEONE ELSE => KEEP GOING. + JRST VWHO3C ;BELONGS TO THIS USER => STOP. + SOJG E,VWHO3D ;KEEP LOOKING BUT DON'T LOOP IF NO JOB TO BE FOUND. +VWHO3B: SETZM WHSTAT(B) ;NO JOB TO BE FOUND. + CONO PI,TTYON + JRST VWHO2 + +VWHO3C: MOVE Q,TT ;DESIRED JOB FOUND: SET UP FOR MODE 1 + IDIVI Q,LUBLK ;LOOKING AT THIS JOB. + LSH Q,16.+4 + MOVEM Q,WHJOB(B) +VWHO3E: CONO PI,TTYON + JRST VWHO3R + + +;USER WHO LIES UPDATED; NOW UPDATE SYSTEM WHO LINE VARS. +VWSYS: LDB A,[$11AD1,,TT11HA] + LDB B,[$11AD0,,TT11LO(A)] + ADD B,[$11WD1,,TT11LO] ;FIRST WORD OF BLOCK SET BY 11 + MOVEI C,SRI + IDPB C,B ;ITS VERSION#. + MOVEI C,2 + MOVEI E,0 +IFN SWPWSP, MOVSI TT,%SWSB + MOVEI Q,2*LUBLK +VWSYS2: CAML Q,USRHI ;COUNT # JOBS. + JRST VWSYS1 + SKIPN UNAME(Q) + JRST VWSYS3 + AOS C ;C GETS # JOBS, + SKIPE USTP(Q) + JRST VWSYS3 +IFE SWPWSP, SKIPGE USWSCD(Q) +IFN SWPWSP, TDNE TT,USWST(Q) + AOS E ;E GETS NUMBER OF ACTIVE SWAPPED BLOCKED JOBS +VWSYS3: ADDI Q,LUBLK + JRST VWSYS2 + +VWSYS1: IDPB C,B ;TOTAL # JOBS + MOVE D,MMPCNT + IDPB D,B ;TOTAL MEM (= TOTAL # PAGES, COUNTING SHARED PAGES ONLY ONCE). + MOVE C,RNABLU + SUBI C,1 + IDPB C,B ;RUNNABLE USERS + IDPB E,B ;# SWAP-BLOCKED JOBS + MOVE TT,NPGWTU + IDPB TT,B ;# WAITING FOR PAGE. + MOVE C,TRUMM ;TOTAL RUNNABLE USER MEMORY + IDPB C,B + MOVEI C,0 + MOVE TT,USRHI ;COUNT PAGES AVAILABLE FOR USE OR ACTUALLY USED FOR USER MEM + ADDI TT,USRSTG+1777 + LSH TT,-10. +VWSYS5: LDB D,[MUR,,MEMBLT(TT)] + CAIE D,MURUSR + CAIN D,MUFR + AOS C ;FREE OR USER MEM. + CAIGE TT,TSYSM-1 + AOJA TT,VWSYS5 + IDPB C,B ;TOTAL MEM AVAIL FOR USERS + HLRZ C,QDATE + IDPB C,B + MOVE C,SYSDBG + IDPB C,B + AOS B ;SKIP A WHOLE WORD FOR TIME OF DAY + MOVEI D,(B) ;SAVE ADDRESS FOR BELOW + MOVE C,SUSRS ;# LOGGED IN USERS. + IDPB C,B + MOVEI E,10000. ;FAIR SHARE IN % + IDIV E,SLOADU ;BASHES TT + IDPB E,B + MOVE C,TIMOFF ;TIME OF DAY IN .5 SEC UNITS. + LSH C,4 + MOVEM C,(D) ;DEPOSITING TIME OF DAY TRIGGERS WHO-LINE UPDATE + POPJ P, ; BY THE PDP-11, SO DEPOSIT IT LAST + +] ;END IFN N11TYS + +SUBTTL EXPAND/CONTRACT USER VARIABLES AREA + +SYSEX: PUSHJ P,SCOREX + POPJ P, + MOVE A,TIME + MOVEM A,SCITM + POPJ P, + +SYSDEC: MOVE A,TIME ;TRY TO DECREASE CORE RESERVED FOR USER VARIABLES + SUB A,SCITM + CAIG A,50. + POPJ P, ;TOO SOON SINCE GOT MORE CORE + CONO PI,CLKOFF + MOVE A,USRHI + SUBI A,LUBLK + SKIPN UNAME(A) + JRST .-2 + ADDI A,LUBLK + MOVEM A,USRHI ;USRHI=> HIGHEST USER+L + ADDI A,USRSTG + ADDI A,1777 + SETOM SJCFF ;INHIBIT ALLOCATION WHILE HUSRAD IS CHANGING + CONO PI,CLKON + MOVEI U,0 ;FOR ACORE + LSHC A,-10.-36. ;MOVE INTO B AS WELL + PUSHJ P,ACORE + BUG ;LOST FLUSHING CORE? + CLEARM SJCFF + POPJ P, + +SCOREX: LDB B,[121000,,HUSRAD] ;EXTEND CORE FOR USER VARIABLES AT TOP OF SYSTEM + ADDI B,1 + CAILE B,LIOBLK + MOVEI B,LIOBLK ;TRYING TO GET TOO BIG, DON'T + MOVEI U,0 + JRST ACORE + +SUBTTL LOGGER OUT + +;THIS ROUTINE AWAKENED BY .LOGOUT, .GUN, ETC. +;SEARCH FOR TREES THAT ARE LOGGING OUT AND READY TO BE FLUSHED +;(IE HAVE BULGO SET) AND FLUSH THEM, PRINTING LOGOUT MESSAGE IF APPRO. +SYSGUN: SETZ U, +SYSGU0: MOVE T,APRC(U) + TLNE T,BULGO ;IS THIS JOB READY TO BE FLUSHED? + SKIPN UNAME(U) + JRST SYSGU1 +IFN NUNITS,[ + SKIPGE TTYTBL(U) ;IF CONSOLE-CONTROLLED, FLUSH UTAPE ASSIGNMENTS + JRST SYSGU2 + MOVSI I,-NUNITS + MOVE A,UNAME(U) + CAMN A,UTASS+1(I) + SETZM UTASS+1(I) + AOBJN I,.-2 +SYSGU2: ] + HLRO B,UNAME(U) + AOJE B,SYSGU3 ;IF THIS TREE COUNTS AS A LOGGED-IN USER, + SKIPL TTYTBL(U) + SOS SUSRS ;DECREMENT COUNT OF SUCH. +SYSGU3: CONO PI,CLKOFF + PUSHJ P,DMNPLO ;UPDATE TREE'S USAGE AND INFORM DEMON JOB + MOVEM TT,TRUNTM(U) ;SAVE RUN TIME FOR LOGOUT MSG + CONO PI,CLKON + SKIPGE A,TTYTBL(U) + JRST SYSGU4 ;IF TREE HAS CONSOLE, + SKIPE TTNTO(A) + BUG + PUSHJ P,TTYLO1 ;FREE IT. + CAMN U,EPDL(U) ;UNLESS GUNNED DOWN, + SKIPN SUPPLG ;MAY NOT WANT TO BOTHER PRINTING MESSAGE ON SYS CONSOLE + SKIPGE DEDTIM + JRST SYSGU4 ;IF LOGGED OUT BECAUSE SYS DOWN, SPARE THE LOGOUT MSG + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ / LOGOUT /] + PUSHJ P,SYSSP + MOVE A,UNAME(U) + PUSHJ P,SYSIXP ;UNAME. + PUSHJ P,STYOS ;SPACE. + HRRZ A,TTYTBL(U) + PUSHJ P,SYSOPT ;TTY #. + PUSHJ P,SYSTCR + ;VALUE PRINTED IS WRONG, AND HARD TO FIX, SO FOLLOWING CODE HAS BEEN FLUSHED. + ;THE REASON IT'S WRONG IS BECAUSE TIME ALREADY SENT TO THE DAEMON IS NOT INCLUDED. + ;MOVEI I,[ASCIZ / TUSED= /] + ;PUSHJ P,SYSSP + ;MOVE A,TRUNTM(U) + ;MULI A,4069. + ;DIVI A,1000. + ;PUSHJ P,SYSDPC + ;MOVEI I,[ASCIZ / USECS/] + ;PUSHJ P,SYSSTD + CAMN U,EPDL(U) ;WAS LOGGED OUT BY SELF? + JRST SYSGU4 + MOVEI I,[ASCIZ / ^^ GUNNED DOWN BY /] + PUSHJ P,SYSSP + MOVE A,SRN4(U) + PUSHJ P,SYSIXP ;UNAME OF GUNNER. + MOVE A,SRN5(U) + PUSHJ P,SYSSIX ;SPACE, AND JNAME OF GUNNER. + PUSHJ P,SYSTCR ;CRLF. +;MESSAGES PRINTED IF NECESSARY. +SYSGU4: SETZ R, + PUSHJ P,ZUSER ;COMPLETELY ELIMINATE THE JOB. + CONO PI,CLKON +SYSGU1: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSGU0 + SETZ U, + POPJ P, + +;DETACH ANY TREES WHOSE TOP-LEVEL JOBS HAD FATAL INTS + +SYSDT: SETZB U,J + PUSHJ P,SWTL + TREESW + CONO PI,CLKOFF + MOVSI B,BUSRC + MOVSI T,BULGOS+400000 +SYSDT0: SKIPN UNAME(J) + JRST SYSDT1 + SKIPGE SUPPRO(J) ;LOOK FOR TOP-LEVEL + TDNE T,APRC(J) ;IGNORE JOBS ALREADY DISOWNED, OR LOGGING OUT. + JRST SYSDT1 + TDNE B,USTP(J) ;THAT HAS BEEN STOPPED AS BY SUPERIOR + JRST SYSDT2 +SYSDT1: ADDI J,LUBLK + CAMGE J,USRHI + JRST SYSDT0 + JRST CLKOPJ ;NO MORE SUCH JOBS, DONE; LSWPOP AND CLKON. + +;FOUND A TOP LEVEL JOB NEEDING TO BE DETACHED. +SYSDT2: PUSH P,J + MOVE T,OPTION(J) + TLNE T,%OPLKF + JRST [ IDIVI J,LUBLK ;BASHES R + .CALL [SETZ ? 'UNLOCK ? SETZI %JSNUM(J)] ;UNLOCK THE LOCKS + BUG + MOVE J,(P) + JRST .+1 ] + CONO PI,CLKOFF ;IODCSS MIGHT HAVE TURNED IT ON + SKIPL E,JBI(J) ;NOTE CLKOFF IN EFFECT WHILE HACKING JOB DEVICE STUFF + SKIPGE JBCG(E) + JRST SYSDTA + MOVE A,JBCUI(E) ;JOB DEVICE, GIVE IOCER1 OR OPNL7 + LDB T,[000400,,JBSTS(E)] + CAIE T,1 + JRST [ MOVSI T,7_5 ;NON IOT, UNHANG CREATOR SO WILL SEE OPNL7 + MOVEM T,JBSTS(E) + MOVE T,FLSINS(A) + CAMN T,JBFLS + SETZM FLSINS(A) + JRST SYSDTA ] + MOVEI B,1 ;IOT GIVE IOCER1 + MOVS H,E + PUSHJ P,NSTIOC + JFCL +SYSDTA: POP P,J + SETZ U, + MOVE I,[SYSDT8,,[ASCIZ/TOP LEVEL INTERRUPT /]] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT7 + JRST SYSDT + +SYSDT8: MOVE A,-1(P) ;USER INDEX + MOVE A,PIRQC(A) ;TOP LEVEL INTERRUPT BITS + PUSHJ P,SYSFWP +SYSDT9: MOVEI I,[ASCIZ/ DETACHED JOB # /] + JRST SYSSP + +;JOB IN J SHOULD BE DETACHED, AND GUNNED AFTER AN HOUR, +; OR RIGHT AWAY IF NOT LOGGED IN +SYSDT4: HLRE B,UNAME(J) + AOJE B,SYSDT5 ;NOT LOGGED IN => KILL + HRLI I,SYSDT9 + PUSHJ P,SYSJEX + PUSHJ P,SYSDT3 + POPJ P, + +SYSDT5: HRLI I,[MOVEI I,[ASCIZ / KILLED JOB # /] + JRST SYSSP] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT6 + POPJ P, + +SYSDT6: PUSHJ P,SYSDT3 ;FIRST DETACH (LEAVES USER INDEX OF TOP LEVEL JOB IN A). + JRST ALOGO6 ;THEN LOG OUT. SINCE DETACHED, NO ADDITIONAL MSG FROM SYSGUN. + +;CALL WITH CLOCK OFF TO DETACH THE JOB WITH IDX IN A AND J. +;ASSUME JOB'S BULGOS HAS BEEN CHECKED, AND TREESW LOCKED. +;TURNS CLOCK BACK ON AND DOES A LSWCLR +SYSDT7: TDZA B,B ;HERE TO LEAVE AROUND +SYSDT3: MOVEI B,10 ;HERE TO SET BUMRTL WHEN WE DETACH + PUSHJ P,SOSSET + DIELOK(A) + AOS DIELOK(A) + CONO PI,CLKON + MOVEM B,CTLBTS(U) + PUSHJ P,NDETA0 + BUG + POPJ P, + +IFN NDLTYS+NETYS,[ + +;HANDLE DIAL-UP LINE CONNECTS OR DISCONNECTS ON DL-10 AND DTE20. + +SYSDIL: +IFN NDLTYS,[ + SKIPN A,DL10CL + JRST SYSDL2 ;THERE'S NONE TO PROCESS? + SETZM DL10CL ;FREE THE VAR FOR THE PDP11 + PUSHJ P,SYSDL0 +SYSDL2: ];NDLTYS +IFN NETYS,[ + SKIPGE A,DTEHNG + JRST SYSDL3 + SETOM DTEHNG + PUSHJ P,SYSDL0 +SYSDL3: +];NETYS + POPJ P, + +SYSDL0: LDB I,[.BP 77,A] ;GET OUT THE TTY NUMBER + CAIL I,NCT + POPJ P, + TRNE A,-100 + JRST SYSDL1 ;IT'S A CONNECT + PUSHJ P,SWTL ;IT'S A DISCONNECT + TREESW + MOVE J,TTYSTS(I) ;DETACH THE TREE ON THAT TTY. + JUMPL J,LSWPOP ;THERE'S NO TREE. + TLNN J,%TSCNS + JRST LSWPOP ;TTY IS OPEN AS A DEVICE. + MOVE I,APRC(J) + TLNE I,BULGOS ;GIVE UP IF TREE LOGGING OUT. + JRST LSWPOP + MOVE U,USER + MOVEI I,[ASCIZ /DIALUP LINE DISCONNECTED,/] + JRST SYSDT4 + +;ON A CONNECT, SNARF THE LINE SPEEDS DETERMINED BY THE PDP11. +SYSDL1: LDB B,[.BP 7000,A] + DPB B,[$TTISP,,TTYTYP(I)] + LDB B,[.BP 700,A] + DPB B,[$TTOSP,,TTYTYP(I)] + PUSHJ P,NCNSSP ;SET UP INITIAL TTY TYPE AS PRINTING, ACCORDING TO SPEED + MOVEI B,20 ;DON'T ASSUME TTY IS AT LEFT MARGIN + MOVEM B,TTYIHP(I) + MOVEM B,TPHP(TT) + MOVEM B,TPHP+TPLEN(TT) + POPJ P, +];NDLTYS+NETYS +.ELSE SYSDIL==CPOPJ + +IFN N11TYS,[ +SYS11D: MOVEI I,[ASCIZ /TV 11 WENT DOWN --/] + PUSHJ P,SYSSTD ;STRING, SPACE, TIME AND CR + SETZM TT11P ;IN CASE SCR11D WAS SET BY A USER, AND HE DIDN'T HACK THIS. + MOVEI A,TT11HD+1 + MOVEM A,TT11HD ;PREVENT TT11IN FROM BEING CALLED ANY MORE. +SYS11G: PUSHJ P,SWTL ;PREPARE FOR DOING DETACHES + TREESW + MOVE I,[-N11TYS,,NF11TY] +SYS11F: SKIPGE J,TTYSTS(I) ;DETACH ALL 11TV TREES. + JRST SYS11E ;THIS 11TV NOT IN USE + TLNN J,%TSCNS + JRST SYS11P ;THIS 11TV IN USE AS A DEVICE, DON'T DETACH BUT DO PCLSR + MOVE T,APRC(J) + TLNE T,BULGOS + JRST SYS11E ;DON'T DETACH TREES THAT ARE LOGGING OUT. + MOVE U,USER + MOVEI I,[ASCIZ / .../] + PUSHJ P,SYSDT4 ;DETACH OR KILL JOB W/ # IN J, AND PRINT MESSAGE. + JRST SYS11G ;TREESW NOW UNLOCKED; MUST RE-LOCK. + +SYS11P: HRRZ A,J ;PCLSR THE NAME DRAGON + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL ;AND DROP INTO SYS11E + +SYS11E: AOBJN I,SYS11F + PUSHJ P,LSWPOP ;TREESW NOT NEEDED IF NOTHING TO DETACH. + MOVSI T,-MXVBN ;FLUSH VIDEO BUFFER ASSIGNMENTS. + SETOM VBAST(T) + AOBJN T,.-1 + MOVEI T,0 +SYS11V: CAML T,USRHI + POPJ P, + SETZM NVDBA(T) + SETOM TVCREG(T) ;FLUSH TV BUFFER NUMBERS IN CREGS + ADDI T,LUBLK + JRST SYS11V + +TVBNCL: PUSH P,T ;"DEASSIGN" TVVBN(U) AND CLEAR IT ON SCREEN IF NECC + SKIPN TEN11F + SKIPL TT11P + JRST TVBNC1 + SKIPL T,TVVBN(U) + CAME U,USER + JRST TVBNC1 + PUSH P,400000+TTR10*2000 + MOVEM T,400000+TTR10*2000 + MOVE T,TVBLAD + CLEARM 400000+TTR0*2000(T) + POP P,400000+TTR10*2000 +TVBNC1: SETOM TVVBN(U) + JRST POPTJ +];N11TYS + +;PRINT CONSOLE FREE MSGS ON ALL TTYS THAT NEED IT. +;NOTE THAT THERE ARE LOWER CASE MESSAGES ON THIS PAGE. +.SEE TTYLO1 ;THIS RTN SIGNALLED WHEN A TTY BECOMES FREE. +SYSCFM: CLEARM IOCHNM+STYOC ;REUSE SYSTEM CONSOLE CHANNEL +SYSCF0: MOVEI A,0 +SYSCF1: CAIL A,NCT + JRST SYSCOP ;DONE, SWITCH SYSCON CHANNEL BACK TO SYSCON + SKIPGE B,TTYSTA(A) .SEE %TACFM + AOJA A,SYSCF1 + TLNE B,%TANJS + TLZ B,%TACTZ ;%TANJS MEANS A FAILED ^Z - FORGET ABOUT THAT ^Z. + MOVEM B,TTYSTA(A) + SKIPGE TTYSTS(A) .SEE %TSFRE + TLNE B,%TACTZ + AOJA A,SYSCF1 ;IN PROCESS OF LOADING TREE FOR THIS CONSOLE + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" A CHANNEL TO THAT TTY. + SKIPGE SHUTDN + PUSHJ P,SYSTS1 ;IF SHUTDOWN AND A DISPLAY, CLEAR THE SCREEN + MOVEI I,[ASCIZ / +Top level interrupt, tree detached +/] + MOVSI B,%TCDET ;IF TTY FREE DUE TO DETACH FOR TOP LEVEL INT, + TDNE B,TTYCOM(A) + PUSHJ P,SYSSP .SEE NDETAC ;SAY SO. + ANDCAM B,TTYCOM(A) + MOVSI B,%TANJS + ANDCA B,TTYSTA(A) + EXCH B,TTYSTA(A) ;CLEAR BIT, SAVE OLD VALUE + PUSH P,A + XCT DWNMSG + SKIPGE SHUTDN + JRST SYSCF2 ;SYSTEM IS DOWN, SAY SO + XCT SCMESG + CAMN A,SYSCN + JRST SYSCF2 ;SYSTEM JOB USING THIS CONSOLE, SAY SO + SRITYP [ System fully loaded. Console ] + TLNN B,%TANJS + SRITYP [ Console ] + PUSHJ P,SYSSP +IFN N11TYS, CAIE A,NF11TY ;ON ALL FREE PDP11-TV CONSOLES + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / Free./] + PUSHJ P,SYSSTD + XCT DMESSG + SKIPE SYSDBG +SYSCF2: PUSHJ P,SYSSTD ;SAY "SYS BEING DEBUGGED" IF NEC. + SKIPLE SHUTDN + PUSHJ P,SYSSHM ;SAY "SYS GOING DOWN" IF NEC. + POP P,A + MOVSI B,%TACFM ;TTY NO LONGER NEEDS CONSOLE FREE MSG. + IORM B,TTYSTA(A) +IFN N11TYS,PUSHJ P,TTYLO2 ;TELL THE PDP11 THIS TTY IS FREE + SETZM IOCHNM+STYOC + JRST SYSCF0 + +SUBTTL SHUTDOWN + +;HANDLE .SHUTDN - PRINT "GOING DOWN" MSGS, ETC. +SYSSHD: LDB D,[221700,,SHUTLK+1] + PUSHJ P,SWTL + SHUTLK + MOVEI I,SYSSHM + TLO I,40 + PUSH P,D + PUSHJ P,SYALCP + POP P,D + IMULI D,LUBLK + SKIPE D ;SKIP IF LEFT FROM >5 MIN PRINT OUT + SKIPN A,UNAME(D) + JRST LSWPOP + MOVEI I,[ASCIZ /CULPRIT = /] + PUSHJ P,SYSSP + PUSHJ P,SYSSIX + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,SYSTCR + JRST LSWPOP + +;GOING DOWN, WHAT A SHAME +SYSSHM: SRITYP [GOING DOWN IN ] + SKIPG SHUTDN + SRITYP [REVIVED] + PUSHJ P,SYSSP + SKIPG B,SHUTDN + JRST SYSSHN + SUB B,TIME + IDIVI B,30. ;CONVERT TO SECONDS + PUSHJ P,RTIME ;CONVERT TO SIXBIT + MOVE B,A + PUSHJ P,SYSTCD +SYSSHN: MOVEI I,[.ASCII /. /] + JRST SYSSTD + +;AND COME HERE WHEN TIME FOR SYS TO GO DOWN. +;MARK THE SYSTEM "DOWN", START FLAPPING TAPES AND DISKS, +;GUN ALL USERS, ETC. COMPLETION OF GOING DOWN IS DETECTED AT +;SLOW CLOCK LEVEL ("COFFIN"). +SYSOUT: PUSHJ P,CLQDEL + DEDBLK + SETOM DEDTIM ;PREVENT ^Z'S + .FDELE [SIXBIT/ SYSDOWN MAIL/ ? 0 ? 0] + JFCL + MOVEI U,LUBLK*2 +SYSCK3: SKIPGE SUPPRO(U) ;LOOK FOR ALL TOP-LEVEL JOBS. + SKIPN UNAME(U) + JRST SYSCK4 + MOVE T,USTP(U) + TLNE T,BUSRC + JRST SYSCK1 + MOVE T,OPTION(U) ;IS THIS JOB AN EXCEPTION? + TLNE T,%OPLIV + JRST SYSCK4 ;YES, LET IT LOG ITSELF OUT +SYSCK1: PUSHJ P,ALOGOUT ;LOG IT OUT (TELLS IT TO PREPARE ITSELF, SIGNAL SYSGUN) +SYSCK4: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSCK3 + SETZ U, +DWNMSG: SRITYP [NOT IN OPERATION] + PUSHJ P,SYALCP ;TYPE OUT ON FREE CONSOLES +IFN TPLP, MOVEI A,SCRTPF ;TPLOFF +IFN TPLP, IORM A,SUPCOR +IFN UNSPLP,[ SKIPG TPLFLG + JRST SYSCK0 + MOVEI A,SCRTPF + IORM A,SUPCOR +SYSCK0: +] MOVE I,QACTB + IORM I,QMDRO + MOVSI A,-NQS +SYSCK7: MOVE I,DCHBT(A) + SKIPN QACT(A) + IORM I,QTUTO(A) + AOBJN A,SYSCK7 +IFN NUNITS,[ + MOVEI A,1 +SYSUDM: SKIPL UDIRO(A) + .UDISMT A, ;DISMOUNT TAPES + CAIGE A,NUNITS + AOJA A,SYSUDM +] + MOVE T,TIME + MOVEM T,DTHTIM + SETOM SHUTDN + PUSHJ P,TTTMNT ;TURN OFF ALL TERMINET MOTORS + JRST SCOR + +SUBTTL SYSTEM CHECKS +;CHECK FOR DEVICES THAT LOSE THE PIA, DEVICES THAT INTERRUPT SPURIOUSLY, +;CLOBBERD LOCATIONS IN MEMORY. + +IFE KS10P,[ ; KS has no devices to speak of... + +SYSCK5: MOVSI A,-128. +SYSC51: SKIPL B,DCHNTC(A) +SYSC5A: AOBJN A,SYSC51 + JUMPGE A,CPOPJ + TLNN B,300000 + JRST SYSC5A + PUSH P,A + TLZE B,200000 + JRST SYSC52 + PUSHJ P,SYSC5S + JRST SYSC53 +SYSC52: PUSHJ P,SYSC5C +SYSC53: POP P,A + MOVSI B,300000 + ANDCAM B,DCHNTC(A) + JRST SYSC5A + +SYSC5C: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / CLOBBERED/] + JRST SYSSTD + +SYSC5S: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / SUSPECTED OF INTERRUPTING ON CHANNEL /] + PUSHJ P,SYSSP + LDB T,[360300,,DCHNTC(A)] + PUSHJ P,SYSSOP + JRST SYSTCR + +SYSSOP: PUSH P,A + PUSH P,B + MOVE A,T + PUSHJ P,SYSOPT + JRST POPBAJ + +SYSC5B: MOVEI I,[ASCIZ /DEVICE /] + PUSHJ P,SYSSP + HRRZ T,A + LSH T,2 + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ / (CONI= /] + PUSHJ P,SYSSP + HRRZ T,DCHNTC(A) + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ /) /] + JRST SYSSP + +] ;IFE KS10P + +SYSCKS: HRRZ T,UPDBR1 ;CHECK FOR CLOBBERED DBRS + HRRZ TT,UPDBR2 + CAIN T,UPGMP + CAIE TT,UPGMP+100 + BUG HALT,[PAGER DATA CLOBBERED. MAY BE DEC-TTL LEVEL CONVERTERS LOSING.] +;DROPS THROUGH + ;DROPS IN + MOVE A,SYSCKP + MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + CAME C,CKSUMS-TSTB(A) + JRST SYSKS2 + AOBJN A,SYSKS1 +SYSKS3: MOVE A,[-LTSTB,,TSTB] +SYSKS1: MOVEM A,SYSCKP + POPJ P, + +SYSKS2: EXCH C,CKSUMS-TSTB(A) + XOR C,CKSUMS-TSTB(A) ;SAVE XOR + PUSHJ P,WARMTTY + PUSHJ P,DINGTTY + MOVEI I,[ASCIZ /SYSTEM CLOBBERED BETWEEN /] + PUSHJ P,SYSSP + HRRZ A,(A) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / AND /] + PUSHJ P,SYSSP + MOVE B,SYSCKP + HLRE A,(B) + SETCMM A ;OFFSET BY ONE + ADD A,(B) + HRRZS A + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / XOR= /] + PUSHJ P,SYSSP + MOVE A,C + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ / !/] + PUSHJ P,SYSSTD + CLEARM TCKXOR ;TRY TO DETERMINE EXACT ADR AND PREV CONTENTS + MOVE A,[TCKXOR,,TCKXOR+1] + BLT A,TCKXOR+35. + MOVE A,[-LTSTB,,TSTB] +SYSKS6: MOVE B,(A) +SYSKS5: MOVE C,(B) +REPEAT 36.,[IFL .RPCNT-18.,TLNE C,400000_<-.RPCNT> +IFGE .RPCNT-18.,TRNE C,400000_<18.-.RPCNT> + XORM B,TCKXOR+.RPCNT + ] + AOBJN B,SYSKS5 + AOBJN A,SYSKS6 + MOVSI D,-36. +SYSKS7: MOVE A,TCKXOR(D) ;UPDATE CKXORS TBL AND FILL TCKXOR TBL WITH POSSIBLE ADRS + EXCH A,CKXORS(D) + XOR A,CKXORS(D) + HRRZM A,TCKXOR(D) + AOBJN D,SYSKS7 + PUSHJ P,STYOT ;INDENT LINE + MOVSI D,-36. + MOVSI E,400000 ;CURRENT BIT + CLEARB I,J ;COUNT OF #'S PRINTED, CLOBBERED WD +SYSKS8: SKIPE A,TCKXOR(D) + AOJA J,SYSKS9 ;INCR COUNT OF ADRS PRINTED +SYSKT2: LSH E,-1 + AOBJN D,SYSKS8 + SOJN J,SYSKT1 ;MORE THAN 1 ADR CLOBBERD SO CANT PRINT PREV CONTENTS + MOVEI T,"= + PUSHJ P,STYO + MOVE A,I ;PRINT CONTENTS PRIOR TO CLOBBERAGE + XOR A,(R) ;XOR CURRENT CONTENTS + PUSHJ P,SYSFWP + MOVEI T,"- + PUSHJ P,STYO + MOVEI T,"> + PUSHJ P,STYO + MOVE A,(R) + PUSHJ P,SYSFWP ;CURRENT CONTENTS +SYSKT1: PUSHJ P,SYSCRF + JRST SYSKS3 + +SCKX1: PUSH P,T ;UPDATE CKXORS TO REFLECT CHANGING WD IN T IN ADR IN Q + MOVSI C,-36. +SCKX2: SKIPGE T + XORM Q,CKXORS(C) + LSH T,1 + AOBJN C,SCKX2 + JRST POPTJ + +SYSKS9: PUSHJ P,SYSOPT + PUSHJ P,STYOS + MOVE R,TCKXOR(D) ;CLEAR DUP ENTRIES + MOVE T,D + MOVE Q,E ;ALSO LEAVE LAST ADR IN R (IN CASE ITS ONLY ADR) +SYSKT3: CAME R,TCKXOR(T) + JRST SYSKT4 + CLEARM TCKXOR(T) + XORM Q,I +SYSKT4: LSH Q,-1 + AOBJN T,SYSKT3 + JRST SYSKT2 + +SUBTTL SUPPORT ROUTINES FOR BUG MACRO + +;NOTE: THESE REPLACE THE SYSMSG ROUTINE THAT USED TO BE HERE + +;ENTRY POINTS +BUGCHK: PUSH P,TT + MOVE TT,SYSMPT ;HOW MANY MESSAGES BEHIND? + SUB TT,SYSMPU + CAIGE TT,<8_SYSMLNG>-8 + SKIPE SYSDBG + JRST BUGPSE+1 ;TREAT AS BUGPSE IF BUFFER FULL OR SYSDBG + CAIA +BUGINF: PUSH P,TT + PUSHJ P,SYSMS0 ;HAND MESSAGE TO SYSTEM JOB TO BE PRINTED + JRST POPTTJ ;CONTINUE TRAPPED ROUTINE + +BUGPSE: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/PAUSE. FIND A WIZARD, CONSIDER TAKING A CRASH DUMP, +OR TYPE P TO ATTEMPT TO REVIVE THE SYSTEM./ + +BUGDDT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/DDT. TYPE P TO CONTINUE./ + +BUGNIL: PUSH P,TT + JRST BUGHL1 ;NO MESSAGE, JUST GO STRAIGHT TO DDT. + +BUGAWF: 0 ;JSR HERE WHEN AWFUL THINGS HAVE HAPPENED + CONO PI,PIOFF ;BETTER DO THIS AS SOON AS POSSIBLE + MOVEM P,BUGACS+P ;SAVE P AND GET A PDL TO USE + MOVE P,BUGPDL + PUSH P,BUGAWF ;SIMULATE PUSHJ P,BUGHLT +BUGHLT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER +BUGHL1: JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/HALT. FIND A WIZARD OR CONSIDER TAKING A CRASH DUMP. +THE SYSTEM HAS CRASHED AND CANNOT BE REVIVED WITHOUT EXPERT ATTENTION. +IF YOU CAN'T FIND HELP, RELOAD THE SYSTEM./ + +;ROUTINE TO PICK UP THE DATA OUT OF THE BUG TABLE, EVALUATE THE +;ARGUMENTS, AND DUMP THE RESULTS INTO THE SYSMSG BUFFER TO BE +;PRINTED LATER. THE THIRD THING DOWN ON THE STACK IS THE PC+1 +;AT WHICH THE BUG WAS DETECTED. TT IS THE ONLY SMASHABLE REGISTER. +SYSMS0: MOVEI TT,8 ;8 WORDS IN ENTRY + ADDB TT,SYSMPT ;UPDATE STORING POINTER + ANDI TT,8_SYSMLNG-1 ;MASK TO BUFFER INDEX + ADDI TT,SYSMBF + PUSH P,TT ;SAVE PTR + PUSH P,A ;NOW LOCATE BUG TABLE ENTRY + PUSH P,B + MOVE A,TIME ;STASH TIME IN EXTRA WORD OF ENTRY + MOVEM A,7(TT) + MOVEI B,BUGTAB +SYSMS1: HRRZ A,(B) + CAIN A,@-5(P) + JRST SYSMS2 ;PC MATCHES + HLRZ A,(B) ;ADVANCE TO NEXT ENTRY + ADD B,A + JUMPN A,SYSMS1 + JRST 4,. ;NOT IN TABLE?? MACROS MUST BE SCHROD + +SYSMS2: HLRZ A,(B) + ADDI TT,-2(A) + EXCH TT,-2(P) ;TT START OF ENTRY, -2(P) END + MOVE A,TT + HRLI A,1(B) ;COPY BITS,,STRING AND ARG POINTERS + BLT A,@-2(P) + POP P,B + POP P,A + SUBM TT,(P) ;(P) GETS -NARGS + SKIPE (P) ;IN CASE NO ARGS +SYSMS3: PUSH TT,@1(TT) ;EVALUATE ARGUMENT POINTERS + AOSGE (P) + JRST SYSMS3 + MOVEI TT,SCRMSG ;BIT FOR MSG PRINT + IORM TT,SUPCOP ;TRY EVERY SECOND TO PRINT SOME MSGS + IORM TT,SUPCOR ;FIRST ATTEMPT RIGHT AWAY. + JRST POP1J ;RETURN TO BUGINF OR WHEREVER + +;CALL HERE TO PRINT THE MESSAGES OUT OF THE BUFFER +;A HAS SCRMSG +SYSMPR: MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMG TT,SYSMPU ;LAST MESSAGE OUT + JRST [ ANDCAM A,SUPCOP ;CAUGHT UP + POPJ P, ] + SUBI TT,8_SYSMLNG + CAMLE TT,SYSMPU + JRST [ MOVE A,TT ;BEHIND BY MORE THAN SIZE OF BUFFER + SUB A,SYSMPU + MOVEM TT,SYSMPU + LSH A,-3 ;NUMBER OF MESSAGES LOST + PUSHJ P,DINGTTY + PUSHJ P,SYSDPT + MOVEI I,[ASCIZ/ SYS MSGS LOST/] + PUSHJ P,SYSSTD + JRST .+1 ] + MOVEI TT,8 + ADDB TT,SYSMPU + ANDI TT,8_SYSMLNG-1 + ADDI TT,SYSMBF + PUSHJ P,DINGTTY + HLLZ D,(TT) ;GET MODE FLAGS + HRRZ I,(TT) ;GET ASCIZ MSG + HRLI I,440700 +SYSMP0: ILDB T,I + JUMPE T,SYSMP1 + CAIGE T,10 + JRST SYSMP3 + PUSHJ P,STYO + JRST SYSMP0 + +SYSMP1: PUSHJ P,STYOS ;SPACE AND OUTPUT REMAINING ARGS + PUSHJ P,SYSMP2 + JRST SYSTCR ;END WITH TIME, POPJ + JRST SYSMP1 + +SYSMP3: PUSH P,T ;OUTPUT THIS MANY ARGS +SYSMP4: PUSHJ P,SYSMP2 + JFCL + PUSHJ P,STYOS + SOSLE (P) + JRST SYSMP4 + SUB P,[1,,1] + JRST SYSMP0 + +SYSMP2: MOVEI C,0 + LSHC C,3 ;GET A BYTE + JUMPE C,CPOPJ ;NO MORE ARGS TO PRINT + PUSH P,I + MOVE A,1(TT) + PUSHJ P,@SYSMTB(C) + POP P,I + AOJA TT,POPJ1 + +;DISPATCH TABLE FOR SYSTEM MESSAGE PRINTER + +SYSMTB: JRST 4,. ;0 CHECKED FOR END + SYSFWP ;1 FULL WORD OCTAL + SYSDPT ;2 FULL WD DECIMAL + SYSDPC ;3 " WITH COMMAS + SYSCRF ;4 DO CR + CPOPJ ;5 ? + SYSIXP ;6 SIXBIT + [MOVE I,A ;7 ASCIZ + JRST SYSSP] + +;ROUTINE FOR BUGS THAT NEED TO HALT INTO DDT +BUGDD0: HRLI TT,440700 + CONO PI,PIOFF ;PREVENT INTERFERENCE, AND HACK STYO + MOVEM TT,T00POS ;SAVE ADDRESS OF MESSAGE TEMPORARILY + POP P,TT ;RESTORE TT AT TIME OF BUG + POP P,BUGPC ;ADDRESS+1 OF BUG + SKIPE BUGAWF + MOVE P,BUGACS+P ;CORRECT P AT TIME OF BUG + SETZM BUGAWF ;CLEAR FLAG FOR NEXT BUG IN CASE REVIVED + MOVEM 17,BUGACS+17 ;SAVE ACS + MOVEI 17,BUGACS + BLT 17,BUGACS+16 + MOVE P,BUGPDL ;USE THIS PDL FOR TYPING OUT + PUSH P,T00POS ;RECOVER ASCIZ STRING FOR FLAVOR OF BUG + PUSHJ P,SYSCRF ;CARRIAGE RETURN +BUGDD1: MOVEI A,SCRMSG + PUSHJ P,SYSMPR ;DUMP SYSMSG BUFFER +IFN KA10P,[ + CONSZ TTY,40 ;PUNT IF CHARACTER TYPED + JRST BUGDD2 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPE DTEF11 ;INPUT TYPED? + JRST BUGDD2 ;YES, PUNT +] ;KL10P +IFN KS10P,[ + SKIPE 8CTYIN ; Any input available? + JRST BUGDD2 ; Yes: Punt. +] ;KS10P + MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMLE TT,SYSMPU ;LAST MESSAGE OUT + JRST BUGDD1 +BUGDD2: CONI PI,A-1 ;CHECK FOR PI IN PROGRESS + ANDI A-1,77400 + LSH A-1,20. + JFFO A-1,[ MOVEI I,[ASCIZ/PI LEVEL /] + PUSHJ P,SYSSP + PUSHJ P,SYSDPT + PUSHJ P,STYOS + JRST .+1 ] + MOVEI I,[ASCIZ/BUG/] + PUSHJ P,SYSSP + POP P,I ;PAUSE OR HALT MESSAGE + SKIPN SYSDBG ;PUNT LONG-WINDED MESSAGE IF DEBUGGING + PUSHJ P,SYSSP + MOVEI I,[ASCIZ/ +YOU ARE NOW IN DDT./] + PUSHJ P,SYSSP + MOVEI TT,[ASCIZ|BUGPC/Q-2/|] + HRLI TT,440700 + MOVEM TT,777777 ;TELL DDT TO EXAMINE BUGHLT ADDRESS + MOVE TT,BUGPC ;ARRANGE FOR P TO JUMP THERE + MOVEM TT,@DDT-6 ;IN OLDER DDT WILL JUST CLOBBER AC0 + MOVSI 17,BUGACS ;RESTORE ACS + BLT 17,17 + CONO PI,PION + JRST DDT + +EBLK + +;DATA AREAS POINTERS AND BUFFER FOR SYS MSG PRINTER + +CTLMAX==55. ;Number of lines after which we should print the date. +CTLCNT: 0 ;Keeps track of number of lines printed on console. + +SYSMPT: 0 ;POINTER TO MESSAGE MOST RECENTLY INSERTED +SYSMPU: 0 ;POINTER TO MESSAGE MOST RECENTLY PRINTED + ;(MUST TAKE MODULO LENGTH OF TABLE, AND ADD OFFSET OF BEGIN OF TABLE) +IFNDEF SYSMLNG,SYSMLNG==5 ;LOG(2) OF # ENTRIES (5=>32) + +SYSMBF: BLOCK 8_SYSMLNG ;8 WDS PER ENTRY: BITS,,STRING, 6 ARGS, TIME + +BUGPC: 0 ;RESTART PC FROM BUG +BUGACS: BLOCK 20 ;AC SAVE AREA FOR BUGDD0 +BUGPDL: -20,,. + BLOCK 20 +T00POS: 0 ;TTY00 HORIZONTAL POSITION + +BBLK + +SUBTTL .SETLOC ROUTINE (DOCUMENT THEN DOES IT) + +SYSSET: MOVE A,SETSLC ;LOCATION TO BE MODIFIED + TLNN A,-1 ;SKIP IF ALREADY DONE + SKIPA C,SETSLQ ;NEW VAL IN SETSLQ + SKIPA C,(A) ;NEW VAL IN LOC + SKIPA D,A ;OLD VAL IN @A + MOVEI D,SETSLQ ;OLD VAL IN SETSLQ + PUSHJ P,SYSSCT ;PRINT OUT DDT-TYPE SEQUENCE + MOVE A,SETSU ;GET USET NAME + PUSHJ P,STYOT ;TYPE OUT A TAB + MOVEI B,0 + PUSHJ P,SYSIXP ;PRINT NAME OF GUILTY PARTY + PUSHJ P,SYSTCR ;STANDARD SYS CARRIAGE RETURN + SKIPGE SETSLC ;IF ALREADY MUNGED AT UUO LEVEL + POPJ P, ;THEN EXIT NOW + MOVE T,SETSLQ ;GET DESIRED VALUE +; SKIPL UMBTS +; JRST SYSSE8 ;DON'T HACK METABITS +; LMB Q,@SETSLC ;GET META BIT OF DESIRED LOCATION +; TRNE Q,1 ;IF 1 THEN HAVE TO MOMENTARILY CLEAR IT +; JRST SYSSE5 +SYSSE8: EXCH T,@SETSLC ;META BIT=0, CHANGE LOCATION +SYSSE6: MOVE Q,SETSLC ;GET ADR OF MUNGED LOC + MOVE A,[-LTSTB,,TSTB] +SYSSE1: MOVE B,(A) + CAIGE Q,(B) + JRST SYSSE3 + HLRE C,B + SETCMM C + ADD C,B + CAILE Q,(C) + JRST SYSSE3 + PUSHJ P,SCKX1 ;UPDATE CKXORS TBL TOO + EQV T,@SETSLC + EQVM T,CKSUMS-TSTB(A) + MOVE T,@SETSLC + PUSHJ P,SCKX1 ;UPDATE TO REFLECT NEW CONTENTS +SYSSE2: MOVSI A,SCLSET + ANDCAM A,SUPCOR + CAIE Q,SYSDBG ;IF NOT DEBUG SWITCH + POPJ P, ;EXIT + PUSHJ P,DBGINT ;SYSDBG STATE CHANGE, TELL ALL USERS + SKIPE SYSDBG + JUMPN T,CPOPJ +;SYSDBG CLEARED, GIVE "IN OPERATION" MESSAGE BY DROPPING INTO ISYS +;HERE WHEN SYSTEM IS UP AND DISKS HAVE BEEN INITIALIZED +;RE-ENTER HERE WHEN SYSDBG STATE CHANGED +ISYS: PUSHJ P,DATIME ;MAY BE ABLE TO FIND TIME IMMEDIATELY (ONCE MFD IN) + PUSHJ P,TTTMN2 ;MAKE SURE WE THINK THAT ALL TERMINET + ;MOTORS ARE OFF, SO WE'LL TRY TO TURN THEM ALL ON WHEN WE TYPE + ;"ITS IN OPERATION" ON THEM. + PUSHJ P,TTRSAL ;SEND %TDORS TO ALL SOFTWARE TTYS + SRITYP [IN OPERATION] + SKIPE SYSDBG ;IF SYS IN DEBUG MODE +DMESSG: SRITYP [BEING DEBUGGED] ;SET TO APPROP MSG + PUSHJ P,SYALCP ;PRINT ON ALL CONSOLES +SCMESG: SRITYP [SYSTEM JOB USING THIS CONSOLE.] + PUSHJ P,SYSSP ;PRINT ON SYS JOB CONSOLE + SKIPGE DMLLDF ;START DRAGON (DAEMON) IF WANTED + SKIPL DMON+1 ;AND NOT DONE ALREADY + POPJ P, + HRROI T,DMON + CONO PI,UTCOFF + PUSHJ P,NUJBST + BUG ;SHOULD BE ROOM IN REQUEST BUFFER + JRST UTCONJ + +SYSSE3: AOBJN A,SYSSE1 + JRST SYSSE2 + + ;SETLOC ROUTINE TO MODIFY LOCATION WITH META BIT = 1 + +;SYSSE5: MOVEI D,0 +; SMB D,@SETSLC +; EXCH T,@SETSLC +; SMB Q,@SETSLC +; JRST SYSSE6 + +SUBTTL MEMORY ERROR MESSAGES + +NXMTYP: MOVEI I,[ASCIZ /NON-EX MEM ERROR #/] + MOVEI TT,1 + JRST MEMTYP + +IFE KA10P,[ +BPFTYP: MOVEI I,[ASCIZ /PAGE FAIL ERROR #/] + MOVEI TT,2 + JRST MEMTYP +] ;IFE KA10P + +PARTYP: MOVEI I,[ASCIZ /PARITY ERROR #/] ;PARITY ERROR + MOVEI TT,0 +MEMTYP: PUSHJ P,SYSSP + MOVE A,PARERR(TT) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, PC = /] + PUSHJ P,SYSSP + MOVE A,PARPC(TT) + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ /, JOB # /] + PUSHJ P,SYSSP + MOVE A,PARUSR(TT) + IDIVI A,LUBLK + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + MOVE D,PARUSR(TT) + MOVE A,UNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,STYOS + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + JRST @.+1(TT) ;DISPATCH ON TYPE OF ERROR + PARTY2 ;PARITY + SYSTCR ;NXM +IFE KA10P,[ + BPFTY2 ;BPF + +BPFTY2: MOVEI I,[ASCIZ /, PFW = /] + PUSHJ P,SYSSP + MOVE A,BPFPFW + PUSHJ P,SYSFWP + JRST SYSTCR +] ;IFE KA10P + +PARTY2: PUSHJ P,SYSTCR +IFN KS10P,[ + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP + MOVE T,PARERA ; Error address is all we collect on the KS. + PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KS10P +IFN KL10P,[ + SKIPN PARRSN + JRST PARTP1 + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP ;PAR ERR INT ALWAYS GIVES ERR ADDR + MOVE T,PARERA + JRST PARTP2 + +PARTP1: MOVEI I,[ASCIZ /PFW = /] + PUSHJ P,SYSSP ;PAR ERR TRAP GIVES PFW AND BAD DATA + MOVE T,PARPFW ;EVEN IF SCAN DOESN'T FIND PAR ERRS. + PUSHJ P,SYSP + MOVEI I,[ASCIZ /, BAD DATA = /] + PUSHJ P,SYSSP + MOVE T,PARWRD +PARTP2: PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KL10P + SOSGE D,PARCNT + POPJ P, + JUMPE D,PARTP3 ;IF SCAN FOUND MORE THAT ONE PAR ERR, + ;PRINT AND'S AND OR'S OF DATA AND ADDRS. +IRP X,,[PARAAN,PARAOR,PARAND,PARIOR]Y,,[ADDR AND,ADDR IOR,DATA AND,DATA IOR] +IFE .IRPCNT&1, MOVEI I,[ASCIZ /Y = /] +.ELSE MOVEI I,[ASCIZ /, Y = /] + PUSHJ P,SYSSP + MOVE T,X + PUSHJ P,SYSP +IFN .IRPCNT&1, PUSHJ P,SYSCRF ;PRINT TWO ITEMS PER LINE. +TERMIN +PARTP3: MOVEI I,[ASCIZ /PARITY ERRORS: +/] + PUSHJ P,SYSSP +SYSPR1: PUSHJ P,STYOT ;TYPE TAB + MOVE A,PARADR(D) + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,PARCON(D) + PUSHJ P,SYSFWP + PUSHJ P,SYSCRF + SOJGE D,SYSPR1 + AOS D,PARCNT + MOVEI I,[ASCIZ/ .../] + CAIN D,MXPARS + PUSHJ P,SYSSP ;NOT ALL PARITY ERRORS WERE PRINTED + JRST SYSCRF + +SUBTTL LOGIN & MISCELLANEOUS MESSAGES + +SYSLGI: SKIPE SUPPLG + POPJ P, ;DON'T BOTHER PRINTING MESSAGE + HLRZ I,SLGIV+1 ;Message (CHUNAME, LOGIN, etc) + PUSHJ P,SYSSP + MOVEI TT,SLGIV ;.LOGIN + MOVE A,(TT) + CAMN A,[-1] + BUG + PUSHJ P,SYSG23 + SKIPE A,SLGIV+2 + PUSHJ P,SYSSIX + JRST SYSTCR + +SYSG23: PUSHJ P,SYSIXP + PUSHJ P,STYOS + HRRZ A,1(TT) ;PICK UP TTY NUM + JRST SYSOPT + +;PRINT A MESSAGE WHEN SOMEONE WRITES ON SYS. +SYSWRT: MOVE A,SWUNAM ;WRITE ON SYS DEVICE + PUSHJ P,SYSIXP + MOVE A,SWJNAM + PUSHJ P,SYSSIX + MOVE A,SWFN3 ;SNAME - SYS,SYS1, ... + PUSHJ P,SYSSIX + MOVE A,SWFN1 + PUSHJ P,SYSSIX + MOVE A,SWFN2 + PUSHJ P,SYSSIX + MOVE A,[SIXBIT /WRITE/] ;Assume luser was writing. + MOVE B,SWMOD ;Check opcode. + CAIN B,2 ;MLINK? + MOVE A,[SIXBIT /LINK/] ; Yup. + CAIN B,4 ;Maybe DELE/WO, RENAM/WO? + MOVE A,[SIXBIT /DELRNM/] ; Yah, hmmhmmm. +SYSWR3: PUSHJ P,SYSSIX + JRST SYSTCR + +SUBTTL DETERMINE AND PRINT THE DATE AND TIME + +EBLK +DATIME: JRST .+1 ;RH MODIFIED TO REFLECT PROGRESS +BBLK ;ROUTINE CALLED BY PUSHJ, + ;BIT SET EVERY SECOND FROM SUPCOP UNTIL + ;THE DATE IS KNOWN. + MOVSI T,40000 ;"MFD IN" BIT IN QMDRO + CONO PI,UTCOFF ;DISABLE INTERRUPTS + TDNE T,QMDRO ;SEE IF DIRECTORY IN + JRST UTCONJ ;NOT IN + ;MFD IN, GET CRUD FROM IT + MOVE A,QMDRO ;GET ORIGIN OF MFD + SKIPE B,MDYEAR(A) ;YEAR + MOVEM B,FYEAR + SKIPE C,MPDOFF(A) ;PDTIME OFFSET + MOVEM C,PDTIME + MOVEI C,DATIM0 + HRRM C,DATIME + JRST UTCONJ + +DATIM0: PUSHJ P,GLPDTM ;NOW SEE IF IT'S ALL THERE + JRST DATIM2 ;NOT ALL THERE, DOCUMENT WHAT'S MISSING + JRST DATIM6 ;ALL THERE, TYPE OUT AND CLEAR SUPCOR BIT + + ;NOT ALL THERE, DOCUMENT (TYPE OUT) WHAT IS MISSING + ;SHOULD NOT BE NECESSARY TO WARM UP TTY + +DATIM2: +IFN PDCLKP,[ + DATAI PDCLK,A ;SEE IF CLOCK ON + JUMPN A,DATIM3 ;JUMP IF CLOCK WINNING + MOVEI I,[ASCIZ /DECORIOLIS CLOCK HAS BEEN POWERED OFF, IF THE TIME +CANNOT BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + MOVEI T,500. + SOJG T,. ;WAIT AND BE SURE + DATAI PDCLK,A ;GET DATAI AGAIN + JUMPN A,DATIM3 ;JUMP IF OK NOW + PUSHJ P,SYSSP ;COMPLAIN +] ;PDCLKP +IFN KS10P,[ + RDTIM A ; Clobbers B + TLC A,1729. ; "A most interesting number" + TLNN A,-1 ; If present, KS-10 clock still remembers the time. + JRST DATIM3 + MOVEI I,[ASCIZ /THE KS-10 CLOCK HAS BEEN RESET, IF THE TIME CANNOT +BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + PUSHJ P,SYSSP ; Complain +] ;KS10P +DATIM8: +; HRROI T,CCTSS ;NOW PREPARE TO LOAD CTSS CALLER FROM SYS:@ CCTSS +; PUSHJ P,NUJBST ;DO A PSEUDO-CONTROL Z +; JRST DATIM7 +DATIM3: MOVEI C,0 ;COUNTER OF THINGS MISSING FROM MFD + MOVEI I,[ASCIZ /YEAR, /] + SKIPG FYEAR ;CHECK YEAR + PUSHJ P,[AOJA C,SYSSP] ;NOT IN, COMPLAIN +IFN PDCLKP\KS10P,[ + MOVEI I,[ASCIZ /PDTIME OFFSET, /] + SKIPN PDTIME + PUSHJ P,[AOJA C,SYSSP] ;PDTIME OFFSET NOT IN +] ;PDCLKP\KS10P + JUMPE C,DATIM4 ;SKIP FOLLOWING IF EVERYTHING ON DISK + MOVEI I,[ASCIZ /NOT ON DISK. +PLEASE SETLOC APPROPRIATELY. +/] + PUSHJ P,SYSSP +DATIM4: SKIPA T,[DATIM5];UPDATE DATIME TO WAIT FOR EVERYTHING TO BE THERE +DATIM7: MOVEI T,DATIM8 ;UPDATE DATIME TO WAIT FOR ABILITY TO DO + ; PSEUDO-CONTROL Z FOR CTSS CALLER + HRRM T,DATIME + POPJ P, + + ;WAIT FOR EVERYTHING TO BE THERE + ;THEN TYPE OUT "IT IS NOW...", ETC. + +DATIM5: PUSHJ P,GLPDTM ;CHECK IT + POPJ P, ;NOT ALL THERE YET + MOVEI T,DATIME+1 ;ALL THERE, RE-INITIALIZE DATIME + HRRM T,DATIME +DATIM6: MOVSI T,SCLDAT ;STOP CALLING DATIME EVERY SECOND + ANDCAM T,SUPCOP ;NOW THAT THE WORK IS DONE. + HRRZS TIMOFF ;START UP SLOW CLOCK REAL-TIME ROUTINE + SETZM RSWTIM ;Initialize the resource-warning timestamp. + PUSHJ P,WARMTT ;WARM UP TTY + PUSHJ P,RYEAR1 ;GET DAY OF WEEK IN RELEVANT FIELD OF E +SYSNWP: MOVEI I,[ASCIZ /IT IS NOW /] + PUSHJ P,SYSSP ;TYPE IT OUT + IDIVI A,SPD ;A HAS RESULT OF PUSHJ TO GLPDTM + PUSH P,A ;SAVE DAY OF YEAR + MOVE A,B ;GET # SECS SINCE MIDNIGHT IN A + IDIVI A,SPD/2 ;GET AM/PM BIT IN A, 12 HOUR TIME (SECS) IN B + PUSH P,[SIXBIT / AM PM/](A) ;REMEMBER WHAT HALF-DAY + CAIGE B,3600. ;USE 12:01 RATHER THAN 0:01 IN 12-HR TIME. + ADDI B,12.*3600. + PUSHJ P,RTIME ;CONVERT TIME TO SIXBIT + MOVE B,A + TLNN B,170000 ;IF LEADING DIGIT IS ZERO, + TLZ B,770000 ;THEN TURN IT INTO A BLANK + PUSHJ P,SYSTCD ;TYPE OUT TIME + POP P,B ;RESTORE AM OR PM WORD + PUSHJ P,SYS6 ;TYPE IT OUT + MOVE B,[SIXBIT / EST,/] + TLNE E,100000 ;DST BIT + HRLI B,(SIXBIT / ED/) ;DAYLIGHT SAVINGS TIME, TYPE OUT EDT INSTEAD OF EST + PUSHJ P,SYS6 ;TYPE IT OUT + PUSHJ P,STYOS ;TYPE A SPACE + LDB B,[320300,,E] ;GET DAY OF WEEK (0 => SUNDAY) + MOVE B,DOWTBL(B) ;MON, TUES, WEDNES, ETC. (IN SIXBIT) + PUSHJ P,SYS6 ;TYPE IT OUT + MOVEI I,[ASCIZ /DAY, /] ;FINISH ON DAY OF WEEK + PUSHJ P,SYSSP ;" " " + POP P,A ;RESTORE DAY OF YEAR + PUSHJ P,RDATE1 ;CALCULATE MONTH AND DAY + MOVE B,NMNTBL-1(B) ;GET SIXBIT FOR MONTH + PUSHJ P,SYS6 ;TYPE OUT MONTH + PUSHJ P,STYOS ;TYPE A SPACE + MOVE A,C ;GET DAY OF MONTH IN A + PUSHJ P,SYSDPT ;TYPE OUT IN DECIMAL + MOVEI T,", + PUSHJ P,STYO ;TYPE A COMMA + MOVEI A,(E) ;GET YEAR + PUSHJ P,SYSDPT ;TYPE IT OUT + JRST SYSCRF ;END WITH CRLF + + ;TABLE OF NAMES OF MONTHS (FIRST THREE LETTERS, IN SIXBIT) + +NMNTBL: MNIRP [SIXBIT /M/] + + ;TABLE OF SIXBIT NAMES FOR DAYS OF THE WEEK + ;(THE "DAY" ON THE END LEFT OFF) + +DOWTBL: IRPS D,,[SUN MON TUES WEDNES THURS FRI SATUR] + SIXBIT /D/ + TERMIN +IFN .-DOWTBL-7,.ERR BARF AT DOWTBL + +SUBTTL NETWORK UP/DOWN + +SYSNET: +IFE IMPP,JRST SCOR +IFN IMPP,[ + MOVEI I,[ASCIZ /IMP CRASHED, STATUS=/] + PUSHJ P,SYSSP ;Print string + MOVE A,IMERCN ;Get IMP error code + PUSHJ P,SYSFWP ;Print that + PUSHJ P,SYSTCR ;Time, CRLF + SETOM IMERCN ;Reset error status + MOVE A,LNETIM ;Last time net was initted + SUB A,TIME ;A will be positive if net was last + ADDI A,30.*30. ; initted less than 30 sec ago. + PUSH P,A ;Flag for SYSNT5. + means don't restart IMP + MOVNI A,2 ;Say we are coming up, but no PI action yet, + MOVEM A,IMPUP ; and prevent new net openers. IMPUP may + PUSHJ P,SYSNT5 ; not already be -1 if got here via LOCK/NET + JRST SCOR ;Reset net, then back to main loop + +;Reset net, and potentially restart IMP +; Try restarting if IMP ready and -1(P) is negative. +; +;IMPUP is -1 so no new opens can happen. + +SYSNT5: + ;PCLSR those users running in OPEN. + ; + MOVEI U,0 +IFN NCPP,[ + PUSHJ P,LSTSTP ;PCLSR all users in .OPEN + NETLST + MOVSI I,-IMPSTL +SYSNT2: SKIPL A,IMSOC1(I) + JRST SYSNT1 + HRRZS A + SKIPN UNAME(A) + JRST SYSNT1 + MOVE T,APRC(A) + TLNE T,BULGO ;Tree is being deleted anyway. + JRST SYSNT1 + PUSHJ P,IFSTOP ;Stop network user + PUSHJ P,CHSCAA + PUSHJ P,SYSNT3 ;Hack IOCHNM words of net user +SYSNT1: AOBJN I,SYSNT2 +];NCPP + + ;Disconnect all STYs from the network + ; + MOVEI I,NFSTTY+NSTTYS-1 +SYSNT6: + PUSHJ P,NSTYN0 + JFCL + CAILE I,NFSTTY + SOJA I,SYSNT6 + +IFN NCPP,[ + ;Clean up connections which were closing + ; + CONO PI,UTCOFF + MOVSI I,-IMPSTL +SYSNT7: SKIPL H,IMSOC1(I) + JRST SYSNT4 + PUSHJ P,IMPBRT ;RETURN BUFFER + TLNN H,200000 ;IN PROCESS OF CLOSING? + JRST SYSNT4 ;NO, IGNORE + SETZM IMSOC1(I) ;FLUSH SOCKET + SOS IMNCS ;DECREASE COUNT OF CLOSES IN PROCESS +SYSNT4: AOBJN I,SYSNT7 ;LOOP THRU ALL SOCKETS + SKIPE IMNCS ;SKIP IF 0 MORE CLOSES + BUG PAUSE,DEC,IMNCS,[NET CHANNELS NOT CLOSED YET] + CONO PI,UTCON +];NCPP + + ;Maybe try to bring the IMP up again + ; + MOVEI U,0 + SKIPG -1(P) ;If last time down was < half minute ago, + CALL IMPCKR ; or IMP ready line is not set, + JRST LSWCLR ; then don't try to bring it up again + PUSHJ P,IMPINI +IFN NCPP,PUSHJ P,LSWCLR ;Restart old network users + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ /IMP up again./] + JRST SYSSTD ;Print and return + +IFN NCPP,[ +SYSNT3: HRRZ C,(R) + CAIL C,NETDUI + CAILE C,NETDBO + POPJ P, ;NOT A NETWORK CHANNEL + HLRE C,(R) ;SOCKET MAP INDEX + JUMPL C,CPOPJ + HRROS (R) ;SET LH OF IOCHNM TO -1 + HRRZ C,R + SUBI C,IOCHNM(A) + CAIL C,20 + POPJ P, ;ON IOPDL + MOVE C,CHNBIT(C) + AND C,MSKST2(A) + IORM C,IFPIR(A) ;INTERRUPT USER + POPJ P, +];NCPP +];IMPP + +;Try to bring IMP up if desirable +SYSIMU: +IFE IMPP,POPJ P, ;No IMP, no work +IFN IMPP,[ + SKIPGE IMPTCU ;Already trying to come up? + POPJ P, ;Yes, no meddling needed + CALL IMPCKR ;Check if IMP ready line is now + JRST [ SETZM IMPTCU ;IMP not ready, we are down and not trying + POPJ P, ] ; to come up. Give up now + PUSH P,[-1] ;Force SYSNT5 to try and restart IMP if called + SKIPGE IMPUP ;Do this only if imp is temporarily down. + PUSHJ P,SYSNT5 ;Reset world, restart IMP + JRST POP1J ;Clean up and exit +];IMPP + +; PUSHJ P,LSTSTP +; LIST ;WHERE LIST/ +;STOPS ALL JOBS ON THE LIST, AND PUT THEM ON OUR LSWPR. +;LIST SHOULD BE LINKED THROUGH THE RH, AND EACH WORD IN THE LIST SHOULD BE +;IN THE USER VAR BLOCK OF SOME JOB. THAT JOB IS CONSIDERED TO BE ON THE LIST. +;0 IN THE RH MEANS NIL. +LSTSTP: MOVE T,@(P) ;POINTER TO FIRST ELEMENT OF LIST + CONO PI,CLKOFF + MOVE T,(T) +LSTST1: HRRZS T + SKIPN A,T ;ADDRESS OF LSWB BLOCK + JRST CLKOJ1 + MOVEI A,-USRSTG(A) + IDIVI A,LUBLK + IMULI A,LUBLK ;USER INDEX + PUSH P,(T) + PUSHJ P,IFSTOP ;STOP USER, ADDING HIS USTP TO OUR LSWPR + POP P,T + JRST LSTST1 + SUBTTL SYSTEM JOB TYPE-OUT ROUTINES + +;PRINT "/ <@D> " IN OCTAL. +;USED BY SYSSET. CLOBBERS A,B,T. +SYSSCT: HRRZS A + PUSHJ P,SYSOPT + MOVEI T,"/ + PUSHJ P,STYO + PUSHJ P,STYOT ;TAB + MOVE A,(D) ;GET CURRENT VALUE + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,C ;GET NEW VALUE + JRST SYSFWP + +;STRING <- I, SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSSTD: PUSHJ P,SYSSP + +;SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSTCR: PUSHJ P,SYSTPT + +;TYPE A CRLF. CLOBBERS T. +SYSCRF: SOS CTLCNT ;Countdown number of lines printed. + MOVEI T,15 + PUSHJ P,STYO + MOVEI T,12 + JRST STYO + +SYSTPT: PUSHJ P,STYOS ;TYPE SPACE, TIME + CONSZ PI,200 ;IF IN BUGDD0, MUSTN'T CALL GLPDTM + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + IDIVI A,SPD + PUSHJ P,RTIME ;CONVERT TO SIXBIT. + MOVE B,A ;DROP INTO SYSTCD + +SYSTCD: LDB A,[301400,,B] + PUSHJ P,SYSTWR + LDB A,[141400,,B] + PUSHJ P,SYSTWR + MOVE I,[140600,,B] + JRST SYSIX2 + +;PREPARE FOR TYPING OUT A MESSAGE ON THE CONSOLE TTY. CALL HERE BEFORE +;STARTING TO TYPE A LINE, IF THERE IS A CHANCE THAT SYS JOB MIGHT JUST +;BE STARTING TO TYPE AFTER A PERIOD OF SILENCE. +WARMTTY:PUSHJ P,SYSCOP ;GET SYSTEM TTY READY TO USE + .IOT STYOC,[^P] ;ADVANCE TO FRESH LINE + .IOT STYOC,["A] +WARMT2: +IFN 1, POPJ P, +.ELSE [ MOVE T,SYSCN + MOVE T,TTLTM(T) ;DON'T DO THIS IF THERE'S BEEN ACTIVITY IN 2 MINUTES. + ADDI T,115.*30. + CAML T,TIME + POPJ P, + PUSH P,[[MOVEI T,^H + JRST WARMT1]] + SKIPA T,[175] ;WARM UP TELETYPE (ONLY ON AI-KA FOR NOW) +];END .ELSE +DINGTTY: SKIPA T,[^G] ;DING DING +WARMT1: PUSHJ P,.+1 + PUSHJ P,.+1 + JRST STYO + +;ROUTINE TO "OPEN" A CHANNEL TO THE SYSTEM CONSOLE +;IT'S DONE THIS WAY SO THAT THE CONSOLE CAN STILL BE +;USED AS A USER CONSOLE WHEN NECESSARY. SYSTEM JOB +;MESSAGES WILL JUST COME OUT FROM TIME TO TIME. + +SYSCOP: HRLZ T,SYSCN ;FAKE UP AN IOCHNM WORD + ADD T,[%TJDIS+%TJMOR,,TYODN] + SKIPGE SYSCN + MOVEI T,NLODN ;IF NO SYS TTY AVAIL, USE NUL DEVICE + MOVEM T,IOCHNM+STYOC + POPJ P, + +;TYPE OUT THE SIXBIT WORD IN B, QUIT WHEN WHAT IS LEFT IS BLANK +SYS6: JUMPE B,CPOPJ ;RETURN WHEN NOTHING LEFT + MOVEI A,0 ;INITIALIZE FOR LSH + LSHC A,6 ;SHIFT A CHARACTER IN + MOVEI T,40(A) ;CONVERT TO SIXBIT AND GET IN T + PUSHJ P,STYO ;TYPE OUT THE CHARACTER + JRST SYS6 ;LOOP BACK FOR NEXT CHARACTER + +;PRINT A MESSAGE ON ALL FREE CONSOLES. 40 SET IN LH(I) => IT IS ADDR OF ROUTINE; +;ELSE IT IS ADDR OF AN ASCIZ STRING TO BE TYPED FOLLOWED BY THE TIME AND A CRLF. +SYALCP: TLNN I,40 + HRLI I,440700 ;SYSTEM ALL CONSOLES PRINT + MOVEI A,0 +SYALC1: PUSHJ P,SYSTSU + AOJA A,SYALC3 + TLNE I,40 + JRST SYALC5 + MOVE Q,I ;SO NOT TO MUNG I UNTIL END +SYALC2: ILDB E,Q + JUMPE E,SYALC4 ;JUMP IF DONE + .IOT STYOC,E ;COPY CHARACTER + JRST SYALC2 ;GO GET NEXT CHARACTER + +SYALC5: PUSH P,I + PUSH P,A + PUSHJ P,(I) + POP P,A + POP P,I +SYALC6: MOVSI E,%TACFM + IORM E,TTYSTA(A) ;DONT NEED CONSOLE FREE MSG ANY MORE + AOS A ;INCREMENT CONSOLE NUMBER +SYALC3: CAIGE A,NCT+IFN N11TYS,[1-N11TYS] ;IF MORE CONSOLES LEFT, + JRST SYALC1 ;THEN PRINT OUT ON NEXT ONE + JRST SYSCOP ;FINALLY RE-OPEN SYSTEM CONSOLE. + +SYALC4: PUSH P,[SYALC6] ;PUT TIME AT END OF MESSAGE + PUSH P,A ;IF WE KNOW WHAT TIME IT IS + PUSH P,B + PUSHJ P,GLPDTM + JRST POPBAJ + PUSH P,I + IRPC A,,[ AT] + .IOT STYOC,["A] ;PUT TIME IN UP/DOWN MESSAGES + TERMIN + PUSHJ P,SYSTPT + POP P,I + JRST POPBAJ + +SYSTSU: CONO PI,TTYOFF + MOVE T,TTYSTA(A) + TLZN T,%TACFM + JRST TTYONJ ;IN USE OR WILL GET CONSOLE FREE MSG => DON'T HACK IT + MOVEM T,TTYSTA(A) + CONO PI,TTYON + AOS (P) ;TTY NEEDS HACKING, SO SKIP. + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" THE CHANNEL. +SYSTS1: MOVE T,TTYOPT(A) + TLNN T,%TOIML + TLNN T,%TOMVU + POPJ P, ;IMLAC OR PRINTING TTY, DON'T CLEAR. + MOVEI T,^P + PUSHJ P,STYO + MOVEI T,"C + JRST STYO + + ;SYSTEM JOB RADIX PRINT-OUT ROUTINES + ;FULL WORD (TWO HALFWORD) OCTAL: +SYSFWP: TLNN A,-1 ;IF LH=0, + JRST SYSOPT ;THEN PRINT ONLY RH + LSHC A,-18. + HLLM B,(P) + PUSHJ P,SYSOPT + HLRZ A,(P) + MOVEI T,", ;",," BETWEEN HALFWORDS + PUSHJ P,STYO + PUSHJ P,STYO + + ;OCTAL PRINTOUT, NO LEADING ZEROS, HALFWORD MAXIMUM +SYSOPT: IDIVI A,10 + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSOPT +SYSRP2: HLRZ B,(P) ;ENTRY POINT FROM DECIMAL TYPEOUT ROUTINE +SYSRP1: MOVEI T,"0(B) ;" " " + JRST STYO + + ;DECIMAL PRINTOUT, COMMAS EVERY 3 DIGITS, FULLWORD MAXIMUM +SYSDPC: MOVE 0,A ;ROUTINE EXPECTS ARGUMENT IN A, CLOBBERS 0, A(=0+1), B(=A+1) +SYSDP5: IDIVI 0,1000. ;GET LEAST SIGNIFICANT 3 DIGITS IN A + JUMPE 0,SYSDPT ;PRINT HIGH ORDER DIGITS WITHOUT LEADING ZEROES + HRLM A,(P) + PUSHJ P,SYSDP5 + HLRZ A,(P) + MOVEI T,", ;SINCE 3*N DIGITS LEFT TO BE TYPED, N>0, + PUSHJ P,STYO ;PRINT OUT A COMMA + MOVEI T,3 ;NUMBER OF DIGITS TO PRINT OUT + ;ROUTINE TO PRINT OUT AS MANY DECIMAL DIGITS AS SPECIFIED IN T +SYSLZP: IDIVI A,10. + SOJLE T,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSLZP + JRST SYSRP2 + +;PRINT NUMBER IN A IN DECIMAL; CLOBBERS B, T. +SYSDPT: IDIVI A,10. + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSDPT + JRST SYSRP2 + +STYOQ: MOVEI T,"? ;TYPE OUT "?" + JRST STYO + +STYOT: SKIPA T,[11] ;TAB +STYOS: MOVEI T,40 ;TYPE OUT A SPACE +STYO: CONSO PI,200 ;PI ON? (SYSTEM UP) + JRST STYO1 + .IOT STYOC,T + POPJ P, + +;TYPE OUT DIRECTLY WHILE SYSTEM IS NOT RUNNING +STYO1: HRLM T,(P) + CAIN T,15 + SETZM T00POS + AOS T,T00POS + CAIL T,75. + PUSHJ P,SYSCRF + HLRZ T,(P) +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,T +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + ANDI T,177 ; ASCII for the 8080 + IORI T,400 ; Means a character is present + MOVEM T,8CTYOT + CONI T + IORI T,80INT + CONO (T) ; punch 8080 + SKIPE 8CTYOT ; wait for completion + JRST .-1 + HLRZ T,(P) ; God knows who might look at T... +] ;KS10P + POPJ P, + +;PRINT WORD IN I AS 12. OCTAL DIGITS. CLOBBERS J,T. +SYSP: MOVE J,[440300,,I] + MOVE I,T +SYSP1: ILDB T,J + ADDI T,"0 + PUSHJ P,STYO + TLNE J,770000 + JRST SYSP1 + POPJ P, + +SYSSP: HRLI I,440700 ;ENTRY TO TYPE C(I) AS A POINTER TO ASCIZ +SYSSP2: ILDB T,I + JUMPE T,CPOPJ + PUSHJ P,STYO + JRST SYSSP2 + +SYSTWR: LSH A,30-18. + ADDI A,(SIXBIT / :/) + MOVE I,[220600,,A] + JRST SYSIX2 +SYSSIX: PUSHJ P,STYOS ;TYPE A SPACE AND FALL IN +SYSIXP: MOVE I,[440600,,A] ;ENTRY TO TYPE OUT C(A) AS SIXBIT +SYSIX2: ILDB T,I + ADDI T,40 + PUSHJ P,STYO + TLNN I,770000 + POPJ P, + JRST SYSIX2 diff --git a/system/sysjob.116 b/system/sysjob.116 new file mode 100644 index 0000000..ede81f1 --- /dev/null +++ b/system/sysjob.116 @@ -0,0 +1,2805 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +SUBTTL DEMON JOB INTERFACE ROUTINES + ;GIVE STUFF TO DEMON JOB RUNNING IN USER MODE, WHICH THEN OUTPUTS + ;STUFF IN ITS OWN FORMAT TO THE DISK + ;COMMUNICATION IS VIA DMNBUF (BUFFER) AND POINTERS, + ;DEMON JOB FINDS IT BY LOOKING UP SYSTEM SYMS + + ;USAGE: + ;ROUTINES MUST BE CALLED WITH CLK OFF OR IN PROGRESS + ;FIRST CALL DMNP TO SET UP D AS "PDL POINTER" INTO DMNBF + ;DMNPSH ADR ;PUSH ADR INTO DMNBF (ASSEMBLES INTO A PUSH) + ;FIRST WORD PUSHED SHOULD HAVE ENTRY TYPE DESCRIPTOR IN HIGH SIX BITS + + ;ENTRY TYPE DESCRIPTORS: +DMNELI==10000 ;LOGIN (DMNPLI) +DMNELO==20000 ;LOGOUT (DMNPLO) + ;^ ADD MORE AS NEEDED, NEED NOT BE SYMBOLIC BUT PLEASE COMMENT THEM HERE FOR XREF + + ;DMNRS ;NORMALLIZE POINTER (DUE TO STANDARD LENGTH ENTRY IN TABLE) + ;ASSEMBLES INTO ONE STORAGE WORD + ;THEN CALL (PUSHJ) DMNRT WHICH STORES BACK D + ;ALL DMNPSH'S SHOULD BE ASSEMBLED BEFORE DMNRT; + ;ALL ROUTINES SHOULD BE BETWEEN THIS PAGE AND DMNBUF + +;DMNSZ (# ENTRIES IN DMNBF) DEFINED EARLY IN SYSTEM ENGLISH SO CAN BE CHANGED EASILY + +DMNFMT==2 ;ASCENDING FORMAT NUMBER, SHOULD BE INCREMENTED EACH TIME + ;A CHANGE IS MADE REQUIRING CHANGE IN CODING EITHER OF DEMON JOB + ;OR OF PROGRAMS READING ITS OUTPUT +;DMNFNT 1 -> 2 9/71 SWAPIN RQ INCLUDED W/LOGOUT + +DMNBAC==0 ;DMNPSH COUNTER, AFTER FIRST TIME GETS RE-INITIALIZED TO DMNBLM + +DEFINE DMNPSH ADR + DMNBAC==DMNBAC+1 + PUSH D,ADR +TERMIN + +IF1,DMNBEL==0 ;BECOMES LENGTH PER ENTRY IN DMNBF + +DEFINE DMNRS + ADDI D,DMNBEL-DMNBAC +IF1,IFG DMNBAC-DMNBEL,DMNBEL==DMNBAC +DMNBAC==DMNBLM +TERMIN + + ;PUSHJ P,DMNP ;SET UP D FOR DMNPSH'S INTO DMNBF + +DMNP: MOVE D,DMNBFP ;GET POINTER + CAIL D,DMNBFE-1 ;AT END OF BUFFER? + MOVEI D,DMNBF-1 ;YES, RE-INITIALIZE + AOS DMNBC ;INDICATE ENTRY ABOUT TO BE FILLED, SO DEMON KNOWS IF IT LOST +DMNP0: ;DMNP0 MAY BE CALLED IN USER MODE FROM DEMON JOB + DMNPSH TIME ;FIRST WORD IN BUFFER ALWAYS TIME OF ENTRY + ;^ MAYBE ADD MORE STANDARD PUSHES HERE + POPJ P, + +DMNBLM==DMNBAC ;NUMBER OF INITIAL WORDS PUSHED + + ;PUSHJ P,DMNRT (BUT USUALLY JRST DMNRT FOR RETURN) + ;DMNBF ENTRY COMPLETED, STORE BACK POINTERS + +DMNRT: TLZ D,-1 ;CLEAR OUT LEFT HALF OF POINTER + CAIL D,DMNBFE ;AFTER END OF BUFFER? + JRST 4,.+1 ;DMNBF POINTER INCREMENTED INCORRECTLY SOMEWHERE ALONG THE LINE + ;PROBABLY PROGRAMMER FORGOT TO DO DMNRS; CODING AFTER DMNBF MIGHT BE CLOBBERED + AOS DMNBD ;ENTRY COMPLETE, GIVE IT TO DEMON JOB + MOVEM D,DMNBFP + POPJ P, + + ;NOW FOR INDIVIDUAL ROUTINES + + ;LOGIN + +DMNPLI: PUSHJ P,DMNP ;SET UP + HRLI U,DMNELI ;INDICATE LOGIN + ;PUT FOLLOWING INTO DMNBF: + DMNPSH U ;INDEX OF USER BEING LOGGED IN + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME + DMNPSH JNAME(U) ;JNAME + DMNPSH TRMNAM(U) ;TERMINAL NAME + DMNPSH XUNAME(U) + DMNRS ;THAT'S ALL + JRST DMNRT + + ;LOGOUT + +DMNPLO: PUSHJ P,DMNP ;SET UP D + PUSHJ P,LOGUSE ;GET TREE'S USAGE IN T AND TT + HRLI U,DMNELO ;INDICATE LOGOUT + ;PUT FOLLOWING IN DMNBF FOR DEMON JOB TO DUMP OUT ON DISK: + DMNPSH U ;INDEX OF USER BEING LOGGED OUT + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME OF USER + DMNPSH JNAME(U) ;JNAME + DMNPSH TT ;TIME USED, IN 4.069 USEC UNITS + DMNPSH T ;# SWAPIN REQUESTS (THESE VALID SINCE LOGUSE ALREADY CALLED) + ;^ ADD MORE HERE + ADDM TT,LOUTIM ;COUNT UP TOTAL TIME USED BY ALL LOSERS + DMNRS + JRST DMNRT + +DMNPL0==CPOPJ ;DMNPL0 MAY BE CALLED FROM DEMON JOB IN USER MODE + ;IT IS NO LONGER POSSIBLE TO MAKE THIS WORK RIGHT, + ;SO WE JUST RETURN. PFTHMG DRAGON SHOULD BE FIXED. + +EBLK + ;DEMON VARIABLES, MUST FOLLOW CODING + ;USE CARE IN REDEFINING SYMBOLS ON THIS PAGE; DEMON JOB RUNNING IN USER MODE + ;LOOKS AT SOME OF THEM, EXCEPT AS INDICATED + +DMNBF: BLOCK DMNBEL*DMNSZ ;BUFFER +DMNBFE:: + +DMNBC: 0 ;ENTRY COUNT, INCREMENTED JUST BEFORE ENTRY ADDED TO DMNBF (USED BY DEMON) +DMNBD: 0 ;ENTRY COUNT, INCREMENTED JUST AFTER " " " +DMNBFP: DMNBF-1 ;POINTER INTO BUFFER, HAS ADR OF LAST WORD WRITTEN (NOT USED BY DEMON) +VSCLAU: 0 .SEE VSCLA1 ;LAST JOB TREE ACCOUNTING UPDATE DONE FOR + ;NO MORE CODING ALLOWED AFTER THIS POINT + +DEFINE DMNPSH A +INFORM DMNPSH AT .,\. +TERMIN + +DEFINE DMNRS +INFORM DMNRS AT .,\. +TERMIN + +BBLK + +SUBTTL "SYSTEM" JOBS + +IFN TPLP,[ +TPLI==11 ;PSEUDO LPT IN +PRTO==12 ;REAL LPT OUT +] +IFN DEMON,TPLI==11 ;FOR DEMON HACKER +IFN DEMON,TEMPC==16 ;FOR TESTING WHETHER DEMON FILE EXISTS. +STYOC==17 ;OUTPUT " + +;CODE FROM ICLR TO SCOR EXECUTED ONLY ONCE (SEE BEG) +ICLR: MOVE A,[GO,,GO+1] ;PICK UP BLT POINTER (COPY EXCH WORD INTO NEXT) + SETZM GO ;CLEAR FIRST WORD + BLT A,IEND ;CLEAR OUT INITIALIZING CODE (IN AREA TO BE USER VAR BLOCKS) + SKIPL CORRQ ;SKIP IF CORE RQ FOR SYSTEM'S SPACE PROCESSED + PUSHJ P,UFLS ;WAIT AS NECESSARY + PUSHJ P,SYSCOP ;"OPEN" SYSTEM CONSOLE CHANNEL +IFN CCLKP,[ + JRST .+3 ;JFCL FOR CHESS CLK MODE + PUSHJ P,CLQAD1 + CCLKB +];CCLKP +IFN IMPP,[ + MOVE A,TIME + MOVEM A,LNETIM + PUSHJ P,IMPINI +];IMPP + MOVEI A,IINTIC + MOVEM A,IINCNT +SCOR: MOVE P,SYSPDP + MOVE U,USER + CONO PI,CLKON + MOVE A,TIME + ADDI A,30.*60.*5 ;5 MINUTES BEFORE SHUTDOWN? + SKIPLE SHUTDN + CAMG A,SHUTDN + JRST .+3 + SKIPN SUSRS + JRST SYSOUT ;JUMP IF SYS DYING & NO ONE LOGGED IN + MOVE T,[.HANG] + MOVEM T,FORTY ;TELL PEEK WHAT OUR UFLS REALLY IS. + MOVE T,TIME + MOVEM T,SYSITM + SKIPN SUPCOR ;SKIP IF ANY BITS ON IN SUPCOR + PUSHJ P,UFLS ;HANG TILL A BIT ON +;SYS JOB IS HUNG IF SYSITM IS 30 SEC OLD AND PC ISN'T SCOR1. +SCOR1: MOVSI A,(SETZ) + MOVEI B,0 +SYSDP1: TDNE A,SUPCOR + JRST SYSDP2 +SYSDP3: LSH A,-1 + JUMPE A,SCOR + AOJA B,SYSDP1 + +SYSDP2: SKIPGE SYSDTB(B) ;SKIP UNLESS 4.9 BIT OF ENTRY ON + ANDCAM A,SUPCOR ;4.9 ON, CLEAR SUPCOR BIT + LDB C,[370200,,SYSDTB(B)] + TRNE C,2 ;IF ROUTINE IS GOING TO USE TTY, + PUSHJ P,WARMTTY ;THEN WARM IT UP FOR IT + TRNE C,1 + PUSHJ P,DINGTTY + LDB T,[420100,,SYSDTB(B)] ;GET 4.8 BIT + JUMPE T,@SYSDTB(B) ;IF 4.8 BIT = 0, JUMP TO ROUTINE + PUSH P,A ;4.8 .NE. 0, SAVE A + PUSH P,B ;SAVE B + PUSHJ P,@SYSDTB(B) ;CALL ROUTINE + POP P,B ;RESTORE B + POP P,A ;RESTORE A + LDB T,[410100,,SYSDTB(B)] ;GET 4.7 BIT + JUMPE T,SYSDP3 ;IF ZERO RETURN TO LOOP + ANDCAM A,SUPCOR ;NON-ZERO, CLEAR SUPCOR BIT + JRST SYSDP3 ;LOOP + +SUBTTL SUPCOR DISPATCH TABLE + +;DISPATCH TABLE FOR BITS IN SUPCOR +;4.9 = 1 TO CLEAR SUPCOR BIT BEFORE DISPATCHING +;4.8 = 0, JRST TO ROUTINE ; = 1, PUSHJ +;4.7 = 1 TO CLEAR SUPCOR BIT AFTER (ONLY USEFUL IF PUSHJ) +;4.6 WARM UP TELETYPE BEFORE CALL +;4.5 DING BEFORE CALL + +SCL==1,,525252 ;BIT TYPEOUT MASK FOR SUPCOR +SCR==525252 ; .. + +SYSDTB: +SCLEX==400000 ? 300000,,SYSEX ;INCREASE USER-VAR BLOCK SPACE. +SCLSHD==200000 ? 340000,,SYSSHD ;HANDLE .SHUTDN - PRINT "GOING DOWN" MESSAGES. +SCLOUT==100000 ? 400000,,SYSOUT ;TIME FOR SYSTEM TO GO DOWN. +IFE KS10P,[ 660000,,SYSCK5 ;CHECK FOR DEVICES GIVING SPURIOUS INTERRUPTS. + SCLCK5==040000] +IFN KS10P, 400000,,SYSDP3 +SCLDAT==020000 ? 600000,,DATIME ;CONTINUE TRYING TO DETERMINE DATE AND TIME. +SCLPAR==010000 ? 360000,,PARTYP ;PRINT "PARITY ERROR..." +SCLSET==004000 ? 340000,,SYSSET ;DEPOSIT IN SYSTEM (.SETLOC). +SCLIMP==002000 ? 600000,,SYSIMU ;PRINT "NETWORK UP ..." +SCLWRT==001000 ? 340000,,SYSWRT ;PRINT WRITING-ON-SYS: MESSAGE. +SCLLGI==000400 ? 340000,,SYSLGI ;PRINT LOGIN MESSAGE. +SCLDEC==000200 ? 300000,,SYSDEC ;DECREASE USER-VAR SPACE. +SCLVSK==000100 ? 600000,,VSCLK ;VERY SLOW (2 MINUTE) CLOCK. +SCLGUN==000040 ? 600000,,SYSGUN ;FLUSH TREES THAT ARE TRYING TO LOG OUT. +SCLNET==000020 ? 460000,,SYSNET ;BRING NCP DOWN AND UP. +IFN DEMON,[ 600000,,DEMCHK ;RUN ANY DEMONS WHICH NEED IT. + SCLDMN==000010] +IFE DEMON, 400000,,SYSDP3 +SCLNXM==000004 ? 360000,,NXMTYP ;PRINT "NON-EX MEM ERROR ..." +IFE KA10P,[ +SCLBPF==000002 ? 360000,,BPFTYP ;BAD PAGE FAIL +].ELSE 400000,,SYSDP3 +SCLIDK==000001 ? 600000,,ISYS ;DISK IS INITIALIZED +SCRTPP==400000 ? 600000,,TPLPRT ;TRANSFER DATA TO LPT (FROM TPL) +SCRTPC==200000 ? 600000,,VSCL6 ;SEE IF ANY FILES HAVE BEEN SPOOLED. + 400000,,SYSDP3 +SCRHNG==040000 ? 600000,,SYSDIL ;DIALUP LINE CONNECT OR DISCONNECT +SCRDET==020000 ? 600000,,SYSDT ;DETACH TOP-LEVEL JOBS WITH INTERRUPTS. +SCRCFM==010000 ? 600000,,SYSCFM ;PRINT CONSOLE FREE MSGS +SCRMSG==004000 ? 640000,,SYSMPR ;PRINT RANDOM SYSTEM MESSAG + REPEAT 5,400000,,SYSDP3 ;CAN BE SET BY USER (.SUPSET) +IFN N11TYS,[ 600000,,VWHO ;UPDATE WHO LINES (40) + SCRWHO==000040] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11D ;TV 11 GONE DOWN (20) + SCR11D==000020] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11U ;TV 11 COME UP, INIT IT (10) + SCR11U==000010] +.ELSE 400000,,SYSDP3 +IFE DEMON, 400000,,SYSDP3 ;(4) +IFN DEMON,[ 600000,,DMNOFF + SCRDMF==000004] +SCRTPF==000002 ? 300000,,TPLOFF ;BLOCK TPL. +SCRCKS==000001 ? 600000,,SYSCKS ;PERFORM CHECKSUMMING + +IFN .-SYSDTB-36.,.ERR SYS JOB DISPATCH + +SUBTTL DM DAEMON OVERSEER + +IFN DEMON,[ +DEMCHK: PUSHJ P,SYSDEX ;HANDLE REQUESTS TO KNOW WHETHER A FILE + ;EXISTS TO BE SIGNALLED AS A DEMON. + PUSHJ P,LSWTL ;SYSTEM JOB SIEZES DEMON TABLE SWITCH WITH UTCOFF + 400000,,DEMSW + MOVE B,DMLSEX + CAMN B,[-DMLNG,,0] ;IF AT BEGINNING OF TABLE SET FLAG + TDZA D,D + SETOM D +DMSCN9: SKIPE TT,DMTTBL(B) + SKIPE DMTTBL+1(B) ;ONLY PAY ATTENTION IF NOT DOWN + JRST DMSCN1 ;AND GUY THERE + MOVE T,DMTTBL+2(B) + HRRE C,T + TLNE T,-1 + JRST DMSCN3 + JUMPLE C,DMSC10 +DMSCN0: SKIPG DMNFLG + JRST DMSC11 ;IF FLAG SET CAN'T LOAD EM + CAME TT,[SIXBIT /UNSPOO/] + JRST DMSCN4 ;DON'T BOTHER WITH TPL STUFF, IF NOT TPL + SKIPGE TPLFLG + JRST DMSC10 ;REMOVE FROM WORLD + JRST DMSCN4 + +DMSCN4: HLRM T,DMTTBL+3(B) ;SET UP IMPLICIT REQUEST + CONO PI,UTCON ;ATTEMPT LOAD HERE + MOVE T,DMTTBL(B) + MOVEM T,DMOBLK+2 ;CHECK TO SEE IF FILE EXITS + .IOPUSH TPLI, + .OPEN TPLI,DMOBLK ;DON'T WORRY CAN'T PCLSR + JRST DMSCN5 ;OPEN FAILURE + .IOPOP TPLI, ;GET BACK STUFF + HRROI T,DMTTBL(B) + PUSHJ P,NUJBST ;TRY TO LOAD + JRST DMSCN6 ;COME BACK LATER, NO ENTRY FOR THIS GUY. +DMSCN8: ADD B,[DMTLL,,DMTLL] + SKIPL B + MOVSI B,-DMLNG + MOVEM B,DMLSEX ;FIX UP TABLE +DMSCN7: MOVSI B,SCLDMN + IORM B,SUPCOP ;IF MORE REQUESTS, RUN AGAIN IN 1 SECOND. + SOSLE REQCNT ;NO MORE REQUESTS => + JRST LSWPOP + SETZM REQCNT + ANDCAM B,SUPCOP ;DON'T RUN AGAIN. + ANDCAM B,SUPCOR ;THEN CLEAR OUT SUPCOR BIT + JRST LSWPOP + + +DMSCN5: .IOPOP TPLI, ;FILE DOESN'T EXIST + CONO PI,UTCOFF +DMSC10: PUSHJ P,DEMMRV ;REMOVE DEAMON + JRST DMSCN8 ;AND REQUEST + +DMSCN3: JUMPG C,DMSCN0 ;LOAD + JRST DMSCN1 + +DMSCN2: CONO PI,UTCON ;CONTINUE AROUND LOOP + ADD B,[DMTLL,,DMTLL] +DMSCN6: MOVEM B,DMLSEX + JRST LSWPOP ;COME BACK LATTER WITHOUT FLUSHING REQ + +DMSCN1: ADD B,[DMTLL,,DMTLL] ;ADD ON VAL + JUMPL B,DMSCN9 ;CONTINUE AROUND LOOP + MOVSI B,-DMLNG + MOVEM B,DMLSEX + JUMPE D,UTOLKJ +DMSC11: SETZM REQCNT ;IF RAN THROUGH WHOLE TABLE WITHOUT ANY PROCESS + CONO PI,UTCON + JRST DMSCN7 ;FLUSH ALL REQUESTS AND RETURN + +DMNOFF: MOVNS TT,DMNFLG + JUMPLE TT,DMNOF1 ;DEAMONS OFF + PUSHJ P,LSWTL + DEMSW +DMNOF3: SKIPE DMTTBL(B) + SKIPE DMTTBL+1(B) + JRST DMNOF2 + AOS REQCNT +DMNOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,DMNOF3 + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST LSWPOP + +DMNOF1: MOVSI B,SCLDMN + ANDCAM B,SUPCOR + SETZM REQCNT ;ZERO COUNT + POPJ P, + +;CALL HERE TO HANDLE ALL JOBS THAT ARE WAITING IN .DEMSIG TO +;BE TOLD WHETHER A PURPORTED DEMON REALLY EXISTS. GIVE THEM +;THEIR ANSWERS AND START THEM UP AGAIN. +SYSDEX: SETZ A, + MOVEI C,'SYS + MOVE D,['ATSIGN] +SYSDE1: CONO PI,CLKOFF + SKIPN SRN3(A) ;THIS JOB'S ALREADY BEEN SERVICED?^ + SKIPN UNAME(A) ;OR DOESN'T REALLY EXIST? + JRST SYSDE3 + MOVE B,UPC(A) ;IS IT WAITING FOR SERVICE FROM US? + XORI B,ADEMS1 ;MUST BE IN EXEC MODE AT THE RIGHT PLACE. + TDNE B,[%PCUSR,,-1] + JRST SYSDE3 + MOVE E,AC0S+A(A) ;GET THE FN2 IT WANTS TO CHECK. + CONO PI,CLKON + SETZ T, ;T GETS 0 IFF FILE CAN BE OPENED. + .OPEN TEMPC,C + CAIA + JRST SYSDE2 + LDB T,[220600,,IOCHST+TEMPC] + SKIPN T + MOVEI T,%ENSFL +SYSDE2: .CLOSE TEMPC, + CONO PI,CLKOFF + SKIPN UNAME(A) ;SEE IF JOB IS STILL WAITING FOR SERVICE + JRST SYSDE3 ;SO IT ISN'T CLOBBERED IF IT GOT AN + MOVE B,UPC(A) ;INTERRUPT AND IS DOING SOMETHING ELSE. + XORI B,ADEMS1 + TDNN B,[%PCUSR,,-1] + CAME E,AC0S+A(A) + JRST SYSDE3 + MOVEM T,AC0S+T(A) ;GIVE THE JOB ITS ANSWER IN T, AND + SETOM SRN3(A) ;TELL THE JOB IT HAS BEEN SERVED. +SYSDE3: CONO PI,CLKON + ADDI A,LUBLK + CAMGE A,USRHI + JRST SYSDE1 + POPJ P, +];DEMON + +SUBTTL VERY SLOW CLOCK + +;SUBROUTINES CALLED BY THE VERY SLOW CLOCK. + +;CHECK FOR DEMON REQUESTS WHOSE TIME HAS COME. +IFN DEMON,[ +VSCLDM: PUSHJ P,LSWTL + DEMSW + MOVSI B,-DMLNG +VSCLD2: SKIPG DMTTBL+3(B) ;IF SPECIFIC ENTRY IS < = O, IGNORE + JRST VSCLD1 + SOSE DMTTBL+3(B) + JRST VSCLD1 + HLRZ T,DMTTBL+2(B) ;SIGNAL DEAMON + MOVEM T,DMTTBL+3(B) + MOVE A,DMTTBL(B) + PUSHJ P,DEMSIG ;SIGNAL REQUEST FOR THIS GUY + BUG ;ENTRY IN TABLE NOT FOUND EVEN THOUGH NON ZERO TIME +VSCLD1: ADD B,[DMTLL,,DMTLL] + JUMPL B,VSCLD2 + JRST LSWPOP +] + +;CHECK FOR CLOBBERED TEN-11 INTERFACE CONTROL PAGE WORDS, +;AND RESET THEM TO THEIR CORRECT SETTINGS. +IFN TEN11P,[ +T11CK: SKIPE TEN11F + POPJ P, + MOVSI I,-256. +T11CKL: MOVE A,T11MP(I) + CAMN A,[-1] + MOVEI A,0 ;HARDWARE SHOULD BE 0 ON CONFLICT PAGE + TLZ A,174000 ;USAGE COUNT + MOVE B,400000+T11CP*2000(I) + CAME A,B + JRST T11ERR +T11CL1: AOBJN I,T11CKL + POPJ P, + +T11ERR: AOS T11ERC + MOVEM A,400000+T11CP*2000(I) + MOVEM A,T11CCN + MOVEM B,T11WCN + MOVEM I,T11PG + JRST T11CL1 +] + +;VERY SLOW CLOCK (EVERY 2 MIN). SIGNALLED BY SCLVSK, SET BY A CLOCK-QUEUE ENTRY. +;CALLS THE ULTRA-SLOW CLOCK (EVERY 2 HOURS) WHEN IT'S TIME. + +VSCLK:;JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES (WOULD BE NICE, BUT BUGS...) +IFN DEMON,PUSHJ P,VSCLDM ;DEAMON SLOW CLOCK BREAK ROUTINE +IFN TEN11P,PUSHJ P,T11CK + MOVE U,VSCLAU ;ACCOUNTING UPDATE, FIND A JOB TREE +VSCLA1: ADDI U,LUBLK + CAML U,USRHI + MOVEI U,0 + SKIPE UNAME(U) + SKIPL SUPPRO(U) + JRST VSCLA1 + HRLO TT,UNAME(U) + AOJE TT,VSCLA1 ;DON'T IF NOT LOGGED IN YET + MOVEM U,VSCLAU + CONO PI,CLKOFF + PUSHJ P,LOGUPD + PUSHJ P,DMNPLI + CONO PI,CLKON + MOVE U,USER + SKIPLE CTLCNT ;Time to print date on console log? + JRST VSCLA2 ; No. + PUSHJ P,GLPDTM ;Yes - get localized pdtime. + JRST VSCLA2 ; Can't print time if we don't know it. + PUSHJ P,WARMTTY ;Warm up tty, newline. + PUSHJ P,DATIM6 ;Print what time it is now. + MOVEI TT,CTLMAX ;Restart countdown of lines printed. + MOVEM TT,CTLCNT +VSCLA2: PUSHJ P,VSCOLD ;CHECK FOR OLD DETACHED TREES TO BE KILLED + PUSHJ P,TTTMNT ;TURN OFF MOTORS OF IDLE TERMINETS. +VSCL7: SETOM UFDFLF ;CAUSE CORE JOB TO TRY TO FLUSH 2311 UFDS + AOS NCORRQ + MOVSI I,-NCLCH ;LOOK FOR UNOPEND CORE LINK BUFFERS THAT HAVE BEEN + PUSHJ P,SWTL ;AROUND FOR MORE THAN 2 MINUTES + CLOSW +VSCLCL: SKIPE CLSYN(I) ;SKIP IF VARS UNUSED + SKIPL A,CLUSR(I) + JRST VSCLC2 + AOJN A,VSCLC2 ;JUMP IF OPEN + MOVE TT,CLRAC(I) + TLOE TT,200000 + JRST VSCLCR ;BIT ALREADY ON, BUFFER OLD + MOVEM TT,CLRAC(I) +VSCLC2: AOBJN I,VSCLCL ;LOOP FOR ALL SETS OF VARIABLES + PUSHJ P,LSWPOP ;RELEASE SWITCH + + MOVE A,UTTBF ;IF MANY 200-WORD BUFFERS ARE FREE, + CAIGE A,8 + JRST .+3 + SETOM UTBFLF ;HAVE THE CORE JOB FLUSH THEM + AOS NCORRQ + +IFN IMPP,[ + SKIPGE IMPUP ;SKIP IF IMP UP, OR PERMANENTLY DOWN + PUSHJ P,SYSIMU ;TRY TO BRING IT UP +];IMPP +IFN TPLP,PUSHJ P,VSCL6 ;MAYBE START PRINTING FROM .LPTR. +IFN NLPTP,[ + SKIPL NLUSR ;IF LPT ISN'T IN USE, + JRST VSCNL1 + AOS TT,NLFREE ;KEEP TRACK OF HOW LONG THAT'S BEEN SO. + SOJN TT,VSCNL1 ;IF TRUE FOR >=2 VSCLK INTREVALS (4 MIN) + CONO NLPT,1000 ;TURN LPT MOTOR OFF: 1ST PUT LPT IN IMAGE MODE + DATAO NLPT,[.BYTE 7 ? 24 ? 177 ? 177 ? 177 ? 177] ;THEN TURN OFF. +VSCNL1:] + SOSLE IINCNT + POPJ P, + +;IT'S TIME FOR THE ULTRA-SLOW CLOCK + MOVEI A,IINTIC ;GET HERE EVERY TWO HOURS OR SO + MOVEM A,IINCNT + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + PUSHJ P,WARMTTY + JRST DATIM6 ;TIME KNOWN, TELL SYSTEM CONSOLE + +VSCLCR: HRRZ A,TT + PUSHJ P,BRTN ;RETURN BUFFER + SETZM CLSYN(I) ;FREE VARIABLES + JRST VSCLC2 + +;CHECK FOR TREES WITH BUMRTL SET THAT HAVE NOT RUN FOR +;A WHOLE HOUR, AND GUN THEM. +VSCOLD: SETZB U,J + CONO PI,CLKOFF + MOVSI B,BUMRTL + MOVSI C,BULGOS + MOVE A,TIME + SUBI A,60.*60.*30. ;1 HOUR AGO +VSCOL0: SKIPE UNAME(J) + TDNN B,APRC(J) + JRST VSCOL1 ;JOB NON EX OR DOSN'T HAVE BUMRTL + SKIPGE SUPPRO(J) ;NO GOOD IF NOT TOP LEVEL. + TDNE C,APRC(J) ;IGNORE JOBS THAT ARE ALREADY LOGGING OUT. + JRST VSCOL1 + CAML A,LUBTM(J) ;NOT RUNNING AND HASN'T RUN FOR 1 HOUR => GUN. + JRST VSCOL2 +VSCOL1: ADDI J,LUBLK ;KEEP LOOKING TILL FIND JOB THAT NEEDS GUNING. + CAMGE J,USRHI + JRST VSCOL0 + JRST CLKONJ ;NO TREES NEED TO BE GUNNED. + +VSCOL2: MOVEI I,[ASCIZ /KILLED HOUR-OLD DETACHED JOB, # /] + PUSHJ P,SYSJEX ;PRINT MESSAGE AFTER CALLING ALOGO6 + PUSHJ P,ALOGO6 + JRST VSCOLD ;LOOK FOR ANOTHER TREE TO GUN. + +; MOVEI I,[ASCIZ/DID FOO TO JOB # /] +; PUSHJ P,SYSJEX +; PUSHJ P,FOO +;DOES FOO TO THE JOB WITH IDX IN J, AND PRINTS A SYSTEM MSG. +;FOO WILL FIND THE USR IDX IN A AND J. IT IS OK TO ENTER +;SYSJEX WITH CLOCK OFF BUT FOO MUST TURN IT ON. +SYSJEX: HRRZS A,J + PUSH P,JNAME(A) + PUSH P,UNAME(A) + PUSH P,A ;SAVE ALL THE INFO WE NEED FOR THE MESSAGE. + PUSH P,I + XCT @-4(P) ;DO "FOO" + JFCL ;LET FOO SKIP. + AOS -4(P) ;SKIP OVER THE PUSHJ TO FOO. + PUSHJ P,WARMTTY + HRRZ I,(P) + PUSHJ P,SYSSP ;PRINT THE STRING IN I + POP P,I + HLRZS I + SKIPE I + PUSHJ P,(I) ;IF LH(I) WAS NONZERO, CALL THAT PRINT ROUTINE + POP P,A + IDIVI A,LUBLK + PUSHJ P,SYSOPT ;PRINT THE JOB # + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + POP P,A + PUSHJ P,SYSIXP ;PRINT UNAME, AND SPACE + PUSHJ P,STYOS + POP P,A + PUSHJ P,SYSIXP ;PRINT JNAME + JRST SYSTCR ;SPACE, TIME AND CR. + +SUBTTL TPL + +VSCL6: ;CHECK TPL: SEE IF LPT FREE AND ANY FILE TO PRINT. +IFN UNSPLP,[ + PUSHJ P,LSWTL + DEMSW + MOVE A,[SIXBIT /UNSPOO/] + PUSHJ P,DEMSIG + JRST LSWPOP ;REQUEST FAILED, TOO BAD + JRST LSWPOP +] + +IFE TPLP,POPJ P, +IFN TPLP,[ + MOVEI A,SCRTPP ;ALSO ENTER HERE FOR TPL CHECK + TDNE A,SUPCOR ;SKIP IF NOT ALREADY PRINTING FILE + POPJ P, + IFG LPTP-1,[ + SKIPE TPLSWP + JRST VSCL6A + SKIPLE NLPTBR + SKIPL LPTUSR + POPJ P, +VSCL6B: + ] + IFLE LPTP-1,[ + SKIPL LPTUSR + POPJ P, + ] + IFG OLPTP-NLPTP,[ + MOVEI A,132. + CAMLE A,LPTCC + POPJ P, + ] + IFG NLPTP-OLPTP,[ + CONSO NLPT,207 + SKIPG NLPTBR + POPJ P, ;.OPEN OF LPT WOULD HANG + ] + MOVEI A,SCRTPF + TDNE A,SUPCOR ;BLOCKED + POPJ P, + .OPEN TPLI,[SIXBIT / TPL.FILE.(DIR)/] ;MAKE SURE FILE DIR IN CORE + JRST VSCLX1 + MOVEI B,2 +VSCL2: .IOT TPLI,A + CAIE A,^C + CAIN A,12 + SOJG B,VSCL2 + JUMPN B,VSCL2 + SETOB I,C + SETZM TPLFN1 + SETZM TPLFN2 + MOVEI B,TPLFN1 + HRLI B,440600 +VSCL2A: .IOT TPLI,A + CAIN A,"* + JUMPL I,VSCL4 + CAIE A,^C + CAIN A,14 + JRST VSCLX1 + CAIN A,40 + JUMPL I,VSCL2A ;IGNORE SPACES BEFORE THE PACK NUMBER. + CAIN I,3 ;AFTER 4 CHARS STARTING WITH BEGINNING OF PACK NUMBER + JRST VSCL2E ;COMES THE START OF THE FN1. + CAIN A,"L + MOVEI C,0 ;INDICATE LINK + AOJA I,VSCL2A ;FIRST NON SPACE CRUFTY + +IFG LPTP-1,[ +VSCL6A: MOVEI A,132. + CAMG A,LPTCC + SKIPL OLPUSR + POPJ P, + JRST VSCL6B +] + +VSCL2E: MOVEI TT,6 +VSCL2B: SUBI A,40 + IDPB A,B + .IOT TPLI,A + SOJG TT,VSCL2B + MOVE B,[440600,,TPLFN2] +VSCL2C: .IOT TPLI,A + SUBI A,40 + IDPB A,B + TLNE B,770000 + JRST VSCL2C + .IOPUSH TPLI, + .OPEN TPLI,TPLFN + JRST VSCLL1 ;TRY AGAIN + .IOPOP PRTO, + .CLOSE PRTO, +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST VSCL3A +] + CONSZ NLPT,207 + JRST VSCLX1 + MOVEI T,LPTBSZ + CAMN T,NLPTBR ;SKIP ON OPEN WOULD HANG + .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +IFN OLPTP,[ + JRST VSCL3B +VSCL3A: +]] +IFN OLPTP,[ + MOVEI A,132. + CAMG A,LPTCC ;SKIP IF .OPEN WOULD HANG +IFN NLPTP,.OPEN PRTO,[3,,'OLP] +.ELSE .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +VSCL3B: +] + MOVEI A,SCRTPP + IORM A,SUPCOR ;PRINT THIS FILE + IORM A,SUPCOP ;PRINT MORE EVERY SECOND. + JRST TPLPRT + +VSCLL1: .IOPOP TPLI, + JUMPL C,VSCLX1 + MOVEI B,1 ;LINK THAT DIDN'T EXIST + JRST VSCL2 +] + +IFN TPLP,[ +;COME HERE TO TRANSFER SOME CHARS FROM DSK TO LPT, +;ASSUMING BOTH CHNLS ALREADY OPEN. +TPLPRT: +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST TPLPR3 +] + MOVEI A,TPLBSZ + CAMLE A,NLPTBR + POPJ P, +IFN OLPTP,[ + JRST TPLPR5 +TPLPR3: +]] +IFN OLPTP,[ + MOVEI A,10.*TPLBSZ ;LEAVE SPACE FOR CHARS THAT TAKE MORE THAN 1 CHAR + CAMLE A,LPTCC + POPJ P, +TPLPR5: +] + MOVE A,[-TPLBSZ,,TPLBUF] ;"UN-RELOCATE" + .IOT TPLI,A + MOVE B,A + MOVNI A,-TPLBUF(A) + HRLZS A + JUMPE A,TPLPR1 ;JUMP ON END OF FILE + HRRI A,TPLBUF + .IOT PRTO,A + JUMPL B,TPLPR1 ;LAST BUFFER-FULL PRINTED + JRST TPLPRT + +TPLPR4: CLEARM TPLFN3 + .FDELE TPLFN ;DELETE FILE JUST PRINTED + JFCL + MOVEI A,SCRTPP + ANDCAM A,SUPCOP ;DON'T NEED TO CALL TPLPRT EVERY SECOND. + ANDCAM A,SUPCOR +VSCLX1: .CLOSE PRTO, + .CLOSE TPLI, + POPJ P, + +VSCL4: .IOT TPLI,A + CAIN A,14 + JRST VSCLX1 + CAIN A,12 + JRST VSCL2A + JRST VSCL4 + +TPLPR1: PUSHJ P,TPLPR4 + JRST VSCL6 +] +.ELSE TPLPRT==CPOPJ + +;HANDLE A USER'S REQUEST TO "BLOCK THE TPL" +IFN TPLP,[ +;IF SYS JOB IS SPOOLING, JUST THROW AWAY CURRENT FILE. +TPLOFF: MOVEI A,SCRTPP + TDZN A,SUPCOP + POPJ P, ;NOTHING HAPPENING + PUSHJ P,WARMTTY + .RESET PRTO, + PUSHJ P,TPLPR4 + MOVE A,[SIXBIT /TPLOFF/] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +IFE TPLP+UNSPLP,TPLOFF==CPOPJ + +IFN UNSPLP,[ +TPLOFF: MOVNS B,TPLFLG + JUMPG B,VSCL6 ;IF NOW RUNNING GIVE REQ + MOVSI B,-DMLNG +TPLOF1: SKIPE C,DMTTBL(B) + SKIPG D,DMTTBL+1(B) ;USER INDEX -0 IF NOT YET LOADED + JRST TPLOF2 + CAME C,[SIXBIT /UNSPOO/] + JRST TPLOF2 + PUSH P,U + MOVE U,D + PUSHJ P,ALOGOUT ;DOES ONE USTOP FOR YOU + POP P,U + JRST TPLOF3 + +TPLOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,TPLOF1 +TPLOF3: PUSHJ P,WARMTTY + MOVE A,[SIXBIT /TPLOFF/ ] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +SUBTTL WHO LINES + +IFN N11TYS,[ +;PDP11 COMM AREA (SYSTEM WIDE) +;STARTS AT PDP11 ADDRESS 40 +;PNTR TO TT11HD +;PNTR TO POINTA +;I/O VERSION # +;SORCE FILE VERSION # +;--PDP10 WD BOARDARY-- 0 , INITED +; 0 , GODOWN + +;AT POINTA: +; ADDR OF SYSTEM WHO-LINE VARS +; ADDR OF 10-11 COMMAND BUFFER +; TENWHO , 0 ;PDP10 SETS TO TELL PDP11 TO UPDATE WHO-LINES +; MAXTV , 0 ;MAXTV = # TV'S 11 IS SET UP TO HANDLE +; NF11TY , 0 ;10 TELLS 11 WHAT TTY # OF 1ST BUFFER IS. + +;PDP11 CONSOLE VARS +; EVEN PDP11 WORD ODD PDP11 WORD +;TT11HD - CHAIN OF ACTIVE INPUT BUFFERS 0 +; PNTR TO OUTPUT BUFFER CHNL 0 VIDEO BUFFER,KBD # (377 IF NONE) +; " CHNL 1 " +;... +; OUTPUT BFR EMPTY NOTIFY RQ FLAG TO FREE CHNL +;... +; PNTR TO WHO LINE BLOCK FREE + +;THE 11 HAS COME UP, SO INIT COMMUNICATION VARIABLES AND START USING IT +SYS11U: SKIPG TT11P + POPJ P, + LDB A,[$11AD0,,TT11HA] ;GET PDP10 ADDRESS OF INPUT-BFR-CHAIN PTR + CAIL A,NTTPG*2000 + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + ADDI A,TT11LO + CONO PI,TTYOFF + MOVEM A,TT11HD ;SAVE IT FOR CLOCK LVL TO CHECK. + LDB C,[$11WD0,,TT11HA+1] ;GET PDP11 IO VERSION #. + MOVEI B,12. ;OLD TV PROGRAMS HANDLE 12. BUFFERS + LDB T,[$11AD1,,TT11HA] ;GET ADDR OF POINTA + CAIL C,3 ;VERSION 3 AND UP TV PGM HAS MAXTV - READ IT + LDB B,[$11WD0,,TT11LO+2(T)] + MOVEM B,TT1111 ;THAT'S HOW MANY TV'S THE 11 THINKS TERE ARE + CAIL B,N11TYS + MOVEI B,N11TYS ;MIN OF THAT AND # TEN THINKS THERE ARE + MOVEM B,TT11RL + MOVEI B,NF11TY + CAIL C,3 ;VERSION 3 TV PGM AND UP WANTS NF11TY + DPB B,[$11WD0,,TT11LO+3(T)] + HRLZ I,TT11RL ;GET AOBJN -> TV'S BOTH 10 AND 11 WILL HANDLE. + MOVNS I +VSCL7C: LDB B,[$11AD0,,1(A)] ;GET DPY BUFFER ADRESS FOR THIS TTY + ADDI B,TT11LO+2 ;CONVERT TO PDP10 ADDRESS. + HRLI B,040000+TT11BY_6 ;GET BP TO ILDB 1ST DATA WORD. + MOVEM B,NF11TY+TOBBP(I) ;PNTR TO BEG OF OUTPUT BUFFER + LDB C,[$11AD0,,(B)] ;GET # BYTES IN DATA AREA + ADDI B,(C) ;GET BP TO LAST WORD IN AREA + MOVEM B,NF11TY+TOBEP(I) + MOVEM B,NF11TY+TOIP(I) + ADDI A,1 + AOBJN I,VSCL7C + MOVEM C,TT11OL ;REMEMBER LENGTH OF OUTPUT BUFFERS. + SETOM TT11P ;TV TTYS NOW UP. + CONO PI,TTYON + MOVE A,[-N11TYS,,NF11TY] + MOVSI B,%TACFM ;NOW SAY ALL PDP11 TTYS NEED + ANDCAM B,TTYSTA(A) ;CONSOLE FREE MESSAGES, + AOBJN A,.-1 + MOVEI A,SCRCFM + IORM A,SUPCOR ;TELL SYS JOB TO PRINT THEM. + PUSHJ P,CLQAD1 ;ADD WHO LINE BLOCK TO CLOCK QUEUE IF NOT THERE + WHOCLB + MOVEI I,[ASCIZ /TV 11 IS UP -/] + JRST SYSSTD ;STRING,SPACE TIME AND DATE THEN CR +] + +IFN N11TYS,[ + +$INSRT WHOVAR + +;UPDATE WHO-LINE VARIABLES. +VWHO: SKIPL TT11P ;DON'T SCREW UP IF PDP11 ISN'T UP. + POPJ P, + MOVE A,TT11HD + HRLZ A,TT11RL + MOVNS A + HRR A,TT11HD ;-<# TV'S BEING USED>,,
+ ADD A,TT1111 + ADD A,TT1111 ;NOW RH -> 2 11-WDS BEFORE PTR TO WHOLINE VARS OF 1ST TV +VWHO1: LDB B,[$11AD0,,1(A)] ;GET WHO LINE VAR PDP11-ADDR, SHIFTED 2. + ADDI B,TT11LO ;CONVERT TO PDP10 ADDRESS. + CONO PI,TTYOFF + MOVE TT,WHJOB(B) ;JOB # (SHIFTED 4+16.) + MOVE C,WHMODE(B) ;MODE (SHIFTED 4+16.) + JUMPG C,VWHO3 + CONO PI,TTYON + JUMPL C,VWHO2 ;MODE < 0 => NO WHOLINE. + HLRE I,A ;GET -<# TIMES REMAINING THRU LOOP> + ADD I,TT11RL + HRRZ TT,TTYSTS+NF11TY(I) ;MODE 0, USE JOB WHICH HAS THE TTY. + MOVE Q,TT + IDIVI Q,LUBLK + LSH Q,4.+16. + MOVEM Q,WHJOB(B) +;FOR OTHER MODES, COME BACK HERE, WITH USER IDX IN TT. +VWHO3R: CONO PI,CLKOFF + MOVE C,UNAME(TT) + HLLZM C,WHUNAM(B) + HRLZM C,WHUNM2(B) ;STORE THE JOB'S UNAME + MOVE C,JNAME(TT) + HLLZM C,WHJNAM(B) + HRLZM C,WHJNM2(B) ;AND JNAME. + MOVE C,USYSNM(TT) + HLLZM C,WHSNAM(B) + HRLZM C,WHSNM2(B) ;AND SNAME. + MOVE C,[SIXBIT /STOP/] + SKIPE USTP(TT) ;AND "STATUS": IF NOT RUNNABLE, "STOP". + JRST VWHO4 + MOVE C,[SIXBIT /RUN/] ;IF NOT WAITING, "RUN". + SKIPN FLSINS(TT) + JRST VWHO4A + MOVE C,[SIXBIT /PAGE/] ;DETECT WAITING FOR PAGE. + MOVE Q,USWST(TT) + TLNE Q,200000 + JRST VWHO4 + JRST VWHO4B + +VWHO4A: MOVE E,UPC(TT) ;JOB RUNNING: USER MODE? + TLNE E,%PCUSR ;IF SO, STATUS IS "RUN" (C ALREADY SET UP) + JRST VWHO4 +VWHO4B: MOVE E,SV40(TT) ;ELSE DECODE SYSTEM CALL TO GET STATUS. + HLRZ Q,E + CAIN Q,(.CALL) + JRST VWHO4D ;SYMBOLIC SYSTEM CALL. + TRZ Q,17_5 + MOVE I,OPTION(TT) + TLNN I,%OPDEC + JRST VWHO4E + CAIE Q,40_9 + CAIN Q,41_9 + JRST VWHO4F + CAIN Q,47_9 + JRST VWHO4F +VWHO4E: CAIN Q,(.IOT) ;.IOT => DECODE DEVICE IN USE. + JRST VWHOI1 + CAIN Q,(.OPER) + JRST VWHOO1 ;.OPER => DECODE ADDRESS FIELD. + CAIN Q,(.CALL) + JRST VWHOC1 ;.CALL BUT NOT SYMBOLIC => DECODE AC FIELD. + LSH Q,-9 + CAIL Q,40 + CAIL Q,40+NUUOSX +VWHO4F: SKIPA C,[SIXBIT /UUO/] ;UNRECOGNIZED UUO. + MOVE C,UUOSXB-40(Q) ;ELSE GET SIXBIT NAME OF UUO. + JRST VWHO4C + +;A SYMBOLIC SYSTEM CALL IS IN PROGRESS. +VWHO4D: MOVE C,LSCALL(TT) ;USE SYSTEM CALL NAME AS STATUS + CAME C,[SIXBIT /SIOT/] + CAMN C,[SIXBIT /IOT/] + JRST VWHOI2 ;BUT IF IT'S "IOT", DECODE DEVICE TYPE. +VWHO4C: SKIPE FLSINS(TT) + JRST VWHO4 + LSH C,-6 + TLO C,'+_12. ;STICK "+" ON FRONT IF RUNNING IN SYSTEM +;DROPS THROUGH ;(NOT IF IN USER MODE, OR IF HUNG). + ;DROPS IN +;COME HERE WITH STATUS AS SIXBIT IN C. +VWHO4: +IFE SWPWSP, SKIPL USWSCD(TT) ;SKIP IF SWAP-BLOCKED +IFN SWPWSP,[ MOVE Q,USWST(TT) + TLNN Q,%SWSB +] + JRST .+3 + LSH C,-6 + TLO C,(SIXBIT/>/) + HLLZM C,WHSTAT(B) + HRLZM C,WHSTA2(B) + MOVEI C,WHJ%RT(B) + HRLI C,442000 + MOVE Q,JTMU(TT) ;COMPUTE % RUN TIME FROM SCHEDULER PRIORITY. + MULI Q,100. + DIV Q,[2.^6] + IDPB Q,C + MOVE Q,UTRNTM(TT) + IDIVI Q,25000. + IDPB Q,C ;JOB RUNTIME IN .1 SEC UNITS. + MOVE Q,NMPGS(TT) + MOVE I,NSWPGS(TT) + SUBM Q,I + IDPB I,C ;JOB # REAL PAGES. + IDPB Q,C ;JOB # VIRTUAL PAGES. +;HANDLE THE USER-SPECIFIED FIELDS IN THE WHOLINE. + MOVE Q,UWHO1(TT) + ANDCMI Q,17 + MOVEM Q,1(C) ;STORE JOB'S WHOLINE FLAGS. + MOVE Q,UWHO2(TT) + HLLZM Q,2(C) ;STORE FIRST USER WHO VAR + HRLZM Q,3(C) + MOVE Q,UWHO3(TT) + HLLZM Q,4(C) ;STORE SECOND USER WHO VAR + HRLZM Q,5(C) +VWHO2: CONO PI,CLKON + AOBJN A,VWHO1 + JRST VWSYS + +VWHOO1: HRRZ Q,E ;JOB EXECUTING .OPER. + CAIL Q,MXOPR + SKIPA C,[SIXBIT/UUO/] + MOVE C,OPRSXB(Q) ;GET .OPER NAME AS STATUS + JRST VWHO4C + +VWHOI2: SKIPL Q,UUAC(TT) ;NEW SYS CALL IOT + JRST VWHO4C ;GETTING ARGUMENTS, UUAC NOT SET UP YET + MOVE I,C ;SAVE NAME IN I + JRST VWHOI4 + +VWHOI1: LDB Q,[270400,,E] ;.IOT + SETZ I, +VWHOI4: ADDI Q,IOCHNM(TT) ;Q HAS IOCHNM WORD ADDR FOR CHANNEL. + MOVE Q,(Q) ;GET IOCHNM WORD CONTENTS (RH INDEXES TABLES) + HLRZ C,Q + HLL Q,IOTTB(Q) ;LH GETS BITS SAYING DIRECTION, BLOCK VS UNIT. + HLL C,CLSTB(Q) + TLNE C,%CLSJ ;IF JOB DEVICE + JRST [ MOVE C,JBDEV(C) ;GET NAME OF SIMULATED DEVICE + JRST VWHOI6 ] + HLLZ C,DCHSTB(Q) ;C GETS DEVICE NAME (LEFT-JUST SIXBIT) + JUMPL C,VWHOI6 ;JUMP IF NORMAL 3-CHARACTER NAME + MOVSS C ;NO, IS ADDRESS OF 6-CHARACTER NAME + MOVE C,(C) +VWHOI6: SETZ D, ;EVENTUALLY MAKE STATUS BE 9 CHARS, NOT 6? + MOVE E,[360600,,C] + ILDB J,E ;FIND FIRST SPACE IN THAT DEVICE NAME + JUMPN J,.-1 + JUMPGE Q,VWHOI3 .SEE %IOTBK ;IF BLOCK MODE, PUT A "B" THERE. + MOVEI J,'B + DPB J,E + IBP E +VWHOI3: CAME I,[SIXBIT /SIOT/] + JRST VWHOI5 + MOVEI J,'S + DPB J,E + IBP E +VWHOI5: MOVEI J,'O ;FOLLOW WITH "O" OR "I" SAYING DIRECTION. + TLNN Q,%IOTOT + MOVEI J,'I + DPB J,E + JRST VWHO4C ;COMPLETED STATUS LOOKS LIKE "TTYBO". + +VWHOC1: LDB Q,[270400,,E] ;.CALL: GET AC FIELD, + MOVE C,CALSXB(Q) ;GIVE SIXBIT NAME OF .CALL. + JRST VWHO4C + +;MODE ISN'T 0: FIGURE OUT WHICH JOB TO DISPLAY WHO-LINE FOR, +;AND GO TO VWHO3R WITH JOB'S IDX IN TT. COME HERE WITH TTYCHN OFF. +VWHO3: LSH TT,-16.-4 ;WHAT JOB WAS LAST DISPLAY DONE FOR? + IMULI TT,LUBLK + CAMGE TT,USRHI + SKIPN D,UNAME(TT) + JRST VWHO3B ;JOB WE WERE LOOKING AT HAS VANISHED. + TLNE C,<-4>_<16.+4-18.> + JRST VWHO3B ;THIS TTY IS GETTING SYSTEM WHO-LINE. + TLNN C,2_<16.+4-18.> + JRST VWHO3E ;WANT SAME JOB AS LAST TIME. + +;MODE 2 OR 3: COME HERE TO SEARCH FOR DESIRED JOB. +VWHO3A: MOVSI E,1_<16.+4-18.> + MOVEM E,WHMODE(B) ;SWITCH TO MODE 1. + MOVEI E,MAXJ+5 ;DON'T LOOP FOREVER +VWHO3D: ADDI TT,LUBLK ;ADVANCE TO NEXT JOB UP OR DOWN. + TLNE C,1_<16.+4-18.> + SUBI TT,2*LUBLK + SKIPGE TT ;WRAP AROUND IF NEC GOING DOWN. + ADD TT,USRHI + CAML TT,USRHI ;WRAP AROUND IF NEC. GOING UP. + MOVEI TT,0 + CAMN D,UNAME(TT) ;BELONGS TO SOMEONE ELSE => KEEP GOING. + JRST VWHO3C ;BELONGS TO THIS USER => STOP. + SOJG E,VWHO3D ;KEEP LOOKING BUT DON'T LOOP IF NO JOB TO BE FOUND. +VWHO3B: SETZM WHSTAT(B) ;NO JOB TO BE FOUND. + CONO PI,TTYON + JRST VWHO2 + +VWHO3C: MOVE Q,TT ;DESIRED JOB FOUND: SET UP FOR MODE 1 + IDIVI Q,LUBLK ;LOOKING AT THIS JOB. + LSH Q,16.+4 + MOVEM Q,WHJOB(B) +VWHO3E: CONO PI,TTYON + JRST VWHO3R + + +;USER WHO LIES UPDATED; NOW UPDATE SYSTEM WHO LINE VARS. +VWSYS: LDB A,[$11AD1,,TT11HA] + LDB B,[$11AD0,,TT11LO(A)] + ADD B,[$11WD1,,TT11LO] ;FIRST WORD OF BLOCK SET BY 11 + MOVEI C,SRI + IDPB C,B ;ITS VERSION#. + MOVEI C,2 + MOVEI E,0 +IFN SWPWSP, MOVSI TT,%SWSB + MOVEI Q,2*LUBLK +VWSYS2: CAML Q,USRHI ;COUNT # JOBS. + JRST VWSYS1 + SKIPN UNAME(Q) + JRST VWSYS3 + AOS C ;C GETS # JOBS, + SKIPE USTP(Q) + JRST VWSYS3 +IFE SWPWSP, SKIPGE USWSCD(Q) +IFN SWPWSP, TDNE TT,USWST(Q) + AOS E ;E GETS NUMBER OF ACTIVE SWAPPED BLOCKED JOBS +VWSYS3: ADDI Q,LUBLK + JRST VWSYS2 + +VWSYS1: IDPB C,B ;TOTAL # JOBS + MOVE D,MMPCNT + IDPB D,B ;TOTAL MEM (= TOTAL # PAGES, COUNTING SHARED PAGES ONLY ONCE). + MOVE C,RNABLU + SUBI C,1 + IDPB C,B ;RUNNABLE USERS + IDPB E,B ;# SWAP-BLOCKED JOBS + MOVE TT,NPGWTU + IDPB TT,B ;# WAITING FOR PAGE. + MOVE C,TRUMM ;TOTAL RUNNABLE USER MEMORY + IDPB C,B + MOVEI C,0 + MOVE TT,USRHI ;COUNT PAGES AVAILABLE FOR USE OR ACTUALLY USED FOR USER MEM + ADDI TT,USRSTG+1777 + LSH TT,-10. +VWSYS5: LDB D,[MUR,,MEMBLT(TT)] + CAIE D,MURUSR + CAIN D,MUFR + AOS C ;FREE OR USER MEM. + CAIGE TT,TSYSM-1 + AOJA TT,VWSYS5 + IDPB C,B ;TOTAL MEM AVAIL FOR USERS + HLRZ C,QDATE + IDPB C,B + MOVE C,SYSDBG + IDPB C,B + AOS B ;SKIP A WHOLE WORD FOR TIME OF DAY + MOVEI D,(B) ;SAVE ADDRESS FOR BELOW + MOVE C,SUSRS ;# LOGGED IN USERS. + IDPB C,B + MOVEI E,10000. ;FAIR SHARE IN % + IDIV E,SLOADU ;BASHES TT + IDPB E,B + MOVE C,TIMOFF ;TIME OF DAY IN .5 SEC UNITS. + LSH C,4 + MOVEM C,(D) ;DEPOSITING TIME OF DAY TRIGGERS WHO-LINE UPDATE + POPJ P, ; BY THE PDP-11, SO DEPOSIT IT LAST + +] ;END IFN N11TYS + +SUBTTL EXPAND/CONTRACT USER VARIABLES AREA + +SYSEX: PUSHJ P,SCOREX + POPJ P, + MOVE A,TIME + MOVEM A,SCITM + POPJ P, + +SYSDEC: MOVE A,TIME ;TRY TO DECREASE CORE RESERVED FOR USER VARIABLES + SUB A,SCITM + CAIG A,50. + POPJ P, ;TOO SOON SINCE GOT MORE CORE + CONO PI,CLKOFF + MOVE A,USRHI + SUBI A,LUBLK + SKIPN UNAME(A) + JRST .-2 + ADDI A,LUBLK + MOVEM A,USRHI ;USRHI=> HIGHEST USER+L + ADDI A,USRSTG + ADDI A,1777 + SETOM SJCFF ;INHIBIT ALLOCATION WHILE HUSRAD IS CHANGING + CONO PI,CLKON + MOVEI U,0 ;FOR ACORE + LSHC A,-10.-36. ;MOVE INTO B AS WELL + PUSHJ P,ACORE + BUG ;LOST FLUSHING CORE? + CLEARM SJCFF + POPJ P, + +SCOREX: LDB B,[121000,,HUSRAD] ;EXTEND CORE FOR USER VARIABLES AT TOP OF SYSTEM + ADDI B,1 + CAILE B,LIOBLK + MOVEI B,LIOBLK ;TRYING TO GET TOO BIG, DON'T + MOVEI U,0 + JRST ACORE + +SUBTTL LOGGER OUT + +;THIS ROUTINE AWAKENED BY .LOGOUT, .GUN, ETC. +;SEARCH FOR TREES THAT ARE LOGGING OUT AND READY TO BE FLUSHED +;(IE HAVE BULGO SET) AND FLUSH THEM, PRINTING LOGOUT MESSAGE IF APPRO. +SYSGUN: SETZ U, +SYSGU0: MOVE T,APRC(U) + TLNE T,BULGO ;IS THIS JOB READY TO BE FLUSHED? + SKIPN UNAME(U) + JRST SYSGU1 +IFN NUNITS,[ + SKIPGE TTYTBL(U) ;IF CONSOLE-CONTROLLED, FLUSH UTAPE ASSIGNMENTS + JRST SYSGU2 + MOVSI I,-NUNITS + MOVE A,UNAME(U) + CAMN A,UTASS+1(I) + SETZM UTASS+1(I) + AOBJN I,.-2 +SYSGU2: ] + HLRO B,UNAME(U) + AOJE B,SYSGU3 ;IF THIS TREE COUNTS AS A LOGGED-IN USER, + SKIPL TTYTBL(U) + SOS SUSRS ;DECREMENT COUNT OF SUCH. +SYSGU3: CONO PI,CLKOFF + PUSHJ P,DMNPLO ;UPDATE TREE'S USAGE AND INFORM DEMON JOB + MOVEM TT,TRUNTM(U) ;SAVE RUN TIME FOR LOGOUT MSG + CONO PI,CLKON + SKIPGE A,TTYTBL(U) + JRST SYSGU4 ;IF TREE HAS CONSOLE, + SKIPE TTNTO(A) + BUG + PUSHJ P,TTYLO1 ;FREE IT. + CAMN U,EPDL(U) ;UNLESS GUNNED DOWN, + SKIPN SUPPLG ;MAY NOT WANT TO BOTHER PRINTING MESSAGE ON SYS CONSOLE + SKIPGE DEDTIM + JRST SYSGU4 ;IF LOGGED OUT BECAUSE SYS DOWN, SPARE THE LOGOUT MSG + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ / LOGOUT /] + PUSHJ P,SYSSP + MOVE A,UNAME(U) + PUSHJ P,SYSIXP ;UNAME. + PUSHJ P,STYOS ;SPACE. + HRRZ A,TTYTBL(U) + PUSHJ P,SYSOPT ;TTY #. + PUSHJ P,SYSTCR + ;VALUE PRINTED IS WRONG, AND HARD TO FIX, SO FOLLOWING CODE HAS BEEN FLUSHED. + ;THE REASON IT'S WRONG IS BECAUSE TIME ALREADY SENT TO THE DAEMON IS NOT INCLUDED. + ;MOVEI I,[ASCIZ / TUSED= /] + ;PUSHJ P,SYSSP + ;MOVE A,TRUNTM(U) + ;MULI A,4069. + ;DIVI A,1000. + ;PUSHJ P,SYSDPC + ;MOVEI I,[ASCIZ / USECS/] + ;PUSHJ P,SYSSTD + CAMN U,EPDL(U) ;WAS LOGGED OUT BY SELF? + JRST SYSGU4 + MOVEI I,[ASCIZ / ^^ GUNNED DOWN BY /] + PUSHJ P,SYSSP + MOVE A,SRN4(U) + PUSHJ P,SYSIXP ;UNAME OF GUNNER. + MOVE A,SRN5(U) + PUSHJ P,SYSSIX ;SPACE, AND JNAME OF GUNNER. + PUSHJ P,SYSTCR ;CRLF. +;MESSAGES PRINTED IF NECESSARY. +SYSGU4: SETZ R, + PUSHJ P,ZUSER ;COMPLETELY ELIMINATE THE JOB. + CONO PI,CLKON +SYSGU1: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSGU0 + SETZ U, + POPJ P, + +;DETACH ANY TREES WHOSE TOP-LEVEL JOBS HAD FATAL INTS + +SYSDT: SETZB U,J + PUSHJ P,SWTL + TREESW + CONO PI,CLKOFF + MOVSI B,BUSRC + MOVSI T,BULGOS+400000 +SYSDT0: SKIPN UNAME(J) + JRST SYSDT1 + SKIPGE SUPPRO(J) ;LOOK FOR TOP-LEVEL + TDNE T,APRC(J) ;IGNORE JOBS ALREADY DISOWNED, OR LOGGING OUT. + JRST SYSDT1 + TDNE B,USTP(J) ;THAT HAS BEEN STOPPED AS BY SUPERIOR + JRST SYSDT2 +SYSDT1: ADDI J,LUBLK + CAMGE J,USRHI + JRST SYSDT0 + JRST CLKOPJ ;NO MORE SUCH JOBS, DONE; LSWPOP AND CLKON. + +;FOUND A TOP LEVEL JOB NEEDING TO BE DETACHED. +SYSDT2: PUSH P,J + MOVE T,OPTION(J) + TLNE T,%OPLKF + JRST [ IDIVI J,LUBLK ;BASHES R + .CALL [SETZ ? 'UNLOCK ? SETZI %JSNUM(J)] ;UNLOCK THE LOCKS + BUG + MOVE J,(P) + JRST .+1 ] + CONO PI,CLKOFF ;IODCSS MIGHT HAVE TURNED IT ON + SKIPL E,JBI(J) ;NOTE CLKOFF IN EFFECT WHILE HACKING JOB DEVICE STUFF + SKIPGE JBCG(E) + JRST SYSDTA + MOVE A,JBCUI(E) ;JOB DEVICE, GIVE IOCER1 OR OPNL7 + LDB T,[000400,,JBSTS(E)] + CAIE T,1 + JRST [ MOVSI T,7_5 ;NON IOT, UNHANG CREATOR SO WILL SEE OPNL7 + MOVEM T,JBSTS(E) + MOVE T,FLSINS(A) + CAMN T,JBFLS + SETZM FLSINS(A) + JRST SYSDTA ] + MOVEI B,1 ;IOT GIVE IOCER1 + MOVS H,E + PUSHJ P,NSTIOC + JFCL +SYSDTA: POP P,J + SETZ U, + MOVE I,[SYSDT8,,[ASCIZ/TOP LEVEL INTERRUPT /]] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT7 + JRST SYSDT + +SYSDT8: MOVE A,-1(P) ;USER INDEX + MOVE A,PIRQC(A) ;TOP LEVEL INTERRUPT BITS + PUSHJ P,SYSFWP +SYSDT9: MOVEI I,[ASCIZ/ DETACHED JOB # /] + JRST SYSSP + +;JOB IN J SHOULD BE DETACHED, AND GUNNED AFTER AN HOUR, +; OR RIGHT AWAY IF NOT LOGGED IN +SYSDT4: HLRE B,UNAME(J) + AOJE B,SYSDT5 ;NOT LOGGED IN => KILL + HRLI I,SYSDT9 + PUSHJ P,SYSJEX + PUSHJ P,SYSDT3 + POPJ P, + +SYSDT5: HRLI I,[MOVEI I,[ASCIZ / KILLED JOB # /] + JRST SYSSP] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT6 + POPJ P, + +SYSDT6: PUSHJ P,SYSDT3 ;FIRST DETACH (LEAVES USER INDEX OF TOP LEVEL JOB IN A). + JRST ALOGO6 ;THEN LOG OUT. SINCE DETACHED, NO ADDITIONAL MSG FROM SYSGUN. + +;CALL WITH CLOCK OFF TO DETACH THE JOB WITH IDX IN A AND J. +;ASSUME JOB'S BULGOS HAS BEEN CHECKED, AND TREESW LOCKED. +;TURNS CLOCK BACK ON AND DOES A LSWCLR +SYSDT7: TDZA B,B ;HERE TO LEAVE AROUND +SYSDT3: MOVEI B,10 ;HERE TO SET BUMRTL WHEN WE DETACH + PUSHJ P,SOSSET + DIELOK(A) + AOS DIELOK(A) + CONO PI,CLKON + MOVEM B,CTLBTS(U) + PUSHJ P,NDETA0 + BUG + POPJ P, + +IFN NDLTYS+NETYS,[ + +;HANDLE DIAL-UP LINE CONNECTS OR DISCONNECTS ON DL-10 AND DTE20. + +SYSDIL: +IFN NDLTYS,[ + SKIPN A,DL10CL + JRST SYSDL2 ;THERE'S NONE TO PROCESS? + SETZM DL10CL ;FREE THE VAR FOR THE PDP11 + PUSHJ P,SYSDL0 +SYSDL2: ];NDLTYS +IFN NETYS,[ + SKIPGE A,DTEHNG + JRST SYSDL3 + SETOM DTEHNG + PUSHJ P,SYSDL0 +SYSDL3: +];NETYS + POPJ P, + +SYSDL0: LDB I,[.BP 77,A] ;GET OUT THE TTY NUMBER + CAIL I,NCT + POPJ P, + TRNE A,-100 + JRST SYSDL1 ;IT'S A CONNECT + PUSHJ P,SWTL ;IT'S A DISCONNECT + TREESW + MOVE J,TTYSTS(I) ;DETACH THE TREE ON THAT TTY. + JUMPL J,LSWPOP ;THERE'S NO TREE. + TLNN J,%TSCNS + JRST LSWPOP ;TTY IS OPEN AS A DEVICE. + MOVE I,APRC(J) + TLNE I,BULGOS ;GIVE UP IF TREE LOGGING OUT. + JRST LSWPOP + MOVE U,USER + MOVEI I,[ASCIZ /DIALUP LINE DISCONNECTED,/] + JRST SYSDT4 + +;ON A CONNECT, SNARF THE LINE SPEEDS DETERMINED BY THE PDP11. +SYSDL1: LDB B,[.BP 7000,A] + DPB B,[$TTISP,,TTYTYP(I)] + LDB B,[.BP 700,A] + DPB B,[$TTOSP,,TTYTYP(I)] + PUSHJ P,NCNSSP ;SET UP INITIAL TTY TYPE AS PRINTING, ACCORDING TO SPEED + MOVEI B,20 ;DON'T ASSUME TTY IS AT LEFT MARGIN + MOVEM B,TTYIHP(I) + MOVEM B,TPHP(TT) + MOVEM B,TPHP+TPLEN(TT) + POPJ P, +];NDLTYS+NETYS +.ELSE SYSDIL==CPOPJ + +IFN N11TYS,[ +SYS11D: MOVEI I,[ASCIZ /TV 11 WENT DOWN --/] + PUSHJ P,SYSSTD ;STRING, SPACE, TIME AND CR + SETZM TT11P ;IN CASE SCR11D WAS SET BY A USER, AND HE DIDN'T HACK THIS. + MOVEI A,TT11HD+1 + MOVEM A,TT11HD ;PREVENT TT11IN FROM BEING CALLED ANY MORE. +SYS11G: PUSHJ P,SWTL ;PREPARE FOR DOING DETACHES + TREESW + MOVE I,[-N11TYS,,NF11TY] +SYS11F: SKIPGE J,TTYSTS(I) ;DETACH ALL 11TV TREES. + JRST SYS11E ;THIS 11TV NOT IN USE + TLNN J,%TSCNS + JRST SYS11P ;THIS 11TV IN USE AS A DEVICE, DON'T DETACH BUT DO PCLSR + MOVE T,APRC(J) + TLNE T,BULGOS + JRST SYS11E ;DON'T DETACH TREES THAT ARE LOGGING OUT. + MOVE U,USER + MOVEI I,[ASCIZ / .../] + PUSHJ P,SYSDT4 ;DETACH OR KILL JOB W/ # IN J, AND PRINT MESSAGE. + JRST SYS11G ;TREESW NOW UNLOCKED; MUST RE-LOCK. + +SYS11P: HRRZ A,J ;PCLSR THE NAME DRAGON + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL ;AND DROP INTO SYS11E + +SYS11E: AOBJN I,SYS11F + PUSHJ P,LSWPOP ;TREESW NOT NEEDED IF NOTHING TO DETACH. + MOVSI T,-MXVBN ;FLUSH VIDEO BUFFER ASSIGNMENTS. + SETOM VBAST(T) + AOBJN T,.-1 + MOVEI T,0 +SYS11V: CAML T,USRHI + POPJ P, + SETZM NVDBA(T) + SETOM TVCREG(T) ;FLUSH TV BUFFER NUMBERS IN CREGS + ADDI T,LUBLK + JRST SYS11V + +TVBNCL: PUSH P,T ;"DEASSIGN" TVVBN(U) AND CLEAR IT ON SCREEN IF NECC + SKIPN TEN11F + SKIPL TT11P + JRST TVBNC1 + SKIPL T,TVVBN(U) + CAME U,USER + JRST TVBNC1 + PUSH P,400000+TTR10*2000 + MOVEM T,400000+TTR10*2000 + MOVE T,TVBLAD + CLEARM 400000+TTR0*2000(T) + POP P,400000+TTR10*2000 +TVBNC1: SETOM TVVBN(U) + JRST POPTJ +];N11TYS + +;PRINT CONSOLE FREE MSGS ON ALL TTYS THAT NEED IT. +;NOTE THAT THERE ARE LOWER CASE MESSAGES ON THIS PAGE. +.SEE TTYLO1 ;THIS RTN SIGNALLED WHEN A TTY BECOMES FREE. +SYSCFM: CLEARM IOCHNM+STYOC ;REUSE SYSTEM CONSOLE CHANNEL +SYSCF0: MOVEI A,0 +SYSCF1: CAIL A,NCT + JRST SYSCOP ;DONE, SWITCH SYSCON CHANNEL BACK TO SYSCON + SKIPGE B,TTYSTA(A) .SEE %TACFM + AOJA A,SYSCF1 + TLNE B,%TANJS + TLZ B,%TACTZ ;%TANJS MEANS A FAILED ^Z - FORGET ABOUT THAT ^Z. + MOVEM B,TTYSTA(A) + SKIPGE TTYSTS(A) .SEE %TSFRE + TLNE B,%TACTZ + AOJA A,SYSCF1 ;IN PROCESS OF LOADING TREE FOR THIS CONSOLE + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" A CHANNEL TO THAT TTY. + SKIPGE SHUTDN + PUSHJ P,SYSTS1 ;IF SHUTDOWN AND A DISPLAY, CLEAR THE SCREEN + MOVEI I,[ASCIZ / +Top level interrupt, tree detached +/] + MOVSI B,%TCDET ;IF TTY FREE DUE TO DETACH FOR TOP LEVEL INT, + TDNE B,TTYCOM(A) + PUSHJ P,SYSSP .SEE NDETAC ;SAY SO. + ANDCAM B,TTYCOM(A) + MOVSI B,%TANJS + ANDCA B,TTYSTA(A) + EXCH B,TTYSTA(A) ;CLEAR BIT, SAVE OLD VALUE + PUSH P,A + XCT DWNMSG + SKIPGE SHUTDN + JRST SYSCF2 ;SYSTEM IS DOWN, SAY SO + XCT SCMESG + CAMN A,SYSCN + JRST SYSCF2 ;SYSTEM JOB USING THIS CONSOLE, SAY SO + SRITYP [ System fully loaded. Console ] + TLNN B,%TANJS + SRITYP [ Console ] + PUSHJ P,SYSSP +IFN N11TYS, CAIE A,NF11TY ;ON ALL FREE PDP11-TV CONSOLES + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / Free./] + PUSHJ P,SYSSTD + XCT DMESSG + SKIPE SYSDBG +SYSCF2: PUSHJ P,SYSSTD ;SAY "SYS BEING DEBUGGED" IF NEC. + SKIPLE SHUTDN + PUSHJ P,SYSSHM ;SAY "SYS GOING DOWN" IF NEC. + POP P,A + MOVSI B,%TACFM ;TTY NO LONGER NEEDS CONSOLE FREE MSG. + IORM B,TTYSTA(A) +IFN N11TYS,PUSHJ P,TTYLO2 ;TELL THE PDP11 THIS TTY IS FREE + SETZM IOCHNM+STYOC + JRST SYSCF0 + +SUBTTL SHUTDOWN + +;HANDLE .SHUTDN - PRINT "GOING DOWN" MSGS, ETC. +SYSSHD: LDB D,[221700,,SHUTLK+1] + PUSHJ P,SWTL + SHUTLK + MOVEI I,SYSSHM + TLO I,40 + PUSH P,D + PUSHJ P,SYALCP + POP P,D + IMULI D,LUBLK + SKIPE D ;SKIP IF LEFT FROM >5 MIN PRINT OUT + SKIPN A,UNAME(D) + JRST LSWPOP + MOVEI I,[ASCIZ /CULPRIT = /] + PUSHJ P,SYSSP + PUSHJ P,SYSSIX + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,SYSTCR + JRST LSWPOP + +;GOING DOWN, WHAT A SHAME +SYSSHM: SRITYP [GOING DOWN IN ] + SKIPG SHUTDN + SRITYP [REVIVED] + PUSHJ P,SYSSP + SKIPG B,SHUTDN + JRST SYSSHN + SUB B,TIME + IDIVI B,30. ;CONVERT TO SECONDS + PUSHJ P,RTIME ;CONVERT TO SIXBIT + MOVE B,A + PUSHJ P,SYSTCD +SYSSHN: MOVEI I,[.ASCII /. /] + JRST SYSSTD + +;AND COME HERE WHEN TIME FOR SYS TO GO DOWN. +;MARK THE SYSTEM "DOWN", START FLAPPING TAPES AND DISKS, +;GUN ALL USERS, ETC. COMPLETION OF GOING DOWN IS DETECTED AT +;SLOW CLOCK LEVEL ("COFFIN"). +SYSOUT: PUSHJ P,CLQDEL + DEDBLK + SETOM DEDTIM ;PREVENT ^Z'S + .FDELE [SIXBIT/ SYSDOWN MAIL/ ? 0 ? 0] + JFCL + MOVEI U,LUBLK*2 +SYSCK3: SKIPGE SUPPRO(U) ;LOOK FOR ALL TOP-LEVEL JOBS. + SKIPN UNAME(U) + JRST SYSCK4 + MOVE T,USTP(U) + TLNE T,BUSRC + JRST SYSCK1 + MOVE T,OPTION(U) ;IS THIS JOB AN EXCEPTION? + TLNE T,%OPLIV + JRST SYSCK4 ;YES, LET IT LOG ITSELF OUT +SYSCK1: PUSHJ P,ALOGOUT ;LOG IT OUT (TELLS IT TO PREPARE ITSELF, SIGNAL SYSGUN) +SYSCK4: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSCK3 + SETZ U, +DWNMSG: SRITYP [NOT IN OPERATION] + PUSHJ P,SYALCP ;TYPE OUT ON FREE CONSOLES +IFN TPLP, MOVEI A,SCRTPF ;TPLOFF +IFN TPLP, IORM A,SUPCOR +IFN UNSPLP,[ SKIPG TPLFLG + JRST SYSCK0 + MOVEI A,SCRTPF + IORM A,SUPCOR +SYSCK0: +] MOVE I,QACTB + IORM I,QMDRO + MOVSI A,-NQS +SYSCK7: MOVE I,DCHBT(A) + SKIPN QACT(A) + IORM I,QTUTO(A) + AOBJN A,SYSCK7 +IFN NUNITS,[ + MOVEI A,1 +SYSUDM: SKIPL UDIRO(A) + .UDISMT A, ;DISMOUNT TAPES + CAIGE A,NUNITS + AOJA A,SYSUDM +] + MOVE T,TIME + MOVEM T,DTHTIM + SETOM SHUTDN + PUSHJ P,TTTMNT ;TURN OFF ALL TERMINET MOTORS + JRST SCOR + +SUBTTL SYSTEM CHECKS +;CHECK FOR DEVICES THAT LOSE THE PIA, DEVICES THAT INTERRUPT SPURIOUSLY, +;CLOBBERD LOCATIONS IN MEMORY. + +IFE KS10P,[ ; KS has no devices to speak of... + +SYSCK5: MOVSI A,-128. +SYSC51: SKIPL B,DCHNTC(A) +SYSC5A: AOBJN A,SYSC51 + JUMPGE A,CPOPJ + TLNN B,300000 + JRST SYSC5A + PUSH P,A + TLZE B,200000 + JRST SYSC52 + PUSHJ P,SYSC5S + JRST SYSC53 +SYSC52: PUSHJ P,SYSC5C +SYSC53: POP P,A + MOVSI B,300000 + ANDCAM B,DCHNTC(A) + JRST SYSC5A + +SYSC5C: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / CLOBBERED/] + JRST SYSSTD + +SYSC5S: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / SUSPECTED OF INTERRUPTING ON CHANNEL /] + PUSHJ P,SYSSP + LDB T,[360300,,DCHNTC(A)] + PUSHJ P,SYSSOP + JRST SYSTCR + +SYSSOP: PUSH P,A + PUSH P,B + MOVE A,T + PUSHJ P,SYSOPT + JRST POPBAJ + +SYSC5B: MOVEI I,[ASCIZ /DEVICE /] + PUSHJ P,SYSSP + HRRZ T,A + LSH T,2 + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ / (CONI= /] + PUSHJ P,SYSSP + HRRZ T,DCHNTC(A) + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ /) /] + JRST SYSSP + +] ;IFE KS10P + +SYSCKS: HRRZ T,UPDBR1 ;CHECK FOR CLOBBERED DBRS + HRRZ TT,UPDBR2 + CAIN T,UPGMP + CAIE TT,UPGMP+100 + BUG HALT,[PAGER DATA CLOBBERED. MAY BE DEC-TTL LEVEL CONVERTERS LOSING.] +;DROPS THROUGH + ;DROPS IN + MOVE A,SYSCKP + MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + CAME C,CKSUMS-TSTB(A) + JRST SYSKS2 + AOBJN A,SYSKS1 +SYSKS3: MOVE A,[-LTSTB,,TSTB] +SYSKS1: MOVEM A,SYSCKP + POPJ P, + +SYSKS2: EXCH C,CKSUMS-TSTB(A) + XOR C,CKSUMS-TSTB(A) ;SAVE XOR + PUSHJ P,WARMTTY + PUSHJ P,DINGTTY + MOVEI I,[ASCIZ /SYSTEM CLOBBERED BETWEEN /] + PUSHJ P,SYSSP + HRRZ A,(A) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / AND /] + PUSHJ P,SYSSP + MOVE B,SYSCKP + HLRE A,(B) + SETCMM A ;OFFSET BY ONE + ADD A,(B) + HRRZS A + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / XOR= /] + PUSHJ P,SYSSP + MOVE A,C + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ / !/] + PUSHJ P,SYSSTD + CLEARM TCKXOR ;TRY TO DETERMINE EXACT ADR AND PREV CONTENTS + MOVE A,[TCKXOR,,TCKXOR+1] + BLT A,TCKXOR+35. + MOVE A,[-LTSTB,,TSTB] +SYSKS6: MOVE B,(A) +SYSKS5: MOVE C,(B) +REPEAT 36.,[IFL .RPCNT-18.,TLNE C,400000_<-.RPCNT> +IFGE .RPCNT-18.,TRNE C,400000_<18.-.RPCNT> + XORM B,TCKXOR+.RPCNT + ] + AOBJN B,SYSKS5 + AOBJN A,SYSKS6 + MOVSI D,-36. +SYSKS7: MOVE A,TCKXOR(D) ;UPDATE CKXORS TBL AND FILL TCKXOR TBL WITH POSSIBLE ADRS + EXCH A,CKXORS(D) + XOR A,CKXORS(D) + HRRZM A,TCKXOR(D) + AOBJN D,SYSKS7 + PUSHJ P,STYOT ;INDENT LINE + MOVSI D,-36. + MOVSI E,400000 ;CURRENT BIT + CLEARB I,J ;COUNT OF #'S PRINTED, CLOBBERED WD +SYSKS8: SKIPE A,TCKXOR(D) + AOJA J,SYSKS9 ;INCR COUNT OF ADRS PRINTED +SYSKT2: LSH E,-1 + AOBJN D,SYSKS8 + SOJN J,SYSKT1 ;MORE THAN 1 ADR CLOBBERD SO CANT PRINT PREV CONTENTS + MOVEI T,"= + PUSHJ P,STYO + MOVE A,I ;PRINT CONTENTS PRIOR TO CLOBBERAGE + XOR A,(R) ;XOR CURRENT CONTENTS + PUSHJ P,SYSFWP + MOVEI T,"- + PUSHJ P,STYO + MOVEI T,"> + PUSHJ P,STYO + MOVE A,(R) + PUSHJ P,SYSFWP ;CURRENT CONTENTS +SYSKT1: PUSHJ P,SYSCRF + JRST SYSKS3 + +SCKX1: PUSH P,T ;UPDATE CKXORS TO REFLECT CHANGING WD IN T IN ADR IN Q + MOVSI C,-36. +SCKX2: SKIPGE T + XORM Q,CKXORS(C) + LSH T,1 + AOBJN C,SCKX2 + JRST POPTJ + +SYSKS9: PUSHJ P,SYSOPT + PUSHJ P,STYOS + MOVE R,TCKXOR(D) ;CLEAR DUP ENTRIES + MOVE T,D + MOVE Q,E ;ALSO LEAVE LAST ADR IN R (IN CASE ITS ONLY ADR) +SYSKT3: CAME R,TCKXOR(T) + JRST SYSKT4 + CLEARM TCKXOR(T) + XORM Q,I +SYSKT4: LSH Q,-1 + AOBJN T,SYSKT3 + JRST SYSKT2 + +SUBTTL SUPPORT ROUTINES FOR BUG MACRO + +;NOTE: THESE REPLACE THE SYSMSG ROUTINE THAT USED TO BE HERE + +;ENTRY POINTS +BUGCHK: PUSH P,TT + MOVE TT,SYSMPT ;HOW MANY MESSAGES BEHIND? + SUB TT,SYSMPU + CAIGE TT,<8_SYSMLNG>-8 + SKIPE SYSDBG + JRST BUGPSE+1 ;TREAT AS BUGPSE IF BUFFER FULL OR SYSDBG + CAIA +BUGINF: PUSH P,TT + PUSHJ P,SYSMS0 ;HAND MESSAGE TO SYSTEM JOB TO BE PRINTED + JRST POPTTJ ;CONTINUE TRAPPED ROUTINE + +BUGPSE: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/PAUSE. FIND A WIZARD, CONSIDER TAKING A CRASH DUMP, +OR TYPE P TO ATTEMPT TO REVIVE THE SYSTEM./ + +BUGDDT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/DDT. TYPE P TO CONTINUE./ + +BUGNIL: PUSH P,TT + JRST BUGHL1 ;NO MESSAGE, JUST GO STRAIGHT TO DDT. + +BUGAWF: 0 ;JSR HERE WHEN AWFUL THINGS HAVE HAPPENED + CONO PI,PIOFF ;BETTER DO THIS AS SOON AS POSSIBLE + MOVEM P,BUGACS+P ;SAVE P AND GET A PDL TO USE + MOVE P,BUGPDL + PUSH P,BUGAWF ;SIMULATE PUSHJ P,BUGHLT +BUGHLT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER +BUGHL1: JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/HALT. FIND A WIZARD OR CONSIDER TAKING A CRASH DUMP. +THE SYSTEM HAS CRASHED AND CANNOT BE REVIVED WITHOUT EXPERT ATTENTION. +IF YOU CAN'T FIND HELP, RELOAD THE SYSTEM./ + +;ROUTINE TO PICK UP THE DATA OUT OF THE BUG TABLE, EVALUATE THE +;ARGUMENTS, AND DUMP THE RESULTS INTO THE SYSMSG BUFFER TO BE +;PRINTED LATER. THE THIRD THING DOWN ON THE STACK IS THE PC+1 +;AT WHICH THE BUG WAS DETECTED. TT IS THE ONLY SMASHABLE REGISTER. +SYSMS0: MOVEI TT,8 ;8 WORDS IN ENTRY + ADDB TT,SYSMPT ;UPDATE STORING POINTER + ANDI TT,8_SYSMLNG-1 ;MASK TO BUFFER INDEX + ADDI TT,SYSMBF + PUSH P,TT ;SAVE PTR + PUSH P,A ;NOW LOCATE BUG TABLE ENTRY + PUSH P,B + MOVE A,TIME ;STASH TIME IN EXTRA WORD OF ENTRY + MOVEM A,7(TT) + MOVEI B,BUGTAB +SYSMS1: HRRZ A,(B) + CAIN A,@-5(P) + JRST SYSMS2 ;PC MATCHES + HLRZ A,(B) ;ADVANCE TO NEXT ENTRY + ADD B,A + JUMPN A,SYSMS1 + JRST 4,. ;NOT IN TABLE?? MACROS MUST BE SCHROD + +SYSMS2: HLRZ A,(B) + ADDI TT,-2(A) + EXCH TT,-2(P) ;TT START OF ENTRY, -2(P) END + MOVE A,TT + HRLI A,1(B) ;COPY BITS,,STRING AND ARG POINTERS + BLT A,@-2(P) + POP P,B + POP P,A + SUBM TT,(P) ;(P) GETS -NARGS + SKIPE (P) ;IN CASE NO ARGS +SYSMS3: PUSH TT,@1(TT) ;EVALUATE ARGUMENT POINTERS + AOSGE (P) + JRST SYSMS3 + MOVEI TT,SCRMSG ;BIT FOR MSG PRINT + IORM TT,SUPCOP ;TRY EVERY SECOND TO PRINT SOME MSGS + IORM TT,SUPCOR ;FIRST ATTEMPT RIGHT AWAY. + JRST POP1J ;RETURN TO BUGINF OR WHEREVER + +;CALL HERE TO PRINT THE MESSAGES OUT OF THE BUFFER +;A HAS SCRMSG +SYSMPR: MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMG TT,SYSMPU ;LAST MESSAGE OUT + JRST [ ANDCAM A,SUPCOP ;CAUGHT UP + POPJ P, ] + SUBI TT,8_SYSMLNG + CAMLE TT,SYSMPU + JRST [ MOVE A,TT ;BEHIND BY MORE THAN SIZE OF BUFFER + SUB A,SYSMPU + MOVEM TT,SYSMPU + LSH A,-3 ;NUMBER OF MESSAGES LOST + PUSHJ P,DINGTTY + PUSHJ P,SYSDPT + MOVEI I,[ASCIZ/ SYS MSGS LOST/] + PUSHJ P,SYSSTD + JRST .+1 ] + MOVEI TT,8 + ADDB TT,SYSMPU + ANDI TT,8_SYSMLNG-1 + ADDI TT,SYSMBF + PUSHJ P,DINGTTY + HLLZ D,(TT) ;GET MODE FLAGS + HRRZ I,(TT) ;GET ASCIZ MSG + HRLI I,440700 +SYSMP0: ILDB T,I + JUMPE T,SYSMP1 + CAIGE T,10 + JRST SYSMP3 + PUSHJ P,STYO + JRST SYSMP0 + +SYSMP1: PUSHJ P,STYOS ;SPACE AND OUTPUT REMAINING ARGS + PUSHJ P,SYSMP2 + JRST SYSTCR ;END WITH TIME, POPJ + JRST SYSMP1 + +SYSMP3: PUSH P,T ;OUTPUT THIS MANY ARGS +SYSMP4: PUSHJ P,SYSMP2 + JFCL + PUSHJ P,STYOS + SOSLE (P) + JRST SYSMP4 + SUB P,[1,,1] + JRST SYSMP0 + +SYSMP2: MOVEI C,0 + LSHC C,3 ;GET A BYTE + JUMPE C,CPOPJ ;NO MORE ARGS TO PRINT + PUSH P,I + MOVE A,1(TT) + PUSHJ P,@SYSMTB(C) + POP P,I + AOJA TT,POPJ1 + +;DISPATCH TABLE FOR SYSTEM MESSAGE PRINTER + +SYSMTB: JRST 4,. ;0 CHECKED FOR END + SYSFWP ;1 FULL WORD OCTAL + SYSDPT ;2 FULL WD DECIMAL + SYSDPC ;3 " WITH COMMAS + SYSCRF ;4 DO CR + CPOPJ ;5 ? + SYSIXP ;6 SIXBIT + [MOVE I,A ;7 ASCIZ + JRST SYSSP] + +;ROUTINE FOR BUGS THAT NEED TO HALT INTO DDT +BUGDD0: HRLI TT,440700 + CONO PI,PIOFF ;PREVENT INTERFERENCE, AND HACK STYO + MOVEM TT,T00POS ;SAVE ADDRESS OF MESSAGE TEMPORARILY + POP P,TT ;RESTORE TT AT TIME OF BUG + POP P,BUGPC ;ADDRESS+1 OF BUG + SKIPE BUGAWF + MOVE P,BUGACS+P ;CORRECT P AT TIME OF BUG + SETZM BUGAWF ;CLEAR FLAG FOR NEXT BUG IN CASE REVIVED + CONI PI,BUGPI ; SAVE PI STATUS + CONI BUGAPR ; SAVE APR STATE +IFE KA10P,[ + CONI PAG,BUGEBR ; SAVE EBR, UBR, ETC + DATAI PAG,BUGUBR +] ;IFE KA10P + SPM BUGPGM ; SAVE PAGER STATE + MOVEM 17,BUGACS+17 ;SAVE ACS + MOVEI 17,BUGACS + BLT 17,BUGACS+16 + MOVE P,BUGPDL ;USE THIS PDL FOR TYPING OUT + PUSH P,T00POS ;RECOVER ASCIZ STRING FOR FLAVOR OF BUG + PUSHJ P,SYSCRF ;CARRIAGE RETURN +BUGDD1: MOVEI A,SCRMSG + PUSHJ P,SYSMPR ;DUMP SYSMSG BUFFER +IFN KA10P,[ + CONSZ TTY,40 ;PUNT IF CHARACTER TYPED + JRST BUGDD2 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPE DTEF11 ;INPUT TYPED? + JRST BUGDD2 ;YES, PUNT +] ;KL10P +IFN KS10P,[ + SKIPE 8CTYIN ; Any input available? + JRST BUGDD2 ; Yes: Punt. +] ;KS10P + MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMLE TT,SYSMPU ;LAST MESSAGE OUT + JRST BUGDD1 +BUGDD2: MOVE A-1,BUGPI ;CHECK FOR PI IN PROGRESS + ANDI A-1,77400 + LSH A-1,20. + JFFO A-1,[ MOVEI I,[ASCIZ/PI LEVEL /] + PUSHJ P,SYSSP + PUSHJ P,SYSDPT + PUSHJ P,STYOS + JRST .+1 ] + MOVEI I,[ASCIZ/BUG/] + PUSHJ P,SYSSP + POP P,I ;PAUSE OR HALT MESSAGE + SKIPN SYSDBG ;PUNT LONG-WINDED MESSAGE IF DEBUGGING + PUSHJ P,SYSSP + MOVEI I,[ASCIZ/ +YOU ARE NOW IN DDT./] + PUSHJ P,SYSSP + MOVEI TT,[ASCIZ|BUGPC/Q-2/|] + HRLI TT,440700 + MOVEM TT,777777 ;TELL DDT TO EXAMINE BUGHLT ADDRESS + MOVE TT,BUGPC ;ARRANGE FOR P TO JUMP THERE + MOVEM TT,@DDT-6 ;IN OLDER DDT WILL JUST CLOBBER AC0 + MOVSI 17,BUGACS ;RESTORE ACS + BLT 17,17 + CONO PI,PION + JRST DDT + +EBLK + +;DATA AREAS POINTERS AND BUFFER FOR SYS MSG PRINTER + +CTLMAX==55. ;Number of lines after which we should print the date. +CTLCNT: 0 ;Keeps track of number of lines printed on console. + +SYSMPT: 0 ;POINTER TO MESSAGE MOST RECENTLY INSERTED +SYSMPU: 0 ;POINTER TO MESSAGE MOST RECENTLY PRINTED + ;(MUST TAKE MODULO LENGTH OF TABLE, AND ADD OFFSET OF BEGIN OF TABLE) +IFNDEF SYSMLNG,SYSMLNG==5 ;LOG(2) OF # ENTRIES (5=>32) + +SYSMBF: BLOCK 8_SYSMLNG ;8 WDS PER ENTRY: BITS,,STRING, 6 ARGS, TIME + +BUGPC: 0 ;RESTART PC FROM BUG +BUGPI: 0 ; CONI PI,BUGPI +BUGAPR: 0 ; CONI APR,BUGAPR +IFE KA10P,[ +BUGEBR: 0 ; CONI PAG,BUGEBR +BUGUBR: 0 ; DATAI PAG,BUGUBR +] ;IFE KA10P +BUGPGM: BLOCK UPGMLE-UPGML ; SPM BUGPGM +BUGACS: BLOCK 20 ;AC SAVE AREA FOR BUGDD0 +BUGPDL: -20,,. + BLOCK 20 +T00POS: 0 ;TTY00 HORIZONTAL POSITION + +BBLK + +SUBTTL .SETLOC ROUTINE (DOCUMENT THEN DOES IT) + +SYSSET: MOVE A,SETSLC ;LOCATION TO BE MODIFIED + TLNN A,-1 ;SKIP IF ALREADY DONE + SKIPA C,SETSLQ ;NEW VAL IN SETSLQ + SKIPA C,(A) ;NEW VAL IN LOC + SKIPA D,A ;OLD VAL IN @A + MOVEI D,SETSLQ ;OLD VAL IN SETSLQ + PUSHJ P,SYSSCT ;PRINT OUT DDT-TYPE SEQUENCE + MOVE A,SETSU ;GET USET NAME + PUSHJ P,STYOT ;TYPE OUT A TAB + MOVEI B,0 + PUSHJ P,SYSIXP ;PRINT NAME OF GUILTY PARTY + PUSHJ P,SYSTCR ;STANDARD SYS CARRIAGE RETURN + SKIPGE SETSLC ;IF ALREADY MUNGED AT UUO LEVEL + POPJ P, ;THEN EXIT NOW + MOVE T,SETSLQ ;GET DESIRED VALUE +; SKIPL UMBTS +; JRST SYSSE8 ;DON'T HACK METABITS +; LMB Q,@SETSLC ;GET META BIT OF DESIRED LOCATION +; TRNE Q,1 ;IF 1 THEN HAVE TO MOMENTARILY CLEAR IT +; JRST SYSSE5 +SYSSE8: EXCH T,@SETSLC ;META BIT=0, CHANGE LOCATION +SYSSE6: MOVE Q,SETSLC ;GET ADR OF MUNGED LOC + MOVE A,[-LTSTB,,TSTB] +SYSSE1: MOVE B,(A) + CAIGE Q,(B) + JRST SYSSE3 + HLRE C,B + SETCMM C + ADD C,B + CAILE Q,(C) + JRST SYSSE3 + PUSHJ P,SCKX1 ;UPDATE CKXORS TBL TOO + EQV T,@SETSLC + EQVM T,CKSUMS-TSTB(A) + MOVE T,@SETSLC + PUSHJ P,SCKX1 ;UPDATE TO REFLECT NEW CONTENTS +SYSSE2: MOVSI A,SCLSET + ANDCAM A,SUPCOR + CAIE Q,SYSDBG ;IF NOT DEBUG SWITCH + POPJ P, ;EXIT + PUSHJ P,DBGINT ;SYSDBG STATE CHANGE, TELL ALL USERS + SKIPE SYSDBG + JUMPN T,CPOPJ +;SYSDBG CLEARED, GIVE "IN OPERATION" MESSAGE BY DROPPING INTO ISYS +;HERE WHEN SYSTEM IS UP AND DISKS HAVE BEEN INITIALIZED +;RE-ENTER HERE WHEN SYSDBG STATE CHANGED +ISYS: PUSHJ P,DATIME ;MAY BE ABLE TO FIND TIME IMMEDIATELY (ONCE MFD IN) + PUSHJ P,TTTMN2 ;MAKE SURE WE THINK THAT ALL TERMINET + ;MOTORS ARE OFF, SO WE'LL TRY TO TURN THEM ALL ON WHEN WE TYPE + ;"ITS IN OPERATION" ON THEM. + PUSHJ P,TTRSAL ;SEND %TDORS TO ALL SOFTWARE TTYS + SRITYP [IN OPERATION] + SKIPE SYSDBG ;IF SYS IN DEBUG MODE +DMESSG: SRITYP [BEING DEBUGGED] ;SET TO APPROP MSG + PUSHJ P,SYALCP ;PRINT ON ALL CONSOLES +SCMESG: SRITYP [SYSTEM JOB USING THIS CONSOLE.] + PUSHJ P,SYSSP ;PRINT ON SYS JOB CONSOLE + SKIPGE DMLLDF ;START DRAGON (DAEMON) IF WANTED + SKIPL DMON+1 ;AND NOT DONE ALREADY + POPJ P, + HRROI T,DMON + CONO PI,UTCOFF + PUSHJ P,NUJBST + BUG ;SHOULD BE ROOM IN REQUEST BUFFER + JRST UTCONJ + +SYSSE3: AOBJN A,SYSSE1 + JRST SYSSE2 + + ;SETLOC ROUTINE TO MODIFY LOCATION WITH META BIT = 1 + +;SYSSE5: MOVEI D,0 +; SMB D,@SETSLC +; EXCH T,@SETSLC +; SMB Q,@SETSLC +; JRST SYSSE6 + +SUBTTL MEMORY ERROR MESSAGES + +NXMTYP: MOVEI I,[ASCIZ /NON-EX MEM ERROR #/] + MOVEI TT,1 + JRST MEMTYP + +IFE KA10P,[ +BPFTYP: MOVEI I,[ASCIZ /PAGE FAIL ERROR #/] + MOVEI TT,2 + JRST MEMTYP +] ;IFE KA10P + +PARTYP: MOVEI I,[ASCIZ /PARITY ERROR #/] ;PARITY ERROR + MOVEI TT,0 +MEMTYP: PUSHJ P,SYSSP + MOVE A,PARERR(TT) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, PC = /] + PUSHJ P,SYSSP + MOVE A,PARPC(TT) + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ /, JOB # /] + PUSHJ P,SYSSP + MOVE A,PARUSR(TT) + IDIVI A,LUBLK + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + MOVE D,PARUSR(TT) + MOVE A,UNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,STYOS + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + JRST @.+1(TT) ;DISPATCH ON TYPE OF ERROR + PARTY2 ;PARITY + SYSTCR ;NXM +IFE KA10P,[ + BPFTY2 ;BPF + +BPFTY2: MOVEI I,[ASCIZ /, PFW = /] + PUSHJ P,SYSSP + MOVE A,BPFPFW + PUSHJ P,SYSFWP + JRST SYSTCR +] ;IFE KA10P + +PARTY2: PUSHJ P,SYSTCR +IFN KS10P,[ + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP + MOVE T,PARERA ; Error address is all we collect on the KS. + PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KS10P +IFN KL10P,[ + SKIPN PARRSN + JRST PARTP1 + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP ;PAR ERR INT ALWAYS GIVES ERR ADDR + MOVE T,PARERA + JRST PARTP2 + +PARTP1: MOVEI I,[ASCIZ /PFW = /] + PUSHJ P,SYSSP ;PAR ERR TRAP GIVES PFW AND BAD DATA + MOVE T,PARPFW ;EVEN IF SCAN DOESN'T FIND PAR ERRS. + PUSHJ P,SYSP + MOVEI I,[ASCIZ /, BAD DATA = /] + PUSHJ P,SYSSP + MOVE T,PARWRD +PARTP2: PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KL10P + SOSGE D,PARCNT + POPJ P, + JUMPE D,PARTP3 ;IF SCAN FOUND MORE THAT ONE PAR ERR, + ;PRINT AND'S AND OR'S OF DATA AND ADDRS. +IRP X,,[PARAAN,PARAOR,PARAND,PARIOR]Y,,[ADDR AND,ADDR IOR,DATA AND,DATA IOR] +IFE .IRPCNT&1, MOVEI I,[ASCIZ /Y = /] +.ELSE MOVEI I,[ASCIZ /, Y = /] + PUSHJ P,SYSSP + MOVE T,X + PUSHJ P,SYSP +IFN .IRPCNT&1, PUSHJ P,SYSCRF ;PRINT TWO ITEMS PER LINE. +TERMIN +PARTP3: MOVEI I,[ASCIZ /PARITY ERRORS: +/] + PUSHJ P,SYSSP +SYSPR1: PUSHJ P,STYOT ;TYPE TAB + MOVE A,PARADR(D) + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,PARCON(D) + PUSHJ P,SYSFWP + PUSHJ P,SYSCRF + SOJGE D,SYSPR1 + AOS D,PARCNT + MOVEI I,[ASCIZ/ .../] + CAIN D,MXPARS + PUSHJ P,SYSSP ;NOT ALL PARITY ERRORS WERE PRINTED + JRST SYSCRF + +SUBTTL LOGIN & MISCELLANEOUS MESSAGES + +SYSLGI: SKIPE SUPPLG + POPJ P, ;DON'T BOTHER PRINTING MESSAGE + HLRZ I,SLGIV+1 ;Message (CHUNAME, LOGIN, etc) + PUSHJ P,SYSSP + MOVEI TT,SLGIV ;.LOGIN + MOVE A,(TT) + CAMN A,[-1] + BUG + PUSHJ P,SYSG23 + SKIPE A,SLGIV+2 + PUSHJ P,SYSSIX + JRST SYSTCR + +SYSG23: PUSHJ P,SYSIXP + PUSHJ P,STYOS + HRRZ A,1(TT) ;PICK UP TTY NUM + JRST SYSOPT + +;PRINT A MESSAGE WHEN SOMEONE WRITES ON SYS. +SYSWRT: MOVE A,SWUNAM ;WRITE ON SYS DEVICE + PUSHJ P,SYSIXP + MOVE A,SWJNAM + PUSHJ P,SYSSIX + MOVE A,SWFN3 ;SNAME - SYS,SYS1, ... + PUSHJ P,SYSSIX + MOVE A,SWFN1 + PUSHJ P,SYSSIX + MOVE A,SWFN2 + PUSHJ P,SYSSIX + MOVE A,[SIXBIT /WRITE/] ;Assume luser was writing. + MOVE B,SWMOD ;Check opcode. + CAIN B,2 ;MLINK? + MOVE A,[SIXBIT /LINK/] ; Yup. + CAIN B,4 ;Maybe DELE/WO, RENAM/WO? + MOVE A,[SIXBIT /DELRNM/] ; Yah, hmmhmmm. +SYSWR3: PUSHJ P,SYSSIX + JRST SYSTCR + +SUBTTL DETERMINE AND PRINT THE DATE AND TIME + +EBLK +DATIME: JRST .+1 ;RH MODIFIED TO REFLECT PROGRESS +BBLK ;ROUTINE CALLED BY PUSHJ, + ;BIT SET EVERY SECOND FROM SUPCOP UNTIL + ;THE DATE IS KNOWN. + MOVSI T,40000 ;"MFD IN" BIT IN QMDRO + CONO PI,UTCOFF ;DISABLE INTERRUPTS + TDNE T,QMDRO ;SEE IF DIRECTORY IN + JRST UTCONJ ;NOT IN + ;MFD IN, GET CRUD FROM IT + MOVE A,QMDRO ;GET ORIGIN OF MFD + SKIPE B,MDYEAR(A) ;YEAR + MOVEM B,FYEAR + SKIPE C,MPDOFF(A) ;PDTIME OFFSET + MOVEM C,PDTIME + MOVEI C,DATIM0 + HRRM C,DATIME + JRST UTCONJ + +DATIM0: PUSHJ P,GLPDTM ;NOW SEE IF IT'S ALL THERE + JRST DATIM2 ;NOT ALL THERE, DOCUMENT WHAT'S MISSING + JRST DATIM6 ;ALL THERE, TYPE OUT AND CLEAR SUPCOR BIT + + ;NOT ALL THERE, DOCUMENT (TYPE OUT) WHAT IS MISSING + ;SHOULD NOT BE NECESSARY TO WARM UP TTY + +DATIM2: +IFN PDCLKP,[ + DATAI PDCLK,A ;SEE IF CLOCK ON + JUMPN A,DATIM3 ;JUMP IF CLOCK WINNING + MOVEI I,[ASCIZ /DECORIOLIS CLOCK HAS BEEN POWERED OFF, IF THE TIME +CANNOT BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + MOVEI T,500. + SOJG T,. ;WAIT AND BE SURE + DATAI PDCLK,A ;GET DATAI AGAIN + JUMPN A,DATIM3 ;JUMP IF OK NOW + PUSHJ P,SYSSP ;COMPLAIN +] ;PDCLKP +IFN KS10P,[ + RDTIM A ; Clobbers B + TLC A,1729. ; "A most interesting number" + TLNN A,-1 ; If present, KS-10 clock still remembers the time. + JRST DATIM3 + MOVEI I,[ASCIZ /THE KS-10 CLOCK HAS BEEN RESET, IF THE TIME CANNOT +BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + PUSHJ P,SYSSP ; Complain +] ;KS10P +DATIM8: +; HRROI T,CCTSS ;NOW PREPARE TO LOAD CTSS CALLER FROM SYS:@ CCTSS +; PUSHJ P,NUJBST ;DO A PSEUDO-CONTROL Z +; JRST DATIM7 +DATIM3: MOVEI C,0 ;COUNTER OF THINGS MISSING FROM MFD + MOVEI I,[ASCIZ /YEAR, /] + SKIPG FYEAR ;CHECK YEAR + PUSHJ P,[AOJA C,SYSSP] ;NOT IN, COMPLAIN +IFN PDCLKP\KS10P,[ + MOVEI I,[ASCIZ /PDTIME OFFSET, /] + SKIPN PDTIME + PUSHJ P,[AOJA C,SYSSP] ;PDTIME OFFSET NOT IN +] ;PDCLKP\KS10P + JUMPE C,DATIM4 ;SKIP FOLLOWING IF EVERYTHING ON DISK + MOVEI I,[ASCIZ /NOT ON DISK. +PLEASE SETLOC APPROPRIATELY. +/] + PUSHJ P,SYSSP +DATIM4: SKIPA T,[DATIM5];UPDATE DATIME TO WAIT FOR EVERYTHING TO BE THERE +DATIM7: MOVEI T,DATIM8 ;UPDATE DATIME TO WAIT FOR ABILITY TO DO + ; PSEUDO-CONTROL Z FOR CTSS CALLER + HRRM T,DATIME + POPJ P, + + ;WAIT FOR EVERYTHING TO BE THERE + ;THEN TYPE OUT "IT IS NOW...", ETC. + +DATIM5: PUSHJ P,GLPDTM ;CHECK IT + POPJ P, ;NOT ALL THERE YET + MOVEI T,DATIME+1 ;ALL THERE, RE-INITIALIZE DATIME + HRRM T,DATIME +DATIM6: MOVSI T,SCLDAT ;STOP CALLING DATIME EVERY SECOND + ANDCAM T,SUPCOP ;NOW THAT THE WORK IS DONE. + HRRZS TIMOFF ;START UP SLOW CLOCK REAL-TIME ROUTINE + SETZM RSWTIM ;Initialize the resource-warning timestamp. + PUSHJ P,WARMTT ;WARM UP TTY + PUSHJ P,RYEAR1 ;GET DAY OF WEEK IN RELEVANT FIELD OF E +SYSNWP: MOVEI I,[ASCIZ /IT IS NOW /] + PUSHJ P,SYSSP ;TYPE IT OUT + IDIVI A,SPD ;A HAS RESULT OF PUSHJ TO GLPDTM + PUSH P,A ;SAVE DAY OF YEAR + MOVE A,B ;GET # SECS SINCE MIDNIGHT IN A + IDIVI A,SPD/2 ;GET AM/PM BIT IN A, 12 HOUR TIME (SECS) IN B + PUSH P,[SIXBIT / AM PM/](A) ;REMEMBER WHAT HALF-DAY + CAIGE B,3600. ;USE 12:01 RATHER THAN 0:01 IN 12-HR TIME. + ADDI B,12.*3600. + PUSHJ P,RTIME ;CONVERT TIME TO SIXBIT + MOVE B,A + TLNN B,170000 ;IF LEADING DIGIT IS ZERO, + TLZ B,770000 ;THEN TURN IT INTO A BLANK + PUSHJ P,SYSTCD ;TYPE OUT TIME + POP P,B ;RESTORE AM OR PM WORD + PUSHJ P,SYS6 ;TYPE IT OUT + MOVE B,[SIXBIT / EST,/] + TLNE E,100000 ;DST BIT + HRLI B,(SIXBIT / ED/) ;DAYLIGHT SAVINGS TIME, TYPE OUT EDT INSTEAD OF EST + PUSHJ P,SYS6 ;TYPE IT OUT + PUSHJ P,STYOS ;TYPE A SPACE + LDB B,[320300,,E] ;GET DAY OF WEEK (0 => SUNDAY) + MOVE B,DOWTBL(B) ;MON, TUES, WEDNES, ETC. (IN SIXBIT) + PUSHJ P,SYS6 ;TYPE IT OUT + MOVEI I,[ASCIZ /DAY, /] ;FINISH ON DAY OF WEEK + PUSHJ P,SYSSP ;" " " + POP P,A ;RESTORE DAY OF YEAR + PUSHJ P,RDATE1 ;CALCULATE MONTH AND DAY + MOVE B,NMNTBL-1(B) ;GET SIXBIT FOR MONTH + PUSHJ P,SYS6 ;TYPE OUT MONTH + PUSHJ P,STYOS ;TYPE A SPACE + MOVE A,C ;GET DAY OF MONTH IN A + PUSHJ P,SYSDPT ;TYPE OUT IN DECIMAL + MOVEI T,", + PUSHJ P,STYO ;TYPE A COMMA + MOVEI A,(E) ;GET YEAR + PUSHJ P,SYSDPT ;TYPE IT OUT + JRST SYSCRF ;END WITH CRLF + + ;TABLE OF NAMES OF MONTHS (FIRST THREE LETTERS, IN SIXBIT) + +NMNTBL: MNIRP [SIXBIT /M/] + + ;TABLE OF SIXBIT NAMES FOR DAYS OF THE WEEK + ;(THE "DAY" ON THE END LEFT OFF) + +DOWTBL: IRPS D,,[SUN MON TUES WEDNES THURS FRI SATUR] + SIXBIT /D/ + TERMIN +IFN .-DOWTBL-7,.ERR BARF AT DOWTBL + +SUBTTL NETWORK UP/DOWN + +SYSNET: +IFE IMPP,JRST SCOR +IFN IMPP,[ + MOVEI I,[ASCIZ /IMP CRASHED, STATUS=/] + PUSHJ P,SYSSP ;Print string + MOVE A,IMERCN ;Get IMP error code + PUSHJ P,SYSFWP ;Print that + PUSHJ P,SYSTCR ;Time, CRLF + SETOM IMERCN ;Reset error status + MOVE A,LNETIM ;Last time net was initted + SUB A,TIME ;A will be positive if net was last + ADDI A,30.*30. ; initted less than 30 sec ago. + PUSH P,A ;Flag for SYSNT5. + means don't restart IMP + MOVNI A,2 ;Say we are coming up, but no PI action yet, + MOVEM A,IMPUP ; and prevent new net openers. IMPUP may + PUSHJ P,SYSNT5 ; not already be -1 if got here via LOCK/NET + JRST SCOR ;Reset net, then back to main loop + +;Reset net, and potentially restart IMP +; Try restarting if IMP ready and -1(P) is negative. +; +;IMPUP is -1 so no new opens can happen. + +SYSNT5: + ;PCLSR those users running in OPEN. + ; + MOVEI U,0 +IFN NCPP,[ + PUSHJ P,LSTSTP ;PCLSR all users in .OPEN + NETLST + MOVSI I,-IMPSTL +SYSNT2: SKIPL A,IMSOC1(I) + JRST SYSNT1 + HRRZS A + SKIPN UNAME(A) + JRST SYSNT1 + MOVE T,APRC(A) + TLNE T,BULGO ;Tree is being deleted anyway. + JRST SYSNT1 + PUSHJ P,IFSTOP ;Stop network user + PUSHJ P,CHSCAA + PUSHJ P,SYSNT3 ;Hack IOCHNM words of net user +SYSNT1: AOBJN I,SYSNT2 +];NCPP + + ;Disconnect all STYs from the network + ; + MOVEI I,NFSTTY+NSTTYS-1 +SYSNT6: + PUSHJ P,NSTYN0 + JFCL + CAILE I,NFSTTY + SOJA I,SYSNT6 + +IFN NCPP,[ + ;Clean up connections which were closing + ; + CONO PI,UTCOFF + MOVSI I,-IMPSTL +SYSNT7: SKIPL H,IMSOC1(I) + JRST SYSNT4 + PUSHJ P,IMPBRT ;RETURN BUFFER + TLNN H,200000 ;IN PROCESS OF CLOSING? + JRST SYSNT4 ;NO, IGNORE + SETZM IMSOC1(I) ;FLUSH SOCKET + SOS IMNCS ;DECREASE COUNT OF CLOSES IN PROCESS +SYSNT4: AOBJN I,SYSNT7 ;LOOP THRU ALL SOCKETS + SKIPE IMNCS ;SKIP IF 0 MORE CLOSES + BUG PAUSE,DEC,IMNCS,[NET CHANNELS NOT CLOSED YET] + CONO PI,UTCON +];NCPP + + ;Maybe try to bring the IMP up again + ; + MOVEI U,0 + SKIPG -1(P) ;If last time down was < half minute ago, + CALL IMPCKR ; or IMP ready line is not set, + JRST LSWCLR ; then don't try to bring it up again + PUSHJ P,IMPINI +IFN NCPP,PUSHJ P,LSWCLR ;Restart old network users + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ /IMP up again./] + JRST SYSSTD ;Print and return + +IFN NCPP,[ +SYSNT3: HRRZ C,(R) + CAIL C,NETDUI + CAILE C,NETDBO + POPJ P, ;NOT A NETWORK CHANNEL + HLRE C,(R) ;SOCKET MAP INDEX + JUMPL C,CPOPJ + HRROS (R) ;SET LH OF IOCHNM TO -1 + HRRZ C,R + SUBI C,IOCHNM(A) + CAIL C,20 + POPJ P, ;ON IOPDL + MOVE C,CHNBIT(C) + AND C,MSKST2(A) + IORM C,IFPIR(A) ;INTERRUPT USER + POPJ P, +];NCPP +];IMPP + +;Try to bring IMP up if desirable +SYSIMU: +IFE IMPP,POPJ P, ;No IMP, no work +IFN IMPP,[ + SKIPGE IMPTCU ;Already trying to come up? + POPJ P, ;Yes, no meddling needed + CALL IMPCKR ;Check if IMP ready line is now + JRST [ SETZM IMPTCU ;IMP not ready, we are down and not trying + POPJ P, ] ; to come up. Give up now + PUSH P,[-1] ;Force SYSNT5 to try and restart IMP if called + SKIPGE IMPUP ;Do this only if imp is temporarily down. + PUSHJ P,SYSNT5 ;Reset world, restart IMP + JRST POP1J ;Clean up and exit +];IMPP + +; PUSHJ P,LSTSTP +; LIST ;WHERE LIST/ +;STOPS ALL JOBS ON THE LIST, AND PUT THEM ON OUR LSWPR. +;LIST SHOULD BE LINKED THROUGH THE RH, AND EACH WORD IN THE LIST SHOULD BE +;IN THE USER VAR BLOCK OF SOME JOB. THAT JOB IS CONSIDERED TO BE ON THE LIST. +;0 IN THE RH MEANS NIL. +LSTSTP: MOVE T,@(P) ;POINTER TO FIRST ELEMENT OF LIST + CONO PI,CLKOFF + MOVE T,(T) +LSTST1: HRRZS T + SKIPN A,T ;ADDRESS OF LSWB BLOCK + JRST CLKOJ1 + MOVEI A,-USRSTG(A) + IDIVI A,LUBLK + IMULI A,LUBLK ;USER INDEX + PUSH P,(T) + PUSHJ P,IFSTOP ;STOP USER, ADDING HIS USTP TO OUR LSWPR + POP P,T + JRST LSTST1 + SUBTTL SYSTEM JOB TYPE-OUT ROUTINES + +;PRINT "/ <@D> " IN OCTAL. +;USED BY SYSSET. CLOBBERS A,B,T. +SYSSCT: HRRZS A + PUSHJ P,SYSOPT + MOVEI T,"/ + PUSHJ P,STYO + PUSHJ P,STYOT ;TAB + MOVE A,(D) ;GET CURRENT VALUE + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,C ;GET NEW VALUE + JRST SYSFWP + +;STRING <- I, SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSSTD: PUSHJ P,SYSSP + +;SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSTCR: PUSHJ P,SYSTPT + +;TYPE A CRLF. CLOBBERS T. +SYSCRF: SOS CTLCNT ;Countdown number of lines printed. + MOVEI T,15 + PUSHJ P,STYO + MOVEI T,12 + JRST STYO + +SYSTPT: PUSHJ P,STYOS ;TYPE SPACE, TIME + CONSZ PI,200 ;IF IN BUGDD0, MUSTN'T CALL GLPDTM + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + IDIVI A,SPD + PUSHJ P,RTIME ;CONVERT TO SIXBIT. + MOVE B,A ;DROP INTO SYSTCD + +SYSTCD: LDB A,[301400,,B] + PUSHJ P,SYSTWR + LDB A,[141400,,B] + PUSHJ P,SYSTWR + MOVE I,[140600,,B] + JRST SYSIX2 + +;PREPARE FOR TYPING OUT A MESSAGE ON THE CONSOLE TTY. CALL HERE BEFORE +;STARTING TO TYPE A LINE, IF THERE IS A CHANCE THAT SYS JOB MIGHT JUST +;BE STARTING TO TYPE AFTER A PERIOD OF SILENCE. +WARMTTY:PUSHJ P,SYSCOP ;GET SYSTEM TTY READY TO USE + .IOT STYOC,[^P] ;ADVANCE TO FRESH LINE + .IOT STYOC,["A] +WARMT2: +IFN 1, POPJ P, +.ELSE [ MOVE T,SYSCN + MOVE T,TTLTM(T) ;DON'T DO THIS IF THERE'S BEEN ACTIVITY IN 2 MINUTES. + ADDI T,115.*30. + CAML T,TIME + POPJ P, + PUSH P,[[MOVEI T,^H + JRST WARMT1]] + SKIPA T,[175] ;WARM UP TELETYPE (ONLY ON AI-KA FOR NOW) +];END .ELSE +DINGTTY: SKIPA T,[^G] ;DING DING +WARMT1: PUSHJ P,.+1 + PUSHJ P,.+1 + JRST STYO + +;ROUTINE TO "OPEN" A CHANNEL TO THE SYSTEM CONSOLE +;IT'S DONE THIS WAY SO THAT THE CONSOLE CAN STILL BE +;USED AS A USER CONSOLE WHEN NECESSARY. SYSTEM JOB +;MESSAGES WILL JUST COME OUT FROM TIME TO TIME. + +SYSCOP: HRLZ T,SYSCN ;FAKE UP AN IOCHNM WORD + ADD T,[%TJDIS+%TJMOR,,TYODN] + SKIPGE SYSCN + MOVEI T,NLODN ;IF NO SYS TTY AVAIL, USE NUL DEVICE + MOVEM T,IOCHNM+STYOC + POPJ P, + +;TYPE OUT THE SIXBIT WORD IN B, QUIT WHEN WHAT IS LEFT IS BLANK +SYS6: JUMPE B,CPOPJ ;RETURN WHEN NOTHING LEFT + MOVEI A,0 ;INITIALIZE FOR LSH + LSHC A,6 ;SHIFT A CHARACTER IN + MOVEI T,40(A) ;CONVERT TO SIXBIT AND GET IN T + PUSHJ P,STYO ;TYPE OUT THE CHARACTER + JRST SYS6 ;LOOP BACK FOR NEXT CHARACTER + +;PRINT A MESSAGE ON ALL FREE CONSOLES. 40 SET IN LH(I) => IT IS ADDR OF ROUTINE; +;ELSE IT IS ADDR OF AN ASCIZ STRING TO BE TYPED FOLLOWED BY THE TIME AND A CRLF. +SYALCP: TLNN I,40 + HRLI I,440700 ;SYSTEM ALL CONSOLES PRINT + MOVEI A,0 +SYALC1: PUSHJ P,SYSTSU + AOJA A,SYALC3 + TLNE I,40 + JRST SYALC5 + MOVE Q,I ;SO NOT TO MUNG I UNTIL END +SYALC2: ILDB E,Q + JUMPE E,SYALC4 ;JUMP IF DONE + .IOT STYOC,E ;COPY CHARACTER + JRST SYALC2 ;GO GET NEXT CHARACTER + +SYALC5: PUSH P,I + PUSH P,A + PUSHJ P,(I) + POP P,A + POP P,I +SYALC6: MOVSI E,%TACFM + IORM E,TTYSTA(A) ;DONT NEED CONSOLE FREE MSG ANY MORE + AOS A ;INCREMENT CONSOLE NUMBER +SYALC3: CAIGE A,NCT+IFN N11TYS,[1-N11TYS] ;IF MORE CONSOLES LEFT, + JRST SYALC1 ;THEN PRINT OUT ON NEXT ONE + JRST SYSCOP ;FINALLY RE-OPEN SYSTEM CONSOLE. + +SYALC4: PUSH P,[SYALC6] ;PUT TIME AT END OF MESSAGE + PUSH P,A ;IF WE KNOW WHAT TIME IT IS + PUSH P,B + PUSHJ P,GLPDTM + JRST POPBAJ + PUSH P,I + IRPC A,,[ AT] + .IOT STYOC,["A] ;PUT TIME IN UP/DOWN MESSAGES + TERMIN + PUSHJ P,SYSTPT + POP P,I + JRST POPBAJ + +SYSTSU: CONO PI,TTYOFF + MOVE T,TTYSTA(A) + TLZN T,%TACFM + JRST TTYONJ ;IN USE OR WILL GET CONSOLE FREE MSG => DON'T HACK IT + MOVEM T,TTYSTA(A) + CONO PI,TTYON + AOS (P) ;TTY NEEDS HACKING, SO SKIP. + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" THE CHANNEL. +SYSTS1: MOVE T,TTYOPT(A) + TLNN T,%TOIML + TLNN T,%TOMVU + POPJ P, ;IMLAC OR PRINTING TTY, DON'T CLEAR. + MOVEI T,^P + PUSHJ P,STYO + MOVEI T,"C + JRST STYO + + ;SYSTEM JOB RADIX PRINT-OUT ROUTINES + ;FULL WORD (TWO HALFWORD) OCTAL: +SYSFWP: TLNN A,-1 ;IF LH=0, + JRST SYSOPT ;THEN PRINT ONLY RH + LSHC A,-18. + HLLM B,(P) + PUSHJ P,SYSOPT + HLRZ A,(P) + MOVEI T,", ;",," BETWEEN HALFWORDS + PUSHJ P,STYO + PUSHJ P,STYO + + ;OCTAL PRINTOUT, NO LEADING ZEROS, HALFWORD MAXIMUM +SYSOPT: IDIVI A,10 + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSOPT +SYSRP2: HLRZ B,(P) ;ENTRY POINT FROM DECIMAL TYPEOUT ROUTINE +SYSRP1: MOVEI T,"0(B) ;" " " + JRST STYO + + ;DECIMAL PRINTOUT, COMMAS EVERY 3 DIGITS, FULLWORD MAXIMUM +SYSDPC: MOVE 0,A ;ROUTINE EXPECTS ARGUMENT IN A, CLOBBERS 0, A(=0+1), B(=A+1) +SYSDP5: IDIVI 0,1000. ;GET LEAST SIGNIFICANT 3 DIGITS IN A + JUMPE 0,SYSDPT ;PRINT HIGH ORDER DIGITS WITHOUT LEADING ZEROES + HRLM A,(P) + PUSHJ P,SYSDP5 + HLRZ A,(P) + MOVEI T,", ;SINCE 3*N DIGITS LEFT TO BE TYPED, N>0, + PUSHJ P,STYO ;PRINT OUT A COMMA + MOVEI T,3 ;NUMBER OF DIGITS TO PRINT OUT + ;ROUTINE TO PRINT OUT AS MANY DECIMAL DIGITS AS SPECIFIED IN T +SYSLZP: IDIVI A,10. + SOJLE T,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSLZP + JRST SYSRP2 + +;PRINT NUMBER IN A IN DECIMAL; CLOBBERS B, T. +SYSDPT: IDIVI A,10. + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSDPT + JRST SYSRP2 + +STYOQ: MOVEI T,"? ;TYPE OUT "?" + JRST STYO + +STYOT: SKIPA T,[11] ;TAB +STYOS: MOVEI T,40 ;TYPE OUT A SPACE +STYO: CONSO PI,200 ;PI ON? (SYSTEM UP) + JRST STYO1 + .IOT STYOC,T + POPJ P, + +;TYPE OUT DIRECTLY WHILE SYSTEM IS NOT RUNNING +STYO1: HRLM T,(P) + CAIN T,15 + SETZM T00POS + AOS T,T00POS + CAIL T,75. + PUSHJ P,SYSCRF + HLRZ T,(P) +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,T +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + ANDI T,177 ; ASCII for the 8080 + IORI T,400 ; Means a character is present + MOVEM T,8CTYOT + CONI T + IORI T,80INT + CONO (T) ; punch 8080 + SKIPE 8CTYOT ; wait for completion + JRST .-1 + HLRZ T,(P) ; God knows who might look at T... +] ;KS10P + POPJ P, + +;PRINT WORD IN I AS 12. OCTAL DIGITS. CLOBBERS J,T. +SYSP: MOVE J,[440300,,I] + MOVE I,T +SYSP1: ILDB T,J + ADDI T,"0 + PUSHJ P,STYO + TLNE J,770000 + JRST SYSP1 + POPJ P, + +SYSSP: HRLI I,440700 ;ENTRY TO TYPE C(I) AS A POINTER TO ASCIZ +SYSSP2: ILDB T,I + JUMPE T,CPOPJ + PUSHJ P,STYO + JRST SYSSP2 + +SYSTWR: LSH A,30-18. + ADDI A,(SIXBIT / :/) + MOVE I,[220600,,A] + JRST SYSIX2 +SYSSIX: PUSHJ P,STYOS ;TYPE A SPACE AND FALL IN +SYSIXP: MOVE I,[440600,,A] ;ENTRY TO TYPE OUT C(A) AS SIXBIT +SYSIX2: ILDB T,I + ADDI T,40 + PUSHJ P,STYO + TLNN I,770000 + POPJ P, + JRST SYSIX2 diff --git a/system/sysjob.117 b/system/sysjob.117 new file mode 100644 index 0000000..28a63b2 --- /dev/null +++ b/system/sysjob.117 @@ -0,0 +1,2812 @@ +; -*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +SUBTTL DEMON JOB INTERFACE ROUTINES + ;GIVE STUFF TO DEMON JOB RUNNING IN USER MODE, WHICH THEN OUTPUTS + ;STUFF IN ITS OWN FORMAT TO THE DISK + ;COMMUNICATION IS VIA DMNBUF (BUFFER) AND POINTERS, + ;DEMON JOB FINDS IT BY LOOKING UP SYSTEM SYMS + + ;USAGE: + ;ROUTINES MUST BE CALLED WITH CLK OFF OR IN PROGRESS + ;FIRST CALL DMNP TO SET UP D AS "PDL POINTER" INTO DMNBF + ;DMNPSH ADR ;PUSH ADR INTO DMNBF (ASSEMBLES INTO A PUSH) + ;FIRST WORD PUSHED SHOULD HAVE ENTRY TYPE DESCRIPTOR IN HIGH SIX BITS + + ;ENTRY TYPE DESCRIPTORS: +DMNELI==10000 ;LOGIN (DMNPLI) +DMNELO==20000 ;LOGOUT (DMNPLO) + ;^ ADD MORE AS NEEDED, NEED NOT BE SYMBOLIC BUT PLEASE COMMENT THEM HERE FOR XREF + + ;DMNRS ;NORMALLIZE POINTER (DUE TO STANDARD LENGTH ENTRY IN TABLE) + ;ASSEMBLES INTO ONE STORAGE WORD + ;THEN CALL (PUSHJ) DMNRT WHICH STORES BACK D + ;ALL DMNPSH'S SHOULD BE ASSEMBLED BEFORE DMNRT; + ;ALL ROUTINES SHOULD BE BETWEEN THIS PAGE AND DMNBUF + +;DMNSZ (# ENTRIES IN DMNBF) DEFINED EARLY IN SYSTEM ENGLISH SO CAN BE CHANGED EASILY + +DMNFMT==2 ;ASCENDING FORMAT NUMBER, SHOULD BE INCREMENTED EACH TIME + ;A CHANGE IS MADE REQUIRING CHANGE IN CODING EITHER OF DEMON JOB + ;OR OF PROGRAMS READING ITS OUTPUT +;DMNFNT 1 -> 2 9/71 SWAPIN RQ INCLUDED W/LOGOUT + +DMNBAC==0 ;DMNPSH COUNTER, AFTER FIRST TIME GETS RE-INITIALIZED TO DMNBLM + +DEFINE DMNPSH ADR + DMNBAC==DMNBAC+1 + PUSH D,ADR +TERMIN + +IF1,DMNBEL==0 ;BECOMES LENGTH PER ENTRY IN DMNBF + +DEFINE DMNRS + ADDI D,DMNBEL-DMNBAC +IF1,IFG DMNBAC-DMNBEL,DMNBEL==DMNBAC +DMNBAC==DMNBLM +TERMIN + + ;PUSHJ P,DMNP ;SET UP D FOR DMNPSH'S INTO DMNBF + +DMNP: MOVE D,DMNBFP ;GET POINTER + CAIL D,DMNBFE-1 ;AT END OF BUFFER? + MOVEI D,DMNBF-1 ;YES, RE-INITIALIZE + AOS DMNBC ;INDICATE ENTRY ABOUT TO BE FILLED, SO DEMON KNOWS IF IT LOST +DMNP0: ;DMNP0 MAY BE CALLED IN USER MODE FROM DEMON JOB + DMNPSH TIME ;FIRST WORD IN BUFFER ALWAYS TIME OF ENTRY + ;^ MAYBE ADD MORE STANDARD PUSHES HERE + POPJ P, + +DMNBLM==DMNBAC ;NUMBER OF INITIAL WORDS PUSHED + + ;PUSHJ P,DMNRT (BUT USUALLY JRST DMNRT FOR RETURN) + ;DMNBF ENTRY COMPLETED, STORE BACK POINTERS + +DMNRT: TLZ D,-1 ;CLEAR OUT LEFT HALF OF POINTER + CAIL D,DMNBFE ;AFTER END OF BUFFER? + JRST 4,.+1 ;DMNBF POINTER INCREMENTED INCORRECTLY SOMEWHERE ALONG THE LINE + ;PROBABLY PROGRAMMER FORGOT TO DO DMNRS; CODING AFTER DMNBF MIGHT BE CLOBBERED + AOS DMNBD ;ENTRY COMPLETE, GIVE IT TO DEMON JOB + MOVEM D,DMNBFP + POPJ P, + + ;NOW FOR INDIVIDUAL ROUTINES + + ;LOGIN + +DMNPLI: PUSHJ P,DMNP ;SET UP + HRLI U,DMNELI ;INDICATE LOGIN + ;PUT FOLLOWING INTO DMNBF: + DMNPSH U ;INDEX OF USER BEING LOGGED IN + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME + DMNPSH JNAME(U) ;JNAME + DMNPSH TRMNAM(U) ;TERMINAL NAME + DMNPSH XUNAME(U) + DMNRS ;THAT'S ALL + JRST DMNRT + + ;LOGOUT + +DMNPLO: PUSHJ P,DMNP ;SET UP D + PUSHJ P,LOGUSE ;GET TREE'S USAGE IN T AND TT + HRLI U,DMNELO ;INDICATE LOGOUT + ;PUT FOLLOWING IN DMNBF FOR DEMON JOB TO DUMP OUT ON DISK: + DMNPSH U ;INDEX OF USER BEING LOGGED OUT + TLZ U,-1 + DMNPSH UNAME(U) ;UNAME OF USER + DMNPSH JNAME(U) ;JNAME + DMNPSH TT ;TIME USED, IN 4.069 USEC UNITS + DMNPSH T ;# SWAPIN REQUESTS (THESE VALID SINCE LOGUSE ALREADY CALLED) + ;^ ADD MORE HERE + ADDM TT,LOUTIM ;COUNT UP TOTAL TIME USED BY ALL LOSERS + DMNRS + JRST DMNRT + +DMNPL0==CPOPJ ;DMNPL0 MAY BE CALLED FROM DEMON JOB IN USER MODE + ;IT IS NO LONGER POSSIBLE TO MAKE THIS WORK RIGHT, + ;SO WE JUST RETURN. PFTHMG DRAGON SHOULD BE FIXED. + +EBLK + ;DEMON VARIABLES, MUST FOLLOW CODING + ;USE CARE IN REDEFINING SYMBOLS ON THIS PAGE; DEMON JOB RUNNING IN USER MODE + ;LOOKS AT SOME OF THEM, EXCEPT AS INDICATED + +DMNBF: BLOCK DMNBEL*DMNSZ ;BUFFER +DMNBFE:: + +DMNBC: 0 ;ENTRY COUNT, INCREMENTED JUST BEFORE ENTRY ADDED TO DMNBF (USED BY DEMON) +DMNBD: 0 ;ENTRY COUNT, INCREMENTED JUST AFTER " " " +DMNBFP: DMNBF-1 ;POINTER INTO BUFFER, HAS ADR OF LAST WORD WRITTEN (NOT USED BY DEMON) +VSCLAU: 0 .SEE VSCLA1 ;LAST JOB TREE ACCOUNTING UPDATE DONE FOR + ;NO MORE CODING ALLOWED AFTER THIS POINT + +DEFINE DMNPSH A +INFORM DMNPSH AT .,\. +TERMIN + +DEFINE DMNRS +INFORM DMNRS AT .,\. +TERMIN + +BBLK + +SUBTTL "SYSTEM" JOBS + +IFN TPLP,[ +TPLI==11 ;PSEUDO LPT IN +PRTO==12 ;REAL LPT OUT +] +IFN DEMON,TPLI==11 ;FOR DEMON HACKER +IFN DEMON,TEMPC==16 ;FOR TESTING WHETHER DEMON FILE EXISTS. +STYOC==17 ;OUTPUT " + +;CODE FROM ICLR TO SCOR EXECUTED ONLY ONCE (SEE BEG) +ICLR: MOVE A,[GO,,GO+1] ;PICK UP BLT POINTER (COPY EXCH WORD INTO NEXT) + SETZM GO ;CLEAR FIRST WORD + BLT A,IEND ;CLEAR OUT INITIALIZING CODE (IN AREA TO BE USER VAR BLOCKS) + SKIPL CORRQ ;SKIP IF CORE RQ FOR SYSTEM'S SPACE PROCESSED + PUSHJ P,UFLS ;WAIT AS NECESSARY + PUSHJ P,SYSCOP ;"OPEN" SYSTEM CONSOLE CHANNEL +IFN CCLKP,[ + JRST .+3 ;JFCL FOR CHESS CLK MODE + PUSHJ P,CLQAD1 + CCLKB +];CCLKP +IFN IMPP,[ + MOVE A,TIME + MOVEM A,LNETIM + PUSHJ P,IMPINI +];IMPP + MOVEI A,IINTIC + MOVEM A,IINCNT +SCOR: MOVE P,SYSPDP + MOVE U,USER + CONO PI,CLKON + MOVE A,TIME + ADDI A,30.*60.*5 ;5 MINUTES BEFORE SHUTDOWN? + SKIPLE SHUTDN + CAMG A,SHUTDN + JRST .+3 + SKIPN SUSRS + JRST SYSOUT ;JUMP IF SYS DYING & NO ONE LOGGED IN + MOVE T,[.HANG] + MOVEM T,FORTY ;TELL PEEK WHAT OUR UFLS REALLY IS. + MOVE T,TIME + MOVEM T,SYSITM + SKIPN SUPCOR ;SKIP IF ANY BITS ON IN SUPCOR + PUSHJ P,UFLS ;HANG TILL A BIT ON +;SYS JOB IS HUNG IF SYSITM IS 30 SEC OLD AND PC ISN'T SCOR1. +SCOR1: MOVSI A,(SETZ) + MOVEI B,0 +SYSDP1: TDNE A,SUPCOR + JRST SYSDP2 +SYSDP3: LSH A,-1 + JUMPE A,SCOR + AOJA B,SYSDP1 + +SYSDP2: SKIPGE SYSDTB(B) ;SKIP UNLESS 4.9 BIT OF ENTRY ON + ANDCAM A,SUPCOR ;4.9 ON, CLEAR SUPCOR BIT + LDB C,[370200,,SYSDTB(B)] + TRNE C,2 ;IF ROUTINE IS GOING TO USE TTY, + PUSHJ P,WARMTTY ;THEN WARM IT UP FOR IT + TRNE C,1 + PUSHJ P,DINGTTY + LDB T,[420100,,SYSDTB(B)] ;GET 4.8 BIT + JUMPE T,@SYSDTB(B) ;IF 4.8 BIT = 0, JUMP TO ROUTINE + PUSH P,A ;4.8 .NE. 0, SAVE A + PUSH P,B ;SAVE B + PUSHJ P,@SYSDTB(B) ;CALL ROUTINE + POP P,B ;RESTORE B + POP P,A ;RESTORE A + LDB T,[410100,,SYSDTB(B)] ;GET 4.7 BIT + JUMPE T,SYSDP3 ;IF ZERO RETURN TO LOOP + ANDCAM A,SUPCOR ;NON-ZERO, CLEAR SUPCOR BIT + JRST SYSDP3 ;LOOP + +SUBTTL SUPCOR DISPATCH TABLE + +;DISPATCH TABLE FOR BITS IN SUPCOR +;4.9 = 1 TO CLEAR SUPCOR BIT BEFORE DISPATCHING +;4.8 = 0, JRST TO ROUTINE ; = 1, PUSHJ +;4.7 = 1 TO CLEAR SUPCOR BIT AFTER (ONLY USEFUL IF PUSHJ) +;4.6 WARM UP TELETYPE BEFORE CALL +;4.5 DING BEFORE CALL + +SCL==1,,525252 ;BIT TYPEOUT MASK FOR SUPCOR +SCR==525252 ; .. + +SYSDTB: +SCLEX==400000 ? 300000,,SYSEX ;INCREASE USER-VAR BLOCK SPACE. +SCLSHD==200000 ? 340000,,SYSSHD ;HANDLE .SHUTDN - PRINT "GOING DOWN" MESSAGES. +SCLOUT==100000 ? 400000,,SYSOUT ;TIME FOR SYSTEM TO GO DOWN. +IFE KS10P,[ 660000,,SYSCK5 ;CHECK FOR DEVICES GIVING SPURIOUS INTERRUPTS. + SCLCK5==040000] +IFN KS10P, 400000,,SYSDP3 +SCLDAT==020000 ? 600000,,DATIME ;CONTINUE TRYING TO DETERMINE DATE AND TIME. +SCLPAR==010000 ? 360000,,PARTYP ;PRINT "PARITY ERROR..." +SCLSET==004000 ? 340000,,SYSSET ;DEPOSIT IN SYSTEM (.SETLOC). +SCLIMP==002000 ? 600000,,SYSIMU ;PRINT "NETWORK UP ..." +SCLWRT==001000 ? 340000,,SYSWRT ;PRINT WRITING-ON-SYS: MESSAGE. +SCLLGI==000400 ? 340000,,SYSLGI ;PRINT LOGIN MESSAGE. +SCLDEC==000200 ? 300000,,SYSDEC ;DECREASE USER-VAR SPACE. +SCLVSK==000100 ? 600000,,VSCLK ;VERY SLOW (2 MINUTE) CLOCK. +SCLGUN==000040 ? 600000,,SYSGUN ;FLUSH TREES THAT ARE TRYING TO LOG OUT. +SCLNET==000020 ? 460000,,SYSNET ;BRING NCP DOWN AND UP. +IFN DEMON,[ 600000,,DEMCHK ;RUN ANY DEMONS WHICH NEED IT. + SCLDMN==000010] +IFE DEMON, 400000,,SYSDP3 +SCLNXM==000004 ? 360000,,NXMTYP ;PRINT "NON-EX MEM ERROR ..." +IFE KA10P,[ +SCLBPF==000002 ? 360000,,BPFTYP ;BAD PAGE FAIL +].ELSE 400000,,SYSDP3 +SCLIDK==000001 ? 600000,,ISYS ;DISK IS INITIALIZED +SCRTPP==400000 ? 600000,,TPLPRT ;TRANSFER DATA TO LPT (FROM TPL) +SCRTPC==200000 ? 600000,,VSCL6 ;SEE IF ANY FILES HAVE BEEN SPOOLED. + 400000,,SYSDP3 +SCRHNG==040000 ? 600000,,SYSDIL ;DIALUP LINE CONNECT OR DISCONNECT +SCRDET==020000 ? 600000,,SYSDT ;DETACH TOP-LEVEL JOBS WITH INTERRUPTS. +SCRCFM==010000 ? 600000,,SYSCFM ;PRINT CONSOLE FREE MSGS +SCRMSG==004000 ? 640000,,SYSMPR ;PRINT RANDOM SYSTEM MESSAG + REPEAT 5,400000,,SYSDP3 ;CAN BE SET BY USER (.SUPSET) +IFN N11TYS,[ 600000,,VWHO ;UPDATE WHO LINES (40) + SCRWHO==000040] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11D ;TV 11 GONE DOWN (20) + SCR11D==000020] +.ELSE 400000,,SYSDP3 +IFN N11TYS,[ 640000,,SYS11U ;TV 11 COME UP, INIT IT (10) + SCR11U==000010] +.ELSE 400000,,SYSDP3 +IFE DEMON, 400000,,SYSDP3 ;(4) +IFN DEMON,[ 600000,,DMNOFF + SCRDMF==000004] +SCRTPF==000002 ? 300000,,TPLOFF ;BLOCK TPL. +SCRCKS==000001 ? 600000,,SYSCKS ;PERFORM CHECKSUMMING + +IFN .-SYSDTB-36.,.ERR SYS JOB DISPATCH + +SUBTTL DM DAEMON OVERSEER + +IFN DEMON,[ +DEMCHK: PUSHJ P,SYSDEX ;HANDLE REQUESTS TO KNOW WHETHER A FILE + ;EXISTS TO BE SIGNALLED AS A DEMON. + PUSHJ P,LSWTL ;SYSTEM JOB SIEZES DEMON TABLE SWITCH WITH UTCOFF + 400000,,DEMSW + MOVE B,DMLSEX + CAMN B,[-DMLNG,,0] ;IF AT BEGINNING OF TABLE SET FLAG + TDZA D,D + SETOM D +DMSCN9: SKIPE TT,DMTTBL(B) + SKIPE DMTTBL+1(B) ;ONLY PAY ATTENTION IF NOT DOWN + JRST DMSCN1 ;AND GUY THERE + MOVE T,DMTTBL+2(B) + HRRE C,T + TLNE T,-1 + JRST DMSCN3 + JUMPLE C,DMSC10 +DMSCN0: SKIPG DMNFLG + JRST DMSC11 ;IF FLAG SET CAN'T LOAD EM + CAME TT,[SIXBIT /UNSPOO/] + JRST DMSCN4 ;DON'T BOTHER WITH TPL STUFF, IF NOT TPL + SKIPGE TPLFLG + JRST DMSC10 ;REMOVE FROM WORLD + JRST DMSCN4 + +DMSCN4: HLRM T,DMTTBL+3(B) ;SET UP IMPLICIT REQUEST + CONO PI,UTCON ;ATTEMPT LOAD HERE + MOVE T,DMTTBL(B) + MOVEM T,DMOBLK+2 ;CHECK TO SEE IF FILE EXITS + .IOPUSH TPLI, + .OPEN TPLI,DMOBLK ;DON'T WORRY CAN'T PCLSR + JRST DMSCN5 ;OPEN FAILURE + .IOPOP TPLI, ;GET BACK STUFF + HRROI T,DMTTBL(B) + PUSHJ P,NUJBST ;TRY TO LOAD + JRST DMSCN6 ;COME BACK LATER, NO ENTRY FOR THIS GUY. +DMSCN8: ADD B,[DMTLL,,DMTLL] + SKIPL B + MOVSI B,-DMLNG + MOVEM B,DMLSEX ;FIX UP TABLE +DMSCN7: MOVSI B,SCLDMN + IORM B,SUPCOP ;IF MORE REQUESTS, RUN AGAIN IN 1 SECOND. + SOSLE REQCNT ;NO MORE REQUESTS => + JRST LSWPOP + SETZM REQCNT + ANDCAM B,SUPCOP ;DON'T RUN AGAIN. + ANDCAM B,SUPCOR ;THEN CLEAR OUT SUPCOR BIT + JRST LSWPOP + + +DMSCN5: .IOPOP TPLI, ;FILE DOESN'T EXIST + CONO PI,UTCOFF +DMSC10: PUSHJ P,DEMMRV ;REMOVE DEAMON + JRST DMSCN8 ;AND REQUEST + +DMSCN3: JUMPG C,DMSCN0 ;LOAD + JRST DMSCN1 + +DMSCN2: CONO PI,UTCON ;CONTINUE AROUND LOOP + ADD B,[DMTLL,,DMTLL] +DMSCN6: MOVEM B,DMLSEX + JRST LSWPOP ;COME BACK LATTER WITHOUT FLUSHING REQ + +DMSCN1: ADD B,[DMTLL,,DMTLL] ;ADD ON VAL + JUMPL B,DMSCN9 ;CONTINUE AROUND LOOP + MOVSI B,-DMLNG + MOVEM B,DMLSEX + JUMPE D,UTOLKJ +DMSC11: SETZM REQCNT ;IF RAN THROUGH WHOLE TABLE WITHOUT ANY PROCESS + CONO PI,UTCON + JRST DMSCN7 ;FLUSH ALL REQUESTS AND RETURN + +DMNOFF: MOVNS TT,DMNFLG + JUMPLE TT,DMNOF1 ;DEAMONS OFF + PUSHJ P,LSWTL + DEMSW +DMNOF3: SKIPE DMTTBL(B) + SKIPE DMTTBL+1(B) + JRST DMNOF2 + AOS REQCNT +DMNOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,DMNOF3 + MOVSI B,SCLDMN + IORM B,SUPCOR + JRST LSWPOP + +DMNOF1: MOVSI B,SCLDMN + ANDCAM B,SUPCOR + SETZM REQCNT ;ZERO COUNT + POPJ P, + +;CALL HERE TO HANDLE ALL JOBS THAT ARE WAITING IN .DEMSIG TO +;BE TOLD WHETHER A PURPORTED DEMON REALLY EXISTS. GIVE THEM +;THEIR ANSWERS AND START THEM UP AGAIN. +SYSDEX: SETZ A, + MOVEI C,'SYS + MOVE D,['ATSIGN] +SYSDE1: CONO PI,CLKOFF + SKIPN SRN3(A) ;THIS JOB'S ALREADY BEEN SERVICED?^ + SKIPN UNAME(A) ;OR DOESN'T REALLY EXIST? + JRST SYSDE3 + MOVE B,UPC(A) ;IS IT WAITING FOR SERVICE FROM US? + XORI B,ADEMS1 ;MUST BE IN EXEC MODE AT THE RIGHT PLACE. + TDNE B,[%PCUSR,,-1] + JRST SYSDE3 + MOVE E,AC0S+A(A) ;GET THE FN2 IT WANTS TO CHECK. + CONO PI,CLKON + SETZ T, ;T GETS 0 IFF FILE CAN BE OPENED. + .OPEN TEMPC,C + CAIA + JRST SYSDE2 + LDB T,[220600,,IOCHST+TEMPC] + SKIPN T + MOVEI T,%ENSFL +SYSDE2: .CLOSE TEMPC, + CONO PI,CLKOFF + SKIPN UNAME(A) ;SEE IF JOB IS STILL WAITING FOR SERVICE + JRST SYSDE3 ;SO IT ISN'T CLOBBERED IF IT GOT AN + MOVE B,UPC(A) ;INTERRUPT AND IS DOING SOMETHING ELSE. + XORI B,ADEMS1 + TDNN B,[%PCUSR,,-1] + CAME E,AC0S+A(A) + JRST SYSDE3 + MOVEM T,AC0S+T(A) ;GIVE THE JOB ITS ANSWER IN T, AND + SETOM SRN3(A) ;TELL THE JOB IT HAS BEEN SERVED. +SYSDE3: CONO PI,CLKON + ADDI A,LUBLK + CAMGE A,USRHI + JRST SYSDE1 + POPJ P, +];DEMON + +SUBTTL VERY SLOW CLOCK + +;SUBROUTINES CALLED BY THE VERY SLOW CLOCK. + +;CHECK FOR DEMON REQUESTS WHOSE TIME HAS COME. +IFN DEMON,[ +VSCLDM: PUSHJ P,LSWTL + DEMSW + MOVSI B,-DMLNG +VSCLD2: SKIPG DMTTBL+3(B) ;IF SPECIFIC ENTRY IS < = O, IGNORE + JRST VSCLD1 + SOSE DMTTBL+3(B) + JRST VSCLD1 + HLRZ T,DMTTBL+2(B) ;SIGNAL DEAMON + MOVEM T,DMTTBL+3(B) + MOVE A,DMTTBL(B) + PUSHJ P,DEMSIG ;SIGNAL REQUEST FOR THIS GUY + BUG ;ENTRY IN TABLE NOT FOUND EVEN THOUGH NON ZERO TIME +VSCLD1: ADD B,[DMTLL,,DMTLL] + JUMPL B,VSCLD2 + JRST LSWPOP +] + +;CHECK FOR CLOBBERED TEN-11 INTERFACE CONTROL PAGE WORDS, +;AND RESET THEM TO THEIR CORRECT SETTINGS. +IFN TEN11P,[ +T11CK: SKIPE TEN11F + POPJ P, + MOVSI I,-256. +T11CKL: MOVE A,T11MP(I) + CAMN A,[-1] + MOVEI A,0 ;HARDWARE SHOULD BE 0 ON CONFLICT PAGE + TLZ A,174000 ;USAGE COUNT + MOVE B,400000+T11CP*2000(I) + CAME A,B + JRST T11ERR +T11CL1: AOBJN I,T11CKL + POPJ P, + +T11ERR: AOS T11ERC + MOVEM A,400000+T11CP*2000(I) + MOVEM A,T11CCN + MOVEM B,T11WCN + MOVEM I,T11PG + JRST T11CL1 +] + +;VERY SLOW CLOCK (EVERY 2 MIN). SIGNALLED BY SCLVSK, SET BY A CLOCK-QUEUE ENTRY. +;CALLS THE ULTRA-SLOW CLOCK (EVERY 2 HOURS) WHEN IT'S TIME. + +VSCLK:;JSP E,CHECK ;CHECK FOR CLOBBERED DEVICES (WOULD BE NICE, BUT BUGS...) +IFN DEMON,PUSHJ P,VSCLDM ;DEAMON SLOW CLOCK BREAK ROUTINE +IFN TEN11P,PUSHJ P,T11CK + MOVE U,VSCLAU ;ACCOUNTING UPDATE, FIND A JOB TREE +VSCLA1: ADDI U,LUBLK + CAML U,USRHI + MOVEI U,0 + SKIPE UNAME(U) + SKIPL SUPPRO(U) + JRST VSCLA1 + HRLO TT,UNAME(U) + AOJE TT,VSCLA1 ;DON'T IF NOT LOGGED IN YET + MOVEM U,VSCLAU + CONO PI,CLKOFF + PUSHJ P,LOGUPD + PUSHJ P,DMNPLI + CONO PI,CLKON + MOVE U,USER + SKIPLE CTLCNT ;Time to print date on console log? + JRST VSCLA2 ; No. + PUSHJ P,GLPDTM ;Yes - get localized pdtime. + JRST VSCLA2 ; Can't print time if we don't know it. + PUSHJ P,WARMTTY ;Warm up tty, newline. + PUSHJ P,DATIM6 ;Print what time it is now. + MOVEI TT,CTLMAX ;Restart countdown of lines printed. + MOVEM TT,CTLCNT +VSCLA2: PUSHJ P,VSCOLD ;CHECK FOR OLD DETACHED TREES TO BE KILLED + PUSHJ P,TTTMNT ;TURN OFF MOTORS OF IDLE TERMINETS. +VSCL7: SETOM UFDFLF ;CAUSE CORE JOB TO TRY TO FLUSH 2311 UFDS + AOS NCORRQ + MOVSI I,-NCLCH ;LOOK FOR UNOPEND CORE LINK BUFFERS THAT HAVE BEEN + PUSHJ P,SWTL ;AROUND FOR MORE THAN 2 MINUTES + CLOSW +VSCLCL: SKIPE CLSYN(I) ;SKIP IF VARS UNUSED + SKIPL A,CLUSR(I) + JRST VSCLC2 + AOJN A,VSCLC2 ;JUMP IF OPEN + MOVE TT,CLRAC(I) + TLOE TT,200000 + JRST VSCLCR ;BIT ALREADY ON, BUFFER OLD + MOVEM TT,CLRAC(I) +VSCLC2: AOBJN I,VSCLCL ;LOOP FOR ALL SETS OF VARIABLES + PUSHJ P,LSWPOP ;RELEASE SWITCH + + MOVE A,UTTBF ;IF MANY 200-WORD BUFFERS ARE FREE, + CAIGE A,8 + JRST .+3 + SETOM UTBFLF ;HAVE THE CORE JOB FLUSH THEM + AOS NCORRQ + +IFN IMPP,[ + SKIPGE IMPUP ;SKIP IF IMP UP, OR PERMANENTLY DOWN + PUSHJ P,SYSIMU ;TRY TO BRING IT UP +];IMPP +IFN TPLP,PUSHJ P,VSCL6 ;MAYBE START PRINTING FROM .LPTR. +IFN NLPTP,[ + SKIPL NLUSR ;IF LPT ISN'T IN USE, + JRST VSCNL1 + AOS TT,NLFREE ;KEEP TRACK OF HOW LONG THAT'S BEEN SO. + SOJN TT,VSCNL1 ;IF TRUE FOR >=2 VSCLK INTREVALS (4 MIN) + CONO NLPT,1000 ;TURN LPT MOTOR OFF: 1ST PUT LPT IN IMAGE MODE + DATAO NLPT,[.BYTE 7 ? 24 ? 177 ? 177 ? 177 ? 177] ;THEN TURN OFF. +VSCNL1:] + SOSLE IINCNT + POPJ P, + +;IT'S TIME FOR THE ULTRA-SLOW CLOCK + MOVEI A,IINTIC ;GET HERE EVERY TWO HOURS OR SO + MOVEM A,IINCNT + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + PUSHJ P,WARMTTY + JRST DATIM6 ;TIME KNOWN, TELL SYSTEM CONSOLE + +VSCLCR: HRRZ A,TT + PUSHJ P,BRTN ;RETURN BUFFER + SETZM CLSYN(I) ;FREE VARIABLES + JRST VSCLC2 + +;CHECK FOR TREES WITH BUMRTL SET THAT HAVE NOT RUN FOR +;A WHOLE HOUR, AND GUN THEM. +VSCOLD: SETZB U,J + CONO PI,CLKOFF + MOVSI B,BUMRTL + MOVSI C,BULGOS + MOVE A,TIME + SUBI A,60.*60.*30. ;1 HOUR AGO +VSCOL0: SKIPE UNAME(J) + TDNN B,APRC(J) + JRST VSCOL1 ;JOB NON EX OR DOSN'T HAVE BUMRTL + SKIPGE SUPPRO(J) ;NO GOOD IF NOT TOP LEVEL. + TDNE C,APRC(J) ;IGNORE JOBS THAT ARE ALREADY LOGGING OUT. + JRST VSCOL1 + CAML A,LUBTM(J) ;NOT RUNNING AND HASN'T RUN FOR 1 HOUR => GUN. + JRST VSCOL2 +VSCOL1: ADDI J,LUBLK ;KEEP LOOKING TILL FIND JOB THAT NEEDS GUNING. + CAMGE J,USRHI + JRST VSCOL0 + JRST CLKONJ ;NO TREES NEED TO BE GUNNED. + +VSCOL2: MOVEI I,[ASCIZ /KILLED HOUR-OLD DETACHED JOB, # /] + PUSHJ P,SYSJEX ;PRINT MESSAGE AFTER CALLING ALOGO6 + PUSHJ P,ALOGO6 + JRST VSCOLD ;LOOK FOR ANOTHER TREE TO GUN. + +; MOVEI I,[ASCIZ/DID FOO TO JOB # /] +; PUSHJ P,SYSJEX +; PUSHJ P,FOO +;DOES FOO TO THE JOB WITH IDX IN J, AND PRINTS A SYSTEM MSG. +;FOO WILL FIND THE USR IDX IN A AND J. IT IS OK TO ENTER +;SYSJEX WITH CLOCK OFF BUT FOO MUST TURN IT ON. +SYSJEX: HRRZS A,J + PUSH P,JNAME(A) + PUSH P,UNAME(A) + PUSH P,A ;SAVE ALL THE INFO WE NEED FOR THE MESSAGE. + PUSH P,I + XCT @-4(P) ;DO "FOO" + JFCL ;LET FOO SKIP. + AOS -4(P) ;SKIP OVER THE PUSHJ TO FOO. + PUSHJ P,WARMTTY + HRRZ I,(P) + PUSHJ P,SYSSP ;PRINT THE STRING IN I + POP P,I + HLRZS I + SKIPE I + PUSHJ P,(I) ;IF LH(I) WAS NONZERO, CALL THAT PRINT ROUTINE + POP P,A + IDIVI A,LUBLK + PUSHJ P,SYSOPT ;PRINT THE JOB # + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + POP P,A + PUSHJ P,SYSIXP ;PRINT UNAME, AND SPACE + PUSHJ P,STYOS + POP P,A + PUSHJ P,SYSIXP ;PRINT JNAME + JRST SYSTCR ;SPACE, TIME AND CR. + +SUBTTL TPL + +VSCL6: ;CHECK TPL: SEE IF LPT FREE AND ANY FILE TO PRINT. +IFN UNSPLP,[ + PUSHJ P,LSWTL + DEMSW + MOVE A,[SIXBIT /UNSPOO/] + PUSHJ P,DEMSIG + JRST LSWPOP ;REQUEST FAILED, TOO BAD + JRST LSWPOP +] + +IFE TPLP,POPJ P, +IFN TPLP,[ + MOVEI A,SCRTPP ;ALSO ENTER HERE FOR TPL CHECK + TDNE A,SUPCOR ;SKIP IF NOT ALREADY PRINTING FILE + POPJ P, + IFG LPTP-1,[ + SKIPE TPLSWP + JRST VSCL6A + SKIPLE NLPTBR + SKIPL LPTUSR + POPJ P, +VSCL6B: + ] + IFLE LPTP-1,[ + SKIPL LPTUSR + POPJ P, + ] + IFG OLPTP-NLPTP,[ + MOVEI A,132. + CAMLE A,LPTCC + POPJ P, + ] + IFG NLPTP-OLPTP,[ + CONSO NLPT,207 + SKIPG NLPTBR + POPJ P, ;.OPEN OF LPT WOULD HANG + ] + MOVEI A,SCRTPF + TDNE A,SUPCOR ;BLOCKED + POPJ P, + .OPEN TPLI,[SIXBIT / TPL.FILE.(DIR)/] ;MAKE SURE FILE DIR IN CORE + JRST VSCLX1 + MOVEI B,2 +VSCL2: .IOT TPLI,A + CAIE A,^C + CAIN A,12 + SOJG B,VSCL2 + JUMPN B,VSCL2 + SETOB I,C + SETZM TPLFN1 + SETZM TPLFN2 + MOVEI B,TPLFN1 + HRLI B,440600 +VSCL2A: .IOT TPLI,A + CAIN A,"* + JUMPL I,VSCL4 + CAIE A,^C + CAIN A,14 + JRST VSCLX1 + CAIN A,40 + JUMPL I,VSCL2A ;IGNORE SPACES BEFORE THE PACK NUMBER. + CAIN I,3 ;AFTER 4 CHARS STARTING WITH BEGINNING OF PACK NUMBER + JRST VSCL2E ;COMES THE START OF THE FN1. + CAIN A,"L + MOVEI C,0 ;INDICATE LINK + AOJA I,VSCL2A ;FIRST NON SPACE CRUFTY + +IFG LPTP-1,[ +VSCL6A: MOVEI A,132. + CAMG A,LPTCC + SKIPL OLPUSR + POPJ P, + JRST VSCL6B +] + +VSCL2E: MOVEI TT,6 +VSCL2B: SUBI A,40 + IDPB A,B + .IOT TPLI,A + SOJG TT,VSCL2B + MOVE B,[440600,,TPLFN2] +VSCL2C: .IOT TPLI,A + SUBI A,40 + IDPB A,B + TLNE B,770000 + JRST VSCL2C + .IOPUSH TPLI, + .OPEN TPLI,TPLFN + JRST VSCLL1 ;TRY AGAIN + .IOPOP PRTO, + .CLOSE PRTO, +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST VSCL3A +] + CONSZ NLPT,207 + JRST VSCLX1 + MOVEI T,LPTBSZ + CAMN T,NLPTBR ;SKIP ON OPEN WOULD HANG + .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +IFN OLPTP,[ + JRST VSCL3B +VSCL3A: +]] +IFN OLPTP,[ + MOVEI A,132. + CAMG A,LPTCC ;SKIP IF .OPEN WOULD HANG +IFN NLPTP,.OPEN PRTO,[3,,'OLP] +.ELSE .OPEN PRTO,[3,,(SIXBIT /LPT/)] + JRST VSCLX1 +VSCL3B: +] + MOVEI A,SCRTPP + IORM A,SUPCOR ;PRINT THIS FILE + IORM A,SUPCOP ;PRINT MORE EVERY SECOND. + JRST TPLPRT + +VSCLL1: .IOPOP TPLI, + JUMPL C,VSCLX1 + MOVEI B,1 ;LINK THAT DIDN'T EXIST + JRST VSCL2 +] + +IFN TPLP,[ +;COME HERE TO TRANSFER SOME CHARS FROM DSK TO LPT, +;ASSUMING BOTH CHNLS ALREADY OPEN. +TPLPRT: +IFN NLPTP,[ +IFN OLPTP,[ + SKIPE TPLSWP + JRST TPLPR3 +] + MOVEI A,TPLBSZ + CAMLE A,NLPTBR + POPJ P, +IFN OLPTP,[ + JRST TPLPR5 +TPLPR3: +]] +IFN OLPTP,[ + MOVEI A,10.*TPLBSZ ;LEAVE SPACE FOR CHARS THAT TAKE MORE THAN 1 CHAR + CAMLE A,LPTCC + POPJ P, +TPLPR5: +] + MOVE A,[-TPLBSZ,,TPLBUF] ;"UN-RELOCATE" + .IOT TPLI,A + MOVE B,A + MOVNI A,-TPLBUF(A) + HRLZS A + JUMPE A,TPLPR1 ;JUMP ON END OF FILE + HRRI A,TPLBUF + .IOT PRTO,A + JUMPL B,TPLPR1 ;LAST BUFFER-FULL PRINTED + JRST TPLPRT + +TPLPR4: CLEARM TPLFN3 + .FDELE TPLFN ;DELETE FILE JUST PRINTED + JFCL + MOVEI A,SCRTPP + ANDCAM A,SUPCOP ;DON'T NEED TO CALL TPLPRT EVERY SECOND. + ANDCAM A,SUPCOR +VSCLX1: .CLOSE PRTO, + .CLOSE TPLI, + POPJ P, + +VSCL4: .IOT TPLI,A + CAIN A,14 + JRST VSCLX1 + CAIN A,12 + JRST VSCL2A + JRST VSCL4 + +TPLPR1: PUSHJ P,TPLPR4 + JRST VSCL6 +] +.ELSE TPLPRT==CPOPJ + +;HANDLE A USER'S REQUEST TO "BLOCK THE TPL" +IFN TPLP,[ +;IF SYS JOB IS SPOOLING, JUST THROW AWAY CURRENT FILE. +TPLOFF: MOVEI A,SCRTPP + TDZN A,SUPCOP + POPJ P, ;NOTHING HAPPENING + PUSHJ P,WARMTTY + .RESET PRTO, + PUSHJ P,TPLPR4 + MOVE A,[SIXBIT /TPLOFF/] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +IFE TPLP+UNSPLP,TPLOFF==CPOPJ + +IFN UNSPLP,[ +TPLOFF: MOVNS B,TPLFLG + JUMPG B,VSCL6 ;IF NOW RUNNING GIVE REQ + MOVSI B,-DMLNG +TPLOF1: SKIPE C,DMTTBL(B) + SKIPG D,DMTTBL+1(B) ;USER INDEX -0 IF NOT YET LOADED + JRST TPLOF2 + CAME C,[SIXBIT /UNSPOO/] + JRST TPLOF2 + PUSH P,U + MOVE U,D + PUSHJ P,ALOGOUT ;DOES ONE USTOP FOR YOU + POP P,U + JRST TPLOF3 + +TPLOF2: ADD B,[DMTLL,,DMTLL] + JUMPL B,TPLOF1 +TPLOF3: PUSHJ P,WARMTTY + MOVE A,[SIXBIT /TPLOFF/ ] + PUSHJ P,SYSIXP + JRST SYSTCR +] + +SUBTTL WHO LINES + +IFN N11TYS,[ +;PDP11 COMM AREA (SYSTEM WIDE) +;STARTS AT PDP11 ADDRESS 40 +;PNTR TO TT11HD +;PNTR TO POINTA +;I/O VERSION # +;SORCE FILE VERSION # +;--PDP10 WD BOARDARY-- 0 , INITED +; 0 , GODOWN + +;AT POINTA: +; ADDR OF SYSTEM WHO-LINE VARS +; ADDR OF 10-11 COMMAND BUFFER +; TENWHO , 0 ;PDP10 SETS TO TELL PDP11 TO UPDATE WHO-LINES +; MAXTV , 0 ;MAXTV = # TV'S 11 IS SET UP TO HANDLE +; NF11TY , 0 ;10 TELLS 11 WHAT TTY # OF 1ST BUFFER IS. + +;PDP11 CONSOLE VARS +; EVEN PDP11 WORD ODD PDP11 WORD +;TT11HD - CHAIN OF ACTIVE INPUT BUFFERS 0 +; PNTR TO OUTPUT BUFFER CHNL 0 VIDEO BUFFER,KBD # (377 IF NONE) +; " CHNL 1 " +;... +; OUTPUT BFR EMPTY NOTIFY RQ FLAG TO FREE CHNL +;... +; PNTR TO WHO LINE BLOCK FREE + +;THE 11 HAS COME UP, SO INIT COMMUNICATION VARIABLES AND START USING IT +SYS11U: SKIPG TT11P + POPJ P, + LDB A,[$11AD0,,TT11HA] ;GET PDP10 ADDRESS OF INPUT-BFR-CHAIN PTR + CAIL A,NTTPG*2000 + BUG HALT,[GARBAGE POINTER IN TV-11 MEMORY] + ADDI A,TT11LO + CONO PI,TTYOFF + MOVEM A,TT11HD ;SAVE IT FOR CLOCK LVL TO CHECK. + LDB C,[$11WD0,,TT11HA+1] ;GET PDP11 IO VERSION #. + MOVEI B,12. ;OLD TV PROGRAMS HANDLE 12. BUFFERS + LDB T,[$11AD1,,TT11HA] ;GET ADDR OF POINTA + CAIL C,3 ;VERSION 3 AND UP TV PGM HAS MAXTV - READ IT + LDB B,[$11WD0,,TT11LO+2(T)] + MOVEM B,TT1111 ;THAT'S HOW MANY TV'S THE 11 THINKS TERE ARE + CAIL B,N11TYS + MOVEI B,N11TYS ;MIN OF THAT AND # TEN THINKS THERE ARE + MOVEM B,TT11RL + MOVEI B,NF11TY + CAIL C,3 ;VERSION 3 TV PGM AND UP WANTS NF11TY + DPB B,[$11WD0,,TT11LO+3(T)] + HRLZ I,TT11RL ;GET AOBJN -> TV'S BOTH 10 AND 11 WILL HANDLE. + MOVNS I +VSCL7C: LDB B,[$11AD0,,1(A)] ;GET DPY BUFFER ADRESS FOR THIS TTY + ADDI B,TT11LO+2 ;CONVERT TO PDP10 ADDRESS. + HRLI B,040000+TT11BY_6 ;GET BP TO ILDB 1ST DATA WORD. + MOVEM B,NF11TY+TOBBP(I) ;PNTR TO BEG OF OUTPUT BUFFER + LDB C,[$11AD0,,(B)] ;GET # BYTES IN DATA AREA + ADDI B,(C) ;GET BP TO LAST WORD IN AREA + MOVEM B,NF11TY+TOBEP(I) + MOVEM B,NF11TY+TOIP(I) + ADDI A,1 + AOBJN I,VSCL7C + MOVEM C,TT11OL ;REMEMBER LENGTH OF OUTPUT BUFFERS. + SETOM TT11P ;TV TTYS NOW UP. + CONO PI,TTYON + MOVE A,[-N11TYS,,NF11TY] + MOVSI B,%TACFM ;NOW SAY ALL PDP11 TTYS NEED + ANDCAM B,TTYSTA(A) ;CONSOLE FREE MESSAGES, + AOBJN A,.-1 + MOVEI A,SCRCFM + IORM A,SUPCOR ;TELL SYS JOB TO PRINT THEM. + PUSHJ P,CLQAD1 ;ADD WHO LINE BLOCK TO CLOCK QUEUE IF NOT THERE + WHOCLB + MOVEI I,[ASCIZ /TV 11 IS UP -/] + JRST SYSSTD ;STRING,SPACE TIME AND DATE THEN CR +] + +IFN N11TYS,[ + +$INSRT WHOVAR + +;UPDATE WHO-LINE VARIABLES. +VWHO: SKIPL TT11P ;DON'T SCREW UP IF PDP11 ISN'T UP. + POPJ P, + MOVE A,TT11HD + HRLZ A,TT11RL + MOVNS A + HRR A,TT11HD ;-<# TV'S BEING USED>,,
+ ADD A,TT1111 + ADD A,TT1111 ;NOW RH -> 2 11-WDS BEFORE PTR TO WHOLINE VARS OF 1ST TV +VWHO1: LDB B,[$11AD0,,1(A)] ;GET WHO LINE VAR PDP11-ADDR, SHIFTED 2. + ADDI B,TT11LO ;CONVERT TO PDP10 ADDRESS. + CONO PI,TTYOFF + MOVE TT,WHJOB(B) ;JOB # (SHIFTED 4+16.) + MOVE C,WHMODE(B) ;MODE (SHIFTED 4+16.) + JUMPG C,VWHO3 + CONO PI,TTYON + JUMPL C,VWHO2 ;MODE < 0 => NO WHOLINE. + HLRE I,A ;GET -<# TIMES REMAINING THRU LOOP> + ADD I,TT11RL + HRRZ TT,TTYSTS+NF11TY(I) ;MODE 0, USE JOB WHICH HAS THE TTY. + MOVE Q,TT + IDIVI Q,LUBLK + LSH Q,4.+16. + MOVEM Q,WHJOB(B) +;FOR OTHER MODES, COME BACK HERE, WITH USER IDX IN TT. +VWHO3R: CONO PI,CLKOFF + MOVE C,UNAME(TT) + HLLZM C,WHUNAM(B) + HRLZM C,WHUNM2(B) ;STORE THE JOB'S UNAME + MOVE C,JNAME(TT) + HLLZM C,WHJNAM(B) + HRLZM C,WHJNM2(B) ;AND JNAME. + MOVE C,USYSNM(TT) + HLLZM C,WHSNAM(B) + HRLZM C,WHSNM2(B) ;AND SNAME. + MOVE C,[SIXBIT /STOP/] + SKIPE USTP(TT) ;AND "STATUS": IF NOT RUNNABLE, "STOP". + JRST VWHO4 + MOVE C,[SIXBIT /RUN/] ;IF NOT WAITING, "RUN". + SKIPN FLSINS(TT) + JRST VWHO4A + MOVE C,[SIXBIT /PAGE/] ;DETECT WAITING FOR PAGE. + MOVE Q,USWST(TT) + TLNE Q,200000 + JRST VWHO4 + JRST VWHO4B + +VWHO4A: MOVE E,UPC(TT) ;JOB RUNNING: USER MODE? + TLNE E,%PCUSR ;IF SO, STATUS IS "RUN" (C ALREADY SET UP) + JRST VWHO4 +VWHO4B: MOVE E,SV40(TT) ;ELSE DECODE SYSTEM CALL TO GET STATUS. + HLRZ Q,E + CAIN Q,(.CALL) + JRST VWHO4D ;SYMBOLIC SYSTEM CALL. + TRZ Q,17_5 + MOVE I,OPTION(TT) + TLNN I,%OPDEC + JRST VWHO4E + CAIE Q,40_9 + CAIN Q,41_9 + JRST VWHO4F + CAIN Q,47_9 + JRST VWHO4F +VWHO4E: CAIN Q,(.IOT) ;.IOT => DECODE DEVICE IN USE. + JRST VWHOI1 + CAIN Q,(.OPER) + JRST VWHOO1 ;.OPER => DECODE ADDRESS FIELD. + CAIN Q,(.CALL) + JRST VWHOC1 ;.CALL BUT NOT SYMBOLIC => DECODE AC FIELD. + LSH Q,-9 + CAIL Q,40 + CAIL Q,40+NUUOSX +VWHO4F: SKIPA C,[SIXBIT /UUO/] ;UNRECOGNIZED UUO. + MOVE C,UUOSXB-40(Q) ;ELSE GET SIXBIT NAME OF UUO. + JRST VWHO4C + +;A SYMBOLIC SYSTEM CALL IS IN PROGRESS. +VWHO4D: MOVE C,LSCALL(TT) ;USE SYSTEM CALL NAME AS STATUS + CAME C,[SIXBIT /SIOT/] + CAMN C,[SIXBIT /IOT/] + JRST VWHOI2 ;BUT IF IT'S "IOT", DECODE DEVICE TYPE. +VWHO4C: SKIPE FLSINS(TT) + JRST VWHO4 + LSH C,-6 + TLO C,'+_12. ;STICK "+" ON FRONT IF RUNNING IN SYSTEM +;DROPS THROUGH ;(NOT IF IN USER MODE, OR IF HUNG). + ;DROPS IN +;COME HERE WITH STATUS AS SIXBIT IN C. +VWHO4: +IFE SWPWSP, SKIPL USWSCD(TT) ;SKIP IF SWAP-BLOCKED +IFN SWPWSP,[ MOVE Q,USWST(TT) + TLNN Q,%SWSB +] + JRST .+3 + LSH C,-6 + TLO C,(SIXBIT/>/) + HLLZM C,WHSTAT(B) + HRLZM C,WHSTA2(B) + MOVEI C,WHJ%RT(B) + HRLI C,442000 + MOVE Q,JTMU(TT) ;COMPUTE % RUN TIME FROM SCHEDULER PRIORITY. + MULI Q,100. + DIV Q,[2.^6] + IDPB Q,C + MOVE Q,UTRNTM(TT) + IDIVI Q,25000. + IDPB Q,C ;JOB RUNTIME IN .1 SEC UNITS. + MOVE Q,NMPGS(TT) + MOVE I,NSWPGS(TT) + SUBM Q,I + IDPB I,C ;JOB # REAL PAGES. + IDPB Q,C ;JOB # VIRTUAL PAGES. +;HANDLE THE USER-SPECIFIED FIELDS IN THE WHOLINE. + MOVE Q,UWHO1(TT) + ANDCMI Q,17 + MOVEM Q,1(C) ;STORE JOB'S WHOLINE FLAGS. + MOVE Q,UWHO2(TT) + HLLZM Q,2(C) ;STORE FIRST USER WHO VAR + HRLZM Q,3(C) + MOVE Q,UWHO3(TT) + HLLZM Q,4(C) ;STORE SECOND USER WHO VAR + HRLZM Q,5(C) +VWHO2: CONO PI,CLKON + AOBJN A,VWHO1 + JRST VWSYS + +VWHOO1: HRRZ Q,E ;JOB EXECUTING .OPER. + CAIL Q,MXOPR + SKIPA C,[SIXBIT/UUO/] + MOVE C,OPRSXB(Q) ;GET .OPER NAME AS STATUS + JRST VWHO4C + +VWHOI2: SKIPL Q,UUAC(TT) ;NEW SYS CALL IOT + JRST VWHO4C ;GETTING ARGUMENTS, UUAC NOT SET UP YET + MOVE I,C ;SAVE NAME IN I + JRST VWHOI4 + +VWHOI1: LDB Q,[270400,,E] ;.IOT + SETZ I, +VWHOI4: ADDI Q,IOCHNM(TT) ;Q HAS IOCHNM WORD ADDR FOR CHANNEL. + MOVE Q,(Q) ;GET IOCHNM WORD CONTENTS (RH INDEXES TABLES) + HLRZ C,Q + HLL Q,IOTTB(Q) ;LH GETS BITS SAYING DIRECTION, BLOCK VS UNIT. + HLL C,CLSTB(Q) + TLNE C,%CLSJ ;IF JOB DEVICE + JRST [ MOVE C,JBDEV(C) ;GET NAME OF SIMULATED DEVICE + JRST VWHOI6 ] + HLLZ C,DCHSTB(Q) ;C GETS DEVICE NAME (LEFT-JUST SIXBIT) + JUMPL C,VWHOI6 ;JUMP IF NORMAL 3-CHARACTER NAME + MOVSS C ;NO, IS ADDRESS OF 6-CHARACTER NAME + MOVE C,(C) +VWHOI6: SETZ D, ;EVENTUALLY MAKE STATUS BE 9 CHARS, NOT 6? + MOVE E,[360600,,C] + ILDB J,E ;FIND FIRST SPACE IN THAT DEVICE NAME + JUMPN J,.-1 + JUMPGE Q,VWHOI3 .SEE %IOTBK ;IF BLOCK MODE, PUT A "B" THERE. + MOVEI J,'B + DPB J,E + IBP E +VWHOI3: CAME I,[SIXBIT /SIOT/] + JRST VWHOI5 + MOVEI J,'S + DPB J,E + IBP E +VWHOI5: MOVEI J,'O ;FOLLOW WITH "O" OR "I" SAYING DIRECTION. + TLNN Q,%IOTOT + MOVEI J,'I + DPB J,E + JRST VWHO4C ;COMPLETED STATUS LOOKS LIKE "TTYBO". + +VWHOC1: LDB Q,[270400,,E] ;.CALL: GET AC FIELD, + MOVE C,CALSXB(Q) ;GIVE SIXBIT NAME OF .CALL. + JRST VWHO4C + +;MODE ISN'T 0: FIGURE OUT WHICH JOB TO DISPLAY WHO-LINE FOR, +;AND GO TO VWHO3R WITH JOB'S IDX IN TT. COME HERE WITH TTYCHN OFF. +VWHO3: LSH TT,-16.-4 ;WHAT JOB WAS LAST DISPLAY DONE FOR? + IMULI TT,LUBLK + CAMGE TT,USRHI + SKIPN D,UNAME(TT) + JRST VWHO3B ;JOB WE WERE LOOKING AT HAS VANISHED. + TLNE C,<-4>_<16.+4-18.> + JRST VWHO3B ;THIS TTY IS GETTING SYSTEM WHO-LINE. + TLNN C,2_<16.+4-18.> + JRST VWHO3E ;WANT SAME JOB AS LAST TIME. + +;MODE 2 OR 3: COME HERE TO SEARCH FOR DESIRED JOB. +VWHO3A: MOVSI E,1_<16.+4-18.> + MOVEM E,WHMODE(B) ;SWITCH TO MODE 1. + MOVEI E,MAXJ+5 ;DON'T LOOP FOREVER +VWHO3D: ADDI TT,LUBLK ;ADVANCE TO NEXT JOB UP OR DOWN. + TLNE C,1_<16.+4-18.> + SUBI TT,2*LUBLK + SKIPGE TT ;WRAP AROUND IF NEC GOING DOWN. + ADD TT,USRHI + CAML TT,USRHI ;WRAP AROUND IF NEC. GOING UP. + MOVEI TT,0 + CAMN D,UNAME(TT) ;BELONGS TO SOMEONE ELSE => KEEP GOING. + JRST VWHO3C ;BELONGS TO THIS USER => STOP. + SOJG E,VWHO3D ;KEEP LOOKING BUT DON'T LOOP IF NO JOB TO BE FOUND. +VWHO3B: SETZM WHSTAT(B) ;NO JOB TO BE FOUND. + CONO PI,TTYON + JRST VWHO2 + +VWHO3C: MOVE Q,TT ;DESIRED JOB FOUND: SET UP FOR MODE 1 + IDIVI Q,LUBLK ;LOOKING AT THIS JOB. + LSH Q,16.+4 + MOVEM Q,WHJOB(B) +VWHO3E: CONO PI,TTYON + JRST VWHO3R + + +;USER WHO LIES UPDATED; NOW UPDATE SYSTEM WHO LINE VARS. +VWSYS: LDB A,[$11AD1,,TT11HA] + LDB B,[$11AD0,,TT11LO(A)] + ADD B,[$11WD1,,TT11LO] ;FIRST WORD OF BLOCK SET BY 11 + MOVEI C,SRI + IDPB C,B ;ITS VERSION#. + MOVEI C,2 + MOVEI E,0 +IFN SWPWSP, MOVSI TT,%SWSB + MOVEI Q,2*LUBLK +VWSYS2: CAML Q,USRHI ;COUNT # JOBS. + JRST VWSYS1 + SKIPN UNAME(Q) + JRST VWSYS3 + AOS C ;C GETS # JOBS, + SKIPE USTP(Q) + JRST VWSYS3 +IFE SWPWSP, SKIPGE USWSCD(Q) +IFN SWPWSP, TDNE TT,USWST(Q) + AOS E ;E GETS NUMBER OF ACTIVE SWAPPED BLOCKED JOBS +VWSYS3: ADDI Q,LUBLK + JRST VWSYS2 + +VWSYS1: IDPB C,B ;TOTAL # JOBS + MOVE D,MMPCNT + IDPB D,B ;TOTAL MEM (= TOTAL # PAGES, COUNTING SHARED PAGES ONLY ONCE). + MOVE C,RNABLU + SUBI C,1 + IDPB C,B ;RUNNABLE USERS + IDPB E,B ;# SWAP-BLOCKED JOBS + MOVE TT,NPGWTU + IDPB TT,B ;# WAITING FOR PAGE. + MOVE C,TRUMM ;TOTAL RUNNABLE USER MEMORY + IDPB C,B + MOVEI C,0 + MOVE TT,USRHI ;COUNT PAGES AVAILABLE FOR USE OR ACTUALLY USED FOR USER MEM + ADDI TT,USRSTG+1777 + LSH TT,-10. +VWSYS5: LDB D,[MUR,,MEMBLT(TT)] + CAIE D,MURUSR + CAIN D,MUFR + AOS C ;FREE OR USER MEM. + CAIGE TT,TSYSM-1 + AOJA TT,VWSYS5 + IDPB C,B ;TOTAL MEM AVAIL FOR USERS + HLRZ C,QDATE + IDPB C,B + MOVE C,SYSDBG + IDPB C,B + AOS B ;SKIP A WHOLE WORD FOR TIME OF DAY + MOVEI D,(B) ;SAVE ADDRESS FOR BELOW + MOVE C,SUSRS ;# LOGGED IN USERS. + IDPB C,B + MOVEI E,10000. ;FAIR SHARE IN % + IDIV E,SLOADU ;BASHES TT + IDPB E,B + MOVE C,TIMOFF ;TIME OF DAY IN .5 SEC UNITS. + LSH C,4 + MOVEM C,(D) ;DEPOSITING TIME OF DAY TRIGGERS WHO-LINE UPDATE + POPJ P, ; BY THE PDP-11, SO DEPOSIT IT LAST + +] ;END IFN N11TYS + +SUBTTL EXPAND/CONTRACT USER VARIABLES AREA + +SYSEX: PUSHJ P,SCOREX + POPJ P, + MOVE A,TIME + MOVEM A,SCITM + POPJ P, + +SYSDEC: MOVE A,TIME ;TRY TO DECREASE CORE RESERVED FOR USER VARIABLES + SUB A,SCITM + CAIG A,50. + POPJ P, ;TOO SOON SINCE GOT MORE CORE + CONO PI,CLKOFF + MOVE A,USRHI + SUBI A,LUBLK + SKIPN UNAME(A) + JRST .-2 + ADDI A,LUBLK + MOVEM A,USRHI ;USRHI=> HIGHEST USER+L + ADDI A,USRSTG + ADDI A,1777 + SETOM SJCFF ;INHIBIT ALLOCATION WHILE HUSRAD IS CHANGING + CONO PI,CLKON + MOVEI U,0 ;FOR ACORE + LSHC A,-10.-36. ;MOVE INTO B AS WELL + PUSHJ P,ACORE + BUG ;LOST FLUSHING CORE? + CLEARM SJCFF + POPJ P, + +SCOREX: LDB B,[121000,,HUSRAD] ;EXTEND CORE FOR USER VARIABLES AT TOP OF SYSTEM + ADDI B,1 + CAILE B,LIOBLK + MOVEI B,LIOBLK ;TRYING TO GET TOO BIG, DON'T + MOVEI U,0 + JRST ACORE + +SUBTTL LOGGER OUT + +;THIS ROUTINE AWAKENED BY .LOGOUT, .GUN, ETC. +;SEARCH FOR TREES THAT ARE LOGGING OUT AND READY TO BE FLUSHED +;(IE HAVE BULGO SET) AND FLUSH THEM, PRINTING LOGOUT MESSAGE IF APPRO. +SYSGUN: SETZ U, +SYSGU0: MOVE T,APRC(U) + TLNE T,BULGO ;IS THIS JOB READY TO BE FLUSHED? + SKIPN UNAME(U) + JRST SYSGU1 +IFN NUNITS,[ + SKIPGE TTYTBL(U) ;IF CONSOLE-CONTROLLED, FLUSH UTAPE ASSIGNMENTS + JRST SYSGU2 + MOVSI I,-NUNITS + MOVE A,UNAME(U) + CAMN A,UTASS+1(I) + SETZM UTASS+1(I) + AOBJN I,.-2 +SYSGU2: ] + HLRO B,UNAME(U) + AOJE B,SYSGU3 ;IF THIS TREE COUNTS AS A LOGGED-IN USER, + SKIPL TTYTBL(U) + SOS SUSRS ;DECREMENT COUNT OF SUCH. +SYSGU3: CONO PI,CLKOFF + PUSHJ P,DMNPLO ;UPDATE TREE'S USAGE AND INFORM DEMON JOB + MOVEM TT,TRUNTM(U) ;SAVE RUN TIME FOR LOGOUT MSG + CONO PI,CLKON + SKIPGE A,TTYTBL(U) + JRST SYSGU4 ;IF TREE HAS CONSOLE, + SKIPE TTNTO(A) + BUG + PUSHJ P,TTYLO1 ;FREE IT. + CAMN U,EPDL(U) ;UNLESS GUNNED DOWN, + SKIPN SUPPLG ;MAY NOT WANT TO BOTHER PRINTING MESSAGE ON SYS CONSOLE + SKIPGE DEDTIM + JRST SYSGU4 ;IF LOGGED OUT BECAUSE SYS DOWN, SPARE THE LOGOUT MSG + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ / LOGOUT /] + PUSHJ P,SYSSP + MOVE A,UNAME(U) + PUSHJ P,SYSIXP ;UNAME. + PUSHJ P,STYOS ;SPACE. + HRRZ A,TTYTBL(U) + PUSHJ P,SYSOPT ;TTY #. + PUSHJ P,SYSTCR + ;VALUE PRINTED IS WRONG, AND HARD TO FIX, SO FOLLOWING CODE HAS BEEN FLUSHED. + ;THE REASON IT'S WRONG IS BECAUSE TIME ALREADY SENT TO THE DAEMON IS NOT INCLUDED. + ;MOVEI I,[ASCIZ / TUSED= /] + ;PUSHJ P,SYSSP + ;MOVE A,TRUNTM(U) + ;MULI A,4069. + ;DIVI A,1000. + ;PUSHJ P,SYSDPC + ;MOVEI I,[ASCIZ / USECS/] + ;PUSHJ P,SYSSTD + CAMN U,EPDL(U) ;WAS LOGGED OUT BY SELF? + JRST SYSGU4 + MOVEI I,[ASCIZ / ^^ GUNNED DOWN BY /] + PUSHJ P,SYSSP + MOVE A,SRN4(U) + PUSHJ P,SYSIXP ;UNAME OF GUNNER. + MOVE A,SRN5(U) + PUSHJ P,SYSSIX ;SPACE, AND JNAME OF GUNNER. + PUSHJ P,SYSTCR ;CRLF. +;MESSAGES PRINTED IF NECESSARY. +SYSGU4: SETZ R, + PUSHJ P,ZUSER ;COMPLETELY ELIMINATE THE JOB. + CONO PI,CLKON +SYSGU1: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSGU0 + SETZ U, + POPJ P, + +;DETACH ANY TREES WHOSE TOP-LEVEL JOBS HAD FATAL INTS + +SYSDT: SETZB U,J + PUSHJ P,SWTL + TREESW + CONO PI,CLKOFF + MOVSI B,BUSRC + MOVSI T,BULGOS+400000 +SYSDT0: SKIPN UNAME(J) + JRST SYSDT1 + SKIPGE SUPPRO(J) ;LOOK FOR TOP-LEVEL + TDNE T,APRC(J) ;IGNORE JOBS ALREADY DISOWNED, OR LOGGING OUT. + JRST SYSDT1 + TDNE B,USTP(J) ;THAT HAS BEEN STOPPED AS BY SUPERIOR + JRST SYSDT2 +SYSDT1: ADDI J,LUBLK + CAMGE J,USRHI + JRST SYSDT0 + JRST CLKOPJ ;NO MORE SUCH JOBS, DONE; LSWPOP AND CLKON. + +;FOUND A TOP LEVEL JOB NEEDING TO BE DETACHED. +SYSDT2: PUSH P,J + MOVE T,OPTION(J) + TLNE T,%OPLKF + JRST [ IDIVI J,LUBLK ;BASHES R + .CALL [SETZ ? 'UNLOCK ? SETZI %JSNUM(J)] ;UNLOCK THE LOCKS + BUG + MOVE J,(P) + JRST .+1 ] + CONO PI,CLKOFF ;IODCSS MIGHT HAVE TURNED IT ON + SKIPL E,JBI(J) ;NOTE CLKOFF IN EFFECT WHILE HACKING JOB DEVICE STUFF + SKIPGE JBCG(E) + JRST SYSDTA + MOVE A,JBCUI(E) ;JOB DEVICE, GIVE IOCER1 OR OPNL7 + LDB T,[000400,,JBSTS(E)] + CAIE T,1 + JRST [ MOVSI T,7_5 ;NON IOT, UNHANG CREATOR SO WILL SEE OPNL7 + MOVEM T,JBSTS(E) + MOVE T,FLSINS(A) + CAMN T,JBFLS + SETZM FLSINS(A) + JRST SYSDTA ] + MOVEI B,1 ;IOT GIVE IOCER1 + MOVS H,E + PUSHJ P,NSTIOC + JFCL +SYSDTA: POP P,J + SETZ U, + MOVE I,[SYSDT8,,[ASCIZ/TOP LEVEL INTERRUPT /]] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT7 + JRST SYSDT + +SYSDT8: MOVE A,-1(P) ;USER INDEX + MOVE A,PIRQC(A) ;TOP LEVEL INTERRUPT BITS + PUSHJ P,SYSFWP +SYSDT9: MOVEI I,[ASCIZ/ DETACHED JOB # /] + JRST SYSSP + +;JOB IN J SHOULD BE DETACHED, AND GUNNED AFTER AN HOUR, +; OR RIGHT AWAY IF NOT LOGGED IN +SYSDT4: HLRE B,UNAME(J) + AOJE B,SYSDT5 ;NOT LOGGED IN => KILL + HRLI I,SYSDT9 + PUSHJ P,SYSJEX + PUSHJ P,SYSDT3 + POPJ P, + +SYSDT5: HRLI I,[MOVEI I,[ASCIZ / KILLED JOB # /] + JRST SYSSP] + PUSHJ P,SYSJEX + PUSHJ P,SYSDT6 + POPJ P, + +SYSDT6: PUSHJ P,SYSDT3 ;FIRST DETACH (LEAVES USER INDEX OF TOP LEVEL JOB IN A). + JRST ALOGO6 ;THEN LOG OUT. SINCE DETACHED, NO ADDITIONAL MSG FROM SYSGUN. + +;CALL WITH CLOCK OFF TO DETACH THE JOB WITH IDX IN A AND J. +;ASSUME JOB'S BULGOS HAS BEEN CHECKED, AND TREESW LOCKED. +;TURNS CLOCK BACK ON AND DOES A LSWCLR +SYSDT7: TDZA B,B ;HERE TO LEAVE AROUND +SYSDT3: MOVEI B,10 ;HERE TO SET BUMRTL WHEN WE DETACH + PUSHJ P,SOSSET + DIELOK(A) + AOS DIELOK(A) + CONO PI,CLKON + MOVEM B,CTLBTS(U) + PUSHJ P,NDETA0 + BUG + POPJ P, + +IFN NDLTYS+NETYS,[ + +;HANDLE DIAL-UP LINE CONNECTS OR DISCONNECTS ON DL-10 AND DTE20. + +SYSDIL: +IFN NDLTYS,[ + SKIPN A,DL10CL + JRST SYSDL2 ;THERE'S NONE TO PROCESS? + SETZM DL10CL ;FREE THE VAR FOR THE PDP11 + PUSHJ P,SYSDL0 +SYSDL2: ];NDLTYS +IFN NETYS,[ + SKIPGE A,DTEHNG + JRST SYSDL3 + SETOM DTEHNG + PUSHJ P,SYSDL0 +SYSDL3: +];NETYS + POPJ P, + +SYSDL0: LDB I,[.BP 77,A] ;GET OUT THE TTY NUMBER + CAIL I,NCT + POPJ P, + TRNE A,-100 + JRST SYSDL1 ;IT'S A CONNECT + PUSHJ P,SWTL ;IT'S A DISCONNECT + TREESW + MOVE J,TTYSTS(I) ;DETACH THE TREE ON THAT TTY. + JUMPL J,LSWPOP ;THERE'S NO TREE. + TLNN J,%TSCNS + JRST LSWPOP ;TTY IS OPEN AS A DEVICE. + MOVE I,APRC(J) + TLNE I,BULGOS ;GIVE UP IF TREE LOGGING OUT. + JRST LSWPOP + MOVE U,USER + MOVEI I,[ASCIZ /DIALUP LINE DISCONNECTED,/] + JRST SYSDT4 + +;ON A CONNECT, SNARF THE LINE SPEEDS DETERMINED BY THE PDP11. +SYSDL1: LDB B,[.BP 7000,A] + DPB B,[$TTISP,,TTYTYP(I)] + LDB B,[.BP 700,A] + DPB B,[$TTOSP,,TTYTYP(I)] + PUSHJ P,NCNSSP ;SET UP INITIAL TTY TYPE AS PRINTING, ACCORDING TO SPEED + MOVEI B,20 ;DON'T ASSUME TTY IS AT LEFT MARGIN + MOVEM B,TTYIHP(I) + MOVEM B,TPHP(TT) + MOVEM B,TPHP+TPLEN(TT) + POPJ P, +];NDLTYS+NETYS +.ELSE SYSDIL==CPOPJ + +IFN N11TYS,[ +SYS11D: MOVEI I,[ASCIZ /TV 11 WENT DOWN --/] + PUSHJ P,SYSSTD ;STRING, SPACE, TIME AND CR + SETZM TT11P ;IN CASE SCR11D WAS SET BY A USER, AND HE DIDN'T HACK THIS. + MOVEI A,TT11HD+1 + MOVEM A,TT11HD ;PREVENT TT11IN FROM BEING CALLED ANY MORE. +SYS11G: PUSHJ P,SWTL ;PREPARE FOR DOING DETACHES + TREESW + MOVE I,[-N11TYS,,NF11TY] +SYS11F: SKIPGE J,TTYSTS(I) ;DETACH ALL 11TV TREES. + JRST SYS11E ;THIS 11TV NOT IN USE + TLNN J,%TSCNS + JRST SYS11P ;THIS 11TV IN USE AS A DEVICE, DON'T DETACH BUT DO PCLSR + MOVE T,APRC(J) + TLNE T,BULGOS + JRST SYS11E ;DON'T DETACH TREES THAT ARE LOGGING OUT. + MOVE U,USER + MOVEI I,[ASCIZ / .../] + PUSHJ P,SYSDT4 ;DETACH OR KILL JOB W/ # IN J, AND PRINT MESSAGE. + JRST SYS11G ;TREESW NOW UNLOCKED; MUST RE-LOCK. + +SYS11P: HRRZ A,J ;PCLSR THE NAME DRAGON + PUSHJ P,NJRPCL + PUSHJ P,NJUPCL ;AND DROP INTO SYS11E + +SYS11E: AOBJN I,SYS11F + PUSHJ P,LSWPOP ;TREESW NOT NEEDED IF NOTHING TO DETACH. + MOVSI T,-MXVBN ;FLUSH VIDEO BUFFER ASSIGNMENTS. + SETOM VBAST(T) + AOBJN T,.-1 + MOVEI T,0 +SYS11V: CAML T,USRHI + POPJ P, + SETZM NVDBA(T) + SETOM TVCREG(T) ;FLUSH TV BUFFER NUMBERS IN CREGS + ADDI T,LUBLK + JRST SYS11V + +TVBNCL: PUSH P,T ;"DEASSIGN" TVVBN(U) AND CLEAR IT ON SCREEN IF NECC + SKIPN TEN11F + SKIPL TT11P + JRST TVBNC1 + SKIPL T,TVVBN(U) + CAME U,USER + JRST TVBNC1 + PUSH P,400000+TTR10*2000 + MOVEM T,400000+TTR10*2000 + MOVE T,TVBLAD + CLEARM 400000+TTR0*2000(T) + POP P,400000+TTR10*2000 +TVBNC1: SETOM TVVBN(U) + JRST POPTJ +];N11TYS + +;PRINT CONSOLE FREE MSGS ON ALL TTYS THAT NEED IT. +;NOTE THAT THERE ARE LOWER CASE MESSAGES ON THIS PAGE. +.SEE TTYLO1 ;THIS RTN SIGNALLED WHEN A TTY BECOMES FREE. +SYSCFM: CLEARM IOCHNM+STYOC ;REUSE SYSTEM CONSOLE CHANNEL +SYSCF0: MOVEI A,0 +SYSCF1: CAIL A,NCT + JRST SYSCOP ;DONE, SWITCH SYSCON CHANNEL BACK TO SYSCON + SKIPGE B,TTYSTA(A) .SEE %TACFM + AOJA A,SYSCF1 + TLNE B,%TANJS + TLZ B,%TACTZ ;%TANJS MEANS A FAILED ^Z - FORGET ABOUT THAT ^Z. + MOVEM B,TTYSTA(A) + SKIPGE TTYSTS(A) .SEE %TSFRE + TLNE B,%TACTZ + AOJA A,SYSCF1 ;IN PROCESS OF LOADING TREE FOR THIS CONSOLE + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" A CHANNEL TO THAT TTY. + SKIPGE SHUTDN + PUSHJ P,SYSTS1 ;IF SHUTDOWN AND A DISPLAY, CLEAR THE SCREEN + MOVEI I,[ASCIZ / +Top level interrupt, tree detached +/] + MOVSI B,%TCDET ;IF TTY FREE DUE TO DETACH FOR TOP LEVEL INT, + TDNE B,TTYCOM(A) + PUSHJ P,SYSSP .SEE NDETAC ;SAY SO. + ANDCAM B,TTYCOM(A) + MOVSI B,%TANJS + ANDCA B,TTYSTA(A) + EXCH B,TTYSTA(A) ;CLEAR BIT, SAVE OLD VALUE + PUSH P,A + XCT DWNMSG + SKIPGE SHUTDN + JRST SYSCF2 ;SYSTEM IS DOWN, SAY SO + XCT SCMESG + CAMN A,SYSCN + JRST SYSCF2 ;SYSTEM JOB USING THIS CONSOLE, SAY SO + SRITYP [ System fully loaded. Console ] + TLNN B,%TANJS + SRITYP [ Console ] + PUSHJ P,SYSSP +IFN N11TYS, CAIE A,NF11TY ;ON ALL FREE PDP11-TV CONSOLES + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / Free./] + PUSHJ P,SYSSTD + XCT DMESSG + SKIPE SYSDBG +SYSCF2: PUSHJ P,SYSSTD ;SAY "SYS BEING DEBUGGED" IF NEC. + SKIPLE SHUTDN + PUSHJ P,SYSSHM ;SAY "SYS GOING DOWN" IF NEC. + POP P,A + MOVSI B,%TACFM ;TTY NO LONGER NEEDS CONSOLE FREE MSG. + IORM B,TTYSTA(A) +IFN N11TYS,PUSHJ P,TTYLO2 ;TELL THE PDP11 THIS TTY IS FREE + SETZM IOCHNM+STYOC + JRST SYSCF0 + +SUBTTL SHUTDOWN + +;HANDLE .SHUTDN - PRINT "GOING DOWN" MSGS, ETC. +SYSSHD: LDB D,[221700,,SHUTLK+1] + PUSHJ P,SWTL + SHUTLK + MOVEI I,SYSSHM + TLO I,40 + PUSH P,D + PUSHJ P,SYALCP + POP P,D + IMULI D,LUBLK + SKIPE D ;SKIP IF LEFT FROM >5 MIN PRINT OUT + SKIPN A,UNAME(D) + JRST LSWPOP + MOVEI I,[ASCIZ /CULPRIT = /] + PUSHJ P,SYSSP + PUSHJ P,SYSSIX + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,SYSTCR + JRST LSWPOP + +;GOING DOWN, WHAT A SHAME +SYSSHM: SRITYP [GOING DOWN IN ] + SKIPG SHUTDN + SRITYP [REVIVED] + PUSHJ P,SYSSP + SKIPG B,SHUTDN + JRST SYSSHN + SUB B,TIME + IDIVI B,30. ;CONVERT TO SECONDS + PUSHJ P,RTIME ;CONVERT TO SIXBIT + MOVE B,A + PUSHJ P,SYSTCD +SYSSHN: MOVEI I,[.ASCII /. /] + JRST SYSSTD + +;AND COME HERE WHEN TIME FOR SYS TO GO DOWN. +;MARK THE SYSTEM "DOWN", START FLAPPING TAPES AND DISKS, +;GUN ALL USERS, ETC. COMPLETION OF GOING DOWN IS DETECTED AT +;SLOW CLOCK LEVEL ("COFFIN"). +SYSOUT: PUSHJ P,CLQDEL + DEDBLK + SETOM DEDTIM ;PREVENT ^Z'S + .FDELE [SIXBIT/ SYSDOWN MAIL/ ? 0 ? 0] + JFCL + MOVEI U,LUBLK*2 +SYSCK3: SKIPGE SUPPRO(U) ;LOOK FOR ALL TOP-LEVEL JOBS. + SKIPN UNAME(U) + JRST SYSCK4 + MOVE T,USTP(U) + TLNE T,BUSRC + JRST SYSCK1 + MOVE T,OPTION(U) ;IS THIS JOB AN EXCEPTION? + TLNE T,%OPLIV + JRST SYSCK4 ;YES, LET IT LOG ITSELF OUT +SYSCK1: PUSHJ P,ALOGOUT ;LOG IT OUT (TELLS IT TO PREPARE ITSELF, SIGNAL SYSGUN) +SYSCK4: ADDI U,LUBLK + CAMGE U,USRHI + JRST SYSCK3 + SETZ U, +DWNMSG: SRITYP [NOT IN OPERATION] + PUSHJ P,SYALCP ;TYPE OUT ON FREE CONSOLES +IFN TPLP, MOVEI A,SCRTPF ;TPLOFF +IFN TPLP, IORM A,SUPCOR +IFN UNSPLP,[ SKIPG TPLFLG + JRST SYSCK0 + MOVEI A,SCRTPF + IORM A,SUPCOR +SYSCK0: +] MOVE I,QACTB + IORM I,QMDRO + MOVSI A,-NQS +SYSCK7: MOVE I,DCHBT(A) + SKIPN QACT(A) + IORM I,QTUTO(A) + AOBJN A,SYSCK7 +IFN NUNITS,[ + MOVEI A,1 +SYSUDM: SKIPL UDIRO(A) + .UDISMT A, ;DISMOUNT TAPES + CAIGE A,NUNITS + AOJA A,SYSUDM +] + MOVE T,TIME + MOVEM T,DTHTIM + SETOM SHUTDN + PUSHJ P,TTTMNT ;TURN OFF ALL TERMINET MOTORS + JRST SCOR + +SUBTTL SYSTEM CHECKS +;CHECK FOR DEVICES THAT LOSE THE PIA, DEVICES THAT INTERRUPT SPURIOUSLY, +;CLOBBERD LOCATIONS IN MEMORY. + +IFE KS10P,[ ; KS has no devices to speak of... + +SYSCK5: MOVSI A,-128. +SYSC51: SKIPL B,DCHNTC(A) +SYSC5A: AOBJN A,SYSC51 + JUMPGE A,CPOPJ + TLNN B,300000 + JRST SYSC5A + PUSH P,A + TLZE B,200000 + JRST SYSC52 + PUSHJ P,SYSC5S + JRST SYSC53 +SYSC52: PUSHJ P,SYSC5C +SYSC53: POP P,A + MOVSI B,300000 + ANDCAM B,DCHNTC(A) + JRST SYSC5A + +SYSC5C: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / CLOBBERED/] + JRST SYSSTD + +SYSC5S: PUSHJ P,SYSC5B + MOVEI I,[ASCIZ / SUSPECTED OF INTERRUPTING ON CHANNEL /] + PUSHJ P,SYSSP + LDB T,[360300,,DCHNTC(A)] + PUSHJ P,SYSSOP + JRST SYSTCR + +SYSSOP: PUSH P,A + PUSH P,B + MOVE A,T + PUSHJ P,SYSOPT + JRST POPBAJ + +SYSC5B: MOVEI I,[ASCIZ /DEVICE /] + PUSHJ P,SYSSP + HRRZ T,A + LSH T,2 + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ / (CONI= /] + PUSHJ P,SYSSP + HRRZ T,DCHNTC(A) + PUSHJ P,SYSSOP + MOVEI I,[ASCIZ /) /] + JRST SYSSP + +] ;IFE KS10P + +SYSCKS: HRRZ T,UPDBR1 ;CHECK FOR CLOBBERED DBRS + HRRZ TT,UPDBR2 + CAIN T,UPGMP + CAIE TT,UPGMP+100 + BUG HALT,[PAGER DATA CLOBBERED. MAY BE DEC-TTL LEVEL CONVERTERS LOSING.] +;DROPS THROUGH + ;DROPS IN + MOVE A,SYSCKP + MOVE B,(A) + MOVEI C,(B) + EQV C,(B) + AOBJN B,.-1 + CAME C,CKSUMS-TSTB(A) + JRST SYSKS2 + AOBJN A,SYSKS1 +SYSKS3: MOVE A,[-LTSTB,,TSTB] +SYSKS1: MOVEM A,SYSCKP + POPJ P, + +SYSKS2: EXCH C,CKSUMS-TSTB(A) + XOR C,CKSUMS-TSTB(A) ;SAVE XOR + PUSHJ P,WARMTTY + PUSHJ P,DINGTTY + MOVEI I,[ASCIZ /SYSTEM CLOBBERED BETWEEN /] + PUSHJ P,SYSSP + HRRZ A,(A) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / AND /] + PUSHJ P,SYSSP + MOVE B,SYSCKP + HLRE A,(B) + SETCMM A ;OFFSET BY ONE + ADD A,(B) + HRRZS A + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ / XOR= /] + PUSHJ P,SYSSP + MOVE A,C + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ / !/] + PUSHJ P,SYSSTD + CLEARM TCKXOR ;TRY TO DETERMINE EXACT ADR AND PREV CONTENTS + MOVE A,[TCKXOR,,TCKXOR+1] + BLT A,TCKXOR+35. + MOVE A,[-LTSTB,,TSTB] +SYSKS6: MOVE B,(A) +SYSKS5: MOVE C,(B) +REPEAT 36.,[IFL .RPCNT-18.,TLNE C,400000_<-.RPCNT> +IFGE .RPCNT-18.,TRNE C,400000_<18.-.RPCNT> + XORM B,TCKXOR+.RPCNT + ] + AOBJN B,SYSKS5 + AOBJN A,SYSKS6 + MOVSI D,-36. +SYSKS7: MOVE A,TCKXOR(D) ;UPDATE CKXORS TBL AND FILL TCKXOR TBL WITH POSSIBLE ADRS + EXCH A,CKXORS(D) + XOR A,CKXORS(D) + HRRZM A,TCKXOR(D) + AOBJN D,SYSKS7 + PUSHJ P,STYOT ;INDENT LINE + MOVSI D,-36. + MOVSI E,400000 ;CURRENT BIT + CLEARB I,J ;COUNT OF #'S PRINTED, CLOBBERED WD +SYSKS8: SKIPE A,TCKXOR(D) + AOJA J,SYSKS9 ;INCR COUNT OF ADRS PRINTED +SYSKT2: LSH E,-1 + AOBJN D,SYSKS8 + SOJN J,SYSKT1 ;MORE THAN 1 ADR CLOBBERD SO CANT PRINT PREV CONTENTS + MOVEI T,"= + PUSHJ P,STYO + MOVE A,I ;PRINT CONTENTS PRIOR TO CLOBBERAGE + XOR A,(R) ;XOR CURRENT CONTENTS + PUSHJ P,SYSFWP + MOVEI T,"- + PUSHJ P,STYO + MOVEI T,"> + PUSHJ P,STYO + MOVE A,(R) + PUSHJ P,SYSFWP ;CURRENT CONTENTS +SYSKT1: PUSHJ P,SYSCRF + JRST SYSKS3 + +SCKX1: PUSH P,T ;UPDATE CKXORS TO REFLECT CHANGING WD IN T IN ADR IN Q + MOVSI C,-36. +SCKX2: SKIPGE T + XORM Q,CKXORS(C) + LSH T,1 + AOBJN C,SCKX2 + JRST POPTJ + +SYSKS9: PUSHJ P,SYSOPT + PUSHJ P,STYOS + MOVE R,TCKXOR(D) ;CLEAR DUP ENTRIES + MOVE T,D + MOVE Q,E ;ALSO LEAVE LAST ADR IN R (IN CASE ITS ONLY ADR) +SYSKT3: CAME R,TCKXOR(T) + JRST SYSKT4 + CLEARM TCKXOR(T) + XORM Q,I +SYSKT4: LSH Q,-1 + AOBJN T,SYSKT3 + JRST SYSKT2 + +SUBTTL SUPPORT ROUTINES FOR BUG MACRO + +;NOTE: THESE REPLACE THE SYSMSG ROUTINE THAT USED TO BE HERE + +;ENTRY POINTS +BUGCHK: PUSH P,TT + MOVE TT,SYSMPT ;HOW MANY MESSAGES BEHIND? + SUB TT,SYSMPU + CAIGE TT,<8_SYSMLNG>-8 + SKIPE SYSDBG + JRST BUGPSE+1 ;TREAT AS BUGPSE IF BUFFER FULL OR SYSDBG + CAIA +BUGINF: PUSH P,TT + PUSHJ P,SYSMS0 ;HAND MESSAGE TO SYSTEM JOB TO BE PRINTED + JRST POPTTJ ;CONTINUE TRAPPED ROUTINE + +BUGPSE: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/PAUSE. FIND A WIZARD, CONSIDER TAKING A CRASH DUMP, +OR TYPE P TO ATTEMPT TO REVIVE THE SYSTEM./ + +BUGDDT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER + JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/DDT. TYPE P TO CONTINUE./ + +BUGNIL: PUSH P,TT + JRST BUGHL1 ;NO MESSAGE, JUST GO STRAIGHT TO DDT. + +BUGAWF: 0 ;JSR HERE WHEN AWFUL THINGS HAVE HAPPENED + CONO PI,PIOFF ;BETTER DO THIS AS SOON AS POSSIBLE + MOVEM P,BUGACS+P ;SAVE P AND GET A PDL TO USE + MOVE P,BUGPDL + PUSH P,BUGAWF ;SIMULATE PUSHJ P,BUGHLT +BUGHLT: PUSH P,TT + PUSHJ P,SYSMS0 ;COPY MESSAGE INTO SYSTEM JOB BUFFER +BUGHL1: JSP TT,BUGDD0 ;PRINT MESSAGE AND GO TO DDT + ASCIZ/HALT. FIND A WIZARD OR CONSIDER TAKING A CRASH DUMP. +THE SYSTEM HAS CRASHED AND CANNOT BE REVIVED WITHOUT EXPERT ATTENTION. +IF YOU CAN'T FIND HELP, RELOAD THE SYSTEM./ + +;ROUTINE TO PICK UP THE DATA OUT OF THE BUG TABLE, EVALUATE THE +;ARGUMENTS, AND DUMP THE RESULTS INTO THE SYSMSG BUFFER TO BE +;PRINTED LATER. THE THIRD THING DOWN ON THE STACK IS THE PC+1 +;AT WHICH THE BUG WAS DETECTED. TT IS THE ONLY SMASHABLE REGISTER. +SYSMS0: MOVEI TT,8 ;8 WORDS IN ENTRY + ADDB TT,SYSMPT ;UPDATE STORING POINTER + ANDI TT,8_SYSMLNG-1 ;MASK TO BUFFER INDEX + ADDI TT,SYSMBF + PUSH P,TT ;SAVE PTR + PUSH P,A ;NOW LOCATE BUG TABLE ENTRY + PUSH P,B + MOVE A,TIME ;STASH TIME IN EXTRA WORD OF ENTRY + MOVEM A,7(TT) + MOVEI B,BUGTAB +SYSMS1: HRRZ A,(B) + CAIN A,@-5(P) + JRST SYSMS2 ;PC MATCHES + HLRZ A,(B) ;ADVANCE TO NEXT ENTRY + ADD B,A + JUMPN A,SYSMS1 + JRST 4,. ;NOT IN TABLE?? MACROS MUST BE SCHROD + +SYSMS2: HLRZ A,(B) + ADDI TT,-2(A) + EXCH TT,-2(P) ;TT START OF ENTRY, -2(P) END + MOVE A,TT + HRLI A,1(B) ;COPY BITS,,STRING AND ARG POINTERS + BLT A,@-2(P) + POP P,B + POP P,A + SUBM TT,(P) ;(P) GETS -NARGS + SKIPE (P) ;IN CASE NO ARGS +SYSMS3: PUSH TT,@1(TT) ;EVALUATE ARGUMENT POINTERS + AOSGE (P) + JRST SYSMS3 + MOVEI TT,SCRMSG ;BIT FOR MSG PRINT + IORM TT,SUPCOP ;TRY EVERY SECOND TO PRINT SOME MSGS + IORM TT,SUPCOR ;FIRST ATTEMPT RIGHT AWAY. + JRST POP1J ;RETURN TO BUGINF OR WHEREVER + +;CALL HERE TO PRINT THE MESSAGES OUT OF THE BUFFER +;A HAS SCRMSG +SYSMPR: MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMG TT,SYSMPU ;LAST MESSAGE OUT + JRST [ ANDCAM A,SUPCOP ;CAUGHT UP + POPJ P, ] + SUBI TT,8_SYSMLNG + CAMLE TT,SYSMPU + JRST [ MOVE A,TT ;BEHIND BY MORE THAN SIZE OF BUFFER + SUB A,SYSMPU + MOVEM TT,SYSMPU + LSH A,-3 ;NUMBER OF MESSAGES LOST + PUSHJ P,DINGTTY + PUSHJ P,SYSDPT + MOVEI I,[ASCIZ/ SYS MSGS LOST/] + PUSHJ P,SYSSTD + JRST .+1 ] + MOVEI TT,8 + ADDB TT,SYSMPU + ANDI TT,8_SYSMLNG-1 + ADDI TT,SYSMBF + PUSHJ P,DINGTTY + HLLZ D,(TT) ;GET MODE FLAGS + HRRZ I,(TT) ;GET ASCIZ MSG + HRLI I,440700 +SYSMP0: ILDB T,I + JUMPE T,SYSMP1 + CAIGE T,10 + JRST SYSMP3 + PUSHJ P,STYO + JRST SYSMP0 + +SYSMP1: PUSHJ P,STYOS ;SPACE AND OUTPUT REMAINING ARGS + PUSHJ P,SYSMP2 + JRST SYSTCR ;END WITH TIME, POPJ + JRST SYSMP1 + +SYSMP3: PUSH P,T ;OUTPUT THIS MANY ARGS +SYSMP4: PUSHJ P,SYSMP2 + JFCL + PUSHJ P,STYOS + SOSLE (P) + JRST SYSMP4 + SUB P,[1,,1] + JRST SYSMP0 + +SYSMP2: MOVEI C,0 + LSHC C,3 ;GET A BYTE + JUMPE C,CPOPJ ;NO MORE ARGS TO PRINT + PUSH P,I + MOVE A,1(TT) + PUSHJ P,@SYSMTB(C) + POP P,I + AOJA TT,POPJ1 + +;DISPATCH TABLE FOR SYSTEM MESSAGE PRINTER + +SYSMTB: JRST 4,. ;0 CHECKED FOR END + SYSFWP ;1 FULL WORD OCTAL + SYSDPT ;2 FULL WD DECIMAL + SYSDPC ;3 " WITH COMMAS + SYSCRF ;4 DO CR + CPOPJ ;5 ? + SYSIXP ;6 SIXBIT + [MOVE I,A ;7 ASCIZ + JRST SYSSP] + +;ROUTINE FOR BUGS THAT NEED TO HALT INTO DDT +BUGDD0: HRLI TT,440700 + CONO PI,PIOFF ;PREVENT INTERFERENCE, AND HACK STYO + MOVEM TT,T00POS ;SAVE ADDRESS OF MESSAGE TEMPORARILY + POP P,TT ;RESTORE TT AT TIME OF BUG + POP P,BUGPC ;ADDRESS+1 OF BUG + SKIPE BUGAWF + MOVE P,BUGACS+P ;CORRECT P AT TIME OF BUG + SETZM BUGAWF ;CLEAR FLAG FOR NEXT BUG IN CASE REVIVED + CONI PI,BUGPI ; SAVE PI STATUS + CONI BUGAPR ; SAVE APR STATE +IFE KA10P,[ + CONI PAG,BUGEBR ; SAVE EBR, UBR, ETC + DATAI PAG,BUGUBR +] ;IFE KA10P + SPM BUGPGM ; SAVE PAGER STATE + MOVEM 17,BUGACS+17 ;SAVE ACS + MOVEI 17,BUGACS + BLT 17,BUGACS+16 + MOVE P,BUGPDL ;USE THIS PDL FOR TYPING OUT + PUSH P,T00POS ;RECOVER ASCIZ STRING FOR FLAVOR OF BUG + PUSHJ P,SYSCRF ;CARRIAGE RETURN +BUGDD1: MOVEI A,SCRMSG + PUSHJ P,SYSMPR ;DUMP SYSMSG BUFFER +IFN KA10P,[ + CONSZ TTY,40 ;PUNT IF CHARACTER TYPED + JRST BUGDD2 +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEI A,%DTTYI + MOVEM A,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 + SKIPE DTEF11 ;INPUT TYPED? + JRST BUGDD2 ;YES, PUNT +] ;KL10P +IFN KS10P,[ + SKIPE 8CTYIN ; Any input available? + JRST BUGDD2 ; Yes: Punt. +] ;KS10P + MOVE TT,SYSMPT ;LAST MESSAGE IN + CAMLE TT,SYSMPU ;LAST MESSAGE OUT + JRST BUGDD1 +BUGDD2: MOVE A-1,BUGPI ;CHECK FOR PI IN PROGRESS + ANDI A-1,77400 + LSH A-1,20. + JFFO A-1,[ MOVEI I,[ASCIZ/PI LEVEL /] + PUSHJ P,SYSSP + PUSHJ P,SYSDPT + PUSHJ P,STYOS + JRST .+1 ] + MOVEI I,[ASCIZ/BUG/] + PUSHJ P,SYSSP + POP P,I ;PAUSE OR HALT MESSAGE + SKIPN SYSDBG ;PUNT LONG-WINDED MESSAGE IF DEBUGGING + PUSHJ P,SYSSP + MOVEI I,[ASCIZ/ +YOU ARE NOW IN DDT./] + PUSHJ P,SYSSP + MOVEI TT,[ASCIZ|BUGPC/Q-2/|] + HRLI TT,440700 + MOVEM TT,777777 ;TELL DDT TO EXAMINE BUGHLT ADDRESS + MOVE TT,BUGPC ;ARRANGE FOR P TO JUMP THERE + MOVEM TT,@DDT-6 ;IN OLDER DDT WILL JUST CLOBBER AC0 + MOVSI 17,BUGACS ;RESTORE ACS + BLT 17,17 + CONO PI,PION + JRST DDT + +EBLK + +;DATA AREAS POINTERS AND BUFFER FOR SYS MSG PRINTER + +CTLMAX==55. ;Number of lines after which we should print the date. +CTLCNT: 0 ;Keeps track of number of lines printed on console. + +SYSMPT: 0 ;POINTER TO MESSAGE MOST RECENTLY INSERTED +SYSMPU: 0 ;POINTER TO MESSAGE MOST RECENTLY PRINTED + ;(MUST TAKE MODULO LENGTH OF TABLE, AND ADD OFFSET OF BEGIN OF TABLE) +IFNDEF SYSMLNG,SYSMLNG==5 ;LOG(2) OF # ENTRIES (5=>32) + +SYSMBF: BLOCK 8_SYSMLNG ;8 WDS PER ENTRY: BITS,,STRING, 6 ARGS, TIME + +BUGPC: 0 ;RESTART PC FROM BUG +BUGPI: 0 ; CONI PI,BUGPI +BUGAPR: 0 ; CONI APR,BUGAPR +IFE KA10P,[ +BUGEBR: 0 ; CONI PAG,BUGEBR +BUGUBR: 0 ; DATAI PAG,BUGUBR +];IFE KA10P +IFN 0,[ ;UPGML/UPGMLE not defined yet... +BUGPGM: BLOCK UPGMLE-UPGML ; SPM BUGPGM +] +BUGPGM: BLOCK 8 ;KLUDGE +BUGACS: BLOCK 20 ;AC SAVE AREA FOR BUGDD0 +BUGPDL: -20,,. + BLOCK 20 +T00POS: 0 ;TTY00 HORIZONTAL POSITION + +BBLK + +SUBTTL .SETLOC ROUTINE (DOCUMENT THEN DOES IT) + +SYSSET: MOVE A,SETSLC ;LOCATION TO BE MODIFIED + TLNN A,-1 ;SKIP IF ALREADY DONE + SKIPA C,SETSLQ ;NEW VAL IN SETSLQ + SKIPA C,(A) ;NEW VAL IN LOC + SKIPA D,A ;OLD VAL IN @A + MOVEI D,SETSLQ ;OLD VAL IN SETSLQ + PUSHJ P,SYSSCT ;PRINT OUT DDT-TYPE SEQUENCE + MOVE A,SETSU ;GET USET NAME + PUSHJ P,STYOT ;TYPE OUT A TAB + MOVEI B,0 + PUSHJ P,SYSIXP ;PRINT NAME OF GUILTY PARTY + PUSHJ P,SYSTCR ;STANDARD SYS CARRIAGE RETURN + SKIPGE SETSLC ;IF ALREADY MUNGED AT UUO LEVEL + POPJ P, ;THEN EXIT NOW + MOVE T,SETSLQ ;GET DESIRED VALUE +; SKIPL UMBTS +; JRST SYSSE8 ;DON'T HACK METABITS +; LMB Q,@SETSLC ;GET META BIT OF DESIRED LOCATION +; TRNE Q,1 ;IF 1 THEN HAVE TO MOMENTARILY CLEAR IT +; JRST SYSSE5 +SYSSE8: EXCH T,@SETSLC ;META BIT=0, CHANGE LOCATION +SYSSE6: MOVE Q,SETSLC ;GET ADR OF MUNGED LOC + MOVE A,[-LTSTB,,TSTB] +SYSSE1: MOVE B,(A) + CAIGE Q,(B) + JRST SYSSE3 + HLRE C,B + SETCMM C + ADD C,B + CAILE Q,(C) + JRST SYSSE3 + PUSHJ P,SCKX1 ;UPDATE CKXORS TBL TOO + EQV T,@SETSLC + EQVM T,CKSUMS-TSTB(A) + MOVE T,@SETSLC + PUSHJ P,SCKX1 ;UPDATE TO REFLECT NEW CONTENTS +SYSSE2: MOVSI A,SCLSET + ANDCAM A,SUPCOR + CAIE Q,SYSDBG ;IF NOT DEBUG SWITCH + POPJ P, ;EXIT + PUSHJ P,DBGINT ;SYSDBG STATE CHANGE, TELL ALL USERS + SKIPE SYSDBG + JUMPN T,CPOPJ +;SYSDBG CLEARED, GIVE "IN OPERATION" MESSAGE BY DROPPING INTO ISYS +;HERE WHEN SYSTEM IS UP AND DISKS HAVE BEEN INITIALIZED +;RE-ENTER HERE WHEN SYSDBG STATE CHANGED +ISYS: PUSHJ P,DATIME ;MAY BE ABLE TO FIND TIME IMMEDIATELY (ONCE MFD IN) + PUSHJ P,TTTMN2 ;MAKE SURE WE THINK THAT ALL TERMINET + ;MOTORS ARE OFF, SO WE'LL TRY TO TURN THEM ALL ON WHEN WE TYPE + ;"ITS IN OPERATION" ON THEM. + PUSHJ P,TTRSAL ;SEND %TDORS TO ALL SOFTWARE TTYS + SRITYP [IN OPERATION] + SKIPE SYSDBG ;IF SYS IN DEBUG MODE +DMESSG: SRITYP [BEING DEBUGGED] ;SET TO APPROP MSG + PUSHJ P,SYALCP ;PRINT ON ALL CONSOLES +SCMESG: SRITYP [SYSTEM JOB USING THIS CONSOLE.] + PUSHJ P,SYSSP ;PRINT ON SYS JOB CONSOLE + SKIPGE DMLLDF ;START DRAGON (DAEMON) IF WANTED + SKIPL DMON+1 ;AND NOT DONE ALREADY + POPJ P, + HRROI T,DMON + CONO PI,UTCOFF + PUSHJ P,NUJBST + BUG ;SHOULD BE ROOM IN REQUEST BUFFER + JRST UTCONJ + +SYSSE3: AOBJN A,SYSSE1 + JRST SYSSE2 + + ;SETLOC ROUTINE TO MODIFY LOCATION WITH META BIT = 1 + +;SYSSE5: MOVEI D,0 +; SMB D,@SETSLC +; EXCH T,@SETSLC +; SMB Q,@SETSLC +; JRST SYSSE6 + +SUBTTL MEMORY ERROR MESSAGES + +NXMTYP: MOVEI I,[ASCIZ /NON-EX MEM ERROR #/] + MOVEI TT,1 + JRST MEMTYP + +IFE KA10P,[ +BPFTYP: MOVEI I,[ASCIZ /PAGE FAIL ERROR #/] + MOVEI TT,2 + JRST MEMTYP +] ;IFE KA10P + +PARTYP: MOVEI I,[ASCIZ /PARITY ERROR #/] ;PARITY ERROR + MOVEI TT,0 +MEMTYP: PUSHJ P,SYSSP + MOVE A,PARERR(TT) + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, PC = /] + PUSHJ P,SYSSP + MOVE A,PARPC(TT) + PUSHJ P,SYSFWP + MOVEI I,[ASCIZ /, JOB # /] + PUSHJ P,SYSSP + MOVE A,PARUSR(TT) + IDIVI A,LUBLK + PUSHJ P,SYSOPT + MOVEI I,[ASCIZ /, USR:/] + PUSHJ P,SYSSP + MOVE D,PARUSR(TT) + MOVE A,UNAME(D) + PUSHJ P,SYSSIX + PUSHJ P,STYOS + MOVE A,JNAME(D) + PUSHJ P,SYSSIX + JRST @.+1(TT) ;DISPATCH ON TYPE OF ERROR + PARTY2 ;PARITY + SYSTCR ;NXM +IFE KA10P,[ + BPFTY2 ;BPF + +BPFTY2: MOVEI I,[ASCIZ /, PFW = /] + PUSHJ P,SYSSP + MOVE A,BPFPFW + PUSHJ P,SYSFWP + JRST SYSTCR +] ;IFE KA10P + +PARTY2: PUSHJ P,SYSTCR +IFN KS10P,[ + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP + MOVE T,PARERA ; Error address is all we collect on the KS. + PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KS10P +IFN KL10P,[ + SKIPN PARRSN + JRST PARTP1 + MOVEI I,[ASCIZ /ERR ADDR = /] + PUSHJ P,SYSSP ;PAR ERR INT ALWAYS GIVES ERR ADDR + MOVE T,PARERA + JRST PARTP2 + +PARTP1: MOVEI I,[ASCIZ /PFW = /] + PUSHJ P,SYSSP ;PAR ERR TRAP GIVES PFW AND BAD DATA + MOVE T,PARPFW ;EVEN IF SCAN DOESN'T FIND PAR ERRS. + PUSHJ P,SYSP + MOVEI I,[ASCIZ /, BAD DATA = /] + PUSHJ P,SYSSP + MOVE T,PARWRD +PARTP2: PUSHJ P,SYSP + PUSHJ P,SYSCRF +] ;KL10P + SOSGE D,PARCNT + POPJ P, + JUMPE D,PARTP3 ;IF SCAN FOUND MORE THAT ONE PAR ERR, + ;PRINT AND'S AND OR'S OF DATA AND ADDRS. +IRP X,,[PARAAN,PARAOR,PARAND,PARIOR]Y,,[ADDR AND,ADDR IOR,DATA AND,DATA IOR] +IFE .IRPCNT&1, MOVEI I,[ASCIZ /Y = /] +.ELSE MOVEI I,[ASCIZ /, Y = /] + PUSHJ P,SYSSP + MOVE T,X + PUSHJ P,SYSP +IFN .IRPCNT&1, PUSHJ P,SYSCRF ;PRINT TWO ITEMS PER LINE. +TERMIN +PARTP3: MOVEI I,[ASCIZ /PARITY ERRORS: +/] + PUSHJ P,SYSSP +SYSPR1: PUSHJ P,STYOT ;TYPE TAB + MOVE A,PARADR(D) + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,PARCON(D) + PUSHJ P,SYSFWP + PUSHJ P,SYSCRF + SOJGE D,SYSPR1 + AOS D,PARCNT + MOVEI I,[ASCIZ/ .../] + CAIN D,MXPARS + PUSHJ P,SYSSP ;NOT ALL PARITY ERRORS WERE PRINTED + JRST SYSCRF + +SUBTTL LOGIN & MISCELLANEOUS MESSAGES + +SYSLGI: SKIPE SUPPLG + POPJ P, ;DON'T BOTHER PRINTING MESSAGE + HLRZ I,SLGIV+1 ;Message (CHUNAME, LOGIN, etc) + PUSHJ P,SYSSP + MOVEI TT,SLGIV ;.LOGIN + MOVE A,(TT) + CAMN A,[-1] + BUG + PUSHJ P,SYSG23 + SKIPE A,SLGIV+2 + PUSHJ P,SYSSIX + JRST SYSTCR + +SYSG23: PUSHJ P,SYSIXP + PUSHJ P,STYOS + HRRZ A,1(TT) ;PICK UP TTY NUM + JRST SYSOPT + +;PRINT A MESSAGE WHEN SOMEONE WRITES ON SYS. +SYSWRT: MOVE A,SWUNAM ;WRITE ON SYS DEVICE + PUSHJ P,SYSIXP + MOVE A,SWJNAM + PUSHJ P,SYSSIX + MOVE A,SWFN3 ;SNAME - SYS,SYS1, ... + PUSHJ P,SYSSIX + MOVE A,SWFN1 + PUSHJ P,SYSSIX + MOVE A,SWFN2 + PUSHJ P,SYSSIX + MOVE A,[SIXBIT /WRITE/] ;Assume luser was writing. + MOVE B,SWMOD ;Check opcode. + CAIN B,2 ;MLINK? + MOVE A,[SIXBIT /LINK/] ; Yup. + CAIN B,4 ;Maybe DELE/WO, RENAM/WO? + MOVE A,[SIXBIT /DELRNM/] ; Yah, hmmhmmm. +SYSWR3: PUSHJ P,SYSSIX + JRST SYSTCR + +SUBTTL DETERMINE AND PRINT THE DATE AND TIME + +EBLK +DATIME: JRST .+1 ;RH MODIFIED TO REFLECT PROGRESS +BBLK ;ROUTINE CALLED BY PUSHJ, + ;BIT SET EVERY SECOND FROM SUPCOP UNTIL + ;THE DATE IS KNOWN. + MOVSI T,40000 ;"MFD IN" BIT IN QMDRO + CONO PI,UTCOFF ;DISABLE INTERRUPTS + TDNE T,QMDRO ;SEE IF DIRECTORY IN + JRST UTCONJ ;NOT IN + ;MFD IN, GET CRUD FROM IT + MOVE A,QMDRO ;GET ORIGIN OF MFD + SKIPE B,MDYEAR(A) ;YEAR + MOVEM B,FYEAR + SKIPE C,MPDOFF(A) ;PDTIME OFFSET + MOVEM C,PDTIME + MOVEI C,DATIM0 + HRRM C,DATIME + JRST UTCONJ + +DATIM0: PUSHJ P,GLPDTM ;NOW SEE IF IT'S ALL THERE + JRST DATIM2 ;NOT ALL THERE, DOCUMENT WHAT'S MISSING + JRST DATIM6 ;ALL THERE, TYPE OUT AND CLEAR SUPCOR BIT + + ;NOT ALL THERE, DOCUMENT (TYPE OUT) WHAT IS MISSING + ;SHOULD NOT BE NECESSARY TO WARM UP TTY + +DATIM2: +IFN PDCLKP,[ + DATAI PDCLK,A ;SEE IF CLOCK ON + JUMPN A,DATIM3 ;JUMP IF CLOCK WINNING + MOVEI I,[ASCIZ /DECORIOLIS CLOCK HAS BEEN POWERED OFF, IF THE TIME +CANNOT BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + MOVEI T,500. + SOJG T,. ;WAIT AND BE SURE + DATAI PDCLK,A ;GET DATAI AGAIN + JUMPN A,DATIM3 ;JUMP IF OK NOW + PUSHJ P,SYSSP ;COMPLAIN +] ;PDCLKP +IFN KS10P,[ + RDTIM A ; Clobbers B + TLC A,1729. ; "A most interesting number" + TLNN A,-1 ; If present, KS-10 clock still remembers the time. + JRST DATIM3 + MOVEI I,[ASCIZ /THE KS-10 CLOCK HAS BEEN RESET, IF THE TIME CANNOT +BE DETERMINED FROM THE NETWORK, YOU MAY HAVE TO :PDSET +/] + PUSHJ P,SYSSP ; Complain +] ;KS10P +DATIM8: +; HRROI T,CCTSS ;NOW PREPARE TO LOAD CTSS CALLER FROM SYS:@ CCTSS +; PUSHJ P,NUJBST ;DO A PSEUDO-CONTROL Z +; JRST DATIM7 +DATIM3: MOVEI C,0 ;COUNTER OF THINGS MISSING FROM MFD + MOVEI I,[ASCIZ /YEAR, /] + SKIPG FYEAR ;CHECK YEAR + PUSHJ P,[AOJA C,SYSSP] ;NOT IN, COMPLAIN +IFN PDCLKP\KS10P,[ + MOVEI I,[ASCIZ /PDTIME OFFSET, /] + SKIPN PDTIME + PUSHJ P,[AOJA C,SYSSP] ;PDTIME OFFSET NOT IN +] ;PDCLKP\KS10P + JUMPE C,DATIM4 ;SKIP FOLLOWING IF EVERYTHING ON DISK + MOVEI I,[ASCIZ /NOT ON DISK. +PLEASE SETLOC APPROPRIATELY. +/] + PUSHJ P,SYSSP +DATIM4: SKIPA T,[DATIM5];UPDATE DATIME TO WAIT FOR EVERYTHING TO BE THERE +DATIM7: MOVEI T,DATIM8 ;UPDATE DATIME TO WAIT FOR ABILITY TO DO + ; PSEUDO-CONTROL Z FOR CTSS CALLER + HRRM T,DATIME + POPJ P, + + ;WAIT FOR EVERYTHING TO BE THERE + ;THEN TYPE OUT "IT IS NOW...", ETC. + +DATIM5: PUSHJ P,GLPDTM ;CHECK IT + POPJ P, ;NOT ALL THERE YET + MOVEI T,DATIME+1 ;ALL THERE, RE-INITIALIZE DATIME + HRRM T,DATIME +DATIM6: MOVSI T,SCLDAT ;STOP CALLING DATIME EVERY SECOND + ANDCAM T,SUPCOP ;NOW THAT THE WORK IS DONE. + HRRZS TIMOFF ;START UP SLOW CLOCK REAL-TIME ROUTINE + SETZM RSWTIM ;Initialize the resource-warning timestamp. + PUSHJ P,WARMTT ;WARM UP TTY + PUSHJ P,RYEAR1 ;GET DAY OF WEEK IN RELEVANT FIELD OF E +SYSNWP: MOVEI I,[ASCIZ /IT IS NOW /] + PUSHJ P,SYSSP ;TYPE IT OUT + IDIVI A,SPD ;A HAS RESULT OF PUSHJ TO GLPDTM + PUSH P,A ;SAVE DAY OF YEAR + MOVE A,B ;GET # SECS SINCE MIDNIGHT IN A + IDIVI A,SPD/2 ;GET AM/PM BIT IN A, 12 HOUR TIME (SECS) IN B + PUSH P,[SIXBIT / AM PM/](A) ;REMEMBER WHAT HALF-DAY + CAIGE B,3600. ;USE 12:01 RATHER THAN 0:01 IN 12-HR TIME. + ADDI B,12.*3600. + PUSHJ P,RTIME ;CONVERT TIME TO SIXBIT + MOVE B,A + TLNN B,170000 ;IF LEADING DIGIT IS ZERO, + TLZ B,770000 ;THEN TURN IT INTO A BLANK + PUSHJ P,SYSTCD ;TYPE OUT TIME + POP P,B ;RESTORE AM OR PM WORD + PUSHJ P,SYS6 ;TYPE IT OUT + MOVE B,[SIXBIT / EST,/] + TLNE E,100000 ;DST BIT + HRLI B,(SIXBIT / ED/) ;DAYLIGHT SAVINGS TIME, TYPE OUT EDT INSTEAD OF EST + PUSHJ P,SYS6 ;TYPE IT OUT + PUSHJ P,STYOS ;TYPE A SPACE + LDB B,[320300,,E] ;GET DAY OF WEEK (0 => SUNDAY) + MOVE B,DOWTBL(B) ;MON, TUES, WEDNES, ETC. (IN SIXBIT) + PUSHJ P,SYS6 ;TYPE IT OUT + MOVEI I,[ASCIZ /DAY, /] ;FINISH ON DAY OF WEEK + PUSHJ P,SYSSP ;" " " + POP P,A ;RESTORE DAY OF YEAR + PUSHJ P,RDATE1 ;CALCULATE MONTH AND DAY + MOVE B,NMNTBL-1(B) ;GET SIXBIT FOR MONTH + PUSHJ P,SYS6 ;TYPE OUT MONTH + PUSHJ P,STYOS ;TYPE A SPACE + MOVE A,C ;GET DAY OF MONTH IN A + PUSHJ P,SYSDPT ;TYPE OUT IN DECIMAL + MOVEI T,", + PUSHJ P,STYO ;TYPE A COMMA + MOVEI A,(E) ;GET YEAR + PUSHJ P,SYSDPT ;TYPE IT OUT + JRST SYSCRF ;END WITH CRLF + + ;TABLE OF NAMES OF MONTHS (FIRST THREE LETTERS, IN SIXBIT) + +NMNTBL: MNIRP [SIXBIT /M/] + + ;TABLE OF SIXBIT NAMES FOR DAYS OF THE WEEK + ;(THE "DAY" ON THE END LEFT OFF) + +DOWTBL: IRPS D,,[SUN MON TUES WEDNES THURS FRI SATUR] + SIXBIT /D/ + TERMIN +IFN .-DOWTBL-7,.ERR BARF AT DOWTBL + +SUBTTL NETWORK UP/DOWN + +SYSNET: +IFE IMPP,JRST SCOR +IFN IMPP,[ + MOVE A,IMERCN ;Get error status + CAME A,[-1] ;--1 means IMP cycled by user + SKIPA I,[[ASCIZ /IMP CRASHED, STATUS=/]] + MOVEI I,[ASCIZ /IMP cycled by user at/] + PUSHJ P,SYSSP ;Print string + MOVE A,IMERCN ;Get IMP error code back + CAME A,[-1] + PUSHJ P,SYSFWP ;Print status if error + PUSHJ P,SYSTCR ;Time, CRLF + SETOM IMERCN ;Reset error status + MOVE A,LNETIM ;Last time net was initted + SUB A,TIME ;A will be positive if net was last + ADDI A,30.*30. ; initted less than 30 sec ago. + PUSH P,A ;Flag for SYSNT5. + means don't restart IMP + MOVNI A,2 ;Say we are coming up, but no PI action yet, + MOVEM A,IMPUP ; and prevent new net openers. IMPUP may + PUSHJ P,SYSNT5 ; not already be -1 if got here via LOCK/NET + JRST SCOR ;Reset net, then back to main loop + +;Reset net, and potentially restart IMP +; Try restarting if IMP ready and -1(P) is negative. +; +;IMPUP is -1 so no new opens can happen. + +SYSNT5: + ;PCLSR those users running in OPEN. + ; + MOVEI U,0 +IFN NCPP,[ + PUSHJ P,LSTSTP ;PCLSR all users in .OPEN + NETLST + MOVSI I,-IMPSTL +SYSNT2: SKIPL A,IMSOC1(I) + JRST SYSNT1 + HRRZS A + SKIPN UNAME(A) + JRST SYSNT1 + MOVE T,APRC(A) + TLNE T,BULGO ;Tree is being deleted anyway. + JRST SYSNT1 + PUSHJ P,IFSTOP ;Stop network user + PUSHJ P,CHSCAA + PUSHJ P,SYSNT3 ;Hack IOCHNM words of net user +SYSNT1: AOBJN I,SYSNT2 +];NCPP + + ;Disconnect all STYs from the network + ; + MOVEI I,NFSTTY+NSTTYS-1 +SYSNT6: + PUSHJ P,NSTYN0 + JFCL + CAILE I,NFSTTY + SOJA I,SYSNT6 + +IFN NCPP,[ + ;Clean up connections which were closing + ; + CONO PI,UTCOFF + MOVSI I,-IMPSTL +SYSNT7: SKIPL H,IMSOC1(I) + JRST SYSNT4 + PUSHJ P,IMPBRT ;RETURN BUFFER + TLNN H,200000 ;IN PROCESS OF CLOSING? + JRST SYSNT4 ;NO, IGNORE + SETZM IMSOC1(I) ;FLUSH SOCKET + SOS IMNCS ;DECREASE COUNT OF CLOSES IN PROCESS +SYSNT4: AOBJN I,SYSNT7 ;LOOP THRU ALL SOCKETS + SKIPE IMNCS ;SKIP IF 0 MORE CLOSES + BUG PAUSE,DEC,IMNCS,[NET CHANNELS NOT CLOSED YET] + CONO PI,UTCON +];NCPP + + ;Maybe try to bring the IMP up again + ; + MOVEI U,0 + SKIPG -1(P) ;If last time down was < half minute ago, + CALL IMPCKR ; or IMP ready line is not set, + JRST LSWCLR ; then don't try to bring it up again + PUSHJ P,IMPINI +IFN NCPP,PUSHJ P,LSWCLR ;Restart old network users + PUSHJ P,WARMTTY + MOVEI I,[ASCIZ /IMP up again./] + JRST SYSSTD ;Print and return + +IFN NCPP,[ +SYSNT3: HRRZ C,(R) + CAIL C,NETDUI + CAILE C,NETDBO + POPJ P, ;NOT A NETWORK CHANNEL + HLRE C,(R) ;SOCKET MAP INDEX + JUMPL C,CPOPJ + HRROS (R) ;SET LH OF IOCHNM TO -1 + HRRZ C,R + SUBI C,IOCHNM(A) + CAIL C,20 + POPJ P, ;ON IOPDL + MOVE C,CHNBIT(C) + AND C,MSKST2(A) + IORM C,IFPIR(A) ;INTERRUPT USER + POPJ P, +];NCPP +];IMPP + +;Try to bring IMP up if desirable +SYSIMU: +IFE IMPP,POPJ P, ;No IMP, no work +IFN IMPP,[ + SKIPGE IMPTCU ;Already trying to come up? + POPJ P, ;Yes, no meddling needed + CALL IMPCKR ;Check if IMP ready line is now + JRST [ SETZM IMPTCU ;IMP not ready, we are down and not trying + POPJ P, ] ; to come up. Give up now + PUSH P,[-1] ;Force SYSNT5 to try and restart IMP if called + SKIPGE IMPUP ;Do this only if imp is temporarily down. + PUSHJ P,SYSNT5 ;Reset world, restart IMP + JRST POP1J ;Clean up and exit +];IMPP + +; PUSHJ P,LSTSTP +; LIST ;WHERE LIST/ +;STOPS ALL JOBS ON THE LIST, AND PUT THEM ON OUR LSWPR. +;LIST SHOULD BE LINKED THROUGH THE RH, AND EACH WORD IN THE LIST SHOULD BE +;IN THE USER VAR BLOCK OF SOME JOB. THAT JOB IS CONSIDERED TO BE ON THE LIST. +;0 IN THE RH MEANS NIL. +LSTSTP: MOVE T,@(P) ;POINTER TO FIRST ELEMENT OF LIST + CONO PI,CLKOFF + MOVE T,(T) +LSTST1: HRRZS T + SKIPN A,T ;ADDRESS OF LSWB BLOCK + JRST CLKOJ1 + MOVEI A,-USRSTG(A) + IDIVI A,LUBLK + IMULI A,LUBLK ;USER INDEX + PUSH P,(T) + PUSHJ P,IFSTOP ;STOP USER, ADDING HIS USTP TO OUR LSWPR + POP P,T + JRST LSTST1 + SUBTTL SYSTEM JOB TYPE-OUT ROUTINES + +;PRINT "/ <@D> " IN OCTAL. +;USED BY SYSSET. CLOBBERS A,B,T. +SYSSCT: HRRZS A + PUSHJ P,SYSOPT + MOVEI T,"/ + PUSHJ P,STYO + PUSHJ P,STYOT ;TAB + MOVE A,(D) ;GET CURRENT VALUE + PUSHJ P,SYSFWP + PUSHJ P,STYOT + MOVE A,C ;GET NEW VALUE + JRST SYSFWP + +;STRING <- I, SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSSTD: PUSHJ P,SYSSP + +;SPACE, TIME AND CRLF. +;CLOBBERS A THRU E AND T. +SYSTCR: PUSHJ P,SYSTPT + +;TYPE A CRLF. CLOBBERS T. +SYSCRF: SOS CTLCNT ;Countdown number of lines printed. + MOVEI T,15 + PUSHJ P,STYO + MOVEI T,12 + JRST STYO + +SYSTPT: PUSHJ P,STYOS ;TYPE SPACE, TIME + CONSZ PI,200 ;IF IN BUGDD0, MUSTN'T CALL GLPDTM + PUSHJ P,GLPDTM + POPJ P, ;TIME NOT KNOWN + IDIVI A,SPD + PUSHJ P,RTIME ;CONVERT TO SIXBIT. + MOVE B,A ;DROP INTO SYSTCD + +SYSTCD: LDB A,[301400,,B] + PUSHJ P,SYSTWR + LDB A,[141400,,B] + PUSHJ P,SYSTWR + MOVE I,[140600,,B] + JRST SYSIX2 + +;PREPARE FOR TYPING OUT A MESSAGE ON THE CONSOLE TTY. CALL HERE BEFORE +;STARTING TO TYPE A LINE, IF THERE IS A CHANCE THAT SYS JOB MIGHT JUST +;BE STARTING TO TYPE AFTER A PERIOD OF SILENCE. +WARMTTY:PUSHJ P,SYSCOP ;GET SYSTEM TTY READY TO USE + .IOT STYOC,[^P] ;ADVANCE TO FRESH LINE + .IOT STYOC,["A] +WARMT2: +IFN 1, POPJ P, +.ELSE [ MOVE T,SYSCN + MOVE T,TTLTM(T) ;DON'T DO THIS IF THERE'S BEEN ACTIVITY IN 2 MINUTES. + ADDI T,115.*30. + CAML T,TIME + POPJ P, + PUSH P,[[MOVEI T,^H + JRST WARMT1]] + SKIPA T,[175] ;WARM UP TELETYPE (ONLY ON AI-KA FOR NOW) +];END .ELSE +DINGTTY: SKIPA T,[^G] ;DING DING +WARMT1: PUSHJ P,.+1 + PUSHJ P,.+1 + JRST STYO + +;ROUTINE TO "OPEN" A CHANNEL TO THE SYSTEM CONSOLE +;IT'S DONE THIS WAY SO THAT THE CONSOLE CAN STILL BE +;USED AS A USER CONSOLE WHEN NECESSARY. SYSTEM JOB +;MESSAGES WILL JUST COME OUT FROM TIME TO TIME. + +SYSCOP: HRLZ T,SYSCN ;FAKE UP AN IOCHNM WORD + ADD T,[%TJDIS+%TJMOR,,TYODN] + SKIPGE SYSCN + MOVEI T,NLODN ;IF NO SYS TTY AVAIL, USE NUL DEVICE + MOVEM T,IOCHNM+STYOC + POPJ P, + +;TYPE OUT THE SIXBIT WORD IN B, QUIT WHEN WHAT IS LEFT IS BLANK +SYS6: JUMPE B,CPOPJ ;RETURN WHEN NOTHING LEFT + MOVEI A,0 ;INITIALIZE FOR LSH + LSHC A,6 ;SHIFT A CHARACTER IN + MOVEI T,40(A) ;CONVERT TO SIXBIT AND GET IN T + PUSHJ P,STYO ;TYPE OUT THE CHARACTER + JRST SYS6 ;LOOP BACK FOR NEXT CHARACTER + +;PRINT A MESSAGE ON ALL FREE CONSOLES. 40 SET IN LH(I) => IT IS ADDR OF ROUTINE; +;ELSE IT IS ADDR OF AN ASCIZ STRING TO BE TYPED FOLLOWED BY THE TIME AND A CRLF. +SYALCP: TLNN I,40 + HRLI I,440700 ;SYSTEM ALL CONSOLES PRINT + MOVEI A,0 +SYALC1: PUSHJ P,SYSTSU + AOJA A,SYALC3 + TLNE I,40 + JRST SYALC5 + MOVE Q,I ;SO NOT TO MUNG I UNTIL END +SYALC2: ILDB E,Q + JUMPE E,SYALC4 ;JUMP IF DONE + .IOT STYOC,E ;COPY CHARACTER + JRST SYALC2 ;GO GET NEXT CHARACTER + +SYALC5: PUSH P,I + PUSH P,A + PUSHJ P,(I) + POP P,A + POP P,I +SYALC6: MOVSI E,%TACFM + IORM E,TTYSTA(A) ;DONT NEED CONSOLE FREE MSG ANY MORE + AOS A ;INCREMENT CONSOLE NUMBER +SYALC3: CAIGE A,NCT+IFN N11TYS,[1-N11TYS] ;IF MORE CONSOLES LEFT, + JRST SYALC1 ;THEN PRINT OUT ON NEXT ONE + JRST SYSCOP ;FINALLY RE-OPEN SYSTEM CONSOLE. + +SYALC4: PUSH P,[SYALC6] ;PUT TIME AT END OF MESSAGE + PUSH P,A ;IF WE KNOW WHAT TIME IT IS + PUSH P,B + PUSHJ P,GLPDTM + JRST POPBAJ + PUSH P,I + IRPC A,,[ AT] + .IOT STYOC,["A] ;PUT TIME IN UP/DOWN MESSAGES + TERMIN + PUSHJ P,SYSTPT + POP P,I + JRST POPBAJ + +SYSTSU: CONO PI,TTYOFF + MOVE T,TTYSTA(A) + TLZN T,%TACFM + JRST TTYONJ ;IN USE OR WILL GET CONSOLE FREE MSG => DON'T HACK IT + MOVEM T,TTYSTA(A) + CONO PI,TTYON + AOS (P) ;TTY NEEDS HACKING, SO SKIP. + HRLZ T,A + ADD T,[%TJDIS+%TJMOR,,TYODN] + MOVEM T,IOCHNM+STYOC ;"OPEN" THE CHANNEL. +SYSTS1: MOVE T,TTYOPT(A) + TLNN T,%TOIML + TLNN T,%TOMVU + POPJ P, ;IMLAC OR PRINTING TTY, DON'T CLEAR. + MOVEI T,^P + PUSHJ P,STYO + MOVEI T,"C + JRST STYO + + ;SYSTEM JOB RADIX PRINT-OUT ROUTINES + ;FULL WORD (TWO HALFWORD) OCTAL: +SYSFWP: TLNN A,-1 ;IF LH=0, + JRST SYSOPT ;THEN PRINT ONLY RH + LSHC A,-18. + HLLM B,(P) + PUSHJ P,SYSOPT + HLRZ A,(P) + MOVEI T,", ;",," BETWEEN HALFWORDS + PUSHJ P,STYO + PUSHJ P,STYO + + ;OCTAL PRINTOUT, NO LEADING ZEROS, HALFWORD MAXIMUM +SYSOPT: IDIVI A,10 + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSOPT +SYSRP2: HLRZ B,(P) ;ENTRY POINT FROM DECIMAL TYPEOUT ROUTINE +SYSRP1: MOVEI T,"0(B) ;" " " + JRST STYO + + ;DECIMAL PRINTOUT, COMMAS EVERY 3 DIGITS, FULLWORD MAXIMUM +SYSDPC: MOVE 0,A ;ROUTINE EXPECTS ARGUMENT IN A, CLOBBERS 0, A(=0+1), B(=A+1) +SYSDP5: IDIVI 0,1000. ;GET LEAST SIGNIFICANT 3 DIGITS IN A + JUMPE 0,SYSDPT ;PRINT HIGH ORDER DIGITS WITHOUT LEADING ZEROES + HRLM A,(P) + PUSHJ P,SYSDP5 + HLRZ A,(P) + MOVEI T,", ;SINCE 3*N DIGITS LEFT TO BE TYPED, N>0, + PUSHJ P,STYO ;PRINT OUT A COMMA + MOVEI T,3 ;NUMBER OF DIGITS TO PRINT OUT + ;ROUTINE TO PRINT OUT AS MANY DECIMAL DIGITS AS SPECIFIED IN T +SYSLZP: IDIVI A,10. + SOJLE T,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSLZP + JRST SYSRP2 + +;PRINT NUMBER IN A IN DECIMAL; CLOBBERS B, T. +SYSDPT: IDIVI A,10. + JUMPE A,SYSRP1 + HRLM B,(P) + PUSHJ P,SYSDPT + JRST SYSRP2 + +STYOQ: MOVEI T,"? ;TYPE OUT "?" + JRST STYO + +STYOT: SKIPA T,[11] ;TAB +STYOS: MOVEI T,40 ;TYPE OUT A SPACE +STYO: CONSO PI,200 ;PI ON? (SYSTEM UP) + JRST STYO1 + .IOT STYOC,T + POPJ P, + +;TYPE OUT DIRECTLY WHILE SYSTEM IS NOT RUNNING +STYO1: HRLM T,(P) + CAIN T,15 + SETZM T00POS + AOS T,T00POS + CAIL T,75. + PUSHJ P,SYSCRF + HLRZ T,(P) +IFN KA10P,[ + CONSZ TTY,20 + JRST .-1 + DATAO TTY,T +] ;KA10P +IFN KL10P,[ + SETZM DTEFLG + MOVEM T,DTECMD + CONO DTE,%DBL11 + SKIPN DTEFLG + JRST .-1 +] ;KL10P +IFN KS10P,[ + ANDI T,177 ; ASCII for the 8080 + IORI T,400 ; Means a character is present + MOVEM T,8CTYOT + CONI T + IORI T,80INT + CONO (T) ; punch 8080 + SKIPE 8CTYOT ; wait for completion + JRST .-1 + HLRZ T,(P) ; God knows who might look at T... +] ;KS10P + POPJ P, + +;PRINT WORD IN I AS 12. OCTAL DIGITS. CLOBBERS J,T. +SYSP: MOVE J,[440300,,I] + MOVE I,T +SYSP1: ILDB T,J + ADDI T,"0 + PUSHJ P,STYO + TLNE J,770000 + JRST SYSP1 + POPJ P, + +SYSSP: HRLI I,440700 ;ENTRY TO TYPE C(I) AS A POINTER TO ASCIZ +SYSSP2: ILDB T,I + JUMPE T,CPOPJ + PUSHJ P,STYO + JRST SYSSP2 + +SYSTWR: LSH A,30-18. + ADDI A,(SIXBIT / :/) + MOVE I,[220600,,A] + JRST SYSIX2 +SYSSIX: PUSHJ P,STYOS ;TYPE A SPACE AND FALL IN +SYSIXP: MOVE I,[440600,,A] ;ENTRY TO TYPE OUT C(A) AS SIXBIT +SYSIX2: ILDB T,I + ADDI T,40 + PUSHJ P,STYO + TLNN I,770000 + POPJ P, + JRST SYSIX2 diff --git a/system/t20mac.1 b/system/t20mac.1 new file mode 100644 index 0000000..18baa82 --- /dev/null +++ b/system/t20mac.1 @@ -0,0 +1,361 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;Random useful coding macros. GZ@OZ developed MACSYM.MID based on the +;Twenex monitor macro collection MACSYM.MAC - this is a non-Twenex-specific +;subset of that. + +;Stuff supported (will add more stuff as need arises): +; FLD(VAL,MSK) & BIT(n) & POINT SIZE,ADDR,OFFSET +; MOVX AC,MASK & TXxx AC,MASK & JXx AC,MASK,ADDR & LOAD/STOR AC,MASK,ADDR +; DO./ENDDO. macros (and related stuff) +; IFxxx/ANxxx macros +; SAVEACS [A,B,C,D] & SAVE. [LOC,LOC,LOC] + + +.KILL ..XX,..TXZ,..TXO,..TXC,..X0,..X1,..X2,..X3,TOP. +.XCREF ..XX,..TXZ,..TXO,..TXC,..X0,..X1,..X2,..X3 +.XCREF ..DX,..IX,..EX,.SAVX1,.SAVX2 + +IF2,.INEOF ;Don't bother if no code + +;.NSTGW ;No storage words in this part + +DEFINE FLD (VAL,MASK) +<.DPB ,<.BP ,>,0>TERMIN + +DEFINE BIT (N) +<1_<35.->>TERMIN + +DEFINE POINT SIZE=7,ADDR=0,COUNT=0 +RADIX 8+2 +..X1==SIZE +..X2==COUNT +RADIX 8 +..XX==<..X2-1>/<36./..X1> +..X2==..X2-..XX*<36./..X1> +<<<36.-<..X1*..X2>>_30.>+<..X1_24.>++..X1> +TERMIN + +;MOVX - LOAD AC WITH CONSTANT + +DEFINE MOVX AC,#MSK + IFE <-1,,0>&MSK,[MOVEI AC,MSK] + .ELSE [IFE <0,,-1>&MSK,[MOVSI AC,(MSK)] + .ELSE [IFE <<-1,,0>&MSK>-<-1,,0>,[HRROI AC,MSK] + .ELSE [IFE <<0,,-1>&MSK>-<0,,-1>,[HRLOI AC,(MSK&.LHALF)] + .ELSE [MOVE AC,[MSK]]]]] +TERMIN + +;TX - TEST MASK + +IRP OP,,[N,NA,OE,ON,OA,ZE,ZN,ZA,CE,CN,CA] + DEFINE TX!OP AC,#MSK + IFE <-1,,0>&MSK,[TR!OP AC,MSK] + .ELSE [IFE <0,,-1>&MSK,[TL!OP AC,(MSK)] + .ELSE [TD!OP AC,[MSK]]] + TERMIN +TERMIN + +IRP OP,,[N,E] + DEFINE TXN!OP AC,#MSK + IFE <-1,,0>&MSK,[TRN!OP AC,MSK] + .ELSE [IFE <0,,-1>&MSK,[TLN!OP AC,(MSK)] + .ELSE [IFE MSK+1,[CAI!OP AC,0] + .ELSE [TDN!OP AC,[MSK]]]] + TERMIN +TERMIN + +..TXZ==ANDI +..TXO==ORCMI +..TXC==EQVI +IRP OP,,[Z,O,C] + DEFINE TX!OP AC,#MSK + IFE <-1,,0>&MSK,[TR!OP AC,MSK] + .ELSE [IFE <0,,-1>&MSK,[TL!OP AC,(MSK)] + .ELSE [IFE <<-1,,0>&MSK>-<-1,,0>,[..TX!OP AC,-1#MSK] + .ELSE [TD!OP AC,[MSK]]]] + TERMIN +TERMIN + +EQUALS IORX,TXO +EQUALS XORX,TXC + +DEFINE ANDX AC,#MSK +TXZ AC,-1#MSK +TERMIN + + SUBTTL JX -- JUMP ON MASK + +;JXE -- JUMP IF MASKED BITS ARE EQUAL TO 0 +;JXN -- JUMP IF MASKED BITS ARE NOT EQUAL TO 0 +;JXO -- JUMP IF MASKED BITS ARE ALL ONES +;JXF -- JUMP IF MASKED BITS ARE NOT ALL ONES (FALSE) + +DEFINE JXE AC,#MSK,?ADR + IFE MSK-.MINFI,[JUMPGE AC,ADR] + .ELSE [IFE MSK+1,[JUMPE AC,ADR] + .ELSE [TXNN AC,MSK + JRST ADR]] +TERMIN + +DEFINE JXN AC,#MSK,?ADR + IFE MSK-.MINFI,[JUMPL AC,ADR] + .ELSE [IFE MSK+1,[JUMPN AC,ADR] + .ELSE [TXNE AC,MSK + JRST ADR]] +TERMIN + +DEFINE JXO AC,#MSK,?ADR + IFE <.LZ MSK,>+<.TZ MSK,>-35.,[JXN AC,MSK,ADR] + .ELSE [TXC AC,MSK + TXCN AC,MSK + JRST ADR] +TERMIN + +DEFINE JXF AC,#MSK,?ADR +IFE <.LZ MSK,>+<.TZ MSK,>-35.,[JXE AC,MSK,ADR] +.ELSE [TXC AC,MSK + TXCE AC,MSK + JRST ADR] +TERMIN + +;LOAD, STOR +DEFINE LOAD AC,#MSK,?LOCN + IFE MSK+1,[MOVE AC,LOCN] + .ELSE [IFE MSK-777777,[HRRZ AC,LOCN] + .ELSE [IFE MSK-<-1,,0>,[HLRZ AC,LOCN] + .ELSE [LDB AC,[.BP MSK,LOCN]]]] +TERMIN + +DEFINE STOR AC,#MSK,?LOCN + IFE MSK+1,[MOVEM AC,LOCN] + .ELSE [IFE MSK-777777,[HRRM AC,LOCN] + .ELSE [IFE MSK-<-1,,0>,[HRLM AC,LOCN] + .ELSE [DPB AC,[.BP MSK,LOCN]]]] +TERMIN + + SUBTTL BLOCK MACROS + +;MACROS TO PROVIDE SOME BLOCK HANDLING OF CODE + +;DO. - LOOP STRUCTURE, DECLARES TOP OF LOOP +; LOOP. - JUMPS TO TOP OF LOOP +; EXIT. - EXITS LOOP +; TOP. - TAG AT TOP OF LOOP FOR JUMPS, E.G. SOJG T4,TOP. +; ENDLP. - TAG AT END OF LOOP FOR JUMPS, E.G. SOJL T4,ENDLP. + +DEFINE DO. + ..DX +TERMIN + +DEFINE ..DX \%TGE,%SV1,%SV2,%SV3 + EQUALS %SV1,TOP. ? EQUALS %SV2,ENDDO. ? EQUALS %SV3,ENDLP. + .KILL %SV1 + TOP.==. + DEFINE ENDDO. + %TGE::EQUALS TOP.,%SV1 ? EQUALS ENDDO.,%SV2 ? EQUALS ENDLP.,%SV3 + .KILL %TGE + TERMIN + DEFINE ENDLP. +%TGE!!TERMIN +TERMIN + +DEFINE ENDDO. +.ERR ENDDO. outside loop +TERMIN +DEFINE ENDLP. +.ERR ENDLP. outside loop +TERMIN +TOP.==-1 + +DEFINE OD. +ENDDO.!TERMIN + +DEFINE LOOP. +JRST TOP.!TERMIN + +DEFINE EXIT. +JRST ENDLP.!TERMIN + + +;Conditionals + +DEFINE IFSKP. +..IX [JRST ] +TERMIN + +DEFINE IFNSK. +TRNA + ..IX [JRST ] +TERMIN + +DEFINE IFXN. AC,#MASK + IFE 1_35.-MASK,..IX [JUMPGE AC,] + .ELSE [IFE MASK+1,..IX [JUMPE AC,] + .ELSE [TXNN AC,MASK + ..IX [JRST ] + ]] +TERMIN + +DEFINE IFXE. AC,#MASK + IFE 1_35.-MASK,..IX [JUMPL AC,] + .ELSE [IFE MASK+1,..IX [JUMPN AC,] + .ELSE [TXNE AC,MASK + ..IX [JRST ] + ]] +TERMIN + +DEFINE IFE. AC +..IX [JUMPN AC,] +TERMIN + +DEFINE IFN. AC +..IX [JUMPE AC,] +TERMIN + +DEFINE IFG. AC +..IX [JUMPLE AC,] +TERMIN + +DEFINE IFGE. AC +..IX [JUMPL AC,] +TERMIN + +DEFINE IFLE. AC +..IX [JUMPG AC,] +TERMIN + +DEFINE IFL. AC +..IX [JUMPGE AC,] +TERMIN + +DEFINE ..IX OP,\%TAG,%SV1,%SV2 + OP!%TAG + EQUALS %SV1,..TG ? EQUALS %SV2,ENDIF. + DEFINE ..TG LBL + %TAG!!LBL!TERMIN + DEFINE ENDIF. + ..TG [::] + .KILL ..TG + EQUALS ..TG,%SV1 ? EQUALS ENDIF.,%SV2 + TERMIN +TERMIN + +DEFINE ELSE. +..EX +TERMIN + +DEFINE ..EX \%TAG + JRST %TAG + ..TG [::] + DEFINE ..TG LBL + %TAG!!LBL!TERMIN +TERMIN + +DEFINE ..TG LBL + .ERR Conditional construct outside a conditional +TERMIN + +DEFINE ENDIF. + .ERR ENDIF. outside a conditional +TERMIN + + +;GENERAL CASES WITHIN CONDITIONALS + +DEFINE ANSKP. + JRST ..TG +TERMIN + +DEFINE ANNSK. + TRNA + JRST ..TG +TERMIN + +DEFINE ANDXN. AC,#MASK +IFE 1_35.-MASK,JUMPGE AC,..TG +.ELSE [IFE MASK+1,JUMPE AC,..TG + .ELSE [TXNN AC,MASK + JRST ..TG + ]] +TERMIN + +DEFINE ANDXE. AC,#MASK +IFE 1_35.-MASK,JUMPL AC,..TG +.ELSE [IFE MASK+1,JUMPN AC,..TG + .ELSE [TXNE AC,MASK + JRST ..TG + ]] +TERMIN + +DEFINE ANDE. AC + JUMPN AC,..TG +TERMIN + +DEFINE ANDN. AC + JUMPE AC,..TG +TERMIN + +DEFINE ANDG. AC + JUMPLE AC,..TG +TERMIN + +DEFINE ANDGE. AC + JUMPL AC,..TG +TERMIN + +DEFINE ANDLE. AC + JUMPG AC,..TG +TERMIN + +DEFINE ANDL. AC + JUMPGE AC,..TG +TERMIN + + + +; SAVEAC [A,B,C] +; Supports +1/+2 returns. +; Unlike macro version, supports arbitrary locations (not just AC's) +; and doesn't clobber AC16. Assumes stack in P, though. + +DEFINE SAVEAC ACS + IRP AC,,[ACS] + PUSH P,AC + ..XX==.IRPCNT + TERMIN + .SAVX1 ..XX+1,[ACS] +TERMIN + +EQUALS SAVE.,SAVEAC ;Not in MACRO version... + +DEFINE .SAVX1 #N#,ACS + PUSH P,[[CAIA + AOS -N(P) + .SAVX2 [ACS] + POPJ P, + ]] +TERMIN + +DEFINE .SAVX2 ACS + IRP AC,REST,[ACS] + .SAVX2 [REST] + POP P,AC + .ISTOP + TERMIN +TERMIN + diff --git a/system/t300.defs7 b/system/t300.defs7 new file mode 100644 index 0000000..6abb55e --- /dev/null +++ b/system/t300.defs7 @@ -0,0 +1,108 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;ALLOW USER TO USE SYMBOLS IN OTHER WAYS IF HE WISHES. +;BUT NORMALLY, DEFSYM FOO==BAR DOES FOO==BAR WITH ERROR CHECK. + +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ + $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` +] +.ISTOP +TERMIN TERMIN + +IFLE .MLLIT,.ERR .MLLIT MUST BE 1; SETTING IT TO 1. +.MLLIT==1 +$$TEMP==1 +];IF Not DEFined DEFSYM +.ELSE $$TEMP==0 + +;DISK PHYSICAL PARAMETERS (CENTURY DATA T-300 AND 2561 CONTROLLER) +;SINCE WE HAVE ALSO AN RH10 CONTROLLER, THESE ARE SUFFIXED WITH A 1 + +DEFSYM NCYLS1==812. ;# CYLINDERS NORMALLY USED +DEFSYM XCYLS1==815.-NCYLS1 ;# CYLINDERS FOR SPARES, HACKS, ETC. +DEFSYM NHEDS1==19. ;# TRACKS/CYLINDER +DEFSYM NSECS1==32. ;# SECTORS/TRACK (256. 16-BIT WORDS) +DEFSYM SECBL1==12. ;# SECTORS/BLOCK +DEFSYM NBLKC1==NHEDS1*NSECS1/SECBL1 ;# BLOCKS/CYLINDER +DEFSYM NBLKS1==NCYLS1*NBLKC1 ;# BLOCKS NORMALLY USED +DEFSYM XBLKS1==XCYLS1*NBLKC1 ;# BLOCKS FOR HACKS +DEFSYM TBLKS1==NBLKS1+XBLKS1 ;TOTAL BLOCKS + +DEFSYM NTUTB1==4 ;4 BLOCKS PER TUT HERE +DEFSYM TUTBL1==MFDBLK-NTUTB1 ;TUT ALSO STARTS AT A DIFFERENT PLACE + +;TAKE DECADE FROM RH1O DEFS +;DEFSYM DECADE==NBLKSC ;NUMBER OF BLOCKS TO ALLOCATE AT A TIME +; ;QSWAPA AND QLASTB MUST BE MULTIPLES OF THIS. +; ;DECADE SIZE = CYLINDER SIZE FOR KLFEDR'S SAKE + +;10/11 COMMUNICATION AREA IS 14. WORDS STARTING 48. WORDS INTO THE 64.-WORD DL10 AREA + +DEFSYM DSCCHK=DL10AR+60 ;MUST BE 2561 OCTAL +DEFSYM DSCREQ=DL10AR+61 ;SET NON-ZERO BY 10 TO SIGNAL REQUEST TO 11 +DEFSYM DSCDON=DL10AR+62 ;SET NON-ZERO BY 11 TO SIGNAL DONE TO 10 +DEFSYM DSCFLT=DL10AR+63 ;0 NO FAULT +DEFSYM %DFRST==100000 ;POWER CYCLED OR BROKEN, SO CONTROLLER WAS RESET +DEFSYM %DFCQE==10000 ;CONSISTENCY ERROR IN COMMAND QUEUE +DEFSYM %DFNXM==4000 ;NXM ERROR IN COMMAND QUEUE +DEFSYM %DFPAR==2000 ;PARITY ERROR IN COMMAND QUEUE + ; IF ONE OF THESE BITS IS ON, BITS 1-0 AND DSCSTS + ; ARE THE ERROR ADDRESS + ;BITS 7-0 SYSTEM FAULT CODE IF LEFT BYTE IS ZERO + ; SEE THE 2561 OEM MANUAL FOR MEANING OF FAULT CODES +DEFSYM DSCSTS=DL10AR+64 ;STATUS BITS AS FOLLOWS +DEFSYM %DSRTR==100000 ;COMMAND WAS RETRIED +DEFSYM %DSECH==40000 ;UNCORRECTABLE DATA ERROR (ECC HARD) +DEFSYM %DSECC==20000 ;CORRECTED DATA ERROR +DEFSYM %DSIDE==10000 ;ID ERROR +DEFSYM %DSHCE==4000 ;ADDRESS ERROR (HEADER COMPARE ERROR) +DEFSYM %DSPRT==2000 ;WRITE-PROTECT STATUS OF SECTOR (ABORTS WRITE COMMAND) +DEFSYM %DSALT==1000 ;ALTERNATE-SECTOR STATUS (ABORTS READ, WRITE, AND CHECK) +DEFSYM %DSOVR==400 ;FIFO OVER-RUN, NOT CORRECTED BY 1 RETRY +DEFSYM %DSSKE==200 ;SEEK ERROR FROM DRIVE +DEFSYM %DSOFL==100 ;DRIVE OFF-LINE OR FAULT +DEFSYM %DSFLT==20 ;DRIVE FAULT +DEFSYM %DSNXM==10 ;NXM ON PDP11 MEMORY +DEFSYM %DSPAR==4 ;PARITY ERROR IN PDP11 MEMORY +DEFSYM %DSSFL==2 ;SYSTEM FAULT, SEE LOW BYTE OF DSCFLT +DEFSYM %DSWLK==1 ;DRIVE WRITE-LOCKED, WRITE ABORTED + +DEFSYM DSCCMD=DL10AR+65 ;COMMAND CODE AS FOLLOWS +DEFSYM %DMSNS==2 ;SENSE DRIVE STATE. DSCSTS GETS CODE FOR DRIVE TYPE IN + ; BITS 14-8 (10 FOR T-300), AND %DSWLK, %DSFLT, %DSOFL, %DSSKE +DEFSYM %DMTST==3 ;TEST SPECIFIED DRIVE (RUNS DIAGNOSTICS) +DEFSYM %DMREC==4 ;RECALIBRATE +DEFSYM %DMSEK==5 ;SEEK +DEFSYM %DMWRT==6 ;WRITE DATA +DEFSYM %DMRED==20 ;READ DATA. ADD 1-10 FOR VARIOUS RECOVERY FEATURES AS + ; DOCUMENTED IN THE 2561 OEM MANUAL. + +DEFSYM DSCDRV=DL10AR+66 ;DRIVE NUMBER (0 IS FIRST DRIVE ON 11) +DEFSYM DSCCYL=DL10AR+67 ;CYLINDER NUMBER +DEFSYM DSCHED=DL10AR+70 ;HEAD NUMBER +DEFSYM DSCSEC=DL10AR+71 ;SECTOR NUMBER +DEFSYM DSCPNT=DL10AR+72 ;4 12-BIT BYTE POINTERS TO DATA TO TRANSFER + +IFN $$TEMP,EXPUNG DEFSYM diff --git a/system/tcp.273 b/system/tcp.273 new file mode 100644 index 0000000..738c1c2 --- /dev/null +++ b/system/tcp.273 @@ -0,0 +1,3631 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; This file holds the modules for TCP. +comment | STUFF TO DO + +Incoming ACKs should prevent retrans from aborting connection, since +clearly it is still alive, just doesn't have room for our stuff (which +is possibly overflowing its window). + +Note Clark suggs on windowing/ACKing. + If input data seg doesnt have PUSH, don't send ACK, but set + a timeout for sending ACK. Send ACK when: + PUSH is seen + outgoing seg forced out (new or retrans) + timed out + +Output buffering stinks. If can't send buff due to too many segs, +then should be able to keep adding to present segment. + +Provide way for output IOT to specify URGENT, and +Handle URGENT when received on input. + +| + +SUBTTL TCP definitions + +%WYTCP==:7 ; Move to BITS later + +%MOD32==:740000 ; LH mask used for mod 32 arithmetic +%TCPMI==:5 ; Max # segments in input queue per connection +%TCPMO==:5 ; Max # segments in output queue per connection +%TCPDS==:536. ; Default max # bytes per segment (when no + ; knowledge of receiving host) +%TCPMS==:2048.-40. ; Maximum possible segment size we can support + ; This must be 7777 (octal) or less. +%TCPMB==:%TCPMI*%TCPMS ; Max # bytes of data in queue (a bit fictional) +%TCPMR==:20. ; Max # retransmit retries allowed +%TCPMQ==:20 ; Max # pending RFCs allowed +%TCPMP==:777 ; Max port # allowed for pending-RFC (SYN) conns + ; Note pending-RFCs used ONLY for job startups, + ; SYNs are not queued in general. + +; Defintions of TCP Segment Header fields. +%TCPHL==:5 ; # of 32-bit words in fixed part of TCP header + +TH%SRC==:777774,, ; 0 Source Port +TH%DST==: 3,,777760 ; 0 Destination Port +TH%SEQ==:777777,,777760 ; 1 Sequence Number +TH%ACK==:777777,,777760 ; 2 Acknowledgement Number +TH%THL==:740000,, ; 3 Data Offset (TCP Header Length in 32-bit wds) +TH%RES==: 37400,, ; 3 Reserved (should be 0) +TH%CTL==: 374,, ; 3 Control bits +TH%WND==: 3,,777760 ; 3 Window +TH%CKS==:777774,, ; 4 Checksum +TH%UP==: 3,,777760 ; 4 Urgent Pointer + ; 5 Start of Options/Data + +TH$SRC==:<.BP TH%SRC,0> +TH$DST==:<.BP TH%DST,0 > +TH$SEQ==:<.BP TH%SEQ,1> +TH$ACK==:<.BP TH%ACK,2> +TH$THL==:<.BP TH%THL,3> +TH$RES==:<.BP TH%RES,3> +TH$CTL==:<.BP TH%CTL,3> +TH$WND==:<.BP TH%WND,3> +TH$CKS==:<.BP TH%CKS,4> +TH$UP==: <.BP TH%UP, 4> +TH$OPT==:<441000,,5> ; An ILDB-type pointer to start of options. + + ; Control bit definitions (as located in full word) +TC%URG==:<200,,> ; Urgent Pointer significant +TC%ACK==:<100,,> ; Ack field significant +TC%PSH==:< 40,,> ; Push Function +TC%RST==:< 20,,> ; Reset connection +TC%SYN==:< 10,,> ; Synchronize sequence numbers +TC%FIN==:< 4,,> ; Finalize - no more data from sender + +; TCP Connection tables, normally indexed by I +; These correspond to what the TCP document (RFC-793) calls +; the "Transmission Control Block" parameters. +; A TCB is "in use" if either XBUSER or XBSTAT is non-zero. +; XBUSER is set if a user job has channels associated with the TCB. +; XBSTAT is set if TCP is dealing with the TCB. +; PI level will never touch any TCBs which have a zero XBSTAT, so it is +; safe for the MP level to hack a zero-XBSTAT TCB without using NETOFF. + +IFNDEF XBL,XBL==10. ; Allow this many TCP connections for now. + +EBLK ; General variables + +XBUSER: BLOCK XBL ; RH User index + XB%STY==:<770000,,> ; TTY # of STY connected to (0 if none) + XB%ICH==:<007700,,> ; Input channel #+1 (77=IOPUSHed) + XB%OCH==:<000077,,> ; Output channel #+1 (77=IOPUSHed) + XB$STY==:<.BP XB%STY,XBUSER> + XB$ICH==:<.BP XB%ICH,XBUSER> + XB$OCH==:<.BP XB%OCH,XBUSER> +XBSTAT: BLOCK XBL ; ,, + ; Connection flags (internal to ITS) + %XBMPL==:SETZ ; Current output segment locked at MP level (IOT) + ; This must be sign bit for SGNSET/PCLSR to work. + %XBCTL==:<374,,> ; Array of output request bits + IFN %XBCTL-TH%CTL,.ERR %XBCTL flags must be the same as TH%CTL!! + ; For all bits in %XBCTL the general meaning is + ; "Set this bit in next outgoing segment". If no bits + ; are set, output is sent every 2 sec, otherwise every + ; 1/2 sec. If %XBNOW is set, output is sent as soon + ; as something notices it. + %XBNOW==:<1,,> ; Send output segment ASAP (else 1/2 sec clock) + %XBACF==:<2,,> ; Our FIN has been ACKed + + %XBABT==:< 400,,> ; We're aborting. + %XBFIN==:<1000,,> ; FIN received for input, input queue will not + ; get any more additions. +; %XBWOK==:<100,,> ; State is OK for user to write (else get IOC err) +; %XBROK==:<200,,> ; State is OK for user to read (else get IOC err) + + ; Connection state, as in TCP document (RFC-793) + ; Some test/dispatch code depends on the fact that the first + ; 4 states have the values they do. + ; ** NOTE: These .XSzzz symbols are not advertised to users. + ; ** Maybe I'll rename them in here sometime. -- CSTACY 9/84 + .XSCLS==:0 ; Closed (must be zero) + .XSSYQ==:1 ; ADDITIONAL ITS STATE: Syn-Queued + .XSLSN==:2 ; Listen + .XSSYN==:3 ; Syn-Sent + .XSSYR==:4 ; Syn-Rcvd + .XSOPN==:5 ; Established (Open) + .XSFN1==:6 ; Fin-Wait-1 + .XSFN2==:7 ; Fin-Wait-2 + .XSCLW==:10 ; Close-Wait + .XSCLO==:11 ; Closing + .XSCLA==:12 ; Last-Ack + .XSTMW==:13 ; Time-Wait + .XSTOT==:14 ; Total # of states +XBSTAU: BLOCK XBL ; User Channel state ,, +XBCLSU: BLOCK XBL ; Close reason ,, + .XCNTO==:0 ; Never opened + .XCUSR==:1 ; Closed by user + .XCFRN==:2 ; Closed by foreign host + .XCRST==:3 ; Fgn host reset things + .XCDED==:4 ; Fgn host dead (apparently) + .XCINC==:5 ; Incomplete transmission (retrans timeout) + ; ==:6 ; Byte size mismatch - can't happen + .XCNCP==:7 ; Local TCP went down + .XCRFS==:10 ; Fgn host refused connection (valid RST + ; received in SYN-SENT state) + +XBPORT: BLOCK XBL ; <4 zero bits> + ; It is set up this way for fast lookup of + ; incoming segments. +XBHOST: BLOCK XBL ; Remote host (HOSTS3 format) +XBLCL: BLOCK XBL ; Local host (HOSTS3 format) +XBNADR: REPEAT XBL,-1 ; Net host address to give the device driver (-1 none) + +; MP Input - see TCPI for detailed description +XBITQH: BLOCK XBL ; Input Segment TCP queue header +XBINBS: BLOCK XBL ; Total # bytes in input queue +XBINPS: BLOCK XBL ; Total # segments in input queue +XBIBP: BLOCK XBL ; Main prog BP to input +XBIBC: BLOCK XBL ; # bytes available for this BP + +; MP Output - see TCPW for detailed description +XBOCOS: BLOCK XBL ; Current Output Segment pointer (0 if none) +XBOBP: BLOCK XBL ; Main prog BP into output segment +XBOBC: BLOCK XBL ; # bytes of room for this BP + +XBORTP: BLOCK XBL ; Retransmit parameters +XBORTQ: BLOCK XBL ; Retransmit queue header +XBORTL: BLOCK XBL ; Retransmit queue length (# of segments) +XBORTC: BLOCK XBL ; Retransmit count (1st msg on queue) +XBORTT: BLOCK XBL ; Retransmit timeout (1st msg on queue) + +; TCP Send Sequence Variables +XBSUNA: BLOCK XBL ; Send Unacknowledged +XBSNXT: BLOCK XBL ; Send Next +XBSWND: BLOCK XBL ; Send Window (offered window) +XBSAVW: BLOCK XBL ; Available window (between SNXT and SUNA+WND) +XBSUP: BLOCK XBL ; Send Urgent Pointer +XBSWL1: BLOCK XBL ; Segment Seq number used for last window update +XBSWL2: BLOCK XBL ; Segment Ack number used for last window update +XBSMSS: BLOCK XBL ; Max seg size that receiver can handle + +; TCP Receive Sequence Variables +XBRNXT: BLOCK XBL ; Receive Next +XBRWND: BLOCK XBL ; Receive Window +XBRUP: BLOCK XBL ; Receive Urgent Pointer +XBRMSS: BLOCK XBL ; Max seg size we are expecting/ have asked for + +BBLK + +NTSYNL: SIXBIT /TCP/ ; Start SYS;ATSIGN TCP for random SYNs. +EBLK + 0 ; Word for NUJBST etc to mung for above job starting + +TCPUP: -1 ; -1 to handle TCP stuff, 0 to turn off. +TCPUSW: 0 ; -1 to disable net conns from anyone but ourself (like NETUSW) + ; Perhaps eventually this should be the same as NETUSW. +TCPRQN: 0 ; # of things in SYN queue, to keep it small +TCPRQL: 0 ; Index of last SYN queued. +TCPCRI: 0 ; Counter used for gensymming local port #s +TISSLU: 0 ; Last ISS used +TISSC: 0 ; Counter to further uniquize ISS +TCPLCP: 0 ; Last TCB index allocated +TCPBSW: -1 ? 0 ; Lock switch for allocating TCB indices +TCPTMO: 4*30. ; Default timeout for retransmits (in 30'ths of sec) +BBLK + +; Macro to perform sequence-number range checking. +; Note all numbers are 32-bit positive integers, modulo 2**32. +; Use it like this: +; CMPSEQ ,,,,,, +; Left and Right are addrs of the range bounds. One of them +; must be an AC. +; Seqno must be an AC. +; LT and LE are the strings "<" and "=<". +; Lerr and Rerr are the places to JRST to if the left or +; right compares fail, respectively. Rerr can +; be omitted and will default to Lerr. +; e.g. +; CMPSEQ A,<,D,=<,XBSNXT(I),TSI30 +; NOTE CAREFULLY that only existence within a range is checked, +; and the bounds L,R of the range MUST be known to be L =< R! +; It does not work to use CMPSEQ for the degenerate case +; CMPSEQ A,<,B,<,B,ERR +; to see if A < B. + +DEFINE CMPSEQ (L),C1,S,C2,(R),(OUTV1),(OUTV2) + %%%CML==0 + %%%CMR==0 +IFSE [C1][<] %%%CML==CAMG +IFSE [C1][=<] %%%CML==CAMGE +IFSE [C2][<] %%%CMR==CAML +IFSE [C2][=<] %%%CMR==CAMLE +IFE %%%CML&%%%CMR, .ERR Seq compare has bad relational arg + %%%CMX==CAMLE +IFSE [C1][=<] %%%CMX==CAML + +IFGE L-20,IFGE R-20, .ERR Seq compare needs ACs + +IFL L-20,CAMLE L,R ; Skip if normal order, L =< R +.ELSE CAMGE R,L + JRST [ ; Reverse order, R < L. Check S < R & L < S + %%%CMR S,R ; Skipwin if S <(=) R + %%%CMX S,L ; Unusual test here, win if S >(~=) L + JRST .+5 ; If either wins, win completely! +IFB OUTV2, JRST OUTV1 +.ELSE CAML S,[020000,,] ? JRST OUTV1 ? JRST OUTV2 + ] + ; Normal order, L =< R + %%%CML S,L ; Skipwin if S >(=) L + JRST OUTV1 + %%%CMR S,R ; Skipwin if S <(=) R +IFB OUTV2, JRST OUTV1 +.ELSE JRST OUTV2 +TERMIN + +SUBTTL TCP Open system call + +; .CALL TCPOPN +; arg 1 - receive channel number +; arg 2 - transmit channel number +; arg 3 - local port # (-1 to gensym unique port #) +; arg 4 - foreign port # (-1 for wild) +; arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild) +; arg 6 - Retransmission timeout (optional) + +;Control bits: +; - None needed for channels - they are opened as .UAI and .UAO +; automatically (no other modes possible). +; - 7 vs 8 bit ASCII transfers can be determined by user-space byte +; pointer used in SIOT. System buffers are always 8-bit bytes. +%NOLSN==:100 ; Listen mode +%NOBBI==:200 ; Use big buffer for input (not implemented yet) +%NOBBO==:400 ; Use big buffer for output (not implemented yet) +%NOWDA==:1000 ; Use word-align algorithm on transmit (not implemented yet) + +; Note a value of -1 for either the foreign port or host will imply +; that the call is a "listen". For the time being, either also implies +; the other, i.e. wild port means wild host and vice versa. This is +; because I havent figured out what the right thing to do is for the +; various combinations that could result otherwise. +; Word-align means that for the transmit side, all segments sent will +; have the data aligned so that the first byte, and every fourth byte +; after that, will start on a 32-bit word boundary. This should +; produce a noticeable speedup for transfers that involve large blocks +; of words rather than small amounts of miscellaneous text. +; For the latter, it only makes things worse, so is not the default. + +; Return is semi-immediate; the call may +; hang momentarily waiting for a free network buffer. (Have timeout? +; do a SKIPA SKIPA HANG to schedule, then fail if still none?) +; Use NETBLK +; to determine when the channels become open. For a non-listen call, +; there is an internal ITS timeout, but for listen the state can persist +; forever. + +TCPOPN: METER("TCP: syscal tcpopn") + MOVEI A,(A) + MOVEI B,(B) + CAIGE A,NIOCHN + CAIL B,NIOCHN + JRST OPNL14 ; Bad channel # argument + CAIN A,(B) + JRST OPNL33 ; Illegal to use same channel # for both + MOVEI J,(B) + HRLI J,(A) ; Save chan #s in J/ ,, + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,J + MOVEI R,(A) ; Close receive chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE ; Close whatever is already on channels. + HRRZ R,(P) ; Close xmit chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,J + POP P,E + POP P,D + POP P,C + + HLRZM J,UUAC(U) ; Remember input channel # for errs. + SKIPN TCPUP ; If TCP disabled, + JRST OPNL7 ; Fail, "device not ready". + CALL SWTL ; Lock TCB assignment switch + TCPBSW + MOVE I,TCPLCP + SOJL I,TCPO2 +TCPO1: SKIPN XBUSER(I) ; Hunt for free TCB + SKIPE XBSTAT(I) ; Must be both closed and unassigned. + SOJGE I,TCPO1 + JUMPGE I,TCPO3 ; Jump if got one! +TCPO2: MOVEI I,XBL ; Hit beginning, wrap back to end + CAMN I,TCPLCP + JRST OPNL6 ; No free TCB's available + MOVEM I,TCPLCP ; Might as well make faster next time + SOJA I,TCPO1 + +TCPO3: MOVEM I,TCPLCP ; Save scan pointer for next time + JRST TCPO4 ; (This is here for patching. -CSTACY) + + ; Got an index, now see if we're going to do a LISTEN + ; or an active open. +TCPO4: SETZ W, ; Assume active + CAME C,[-1] ; Verify local port is OK + CAIG C,177777 + CAIA + JRST OPNL11 ; Complain "illegal file name" + CAMN D,[-1] + AOJA W,.+3 + CAILE D,177777 + JRST OPNL11 + CAMN E,[-1] + ADDI W,2 + ; W = 0 if no wildcards, =1 if port wild, =2 if host wild, =3 both. + MOVE B,CTLBTS(U) ; Get control bits for call + CAIE W, + TRO B,%NOLSN ; Set "Listen" bit if implied by args. +; Crock - if either is wild, ensure both are. + CAIE W, + SETOB D,E + + SETZ R, ; Say we have no buffer + TRNE B,%NOLSN ; Skip if not listening, doing active open. + JRST TCPO20 ; Listening, don't need buffer. + + ; No wild-cards, this is going to be an active open. We will need + ; a buffer to send the initial SYN, so let's get it now and get + ; all possible PCLSR'ing over with, before turning off the NET PI. + CALL PKTGFI ; Get a free packet, skip unless fail. + CAIA ; Didn't get, skip to schedule. + JRST TCPO15 ; Got it! + SKIPA + SKIPA ; Force a schedule + CALL UFLS + CALL PKTGFI ; Try again. If we fail again, net is full, + JRST OPNL6 ; so better just return "device full" err. +TCPO15: MOVEI R,(A) ; We have buffer! Fall through. + TRCPKT R,"TCPO15 Alloc to send initial SYN" + + ; Okay, nothing can stop us now from running through to completion. + ; We do all the following code with net interrupts OFF so that + ; (a) We can scan all TCBs for port/host conflicts and be + ; sure we checked everything right, + ; (b) Incoming segments at int level won't be confused by + ; an inconsistent state for this TCB. + ; (c) We can check the pending-RFC queue safely. +TCPO20: CONO PI,NETOFF ; Don't let PI level see dirty work. + CAMN C,[-1] + JRST [ CALL TCPPCR ; Assign unique TCP port # + ROT D,-16. ; Put fgn port in high 16 bits + DPB A,[.BP TH%DST,D] ; Deposit local port + JRST TCPO30] ; Note that since port is unique, no + ; possible conflict with existing, so skip chk. + ; Also, low 4 bits indicate wildness if set. + + ; Note that low 4 bits of XBPORT are set to indicate wildness. + ; This ensures that TCPIS won't find them, but TSISQ will. + ; Have specific local port, check to make sure it doesn't already + ; exist in TCB tables. + ROT D,-16. ; Get fgn port in high 16 bits + DPB C,[.BP TH%DST,D] ; Put together the ports word + MOVSI T,-XBL +TCPO22: CAMN D,XBPORT(T) ; Look for matching port set + SKIPN XBSTAT(T) ; which is in use + AOBJN T,TCPO22 + JUMPL T,TCPO91 ; Ugh, found match! Must fail... + + ; OK, D has our unique port set, and we're ready to set things up. +TCPO30: MOVEM D,XBPORT(I) ; Store port set + SKIPL A,E + CALL CVH3NA ; Make sure it's HOSTS3 format. + MOVEM A,XBHOST(I) ; Store foreign host + CALL IPBSLA ; Call IP for best local address + MOVEM A,XBLCL(I) + CALL TXBINI ; Initialize the TCB + CALL TCPMSS ; Set default MSS values. Reexamined when + ; foreign host known if this is a wild listen. + CALL TCPRWS ; Open a default receive window + HRRZM U,XBUSER(I) ; Make TCB/index in use + HLRZ A,J ; Get back saved rcv channel # + DPB A,[XB$ICH (I)] ; Deposit input channel + DPB J,[XB$OCH (I)] ; and output channel + MOVE B,[0101,,0] ; Increment both channel #'s by 1 + ADDM B,XBUSER(I) ; So can distinguish chan 0 from no chan. + HRLZ T,I ; Set up user's IOCHNM words + HRRI T,TCPDUI + ADDI A,IOCHNM(U) + MOVEM T,(A) ; Set up input chan ,,TCPDUI + HRRI T,TCPDUO + ADDI J,IOCHNM(U) + MOVEM T,(J) ; Set up output chan ,,TCPDUO + + ; Search pending-RFC queue to make sure we match up or reject + ; with stuff in there. + LDB B,[.BP TH%DST,XBPORT(I)] ; B gets local port # + SETO D, ; D is -1 for any PE ptr. + CALL TCPRQS ; Search queue, return index in A + JUMPL A,TCPO41 ; Ignore further RFC checks if nothing. + MOVEI C,(A) + HRRZ A,XBITQH(C) + CAIN A, + BUG HALT + HLRZ W,PK.IP(A) + HLRZ H,PK.TCP(A) + TRNE D,17 ; If we're "wild" accepting any request, + JRST TCPO35 ; Take it! + LDB B,[IP$SRC (W)] ; No, must try full match. + CAMN B,XBHOST(I) ; If hosts match + CAME D,TH$SRC(H) ; and ports match too + JRST TCPO40 ; (don't) + + ; Matching request!! + ; For now, we ignore the listen/active distinction here, and + ; always try to establish connection with the pending RFC. + ; So, can flush use of R for listen flag. Have to flush the + ; extra buffer if it was "active" open, though, since we can + ; just re-use the pending-RFC packet. +TCPO35: METER("TCP: Open matched pending RFC") + JUMPN R,TCPO36 + MOVEI Q,XBITQH(C) ; If don't already have buffer, + CALL PKQGF(PK.TCP) ; Get it from the queued SYN (C is idx to) + SKIPN R,A ; It had better have a buffer! + BUG HALT + TRCPKT R,"TCPO36 Queued SYN used to answer pending RFC rqst" +TCPO36: LDB B,[IP$SRC (W)] + MOVEM B,XBHOST(I) ; Set host address + LDB B,[IP$DST (W)] + MOVEM B,XBLCL(I) ; Use local address the other end wants + MOVE D,TH$SRC(H) + MOVEM D,XBPORT(I) ; And ports + CALL TCPMSS ; Find default segment sizes for connection + CALL TCPRWS ; Set up receive window + EXCH C,I ; C identifies slot of queued SYN. + CALL TSISQF ; Flush the SYN from queue! + MOVEI I,(C) + CALL TSILSX ; Invoke interrupt level SYN+ACK, re-uses + ; the packet and sets state and everything. + JRST TCPO80 ; OK, take win return. + + ; Request doesn't match, restore it and fall thru. +TCPO40: +; MOVEI Q,TCPRQH ; Thought we had something but didn't, +; CALL PKQPF(PK.TCP) ; so put back on queue. + + ; No matching request on pending-RFC queue. +TCPO41: CAIN R, ; Skip if handling active open + JRST [ MOVEI A,.XSLSN ; No, handling a listen. + JRST TCPO70] ; Just change state and we're done. + + ; Active open, must fire off initial SYN. + ; R has PE ptr to free packet to be used for the SYN. + CALL TCPISS ; Get initial sequence # + MOVEM A,XBSUNA(I) ; Set up sequence vars + MOVEM A,XBSNXT(I) + MOVSI T,(TC%SYN) ; Note no ACK in initial segment! + TRCPKT R,"TCPO41 Send initial SYN" + CALL TSOSSN ; Send SYN segment (clobber mucho ACs) + MOVEI A,.XSSYN ; Set state to SYN-SENT and fall thru. + +TCPO70: HRRM A,XBSTAT(I) ; Set state LISTEN or SYN-SENT. + CALL TCPUSI ; Change user state. +TCPO80: CONO PI,NETON + JRST LSWPJ1 ; Success return, unlock switch and skip. + + ; Port match failure, must back off and fail. +TCPO91: CONO PI,NETON ; No need to hide our shame + SKIPE A,R ; If we had a buffer, + CALL PKTRT ; return it to freelist. + JRST OPNL13 ; Say "file already exists". + +; TXBINI - Initialize TCB connection table entries for specific index. +; The things it doesn't touch are commented out below. +; I/ TCB index + +TXBINI: +; SETZM XBUSER(I) ; Set after +; SETZM XBSTAT(I) ; Set after + SETZM XBSTAU(I) + SETZM XBCLSU(I) +; SETZM XBPORT(I) ; Set prior +; SETZM XBHOST(I) ; Set prior +; SETZM XBLCL(I) + SETOM XBNADR(I) + + ; I/O vars + SKIPE XBITQH(I) + BUG CHECK,[TCP: Init TCB has input, I=],OCT,I,[list ],OCT,XBITQH(I) + SETZM XBITQH(I) + SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + + SKIPE XBOCOS(I) + BUG CHECK,[TCP: Init TCB has output, I=],OCT,I,[list ],OCT,XBOCOS(I) + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + + ; Retransmit stuff + SETZM XBORTP(I) + SKIPE XBORTQ(I) + BUG CHECK,[TCP: Init TCB has retrans, I=],OCT,I,[list ],OCT,XBORTQ(I) + SETZM XBORTQ(I) + SETZM XBORTL(I) + SETZM XBORTC(I) + SETZM XBORTT(I) + + ; TCP Send Sequence Initialization + SETZM XBSUNA(I) + SETZM XBSNXT(I) + SETZM XBSWND(I) + SETZM XBSAVW(I) + SETZM XBSUP(I) + SETZM XBSWL1(I) + SETZM XBSWL2(I) +; SETZM XBSMSS(I) ; Set after + + ; TCP Receive Sequence Initialization + SETZM XBRNXT(I) + SETZM XBRUP(I) +; SETZM XBRMSS(I) ; Set after +; SETZM XBRWND(I) ; Set after + RET + +; TCPPCR - Port Create. Creates a unique local port #. +; Returns # in A. Current algorithm is very simple/dumb. +; Must only be called at MP level with NETOFF. +; Clobbers T,Q + +TCPPCR: PUSH P,B + MOVEI A,(U) ; Get user index + IDIVI A,LUBLK ; Find job # + AOS B,TCPCRI ; Bump and get new counter + ROT B,-8. ; Put low bits into high + LSHC A,8. ; Then shift them into port # + CALL TCPPLU ; See if this port unique or not. + JRST [ AOS TCPCRI ; If not, AOS stuff and keep going. + AOJA A,.-1] + POP P,B + RET + +; TCPPLU - Port Lookup. Skips if port # unique among local ports. +; A/ port # +; Clobbers T, Q. +; Returns .+1 if fail (number not unique) +; T/ idx of matching TCB + +TCPPLU: LSH A,4 ; Shift over for easier compare + MOVSI T,-XBL +TCPLU2: SKIPN Q,XBPORT(T) + JRST TCPLU3 + AND Q,[TH%DST] + CAMN A,Q + JRST TCPLU7 +TCPLU3: AOBJN T,TCPLU2 + AOS (P) +TCPLU7: LSH A,-4 + RET + +; TCPMSS - Determine and set max bytes per segment for TCB in I +; I/ TCB index. XBHOST should be set already. +; Bashes A, T +; Base maximum TCP segment sizes on size of largest datagram IP wants +; to send to destination. This sets the default sizes. We will tell +; the foreign side what we want (XBRMSS) with a TCP MSS option in the +; outgoing SYN. We will adjust what we send (XBSMSS) down if foreign +; side requests it with MSS opton in an incoming SYN. + +TCPMSS: MOVE A,XBHOST(I) ; Foreign address + CALL IPMTU ; IP datagram size to T + SUBI T,40. + MOVEM T,XBSMSS(I) ; Set default send and receive segment sizes + MOVEM T,XBRMSS(I) + RET + + +SUBTTL Other TCP device system call routines + +; Device name in DEVTAB, device code in DCHSTB, index in RSTB to some tables + +; OPEN - from DEVADR + +TCPO: JRST OPNL12 ; Say "mode not avail" + ; Save rest temporarily. + HLRS C + MOVSI A,(A) ; Save RH of FN1 in LH of IOCHNM + JSP Q,OPSLC7 + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + +; CLOSE - from CLSTB +; R/ addr of IOCHNM word + +TCPCLS: METER("TCP: syscal close") + HLRZ I,(R) ; Get TCB index from LH of IOCHNM + CAIL I,XBL ; Make sure it's reasonable + BUG HALT,[TCP: CLS idx bad] + HRRZ A,XBUSER(I) ; Verify user + CAIE A,(U) + BUG HALT,[TCP: CLS usr bad] + SETO D, ; See if input or output + HRRZ A,(R) + CAIN A,TCPDUO ; Output? + AOSA D + CAIN A,TCPDUI ; Input? + ADDI D,1 + CAIGE D, ; D/ 0 for input, 1 for output. + BUG ; IOCHNM value screwed up?? + LDB A,[XB$ICH (I)] ; Get input chan # according to TCB + LDB B,[XB$OCH (I)] ; Ditto output + MOVEI C,(R) + SUBI C,IOCHNM(U) ; Find channel # we're closing + ADDI C,1 ; Increment since TCB # is really #+1 + CAME C,A(D) ; Compare with channel # in TCB + BUG HALT,[TCP: Close chan not same as TCB chan] + JUMPN D,[MOVEI D,2 + CAIE A, + MOVEI D,3 + JRST TCPC06] + CAIE B, + IORI D,1 +TCPC06: + ; D is now a 2-bit channel status index. + ; Bit 1.2 is 0 for input, 1 for output. + ; Bit 1.1 is 0 if other channel is closed, 1 if it is still open. + SKIPN XBSTAT(I) ; Perhaps already gone? + JRST TCPCL8 ; Yeah, flush channel etc. + PUSH P,D + CONO PI,NETOFF ; Ensure that state doesn't change on us. + HRRZ J,XBSTAT(I) + CAIL J,.XSTOT + BUG HALT,[TCP: CLS state bad] + XCT TCPCXT(J) ; Invoke closure stuff appropriate for state + CONO PI,NETON ; TCB state hacking done, can re-enable ints. + POP P,D + + ; Remove links between user channel and TCB. If both channels + ; are gone, XBUSER is cleared completely. + ; The TCB is not necessarily closed at this point (XBSTAT zero) + ; but TCP will look after it independently to ensure it eventually + ; goes away. +TCPCL8: SETZ B, ; Get a zero + MOVEI T,.XCUSR ; Use this for "Close reason" if needed + TRNE D,2 ; Remember D bit 1.2 indicates output chan + JRST [ DPB B,[XB$OCH (I)] ; Yup, clear output chan. + CALL TCPUCO ; Set close reason if necessary + HRRZ A,XBOCOS(I) ; Does a COS buffer exist? + CAIN A, + JRST TCPCL9 ; Nope, nothing to flush. + CALL PKTRTA ; Aha, free it up. + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST TCPCL9] + DPB B,[XB$ICH (I)] ; Clear input chan. + CALL TCPUCI ; Set close reason if need to. + CALL TXBIFL ; Flush input queue + +TCPCL9: TRNN D,1 ; Skip if other channel still there. + SETZM XBUSER(I) ; Else flush whole word incl user index! + TRNE D,1 ; If a channel is left, + CALL TCPUSI ; we may need to take interrupt on it. + LDB A,[XB$STY (I)] ; Was a STY connected to channel? + JUMPE A,CPOPJ ; Return if not. + MOVEI I,(A) ; Ugh, must disconnect it! Set up TTY # + CALL NSTYN0 ; Disconnect + JFCL + RET ; Return (CLOSE will clear IOCHNM/IOCHST) + +TCPCLE: BUG CHECK,[TCP: Illegal state in CLOSE, J=],OCT,J,[ D=],OCT,D + CALL TXBFLS ; Flush all of TCB but XBUSER + RET + +TCPCXT: OFFSET -. +.XSCLS:: CALL TXBFLS ; Closed already, but flush again to make sure +.XSSYQ:: CALL TCPCLE ; Syn-Queued - can't happen!! +.XSLSN:: CALL TXBFLS ; Listen - flush TCB, enter closed state. +.XSSYN:: CALL TXBFLS ; Syn-Sent - flush TCB, enter closed state. +.XSSYR:: XCT TCPCXT+.XSOPN ; Syn-Rcvd - handled same as OPEN below +.XSOPN:: XCT (D)[ ; Established (Open) + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC30 ; Out (only) - Send FIN, enter FIN-WAIT-1 + CALL TCPC30] ; Out (have In) - " " " " +.XSFN1:: XCT (D)[ ; Fin-Wait-1 + JFCL ; In (only) - Disconnect input + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSFN2:: XCT (D)[ ; Fin-Wait-2 + CALL TXBFLS ; In (only) - Flush, give up waiting + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSCLW:: XCT (D)[ ; Close-Wait + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC70 ; Out (only) - Send FIN, enter LAST-ACK + CALL TCPC70] ; Out (have In) - " " " " +.XSCLO:: XCT TCPCXT+.XSFN1 ; Closing - handled same as Fin-Wait-1 etc. +.XSCLA:: XCT TCPCXT+.XSFN1 ; Last-Ack - handled same as Fin-Wait-1 etc. +.XSTMW:: XCT TCPCXT+.XSFN1 ; Time-Wait - handled same as Fin-Wait-1 etc. +.XSTOT:: OFFSET 0 + + ; Closing output channel while in SYN-RCVD state. + ; Send a FIN and enter FIN-WAIT-1 state. +TCPC30: CALL TCPCLF + MOVEI J,.XSFN1 + JRST TCPC75 + + ; Closing output channel while in CLOSE-WAIT state. + ; Send a FIN and enter LAST-ACK state. +TCPC70: CALL TCPCLF + MOVEI J,.XSCLA +TCPC75: HRRM J,XBSTAT(I) + RET + +TCPCLF: MOVSI T,(TC%ACK+TC%FIN+%XBNOW) ; Tell TCP that output needs FIN and ACK. + JRST TCPOFR ; Go force out current buffer if any + +; TCPUC - Set "Reason-closed" states if not already set. +; T/ Reason to use, if none already exists. +; Clobbers Q +TCPUC: CALL TCPUCI +TCPUCO: HRRZ Q,XBCLSU(I) + CAIN Q, + HRRM T,XBCLSU(I) + RET +TCPUCI: HLRZ Q,XBCLSU(I) + CAIN Q, + HRLM T,XBCLSU(I) + RET + +; TXBFLS - Flush all info about a TCB from TCP viewpoint. +; Mostly consists of freeing up all buffers used, and then +; clearing out most other data cells of the TCB. +; Note that XBUSER and XBSTAU are not affected! +; TXBFLP - ditto but usable at PI level, it is careful not to smash +; things that MP level might be referencing. +; Clobbers A,T,Q +; TXBIFL - Flushes input queue +; TXBOFL - Flushes output queue (including retrans list!) + +TXBFLS: SETZM XBSTAT(I) + CALL TXBIFL + CALL TXBOFL + SETZM XBPORT(I) + SETZM XBHOST(I) + RET + +; TXBFLP - Things to be careful of: +; - swiping COS +; - flushing input queue (don't touch it) + +TXBFLP: CALL TXBOFL + SETZM XBSTAT(I) ; Say off-limits to PI level now. + SETZM XBPORT(I) + SETZM XBHOST(I) + LDB T,[XB$ICH (I)] ; See if input chan active + CAIN T, + CALL TXBIFL ; No input chan, so ensure input q flushed + CALL TCPUSI ; Alert user to mung + RET + +TXBIFL: SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + MOVEI Q,XBITQH(I) + CALL PKPFLS + SKIPE XBITQH(I) + BUG CHECK,[TCP: Incompl input fls I=],OCT,I,[list ],OCT,XBITQH(I) + CALL TCPRWS ; Reset receive window. + RET + +TXBOFL: HRRZ A,XBOCOS(I) ; If current output seg exists, + CAIE A, + SKIPGE XBSTAT(I) ; and isn't locked by MP level, + CAIA + JRST [CALL PKTRTA ; then free it + SETZM XBOCOS(I) ; and clear the pointer. + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST .+1] + SETZM XBORTT(I) + SETZM XBORTC(I) + MOVEI Q,XBORTQ(I) + CALL PKPFL ; Flush retrans list carefully. + SKIPE XBORTL(I) + BUG CHECK,[TCP: Incompl output fls, I=],OCT,I,[list ],OCT,XBORTQ(I) + MOVE A,XBSNXT(I) + MOVEM A,XBSUNA(I) ; Claim everything ACK'd. + SETZM XBSWND(I) ; Zero our send window. + SETZM XBSAVW(I) ; and available window + SETZM XBSUP(I) ; and urgent pointer. + RET + +PKPFLS: PUSH P,Q +PKPFL2: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CALL PKTRTA ; Should always be freeable. + JRST PKPFL2 + +; Ditto, but for flushing retransmit queue, which has to be special +; since packets are linked on IP output list as well as TCP list. +; Since we can't take packets off the IP output list here, we just set +; a flag telling output PI level to ignore the packet. + +PKPFL: PUSH P,Q +PKPFL3: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CONO PI,PIOFF + MOVE T,PK.FLG(A) ; Check packet flags + TLNN T,(%PKODN) ; Output done? + JRST [ TLO T,(%PKFLS) ; No, say to flush when hit it. + TLZ T,(%PKNOF) ; and just in case, turn don't-free flag off. + MOVEM T,PK.FLG(A) + CONO PI,PION + TRCPKT A,"PKPFL3 Packet not flushed" + JRST PKPFL4] + CONO PI,PION + CALL PKTRT +PKPFL4: SOSGE XBORTL(I) + BUG CHECK,[TCP: Retrans Q count err] + JRST PKPFL3 + +SUBTTL TCP Main Program Input + +; All TCP input segments for a connection are put on a queue that +; is headed at XBITQH. When this header is zero, there is no more +; input; if the %XBFIN flag is also set, the remote host has closed +; its transmit side and there will never be any more input. +; Segments are only added by PI level, at the end of the queue. +; Segments are only removed by MP level IOTs, at the start of the queue. +; (An incoming RST will of course flush the queue at PI level) + +; If XBIBP is non-zero, it points into the first segment on the input queue, +; and XBIBC is also valid; things are ready for MP IOTing. +; However, neither XBIBP nor XBIBC is meaningful if XBITQH is zero. + +; Input IOT - from IOTTB + SKIPA T,[SIOKT] ; Come here for SIOT entry +TCPI: MOVEI T,CHRKT + METER("TCP: syscal in") + HLRZ I,(R) ; Get TCB index + + ; Verify state, do misc setup for reading + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Can't IOT if direct-connected to STY. + JRST IOCR10 ; "Chan in illegal mode" + HLRZ B,XBSTAU(I) ; Just reading state, don't need NETOFF. + SKIPG TCPTBI(B) ; Ensure meta-state allows reading. + JRST [ HLRZ B,XBCLSU(I) ; Can't read, see if reason OK + CAIN B,.XCFRN ; Only OK reason is clean fgn close. + JRST UNIEOF ; Yeah, just return quietly. + JRST IOCR10] + + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + XBIBP(I) ; Byte pointer + XBIBC(I) ; # bytes to read + TCPIBG ; Routine to get next buffer + TCPIBD ; Routine to discard buffer + 0 ; not used + TRNA ; Negative - TCPIBG and TCPIBD will do waiting. + ] + CALL (T) + CAIA + AOS (P) + SKIPG XBIBC(I) ; If count for this buffer reached zero, + CALL TCPIBD ; Flush it so XBITQH is valid indication of input avail + RET + +; TCPIBD - Discard input buffer, invoked by I/O. +; This is always called before TCPIBG is. + +TCPIBD: SKIPN XBIBP(I) ; Make sure something's there to discard. + RET ; Nope, gone or was never set up. + MOVEI Q,XBITQH(I) ; Point to TCP input queue header + CALL PKQGF(PK.TCP) ; Get first thing off queue, into A + CAIN A, ; Something better be there. + BUG HALT,[TCP: IOTI queue lost] + + ; Check BP just out of sheer paranoia. + HRRZ T,XBIBP(I) ; Find addr BP points to (maybe +1 actual) + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + CAIL Q,(T) ; Header better be less than BP! + JRST TCPIB2 + TRZ Q,PKBSIZ-1 ; Get addr of start of buffer + CAILE T,PKBSIZ(Q) ; BP should be within or just past end. +TCPIB2: BUG HALT,[TCP: IOTI BP incons] + + ; Okay, end of paranoia, just flush the buffer. + LDB T,[PK$TDL (A)] ; Find # chars we read + MOVN T,T + ADDM T,XBINBS(I) ; Update # chars avail for input. + CALL PKTRT ; Return packet to freelist. + SOSGE T,XBINPS(I) ; Decrement count of segs on input queue + BUG CHECK,[TCP: Input Q count incons] + CAIL T,%TCPMI/2 ; If we are now handling past 50% input, + JRST [ MOVSI T,(TC%ACK) ; Make sure we send an ACK + IORM T,XBSTAT(I) ; so new rcv window is reported. + JRST .+1] + CONO PI,NETOFF + CALL TCPRWS ; Set new receive window + CALL TXBIST ; Get new input chan state + HRLM T,XBSTAU(I) ; Set it. Note interrupt is avoided here. + CONO PI,NETON + SETZM XBIBP(I) + SETZM XBIBC(I) + RET ; Always return with simple POPJ + +TCPRWS: MOVEI T,%TCPMI + SUB T,XBINPS(I) ; Find # segs we can still queue up + CAIGE T,1 ; If no full segs left, + TDZA T,T ; Zero the window, no more segs allowed + IMUL T,XBRMSS(I) ; Else will take N * MSS bytes +TCPRW3: MOVEM T,XBRWND(I) + RET + +IFN 0,[ + ; This code turns out to lose because the code at TCPIS only + ; checks XBRWND to see whether to compact input or not, and as + ; long as XBRWND is non-zero, stuff will always be added to queue, + ; using up all the packet buffers. + ; Basically it's a question of whether or not to allow more input, + ; up to limits of last queued buffer, if the queue has too many + ; buffers on it. Metering will show whether most other implementations + ; win or lose with our buffer-alloc type windowing. +TCPRW2: HLRZ Q,XBITQH(I) ; Find # chars room in last seg + LDB T,[PK$TDL (Q)] + LDB Q,[PK$TDO (Q)] + ADDI Q,(T) + MOVEI T,576. + SUBI T,(Q) + CAIGE T, + SETZ T, + MOVEM T,XBRWND(I) + RET +] + +; TCPIBG - Get new input buffer (invoked by I/O, after TCPIBD) +; Return .+1 if can't get new buffer, must wait (Never, we do waiting) +; Return .+2 if OK, new BP and count set up. +; Return .+3 if "EOF", transfer complete + +TCPIBG: SKIPE XBIBP(I) ; Shouldn't be anything already there. + BUG HALT,[TCP: IOTI buf incons] +TCPIB3: SKIPN A,XBITQH(I) ; See if anything in input queue + JRST TCPIB5 ; No, go handle EOF. + LDB T,[PK$TDL (A)] ; Find # bytes input for this segment + CAIN T, ; Something probably shd be there. + BUG HALT,[TCP: IOTI null seg] + MOVEM T,XBIBC(I) ; Store as new # bytes + LDB T,[PK$TDO (A)] ; Get offset from start of header + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + ROT T,-2 ; Divide offset by 4 + ADDI Q,(T) ; Point to right word + LSH T,-34. ; Right-justify the low 2 bits + HRL Q,(T)[441000 ? 341000 ? 241000 ? 141000] ; Get right LH for BP + MOVEM Q,XBIBP(I) ; Now store BP! + JRST POPJ1 ; Say ready to go again... + + ; No input available. First check to see if there will ever + ; be any more (FIN seen?), then whether to return right away or + ; hang. +TCPIB5: CONO PI,NETOFF ; Avoid timing inconsistencies + SKIPE A,XBITQH(I) ; Check again + JRST [ CONO PI,NETON ; Got some?? + JRST TCPIB3] ; Try again. + SKIPN XBINPS(I) ; No, should also have no segments + SKIPE XBINBS(I) ; and no bytes + BUG HALT,[TCP: IOTI count incons] + MOVE A,XBRWND(I) ; Save value of rcv window + CALL TCPRWS ; Then reset the window + CAME A,XBRWND(I) ; Was previous value correct? + METER("TCP: RCV.WND out of synch") + MOVE T,XBSTAT(I) ; Get flags + CONO PI,NETON + TLNE T,(%XBFIN) ; FIN seen, and input queue empty? + JRST TCPIB6 ; Yes, true EOF now. + + MOVE T,CTLBTS(U) ; See if call had "don't-hang" bit set + TRNE T,10 + JRST TCPIB7 ; No, return EOF. + SKIPN XBITQH(I) ; Wait until input queue has something. + CALL UFLS + JRST TCPIBG ; Then call again. + +TCPIB6: +TCPIB7: CALL TCPUSI ; Adjust user state. + JRST POPJ2 ; and return "EOF" + + +SUBTTL TCP Main Program Output + +; Output IOT - from IOTTB +; Output segments are chained together from XBORTQ, which is +; the "retransmit queue". +; The queue only contains segments which occupy sequence space, since +; these are the only ones which require ACKs and possible retransmit. +; All others are sent directly to the IP output queue. +; While the transmit connection is open, +; Segments are only added by MP level IOTs, at the end of the queue. +; Segments are only removed by PI level ACKs, at the start of the queue. + +; Main program I/O is done into the "Current Output Segment", which is NOT +; on the retransmit queue. There are three variables related to this COS. +; XBOCOS - ,, +; XBOBP - BP into the COS, for MP IOT writing. +; XBOBC - Count of # bytes left that MP IOT can deposit into. +; Note that the maximum possible size of the buffer is kept in PK$TDL +; (TCP segment Data Length). For windowing reasons it may be necessary +; to restrict the amount of space actually used, thus the initial value +; of XBOBC may be less than PK$TDL. This is why the initial value is also +; copied into the RH of XBOCOS, so that when XBOBC counts out we know +; exactly how much of the buffer was actually used. It is possible for +; XBOBC to be increased by interrupt level window processing, in order +; to increase utilization of the buffer. +; States: +; If XBOCOS is zero, XBOBP and XBOBC must also be zero; there is +; no COS. +; If XBOCOS is non-zero (a current output seg exists), then: +; if LH(XBOCOS) is zero, the segment hasn't yet been written +; into, and needs to be set up. +; XBOBP and XBOBC should be zero! +; else the segment is set up for writing. XBOBP should be set! +; If XBOBC is zero it means the segment now contains +; LH(XBOCOS) bytes of data. If this number is less +; than PK$TDL (max possible seg data) then the count +; may be reset to allow further output into this +; segment, or it may simply be sent as is. +; +; The current segment is put on the retransmit queue (and IP output queue) +; when: +; PI level (eg clock) decides it's time to send an ACK or do a FORCE. +; MP level IOT fills up the segment completely. +; MP level FORCE or CLOSE is invoked. +; The current segment is locked down during MP IOT, to keep PI level +; from ripping it away (which would leave entrails dangling). +; PCLSR'ing will clear this lock. If TCP flushes the TCB at PI level +; for some reason, XBOCOS will be freed unless locked. XBOBC and XBOBP +; will still be cleared even if locked, so as to cause a call to TCPOBW +; which will notice the condition and free the COS itself. + + SKIPA A,[SIOKT] ; Come here for SIOT entry +TCPW: MOVEI A,CHRKT + METER("TCP: syscal out") + HLRZ I,(R) ; Get TCB index from IOCHNM wd + + ; Verify state, do misc setup for writing, lock segment. + CONO PI,NETOFF + HRRZ B,XBSTAU(I) ; Get output chan state + SKIPG TCPTBO(B) ; See if meta-state allows writing + JRST IOCR10 ; Can't, say "chan not open" (ugh) + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Also can't if direct-connected to STY. + JRST IOCR10 + MOVSI B,(%XBMPL) ; Set locked flag (must be sign bit!) + IORM B,XBSTAT(I) + CONO PI,NETON ; Okay, we've got it. + CALL SGNSET ; Set PCLSR routine to unlock flag. + XBSTAT(I) + SKIPN XBOCOS(I) ; If no COS there, + SETZM XBOBC(I) ; make SURE count is zapped so refill invoked. + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + SETZ XBOBP(I) ; Output BP found here (sign sez is output) + XBOBC(I) ; # bytes of room remaining + TCPOBG ; Routine to get another buffer (not used) + TCPOBW ; Buffer full, routine to send it. + 0 ; Not used + TRNA] ; Negative - TCPOBG and TCPOBW will do waiting. + CALL (A) + CAIA + AOS (P) ; Pass on a skip return. + + ; User IOT is done, now unlock the segment. + ; We also check for wanting to do an immediate ACK and if needed + ; ship out the current buffer right now, without waiting + ; for the 1/2-sec clock to do it. + SKIPN A,XBSTAT(I) ; See if XBSTAT is still set + JRST IOCR10 ; No, take IOC error return! + CAIL A, ; It better still be locked! + BUG CHECK,[TCP: Output not locked] + CALL LSWPOP ; Clear the lock flag + TLNN A,(%XBNOW) ; Was "immediate-send" flag set? + RET ; Nope, can just return. + METER("TCP: TCPW exit force") + CONO PI,NETOFF + MOVSI T,(TC%PSH) ; Hmm, set up and shove out. + CALL TCPOFR ; and force out current output segment. + CONO PI,NETON + RET + +TCPOBG: BUG CHECK,[TCP: IOT called wrong rtn (TCPOBG)] + AOS (P) ; If proceeded, can still win. Make skip return + ; and drop through to TCPOBW. + +; TCPOBW - Write/Get output buffer, invoked by SIOKT/CHRKT when the +; buffer count (XBOBC) is zero. This routine can figure out +; whether it needs to ship out a full buffer, or get a new +; output buffer, or both. Always returns with XBOBP and +; XBOBC set up for additional output (otherwise it hangs and +; can be PCLSR'd) + +TCPOBW: SKIPE R,XBOCOS(I) ; Get PE ptr to COS + JRST [ HLRZ A,R ; Got a COS, see if already set up + JUMPN A,TCPOB5 ; Jump if so. + JRST TCPOB2] ; Else must set it up. + + ; No current segment, must get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + JRST IOCR10 ; Blooie, say "Chan not open". + CALL PKTGF ; Get one, hang until we succeed. + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOBW Alloc for IOT output buffer" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOB2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Hang until we have less than this. + CALL UFLS ; Note that conn closure will unhang too, + ; because it flushes output queue. + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOB4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + JRST IOCR10] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for PCLSRing. + CALL TCPOB9 ; Check available window + JRST [ CONO PI,NETON ; Window too small, allow ints + CALL TCPOB9 + CALL UFLS + JRST TCPOB4] ; Big enough, go back and re-try stuff. + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + RET ; Okay, all set up, return. + +TCPOB9: MOVE A,XBSWND(T) + LSH A,-2 ; Get 25% offered window + CAML A,XBSAVW(T) ; If 25% offered > avail window, + RET ; punt and wait for better stuff. + JRST POPJ1 + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOB5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOB6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOB6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + RET ; And return happily. + +TCPOB6: TRCPKT R,"TCPOB6 IOT Send" + CALL TCPOB7 + JRST TCPOBW + +TCPOB7: DPB T,[PK$TDL (R)] ; Okay, say this many bytes of data are in seg + PUSH P,B + PUSH P,C + PUSH P,E + MOVSI T,(TC%PSH) ; Ensure seg is pushed out. + IORM T,XBSTAT(I) + CALL TSOSND ; Send data segment (# bytes in PK.TCI) + ; This clobbers a lot of ACs! + SETZM XBOCOS(I) ; No current output segment now. + CONO PI,NETON + SETZM XBOBP(I) + SETZM XBOBC(I) + POP P,E + POP P,C + POP P,B + RET + +; TCPOFR - Force out partially-filled current output segment +; Must have NETOFF. +; Called by FORCE and CLOSE at MP level +; by TCPCLK at PI clock level +; Note that we try to never have stuff in the COS which would +; over-run our send window, by hanging in MP IOT. This will +; be slightly screwed up if the receiver suddenly decreases the window +; size, since this routine always sends the whole thing anyway, +; but it's probably OK (helps avoid SWS) +; I/ TCB index +; T/ additional flags to use (PUSH, URG, FIN) +; Clobbers R and everything that TSOSND does (a lot!) + +TCPOFR: MOVE A,XBSTAT(I) ; Get flags for connection + TLNE A,(%XBCTL) ; Wants anything added on? + IOR T,A ; Yes, OR the bits in. + JUMPL A,TCPOF6 ; If locked at MP level, don't send it! + SKIPN R,XBOCOS(I) ; See if current output seg exists + JRST TCPOF5 ; No, can't hack now. + HLRZ TT,R ; Get # bytes of original buffer size + JUMPE TT,TCPOF5 ; If none, nothing to hack. + SUB TT,XBOBC(I) ; Subtract # left, to get # bytes data + CAIG TT, + JRST [ SETZ TT, ; No data, see if a flag wants to be sent. + TLNN T,(TC%FIN+TC%ACK+TC%SYN) ; Any of these are impt. + JRST TCPOF9 ; Nope, do nothing. + JRST .+1] + DPB TT,[PK$TDL (R)] ; Store back # bytes of real data + AND T,[TH%CTL] ; Mask off the flags + IORM T,XBSTAT(I) ; Stuff in as requests + TRCPKT R,"TCPOFR Force send" + CALL TSOSND ; Send out the stuff + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) +TCPOF9: RET + + ; No current output segment, so no data to send. Check, though, + ; to see if any flags need sending. +TCPOF5: TLNN T,(TC%SYN+TC%ACK+TC%FIN) + RET ; Nope, just return. + MOVE E,T ; They do! Save em against smashage + CALL PKTGFI ; Try to get a buffer (clobbers T,Q) + JRST TCPOF6 ; Ugh, failed, see about setting flags. + MOVEI R,(A) + TRCPKT R,"TCPOF5 Alloc and send flags only in TCPOFR" + MOVE T,E ; Restore flags + CALL TSOSNR ; Set up the packet and send it! + RET + + ; Can't get packet now, so set up the request flags for later hacking. + ; Also comes here when current output seg is locked at MP level. +TCPOF6: AND T,[%XBCTL] ; Clear out extraneous bits + TLO T,(%XBNOW) ; Ask to send stuff immediately + IORM T,XBSTAT(I) ; and set flags back. + RET + +; TCPOSB - Routine similar to TCPOBW, except that it doesn't hang, +; so that it is suitable for calling at PI level (by STYNTC esp) +; Returns .+1 if can't set up output buffer for writing. +; Returns .+2 if output buff is all set up, with non-zero XBOBC. + +TCPOSB: SKIPE R,XBOCOS(I) + JRST [ HLRZ A,R ; Have COS, see if already set up + JUMPN A,TCPOS5 ; Jump if so. + JRST TCPOS2] ; Else just set it up. + + ; No current segment, get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + RET ; Blooie. + CALL PKTGFI ; Get one, skip if successful + RET ; Sigh... + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOSB Alloc for STYNET output data" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOS2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Fail if we have more than this. + RET + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOS4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + RET] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for testing (no PCLSR) + CALL TCPOB9 ; Check available window + JRST NETONJ ; Window too small, just return + + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + AOS (P) + RET ; Okay, all set up, return. + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOS5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOS6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOS6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + AOS (P) + RET ; And return happily. + +TCPOS6: TRCPKT R,"TCPOS6 STYNET Send" + CALL TCPOB7 + JRST TCPOSB + +TCPBI: +TCPBO: RET ; No-ops, labels left in case want to use. + +; STATUS - from LH(DTSTB) +; Must return status in LH(D). Must not smash C,R. +; R/ addr of IOCHNM word + +TCPSTA: HLRZ I,(R) ; Get TCB index + SKIPN XBUSER(I) ; Probably an error if this is zero. + BUG CHECK,[TCP: STATUS on unused conn ],OCT,I + SETZ D, + SKIPN XBSTAT(I) + RET + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + SKIPA T,[TXBIST] + MOVEI T,TXBOST + CALL (T) + DPB T,[140600,,D] + RET + + +TXBIST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBI(T) ; Get conversion + JRST [ SKIPN XBITQH(I) ; Must test for input avail - any segs? + SKIPA T,(T) ; None avail, use standard + MOVE T,1(T) ; Have some waiting, use alternate state + RET] + RET +XBCTBI: OFFSET -. +.XSCLS:: SETZ [%NTCLS ? %NTCLI] ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTINP] ; 5/11 Established (open) +.XSFN1:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-1 +.XSFN2:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTCLU ? %NTCLI] ; 3/10 Close-Wait +.XSCLO:: SETZ [%NTCLS ? %NTCLI] ; 7/10 Closing +.XSCLA:: SETZ [%NTCLS ? %NTCLI] ; 7 Last-Ack +.XSTMW:: SETZ [%NTCLS ? %NTCLI] ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + +TXBOST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBO(T) ; Get conversion + JRST [ SKIPN XBORTQ(I) ; Must test for output queued + SKIPA T,(T) ; None, use standard + MOVE T,1(T) ; Have some output waiting, use alternate state + RET] + RET +XBCTBO: OFFSET -. +.XSCLS:: %NTCLS ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Established (open) +.XSFN1:: %NTCLX ; 7 Fin-Wait-1 +.XSFN2:: %NTCLX ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Close-Wait +.XSCLO:: %NTCLX ; 7 Closing +.XSCLA:: %NTCLX ; 7 Last-Ack +.XSTMW:: %NTCLX ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + + +; WHYINT - from RH(DTSTB) +; Results are: +; A/ %WYTCP +; B/ +; C/ input - # bytes in input buff +; output - # bytes of room avail in output buff +; D/ Close reason (only valid if state %NTCLS) + +TCPWHY: HLRZ I,(R) ; Get TCB index + METER("TCP: syscal whyint") + CAIL I,XBL + BUG HALT,[TCP: WHY idx bad] + CALL TCPSTA + LDB B,[140600,,D] ; Get state for channel + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + JRST [ HLRZ D,XBCLSU(I) ; Get input close reason + MOVSI C,(XB%STY) + TDNE C,XBUSER(I) ; No input avail if direct-conn to STY + JRST [ SETZ C, ? JRST TCPWH5] + SKIPLE C,XBINBS(I) + JRST TCPWH5 + SKIPN C,XBITQH(I) + JRST TCPWH5 + LDB C,[PK$TDL (C)] + JRST TCPWH5] + HRRZ D,XBCLSU(I) ; Get output close reason + SKIPN C,XBOBC(I) ; Get # bytes of room left in current pkt + JRST [ MOVEI C,%TCPMO ; If none, return total queue space instead + SUB C,XBORTL(I) + IMUL C,XBSMSS(I) + CAIG C, + SETZ C, + JRST .+1] +TCPWH5: MOVEI A,%WYTCP + JRST POPJ1 + + + +; RFNAME - from LH(DRFNTB) +; A/ LH of IOCHNM word for channel. + +TCPRCH: MOVEI I,(A) + LDB B,[.BP TH%DST,XBPORT(I)] + LDB C,[.BP TH%SRC,XBPORT(I)] + MOVE D,XBHOST(I) + MOVEI W,4 + POPJ P, + +; RFPNTR - from RH(DRFNTB) +TCPRFP: JRST OPNL34 + +; IOPUSH/POP - from LH(RSTBI) +TCPIOP: HRRZ T,R + SUBI T,IOCHNM(U) + CAIN I, + SKIPA T,[77] ; IOPUSH, use 77 + ADDI T,1 ; IOPOP, use chan+1 + HLRZ I,(R) ; Get TCB index + HRRZ B,(R) ; Get direction + CAIN B,TCPDUI ; as a BP to chan # + SKIPA B,[XB$ICH (I)] + MOVE B,[XB$OCH (I)] + DPB T,B ; Store new saved channel # + POPJ P, + +; RESET - from RH(RSTBI) +; This doesn't have to do anything for a while yet. +TCPRST: + POPJ P, + +; FORCE - from LH(DFRCTB) +; Should force out the TCP segment currently being written, +; and give it a good shove (ie PUSH). +; A/ LH of IOCHNM word, in RH. +; H/ IOCHNM word +; R/ ,, +TCPFRC: METER("TCP: syscal force") + HRRZ B,(R) ; This should be a TCP output channel. + CAIE B,TCPDUO ; If not output, must be input, so + JRST OPNL2 ; say "wrong direction". + HLRZ I,(R) ; Get TCB index + CAIL I,XBL ; Ensure validity + BUG HALT,[TCP: FRC bad idx] + + ; Ensure that state allows sending anything. + CONO PI,NETOFF ; So state doesn't change while we think. + HRRZ J,XBSTAT(I) + CAIE J,.XSOPN + CAIN J,.XSCLW + CAIA + JRST OPNL7 ; Bad state, say "device not ready". + + PUSH P,R + MOVSI T,(TC%PSH) ; Set PUSH flag (but not ACK, to avoid + ; forcing send of empty buffer) + CALL TCPOFR ; Force out! Clobber many ACs. + CONO PI,NETON + POP P,R + JRST POPJ1 + + +; FINISH - from RH(DFRCTB) +; We already know that R is OK since FORCE looked at it first. +; In fact, I is still set up. +; R/ addr of IOCHNM word + +TCPFIN: METER("TCP: syscal finish") + MOVSI T,(%XBNOW) + TDNE T,XBSTAT(I) ; Wait until this bit is off (XBOCOS put on Q) + CALL UFLS + SKIPE XBORTQ(I) ; Hang until retransmit queue is empty. + CALL UFLS + JRST POPJ1 + +SUBTTL TCP STY connection routines + +; STYTCP - invoked by STYNTC routine during 1/2 sec clock, for +; STYs connected to TCP channels. +; R/ TTY # + +STYTCP: MOVE I,STYNTI-NFSTTY(R) ; Get TCB index for connection + LDB TT,[XB$STY (I)] ; Verify that TCB thinks we're hooked up + CAIE TT,(R) + BUG ; It doesn't?? + + ; First, check for and transfer any input for the STY. + HLRZ T,XBSTAU(I) ; Get input state + SKIPG TCPTBI(T) ; Make sure we can do input. + JRST STYTC9 ; Nope, must disconnect. +STYTC1: SOSGE XBIBC(I) + JRST [ CALL TCPIBD ; Discard input buffer if any + HRRZ A,XBITQH(I) ; Any more input avail? + JUMPE A,STYTC5 ; No, done, check for output. + CALL TCPIBG ; Have some! Set it up. Shd never hang. + JFCL + JRST STYTC1] + ILDB A,XBIBP(I) ; Get the byte + TRNE A,200 ; Special char? + JRST [ AOS XBIBC(I) ; Ugh, must back up and get user's attention + MOVSI B,8._14 ; Back up both count and 8-bit byte pointer + ADDM B,XBIBP(I) ; by adding to P field of BP + JRST STYTC9] ; Go disconnect. + EXCH R,I ; I gets TTY #, R gets TCB index + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + CALL NTYI5 ; Give the char to TTY input interrupt level + CONO PI,TTYON + POP P,R ; Note reverse order, so R gets TTY # + POP P,I ; and I gets TCB index again. + JRST STYTC1 ; Try for more input. + + ; Transfer chars from STY output to TCP connection +STYTC5: SKIPGE TTYOAC(R) ; Do we have any output? + JRST STYTC7 ; No, all's done, force out what we did. + HRRZ A,XBSTAU(I) ; Check output state + SKIPG TCPTBO(A) ; to verify that TCB is healthy. + JRST STYTC9 ; Ugh, go disconnect STY. + MOVSI A,(%XBMPL) + IORM A,XBSTAT(I) ; Lock COS against PI level snarfing + + SKIPE XBOCOS(I) + SKIPG E,XBOBC(I) ; Get # bytes room in output buff + JRST [ + ; Set up buffer, etc, possibly forcing out existing buff. + PUSH P,R + CALL TCPOSB ; Invoke special hang-less routine. + JRST [POP P,R ; If can't get any more room, jump to STYTC6 + JRST STYTC6] + POP P,R + SKIPG E,XBOBC(I) ; OK, should have bytes now. + BUG + JRST .+1] + SKIPN D,XBOBP(I) ; Get BP into buffer + BUG + EXCH R,I + CONO PI,TTYOFF + MOVEM D,DBBBP ; Set up buffer for TTY output interrupt level + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ; Generate output + SETZM TYPNTF + POP P,R + EXCH R,I ; Restore I/ TCB #, R/ TTY # + MOVE D,DBBBP ; Advance pointers + MOVEM D,XBOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ; Minus # chars output generated + CONO PI,TTYON + ADDM E,XBOBC(I) + JRST STYTC5 ; Check for more output + + ; No more output or we can't get more room, force out what + ; we've currently got. +STYTC6: CALL TCPUII ; Reactivate STY (expensive crock, but...) +STYTC7: MOVSI A,(%XBMPL) ; Unlock the COS + ANDCAM A,XBSTAT(I) + MOVSI T,(TC%PSH) ; PUSH this stuff + CALL TCPOFR ; Force out buffer + JRST STYNT8 ; Then go check other STYs. + + + ; Disconnect STY and get user's attention. Note this may be + ; buggy in that STY output has not yet been transferred to the + ; net by the time we get here, if we're here due to a 200 char. +STYTC9: PUSH P,I + MOVEI I,(R) ; Set up I/ TTY # + CALL NSTYN0 ; Disconnect it + BUG + POP P,I + CALL TCPUII ; Wake up the user program + JRST STYNT8 ; Go handle other STYs. + +IFN 0,[ +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS +] ;ifn 0 + +SUBTTL Other TCP system call functions + +; TCPRQ - Handle .CALL NETRFC, return port # of next pending +; request for connection (SYN). +; Perhaps return a uniquizer in LH, so know when see +; the same request again? + +TCPRQ: TRNE C,%NQREF ; Skip if just getting, not flushing. + JRST TCPRQ5 + METER("TCP: syscal netrfc get") + CONO PI,NETOFF ; In case a RST comes for it or something. +; MOVE I,TCPRQL ; Get last thing stored on queue + SETOB B,D ; Look for any match + CALL TCPRQS ; Search the queue... + JUMPL A,OPNL4 ; None, say "file not found". + MOVEI I,(A) + LDB A,[.BP TH%DST,XBPORT(I)] ; Get local port # for the SYN + HRLI A,(I) ; And put index in LH as uniquizer. + CONO PI,NETON + JRST POPJ1 + +TCPRQ2: BUG CHECK,[TCP: Pending SYN smashed!] + RET + + ; Refuse indicated connection. +TCPRQ5: METER("TCP: syscal netrfc ref") + CAIGE W,2 ; Must have 2 args + JRST OPNL30 ; "Too few args" + HLRE D,A ; Get identifier + HRRE B,A + CONO PI,NETOFF + CALL TCPRQS ; Search for the queued SYN + JUMPL A,OPNL4 + + ; Now must refuse connection. + MOVEI I,(A) + MOVEI Q,XBITQH(I) + CALL PKQGF(PK.TCP) ; Get queued SYN segment + SKIPN XBITQH(I) ; Should have been only one + SKIPG R,A ; and should have been one! + BUG HALT + CALL TXBFLS ; Flush the TCB. + SOSGE TCPRQN ; Decrement count of queued SYNs + BUG HALT + HLRZ W,PK.IP(R) ; Move all this setup somewhere modular. + HLRZ H,PK.TCP(R) + LDB TT,[PK$TDL (R)] + MOVE E,TH$CTL(H) + TLNE E,(TC%SYN) + ADDI TT,1 + TLNE E,(TC%FIN) + ADDI TT,1 + CALL TSISLR ; Respond to this req with RST+ACK + CONO PI,NETON + JRST POPJ1 + +; TCPRQS - Search pending-RFC queue. Must be called with NETOFF!! +; B/ local port # (-1 for any) +; D/ Index #, -1 for any (searches back from last one stored) +; Clobbers T,Q +; Returns +; A/ Index to matching SYN (-1 if no match) + +TCPRQS: JUMPGE D,TCPRQ7 + MOVE A,TCPRQL + MOVEI C,1 +TCPRQ6: HRRZ T,XBSTAT(A) ; See if right state + CAIN T,.XSSYQ + JRST [ LDB T,[.BP TH%DST,XBPORT(A)] + CAIL B, + CAMN T,B + RET + JRST .+1] + SOJGE A,TCPRQ6 + MOVEI A,XBL-1 + SOJGE C,TCPRQ6 +TCPRQ9: SETO A, + RET + +TCPRQ7: SKIPL A,D + CAIL D,XBL + JRST TCPRQ9 + HRRZ T,XBSTAT(A) ; Verify state + CAIE T,.XSSYQ + JRST TCPRQ9 + LDB T,[.BP TH%DST,XBPORT(A)] ; Got one! Get local port # + CAIL B, + CAIN T,(B) ; Must match given arg unless -1 + RET ; Won! + JRST TCPRQ9 + +ifn 0,[ +TCPRQS: MOVEI A,TCPRQH-PK.TCP +TCPRQ6: MOVEI Q,(A) ; Save ptr to prev node + HRRZ A,PK.TCP(A) ; Get ptr to next PE + JUMPE A,TCPRQ8 ; If not there, return 0 as error. + JUMPL D,TCPRQ7 + CAIE A,(D) ; See if identifier matches + JRST TCPRQ6 ; Jump if not. +TCPRQ7: HLRZ T,PK.TCP(A) ; Yes, verify port number + CAIN T, ; Ensure ptr to TCP header exists. + BUG HALT + LDB T,[TH$DST (T)] + CAIE T,(B) + JRST TCPRQ6 ; Nope, get next thing. + + ; Found it! Take off list, a bit tricky. + SOSGE TCPRQN ; Decrement count of entries + BUG HALT + MOVSI T,(%PQFL2) ; Clear the on-list flag for PK.TCP + ANDCAM T,PK.FLG(A) +IFN 2-PK.TCP,.ERR TCPRQS must fix %PQFL2 to match PK.TCP + HRRZ T,PK.TCP(A) ; Get its next-ptr + HRRM T,PK.TCP(Q) ; Store in node previous to this one. + JUMPN T,TCPRQ8 ; If wasn't last thing, all's well. + CAIN Q,TCPRQH-PK.TCP ; Last thing. If prev was actually hdr, + SETZ Q, ; must store zero. + HRLM Q,TCPRQH ; Set new "last" ptr in hdr. +TCPRQ8: + RET + +] ;ifn 0 + +; TSOINI - set up a raw PE for use as a TCP output segment. Means +; setting IP, TCP header pointers properly, so that all fields +; are contiguous. Note that PK.TCI is set to indicate XBSMSS(I) +; bytes of (available) data storage! +; Sets up PK.IP, PK.TCP, and PK.TCI. +; R/ PE ptr +; I/ TCB connection index (val put into PK.TCI) +; Returns with R, W, H pointing to PE, IP hdr, and TCP hdr. +; +; TSOINA - Ditto, but takes arg in A and only clobbers T (doesn't set W, H) + + +TSOINI: HRRZ W,PK.BUF(R) ; Get addr of buffer + HRLM W,PK.IP(R) ; Store as IP header addr + MOVEI H,(I) ; Set up TCI with all fields. + ANDI H,PK%TCB + IOR H,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM H,PK.TCI(R) ; + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + MOVEI H,%TCPHL(W) ; For now, this will do. + HRLM H,PK.TCP(R) ; Store as TCP header addr + RET + +TSOINA: HRRZ T,PK.BUF(A) ; Get addr of buffer + HRLM T,PK.IP(A) ; Store as IP header addr + ADDI T,%TCPHL ; For now, this will do to get TCP hdr. + HRLM T,PK.TCP(A) ; Store as TCP header addr + MOVEI T,(I) ; Set up TCI with all fields. + ANDI T,PK%TCB + IOR T,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM T,PK.TCI(A) ; Set up index and header length fields + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + RET + +; TCPUSI - TCP User State-change Interrupt. Called each time connection +; changes state (.XSnnn) or I/O queues start/end. Always tries +; to interrupt user, except for change %NTWRT->%NTOPN on output +; and %NTINP->%NTOPN on input. +; Moon: Interrupt when input rcvd and buff empty, or output full +; and becomes reasonably non-full. +; Clobbers T, Q + +TCPUSI: METER("TCP: tcpusi called") + CALL TXBIST ; Check input state + HLRZ Q,XBSTAU(I) + CAIE T,(Q) ; New state? + JRST TCPUS3 ; Yes, go handle. +TCPUS2: CALL TXBOST + HRRZ Q,XBSTAU(I) + CAIN T,(Q) + RET + + ; Output channel state change + ; Q/ old state, T/ new state (%NT values, not .XS) + HRRM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTOPN ; If was open + CAIE T,%NTWRT ; Changing to buff-full + CAIA + RET ; Then don't interrupt. + MOVE Q,TCPTBO(Q) + CAMN Q,TCPTBO(T) ; See if meta-state change + RET ; Nope, ignore. + LDB Q,[XB$OCH (I)] ; Yes, get channel # + METER("TCP: User O ints") + CALRET TCPUS5 + + ; Input channel state change +TCPUS3: HRLM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTINP ; If was input avail + CAIE T,%NTOPN ; Changing to plain open + CAIA + JRST TCPUS2 ; Then don't interrupt. + MOVE Q,TCPTBI(Q) + CAMN Q,TCPTBI(T) ; See if meta-state change + JRST TCPUS2 ; No + ; Drop thru to interrupt + + ; Give input channel interrupt +TCPUII: METER("TCP: User I ints") + LDB Q,[XB$STY (I)] ; See if hooked to STY + JUMPN Q,TCPUSS ; Jump to handle STY stuff if so. + LDB Q,[XB$ICH (I)] ; No, just get input chan + CALL TCPUS5 + JRST TCPUS2 + + ; Give interrupt to STY that TCB is connected to. + ; Q/ TTY # +TCPUSS: CONO PI,PIOFF ; Protect list hacking + SKIPL STYNTL-NFSTTY(Q) ; Don't put on list twice + JRST PIONJ + MOVE T,STYNTA ; Add to list + MOVEM T,STYNTL-NFSTTY(Q) + MOVEM Q,STYNTA + JRST PIONJ + + ; Interrupt on channel in Q. +TCPUS5: JUMPE Q,CPOPJ ; May be no channel there. + PUSH P,U + SKIPN U,XBUSER(I) + BUG HALT ; Jumpe above should catch this. + MOVSI T,(SETZ) + IORM T,PIRQC(U) + CAIN Q,77 ; If IOPUSH'ed, no interrupt. + JRST POPUJ + MOVE T,CHNBIT-1(Q) ; Q is -1 based. + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + ; Input chan state type. Pos # means can read. + ; 0 is pre-open, 1 is open, 2 is input avail, -1 is post-open. +TCPTBI: OFFSET -. +%NTCLS:: 0 ; 0 CLS +%NTLSN:: 0 ; 1 LSN +%NTSYR:: 0 ; 2 RFC +%NTCLU:: -1 ; 3 RCL? +%NTSYN:: 0 ; 4 RFS +%NTOPN:: 1 ; 5 OPN +%NTWRT:: 1 ; 6 RFN +%NTCLX:: -1 ; 7 CLW +%NTCLI:: 1 ; 10 CLI +%NTINP:: 2 ; 11 INP + OFFSET 0 + + ; Output chan state type. Pos # means can write. + ; 0 is pre-open, 1 is open, 2 is buff full, -1 is post-open. +TCPTBO: OFFSET -. +%NTCLS:: 0 +%NTLSN:: 0 +%NTSYR:: 0 +%NTCLU:: 1 +%NTSYN:: 0 +%NTOPN:: 1 +%NTWRT:: 2 +%NTCLX:: -1 +%NTCLI:: 1 +%NTINP:: 1 + OFFSET 0 + + +SUBTTL TCP Input Interrupt Level + +; TCPIS - Process TCP Input Segment (PI level) +; R/ PE ptr to packet, not on any list. +; PK.BUF is set, ditto IP/TCP header pointers. +; W/ addr of IP header +; H/ addr of IP data (start of TCP header) +; J/ host-table index for address datagram received from. +; Can clobber all ACs except P, returns with POPJ. +; AC usage during incoming segment processing: +; R/ PE ptr to packet +; W/ addr of IP header +; H/ addr of TCP header +; I/ TCB index (if any) +; J/ TCB connection state +; TT/ # bytes of TCP data in segment +; E/ ,, +; D/ Segment Sequence no. +; Flags for RH of E +%TSISL==1 ; Seq starts to left of rcv.nxt +%TSISR==2 ; Seq starts to right of " ; if neither on, is = rcv.nxt +%TSIFL==4 ; Bad seq, flush after handling RST/ACK/URG + +TCPIS: METER("TCP: Segs rcvd") + SKIPN TCPUP ; Unless TCP claims to be up, + JRST TSIFL ; Throw it away, no TCP yet, sigh. + + ; First verify that this is a valid TCP segment, by + ; checksumming it (sigh!). TT gets total # bytes in TCP segment. + CALL THCKSI ; Get checksum in A for segment + LDB B,[TH$CKS (H)] ; Get segment's checksum + CAME A,B ; Should match. + JRST TSIF01 ; Failed, go bump err count and flush it. + LDB T,[TH$THL (H)] ; Find TCP header length in words + LSH T,2 ; Make it in octets + SUBI TT,(T) ; TT now has # octets of segment data. + + ; Contents of segment have been validated (more or less), + ; now set up convenient context values + ; PK.TCI contents + ; E/ Segment control flags (in LH) + ; TT/ SEG.LEN + HLLZ E,TH$CTL(H) ; Get word with segment control flags + DPB T,[PK$TDO (R)] ; Store offset of data (from THCKSI) + DPB TT,[PK$TDL (R)] ; Store length of data + TLNE E,(TC%SYN) ; Note that SYN counts in seg.len + ADDI TT,1 ; so allow for it + TLNE E,(TC%FIN) ; And do same thing for FIN. + ADDI TT,1 ; Either way, get SEG.LEN set up in TT. + + ; Then see if any TCB exists for this segment. + SKIPE A,TH$SRC(H) ; Get source/dest port word + SKIPN B,IP$SRC(W) ; Get source addr from IP header + JRST TSIF02 ; Flush anything with zero field. + LSH B,-4 ; Right-justify the addr + MOVSI I,-XBL +TSI02: CAMN A,XBPORT(I) ; Loop til we find it + CAME B,XBHOST(I) +TSI03: AOBJN I,TSI02 + JUMPL I,TSI05 ; Jump if found existing connection + JRST TSISQ ; Jump if no existing connection. + +TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? + JRST TSI02 ; LH must have crud still set, ignore for now + BUG CHECK,[TCP: Clsed TCB has active port/host] ; Shouldn't happen! + SETZM XBHOST(I) ; If continued, fix up. + JRST TSI02 + + ; Connection exists, TCB index now in I. + ; Set up a little more context (PK.TCI and J) +TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info + MOVEM J,XBNADR(I) ; Save host-table idx of addr this seg is from. + HRRZ J,XBSTAT(I) ; Get connection state + CAIL J,.XSTOT ; Highest possible state. + BUG HALT,[TCP: Bad conn state] + METER("TCP: IS all states") + XCT XSMTRS(J) ; Bump meter for each state + CAIG J,.XSSYN ; If it's CLS, SYQ, LSN or SYN-SENT + JRST @(J)[ ; then process specially. + TSI04 ; Closed??? + TSISQQ ; Syn-Queued? (Probably re-trans) + TSILS ; Listen + TSISS] ; Syn-sent + ; Drop through to perform general sequence-number checking. + + ; Check Sequence Number!!! + ; This code doesn't do two things: + ; 1) it doesn't keep around stuff that arrives to the + ; right of rcv.nxt. + ; 2) for situation where seg.seq number is valid, + ; (i.e. seq =< rcv.nxt) the code punts if + ; end of seg is out of window. It should simply + ; expand the window! + LDB D,[TH$SEQ (H)] ; Get sequence number + JUMPG TT,TSI10 ; Jump if data present. + JUMPL TT,TSIF03 ; No data. Jump if error (neg data!) + + ; No data in this segment, it is probably a simple ACK. + CAMN D,XBRNXT(I) ; Seg.seq == snd.nxt (as expected?) + JRST TSI20 ; Yep, seg is acceptable instantly! + METER("TCP: Ifl 0-len seqerr") + JRST TSISNE ; Sigh, flush it. + + ; Seq number check when data present. +TSI10: CAME D,XBRNXT(I) ; Is seq # what we expect (seq = nxt)? + JRST TSI11 + SKIPE C,XBRWND(I) ; Yes! And is our window open? + JRST TSI20 ; Yes! Fast dispatch! + + ; Data segment, with valid sequence number, but our window is + ; zero. See if there's some way we can avoid throwing away the + ; segment... if we can't take it then still must handle + ; ACK/URG/RST flags. For now, we really handle this at TSI70. +TSI12: METER("TCP: 0-wnd data seg") + JRST TSI20 + + ; Sequence # isn't exactly what we hoped for, see if the + ; segment overlaps a valid portion of sequence space. +TSI11: SKIPN C,XBRWND(I) ;#3: Get window, is it zero? + MOVEI C,512. ; If zero, substitute a dummy window. + + ; Both len>0 and wnd>0. + ADD C,XBRNXT(I) ; Get nxt+wnd + TLZ C,%MOD32 ; all arith mod 32 + ;#4a: nxt =< seq < nxt+wnd + CMPSEQ XBRNXT(I),=<,D,<,C,TSI13 ; Jump if fail this test, try 4b. + + ; Come here when sequence # is OK, but segment starts farther on + ; than we want, i.e. there is a "hole" between rcv.nxt and seg.seq. + ; Eventually we could keep this segment around, to speed up + ; throughput for nets that get packets out of order, but for + ; now we'll just flush it and force a retransmit. + METER("TCP: Iseg hole") + TRO E,%TSISR+%TSIFL ; Say starts to right, and flush later. + JRST TSI20 ; Go process RST/ACK/URG etc. + +TSIF12: METER("TCP: Ifl seq dup") ; Segment falls in prev rcvd data. + MOVE D,XBRNXT(I) ; Fake out, say seq # OK + TRO E,%TSIFL ; and don't process data. + JRST TSI20 ; Go handle RST/ACK/URG. + +TSIF13: METER("TCP: Ifl seq int err") ; Shouldn't ever happen, due to + JRST TSISNE ; right-bound check code above. +TSIF14: METER("TCP: Ifl seq old") + JRST TSISNE +TSIF15: METER("TCP: Ifl monster seg") ; Impossible error + JRST TSISNE + + ; Segment does not overlap window to right, so see if it + ; overlaps to left, i.e. sequence # falls within data we have + ; already received. +TSI13: MOVE A,XBRNXT(I) + SUBI A,%TCPMB ; Make a fictional lower bound + CAIGE A, + ADD A,[1_32.] ; Keep bound mod 2^32 + CMPSEQ A,=<,D,=<,XBRNXT(I),TSIF14,TSIF13 + + ; Yep, falls within received data. It's probably a duplicate + ; retransmitted segment; see if there's any new data on right side. + ; Note that we are not using XBRWND here, because as long as we + ; have a non-zero window we will always accept everything in the + ; segment. So we create another fictional bound to the right. + ADD A,[%TCPMB*2] ; Get back to other side of rcv.nxt + TLZ A,%MOD32 ; Keep mod 2^32 + MOVE C,D + ADDI C,-1(TT) ; Get seq+len-1 + TLZ C,%MOD32 + ;#4b: nxt =< seq+len-1 < nxt+wnd? + CMPSEQ XBRNXT(I),=<,C,=<,A,TSIF12,TSIF15 ; If fail this too, error. + + ; Aha, have some new data in spite of being overlapped with some + ; previously received data! Here, we + ; twiddle things so that it appears to start properly at + ; rcv.nxt. This is done without touching the segment contents + ; at all, just modifying the packet entry info. + METER("TCP: Iseg ovlap") + MOVE A,XBRNXT(I) ; Get rcv.nxt + CAMGE A,D ; Make sure it's greater than seg.seq + TLO A,(1_32.) ; Mod 2^32 screw, make it greater (add 33d bit) + SUB A,D ; Find # octets of sequence space diff + CAMLE A,TT ; Shouldn't be greater than seg.len!! + BUG CHECK,[TCP: Trim error] + SUBI TT,(A) + JUMPLE TT,TSIF12 ; If nothing left, drop this segment. + TLZE E,(TC%SYN) ; Clear SYN since it's at front. + SUBI A,1 ; If it was set, reduce cnt of actual data + LDB T,[PK$TDL (R)] ; that we're going to flush. Get cnt + SUBI T,(A) ; Decrement # valid data bytes in segment + DPB T,[PK$TDL (R)] ; Put back + LDB T,[PK$TDO (R)] ; Also adjust offset to valid data + ADDI T,(A) ; Increment to point at new data + DPB T,[PK$TDO (R)] ; Put back + MOVE D,XBRNXT(I) ; Now say seg.seq = rcv.nxt! + ; Segment sanitized, drop through. + SKIPN XBRWND(I) ; Only proceed if our window not zero. + JRST TSI12 ; It's zero! May have to flush it... + + ; Fall through to TSI20 for RST/ACK/URG processing. + + ; Now check RST +TSI20: TLNE E,(TC%RST) ; RST bit set? + JRST TSIRST ; Yeah, go process it. + + ; Now check security/precedence + JFCL ; ho ho ho + + ; Now check SYN bit +TSI40: TLNE E,(TC%SYN) ; SYN bit set? + JRST TSISYN ; Yeah, go process it (basically error) + + ; Now check ACK bit +TSI50: TLNN E,(TC%ACK) ; ACK bit set? + JRST TSIF50 ; No, error. Drop segment. + JRST @TSI51(J) ; Yes, dispatch depending on state. +TSI51: OFFSET -. +.XSCLS:: [JRST 4,TSI51] ; Closed +.XSSYQ:: [JRST 4,TSI51] ; ITS: Syn-Queued +.XSLSN:: [JRST 4,TSI51] ; Listen +.XSSYN:: [JRST 4,TSI51] ; Syn-Sent +.XSSYR:: TSI53 ; Syn-Rcvd +.XSOPN:: TSI54 ; Established (open) +.XSFN1:: TSI54 ; Fin-Wait-1 +.XSFN2:: TSI54 ; Fin-Wait-2 +.XSCLW:: TSI54 ; Close-Wait +.XSCLO:: TSI54 ; Closing +.XSCLA:: TSI54 ; Last-Ack +.XSTMW:: TSIATW ; Time-Wait +.XSTOT:: OFFSET 0 + + + ; SYN-RCVD state, handling ACK. +TSI53: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + CMPSEQ B,=<,A,=<,XBSNXT(I),TSISRA ; Jump if fail + MOVEI J,.XSOPN ; ACK wins, we're now open! + HRRM J,XBSTAT(I) ; Set new state, fall through to handle. + CALL TCPUSI ; Adjust user state. + ; Must initialize SND.WL1, SND.WL2, and SND.WND. + ; Maybe later merge this with TSI55. + MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + MOVEM B,XBSAVW(I) ; and make avail window be same as send wind. + JRST TSI54X ; Skip repeating the ACK test. + + ; Handle ACK while in open state (also other receive-OK states) +TSI54: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + ; If seg.ack < snd.una, go to TSI60 and ignore the ACK. + ; If seg.ack > snd.nxt, go to TSISAK to drop segment (ACKing) + CMPSEQ B,=<,A,=<,XBSNXT(I),TSI60,TSISAK ; Jump if fail + + ; ACK is fine. Update SND.UNA and clean up retransmit queue. +TSI54X: MOVEM A,XBSUNA(I) ; Update snd.una + + ; Must check retransmit queue slowly to find right place to flush, + ; if any. + ; Procedure is: (1) pull off 1st thing on queue. + ; (2) If the new 1st thing has a seq # =< snd.una, + ; then can flush what we pulled off, and try again. + ; (3) otherwise put it back on at front. +TSI54A: MOVE C,A ; Save ACK # in C +TSI54B: MOVEI Q,XBORTQ(I) ; Get pointer to retrans q + CALL PKQGF(PK.TCP) ; Get 1st thing on queue + JUMPE A,TSI54Z ; None left? Win! + TRCPKT A,"TSI54B Mabye flush from rexmit Q" + MOVE T,PK.FLG(A) ; Check packet flags, + TLNN T,(%PKODN) ; to make sure output was completed. + JRST TSI54Y ; Not done yet, so don't flush yet. + HRRZ B,XBORTQ(I) ; Get pointer to next thing + JUMPE B,[CAMN C,XBSNXT(I) ; No next thing, compare with snd.nxt + JRST TSI54D ; Equal, can flush! + JRST TSI54Y] ; If not equal, must have ack < snd.nxt + ; so previous segment can't be flushed. + HLRZ B,PK.TCP(B) ; Get addr of TCP hdr for 2nd queued segment + LDB B,[TH$SEQ (B)] ; Get sequence # for it +TSI54C: CMPSEQ B,=<,C,=<,XBSNXT(I),TSI54Y ; See if ACK comes after that # + + ; Hurray, matches or exceeds this seq #, + ; So we can flush the seg we pulled off! +TSI54D: TRCPKT A,"TSI54D Flushing from Q" + TLNE T,(%PKPIL) ; + JRST [ TLZ T,(%PKNOF) ; Packet is locked by PI I/O + MOVEM T,PK.FLG(A) ; So just say to flush when done. + JRST TSI54E] + CALL PKTRT +TSI54E: MOVE A,TIME ; Crock crock, set up new timeout. + ADD A,TCPTMO + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Reset retry counts + SOSGE XBORTL(I) ; Decrement # segments on retrans q. + BUG HALT,[TCP: Retrans Q count error] + JRST TSI54B ; Keep going as long as we can. + +TSI54Y: MOVEI Q,XBORTQ(I) + CALL PKQPF(PK.TCP) ; Put back on front of queue +TSI54Z: MOVE A,C ; Restore ACK # to A. + + ; Now see if send window should be updated. + CAMN D,XBSWL1(I) ; Fast check first, WL1 = SEQ? + JRST TSI55C ; Yes, go check ACK then + MOVE T,XBSWL1(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL1(I),<,D,<,T,TSI56 ; Check if wl1 < seq < wl1+xxx + JRST TSI55 ; Yes, must update window. +TSI55C: MOVE T,XBSWL2(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL2(I),=<,A,=<,T,TSI56 ; Fall-thru win if snd.wl2 =< seg.ack + +TSI55: MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + ; Drop thru + + ; Either SND.UNA or SND.WND was probably updated, so lets update + ; SND.AVW also (available window). The following computes + ; WND - (NXT - UNA) and assumes UNA =< NXT. +TSI56: MOVE A,XBSNXT(I) + CAMGE A,XBSUNA(I) ; If need mod 32 wrap, + TLO A,(1_32.) ; wrap up the number that should be higher. + SUB A,XBSUNA(I) ; Find NXT-UNA (# bytes not yet acked) + CAIL A,0 + CAILE A,177777 ; Make simple check + BUG INFO,[TCP: Bad AVW calc, UNA=],OCT,XBSNXT(I),[NXT=],OCT,XBSUNA(I) + MOVE B,XBSWND(I) + SUBI B,(A) ; Find # bytes we can still send + CAIGE B, ; Make sure it's not negative! + SETZ B, + MOVEM B,XBSAVW(I) + + ; Done with ACK processing for OPEN state, see if must handle + ; idiosyncracies of other states. +TSI57: CAIN J,.XSOPN ; Skip other checks if state is OPEN (normal) + JRST TSI60 ; Go check for URG etc. + CAIN J,.XSCLW + JRST TSI80 + CAIN J,.XSFN1 + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, enter FIN-WAIT-2 + JRST TSI60 ; Not yet. + MOVEI J,.XSFN2 ; Yes, FIN was ACKed, change state. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Call this for any state change. + LDB T,[XB$ICH (I)] ; Do we have an input chan? + JUMPN T,TSI60 ; If so, CLOSE will handle the wrapup. + MOVE T,TIME ; No, must set timeout. + ADDI T,2*60.*30. ; Use 2*MSL + MOVEM T,XBORTT ; set timeout. + JRST TSI60] + CAIN J,.XSFN2 + JRST [ ; If retrans queue empty, transmit-chan CLOSE done. + JRST TSI60] + CAIN J,.XSCLO + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, + JRST TSIF55 ; No-- flush the segment. + CALL TSITMW ; then enter TIME-WAIT state, start timeout. + JRST TSI80] ; Then go check for FIN, etc. + CAIN J,.XSCLA ; LAST-ACK waiting for ACK of our FIN. + JRST [ SKIPE XBORTQ(I) ; If our FIN has been ACK'd, + JRST TSIF56 ; No-- flush the segment. + METER("TCP: FIN acked in .XSCLA") + CALL TXBFLP ; Flush the TCB immediately, PI level + JRST TSIFL] ; then flush the segment. + BUG CHECK,[TCP: Bad ACK state] + + ; Check the URG bit. The only states which get to this + ; point are OPEN, FIN-WAIT-1, and FIN-WAIT-2. +TSI60: TLNN E,(TC%URG) ; Segment has urgent pointer set? + JRST TSI70 ; Nope, on to next step. + LDB A,[TH$UP (H)] ; Get SEG.UP (urgent ptr from segment) + + ; This is where URGENT should be handled!!!! + ; Drop through + + ; Finally process segment text! + ; Only states OPEN, FIN-WAIT-1 and FIN-WAIT-2 can get here. +TSI70: TRNE E,%TSIFL ; If segment being flushed after ACK/URG, + JRST TSIF70 ; flush it now! + + + LDB A,[PK$TDL (R)] ; Find # bytes of real data in segment + JUMPLE A,TSI80 ; If none, no text processing. + TLNE E,(TC%FIN) ; Check that # bytes data == seg.len + JRST [ CAIE A,-1(TT) ; Must allow for funny non-data FIN. + JRST TSI71 ; Nope + JRST TSI72] ; Yep + CAIE A,(TT) ; # bytes data should == seg.len +TSI71: BUG CHECK,[TCP: seglen error] +TSI72: SKIPE D,XBRWND(I) ; Note D used for flag, + JRST TSI75 ; and is non-zero if no compaction done. + + ; Our window is zero, and technically we should throw away the + ; data now that all RST/ACK/URG processing has been done. However, + ; we try to see if we can possibly do a little compaction, since + ; the overhead of doing this is a lot less than the overhead + ; of re-processing the re-transmitted segment! + MOVE A,XBINPS(I) ; Check length of input queue + CAIL A,2 ; Must be at least 2 + SKIPN XBITQH(I) + BUG CHECK,[TCP: Wind & Queue both 0] + + ; See if it's worth trying to compact the input seg into the + ; last one received (which hasn't yet been seen by MP level) + HLRZ A,XBITQH(I) ; Get ptr to last input seg on queue + LDB B,[PK$TDO (A)] ; Get offset to data in old seg + LDB C,[PK$TDL (A)] ; See how much data is there + LDB T,[PK$TDL (R)] ; Find # bytes in new segment + ADDI B,(C) ; Get offset to end of data + MOVEI D,(B) + ADDI D,(T) ; Get projected total offset + CAML D,XBRMSS(I) ; Crock method of ensuring enuf room. + JRST TSI17 ; Not enough, we lose. Lose. Lose. + + ; Win! We're gonna compact! + METER("TCP: Iseg cmpct") + ADDI C,(T) ; Get new # bytes for prev seg + DPB C,[PK$TDL (A)] ; Store it in advance. + HLRZ D,PK.TCP(A) ; Find addr of TCP header in prev seg + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (R)] ; Get data offset for new segment + IDIVI B,4 + ADDI B,(H) ; Get addr for BP to start of new data + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to new data + ; D/ BP to end of old data + ; T/ # bytes of new data + MOVEI A,(T) ; Save # added data in A +TSI74: ILDB C,B + IDPB C,D + SOJG T,TSI74 + SETZ D, ; Clear D to indicate compaction done. + JRST TSI75 + + ; Can't accept segment data, period. +TSI17: METER("TCP: Ifl 0-wnd") + JRST TSIFL ; Flush the seg, sob. + +TSI75: MOVEI B,(TT) + ADDB B,XBRNXT(I) ; Update rcv.nxt value by adding seg.len + TLZE B,%MOD32 + MOVEM B,XBRNXT(I) ; Updated! + LDB B,[XB$ICH (I)] ; See if we have an input channel # + JUMPE B,[METER("TCP: IS fl no chan") + JRST TSI78] ; No input channel, so just throw away. + MOVEI C,(A) ; Save # bytes data. + ADDM A,XBINBS(I) ; Add new bytes to # bytes in input queue + JUMPE D,TSI78 ; If compaction done, that's all... + SKIPE B,XBINPS(I) ; If no segments previously on queue, + MOVE B,XBIBC(I) ; or current input buff has zero cnt, + ; then will definitely interrupt user later. + AOS XBINPS(I) ; Bump # segments on queue + + ; Check to see how much to reduce window by. + ; Amount is in C (defaults to amount we just received) + CALL TCPRWS ; Set receive window + + ; Finally add segment to queue! + MOVEI A,(R) ; Set up pointer to packet/segment + MOVEI Q,XBITQH(I) ; Point to TCP input queue + CALL PKQPL(PK.TCP) ; Add to end of queue, using TCP links. + JUMPN B,TSI78 ; Check, jump unless had no input before + CALL TXBIST ; If none, then must definitely change state! + HRLM T,XBSTAU(I) ; + CALL TCPUII ; And always give an input-avail int! + + ; Now must send an ACK, or rather arrange for one to be + ; sent soon. FIN is also checked here, so as to bypass the + ; code which assumes that XBRNXT hasn't been updated (if we are + ; here, it certainly has!) +TSI78: MOVSI A,(TC%ACK) ; Set bit asking for ACK to be sent. + IORM A,XBSTAT(I) + TLNN E,(TC%FIN) ; Perform FIN-bit check + JRST TSI90 ; None, all done with segment! + JRST TSI82 ; FIN exists, handle it (bypass bump of XBRNXT) + + ; Lastly check the FIN bit. Not clear if a bunch of states + ; want to come here from ACK processing or not. + ; Anyway, code assumes could be in any state. +TSI80: TLNN E,(TC%FIN) + JRST TSI90 + CAIG J,.XSSYN + JRST TSIF80 ; Flush if CLOSED, LISTEN, SYN-SENT + + ; Advance RCV.NXT over the FIN and send an ACK for it. + AOS A,XBRNXT(I) + TLZE A,%MOD32 + MOVEM A,XBRNXT(I) +TSI82: MOVSI A,(TC%ACK+%XBFIN) ; Set bit asking that ACK be sent, and FIN + IORM A,XBSTAT(I) ; was seen. + MOVEI T,.XCFRN ; Say foreign host closed input side. + CALL TCPUCI + + ; Now effect some state changes + CAIE J,.XSOPN ; If OPEN + CAIN J,.XSSYR ; or SYN-RCVD + JRST [MOVEI J,.XSCLW ; Change state to CLOSE-WAIT + JRST TSI85] + CAIN J,.XSFN1 + JRST [ SKIPN XBORTQ(I) ; If our FIN was ACK'd, + JRST TSI84 ; Go enter TIME-WAIT state + MOVEI J,.XSCLO ; Otherwise enter CLOSING state. + JRST TSI85] + CAIE J,.XSFN2 + CAIN J,.XSTMW + JRST TSI84 ; Go to TIME-WAIT + JRST TSI90 ; Any other states just do nothing. + +TSI84: CALL TSITMW ; Enter TIME-WAIT state, starting 2-MSL timeout + JRST TSI90 +TSI85: HRRM J,XBSTAT(I) ; Set new state and fall through. + CALL TCPUSI ; Set user state. + + ; Done. Finally decide whether to keep segment around or not. +TSI90: HLRZ A,XBITQH(I) ; Get ptr to last thing on input queue + CAIN A,(R) ; Same as current seg (ie it was queued?) + RET ; Yes, just return! + JRST TSIF90 ; Else drop through to flush the segment. + +XSMTRS: OFFSET -. +.XSCLS:: METER("TCP: state CLS") +.XSSYQ:: METER("TCP: state SYQ") +.XSLSN:: METER("TCP: state LSN") +.XSSYN:: METER("TCP: state SYN") +.XSSYR:: METER("TCP: state SYR") +.XSOPN:: METER("TCP: state OPN") +.XSFN1:: METER("TCP: state FN1") +.XSFN2:: METER("TCP: state FN2") +.XSCLW:: METER("TCP: state CLW") +.XSCLO:: METER("TCP: state CLO") +.XSCLA:: METER("TCP: state CLA") +.XSTMW:: METER("TCP: state TMW") +.XSTOT:: OFFSET 0 + + +TSIF01: METER("TCP: ISeg cksm errs ") + JRST TSIFL +TSIF02: METER("TCP: IS zero port/addr") + JRST TSIFL +TSIF03: METER("TCP: IS fl neg data") + JRST TSIFL +;TSIF10: ; Flush this later (retain til get new .METER LIST) + METER("TCP: IS fls Seq # err") + JRST TSIFL +TSIF50: METER("TCP: IS fls Seq no ACK ") + JRST TSIFL +TSIF55: METER("TCP: IS fls CLO & FIN not ACKed") + JRST TSIFL +TSIF56: METER("TCP: IS fls CLA & FIN not ACKed") + JRST TSIFL +TSIF70: METER("TCP: IS fls seqerr processed A/U/R") + JRST TSISNE ; Go respond with ACK +TSIF80: METER("TCP: IS fls FINchk state") + JRST TSIFL +TSIF2A: METER("TCP: IS fls random RST") + JRST TSIFL +TSIF2B: METER("TCP: IS fls Fresh SYN already on SYNQ") + JRST TSIFL + +TSIF90: METER("TCP: IS fls processed seg") + JRST TSIFL + + ; Come here to flush the datagram/segment and return. +TSIFL: METER("TCP: Isegs flushed") + MOVEI A,(R) + CALRET PKTRT + +; TSITMW - Routine to enter TIME-WAIT state. +; TSITM2 is entry point when already in that state. +; Clobbers T, Q +TSITMW: MOVEI J,.XSTMW + HRRM J,XBSTAT(I) + CALL TCPUSI ; Alert user if necessary. +TSITM2: SKIPE XBORTQ(I) ; Unless retransmit still hogs timeout + RET ; (if so, return) + MOVE T,TIME ; then set up 2-MSL timeout. + ADDI T,30.*2.*60. + MOVEM T,XBORTT(I) + RET + +; TSISNE - Sequence number error, segment not acceptable, +; return an ACK unless RST was set. + +TSISNE: METER("TCP: IS NE seqerr") + TLNE E,(TC%RST) + JRST TSIFL ; Flush segment if RST was set + + ; Send an immediate ACK without data, re-using the + ; packet/segment that R points to. +TSOACK: MOVSI T,(TC%ACK) ; Send an ACK immediately + TRCPKT R,"TSOACK return ACK in response to out-of-seq ACK" + CALL TSOSNR + RET + +; TSISQ - Jumped to from TCPIS when TCP segment is received that matches +; no existing connection. Check to see if it's a valid connection +; request. If so, +; (1) see if it matches any wild listens; if so, process. +; (2) see if it's OK to start up a server for it; if so, process. + +TSISQ: TLNE E,(TC%RST) ; If it has RST set, + JRST TSIF2A ; Go drop it quietly. + TLNE E,(TC%ACK) ; If ACK, can't be a valid request either + JRST TSISAR ; Go send a RST in response (with SEQ=SEG.ACK) + TLNN E,(TC%SYN) ; Anything else had better have a SYN + JRST TSISLR ; otherwise send RST with SEQ=0,ACK=SEQ+LEN + + ; Okay, we have a promising SYN. See if it matches any + ; "wild" listens. + METER("TCP: Fresh SYN") + LDB B,[TH$DST (H)] ; Get desired port # + LDB C,[TH$SRC (H)] ; Find port it's from + LDB D,[IP$SRC (W)] ; and host it's from. + MOVSI I,-XBL +TSISQ2: HRRZ J,XBSTAT(I) ; Get state for TCB + CAIE J,.XSLSN ; We're hunting for LISTEN +TSISQ3: AOBJN I,TSISQ2 + JUMPGE I,TSISQ5 ; Jump if no match. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get our local port (never wild) + CAIE A,(B) ; It must match desired "dest port"! + JRST TSISQ3 ; Nope, doesn't want this one. + SKIPL XBHOST(I) ; Aha, very likely will match. Follow thru. + CAMN D,XBHOST(I) + CAIA + JRST TSISQ3 ; Host didn't match. + MOVE A,XBPORT(I) ; Check remote port field + TRNE A,17 ; Low 4 bits are non-zero if remote wild. + JRST TSISQ4 ; Won! + LDB A,[.BP TH%SRC,A] ; Not wild, see if it matches request. + CAIE A,(C) ; Compare our remote with its source. + JRST TSISQ3 ; No, no match here. + + ; Matched a wild listen! Must fill in various stuff. +TSISQ4: MOVEI A,17 + ANDCAM A,XBPORT(I) ; Clear wild bits + DPB C,[.BP TH%SRC,XBPORT(I)] ; Set remote port # + MOVEM D,XBHOST(I) ; Set remote host addr + LDB D,[IP$DST (W)] ; Set local address to whichever address other guy knows + MOVEM D,XBLCL(I) + DPB I,[PK$TCB (R)] ; Finish setting up context for dispatch + CALL TCPMSS ; Correct MSS values for specified foreign host + CALL TCPRWS ; Open up a receive window + JRST TSILS ; Go handle SYN rcvd for LISTEN. + + ; No outstanding listens. Check the port number, to + ; see if it's something we are likely to service. +TSISQ5: LDB A,[TH$DST (H)] ; Get destination port # + CAILE A,%TCPMP ; Fits max port # for RFC service? + JRST TSISLR ; Naw, barf about it (send RST). + + ; See if we're actually willing to start up a job... + LDB A,[IP$SRC (W)] ; See who it's from + JSP T,IPLCLH ; Ask IP if this is one of us + SKIPL TCPUSW ; It isn't, so make sure we're open for biz + CAIA + JRST TSISLR ; Sorry charlie (send RST) + + ; Okay, we'll take it as SYN-QUEUED! We know this is a new + ; request, otherwise it would have been matched at TSI02 and + ; dispatched to TSISQQ instead. + +ifn 0,[ + ; first see if it's already on the queue! + ; Note that we still have remote host # in D. + SKIPN Q,TCPRQH ; Get pointer to 1st item on queue + JRST TSISQ7 ; No queue, so not on. + MOVE B,TH$SRC(H) ; Get req's source/dest ports + MOVE D,IP$SRC(W) ; and its source addr +TSISQ6: HLRZ T,PK.TCP(Q) ; Get addr of TCP header from queue + HLRZ C,PK.IP(Q) ; and addr of IP header + CAIE T, + CAIN C, + BUG CHECK,[TCP: SYNQ smashed] + CAMN B,TH$SRC(T) ; Same ports? + CAME D,IP$SRC(C) ; Same host? + CAIA ; No + JRST TSIF2B ; Yes, assume SYN is a dup, ignore it. + HRRZ Q,PK.TCP(Q) ; Get next thing on pending queue + JUMPN Q,TSISQ6 + + ; Not on queue, let's try to add it. +TSISQ7: MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,%TCPMQ ; Keep its length reasonable + JRST TSISQ8 ; Sigh, ran out. + HRROI T,NTSYNL ; OK, now try loading job up! + CALL NUJBST ; Queue request for job TCPRFC + JRST TSISLR ; Bah, no job slots or something! + MOVEI A,(R) ; It's on the way! Queue the SYN now. + MOVEI Q,TCPRQH + CALL PKQPL(PK.TCP) ; Add onto end of pending-RFC queue. +] ;ifn 0 + + MOVSI I,-XBL +TSISQ6: SKIPN XBUSER(I) + SKIPE XBSTAT(I) + AOBJN I,TSISQ6 + JUMPGE I,TSISQ8 ; Jump if no free slots. + CALL TXBINI ; Got one, might as well verify it's cleared. + MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,XBL/2 ; Keep number reasonable + JRST TSISQ8 ; Sorry, too many. + HRROI T,NTSYNL ; Now see if we can load up handler job. + CALL NUJBST ; Do it + JRST TSISLR ; Ugh, couldn't start new job... + MOVEI J,.XSSYQ + MOVEM J,XBSTAT(I) ; Set state SYN-QUEUED + LDB A,[IP$SRC (W)] + MOVEM A,XBHOST(I) ; Set up host # + MOVE A,TH$SRC(H) ; and ports + ; Don't need to set XBLCL, won't be looked at + MOVEM A,XBPORT(I) ; That's all we need for now. + CALL TCPMSS ; Might as well keep these right even though + CALL TCPRWS ; this TCB will be flushed when conn opens. + MOVE A,TIME + ADDI A,10.*30. ; Let it stay queued for 10 seconds. + MOVEM A,XBORTT(I) + MOVEI Q,XBITQH(I) ; Put the segment on input queue for slot. + MOVEI A,(R) + CALL PKQPF(PK.TCP) + + HRRZM I,TCPRQL ; Save # of last SYN queued. + AOS TCPRQN ; And increment count of entries. + METER("TCP: Srvjob starts") + RET ; All done! + +TSISQ8: BUG INFO,[TCP: SYN queue full] + JRST TSISLR ; Sigh. + + +; TSISQQ - Come here when segment received that matches an +; existing port/host which is in SYN-QUEUED state. + +TSISQQ: TLNE E,(TC%RST) ; Is it an RST? + JRST [ CALL TSISQF ; Yeah, flush the queued SYN. + JRST TSIFL] ; and drop segment. + TLNE E,(TC%ACK) ; An ACK? That's illegal etc... + JRST [ CALL TSISQF ; Flush the queued SYN, + JRST TSISAR] ; and send a RST in response. + TLNN E,(TC%SYN) ; Anything else better be a SYN + JRST [ CALL TSISQF ; else send RST. + JRST TSISLR] + JRST TSIF2B ; Most likely a duplicate SYN, so just + ; flush it and return. + + ; Flush TCB for a queued SYN. +TSISQF: SETZM XBSTAT(I) + SETZM XBPORT(I) + SETZM XBHOST(I) + SETZM XBORTT(I) + SKIPE XBITQH(I) + CALL TXBIFL + SOSGE TCPRQN + BUG HALT + RET + + +; TSISAR - Respond to current segment by sending a RST with +; SEQ=SEG.ACK. Re-uses the current segment's packet buffer. +; R, W, H set up for PE, IP, and TCP. +; E has seg flags. May not be anything in I, so re-use fields +; from given packet! +; TSISAQ - like TSISAR but just drops segment if it has RST in it. +; TSISLR - like TSISAR, but SEQ=0, ACK=SEG.SEQ+SEG.LEN +; This is used when responding to segments without an ACK, i.e. +; initial SYNs. + +TSISLR: METER("TCP: times at TSISLR") + LDB A,[TH$SEQ (H)] ; Get SEQ. Assume TT still valid. + ADDI A,(TT) ; ACK=SEG.SEQ+SEG.LEN + LSH A,4 ; Left justify it. + SETZ D, ; SEQ=0 + MOVSI T,(TC%RST+TC%ACK) + JRST TSISA2 + +TSISAQ: TLNE E,(TC%RST) ; Here, if incoming seg was RST, + JRST TSIFL ; just ignore, don't respond. +TSISAR: METER("TCP: times at TSISAR") + MOVE D,TH$ACK(H) ; Use SEG.ACK for SEQ + MOVSI T,(TC%RST) + + ; Here, A, D, and T must be set up. +TSISA2: SETZ B, + LDB C,[TH$SRC (H)] ; Get source port + DPB C,[.BP TH%DST,B] ; Use as dest port + LDB C,[TH$DST (H)] ; Get dest + DPB C,[.BP TH%SRC,B] ; Use as... you guessed it. + PUSH P,IP$DST(W) ; Which of my addresses to claim to be from + MOVE C,IP$SRC(W) + +; A/ ACK field (left justified) +; B/ (left justified) +; C/ remote host (left justified) +; D/ SEQ field (left justified) +; R/ PE ptr to packet responding to +; T/ flags to use + + + SETZ I, + CALL TSOINI ; Initialize W,H,PK.IP(R),PK.TCP(R),PK.TCI(R) + ; Note everything in PK.TCI will be wrong. + MOVEM C,IP$DST(W) ; Store remote host + MOVEM B,TH$SRC(H) ; Store loc/rem ports + MOVEM D,TH$SEQ(H) ; Deposit new SEQ field + TLNN T,(TC%ACK) ; If sending an ACK + SETZ A, + MOVEM A,TH$ACK(H) ; Deposit ACK field. + TLO T,240000 ; Set IHL + MOVEM T,TH$CTL(H) ; Deposit segment flags + MOVEI A,5*4 + DPB A,[IP$TOL (W)] ; Say length just a std TCP header. + POP P,IP$SRC(W) + CALL THCKSM ; Figure TCP checksum + DPB A,[TH$CKS (H)] ; Deposit in + CALL IPKSND ; Put this buffer on IP output queue! + RET + + +; TSILS - Segment received for this connection while in LISTEN state. +; +TSILS: METER("TCP: Segs rcvd in LSN") + TLNE E,(TC%RST) ; Ignore any RSTs. + JRST TSIFL + TLNE E,(TC%ACK) ; ACKs are bad too. + JRST TSISAR ; Respond with a RST to them. + TLNN E,(TC%SYN) ; It should be a SYN. + JRST TSIFL ; If not, just flush. + + ; We've received a SYN that should be valid. Set up for + ; SYN-RCVD state. Note that we ignore security/precedence + ; except to remember it so our transmits look OK. + ; NOTE!!! TSILSX is an entry point from MP level TCPOPN call, + ; which is used to hook up a user OPEN to a matching SYN on + ; the pending-RFC queue! + METER("TCP: SYN in LSN") +TSILSX: LDB D,[TH$SEQ (H)] ; Get sequence number + LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + CALL TCPISS ; Select a new ISS in A (Initial Send Seq#) + MOVEM A,XBSUNA(I) ; Set SND.UNA to ISS +; ADDI A,1 +; TLZ A,%MOD32 + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + + ; Check for TCP options at this point, and process if present + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + ; Nasty business - put together and send a segment with + ; seq=ISS,ack=RCV.NXT,ctl=SYN+ACK. + ; For now we can assume that initial SYNs will never + ; contain text, and so we don't have to queue it up. + ; Alternatively can hope that remote site is clever about + ; retransmitting! + ; This is because if we don't need to keep received segment + ; around, can just re-use it. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISLX Reflecting incoming SYN with SYN" + CALL TSOSSN ; Fire off SYN. Sends MSS option too. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TCPISS - Select new ISS, return in A + +TCPISS: MOVE A,TIME + LSH A,13. +TCPIS2: TLZ A,%MOD32 + CAMN A,TISSLU ; Same as last used? + JRST [ AOS A,TISSC + ANDI A,17 + LSH A,9. + ADD A,TISSLU + JRST TCPIS2] ; Jump to mask off and test again. + MOVEM A,TISSLU + RET + +; TCPPIO - Process TCP options from incoming segment. +; This is only checked for SYN segments because the only interesting +; option (Max Segment Size) is only sent with SYN segments +; +; R/ Pkt buffer +; I/ TCB Index +; H/ TCP Header +; A/ TCP header size in 32-bit words + +TCPPIO: SUBI A,%TCPHL + LSH A,2 ; Options length in bytes + MOVE B,[TH$OPT (H)] ; BP to start of options +TCPPIL: SKIPG A ; Anything left? + RET ; Nope, done + ILDB C,B ; Get option type + CAIL C,TCPPIS ; In range? + RET ; Have to give up if unknown option + JRST @TCPPIT(C) + +TCPPIT: TCPPI0 + TCPPI1 + TCPPI2 +TCPPIS==.-TCPPIT + + ;End of option list +TCPPI0: RET + + ;NOP +TCPPI1: SOJA A,TCPPIL ; Decrement length and loop + + ;Max Seg Size TYPE ? LENGTH ? MSB ? LSB +TCPPI2: ILDB C,B ; Get length + SUB A,C ; Count it + ILDB C,B ; Get 16-bit quantity, updating B + LSH C,8. + ILDB D,B + ADD C,D ; Now contains foreign MSS request + CAMGE C,XBSMSS(I) ; Don't exceed our own limits! + MOVEM C,XBSMSS(I) ; Set new value in TCB + JRST TCPPIL + + +; TSISS - Segment received while in SYN-SENT state. +; Note that being in this state implies that there is one +; segment on the retransmit queue, which must be the initial SYN +; that we sent. + +TSISS: METER("TCP: Segs rcvd in SYN-SENT") + LDB D,[TH$SEQ (H)] ; Get SEG.SEQ + TLNN E,(TC%ACK) ; Has an ACK? + JRST TSISS2 ; Nope, it better be RST or SYN. + + ; See if our SYN has been ACKed. Since we only send SYNs + ; without data, this just means a test for SEG.ACK = SND.NXT. + LDB B,[TH$ACK (H)] ; Have ACK. Get ack field + CAME B,XBSNXT(I) ; It should ACK our initial SYN + JRST TSISAQ ; If not, send a RST. +; MOVE A,XBSUNA(I) ; snd.una =< seg.ack =< snd.nxt ? +; CMPSEQ A,=<,B,=<,XBSNXT(I),TSISAQ ; If not good, send RST. + +TSISS2: TLNE E,(TC%RST) ; Check for RST + JRST [ TLNN E,(TC%ACK) ; Ugh, have RST. Did we also get good ACK? + JRST TSIFL ; No, can just flush this segment. + MOVEI T,.XCRFS ; Yeah, our SYN is being refused, so + CALL TCPUC ; say this is close-reason. + JRST TSIRST] ; Then must go abort connection. + + ; Here we get to check security/precedence. Hurray. + ; We should just copy the seg values, so as to fake sender out. + + ; Now finally check the SYN bit! + TLNN E,(TC%SYN) ; Must be set + JRST TSIFL ; Neither RST nor SYN? Flush it. + + ; It's a SYN. Update our send params from its values. + ; We will either send an ACK or another SYN; in both cases the + ; SYN segment currently on the retransmit queue should be flushed. + MOVEI Q,XBORTQ(I) ; Point to retrans q + CALL PKQGF(PK.TCP) ; Pluck off 1st thing + SOSN XBORTL(I) ; Verify none left on queue + CAIN A, ; and something was there! + BUG CHECK,[TCP: SYN-SENT retrans Q bad] + JUMPE A,TSISS3 ; Just for robustness + TRCPKT A,"TSISS2 Flushing our SYN from rexmit Q" + MOVE T,PK.FLG(A) + TLNE T,(%PKPIL) ; See if packet locked by PI I/O + JRST [ TLZ T,(%PKNOF) ; Yeah, so just say to flush when done. + MOVEM T,PK.FLG(A) + JRST .+2] ; Skip over the freecall + CALL PKTRT ; Flush SYN packet + SETZM XBORTT(I) ; and flush timeout. + +TSISS3: LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 + MOVEM D,XBRNXT(I) ; Set RCV.NXT to SEQ+1 + + ; Process segment options in case sender specified MSS + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + TLNN E,(TC%ACK) + JRST TSISS4 + LDB A,[TH$ACK (H)] ; If ACK also present, (known acceptable) + MOVEM A,XBSUNA(I) ; Set SND.UNA to SEG.ACK. + + ; Here must test if SND.UNA > ISS (our SYN has been ACKed). + ; But this was already checked just before TSISS2. + MOVSI T,(TC%ACK) ; Hurray, we're open! Must ACK the SYN + TRCPKT R,"TSISS3 ACK SYN to open conn" + CALL TSOSNR ; (Re-using its segment) + MOVEI J,.XSOPN ; Hurray, we're open now! + HRRM J,XBSTAT(I) + CALL TCPUSI ; Update user state + RET + + ; Our SYN not ACKed yet, so enter SYN-RCVD state. +TSISS4: + ; Must go send seq=ISS,ack=RCV.NXT,ctl=SYN+ACK + LDB D,[TH$SEQ (H)] ; Get sequence number + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + SOSGE A,XBSUNA(I) ; Set SND.UNA to ISS + JRST [ MOVEI A,1 + MOVEM A,XBSUNA(I) + JRST .+1] + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISS4 ACK and re-SYN SYN-SENT conn" + CALL TSOSSN ; Fire off SYN/ACK with MSS option included. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TSIRST - valid RST segment received (not in LISTEN). +; Basically must flush the connection, signal user, etc. + +TSIRST: METER("TCP: Valid RSTs") + CALL TXBFLP ; Flush the TCB immediately, PI level + MOVEI T,.XCRST ; Say fgn host reset stuff + CALL TCPUC ; as "close reason" + CALRET TSIFL ; Flush segment. + +; TSISYN - SYN segment received. +; If in window, error - send a RST and close things up. +; If not in window, return an ACK as for TSISNE. + +TSISYN: METER("TCP: Random SYN") + + CALRET TSIFL + +; TSISRA - Bad ACK seen while in SYN-RCVD state, +; send a RST. + +TSISRA: METER("TCP: Bad ACK in SYR") + CALRET TSIFL + +; TSISAK - Received ACK for something not yet seen, send ACK and +; drop segment. +TSISAK: METER("TCP: ACK for nxm") + CALRET TSIFL + +; TSIATW - Received ACK while in TIME-WAIT state. This should be +; a re-transmit of the remote FIN. ACK it, and restart +; 2-MSL timeout. + +TSIATW: METER("TCP: ACK in .XSTMW") + MOVSI T,(TC%ACK) + TRCPKT R,"TSIATW ACK send in TIME-WAIT" + CALL TSOSNR ; Send simple ACK in response. + JRST TSITM2 ; and restart 2-MSL timeout. + +SUBTTL TCP Send output segment + +; Send TCP output segment. +; Send output (usually data) segment, for connection indexed by I. +; Note this differs from TSISAR etc. which don't have any active connection, +; thus no valid I. As much context as possible is taken from the +; TCB tables indexed by I. +; In particular, the %XBCTL flags are examined to see if anything should +; be added to the outgoing segment, other than what was requested in the +; call. + +; Sequence space variables are updated. +; The following possibilities are independently possible: +; Re-using packet / using fresh packet +; Uses seq space (must retrans) / no seq space used +; +; TSOSND - send output segment while connection established +; R/ PE ptr to packet, +; PK.BUF, PK.IP and PK.TCP must be set. +; If these were not initialized by TSOINI so as to get +; the right offsets, you will probably lose. +; PK.TCI should have the # bytes of data and offset. +; I/ TCB index +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +; TSOSNR - Just sends a data-less "reply" type segment using +; TCB's sequence space vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (Neither ACK nor %XBCTL will be added automatically!) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSNR: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + + +; TSOSSN - Send an initial SYN segment. No data, but add a TCP +; MSS option set from XBRMSS(I), and using TCB's sequence space +; vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (None, including SYN, will be added automatically) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSSN: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + MOVE TT,XBRMSS(I) ; Max seg size we would like + LSH TT,4 ; 32-bit option + IOR TT,TSOMSO ; Add in type and length fields of option + MOVEM TT,TH$OPT(H) ; Write it. Damn well better be first option. + LDB TT,[PK$TDO (R)] ; Get current TCP header size + ADDI TT,4 ; Adding 4-byte option + DPB TT,[PK$TDO (R)] + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + +TSOMSO: .BYTE 8 ? 2 ? 4 ? 0 ? 0 ? .BYTE ; Option 2, length 4, two data words + +TSOSND: MOVSI T,(TC%ACK) ; Simple data segment + IOR T,XBSTAT(I) ; Plus whatever is being requested. + HLRZ W,PK.IP(R) ; Get ptr to IP header + HLRZ H,PK.TCP(R) ; and TCP header + LDB TT,[PK$TDL (R)] ; Get # bytes of data +; LDB A,[PK$TDO (R)] ; Get offset of data +; ADDI TT,(A) ; Now have # bytes past std hdr length. + +; TSOSN - Entry point if W, H, and TT already set up. +; I/ TCB index +; T/ flags for segment +; R/ PE ptr (PK.BUF, PK.IP, PK.TCP, PK.TCI must all be set) +; W/ IP header ptr +; H/ TCP header ptr +; TT/ # bytes of data (real data, not including header or SYN/FIN) +; Clobbers A,B,C,D,E,TT,T,Q and updates various TCB data. + +; This code assumes TT is the bytes of DATA only. +; Must store the out-of-TCP info in the IP header field, so that +; the checksum and IPKSND routines will find it there. +; This info consists of: +; IP$SRC - Source address +; IP$DST - Dest address +; IP$TOL - TCP segment length including header +; IP$PTC - Protocol number (needn't set, assumes %PTCTC always) + +TSOSN: METER("TCP: Out segs") + AND T,[TH%CTL] ; Ensure non-flag bits are flushed. + MOVE A,T + ANDCAB A,XBSTAT(I) ; Turn off these request bits + TLNE A,(TH%CTL) ; Any request bits left? + JRST TSOSN2 ; Yeah, can't turn off "now" bit. + MOVSI A,(%XBNOW) ; Satisfied everything, so flush + ANDCAM A,XBSTAT(I) ; the send-immediately bit. + +TSOSN2: LDB A,[PK$TDO (R)] ; Bytes of header + ADDI A,(TT) ; Add bytes of data + DPB A,[IP$TOL (W)] ; Store in IP length field + MOVE A,XBLCL(I) + LSH A,4 + MOVEM A,IP$SRC(W) ; Set source host + MOVE A,XBHOST(I) + LSH A,4 + MOVEM A,IP$DST(W) ; Set dest host + + ; Out-of-TCP info set up, now build the real TCP header. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get port sending from (local) + DPB A,[TH$SRC (H)] + LDB A,[.BP TH%SRC,XBPORT(I)] ; Get port to send to + DPB A,[TH$DST (H)] + MOVE A,XBSNXT(I) ; Get sequence number to use + LSH A,4 + MOVEM A,TH$SEQ(H) ; Set SEQ field + TLNN T,(TC%ACK) ; Check flags, sending ACK? + TDZA A,A ; If not, use zero field anyway. + MOVE A,XBRNXT(I) ; Get ack number to use + LSH A,4 + MOVEM A,TH$ACK(H) ; Set ACK field + + SKIPE A,XBSUP(I) ; Urgent data being sent? + JRST [ TLO T,(TC%URG) ; Yes! Say urgent pointer signif + METER("TCP: Urgent dgms") + MOVNI B,(TT) + ADDB B,XBSUP(I) ; Adjust pointer as result of data sent + CAIGE B, + SETZM XBSUP(I) + LSH A,4 + JRST .+1] + MOVEM A,TH$UP(H) ; Set urgent pointer if any + + MOVE A,XBRWND(I) ; Get our current receive window + LSH A,4 + IOR A,T ; Add in caller's flags + LDB B,[PK$TDO (R)] ; Header length in bytes + LSH B,-2 ; TCP wants length in 32-bit words + DPB B,[<.BP TH%THL,A>] + MOVEM A,TH$THL(H) ; Store header len, flags, window + + PUSH P,TT ; Goddam checksum clobberage + CALL THCKSM ; Now figure out checksum + POP P,TT + DPB A,[TH$CKS (H)] + + ; TCP header set up. Now update our TCB connection vars to + ; account for the stuff we're sending. + TLNE T,(TC%SYN) ; Now find new seq # (SND.NXT) + ADDI TT,1 ; SYN counts as 1 octet + TLNE T,(TC%FIN) ; So does a FIN + ADDI TT,1 + JUMPLE TT,TSOSN8 ; If not actually using seq space, skip + ; a bunch of update/retrans stuff. + + ; We're using up some sequence space! Must update avail window, + ; and put the segment on retransmit queue. + MOVE A,XBSAVW(I) ; Must update avail send window + SUBI A,(TT) + CAIGE A, ; If window becomes negative, + SETZ A, ; keep it at zero. + MOVEM A,XBSAVW(I) + ADD TT,XBSNXT(I) ; Get new SND.NXT + TLZ TT,%MOD32 + MOVEM TT,XBSNXT(I) + SKIPN XBORTT(I) ; Retrans timeout already set? + JRST [ MOVE A,TIME + ADD A,TCPTMO ; Make it 5 sec for now. + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Clear count of retries. + JRST .+1] + MOVSI A,(%PKNOF) ; Don't free packet when output done + IORM A,PK.FLG(R) + TRCPKT R,"TSOSND Pkt w/seq space added to retransmit queue" + MOVEI A,(R) ; Arg to PKQPL, A/ PE ptr + MOVEI Q,XBORTQ(I) ; Arg to PKQPL, Q/ queue hdr ptr + CALL PKQPL(PK.TCP) ; Put on TCP retrans queue + AOS XBORTL(I) ; Bump count of segs on queue + +TSOSN8: CALL IPKSND ; Put on IP output queue + RET + +SUBTTL TCP Retransmit and Timeout + +Comment | + The following things in TCP need some sort of timeout: + Retransmit output segment if not ACKed (removed) within RT sec + Timeout to abort connection if retransmission fails for UT sec + Timeout to ACK incoming data (ie avoid ACKing immediately, + wait for more output or input). + Timeout during TIME-WAIT to flush connection. +| + +; TCPCLK - This routine is called by 1/2-sec "slow" clock. What it has to do +; is scan all active TCB's for the following conditions: +; (1) Retransmit timeout has expired, must resend something. +; or TIME-WAIT timeout has expired. +; (2) An ACK must be sent, either by sending the current output +; buffer, or by generating an ACK without data. + +EBLK +TCLKRC: 0 ; Count of segs compacted in pass over a retrans Q +BBLK + +TCPCLK: SKIPN TCPUP ; Do nothing if turned off. + RET + MOVSI I,-XBL + CONO PI,NETOFF + SKIPA A,TIME +TCLK05: SKIPA A,TIME + +TCLK10: SKIPN B,XBSTAT(I) + JRST TCLK15 + SKIPE C,XBORTT(I) + CAMG A,C + CAIA + JRST TCLK20 ; Retrans timeout +TCLK12: TLNE B,(TH%CTL+%XBNOW) ; Any flags set? + JRST TCLK50 ; Wants ACK sent +TCLK15: AOBJN I,TCLK10 + CONO PI,NETON + RET +TCLK16: MOVE A,TIME + AOBJN I,TCLK10 + CONO PI,NETON + RET + + ; Come here for timeout of some sort. +TCLK20: SKIPE XBORTQ(I) ; If a retrans queue exists, + JRST TCLK22 ; then assume it was a retrans timeout. + MOVEI C,(B) ; No retrans Q, probably a TIME-WAIT one? + CAIN C,.XSTMW ; State TIME-WAIT? + JRST [ METER("TCP: Time-Wait timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + JRST TCLK16] + CAIN C,.XSSYQ ; State SYN-QUEUED? + JRST [ METER("TCP: SYQ timeout") + CALL TSISQF ; Flush the queued SYN. + JRST TCLK16] + CAIN C,.XSFN2 ; State FIN-WAIT-2? + JRST TCLK21 + METER("TCP: Random timeout") ; Sigh. + SETZM XBORTT(I) ; Flush whatever it was. + JRST TCLK16 + +TCLK21: METER("TCP: FN2 timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + SKIPE XBUSER(I) ; Shouldn't still have anything open. + BUG CHECK,[TCP: FN2 timo with active user] + JRST TCLK16 + +TCLK22: METER("TCP: Retrans") + AOS C,XBORTC(I) ; Retrans timeout. Send it again. + SKIPE D,XBORTP(I) ; Has user set any retrans params? + JRST [ JRST TCLK25] ; Yes! For now, non-Z means skip abort check. + CAILE C,%TCPMR ; Tried too many times? + JRST TCLK80 ; Ugh, abort the connection! + SKIPN R,XBORTQ(I) + JRST [ SETZM XBORTT(I) ; If nothing on queue, + JRST TCLK12] ; just reset the timeout to nothing. + SKIPGE A,PK.FLG(R) ; Ensure that packet isn't being output now + JRST TCLK25 ; Still being output?? Reset timeout. + ; Note that we don't check to see whether segment has already + ; been transmitted, on the theory that compaction is going to + ; pay off anyway. + HLRZ W,PK.IP(R) + HLRZ H,PK.TCP(R) + SETZM TCLKRC ; Clear compaction count. + + ; Looks like we have to retransmit. Try to compact up as much + ; stuff as possible into a single segment; this gets a bit + ; hairy. Note that we compact as much as we can, ignoring the + ; %PKPIL and %PKODN bits (except for setting the appropriate flush + ; flags). + TRCPKT R,"TCLK30 Segment being retransmitted" +TCLK30: HRRZ J,PK.TCP(R) ; Get pointer to succeeding segment + JUMPE J,TCLK39 ; If none following, can't compact (ignore + ; possibility of adding XBOCOS for now) + LDB B,[PK$TDO (R)] ; Get 1st offset + LDB C,[PK$TDL (R)] ; Get 1st length + LDB T,[PK$TDL (J)] ; Get 2nd length + ADDI B,(C) ; Find offset to end of 1st data + MOVEI D,(B) + ADDI D,(T) ; Find total length after compaction + CAILE D,576.-<5*4> ; Hack hack hack! Limit to 556. so std + ; IP datagram is limited to 576. + JRST TCLK39 ; If too big, don't compact. + + ; Compact two segments into one! + ; R/ 1st seg D/ offset to end of data + ; J/ 2nd seg T/ len of 2nd data + METER("TCP: Retrans compact") + TRCPKT J,"TCLK30 Segment being compacted into previous seg for rexmit" + ADDI C,(T) ; Get new # bytes for 1st seg + DPB C,[PK$TDL (R)] ; Store it in advance. +; HLRZ D,PK.TCP(R) ; Find addr of TCP header in 1st seg + MOVEI D,(H) + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (J)] ; Get data offset for 2nd seg + IDIVI B,4 + HLRZ A,PK.TCP(J) ; Get addr for BP to start of 2nd data + ADDI B,(A) + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to 2nd data + ; D/ BP to end of 1st data + ; T/ # bytes of 2nd data + LDB A,[IP$TOL (W)] ; Get current length of whole datagram + ADDI A,(T) ; Increment by length of added stuff + DPB A,[IP$TOL (W)] ; Store back + ADDI A,3 + LSH A,-2 + HRLM A,PK.BUF(R) ; Set up new count of # words in datagram. +TCLK32: ILDB C,B + IDPB C,D + SOJG T,TCLK32 + + ; Data copied over, now update flags and stuff. + HLRZ D,PK.TCP(J) + MOVE A,TH$CTL(D) ; Get flags for 2nd seg + AND A,[TH%CTL] ; Mask off just flags + IORM A,TH$CTL(H) ; Add them to flags for 1st seg + TLNE A,(TC%URG) ; If URGENT bit set, + JRST [ LDB B,[TH$UP (D)] ; Get pointer from 2nd seg + LDB C,[PK$TDL (R)] ; Sigh, get new len of 1st seg + ADDI B,(C) ; Adjust for bytes in front + LDB C,[PK$TDL (J)] ; But have to subtract length + SUBI B,(C) ; of 2nd seg (already in 1st len) + DPB B,[TH$UP (H)] ; Store ptr back in 1st seg + JRST .+1] + + ; Compaction done! Now have to remove 2nd seg from queue. + HRRZ B,PK.TCP(J) ; Get pointer to 3rd seg + HRRM B,PK.TCP(R) ; Point 1st at it + CAIN B, ; If 2nd was the last one, + HRLM R,XBORTQ(I) ; must update "last" ptr in queue header. + MOVE A,PK.FLG(J) ; Get flags +IFN PK.TCP-2,.ERR %PQFL flag must match PK.TCP + TLZ A,(%PKNOF+%PQFL2) ; Say it's off the TCP list, and allow + ; flushing from IP queue. + TLO A,(%PKFLS) ; In fact, require it + MOVEM A,PK.FLG(J) ; Store flags back + JUMPGE A,[MOVEI A,(J) ; If not locked by PI output, + TRCPKT A,"TCLK32 Seg flushed from rexmit by compaction" + CALL PKTRT ; try to flush it now. + JRST .+1] + SOSGE XBORTL(I) ; Decrement count of retrans queue segs + BUG HALT + AOS TCLKRC ; Bump count of recompacts done + JRST TCLK30 ; OK, try to recompact next seg! + + ; Note one possible problem with following code; although + ; the segment being re-trans'd is given latest poop (ACK, WND), + ; the ones following are not. This is usually OK as we assume + ; that following segs have actually been sent out, but if it + ; happens that they HAVEN'T (i.e. %PKODN not set) then their + ; info is going to be a little out of date. This shouldn't + ; screw things too much, however. +TCLK39: MOVE D,XBRNXT(I) ; Get latest ACK value + LSH D,4 + MOVEM D,TH$ACK(H) ; Set it + MOVE D,XBRWND(I) ; And latest window + DPB D,[TH$WND (H)] + CALL THCKSI ; Compute checksum for it (note not THCKSM) + DPB A,[TH$CKS (H)] + SKIPE TCLKRC ; Was any recompaction done? + CALL IPKHD2 ; Yes, must recompute IP header (checksum etc) + MOVE A,PK.FLG(R) + TLNN A,(%PKODN) ; Has segment already been tried once? + JRST [ ; No, don't put on output queue twice!! + TRCPKT R,"TCLK39 Rexmit skipped because seg not yet output" + METER("TCP: Pretrans compact") + JRST TCLK25] + TLO A,(%PKRTR) ; Set flag saying this is a retransmit + MOVEM A,PK.FLG(R) + MOVEI A,(R) + CALL IPKSNQ ; Put back on IP output queue + ; Note PK.BUF shd still be set up right, + ; and shd still have %PKNOF set. +TCLK25: MOVE A,TIME + HRRZ B,XBORTP(I) ; If RH set, use it for new timeout. + CAIN B, + MOVE B,TCPTMO ; Use timeout default. + ADD B,A + MOVEM B,XBORTT(I) + JRST TCLK79 + + ; Here when need to send an ACK. First see if we can + ; make use of existing output buffer. +TCLK50: METER("TCP: slow ACKs") + TLNE B,(TC%SYN+TC%RST) + BUG CHECK,[TCP: SYN or RST set in XBSTAT clock req] + SKIPE R,XBOCOS(I) ; Ensure there is one. + TLNE B,(%XBMPL) ; and that it isn't locked. + JRST TCLK60 ; Sigh, can't use it. + + ; There is an output buffer, and it's not locked, so use that + ; to send stuff out! + TRCPKT R,"TCLK50 COS used to send clock level ACK" + MOVSI T,(TC%PSH) + CALL TCPOFR ; Force it out. + JRST TCLK16 + + ; Come here when we have to generate a new segment for ACK. +TCLK60: TLNN B,(%XBNOW) ; Insisting that we ACK? + JRST TCLK65 ; No, can semi-punt. + CALL PKTGFI ; Get buffer + JRST TCLK65 ; and forget about ACKing if we cant get one + METER("TCP: Clk ACK") + MOVEI R,(A) + MOVE T,B ; Use request flags in segment. + TRCPKT R,"TCLK60 Alloc and send ACK from clock level" + CALL TSOSNR ; Send a simple ACK + JRST TCLK16 + +TCLK65: MOVSI A,(%XBNOW) ; No, so just set insist flag + IORM A,XBSTAT(I) ; and wait a bit longer. + JRST TCLK16 + +TCLK79: + JRST TCLK16 + + ; Abort the connection, timed out. +TCLK80: METER("TCP: Timeout abort") + CALL TXBFLP ; This is pretty drastic... flush, PI level. + MOVEI T,.XCINC ; Say "incomplete transmission" + CALL TCPUC ; as close reason. + JRST TCLK16 + +TCLK90: CONO PI,NETON + RET + + +; Checksum cruft. + +; THCKSM - Figures TCP segment checksum, IP$TOL has TCP segment length. +; THCKSI - Figures TCP segment checksum, IP$TOL has IP header plus TCP seg. +; W/ addr of IP header +; H/ addr of TCP header +; Note that the following out-of-TCP values are looked up +; from the IP header in order to compute sum for the "pseudo header". +; IP$SRC - source host +; IP$DST - dest host +; IP$TOL - # octets in TCP segment (plus IP header) +; Finally, +; %PTCTC - Assumed value +; +; Clobbers B,C,D,E +; Returns +; A/ checksum +; TT/ Total # bytes in TCP segment + +THCKSM: TDZA C,C ; Compute as if IHL=0 +THCKSI: MOVNI C,5*4 + ; First compute pseudo header + LDB A,[IP$SRC (W)] ; Source addr + LDB B,[IP$DST (W)] ; Dest addr + ADD A,B + ADDI A,%PTCTC ; Add TCP protocol number + LDB TT,[IP$TOL (W)] ; Get total length in octets + JUMPE C,THCKS2 + LDB B,[IP$IHL (W)] ; Find IP header length in 32-bit wds + LSH B,2 ; mult by 4 to get # octets + SUBI TT,(B) ; Find # octets of IP data (TCP segment) +THCKS2: ADDI A,(TT) ; Add in. + MOVEI C,-<5*4>(TT) ; Get # bytes in segment after 1st 5 wds + + ; Done with pseudo header (not folded yet, though). + LDB B,[044000,,0(H)] ; Get wd 0 (src/dest) + ADD A,B + LDB B,[TH$SEQ (H)] ; Get wd 1 (seqno) + ADD A,B + LDB B,[TH$ACK (H)] ; wd 2 + ADD A,B + LDB B,[044000,,3(H)] ; wd 3 + ADD A,B + LDB B,[TH$UP (H)] ; wd 4 (part of) + ADDI A,(B) + + LSHC A,-16. + LSH B,-<16.+4> + ADDI A,(B) ; Now have it folded up. + JUMPLE C,THCKS7 ; If nothing more, can leave now. + MOVEI E,5(H) + HRLI E,442000 ; Set up 16-bit byte ptr to options/data + LSHC C,-1 + JUMPLE C,THCKS6 +THCKS5: ILDB B,E + ADDI A,(B) + SOJG C,THCKS5 +THCKS6: JUMPL D,[ ; Jump if odd byte left. + ILDB B,E ; get it + ANDCMI B,377 ; mask off low (unused) byte. + ADDI A,(B) + JRST .+1] +%CKMSK==<-1#177777> ; Mask for stuff above 16 bits +THCKS7: TDNE A,[%CKMSK] ; If any carries, add them in. + JRST [ LDB B,[.BP %CKMSK,A] + TDZ A,[%CKMSK] + ADD A,B + JRST THCKS7] + ANDCAI A,177777 ; Complement sum and mask off. + RET + + +MTRCOD ; Last stuff -- expand meter tables. +TRCCOD ; Expand trace tables diff --git a/system/tcp.274 b/system/tcp.274 new file mode 100644 index 0000000..bd282d7 --- /dev/null +++ b/system/tcp.274 @@ -0,0 +1,3640 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; This file holds the modules for TCP. +comment | STUFF TO DO + +Incoming ACKs should prevent retrans from aborting connection, since +clearly it is still alive, just doesn't have room for our stuff (which +is possibly overflowing its window). + +Note Clark suggs on windowing/ACKing. + If input data seg doesnt have PUSH, don't send ACK, but set + a timeout for sending ACK. Send ACK when: + PUSH is seen + outgoing seg forced out (new or retrans) + timed out + +Output buffering stinks. If can't send buff due to too many segs, +then should be able to keep adding to present segment. + +Provide way for output IOT to specify URGENT, and +Handle URGENT when received on input. + +| + +SUBTTL TCP definitions + +%WYTCP==:7 ; Move to BITS later + +%MOD32==:740000 ; LH mask used for mod 32 arithmetic +%TCPMI==:5 ; Max # segments in input queue per connection +%TCPMO==:5 ; Max # segments in output queue per connection +%TCPDS==:536. ; Default max # bytes per segment (when no + ; knowledge of receiving host) +%TCPMS==:2048.-40. ; Maximum possible segment size we can support + ; This must be 7777 (octal) or less. +%TCPMB==:%TCPMI*%TCPMS ; Max # bytes of data in queue (a bit fictional) +%TCPMR==:20. ; Max # retransmit retries allowed +%TCPMQ==:20 ; Max # pending RFCs allowed +%TCPMP==:777 ; Max port # allowed for pending-RFC (SYN) conns + ; Note pending-RFCs used ONLY for job startups, + ; SYNs are not queued in general. + +; Defintions of TCP Segment Header fields. +%TCPHL==:5 ; # of 32-bit words in fixed part of TCP header + +TH%SRC==:777774,, ; 0 Source Port +TH%DST==: 3,,777760 ; 0 Destination Port +TH%SEQ==:777777,,777760 ; 1 Sequence Number +TH%ACK==:777777,,777760 ; 2 Acknowledgement Number +TH%THL==:740000,, ; 3 Data Offset (TCP Header Length in 32-bit wds) +TH%RES==: 37400,, ; 3 Reserved (should be 0) +TH%CTL==: 374,, ; 3 Control bits +TH%WND==: 3,,777760 ; 3 Window +TH%CKS==:777774,, ; 4 Checksum +TH%UP==: 3,,777760 ; 4 Urgent Pointer + ; 5 Start of Options/Data + +TH$SRC==:<.BP TH%SRC,0> +TH$DST==:<.BP TH%DST,0 > +TH$SEQ==:<.BP TH%SEQ,1> +TH$ACK==:<.BP TH%ACK,2> +TH$THL==:<.BP TH%THL,3> +TH$RES==:<.BP TH%RES,3> +TH$CTL==:<.BP TH%CTL,3> +TH$WND==:<.BP TH%WND,3> +TH$CKS==:<.BP TH%CKS,4> +TH$UP==: <.BP TH%UP, 4> +TH$OPT==:<441000,,5> ; An ILDB-type pointer to start of options. + + ; Control bit definitions (as located in full word) +TC%URG==:<200,,> ; Urgent Pointer significant +TC%ACK==:<100,,> ; Ack field significant +TC%PSH==:< 40,,> ; Push Function +TC%RST==:< 20,,> ; Reset connection +TC%SYN==:< 10,,> ; Synchronize sequence numbers +TC%FIN==:< 4,,> ; Finalize - no more data from sender + +; TCP Connection tables, normally indexed by I +; These correspond to what the TCP document (RFC-793) calls +; the "Transmission Control Block" parameters. +; A TCB is "in use" if either XBUSER or XBSTAT is non-zero. +; XBUSER is set if a user job has channels associated with the TCB. +; XBSTAT is set if TCP is dealing with the TCB. +; PI level will never touch any TCBs which have a zero XBSTAT, so it is +; safe for the MP level to hack a zero-XBSTAT TCB without using NETOFF. + +IFNDEF XBL,XBL==10. ; Allow this many TCP connections for now. + +EBLK ; General variables + +XBUSER: BLOCK XBL ; RH User index + XB%STY==:<770000,,> ; TTY # of STY connected to (0 if none) + XB%ICH==:<007700,,> ; Input channel #+1 (77=IOPUSHed) + XB%OCH==:<000077,,> ; Output channel #+1 (77=IOPUSHed) + XB$STY==:<.BP XB%STY,XBUSER> + XB$ICH==:<.BP XB%ICH,XBUSER> + XB$OCH==:<.BP XB%OCH,XBUSER> +XBSTAT: BLOCK XBL ; ,, + ; Connection flags (internal to ITS) + %XBMPL==:SETZ ; Current output segment locked at MP level (IOT) + ; This must be sign bit for SGNSET/PCLSR to work. + %XBCTL==:<374,,> ; Array of output request bits + IFN %XBCTL-TH%CTL,.ERR %XBCTL flags must be the same as TH%CTL!! + ; For all bits in %XBCTL the general meaning is + ; "Set this bit in next outgoing segment". If no bits + ; are set, output is sent every 2 sec, otherwise every + ; 1/2 sec. If %XBNOW is set, output is sent as soon + ; as something notices it. + %XBNOW==:<1,,> ; Send output segment ASAP (else 1/2 sec clock) + %XBACF==:<2,,> ; Our FIN has been ACKed + + %XBABT==:< 400,,> ; We're aborting. + %XBFIN==:<1000,,> ; FIN received for input, input queue will not + ; get any more additions. +; %XBWOK==:<100,,> ; State is OK for user to write (else get IOC err) +; %XBROK==:<200,,> ; State is OK for user to read (else get IOC err) + + ; Connection state, as in TCP document (RFC-793) + ; Some test/dispatch code depends on the fact that the first + ; 4 states have the values they do. + ; ** NOTE: These .XSzzz symbols are not advertised to users. + ; ** Maybe I'll rename them in here sometime. -- CSTACY 9/84 + .XSCLS==:0 ; Closed (must be zero) + .XSSYQ==:1 ; ADDITIONAL ITS STATE: Syn-Queued + .XSLSN==:2 ; Listen + .XSSYN==:3 ; Syn-Sent + .XSSYR==:4 ; Syn-Rcvd + .XSOPN==:5 ; Established (Open) + .XSFN1==:6 ; Fin-Wait-1 + .XSFN2==:7 ; Fin-Wait-2 + .XSCLW==:10 ; Close-Wait + .XSCLO==:11 ; Closing + .XSCLA==:12 ; Last-Ack + .XSTMW==:13 ; Time-Wait + .XSTOT==:14 ; Total # of states +XBSTAU: BLOCK XBL ; User Channel state ,, +XBCLSU: BLOCK XBL ; Close reason ,, + .XCNTO==:0 ; Never opened + .XCUSR==:1 ; Closed by user + .XCFRN==:2 ; Closed by foreign host + .XCRST==:3 ; Fgn host reset things + .XCDED==:4 ; Fgn host dead (apparently) + .XCINC==:5 ; Incomplete transmission (retrans timeout) + ; ==:6 ; Byte size mismatch - can't happen + .XCNCP==:7 ; Local TCP went down + .XCRFS==:10 ; Fgn host refused connection (valid RST + ; received in SYN-SENT state) + +XBPORT: BLOCK XBL ; <4 zero bits> + ; It is set up this way for fast lookup of + ; incoming segments. +XBHOST: BLOCK XBL ; Remote host (HOSTS3 format) +XBLCL: BLOCK XBL ; Local host (HOSTS3 format) +XBNADR: REPEAT XBL,-1 ; Net host address to give the device driver (-1 none) + +; MP Input - see TCPI for detailed description +XBITQH: BLOCK XBL ; Input Segment TCP queue header +XBINBS: BLOCK XBL ; Total # bytes in input queue +XBINPS: BLOCK XBL ; Total # segments in input queue +XBIBP: BLOCK XBL ; Main prog BP to input +XBIBC: BLOCK XBL ; # bytes available for this BP + +; MP Output - see TCPW for detailed description +XBOCOS: BLOCK XBL ; Current Output Segment pointer (0 if none) +XBOBP: BLOCK XBL ; Main prog BP into output segment +XBOBC: BLOCK XBL ; # bytes of room for this BP + +XBORTP: BLOCK XBL ; Retransmit parameters +XBORTQ: BLOCK XBL ; Retransmit queue header +XBORTL: BLOCK XBL ; Retransmit queue length (# of segments) +XBORTC: BLOCK XBL ; Retransmit count (1st msg on queue) +XBORTT: BLOCK XBL ; Retransmit timeout (1st msg on queue) + +; TCP Send Sequence Variables +XBSUNA: BLOCK XBL ; Send Unacknowledged +XBSNXT: BLOCK XBL ; Send Next +XBSWND: BLOCK XBL ; Send Window (offered window) +XBSAVW: BLOCK XBL ; Available window (between SNXT and SUNA+WND) +XBSUP: BLOCK XBL ; Send Urgent Pointer +XBSWL1: BLOCK XBL ; Segment Seq number used for last window update +XBSWL2: BLOCK XBL ; Segment Ack number used for last window update +XBSMSS: BLOCK XBL ; Max seg size that receiver can handle + +; TCP Receive Sequence Variables +XBRNXT: BLOCK XBL ; Receive Next +XBRWND: BLOCK XBL ; Receive Window +XBRUP: BLOCK XBL ; Receive Urgent Pointer +XBRMSS: BLOCK XBL ; Max seg size we are expecting/ have asked for + +BBLK + +NTSYNL: SIXBIT /TCP/ ; Start SYS;ATSIGN TCP for random SYNs. +EBLK + 0 ; Word for NUJBST etc to mung for above job starting + +TCPUP: -1 ; -1 to handle TCP stuff, 0 to turn off. +TCPUSW: 0 ; -1 to disable net conns from anyone but ourself (like NETUSW) + ; Perhaps eventually this should be the same as NETUSW. +TCPRQN: 0 ; # of things in SYN queue, to keep it small +TCPRQL: 0 ; Index of last SYN queued. +TCPCRI: 0 ; Counter used for gensymming local port #s +TISSLU: 0 ; Last ISS used +TISSC: 0 ; Counter to further uniquize ISS +TCPLCP: 0 ; Last TCB index allocated +TCPBSW: -1 ? 0 ; Lock switch for allocating TCB indices +TCPTMO: 4*30. ; Default timeout for retransmits (in 30'ths of sec) +BBLK + +; Macro to perform sequence-number range checking. +; Note all numbers are 32-bit positive integers, modulo 2**32. +; Use it like this: +; CMPSEQ ,,,,,, +; Left and Right are addrs of the range bounds. One of them +; must be an AC. +; Seqno must be an AC. +; LT and LE are the strings "<" and "=<". +; Lerr and Rerr are the places to JRST to if the left or +; right compares fail, respectively. Rerr can +; be omitted and will default to Lerr. +; e.g. +; CMPSEQ A,<,D,=<,XBSNXT(I),TSI30 +; NOTE CAREFULLY that only existence within a range is checked, +; and the bounds L,R of the range MUST be known to be L =< R! +; It does not work to use CMPSEQ for the degenerate case +; CMPSEQ A,<,B,<,B,ERR +; to see if A < B. + +DEFINE CMPSEQ (L),C1,S,C2,(R),(OUTV1),(OUTV2) + %%%CML==0 + %%%CMR==0 +IFSE [C1][<] %%%CML==CAMG +IFSE [C1][=<] %%%CML==CAMGE +IFSE [C2][<] %%%CMR==CAML +IFSE [C2][=<] %%%CMR==CAMLE +IFE %%%CML&%%%CMR, .ERR Seq compare has bad relational arg + %%%CMX==CAMLE +IFSE [C1][=<] %%%CMX==CAML + +IFGE L-20,IFGE R-20, .ERR Seq compare needs ACs + +IFL L-20,CAMLE L,R ; Skip if normal order, L =< R +.ELSE CAMGE R,L + JRST [ ; Reverse order, R < L. Check S < R & L < S + %%%CMR S,R ; Skipwin if S <(=) R + %%%CMX S,L ; Unusual test here, win if S >(~=) L + JRST .+5 ; If either wins, win completely! +IFB OUTV2, JRST OUTV1 +.ELSE CAML S,[020000,,] ? JRST OUTV1 ? JRST OUTV2 + ] + ; Normal order, L =< R + %%%CML S,L ; Skipwin if S >(=) L + JRST OUTV1 + %%%CMR S,R ; Skipwin if S <(=) R +IFB OUTV2, JRST OUTV1 +.ELSE JRST OUTV2 +TERMIN + +SUBTTL TCP Open system call + +; .CALL TCPOPN +; arg 1 - receive channel number +; arg 2 - transmit channel number +; arg 3 - local port # (-1 to gensym unique port #) +; arg 4 - foreign port # (-1 for wild) +; arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild) +; arg 6 - Retransmission timeout (optional) + +;Control bits: +; - None needed for channels - they are opened as .UAI and .UAO +; automatically (no other modes possible). +; - 7 vs 8 bit ASCII transfers can be determined by user-space byte +; pointer used in SIOT. System buffers are always 8-bit bytes. +%NOLSN==:100 ; Listen mode +%NOBBI==:200 ; Use big buffer for input (not implemented yet) +%NOBBO==:400 ; Use big buffer for output (not implemented yet) +%NOWDA==:1000 ; Use word-align algorithm on transmit (not implemented yet) + +; Note a value of -1 for either the foreign port or host will imply +; that the call is a "listen". For the time being, either also implies +; the other, i.e. wild port means wild host and vice versa. This is +; because I havent figured out what the right thing to do is for the +; various combinations that could result otherwise. +; Word-align means that for the transmit side, all segments sent will +; have the data aligned so that the first byte, and every fourth byte +; after that, will start on a 32-bit word boundary. This should +; produce a noticeable speedup for transfers that involve large blocks +; of words rather than small amounts of miscellaneous text. +; For the latter, it only makes things worse, so is not the default. + +; Return is semi-immediate; the call may +; hang momentarily waiting for a free network buffer. (Have timeout? +; do a SKIPA SKIPA HANG to schedule, then fail if still none?) +; Use NETBLK +; to determine when the channels become open. For a non-listen call, +; there is an internal ITS timeout, but for listen the state can persist +; forever. + +TCPOPN: METER("TCP: syscal tcpopn") + MOVEI A,(A) + MOVEI B,(B) + CAIGE A,NIOCHN + CAIL B,NIOCHN + JRST OPNL14 ; Bad channel # argument + CAIN A,(B) + JRST OPNL33 ; Illegal to use same channel # for both + MOVEI J,(B) + HRLI J,(A) ; Save chan #s in J/ ,, + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,J + MOVEI R,(A) ; Close receive chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE ; Close whatever is already on channels. + HRRZ R,(P) ; Close xmit chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,J + POP P,E + POP P,D + POP P,C + + HLRZM J,UUAC(U) ; Remember input channel # for errs. + SKIPN TCPUP ; If TCP disabled, + JRST OPNL7 ; Fail, "device not ready". + CALL SWTL ; Lock TCB assignment switch + TCPBSW + MOVE I,TCPLCP + SOJL I,TCPO2 +TCPO1: SKIPN XBUSER(I) ; Hunt for free TCB + SKIPE XBSTAT(I) ; Must be both closed and unassigned. + SOJGE I,TCPO1 + JUMPGE I,TCPO3 ; Jump if got one! +TCPO2: MOVEI I,XBL ; Hit beginning, wrap back to end + CAMN I,TCPLCP + JRST OPNL6 ; No free TCB's available + MOVEM I,TCPLCP ; Might as well make faster next time + SOJA I,TCPO1 + +TCPO3: MOVEM I,TCPLCP ; Save scan pointer for next time + JRST TCPO4 ; (This is here for patching. -CSTACY) + + ; Got an index, now see if we're going to do a LISTEN + ; or an active open. +TCPO4: SETZ W, ; Assume active + CAME C,[-1] ; Verify local port is OK + CAIG C,177777 + CAIA + JRST OPNL11 ; Complain "illegal file name" + CAMN D,[-1] + AOJA W,.+3 + CAILE D,177777 + JRST OPNL11 + CAMN E,[-1] + ADDI W,2 + ; W = 0 if no wildcards, =1 if port wild, =2 if host wild, =3 both. + MOVE B,CTLBTS(U) ; Get control bits for call + CAIE W, + TRO B,%NOLSN ; Set "Listen" bit if implied by args. +; Crock - if either is wild, ensure both are. + CAIE W, + SETOB D,E + + SETZ R, ; Say we have no buffer + TRNE B,%NOLSN ; Skip if not listening, doing active open. + JRST TCPO20 ; Listening, don't need buffer. + + ; No wild-cards, this is going to be an active open. We will need + ; a buffer to send the initial SYN, so let's get it now and get + ; all possible PCLSR'ing over with, before turning off the NET PI. + CALL PKTGFI ; Get a free packet, skip unless fail. + CAIA ; Didn't get, skip to schedule. + JRST TCPO15 ; Got it! + SKIPA + SKIPA ; Force a schedule + CALL UFLS + CALL PKTGFI ; Try again. If we fail again, net is full, + JRST OPNL6 ; so better just return "device full" err. +TCPO15: MOVEI R,(A) ; We have buffer! Fall through. + TRCPKT R,"TCPO15 Alloc to send initial SYN" + + ; Okay, nothing can stop us now from running through to completion. + ; We do all the following code with net interrupts OFF so that + ; (a) We can scan all TCBs for port/host conflicts and be + ; sure we checked everything right, + ; (b) Incoming segments at int level won't be confused by + ; an inconsistent state for this TCB. + ; (c) We can check the pending-RFC queue safely. +TCPO20: CONO PI,NETOFF ; Don't let PI level see dirty work. + CAMN C,[-1] + JRST [ CALL TCPPCR ; Assign unique TCP port # + ROT D,-16. ; Put fgn port in high 16 bits + DPB A,[.BP TH%DST,D] ; Deposit local port + JRST TCPO30] ; Note that since port is unique, no + ; possible conflict with existing, so skip chk. + ; Also, low 4 bits indicate wildness if set. + + ; Note that low 4 bits of XBPORT are set to indicate wildness. + ; This ensures that TCPIS won't find them, but TSISQ will. + ; Have specific local port, check to make sure it doesn't already + ; exist in TCB tables. + ROT D,-16. ; Get fgn port in high 16 bits + DPB C,[.BP TH%DST,D] ; Put together the ports word + MOVSI T,-XBL +TCPO22: CAMN D,XBPORT(T) ; Look for matching port set + SKIPN XBSTAT(T) ; which is in use + AOBJN T,TCPO22 + JUMPL T,TCPO91 ; Ugh, found match! Must fail... + + ; OK, D has our unique port set, and we're ready to set things up. +TCPO30: MOVEM D,XBPORT(I) ; Store port set + SKIPL A,E + CALL CVH3NA ; Make sure it's HOSTS3 format. + MOVEM A,XBHOST(I) ; Store foreign host + CALL IPBSLA ; Call IP for best local address + MOVEM A,XBLCL(I) + CALL TXBINI ; Initialize the TCB + CALL TCPMSS ; Set default MSS values. Reexamined when + ; foreign host known if this is a wild listen. + CALL TCPRWS ; Open a default receive window + HRRZM U,XBUSER(I) ; Make TCB/index in use + HLRZ A,J ; Get back saved rcv channel # + DPB A,[XB$ICH (I)] ; Deposit input channel + DPB J,[XB$OCH (I)] ; and output channel + MOVE B,[0101,,0] ; Increment both channel #'s by 1 + ADDM B,XBUSER(I) ; So can distinguish chan 0 from no chan. + HRLZ T,I ; Set up user's IOCHNM words + HRRI T,TCPDUI + ADDI A,IOCHNM(U) + MOVEM T,(A) ; Set up input chan ,,TCPDUI + HRRI T,TCPDUO + ADDI J,IOCHNM(U) + MOVEM T,(J) ; Set up output chan ,,TCPDUO + + ; Search pending-RFC queue to make sure we match up or reject + ; with stuff in there. + LDB B,[.BP TH%DST,XBPORT(I)] ; B gets local port # + SETO D, ; D is -1 for any PE ptr. + CALL TCPRQS ; Search queue, return index in A + JUMPL A,TCPO41 ; Ignore further RFC checks if nothing. + MOVEI C,(A) + HRRZ A,XBITQH(C) + CAIN A, + BUG HALT + HLRZ W,PK.IP(A) + HLRZ H,PK.TCP(A) + TRNE D,17 ; If we're "wild" accepting any request, + JRST TCPO35 ; Take it! + LDB B,[IP$SRC (W)] ; No, must try full match. + CAMN B,XBHOST(I) ; If hosts match + CAME D,TH$SRC(H) ; and ports match too + JRST TCPO40 ; (don't) + + ; Matching request!! + ; For now, we ignore the listen/active distinction here, and + ; always try to establish connection with the pending RFC. + ; So, can flush use of R for listen flag. Have to flush the + ; extra buffer if it was "active" open, though, since we can + ; just re-use the pending-RFC packet. +TCPO35: METER("TCP: Open matched pending RFC") + JUMPN R,TCPO36 + MOVEI Q,XBITQH(C) ; If don't already have buffer, + CALL PKQGF(PK.TCP) ; Get it from the queued SYN (C is idx to) + SKIPN R,A ; It had better have a buffer! + BUG HALT + TRCPKT R,"TCPO36 Queued SYN used to answer pending RFC rqst" +TCPO36: LDB B,[IP$SRC (W)] + MOVEM B,XBHOST(I) ; Set host address + LDB B,[IP$DST (W)] + MOVEM B,XBLCL(I) ; Use local address the other end wants + MOVE D,TH$SRC(H) + MOVEM D,XBPORT(I) ; And ports + CALL TCPMSS ; Find default segment sizes for connection + CALL TCPRWS ; Set up receive window + EXCH C,I ; C identifies slot of queued SYN. + CALL TSISQF ; Flush the SYN from queue! + MOVEI I,(C) + CALL TSILSX ; Invoke interrupt level SYN+ACK, re-uses + ; the packet and sets state and everything. + JRST TCPO80 ; OK, take win return. + + ; Request doesn't match, restore it and fall thru. +TCPO40: +; MOVEI Q,TCPRQH ; Thought we had something but didn't, +; CALL PKQPF(PK.TCP) ; so put back on queue. + + ; No matching request on pending-RFC queue. +TCPO41: CAIN R, ; Skip if handling active open + JRST [ MOVEI A,.XSLSN ; No, handling a listen. + JRST TCPO70] ; Just change state and we're done. + + ; Active open, must fire off initial SYN. + ; R has PE ptr to free packet to be used for the SYN. + CALL TCPISS ; Get initial sequence # + MOVEM A,XBSUNA(I) ; Set up sequence vars + MOVEM A,XBSNXT(I) + MOVSI T,(TC%SYN) ; Note no ACK in initial segment! + TRCPKT R,"TCPO41 Send initial SYN" + CALL TSOSSN ; Send SYN segment (clobber mucho ACs) + MOVEI A,.XSSYN ; Set state to SYN-SENT and fall thru. + +TCPO70: HRRM A,XBSTAT(I) ; Set state LISTEN or SYN-SENT. + CALL TCPUSI ; Change user state. +TCPO80: CONO PI,NETON + JRST LSWPJ1 ; Success return, unlock switch and skip. + + ; Port match failure, must back off and fail. +TCPO91: CONO PI,NETON ; No need to hide our shame + SKIPE A,R ; If we had a buffer, + CALL PKTRT ; return it to freelist. + JRST OPNL13 ; Say "file already exists". + +; TXBINI - Initialize TCB connection table entries for specific index. +; The things it doesn't touch are commented out below. +; I/ TCB index + +TXBINI: +; SETZM XBUSER(I) ; Set after +; SETZM XBSTAT(I) ; Set after + SETZM XBSTAU(I) + SETZM XBCLSU(I) +; SETZM XBPORT(I) ; Set prior +; SETZM XBHOST(I) ; Set prior +; SETZM XBLCL(I) + SETOM XBNADR(I) + + ; I/O vars + SKIPE XBITQH(I) + BUG CHECK,[TCP: Init TCB has input, I=],OCT,I,[list ],OCT,XBITQH(I) + SETZM XBITQH(I) + SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + + SKIPE XBOCOS(I) + BUG CHECK,[TCP: Init TCB has output, I=],OCT,I,[list ],OCT,XBOCOS(I) + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + + ; Retransmit stuff + SETZM XBORTP(I) + SKIPE XBORTQ(I) + BUG CHECK,[TCP: Init TCB has retrans, I=],OCT,I,[list ],OCT,XBORTQ(I) + SETZM XBORTQ(I) + SETZM XBORTL(I) + SETZM XBORTC(I) + SETZM XBORTT(I) + + ; TCP Send Sequence Initialization + SETZM XBSUNA(I) + SETZM XBSNXT(I) + SETZM XBSWND(I) + SETZM XBSAVW(I) + SETZM XBSUP(I) + SETZM XBSWL1(I) + SETZM XBSWL2(I) +; SETZM XBSMSS(I) ; Set after + + ; TCP Receive Sequence Initialization + SETZM XBRNXT(I) + SETZM XBRUP(I) +; SETZM XBRMSS(I) ; Set after +; SETZM XBRWND(I) ; Set after + RET + +; TCPPCR - Port Create. Creates a unique local port #. +; Returns # in A. Current algorithm is very simple/dumb. +; Must only be called at MP level with NETOFF. +; Clobbers T,Q + +TCPPCR: PUSH P,B + MOVEI A,(U) ; Get user index + IDIVI A,LUBLK ; Find job # + AOS B,TCPCRI ; Bump and get new counter + ROT B,-8. ; Put low bits into high + LSHC A,8. ; Then shift them into port # + CALL TCPPLU ; See if this port unique or not. + JRST [ AOS TCPCRI ; If not, AOS stuff and keep going. + AOJA A,.-1] + POP P,B + RET + +; TCPPLU - Port Lookup. Skips if port # unique among local ports. +; A/ port # +; Clobbers T, Q. +; Returns .+1 if fail (number not unique) +; T/ idx of matching TCB + +TCPPLU: LSH A,4 ; Shift over for easier compare + MOVSI T,-XBL +TCPLU2: SKIPN Q,XBPORT(T) + JRST TCPLU3 + AND Q,[TH%DST] + CAMN A,Q + JRST TCPLU7 +TCPLU3: AOBJN T,TCPLU2 + AOS (P) +TCPLU7: LSH A,-4 + RET + +; TCPMSS - Determine and set max bytes per segment for TCB in I +; I/ TCB index. XBHOST should be set already. +; Bashes A, T +; Base maximum TCP segment sizes on size of largest datagram IP wants +; to send to destination. This sets the default sizes. We will tell +; the foreign side what we want (XBRMSS) with a TCP MSS option in the +; outgoing SYN. We will adjust what we send (XBSMSS) down if foreign +; side requests it with MSS opton in an incoming SYN. + +TCPMSS: MOVE A,XBHOST(I) ; Foreign address + CALL IPMTU ; IP datagram size to T + SUBI T,40. + MOVEM T,XBSMSS(I) ; Set default send and receive segment sizes + MOVEM T,XBRMSS(I) + RET + + +SUBTTL Other TCP device system call routines + +; Device name in DEVTAB, device code in DCHSTB, index in RSTB to some tables + +; OPEN - from DEVADR + +TCPO: JRST OPNL12 ; Say "mode not avail" + ; Save rest temporarily. + HLRS C + MOVSI A,(A) ; Save RH of FN1 in LH of IOCHNM + JSP Q,OPSLC7 + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + +; CLOSE - from CLSTB +; R/ addr of IOCHNM word + +TCPCLS: METER("TCP: syscal close") + HLRZ I,(R) ; Get TCB index from LH of IOCHNM + CAIL I,XBL ; Make sure it's reasonable + BUG HALT,[TCP: CLS idx bad] + HRRZ A,XBUSER(I) ; Verify user + CAIE A,(U) + BUG HALT,[TCP: CLS usr bad] + SETO D, ; See if input or output + HRRZ A,(R) + CAIN A,TCPDUO ; Output? + AOSA D + CAIN A,TCPDUI ; Input? + ADDI D,1 + CAIGE D, ; D/ 0 for input, 1 for output. + BUG ; IOCHNM value screwed up?? + LDB A,[XB$ICH (I)] ; Get input chan # according to TCB + LDB B,[XB$OCH (I)] ; Ditto output + MOVEI C,(R) + SUBI C,IOCHNM(U) ; Find channel # we're closing + ADDI C,1 ; Increment since TCB # is really #+1 + CAME C,A(D) ; Compare with channel # in TCB + BUG HALT,[TCP: Close chan not same as TCB chan] + JUMPN D,[MOVEI D,2 + CAIE A, + MOVEI D,3 + JRST TCPC06] + CAIE B, + IORI D,1 +TCPC06: + ; D is now a 2-bit channel status index. + ; Bit 1.2 is 0 for input, 1 for output. + ; Bit 1.1 is 0 if other channel is closed, 1 if it is still open. + SKIPN XBSTAT(I) ; Perhaps already gone? + JRST TCPCL8 ; Yeah, flush channel etc. + PUSH P,D + CONO PI,NETOFF ; Ensure that state doesn't change on us. + HRRZ J,XBSTAT(I) + CAIL J,.XSTOT + BUG HALT,[TCP: CLS state bad] + XCT TCPCXT(J) ; Invoke closure stuff appropriate for state + CONO PI,NETON ; TCB state hacking done, can re-enable ints. + POP P,D + + ; Remove links between user channel and TCB. If both channels + ; are gone, XBUSER is cleared completely. + ; The TCB is not necessarily closed at this point (XBSTAT zero) + ; but TCP will look after it independently to ensure it eventually + ; goes away. +TCPCL8: SETZ B, ; Get a zero + MOVEI T,.XCUSR ; Use this for "Close reason" if needed + TRNE D,2 ; Remember D bit 1.2 indicates output chan + JRST [ DPB B,[XB$OCH (I)] ; Yup, clear output chan. + CALL TCPUCO ; Set close reason if necessary + HRRZ A,XBOCOS(I) ; Does a COS buffer exist? + CAIN A, + JRST TCPCL9 ; Nope, nothing to flush. + CALL PKTRTA ; Aha, free it up. + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST TCPCL9] + DPB B,[XB$ICH (I)] ; Clear input chan. + CALL TCPUCI ; Set close reason if need to. + CALL TXBIFL ; Flush input queue + +TCPCL9: TRNN D,1 ; Skip if other channel still there. + SETZM XBUSER(I) ; Else flush whole word incl user index! + TRNE D,1 ; If a channel is left, + CALL TCPUSI ; we may need to take interrupt on it. + LDB A,[XB$STY (I)] ; Was a STY connected to channel? + JUMPE A,CPOPJ ; Return if not. + MOVEI I,(A) ; Ugh, must disconnect it! Set up TTY # + CALL NSTYN0 ; Disconnect + JFCL + RET ; Return (CLOSE will clear IOCHNM/IOCHST) + +TCPCLE: BUG CHECK,[TCP: Illegal state in CLOSE, J=],OCT,J,[ D=],OCT,D + CALL TXBFLS ; Flush all of TCB but XBUSER + RET + +TCPCXT: OFFSET -. +.XSCLS:: CALL TXBFLS ; Closed already, but flush again to make sure +.XSSYQ:: CALL TCPCLE ; Syn-Queued - can't happen!! +.XSLSN:: CALL TXBFLS ; Listen - flush TCB, enter closed state. +.XSSYN:: CALL TXBFLS ; Syn-Sent - flush TCB, enter closed state. +.XSSYR:: XCT TCPCXT+.XSOPN ; Syn-Rcvd - handled same as OPEN below +.XSOPN:: XCT (D)[ ; Established (Open) + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC30 ; Out (only) - Send FIN, enter FIN-WAIT-1 + CALL TCPC30] ; Out (have In) - " " " " +.XSFN1:: XCT (D)[ ; Fin-Wait-1 + JFCL ; In (only) - Disconnect input + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSFN2:: XCT (D)[ ; Fin-Wait-2 + CALL TXBFLS ; In (only) - Flush, give up waiting + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSCLW:: XCT (D)[ ; Close-Wait + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC70 ; Out (only) - Send FIN, enter LAST-ACK + CALL TCPC70] ; Out (have In) - " " " " +.XSCLO:: XCT TCPCXT+.XSFN1 ; Closing - handled same as Fin-Wait-1 etc. +.XSCLA:: XCT TCPCXT+.XSFN1 ; Last-Ack - handled same as Fin-Wait-1 etc. +.XSTMW:: XCT TCPCXT+.XSFN1 ; Time-Wait - handled same as Fin-Wait-1 etc. +.XSTOT:: OFFSET 0 + + ; Closing output channel while in SYN-RCVD state. + ; Send a FIN and enter FIN-WAIT-1 state. +TCPC30: CALL TCPCLF + MOVEI J,.XSFN1 + JRST TCPC75 + + ; Closing output channel while in CLOSE-WAIT state. + ; Send a FIN and enter LAST-ACK state. +TCPC70: CALL TCPCLF + MOVEI J,.XSCLA +TCPC75: HRRM J,XBSTAT(I) + RET + +TCPCLF: MOVSI T,(TC%ACK+TC%FIN+%XBNOW) ; Tell TCP that output needs FIN and ACK. + JRST TCPOFR ; Go force out current buffer if any + +; TCPUC - Set "Reason-closed" states if not already set. +; T/ Reason to use, if none already exists. +; Clobbers Q +TCPUC: CALL TCPUCI +TCPUCO: HRRZ Q,XBCLSU(I) + CAIN Q, + HRRM T,XBCLSU(I) + RET +TCPUCI: HLRZ Q,XBCLSU(I) + CAIN Q, + HRLM T,XBCLSU(I) + RET + +; TXBFLS - Flush all info about a TCB from TCP viewpoint. +; Mostly consists of freeing up all buffers used, and then +; clearing out most other data cells of the TCB. +; Note that XBUSER and XBSTAU are not affected! +; TXBFLP - ditto but usable at PI level, it is careful not to smash +; things that MP level might be referencing. +; Clobbers A,T,Q +; TXBIFL - Flushes input queue +; TXBOFL - Flushes output queue (including retrans list!) + +TXBFLS: SETZM XBSTAT(I) + CALL TXBIFL + CALL TXBOFL + SETZM XBPORT(I) + SETZM XBHOST(I) + RET + +; TXBFLP - Things to be careful of: +; - swiping COS +; - flushing input queue (don't touch it) + +TXBFLP: CALL TXBOFL + SETZM XBSTAT(I) ; Say off-limits to PI level now. + SETZM XBPORT(I) + SETZM XBHOST(I) + LDB T,[XB$ICH (I)] ; See if input chan active + CAIN T, + CALL TXBIFL ; No input chan, so ensure input q flushed + CALL TCPUSI ; Alert user to mung + RET + +TXBIFL: SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + MOVEI Q,XBITQH(I) + CALL PKPFLS + SKIPE XBITQH(I) + BUG CHECK,[TCP: Incompl input fls I=],OCT,I,[list ],OCT,XBITQH(I) + CALL TCPRWS ; Reset receive window. + RET + +TXBOFL: HRRZ A,XBOCOS(I) ; If current output seg exists, + CAIE A, + SKIPGE XBSTAT(I) ; and isn't locked by MP level, + CAIA + JRST [CALL PKTRTA ; then free it + SETZM XBOCOS(I) ; and clear the pointer. + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST .+1] + SETZM XBORTT(I) + SETZM XBORTC(I) + MOVEI Q,XBORTQ(I) + CALL PKPFL ; Flush retrans list carefully. + SKIPE XBORTL(I) + BUG CHECK,[TCP: Incompl output fls, I=],OCT,I,[list ],OCT,XBORTQ(I) + MOVE A,XBSNXT(I) + MOVEM A,XBSUNA(I) ; Claim everything ACK'd. + SETZM XBSWND(I) ; Zero our send window. + SETZM XBSAVW(I) ; and available window + SETZM XBSUP(I) ; and urgent pointer. + RET + +PKPFLS: PUSH P,Q +PKPFL2: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CALL PKTRTA ; Should always be freeable. + JRST PKPFL2 + +; Ditto, but for flushing retransmit queue, which has to be special +; since packets are linked on IP output list as well as TCP list. +; Since we can't take packets off the IP output list here, we just set +; a flag telling output PI level to ignore the packet. + +PKPFL: PUSH P,Q +PKPFL3: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CONO PI,PIOFF + MOVE T,PK.FLG(A) ; Check packet flags + TLNN T,(%PKODN) ; Output done? + JRST [ TLO T,(%PKFLS) ; No, say to flush when hit it. + MOVEM T,PK.FLG(A) + CONO PI,PION + TRCPKT A,"PKPFL3 Packet not flushed" + JRST PKPFL4] + CONO PI,PION + CALL PKTRT +PKPFL4: SOSGE XBORTL(I) + BUG CHECK,[TCP: Retrans Q count err] + JRST PKPFL3 + +SUBTTL TCP Main Program Input + +; All TCP input segments for a connection are put on a queue that +; is headed at XBITQH. When this header is zero, there is no more +; input; if the %XBFIN flag is also set, the remote host has closed +; its transmit side and there will never be any more input. +; Segments are only added by PI level, at the end of the queue. +; Segments are only removed by MP level IOTs, at the start of the queue. +; (An incoming RST will of course flush the queue at PI level) + +; If XBIBP is non-zero, it points into the first segment on the input queue, +; and XBIBC is also valid; things are ready for MP IOTing. +; However, neither XBIBP nor XBIBC is meaningful if XBITQH is zero. + +; Input IOT - from IOTTB + SKIPA T,[SIOKT] ; Come here for SIOT entry +TCPI: MOVEI T,CHRKT + METER("TCP: syscal in") + HLRZ I,(R) ; Get TCB index + + ; Verify state, do misc setup for reading + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Can't IOT if direct-connected to STY. + JRST IOCR10 ; "Chan in illegal mode" + HLRZ B,XBSTAU(I) ; Just reading state, don't need NETOFF. + SKIPG TCPTBI(B) ; Ensure meta-state allows reading. + JRST [ HLRZ B,XBCLSU(I) ; Can't read, see if reason OK + CAIN B,.XCFRN ; Only OK reason is clean fgn close. + JRST UNIEOF ; Yeah, just return quietly. + JRST IOCR10] + + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + XBIBP(I) ; Byte pointer + XBIBC(I) ; # bytes to read + TCPIBG ; Routine to get next buffer + TCPIBD ; Routine to discard buffer + 0 ; not used + TRNA ; Negative - TCPIBG and TCPIBD will do waiting. + ] + CALL (T) + CAIA + AOS (P) + SKIPG XBIBC(I) ; If count for this buffer reached zero, + CALL TCPIBD ; Flush it so XBITQH is valid indication of input avail + RET + +; TCPIBD - Discard input buffer, invoked by I/O. +; This is always called before TCPIBG is. + +TCPIBD: SKIPN XBIBP(I) ; Make sure something's there to discard. + RET ; Nope, gone or was never set up. + MOVEI Q,XBITQH(I) ; Point to TCP input queue header + CALL PKQGF(PK.TCP) ; Get first thing off queue, into A + CAIN A, ; Something better be there. + BUG HALT,[TCP: IOTI queue lost] + + ; Check BP just out of sheer paranoia. + HRRZ T,XBIBP(I) ; Find addr BP points to (maybe +1 actual) + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + CAIL Q,(T) ; Header better be less than BP! + JRST TCPIB2 + TRZ Q,PKBSIZ-1 ; Get addr of start of buffer + CAILE T,PKBSIZ(Q) ; BP should be within or just past end. +TCPIB2: BUG HALT,[TCP: IOTI BP incons] + + ; Okay, end of paranoia, just flush the buffer. + LDB T,[PK$TDL (A)] ; Find # chars we read + MOVN T,T + ADDM T,XBINBS(I) ; Update # chars avail for input. + CALL PKTRT ; Return packet to freelist. + SOSGE T,XBINPS(I) ; Decrement count of segs on input queue + BUG CHECK,[TCP: Input Q count incons] + CAIL T,%TCPMI/2 ; If we are now handling past 50% input, + JRST [ MOVSI T,(TC%ACK) ; Make sure we send an ACK + IORM T,XBSTAT(I) ; so new rcv window is reported. + JRST .+1] + CONO PI,NETOFF + CALL TCPRWS ; Set new receive window + CALL TXBIST ; Get new input chan state + HRLM T,XBSTAU(I) ; Set it. Note interrupt is avoided here. + CONO PI,NETON + SETZM XBIBP(I) + SETZM XBIBC(I) + RET ; Always return with simple POPJ + +TCPRWS: MOVEI T,%TCPMI + SUB T,XBINPS(I) ; Find # segs we can still queue up + CAIGE T,1 ; If no full segs left, + TDZA T,T ; Zero the window, no more segs allowed + IMUL T,XBRMSS(I) ; Else will take N * MSS bytes +TCPRW3: MOVEM T,XBRWND(I) + RET + +IFN 0,[ + ; This code turns out to lose because the code at TCPIS only + ; checks XBRWND to see whether to compact input or not, and as + ; long as XBRWND is non-zero, stuff will always be added to queue, + ; using up all the packet buffers. + ; Basically it's a question of whether or not to allow more input, + ; up to limits of last queued buffer, if the queue has too many + ; buffers on it. Metering will show whether most other implementations + ; win or lose with our buffer-alloc type windowing. +TCPRW2: HLRZ Q,XBITQH(I) ; Find # chars room in last seg + LDB T,[PK$TDL (Q)] + LDB Q,[PK$TDO (Q)] + ADDI Q,(T) + MOVEI T,576. + SUBI T,(Q) + CAIGE T, + SETZ T, + MOVEM T,XBRWND(I) + RET +] + +; TCPIBG - Get new input buffer (invoked by I/O, after TCPIBD) +; Return .+1 if can't get new buffer, must wait (Never, we do waiting) +; Return .+2 if OK, new BP and count set up. +; Return .+3 if "EOF", transfer complete + +TCPIBG: SKIPE XBIBP(I) ; Shouldn't be anything already there. + BUG HALT,[TCP: IOTI buf incons] +TCPIB3: SKIPN A,XBITQH(I) ; See if anything in input queue + JRST TCPIB5 ; No, go handle EOF. + LDB T,[PK$TDL (A)] ; Find # bytes input for this segment + CAIN T, ; Something probably shd be there. + BUG HALT,[TCP: IOTI null seg] + MOVEM T,XBIBC(I) ; Store as new # bytes + LDB T,[PK$TDO (A)] ; Get offset from start of header + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + ROT T,-2 ; Divide offset by 4 + ADDI Q,(T) ; Point to right word + LSH T,-34. ; Right-justify the low 2 bits + HRL Q,(T)[441000 ? 341000 ? 241000 ? 141000] ; Get right LH for BP + MOVEM Q,XBIBP(I) ; Now store BP! + JRST POPJ1 ; Say ready to go again... + + ; No input available. First check to see if there will ever + ; be any more (FIN seen?), then whether to return right away or + ; hang. +TCPIB5: CONO PI,NETOFF ; Avoid timing inconsistencies + SKIPE A,XBITQH(I) ; Check again + JRST [ CONO PI,NETON ; Got some?? + JRST TCPIB3] ; Try again. + SKIPN XBINPS(I) ; No, should also have no segments + SKIPE XBINBS(I) ; and no bytes + BUG HALT,[TCP: IOTI count incons] + MOVE A,XBRWND(I) ; Save value of rcv window + CALL TCPRWS ; Then reset the window + CAME A,XBRWND(I) ; Was previous value correct? + METER("TCP: RCV.WND out of synch") + MOVE T,XBSTAT(I) ; Get flags + CONO PI,NETON + TLNE T,(%XBFIN) ; FIN seen, and input queue empty? + JRST TCPIB6 ; Yes, true EOF now. + + MOVE T,CTLBTS(U) ; See if call had "don't-hang" bit set + TRNE T,10 + JRST TCPIB7 ; No, return EOF. + SKIPN XBITQH(I) ; Wait until input queue has something. + CALL UFLS + JRST TCPIBG ; Then call again. + +TCPIB6: +TCPIB7: CALL TCPUSI ; Adjust user state. + JRST POPJ2 ; and return "EOF" + + +SUBTTL TCP Main Program Output + +; Output IOT - from IOTTB +; Output segments are chained together from XBORTQ, which is +; the "retransmit queue". +; The queue only contains segments which occupy sequence space, since +; these are the only ones which require ACKs and possible retransmit. +; All others are sent directly to the IP output queue. +; While the transmit connection is open, +; Segments are only added by MP level IOTs, at the end of the queue. +; Segments are only removed by PI level ACKs, at the start of the queue. + +; Main program I/O is done into the "Current Output Segment", which is NOT +; on the retransmit queue. There are three variables related to this COS. +; XBOCOS - ,, +; XBOBP - BP into the COS, for MP IOT writing. +; XBOBC - Count of # bytes left that MP IOT can deposit into. +; Note that the maximum possible size of the buffer is kept in PK$TDL +; (TCP segment Data Length). For windowing reasons it may be necessary +; to restrict the amount of space actually used, thus the initial value +; of XBOBC may be less than PK$TDL. This is why the initial value is also +; copied into the RH of XBOCOS, so that when XBOBC counts out we know +; exactly how much of the buffer was actually used. It is possible for +; XBOBC to be increased by interrupt level window processing, in order +; to increase utilization of the buffer. +; States: +; If XBOCOS is zero, XBOBP and XBOBC must also be zero; there is +; no COS. +; If XBOCOS is non-zero (a current output seg exists), then: +; if LH(XBOCOS) is zero, the segment hasn't yet been written +; into, and needs to be set up. +; XBOBP and XBOBC should be zero! +; else the segment is set up for writing. XBOBP should be set! +; If XBOBC is zero it means the segment now contains +; LH(XBOCOS) bytes of data. If this number is less +; than PK$TDL (max possible seg data) then the count +; may be reset to allow further output into this +; segment, or it may simply be sent as is. +; +; The current segment is put on the retransmit queue (and IP output queue) +; when: +; PI level (eg clock) decides it's time to send an ACK or do a FORCE. +; MP level IOT fills up the segment completely. +; MP level FORCE or CLOSE is invoked. +; The current segment is locked down during MP IOT, to keep PI level +; from ripping it away (which would leave entrails dangling). +; PCLSR'ing will clear this lock. If TCP flushes the TCB at PI level +; for some reason, XBOCOS will be freed unless locked. XBOBC and XBOBP +; will still be cleared even if locked, so as to cause a call to TCPOBW +; which will notice the condition and free the COS itself. + + SKIPA A,[SIOKT] ; Come here for SIOT entry +TCPW: MOVEI A,CHRKT + METER("TCP: syscal out") + HLRZ I,(R) ; Get TCB index from IOCHNM wd + + ; Verify state, do misc setup for writing, lock segment. + CONO PI,NETOFF + HRRZ B,XBSTAU(I) ; Get output chan state + SKIPG TCPTBO(B) ; See if meta-state allows writing + JRST IOCR10 ; Can't, say "chan not open" (ugh) + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Also can't if direct-connected to STY. + JRST IOCR10 + MOVSI B,(%XBMPL) ; Set locked flag (must be sign bit!) + IORM B,XBSTAT(I) + CONO PI,NETON ; Okay, we've got it. + CALL SGNSET ; Set PCLSR routine to unlock flag. + XBSTAT(I) + SKIPN XBOCOS(I) ; If no COS there, + SETZM XBOBC(I) ; make SURE count is zapped so refill invoked. + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + SETZ XBOBP(I) ; Output BP found here (sign sez is output) + XBOBC(I) ; # bytes of room remaining + TCPOBG ; Routine to get another buffer (not used) + TCPOBW ; Buffer full, routine to send it. + 0 ; Not used + TRNA] ; Negative - TCPOBG and TCPOBW will do waiting. + CALL (A) + CAIA + AOS (P) ; Pass on a skip return. + + ; User IOT is done, now unlock the segment. + ; We also check for wanting to do an immediate ACK and if needed + ; ship out the current buffer right now, without waiting + ; for the 1/2-sec clock to do it. + SKIPN A,XBSTAT(I) ; See if XBSTAT is still set + JRST IOCR10 ; No, take IOC error return! + CAIL A, ; It better still be locked! + BUG CHECK,[TCP: Output not locked] + CALL LSWPOP ; Clear the lock flag + TLNN A,(%XBNOW) ; Was "immediate-send" flag set? + RET ; Nope, can just return. + METER("TCP: TCPW exit force") + CONO PI,NETOFF + MOVSI T,(TC%PSH) ; Hmm, set up and shove out. + CALL TCPOFR ; and force out current output segment. + CONO PI,NETON + RET + +TCPOBG: BUG CHECK,[TCP: IOT called wrong rtn (TCPOBG)] + AOS (P) ; If proceeded, can still win. Make skip return + ; and drop through to TCPOBW. + +; TCPOBW - Write/Get output buffer, invoked by SIOKT/CHRKT when the +; buffer count (XBOBC) is zero. This routine can figure out +; whether it needs to ship out a full buffer, or get a new +; output buffer, or both. Always returns with XBOBP and +; XBOBC set up for additional output (otherwise it hangs and +; can be PCLSR'd) + +TCPOBW: SKIPE R,XBOCOS(I) ; Get PE ptr to COS + JRST [ HLRZ A,R ; Got a COS, see if already set up + JUMPN A,TCPOB5 ; Jump if so. + JRST TCPOB2] ; Else must set it up. + + ; No current segment, must get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + JRST IOCR10 ; Blooie, say "Chan not open". + CALL PKTGF ; Get one, hang until we succeed. + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOBW Alloc for IOT output buffer" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOB2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Hang until we have less than this. + CALL UFLS ; Note that conn closure will unhang too, + ; because it flushes output queue. + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOB4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + JRST IOCR10] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for PCLSRing. + CALL TCPOB9 ; Check available window + JRST [ CONO PI,NETON ; Window too small, allow ints + CALL TCPOB9 + CALL UFLS + JRST TCPOB4] ; Big enough, go back and re-try stuff. + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + RET ; Okay, all set up, return. + +TCPOB9: MOVE A,XBSWND(T) + LSH A,-2 ; Get 25% offered window + CAML A,XBSAVW(T) ; If 25% offered > avail window, + RET ; punt and wait for better stuff. + JRST POPJ1 + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOB5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOB6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOB6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + RET ; And return happily. + +TCPOB6: TRCPKT R,"TCPOB6 IOT Send" + CALL TCPOB7 + JRST TCPOBW + +TCPOB7: DPB T,[PK$TDL (R)] ; Okay, say this many bytes of data are in seg + PUSH P,B + PUSH P,C + PUSH P,E + MOVSI T,(TC%PSH) ; Ensure seg is pushed out. + IORM T,XBSTAT(I) + CALL TSOSND ; Send data segment (# bytes in PK.TCI) + ; This clobbers a lot of ACs! + SETZM XBOCOS(I) ; No current output segment now. + CONO PI,NETON + SETZM XBOBP(I) + SETZM XBOBC(I) + POP P,E + POP P,C + POP P,B + RET + +; TCPOFR - Force out partially-filled current output segment +; Must have NETOFF. +; Called by FORCE and CLOSE at MP level +; by TCPCLK at PI clock level +; Note that we try to never have stuff in the COS which would +; over-run our send window, by hanging in MP IOT. This will +; be slightly screwed up if the receiver suddenly decreases the window +; size, since this routine always sends the whole thing anyway, +; but it's probably OK (helps avoid SWS) +; I/ TCB index +; T/ additional flags to use (PUSH, URG, FIN) +; Clobbers R and everything that TSOSND does (a lot!) + +TCPOFR: MOVE A,XBSTAT(I) ; Get flags for connection + TLNE A,(%XBCTL) ; Wants anything added on? + IOR T,A ; Yes, OR the bits in. + JUMPL A,TCPOF6 ; If locked at MP level, don't send it! + SKIPN R,XBOCOS(I) ; See if current output seg exists + JRST TCPOF5 ; No, can't hack now. + HLRZ TT,R ; Get # bytes of original buffer size + JUMPE TT,TCPOF5 ; If none, nothing to hack. + SUB TT,XBOBC(I) ; Subtract # left, to get # bytes data + CAIG TT, + JRST [ SETZ TT, ; No data, see if a flag wants to be sent. + TLNN T,(TC%FIN+TC%ACK+TC%SYN) ; Any of these are impt. + JRST TCPOF9 ; Nope, do nothing. + JRST .+1] + DPB TT,[PK$TDL (R)] ; Store back # bytes of real data + AND T,[TH%CTL] ; Mask off the flags + IORM T,XBSTAT(I) ; Stuff in as requests + TRCPKT R,"TCPOFR Force send" + CALL TSOSND ; Send out the stuff + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) +TCPOF9: RET + + ; No current output segment, so no data to send. Check, though, + ; to see if any flags need sending. +TCPOF5: TLNN T,(TC%SYN+TC%ACK+TC%FIN) + RET ; Nope, just return. + MOVE E,T ; They do! Save em against smashage + CALL PKTGFI ; Try to get a buffer (clobbers T,Q) + JRST TCPOF6 ; Ugh, failed, see about setting flags. + MOVEI R,(A) + TRCPKT R,"TCPOF5 Alloc and send flags only in TCPOFR" + MOVE T,E ; Restore flags + CALL TSOSNR ; Set up the packet and send it! + RET + + ; Can't get packet now, so set up the request flags for later hacking. + ; Also comes here when current output seg is locked at MP level. +TCPOF6: AND T,[%XBCTL] ; Clear out extraneous bits + TLO T,(%XBNOW) ; Ask to send stuff immediately + IORM T,XBSTAT(I) ; and set flags back. + RET + +; TCPOSB - Routine similar to TCPOBW, except that it doesn't hang, +; so that it is suitable for calling at PI level (by STYNTC esp) +; Returns .+1 if can't set up output buffer for writing. +; Returns .+2 if output buff is all set up, with non-zero XBOBC. + +TCPOSB: SKIPE R,XBOCOS(I) + JRST [ HLRZ A,R ; Have COS, see if already set up + JUMPN A,TCPOS5 ; Jump if so. + JRST TCPOS2] ; Else just set it up. + + ; No current segment, get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + RET ; Blooie. + CALL PKTGFI ; Get one, skip if successful + RET ; Sigh... + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOSB Alloc for STYNET output data" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOS2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Fail if we have more than this. + RET + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOS4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + RET] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for testing (no PCLSR) + CALL TCPOB9 ; Check available window + JRST NETONJ ; Window too small, just return + + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + AOS (P) + RET ; Okay, all set up, return. + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOS5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOS6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOS6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + AOS (P) + RET ; And return happily. + +TCPOS6: TRCPKT R,"TCPOS6 STYNET Send" + CALL TCPOB7 + JRST TCPOSB + +TCPBI: +TCPBO: RET ; No-ops, labels left in case want to use. + +; STATUS - from LH(DTSTB) +; Must return status in LH(D). Must not smash C,R. +; R/ addr of IOCHNM word + +TCPSTA: HLRZ I,(R) ; Get TCB index + SKIPN XBUSER(I) ; Probably an error if this is zero. + BUG CHECK,[TCP: STATUS on unused conn ],OCT,I + SETZ D, + SKIPN XBSTAT(I) + RET + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + SKIPA T,[TXBIST] + MOVEI T,TXBOST + CALL (T) + DPB T,[140600,,D] + RET + + +TXBIST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBI(T) ; Get conversion + JRST [ SKIPN XBITQH(I) ; Must test for input avail - any segs? + SKIPA T,(T) ; None avail, use standard + MOVE T,1(T) ; Have some waiting, use alternate state + RET] + RET +XBCTBI: OFFSET -. +.XSCLS:: SETZ [%NTCLS ? %NTCLI] ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTINP] ; 5/11 Established (open) +.XSFN1:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-1 +.XSFN2:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTCLU ? %NTCLI] ; 3/10 Close-Wait +.XSCLO:: SETZ [%NTCLS ? %NTCLI] ; 7/10 Closing +.XSCLA:: SETZ [%NTCLS ? %NTCLI] ; 7 Last-Ack +.XSTMW:: SETZ [%NTCLS ? %NTCLI] ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + +TXBOST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBO(T) ; Get conversion + JRST [ SKIPN XBORTQ(I) ; Must test for output queued + SKIPA T,(T) ; None, use standard + MOVE T,1(T) ; Have some output waiting, use alternate state + RET] + RET +XBCTBO: OFFSET -. +.XSCLS:: %NTCLS ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Established (open) +.XSFN1:: %NTCLX ; 7 Fin-Wait-1 +.XSFN2:: %NTCLX ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Close-Wait +.XSCLO:: %NTCLX ; 7 Closing +.XSCLA:: %NTCLX ; 7 Last-Ack +.XSTMW:: %NTCLX ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + + +; WHYINT - from RH(DTSTB) +; Results are: +; A/ %WYTCP +; B/ +; C/ input - # bytes in input buff +; output - # bytes of room avail in output buff +; D/ Close reason (only valid if state %NTCLS) + +TCPWHY: HLRZ I,(R) ; Get TCB index + METER("TCP: syscal whyint") + CAIL I,XBL + BUG HALT,[TCP: WHY idx bad] + CALL TCPSTA + LDB B,[140600,,D] ; Get state for channel + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + JRST [ HLRZ D,XBCLSU(I) ; Get input close reason + MOVSI C,(XB%STY) + TDNE C,XBUSER(I) ; No input avail if direct-conn to STY + JRST [ SETZ C, ? JRST TCPWH5] + SKIPLE C,XBINBS(I) + JRST TCPWH5 + SKIPN C,XBITQH(I) + JRST TCPWH5 + LDB C,[PK$TDL (C)] + JRST TCPWH5] + HRRZ D,XBCLSU(I) ; Get output close reason + SKIPN C,XBOBC(I) ; Get # bytes of room left in current pkt + JRST [ MOVEI C,%TCPMO ; If none, return total queue space instead + SUB C,XBORTL(I) + IMUL C,XBSMSS(I) + CAIG C, + SETZ C, + JRST .+1] +TCPWH5: MOVEI A,%WYTCP + JRST POPJ1 + + + +; RFNAME - from LH(DRFNTB) +; A/ LH of IOCHNM word for channel. + +TCPRCH: MOVEI I,(A) + LDB B,[.BP TH%DST,XBPORT(I)] + LDB C,[.BP TH%SRC,XBPORT(I)] + MOVE D,XBHOST(I) + MOVEI W,4 + POPJ P, + +; RFPNTR - from RH(DRFNTB) +TCPRFP: JRST OPNL34 + +; IOPUSH/POP - from LH(RSTBI) +TCPIOP: HRRZ T,R + SUBI T,IOCHNM(U) + CAIN I, + SKIPA T,[77] ; IOPUSH, use 77 + ADDI T,1 ; IOPOP, use chan+1 + HLRZ I,(R) ; Get TCB index + HRRZ B,(R) ; Get direction + CAIN B,TCPDUI ; as a BP to chan # + SKIPA B,[XB$ICH (I)] + MOVE B,[XB$OCH (I)] + DPB T,B ; Store new saved channel # + POPJ P, + +; RESET - from RH(RSTBI) +; This doesn't have to do anything for a while yet. +TCPRST: + POPJ P, + +; FORCE - from LH(DFRCTB) +; Should force out the TCP segment currently being written, +; and give it a good shove (ie PUSH). +; A/ LH of IOCHNM word, in RH. +; H/ IOCHNM word +; R/ ,, +TCPFRC: METER("TCP: syscal force") + HRRZ B,(R) ; This should be a TCP output channel. + CAIE B,TCPDUO ; If not output, must be input, so + JRST OPNL2 ; say "wrong direction". + HLRZ I,(R) ; Get TCB index + CAIL I,XBL ; Ensure validity + BUG HALT,[TCP: FRC bad idx] + + ; Ensure that state allows sending anything. + CONO PI,NETOFF ; So state doesn't change while we think. + HRRZ J,XBSTAT(I) + CAIE J,.XSOPN + CAIN J,.XSCLW + CAIA + JRST OPNL7 ; Bad state, say "device not ready". + + PUSH P,R + MOVSI T,(TC%PSH) ; Set PUSH flag (but not ACK, to avoid + ; forcing send of empty buffer) + CALL TCPOFR ; Force out! Clobber many ACs. + CONO PI,NETON + POP P,R + JRST POPJ1 + + +; FINISH - from RH(DFRCTB) +; We already know that R is OK since FORCE looked at it first. +; In fact, I is still set up. +; R/ addr of IOCHNM word + +TCPFIN: METER("TCP: syscal finish") + MOVSI T,(%XBNOW) + TDNE T,XBSTAT(I) ; Wait until this bit is off (XBOCOS put on Q) + CALL UFLS + SKIPE XBORTQ(I) ; Hang until retransmit queue is empty. + CALL UFLS + JRST POPJ1 + +SUBTTL TCP STY connection routines + +; STYTCP - invoked by STYNTC routine during 1/2 sec clock, for +; STYs connected to TCP channels. +; R/ TTY # + +STYTCP: MOVE I,STYNTI-NFSTTY(R) ; Get TCB index for connection + LDB TT,[XB$STY (I)] ; Verify that TCB thinks we're hooked up + CAIE TT,(R) + BUG ; It doesn't?? + + ; First, check for and transfer any input for the STY. + HLRZ T,XBSTAU(I) ; Get input state + SKIPG TCPTBI(T) ; Make sure we can do input. + JRST STYTC9 ; Nope, must disconnect. +STYTC1: SOSGE XBIBC(I) + JRST [ CALL TCPIBD ; Discard input buffer if any + HRRZ A,XBITQH(I) ; Any more input avail? + JUMPE A,STYTC5 ; No, done, check for output. + CALL TCPIBG ; Have some! Set it up. Shd never hang. + JFCL + JRST STYTC1] + ILDB A,XBIBP(I) ; Get the byte + TRNE A,200 ; Special char? + JRST [ AOS XBIBC(I) ; Ugh, must back up and get user's attention + MOVSI B,8._14 ; Back up both count and 8-bit byte pointer + ADDM B,XBIBP(I) ; by adding to P field of BP + JRST STYTC9] ; Go disconnect. + EXCH R,I ; I gets TTY #, R gets TCB index + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + CALL NTYI5 ; Give the char to TTY input interrupt level + CONO PI,TTYON + POP P,R ; Note reverse order, so R gets TTY # + POP P,I ; and I gets TCB index again. + JRST STYTC1 ; Try for more input. + + ; Transfer chars from STY output to TCP connection +STYTC5: SKIPGE TTYOAC(R) ; Do we have any output? + JRST STYTC7 ; No, all's done, force out what we did. + HRRZ A,XBSTAU(I) ; Check output state + SKIPG TCPTBO(A) ; to verify that TCB is healthy. + JRST STYTC9 ; Ugh, go disconnect STY. + MOVSI A,(%XBMPL) + IORM A,XBSTAT(I) ; Lock COS against PI level snarfing + + SKIPE XBOCOS(I) + SKIPG E,XBOBC(I) ; Get # bytes room in output buff + JRST [ + ; Set up buffer, etc, possibly forcing out existing buff. + PUSH P,R + CALL TCPOSB ; Invoke special hang-less routine. + JRST [POP P,R ; If can't get any more room, jump to STYTC6 + JRST STYTC6] + POP P,R + SKIPG E,XBOBC(I) ; OK, should have bytes now. + BUG + JRST .+1] + SKIPN D,XBOBP(I) ; Get BP into buffer + BUG + EXCH R,I + CONO PI,TTYOFF + MOVEM D,DBBBP ; Set up buffer for TTY output interrupt level + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ; Generate output + SETZM TYPNTF + POP P,R + EXCH R,I ; Restore I/ TCB #, R/ TTY # + MOVE D,DBBBP ; Advance pointers + MOVEM D,XBOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ; Minus # chars output generated + CONO PI,TTYON + ADDM E,XBOBC(I) + JRST STYTC5 ; Check for more output + + ; No more output or we can't get more room, force out what + ; we've currently got. +STYTC6: CALL TCPUII ; Reactivate STY (expensive crock, but...) +STYTC7: MOVSI A,(%XBMPL) ; Unlock the COS + ANDCAM A,XBSTAT(I) + MOVSI T,(TC%PSH) ; PUSH this stuff + CALL TCPOFR ; Force out buffer + JRST STYNT8 ; Then go check other STYs. + + + ; Disconnect STY and get user's attention. Note this may be + ; buggy in that STY output has not yet been transferred to the + ; net by the time we get here, if we're here due to a 200 char. +STYTC9: PUSH P,I + MOVEI I,(R) ; Set up I/ TTY # + CALL NSTYN0 ; Disconnect it + BUG + POP P,I + CALL TCPUII ; Wake up the user program + JRST STYNT8 ; Go handle other STYs. + +IFN 0,[ +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS +] ;ifn 0 + +SUBTTL Other TCP system call functions + +; TCPRQ - Handle .CALL NETRFC, return port # of next pending +; request for connection (SYN). +; Perhaps return a uniquizer in LH, so know when see +; the same request again? + +TCPRQ: TRNE C,%NQREF ; Skip if just getting, not flushing. + JRST TCPRQ5 + METER("TCP: syscal netrfc get") + CONO PI,NETOFF ; In case a RST comes for it or something. +; MOVE I,TCPRQL ; Get last thing stored on queue + SETOB B,D ; Look for any match + CALL TCPRQS ; Search the queue... + JUMPL A,OPNL4 ; None, say "file not found". + MOVEI I,(A) + LDB A,[.BP TH%DST,XBPORT(I)] ; Get local port # for the SYN + HRLI A,(I) ; And put index in LH as uniquizer. + CONO PI,NETON + JRST POPJ1 + +TCPRQ2: BUG CHECK,[TCP: Pending SYN smashed!] + RET + + ; Refuse indicated connection. +TCPRQ5: METER("TCP: syscal netrfc ref") + CAIGE W,2 ; Must have 2 args + JRST OPNL30 ; "Too few args" + HLRE D,A ; Get identifier + HRRE B,A + CONO PI,NETOFF + CALL TCPRQS ; Search for the queued SYN + JUMPL A,OPNL4 + + ; Now must refuse connection. + MOVEI I,(A) + MOVEI Q,XBITQH(I) + CALL PKQGF(PK.TCP) ; Get queued SYN segment + SKIPN XBITQH(I) ; Should have been only one + SKIPG R,A ; and should have been one! + BUG HALT + CALL TXBFLS ; Flush the TCB. + SOSGE TCPRQN ; Decrement count of queued SYNs + BUG HALT + HLRZ W,PK.IP(R) ; Move all this setup somewhere modular. + HLRZ H,PK.TCP(R) + LDB TT,[PK$TDL (R)] + MOVE E,TH$CTL(H) + TLNE E,(TC%SYN) + ADDI TT,1 + TLNE E,(TC%FIN) + ADDI TT,1 + CALL TSISLR ; Respond to this req with RST+ACK + CONO PI,NETON + JRST POPJ1 + +; TCPRQS - Search pending-RFC queue. Must be called with NETOFF!! +; B/ local port # (-1 for any) +; D/ Index #, -1 for any (searches back from last one stored) +; Clobbers T,Q +; Returns +; A/ Index to matching SYN (-1 if no match) + +TCPRQS: JUMPGE D,TCPRQ7 + MOVE A,TCPRQL + MOVEI C,1 +TCPRQ6: HRRZ T,XBSTAT(A) ; See if right state + CAIN T,.XSSYQ + JRST [ LDB T,[.BP TH%DST,XBPORT(A)] + CAIL B, + CAMN T,B + RET + JRST .+1] + SOJGE A,TCPRQ6 + MOVEI A,XBL-1 + SOJGE C,TCPRQ6 +TCPRQ9: SETO A, + RET + +TCPRQ7: SKIPL A,D + CAIL D,XBL + JRST TCPRQ9 + HRRZ T,XBSTAT(A) ; Verify state + CAIE T,.XSSYQ + JRST TCPRQ9 + LDB T,[.BP TH%DST,XBPORT(A)] ; Got one! Get local port # + CAIL B, + CAIN T,(B) ; Must match given arg unless -1 + RET ; Won! + JRST TCPRQ9 + +ifn 0,[ +TCPRQS: MOVEI A,TCPRQH-PK.TCP +TCPRQ6: MOVEI Q,(A) ; Save ptr to prev node + HRRZ A,PK.TCP(A) ; Get ptr to next PE + JUMPE A,TCPRQ8 ; If not there, return 0 as error. + JUMPL D,TCPRQ7 + CAIE A,(D) ; See if identifier matches + JRST TCPRQ6 ; Jump if not. +TCPRQ7: HLRZ T,PK.TCP(A) ; Yes, verify port number + CAIN T, ; Ensure ptr to TCP header exists. + BUG HALT + LDB T,[TH$DST (T)] + CAIE T,(B) + JRST TCPRQ6 ; Nope, get next thing. + + ; Found it! Take off list, a bit tricky. + SOSGE TCPRQN ; Decrement count of entries + BUG HALT + MOVSI T,(%PQFL2) ; Clear the on-list flag for PK.TCP + ANDCAM T,PK.FLG(A) +IFN 2-PK.TCP,.ERR TCPRQS must fix %PQFL2 to match PK.TCP + HRRZ T,PK.TCP(A) ; Get its next-ptr + HRRM T,PK.TCP(Q) ; Store in node previous to this one. + JUMPN T,TCPRQ8 ; If wasn't last thing, all's well. + CAIN Q,TCPRQH-PK.TCP ; Last thing. If prev was actually hdr, + SETZ Q, ; must store zero. + HRLM Q,TCPRQH ; Set new "last" ptr in hdr. +TCPRQ8: + RET + +] ;ifn 0 + +; TSOINI - set up a raw PE for use as a TCP output segment. Means +; setting IP, TCP header pointers properly, so that all fields +; are contiguous. Note that PK.TCI is set to indicate XBSMSS(I) +; bytes of (available) data storage! +; Sets up PK.IP, PK.TCP, and PK.TCI. +; R/ PE ptr +; I/ TCB connection index (val put into PK.TCI) +; Returns with R, W, H pointing to PE, IP hdr, and TCP hdr. +; +; TSOINA - Ditto, but takes arg in A and only clobbers T (doesn't set W, H) + + +TSOINI: HRRZ W,PK.BUF(R) ; Get addr of buffer + HRLM W,PK.IP(R) ; Store as IP header addr + MOVEI H,(I) ; Set up TCI with all fields. + ANDI H,PK%TCB + IOR H,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM H,PK.TCI(R) ; + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + MOVEI H,%TCPHL(W) ; For now, this will do. + HRLM H,PK.TCP(R) ; Store as TCP header addr + RET + +TSOINA: HRRZ T,PK.BUF(A) ; Get addr of buffer + HRLM T,PK.IP(A) ; Store as IP header addr + ADDI T,%TCPHL ; For now, this will do to get TCP hdr. + HRLM T,PK.TCP(A) ; Store as TCP header addr + MOVEI T,(I) ; Set up TCI with all fields. + ANDI T,PK%TCB + IOR T,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM T,PK.TCI(A) ; Set up index and header length fields + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + RET + +; TCPUSI - TCP User State-change Interrupt. Called each time connection +; changes state (.XSnnn) or I/O queues start/end. Always tries +; to interrupt user, except for change %NTWRT->%NTOPN on output +; and %NTINP->%NTOPN on input. +; Moon: Interrupt when input rcvd and buff empty, or output full +; and becomes reasonably non-full. +; Clobbers T, Q + +TCPUSI: METER("TCP: tcpusi called") + CALL TXBIST ; Check input state + HLRZ Q,XBSTAU(I) + CAIE T,(Q) ; New state? + JRST TCPUS3 ; Yes, go handle. +TCPUS2: CALL TXBOST + HRRZ Q,XBSTAU(I) + CAIN T,(Q) + RET + + ; Output channel state change + ; Q/ old state, T/ new state (%NT values, not .XS) + HRRM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTOPN ; If was open + CAIE T,%NTWRT ; Changing to buff-full + CAIA + RET ; Then don't interrupt. + MOVE Q,TCPTBO(Q) + CAMN Q,TCPTBO(T) ; See if meta-state change + RET ; Nope, ignore. + LDB Q,[XB$OCH (I)] ; Yes, get channel # + METER("TCP: User O ints") + CALRET TCPUS5 + + ; Input channel state change +TCPUS3: HRLM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTINP ; If was input avail + CAIE T,%NTOPN ; Changing to plain open + CAIA + JRST TCPUS2 ; Then don't interrupt. + MOVE Q,TCPTBI(Q) + CAMN Q,TCPTBI(T) ; See if meta-state change + JRST TCPUS2 ; No + ; Drop thru to interrupt + + ; Give input channel interrupt +TCPUII: METER("TCP: User I ints") + LDB Q,[XB$STY (I)] ; See if hooked to STY + JUMPN Q,TCPUSS ; Jump to handle STY stuff if so. + LDB Q,[XB$ICH (I)] ; No, just get input chan + CALL TCPUS5 + JRST TCPUS2 + + ; Give interrupt to STY that TCB is connected to. + ; Q/ TTY # +TCPUSS: CONO PI,PIOFF ; Protect list hacking + SKIPL STYNTL-NFSTTY(Q) ; Don't put on list twice + JRST PIONJ + MOVE T,STYNTA ; Add to list + MOVEM T,STYNTL-NFSTTY(Q) + MOVEM Q,STYNTA + JRST PIONJ + + ; Interrupt on channel in Q. +TCPUS5: JUMPE Q,CPOPJ ; May be no channel there. + PUSH P,U + SKIPN U,XBUSER(I) + BUG HALT ; Jumpe above should catch this. + MOVSI T,(SETZ) + IORM T,PIRQC(U) + CAIN Q,77 ; If IOPUSH'ed, no interrupt. + JRST POPUJ + MOVE T,CHNBIT-1(Q) ; Q is -1 based. + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + ; Input chan state type. Pos # means can read. + ; 0 is pre-open, 1 is open, 2 is input avail, -1 is post-open. +TCPTBI: OFFSET -. +%NTCLS:: 0 ; 0 CLS +%NTLSN:: 0 ; 1 LSN +%NTSYR:: 0 ; 2 RFC +%NTCLU:: -1 ; 3 RCL? +%NTSYN:: 0 ; 4 RFS +%NTOPN:: 1 ; 5 OPN +%NTWRT:: 1 ; 6 RFN +%NTCLX:: -1 ; 7 CLW +%NTCLI:: 1 ; 10 CLI +%NTINP:: 2 ; 11 INP + OFFSET 0 + + ; Output chan state type. Pos # means can write. + ; 0 is pre-open, 1 is open, 2 is buff full, -1 is post-open. +TCPTBO: OFFSET -. +%NTCLS:: 0 +%NTLSN:: 0 +%NTSYR:: 0 +%NTCLU:: 1 +%NTSYN:: 0 +%NTOPN:: 1 +%NTWRT:: 2 +%NTCLX:: -1 +%NTCLI:: 1 +%NTINP:: 1 + OFFSET 0 + + +SUBTTL TCP Input Interrupt Level + +; TCPIS - Process TCP Input Segment (PI level) +; R/ PE ptr to packet, not on any list. +; PK.BUF is set, ditto IP/TCP header pointers. +; W/ addr of IP header +; H/ addr of IP data (start of TCP header) +; J/ host-table index for address datagram received from. +; Can clobber all ACs except P, returns with POPJ. +; AC usage during incoming segment processing: +; R/ PE ptr to packet +; W/ addr of IP header +; H/ addr of TCP header +; I/ TCB index (if any) +; J/ TCB connection state +; TT/ # bytes of TCP data in segment +; E/ ,, +; D/ Segment Sequence no. +; Flags for RH of E +%TSISL==1 ; Seq starts to left of rcv.nxt +%TSISR==2 ; Seq starts to right of " ; if neither on, is = rcv.nxt +%TSIFL==4 ; Bad seq, flush after handling RST/ACK/URG + +TCPIS: METER("TCP: Segs rcvd") + SKIPN TCPUP ; Unless TCP claims to be up, + JRST TSIFL ; Throw it away, no TCP yet, sigh. + + ; First verify that this is a valid TCP segment, by + ; checksumming it (sigh!). TT gets total # bytes in TCP segment. + CALL THCKSI ; Get checksum in A for segment + LDB B,[TH$CKS (H)] ; Get segment's checksum + CAME A,B ; Should match. + JRST TSIF01 ; Failed, go bump err count and flush it. + LDB T,[TH$THL (H)] ; Find TCP header length in words + LSH T,2 ; Make it in octets + SUBI TT,(T) ; TT now has # octets of segment data. + + ; Contents of segment have been validated (more or less), + ; now set up convenient context values + ; PK.TCI contents + ; E/ Segment control flags (in LH) + ; TT/ SEG.LEN + HLLZ E,TH$CTL(H) ; Get word with segment control flags + DPB T,[PK$TDO (R)] ; Store offset of data (from THCKSI) + DPB TT,[PK$TDL (R)] ; Store length of data + TLNE E,(TC%SYN) ; Note that SYN counts in seg.len + ADDI TT,1 ; so allow for it + TLNE E,(TC%FIN) ; And do same thing for FIN. + ADDI TT,1 ; Either way, get SEG.LEN set up in TT. + + ; Then see if any TCB exists for this segment. + SKIPE A,TH$SRC(H) ; Get source/dest port word + SKIPN B,IP$SRC(W) ; Get source addr from IP header + JRST TSIF02 ; Flush anything with zero field. + LSH B,-4 ; Right-justify the addr + MOVSI I,-XBL +TSI02: CAMN A,XBPORT(I) ; Loop til we find it + CAME B,XBHOST(I) +TSI03: AOBJN I,TSI02 + JUMPL I,TSI05 ; Jump if found existing connection + JRST TSISQ ; Jump if no existing connection. + +TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? + JRST TSI02 ; LH must have crud still set, ignore for now + BUG CHECK,[TCP: Clsed TCB has active port/host] ; Shouldn't happen! + SETZM XBHOST(I) ; If continued, fix up. + JRST TSI02 + + ; Connection exists, TCB index now in I. + ; Set up a little more context (PK.TCI and J) +TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info + MOVEM J,XBNADR(I) ; Save host-table idx of addr this seg is from. + HRRZ J,XBSTAT(I) ; Get connection state + CAIL J,.XSTOT ; Highest possible state. + BUG HALT,[TCP: Bad conn state] + METER("TCP: IS all states") + XCT XSMTRS(J) ; Bump meter for each state + CAIG J,.XSSYN ; If it's CLS, SYQ, LSN or SYN-SENT + JRST @(J)[ ; then process specially. + TSI04 ; Closed??? + TSISQQ ; Syn-Queued? (Probably re-trans) + TSILS ; Listen + TSISS] ; Syn-sent + ; Drop through to perform general sequence-number checking. + + ; Check Sequence Number!!! + ; This code doesn't do two things: + ; 1) it doesn't keep around stuff that arrives to the + ; right of rcv.nxt. + ; 2) for situation where seg.seq number is valid, + ; (i.e. seq =< rcv.nxt) the code punts if + ; end of seg is out of window. It should simply + ; expand the window! + LDB D,[TH$SEQ (H)] ; Get sequence number + JUMPG TT,TSI10 ; Jump if data present. + JUMPL TT,TSIF03 ; No data. Jump if error (neg data!) + + ; No data in this segment, it is probably a simple ACK. + CAME D,XBRNXT(I) ; Seg.seq == snd.nxt (as expected?) + JRST TSI01 + METER("TCP: 0-len seg seq match") + JRST TSI20 ; Yep, seg is acceptable instantly! + +TSI01: SKIPN C,XBRWND(I) ; Have some receive window? + JRST TSI09 + ADD C,XBRNXT(I) ; Get nxt+wnd + TLZ C,%MOD32 ; all arith mod 32 + CMPSEQ XBRNXT(I),=<,D,<,C,TSI07,TSI08 + JRST TSI20 ; Within rcv window, buy it + +TSI07: METER("TCP: 0-len seg before rcv window") + JRST TSISNE + +TSI08: METER("TCP: 0-len seg after rcv window") + JRST TSISNE + + ; 0-data, 0-window, and SEG.SEQ != RCV.NXT +TSI09: METER("TCP: Ifl 0-len 0-window seqerr") + JRST TSISNE ; Sigh, flush it. + + ; Seq number check when data present. +TSI10: CAME D,XBRNXT(I) ; Is seq # what we expect (seq = nxt)? + JRST TSI11 + SKIPE C,XBRWND(I) ; Yes! And is our window open? + JRST TSI20 ; Yes! Fast dispatch! + + ; Data segment, with valid sequence number, but our window is + ; zero. See if there's some way we can avoid throwing away the + ; segment... if we can't take it then still must handle + ; ACK/URG/RST flags. For now, we really handle this at TSI70. +TSI12: METER("TCP: 0-wnd data seg") + JRST TSI20 + + ; Sequence # isn't exactly what we hoped for, see if the + ; segment overlaps a valid portion of sequence space. +TSI11: SKIPN C,XBRWND(I) ;#3: Get window, is it zero? + MOVEI C,512. ; If zero, substitute a dummy window. + + ; Both len>0 and wnd>0. + ADD C,XBRNXT(I) ; Get nxt+wnd + TLZ C,%MOD32 ; all arith mod 32 + ;#4a: nxt =< seq < nxt+wnd + CMPSEQ XBRNXT(I),=<,D,<,C,TSI13 ; Jump if fail this test, try 4b. + + ; Come here when sequence # is OK, but segment starts farther on + ; than we want, i.e. there is a "hole" between rcv.nxt and seg.seq. + ; Eventually we could keep this segment around, to speed up + ; throughput for nets that get packets out of order, but for + ; now we'll just flush it and force a retransmit. + METER("TCP: Iseg hole") + TRO E,%TSISR+%TSIFL ; Say starts to right, and flush later. + JRST TSI20 ; Go process RST/ACK/URG etc. + +TSIF12: METER("TCP: Ifl seq dup") ; Segment falls in prev rcvd data. + MOVE D,XBRNXT(I) ; Fake out, say seq # OK + TRO E,%TSIFL ; and don't process data. + JRST TSI20 ; Go handle RST/ACK/URG. + +TSIF13: METER("TCP: Ifl seq int err") ; Shouldn't ever happen, due to + JRST TSISNE ; right-bound check code above. +TSIF14: METER("TCP: Ifl seq old") + JRST TSISNE +TSIF15: METER("TCP: Ifl monster seg") ; Impossible error + JRST TSISNE + + ; Segment does not overlap window to right, so see if it + ; overlaps to left, i.e. sequence # falls within data we have + ; already received. +TSI13: MOVE A,XBRNXT(I) + SUBI A,%TCPMB ; Make a fictional lower bound + CAIGE A, + ADD A,[1_32.] ; Keep bound mod 2^32 + CMPSEQ A,=<,D,=<,XBRNXT(I),TSIF14,TSIF13 + + ; Yep, falls within received data. It's probably a duplicate + ; retransmitted segment; see if there's any new data on right side. + ; Note that we are not using XBRWND here, because as long as we + ; have a non-zero window we will always accept everything in the + ; segment. So we create another fictional bound to the right. + ADD A,[%TCPMB*2] ; Get back to other side of rcv.nxt + TLZ A,%MOD32 ; Keep mod 2^32 + MOVE C,D + ADDI C,-1(TT) ; Get seq+len-1 + TLZ C,%MOD32 + ;#4b: nxt =< seq+len-1 < nxt+wnd? + CMPSEQ XBRNXT(I),=<,C,=<,A,TSIF12,TSIF15 ; If fail this too, error. + + ; Aha, have some new data in spite of being overlapped with some + ; previously received data! Here, we + ; twiddle things so that it appears to start properly at + ; rcv.nxt. This is done without touching the segment contents + ; at all, just modifying the packet entry info. + METER("TCP: Iseg ovlap") + MOVE A,XBRNXT(I) ; Get rcv.nxt + CAMGE A,D ; Make sure it's greater than seg.seq + TLO A,(1_32.) ; Mod 2^32 screw, make it greater (add 33d bit) + SUB A,D ; Find # octets of sequence space diff + CAMLE A,TT ; Shouldn't be greater than seg.len!! + BUG CHECK,[TCP: Trim error] + SUBI TT,(A) + JUMPLE TT,TSIF12 ; If nothing left, drop this segment. + TLZE E,(TC%SYN) ; Clear SYN since it's at front. + SUBI A,1 ; If it was set, reduce cnt of actual data + LDB T,[PK$TDL (R)] ; that we're going to flush. Get cnt + SUBI T,(A) ; Decrement # valid data bytes in segment + DPB T,[PK$TDL (R)] ; Put back + LDB T,[PK$TDO (R)] ; Also adjust offset to valid data + ADDI T,(A) ; Increment to point at new data + DPB T,[PK$TDO (R)] ; Put back + MOVE D,XBRNXT(I) ; Now say seg.seq = rcv.nxt! + ; Segment sanitized, drop through. + SKIPN XBRWND(I) ; Only proceed if our window not zero. + JRST TSI12 ; It's zero! May have to flush it... + + ; Fall through to TSI20 for RST/ACK/URG processing. + + ; Now check RST +TSI20: TLNE E,(TC%RST) ; RST bit set? + JRST TSIRST ; Yeah, go process it. + + ; Now check security/precedence + JFCL ; ho ho ho + + ; Now check SYN bit +TSI40: TLNE E,(TC%SYN) ; SYN bit set? + JRST TSISYN ; Yeah, go process it (basically error) + + ; Now check ACK bit +TSI50: TLNN E,(TC%ACK) ; ACK bit set? + JRST TSIF50 ; No, error. Drop segment. + JRST @TSI51(J) ; Yes, dispatch depending on state. +TSI51: OFFSET -. +.XSCLS:: [JRST 4,TSI51] ; Closed +.XSSYQ:: [JRST 4,TSI51] ; ITS: Syn-Queued +.XSLSN:: [JRST 4,TSI51] ; Listen +.XSSYN:: [JRST 4,TSI51] ; Syn-Sent +.XSSYR:: TSI53 ; Syn-Rcvd +.XSOPN:: TSI54 ; Established (open) +.XSFN1:: TSI54 ; Fin-Wait-1 +.XSFN2:: TSI54 ; Fin-Wait-2 +.XSCLW:: TSI54 ; Close-Wait +.XSCLO:: TSI54 ; Closing +.XSCLA:: TSI54 ; Last-Ack +.XSTMW:: TSIATW ; Time-Wait +.XSTOT:: OFFSET 0 + + + ; SYN-RCVD state, handling ACK. +TSI53: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + CMPSEQ B,=<,A,=<,XBSNXT(I),TSISRA ; Jump if fail + MOVEI J,.XSOPN ; ACK wins, we're now open! + HRRM J,XBSTAT(I) ; Set new state, fall through to handle. + CALL TCPUSI ; Adjust user state. + ; Must initialize SND.WL1, SND.WL2, and SND.WND. + ; Maybe later merge this with TSI55. + MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + MOVEM B,XBSAVW(I) ; and make avail window be same as send wind. + JRST TSI54X ; Skip repeating the ACK test. + + ; Handle ACK while in open state (also other receive-OK states) +TSI54: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + ; If seg.ack < snd.una, go to TSI60 and ignore the ACK. + ; If seg.ack > snd.nxt, go to TSISAK to drop segment (ACKing) + CMPSEQ B,=<,A,=<,XBSNXT(I),TSI60,TSISAK ; Jump if fail + + ; ACK is fine. Update SND.UNA and clean up retransmit queue. +TSI54X: MOVEM A,XBSUNA(I) ; Update snd.una + + ; Must check retransmit queue slowly to find right place to flush, + ; if any. + ; Procedure is: (1) pull off 1st thing on queue. + ; (2) If the new 1st thing has a seq # =< snd.una, + ; then can flush what we pulled off, and try again. + ; (3) otherwise put it back on at front. +TSI54A: MOVE C,A ; Save ACK # in C +TSI54B: MOVEI Q,XBORTQ(I) ; Get pointer to retrans q + CALL PKQGF(PK.TCP) ; Get 1st thing on queue + JUMPE A,TSI54Z ; None left? Win! + TRCPKT A,"TSI54B Mabye flush from rexmit Q" + MOVE T,PK.FLG(A) ; Check packet flags, + TLNN T,(%PKODN) ; to make sure output was completed. + JRST TSI54Y ; Not done yet, so don't flush yet. + HRRZ B,XBORTQ(I) ; Get pointer to next thing + JUMPE B,[CAMN C,XBSNXT(I) ; No next thing, compare with snd.nxt + JRST TSI54D ; Equal, can flush! + JRST TSI54Y] ; If not equal, must have ack < snd.nxt + ; so previous segment can't be flushed. + HLRZ B,PK.TCP(B) ; Get addr of TCP hdr for 2nd queued segment + LDB B,[TH$SEQ (B)] ; Get sequence # for it +TSI54C: CMPSEQ B,=<,C,=<,XBSNXT(I),TSI54Y ; See if ACK comes after that # + + ; Hurray, matches or exceeds this seq #, + ; So we can flush the seg we pulled off! +TSI54D: TRCPKT A,"TSI54D Flushing from Q" + TLO T,(%PKFLS) ; Tell IP to forget it if queued + MOVEM T,PK.FLG(A) + CALL PKTRT ; Flush if not otherwise occupied +TSI54E: MOVE A,TIME ; Crock crock, set up new timeout. + ADD A,TCPTMO + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Reset retry counts + SOSGE XBORTL(I) ; Decrement # segments on retrans q. + BUG HALT,[TCP: Retrans Q count error] + JRST TSI54B ; Keep going as long as we can. + +TSI54Y: MOVEI Q,XBORTQ(I) + CALL PKQPF(PK.TCP) ; Put back on front of queue +TSI54Z: MOVE A,C ; Restore ACK # to A. + + ; Now see if send window should be updated. + CAMN D,XBSWL1(I) ; Fast check first, WL1 = SEQ? + JRST TSI55C ; Yes, go check ACK then + MOVE T,XBSWL1(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL1(I),<,D,<,T,TSI56 ; Check if wl1 < seq < wl1+xxx + JRST TSI55 ; Yes, must update window. +TSI55C: MOVE T,XBSWL2(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL2(I),=<,A,=<,T,TSI56 ; Fall-thru win if snd.wl2 =< seg.ack + +TSI55: MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + ; Drop thru + + ; Either SND.UNA or SND.WND was probably updated, so lets update + ; SND.AVW also (available window). The following computes + ; WND - (NXT - UNA) and assumes UNA =< NXT. +TSI56: MOVE A,XBSNXT(I) + CAMGE A,XBSUNA(I) ; If need mod 32 wrap, + TLO A,(1_32.) ; wrap up the number that should be higher. + SUB A,XBSUNA(I) ; Find NXT-UNA (# bytes not yet acked) + CAIL A,0 + CAILE A,177777 ; Make simple check + BUG INFO,[TCP: Bad AVW calc, UNA=],OCT,XBSNXT(I),[NXT=],OCT,XBSUNA(I) + MOVE B,XBSWND(I) + SUBI B,(A) ; Find # bytes we can still send + CAIGE B, ; Make sure it's not negative! + SETZ B, + MOVEM B,XBSAVW(I) + + ; Done with ACK processing for OPEN state, see if must handle + ; idiosyncracies of other states. +TSI57: CAIN J,.XSOPN ; Skip other checks if state is OPEN (normal) + JRST TSI60 ; Go check for URG etc. + CAIN J,.XSCLW + JRST TSI80 + CAIN J,.XSFN1 + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, enter FIN-WAIT-2 + JRST TSI60 ; Not yet. + MOVEI J,.XSFN2 ; Yes, FIN was ACKed, change state. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Call this for any state change. + LDB T,[XB$ICH (I)] ; Do we have an input chan? + JUMPN T,TSI60 ; If so, CLOSE will handle the wrapup. + MOVE T,TIME ; No, must set timeout. + ADDI T,2*60.*30. ; Use 2*MSL + MOVEM T,XBORTT ; set timeout. + JRST TSI60] + CAIN J,.XSFN2 + JRST [ ; If retrans queue empty, transmit-chan CLOSE done. + JRST TSI60] + CAIN J,.XSCLO + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, + JRST TSIF55 ; No-- flush the segment. + CALL TSITMW ; then enter TIME-WAIT state, start timeout. + JRST TSI80] ; Then go check for FIN, etc. + CAIN J,.XSCLA ; LAST-ACK waiting for ACK of our FIN. + JRST [ SKIPE XBORTQ(I) ; If our FIN has been ACK'd, + JRST TSIF56 ; No-- flush the segment. + METER("TCP: FIN acked in .XSCLA") + CALL TXBFLP ; Flush the TCB immediately, PI level + JRST TSIFL] ; then flush the segment. + BUG CHECK,[TCP: Bad ACK state] + + ; Check the URG bit. The only states which get to this + ; point are OPEN, FIN-WAIT-1, and FIN-WAIT-2. +TSI60: TLNN E,(TC%URG) ; Segment has urgent pointer set? + JRST TSI70 ; Nope, on to next step. + LDB A,[TH$UP (H)] ; Get SEG.UP (urgent ptr from segment) + + ; This is where URGENT should be handled!!!! + ; Drop through + + ; Finally process segment text! + ; Only states OPEN, FIN-WAIT-1 and FIN-WAIT-2 can get here. +TSI70: TRNE E,%TSIFL ; If segment being flushed after ACK/URG, + JRST TSIF70 ; flush it now! + + + LDB A,[PK$TDL (R)] ; Find # bytes of real data in segment + JUMPLE A,TSI80 ; If none, no text processing. + TLNE E,(TC%FIN) ; Check that # bytes data == seg.len + JRST [ CAIE A,-1(TT) ; Must allow for funny non-data FIN. + JRST TSI71 ; Nope + JRST TSI72] ; Yep + CAIE A,(TT) ; # bytes data should == seg.len +TSI71: BUG CHECK,[TCP: seglen error] +TSI72: SKIPE D,XBRWND(I) ; Note D used for flag, + JRST TSI75 ; and is non-zero if no compaction done. + + ; Our window is zero, and technically we should throw away the + ; data now that all RST/ACK/URG processing has been done. However, + ; we try to see if we can possibly do a little compaction, since + ; the overhead of doing this is a lot less than the overhead + ; of re-processing the re-transmitted segment! + MOVE A,XBINPS(I) ; Check length of input queue + CAIL A,2 ; Must be at least 2 + SKIPN XBITQH(I) + BUG CHECK,[TCP: Wind & Queue both 0] + + ; See if it's worth trying to compact the input seg into the + ; last one received (which hasn't yet been seen by MP level) + HLRZ A,XBITQH(I) ; Get ptr to last input seg on queue + LDB B,[PK$TDO (A)] ; Get offset to data in old seg + LDB C,[PK$TDL (A)] ; See how much data is there + LDB T,[PK$TDL (R)] ; Find # bytes in new segment + ADDI B,(C) ; Get offset to end of data + MOVEI D,(B) + ADDI D,(T) ; Get projected total offset + CAML D,XBRMSS(I) ; Crock method of ensuring enuf room. + JRST TSI17 ; Not enough, we lose. Lose. Lose. + + ; Win! We're gonna compact! + METER("TCP: Iseg cmpct") + ADDI C,(T) ; Get new # bytes for prev seg + DPB C,[PK$TDL (A)] ; Store it in advance. + HLRZ D,PK.TCP(A) ; Find addr of TCP header in prev seg + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (R)] ; Get data offset for new segment + IDIVI B,4 + ADDI B,(H) ; Get addr for BP to start of new data + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to new data + ; D/ BP to end of old data + ; T/ # bytes of new data + MOVEI A,(T) ; Save # added data in A +TSI74: ILDB C,B + IDPB C,D + SOJG T,TSI74 + SETZ D, ; Clear D to indicate compaction done. + JRST TSI75 + + ; Can't accept segment data, period. +TSI17: METER("TCP: Ifl 0-wnd") + JRST TSIFL ; Flush the seg, sob. + +TSI75: MOVEI B,(TT) + ADDB B,XBRNXT(I) ; Update rcv.nxt value by adding seg.len + TLZE B,%MOD32 + MOVEM B,XBRNXT(I) ; Updated! + LDB B,[XB$ICH (I)] ; See if we have an input channel # + JUMPE B,[METER("TCP: IS fl no chan") + JRST TSI78] ; No input channel, so just throw away. + MOVEI C,(A) ; Save # bytes data. + ADDM A,XBINBS(I) ; Add new bytes to # bytes in input queue + JUMPE D,TSI78 ; If compaction done, that's all... + SKIPE B,XBINPS(I) ; If no segments previously on queue, + MOVE B,XBIBC(I) ; or current input buff has zero cnt, + ; then will definitely interrupt user later. + AOS XBINPS(I) ; Bump # segments on queue + + ; Check to see how much to reduce window by. + ; Amount is in C (defaults to amount we just received) + CALL TCPRWS ; Set receive window + + ; Finally add segment to queue! + MOVEI A,(R) ; Set up pointer to packet/segment + MOVEI Q,XBITQH(I) ; Point to TCP input queue + CALL PKQPL(PK.TCP) ; Add to end of queue, using TCP links. + JUMPN B,TSI78 ; Check, jump unless had no input before + CALL TXBIST ; If none, then must definitely change state! + HRLM T,XBSTAU(I) ; + CALL TCPUII ; And always give an input-avail int! + + ; Now must send an ACK, or rather arrange for one to be + ; sent soon. FIN is also checked here, so as to bypass the + ; code which assumes that XBRNXT hasn't been updated (if we are + ; here, it certainly has!) +TSI78: MOVSI A,(TC%ACK) ; Set bit asking for ACK to be sent. + IORM A,XBSTAT(I) + TLNN E,(TC%FIN) ; Perform FIN-bit check + JRST TSI90 ; None, all done with segment! + JRST TSI82 ; FIN exists, handle it (bypass bump of XBRNXT) + + ; Lastly check the FIN bit. Not clear if a bunch of states + ; want to come here from ACK processing or not. + ; Anyway, code assumes could be in any state. +TSI80: TLNN E,(TC%FIN) + JRST TSI90 + CAIG J,.XSSYN + JRST TSIF80 ; Flush if CLOSED, LISTEN, SYN-SENT + + ; Advance RCV.NXT over the FIN and send an ACK for it. + AOS A,XBRNXT(I) + TLZE A,%MOD32 + MOVEM A,XBRNXT(I) +TSI82: MOVSI A,(TC%ACK+%XBFIN) ; Set bit asking that ACK be sent, and FIN + IORM A,XBSTAT(I) ; was seen. + MOVEI T,.XCFRN ; Say foreign host closed input side. + CALL TCPUCI + + ; Now effect some state changes + CAIE J,.XSOPN ; If OPEN + CAIN J,.XSSYR ; or SYN-RCVD + JRST [MOVEI J,.XSCLW ; Change state to CLOSE-WAIT + JRST TSI85] + CAIN J,.XSFN1 + JRST [ SKIPN XBORTQ(I) ; If our FIN was ACK'd, + JRST TSI84 ; Go enter TIME-WAIT state + MOVEI J,.XSCLO ; Otherwise enter CLOSING state. + JRST TSI85] + CAIE J,.XSFN2 + CAIN J,.XSTMW + JRST TSI84 ; Go to TIME-WAIT + JRST TSI90 ; Any other states just do nothing. + +TSI84: CALL TSITMW ; Enter TIME-WAIT state, starting 2-MSL timeout + JRST TSI90 +TSI85: HRRM J,XBSTAT(I) ; Set new state and fall through. + CALL TCPUSI ; Set user state. + + ; Done. Finally decide whether to keep segment around or not. +TSI90: HLRZ A,XBITQH(I) ; Get ptr to last thing on input queue + CAIN A,(R) ; Same as current seg (ie it was queued?) + RET ; Yes, just return! + JRST TSIF90 ; Else drop through to flush the segment. + +XSMTRS: OFFSET -. +.XSCLS:: METER("TCP: state CLS") +.XSSYQ:: METER("TCP: state SYQ") +.XSLSN:: METER("TCP: state LSN") +.XSSYN:: METER("TCP: state SYN") +.XSSYR:: METER("TCP: state SYR") +.XSOPN:: METER("TCP: state OPN") +.XSFN1:: METER("TCP: state FN1") +.XSFN2:: METER("TCP: state FN2") +.XSCLW:: METER("TCP: state CLW") +.XSCLO:: METER("TCP: state CLO") +.XSCLA:: METER("TCP: state CLA") +.XSTMW:: METER("TCP: state TMW") +.XSTOT:: OFFSET 0 + + +TSIF01: METER("TCP: ISeg cksm errs ") + JRST TSIFL +TSIF02: METER("TCP: IS zero port/addr") + JRST TSIFL +TSIF03: METER("TCP: IS fl neg data") + JRST TSIFL +;TSIF10: ; Flush this later (retain til get new .METER LIST) + METER("TCP: IS fls Seq # err") + JRST TSIFL +TSIF50: METER("TCP: IS fls Seq no ACK ") + JRST TSIFL +TSIF55: METER("TCP: IS fls CLO & FIN not ACKed") + JRST TSIFL +TSIF56: METER("TCP: IS fls CLA & FIN not ACKed") + JRST TSIFL +TSIF70: METER("TCP: IS fls seqerr processed A/U/R") + JRST TSISNE ; Go respond with ACK +TSIF80: METER("TCP: IS fls FINchk state") + JRST TSIFL +TSIF2A: METER("TCP: IS fls random RST") + JRST TSIFL +TSIF2B: METER("TCP: IS fls Fresh SYN already on SYNQ") + JRST TSIFL + +TSIF90: METER("TCP: IS fls processed seg") + JRST TSIFL + + ; Come here to flush the datagram/segment and return. +TSIFL: METER("TCP: Isegs flushed") + MOVEI A,(R) + CALRET PKTRT + +; TSITMW - Routine to enter TIME-WAIT state. +; TSITM2 is entry point when already in that state. +; Clobbers T, Q +TSITMW: MOVEI J,.XSTMW + HRRM J,XBSTAT(I) + CALL TCPUSI ; Alert user if necessary. +TSITM2: SKIPE XBORTQ(I) ; Unless retransmit still hogs timeout + RET ; (if so, return) + MOVE T,TIME ; then set up 2-MSL timeout. + ADDI T,30.*2.*60. + MOVEM T,XBORTT(I) + RET + +; TSISNE - Sequence number error, segment not acceptable, +; return an ACK unless RST was set. + +TSISNE: METER("TCP: IS NE seqerr") + TLNE E,(TC%RST) + JRST TSIFL ; Flush segment if RST was set + + ; Send an immediate ACK without data, re-using the + ; packet/segment that R points to. +TSOACK: MOVSI T,(TC%ACK) ; Send an ACK immediately + TRCPKT R,"TSOACK return ACK in response to out-of-seq ACK" + CALL TSOSNR + RET + +; TSISQ - Jumped to from TCPIS when TCP segment is received that matches +; no existing connection. Check to see if it's a valid connection +; request. If so, +; (1) see if it matches any wild listens; if so, process. +; (2) see if it's OK to start up a server for it; if so, process. + +TSISQ: TLNE E,(TC%RST) ; If it has RST set, + JRST TSIF2A ; Go drop it quietly. + TLNE E,(TC%ACK) ; If ACK, can't be a valid request either + JRST TSISAR ; Go send a RST in response (with SEQ=SEG.ACK) + TLNN E,(TC%SYN) ; Anything else had better have a SYN + JRST TSISLR ; otherwise send RST with SEQ=0,ACK=SEQ+LEN + + ; Okay, we have a promising SYN. See if it matches any + ; "wild" listens. + METER("TCP: Fresh SYN") + LDB B,[TH$DST (H)] ; Get desired port # + LDB C,[TH$SRC (H)] ; Find port it's from + LDB D,[IP$SRC (W)] ; and host it's from. + MOVSI I,-XBL +TSISQ2: HRRZ J,XBSTAT(I) ; Get state for TCB + CAIE J,.XSLSN ; We're hunting for LISTEN +TSISQ3: AOBJN I,TSISQ2 + JUMPGE I,TSISQ5 ; Jump if no match. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get our local port (never wild) + CAIE A,(B) ; It must match desired "dest port"! + JRST TSISQ3 ; Nope, doesn't want this one. + SKIPL XBHOST(I) ; Aha, very likely will match. Follow thru. + CAMN D,XBHOST(I) + CAIA + JRST TSISQ3 ; Host didn't match. + MOVE A,XBPORT(I) ; Check remote port field + TRNE A,17 ; Low 4 bits are non-zero if remote wild. + JRST TSISQ4 ; Won! + LDB A,[.BP TH%SRC,A] ; Not wild, see if it matches request. + CAIE A,(C) ; Compare our remote with its source. + JRST TSISQ3 ; No, no match here. + + ; Matched a wild listen! Must fill in various stuff. +TSISQ4: MOVEI A,17 + ANDCAM A,XBPORT(I) ; Clear wild bits + DPB C,[.BP TH%SRC,XBPORT(I)] ; Set remote port # + MOVEM D,XBHOST(I) ; Set remote host addr + LDB D,[IP$DST (W)] ; Set local address to whichever address other guy knows + MOVEM D,XBLCL(I) + DPB I,[PK$TCB (R)] ; Finish setting up context for dispatch + CALL TCPMSS ; Correct MSS values for specified foreign host + CALL TCPRWS ; Open up a receive window + JRST TSILS ; Go handle SYN rcvd for LISTEN. + + ; No outstanding listens. Check the port number, to + ; see if it's something we are likely to service. +TSISQ5: LDB A,[TH$DST (H)] ; Get destination port # + CAILE A,%TCPMP ; Fits max port # for RFC service? + JRST TSISLR ; Naw, barf about it (send RST). + + ; See if we're actually willing to start up a job... + LDB A,[IP$SRC (W)] ; See who it's from + JSP T,IPLCLH ; Ask IP if this is one of us + SKIPL TCPUSW ; It isn't, so make sure we're open for biz + CAIA + JRST TSISLR ; Sorry charlie (send RST) + + ; Okay, we'll take it as SYN-QUEUED! We know this is a new + ; request, otherwise it would have been matched at TSI02 and + ; dispatched to TSISQQ instead. + +ifn 0,[ + ; first see if it's already on the queue! + ; Note that we still have remote host # in D. + SKIPN Q,TCPRQH ; Get pointer to 1st item on queue + JRST TSISQ7 ; No queue, so not on. + MOVE B,TH$SRC(H) ; Get req's source/dest ports + MOVE D,IP$SRC(W) ; and its source addr +TSISQ6: HLRZ T,PK.TCP(Q) ; Get addr of TCP header from queue + HLRZ C,PK.IP(Q) ; and addr of IP header + CAIE T, + CAIN C, + BUG CHECK,[TCP: SYNQ smashed] + CAMN B,TH$SRC(T) ; Same ports? + CAME D,IP$SRC(C) ; Same host? + CAIA ; No + JRST TSIF2B ; Yes, assume SYN is a dup, ignore it. + HRRZ Q,PK.TCP(Q) ; Get next thing on pending queue + JUMPN Q,TSISQ6 + + ; Not on queue, let's try to add it. +TSISQ7: MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,%TCPMQ ; Keep its length reasonable + JRST TSISQ8 ; Sigh, ran out. + HRROI T,NTSYNL ; OK, now try loading job up! + CALL NUJBST ; Queue request for job TCPRFC + JRST TSISLR ; Bah, no job slots or something! + MOVEI A,(R) ; It's on the way! Queue the SYN now. + MOVEI Q,TCPRQH + CALL PKQPL(PK.TCP) ; Add onto end of pending-RFC queue. +] ;ifn 0 + + MOVSI I,-XBL +TSISQ6: SKIPN XBUSER(I) + SKIPE XBSTAT(I) + AOBJN I,TSISQ6 + JUMPGE I,TSISQ8 ; Jump if no free slots. + CALL TXBINI ; Got one, might as well verify it's cleared. + MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,XBL/2 ; Keep number reasonable + JRST TSISQ8 ; Sorry, too many. + HRROI T,NTSYNL ; Now see if we can load up handler job. + CALL NUJBST ; Do it + JRST TSISLR ; Ugh, couldn't start new job... + MOVEI J,.XSSYQ + MOVEM J,XBSTAT(I) ; Set state SYN-QUEUED + LDB A,[IP$SRC (W)] + MOVEM A,XBHOST(I) ; Set up host # + MOVE A,TH$SRC(H) ; and ports + ; Don't need to set XBLCL, won't be looked at + MOVEM A,XBPORT(I) ; That's all we need for now. + CALL TCPMSS ; Might as well keep these right even though + CALL TCPRWS ; this TCB will be flushed when conn opens. + MOVE A,TIME + ADDI A,10.*30. ; Let it stay queued for 10 seconds. + MOVEM A,XBORTT(I) + MOVEI Q,XBITQH(I) ; Put the segment on input queue for slot. + MOVEI A,(R) + CALL PKQPF(PK.TCP) + + HRRZM I,TCPRQL ; Save # of last SYN queued. + AOS TCPRQN ; And increment count of entries. + METER("TCP: Srvjob starts") + RET ; All done! + +TSISQ8: BUG INFO,[TCP: SYN queue full] + JRST TSISLR ; Sigh. + + +; TSISQQ - Come here when segment received that matches an +; existing port/host which is in SYN-QUEUED state. + +TSISQQ: TLNE E,(TC%RST) ; Is it an RST? + JRST [ CALL TSISQF ; Yeah, flush the queued SYN. + JRST TSIFL] ; and drop segment. + TLNE E,(TC%ACK) ; An ACK? That's illegal etc... + JRST [ CALL TSISQF ; Flush the queued SYN, + JRST TSISAR] ; and send a RST in response. + TLNN E,(TC%SYN) ; Anything else better be a SYN + JRST [ CALL TSISQF ; else send RST. + JRST TSISLR] + JRST TSIF2B ; Most likely a duplicate SYN, so just + ; flush it and return. + + ; Flush TCB for a queued SYN. +TSISQF: SETZM XBSTAT(I) + SETZM XBPORT(I) + SETZM XBHOST(I) + SETZM XBORTT(I) + SKIPE XBITQH(I) + CALL TXBIFL + SOSGE TCPRQN + BUG HALT + RET + + +; TSISAR - Respond to current segment by sending a RST with +; SEQ=SEG.ACK. Re-uses the current segment's packet buffer. +; R, W, H set up for PE, IP, and TCP. +; E has seg flags. May not be anything in I, so re-use fields +; from given packet! +; TSISAQ - like TSISAR but just drops segment if it has RST in it. +; TSISLR - like TSISAR, but SEQ=0, ACK=SEG.SEQ+SEG.LEN +; This is used when responding to segments without an ACK, i.e. +; initial SYNs. + +TSISLR: METER("TCP: times at TSISLR") + LDB A,[TH$SEQ (H)] ; Get SEQ. Assume TT still valid. + ADDI A,(TT) ; ACK=SEG.SEQ+SEG.LEN + LSH A,4 ; Left justify it. + SETZ D, ; SEQ=0 + MOVSI T,(TC%RST+TC%ACK) + JRST TSISA2 + +TSISAQ: TLNE E,(TC%RST) ; Here, if incoming seg was RST, + JRST TSIFL ; just ignore, don't respond. +TSISAR: METER("TCP: times at TSISAR") + MOVE D,TH$ACK(H) ; Use SEG.ACK for SEQ + MOVSI T,(TC%RST) + + ; Here, A, D, and T must be set up. +TSISA2: SETZ B, + LDB C,[TH$SRC (H)] ; Get source port + DPB C,[.BP TH%DST,B] ; Use as dest port + LDB C,[TH$DST (H)] ; Get dest + DPB C,[.BP TH%SRC,B] ; Use as... you guessed it. + PUSH P,IP$DST(W) ; Which of my addresses to claim to be from + MOVE C,IP$SRC(W) + +; A/ ACK field (left justified) +; B/ (left justified) +; C/ remote host (left justified) +; D/ SEQ field (left justified) +; R/ PE ptr to packet responding to +; T/ flags to use + + + SETZ I, + CALL TSOINI ; Initialize W,H,PK.IP(R),PK.TCP(R),PK.TCI(R) + ; Note everything in PK.TCI will be wrong. + MOVEM C,IP$DST(W) ; Store remote host + MOVEM B,TH$SRC(H) ; Store loc/rem ports + MOVEM D,TH$SEQ(H) ; Deposit new SEQ field + TLNN T,(TC%ACK) ; If sending an ACK + SETZ A, + MOVEM A,TH$ACK(H) ; Deposit ACK field. + TLO T,240000 ; Set IHL + MOVEM T,TH$CTL(H) ; Deposit segment flags + MOVEI A,5*4 + DPB A,[IP$TOL (W)] ; Say length just a std TCP header. + POP P,IP$SRC(W) + CALL THCKSM ; Figure TCP checksum + DPB A,[TH$CKS (H)] ; Deposit in + CALL IPKSND ; Put this buffer on IP output queue! + RET + + +; TSILS - Segment received for this connection while in LISTEN state. +; +TSILS: METER("TCP: Segs rcvd in LSN") + TLNE E,(TC%RST) ; Ignore any RSTs. + JRST TSIFL + TLNE E,(TC%ACK) ; ACKs are bad too. + JRST TSISAR ; Respond with a RST to them. + TLNN E,(TC%SYN) ; It should be a SYN. + JRST TSIFL ; If not, just flush. + + ; We've received a SYN that should be valid. Set up for + ; SYN-RCVD state. Note that we ignore security/precedence + ; except to remember it so our transmits look OK. + ; NOTE!!! TSILSX is an entry point from MP level TCPOPN call, + ; which is used to hook up a user OPEN to a matching SYN on + ; the pending-RFC queue! + METER("TCP: SYN in LSN") +TSILSX: LDB D,[TH$SEQ (H)] ; Get sequence number + LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + CALL TCPISS ; Select a new ISS in A (Initial Send Seq#) + MOVEM A,XBSUNA(I) ; Set SND.UNA to ISS +; ADDI A,1 +; TLZ A,%MOD32 + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + + ; Check for TCP options at this point, and process if present + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + ; Nasty business - put together and send a segment with + ; seq=ISS,ack=RCV.NXT,ctl=SYN+ACK. + ; For now we can assume that initial SYNs will never + ; contain text, and so we don't have to queue it up. + ; Alternatively can hope that remote site is clever about + ; retransmitting! + ; This is because if we don't need to keep received segment + ; around, can just re-use it. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISLX Reflecting incoming SYN with SYN" + CALL TSOSSN ; Fire off SYN. Sends MSS option too. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TCPISS - Select new ISS, return in A + +TCPISS: MOVE A,TIME + LSH A,13. +TCPIS2: TLZ A,%MOD32 + CAMN A,TISSLU ; Same as last used? + JRST [ AOS A,TISSC + ANDI A,17 + LSH A,9. + ADD A,TISSLU + JRST TCPIS2] ; Jump to mask off and test again. + MOVEM A,TISSLU + RET + +; TCPPIO - Process TCP options from incoming segment. +; This is only checked for SYN segments because the only interesting +; option (Max Segment Size) is only sent with SYN segments +; +; R/ Pkt buffer +; I/ TCB Index +; H/ TCP Header +; A/ TCP header size in 32-bit words + +TCPPIO: SUBI A,%TCPHL + LSH A,2 ; Options length in bytes + MOVE B,[TH$OPT (H)] ; BP to start of options +TCPPIL: SKIPG A ; Anything left? + RET ; Nope, done + ILDB C,B ; Get option type + CAIL C,TCPPIS ; In range? + RET ; Have to give up if unknown option + JRST @TCPPIT(C) + +TCPPIT: TCPPI0 + TCPPI1 + TCPPI2 +TCPPIS==.-TCPPIT + + ;End of option list +TCPPI0: RET + + ;NOP +TCPPI1: SOJA A,TCPPIL ; Decrement length and loop + + ;Max Seg Size TYPE ? LENGTH ? MSB ? LSB +TCPPI2: ILDB C,B ; Get length + SUB A,C ; Count it + ILDB C,B ; Get 16-bit quantity, updating B + LSH C,8. + ILDB D,B + ADD C,D ; Now contains foreign MSS request + CAMGE C,XBSMSS(I) ; Don't exceed our own limits! + MOVEM C,XBSMSS(I) ; Set new value in TCB + JRST TCPPIL + + +; TSISS - Segment received while in SYN-SENT state. +; Note that being in this state implies that there is one +; segment on the retransmit queue, which must be the initial SYN +; that we sent. + +TSISS: METER("TCP: Segs rcvd in SYN-SENT") + LDB D,[TH$SEQ (H)] ; Get SEG.SEQ + TLNN E,(TC%ACK) ; Has an ACK? + JRST TSISS2 ; Nope, it better be RST or SYN. + + ; See if our SYN has been ACKed. Since we only send SYNs + ; without data, this just means a test for SEG.ACK = SND.NXT. + LDB B,[TH$ACK (H)] ; Have ACK. Get ack field + CAME B,XBSNXT(I) ; It should ACK our initial SYN + JRST TSISAQ ; If not, send a RST. +; MOVE A,XBSUNA(I) ; snd.una =< seg.ack =< snd.nxt ? +; CMPSEQ A,=<,B,=<,XBSNXT(I),TSISAQ ; If not good, send RST. + +TSISS2: TLNE E,(TC%RST) ; Check for RST + JRST [ TLNN E,(TC%ACK) ; Ugh, have RST. Did we also get good ACK? + JRST TSIFL ; No, can just flush this segment. + MOVEI T,.XCRFS ; Yeah, our SYN is being refused, so + CALL TCPUC ; say this is close-reason. + JRST TSIRST] ; Then must go abort connection. + + ; Here we get to check security/precedence. Hurray. + ; We should just copy the seg values, so as to fake sender out. + + ; Now finally check the SYN bit! + TLNN E,(TC%SYN) ; Must be set + JRST TSIFL ; Neither RST nor SYN? Flush it. + + ; It's a SYN. Update our send params from its values. + ; We will either send an ACK or another SYN; in both cases the + ; SYN segment currently on the retransmit queue should be flushed. + MOVEI Q,XBORTQ(I) ; Point to retrans q + CALL PKQGF(PK.TCP) ; Pluck off 1st thing + SOSN XBORTL(I) ; Verify none left on queue + CAIN A, ; and something was there! + BUG CHECK,[TCP: SYN-SENT retrans Q bad] + JUMPE A,TSISS3 ; Just for robustness + TRCPKT A,"TSISS2 Flushing our SYN from rexmit Q" + MOVE T,PK.FLG(A) + TLO T,%PKFLS ; Tell IP to flush packet if seen + MOVEM T,PK.FLG(A) + CALL PKTRT ; Flush SYN packet if not otherwise busy + SETZM XBORTT(I) ; and flush timeout. + +TSISS3: LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 + MOVEM D,XBRNXT(I) ; Set RCV.NXT to SEQ+1 + + ; Process segment options in case sender specified MSS + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + TLNN E,(TC%ACK) + JRST TSISS4 + LDB A,[TH$ACK (H)] ; If ACK also present, (known acceptable) + MOVEM A,XBSUNA(I) ; Set SND.UNA to SEG.ACK. + + ; Here must test if SND.UNA > ISS (our SYN has been ACKed). + ; But this was already checked just before TSISS2. + MOVSI T,(TC%ACK) ; Hurray, we're open! Must ACK the SYN + TRCPKT R,"TSISS3 ACK SYN to open conn" + CALL TSOSNR ; (Re-using its segment) + MOVEI J,.XSOPN ; Hurray, we're open now! + HRRM J,XBSTAT(I) + CALL TCPUSI ; Update user state + RET + + ; Our SYN not ACKed yet, so enter SYN-RCVD state. +TSISS4: + ; Must go send seq=ISS,ack=RCV.NXT,ctl=SYN+ACK + LDB D,[TH$SEQ (H)] ; Get sequence number + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + SOSGE A,XBSUNA(I) ; Set SND.UNA to ISS + JRST [ MOVEI A,1 + MOVEM A,XBSUNA(I) + JRST .+1] + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISS4 ACK and re-SYN SYN-SENT conn" + CALL TSOSSN ; Fire off SYN/ACK with MSS option included. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TSIRST - valid RST segment received (not in LISTEN). +; Basically must flush the connection, signal user, etc. + +TSIRST: METER("TCP: Valid RSTs") + CALL TXBFLP ; Flush the TCB immediately, PI level + MOVEI T,.XCRST ; Say fgn host reset stuff + CALL TCPUC ; as "close reason" + CALRET TSIFL ; Flush segment. + +; TSISYN - SYN segment received. +; If in window, error - send a RST and close things up. +; If not in window, return an ACK as for TSISNE. + +TSISYN: METER("TCP: Random SYN") + + CALRET TSIFL + +; TSISRA - Bad ACK seen while in SYN-RCVD state, +; send a RST. + +TSISRA: METER("TCP: Bad ACK in SYR") + CALRET TSIFL + +; TSISAK - Received ACK for something not yet seen, send ACK and +; drop segment. +TSISAK: METER("TCP: ACK for nxm") + CALRET TSIFL + +; TSIATW - Received ACK while in TIME-WAIT state. This should be +; a re-transmit of the remote FIN. ACK it, and restart +; 2-MSL timeout. + +TSIATW: METER("TCP: ACK in .XSTMW") + MOVSI T,(TC%ACK) + TRCPKT R,"TSIATW ACK send in TIME-WAIT" + CALL TSOSNR ; Send simple ACK in response. + JRST TSITM2 ; and restart 2-MSL timeout. + +SUBTTL TCP Send output segment + +; Send TCP output segment. +; Send output (usually data) segment, for connection indexed by I. +; Note this differs from TSISAR etc. which don't have any active connection, +; thus no valid I. As much context as possible is taken from the +; TCB tables indexed by I. +; In particular, the %XBCTL flags are examined to see if anything should +; be added to the outgoing segment, other than what was requested in the +; call. + +; Sequence space variables are updated. +; The following possibilities are independently possible: +; Re-using packet / using fresh packet +; Uses seq space (must retrans) / no seq space used +; +; TSOSND - send output segment while connection established +; R/ PE ptr to packet, +; PK.BUF, PK.IP and PK.TCP must be set. +; If these were not initialized by TSOINI so as to get +; the right offsets, you will probably lose. +; PK.TCI should have the # bytes of data and offset. +; I/ TCB index +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +; TSOSNR - Just sends a data-less "reply" type segment using +; TCB's sequence space vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (Neither ACK nor %XBCTL will be added automatically!) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSNR: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + + +; TSOSSN - Send an initial SYN segment. No data, but add a TCP +; MSS option set from XBRMSS(I), and using TCB's sequence space +; vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (None, including SYN, will be added automatically) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSSN: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + MOVE TT,XBRMSS(I) ; Max seg size we would like + LSH TT,4 ; 32-bit option + IOR TT,TSOMSO ; Add in type and length fields of option + MOVEM TT,TH$OPT(H) ; Write it. Damn well better be first option. + LDB TT,[PK$TDO (R)] ; Get current TCP header size + ADDI TT,4 ; Adding 4-byte option + DPB TT,[PK$TDO (R)] + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + +TSOMSO: .BYTE 8 ? 2 ? 4 ? 0 ? 0 ? .BYTE ; Option 2, length 4, two data words + +TSOSND: MOVSI T,(TC%ACK) ; Simple data segment + IOR T,XBSTAT(I) ; Plus whatever is being requested. + HLRZ W,PK.IP(R) ; Get ptr to IP header + HLRZ H,PK.TCP(R) ; and TCP header + LDB TT,[PK$TDL (R)] ; Get # bytes of data +; LDB A,[PK$TDO (R)] ; Get offset of data +; ADDI TT,(A) ; Now have # bytes past std hdr length. + +; TSOSN - Entry point if W, H, and TT already set up. +; I/ TCB index +; T/ flags for segment +; R/ PE ptr (PK.BUF, PK.IP, PK.TCP, PK.TCI must all be set) +; W/ IP header ptr +; H/ TCP header ptr +; TT/ # bytes of data (real data, not including header or SYN/FIN) +; Clobbers A,B,C,D,E,TT,T,Q and updates various TCB data. + +; This code assumes TT is the bytes of DATA only. +; Must store the out-of-TCP info in the IP header field, so that +; the checksum and IPKSND routines will find it there. +; This info consists of: +; IP$SRC - Source address +; IP$DST - Dest address +; IP$TOL - TCP segment length including header +; IP$PTC - Protocol number (needn't set, assumes %PTCTC always) + +TSOSN: METER("TCP: Out segs") + AND T,[TH%CTL] ; Ensure non-flag bits are flushed. + MOVE A,T + ANDCAB A,XBSTAT(I) ; Turn off these request bits + TLNE A,(TH%CTL) ; Any request bits left? + JRST TSOSN2 ; Yeah, can't turn off "now" bit. + MOVSI A,(%XBNOW) ; Satisfied everything, so flush + ANDCAM A,XBSTAT(I) ; the send-immediately bit. + +TSOSN2: LDB A,[PK$TDO (R)] ; Bytes of header + ADDI A,(TT) ; Add bytes of data + DPB A,[IP$TOL (W)] ; Store in IP length field + MOVE A,XBLCL(I) + LSH A,4 + MOVEM A,IP$SRC(W) ; Set source host + MOVE A,XBHOST(I) + LSH A,4 + MOVEM A,IP$DST(W) ; Set dest host + + ; Out-of-TCP info set up, now build the real TCP header. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get port sending from (local) + DPB A,[TH$SRC (H)] + LDB A,[.BP TH%SRC,XBPORT(I)] ; Get port to send to + DPB A,[TH$DST (H)] + MOVE A,XBSNXT(I) ; Get sequence number to use + LSH A,4 + MOVEM A,TH$SEQ(H) ; Set SEQ field + TLNN T,(TC%ACK) ; Check flags, sending ACK? + TDZA A,A ; If not, use zero field anyway. + MOVE A,XBRNXT(I) ; Get ack number to use + LSH A,4 + MOVEM A,TH$ACK(H) ; Set ACK field + + SKIPE A,XBSUP(I) ; Urgent data being sent? + JRST [ TLO T,(TC%URG) ; Yes! Say urgent pointer signif + METER("TCP: Urgent dgms") + MOVNI B,(TT) + ADDB B,XBSUP(I) ; Adjust pointer as result of data sent + CAIGE B, + SETZM XBSUP(I) + LSH A,4 + JRST .+1] + MOVEM A,TH$UP(H) ; Set urgent pointer if any + + MOVE A,XBRWND(I) ; Get our current receive window + LSH A,4 + IOR A,T ; Add in caller's flags + LDB B,[PK$TDO (R)] ; Header length in bytes + LSH B,-2 ; TCP wants length in 32-bit words + DPB B,[<.BP TH%THL,A>] + MOVEM A,TH$THL(H) ; Store header len, flags, window + + PUSH P,TT ; Goddam checksum clobberage + CALL THCKSM ; Now figure out checksum + POP P,TT + DPB A,[TH$CKS (H)] + + ; TCP header set up. Now update our TCB connection vars to + ; account for the stuff we're sending. + TLNE T,(TC%SYN) ; Now find new seq # (SND.NXT) + ADDI TT,1 ; SYN counts as 1 octet + TLNE T,(TC%FIN) ; So does a FIN + ADDI TT,1 + JUMPLE TT,TSOSN8 ; If not actually using seq space, skip + ; a bunch of update/retrans stuff. + + ; We're using up some sequence space! Must update avail window, + ; and put the segment on retransmit queue. + MOVE A,XBSAVW(I) ; Must update avail send window + SUBI A,(TT) + CAIGE A, ; If window becomes negative, + SETZ A, ; keep it at zero. + MOVEM A,XBSAVW(I) + ADD TT,XBSNXT(I) ; Get new SND.NXT + TLZ TT,%MOD32 + MOVEM TT,XBSNXT(I) + SKIPN XBORTT(I) ; Retrans timeout already set? + JRST [ MOVE A,TIME + ADD A,TCPTMO ; Make it 5 sec for now. + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Clear count of retries. + JRST .+1] + TRCPKT R,"TSOSND Pkt w/seq space added to retransmit queue" + MOVEI A,(R) ; Arg to PKQPL, A/ PE ptr + MOVEI Q,XBORTQ(I) ; Arg to PKQPL, Q/ queue hdr ptr + CALL PKQPL(PK.TCP) ; Put on TCP retrans queue + AOS XBORTL(I) ; Bump count of segs on queue + +TSOSN8: CALL IPKSND ; Put on IP output queue + RET + +SUBTTL TCP Retransmit and Timeout + +Comment | + The following things in TCP need some sort of timeout: + Retransmit output segment if not ACKed (removed) within RT sec + Timeout to abort connection if retransmission fails for UT sec + Timeout to ACK incoming data (ie avoid ACKing immediately, + wait for more output or input). + Timeout during TIME-WAIT to flush connection. +| + +; TCPCLK - This routine is called by 1/2-sec "slow" clock. What it has to do +; is scan all active TCB's for the following conditions: +; (1) Retransmit timeout has expired, must resend something. +; or TIME-WAIT timeout has expired. +; (2) An ACK must be sent, either by sending the current output +; buffer, or by generating an ACK without data. + +EBLK +TCLKRC: 0 ; Count of segs compacted in pass over a retrans Q +BBLK + +TCPCLK: SKIPN TCPUP ; Do nothing if turned off. + RET + MOVSI I,-XBL + CONO PI,NETOFF + SKIPA A,TIME +TCLK05: SKIPA A,TIME + +TCLK10: SKIPN B,XBSTAT(I) + JRST TCLK15 + SKIPE C,XBORTT(I) + CAMG A,C + CAIA + JRST TCLK20 ; Retrans timeout +TCLK12: TLNE B,(TH%CTL+%XBNOW) ; Any flags set? + JRST TCLK50 ; Wants ACK sent +TCLK15: AOBJN I,TCLK10 + CONO PI,NETON + RET +TCLK16: MOVE A,TIME + AOBJN I,TCLK10 + CONO PI,NETON + RET + + ; Come here for timeout of some sort. +TCLK20: SKIPE XBORTQ(I) ; If a retrans queue exists, + JRST TCLK22 ; then assume it was a retrans timeout. + MOVEI C,(B) ; No retrans Q, probably a TIME-WAIT one? + CAIN C,.XSTMW ; State TIME-WAIT? + JRST [ METER("TCP: Time-Wait timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + JRST TCLK16] + CAIN C,.XSSYQ ; State SYN-QUEUED? + JRST [ METER("TCP: SYQ timeout") + CALL TSISQF ; Flush the queued SYN. + JRST TCLK16] + CAIN C,.XSFN2 ; State FIN-WAIT-2? + JRST TCLK21 + METER("TCP: Random timeout") ; Sigh. + SETZM XBORTT(I) ; Flush whatever it was. + JRST TCLK16 + +TCLK21: METER("TCP: FN2 timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + SKIPE XBUSER(I) ; Shouldn't still have anything open. + BUG CHECK,[TCP: FN2 timo with active user] + JRST TCLK16 + +TCLK22: METER("TCP: Retrans") + AOS C,XBORTC(I) ; Retrans timeout. Send it again. + SKIPE D,XBORTP(I) ; Has user set any retrans params? + JRST [ JRST TCLK25] ; Yes! For now, non-Z means skip abort check. + CAILE C,%TCPMR ; Tried too many times? + JRST TCLK80 ; Ugh, abort the connection! + SKIPN R,XBORTQ(I) + JRST [ SETZM XBORTT(I) ; If nothing on queue, + JRST TCLK12] ; just reset the timeout to nothing. + SKIPGE A,PK.FLG(R) ; Ensure that packet isn't being output now + JRST TCLK25 ; Still being output?? Reset timeout. + ; Note that we don't check to see whether segment has already + ; been transmitted, on the theory that compaction is going to + ; pay off anyway. + HLRZ W,PK.IP(R) + HLRZ H,PK.TCP(R) + SETZM TCLKRC ; Clear compaction count. + + ; Looks like we have to retransmit. Try to compact up as much + ; stuff as possible into a single segment; this gets a bit + ; hairy. Note that we compact as much as we can, ignoring the + ; %PKPIL and %PKODN bits (except for setting the appropriate flush + ; flags). + TRCPKT R,"TCLK30 Segment being retransmitted" +TCLK30: HRRZ J,PK.TCP(R) ; Get pointer to succeeding segment + JUMPE J,TCLK39 ; If none following, can't compact (ignore + ; possibility of adding XBOCOS for now) + LDB B,[PK$TDO (R)] ; Get 1st offset + LDB C,[PK$TDL (R)] ; Get 1st length + LDB T,[PK$TDL (J)] ; Get 2nd length + ADDI B,(C) ; Find offset to end of 1st data + MOVEI D,(B) + ADDI D,(T) ; Find total length after compaction + CAILE D,576.-<5*4> ; Hack hack hack! Limit to 556. so std + ; IP datagram is limited to 576. + JRST TCLK39 ; If too big, don't compact. + + ; Compact two segments into one! + ; R/ 1st seg D/ offset to end of data + ; J/ 2nd seg T/ len of 2nd data + METER("TCP: Retrans compact") + TRCPKT J,"TCLK30 Segment being compacted into previous seg for rexmit" + ADDI C,(T) ; Get new # bytes for 1st seg + DPB C,[PK$TDL (R)] ; Store it in advance. +; HLRZ D,PK.TCP(R) ; Find addr of TCP header in 1st seg + MOVEI D,(H) + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (J)] ; Get data offset for 2nd seg + IDIVI B,4 + HLRZ A,PK.TCP(J) ; Get addr for BP to start of 2nd data + ADDI B,(A) + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to 2nd data + ; D/ BP to end of 1st data + ; T/ # bytes of 2nd data + LDB A,[IP$TOL (W)] ; Get current length of whole datagram + ADDI A,(T) ; Increment by length of added stuff + DPB A,[IP$TOL (W)] ; Store back + ADDI A,3 + LSH A,-2 + HRLM A,PK.BUF(R) ; Set up new count of # words in datagram. +TCLK32: ILDB C,B + IDPB C,D + SOJG T,TCLK32 + + ; Data copied over, now update flags and stuff. + HLRZ D,PK.TCP(J) + MOVE A,TH$CTL(D) ; Get flags for 2nd seg + AND A,[TH%CTL] ; Mask off just flags + IORM A,TH$CTL(H) ; Add them to flags for 1st seg + TLNE A,(TC%URG) ; If URGENT bit set, + JRST [ LDB B,[TH$UP (D)] ; Get pointer from 2nd seg + LDB C,[PK$TDL (R)] ; Sigh, get new len of 1st seg + ADDI B,(C) ; Adjust for bytes in front + LDB C,[PK$TDL (J)] ; But have to subtract length + SUBI B,(C) ; of 2nd seg (already in 1st len) + DPB B,[TH$UP (H)] ; Store ptr back in 1st seg + JRST .+1] + + ; Compaction done! Now have to remove 2nd seg from queue. + HRRZ B,PK.TCP(J) ; Get pointer to 3rd seg + HRRM B,PK.TCP(R) ; Point 1st at it + CAIN B, ; If 2nd was the last one, + HRLM R,XBORTQ(I) ; must update "last" ptr in queue header. + MOVE A,PK.FLG(J) ; Get flags +IFN PK.TCP-2,.ERR %PQFL flag must match PK.TCP + TLZ A,(%PQFL2) ; Say it's off the TCP list, to allow + ; flushing from IP queue. + TLO A,(%PKFLS) ; In fact, require it + MOVEM A,PK.FLG(J) ; Store flags back + JUMPGE A,[MOVEI A,(J) ; If not locked by PI output, + TRCPKT A,"TCLK32 Seg flushed from rexmit by compaction" + CALL PKTRT ; try to flush it now. + JRST .+1] + SOSGE XBORTL(I) ; Decrement count of retrans queue segs + BUG HALT + AOS TCLKRC ; Bump count of recompacts done + JRST TCLK30 ; OK, try to recompact next seg! + + ; Note one possible problem with following code; although + ; the segment being re-trans'd is given latest poop (ACK, WND), + ; the ones following are not. This is usually OK as we assume + ; that following segs have actually been sent out, but if it + ; happens that they HAVEN'T (i.e. %PKODN not set) then their + ; info is going to be a little out of date. This shouldn't + ; screw things too much, however. +TCLK39: MOVE D,XBRNXT(I) ; Get latest ACK value + LSH D,4 + MOVEM D,TH$ACK(H) ; Set it + MOVE D,XBRWND(I) ; And latest window + DPB D,[TH$WND (H)] + CALL THCKSI ; Compute checksum for it (note not THCKSM) + DPB A,[TH$CKS (H)] + SKIPE TCLKRC ; Was any recompaction done? + CALL IPKHD2 ; Yes, must recompute IP header (checksum etc) + MOVE A,PK.FLG(R) + TLNN A,(%PKODN) ; Has segment already been tried once? + JRST [ ; No, don't put on output queue twice!! + TRCPKT R,"TCLK39 Rexmit skipped because seg not yet output" + METER("TCP: Pretrans compact") + JRST TCLK25] + TLO A,(%PKRTR) ; Set flag saying this is a retransmit + MOVEM A,PK.FLG(R) + MOVEI A,(R) + CALL IPKSNQ ; Put back on IP output queue + ; Note PK.BUF shd still be set up right. +TCLK25: MOVE A,TIME + HRRZ B,XBORTP(I) ; If RH set, use it for new timeout. + CAIN B, + MOVE B,TCPTMO ; Use timeout default. + ADD B,A + MOVEM B,XBORTT(I) + JRST TCLK79 + + ; Here when need to send an ACK. First see if we can + ; make use of existing output buffer. +TCLK50: METER("TCP: slow ACKs") + TLNE B,(TC%SYN+TC%RST) + BUG CHECK,[TCP: SYN or RST set in XBSTAT clock req] + SKIPE R,XBOCOS(I) ; Ensure there is one. + TLNE B,(%XBMPL) ; and that it isn't locked. + JRST TCLK60 ; Sigh, can't use it. + + ; There is an output buffer, and it's not locked, so use that + ; to send stuff out! + TRCPKT R,"TCLK50 COS used to send clock level ACK" + MOVSI T,(TC%PSH) + CALL TCPOFR ; Force it out. + JRST TCLK16 + + ; Come here when we have to generate a new segment for ACK. +TCLK60: TLNN B,(%XBNOW) ; Insisting that we ACK? + JRST TCLK65 ; No, can semi-punt. + CALL PKTGFI ; Get buffer + JRST TCLK65 ; and forget about ACKing if we cant get one + METER("TCP: Clk ACK") + MOVEI R,(A) + MOVE T,B ; Use request flags in segment. + TRCPKT R,"TCLK60 Alloc and send ACK from clock level" + CALL TSOSNR ; Send a simple ACK + JRST TCLK16 + +TCLK65: MOVSI A,(%XBNOW) ; No, so just set insist flag + IORM A,XBSTAT(I) ; and wait a bit longer. + JRST TCLK16 + +TCLK79: + JRST TCLK16 + + ; Abort the connection, timed out. +TCLK80: METER("TCP: Timeout abort") + CALL TXBFLP ; This is pretty drastic... flush, PI level. + MOVEI T,.XCINC ; Say "incomplete transmission" + CALL TCPUC ; as close reason. + JRST TCLK16 + +TCLK90: CONO PI,NETON + RET + + +; Checksum cruft. + +; THCKSM - Figures TCP segment checksum, IP$TOL has TCP segment length. +; THCKSI - Figures TCP segment checksum, IP$TOL has IP header plus TCP seg. +; W/ addr of IP header +; H/ addr of TCP header +; Note that the following out-of-TCP values are looked up +; from the IP header in order to compute sum for the "pseudo header". +; IP$SRC - source host +; IP$DST - dest host +; IP$TOL - # octets in TCP segment (plus IP header) +; Finally, +; %PTCTC - Assumed value +; +; Clobbers B,C,D,E +; Returns +; A/ checksum +; TT/ Total # bytes in TCP segment + +THCKSM: TDZA C,C ; Compute as if IHL=0 +THCKSI: MOVNI C,5*4 + ; First compute pseudo header + LDB A,[IP$SRC (W)] ; Source addr + LDB B,[IP$DST (W)] ; Dest addr + ADD A,B + ADDI A,%PTCTC ; Add TCP protocol number + LDB TT,[IP$TOL (W)] ; Get total length in octets + JUMPE C,THCKS2 + LDB B,[IP$IHL (W)] ; Find IP header length in 32-bit wds + LSH B,2 ; mult by 4 to get # octets + SUBI TT,(B) ; Find # octets of IP data (TCP segment) +THCKS2: ADDI A,(TT) ; Add in. + MOVEI C,-<5*4>(TT) ; Get # bytes in segment after 1st 5 wds + + ; Done with pseudo header (not folded yet, though). + LDB B,[044000,,0(H)] ; Get wd 0 (src/dest) + ADD A,B + LDB B,[TH$SEQ (H)] ; Get wd 1 (seqno) + ADD A,B + LDB B,[TH$ACK (H)] ; wd 2 + ADD A,B + LDB B,[044000,,3(H)] ; wd 3 + ADD A,B + LDB B,[TH$UP (H)] ; wd 4 (part of) + ADDI A,(B) + + LSHC A,-16. + LSH B,-<16.+4> + ADDI A,(B) ; Now have it folded up. + JUMPLE C,THCKS7 ; If nothing more, can leave now. + MOVEI E,5(H) + HRLI E,442000 ; Set up 16-bit byte ptr to options/data + LSHC C,-1 + JUMPLE C,THCKS6 +THCKS5: ILDB B,E + ADDI A,(B) + SOJG C,THCKS5 +THCKS6: JUMPL D,[ ; Jump if odd byte left. + ILDB B,E ; get it + ANDCMI B,377 ; mask off low (unused) byte. + ADDI A,(B) + JRST .+1] +%CKMSK==<-1#177777> ; Mask for stuff above 16 bits +THCKS7: TDNE A,[%CKMSK] ; If any carries, add them in. + JRST [ LDB B,[.BP %CKMSK,A] + TDZ A,[%CKMSK] + ADD A,B + JRST THCKS7] + ANDCAI A,177777 ; Complement sum and mask off. + RET + + +MTRCOD ; Last stuff -- expand meter tables. +TRCCOD ; Expand trace tables diff --git a/system/tcp.275 b/system/tcp.275 new file mode 100644 index 0000000..d9e6aba --- /dev/null +++ b/system/tcp.275 @@ -0,0 +1,3645 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; This file holds the modules for TCP. +comment | STUFF TO DO + +Incoming ACKs should prevent retrans from aborting connection, since +clearly it is still alive, just doesn't have room for our stuff (which +is possibly overflowing its window). + +Note Clark suggs on windowing/ACKing. + If input data seg doesnt have PUSH, don't send ACK, but set + a timeout for sending ACK. Send ACK when: + PUSH is seen + outgoing seg forced out (new or retrans) + timed out + +Output buffering stinks. If can't send buff due to too many segs, +then should be able to keep adding to present segment. + +Provide way for output IOT to specify URGENT, and +Handle URGENT when received on input. + +| + +SUBTTL TCP definitions + +%WYTCP==:7 ; Move to BITS later + +%MOD32==:740000 ; LH mask used for mod 32 arithmetic +%TCPMI==:5 ; Max # segments in input queue per connection +%TCPMO==:5 ; Max # segments in output queue per connection +%TCPDS==:536. ; Default max # bytes per segment (when no + ; knowledge of receiving host) +%TCPMS==:2048.-40. ; Maximum possible segment size we can support + ; This must be 7777 (octal) or less. +%TCPMB==:%TCPMI*%TCPMS ; Max # bytes of data in queue (a bit fictional) +%TCPMR==:20. ; Max # retransmit retries allowed +%TCPMQ==:20 ; Max # pending RFCs allowed +%TCPMP==:777 ; Max port # allowed for pending-RFC (SYN) conns + ; Note pending-RFCs used ONLY for job startups, + ; SYNs are not queued in general. + +; Defintions of TCP Segment Header fields. +%TCPHL==:5 ; # of 32-bit words in fixed part of TCP header + +TH%SRC==:777774,, ; 0 Source Port +TH%DST==: 3,,777760 ; 0 Destination Port +TH%SEQ==:777777,,777760 ; 1 Sequence Number +TH%ACK==:777777,,777760 ; 2 Acknowledgement Number +TH%THL==:740000,, ; 3 Data Offset (TCP Header Length in 32-bit wds) +TH%RES==: 37400,, ; 3 Reserved (should be 0) +TH%CTL==: 374,, ; 3 Control bits +TH%WND==: 3,,777760 ; 3 Window +TH%CKS==:777774,, ; 4 Checksum +TH%UP==: 3,,777760 ; 4 Urgent Pointer + ; 5 Start of Options/Data + +TH$SRC==:<.BP TH%SRC,0> +TH$DST==:<.BP TH%DST,0 > +TH$SEQ==:<.BP TH%SEQ,1> +TH$ACK==:<.BP TH%ACK,2> +TH$THL==:<.BP TH%THL,3> +TH$RES==:<.BP TH%RES,3> +TH$CTL==:<.BP TH%CTL,3> +TH$WND==:<.BP TH%WND,3> +TH$CKS==:<.BP TH%CKS,4> +TH$UP==: <.BP TH%UP, 4> +TH$OPT==:<441000,,5> ; An ILDB-type pointer to start of options. + + ; Control bit definitions (as located in full word) +TC%URG==:<200,,> ; Urgent Pointer significant +TC%ACK==:<100,,> ; Ack field significant +TC%PSH==:< 40,,> ; Push Function +TC%RST==:< 20,,> ; Reset connection +TC%SYN==:< 10,,> ; Synchronize sequence numbers +TC%FIN==:< 4,,> ; Finalize - no more data from sender + +; TCP Connection tables, normally indexed by I +; These correspond to what the TCP document (RFC-793) calls +; the "Transmission Control Block" parameters. +; A TCB is "in use" if either XBUSER or XBSTAT is non-zero. +; XBUSER is set if a user job has channels associated with the TCB. +; XBSTAT is set if TCP is dealing with the TCB. +; PI level will never touch any TCBs which have a zero XBSTAT, so it is +; safe for the MP level to hack a zero-XBSTAT TCB without using NETOFF. + +IFNDEF XBL,XBL==10. ; Allow this many TCP connections for now. + +EBLK ; General variables + +XBUSER: BLOCK XBL ; RH User index + XB%STY==:<770000,,> ; TTY # of STY connected to (0 if none) + XB%ICH==:<007700,,> ; Input channel #+1 (77=IOPUSHed) + XB%OCH==:<000077,,> ; Output channel #+1 (77=IOPUSHed) + XB$STY==:<.BP XB%STY,XBUSER> + XB$ICH==:<.BP XB%ICH,XBUSER> + XB$OCH==:<.BP XB%OCH,XBUSER> +XBSTAT: BLOCK XBL ; ,, + ; Connection flags (internal to ITS) + %XBMPL==:SETZ ; Current output segment locked at MP level (IOT) + ; This must be sign bit for SGNSET/PCLSR to work. + %XBCTL==:<374,,> ; Array of output request bits + IFN %XBCTL-TH%CTL,.ERR %XBCTL flags must be the same as TH%CTL!! + ; For all bits in %XBCTL the general meaning is + ; "Set this bit in next outgoing segment". If no bits + ; are set, output is sent every 2 sec, otherwise every + ; 1/2 sec. If %XBNOW is set, output is sent as soon + ; as something notices it. + %XBNOW==:<1,,> ; Send output segment ASAP (else 1/2 sec clock) + %XBACF==:<2,,> ; Our FIN has been ACKed + + %XBABT==:< 400,,> ; We're aborting. + %XBFIN==:<1000,,> ; FIN received for input, input queue will not + ; get any more additions. +; %XBWOK==:<100,,> ; State is OK for user to write (else get IOC err) +; %XBROK==:<200,,> ; State is OK for user to read (else get IOC err) + + ; Connection state, as in TCP document (RFC-793) + ; Some test/dispatch code depends on the fact that the first + ; 4 states have the values they do. + ; ** NOTE: These .XSzzz symbols are not advertised to users. + ; ** Maybe I'll rename them in here sometime. -- CSTACY 9/84 + .XSCLS==:0 ; Closed (must be zero) + .XSSYQ==:1 ; ADDITIONAL ITS STATE: Syn-Queued + .XSLSN==:2 ; Listen + .XSSYN==:3 ; Syn-Sent + .XSSYR==:4 ; Syn-Rcvd + .XSOPN==:5 ; Established (Open) + .XSFN1==:6 ; Fin-Wait-1 + .XSFN2==:7 ; Fin-Wait-2 + .XSCLW==:10 ; Close-Wait + .XSCLO==:11 ; Closing + .XSCLA==:12 ; Last-Ack + .XSTMW==:13 ; Time-Wait + .XSTOT==:14 ; Total # of states +XBSTAU: BLOCK XBL ; User Channel state ,, +XBCLSU: BLOCK XBL ; Close reason ,, + .XCNTO==:0 ; Never opened + .XCUSR==:1 ; Closed by user + .XCFRN==:2 ; Closed by foreign host + .XCRST==:3 ; Fgn host reset things + .XCDED==:4 ; Fgn host dead (apparently) + .XCINC==:5 ; Incomplete transmission (retrans timeout) + ; ==:6 ; Byte size mismatch - can't happen + .XCNCP==:7 ; Local TCP went down + .XCRFS==:10 ; Fgn host refused connection (valid RST + ; received in SYN-SENT state) + +XBPORT: BLOCK XBL ; <4 zero bits> + ; It is set up this way for fast lookup of + ; incoming segments. +XBHOST: BLOCK XBL ; Remote host (HOSTS3 format) +XBLCL: BLOCK XBL ; Local host (HOSTS3 format) +XBNADR: REPEAT XBL,-1 ; Net host address to give the device driver (-1 none) + +; MP Input - see TCPI for detailed description +XBITQH: BLOCK XBL ; Input Segment TCP queue header +XBINBS: BLOCK XBL ; Total # bytes in input queue +XBINPS: BLOCK XBL ; Total # segments in input queue +XBIBP: BLOCK XBL ; Main prog BP to input +XBIBC: BLOCK XBL ; # bytes available for this BP + +; MP Output - see TCPW for detailed description +XBOCOS: BLOCK XBL ; Current Output Segment pointer (0 if none) +XBOBP: BLOCK XBL ; Main prog BP into output segment +XBOBC: BLOCK XBL ; # bytes of room for this BP + +XBORTP: BLOCK XBL ; Retransmit parameters +XBORTQ: BLOCK XBL ; Retransmit queue header +XBORTL: BLOCK XBL ; Retransmit queue length (# of segments) +XBORTC: BLOCK XBL ; Retransmit count (1st msg on queue) +XBORTT: BLOCK XBL ; Retransmit timeout (1st msg on queue) + +; TCP Send Sequence Variables +XBSUNA: BLOCK XBL ; Send Unacknowledged +XBSNXT: BLOCK XBL ; Send Next +XBSWND: BLOCK XBL ; Send Window (offered window) +XBSAVW: BLOCK XBL ; Available window (between SNXT and SUNA+WND) +XBSUP: BLOCK XBL ; Send Urgent Pointer +XBSWL1: BLOCK XBL ; Segment Seq number used for last window update +XBSWL2: BLOCK XBL ; Segment Ack number used for last window update +XBSMSS: BLOCK XBL ; Max seg size that receiver can handle + +; TCP Receive Sequence Variables +XBRNXT: BLOCK XBL ; Receive Next +XBRWND: BLOCK XBL ; Receive Window +XBRUP: BLOCK XBL ; Receive Urgent Pointer +XBRMSS: BLOCK XBL ; Max seg size we are expecting/ have asked for + +BBLK + +NTSYNL: SIXBIT /TCP/ ; Start SYS;ATSIGN TCP for random SYNs. +EBLK + 0 ; Word for NUJBST etc to mung for above job starting + +TCPUP: -1 ; -1 to handle TCP stuff, 0 to turn off. +TCPUSW: 0 ; -1 to disable net conns from anyone but ourself (like NETUSW) + ; Perhaps eventually this should be the same as NETUSW. +TCPRQN: 0 ; # of things in SYN queue, to keep it small +TCPRQL: 0 ; Index of last SYN queued. +TCPCRI: 0 ; Counter used for gensymming local port #s +TISSLU: 0 ; Last ISS used +TISSC: 0 ; Counter to further uniquize ISS +TCPLCP: 0 ; Last TCB index allocated +TCPBSW: -1 ? 0 ; Lock switch for allocating TCB indices +TCPTMO: 4*30. ; Default timeout for retransmits (in 30'ths of sec) +BBLK + +; Macro to perform sequence-number range checking. +; Note all numbers are 32-bit positive integers, modulo 2**32. +; Use it like this: +; CMPSEQ ,,,,,, +; Left and Right are addrs of the range bounds. One of them +; must be an AC. +; Seqno must be an AC. +; LT and LE are the strings "<" and "=<". +; Lerr and Rerr are the places to JRST to if the left or +; right compares fail, respectively. Rerr can +; be omitted and will default to Lerr. +; e.g. +; CMPSEQ A,<,D,=<,XBSNXT(I),TSI30 +; NOTE CAREFULLY that only existence within a range is checked, +; and the bounds L,R of the range MUST be known to be L =< R! +; It does not work to use CMPSEQ for the degenerate case +; CMPSEQ A,<,B,<,B,ERR +; to see if A < B. + +DEFINE CMPSEQ (L),C1,S,C2,(R),(OUTV1),(OUTV2) + %%%CML==0 + %%%CMR==0 +IFSE [C1][<] %%%CML==CAMG +IFSE [C1][=<] %%%CML==CAMGE +IFSE [C2][<] %%%CMR==CAML +IFSE [C2][=<] %%%CMR==CAMLE +IFE %%%CML&%%%CMR, .ERR Seq compare has bad relational arg + %%%CMX==CAMLE +IFSE [C1][=<] %%%CMX==CAML + +IFGE L-20,IFGE R-20, .ERR Seq compare needs ACs + +IFL L-20,CAMLE L,R ; Skip if normal order, L =< R +.ELSE CAMGE R,L + JRST [ ; Reverse order, R < L. Check S < R & L < S + %%%CMR S,R ; Skipwin if S <(=) R + %%%CMX S,L ; Unusual test here, win if S >(~=) L + JRST .+5 ; If either wins, win completely! +IFB OUTV2, JRST OUTV1 +.ELSE CAML S,[020000,,] ? JRST OUTV1 ? JRST OUTV2 + ] + ; Normal order, L =< R + %%%CML S,L ; Skipwin if S >(=) L + JRST OUTV1 + %%%CMR S,R ; Skipwin if S <(=) R +IFB OUTV2, JRST OUTV1 +.ELSE JRST OUTV2 +TERMIN + +SUBTTL TCP Open system call + +; .CALL TCPOPN +; arg 1 - receive channel number +; arg 2 - transmit channel number +; arg 3 - local port # (-1 to gensym unique port #) +; arg 4 - foreign port # (-1 for wild) +; arg 5 - foreign host address (HOSTS3 fmt) (-1 for wild) +; arg 6 - Retransmission timeout (optional) + +;Control bits: +; - None needed for channels - they are opened as .UAI and .UAO +; automatically (no other modes possible). +; - 7 vs 8 bit ASCII transfers can be determined by user-space byte +; pointer used in SIOT. System buffers are always 8-bit bytes. +%NOLSN==:100 ; Listen mode +%NOBBI==:200 ; Use big buffer for input (not implemented yet) +%NOBBO==:400 ; Use big buffer for output (not implemented yet) +%NOWDA==:1000 ; Use word-align algorithm on transmit (not implemented yet) + +; Note a value of -1 for either the foreign port or host will imply +; that the call is a "listen". For the time being, either also implies +; the other, i.e. wild port means wild host and vice versa. This is +; because I havent figured out what the right thing to do is for the +; various combinations that could result otherwise. +; Word-align means that for the transmit side, all segments sent will +; have the data aligned so that the first byte, and every fourth byte +; after that, will start on a 32-bit word boundary. This should +; produce a noticeable speedup for transfers that involve large blocks +; of words rather than small amounts of miscellaneous text. +; For the latter, it only makes things worse, so is not the default. + +; Return is semi-immediate; the call may +; hang momentarily waiting for a free network buffer. (Have timeout? +; do a SKIPA SKIPA HANG to schedule, then fail if still none?) +; Use NETBLK +; to determine when the channels become open. For a non-listen call, +; there is an internal ITS timeout, but for listen the state can persist +; forever. + +TCPOPN: METER("TCP: syscal tcpopn") + MOVEI A,(A) + MOVEI B,(B) + CAIGE A,NIOCHN + CAIL B,NIOCHN + JRST OPNL14 ; Bad channel # argument + CAIN A,(B) + JRST OPNL33 ; Illegal to use same channel # for both + MOVEI J,(B) + HRLI J,(A) ; Save chan #s in J/ ,, + PUSH P,C + PUSH P,D + PUSH P,E + PUSH P,J + MOVEI R,(A) ; Close receive chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE ; Close whatever is already on channels. + HRRZ R,(P) ; Close xmit chan + ADDI R,IOCHNM(U) + PUSHJ P,CCLOSE + POP P,J + POP P,E + POP P,D + POP P,C + + HLRZM J,UUAC(U) ; Remember input channel # for errs. + SKIPN TCPUP ; If TCP disabled, + JRST OPNL7 ; Fail, "device not ready". + CALL SWTL ; Lock TCB assignment switch + TCPBSW + MOVE I,TCPLCP + SOJL I,TCPO2 +TCPO1: SKIPN XBUSER(I) ; Hunt for free TCB + SKIPE XBSTAT(I) ; Must be both closed and unassigned. + SOJGE I,TCPO1 + JUMPGE I,TCPO3 ; Jump if got one! +TCPO2: MOVEI I,XBL ; Hit beginning, wrap back to end + CAMN I,TCPLCP + JRST OPNL6 ; No free TCB's available + MOVEM I,TCPLCP ; Might as well make faster next time + SOJA I,TCPO1 + +TCPO3: MOVEM I,TCPLCP ; Save scan pointer for next time + JRST TCPO4 ; (This is here for patching. -CSTACY) + + ; Got an index, now see if we're going to do a LISTEN + ; or an active open. +TCPO4: SETZ W, ; Assume active + CAME C,[-1] ; Verify local port is OK + CAIG C,177777 + CAIA + JRST OPNL11 ; Complain "illegal file name" + CAMN D,[-1] + AOJA W,.+3 + CAILE D,177777 + JRST OPNL11 + CAMN E,[-1] + ADDI W,2 + ; W = 0 if no wildcards, =1 if port wild, =2 if host wild, =3 both. + MOVE B,CTLBTS(U) ; Get control bits for call + CAIE W, + TRO B,%NOLSN ; Set "Listen" bit if implied by args. +; Crock - if either is wild, ensure both are. + CAIE W, + SETOB D,E + + SETZ R, ; Say we have no buffer + TRNE B,%NOLSN ; Skip if not listening, doing active open. + JRST TCPO20 ; Listening, don't need buffer. + + ; No wild-cards, this is going to be an active open. We will need + ; a buffer to send the initial SYN, so let's get it now and get + ; all possible PCLSR'ing over with, before turning off the NET PI. + CALL PKTGFI ; Get a free packet, skip unless fail. + CAIA ; Didn't get, skip to schedule. + JRST TCPO15 ; Got it! + SKIPA + SKIPA ; Force a schedule + CALL UFLS + CALL PKTGFI ; Try again. If we fail again, net is full, + JRST OPNL6 ; so better just return "device full" err. +TCPO15: MOVEI R,(A) ; We have buffer! Fall through. + TRCPKT R,"TCPO15 Alloc to send initial SYN" + + ; Okay, nothing can stop us now from running through to completion. + ; We do all the following code with net interrupts OFF so that + ; (a) We can scan all TCBs for port/host conflicts and be + ; sure we checked everything right, + ; (b) Incoming segments at int level won't be confused by + ; an inconsistent state for this TCB. + ; (c) We can check the pending-RFC queue safely. +TCPO20: CONO PI,NETOFF ; Don't let PI level see dirty work. + CAMN C,[-1] + JRST [ CALL TCPPCR ; Assign unique TCP port # + ROT D,-16. ; Put fgn port in high 16 bits + DPB A,[.BP TH%DST,D] ; Deposit local port + JRST TCPO30] ; Note that since port is unique, no + ; possible conflict with existing, so skip chk. + ; Also, low 4 bits indicate wildness if set. + + ; Note that low 4 bits of XBPORT are set to indicate wildness. + ; This ensures that TCPIS won't find them, but TSISQ will. + ; Have specific local port, check to make sure it doesn't already + ; exist in TCB tables. + ROT D,-16. ; Get fgn port in high 16 bits + DPB C,[.BP TH%DST,D] ; Put together the ports word + MOVSI T,-XBL +TCPO22: CAMN D,XBPORT(T) ; Look for matching port set + SKIPN XBSTAT(T) ; which is in use + AOBJN T,TCPO22 + JUMPL T,TCPO91 ; Ugh, found match! Must fail... + + ; OK, D has our unique port set, and we're ready to set things up. +TCPO30: MOVEM D,XBPORT(I) ; Store port set + SKIPL A,E + CALL CVH3NA ; Make sure it's HOSTS3 format. + MOVEM A,XBHOST(I) ; Store foreign host + CALL IPBSLA ; Call IP for best local address + MOVEM A,XBLCL(I) + CALL TXBINI ; Initialize the TCB + CALL TCPMSS ; Set default MSS values. Reexamined when + ; foreign host known if this is a wild listen. + CALL TCPRWS ; Open a default receive window + HRRZM U,XBUSER(I) ; Make TCB/index in use + HLRZ A,J ; Get back saved rcv channel # + DPB A,[XB$ICH (I)] ; Deposit input channel + DPB J,[XB$OCH (I)] ; and output channel + MOVE B,[0101,,0] ; Increment both channel #'s by 1 + ADDM B,XBUSER(I) ; So can distinguish chan 0 from no chan. + HRLZ T,I ; Set up user's IOCHNM words + HRRI T,TCPDUI + ADDI A,IOCHNM(U) + MOVEM T,(A) ; Set up input chan ,,TCPDUI + HRRI T,TCPDUO + ADDI J,IOCHNM(U) + MOVEM T,(J) ; Set up output chan ,,TCPDUO + + ; Search pending-RFC queue to make sure we match up or reject + ; with stuff in there. + LDB B,[.BP TH%DST,XBPORT(I)] ; B gets local port # + SETO D, ; D is -1 for any PE ptr. + CALL TCPRQS ; Search queue, return index in A + JUMPL A,TCPO41 ; Ignore further RFC checks if nothing. + MOVEI C,(A) + HRRZ A,XBITQH(C) + CAIN A, + BUG HALT + HLRZ W,PK.IP(A) + HLRZ H,PK.TCP(A) + TRNE D,17 ; If we're "wild" accepting any request, + JRST TCPO35 ; Take it! + LDB B,[IP$SRC (W)] ; No, must try full match. + CAMN B,XBHOST(I) ; If hosts match + CAME D,TH$SRC(H) ; and ports match too + JRST TCPO40 ; (don't) + + ; Matching request!! + ; For now, we ignore the listen/active distinction here, and + ; always try to establish connection with the pending RFC. + ; So, can flush use of R for listen flag. Have to flush the + ; extra buffer if it was "active" open, though, since we can + ; just re-use the pending-RFC packet. +TCPO35: METER("TCP: Open matched pending RFC") + JUMPN R,TCPO36 + MOVEI Q,XBITQH(C) ; If don't already have buffer, + CALL PKQGF(PK.TCP) ; Get it from the queued SYN (C is idx to) + SKIPN R,A ; It had better have a buffer! + BUG HALT + TRCPKT R,"TCPO36 Queued SYN used to answer pending RFC rqst" +TCPO36: LDB B,[IP$SRC (W)] + MOVEM B,XBHOST(I) ; Set host address + LDB B,[IP$DST (W)] + MOVEM B,XBLCL(I) ; Use local address the other end wants + MOVE D,TH$SRC(H) + MOVEM D,XBPORT(I) ; And ports + CALL TCPMSS ; Find default segment sizes for connection + CALL TCPRWS ; Set up receive window + EXCH C,I ; C identifies slot of queued SYN. + CALL TSISQF ; Flush the SYN from queue! + MOVEI I,(C) + CALL TSILSX ; Invoke interrupt level SYN+ACK, re-uses + ; the packet and sets state and everything. + JRST TCPO80 ; OK, take win return. + + ; Request doesn't match, restore it and fall thru. +TCPO40: +; MOVEI Q,TCPRQH ; Thought we had something but didn't, +; CALL PKQPF(PK.TCP) ; so put back on queue. + + ; No matching request on pending-RFC queue. +TCPO41: CAIN R, ; Skip if handling active open + JRST [ MOVEI A,.XSLSN ; No, handling a listen. + JRST TCPO70] ; Just change state and we're done. + + ; Active open, must fire off initial SYN. + ; R has PE ptr to free packet to be used for the SYN. + CALL TCPISS ; Get initial sequence # + MOVEM A,XBSUNA(I) ; Set up sequence vars + MOVEM A,XBSNXT(I) + MOVSI T,(TC%SYN) ; Note no ACK in initial segment! + TRCPKT R,"TCPO41 Send initial SYN" + CALL TSOSSN ; Send SYN segment (clobber mucho ACs) + MOVEI A,.XSSYN ; Set state to SYN-SENT and fall thru. + +TCPO70: HRRM A,XBSTAT(I) ; Set state LISTEN or SYN-SENT. + CALL TCPUSI ; Change user state. +TCPO80: CONO PI,NETON + JRST LSWPJ1 ; Success return, unlock switch and skip. + + ; Port match failure, must back off and fail. +TCPO91: CONO PI,NETON ; No need to hide our shame + SKIPE A,R ; If we had a buffer, + CALL PKTRT ; return it to freelist. + JRST OPNL13 ; Say "file already exists". + +; TXBINI - Initialize TCB connection table entries for specific index. +; The things it doesn't touch are commented out below. +; I/ TCB index + +TXBINI: +; SETZM XBUSER(I) ; Set after +; SETZM XBSTAT(I) ; Set after + SETZM XBSTAU(I) + SETZM XBCLSU(I) +; SETZM XBPORT(I) ; Set prior +; SETZM XBHOST(I) ; Set prior +; SETZM XBLCL(I) + SETOM XBNADR(I) + + ; I/O vars + SKIPE XBITQH(I) + BUG CHECK,[TCP: Init TCB has input, I=],OCT,I,[list ],OCT,XBITQH(I) + SETZM XBITQH(I) + SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + + SKIPE XBOCOS(I) + BUG CHECK,[TCP: Init TCB has output, I=],OCT,I,[list ],OCT,XBOCOS(I) + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + + ; Retransmit stuff + SETZM XBORTP(I) + SKIPE XBORTQ(I) + BUG CHECK,[TCP: Init TCB has retrans, I=],OCT,I,[list ],OCT,XBORTQ(I) + SETZM XBORTQ(I) + SETZM XBORTL(I) + SETZM XBORTC(I) + SETZM XBORTT(I) + + ; TCP Send Sequence Initialization + SETZM XBSUNA(I) + SETZM XBSNXT(I) + SETZM XBSWND(I) + SETZM XBSAVW(I) + SETZM XBSUP(I) + SETZM XBSWL1(I) + SETZM XBSWL2(I) +; SETZM XBSMSS(I) ; Set after + + ; TCP Receive Sequence Initialization + SETZM XBRNXT(I) + SETZM XBRUP(I) +; SETZM XBRMSS(I) ; Set after +; SETZM XBRWND(I) ; Set after + RET + +; TCPPCR - Port Create. Creates a unique local port #. +; Returns # in A. Current algorithm is very simple/dumb. +; Must only be called at MP level with NETOFF. +; Clobbers T,Q + +TCPPCR: PUSH P,B + MOVEI A,(U) ; Get user index + IDIVI A,LUBLK ; Find job # + AOS B,TCPCRI ; Bump and get new counter + ROT B,-8. ; Put low bits into high + LSHC A,8. ; Then shift them into port # + CALL TCPPLU ; See if this port unique or not. + JRST [ AOS TCPCRI ; If not, AOS stuff and keep going. + AOJA A,.-1] + POP P,B + RET + +; TCPPLU - Port Lookup. Skips if port # unique among local ports. +; A/ port # +; Clobbers T, Q. +; Returns .+1 if fail (number not unique) +; T/ idx of matching TCB + +TCPPLU: LSH A,4 ; Shift over for easier compare + MOVSI T,-XBL +TCPLU2: SKIPN Q,XBPORT(T) + JRST TCPLU3 + AND Q,[TH%DST] + CAMN A,Q + JRST TCPLU7 +TCPLU3: AOBJN T,TCPLU2 + AOS (P) +TCPLU7: LSH A,-4 + RET + +; TCPMSS - Determine and set max bytes per segment for TCB in I +; I/ TCB index. XBHOST should be set already. +; Bashes A, T +; Base maximum TCP segment sizes on size of largest datagram IP wants +; to send to destination. This sets the default sizes. We will tell +; the foreign side what we want (XBRMSS) with a TCP MSS option in the +; outgoing SYN. We will adjust what we send (XBSMSS) down if foreign +; side requests it with MSS opton in an incoming SYN. + +TCPMSS: MOVE A,XBHOST(I) ; Foreign address + CALL IPMTU ; IP datagram size to T + SUBI T,40. + MOVEM T,XBSMSS(I) ; Set default send and receive segment sizes + MOVEM T,XBRMSS(I) + RET + + +SUBTTL Other TCP device system call routines + +; Device name in DEVTAB, device code in DCHSTB, index in RSTB to some tables + +; OPEN - from DEVADR + +TCPO: JRST OPNL12 ; Say "mode not avail" + ; Save rest temporarily. + HLRS C + MOVSI A,(A) ; Save RH of FN1 in LH of IOCHNM + JSP Q,OPSLC7 + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + TCPDUI,,TCPDUO + TCPDBI,,TCPDBO + +; CLOSE - from CLSTB +; R/ addr of IOCHNM word + +TCPCLS: METER("TCP: syscal close") + HLRZ I,(R) ; Get TCB index from LH of IOCHNM + CAIL I,XBL ; Make sure it's reasonable + BUG HALT,[TCP: CLS idx bad] + HRRZ A,XBUSER(I) ; Verify user + CAIE A,(U) + BUG HALT,[TCP: CLS usr bad] + SETO D, ; See if input or output + HRRZ A,(R) + CAIN A,TCPDUO ; Output? + AOSA D + CAIN A,TCPDUI ; Input? + ADDI D,1 + CAIGE D, ; D/ 0 for input, 1 for output. + BUG ; IOCHNM value screwed up?? + LDB A,[XB$ICH (I)] ; Get input chan # according to TCB + LDB B,[XB$OCH (I)] ; Ditto output + MOVEI C,(R) + SUBI C,IOCHNM(U) ; Find channel # we're closing + ADDI C,1 ; Increment since TCB # is really #+1 + CAME C,A(D) ; Compare with channel # in TCB + BUG HALT,[TCP: Close chan not same as TCB chan] + JUMPN D,[MOVEI D,2 + CAIE A, + MOVEI D,3 + JRST TCPC06] + CAIE B, + IORI D,1 +TCPC06: + ; D is now a 2-bit channel status index. + ; Bit 1.2 is 0 for input, 1 for output. + ; Bit 1.1 is 0 if other channel is closed, 1 if it is still open. + SKIPN XBSTAT(I) ; Perhaps already gone? + JRST TCPCL8 ; Yeah, flush channel etc. + PUSH P,D + CONO PI,NETOFF ; Ensure that state doesn't change on us. + HRRZ J,XBSTAT(I) + CAIL J,.XSTOT + BUG HALT,[TCP: CLS state bad] + XCT TCPCXT(J) ; Invoke closure stuff appropriate for state + CONO PI,NETON ; TCB state hacking done, can re-enable ints. + POP P,D + + ; Remove links between user channel and TCB. If both channels + ; are gone, XBUSER is cleared completely. + ; The TCB is not necessarily closed at this point (XBSTAT zero) + ; but TCP will look after it independently to ensure it eventually + ; goes away. +TCPCL8: SETZ B, ; Get a zero + MOVEI T,.XCUSR ; Use this for "Close reason" if needed + TRNE D,2 ; Remember D bit 1.2 indicates output chan + JRST [ DPB B,[XB$OCH (I)] ; Yup, clear output chan. + CALL TCPUCO ; Set close reason if necessary + HRRZ A,XBOCOS(I) ; Does a COS buffer exist? + CAIN A, + JRST TCPCL9 ; Nope, nothing to flush. + CALL PKTRTA ; Aha, free it up. + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST TCPCL9] + DPB B,[XB$ICH (I)] ; Clear input chan. + CALL TCPUCI ; Set close reason if need to. + CALL TXBIFL ; Flush input queue + +TCPCL9: TRNN D,1 ; Skip if other channel still there. + SETZM XBUSER(I) ; Else flush whole word incl user index! + TRNE D,1 ; If a channel is left, + CALL TCPUSI ; we may need to take interrupt on it. + LDB A,[XB$STY (I)] ; Was a STY connected to channel? + JUMPE A,CPOPJ ; Return if not. + MOVEI I,(A) ; Ugh, must disconnect it! Set up TTY # + CALL NSTYN0 ; Disconnect + JFCL + RET ; Return (CLOSE will clear IOCHNM/IOCHST) + +TCPCLE: BUG CHECK,[TCP: Illegal state in CLOSE, J=],OCT,J,[ D=],OCT,D + CALL TXBFLS ; Flush all of TCB but XBUSER + RET + +TCPCXT: OFFSET -. +.XSCLS:: CALL TXBFLS ; Closed already, but flush again to make sure +.XSSYQ:: CALL TCPCLE ; Syn-Queued - can't happen!! +.XSLSN:: CALL TXBFLS ; Listen - flush TCB, enter closed state. +.XSSYN:: CALL TXBFLS ; Syn-Sent - flush TCB, enter closed state. +.XSSYR:: XCT TCPCXT+.XSOPN ; Syn-Rcvd - handled same as OPEN below +.XSOPN:: XCT (D)[ ; Established (Open) + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC30 ; Out (only) - Send FIN, enter FIN-WAIT-1 + CALL TCPC30] ; Out (have In) - " " " " +.XSFN1:: XCT (D)[ ; Fin-Wait-1 + JFCL ; In (only) - Disconnect input + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSFN2:: XCT (D)[ ; Fin-Wait-2 + CALL TXBFLS ; In (only) - Flush, give up waiting + CALL TCPCLE ; In (have Out) - Can't happen + CALL TCPCLE ; Out (only) - Can't happen + CALL TCPCLE] ; Out (have In) - Can't happen +.XSCLW:: XCT (D)[ ; Close-Wait + CALL TCPCLE ; In (only) - Can't happen + JFCL ; In (have Out) - Disconnect input + CALL TCPC70 ; Out (only) - Send FIN, enter LAST-ACK + CALL TCPC70] ; Out (have In) - " " " " +.XSCLO:: XCT TCPCXT+.XSFN1 ; Closing - handled same as Fin-Wait-1 etc. +.XSCLA:: XCT TCPCXT+.XSFN1 ; Last-Ack - handled same as Fin-Wait-1 etc. +.XSTMW:: XCT TCPCXT+.XSFN1 ; Time-Wait - handled same as Fin-Wait-1 etc. +.XSTOT:: OFFSET 0 + + ; Closing output channel while in SYN-RCVD state. + ; Send a FIN and enter FIN-WAIT-1 state. +TCPC30: CALL TCPCLF + MOVEI J,.XSFN1 + JRST TCPC75 + + ; Closing output channel while in CLOSE-WAIT state. + ; Send a FIN and enter LAST-ACK state. +TCPC70: CALL TCPCLF + MOVEI J,.XSCLA +TCPC75: HRRM J,XBSTAT(I) + RET + +TCPCLF: MOVSI T,(TC%ACK+TC%FIN+%XBNOW) ; Tell TCP that output needs FIN and ACK. + JRST TCPOFR ; Go force out current buffer if any + +; TCPUC - Set "Reason-closed" states if not already set. +; T/ Reason to use, if none already exists. +; Clobbers Q +TCPUC: CALL TCPUCI +TCPUCO: HRRZ Q,XBCLSU(I) + CAIN Q, + HRRM T,XBCLSU(I) + RET +TCPUCI: HLRZ Q,XBCLSU(I) + CAIN Q, + HRLM T,XBCLSU(I) + RET + +; TXBFLS - Flush all info about a TCB from TCP viewpoint. +; Mostly consists of freeing up all buffers used, and then +; clearing out most other data cells of the TCB. +; Note that XBUSER and XBSTAU are not affected! +; TXBFLP - ditto but usable at PI level, it is careful not to smash +; things that MP level might be referencing. +; Clobbers A,T,Q +; TXBIFL - Flushes input queue +; TXBOFL - Flushes output queue (including retrans list!) + +TXBFLS: SETZM XBSTAT(I) + CALL TXBIFL + CALL TXBOFL + SETZM XBPORT(I) + SETZM XBHOST(I) + RET + +; TXBFLP - Things to be careful of: +; - swiping COS +; - flushing input queue (don't touch it) + +TXBFLP: CALL TXBOFL + SETZM XBSTAT(I) ; Say off-limits to PI level now. + SETZM XBPORT(I) + SETZM XBHOST(I) + LDB T,[XB$ICH (I)] ; See if input chan active + CAIN T, + CALL TXBIFL ; No input chan, so ensure input q flushed + CALL TCPUSI ; Alert user to mung + RET + +TXBIFL: SETZM XBINBS(I) + SETZM XBINPS(I) + SETZM XBIBP(I) + SETZM XBIBC(I) + MOVEI Q,XBITQH(I) + CALL PKPFLS + SKIPE XBITQH(I) + BUG CHECK,[TCP: Incompl input fls I=],OCT,I,[list ],OCT,XBITQH(I) + CALL TCPRWS ; Reset receive window. + RET + +TXBOFL: HRRZ A,XBOCOS(I) ; If current output seg exists, + CAIE A, + SKIPGE XBSTAT(I) ; and isn't locked by MP level, + CAIA + JRST [CALL PKTRTA ; then free it + SETZM XBOCOS(I) ; and clear the pointer. + SETZM XBOBP(I) + SETZM XBOBC(I) + JRST .+1] + SETZM XBORTT(I) + SETZM XBORTC(I) + MOVEI Q,XBORTQ(I) + CALL PKPFL ; Flush retrans list carefully. + SKIPE XBORTL(I) + BUG CHECK,[TCP: Incompl output fls, I=],OCT,I,[list ],OCT,XBORTQ(I) + MOVE A,XBSNXT(I) + MOVEM A,XBSUNA(I) ; Claim everything ACK'd. + SETZM XBSWND(I) ; Zero our send window. + SETZM XBSAVW(I) ; and available window + SETZM XBSUP(I) ; and urgent pointer. + RET + +PKPFLS: PUSH P,Q +PKPFL2: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CALL PKTRTA ; Should always be freeable. + JRST PKPFL2 + +; Ditto, but for flushing retransmit queue, which has to be special +; since packets are linked on IP output list as well as TCP list. +; Since we can't take packets off the IP output list here, we just set +; a flag telling output PI level to ignore the packet. + +PKPFL: PUSH P,Q +PKPFL3: MOVE Q,(P) + CALL PKQGF(PK.TCP) + JUMPE A,POPQJ + CONO PI,PIOFF + MOVE T,PK.FLG(A) ; Check packet flags + TLNN T,(%PKODN) ; Output done? + JRST [ TLO T,(%PKFLS) ; No, say to flush when hit it. + MOVEM T,PK.FLG(A) + CONO PI,PION + TRCPKT A,"PKPFL3 Packet not flushed" + JRST PKPFL4] + CONO PI,PION + CALL PKTRT +PKPFL4: SOSGE XBORTL(I) + BUG CHECK,[TCP: Retrans Q count err] + JRST PKPFL3 + +SUBTTL TCP Main Program Input + +; All TCP input segments for a connection are put on a queue that +; is headed at XBITQH. When this header is zero, there is no more +; input; if the %XBFIN flag is also set, the remote host has closed +; its transmit side and there will never be any more input. +; Segments are only added by PI level, at the end of the queue. +; Segments are only removed by MP level IOTs, at the start of the queue. +; (An incoming RST will of course flush the queue at PI level) + +; If XBIBP is non-zero, it points into the first segment on the input queue, +; and XBIBC is also valid; things are ready for MP IOTing. +; However, neither XBIBP nor XBIBC is meaningful if XBITQH is zero. + +; Input IOT - from IOTTB + SKIPA T,[SIOKT] ; Come here for SIOT entry +TCPI: MOVEI T,CHRKT + METER("TCP: syscal in") + HLRZ I,(R) ; Get TCB index + + ; Verify state, do misc setup for reading + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Can't IOT if direct-connected to STY. + JRST IOCR10 ; "Chan in illegal mode" + HLRZ B,XBSTAU(I) ; Just reading state, don't need NETOFF. + SKIPG TCPTBI(B) ; Ensure meta-state allows reading. + JRST [ HLRZ B,XBCLSU(I) ; Can't read, see if reason OK + CAIN B,.XCFRN ; Only OK reason is clean fgn close. + JRST UNIEOF ; Yeah, just return quietly. + JRST IOCR10] + + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + XBIBP(I) ; Byte pointer + XBIBC(I) ; # bytes to read + TCPIBG ; Routine to get next buffer + TCPIBD ; Routine to discard buffer + 0 ; not used + TRNA ; Negative - TCPIBG and TCPIBD will do waiting. + ] + CALL (T) + CAIA + AOS (P) + SKIPG XBIBC(I) ; If count for this buffer reached zero, + CALL TCPIBD ; Flush it so XBITQH is valid indication of input avail + RET + +; TCPIBD - Discard input buffer, invoked by I/O. +; This is always called before TCPIBG is. + +TCPIBD: SKIPN XBIBP(I) ; Make sure something's there to discard. + RET ; Nope, gone or was never set up. + MOVEI Q,XBITQH(I) ; Point to TCP input queue header + CALL PKQGF(PK.TCP) ; Get first thing off queue, into A + CAIN A, ; Something better be there. + BUG HALT,[TCP: IOTI queue lost] + + ; Check BP just out of sheer paranoia. + HRRZ T,XBIBP(I) ; Find addr BP points to (maybe +1 actual) + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + CAIL Q,(T) ; Header better be less than BP! + JRST TCPIB2 + TRZ Q,PKBSIZ-1 ; Get addr of start of buffer + CAILE T,PKBSIZ(Q) ; BP should be within or just past end. +TCPIB2: BUG HALT,[TCP: IOTI BP incons] + + ; Okay, end of paranoia, just flush the buffer. + LDB T,[PK$TDL (A)] ; Find # chars we read + MOVN T,T + ADDM T,XBINBS(I) ; Update # chars avail for input. + CALL PKTRT ; Return packet to freelist. + SOSGE T,XBINPS(I) ; Decrement count of segs on input queue + BUG CHECK,[TCP: Input Q count incons] + CAIL T,%TCPMI/2 ; If we are now handling past 50% input, + JRST [ MOVSI T,(TC%ACK) ; Make sure we send an ACK + IORM T,XBSTAT(I) ; so new rcv window is reported. + JRST .+1] + CONO PI,NETOFF + CALL TCPRWS ; Set new receive window + CALL TXBIST ; Get new input chan state + HRLM T,XBSTAU(I) ; Set it. Note interrupt is avoided here. + CONO PI,NETON + SETZM XBIBP(I) + SETZM XBIBC(I) + RET ; Always return with simple POPJ + +TCPRWS: MOVEI T,%TCPMI + SUB T,XBINPS(I) ; Find # segs we can still queue up + CAIGE T,1 ; If no full segs left, + TDZA T,T ; Zero the window, no more segs allowed + IMUL T,XBRMSS(I) ; Else will take N * MSS bytes +TCPRW3: MOVEM T,XBRWND(I) + RET + +IFN 0,[ + ; This code turns out to lose because the code at TCPIS only + ; checks XBRWND to see whether to compact input or not, and as + ; long as XBRWND is non-zero, stuff will always be added to queue, + ; using up all the packet buffers. + ; Basically it's a question of whether or not to allow more input, + ; up to limits of last queued buffer, if the queue has too many + ; buffers on it. Metering will show whether most other implementations + ; win or lose with our buffer-alloc type windowing. +TCPRW2: HLRZ Q,XBITQH(I) ; Find # chars room in last seg + LDB T,[PK$TDL (Q)] + LDB Q,[PK$TDO (Q)] + ADDI Q,(T) + MOVEI T,576. + SUBI T,(Q) + CAIGE T, + SETZ T, + MOVEM T,XBRWND(I) + RET +] + +; TCPIBG - Get new input buffer (invoked by I/O, after TCPIBD) +; Return .+1 if can't get new buffer, must wait (Never, we do waiting) +; Return .+2 if OK, new BP and count set up. +; Return .+3 if "EOF", transfer complete + +TCPIBG: SKIPE XBIBP(I) ; Shouldn't be anything already there. + BUG HALT,[TCP: IOTI buf incons] +TCPIB3: SKIPN A,XBITQH(I) ; See if anything in input queue + JRST TCPIB5 ; No, go handle EOF. + LDB T,[PK$TDL (A)] ; Find # bytes input for this segment + CAIN T, ; Something probably shd be there. + BUG HALT,[TCP: IOTI null seg] + MOVEM T,XBIBC(I) ; Store as new # bytes + LDB T,[PK$TDO (A)] ; Get offset from start of header + HLRZ Q,PK.TCP(A) ; Get addr of TCP header + ROT T,-2 ; Divide offset by 4 + ADDI Q,(T) ; Point to right word + LSH T,-34. ; Right-justify the low 2 bits + HRL Q,(T)[441000 ? 341000 ? 241000 ? 141000] ; Get right LH for BP + MOVEM Q,XBIBP(I) ; Now store BP! + JRST POPJ1 ; Say ready to go again... + + ; No input available. First check to see if there will ever + ; be any more (FIN seen?), then whether to return right away or + ; hang. +TCPIB5: CONO PI,NETOFF ; Avoid timing inconsistencies + SKIPE A,XBITQH(I) ; Check again + JRST [ CONO PI,NETON ; Got some?? + JRST TCPIB3] ; Try again. + SKIPN XBINPS(I) ; No, should also have no segments + SKIPE XBINBS(I) ; and no bytes + BUG HALT,[TCP: IOTI count incons] + MOVE A,XBRWND(I) ; Save value of rcv window + CALL TCPRWS ; Then reset the window + CAME A,XBRWND(I) ; Was previous value correct? + METER("TCP: RCV.WND out of synch") + MOVE T,XBSTAT(I) ; Get flags + CONO PI,NETON + TLNE T,(%XBFIN) ; FIN seen, and input queue empty? + JRST TCPIB6 ; Yes, true EOF now. + + MOVE T,CTLBTS(U) ; See if call had "don't-hang" bit set + TRNE T,10 + JRST TCPIB7 ; No, return EOF. + SKIPN XBITQH(I) ; Wait until input queue has something. + CALL UFLS + JRST TCPIBG ; Then call again. + +TCPIB6: +TCPIB7: CALL TCPUSI ; Adjust user state. + JRST POPJ2 ; and return "EOF" + + +SUBTTL TCP Main Program Output + +; Output IOT - from IOTTB +; Output segments are chained together from XBORTQ, which is +; the "retransmit queue". +; The queue only contains segments which occupy sequence space, since +; these are the only ones which require ACKs and possible retransmit. +; All others are sent directly to the IP output queue. +; While the transmit connection is open, +; Segments are only added by MP level IOTs, at the end of the queue. +; Segments are only removed by PI level ACKs, at the start of the queue. + +; Main program I/O is done into the "Current Output Segment", which is NOT +; on the retransmit queue. There are three variables related to this COS. +; XBOCOS - ,, +; XBOBP - BP into the COS, for MP IOT writing. +; XBOBC - Count of # bytes left that MP IOT can deposit into. +; Note that the maximum possible size of the buffer is kept in PK$TDL +; (TCP segment Data Length). For windowing reasons it may be necessary +; to restrict the amount of space actually used, thus the initial value +; of XBOBC may be less than PK$TDL. This is why the initial value is also +; copied into the RH of XBOCOS, so that when XBOBC counts out we know +; exactly how much of the buffer was actually used. It is possible for +; XBOBC to be increased by interrupt level window processing, in order +; to increase utilization of the buffer. +; States: +; If XBOCOS is zero, XBOBP and XBOBC must also be zero; there is +; no COS. +; If XBOCOS is non-zero (a current output seg exists), then: +; if LH(XBOCOS) is zero, the segment hasn't yet been written +; into, and needs to be set up. +; XBOBP and XBOBC should be zero! +; else the segment is set up for writing. XBOBP should be set! +; If XBOBC is zero it means the segment now contains +; LH(XBOCOS) bytes of data. If this number is less +; than PK$TDL (max possible seg data) then the count +; may be reset to allow further output into this +; segment, or it may simply be sent as is. +; +; The current segment is put on the retransmit queue (and IP output queue) +; when: +; PI level (eg clock) decides it's time to send an ACK or do a FORCE. +; MP level IOT fills up the segment completely. +; MP level FORCE or CLOSE is invoked. +; The current segment is locked down during MP IOT, to keep PI level +; from ripping it away (which would leave entrails dangling). +; PCLSR'ing will clear this lock. If TCP flushes the TCB at PI level +; for some reason, XBOCOS will be freed unless locked. XBOBC and XBOBP +; will still be cleared even if locked, so as to cause a call to TCPOBW +; which will notice the condition and free the COS itself. + + SKIPA A,[SIOKT] ; Come here for SIOT entry +TCPW: MOVEI A,CHRKT + METER("TCP: syscal out") + HLRZ I,(R) ; Get TCB index from IOCHNM wd + + ; Verify state, do misc setup for writing, lock segment. + CONO PI,NETOFF + HRRZ B,XBSTAU(I) ; Get output chan state + SKIPG TCPTBO(B) ; See if meta-state allows writing + JRST IOCR10 ; Can't, say "chan not open" (ugh) + MOVSI B,(XB%STY) + TDNE B,XBUSER(I) ; Also can't if direct-connected to STY. + JRST IOCR10 + MOVSI B,(%XBMPL) ; Set locked flag (must be sign bit!) + IORM B,XBSTAT(I) + CONO PI,NETON ; Okay, we've got it. + CALL SGNSET ; Set PCLSR routine to unlock flag. + XBSTAT(I) + SKIPN XBOCOS(I) ; If no COS there, + SETZM XBOBC(I) ; make SURE count is zapped so refill invoked. + MOVE E,[441000,,4] ; 8-bit bytes, 4 to a word + MOVEI B,[ + SETZ XBOBP(I) ; Output BP found here (sign sez is output) + XBOBC(I) ; # bytes of room remaining + TCPOBG ; Routine to get another buffer (not used) + TCPOBW ; Buffer full, routine to send it. + 0 ; Not used + TRNA] ; Negative - TCPOBG and TCPOBW will do waiting. + CALL (A) + CAIA + AOS (P) ; Pass on a skip return. + + ; User IOT is done, now unlock the segment. + ; We also check for wanting to do an immediate ACK and if needed + ; ship out the current buffer right now, without waiting + ; for the 1/2-sec clock to do it. + SKIPN A,XBSTAT(I) ; See if XBSTAT is still set + JRST IOCR10 ; No, take IOC error return! + CAIL A, ; It better still be locked! + BUG CHECK,[TCP: Output not locked] + CALL LSWPOP ; Clear the lock flag + TLNN A,(%XBNOW) ; Was "immediate-send" flag set? + RET ; Nope, can just return. + METER("TCP: TCPW exit force") + CONO PI,NETOFF + MOVSI T,(TC%PSH) ; Hmm, set up and shove out. + CALL TCPOFR ; and force out current output segment. + CONO PI,NETON + RET + +TCPOBG: BUG CHECK,[TCP: IOT called wrong rtn (TCPOBG)] + AOS (P) ; If proceeded, can still win. Make skip return + ; and drop through to TCPOBW. + +; TCPOBW - Write/Get output buffer, invoked by SIOKT/CHRKT when the +; buffer count (XBOBC) is zero. This routine can figure out +; whether it needs to ship out a full buffer, or get a new +; output buffer, or both. Always returns with XBOBP and +; XBOBC set up for additional output (otherwise it hangs and +; can be PCLSR'd) + +TCPOBW: SKIPE R,XBOCOS(I) ; Get PE ptr to COS + JRST [ HLRZ A,R ; Got a COS, see if already set up + JUMPN A,TCPOB5 ; Jump if so. + JRST TCPOB2] ; Else must set it up. + + ; No current segment, must get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + JRST IOCR10 ; Blooie, say "Chan not open". + CALL PKTGF ; Get one, hang until we succeed. + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOBW Alloc for IOT output buffer" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOB2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Hang until we have less than this. + CALL UFLS ; Note that conn closure will unhang too, + ; because it flushes output queue. + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOB4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + JRST IOCR10] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for PCLSRing. + CALL TCPOB9 ; Check available window + JRST [ CONO PI,NETON ; Window too small, allow ints + CALL TCPOB9 + CALL UFLS + JRST TCPOB4] ; Big enough, go back and re-try stuff. + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + RET ; Okay, all set up, return. + +TCPOB9: MOVE A,XBSWND(T) + LSH A,-2 ; Get 25% offered window + CAML A,XBSAVW(T) ; If 25% offered > avail window, + RET ; punt and wait for better stuff. + JRST POPJ1 + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOB5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOB6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOB6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + RET ; And return happily. + +TCPOB6: TRCPKT R,"TCPOB6 IOT Send" + CALL TCPOB7 + JRST TCPOBW + +TCPOB7: DPB T,[PK$TDL (R)] ; Okay, say this many bytes of data are in seg + PUSH P,B + PUSH P,C + PUSH P,E + MOVSI T,(TC%PSH) ; Ensure seg is pushed out. + IORM T,XBSTAT(I) + CALL TSOSND ; Send data segment (# bytes in PK.TCI) + ; This clobbers a lot of ACs! + SETZM XBOCOS(I) ; No current output segment now. + CONO PI,NETON + SETZM XBOBP(I) + SETZM XBOBC(I) + POP P,E + POP P,C + POP P,B + RET + +; TCPOFR - Force out partially-filled current output segment +; Must have NETOFF. +; Called by FORCE and CLOSE at MP level +; by TCPCLK at PI clock level +; Note that we try to never have stuff in the COS which would +; over-run our send window, by hanging in MP IOT. This will +; be slightly screwed up if the receiver suddenly decreases the window +; size, since this routine always sends the whole thing anyway, +; but it's probably OK (helps avoid SWS) +; I/ TCB index +; T/ additional flags to use (PUSH, URG, FIN) +; Clobbers R and everything that TSOSND does (a lot!) + +TCPOFR: MOVE A,XBSTAT(I) ; Get flags for connection + TLNE A,(%XBCTL) ; Wants anything added on? + IOR T,A ; Yes, OR the bits in. + JUMPL A,TCPOF6 ; If locked at MP level, don't send it! + SKIPN R,XBOCOS(I) ; See if current output seg exists + JRST TCPOF5 ; No, can't hack now. + HLRZ TT,R ; Get # bytes of original buffer size + JUMPE TT,TCPOF5 ; If none, nothing to hack. + SUB TT,XBOBC(I) ; Subtract # left, to get # bytes data + CAIG TT, + JRST [ SETZ TT, ; No data, see if a flag wants to be sent. + TLNN T,(TC%FIN+TC%ACK+TC%SYN) ; Any of these are impt. + JRST TCPOF9 ; Nope, do nothing. + JRST .+1] + DPB TT,[PK$TDL (R)] ; Store back # bytes of real data + AND T,[TH%CTL] ; Mask off the flags + IORM T,XBSTAT(I) ; Stuff in as requests + TRCPKT R,"TCPOFR Force send" + CALL TSOSND ; Send out the stuff + SETZM XBOCOS(I) + SETZM XBOBP(I) + SETZM XBOBC(I) +TCPOF9: RET + + ; No current output segment, so no data to send. Check, though, + ; to see if any flags need sending. +TCPOF5: TLNN T,(TC%SYN+TC%ACK+TC%FIN) + RET ; Nope, just return. + MOVE E,T ; They do! Save em against smashage + CALL PKTGFI ; Try to get a buffer (clobbers T,Q) + JRST TCPOF6 ; Ugh, failed, see about setting flags. + MOVEI R,(A) + TRCPKT R,"TCPOF5 Alloc and send flags only in TCPOFR" + MOVE T,E ; Restore flags + CALL TSOSNR ; Set up the packet and send it! + RET + + ; Can't get packet now, so set up the request flags for later hacking. + ; Also comes here when current output seg is locked at MP level. +TCPOF6: AND T,[%XBCTL] ; Clear out extraneous bits + TLO T,(%XBNOW) ; Ask to send stuff immediately + IORM T,XBSTAT(I) ; and set flags back. + RET + +; TCPOSB - Routine similar to TCPOBW, except that it doesn't hang, +; so that it is suitable for calling at PI level (by STYNTC esp) +; Returns .+1 if can't set up output buffer for writing. +; Returns .+2 if output buff is all set up, with non-zero XBOBC. + +TCPOSB: SKIPE R,XBOCOS(I) + JRST [ HLRZ A,R ; Have COS, see if already set up + JUMPN A,TCPOS5 ; Jump if so. + JRST TCPOS2] ; Else just set it up. + + ; No current segment, get a new one. + HRRZ T,XBSTAU(I) ; First ensure output state is OK. + SKIPG TCPTBO(T) ; Skip if still OK to output. + RET ; Blooie. + CALL PKTGFI ; Get one, skip if successful + RET ; Sigh... + MOVEI R,(A) ; Set up in std AC + TRCPKT R,"TCPOSB Alloc for STYNET output data" + HRRZM R,XBOCOS(I) ; Store ptr + + ; Set up segment for IOT to deposit into. +TCPOS2: MOVEI T,%TCPMO ; Get max # segments allowed on queue + CAMG T,XBORTL(I) ; Fail if we have more than this. + RET + CALL TSOINI ; Initialize the segment (set up W, H) + LDB A,[PK$TDO (R)] ; Find offset data should start at. + TRNE A,3 + BUG HALT ; Should always start at wd boundary! + LSH A,-2 ; Find # words + ADDI A,(H) ; Add address of TCP header, + HRLI A,441000 ; and now we have our initial BP. + MOVEM A,XBOBP(I) ; Set it up. + LDB A,[PK$TDL (R)] ; Get max length avail in this segment + + ; Now have a fresh buffer and nothing else to wait for. + ; Freeze the world, make sure it's still OK to output, and find + ; out how big an output segment we can allow. +TCPOS4: CONO PI,NETOFF + HRRZ T,XBSTAU(I) ; Still OK to output? Check again. + SKIPG TCPTBO(T) + JRST [ MOVEI A,(R) ; Bah, must return buffer. + CALL PKTRTA + SETZM XBOCOS(I) + CONO PI,NETON + RET] ; Barf "Chan not open". + MOVEI T,(I) ; Get index in T for testing (no PCLSR) + CALL TCPOB9 ; Check available window + JRST NETONJ ; Window too small, just return + + LDB Q,[PK$TDL (R)] ; Get max # bytes available + CAMLE Q,XBSAVW(I) ; Greater than window? + MOVE Q,XBSAVW(I) ; Yeah, truncate down to this size. + HRLM Q,XBOCOS(I) ; Store original # bytes in LH of XBOCOS + MOVEM Q,XBOBC(I) + CONO PI,NETON + AOS (P) + RET ; Okay, all set up, return. + + ; Here when we were all set up, and output has used up all + ; of the buffer space initially available. Check to make sure + ; there isn't more we can fill out, and if not then fire off + ; the segment. +TCPOS5: HLRZ T,XBOCOS(I) ; Get # bytes we originally had + CONO PI,NETOFF ; Avoid magic changes in send window + CAML T,XBSAVW(I) + JRST TCPOS6 ; Send window same or smaller (!), send seg. + MOVE Q,XBSAVW(I) ; Send window is bigger! Get new size + LDB A,[PK$TDL (R)] ; Get max size + CAMLE A,Q + MOVEI A,(Q) ; Use minimum of max size and send window. + MOVEI Q,(A) ; Save result + SUBI A,(T) ; Find # more bytes we can hack + CAIG A, ; If there's no more, + JRST TCPOS6 ; Just send it off anyway. + HRLM Q,XBOCOS(I) ; Hurray, got more! Store new original # + MOVEM A,XBOBC(I) ; And set up new count + CONO PI,NETON + AOS (P) + RET ; And return happily. + +TCPOS6: TRCPKT R,"TCPOS6 STYNET Send" + CALL TCPOB7 + JRST TCPOSB + +TCPBI: +TCPBO: RET ; No-ops, labels left in case want to use. + +; STATUS - from LH(DTSTB) +; Must return status in LH(D). Must not smash C,R. +; R/ addr of IOCHNM word + +TCPSTA: HLRZ I,(R) ; Get TCB index + SKIPN XBUSER(I) ; Probably an error if this is zero. + BUG CHECK,[TCP: STATUS on unused conn ],OCT,I + SETZ D, + SKIPN XBSTAT(I) + RET + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + SKIPA T,[TXBIST] + MOVEI T,TXBOST + CALL (T) + DPB T,[140600,,D] + RET + + +TXBIST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBI(T) ; Get conversion + JRST [ SKIPN XBITQH(I) ; Must test for input avail - any segs? + SKIPA T,(T) ; None avail, use standard + MOVE T,1(T) ; Have some waiting, use alternate state + RET] + RET +XBCTBI: OFFSET -. +.XSCLS:: SETZ [%NTCLS ? %NTCLI] ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTINP] ; 5/11 Established (open) +.XSFN1:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-1 +.XSFN2:: SETZ [%NTOPN ? %NTINP] ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTCLU ? %NTCLI] ; 3/10 Close-Wait +.XSCLO:: SETZ [%NTCLS ? %NTCLI] ; 7/10 Closing +.XSCLA:: SETZ [%NTCLS ? %NTCLI] ; 7 Last-Ack +.XSTMW:: SETZ [%NTCLS ? %NTCLI] ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + +TXBOST: HRRZ T,XBSTAT(I) + CAIL T,.XSTOT + BUG HALT + SKIPGE T,XBCTBO(T) ; Get conversion + JRST [ SKIPN XBORTQ(I) ; Must test for output queued + SKIPA T,(T) ; None, use standard + MOVE T,1(T) ; Have some output waiting, use alternate state + RET] + RET +XBCTBO: OFFSET -. +.XSCLS:: %NTCLS ; 0 Closed +.XSSYQ:: 0 ; Technically this is an impossible state... +.XSLSN:: %NTLSN ; 1 Listen +.XSSYN:: %NTSYN ; 4 Syn-Sent +.XSSYR:: %NTSYR ; 2 Syn-Rcvd +.XSOPN:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Established (open) +.XSFN1:: %NTCLX ; 7 Fin-Wait-1 +.XSFN2:: %NTCLX ; 7 Fin-Wait-2 +.XSCLW:: SETZ [%NTOPN ? %NTWRT] ; 5/6 Close-Wait +.XSCLO:: %NTCLX ; 7 Closing +.XSCLA:: %NTCLX ; 7 Last-Ack +.XSTMW:: %NTCLX ; 7 Time-Wait +.XSTOT:: OFFSET 0 + + + +; WHYINT - from RH(DTSTB) +; Results are: +; A/ %WYTCP +; B/ +; C/ input - # bytes in input buff +; output - # bytes of room avail in output buff +; D/ Close reason (only valid if state %NTCLS) + +TCPWHY: HLRZ I,(R) ; Get TCB index + METER("TCP: syscal whyint") + CAIL I,XBL + BUG HALT,[TCP: WHY idx bad] + CALL TCPSTA + LDB B,[140600,,D] ; Get state for channel + HRRZ A,(R) ; Find whether input or output + CAIN A,TCPDUI + JRST [ HLRZ D,XBCLSU(I) ; Get input close reason + MOVSI C,(XB%STY) + TDNE C,XBUSER(I) ; No input avail if direct-conn to STY + JRST [ SETZ C, ? JRST TCPWH5] + SKIPLE C,XBINBS(I) + JRST TCPWH5 + SKIPN C,XBITQH(I) + JRST TCPWH5 + LDB C,[PK$TDL (C)] + JRST TCPWH5] + HRRZ D,XBCLSU(I) ; Get output close reason + SKIPN C,XBOBC(I) ; Get # bytes of room left in current pkt + JRST [ MOVEI C,%TCPMO ; If none, return total queue space instead + SUB C,XBORTL(I) + IMUL C,XBSMSS(I) + CAIG C, + SETZ C, + JRST .+1] +TCPWH5: MOVEI A,%WYTCP + JRST POPJ1 + + + +; RFNAME - from LH(DRFNTB) +; A/ LH of IOCHNM word for channel. + +TCPRCH: MOVEI I,(A) + LDB B,[.BP TH%DST,XBPORT(I)] + LDB C,[.BP TH%SRC,XBPORT(I)] + MOVE D,XBHOST(I) + MOVEI W,4 + POPJ P, + +; RFPNTR - from RH(DRFNTB) +TCPRFP: JRST OPNL34 + +; IOPUSH/POP - from LH(RSTBI) +TCPIOP: HRRZ T,R + SUBI T,IOCHNM(U) + CAIN I, + SKIPA T,[77] ; IOPUSH, use 77 + ADDI T,1 ; IOPOP, use chan+1 + HLRZ I,(R) ; Get TCB index + HRRZ B,(R) ; Get direction + CAIN B,TCPDUI ; as a BP to chan # + SKIPA B,[XB$ICH (I)] + MOVE B,[XB$OCH (I)] + DPB T,B ; Store new saved channel # + POPJ P, + +; RESET - from RH(RSTBI) +; This doesn't have to do anything for a while yet. +TCPRST: + POPJ P, + +; FORCE - from LH(DFRCTB) +; Should force out the TCP segment currently being written, +; and give it a good shove (ie PUSH). +; A/ LH of IOCHNM word, in RH. +; H/ IOCHNM word +; R/ ,, +TCPFRC: METER("TCP: syscal force") + HRRZ B,(R) ; This should be a TCP output channel. + CAIE B,TCPDUO ; If not output, must be input, so + JRST OPNL2 ; say "wrong direction". + HLRZ I,(R) ; Get TCB index + CAIL I,XBL ; Ensure validity + BUG HALT,[TCP: FRC bad idx] + + ; Ensure that state allows sending anything. + CONO PI,NETOFF ; So state doesn't change while we think. + HRRZ J,XBSTAT(I) + CAIE J,.XSOPN + CAIN J,.XSCLW + CAIA + JRST OPNL7 ; Bad state, say "device not ready". + + PUSH P,R + MOVSI T,(TC%PSH) ; Set PUSH flag (but not ACK, to avoid + ; forcing send of empty buffer) + CALL TCPOFR ; Force out! Clobber many ACs. + CONO PI,NETON + POP P,R + JRST POPJ1 + + +; FINISH - from RH(DFRCTB) +; We already know that R is OK since FORCE looked at it first. +; In fact, I is still set up. +; R/ addr of IOCHNM word + +TCPFIN: METER("TCP: syscal finish") + MOVSI T,(%XBNOW) + TDNE T,XBSTAT(I) ; Wait until this bit is off (XBOCOS put on Q) + CALL UFLS + SKIPE XBORTQ(I) ; Hang until retransmit queue is empty. + CALL UFLS + JRST POPJ1 + +SUBTTL TCP STY connection routines + +; STYTCP - invoked by STYNTC routine during 1/2 sec clock, for +; STYs connected to TCP channels. +; R/ TTY # + +STYTCP: MOVE I,STYNTI-NFSTTY(R) ; Get TCB index for connection + LDB TT,[XB$STY (I)] ; Verify that TCB thinks we're hooked up + CAIE TT,(R) + BUG ; It doesn't?? + + ; First, check for and transfer any input for the STY. + HLRZ T,XBSTAU(I) ; Get input state + SKIPG TCPTBI(T) ; Make sure we can do input. + JRST STYTC9 ; Nope, must disconnect. +STYTC1: SOSGE XBIBC(I) + JRST [ CALL TCPIBD ; Discard input buffer if any + HRRZ A,XBITQH(I) ; Any more input avail? + JUMPE A,STYTC5 ; No, done, check for output. + CALL TCPIBG ; Have some! Set it up. Shd never hang. + JFCL + JRST STYTC1] + ILDB A,XBIBP(I) ; Get the byte + TRNE A,200 ; Special char? + JRST [ AOS XBIBC(I) ; Ugh, must back up and get user's attention + MOVSI B,8._14 ; Back up both count and 8-bit byte pointer + ADDM B,XBIBP(I) ; by adding to P field of BP + JRST STYTC9] ; Go disconnect. + EXCH R,I ; I gets TTY #, R gets TCB index + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + CALL NTYI5 ; Give the char to TTY input interrupt level + CONO PI,TTYON + POP P,R ; Note reverse order, so R gets TTY # + POP P,I ; and I gets TCB index again. + JRST STYTC1 ; Try for more input. + + ; Transfer chars from STY output to TCP connection +STYTC5: SKIPGE TTYOAC(R) ; Do we have any output? + JRST STYTC7 ; No, all's done, force out what we did. + HRRZ A,XBSTAU(I) ; Check output state + SKIPG TCPTBO(A) ; to verify that TCB is healthy. + JRST STYTC9 ; Ugh, go disconnect STY. + MOVSI A,(%XBMPL) + IORM A,XBSTAT(I) ; Lock COS against PI level snarfing + + SKIPE XBOCOS(I) + SKIPG E,XBOBC(I) ; Get # bytes room in output buff + JRST [ + ; Set up buffer, etc, possibly forcing out existing buff. + PUSH P,R + CALL TCPOSB ; Invoke special hang-less routine. + JRST [POP P,R ; If can't get any more room, jump to STYTC6 + JRST STYTC6] + POP P,R + SKIPG E,XBOBC(I) ; OK, should have bytes now. + BUG + JRST .+1] + SKIPN D,XBOBP(I) ; Get BP into buffer + BUG + EXCH R,I + CONO PI,TTYOFF + MOVEM D,DBBBP ; Set up buffer for TTY output interrupt level + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ; Generate output + SETZM TYPNTF + POP P,R + EXCH R,I ; Restore I/ TCB #, R/ TTY # + MOVE D,DBBBP ; Advance pointers + MOVEM D,XBOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ; Minus # chars output generated + CONO PI,TTYON + ADDM E,XBOBC(I) + JRST STYTC5 ; Check for more output + + ; No more output or we can't get more room, force out what + ; we've currently got. +STYTC6: CALL TCPUII ; Reactivate STY (expensive crock, but...) +STYTC7: MOVSI A,(%XBMPL) ; Unlock the COS + ANDCAM A,XBSTAT(I) + MOVSI T,(TC%PSH) ; PUSH this stuff + CALL TCPOFR ; Force out buffer + JRST STYNT8 ; Then go check other STYs. + + + ; Disconnect STY and get user's attention. Note this may be + ; buggy in that STY output has not yet been transferred to the + ; net by the time we get here, if we're here due to a 200 char. +STYTC9: PUSH P,I + MOVEI I,(R) ; Set up I/ TTY # + CALL NSTYN0 ; Disconnect it + BUG + POP P,I + CALL TCPUII ; Wake up the user program + JRST STYNT8 ; Go handle other STYs. + +IFN 0,[ +;CALLED AT CLOCK LEVEL FROM STYNTC WHEN A CHAOS STY IS ENCOUNTERED +;TTY NUMBER IN I & R +STYCHA: MOVE I,STYNTI-NFSTTY(R) ;GET CHAOS INDEX + MOVE TT,CHSSTA(I) + TLNN TT,%CFSTY + JRST 4,. ;CHAOS CONNECTION CLAIMS NOT BE CONNECTED? + JUMPL TT,STYCH9 .SEE %CFOFF ;OK TO USE? IF NOT, DISCONNECT + SKIPGE TTYOAC(R) ;ANY OUTPUT? + JRST STYCH1 ;NO, CHECK FOR INPUT + SKIPN D,CHSOBP(I) ;IF BUFFER ALLOCATED, USE IT + JRST [ SKIPG CHSNOS(I) ;OTHERWISE ALLOCATE ONE + JRST STYCH1 ;WINDOW FULL, WAIT UNTIL REACTIVATED + PUSHJ P,CHABGI + JRST STYCH3 ;NO CORE, WAIT ONE CLOCK TICK + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSOBP(I) + MOVEI E,%CPMXC + MOVEM E,CHSOBC(I) + JRST .+3 ] + SKIPG E,CHSOBC(I) + JRST STYCH4 ;BUFFER FULL, FORCE IT + EXCH R,I ;I GETS TTY, R GETS CHAOS + CONO PI,TTYOFF + MOVEM D,DBBBP ;SET UP BUFFER FOR TTY OUTPUT INTERRUPT LEVEL + MOVEM E,DBBCC + MOVEM E,DBBCC1 + PUSH P,R + SETOM TYPNTF + PUSHJ P,TYP ;GENERATE OUTPUT + SETZM TYPNTF + POP P,R + EXCH R,I ;I GETS CHAOS, R GETS TTY + MOVE D,DBBBP ;ADVANCE POINTERS + MOVEM D,CHSOBP(I) + MOVE E,DBBCC + SUB E,DBBCC1 ;MINUS # CHARS OUTPUT GENERATED + CONO PI,TTYON + ADDM E,CHSOBC(I) +STYCH4: PUSHJ P,CHAFC1 ;FORCE THE BUFFER + JRST STYCHA ;CHECK FOR MORE OUTPUT + +STYCH3: PUSHJ P,CHINTI ;REACTIVATE SO WILL COME BACK ON NEXT CLOCK TICK +STYCH1: SOSGE CHSIBC(I) ;GET INPUT, IF ANY + JRST [ PUSHJ P,CHAIBD ;DISCARD EXHAUSTED INPUT BUFFER, IF ANY + HLRZ A,CHSIBF(I) + JUMPE A,STYNT8 ;NONE, RETURN TO STYNTC + LDB TT,[$CPKOP(A)] + CAIE TT,%CODAT + JRST STYCH9 ;RANDOM PACKET, DISCONNECT + PUSHJ P,CHPKIA ;ACKNOWLEDGE GOBBLING OF THIS PACKET + SOS CHSNBF(I) ;REMOVE BUFFER FROM RECEIVE LIST + MOVEI Q,CHSIBF(I) + PUSHJ P,CHAQGF + LDB E,[$CPKNB(A)] ;SET UP FOR BYTE STREAM INPUT + MOVEM E,CHSIBC(I) + MOVEI D,%CPKDT(A) + HRLI D,440800 + MOVEM D,CHSIBP(I) + JRST STYCH1 ] + ILDB A,CHSIBP(I) ;GET CHARACTER OF INPUT + TRNE A,200 + JRST [ AOS CHSIBC(I) ;WOOPS, SPECIAL CHARACTER, NEEDS USER ATTENTION + MOVSI A,8_14 ;SO PUT IT BACK AND DISCONNECT + ADDM A,CHSIBP(I) + JRST STYCH9 ] + EXCH R,I ;I GETS TTY, R GETS CHAOS + PUSH P,R + PUSH P,I + CONO PI,TTYOFF + PUSHJ P,NTYI5 ;GIVE CHARACTER TO TTY INPUT INTERRUPT LEVEL + CONO PI,TTYON + POP P,R + POP P,I ;I GETS CHAOS, R GETS TTY ((POP IN REVERSE ORDER)) + JRST STYCH1 ;TRY FOR MORE INPUT + +STYCH9: PUSH P,I + MOVE I,R ;I GETS TTY + PUSHJ P,NSTYN0 ;DISCONNECT THE STY + JRST 4,. + POP P,I ;I GETS CHAOS + PUSHJ P,CHINTI ;WAKE UP THE TELNET SERVER + JRST STYNT8 ;GO HANDLE OTHER STYS +] ;ifn 0 + +SUBTTL Other TCP system call functions + +; TCPRQ - Handle .CALL NETRFC, return port # of next pending +; request for connection (SYN). +; Perhaps return a uniquizer in LH, so know when see +; the same request again? + +TCPRQ: TRNE C,%NQREF ; Skip if just getting, not flushing. + JRST TCPRQ5 + METER("TCP: syscal netrfc get") + CONO PI,NETOFF ; In case a RST comes for it or something. +; MOVE I,TCPRQL ; Get last thing stored on queue + SETOB B,D ; Look for any match + CALL TCPRQS ; Search the queue... + JUMPL A,OPNL4 ; None, say "file not found". + MOVEI I,(A) + LDB A,[.BP TH%DST,XBPORT(I)] ; Get local port # for the SYN + HRLI A,(I) ; And put index in LH as uniquizer. + CONO PI,NETON + JRST POPJ1 + +TCPRQ2: BUG CHECK,[TCP: Pending SYN smashed!] + RET + + ; Refuse indicated connection. +TCPRQ5: METER("TCP: syscal netrfc ref") + CAIGE W,2 ; Must have 2 args + JRST OPNL30 ; "Too few args" + HLRE D,A ; Get identifier + HRRE B,A + CONO PI,NETOFF + CALL TCPRQS ; Search for the queued SYN + JUMPL A,OPNL4 + + ; Now must refuse connection. + MOVEI I,(A) + MOVEI Q,XBITQH(I) + CALL PKQGF(PK.TCP) ; Get queued SYN segment + SKIPN XBITQH(I) ; Should have been only one + SKIPG R,A ; and should have been one! + BUG HALT + CALL TXBFLS ; Flush the TCB. + SOSGE TCPRQN ; Decrement count of queued SYNs + BUG HALT + HLRZ W,PK.IP(R) ; Move all this setup somewhere modular. + HLRZ H,PK.TCP(R) + LDB TT,[PK$TDL (R)] + MOVE E,TH$CTL(H) + TLNE E,(TC%SYN) + ADDI TT,1 + TLNE E,(TC%FIN) + ADDI TT,1 + CALL TSISLR ; Respond to this req with RST+ACK + CONO PI,NETON + JRST POPJ1 + +; TCPRQS - Search pending-RFC queue. Must be called with NETOFF!! +; B/ local port # (-1 for any) +; D/ Index #, -1 for any (searches back from last one stored) +; Clobbers T,Q +; Returns +; A/ Index to matching SYN (-1 if no match) + +TCPRQS: JUMPGE D,TCPRQ7 + MOVE A,TCPRQL + MOVEI C,1 +TCPRQ6: HRRZ T,XBSTAT(A) ; See if right state + CAIN T,.XSSYQ + JRST [ LDB T,[.BP TH%DST,XBPORT(A)] + CAIL B, + CAMN T,B + RET + JRST .+1] + SOJGE A,TCPRQ6 + MOVEI A,XBL-1 + SOJGE C,TCPRQ6 +TCPRQ9: SETO A, + RET + +TCPRQ7: SKIPL A,D + CAIL D,XBL + JRST TCPRQ9 + HRRZ T,XBSTAT(A) ; Verify state + CAIE T,.XSSYQ + JRST TCPRQ9 + LDB T,[.BP TH%DST,XBPORT(A)] ; Got one! Get local port # + CAIL B, + CAIN T,(B) ; Must match given arg unless -1 + RET ; Won! + JRST TCPRQ9 + +ifn 0,[ +TCPRQS: MOVEI A,TCPRQH-PK.TCP +TCPRQ6: MOVEI Q,(A) ; Save ptr to prev node + HRRZ A,PK.TCP(A) ; Get ptr to next PE + JUMPE A,TCPRQ8 ; If not there, return 0 as error. + JUMPL D,TCPRQ7 + CAIE A,(D) ; See if identifier matches + JRST TCPRQ6 ; Jump if not. +TCPRQ7: HLRZ T,PK.TCP(A) ; Yes, verify port number + CAIN T, ; Ensure ptr to TCP header exists. + BUG HALT + LDB T,[TH$DST (T)] + CAIE T,(B) + JRST TCPRQ6 ; Nope, get next thing. + + ; Found it! Take off list, a bit tricky. + SOSGE TCPRQN ; Decrement count of entries + BUG HALT + MOVSI T,(%PQFL2) ; Clear the on-list flag for PK.TCP + ANDCAM T,PK.FLG(A) +IFN 2-PK.TCP,.ERR TCPRQS must fix %PQFL2 to match PK.TCP + HRRZ T,PK.TCP(A) ; Get its next-ptr + HRRM T,PK.TCP(Q) ; Store in node previous to this one. + JUMPN T,TCPRQ8 ; If wasn't last thing, all's well. + CAIN Q,TCPRQH-PK.TCP ; Last thing. If prev was actually hdr, + SETZ Q, ; must store zero. + HRLM Q,TCPRQH ; Set new "last" ptr in hdr. +TCPRQ8: + RET + +] ;ifn 0 + +; TSOINI - set up a raw PE for use as a TCP output segment. Means +; setting IP, TCP header pointers properly, so that all fields +; are contiguous. Note that PK.TCI is set to indicate XBSMSS(I) +; bytes of (available) data storage! +; Sets up PK.IP, PK.TCP, and PK.TCI. +; R/ PE ptr +; I/ TCB connection index (val put into PK.TCI) +; Returns with R, W, H pointing to PE, IP hdr, and TCP hdr. +; +; TSOINA - Ditto, but takes arg in A and only clobbers T (doesn't set W, H) + + +TSOINI: HRRZ W,PK.BUF(R) ; Get addr of buffer + HRLM W,PK.IP(R) ; Store as IP header addr + MOVEI H,(I) ; Set up TCI with all fields. + ANDI H,PK%TCB + IOR H,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM H,PK.TCI(R) ; + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + MOVEI H,%TCPHL(W) ; For now, this will do. + HRLM H,PK.TCP(R) ; Store as TCP header addr + RET + +TSOINA: HRRZ T,PK.BUF(A) ; Get addr of buffer + HRLM T,PK.IP(A) ; Store as IP header addr + ADDI T,%TCPHL ; For now, this will do to get TCP hdr. + HRLM T,PK.TCP(A) ; Store as TCP header addr + MOVEI T,(I) ; Set up TCI with all fields. + ANDI T,PK%TCB + IOR T,[<<%TCPHL*4>_<.TZ PK%TDO,>>] + MOVEM T,PK.TCI(A) ; Set up index and header length fields + MOVE H,XBSMSS(I) ; Allow XBSMSS(I) bytes with assumed offset. + DPB H,[PK$TDL (R)] + RET + +; TCPUSI - TCP User State-change Interrupt. Called each time connection +; changes state (.XSnnn) or I/O queues start/end. Always tries +; to interrupt user, except for change %NTWRT->%NTOPN on output +; and %NTINP->%NTOPN on input. +; Moon: Interrupt when input rcvd and buff empty, or output full +; and becomes reasonably non-full. +; Clobbers T, Q + +TCPUSI: METER("TCP: tcpusi called") + CALL TXBIST ; Check input state + HLRZ Q,XBSTAU(I) + CAIE T,(Q) ; New state? + JRST TCPUS3 ; Yes, go handle. +TCPUS2: CALL TXBOST + HRRZ Q,XBSTAU(I) + CAIN T,(Q) + RET + + ; Output channel state change + ; Q/ old state, T/ new state (%NT values, not .XS) + HRRM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTOPN ; If was open + CAIE T,%NTWRT ; Changing to buff-full + CAIA + RET ; Then don't interrupt. + MOVE Q,TCPTBO(Q) + CAMN Q,TCPTBO(T) ; See if meta-state change + RET ; Nope, ignore. + LDB Q,[XB$OCH (I)] ; Yes, get channel # + METER("TCP: User O ints") + CALRET TCPUS5 + + ; Input channel state change +TCPUS3: HRLM T,XBSTAU(I) ; Store new state (old in Q) + CAIN Q,%NTINP ; If was input avail + CAIE T,%NTOPN ; Changing to plain open + CAIA + JRST TCPUS2 ; Then don't interrupt. + MOVE Q,TCPTBI(Q) + CAMN Q,TCPTBI(T) ; See if meta-state change + JRST TCPUS2 ; No + ; Drop thru to interrupt + + ; Give input channel interrupt +TCPUII: METER("TCP: User I ints") + LDB Q,[XB$STY (I)] ; See if hooked to STY + JUMPN Q,TCPUSS ; Jump to handle STY stuff if so. + LDB Q,[XB$ICH (I)] ; No, just get input chan + CALL TCPUS5 + JRST TCPUS2 + + ; Give interrupt to STY that TCB is connected to. + ; Q/ TTY # +TCPUSS: CONO PI,PIOFF ; Protect list hacking + SKIPL STYNTL-NFSTTY(Q) ; Don't put on list twice + JRST PIONJ + MOVE T,STYNTA ; Add to list + MOVEM T,STYNTL-NFSTTY(Q) + MOVEM Q,STYNTA + JRST PIONJ + + ; Interrupt on channel in Q. +TCPUS5: JUMPE Q,CPOPJ ; May be no channel there. + PUSH P,U + SKIPN U,XBUSER(I) + BUG HALT ; Jumpe above should catch this. + MOVSI T,(SETZ) + IORM T,PIRQC(U) + CAIN Q,77 ; If IOPUSH'ed, no interrupt. + JRST POPUJ + MOVE T,CHNBIT-1(Q) ; Q is -1 based. + AND T,MSKST2(U) + IORM T,IFPIR(U) + POP P,U + RET + + ; Input chan state type. Pos # means can read. + ; 0 is pre-open, 1 is open, 2 is input avail, -1 is post-open. +TCPTBI: OFFSET -. +%NTCLS:: 0 ; 0 CLS +%NTLSN:: 0 ; 1 LSN +%NTSYR:: 0 ; 2 RFC +%NTCLU:: -1 ; 3 RCL? +%NTSYN:: 0 ; 4 RFS +%NTOPN:: 1 ; 5 OPN +%NTWRT:: 1 ; 6 RFN +%NTCLX:: -1 ; 7 CLW +%NTCLI:: 1 ; 10 CLI +%NTINP:: 2 ; 11 INP + OFFSET 0 + + ; Output chan state type. Pos # means can write. + ; 0 is pre-open, 1 is open, 2 is buff full, -1 is post-open. +TCPTBO: OFFSET -. +%NTCLS:: 0 +%NTLSN:: 0 +%NTSYR:: 0 +%NTCLU:: 1 +%NTSYN:: 0 +%NTOPN:: 1 +%NTWRT:: 2 +%NTCLX:: -1 +%NTCLI:: 1 +%NTINP:: 1 + OFFSET 0 + + +SUBTTL TCP Input Interrupt Level + +; TCPIS - Process TCP Input Segment (PI level) +; R/ PE ptr to packet, not on any list. +; PK.BUF is set, ditto IP/TCP header pointers. +; W/ addr of IP header +; H/ addr of IP data (start of TCP header) +; J/ host-table index for address datagram received from. +; Can clobber all ACs except P, returns with POPJ. +; AC usage during incoming segment processing: +; R/ PE ptr to packet +; W/ addr of IP header +; H/ addr of TCP header +; I/ TCB index (if any) +; J/ TCB connection state +; TT/ # bytes of TCP data in segment +; E/ ,, +; D/ Segment Sequence no. +; Flags for RH of E +%TSISL==1 ; Seq starts to left of rcv.nxt +%TSISR==2 ; Seq starts to right of " ; if neither on, is = rcv.nxt +%TSIFL==4 ; Bad seq, flush after handling RST/ACK/URG + +TCPIS: METER("TCP: Segs rcvd") + SKIPN TCPUP ; Unless TCP claims to be up, + JRST TSIFL ; Throw it away, no TCP yet, sigh. + + ; First verify that this is a valid TCP segment, by + ; checksumming it (sigh!). TT gets total # bytes in TCP segment. + CALL THCKSI ; Get checksum in A for segment + LDB B,[TH$CKS (H)] ; Get segment's checksum + CAME A,B ; Should match. + JRST TSIF01 ; Failed, go bump err count and flush it. + LDB T,[TH$THL (H)] ; Find TCP header length in words + LSH T,2 ; Make it in octets + SUBI TT,(T) ; TT now has # octets of segment data. + + ; Contents of segment have been validated (more or less), + ; now set up convenient context values + ; PK.TCI contents + ; E/ Segment control flags (in LH) + ; TT/ SEG.LEN + HLLZ E,TH$CTL(H) ; Get word with segment control flags + DPB T,[PK$TDO (R)] ; Store offset of data (from THCKSI) + DPB TT,[PK$TDL (R)] ; Store length of data + TLNE E,(TC%SYN) ; Note that SYN counts in seg.len + ADDI TT,1 ; so allow for it + TLNE E,(TC%FIN) ; And do same thing for FIN. + ADDI TT,1 ; Either way, get SEG.LEN set up in TT. + + ; Then see if any TCB exists for this segment. + SKIPE A,TH$SRC(H) ; Get source/dest port word + SKIPN B,IP$SRC(W) ; Get source addr from IP header + JRST TSIF02 ; Flush anything with zero field. + LSH B,-4 ; Right-justify the addr + MOVSI I,-XBL +TSI02: CAMN A,XBPORT(I) ; Loop til we find it + CAME B,XBHOST(I) +TSI03: AOBJN I,TSI02 + JUMPL I,TSI05 ; Jump if found existing connection + JRST TSISQ ; Jump if no existing connection. + +TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? + JRST TSI02 ; LH must have crud still set, ignore for now + BUG CHECK,[TCP: Clsed TCB has active port/host] ; Shouldn't happen! + SETZM XBHOST(I) ; If continued, fix up. + JRST TSI02 + + ; Connection exists, TCB index now in I. + ; Set up a little more context (PK.TCI and J) +TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info + MOVEM J,XBNADR(I) ; Save host-table idx of addr this seg is from. + HRRZ J,XBSTAT(I) ; Get connection state + CAIL J,.XSTOT ; Highest possible state. + BUG HALT,[TCP: Bad conn state] + METER("TCP: IS all states") + XCT XSMTRS(J) ; Bump meter for each state + CAIG J,.XSSYN ; If it's CLS, SYQ, LSN or SYN-SENT + JRST @(J)[ ; then process specially. + TSI04 ; Closed??? + TSISQQ ; Syn-Queued? (Probably re-trans) + TSILS ; Listen + TSISS] ; Syn-sent + ; Drop through to perform general sequence-number checking. + + ; Check Sequence Number!!! + ; This code doesn't do two things: + ; 1) it doesn't keep around stuff that arrives to the + ; right of rcv.nxt. + ; 2) for situation where seg.seq number is valid, + ; (i.e. seq =< rcv.nxt) the code punts if + ; end of seg is out of window. It should simply + ; expand the window! + LDB D,[TH$SEQ (H)] ; Get sequence number + JUMPG TT,TSI10 ; Jump if data present. + JUMPL TT,TSIF03 ; No data. Jump if error (neg data!) + + ; No data in this segment, it is probably a simple ACK. + CAME D,XBRNXT(I) ; Seg.seq == snd.nxt (as expected?) + JRST TSI01 + METER("TCP: 0-len seg seq match") + JRST TSI20 ; Yep, seg is acceptable instantly! + +TSI01: SKIPN C,XBRWND(I) ; Have some receive window? + JRST TSI09 + ADD C,XBRNXT(I) ; Get nxt+wnd + TLZ C,%MOD32 ; all arith mod 32 + CMPSEQ XBRNXT(I),=<,D,<,C,TSI07,TSI08 + JRST TSI20 ; Within rcv window, buy it + +TSI07: METER("TCP: 0-len seg before rcv window") + JRST TSISNE + +TSI08: METER("TCP: 0-len seg after rcv window") + JRST TSISNE + + ; 0-data, 0-window, and SEG.SEQ != RCV.NXT +TSI09: METER("TCP: Ifl 0-len 0-window seqerr") + JRST TSISNE ; Sigh, flush it. + + ; Seq number check when data present. +TSI10: CAME D,XBRNXT(I) ; Is seq # what we expect (seq = nxt)? + JRST TSI11 + SKIPE C,XBRWND(I) ; Yes! And is our window open? + JRST TSI20 ; Yes! Fast dispatch! + + ; Data segment, with valid sequence number, but our window is + ; zero. See if there's some way we can avoid throwing away the + ; segment... if we can't take it then still must handle + ; ACK/URG/RST flags. For now, we really handle this at TSI70. +TSI12: METER("TCP: 0-wnd data seg") + JRST TSI20 + + ; Sequence # isn't exactly what we hoped for, see if the + ; segment overlaps a valid portion of sequence space. +TSI11: SKIPN C,XBRWND(I) ;#3: Get window, is it zero? + MOVEI C,512. ; If zero, substitute a dummy window. + + ; Both len>0 and wnd>0. + ADD C,XBRNXT(I) ; Get nxt+wnd + TLZ C,%MOD32 ; all arith mod 32 + ;#4a: nxt =< seq < nxt+wnd + CMPSEQ XBRNXT(I),=<,D,<,C,TSI13 ; Jump if fail this test, try 4b. + + ; Come here when sequence # is OK, but segment starts farther on + ; than we want, i.e. there is a "hole" between rcv.nxt and seg.seq. + ; Eventually we could keep this segment around, to speed up + ; throughput for nets that get packets out of order, but for + ; now we'll just flush it and force a retransmit. + METER("TCP: Iseg hole") + TRO E,%TSISR+%TSIFL ; Say starts to right, and flush later. + JRST TSI20 ; Go process RST/ACK/URG etc. + +TSIF12: METER("TCP: Ifl seq dup") ; Segment falls in prev rcvd data. + MOVE D,XBRNXT(I) ; Fake out, say seq # OK + TRO E,%TSIFL ; and don't process data. + JRST TSI20 ; Go handle RST/ACK/URG. + +TSIF13: METER("TCP: Ifl seq int err") ; Shouldn't ever happen, due to + JRST TSISNE ; right-bound check code above. +TSIF14: METER("TCP: Ifl seq old") + JRST TSISNE +TSIF15: METER("TCP: Ifl monster seg") ; Impossible error + JRST TSISNE + + ; Segment does not overlap window to right, so see if it + ; overlaps to left, i.e. sequence # falls within data we have + ; already received. +TSI13: MOVE A,XBRNXT(I) + SUBI A,%TCPMB ; Make a fictional lower bound + CAIGE A, + ADD A,[1_32.] ; Keep bound mod 2^32 + CMPSEQ A,=<,D,=<,XBRNXT(I),TSIF14,TSIF13 + + ; Yep, falls within received data. It's probably a duplicate + ; retransmitted segment; see if there's any new data on right side. + ; Note that we are not using XBRWND here, because as long as we + ; have a non-zero window we will always accept everything in the + ; segment. So we create another fictional bound to the right. + ADD A,[%TCPMB*2] ; Get back to other side of rcv.nxt + TLZ A,%MOD32 ; Keep mod 2^32 + MOVE C,D + ADDI C,-1(TT) ; Get seq+len-1 + TLZ C,%MOD32 + ;#4b: nxt =< seq+len-1 < nxt+wnd? + CMPSEQ XBRNXT(I),=<,C,=<,A,TSIF12,TSIF15 ; If fail this too, error. + + ; Aha, have some new data in spite of being overlapped with some + ; previously received data! Here, we + ; twiddle things so that it appears to start properly at + ; rcv.nxt. This is done without touching the segment contents + ; at all, just modifying the packet entry info. + METER("TCP: Iseg ovlap") + MOVE A,XBRNXT(I) ; Get rcv.nxt + CAMGE A,D ; Make sure it's greater than seg.seq + TLO A,(1_32.) ; Mod 2^32 screw, make it greater (add 33d bit) + SUB A,D ; Find # octets of sequence space diff + CAMLE A,TT ; Shouldn't be greater than seg.len!! + BUG CHECK,[TCP: Trim error] + SUBI TT,(A) + JUMPLE TT,TSIF12 ; If nothing left, drop this segment. + TLZE E,(TC%SYN) ; Clear SYN since it's at front. + SUBI A,1 ; If it was set, reduce cnt of actual data + LDB T,[PK$TDL (R)] ; that we're going to flush. Get cnt + SUBI T,(A) ; Decrement # valid data bytes in segment + DPB T,[PK$TDL (R)] ; Put back + LDB T,[PK$TDO (R)] ; Also adjust offset to valid data + ADDI T,(A) ; Increment to point at new data + DPB T,[PK$TDO (R)] ; Put back + MOVE D,XBRNXT(I) ; Now say seg.seq = rcv.nxt! + ; Segment sanitized, drop through. + SKIPN XBRWND(I) ; Only proceed if our window not zero. + JRST TSI12 ; It's zero! May have to flush it... + + ; Fall through to TSI20 for RST/ACK/URG processing. + + ; Now check RST +TSI20: TLNE E,(TC%RST) ; RST bit set? + JRST TSIRST ; Yeah, go process it. + + ; Now check security/precedence + JFCL ; ho ho ho + + ; Now check SYN bit +TSI40: TLNE E,(TC%SYN) ; SYN bit set? + JRST TSISYN ; Yeah, go process it (basically error) + + ; Now check ACK bit +TSI50: TLNN E,(TC%ACK) ; ACK bit set? + JRST TSIF50 ; No, error. Drop segment. + JRST @TSI51(J) ; Yes, dispatch depending on state. +TSI51: OFFSET -. +.XSCLS:: [JRST 4,TSI51] ; Closed +.XSSYQ:: [JRST 4,TSI51] ; ITS: Syn-Queued +.XSLSN:: [JRST 4,TSI51] ; Listen +.XSSYN:: [JRST 4,TSI51] ; Syn-Sent +.XSSYR:: TSI53 ; Syn-Rcvd +.XSOPN:: TSI54 ; Established (open) +.XSFN1:: TSI54 ; Fin-Wait-1 +.XSFN2:: TSI54 ; Fin-Wait-2 +.XSCLW:: TSI54 ; Close-Wait +.XSCLO:: TSI54 ; Closing +.XSCLA:: TSI54 ; Last-Ack +.XSTMW:: TSIATW ; Time-Wait +.XSTOT:: OFFSET 0 + + + ; SYN-RCVD state, handling ACK. +TSI53: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + CMPSEQ B,=<,A,=<,XBSNXT(I),TSISRA ; Jump if fail + MOVEI J,.XSOPN ; ACK wins, we're now open! + HRRM J,XBSTAT(I) ; Set new state, fall through to handle. + CALL TCPUSI ; Adjust user state. + ; Must initialize SND.WL1, SND.WL2, and SND.WND. + ; Maybe later merge this with TSI55. + MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + MOVEM B,XBSAVW(I) ; and make avail window be same as send wind. + JRST TSI54X ; Skip repeating the ACK test. + + ; Handle ACK while in open state (also other receive-OK states) +TSI54: LDB A,[TH$ACK (H)] ; Get ACK field + MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC + ; Test: snd.una =< seg.ack =< snd.nxt + ; If seg.ack < snd.una, go to TSI60 and ignore the ACK. + ; If seg.ack > snd.nxt, go to TSISAK to drop segment (ACKing) + CMPSEQ B,=<,A,=<,XBSNXT(I),TSI60,TSISAK ; Jump if fail + + ; ACK is fine. Update SND.UNA and clean up retransmit queue. +TSI54X: MOVEM A,XBSUNA(I) ; Update snd.una + + ; Must check retransmit queue slowly to find right place to flush, + ; if any. + ; Procedure is: (1) pull off 1st thing on queue. + ; (2) If the new 1st thing has a seq # =< snd.una, + ; then can flush what we pulled off, and try again. + ; (3) otherwise put it back on at front. +TSI54A: MOVE C,A ; Save ACK # in C +TSI54B: MOVEI Q,XBORTQ(I) ; Get pointer to retrans q + CALL PKQGF(PK.TCP) ; Get 1st thing on queue + JUMPE A,TSI54Z ; None left? Win! + TRCPKT A,"TSI54B Mabye flush from rexmit Q" + MOVE T,PK.FLG(A) ; Check packet flags, + TLNN T,(%PKODN) ; to make sure output was completed. + JRST TSI54Y ; Not done yet, so don't flush yet. + HRRZ B,XBORTQ(I) ; Get pointer to next thing + JUMPE B,[CAMN C,XBSNXT(I) ; No next thing, compare with snd.nxt + JRST TSI54D ; Equal, can flush! + JRST TSI54Y] ; If not equal, must have ack < snd.nxt + ; so previous segment can't be flushed. + HLRZ B,PK.TCP(B) ; Get addr of TCP hdr for 2nd queued segment + LDB B,[TH$SEQ (B)] ; Get sequence # for it +TSI54C: CMPSEQ B,=<,C,=<,XBSNXT(I),TSI54Y ; See if ACK comes after that # + + ; Hurray, matches or exceeds this seq #, + ; So we can flush the seg we pulled off! +TSI54D: TRCPKT A,"TSI54D Flushing from Q" + TLO T,(%PKFLS) ; Tell IP to forget it if queued + MOVEM T,PK.FLG(A) + CALL PKTRT ; Flush if not otherwise occupied +TSI54E: MOVE A,TIME ; Crock crock, set up new timeout. + ADD A,TCPTMO + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Reset retry counts + SOSGE XBORTL(I) ; Decrement # segments on retrans q. + BUG HALT,[TCP: Retrans Q count error] + JRST TSI54B ; Keep going as long as we can. + +TSI54Y: MOVEI Q,XBORTQ(I) + CALL PKQPF(PK.TCP) ; Put back on front of queue +TSI54Z: MOVE A,C ; Restore ACK # to A. + + ; Now see if send window should be updated. + CAMN D,XBSWL1(I) ; Fast check first, WL1 = SEQ? + JRST TSI55C ; Yes, go check ACK then + MOVE T,XBSWL1(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL1(I),<,D,<,T,TSI56 ; Check if wl1 < seq < wl1+xxx + JRST TSI55 ; Yes, must update window. +TSI55C: MOVE T,XBSWL2(I) + ADDI T,-1 + TLZ T,%MOD32 + CMPSEQ XBSWL2(I),=<,A,=<,T,TSI56 ; Fall-thru win if snd.wl2 =< seg.ack + +TSI55: MOVEM A,XBSWL2(I) ; Yes! Update send window, set WL2 to ACK + MOVEM D,XBSWL1(I) ; and WL1 to SEQ + LDB B,[TH$WND (H)] + MOVEM B,XBSWND(I) ; and snd.WND to seg.WND. + ; Drop thru + + ; Either SND.UNA or SND.WND was probably updated, so lets update + ; SND.AVW also (available window). The following computes + ; WND - (NXT - UNA) and assumes UNA =< NXT. +TSI56: MOVE A,XBSNXT(I) + CAMGE A,XBSUNA(I) ; If need mod 32 wrap, + TLO A,(1_32.) ; wrap up the number that should be higher. + SUB A,XBSUNA(I) ; Find NXT-UNA (# bytes not yet acked) + CAIL A,0 + CAILE A,177777 ; Make simple check + BUG INFO,[TCP: Bad AVW calc, UNA=],OCT,XBSNXT(I),[NXT=],OCT,XBSUNA(I) + MOVE B,XBSWND(I) + SUBI B,(A) ; Find # bytes we can still send + CAIGE B, ; Make sure it's not negative! + SETZ B, + MOVEM B,XBSAVW(I) + + ; Done with ACK processing for OPEN state, see if must handle + ; idiosyncracies of other states. +TSI57: CAIN J,.XSOPN ; Skip other checks if state is OPEN (normal) + JRST TSI60 ; Go check for URG etc. + CAIN J,.XSCLW + JRST TSI80 + CAIN J,.XSFN1 + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, enter FIN-WAIT-2 + JRST TSI60 ; Not yet. + MOVEI J,.XSFN2 ; Yes, FIN was ACKed, change state. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Call this for any state change. + LDB T,[XB$ICH (I)] ; Do we have an input chan? + JUMPN T,TSI60 ; If so, CLOSE will handle the wrapup. + MOVE T,TIME ; No, must set timeout. + ADDI T,2*60.*30. ; Use 2*MSL + MOVEM T,XBORTT ; set timeout. + JRST TSI60] + CAIN J,.XSFN2 + JRST [ ; If retrans queue empty, transmit-chan CLOSE done. + JRST TSI60] + CAIN J,.XSCLO + JRST [ SKIPE XBORTQ(I) ; If our FIN is ACK'd, + JRST TSIF55 ; No-- flush the segment. + CALL TSITMW ; then enter TIME-WAIT state, start timeout. + JRST TSI80] ; Then go check for FIN, etc. + CAIN J,.XSCLA ; LAST-ACK waiting for ACK of our FIN. + JRST [ SKIPE XBORTQ(I) ; If our FIN has been ACK'd, + JRST TSIF56 ; No-- flush the segment. + METER("TCP: FIN acked in .XSCLA") + CALL TXBFLP ; Flush the TCB immediately, PI level + JRST TSIFL] ; then flush the segment. + BUG CHECK,[TCP: Bad ACK state] + + ; Check the URG bit. The only states which get to this + ; point are OPEN, FIN-WAIT-1, and FIN-WAIT-2. +TSI60: TLNN E,(TC%URG) ; Segment has urgent pointer set? + JRST TSI70 ; Nope, on to next step. + LDB A,[TH$UP (H)] ; Get SEG.UP (urgent ptr from segment) + + ; This is where URGENT should be handled!!!! + ; Drop through + + ; Finally process segment text! + ; Only states OPEN, FIN-WAIT-1 and FIN-WAIT-2 can get here. +TSI70: TRNE E,%TSIFL ; If segment being flushed after ACK/URG, + JRST TSIF70 ; flush it now! + + LDB A,[PK$TDL (R)] ; Find # bytes of real data in segment + JUMPLE A,TSI80 ; If none, no text processing. + + TLNE E,(TC%FIN) ; Check that # bytes data == seg.len + JRST [ CAIE A,-1(TT) ; Must allow for funny non-data FIN. + JRST TSI71 ; Nope + JRST TSI72] ; Yep + CAIE A,(TT) ; # bytes data should == seg.len +TSI71: BUG CHECK,[TCP: seglen error] +TSI72: SKIPE D,XBRWND(I) ; Note D used for flag, + JRST TSI75 ; and is non-zero if no compaction done. + + ; Our window is zero, and technically we should throw away the + ; data now that all RST/ACK/URG processing has been done. However, + ; we try to see if we can possibly do a little compaction, since + ; the overhead of doing this is a lot less than the overhead + ; of re-processing the re-transmitted segment! + MOVE A,XBINPS(I) ; Check length of input queue + CAIL A,2 ; Must be at least 2 + SKIPN XBITQH(I) + BUG CHECK,[TCP: Wind & Queue both 0] + + ; See if it's worth trying to compact the input seg into the + ; last one received (which hasn't yet been seen by MP level) + HLRZ A,XBITQH(I) ; Get ptr to last input seg on queue + LDB B,[PK$TDO (A)] ; Get offset to data in old seg + LDB C,[PK$TDL (A)] ; See how much data is there + LDB T,[PK$TDL (R)] ; Find # bytes in new segment + ADDI B,(C) ; Get offset to end of data + MOVEI D,(B) + ADDI D,(T) ; Get projected total offset + CAML D,XBRMSS(I) ; Crock method of ensuring enuf room. + JRST TSI17 ; Not enough, we lose. Lose. Lose. + + ; Win! We're gonna compact! + METER("TCP: Iseg cmpct") + ADDI C,(T) ; Get new # bytes for prev seg + DPB C,[PK$TDL (A)] ; Store it in advance. + HLRZ D,PK.TCP(A) ; Find addr of TCP header in prev seg + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (R)] ; Get data offset for new segment + IDIVI B,4 + ADDI B,(H) ; Get addr for BP to start of new data + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to new data + ; D/ BP to end of old data + ; T/ # bytes of new data + MOVEI A,(T) ; Save # added data in A +TSI74: ILDB C,B + IDPB C,D + SOJG T,TSI74 + SETZ D, ; Clear D to indicate compaction done. + JRST TSI75 + + ; Can't accept segment data, period. +TSI17: METER("TCP: Ifl 0-wnd") + JRST TSIFL ; Flush the seg, sob. + +TSI75: MOVEI B,(TT) + ADDB B,XBRNXT(I) ; Update rcv.nxt value by adding seg.len + TLZE B,%MOD32 + MOVEM B,XBRNXT(I) ; Updated! + LDB B,[XB$ICH (I)] ; See if we have an input channel # + JUMPE B,[METER("TCP: IS fl no chan") + JRST TSI78] ; No input channel, so just throw away. + MOVEI C,(A) ; Save # bytes data. + ADDM A,XBINBS(I) ; Add new bytes to # bytes in input queue + JUMPE D,TSI78 ; If compaction done, that's all... + SKIPE B,XBINPS(I) ; If no segments previously on queue, + MOVE B,XBIBC(I) ; or current input buff has zero cnt, + ; then will definitely interrupt user later. + AOS XBINPS(I) ; Bump # segments on queue + + ; Check to see how much to reduce window by. + ; Amount is in C (defaults to amount we just received) + CALL TCPRWS ; Set receive window + + ; Finally add segment to queue! + MOVEI A,(R) ; Set up pointer to packet/segment + MOVEI Q,XBITQH(I) ; Point to TCP input queue + CALL PKQPL(PK.TCP) ; Add to end of queue, using TCP links. + JUMPN B,TSI78 ; Check, jump unless had no input before + CALL TXBIST ; If none, then must definitely change state! + HRLM T,XBSTAU(I) ; + CALL TCPUII ; And always give an input-avail int! + + ; Now must send an ACK, or rather arrange for one to be + ; sent soon. FIN is also checked here, so as to bypass the + ; code which assumes that XBRNXT hasn't been updated (if we are + ; here, it certainly has!) +TSI78: MOVSI A,(TC%ACK) ; Set bit asking for ACK to be sent. + IORM A,XBSTAT(I) + TLNN E,(TC%FIN) ; Perform FIN-bit check + JRST TSI90 ; None, all done with segment! + JRST TSI82 ; FIN exists, handle it (bypass bump of XBRNXT) + + ; Lastly check the FIN bit. + ; Connection states which do not expect to receive data come here + ; directly from ACK processing. +TSI80: TRNE E,%TSIFL ; If duplicate segment being flushed after + JRST TSIF70 ; ACK/URG, flush it now! + TLNN E,(TC%FIN) + JRST TSI90 + CAIG J,.XSSYN + JRST TSIF80 ; Flush if CLOSED, LISTEN, SYN-SENT + + ; Advance RCV.NXT over the FIN + AOS A,XBRNXT(I) + TLZE A,%MOD32 + MOVEM A,XBRNXT(I) + + ; Rest of FIN processing, after processing new data in packet. + ; Ack FIN, update connection state, inform user. +TSI82: MOVSI A,(TC%ACK+%XBFIN) ; Set bit asking that ACK be sent, and FIN + IORM A,XBSTAT(I) ; was seen. + MOVEI T,.XCFRN ; Say foreign host closed input side. + CALL TCPUCI + + ; Now effect some state changes + CAIE J,.XSOPN ; If OPEN + CAIN J,.XSSYR ; or SYN-RCVD + JRST [MOVEI J,.XSCLW ; Change state to CLOSE-WAIT + JRST TSI85] + CAIN J,.XSFN1 + JRST [ SKIPN XBORTQ(I) ; If our FIN was ACK'd, + JRST TSI84 ; Go enter TIME-WAIT state + MOVEI J,.XSCLO ; Otherwise enter CLOSING state. + JRST TSI85] + CAIE J,.XSFN2 + CAIN J,.XSTMW + JRST TSI84 ; Go to TIME-WAIT + JRST TSI90 ; Any other states just do nothing. + +TSI84: CALL TSITMW ; Enter TIME-WAIT state, starting 2-MSL timeout + JRST TSI90 +TSI85: HRRM J,XBSTAT(I) ; Set new state and fall through. + CALL TCPUSI ; Set user state. + + ; Done. Finally decide whether to keep segment around or not. +TSI90: HLRZ A,XBITQH(I) ; Get ptr to last thing on input queue + CAIN A,(R) ; Same as current seg (ie it was queued?) + RET ; Yes, just return! + JRST TSIF90 ; Else drop through to flush the segment. + +XSMTRS: OFFSET -. +.XSCLS:: METER("TCP: state CLS") +.XSSYQ:: METER("TCP: state SYQ") +.XSLSN:: METER("TCP: state LSN") +.XSSYN:: METER("TCP: state SYN") +.XSSYR:: METER("TCP: state SYR") +.XSOPN:: METER("TCP: state OPN") +.XSFN1:: METER("TCP: state FN1") +.XSFN2:: METER("TCP: state FN2") +.XSCLW:: METER("TCP: state CLW") +.XSCLO:: METER("TCP: state CLO") +.XSCLA:: METER("TCP: state CLA") +.XSTMW:: METER("TCP: state TMW") +.XSTOT:: OFFSET 0 + + +TSIF01: METER("TCP: ISeg cksm errs ") + JRST TSIFL +TSIF02: METER("TCP: IS zero port/addr") + JRST TSIFL +TSIF03: METER("TCP: IS fl neg data") + JRST TSIFL +;TSIF10: ; Flush this later (retain til get new .METER LIST) + METER("TCP: IS fls Seq # err") + JRST TSIFL +TSIF50: METER("TCP: IS fls Seq no ACK ") + JRST TSIFL +TSIF55: METER("TCP: IS fls CLO & FIN not ACKed") + JRST TSIFL +TSIF56: METER("TCP: IS fls CLA & FIN not ACKed") + JRST TSIFL +TSIF70: METER("TCP: IS fls seqerr processed A/U/R") + JRST TSISNE ; Go respond with ACK +TSIF80: METER("TCP: IS fls FINchk state") + JRST TSIFL +TSIF2A: METER("TCP: IS fls random RST") + JRST TSIFL +TSIF2B: METER("TCP: IS fls Fresh SYN already on SYNQ") + JRST TSIFL + +TSIF90: METER("TCP: IS fls processed seg") + JRST TSIFL + + ; Come here to flush the datagram/segment and return. +TSIFL: METER("TCP: Isegs flushed") + MOVEI A,(R) + CALRET PKTRT + +; TSITMW - Routine to enter TIME-WAIT state. +; TSITM2 is entry point when already in that state. +; Clobbers T, Q +TSITMW: MOVEI J,.XSTMW + HRRM J,XBSTAT(I) + CALL TCPUSI ; Alert user if necessary. +TSITM2: SKIPE XBORTQ(I) ; Unless retransmit still hogs timeout + RET ; (if so, return) + MOVE T,TIME ; then set up 2-MSL timeout. + ADDI T,30.*2.*60. + MOVEM T,XBORTT(I) + RET + +; TSISNE - Sequence number error, segment not acceptable, +; return an ACK unless RST was set. + +TSISNE: METER("TCP: IS NE seqerr") + TLNE E,(TC%RST) + JRST TSIFL ; Flush segment if RST was set + + ; Send an immediate ACK without data, re-using the + ; packet/segment that R points to. +TSOACK: MOVSI T,(TC%ACK) ; Send an ACK immediately + TRCPKT R,"TSOACK return ACK in response to out-of-seq ACK" + CALL TSOSNR + RET + +; TSISQ - Jumped to from TCPIS when TCP segment is received that matches +; no existing connection. Check to see if it's a valid connection +; request. If so, +; (1) see if it matches any wild listens; if so, process. +; (2) see if it's OK to start up a server for it; if so, process. + +TSISQ: TLNE E,(TC%RST) ; If it has RST set, + JRST TSIF2A ; Go drop it quietly. + TLNE E,(TC%ACK) ; If ACK, can't be a valid request either + JRST TSISAR ; Go send a RST in response (with SEQ=SEG.ACK) + TLNN E,(TC%SYN) ; Anything else had better have a SYN + JRST TSISLR ; otherwise send RST with SEQ=0,ACK=SEQ+LEN + + ; Okay, we have a promising SYN. See if it matches any + ; "wild" listens. + METER("TCP: Fresh SYN") + LDB B,[TH$DST (H)] ; Get desired port # + LDB C,[TH$SRC (H)] ; Find port it's from + LDB D,[IP$SRC (W)] ; and host it's from. + MOVSI I,-XBL +TSISQ2: HRRZ J,XBSTAT(I) ; Get state for TCB + CAIE J,.XSLSN ; We're hunting for LISTEN +TSISQ3: AOBJN I,TSISQ2 + JUMPGE I,TSISQ5 ; Jump if no match. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get our local port (never wild) + CAIE A,(B) ; It must match desired "dest port"! + JRST TSISQ3 ; Nope, doesn't want this one. + SKIPL XBHOST(I) ; Aha, very likely will match. Follow thru. + CAMN D,XBHOST(I) + CAIA + JRST TSISQ3 ; Host didn't match. + MOVE A,XBPORT(I) ; Check remote port field + TRNE A,17 ; Low 4 bits are non-zero if remote wild. + JRST TSISQ4 ; Won! + LDB A,[.BP TH%SRC,A] ; Not wild, see if it matches request. + CAIE A,(C) ; Compare our remote with its source. + JRST TSISQ3 ; No, no match here. + + ; Matched a wild listen! Must fill in various stuff. +TSISQ4: MOVEI A,17 + ANDCAM A,XBPORT(I) ; Clear wild bits + DPB C,[.BP TH%SRC,XBPORT(I)] ; Set remote port # + MOVEM D,XBHOST(I) ; Set remote host addr + LDB D,[IP$DST (W)] ; Set local address to whichever address other guy knows + MOVEM D,XBLCL(I) + DPB I,[PK$TCB (R)] ; Finish setting up context for dispatch + CALL TCPMSS ; Correct MSS values for specified foreign host + CALL TCPRWS ; Open up a receive window + JRST TSILS ; Go handle SYN rcvd for LISTEN. + + ; No outstanding listens. Check the port number, to + ; see if it's something we are likely to service. +TSISQ5: LDB A,[TH$DST (H)] ; Get destination port # + CAILE A,%TCPMP ; Fits max port # for RFC service? + JRST TSISLR ; Naw, barf about it (send RST). + + ; See if we're actually willing to start up a job... + LDB A,[IP$SRC (W)] ; See who it's from + JSP T,IPLCLH ; Ask IP if this is one of us + SKIPL TCPUSW ; It isn't, so make sure we're open for biz + CAIA + JRST TSISLR ; Sorry charlie (send RST) + + ; Okay, we'll take it as SYN-QUEUED! We know this is a new + ; request, otherwise it would have been matched at TSI02 and + ; dispatched to TSISQQ instead. + +ifn 0,[ + ; first see if it's already on the queue! + ; Note that we still have remote host # in D. + SKIPN Q,TCPRQH ; Get pointer to 1st item on queue + JRST TSISQ7 ; No queue, so not on. + MOVE B,TH$SRC(H) ; Get req's source/dest ports + MOVE D,IP$SRC(W) ; and its source addr +TSISQ6: HLRZ T,PK.TCP(Q) ; Get addr of TCP header from queue + HLRZ C,PK.IP(Q) ; and addr of IP header + CAIE T, + CAIN C, + BUG CHECK,[TCP: SYNQ smashed] + CAMN B,TH$SRC(T) ; Same ports? + CAME D,IP$SRC(C) ; Same host? + CAIA ; No + JRST TSIF2B ; Yes, assume SYN is a dup, ignore it. + HRRZ Q,PK.TCP(Q) ; Get next thing on pending queue + JUMPN Q,TSISQ6 + + ; Not on queue, let's try to add it. +TSISQ7: MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,%TCPMQ ; Keep its length reasonable + JRST TSISQ8 ; Sigh, ran out. + HRROI T,NTSYNL ; OK, now try loading job up! + CALL NUJBST ; Queue request for job TCPRFC + JRST TSISLR ; Bah, no job slots or something! + MOVEI A,(R) ; It's on the way! Queue the SYN now. + MOVEI Q,TCPRQH + CALL PKQPL(PK.TCP) ; Add onto end of pending-RFC queue. +] ;ifn 0 + + MOVSI I,-XBL +TSISQ6: SKIPN XBUSER(I) + SKIPE XBSTAT(I) + AOBJN I,TSISQ6 + JUMPGE I,TSISQ8 ; Jump if no free slots. + CALL TXBINI ; Got one, might as well verify it's cleared. + MOVE A,TCPRQN ; Find # of things on queue already + CAIL A,XBL/2 ; Keep number reasonable + JRST TSISQ8 ; Sorry, too many. + HRROI T,NTSYNL ; Now see if we can load up handler job. + CALL NUJBST ; Do it + JRST TSISLR ; Ugh, couldn't start new job... + MOVEI J,.XSSYQ + MOVEM J,XBSTAT(I) ; Set state SYN-QUEUED + LDB A,[IP$SRC (W)] + MOVEM A,XBHOST(I) ; Set up host # + MOVE A,TH$SRC(H) ; and ports + ; Don't need to set XBLCL, won't be looked at + MOVEM A,XBPORT(I) ; That's all we need for now. + CALL TCPMSS ; Might as well keep these right even though + CALL TCPRWS ; this TCB will be flushed when conn opens. + MOVE A,TIME + ADDI A,10.*30. ; Let it stay queued for 10 seconds. + MOVEM A,XBORTT(I) + MOVEI Q,XBITQH(I) ; Put the segment on input queue for slot. + MOVEI A,(R) + CALL PKQPF(PK.TCP) + + HRRZM I,TCPRQL ; Save # of last SYN queued. + AOS TCPRQN ; And increment count of entries. + METER("TCP: Srvjob starts") + RET ; All done! + +TSISQ8: BUG INFO,[TCP: SYN queue full] + JRST TSISLR ; Sigh. + + +; TSISQQ - Come here when segment received that matches an +; existing port/host which is in SYN-QUEUED state. + +TSISQQ: TLNE E,(TC%RST) ; Is it an RST? + JRST [ CALL TSISQF ; Yeah, flush the queued SYN. + JRST TSIFL] ; and drop segment. + TLNE E,(TC%ACK) ; An ACK? That's illegal etc... + JRST [ CALL TSISQF ; Flush the queued SYN, + JRST TSISAR] ; and send a RST in response. + TLNN E,(TC%SYN) ; Anything else better be a SYN + JRST [ CALL TSISQF ; else send RST. + JRST TSISLR] + JRST TSIF2B ; Most likely a duplicate SYN, so just + ; flush it and return. + + ; Flush TCB for a queued SYN. +TSISQF: SETZM XBSTAT(I) + SETZM XBPORT(I) + SETZM XBHOST(I) + SETZM XBORTT(I) + SKIPE XBITQH(I) + CALL TXBIFL + SOSGE TCPRQN + BUG HALT + RET + + +; TSISAR - Respond to current segment by sending a RST with +; SEQ=SEG.ACK. Re-uses the current segment's packet buffer. +; R, W, H set up for PE, IP, and TCP. +; E has seg flags. May not be anything in I, so re-use fields +; from given packet! +; TSISAQ - like TSISAR but just drops segment if it has RST in it. +; TSISLR - like TSISAR, but SEQ=0, ACK=SEG.SEQ+SEG.LEN +; This is used when responding to segments without an ACK, i.e. +; initial SYNs. + +TSISLR: METER("TCP: times at TSISLR") + LDB A,[TH$SEQ (H)] ; Get SEQ. Assume TT still valid. + ADDI A,(TT) ; ACK=SEG.SEQ+SEG.LEN + LSH A,4 ; Left justify it. + SETZ D, ; SEQ=0 + MOVSI T,(TC%RST+TC%ACK) + JRST TSISA2 + +TSISAQ: TLNE E,(TC%RST) ; Here, if incoming seg was RST, + JRST TSIFL ; just ignore, don't respond. +TSISAR: METER("TCP: times at TSISAR") + MOVE D,TH$ACK(H) ; Use SEG.ACK for SEQ + MOVSI T,(TC%RST) + + ; Here, A, D, and T must be set up. +TSISA2: SETZ B, + LDB C,[TH$SRC (H)] ; Get source port + DPB C,[.BP TH%DST,B] ; Use as dest port + LDB C,[TH$DST (H)] ; Get dest + DPB C,[.BP TH%SRC,B] ; Use as... you guessed it. + PUSH P,IP$DST(W) ; Which of my addresses to claim to be from + MOVE C,IP$SRC(W) + +; A/ ACK field (left justified) +; B/ (left justified) +; C/ remote host (left justified) +; D/ SEQ field (left justified) +; R/ PE ptr to packet responding to +; T/ flags to use + + + SETZ I, + CALL TSOINI ; Initialize W,H,PK.IP(R),PK.TCP(R),PK.TCI(R) + ; Note everything in PK.TCI will be wrong. + MOVEM C,IP$DST(W) ; Store remote host + MOVEM B,TH$SRC(H) ; Store loc/rem ports + MOVEM D,TH$SEQ(H) ; Deposit new SEQ field + TLNN T,(TC%ACK) ; If sending an ACK + SETZ A, + MOVEM A,TH$ACK(H) ; Deposit ACK field. + TLO T,240000 ; Set IHL + MOVEM T,TH$CTL(H) ; Deposit segment flags + MOVEI A,5*4 + DPB A,[IP$TOL (W)] ; Say length just a std TCP header. + POP P,IP$SRC(W) + CALL THCKSM ; Figure TCP checksum + DPB A,[TH$CKS (H)] ; Deposit in + CALL IPKSND ; Put this buffer on IP output queue! + RET + + +; TSILS - Segment received for this connection while in LISTEN state. +; +TSILS: METER("TCP: Segs rcvd in LSN") + TLNE E,(TC%RST) ; Ignore any RSTs. + JRST TSIFL + TLNE E,(TC%ACK) ; ACKs are bad too. + JRST TSISAR ; Respond with a RST to them. + TLNN E,(TC%SYN) ; It should be a SYN. + JRST TSIFL ; If not, just flush. + + ; We've received a SYN that should be valid. Set up for + ; SYN-RCVD state. Note that we ignore security/precedence + ; except to remember it so our transmits look OK. + ; NOTE!!! TSILSX is an entry point from MP level TCPOPN call, + ; which is used to hook up a user OPEN to a matching SYN on + ; the pending-RFC queue! + METER("TCP: SYN in LSN") +TSILSX: LDB D,[TH$SEQ (H)] ; Get sequence number + LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + CALL TCPISS ; Select a new ISS in A (Initial Send Seq#) + MOVEM A,XBSUNA(I) ; Set SND.UNA to ISS +; ADDI A,1 +; TLZ A,%MOD32 + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + + ; Check for TCP options at this point, and process if present + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + ; Nasty business - put together and send a segment with + ; seq=ISS,ack=RCV.NXT,ctl=SYN+ACK. + ; For now we can assume that initial SYNs will never + ; contain text, and so we don't have to queue it up. + ; Alternatively can hope that remote site is clever about + ; retransmitting! + ; This is because if we don't need to keep received segment + ; around, can just re-use it. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISLX Reflecting incoming SYN with SYN" + CALL TSOSSN ; Fire off SYN. Sends MSS option too. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TCPISS - Select new ISS, return in A + +TCPISS: MOVE A,TIME + LSH A,13. +TCPIS2: TLZ A,%MOD32 + CAMN A,TISSLU ; Same as last used? + JRST [ AOS A,TISSC + ANDI A,17 + LSH A,9. + ADD A,TISSLU + JRST TCPIS2] ; Jump to mask off and test again. + MOVEM A,TISSLU + RET + +; TCPPIO - Process TCP options from incoming segment. +; This is only checked for SYN segments because the only interesting +; option (Max Segment Size) is only sent with SYN segments +; +; R/ Pkt buffer +; I/ TCB Index +; H/ TCP Header +; A/ TCP header size in 32-bit words + +TCPPIO: SUBI A,%TCPHL + LSH A,2 ; Options length in bytes + MOVE B,[TH$OPT (H)] ; BP to start of options +TCPPIL: SKIPG A ; Anything left? + RET ; Nope, done + ILDB C,B ; Get option type + CAIL C,TCPPIS ; In range? + RET ; Have to give up if unknown option + JRST @TCPPIT(C) + +TCPPIT: TCPPI0 + TCPPI1 + TCPPI2 +TCPPIS==.-TCPPIT + + ;End of option list +TCPPI0: RET + + ;NOP +TCPPI1: SOJA A,TCPPIL ; Decrement length and loop + + ;Max Seg Size TYPE ? LENGTH ? MSB ? LSB +TCPPI2: ILDB C,B ; Get length + SUB A,C ; Count it + ILDB C,B ; Get 16-bit quantity, updating B + LSH C,8. + ILDB D,B + ADD C,D ; Now contains foreign MSS request + CAMGE C,XBSMSS(I) ; Don't exceed our own limits! + MOVEM C,XBSMSS(I) ; Set new value in TCB + JRST TCPPIL + + +; TSISS - Segment received while in SYN-SENT state. +; Note that being in this state implies that there is one +; segment on the retransmit queue, which must be the initial SYN +; that we sent. + +TSISS: METER("TCP: Segs rcvd in SYN-SENT") + LDB D,[TH$SEQ (H)] ; Get SEG.SEQ + TLNN E,(TC%ACK) ; Has an ACK? + JRST TSISS2 ; Nope, it better be RST or SYN. + + ; See if our SYN has been ACKed. Since we only send SYNs + ; without data, this just means a test for SEG.ACK = SND.NXT. + LDB B,[TH$ACK (H)] ; Have ACK. Get ack field + CAME B,XBSNXT(I) ; It should ACK our initial SYN + JRST TSISAQ ; If not, send a RST. +; MOVE A,XBSUNA(I) ; snd.una =< seg.ack =< snd.nxt ? +; CMPSEQ A,=<,B,=<,XBSNXT(I),TSISAQ ; If not good, send RST. + +TSISS2: TLNE E,(TC%RST) ; Check for RST + JRST [ TLNN E,(TC%ACK) ; Ugh, have RST. Did we also get good ACK? + JRST TSIFL ; No, can just flush this segment. + MOVEI T,.XCRFS ; Yeah, our SYN is being refused, so + CALL TCPUC ; say this is close-reason. + JRST TSIRST] ; Then must go abort connection. + + ; Here we get to check security/precedence. Hurray. + ; We should just copy the seg values, so as to fake sender out. + + ; Now finally check the SYN bit! + TLNN E,(TC%SYN) ; Must be set + JRST TSIFL ; Neither RST nor SYN? Flush it. + + ; It's a SYN. Update our send params from its values. + ; We will either send an ACK or another SYN; in both cases the + ; SYN segment currently on the retransmit queue should be flushed. + MOVEI Q,XBORTQ(I) ; Point to retrans q + CALL PKQGF(PK.TCP) ; Pluck off 1st thing + SOSN XBORTL(I) ; Verify none left on queue + CAIN A, ; and something was there! + BUG CHECK,[TCP: SYN-SENT retrans Q bad] + JUMPE A,TSISS3 ; Just for robustness + TRCPKT A,"TSISS2 Flushing our SYN from rexmit Q" + MOVE T,PK.FLG(A) + TLO T,%PKFLS ; Tell IP to flush packet if seen + MOVEM T,PK.FLG(A) + CALL PKTRT ; Flush SYN packet if not otherwise busy + SETZM XBORTT(I) ; and flush timeout. + +TSISS3: LDB A,[TH$WND (H)] + MOVEM A,XBSWND(I) ; Initialize send window + MOVEM A,XBSAVW(I) ; and available window + MOVEM D,XBSWL1(I) ; Save seg.seq used for last window update + LDB A,[TH$ACK (H)] + MOVEM A,XBSWL2(I) ; Save seg.ack used for last window update + ADDI D,1 + TLZ D,%MOD32 + MOVEM D,XBRNXT(I) ; Set RCV.NXT to SEQ+1 + + ; Process segment options in case sender specified MSS + LDB A,[TH$THL (H)] ; TCP header length + CAILE A,%TCPHL ; If default, no options present + CALL TCPPIO ; Else, process input options + + TLNN E,(TC%ACK) + JRST TSISS4 + LDB A,[TH$ACK (H)] ; If ACK also present, (known acceptable) + MOVEM A,XBSUNA(I) ; Set SND.UNA to SEG.ACK. + + ; Here must test if SND.UNA > ISS (our SYN has been ACKed). + ; But this was already checked just before TSISS2. + MOVSI T,(TC%ACK) ; Hurray, we're open! Must ACK the SYN + TRCPKT R,"TSISS3 ACK SYN to open conn" + CALL TSOSNR ; (Re-using its segment) + MOVEI J,.XSOPN ; Hurray, we're open now! + HRRM J,XBSTAT(I) + CALL TCPUSI ; Update user state + RET + + ; Our SYN not ACKed yet, so enter SYN-RCVD state. +TSISS4: + ; Must go send seq=ISS,ack=RCV.NXT,ctl=SYN+ACK + LDB D,[TH$SEQ (H)] ; Get sequence number + ADDI D,1 + TLZ D,%MOD32 ; Get seg.seq+1 + MOVEM D,XBRNXT(I) ; Store as initial RCV.NXT + SOSGE A,XBSUNA(I) ; Set SND.UNA to ISS + JRST [ MOVEI A,1 + MOVEM A,XBSUNA(I) + JRST .+1] + MOVEM A,XBSNXT(I) ; And SND.NXT also; assume that process of + ; sending it will increment by 1. + MOVSI T,(TC%SYN+TC%ACK) + TRCPKT R,"TSISS4 ACK and re-SYN SYN-SENT conn" + CALL TSOSSN ; Fire off SYN/ACK with MSS option included. + MOVEI J,.XSSYR ; Change state to SYN-RCVD. + HRRM J,XBSTAT(I) + CALL TCPUSI ; Set user state. + RET + +; TSIRST - valid RST segment received (not in LISTEN). +; Basically must flush the connection, signal user, etc. + +TSIRST: METER("TCP: Valid RSTs") + CALL TXBFLP ; Flush the TCB immediately, PI level + MOVEI T,.XCRST ; Say fgn host reset stuff + CALL TCPUC ; as "close reason" + CALRET TSIFL ; Flush segment. + +; TSISYN - SYN segment received. +; If in window, error - send a RST and close things up. +; If not in window, return an ACK as for TSISNE. + +TSISYN: METER("TCP: Random SYN") + + CALRET TSIFL + +; TSISRA - Bad ACK seen while in SYN-RCVD state, +; send a RST. + +TSISRA: METER("TCP: Bad ACK in SYR") + CALRET TSIFL + +; TSISAK - Received ACK for something not yet seen, send ACK and +; drop segment. +TSISAK: METER("TCP: ACK for nxm") + CALRET TSIFL + +; TSIATW - Received ACK while in TIME-WAIT state. This should be +; a re-transmit of the remote FIN. ACK it, and restart +; 2-MSL timeout. + +TSIATW: METER("TCP: ACK in .XSTMW") + MOVSI T,(TC%ACK) + TRCPKT R,"TSIATW ACK send in TIME-WAIT" + CALL TSOSNR ; Send simple ACK in response. + JRST TSITM2 ; and restart 2-MSL timeout. + +SUBTTL TCP Send output segment + +; Send TCP output segment. +; Send output (usually data) segment, for connection indexed by I. +; Note this differs from TSISAR etc. which don't have any active connection, +; thus no valid I. As much context as possible is taken from the +; TCB tables indexed by I. +; In particular, the %XBCTL flags are examined to see if anything should +; be added to the outgoing segment, other than what was requested in the +; call. + +; Sequence space variables are updated. +; The following possibilities are independently possible: +; Re-using packet / using fresh packet +; Uses seq space (must retrans) / no seq space used +; +; TSOSND - send output segment while connection established +; R/ PE ptr to packet, +; PK.BUF, PK.IP and PK.TCP must be set. +; If these were not initialized by TSOINI so as to get +; the right offsets, you will probably lose. +; PK.TCI should have the # bytes of data and offset. +; I/ TCB index +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +; TSOSNR - Just sends a data-less "reply" type segment using +; TCB's sequence space vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (Neither ACK nor %XBCTL will be added automatically!) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSNR: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + + +; TSOSSN - Send an initial SYN segment. No data, but add a TCP +; MSS option set from XBRMSS(I), and using TCB's sequence space +; vars. Seq=snd.nxt, ack=rcv.nxt, etc. +; R/ PE ptr to packet (packet will be smashed and re-used) +; I/ TCB index +; T/ flags to use (None, including SYN, will be added automatically) + +; Clobbers A,B,C,D,E,W,H,Q,T,TT + +TSOSSN: CALL TSOINI ; Initialize (sets up W,H PK.IP,PK.TCP,PK.TCI) + MOVE TT,XBRMSS(I) ; Max seg size we would like + LSH TT,4 ; 32-bit option + IOR TT,TSOMSO ; Add in type and length fields of option + MOVEM TT,TH$OPT(H) ; Write it. Damn well better be first option. + LDB TT,[PK$TDO (R)] ; Get current TCP header size + ADDI TT,4 ; Adding 4-byte option + DPB TT,[PK$TDO (R)] + SETZ TT, ; Say zero bytes of real data + DPB TT,[PK$TDL (R)] ; and make sure packet entry reflects this. + JRST TSOSN ; Jump in to do it. + +TSOMSO: .BYTE 8 ? 2 ? 4 ? 0 ? 0 ? .BYTE ; Option 2, length 4, two data words + +TSOSND: MOVSI T,(TC%ACK) ; Simple data segment + IOR T,XBSTAT(I) ; Plus whatever is being requested. + HLRZ W,PK.IP(R) ; Get ptr to IP header + HLRZ H,PK.TCP(R) ; and TCP header + LDB TT,[PK$TDL (R)] ; Get # bytes of data +; LDB A,[PK$TDO (R)] ; Get offset of data +; ADDI TT,(A) ; Now have # bytes past std hdr length. + +; TSOSN - Entry point if W, H, and TT already set up. +; I/ TCB index +; T/ flags for segment +; R/ PE ptr (PK.BUF, PK.IP, PK.TCP, PK.TCI must all be set) +; W/ IP header ptr +; H/ TCP header ptr +; TT/ # bytes of data (real data, not including header or SYN/FIN) +; Clobbers A,B,C,D,E,TT,T,Q and updates various TCB data. + +; This code assumes TT is the bytes of DATA only. +; Must store the out-of-TCP info in the IP header field, so that +; the checksum and IPKSND routines will find it there. +; This info consists of: +; IP$SRC - Source address +; IP$DST - Dest address +; IP$TOL - TCP segment length including header +; IP$PTC - Protocol number (needn't set, assumes %PTCTC always) + +TSOSN: METER("TCP: Out segs") + AND T,[TH%CTL] ; Ensure non-flag bits are flushed. + MOVE A,T + ANDCAB A,XBSTAT(I) ; Turn off these request bits + TLNE A,(TH%CTL) ; Any request bits left? + JRST TSOSN2 ; Yeah, can't turn off "now" bit. + MOVSI A,(%XBNOW) ; Satisfied everything, so flush + ANDCAM A,XBSTAT(I) ; the send-immediately bit. + +TSOSN2: LDB A,[PK$TDO (R)] ; Bytes of header + ADDI A,(TT) ; Add bytes of data + DPB A,[IP$TOL (W)] ; Store in IP length field + MOVE A,XBLCL(I) + LSH A,4 + MOVEM A,IP$SRC(W) ; Set source host + MOVE A,XBHOST(I) + LSH A,4 + MOVEM A,IP$DST(W) ; Set dest host + + ; Out-of-TCP info set up, now build the real TCP header. + LDB A,[.BP TH%DST,XBPORT(I)] ; Get port sending from (local) + DPB A,[TH$SRC (H)] + LDB A,[.BP TH%SRC,XBPORT(I)] ; Get port to send to + DPB A,[TH$DST (H)] + MOVE A,XBSNXT(I) ; Get sequence number to use + LSH A,4 + MOVEM A,TH$SEQ(H) ; Set SEQ field + TLNN T,(TC%ACK) ; Check flags, sending ACK? + TDZA A,A ; If not, use zero field anyway. + MOVE A,XBRNXT(I) ; Get ack number to use + LSH A,4 + MOVEM A,TH$ACK(H) ; Set ACK field + + SKIPE A,XBSUP(I) ; Urgent data being sent? + JRST [ TLO T,(TC%URG) ; Yes! Say urgent pointer signif + METER("TCP: Urgent dgms") + MOVNI B,(TT) + ADDB B,XBSUP(I) ; Adjust pointer as result of data sent + CAIGE B, + SETZM XBSUP(I) + LSH A,4 + JRST .+1] + MOVEM A,TH$UP(H) ; Set urgent pointer if any + + MOVE A,XBRWND(I) ; Get our current receive window + LSH A,4 + IOR A,T ; Add in caller's flags + LDB B,[PK$TDO (R)] ; Header length in bytes + LSH B,-2 ; TCP wants length in 32-bit words + DPB B,[<.BP TH%THL,A>] + MOVEM A,TH$THL(H) ; Store header len, flags, window + + PUSH P,TT ; Goddam checksum clobberage + CALL THCKSM ; Now figure out checksum + POP P,TT + DPB A,[TH$CKS (H)] + + ; TCP header set up. Now update our TCB connection vars to + ; account for the stuff we're sending. + TLNE T,(TC%SYN) ; Now find new seq # (SND.NXT) + ADDI TT,1 ; SYN counts as 1 octet + TLNE T,(TC%FIN) ; So does a FIN + ADDI TT,1 + JUMPLE TT,TSOSN8 ; If not actually using seq space, skip + ; a bunch of update/retrans stuff. + + ; We're using up some sequence space! Must update avail window, + ; and put the segment on retransmit queue. + MOVE A,XBSAVW(I) ; Must update avail send window + SUBI A,(TT) + CAIGE A, ; If window becomes negative, + SETZ A, ; keep it at zero. + MOVEM A,XBSAVW(I) + ADD TT,XBSNXT(I) ; Get new SND.NXT + TLZ TT,%MOD32 + MOVEM TT,XBSNXT(I) + SKIPN XBORTT(I) ; Retrans timeout already set? + JRST [ MOVE A,TIME + ADD A,TCPTMO ; Make it 5 sec for now. + MOVEM A,XBORTT(I) + SETZM XBORTC(I) ; Clear count of retries. + JRST .+1] + TRCPKT R,"TSOSND Pkt w/seq space added to retransmit queue" + MOVEI A,(R) ; Arg to PKQPL, A/ PE ptr + MOVEI Q,XBORTQ(I) ; Arg to PKQPL, Q/ queue hdr ptr + CALL PKQPL(PK.TCP) ; Put on TCP retrans queue + AOS XBORTL(I) ; Bump count of segs on queue + +TSOSN8: CALL IPKSND ; Put on IP output queue + RET + +SUBTTL TCP Retransmit and Timeout + +Comment | + The following things in TCP need some sort of timeout: + Retransmit output segment if not ACKed (removed) within RT sec + Timeout to abort connection if retransmission fails for UT sec + Timeout to ACK incoming data (ie avoid ACKing immediately, + wait for more output or input). + Timeout during TIME-WAIT to flush connection. +| + +; TCPCLK - This routine is called by 1/2-sec "slow" clock. What it has to do +; is scan all active TCB's for the following conditions: +; (1) Retransmit timeout has expired, must resend something. +; or TIME-WAIT timeout has expired. +; (2) An ACK must be sent, either by sending the current output +; buffer, or by generating an ACK without data. + +EBLK +TCLKRC: 0 ; Count of segs compacted in pass over a retrans Q +BBLK + +TCPCLK: SKIPN TCPUP ; Do nothing if turned off. + RET + MOVSI I,-XBL + CONO PI,NETOFF + SKIPA A,TIME +TCLK05: SKIPA A,TIME + +TCLK10: SKIPN B,XBSTAT(I) + JRST TCLK15 + SKIPE C,XBORTT(I) + CAMG A,C + CAIA + JRST TCLK20 ; Retrans timeout +TCLK12: TLNE B,(TH%CTL+%XBNOW) ; Any flags set? + JRST TCLK50 ; Wants ACK sent +TCLK15: AOBJN I,TCLK10 + CONO PI,NETON + RET +TCLK16: MOVE A,TIME + AOBJN I,TCLK10 + CONO PI,NETON + RET + + ; Come here for timeout of some sort. +TCLK20: SKIPE XBORTQ(I) ; If a retrans queue exists, + JRST TCLK22 ; then assume it was a retrans timeout. + MOVEI C,(B) ; No retrans Q, probably a TIME-WAIT one? + CAIN C,.XSTMW ; State TIME-WAIT? + JRST [ METER("TCP: Time-Wait timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + JRST TCLK16] + CAIN C,.XSSYQ ; State SYN-QUEUED? + JRST [ METER("TCP: SYQ timeout") + CALL TSISQF ; Flush the queued SYN. + JRST TCLK16] + CAIN C,.XSFN2 ; State FIN-WAIT-2? + JRST TCLK21 + METER("TCP: Random timeout") ; Sigh. + SETZM XBORTT(I) ; Flush whatever it was. + JRST TCLK16 + +TCLK21: METER("TCP: FN2 timeout") + CALL TXBFLP ; Flush the TCB completely, PI level + SKIPE XBUSER(I) ; Shouldn't still have anything open. + BUG CHECK,[TCP: FN2 timo with active user] + JRST TCLK16 + +TCLK22: METER("TCP: Retrans") + AOS C,XBORTC(I) ; Retrans timeout. Send it again. + SKIPE D,XBORTP(I) ; Has user set any retrans params? + JRST [ JRST TCLK25] ; Yes! For now, non-Z means skip abort check. + CAILE C,%TCPMR ; Tried too many times? + JRST TCLK80 ; Ugh, abort the connection! + SKIPN R,XBORTQ(I) + JRST [ SETZM XBORTT(I) ; If nothing on queue, + JRST TCLK12] ; just reset the timeout to nothing. + SKIPGE A,PK.FLG(R) ; Ensure that packet isn't being output now + JRST TCLK25 ; Still being output?? Reset timeout. + ; Note that we don't check to see whether segment has already + ; been transmitted, on the theory that compaction is going to + ; pay off anyway. + HLRZ W,PK.IP(R) + HLRZ H,PK.TCP(R) + SETZM TCLKRC ; Clear compaction count. + + ; Looks like we have to retransmit. Try to compact up as much + ; stuff as possible into a single segment; this gets a bit + ; hairy. Note that we compact as much as we can, ignoring the + ; %PKPIL and %PKODN bits (except for setting the appropriate flush + ; flags). + TRCPKT R,"TCLK30 Segment being retransmitted" +TCLK30: HRRZ J,PK.TCP(R) ; Get pointer to succeeding segment + JUMPE J,TCLK39 ; If none following, can't compact (ignore + ; possibility of adding XBOCOS for now) + LDB B,[PK$TDO (R)] ; Get 1st offset + LDB C,[PK$TDL (R)] ; Get 1st length + LDB T,[PK$TDL (J)] ; Get 2nd length + ADDI B,(C) ; Find offset to end of 1st data + MOVEI D,(B) + ADDI D,(T) ; Find total length after compaction + CAILE D,576.-<5*4> ; Hack hack hack! Limit to 556. so std + ; IP datagram is limited to 576. + JRST TCLK39 ; If too big, don't compact. + + ; Compact two segments into one! + ; R/ 1st seg D/ offset to end of data + ; J/ 2nd seg T/ len of 2nd data + METER("TCP: Retrans compact") + TRCPKT J,"TCLK30 Segment being compacted into previous seg for rexmit" + ADDI C,(T) ; Get new # bytes for 1st seg + DPB C,[PK$TDL (R)] ; Store it in advance. +; HLRZ D,PK.TCP(R) ; Find addr of TCP header in 1st seg + MOVEI D,(H) + IDIVI B,4 + ADDI D,(B) ; Get addr for BP to end of data + HRL D,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + LDB B,[PK$TDO (J)] ; Get data offset for 2nd seg + IDIVI B,4 + HLRZ A,PK.TCP(J) ; Get addr for BP to start of 2nd data + ADDI B,(A) + HRL B,(C)[441000 ? 341000 ? 241000 ? 141000] ; Make LH + ; B/ BP to 2nd data + ; D/ BP to end of 1st data + ; T/ # bytes of 2nd data + LDB A,[IP$TOL (W)] ; Get current length of whole datagram + ADDI A,(T) ; Increment by length of added stuff + DPB A,[IP$TOL (W)] ; Store back + ADDI A,3 + LSH A,-2 + HRLM A,PK.BUF(R) ; Set up new count of # words in datagram. +TCLK32: ILDB C,B + IDPB C,D + SOJG T,TCLK32 + + ; Data copied over, now update flags and stuff. + HLRZ D,PK.TCP(J) + MOVE A,TH$CTL(D) ; Get flags for 2nd seg + AND A,[TH%CTL] ; Mask off just flags + IORM A,TH$CTL(H) ; Add them to flags for 1st seg + TLNE A,(TC%URG) ; If URGENT bit set, + JRST [ LDB B,[TH$UP (D)] ; Get pointer from 2nd seg + LDB C,[PK$TDL (R)] ; Sigh, get new len of 1st seg + ADDI B,(C) ; Adjust for bytes in front + LDB C,[PK$TDL (J)] ; But have to subtract length + SUBI B,(C) ; of 2nd seg (already in 1st len) + DPB B,[TH$UP (H)] ; Store ptr back in 1st seg + JRST .+1] + + ; Compaction done! Now have to remove 2nd seg from queue. + HRRZ B,PK.TCP(J) ; Get pointer to 3rd seg + HRRM B,PK.TCP(R) ; Point 1st at it + CAIN B, ; If 2nd was the last one, + HRLM R,XBORTQ(I) ; must update "last" ptr in queue header. + MOVE A,PK.FLG(J) ; Get flags +IFN PK.TCP-2,.ERR %PQFL flag must match PK.TCP + TLZ A,(%PQFL2) ; Say it's off the TCP list, to allow + ; flushing from IP queue. + TLO A,(%PKFLS) ; In fact, require it + MOVEM A,PK.FLG(J) ; Store flags back + JUMPGE A,[MOVEI A,(J) ; If not locked by PI output, + TRCPKT A,"TCLK32 Seg flushed from rexmit by compaction" + CALL PKTRT ; try to flush it now. + JRST .+1] + SOSGE XBORTL(I) ; Decrement count of retrans queue segs + BUG HALT + AOS TCLKRC ; Bump count of recompacts done + JRST TCLK30 ; OK, try to recompact next seg! + + ; Note one possible problem with following code; although + ; the segment being re-trans'd is given latest poop (ACK, WND), + ; the ones following are not. This is usually OK as we assume + ; that following segs have actually been sent out, but if it + ; happens that they HAVEN'T (i.e. %PKODN not set) then their + ; info is going to be a little out of date. This shouldn't + ; screw things too much, however. +TCLK39: MOVE D,XBRNXT(I) ; Get latest ACK value + LSH D,4 + MOVEM D,TH$ACK(H) ; Set it + MOVE D,XBRWND(I) ; And latest window + DPB D,[TH$WND (H)] + CALL THCKSI ; Compute checksum for it (note not THCKSM) + DPB A,[TH$CKS (H)] + SKIPE TCLKRC ; Was any recompaction done? + CALL IPKHD2 ; Yes, must recompute IP header (checksum etc) + MOVE A,PK.FLG(R) + TLNN A,(%PKODN) ; Has segment already been tried once? + JRST [ ; No, don't put on output queue twice!! + TRCPKT R,"TCLK39 Rexmit skipped because seg not yet output" + METER("TCP: Pretrans compact") + JRST TCLK25] + TLO A,(%PKRTR) ; Set flag saying this is a retransmit + MOVEM A,PK.FLG(R) + MOVEI A,(R) + CALL IPKSNQ ; Put back on IP output queue + ; Note PK.BUF shd still be set up right. +TCLK25: MOVE A,TIME + HRRZ B,XBORTP(I) ; If RH set, use it for new timeout. + CAIN B, + MOVE B,TCPTMO ; Use timeout default. + ADD B,A + MOVEM B,XBORTT(I) + JRST TCLK79 + + ; Here when need to send an ACK. First see if we can + ; make use of existing output buffer. +TCLK50: METER("TCP: slow ACKs") + TLNE B,(TC%SYN+TC%RST) + BUG CHECK,[TCP: SYN or RST set in XBSTAT clock req] + SKIPE R,XBOCOS(I) ; Ensure there is one. + TLNE B,(%XBMPL) ; and that it isn't locked. + JRST TCLK60 ; Sigh, can't use it. + + ; There is an output buffer, and it's not locked, so use that + ; to send stuff out! + TRCPKT R,"TCLK50 COS used to send clock level ACK" + MOVSI T,(TC%PSH) + CALL TCPOFR ; Force it out. + JRST TCLK16 + + ; Come here when we have to generate a new segment for ACK. +TCLK60: TLNN B,(%XBNOW) ; Insisting that we ACK? + JRST TCLK65 ; No, can semi-punt. + CALL PKTGFI ; Get buffer + JRST TCLK65 ; and forget about ACKing if we cant get one + METER("TCP: Clk ACK") + MOVEI R,(A) + MOVE T,B ; Use request flags in segment. + TRCPKT R,"TCLK60 Alloc and send ACK from clock level" + CALL TSOSNR ; Send a simple ACK + JRST TCLK16 + +TCLK65: MOVSI A,(%XBNOW) ; No, so just set insist flag + IORM A,XBSTAT(I) ; and wait a bit longer. + JRST TCLK16 + +TCLK79: + JRST TCLK16 + + ; Abort the connection, timed out. +TCLK80: METER("TCP: Timeout abort") + CALL TXBFLP ; This is pretty drastic... flush, PI level. + MOVEI T,.XCINC ; Say "incomplete transmission" + CALL TCPUC ; as close reason. + JRST TCLK16 + +TCLK90: CONO PI,NETON + RET + + +; Checksum cruft. + +; THCKSM - Figures TCP segment checksum, IP$TOL has TCP segment length. +; THCKSI - Figures TCP segment checksum, IP$TOL has IP header plus TCP seg. +; W/ addr of IP header +; H/ addr of TCP header +; Note that the following out-of-TCP values are looked up +; from the IP header in order to compute sum for the "pseudo header". +; IP$SRC - source host +; IP$DST - dest host +; IP$TOL - # octets in TCP segment (plus IP header) +; Finally, +; %PTCTC - Assumed value +; +; Clobbers B,C,D,E +; Returns +; A/ checksum +; TT/ Total # bytes in TCP segment + +THCKSM: TDZA C,C ; Compute as if IHL=0 +THCKSI: MOVNI C,5*4 + ; First compute pseudo header + LDB A,[IP$SRC (W)] ; Source addr + LDB B,[IP$DST (W)] ; Dest addr + ADD A,B + ADDI A,%PTCTC ; Add TCP protocol number + LDB TT,[IP$TOL (W)] ; Get total length in octets + JUMPE C,THCKS2 + LDB B,[IP$IHL (W)] ; Find IP header length in 32-bit wds + LSH B,2 ; mult by 4 to get # octets + SUBI TT,(B) ; Find # octets of IP data (TCP segment) +THCKS2: ADDI A,(TT) ; Add in. + MOVEI C,-<5*4>(TT) ; Get # bytes in segment after 1st 5 wds + + ; Done with pseudo header (not folded yet, though). + LDB B,[044000,,0(H)] ; Get wd 0 (src/dest) + ADD A,B + LDB B,[TH$SEQ (H)] ; Get wd 1 (seqno) + ADD A,B + LDB B,[TH$ACK (H)] ; wd 2 + ADD A,B + LDB B,[044000,,3(H)] ; wd 3 + ADD A,B + LDB B,[TH$UP (H)] ; wd 4 (part of) + ADDI A,(B) + + LSHC A,-16. + LSH B,-<16.+4> + ADDI A,(B) ; Now have it folded up. + JUMPLE C,THCKS7 ; If nothing more, can leave now. + MOVEI E,5(H) + HRLI E,442000 ; Set up 16-bit byte ptr to options/data + LSHC C,-1 + JUMPLE C,THCKS6 +THCKS5: ILDB B,E + ADDI A,(B) + SOJG C,THCKS5 +THCKS6: JUMPL D,[ ; Jump if odd byte left. + ILDB B,E ; get it + ANDCMI B,377 ; mask off low (unused) byte. + ADDI A,(B) + JRST .+1] +%CKMSK==<-1#177777> ; Mask for stuff above 16 bits +THCKS7: TDNE A,[%CKMSK] ; If any carries, add them in. + JRST [ LDB B,[.BP %CKMSK,A] + TDZ A,[%CKMSK] + ADD A,B + JRST THCKS7] + ANDCAI A,177777 ; Complement sum and mask off. + RET + + +MTRCOD ; Last stuff -- expand meter tables. +TRCCOD ; Expand trace tables diff --git a/system/tcpbuf.56 b/system/tcpbuf.56 new file mode 100644 index 0000000..9cdcc29 --- /dev/null +++ b/system/tcpbuf.56 @@ -0,0 +1,588 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +COMMENT | + +Notes on TCP input and output buffers + +Ideally the TCP segment queues should be logically separate from the IP +datagram queues, but for efficiency it should be possible to have them +both together. + +Input buffers are expected to be lists of datagrams/segments. +This is reasonably simple, since pointers (in known places) can just be +set up to the data (whereever it is in the datagram/segment). +There is a problem with allocation/windows in this scheme, since it +is possible to run out of datagram buffers before running out of window, +if the remote site becomes cretinous about it and sends only a few +bytes per dgram very fast. But in that case re-transmission can just +force it to buffer up its output, so that future dgrams will be somewhat +more filled, so it is probably OK. If this does become a screw, can +add code to do compaction at clock level. + +Output buffers are a little more uncertain. Could have simple +circular buffer, with appropriate pointers set up so that IMP output +message is read directly from the buffer (same as NCP). Alternatively +could have queue of segments/datagrams all ready to go. Guess I'd +like to try doing the latter, to keep things "simple" by minimizing +the number of kinds of things floating around. + +Problem with putting output datagram together: can't always predict +ahead of time how big the leaders are going to be! Especially true +for IP level, which TCP is not supposed to know too much about. Thus +if not careful, it could happen that output is put into a segment too +close to the start of the buffer, so that there is not enough room for +the TCP and IP headers to fit in. Have to look at this; may need to +give up notion of keeping all the packet internals nicely contiguous. +Maximum IP header length is set at 60 bytes (15 words). The maximum +TCP header length is also 15 words. +Looking at the currently defined options, it seems unlikely that ITS +will use any of them, and if so, they can be predicted fairly easily on +a per-connection basis, so things should work out okay. Note that +the IP level can always simply fragment stuff if it really wants to be +that complex. + +It would be nice to be able to keep track of stuff which is on the +device (IMP) output queue but hasn't yet gone out, in order to add +last-minute bits (like ACK) or even some more data. Idea: output "queue" +is just a list of TCP connections that need attention, so can always +go in and mung stuff (even change mind about outputting) just by playing +with connection flags/lists. This is basically how NCP does it. + +Re packet buffer design: + Somewhat more hypothetical is the notion of keeping a "usage +count" for each buffer, so that pointers from the packet table entries +can point to several different buffers and not just one. When a usage +count hits zero, put the buffer on the freelist. Actually this is not +really needed for the case of a table entry pointing to more than one +buffer, but it IS needed for the case of more than one table entry +pointing to the same buffer. This might happen, for example, if +an internet bypass were set up so that datagrams going to ourselves +were simply vectored directly to the input queues. But for the +time being, it probably isn't too outrageous to simply re-copy the +datagram in question. (Also better emulates a fake network device). + +Suggest that lists point directly to themselves rather than +to start of entry; this allows low-level list routines to be used +on all lists. The higher-level routines of course have to know what +offsets to use for a specific list. Alternatively provide different routines +for each offset needed, and equate references to the appropriate routine +for each use. (This is what I'm trying at the moment, hence the IRPS) + +May want to use format ,, where is the addr +of the initial pointer (not initial node). This allows backtracking +to figure out what TCP connection or IP queue a packet belongs to. +Brute force approach is to simply have another word for the TCB index, etc. + +If this stuff is general enough it could be used for CHAOS packets also. +| + +COMMENT | + +Buffers are all 256 (400 octal) words long, and 4 of them fit on one +ITS page. This size was chosen because the maximum length of an IMP +message (not counting IMP-Host padding) is 255 words of 4 8-bit bytes +per word. This allows one extra word; not much. Taking away the +3 IMP leader words (which has to be done anyway for NCP to continue +working) gives us 4 spare words per buffer. + +This still may not be enough. Rather than shoe-horn some clever stuff +into each buffer header, I am opting to maintain "Packet Entries" in a +"Packet Table" separate from the "Packet Buffers" themselves. All +messages/datagrams/segments/packets are identified by a pointer +into the table. (Could use index, as for sockets/TCBs, but this is +awkward for lists). The entry identified by the pointer will contain +the actual pointers into the buffer associated with that packet. +[NOTE: may want to have these pointers point into various places, not +necessarily all the same buffer. Must think about this.] + +Free buffers are linked by a freelist pointer in their first word, +with an identifier in the second word to help GC. The only design +issue for the buffers themselves is how to set things up so that it is +easy to GC a large freelist, i.e. identify pages that have nothing +but free buffers in them and thus can be removed from the system's +address space. Currently I have simply adopted the strategem used for +CHAOS buffers (at CHCLN) to have the core job snuffle over the freelist. + +Note that the low-level routines for manipulating lists are actually +referenced via macros which are given an offset as argument. This +offset refers to the offset between the node pointer and the location +of the "next" pointer in the node; the macro will assemble into a +call to the right routine for that offset. Currently only offsets +up to 2 are supported; any lists that the packet is put on must +be threaded through the first 3 words of the node, and the macros check +for this. +| + + SUBTTL Packet Tracing Code + +IFNDEF PKTTRC,PKTTRC==:0 ; Nonzero turns tracing code on +IF1,IFN PKTTRC,.ERR IP packet tracing code included. + +COMMENT | + +This code can be used to keep a history of what happens to a packet. +The history is stored in the packet buffer as a series of indexes +into a table of named events. + +To trace a particular event use the TRCPKT macro. + + TRCPKT(REG,"String") + +REG is the register which currently contains an index to the packet +buffer table. The code is more efficient if the register is R. String +is the description of the event. + +To generate the event table, you must call the TRCCOD macro somewhere +after the last call to TRCPKT. + +| + +%NTRCE==:77 ; Allow this many trace events. Value must be a bit mask (all + ; ones) to work right. If you make it bigger than 77 + ; you have to change the "TRC%" in the macros to something + ; shorter, too. + +%%%TRC==1 + +; TRCCOD generates TRCTBL, which holds +; for each trace event. +DEFINE TRCCOD +IFN PKTTRC,[ +TRC%0==:<0,,[ASCIZ /Null event/]> +TRCTBL: REPEAT %%%TRC,CONC TRC%,\.RPCNT +IF2, REPEAT %%%TRC,CONC EXPUNGE TRC%,\.RPCNT +] +TERMIN + +DEFINE TRCPKT REG,&(EVENT) +IFN PKTTRC,[ +IFG %%%TRC-%NTRCE,.ERR Too many packet trace events! +CONC TRC%,\%%%TRC,==:<.,,[ASCIZ EVENT]> + IFN REG-R,[ + PUSH P,R + MOVE R,REG + ] + PUSH P,TT + MOVEI TT,%%%TRC + PUSHJ P,PKTPTS + POP P,TT + IFN REG-R,[ + POP P,R + ] +%%%TRC==%%%TRC+1 +] +TERMIN + +IFN PKTTRC,[ + +; Store information in the packet history data buffer +; "Information" is a 6-bit quantity which indexes into a table +; of strings. +; TT/ Reason index +; R/ Pkt Buffer index + +PKTPTS: CONO PI,PIOFF ; Freeze machine + DPB TT,PK.HSP(R) ; Store trace info + IBP PK.HSP(R) ; Bump BP + HRRZ TT,PK.HSP(R) ; Pick up history byte ref (address only) + CAIL TT,PK.HSP(R) ; If we've gotten to the bottom, + JRST [ MOVEI TT,PK.HST(R) ;Wrap around + HRLI TT,(<.BP %NTRCE_30.>) ; BP to left 6 bits + MOVEM TT,PK.HSP(R) ;Reset it to top + JRST .+1 ] + CONO PI,PION + POPJ P, +] + +;;; Packet Table Entries + +EBLK +IFNDEF PKBSIZ,PKBSIZ==400 ; 256. words per packet buffer +IFNDEF NPKPGS,NPKPGS==40. ; # pages OK to use for packet buffers +NPKB==:> ; # packet buffers available +NPKE==:NPKB ; # packet entry nodes. +IFN NPKB-NPKE,.ERR You must fix the UFLS at PKTGF. + +PKETBL: OFFSET -. + ; General (device driver, etc) +PK.FLG:: 1,,PKETBL+PK.L ; General - ,, + %PKPIL==: ; Packet locked at PI level, being output + %PKODN==:<1000,,> ; Packet has been output (else not yet) + %PKNOF==:<2000,,> ; Packet should not be freed when output done. + %PKFLS==:<4000,,> ; Flush pkt if seen on output queue (ie dont output) + %PKRTR==:<10000,,> ; Packet is being re-transmitted by TCP + .SEE %PQFLX ; Low bits of LH used for on-list flags. + +PK.IP:: 0 ; IP Datagram - ,, + ; May be strung on Internet Queue, IP output queue +PK.TCP:: 0 ; TCP Segment - ,, + ; May be strung on TCB input Q, output retransmit Q +PK.TCI:: 0 ; TCP Segment - <# bytes data><# bytes offset> + PK%TDL==:<777700,,0> ; # octets of data in TCP segment + PK%TDO==:< 77,,770000> ; # octets data is offset from TCP header + PK%TCB==:< ,,007777> ; TCB connection index + PK$TDL==:<.BP PK%TDL,PK.TCI> + PK$TDO==:<.BP PK%TDO,PK.TCI> + PK$TCB==:<.BP PK%TCB,PK.TCI> +PK.BUF:: 0 ; General - <# wds>,, +PK.TIM:: 0 ; General - Time sent or received, int level (Sys time) +PK.DST:: 0 ; Immediate destination address if on output queue + +IFN PKTTRC,[ +PK.HST:: BLOCK 3 ; Packet trace history buffer +PK.HSP:: 0 ; Packet trace history pointer +] + +PK.L:: OFFSET 0 ; Length of a Packet-Entry (PE) node + REPEAT ,[ + IFN .RPCNT-, 1,,.+PK.L ; Build initial freelist + .ELSE 1,,0 + BLOCK PK.L-1 + ] +PKETBE==:.-PK.L ; Last legal PE pointer value + +PKEQHF: PKETBE,,PKETBL ; Header for Packet-Entry node freelist + +BBLK + +; A "queue" is a list of nodes pointed to by a "queue header" word +; of format ,,. Each node pointer points to +; the next node pointer (or zero if no more). +; There is a set of flags in the LH of a certain word, at offset +; PQ.FLG, that indicate which lists a node is currently on. + +PQ.FLG==:PK.FLG ; Offset of word list-flags are in. +%PQFLX==0 ; Initial val +IFNDEF %%%QOF,%%%QOF==0 ; This gets set to highest offset supported + +IRPS PKQGF,,[PKQGF0:PKQGF1:PKQGF2:]PKQPL,,[PKQPL0:PKQPL1:PKQPL2:]PKQPF,,[PKQPF0:PKQPF1:PKQPF2:]%PQFL,,[%PQFL0:%PQFL1:%PQFL2:] +IFG .IRPCNT-%%%QOF,%%%QOF==.IRPCNT + + %PQFL==:<1_.IRPCNT,,> ; Def a flag in LH at offset PQ.FLG + %PQFLX==%PQFLX\%PQFL ; Mask of all list-flags def'd. + +; PKQGF - Get first node from queue +; Q/ addr of queue header +; A/ addr of node (zero if none) + +PKQGF: CONO PI,PIOFF ; Work at all levels + HRRZ A,(Q) ; Get 1st from queue header word + JUMPE A,PIONJ ; None, so return zero. + MOVSI T,(%PQFL) ; Now clear appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's not on it any more. + TLNE T,(%PQFL) ; Paranoia plus + BUG HALT,[PK: GF node wasnt on list] + HRRZ T,.IRPCNT(A) ; Get 2nd + HRRM T,(Q) ; Make it 1st + CAIN T, ; If all's well, done. + SETZM (Q) ; Else must clear whole header +IFNDEF PIONJ,PIONJ: + CONO PI,PION + POPJ P, + +; PKQPL - Put node on queue as last thing. +; Q/ addr of queue header +; A/ addr of node +PKQPL: TRNN A,-1 ; More paranoia + BUG HALT,[PK: zero node ptr] + HLLZS .IRPCNT(A) ; Say this node is last one + CONO PI,PIOFF ; Work at all levels + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; plus check... + BUG HALT,[PK: node already on list] + HLRZ T,(Q) ; Get last node + HRLM A,(Q) ; Point to new last node + JUMPN T,[HRRM A,.IRPCNT(T) ; Make prev last node point to new last + JRST .+2] ; Skip over next instr!! + HRRM A,(Q) ; Queue was empty, make this the new first too + CONO PI,PION + POPJ P, + +; PKQPF - Put node on queue as first thing. +; Q/ addr of queue header +; A/ addr of node +PKQPF: TRNN A,-1 ; Yes more paranoia + BUG HALT,[PK: zero node ptr] + CONO PI,PIOFF + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; check... + BUG HALT,[PK: node already on list] + HRRZ T,(Q) ; Get first thing + CAIN A,(T) ; paranoia, avoid loops to self + BUG + HRRM T,.IRPCNT(A) ; Make it second thing + HRRM A,(Q) ; Make new first thing + CAIN T, + HRLM A,(Q) ; Was empty, also make it last thing. + CONO PI,PION + POPJ P, +TERMIN + +; Define PKQGF, etc so that they actually reference PKQGF0, etc as +; appropriate for the given offset. +IRP RTN,,[PKQGF,PKQPF,PKQPL] +DEFINE RTN ?OFFST=0, +CONC RTN,\OFFST +IFG OFFST-%%%QOF,.ERR RTN used with bad offset +TERMIN +TERMIN + + +; PKEGF - Get a free Packet-Entry node +; Clears node contents. +; Clobbers Q,T +; Returns A/ PE ptr (0 if none) + +PKEGF: MOVEI Q,PKEQHF +IFE PKTTRC,[ + CALRET PKQGF ; Get a node +] +IFN PKTTRC,[ + CALL PKQGF + JUMPE A,CPOPJ ; No packet + SETZM PK.HST(A) + SETZM PK.HST+1(A) + SETZM PK.HST+2(A) + MOVEI Q,PK.HST(A) ; Build byte ref to history trail + HRLI Q,(<.BP %NTRCE_30.>) ; (dpb ref) + MOVEM Q,PK.HSP(A) ; save ref + POPJ P, +] + +; PKERT - Return a Packet-Entry node to freelist +; A/ PE ptr to node +; Clobbers Q,T + +PKERT: MOVEI Q,PKEQHF ; Use Packet-Entry freelist + CALRET PKQPF ; Put back on start of list. + +; Note that all MP calls to the routines below which allocate or free +; entries/buffers must be sure not to block (page fault or UFLS) +; while any "loose" entries/buffers exist (not pointed to by any list) +; unless there something on the PCLSR locked-switch list which will return the +; currently "loose" entry/buffer to its freelist -- otherwise +; it is possible for "loose" stuff to slowly accumulate. + +; PKTGF - Get a free Packet-Entry node and Packet Buffer. Hangs until +; it wins. Note that it depends on fact there is one PE node +; for every packet buffer, and vice versa! If this becomes untrue +; then the way it UFLSes should be fixed up. +; PKTGFI - version that skips if wins, doesn't hang. +; Returns A/ PE ptr Clobbers Q,T + +PKTGF: SKIPN PKEQHF ; Fast check, see if any packet entries/buffers free + CALL UFLS ; Nope, hang until something turns up. + CALL PKTGFI ; Get a entry/buffer! + JRST PKTGF ; None? Sigh, go hang. + RET + +PKTGFI: CALL PKEGF ; Get a free node + JUMPE A,CPOPJ + PUSH P,A ; Save pointer to it +PKTGF1: CALL PKBGF ; Get a free buffer + JUMPN A,PKTGF8 ; Jump if found one right away! + CALL PKBAL ; None left on freelist, try to allocate more. + CAIA ; Sigh, failed. + JRST PKTGF1 ; Won, go pluck a buffer from freelist. + + ; Lost, can't get any more buffers. + POP P,A ; None available, take non-skip return + CALRET PKERT ; Put PE node back on its freelist. + + ; Won, store buffer pointer in PE. +PKTGF8: MOVE T,A + POP P,A ; Restore PE ptr + MOVEM T,PK.BUF(A) + MOVE T,PQ.FLG(A) ; Paranoia dept, verify not on any lists. + TLNE T,(%PQFLX) + BUG HALT,[PK: Freelist node not free!] + SETZM PK.FLG(A) ; Zap all other entries in packet node. + SETZM PK.IP(A) + SETZM PK.TCP(A) + SETZM PK.TCI(A) + SETZM PK.TIM(A) + AOS (P) ; Win, skip on return! + RET + +; PKTRT - Return both a Packet-Entry and its associated buffer to freelist +; only if check shows that it doesn't belong to any lists. +; PKTRTA - Always return to freelist. If check shows that it is still +; on some list, bad error! +; Clobbers A,Q,T +; A/ PE ptr (must be off all lists) + +PKTRTA: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) ; Get list flags + TLNE T,(%PQFLX) ; Any still on? + BUG HALT,[PK: Freeing packet still in use!] + JRST PKTRTX ; Nope, can proceed to put on freelist. + +PKTRT: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) + TLNE T,(%PQFLX) ; Any list flags on? + RET ; Yes, don't return to freelist yet. +PKTRTX: PUSH P,A ; Save PE ptr + SKIPE A,PK.BUF(A) ; Get buffer pointer associated with PE + CALL PKBRT ; Return the buffer + POP P,A + SETZM PK.BUF(A) ; Ensure buffer pointer zapped. + CALRET PKERT ; Then return the packet entry + +; PKTPCL - Return a packet entry/buffer while PCLSR'ing. +; This is the standard LOSSET routine to use. +; A must hold the PE ptr at time of the block (which we are backing +; out of). +; Must only clobber A and T!! + +PKTPCL: MOVE A,AC0S+A(U) ; Get ac A at time of the block + PUSH P,Q ; Mustn't clobber Q + CALL PKTRT ; Return the entry/buffer (clobbers Q,T) + JRST POPQJ + + +EBLK +PKBNF: 0 ; # free Packet Buffers +PKBNT: 0 ; # total Packet Buffers +PKBCTM: 0 ; Time of last no-more-core complaint +PKBQHF: 0 ; Queue Header for buffer freelist +PKBQHC: 0 ; Queue Header for core job cleanup +BBLK + +; PKBGF - Get a free Packet Buffer +; Clobbers Q,T +; Returns A/ PB ptr (0 if none) + +PKBGF: MOVEI Q,PKBQHF ; Point to buffer freelist + CALL PKQGF ; Get first thing off it + JUMPE A,CPOPJ ; If got nothing, just return. + SETZM 1(A) ; Aha, got it! Flush free-buffer identifier. + SOS PKBNF ; Decrement # free packet buffers. + RET + +; PKBRT - Return a Packet Buffer to freelist. Puts back at END of freelist, +; as PKBCLN clean-up depends on this. +; Clobbers Q,T +PKBRT: SETZM (A) ; Paranoia aid - clear "flags" in LH of 1st wd. + ; Otherwise PKQ routines complain. + MOVE T,[SIXBIT /BRUNCH/] + MOVEM T,1(A) ; Set up free-buffer identifier + AOS PKBNF ; Increment # free packet buffers. + MOVEI Q,PKBQHF ; Point to buffer freelist + CALRET PKQPL ; Put it back on, at end. + +; PKBRTL - Return a list of Packet Buffers to freelist +; Q/ ptr to queue header of list +; Clobbers A,T +PKBRTL: CALL PKQGF ; Get first thing off list + JUMPE A,CPOPJ + PUSH P,Q + CALL PKBRT ; Return it to buffer freelist + POP P,Q + JRST PKBRTL + +; PKBAL - Allocate more Packet Buffers +; Clobbers A,Q,T +; Returns .+1 if lost +; .+2 if won (must still call PKBGF to get a buffer from list) + +PKBAL: PUSH P,B + CONI PI,Q ; Save PI channel-on status + ANDI Q,177 + CONO PI,UTCOFF ; Make the world safe for IOMQ + MOVE B,PKBNT ; Check total # of buffers so far + CAIL B,NPKB ; Make sure we're not already using max allowed + JRST PKBAL4 ; Ugh, already at max! Go complain. + PUSHJ P,IOMQ ; Get 1K of memory + JRST PKBAL3 ; Mem not available, fail + CONO PI,PICON(Q) ; Won, restore PI status + MOVEI B,MUPKT ; Set page type = packet + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ; Turn allocated page # into mem address + HRLI A,-<2000/PKBSIZ> ; Make AOBJN into page (# buffers per page) +PKBAL2: PUSHJ P,PKBRT ; Put them all on free list + ADDI A,PKBSIZ-1 + AOBJN A,PKBAL2 + MOVEI B,<2000/PKBSIZ> ; This many more buffers have been created + ADDM B,PKBNT ; Increase total (PKBNF bumped by PKBRT) + POP P,B + AOS (P) ; Take win return. + RET + + ; Here if packet stuff trying to use up too much core +PKBAL4: MOVE B,PKBCTM ; Don't complain too often + ADDI B,60.*30. ; Just once a minute + CAMLE B,TIME + JRST PKBAL3 + BUG CHECK,[PACKET NET ATTEMPTING TO USE TOO MUCH CORE] + MOVE B,TIME + MOVEM B,PKBCTM +PKBAL3: CONO PI,PICON(Q) ; Lost, restore PI status + POP P,B + POPJ P, ; and take error return. + + +; PKBCLN - Called only by core job, to clean up packet buffers. +; Smashes all ACs. + +PKBCLN: SKIPE A,PKBNT ; See if 2/3 or more of buffers free + SKIPN B,PKBNF + POPJ P, ; No buffers or none free, nothing to do + SUBM A,B + IDIV A,B ; Get ratio of total to used + CAIGE A,3 ; Note if B is zero, A is unchanged + POPJ P, ; and at least 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ; Scan memory for packet buffer pages +.ELSE MOVEI D,255. +PKBCL0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUPKT +PKBCL4: SOJGE D,PKBCL0 + JUMPL D,CPOPJ + MOVE A,D ; Quickly determine if any non-free buffers + LSH A,10. ; on this page + HRLI A,-<2000/PKBSIZ> + MOVE T,[SIXBIT/BRUNCH/] +PKBCL5: CAME T,1(A) + JRST PKBCL4 ; Not free, don't bother with slow stuff + ADDI A,PKBSIZ-1 + AOBJN A,PKBCL5 + SETZB C,PKBQHC ; Collect all free buffers on this page + MOVE E,PKBNF ; Loop about as many times as there are free buffers +PKBCL1: PUSHJ P,PKBGF ; Get next free buffer + JUMPE A,PKBCL2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,PKBQHC ; This one's on the page, save it + PUSHJ P,PKQPL + AOJA C,.+2 ] ; Count them + PUSHJ P,PKBRT ; Not on the page, put back. This depends on + ; the fact PKBRT puts back at END of list! + SOJG E,PKBCL1 +PKBCL2: CAIE C,<2000/PKBSIZ> ; Did we get the whole page? + JRST [ MOVEI Q,PKBQHC ; No, must punt this one, and + PUSHJ P,PKBRTL ; return all the buffers we saved up. + JRST PKBCL4] + MOVNS C ; Yes, get rid of these buffers + ADDM C,PKBNT ; Decrement total # of buffers in use + MOVE A,D + PUSHJ P,MEMR ; Flush the page from addr space + JRST PKBCLN ; Back to flush more, until quota done. diff --git a/system/tcpbuf.57 b/system/tcpbuf.57 new file mode 100644 index 0000000..5119865 --- /dev/null +++ b/system/tcpbuf.57 @@ -0,0 +1,588 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +COMMENT | + +Notes on TCP input and output buffers + +Ideally the TCP segment queues should be logically separate from the IP +datagram queues, but for efficiency it should be possible to have them +both together. + +Input buffers are expected to be lists of datagrams/segments. +This is reasonably simple, since pointers (in known places) can just be +set up to the data (whereever it is in the datagram/segment). +There is a problem with allocation/windows in this scheme, since it +is possible to run out of datagram buffers before running out of window, +if the remote site becomes cretinous about it and sends only a few +bytes per dgram very fast. But in that case re-transmission can just +force it to buffer up its output, so that future dgrams will be somewhat +more filled, so it is probably OK. If this does become a screw, can +add code to do compaction at clock level. + +Output buffers are a little more uncertain. Could have simple +circular buffer, with appropriate pointers set up so that IMP output +message is read directly from the buffer (same as NCP). Alternatively +could have queue of segments/datagrams all ready to go. Guess I'd +like to try doing the latter, to keep things "simple" by minimizing +the number of kinds of things floating around. + +Problem with putting output datagram together: can't always predict +ahead of time how big the leaders are going to be! Especially true +for IP level, which TCP is not supposed to know too much about. Thus +if not careful, it could happen that output is put into a segment too +close to the start of the buffer, so that there is not enough room for +the TCP and IP headers to fit in. Have to look at this; may need to +give up notion of keeping all the packet internals nicely contiguous. +Maximum IP header length is set at 60 bytes (15 words). The maximum +TCP header length is also 15 words. +Looking at the currently defined options, it seems unlikely that ITS +will use any of them, and if so, they can be predicted fairly easily on +a per-connection basis, so things should work out okay. Note that +the IP level can always simply fragment stuff if it really wants to be +that complex. + +It would be nice to be able to keep track of stuff which is on the +device (IMP) output queue but hasn't yet gone out, in order to add +last-minute bits (like ACK) or even some more data. Idea: output "queue" +is just a list of TCP connections that need attention, so can always +go in and mung stuff (even change mind about outputting) just by playing +with connection flags/lists. This is basically how NCP does it. + +Re packet buffer design: + Somewhat more hypothetical is the notion of keeping a "usage +count" for each buffer, so that pointers from the packet table entries +can point to several different buffers and not just one. When a usage +count hits zero, put the buffer on the freelist. Actually this is not +really needed for the case of a table entry pointing to more than one +buffer, but it IS needed for the case of more than one table entry +pointing to the same buffer. This might happen, for example, if +an internet bypass were set up so that datagrams going to ourselves +were simply vectored directly to the input queues. But for the +time being, it probably isn't too outrageous to simply re-copy the +datagram in question. (Also better emulates a fake network device). + +Suggest that lists point directly to themselves rather than +to start of entry; this allows low-level list routines to be used +on all lists. The higher-level routines of course have to know what +offsets to use for a specific list. Alternatively provide different routines +for each offset needed, and equate references to the appropriate routine +for each use. (This is what I'm trying at the moment, hence the IRPS) + +May want to use format ,, where is the addr +of the initial pointer (not initial node). This allows backtracking +to figure out what TCP connection or IP queue a packet belongs to. +Brute force approach is to simply have another word for the TCB index, etc. + +If this stuff is general enough it could be used for CHAOS packets also. +| + +COMMENT | + +Buffers are all 256 (400 octal) words long, and 4 of them fit on one +ITS page. This size was chosen because the maximum length of an IMP +message (not counting IMP-Host padding) is 255 words of 4 8-bit bytes +per word. This allows one extra word; not much. Taking away the +3 IMP leader words (which has to be done anyway for NCP to continue +working) gives us 4 spare words per buffer. + +This still may not be enough. Rather than shoe-horn some clever stuff +into each buffer header, I am opting to maintain "Packet Entries" in a +"Packet Table" separate from the "Packet Buffers" themselves. All +messages/datagrams/segments/packets are identified by a pointer +into the table. (Could use index, as for sockets/TCBs, but this is +awkward for lists). The entry identified by the pointer will contain +the actual pointers into the buffer associated with that packet. +[NOTE: may want to have these pointers point into various places, not +necessarily all the same buffer. Must think about this.] + +Free buffers are linked by a freelist pointer in their first word, +with an identifier in the second word to help GC. The only design +issue for the buffers themselves is how to set things up so that it is +easy to GC a large freelist, i.e. identify pages that have nothing +but free buffers in them and thus can be removed from the system's +address space. Currently I have simply adopted the strategem used for +CHAOS buffers (at CHCLN) to have the core job snuffle over the freelist. + +Note that the low-level routines for manipulating lists are actually +referenced via macros which are given an offset as argument. This +offset refers to the offset between the node pointer and the location +of the "next" pointer in the node; the macro will assemble into a +call to the right routine for that offset. Currently only offsets +up to 2 are supported; any lists that the packet is put on must +be threaded through the first 3 words of the node, and the macros check +for this. +| + + SUBTTL Packet Tracing Code + +IFNDEF PKTTRC,PKTTRC==:0 ; Nonzero turns tracing code on +IF1,IFN PKTTRC,.ERR IP packet tracing code included. + +COMMENT | + +This code can be used to keep a history of what happens to a packet. +The history is stored in the packet buffer as a series of indexes +into a table of named events. + +To trace a particular event use the TRCPKT macro. + + TRCPKT(REG,"String") + +REG is the register which currently contains an index to the packet +buffer table. The code is more efficient if the register is R. String +is the description of the event. + +To generate the event table, you must call the TRCCOD macro somewhere +after the last call to TRCPKT. + +| + +%NTRCE==:77 ; Allow this many trace events. Value must be a bit mask (all + ; ones) to work right. If you make it bigger than 77 + ; you have to change the "TRC%" in the macros to something + ; shorter, too. + +%%%TRC==1 + +; TRCCOD generates TRCTBL, which holds +; for each trace event. +DEFINE TRCCOD +IFN PKTTRC,[ +TRC%0==:<0,,[ASCIZ /Null event/]> +TRCTBL: REPEAT %%%TRC,CONC TRC%,\.RPCNT +IF2, REPEAT %%%TRC,CONC EXPUNGE TRC%,\.RPCNT +] +TERMIN + +DEFINE TRCPKT REG,&(EVENT) +IFN PKTTRC,[ +IFG %%%TRC-%NTRCE,.ERR Too many packet trace events! +CONC TRC%,\%%%TRC,==:<.,,[ASCIZ EVENT]> + IFN REG-R,[ + PUSH P,R + MOVE R,REG + ] + PUSH P,TT + MOVEI TT,%%%TRC + PUSHJ P,PKTPTS + POP P,TT + IFN REG-R,[ + POP P,R + ] +%%%TRC==%%%TRC+1 +] +TERMIN + +IFN PKTTRC,[ + +; Store information in the packet history data buffer +; "Information" is a 6-bit quantity which indexes into a table +; of strings. +; TT/ Reason index +; R/ Pkt Buffer index + +PKTPTS: CONO PI,PIOFF ; Freeze machine + DPB TT,PK.HSP(R) ; Store trace info + IBP PK.HSP(R) ; Bump BP + HRRZ TT,PK.HSP(R) ; Pick up history byte ref (address only) + CAIL TT,PK.HSP(R) ; If we've gotten to the bottom, + JRST [ MOVEI TT,PK.HST(R) ;Wrap around + HRLI TT,(<.BP %NTRCE_30.>) ; BP to left 6 bits + MOVEM TT,PK.HSP(R) ;Reset it to top + JRST .+1 ] + CONO PI,PION + POPJ P, +] + +;;; Packet Table Entries + +EBLK +IFNDEF PKBSIZ,PKBSIZ==400 ; 256. words per packet buffer +IFNDEF NPKPGS,NPKPGS==40. ; # pages OK to use for packet buffers +NPKB==:> ; # packet buffers available +NPKE==:NPKB ; # packet entry nodes. +IFN NPKB-NPKE,.ERR You must fix the UFLS at PKTGF. + +PKETBL: OFFSET -. + ; General (device driver, etc) +PK.FLG:: 1,,PKETBL+PK.L ; General - ,, + %PKPIL==: ; Packet locked at PI level, being output + %PKODN==:<1000,,> ; Packet has been output (else not yet) +;;; %PKNOF==:<2000,,> ; Packet should not be freed when output done. + %PKFLS==:<4000,,> ; Flush pkt if seen on output queue (ie dont output) + %PKRTR==:<10000,,> ; Packet is being re-transmitted by TCP + .SEE %PQFLX ; Low bits of LH used for on-list flags. + +PK.IP:: 0 ; IP Datagram - ,, + ; May be strung on Internet Queue, IP output queue +PK.TCP:: 0 ; TCP Segment - ,, + ; May be strung on TCB input Q, output retransmit Q +PK.TCI:: 0 ; TCP Segment - <# bytes data><# bytes offset> + PK%TDL==:<777700,,0> ; # octets of data in TCP segment + PK%TDO==:< 77,,770000> ; # octets data is offset from TCP header + PK%TCB==:< ,,007777> ; TCB connection index + PK$TDL==:<.BP PK%TDL,PK.TCI> + PK$TDO==:<.BP PK%TDO,PK.TCI> + PK$TCB==:<.BP PK%TCB,PK.TCI> +PK.BUF:: 0 ; General - <# wds>,, +PK.TIM:: 0 ; General - Time sent or received, int level (Sys time) +PK.DST:: 0 ; Immediate destination address if on output queue + +IFN PKTTRC,[ +PK.HST:: BLOCK 3 ; Packet trace history buffer +PK.HSP:: 0 ; Packet trace history pointer +] + +PK.L:: OFFSET 0 ; Length of a Packet-Entry (PE) node + REPEAT ,[ + IFN .RPCNT-, 1,,.+PK.L ; Build initial freelist + .ELSE 1,,0 + BLOCK PK.L-1 + ] +PKETBE==:.-PK.L ; Last legal PE pointer value + +PKEQHF: PKETBE,,PKETBL ; Header for Packet-Entry node freelist + +BBLK + +; A "queue" is a list of nodes pointed to by a "queue header" word +; of format ,,. Each node pointer points to +; the next node pointer (or zero if no more). +; There is a set of flags in the LH of a certain word, at offset +; PQ.FLG, that indicate which lists a node is currently on. + +PQ.FLG==:PK.FLG ; Offset of word list-flags are in. +%PQFLX==0 ; Initial val +IFNDEF %%%QOF,%%%QOF==0 ; This gets set to highest offset supported + +IRPS PKQGF,,[PKQGF0:PKQGF1:PKQGF2:]PKQPL,,[PKQPL0:PKQPL1:PKQPL2:]PKQPF,,[PKQPF0:PKQPF1:PKQPF2:]%PQFL,,[%PQFL0:%PQFL1:%PQFL2:] +IFG .IRPCNT-%%%QOF,%%%QOF==.IRPCNT + + %PQFL==:<1_.IRPCNT,,> ; Def a flag in LH at offset PQ.FLG + %PQFLX==%PQFLX\%PQFL ; Mask of all list-flags def'd. + +; PKQGF - Get first node from queue +; Q/ addr of queue header +; A/ addr of node (zero if none) + +PKQGF: CONO PI,PIOFF ; Work at all levels + HRRZ A,(Q) ; Get 1st from queue header word + JUMPE A,PIONJ ; None, so return zero. + MOVSI T,(%PQFL) ; Now clear appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's not on it any more. + TLNE T,(%PQFL) ; Paranoia plus + BUG HALT,[PK: GF node wasnt on list] + HRRZ T,.IRPCNT(A) ; Get 2nd + HRRM T,(Q) ; Make it 1st + CAIN T, ; If all's well, done. + SETZM (Q) ; Else must clear whole header +IFNDEF PIONJ,PIONJ: + CONO PI,PION + POPJ P, + +; PKQPL - Put node on queue as last thing. +; Q/ addr of queue header +; A/ addr of node +PKQPL: TRNN A,-1 ; More paranoia + BUG HALT,[PK: zero node ptr] + HLLZS .IRPCNT(A) ; Say this node is last one + CONO PI,PIOFF ; Work at all levels + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; plus check... + BUG HALT,[PK: node already on list] + HLRZ T,(Q) ; Get last node + HRLM A,(Q) ; Point to new last node + JUMPN T,[HRRM A,.IRPCNT(T) ; Make prev last node point to new last + JRST .+2] ; Skip over next instr!! + HRRM A,(Q) ; Queue was empty, make this the new first too + CONO PI,PION + POPJ P, + +; PKQPF - Put node on queue as first thing. +; Q/ addr of queue header +; A/ addr of node +PKQPF: TRNN A,-1 ; Yes more paranoia + BUG HALT,[PK: zero node ptr] + CONO PI,PIOFF + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; check... + BUG HALT,[PK: node already on list] + HRRZ T,(Q) ; Get first thing + CAIN A,(T) ; paranoia, avoid loops to self + BUG + HRRM T,.IRPCNT(A) ; Make it second thing + HRRM A,(Q) ; Make new first thing + CAIN T, + HRLM A,(Q) ; Was empty, also make it last thing. + CONO PI,PION + POPJ P, +TERMIN + +; Define PKQGF, etc so that they actually reference PKQGF0, etc as +; appropriate for the given offset. +IRP RTN,,[PKQGF,PKQPF,PKQPL] +DEFINE RTN ?OFFST=0, +CONC RTN,\OFFST +IFG OFFST-%%%QOF,.ERR RTN used with bad offset +TERMIN +TERMIN + + +; PKEGF - Get a free Packet-Entry node +; Clears node contents. +; Clobbers Q,T +; Returns A/ PE ptr (0 if none) + +PKEGF: MOVEI Q,PKEQHF +IFE PKTTRC,[ + CALRET PKQGF ; Get a node +] +IFN PKTTRC,[ + CALL PKQGF + JUMPE A,CPOPJ ; No packet + SETZM PK.HST(A) + SETZM PK.HST+1(A) + SETZM PK.HST+2(A) + MOVEI Q,PK.HST(A) ; Build byte ref to history trail + HRLI Q,(<.BP %NTRCE_30.>) ; (dpb ref) + MOVEM Q,PK.HSP(A) ; save ref + POPJ P, +] + +; PKERT - Return a Packet-Entry node to freelist +; A/ PE ptr to node +; Clobbers Q,T + +PKERT: MOVEI Q,PKEQHF ; Use Packet-Entry freelist + CALRET PKQPF ; Put back on start of list. + +; Note that all MP calls to the routines below which allocate or free +; entries/buffers must be sure not to block (page fault or UFLS) +; while any "loose" entries/buffers exist (not pointed to by any list) +; unless there something on the PCLSR locked-switch list which will return the +; currently "loose" entry/buffer to its freelist -- otherwise +; it is possible for "loose" stuff to slowly accumulate. + +; PKTGF - Get a free Packet-Entry node and Packet Buffer. Hangs until +; it wins. Note that it depends on fact there is one PE node +; for every packet buffer, and vice versa! If this becomes untrue +; then the way it UFLSes should be fixed up. +; PKTGFI - version that skips if wins, doesn't hang. +; Returns A/ PE ptr Clobbers Q,T + +PKTGF: SKIPN PKEQHF ; Fast check, see if any packet entries/buffers free + CALL UFLS ; Nope, hang until something turns up. + CALL PKTGFI ; Get a entry/buffer! + JRST PKTGF ; None? Sigh, go hang. + RET + +PKTGFI: CALL PKEGF ; Get a free node + JUMPE A,CPOPJ + PUSH P,A ; Save pointer to it +PKTGF1: CALL PKBGF ; Get a free buffer + JUMPN A,PKTGF8 ; Jump if found one right away! + CALL PKBAL ; None left on freelist, try to allocate more. + CAIA ; Sigh, failed. + JRST PKTGF1 ; Won, go pluck a buffer from freelist. + + ; Lost, can't get any more buffers. + POP P,A ; None available, take non-skip return + CALRET PKERT ; Put PE node back on its freelist. + + ; Won, store buffer pointer in PE. +PKTGF8: MOVE T,A + POP P,A ; Restore PE ptr + MOVEM T,PK.BUF(A) + MOVE T,PQ.FLG(A) ; Paranoia dept, verify not on any lists. + TLNE T,(%PQFLX) + BUG HALT,[PK: Freelist node not free!] + SETZM PK.FLG(A) ; Zap all other entries in packet node. + SETZM PK.IP(A) + SETZM PK.TCP(A) + SETZM PK.TCI(A) + SETZM PK.TIM(A) + AOS (P) ; Win, skip on return! + RET + +; PKTRT - Return both a Packet-Entry and its associated buffer to freelist +; only if check shows that it doesn't belong to any lists. +; PKTRTA - Always return to freelist. If check shows that it is still +; on some list, bad error! +; Clobbers A,Q,T +; A/ PE ptr (must be off all lists) + +PKTRTA: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) + TLNE T,(%PQFLX\%PKPIL) ; On list or locked at I/O PI level? + BUG HALT,[PK: Freeing packet still in use!] + JRST PKTRTX ; Nope, can proceed to put on freelist. + +PKTRT: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) + TLNE T,(%PQFLX\%PKPIL) ; On a list or locked by interface PI level? + RET ; Yes, don't return to freelist yet. +PKTRTX: PUSH P,A ; Save PE ptr + SKIPE A,PK.BUF(A) ; Get buffer pointer associated with PE + CALL PKBRT ; Return the buffer + POP P,A + SETZM PK.BUF(A) ; Ensure buffer pointer zapped. + CALRET PKERT ; Then return the packet entry + +; PKTPCL - Return a packet entry/buffer while PCLSR'ing. +; This is the standard LOSSET routine to use. +; A must hold the PE ptr at time of the block (which we are backing +; out of). +; Must only clobber A and T!! + +PKTPCL: MOVE A,AC0S+A(U) ; Get ac A at time of the block + PUSH P,Q ; Mustn't clobber Q + CALL PKTRT ; Return the entry/buffer (clobbers Q,T) + JRST POPQJ + + +EBLK +PKBNF: 0 ; # free Packet Buffers +PKBNT: 0 ; # total Packet Buffers +PKBCTM: 0 ; Time of last no-more-core complaint +PKBQHF: 0 ; Queue Header for buffer freelist +PKBQHC: 0 ; Queue Header for core job cleanup +BBLK + +; PKBGF - Get a free Packet Buffer +; Clobbers Q,T +; Returns A/ PB ptr (0 if none) + +PKBGF: MOVEI Q,PKBQHF ; Point to buffer freelist + CALL PKQGF ; Get first thing off it + JUMPE A,CPOPJ ; If got nothing, just return. + SETZM 1(A) ; Aha, got it! Flush free-buffer identifier. + SOS PKBNF ; Decrement # free packet buffers. + RET + +; PKBRT - Return a Packet Buffer to freelist. Puts back at END of freelist, +; as PKBCLN clean-up depends on this. +; Clobbers Q,T +PKBRT: SETZM (A) ; Paranoia aid - clear "flags" in LH of 1st wd. + ; Otherwise PKQ routines complain. + MOVE T,[SIXBIT /BRUNCH/] + MOVEM T,1(A) ; Set up free-buffer identifier + AOS PKBNF ; Increment # free packet buffers. + MOVEI Q,PKBQHF ; Point to buffer freelist + CALRET PKQPL ; Put it back on, at end. + +; PKBRTL - Return a list of Packet Buffers to freelist +; Q/ ptr to queue header of list +; Clobbers A,T +PKBRTL: CALL PKQGF ; Get first thing off list + JUMPE A,CPOPJ + PUSH P,Q + CALL PKBRT ; Return it to buffer freelist + POP P,Q + JRST PKBRTL + +; PKBAL - Allocate more Packet Buffers +; Clobbers A,Q,T +; Returns .+1 if lost +; .+2 if won (must still call PKBGF to get a buffer from list) + +PKBAL: PUSH P,B + CONI PI,Q ; Save PI channel-on status + ANDI Q,177 + CONO PI,UTCOFF ; Make the world safe for IOMQ + MOVE B,PKBNT ; Check total # of buffers so far + CAIL B,NPKB ; Make sure we're not already using max allowed + JRST PKBAL4 ; Ugh, already at max! Go complain. + PUSHJ P,IOMQ ; Get 1K of memory + JRST PKBAL3 ; Mem not available, fail + CONO PI,PICON(Q) ; Won, restore PI status + MOVEI B,MUPKT ; Set page type = packet + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ; Turn allocated page # into mem address + HRLI A,-<2000/PKBSIZ> ; Make AOBJN into page (# buffers per page) +PKBAL2: PUSHJ P,PKBRT ; Put them all on free list + ADDI A,PKBSIZ-1 + AOBJN A,PKBAL2 + MOVEI B,<2000/PKBSIZ> ; This many more buffers have been created + ADDM B,PKBNT ; Increase total (PKBNF bumped by PKBRT) + POP P,B + AOS (P) ; Take win return. + RET + + ; Here if packet stuff trying to use up too much core +PKBAL4: MOVE B,PKBCTM ; Don't complain too often + ADDI B,60.*30. ; Just once a minute + CAMLE B,TIME + JRST PKBAL3 + BUG CHECK,[PACKET NET ATTEMPTING TO USE TOO MUCH CORE] + MOVE B,TIME + MOVEM B,PKBCTM +PKBAL3: CONO PI,PICON(Q) ; Lost, restore PI status + POP P,B + POPJ P, ; and take error return. + + +; PKBCLN - Called only by core job, to clean up packet buffers. +; Smashes all ACs. + +PKBCLN: SKIPE A,PKBNT ; See if 2/3 or more of buffers free + SKIPN B,PKBNF + POPJ P, ; No buffers or none free, nothing to do + SUBM A,B + IDIV A,B ; Get ratio of total to used + CAIGE A,3 ; Note if B is zero, A is unchanged + POPJ P, ; and at least 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ; Scan memory for packet buffer pages +.ELSE MOVEI D,255. +PKBCL0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUPKT +PKBCL4: SOJGE D,PKBCL0 + JUMPL D,CPOPJ + MOVE A,D ; Quickly determine if any non-free buffers + LSH A,10. ; on this page + HRLI A,-<2000/PKBSIZ> + MOVE T,[SIXBIT/BRUNCH/] +PKBCL5: CAME T,1(A) + JRST PKBCL4 ; Not free, don't bother with slow stuff + ADDI A,PKBSIZ-1 + AOBJN A,PKBCL5 + SETZB C,PKBQHC ; Collect all free buffers on this page + MOVE E,PKBNF ; Loop about as many times as there are free buffers +PKBCL1: PUSHJ P,PKBGF ; Get next free buffer + JUMPE A,PKBCL2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,PKBQHC ; This one's on the page, save it + PUSHJ P,PKQPL + AOJA C,.+2 ] ; Count them + PUSHJ P,PKBRT ; Not on the page, put back. This depends on + ; the fact PKBRT puts back at END of list! + SOJG E,PKBCL1 +PKBCL2: CAIE C,<2000/PKBSIZ> ; Did we get the whole page? + JRST [ MOVEI Q,PKBQHC ; No, must punt this one, and + PUSHJ P,PKBRTL ; return all the buffers we saved up. + JRST PKBCL4] + MOVNS C ; Yes, get rid of these buffers + ADDM C,PKBNT ; Decrement total # of buffers in use + MOVE A,D + PUSHJ P,MEMR ; Flush the page from addr space + JRST PKBCLN ; Back to flush more, until quota done. diff --git a/system/tcpbuf.58 b/system/tcpbuf.58 new file mode 100644 index 0000000..64243db --- /dev/null +++ b/system/tcpbuf.58 @@ -0,0 +1,591 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +COMMENT | + +Notes on TCP input and output buffers + +Ideally the TCP segment queues should be logically separate from the IP +datagram queues, but for efficiency it should be possible to have them +both together. + +Input buffers are expected to be lists of datagrams/segments. +This is reasonably simple, since pointers (in known places) can just be +set up to the data (whereever it is in the datagram/segment). +There is a problem with allocation/windows in this scheme, since it +is possible to run out of datagram buffers before running out of window, +if the remote site becomes cretinous about it and sends only a few +bytes per dgram very fast. But in that case re-transmission can just +force it to buffer up its output, so that future dgrams will be somewhat +more filled, so it is probably OK. If this does become a screw, can +add code to do compaction at clock level. + +Output buffers are a little more uncertain. Could have simple +circular buffer, with appropriate pointers set up so that IMP output +message is read directly from the buffer (same as NCP). Alternatively +could have queue of segments/datagrams all ready to go. Guess I'd +like to try doing the latter, to keep things "simple" by minimizing +the number of kinds of things floating around. + +Problem with putting output datagram together: can't always predict +ahead of time how big the leaders are going to be! Especially true +for IP level, which TCP is not supposed to know too much about. Thus +if not careful, it could happen that output is put into a segment too +close to the start of the buffer, so that there is not enough room for +the TCP and IP headers to fit in. Have to look at this; may need to +give up notion of keeping all the packet internals nicely contiguous. +Maximum IP header length is set at 60 bytes (15 words). The maximum +TCP header length is also 15 words. +Looking at the currently defined options, it seems unlikely that ITS +will use any of them, and if so, they can be predicted fairly easily on +a per-connection basis, so things should work out okay. Note that +the IP level can always simply fragment stuff if it really wants to be +that complex. + +It would be nice to be able to keep track of stuff which is on the +device (IMP) output queue but hasn't yet gone out, in order to add +last-minute bits (like ACK) or even some more data. Idea: output "queue" +is just a list of TCP connections that need attention, so can always +go in and mung stuff (even change mind about outputting) just by playing +with connection flags/lists. This is basically how NCP does it. + +Re packet buffer design: + Somewhat more hypothetical is the notion of keeping a "usage +count" for each buffer, so that pointers from the packet table entries +can point to several different buffers and not just one. When a usage +count hits zero, put the buffer on the freelist. Actually this is not +really needed for the case of a table entry pointing to more than one +buffer, but it IS needed for the case of more than one table entry +pointing to the same buffer. This might happen, for example, if +an internet bypass were set up so that datagrams going to ourselves +were simply vectored directly to the input queues. But for the +time being, it probably isn't too outrageous to simply re-copy the +datagram in question. (Also better emulates a fake network device). + +Suggest that lists point directly to themselves rather than +to start of entry; this allows low-level list routines to be used +on all lists. The higher-level routines of course have to know what +offsets to use for a specific list. Alternatively provide different routines +for each offset needed, and equate references to the appropriate routine +for each use. (This is what I'm trying at the moment, hence the IRPS) + +May want to use format ,, where is the addr +of the initial pointer (not initial node). This allows backtracking +to figure out what TCP connection or IP queue a packet belongs to. +Brute force approach is to simply have another word for the TCB index, etc. + +If this stuff is general enough it could be used for CHAOS packets also. +| + +COMMENT | + +-- Lots of this is wrong now... -- + +Buffers are all 256 (400 octal) words long, and 4 of them fit on one +ITS page. This size was chosen because the maximum length of an IMP +message (not counting IMP-Host padding) is 255 words of 4 8-bit bytes +per word. This allows one extra word; not much. Taking away the +3 IMP leader words (which has to be done anyway for NCP to continue +working) gives us 4 spare words per buffer. + +This still may not be enough. Rather than shoe-horn some clever stuff +into each buffer header, I am opting to maintain "Packet Entries" in a +"Packet Table" separate from the "Packet Buffers" themselves. All +messages/datagrams/segments/packets are identified by a pointer +into the table. (Could use index, as for sockets/TCBs, but this is +awkward for lists). The entry identified by the pointer will contain +the actual pointers into the buffer associated with that packet. +[NOTE: may want to have these pointers point into various places, not +necessarily all the same buffer. Must think about this.] + +Free buffers are linked by a freelist pointer in their first word, +with an identifier in the second word to help GC. The only design +issue for the buffers themselves is how to set things up so that it is +easy to GC a large freelist, i.e. identify pages that have nothing +but free buffers in them and thus can be removed from the system's +address space. Currently I have simply adopted the strategem used for +CHAOS buffers (at CHCLN) to have the core job snuffle over the freelist. + +Note that the low-level routines for manipulating lists are actually +referenced via macros which are given an offset as argument. This +offset refers to the offset between the node pointer and the location +of the "next" pointer in the node; the macro will assemble into a +call to the right routine for that offset. Currently only offsets +up to 2 are supported; any lists that the packet is put on must +be threaded through the first 3 words of the node, and the macros check +for this. +| + + SUBTTL Packet Tracing Code + +IFNDEF PKTTRC,PKTTRC==:0 ; Nonzero turns tracing code on +IF1,IFN PKTTRC,.ERR IP packet tracing code included. + +COMMENT | + +This code can be used to keep a history of what happens to a packet. +The history is stored in the packet buffer as a series of indexes +into a table of named events. + +To trace a particular event use the TRCPKT macro. + + TRCPKT(REG,"String") + +REG is the register which currently contains an index to the packet +buffer table. The code is more efficient if the register is R. String +is the description of the event. + +To generate the event table, you must call the TRCCOD macro somewhere +after the last call to TRCPKT. + +| + +%NTRCE==:77 ; Allow this many trace events. Value must be a bit mask (all + ; ones) to work right. If you make it bigger than 77 + ; you have to change the "TRC%" in the macros to something + ; shorter, too. + +%%%TRC==1 + +; TRCCOD generates TRCTBL, which holds +; for each trace event. +DEFINE TRCCOD +IFN PKTTRC,[ +TRC%0==:<0,,[ASCIZ /Null event/]> +TRCTBL: REPEAT %%%TRC,CONC TRC%,\.RPCNT +IF2, REPEAT %%%TRC,CONC EXPUNGE TRC%,\.RPCNT +] +TERMIN + +DEFINE TRCPKT REG,&(EVENT) +IFN PKTTRC,[ +IFG %%%TRC-%NTRCE,.ERR Too many packet trace events! +CONC TRC%,\%%%TRC,==:<.,,[ASCIZ EVENT]> + IFN REG-R,[ + PUSH P,R + MOVE R,REG + ] + PUSH P,TT + MOVEI TT,%%%TRC + PUSHJ P,PKTPTS + POP P,TT + IFN REG-R,[ + POP P,R + ] +%%%TRC==%%%TRC+1 +] +TERMIN + +IFN PKTTRC,[ + +; Store information in the packet history data buffer +; "Information" is a 6-bit quantity which indexes into a table +; of strings. +; TT/ Reason index +; R/ Pkt Buffer index + +PKTPTS: CONO PI,PIOFF ; Freeze machine + DPB TT,PK.HSP(R) ; Store trace info + IBP PK.HSP(R) ; Bump BP + HRRZ TT,PK.HSP(R) ; Pick up history byte ref (address only) + CAIL TT,PK.HSP(R) ; If we've gotten to the bottom, + JRST [ MOVEI TT,PK.HST(R) ;Wrap around + HRLI TT,(<.BP %NTRCE_30.>) ; BP to left 6 bits + MOVEM TT,PK.HSP(R) ;Reset it to top + JRST .+1 ] + CONO PI,PION + POPJ P, +] + +;;; Packet Table Entries + +EBLK +IFNDEF PKBSIZ,PKBSIZ==1000 ; 512. words per packet buffer (2048 byte MTU) +IFNDEF NPKPGS,NPKPGS==40. ; # pages OK to use for packet buffers +NPKB==:> ; # packet buffers available +NPKE==:NPKB ; # packet entry nodes. +IFN NPKB-NPKE,.ERR You must fix the UFLS at PKTGF. + +PKETBL: OFFSET -. + ; General (device driver, etc) +PK.FLG:: 1,,PKETBL+PK.L ; General - ,, + %PKPIL==: ; Packet locked at PI level, being output + %PKODN==:<1000,,> ; Packet has been output (else not yet) +;;; %PKNOF==:<2000,,> ; Packet should not be freed when output done. + %PKFLS==:<4000,,> ; Flush pkt if seen on output queue (ie dont output) + %PKRTR==:<10000,,> ; Packet is being re-transmitted by TCP + .SEE %PQFLX ; Low bits of LH used for on-list flags. + +PK.IP:: 0 ; IP Datagram - ,, + ; May be strung on Internet Queue, IP output queue +PK.TCP:: 0 ; TCP Segment - ,, + ; May be strung on TCB input Q, output retransmit Q +PK.TCI:: 0 ; TCP Segment - <# bytes data><# bytes offset> + PK%TDL==:<777700,,0> ; # octets of data in TCP segment + PK%TDO==:< 77,,770000> ; # octets data is offset from TCP header + PK%TCB==:< ,,007777> ; TCB connection index + PK$TDL==:<.BP PK%TDL,PK.TCI> + PK$TDO==:<.BP PK%TDO,PK.TCI> + PK$TCB==:<.BP PK%TCB,PK.TCI> +PK.BUF:: 0 ; General - <# wds>,, +PK.TIM:: 0 ; General - Time sent or received, int level (Sys time) +PK.DST:: 0 ; Immediate destination address if on output queue +PK.HWI:: 0 ; Hardware Information - currently KS Unibus address + +IFN PKTTRC,[ +PK.HST:: BLOCK 3 ; Packet trace history buffer +PK.HSP:: 0 ; Packet trace history pointer +] + +PK.L:: OFFSET 0 ; Length of a Packet-Entry (PE) node + REPEAT ,[ + IFN .RPCNT-, 1,,.+PK.L ; Build initial freelist + .ELSE 1,,0 + BLOCK PK.L-1 + ] +PKETBE==:.-PK.L ; Last legal PE pointer value + +PKEQHF: PKETBE,,PKETBL ; Header for Packet-Entry node freelist + +BBLK + +; A "queue" is a list of nodes pointed to by a "queue header" word +; of format ,,. Each node pointer points to +; the next node pointer (or zero if no more). +; There is a set of flags in the LH of a certain word, at offset +; PQ.FLG, that indicate which lists a node is currently on. + +PQ.FLG==:PK.FLG ; Offset of word list-flags are in. +%PQFLX==0 ; Initial val +IFNDEF %%%QOF,%%%QOF==0 ; This gets set to highest offset supported + +IRPS PKQGF,,[PKQGF0:PKQGF1:PKQGF2:]PKQPL,,[PKQPL0:PKQPL1:PKQPL2:]PKQPF,,[PKQPF0:PKQPF1:PKQPF2:]%PQFL,,[%PQFL0:%PQFL1:%PQFL2:] +IFG .IRPCNT-%%%QOF,%%%QOF==.IRPCNT + + %PQFL==:<1_.IRPCNT,,> ; Def a flag in LH at offset PQ.FLG + %PQFLX==%PQFLX\%PQFL ; Mask of all list-flags def'd. + +; PKQGF - Get first node from queue +; Q/ addr of queue header +; A/ addr of node (zero if none) + +PKQGF: CONO PI,PIOFF ; Work at all levels + HRRZ A,(Q) ; Get 1st from queue header word + JUMPE A,PIONJ ; None, so return zero. + MOVSI T,(%PQFL) ; Now clear appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's not on it any more. + TLNE T,(%PQFL) ; Paranoia plus + BUG HALT,[PK: GF node wasnt on list] + HRRZ T,.IRPCNT(A) ; Get 2nd + HRRM T,(Q) ; Make it 1st + CAIN T, ; If all's well, done. + SETZM (Q) ; Else must clear whole header +IFNDEF PIONJ,PIONJ: + CONO PI,PION + POPJ P, + +; PKQPL - Put node on queue as last thing. +; Q/ addr of queue header +; A/ addr of node +PKQPL: TRNN A,-1 ; More paranoia + BUG HALT,[PK: zero node ptr] + HLLZS .IRPCNT(A) ; Say this node is last one + CONO PI,PIOFF ; Work at all levels + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; plus check... + BUG HALT,[PK: node already on list] + HLRZ T,(Q) ; Get last node + HRLM A,(Q) ; Point to new last node + JUMPN T,[HRRM A,.IRPCNT(T) ; Make prev last node point to new last + JRST .+2] ; Skip over next instr!! + HRRM A,(Q) ; Queue was empty, make this the new first too + CONO PI,PION + POPJ P, + +; PKQPF - Put node on queue as first thing. +; Q/ addr of queue header +; A/ addr of node +PKQPF: TRNN A,-1 ; Yes more paranoia + BUG HALT,[PK: zero node ptr] + CONO PI,PIOFF + MOVSI T,(%PQFL) ; Paranoia: Set appropriate flag for list + XORB T,PQ.FLG(A) ; to indicate it's on it now. + TLNN T,(%PQFL) ; check... + BUG HALT,[PK: node already on list] + HRRZ T,(Q) ; Get first thing + CAIN A,(T) ; paranoia, avoid loops to self + BUG + HRRM T,.IRPCNT(A) ; Make it second thing + HRRM A,(Q) ; Make new first thing + CAIN T, + HRLM A,(Q) ; Was empty, also make it last thing. + CONO PI,PION + POPJ P, +TERMIN + +; Define PKQGF, etc so that they actually reference PKQGF0, etc as +; appropriate for the given offset. +IRP RTN,,[PKQGF,PKQPF,PKQPL] +DEFINE RTN ?OFFST=0, +CONC RTN,\OFFST +IFG OFFST-%%%QOF,.ERR RTN used with bad offset +TERMIN +TERMIN + + +; PKEGF - Get a free Packet-Entry node +; Clears node contents. +; Clobbers Q,T +; Returns A/ PE ptr (0 if none) + +PKEGF: MOVEI Q,PKEQHF +IFE PKTTRC,[ + CALRET PKQGF ; Get a node +] +IFN PKTTRC,[ + CALL PKQGF + JUMPE A,CPOPJ ; No packet + SETZM PK.HST(A) + SETZM PK.HST+1(A) + SETZM PK.HST+2(A) + MOVEI Q,PK.HST(A) ; Build byte ref to history trail + HRLI Q,(<.BP %NTRCE_30.>) ; (dpb ref) + MOVEM Q,PK.HSP(A) ; save ref + POPJ P, +] + +; PKERT - Return a Packet-Entry node to freelist +; A/ PE ptr to node +; Clobbers Q,T + +PKERT: MOVEI Q,PKEQHF ; Use Packet-Entry freelist + CALRET PKQPF ; Put back on start of list. + +; Note that all MP calls to the routines below which allocate or free +; entries/buffers must be sure not to block (page fault or UFLS) +; while any "loose" entries/buffers exist (not pointed to by any list) +; unless there something on the PCLSR locked-switch list which will return the +; currently "loose" entry/buffer to its freelist -- otherwise +; it is possible for "loose" stuff to slowly accumulate. + +; PKTGF - Get a free Packet-Entry node and Packet Buffer. Hangs until +; it wins. Note that it depends on fact there is one PE node +; for every packet buffer, and vice versa! If this becomes untrue +; then the way it UFLSes should be fixed up. +; PKTGFI - version that skips if wins, doesn't hang. +; Returns A/ PE ptr Clobbers Q,T + +PKTGF: SKIPN PKEQHF ; Fast check, see if any packet entries/buffers free + CALL UFLS ; Nope, hang until something turns up. + CALL PKTGFI ; Get a entry/buffer! + JRST PKTGF ; None? Sigh, go hang. + RET + +PKTGFI: CALL PKEGF ; Get a free node + JUMPE A,CPOPJ + PUSH P,A ; Save pointer to it +PKTGF1: CALL PKBGF ; Get a free buffer + JUMPN A,PKTGF8 ; Jump if found one right away! + CALL PKBAL ; None left on freelist, try to allocate more. + CAIA ; Sigh, failed. + JRST PKTGF1 ; Won, go pluck a buffer from freelist. + + ; Lost, can't get any more buffers. + POP P,A ; None available, take non-skip return + CALRET PKERT ; Put PE node back on its freelist. + + ; Won, store buffer pointer in PE. +PKTGF8: MOVE T,A + POP P,A ; Restore PE ptr + MOVEM T,PK.BUF(A) + MOVE T,PQ.FLG(A) ; Paranoia dept, verify not on any lists. + TLNE T,(%PQFLX) + BUG HALT,[PK: Freelist node not free!] + SETZM PK.FLG(A) ; Zap all other entries in packet node. + SETZM PK.IP(A) + SETZM PK.TCP(A) + SETZM PK.TCI(A) + SETZM PK.TIM(A) + AOS (P) ; Win, skip on return! + RET + +; PKTRT - Return both a Packet-Entry and its associated buffer to freelist +; only if check shows that it doesn't belong to any lists. +; PKTRTA - Always return to freelist. If check shows that it is still +; on some list, bad error! +; Clobbers A,Q,T +; A/ PE ptr (must be off all lists) + +PKTRTA: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) + TLNE T,(%PQFLX\%PKPIL) ; On list or locked at I/O PI level? + BUG HALT,[PK: Freeing packet still in use!] + JRST PKTRTX ; Nope, can proceed to put on freelist. + +PKTRT: CAIL A,PKETBL ; Paranoia check for legal pointers + CAILE A,PKETBE + BUG HALT,[PK: Bad PE pointer] + MOVE T,PQ.FLG(A) + TLNE T,(%PQFLX\%PKPIL) ; On a list or locked by interface PI level? + RET ; Yes, don't return to freelist yet. +PKTRTX: PUSH P,A ; Save PE ptr + SKIPE A,PK.BUF(A) ; Get buffer pointer associated with PE + CALL PKBRT ; Return the buffer + POP P,A + SETZM PK.BUF(A) ; Ensure buffer pointer zapped. + CALRET PKERT ; Then return the packet entry + +; PKTPCL - Return a packet entry/buffer while PCLSR'ing. +; This is the standard LOSSET routine to use. +; A must hold the PE ptr at time of the block (which we are backing +; out of). +; Must only clobber A and T!! + +PKTPCL: MOVE A,AC0S+A(U) ; Get ac A at time of the block + PUSH P,Q ; Mustn't clobber Q + CALL PKTRT ; Return the entry/buffer (clobbers Q,T) + JRST POPQJ + + +EBLK +PKBNF: 0 ; # free Packet Buffers +PKBNT: 0 ; # total Packet Buffers +PKBCTM: 0 ; Time of last no-more-core complaint +PKBQHF: 0 ; Queue Header for buffer freelist +PKBQHC: 0 ; Queue Header for core job cleanup +BBLK + +; PKBGF - Get a free Packet Buffer +; Clobbers Q,T +; Returns A/ PB ptr (0 if none) + +PKBGF: MOVEI Q,PKBQHF ; Point to buffer freelist + CALL PKQGF ; Get first thing off it + JUMPE A,CPOPJ ; If got nothing, just return. + SETZM 1(A) ; Aha, got it! Flush free-buffer identifier. + SOS PKBNF ; Decrement # free packet buffers. + RET + +; PKBRT - Return a Packet Buffer to freelist. Puts back at END of freelist, +; as PKBCLN clean-up depends on this. +; Clobbers Q,T +PKBRT: SETZM (A) ; Paranoia aid - clear "flags" in LH of 1st wd. + ; Otherwise PKQ routines complain. + MOVE T,[SIXBIT /BRUNCH/] + MOVEM T,1(A) ; Set up free-buffer identifier + AOS PKBNF ; Increment # free packet buffers. + MOVEI Q,PKBQHF ; Point to buffer freelist + CALRET PKQPL ; Put it back on, at end. + +; PKBRTL - Return a list of Packet Buffers to freelist +; Q/ ptr to queue header of list +; Clobbers A,T +PKBRTL: CALL PKQGF ; Get first thing off list + JUMPE A,CPOPJ + PUSH P,Q + CALL PKBRT ; Return it to buffer freelist + POP P,Q + JRST PKBRTL + +; PKBAL - Allocate more Packet Buffers +; Clobbers A,Q,T +; Returns .+1 if lost +; .+2 if won (must still call PKBGF to get a buffer from list) + +PKBAL: PUSH P,B + CONI PI,Q ; Save PI channel-on status + ANDI Q,177 + CONO PI,UTCOFF ; Make the world safe for IOMQ + MOVE B,PKBNT ; Check total # of buffers so far + CAIL B,NPKB ; Make sure we're not already using max allowed + JRST PKBAL4 ; Ugh, already at max! Go complain. + PUSHJ P,IOMQ ; Get 1K of memory + JRST PKBAL3 ; Mem not available, fail + CONO PI,PICON(Q) ; Won, restore PI status + MOVEI B,MUPKT ; Set page type = packet + DPB B,[MUR,,MEMBLT(A)] + LSH A,10. ; Turn allocated page # into mem address + HRLI A,-<2000/PKBSIZ> ; Make AOBJN into page (# buffers per page) +PKBAL2: PUSHJ P,PKBRT ; Put them all on free list + ADDI A,PKBSIZ-1 + AOBJN A,PKBAL2 + MOVEI B,<2000/PKBSIZ> ; This many more buffers have been created + ADDM B,PKBNT ; Increase total (PKBNF bumped by PKBRT) + POP P,B + AOS (P) ; Take win return. + RET + + ; Here if packet stuff trying to use up too much core +PKBAL4: MOVE B,PKBCTM ; Don't complain too often + ADDI B,60.*30. ; Just once a minute + CAMLE B,TIME + JRST PKBAL3 + BUG CHECK,[PACKET NET ATTEMPTING TO USE TOO MUCH CORE] + MOVE B,TIME + MOVEM B,PKBCTM +PKBAL3: CONO PI,PICON(Q) ; Lost, restore PI status + POP P,B + POPJ P, ; and take error return. + + +; PKBCLN - Called only by core job, to clean up packet buffers. +; Smashes all ACs. + +PKBCLN: SKIPE A,PKBNT ; See if 2/3 or more of buffers free + SKIPN B,PKBNF + POPJ P, ; No buffers or none free, nothing to do + SUBM A,B + IDIV A,B ; Get ratio of total to used + CAIGE A,3 ; Note if B is zero, A is unchanged + POPJ P, ; and at least 32. +IFL TSYSM-256., MOVEI D,TSYSM-1 ; Scan memory for packet buffer pages +.ELSE MOVEI D,255. +PKBCL0: LDB A,[MUR,,MEMBLT(D)] + CAIE A,MUPKT +PKBCL4: SOJGE D,PKBCL0 + JUMPL D,CPOPJ + MOVE A,D ; Quickly determine if any non-free buffers + LSH A,10. ; on this page + HRLI A,-<2000/PKBSIZ> + MOVE T,[SIXBIT/BRUNCH/] +PKBCL5: CAME T,1(A) + JRST PKBCL4 ; Not free, don't bother with slow stuff + ADDI A,PKBSIZ-1 + AOBJN A,PKBCL5 + SETZB C,PKBQHC ; Collect all free buffers on this page + MOVE E,PKBNF ; Loop about as many times as there are free buffers +PKBCL1: PUSHJ P,PKBGF ; Get next free buffer + JUMPE A,PKBCL2 + LDB B,[121000,,A] + CAMN B,D + JRST [ MOVEI Q,PKBQHC ; This one's on the page, save it + PUSHJ P,PKQPL + AOJA C,.+2 ] ; Count them + PUSHJ P,PKBRT ; Not on the page, put back. This depends on + ; the fact PKBRT puts back at END of list! + SOJG E,PKBCL1 +PKBCL2: CAIE C,<2000/PKBSIZ> ; Did we get the whole page? + JRST [ MOVEI Q,PKBQHC ; No, must punt this one, and + PUSHJ P,PKBRTL ; return all the buffers we saved up. + JRST PKBCL4] + MOVNS C ; Yes, get rid of these buffers + ADDM C,PKBNT ; Decrement total # of buffers in use + MOVE A,D + PUSHJ P,MEMR ; Flush the page from addr space + JRST PKBCLN ; Back to flush more, until quota done. diff --git a/system/time.948 b/system/time.948 new file mode 100644 index 0000000..6c86424 --- /dev/null +++ b/system/time.948 @@ -0,0 +1,359 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;I T S .OPERS RELEVANT TO REAL TIME + + ;.PDTIME AC, ;RETURNS PDUPS*<# SECS SINCE BEGINNING OF YEAR> + +APDTIM: PUSHJ P,GPDTIM + JRST RETM1 ;-1 IF NOT KNOWN + JRST APTUAJ + + ;.RDATE AC, ;RETURNS SIXBIT YYMMDD IN AC + +ARDATE: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # DAYS SINCE BEGINNING OF YEAR + PUSHJ P,RDATE ;GET THE ANSWER + JRST APTUAJ ;RETURN IT + + ;.RTIME AC, ;RETURNS SIXBIT HHMMSS (24 HOUR TIME) IN AC + +ARTIME: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # SECS SINCE MIDNIGHT IN B + PUSHJ P,RTIME ;CONVERT TO SIXBIT HHMMSS + JRST APTUAJ ;RETURN IT + + ;.RDATIM AC, ;DOES .RTIME TO AC, .RDATE TO AC+1 + +ARDATI: PUSHJ P,GLPDTM ;GET CRUD + JRST RETM1 ;NO LUCK (THIS IS GETTING BORING) + IDIVI A,SPD ;CONVERT TO DAYS AND SECONDS + HRLM A,(P) ;SAVE DAYS ON PDL + PUSHJ P,RTIME ;GET TIME (HHMMSS) + UMOVEM A,(J) ;GIVE TO USER + HLRZ A,(P) ;GET DAYS AGAIN + PUSHJ P,RDATE ;CONVERT TO SIXBIT + AOJA J,APTUAJ ;GIVE TO USER AND RETURN + + ;.RYEAR AC, ;PUSHJ'S TO RYEAR AND MOVEM'S E TO AC + +ARYEAR: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,(J) ;STORE YEAR AND CRUD + POPJ P, + + ;.RLPDT AC, ;DOES .RYEAR AC+1, AND ALSO MOVEM'S A TO AC + +ARLPDT: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,1(J) ;STORE YEAR AND CRUD + JRST APTUAJ ;STORE TIME AND RETURN + + ;ROUTINE TO RETURN -1 ON AN OPER + +RETM1: XCTR XRW,[SETOM (J)] + POPJ P, + + ;GET THE CORRECTED PDUPS*<# SECS SINCE BEGINNING OF YEAR> IN A + ;SKIP IF OFFSET AVAILABLE AND CLOCK ON + +GPDTIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;GET THE OFFSET + JRST GPDTM2 ;NOT AVAILABLE + DATAI PDCLK,B ;GET WHAT THE CLOCK IS SAYING + TLZ B,600000 + JUMPE B,GPDTM2 ;POWER PROBABLY (BUT NOT NECESSARILY) TURNED OFF + SUBM B,A ;DO THE CORRECTION + JUMPL A,CPOPJ ;LOST, DON'T RETURN A NEGATIVE NUMBER! + JRST POPJ1 ;EXIT SKIPPING (SUCCESS) +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Offset available? + JRST GPDTM2 ; No: Try backup + RDTIM A ; Read clock into A!B + TLC A,1729. ; "A most interesting number" + TLNE A,-1 ; Does the clock look like it has been set? + JRST GPDTM2 ; Must have been reset + DIVI A,<<1000._12.>+30.>/60. ; Convert to 60ths + SUB A,PDTIME ; Subtract offset + JUMPL A,CPOPJ ; Wooops, don't return a negative number! (Why + ; don't we use the backup in this case?) + JRST POPJ1 +] ;KS10P +GPDTM2: SKIPGE A,PDYTIM ;CLOCK NOT ON, TRY BACKUP + POPJ P, ;SORRY, NOT AVAILABLE + IMULI A,30. ;CONVERT TO SIXTIETHS OF A SECOND + JRST POPJ1 ;CALL IT CORRECT AND AVAILABLE + + ;GET SIXBIT YYMMDD (DATE) IN A (LOCALIZED PDTIME/SPD IN A, YEAR IN RH(E)) + +RDATE: PUSHJ P,RDATE1 ;GET DAY IN C, MONTH IN B + MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + PUSHJ P,RDATM1 ;DEPOSIT DAY + MOVE C,B ;GET MONTH + PUSHJ P,RDATM1 ;DEPOSIT MONTH + MOVEI B,(E) ;GET YEAR + IDIVI B,100. ;GET LAST TWO DIGITS IN C +ARTIMX: PUSHJ P,RDATM1 ;DEPOSIT YEAR (ENTRY FROM RTIME TO DEPOSIT HOUR) + IOR A,[SIXBIT /000000/] ;CONVERT TO REAL SIXBIT + POPJ P, + + ;GET MONTH (1 => JAN) IN B, DAY (1 => THE FIRST) IN C + +RDATE1: AOS C,A ;GET DAY OF YEAR (LOCALIZED) (1 => THE FIRST) + MOVEI B,12. ;INITIALLY ASSUME DECEMBER FOR MONTH + CAMG C,LMNTBL-1(B) ;IF DAY IN YEAR .LE. DAY IN YEAR AT BEGINNING OF THIS MONTH, + SOJA B,.-1 ;THEN DECREMENT TO PREVIOUS MONTH AND TRY AGAIN + SUB C,LMNTBL-1(B) ;C(C) := DAY OF MONTH + POPJ P, + +LMNTBL: MNIRP [] ;TABLE OF DAYS GONE BY AT BEGINNING OF MONTH + + ;GET THE SIXBIT TIME IN A (# SECS SINCE MIDNIGHT IN B) + +RTIME: MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + IDIVI B,60. ;GET SECONDS IN C + PUSHJ P,RDATM1 ;DEPOSIT INTO A + IDIVI B,60. ;GET HOURS IN B, MINUTES IN C + PUSHJ P,RDATM1 ;DEPOSIT MINUTES + MOVE C,B ;GET HOURS IN C + JRST ARTIMX ;DEPOSIT HOURS, CONVERT TO SIXBIT, AND RETURN + + ;DEPOSIT C(C) AS TWO SIX BIT (AS OPPOSED TO SIXBIT) DECIMAL DIGITS + ; VIA T (INTO A) THEN DECREMENT T + +RDATM1: IDIVI C,10. ;SEPARATE DIGITS + DPB C,[60600,,D] ;DEPOSIT FIRST DIGIT TO GIVE 12 BITS + DPB D,T ;OUTPUT BYTE + ADD T,[140000,,] ;DECREMENT BYTE POINTER + POPJ P, ;THAT'S ALL + + ;DO A PUSHJ P,GLPDTM THEN HACK AROUND + ;DO THOSE THINGS TO E COMMENTED IN GLPDTM AS BEING DONE BY RYEAR + ;TRY TO GET YEAR EVEN IF GLPDTM DOESN'T SKIP, BUT IN THAT CASE CLOBBER A TO -1 + +RYEAR: PUSHJ P,GLPDTM ;GET THE CRUFT + JRST RYEAR2 ;DIDN'T SKIP, SEE WHAT CAN BE SALVAGED +RYEAR1: PUSH P,A ;PROTECT A FROM FUTURE CLOBBERAGE + IDIVI A,SPD ;GET LOCALIZED # DAYS SINCE BEGINNING OF YEAR + JUMPL E,[SOJA A,.+1] ;DE-LOCALIZE + LDB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + ADD A,B ;ADD IN + IDIVI A,7 ;GET TODAY'S DAY OF WEEK (0 => SUNDAY) IN B + DPB B,[320300,,E] ;DEPOSIT IN E + TLO E,40000 ;DOCUMENT FACT THAT TIME OF YEAR KNOWN + JRST POPAJ ;RESTORE A AND RETURN + +RYEAR2: PUSHJ P,GDWOBY ;GLPDTM DIDN'T SKIP, TRY TO SALVAGE CRUFT: FIRST DOWOBY + MOVNI A,1 ;DOCUMENT FACT THAT TIME OF YEAR NOT KNOWN + JUMPE E,CPOPJ ;RETURN IF YEAR NOT KNOWN EITHER + DPB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + JRST CMPF29 ;SEE IF LEAP YEAR, AND RETURN + + ;NOTE: THE SYMS JAN, FEB, MAR, ETC. ARE DEFINED AFTER (AND BY) MNIRP (A MACRO) + + ;INCREMENT YEAR + +NUPDT: TLNN E,200000 ;SEE IF LEAP YEAR + SKIPA A,[<365.*SPD*PDUPS>] ;NORMAL YEAR + MOVE A,[<366.*SPD*PDUPS>] ;LEAP YEAR + ADDM A,PDTIME ;UPDATE PDCLK OFFSET + IDIVI A,30. ;CONVERT TO HALF-SECONDS + EXCH A,PDYTIM ;ALSO UPDATE BACKUP SYSTEM + SUBM A,PDYTIM + AOS FYEAR ;INCREMENT YEAR + + ;INSERT OTHER CRUFT HERE IF DESIRED + ;DROPS THROUGH + + ;CODING DROPS THROUGH FROM PREVIOUS PAGE +;GET "LOCALIZED" NUMBER OF SECONDS SINCE BEGINNING OF YEAR IN A + ;IF DIVIDED BY # SECONDS IN A DAY, + ;GIVES REMAINDER OF # SECONDS SINCE MIDNIGHT LOCAL TIME + ;QUOTIENT WHEN FED TO DATE GENERATOR ROUTINE ASSUMING LEAP YEAR GIVES CORRECT DATE +;ALSO GET YEAR AND FLAGS (AS RETURNED BY .RYEAR) IN E + ;1.1-2.9 => YEAR (E.G. 1969.) + ;3.1-3.5 ZERO + ;3.6-3.8 => DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + ;3.9-4.2 ZERO (RYEAR SETS THIS BYTE TO TODAY'S DAY OF WEEK IF TIME OF YEAR KNOWN) + ;4.6 ZERO (RYEAR SETS IT TO 1 IF TIME OF YEAR KNOWN) + ;4.7 ONE => DAYLIGHT SAVINGS TIME IN EFFECT + ;4.8 ONE => LEAP YEAR + ;4.9 ONE => 365 DAY YEAR AND AFTER FEB 28 +;SKIPS IF PDCLK ON AND BOTH PDTIME AND FYEAR NON-ZERO (IN OTHER WORDS IF SUCCESSFUL) +;PREVIOUS CODING DROPS THROUGH ON YEAR INCREMENT + +GLPDTM: CONO PI,CLKOFF ;AVOID DOUBLE YEAR INCREMENT + SKIPE E,FYEAR ;GET YEAR IN E, SKIP IF NOT AVAILABLE + PUSHJ P,GPDTIM ;GET PDTIME, SHOULD SKIP + JRST CLKONJ ;SOMETHING NOT AVAILABLE, DON'T SKIP + IDIVI A,60. ;CONVERT TO SECONDS + PUSHJ P,CMPF29 ;MAYBE SET BIT 4.8 OR 4.9 OF E, IF 4.9 SET THEN ADD SPD TO A + CAML A,[366.*SPD] ;IF MORE THAN A YEAR HAS GONE, + JRST NUPDT ;THEN INCREMENT YEAR + CONO PI,CLKON ;TIMIMG ERROR PROBLEM GONE + PUSH P,A ;SAVE # SECONDS DURING NEXT CALL + PUSHJ P,GDWOBY ;GET DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + DPB B,[270300,,E] ;DEPOSIT IN RIGHT PLACE + POP P,A ;RESTORE A + AOS (P) ;CAUSE RETURN TO SKIP + + ;IF DAYLIGHT SAVINGS TIME THEN ADD 3600. TO A AND SET BIT 4.7 IN E + +GLPDT2: JFCL ;POPJ FOR STD TIME + ;JRST CRDDST FOR DAY LIGHT TIME + ;JFCL "NORMAL" + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 24, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCT 31, + POPJ P, ;THEN OBVIOUSLY STANDARD TIME IS IN EFFECT + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 30 STANDARD TIME, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCTOBER 25, + JRST GLPDT3 ;THEN NOT OBVIOUS +CRDDST: TLO E,100000 ;DAYLIGHT SAVINGS TIME, SET BIT IN E + ADDI A,3600. ;CONTINUE TO LOCALIZE THE TIME THAT WILL BE RETURNED + POPJ P, + + ;IT IS NOW SOMETIME DURING THE WEEKS IN APR AND OCTOBER + ;WHEN IT MAY BE EITHER STANDARD OR DAYLIGHT SAVINGS TIME + +GLPDT3: PUSH P,A ;SAVE # SECS + CAMG A,[JUL*SPD] ;IF NOT YET JULY, + TDZA D,D ;THEN IT MUST BE APR, SET INDEX + MOVEI D,1 ;OCTOBER, SET INDEX + SUB A,CRDSB(D) ;COMPENSATE FOR 2AM OR 1AM + IDIVI A,SPD ;FLUSH SECONDS, LEAVE ONLY DAYS (IT LOOKS LIKE A LEAP YEAR, REMEMBER) + LDB C,[270300,,E] ;GET DAY OF WEEK OF BEGINNING OF YEAR IN C + JUMPGE E,.+3 ;IF REGULAR YEAR, + SOJGE C,.+2 ;THEN DE-LOCALIZE SO IT WILL RE-LOCALIZE LATER... + MOVEI C,6 ;MOD 7 + ADD A,C ;ADD TO NUMBER OF DAYS + IDIVI A,7 + IMULI A,7 + SUB A,C ;C(A) := NUMBER OF DAYS IN YEAR BEFORE LAST SUNDAY (MAYBE TODAY) + ;IF LAST SUNDAY (AS DEFINED ABOVE) IS BELOW THE "REGION OF AMBIGUITY", + ;THEN IT HAS NOT YET CHANGED TO THE LATER TIME + XCT CRDTST(D) ;SKIP IF DAYLIGHT SAVINGS TIME + JRST POPAJ ;STANDARD TIME, NO CHANGES NECESSARY + POP P,A ;DAYLIGHT SAVINGS TIME, RESTORE A + JRST CRDDST ;MUNG A AND E AND RETURN + +CRDSB: 7200. ;IN APR CHANGES AT 2AM EST + 3600. ;IN OCTOBER CHANGES AT 1AM EST + +CRDTST: CAIGE A, + CAIL A, + + ;IF LEAP YEAR THEN SET BIT 4.8 OF E + ;IF NOT LEAP YEAR THEN IF AFTER FEB 28 THEN SET BIT 4.9 OF E AND ADD SPD TO A + +CMPF29: TRNN E,3 ;IF LEAP YEAR, (HOPEFULLY THIS ONLY PLACE WHERE DIRECTLY CHECKED FOR LEAP YEAR) + TLOA E,200000 ;THEN SET BIT 4.8 OF E AND RETURN + CAMGE A,[<-1>*SPD] ;365 DAY YEAR, IF BEFORE MARCH FIRST, + POPJ P, ;THEN RETURN + TLO E,400000 ;365 DAY YEAR AFTER FEB 28, SET BIT 4.9 OF E + ADDI A,SPD ;INCREMENT A ONE DAY + POPJ P, + + ;GET DAY OF WEEK OF BEGINNING OF YEAR (IN E) (0 => SUNDAY) IN B + ;FOLLOWING ROUTINE HAS BEEN EXHAUSTIVELY CHECKED + +GDWOBY: MOVEI A,-1(E) + IDIVI A,400. + MOVEI A,1(B) + IDIVI B,4 + ADD A,B + IDIVI B,25. + SUB A,B + IDIVI A,7 + POPJ P, + + ;SLOW CLOCK ROUTINE TO CHECK ON REAL-TIME CLOCK SYSTEM + +PDCCHK: SKIPL PDYTIM ;IF BACKUP TIME (SINCE BEGINNING OF YEAR) CALCULATED, + AOS PDYTIM ;THEN UPDATE IT + SKIPGE TIMOFF ;IF TIMOFF NOT CALCULATED, + POPJ P, ;THEN RETURN + AOS A,TIMOFF ;UPDATE TIMOFF + CAMGE A,[2*SPD] ;Incremented beyond length of day? + JRST PDCCH1 + SETZB A,TIMOFF ;Yes - reset it. + MOVEM A,RSWTIM ;Also reset last-resource-warning timestamp. +PDCCH1: TRNE A,64.*2-1 ;Is this a 64. second (based on TIMOFF) clock break? + POPJ P, ; No, so return. +INITIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;MAYBE UPDATE BACKUP SYSTEM + JRST INITM2 ;PDTIME NOT AVAILABLE, DON'T + DATAI PDCLK,B + TLZ B,600000 + JUMPE B,INITM2 ;JUMP IF CLOCK OFF + SUBM B,A + JUMPL A,CPOPJ + IDIVI A,30. ;CONVERT TO HALF-SECONDS SINCE BEGINNING OF YEAR + MOVEM A,PDYTIM ;STORE RE-CALCULATED BACKUP TIME +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Update backup system? + JRST INITM2 ; Not without offset + RDTIM A + TLC A,1729. + TLNE A,-1 + JRST INITM2 ; Not if clock reset + DIVI A,<<1000._12.>+30.>/60. + SUB A,PDTIME ; 60ths since Jan 1 + JUMPL A,CPOPJ + IDIVI A,30. ; halfs since Jan 1 + MOVEM A,PDYTIM ; Store backup +] ;KS10P +INITM2: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + POPJ P, ;SOMETHING'S MISSING + IDIVI A,SPD ;SEPARATE INTO DAYS AND SECONDS + LSH B,1 ;CONVERT TIME SINCE MIDNIGHT TO HALF-SECONDS + MOVEM B,TIMOFF ;STORE RE-CALCULATED NUMBER OF HALF-SECONDS SINCE MIDNIGHT + PUSHJ P,CLCQDT ;GET QDATE,,TIMOFF IN A + CONO PI,UTCOFF ;INHIBIT INTERRUPTS DURING THIS RITUAL + SKIPGE A,QMDRO ;GET ORIGIN OF MASTER DSK DIRECTORY + JRST UTCONJ ;DIRECTORY LOCKED + MOVE B,QACTB ;DIRECTORY CHANGED BIT FOR DSK DIRECTORY + SKIPE T,PDTIME ;GET OFFSET FOR DECORIOLIS CLOCK + CAMN T,MPDOFF(A) ;SEE IF IT MATCHES RELEVANT WORD IN DSKDIR + JRST .+3 ;MATCHES OR PDTIME NOT AVAILABLE + MOVEM T,MPDOFF(A) ;NO MATCH, CORRECT THE DSKDIR ONE + IORM B,QMDRO ;SET DIRECTORY CHANGED BIT + SKIPE T,FYEAR ;NOW DO THE SAME FOR THE YEAR, + CAMN T,MDYEAR(A) ;AND THE RELEVANT WORD IN DSKDIR + JRST .+3 + MOVEM T,MDYEAR(A) + IORM B,QMDRO + JRST UTCONJ ;THAT'S ALL + +CLCQDT: PUSHJ P,RDATE1 ;GET DAY OF MONTH IN C, MONTH IN B + SETZM QDATE ;INITIALIZE FOR FOLLOWING + PUSH P,E-1 + PUSH P,E + MOVE E-1,FYEAR + IDIVI E-1,100. + DPB E,[330700,,QDATE] ;YEAR + POP P,E + POP P,E-1 + DPB B,[270400,,QDATE] ;MONTH + DPB C,[220500,,QDATE] ;DAY + MOVE C,QDATE ;THE FIRST TIME QDATE IS SET UP, + HRR C,TIMOFF ;SET UP QDATEI = TIME SYSTEM CAME UP. + SKIPGE QDATEI + MOVEM C,QDATEI ;MECHANISM IS, SET QDATEI UNLESS ALREADY SET. + POPJ P, diff --git a/system/time.949 b/system/time.949 new file mode 100644 index 0000000..0a4efcf --- /dev/null +++ b/system/time.949 @@ -0,0 +1,359 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;I T S .OPERS RELEVANT TO REAL TIME + + ;.PDTIME AC, ;RETURNS PDUPS*<# SECS SINCE BEGINNING OF YEAR> + +APDTIM: PUSHJ P,GPDTIM + JRST RETM1 ;-1 IF NOT KNOWN + JRST APTUAJ + + ;.RDATE AC, ;RETURNS SIXBIT YYMMDD IN AC + +ARDATE: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # DAYS SINCE BEGINNING OF YEAR + PUSHJ P,RDATE ;GET THE ANSWER + JRST APTUAJ ;RETURN IT + + ;.RTIME AC, ;RETURNS SIXBIT HHMMSS (24 HOUR TIME) IN AC + +ARTIME: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # SECS SINCE MIDNIGHT IN B + PUSHJ P,RTIME ;CONVERT TO SIXBIT HHMMSS + JRST APTUAJ ;RETURN IT + + ;.RDATIM AC, ;DOES .RTIME TO AC, .RDATE TO AC+1 + +ARDATI: PUSHJ P,GLPDTM ;GET CRUD + JRST RETM1 ;NO LUCK (THIS IS GETTING BORING) + IDIVI A,SPD ;CONVERT TO DAYS AND SECONDS + HRLM A,(P) ;SAVE DAYS ON PDL + PUSHJ P,RTIME ;GET TIME (HHMMSS) + UMOVEM A,(J) ;GIVE TO USER + HLRZ A,(P) ;GET DAYS AGAIN + PUSHJ P,RDATE ;CONVERT TO SIXBIT + AOJA J,APTUAJ ;GIVE TO USER AND RETURN + + ;.RYEAR AC, ;PUSHJ'S TO RYEAR AND MOVEM'S E TO AC + +ARYEAR: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,(J) ;STORE YEAR AND CRUD + POPJ P, + + ;.RLPDT AC, ;DOES .RYEAR AC+1, AND ALSO MOVEM'S A TO AC + +ARLPDT: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,1(J) ;STORE YEAR AND CRUD + JRST APTUAJ ;STORE TIME AND RETURN + + ;ROUTINE TO RETURN -1 ON AN OPER + +RETM1: XCTR XRW,[SETOM (J)] + POPJ P, + + ;GET THE CORRECTED PDUPS*<# SECS SINCE BEGINNING OF YEAR> IN A + ;SKIP IF OFFSET AVAILABLE AND CLOCK ON + +GPDTIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;GET THE OFFSET + JRST GPDTM2 ;NOT AVAILABLE + DATAI PDCLK,B ;GET WHAT THE CLOCK IS SAYING + TLZ B,600000 + JUMPE B,GPDTM2 ;POWER PROBABLY (BUT NOT NECESSARILY) TURNED OFF + SUBM B,A ;DO THE CORRECTION + JUMPL A,CPOPJ ;LOST, DON'T RETURN A NEGATIVE NUMBER! + JRST POPJ1 ;EXIT SKIPPING (SUCCESS) +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Offset available? + JRST GPDTM2 ; No: Try backup + RDTIM A ; Read clock into A!B + TLC A,1729. ; "A most interesting number" + TLNE A,-1 ; Does the clock look like it has been set? + JRST GPDTM2 ; Must have been reset + DIVI A,KSFREQ ; Convert to 60ths + SUB A,PDTIME ; Subtract offset + JUMPL A,CPOPJ ; Wooops, don't return a negative number! (Why + ; don't we use the backup in this case?) + JRST POPJ1 +] ;KS10P +GPDTM2: SKIPGE A,PDYTIM ;CLOCK NOT ON, TRY BACKUP + POPJ P, ;SORRY, NOT AVAILABLE + IMULI A,30. ;CONVERT TO SIXTIETHS OF A SECOND + JRST POPJ1 ;CALL IT CORRECT AND AVAILABLE + + ;GET SIXBIT YYMMDD (DATE) IN A (LOCALIZED PDTIME/SPD IN A, YEAR IN RH(E)) + +RDATE: PUSHJ P,RDATE1 ;GET DAY IN C, MONTH IN B + MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + PUSHJ P,RDATM1 ;DEPOSIT DAY + MOVE C,B ;GET MONTH + PUSHJ P,RDATM1 ;DEPOSIT MONTH + MOVEI B,(E) ;GET YEAR + IDIVI B,100. ;GET LAST TWO DIGITS IN C +ARTIMX: PUSHJ P,RDATM1 ;DEPOSIT YEAR (ENTRY FROM RTIME TO DEPOSIT HOUR) + IOR A,[SIXBIT /000000/] ;CONVERT TO REAL SIXBIT + POPJ P, + + ;GET MONTH (1 => JAN) IN B, DAY (1 => THE FIRST) IN C + +RDATE1: AOS C,A ;GET DAY OF YEAR (LOCALIZED) (1 => THE FIRST) + MOVEI B,12. ;INITIALLY ASSUME DECEMBER FOR MONTH + CAMG C,LMNTBL-1(B) ;IF DAY IN YEAR .LE. DAY IN YEAR AT BEGINNING OF THIS MONTH, + SOJA B,.-1 ;THEN DECREMENT TO PREVIOUS MONTH AND TRY AGAIN + SUB C,LMNTBL-1(B) ;C(C) := DAY OF MONTH + POPJ P, + +LMNTBL: MNIRP [] ;TABLE OF DAYS GONE BY AT BEGINNING OF MONTH + + ;GET THE SIXBIT TIME IN A (# SECS SINCE MIDNIGHT IN B) + +RTIME: MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + IDIVI B,60. ;GET SECONDS IN C + PUSHJ P,RDATM1 ;DEPOSIT INTO A + IDIVI B,60. ;GET HOURS IN B, MINUTES IN C + PUSHJ P,RDATM1 ;DEPOSIT MINUTES + MOVE C,B ;GET HOURS IN C + JRST ARTIMX ;DEPOSIT HOURS, CONVERT TO SIXBIT, AND RETURN + + ;DEPOSIT C(C) AS TWO SIX BIT (AS OPPOSED TO SIXBIT) DECIMAL DIGITS + ; VIA T (INTO A) THEN DECREMENT T + +RDATM1: IDIVI C,10. ;SEPARATE DIGITS + DPB C,[60600,,D] ;DEPOSIT FIRST DIGIT TO GIVE 12 BITS + DPB D,T ;OUTPUT BYTE + ADD T,[140000,,] ;DECREMENT BYTE POINTER + POPJ P, ;THAT'S ALL + + ;DO A PUSHJ P,GLPDTM THEN HACK AROUND + ;DO THOSE THINGS TO E COMMENTED IN GLPDTM AS BEING DONE BY RYEAR + ;TRY TO GET YEAR EVEN IF GLPDTM DOESN'T SKIP, BUT IN THAT CASE CLOBBER A TO -1 + +RYEAR: PUSHJ P,GLPDTM ;GET THE CRUFT + JRST RYEAR2 ;DIDN'T SKIP, SEE WHAT CAN BE SALVAGED +RYEAR1: PUSH P,A ;PROTECT A FROM FUTURE CLOBBERAGE + IDIVI A,SPD ;GET LOCALIZED # DAYS SINCE BEGINNING OF YEAR + JUMPL E,[SOJA A,.+1] ;DE-LOCALIZE + LDB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + ADD A,B ;ADD IN + IDIVI A,7 ;GET TODAY'S DAY OF WEEK (0 => SUNDAY) IN B + DPB B,[320300,,E] ;DEPOSIT IN E + TLO E,40000 ;DOCUMENT FACT THAT TIME OF YEAR KNOWN + JRST POPAJ ;RESTORE A AND RETURN + +RYEAR2: PUSHJ P,GDWOBY ;GLPDTM DIDN'T SKIP, TRY TO SALVAGE CRUFT: FIRST DOWOBY + MOVNI A,1 ;DOCUMENT FACT THAT TIME OF YEAR NOT KNOWN + JUMPE E,CPOPJ ;RETURN IF YEAR NOT KNOWN EITHER + DPB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + JRST CMPF29 ;SEE IF LEAP YEAR, AND RETURN + + ;NOTE: THE SYMS JAN, FEB, MAR, ETC. ARE DEFINED AFTER (AND BY) MNIRP (A MACRO) + + ;INCREMENT YEAR + +NUPDT: TLNN E,200000 ;SEE IF LEAP YEAR + SKIPA A,[<365.*SPD*PDUPS>] ;NORMAL YEAR + MOVE A,[<366.*SPD*PDUPS>] ;LEAP YEAR + ADDM A,PDTIME ;UPDATE PDCLK OFFSET + IDIVI A,30. ;CONVERT TO HALF-SECONDS + EXCH A,PDYTIM ;ALSO UPDATE BACKUP SYSTEM + SUBM A,PDYTIM + AOS FYEAR ;INCREMENT YEAR + + ;INSERT OTHER CRUFT HERE IF DESIRED + ;DROPS THROUGH + + ;CODING DROPS THROUGH FROM PREVIOUS PAGE +;GET "LOCALIZED" NUMBER OF SECONDS SINCE BEGINNING OF YEAR IN A + ;IF DIVIDED BY # SECONDS IN A DAY, + ;GIVES REMAINDER OF # SECONDS SINCE MIDNIGHT LOCAL TIME + ;QUOTIENT WHEN FED TO DATE GENERATOR ROUTINE ASSUMING LEAP YEAR GIVES CORRECT DATE +;ALSO GET YEAR AND FLAGS (AS RETURNED BY .RYEAR) IN E + ;1.1-2.9 => YEAR (E.G. 1969.) + ;3.1-3.5 ZERO + ;3.6-3.8 => DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + ;3.9-4.2 ZERO (RYEAR SETS THIS BYTE TO TODAY'S DAY OF WEEK IF TIME OF YEAR KNOWN) + ;4.6 ZERO (RYEAR SETS IT TO 1 IF TIME OF YEAR KNOWN) + ;4.7 ONE => DAYLIGHT SAVINGS TIME IN EFFECT + ;4.8 ONE => LEAP YEAR + ;4.9 ONE => 365 DAY YEAR AND AFTER FEB 28 +;SKIPS IF PDCLK ON AND BOTH PDTIME AND FYEAR NON-ZERO (IN OTHER WORDS IF SUCCESSFUL) +;PREVIOUS CODING DROPS THROUGH ON YEAR INCREMENT + +GLPDTM: CONO PI,CLKOFF ;AVOID DOUBLE YEAR INCREMENT + SKIPE E,FYEAR ;GET YEAR IN E, SKIP IF NOT AVAILABLE + PUSHJ P,GPDTIM ;GET PDTIME, SHOULD SKIP + JRST CLKONJ ;SOMETHING NOT AVAILABLE, DON'T SKIP + IDIVI A,60. ;CONVERT TO SECONDS + PUSHJ P,CMPF29 ;MAYBE SET BIT 4.8 OR 4.9 OF E, IF 4.9 SET THEN ADD SPD TO A + CAML A,[366.*SPD] ;IF MORE THAN A YEAR HAS GONE, + JRST NUPDT ;THEN INCREMENT YEAR + CONO PI,CLKON ;TIMIMG ERROR PROBLEM GONE + PUSH P,A ;SAVE # SECONDS DURING NEXT CALL + PUSHJ P,GDWOBY ;GET DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + DPB B,[270300,,E] ;DEPOSIT IN RIGHT PLACE + POP P,A ;RESTORE A + AOS (P) ;CAUSE RETURN TO SKIP + + ;IF DAYLIGHT SAVINGS TIME THEN ADD 3600. TO A AND SET BIT 4.7 IN E + +GLPDT2: JFCL ;POPJ FOR STD TIME + ;JRST CRDDST FOR DAY LIGHT TIME + ;JFCL "NORMAL" + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 24, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCT 31, + POPJ P, ;THEN OBVIOUSLY STANDARD TIME IS IN EFFECT + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 30 STANDARD TIME, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCTOBER 25, + JRST GLPDT3 ;THEN NOT OBVIOUS +CRDDST: TLO E,100000 ;DAYLIGHT SAVINGS TIME, SET BIT IN E + ADDI A,3600. ;CONTINUE TO LOCALIZE THE TIME THAT WILL BE RETURNED + POPJ P, + + ;IT IS NOW SOMETIME DURING THE WEEKS IN APR AND OCTOBER + ;WHEN IT MAY BE EITHER STANDARD OR DAYLIGHT SAVINGS TIME + +GLPDT3: PUSH P,A ;SAVE # SECS + CAMG A,[JUL*SPD] ;IF NOT YET JULY, + TDZA D,D ;THEN IT MUST BE APR, SET INDEX + MOVEI D,1 ;OCTOBER, SET INDEX + SUB A,CRDSB(D) ;COMPENSATE FOR 2AM OR 1AM + IDIVI A,SPD ;FLUSH SECONDS, LEAVE ONLY DAYS (IT LOOKS LIKE A LEAP YEAR, REMEMBER) + LDB C,[270300,,E] ;GET DAY OF WEEK OF BEGINNING OF YEAR IN C + JUMPGE E,.+3 ;IF REGULAR YEAR, + SOJGE C,.+2 ;THEN DE-LOCALIZE SO IT WILL RE-LOCALIZE LATER... + MOVEI C,6 ;MOD 7 + ADD A,C ;ADD TO NUMBER OF DAYS + IDIVI A,7 + IMULI A,7 + SUB A,C ;C(A) := NUMBER OF DAYS IN YEAR BEFORE LAST SUNDAY (MAYBE TODAY) + ;IF LAST SUNDAY (AS DEFINED ABOVE) IS BELOW THE "REGION OF AMBIGUITY", + ;THEN IT HAS NOT YET CHANGED TO THE LATER TIME + XCT CRDTST(D) ;SKIP IF DAYLIGHT SAVINGS TIME + JRST POPAJ ;STANDARD TIME, NO CHANGES NECESSARY + POP P,A ;DAYLIGHT SAVINGS TIME, RESTORE A + JRST CRDDST ;MUNG A AND E AND RETURN + +CRDSB: 7200. ;IN APR CHANGES AT 2AM EST + 3600. ;IN OCTOBER CHANGES AT 1AM EST + +CRDTST: CAIGE A, + CAIL A, + + ;IF LEAP YEAR THEN SET BIT 4.8 OF E + ;IF NOT LEAP YEAR THEN IF AFTER FEB 28 THEN SET BIT 4.9 OF E AND ADD SPD TO A + +CMPF29: TRNN E,3 ;IF LEAP YEAR, (HOPEFULLY THIS ONLY PLACE WHERE DIRECTLY CHECKED FOR LEAP YEAR) + TLOA E,200000 ;THEN SET BIT 4.8 OF E AND RETURN + CAMGE A,[<-1>*SPD] ;365 DAY YEAR, IF BEFORE MARCH FIRST, + POPJ P, ;THEN RETURN + TLO E,400000 ;365 DAY YEAR AFTER FEB 28, SET BIT 4.9 OF E + ADDI A,SPD ;INCREMENT A ONE DAY + POPJ P, + + ;GET DAY OF WEEK OF BEGINNING OF YEAR (IN E) (0 => SUNDAY) IN B + ;FOLLOWING ROUTINE HAS BEEN EXHAUSTIVELY CHECKED + +GDWOBY: MOVEI A,-1(E) + IDIVI A,400. + MOVEI A,1(B) + IDIVI B,4 + ADD A,B + IDIVI B,25. + SUB A,B + IDIVI A,7 + POPJ P, + + ;SLOW CLOCK ROUTINE TO CHECK ON REAL-TIME CLOCK SYSTEM + +PDCCHK: SKIPL PDYTIM ;IF BACKUP TIME (SINCE BEGINNING OF YEAR) CALCULATED, + AOS PDYTIM ;THEN UPDATE IT + SKIPGE TIMOFF ;IF TIMOFF NOT CALCULATED, + POPJ P, ;THEN RETURN + AOS A,TIMOFF ;UPDATE TIMOFF + CAMGE A,[2*SPD] ;Incremented beyond length of day? + JRST PDCCH1 + SETZB A,TIMOFF ;Yes - reset it. + MOVEM A,RSWTIM ;Also reset last-resource-warning timestamp. +PDCCH1: TRNE A,64.*2-1 ;Is this a 64. second (based on TIMOFF) clock break? + POPJ P, ; No, so return. +INITIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;MAYBE UPDATE BACKUP SYSTEM + JRST INITM2 ;PDTIME NOT AVAILABLE, DON'T + DATAI PDCLK,B + TLZ B,600000 + JUMPE B,INITM2 ;JUMP IF CLOCK OFF + SUBM B,A + JUMPL A,CPOPJ + IDIVI A,30. ;CONVERT TO HALF-SECONDS SINCE BEGINNING OF YEAR + MOVEM A,PDYTIM ;STORE RE-CALCULATED BACKUP TIME +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Update backup system? + JRST INITM2 ; Not without offset + RDTIM A + TLC A,1729. + TLNE A,-1 + JRST INITM2 ; Not if clock reset + DIVI A,KSFREQ + SUB A,PDTIME ; 60ths since Jan 1 + JUMPL A,CPOPJ + IDIVI A,30. ; halfs since Jan 1 + MOVEM A,PDYTIM ; Store backup +] ;KS10P +INITM2: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + POPJ P, ;SOMETHING'S MISSING + IDIVI A,SPD ;SEPARATE INTO DAYS AND SECONDS + LSH B,1 ;CONVERT TIME SINCE MIDNIGHT TO HALF-SECONDS + MOVEM B,TIMOFF ;STORE RE-CALCULATED NUMBER OF HALF-SECONDS SINCE MIDNIGHT + PUSHJ P,CLCQDT ;GET QDATE,,TIMOFF IN A + CONO PI,UTCOFF ;INHIBIT INTERRUPTS DURING THIS RITUAL + SKIPGE A,QMDRO ;GET ORIGIN OF MASTER DSK DIRECTORY + JRST UTCONJ ;DIRECTORY LOCKED + MOVE B,QACTB ;DIRECTORY CHANGED BIT FOR DSK DIRECTORY + SKIPE T,PDTIME ;GET OFFSET FOR DECORIOLIS CLOCK + CAMN T,MPDOFF(A) ;SEE IF IT MATCHES RELEVANT WORD IN DSKDIR + JRST .+3 ;MATCHES OR PDTIME NOT AVAILABLE + MOVEM T,MPDOFF(A) ;NO MATCH, CORRECT THE DSKDIR ONE + IORM B,QMDRO ;SET DIRECTORY CHANGED BIT + SKIPE T,FYEAR ;NOW DO THE SAME FOR THE YEAR, + CAMN T,MDYEAR(A) ;AND THE RELEVANT WORD IN DSKDIR + JRST .+3 + MOVEM T,MDYEAR(A) + IORM B,QMDRO + JRST UTCONJ ;THAT'S ALL + +CLCQDT: PUSHJ P,RDATE1 ;GET DAY OF MONTH IN C, MONTH IN B + SETZM QDATE ;INITIALIZE FOR FOLLOWING + PUSH P,E-1 + PUSH P,E + MOVE E-1,FYEAR + IDIVI E-1,100. + DPB E,[330700,,QDATE] ;YEAR + POP P,E + POP P,E-1 + DPB B,[270400,,QDATE] ;MONTH + DPB C,[220500,,QDATE] ;DAY + MOVE C,QDATE ;THE FIRST TIME QDATE IS SET UP, + HRR C,TIMOFF ;SET UP QDATEI = TIME SYSTEM CAME UP. + SKIPGE QDATEI + MOVEM C,QDATEI ;MECHANISM IS, SET QDATEI UNLESS ALREADY SET. + POPJ P, diff --git a/system/time.950 b/system/time.950 new file mode 100644 index 0000000..1007c41 --- /dev/null +++ b/system/time.950 @@ -0,0 +1,359 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;I T S .OPERS RELEVANT TO REAL TIME + + ;.PDTIME AC, ;RETURNS PDUPS*<# SECS SINCE BEGINNING OF YEAR> + +APDTIM: PUSHJ P,GPDTIM + JRST RETM1 ;-1 IF NOT KNOWN + JRST APTUAJ + + ;.RDATE AC, ;RETURNS SIXBIT YYMMDD IN AC + +ARDATE: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # DAYS SINCE BEGINNING OF YEAR + PUSHJ P,RDATE ;GET THE ANSWER + JRST APTUAJ ;RETURN IT + + ;.RTIME AC, ;RETURNS SIXBIT HHMMSS (24 HOUR TIME) IN AC + +ARTIME: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + JRST RETM1 ;NOT AVAILABLE + IDIVI A,SPD ;GET # SECS SINCE MIDNIGHT IN B + PUSHJ P,RTIME ;CONVERT TO SIXBIT HHMMSS + JRST APTUAJ ;RETURN IT + + ;.RDATIM AC, ;DOES .RTIME TO AC, .RDATE TO AC+1 + +ARDATI: PUSHJ P,GLPDTM ;GET CRUD + JRST RETM1 ;NO LUCK (THIS IS GETTING BORING) + IDIVI A,SPD ;CONVERT TO DAYS AND SECONDS + HRLM A,(P) ;SAVE DAYS ON PDL + PUSHJ P,RTIME ;GET TIME (HHMMSS) + UMOVEM A,(J) ;GIVE TO USER + HLRZ A,(P) ;GET DAYS AGAIN + PUSHJ P,RDATE ;CONVERT TO SIXBIT + AOJA J,APTUAJ ;GIVE TO USER AND RETURN + + ;.RYEAR AC, ;PUSHJ'S TO RYEAR AND MOVEM'S E TO AC + +ARYEAR: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,(J) ;STORE YEAR AND CRUD + POPJ P, + + ;.RLPDT AC, ;DOES .RYEAR AC+1, AND ALSO MOVEM'S A TO AC + +ARLPDT: PUSHJ P,RYEAR ;GET THE CRUFT + UMOVEM E,1(J) ;STORE YEAR AND CRUD + JRST APTUAJ ;STORE TIME AND RETURN + + ;ROUTINE TO RETURN -1 ON AN OPER + +RETM1: XCTR XRW,[SETOM (J)] + POPJ P, + + ;GET THE CORRECTED PDUPS*<# SECS SINCE BEGINNING OF YEAR> IN A + ;SKIP IF OFFSET AVAILABLE AND CLOCK ON + +GPDTIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;GET THE OFFSET + JRST GPDTM2 ;NOT AVAILABLE + DATAI PDCLK,B ;GET WHAT THE CLOCK IS SAYING + TLZ B,600000 + JUMPE B,GPDTM2 ;POWER PROBABLY (BUT NOT NECESSARILY) TURNED OFF + SUBM B,A ;DO THE CORRECTION + JUMPL A,CPOPJ ;LOST, DON'T RETURN A NEGATIVE NUMBER! + JRST POPJ1 ;EXIT SKIPPING (SUCCESS) +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Offset available? + JRST GPDTM2 ; No: Try backup + RDTIM A ; Read clock into A!B + TLC A,1729. ; "A most interesting number" + TLNE A,-1 ; Does the clock look like it has been set? + JRST GPDTM2 ; Must have been reset + DIVI A,KSFREQ ; Convert to 60ths + SUB A,PDTIME ; Subtract offset + JUMPL A,CPOPJ ; Wooops, don't return a negative number! (Why + ; don't we use the backup in this case?) + JRST POPJ1 +] ;KS10P +GPDTM2: SKIPGE A,PDYTIM ;CLOCK NOT ON, TRY BACKUP + POPJ P, ;SORRY, NOT AVAILABLE + IMULI A,30. ;CONVERT TO SIXTIETHS OF A SECOND + JRST POPJ1 ;CALL IT CORRECT AND AVAILABLE + + ;GET SIXBIT YYMMDD (DATE) IN A (LOCALIZED PDTIME/SPD IN A, YEAR IN RH(E)) + +RDATE: PUSHJ P,RDATE1 ;GET DAY IN C, MONTH IN B + MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + PUSHJ P,RDATM1 ;DEPOSIT DAY + MOVE C,B ;GET MONTH + PUSHJ P,RDATM1 ;DEPOSIT MONTH + MOVEI B,(E) ;GET YEAR + IDIVI B,100. ;GET LAST TWO DIGITS IN C +ARTIMX: PUSHJ P,RDATM1 ;DEPOSIT YEAR (ENTRY FROM RTIME TO DEPOSIT HOUR) + IOR A,[SIXBIT /000000/] ;CONVERT TO REAL SIXBIT + POPJ P, + + ;GET MONTH (1 => JAN) IN B, DAY (1 => THE FIRST) IN C + +RDATE1: AOS C,A ;GET DAY OF YEAR (LOCALIZED) (1 => THE FIRST) + MOVEI B,12. ;INITIALLY ASSUME DECEMBER FOR MONTH + CAMG C,LMNTBL-1(B) ;IF DAY IN YEAR .LE. DAY IN YEAR AT BEGINNING OF THIS MONTH, + SOJA B,.-1 ;THEN DECREMENT TO PREVIOUS MONTH AND TRY AGAIN + SUB C,LMNTBL-1(B) ;C(C) := DAY OF MONTH + POPJ P, + +LMNTBL: MNIRP [] ;TABLE OF DAYS GONE BY AT BEGINNING OF MONTH + + ;GET THE SIXBIT TIME IN A (# SECS SINCE MIDNIGHT IN B) + +RTIME: MOVE T,[1400,,A];SET UP BYTE POINTER FOR OUTPUT + IDIVI B,60. ;GET SECONDS IN C + PUSHJ P,RDATM1 ;DEPOSIT INTO A + IDIVI B,60. ;GET HOURS IN B, MINUTES IN C + PUSHJ P,RDATM1 ;DEPOSIT MINUTES + MOVE C,B ;GET HOURS IN C + JRST ARTIMX ;DEPOSIT HOURS, CONVERT TO SIXBIT, AND RETURN + + ;DEPOSIT C(C) AS TWO SIX BIT (AS OPPOSED TO SIXBIT) DECIMAL DIGITS + ; VIA T (INTO A) THEN DECREMENT T + +RDATM1: IDIVI C,10. ;SEPARATE DIGITS + DPB C,[60600,,D] ;DEPOSIT FIRST DIGIT TO GIVE 12 BITS + DPB D,T ;OUTPUT BYTE + ADD T,[140000,,] ;DECREMENT BYTE POINTER + POPJ P, ;THAT'S ALL + + ;DO A PUSHJ P,GLPDTM THEN HACK AROUND + ;DO THOSE THINGS TO E COMMENTED IN GLPDTM AS BEING DONE BY RYEAR + ;TRY TO GET YEAR EVEN IF GLPDTM DOESN'T SKIP, BUT IN THAT CASE CLOBBER A TO -1 + +RYEAR: PUSHJ P,GLPDTM ;GET THE CRUFT + JRST RYEAR2 ;DIDN'T SKIP, SEE WHAT CAN BE SALVAGED +RYEAR1: PUSH P,A ;PROTECT A FROM FUTURE CLOBBERAGE + IDIVI A,SPD ;GET LOCALIZED # DAYS SINCE BEGINNING OF YEAR + JUMPL E,[SOJA A,.+1] ;DE-LOCALIZE + LDB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + ADD A,B ;ADD IN + IDIVI A,7 ;GET TODAY'S DAY OF WEEK (0 => SUNDAY) IN B + DPB B,[320300,,E] ;DEPOSIT IN E + TLO E,40000 ;DOCUMENT FACT THAT TIME OF YEAR KNOWN + JRST POPAJ ;RESTORE A AND RETURN + +RYEAR2: PUSHJ P,GDWOBY ;GLPDTM DIDN'T SKIP, TRY TO SALVAGE CRUFT: FIRST DOWOBY + MOVNI A,1 ;DOCUMENT FACT THAT TIME OF YEAR NOT KNOWN + JUMPE E,CPOPJ ;RETURN IF YEAR NOT KNOWN EITHER + DPB B,[270300,,E] ;DAY OF WEEK OF BEGINNING OF YEAR + JRST CMPF29 ;SEE IF LEAP YEAR, AND RETURN + + ;NOTE: THE SYMS JAN, FEB, MAR, ETC. ARE DEFINED AFTER (AND BY) MNIRP (A MACRO) + + ;INCREMENT YEAR + +NUPDT: TLNN E,200000 ;SEE IF LEAP YEAR + SKIPA A,[<365.*SPD*PDUPS>] ;NORMAL YEAR + MOVE A,[<366.*SPD*PDUPS>] ;LEAP YEAR + ADDM A,PDTIME ;UPDATE PDCLK OFFSET + IDIVI A,30. ;CONVERT TO HALF-SECONDS + EXCH A,PDYTIM ;ALSO UPDATE BACKUP SYSTEM + SUBM A,PDYTIM + AOS FYEAR ;INCREMENT YEAR + + ;INSERT OTHER CRUFT HERE IF DESIRED + ;DROPS THROUGH + + ;CODING DROPS THROUGH FROM PREVIOUS PAGE +;GET "LOCALIZED" NUMBER OF SECONDS SINCE BEGINNING OF YEAR IN A + ;IF DIVIDED BY # SECONDS IN A DAY, + ;GIVES REMAINDER OF # SECONDS SINCE MIDNIGHT LOCAL TIME + ;QUOTIENT WHEN FED TO DATE GENERATOR ROUTINE ASSUMING LEAP YEAR GIVES CORRECT DATE +;ALSO GET YEAR AND FLAGS (AS RETURNED BY .RYEAR) IN E + ;1.1-2.9 => YEAR (E.G. 1969.) + ;3.1-3.5 ZERO + ;3.6-3.8 => DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + ;3.9-4.2 ZERO (RYEAR SETS THIS BYTE TO TODAY'S DAY OF WEEK IF TIME OF YEAR KNOWN) + ;4.6 ZERO (RYEAR SETS IT TO 1 IF TIME OF YEAR KNOWN) + ;4.7 ONE => DAYLIGHT SAVINGS TIME IN EFFECT + ;4.8 ONE => LEAP YEAR + ;4.9 ONE => 365 DAY YEAR AND AFTER FEB 28 +;SKIPS IF PDCLK ON AND BOTH PDTIME AND FYEAR NON-ZERO (IN OTHER WORDS IF SUCCESSFUL) +;PREVIOUS CODING DROPS THROUGH ON YEAR INCREMENT + +GLPDTM: CONO PI,CLKOFF ;AVOID DOUBLE YEAR INCREMENT + SKIPE E,FYEAR ;GET YEAR IN E, SKIP IF NOT AVAILABLE + PUSHJ P,GPDTIM ;GET PDTIME, SHOULD SKIP + JRST CLKONJ ;SOMETHING NOT AVAILABLE, DON'T SKIP + IDIVI A,60. ;CONVERT TO SECONDS + PUSHJ P,CMPF29 ;MAYBE SET BIT 4.8 OR 4.9 OF E, IF 4.9 SET THEN ADD SPD TO A + CAML A,[366.*SPD] ;IF MORE THAN A YEAR HAS GONE, + JRST NUPDT ;THEN INCREMENT YEAR + CONO PI,CLKON ;TIMIMG ERROR PROBLEM GONE + PUSH P,A ;SAVE # SECONDS DURING NEXT CALL + PUSHJ P,GDWOBY ;GET DAY OF WEEK OF BEGINNING OF YEAR (0 => SUNDAY) + DPB B,[270300,,E] ;DEPOSIT IN RIGHT PLACE + POP P,A ;RESTORE A + AOS (P) ;CAUSE RETURN TO SKIP + + ;IF DAYLIGHT SAVINGS TIME THEN ADD 3600. TO A AND SET BIT 4.7 IN E + +GLPDT2: JFCL ;POPJ FOR STD TIME + ;JRST CRDDST FOR DAY LIGHT TIME + ;JFCL "NORMAL" + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 1, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCT 31, + POPJ P, ;THEN OBVIOUSLY STANDARD TIME IS IN EFFECT + CAML A,[*SPD+7200.] ;IF BEFORE 2AM APR 7 STANDARD TIME, + CAML A,[*SPD+3600.] ;OR IF AFTER 1AM STANDARD TIME OCTOBER 25, + JRST GLPDT3 ;THEN NOT OBVIOUS +CRDDST: TLO E,100000 ;DAYLIGHT SAVINGS TIME, SET BIT IN E + ADDI A,3600. ;CONTINUE TO LOCALIZE THE TIME THAT WILL BE RETURNED + POPJ P, + + ;IT IS NOW SOMETIME DURING THE WEEKS IN APR AND OCTOBER + ;WHEN IT MAY BE EITHER STANDARD OR DAYLIGHT SAVINGS TIME + +GLPDT3: PUSH P,A ;SAVE # SECS + CAMG A,[JUL*SPD] ;IF NOT YET JULY, + TDZA D,D ;THEN IT MUST BE APR, SET INDEX + MOVEI D,1 ;OCTOBER, SET INDEX + SUB A,CRDSB(D) ;COMPENSATE FOR 2AM OR 1AM + IDIVI A,SPD ;FLUSH SECONDS, LEAVE ONLY DAYS (IT LOOKS LIKE A LEAP YEAR, REMEMBER) + LDB C,[270300,,E] ;GET DAY OF WEEK OF BEGINNING OF YEAR IN C + JUMPGE E,.+3 ;IF REGULAR YEAR, + SOJGE C,.+2 ;THEN DE-LOCALIZE SO IT WILL RE-LOCALIZE LATER... + MOVEI C,6 ;MOD 7 + ADD A,C ;ADD TO NUMBER OF DAYS + IDIVI A,7 + IMULI A,7 + SUB A,C ;C(A) := NUMBER OF DAYS IN YEAR BEFORE LAST SUNDAY (MAYBE TODAY) + ;IF LAST SUNDAY (AS DEFINED ABOVE) IS BELOW THE "REGION OF AMBIGUITY", + ;THEN IT HAS NOT YET CHANGED TO THE LATER TIME + XCT CRDTST(D) ;SKIP IF DAYLIGHT SAVINGS TIME + JRST POPAJ ;STANDARD TIME, NO CHANGES NECESSARY + POP P,A ;DAYLIGHT SAVINGS TIME, RESTORE A + JRST CRDDST ;MUNG A AND E AND RETURN + +CRDSB: 7200. ;IN APR CHANGES AT 2AM EST + 3600. ;IN OCTOBER CHANGES AT 1AM EST + +CRDTST: CAIGE A, + CAIL A, + + ;IF LEAP YEAR THEN SET BIT 4.8 OF E + ;IF NOT LEAP YEAR THEN IF AFTER FEB 28 THEN SET BIT 4.9 OF E AND ADD SPD TO A + +CMPF29: TRNN E,3 ;IF LEAP YEAR, (HOPEFULLY THIS ONLY PLACE WHERE DIRECTLY CHECKED FOR LEAP YEAR) + TLOA E,200000 ;THEN SET BIT 4.8 OF E AND RETURN + CAMGE A,[<-1>*SPD] ;365 DAY YEAR, IF BEFORE MARCH FIRST, + POPJ P, ;THEN RETURN + TLO E,400000 ;365 DAY YEAR AFTER FEB 28, SET BIT 4.9 OF E + ADDI A,SPD ;INCREMENT A ONE DAY + POPJ P, + + ;GET DAY OF WEEK OF BEGINNING OF YEAR (IN E) (0 => SUNDAY) IN B + ;FOLLOWING ROUTINE HAS BEEN EXHAUSTIVELY CHECKED + +GDWOBY: MOVEI A,-1(E) + IDIVI A,400. + MOVEI A,1(B) + IDIVI B,4 + ADD A,B + IDIVI B,25. + SUB A,B + IDIVI A,7 + POPJ P, + + ;SLOW CLOCK ROUTINE TO CHECK ON REAL-TIME CLOCK SYSTEM + +PDCCHK: SKIPL PDYTIM ;IF BACKUP TIME (SINCE BEGINNING OF YEAR) CALCULATED, + AOS PDYTIM ;THEN UPDATE IT + SKIPGE TIMOFF ;IF TIMOFF NOT CALCULATED, + POPJ P, ;THEN RETURN + AOS A,TIMOFF ;UPDATE TIMOFF + CAMGE A,[2*SPD] ;Incremented beyond length of day? + JRST PDCCH1 + SETZB A,TIMOFF ;Yes - reset it. + MOVEM A,RSWTIM ;Also reset last-resource-warning timestamp. +PDCCH1: TRNE A,64.*2-1 ;Is this a 64. second (based on TIMOFF) clock break? + POPJ P, ; No, so return. +INITIM: +IFN PDCLKP,[ + SKIPN A,PDTIME ;MAYBE UPDATE BACKUP SYSTEM + JRST INITM2 ;PDTIME NOT AVAILABLE, DON'T + DATAI PDCLK,B + TLZ B,600000 + JUMPE B,INITM2 ;JUMP IF CLOCK OFF + SUBM B,A + JUMPL A,CPOPJ + IDIVI A,30. ;CONVERT TO HALF-SECONDS SINCE BEGINNING OF YEAR + MOVEM A,PDYTIM ;STORE RE-CALCULATED BACKUP TIME +] ;PDCLKP +IFN KS10P,[ + SKIPN PDTIME ; Update backup system? + JRST INITM2 ; Not without offset + RDTIM A + TLC A,1729. + TLNE A,-1 + JRST INITM2 ; Not if clock reset + DIVI A,KSFREQ + SUB A,PDTIME ; 60ths since Jan 1 + JUMPL A,CPOPJ + IDIVI A,30. ; halfs since Jan 1 + MOVEM A,PDYTIM ; Store backup +] ;KS10P +INITM2: PUSHJ P,GLPDTM ;GET LOCALIZED PDTIME + POPJ P, ;SOMETHING'S MISSING + IDIVI A,SPD ;SEPARATE INTO DAYS AND SECONDS + LSH B,1 ;CONVERT TIME SINCE MIDNIGHT TO HALF-SECONDS + MOVEM B,TIMOFF ;STORE RE-CALCULATED NUMBER OF HALF-SECONDS SINCE MIDNIGHT + PUSHJ P,CLCQDT ;GET QDATE,,TIMOFF IN A + CONO PI,UTCOFF ;INHIBIT INTERRUPTS DURING THIS RITUAL + SKIPGE A,QMDRO ;GET ORIGIN OF MASTER DSK DIRECTORY + JRST UTCONJ ;DIRECTORY LOCKED + MOVE B,QACTB ;DIRECTORY CHANGED BIT FOR DSK DIRECTORY + SKIPE T,PDTIME ;GET OFFSET FOR DECORIOLIS CLOCK + CAMN T,MPDOFF(A) ;SEE IF IT MATCHES RELEVANT WORD IN DSKDIR + JRST .+3 ;MATCHES OR PDTIME NOT AVAILABLE + MOVEM T,MPDOFF(A) ;NO MATCH, CORRECT THE DSKDIR ONE + IORM B,QMDRO ;SET DIRECTORY CHANGED BIT + SKIPE T,FYEAR ;NOW DO THE SAME FOR THE YEAR, + CAMN T,MDYEAR(A) ;AND THE RELEVANT WORD IN DSKDIR + JRST .+3 + MOVEM T,MDYEAR(A) + IORM B,QMDRO + JRST UTCONJ ;THAT'S ALL + +CLCQDT: PUSHJ P,RDATE1 ;GET DAY OF MONTH IN C, MONTH IN B + SETZM QDATE ;INITIALIZE FOR FOLLOWING + PUSH P,E-1 + PUSH P,E + MOVE E-1,FYEAR + IDIVI E-1,100. + DPB E,[330700,,QDATE] ;YEAR + POP P,E + POP P,E-1 + DPB B,[270400,,QDATE] ;MONTH + DPB C,[220500,,QDATE] ;DAY + MOVE C,QDATE ;THE FIRST TIME QDATE IS SET UP, + HRR C,TIMOFF ;SET UP QDATEI = TIME SYSTEM CAME UP. + SKIPGE QDATEI + MOVEM C,QDATEI ;MECHANISM IS, SET QDATEI UNLESS ALREADY SET. + POPJ P, diff --git a/system/tm03s.defs2 b/system/tm03s.defs2 new file mode 100644 index 0000000..c7c3014 --- /dev/null +++ b/system/tm03s.defs2 @@ -0,0 +1,167 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + + +;;; RH11/TM03 Interrupt vector: +DEFSYM %TMVEC==224 ;(224/4 = 45) Interrupts occur on level 6 + ; (high priority) on UBA #1. +DEFSYM %TMBAS==772440 ;Unibus address of first register + +;;; RH11/TM03 Unibus register addresses: + +DEFSYM %TMCS1==%TMBAS ;CONTROL AND STATUS 1 + DEFSYM %TM1SC==1_15. ; Special Condition + DEFSYM %TM1TE==1_14. ; Transfer Error + DEFSYM %TM1MP==1_13. ; Massbus Control Bus Parity Error + DEFSYM %TM1DA==1_11. ; Drive Available + DEFSYM %TM1A7==1_9. ; UB Address Extension Bit 17 + DEFSYM %TM1A6==1_8. ; UB Address Extension Bit 16 + DEFSYM %TM1RY==1_7. ; Ready + DEFSYM %TM1IE==1_6. ; Interrupt Enable + DEFSYM $TM1CM==.BP 77 ; Bits 0-5 specify commands. + DEFSYM %TM1GO==1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %TMNOP==1 ;No Operation +DEFSYM %TMUNL==3 ;Unload +DEFSYM %TMREW==7 ;Rewind +DEFSYM %TMCLR==11 ;Formatter clear (reset errors etc.) +DEFSYM %TMER3==25 ;Erase three inch gap +DEFSYM %TMWTM==27 ;Write Tape Mark +DEFSYM %TMSPF==31 ;Space Forward +DEFSYM %TMSPR==33 ;Space Reverse +DEFSYM %TMWCF==51 ;Write Check FOrward +DEFSYM %TMWCR==57 ;Write Check Reverse +DEFSYM %TMWRT==61 ;Write Forward +DEFSYM %TMRDF==71 ;Read Forward +DEFSYM %TMRDR==77 ;Read Data Reverse + +DEFSYM %TMWC==%TMBAS+2 ;WORD COUNT. + +DEFSYM %TMBA==%TMBAS+4 ;UNIBUS ADDRESS. + +DEFSYM %TMFC==%TMBAS+6 ;TAPE FRAME COUNT + +DEFSYM %TMCS2==%TMBAS+10 ;CONTROL AND STATUS 2. + DEFSYM %TM2DL==1_15. ; Data Late + DEFSYM %TM2UP==1_13. ; Unibus Parity Error + DEFSYM %TM2NF==1_12. ; Non-existant Formatter + DEFSYM %TM2NM==1_11. ; %TMBA is NXM during DMA + DEFSYM %TM2PE==1_10. ; Program Error + DEFSYM %TM2MT==1_9. ; Missed Transfer + DEFSYM %TM2MP==1_8. ; Massbus Data Bus Parity Error + DEFSYM %TM2OR==1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %TM2IR==1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %TM2CC==1_5. ; Controller Clear + DEFSYM %TM2PT==1_4. ; Parity Test + DEFSYM %TM2AI==1_3. ; Unibus Address Increment Inhibit + +DEFSYM %TMFS==%TMBAS+12 ;FORMATTER STATUS + DEFSYM %TMSAA==1_15. ; Attention Active + DEFSYM %TMSES==1_14. ; Error Summary + DEFSYM %TMSPP==1_13. ; Positioning in Progress + DEFSYM %TMSOL==1_12. ; Medium On-Line + DEFSYM %TMSWL==1_11. ; Write Locked + DEFSYM %TMSET==1_10. ; End of Tape + DEFSYM %TMSFP==1_8. ; Formatter Present + DEFSYM %TMSFR==1_7. ; Formatter Ready + DEFSYM %TMSSC==1_6 ; Slave Status Change + DEFSYM %TMSPE==1_5. ; Phase Encoded (1600BPI) Mode + DEFSYM %TMSSD==1_4. ; Slowing Down + DEFSYM %TMSIB==1_3. ; PE Identification Burst Detected + DEFSYM %TMSTM==1_2. ; Tape Mark detected + DEFSYM %TMSBT==1_1. ; Beginning of Tape + DEFSYM %TMSSA==1_0. ; Slave Attention (on-line) + +DEFSYM %TMERR==%TMBAS+14 ;ERROR REGISTER + DEFSYM %TMECE==1_15. ; Correctable Data/CRC Error + DEFSYM %TMEUS==1_14. ; Unsafe + DEFSYM %TMEOI==1_13. ; Operation Incomplete + DEFSYM %TMECT==1_12. ; Controller Timing Error + DEFSYM %TMENX==1_11. ; Non Executable Function + DEFSYM %TMECS==1_10. ; Correctable Skew/Illegal Tape Mark Error + DEFSYM %TMEFC==1_9. ; Frame Count Error + DEFSYM %TMENG==1_8. ; Non-standard Gap + DEFSYM %TMEFL==1_7. ; PE Format/LRC Error + DEFSYM %TMEIC==1_6. ; Incorrectable Data/Hard Error + DEFSYM %TMEMD==1_5. ; Massbus Data Parity Error + DEFSYM %TMEFS==1_4. ; Format Select Error + DEFSYM %TMEMC==1_3. ; Massbus Control Parity Error + DEFSYM %TMERM==1_2. ; Register Modification Refused + DEFSYM %TMEIR==1_1. ; Illegal Register + DEFSYM %TMEIF==1_0. ; Illegal Function + DEFSYM %TMEHD==44077 ; Hard errors - US,NX,MD,FS,MC,RM,IR,IF + +DEFSYM %TMASN==%TMBAS+16 ;ATTENTION SUMMARY. + ;Each bit 7-0 corresponds to a formatter asserting ATA. + +DEFSYM %TMCCR==%TMBAS+20 ;CHECK CHARACTER REGISTER + DEFSYM %TMCDP==1_8. ; Dead Track Parity/CRC Parity + DEFSYM $TMCEI==.BP 177 ; Error Information + +DEFSYM %TMBUF==%TMBAS+22 ;DATA BUFFER REGISTER + +DEFSYM %TMMNT==%TMBAS+24 ;MAINTENANCE. + +DEFSYM %TMTYP==%TMBAS+26 ;DRIVE TYPE. + ;2.7 Not Sector addressed + ;2.6 Tape + ;2.5 Moving Head + ;2.3 Dual controller option available + ;1.9 - 1.1 Drive Type Number. + ; TU77=14, TU45=12, TE16=11 Nothing=10 + +DEFSYM %TMSER==%TMBAS+30 ;SERIAL NUMBER + +DEFSYM %TMTC==%TMBAS+32 ;TAPE CONTROL REGISTER + DEFSYM %TMTAC==1_15. ; Acceleration (not up to speed) + DEFSYM %TMTFC==1_14. ; Frame Count non-zero + DEFSYM %TMTSA==1_13. ; Slave Address (selected slave) Changed + DEFSYM %TMTEA==1_12. ; Enable Abort on data transfer error + DEFSYM %TMTDS==7_8. ; Density Select Field + DEFSYM $TMTDS==.BP %TMTDS + DEFSYM %TMD08==3 ; 800 BPI NRZI + DEFSYM %TMD16==4 ; 1600 BPI PE + DEFSYM %TMTFS==17_4. ; Format Select + DEFSYM $TMTFS==.BP %TMTFS + DEFSYM %TMFCD==0 ; PDP10 Core Dump + DEFSYM %TMFIC==3 ; Industry Compatible (32 bit mode) + DEFSYM %TMTEP==1_3. ; Even Parity + DEFSYM %TMTTS==7 ; Transport Select + DEFSYM $TMTTS==.BP %TMTTS + +IFN $$TEMP,EXPUNG DEFSYM + + diff --git a/system/tm03s.defs3 b/system/tm03s.defs3 new file mode 100644 index 0000000..8bf507f --- /dev/null +++ b/system/tm03s.defs3 @@ -0,0 +1,167 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + + +;;; RH11/TM03 Interrupt vector: +DEFSYM %TMVEC==224 ;(224/4 = 45) Interrupts occur on level 6 + ; (high priority) on UBA #1. +DEFSYM %TMBAS==772440 ;Unibus address of first register + +;;; RH11/TM03 Unibus register addresses: + +DEFSYM %TMCS1=:%TMBAS ;CONTROL AND STATUS 1 + DEFSYM %TM1SC==1_15. ; Special Condition + DEFSYM %TM1TE==1_14. ; Transfer Error + DEFSYM %TM1MP==1_13. ; Massbus Control Bus Parity Error + DEFSYM %TM1DA==1_11. ; Drive Available + DEFSYM %TM1A7==1_9. ; UB Address Extension Bit 17 + DEFSYM %TM1A6==1_8. ; UB Address Extension Bit 16 + DEFSYM %TM1RY==1_7. ; Ready + DEFSYM %TM1IE==1_6. ; Interrupt Enable + DEFSYM $TM1CM==.BP 77 ; Bits 0-5 specify commands. + DEFSYM %TM1GO==1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %TMNOP==1 ;No Operation +DEFSYM %TMUNL==3 ;Unload +DEFSYM %TMREW==7 ;Rewind +DEFSYM %TMCLR==11 ;Formatter clear (reset errors etc.) +DEFSYM %TMER3==25 ;Erase three inch gap +DEFSYM %TMWTM==27 ;Write Tape Mark +DEFSYM %TMSPF==31 ;Space Forward +DEFSYM %TMSPR==33 ;Space Reverse +DEFSYM %TMWCF==51 ;Write Check FOrward +DEFSYM %TMWCR==57 ;Write Check Reverse +DEFSYM %TMWRT==61 ;Write Forward +DEFSYM %TMRDF==71 ;Read Forward +DEFSYM %TMRDR==77 ;Read Data Reverse + +DEFSYM %TMWC=:%TMBAS+2 ;WORD COUNT. + +DEFSYM %TMBA=:%TMBAS+4 ;UNIBUS ADDRESS. + +DEFSYM %TMFC=:%TMBAS+6 ;TAPE FRAME COUNT + +DEFSYM %TMCS2=:%TMBAS+10 ;CONTROL AND STATUS 2. + DEFSYM %TM2DL==1_15. ; Data Late + DEFSYM %TM2UP==1_13. ; Unibus Parity Error + DEFSYM %TM2NF==1_12. ; Non-existant Formatter + DEFSYM %TM2NM==1_11. ; %TMBA is NXM during DMA + DEFSYM %TM2PE==1_10. ; Program Error + DEFSYM %TM2MT==1_9. ; Missed Transfer + DEFSYM %TM2MP==1_8. ; Massbus Data Bus Parity Error + DEFSYM %TM2OR==1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %TM2IR==1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %TM2CC==1_5. ; Controller Clear + DEFSYM %TM2PT==1_4. ; Parity Test + DEFSYM %TM2AI==1_3. ; Unibus Address Increment Inhibit + +DEFSYM %TMFS=:%TMBAS+12 ;FORMATTER STATUS + DEFSYM %TMSAA==1_15. ; Attention Active + DEFSYM %TMSES==1_14. ; Error Summary + DEFSYM %TMSPP==1_13. ; Positioning in Progress + DEFSYM %TMSOL==1_12. ; Medium On-Line + DEFSYM %TMSWL==1_11. ; Write Locked + DEFSYM %TMSET==1_10. ; End of Tape + DEFSYM %TMSFP==1_8. ; Formatter Present + DEFSYM %TMSFR==1_7. ; Formatter Ready + DEFSYM %TMSSC==1_6 ; Slave Status Change + DEFSYM %TMSPE==1_5. ; Phase Encoded (1600BPI) Mode + DEFSYM %TMSSD==1_4. ; Slowing Down + DEFSYM %TMSIB==1_3. ; PE Identification Burst Detected + DEFSYM %TMSTM==1_2. ; Tape Mark detected + DEFSYM %TMSBT==1_1. ; Beginning of Tape + DEFSYM %TMSSA==1_0. ; Slave Attention (on-line) + +DEFSYM %TMERR=:%TMBAS+14 ;ERROR REGISTER + DEFSYM %TMECE==1_15. ; Correctable Data/CRC Error + DEFSYM %TMEUS==1_14. ; Unsafe + DEFSYM %TMEOI==1_13. ; Operation Incomplete + DEFSYM %TMECT==1_12. ; Controller Timing Error + DEFSYM %TMENX==1_11. ; Non Executable Function + DEFSYM %TMECS==1_10. ; Correctable Skew/Illegal Tape Mark Error + DEFSYM %TMEFC==1_9. ; Frame Count Error + DEFSYM %TMENG==1_8. ; Non-standard Gap + DEFSYM %TMEFL==1_7. ; PE Format/LRC Error + DEFSYM %TMEIC==1_6. ; Incorrectable Data/Hard Error + DEFSYM %TMEMD==1_5. ; Massbus Data Parity Error + DEFSYM %TMEFS==1_4. ; Format Select Error + DEFSYM %TMEMC==1_3. ; Massbus Control Parity Error + DEFSYM %TMERM==1_2. ; Register Modification Refused + DEFSYM %TMEIR==1_1. ; Illegal Register + DEFSYM %TMEIF==1_0. ; Illegal Function + DEFSYM %TMEHD==44077 ; Hard errors - US,NX,MD,FS,MC,RM,IR,IF + +DEFSYM %TMASN=:%TMBAS+16 ;ATTENTION SUMMARY. + ;Each bit 7-0 corresponds to a formatter asserting ATA. + +DEFSYM %TMCCR=:%TMBAS+20 ;CHECK CHARACTER REGISTER + DEFSYM %TMCDP==1_8. ; Dead Track Parity/CRC Parity + DEFSYM $TMCEI==.BP 177 ; Error Information + +DEFSYM %TMBUF=:%TMBAS+22 ;DATA BUFFER REGISTER + +DEFSYM %TMMNT=:%TMBAS+24 ;MAINTENANCE. + +DEFSYM %TMTYP=:%TMBAS+26 ;DRIVE TYPE. + ;2.7 Not Sector addressed + ;2.6 Tape + ;2.5 Moving Head + ;2.3 Dual controller option available + ;1.9 - 1.1 Drive Type Number. + ; TU77=14, TU45=12, TE16=11 Nothing=10 + +DEFSYM %TMSER=:%TMBAS+30 ;SERIAL NUMBER + +DEFSYM %TMTC=:%TMBAS+32 ;TAPE CONTROL REGISTER + DEFSYM %TMTAC==1_15. ; Acceleration (not up to speed) + DEFSYM %TMTFC==1_14. ; Frame Count non-zero + DEFSYM %TMTSA==1_13. ; Slave Address (selected slave) Changed + DEFSYM %TMTEA==1_12. ; Enable Abort on data transfer error + DEFSYM %TMTDS==7_8. ; Density Select Field + DEFSYM $TMTDS==.BP %TMTDS + DEFSYM %TMD08==3 ; 800 BPI NRZI + DEFSYM %TMD16==4 ; 1600 BPI PE + DEFSYM %TMTFS==17_4. ; Format Select + DEFSYM $TMTFS==.BP %TMTFS + DEFSYM %TMFCD==0 ; PDP10 Core Dump + DEFSYM %TMFIC==3 ; Industry Compatible (32 bit mode) + DEFSYM %TMTEP==1_3. ; Even Parity + DEFSYM %TMTTS==7 ; Transport Select + DEFSYM $TMTTS==.BP %TMTTS + +IFN $$TEMP,EXPUNG DEFSYM + + diff --git a/system/tm03s.defs4 b/system/tm03s.defs4 new file mode 100644 index 0000000..386b6ed --- /dev/null +++ b/system/tm03s.defs4 @@ -0,0 +1,167 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + + +;;; RH11/TM03 Interrupt vector: +DEFSYM %TMVEC==224 ;(224/4 = 45) Interrupts occur on level 6 + ; (high priority) on UBA #1. +DEFSYM %TMBAS==772400 ;Unibus address of first register + +;;; RH11/TM03 Unibus register addresses: + +DEFSYM %TMCS1=:%TMBAS ;CONTROL AND STATUS 1 + DEFSYM %TM1SC==1_15. ; Special Condition + DEFSYM %TM1TE==1_14. ; Transfer Error + DEFSYM %TM1MP==1_13. ; Massbus Control Bus Parity Error + DEFSYM %TM1DA==1_11. ; Drive Available + DEFSYM %TM1A7==1_9. ; UB Address Extension Bit 17 + DEFSYM %TM1A6==1_8. ; UB Address Extension Bit 16 + DEFSYM %TM1RY==1_7. ; Ready + DEFSYM %TM1IE==1_6. ; Interrupt Enable + DEFSYM $TM1CM==.BP 77 ; Bits 0-5 specify commands. + DEFSYM %TM1GO==1_0. ; GO bit + +;;; Commands with bit 0 (GO) included: + +DEFSYM %TMNOP==1 ;No Operation +DEFSYM %TMUNL==3 ;Unload +DEFSYM %TMREW==7 ;Rewind +DEFSYM %TMCLR==11 ;Formatter clear (reset errors etc.) +DEFSYM %TMER3==25 ;Erase three inch gap +DEFSYM %TMWTM==27 ;Write Tape Mark +DEFSYM %TMSPF==31 ;Space Forward +DEFSYM %TMSPR==33 ;Space Reverse +DEFSYM %TMWCF==51 ;Write Check FOrward +DEFSYM %TMWCR==57 ;Write Check Reverse +DEFSYM %TMWRT==61 ;Write Forward +DEFSYM %TMRDF==71 ;Read Forward +DEFSYM %TMRDR==77 ;Read Data Reverse + +DEFSYM %TMWC=:%TMBAS+2 ;WORD COUNT. + +DEFSYM %TMBA=:%TMBAS+4 ;UNIBUS ADDRESS. + +DEFSYM %TMFC=:%TMBAS+6 ;TAPE FRAME COUNT + +DEFSYM %TMCS2=:%TMBAS+10 ;CONTROL AND STATUS 2. + DEFSYM %TM2DL==1_15. ; Data Late + DEFSYM %TM2UP==1_13. ; Unibus Parity Error + DEFSYM %TM2NF==1_12. ; Non-existant Formatter + DEFSYM %TM2NM==1_11. ; %TMBA is NXM during DMA + DEFSYM %TM2PE==1_10. ; Program Error + DEFSYM %TM2MT==1_9. ; Missed Transfer + DEFSYM %TM2MP==1_8. ; Massbus Data Bus Parity Error + DEFSYM %TM2OR==1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %TM2IR==1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %TM2CC==1_5. ; Controller Clear + DEFSYM %TM2PT==1_4. ; Parity Test + DEFSYM %TM2AI==1_3. ; Unibus Address Increment Inhibit + +DEFSYM %TMFS=:%TMBAS+12 ;FORMATTER STATUS + DEFSYM %TMSAA==1_15. ; Attention Active + DEFSYM %TMSES==1_14. ; Error Summary + DEFSYM %TMSPP==1_13. ; Positioning in Progress + DEFSYM %TMSOL==1_12. ; Medium On-Line + DEFSYM %TMSWL==1_11. ; Write Locked + DEFSYM %TMSET==1_10. ; End of Tape + DEFSYM %TMSFP==1_8. ; Formatter Present + DEFSYM %TMSFR==1_7. ; Formatter Ready + DEFSYM %TMSSC==1_6 ; Slave Status Change + DEFSYM %TMSPE==1_5. ; Phase Encoded (1600BPI) Mode + DEFSYM %TMSSD==1_4. ; Slowing Down + DEFSYM %TMSIB==1_3. ; PE Identification Burst Detected + DEFSYM %TMSTM==1_2. ; Tape Mark detected + DEFSYM %TMSBT==1_1. ; Beginning of Tape + DEFSYM %TMSSA==1_0. ; Slave Attention (on-line) + +DEFSYM %TMERR=:%TMBAS+14 ;ERROR REGISTER + DEFSYM %TMECE==1_15. ; Correctable Data/CRC Error + DEFSYM %TMEUS==1_14. ; Unsafe + DEFSYM %TMEOI==1_13. ; Operation Incomplete + DEFSYM %TMECT==1_12. ; Controller Timing Error + DEFSYM %TMENX==1_11. ; Non Executable Function + DEFSYM %TMECS==1_10. ; Correctable Skew/Illegal Tape Mark Error + DEFSYM %TMEFC==1_9. ; Frame Count Error + DEFSYM %TMENG==1_8. ; Non-standard Gap + DEFSYM %TMEFL==1_7. ; PE Format/LRC Error + DEFSYM %TMEIC==1_6. ; Incorrectable Data/Hard Error + DEFSYM %TMEMD==1_5. ; Massbus Data Parity Error + DEFSYM %TMEFS==1_4. ; Format Select Error + DEFSYM %TMEMC==1_3. ; Massbus Control Parity Error + DEFSYM %TMERM==1_2. ; Register Modification Refused + DEFSYM %TMEIR==1_1. ; Illegal Register + DEFSYM %TMEIF==1_0. ; Illegal Function + DEFSYM %TMEHD==44077 ; Hard errors - US,NX,MD,FS,MC,RM,IR,IF + +DEFSYM %TMASN=:%TMBAS+16 ;ATTENTION SUMMARY. + ;Each bit 7-0 corresponds to a formatter asserting ATA. + +DEFSYM %TMCCR=:%TMBAS+20 ;CHECK CHARACTER REGISTER + DEFSYM %TMCDP==1_8. ; Dead Track Parity/CRC Parity + DEFSYM $TMCEI==.BP 177 ; Error Information + +DEFSYM %TMBUF=:%TMBAS+22 ;DATA BUFFER REGISTER + +DEFSYM %TMMNT=:%TMBAS+24 ;MAINTENANCE. + +DEFSYM %TMTYP=:%TMBAS+26 ;DRIVE TYPE. + ;2.7 Not Sector addressed + ;2.6 Tape + ;2.5 Moving Head + ;2.3 Dual controller option available + ;1.9 - 1.1 Drive Type Number. + ; TU77=14, TU45=12, TE16=11 Nothing=10 + +DEFSYM %TMSER=:%TMBAS+30 ;SERIAL NUMBER + +DEFSYM %TMTC=:%TMBAS+32 ;TAPE CONTROL REGISTER + DEFSYM %TMTAC==1_15. ; Acceleration (not up to speed) + DEFSYM %TMTFC==1_14. ; Frame Count non-zero + DEFSYM %TMTSA==1_13. ; Slave Address (selected slave) Changed + DEFSYM %TMTEA==1_12. ; Enable Abort on data transfer error + DEFSYM %TMTDS==7_8. ; Density Select Field + DEFSYM $TMTDS==.BP %TMTDS + DEFSYM %TMD08==3 ; 800 BPI NRZI + DEFSYM %TMD16==4 ; 1600 BPI PE + DEFSYM %TMTFS==17_4. ; Format Select + DEFSYM $TMTFS==.BP %TMTFS + DEFSYM %TMFCD==0 ; PDP10 Core Dump + DEFSYM %TMFIC==3 ; Industry Compatible (32 bit mode) + DEFSYM %TMTEP==1_3. ; Even Parity + DEFSYM %TMTTS==7 ; Transport Select + DEFSYM $TMTTS==.BP %TMTTS + +IFN $$TEMP,EXPUNG DEFSYM + + diff --git a/system/tm78s.defs1 b/system/tm78s.defs1 new file mode 100644 index 0000000..4eb5248 --- /dev/null +++ b/system/tm78s.defs1 @@ -0,0 +1,194 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + + +;;; RH11/TM78 Interrupt vector: +DEFSYM %ARVEC==224 ;(224/4 = 45) Interrupts occur on level 6 + ; (high priority) on UBA #1. +DEFSYM %ARBAS==772440 ;Unibus address of first register + +;;; RH11/TM78 Unibus register addresses: + +DEFSYM %ARCS1==%ARBAS ;CONTROL AND STATUS 1 (RH11 and MB Reg 00) + DEFSYM %A1SC==1_15. ; Special Condition + DEFSYM %A1TE==1_14. ; Transfer Error + DEFSYM %A1MCP==1_13. ; Massbus Control Bus Parity Error + DEFSYM %A1DA==1_11. ; Drive (TM78) Available + DEFSYM %A1A7==1_9. ; UB Address Extension Bit 17 + DEFSYM %A1A6==1_8. ; UB Address Extension Bit 16 + DEFSYM %A1RDY==1_7. ; Ready + DEFSYM %A1IE==1_6. ; Interrupt Enable + DEFSYM %A1CMD==77 ; Bits 0-5 specify commands. + DEFSYM %A1GO==1_0. ; GO bit + +;;; Commands, with GO bit or'd in. +;;; --NOTE-- +;;; Commands are passed to the controller in two ways. Data transfer +;;; command get written into the CS1 register, as usual. Non-data-transfer +;;; commands are written to the %ARNDC register for the desired drive +;;; unit (see below). Non-data-transfer commands are marked with a '*'. + +DEFSYM %ACNOP==3 ;(*) No Operation +DEFSYM %ACUNL==5 ;(*) Unload +DEFSYM %ACREW==7 ;(*) Rewind +DEFSYM %ACSNS==11 ;(*) Sense (Get status from TM) +DEFSYM %ACDSE==13 ;(*) Data Security Erase! (Erase rest of tape) +DEFSYM %ACWPM==15 ;(*) Write Phase Encoded (1600bpi) Tape Mark +DEFSYM %ACWGM==17 ;(*) Write GCR (6250bpi Tape Mark +DEFSYM %ACSFR==21 ;(*) Space Forward Record +DEFSYM %ACSRR==23 ;(*) Space Reverse Record +DEFSYM %ACSFF==25 ;(*) Space Forward File +DEFSYM %ACSRF==27 ;(*) Space Reverse File +DEFSYM %ACSFE==31 ;(*) Space Forward Either (record or file) +DEFSYM %ACSRE==33 ;(*) Space Reverse Either +DEFSYM %ACE3P==35 ;(*) Erase Three-inch gap, set PE +DEFSYM %ACE3G==37 ;(*) Erase Three-inch gap, set GCR +DEFSYM %ACCFP==41 ;(*) Close File PE (write two marks, back one) +DEFSYM %ACCFG==43 ;(*) Close File GCR +DEFSYM %ACEOT==45 ;(*) Space to Logical EOT +DEFSYM %ACSFU==47 ;(*) Space forward usefully (to file or EOT) +DEFSYM %ACWCF==51 ;Write Check Forward +DEFSYM %ACWCR==57 ;Write Check Reverse +DEFSYM %ACWRP==61 ;Write Forward PE +DEFSYM %ACWRG==63 ;Write Forward GCR +DEFSYM %ACRDF==71 ;Read Forward +DEFSYM %ACRES==73 ;Read Extended Sense Information +DEFSYM %ACRDR==77 ;Read Data Reverse + + +DEFSYM %ARWC==%ARBAS+2 ;UNIBUS DMA WORD COUNT. (RH11) + ; Negative count of the number of PDP11 (18-bit) words to DMA + +DEFSYM %ARBA==%ARBAS+4 ;UNIBUS ADDRESS. (RH11) + ; Unibus address of start of DMA transfer + +DEFSYM %ARFC==%ARBAS+6 ;TAPE FRAME BYTE COUNT (MB Reg 05) + +DEFSYM %ARCS2==%ARBAS+10 ;CONTROL AND STATUS 2. (RH11) + DEFSYM %A2DL==1_15. ; Data Late + DEFSYM %A2UPE==1_13. ; Unibus Parity Error + DEFSYM %A2NF==1_12. ; Non-existant Formatter (TM78) + DEFSYM %A2NM==1_11. ; Unibus mem NXM during DMA + DEFSYM %A2PE==1_10. ; Program Error + DEFSYM %A2MT==1_9. ; Missed Transfer + DEFSYM %A2MDP==1_8. ; Massbus Data Bus Parity Error + DEFSYM %A2OR==1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %A2IR==1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %A2CC==1_5. ; Controller Clear + DEFSYM %A2PT==1_4. ; Parity Test + DEFSYM %A2UAI==1_3. ; Unibus Address Increment Inhibit + +DEFSYM %ARDER==%ARBAS+12 ;DATA TRANSFER ERROR REPORT (MB Reg 01) + DEFSYM %ADEIC==77 ; Interrupt Code + DEFSYM %ADEDP==1_8. ; DPR ??? + DEFSYM %ADEFC==77_10. ; Failure Code + +DEFSYM %ARDCA==%ARBAS+14 ;DATA COMMAND ARGUMENTS (MB Reg 02) + DEFSYM %ADACA==3 ; Command Address (TU78 unit number) + DEFSYM %ADARC==77_2. ; Record Count + DEFSYM %ADASC==17_8. ; Skip Count + DEFSYM %ADAFT==7_12. ; Format + DEFSYM %ADASR==1_15. ; Supress Repositioning on error + +DEFSYM %ARASN==%ARBAS+16 ;ATTENTION SUMMARY. (MB Reg 04) + ;Each bit 3-0 corresponds to a drive wanting attention + ; You must explicitly -RESET- an attention bit by writing a + ; one into it before the controller can interrupt you again. + +DEFSYM %ARDS==%ARBAS+20 ;DRIVE STATUS (MB Reg 07) + ;;; This register is valid only after a SENSE command + ;;; (or possibly an unsolicited ONLINE interrupt) + DEFSYM %ASRDY==1_15. ; Tape Ready + DEFSYM %ASPRE==1_14. ; Present (TM78 powered up) + DEFSYM %ASONL==1_13. ; Online + DEFSYM %ASREW==1_12. ; Tape Rewinding + DEFSYM %ASPE==1_11. ; Tape is Phase Encoded + DEFSYM %ASBOT==1_10. ; Tape at BOT + DEFSYM %ASEOT==1_9. ; Tape at EOT + DEFSYM %ASWPT==1_8. ; Tape is Write Protected + DEFSYM %ASUA==1_7. ; Unit Available + DEFSYM %ASUS==1_6. ; Unit is shared + DEFSYM %ASMMD==1_5. ; Unit is in Maintainance mode + DEFSYM %ASDSE==1_4. ; Data Security Erase in progress. + +DEFSYM %ARBUF==%ARBAS+22 ;DATA BUFFER REGISTER (RH11) + +DEFSYM %ARMR1==%ARBAS+24 ;MAINTENANCE REGISTER 1 (MB Reg 03) + +DEFSYM %ARTYP==%ARBAS+26 ;DRIVE TYPE. (MB Reg 06) + ;;; This register is valid only after a SENSE command + ;2.7 Not Sector addressed + ;2.6 Tape + ;2.5 Moving Head (always 0) + ;2.4 7 track (always 0) + ;2.3 Dual port (must do arbitration) + ;2.2 Slave present (always 1) + ;2.1 Writable Control Store (always 0) + ;1.9 - 1.1 Drive Type Number. + ; TU78=101 + +DEFSYM %ARSER==%ARBAS+30 ;SERIAL NUMBER (MB Reg 010) + ;;; This register is valid only after a SENSE command + ;0-3 SN digit 0, in BCD + ;4-7 SN digit 1 + ;8-11 SN digit 2 + ;12-15 SN digit 3 + +DEFSYM %ARMR2==%ARBAS+32 ;MAINTAINANCE REGISTER 2 (MB Reg 011) + +DEFSYM %ARMR3==%ARBAS+34 ;MAINTAINANCE REGISTER 3 (MB Reg 012) + +DEFSYM %ARNDE==%ARBAS+36 ;NON-DATA CMD ERROR REGISTER (MB Reg 013) + DEFSYM %ANEIC==77 ; NDT Interrupt code + DEFSYM %ANEAA==3_8. ; Attention Address (drive that caused this) + DEFSYM %ANEFC==77_10. ; NDT Failure Code + +DEFSYM %ARNDA==%ARBAS+40 ;NON-DATA CMD ARG REGISTERS (MB Reg 014 - 017) + ;;; There are four of these, one for each of the possible slave TU78 + ;;; units on the TM78. This is where you write commands that don't + ;;; move data over the massbus. + DEFSYM %ANCMD==77 ; Command to execute + DEFSYM %ANCNT==377_8. ; Count + +DEFSYM %ARIA==%ARBAS+50 ;INTERNAL ADDRESS (MB Reg 020) + +DEFSYM %ARID==%ARBAS+52 ;HARDWARE CONTROL (MB Reg 021) + DEFSYM %AHRDY==1_15. ; Set when controller is ready. (read only) + DEFSYM %AHCLR==1_14. ; Write 1 here to reset controller. + ;;; And a bunch of other stuff + + +IFN $$TEMP,EXPUNG DEFSYM + + diff --git a/system/tm78s.defs2 b/system/tm78s.defs2 new file mode 100644 index 0000000..4f864e3 --- /dev/null +++ b/system/tm78s.defs2 @@ -0,0 +1,194 @@ +;;; -*- Mode: Midas -*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +.AUXIL + +;;; Canonical symbol definition macro, FOO==BAR with error check. +IFNDEF DEFSYM,[ +DEFINE DEFSYM X/ +IRPS Z,,[X] +IFNDEF Z,X +.ELSE [ $$TEM1==Z + X + IFN Z-$$TEM1,.ERR Z MULTIPLY .QUOTE`.QUOTE/DEFINED/` + ] +.ISTOP +TERMIN TERMIN +$$TEMP==1 +] ;IFNDEF DEFSYM +.ELSE, $$TEMP==0 + + +;;; RH11/TM78 Interrupt vector: +DEFSYM %ARVEC==224 ;(224/4 = 45) Interrupts occur on level 6 + ; (high priority) on UBA #1. +DEFSYM %ARBAS==772400 ;Unibus address of first register + +;;; RH11/TM78 Unibus register addresses: + +DEFSYM %ARCS1==%ARBAS ;CONTROL AND STATUS 1 (RH11 and MB Reg 00) + DEFSYM %A1SC==1_15. ; Special Condition + DEFSYM %A1TE==1_14. ; Transfer Error + DEFSYM %A1MCP==1_13. ; Massbus Control Bus Parity Error + DEFSYM %A1DA==1_11. ; Drive (TM78) Available + DEFSYM %A1A7==1_9. ; UB Address Extension Bit 17 + DEFSYM %A1A6==1_8. ; UB Address Extension Bit 16 + DEFSYM %A1RDY==1_7. ; Ready + DEFSYM %A1IE==1_6. ; Interrupt Enable + DEFSYM %A1CMD==77 ; Bits 0-5 specify commands. + DEFSYM %A1GO==1_0. ; GO bit + +;;; Commands, with GO bit or'd in. +;;; --NOTE-- +;;; Commands are passed to the controller in two ways. Data transfer +;;; command get written into the CS1 register, as usual. Non-data-transfer +;;; commands are written to the %ARNDC register for the desired drive +;;; unit (see below). Non-data-transfer commands are marked with a '*'. + +DEFSYM %ACNOP==3 ;(*) No Operation +DEFSYM %ACUNL==5 ;(*) Unload +DEFSYM %ACREW==7 ;(*) Rewind +DEFSYM %ACSNS==11 ;(*) Sense (Get status from TM) +DEFSYM %ACDSE==13 ;(*) Data Security Erase! (Erase rest of tape) +DEFSYM %ACWPM==15 ;(*) Write Phase Encoded (1600bpi) Tape Mark +DEFSYM %ACWGM==17 ;(*) Write GCR (6250bpi Tape Mark +DEFSYM %ACSFR==21 ;(*) Space Forward Record +DEFSYM %ACSRR==23 ;(*) Space Reverse Record +DEFSYM %ACSFF==25 ;(*) Space Forward File +DEFSYM %ACSRF==27 ;(*) Space Reverse File +DEFSYM %ACSFE==31 ;(*) Space Forward Either (record or file) +DEFSYM %ACSRE==33 ;(*) Space Reverse Either +DEFSYM %ACE3P==35 ;(*) Erase Three-inch gap, set PE +DEFSYM %ACE3G==37 ;(*) Erase Three-inch gap, set GCR +DEFSYM %ACCFP==41 ;(*) Close File PE (write two marks, back one) +DEFSYM %ACCFG==43 ;(*) Close File GCR +DEFSYM %ACEOT==45 ;(*) Space to Logical EOT +DEFSYM %ACSFU==47 ;(*) Space forward usefully (to file or EOT) +DEFSYM %ACWCF==51 ;Write Check Forward +DEFSYM %ACWCR==57 ;Write Check Reverse +DEFSYM %ACWRP==61 ;Write Forward PE +DEFSYM %ACWRG==63 ;Write Forward GCR +DEFSYM %ACRDF==71 ;Read Forward +DEFSYM %ACRES==73 ;Read Extended Sense Information +DEFSYM %ACRDR==77 ;Read Data Reverse + + +DEFSYM %ARWC==%ARBAS+2 ;UNIBUS DMA WORD COUNT. (RH11) + ; Negative count of the number of PDP11 (18-bit) words to DMA + +DEFSYM %ARBA==%ARBAS+4 ;UNIBUS ADDRESS. (RH11) + ; Unibus address of start of DMA transfer + +DEFSYM %ARFC==%ARBAS+6 ;TAPE FRAME BYTE COUNT (MB Reg 05) + +DEFSYM %ARCS2==%ARBAS+10 ;CONTROL AND STATUS 2. (RH11) + DEFSYM %A2DL==1_15. ; Data Late + DEFSYM %A2UPE==1_13. ; Unibus Parity Error + DEFSYM %A2NF==1_12. ; Non-existant Formatter (TM78) + DEFSYM %A2NM==1_11. ; Unibus mem NXM during DMA + DEFSYM %A2PE==1_10. ; Program Error + DEFSYM %A2MT==1_9. ; Missed Transfer + DEFSYM %A2MDP==1_8. ; Massbus Data Bus Parity Error + DEFSYM %A2OR==1_7. ; Output Ready (for Silo buffer diag.) + DEFSYM %A2IR==1_6. ; Input Ready (for Silo buffer diag.) + DEFSYM %A2CC==1_5. ; Controller Clear + DEFSYM %A2PT==1_4. ; Parity Test + DEFSYM %A2UAI==1_3. ; Unibus Address Increment Inhibit + +DEFSYM %ARDER==%ARBAS+12 ;DATA TRANSFER ERROR REPORT (MB Reg 01) + DEFSYM %ADEIC==77 ; Interrupt Code + DEFSYM %ADEDP==1_8. ; DPR ??? + DEFSYM %ADEFC==77_10. ; Failure Code + +DEFSYM %ARDCA==%ARBAS+14 ;DATA COMMAND ARGUMENTS (MB Reg 02) + DEFSYM %ADACA==3 ; Command Address (TU78 unit number) + DEFSYM %ADARC==77_2. ; Record Count + DEFSYM %ADASC==17_8. ; Skip Count + DEFSYM %ADAFT==7_12. ; Format + DEFSYM %ADASR==1_15. ; Supress Repositioning on error + +DEFSYM %ARASN==%ARBAS+16 ;ATTENTION SUMMARY. (MB Reg 04) + ;Each bit 3-0 corresponds to a drive wanting attention + ; You must explicitly -RESET- an attention bit by writing a + ; one into it before the controller can interrupt you again. + +DEFSYM %ARDS==%ARBAS+20 ;DRIVE STATUS (MB Reg 07) + ;;; This register is valid only after a SENSE command + ;;; (or possibly an unsolicited ONLINE interrupt) + DEFSYM %ASRDY==1_15. ; Tape Ready + DEFSYM %ASPRE==1_14. ; Present (TM78 powered up) + DEFSYM %ASONL==1_13. ; Online + DEFSYM %ASREW==1_12. ; Tape Rewinding + DEFSYM %ASPE==1_11. ; Tape is Phase Encoded + DEFSYM %ASBOT==1_10. ; Tape at BOT + DEFSYM %ASEOT==1_9. ; Tape at EOT + DEFSYM %ASWPT==1_8. ; Tape is Write Protected + DEFSYM %ASUA==1_7. ; Unit Available + DEFSYM %ASUS==1_6. ; Unit is shared + DEFSYM %ASMMD==1_5. ; Unit is in Maintainance mode + DEFSYM %ASDSE==1_4. ; Data Security Erase in progress. + +DEFSYM %ARBUF==%ARBAS+22 ;DATA BUFFER REGISTER (RH11) + +DEFSYM %ARMR1==%ARBAS+24 ;MAINTENANCE REGISTER 1 (MB Reg 03) + +DEFSYM %ARTYP==%ARBAS+26 ;DRIVE TYPE. (MB Reg 06) + ;;; This register is valid only after a SENSE command + ;2.7 Not Sector addressed + ;2.6 Tape + ;2.5 Moving Head (always 0) + ;2.4 7 track (always 0) + ;2.3 Dual port (must do arbitration) + ;2.2 Slave present (always 1) + ;2.1 Writable Control Store (always 0) + ;1.9 - 1.1 Drive Type Number. + ; TU78=101 + +DEFSYM %ARSER==%ARBAS+30 ;SERIAL NUMBER (MB Reg 010) + ;;; This register is valid only after a SENSE command + ;0-3 SN digit 0, in BCD + ;4-7 SN digit 1 + ;8-11 SN digit 2 + ;12-15 SN digit 3 + +DEFSYM %ARMR2==%ARBAS+32 ;MAINTAINANCE REGISTER 2 (MB Reg 011) + +DEFSYM %ARMR3==%ARBAS+34 ;MAINTAINANCE REGISTER 3 (MB Reg 012) + +DEFSYM %ARNDE==%ARBAS+36 ;NON-DATA CMD ERROR REGISTER (MB Reg 013) + DEFSYM %ANEIC==77 ; NDT Interrupt code + DEFSYM %ANEAA==3_8. ; Attention Address (drive that caused this) + DEFSYM %ANEFC==77_10. ; NDT Failure Code + +DEFSYM %ARNDA==%ARBAS+40 ;NON-DATA CMD ARG REGISTERS (MB Reg 014 - 017) + ;;; There are four of these, one for each of the possible slave TU78 + ;;; units on the TM78. This is where you write commands that don't + ;;; move data over the massbus. + DEFSYM %ANCMD==77 ; Command to execute + DEFSYM %ANCNT==377_8. ; Count + +DEFSYM %ARIA==%ARBAS+50 ;INTERNAL ADDRESS (MB Reg 020) + +DEFSYM %ARID==%ARBAS+52 ;HARDWARE CONTROL (MB Reg 021) + DEFSYM %AHRDY==1_15. ; Set when controller is ready. (read only) + DEFSYM %AHCLR==1_14. ; Write 1 here to reset controller. + ;;; And a bunch of other stuff + + +IFN $$TEMP,EXPUNG DEFSYM + + diff --git a/system/ts3tty.400 b/system/ts3tty.400 new file mode 100644 index 0000000..80ac5fd --- /dev/null +++ b/system/ts3tty.400 @@ -0,0 +1,8230 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +TTYVRS==.IFNM2 + +OVHMTR TTY ;MISC TTY CODE + +SUBTTL SPY DEVICE + +;FIRST FILE NAME MUST BE TTY NUMBER (NOT CHARACTERS) + +SPYO: JUMPN D,OPNL12 ;ONLY UNIT ASCII INPUT ALLOWED + JUMPL A,OPNL11 + CAIL A,NCT + JRST OPNL11 + MOVE E,TIIP(A) + MOVEM E,IOCHST-IOCHNM(R) + MOVEI C,ISPY + HRL C,A + MOVEM C,(R) + JRST POPJ1 + +;A HAS LH OF IOCHNM =TTY # + +SPYI: MOVE T,IOCHST-IOCHNM(R) ;POINTER TO INPUT BUFFER + HRRZ B,TIBEP(A) + CAIL B,(T) + CAILE B,TIBL(T) + JRST SPYIL +SPYILL: CAMN T,TIIP(A) + PUSHJ P,UFLS + CAMN T,TIBEP(A) + SUBI T,TIBL + HRRM T,IOCHST-IOCHNM(R) + ILDB W,IOCHST-IOCHNM(R) + POPJ P, + +SPYIL: MOVE T,TIIP(A) + MOVEM T,IOCHST-IOCHNM(R) + JRST SPYILL + +;.CALL RFNAME on a SPY channel. A contains LH(IOCHNM) = TTY # +SPYRCH: MOVEI B,(A) ;FN1 is TTY # + POPJ P, ;easy! + +SUBTTL STY DEVICE + +;STY OPEN + +;MODE BITS (LH) +;3.1=0 => INPUT =1 => OUTPUT (FROM PROGRAM POINT OF VIEW) +;3.2=0 => UNIT =1 => BLOCK +;INPUT +;3.3=0 => FULL DUPLEX =1 => HALF DUPLEX +;3.4=1 => DON'T HANG ON INPUT IOTS, INPUT -1 INSTEAD (IGNORED ON OUTPUT OPEN) +;3.5=1 => WANT TO GET %TDORS ON OUTPUT RESET. + ;BIT 3.5 NOTICED ON OUTPUT, TOO, BUT THAT'S NO FEATURE? + +STTYO: HRRZ I,USTYN(U) + JUMPN I,STTYO3 ;JUMP IF STY ALREADY OPEN + PUSHJ P,SWTL ;LOCK STY OPEN SWITCH + STYOSW + MOVE I,[-NSTTYS,,NFSTTY] + MOVSI TT,%SSUSE +STTYO1: TDNE TT,STYSTS-NFSTTY(I) ;SKIP ON FREE SLOT +STTYO5: AOBJN I,STTYO1 + JUMPGE I,OPNL6 ;NO SLOTS. GIVE DEVICE FULL + SKIPGE TTYSTA(I) ;SKIP IF CONSOLE FREE MSG NOT TYPED. + SKIPE TTNTO(I) ;SKIP IF NOT OPEN. + JRST STTYO5 + MOVEI I,(I) ;We want to compare left half + CAMLE I,STYMAX ;If we're limiting STY's, is this over our + JRST OPNL6 ; limit? If so, give DEVICE FULL + HRRM I,USTYN(U) ;STORE TTY NUMBER OF STY +STTYO4: ANDI I,-1 + SETZM STYNTO-NFSTTY(I) + SETZM STYMSK-NFSTTY(I) + MOVSI TT,%SSUSE + MOVEM TT,STYSTS-NFSTTY(I) ;SET IN USE BIT + MOVSI TT,(<.BM ($TTISP)>+<.BM ($TTOSP)>) + ANDCAM TT,TTYTYP(I) ;RESET SPEEDS TO ZERO + PUSH P,C + PUSHJ P,NCNSSP ;MAKE THE TTY A PRINTING TTY. + PUSHJ P,TTYIN1 ;INIT THE TTYOPT AND TTYCOM USER OPTION BITS. + PUSHJ P,STYIR1 ;FLUSH TTY'S OUTPUT BUFFER. + PUSHJ P,STYOR1 ;AND ITS INPUT BUFFER. + PUSHJ P,LSWPOP ;UNLOCK STY OPEN SWITCH + POP P,C + HRRM U,STYSTS-NFSTTY(I) + MOVE T,UTMPTR(U) ;Check out this tree + CAIE T,SYSRCE-1 ;Is this a top-level non-console tree, + CAIN T,SYSRCE ;or a system demon? + JRST STTYO3 ; Yes, don't print on console. + ; since TELSER, etc., logs in + MOVEI T,(I) ;Get TTY number + HRLI T,[ASCIZ / STYOPN /] + PUSHJ P,SGWAIT ;Ask SYSJOB to print the info + MOVE T,JNAME(U) ;Add the JNAME to the info + MOVEM T,SLGIV+2 ;to be printed + +STTYO3: JUMPL D,[MOVSI TT,%SSOHG ;JUMP IF OPENING FOR OUTPUT + JRST STTYO2] + LDB TT,[240100,,C] + DPB TT,[400100,,STYSTS-NFSTTY(I)] .SEE %SSHDX + DPB TT,[$TOHDX,,TTYOPT(I)] + MOVSI TT,%SSHNG +STTYO2: TLNE C,10 + IORM TT,STYSTS-NFSTTY(I) + MOVSI TT,%SSORS + TLNE C,20 + IORM TT,STYSTS-NFSTTY(I) + MOVE J,R + SUBI J,IOCHNM(U) ;CHANNEL BEING OPENED FOR INPUT ON + MOVE J,CHNBIT(J) + SKIPL D ;SKIP IF OUTPUT + IORM J,STYMSK-NFSTTY(I) + SKIPGE D ;SKIP IF INPUT + IORM J,STYOMS-NFSTTY(I) + AOS STYNTO-NFSTTY(I) + HRLZ A,I ;LH OF IOCHNM GETS STY NUMBER + MOVSS C + JSP Q,OPSLC3 + STYDUI,,STYDUO + STYDBI,,STYDBO + + +;ENTRY FOR OPEN OF PSEUDO-TTY AS SNM OR STN +STTYOA: JUMPL I,OPNL1 + CAIL I,NSTTYS + JRST OPNL1 + ADDI I,NFSTTY + PUSHJ P,SWTL + STYOSW + MOVE TT,STYSTS-NFSTTY(I) ;SKIP IF IN USE + TLNN TT,%SSUSE + JRST STTYO4 ;OK TO OPEN IF FREE + CAIE U,(TT) + JRST OPNL10 ;DIFFERENT USER HAS IT OPEN + PUSHJ P,LSWPOP + JRST STTYO3 + + JRST STTS ;STY INPUT SIOT ROUTINE. +;PSEUDO-TTY INPUT ROUTINE. RETURNS CHAR WITHOUT PARITY BIT +STTYI: MOVE I,A +STTYIA: SKIPGE TTYOAC(I) ;SKIP IF ANY CHARS AVAIL (MAYBE) + JRST STTYI1 +STTYI4: PUSH P,C + PUSH P,E + CONO PI,TTYOFF + PUSHJ P,TYPSC + POP P,E + POP P,C + MOVE U,USER + MOVE W,STYICH + SKIPGE DBBBP + JRST STTYI2 ;REALLY NO CHARS AVAIL + CONO PI,TTYON + MOVSI R,%SSONT ;FOR TTYO INT TO STYI + JRST STTYIC ;INT CLEAR + +STTYI2: CONO PI,TTYON +STTYI1: SKIPGE STYSTS-NFSTTY(I) + JRST STTYI3 ;DON'T HANG + SKIPGE TTYOAC(I) + PUSHJ P,UFLS + JRST STTYIA + +STTYI3: MOVNI W,1 + TLO E,100000 .SEE INBTCH ;UNHANG BLOCK MD IOT IMMEDIATELY. + JRST POPJ1 ;UNHANG SIOT IMMEDIATELY. + +;STY INPUT SIOT; GOES 1 WORD AT A TIME, WHATEVER THE USER'S BYTE SIZE. +STTS: XCTR XRW,[SKIPG E,(C)] + JRST POPJ1 ;RETURN AT ONCE IF NO CHARS WANTED BY USER. + PUSH P,B ;SAVE ADDRS OF USER'S B.P. AND COUNT. + PUSH P,C +STTSA: SKIPGE TTYOAC(I) + JRST STTS4 ;NO INPUT AVAILABLE. +STTS2: UMOVE B,@-1(P) +STTS1: XCTR XRW,[MOVES D,(B)] +;IT IS ASSUMED THAT E HAS THE # OF CHARS THE USER WANTS. + CONO PI,TTYOFF + MOVEM D,STYICH ;STORE THE WORD THE USER'S B.P. POINTS AT. + LDB C,[360600,,B] + LDB D,[300600,,B] + IDIV C,D ;HOW MANY MORE CHARS GO IN THIS WORD? + JUMPE C,STTS7 + PUSH P,B ;SAVE STARTING B.P. AND # CHARS FITTING IN WORD. + HRRI B,STYICH ;SET UP TO STORE CHARS AT APPRO. PLACE IN STYICH. + MOVEM B,DBBBP + CAML C,E + MOVE C,E ;GET MIN OF # CAHRS FITTING IN WORD AND # CHARS USER WANTS. + MOVEM C,DBBCC ;THAT'S HOW MANY CHARS WE CAN ACCEPT THIS TIME. + MOVEM C,DBBCC1 + PUSHJ P,TYP ;FILL UP STYICH WITH CHARS, VIA DBBBP. + POP P,B ;NOTE E HAS -<# CHARS GOBBLED> + MOVE D,STYICH ;GET USER'S WORD, WITH CHARS STUCK IN IT. + UMOVEM D,(B) ;STORE IT WHERE IT CAME FROM. + XCTR XRW,[ADDB E,@(P)] ;UPDATE COUNT BY -<# CHARS OBTAINED>. + HLL B,DBBBP ;UPDATE B.P. TO THE L.H. CORRESP. TO CHARS STORED IN STYICH. + UMOVEM B,@-1(P) + SKIPE DBBCC ;DID WE GET AS MANY CHARS AS WE WANTED? + JRST STTS3 ;NO, SO EITHER RETURN OR HANG UP. + CONO PI,TTYON + JUMPG E,STTS7 ;USER WANTS MORE CHARS => TRANSFER ANOTHER WORD. +STTS5: MOVE U,USER + MOVSI R,%SSONT + SUB P,[2,,2] + AOS (P) + JRST STTYIC + +;COME HERE DURING STY INPUT SIOT IF USER WANTS CHARS BUT THERE ARE NONE. +STTS3: CONO PI,TTYON +STTS4: SKIPGE STYSTS-NFSTTY(I) + JRST STTS5 ;DON'T HANG MODE. + SKIPGE TTYOAC(I) + PUSHJ P,UFLS + JRST STTSA + +STTS7: AOS B +STTS6: TLZ B,770000 + TLO B,440000 + JRST STTS1 + +;PSEUDO-TTY OUTPUT +STTYW: MOVE I,A + SKIPGE C + SKIPA A,(C) + UMOVE A,(C) +BSTTYW: MOVSI T,%SSOHG ;BIT ON SAYS DONT HANG + TDNE T,STYSTS-NFSTTY(I) + JRST BSTTYX ;J TO NOT HANG. CHARS MAY BE LOST + MOVEI T,TIBS + CAMG T,TICC(I) + PUSHJ P,UFLS ;HANG UNTIL ROOM IN INPUT BUFFER +BSTTYX: CONO PI,TTYOFF + PUSH P,I + PUSHJ P,NTYI5 + POP P,I + MOVE U,USER + MOVSI R,%SSINT +STTYIC: ANDCAM R,STYSTS-NFSTTY(I) ;CALLED BY STTYI ABOVE ALSO + HRRZ R,UUAC(U) + MOVE R,CHNBIT(R) + ANDCAM R,IFPIR(U) ;FLUSH ANY OUTPUT INTERRUPT + CONO PI,TTYON + POPJ P, + +STTBI: JSP E,INBTCH + JRST STTYI + +STTBO: JSP E,NBTOCH + CAIN A,EOFCH + POPJ P, + HLRZ I,(R) + PUSH P,R + PUSH P,D + PUSH P,TT + PUSH P,E + PUSH P,C + PUSHJ P,BSTTYW + POP P,C + POP P,E + POP P,TT + POP P,D + POP P,R + POPJ P, + +;STY OUTPUT CLOSE. +STYOCL: SUBI R,IOCHNM(U) + MOVE B,CHNBIT(R) + ANDCAM B,STYOMS-NFSTTY(A) + JRST STYCL + +;STY INPUT CLOSE +STYICL: SUBI R,IOCHNM(U) + MOVE B,CHNBIT(R) + ANDCAM B,STYMSK-NFSTTY(A) +STYCL: SOSE STYNTO-NFSTTY(A) + POPJ P, +STYCL1: PUSHJ P,TTYLFC ;LEAVE COM. MODE, PUT TTY # IN I. +IFN NETP,[ + PUSHJ P,NSTYN0 ;DISCONNECT ANY NET SOCKETS FROM THE STY + JFCL +] + CONO PI,TTYON#200_<-APRCHN> ;LEAVE CLOCK OFF. + SKIPGE C,TTYSTS(I) + JRST STYOC8 ;TTY NOT IN USE. + TLNN C,%TSCNS + JRST STYOC9 ;OPEN AS DEVICE, NOT AS CONSOLE. + PUSH P,U +STYOC3: HRRZ U,C + SKIPL C,SUPPRO(U) + JRST STYOC3 ;NOT TOP LEVEL + MOVE C,USER +STYC4A: HRRZ TT,C + SKIPL C,SUPPRO(TT) + JRST STYC4A + AOS STYNTO-NFSTTY(I) ;IN CASE WE PCLSR, PREVENT JRST 4,. + PUSH P,I + CAME U,USER ;DON'T GET INTO LOOP AT ALOGO1 + PUSHJ P,ALOGOUT ;TELL SYS JOB TO FLUSH THE TREE UNDER THE STY. + POP P,I + POP P,U + SOS STYNTO-NFSTTY(I) +STYOC5: PUSHJ P,STYIR1 ;FLUSH TTY OUTPUT BUFFER. +STYOC9: SETZM STYSTS-NFSTTY(I) + CAIN I,@USTYN(U) ;IF HE'S CLOSING HIS STY:, SAY HE HAS NONE. + HLLZS USTYN(U) + JRST CLKONJ + +STYOC8: SKIPGE TTYSTA(I) ;IN TRANSIENT STATE BETWEEN USAGE AND NOT? + JRST STYOC5 ;NO, REALLY FREE, SIMPLE. + CONO PI,CLKON + AOS STYNTO-NFSTTY(I) + MOVE T,I + PUSHJ P,STYOCF + PUSHJ P,UFLS + MOVE A,I + JRST STYCL + +STYOCF: SKIPGE TTYSTS(T) ;IF NOW IN USE + SKIPGE TTYSTA(T) ;OR COMPLETELY FREE, + AOS (P) ;THEN NO LONGER IN TRANSIENT STATE. + POPJ P, + +;STY OUTPUT .CALL FINISH +STYFIN: SKIPE TICC(A) ;WAIT UNTIL CORRESPONDING INPUT BUFFER IS EMPTY + PUSHJ P,UFLS + JRST POPJ1 + +;STY OUTPUT .CALL WHYINT +STOWHY: MOVEI A,%WYSTO ;NULL ROUTINE FOR NOW + JRST POPJ1 + +;STY INPUT .CALL WHYINT +STIWHY: MOVEI A,%WYSTI ;NULL ROUTINE FOR NOW + JRST POPJ1 + +;STY INPUT RESET. DOES TTY OUTPUT RESET, WITH THE TTY'S OWNER STOPPED. +STYIRS: HLRZ I,(R) +STYIR1: CONO PI,TTYOFF + SKIPGE B,TTYSTS(I) + JRST STYIR2 ;TTY IS FREE => NO PROBLEM. + HRRZ A,B + PUSHJ P,RPCLSR ;ELSE MUST MAKE SURE ITS OWNER ISN'T TYPING OUT. + CONO PI,TTYOFF + XOR B,TTYSTS(I) ;WE MIGHT HAVE BEEN DELAYED - HAS TTY MOVED AROUND? + TRNN B,-1 + JRST STYIR4 ;NO; THE GUY WAS STOPPED WHILE STILL ITS OWNER. + PUSHJ P,UPCLSR ;YES; UNSTOP GUY WE STOPPED, + JRST STYIR1 ;THEN GO STOP THE NEW OWNER. + +STYIR4: PUSH P,A ;SAVE JOB STOPPED + PUSHJ P,STYIR2 ;ACTUALLY DO THE RESET OF TTY OUTPUT + POP P,A + JRST UPCLSR ;THEN UNSTOP THE TTY'S OWNER + +STYIR2: SETOM TTYOAC(I) ;WE WILL NO LONGER BE LOOKING FOR TTY'S OUTPUT. + JRST TYORS1 ;DO THE TTY OUTPUT RESET AND TURN ON PI CHANNELS. + +;STY OUTPUT RESET. +STYORS: HLRZ I,(R) +STYOR1: CONO PI,TTYOFF + PUSHJ P,TYIRS1 ;TURNS INTO TTY INPUT RESET. + JRST TTYONJ + +;STY OUTPUT STATUS - BIT 2.1 => BUFFER FULL, 2.2 => EMPTY. +STASTO: ANDI A,77 + SKIPN B,TICC(A) + IORI D,1_<9+1> ;BUFFER EMPTY. + CAIL B,TIBS-10. + IORI D,1_9 ;ALMOST FULL. + POPJ P, + +;STY INPUT STATUS - THE SAME 2 BITS. +STASTI: ANDI A,77 + SKIPG B,TORM(A) + IORI D,1_9 ;FULL. + CAIN B,TOBS + IORI D,1_<9+1> ;EMPTY. + POPJ P, + +;"STYGET" SYSTEM CALL. 1 ARG, A TTY SPECIFYER. +;1ST VALUE IS STYSTS WORD (RH IS JOB NUMBER OF OWNER OF STY). 0 FOR FREE STY. +; %SSHNG AND %SSOHG BITS MAY BE INTERESTING. +;2ND VALUE IS JOB THAT OWNS CORRESP. TTY (OR -1 IF TTY FREE). +;3RD VALUE IS -1 IF TTY NOT CONSOLE; ELSE JOB NUMBER OF TOP OF TREE IN RH +; AND BIT 4.8 SET IFF IT IS LOGGING OUT. +; AND BIT 4.7 SET IF IT IS LOGGED IN. +;4TH VALUE BITS ARE: +; 1 IF TTY OWNER IS IN TYO WAIT +; SIGN IF HE'S IN TYI WAIT. +;5TH VALUE BITS ARE: +; 4.9 => TTY INPUT AVAILABLE +; 4.8 => TTY OUTPUT BUFFER HAS ROOM +;6TH VALUE IS TTYSTA WORD + +NSTYGT: JSP J,ATTYCI ;DECODE A TTY-SPECIFYER IN A. + CONO PI,CLKOFF + SETZ A, + MOVE TT,TTYTYP(I) + TRNN TT,%TYSTY ;IF SPEC'D TTY ISN'T ASSOCIATED WITH A STY, IT HAS NO STYSTS WORD. + JRST NSTYG3 + HRRZ A,STYSTS-NFSTTY(I) + IDIVI A,LUBLK ;NUMBER OF JOB USING THE STY. + HLL A,STYSTS-NFSTTY(I) ;AND SOME RANDOM BITS. +NSTYG3: SETOB B,C ;B GETS # OF JOB THAT HAS TTY, OR -1. + ;C GETS (IF TTY IS CONSOLE, JOB # OF TOP OF TRREE, ELSE -1). + SETZB D,E ;D, E SHOULD GET 0 IF NO JOB HAS TTY. + HRRE B,TTYSTS(I) + JUMPL B,NSTYG1 ;JUMP IF CONSOLE NOT IN USE. + IDIVI B,LUBLK ;ELSE GET JOB NUMBER OF JOB USING IT. + MOVE D,TTYSTS(I) + TLNN D,%TSCNS ;TTY NOT CONSOLE => DON'T REPLACE THE -1 IN C WITH ANYTHING. + JRST NSTYG2 + HRRZ C,TTYSTS(I) + SKIPL D,SUPPRO(C) ;ELSE TRACE SUPPRO'S TO TOP OF TREE. + JRST [ HRRZ C,D + JRST .-1] + MOVE TT,APRC(C) + HLRE W,UNAME(C) + IDIVI C,LUBLK ;GET JOB # OF TOP OF TREE. + TLNE TT,BULGOS + TLO C,200000 + AOSE W + TLO C,100000 +NSTYG2: SETZ D, + MOVE TT,TTYSTS(I) + HRRZ TT,FLSINS(TT) ;WHAT VARIABLE IS FLSINS OF JOB OWNING TTY WAITING ON? + CAIE TT,TICC(I) ;RETURN IN D SETZ IFF JOB IS IN TYI WAIT, + CAIN TT,TACC(I) + MOVSI D,(SETZ) + CAIN TT,TORM(I) + MOVEI D,1 ;OR 1 IF JOB IS IN TYO WAIT; ELSE 0. +NSTYG1: SKIPE TICC(I) + TLO E,400000 + MOVE TT,TORM(I) + CAIL TT,TYOWNC + TLO E,200000 + MOVE TT,TTYSTA(I) + CONO PI,CLKON + JRST POPJ1 + +;.CALL STLGET - GET INFO FROM SERVER TELNET + +; Arg 1: a TTY +; Val 1: XJNAME of server telnet +; Val 2: TRMNAM of server telnet (has sixbit name of host) +; Val 3: SNAME of server telnet +; Val 4: STY control bits,,STY owner idx + +NSTLGT: JSP J,ATTYCI + SETZB A,B + SETZB C,D + MOVE TT,TTYTYP(I) + TRNN TT,%TYSTY + JRST OPNL34 + SKIPN T,STYSTS-NFSTTY(I) ;Get STY status bits,,STY user. + JRST POPJ1 + MOVE A,XJNAME(T) + MOVE B,TRMNAM(T) + MOVE C,USYSNM(T) + HRRZ D,T + IDIVI D,LUBLK ;Make it into user index. + HLL D,T ;Stuff STY status bits in LH. + JRST POPJ1 + + +SUBTTL .ATTY, .DTTY - PASS CONTROL OF TTY + +NATTY: MOVE J,A ;.CALL ATTY + JSP T,NCRUI2 ;DECODE JOBSPEC BUT DON'T SET DIELOK + JFCL +IFN PDP6P,[ + CAIN J,-1 + JRST OPNL34 ;SORRY, I/O BUS MPXR IS NOT THAT HAIRY +] + HRRZ B,SUPPRO(J) + CAME B,U + JRST OPNL31 ;NOT DIRECT INFERIOR (CAN'T MODIFY JOB) + MOVE A,J + JRST NATTY1 + +; .ATTY USR, OPER 11 + +AATTY: HLRZ A,(R) ;A HAS INFERIOR'S USER INDEX + HRRZ B,(R) + SKIPL CLSTB(B) .SEE %CLSU ;SKIP IF USER OPEN ON CHANNEL + JRST OPNL34 +NATTY1: MOVE TT,APRC(A) + TLNE TT,BULGOS ;REFUSE TO GIVE TTY TO A DYING JOB. + JRST OPNL42 ;JOB GOING AWAY + CONO PI,CLKOFF + MOVE I,TTYTBL(U) + JUMPL I,AATT1 ;DOESNT HAVE TTY NOW + HLLZS TTYTBL(U) + HRLI A,%TBNOT + IORM A,TTYTBL(U) ;NO LONGER HAS TTY. STORE USER INDEX GIVEN TO + PUSHJ P,AATT6 ;A _ IDX OF USER TO RECEIVE TTY, + ;ALSO CHANGE ALL TTYTBL VARS THAT NEED IT. + EXCH A,U + PUSHJ P,AGBLT6 ;TAKE TTY FROM USER IN A (ME), + ;GIVE TO USER IN U (HIM) + ;CHANGES TTY VARS AND TTSTSV VARS. + ;ALSO SETS CHANNELS-OPEN MASKS. + ;TURNS ON ALL PI CHNLS. + EXCH A,U + JRST POPJ1 + +AATT1: TLZN I,%TBDTY ;SAY OUR INFERIOR HAD IT WHEN TAKEN + JRST OPNL10 ;DEVICE NOT AVAILABLE, ALREADY GAVE TTY AWAY + HRRI I,(A) + MOVEM I,TTYTBL(U) + PUSHJ P,AATT6 ;SET UP HIS VARS + JRST CLKOJ1 + +;CHANGE TTYTBL VARS OF ALL JOBS DOWN TO THE ONE GETTING THE TTY. +;RETURN IN A, T, TT THE TTYSTS, TTYST1, TTYST2 SETTINGS FOR THAT JOB. +;IF THAT JOB NEVER HAD THE TTY, INIT HIS TTSTSV VARS. +;I HAS TTY #, U HAS RUNNING JOB. +AATT6: MOVE E,TTYTBL(A) + MOVSI T,%TSATY ;TELL THIS GUY TTY WAS TAKEN FROM HIM & RETURNED. + IORM T,TTSTSV+2(A) + TLNE E,%TBDTY ;SKIP IF NOT TAKEN FROM ME + JRST AATT3 ;GUY IT WAS TAKEN FROM (I.E. HE HADN'T GIVEN IT TO SOMEONE ELSE) + HRRZ A,TTYTBL(A) + JRST AATT6 + +AATT3: HRRZS I ;TTY NUMBER + HLL A,TTSTSV+2(A) + TLZ A,%TSFRE+%TSLCZ ;CLEAR TTY NOT OPEN AND ^Z BITS + MOVEM A,TTSTSV+2(A) ;UPDATE SAVED TTY STATUS + POPJ P, + +;SET UP TYIMSK AND TYOMSK. ARGS: TTY # IN I, +;D -> 1ST IOCHNM WORD OF USER TO SET UP FOR. +;MAKE LAST CHAR IN INPUT BFR AN ACTIVATION CHAR. TURN ON TTYCHN. +AATT8: SETZM TYOMSK(I) + SETZM TYIMSK(I) + CONO PI,TTYOFF + HRLI D,A ;INDIRECTION POINTER TO INFERIOR'S IO CHANNELS + MOVSI A,-20 ;AOBJN POINTER +AATT9: MOVE B,@D ;GET IOCHNM IN B + JUMPGE B,AATT10 ;IF CHANNEL HAS CONSOLE BIT SET, + ANDI B,-1 + MOVE C,CHNBIT(A) ;GET THE BIT WE MIGHT WANT TO SET. + CAIE B,TYODN + CAIN B,TYOBN ;IF TTY OUTPUT CHNL, + IORM C,TYOMSK(I) ;SET BIT IN OUTPUT MASK. + CAIE B,TYIDN + CAIN B,TYIBN ;IF INPUT, SET IN INPUT MASK. + IORM C,TYIMSK(I) +AATT10: AOBJN A,AATT9 ;TRY NEXT CHANNEL OR CONTINUE IF DONE + JRST ATTYS1 ;ALL CHRS SO FAR ARE ACTIVATION CHRS + +ADTTY: ;DON'T CLOBBER R (SEE AUCL2) +SDTTY: CONO PI,CLKOFF + MOVE A,TTYTBL(U) + JUMPGE A,CLKOJ1 ;I ALREADY HAVE IT + TLNE A,%TBDTY + JRST CLKOJ1 ;I ALREADY DID A .DTTY AND SO DID MY SUPERIOR + +;LOOK FOR SUBJOB THAT HAS TTY, OR DOESN'T WANT TO GIVE TTY +;AWAY IF IT GETS THE TTY. +AGBLT3: MOVE I,TTYTBL(A) + TLNE I,%TBDTY ;REACHED A JOB THAT DIDN'T GIVE TTY AWAY + JRST AGBLT1 ;THIS IMPLIES OUR SUPERIOR TOOK TTY AWAY. + JUMPL I,AGBLT2 ;IF THIS GUY GAVE IT AWAY THEN TRY THE ONE HE GAVE IT TO + HRRZS A ;A HAS IDX OF TTY OWNER; TAKE TTY FROM HIM. + PUSHJ P,RPCLSR ;TURNS CLOCK ON! + CONO PI,CLKOFF + SKIPGE TTYTBL(A) ;DID TTY MOVE WHILE CLOCK WAS ON? + JRST [PUSHJ P,UPCLSR ;IF SO, START OVER + JRST SDTTY] + HLLZ D,TTYTBL(A) + TLZ D,%TBCLR ;DON'T ALTER USER-SETTABLE BITS, BUT + TLO D,%TBNOT+%TBDTY ;TELL HIM HE HASN'T GOT TTY. + MOVEM D,TTYTBL(A) + AOS (P) ;THE .DTTY SHOULD SKIP. + PUSH P,[UPCLSR] ;AFTER RESTARTING THE SUBJOB. +AGBLT6: ANDI I,-1 ;LH(TTYTBL) MAY BE NONZERO EVEN IF JOB HAS TTY! + MOVSI D,%TCLED + TDNE D,TTYCOM(I) ;IF OLD JOB WAS WANTING LOCAL EDITING, + PUSHJ P,AGBLT5 ;TELL TERMINAL TO STOP IMMEDIATELY. + ANDCAM D,TTYCOM(I) ;ASSUME NEW JOB DOES NOT WANT LOCAL EDITING + ;AND SHOULD NOT SEE RESYNCHS (TOP-S). + MOVEI D,TTSTSV-1(A) ;SAVE CURRENT TTY STATUS IN + PUSH D,TTYST1(I) ;USER VARS OF USER GIVING AWAY THE TTY. + PUSH D,TTYST2(I) + PUSH D,TTYSTS(I) + MOVE TT,I + IMULI TT,TPLEN*2 + MOVE D,TPVB+TPLEN(TT) + SUB D,TCMXV(I) + MOVNS D + DPB D,[$TBECL,,TTYTBL(A)] +IFN N11TYS,[ + EXCH U,A ;GET USER GIVING AWAY TTY IN U + MOVE D,TVVBN(U) ;SAVE THIS + PUSHJ P,TVBNCL ;CLEAR OUT CURRENT GUY (MAYBE CLEARING RUN GLITCH ON SCREEN) + MOVEM D,TVVBN(A);PASS THE BALL TO HIM + EXCH U,A +] +;ENTRY FROM "ATTACH". GIVE TTY TO JOB W/ IDX IN U, WITHOUT +;"TAKING" IT FROM ANY JOB. USED WHEN TTY HAD BEEN FREE; JOB, DISOWNED. +AGBLT4: HRROI D,TTSTSV+2(U) + POP D,TTYSTS(I) ;RESTORE THE TTY STATUS OF JOB GIVING TTY TO. + POP D,TTYST2(I) + POP D,TTYST1(I) + HRRM I,TTYTBL(U) ;INDICATE THAT IT HAS THE TTY + LDB H,[$TBECL,,TTYTBL(U)] + HRLOI D,#%TBCLR + ANDM D,TTYTBL(U) + PUSHJ P,ASCML1 ;SET # COMMAND LINES FROM H + MOVSI D,%PJATY + AND D,MSKST(U) + IORM D,PIRQC(U) + MOVEI D,IOCHNM(U) + PUSH P,A ;GENERATE CHNLS-OPEN MASKS, CREATE AN + PUSHJ P,AATT8 ;ACTIVATION CHAR IF NEC, TURN ON PI. + JRST POPAJ + +AGBLT2: HRRZ A,TTYTBL(A) + JRST AGBLT3 + +AGBLT1: MOVSI A,%TBDTY ;TTY WAS TAKEN AWAY FROM US, + IORM A,TTYTBL(U) ;WHEN GIVEN BACK WILL STOP WITH THIS JOB. + JRST CLKOJ1 + +;TELL TERMINAL TO STOP DOING LOCAL EDITING IMMEDIATELY. +AGBLT5: MOVE H,TTYOPT(I) + TRNE H,%TP11T + POPJ P, ;DON'T EVEN TRY ON A TV -- TORM DOESN'T MEAN ANYTHING. + SKIPG TORM(I) ;WAIT FOR ROOM IN OUTPUT BUFFER. + PUSHJ P,UFLS + PUSH P,A + MOVE Q,TOIP(I) + MOVEI A,%TDNLE + PUSHJ P,TYOOU1 ;PUT CMD IN OUTPUT BFR, + MOVEM Q,TOIP(I) + AOSN TTYOAC(I) + XCT TTYST(I) ;AND TELL INT. LVL. ABOUT IT. + JRST POPAJ + +SUBTTL CNSSET, TTYSET, ETC. .CALLS FOR TTYS + +;DECODING TTY SPECIFIERS. CALL WITH JSP,J. MAY RETURN TO (J), +;OR POPJ AND REPORT AN ERROR. + +;DECODE A TTY SPECIFIER, BUT DON'T CHECK FOR PERMISSION TO +;USE THE TTY. ALWAYS RETURN IMMEDIATELY WITH LEGAL TTY SPECIFIER. +ATTYCI: MOVEI Q,CPOPJ + JRST ATTYC8 + +;DECODE A TTY SPECIFIER. +;IF W IS GREATER THAN ONE, DO NOT ALLOW RANDOM TTY NUMBERS. +;ALWAYS WAIT FOR PERMISSION TO OUTPUT. +;IF THE SPECIFIED TTY IS OUR CONSOLE AND OUTPUT IS BEING IGNORED, +;CLOBBER W TO ONE, SO THAT ITS PARAMETERS WILL NOT BE CHANGED (FOR SCPOS). +ATTYCW: JSP Q,[ CAIGE W,2 + JRST ATTYC8 + JRST ATTYC7 ] + PUSHJ P,TTYWO2 + MOVEI W,1 + POPJ P, + +;DECODE A TTY SPEC. +;IF THERE ARE TWO OR MORE ARGS, AND IT IS OUR CONSOLE, +;WAIT UNTIL WE OWN IT, OR MAYBE INTERRUPT. +ATTYC: CAIGE W,2 + JRST ATTYCI +;DECODE A TTY SPEC. +;IF IT IS OUR CONSOLE, WAIT TILL WE OWN IT, OR MAYBE INTERRUPT. +ATTYC2: MOVEI Q,TTYWC2 + JRST ATTYC7 + +;DECODE A TTY SPEC. +;IF IT IS OUR CONSOLE, WAIT TILL WE CAN DO INPUT, +;OR INTERRUPT IF DOING INPUT WOULD. +ATTYCR: MOVEI Q,TTYWI2 + JRST ATTYC7 + +;DECODE A TTY SPEC. SKIP IF IT REFERS TO OUR CONSOLE. +;DO NOT ALLOW RANDOM TTY NUMBERS. +ATTYCM: MOVEI Q,[AOJA J,CPOPJ] + JRST ATTYC7 + +;DECODE A TTY SPEC. SKIP IF IT REFERS TO OUR CONSOLE. +ATTYC9: MOVEI Q,[AOJA J,CPOPJ] +;DECODE CHNL # (IF < 400000) OR TTY # (OTHERWISE) IN A. -1 MEANS TREE'S CONSOLE. +;IF CHNL # BAD, POPJ WITH OPNL. IF NOT STY OR TTY, POPJ WITH OPNL. +;IF OUR CONSOLE, CALL THE ROUTINE Q POINTS TO. +;THEN RETURN WITH TTY # IN I. +ATTYC8: TDZE A,[-400000] ;IS IT A TTY NUMBER? + JRST ATTYC3 ;YES, DECODE THAT. +;DECODE CHNL #, TTY # NOT ALLOWED. +ATTYC7: HRRE T,A + AOJE T,ATTYC6 + HRLI J,ATTYC5 ;RETURN THERE IF NORMAL, OPEN CHANNEL + MOVEI T,AIOCAL ;USE JOB DEVICE CHECKER + JRST CHNDCD ;DECODE CHANNEL AND HANDLE JOB DEVICE SPECIALLY. + +;CHNDCD RETURNS HERE WITH IOCHNM WORD CONTENTS IN H. +ATTYC5: HRRZ T,H + LDB I,[$TIIDX,,H] ;FOR EITHER TTY CHNL OR STY CHNL, GET TTY #. + CAIN I,%TINON ;TREE HAS NO TTY => RETURN "DEVICE NOT AVAILABLE". + JRST OPNL10 + CAIG T,4 ;TTY CHNL => GOOD. + JUMPG T,ATTYC4 + CAIL T,STYDUI + CAILE T,STYDBO + JRST OPNL34 ;NOT STY => BAD. + JRST (J) ;STY => GOOD. + +ATTYC4: LDB T,[.BP <%TICNS,,>,H] ;GET DEVICE/CONSOLE BIT + JUMPE T,ATTYC1 ;JUMP IF IT'S A DEVICE. + PUSHJ P,(Q) ;AWAIT TTY OR INTERRUPT + LDB I,[$TIIDX,,(R)] + SKIPGE T,TTYTBL(U) + JRST (J) ;USER DOESN'T HAVE THE TTY (^P), ERROR CHECKS DON'T APPLY + CAIE I,(T) + BUG ;USER HAS TWO DIFFERENT CONSOLE TTYS +ATTYC1: HRRZ T,TTYSTS(I) ;USER INDEX THAT HAS THIS TTY + CAME T,U + BUG ;USER HAS TTY BUT TTY DOESN'T HAVE THAT USER + JRST (J) + +ATTYC3: MOVEI I,(A) + CAIGE I,NCT ;IS THE ARG THE # OF A REAL TTY? + JRST (J) ;YES, OK. + CAIE I,377777 ;SKIP IF ARG WAS -1 + JRST OPNL1 ;"NO SUCH DEVICE" ERROR. +ATTYC6: PUSHJ P,(Q) ;"MY OWN CONSOLE" SPECIFIED; WAIT OR INTERRUPT. + HRRZ I,TTYTBL(U);NOW GET TTY NUMBER + CAIN I,%TINON ;TREE HAS NO TTY => RETURN "DEVICE NOT AVAILABLE". + JRST OPNL10 + JRST ATTYC1 + +;TTYSET SYSTEM CALL +;SETS TTYST1, TTYST2, TTYSTS, WHEN THE USER HAS THE TTY +;HANGS UNTIL HE GETS IT +ATTYST: JSP J,ATTYCM ;GET TTY NUMBER IN I; SKIP IF IT'S OUR CONSOLE. + JRST ATTYS6 + SKIPGE TTYTBL(U) + JRST ATTYS5 ;JUMP IF OUR CONSOLE AND WE DON'T OWN IT. +ATTYS6: CONO PI,TTYOFF + MOVEM B,TTYST1(I) + MOVEM C,TTYST2(I) + CAIGE W,4 + JRST ATTYS0 ;NO 4TH ARG => DON'T SET TTYSTS. + TLNE D,%TSINT ;SETTING "INT ON NEXT CHAR REGARDLESS"? + PUSHJ P,ATTYS3 ;MAYBE THE "NEXT CHAR" HAS ALREADY BEEN READ. + HRLOI B,%TSFRE+%TSCNS+%TSLCZ+%TSHDX ;DON'T CHANGE THESE. + TLZ D,%TSFRE+%TSCNS+%TSLCZ+%TSHDX + ANDCMI D,-1 + ANDM B,TTYSTS(I) + IORM D,TTYSTS(I) +ATTYS0: AOS (P) ;MAKE ALL CHRS IN BUFFER ACTIVATION CHARS +ATTYS1: SKIPG TICC(I) + JRST TTYONJ + LDB E,TIIP(I) ;MAKE LAST CHAR AN ACTIVATION CHAR + TRON E,%TXACT + AOS TACC(I) ;IF IT WASN'T ONE, IS ONE MORE ACT CHAR NOW + DPB E,TIIP(I) + JRST TTYONJ + +ATTYS3: SKIPE B,TINTP(I) +ATTYS4: CAMN B,TIIP(I) ;ANY MORE CHARS TO CHECK? + POPJ P, + CAMN B,TIBEP(I) + SUBI B,TIBL + ILDB E,B ;YES, CHECK THE NEXT ONE. + TRNE E,%TXIGN ;IF IT ISN'T REALLY THERE, IT SHOULDN'T + JRST ATTYS4 ;INTERRUPT. + TLZ D,%TSINT ;ELSE THIS CHAR IS THE "NEXT CHAR" THAT + TROE E,%TXINT ;SHOULD INTERRUPT REGARDLESS. + POPJ P, + AOS TINTC(I) ;SO MAKE IT AN INT. CHAR IF IT ISN'T. + DPB E,B + MOVE B,TYIMSK(I) + AND B,MSKST2(U) + MOVN C,B + AND B,C + IORM B,IFPIR(U) + MOVEI A,%PITYI + TDNE A,MSKST(U) + IORM A,PIRQC(U) + POPJ P, + +;TTYSET WHEN WE DON'T OWN OUR CONSOLE. +ATTYS5: MOVEM B,TTSTSV(U) + MOVEM C,TTSTSV+1(U) + CAIGE W,4 + JRST POPJ1 + HRLOI B,%TSFRE+%TSCNS+%TSLCZ+%TSHDX ;DON'T CHANGE THESE. + TLZ D,%TSFRE+%TSCNS+%TSLCZ+%TSHDX ;CHANGE ONLY CERTAIN LH BITS. + ANDCMI D,-1 + ANDM B,TTSTSV+2(U) + IORM D,TTSTSV+2(U) + JRST POPJ1 + +;TTYGET SYSTEM CALL +;GETS TTYST1, TTYST2 AND TTYSTS WHEN THE USER HAS THE TTY +;HANGS UNTIL HE GETS IT, IF IT'S HIS CONSOLE. +;ALSO RETURNS HIS TTYTYP, TCTYP. +;THE RH OF TTYSTS AS RETURNED IS PRE-DIVIDED BY LUBLK +ATTYGT: JSP J,ATTYC9 ;GET TTY NUMBER NOW IN I; SKIP IF IT'S OUR CONSOLE. + CAIA + SKIPL TTYTBL(U) + JRST ATTYG1 +;OUR CONSOLE AND WE DON'T CURRENTLY OWN IT. + MOVE A,TTSTSV(U) + MOVE B,TTSTSV+1(U) + MOVE C,TTSTSV+2(U) + JRST ATTYG2 + +;EITHER NOT OUR CONSOLE OR WE OWN IT. +ATTYG1: MOVE A,TTYST1(I) + MOVE B,TTYST2(I) + HLLZ C,TTYSTS(I) +ATTYG2: HRRZ D,TTYSTS(I) ;GET IDX OF TTY'S OWNER + CAIE D,-1 ;(BUT MAY BE NO OWNER IF WE SPECIFIED RANDOM TTY) + IDIVI D,LUBLK ;RETURN IN EASY-TO-DIGEST FORM. + HRR C,D + MOVE D,TTYOPT(I) + TLNE D,%TOHDX ;THE %TSHDX BIT REFLECTS THE %TOHDX BIT. + TLO C,%TSHDX + MOVE D,TTYTYP(I) + MOVE E,TCTYP(I) + JRST POPJ1 + +;SCML SYSTEM CALL. 1ST ARG TTY OR STY CHNL, +;2ND ARG IS DESIRED # COMMAND LINES(FOR ECHOING AT BOTTOM OF SCREEN) +;2ND ARG 0 => NO ECHO REGION. +ASCML: JSP J,ATTYCM + JRST ASCML3 + SKIPL TTYTBL(U) + JRST ASCML3 + DPB B,[$TBECL,,TTYTBL(U)] ;IT'S OUR CONSOLE AND WE DON'T OWN IT. + JRST POPJ1 + +ASCML3: PUSH P,[TTYOJ1] + CONO PI,TTYOFF + MOVEI H,(B) +;I HAS TTY #, H HAS # CMD LINES, TTY CHANNEL OFF (TURNED BACK ON). +ASCML1: MOVE TT,TCMXV(I) + CAMN TT,[MOVE] + JRST [ MOVE H,TT ;PRINTING TERMINALS (INFINITE SCREEN) ARE A SPECIAL CASE + JRST ASCML2 ] + CAML H,TT + SOS H,TT + SUB H,TCMXV(I) + MOVMS H ;VPOS OF START OF ECHO AREA. + CAIL H,117. + MOVEI H,117. ;IF TCMXV GARBAGE, AVOID GETTING GARBAGE INTO TPVP +ASCML2: MOVE TT,I + IMULI TT,TPLEN*2 + ADDI TT,TPLEN + CAMN TT,TTYLPP(I) ;MAKE SURE TTY ISN'T ASSOCIATED WITH PC OF PPR + PUSHJ P,TYOMVC ;WHILE THE LATTER'S SIZE IS CHANGING. + SUBI TT,TPLEN + MOVEM H,TPVB+TPLEN(TT) + MOVEM H,TPVP+TPLEN(TT) + HRLM H,TPSP+TPLEN(TT) + JRST NCNSSG + +;RCPOS SYSTEM CALL. (READ CURSOR POSITION) +;1 ARG - TTY OR STY CHNL. +;1ST VALUE ,, +;2ND VALUE
,,
+;1ST VALUE IRRELEVANT IF NO ECHO LINES. +ARCPOS: JSP J,ATTYCW + HRRZ B,H + CAILE B,4 + JRST NRCPO1 + SKIPL TTOALC(I) + PUSHJ P,UFLS +NRCPO1: MOVE TT,I + IMULI TT,TPLEN*2 + HRRZ B,TPVP+TPLEN(TT) + SUB B,TPVB+TPLEN(TT) + HRLZS B + HRR B,TPHP+TPLEN(TT) + HRLZ A,TPVP(TT) + HRR A,TPHP(TT) + JRST POPJ1 + +;SCPOS SYSTEM CALL GETS OR SETS THE SYSTEM'S IDEA OF WHERE THE TTY'S +;CURSOR IS REALLY LOCATED (AT THE M.P. SIDE OF THE OUTPUT BUFFER). +;TO BE USED AFTER OUTPUTTING IN SUPERIMAGE MODE, TO TELL THE SYSTEM +;WHAT THE CHARS ALREADY OUTPUT WILL DO TO THE TTY. MAY ALSO BE USED +;BY A STY PROGRAM LOOKING AT A SOFTWARE TTY, TO TELL THE SYSTEM HOW +;IT HAS INTERPRETED THE CURSOR-MOVING DISPLAY CODES, PROVIDED THE +;OUTPUT BUFFER IS EMPTY (AS IT WILL BE AFTER AN OUTPUT RESET). +;FOR THAT APPLICATION, A WAY TO SET TTOALC IS PROVIDED. +;3 VALUES - VPOS, HPOS AND TTOALC. +;1 ARG (TTY SPEC) => JUST READ THEM. +;2 MORE ARGS => THEY ARE NEW VPOS AND HPOS. +;A FOURTH ARG WILL SET TTOALC. +NSCPOS: JSP J,ATTYCW + HRRZ T,H + CAILE T,4 ;IF WE'RE HACKING A TTY CHANNEL + JRST NSCPO4 + SKIPL TTOALC(I) ;THEN MAYBE THE TTY WANTS TO HACK IT FIRST. + PUSHJ P,UFLS +NSCPO4: SOJE W,NSCPO2 + JUMPL B,OPNL33 + JUMPL C,OPNL33 + CAIG B,118. ;DON'T ALLOW GARBAGE TO GET INTO TPVP + CAIGE W,2 + JRST OPNL33 ;NOT 3 ARGS?? + CAMGE B,TCMXV(I) + ;CAML C,TCMXH(I) + CAIL C,400 ;PREVIOUS LINE MESSES UP ON !-CONTINUED LINES + JRST OPNL33 +NSCPO2: MOVSI TT,%TCLED ;CONTROL BIT SET => SET %TCLED, ALLOWING THIS JOB TO + SKIPE CTLBTS(U) ;READ TOP-E AND TOP-S CHARS. NORMALLY, ITS DISCARDS THEM. + IORM TT,TTYCOM(I) + CONO PI,TTYOFF + SKIPL TT,TTYLPP(I) + JRST NSCPO1 ;WHERE POS LIVES DEPENDS ON WHETHER TTY IS ASSOCIATED. + HRRZ T,C + HRL T,B ;FOR DISSOCIATED TTYS, TTYLPS HAS POS, MUST BE SET. + CAIE W, + MOVEM T,TTYLPS(I) + SETCA TT, ;MAKE SURE TT HAS THE PC PPR #, UNCOMPLEMENTED. +NSCPO1: MOVE A,TPVP(TT) ;FOR ASSOCIATED TTY, POS LIVES IN TPVP AND TPHP OF PC PPR. + CAIE W, + MOVEM B,TPVP(TT) + MOVE B,TPHP(TT) + CAIE W, + MOVEM C,TPHP(TT) +NSCPO3: MOVE C,TTOALC(I) ;NOW GET OLD TTOALC, AND SET IT IF THERE WERE 4 ARGS. + CAIGE W,3 + JRST TTYOJ1 + MOVEM D,TTOALC(I) + CONO PI,TTYON + AOSN TTYOAC(I) ;MAY BE RESTARTING FROM ZERO ALLOCATION + XCT TTYST(I) + JRST POPJ1 + +;CNSGET OR RSSIZE SYSTEM CALL. 1 ARG - TTY OR STY CHNL. +;RETURNS THE SAME VARS THAT CNSSET SETS, IN THE SAME ORDER. +NCNSGET: ;RETURN PERMANENT AND SEMIPERMANENT TTY INFO. +ARSSIZ: JSP J,ATTYCI + MOVE TT,TTYTYP(I) + MOVE E,TTYOPT(I) + MOVE D,TTYCOM(I) + MOVE C,TCTYP(I) + MOVE B,TCMXH(I) ;NOTE TCMXH IS LINEL INCLUDING THE CONTIN. COLUMN, + MOVE A,TCMXV(I) + MOVE I,TTYSMT(I) + SOJA B,POPJ1 + +;CNSSET SYSTEM CALL. +;1ST ARG TTY OR STY CHNL. NEXT ARGS SET +;VERT SIZE, HORIZ SIZE, TCTYP, TTYCOM, TTYOPT VARS RESPECTIVELY. +;TCTYP CAN'T BE SET TO A NONSENSE VALUE, SOME TTYCOM BITS CAN'T BE SET. +;IF 2ND, 3RD OR 4TH ARG IS NEGATIVE, ITS VALUE ISNT CHANGED +NCNSSET: + JSP J,ATTYC + MOVE H,TT +;.CALL TTYVAR ENTERS HERE WITH B/TCMXV, C/TCMXH-1, D/TCTYP, E/TTYCOM, H/TTYOPT +;AND I/TTY#, W/6 +NCNSS0: SKIPL D ;MAKE SURE D HAS NEW VALUE OF TCTYP, + CAIG W,3 ;WHETHER WE'RE CHANGING IT NOW OR NOT. + MOVE D,TCTYP(I) + CAIL D,%TNMAX ;DON'T LET TCTYP BE SET TO ILLEGAL VALUE. + JRST OPNL33 + CONO PI,TTYOFF + MOVE T,TTYTYP(I) ;DON'T LET %TPORS BE SET FOR PDP11 TV. + TRNE T,%TY11T + TRZA H,%TPORS+7*%TPPCR+%TPCBS + TRZA H,%TP11T ;%TP11T MUST REFLECT %TY11T. + IORI H,%TP11T + TRNE T,%TY11T + JRST [ MOVEI B,37. ;DON'T ALLOW A TV TO BE CALLED ANYTHING BUT. + MOVEI C,95. + MOVEI D,%TNTV + JRST NCNSS3] + CAIN D,%TNTV ;NOT A PDP11 LINE => DON'T LET IT BE TREATED AS ONE. + MOVEI D,%TNDP +NCNSS3: CAIGE W,6 + MOVE H,TTYOPT(I) + SKIPE D + TLZ H,%TORAW ;"RAW" MODE EXISTS ONLY ON PRINTING TTYS. + SKIPGE TYMDTB(D) + TLZ H,%TOMVU+%TOERS ;DON'T CLAIM TO DO SOMETHING WE DON'T KNOW HOW TO DO + MOVEI T,1 + TLNN H,%TOMVU + MOVEM T,TTYROL(I) ;ON PRINTING TTYS TTYROL MUST BE 1 + TRNN H,%TPCBS ;IF ^\ ISN'T TO BE HANDLED SPECIALLY, MAKE SURE ALL OF + SETOM TTOALC(I) ;THE FEATURES IT PROVIDES ARE IN THEIR NORMAL STATES. + MOVEI TT,TYBN + TRNN H,%TPCBS+%TPTEL + MOVEM TT,TYBPC(I) + MOVE TT,I + IMULI TT,TPLEN*2 ;TT HAS IDX OF MAIN PC PPR OF TTY. + XORI W,-1 ;EACH OF THE INSNS AFTER THE JRST SETS ONE PARAMETER. + CAIL W,#6 ;>6 ARGS SAME AS 6 ARGS. + JRST NCNSS1+2(W) ;ELSE DON'T SET VARS WE DIDN'T GET ARGS FOR. + MOVEM H,TTYOPT(I) + PUSHJ P,NCNSSC ;SET TTYCOM + MOVEM D,TCTYP(I) ;SET TCTYP. + PUSHJ P,[CAIL C,3 ;DON'T ALLOW SCREEN WIDTH LESS THAN 3. + CAIL C,377777 ;DON'T ALLOW AN HPOS THAT WON'T FIT IN HALFWORD. + POPJ P, ;SPEC NO GOOD, IGNORE + JRST NCNSSH ] ;SET TCMXH. + PUSHJ P,[CAMN B,[200000,,] ;200000,, IS SPECIAL (PRINTING TTY). + JRST NCNSSV + CAIL B,3 ;DON'T ALLOW SCREEN HEIGHT LESS THAN 3. + CAIL B,120. ;VPOS MUST FIT IN ASCII CHARACTER, USUALLY. + POPJ P, ;NO GOOD, IGNORE + JRST NCNSSV ] ;SET TCMXV +NCNSS1: PUSHJ P,NCNSSG ;COMPUTE TTYEPP FROM NEW SETTINGS OF TTY VARS. + JRST TTYOJ1 + +;SET TTY WIDTH (NOT INCLUDING THE SPACE FOR THE "!") TO ARG IN C. +;TTY # IN I, MAIN PC PPR IDX IN TT. +NCNSSH: ADDI C,1 + MOVEM C,TCMXH(I) + CAMG C,TTYIHP(I) ;DON'T ALLOW TTYIHP TO HAVE ILLEGAL VALUE. + SETZM TTYIHP(I) +.SEE TPHE ; MOVEM C,TPHE(TT) +.SEE TPHE ; MOVEM C,TPHE+TPLEN(TT) + CAMG C,TPHP(TT) + MOVEM C,TPHP(TT) + CAMG C,TPHP+TPLEN(TT) + MOVEM C,TPHP+TPLEN(TT) + POPJ P, + +;SET TTY SCREEN HEIGHT FROM VALUE IN B. +NCNSSV: MOVEM B,TCMXV(I) + CAMG B,TTYIVP(I) ;DON'T ALLOW TTYIVP TO GET ILLEGAL VALUE. + SETZM TTYIVP(I) +.SEE TPVE ; MOVEM B,TPVE(TT) +.SEE TPVE ; MOVEM B,TPVE+TPLEN(TT) + HRLM B,TPSP+TPLEN(TT) ;CLOBBER THE 2ND PC PPR TO NULL STATE. + MOVEM B,TPVP+TPLEN(TT) + MOVEM B,TPVB+TPLEN(TT) + CAMG B,TPVP(TT) + SETZM TPVP(TT) + HRRZS TPSP(TT) + POPJ P, + +;MAKE A TTY INTO AN ORDINARY PRINTING TTY. +;TTY # IN I; CLOBBERS TT,B,C. +NCNSSP: SETZM TCTYP(I) + MOVE TT,[%TOMVB+%TOOVR+%TOLWR,,%TPORS] + MOVE B,TTYTYP(I) + TRNN B,%TYSTY + IORI TT,%TPPCR + LDB B,[$TTOSP,,B] + CAIN B,2 + TLC TT,%TOALT+%TOMVB+%TOLWR ;10CPS => ASSUME TELETYPE. +IFN 0,[ ;THIS WOULD TURN THE MOTOR OF A CRTSTY DISPLAY ON AND OFF. + CAIN B,5 ;120CPS => ASSUME TERMINET. + JRST [ TRC TT,%TPPCR+5*%TPPLF + MOVEI C,%TNTRM + MOVEM C,TCTYP(I) + JRST .+1 ] +];IFN 0 + MOVEM TT,TTYOPT(I) + SETZM TTYSMT(I) ;NO GRAPHICS, NO LOCAL EDITING. + SETOM TTOALC(I) ;%TPCBS TURNED OFF + MOVEI TT,1 ;SCROLLS A LINE AT A TIME (THIS IS + MOVEM TT,TTYROL(I) ; MAINLY FOR THE BENEFIT OF TYIFLS) + HRRZ TT,I + IMULI TT,TPLEN*2 + MOVEM TT,TTYEPP(I) + MOVEI C,71. + CAIE B,2 ;10 CPS => TELETYPE + MOVEI C,79. ;ANYTHING ELSE IS AT LEAST 80 WIDE +IFN 0,[ + CAIN B,5 + MOVEI C,119. +] + MOVSI B,(MOVE) + PUSHJ P,NCNSSH + JRST NCNSSV + +;SET TTYEPP OF TTY # IN I, MAIN PC PPR # IN TT. CLOBBER H,TT. +;HAD BETTER ALWAYS BE CONO PI,CLKOFF HERE, OR SYSTEM MAY CRASH IN ECHOING CODE. +NCNSSG: MOVE H,TTYOPT(I) + TLNE H,%TOMVU ;NOT DISPLAY OR + TLNN H,%TOERS ;ARDS-LIKE (CAN'T ERASE) + JRST NCNSSF ; => CAN'T HAVE ECHO AREA. + MOVE H,TPLEN+TPVB(TT) + CAMGE H,TCMXV(I) ;NO ECHO LINES => CAN'T USE ECHO AREA. + ADDI TT,TPLEN ;ELSE USE IT. +NCNSSF: MOVEM TT,TTYEPP(I) + POPJ P, + +IFN N11TYS,[ +;RE-INIT THE PARAMETERS OF A T.V. WHEN IT BECOMES FREE. +NCNSST: HRRZ TT,I + IMULI TT,TPLEN*2 + MOVEI B,%TNTV + MOVEM B,TCTYP(I) + MOVE B,[%TOMVB+%TOMVU+%TOERS+%TOSAI+%TOLWR+%TOOVR+%TOFCI+%TOLID+%TOCID,,%TP11T+%TPRSC] + MOVEM B,TTYOPT(I) + MOVEI B,4 ;TV'S SCROLL BY 4 LINES PER GLITCH + MOVEM B,TTYROL(I) + MOVEI B,37. + MOVEI C,95. + PUSHJ P,NCNSSH + JRST NCNSSV +];N11TYS + +NCNSSC: XOR E,TTYCOM(I) ;DON'T CHANGE TTYCOM BITS EXCEPT THESE. + AND E,[%TCQRY+%TCRFS+%TCICO+%TCOCO,,] + XORM E,TTYCOM(I) + POPJ P, + +TYVSRO: JUMPL A,OPNL33 ;CAN'T BE NEGATIVE + ;CAME D,%TNTV ;CAN'T SET NON-ZERO ON TVS + CAML A,TCMXV(I);CAN'T BE BIGGER THAN SCREEN SIZE + JUMPN A,OPNL33 + TLNN H,%TOMVU ;ON PRINTING TTYS, TTYROL MUST BE 1 OR GET INTO + CAIN A,1 ; INFINITE RECURSION AT TYOLF3/TYOCLR/TYOCRL + CAIA + JRST OPNL33 + MOVEM A,TTYROL(I) + JRST TTYOJ1 + +;TTYVAR SYSTEM CALL - READ AND WRITE VARIOUS TTY VARIABLES + +;TABLES OF TTY VARIABLES. +;THE NEXT 3 TABLES ARE PARALLEL, IF YOU CHANGE ONE CHANGE THEM ALL. + +;TTY VARIABLE NAMES. MUST BE SORTED IN SIXBIT ORDER. + +TYVTAB: SIXBIT/HEIGHT/ + SIXBIT/IDLTIM/ + SIXBIT/ISPEED/ ;IN BITS PER SECOND + SIXBIT/OSPEED/ ;IN BITS PER SECOND + SIXBIT/SMARTS/ + SIXBIT/TCTYP/ + SIXBIT/TTYCOM/ + SIXBIT/TTYOPT/ + SIXBIT/TTYROL/ + SIXBIT/TTYSMT/ + SIXBIT/TTYTYP/ + SIXBIT/WIDTH/ +LTYVTA==:.-TYVTAB +TYVTL2==.RADIX 2,CONC [.LENGTH/]\.-TYVTAB-1,/ ;BASE 2 LOG-1 OF TABLE SIZE +REPEAT 1_-<.-TYVTAB-1>-1, -1 ;PAD OUT TO POWER OF 2 SIZE + +;INSTRUCTIONS TO GET VARIABLE INTO A + +TYVGET: MOVE A,TCMXV(I) + PUSHJ P,[MOVE A,TIME ? SUB A,TTITM(I) ? POPJ P,] + PUSHJ P,[LDB A,[$TTISP,,TTYTYP(I)] ? MOVE A,BAUDRT(A) ? POPJ P,] + PUSHJ P,[LDB A,[$TTOSP,,TTYTYP(I)] ? MOVE A,BAUDRT(A) ? POPJ P,] + MOVE A,TTYSMT(I) + MOVE A,TCTYP(I) + MOVE A,TTYCOM(I) + MOVE A,TTYOPT(I) + MOVE A,TTYROL(I) + MOVE A,TTYSMT(I) + MOVE A,TTYTYP(I) + PUSHJ P,[MOVE A,TCMXH(I) ? SOJA A,CPOPJ] + +;INSTRUCTIONS TO SET VARIABLE FROM A. OPNL33 IF VALUE BAD. OPNL26 IF CAN'T WRITE. +;OTHERWISE, IF GOES VIA .CALL CNSSET, MOVE A INTO APPROPRIATE AC (SEE COMMENT AT NCNSS0). +;FOR OTHER VARIABLES, JRST TO ROUTINE TO STORE A INTO VARIABLE. + +TYVSET: MOVE B,A ;HEIGHT + JRST [SUB A,TIME ? MOVNM A,TTITM(I) ? JRST TTYOJ1] ;IDLTIM + JRST TYSISP ;ISPEED + JRST TYSOSP ;OSPEED + JRST TYVSSM ;SMARTS + MOVE D,A ;TCTYP + MOVE E,A ;TTYCOM + MOVE H,A ;TTYOPT + JRST TYVSRO ;TTYROL + JRST TYVSSM ;TTYSMT + JRST OPNL26 ;TTYTYP + MOVE C,A ;WIDTH + +TYVSSM: MOVEM A,TTYSMT(I) + JRST TTYOJ1 + +;SET SPEED. MAYBE THIS SHOULD CHANGE IT IN HARDWARE ALSO? +TYSISP: SKIPA B,[$TTISP,,TTYTYP(I)] +TYSOSP: MOVE B,[$TTOSP,,TTYTYP(I)] + MOVEI C,17 ;FIND CODE + CAME A,BAUDRT(C) + SOJGE C,.-1 + JUMPL C,OPNL33 ;NON-EXISTENT + DPB C,B + JRST TTYOJ1 + +;TRANSLATION FROM INTERNAL SPEED CODES TO BAUDS +BAUDRT: 0 ? 600. ? 110. ? 150. + 300. ? 1200. ? 1800. ? 2400. + 4800. ? 9600. ? 25000. ? 40000. + 50000. ? 80000. ? -1 ? -2 + +;CODE FOR TTYVAR SYS CALL BEGINS HERE + +NTTYVA: HRRE E,A + JSP J,ATTYC9 ;I TTY NUMBER + SKIPA J,[1] + SETO J, ;J GETS -1 IF IT'S OUR CONSOLE, 1 IF OTHER TTY CHNL. + AOSGE E ;SKIP IF ARG WAS -1 (OWN CNSL) OR CHANNEL NUMBER + MOVEI J,0 ;J ZERO IF TTY SPECIFIED BY NUMBER. + PUSHJ P,VARCAL ;RETURN WITH SUITABLE STUFF IN E,D,W + JUMPE W,NTTYV1 + JUMPE J,OPNL26 ;ERR OUT IF WRITE LOCKED (SOMEONE ELSE'S TTY) + JUMPG J,NTTYV1 ;IF IT'S OUR CONSOLE, WAIT TILL WE OWN IT, OR INTERRUPT. + PUSHJ P,TTYWC2 +NTTYV1: TLNN E,-1 ;DEFAULT LH OF SIXBIT VARIABLE NAME TO 'TTY' + HRLI E,'TTY ;SO CALLER CAN USE IMMEDIATE ARGUMENT -- PRETTY RANDOM + MOVEI B,0 ;LOOK UP IN TABLE OF TTY VARIABLES (TYVTAB) + REPEAT TYVTL2,[CAML E,TYVTAB+1_(B) + ADDI B,1_ + ] + CAME E,[-1] + CAME E,TYVTAB(B) + JRST OPNL11 ;IILEGAL TTY VARIABLE NAME + CONO PI,TTYOFF + XCT TYVGET(B) ;GET VALUE OF VARIABLE INTO A + JUMPE W,TTYOJ1 ;RETURN IF READING + HRRI W,A + XCT W ;PUT NEW VALUE INTO A + MOVE W,TYVSET(B) ;GET INSTRUCTION TO PUT A IN PROPER PLACE + MOVE B,TCMXV(I) ;SET UP OLD VARIABLES FOR NCNSS0 + MOVE C,TCMXH(I) + SUBI C,1 + MOVE D,TCTYP(I) + MOVE E,TTYCOM(I) + MOVE H,TTYOPT(I) + XCT W ;CHANGE THE AC CONTAINING THE VARIABLE TO BE CHANGED + MOVEI W,6 ;TELL CNSSET TO CHANGE EVERYTHING + JRST NCNSS0 ;MAKE THE CHANGES, THEN TTYOJ1. + +;.CALL TTYFLS +; ARG 1 - +;WITH CONTROL BITS 0, MARKS LAST INTERRUPT CHARACTER ITYIC'ED +; TO BE IGNORED AT MAIN PROGRAM LEVEL. +;WITH CONTROL BIT 1, DISCARDS ALL INPUT THROUGH LAST CHARACTER ITYIC'ED. +NTTYFLS:JSP J,TTYNGT + MOVE A,CTLBTS(U) + TRNN A,1 + JRST NTTYF2 + CONO PI,TTYOFF +NTTYF1: MOVE C,TIOP(I) + CAMN C,TINTP(I) + JRST TTYOJ1 + PUSHJ P,TYIREM + JRST NTTYF1 + +NTTYF2: LDB A,TINTP(I) + TRO A,%TXIGN + DPB A,TINTP(I) + JRST POPJ1 + +NTTYESC: ;SIMULATES TYPING OF ^_ + JSP J,ATTYC2 ;DECODE TTY SPEC. IF OUR CONSOLE, WAIT TILL WE CAN INPUT. + CONO PI,TTYOFF + HRRZ A,TTYIPC(I) + CAIE A,TTYI + JRST OPNL7 ;DEVICE NOT READY + MOVEI A,TYCI + MOVEM A,TTYIPC(I) + JRST TTYOJ1 + +;WHOLINE SYSTEM CALL. +;TAKES A MANDATORY 1ST ARGUMENT SPECIFYING A TTY. +;RETURNS TWO VALUES - THE OLD SETTINGS OF WHMODE AND WHJOB +;FOR THAT TTY. +;OPTIONAL 2ND AND 3RD ARGUMENTS SET WHMODE AND WHJOB. IF THEY +;ARE PRESENT, THE RETURNED VALUES ARE THE OLD SETTINGS. +;THE CALL FAILS FOR TTY'S OTHER THAN TV'S. + +NWHOLI: JSP J,ATTYC ;DECODE THE TTY SPEC. + MOVE H,TTYOPT(I) +IFN N11TYS,TRNN H,%TP11T ;FAIL IF NOT PDP11 TV. + JRST OPNL34 +IFN N11TYS,[ + SKIPL TT11P ;TV PDP11 DOWN => DON'T USE IT. + JRST OPNL10 + CAIGE W,2 ;IF THERE ARE OPTIONAL ARGS, DECODE THEM. + JRST NWHOL2 + CAIE B,1 ;DECODE 3RD ARG ONLY IF RELEVANT. + JRST NWHOL2 + MOVE J,C ;IT SHOULD BE A JOB SPEC. + CAIGE W,3 + SETO J, ;USE -1 (SELF) AS THE DEFAULT. + JSP T,NCRUI2 + JFCL + JUMPL J,OPNL34 ;PDP6 IS NO GOOD. + MOVE C,J + IDIVI C,LUBLK ;CONVERT USER IDX TO JOB #. +NWHOL2: ADD I,TT11HD + ADD I,TT1111 + ADD I,TT1111 + LDB TT,[$11AD0,,1-NF11TY(I)] + ADDI TT,TT11LO ;TT HAS PDP10 ADDR OF TTY'S WHOLINE VARS. + CONO PI,TTYOFF + MOVE T,WHMODE(TT) ;FIRST, GET THE CURRENT SETTINGS. + LDB Q,[$11WD0,,WHJOB(TT)] + CAIGE W,2 + JRST NWHOL3 + DPB B,[$11WD0,,WHMODE(TT)] ;THEN, SET TO NEW VALUES IF REQUIRED. + DPB C,[$11WD0,,WHJOB(TT)] +NWHOL3: CONO PI,TTYON + MOVE A,T ;PUT RETURN VALUES IN APPRO. ACS + ASH A,-24 + MOVE B,Q + JRST POPJ1 +] + +;TVWHER SYSTEM CALL. +;TAKES 1 ARG SPECIFYING A TTY, WHICH MUST BE A TV TTY. +;RETURNS 2 VALUES. +;1ST VALUE: THE KEYBOARD NUMBER OF THE PHYSICAL TERMINAL IN USE. +;2ND VALUE: THE NUMBER OF THE DISPLAY BUFFER IN USE ON THIS TTY. + +NTVWHE: JSP J,ATTYCI + MOVE H,TTYOPT(I) +IFN N11TYS, TRNN H,%TP11T + JRST OPNL34 +IFN N11TYS,[ +NTVWH1: LDB A,[$11AD0,,TT11HA] + ADDI A,TT11LO(I) + LDB B,[$11BY3,,1-NF11TY(A)] + LDB A,[$11BY2,,1-NF11TY(A)] + JRST POPJ1 +] + +SUBTTL .ITYIC, .LISTEN, TTY WHYINT + +;.CALL ITYIC. 1 ARG, A TTY INPUT CHANNEL; 1 VALUE, THE INTERRUPT CHAR. +;FAILS IF THERE ARE NO INTERRUPT CHARACTERS. +NITYIC: JSP J,TTYNGT +AITYI1: SKIPG D,TINTC(I) + POPJ P, + MOVE A,TINTP(I) ;SAVE SOME INFO FOR DEBUGGING + MOVE J,TICC(I) + MOVE C,TIIP(I) ;GET THE END OF FILLED PART OF BUFFER +AITYI2: CAMN C,TINTP(I) ;IF OUR MOVING POINTER PASSES THERE, THERE ARE REALLY + BUG ;NO INT CHARS IN THE BUFFER. BUT TINTC NON-ZERO?? + MOVE B,TINTP(I) + CAMN B,TIBEP(I) ;WRAP AROUND AT END OF BUFFER + SUBI B,TIBL + HRRM B,TINTP(I) ;ADVANCE TINTP TO NEXT CHARACTER. + ILDB B,TINTP(I) + TRZN B,%TXINT ;KEEP LOOKING TILL FIND NEXT INT. CHAR. + JRST AITYI2 + DPB B,TINTP(I) + SOS TINTC(I) + HLRZ R,H ;GET IOCHNM BITS IN R. UNLESS %TIFUL IS SET, + MOVE A,B + AOS (P) + JRST TYINRM ;NORMALIZE PDP-11 12-BIT CHARACTERS TO 7-BIT. + +;.CALL WHYINT ON TTY INPUT CHANNEL IS SIMILAR TO ITYIC +TYIWHY: JSP J,TTYNG1 + PUSHJ P,AITYI1 + SOS (P) ;DON'T SKIP-RETURN IF NO INTERRUPT CHARS + MOVE B,A ;SECOND RESULT IS INTERRUPT CHARACTER + MOVEI A,%WYTYI ;FIRST RESULT IS DEVICE CODE + JRST POPJ1 + +AITYI: SETO A, ;.ITYI OBSOLETE. + TDZA H,H +AITYIC: UMOVE A,(J) ;.ITYIC + PUSH P,J ;TURN INTO NEW SYSTEM CALL ITYIC + MOVE B,[SIXBIT /ITYIC/] + MOVEM B,LSCALL(U) ;FOR JOB DEVICES' SAKE. + MOVEI W,1 + PUSHJ P,NITYIC + JRST POP1J + UMOVEM A,@(P) + JRST POP1J1 + +ALISTEN:SKIPGE I,TTYTBL(U) ;.LISTEN + JRST ALIS1 + PUSHJ P,TYOWC + SKIPA B,TICC(I) +ALIS1: SETZ B, + MOVE A,PIRQC(U) + TRNE A,%PIC.Z + JRST UDELAY + UMOVEM B,(J) + POPJ P, + +TTYFIN: JSP J,TTYNG1 ;HERE FOR .CALL FINISH ON TTY OUTPUT CHANNEL + PUSHJ P,TYOWC + JRST POPJ1 + +NLISTE: JSP J,TTYNGT ;HERE FOR .CALL LISTEN + PUSHJ P,TYOWC + MOVE A,TICC(I) + JRST POPJ1 + +TTYNGT: TRC A,-1 ;RH(A)=-1 => TREE'S CONSOLE + TRCN A,-1 + JRST TTYNG2 + MOVEI T,AIOCAL ;OTHERWISE MUST BE CHANNEL NUMBER + HRLI J,.+2 + JRST CHNDCD + TLNN R,%CLSTI ;CHNDCD RETURNS CLSTB BITS IN R, IOCHNM WD CONTENTS IN H + JRST OPNL34 +TTYNG1: HLRZ I,H + TRZ I,377700 + TRZE I,400000 ;SKIP IF DEVICE (RATHER THAN CONSOLE) +TTYNG2: SKIPL I,TTYTBL(U) + JRST (J) + JRST OPNL10 + +TYOWHY: MOVEI A,%WYTYO ;.CALL WHYINT ON TTY OUTPUT CHANNEL + MOVSI B,(SETZ) ;FOR NOW, JUST ASSUME REASON IS **MORE** + JRST POPJ1 + +SUBTTL TTY OPEN + +;LH TTY OPEN +;3.1 0 -> IN 1 -> OUT +;3.2 0 -> UNIT 1 -> BLOCK + +;OUTPUT +;3.3 => IMAGE MODE (SET ALL %TGIMG BITS IN TTYST1 AND TTYST2) +;3.4 0 -> NORMAL 1 -> ECHO MODE OUTPUT (SET %TJECH, %TJPP2, %TJMOR). +;3.5 0 -> NORMAL 1 -> DISPLAYMODE, LOOK FOR ^P (SET %TJDIS). +;3.6 0 -> NORMAL 1 -> SUPER-IMAGE OUTPUT (SET %TJSIO). + +;INPUT +;3.3 => IMAGE MODE (CLEAR ALL ECHO BITS IN TTYST1, TTYST2). +;3.4 => "DDT" (DON'T ECHO CR, LF, TAB) +;3.5 => CONVERT LOWER TO UPPER CASE +;3.6 => WANT 3 LINES IN ECHO AREA. + +;BITS 3.4 AND 3.6 ON INPUT, AND BIT 3.3, HAVE EFFECT +;ONLY ON THE FIRST OPEN IN EITHER DIRECTION. +;(THEY ARE OBSOLETED BY THE TTYSET SYSTEM CALL) + +;LH OF IOCHNM WD +;(SHOWS UP IN RH OF A ON .IOT, .CLOSE, ETC) + +%TICNS==400000 ;4.9 1-> CONSOLE 0 -> DEVICE. THIS BIT EXIST IN INPUT AND OUTPUT CHNLS. +%TJCNS==400000 ;4.9 1-> CONSOLE 0 -> DEVICE + +;OUTPUT: +%TJCP1==200000 ;^P-CODE ANTICIPATION STATE. +%TJCP2==100000 ; ". 0=>NORMAL, 1=> CHAR AFTER ^P, 2=> ^PH, 3=>^PV. +%TJECH==40000 ;SET => ECHO MODE OUTPUT.-MODE OUTPUT (ALL CHARS OUTPUT THE + ;WAY THEY WOULD BE ECHOED) +%TJCTN==20000 ;SET => DON'T DO LINE-CONTINUATION. +%TJSTP==10000 ;SET => THIS CHANNEL IS HUNG IN **MORE**. +%TJDIS==4000 ;SET => LOOK FOR ^P CODES. +%TJSIO==2000 ;SET => SUPERIMAGE OUTPUT, NO PADDING OR CURSOR CTL. +%TJMOR==1000 ;SET => DON'T DO **MORE** PROCESSING. +%TJPP2==400 ;SET => USE ALTERNATE PC PPR (THE ECHO AREA) +%TJINK==200 ;SET => NEXT CHAR ASSUMED TO BE 1-POSITION PRINTING. +%TJHDE==100 ;SET => ACCOUTING FOR CURSOR MOTION DUE TO + ;CHAR ECHOED ON A HALF-DUPLEX TTY. + +;INPUT +;3.3 => NO ECHO. +%TIECH==40000 ;CAN READ EVEN IF CHAR NEEDS PI ECHOING. +%TIPEK==20000 ;DON'T REMOVE CHAR FROM BUFFER. +%TIACT==4000 ;SET => DON'T WAIT FOR ACTIVATION CHARACTER. +%TIINT==2000 ;SET => CAN READ A CHAR EVEN IF IT IS SUPPOSED TO INTERRUPT & HASN'T YET. +%TINWT==1000 ;SET => IF NO INPUT AVAILABLE, DON'T WAIT, JUST RETURN -1. +%TIFUL==400 ;SET => GIVE FULL CHARACTER (SIGNIFICANT ON IMLAX, TVS) + +$TIIDX==220600 ;3.6-3.1 CONSOLE #, OR 77 FOR A "DISOWNED" CONSOLE TTY CHNL +;IE, ONE THAT CORRESPONDS TO NO REAL TTY. THEY EXIST ONLY IN +;TREES WITH NO TTY, IN JOBS THAT CAM FROM TREES WITH TTYS. +%TINON==77 ;"TTY #" FOR A CHANNEL WITH NO REAL TTY. + +;ENTRY FOR OPEN OF TTY AS DEVICE TYN OR TNM + + +IFN TTLPTP,[ +LPTO: MOVE J,TIME + SUB J,LPTTIME ;"LPT" INPUTS EVERY ONCE IN A WHILE IF IT IS UP + CAIL J,60. ;2 SECONDS + JRST OPNL7 + SKIPA I,LPTTTY +] +TTYO: PUSHJ P,TTYFD ;TEST FOR FILE NAME OF .FILE. (DIR) + CAIL I,NCT + JRST OPNL1 ;TTY NUM TOO LARGE +TTYO3C: +IFN NNVTTS,[ + .ERR Shouldn't this be using NFNVTY instead? + CAIGE I,NOTYS+NNTYS+NNVTTS + CAIGE I,NOTYS+NNTYS ;SKIP ON NOVA TTY + JRST TTYO3A + SKIPGE NOVATT + JRST OPNL10 ;NOVA LINK NOT ACTIVE +TTYO3A: CAMN I,NOVATT + JRST OPNL10 ;CANT OPEN TTY USED AS CNHL TO NOVA +] + MOVEI A,0 ;MARK AS A DEVICE + CONO PI,TTYOFF ;INTERLOCK WITH OTHER TTY OPENS, AND ^Z'S. + SKIPGE TT,TTYSTS(I) ;SKIP IF TTY OPEN + JRST TTYO3B ;OK IF TTY NOT OPEN + CAIE U,(TT) ;SAME USER THAT HAS IT? + JRST OPNL10 ;TTY ALREADY OPEN AS DEVICE BY SOMEONE ELSE. + TLNN TT,%TSCNS ;OPEN AS CONSOLE? + JRST TTYO8 ;NO, AS DEVICE + CONO PI,TTYON + JRST TTYO7 ;OPEN, THIS TIME AS CONSOLE. + +TTYO3B: SKIPGE TTYSTA(I) ;TTY IS FREE: IS IT IN TRANSITION TO OR FROM BEING IN USE? + JRST TTYO8 ;OK IF NOT; + MOVE T,I ;STYOCF TAKES TTY # IN T. + PUSHJ P,STYOCF ;AND WAIT TILL TTY IS NO LONGER IN TRANSITION + PUSHJ P,UFLS + JRST TTYO3C ;THEN TRY AGAIN TO OPEN IT. + +;TTY IS AVAIL. TO OPEN AS A DEVICE. +TTYO8: SKIPN TTNTO(I) ;IF TTY USED TO BE FREE, INIT. IT. + PUSHJ P,TTYINI + MOVSI TT,%TSFRE + ANDCAM TT,TTYSTS(I) + JRST TTYO3 + +TTYFD: PUSHJ P,FLDRCK ;SKIP IF FILE DIR BEING OPENED + JRST TTYFD1 ;FILE NAMES NOT SPECIAL + SUB P,[1,,1] + MOVEI J,6 + JRST LISTF7 ;GO GET DIRCTORY + +TTYFD1: JUMPE W,CPOPJ ;0 IS THE ONLY DEFINED MODE FOR ANY TTY OPEN + SUB P,[1,,1] + JRST OPNL12 + +FLDRCK: CAMN A,[SIXBIT /.FILE./] + CAME B,[SIXBIT /(DIR)/] + POPJ P, + JRST POPJ1 + +;INIT A TTY WHEN IT CEASES TO BE FREE. (ZFLAG7 FOR TTY, TTYO8 FOR TNM) +;CHNL 3 (TTYCHN) MUST BE OFF OR IN PROGRESS. +TTYINI: SETZM TTYST1(I) + SETZM TTYST2(I) + MOVSI J,%TACFM ;TTY NEEDS A CONSOLE FREE MESSAGE. + ANDCAM J,TTYSTA(I) + MOVE J,TTYTYP(I) + TRNN J,%TYSTY ;EXCEPT ON STY TTYS, + PUSHJ P,TTYIN1 ;INIT THE USER OPTIONS IN TTYOPT, TTYCOM. + MOVE J,TTYOPT(I) + HRLOI H,%TSFRE ;INITIALIZE TTYSTS FROM TTYOPT + TLNE J,%TOROL + TLO H,%TSROL + TLNN J,%TOMOR ;NOTE %TOMOR SAYS DO **MORE** PROC, + TLO H,%TSMOR ;%TSMOR SAYS INHIBIT **MORE** PROC. + TLNE J,%TOSA1 + TLO H,%TSSAI + MOVEM H,TTYSTS(I) + HRRZ TT,I + IMULI TT,TPLEN*2 + SETZM TPFLAG(TT) + SETZM TPFLAG+TPLEN(TT) + SETZ H, ;START OUT WITH NO ECHO LINES. + JRST ASCML1 + +;INIT A FEW BITS IN TTYOPT, TTYCOM THAT ARE CONSIDERED USER OPTIONS. +;NORMALLY DONE WHENEVER A TTY BECOMES IN USE, BUT ON STY TTY'S +;DONE ONLY WHEN THE STY IS INITIALIZED (SO STY-USER CAN SET THESE OPTIONS). +TTYIN1: MOVE J,TTYCOM(I) + TLZ J,%TCRFS+%TCQRY+%TCOCO+%TCICO + MOVEM J,TTYCOM(I) + MOVE J,TTYOPT(I) ;INIT SOME TTYOPT BITS. + TLZ J,%TOUSR + TRZ J,%TPUSR + TLO J,%TOMOR ;DO **MORE** + HLLM J,TTYOPT(I) + POPJ P, + +;TELETYPE OPEN ROUTINES + +;ENTRY FOR OPEN OF "TTY" AS A CONSOLE + +TTYO1: PUSHJ P,TTYFD ;TEST FOR FILE NAME OF .FILE. (DIR) +TTYO7: MOVE I,TTYTBL(U) + JUMPGE I,TTYO2 ;JUMP IF HAS TTY NOW + TLNE I,%TBWAT + JRST TTYO2A + TLNN I,%TBNVR ;IF I SHOULD FAIL IF TRY TO OPEN TTY WHEN DON'T HAVE IT, + TLNN I,%TBDTY ;OR IF I HAVE DONE A .ATTY, + JRST OPNL10 ;THE OPEN SHOULD FAIL. +TTYO2A: PCLT + SKIPGE TTYTBL(U) + PUSHJ P,UFLS ;HANG UNTIL HAS TTY + MOVE I,TTYTBL(U) +TTYO2: HRRZS I ;TTY NUMBER + CAIL I,NCT + JRST 4,OPNL1 ;TTY NUM TOO LARGE + MOVSI A,%TICNS ;SAY TTY CHNL WILL BE OPEN AS CONSOLE. + CONO PI,TTYOFF +TTYO3: HRLZI J,(D) ;SET IOCHNM BITS (IN A) FROM OPEN MODE. + LSH J,1 + TLZ J,700077 ;BUT DON'T USE PARTS OF OPEN WD USED FOR OTHER THINGS. + IOR A,J +IFN TTLPTP,[ + CAMN I,LPTTTY ;SKIP IF OT TTY + HRRZM U,LPTUSR +] + DPB I,[$TIIDX,,A] ;LH OF A WILL BE STORED IN LH OF IOCHNM WORD + HRRZ TT,UUAC(U) ;TT HAS CHNL # BEING OPENED. + JUMPGE D,TTYO4 ;J IF INPUT OPEN. + TRNE D,20 + TLO A,%TJSIO ;SUPER IMAGE OUT. + TRNE D,4 + TLO A,%TJECH+%TJPP2+%TJMOR ;ECHO OUTPUT + TRNE D,10 + TLO A,%TJDIS ;DISPLAY OUTPUT MODE. + MOVE J,TYOMSK(I) + IOR J,CHNBIT(TT) ;UPDATE CHANNELS-OPEN MASK + EXCH J,TYOMSK(I) ;FOR THE NEW OUTPUT CHANNEL. + JUMPN J,TTYO5 ;FOR 1ST OUTPUT OPEN, INIT TTYST1,2. + MOVE J,[101010,,101010] + IORM J,TTYST1(I) + IORM J,TTYST2(I) ;SET ALL THE OUTPUT-IN-IMAGE-MODE BITS. + TRNN D,2 + ANDCAM J,TTYST1(I) ;IF NOT IMAGE, CLEAR THEM. + TRNN D,2 + ANDCAM J,TTYST2(I) + JRST TTYO5 + +TTYO4: MOVE J,TYIMSK(I) + IOR J,CHNBIT(TT) ;UPDATE INPUT-CHNLS-OPEN MASK + EXCH J,TYIMSK(I) ;FOR NEWLY OPENED INPUT CHANNEL. + JUMPN J,TTYO5 ;THE 1ST INPUT CHNL OPEN, INIT ECHO BITS... + MOVEI H,0 ;INPUT + TRNE D,20 + MOVEI H,3 ;# COMMAND LINES + PUSHJ P,ASCML1 + MOVE J,TTYST1(I) + AND J,[101010,,101010] ;SAVE IMAGE MODE OUTPUT BITS + TRNN D,2 ;SKIP ON IMAGE MODE INPUT + IOR J,[202020,,202020] ;ASCII MODE INPUT + IOR J,[030303,,030303] ;ENABLE INTERRUPT AND ACTIVATE ON ANY CHARACTER + MOVEM J,TTYST1(I) ;STORE BACK + MOVE J,TTYST2(I) + AND J,[101010,,101010] ;SAVE IMAGE MODE OUTPUT BITS + TRNN D,2 ;SKIP ON IMAGE MODE INPUT + IOR J,[202020,,200020] ;SAY ALL CHARS EXCEPT RUBOUT SHOULD ECHO. + TRNE D,4 ;SKIP ON NOT DDT MODE + ANDCM J,[006000,,606000] ;DDT MODE + IOR J,[030303,,030303] ;ENABLE INTERRUPT AND ACTIVATE ON ANY CHARACTER + MOVEM J,TTYST2(I) ;STORE BACK +TTYO5: HRRM U,TTYSTS(I) + AOS TTNTO(I) ;INCREMENT NUMBER OF CHNLS THIS TTY OPEN ON. + CONO PI,TTYON + MOVSS C + JSP Q,OPSLC3 ;SET UP IO CHNM WORD AND RETURN + TYIDN,,TYODN + TYIBN,,TYOBN + +SUBTTL WAITING FOR ACCESS TO TTY + +;HERE WHEN WANT TO DO TTY INPUT, TO CHECK FOR PERMISSION. +TTYWI: HLRZ I,(R) + ANDI I,%TICNS+(.BM $TIIDX) + TRZN I,%TICNS ;CLEAR AND CHECK CONSOLE/DEVICE BIT + POPJ P, ;RETURN RIGHT AWAY IF DEVICE +;CALL FROM ATTYCR. +TTYWI2: MOVE T,TTYTBL(U) + TLNN T,%TBNOT ;RETURN RIGHT AWAY IF WE OWN THE TTY. + POPJ P, + TLNE T,%TBIIN ;ELSE INTERRUPT IF %TBIIN IS SET. + JRST TTYLOS +TTYWC3: TLC T,%TBINT ;ELSE INTERRUPT IF %TBINT IS SET AND NOT %TBWAT. + TLNN T,%TBINT+%TBWAT + JRST TTYLOS + PCLT + SKIPGE TTYTBL(U) + PUSHJ P,UFLS ;WAIT TILL HAS TTY (CANT HAVE TTY IF DISOWNED) + POPJ P, + +;CALL FROM ATTYC, ATTYC2. WAIT TILL WE OWN THE TTY. +TTYWC2: MOVE T,TTYTBL(U) + TLNN T,%TBNOT ;RETURN RIGHT AWAY IF WE OWN THE TTY. + POPJ P, + JRST TTYWC3 + +;HERE WHEN WANT TO DO A TTY RESET. +;SKIP IF THE RESET SHOULD REALLY BE DONE. +TTYWR: HLRZ I,(R) + ANDI I,%TICNS+(.BM $TIIDX) + TRZN I,%TICNS ;CLEAR AND CHECK CONSOLE/DEVICE BIT + JRST POPJ1 ;RETURN YES IF DEVICE + MOVE T,TTYTBL(U) + TLNN T,%TBNOT ;RETURN YES IF WE OWN THE TTY. + JRST POPJ1 + POPJ P, ;OTHERWISE IGNORE THE RESET. + +;HERE TO WAIT FOR OUTPUT PERMISSION FOR TTY +;RETURN WITHOUT SKIP IF THE OUTPUT SHOULD BE THROWN AWAY +;AND REPORTED TO THE USER AS DONE. +TTYWO: HLRZ I,(R) + ANDI I,%TICNS+(.BM $TIIDX) + TRZN I,%TICNS + JRST POPJ1 ;ALWAYS HAVE PERMISSION IF TTY IS A DEVICE. +;CALL FROM ATTYC, ETC. +TTYWO2: MOVE A,U + HRRZ T,I + CAIN T,%TINON ;NEVER HAVE PERMISSION FOR CONSOLE IF WE'RE DISOWNED. + JRST TTYWO1 + MOVE T,TTYTBL(U) ;WE HAVE OUTPUT PERMISSION IFF ALL OUR SUPERIORS + ;HAVE PERMISSION AND WE HAVE %TBOUT + ;AND THE TREE HAS A TTY. +;THE NEXT INSN IS TEMPORARY, UNTIL DDT ETC. ARE CHANGED TO WIN FULLY. +TTYWO3: JUMPGE T,TTYWO4 ;IF WE HAVE THE TTY, WE CAN TYPE ON IT. + SKIPGE SUPPRO(A) ;ALL OK TO TOP OF TREE => SEE IF TREE HAS A TTY. + JRST TTYWO4 + TLNN T,%TBOUT ;NOT AT TREE TOP => DOES THIS JOB HAVE PERMISSION + JRST TTYWO1 ;FROM ITS SUPERIOR? + MOVE A,SUPPRO(A) ;AND IS THE SUPERIOR ALLOWING ANY INFERIORS PERMISSION? + MOVE T,TTYTBL(A) + TLNE T,%TBINF ;SUPERIOR SAYS WE'RE OK => SEE IF SUPERIOR HAS PERMISSION. + JRST TTYWO3 +TTYWO1: MOVE T,TTYTBL(U) ;HERE IF WE DON'T HAVE PERMISSION. + TLNE T,%TBOIG ;IF OUTPUT IS TO BE IGNORED, + POPJ P, ;TELL OUR CALLER TO THROW IT AWAY, RIGHT NOW. + TLNE T,%TBWAT+%TBOUT + JRST TTYWO6 + TLNE T,%TBINT + JRST TTYLOS + TLNE T,%TBNVR+%TBDTY + JUMPL I,[ SUB P,[1,,1] ? JRST OPNL10 ] +TTYWO6: MOVE T,TTYTBL(A) ;ELSE MUST WAIT. WAIT FOR A CHANGE IN THE + CAMN T,TTYTBL(A) ;TTYTBL OF THE SUPERIOR DENYING US PERMISSION. + PUSHJ P,UFLS + JRST TTYWO ;NOW RE-CHECK EVERYTHING. + +;WE HAVE PERMISSION, BUT MAYBE WAIT ANYWAY TO AVOID MIXING JOBS' OUTPUT. +TTYWO4: SKIPGE TTYTBL(U) ;NO NEED TO WAIT IF WE OWN THE TTY + CAMN U,TTYLJB(I) ;OR WE WERE LAST JOB TO USE IT. + JRST TTYWO5 + MOVEI T,TOBS ;ELSE WAIT FOR BUFFER TO BE EMPTY + CAMN T,TORM(I) + JRST TTYWO5 + CAME T,TORM(I) + PUSHJ P,UFLS + JRST TTYWO ;RECHECK EVERYTHING, SINCE WE MAY HAVE LOST PERMISSION. + +;WE ARE ALLOWED TO OUTPUT RIGHT AWAY. +TTYWO5: MOVEM U,TTYLJB(I) ;MAKE SURE WE DON'T HAVE TO WAIT AGAIN. + JRST POPJ1 + +;TURN TTY OFF, THEN WAIT UNTIL EITHER TTY ISN'T IN COM MODE OR +;ONE OF THE BITS IN T IS SET IN TTYCOM(I). +TTYCMW: CONO PI,TTYOFF + TDNN T,TTYCOM(I) + SKIPL TTYCOM(I) + POPJ P, + SKIPN USER + POPJ P, ;SYS JOB TRYING TO HACK + HRR T,I ;WAIT UNTIL NOT COM MODE OR IN COM MODE BUT ONE OR MORE BITS IN LH OF T + PUSHJ P,LWAIT1 ;COME ON. WAIT UNTIL OUT OF COM MODE WITH UTCOFF + PUSHJ P,TTYSCM + POPJ P, + +TTYSCM: SKIPL TTYCOM(T) + JRST POPJ1 ;NOT COM MODE + PUSH P,A + HLLZ A,TTYCOM(T) + TDNE A,T + AOS -1(P) ;MASKED BIT(S) ON + POP P,A + POPJ P, + + +;ECHOIN SYSTEM CALL. ASK FOR ECHOING OF CERTAIN CHARACTERS +;UNTIL A BREAK CONDITION OCCURS. +;A BREAK CONDITION IS WHEN EITHER A NON-ECHOED CHARACTER IS TYPED IN +;OR A CERTAIN NUMBER OF CHARACTERS HAVE BEEN TYPED IN. +;CHARACTERS ECHOED BY THE ECHOIN ARE STORED INTO THE USER'S +;MEMORY BY THE INTERRUPT LEVEL. IF THE NECESSARY AREAS OF MEMORY +;ARE SWAPPED OUT, THAT CONSTITUTES A BREAK CONDITION. + +;THE BREAK TABLE IS 128 BITS (DIVIDED INTO 4 WORDS THE LOW 4 BITS OF EACH UNUSED) +;ONE BIT FOR EACH ASCII CHARACTER. A 1 INDICATES A CHARACTER THAT +;IS A BREAK CONDITION. A 0 INDICATES A CHARACTER THAT CAN BE ECHOED. +;A CHARACTER WITH THE CONTROL OR META BIT IS ALWAYS A BREAK. + +;ARG 1 TTY INPUT CHANNEL +;ARG 2 B.P. TO WHERE IN USER'S MEMORY TO STORE CHARACTERS. +;ARG 3 NUMBER OF CHARACTERS TO ALLOW +;ARG 4 ADDRESS OF BREAK TABLE. +;ARG 5 ADDRESS OF BLOCK OF COUNTERS TO BE INCREMENTED OR DECREMENTED FOR EACH CHARACTER. +; IF THE ADDRESS IS ZERO, ALL THIS IS OMITTED. +; THE BLOCK HAS SEVEN WORDS. +; THE FIRST TWO WORDS ARE LEFT ALONE. +; THE NEXT FOUR ARE INCREMENTED. +; THE SEVENTH IS DECREMENTED. + +;THE WORDS OF THE BREAK TABLE RESIDE IN ACS Q, J, R AND W. +;SIMILARLY, THE ADDRESS OF THE COUNT RESIDES IN AC C, +;THE ADDRESS OF THE BYTE POINTER IN B, +;AND THE ADDRESS OF THE BLOCK OF COUNTERS IN E. +;THEY ARE LOOKED AT BY THE INTERRUPT LEVEL, +;WHICH KNOWS THAT THE PROGRAM IS EXECUTING AN ECHOIN +;BY THE FACT THAT THE PC IS NECHO1. IT IS IMPORTANT THAT WE +;NOT LOCK ANY SWITCHES SO THAT SWAPPING OUT A PAGE WON'T PCLSR +;US UNTIL WE ARE AWAKENED BY THE INTERRUPT LEVEL WHEN IT SEES +;THAT THE PAGES IT NEEDS ARE NOT IN CORE. + +NECHOIN: + JSP J,ATTYCR ;DECODE CHANNEL. GET TTY NUMBER IN I. + XCTR XRW,[MOVES A,(C)] ;MAKE SURE COUNT IS IN CORE AND WRITABLE. + JUMPLE A,POPJ1 ;IF WANT ZERO OR FEWER CHARACTERS, RETURN IMMEDIATELY. + XCTR XRW,[MOVES A,(B)] ;MAKE SURE BYTE POINTER IS IN CORE AND WRITABLE. + IBP A ;MAKE SURE BYTE BUFFER IS IN CORE AND WRITABLE. + XCTR XRW,[MOVES (A)] ; (NO LOSSAGE IF IT ISN'T, BUT MIGHT AS WELL SWAP IT IN NOW.) + XCTR XRW,[MOVES (E)] ;MAKE SURE BLOCK OF COUNTERS IS IN CORE AND WRITABLE. + XCTR XRW,[MOVES 6(E)] + UMOVE Q,(D) ;LOAD BREAK TABLE WORDS INTO Q, J, R, W. + UMOVE J,1(D) + UMOVE R,2(D) + UMOVE W,3(D) + SKIPE TICC(I) ;IF TYPE-AHEAD AVAILABLE, WE CAN'T DO ANYTHING. + JRST POPJ1 + SKIPG TACC(I) ;WAIT FOR AN ACTIVATION (PROBABLY NON-ECHOED) CHARACTER. + PUSHJ P,TYIFL2 ;CALL TYIFL2 INSTEAD OF UFLS TO PREVENT IMPENDING **MORE**. +NECHO1: JRST POPJ1 ;THE JOB IS INSIDE AN ECHOIN IF ITS PC IS HERE. + +SUBTTL TTY INPUT IOT + +;BLOCK MODE INPUT IOT. +TTYBI: JSP E,INBTCH + +;UNIT MODE INPUT IOT. +;R HAS THE ADDRESS OF THE IOCHNM WORD. +;VALUE RETURNED IN W. +TYI: PUSHJ P,TTYWI ;WAIT FOR THE TTY IF ITS A CONSOLE. TTY NUMBER IN I + HLRZ R,(R) ;GET IOCHNM WORD FLAGS, MODIFIED BY CTL BITS + XOR R,CTLBTS(U) ;R HAS CHANNEL FLAGS + PUSH P,E + PUSHJ P,TYI0 ;GET THE CHAR IN D. + POP P,E + JUMPL D,UNIEOF ;TYI0 RETURN -1 => DON'T FLUSH THE SIGN BIT, AND TERMINATE BLOCK IOT. + ANDI D,%TXPIE+%TXMPE+%TXECI+%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC + CAIN A,^C + AOS (P) ;EOF, SKIP RETURN + MOVE W,D + POPJ P, + +;ASSUMING I HAS TTY NUMBER AND R HAS IOCHNM BITS. +;READ A CHARACTER FROM THE TERMINAL AND RETURN IT IN D. +TYI0: MOVE D,TTYTYP(I) + TRNN D,%TYSTY ;SKIP IF TTY IS ALTER EGO OF STY. + JRST TYI1B1 + MOVSI D,%SSINT + TDNE D,STYSTS-NFSTTY(I) + JRST TYI1B1 ;HAVE ALREADY GIVEN INT + SKIPE TICC(I) + JRST TYI1B1 + IORB D,STYSTS-NFSTTY(I) + MOVE TT,STYOMS-NFSTTY(I) ;CHANNELS OPEN FOR OUTPUT ON + AND TT,MSKST2(D) + MOVN B,TT + AND TT,B + IORM TT,IFPIR(D) ;GIVE INT ON LOWEST-NUMBERED CHANNEL. + JRST TYI1B1 + +TYI1B1: TRNE R,%TIACT + JRST TYI1B ;GOBBLE NEXT CHR REGARDLESS OF ACTIVATION + MOVE TT,TTYSTS(I) + TLNE TT,%TSACT + JRST TYI1B + PCLT + SKIPG TACC(I) + PUSHJ P,TYIFLS +TYI1B: PCLT ;WAIT TILL THERE'S A CHAR TO READ. + SKIPG TICC(I) + PUSHJ P,TYIFLS + CONO PI,CLKOFF ;PREVENT ECHOING WHILE WE'RE MESSING WITH POINTERS. + MOVE B,TIOP(I) + MOVE T,B + CAMN B,TIBEP(I) + SUBI B,TIBL + ILDB D,B + SKIPN TT,TICC(I) ;CHECK FOR CHAR FLUSHED BY ECHO BEFORE WE TURNED OFF CLOCK. + JRST TYI1A + TRNN D,%TXIGN + JRST TYI1 + TRNN R,%TIECH + TRNN D,%TXPIE + JRST [ PUSHJ P,TYIREM + JRST TYI1A ] + PCLT + CAMN T,TIOP(I) ;WAIT FOR ECHOING TO FLUSH THIS CHAR FROM BUFFER, + PUSHJ P,UFLS +TYI1A: CONO PI,CLKON ;ALLOW ECHOING. + JRST TYI1B1 ;THEN TRY AGAIN TO READ CHAR. + +TYI1: CONO PI,CLKON ;ALLOW ECHOING. + MOVE T,TTYSTS(I) + TLNN T,%TSNOE ;ECHOING BEING DEFERRED OR + TRNE R,%TIECH ;THIS CHANNEL NEEDN'T WAIT FOR ECHO + ANDCMI D,%TXPIE ;=> DON'T. + SKIPE PICLR(U) ;AT INT LVL IN USER PRGM OR + TRNE R,%TIINT ;THIS CHNL NEEDN'T WAIT FOR CHAR TO INTERRUPT + ANDCMI D,%TXINT ;=> DON'T WAIT FOR THAT. + MOVEI T,(D) + ANDI T,%TXINT+%TXPIE ;WAIT FOR THESE BITS TO CLEAR. + TRNE T,%TXINT ;IF ABOUT TO WAIT FOR %TXINT TO CLEAR, + PUSHJ P,TYIIWT ;TAKE CARE OF SEVERAL POSSIBLE SCREWS - MAY SET T. + LDB D,[360600,,B] + LSH T,(D) + PCLT + TDNE T,@B + PUSHJ P,UFLS ;HANG UNTIL PI ECHO BIT FOR THIS CHAR IS TURNED OFF + LDB D,B ;GET CHARACTER + TRNN R,%TIECH ;IF WE AREN'T SUPPRESSING ECHOING, + TRNN D,%TXMPE ;AND M.P. ECHOING NEEDED BUT NOT YET DONE, + JRST TYI2 + MOVE T,TTYSTS(I) + TLNE T,%TSNOE + JRST TYI2 + JRST TYIMP1 ;GO DO IT. + +TYIMP1: PUSH P,R ;DO MAIN-PRGM ECHO IF NECESSARY. + PUSH P,C + PUSHJ P,[MOVEI J,1(P) + ADD P,[3,,3] + HRRZM P,(P) + MOVE TT,TTYEPP(I) + PUSHJ P,NULSET ;NO LOSSET OF IOCHNM + JSP E,TYOSE1 + MOVEI R,%TJECH+%TJMOR + MOVE A,D + ANDI A,%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC + JRST TYO6] + POP P,C + POP P,R + CONO PI,TTYOFF + MOVE B,TIOP(I) + CAMN B,TIBEP(I) + SUBI B,TIBL + ILDB D,B + TRZ D,%TXMPE ;M.P. ECHOING NO LONGER PENDING FOR THIS CHAR. + DPB D,B + CONO PI,TTYON +TYI2: TRNN R,%TIPEK ;DON'T REMOVE IF CHNL SAYS DON'T. + PUSHJ P,TYIREM ;FINALLY REMOVE CHAR FROM BUFFER. + MOVE TT,TTYCOM(I) + TLNE TT,%TCLED ;DOES THIS JOB WANT TO SEE LOCAL EDITING PROTOCOL + JRST TYI2Z ;REPLIES, ETC.? + MOVE TT,D + ANDI TT,%TXTOP+%TXASC ;NO. DISCARD THEM. + CAIE TT,%TXTOP+"S ;TOP-S AND TOP-E ARE SPECIAL COMMANDS SENT + CAIN TT,%TXTOP+"E ;BY LOCAL EDITING TTYS. + JRST [SKIPG TICC(I) ;IGNORE THE TOP-E OR TOP-S, + PUSHJ P,UFLS ;AND THE CHARACTER AFTER IT AS WELL. + PUSHJ P,TYIREM + JRST TYI1B1] + CAIN TT,%TXTOP+"T ;TOP-T MEANS "LABEL FAILURE" IN LINE SAVING PROTOCOL. + JRST [ MOVEI T,3 ;IGNORE COMMAND AND THREE ARGS. + CAMLE T,TICC(I) + PUSHJ P,UFLS + PUSHJ P,TYIREM + PUSHJ P,TYIREM + PUSHJ P,TYIREM + JRST TYI1B1] +TYI2Z: MOVE T,TTYSTS(I) + TLNE T,%TSCNS + SKIPGE SUPPRO(U) + JRST TYI3 ;DEFERRED CALL IGNORED IF TOP-LEVEL, OR NOT A CONSOLE + CAIN TT,%TXTOP+"Z + JRST [ TRNE R,%TIPEK ;DEFERRED CALL + PUSHJ P,TYIREM ;REMOVE IT IF DIDN'T ALREADY + MOVSI T,(%PIDCL) + JRST UUOER1 ] +TYI3: MOVSI TT,%TSACT + ANDCAM TT,TTYSTS(I) +;TYIFLS CAN COME HERE AFTER THROWING AWAY 1 WORD FROM STACK, FOR NO CHARS AVAIL WITH %TINWT. +TYI4: MOVSI TT,%SSINT ;IF TTY IS STY'S, MAKE SURE NEXT TTY IOT GIVES STY OUTPUT INT. + MOVE B,TTYTYP(I) + TRNE B,%TYSTY + ANDCAM TT,STYSTS-NFSTTY(I) + SKIPGE A,D ;CHAR IN A FOR TYINRM + POPJ P, ;DON'T CANONICALIZE A -1 (NO CHARS AVAILABLE) TO A RUBOUT! + PUSHJ P,TYINRM ;CANONICALIZE TO ASCII UNLESS %TIFUL IS SET. + ANDI D,%TXPIE\%TXMPE\%TXECI ;BUT PRESERVE THE EXTRA INFO BITS + IOR D,A ;WHICH ARE NOT REALLY PART OF THE CHARACTER. + ANDI A,%TXASC + POPJ P, + +;ASSUME R HAS IOCHNM BITS (OR AT LEAST THE %TIFUL BIT). +;TURN CHAR. IN A TO 7-BIT ASCII CHAR IF %TIFUL IS OFF. +TYINRM: ANDI A,%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC + TRNE R,%TIFUL + POPJ P, + MOVE TT,A ;LEAVE THE HELP CHARACTER ALONE + ANDI TT,%TXTOP+%TXASC ;(THIS USED TO FLUSH THE SUPER ("SHIFT") BIT + CAIN TT,%TXTOP+"H ; PERHAPS IT SHOULD FLUSH ALL OF CTL/MTA/SUP?) + POPJ P, +TYINR2: ANDI A,%TXCTL+%TXASC ;FLUSH THE EXTRA BITS. + TRZE A,%TXCTL ;DON'T WANT FULL CHAR SET: TURN CTL+X INTO ASCII CTL-X + CAIN A,177 ;BUT LEAVE CTL-RUBOUT AS RUBOUT, FOR TECO'S SAKE. + POPJ P, + CAIGE A,77 ;CTL-? => RUBOUT + JRST [ CAIN A,40 ;CTL-SPACE => CTL-@ + MOVEI A,^@ ;41-76 STAY THE SAME + POPJ P, ] ;LETTERS TURN INTO ASCII CONTROLS + CAIL A,140 ;TO CONTROLIFY, FIRST TURN LOWER CASE TO UPPER, + SUBI A,40 + XORI A,100 ;THEN TOGGLE 100 BIT, TURNING A INTO ^A AND ? INTO RUBOUT. + POPJ P, + +;REMOVE THE FIRST CHAR. FROM THE INPUT BUFFER, AND RETURN IT IN D. +;UPDATES ALL COUNTS AND POINTERS. HALTS IF BUFFER EMPTY. +;CLOBBERS B,TT. +TYIREM: CONO PI,TTYOFF + PUSHJ P,TYIRE1 + JRST TTYONJ + +TYIRE1: SOSGE TICC(I) ;ENTRY WHEN TTYCHN IS OFF. + BUG PAUSE,[TTY: BUFFER EMPTY AT TYIREM] + MOVE B,TIOP(I) ;SAVE COPY OF BUFFER-EMPTYING POINTER IN TT. + MOVE TT,B + CAMN B,TIBEP(I) ;ADVANCE THE POINTER, FETCHING THE CHARACTER. + SUBI B,TIBL + ILDB D,B + MOVEM B,TIOP(I) + TRNE D,%TXACT ;IF CHAR SAYS IT WAS AN ACTIVATION CHAR, UPDATE # OF ACTIVATION + SOS TACC(I) ;CHARS STILL INB THE BUFFER. + TRNE D,%TXPIE ;IF IT NEEDED PI ECHO, + SOS ECHOC(I) ;ONE FEWER CHAR AWAITS PI ECHO. + TRNE D,%TXINT + SOS TINTC(I) ;SIMILAR FOR INT. TO PROGM. + SKIPL TINTC(I) + SKIPGE ECHOC(I) + BUG PAUSE,[TTY: TINTC OR ECHOC OVER-DECREMENTED] + CAMN TT,ECHOP(I) ;IF ECHOP POINTED AT THIS CHAR, + MOVEM B,ECHOP(I) ;ADVANCE IT. + CAMN TT,TINTP(I) ;SIMILAR FOR TINTP + MOVEM B,TINTP(I) + POPJ P, + +;COME HERE WHEN ABOUT TO WAIT FOR A CHAR'S %TXINT TO CLEAR OUT. +;CLOBBERS D, TT; MAY ZERO %TXINT IN T, IN WHICH CASE CALLER SHOULD +;NOT BOTHER TO WAIT FOR %TXINT TO CLEAR. +TYIIWT: MOVE D,MSKST2(U) + AND D,TYIMSK(I) ;D GETS ENABLED TTY INPUT CHANNELS. + MOVE TT,D + ANDCM TT,IDF2(U) ;TT GETS ENABLED, UNDEFERRED TTY INPUT CHANNELS. + TDNE TT,IFPIR(U) ;IF AN INTERRUPT IS PENDING ON ONE OF THEM, %TXINT + POPJ P, ;WILL CLEAR IF WE LET THE INT. HAPPEN. + MOVN TT,D ;ELSE GET LOWEST NUMBERED ENABLED INPUT CHANNEL'S BIT + AND D,TT + AND D,IDF2(U) ;IF THAT CHANNEL ISN'T DEFFERED, + IORM D,IFPIR(U) ;REQUEST AN INTERRUPT ON IT, AND WE CAN STILL WIN. + JUMPN D,CPOPJ + ANDCMI T,%TXINT ;CAN'T RQ AN INT, SO BIT WON'T BE CLEARED, IT IS CERTAIN, + POPJ P, ;SO GIVE UP ON WAIITING FOR IT TO CLEAR. + +;COME HERE TO HANG UP FOR INPUT. LIKE UFLS BUT PREVENTS +;A **MORE** THIS TIME AROUND THE SCREEN, ON GROUNDS THAT USER +;HAS COMMANDED THE OUTPUT FOR 1 MORE PAGE AT LEAST. +;IF %TINWT IS SET, INSTEAD OF HANGING, THROW AWAY RETURN ADDRESS +;AND JUMP TO TYI4, TO RETURN -1 FROM THE IOT. +;CLOBBERS A,D,H. +TYIFLS: TRNE R,%TINWT + JRST [ SUB P,[1,,1] + SETO D, + JRST TYI4] +;ENTER HERE FROM ECHOIN - R IS NOT MEANINGFUL. +TYIFL2: MOVE H,TTYOPT(I) + TLNE H,%TOMVU ;THIS DOESNT APPLY TO ARDS-LIKE DISPLAYS + TLNE H,%TOERS + SKIPA D,I + JRST UFLS + IMULI D,TPLEN*2 + MOVEI A,%TFEOP + ANDCAM A,TPFLAG(D) ;CLEAR PENDING MORE + HLL D,TTYSTS(I) + MOVE A,TCMXV(I) .SEE TPVE;(D) + TLNE H,%TOMVU ;PRINTING TTY'S AND DISPLAYS IN SCROLL MODE + TLNE D,%TSROL ;DO ONE THING. + JRST TYIFL1 + CAME A,TPVB+TPLEN(D) ;FOR WRAP-AROUND DISPLAYS, + JRST UFLS ;IF NOT USING AN ECHO AREA, + MOVEI A,6 ;PREVENT MORES FOR THE NEXT 6 LINES. + MOVEM A,TPVM(D) + JRST UFLS + +TYIFL1: SUB A,TTYROL(I) ;IN SCROLL MODE, **MORE** WHEN THIS LINE GOES OFF THE SCREEN. + MOVEM A,TPVM(D) + JRST UFLS + +SUBTTL TTY OUTPUT IOT + +;THESE PUSHED BY TYOSET, REFERENCED INDEX OF J. +TYOPV0==0 ;COUNT OF NUMBER OF CHARACTERS THAT WE CAN TAKE A SHORTCUT FOR, + ;IN SUPERIMAGE MODE SIOT. +;TYOPV1 UNUSED, BUT SPACE ALLOCATED. +TYOPV2==2 ;-> IOCHNM WORD OF CHANNEL IOT IS ON. +TYOPV3==3 ;PC PPR IDX,,TTY #. + + +;TO OUTPUT TO A TTY (R -> IOCHNM WD OF TTY CHNL) +; JSP E,TYOSET ;WAIT TILL JOB HAS TTY AND OUT OF COM MODE, +; ;INIT FOR PCLSRING, PUSH VARS ON STACK. +; JRST IGNORE ;TYOSET RETURNS HERE IF THIS OUTPUT SHOULD BE DISCARDED. +; ... ;OUTPUT 1 OR MORE CHARS TO TTY +; ;MEANWHILE, J -> BLOCK OF 4 STACK VARS. +; POPJ P, ;RETURNS TO TYOUNS TO FLUSH STACK, ETC. + +TYOSET: PUSHJ P,TTYWO ;WAIT TILL THIS JOB HAS OUTPUT PERMISSION. + JRST (E) ;RETURN IF OUTPUT BEING IGNORED. + AOS E ;SKIP THAT RETURN IF WE ARE GOING TO DO THE OUTPUT. + JUMPN U,TYOSE3 + MOVEI T,TYOWNC ;FOR SYSTEM JOB, CHECK TTOALC WITH A TIMEOUT IN CASE + SKIPL TTOALC(I) ;THE TTY IS FORGETTING TO TURN TYPEOUT BACK ON. + PUSHJ P,TYOW2 + JRST TYOSE4 ;NOTE THAT TYOW2 CAN POP1J. + +TYOSE3: SKIPL TTOALC(I) ;^\ CAN DELAY TYPEOUT AT M.P. LEVEL THROUGH SIGN OF TTOALC. + PUSHJ P,UFLS ;ALSO USED BY OUTPUT RESET ON SOFTWARE TTY. +TYOSE4: MOVEI J,1(P) ;PROVIDE SPACE FOR TEMPS, WHERE FINSET CAN FIND THEM. + ADD P,[2,,2] + PUSH P,R .SEE TYOPV2 + MOVE H,TTYOPT(I) + MOVSI T,%TCLFT+%TCOCO+%TCICO + SKIPGE TTYCOM(I) + PUSHJ P,TTYCMW ;WAIT TILL TTY IS NOT IN COM MODE, OR OVER-RIDDEN. + CONO PI,TTYON + MOVEI A,%TJCNS+77+%TJCP1+%TJCP2+%TJSTP+%TJINK ;DON'T LET THESE IOCHNM BITS BE CHANGED + ANDCAB A,CTLBTS(U) ;EVEN TEMPORARILY. + HRLZS A ;ELSE, IF A BIT IS SET IN THE CTL BITS, + XORB A,(R) ;CHANGE IT (TEMPORARILY) IN IOCHNM WORD. + PUSHJ P,LOSSET ;SET UP ROUTINE TO UNDO THAT TEMPORARY CHANGE + [MOVE A,AC0S+J(U) ;IF WE SHOULD PCLSR OUT + HLRZ T,@TYOPV2(A) + XOR T,CTLBTS(U) + HRLM T,@TYOPV2(A) + POPJ P,] + HLRZS A + TRNE A,%TJSTP ;IF WE ARE HUNG IN A **MORE**, WAIT TILL THERE'S A CHARACTER + PUSHJ P,TYOSMR ;IT'S IMPORTANT WE WAIT WITOUT TYOSW SET - ELSE NO ECHOING! + MOVE TT,I ;NOW MAKE TT -> APPRO. PC PPR FOR THIS CHNL. + IMULI TT,TPLEN*2 + TRNE A,%TJPP2 + MOVE TT,TTYEPP(I) +TYOSE1: PCLT ;ENTER HERE FROM INPUT IOT WHEN DOING M.P. ECHOING + AOSE TYOSW(I) ;SEIZE THIS TTY FOR MP LEVEL. + JRST [SKIPL TYOSW(I) + PUSHJ P,UFLS + JRST .-1] + PUSHJ P,LSWDEL ;THEN SET UP LOSSET ROUTINE FOR BOTH TYOSW AND + PUSHJ P,LOSSET ;PREVIOUSLY-LOSSET'ED CHANGE TO IOCHNM BITS. + [MOVE A,AC0S+J(U) + HLRZ T,@TYOPV2(A) + XOR T,CTLBTS(U) + HRLM T,@TYOPV2(A) + MOVE A,TYOPV3(A) + SETOM TYOSW(A) + POPJ P,] + CAMN TT,TTYLPP(I) ;IF TTY IS ASSOCIATED W/ ANOTHER PC PPR, + JRST TYOSE2 + PUSH P,TT + SKIPL TT,TTYLPP(I) + PUSHJ P,TYOMVC ;DISASSOCIATE THEM. + POP P,TT + SETCAM TT,TTYLPP(I) +TYOSE2: PUSH P,I .SEE TYOPV3 + HRLM TT,(P) + MOVE Q,TTYCOM(I) + TLNE Q,%TCECH ;IF THERE'S ECHOING OUTPUT IN OUTPUT BUFFER, + JRST [ PCLT ;WAIT FOR IT TO GET PRINTED. MUSTN'T HAVE ECHO AND + PUSHJ P,TYOWC ;OUTPUT IN THE OUTPUT BUFFER AT ONE TIME. + MOVSI Q,%TCECH + ANDCAB Q,TTYCOM(I) + JRST .+1] + TLNE Q,%TCMTR ;IF THIS TTY IS A TERMINET & ITS MOTOR IS OFF, + PUSHJ P,TTTMTO ;TURN THE MOTOR ON BEFORE OUTPUT. + PUSHJ P,(E) + +TYOUNS: CAIA ;IF WE ARE SKIPPED INTO, PROPAGATE THE SKIP. + AOS -4(P) + SUB P,[4,,4] + +TYOUN1: HRLZ R,CTLBTS(U) ;UNDO TEMPORARY CHANGES IN IOCHNM WD. + XORM R,@TYOPV2(J) + PUSHJ P,LSWDEL + SKIPGE TTYERQ(I) ;IF ECHOING ISN'T ALREADY REQUESTED, + SKIPL TTYLPP(I) ;AND THERE IS BUFFERED CURSOR POSITIONING, + JRST TYOUN3 + CONO PI,TTYOFF + MOVEI J,TTEDMY ;SO TYOFNR WON'T CLOBBER RANDOMNESS. + SETCM TT,TTYLPP(I) ;TT -> PC PPR TTY WAS DISSOCIATED FROM. + MOVE H,TTYOPT(I) + MOVE A,TORM(I) + CAIN A,TOBS ;AND IT CAN BE DONE NOW, + PUSHJ P,TYOFRC ;FORCE OUT BUFFERED CURSOR MOTION. + SETOM TYOSW(I) + JRST TTYONJ + +TYOUN3: SETOM TYOSW(I) ;RELEASE TTY. + POPJ P, + +;WAIT TILL THERE'S A TTY INPUT CHARACTER. +TYOSMR: PUSH P,A + PUSH P,R + MOVEI R,%TIACT+%TIECH+%TIPEK + PUSHJ P,TYI0 + POP P,R + JRST POPAJ + +;OUTPUT IOT + +;BLOCK MODE. +TTYBO: JSP E,TYOSET + JRST TTYBOI + JSP E,NBTOCH +TTYBO3: CAIN A,EOFCH + POPJ P, + PUSH P,TT + PUSHJ P,TTYBO1 + POP P,TT + MOVEI E,TTYBO3 + POPJ P, + +;IGNORE SOME BLOCK MODE OUTPUT. +TTYBOI: XCTR XRW,[MOVES D,(C)] + TLO D,700000 + HLRE A,D + MOVNS A + HRLS A + ADD D,A ;COUNT THE AOBJN POINTER ALL THE WAY OUT. + XCTR XRW,[MOVEM D,(C)] + POPJ P, + + JRST TYOBP ;SIOT DISPATCH IS -1 + ADDR. OF UNIT MODE ROUTINE. +;UNIT MODE TTY OUTPUT. +TYO: JSP E,TYOSET + POPJ P, ;JUST RETURN IF WE ARE SUPPOSED TO DISCARD THE OUTPUT. + SKIPGE C + SKIPA A,(C) + UMOVE A,(C) +;MUSTN'T CLOBBER C OR D. +TTYBO1: HLRZ R,@TYOPV2(J) ;RH(R) GETS LH(IOCHNM WD) + HRRZ I,TYOPV3(J) + HLRZ TT,TYOPV3(J) +TYOBP2: ANDI A,%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC + SKIPGE E,TTYCOM(I);IN COM MODE W/ LOCAL FEED THRU, + TLNN E,%TCLFT + JRST TYO6 + PUSH P,C + PUSH P,D + PUSH P,U + PUSH P,TT ;ECHO CHAR ON ALL TTYS IN LOOP + PUSH P,R ;THAT HAVE REMOTE-FEED-THRU. + PUSHJ P,TYCREP ;DO FOLLOWING INSN FOR EACH TTY IN LOOP. + PUSHJ P,TYO7 ;(# OF TTY DOING IT FOR PUT IN I) + JFCL ;(TYCREP WILL SKIP IF THAT INSN ALWAYS DOES) + POP P,R + POP P,TT + POP P,U + POP P,D + POP P,C + JRST TYO6 + +TYO7: MOVE D,TTYCOM(I) ;IF THIS TTY WANTS MY TYPEOUT. + TLNE D,%TCRFT + CAMN I,-2(P) ;AND IF IT ISN'T ME, + JRST POPJ1 + PUSHJ P,TYCSET ;SET UP ACS Q,R,U FOR TTY TO ECHO ON. + CONO PI,TTYOFF + PUSH P,A + PUSHJ P,TTYI13 ;ECHO CHAR ON THIS TTY. + CONO PI,TTYON + JRST POPAJ1 + +;SIOT ROUTINE FOR TTY OUTPUT - JUST LIKE REPEATED UNIT MODE, +;BUT MOVES THE TYOSET OUTSIDE THE LOOP TO SAVE TIME. +TYOBP: MOVEM B,SRN3(U) ;SAVE B, C; CAN'T USE STACK SINCE TYOSET PUSHES. + MOVEM C,SRN4(U) + JSP E,TYOSET ;SET UP FOR DOING TTY OUTPUT. + JRST TYOBPI ;RETURN HERE IF WE SHOULD DISCARD THE OUTPUT + HLRZ R,@TYOPV2(J) ;FOR TYOFRC + CAME TT,TTYLPP(I) + TRNN R,%TJSIO ;ONLY IN SUPER-IMAGE MODE, + CAIA + PUSHJ P,TYOFRC ;FORCE OUT ALL PREVIOUS MAIN PROGRAM CURSOR MOTION + MOVE B,SRN3(U) ;BE JUST LIKE ORDINARY REPEATED-UNIT-MODE SIOT, + MOVE C,SRN4(U) ;EXCEPT THAT THE TYOSET IS OUTSIDE THE LOOP. + SETOM TYOPV0(J) ;CAN'T TAKE SHORTCUT AT FIRST. + MOVE D,[%IOTOT,,.+2] + JRST NSIOT1 ;SIOT ROUTINE WILL COME BACK FOR EACH CHAR, PRESERVING I,J,TT + HLRZ R,@TYOPV2(J) + MOVE A,D ;PUSHJ HERE FOR EACH CHARACTER. + SOSG TYOPV0(J) ;PERHAPS THE PREVIOUS CHARACTER DISCOVERED WE CAN + ;START TAKING THE SHORTCUT. + JRST TYOBP2 ;IF NOT, DO THE WHOLE PILE OF WORK. + ANDI A,%TXDIS+%TXASC + SKIPGE E,TTYCOM(I) + TLNN E,%TCLFT ;SHORT CUT IS TO PUT THE CHARACTER RIGHT IN THE OUTPUT BUFFER. + JRST TYONCC ;MAY BE USED ONLY FOR SUPERIMAGE OUTPUT. + JRST TYOBP2 ;AND BETTER NOT BE IN COM MODE WITH LOCAL FEED THRU. + +;IGNORE THIS STRING OF OUTPUT; TELL THE USER WE OUTPUT IT. +TYOBPI: MOVE B,SRN3(U) + MOVE C,SRN3(U) + UMOVE T,(B) + UMOVE TT,(C) + JUMPE C,POPJ1 + IBP T + SOJG TT,.-1 + XCTR XRW,[MOVEM T,(B)] + XCTR XRW,[MOVEM TT,(C)] + JRST POPJ1 + + +;A USUALLY HOLDS THE CHAR BEING IOTTED, OR THE CHAR TO BE PUT IN BUFFER. +;B IS A TEMP. +;C IS USUALLY UNUSED, AND MUSTN'T BE CLOBBER BY IOT RTN. +;D " +;E IS A TEMP. +;TT HOLDS THE INDEX OF THE PC PPR BEING USED. +;I HOLDS THE TTY NUMBER. +;H HOLDS THE TTY'S TTYOPT WORD. +;J HOLDS THE INDEX OF A 4-WORD BLOCK USUALLY ON THE STACK +; INDEX USING TYOPV0, TYOPV1, TYOPV2, TYOPV3. +;T IS A TEMP. +;R'S RH HOLDS THE IOCHNM WORD'S LH. +;Q HOLDS THE BP FOR STORING IN OUTPUT BUFFER. +; INITTED FROM TOIP, AND STORED BACK IN TOIP WHEN FINALIZED. + +TYO6: PCLT + MOVEI T,TYOWNC ;MAKE SURE AT LEAST TYOWNC + CAML T,TORM(I) ;CHARS OF SPACE LEFT IN OUTPUT BUFFER. + PUSHJ P,TYOW2 ;NOTE THIS CAN POP1J. SO CAN TYOWN. + MOVE H,TTYOPT(I) +IFN N11TYS,[ + TRNN H,%TP11T ;FOR A PDP11 TV TTY, + JRST TYO8 + SKIPL TT11P ;IGNORE IT IF PDP11 ISN'T UP. + POPJ P, + PUSHJ P,TYOWN ;WAIT TILL AT LEAST TYOWNC CHARS SPACE. +] ;(TORM HAS NO INFO ON TV TTYS). +;A,R,I,TT,H,J SET UP AT THIS POINT. +;ENTER HERE FROM PI LEVEL TO ECHO CHARS +TYO8: MOVE Q,TOIP(I) ;GET COPY OF BP TO STORE WITH. + ;WHEN OUTPUTTING CHARS, WILL UPDATE Q INSTEAD TOIP. + ;THEN, WHEN CAN NO LONGER PCLSR, DO TOIP(I)_Q. + MOVE B,TPFLAG(TT) +TYOIG1: TRNE B,%TFEOP+%TFIGL ;ANY EXCEPTIONAL CONDITION FOR THIS PC PPR? + JRST TYOIGL ;IF SO, HANDLE IT. +TYOEO9: TRNE R,%TJCP1+%TJCP2+%TJSTP+%TJSIO+%TJINK + JRST TYOCP1 ;HANDLE ANY EXCEPTIONAL CONDITION FOR CHANNEL. + TRNE A,%TXCTL+%TXMTA+%TXSUP+%TXTOP + JRST TYOMTA ;TAKE CARE OF FUNNY BITS IN CHARACTER. +TYOMT9: CAILE A,40 + JRST TYONRM ;PRINTING CHARS AND RUBOUT. + CAIN A,40 + JRST TYOSPC ;SPACE MAY BE EITHER PRINTING OR CURSOR MOTION. + CAIL A,^G ;< ^G OR > ^S => NORMAL CTL CHAR, +IFE 0, CAIL A,^Q ;RIGHT NOW, ^S USES %TGIMG OF GROUP 0. +IFN 0, CAIL A,^T ;BUT FOR INPUT, IT USES GROUP 6. THIS INSN MAKES IT USE GROUP 6 FOR OUTPUT TOO. + JRST TYOCTL + JRST @.+1-^G(A) ;ELSE DO WHAT THIS PARTICULAR ONE WANTS. + + TYOBEL ;^G DOESN'T MOVE CURSOR. + TYOBS ;^H MOVES BACKWARDS. + TYOTAB ;^I MOVES TO TAB STOP. + TYOLF ;^J IS LINEFEED. + TYOCTL ;^K IS NORMAL. + TYOFF ;^L MAY CAUSE A **MORE** + TYOCR ;^M IS A CARRET + TYOCTL ;^N IS NORMAL + TYOCTL ;^O IS NORMAL + TYOCTP ;^P MAY SIGNIFY A CURSOR CTL CODE. + TYOCTL ;^Q IS NORMAL + TYOCTL ;^R IS NORMAL + TYOCTS ;^S IS NORMAL EXCEPT USES A DIFFERENT GROUP'S %TGIMG. + +;OUTPUT CHARACTER IN SUPERIMAGE MODE. +TYOSIO: ANDI A,377 + MOVEI B,TYOWNC ;IF WE'VE GOT THIS FAR, THEN THERE'S AT LEAST TYOWNC CHARS OF SPACE, + CAME TT,TTYLPP(I) ;IF DISSOCIATED, + PUSHJ P,[ + PUSH P,Q + PUSHJ P,TYOASS ;ASSOCIATE, + POP P,T + CAME T,Q ;AND IF THAT REQUIRED OUTPUT, + SUBI B,5 ;THAT'S SO MANY FEWER CHARS BEFORE TIME TO CHECK TORM AGAIN. + POPJ P,] + MOVEM B,TYOPV0(J) ;AND NO UNUSUAL CONDITIONS, SO SIOT CAN GO FAST FOR A WHILE. +;OUTPUT A CHAR WITH NO CURSOR CONTROL. +;ASSUMES ITS POSITION DOESN'T MATTER. +TYONCC: PUSHJ P,TYOOUT + JRST TYOFN2 + +;COME HERE WHEN ^P IS OUTPUT. +TYOCTP: TRNN R,%TJDIS ;IS THIS OUTPUT CHNL TREATING ^P SPECIALLY? + JRST TYOCTL ;NO, TREAT ^P AS NORMAL CTL CHAR. + TRO R,%TJCP1 ;YES, SAY TREAT NEXT CHAR AS CURSOR CODE. + JRST TYOFNR + +;COME HERE TO OUTPUT A ^S. +TYOCTS: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS ;PREPARE TO OUTPUT PRINTING CHARACTERS. + HLLZ T,TTYST2(I) ;GET THE RELEVANT %TGIMG BIT. + TLZ T,#<%TGIMG_12.> + JRST TYORU2 + +;HERE TO OUTPUT ^G +TYOBEL: MOVEI A,%TDBEL + JRST TYONCC + +;COME HERE FOR ^PP - OUTPUT A ^P. +TYOCPP: SKIPA A,[^P] + +;COME HERE FOR ^PQ TO OUTPUT A ^C. +TYOCPQ: MOVEI A,^C + +;COME HERE FOR NORMAL (NON-FORMATTING) CONTROLS. +TYOCTL: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS ;PREPARE TO OUTPUT PRINTING CHARACTERS. + CAIN A,33 + JRST TYOALT ;CHECK FOR ALTMODE. + HLLZ T,TTYST1(I) ;GET THE "OUTPUT IN IMAGE MODE" BIT THAT'S RELEVANT. + TLZ T,#<%TGIMG_12.> +TYORU2: TRNE R,%TJECH ;ECHO-MODE OUT => PRINT IN ASCII MODE. + JRST TYOCT1 + MOVE B,TTYSTS(I) + TLNE B,%TSSAI ;SHOULD USE SAIL CHAR SET FOR OUTPUT => DO SO. + JRST TYONR0 + JUMPN T,TYOAL1 ;IF "OUTPUT IN IMAGE" IS SET, GO DO SO. +TYOCT1: HRLM A,(P) ;ELSE OUTPUT CTL CHAR IN ASCII MODE, + MOVEI A,"^ ;AS "^" FOLLOWED BY UN-CTL'ED CHAR. + TLNE H,%TOSAI + MOVEI A,13 ;IF TTY HAS SAIL MODE, USE A SAIL UPARROW. + PUSHJ P,TYONR1 + HLRZ A,(P) + XORI A,100 + JRST TYONR0 + +TYOAL1: TLNN H,%TOSAI + JRST TYORU1 + JRST TYONR0 + +;HANDLE CHARACTERS WHICH HAVE %TXCTL, %TXMTA, %TXSUP OR %TXTOP SET. +TYOMTA: MOVE B,TTYSTS(I) + TLNN B,%TSFCO ;IF USER DOESN'T WANT FULL CHAR SET OUTPUT, + JRST TYOMT4 ;IGNORE THE META BITS (USUALLY). + TRNE A,%TXCTL + PUSHJ P,TYOMT1 ;ECHO AN ALPHA FOR %TXCTL. + TRZE A,%TXMTA + PUSHJ P,TYOMT2 ;TYPE A BETA FOR %TXMTA + TRZE A,%TXSUP + PUSHJ P,TYOMT5 + TRZN A,%TXCTL+%TXTOP ;IF CTL OR TOP IS SET, THE CHARACTER + JRST TYOMT9 + CAIN A,40 ;ISN'T AN ASCII CONTROL CHAR EVEN IF < 40 + JRST TYOSPC ;(BTW, SPACE IS STILL SPACE) + CAIE A,177 + CAIG A,40 +TYOMT3: TLNE H,%TOSAI + JRST TYONRM + CAME TT,TTYLPP(I) ;WE HAVE WHAT WOULD OTHERWISE BE AN ASCII CTL CHAR. + PUSHJ P,TYOASS + CAIN A,33 + JRST TYOAL3 + JRST TYOCT1 + +TYOMT5: MOVEI B,6 ; EPSILON + JRST TYOMT6 + +TYOMT1: SKIPA B,[2] ; ALPHA +TYOMT2: MOVEI B,3 ; BETA +TYOMT6: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS + PUSH P,A + MOVE A,B + PUSHJ P,TYONR1 + JRST POPAJ + +TYOMT4: TRNN R,%TJECH ;FOR OUTPUT, IGNORE THE META BITS. FOR ECHO, + ANDI A,%TXASC ; TRY TO ECHO WHAT THE GUY TYPED. + TRNE A,%TXTOP ;IF TOP IS ON, + TLNN H,%TOSAI ;AND THE TTY HAS THE SAIL CHAR SET, + TRZA A,%TXMTA+%TXSUP+%TXTOP + JRST TYONR3 ;ECHO THE CHAR USING SAIL CHAR SET. + PUSHJ P,TYINR2 ;ECHO AS WHAT PROGRAM SEES + JRST TYOMT9 ;ALSO HACKS SUCH AS ^L MAY CLEAR THE SCREEN + +;HANDLE SPACE: ON OVERPRINTING TERMINALS, SPACE = ^PF. +;ON IMLACS, SPACE = SPACE BECAUSE THE IMLAC PROGRAM LOSES FOR ^PF AT END OF LINE. +;ON RAW TERMINALS, SPACE OF COURSE GOES OUT AS SPACE. +;ON OTHER TERMINALS, SPACE = SPACE. THIS IS A CROCK, BUT IT IS NECESSARY +;BECAUSE ^PF TAKES 6 TIMES AS LONG ON DATAPOINTS BECAUSE OF PADDING, +;AND TWICE AS LONG ON VT52S BECAUSE IT TAKES TWO CHARACTERS. + +TYOSPC: TLNN H,%TOOVR ;NON-OVERPRINTING => OUTPUT A REAL SPACE. + JRST [ TLNE H,%TOMVU + JRST TYONRM + HLRE B,TTYLPS(I) ;BUT ON GLASS TTY'S (NON-OVERPRINTING, NO UPWARD MOTION) + CAMGE B,TPVP(TT) + JUMPGE B,.+1 ;IT IS SAFE TO TREAT SPACES AS CURSOR MOTION + JRST TYONRM] ;IF THEY ARE GOING TO FOLLOW DOWNWARD MOTION ANYWAY. + TLNE H,%TORAW+%TOIML ;IMLAC, OR NO OPTIMIZATION => OUTPUT A REAL SPACE. + JRST TYONRM ;NORMAL CHARACTER. + CAMN TT,TTYLPP(I) + PUSHJ P,TYOMVC ;PREPARE FOR CURSOR MOTION. + AOS B,TPHP(TT) ;MOVE FORWARD 1 POS. + CAML B,TCMXH(I) .SEE TPHE;(TT) + TRNE R,%TJCTN + JRST TYOFNR + SOS TPHP(TT) ;IF NECESSARY, CONTINUE TO NEXT LINE AND RETRY. + PUSHJ P,TYOCTN + JRST TYOSPC + +TYONR3: ANDI A,%TXASC +;OUTPUT A NORMAL CHARACTER, AND FINALIZE. COME HERE FOR +;NORMAL CHAR ACTUALLY IOTTED. +TYONRM: CAME TT,TTYLPP(I) ;ABOUT TO OUTPUT PRINTING CHARS SO + PUSHJ P,TYOASS ;FORCE ANY CURSOR MOTION INTO OUTPUT BFR + CAIN A,177 + JRST TYORUB + +;CALL HERE TO OUTPUT NORMAL CHAR, IF CURSOR POSITIONING KNOWN +;NOT TO BE NECESSARY. +TYONR0: PUSH P,[TYOFNA] ;CAUSE FINALIZATION WHEN FINISHED. + +;CALL HERE TO OUTPUT NORMAL CHAR AS PART OF TASK OF OUTPUTTING +;SOME LARGER GROUP. DOESN'T FINALIZE, IN CASE WE PCLSR LATER. +TYONR1: AOS B,TPHP(TT) ;ADVANCE CURSOR OF PC PPR 1 SPACE. + CAML B,TCMXH(I) .SEE TPHE;(TT) ;NOT YET AT END OF LINE => OUTPUT CHAR. + TRNE R,%TJCTN ;AT END: NO CONTIN => OUTPUT, + JRST TYOOUT + PUSHJ P,TYONR2 ;CONTINUE THE LINE (NOTE CURSOR POS FOR + CAME TT,TTYLPP(I) ;THE "!" WAS ALREADY DONE) + PUSHJ P,TYOASS ;TYONR2 DISSOCIATED THE TTY + JRST TYONR1 ;BUT TYONR1 NEEDS IT ASSOCIATED. + +;TYPE "!" TO CONTINUE A LINE. +;THIS FINALIZES THE !CRLF BUT ALSO REMOVES THE CONDITIONS WHICH +;CAUSED IT TO BE CALLED; SO PCLSRING IS NO PROBLEM. +;LEAVES TTY DISSOCIATED FROM PC PPR. +TYOCTN: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS + AOS TPHP(TT) ;ACCOUNT FOR THE "!". +TYONR2: PUSH P,A + MOVEI A,"! ;PUT "!" IN OUTPUT BUFFER, + PUSHJ P,TYOOUT + PUSHJ P,TYORCR ;AND GO TO NEXT LINE. + PUSHJ P,TYOLF + MOVE B,TPFLAG(TT) ;IF THAT LF TOOK US TO LAST LINE, + TRNE B,%TFEOP + JRST TYOEO5 ;DO **MORE** PROCESSING IF NEC. + JRST POPAJ ;AND RETRY WHATEVER CAUSED CONTINUATION. + +;COME HERE TO OUTPUT A RUBOUT. +TYORUB: TRNN R,%TJECH + JRST TYORU3 + TLNN H,%TOERS ;RUBOUT ON A DISPLAY CONSOLE ECHOES AS DELETE BACKWARDS. + TLNN H,%TOOVR ;LIKEWISE ON A GLASS TTY + JRST TYODLB +TYORU3: MOVE T,TTYST2(I) + ANDI T,%TGIMG_6 ;GET RUBOUT'S "OUTPUT IN IMAGE MODE" BIT. + JRST TYORU2 + +;COME HERE TO OUTPUT A LF. FINALIZES. LEAVES TTY DISSOCIATED. +TYOLF: CAMN TT,TTYLPP(I) ;BEFORE MUNGING PC PPR'S CURSOR POS, + PUSHJ P,TYOMVC ;MUST DISASSOCIATE TTY'S POS FROM PC PPR. + SOS TPVM(TT) ;COUNT DOWN # LINES TILL NEXT **MORE**. + AOS B,TPVP(TT) ;MOVE PC PPR'S CURSOR 1 LINE DOWN. + CAIG B,118. ;DON'T LET VPOS ON PRINTING TTY GET TOO BIG. + CAML B,TCMXV(I) .SEE TPVE;(TT) ;END OF RANGE => GO TO TOP OR SCROLL. + JRST TYOLFE +TYOLF0: MOVE A,TTYSTS(I) + TLNE A,%TSMOR ;IF **MORE** DESIRED, + JRST TYOLF1 + ADDI B,1 ;THEN IF ENTERING LAST LINE OF RANGE, + CAME B,TCMXV(I) .SEE TPVE;(TT) + JRST TYOLF1 + SKIPGE TPVM(TT) ;UNLESS NOT TIME YET, + SKIPA B,[%TFEOP] ;TELL NEXT OUTPUT ATTEMPT TO CAUSE **MORE**. +TYOLF1: SETZ B, + PUSH P,B + TLNE H,%TORAW + JRST [ MOVEI A,%TDLF ;NO OPTIMIZATION => + PUSHJ P,TYOOUT ;OUTPUT A REAL LF (PLUS PADDING) + PUSHJ P,TYOMVC + JRST TYOLF5] + TLNN H,%TOERS ;IF TTY HAS SELECTIVE ERASE, + JRST TYOLF5 + PUSH P,TPHP(TT) + PUSHJ P,TYORCR ;GO TO BEGINNING OF LINE + HLRZ B,TTYLPS(I) ;IF CR AND LF AND CLR-EOL ARE EXACTLY + ADDI B,1 ;WHAT WE NEED, + CAMN B,TPVP(TT) + SKIPN TTYROL(I) ;AND TTY CAN DO IT, DO THEM ALL AT ONCE. + SKIPA A,[%TDEOL] ;OTHERWISE, OUTPUT MOVE-CURSOR AND %TDEOL. + SKIPA A,[%TDCRL] ;OUTPUT %TDCRL = %TDMOV AND %TDEOL TOGETHER. + PUSHJ P,TYOASS + PUSHJ P,TYOOUT + PUSHJ P,TYOMVC + POP P,TPHP(TT) +TYOLF5: POP P,B + IORM B,TPFLAG(TT) + JRST TYOFND + +;LINEFEED THAT WRAPS AROUND. +TYOLFE: MOVE A,TTYSTS(I) + TLNN H,%TOMVU ;END OF SCREEN ON PRINTING TTY => SCROLL BY 1. + JRST TYOLF2 + TLNE A,%TSROL ;DISPLAY IN SCROLL MODE? + SKIPE TPVB(TT) ;CAN'T SCROLL UNLESS PC PPR IS WHOLE SCREEN. + JRST TYOLF3 +TYOLF2: MOVN A,TTYROL(I) ;A GETS - # LINES TO SCROLL AT ONCE. + JUMPE A,TYOLF3 ;JUMP IF THIS TTY CAN'T SCROLL + SOS TPVP(TT) + PUSH P,TPHP(TT) + HRRZ B,TTYLPS(I) + MOVEM B,TPHP(TT) + PUSHJ P,TYOASS ;MOVE CURSOR DOWN TO LAST LINE ON SCREEN, PREPARING FOR SCROLL + PUSHJ P,TYOMVC + POP P,TPHP(TT) + AOS TPVP(TT) +;SCROLL: A HAS -<# LINES TO ADJUST ALL VPOS'S BY>. +TYOLF6: HLRZ B,TTYLPS(I) ;COMPUTE NEW TTYLPS LH. + ADD B,A + JUMPGE B,TYOLF7 ;IF IT WOULD BE NEGATIVE, + TLNN H,%TORAW ;ON DISPLAY WRAP AROUND INSTEAD (LOSSAGE HAPPENING). + JRST TYOLF3 + SETZ B, ;IN RAW MODE, DON'T WORRY ABOUT IT. +TYOLF7: HRLM B,TTYLPS(I) ;STORE UPDATED M.P. VPOS. + ADDM A,TPVP(TT) ;CHANGE OTHER MAIN PRGM VPOS'S. + MOVE B,TPVP(TT) ;IF SCROLLING 1 LINE AT A TIME, + JRST TYOLF0 ;MAY NEED TO SET %TFEOP. + ;IN ANY CASE, CLEAR NEXT LINE & FINALIZE. + +;HERE TO WRAP AROUND TO TOP OF SCREEN. +TYOLF3: SETZM TPVM(TT) ;TURN OFF ANY SUPPRESSION OF MORES BY INPUT + TLNN H,%TOERS ;ON DISPLAYS WITHOUT SELECTIVE ERASE, + JRST [ PUSHJ P,TYOCLR ;MUST CLEAR SCREEN WHEN WRAP AROUND. + JRST TYOMVC] ;MUST LEAVE TTY DISSOCIATED. +TYOLF4: MOVE B,TPVB(TT) ;ELSE JUST MOVE TO TOP OF PC PPR + MOVEM B,TPVP(TT) + JRST TYOLF1 ;AND CLEAR THE TOP LINE. + +;HANDLE BACKSPACE. +TYOBS: TLNN H,%TOIML ;BACKSPACE ON IMLAC ISN'T SAME AS MOVE BACK. + JRST TYOBS1 + MOVE B,TPHP(TT) ;ON IMLAC, FIRST, IF AT LEFT MARGIN, + SKIPG B .SEE TPHB;(TT) ;DO NOTHING. + JRST TYOFN2 +TYOBS2: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS ;IF WE SHOULD BACKSPACE, + SOSGE TPHP(TT) + SETZM TPHP(TT) + JRST TYORU1 ;DO IT BY SENDING A ^H. + +TYOBS1: TLNE H,%TOMVB ;ARE WE ECHOING ^H ON TTY THAT CAN'T BS? + JRST TYOBS4 + TRNN R,%TJECH + JRST TYOBS3 + JRST TYOCTL ;ECHO "^H" RATHER THAN CR AND SPACE FWD. + +TYOBS4: TLNE H,%TORAW ;IN RAW MODE ON TTY THAT CAN BS? + JRST [ MOVEI A,%TDBS ;IF NO OPTIMIZATION, + JRST TYOBS2 ] ;ARRANGE TO OUTPUT REAL BS. +TYOBS3: CAMN TT,TTYLPP(I) ;BS ON TTY THAT ISN'T AN IMLAC. + PUSHJ P,TYOMVC ;PREPARE TO DO CURSOR MOTION. + SOS B,TPHP(TT) ;MOVE BACK 1 POS. + SKIPGE B .SEE TPHB;(TT) + AOS TPHP(TT) ;AT LEFT MARGIN, DO NOTHING. + JRST TYOFNX + +;COME HERE WHEN TAB OUTPUT (AT TOP LEVEL ONLY) +TYOTAB: TRNE R,%TJECH + JRST TYOTA1 + MOVE B,TTYST2(I) ;MAYBE TABS SHOULD BE OUTPUT IN IMAGE MODE. + TLNE B,%TGIMG_6 + JRST TYONMV +TYOTA1: MOVE A,TPHP(TT) + ADDI A,10 + TRZ A,7 ;HPOS OF NEXT TAB STOP. + MOVE B,TCMXH(I) .SEE TPHE;(TT) + TRNN R,%TJCTN + SUBI B,1 ;B HAS EFFECTIVE LINEL. + CAML A,B + MOVE A,B ;A HAS PLACE TAB MOVES TO. + SUB A,TPHP(TT) ;HOW FAR TO MOVE RIGHT? + TRNN R,%TJCTN + JUMPE A,[PUSHJ P,TYOCTN + JRST TYOTAB] + CAMN TT,TTYLPP(I) + PUSHJ P,TYOMVC ;PREPARE FOR CURSOR CTL. + ADDM A,TPHP(TT) ;MOVE CURSOR TO TAB STOP. + JRST TYOFNX + +;HANDLE ^L. +TYOFF: TRNN R,%TJECH ;ECHOING? + JRST TYOCTL + MOVE B,TTYSTS(I) ;YES; ^L ECHOES AS UPARROW-L + TLNE H,%TOMVU ;EXCEPT ON DISPLAYS, UNLESS PRGM HAS DISABLED. + TLNE B,%TSCLE + JRST TYOCTL ;ECHO AS UPARROW L + JRST TYOCLR ;ECHO AS CLEAR SCREEN. + +;^M IOTTED - MAYBE DO CR AND LF. +TYOCR: TRNE R,%TJECH ;IF ECHO MODE OUT, CR DOES CRLF. + JRST TYOCRL + MOVE B,TTYST2(I) + TRNE B,%TGIMG_12. ;ELSE OUTPUT-CR-IN-IMAGE PREVENTS LF. + JRST TYOCR1 + PUSHJ P,TYOCRL ;DO CR AND LF, + MOVEI B,%TFIGL ;THEN SAY IGNORE NEXT CHAR IF IT'S A LF. + IORM B,TPFLAG(TT) + POPJ P, + +TYOCRL: PUSHJ P,TYORCR + PUSHJ P,TYOLF + JRST TYOFND + +TYOCR1: PUSHJ P,TYORCR + JRST TYOFND + +;ALTMODE IOTTED - SHOULD WE OUTPUT DOLLARSIGN? +TYOALT: MOVE B,TTYST2(I) + TRNN R,%TJECH ;ECHO MODE => YES. + TLNN B,%TGIMG ;OUTPUT ALT IN ASCII MODE SAYS YES. + JRST TYOAL4 + JRST TYOAL1 ;NO, OUTPUT AN ALTMODE, WHETHER IT PRINTS OR NOT. + +TYOAL4: TLNN H,%TOSAI ;IF ALTMODE IS A GRAPHIC, USE IT; +TYOAL3: MOVEI A,"$ ;ELSE USE DOLLARSIGN. + JRST TYONR0 ;EITHER WAY IT'S A NORMAL PRINTING CHAR. + +;IF ABOUT TO CHANGE PC PPR'S CURSOR POS WITHOUT PUTTING +;ANYTHING IN THE OUTPUT BUFFER THAT WILL CHANGE THE TTY'S +;REAL CURSOR POS THE SAME WAY, MUST DISASSOCIATE TTY'S +;CURSOR POS FROM THIS PC PPR. TTYLPS WILL THEN +;SAY WHERE THE TTY'S CURSOR WILL BE AFTER CHARS IN OUTPUT +;BUFFER ARE ALL OUTPUT. +TYOMVC: HRLZ B,TPVP(TT) + HRR B,TPHP(TT) + MOVEM B,TTYLPS(I) + SETCAM TT,TTYLPP(I) ;TTY NO LONGER ASSOCIATED. + POPJ P, + +;BEFORE PUTTING ANYTHING IN OUTPUT BUFFER USING A PC PPR, +;TTY'S CURSOR MUST BE ASSOCIATED WITH PC PPR (THAT IS, +;THE TTY'S CURSOR MUST BE WHERE THE PC PPR'S CURSOR IS) +;WHEN A TTY IS ASSOCIATED WITH A PC PPR, TTYLPS +;IS NONSENSE, AND IT IS NECESSARY FOR OUPUT RTNS +;TO UPDATE PC PPR'S CURSOR IN ACCORDANCE WITH WHAT +;IS PUT IN THE OUTPUT BUFFER. +;THIS ROUTINE ASSOCIATES TTY IN I WITH PC PPR IN TT. +TYOASS: TRNE R,%TJHDE + POPJ P, + PUSH P,A + HLRZ T,TTYLPS(I) ;CURRENT VERTICAL POS + HRRZ A,TTYLPS(I) ;CURRENT HORIZONTAL POS + CAMN T,TPVP(TT) ;IF CURSOR IS WHERE WE WANT IT, + CAME A,TPHP(TT) + AOSA A + JRST TYOAS3 ;JUST SAY WE'RE ASSOCIATED. + SKIPGE TTYLPS(I) + BUG ;TTY ALREADY ASSOCIATED WITH A PC PPR? + CAMN T,TPVP(TT) ;SEE IF JUST MOVING ONE SPACE TO THE RIGHT + CAME A,TPHP(TT) + JRST TYOAS6 ;NO, NEED FULLY GENERAL CURSOR MOTION + MOVEI A,%TDFS ;SAVE BUFFER SPACE IN THIS COMMON CASE + TLNE H,%TOOVR + MOVEI A,40 ;IF SPACE OVERPRINTS, IT IS BETTER THAN %TDFS SINCE FEWER CHARS + PUSHJ P,TYOOUT ;IF SENT TO A SOFTWARE TTY OVER HARDWARE LINE. + JRST TYOAS3 + +TYOAS6: MOVEI A,%TDMV0 ;TELL THE TTY TO PUT ITS CURSOR + TLNE H,%TOMVU + JRST TYOAS7 + MOVEI A,%TDMOV + PUSHJ P,TYOOUT ;WHERE THIS PC PPR WANTS IT. + HLRZ A,TTYLPS(I) + PUSHJ P,TYOOUT + HRRZ A,TTYLPS(I) +TYOAS7: PUSHJ P,TYOOUT + MOVE A,TPVP(TT) + CAML A,TCMXV(I) ;ATTEMPT TO GO BELOW SCREEN BOTTOM? + BUG + PUSHJ P,TYOOUT ;AND THE NEW POSITION. + MOVE A,TPHP(TT) + PUSHJ P,TYOOUT +TYOAS3: MOVEM TT,TTYLPP(I) ;TELL TTY IT IS ASSOCIATED. + SETOM TTYLPS(I) + JRST POPAJ + +TYOAS5: PUSH P,A ;REGARD TTY AS ASSOCIATED WITHOUT ACTUALLY + JRST TYOAS3 ;MOVING ITS CURSOR. + +;FORCE OUT BUFFERED CURSOR MOTION. +;CALL ONLY IF TTY DISSOCIATED, FROM M.P. OR CLOCK LEVEL. +;H MUST BE SET UP ALREADY +TYOFRC: MOVE Q,TOIP(I) + PUSHJ P,TYOASS + JRST TYOFN2 + +;PUT CHAR IN OUTPUT BFR (BUT IT DOESN'T BECOME VISIBLE +;TO INT. LEVEL UNTIL WE FINALIZE - IN CASE WE PCLSR) +TYOOUT: TRNE R,%TJHDE + POPJ P, +TYOOU1: CAMN Q,TOBEP(I) ;Going to deposit past end of buffer? + MOVE Q,TOBBP(I) ; Yes, make wrap around instead. + HRRZI T,(Q) ;Get addr part of the buffer pointer. + CAILE T,@TOBEP(I) ;Reasonable buffer pointer? + ; CANT HAVE BEEN DUE TO 11 DOWN + BUG HALT,[TTY: OUTPUT BUFFER POINTER PAST END OF BUFFER] + IDPB A,Q ;Stuff char into output buffer. +IFN N11TYS, TRNN H,%TP11T ;TV-11 ttys dont have TORM. + SOSL TORM(I) ; One less space available in buffer. + POPJ P, + BUG HALT,[TTY: OUTPUT BUFFER OVERFLOWED, TYOWNC IS TOO SMALL] + +;FINALIZE, UPDATING TOIP, TORM AND FLAGS. +;ALSO RESET Q FOR ANOTHER BUNCH OF OUTPUT. +TYOFNX: ;FINALIZE WHEN TTY DISSOCIATED AND NOTHING PUT IN BFR. +TYOFND: ;SIMILAR, WHEN SOMETHING MIGHT HAVE BEEN PUT IN BFR. +TYOFNA: ;FINALIZE WHEN TTY ASSOCIATED W/ PC PPR. +TYOFN2: MOVEM Q,TOIP(I) + AOSN TTYOAC(I) ;START THE TTY. + XCT TTYST(I) + JRST TYOFNR + +;ON ORDINARY TTY, CALL WHEN BUFFER FULL. +;WAIT TILL AT LEAST 3/4 EMPTY. T HAS MINIMUM # CHARS NEEDED. +;IF RUNNING SYS JOB, POP1J IF TTY SEEMS TO BE HUNG. +TYOW1: CAIGE T,TOBS*3/4 ;DON'T UNBLOCK TILL BUFFER AT LEAST 3/4 EMPTY. + MOVEI T,TOBS*3/4 +TYOW2: MOVEM I,EPDL3(U) ;MAY TRAP OUT ON SYSTEM JOB + CAME U,USER + BUG + JUMPN U,TYOW4 + JRST TYOW5 ;HANG UP SYS JOB FOR MAX OF 5 SEC + + PUSHJ P,TYOW6 +TYOW5: PUSHJ P,UFLS + MOVE T,TTYCOM(I) + TLNE T,%TCHNG + SUB P,[1,,1] ;TIMED OUT + POPJ P, + + CAMLE T,TORM(I) +TYOW4: PUSHJ P,UFLS + POPJ P, + +TYOW6: MOVE A,AC0S+U(U) ;(IN CASE U DIDN'T EQUAL USER AT TYOW1) + MOVE A,EPDL3(A) ;IF SYS JOB, FLUSH IF NO CHR PROCESSED FOR 15 SEC + MOVE Q,TTYTYP(A) + SKIPL TTOALC(A) ;TIME OUT ON SOFTWARE TTY'S WITHOUT ALLOCATION. + JRST TYOW6A ;IF THIS IS A PDP-11 TV, + TRNE Q,%TY11T ;TEST FOR ROOM IN BUFFER IS DIFFERENT ON TV'S + JRST TYOW7 + CAMG T,TORM(A) ;FOR NON-TV'S, TORM IS VALID. + JRST TYOW6B ;THERES ROOM NOW +TYOW6A: MOVSI T,%TCHNG + MOVE Q,TIME + SUB Q,TTLTM(A) + CAIG Q,5.*30. + JRST TYOW6C ;NO NEW TIMEOUT YET + IORM T,TTYCOM(A) ;MARK THIS TTY AS HUNG FOR SYS JOB + JRST POPJ1 + +TYOW6C: CAILE Q,3 + TDNN T,TTYCOM(A) ;SKIP ON CONSOLE WAS LOSING RECENTLY + POPJ P, + JRST POPJ1 ;TIME OUT MUCH SHORTER IF CONSOLE DETERMINED TO BE A LOSER + +TYOW7: LDB Q,T + CAIE Q,1_TT11BY-1 + JRST TYOW6A +TYOW6B: MOVSI T,%TCHNG ;GET HERE WHEN ROOM EXISTS IN BUFFER + ANDCAM T,TTYCOM(A) ;ITS NOT HUNG NOW + JRST POPJ1 + +IFN N11TYS,[ +;ON A PDP-11 TV, CALL HERE TO WAIT UNTIL THERE ARE AT LEAST +;TYOWNC CHARS OF SPACE IN THE OUTPUT BUFFER. +;CAN POP1J FOR THE SYS JOB. +TYOWN: PUSHJ P,TYOWN1 + LDB B,T ;IS THE POS. 20. CHARS UP VACANT? + CAIN B,1_TT11BY-1 + POPJ P, ;YES, NO NEED TO WAIT. + JUMPN U,TYOWN2 ;IF SYS JOB, TIME OUT BEFORE TOO LONG. + MOVEM I,EPDL3(U) + MOVE B,TIME + MOVEM B,TTLTM(I) + JRST TYOW5 + +TYOWN2: PUSH P,A ;SEEMS TO BE NO SPACE, CHECK AGAIN + MOVE B,(T) ;DOING THINGS IN THE RIGHT ORDER THIS TIME + LDB A,T ;TO AVOID GETTING HUNG BY A TIMING ERROR + CAIN A,1_TT11BY-1 + JRST POPAJ ;SOME SPACE APPEARED IN THE MEANTIME + POP P,A + EXCH B,T + CAMN T,(B) ;WAIT FOR THIS WORD TO CHANGE + PUSHJ P,UFLS + JRST TYOWN ;THEN CHECK IT AGAIN + +TYOWN1: MOVE T,TOIP(I) + ADDI T,TYOWNC/<36./TT11BY> + HRRZ B,TOBEP(I) + CAIGE B,(T) + SUB T,TT11OL + HRLI T,040000+TT11BY_6 ;BP TO WHOLE OF RIGHTMOST BYTE IN WORD + POPJ P, +] + +;COME HERE WHEN DETECT THAT %TFEOP OR %TFIGL IS SET. +TYOIGL: TRZN B,%TFIGL ;%TFIGL TAKES PRIORITY. + JRST TYOEOP + MOVEM B,TPFLAG(TT) ;CLEAR IT, AND IGNORE THIS CHAR + CAIE A,^J + JRST TYOIG1 + POPJ P, + +;%TFEOP IS SET AND OUTPUT IS DONE: DO **MORE** PROC. +TYOEOP: PUSH P,[TYOEO9] + PUSH P,A +TYOEO5: SKIPE USER ;DON'T DO MORES IF SYSTEM JOB IS TYPING + TRNE R,%TJMOR+%TJECH ;OR THIS CHANNEL DOESN'T WANT TO + JRST TYOEO7 + MOVSI B,%TSMOR + TDNE B,TTYSTS(I) ;OR THIS JOB DOESN'T WANT TO + JRST TYOEO7 + HRRZ B,TTYSTS(I) ;DON'T **MORE** AN $$^P'ED JOB'S OUTPUT + CAME B,U + JRST POPAJ + MOVE B,TCMXV(I) .SEE TPVE;(TT) + MOVEM B,TPVM(TT) + HRRZ B,UUAC(U) ;GET INTERRUPT BIT FOR CHANNEL THIS IOT IS ON + MOVE B,CHNBIT(B) + AND B,MSKST2(U) ;HAS USER ENABLED OUTPUT INTERRUPT? + JUMPE B,TYOEO1 ;NO, SYSTEM DOES **MORE** PROC. + IORM B,IFPIR(U) ;YES, JUST GIVE USER INT + MOVEI B,%TFEOP ;HE CAN TYPE **MORE** IF HE WANTS TO. + ANDCAM B,TPFLAG(TT) ;INT. HAS BEEN GIVEN. + PUSHJ P,TYOUN1 ;LSWPOP THE FINSET, ETC. + SKIPA + SKIPA + PUSHJ P,UFLS ;MAKE HIM TAKE THE INT. RIGHT NOW. +TYOEO6: PUSHJ P,LSWCLR + SOS UUOH ;HIS PICLR IS SET? RETRY THE UUO. + JRST URET + +TYOEO7: MOVEI B,%TFEOP ;MORE SUPPRESSED, TURN OFF THE FLAG + ANDCAM B,TPFLAG(TT) + JRST POPAJ + +;COME HERE AT END OF PAGE IF PROGRAM ISN'T SMART. +TYOEO1: PUSH P,TPHP(TT) + MOVE A,TPHP(TT) + ADDI A,10 + CAML A,TCMXH(I) + PUSHJ P,TYORCR + CAME TT,TTYLPP(I) + PUSHJ P,TYOASS + IRPC X,,**MORE** + MOVEI A,"X + PUSHJ P,TYONR1 + TERMIN ;OUTPUT THE STRING "**MORE**" + IORI R,%TJSTP ;MAKE ALL OUTPUT ON THIS CHNL HANG. + MOVEI B,%TFEOP ;NO LONGER WANT NEXT CHAR TO DO **MORE** + ANDCAM B,TPFLAG(TT) + POP P,A ;REMEMBER VALUE TO RESET HPOS TO LATER. + HRLM A,TPFLAG(TT) + PUSHJ P,TYOFNA ;FINALIZE SO "**MORE**" WILL TYPE OUT; + ;PCLSRING NO PROBLEM; SINCE %TJSTP IS SET THE IOT + ;WILL COME TO TYOEO3. +TYOEO3: +IFN N11TYS,[ + TRNE H,%TP11T ;WAIT FOR BUFFER SPACE ON TV. + PUSHJ P,TYOWN ;NOTE THIS CAN POP1J +] + PCLT + MOVEI T,TOBS ;WAIT FOR ALL OF "**MORE**" TO GET OUT. + CAME T,TORM(I) + PUSHJ P,TYOW1 + PUSH P,C + PUSH P,D + PUSH P,R + PUSH P,TT + MOVEI R,%TIPEK+%TIACT+%TIECH+%TINWT + PUSHJ P,TYI0 ;LOOK AHEAD AT NEXT INPUT CHAR. + JUMPL D,TYOEO6 ;IS NONE => RETRY UUO AND WAIT IN TYOSET. + EXCH TT,(P) + EXCH R,-1(P) + MOVE Q,TOIP(I) + MOVE C,TTYSTS(I) + TLNE C,%TSROL ;IN SCROLL MODE, MAKE NEXT LINE OF OUTPUT OVERWRITE **MORE**. + JRST [ PUSHJ P,TYORCR + PUSHJ P,TYOCEL + SOS TPVM(TT) ;MORE AGAIN BEFORE THIS LINE GOES OFF SCREEN + JRST TYOEO4] + TRZN R,%TJCP1 ;UNLESS THIS IS ^PN + PUSHJ P,TYOHD1 ;HOME UP (BY HOMING DOWN AND LF'ING) + PUSHJ P,TYOLF ;OTHERWISE (FOR ^PN) JUST LF. +TYOEO4: CAMN TT,TTYLPP(I) + PUSHJ P,TYOMVC ;PREPARE FOR CURSOR MOTION. + HLRZ A,TPFLAG(TT) ;SET HPOS TO WHAT IT WAS BEFORE THE **MORE**. + MOVEM A,TPHP(TT) + HRRZS TPFLAG(TT) + EXCH TT,(P) + EXCH R,-1(P) + ANDI D,177 + CAIE D,177 + CAIN D,40 ;IF A SPACE, FLUSH IT FROM INPUT BFR + PUSHJ P,TYIREM + POP P,TT + POP P,R + POP P,D + POP P,C + ANDCMI R,%TJSTP ;RETURN CHANNEL TO NORMAL. + MOVE Q,TOIP(I) + PUSHJ P,TYOFNR + POP P,A ;RESTORE THE CHAR BEING IOTTED + POPJ P, ;AND TRY AGAIN TO IOT IT. + +TYOEO2: PUSH P,[TYOEO9] + PUSH P,A ;COME HERE IF PCLSR OUT OF TYOEO3, ETC. + JRST TYOEO3 ;WHEN THE IOT IS RETRIED. + +TYOCP1: TRZE R,%TJINK ;IF THIS IS THE CHAR AFTER A ^PI, TREAT IT AS + JRST TYONR3 ;NORMAL PRINTING CHARACTER. + TRNE R,%TJSTP + JRST TYOEO2 ;CHANNEL HUNG IN **MORE**. +;HANDLE CURSOR CONTROL CODES. COME HERE WITH IOTTED CHAR IN A. +;IF WE ARE IN THE MIDDLE OF A ^P CODE. +;OR IF THE CHANNEL IS A SUPERIMAGE OUTPUT CHANNEL. + TRZE R,%TJCP2 ;AFTER A ^PV OR ^PH ? + JRST TYOCP2 + TRZN R,%TJCP1 ;NO, NEXT CHAR ISN'T IN THE ^P CODE. + JRST TYOSIO ;MUST BE %TJSIO THAT WAS SET. +TYOCP4: CAIL A,"A ;IF ^P CODE IS A LETTER, + CAILE A,"_ + JRST TYOCP3 + MOVE B,TYOCPT-"A(A) ;GET THE DISPATCH ENTRY FOR IT, + TLNN H,%TOMVU + JUMPL B,TYOCPA ;TURN SOME CURSOR OPERATIONS INTO CRLF ON PRINTING TTY + TLNE B,200000 + PUSH P,[TYOCPR] ;SOME OPERATIONS RETURN HERE FOR FINALIZATION + JRST (B) ;FINALLY, DISPATCH + +TYOCPR: MOVEI B,%TFEOP + ANDCAM B,TPFLAG(TT) + JRST TYOFNX + +TYOCP3: CAIL A,140 ;LOWERCASE LETTERS ACT LIKE UPPERCASE + JRST [ SUBI A,40 + JRST TYOCP4] + HRLM R,@TYOPV2(J) + PUSHJ P,TYOUN1 ;OR IT'S ILLEGAL. + JRST IOCR11 ;IOC ERROR. + +TYOCPV: IORI R,%TJCP1 ;HERE FOR ^PV +TYOCPH: IORI R,%TJCP2 ;SAME FOR ^PH. SAY NEXT CHAR IS THE CURSOR POS. +TYOFNR: HRLM R,@TYOPV2(J) + POPJ P, + +TYOCP2: CAMN TT,TTYLPP(I) ;INTERPRET THE CHAR AFTER ^PH OR ^PV. + PUSHJ P,TYOMVC + ANDI A,177 + TRZN R,%TJCP1 ;WHICH OF THOSE 2 WAS IT? + JRST TYOCH1 ;IT WAS ^PH + ADD A,TPVB(TT) + SUBI A,10 + CAML A,TCMXV(I) .SEE TPVE;(TT) ;DON'T PUT CURSOR PAST END. + JRST [ MOVE A,TCMXV(I) .SEE TPVE;(TT) + SOJA A,.+1] + CAMGE A,TPVB(TT) ;OR BEFORE BEGINNING. + MOVE A,TPVB(TT) + MOVEM A,TPVP(TT) + JRST TYOCPR + +TYOCH1: .SEE ADD A,TPHB;(TT) + SUBI A,10 + CAML A,TCMXH(I) .SEE TPHE;(TT) ;DON'T PUT CURSOR PAST END. + JRST [ MOVE A,TCMXH(I) .SEE TPHE;(TT) + SOJA A,.+1] + SKIPGE A .SEE TPHB;(TT) ;OR BEFORE BEGINNING. + SETZ A, .SEE TPHB;(TT) + MOVEM A,TPHP(TT) + JRST TYOCPR + +;DISPATCH TABLE FOR ^P CODES. +;SIGN => TURN INTO ^PA ON PRINTING TTY. +;4.8 => PUSHJ, ELSE JRST +TYOCPT: TYOCPA ;A - ADVANCE TO FRESH LINE. + 200000,,TYOMVB ;B - MOVE BACK. + TYOCLR ;C - CLEAR SCREEN. + 200000,,TYOMVD ;D - MOVE DOWN. + TYOCEF ;E - CLEAR TO END OF SCREEN. + 200000,,TYOMVF ;F - MOVE FORWARD. + TYOCP3 ;G - ILLEGAL. + TYOCPH ;H - NEXT CHAR IS DESIRED HPOS. + TYOCPI ;I - NEXT CHARACTER TREATED AS NORMAL PRINTING. + TYOCP3 ;J - ILLEGAL. + 200000,,TYODLF ;K - DELETE FORWARD. + TYOCEL ;L - CLEAR REST OF LINE. + TYOMOR ;M - DO **MORE**. + TYOMO1 ;N - SIMILAR BUT DON'T HOME UP. + TYOCP3 ;O - ILLEGAL. + TYOCPP ;P - TYPE "^P". + TYOCPQ ;Q - TYPE "^C". + 600000,,TYORPS ;R - RESTORE SAVED POS. + 200000,,TYOSPS ;S - SAVE POSITION (FOR A ^PR). + 600000,,TYOHMU ;T - HOME UP. + 200000,,TYOMVU ;U - MOVE UP. + TYOCPV ;V - NEXT CHAR IS DESIRED VPOS. + TYOCP3 ;W - ILLEGAL. + 200000,,TYODLB ;X - DELETE BACKWARDS. + TYOCP3 ;Y - ILLEGAL. + 600000,,TYOHMD ;Z - HOME DOWN. + 200000,,TYOILP ;[ - INSERT LINE POSITION + 200000,,TYODLP ;\ - DELETE LINE POSITION + TYOCEL ;] - CLEAR TO END OF LINE (USE ^PL IT'S BETTER) + 200000,,TYOICP ;^ - INSERT CHARACTER POSITION + 200000,,TYODCP ;_ - DELETE CHARACTER POSITION +IFN .-31.-TYOCPT,.ERR WRONG LENGTH TABLE. + +;^PM AND ^PN DON'T WORK IN PROGRAMS THAT TAKE **MORE** +;INTERRUPTS - OR, PRECISELY, THEY ALWAYS ENTER +;THE STATE OF A CHANNEL THAT HAS JUST TYPED OUT "**MORE**". +TYOMO1: IORI R,%TJCP1 .SEE TYOEO3 ;^PN - ENTER **MORE** STATE. +TYOMOR: IORI R,%TJSTP ;^PM. + HRRZS TPFLAG(TT) + JRST TYOFNR + +TYOCPI: IORI R,%TJINK + JRST TYOFNR + +;INSERT AND DELETE CHARACTERS AND LINES +TYOILP: SKIPA A,[%TDILP] +TYODLP: MOVEI A,%TDDLP + TLNN H,%TOLID + POPJ P, + PUSH P,A ;SUPPOSED TO BE AT LEFT MARGIN + PUSHJ P,TYORCR ;MAKE SURE + POP P,A + JRST TYOIL1 + +TYOICP: SKIPA A,[%TDICP] +TYODCP: MOVEI A,%TDDCP + TLNN H,%TOCID + POPJ P, +TYOIL1: CAME TT,TTYLPP(I) + PUSHJ P,TYOASS + PUSHJ P,TYOOUT + MOVEI A,1 ;SUPPLY PARAMETER OF 1 + JRST TYORU1 ;IF YOU WANT TO OPTIMIZE CONSECUTIVE ONES + ; USE SUPER-IMAGE OUTPUT, AT LEAST FOR NOW + +;RTNS FOR VARIOUS ^P CODES. +;THE FIRST FOUR DON'T FINALIZE ANYTHING. +TYOMVF: CAMN TT,TTYLPP(I) ;^PF + PUSHJ P,TYOMVC ;PREPARE FOR CURSOR MOTION. + AOS B,TPHP(TT) + CAMGE B,TCMXH(I) .SEE TPHE;(TT) + POPJ P, + ;SETZ A, .SEE TPHB;(TT) ;WRAP AROUND FROM LAST POS. TO FIRST. + SETZM TPHP(TT) +TYOMVD: CAMN TT,TTYLPP(I) ;^PD + PUSHJ P,TYOMVC ;PREPARE FOR CURSOR MOTION. + AOS B,TPVP(TT) + MOVE A,TPVB(TT) + CAIGE B,119. + CAML B,TCMXV(I) .SEE TPVE;(TT) ;WRAP AROUND FROM LAST POS. TO FIRST. + MOVEM A,TPVP(TT) + POPJ P, + +TYOMVB: CAMN TT,TTYLPP(I) ;^PB - MOVE BACK. + PUSHJ P,TYOMVC + SOSL B,TPHP(TT) .SEE TPHB;(TT) + POPJ P, + MOVE A,TCMXH(I) .SEE TPHE;(TT) ;WRAP AROUND FROM FIRST TO LAST. + SUBI A,2 + MOVMM A,TPHP(TT) +TYOMVU: CAMN TT,TTYLPP(I) ;^PU - MOVE UP. + PUSHJ P,TYOMVC + SOS B,TPVP(TT) + MOVE A,TCMXV(I) .SEE TPVE;(TT) ;WRAP AROUND FROM FIRST TO LAST. + SUBI A,1 + CAIL A,119. + MOVEI A,118. + CAMGE B,TPVB(TT) + MOVEM A,TPVP(TT) + POPJ P, + +TYOSPS: MOVE B,TPHP(TT) ;^PS - SAVE CURSOR POS. + HRL B,TPVP(TT) + MOVEM B,TPSP(TT) + POPJ P, + +TYORPS: CAMN TT,TTYLPP(I) ;^PR - RESTORE CURSOR POS FROM SAVED. + PUSHJ P,TYOMVC + MOVE B,TPSP(TT) + HRRZM B,TPHP(TT) + HLRZM B,TPVP(TT) + POPJ P, + +TYOCPA: CAMN TT,TTYLPP(I) ;ADVANCE TO FRESH LINE, IN ANY CASE CLEAR REST OF LINE + PUSHJ P,TYOMVC + SKIPE TPHP(TT) ;IF NOT AT THE BEGINNING OF A LINE, + JRST TYOCRL ;CRLF. MAYBE SOMEDAY THIS WILL CHECK + JRST TYOCEL ;WHETHER ANYTHING HAS YET BEEN TYPED ON THIS LINE. + +TYOCLR: TLNN H,%TOMVU ;^PC - CLEAR SCREEN. + JRST [ MOVE A,TCMXV(I) ;ON PRINTING TTYS, JUST CRLF. + SUB A,TTYROL(I) ;BUT DON'T --MORE-- UNTIL THIS LINE + MOVEM A,TPVM(TT);GOES OFF THE SCREEN + JRST TYOCRL ] + SKIPN TPVB(TT) ;USE FAST METHOD IF REALLY CLEARING WHOLE SCREEN + JRST TYOCIM +TYOCI1: PUSHJ P,TYOHMU +TYOCEF: SKIPA A,[%TDEOF] ;^PE CLEAR EOF +TYOCEL: MOVEI A,%TDEOL ;[ ^P] - CLEAR EOL. + TLNN H,%TOERS + JRST TYOFNR +TYONMV: CAME TT,TTYLPP(I) ;HERE FOR CHARS THAT DON'T MOVE THE CURSOR + PUSHJ P,TYOASS ;BUT DO DEPEND ON BEING PRINTED AT THE RIGHT PLACE ON THE SCREEN +TYORU1: PUSHJ P,TYOOUT + JRST TYOFNA + +TYOCIM: PUSHJ P,TYOHMU ;CLEAR WHOLE SCREEN + MOVEM TT,TTYLPP(I) + SETOM TTYLPS(I) + MOVEI A,%TDCLR + JRST TYONMV + +TYOHMU: SETZM TPVM(TT) ;^PT - HOME UP + CAMN TT,TTYLPP(I) + PUSHJ P,TYOMVC ;GO TO COLUMN 0, + MOVE B,TPVB(TT) ;LINE 0. + MOVEM B,TPVP(TT) + +TYORCR: TLNE H,%TORAW ;GO TO COLUMN 0 - CR IN IMAGE MODE. + JRST [ CAME TT,TTYLPP(I) + PUSHJ P,TYOASS ;NO OPTIMIZATION => + SETZM TPHP(TT) + MOVEI A,%TDRCR ;ARRANGE TO SEND REAL CR. + PUSHJ P,TYONCC + JRST TYOMVC] + CAMN TT,TTYLPP(I) + PUSHJ P,TYOMVC ;ELSE DO CURSOR-MOTION. + SETZ B, .SEE TPHB;(TT) + MOVEM B,TPHP(TT) + POPJ P, + +TYOHMD: PUSHJ P,TYORCR ;^PZ - HOME DOWN. +TYOHD1: MOVE B,TCMXV(I) .SEE TPVE;(TT) + SUBI B,1 + CAIGE B,119. + MOVEM B,TPVP(TT) + POPJ P, + +TYODLB: SKIPN TPHP(TT) ;^PX - DELETE BACKWARD. + PUSHJ P,.+1 ;IN COLUMN 0, DO IT TWICE SO AS TO ERASE THE "!" AND CHAR BEFORE IT + PUSH P,TPHP(TT) + PUSHJ P,TYOMVB + POP P,B + SKIPN B + AOS TPHP(TT) ;IF WRAPPED AROUND, SET TO TCMXH-1 +TYODLF: MOVE B,TPHP(TT) ;^PK - ERASE 1 CHARACTER. + CAML B,TCMXH(I) .SEE TPHE;(TT) ;DO NOTHING AT END OF LINE. + POPJ P, + TLNE H,%TOOVR ;IF CAN'T OVERPRINT, USE SPACE TO ERASE + JRST [ TLNN H,%TOERS + POPJ P, ;OTHERWISE, USE SPECIAL CONTROL SEQUENCE IF KNOWN + MOVEI A,%TDDLF + JRST TYONMV ] + CAME TT,TTYLPP(I) + PUSHJ P,TYOASS + AOS TPHP(TT) + MOVEI A,40 ;USE REALLY SPACE, NOT CURSOR MOTION! + PUSHJ P,TYOOUT + PUSHJ P,TYOMVB ;THEN BACKSPACE OVER IT + JRST TYOFNX + +SUBTTL .STATUS AND IOPDL FOR TTY + +;2.4 HAS "TTY" +;2.3 DDT MODE ON INPUT +;(STATYI);2.5 CHRS HAVE BEEN ITYI'ED BUT NOT .IOT'ED (STATYI) + ;2.8 TELETYPE NEXT TO 340 OR 340 SLAVE + ;2.9 TELETYPE IS LOCAL, NOT DIAL IN + +STATYO: ANDI A,77 + CAIN A,%TINON ;IF CHANNEL HAS NO REAL TTY, + POPJ P, ;THERE ARE NO SPECIFICS WE CAN SAY. + SKIPN B,TORM(A) + TRO D,1_9. ;BUF CAP FULL + CAIN B,TOBS + TRO D,1_<9.+1> ;BUFFER CAP EMPTY +STATY1: SKIPL TTYTBL(U) + TRO D,1_<9.+3> ;HAS TTY + IORI D,SNTTY + MOVE H,TTYOPT(A) + TLNE H,%TOERS + TRC D,SNTTY#SNTDS + POPJ P, + +STATYI: ANDI A,77 + CAIN A,%TINON ;CATCH "DISOWNED" TTY CHNLS. + POPJ P, + TRO D,1_<9+1> ;ASSUME BUF CAP EMPTY + SKIPN B,TICC(A) ;SEE IF THERE ARE ANY INPUT CHARACTERS + JRST STATY2 ;NOT INCLUDING COM MODE ECHO + MOVE E,TIOP(A) +STATY3: CAMN E,TIBEP(A) + SUBI E,TIBL + ILDB TT,E + TLNN TT,%TXIGN + TRZA D,1_<9+1> ;INPUT SEEN, BUF CAP NOT EMPTY + SOJG B,STATY3 +STATY2: CAIL B,TIBS-10. + TRO D,1_9. ;BUF CAP NEARLY FULL + LDB B,[400400,,TTYTYP(A)] ;GET LOCAL AND 340 MDS + DPB B,[160400,,D] ;DEPOSIT IN STATUS WORD + CONO PI,TTYOFF + MOVE TT,TICC(A) + CAMLE TT,TINTC(A) + TRO D,20000 ;MORE CHRS HAVE BEEN ITYI'ED THAN .IOT'ED + CONO PI,TTYON + JRST STATY1 + +;TELETYPE IO PUSHDOWN ROUTINES + +TYOIOP: TDZA A,A ;OUUTPUT CHNL. +TYIIOP: MOVEI A,TYIMSK-TYOMSK ;INPUT CHNL, SET TYIMSK INSTEAD TYOMSK. + CONO PI,CLKOFF ;TO PREVENT TELETYPE (IF CONSOLE) FROM MOVING AROUND + JUMPGE B,TYIOP1 ;JUMP IF OPEN AS DEVICE + SKIPGE TTYTBL(U) ;IF PROCEDURE DOESN'T HAVE CONSOLE, + JRST CLKONJ ;THEN THAT'S ALL +TYIOP1: LDB E,[$TIIDX,,B] ;GET TTY NUMBER IN E + ADDI E,(A) ;IF INPUT, TYOMSK(E) WILL BE TYIMSK VAR. + HRRZ R,UUAC(U) ;GET "AC FIELD" (IO PUSHDOWN ROUTINES RESTORE R) + MOVE A,CHNBIT(R) ;GET RELEVANT CHANNEL INTERRUPT BIT + XCT TYIOPT(I) ;IORM OR ANDCAM A TO TYOMSK(E) + JRST CLKONJ ;RETURN + +TYIOPT: ANDCAM A,TYOMSK(E) ;IOPUSH (PSEUDO-CLOSE) + IORM A,TYOMSK(E) ;IOPOP (PSEUDO-OPEN) + +;STY IO PDL ROUTINES + +STYOIP: TDZA A,A +STYIIP: MOVEI A,STYMSK-STYOMS + ADDI A,STYOMS-NFSTTY-TYOMSK + JRST TYIOP1 + +SUBTTL TTY CLOSE ROUTINES + +;INPUT CLOSE + +TYICLS: JSP E,TYCLOS ;IGNORE FOR DISOWNED CONSOLE + ANDCAM B,TYIMSK(A) ;INDICATE CHANNEL CLOSURE + JRST TYICL2 + +TYCLOS: LDB I,[210100,,A] + ANDI A,77 ;THROW AWAY TOP BITS OF IOCHNM WD, GET TTY #. + CAIN A,%TINON ;FOR A CHNL IN A TTYLESS TREE, + POPJ P, ;DON'T SOS ANYONE'S TTNTO. + SKIPGE APRC(U) ;SKIP UNLESS DISOWNED + JUMPN I,[JRST 4,.] ;DISOWNED JOB HAS REAL CONSOLE TTY? + SKIPGE TTYTBL(U);IF IT'S A CONSOLE AND THIS JOB DOESN'T + JUMPN I,TYICL2 ;HAVE TTY, DON'T CHANGE TYIMSK OR TYOMSK. + HRRZ R,UUAC(U) + MOVE B,CHNBIT(R) ;GET THE BIT TO CLEAR IN TYIMSK OR TYOMSK. + JRST (E) ;RETURN & CLEAR IT. + +;OUTPUT CLOSE + +TYOCLS: JSP E,TYCLOS ;IGNORE FOR DISOWNED CONSOLE + MOVE I,A + SKIPE USER + PUSHJ P,TYOWC ;WAIT A WHILE FOR OUTPUT TO FINISH + ANDCAM B,TYOMSK(A) ;SET OF OUTPUT CHNLS OPEN. +TYICL2: SOSLE TTNTO(A) + POPJ P, ;MORE OPENS ON TTY + SKIPE TTNTO(A) + BUG + MOVE B,TTYSTS(A) + TLNE B,%TSCNS + POPJ P, ;OPEN AS CONSOLE + JRST TTYLO1 + +;WAIT FOR TTY OUTPUT BUFFER TO BE EMPTY, +;BUT TIME OUT IF TTY DOESN'T TYPE OUT FOR 5 SEC. +TYOWC: MOVEM I,EPDL3(U) ;SAVE TTY # FOR TYOW5. +IFN N11TYS,[ + MOVE T,TTYTYP(I) + TRNE T,%TY11T + POPJ P, +] + MOVEI T,TOBS ;WAIT TILL OUTPUT BUFFER EMPTY + PUSHJ P,TYOW5 ;BUT DON'T WAIT TOO LONG. + POPJ P, ;TYOW5 MAY POP1J. + +;TTY # IN A - MAKE THE TTY FREE. +TTYLO1: SETZM TTNTO(A) + SETZM TYIMSK(A) + SETZM TYOMSK(A) + HRLOI B,%TSFRE + IORB B,TTYSTS(A) ;SAY TTY FREE (BUT TTYSTA OFF SO CAN'T ^Z) + PUSHJ P,TTYLFC ;REMOVE TTY FROM COM MODE AND + PUSHJ P,TYIRS0 ;RESET INPUT BUFFER +IFN TTLPTP,[ + CAMN I,LPTTTY ;IF TTY'S THE LPT, IT'S NOT IN USE. + SETOM LPTUSR +] + MOVE T,TTYTYP(I) + TRNN T,%TYSTY + PUSHJ P,TTYIN1 ;RE-INIT USER OPTIONS + TRNE T,%TYDIL\%TYRLM ;DIALUP LINE => MAKE IT PRINTING. + TRNE T,%TYMDM ;UNLESS WE CAN DETECT DISCONNECTS, IN WHICH CASE DO IT THEN. + CAIA + PUSHJ P,NCNSSP +IFN N11TYS,[ + TRNE T,%TY11T + PUSHJ P,NCNSST +] + MOVEI B,SCRCFM + SKIPL TTYSTA(I) + IORM B,SUPCOR ;REQUEST A CONSOLE-FREE MESSAGE. + MOVE A,I ;IN CASE OUR CALLER WANTS TTY # IN A. + POPJ P, + +IFN N11TYS,[ +TTYLO2: MOVE B,TTYTYP(A) ;TTY BEING CLOSED & CNSL FREE MSG NOT NEEDED, + SKIPGE TT11P ;IF IT'S A PDP11-TV TTY + TRNN B,%TY11T + POPJ P, + MOVE I,A ;MAKE ALL JOBS CEASE TO HACK THIS SCREEN + PUSHJ P,NTVWH1 ;B := VIDEO BUFFER NUMBER + BUG + SETZ A, +TTYLO3: LDB C,[$11BY0,,TVCREG(A)] ;VIDEO BUFFER HACKED BY THIS JOB OR 377 + CAMN C,B + SETOM TVCREG(A) ;IF JOB HACKING THIS VIDEO BUFFER, MAKE IT STOP. + ADDI A,LUBLK + CAMGE A,USRHI + JRST TTYLO3 + MOVE B,TT11HD ;TELL THE 11 THE TTY IS FREE. + ADDI B,1-NF11TY(I) + ADD B,TT1111 + HRROI T,-1_4+10 ;SET TTY'S PHYSLC WORD TO -1. + MOVEM T,(B) + MOVE T,TOBBP(I) ;RESET OUTPUT BUFFER POINTER TO BEGINNING OF + MOVEM T,TOIP(I) ; BUFFER. THE 11 DOES ALSO. + POPJ P, +] + +;REMOVE A TTY FROM COM MODE IF IT IS COM MODE. +;CALLED WHEN TTY BECOMES FREE, ETC. +;TAKES TTY # IN A; LEAVES IT IN A AND I. +TTYLFC: HRRZ I,A + CONO PI,TTYOFF + SKIPL Q,TTYCOM(I) + JRST TTLFC1 + PUSH P,I + PUSH P,U + PUSHJ P,TYCSET + TLZ Q,%TCCBK+%TCTPN+%TCCBS + MOVEM Q,TTYCOM(I) ;FLUSH COM MODE TEMP FLAGS. + PUSHJ P,TYCGTM ;REMOVE THE TTY FROM COM LINKS. + POP P,U + POP P,I +TTLFC1: MOVE A,I + MOVEI B,TTYI + MOVEM B,TTYIPC(A) + POPJ P, + +SUBTTL TTY RESET ROUTINES + +;TTY INPUT RESET + +TYIRS: PUSHJ P,TTYWR + POPJ P, ;IGNORE IF WE DON'T OWN THE TTY. +TYIRS0: MOVSI T,%TCLFT+%TCICO + PUSHJ P,TTYCMW ;MAYBE WAIT FOR COM LINK TO FINISH. RETURN WITH TTYCHN OFF. + PUSHJ P,TYIRS1 ;DISCARD THE INPUT. + JRST TTYONJ + +;; DISCARD THE CONTENTS OF THE TTY INPUT BUFFER. TTY NUMBER IN I. +TYIRS1: MOVE B,TIIP(I) ;Get input pointer. + MOVEM B,TIOP(I) ;Bash output ptr to it. + MOVEM B,TINTP(I) ;Bash interrupt-peeked ptr to it. + MOVEM B,ECHOP(I) ;Bash echo ptr to it. + SETZM ECHOC(I) ;Nothing to echo. + CLEARM TICC(I) ;Nothing has been input. + CLEARM TACC(I) ;No activation chars either. + CLEARM TINTC(I) ;Nothing to ITYIC either. + POPJ P, + +;OUTPUT RESET + +TYORS: PUSHJ P,TTYWR ;CHECK FOR OWNING TTY. TTY NUMBER IN I. + POPJ P, ;NON-SKIP MEANS NO; IGNORE THE .RESET. + SKIPL TTOALC(I) + PUSHJ P,UFLS + MOVSI T,%TCLFT+%TCOCO+%TCICO+%TCFPD ;ALSO WAIT FOR OUTPUT SEQ TO FINISH. + PUSHJ P,TTYCMW ;HANG UNTIL OUT OF COM MODE, OR OVER-RIDDEN. MAY UTCOFF. + MOVSI B,%TJCP1+%TJCP2+%TJSTP ;IF LAST CHAR THIS CHNL WAS ^P, + ANDCAM B,(R) ;FORGET IT. ALSO UNHANG CHANNEL FROM **MORE**. + MOVE TT,I + IMULI TT,TPLEN*2 + MOVEI B,%TFEOP+%TFIGL ;RESTORE BOTH PCS OF PPR TO NORMAL STATE. + ANDCAM B,TPFLAG(TT) + ANDCAM B,TPFLAG+TPLEN(TT) + MOVE B,TTYOPT(I) ;IS OUTPUT RESET SUPPOSED TO DO SOMETHING? + TRNN B,%TPORS ;(ON FAST TTYSS IT DOESN'T) + JRST UTCONJ + MOVE B,TTYCOM(I) + TLNE B,%TCECH + JRST UTCONJ +TYORS1: MOVE B,TOOP(I) ;SCAN BACKWARD 4 CHARS FROM TOOP TO SEE IF A %TDMOV + MOVEM B,TOIP(I) + MOVEI TT,TOBS-4 ;HAS BEEN PARTIALLY REMOVED FROM THE BUFFER. + MOVEM TT,TORM(I) ;TORM HAS THE RIGHT VALUE ASSUMING A %TDMOV APPEARS + ;JUST BEFORE TOOP - THE FIRST PLACE WE WILL LOOK FOR ONE. +TYORS4: LDB T,B + CAIE T,%TDMV0 + CAIN T,%TDMV1 + JRST TYORS8 + CAIN T,%TDMOV ;IF ONE IS FOUND IN THOSE 4 CHARS, IT MUST EXTEND PAST TOOP, + JRST TYORS5 ;SO TAKE TOOP AND INCREMENT IT TO GET NEW TOIP. + IBP B ;DBP B - KNOWING THAT THERE ARE 4 BYTES/WORD. + IBP B + IBP B + SUBI B,1 + CAMN B,TOBBP(I) + MOVE B,TOBEP(I) + AOS TT,TORM(I) ;AS THE %TDMOV GETS FARTHER BACK, ITS REMNANT OCCUPIES LESS SPACE. + CAIE TT,TOBS ;IF ITS REMNANT TAKES NO SPACE, FORGET ABOUT IT. + JRST TYORS4 + JRST TYORS6 + +TYORS8: ADDI TT,2 ;THIS REMNANT IS TWO CHARS LONG + CAIL TT,TOBS + JRST [ MOVEI TT,TOBS + MOVEM TT,TORM(I) + JRST TYORS6 ] + MOVEM TT,TORM(I) +TYORS5: SUBI TT,TOBS ;TT GETS - + MOVE B,TOOP(I) +TYORS7: CAMN B,TOBEP(I) ;SCAN FORWARD FROM TOOP TO FIND END OF REMNANT + MOVE B,TOBBP(I) + IBP B + AOJL TT,TYORS7 + MOVEM B,TOIP(I) ;AND FLUSH FROM BUFFER ALL BUT THAT REMNANT. +;DROPS THROUGH + ;DROPS IN +TYORS6: MOVE B,TCTYP(I) ;IF A "SOFTWARE" TTY, SEND A %TDORS. + CAIE B,%TNSFW + JRST [ MOVE B,TTYTYP(I) + TRNN B,%TYSTY ;ELSE, ON A STY, IF %SSORS + JRST TYORS2 + MOVE B,STYSTS-NFSTTY(I) + TLNN B,%SSORS + JRST TYORS2 + JRST .+1] ;THEN SEND %TDORS + SOS TORM(I) + MOVE B,TOIP(I) + CAMN B,TOBEP(I) + MOVE B,TOBBP(I) + MOVEM B,TOIP(I) ;CHECK FOR WRAP + MOVEI B,%TDORS ;RESET CODE + IDPB B,TOIP(I) + PUSHJ P,TYORS2 ;FINISH RESETTING, TURN TTYCHN BACK ON, + AOSN TTYOAC(I) ;AND ACTIVATE INT. LEVEL, SO %TDORS WILL BE SENT. + XCT TTYST(I) ;(THIS MAY TURN TTYCHN OFF AND ON AGAIN). + MOVE B,TTYOPT(I) + TRNN B,%TPCBS ;ON SOFTWARE TTY WITH ^\ TURNED ON, STOP TYPEOUT AT M.P. + POPJ P, ;LEVEL UNTIL THE TTY SAYS WHAT ITS CURSOR POSITION IS NOW, + HRRZS TTOALC(I) ;USING ^\^P... OR SCPOS + POPJ P, + +TYORS2: SKIPGE TT,TTYLPP(I) + SETCMB TT,TTYLPP(I) + SKIPL B,TTYIHP(I) ;AND UNDO MAIN PRGM CURSOR POS MVT + CAMGE B,TCMXH(I) + JRST TYORS3 + MOVE B,TCMXH(I) + SUBI B,1 + MOVEM B,TTYIHP(I) +TYORS3: MOVEM B,TPHP(TT) + MOVE B,TTYIVP(I) + CAML B,TCMXV(I) + BUG + MOVEM B,TPVP(TT) + SETOM TTYLPS(I) + JRST UTCONJ + +;SEND A %TDINI TO ALL TTYS. CALLED AT SYSTEM STARTUP. +TTRSAL: MOVSI I,-NCT +TTRSA1: MOVE T,TCTYP(I) + MOVE H,TTYOPT(I) + MOVE Q,TOIP(I) + CONO PI,TTYOFF + MOVEI A,%TDINI + PUSHJ P,TYOOU1 ;YES, SEND IT A REINIT CHARACTER + MOVEM Q,TOIP(I) + CONO PI,TTYON + AOSN TTYOAC(I) + XCT TTYST(I) ;AND MAKE SURE IT GETS SENT TO THE TTY +TTRSA2: AOBJN I,TTRSA1 + POPJ P, + +SUBTTL TV-11 INPUT PROCESSOR + +IFN N11TYS,[ +;CALL HERE FROM CLOCK LEVEL WHEN THERE IS INPUT FROM THE PDP-11. +;TAKE CHARACTERS FROM THE PDP11 AND CALL THE TTY INPUT INT. LVL. +;ROUTINES WITH THEM ONE AT A TIME. MAY CLOBBER ANY ACS. +TT11IN: SKIPL TT11P ;IF 11 DOWN, DON'T LOOK FOR INPUT FROM IT. + JRST TT11D1 + LDB TT,[$11WD0,,@TT11HD] + SETZM @TT11HD ;GET AND RESET CHAIN OF INPUT BUFFERS. +;HANDLE THE NEXT INPUT BUFFERFULL. PDP11 ADDRESS IN TT. +TT11I1: LSH TT,-2 ;CONVERT PDP11 ADDRESS TO PDP10 ADDR. + ADDI TT,TT11LO + MOVE A,(TT) ;GET -<# CHARS IN BUFFER> + ASH A,-24 + LDB I,[$11WD0,,2(TT)] ;GET # OF TTY THE CHARS ARE FOR. + CAML A,[-400] ;IF A OR I IS RIDICULOUS, + CAML I,TT1111 + JRST TT11LS ;ASSUME 11 HAS CRASHED. + JUMPG A,TT11LS + ADDI I,NF11TY + MOVEI B,3(TT) ;SET UP BP TO DATA AREA OF BUFFER. + HRLI B,$11WD1 ;EACH CHAR IS 16. BITS - A PDP11 WORD. + PUSH P,TT ;SAVE BUFFER ADDR SO CAN FIND NEXT BFR. + CAIL I,NF11TY+N11TYS + JRST [ MOVE A,I ;IF 11 KNOWS MORE TV'S THAN 10, IGNORE THOSE 10 ISN'T USING. + PUSHJ P,TTYLO2 ;AND IF THE 11 STARTS USING ONE, FREE IT SO USER ISN'T CONFUSED. + JRST TT11I3] + CONO PI,TTYOFF-1 + JUMPE A,TT11I4 + PUSH P,I + PUSH P,A + PUSH P,B +TT11I2: ILDB A,(P) ;GET NEXT CHAR FROM BFR, + MOVE I,-2(P) + PUSHJ P,NTYI5 ;PRETEND IT CAME FROM A TTY CONTROLLER INT., + AOSE -1(P) + JRST TT11I2 ;MORE CHARS => HANDLE THEM. + SUB P,[3,,3] +TT11I3: CONO PI,TTYON-1 + POP P,A ;ADDR. OF BUFFER JUST EMPTIED. + LDB TT,[$11WD1,,1(A)] ;GET ADDR OF NEXT BUFFER. + SETZB B,(A) ;THIS BUFFER NOW FREE. + DPB B,[$11WD1,,1(A)] + JUMPN TT,TT11I1 ;LOOK AT NEXT ONE, IF ANY. + POPJ P, + +TT11I4: PUSHJ P,TYPEND ;INPUT BUFFER WITH 0 CHARS SAYS OUTPUT BUFFER + JRST TT11I3 ;IS EMPTY, SO MAYBE REQUEST ECHOING. + +TT11LS: MOVEM A,TT11ER ;LEAVE DIAGNOSTIC INFO BEHIND + MOVEM I,TT11ER+1 + MOVEM TT,TT11ER+2 + MOVE A,(TT) + MOVEM A,TT11ER+3 + MOVE A,1(TT) + MOVEM A,TT11ER+4 + MOVE A,2(TT) + MOVEM A,TT11ER+5 +TT1LS1: SETZM TT11P ;MARK 11 DOWN AND DONT TRY TO COME BACK UP FOR NOW + MOVEI A,SCR11D ;MAKE SYS JOB PRINT "11 WENT DOWN" MESSAGE. + IORM A,SUPCOR +TT11D1: MOVEI A,TT11HD+1 ;MAKE SURE CLOCK LEVEL DOESN'T THINK + MOVEM A,TT11HD ;THAT THE 11 IS SENDING INPUT. + POPJ P, +] + +SUBTTL TERMINET MOTOR CONTROL + +;COME HERE FROM VERY SLOW CLOCK (2 MIN.), RUNNING IN SYS JOB. +;TURN OFF MOTORS OF ALL TERMINETS THAT HAVE BEEN IDLE 30. SEC. +;MAY CLOBBER ANY ACS. +TTTMNT: MOVE TT,TIME + SUBI TT,900. ;TT=30. SECONDS AGO. + CAIA +TTTMN2: MOVE TT,TIME ;TURN OFF ALL TERMINETS AT SYSTEM STARTUP. + MOVSI I,-NCT +TTTMN0: MOVE T,TCTYP(I) + CONO PI,TTYOFF + SKIPL SHUTDN + CAML TT,TTLTM(I) ;IF TTY HAS OUTPUT RECENTLY + CAIE T,%TNTRM ;OR ISN'T A TERMINET, + JRST TTTMN1 ;NOTHING TO DO. + MOVSI T,%TCMTR + TDNE T,TTYCOM(I) ;DITTO IF MOTOR ALREADY OFF. + JRST TTTMN1 + IORM T,TTYCOM(I) + MOVE H,TTYOPT(I) + MOVE Q,TOIP(I) + MOVEI A,%TDMTF ;PUT A MOTOR-OFF COMMAND IN OUTPUT BFR + PUSHJ P,TYOOU1 + MOVEM Q,TOIP(I) + CONO PI,TTYON + AOSN TTYOAC(I) + XCT TTYST(I) ;AND TELL INT. LVL. ABOUT IT. +TTTMN1: CONO PI,TTYON + AOBJN I,TTTMN0 + POPJ P, + +;CALL HERE WHEN ABOUT TO OUTPUT TO A TERMINET WHOSE MOTOR IS OFF +;TTY # IN I. LEAVES TTY'S TTYCOM IN Q. +TTTMTO: MOVE Q,TOIP(I) + MOVEI A,%TDMTN + MOVE H,TTYOPT(I) + PUSHJ P,TYOOU1 ;PUT MOTOR-ON CMD IN OUTPUT BFR, + MOVEM Q,TOIP(I) + MOVSI Q,%TCMTR ;MOTOR NOW ON AS FAR AS MAIN PRGM + ANDCAB Q,TTYCOM(I) ;IS CONCERNED. + POPJ P, + +SUBTTL PI-LEVEL ECHOING + +;ECHOING - CALLED AT CLOCK LEVEL. MAY CLOBBER ANY AC. +;ECHOES CHARS BY COPYING THEM FROM INPUT BFR TO OUTPUT BFR. +TTECH: MOVSI I,200000 ;GET LIST OF TTYS NEEDING ECHO, AND REINIT IT. + EXCH I,TTERQS +TTELUP: AOS NTTELU ;TAKE STATISTICS. + CAIL I,-1 + POPJ P, ;NO MORE TTYS NEED ECHOING. + ;I HAS IDX OF A TTY NEEDING ECHOING. +IFN N11TYS,[ + MOVE T,TTYTYP(I) + TRNE T,%TY11T + JRST TTELU3 +TTELU4: ] + MOVEI A,TOBS + MOVSI T,%TCECH + TDNE T,TTYCOM(I);CAN'T ECHO UNLESS OUTPUT BUFFER HAS ENOUGH ROOM, + MOVEI A,TYOWNC+1 + CAMG A,TORM(I) ;NO MAIN PROGRAM OUTPUT IN IT, + SKIPL TTOALC(I);OUTPUT NOT BLOCKED AT M.P. LEVEL, + JRST TTEDU4 + SKIPL TYOSW(I) ;AND NO MORE OUTPUT COMING SOON. + JRST TTEWAT ;PUT TTY BACK ON LIST. + MOVE H,TTYOPT(I) + MOVE Q,TTYCOM(I) + TLNE Q,%TCMTR ;IF TTY'S MOTOR IS OFF, TURN IT ON. + PUSHJ P,TTTMTO + MOVEI J,TTEDMY ;PROVIDE IOT RTNS WITH VARIABLE-BLOCK. + SKIPGE TT,TTYLPP(I) ;TT HAS IDX OF MOST RECENTLY USED PC PPR + SETCM TT,TTYLPP(I) ;WHETHER NOW ASSOCIATED OR NOT. + MOVE A,TPVB(TT) ;PERHAPS MOST RECENT PC PPR IS ECHO AREA, + CAMN A,TCMXV(I) ;BUT THERE'S NO ECHO AREA NOW. IN THAT CASE, + SUBI TT,TPLEN ;MAKE SURE DON'T TRY TO FORCE OUT BUFFERED CURSOR POS IN THAT PC PPR. +TTEDU2: TLZE Q,%TCDNG ;SHOULD BELL BE TYPED BECAUSE INPUT BFR FULL? + PUSHJ P,[MOVEM Q,TTYCOM(I) + MOVEI R,%TJECH+%TJMOR + MOVEI A,^G ;DING ON TTY IF DESIRED. + JRST TYO8] +TTELP1: SKIPN T,ECHOC(I) ;ANY CHARS TO BE ECHOED NOW IN INPUT BFR? + JRST TTEDUN ;NO, FINISHED ECHOING. + SKIPG T + BUG ;ECHOED MORE CHARS THAN THERE WERE? + AOS NTTEL1 +;NOW FIND NEXT CHARACTER NEEDING PI ECHO, +;AND MARK IT AS NO LONGER NEEDING IT. +;CAN EXIT TO TTEDU5 IF MUST STOP ECHOING BECAUSE ECHOING IS DEFERRED. + CONO PI,TTYOFF-1 ;PREVENT INTERACTION WITH INPUT INTERRUPTS. + MOVE B,ECHOP(I) +TTELP2: MOVE C,TICC(I) + CAMN B,TIIP(I) + JRST TTELBG + MOVE C,B + CAMN B,TIBEP(I) ;LOOK FOR 1ST CHAR NEEDING PI ECHO. + SUBI B,TIBL + ILDB A,B + TRZN A,%TXPIE + JRST TTELP2 + TRNN A,%TXIGN ;DON'T ECHO NON-COM-MODE CHARS + JRST [ MOVE T,TTYSTS(I) ;IF ECHOING BEING DEFERRED. + TLNE T,%TSNOE + TLNE H,%TOHDX ;BUT IF HALF-DUPLEX, IT ECHOES IN ANY CASE. + JRST .+1 + JRST TTEDU5] + SOSGE ECHOC(I) ;FOUND ONE; NOW ECHO IT. + BUG + MOVEM B,ECHOP(I) + DPB A,B ;MARK IT AS ECHOED. + LDB A,B ;CHECK FOR HARDWARE LOSSAGE. + TRNE A,%TXPIE + BUG ;DPB OR TRZN LOST?? + TRNN A,%TXIGN ;IF CHAR IS IN BFR ONLY TO BE ECHOED, + JRST TTELP5 + CAMN C,TIOP(I) ;IF IT'S 1ST CHAR IN CUFFER, + JRST [ PUSHJ P,TYIRE1 ;REMOVE IT THE NORMAL WAY. + JRST TTELP5] + CAMN B,TIIP(I) ;IF CHAR IS LAST CHAR IN BFR, + PUSHJ P,TTEBAK ;DELETE IT, & MAYBE OTHERS BEFORE IT. +TTELP5: CONO PI,TTYON-1 +;DECIDE WHICH PC PPR TO USE. + MOVE T,I + IMULI T,2*TPLEN ;COMPUTE INDEX OF M.P. PC-PPR. + SKIPGE Q,TTYCOM(I) ;COM MODE, UNLESS %TCICO OR %TCLFT, MEANS USE M.P. AREA. + TDNE Q,[%TCICO+%TCLFT,,400000] + MOVE T,TTYEPP(I) ;OTHERWISE USE THE ECHO AREA IF ANY. + MOVE B,TTYSTS(I) + TRNN A,%TXECI + TRNN A,%TXIGN ; FOR ^_ COMMANDS, DON'T OBEY %TSNEA. + TLNN B,%TSNEA ; %TSNEA SAYS USE M.P. AREA. + JRST TTELP4 + MOVE T,I + IMULI T,2*TPLEN +TTELP4: SKIPGE TT,TTYLPP(I) ;TT GETS LAST PC PPR HACKED WITH THIS TTY. + SETCA TT, + CAMN TT,T ;IF WE ARE SWITCHING TO A DIFFERENT PC PPR, + JRST TTELU1 + SKIPL TTYLPP(I) ;DISASSOCIATE THE OLD ONE IF NEC. + PUSHJ P,TYOMVC +TTELU1: MOVE TT,T ;MOST RECENT PC PPR NOW ECHOING PC PPR. + MOVSI Q,%TCECH ;NOW DEFINITELY GOING TO PUT CHARS IN OUTPUT BUFFER + IORB Q,TTYCOM(I) + MOVEI R,%TJECH+%TJMOR + TLNN H,%TOHDX ;ON HALF-DUPLEX TTYS, EXCEPT FOR + JRST TTELP3 + TRNN A,%TXCOM ;CHARS PRODUCED BY COM LINKS, + PUSHJ P,[IORI R,%TJHDE + JRST TYOAS5] ;MOVE CURSOR BUT DON'T REALLY OUTPUT. + ;THUS, CURSOR MOTION DUE TO ECHOING BY TTY + ;IS ACCOUNTED FOR. +TTELP3: LDB B,[.BP %TXASC,A] + TRNE A,%TXECI + JRST TTELP6 + TRZE A,%TXIGN + CAIE B,^L ;^L ECHOED IN COM MODE SHOULD CLEAR SCREEN. + TRZA R,%TJCP1 + JRST [ MOVEI A,"C ;(BY SIMULATING A ^PC). + IORI R,%TJCP1 + JRST .+1] +TTELP6: ANDI A,%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC + PUSHJ P,TYO8 + TRZE R,%TJHDE + PUSHJ P,TYOMVC + SKIPN ECHOC(I) + JRST TTEDUN +IFN N11TYS,[ + TRNE H,%TP11T + JRST [ PUSHJ P,TYOWN1 + LDB B,T + CAIE B,1_TT11BY-1 + JRST TTEDU6 ;LESS THAN 20. FREE SPACES IN BFR => GIVE UP. + JRST TTELP1] +] + MOVE A,TORM(I) + CAIGE A,TYOWNC ;IS THERE A CHANCE OUTPUT WOULD HANG UP? + JRST TTEDU4 ;YES, WAIT UNTIL LATER TO ECHO THE REST. + JRST TTELP1 ;NO, ECHO MORE + +TTELBG: BUG PAUSE,[ECHOC is ],OCT,T,[ but ECHOP equals TIIP. TICC=],OCT,C,[. TTY ],OCT,I + SETZM ECHOC(I) +;COME HERE WHEN ALL ECHOING DESIRED ON THIS TTY WAS DONE. +TTEDUN: CONO PI,TTYOFF-1 + SKIPE ECHOC(I) + JRST TTEDU1 +TTEDU5: MOVE Q,TTYCOM(I) + TLNE Q,%TCDNG ;HAS ANOTHER REASON TO ECHO ARISEN AFTER WE CHECKED? + JRST TTEDU1 ;YES, GO PROCESS IT. + PUSH P,TTYERQ(I);SAVE NEXT TTY TO ECHO ON + SETOM TTYERQ(I) ;AND TURN OFF THIS ONE'S ECHO REQUEST + CONO PI,TTYON-1 + SETZ R, + CAME TT,TTYLPP(I) + PUSHJ P,TYOFRC ;FORCE OUT BUFFERED CURSOR MOTION. + POP P,I + JRST TTELUP + +TTEDU4: +TTEDU3: SETO A, ;NO, MOVE TO NEXT TTY ON LIST. + EXCH A,TTYERQ(I) + MOVE I,A + JRST TTELUP + +TTEDU1: CONO PI,TTYON-1 + JRST TTEDU2 + +;COME HERE WHEN CAN'T ECHO BECAUSE TYOSW IS LOCKED. +TTEWAT: AOS NTTEWA + MOVE A,I ;IF WE CAN'T DO ANY. + CONO PI,TTYOFF-1 + EXCH A,TTERQS ;PUT THIS TTY BACK ON LIST, + EXCH A,TTYERQ(I) ;SO IT WIL BE REEXAMINED NEXT TICK. + CONO PI,TTYON-1 + MOVE I,A ;MOVE TO NEXT TTY ON OLD LIST. + JRST TTELUP + +IFN N11TYS,[ +TTELU3: SKIPL TT11P + JRST TTEDU4 ;DON'T ECHO ON PDP11 TTYS IF PDP11 DOWN. + LDB A,TOIP(I) ;DEFER ECHOING UNLESS OUTPUT BFR EMPTY. + CAIN A,1_TT11BY-1 + JRST TTELU4 ;JUMP IF BUFFER EMPTY (LAST CHAR OUTPUT CHANGED TO -1) +TTEDU6: JRST TTEWAT ;TEMPORARY PATCH +.ERR IS THIS PATCH TEMPORARY OR PERMANENT? + MOVE A,TT11HD ;BFR NOT EMPTY: TELL 11 + ADDI A,1-NF11TY(I) ;(BY SETTING ECOFLG) + ADD A,TT1111 + MOVSI B,400000 ;TO SIGNAL TEN WHEN THE BUFFER BECOMES EMPTY. + IORM B,(A) .SEE TT11I4 + JRST TTEDU4 +] +;COME HERE WHEN ARE JUST ABOUT TO ECHO THE LAST CHAR +;IN THE INPUT BUFFER, AND ITS %TXIGN IS SET. +;TRY TO FLUSH THE CHARACTER FROM THE INPUT BFR, +;AND ALSO THE CHARS BEFORE IT, IF THEY TOO HAVE %TXIGN. +TTEBAK: SKIPE C,ECHOC(I) + BUG PAUSE,[ECHOING LAST CHAR BUT ECHOC IS ],OCT,C,[. TTY ],OCT,I + SETZM ECHOC(I) + IBP B ;THIS DEPENDS ON 18-BIT BYTES IN INPUT BUFFER. + SUBI B,1 + CAMN B,TIBEP-1(I) + ADDI B,TIBL + SOSN TICC(I) + JRST TTEBA1 + LDB C,B + TRNE C,%TXIGN + JRST TTEBAK +TTEBA1: MOVE C,TIIP(I) + CAMN C,TINTP(I) + MOVEM B,TINTP(I) + CAME C,ECHOP(I) + BUG + MOVEM B,ECHOP(I) + MOVEM B,TIIP(I) + POPJ P, + +SUBTTL TTY INTERRUPT HANDLING + +;MACRO TO SAVE ACS AND CONI APR ON ENTERING A TTYCHN INTERRUPT ROUTINE. +;PCLOC SHOULD BE THE ADDRESS OF THE STORED PC, WHICH IS MOVED TO TTYBRK. +DEFINE TTYSAV PCLOC=TTYBRK +IFN KL10P,[ + CONSO PI,1_<7-TTYCHN> + JRST 4,. ;HARDWARE BUG ALLEGEDLY FIXED +] +IFN KA10P, CONI TTYAPC + MOVEM A,TTYA + MOVE A,[B,,TTYACS] + BLT A,TTYACS+17-B+1-1 ;SAVE ALL ACS BUT 0 +IFSN PCLOC,TTYBRK,[ + MOVE A,PCLOC + MOVEM A,TTYBRK +] + MOVE P,TTYPDP + PUSH P,[TTYRET] +TERMIN + +EBLK + +TTYBRK: 0 + +BBLK + TTYSAV ;SAVE ACS AND SET UP P. +IFN KL10P,[ + CONSZ DTE,%DBL10+560 + JRST TTDTE1 ;DTE20 INTERRUPTED (DOORBELL OR BYTE TRANSFER ERROR OR DONE) +] ;KL10P +IFN DL10P,[ + CONSZ DLC,10 + JRST TTDLB0 ;DL10 INTERRUPTED +] +IFN TK10P,[ + CONSZ NTY,200000 + JRST NTY1 ;NEW TELETYPE KLUDGE +] +IFN MTYP,[ + CONSZ MTY,50 + JRST MTY1 ;MORTON BOX +] +IFN DPKPP,[ + CONSZ DPK,60 + JRST DPKPE ;PARITY ERROR OR NXM + CONSZ DPK,10 + JRST DPTI1 ;CHAR AVAIL DPK + CONSZ DPK,400 + JRST DPTO1 ;OUTPUT BUFFER FIN DPK +] +IFN NOTYS,[ + MOVEI I,0 + CONSZ TTY,50 + JRST GOTTY +] +IFN NDZTYS,[ +;DZ-11 Code The only place that emulates an interrupt on the TTY interrupt +; channel is the DTE code, handled above, so there should never be a +; need for a DZ11 entry here. +] +; MOVEI J,TTYCHN ;KNIGHT TTY KLUDGE GENERATES SPUR INTS +; JSP E,SPUR ;SPURIOUS INT +TTYRET: +TTYRT3: +IFN KA10P,[ + CONI A + ANDCM A,TTYAPC + TRNE A,220000 ;DID MPV OR PDL OV COME ON DURING THIS INT? + BUG PAUSE,[MPV OR PDL OV IN TTY INT HANDLER, APR CONI=],OCT,A +] ;KA10P + MOVS A,[B,,TTYACS] + BLT A,17 + MOVE A,TTYA + JRST 12,@TTYBRK + +IFN DPKPP,[ +DPKPE: AOS NDPKPE + CONO DPK,60+TTYCHN ;PARITY ERROR OR NXM + JRST TTYRT3 +] + +IFN DZ11P,[ ;DZ-11 Code + +IFE KS10P, .ERR DZ11 code only works on a KS-10. + +$INSRT DZ11 + +REPEAT DZ11NB,[ + +EBLK +CONC DZ,\.RPCNT,RB: 0 +BBLK + MOVEM U,TTYACS-B+U + JSP U,DZRBK + ;; ,,: + NFDZTY+,,CONC DZ,\.RPCNT,BA + +EBLK +CONC DZ,\.RPCNT,XB: 0 +BBLK + MOVEM U,TTYACS-B+U + JSP U,DZXBK + ;; ,,: + NFDZTY+,,CONC DZ,\.RPCNT,BA + +];DZ11NB + +DEFINE DZSAV + MOVEM A,TTYA + MOVE A,[B,,TTYACS] + BLT A,TTYACS-B+ ;SAVE ALL ACS BUT 0, A AND U... + MOVE A,-3(U) ;Get return address + MOVEM A,TTYBRK ;Save it in TTYBRK + MOVE P,TTYPDP ;Stack + PUSH P,[TTYRET] ;Set up return address + HRRZ C,(U) ;Get Unibus address + HLRZ I,(U) ;Get ITS TTY # of first DZtty on this board +TERMIN + +; DZ11 receiver interrupts (actually silo overflow) +DZRBK: DZSAV ;Save ACs and setup parameters + IORDI A,%DZRCS(C) + TRNN A,%DZCRD ;Character ready? + JRST [ AOS DZRSPR ;Count spurious interrupts + POPJ P, ] +DZRBK1: IORDI A,%DZRDR(C) + TRNN A,%DZDDV ;Data valid? + POPJ P, ;Nope, got it all + ; If parity must be hacked, it should be done here + LDB D,[.BP %DZLM,A] ;Get line number + ANDI A,%DZTCM ;Get character + ADD I,D ;Get TTY number + CAIL I,NFDZTY+NDZTYS + BUG + JRST NTYI1 + +; The following code can't work because I found the place where NTYI1 +; clobbers U (Alan 3/26/86): +; +; PUSHJ P,NTYI1 ;Process the input +; HRRZ C,(U) ;Get Unibus address +; HLRZ I,(U) ;Get ITS TTY # of first DZtty on this board +; JRST DZRBK1 + +; DZ11 transmitter interrupts +DZXBK: DZSAV ;Save ACs and setup + AOS DZXINC ;Count interrupts +DZXBK1: IORDI A,%DZRCS(C) + TRNN A,%DZCTR ;Transmitter ready? + POPJ P, + LDB D,[.BP %DZLM,A] ;Get line number + ADD I,D ;ITS terminal number of this line + CAIL I,NFDZTY+NDZTYS + BUG + AOS DZXCHC ;Count characters sent + PUSHJ P,TYPSC ;Merge with the rest of the world + HRRZ C,(U) ;Get UB address of board again + HLRZ I,(U) ;Get ITS TTY # of first DZtty on this board + JRST DZXBK1 ;Try to send another, maybe we'll get lucky + +];DZ11P + +IFN KL10P,[ +;HANDLE INTERRUPTS FROM THE CONSOLE PDP11 VIA THE DTE20 +;CODE FOR HANDLING MULTIPLE CONSOLES, BLOCK TTY OUTPUT, ETC. +;IN THE FUTURE ETHERNET STUFF WILL GET ADDED HERE. + +TTDTE1: CONI DTE,DTECNI ;SAVE FOR DEBUGGING + CONSZ DTE,460 ;TO11 ERROR OR TO10 DONE OR TO10 ERROR + BUG PAUSE,[DTE20 ERROR, CONI=],OCT,DTECNI + CONSZ DTE,100 ;TO11 TRANSFER COMPLETE + JRST [ CONO DTE,100 ;CLEAR TO11 TRANSFER COMPLETE + SETZM DTEBBY ;BUFFER NO LONGER BUSY + JRST .+1 ] + CONO DTE,%DBL10+40 ;CLEAR DTE20 INTERRUPTING STATE + SKIPGE A,DTETYI ;CHECK FOR TTY INPUT AVAILABLE + JRST TTDTE2 + SETOM DTETYI ;AVAILABLE. INDICATE HAS BEEN GOTTEN. + CONO DTE,%DBL11 ;SIGNAL 11 THAT WE'RE READY FOR MORE. + HLRZ I,A ;GET LINE NUMBER + CAIL I,NFETY ;CHECK IT + CAIL I,NFETY+NETYS + BUG PAUSE,[BAD TTY NUMBER ],OCT,I,[FROM PDP-11] + PUSHJ P,NTYI1 ;PROCESS THE INPUT + JRST TTDTE1 ;CHECK FOR MORE + +TTDTE2: MOVEI A,SCRHNG ;IF HANGUP/DIALIN, SIGNAL SYSTEM JOB TO HANDLE IT + SKIPL DTEHNG + IORM A,SUPCOR + SKIPN DTEBBY ;DON'T CHECK FOR OUTPUT DONE IF BUFFER BUSY + SKIPGE A,DTEODN ;CHECK FOR TTY OUTPUT DONE + POPJ P, ;NOTHING, DISMISS INTERRUPT + SETOM DTEODN ;INDICATE SIGNAL HAS BEEN RECEIVED + HLRZ I,A ;GET LINE NUMBER + CAIL I,NFETY ;CHECK IT + CAIL I,NFETY+NETYS + BUG PAUSE,[BAD TTY NUMBER ],OCT,I,[FROM PDP-11] + HRRZS A ;SET UP MULTI-CHARACTER TRANSFER, + HRRZ B,TTOALC(I) ;SETTING MAX# CHARACTERS FROM ELEVEN'S BUFFER SIZE + CAIGE B,(A) ;DON'T SEND MORE CHARACTERS THAN ALLOCATED + MOVE A,B + CAILE A,DTEOBL ;DON'T EXCEED SIZE OF OUR BUFFER + MOVEI A,DTEOBL + MOVEM A,DBBCC + MOVEM A,DBBCC1 + MOVE A,[441000,,DTEOBF] + MOVEM A,DBBBP + JRST TYP ;GO FILL OUTPUT BUFFER +];KL10P + +IFN DL10P,[ +;HANDLE THE DL-10 (A PDP-11 FRONT END FOR THE KL-10). +;ALL INTERRUPTS FROM DL-10 COME HERE. + +TTDLB0: CONO DLC,10+TTYCHN ;CLEAR INTERRUPT FLAG + SKIPN DL10F ;IGNORE DL10 IF IT IS MARKED OUT OF SERVICE. + POPJ P, +IFN CHAOSP, IFN DLCP, PUSHJ P,DLCWAK ;SEE IF INTR IS FOR CHAOS NET +IFN T300P,[ ;CHECK FOR T-300 INTERRUPT, PASS TO DISK LEVEL IF SO + SKIPE DSCDON + CONO PI,DSKRQ +];T300P + SKIPE I,DL10IL ;IS INPUT AVAIL? IF SO, READ WHICH LINE + PUSHJ P,TTDLIN ;AND PROCESS THE CHARACTER. + MOVEI A,SCRHNG ;DOES THE 11 SAY A MODEM WAS DISCONNECTED? + SKIPE DL10CL + IORM A,SUPCOR ;IF SO, TELL SYS JOB TO TAKE APPROPRIATE ACTION. + SKIPN DL10LN ;DON'T CHECK OUTPUT-DONE IF OUTPUT BUFFER IS BUSY + SKIPN I,DL10OD ;OUTPUT DONE ON SOME TTY? + POPJ P, + MOVE A,DL10BS ;YES, GET 11'S BUFFER SIZE AND + SETZM DL10OD ;MAKE COMMUNICATION CHANNEL FREE FOR -11 AGAIN + HRRZ B,TTOALC(I) + CAMLE A,B + MOVE A,B ;DON'T SEND MORE CHARACTERS THAN TERMINAL HAS ALLOCATION FOR + MOVEM A,DBBCC ;INIT CHARACTER COUNTERS TO SIZE OF BUFFER IN 11 + MOVEM A,DBBCC1 + MOVE A,[441000,,DL10BF] + MOVEM A,DBBBP ;INIT B.P. USED BY 10 TO STORE INTO BUFFER. + JRST TYP ;GO FILL UP THE OUTPUT BUFFER + +TTDLIN: MOVE A,DL10IC ;GET THE CHARACTER TYPED IN + SETZM DL10IL ;FREE THE INPUT CHANNEL SO 11 CAN USE IT AGAIN. + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + JRST NTYI1 ;AND PROCESS THE INPUT. +] + +IFN DPKPP,[ +DPTO1: CONI DPK,A + LDB I,[220400,,A] + ADDI I,NFDPTY + SKIPL @DPKC-NFDPTY(I) + SETOM @DPKC-NFDPTY(I) + LDB J,[$TTOSP,,TTYTYP(I)] ;GET OUTPUT SPEED CODE. + CAIL J,LDPSPT + MOVEI J,LDPSPT-1 + HRRZ A,TTOALC(I) + CAMLE A,DPSPT(J) + MOVE A,DPSPT(J) ;# CHARS BUFFER SPACE FOR THAT SPEED. + MOVEM A,DBBCC + MOVEM A,DBBCC1 + MOVE A,DBBFP-NFDPTY(I) + MOVEM A,DBBBP ;BP FOR STORING CHARS. + MOVSM A,@DPKP-NFDPTY(I) + JRST TYP0 + +DPTI1: DATAI DPK,A + LDB I,[220400,,A] + ADDI I,NFDPTY + JRST NTYI1 +] +IFN TK10P,[ +NTY1: CONSZ NTY,400000 + POPJ P, ;SCANNER NOT STOPPED + CONI NTY,I ;READ IN TTY # +IFE NNTYS-10,LDB I,[110300,,I] +IFE NNTYS-20,LDB I,[100400,,I] +IFN *,.ERR + CAIL I,NNTYS + BUG + ADDI I,NFNTY ;CALCULATE CONSOLE # + CONO NTY,@TTYLT(I) ;SELECT APPROPRIATE TTY + CONSZ NTY,20 + JRST TYPSC ;DONE FLAG ON TYPEOUT + CONSO NTY,40 + JRST TTYRT2 ;THIS TTY NOT REALLY UNHAPPY + DATAI NTY,A + JRST NTYI1 + +TTYRT2: CONO NTY,200000+TTYCHN + JRST TTYRET +] + +IFN MTYP,[ +MTY1: CONI MTY,I + LDB I,[140500,,I] ;GET SUBDEVICE + CAIL I,NMTYS + JRST MTY2 ;NOT A VALID # + ADDI I,NFMTY + CONO MTY,@TTYLT(I) + CONSO MTY,40 ;INPUT DONE + JRST MTY6 + DATAI MTY,A + JRST NTYI1 + +MTY6: CONSO MTY,10 ;OUTPUT DONE + POPJ P, + HRRZ A,TTOALC(I) + CAILE A,MTYNC + MOVEI A,MTYNC + MOVEM A,DBBCC ;# CHARS CAN GIVE AT ONCE. + MOVEM A,DBBCC1 + SETZM MTYOW ;SET UP WORD TO FILL WITH OUTPUT CHARS. + MOVE A,[440700,,MTYOW] + MOVEM A,DBBBP ;SET UP BP FOR STUFFING THAT WORD. + JRST TYP + +MTY2: CONSZ MTY,10 + JRST MTY3 ;OUTPUT + CONSZ MTY,40 + DATAI MTY,A ;INPUT + POPJ P, ;AND IGNORE + +MTY3: LSH I,12. + CONO MTY,200+TTYCHN(I) ;CLEAR OUTPUT DONE FLAG + POPJ P, +] + +IFN NOTYS,[ +GOTTY: CONSZ TTY,10 + JRST TYPSC ;TTO DONE + CONSO TTY,40 + POPJ P, ;NONE + DATAI TTY,A ;TTI DONE, READ CHR + JRST NTYI1 +] + +;PROCESS INPUT INTERRUPT WITH CHARACTER IN A, TTY # IN I + +OVHMTR TTI ;TTY INPUT INTERRUPT LEVEL + +;ENTER HERE FOR "HARDWARE" TTYS, LOW 8 BITS OF A ARE THE INPUT, OTHER BITS ARE GARBAGE +NTYI1: +IFN NNVTTS,[ + CAME I,NOVATT ;SKIP IF THIS TTY IS NOVA + JRST NTYI3 + TRZE A,200 ;SKIP IF DATA AND NOT TTY # + JRST NTYI2 ;SET TTY # + SKIPGE I,NVIPTT ;CURRENTLY SELECTED CONSOLE ON INPUT + POPJ P, ;NONE SELECTED +NTYI3:] +IFN TTLPTP,[ + CAMN I,LPTTTY + JRST INLPT +] + ANDI A,377 ;FLUSH EXTRANEOUS BITS, KEEP LOW 7 + MOVE H,TTYOPT(I) + TRNN H,%TPMTA ; OR KEEP LOW 8 IF 8TH IS HARDWARE META KEY + ANDI A,177 +;ENTER HERE FOR TTYS WHICH MAY INPUT IN FULL-CHARACTER-SET +NTYI5: MOVEM I,LOCTTY ;TTY CHAR ACTUALLY TYPED ON + MOVSI U,%TSLCZ + ANDCAB U,TTYSTS(I) ;CLEAR LAST CHR ^Z BIT + MOVE Q,TTYCOM(I) + MOVE R,TTYTYP(I) + MOVE H,TTYOPT(I) + TRNE H,%TPMTA ;PROCESS HARDWARE META KEY IF PRESENT + TRZN A,200 + CAIA + IORI A,%TXMTA + ANDI A,%TXCTL+%TXMTA+%TXSUP+%TXTOP+%TXASC ;FLUSH MEANINGLESS BITS. + TLNE H,%TOALT ;IF THIS TTY WANTS IT, MAYBE STANDARDIZE ALTMODES + PUSHJ P,TTYSAM + HRRZ D,TTYIPC(I) + MOVEM D,LTTYIPC ;REMEMBER INPUT RTN FOR DEBUGGING + MOVE D,TYBPC(I) + MOVEM D,LTYBPC + JRST (D) ;PROCESS THE CHARACTER AND RETURN. + +IFN NNVTTS,[ +NTYI2: JUMPE A,CPOPJ + ADDI A,NFNVTY + CAIGE A,NFNVTY+NNVTTS + MOVEM A,NVIPTT ;SELECT CONSOLE + POPJ P, +] + +IFN TTLPTP,[INLPT: MOVE A,TIME + MOVEM A,LPTTIME + POPJ P, +] + +SUBTTL HANDLE ^\ CODES +;OR PASS CHARACTERS ON TO NEXT LEVEL OF INPUT +;PROCESSING IF NO ^\ CODE IS IN PROGRESS. + +;THIS IS THE NORMAL VALUE OF TYBPC FOR ALL TTY'S; IT IS THE ONLY POSSIBLE VALUE +;FOR A TTY WHOSE %TPCBS AND %TPTEL ARE 0. +TYBN: TRNE H,%TPPRN + PUSHJ P,TYBPRN + TRNN H,%TPCBS+%TPTEL + JRST TYBRT2 ;IF NOT ENABLED, JUST PASS CHAR TO NORMAL INPUT LEVEL. +; USED TO CLEAR %TXSFT (NOW %TXSUP) BEFORE CHECKING FOR ^\ +; MOVEI E,(A) +; ANDCMI E,%TXSUP + CAIN A,^\ + TRNN H,%TPCBS + JRST TYBCR1 ;IF NOT AN ENABLED ^\, GO CHECK FOR SPECIAL CR HANDLING + JSP D,TYBRED ;READ THE CHARACTER AFTER THE ^\ + CAIGE A,100 ;^\ FOLLOWED BY @ THROUGH _ IS THE HIGH BITS FOR THE NEXT CHARACTER. + JRST TYBCTL ;^\ FOLLOWED BY A CONTROL CHAR, ETC. IS A SPECIAL HACK. + ANDI A,<%TXCTL+%TXMTA+%TXSUP+%TXTOP>_-7 + LSH A,7+18. ;GET THE EXCESS OVER 100 AND SHIFT BY 7, + HRRI A,TYBPFX ;AND STORE IN LH OF TYBPC + MOVEM A,TYBPC(I) + POPJ P, ;RETURN. NEXT CHAR COMES TO TYBPFX + +TYBPFX: HLRZ D,TYBPC(I) ;GET THE HIGH BITS READ IN LAST TIME + IOR A,D ;AND MERGE INTO THE CHAR JUST READ IN +TYBRET: MOVEI D,TYBN ;RESET ^\ STATUS TO NORMAL +TYBRT1: MOVEM D,TYBPC(I) +TYBRT2: MOVE E,TIME + MOVEM E,TTITM(I) ;UPDATE TIME OF LAST INPUT ON THIS TTY. +;NOW DETECT SPECIAL TOP-CHARS THAT SHOULD NOT ECHO +;AND SHOULD BE IGNORED IN COM MODE OR IN ^_ COMMANDS. + SETZ E, ;WE SET E TO -1 BELOW FOR THOSE CHARACTERS. + MOVE D,TTYSTA(I) + TLNE D,%TANEC ;IF COUNT OF DON'T-ECHO CHARS IS >0, + JRST [ SUB D,[<.DPB 1,.BP %TANEC>,,] ;DECREMENT IT + SETO E, ;AND DON'T ECHO THIS ONE. + JRST TYBRT3] + MOVE E,A ;IS THIS INPUT REALLY FOR LOCAL EDITING PROTOCOL? + ANDI E,%TXTOP+%TXASC ;THAT IS, TOP-E OR TOP-S, OR THE CHARACTER FOLLOWING ONE? + CAIE E,%TXTOP+"E + CAIN E,%TXTOP+"S ;DON'T ECHO OR INTERRUPT FOR TOP-S OR TOP-E, + TLO D,<.DPB 1,.BP %TANEC> ;OR THE CHAR THAT FOLLOWS IT. + CAIN E,%TXTOP+"T ;DON'T ECHO OR INT FOR TOP-T, OR FOLLOWING 3 CHARS. + TLO D,<.DPB 3,.BP %TANEC> + CAIE E,%TXTOP+"Y ;GRAPHICS INPUT CMDS TAKE 5 ARG CHARS. + CAIN E,%TXTOP+"X + TLO D,<.DPB 5,.BP %TANEC> + SETZ E, + TLNE D,%TANEC + SETO E, +TYBRT3: MOVEM D,TTYSTA(I) + MOVEM E,LEPCHR ;LEPCHR IS -1 FOR SPECIAL CHARS THAT SHOULD USUALLY BE IGNORED. + HRRZ D,TTYIPC(I) + JUMPE E,(D) ;IN WHICH CASE, DROP THIS CHAR ENTIRELY + CAIN D,TTYI ;IF IT IS NOT THE NORMAL SORT OF INPUT. + JRST (D) + POPJ P, + +;COME HERE FOR ^\ FOLLOWED BY A CHARACTER < 100. +TYBCTL: CAIN A,^A ;^\^A => ALLOCATE OUTPUT CHARS. + JRST TYBA + CAIN A,^Z ;^\^Z => ZERO ALLOCATION + JRST TYBZ + CAIN A,^I ;^\^I => INFINITY ALLOCATION + JRST TYBI + CAIN A,^R ;^\^R => RESTART OUTPUT AT M.P. LEVEL. + JRST TYBR + CAIN A,^P ;^\^P => SET CURSOR POSITION AND RESTART OUTPUT AT M.P. LEVEL. + JRST TYBP + CAIN A,^\ ;^\^\ => INPUT A ^\. + JRST TYBRET + CAIN A,^C ;^\^C => SCREEN HAS BEEN SURREPTITIOUSLY CHANGED + PUSHJ P,TYBC +;RETURN TO NORMAL ^\ STATUS BUT DON'T PASS ANY INPUT UP TO NORMAL INPUT LEVEL. +TYBXIT: MOVEI D,TYBN +TYBRED: MOVEM D,TYBPC(I) ;JSP D,TYBRED TO WAIT FOR NEXT CHARACTER + POPJ P, + +TYBC: MOVSI D,%TSATY + IORB D,TTYSTS(I) + JUMPL D,CPOPJ + HLLZ E,MSKST(D) + TLZ E,#%PJATY + TLNE D,%TSCNS + IORM E,PIRQC(D) + POPJ P, + +TYBCR1: CAIN A,15 ;SEE IF ENABLED CR + TRNN H,%TPTEL + JRST TYBRT2 ;NO, JUST PASS CHAR TO NORMAL INPUT LEVEL + JSP D,TYBRT1 ;PASS CHAR TO NORMAL INPUT LEVEL BUT HACK NEXT CHAR + CAIE A,12 ;IF IT IS LF OR NULL IGNORE IT + JUMPN A,TYBRET ;BUT OTHERWISE PASS IT TO NORMAL INPUT LEVEL + JRST TYBXIT ;IN ANY CASE RESET TYBPC TO NORMAL + +TYBPRN: LDB E,[.BP %TXASC,A] + CAIE E,"( + CAIN E,"[ + XORI A,"(#"[ + CAIE E,") + CAIN E,"] + XORI A,")#"] + POPJ P, + +;^\^P - SET CURSOR POS, THEN RESTART OUTPUT AT M.P. LEVEL. +;THIS IS THE WAY TO RESPOND TO A %TDORS CHARACTER ON A SOFTWARE TTY, +;SINCE OUTPUT RESET WILL STOP OUTPUT AT M.P. LEVEL ON SOFTWARE TTY'S +;WHICH HAVE ^\ TURNED ON. +TYBP: JSP D,TYBRED ;WAIT FOR VPOS TO COME IN + CAML A,TCMXV(I) + SETZ A, + MOVEM A,TTYIVP(I) + SKIPGE TT,TTYLPP(I) + SETCA TT, + MOVEM A,TPVP(TT) + SKIPGE TTYLPP(I) + HRLM A,TTYLPS(I) + JSP D,TYBRED ;NOW WAIT FOR HPOS TO COME IN + CAML A,TCMXH(I) + SETZ A, + MOVEM A,TTYIHP(I) + SKIPGE TT,TTYLPP(I) + SETCA TT, + MOVEM A,TPHP(TT) + SKIPGE TTYLPP(I) + HRRM A,TTYLPS(I) +TYBR: HRROS TTOALC(I) ;RESTART AT M.P. LEVEL. + PUSHJ P,TYPEN2 ;REQUEUE ECHOING IF NECESSARY + JRST TYBXIT + +TYBZ: HLLZS TTOALC(I) ;SET ALLOCATION TO 0. + JRST TYBXIT + +TYBI: HLLOS TTOALC(I) ;SET ALLOCATION TO INFINITY. + JRST TYBST ;NOW MUST START THE TTY IN CASE IT WAS STOPPED DUE TO NO ALLOC. + +TYBA: JSP D,TYBRED ;^\^A => INCREMENT ALLOCATION BY + MOVE D,TTOALC(I) + TRNN D,400000 ;SKIP IF ALLOCATION = INFINITY + ADD D,A + HRRM D,TTOALC(I) +TYBST: AOSN TTYOAC(I) + XCT TTYST(I) + JRST TYBXIT + +SUBTTL NORMAL TTY INPUT HANDLER +;CLOBBERS A - E, EXPECTS R, U, I SET UP. +;R HAS TTYTYP, U HAS TTYSTS, I HAS # OF TTY. +;Also seems to expect Q/ TTYCOM and perhaps H/ TTYOPT -Alan 12/18/85 + +TTYI: CAIN A,^_ + JRST TTYICB ;CHAR IS ^_, MAYBE ENTER COM MODE. +TTYI2: CAIN A,^Z ;TEST FOR ^Z + JRST ZFLAG ;^Z TYPED +TTYI2A: JUMPL U,CPOPJ ;IGNORE CHAR IF NO USER. + TLNE U,%TSSII ;If in superimage input mode, + JRST TTYI2B ; don't check for magic chars. + CAIN A,%TXCTL+^Z ;Control-CALL is Deferred-Call + JRST [ MOVEI A,%TXACT+%TXPIE+%TXCTL+%TXTOP+"Z ;DEFERRED CALL + JRST TTYI19 ] + CAIN A,%TXTOP+"C ; CLEAR-INPUT does like TYCFLS, flushes + ; input buffer of TTY in I. + JRST TYIRS1 ; TYIRS1 does a POPJ P, for us: Hear no + ; evil, see no evil, echo no evil... +TTYI2B: TLZ A,-1 ;IF WE WERE CALLED FROM ^_-QUOTING RTN, BIT 3.1 WAS + ;SET TO FAKE OUT ABOVE JUNK. FLUSH FAKEOUT BIT. + MOVE E,TIME + MOVEM E,TTITM(I) ;REMEMBER TIME OF LAST TYPE-IN ON TTY. +TTYI11: MOVE E,TICC(I) + CAIL E,TIBS ;SKIP IF ANY ROOM LEFT IN INPUT BUFFER + JRST DING1 + MOVE C,A + ANDI C,%TXTOP+%TXASC + CAIL C,141 ;IF A LOWER CASE CHAR, + CAILE C,172 + JRST TTYI15 + MOVE C,TTYOPT(I) + TLNE C,%TOCLC ;CONVERT TO UPPER CASE IF WANTED + XORI A,40 +TTYI15: MOVE E,UPC(U) + TLZ E,#%PCUSR + CAIN E,NECHO1 ;IS THE JOB EXECUTING AN ECHOIN RIGHT NOW? + SKIPE E,TACC(I) ;IF SO, AND IF IT HASN'T HAD A BREAK CONDITION YET, + JRST TTYI12 + PUSHJ P,TTECIN ;MAYBE STORE CHAR IN USER MEMORY, AND JUST ECHO IT. + MOVEI E,0 ;E 0 IF CALLED TTECIN, NON-0 IF DIDN'T +TTYI12: TRNN A,%TXACT ;IF TTECIN DIDN'T ACTIVATE IT, THEN IGNORE TTYSET BITS + JUMPE E,TTYI19 ;AND DON'T ACTIVATE OR INTERRUPT NO MATTER WHAT. + MOVE C,LEPCHR + JUMPL C,TTYI19 ;JUMP IF LOCAL EDITING PROTOCOL COMMAND CHAR. + PUSHJ P,GETGRP ;GET 6 BIT BYTE FOR GROUP THIS CHARACTER IS IN + TLZE U,%TSINT ;IF WANT THIS CHAR TO INT. WHATEVER IT IS, + IORI B,%TGINT ;PRETEND IT'S AN INT. CHAR. + MOVEM U,TTYSTS(I) + LSH B,14 ;PUT %TXACT, %TXPIE, AND %TXMPE IN. + TRNN A,%TXECI + IORI A,(B) + ANDCMI A,%TXIGN+%TXINT+%TXCOM + TRNN B,%TXINT ;TEST INTERRUPT BIT FOR THIS GROUP + JRST TTYI19 ;OFF. DON'T INTERRUPT + HRRE B,U ;RH OF B IS USER INDEX + JUMPL B,[JRST 4,.] ;SHOULDN'T BE NO USER + HRL B,MSKST(B) ;LH OF B IS USER'S INTERRUPT MASK + TLNN B,%PITYI ;SKIP IF INTERRUPTS ON TYPE IN ENABLED + JRST TTYI5 ;DISABLED + MOVEI C,%PITYI + IORM C,PIRQC(B) ;GENERATE TYPE IN INTERRUPT REQUEST + TRO A,%TXINT ;INDICATE INTERRUPT +TTYI5: MOVE C,TYIMSK(I) ;GET TTY CHANNELS OPEN MASK + AND C,MSKST2(B) ;MASK OFF CHANNELS NOT ENABLED + JUMPE C,TTYI19 ;JUMP IF NO OPEN CHANNELS HAVE INTERRUPTS ENABLED + MOVN D,C + AND C,D ;ISOLATE LEAST SIGNIFICANT BIT + IORM C,IFPIR(B) ;GENERATE SECOND WORD INTERRUPT REQUEST + IORI A,%TXINT ;INDICATE INTERRUPT + JRST TTYI19 + +;LIKE TTYI18 BUT FOR A CHAR THAT WASN'T REALLY TYPED IN. +TTYI13: IORI A,%TXCOM + +;ECHO BUT DON'T USE AS INPUT THE CHAR IN A, +;ASSUMING IT WAS ACTUALLY TYPED IN BY USER. MUST NOT CLOBBER H, TT. +TTYI18: IORI A,%TXPIE+%TXIGN ;THIS CHAR WILL ECHO & BE IGNORED. + +;PUT CHARACTER IN A IN INPUT BUFFER, ADJUSTING ALL COUNTS AND POINTERS. +TTYI19: MOVE C,TICC(I) + CAIL C,TIBS + JRST DING1 ;NO ROOM IN INPUT BFR => COMPLAIN. + TRNE A,%TXACT ;IF ACTIVATION CHAR, COUNT IT. + AOS TACC(I) + TRNE A,%TXPIE ;IF PI ECHO CHAR, COUNT IT. + AOS ECHOC(I) + TRNE A,%TXINT ;SIMILAR FOR TINTC, TINTP IF INT. CHAR. + AOS TINTC(I) + MOVE E,TICC(I) + CAIL E,MICBAA + SKIPLE TACC(I) ;BUFFER FULL+ NO ACTV CHRS, GEN ONE + JRST TTYIS5 + AOS TACC(I) + IORI A,%TXACT +TTYIS5: MOVE E,TIIP(I) + CAMN E,TIBEP(I) ;SKIP IF NOT OFF THE END OF THE CIRCULAR BUFFER + SUBI E,TIBL ;RESET TIIP + HRRM E,TIIP(I) ;STORE BACK IN RH + IDPB A,TIIP(I) ;STORE CHARACTER IN INPUT BUFFER + AOS TICC(I) + TRNN A,%TXPIE ;IF PI ECHO NEEDED, + POPJ P, +TTYI7: MOVE C,TORM(I) + CAIL C,TOBS + SKIPL TTYERQ(I);PUT THIS TTY ON LIST OF THOSE NEEDING ECHO + POPJ P, ;UNLESS IT'S ALREADY ON. + TLNE I,-1 + BUG + MOVE C,TTERQS + MOVEM I,TTERQS + MOVEM C,TTYERQ(I) + POPJ P, + +DING1: TLNE R,%TTDDI ;SKIP IF WANT TO DING ON EXCESS INPUT + POPJ P, + MOVSI C,%TCDNG + IORM C,TTYCOM(I) + JRST TTYI7 ;TELL CLOCK LEVEL TO LOOK AT THIS TTY. + +TYCLWR: PUSHJ P,TCNRM + CAIL E,141 ;CONVERT LOWER CASE LTRS TO UPPER + CAILE E,172 + POPJ P, + SUBI E,40 + POPJ P, + +TTYSAM: ;STANDARDIZE ALT MODE (IF APPRO) + TLNE U,%TSALT+%TSSII ;SKIP IF ALT MODE NOT TO BE STANDARDIZED + POPJ P, ;DON'T STANDARDIZE ALT MODE + CAIE A,176 ;ALT MODE CAN BE 176 OR + CAIN A,175 ;175 + MOVEI A,33 ;CHANGE EITHER TO 33 + POPJ P, + +;GETS BYTE IN B, GROUP NUMBER IN C, BYTE POINTER IN D +GETGRP: PUSH P,A + PUSHJ P,TYINR2 ;NORMALIZE CHARACTER TO FIND CORRECT GROUP. + MOVE B,A + IDIVI B,5 + POP P,A + LDB C,GRPBPT(C) ;GET GROUP BITS + MOVEI D,TTYST1(I) + CAIL C,6 + JRST GETGR2 + LDB E,[301400,,SBTBL(C)] ;LOAD LH OF BYTE PTR +GETGR1: DPB E,[301400,,D] ;MAKE TTYST1 OR TTYST2 APPROPRIATE BYTE POINTER + LDB B,D + POPJ P, + +GETGR2: LDB E,[301400,,SBTBL-6(C)] + MOVEI D,TTYST2(I) + JRST GETGR1 + +DEFINE GGRPTB A,B,C,D,E +A_29.+B_22.+C_15.+D_8+E_1 +TERMIN + +GRPTBL: GGRPTB 0,0,0,0,0 + GGRPTB 0,0,6,13,7 + GGRPTB 7,0,0,11,0 + GGRPTB 0,0,0,0,6 + GGRPTB 0,0,0,0,0 + GGRPTB 0,0,10,0,0 + GGRPTB 0,0,13,3,3 + GGRPTB 3,3,3,3,3 + GGRPTB 5,5,4,4,3 + GGRPTB 4,3,4,2,2 + GGRPTB 2,2,2,2,2 + GGRPTB 2,2,2,3,3 + GGRPTB 5,4,5,3,3 + REPEAT 5,GGRPTB 1,1,1,1,1 + GGRPTB 1,5,3,5,4 + GGRPTB 4,3,1,1,1 + REPEAT 4,GGRPTB 1,1,1,1,1 + GGRPTB 1,1,1,5,3 + GGRPTB 5,3,12,0,0 + +GRPBPT: 350700,,GRPTBL(B) + 260700,,GRPTBL(B) + 170700,,GRPTBL(B) + 100700,,GRPTBL(B) + 010700,,GRPTBL(B) + +;HANDLE A CHARACTER TYPED WHILE THE TTY OWNER IS DOING AN ECHOIN. +;A HOLDS THE CHARACTER, U HOLDS THE JOB INDEX. CLOBBERS B, C, E. +;IF THE CHARACTER IS A BREAK, ACTIVATE ON IT. +;OTHERWISE, STORE IT IN THE USER'S BUFFER AND JUST ECHO IT AND DISCARD IT; +;BUT IF THAT IS IMPOSSIBLE BECAUSE PAGES HAVE BEEN SWAPPED OUT, +;JUST ACTIVATE INSTEAD. +TTECIN: HRRZ B,U ;PREVENT TIMING ERRORS BY NOT CONSIDERING + ; HIM INSIDE THE ECHOIN IF HE HAS THE + ; PROCESSOR, SINCE UPC NOT VALID. +IFE KA10P,[ ;IF HIS USER-MODE ACS ARE IN AC BLOCK 1, WE + ; HAVE TO GIVE UP SINCE THEY MIGHT BE SAVED + ; IN TTYACS OR SOME PLACE. + MOVEI C,UUOACS(U) + CAME C,AC1PTR +] ;IFE KA10P +IFN KA10P,[ ;ON KA10, DON'T DO THIS IF MPV IS SET + CONSO 20000 ;INTERRUPT OUT OF XCTR WITH PI TRAP SET +] ;KA10P ;GETS THE MACHINE VERY CONFUSED, I SUSPECT + CAMN B,USER + JRST TTECI9 + TRNN A,%TXCTL+%TXMTA+%TXSUP ;DECIDE WHETHER THIS CHAR ECHOES OR + ; BREAKS. + CAIGE A,40 ;CONTROL CHARS, EITHER 9-BIT OR ASCII, BREAK. + JRST TTECI9 ;NOTE THAT SAIL CHARS WILL HAVE %TXTOP. + CAIN A,%TXTOP+"H ;DON'T ECHO HELP CHAR. + JRST TTECI9 + LDB B,[050200,,A] ;WHICH WORD OF BREAK TABLE IS THIS CHARACTER IN? + ADD B,U ;JOB OWNING TTY + MOVE B,AC0S+Q(B) .SEE NECHOIN ;GET THAT WORD. + LDB E,[0500,,A] + LSH B,(E) ;GET THE BIT FOR THIS CHARACTER INTO THE SIGN BIT. + JUMPL B,TTECI9 ;IF BIT IS SET, THIS IS A BREAK CHARACTER. + SPM TTECIM ;SAVE PAGE MAP AND LOAD UP TTY-OWNING JOB'S MAP. + LPMR UPGML(U) +IFE KA10P,[ + JRST 2,@[%PSPCU,,.+1] ;XCTR DOESN'T WORK IF THIS BIT NOT SET + DATAI PAG,TTECIX ;SAVE ACS CONTEXT ALSO, SET PREVIOUS AC + ; CONTEXT TO AC BLOCK 2, BUT DON'T CHANGE + ; CURRENT CONTEXT WHICH MAY BE 0 OR 1. + MOVE B,[600200,,400000] .SEE SPCCTX ;THIS DATAO PAG, IS SAME AS IN + ; AC2CTX. (ALTHOUGH THERE ARE + ; A FEW SPURIOUS BITS SET ON + ; THE KS-10.) + LDB C,[330300,,TTECIX] ;BUT TRANSFER CURRENT AC BLOCK INTO IT + DPB C,[330300,,B] + DATAO PAG,B + MOVSI B,UUOACS(U) ;COPY THE JOB'S USER MODE ACS INTO THAT BLOCK. + XCTR XBW,[BLT B,17] +] ;IFE KA10P + MOVE C,AC0S+C(U) + XCTRI XRW,[MOVES E,(C)] ;MAKE SURE THE COUNT IS STILL IN CORE AND > 0. + CAIG E,0 + JRST TTECIL + MOVE B,AC0S+B(U) + XCTRI XRW,[MOVES E,(B)] ;MAKE SURE BYTE POINTER STILL IN CORE, + CAIA + JRST TTECIL + IBP E + XCTRI XRW,[MOVES (E)] ;AND THAT THE WORD THE CHARACTER WILL GO IN IS IN CORE + SKIPA E,AC0S+E(U) ; AND WRITABLE + JRST TTECIL + XCTRI XRW,[MOVES (E)] ;MAKE SURE THE BLOCK OF COUNTERS IS STILL IN CORE. + CAIA + JRST TTECIL + XCTRI XRW,[MOVES 6(E)] + CAIA + JRST TTECIL + XCTRI XBYTE,[IDPB A,(B)] ;STORE THE CHARACTER. + CAIA + BUG + XCTRI XRW,[SOS (C)] ;DECREMENT THE COUNT OF CHARS TO ECHO. + CAIA + BUG + JUMPE E,TTECI2 ;UPDATE THE BLOCK OF COUNTERS, IF THERE IS ONE. + ADDI E,2 ;THE FIRST TWO ARE IGNORED. + HRLI E,-4 ;THE NEXT FOUR ARE INCREMENTED. +TTECI1: XCTRI XRW,[AOS (E)] + CAIA + BUG + AOBJN E,TTECI1 + XCTRI XRW,[SOS (E)] ;THE SEVENTH IS DECREMENTED. + CAIA + BUG +;GOOD. CHARACTER HAS BEEN STORED IN THE USER'S MEMORY. +TTECI2: TRO A,%TXIGN\%TXPIE\%TXECI ;NOW MAKE IT ECHO. + PUSHJ P,TTECIR + POPJ P, + +;WE CAN'T HANDLE A CHARACTER, SO MAKE IT ACTIVATE SO THE ECHOIN WILL RETURN. +;TTECIL IS FOR AFTER THE MAP HAS BEEN SWITCHED. TTECI9 IS FOR BEFORE THEN. +TTECIL: PUSHJ P,TTECIR +TTECI9: IORI A,%TXACT + POPJ P, + +;RESTORE THE PAGE MAP THAT WE SAVED. +TTECIR: +IFE KA10P,[ + MOVEI B,UUOACS(U) ;COPY POSSIBLY ALTERED USER ACS BACK INTO + ; THE JOB. + XCTR XBR,[BLT B,UUOACS+17(U)] + DATAO PAG,TTECIX +] ;IFE KA10P + LPMR TTECIM + POPJ P, + +EBLK + +TTECIM: BLOCK 10 ;OUTER LEVEL MAP SAVED HERE AND RESTORED AT EXIT. +IF2 IFG UPGMLE-UPGML-10,.ERR TTECIM too short. +IFE KA10P,[ +TTECIX: 0 ;SAVED DATAI PAG VALUE. +] + +BBLK + +SUBTTL HANDLE ^Z + +ZFLAG: MOVSI U,%TSLCZ ;EVEN IF THIS BIT IN TTYSTS IS OFF, TTY MAY BE FREE + IORB U,TTYSTS(I) ;GET TTYSTS + JUMPGE U,ZFLAG2 ;(TTY IS IN USE) + SKIPGE TTYSTA(I) ;CONSOLE FREE MSG COMING OUT OR ALREADY TRYING TO ^Z + SKIPGE DEDTIM ;OR SYSTEM IS DOWN. DON'T CREATE A NEW JOB TREE. + POPJ P, + MOVN B,SYSDBG + SKIPGE SYSDBG ;IF NOT ALLOWING USERS, + CAMN I,B ;ALLOW ONLY THE SPEC'D TTY (= -C(SYSDBG) ) + JRST ZFLAG7 + MOVE B,TTYTYP(I) ;AND STY TTY'S, AS WELL AS TTY 0. + TRNN B,%TYSTY ;NOTE STELNT WILL REFUSE NETWORK LOGINS WHEN SYS BEING DEBUGGED. + JUMPN I,CPOPJ +ZFLAG7: CONO PI,PICOFF\<200_-UTCCHN> .SEE NUJBST + MOVE A,UTTYCT ;SET UP NEW USER + CAIL A,MXCZS ;BUT DON'T OVERFILL BUFFER + JRST [ CONO PI,PICON\<200_-UTCCHN> ? POPJ P,] + AOS UTTYCT + HRRZM I,@UTTYI + AOS A,UTTYI + CAIL A,UTTYS+MXCZS + MOVEI A,UTTYS + MOVEM A,UTTYI + CONO PI,PICON\<200_-UTCCHN> + MOVSI A,%TACTZ ;SAY TTY BEING ^Z'D - ELSE SYS JOB MIGHT TYPE CONSOLE-FREE MSG, + IORM A,TTYSTA(I) ;SINCE TTY IS FREE AND %TACFM IS OFF (OR WILL BE AFTER TTYINI) + JRST TTYINI + +ZFLAG4: HRR U,SUPPRO(U) +ZFLAG2: SKIPL SUPPRO(U) + TLNE U,%TSSII + JRST ZFLAG3 ;SUPER IMAGE INPUT MODE OR TOP LEVEL JOB + TLNN U,%TSCNS ;OR IN USE AS A DEVICE => DON'T TREAT ^Z SPECIALLY + JRST ZFLAG3 + MOVEI E,%PIC.Z + TDNE E,PIRQC(U) ;IF IMMEDIATE SUPERIOR DOESN'T RESPOND TO ^Z BY TAKING + JRST ZFLAG4 ;THE TTY FROM THE ^Z'ED JOB, TRY FOR HIS SUPERIOR. + IORM E,PIRQC(U) ;OTHERWISE GIVE ^Z INTERRUPT TO JOB + PUSHJ P,TYIRS1 ;DISCARD ALL PENDING INPUT BEFORE THE ^Z. + MOVEI A,^Z+%TXPIE+%TXIGN + JRST TTYI19 ;ARRANGE FOR THE ^Z TO BE ECHOED. + +ZFLAG3: MOVSI U,%TSLCZ ;CLEAR BIT + ANDCAB U,TTYSTS(I) + JRST TTYI2A ;TREAT ^Z AS ANY OTHER CHAR. + +SUBTTL HANDLE ^_ + +TTYICB: TLNE U,%TSSII ;^_ NOT SPECIAL IF TTY IS IN USE, IN SUPERIMAGE INPUT. + JUMPGE U,TTYI2 + SKIPGE DEDTIM ;DON'T ALLOW ^_ IF ITS IS DOWN + POPJ P, + JUMPGE U,TYCGTN ;DO ALLOW THEM ON ANY TTY THAT'S IN USE + SKIPGE SYSDBG ;IF ITS BEING DEBUGGED, ALLOW ^_ IN SAME CASES ^Z IS ALLOWED. + TRNE R,%TYSTY + JRST TYCGTN + MOVN B,SYSDBG + CAME B,I + JUMPN I,CPOPJ +TYCGTN: JSP D,TYCRDE ;ECHO IT, RETURN WITH NEXT CHAR TYPED. +TYCI: SETOM COMT1(I) ;CHR AFTER ^_ + PUSHJ P,TCNRM + CAIE E,^_ + CAIN E,^Z + JRST TYCI3A ;GIVE EITHER CHARACTER TO MAIN PROGRAM + CAIL E,^B + CAILE E,^D ;^B, ^C, ^D, ^F SIGNIFY META BITS BEING SPEC'D. + CAIN E,^F + JRST TYCMB + CAIL E,"0 ;DIGIT => CHARATER BEING TYPED IN BY ITS ASCII CODE. + CAILE E,"9 + JRST TYCI7 ;JUMP IF NOT A DIGIT. + MOVEI B,-"0(E) + MOVEM B,COMT1(I) ;STORE FIRST DIGIT + JSP D,TYCRDE ;ECHO DIGIT, READ ANOTHR. (TTYIPC LEFT -> TYCI4) +TYCI4: PUSHJ P,TYCI22 ;READ NUM AFTER FIRST DIGIT + JRST TYCI6 ;CHARACTER IS NON-NUMERIC + JRST TTYI18 ;ECHO THE DIGIT - IT'S ALREADY HANDLED. + +TYCI3A: TRNN H,%TP11T ;ON NON-TV TERMINALS, + MOVEI A,%TXCTL+100(E) ;MAKE QUOTED ^Z LOOK LIKE "CONTROL" AND "Z" IN FULL +TYCI3: PUSHJ P,TYCI17 ;RESTORE TTYIPC TO NORMAL, + HRLI A,1 ;PREVENT CHAR FROM BEING TAKEN AS ^Z OR ^_. + JRST @TTYIPC(I) ;HANDLE CHAR (BUT QUOTE ^_ AND ^Z) + + +TYCI22: LDB E,[700,,A] + CAIL E,"0 + CAILE E,"9 + POPJ P, ;RETURN WITHOUT SKIPPING IF NON-NUMERIC + MOVE B,COMT1(I) + LSH B,3 + ADDI B,-"0(E) + MOVEM B,COMT1(I) ;UPDATE VALUE SO FAR + JRST POPJ1 ;SKIP RETURN + +TYCMB: SETZM COMT1(I) ;^A THRU ^F SEEN - INITIALIZE, AND DECODE THE CHARACTER. + JRST TYCMB2 + +TYCMB1: IORM D,COMT1(I) ;SET THE SPEC'D META-BIT AND READ ANOTHER CHAR. + JSP D,TYCRDE ;WHICH WE THEN DECODE ... +TYCMB2: SETZ D, + PUSHJ P,TCNRM + CAIN E,^B + IORI D,%TXCTL + CAIN E,^C + IORI D,%TXMTA + CAIN E,^D + IORI D,%TXTOP + CAIN E,^F + IORI D,%TXSUP + JUMPN D,TYCMB1 ;IF CHAR WAS ^B THRU ^F, SET APPRO META-BIT AND LOOP. + CAIN E,^Q + JSP D,TYCRDE ;OTHERWISE, ^Q QUOTES, + IOR A,COMT1(I) ;JUST READ THE CHARACTER, WITH SPEC'D META-BITS MERGED IN. + JRST TYCI3 + +TYCI2: PUSHJ P,TTYI18 ;ECHO CHAR, RESET TTYIPC TO NORMAL. +TYCI17: MOVEI B,TYCG + SKIPL Q + MOVEI B,TTYI + MOVEM B,TTYIPC(I) + TLZ Q,%TCCBS+%TCCBK ;ALSO FLUSH TEMPORARY STATUS INFO. + MOVEM Q,TTYCOM(I) + POPJ P, + +TYCI6: EXCH A,COMT1(I) ;A NOW HAS CHAR REPRESENTED BY DIGITS; COMT1 HAS THE NON-DIGIT JUST TYPED IN. + ANDI A,7777 + PUSH P,I ;IF IN COME MODE, TYCI3 CALLS TYCG AND SMASHES I + PUSHJ P,TYCI3 ;SIMULATE ITS TYPE IN + POP P,I + MOVE A,COMT1(I) ;GET LAST CHARACTER TYPED + CAIN A,40 ;A SPACE GETS FLUSHED FOLLOWING DIGITS + POPJ P, + MOVE Q,TTYCOM(I) ;RESTORE ACS BASHED BY TYCG + MOVE R,TTYTYP(I) + MOVE H,TTYOPT(I) ;THIS ONE MAY BE SUPERFLUOUS + MOVE U,TTYSTS(I) + JRST @TTYIPC(I) ;PROCESS IT NORMALLY + +TCNRM: MOVE E,A + PUSHJ P,TYINR2 + EXCH E,A + POPJ P, + +TYCI7: PUSHJ P,TYCLWR ;NON-DIGIT, NON-^Z, NON-^_ AFTER ^_. + CAIN E,^U ;^U is CLEAR INPUT. + JRST TYCFLS + CAIL E,"A ;IF IT'S A LETTER, + CAILE E,"Z + JRST TYCI7A + XCT TYIQT-"A(E) ;JUST DISPATCH ON IT. + MOVEM H,TTYOPT(I) +TYCI7D: MOVEM U,TTYSTS(I) + JRST TYCI2 + +TYCI7A: CAIE E,"" ;ASIDE FROM LETTERS, " AND ^ ARE OK. + CAIN E,"^ + JRST TYCI7B +TYCI7F: MOVEI A,"? ;OTHER CHARS ARE ERRORS. +TYCI2A: PUSHJ P,TTYI13 ;ECHO A CHARACTER THAT WASN'T INPUT, AND RESET TTYCOM AND TTYIPC. + JRST TYCI17 + +TYCI7B: CAIE E,"" + TLCA U,%TSROL ;^_^ COMPLEMENTS SCROLL MODE. + TLC U,%TSSAI ;^_" COMPLEMENTS SAIL CHAR SET USAGE. + JRST TYCI7D + +TYIQT: JRST TYCA ;A => ACCEPT COM LINKS. + JRST TYCB ;B => TRIGGER A **MORE** (BLOCK TYPEOUT). + JRST TYCC ;C => CREATE COM LINK. + JRST TYCD ;D => DEFERRED CALL + JRST TYCRFT ;E => ENTER REMOTE FEED-THRU. + JRST TYCI7F ;F => ERROR. + TLC U,%TSMOR ;G => COMPLEMENT MORE-PROCESSING. + JRST TYCH ;H => HELP KEY. + TLC Q,%TCICO ;I => COMPLEMENT INPUT OVERRIDE. + JRST TYCJ ;J => Cause %PIJST interrupt. + JRST TYCK ;K => FLUSH SPEC'D TTY FROM COM LINK. + MOVEI A,^L+%TXIGN+%TXCOM ;L => CLEAR SCREEN. + TLC U,%TSMOR ;M => COMPLEMENT MORE-PROCESSING. + JRST TYCN ;N => BREAK COM LINK. + TLC Q,%TCOCO ;O => COMPLEMENT OUTPUT COM OVERRIDE. + JRST TYCI7F ;P => ERROR. + JRST TYCQ ;Q => ENTER QUERY MODE. + JRST TYCR ;R => ENTER REFUSE MODE. + JRST TYCS ;S => SLAVE ANOTHER TTY. + JRST TYCI7F ;T => ERROR. + TLC H,%TOCLC ;U => COMPLEMENT CASE-CONVERSION. + JRST TYCI7F ;V => ERROR. + JRST TYCI7F ;W => ERROR. + JRST TYCI7F ;X => ERROR. + JRST TYCQA ;Y => ACCEPT PENDING QUERIES FOR COM LINKS + JRST TYCQR ;Z => REJECT PENDING QUERIES. + +IFN .-TYIQT-26.,.ERR WRONG LENGTH TABLE. + +;PUT IN A DEFERRED CALL +TYCD: PUSHJ P,TTYI18 ;ECHO THE D + MOVEI A,%TXACT+%TXCTL+%TXTOP+"Z + PUSHJ P,TTYI19 ;PUT A DEFERRED CALL IN THE BUFFER + JRST TYCI17 ;RESET ^_ STATE + +;HELP KEY +TYCH: PUSHJ P,TTYI18 ;ECHO THE H + MOVEI A,%TXACT+%TXTOP+"H + PUSHJ P,TTYI19 ;PUT A [HELP] IN THE BUFFER + JRST TYCI17 ;RESET ^_ STATE + +;Cause %PIJST interrupt. +TYCJ: SKIPA B,[%PIJST] +TYCJ1: MOVE U,SUPPRO(U) + JUMPL U,TYCI7F ; Error if tty not in use or nobody enabled + ; for it. + TDNN B,MSKST(U) + JRST TYCJ1 + IORM B,PIRQC(U) + JRST TYCI2 ; Echo the J and reset ^_ state. + +;CLEAR INPUT +TYCFLS: CONO PI,TTYOFF ;No touching buffer while I'm frobbing it. + PUSHJ P,TYIRS1 ;Completely flush input buffer of TTY in I. + CONO PI,TTYON + MOVEI A,^U + PUSHJ P,TTYI13 ;Can echo the ^U now. + JRST TYCI17 ;Reset ^_ state. + + +TYCB: HRRZ B,I ;COME HERE FOR ^_B. + IMULI B,TPLEN*2 + MOVEI C,%TFEOP + IORM C,TPFLAG(B) + JRST TYCI2 + +TYCRFT: PUSH P,A ;COME HERE FOR ^_E. + MOVE A,TTYTYP(I) ;ARE WE A LOCAL TTY? + TRNN A,%TYDIL\%TYRLM\%TYSTY + JRST TYCRF0 ;LOCAL TTYS ARE ALLOWED TO SLAVE W/O LOGIN + TRNN A,%TYSTY ;Is it a STY? + JRST TYCRFA ; Nope + HRRZ A,STYSTS-NFSTTY(I) ;Special Check for TARAKA demons linking + MOVE A,UNAME(A) ;Is the UNAME of the owner of this STY + CAMN A,[SIXBIT /TARAKA/] ;TARAKA? + JRST TYCRF0 ;Yes, let it hack all it wants. +TYCRFA: HRRE A,TTYSTS(I) ;GET OWNER OF THIS TTY + AOJE A,TYCRF2 ;IF THIS IS A FREE TTY, DON'T LET HIM + HLRE A,UNAME-1(A) ;IS HE LOGGED IN? + AOJE A,TYCRF2 ; IF NOT, FAIL +TYCRF0: SETZ B, ;COMPLEMENT OUR %TCRFT BIT. + PUSHJ P,TYCREP ;1ST, COUNT # TTYS IN LOOP. + PUSHJ P,[ + MOVE A,TTYCOM(I) + TLNE A,%TCLFT ;IF ANY TTY IN LOOP HAS %TCLFT SET + POPJ P, ;THEN IT'S OK FOR OUR %TCRFT TO BE. + AOJA B,POPJ1] + JRST TYCRF1 ;SOME TTY IN LOOP HAS %TCLFT => OK TO SET %TCRFT. + CAIE B,2 ;ONLY 1 OTHER TTY => SET ITS %TCLFT, THEN OUR %TCRFT. + JRST TYCRF2 ;FAIL TO SET %TCRFT IF CAN'T FIND OTHER WITH %TCLFT. + MOVE A,TTYCOM(I) + MOVSI B,%TCLFT + IORM B,TTYCOM(A) +TYCRF1: TLC Q,%TCRFT + POP P,A + JRST TYCI7D + +TYCRF2: SUB P,[1,,1] + JRST TYCI7F + +;COME HERE AFTER READING UNAME FOR ^_S. B HAS IDX OF SPEC'D TTY. +;SET THAT TTY'S %TCLFT, ENSLAVING IT. CLEAR %TCLFT OF ALL OTHER TTYS +;IN THE SAME LOOP AS SPEC'D TTY. +TYCS1: PUSHJ P,TYCREP + CAIN B,(I) ;IF SPEC'D TTY NOT IN COM WITH US + CAIA + JRST TYCI7F ;THEN IT'S AN ERROR. + MOVSI A,%TCLFT + PUSHJ P,TYCREP ;CLEAR %TCLFT OF ALL TTY'S LINKED TO US, + ANDCAM A,TTYCOM(I) + JFCL + IORM A,TTYCOM(B) ;THEN SET IT FOR HIM. + POPJ P, + +;CALL WITH JSP D, ECHO CHAR IN A, RETURN WITH NEXT CHAR. +TYCRDE: HRRZM D,TTYIPC(I) + JRST TTYI18 + +;LIKE TYCRDE BUT DON'T ECHO THE CHARACTER IN A. +TYCRED: HRRZM D,TTYIPC(I) + POPJ P, + +;T -> ASCIZ STRING, ECHO ON TTY # IN I (MUST HAVE DONE TYCSET) +TYCI40: HRLI T,440700 +TYCI39: ILDB A,T + JUMPE A,CPOPJ + PUSHJ P,TTYI13 ;ECHO CHARACTER ON TTY + JRST TYCI39 + +;SET UP ACS FOR ECHOING ON TTY # IN I. +TYCSET: MOVE R,TTYTYP(I) + MOVE Q,TTYCOM(I) + MOVE U,TTYSTS(I) + POPJ P, + +;PUT TTY IN COM MODE IF IT ISN'T. TTY # IN I. +TYCI63: TLON Q,400000 + TLZ Q,%TCLFT+%TCRFT + MOVEM Q,TTYCOM(I) + JRST TYBC + +;TTY # IN I, REPEAT OVER THAT TTY AND ALL LINKED TO IT. +;INSN TO BE REPEATED FOLLOWS CALL. +;IF THE INSN DOESN'T SKIP, IMMEDIATELY RERURNS +;SKIPPING ONLY THAT INSN. ELSE RETURNS SKIPPING 2 WHEN ALL TTYS DONE. +TYCREP: PUSH P,I ;PUSH TTY STARTING WITH. + PUSH P,I ;PUSH TTY DOING NEXT. +TYCRE0: XCT @-2(P) ;(THE INSN AFTER THE PUSHJ) + JRST TYCRE1 ;IT DIDN'T SKIP, GIVE UP RIGHT AWAY. + MOVE I,(P) ;ELSE KEEP GOING, + SKIPL I,TTYCOM(I) + JRST TYCRE2 ;LAST TTY DONE NOT LINKED, THRU. + ANDI I,-1 + CAIE I,-1 ;IN COM MD BUT NOT LINKED OR + CAMN I,-1(P) ;HAVE GONE ALL AROUND CIRCULAR LIST + JRST TYCRE2 ;=> DONE. + MOVEM I,(P) ;ELSE DO THE NEXT ONE. + JRST TYCRE0 + +TYCRE2: AOS -2(P) ;RETURN SKIPPING 2. +TYCRE1: SUB P,[1,,1] + POP P,I + JRST POPJ1 + +;^_A - ACCEPT ALL PENDING AND FUTURE REQUESTS FOR COM LINKS. +TYCA: TLZ Q,%TCRFS+%TCQRY + +;^_Y - ACCEPT ALL PENDING REQUESTS FOR COM LINKS. +TYCQA: PUSHJ P,TYCI2 ;ECHO THE A OR Y. + PUSHJ P,TYCQRP ;FIND ALL PENDING QUERIES + PUSHJ P,TYCQAC ;ACCEPT EACH ONE. + POPJ P, + +TYCQAC: PUSHJ P,TYCREP ;DON'T ACCEPT A RQ FROM SOMEONE ALREADY LINKED TO US. + CAIN B,(I) + POPJ P, + MOVE H,B ;HIS TTY # IN H FOR TYCI43 + PUSHJ P,TYCSET + PUSHJ P,TYCI43 ;LINK HIM AND ME; ECHANGE I AND H. + MOVE B,I + MOVE I,H ;GET HIS # BACK IN B AND MINE IN I. + POPJ P, + +;^_R - REFUSE ALL PENDING AND FUTURE REQUESTS FOR COM LINKS. +TYCR: TLO Q,%TCRFS + TLZ Q,%TCQRY + +;^_Z - REFUSE ALL PENDING REQUESTS FOR COM LINKS. +TYCQR: PUSHJ P,TYCI2 ;ECHO THE R OR Z. + PUSHJ P,TYCQRP ;FIND ALL PENDING QUERIES + PUSHJ P,TYCQRF ;AND REFUSE EACH ONE. + POPJ P, + +TYCQRF: EXCH B,I + PUSHJ P,TYCSET ;TYPE ON REQUESTING TTY + PUSHJ P,TYCI36 ;THAT IT IS BEING REJECTED + EXCH B,I ;AND REMOVE IT FROM A QUERYING STATE. + POPJ P, + +;^_Q - ALL REQUESTS FOR COM LINKS SHOULD REMAIN PENDING UNTIL ANSWERED +;WITH ^_Y, ^_Z OR AN INVERSE ^_C. +;ALSO, LIST ALL REQUESTS THAT ARE NOW PENDING. +TYCQ: TLZ Q,%TCRFS + TLO Q,%TCQRY + PUSHJ P,TYCI2 ;ECHO THE "Q" AND RESET ALL STATUS INFO. + PUSHJ P,TYCSET + SETZ T, ;INDICATE NOTHING HAS BEEN TYPED YET. + PUSHJ P,TYCQRP ;FIND THE PENDING REQUESTS + PUSHJ P,TYCQLS ;SAY WHO EACH IS FROM. + POPJ P, + +TYCQLS: JUMPE T,TYCQL1 ;IF THIS ISN'T THE FIRST NAME MENTIONED, + MOVEI T,[ASCIZ/, /] ;SEPARATE FROM THE PREVIOUS NAME. + PUSHJ P,TYCI40 +TYCQL1: MOVE C,B ;THIS IS TTY NUMBER QUERYING US + PUSH P,C .SEE TYCI92 + PUSH P,[POPCJ-1] ;TYCI67 ALWAYS SKIP-RETURNS. + JRST TYCI67 ;TYPE THE USER'S NAME OR THE TTY NUMBER. + +; PUSHJ P,TYCQRP +; INSN +;EXECUTES INSN ONCE FOR EACH TTY QHICH IS QUERYING THE TTY IN I. +;THE QUERYING TTY'S NUMBER IS IN B. INSN MUST PRESERVE B AND I. +;A IS CLOBBERED BY TYCQRP. OTHER ACS ARE UNTOUCHED. + +TYCQRP: SETZ B, +TYCQR1: MOVE A,TTYIPC(B) + CAIE A,TYCRW + CAIN A,TYCRW2 + CAME I,COMT1(B) + JRST TYCQR2 ;TTY IN B ISN'T QUERYING TTY IN I. + XCT @(P) ;EXECUTE INSN. +TYCQR2: CAIE B,NCT-1 + AOJA B,TYCQR1 + JRST POPJ1 ;SKIP OVER INSN WHEN RETURN. + +SUBTTL HANDLE COM-LINKS + +TYCC: TLOA Q,%TCTPN ;^_C - WHEN LEAVE COM MODE MUST TYPE ^_N. +TYCK: TLO Q,%TCCBK ;SAY WE'RE DOING ^_K. + JRST TYCI19 + +TYCS: TLO Q,%TCCBS ;^_S - ENSLAVE SPEC'D TTY. +TYCI19: MOVEM Q,TTYCOM(I) + JSP D,TYCRDE ;ECHO, RETURN, COME BACK WITH NEXT CHAR. + PUSHJ P,TCNRM + CAIE E,15 ;SPACE OR CR IS 1ST CHAR, IGNORE. + CAIN E,40 + JRST TTYI18 + MOVEI B,TYCI27 + MOVEM B,TTYIPC(I) + SETZM COMT3(I) ;INIT. ACCUMULATED #. + SETZM COMT1(I) ;AND ACCUM UNAME. + +;READING CHARS AFTER ^_C (AFTER A NON-SPACE HAS BEEN SEEN) +;COMT1 ACCUMULATES SIXBIT, COMT3 OCTAL NUMBER. +;SIGN OF COMT3 SET => NONDIGIT WAS SEEN, USE THE SIXBIT. +TYCI27: PUSHJ P,TYCLWR ;CONVERT TO UPPER CASE. + CAIN E,^_ + JRST TYCI7F ;ANOTHER ^_ IS NO GOOD. + CAIE E,15 + CAIN E,40 + JRST TYCI28 ;SPACE DELIMITS UNAME OR NUMBER + CAIN E,^^ + JRST TYCI28 + CAIN E,177 + JRST TYCI7F ;RUBOUT => TYPE ? AND GIVE UP. + MOVE B,COMT3(I) ;ACCUM NUMBER IN RH OF COMT3. + LSH B,3 + ADDI B,-"0(E) + HRRM B,COMT3(I) + CAIL E,"0 + CAILE E,"9 ;NON-DIGIT SEEN => SET SIGN OF COMT3 SAYING + SETOM COMT3(I) ;CERTAINLY NOT NUMBER. + MOVE B,COMT1(I) + LSH B,6 + IORI B,-40(E) + MOVEM B,COMT1(I) ;ADD NEW CHARACTER ONTO THE END OF THE NAME + JRST TTYI18 ;EXIT TO ECHO THE CHARACTER + +TYCI28: MOVE H,Q ;SAVE SETTINGS OF %TCCBS, %TCCBK, SINCE TYCI2 WILL CLEAR THEM. + PUSH P,E + PUSHJ P,TYCI2 ;ECHO TERMINATING CHAR IN A, AND RESET ALL TO NORMAL. + POP P,E + SKIPGE B,COMT3(I) + JRST TYCI52 ;TYPEIN WASN'T NUMBER. + CAIGE B,NCT ;IS NUMBER THAT OF A TTY THAT EXISTS? + JRST TYCI53 +TYCI52: MOVE D,COMT1(I) +TYCI29: TLNE D,770000 ;LEFT ADJUST THE UNAME + JRST TYCI30 + LSH D,6 + JRST TYCI29 + +TYCI30: MOVEI U,LUBLK ;START LOOKING AT USER NUMBER 2 + MOVSI A,%TCRFS + SETO B, ;NO REFUSE-MODE TTY FOUND YET +TYCI31: ADDI U,LUBLK + CAML U,USRHI + JRST [ JUMPGE B,TYCI36 ;REFUSED + JRST TYCI7F ] ;OUT OF USERS SO GIVE ? AND RETURN + CAMN D,UNAME(U) ;SKIP IF UNAME DOESN'T MATCH + SKIPGE C,TTYTBL(U) ;SKIP IF PROCEDURE HAS THE TTY + JRST TYCI31 ;TRY NEXT PROCEDURE + HRRZ B,C ;TTY NUMBER + TDNE A,TTYCOM(B) ;IN REFUSE MODE? + JRST TYCI31 ;YES, MAY BE CRTSTY, TRY TO FIND A BETTER TTY WITH THIS UNAME +TYCI53: MOVEM B,COMT1(I) ;# OF TTY TRYING TO HACK + SETZM COMT3(I) ;IEC FLAG FOR QUERY MODE + CAIN E,^^ + SETOM COMT3(I) + TLZE H,%TCCBK ;JUMP IF DOING ^_K. + JRST TYCK1 +IFG APL,[ + CAIN B,APL ;DON'T SEND MESSAGE TO A.P. LINE + JRST TYCI7F ;(OK NOW TO SEND TO SYSTEM CONSOLE, HAS O.C.O. ANYWAY) +] + TLZE H,%TCCBS + JRST TYCS1 ;ALSO CHECK FOR ^_S. + PUSHJ P,TYCREP ;NO, IT'S ^_C. + CAIN B,(I) ;DON'T LET LINK TO SELF OR SOMEONE ALREADY LINKED TO. + JRST TYCI7F + HRRE C,TTYSTS(B) + AOJN C,TYCI34 ;TTY HAS A USER + MOVEI A,"F ;TTY IS FREE + PUSHJ P,TTYI13 ;TYPE AN F + MOVEI A,40 + PUSHJ P,TTYI13 ;FOLLOWED BY A SPACE + MOVE B,COMT1(I) ;RESTORE THAT TTY'S NUMBER. + JRST TYCI32 + +TYCI34: MOVE C,TTYSTS(B) ;TTY IN USE: AS A DEVICE? + TLNN C,%TSCNS + JRST TYCI7F ;^_C NOT ALLOWED TO TTY OPEN AS DEVICE. +TYCI32: MOVE A,TTYIPC(B) + CAIE A,TYCRW2 + CAIN A,TYCRW ;IF HE'S QUERYING ME, THEN HE AUTOMATICALLY ACCEPTS + JRST [CAME I,COMT1(B) ;REGARDLESS OF HIS %TCRFS AND %TCQRY. + JRST TYCI37 ;IF HE'S QUERYING SOMEONE ELSE, HE'S BUSY. + JRST TYCI33] + MOVE C,TTYCOM(B) + TLNE C,%TCRFS ;GIVE UP IF HE IS REFUSING ^_C'S. + JRST TYCI36 + CAIN A,TTYI ;MUNGING IPC WHILE NOT NORMAL WOULD LEAVE + JRST TYCI44 ;WHAT HE'S DOING UNFINISHED - CAUSING BUGS. + CAIE A,TYCG + JRST TYCI37 ;IPC NOT NORMAL. + MOVEM B,COMT1(I) ;IPC NORMAL BUT HE'S IN A COM LINK. + MOVE TT,I + MOVE H,B ;MY TTY # IN TT AND I, HIS IN H. + MOVEI T,[ASCIZ/ IN COM: /] + PUSHJ P,TYCI71 ;LIST ALL TTYS IN COM WITH HIM. + JFCL + MOVEI T,[ASCIZ/ +BREAK IN? /] + PUSHJ P,TYCI40 ;PRINT STRING ON MY TTY. + JSP D,TYCRED ;READ THE ANSWER + PUSHJ P,TTYI18 ;AND ECHO IT. + PUSHJ P,TYCLWR ;NORMALIZE IT AND CONVERT TO UPPER CASE IN E. + CAIE E,"Y + JRST TYCI17 ;NO => RESET US TO NORMAL AND GIVE UP. + MOVE B,COMT1(I) ;ANSWER IS YES, GO AHEAD. + MOVE A,TTYIPC(B) + CAIE A,TTYI + CAIN A,TYCG + CAIA + JRST TYCI37 ;CAN'T MUNG HIM IF IPC NOT NORMAL. + MOVE C,TTYCOM(B) + TLNE C,%TCRFS + JRST TYCI36 ;HE'S REFUSING. +TYCI33: PUSHJ P,TYCREP + CAIN B,(I) ;MAYBE HE ENTERED OUR LOOP WHILE WE WAITED. + JRST TYCI7F ;LINKING TO SOMEONE ALREADY LINKED TO CAUSES BUGS. + JRST TYCI44 ;GO AHEAD AND LINK UP. + +TYCI37: SKIPA T,[[ASCIZ/BUSY /]] ;TARGET IS BUSY. +TYCI36: MOVEI T,[ASCIZ/REFUSED /] ;TARGET IS REFUSING. + PUSHJ P,TYCI40 + JRST TYCI17 + +;NOW WE KNOW IT'S OK TO TRY TO ^_C HIM. HIS TTY # IN B, MINE IN I. +TYCI44: MOVE H,I ;PUT MY TTY # IN H, HIS IN I. + MOVE I,B + SETO TT, + PUSHJ P,TYCSET ;GET HIS TTYCOM IN Q FOR TYCI63 + PUSHJ P,TYCI64 ;TYPE MSG FROM ME ON HIM. + JFCL + MOVE A,TTYIPC(I) + CAIE A,TYCRW2 ;IF HE'S QUERYING US, NO NEED TO QUERY HIM; + CAIN A,TYCRW ;JUST PRETEND HE'S IN ACCEPT MODE. + JRST TYCI43 + MOVSI A,%TCQRY + TDNN A,TTYCOM(I) ;SKIP IF HE MUST BE ASKED + JRST TYCI43 ;HE'S IN ACCEPT MODE. + MOVEI T,[ASCIZ /- QUERYING/] ;ELSE JUST MENTION TO HIM THAT WE'RE QUERYING + SKIPL COMT3(H) + PUSHJ P,TYCI40 + MOVEM I,COMT1(H) ;AND SETTLE DOWN FOR HIM TO DO SOMETHING ABOUT IT. + MOVEI A,TYCRW + MOVEM A,TTYIPC(H) + MOVE I,H + PUSHJ P,TYCSET + MOVEI T,[ASCIZ /QUERYING /] ;TELL OUR USER THAT WE'RE WAITING FOR ANSWER. + JRST TYCI40 + +TYCI68: CAIN TT,(I) ;ENTRY TO DO FOR ALL LINKED TO HIM BUT NOT HIM. + JRST POPJ1 +TYCI64: MOVEI T,[ASCIZ / +MESSAGE FROM /] + MOVE R,LOCTTY + MOVE R,TTYTYP(R) + TRNN R,%TYSTY + JRST TYCI62 + MOVE R,LOCTTY + MOVE R,STYSTS-NFSTTY(R) + MOVE R,JNAME(R) + CAME R,[SIXBIT /PEEK/] ;THIS SEEMS TO BE A CROCK --RG +TYCI62: MOVEI T,[ASCIZ / +LINK FROM /] +TYCI71: PUSHJ P,TYCSET ;SET UP Q,R,U,W FOR HIS TTY (# IN I) + PUSHJ P,TYCI40 ;PRINT MSG <- T ON IT. + PUSH P,I ;SAVE HIS TTY #, + MOVE I,H ;GET MINE (ARG TO TYCREP) + PUSHJ P,TYCREP ;LOOP OVER ME AND ALL ALREADY LINKED TO ME. + PUSHJ P,TYCI66 + JFCL +TYCI41: POP P,I + MOVEI A,40 + PUSHJ P,TTYI13 + JRST POPJ1 + +;TYPE UNAME OF 1 OF MY TTYS ON 1 OF HIS. +TYCI66: HRRZ C,TTYCOM(H) + CAIE C,-1 + JRST TYCI72 + CAIN H,(I) ;BUT DON'T TYPE MY NAME ON HIM. + CAME TT,-4(P) + CAIA + JRST POPJ1 +TYCI72: MOVEI C,(I) ;PUT THIS TTY # IN C, + MOVE I,-4(P) ;GET HIS BACK IN I SINCE STILL TYPING ON HIM. + CAMN C,-2(P) ;IF THIS ISN'T MY TTY, + JRST TYCI67 + MOVEI T,[ASCIZ/ AND /] ;THEN IT'S SOMEONE LINKED TO ME + PUSHJ P,TYCI40 ;AND MY NAME WAS ALREADY TYPED + MOVE C,-1(P) +TYCI67: HRRE C,TTYSTS(C) ;MY USER INDEX + JUMPL C,TYCI92 + MOVE C,UNAME(C) + HLRE A,C + AOJE A,TYCI92 +TYCI91: PUSH P,C + MOVSI T,(440600,,(P)) +TYCI42: ILDB A,T + JUMPE A,POP1J1 + ADDI A,40 ;CONVERT MY UNAME FROM SIXBIT TO ASCII + PUSHJ P,TTYI13 ;ECHO CHARACTER ON HIS TTY + TLNE T,770000 + JRST TYCI42 + JRST POP1J1 + + +TYCI92: MOVSI C,(SIXBIT /T/) + LDB T,[030300,,-1(P)] + ADDI T,20 + DPB T,[300600,,C] + LDB T,[000300,,-1(P)] + ADDI T,20 + DPB T,[220600,,C] + JRST TYCI91 + +;ACTUALLY JOIN MY TTY AND HIS IN COM LINK. +;ENTER WITH HIS TTY # IN I AND MINE IN H. +;LEAVE WITH MINE IN I AND HIS IN H, TT. +TYCI43: TLO Q,%TCTPN ;WHEN HE LEAVES COM MODE TYPE ^_N AT HIM. + PUSHJ P,TYCI63 ;PUT HIM IN COM MODE IF HE ISN'T ALREADY. + MOVE TT,I ;HIS TTY # IN TT, MINE IN H. + PUSHJ P,TYCREP ;LOOP OVER TTYS LINKED TO HIM. + PUSHJ P,TYCI68 ;PRINT OUT MSG FROM ON ALL LINKED TO HIM, NOT HIM. + JFCL + EXCH TT,H ;INTERCHANGE HIS AND MINE. + MOVE I,TT ;LOOK AT ALL LINKED TO ME. + PUSHJ P,TYCSET ;WHEN I CHANGES, RELATED ACS SHOULD ALSO CHANGE. + TLO Q,%TCTPN ;WHEN HE LEAVES COM MODE TYPE ^_N AT HIM. + PUSHJ P,TYCI63 ;PUT HIM IN COM MODE IF HE ISN'T ALREADY. + PUSHJ P,TYCREP ;ON EACH OF MINE, GIVE NAMES OF HIS. + PUSHJ P,TYCI69 + JFCL + MOVE TT,H + MOVE A,TTYCOM(TT) ;SET UP LINK + MOVE B,TTYCOM(I) ;LINK TTYCOM WORDS + HRRE E,A + AOJN E,TYCI45 + HRRM TT,A +TYCI45: HRRE E,B + AOJN E,TYCI46 + HRRM I,B +TYCI46: HRRZ D,A + HRRZ E,B + HRRM E,A + HRRM D,B + MOVEM A,TTYCOM(TT) + MOVEM B,TTYCOM(I) + MOVEI A,TYCG + MOVEM A,TTYIPC(I) + MOVEM A,TTYIPC(TT) + POPJ P, + +TYCI69: CAIE I,(TT) ;PRINT MSG ON ONE OF MY TTYS. + JRST TYCI70 + SKIPA T,[[ASCIZ/OK /]] ;MY TTY, SAY "G". +TYCI70: MOVEI T,[ASCIZ/ +LINK TO /] + JRST TYCI71 ;DUE TO EXCH'S IN TYCI43, + ;EXCHANGE "ME" AND "HIM" IN COMMENTS IN TYCI71. + +;TTYIPC FOR A ^_C'ER WHO IS QUERYING IS EITHER TYCRW OR TYCRW2. +;THAT IS DEPENDED ON. +TYCRW: PUSHJ P,TCNRM + CAIE E,^G ;^_C'ER MAY USE ^G TO GET ATTENTION. + SKIPGE COMT3(I);IN IEC MODE CAN ALSO SAY THE NAME + JRST TYCRW4 + CAIE E,^_ ;IGNORE ALL TYPEIN EXCEPT ^G AND ^_N. + POPJ P, + JSP D,TYCRDE ;^_, ECHO IT AND GET NEXT CHAR. +TYCRW2: PUSHJ P,TYCLWR + CAIN E,"N + JRST TYCI2 + MOVEI A,"? ;^_ FOLLOWED BY OTHER THAN N. + MOVEI B,TYCRW + MOVEM B,TTYIPC(I) + JRST TTYI13 ;ECHO ? AND GO BACK TO TYCRW + +TYCRW4: PUSHJ P,TTYI18 ;^_C'ER TYPED ^G - ECHO ON HIS TTY + MOVE I,COMT1(I) ;AND ^_C'D TTY. + PUSHJ P,TYCSET + JRST TTYI13 + +;THE TTYIPC FOR A TTY IN A COM LINK NORMALLY POINTS HERE. +;ECHO OR INPUT THE CHAR ON ALL TTYS IN THE LOOP ACCORDING TO SETTINGS +;OF THE RELEVANT %TCICO, %TCLFT AND %TCRFT BITS. +TYCG: MOVE E,A + ANDCMI E,#177 .SEE TYCI3 + CAIN E,^_ ;REC CHRS IN COM MODE + JRST TYCGTN +TYCG21: PUSH P,TTYCOM(I) ;SAVE COMMUNICATE WORD. + PUSH P,I ;SAVE MY CONSOLE NUMBER + PUSH P,A ;SAVE THE CHARACTER + TLNE Q,%TCICO ;SKIP IF INPUT COM OVERRIDE OFF + PUSHJ P,TTYI2 ;PROCESS INPUT OVERRIDE + TLNN Q,%TCICO + PUSHJ P,TTYI18 ;ECHO CHR ON MY TTY IF %TCICO NOT SET, OTHERWISE GIVE TO PROGRAM + MOVE A,(P) ;RESTORE CHARACTER +TYCG5: HRRE B,TTYCOM(I) ;FIRST TTY IN CHAIN + JUMPL B,[JRST 4,.] ;I'M NOT COMMUNICATING WITH ANYONE + CAME B,-1(P) ;SKIP IF I'M COMMUNICATING WITH MYSELF +TYCG3: SKIPL C,TTYCOM(B) ;SKIP IF HE IS IN COMMUNICATE MODE (THIS POINT IS "COM IN") + BUG ;LOSSAGE + MOVE I,B ;GET HIS TTY NUMBER IN I + MOVE R,TTYTYP(I) + MOVE B,-2(P) + TLNE B,%TCRFT ;IF MY %TCRFT AND HIS %TCLFT SET, + TLNN C,%TCLFT + JRST TYCG1 + MOVSI U,%TSLCZ ;GIVE CHAR TO HIS PROGM. + ANDCAB U,TTYSTS(I) + PUSHJ P,TTYI2 ;TREAT CHAR AS INPUT FROM HIS TTY. + JRST TYCG2 ;PROCESS NEXT TTY IN CHAIN + +TYCG1: PUSHJ P,TTYI13 ;OUTPUT CHAR ON HIS CONSOLE +TYCG2: MOVE A,(P) ;RESTORE CHARACTER + HRRE B,TTYCOM(I) ;NEXT TTY IN CHAIN + JUMPL B,[JRST 4,.] ;CHAIN ENDS STRANGELY + CAME B,-1(P) ;SKIP IF DONE + JRST TYCG3 ;PROCESS NEXT TTY + SUB P,[3,,3] + POPJ P, + +;COME AFTER READING UNAME AFTER ^_K, HIS TTY # IN B. +TYCK1: PUSHJ P,TYCREP ;NO GOOD IF THAT TTY ISN'T LINKED TO ME. + CAIN B,(I) + CAIN B,(I) ;BUT NO GOOD IF IT IS ME. + JRST TYCK2 ;NO GOOD, COMPLAIN. + MOVE I,B + PUSHJ P,TYCSET ;GET HIS TTYCOM IN Q. + JRST TYCGTM ;NOW PRETEND HE DID ^_N (READ "HIM" FOR "ME") + +TYCK2: MOVE A,TTYIPC(B) + CAIE A,TYCRW + CAIN A,TYCRW2 + CAME I,COMT1(B) + JRST TYCI7F ;NOT LINKED TO THIS GUY, GIVE "?" + JRST TYCQRF ;FLUSH GUY WHO WAS QUERYING + +;^_N TYPED IN. +TYCN: TLZ Q,%TCTPN ;I DON'T NEED ^_N SUPPLIED IF I JUST TYPED IT IN MYSELF. + PUSHJ P,TYCI2 ;ECHO THE N AND STORE Q. ALSO RESTORE TTYIPC AND TTYCOM TO NORMAL. + SKIPL TTYCOM(I) + POPJ P, + +;ASSUMING THAT TTY IN I IS IN A COM LINK, UNLINK IT. +;IF ONLY ONE OTHER TTY IS IN THE LINK, REMOVE IT FROM COM MODE TOO. +TYCGTM: HRRE B,TTYCOM(I) .SEE TTYLFC + JUMPL B,[JRST 4,.] ;WASN'T COMMUNICATING WITH ANYONE + CAMN B,I + BUG ;COMMUNICATING WITH SELF +TYCGT3: HRRE C,TTYCOM(B) + JUMPL C,[JRST 4,.] ;LIST NOT CIRCULAR + CAMN C,I + JRST TYCGT4 ;B HAS TTY NUMBER OF GUY POINTING TO ME + MOVE B,C + JRST TYCGT3 + +TYCGT4: HRRZ C,TTYCOM(I) + PUSH P,B + PUSH P,C + PUSHJ P,TYCGT2 ;TAKE ME OUT OF COM MODE. + POP P,C + POP P,B + EXCH I,B + PUSHJ P,TYCSET + CAME C,I ;SKIP IF ONLY 1 IN LOOP BESIDES ME. IF SO, HE'S UNLINKED TOO. + JRST TYCGT5 +;MARK TTY IN I AS UNLINKED AND NOT N COM MODE. TYPE ^_N ON IT IF NECESSARY. +TYCGT2: HRRI Q,-1 + TLZ Q,400000+%TCLFT+%TCRFT + TLZN Q,%TCTPN + JRST TYCI17 + MOVEI T,[ASCIZ/N/] + PUSHJ P,TYCI40 + JRST TYCI17 + +TYCGT5: HRRM C,TTYCOM(I) ;TAKE ME OUT OF THE CIRCULAR LIST + MOVEI H,(B) + SETO TT, ;FOOL TEST AT TYCI66 + PUSHJ P,TYCREP ;TELL ALL THE OTHERS THAT I'VE LEFT. + PUSHJ P,TYCI73 + JFCL + POPJ P, + +TYCI73: JSP T,TYCI71 ;PRINT MSG AND MY UNAME ON TTY # IN I. + ASCIZ/ +BYE FROM / + +SUBTTL TTY OUTPUT INTERRUPT LEVEL + +OVHMTR TTO ;TTY OUTPUT INTERRUPT LEVEL + +;HANDLE AN OUTPUT INTERRUPT FROM A CHAR-AT-A-TIME CONTROLLER. +TYPSC: MOVEI B,1 + MOVEM B,DBBCC + MOVEM B,DBBCC1 + MOVE B,[444400,,STYICH] + MOVEM B,DBBBP +;HANDLE AN OUTPUT INT. ON A MULTI-CHAR CONTROLLER, ASSUMING +;COUNT AND B.P. ARE ALREADY SET UP. +TYP: LDB J,[220300,,TTYTYP(I)] ;GET TTY OUTPUT SPEED. +TYP0: ;COME HERE FOR DPK; J ALREADY SET UP. +IFN NNVTTS,[ + CAMN I,NOVATT + JRST TYP0N +] + HRRZ W,TCTYP(I) + MOVE T,TTYTYP(I) + MOVE H,TTYOPT(I) + HRRZ A,TTOALC(I) + JUMPE A,[SETOM TTYOAC(I) + JRST TYP1C] ;IF TTY HAS NO SPACE FOR ANY OUTPUT, STOP SENDING. + MOVE A,TIME + MOVEM A,TTLTM(I) ;UPDATE TIME OF LAST OUTPUT THIS TTY. +TYP0F: PUSHJ P,TYPLUP ;OUTPUT AT LEAST 1 CHAR. + SKIPGE TTYOAC(I) + JRST TYP1C + SKIPLE DBBCC ;SKIP IF OUT OF ROOM + JRST TYP0F ;CONTINUE MESSAGE +TYP1B: SKIPGE A,DBBCC + BUG ;CONTROLLER'S BUFFER OVERFILLED? + SUB A,DBBCC1 ;GET -<# CHARS WE ARE SENDING> + SKIPL E,A + BUG ;SENDING NO CHARS OR NEGATIVELY MANY? + ADD A,TTOALC(I) ;IF THE ALLOCATION ISN'T INFINITE, + TRNN A,400000 + HRRM A,TTOALC(I) ;DECREMENT IT BY # CHARS JUST OUTPUT. +IFN MTYP,[ + TRNN T,%TYMTY ;IF MTY ISN'T THE ONLY CONTROLLER, CHECK FOR THE OTHERS + JRST TYP1D + CONO MTY,@TTYLT(I) + DATAO MTY,MTYOW + POPJ P, + +TYP1D: ] +IFN DPKPP,[ + TRNN T,%TYDPK + JRST TYP1E + MOVN A,E ;- - # CHARS OUTPUT + ADDM A,@DPKC-NFDPTY(I) ;GIVES # OF CHARS FOR CONTROLLER. + XCT TTYST(I) ;TELL THE DPK THEY'RE THERE. + POPJ P, + +TYP1E:] +IFN DL10P,[ + TRNN T,%TYDL + JRST TYP1G + MOVNM E,DL10CC ;STORE # CHARS BEING SENT. + MOVE A,[340000,,DL10BF-1] + MOVEM A,DL10BP ;GIVE THE 11 ITS MAGIC POINTER TO SNARF THE BUFFER. + MOVEM I,DL10LN ;STORE LINE # OF TTY, THUS TELLING 11 TO GO AHEAD. + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, +TYP1G:] +IFN KL10P,[ + TRNN T,%TYETY + JRST TYP1I + SKIPL DTEOUT + BUG ;OVER-RUNNING PREVIOUS TRANSFER + MOVE A,[441000,,DTEOBF] ;SET UP BYTE POINTER FOR 10-11 CHANNEL + MOVEM A,DTEBPO + MOVN A,E ;NUMBER OF CHARACTERS BEING SENT + HRLI A,%DCTYO(I);SEND TYPE-OUT COMMAND, AND LINE NUMBER + MOVEM A,DTEOUT ;GIVE COMMAND TO 11 + MOVEM A,DTEBBY ;FLAG BUFFER BUSY (AND REMEMBER WHICH COMMAND FOR DEBUGGING) + MOVEI A,10. ;5-SECOND TIMEOUT FOR LOST TO-11 XFER DONE INTERRUPT + MOVEM A,DTEBBT ;WHICH SEEMS TO HAPPEN NOW & THEN FOR SOME REASON + CONO DTE,%DBL11 ;AND GIVE INTERRUPT + POPJ P, +TYP1I:];KL10P + TRNN T,%TYSTY + JRST TYP1H + MOVEI A,TOBS + CAML A,TORM(I) + POPJ P, + MOVE A,TTYBYP(I) + ILDB B,A + JUMPE B,TYPEND + POPJ P, + +TYP1H: MOVE A,STYICH ;HANDLE CHAR-AT-A-TIME CONTROLLERS. + TLNN T,%TTPAR ;GENERATE A PARITY BIT IF NECESSARY. + JRST TYPDA1 + IMUL A,[2010040201] + AND A,[21042104377] + IDIVI A,17_7 + MOVE A,B +TYPDA1: CAIL I,NFDPTY + BUG + XCT TTYDO(I) ;DATAO XXX,A + POPJ P, + +TYP1C: MOVE E,DBBCC + CAME E,DBBCC1 ;SKIP IF NOTHING TO SEND + JRST TYP1F ;SEND WHAT THERE IS + XCT TTYDFF(I) ;CLEAR OUTPUT DONE + POPJ P, + +TYP1F: AOS TTYOAC(I) + JRST TYP1B + +IFN NNVTTS,[ +TYP0N: AOSE NVTSIP ;CHAR PENDING? + JRST TYP0A ;NO + DATAO NTY,NVTSSC ;SEND CHR AFTER SELECT + POPJ P, + +TYP0A: SKIPN A,NVOPTT + .ERR Shouldn't this be using NFNVTY Instead? + MOVEI A,NOTYS+NNTYS+NNVTTS-1 + MOVEM A,NNVSEC ;SET UP END CHECK + SKIPN I,NVOPTT + MOVEI I,NOTYS+NNTYS ;INITIALIZE + SETOM NNVSFL ;SET FIRST TIME THRU FLAG + MOVE A,NVTCC + CAIGE A,10 ;SENT TOO MANY CHRS TO THIS CONSOLE W/O LOOKING AT OTHERS? + JRST TYP ;NO, LOOK AT CONSOLE + SETZM NVOPTT + SETZM NVTCC ;YES LOOK AT OTHERS +TYP0C: AOS I + CAIL I,NOTYS+NNTYS+NNVTTS + SUBI I,NNVTTS + AOS NNVSFL + JRST TYP +] + +;FEED SOME CHARACTERS FROM OUTPUT BUFFER TO THE TTY. +TYPLUP: SKIPE TTYBYP(I) + JRST TYPBP + MOVE Q,TOOP(I) + MOVE E,TORM(I) +TYPLU1: CAIL E,TOBS + JRST [ MOVEM E,TORM(I) ;OUTPUT BUFFER EMPTY + MOVEM Q,TOOP(I) + JRST TYPEND ] + MOVE D,Q + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB A,Q ;GET NEXT CHARACTER FROM OUTPUT BUFFER + CAIL A,%TXDIS-1 ;IF DISPLAY OR CURSOR MOTION, DISPATCH. + JRST [ MOVEM E,TORM(I) ;LEAVING THE FAST LOOP + MOVEM D,TOOP(I) ;WITHOUT EATING THIS CHAR YET + CAIN W,%TNSFW ;"SOFTWARE" TTY GETS THE CODES + JRST TYPSFW ;AS THEY APPEAR IN THE BUFFER. + CAIL A,%TDMAX + JRST TYEEO1 + JRST @TYPDTB-%TXDIS(A)] + TLNN H,%TOSAI ;CTL CHARS ARE SPACING IFF SAIL CHAR SET; + CAIL A,40 ;NON-CONTROLS ARE SPACING. + AOS TTYIHP(I) +IFN MTYP,[ + JUMPE A,[ TRNE T,%TYMTY ;MTY CAN'T SEND NULLS EXCEPT AS FIRST CHAR IN WORD + PUSHJ P,MNULLO + JRST .+1 ;OUTPUT IT NOW + MOVE Q,D ;BACKUP BYTE POINTER AND OUTPUT IT LATER + JRST TYPLU2] +];MTYP + IDPB A,DBBBP ;PUT INTO DEVICE BUFFER + SOSLE DBBCC + AOJA E,TYPLU1 + AOS E ;MAXIMUM AMOUNT OF CRUFT GENERATED +TYPLU2: MOVEM E,TORM(I) + MOVEM Q,TOOP(I) + POPJ P, + +IFN MTYP,[ +MNULLO: MOVE A,DBBCC ;SKIPS IF NULL MAY NOT BE OUTPUT TO MTY NOW + SETZM DBBCC + SUBM A,DBBCC1 + MOVNS DBBCC1 + CAIE A,MTYNC + JRST POPJ1 + SETZB A,MTYOW + AOS DBBCC + AOS DBBCC1 + POPJ P, +];MTYP + +;HERE TO OUTPUT CHARACTER WHEN NOT IN FAST LOOP +TYPSIO: +IFN MTYP,[ + JUMPE A,[ TRNE T,%TYMTY ;MTY CAN'T SEND NULLS EXCEPT AS FIRST CHAR IN WORD + PUSHJ P,MNULLO + JRST .+1 ;OUTPUT IT NOW + POPJ P, ] ;WAIT +];MTYP + MOVEM Q,TOOP(I) ;REMOVE CHAR FROM OUTPUT BUFFER. + AOS TORM(I) + +;OUTPUT CHAR IN A TO TTY, AND LOOP BACK TO TYPLUP IF THERE IS +;ROOM FOR MORE CHARS. (OTHERWISE POPJ OUT OF TYPLUP). +TYPOU2: IDPB A,DBBBP ;FOR FAST CONTROLLERS, STICK CHAR IN LOW LVL BUFFER. + SOSLE DBBCC + JRST TYPLUP ;ROOM FOR MORE CHARS. + POPJ P, + +;ACTUALLY OUTPUT A CHAR TO THE TTY (AND POPJ). +TYPOUT: +IFN MTYP,[ + TRNE T,%TYMTY + JUMPE A,CPOPJ ;MTY CAN'T HANDLE NULLS. +] + IDPB A,DBBBP + SOSGE DBBCC + BUG + POPJ P, + +TYPSFW: TRNE T,%TYSTY ;STY TTY IN SOFTWARE MODE => + JRST TYPSFS ;SEND THE 8-BIT FROB + SUBI A,%TXDIS-2 ;ELSE SEND IT, ESCAPED BY A RUBOUT, WITH 176 + CAIE A,%TDMV0-%TXDIS+2 ; SUBTRACTED FROM IT SO FITS IN 7 BITS + CAIN A,%TDMV1-%TXDIS+2 + JRST [ MOVE E,TORM(I) ;FOR %TDMV1, MUST INCREMENT THE 2 ARGS. + CAILE E,TOBS-3 + JRST TYPEND + JRST TYPSF2] + CAIE A,%TDMOV-%TXDIS+2 + JRST TYPSF0 + MOVE E,TORM(I) ;AND FOR %TDMOV, MUST INCREMENT THE 4 ARGS SO THEY'RE NOT 0. + CAILE E,TOBS-5 ;IF NOT ALL IN BUFFER, WAIT FOR THEM. TTY WILL BE STARTED AGAIN. + JRST TYPEND +IRPS TYPSF1,,TYPSF4:TYPSF3:TYPSF2:TYPSF1: ;DIGIT MANY CHARS FOLLOW +TYPSF1: DPB A,Q ;STORE PREV. CHAR, FIXED UP. + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB A,Q + ADDI A,1 ;UPDATE %TDMOV ARGS BY ADDING 1. +TERMIN +TYPSF0: DPB A,Q ;OK, THE COMMANDS ARE ALTERED, SO SEND THE 177. + MOVEI A,%TXDIS-1 + JRST TYPOU2 + +IFE NETP,TYPSFS== +IFN NETP,[ +;HERE FOR OUTPUT OF 8-BIT FROB TO A SOFTWARE TTY THAT IS A STY +TYPSFS: CAIN A,%TDORS ;SKIPS INTO TYPORS +;HERE FOR %TDORS IN OUTPUT BUFFER +TYPORS: SKIPN TYPNTF + JRST TYPSIO +;HERE FOR %TDORS OUTPUT BY STY DIRECTLY INTO A NET SOCKET +IFN CHAOSP\TCPP, MOVE T,STYSTS-NFSTTY(I) ; Get flags for STY +IFN CHAOSP,[ + TLNE T,%SSCHA ; If Chaosnet, + JRST TYPOR1 ; don't send "INS" +];CHAOSP +IFN TCPP,[ + TLNN T,%SSTCP ; If TCP, send magic chars in URGENT mode. + JRST TYPOR2 + HRRZ A,STYNTI-NFSTTY(I) ; Get TCB index + SKIPL XBSTAT(A) ; Verify that COS is locked down + BUG HALT,[TCP: Buff not locked] + HLRZ T,XBOCOS(A) ; Find orig val of XBOBC + SUB T,XBOBC(A) ; Find # bytes already in buffer + CAIGE T, + BUG HALT ; Just-in-case check + MOVE H,STYORC-NFSTTY(I) ; Get magic 8-bit chars to send + TLNE H,(377_<<8.*3>+4>) ; Check 1st char + AOJA T,[TLNE H,(377_<<8.*2>+4>) ; Check 2nd char + AOJA T,[ TDNE H,[377_<8.+4>] ; Check 3rd char + AOJA T,.+1 + JRST .+1] + JRST .+1] + MOVEM T,XBSUP(A) ; Store # chars up to # including magic chars + ; as the TCP URGENT pointer. + JRST TYPOR1 +TYPOR2: +];TCPP +IFN NCPP,[ + HRRZ A,STYNTI-NFSTTY(I) ;GET NET INDEX + PI2SAF + MOVE T,IMFCQL ;IF INSUFFICIENT SPACE IN + CAIG T,2 ; THE CONTROL QUEUE, + JRST [ MOVSI T,200000 ; DEFER SENDING THIS + IORM T,IMSOC5(A) ;AND REQUEST TTY WAKEUP LATER + AOS IMNAS ;TELL 1/2 SECOND CLOCK + AOS IMNORH + MOVE T,TTYTYP(I) ;NEEDED BY TTY ROUTINES + JRST TYPEN1 ] + EXCH A,I ;A TTY IDX, I NET IDX + PUSH P,Q + PUSH P,IMPCSH + LDB T,IMSCFH + MOVEM T,IMPCSH ;SECRET ARGUMENT TO IMSTCM + JSP T,IMSTCM + 2,,1 + BUG PAUSE,[TTY: NO IMP BUFFERS AVAILABLE FOR "INS" MSG] + MOVSI B,8_10. ;INS + LDB C,IMSCLN ;LINK # + DPB C,[241000,,B] + MOVEM B,10(Q) + PUSHJ P,IMWCQ + POP P,IMPCSH + POP P,Q + MOVE I,A +] ;IFN NCPP +TYPOR1: MOVE H,TTYOPT(I) + MOVE T,TTYTYP(I) + MOVE W,TCTYP(I) + MOVEI A,STYORC-NFSTTY(I) ;TYPE OUT THE MAGIC CHARACTERS + HRLI A,440800 + JRST TYEEO2 +];NETP + +;COME HERE FROM TYPLUP WHEN THERE'S NOTHING TO TYPE OUT. +;CALL ALSO FROM TT11I4 WHEN THE PDP11 SAYS THE OUTPUT BUFFER IS EMPTY. +TYPEND: PUSHJ P,TYPEN2 +TYPEN1: SETOM TTYOAC(I) + POPJ P, + +;SUBROUTINE TO ACTIVATE ANY ECHOING ETC. THAT MAY NEED TO BE DONE +TYPEN2: SKIPGE TYOSW(I) ;IF ECHOING CAN BE DONE NOW, + SKIPL TTOALC(I) + POPJ P, + MOVE Q,TTYCOM(I) + TLNN Q,%TCDNG ;IS THERE ECHOING NEEDING TO BE DONE? + SKIPE ECHOC(I) + PUSHJ P,TTYI7 ;IF SO, QUEUE IT. + SKIPGE TTYLPP(I) + PUSHJ P,TTYI7 ;ALSO FORCE OUT BUFFERED CURSOR MVT. + POPJ P, + +IFN NNVTTS,[ +TYP5: CAMN I,NNVSEC ;REACHED END + AOSG NNVSFL ;AND NOT FIRST TIME + JRST TYP0C ;LOOK AT OTHER NOVA CONSOLES + MOVE I,NOVATT + JRST TYP1C +] + +;IF TTYBYP ISN'T 0, IT IS B.P. TO ASCIZ STRING TO TYPE. +;COME HERE TO OUTPUT THE NEXT CHAR OF THE STRING OR CLEAR TTYBYP. +TYPBP: ILDB A,TTYBYP(I) + TRZE A,400 ;KLUDGE FOR C-100 (and others) TO GET NULLS OUT +IFE MTYP,JRST TYPOU2 +.ELSE [ JRST [ TRNE T,%TYMTY + PUSHJ P,MNULLO ;MTY CAN'T SEND NULLS EXCEPT AS FIRST CHAR IN WORD + JRST TYPOU2 ;OUTPUT THE NULL NOW + MOVSI A,100000 ;BACK UP BYTE POINTER + ADDM A,TTYBYP(I) + POPJ P, ] ;OUTPUT PARTIAL WORD THEN SEND NULL NEXT TIME +];MTYP + JUMPN A,TYPOU2 ;NOT END => OUTPUT THE CHAR. + MOVE A,@TTYBYP(I) ;AT END, CHECK FOR SPECIAL + TRNE A,1 ; TEKTRONIX DELAY KLUDGE + JRST TYPBP1 +TYPBP2: CLEARM TTYBYP(I) ;END OF ASCIZ STRING. + JRST TYPLUP + +TYPBP1: MOVSI B,7700 ;CLEAR SIZE FIELD + ANDCAB B,TTYBYP(I) + LDB A,[$TTOSP,,TTYTYP(I)] + MOVM A,BAUDRT(A) ;GET BITS PER SECOND + MOVE B,1(B) ;GET SPECIFICATION WORD SAYING WHAT PADDING WE WANT. + CAMN B,[SETZ] + JRST TYPBP3 ;JUMP IF SPECIAL KLUDGE FOR TEKTRONIX + JUMPG B,TYPBP4 ;JUMP IF PADDING INDEPENDENT OF VPOS. +; this is fixed elsewhere now. +; MOVE Q,TCTYP(I) ;IS THIS AN H19 +; CAIN Q,%TNH19 ;H19'S HAVE TO BE PADDED WITH NUL's +; JRST TYPBP8 ; SO HANDLE THEM SPECIALLY + PUSHJ P,TYPBP6 ;CALCULATE NUMBER OF CHARACTERS OF PADDING NEEDED + JRST TYPBP5 + +TYPBP4: IMUL B,A ;1000. * NUMBER OF BITS PADDING + IDIVI B,10000. ;NUMBER OF CHARACTERS PADDING (NOTE ROUND-DOWN) +TYPBP5: SETZM TTYBYP(I) ;IN CASE NO PADDING REQUIRED + PUSHJ P,TYMPAD ;PUT THE PADDING BYTE POINTER INTO TTYBYP + JRST TYPLUP + +TYPBP3: IDIVI A,9 ;GET CHARACTERS PER 1.1 SECOND + SKIPL TTYIHP(I) ;KLUDGE KLUDGE + MOVNM A,TTYIHP(I) ;BUT IT'S GOTTA BE STORED SOMEPLACE + AOSL TTYIHP(I) + JRST TYPBP2 ;SIGH, DELAY COMPLETED + MOVEI A,^V ;NOT YET COMPLETED, SEND ANOTHER PAD + JRST TYPOU2 + +TYPBP6: MOVMS B + IMUL A,B ;IF NEGATIVE, TAKE ABS VALUE + MOVE B,TCMXV(I) ;TIMES NUMBER OF LINES AT AND BELOW THE CURSOR. + SUB B,TTYIVP(I) + IMUL B,A ; 1000.* NUMBER OF BITS OF PADDING + IDIVI B,10000.*8. ; DIVIDE BY 10000. TO GET NO. OF CHARS OF PADDING + ; AND THEN BY 8 BECAUSE PER LINE TIMES ARE EXPRESSED + POPJ P, ; IN TERMS OF 1/8 MS FOR BETTER RESOLUTION + +;once upon a time someone thought that this might cause padding with nulls to +;happen. It didn't work. +;TYPBP8: SKIPL TTYIHP(I) ;TO EXPAND UPON A KLUDGE +; JRST [ PUSHJ P,TYPBP6 ;CALCULATE THE # OF CHARS NEEDED +; MOVNM B,TTYIHP(I) ;AND SAVE THEM AWAY TO BE COUNTED +; JRST .+1 ] +; AOSL TTYIHP(I) ;COUNT THIS CHARACTER +; JRST TYPBP2 ; DELAY COMPLETED, RESET WORLD +; SETZ A, ;NUL! +; JRST TYPOU2 ;STUFF IT IN THE BUFFER, AND FIND WAY BACK HERE + +;COME HERE TO DO CURSOR MOTION ON PRINTING TTYS. +;TT HAS DESIRED HPOS; D HAS DESIRED VPOS. +TYMPRR: MOVE B,TCMXH(I) + SUBI B,1 + CAMGE B,TTYIHP(I) + MOVEM B,TTYIHP(I) +TYMPRT: CAIN W,%TNMEM + JRST [ CAMLE D,TTYIVP(I) ;VERTICAL MOTION NEEDED, AND CURSOR NOT AT LEFT MARGIN? + SKIPN TTYIHP(I) + JRST .+1 ;(PREVENT INFINITE CR LOOP). + SETZ TT, ;START WITH A CR. + JRST TYMPH1] ;MEMOWRECK LOSES LF'ING IN MID-LINE. + CAMGE TT,TTYIHP(I) ;BACKWARD MOTION TAKES PRIORITY. + JRST TYMPH1 + CAMLE D,TTYIVP(I) ;THEN DOWNWARD MOTION. + JRST TYMPV2 + CAMLE TT,TTYIHP(I) ;THEN FORWARD MOION. + JRST TYMPHF + MOVEM D,TTYIVP(I) ;MUST BE UPWARD MOTION + JRST TYMOV8 ;WHICH IS A NO-OP ON PRINTING TTYS. + +TYMPV2: AOS TTYIVP(I) ;MOVING DOWN: DO ONE LF + MOVEI A,^J + PUSHJ P,TYPOUT + PUSHJ P,TYMOVX ;IF REACHED GOAL, SAY FINISHED. + LDB B,[$TPPLF,,TTYOPT(I)] + CAIN W,%TNTRM + ADDI B,TYMTVT-TYMPVT + CAIN W,%TNMEM + ADDI B,TYMMVT-TYMPVT + HRRZ B,TYMPVT(B) ;# PADDING AFTER LF. + JUMPN B,TYMPAD + POPJ P, + +TYMPVT: 0 ;NORMAL + 2 ;2741, MEMOWRECK +REPEAT 6,2+.RPCNT ;EXTRA +TYMTVT: 0 ;UNPADDED TERMINET + 3 ;10CPS TERMINET + 4 ;15CPS TERMINET + 10 ;30CPS TERMINET + 17 ;60CPS TERMINET + 35 ;120CPS TERMINET (MAX SPEED) + 0 + 0 +TYMMVT: 0 ;UNPADDED WRECK + 0 + 0 + 1 ;30CPS WRECK + 2 ;60CPS +REPEAT 3,0 + +TYMPHF: LDB B,[$TPPTB,,TTYOPT(I)] ;FORWARD: CAN WE DO IT WITH TABS? + JUMPE B,TYMPH6 ;TABS NOT ALLOWED ON THIS TTY. + MOVE A,TTYIHP(I) + ANDCMI A,7 ;SEE WHERE A TAB WOULD BRING US. + ADDI A,10 + CAILE A,(TT) ;BEYOND WHERE WE WANT TO GO? + JRST TYMPH6 + SUBI A,(B) ;A HAS TAB STOP - <# PADDING>-1 + CAMG A,TTYIHP(I) ;TAB FASTER THAN SPACES (INCLUDING PADDING)? + JRST TYMPH6 ;NO, USE SPACES. + ADDI A,(B) ;A HAS TAB STOP. + MOVEM A,TTYIHP(I) + MOVEI A,^I + SOJA B,TYMPT1 ;B HAS # PADDING AFTER TAB. + +TYMPH6: MOVEI A,40 ;GO FORWARD WITH SPACES + MOVE C,[AOS TTYIHP(I)] + JRST TYMPH7 + +TYMPH2: MOVEI A,^H ;GO BACKWARD WITH BACKSPACES + MOVE C,[SOS TTYIHP(I)] +TYMPH7: MOVE B,TT + SUB B,TTYIHP(I) + MOVMS B ;HOW MANY TIMES TO PUT CHAR +TYMPH8: XCT C + IDPB A,DBBBP + SOSG DBBCC + JRST TYMOVY + SOJG B,TYMPH8 + JRST TYMOVX + +;COME HERE TO MOVE BACKWARDS. +TYMPH1: MOVE A,TTYIHP(I) + SUB A,TT ;A HAS # CHARS IF WE BACKSPACE. + LDB B,[$TPPCR,,TTYOPT(I)] + JUMPE B,TYMPH9 + MOVE E,B ;E HAS PADDING TYPE OF TTY, + MOVE B,TTYIHP(I) ;B HAS CURRENT HPOS. + CAIL E,<.BM $TPPCR,_-.TZ .BM $TPPCR>-TYMPHL+1 ;THIS ONE A SPECIAL $TPPCR CODE? + JRST @TYMPHT-<.BM $TPPCR,_-.TZ .BM $TPPCR>-1(E) + LDB C,[$TTOSP,,TTYTYP(I)] + SUBI C,2 ;(THIS ONLY WORKS FOR SPEED CODES 2,3,4,5) + ANDI C,3 ;(= 110, 150, 300, 1200 BAUD). + MOVE C,(C)[33. ? 20. ? 10. ? 5] + IDIV B,C ;1 PAD CHAR FOR EACH (33./20./10./5) SPACES TO MOVE. + ADDI B,1 ;I.E. MOVES AT 300/PADCODE COLUMNS PER SECOND + IMULI B,(E) ; OR 600/PADCODE COLUMNS PER SECOND AT 1200 BAUD + ADDI B,-1(E) +TYMPH9: MOVE C,D + SUB C,TTYIVP(I) ;IF WE'RE MOVING DOWN AFTER THE CR, HOW MANY LF'S? + JUMPLE C,TYMPH5 + SUB B,C ;EACH LF REDUCES # PADDING NEEDED BY CR. + CAIGE B, ;BUT CAN'T NEED LESS THAN 0 PADDING. + SETZ B, +;B HAS # CHARS PADDING NEEDED AFTER CR, IF WE DECIDE TO CR. +TYMPH5: TLNN H,%TOMVB ;HOW DO WE MOVE BACKWARD? + JRST TYMPH3 ;CAN'T BS => MUST CR AND SPACE FWD. + JUMPE TT,TYMPH3 ;GOING TO COLUMN 0 => ALWAYS CR + TLNN H,%TOOVR ;ON A GLASS TTY, IF STAYING ON THE SAME LINE, HAVE TO + JUMPLE C,TYMPH2 ; USE BACKSPACES TO NOT OBLITERATE PREVIOUS OUTPUT + LDB E,[$TPPTB,,TTYOPT(I)] + JUMPE E,[MOVE C,TT ;CAN'T USE TABS: C _ TIME IF MOVE FWD. + JRST TYMPT2] + PUSH P,B ;CAN USE TABS: SEE HOW LONG TO GO FWD + MOVE B,TT ;USING TABS. + IDIVI B,10 ;NEED C(B) TABS AND C(C) SPACES. + IMULI B,(E) ;B _ TIME NEEDED FOR TABS & PADDING. + ADDI C,(B) ;C _ TIME NEEDED TO GO FWD. + POP P,B +TYMPT2: ADDI C,1(B) ;ADD IN TIME TO CR, + PADDING. + CAMLE C,A + JRST TYMPH2 ;FASTER TO BACKSPACE. +TYMPH3: MOVEI A,^M ;OUTPUT A CR (WILL SPACE FORWARD LATER) + SETZM TTYIHP(I) ;WHEN WE COME BACK WE'LL SEE WE +TYMPT1: PUSH P,B ;NEED TO GO FORWARD. + PUSHJ P,TYPOUT + PUSHJ P,TYMOVX + POP P,B + JRST TYMPAD ;PAD THE TTY (# CHARS PADDING IN B) + +;DISPATCH TABLE FOR SPECIAL %TPPCR CODES. +TYMPHZ: TYMPEX ;EXECUPORT. + TYMP27 ;2741. + TYMPMW ;MEMOWRECK. + TYMPH5 ;CODE 7 NOT USED. +TYMPHT: TYMPHL==.-TYMPHZ + +TYMP27: IDIVI B,10. + CAILE B,14. + MOVEI B,14. + AOJA B,TYMPH5 + +TYMPMW: LDB E,[$TPPLF,,TTYOPT(I)] + JUMPE B,TYMPM1 ;NO CHRS + MOVNS B + ADD B,TYMPMT(E) + CAMGE B,TYMMVT(E) +TYMPM1: MOVE B,TYMMVT(E) + CAMLE D,TTYIVP(I) ;BEFORE LF'ING, MEMOWRECK + JRST TYMPH3 ;MUST CR RATHER THAN BS. + JRST TYMPH5 + +TYMPMT: 0 ;MEMOWRECK MIMIMUM LINE SIZE, AS FUNCTION OF SPEED + 8 ;VIA THE $TPPLF CODE. + 11. + 22. + 43. +REPEAT 3,0 + +TYMPEX: IDIVI B,10. ;EXECUPORT: 1 PAD CHAR FOR EVERY 10 POSITIONS TO CR THRU. + ADDI B,5 + JRST TYMPH9 + +;COME HERE TO PAD A PRINTING TERMINAL: # CHARS OF PADDING IN B. +TYMPAD: AOSG A,B ;AOS COMPENSATES FOR ILDB + POPJ P, + MOVE Q,TCTYP(I) ;is this an H19? + CAIN Q,%TNH19 ;H19's have to be nullified. I mean, padded with nulls. + JRST TYMPNL + CAILE A,199. ;DON'T TRY TO PAD MORE THAN 199 TIMES, WOULD + MOVEI A,199. ; BLOW OUT AT TYPBP1 + IDIVI A,5 + MOVNS A + ADD A,TYMPA1(B) ;CREATE A BP TO A STRING WITH THE RIGHT # OF RUBOUTS. + MOVEM A,TTYBYP(I) + POPJ P, +TYMPNL: CAILE A,399. ;we make an exception for H19's, which need a lot of + MOVEI A,399. ;padding. + IDIVI A,4 ;This works same as with rubouts, but for 9 bits + MOVNS A + ADD A,TYPNL1(B) + MOVEM A,TTYBYP(I) + POPJ P, + +;THIS IS AN ASCIZ STRING OF 199. RUBOUTS. +;SOME FINAL SEGMENT OF IT WILL BE TYPED OUT. +TYMPA0: REPEAT 199./5, -2 +TYMPA2: -400 + +TYMPA1: 010700,,TYMPA2 + 100700,,TYMPA2 + 170700,,TYMPA2 + 260700,,TYMPA2 + 350700,,TYMPA2 + +;This is a not-quite ASCIZ string of 399. pseudo-nulls. They are 9 bits long so +;that the typeout loop will spot the high bit and see that we're not at the end. +;This is used by things that want to be padded with nulls, like h19s. +TYPNL0: REPEAT 399./4,<.BYTE 9 ? 400 ? 400 ? 400 ? 400> +TYPNL2: 400400400000 + +TYPNL1: 001100,,TYPNL2 + 111100,,TYPNL2 + 221100,,TYPNL2 + 331100,,TYPNL2 + +;DISPATCH TABLE FOR CURSOR CONTROL CMDS AND RUBOUT + TYPSIO ;RUBOUT DISPATCHES HERE +TYPDTB: OFFSET %TDMOV-. +%TDMOV::TYMOV ;MOVE CURSOR +%TDMV1::TYMOV2 ;DUMMY COMMAND CREATED BY TYMOV. + ;MAKES IT POSSIBLE FOR TYMOV TO STOP WHEN BUFFER FULL + ;AND BE REENTERED NEXT INTERRUPT. +%TDEOF::TYEEOF ;CLEAR REST OF PAGE +%TDEOL::TYEEOL ;CLEAR REST OF LINE +%TDDLF::TYEDLF ;DELETE FORWARD (FOR ERASABLE OVERPRINTING TTYS) +%TDMTF::TYEMTF ;MOTOR OFF (FOR TERMINETS) +%TDMTN::TYEMTN ;MOTOR ON (FOR TERMINETS) +%TDCRL::TYECRL ;CRLF ON DATAPOINTS, IMLACS. +%TDNOP::TYEEO1 ;NO-OP FOR SUPERDUPERIMAGE MODE. +%TDBS:: TYEBS ;BACKSPACE (FOR TTY'S WITH %TORAW SET). +%TDLF:: TYELF ;LINEFEED ("). +%TDRCR::TYERCR ;CARRET ("). +%TDORS::TYPORS ;"OUTPUT RESET" FOR SAKE OF SOFTWARE TTYS & STYS +%TDQOT::TYEQOT ;DEVICE-DEPENDENT DATA IN NEXT BYTE. +%TDFS:: TYEFS ;FORWARD ONE SPACE +%TDMV0::TYMV0 ;REPLACEMENT FOR %TDMOV +%TDCLR::TYECLR ;CLEAR THE SCREEN +%TDBEL::TYEBEL ;DING THE BELL. +%TDINI::TYEINI ;REINITIALIZE INTELLIGENT TERMINAL +%TDILP::TYEILP ;INSERT LINE POSITION, FOLLOW BY COUNT +%TDDLP::TYEDLP ;DELETE LINE POSITION, FOLLOW BY COUNT +%TDICP::TYEICP ;INSERT CHARACTER POSITION, FOLLOW BY COUNT +%TDDCP::TYEDCP ;DELETE CHARACTER POSITION, FOLLOW BY COUNT +%TDBOW::TYEBOW ;ENTER INVERSE VIDEO MODE +%TDRST::TYERST ;CLEAR ALL SPECIAL MODES (SUCH AS INVERSE VIDEO). +%TDGRF::TYEEO1 ;GRAPHICS, FLUSH IT +%TDRSU::TYERSU ;REGION SCROLL UP +%TDRSD::TYERSD ;REGION SCROLL DOWN + TYEEO1 ;NEXT 4 CODES ARE USED FOR SOME WEIRD FORM OF GRAPHICS OUTPUT + TYEEO1 ;THAT WILL EVENTUALLY BE FLUSHED. + TYEEO1 + TYEEO1 +;FOLLOWING CODES ARE FOR LOCAL EDITING TERMINALS +;NON-SOTFWARE TERMINALS DON'T HANDLE THEM, SO IGNORE THEM. +%TDSYN::TYEIG1 ;RESYNCH REPLY TO LOCAL EDITING TERMINAL. IGNORE 1 ARG. +%TDECO::TYEEO1 ;ASK TERMINAL TO TRY LOCAL EDITING BY SENDING A RESYNCH. IGNORE. +%TDEDF::TYEIG2 ;SET LOCAL EDITING TERMINAL COMMAND DEFINITION. IGNORE 2 ARGS. +%TDNLE::TYEEO1 ;STOP DOING LOCAL EDITING. IGNORE. +%TDTSP::TYEEO1 ;DISPLAYS LIKE SPACE, BUT IS PART OF A TAB. IGNORE. SHOULDN'T HAPPEN. +%TDCTB::TYEEO1 ;THIS LINE IS CONTINUED AT THE BEGINNING. +%TDCTE::TYEEO1 ;THIS LINE IS CONTINUED AT THE END. +%TDMLT::TYEIG2 ;DECLARE MULTI-POSITION CHAR FOR LOCAL EDITING. IGNORE 2 ARGS. +%TDSVL::TYEIG3 ;SAVE LINE CONTENTS. IGNORE 3 ARGS. +%TDRSL::TYEIG3 ;RESTORE LINE CONTENTS. IGNORE 3 ARGS. +%TDSSR::TYEIG2 ;SET RANGE OF COLUMNS TO SAVE. IGNORE 2 ARGS. +%TDSLL::TYEIG2 ;SET LABEL FOR LOCAL LINE SAVING. IGNORE 2 ARGS. +%TDMAX::OFFSET 0 + + +;IGNORE THIS COMMAND AND 3 ARGS. +TYEIG3: MOVE A,TORM(I) + CAILE A,TOBS-4 + JRST TYPEND + AOS A,TORM(I) + IBP Q +;IGNORE THIS COMMAND AND 2 ARGS. +TYEIG2: MOVE A,TORM(I) + CAILE A,TOBS-3 + JRST TYPEND + AOS A,TORM(I) + IBP Q +;IGNORE THIS COMMAND AND 1 ARG. +TYEIG1: MOVE A,TORM(I) + CAILE A,TOBS-2 + JRST TYPEND + AOS A,TORM(I) + IBP Q + JRST TYEEO1 + +TYEQOT: MOVE A,TORM(I) + CAILE A,TOBS-2 + JRST TYPEND + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB A,Q + AOS TORM(I) + JRST TYPSIO + +TYEBEL: MOVEI A,7 + JRST TYPSIO + +;%TDMOV MOVE CURSOR COMMAND DISPATCHES HERE. +TYMOV: MOVE A,TORM(I) + CAILE A,TOBS-5 ;IF THE 4 ARGUMENT CHARS AREN'T IN THE BUFFER YET, + JRST TYPEND ;GO AWAY; WILL COME BACK WHEN THEY ARE OUTPUT. + CAMN Q,TOBEP(I) ;FETCH THE NEXT 2 CHARS WHICH + MOVE Q,TOBBP(I) ;HOLD THE "OLD" POSITION + ILDB A,Q + MOVEM Q,TOOP(I) ;FLUSH FIRST TWO CHARS (AS IF WAS %TDMV0) + MOVEI C,2 + ADDM C,TORM(I) + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB B,Q + CAMGE A,TCMXV(I) + MOVEM A,TTYIVP(I) ;SET INITIAL STARTING PLACE + MOVEM B,TTYIHP(I) + JRST TYMV0A + +TYMV0: MOVE A,TORM(I) ;MAKE SURE THE TWO ARG CHARS ARE IN THE BUFFER + CAILE A,TOBS-3 + JRST TYPEND ;GO AWAY; WILL COME BACK WHEN THEY ARE OUTPUT. +;DROPS THROUGH + ;DROPS IN +;%TDMOV COMMAND ON ALL TERMINALS. +TYMV0A: MOVSI C,%TCPAD+%TCFPD ;FOR DATAPOINTS, PADDING WILL BE NECESSARY NOW. + ANDCAM C,TTYCOM(I) ; ALSO, CLEAR FPD IF IT GOT LEFT ON SOMEHOW + MOVEI A,%TDMV1 ;PUT A NEW COMMAND IN OUTPUT BUFFER + DPB A,Q ; IN CASE WE FILL UP BUFFER AND HAVE TO COME BACK. + ; IN THAT CASE WILL RETURN TO TYMOV2. +;BUFFER NOW HOLDS: +; %TDMV1 ? NEW VPOS ? NEW HPOS +TYMOV2: CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) ;FETCH DESIRED POS. FROM BUFFER. + ILDB D,Q + CAML D,TCMXV(I) + SETZ D, + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB TT,Q + CAIGE W,%TNMAX ;If pointer to routine is within range, + JUMPGE W,@TYMDTB(W) ;GO TO DEVICE-DEPENDENT CURSOR POSITIONING ROUTINE + BUG + +TYMDTB: OFFSET -. +%TNPRT::SETZ TYMPRT ;PRINTING +%TNDP:: TYMDP ;DATAPOINT +%TNODP::TYMDP ;LOSING DATAPOINT +%TNIML::TYMIML ;IMLAC +%TNTEK::TYMDP ;TEKTRONIX +%TNTV:: [JRST 4,.+TYMDTB] +%TNMEM::SETZ TYMPRT ;MEMOWRECK +%TNSFW::[JRST 4,.+TYMDTB] +%TNTRM::SETZ TYMPRT ;TERMINET +%TNESC::TYMDP ;ASCII ESCAPE SEQUENCES TTY +%TNDTM::TYMIML ;DATAMEDIA +%TNRAY::TYMDP ;TELERAY 1061 +%TNHDS::TYMDP ;HDS CONCEPT-100 +%TNH19::TYMH19 ;H19 +%TNAAA::TYMAAA ;Ann Arbor Ambassador +%TNMAX::OFFSET 0 + +;DISPLAY TERMINALS THAT HAVE RELATIVE CURSOR POSITIONING +TYMDP: MOVE A,TTYIVP(I) ;CURRENT HARDWARE VERTICAL POSITION + SUB A,D ;SUBTRACT VERTICAL POSITION OF WHERE WE WANT TO BE + MOVMS A ;A IS HOW FAR WE HAVE TO GO UP OR DOWN + CAML TT,TCMXH(I) ;IF TRYING TO MOVE OFF RIGHT MARGIN, + JRST [ MOVE TT,TCMXH(I) ;CODE JUST BELOW CAUSES INFINITE LOOP + SOJA TT,.+1 ] ;SO PRETEND MOVING TO MARGIN + MOVE B,TTYIHP(I) ;COMPUTE NET CHRS TO POSITION + CAML B,TCMXH(I) ;IF WE THINK WE MOVED OFF THE END OF THE LINE, + JRST [ MOVE B,TCMXH(I) ;PRESUMABLY BY PRINTING IN THE LAST COLUMN, + SUBI B,1 ;THE CURSOR ACTUALLY STUCK IN THE LAST COLUMN + MOVEM B,TTYIHP(I) + JRST .+1 ] + SUB B,TT + MOVM C,B ;C IS HOW FAR WE HAVE TO GO HORIZONTALLY + TRNE H,%TPPTB ;IF TERMINAL HAS TABS + JRST TYMTB1 ;USE DIFFERENT CURSOR POSITIONING ROUTINE + CAMLE B,TT ;SKIP IF NOT SHORTER TO CR FIRST + MOVEI C,1(TT) ;# CHARS IF CR FIRST. + ADD A,C ;A NOW HAS TOTAL NUMBER OF CHARS TO SEND TO GET THERE + JUMPE A,TYMOV8 ;WE'RE THERE + MOVE C,D + ADDI C,1(TT) ;C HAS NUMBER OF CHARS IT WOULD TAKE IF WE HOMED UP FIRST + MOVE E,TCMXV(I) + SUBI E,1 + SUB E,D ;E HAS NUMBER IF HOME DOWN FIRST + JUMPL E,TYPCPG + ADD E,TT + CAMGE C,A + JRST TYMHU ;HOME UP SHORTER + CAMGE E,A + JSP A,TYMHD ;HOME DOWN SHORTER +TYPCPG: JUMPL B,TYMDP3 ;H POS TOO SMALL, MOVE FWD + JUMPG B,TYMDP6 ;MOVE BACKWARD (EITHER BS OR CR). +TYMDPL: MOVE B,TTYIVP(I) + SUB B,D + JUMPG B,TYMDP2 ;MOVE UP IF NECESSARY + JUMPL B,TYMDP1 ;OR DOWN. + JRST TYMOV8 ;OR WE'RE DONE. + +TYMDP3: JSP E,TYMDPP ;PAD IF NEC. + MOVE C,[AOS TTYIHP(I)] + SKIPL A,CCFS(W) ;GET FORWARD SPACE CHARACTER + JRST TYMDP7 ;IS ONE CHAR + HRRZS A + JRST TYMVT7 ;IS TWO CHARS + +TYMDP6: CAMG B,TT + JRST TYMDP8 +TYMTB6: MOVEI A,15 ;BETTER TO CR FIRST + CAIE W,%TNODP + CLEARM TTYIHP(I) + MOVEI B,1 + MOVSI C,(JFCL) + CAIE W,%TNODP + JRST TYMDP5 + MOVE E,TCMXV(I) + SUBI E,1 + CAMN E,TTYIVP(I) ;ON LOSERS, AFTER CR MUST GO LF TO TURN OFF SPOW MODE. + JRST TYMDP2 ;IF ON BOTTOM LINE, GO UP BEFORE CR SO CAN GO DOWN AFTER. + MOVE E,TTYCOM(I) + TLCN E,%TCFPD + MOVEM E,TTYCOM(I) + TLNE E,%TCFPD + JRST TYMDP5 ;JUMP IF HAVEN'T DONE CR YET + JSP E,TYMDPP ;AFTER CR, PAD + JRST TYMHU3 ;THEN GO SETZM TTYIHP(I) AND TURN OFF SPOW LATCH + +TYMDP8: JSP E,TYMDPP + MOVE C,[SOS TTYIHP(I)] + MOVEI A,%DPBS ;DATAPOINT BACK-SPACE. + JRST TYMDP7 + +TYMDP1: JSP E,TYMDPP + MOVEI A,%DPDN ;DATAPOINT LINEFEED. + MOVE C,[AOS TTYIVP(I)] + JRST TYMDP7 + +TYMDP2: JSP E,TYMDPP + MOVE C,[SOS TTYIVP(I)] + SKIPL A,CCUP(W) ;GET LINE-STARVE CHARACTER + JRST TYMDP5 + HRRZS A + JRST TYMVT7 ;IT'S TWO CHARS LONG + +TYMHU: SKIPN CCHUP(W) ;SKIP IF TTY CAN HOME UP + JRST TYPCPG + CAMLE C,E ;HOME UP IS BETTER THAN DIRECT ROUTE. + JSP A,TYMHD ;MAYBE HOME DOWN IS EVEN BETTER + CAIN W,%TNODP + JRST TYMHU1 + CLEARM TTYIVP(I) ;NO, HOME UP IS BEST. + CLEARM TTYIHP(I) +TYMHU2: MOVE A,CCHUP(W) + MOVEM A,TTYBYP(I) + JRST TYMOVX + +TYMHU1: MOVE E,TTYCOM(I) ;HERE FOR HOME UP ON DISAPPOINT + TLCN E,%TCFPD + MOVEM E,TTYCOM(I) + TLNE E,%TCFPD + JRST TYMHU2 ;JUMP IF HAVEN'T HOMED UP YET + MOVSI E,%TCPAD ;DON'T PAD AFTER HOME UP + IORM E,TTYCOM(I) + SETZM TTYIVP(I) ;AND TURN OFF THE SPOW LATCH +TYMHU3: MOVSI E,%TCFPD ;FIRST PART WILL HAVE BEEN DONE WHEN + ANDCAM E,TTYCOM(I) ; WE PUT OUT THE ONE CHAR TO GO DOWN ONE LINE + SETZM TTYIHP(I) + MOVEI B,1 ;GO DOWN ONE LINE TO RESET SPOW + JRST TYMDP1 + +TYMDP7: MOVMS B +TYMDP5: JUMPE A,[JRST 4,.] +TYMDP4: XCT C + IDPB A,DBBBP + SOSG DBBCC + JRST TYMOVY + SOJG B,TYMDP4 + JRST TYMOVC + +;CAN'T OUTPUT ANY MORE: IF REACHED DESIRED POS, FLUSH THE +;%TDMV1; OTHERWISE RETURN LEAVING IT TO COME BACK HERE WHEN +;TTY CAN ACCEPT MORE OUTPUT. +TYMOVY: SOJG B,TYMOVP +TYMOVX: CAMN D,TTYIVP(I) + CAME TT,TTYIHP(I) + POPJ P, +;WE USED UP ALL THE SPACE BUT GOT WHERE WE'RE GOING. +TYMOV9: MOVEM Q,TOOP(I) ;FLUSH THE %TDMV1 COMMAND. + MOVEI B,3 + ADDM B,TORM(I) + POPJ P, + +;WE FINISHED ONE SET OF OUTPUT CHARS, & HAVE ROOM FOR MORE. +;EITHER CONTINUE MOVING CURSOR, OR LOOK FOR NEXT THING TO DO. +TYMOVC: CAME TT,TTYIHP(I) + JRST TYMDP ;HORIZ POS STILL NEEDS CHANGING. + CAME D,TTYIVP(I) + JRST TYMDPL ;VERT POS STILL NEEDS CHANGING. +TYMOV8: MOVEM Q,TOOP(I) ;FLUSH THE %TDMV1 COMMAND + MOVEI B,3 + ADDM B,TORM(I) + JRST TYPLUP ;AND GO GET NEXT THING FROM BUFFER. + +;COME HERE TO PAD DATAPOINT IF NECESSARY. +;CALL WITH JSP E,. CLOBBERS A, C. +;MAY JUMP AWAY TO PAD, IN WHICH CASE TYMDP WILL BE RE-ENTERED LATER. +TYMDPP: MOVSI C,%TCPAD + TDNE C,TTYCOM(I) ;PADDING ALREADY DONE FOR THIS COMMAND => RETURN. + JRST (E) + LDB A,[$TPPCR,,TTYOPT(I)] + JUMPE A,(E) ;RETURN IF THIS TTY NOT PADDED. + MOVE B,A + IORM C,TTYCOM(I) ;AFTER WE PAD, PADDING WON'T BE NECESSARY. + MOVEI A,177 + MOVSI C,(JFCL) + JRST TYMDP5 ;GO OUTPUT THEM. + +TYMOVP: CAIE A,177 + POPJ P, + JRST TYMPAD + +;JSP A,TYMHD IF HOME-DOWN LOOKS BEST +TYMHD: CAIE W,%TNDP + JRST (A) ;BUT HOME-DOWN ONLY WORKS ON DATAPOINTS + SETZM TTYIHP(I) ;HOME DOWN IS BEST. + MOVE C,TCMXV(I) + SUBI C,1 + MOVEM C,TTYIVP(I) + MOVE A,CCHDP + MOVEM A,TTYBYP(I) + JRST TYPLUP + +;HERE TO SEND ONE OR MORE COPIES OF AN ESCAPE SEQUENCE. +;ESCAPED CHAR IN A. # TIMES IN B. INSN TO ADJUST TTYIVP,TTYIHP IN C. +TYMVT7: MOVMS B +TYMVT5: MOVE E,TTYCOM(I) ;STOPPED IN MIDDLE OF ESC SEQ? + TLZN E,%TCFPD + JRST TYMVT4 + MOVEM E,TTYCOM(I) ;YES, SKIP INITIAL ESC + JRST TYMVT6 + +TYMVT4: MOVEI E,33 + IDPB E,DBBBP + SOSG DBBCC ;NO MORE ROOM => + JRST TYMVT3 ;STOPPED WITHIN ESC SEQUENCE +TYMVT6: XCT C ;ELSE SEND THE ESCAPED CHAR + IDPB A,DBBBP + SOSG DBBCC + JRST TYMOVY ;NO ROOM => DISMISS + SOJG B,TYMVT4 ;ELSE SEND NEXT ESC SEQ + JRST TYMOVC ;FLUSH THE %TDMOV AND RETURN + +TYMVT3: MOVSI E,%TCFPD + IORM E,TTYCOM(I) + POPJ P, + +;CURSOR POSITIONING ON A DISPLAY TTY WITH TABS +TYMTB1: MOVE R,TT + IDIVI R,8 + ADD R,TYMTBC(W) ;COST OF TABBING TO DEST FROM LEFT MARGIN + MOVE W,TCTYP(I) ;RESTORE W, CLOBBERED BY IDIVI + JUMPG B,TYMTB2 ;JUMP IF MOVING BACKWARDS + JUMPE B,TYMTB3 ;JUMP IF NOT MOVING HORIZONTALLY + SKIPGE CCFS(W) + ADD C,C ;MOVING FORWARDS IS SLOW ON ESCAPE-C TYPE TERMINAL + MOVE E,TTYIHP(I) + LSH E,-3 + SUBM R,E ;COST OF TABBING FROM WHERE WE ARE NOW + CAMLE C,E + MOVE C,E ;FASTER IF TABS ARE USED + JRST TYMTB3 ;MOVING FORWARD, SO CR CAN'T HELP + +TYMTB2: CAILE C,1(R) + MOVEI C,1(R) ;BETTER TO CR FIRST +TYMTB3: ADD A,C ;TOTAL # CHARS TO BE SENT IF RELATIVE POSITIONING USED + JUMPE A,TYMOV8 ;WE'RE THERE + MOVE E,D + ADDI E,2(R) ;COST IF HOME-UP FIRST (ASSUMING HOME-UP IS 2 CHARS) + CAMG E,A + MOVE A,E ;RELATIVE POSITIONING SHOULD START WITH HOME-UP + CAILE A,4 ;COMPARE RELATIVE AND ABSOLUTE POSITIONING + TRNN H,2*%TPPTB + JRST TYMTB8 ;RELATIVE POSITIONING BETTER OR ONLY CHOICE +;USE ABSOLUTE POSITIONING, DROP INTO STRAIGHT ABS POS CODE. +;HERE FOR DIRECT POSITIONING ON IMLAC AND DATA MEDIA. SEND MAGIC CHARACTER +;FOLLOWED BY HORIZONTAL AND VERTICAL POSITION, OFFSET BY SUITABLE AMOUNT +;D FOR THE VERTICAL, TT FOR THE HORIZONTAL +TYMIML: MOVE Q,TOOP(I) ;CLOBBER OVER THE 3 CHARS IN OUTPUT BUFFER + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + HLRZ A,CCDPSO(W) ;GET ABS-POSITIONING CHARACTER, IT WILL + IDPB A,Q ; BE FOLLOWED WITH VERTICAL, HORIZONTAL COORDS + MOVEM D,TTYIVP(I) ;CURSOR WILL END UP HERE + MOVEM TT,TTYIHP(I) + TRNE A,200000 + EXCH D,TT ;SEND HORIZONTAL THEN VERTICAL + HRRZ E,CCDPSO(W) ;GET TABLE INDEX + MOVE B,D ;FIRST COORD TO SEND + XCT CCDPSM(E) ;MUNG B APPROPRIATELY + ANDI B,177 ;EXTRA BITS CAUSE TROUBLE LATER + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + IDPB B,Q + MOVE C,B ;SAVE + MOVE B,TT ;SECOND COORD TO SEND + XCT CCDPSM(E) ;MUNG B APPROPRIATELY + ANDI B,177 ;EXTRA BITS CAUSE TROUBLE LATER + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + IDPB B,Q + ANDI A,177 ;DON'T LET TYPLUP THINK THESE CHARACTERS PRINT + TLNN H,%TOSAI + CAIL A,40 + SOS TTYIHP(I) + TLNN H,%TOSAI + CAIL B,40 + SOS TTYIHP(I) + TLNN H,%TOSAI + CAIL C,40 + SOS TTYIHP(I) + SKIPL A,CCDPSO(W) + JRST TYPLUP + MOVEI A,33 ;PUT AN ESC BEFORE IT + JRST TYPOU2 + +TYMTB8: CAMN E,A + JRST TYMHU ;HOME-UP FIRST + JUMPL B,TYMTB4 ;JUMP IF MOVING TO THE RIGHT + JUMPE B,TYMDPL ;JUMP IF NOT MOVING HORIZONTALLY + CAIE C,1(R) ;MOVING TO THE LEFT, SKIP IF SHOULD CR FIRST + JRST TYMDP8 ;NO, JUST BS + JRST TYMTB6 ;GO CR + +TYMTB4: MOVE E,TT ;DESTINATION COLUMN + TRO E,7 ;ENSURE NO BORROW + MOVEI A,1(E) ;COLUMN TO TAB TO THEN BACKSPACE BACK + CAMGE A,TCMXH(I) ;BE SURE NOT TO TAB OFF THE RIGHT MARGIN + TRNN TT,4 ;SKIP IF FASTER TO TAB PAST AND BACKSPACE BACK + JRST TYMTB5 ;JUMP IF BETTER TO TAB THEN FORWARD-SPACE + CAMN B,[-1] + JRST TYMDP3 ;MOVING A SHORT WAY, JUST SEND A FORWARD-SPACE + MOVEI B,8(E) + SUB B,TTYIHP(I) + LSH B,-3 ;# TABS TO GET PAST DESTINATION +TYMTB7: MOVEI A,^I + MOVEI E,7 + ANDCAM E,TTYIHP(I) ;ALIGN TTYIHP WITH TAB STOPS + MOVE C,[ADDM E,TTYIHP(I)] ;EACH TAB ADVANCES TTYIHP BY 8 + AOJA E,TYMDP5 ;GO TAB + +TYMTB5: SUB E,TTYIHP(I) ;COMPUTE # TABS TO GET JUST TO + LSH E,-3 ; THE LEFT OF THE DESTINATION + JUMPE E,TYMDP3 ;WE'RE CLOSE, DO FORWARD SPACES + MOVE B,E ;TAB FIRST + JRST TYMTB7 + +TYMTBC: 0 ? 2 ? 4 ? 6 ;COST OF MOVING RIGHT FROM A TAB STOP + 1+4 ? 1+3 ? 1+2 ? 1+1 ;COST OF TABBING ONE MORE AND BACKSPACING BACK + +;setup routine for TYMH19, TYMAAA. Gets magnitude of horizontal and vertical +;motion in B and A, destinations in TT and D respectively, sets TTYIHP and +;TTYIVP. +TYMPOS: MOVE A,TTYIVP(I) ;current hardware vertical position + SUBM D,A ;subtract from vertical destination + CAML TT,TCMXH(I) ;if trying to move off right margin, + JRST [ MOVE TT,TCMXH(I) ;pretend moving to margin + SOJA TT,.+1 ] + MOVE B,TTYIHP(I) ;compute net chrs to position + CAML B,TCMXH(I) ;if we think we moved off the end of the line, + JRST [ MOVE B,TCMXH(I) ;presumably by printing in the last column, + SUBI B,1 ;the cursor actually stuck in the last column + MOVEM B,TTYIHP(I) + JRST .+1 ] + SUBM TT,B ;now we have horizontal motion in B + MOVEM D,TTYIVP(I) ;put vertical, horizontal destination + MOVEM TT,TTYIHP(I) ;into registers (we'll be there soon). + POPJ P, + +;cursor positioning on an H19. TYMDP occasionally stuffs rubouts into the +;buffer to do its own padding, thereby resulting in ^S ^Q lossage on H19s. I +;could patch TYMDP up, but it's too silly. Generates HCUF, HCUB, HCUD, HCUU, +;or HDCA. +TYMH19: PUSHJ P,TYMPOS ;get horizontal and vertical destinations, etc. + MOVEI C,2 ;now flush the first two chars of cursor + ADDM C,TORM(I) ;motion command (TYEEO2 will flush last) + MOVE C,TOCMBF(I) ;get byte pointer to tty command buffer in C + MOVEI E,33 + IDPB E,C ;send esc + JUMPE A,TYMHOX ;if vertical magnitude 0, only moving in X + JUMPE B,TYMHOY ;same for horizontal and Y +TYMABS: MOVEI E,"Y ;neither is 0, abs. positioning faster + IDPB E,C + ADDI D,40 ;convert line # to H19 coord system. + IDPB D,C + ADDI TT,40 ;convert column # to H19 coord system + IDPB TT,C +TYMHDN: MOVEI E,0 ;top it off with a null + IDPB E,C + MOVE A,TOCMBF(I) ;TYEEO2 wants bp in A + JRST TYEEO2 ;noone seems to think it's necessary to pad + +TYMHOX: CAIN B,1 ;if 1 or -1, then relative positioning is + JRST TYMHX2 ;plenty fast + CAIN B,-1 + JRST TYMHX3 + JRST TYMABS ;otherwise absolute positioning is faster +TYMHX2: MOVEI E,"C ;moving forward one space + IDPB E,C + JRST TYMHDN +TYMHX3: MOVEI E,"D ;moving backwards one space + IDPB E,C + JRST TYMHDN + +TYMHOY: CAIN A,1 ;if 1 or -1, then relative positioning is + JRST TYMHY2 ;plenty fast + CAIN A,-1 + JRST TYMHY3 + JRST TYMABS ;otherwise absolute positioning is faster +TYMHY2: MOVEI E,"B ;moving down one line + IDPB E,C + JRST TYMHDN +TYMHY3: MOVEI E,"A ;moving up one line + IDPB E,C + JRST TYMHDN + +;cursor positioning on an AAA. Generates either CUP, HPA, or VPA, +;whichever involves fewest chars. +TYMAAA: PUSHJ P,TYMPOS ;get X-Y motion and set dests. + MOVEI C,2 ;now flush the first two chars of cursor + ADDM C,TORM(I) ;motion command (TYEEO2 will flush last) + MOVE C,TOCMBF(I) ;get byte pointer to tty command buffer in C + MOVEI E,33 + IDPB E,C ;send esc + MOVEI E,"[ ;[ + IDPB E,C + JUMPE B,TYMAVT ;going vertically only + JUMPE A,TYMAHZ ;horizontally only + JUMPE D,TYMAP3 ;if going to top line, optimize out 1st coord + MOVE E,D + PUSHJ P,SNDNUM ;send vertical coord + JUMPE TT,TYMAP5 ;if moving to leftmost col no second coord +TYMAP3: MOVEI A,73 ;or semicolon + IDPB A,C + MOVE E,TT + PUSHJ P,SNDNUM ;send horizontal coord +TYMAP5: MOVEI A,"H ;absolute positioning char + JRST TYMADN +;going vertically only, use vertical absolute positioning +TYMAVT: MOVE E,D + PUSHJ P,SNDNUM + MOVEI A,"d ;vertical absolute positioning char + JRST TYMADN +;going horizontally only, horizontal absolute positioning +TYMAHZ: MOVE E,TT + PUSHJ P,SNDNUM + MOVEI A,"` ;horizontal absolute positioning char +;fall through into done code + +TYMADN: IDPB A,C ;send that last char + MOVEI A,4 ;padding is A*TT in ms + MOVEI TT,1 ;4 ms of padding ought to be enough + JRST TYDAPD ;go set it up + +;Add one to the number in E, convert it to ASCII decimal, and idpb it +;in the location pointed to by the bp in C. Assumes no more than 2 +;digits in E. Bashes A, B, E (B because of the IDIVI). +SNDNUM: AOS E ;bump + MOVE A,E + IDIVI A,10. ;divide by 10 for high digit + JUMPE A,SNDNM2 ;only one digit + ADDI A,"0 ;make high digit ascii + IDPB A,C ;put in buffer + SUBI A,"0 ;un-ascii high digit + IMULI A,10. ;find out what we printed + SUB E,A ;take it from what we had to get low digit +SNDNM2: ADDI E,"0 ;make low digit ascii + IDPB E,C ;put in buffer + POPJ P, + +TYEBS: SOSGE TTYIHP(I) ;%TDBS: OUTPUT BS. + SETZM TTYIHP(I) + MOVEI A,^H + JRST TYPSIO + +TYERCR: MOVE D,TTYIVP(I) ;%TDRCR: OUTPUT A CR (PLUS PADDING) + SETZ TT, + SKIPN TTYIHP(I) + AOS TTYIHP(I) +TYERC1: SOS TORM(I) .SEE TYMOVX ;WHICH WILL ADD 3 TO TORM. + SOS TORM(I) + JRST TYMPRR + +TYELF: MOVE TT,TTYIHP(I) ;%TDLF: OUTPUT LF (PLUS PADDING) + MOVE D,TTYIVP(I) + AOS D + CAIG D,118. + CAML D,TCMXV(I) + JRST TYELFE ;DETECT A LF THAT SCROLLS. + JRST TYERC1 + +TYELFE: SKIPN TTYROL(I) ;IF NOT A SCROLLING TTY, RESET VPOS TO 0 + TDZA D,D + SUB D,TTYROL(I) ;OTHERWISE, GLITCH UP + MOVEM D,TTYIVP(I) ;STORE VPOS AFTER SCROLLING. + SOS TTYIVP(I) ;MAKE SURE 1 LF IS OUTPUT. + JRST TYERC1 + +TYEFS: CAIN W,%TNAAA ;AAA's use a different format + JRST TYFSAA + MOVSI E,%TCFPD ;ON SOME TTYS, IS TWO PARTS + TDNE E,TTYCOM(I) + JRST TYEFS2 ;FIRST PART DONE, DO SECOND + IORM E,TTYCOM(I) ;ABOUT TO DO FIRST PART + CAIE W,%TNDP ;DATAPOINTS NEED PADDING + CAIN W,%TNODP + JRST TYEFSD ;SO GO DO IT + MOVEI A,33 ;VT52S ETC. NEED ALTMODE PREFIX + SKIPGE CCFS(W) + JRST TYPOU2 ;SO GO DO THAT +TYEFS2: ANDCAM E,TTYCOM(I) ;ABOUT TO DO SECOND PART + HRRZ A,CCFS(W) ;GET CHARACTER TO SEND + AOS TTYIHP(I) ;IT WILL MOVE THE CURSOR + JRST TYPSIO ;SEND IT, AND ABSORB THE %TDFS + +TYEFSD: LDB B,[$TPPCR,,TTYOPT(I)] + PUSHJ P,TYMPAD ;SET UP TTYBYP TO PAD + JRST TYPLUP ;PAD THEN COME BACK HERE + +;handle forward-space on AAA's +TYFSAA: MOVE A,CCFS(W) + JRST TYEEO2 + +;HANDLE CLEAR-EOL: +TYEEOL: SKIPA A,CCEOLP(W) + +;HANDLE CLEAR-EOF +TYEEOF: MOVE A,CCEOFP(W) +TYEEO2: CAILE A,0 + PUSHJ P,TYEEO3 ;JUMP IF OUTPUT SEQ IS mn,,TABLE +TYEEO4: MOVEM A,TTYBYP(I) ;STORE BYTE POINTER OR ZERO +TYEEO1: AOS TORM(I) ;FLUSH THE CURSOR CTL CMD FROM OUTPUT BFR. + MOVEM Q,TOOP(I) + JRST TYPLUP + +;OUTPUT SEQUENCE SPECIFIED AS mn,,TABLE +;m=LOWEST PAD CODE IN TABLE, n=HIGHEST +TYEEO3: LDB B,[$TPPCR,,TTYOPT(I)] + LDB C,[220300,,A] ;n + CAMLE B,C + MOVE B,C + LDB C,[250300,,A] ;m + SUB B,C + SKIPLE B + ADD A,B + MOVE A,(A) ;PICK UP BYTE POINTER OUT OF TABLE + POPJ P, + +;HANDLE CLEAR THE SCREEN +TYECLR: SETZM TTYIHP(I) ;AFTER CLEARING, CURSOR WILL BE AT TOP LEFT + SETZM TTYIVP(I) + SKIPA A,CCCLRP(W) +;HANDLE DELETE FWD, ON OVERPRINTING ERASABLE DISPLAYS, AND IMLACS (ACC TO %TOIML). +TYEDLF: MOVE A,CCDLFP(W) + JRST TYEEO2 + +;HANDLE ENTER-INVERSE-VIDEO AND LEAVE-ALL-SUCH-MODES +TYEBOW: SKIPA A,CCBOWP(W) +TYERST: MOVE A,CCRSTP(W) + JRST TYEEO2 + +TYEINI: MOVE A,CCINIP(W) + JRST TYEEO2 + +;REGION-SCROLL UP AND REGION-SCROLL DOWN HANDLED ONLY ON DM2500 +;FOR NOW. REAL DM2500'S CAN'T DO IT, BUT CERTAIN FAKE ONES CAN. +;SOMEDAY HAIRY CODE COULD BE ADDED TO DO IT ON C100 AND VT100. +TYERSU: +TYERSD: SUBI A,%TDRSU-^U ;SEND ^U OR ^V +; CAIE W,%TNDTM +; JRST TYEEO1 + MOVE B,TORM(I) ;MAKE SURE ARGS IN BUFFER + CAILE B,TOBS-3 + JRST TYPEND ;NO, COME BACK LATER + DPB A,Q + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB A,Q ;XOR 140 INTO ARGS + XORI A,140 + DPB A,Q + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB A,Q + XORI A,140 + DPB A,Q + MOVNI A,2 ;COMPENSATE FOR "PRINTING" CHARS + ADDM A,TTYIHP(I) + JRST TYPLUP + +;HANDLE DELETE AND INSERT CHARACTERS AND LINES +;DOESN'T TRY TO BE TOTALLY HAIRY ABOUT MULTIPLE INSERT/DELETES. +TYEILP: SKIPA A,CCILPP(W) +TYEDLP: MOVE A,CCDLPP(W) + JRST TYEIL1 + +;if we're on an H19 we don't want to call TYDH19 from TYEICP, because +;no multiple insert char. +TYEICP: MOVE A,CCICPP(W) + CAIE W,%TNH19 ;if we're on an H19, no multiple insert char + JRST TYEIL1 ;so hack locally, else go to main routine + MOVE B,TORM(I) ;MAKE SURE REPEAT-COUNT ARGUMENT IS IN THE BUFFER + CAILE B,TOBS-2 + JRST TYPEND ;if it's not, come back when it is + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB B,Q ;GET IT + JRST TYEIL2 +TYEDCP: MOVE A,CCDCPP(W) +TYEIL1: MOVE B,TORM(I) ;MAKE SURE REPEAT-COUNT ARGUMENT IS IN THE BUFFER + CAILE B,TOBS-2 + JRST TYPEND ;IT'S NOT, COME BACK WHEN IT IS + CAMN Q,TOBEP(I) + MOVE Q,TOBBP(I) + ILDB B,Q ;GET IT + CAIN W,%TNAAA ;AAA's have a better way of doing this + JRST TYIDAA + CAIN W,%TNH19 ;so do H19's + JRST TYDH19 +TYEIL2: SOJG B,[DPB B,Q ;NOT LAST TIME, LEAVE DECREMENTED REQUEST IN BUFFER + CAILE A,0 + PUSHJ P,TYEEO3 + MOVEM A,TTYBYP(I) ;AND DO ONCE + JRST TYPLUP] + AOS TORM(I) ;OTHERWISE, REMOVE FROM BUFFER + JRST TYEEO2 ;AND GO DO + +;Handle insert/delete line, delete char on an H19, without weenie +;weenie. Actually enters ANSI mode for multiple insert/deletes. +TYDH19: CAIG B,6 ;if we're doing < 6, non-hairy way is faster. + JRST [ MOVE A,1(A) ;format of table is + JRST TYEIL2 ] ; [ansicommand ? zdscommand] + MOVE A,@A ;get the command char + AOS TORM(I) ;flush the arg + MOVE C,TOCMBF(I) ;pointer to comand buffer + MOVEI E,33 ;send esc and + IDPB E,C + MOVEI E,"< ;< to enter ANSI mode + IDPB E,C + PUSHJ P,TYIDA2 ;send the command and set TT to arg + MOVEI A,19. ;19 ms padding per operation. + MOVE D,H19ZDS ;copy command to enter ZDS mode + ILDB E,D ;into buffer + JUMPE E,TYDAPD ;when done, go do padding + IDPB E,C + JRST .-3 + +H19ZDS: 440700,,[ASCIZ /[?2h/] ;command to enter ZDS mode + +;Handle insert/delete chars/lines on an AAA. This code avoids the +;"weenie weenie" syndrome, where lines get deleted one at a time +;(weenie weenie), and then get inserted one at a time (weenie weenie). +TYIDAA: AOS TORM(I) ;flush arg from buffer + MOVE C,TOCMBF(I) ;get pointer to command buffer + PUSHJ P,TYIDA2 ;send command and set TT to arg + MOVEI A,4 ;4 ms padding per operation + JRST TYDAPD ;send the padding + +TYIDA2: MOVEI E,33 ;send esc + IDPB E,C + MOVEI E,"[ ;send [ + IDPB E,C + MOVE E,B ;SNDNUM takes arg in E + MOVE D,A ;and bashes A + MOVE TT,B ;and B - so save 'em + SOS E ;SNDNUM also adds 1 to its arg. + PUSHJ P,SNDNUM ;send arg + IDPB D,C ;send command char, which is now in D + POPJ P, + +;TYDAPD sets up the end of TOCMBF to include a null and the amount of +;padding needed, and then jumps to TYEEO2. TT contains a number that +;is multiplied by the contents of A to get the number of ms of padding +;desired. TT usually has the number of inserts or deletes in it, and +;A usually has the pad factor. +TYDAPD: MOVEI D,0 ;put a null at end + IDPB D,C ;now do padding - set up for TYEEO2 + HLRZ D,C ;did we just deposit in the lowest + CAIN D,010700 ;byte in this word? + JRST [ HRRZ D,C ;yes, put a 1 in the next + AOS D + MOVEI E,1 + MOVEM E,@D + JRST .+2 ] + JRST [ HRRZ D,C ;turn on the low bit in this one + MOVEI E,1 + IORM E,@D + JRST .+1 ] + AOS D + IMUL TT,A ;ms padding = TT * A + MOVEM TT,@D ;TT usually has arg to command + MOVE A,TOCMBF(I) ;pointer to beginning of buffer + JRST TYEEO2 ;goes in A, where TYEEO2 wants it + +;HANDLE TURN-ON-MOTOR COMMAND. +TYEMTN: CAIE W,%TNTRM + JRST TYEEO1 ;NO-OP EXCEPT ON TERMINETS + LDB B,[$TPPLF,,TTYOPT(I)] + JUMPE B,TYEEO1 ;PADDING CODE 0 => DON'T HACK THE MOTOR. + HRRZ A,TYMTVT(B) + LSH A,1 + IDIVI A,5 + MOVNS A + ADD A,TYEMT1(B) ;CREATE A BP TO A STRING WITH THE RIGHT # OF RUBOUTS. + JRST TYEEO4 + +;THIS IS AN ASCIZ STRING OF 90. RUBOUTS. +;SOME FINAL SEGMENT OF IT WILL BE TYPED OUT. +TYEMT0: REPEAT 90./5, -2 +TYEMT2: ASCIZ /H/ + +TYEMT1: 010700,,TYEMT2-1 + 100700,,TYEMT2-1 + 170700,,TYEMT2-1 + 260700,,TYEMT2-1 + 350700,,TYEMT2-1 + +;HANDLE TURN-MOTOR-OFF COMMAND. +TYEMTF: CAIE W,%TNTRM + JRST TYEEO1 + LDB B,[$TPPLF,,TTYOPT(I)] + JUMPE B,TYEEO1 + MOVE A,[440700,,[ASCIZ/J/]] + JRST TYEEO2 + +;CRLF AND CLEAR EOL. +TYECRL: SETZM TTYIHP(I) + AOS B,TTYIVP(I) + MOVN A,TTYROL(I) + CAML B,TCMXV(I) + ADDM A,TTYIVP(I) + MOVE A,CCROLP(W) ;HOW TO SCROLL THIS KIND OF TTY? + JRST TYEEO2 + +SUBTTL TABLES OF CURSOR-CONTROL SEQUENCES + +;Note that a table entry can be (for those tables which are strings): +; mn,,TABLE - m is lowest pad code in table, n is highest +; These pad codes from the $TPPCR. The appropriate +; table entry is selected, indexed by pad code. +; The table entry should look like 440700,,string. +; 440700,,string - the string is output. If the low-order +; bit of the last word in the string is set, the +; following word contains the number of milliseconds +; of padding required. (max is 200 ms at 9600 baud, +; see TYMPAD), or if this word is SETZ, a special kludge +; for Tektronix screen-clear is invoked. +; A negative number is the number of 1/8 msec of padding +; per line below the cursor. Note carefully that is in +; 1/8 msec units! +; 0 - output nothing +; +; (for those tables which are characters): +; "ch - output the character +; SETZ "ch - output esc (033) followed by the character + +;DATAPOINT CURSOR CONTROL CHARACTERS +%DPFS==30 ;30 => FORWARD SPACE + ;31 => (NON-EXISTANT) +%DPUP==32 ;32 => MOVE UP + ;33 => (NON-EXISTANT) +%DPHD==34 ;34 => HOME DOWN (DOESN'T WORK ON OLD DATAPOINTS ABOVE 300 BAUD) +%DPHU==35 ;35 => HOME UP + ;36 => CLEAR EOL + ;37 => CLEAR EOF +%DPBS==10 ;BACKSPACE +%DPDN==12 ;LINEFEED. + +CCDPSO: 0 ;PRT ;LH DIRECT POSITIONING CHAR, RH INDEX INTO CCDPSM + 0 ;DPT ;4.9 ESC BEFORE CHAR, 4.8 HORIZONTAL THEN VERTICAL + 0 ;LSR + 200016,,0 ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 400131,,2 ;ESC + 200014,,1 ;DTM + 400131,,2 ;RAY + 400141,,2 ;HDS + 0 ;H19's have their own routine + 0 ;AAA's have their own routine +IFN .-CCDPSO-%TNMAX, .ERR SOME TCTYP SETTING LACKS CCDPSO + +;INSTRUCTION TO MUNG B TO CONVERT TO TERMINAL'S COORDINATE SYSTEM +CCDPSM: ADDI B,1 ;IMLAC + XORI B,140 ;DATAMEDIA + ADDI B,40 ;VT52, TELERAY, CONCEPT-100, ETC. + +CCFS: 40 ;FORWARD-SPACE CHARACTER, 4.9 => IT NEEDS AN ESC IN FRONT OF IT + %DPFS ;DPT + %DPFS ;LSR + ^Y ;IMLAC + 40 ;TEK + 0 ;TV + 40 ;MEM + 0 ;SFW + 40 ;TRM + SETZ "C ;ESC + 34 ;DTM + SETZ "C ;RAY + SETZ "= ;HDS + SETZ "C ;H19 +;the AAA entry looks strange here, but it's the right thing. TYEFS +;checks for AAA's specially, and AAA's don't use TYMDP. + 440700,,[.BYTE 7 ? 33 ? "[ ? "C ] ;AAA +IFN .-CCFS-%TNMAX, .ERR SOME TCTYP SETTING LACKS CCFS + +CCUP: 0 ;LINE-STARVE CHARACTER, - => IT NEEDS AN ESC IN FRONT OF IT + %DPUP ;DPT + %DPUP ;LSR + 0 ;IMLAC + 13 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + SETZ "A ;ESC + 32 ;DTM + SETZ "A ;RAY + SETZ "; ;HDS + SETZ "A ;H19 + 0 ;AAA +;this entry isn't here because this is a stupid word table instead +;of a winning string table. +; 440700,,[.BYTE 7 ? 33 ? "[ ? "A ] ;AAA +IFN .-CCUP-%TNMAX, .ERR SOME TCTYP SETTING LACKS CCUP + +CCHUP: 0 ;HOME-UP SEQUENCE POINTER + 440700,,[.BYTE 7 ? %DPHU] ;DPT + 440700,,[.BYTE 7 ? %DPHU ? %DPHU ? %DPHU] ;LSR + 0 ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "H] ;ESC + 440700,,[.BYTE 7 ? 2] ;DTM + 440700,,[.BYTE 7 ? 33 ? "H] ;RAY + 440700,,[.BYTE 7 ? 33 ? "?] ;HDS + 440700,,[.BYTE 7 ? 33 ? "H] ;H19 + 440700,,[.BYTE 7 ? 33 ? "[ ? "H] ;AAA +IFN .-CCHUP-%TNMAX, .ERR SOME TCTYP SETTING LACKS CCHUP + +CCHDP: 440700,,CCHD +CCHD: 34_29.+177_22.+177_15.+177_8 + +CCEOLP: 0 ;PRT + 440700,,[.BYTE 7 ? 36 ? 177 ? 177 ? 177] ;DPT + 440700,,[.BYTE 7 ? 36 ? 36 ? 36 ? 36] ;LSR + 440700,,[.BYTE 7 ? ^Q] ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "K] ;ESC + 440700,,[.BYTE 7 ? 27] ;DTM + 440700,,[.BYTE 7 ? 33 ? "K] ;RAY + 01,,[ 440700,,[<.BYTE 7 ? 33 ? 23>+1 ? 8.] ;HDS 300/1200 + 440700,,[<.BYTE 7 ? 33 ? 23>+1 ? 16.] ] ;HDS 9600 + 440700,,[.BYTE 7 ? 33 ? "K] ;H19 + 440700,,[.BYTE 7 ? 33 ? "[ ? "K] ;AAA +IFN .-CCEOLP-%TNMAX,.ERR SOME TCTYP SETTING LACKS %TDEOL + +CCEOFP: 0 ;PRT + 440700,,[.BYTE 7 ? 37 ? 177 ? 177 ? 177] ;DPT + 440700,,[.BYTE 7 ? 37 ? 37 ? 37 ? 37 ? 37 ? 0] ;LSR + 440700,,[.BYTE 7 ? ^P] ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "J] ;ESC + 440700,,[.BYTE 7 ? 27] ;DTM (CAN'T CLEAR TO EOF, SO CLEAR TO EOL) + 440700,,[<.BYTE 7 ? 33 ? "J>+1 ? 90.] ;RAY + ;HDS PAD CODES ARE 0 1200 OR LESS, 1 9600 OR MORE + ; AT 9600 OR ABOVE, USE ERASE EOL INSTEAD OF ERASE EOS + 01,,[ ; DUE TO INABILITY TO SEND 340 (!!) MILLISECONDS OF PADDING + 440700,,[<.BYTE 7 ? 33 ? 3>+1 ? 170.] ;HDS 300/1200 + 440700,,[<.BYTE 7 ? 33 ? 23>+1 ? 16.] ] ;HDS 9600 + 440700,,[.BYTE 7 ? 33 ? "J] ;H19 + 440700,,[<.BYTE 7 ? 33 ? "[ ? "J>+1 ? 5.] ;AAA 5 ms padding +IFN .-CCEOFP-%TNMAX,.ERR SOME TCTYP SETTING LACKS %TDEOF + +CCDLFP: 0 ;PRT + 440700,,[.BYTE 7 ? 31] ;(DPT) FOR BENEFIT OF GT40 + 0 ;LSR + 440700,,[.BYTE 7 ? ^X] ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 0 ;ESC + 0 ;DTM + 0 ;RAY + 0 ;HDS + 0 ;H19 + 0 ;AAA +IFN .-CCDLFP-%TNMAX,.ERR SOME TCTYP SETTING LACKS %TDDLF + +CCROLP: 0 ;PRT + 25,,CCCRLP ;DPT + 25,,CCCRL1 ;LSR + 440700,,[.BYTE 7 ? ^M ? ^K ? ^Q] ;IMLAC + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? ^M ? ^J ? 33 ? "K] ;ESC + 440700,,[.BYTE 7 ? ^M ? ^J ? 27] ;DTM + ;NOTE: REAL DATAMEDIAS IGNORE THE ^J BUT IMITATION ONES MIGHT NOT + 440700,,[.BYTE 7 ? ^M ? ^J ? 33 ? "K] ;RAY + 440700,,[<.BYTE 7 ? ^M ? ^J ? 33 ? 23>+1 ? 16.] ;HDS + 440700,,[.BYTE 7 ? ^M ? ^J ? 33 ? "K] ;H19 + 440700,,[.BYTE 7 ? ^M ? ^J ? 33 ? "[ ? "K ? 0] ;AAA +IFN .-CCROLP-%TNMAX,.ERR SOME TCTYP SETTING LACKS %TDCRL + +;CRLF ON DATAPOINTS, DEPENDING ON LOSER-NESS AND SPEED. +CCCRLP: 440700,,[.BYTE 7 ? ^M ? ^J ? 36] + 440700,,[.BYTE 7 ? ^M ? ^J ? 177 ? 177 ? 177 ? 36] +REPEAT 2,440700,,[.BYTE 7 ? ^M ? ^J ? 177 ? 177 ? 177 ? 177 ? 36] + +CCCRL1: 440700,,[.BYTE 7 ? ^M ? ^J ? 36 ? 36 ? 36 ? 36] + 440700,,[.BYTE 7 ? ^M ? ^J ? 177 ? 177 ? 177 ? 36 ? 36 ? 36 ? 36] +REPEAT 2,440700,,[.BYTE 7 ? ^M ? ^J ? 177 ? 177 ? 177 ? 177 ? 36 ? 36 ? 36 ? 36 ? 0] + +CCCLRP: 0 ;CLEAR THE SCREEN SEQUENCE POINTER + 440700,,[.BYTE 7 ? %DPHU ? 37 ? 177 ? 177 ? 177 ? 0] ;DPT + 440700,,[.BYTE 7 ? %DPHU ? %DPHU ? %DPHU ? 37 ? 37 ? 37 ? 37 ? 37 ? 0] ;LSR + 440700,,[.BYTE 7 ? ^L] ;IMLAC + 440700,,[<.BYTE 7 ? 33 ? 14>+1 ? SETZ] .SEE TYPBP ;TEKTRONIX + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "H ? 33 ? "J ? 0] ;ESC + 34,,[440700,,[.BYTE 7 ? 36] ;DTM + 440700,,[.BYTE 7 ? 36 ? 36]] + 440700,,[<.BYTE 7 ? 33 ? "j>+1 ? 90.] ;RAY + 440700,,[<.BYTE 7 ? 14>+1 ? 48.] ;HDS (RIGHT FOR 9600 BAUD, NEED HALF AS MUCH AT 300) + 440700,,[.BYTE 7 ? 33 ? "H ? 33 ? "J ? 0] ;H19 + 440700,,[<.BYTE 7 ? 33 ? "[ ? "H ? 33 ? "[ > + <.BYTE 7 ? "J>+1 ? 5.] ;AAA needs 5 ms padding + +IFN .-CCCLRP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDCLR + +CCILPP: 0 ;PRT + 0 ;DPT + 0 ;LSR + 0 ;IML + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 01,,[ ;ESC padding mainly based on H19 - CBF + 440700,,[<.BYTE 7 ? 33 ? "L>] ; no padding at all at 1200 baud + 440700,,[<.BYTE 7 ? 33 ? "L>+1 ? -6.]] ; .75 ms/line at higher + 04,,[440700,,[.BYTE 7 ? ^P ? ^J ? ^X ? 0] ;DTM + 440700,,[.BYTE 7 ? ^P ? ^J ? REPEAT 3,[177 ? ] ^X ? 0] + 440700,,[.BYTE 7 ? ^P ? ^J ? REPEAT 5,[177 ? ] ? ^X ? 0] + 440700,,[.BYTE 7 ? ^P ? ^J ? REPEAT 10.,[177 ? ] ^X ? 0] + 440700,,[.BYTE 7 ? ^P ? ^J ? REPEAT 20.,[177 ? ] ^X ? 0]] + 440700,,[<.BYTE 7 ? 33 ? "L>+1 ? -20.] ;RAY (2.5ms/line) + 01,,[ + 440700,,[<.BYTE 7 ? 33 ? ^R>+1 ? -14.] ;HDS AT 300/1200 (1.75ms/line) + 440700,,[<.byte 7 ? 33 ? ^R>+1 ? -3.*8]] ;HDS AT 9600 (3ms/line) + ["L ? 01,,[ ;H19's use this table differently + 440700,,[<.BYTE 7 ? 33 ? "L>] ; no padding at all at 1200 baud + 440700,,[<.BYTE 7 ? 33 ? "L>+1 ? -6.]]] ; .75 ms/line at higher + "L ;AAA (AAA's use this table differently) + +IFN .-CCILPP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDILP + +CCDLPP: 0 ;PRT + 0 ;DPT + 0 ;LSR + 0 ;IML + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 01,,[ ;ESC padding mainly based on H19 - CBF + 440700,,[<.BYTE 7 ? 33 ? "M>] ; no padding at all at 1200 baud + 440700,,[<.BYTE 7 ? 33 ? "M>+1 ? -6.]] ; .75 ms/line at higher + 34,,[440700,,[.BYTE 7 ? ^P ? ^Z ? ^X] ;DTM + 440700,,[.BYTE 7 ? ^P ? ^Z ? 177 ? ^X]] + 440700,,[<.BYTE 7 ? 33 ? "M>+1 ? -20.] ;RAY (2.5ms/line) + 01,,[ + 440700,,[<.BYTE 7 ? 33 ? ^B>+1 ? -14.] ;HDS AT 300/1200 (1.75ms/line) + 440700,,[<.byte 7 ? 33 ? ^B>+1 ? -3.*8.]] ;HDS AT 9600 (3ms/line) + ["M ? 01,,[ ;H19's use this table differently + 440700,,[<.BYTE 7 ? 33 ? "M>] ; no padding at all at 1200 baud + 440700,,[<.BYTE 7 ? 33 ? "M>+1 ? -6.]]] ; .75 ms/line at higher + "M ;AAA (AAA's use this table differently) +IFN .-CCDLPP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDDLP + +CCICPP: 0 ;PRT + 0 ;DPT + 0 ;LSR + 0 ;IML + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "Q ? 40 ? 10 ? 33 ? "R] ;ESC + 34,,[440700,,[.BYTE 7 ? ^P ? ^\ ? ^X] ;DTM + 440700,,[.BYTE 7 ? ^P ? 40 ? 177 ? ^X ? ^H ? 40 ? ^H ? 0]] + 440700,,[.BYTE 7 ? 33 ? "P] ;RAY + ; The HDS requires a null in its insert char sequence so we + ; resort to non 7 bit char so the typeout loop won't think its + ; the end of an ASCIZ string. + 01,,[ ;HDS + 441100,,[<.byte 9 ? 33 ? 20 ? 40 ? 10 > ? + <.byte 9 ? 33 ? 400 >] ; no padding 1200 or under + 441100,,[<.byte 9 ? 33 ? 20 ? 40 ? 10 > ? + <.byte 9 ? 33 ? 400 >+1 ? 16.]] ; 16 ms per insert >1200 + 440700,,[.BYTE 7 ? 33 ? "@ ? 40 ? 10 ? 33 ? "O] ;H19 + "@ ;AAA's use this table differently +IFN .-CCICPP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDICP + +CCDCPP: 0 ;PRT + 0 ;DPT + 0 ;LSR + 0 ;IML + 0 ;TEK + 0 ;TV + 0 ;MEM + 0 ;SFW + 0 ;TRM + 440700,,[.BYTE 7 ? 33 ? "P] ;ESC + 34,,[440700,,[.BYTE 7 ? ^P ? ^H ? ^X] ;DTM + 440700,,[.BYTE 7 ? ^P ? ^H ? 177 ? ^X]] + 440700,,[.BYTE 7 ? 33 ? "Q] ;RAY + 01,,[ ;HDS + 440700,,[.byte 7 ? 33 ? 21] ; no padding 1200 or under + 440700,,[<.byte 7 ? 33 ? 21>+1 ? 16.]] ; 16 ms per del at >1200 + ["P ? 440700,,[.BYTE 7 ? 33 ? "N]] ;H19's also use this table differently + "P ;AAA's use this table differently +IFN .-CCDCPP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDDCP + +CCBOWP: + REPEAT %TNDTM,0 + 440700,,[.BYTE 7 ? 16] ;DTM + 0 ;RAY + 440700,,[.BYTE 7 ? 33 ? "D] ;HDS + 440700,,[.BYTE 7 ? 33 ? "p] ;H19 + 440700,,[.BYTE 7 ? 33 ? "[ ? "7 ? "m] ;AAA +IFN .-CCBOWP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDBOW + +CCRSTP: + REPEAT %TNESC,0 + 440700,,[.BYTE 7 ? 33 ? "G] ;VT52, ETC. + 440700,,[.BYTE 7 ? 30] ;DTM + 0 ;RAY + 440700,,[.BYTE 7 ? 33 ? "d] ;HDS + 440700,,[.BYTE 7 ? 33 ? "q] ;H19 + 440700,,[.BYTE 7 ? 33 ? "[ ? "m] ;AAA - this is not RIS, +;which could screw you over if your default state were a bad one. It's +;just SGR 0. +IFN .-CCRSTP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDRST + +CCINIP: ;initialize an intelligent terminal + REPEAT %TNESC,0 + 440700,,[.BYTE 7 ? 33 ? "G] ;VT52, ETC. + 440700,,[.BYTE 7 ? 30] ;DTM + 0 ;RAY + 440700,,[.BYTE 7 ? 33 ? "d] ;HDS + 440700,,[.BYTE 7 ? 33 ? "q] ;H19 +;all sorts of ways the AAA can be messed up. We fix just a few. + 440700,,[ASCII "[>27;29;30;33;34;35;37;40;46;51l[>52h[" + +1 ? 5.] ;First line must be multiple of 5 chars! +;does: turn off insert char, LF is LF, CR is CR, no destructive BS, no +;wrap forward, no wrap backward, no AUTO XON/XOFF, no half-duplex, no +;auto kbd disable(!), no alternate cursor mode. Let us clear entire +;screen, enable sending to host, turn off delete display, turn on META +;key. Finally, clears the screen, about 5 ms padding. +IFN .-CCINIP-%TNMAX, .ERR SOME TCTYP SETTING LACKS %TDINI + + +SUBTTL TTY CONTROL TABLES + +;TOTAL NUMBER OF TTYS +NCT==NOTYS+NKSTYS+NETYS+NNTYS+NNVTTS+NDZTYS+NDPTYS+NMTYS+NDLTYS+NSTTYS+N11TYS + +IFGE NCT-%TINON, .ERR EXCESSIVE NUMBER OF TTYS + +IFG NOTYS-1, .ERR MORE THAN ONE KA-10 CONSOLE TTY? +IFG NKSTYS-1, .ERR MORE THAN ONE KS-10 CONSOLE TTY? + +NFKSTY==NOTYS ;# OF FIRST KS-10 (BETTER BE ONLY) 8080 CONSOLE TTY +NFETY==NFKSTY+NKSTYS ;# OF FIRST DTE20 TTY +NFNTY==NFETY+NETYS ;# OF FIRST TK-10 TTY +NFNVTY==NFNTY+NNTYS ;# OF FIRST NOVA TTY +NFDZTY==NFNVTY+NNVTTS ;# OF FIRST DZ11 TTY. +; Terminals above this line have slow (char at a time) controllers +; below they have fast controllers. (Check TYPDA1: and TTYDO:) +NFDPTY==NFDZTY+NDZTYS ;# OF FIRST DATAPOINT LINE +NFMTY==NFDPTY+NDPTYS ;# OF FIRST MORTON TTY +NFDLTY==NFMTY+NMTYS ;# OF FIRST DL10 TTY. +NFSTTY==NFDLTY+NDLTYS ;# OF FIRST PSEUDO-TTY +NF11TY==NFSTTY+NSTTYS ;# OF FIRST PDP11-TV TTY. + +IFG NKSTYS, IFN NFKSTY, .ERR KS-10 CONSOLE TTY NOT ZERO? +IFG NETYS, IFN NFETY, .ERR FIRST DTE20 TTY NOT ZERO? + +;INSTRUCTION TO OUTPUT 1 CHAR TO A CHAR-AT-A-TIME CONTROLLER. +;INSNS NEED NOT EXIST FOR FAST CONTROLLERS. +TTYDO: REPEAT NOTYS,DATAO TTY,A + REPEAT NKSTYS, PUSHJ P,TTKSDO + REPEAT NETYS,JFCL + REPEAT NNTYS,DATAO NTY,A + REPEAT NNVTTS,PUSHJ P,TTNDO + REPEAT NDZTYS,PUSHJ P,TTDZDO + +IFN NKSTYS,[ +TTKSDO: ANDI A,177 ; Be sure it is ASCII + TRO A,400 ; Tell 8080 there is something there. + MOVEM A,8CTYOT ; Here is where it looks. + CONO 80INT\APRCHN ; Wake up! + POPJ P, +] ;NKSTYS + +IFN NDZTYS,[ ;DZ-11 Code +TTDZDO: PUSH P,C + ANDI A,177 ;Be sure it is ASCII, and no break bits set + HRRZ C,TTYLT(I) ;Unibus address + IOWRBI A,%DZRTD(C) ;Send it + POP P,C + POPJ P, +] ;NDZTYS + +IFN NNVTTS,[ +TTNDO: ANDI A,177 + CAME I,NVOPTT + JRST TTNDO1 + AOS NVTCC + DATAO NTY,A + POPJ P, + +TTNDO1: MOVEM I,NVOPTT ;MUST SELECT NEW CONSOLE + SETOM NVTSIP ;SIGNAL + MOVEM A,NVTSSC ;SAVE CHR + PUSH P,I + SUBI I,NFNVTY-1 + TRO I,200 + DATAO NTY,I + CLEARM NVTCC + POP P,I + POPJ P, +] + +;INSTRUCTION TO TELL A TTY'S CONTROLLER TO STOP INTERRUPTING FOR IT. +;(BECAUSE THERE IS NO OUTPUT TO BE SENT) +TTYDFF: REPEAT NOTYS,CONO TTY,200+TTYCHN + REPEAT NKSTYS, JFCL + REPEAT NETYS,JFCL + REPEAT NNTYS,CONO NTY,20+TTYCHN + REPEAT NNVTTS,JRST TYP5 + REPEAT NDZTYS,PUSHJ P,DZTYDF + REPEAT NDPTYS,CONO DPK,.RPCNT_12.+400+TTYCHN + REPEAT NMTYS,CONO MTY,.RPCNT_12.+200+TTYCHN + REPEAT NDLTYS,JFCL + REPEAT NSTTYS,JFCL + +;LINE-SPECIFIC INFORMATION +TTYLT: REPEAT NOTYS,500000+TTYCHN + REPEAT NKSTYS, 0 + REPEAT NETYS,0 + REPEAT NNTYS,.RPCNT_12.+400000+TTYCHN + REPEAT NNVTTS,0 + REPEAT NDZTYS, <.RPCNT&DZLNM>,,,BA> + REPEAT NDPTYS,0 + REPEAT NMTYS,.RPCNT_12.+TTYCHN + +;INSN TO EXECUTE TO SIGNAL THAT OUTPUT IS AVAILABLE ON A PREVIOUSLY +;IDLE TTY - TELLS THE CONTROLLER TO CAUSE AN "OUTPUT DONE" INTERRUPT. +TTYST: REPEAT NOTYS,CONO TTY,10+TTYCHN + REPEAT NKSTYS, CONO 10020\APRCHN + REPEAT NETYS,PUSHJ P,TTYSTE + REPEAT NNTYS,PUSHJ P,NTYST + REPEAT NNVTTS,PUSHJ P,NVTYST + REPEAT NDZTYS,PUSHJ P,DZTYST + REPEAT NDPTYS,CONO DPK,.RPCNT_12.+100+TTYCHN + REPEAT NMTYS,CONO MTY,.RPCNT_12.+10+TTYCHN + REPEAT NDLTYS,PUSHJ P,TTYSTD + REPEAT NSTTYS,PUSHJ P,TTYPT + REPEAT N11TYS,JFCL + +IFN DZ11P,[ ;DZ-11 Code +; Disable transmitter ready interrupts from this line +DZTYDF: PUSH P,[ANDCM B,DZLBIT(A)] ;Clear this line's bit + JRST DZTYDS + +; Enable transmitter ready interrupts from this line +DZTYST: PUSH P,[IOR B,DZLBIT(A)] ;Set this line's bit +DZTYDS: PUSH P,A + PUSH P,B + PUSH P,C + HRRZ C,TTYLT(I) ;Unibus address + HLRZ A,TTYLT(I) ;Line number + IORDBI B,%DZRTC(C) + XCT -3(P) ;Frob bit + IOWRBI B,%DZRTC(C) ;Write new state + POP P,C + POP P,B + POP P,A + SUB P,[1,,1] + POPJ P, + +; DZ11 initialization. +; No parity, character length = 8 bits, stop-code = 1 bit. +DZINIT: MOVEI C,NDZTYS-1 ;Relative last DZ TTY + SKIPGE C ;Don't do anything if there aren't any + POPJ P, +DZINI1: LDB A,[$TTOSP,,NFDZTY+TTYTYP(C)] ;Ospeed (assume it is = Ispeed) + HLRZ D,NFDZTY+TTYLT(C) ; Line number on board. + HRRZ B,NFDZTY+TTYLT(C) ; Bus address of controller. + SOSL A ;Is speed = 0? + CAILE A,10 ;Is speed > 9600? + BUG HALT,[BAD SPEED CODE FOR DZ-11. LINE],OCT,C + LSH A,32. ;Assemble byte pointer + IOR A,[400,,[.BYTE 4 ? 16 ? 14 ? 12 ? 10 ? 7 ? 5 ? 4 ? 2 ? 6]] + LDB A,A ;Obtain DZ11 speed code + LSH A,%DZLSS ;Assemble LPR code + IORI A,%DZLRO+3*%DZLCL(D) ;Line # to write and various bits + XCTRI [IOWRI A,%DZRLP(B)] ;Initialize this line + CAIA + BUG HALT,[DZ11 NOT RESPONDING (CHECK THE BREAKER ON THE UNIBUS). LINE],OCT,C + SOJGE C,DZINI1 ;Loop over all DZ TTYs. + +IFN ,[ + MOVEI C, ;First unused line on last used board +DZINI2: IOWRI C,%DZRLP+,BA> ; Disable line + CAIGE C,DZNLN-1 ;Only disable lines on last used board + AOJA C,DZINI2 ;Loop +] + MOVEI C,%DZCTE+%DZCRE+%DZCSE+%DZCMS ;Turn board on + MOVEI D,377_8 ; Set all DTR bits, clear enable bits +REPEAT <_-DZLNLN>,[ + IOWRI C,%DZRCS+ + IOWRI D,%DZRTC+ +] + POPJ P, + +;CALLED AT CLOCK LEVEL TO EMPTY DZ INPUT SILOS TO TTY CODE +; What you really want to do is measure the average interrupt rate of +; each DZ and use this scanning approach only when the DZ is heavily +; active. What fun. +DZSCAN: CONO PI,TTYOFF-1 ;No TTY or lower ints, leave clock on + PUSH P,I ;Just in case +REPEAT <_-DZLNLN>,[ + IORDI A,%DZRCS+ + TRNN A,%DZCRD ;Character in silo? + JRST CONC DZS,\.RPCNT,EN +CONC DZS,\.RPCNT,LP: + IORDI A,%DZRDR+ ;Get character from silo + TRNN A,%DZDDV ;Valid character? + JRST CONC DZS,\.RPCNT,EN ;Nope, done with this DZ + ;Check parity? + LDB I,[.BP %DZLM,A] ;Get line # on DZ + ADDI I,+NFDZTY + CAIL I,NFDZTY+NDZTYS + BUG + PUSHJ P,NTYI1 ;Send char to TTY code + JRST CONC DZS,\.RPCNT,LP +CONC DZS,\.RPCNT,EN: +] + POP P,I + CONO PI,TTYON-1 ;Turn ints back on + POPJ P, +];DZ11P + +IFN TK10P,[ +NTYST: PUSH P,C ;START A TK10 TTY + CONI PI,C + ANDI C,177 ;SAVE WHICH PI CHANNELS ARE ON + CONO PI,TTYOFF + CONO NTY,@TTYLT(I) + CONO NTY,10+TTYCHN + CONO PI,2000(C) ;RESTORE PI STATUS + POP P,C + POPJ P, +] + +IFN NNVTTS,[ +NVTYST: PUSH P,I + SKIPL I,NOVATT + PUSHJ P,NTYST + POP P,I + POPJ P, +] + +TTYPT: PUSH P,B ;TTYST ROUTINE FOR STY TTYS. + PUSH P,C + MOVE B,STYSTS-NFSTTY(I) ;USER +IFN NETP,[ + TLNE B,%SSNET + JRST TTYPT2 +TTYPT3: +];NETP + MOVE C,STYMSK-NFSTTY(I) ;CHANNELS OPEN MASK + AND C,MSKST2(B) + JUMPE C,POPCBJ ;JUMP IF INTS NOT ENABLED + MOVN B,C + AND C,B + MOVE B,STYSTS-NFSTTY(I) + IORM C,IFPIR(B) + JRST POPCBJ + +IFN NETP,[ ;START STY THAT'S DIRECT CONNECTED TO NETWORK +TTYPT2: CONI PI,C + ANDI C,177 ;SAVE WHICH PI CHANNELS ARE ON + CONO PI,NETOFF + MOVSI B,%SSNET + TDNN B,STYSTS-NFSTTY(I) + JRST [ CONO PI,2000(C) ? JRST TTYPT3 ] + SKIPL STYNTL-NFSTTY(I) + JRST TTYPT4 ;ALREADY ON ACTIVATE LIST + MOVE B,STYNTA + MOVEM B,STYNTL-NFSTTY(I) + MOVEM I,STYNTA +TTYPT4: CONO PI,2000(C) ;RESTORE PI STATUS + JRST POPCBJ +];NETP + +IFN NETYS,[ +TTYSTE: CONO PI,400 ;PI OFF + SKIPL DTEOST + JRST TYSTE1 + HRRZM I,DTEOST ;TELL 11 TO SET OUTPUT DONE + CONO PI,200 ;PI ON + CONO DTE,%DBL11 ;INTERRUPT 11 + POPJ P, + +TYSTE1: CONO PI,200 ;PI ON + CONO DTE,%DBL11 ;INTERRUPT 11 + AOS DTEHC ;COUNT NUMBER OF TIMES HAD TO WAIT + SKIPL DTEOST ;THERE'S NO WAY TO AVOID HAVING TO WAIT ONE PLACE + JRST .-2 ; OR ANOTHER. THE -11 TRIES TO PICK UP OUTPUT-DONE FAST. + JRST TTYSTE +];NETYS + +IFN DL10P,[ +TTYSTD: SKIPN DL10F + JRST TYPEN1 + CONO PI,400 ;PI OFF + SKIPE DL10SO + JRST TTYSD1 + HRRZM I,DL10SO ;TELL 11 TO SET OUTPUT DONE + CONO PI,200 ;PI ON + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + POPJ P, + +TTYSD1: CONO PI,200 ;PI ON + CONO DLC,100040+TTYCHN ;INTERRUPT 11 + AOS DL10HC ;COUNT NUMBER OF TIMES HAD TO WAIT + SKIPE DL10SO ;THERE'S NO WAY TO AVOID HAVING TO WAIT ONE PLACE + JRST .-2 ;OR ANOTHER. THE -11 TRIES TO PICK UP OUTPUT-DONE FAST. + JRST TTYSTD +] + +EBLK + +DEFINE TTYREP WRD +.CRFOFF +REPEAT NCT,CONC T,\.RPCNT,$!WRD +.CRFON +TERMIN + +IFNDEF TIBL,TIBL==41 +IFNDEF TOBL,TOBL==101 +TIBS==TIBL*2-1 +TOBS==TOBL*4 + +IFNDEF MICBAA,MICBAA==50. ;MAXIMUM NUMBER OF INPUT BUFFER CHARACTERS BEFORE AUTOMATIC ACTIVATION + +IFNDEF TYOWNC,TYOWNC==20. ;MIN # BYTES OF SPACE THERE MUST BE + ;IN OUTPUT BUFFER BEFORE IT IS OK TO TRY TO OUTPUT ANYTHING. + +TIB: BLOCK TIBL*NCT ;TTY INPUT BUFFERS (18 BITS PER CHARACTER) +TOB: BLOCK TOBL* ;TTY OUTPUT BUFFERS (8 BITS PER CHARACTER) + +;INPUT BUFFER BITS: +%TXMPE==400000 ;MAIN PROGRAM ECHO CHARACTER +%TXPIE==200000 ;PI ECHO CHARACTER +%TXCOM==100000 ;COM MODE ECHO CHAR; DO PI ECHO EVEN IF HDX TTY. +%TXIGN==40000 ;IGNORE THIS CHAR AT .IOT TIME. +%TXACT==20000 ;THIS IS AN ACTIVATION CHAR. +%TXINT==10000 ;THIS CHAR SHOULD INTERRUPT THE USER. + +;NOW COME THE BITS OF THE CHARACTER ITSELF: +%TXTOP==4000 ;"TOP" KEY. +%TXECI==2000 ;ECHOED DUE TO ECHOIN SYSTEM CALL +;%TXSFT==1000 ;"SHIFT" KEY. +%TXSUP==1000 ;"SUPER" KEY. +%TXMTA==400 ;"META" KEY. +%TXCTL==200 ;"CONTROL" KEY. +%TXASC==177 ;THE ASCII PART OF THE CHARACTER. + ;%TXTOP+CERTAIN LETTERS ARE MAGIC KEYS. %TXTOP+"Z IS DEFERRED CALL. + +;OUTPUT BUFFER BIT: +%TXDIS==200 ;1 => THIS IS A %TD CHARACTER. +IF2 EXPUNGE %TXDIS ;SO %TX BIT TYPEOUT MODE LOOKS NICE. + +TIIP: REPEAT NCT, (002200)TIB-1+.RPCNT*TIBL+TIBL ;INPUT BUFFER INPUT POINTER +TIOP: REPEAT NCT, (002200)TIB-1+.RPCNT*TIBL+TIBL ;INPUT BUFFER OUTPUT POINTER + (002200)TIB-1 .SEE TTEBAK +TIBEP: REPEAT NCT, (002200)TIB-1+.RPCNT*TIBL+TIBL ;END OF INPUT BUFFER POINTER +TOIP: REPEAT NCT-N11TYS,(041000)TOB-1+.RPCNT*TOBL ;OUTPUT BUFFER INPUT POINTER + REPEAT N11TYS,0 +TOOP: REPEAT NCT-N11TYS,(041000)TOB-1+.RPCNT*TOBL ;OUTPUT BUFFER OUTPUT POINTER + REPEAT N11TYS,0 +TOBEP: REPEAT NCT-N11TYS,(041000)TOB-1+.RPCNT*TOBL+TOBL ;END OF OUTPUT BUFFER POINTER + REPEAT N11TYS,1 +TOBBP: REPEAT NCT-N11TYS,(041000)TOB-1+.RPCNT*TOBL ;BEG OF OUTPUT BUFFER POINTER + REPEAT N11TYS,1 +TINTP: REPEAT NCT,2200,,TIB-1+.RPCNT*TIBL+TIBL ;INTERRUPT CHARACTER POINTER +ECHOC: REPEAT NCT,0 ;COUNT OF ECHO BUF CHARS THAT ARE REALLY ECHO CHARS +ECHOP: REPEAT NCT,2200,,TIB-1+.RPCNT*TIBL+TIBL ;POINTER TO INPUT CHARACTER TO BE ECHOED NEXT +TINTC: REPEAT NCT,0 ;COUNT OF CHARACTERS AVAILABLE FOR .ITYIC'ING. +TICC: REPEAT NCT,0 ;TYPE IN CHARACTER COUNT +TACC: REPEAT NCT,0 ;ACTIVATION CHARACTER COUNT +TORM: REPEAT NCT,TOBS ;# CHARS ROOM LEFT IN OUTPUT BUFFER. +TOCMBF: REPEAT NCT,440700,,TCMBLK+.RPCNT*5 ;5-word string buffer for each +TCMBLK: BLOCK NCT*5 ;tty for outputting commands that are longer than a few chars. + +TTYERQ: REPEAT NCT,-1 ;LIST OF TTYS NEEDING ECHO LINKED THRU THESE WDS. (NIL = 200000,,) + ;-1 FOR TTY NOT NEEDING ECHO. +TYOSW: REPEAT NCT,-1 ;AOSE-STYLE SWITCH FOR MP USE OF TTY. +TTNTO: REPEAT NCT,0 ;# CHANNELS TTY IS OPEN ON (IN ALL JOBS.) +TYIMSK: REPEAT NCT,0 ;BIT SET FOR EACH CHANNEL THE TTY IS OPEN FOR + ;INPUT ON IN THE JOB THAT OWNS THE TTY NOW. +TYOMSK: REPEAT NCT,0 ;SIMILAR, BUT FOR OUTPUT CHANNELS. +TTYBYP: BLOCK NCT ;NOT 0 => B.P. TO ASCIZ STRING TO OUTPUT AT INT. LVL. +TTLTM: REPEAT NCT,0 ;TIME LAST CHRWAS REMOVED FROM OUTPUT BUFFER. +TTYOAC: REPEAT NCT,-1 ;-1 IF TTY OUTPUT INACTIVE +TTITM: REPEAT NCT,0 ;TIME OF LAST TYPE-IN ON TTY (NOT USED BY SYSTEM). +TTYLJB: REPEAT NCT,0 ;LAST JOB TO OUTPUT TO THIS TTY. DOES NO HARM IF ABSURD. + +TTYIPC: REPEAT NCT,[ +IFG APL,IFE APL-.RPCNT, TTYIS5 ;JUST STORE AND EXIT FOR AP LINE. + .ELSE TTYI ;TTY INPUT PC +] +TYBPC: REPEAT NCT,TYBN ;PC OF ^\-HANDLING CO-ROUTINE. +TTOALC: REPEAT NCT,-1 ;LH IS -1 TO ALLOW M.P. TYPEOUT, OR 0 TO DELAY IT. + ;RH IS OUTPUT ALLOCATION: -1 => INFINITY (THE NORMAL CASE), + ;ELSE # OF CHARS ALLOWED TO BE OUTPUT. ^\ COMMANDS ARE + ;USED BY THE TTY TO ALLOCATE FOR OUTPUT. + +TCMXV: TTYREP VER ;MAX LINES VERT +TCMXH: TTYREP HOR ;MAX CHR HORZ +TTYROL: TTYREP ROL ;# LINES PER GLITCH WHEN SCROLLING. +TTYIHP: REPEAT NCT,30. ;INT LVL HPOS +TTYIVP: REPEAT NCT,5 ;INT LVL VPOS +TTYLPP: REPEAT NCT,#-1 + ;IDX OF PC PPR ASSOCIATED WITH TTY, + ;OR NEGATIVE => NONE NOW ASSOCIATED, + ;AND IS 1'S COMP. OF IDX OF PC PPR + ;FORMERLY ASSOCIATED. +TTYEPP: REPEAT NCT, ;IDX OF PC PPR TO USE FOR ECHO. +TTYLPS: REPEAT NCT,5,,30. ;IF TTYLPP <0, THIS IS MAIN PRGM VPOS,,HPOS. + +TPBEG: ;BEGINNING OF PC PPR VARS. +TPHB: ;USE 0 ;HPOS OF LEFT MARGIN. +TPVB: BLOCK 1 ;VPOS OF TOP MARGIN (1ST LINE OF PC PPR) +TPHE: ;USE TCMXH ;HPOS OF 1ST COLUMN AFTER RIGHT MARGIN +TPVE: ;USE TCMXV ;VPOS OF 1ST LINE BELOW BOTTOM MARGIN +TPHP: BLOCK 1 ;HORIZONTAL POSITION OF CURSOR +TPVP: BLOCK 1 ;VERTICAL POSITION OF CURSOR +TPVM: BLOCK 1 ;NUMBER OF LINES BEFORE A **MORE** IS ALLOWED +TPSP: BLOCK 1 ;SAVED CURSOR POS (FOR ^PS AND ^PR) +TPFLAG: BLOCK 1 ;HOLDS RANDOM FLAGS. +%TF==0,,777775 +%TFEOP==1 ;1 => HAVE JUST ENTERED LAST LINE OF PC PPR. + ;NEXT ATTEMPT TO OUTPUT SHOULD DO **MORE** PROC. +%TFIGL==2 ;1 => LAST CHAR WAS CR NOT IN IMAGE MODE. + ;IF NEXT CHAR IS LF, IGNORE IT. + + TPLEN==.-TPBEG + .=TPBEG + +REPEAT 2*NCT,[ ;NOW ASSEMBLE INITIAL CONTENTS OF PC PPR VARS. + 0 + 0+IFE .RPCNT&1,30. ;TPHP & TPVP: NONZERO FOR MAIN PRGM. + 0+IFE .RPCNT&1,5 + 0 ? 0 ? 0 +] +EXPUNG TPHB,TPHE,TPVE + +IFN .-TPBEG-NCT*TPLEN*2,.ERR + +COMT1: BLOCK NCT ;COM TEMPORARY STORAGE +COMT3: BLOCK NCT ;DITTO. WHILE QUERYING FOR A LINK, THIS IS -1 IF + ;IN IEC MODE, WHICH MEANS OK TO PASS TYPEIN THROUGH +DZLBIT:: ; Also Line number bits for DZ11 +CHNBIT: REPEAT 20,1_<.RPCNT> + +;DATA POINT CONTROLLER LINE VARIABLES +;THIS ARRAY LOOKED AT BY HARDWARE + +IFNDEF LDBFF,LDBFF==10. ;LENGTH OF OUTPUT BUFFER^2 (PER LINE) + +IFN DPKPP,[ +DPKBAS: REPEAT NDPTYS,[ + -1 ;CHR CNT + (440701,,0) ;BYTE PNTR +] + +DBBFP: REPEAT NDPTYS, 440700,,DBBF+.RPCNT*LDBFF ;PNTRS TO OUTPUT BUFFER +DPKC: REPEAT NDPTYS, DPKBAS+2*.RPCNT ;PNTR TO HARDWARE COUNT WORD +DPKP: REPEAT NDPTYS, DPKBAS+2*.RPCNT+1 ;PNTR TO BUFFER PNTR WD +DBBF: BLOCK LDBFF*NDPTYS ;OUTPUT BUFFER + +DPSPT: 2 ;134 + 6 ;600 + 1 ;110 + 2 ;150 + 3 ;300 + 24. ;1200 + 36. ;1800 + 48. ;2400 + 48. ;4800 +LDPSPT==.-DPSPT +] +DBBCC: 0 ;CHRS REMAINING IN CURRENT BLOCK + ;FOR DPK, SET ACC. TO OUTPUT SPEED, TO + ;REPRESENT APPROX. 100MS TYPEOUT TIME. + ;FOR MTY, SET TO 5. + +DBBCC1: 0 ;INITTED LIKE DBBCC, BUT NOT DECREMENTED. + +DBBBP: 0 ;BYTE PNTR TO DBBF BUFFER OR MTYOW. + +;MORTON BOX LINE VARIABLES +IFN MTYP,[ +MTYOW: 0 ;UP TO 5 CHARS TO BE OUTPUT PUT IN THIS WD. +MTYNC==5 ;NUMBER OF CHARS PACKED IN ABOVE WORD. +] + +;DTE20 VARIABLES OTHER THAN THOSE IN LOW CORE +;I.E. NOT (DIRECTLY) REFERENCED BY 11 +IFN NETYS,[ +DTEHC: 0 ;NUMBER OF TIMES LOOPING AT TTYSTE +DTECNI: 0 ;CONI DTE, AT LAST INTERRUPT +DTEBBY: 0 ;NON-ZERO => BUFFER BUSY WITH TRANSFER IN PROGRESS + ; FOR DEBUGGING, THE NON-ZERO VALUE IS THE DTEOUT COMMAND. +DTEBBT: 0 ;TIME-OUT IN HALF-SECOND UNITS +DTEOBL==200 ;NUMBER OF CHARACTERS IN OUTPUT BUFFER +DTEOBF: BLOCK /4 ;TTY OUTPUT BUFFER +];NETYS + +IFN NNVTTS,[ +NOVATT: -1 ;TTY # NOVA CONNECTED TO -1 IF NONE +NVIPTT: -1 ;CURRENT NOVA PSEUDO TTY ON INPUT +NVOPTT: 0 ;CURRENT NOVA PSEUDO TTY ON OUTPUT +NVTSIP: 0 ;-1 IF NOVA TTY SELECT IN PROGRESS (OUTPUT) +NVTSSC: 0 ;CHAR SAVED HERE DURING NVTSIP -1 +NVTCC: 0 ;# CHARS SENT TO CURRENT TTY SINCE RESCANING OTHER PSEUDO TTYS +NNVSEC: 0 ;LAST CONSOLE TO CHECK IN TYP0 SEARCH +NNVSFL: 0 ;-1 IF SERVING PREV SELECTED + ;IE IF IT CRAPS OUT, SEARCH EVEN THO IT = NNVSEC +] + +IFN N11TYS,[ +;PDP11-TV COMMUNICATION VARIABLES: + +TT11HD: .+1 ;ADDR (IN PDP10 ADDRESS SPACE) OF PDP11 CHANNEL + 0 ;HEADER AREA. IF @TT11HD IS NONZERO, THERE + ;IS INPUT TO BE PROCESSED. + +TT1111: 0 ;# TV'S THE 11 IS SET UP FOR +TT11RL: 0 ;# TV'S IN USE = MIN (TT1111, N11TYS). +TT11OL: 0 ;# PDP10 WORDS IN A PDP11-TV OUTPUT BUFFER. +TT11ER: BLOCK 6 ;FILLED WHEN BAD DATA COMMING FROM PDP11 + .SEE TT11LS + +TT11LO=400000+TTPG0*2000 ;BEGINNING OF PDP11 MEMORY IN PDP10 ADDRESS SPACE. +TT11HA==10+TT11LO ;PDP10 ADDR OF PDP11'S 40 (CHNL HDR AREA ADDR) +TT11UP==TT11HA+2 ;PDP10 ADDR OF "11 UP" FLAG. +TT11DN==TT11UP+1 ;PDP10 ADDR OF "11 ABOUT TO GO DOWN" FLAG. + +$11==1,,777700 ;DEFINE B.P.'S TO PDP11 FIELDS OF A PDP10 WORD. +$11WD0==242000 ;LOW (EVEN) 11 WORD +$11WD1==042000 ;HIGH (ODD) 11 WORD + +$11AD0==261600 ;LOW 11 WORD, SHIFTED DOWN 2 (FOR CONVERTING 11-ADDRESS TO 10 ADDRESS). +$11AD1==061600 ;HIGH 11 WORD, SHIFTED DOWN 2 + +$11BY0==241000 ;LOWEST 11 BYTE. EACH 10-WORD HOLDS 4 11-BYTES. +$11BY1==341000 ;NEXT 11 BYTE +$11BY2==041000 ;THIRD BYTE +$11BY3==141000 ;FOURTH BYTE + +;FORMAT OF AN INPUT BUFFER: (ALL POINTERS ARE PDP11 ADDRS) +;PDP11 WORD #, ... MEANING. +; 0 ... 0 => FREE, ELSE -<# DATA CHARS>. +; 1 ... ZERO, ALWAYS. +; 2 ... -> NEXT BUFFER FOR THIS TTY. +; 3 ... -> NEXT ACTIVE BUFFER. +; 4 ... KEYBOARD NUMBER (= -NF11TY) +; 5+ ... DATA CHARS, 1 PER PDP11 WORD. + +;FORMAT OF AN OUTPUT BUFFER: +;STARTS AT A MULTIPLE-OF-FOUR PDP11 ADDRESS, HAS A BUNCH OF BYTES, +;TT11BY BITS PER BYTE (USED TO BE 16, NOW 8). BYTES ARE IN PDP10 ORDER. +;AFTER THE PDP11 PICKS UP A BYTE OUT OF THE BUFFER, IT STORES BACK -1, +;WHICH TELLS THE 10 THAT IT IS OK TO STORE ANOTHER BYTE THERE. +];N11TYS + +IFN DZ11P,[ +;DZ11 STORAGE +;Temp metering locs +DZXINC: 0 ;Count of DZ transmit interrupts +DZXCHC: 0 ;Count of DZ transmit characters +; +DZDCRQ: 0 ;Disconnect requests +DZCORQ: 0 ;Connect requests. +IFG NDZTYS-36.,.ERR Too many DZ TTYS, fix code using DZDCRQ or DZCORQ +];DZ11P + +LOCTTY: 0 ;CONSOLE INPUT CHAR READ FROM +LTTYIPC:0 ;TTYIPC USED IN LAST INPUT INT (DEBUGGING ONLY) +LTYBPC: 0 ;TYBPC USED IN LAST INPUT INT (DEBUGGING ONLY) +LEPCHR: 0 ;-1 IF CURRENT INPUT CHAR IS A LOCAL EDITING PROTOCOL COMMAND CHAR. + +TTYA: 0 +TTYACS: BLOCK 17-B+1 +IFN KA10P, TTYAPC: 0 ;APR CONI AT TTYBRK. +TTYPDP: -LTTYP,,TTYPDL-1 +TTYPDL: BLOCK LTTYP + +IFN TTLPTP,[ +LPTTTY: TTLPTP ;TTY# THAT IS REALLY LPT +LPTTIME: 0 ;LAST TIME SYSTEM GOT INPUT FROM LPT +] + +STYMAX: NCT ;Highest-numbered STY to be allocated (for limiting load) +STYOSW: -1 ;PSEUDO TTY OPEN SWITCH + 0 + +TTERQS: MOVE ;LIST (THREADED THRU TTYERQ) OF TTYS NEEDING ECHOING. + ;"MOVE" (= 200000,,) IS THE END OF THE LIST. + ;OTHERWISE, A POINTER IS THE NUMBER OF A TTY + ;WHOSE TTYERQ VAR. HOLDS THE NEXT POINTER. + +TTEDMY: 0 .SEE TYOPV0 ;DUMMY VARIABLE BLOCK + 0 .SEE TYOPV1 ;PASSED BY ECHO ROUTINE + TTEDMY .SEE TYOPV2 ;TO .IOT RTNS. + 0 .SEE TYOPV3,TTELUP + +NTTELU: 0 .SEE TTELUP ;ECHOING STATISTICS. +NTTEWA: 0 .SEE TTEWAT +NTTEL1: 0 .SEE TTELP1 + +STYNTO: BLOCK NSTTYS ;NUMBER TIMES PSEUDO TTY OPEN +STYMSK: REPEAT NSTTYS,0 ;BIT FOR EACH CHNL STY OPEN FOR INPUT ON +STYOMS: REPEAT NSTTYS,0 ;OUTPUT +STYSTS: REPEAT NSTTYS,0 ;STY STATUS 0 => FREE SLOT + ;RH = USER INDEX THAT HAS IT OPEN +%SSHNG==400000 ;4.9 = 1 => DON'T HANG ON INPUT IOTS +%SSUSE==200000 ;4.8 = 1 => IN USE +%SSINT==100000 ;4.7 = 1 => HAVE GIVEN INT ON STY OUTPUT CHNS ALREADY +%SSONT==040000 ;4.6 = 1 => DITTO FOR STY INPUT (TTY OUTPUT) +%SSOHG==20000 ;4.5 = 1 => DON'T HANG ON OUTPUT IOT +%SSORS==10000 ;4.4 = 1 => THIS STY WANTS %TDORS WHEN A + ;TTY OUTPUT RESET IS DONE. +IFN NETP,[ +%SSNET==4000 ;4.3 = 1 => THIS STY CONNECTED TO SOME NET SOCKETS. +%SSCHA==2000 ;4.2 = 0 FOR ARPANET, 1 FOR CHAOS NET +%SSTCP==1000 ;4.1 = 1 for TCP internet (%SSCHA must be 0) + +STYNTI: REPEAT NSTTYS,-1; If %SSNET set, holds net connection identifier. + ; NCP: Input IMSOC idx,,Output IMSOC idx + ; CHA: connection index + ; TCP: TCB (connection) index + ; Otherwise -1 +STYNTA: 0 ;HEAD OF LIST OF DIRECT-CONNECTED STYS NEEDING DATA XFER. + ;0 IS NIL; A TTY # POINTS TO A STY. +STYNTB: 0 .SEE STYNTC ;COPIED STYNTA LIST USED INSIDE STYNTC ONLY +STYNTL: REPEAT NSTTYS,-1;STYNTA LIST THREADED THROUGH THIS TABLE. + ;+ NEXT TTY IN LIST, 0 END OF LIST, - NOT IN LIST +STYORC: REPEAT NSTTYS,0 ;OUTPUT-RESET CHARACTERS, 8-BIT BYTES TERMINATED BY 0 +TYPNTF: 0 ;-1 WHILE TYP BEING CALLED FROM STYNT0 +NTORFU: 0 .SEE TYPOR3 +] ;NETP + +STYICH: 0 ;TEMP STORAGE FOR PSEUDO-TTY INPUT CHAR + +TCTYP: TTYREP TCT ;THIS WORD SAYS HOW TO PERFORM + ;CURSOR CTL FUNCTIONS ON TTY. +%TNPRT==0 ;PRINTING TTY. +%TNDP==1 ;TTY USES DATAPOINT CURSOR CTL CODES. +%TNODP==2 ;LOSING DATAPOINT (ML-KA HAS SOME). +%TNIML==3 ;TTY USES IMLAC CURSOR CODES. +%TNTEK==4 ;TEKTRONIX 4000 SERIES +%TNTV==5 ;TTY IS A KNIGHT TV DISPLAY. +%TNMEM==6 ;MEMOWRECK +%TNSFW==7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. +%TNTRM==10 ;TERMINET +%TNESC==11 ;TTY WANTING STANDARD ASCII ESCAPE SEQUENCES +%TNDTM==12 ;DATAMEDIA +%TNRAY==13 ;TELERAY 1061 +%TNHDS==14 ;HDS CONCEPT-100 +%TNH19==15 ;H19/Z19 +%TNAAA==16 ;AAA +%TNMAX==17 + +;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR +;TERMINAL ATTACHED TO EACH LINE. +TTYOPT: TTYREP OPT + +;LEFT HALF BITS ARE: +%TOALT==200000 ;4.8 => STANDARDIZE ALTMODES. +%TOCLC==100000 ;4.7 => CONVERT LOWER CASE TO UPPER. +%TOERS==40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. +%TOHDX==20000 ;4.5 => THIS TTY IS HALF-DUPLEX. +$TOHDX==370100 +%TOMVB==10000 ;4.4 => THIS TTY CAN BACKSPACE. +%TOSAI==4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. +%TOSA1==2000 ;4.2 INIT %TSSAI OF NEW JOBS. +%TOOVR==1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. +%TOMVU==400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (IS A DISPLAY). +%TOMOR==200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY + ;(ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). +%TOROL==100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. +%TORAW==40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. +%TOLWR==20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. +%TOFCI==10 ;3.4 => THIS TTY CAN INPUT 12-BIT CHARACTERS (HAS FULL KEYBOARD). +%TOIML==4 ;3.3 => IMLAC, HANDLES CURSOR MOTION STRANGELY. +%TOLID==2 ;3.2 => LINE INSERT AND DELETE WORK +%TOCID==1 ;3.1 => CHARACTER INSERT AND DELETE WORK + +;RIGHT HALF: +%TPPLF==100000 +$TPPLF==170300 ;3-BIT FIELD SAYING HOW TO PAD LF. + ;0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. +%TPPCR==10000 +$TPPCR==140300 ;3-BIT FIELD SAYING HOW TO PAD CR. + ;7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. + ;0 - DON'T. 1 - NORMAL. 2 - DOUBLE. + ;ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL CURSOR MOTION. + ;4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. + ;ON TERMINETS, 0 => NO PADDING, OTHER CODES ARE + ;1 FOR 10CPS, 2 FOR 15CPS, 3, 4, 5 FOR 30, 60, 120 CPS. +%TPPCW==6 ;FOR MEMO WRECK. +%TPPTB==1000 +$TPPTB==110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER TAB. + ;0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING CHARS NEEDED> +%TPMTA==400 ;1.9 => HARDWARE META KEY SETS 8TH BIT +%TPPRN==200 ;1.8 => INTERCHANGE () WITH [] ON INPUT +%TPTEL==100 ;1.7 => TREAT CRLF INPUT AS CR FOR TELNET PROTOCOL +%TPCBS==40 ;1.6 => ENABLE SPECIAL TREATMENT OF 034 ("CONTROL BACK SLASH") ON INPUT. + ;(THE "INTELLIGENT TERMINAL PROTOCOL"). +%TP11T==20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. + ;NOT SETTABLE BY USER. +%TPORS==10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO SOMETHING. +%TPRSC==4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD + +;SMARTS VARIABLE, %TQ IN LH, %TR IN RH, BIT DEFINITIONS IN BITS > +TTYSMT: TTYREP SMT +.SEE %TQ +.SEE %TR + +TTYST1: REPEAT NCT,0 ;FIRST SIX GROUPT (SIX BITS PER GROUP) +TTYST2: REPEAT NCT,0 ;SECOND SIX GROUPS (SIX BITS PER GROUP) +TTYSTS: REPEAT NCT,%TSFRE,,-1 ;MODE BITS FOR TTY + +;GROUP NUMBER CHARACTERS +;[ 0 ^A-^F ^K-^L ^N-^R ^T-^Z ^] ^^ ^_ ^@ ^\ +; 1 A-Z LOWER CASE A-Z +; 2 0-9 +; 3 !"#$(DOLLAR)%&',.:;?@\ (ACCENT GRAVE) (VERTICAL BAR) (TILDE) +; 4 *+-/=^_ +; 5 <>[]() (LEFT BRACE) (RIGHT BRACE) +; 6 ^G ^S (^S IS IN GROUP 0 AS FAR AS %TGIMG IS CONCERNED) +; 7 LF ^I(TAB) +; 10 (ALTMODE) +; 11 CR +; 12 RUBOUT +; 13 SPACE ^H(BACKSPACE) + +;TTYST1 HAS GROUPS 0 THROUGH 5 FROM LEFT TO RIGHT +;TTYST2 HAS 6 THROUGH 13 +;EACH GROUP HAS SIX BITS AS FOLLOWS: +%TGINT==1 ;N.1 => INTERRUPT ON THIS GROUP +%TGACT==2 ;N.2 => ACTIVATE ON THIS GROUP (FOR SWAPPING) +%TGSPC==4 ;N.3 => SPECIAL HACKS. (THIS SET ON GROUP 1 => CONVERT LOWER CASE INPUT) +%TGIMG==10 ;N.4 => IMAGE MODE OUTPUT (N.4=0 => ASCII MODE) + ;N.6-N.5 => ECHO MODE + ; 00 => NO ECHO +%TGPIE==20 ; 01 => PI ECHO (ECHO CHARACTER WHEN TYPED) +%TGMPE==40 ; 10 => MAIN PROGRAM ECHO (ECHO WHEN MAIN PROGRAM RECEIVES CHARACTER) + +;TTYSTS HAS RANDOM BITS ASSOCIATED WITH THE TELETYPE +%TSFRE==400000 ;4.9 => TTY FREE +%TSCLE==200000 ;4.8 => ECHO ^L AS UPARROW-L EVEN ON DISPLAYS + ;(OTHERWISE WOULD ECHO AS CLEAR SCREEN) +%TSHDX==100000 ;4.7 REFLECTS %TOHDX BIT. +%TSFCO==040000 ;4.6 => HANDLE 9-BIT CHARS ON OUTPUT, USING ALPHA, BETA. +%TSALT==020000 ;4.5 => DON'T STANDARDIZE ALTMODE. +%TSROL==010000 ;4.4 => SCROLL MODE. +%TSSAI==004000 ;4.3 => ECHO AND ASCII MODE SHOULD USE SAIL CHAR SET. +%TSACT==002000 ;4.2 => GOBBLE NEXT CHAR REGARDLESS OF ACTIVATION STATUS +%TSNEA==001000 ;4.1 => DON'T ECHO IN THE ECHO AREA. ECHO IN M.P. AREA. +%TSINT==000400 ;3.9 => INT ON NEXT CHAR REGARDLESS +%TSMOR==000200 ;3.8 => INHIBIT **MORE**. +%TSATY==000100 ;3.7 SET BY .ATTY, SAYS TTY WAS TAKEN AWAY & RETURNED. + ;3.6-3.5 UNUSED. +%TSNOE==000010 ;3.4 => DEFER ECHOING, AND MAKE INPUT IOT'S ACT AS IF %TIECH=1. +%TSLCZ==000004 ;3.3 => LAST CHARACTER TYPED WAS ^Z (NOT PRECEEDED BY ^_) +%TSSII==000002 ;3.2 => SUPER IMAGE INPUT MODE +%TSCNS==000001 ;3.1 => CONSOLE +$TSCNS==220100 + ;RH => USER INDEX + ; -1 => NO USER + +TTYSTA: REPEAT NCT,%TACFM,, ;NOT SAVED AT ATTY +%TACFM==400000 ;4.9 = 0 => NEEDS TO HAVE CONSOLE FREE MSG EVENTUALLY TYPED + ; CLEARED BY OPEN OR ZFLAG WHEN INITIALIZING CONSOLE PROCEDURE + ; SET BY SYS JOB AFTER TYPING CONSOLE FREE MSG + ;WHEN THIS BIT IS 0, TTY ISN'T AVAILABLE FOR BEING GOBBLED DOWN + ;FOR ANY NEW USE. +%TACTZ==200000 ;4.8 ON => TTY IS FREE AND BEING ^Z'D, SO EVEN THOUGH IT APPEARS + ;OTHERWISE TO NEED A CONSOLE-FREE MESSAGE IT SHOULDN'T GET ONE. +%TANJS==100000 ;4.7 ON => TTY IS BEING ^Z'D, BUT THERE ARE NO JOB SLOTS. + ;4.8 WILL BE ON AND 4.9 OFF. SYS JOB WILL RESTORE ALL TO NORMAL + ;AFTER TYPING "SYSTEM FULL" ON THE TTY. +%TANEC==070000 ;4.6-4.3 NUMBER OF FOLLOWING CHARS TO INHIBIT ECHO AND INTS FOR. + ;THIS IS USED FOR THE ARG CHARS THAT FOLLOW TOP-E, TOP-S, TOP-Y, ETC. + +TTYCOM: REPEAT NCT,0,,-1 ;COMMUNICATE WORD +;4.9 => TTY IN COMMUNICATE MODE +%TCLFT==200000 ;4.8 => LOCAL FEED THROUGH (SET IF MY PRGM RECIEVING HIS CHRS) +%TCRFT==100000 ;4.7 => REMOTE FEED THROUGH (SET IF HIS PRGM RECIEVING MY CHRS) +%TCICO==40000 ;4.6 => INPUT COMMUNICATE OVERRIDE (SET IF MY CONSOLE FEEDING MY + ; PRGM EVEN THO IN COMM MODE). ALSO IMPLIES OUTPUT OVER-RIDE. +%TCOCO==20000 ;4.5 => OUTPUT COMMUNICATE OVERRIDE (SET IF MY PRGM'S OUTPUT TO APPEAR ON MY CONSOLE ONLY EVEN THO IN COM MODE) +;4.4-4.3 => MESSAGE RECEIPT SWITCH + ;00 => ACCEPT +%TCRFS==10000 ;10 => REFUSE +%TCQRY==4000 ;01 => INTERROGATE +%TCMTR==2000 ;4.2 SET FOR TTY WHOSE MOTOR IS OFF & MUST BE TURNED +;ON BEFORE ANY OTHER OUTPUT IS DONE. +;(ONLY TERMINETS HAVE THEIR MOTORS SHUT OFF BY ITS). +%TCECH==1000 ;4.1 THE OUTPUT BUFFER CONTAINS ECHOING OUTPUT. + ;THIS MAKES OUTPUT RESET DO NOTHING. + ;THE BUFFER MUST NOT CONTAIN ECHO OUTPUT AND NORMAL OUTPUT AT ONE TIME. +%TCDET==200 ;3.8 CONSOLE'S TREE DETACHED BY TOP LEVEL INTERRUPT. + ;SET BY NDETAC AS SIGNAL TO SYSCFM (CNSL-FREE-MSG TYPER) +%TCDNG==100 ;3.7 => TYPE BELL ON TTY (BECAUSE INPUT BFR FULL). +%TCCBK==40 ;3.6 => READING UNAME OR TTY # AFTER ^_K. +%TCCBS==20 ;3.5 => READING UNAME OR TTY # AFTER ^_S. +%TCFPD==10 ;3.4 => FIRST PART DONE (USED FOR %TNESC ESCAPE SEQUENCES, %TNODP CR) +%TCTPN==4 ;3.3 TYPE ^_N ON LEAVING COM MODE (UNLESS USER EXPLICITLY TYPES ^_N) +%TCPAD==2 ;3.2 0 => PADDING NECESSARY ON DATAPOINT. +%TCHNG==1 ;3.1 TTY'S DONE FLAG APPEARS TO BE FRIED, TIME OUT QUICKLY +;RH => USER INDEX COMMUNICATING WITH (-1 NONE) + + +;TTYTYP TABLE +;THIS TABLE HOLDS BITS THAT DESCRIBE THE LINE +;AND ITS CONTROLLER, RATHER THAN THE TTY ATTACHED TO THE LINE. + +%TTLCL==400000 ;BIT 4.9 ONE => LOCAL TTY +%TT340==200000 ;BIT 4.8 ONE => CONSOLE NEXT TO 340 OR A 340 SLAVE +%TT3HP==100000 ;BIT 4.7 HIGH PRIORITY ON 340 +%TTPAR==004000 ;BIT 4.3 THIS TTY NEEDS PARITY BIT SENT. +%TTDDI==002000 ;BIT 4.2 DONT DING ON EXCESS INPUT +$TTISP==260400 ;3.8-3.5 INPUT SPEED CODE +$TTOSP==220400 ;3.4-3.1 OUTPUT SPEED CODE + +%TYDPK==400000 ;BIT 2.9 DATAPOINT KLUDGE TERMINAL +%TYSTY==200000 ;BIT 2.8 PSEUDO TTY +%TYNVA==100000 ;BIT 2.7 NOVA TTY +%TYMTY==040000 ;BIT 2.6 MORTON BOX +%TYDIL==020000 ;BIT 2.5 DIAL UP +%TY11T==010000 ;BIT 2.4 PDP-11 TV TTY. +%TYDL== 004000 ;BIT 2.3 DL10 TTY +%TYOTY==002000 ;BIT 2.2 ORDINARY KA-10 CONSOLE TTY +%TYETY==001000 ;BIT 2.1 DTE-20 TTY (KL-10 CONSOLE) +%TYNTY==000400 ;BIT 1.9 TK-10 TTY. +%TYMDM==000200 ;BIT 1.8 LINE HAS MODEM CONTROL, DETECTS DIALINS AND HANGUPS +%TYKST==000100 ;BIT 1.7 KS-10 CONSOLE TTY +%TYDZT==000040 ;BIT 1.6 DZ-11 TTY ON KS-10 +%TYRLM==000020 ;BIT 1.5 ROLM DATA SWITCH + +TTYTYP: TTYREP TYP ;PART OF TTYTYP MAY BE WRITEABLE. +BBLK + 0 ;DISOWNED JOBS CANT HAVE LPT + %TTLCL,,;SYSTEM JOB CAN GET LPT + +.CRFOFF +IRPS X,,TYP OPT HOR VER TCT ROL SMT +REPEAT NCT,[ +CONC EXPUNG T,\.RPCNT,$!X +] +TERMIN +.CRFON + +OVHMTR UUO ;YET MORE RANDOM UUOS diff --git a/system/ttytyp.310 b/system/ttytyp.310 new file mode 100644 index 0000000..ab2929a --- /dev/null +++ b/system/ttytyp.310 @@ -0,0 +1,416 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;THE MASTER COPY OF THIS FILE IS KEPT ON AI:SYSTEM;TTYTYP > +;DUPLICATES ARE KEPT ON OTHER ITS MACHINES BUT THEY SHOULD +;NEVER BE EDITED. IF YOU'RE NOT TOTALLY SURE OF WHAT YOU'RE DOING +;DON'T EDIT THIS FILE; ASK A HACKER FOR ASSISTANCE. + +;HOW TO DESCRIBE EACH TTY. IT ASSUMES THE FOLLOWING: +;EACH MACHINE MUST HAVE A BLOCK OF ENTRIES, WHICH STARTS WITH +;THREE SEMICOLONS, A SPACE , AND THE NAME OF THE MACHINE. +;THEN MUST COME EXACTLY ONE COMMENT PER TTY, STARTING WITH +;"TNM ". THERE MAY BE OTHER COMMENTS NOT STARTING WITH A "TNM ". +;THOSE OTHER COMMENTS WILL BE IGNORED BY "NAME". + +;THIS FILE IS ARRANGED SO THAT IT CAN BE ASSEMBLED BY EITHER MIDAS OR PALX +;THE FOLLOWING MACROS ARE USED IN THIS FILE +; +;SEPARATORS: +; MCONDX CONDITIONAL FOR WHICH MACHINE +; .ENDC TERMINATE ... +; + +;TERMINAL TYPES: +;FIRST ARGUMENT TO TTDXXX MACRO IS THE LINE NUMBER +;FOLLOWING THAT CAN BE SEVERAL OPTIONS, SELECTED BY THE FOLLOWING KEYWORD PARAMETERS: +;TT LH(TTYTYP) ADDED TO SPEED CODE +;TY RH(TTYTYP) ADDED TO CONTROLLER-SELECT BIT +;TO LH(TTYOPT) ADDED TO DEFAULT BITS FOR DEVICE +;TP RH(TTYOPT) ADDED TO PAD CODES, DEFAULT IS DEFAULT %TPORS AND %TPCBS +;TCT TCTYP DEFAULT IS APPROPRIATE FOR TERMINAL BEING DEFINED +;HOR SCREEN WIDTH DEFAULT .. +;VER SCREEN HEIGHT DEFAULT .. +;ROL LINES/GLITCH DEFAULT .. +;SPEED OUTPUT SPEED IN BAUDS DEFAULT IS APPROPRIATE.. +;ISPEED INPUT SPEED IN BAUDS (IF DIFFERENT) +;SOME TERMINAL TYPES DON'T ACCEPT SOME OF THESE OPTIONS WHICH WOULD BE MEANINGLESS. + +.XCREF TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED ;FOOL @ + +; TTDPRT PRINTING TERMINAL (SPEED=110 => TTY35). DEFAULT SPEED IS 300. +; TTDMRX MEMOREX 1240 +; TTDTRM TERMINET 1200 +; TTDLPT BRIGHT (OR ODEC OR GOULD) LINE PRINTER ON TTY LINE +; TTDLA36 LA 36 +; TTDIML IMLAC +; TTDVT VT-52 +; TTDH19 H19 +; TTDTEK TEKTRONIX +; TTDLSR LOSING DATAPOINT +; TTDDPT DATAPOINT +; TTDGT40 GT-40 +; TTD11 PDP-11 (LOOKS LIKE PRINTING TERMINAL) +; TTDRAN RANDOM TYPE, YOU BETTER SPECIFY EVERYTHING +; TTDTV PDP-11 TV "LINE" VIA TEN-11 INTERFACE +; TTDGRN PDP-11 TV (OR GRINNELL TV) ON NORMAL TTY LINE +; TTD2741 N,CODE 2741 CODE=0 => EBCDIC, CODE=1 => CORRESPONDENCE +; TTDSTY SOFTWARE PSEUDO-TTY +; TTDC100 CONCEPT-100 +; TTDAAA Ann Arbor Ambassador + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AIKA,{ ;;; AI-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console (9th) + TTDPRT 1,SPEED=150,TY=%TYDIL ;T01 Dialup 15CPS * + ; 8-7874 15CPS + TTDPRT 2,SPEED=110,TY=%TYDIL ;T02 Dialup 10CPS * + ; 258-8794 10CPS + TTDPRT 3,SPEED=110,TT=%TTLCL ;T03 XGP TTY (9TH) + TTDPRT 4,SPEED=110,TT=%TTLCL+%TT340+%TT3HP ;T04 PDP6 TTY (9th) + TTDPRT 5,SPEED=110,TT=%TTLCL ;T05 TTY Near LPT (9th) + TTDPRT 6,SPEED=150,TY=%TYDIL ;T06 Dialup 15CPS * + ; 258-8795 15CPS + TTDPRT 7,SPEED=110,TT=%TTLCL+%TT340 ;T07 Little Robot TTY (9th) + TTDPRT 10,SPEED=134 ;T10 Baudot AP * + ;NEXT 3 USED TO BE 2741S, BUT WERE FLUSHED + TTDPRT 11,SPEED=134 ;T11 TSTC (9th) * + TTDPRT 12,SPEED=134 ;T12 2741 (9th) * + TTDPRT 13,SPEED=134,TY=%TYDIL ;T13 2741 Dialup * + TTDPRT 14 ;T14 Unused * + TTDPRT 15,SPEED=300,TY=%TYDIL ;T15 Dialup 30CPS + TTDPRT 16,SPEED=300,TY=%TYDIL ;T16 Dialup 30CPS + TTDPRT 17,SPEED=300,TY=%TYDIL ;T17 Dialup 30CPS + TTDPRT 20,SPEED=300,TY=%TYDIL ;T20 Dialup 30CPS + TTDVT 21,SPEED=4800,TT=%TTLCL ;T21 814 x7881 Barton,Berwick,Brotsky,Sjoberg + TTDTRM 22,TT=%TTLCL ;T22 Terminet in 813 (Hewitt) + TTDVT 23,SPEED=4800,TT=%TTLCL ;T23 926 Under the Miro x6765 + TTDDPT 24,TT=%TTLCL+%TT340,HOR=71. ;T24 Datapoint Near XGP (9th) + TTDAAA 25,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T25 810 Marty, Toto, Kansas x7836 + TTDDPT 26 ;T26 Datapoint in 822 (Stansfield) + TTDAAA 27,TT=%TTLCL,SPEED=4800 ;T27 926 Under ee cummings x6765 + TTDTRM 30,ISPEED=150,TY=%TYDIL ;T30 Dialup 120/15 CPS + ; 258-6091 150 IN, 1200 OUT TERMINET + TTDAAA 31,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T31 936 Lisp Machine Factory x6703 + TTDTRM 32,ISPEED=150,TY=%TYDIL ;T32 Dialup 120/15 CPS + ; 258-6090 150 IN, 1200 OUT TERMINET + TTDAAA 33,SPEED=4800,TT=%TTLCL ;T33 336 Sobalvarro, Delatizky x5834 + TTDVT 34,SPEED=4800,TT=%TTLCL ;T34 908 Oro + TTDDTM 35,SPEED=4800 ;T35 Poggio, Ullman x5781 (Bldg E10) + TTDRAY 36,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T36 812 Attardi, Barber, Koton (x7891) + TTDRAY 37,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T37 939 Kornfeld x5835 + TTDGT40 40,VER=29.,HOR=68.,TO=-%TOOVR ;T40 Micro-Automation PDP-11 (9th) +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MLKA,{ ;;; ML-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL ;T01 Dial-up 1.2KB Vadic + ;258-6756 + TTDPRT 2,SPEED=300,TY=%TYDIL ;T02 Dial-up line 30CPS + ;258-6742 + TTDPRT 3,SPEED=300,TY=%TYDIL ;T03 Dial-up line 30CPS + ;258-6743 + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dial-up 1.2KB Vadic + ;258-7894 + TTDVT 5 ;T05 350 Waters x6037 + TTDDPT 6,TT=%TTLCL ;T06 9th flr near console + TTDLA36 7 ;T07 800D DECwriter + TTDVT 10 ;T10 3rd flr VT52 #833 + TTDPRT 11,SPEED=1200,TY=%TYDIL ;T11 Dial-up 1.2KB Vadic + ;258-6757 + TTDVT 12 ;T12 8th flr VT52 + TTDVT 13 ;T13 8th flr VT52 #433 + TTDVT 14 ;T14 8th flr VT52 + TTDVT 15 ;T15 8th flr VT52 + TTDVT 16 ;T16 3rd flr VT52 #517 + TTDVT 17 ;T17 3rd flr VT52 #256 + TTDVT 20 ;T20 3rd flr VT52 #342 + TTDVT 21 ;T21 3rd flr VT52 #1224 + TTDVT 22 ;T22 3rd flr VT52 #8462 + TTDVT 23 ;T23 3rd flr VT52 #8453 + TTDVT 24 ;T24 3rd flr VT52 #7559 + TTDVT 25 ;T25 3rd flr VT52 #8379 + TTDVT 26 ;T26 3rd flr VT52 #7320 + TTDVT 27 ;T27 3rd flr VT52 #8437 + TTDVT 30 ;T30 VT52 in Library + TTDVT 31 ;T31 5th flr VT52 + ;This is now plugged into the right-hand 4-prong in 512A. That is in + ;parallel with Ann Rubin (Liskov-Dennis's secretary), so she'd + ;need to be asked if someone wanted to do an - ahem - demo. + TTDPRT 32,SPEED=1200,TY=%TYDIL ;T32 Dial-up 1.2KB Vadic + ;258-6733 + TTDC100 33 ;T33 317 Burke x3546 +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DM,{ ;;; DM + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 930 x2910 CPU + TTDLPT 1 ;T01 215 ODEC LPT + TTDVT 2 ;T02 205 x1440 Lebling + TTDVT 3 ;T03 219 x1450 Vezza + TTDVT 4 ;T04 203 x1429 Sangal + TTDVT 5 ;T05 214A x1410 Apollo Room + TTDIML 6 ;T06 [not in use] + TTDPRT 7 ;T07 214A x1410 APOLLO + TTDVT 10 ;T10 204 x1418 Galley + TTDVT 11 ;T11 801/A x6025/4 Faris/Meyer + TTDVT 12 ;T12 218 x7706 Venckus + TTDVT 13 ;T13 222 x5800 Niamir + TTDPRT 14,SPEED=110,TT=%TTLCL ;T14 [not in use] + TTDIML 15 ;T15 [not in use] + TTDVT 16 ;T16 209 x1430 Ilson + TTDIML 17 ;T17 [not in use] + TTDVT 20 ;T20 218A x7705 Licklider + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MX,{ ;;; MX + TTDLA36 0,TT=%TTLCL,HOR=110. ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL+%TYMDM ;T01 Vadic Dialup + ;253-6045 + TTDVT 2,SPEED=9600 ;T02 TRANTOR Math Dept 2-366 x3-6598 + TTDPRT 3,TY=%TYDIL+%TYMDM ;T03 Dialup + TTDPRT 4,TY=%TYDIL+%TYMDM ;T04 Dialup + ;253-7985 + TTDPRT 5,TY=%TYDIL+%TYMDM ;T05 Dialup + ;253-7986 + TTDPRT 6,TY=%TYDIL+%TYMDM ;T06 Dialup + ;253-7987 + TTDPRT 7,TY=%TYDIL+%TYMDM ;T07 Dialup + ;253-7988 + TTDPRT 10,TY=%TYDIL+%TYMDM ;T10 Vadic Dialup + ;253-6985 + TTDPRT 11,TY=%TYDIL+%TYMDM ;T11 Vadic Dialup + ;253-6986 + TTDPRT 12,TY=%TYDIL+%TYMDM ;T12 Vadic Dialup + ;253-6987 + TTDPRT 13,TY=%TYDIL+%TYMDM ;T13 Vadic Dialup + ;253-6988 + TTDPRT 14,TY=%TYDIL+%TYMDM ;T14 Vadic Dialup + ;253-6989 + TTDPRT 15,TY=%TYDIL+%TYMDM ;T15 Vadic Dialup + ;253-6990 + TTDPRT 16,TY=%TYDIL+%TYMDM ;T16 Vadic Dialup + ;Draper Lab + TTDPRT 17,TY=%TYDIL+%TYMDM ;T17 Vadic Dialup + TTDDPT 20 ;T20 not connected + TTDPRT 21,TY=%TYRLM,SPEED=9600 ;T21 ROLM Data Feature + ; #4997 + TTDPRT 22,TY=%TYRLM,SPEED=9600 ;T22 ROLM Data Feature + ; #4996 + TTDPRT 23,TY=%TYRLM,SPEED=9600 ;T23 ROLM Data Feature + ; #4601 + TTDPRT 24,TY=%TYRLM,SPEED=9600 ;T24 ROLM Data Feature + ; #4999 + TTDPRT 25,TY=%TYRLM,SPEED=9600 ;T25 ROLM Data Feature + TTDPRT 26,TY=%TYRLM,SPEED=9600 ;T26 ROLM Data Feature + ; #4603 + TTDPRT 27,TY=%TYRLM,SPEED=9600 ;T27 ROLM Data Feature + TTDPRT 30,TY=%TYRLM,SPEED=9600 ;T30 ROLM Data Feature + TTDPRT 31,TY=%TYRLM,SPEED=9600 ;T31 ROLM Data Feature + ; #4991 + TTDPRT 32,TY=%TYRLM,SPEED=9600 ;T32 ROLM Data Feature + ; #4992 + TTDPRT 33,TY=%TYRLM,SPEED=9600 ;T33 ROLM Data Feature + TTDPRT 34,TY=%TYRLM,SPEED=9600 ;T34 ROLM Data Feature + TTDPRT 35,TY=%TYRLM,SPEED=9600 ;T35 ROLM Data Feature + TTDPRT 36,TY=%TYRLM,SPEED=9600 ;T36 ROLM Data Frobozz + ; #4990 + TTDPRT 37,TY=%TYRLM,SPEED=9600 ;T37 ROLM Data Feature + TTDPRT 40,TY=%TYRLM,SPEED=9600 ;T40 ROLM Data Feature + TTDPRT 41,TY=%TYRLM,SPEED=300 ;T41 ROLM slow + TTDPRT 42,TY=%TYRLM,SPEED=9600 ;T42 ROLM Data Feature + TTDVT 43,TT=%TTLCL ;T43 9th Floor VT52 + TTDPRT 44,SPEED=110,TT=%TTLCL ;T44 DC76 TTY +.ENDC ;} + +REPEAT NSTTYS,[ + TTDSTY \NFSTTY+.RPCNT +.ENDR ;] + +REPEAT N11TYS,[ + TTDTV \NF11TY+.RPCNT +.ENDR ;] + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AI,{ ;;; AI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,TY=%TYRLM,SPEED=9600 ;T01 ROLM Data Feature (line 4968) + TTDPRT 2,TY=%TYRLM,SPEED=9600 ;T02 ROLM Data Feature (line 4969) + TTDPRT 3,SPEED=2400,TY=%TYDIL ;T03 Dialup + ;258-7814 + TTDPRT 4,SPEED=2400,TY=%TYDIL ;T04 Dialup + ;258-7815 + TTDVT 5,SPEED=9600 ;T05 907 x1729 CENT + TTDVT 6,SPEED=9600,TT=%TTLCL ;T06 9th Floor VT52 by AI x6765 + TTDVT 7,SPEED=9600 ;T07 DZ Line 7 (VT52) + TTDAAA 10,SPEED=9600 ;T10 723 x8843 Alan, DPH + TTDAAA 11,SPEED=9600 ;T11 DZ Line 11 (AAA) + TTDAAA 12,SPEED=9600 ;T12 DZ Line 12 (AAA) + TTDAAA 13,SPEED=9600 ;T13 DZ Line 13 (AAA) + TTDAAA 14,SPEED=9600 ;T14 DZ Line 14 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MC,{ ;;; MC + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MC x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX ML,{ ;;; ML + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7832 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7833 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by ML x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MD,{ ;;; MD + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MD x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX SI,{ ;;; SI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + TTDPRT 11,SPEED=9600 ;T11 DZ Line 11 + TTDPRT 12,SPEED=9600 ;T12 DZ Line 12 + TTDPRT 13,SPEED=9600 ;T13 DZ Line 13 + TTDPRT 14,SPEED=9600 ;T14 DZ Line 14 + TTDPRT 15,SPEED=9600 ;T15 DZ Line 15 + TTDPRT 16,SPEED=9600 ;T16 DZ Line 16 + TTDPRT 17,SPEED=9600 ;T17 DZ Line 17 + TTDPRT 20,SPEED=9600 ;T20 DZ Line 20 + TTDPRT 21,SPEED=9600 ;T21 DZ Line 21 + TTDPRT 22,SPEED=9600 ;T22 DZ Line 22 + TTDPRT 23,SPEED=9600 ;T23 DZ Line 23 + TTDPRT 24,SPEED=9600 ;T24 DZ Line 24 + TTDPRT 25,SPEED=9600 ;T25 DZ Line 25 + TTDPRT 26,SPEED=9600 ;T26 DZ Line 26 + TTDPRT 27,SPEED=9600 ;T27 DZ Line 27 + TTDPRT 30,SPEED=9600 ;T30 DZ Line 30 + TTDPRT 31,SPEED=9600 ;T31 DZ Line 31 + TTDPRT 32,SPEED=9600 ;T32 DZ Line 32 + TTDPRT 33,SPEED=9600 ;T33 DZ Line 33 + TTDPRT 34,SPEED=9600 ;T34 DZ Line 34 + TTDPRT 35,SPEED=9600 ;T35 DZ Line 35 + TTDPRT 36,SPEED=9600 ;T36 DZ Line 36 + TTDPRT 37,SPEED=9600 ;T37 DZ Line 37 + TTDPRT 40,SPEED=9600 ;T40 DZ Line 40 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX FU,{ ;;; FU + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX PM,{ ;;; PM + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 (9600 baud) + TTDPRT 2,SPEED=9600 ;T02 (9600 baud) + TTDPRT 3,SPEED=1200,TY=%TYDIL ;T03 Dialup (1200 baud) + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dialup (1200 baud) + TTDPRT 5,SPEED=9600 ;T05 (9600 baud) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DX,{ ;;; DX + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=300 ;T01 DZ Line 1 (300 baud) + TTDPRT 2,SPEED=1200 ;T02 DZ Line 2 (1200 baud) + TTDPRT 3,SPEED=2400 ;T03 DZ Line 3 (2400 baud) + TTDPRT 4,SPEED=4800 ;T04 DZ Line 4 (4800 baud) + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} diff --git a/system/ttytyp.311 b/system/ttytyp.311 new file mode 100644 index 0000000..fd6f325 --- /dev/null +++ b/system/ttytyp.311 @@ -0,0 +1,420 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;THE MASTER COPY OF THIS FILE IS KEPT ON AI:SYSTEM;TTYTYP > +;DUPLICATES ARE KEPT ON OTHER ITS MACHINES BUT THEY SHOULD +;NEVER BE EDITED. IF YOU'RE NOT TOTALLY SURE OF WHAT YOU'RE DOING +;DON'T EDIT THIS FILE; ASK A HACKER FOR ASSISTANCE. + +;HOW TO DESCRIBE EACH TTY. IT ASSUMES THE FOLLOWING: +;EACH MACHINE MUST HAVE A BLOCK OF ENTRIES, WHICH STARTS WITH +;THREE SEMICOLONS, A SPACE , AND THE NAME OF THE MACHINE. +;THEN MUST COME EXACTLY ONE COMMENT PER TTY, STARTING WITH +;"TNM ". THERE MAY BE OTHER COMMENTS NOT STARTING WITH A "TNM ". +;THOSE OTHER COMMENTS WILL BE IGNORED BY "NAME". + +;THIS FILE IS ARRANGED SO THAT IT CAN BE ASSEMBLED BY EITHER MIDAS OR PALX +;THE FOLLOWING MACROS ARE USED IN THIS FILE +; +;SEPARATORS: +; MCONDX CONDITIONAL FOR WHICH MACHINE +; .ENDC TERMINATE ... +; + +;TERMINAL TYPES: +;FIRST ARGUMENT TO TTDXXX MACRO IS THE LINE NUMBER +;FOLLOWING THAT CAN BE SEVERAL OPTIONS, SELECTED BY THE FOLLOWING KEYWORD PARAMETERS: +;TT LH(TTYTYP) ADDED TO SPEED CODE +;TY RH(TTYTYP) ADDED TO CONTROLLER-SELECT BIT +;TO LH(TTYOPT) ADDED TO DEFAULT BITS FOR DEVICE +;TP RH(TTYOPT) ADDED TO PAD CODES, DEFAULT IS DEFAULT %TPORS AND %TPCBS +;TCT TCTYP DEFAULT IS APPROPRIATE FOR TERMINAL BEING DEFINED +;HOR SCREEN WIDTH DEFAULT .. +;VER SCREEN HEIGHT DEFAULT .. +;ROL LINES/GLITCH DEFAULT .. +;SPEED OUTPUT SPEED IN BAUDS DEFAULT IS APPROPRIATE.. +;ISPEED INPUT SPEED IN BAUDS (IF DIFFERENT) +;SOME TERMINAL TYPES DON'T ACCEPT SOME OF THESE OPTIONS WHICH WOULD BE MEANINGLESS. + +.XCREF TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED ;FOOL @ + +; TTDPRT PRINTING TERMINAL (SPEED=110 => TTY35). DEFAULT SPEED IS 300. +; TTDMRX MEMOREX 1240 +; TTDTRM TERMINET 1200 +; TTDLPT BRIGHT (OR ODEC OR GOULD) LINE PRINTER ON TTY LINE +; TTDLA36 LA 36 +; TTDIML IMLAC +; TTDVT VT-52 +; TTDH19 H19 +; TTDTEK TEKTRONIX +; TTDLSR LOSING DATAPOINT +; TTDDPT DATAPOINT +; TTDGT40 GT-40 +; TTD11 PDP-11 (LOOKS LIKE PRINTING TERMINAL) +; TTDRAN RANDOM TYPE, YOU BETTER SPECIFY EVERYTHING +; TTDTV PDP-11 TV "LINE" VIA TEN-11 INTERFACE +; TTDGRN PDP-11 TV (OR GRINNELL TV) ON NORMAL TTY LINE +; TTD2741 N,CODE 2741 CODE=0 => EBCDIC, CODE=1 => CORRESPONDENCE +; TTDSTY SOFTWARE PSEUDO-TTY +; TTDC100 CONCEPT-100 +; TTDAAA Ann Arbor Ambassador + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AIKA,{ ;;; AI-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console (9th) + TTDPRT 1,SPEED=150,TY=%TYDIL ;T01 Dialup 15CPS * + ; 8-7874 15CPS + TTDPRT 2,SPEED=110,TY=%TYDIL ;T02 Dialup 10CPS * + ; 258-8794 10CPS + TTDPRT 3,SPEED=110,TT=%TTLCL ;T03 XGP TTY (9TH) + TTDPRT 4,SPEED=110,TT=%TTLCL+%TT340+%TT3HP ;T04 PDP6 TTY (9th) + TTDPRT 5,SPEED=110,TT=%TTLCL ;T05 TTY Near LPT (9th) + TTDPRT 6,SPEED=150,TY=%TYDIL ;T06 Dialup 15CPS * + ; 258-8795 15CPS + TTDPRT 7,SPEED=110,TT=%TTLCL+%TT340 ;T07 Little Robot TTY (9th) + TTDPRT 10,SPEED=134 ;T10 Baudot AP * + ;NEXT 3 USED TO BE 2741S, BUT WERE FLUSHED + TTDPRT 11,SPEED=134 ;T11 TSTC (9th) * + TTDPRT 12,SPEED=134 ;T12 2741 (9th) * + TTDPRT 13,SPEED=134,TY=%TYDIL ;T13 2741 Dialup * + TTDPRT 14 ;T14 Unused * + TTDPRT 15,SPEED=300,TY=%TYDIL ;T15 Dialup 30CPS + TTDPRT 16,SPEED=300,TY=%TYDIL ;T16 Dialup 30CPS + TTDPRT 17,SPEED=300,TY=%TYDIL ;T17 Dialup 30CPS + TTDPRT 20,SPEED=300,TY=%TYDIL ;T20 Dialup 30CPS + TTDVT 21,SPEED=4800,TT=%TTLCL ;T21 814 x7881 Barton,Berwick,Brotsky,Sjoberg + TTDTRM 22,TT=%TTLCL ;T22 Terminet in 813 (Hewitt) + TTDVT 23,SPEED=4800,TT=%TTLCL ;T23 926 Under the Miro x6765 + TTDDPT 24,TT=%TTLCL+%TT340,HOR=71. ;T24 Datapoint Near XGP (9th) + TTDAAA 25,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T25 810 Marty, Toto, Kansas x7836 + TTDDPT 26 ;T26 Datapoint in 822 (Stansfield) + TTDAAA 27,TT=%TTLCL,SPEED=4800 ;T27 926 Under ee cummings x6765 + TTDTRM 30,ISPEED=150,TY=%TYDIL ;T30 Dialup 120/15 CPS + ; 258-6091 150 IN, 1200 OUT TERMINET + TTDAAA 31,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T31 936 Lisp Machine Factory x6703 + TTDTRM 32,ISPEED=150,TY=%TYDIL ;T32 Dialup 120/15 CPS + ; 258-6090 150 IN, 1200 OUT TERMINET + TTDAAA 33,SPEED=4800,TT=%TTLCL ;T33 336 Sobalvarro, Delatizky x5834 + TTDVT 34,SPEED=4800,TT=%TTLCL ;T34 908 Oro + TTDDTM 35,SPEED=4800 ;T35 Poggio, Ullman x5781 (Bldg E10) + TTDRAY 36,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T36 812 Attardi, Barber, Koton (x7891) + TTDRAY 37,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T37 939 Kornfeld x5835 + TTDGT40 40,VER=29.,HOR=68.,TO=-%TOOVR ;T40 Micro-Automation PDP-11 (9th) +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MLKA,{ ;;; ML-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL ;T01 Dial-up 1.2KB Vadic + ;258-6756 + TTDPRT 2,SPEED=300,TY=%TYDIL ;T02 Dial-up line 30CPS + ;258-6742 + TTDPRT 3,SPEED=300,TY=%TYDIL ;T03 Dial-up line 30CPS + ;258-6743 + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dial-up 1.2KB Vadic + ;258-7894 + TTDVT 5 ;T05 350 Waters x6037 + TTDDPT 6,TT=%TTLCL ;T06 9th flr near console + TTDLA36 7 ;T07 800D DECwriter + TTDVT 10 ;T10 3rd flr VT52 #833 + TTDPRT 11,SPEED=1200,TY=%TYDIL ;T11 Dial-up 1.2KB Vadic + ;258-6757 + TTDVT 12 ;T12 8th flr VT52 + TTDVT 13 ;T13 8th flr VT52 #433 + TTDVT 14 ;T14 8th flr VT52 + TTDVT 15 ;T15 8th flr VT52 + TTDVT 16 ;T16 3rd flr VT52 #517 + TTDVT 17 ;T17 3rd flr VT52 #256 + TTDVT 20 ;T20 3rd flr VT52 #342 + TTDVT 21 ;T21 3rd flr VT52 #1224 + TTDVT 22 ;T22 3rd flr VT52 #8462 + TTDVT 23 ;T23 3rd flr VT52 #8453 + TTDVT 24 ;T24 3rd flr VT52 #7559 + TTDVT 25 ;T25 3rd flr VT52 #8379 + TTDVT 26 ;T26 3rd flr VT52 #7320 + TTDVT 27 ;T27 3rd flr VT52 #8437 + TTDVT 30 ;T30 VT52 in Library + TTDVT 31 ;T31 5th flr VT52 + ;This is now plugged into the right-hand 4-prong in 512A. That is in + ;parallel with Ann Rubin (Liskov-Dennis's secretary), so she'd + ;need to be asked if someone wanted to do an - ahem - demo. + TTDPRT 32,SPEED=1200,TY=%TYDIL ;T32 Dial-up 1.2KB Vadic + ;258-6733 + TTDC100 33 ;T33 317 Burke x3546 +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DM,{ ;;; DM + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 930 x2910 CPU + TTDLPT 1 ;T01 215 ODEC LPT + TTDVT 2 ;T02 205 x1440 Lebling + TTDVT 3 ;T03 219 x1450 Vezza + TTDVT 4 ;T04 203 x1429 Sangal + TTDVT 5 ;T05 214A x1410 Apollo Room + TTDIML 6 ;T06 [not in use] + TTDPRT 7 ;T07 214A x1410 APOLLO + TTDVT 10 ;T10 204 x1418 Galley + TTDVT 11 ;T11 801/A x6025/4 Faris/Meyer + TTDVT 12 ;T12 218 x7706 Venckus + TTDVT 13 ;T13 222 x5800 Niamir + TTDPRT 14,SPEED=110,TT=%TTLCL ;T14 [not in use] + TTDIML 15 ;T15 [not in use] + TTDVT 16 ;T16 209 x1430 Ilson + TTDIML 17 ;T17 [not in use] + TTDVT 20 ;T20 218A x7705 Licklider + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MX,{ ;;; MX + TTDLA36 0,TT=%TTLCL,HOR=110. ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL+%TYMDM ;T01 Vadic Dialup + ;253-6045 + TTDVT 2,SPEED=9600 ;T02 TRANTOR Math Dept 2-366 x3-6598 + TTDPRT 3,TY=%TYDIL+%TYMDM ;T03 Dialup + TTDPRT 4,TY=%TYDIL+%TYMDM ;T04 Dialup + ;253-7985 + TTDPRT 5,TY=%TYDIL+%TYMDM ;T05 Dialup + ;253-7986 + TTDPRT 6,TY=%TYDIL+%TYMDM ;T06 Dialup + ;253-7987 + TTDPRT 7,TY=%TYDIL+%TYMDM ;T07 Dialup + ;253-7988 + TTDPRT 10,TY=%TYDIL+%TYMDM ;T10 Vadic Dialup + ;253-6985 + TTDPRT 11,TY=%TYDIL+%TYMDM ;T11 Vadic Dialup + ;253-6986 + TTDPRT 12,TY=%TYDIL+%TYMDM ;T12 Vadic Dialup + ;253-6987 + TTDPRT 13,TY=%TYDIL+%TYMDM ;T13 Vadic Dialup + ;253-6988 + TTDPRT 14,TY=%TYDIL+%TYMDM ;T14 Vadic Dialup + ;253-6989 + TTDPRT 15,TY=%TYDIL+%TYMDM ;T15 Vadic Dialup + ;253-6990 + TTDPRT 16,TY=%TYDIL+%TYMDM ;T16 Vadic Dialup + ;Draper Lab + TTDPRT 17,TY=%TYDIL+%TYMDM ;T17 Vadic Dialup + TTDDPT 20 ;T20 not connected + TTDPRT 21,TY=%TYRLM,SPEED=9600 ;T21 ROLM Data Feature + ; #4997 + TTDPRT 22,TY=%TYRLM,SPEED=9600 ;T22 ROLM Data Feature + ; #4996 + TTDPRT 23,TY=%TYRLM,SPEED=9600 ;T23 ROLM Data Feature + ; #4601 + TTDPRT 24,TY=%TYRLM,SPEED=9600 ;T24 ROLM Data Feature + ; #4999 + TTDPRT 25,TY=%TYRLM,SPEED=9600 ;T25 ROLM Data Feature + TTDPRT 26,TY=%TYRLM,SPEED=9600 ;T26 ROLM Data Feature + ; #4603 + TTDPRT 27,TY=%TYRLM,SPEED=9600 ;T27 ROLM Data Feature + TTDPRT 30,TY=%TYRLM,SPEED=9600 ;T30 ROLM Data Feature + TTDPRT 31,TY=%TYRLM,SPEED=9600 ;T31 ROLM Data Feature + ; #4991 + TTDPRT 32,TY=%TYRLM,SPEED=9600 ;T32 ROLM Data Feature + ; #4992 + TTDPRT 33,TY=%TYRLM,SPEED=9600 ;T33 ROLM Data Feature + TTDPRT 34,TY=%TYRLM,SPEED=9600 ;T34 ROLM Data Feature + TTDPRT 35,TY=%TYRLM,SPEED=9600 ;T35 ROLM Data Feature + TTDPRT 36,TY=%TYRLM,SPEED=9600 ;T36 ROLM Data Frobozz + ; #4990 + TTDPRT 37,TY=%TYRLM,SPEED=9600 ;T37 ROLM Data Feature + TTDPRT 40,TY=%TYRLM,SPEED=9600 ;T40 ROLM Data Feature + TTDPRT 41,TY=%TYRLM,SPEED=300 ;T41 ROLM slow + TTDPRT 42,TY=%TYRLM,SPEED=9600 ;T42 ROLM Data Feature + TTDVT 43,TT=%TTLCL ;T43 9th Floor VT52 + TTDPRT 44,SPEED=110,TT=%TTLCL ;T44 DC76 TTY +.ENDC ;} + +REPEAT NSTTYS,[ + TTDSTY \NFSTTY+.RPCNT +.ENDR ;] + +REPEAT N11TYS,[ + TTDTV \NF11TY+.RPCNT +.ENDR ;] + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AI,{ ;;; AI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,TY=%TYRLM,SPEED=9600 ;T01 ROLM Data Feature (line 4968) + TTDPRT 2,TY=%TYRLM,SPEED=9600 ;T02 ROLM Data Feature (line 4969) + TTDPRT 3,SPEED=2400,TY=%TYDIL ;T03 Dialup + ;258-7814 + TTDPRT 4,SPEED=2400,TY=%TYDIL ;T04 Dialup + ;258-7815 + TTDVT 5,SPEED=9600 ;T05 907 x1729 CENT + TTDVT 6,SPEED=9600,TT=%TTLCL ;T06 9th Floor VT52 by AI x6765 + TTDVT 7,SPEED=9600 ;T07 DZ Line 7 (VT52) + TTDAAA 10,SPEED=9600 ;T10 723 x8843 Alan, DPH + TTDAAA 11,SPEED=9600 ;T11 DZ Line 11 (AAA) + TTDAAA 12,SPEED=9600 ;T12 DZ Line 12 (AAA) + TTDAAA 13,SPEED=9600 ;T13 DZ Line 13 (AAA) + TTDAAA 14,SPEED=9600 ;T14 DZ Line 14 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MC,{ ;;; MC + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7585 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7586 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MC x6765 + TTDPRT 4,SPEED=9600 ;T02 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T03 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T04 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX ML,{ ;;; ML + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7832 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7833 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by ML x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MD,{ ;;; MD + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MD x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX SI,{ ;;; SI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + TTDPRT 11,SPEED=9600 ;T11 DZ Line 11 + TTDPRT 12,SPEED=9600 ;T12 DZ Line 12 + TTDPRT 13,SPEED=9600 ;T13 DZ Line 13 + TTDPRT 14,SPEED=9600 ;T14 DZ Line 14 + TTDPRT 15,SPEED=9600 ;T15 DZ Line 15 + TTDPRT 16,SPEED=9600 ;T16 DZ Line 16 + TTDPRT 17,SPEED=9600 ;T17 DZ Line 17 + TTDPRT 20,SPEED=9600 ;T20 DZ Line 20 + TTDPRT 21,SPEED=9600 ;T21 DZ Line 21 + TTDPRT 22,SPEED=9600 ;T22 DZ Line 22 + TTDPRT 23,SPEED=9600 ;T23 DZ Line 23 + TTDPRT 24,SPEED=9600 ;T24 DZ Line 24 + TTDPRT 25,SPEED=9600 ;T25 DZ Line 25 + TTDPRT 26,SPEED=9600 ;T26 DZ Line 26 + TTDPRT 27,SPEED=9600 ;T27 DZ Line 27 + TTDPRT 30,SPEED=9600 ;T30 DZ Line 30 + TTDPRT 31,SPEED=9600 ;T31 DZ Line 31 + TTDPRT 32,SPEED=9600 ;T32 DZ Line 32 + TTDPRT 33,SPEED=9600 ;T33 DZ Line 33 + TTDPRT 34,SPEED=9600 ;T34 DZ Line 34 + TTDPRT 35,SPEED=9600 ;T35 DZ Line 35 + TTDPRT 36,SPEED=9600 ;T36 DZ Line 36 + TTDPRT 37,SPEED=9600 ;T37 DZ Line 37 + TTDPRT 40,SPEED=9600 ;T40 DZ Line 40 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX FU,{ ;;; FU + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX PM,{ ;;; PM + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 (9600 baud) + TTDPRT 2,SPEED=9600 ;T02 (9600 baud) + TTDPRT 3,SPEED=1200,TY=%TYDIL ;T03 Dialup (1200 baud) + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dialup (1200 baud) + TTDPRT 5,SPEED=9600 ;T05 (9600 baud) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DX,{ ;;; DX + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=300 ;T01 DZ Line 1 (300 baud) + TTDPRT 2,SPEED=1200 ;T02 DZ Line 2 (1200 baud) + TTDPRT 3,SPEED=2400 ;T03 DZ Line 3 (2400 baud) + TTDPRT 4,SPEED=4800 ;T04 DZ Line 4 (4800 baud) + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} diff --git a/system/ttytyp.312 b/system/ttytyp.312 new file mode 100644 index 0000000..c195b4d --- /dev/null +++ b/system/ttytyp.312 @@ -0,0 +1,420 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;THE MASTER COPY OF THIS FILE IS KEPT ON AI:SYSTEM;TTYTYP > +;DUPLICATES ARE KEPT ON OTHER ITS MACHINES BUT THEY SHOULD +;NEVER BE EDITED. IF YOU'RE NOT TOTALLY SURE OF WHAT YOU'RE DOING +;DON'T EDIT THIS FILE; ASK A HACKER FOR ASSISTANCE. + +;HOW TO DESCRIBE EACH TTY. IT ASSUMES THE FOLLOWING: +;EACH MACHINE MUST HAVE A BLOCK OF ENTRIES, WHICH STARTS WITH +;THREE SEMICOLONS, A SPACE , AND THE NAME OF THE MACHINE. +;THEN MUST COME EXACTLY ONE COMMENT PER TTY, STARTING WITH +;"TNM ". THERE MAY BE OTHER COMMENTS NOT STARTING WITH A "TNM ". +;THOSE OTHER COMMENTS WILL BE IGNORED BY "NAME". + +;THIS FILE IS ARRANGED SO THAT IT CAN BE ASSEMBLED BY EITHER MIDAS OR PALX +;THE FOLLOWING MACROS ARE USED IN THIS FILE +; +;SEPARATORS: +; MCONDX CONDITIONAL FOR WHICH MACHINE +; .ENDC TERMINATE ... +; + +;TERMINAL TYPES: +;FIRST ARGUMENT TO TTDXXX MACRO IS THE LINE NUMBER +;FOLLOWING THAT CAN BE SEVERAL OPTIONS, SELECTED BY THE FOLLOWING KEYWORD PARAMETERS: +;TT LH(TTYTYP) ADDED TO SPEED CODE +;TY RH(TTYTYP) ADDED TO CONTROLLER-SELECT BIT +;TO LH(TTYOPT) ADDED TO DEFAULT BITS FOR DEVICE +;TP RH(TTYOPT) ADDED TO PAD CODES, DEFAULT IS DEFAULT %TPORS AND %TPCBS +;TCT TCTYP DEFAULT IS APPROPRIATE FOR TERMINAL BEING DEFINED +;HOR SCREEN WIDTH DEFAULT .. +;VER SCREEN HEIGHT DEFAULT .. +;ROL LINES/GLITCH DEFAULT .. +;SPEED OUTPUT SPEED IN BAUDS DEFAULT IS APPROPRIATE.. +;ISPEED INPUT SPEED IN BAUDS (IF DIFFERENT) +;SOME TERMINAL TYPES DON'T ACCEPT SOME OF THESE OPTIONS WHICH WOULD BE MEANINGLESS. + +.XCREF TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED ;FOOL @ + +; TTDPRT PRINTING TERMINAL (SPEED=110 => TTY35). DEFAULT SPEED IS 300. +; TTDMRX MEMOREX 1240 +; TTDTRM TERMINET 1200 +; TTDLPT BRIGHT (OR ODEC OR GOULD) LINE PRINTER ON TTY LINE +; TTDLA36 LA 36 +; TTDIML IMLAC +; TTDVT VT-52 +; TTDH19 H19 +; TTDTEK TEKTRONIX +; TTDLSR LOSING DATAPOINT +; TTDDPT DATAPOINT +; TTDGT40 GT-40 +; TTD11 PDP-11 (LOOKS LIKE PRINTING TERMINAL) +; TTDRAN RANDOM TYPE, YOU BETTER SPECIFY EVERYTHING +; TTDTV PDP-11 TV "LINE" VIA TEN-11 INTERFACE +; TTDGRN PDP-11 TV (OR GRINNELL TV) ON NORMAL TTY LINE +; TTD2741 N,CODE 2741 CODE=0 => EBCDIC, CODE=1 => CORRESPONDENCE +; TTDSTY SOFTWARE PSEUDO-TTY +; TTDC100 CONCEPT-100 +; TTDAAA Ann Arbor Ambassador + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AIKA,{ ;;; AI-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console (9th) + TTDPRT 1,SPEED=150,TY=%TYDIL ;T01 Dialup 15CPS * + ; 8-7874 15CPS + TTDPRT 2,SPEED=110,TY=%TYDIL ;T02 Dialup 10CPS * + ; 258-8794 10CPS + TTDPRT 3,SPEED=110,TT=%TTLCL ;T03 XGP TTY (9TH) + TTDPRT 4,SPEED=110,TT=%TTLCL+%TT340+%TT3HP ;T04 PDP6 TTY (9th) + TTDPRT 5,SPEED=110,TT=%TTLCL ;T05 TTY Near LPT (9th) + TTDPRT 6,SPEED=150,TY=%TYDIL ;T06 Dialup 15CPS * + ; 258-8795 15CPS + TTDPRT 7,SPEED=110,TT=%TTLCL+%TT340 ;T07 Little Robot TTY (9th) + TTDPRT 10,SPEED=134 ;T10 Baudot AP * + ;NEXT 3 USED TO BE 2741S, BUT WERE FLUSHED + TTDPRT 11,SPEED=134 ;T11 TSTC (9th) * + TTDPRT 12,SPEED=134 ;T12 2741 (9th) * + TTDPRT 13,SPEED=134,TY=%TYDIL ;T13 2741 Dialup * + TTDPRT 14 ;T14 Unused * + TTDPRT 15,SPEED=300,TY=%TYDIL ;T15 Dialup 30CPS + TTDPRT 16,SPEED=300,TY=%TYDIL ;T16 Dialup 30CPS + TTDPRT 17,SPEED=300,TY=%TYDIL ;T17 Dialup 30CPS + TTDPRT 20,SPEED=300,TY=%TYDIL ;T20 Dialup 30CPS + TTDVT 21,SPEED=4800,TT=%TTLCL ;T21 814 x7881 Barton,Berwick,Brotsky,Sjoberg + TTDTRM 22,TT=%TTLCL ;T22 Terminet in 813 (Hewitt) + TTDVT 23,SPEED=4800,TT=%TTLCL ;T23 926 Under the Miro x6765 + TTDDPT 24,TT=%TTLCL+%TT340,HOR=71. ;T24 Datapoint Near XGP (9th) + TTDAAA 25,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T25 810 Marty, Toto, Kansas x7836 + TTDDPT 26 ;T26 Datapoint in 822 (Stansfield) + TTDAAA 27,TT=%TTLCL,SPEED=4800 ;T27 926 Under ee cummings x6765 + TTDTRM 30,ISPEED=150,TY=%TYDIL ;T30 Dialup 120/15 CPS + ; 258-6091 150 IN, 1200 OUT TERMINET + TTDAAA 31,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T31 936 Lisp Machine Factory x6703 + TTDTRM 32,ISPEED=150,TY=%TYDIL ;T32 Dialup 120/15 CPS + ; 258-6090 150 IN, 1200 OUT TERMINET + TTDAAA 33,SPEED=4800,TT=%TTLCL ;T33 336 Sobalvarro, Delatizky x5834 + TTDVT 34,SPEED=4800,TT=%TTLCL ;T34 908 Oro + TTDDTM 35,SPEED=4800 ;T35 Poggio, Ullman x5781 (Bldg E10) + TTDRAY 36,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T36 812 Attardi, Barber, Koton (x7891) + TTDRAY 37,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T37 939 Kornfeld x5835 + TTDGT40 40,VER=29.,HOR=68.,TO=-%TOOVR ;T40 Micro-Automation PDP-11 (9th) +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MLKA,{ ;;; ML-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL ;T01 Dial-up 1.2KB Vadic + ;258-6756 + TTDPRT 2,SPEED=300,TY=%TYDIL ;T02 Dial-up line 30CPS + ;258-6742 + TTDPRT 3,SPEED=300,TY=%TYDIL ;T03 Dial-up line 30CPS + ;258-6743 + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dial-up 1.2KB Vadic + ;258-7894 + TTDVT 5 ;T05 350 Waters x6037 + TTDDPT 6,TT=%TTLCL ;T06 9th flr near console + TTDLA36 7 ;T07 800D DECwriter + TTDVT 10 ;T10 3rd flr VT52 #833 + TTDPRT 11,SPEED=1200,TY=%TYDIL ;T11 Dial-up 1.2KB Vadic + ;258-6757 + TTDVT 12 ;T12 8th flr VT52 + TTDVT 13 ;T13 8th flr VT52 #433 + TTDVT 14 ;T14 8th flr VT52 + TTDVT 15 ;T15 8th flr VT52 + TTDVT 16 ;T16 3rd flr VT52 #517 + TTDVT 17 ;T17 3rd flr VT52 #256 + TTDVT 20 ;T20 3rd flr VT52 #342 + TTDVT 21 ;T21 3rd flr VT52 #1224 + TTDVT 22 ;T22 3rd flr VT52 #8462 + TTDVT 23 ;T23 3rd flr VT52 #8453 + TTDVT 24 ;T24 3rd flr VT52 #7559 + TTDVT 25 ;T25 3rd flr VT52 #8379 + TTDVT 26 ;T26 3rd flr VT52 #7320 + TTDVT 27 ;T27 3rd flr VT52 #8437 + TTDVT 30 ;T30 VT52 in Library + TTDVT 31 ;T31 5th flr VT52 + ;This is now plugged into the right-hand 4-prong in 512A. That is in + ;parallel with Ann Rubin (Liskov-Dennis's secretary), so she'd + ;need to be asked if someone wanted to do an - ahem - demo. + TTDPRT 32,SPEED=1200,TY=%TYDIL ;T32 Dial-up 1.2KB Vadic + ;258-6733 + TTDC100 33 ;T33 317 Burke x3546 +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DM,{ ;;; DM + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 930 x2910 CPU + TTDLPT 1 ;T01 215 ODEC LPT + TTDVT 2 ;T02 205 x1440 Lebling + TTDVT 3 ;T03 219 x1450 Vezza + TTDVT 4 ;T04 203 x1429 Sangal + TTDVT 5 ;T05 214A x1410 Apollo Room + TTDIML 6 ;T06 [not in use] + TTDPRT 7 ;T07 214A x1410 APOLLO + TTDVT 10 ;T10 204 x1418 Galley + TTDVT 11 ;T11 801/A x6025/4 Faris/Meyer + TTDVT 12 ;T12 218 x7706 Venckus + TTDVT 13 ;T13 222 x5800 Niamir + TTDPRT 14,SPEED=110,TT=%TTLCL ;T14 [not in use] + TTDIML 15 ;T15 [not in use] + TTDVT 16 ;T16 209 x1430 Ilson + TTDIML 17 ;T17 [not in use] + TTDVT 20 ;T20 218A x7705 Licklider + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MX,{ ;;; MX + TTDLA36 0,TT=%TTLCL,HOR=110. ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL+%TYMDM ;T01 Vadic Dialup + ;253-6045 + TTDVT 2,SPEED=9600 ;T02 TRANTOR Math Dept 2-366 x3-6598 + TTDPRT 3,TY=%TYDIL+%TYMDM ;T03 Dialup + TTDPRT 4,TY=%TYDIL+%TYMDM ;T04 Dialup + ;253-7985 + TTDPRT 5,TY=%TYDIL+%TYMDM ;T05 Dialup + ;253-7986 + TTDPRT 6,TY=%TYDIL+%TYMDM ;T06 Dialup + ;253-7987 + TTDPRT 7,TY=%TYDIL+%TYMDM ;T07 Dialup + ;253-7988 + TTDPRT 10,TY=%TYDIL+%TYMDM ;T10 Vadic Dialup + ;253-6985 + TTDPRT 11,TY=%TYDIL+%TYMDM ;T11 Vadic Dialup + ;253-6986 + TTDPRT 12,TY=%TYDIL+%TYMDM ;T12 Vadic Dialup + ;253-6987 + TTDPRT 13,TY=%TYDIL+%TYMDM ;T13 Vadic Dialup + ;253-6988 + TTDPRT 14,TY=%TYDIL+%TYMDM ;T14 Vadic Dialup + ;253-6989 + TTDPRT 15,TY=%TYDIL+%TYMDM ;T15 Vadic Dialup + ;253-6990 + TTDPRT 16,TY=%TYDIL+%TYMDM ;T16 Vadic Dialup + ;Draper Lab + TTDPRT 17,TY=%TYDIL+%TYMDM ;T17 Vadic Dialup + TTDDPT 20 ;T20 not connected + TTDPRT 21,TY=%TYRLM,SPEED=9600 ;T21 ROLM Data Feature + ; #4997 + TTDPRT 22,TY=%TYRLM,SPEED=9600 ;T22 ROLM Data Feature + ; #4996 + TTDPRT 23,TY=%TYRLM,SPEED=9600 ;T23 ROLM Data Feature + ; #4601 + TTDPRT 24,TY=%TYRLM,SPEED=9600 ;T24 ROLM Data Feature + ; #4999 + TTDPRT 25,TY=%TYRLM,SPEED=9600 ;T25 ROLM Data Feature + TTDPRT 26,TY=%TYRLM,SPEED=9600 ;T26 ROLM Data Feature + ; #4603 + TTDPRT 27,TY=%TYRLM,SPEED=9600 ;T27 ROLM Data Feature + TTDPRT 30,TY=%TYRLM,SPEED=9600 ;T30 ROLM Data Feature + TTDPRT 31,TY=%TYRLM,SPEED=9600 ;T31 ROLM Data Feature + ; #4991 + TTDPRT 32,TY=%TYRLM,SPEED=9600 ;T32 ROLM Data Feature + ; #4992 + TTDPRT 33,TY=%TYRLM,SPEED=9600 ;T33 ROLM Data Feature + TTDPRT 34,TY=%TYRLM,SPEED=9600 ;T34 ROLM Data Feature + TTDPRT 35,TY=%TYRLM,SPEED=9600 ;T35 ROLM Data Feature + TTDPRT 36,TY=%TYRLM,SPEED=9600 ;T36 ROLM Data Frobozz + ; #4990 + TTDPRT 37,TY=%TYRLM,SPEED=9600 ;T37 ROLM Data Feature + TTDPRT 40,TY=%TYRLM,SPEED=9600 ;T40 ROLM Data Feature + TTDPRT 41,TY=%TYRLM,SPEED=300 ;T41 ROLM slow + TTDPRT 42,TY=%TYRLM,SPEED=9600 ;T42 ROLM Data Feature + TTDVT 43,TT=%TTLCL ;T43 9th Floor VT52 + TTDPRT 44,SPEED=110,TT=%TTLCL ;T44 DC76 TTY +.ENDC ;} + +REPEAT NSTTYS,[ + TTDSTY \NFSTTY+.RPCNT +.ENDR ;] + +REPEAT N11TYS,[ + TTDTV \NF11TY+.RPCNT +.ENDR ;] + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AI,{ ;;; AI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,TY=%TYRLM,SPEED=9600 ;T01 ROLM Data Feature (line 4968) + TTDPRT 2,TY=%TYRLM,SPEED=9600 ;T02 ROLM Data Feature (line 4969) + TTDPRT 3,SPEED=2400,TY=%TYDIL ;T03 Dialup + ;258-7814 + TTDPRT 4,SPEED=2400,TY=%TYDIL ;T04 Dialup + ;258-7815 + TTDVT 5,SPEED=9600 ;T05 907 x1729 CENT + TTDVT 6,SPEED=9600,TT=%TTLCL ;T06 9th Floor VT52 by AI x6765 + TTDVT 7,SPEED=9600 ;T07 DZ Line 7 (VT52) + TTDAAA 10,SPEED=9600 ;T10 723 x8843 Alan, DPH + TTDAAA 11,SPEED=9600 ;T11 DZ Line 11 (AAA) + TTDAAA 12,SPEED=9600 ;T12 DZ Line 12 (AAA) + TTDAAA 13,SPEED=9600 ;T13 DZ Line 13 (AAA) + TTDAAA 14,SPEED=9600 ;T14 DZ Line 14 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MC,{ ;;; MC + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7585 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7586 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by MC x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX ML,{ ;;; ML + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7832 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7833 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by ML x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MD,{ ;;; MD + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MD x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX SI,{ ;;; SI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + TTDPRT 11,SPEED=9600 ;T11 DZ Line 11 + TTDPRT 12,SPEED=9600 ;T12 DZ Line 12 + TTDPRT 13,SPEED=9600 ;T13 DZ Line 13 + TTDPRT 14,SPEED=9600 ;T14 DZ Line 14 + TTDPRT 15,SPEED=9600 ;T15 DZ Line 15 + TTDPRT 16,SPEED=9600 ;T16 DZ Line 16 + TTDPRT 17,SPEED=9600 ;T17 DZ Line 17 + TTDPRT 20,SPEED=9600 ;T20 DZ Line 20 + TTDPRT 21,SPEED=9600 ;T21 DZ Line 21 + TTDPRT 22,SPEED=9600 ;T22 DZ Line 22 + TTDPRT 23,SPEED=9600 ;T23 DZ Line 23 + TTDPRT 24,SPEED=9600 ;T24 DZ Line 24 + TTDPRT 25,SPEED=9600 ;T25 DZ Line 25 + TTDPRT 26,SPEED=9600 ;T26 DZ Line 26 + TTDPRT 27,SPEED=9600 ;T27 DZ Line 27 + TTDPRT 30,SPEED=9600 ;T30 DZ Line 30 + TTDPRT 31,SPEED=9600 ;T31 DZ Line 31 + TTDPRT 32,SPEED=9600 ;T32 DZ Line 32 + TTDPRT 33,SPEED=9600 ;T33 DZ Line 33 + TTDPRT 34,SPEED=9600 ;T34 DZ Line 34 + TTDPRT 35,SPEED=9600 ;T35 DZ Line 35 + TTDPRT 36,SPEED=9600 ;T36 DZ Line 36 + TTDPRT 37,SPEED=9600 ;T37 DZ Line 37 + TTDPRT 40,SPEED=9600 ;T40 DZ Line 40 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX FU,{ ;;; FU + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX PM,{ ;;; PM + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 (9600 baud) + TTDPRT 2,SPEED=9600 ;T02 (9600 baud) + TTDPRT 3,SPEED=1200,TY=%TYDIL ;T03 Dialup (1200 baud) + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dialup (1200 baud) + TTDPRT 5,SPEED=9600 ;T05 (9600 baud) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DX,{ ;;; DX + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=300 ;T01 DZ Line 1 (300 baud) + TTDPRT 2,SPEED=1200 ;T02 DZ Line 2 (1200 baud) + TTDPRT 3,SPEED=2400 ;T03 DZ Line 3 (2400 baud) + TTDPRT 4,SPEED=4800 ;T04 DZ Line 4 (4800 baud) + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} diff --git a/system/ttytyp.313 b/system/ttytyp.313 new file mode 100644 index 0000000..4125630 --- /dev/null +++ b/system/ttytyp.313 @@ -0,0 +1,416 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;THE MASTER COPY OF THIS FILE IS KEPT ON AI:SYSTEM;TTYTYP > +;DUPLICATES ARE KEPT ON OTHER ITS MACHINES BUT THEY SHOULD +;NEVER BE EDITED. IF YOU'RE NOT TOTALLY SURE OF WHAT YOU'RE DOING +;DON'T EDIT THIS FILE; ASK A HACKER FOR ASSISTANCE. + +;HOW TO DESCRIBE EACH TTY. IT ASSUMES THE FOLLOWING: +;EACH MACHINE MUST HAVE A BLOCK OF ENTRIES, WHICH STARTS WITH +;THREE SEMICOLONS, A SPACE , AND THE NAME OF THE MACHINE. +;THEN MUST COME EXACTLY ONE COMMENT PER TTY, STARTING WITH +;"TNM ". THERE MAY BE OTHER COMMENTS NOT STARTING WITH A "TNM ". +;THOSE OTHER COMMENTS WILL BE IGNORED BY "NAME". + +;THIS FILE IS ARRANGED SO THAT IT CAN BE ASSEMBLED BY EITHER MIDAS OR PALX +;THE FOLLOWING MACROS ARE USED IN THIS FILE +; +;SEPARATORS: +; MCONDX CONDITIONAL FOR WHICH MACHINE +; .ENDC TERMINATE ... +; + +;TERMINAL TYPES: +;FIRST ARGUMENT TO TTDXXX MACRO IS THE LINE NUMBER +;FOLLOWING THAT CAN BE SEVERAL OPTIONS, SELECTED BY THE FOLLOWING KEYWORD PARAMETERS: +;TT LH(TTYTYP) ADDED TO SPEED CODE +;TY RH(TTYTYP) ADDED TO CONTROLLER-SELECT BIT +;TO LH(TTYOPT) ADDED TO DEFAULT BITS FOR DEVICE +;TP RH(TTYOPT) ADDED TO PAD CODES, DEFAULT IS DEFAULT %TPORS AND %TPCBS +;TCT TCTYP DEFAULT IS APPROPRIATE FOR TERMINAL BEING DEFINED +;HOR SCREEN WIDTH DEFAULT .. +;VER SCREEN HEIGHT DEFAULT .. +;ROL LINES/GLITCH DEFAULT .. +;SPEED OUTPUT SPEED IN BAUDS DEFAULT IS APPROPRIATE.. +;ISPEED INPUT SPEED IN BAUDS (IF DIFFERENT) +;SOME TERMINAL TYPES DON'T ACCEPT SOME OF THESE OPTIONS WHICH WOULD BE MEANINGLESS. + +.XCREF TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED ;FOOL @ + +; TTDPRT PRINTING TERMINAL (SPEED=110 => TTY35). DEFAULT SPEED IS 300. +; TTDMRX MEMOREX 1240 +; TTDTRM TERMINET 1200 +; TTDLPT BRIGHT (OR ODEC OR GOULD) LINE PRINTER ON TTY LINE +; TTDLA36 LA 36 +; TTDIML IMLAC +; TTDVT VT-52 +; TTDH19 H19 +; TTDTEK TEKTRONIX +; TTDLSR LOSING DATAPOINT +; TTDDPT DATAPOINT +; TTDGT40 GT-40 +; TTD11 PDP-11 (LOOKS LIKE PRINTING TERMINAL) +; TTDRAN RANDOM TYPE, YOU BETTER SPECIFY EVERYTHING +; TTDTV PDP-11 TV "LINE" VIA TEN-11 INTERFACE +; TTDGRN PDP-11 TV (OR GRINNELL TV) ON NORMAL TTY LINE +; TTD2741 N,CODE 2741 CODE=0 => EBCDIC, CODE=1 => CORRESPONDENCE +; TTDSTY SOFTWARE PSEUDO-TTY +; TTDC100 CONCEPT-100 +; TTDAAA Ann Arbor Ambassador + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AIKA,{ ;;; AI-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console (9th) + TTDPRT 1,SPEED=150,TY=%TYDIL ;T01 Dialup 15CPS * + ; 8-7874 15CPS + TTDPRT 2,SPEED=110,TY=%TYDIL ;T02 Dialup 10CPS * + ; 258-8794 10CPS + TTDPRT 3,SPEED=110,TT=%TTLCL ;T03 XGP TTY (9TH) + TTDPRT 4,SPEED=110,TT=%TTLCL+%TT340+%TT3HP ;T04 PDP6 TTY (9th) + TTDPRT 5,SPEED=110,TT=%TTLCL ;T05 TTY Near LPT (9th) + TTDPRT 6,SPEED=150,TY=%TYDIL ;T06 Dialup 15CPS * + ; 258-8795 15CPS + TTDPRT 7,SPEED=110,TT=%TTLCL+%TT340 ;T07 Little Robot TTY (9th) + TTDPRT 10,SPEED=134 ;T10 Baudot AP * + ;NEXT 3 USED TO BE 2741S, BUT WERE FLUSHED + TTDPRT 11,SPEED=134 ;T11 TSTC (9th) * + TTDPRT 12,SPEED=134 ;T12 2741 (9th) * + TTDPRT 13,SPEED=134,TY=%TYDIL ;T13 2741 Dialup * + TTDPRT 14 ;T14 Unused * + TTDPRT 15,SPEED=300,TY=%TYDIL ;T15 Dialup 30CPS + TTDPRT 16,SPEED=300,TY=%TYDIL ;T16 Dialup 30CPS + TTDPRT 17,SPEED=300,TY=%TYDIL ;T17 Dialup 30CPS + TTDPRT 20,SPEED=300,TY=%TYDIL ;T20 Dialup 30CPS + TTDVT 21,SPEED=4800,TT=%TTLCL ;T21 814 x7881 Barton,Berwick,Brotsky,Sjoberg + TTDTRM 22,TT=%TTLCL ;T22 Terminet in 813 (Hewitt) + TTDVT 23,SPEED=4800,TT=%TTLCL ;T23 926 Under the Miro x6765 + TTDDPT 24,TT=%TTLCL+%TT340,HOR=71. ;T24 Datapoint Near XGP (9th) + TTDAAA 25,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T25 810 Marty, Toto, Kansas x7836 + TTDDPT 26 ;T26 Datapoint in 822 (Stansfield) + TTDAAA 27,TT=%TTLCL,SPEED=4800 ;T27 926 Under ee cummings x6765 + TTDTRM 30,ISPEED=150,TY=%TYDIL ;T30 Dialup 120/15 CPS + ; 258-6091 150 IN, 1200 OUT TERMINET + TTDAAA 31,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T31 936 Lisp Machine Factory x6703 + TTDTRM 32,ISPEED=150,TY=%TYDIL ;T32 Dialup 120/15 CPS + ; 258-6090 150 IN, 1200 OUT TERMINET + TTDAAA 33,SPEED=4800,TT=%TTLCL ;T33 336 Sobalvarro, Delatizky x5834 + TTDVT 34,SPEED=4800,TT=%TTLCL ;T34 908 Oro + TTDDTM 35,SPEED=4800 ;T35 Poggio, Ullman x5781 (Bldg E10) + TTDRAY 36,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T36 812 Attardi, Barber, Koton (x7891) + TTDRAY 37,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T37 939 Kornfeld x5835 + TTDGT40 40,VER=29.,HOR=68.,TO=-%TOOVR ;T40 Micro-Automation PDP-11 (9th) +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MLKA,{ ;;; ML-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL ;T01 Dial-up 1.2KB Vadic + ;258-6756 + TTDPRT 2,SPEED=300,TY=%TYDIL ;T02 Dial-up line 30CPS + ;258-6742 + TTDPRT 3,SPEED=300,TY=%TYDIL ;T03 Dial-up line 30CPS + ;258-6743 + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dial-up 1.2KB Vadic + ;258-7894 + TTDVT 5 ;T05 350 Waters x6037 + TTDDPT 6,TT=%TTLCL ;T06 9th flr near console + TTDLA36 7 ;T07 800D DECwriter + TTDVT 10 ;T10 3rd flr VT52 #833 + TTDPRT 11,SPEED=1200,TY=%TYDIL ;T11 Dial-up 1.2KB Vadic + ;258-6757 + TTDVT 12 ;T12 8th flr VT52 + TTDVT 13 ;T13 8th flr VT52 #433 + TTDVT 14 ;T14 8th flr VT52 + TTDVT 15 ;T15 8th flr VT52 + TTDVT 16 ;T16 3rd flr VT52 #517 + TTDVT 17 ;T17 3rd flr VT52 #256 + TTDVT 20 ;T20 3rd flr VT52 #342 + TTDVT 21 ;T21 3rd flr VT52 #1224 + TTDVT 22 ;T22 3rd flr VT52 #8462 + TTDVT 23 ;T23 3rd flr VT52 #8453 + TTDVT 24 ;T24 3rd flr VT52 #7559 + TTDVT 25 ;T25 3rd flr VT52 #8379 + TTDVT 26 ;T26 3rd flr VT52 #7320 + TTDVT 27 ;T27 3rd flr VT52 #8437 + TTDVT 30 ;T30 VT52 in Library + TTDVT 31 ;T31 5th flr VT52 + ;This is now plugged into the right-hand 4-prong in 512A. That is in + ;parallel with Ann Rubin (Liskov-Dennis's secretary), so she'd + ;need to be asked if someone wanted to do an - ahem - demo. + TTDPRT 32,SPEED=1200,TY=%TYDIL ;T32 Dial-up 1.2KB Vadic + ;258-6733 + TTDC100 33 ;T33 317 Burke x3546 +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DM,{ ;;; DM + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 930 x2910 CPU + TTDLPT 1 ;T01 215 ODEC LPT + TTDVT 2 ;T02 205 x1440 Lebling + TTDVT 3 ;T03 219 x1450 Vezza + TTDVT 4 ;T04 203 x1429 Sangal + TTDVT 5 ;T05 214A x1410 Apollo Room + TTDIML 6 ;T06 [not in use] + TTDPRT 7 ;T07 214A x1410 APOLLO + TTDVT 10 ;T10 204 x1418 Galley + TTDVT 11 ;T11 801/A x6025/4 Faris/Meyer + TTDVT 12 ;T12 218 x7706 Venckus + TTDVT 13 ;T13 222 x5800 Niamir + TTDPRT 14,SPEED=110,TT=%TTLCL ;T14 [not in use] + TTDIML 15 ;T15 [not in use] + TTDVT 16 ;T16 209 x1430 Ilson + TTDIML 17 ;T17 [not in use] + TTDVT 20 ;T20 218A x7705 Licklider + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MX,{ ;;; MX + TTDLA36 0,TT=%TTLCL,HOR=110. ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL+%TYMDM ;T01 Vadic Dialup + ;253-6045 + TTDVT 2,SPEED=9600 ;T02 TRANTOR Math Dept 2-366 x3-6598 + TTDPRT 3,TY=%TYDIL+%TYMDM ;T03 Dialup + TTDPRT 4,TY=%TYDIL+%TYMDM ;T04 Dialup + ;253-7985 + TTDPRT 5,TY=%TYDIL+%TYMDM ;T05 Dialup + ;253-7986 + TTDPRT 6,TY=%TYDIL+%TYMDM ;T06 Dialup + ;253-7987 + TTDPRT 7,TY=%TYDIL+%TYMDM ;T07 Dialup + ;253-7988 + TTDPRT 10,TY=%TYDIL+%TYMDM ;T10 Vadic Dialup + ;253-6985 + TTDPRT 11,TY=%TYDIL+%TYMDM ;T11 Vadic Dialup + ;253-6986 + TTDPRT 12,TY=%TYDIL+%TYMDM ;T12 Vadic Dialup + ;253-6987 + TTDPRT 13,TY=%TYDIL+%TYMDM ;T13 Vadic Dialup + ;253-6988 + TTDPRT 14,TY=%TYDIL+%TYMDM ;T14 Vadic Dialup + ;253-6989 + TTDPRT 15,TY=%TYDIL+%TYMDM ;T15 Vadic Dialup + ;253-6990 + TTDPRT 16,TY=%TYDIL+%TYMDM ;T16 Vadic Dialup + ;Draper Lab + TTDPRT 17,TY=%TYDIL+%TYMDM ;T17 Vadic Dialup + TTDDPT 20 ;T20 not connected + TTDPRT 21,TY=%TYRLM,SPEED=9600 ;T21 ROLM Data Feature + ; #4997 + TTDPRT 22,TY=%TYRLM,SPEED=9600 ;T22 ROLM Data Feature + ; #4996 + TTDPRT 23,TY=%TYRLM,SPEED=9600 ;T23 ROLM Data Feature + ; #4601 + TTDPRT 24,TY=%TYRLM,SPEED=9600 ;T24 ROLM Data Feature + ; #4999 + TTDPRT 25,TY=%TYRLM,SPEED=9600 ;T25 ROLM Data Feature + TTDPRT 26,TY=%TYRLM,SPEED=9600 ;T26 ROLM Data Feature + ; #4603 + TTDPRT 27,TY=%TYRLM,SPEED=9600 ;T27 ROLM Data Feature + TTDPRT 30,TY=%TYRLM,SPEED=9600 ;T30 ROLM Data Feature + TTDPRT 31,TY=%TYRLM,SPEED=9600 ;T31 ROLM Data Feature + ; #4991 + TTDPRT 32,TY=%TYRLM,SPEED=9600 ;T32 ROLM Data Feature + ; #4992 + TTDPRT 33,TY=%TYRLM,SPEED=9600 ;T33 ROLM Data Feature + TTDPRT 34,TY=%TYRLM,SPEED=9600 ;T34 ROLM Data Feature + TTDPRT 35,TY=%TYRLM,SPEED=9600 ;T35 ROLM Data Feature + TTDPRT 36,TY=%TYRLM,SPEED=9600 ;T36 ROLM Data Frobozz + ; #4990 + TTDPRT 37,TY=%TYRLM,SPEED=9600 ;T37 ROLM Data Feature + TTDPRT 40,TY=%TYRLM,SPEED=9600 ;T40 ROLM Data Feature + TTDPRT 41,TY=%TYRLM,SPEED=300 ;T41 ROLM slow + TTDPRT 42,TY=%TYRLM,SPEED=9600 ;T42 ROLM Data Feature + TTDVT 43,TT=%TTLCL ;T43 9th Floor VT52 + TTDPRT 44,SPEED=110,TT=%TTLCL ;T44 DC76 TTY +.ENDC ;} + +REPEAT NSTTYS,[ + TTDSTY \NFSTTY+.RPCNT +.ENDR ;] + +REPEAT N11TYS,[ + TTDTV \NF11TY+.RPCNT +.ENDR ;] + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AI,{ ;;; AI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=2400,TY=%TYDIL ;T03 Dialup + ;258-7814 + TTDPRT 4,SPEED=2400,TY=%TYDIL ;T04 Dialup + ;258-7815 + TTDVT 5,SPEED=9600 ;T05 DZ Line 5 (VT52) + TTDVT 6,SPEED=9600,TT=%TTLCL ;T06 9th Floor VT52 by AI x6765 + TTDVT 7,SPEED=9600 ;T07 DZ Line 7 (VT52) + TTDAAA 10,SPEED=9600 ;T10 DZ Line 8 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MC,{ ;;; MC + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7585 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7586 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by MC x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX ML,{ ;;; ML + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7832 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7833 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by ML x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MD,{ ;;; MD + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MD x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX SI,{ ;;; SI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + TTDPRT 11,SPEED=9600 ;T11 DZ Line 11 + TTDPRT 12,SPEED=9600 ;T12 DZ Line 12 + TTDPRT 13,SPEED=9600 ;T13 DZ Line 13 + TTDPRT 14,SPEED=9600 ;T14 DZ Line 14 + TTDPRT 15,SPEED=9600 ;T15 DZ Line 15 + TTDPRT 16,SPEED=9600 ;T16 DZ Line 16 + TTDPRT 17,SPEED=9600 ;T17 DZ Line 17 + TTDPRT 20,SPEED=9600 ;T20 DZ Line 20 + TTDPRT 21,SPEED=9600 ;T21 DZ Line 21 + TTDPRT 22,SPEED=9600 ;T22 DZ Line 22 + TTDPRT 23,SPEED=9600 ;T23 DZ Line 23 + TTDPRT 24,SPEED=9600 ;T24 DZ Line 24 + TTDPRT 25,SPEED=9600 ;T25 DZ Line 25 + TTDPRT 26,SPEED=9600 ;T26 DZ Line 26 + TTDPRT 27,SPEED=9600 ;T27 DZ Line 27 + TTDPRT 30,SPEED=9600 ;T30 DZ Line 30 + TTDPRT 31,SPEED=9600 ;T31 DZ Line 31 + TTDPRT 32,SPEED=9600 ;T32 DZ Line 32 + TTDPRT 33,SPEED=9600 ;T33 DZ Line 33 + TTDPRT 34,SPEED=9600 ;T34 DZ Line 34 + TTDPRT 35,SPEED=9600 ;T35 DZ Line 35 + TTDPRT 36,SPEED=9600 ;T36 DZ Line 36 + TTDPRT 37,SPEED=9600 ;T37 DZ Line 37 + TTDPRT 40,SPEED=9600 ;T40 DZ Line 40 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX FU,{ ;;; FU + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX PM,{ ;;; PM + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 (9600 baud) + TTDPRT 2,SPEED=9600 ;T02 (9600 baud) + TTDPRT 3,SPEED=1200,TY=%TYDIL ;T03 Dialup (1200 baud) + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dialup (1200 baud) + TTDPRT 5,SPEED=9600 ;T05 (9600 baud) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DX,{ ;;; DX + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=300 ;T01 DZ Line 1 (300 baud) + TTDPRT 2,SPEED=1200 ;T02 DZ Line 2 (1200 baud) + TTDPRT 3,SPEED=2400 ;T03 DZ Line 3 (2400 baud) + TTDPRT 4,SPEED=4800 ;T04 DZ Line 4 (4800 baud) + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} diff --git a/system/ttytyp.314 b/system/ttytyp.314 new file mode 100644 index 0000000..7ad9721 --- /dev/null +++ b/system/ttytyp.314 @@ -0,0 +1,416 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +;THE MASTER COPY OF THIS FILE IS KEPT ON AI:SYSTEM;TTYTYP > +;DUPLICATES ARE KEPT ON OTHER ITS MACHINES BUT THEY SHOULD +;NEVER BE EDITED. IF YOU'RE NOT TOTALLY SURE OF WHAT YOU'RE DOING +;DON'T EDIT THIS FILE; ASK A HACKER FOR ASSISTANCE. + +;HOW TO DESCRIBE EACH TTY. IT ASSUMES THE FOLLOWING: +;EACH MACHINE MUST HAVE A BLOCK OF ENTRIES, WHICH STARTS WITH +;THREE SEMICOLONS, A SPACE , AND THE NAME OF THE MACHINE. +;THEN MUST COME EXACTLY ONE COMMENT PER TTY, STARTING WITH +;"TNM ". THERE MAY BE OTHER COMMENTS NOT STARTING WITH A "TNM ". +;THOSE OTHER COMMENTS WILL BE IGNORED BY "NAME". + +;THIS FILE IS ARRANGED SO THAT IT CAN BE ASSEMBLED BY EITHER MIDAS OR PALX +;THE FOLLOWING MACROS ARE USED IN THIS FILE +; +;SEPARATORS: +; MCONDX CONDITIONAL FOR WHICH MACHINE +; .ENDC TERMINATE ... +; + +;TERMINAL TYPES: +;FIRST ARGUMENT TO TTDXXX MACRO IS THE LINE NUMBER +;FOLLOWING THAT CAN BE SEVERAL OPTIONS, SELECTED BY THE FOLLOWING KEYWORD PARAMETERS: +;TT LH(TTYTYP) ADDED TO SPEED CODE +;TY RH(TTYTYP) ADDED TO CONTROLLER-SELECT BIT +;TO LH(TTYOPT) ADDED TO DEFAULT BITS FOR DEVICE +;TP RH(TTYOPT) ADDED TO PAD CODES, DEFAULT IS DEFAULT %TPORS AND %TPCBS +;TCT TCTYP DEFAULT IS APPROPRIATE FOR TERMINAL BEING DEFINED +;HOR SCREEN WIDTH DEFAULT .. +;VER SCREEN HEIGHT DEFAULT .. +;ROL LINES/GLITCH DEFAULT .. +;SPEED OUTPUT SPEED IN BAUDS DEFAULT IS APPROPRIATE.. +;ISPEED INPUT SPEED IN BAUDS (IF DIFFERENT) +;SOME TERMINAL TYPES DON'T ACCEPT SOME OF THESE OPTIONS WHICH WOULD BE MEANINGLESS. + +.XCREF TT,TY,TO,TP,TCT,HOR,VER,ROL,SPEED,ISPEED ;FOOL @ + +; TTDPRT PRINTING TERMINAL (SPEED=110 => TTY35). DEFAULT SPEED IS 300. +; TTDMRX MEMOREX 1240 +; TTDTRM TERMINET 1200 +; TTDLPT BRIGHT (OR ODEC OR GOULD) LINE PRINTER ON TTY LINE +; TTDLA36 LA 36 +; TTDIML IMLAC +; TTDVT VT-52 +; TTDH19 H19 +; TTDTEK TEKTRONIX +; TTDLSR LOSING DATAPOINT +; TTDDPT DATAPOINT +; TTDGT40 GT-40 +; TTD11 PDP-11 (LOOKS LIKE PRINTING TERMINAL) +; TTDRAN RANDOM TYPE, YOU BETTER SPECIFY EVERYTHING +; TTDTV PDP-11 TV "LINE" VIA TEN-11 INTERFACE +; TTDGRN PDP-11 TV (OR GRINNELL TV) ON NORMAL TTY LINE +; TTD2741 N,CODE 2741 CODE=0 => EBCDIC, CODE=1 => CORRESPONDENCE +; TTDSTY SOFTWARE PSEUDO-TTY +; TTDC100 CONCEPT-100 +; TTDAAA Ann Arbor Ambassador + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AIKA,{ ;;; AI-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console (9th) + TTDPRT 1,SPEED=150,TY=%TYDIL ;T01 Dialup 15CPS * + ; 8-7874 15CPS + TTDPRT 2,SPEED=110,TY=%TYDIL ;T02 Dialup 10CPS * + ; 258-8794 10CPS + TTDPRT 3,SPEED=110,TT=%TTLCL ;T03 XGP TTY (9TH) + TTDPRT 4,SPEED=110,TT=%TTLCL+%TT340+%TT3HP ;T04 PDP6 TTY (9th) + TTDPRT 5,SPEED=110,TT=%TTLCL ;T05 TTY Near LPT (9th) + TTDPRT 6,SPEED=150,TY=%TYDIL ;T06 Dialup 15CPS * + ; 258-8795 15CPS + TTDPRT 7,SPEED=110,TT=%TTLCL+%TT340 ;T07 Little Robot TTY (9th) + TTDPRT 10,SPEED=134 ;T10 Baudot AP * + ;NEXT 3 USED TO BE 2741S, BUT WERE FLUSHED + TTDPRT 11,SPEED=134 ;T11 TSTC (9th) * + TTDPRT 12,SPEED=134 ;T12 2741 (9th) * + TTDPRT 13,SPEED=134,TY=%TYDIL ;T13 2741 Dialup * + TTDPRT 14 ;T14 Unused * + TTDPRT 15,SPEED=300,TY=%TYDIL ;T15 Dialup 30CPS + TTDPRT 16,SPEED=300,TY=%TYDIL ;T16 Dialup 30CPS + TTDPRT 17,SPEED=300,TY=%TYDIL ;T17 Dialup 30CPS + TTDPRT 20,SPEED=300,TY=%TYDIL ;T20 Dialup 30CPS + TTDVT 21,SPEED=4800,TT=%TTLCL ;T21 814 x7881 Barton,Berwick,Brotsky,Sjoberg + TTDTRM 22,TT=%TTLCL ;T22 Terminet in 813 (Hewitt) + TTDVT 23,SPEED=4800,TT=%TTLCL ;T23 926 Under the Miro x6765 + TTDDPT 24,TT=%TTLCL+%TT340,HOR=71. ;T24 Datapoint Near XGP (9th) + TTDAAA 25,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T25 810 Marty, Toto, Kansas x7836 + TTDDPT 26 ;T26 Datapoint in 822 (Stansfield) + TTDAAA 27,TT=%TTLCL,SPEED=4800 ;T27 926 Under ee cummings x6765 + TTDTRM 30,ISPEED=150,TY=%TYDIL ;T30 Dialup 120/15 CPS + ; 258-6091 150 IN, 1200 OUT TERMINET + TTDAAA 31,TT=%TTLCL,SPEED=4800,TP=%TPMTA ;T31 936 Lisp Machine Factory x6703 + TTDTRM 32,ISPEED=150,TY=%TYDIL ;T32 Dialup 120/15 CPS + ; 258-6090 150 IN, 1200 OUT TERMINET + TTDAAA 33,SPEED=4800,TT=%TTLCL ;T33 336 Sobalvarro, Delatizky x5834 + TTDVT 34,SPEED=4800,TT=%TTLCL ;T34 908 Oro + TTDDTM 35,SPEED=4800 ;T35 Poggio, Ullman x5781 (Bldg E10) + TTDRAY 36,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T36 812 Attardi, Barber, Koton (x7891) + TTDRAY 37,SPEED=4800,TP=%TPMTA,TT=%TTLCL ;T37 939 Kornfeld x5835 + TTDGT40 40,VER=29.,HOR=68.,TO=-%TOOVR ;T40 Micro-Automation PDP-11 (9th) +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MLKA,{ ;;; ML-KA + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL ;T01 Dial-up 1.2KB Vadic + ;258-6756 + TTDPRT 2,SPEED=300,TY=%TYDIL ;T02 Dial-up line 30CPS + ;258-6742 + TTDPRT 3,SPEED=300,TY=%TYDIL ;T03 Dial-up line 30CPS + ;258-6743 + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dial-up 1.2KB Vadic + ;258-7894 + TTDVT 5 ;T05 350 Waters x6037 + TTDDPT 6,TT=%TTLCL ;T06 9th flr near console + TTDLA36 7 ;T07 800D DECwriter + TTDVT 10 ;T10 3rd flr VT52 #833 + TTDPRT 11,SPEED=1200,TY=%TYDIL ;T11 Dial-up 1.2KB Vadic + ;258-6757 + TTDVT 12 ;T12 8th flr VT52 + TTDVT 13 ;T13 8th flr VT52 #433 + TTDVT 14 ;T14 8th flr VT52 + TTDVT 15 ;T15 8th flr VT52 + TTDVT 16 ;T16 3rd flr VT52 #517 + TTDVT 17 ;T17 3rd flr VT52 #256 + TTDVT 20 ;T20 3rd flr VT52 #342 + TTDVT 21 ;T21 3rd flr VT52 #1224 + TTDVT 22 ;T22 3rd flr VT52 #8462 + TTDVT 23 ;T23 3rd flr VT52 #8453 + TTDVT 24 ;T24 3rd flr VT52 #7559 + TTDVT 25 ;T25 3rd flr VT52 #8379 + TTDVT 26 ;T26 3rd flr VT52 #7320 + TTDVT 27 ;T27 3rd flr VT52 #8437 + TTDVT 30 ;T30 VT52 in Library + TTDVT 31 ;T31 5th flr VT52 + ;This is now plugged into the right-hand 4-prong in 512A. That is in + ;parallel with Ann Rubin (Liskov-Dennis's secretary), so she'd + ;need to be asked if someone wanted to do an - ahem - demo. + TTDPRT 32,SPEED=1200,TY=%TYDIL ;T32 Dial-up 1.2KB Vadic + ;258-6733 + TTDC100 33 ;T33 317 Burke x3546 +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DM,{ ;;; DM + TTDLA36 0,TT=%TTLCL,HOR=80.,SPEED=110 ;T00 930 x2910 CPU + TTDLPT 1 ;T01 215 ODEC LPT + TTDVT 2 ;T02 205 x1440 Lebling + TTDVT 3 ;T03 219 x1450 Vezza + TTDVT 4 ;T04 203 x1429 Sangal + TTDVT 5 ;T05 214A x1410 Apollo Room + TTDIML 6 ;T06 [not in use] + TTDPRT 7 ;T07 214A x1410 APOLLO + TTDVT 10 ;T10 204 x1418 Galley + TTDVT 11 ;T11 801/A x6025/4 Faris/Meyer + TTDVT 12 ;T12 218 x7706 Venckus + TTDVT 13 ;T13 222 x5800 Niamir + TTDPRT 14,SPEED=110,TT=%TTLCL ;T14 [not in use] + TTDIML 15 ;T15 [not in use] + TTDVT 16 ;T16 209 x1430 Ilson + TTDIML 17 ;T17 [not in use] + TTDVT 20 ;T20 218A x7705 Licklider + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MX,{ ;;; MX + TTDLA36 0,TT=%TTLCL,HOR=110. ;T00 System Console + TTDPRT 1,SPEED=1200,TY=%TYDIL+%TYMDM ;T01 Vadic Dialup + ;253-6045 + TTDVT 2,SPEED=9600 ;T02 TRANTOR Math Dept 2-366 x3-6598 + TTDPRT 3,TY=%TYDIL+%TYMDM ;T03 Dialup + TTDPRT 4,TY=%TYDIL+%TYMDM ;T04 Dialup + ;253-7985 + TTDPRT 5,TY=%TYDIL+%TYMDM ;T05 Dialup + ;253-7986 + TTDPRT 6,TY=%TYDIL+%TYMDM ;T06 Dialup + ;253-7987 + TTDPRT 7,TY=%TYDIL+%TYMDM ;T07 Dialup + ;253-7988 + TTDPRT 10,TY=%TYDIL+%TYMDM ;T10 Vadic Dialup + ;253-6985 + TTDPRT 11,TY=%TYDIL+%TYMDM ;T11 Vadic Dialup + ;253-6986 + TTDPRT 12,TY=%TYDIL+%TYMDM ;T12 Vadic Dialup + ;253-6987 + TTDPRT 13,TY=%TYDIL+%TYMDM ;T13 Vadic Dialup + ;253-6988 + TTDPRT 14,TY=%TYDIL+%TYMDM ;T14 Vadic Dialup + ;253-6989 + TTDPRT 15,TY=%TYDIL+%TYMDM ;T15 Vadic Dialup + ;253-6990 + TTDPRT 16,TY=%TYDIL+%TYMDM ;T16 Vadic Dialup + ;Draper Lab + TTDPRT 17,TY=%TYDIL+%TYMDM ;T17 Vadic Dialup + TTDDPT 20 ;T20 not connected + TTDPRT 21,TY=%TYRLM,SPEED=9600 ;T21 ROLM Data Feature + ; #4997 + TTDPRT 22,TY=%TYRLM,SPEED=9600 ;T22 ROLM Data Feature + ; #4996 + TTDPRT 23,TY=%TYRLM,SPEED=9600 ;T23 ROLM Data Feature + ; #4601 + TTDPRT 24,TY=%TYRLM,SPEED=9600 ;T24 ROLM Data Feature + ; #4999 + TTDPRT 25,TY=%TYRLM,SPEED=9600 ;T25 ROLM Data Feature + TTDPRT 26,TY=%TYRLM,SPEED=9600 ;T26 ROLM Data Feature + ; #4603 + TTDPRT 27,TY=%TYRLM,SPEED=9600 ;T27 ROLM Data Feature + TTDPRT 30,TY=%TYRLM,SPEED=9600 ;T30 ROLM Data Feature + TTDPRT 31,TY=%TYRLM,SPEED=9600 ;T31 ROLM Data Feature + ; #4991 + TTDPRT 32,TY=%TYRLM,SPEED=9600 ;T32 ROLM Data Feature + ; #4992 + TTDPRT 33,TY=%TYRLM,SPEED=9600 ;T33 ROLM Data Feature + TTDPRT 34,TY=%TYRLM,SPEED=9600 ;T34 ROLM Data Feature + TTDPRT 35,TY=%TYRLM,SPEED=9600 ;T35 ROLM Data Feature + TTDPRT 36,TY=%TYRLM,SPEED=9600 ;T36 ROLM Data Frobozz + ; #4990 + TTDPRT 37,TY=%TYRLM,SPEED=9600 ;T37 ROLM Data Feature + TTDPRT 40,TY=%TYRLM,SPEED=9600 ;T40 ROLM Data Feature + TTDPRT 41,TY=%TYRLM,SPEED=300 ;T41 ROLM slow + TTDPRT 42,TY=%TYRLM,SPEED=9600 ;T42 ROLM Data Feature + TTDVT 43,TT=%TTLCL ;T43 9th Floor VT52 + TTDPRT 44,SPEED=110,TT=%TTLCL ;T44 DC76 TTY +.ENDC ;} + +REPEAT NSTTYS,[ + TTDSTY \NFSTTY+.RPCNT +.ENDR ;] + +REPEAT N11TYS,[ + TTDTV \NF11TY+.RPCNT +.ENDR ;] + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX AI,{ ;;; AI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=1200 ;T01 Chronograph + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=2400,TY=%TYDIL ;T03 Dialup + ;258-7814 + TTDPRT 4,SPEED=2400,TY=%TYDIL ;T04 Dialup + ;258-7815 + TTDVT 5,SPEED=9600 ;T05 DZ Line 5 (VT52) + TTDVT 6,SPEED=9600,TT=%TTLCL ;T06 9th Floor VT52 by AI x6765 + TTDVT 7,SPEED=9600 ;T07 DZ Line 7 (VT52) + TTDAAA 10,SPEED=9600 ;T10 DZ Line 8 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MC,{ ;;; MC + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7585 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7586 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by MC x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX ML,{ ;;; ML + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=2400,TY=%TYDIL ;T01 Dialup + ;258-7832 + TTDPRT 2,SPEED=2400,TY=%TYDIL ;T02 Dialup + ;258-7833 + TTDVT 3,SPEED=9600,TT=%TTLCL ;T03 9th Floor VT52 by ML x6765 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDAAA 6,SPEED=9600 ;T06 DZ Line 6 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX MD,{ ;;; MD + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDVT 1,SPEED=9600,TT=%TTLCL ;T01 9th Floor VT52 by MD x6765 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDAAA 4,SPEED=9600 ;T04 DZ Line 4 (AAA) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX SI,{ ;;; SI + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + TTDPRT 11,SPEED=9600 ;T11 DZ Line 11 + TTDPRT 12,SPEED=9600 ;T12 DZ Line 12 + TTDPRT 13,SPEED=9600 ;T13 DZ Line 13 + TTDPRT 14,SPEED=9600 ;T14 DZ Line 14 + TTDPRT 15,SPEED=9600 ;T15 DZ Line 15 + TTDPRT 16,SPEED=9600 ;T16 DZ Line 16 + TTDPRT 17,SPEED=9600 ;T17 DZ Line 17 + TTDPRT 20,SPEED=9600 ;T20 DZ Line 20 + TTDPRT 21,SPEED=9600 ;T21 DZ Line 21 + TTDPRT 22,SPEED=9600 ;T22 DZ Line 22 + TTDPRT 23,SPEED=9600 ;T23 DZ Line 23 + TTDPRT 24,SPEED=9600 ;T24 DZ Line 24 + TTDPRT 25,SPEED=9600 ;T25 DZ Line 25 + TTDPRT 26,SPEED=9600 ;T26 DZ Line 26 + TTDPRT 27,SPEED=9600 ;T27 DZ Line 27 + TTDPRT 30,SPEED=9600 ;T30 DZ Line 30 + TTDPRT 31,SPEED=9600 ;T31 DZ Line 31 + TTDPRT 32,SPEED=9600 ;T32 DZ Line 32 + TTDPRT 33,SPEED=9600 ;T33 DZ Line 33 + TTDPRT 34,SPEED=9600 ;T34 DZ Line 34 + TTDPRT 35,SPEED=9600 ;T35 DZ Line 35 + TTDPRT 36,SPEED=9600 ;T36 DZ Line 36 + TTDPRT 37,SPEED=9600 ;T37 DZ Line 37 + TTDPRT 40,SPEED=9600 ;T40 DZ Line 40 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX FU,{ ;;; FU + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 DZ Line 1 + TTDPRT 2,SPEED=9600 ;T02 DZ Line 2 + TTDPRT 3,SPEED=9600 ;T03 DZ Line 3 + TTDPRT 4,SPEED=9600 ;T04 DZ Line 4 + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX PM,{ ;;; PM + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=9600 ;T01 (9600 baud) + TTDPRT 2,SPEED=9600 ;T02 (9600 baud) + TTDPRT 3,SPEED=1200,TY=%TYDIL ;T03 Dialup (1200 baud) + TTDPRT 4,SPEED=1200,TY=%TYDIL ;T04 Dialup (1200 baud) + TTDPRT 5,SPEED=9600 ;T05 (9600 baud) + +.ENDC ;} + +;NOTE: SEE COMMENT AT FRONT OF FILE FOR CONSTRAINTS ON THE COMMENTS +;THAT APPEAR ON THE FOLLOWING LINES. ALSO NOTE THAT LOWER CASE +;CHARACTERS MAY BE PRESENT IN THEM. + +MCONDX DX,{ ;;; DX + TTDLA36 0,SPEED=1200,HOR=132.,TT=%TTLCL ;T00 System Console + TTDPRT 1,SPEED=300 ;T01 DZ Line 1 (300 baud) + TTDPRT 2,SPEED=1200 ;T02 DZ Line 2 (1200 baud) + TTDPRT 3,SPEED=2400 ;T03 DZ Line 3 (2400 baud) + TTDPRT 4,SPEED=4800 ;T04 DZ Line 4 (4800 baud) + TTDPRT 5,SPEED=9600 ;T05 DZ Line 5 + TTDPRT 6,SPEED=9600 ;T06 DZ Line 6 + TTDPRT 7,SPEED=9600 ;T07 DZ Line 7 + TTDPRT 10,SPEED=9600 ;T10 DZ Line 10 + +.ENDC ;} diff --git a/system/tv.132 b/system/tv.132 new file mode 100644 index 0000000..c224eb2 --- /dev/null +++ b/system/tv.132 @@ -0,0 +1,6011 @@ +;-*-MIDAS-*- +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +.SBTTL MACROS AND CONDITIONAL ASSEMBLY + +;AI PDP-11 TV CONSOLE PROGRAM +; USER WHO-LINE VARIABLES CODE ADDED 7/28/75 BY GLS +; AUDIO SWITCH CODE REWRITTEN 7/12/76 BY ED +; TV IS PDP-11 NUMBER 0 TO THE 10-11 INTERFACE. +; ELEVATOR CODE 2/13/79 BY DANNY & HIC +; REGION-SCROLLING 11/3/79 MOON + +FONTSW==1 ;COMPILE FONTS +FONTMS==0 ;USE MACROS TO COMPILE FONTS + +;REGISTER ASSIGNMENTS + +A=%0 ;ASCII CHARACTER +B=%1 ;META BITS +C=%2 ;C, T, AND TT ARE TEMPORARIES +T=%3 +TT=%4 +U=%5 ;LINE EDITOR OR PAGE PRINTER +SP=%6 +PC=%7 + +.XCREF A,B,C,T,TT,U,SP,PC,...,.... + +.IIF E FONTSW,.TITLE TV NOFONTS + +.IF NE FONTSW +.TITLE TV +.IF NE FONTMS +.NLIST ;WE'RE ONLY INTERESTED IN FONTS +.IF1 +.PRINT /THIS ASSEMBLY WILL TAKE FOREVER! +/ +.ENDC ;.IF1 +.ENDC ;.IF NE FONTMS +.ENDC ;.IF NE FONTSW + +.MACRO PUSH A +.NLIST + MOV A,-(SP) +.LIST +.ENDM + +.MACRO POP A +.NLIST + MOV (SP)+,A +.LIST +.ENDM + +.MACRO REPORT TEXT,NUM +.NLIST +.IF2 +.LIST +.PRINT /TEXT'NUM +/ +.NLIST +.ENDC +.LIST +.ENDM + +.MACRO CHROFF +.NLIST + MOVB PS,-(SP) + MOVB #LKLVL,PS +.LIST +.ENDM + +.MACRO CHRON +.NLIST + MOVB (SP)+,PS +.LIST +.ENDM + +.MACRO BLKOFF A +.NLIST + INCB BLKSWT(A) +.LIST +.ENDM + +.MACRO BLKON A +.NLIST + DECB BLKSWT(A) + BGE .+4 + BPT +.LIST +.ENDM + +.MACRO TENWRD +.NLIST +.IIF NE .&3,.=<.&177774>+4 +.LIST +.ENDM + +.MACRO CHECK TAG,LENGTH +.NLIST +.IF NE .-- +.ERROR TAG WRONG LENGTH +.ENDC +.EVEN +.LIST +.ENDM + +.MACRO TYPOUT A +.NLIST + JSR PC,OUTSTR + .ASCIZ A + .EVEN +.LIST +.ENDM + +.MACRO DECTYPE NUM +.NLIST + MOV NUM,A + JSR PC,DECPNT +.LIST +.ENDM + +.MACRO OCTYPE NUM +.NLIST + MOV NUM,A + JSR PC,OCTPNT +.LIST +.ENDM + +.MACRO ZAPFLG FLAG +.NLIST +%COMPAT==0 + MOV PC,FLAG +%COMPAT==1 +.LIST +.ENDM + +.MACRO CONC A,B,C,D,E,F,G,H,I +A'B'C'D'E'F'G'H'I +.ENDM + +.IF NE 0 ;PROGRAM MAP: +0, TO PDLORG ;TRAP VECTORS +PDLORG, TO KBDBUF ;PUSH DOWN LIST +KBDBUF, TO GO ;KBD BUFFER +GO, TO XTAB ;PROGRAM +XTAB, TO FNTORG ;KEYBOARD TRANSLATION TABLE +FNTORG, TO VARORG ;FONT DEFINITION +VARORG, TO MISORG ;LINE EDITOR/PAGE PRINTER VARIABLES +MISORG, TO PATCH ;MISCELLANEOUS TABLES AND VARIABLES +PATCH, TO LEBUFS ;PATCH AREA +LEBUFS, TO RUGSA ;FREE STORAGE +.ENDC + +.SBTTL HOW IT WORKS +.REPT 0 +channel header pointer (location 40, read only) + + ADDRESS(channel header area) + ADDRESS(pointer area) + I/O version number + source file version number + 0 always 0 + INITED non-zero indicates PDP-11 is running ok(can be cleared by PDP-10) + 0 always 0 + GDOWN used as flag by PDP-10 to acknowledge clear of INITED +channel header area (aligned on PDP-10 word) + + KBD channel: + KBDFLG cleared by 10/set by 11 (chain of activated KBD buffers) + 0 allows PDP-10 to do SKIPN for activation test + DPY channel: (1 per console) + DPYCHN buffer assigned to channel, if zero then DPY channel is closed + DPYKBD .BYTE KBD#, DPY# (377 for either implies not assigned) + KBD flags: (1 per console) + ECOFLG Set by PDP-10. Next time DPYBUF is empty clear ECOFLG + and put flag on KBD ring to signal this condition + CHNCLS if -1, log this guy out!!!! + If non-negative, has keyboard number (377 if none). + WHO flags: (1 per console) + WHOLIN who line variables for this console + WHOUSR -1=>user who line, 0=>system who line + + +format of KBD buffer (aligned on PDP-10 word) + + KBDSTS negative=>-(data byte count), 0=>free + 0 + KBDRNG next KBD buffer associated with this KBD + KBDLST next buffer on activated list (0=>end of chain) + KBDCHN keyboard channel + 0 not used + KBDATA key board data area (1 PDP-11 word/character) + +format of DPY buffer (aligned on PDP-10 word) + (actually, this is the beginning of the "line editor vars" or "channel vars" block). + + DPY10B word PDP-10 is hacking (used only for initailization) + This always points at DPYATA for this buffer these days. + DPY11B word PDP-11 is hacking + 0 + DPYLGL last legal address in this buffer + DPYSIZ size of data area in bytes + 0 not used + DPYATA display data area (1 PDP-11 byte/character) + +format of pointer area (aligned on PDP-10 word) + + ADDRESS(system who line variables) + ADDRESS(PDP-10/PDP-11 communication area) + TENWHO -1=>PDP-10 should update who lines + TENWH1 pads TENWHO + SYMTAB BEGINNING OF TABLE OF SWITCHES WHICH 10 ACCESSES. + +Notes: + +1. All addresses and pointers are in PDP-11 address space. + +2. KBD buffers are ringed two per channel. While the PDP-10 is + emptying one, the PDP-11 can fill the other. + +3. There is only one DPY buffer per channel. When the buffer is filled + with negative ones, it is free. When the PDP-10 writes a character + in the current word: then the PDP-11 processes the data in that + word, sets that word to negative one, and advances to the next word. + (Formerly any negative number would do, but now that the byte size is + 8 rather than 16, -1 [377] must be used since valid characters > 200 exist.) + +WHO LINE VARIABLES + +SYSTEM WHO LINE (ALIGNED ON PDP-10 WORD) + ITSTDP # total # dpy's (read only for PDP-10) + ITSFDP # free dpys (read only for PDP-10) + ITSVER ITS version # + ITSJOB total jobs + ITSCOR total core + ITSRU runnable users + ITSWBJ # jobs swap blocked + ITSJWP # jobs waiting for pages + ITSTRC total runable core + ITSCFU core available for users + ITSDAT date [byte (7) year (4) month (5) day] + ITSDBG system debug flag + ITSTIM time of day (# half seconds since midnight) aligned on PDP-10 word + ITSTI1 low order of time + ITSUSR total number of users + ITSFSH fair share + +USER WHO LINE (ALIGNED ON PDP-10 WORD) + WHJOB job #, -1=>who line not in use + WHJOB1 if negative then clear who line + WHMODE mode 0=>follow keyboard + 1=>freeze + 2=>next higher (when PDP-10 sees this state, it searches + user variables for next higher job index number with same + uname. When it finds it, it stores the number in job # + and changes mode to 1 + 3=>next lower + WHMOD1 pads WHMODE + WHUNAM uname in sixbit (left 18 bits in first two words, right in next two) + WHUNM1 + WHUNM2 + WHUNM3 + WHJNAM jname in sixbit + WHJNM1 + WHJNM2 + WHJNM3 + WHSNAM sname in sixbit + WHSNM1 + WHSNM2 + WHSNM3 + WHSTAT status in sixbit, 0=>job does not exist + WHSTA1 + WHSTA2 + WHSTA3 + WHJ%RT job % run time + WHJTRT job total run time (in tenth's of seconds) + WHRPAG job real memory pages (swapped in) + WHTPAG job total pages + +NOTE: The PDP-11 will not update who lines until it sees that ITSTIM + has changed. + +PDP-10/PDP-11 COMMAND CHANNEL + + CMDFLG aligned on PDP-10 + 0=>buffer is free (PDP-10 can write CMDBUF) + positive=>command # from PDP-10 (PDP-11 can write CMDBUF) + negative=>affirmative reply from PDP-11 (0=>command failed) + PDP-10 can read CMDBUF, then must zero CMDFLG + CMDFL1 always 0 + CMDBUF each arg takes 4 bytes (1 PDP-10 word) + + PDP-10/PDP-11 COMMANDS + + 1 video switch + arg1: video switch input # (set by PDP-10) + arg2: video switch output # ( " " " " ) + + 2 reserve DPY + arg1: DPY reserved (set by PDP-11) + + 3 free DPY + arg1: DPY to free (set by PDP-10) + + 4 read video switch + arg1: < 0 for default setting, > 0 for current setting (set by PDP-10) + 1=>tty chnl, 2=>KBD, 3=>video switch output + arg2: # described by arg1 (set by PDP-10) + arg3: input (set by PDP-11) + arg4: input (set by PDP-11) + arg5: output(set by PDP-11) + + 5 audio switch + arg1: audio switch input # (set by PDP-10) + arg2: audio switch output # (set by PDP-10) + + 6 read audio switch (for this to be useful, 11 must maintain table, since + the audio switch is read-only. + arg1: < 0 for default setting, > 0 for current setting (set by PDP-10) + 1=>tty chnl, 2=>KBD, 3=>audio switch output + arg2: # described by arg1 (set by PDP-10) + arg3: input (set by PDP-11) + arg4: output(set by PDP-11) + +;other 10-11 commuincation issues .. + +;go down resetting video switch vs not +;PDP-11 indicates it has reset video switch + ;(PDP-10 then detaches all jobs with tv ttys) + +;console scroll register 6/23/74 + +CSA==157776 ;selects where video scan starts in video buffer + +__|_____|_____|_____|_____|_____| +15 1211 | +| 3 |1| 12 | +|_____|_|_______________________| + | | | + | | |----------------->scroll offset (start video scan at n*4 PDP-11 words from TVLO) + | | + | |------------------------------->black on white bit (1=>black on white) + | + |----------------------------------->not used + + + +;console register 6/24/74 + +CREG==164044 ;selects video buffer memory + +__|_____|_____|_____|_____|_____| +15 7 | +| 8 | 8 | +|_______________|_______________| + | | + | |-------------->console # (TVLO-TVHI on unibus is video bit map) + | + |------------------------------>ALU function + +video switch 4/17/74 + +VSW==164060 ;sets video switch + +__|_____|_____|_____|_____|_____| +15 12 10 7 3 | +| 3 | 2 | 3 | 4 | 4 | +|_____|___|_____|_______|_______| + | | | | | + | | | | |---------->video source + | | | | + | | | |------------------>not used + | | | + | | |------------------------->| |card section + | | |switch output| + | |------------------------------>| |card select + | + |----------------------------------->switch section number + + +audio switch 7/12/76 + +ASW==170670 ;SETS AUDIO SWITCH. (this is a write-only memory.) + +__|_____|_____|_____|_____|_____| +15 13 10 7 3 | +| 2 | 3 | 3 | 4 | 4 | +|___|_____|_____|_______|_______| + | | | | | + | | | | |---------->audio source + | | | | + | | | |------------------>not used + | | | + | | |------------------------->| |card section (complemented) + | | |switch output| + | |------------------------------->| |card select + | + |------------------------------------>not used + +ASWXOR==1617 ;complemented fields of ASW. + +keyboard multiplexor 3/15/74 + +KBDPC==340 ;interrupt vector +KBDLVL==5_7 ;interrupts on level 5 + +KMS==164050 ;keyboard status + +__|_____|_____|_____|_____|_____| +151413121110 9 8 7 6 5 4 1 | +|1|1|1|1|1|1|1|1|1|1|1| 3 | 2 | +|_|_|_|_|_|_|_|_|_|_|_|_____|___| + | | | | | | | | | | | | | + | | | | | | | | | | | | |------>KMA extension (bits 17 and 16) + | | | | | | | | | | | | + | | | | | | | | | | | |----------->not used + | | | | | | | | | | | + | | | | | | | | | | |--------------->interrupt enable + | | | | | | | | | | + | | | | | | | | | |----------------->direct memory access enable + | | | | | | | | | + | | | | | | | | |------------------->waiting to hack memory + | | | | | | | | + | | | | | | | |--------------------->8th floor elevator + | | | | | | |----------------------->9th floor elevator + | | | | | | + | | | | | |------------------------>extra OC output, pin BBF1. + | | | | | + | | | | |--------------------------->buzz the 9th floor door (dip relay) + | | | | + | | | |----------------------------->generate copy from second source(currently not + | | | enabled) + | | |------------------------------->generate copy from first source + | | + | |--------------------------------->ready line + | + |----------------------------------->waiting to interrupt + +KMA==165052 ;keyboard memory address register + +__|_____|_____|_____|_____|_____| +15 7 1 | +| 9 | 5 | 2 | +|_________________|_________|___| + | | | + | | |----->always 0 + | | + | |------------>binary counter (overflow lost) + | + |------------------------->buffer origin + +;keyboard multiplexor 3/15/74 +;format of data written into memory (each record is two words) + +;first word + +__|_____|_____|_____|_____|_____| +151413 11 9 7 5 | +|1|1| 2 | 2 | 2 | 2 | 6 | +|_|_|___|___|___|___|___________| + | | | | | | | + | | | | | | |--------->key struck + | | | | | | + | | | | | |----------------->shift (7-left, 6-right) + | | | | | + | | | | |--------------------->top (9-left, 8-right) + | | | | + | | | |------------------------->control (11-left, 10-right) + | | | + | | |----------------------------->meta (13-left, 12-right) + | | + | |-------------------------------->shift lock + | + |---------------------------------->always 1 + +;second word + +__|_____|_____|_____|_____|_____| +15 13 7 | +| 2 | 6 | 8 | +|___|___________|_______________| + | | | + | | |----------->high order bits of character (ignored) + | | + | |------------------------->console number + | + |--------------------------------->always 0 + +.ENDR + +;CHARACTER FORMAT WRITTEN BY KBD MULTIPLEXOR + +RCHAR==177700 ;6 BITS FOR KEY STRUCK +RSHBIT==300 ;SHIFT BITS +RTPBIT==1400 ;TOP BITS +RCLBIT==6000 ;CONTROL BITS +RMTBIT==30000 ;META BITS +RSLBIT==40000 ;SHIFT LOCK +RXTRA==100000 ;UNUSED BITS + +;XTAB BITS USED FOR XTAB LOOK UP + +XTPBIT==400 ;TOP +XSLBIT==200 ;SHIFT LOCK +XSHBIT==100 ;SHIFT + +;POSITION OF META BITS, ASCII COMPATIBLE + +ACTBIT==SNB ;CAUSES CHARACTER TO ACT AS ACTIVATOR +ACLBIT==200 ;CONTROL +AMTBIT==400 ;META +ASHBIT==XSHBIT_3 ;SHIFT +ASLBIT==XSLBIT_3 ;SHIFT LOCK +ATPBIT==XTPBIT_3 ;TOP +ACMBIT==AMTBIT+ACLBIT ;CONTROL AND META TOGETHER + +.SBTTL ASSIGNMENTS + +;GEOMETRY + +BITPL==1100 ;BITS PER LINE +NLINS==706 ;LINES ON SCREEN +BYTPL==BITPL/10 ;BYTES PER LINE +WRDPL==BYTPL/2 ;WORDS PER LINE + +CHRWD==6 ;CHARACTER WIDTH ON TEXT LINE +GRIDWD==5 ;WIDTH OF CHARACTER GRID +CHRHT==12 ;CHARACTER HEIGHT +CHRVSP==2 ;BLANK RASTER LINES BETWEEN CHARACTER LINES +LINHT==CHRHT+CHRVSP ;CHRACTER LINE HEIGHT +CHRPL==BITPL/CHRWD ;CHARACTERS PER LINE +CHRLN==NLINS/LINHT ;CHARACTER LINES ON SCREEN + +;MEMORY MAP + +NXMPC== 4 ;BUS ERROR VECTOR +NXMPSW== 6 +RESPC== 10 ;RESERVED INTRUCTION VECTOR +RESPSW== 12 +BPTPC== 14 ;BREAK POINT VECTOR +BPTPSW== 16 +IOTPC== 20 ;IOT VECTOR +IOTPSW== 22 +PWRPC== 24 ;POWER FAIL TRAP VECTOR +PWRPSW== 26 +EMTPC== 30 ;EMULATE TRAP VECTOR +EMTPSW== 32 +TRPPC== 34 ;TRAP INSTRUCTION VECTOR +TRPPSW== 36 +TYIPC== 60 ;TTY INPUT INTERRUPT VECTOR +TYIPSW== 62 +LKPC== 100 ;LINE CLOCK INTERRUPT VECTOR +LKPSW== 102 +KLIPC== 320 ;KL11 INPUT INTERRUPT VECTOR +KLIPSW==322 +KBDPC== 340 ;KEYBOARD MULTIPLEXOR INTERRUPT VECTOR +KBDPSW==342 + +PDLORG==400 ;ORIGIN OF PUSH DOWN LIST +TVLO=60000 ;ORIGIN OF DISPLAY MEMORY +TVFENCE=TVLO+ ;ADDR OF FIRST TEXT LINE THAT SHOULDN'T BE USED + ;(IT'S INCOMPLETE AND CONTAINS THE WHO-LINE). +TVCFENC=TVHI-> ;DON'T TRY TO DISPLAY A CHARACTER AFTER THIS POINT +TVHI=TVLO+-2 ;HIGHEST LEGAL DISPLAY ADDRESS +CSA=157776 ;DISPLAY REFRESH STARTING ADDRESS (STARTS AT 0) + +CREG== 164044 ;UNIBUS CONSOLE REGISTER ADDRESS +CALU== 164045 ;CONSOLE REGISTER LOGICAL FUNCTION ADDR +KMS== 164050 ;KEYBOARD MULTIPLEXOR STATUS +KMA== 164052 ;KEYBOARD MULTIPLEXOR MEMORY ADDRESS +VSW== 164060 ;VIDEO SWITCH +ASW== 170670 ;AUDIO SWITCH +KLIS== 174000 ;KL11 INPUT STATUS +KLIB== 174002 ;KL11 INPUT BUFFER +KLOS== 174004 ;KL11 OUTPUT STATUS +KLOB== 174006 ;KL11 OUTPUT BUFFER + +.EXPUNGE DIV,MUL,ASH ;THESE ARE PREDEFINED AS 11/45 INSTRUCTIONS. +DIV== 177300 ;EAE GOODIES +AC== 177302 +MQ== 177304 +MUL== 177306 +SC== 177310 +SR== 177311 +NOR== 177312 +LSH== 177314 +ASH== 177316 +LKS== 177546 ;LINE CLOCK STATUS +TKS== 177560 ;TTY KEYBOARD STATUS +TKB== 177562 ;TTY KEYBOARD BUFFER +TPS== 177564 ;TTY PRINTER STATUS +TPB== 177566 ;TTY PRINTER BUFFER +CSR== 177570 ;CONSOLE SWITCH REGISTER +PS== 177776 ;PROCESSOR STATUS REGISTER +...==0 +....==0 + +;TEN/11 COMMUNICATIONS AREA + +CHAP==40 ;CHANNEL HEADER AREA POINTER +POINTP==42 ;POINTER TO POINTER AREA +CIOVER==44 ;HOLDS I/O VERSION FOR PDP-10 TO LOOK AT +CVERSE==46 ;ASSEMBLY VERSION FOR PDP-10 + ;50 ;ALWAYS 0 +INITED==52 ;INITED FLAG, SET BY 11 CLEARED BY 10 + ;54 ;ALWAYS 0 +GDOWN==56 ;INTERLOCKS WITH INITED, CLEARED BY 11 SET BY 10 + +;CONSOLE REGISTER FUNCTIONS + +CSETC==0 +CNOR==1 +CANDC==2 +CSETZ==3 +CNAND==4 +CCOMP==5 +CXOR==6 +CANCSD==7 +CEQV==11 +CORCSD==10 +CSAME==12 +CAND==13 +CORSCD==13 +CSETO==14 +CIOR==16 +CSET==17 + +;INTERRUPT LEVELS + +KBDLVL==5_5 ;KEYBOARD MULTIPLEXOR INT. PRIORITY (BUT HANDLER RUNS AT LKLVL). +LKLVL==6_5 ;LINE CLOCK +ERRLVL==7_5 ;PROCESSOR ERRORS + +;MISCELLANEOUS ASSIGNMENTS + +IOVER==3 ;I/O VERSION FOR ITS +PDL==400 ;PUSH DOWN LIST SIZE +MAXKBD==64. ;MAXIMUM # OF KEYBOARDS +MAXTV==16. ;MAX NUMBER OF TV DISPLAYS +MAXBLK==MAXTV ;MAXIMUM # OF BLINKERS +MAXASI==20 ;AUDIO SWITCH INPUTS +MAXASO==100 ;AUDIO SWITCH OUTPUTS +ASWXOR==3400 ;XOR THIS INTO EACH CONTROL WORD TO BE SENT TO THE ASW. +MAXVSI==20 ;VIDEO SWITCH INPUTS +MAXVSO==40 ;VIDEO SWITCH OUTPUTS +VSWSEC==2 ;# VIDEO SWITCH SECTIONS +VSWINC==MAXVSO_10 ;INCREMENTS VIDEO SWITCH SECTION NUMBER +QPYVSW==27 ;VIDEO SWITCH OUTPUT FOR TEKTRONIX VIDEO HARD COPY UNIT +QPTIME==21.*60. ;21. SECONDS BETWEEN COPIES +QPYKMS==20000 ;GENERATE COPY FROM FIRST SOURCE (IN KEYBOARD STATUS, NATURALLY) +QPYKM2==10000 ;GENERATE COPY FROM SECOND SOURCE. +BUZKMS==4000 ;BUZZ DOOR (ALSO IN KEYBOARD STATUS) +BUZTIM==3*60. ;LEAVE THE DOOR BUZZING FOR 3 SECONDS +ELKMS8==1 ;8TH FLOOR ELEVATOR BIT, SWAPPED (IT LIVES IN BYTE 1 OR WORD) +ELKMS9==2 ;9TH FLOOR ELEVATOR BIT, SWAPPED. +ELEKMS==1400 ;ALL ELEVATOR BITS +ELETIM==20 ;PUSH THE BUTTON FOR 1/3 OF A SEC +KBDTIM==10. ;TIME UNTIL KEYBOARD GETS RESET (IN SEMI-SLOW CLOCK TICKS) +MAXBEL==4 ;MAXIMUM # OF BELLS ALLOWED +GLITIM==60.*60.*2 ;# CLOCK TICKS BETWEEN GLITCHES ON CONSOLE FREE DPY +NCQSLT==100 ;# CLOCK QUEUE SLOTS +KBDBFL==200 ;SIZE OF KEYBOARD BUFFER +LBLEN==100 ;PDP-10 INPUT BUFFER SIZE (BETTER BE DIVISIBLE BY 4) +LBCHRS==LBLEN/2 ;# CHARACTERS IN INPUT BUFFER +DPSIZE==600 ;PDP-10 OUTPUT BUFFER SIZE +BOWBIT==10000 ;CSA BLACK ON WHITE BIT +SAMSK==BOWBIT-1 ;MASK FOR SCROLL REGISTER +CSAMSK==170000 ;COMPLEMENT OF SAMSK +BLKTIM==15. ;CLOCK TICKS BETWEEN BLINKS +SNB==100000 ;SIGN BIT +PATL==400 ;SIZE OF PATCH AREA +CMDARG==10 ;# ARGUMENTS WHICH WILL FIT INTO PDP-10/PDP-11 COMMAND BUFFER +RUGSA==57100 ;STARTING ADDRESS OF RUG +TYMSLC==2 ;MAX # 60THS OF A SECOND, MINUS 1, TO CONCENTRATE ON ONE TV + +.SBTTL GO CODE, PDL, AND KBD BUFFER + +.ABS + +;PUSH DOWN LIST AND KEYBOARD BUFFER + +.=PDLORG+PDL +.IIF NE .&177,.=<.&177600>+200 ;ALIGN ON 200 BYTE BOUNDARY +PDBUF==. + +KBDBUF: +.=.+KBDBFL +KBDEND==. + +REPORT GO=,\GO + +GO: RESET ;IN THE PRIVACY OF YOUR OWN HOME + CLR PS + MOV #PDBUF,SP ;SET UP PUSH DOWN POINTER + MOV #ERRLVL,C ;ALL PROCESSOR TRAPS GO ON 7 + MOV #NXMPC,B + MOV #NXMBRK,(B)+ ;BUS TIME OUT + MOV C,(B)+ + MOV #RESBRK,(B)+ ;RESERVED INSTRUCTION + MOV C,(B)+ + MOV (B),T ;BREAK POINT + BNE .+6 + MOV #BPTBRK,T + MOV T,(B)+ + MOV C,(B)+ + MOV #IOTBRK,(B)+ ;IOT TRAP + MOV C,(B)+ + MOV #PWRBRK,(B)+ ;POWER FAILURE + MOV C,(B)+ + MOV #EMTBRK,(B)+ ;EMT + MOV C,(B)+ + MOV #TRPBRK,(B)+ ;"TRAP" TRAP (LEV 7) + MOV C,(B)+ + MOV #CHA,(B)+ ;CHANNEL HEADER AREA + MOV #POINTA,(B)+ ;POINTER AREA POINTER + MOV #IOVER,(B)+ ;I/O VERSION + MOV VERSE,(B)+ ;ASSEMBLY VERSION + CLR (B)+ ;INITED + CLR (B)+ + MOV C,(B)+ ;NON-ZERO SUFFICES + MOV C,(B)+ ;GDOWN + MOV #CLKBRK,LKPC ;CLOCK + MOV #LKLVL,LKPSW + MOV #KBDBRK,KBDPC ;KBD + MOV #LKLVL,KBDPSW + MOV #BPT,0 ;CATCH JUMPS TO ZERO. + +;FALLS THROUGH + +;INITIALIZE VARIBLES FALLS THROUGH + + JSR PC,INIT + +;ENABLE INTERRUPTS + + MOV #100,LKS ;CLOCK + MOV #KBDBUF,KMA + MOV #KBDBUF,OLDKMA + MOV #140,KMS ;KEYBOARD MULTIPLEXOR + MOV #-1,INITED + +;THE MAIN LOOP + +MAIN: MOV #MAXTV-1,U ;CHANNEL + CMP WHOTIM,ITSTI1 ;TIME FOR WHO LINES? + BEQ MAIN1 + ZAPFLG WHOFLG ;TRIGGER WHO LINES +MAIN1: TST INITED + BEQ GO ;RESET THE WORLD + TST CSR + BLT GO2RUG ;SWITCH 15 => GO TO RUG +MAIN3: JSR PC,DPYDPY + MOV CMDFLG,A ;PDP-10 GIVING COMMAND? + BLE MAIN2 + PUSH U + JSR PC,TENCMD ;PROCESS THE COMMAND + POP U +MAIN2: DEC U + BGE MAIN1 ;CYCLED THROUGH ALL CHANNELS? + CLR WHOFLG ;TURN OFF WHO LINES + BR MAIN + +GO2RUG: BPT + BR MAIN3 + +;HERE TO RESTART, NOTIFY THE PDP-10 + +GODOWN: RESET + CLR PS + MOV #INITED-2,B + CLR (B)+ + CLR (B)+ ;INITED + CLR (B)+ + CLR (B)+ ;GDOWN + TST GDOWN ;WAIT FOR THE PDP-10 TO REPLY + BEQ .-4 + JMP GO + +.SBTTL INITIALIZATION + +INIT: CLR TICKS + CLR TICKS1 +;******* TEMPORARY CODE FOR FONT CHECKSUM ******* + MOV #FNTORG,T + MOV T,CKSPNT + CLR CKSSUM + CLR TT +1$: ADD (T)+,TT + CMP T,#FNTEND + BLO 1$ + MOV TT,CKSSMG +;******* END OF TEMPORARY CODE ******* + CLR KBDFLG + CLR KBDFLG+2 + CLR KBDACT + CLR KBDLAST + CLR KBDTSW + CLR CMDFLG + CLR CMDFLG+2 + CLR WHOTIM + CLR ITSTI1 + CLR WHOFLG + CLR TENWHO + CLR QPYSWT + CLR BUZSWT + CLR ELESWT + CLR SSCC + JSR PC,REASW ;FEED EVERY SPEAKER SILENCE. + + MOV #LEBUFS,U ;INITIALIZE FREE LIST OF 11-TO-10 INPUT BUFFERS. + MOV U,FSP + MOV #NLBUFS-1,B +INIT6: MOV U,TT + ADD #,TT + MOV TT,LHFS(U) + MOV TT,U + DEC B + BGT INIT6 + CLR LHFS(U) ;END OF LIST + + CLR BLINK + MOV #BLINKS,A + MOV #BELCNT,C + MOV #-1,T ;SET UP BELL COUNTS + MOV #MAXTV-1,B + CLR ITSTDP +INIT5: CLRB CHNUSE(B) ;EVERY CHANNEL IS FREE. + CLRB BLKSWT(B) ;NO TV HAS BLINKING TEMPORARILY INHIBITED. + TSTB CHCREG(B) ;HOW MANY CHANNELS ARE WORKING? + BLT INIT5A + INC ITSTDP +INIT5A: CLR (A)+ + MOV T,(C)+ + DEC B + BGE INIT5 + MOV ITSTDP,ITSFDP ;# FREE DPY'S + + MOV #MAXBLK,B ;PUT ALL BLINKER BLOCKS ON THE FREE BLINKERS LIST. + MOV #BLKVAR,U + MOV U,FBLINK +INIT7: MOV U,TT + ADD #BLLEN,TT + MOV TT,BLNEXT(U) + CLRB BLON(U) + MOV TT,U + DEC B + BGT INIT7 + CLR (U) + + MOV #MAXTV-1,A + CLR T + MOV #WHVARS,C +INIT2: MOV DPYCHN(T),U + JSR PC,CHCLR ;SET UP THAT CHANNEL + MOV #-1,DPYKBD(T) + MOV #-1,CHNCLS(T) + CLR ECOFLG(T) + MOV C,WHOLIN(T) + MOV #-1,(C) .SEE WHJOB + ADD #WHLEN,C + CMP (T)+,(T)+ + DEC A + BGE INIT2 ;MORE DPY CHANNELS TO SET UP? + + MOV #-1,C + JSR PC,CHCONS ;GET A CHANNEL FOR THE FREE SCREENS. + TST T + BEQ .+4 ;THIS SHOULD ALWAYS GIVE US CHANNEL 0. + BPT + MOV WHOLIN,TT ;WANT SYSTEM WHO LINE ON CONSOLE FREE DPY + MOV #NWHCMD,WHMODE(TT) + MOVB CHCREG,TT ;TT GETS WHICH VIDEO BUFFER IT IS. + MOV TT,DPYFRE ;REMEMBER # OF DPY USED FOR FREE SCREENS. + MOVB TT,CREG ;SET UP CONSOLE REGISTER FOR PRINT + CLR CSA + TYPOUT + MOVB LECREG(U),C ;DPY + ASL C + MOV #MAXVSO-1,B ;SWITCH TO ALL OUTPUTS +INIT1: MOV DPYVSW(C),TT ;VIDEO SWITCH INPUT + MOV B,T ;SWITCH OUTPUT + JSR PC,VSWIT + DEC B + BGE INIT1 + + MOV #MAXKBD,A ;CLEAR KBDLE + CLR B +INIT8: CLR KBDLE(B) + CLR KBDESC(B) + MOV #-1,KBDDEF(B) + TST (B)+ + DEC A + BGT INIT8 + + MOV #NCQSLT-1,C ;INITIALIZE CLOCK QUEUE + CLR CLOCKQ + MOV #CQUEUE,A + MOV A,CLOCKF +INIT9: MOV A,B + ADD #CQLEN,B + MOV B,(A) + MOV B,A + DEC C + BGT INIT9 + CLR (A) + MOVB #CSET,CALU + MOV CREG,T ;SEED QUEUE WITH GLITCH CONSOLE FREE + JSR TT,ADQUE + GLITIM + MSGLIT + RTS PC + +.SBTTL MAIN PROGRAM LEVEL ROUTINES + +;HERE TO GET CHARACTER FROM OPEN CHANNEL +;LOOPS UNTIL NO MORE CHARACTERS AVAILABLE + +DPYDPY: TSTB CHNUSE(U) + BLE DPYD5 ;IGNORE FREE DISPLAYS. + PUSH U ;DPY CHANNEL NUMBER + ASL U + ASL U + PUSH U + MOV DPYCHN(U),U ;U GETS CHANNEL VAR BLOCK ADDR + JSR PC,GETCHR ;ANY OUTPUT FOR THIS CHANNEL? + BEQ DPYDON ;NO, GO CHECK FOR WHO LINES, ETC. + MOV #TYMSLC,TYMSHR ;MAX TIME BEFORE CHECKING OTHER CHANNELS + MOVB LECREG(U),T ;SET UP CONSOLE REGISTER + MOVB T,CREG + PUSH T + BLKOFF T ;TURN OFF ALL BLINKERS ON THIS SCREEN + JSR PC,CLBLIN ;AND CLEAR THEM + PUSH U ;SAVE PAGE PRINTER FOR DPYTVO+5 + MOVB #CIOR,CALU ;ALU FUNCTION FOR DRAWING CHARACTERS + MOV LECPC(U),TT ;RESUMING COROUTINE? + BEQ DPYDP1 ;NO. + MOV LESVB(U),B ;YES, RESTORE B AND PC FOR CORETURN FROM THE + CLR LECPC(U) ;GETCHC THAT DIDN'T FIND ANY CHARS. + BIC #-400,A ;CLEAR EXTRA BITS DUE TO SIGN-EXTENSION + PUSH #DPYXIT ;GETCHC'S CALLER'S RETURN ADDR MUST BE DPYXIT. + JMP (TT) ;GETCHC ENFORCES THAT. + +;FAST CHARACTER OUTPUT LOOP +DPYDP1: MOV (SP),U ;GET PP POINTER + MOVB A,A ;FLUSH HIGH BITS FROM CHAR + BLT DPYCTL ;BRANCH IF NON-PRINTING CONTROL FUNCTION +DPYTVO: MOV LEPHS(U),C ;SET UP TO DRAW CHARACTER + MOV LECC(U),TT ;THIS IS OPEN-CODED FOR SPEED + ASL A ;COPIED FROM CODE AT GENCHR + MOV CTAB(A),T + JSR PC,GENCH1 ;GENERATE CHARACTER, CLOBBER ALL ACS + MOV (SP),U ;RESTORE PP POINTER, CLOBBERED BY GENCH1 + JSR PC,LEDADC ;ADVANCE CURSOR +DPYXIT: TST TYMSHR ;TIME UP? + BMI DPYDX2 ;YES, LEAVE THIS TV FOR A WHILE + MOV (SP),U + JSR PC,GETCHR ;NO, GET NEXT CHARACTER + BNE DPYDP1 ;AND LOOP BACK TO PROCESS IT +DPYDX2: POP U + POP T ;DONE WITH THIS DPY FOR NOW + BLKON T ;ALLOW BLINKERS TO BLINK AGAIN + BR DPYDON + +;HERE IF NO CHARACTER AVAILABLE. TWO WORDS STILL ON THE STACK: +;(SP) IS 4 TIMES CHANNEL NUMBER, 2(SP) IS CHANNEL NUMBER (TO BE POPPED INTO U). + +DPYDON: POP B + TST CHNCLS(B) + BLT DPYFLS ;FLUSH DPY CHANNEL? + TST ECOFLG(B) + BEQ DPYD2 ;CAUSE PSEUDO ACTIVATION? + MOV U,T + ADD #LEZER0,T + + CHROFF + MOV KBDACT,LELIST(TT) ;PUT LINE EDITOR ON ACTIVE RING + MOV T,KBDACT + TST KBDFLG + BNE DPYD0 + MOV T,KBDFLG + CLR KBDACT + CLR KBDLAST +DPYD0: CHRON + +DPYD1: CLR ECOFLG(B) +DPYD2: TST WHOFLG ;DO WHO LINES? + BEQ DPYD3 + MOV WHOLIN(B),T + TST WHMODE(T) + BMI DPYD4 ;DON'T DO WHO LINE, BUT MIGHT WANT TO CLEAR IT + TST WHO1(T) + BMI DPYD4 ;USER WHO MODE VAR CAN ALSO DISABLE WHO LINE + JSR PC,DOWHO ;DO THE WHO LINE FOR THIS GUY +DPYD3: POP U +DPYD5: RTS PC + +;HERE IF NO WHO LINE IS TO BE DONE, WE MIGHT WANT TO CLEAR IT + +DPYD4: MOV WHOLIN(B),T + TST 2(T) ;IF NEGATIVE, THEN CLEAR IT + BGE DPYD3 + CLR 2(T) ;ZAP THE SWITCH + JSR PC,ZAPWHL ;CLEAR THE LINE + BR DPYD3 + +;HERE TO FLUSH DPY CHANNEL + +DPYFLS: MOV (SP),T + TSTB CHNUSE(T) ;ALREADY FREED? + BEQ DPYD3 ;YES, THIS MEANS MAIN LOOP SHOULD SIMPLY IGNORE THIS DPY. + CHROFF + JSR PC,CHRETN + CHRON + BR DPYD3 + +;HERE IF CONTROL CODE FOUND + +DPYCRF: SUB #5,A +DPYCTL: BIC #177600,A ;DISPATCH ON CONTROL CODE + CMP #ILLCTL,A + BLOS DPYTVO ;BRANCH IF ILLEGAL CODE + ASL A + PUSH #DPYXIT ;MAKE THE RETURN ADDR BE "DPYXIT" + JMP @CTLTAB(A) ;SO GETCHC COROUTINING WILL WORK. + +;CONTROL FUNCTION ROUTINES CALLED WITH PP INDEX IN U. +;MAY CLOBBER ALL ACS BUT MUST LEAVE CIOR IN CALU. MANY ARE ALSO +;CALLED FROM ELSEWHERE AND EXPECTED TO PRESERVE U. + +CTLTAB: SETCUR ;200 %TDMOV (FOLLOWED BY TWO IGNORED CHARS, THEN VPOS, HPOS). + SETCR1 ;201 %TDMV1 (FOLLOWED BY NEW VPOS AND NEW HPOS) + CLEOF ;202 %TDEOF (CLEAR TO END OF SCREEN) + CLEOL ;203 %TDEOL (CLEAR TO END OF LINE) + CLRCHR ;204 %TDDLF (DELETE FORWARD) + RTSPC ;205 %TDMTF (MOTOR OFF - IGNORED) + RTSPC ;206 %TDMTN (MOTOR ON - IGNORED) + CRLF ;207 %TDCRL (CRLF AND CLEAR EOL, BUT SCROLL AT END OF SCREEN) + RTSPC ;210 %TDNOP (NO-OP) + DPYBS ;211 %TDBS (BACKSPACE) + LF ;212 %TDLF (LF) + CR ;213 %TDRCR (RAW CR) + RTSPC ;214 %TDORS (OUTPUT RESET - WE CAN'T DO ANYTHING USEFUL) + RTSPC ;215 %TDQOT (DEVICE DEPENDENT DATA FOLLOWS - WELL, THIS DEVICE + ;SAYS IT DOESN'T REALLY DEPEND) + LEDADC ;216 %TDFS + SETCR1 ;217 %TDMV0 (SAME AS %TDMV1 FOR OUR PURPOSES) + DPYCLR ;220 %TDCLR (HOME UP AND CLEAR SCREEN) + BELL ;221 %TDBEL (FLASH THE SCREEN) + RTSPC ;222 %TDINI (REINITIALIZE INTELLIGENT TERMINAL (NOT APPLICABLE)) + LINS ;223 %TDILP (INSERT LINE POSITION (FOLLOW BY # LINES TO INSERT)) + LDEL ;224 %TDDLP (DELETE LINE POSITION (FOLLOW BY # LINES TO DELETE)) + CINS ;225 %TDICP (INSERT CHARACTER POSITION (FOLLOW BY # CHARS)) + CDEL ;226 %TDDCP (DELETE CHARACTER POSITION (FOLLOW BY # CHARS)) + RTSPC ;227 %TDBOW (IGNORED) + RTSPC ;230 %TDRST (IGNORED) + RTSPC ;231 %TDGPH (IGNORED) + RGSCUP ;232 %TDRSU (REGION SCROLL UPWARDS) + RGSCDN ;233 %TDRSD (REGION SCROLL DOWN) +ILLCTL==<.-CTLTAB>/2 + +.SBTTL WHO LINE ROUTINES + +;PRINTS WHO LINE, TAKES 10/11 CHANNEL IN B + +DOWHO: PUSH B ;SAVE 10/11 CHANNEL + MOV ITSTI1,WHOTIM ;TIME WE DID WHO LINE + MOV #WHOPP,TT ;SET DEFAULTS FOR WHO PAGE PRINTER + MOV #LEDFLT,T + MOV #LELEN,U + JSR PC,CALCPY ;ZAP + MOV #WHOPP,U ;SET UP PAGE PRINTER INDEX + CLR A ;CHARACTER X + MOV #CHRLN,B ;CHARACTER Y, PAST LAST LINE + JSR PC,SETXY0 + MOV (SP),B ;RESTORE 10/11 CHANNEL INDEX + MOV WHOLIN(B),A + TST WHO1(A) ;SIGN OF .WHO1 VARIABLE INHIBITS ALL HACKERY + BPL .+4 ;ASSUME USER HAS STUFF THERE AND SHOULDN'T CLOBBER IT. + RTS PC + JSR PC,ZAPWHL ;CLEAR OUT THE WHO LINE +WHINIT: MOV (SP),B ;10/11 CHANNEL INDEX + MOV WHOLIN(B),TT + CMP #NWHCMD-1,WHMODE(TT) + BHI DATIME ;NO VERSION NUMBER FOR USER WHO LINE + TYPOUT /ITS / + DECTYP ITSVER ;TYPE VERSION NUMBER + JSR PC,SPACE + TST ITSDBG + BEQ DATIME + TYPOUT /BEING DEBUGGED / + +;TYPES DAY TIME AND DATE + +DATIME: MOV ITSDAT,A ;PRINT PACKED DATE FIRST + JSR PC,DATTYP ; 7 BITS YEAR, 4 MONTH, 5 DAY + JSR PC,SPACE + MOV #MQ,B + MOV ITSTI1,(B) + MOV ITSTIM,-(B) + JSR PC,TIMTY1 ;TYPE DAY TIME NEXT + JSR PC,SPACE + POP B ;10/11 CHANNEL + MOV WHOLIN(B),TT + CMP #NWHCMD-1,WHMODE(TT) + BHI UWHLDO ;DO USER WHO LINE? + +;SYSTEM WHO LINE +;ITS XXX {BEING DEBUGGED} MM/DD/YY HH:MM:SS ITSFDP/ITSTDP USR RU/JOB SHARE SWBJ JWP TRC/COR CFU + +SWLDO: TYPOUT /TVS: / + DECTYP ITSFDP ;# FREE DPYS + JSR PC,SLASH + DECTYP ITSTDP ;TOTAL DPYS + TYPOUT / USERS: / + DECTYP ITSUSR ;# SYSTEM USERS + JSR PC,SPACE + DECTYP ITSRU ;RUNABLE JOBS/ + JSR PC,SLASH + DECTYP ITSJOB ;# SYSTEM JOBS + JSR PC,SPACE + DECTYP ITSFSH ;FAIR SHARE IN % + TYPOUT /% SB=/ + DECTYP ITSWBJ ;SWAP BLOCKED JOBS + TYPOUT / PG=/ + DECTYP ITSJWP ;JOBS WAITING FOR PAGES + TYPOUT / CORE: / + DECTYP ITSTRC ;RUNABLE CORE + JSR PC,SLASH + DECTYP ITSCOR ;TOTAL CORE + JSR PC,SPACE + DECTYP ITSCFU ;CORE FOR USERS + RTS PC + +;USER WHO LINE +;MM/DD/YY HH:MM:SS JOB UNAME JNAME SNAME STATUS J%RT HH:MM:SS.S JCORE {USER VARS} + +WHNOJB: TYPOUT / JOB SLOT VACANT/ ;HERE IF JOB SLOT VACANT + RTS PC + +UWHLDO: OCTYPE WHJOB(TT) ;JOB # + TST WHSTAT(TT) + BEQ WHNOJB ;VACANT JOB SLOT? + JSR PC,SPACE + MOV #WHUNAM,T + ADD TT,T + JSR PC,SIXPNT ;UNAME + JSR PC,SPACE + JSR PC,SIXPNT ;JNAME + JSR PC,SPACE + JSR PC,SIXPNT ;SNAME + JSR PC,SPACE + JSR PC,SIXPNT ;STATUS + JSR PC,SPACE + DECTYP WHJ%RT(TT) ;JOB % RUN TIME + JSR PC,SLASH + DECTYP ITSFSH ;OUT OF FAIR SHARE + JSR PC,PERCNT + JSR PC,SPACE + MOV WHJTRT(TT),A ;JOB RUNTIME IN .1-SEC TICKS + JSR PC,TIMTEN + JSR PC,SPACE + DECTYP WHRPAG(TT) ;# PAGES REAL CORE + JSR PC,SLASH + DECTYP WHTPAG(TT) ;# PAGES OF VIRTUAL CORE + MOV #'K,A + JSR PC,TVO + JSR PC,SPACE + MOV WHO1(TT),A ;PRINT FIRST USER WHO VAR + MOV #WHO2,T + JSR PC,UWVDO + MOV WHO1A(TT),A ;MAYBE PRINT SPACE + BMI UWHLD1 + JSR PC,SPACE + MOV WHO1A(TT),A +UWHLD1: MOV #WHO3,T ;NOW SECOND USER WHO VAR +;TAKE CONTROL WORD IN A, OFFSET (OFF TT) TO FOUR WORDS IN T, PRINT USER WHO VAR +;CONTROL WORD: +; 15 USED ELSEWHERE - IGNORE HERE +; 14 SUPPRESS SPACE BETWEEN TWO HALVES +; 13-11 MODE FOR FIRST HALF +; 10-08 MODE FOR SECOND HALF +; 07 DOUBLE 06-00 +; 06-00 CHARACTER TO PRINT AFTER FIRST HALF, BEFORE SPACE +UWVDO: PUSH A ;SAVE CONTROL WORD + ADD TT,T ;T POINT TO VAR + MOVB 1(SP),A + ASR A ;GET FIRST MODE + ASR A + ASR A + JSR PC,UWVDO4 ;PRINT FIRST HALF + MOVB (SP),A + BEQ UWVDO1 + BIT #200,A + BEQ UWVDO3 + JSR PC,TVOMSK ;SEPARATOR CHAR(S) +UWVDO3: JSR PC,TVOMSK +UWVDO1: BITB #100,1(SP) + BNE UWVDO2 + JSR PC,SPACE ;INTERVENING SPACE +UWVDO2: MOVB 1(SP),A ;GET SECOND MODE + TST (SP)+ ;POP CONTROL WORD, THEN DO SECOND HALF +UWVDO4: BIC #177770,A + ASL A + JMP @UWVDTB(A) + +UWVDTB: RTSPC ;0 DON'T PRINT + UWVDAT ;1 PACKED DATE AS MM/DD/YY + UWVTEN ;2 TIME IN .025 SECONDS AS HH:MM:SS.T + UWVHAK ;3 TIME IN .5 SECONDS AS HH:MM:SS + UWVHAK ;4 OCTAL (18. BITS) + UWVHAK ;5 DECIMAL (18. BITS) + SIXPN1 ;6 THREE SIXBIT CHARS + RTSPC ;7 RESERVED FOR EXPANSION + +;USER-CONTROLLED WHO-LINE FIELD PRINT-OUT ROUTINES. + +UWVHAK: MOV #MQ,B + TST (T)+ + MOV (T),(B) + MOV -(T),-(B) + CMP (T)+,(T)+ + MOV #-14.,LSH + JMP @UWVDT1-6(A) + +UWVDT1: TIMTY1 + UWVOCT + UWVDEC + +UWVOCT: MOV #10,B + BR UWVDC1 + +UWVDEC: MOV #10.,B +UWVDC1: PUSH RADIX + MOV B,RADIX + JSR PC,DECPN9 + POP RADIX + RTS PC + +UWVTEN: MOV (T)+,A + TST (T)+ + JMP TIMTEN + +UWVDAT: MOV (T)+,A + TST (T)+ + JMP DATTYP + +;SOME WHO LINE UTILITY ROUTINES + +PERCNT: MOV #'%,A +JMPTVO: JMP TVO + +SPACE: MOV #40,A + BR JMPTVO + +SLASH: MOV #'/,A + BR JMPTVO + +;TAKES POINTER TO SIXBIT IN T AND TYPES IT (ADVANCING T) + +SIXPNT: JSR PC,SIXPN1 ;DO TWO SETS OF THREE CHARS +SIXPN1: MOV #MUL,B ;DO ONE SET OF THREE CHARS + MOV #LSH,C + CMP (T)+,(T)+ ;BAG BITING EAE HAS TO LOADED IN JUST THE RIGHT ORDER + MOV -(T),-(B) ;LOW ORDER FIRST + MOV -(T),-(B) + CMP (T)+,(T)+ + MOV #-10.,(C) ;FIRST CHARCTER IN AC, THE REST IN MQ + JSR PC,SIXPN2 ;PRINT FIRST CHAR + JSR PC,SIXPN2 ;PRINT SECOND, FALL IN FOR THIRD +SIXPN2: MOV (B)+,A ;SIXBIT + ADD #40,A ;ASCII + PUSH (B)+ + JSR PC,TVO + POP -(B) + CLR -(B) ;CLEAR AC + MOV #6,(C) ;NEXT CHARACTER INTO AC + RTS PC + +;TAKES TENTHS OF SECONDS IN A AND PRINTS AS HH:MM:SS.T + +TIMTEN: MOV #MQ,T + MOV A,(T) + CLR -(T) + MOV #10.,-(T) ;DO DIVIDE + TST (T)+ + PUSH (T)+ ;TENTH'S OF SECONDS + MOV (T),A + ASL A ;# HALF SECONDS JOB HAS BEEN RUNNING + JSR PC,TIMTYP ;TYPE TIME + MOV #'.,A + JSR PC,TVO + POP A ;TENTH'S OF SECONDS + JMP DECPNT + +;TAKES # HALF SECONDS IN A AND TYPES TIME IN HH:MM:SS FORMAT + +TIMTYP: MOV #MQ,B + MOV A,(B) + CLR -(B) +;TAKE # HALF SECONDS IN EAE AC-MQ AND TYPE AS HH:MM:SS +TIMTY1: MOV #120.,-(B) ;MINUTES SINCE MIDNIGHT + TST (B)+ + PUSH (B) ;REMAINDER IS SS*2 + ASR (SP) + CLR (B) ;CLEAR AC + MOV #60.,-(B) ;HOURS SINCE MIDNIGHT + TST (B)+ + PUSH (B)+ ;REMAINDER IS MM + MOV (B),A ;HH + JSR PC,DECPNT + MOV #':,C ;COLON SEPARATES GOODIES + POP A + JSR PC,MSDPNT ;PRINTS COLON AND PADS WITH LEADING ZERO IF NECESSARY + POP A +MSDPNT: PUSH A + MOV C,A ;PRINT SEPARATING CHARACTER + JSR PC,TVO + CMP #10.,(SP) + BLE MSDPN1 ;PAD WITH LEADING ZERO? + MOV #'0,A + JSR PC,TVO +MSDPN1: POP A + JMP DECPNT ;PRINT NUMBER + +;TAKE DATE PACKED AS 7 BITS YEAR, 4 MONTH, 5 DAY AND PRINT AS MM/DD/YY + +DATTYP: MOV #MQ,B + MOV A,(B) + CLR -(B) ;CLEAR AC + MOV #LSH,C + MOV #7,(C) ;YEAR + PUSH (B) + CLR (B) + MOV #4,(C) ;MONTH + MOV (B),A + CLR (B) + MOV #5,(C) ;DAY + PUSH (B) + JSR PC,DECPNT ;PRINT MONTH + MOV #'/,C ;USE SLASH AS SEPARATOR + POP A + JSR PC,MSDPNT ;PRINT DAY + POP A + JMP MSDPNT ;PRINT YEAR + + +.SBTTL PDP-10 COMMAND PROCESSOR SWITCH VIDEO SWITCH, ETC. + +TENCMD: CMP #MAXCMD,A ;LEGAL COMMAND? + BLOS TENCFL ;NO, COMMAND FAILS + ASL A ;BYTES FOR DISPATCH + JMP @TENDSP(A) + +;PDP-10 COMMAND DISPATCH + +TENDSP: TENCFL ;0 ILLEGAL + TENVSW ;1 VIDEO SWITCH + TENDPC ;2 CONS DPY FOR PDP-10 + TENDPR ;3 RETURN DPY + TENRVS ;4 READ VIDEO SWITCH + TENASW ;5 AUDIO SWITCH + TENRAS ;6 READ AUDIO SWITCH +MAXCMD==<.-TENDSP>/2 + +;HERE TO SWITCH VIDEO SWITCH + +TENVSW: MOV CMDBUF,TT ;SWITCH INPUT + MOV CMDBUF+4,T ;SWITCH OUTPUT + CHROFF ;INHIBIT INTERRUPTS WHILE WE DO THIS + JSR PC,VSWCMD ;CHECKS FOR LEGAL BEFORE SWITCHING + BHIS TENCF1 ;JUMP IF THEY WERE ILLEGAL. +TENCS1: CHRON +TENCSD: MOV #-1,CMDFLG ;COMMAND SUCCEEDS + RTS PC + +;SWITCH AUDIO SWITCH UPON COMMAND FROM PDP-10 + +TENASW: MOV CMDBUF,TT ;SWITCH INPUT + MOV CMDBUF+4,T ;SWITCH OUTPUT + CHROFF + JSR PC,ASWCMD ;SWITCH SWITCH, TESTING LEGALITY. + BHIS TENCF1 ;JUMP IF THEY WERE ILLEGAL, TO SAY COMMAND FAILED. + BR TENCS1 + +;HERE TO CONS UP DPY FOR PDP-10 + +TENDPC: CHROFF ;INHIBIT INTERRUPTS AGAIN + MOV CMDBUF,C ;ARG IS KEYBOARD TO USE, OR -1 FOR NO KEYBOARD. + CMP C,#MAXKBD ;BUT BARF IF ILLEGAL KEYBOARD NUMBER. + BGE TENCF1 + JSR PC,CHCONS ;GET A CHANNEL, CONNECT IT TO THAT KEYBOARD. + TST T + BLT TENCF1 ;CAN'T => COMMAND FAILS. + MOVB LECREG(U),CMDBUF ;ELSE RETURN THE VIDEO BUFFER NUMBER + CLRB CMDBUF+1 + MOV T,CMDBUF+4 ;AND THE 10-11 CHANNEL NUMBER (TTY NUMBER MINUS 52). + BR TENCS1 + +TENCF1: CHRON +TENCFL: CLR CMDFLG ;REPORT FAILURE OF A COMMAND TO THE TEN. + RTS PC + +;HERE TO RETURN DPY ON COMMAND + +TENDPR: MOV CMDBUF,TT ;THE DPY TO RETURN + MOV #MAXTV-1,T +TENDR0: CMPB CHCREG(T),TT ;WHICH CHANNEL DOES IT BELONG TO? GET # IN T. + BEQ TENDR1 + DEC T + BGE TENDR0 + BR TENCSD + +TENDR1: TST CHNUSE(T) ;DO NOTHING IF THE CHANNEL IS FREE. + BEQ TENCSD + CHROFF ;OTHERWISE, FREE THAT CHANNEL. + JSR PC,CHRETN + BR TENCS1 + +;HERE RETURN STATE OF VIDEO SWITCH + +TENRVS: JSR PC,SWTARG ;SET UP 10-11 CHANNEL ARGUMENT + BLOS TENCFL ;ILLEGAL ARG MAKES COMMAND FAIL + JMP @RVSDSP(T) +RVSDSP: TENCFL ;0 IS ILLEGAL + RVSCHN ;1 10/11 CHANNEL # + RVSKBD ;2 KBD # + RVSOUT ;3 VIDEO SWITCH OUTPUT # +NSWTRG==<.-RVSDSP>/2 + +RVSKBD: JSR PC,CHKKBD ;HERE GIVEN KBD #; TEST IT. + BHI RVSCH1 ;IF LEGAL, FALL INTO MAIN LINE CODE + BR TENCFL ;ILLEGAL, TELL HIM SO + +RVSOUT: MOV CMDBUF+4,TT ;HERE GIVEN VIDEO SWITCH OUTPUT #. + MOV #-1,T ;ILLEGAL KBD # + CMP #MAXVSO,TT ;CHECK FOR LEGAL + BHI RVSCH2 ;FALL INTO MAIN LINE CODE + BR TENCFL ;HERE IF ILLEGAL + +RVSCHN: JSR PC,CHNKBD ;HERE GIVEN 10-11 CHANNEL #; GET KBD # IN T + BLOS TENCFL +RVSCH1: MOVB KBDVSW(T),TT ;GET VIDEO SWITCH OUTPUT INTO TT +RVSCH2: MOV TT,CMDBUF+<4*4> ;PUT VIDEO SWITCH OUTPUT INTO COMMAND BUFFER + MOV TT,CMDBUF+<3*4> + TST CMDBUF + BMI RVSDF ;BRANCH IF HE WANTS DEFAULT INPUT OF THIS OUTPUT. + MOVB VSWTAB(TT),TT ;GET CURRENT INPUT OF THIS OUTPUT AND STORE. + BR RVSCH3 + +RVSDF: ASL T ;MAKE IT BYTE INDEX + BMI RVSNL ;NEGATIVE IF NOT LOGGED IN + MOV KBDLE(T),U + BEQ RVSNL ;KBD NOT LOGGED IN, ITS THE DEFAULT +RVSDF1: MOVB LECREG(U),TT ;THE REGISTER HE HACKS + CMP #MAXTV,TT + BLOS TENCFL ;BRANCH IF ILLEGAL CONSOLE # + ASL TT ;MAKE IT A BYTE INDEX + MOV DPYVSW(TT),TT ;VIDEO SWITCH INPUT +RVSCH3: MOV TT,CMDBUF+<2*4> ;STORE SWITCH INPUT INTO COMMAND BUFFER + BR TENCSD + +RVSNL: MOV DPYCHN,U ;CHANNEL 0 IS CONSOLE FREE CHANNEL + BR RVSDF1 ;AND BACK INTO MAIN STREAM + +;GIVEN 10/11 CHANNEL # AND RETURNS KBD IN T + +CHNKBD: MOV CMDBUF+4,T ;PICK UP CHANNEL # + CMP #MAXTV,T + BLOS CHNKB2 + ASL T ;MAKE CHANNEL # INTO INDEX INTO CHANNEL TABLES + ASL T + TST CHNCLS(T) ;MAKE SURE CHANNEL IS OPEN + BLT CHNKB3 + MOVB DPYKBD(T),T ;PICK UP KBD # +CHNKB1: CMP #MAXKBD,T ;FIX CONDITION CODES FOR SUCCESSFUL RETURN +CHNKB2: RTS PC + +CHNKB3: MOV #MAXKBD+1,T ;HERE IF CHANNEL CLOSED + BR CHNKB1 ;CONS UP ILLEGAL KBD # + +CHKKBD: MOV CMDBUF+4,T ;CHECK FOR REASONABLE KBD # + BR CHNKB1 + +;HERE TO SET UP SWITCH ARG FOR 10-11 COMMAND RETURN IN CONDITION CODES +;IS THE RESULT OF CMP #NCHARG, TO CHECK FOR LEGALITY + +SWTARG: MOV CMDBUF,T ;ARGUMENT TYPE + BPL .+4 ;MAKE SURE WE HAVE A POSITIVE # + NEG T + ASL T ;MAKE IT INTO A BYTE INDEX + CMP #NSWTRG*2,T ;TEST FOR LEGAL + RTS PC + +;HERE RETURN STATE OF AUDEO SWITCH + +TENRAS: JSR PC,SWTARG ;SET UP 10-11 CHANNEL ARGUMENT + BLOS RASLOS ;ILLEGAL ARG MAKES COMMAND FAIL + JMP @RASDSP(T) +RASDSP: TENCFL ;0 IS ILLEGAL + RASCHN ;1 10/11 CHANNEL # + RASKBD ;2 KBD # + RASOUT ;3 AUDEO SWITCH OUTPUT # +.IIF NZ .--RASDSP,.ERROR RASDSP AND RVSDSP DIFFER. + +RASCHN: JSR PC,CHNKBD ;GIVEN A 10-11 CHANNEL #; GET KBD # IN T + BLOS RASLOS +RASCH1: MOVB KBDASW(T),TT ;GET AUDEO SWITCH OUTPUT INTO TT +RASCH2: MOV TT,CMDBUF+<3*4> ;PUT OUTPUT NUMBER IN AS RETURN VALUE. + CLR CMDBUF+<2*4> ;IF HE WANTS DEFAULT INPUT OF THIS OUTPUT, IT'S 0. + TST CMDBUF + BMI RASCH3 ;BRANCH IF HE WANTS DEFAULT INPUT OF THIS OUTPUT. + MOVB ASWTAB(TT),CMDBUF+<2*4> ;GET CURRENT INPUT OF THIS OUTPUT AND STORE. +RASCH3: JMP TENCSD + +RASKBD: JSR PC,CHKKBD ;HERE IF GIVEN KBD #; TEST FOR LEGALITY. + BHI RASCH1 ;IF LEGAL, FALL INTO MAIN LINE CODE +RASLOS: JMP TENCFL ;ILLEGAL, TELL HIM SO + +RASOUT: MOV CMDBUF+4,TT ;HERE IS GIVEN AUDEO SWITCH OUTPUT + CMP #MAXASO,TT ;CHECK FOR LEGAL + BHI RASCH2 ;FALL INTO MAIN LINE CODE + BR RASLOS ;HERE IF ILLEGAL + +.SBTTL ERROR TRAPS HERE + +NXMBRK: BPT +RESBRK: BPT +IOTBRK: BPT +PWRBRK: BPT +EMTBRK: BPT +TRPBRK: BPT + +;BPT BREAKS COME HERE IF THERE IS NO RUG. +;DON'T WANT TO HALT THE 11 SINCE 11TEN INTERFACE WOULDN'T BE ABLE TO GET TO BUS. +;WANT TO PUT CONTENTS OF REGISTERS IN CORE WHERE CARPET CAN GET AT THEM. + +BPTBRK: .REPT 7 ;SAVE THE ACS + MOV %0+.RPCNT,BPTACS+<2*.RPCNT> + .ENDR + MOV #INITED-2,A ;TELL THE 10 WE'RE DOWN + CLR (A)+ + CLR (A)+ + CLR (A)+ + CLR (A)+ + +; BELOW LOSES - PREVENTS RESTUFFING UNLESS YOU GO HIT SWITCHES +; WAIT ;PUT 000001 IN LIGHTS (11/05) + BR . ;WAIT FOR RELOAD OR MANUAL INTERVENTION + ;BRANCH TO POINT SO STUFF WILL AUTOMATICALLY START IT. + .REPT 7 ;PROCEED + MOV BPTACS+<2*.RPCNT>,%0+.RPCNT + .ENDR + RTI + +BPTACS: .BLKW 7 + +.SBTTL CLOCK ROUTINES CAUSE BLINKING + +CLKBRK: DEC TYMSHR ;COUNT DOWN THIS DPY'S QUANTUM +;******* TEMPORARY CODE TO CHECKSUM THE FONT ******* +;CHECKSUM IT 100 OCTAL WORDS AT A TIME, SO AS NOT TO SLOW THINGS DOWN +;TOO MUCH. WILL GET CHECKED APPROXIMATELY FOUR TIMES A SECOND. + PUSH T + PUSH TT + MOV CKSPNT,T + MOV T,TT + ADD #100*2,TT + CMP TT,#FNTEND + BLOS 1$ + MOV #FNTEND,TT +1$: ADD (T)+,CKSSUM + CMP T,TT + BLO 1$ + MOV T,CKSPNT + CMP TT,#FNTEND + BNE 2$ + CMP CKSSUM,CKSSMG + BEQ .+4 + BPT + CLR CKSSUM + MOV #FNTORG,CKSPNT +2$: POP TT + POP T +;******* END OF TEMPORARY CODE ******* + PUSH T + ADD #1,TICKS1 ;INC DOES NOT AFFECT C-BIT (SIGH) + ADC TICKS + TST KBDFLG + BNE CLKBR1 ;HAS PDP-10 HACKED THE LAST BUNCH? + MOV KBDACT,KBDFLG ;YES, GIVE HIM THE NEW BUNCH + CLR KBDFLG+2 ;PARANOIA REIGNS SUPREME + CLR KBDACT + CLR KBDLAST ;POINTS TO END OF ACTIVE CHAIN + +;CLOCK QUEUE DISPATCH + +CLKBR1: MOV CLOCKQ,T + BEQ CLKBR2 ;ANYTHING ON CLOCK QUEUE? + TST (T)+ ;IGNORE CDR + CMP (T)+,TICKS ;DOUBLE-PRECISION COMPARE TIME NOW + BHI CLKBR2 ;WITH TIME IN QUEUE BLOCK; TO CLKBR2 IF NOT DUE YET. + BLO CLKBR3 + CMP (T)+,TICKS1 + BHI CLKBR2 +CLKBR3: PUSH CLOCKQ ;CDR THE CLOCK QUEUE + MOV @(SP),CLOCKQ + JSR PC,@(T)+ ;CALL CLOCK LEVEL ROUTINE, T POINTS TO ARGUMENT + POP T + MOV CLOCKF,(T) ;PUT OLD SLOT ON FREE LIST + MOV T,CLOCKF + BR CLKBR1 ;CHECK AGAIN IF SOMETHING STILL ON QUEUE + +CLKBR2: DEC BLINK + BGE .+10 + MOV #BLKTIM,BLINK + CMP BLINK,#MAXTV + BHIS CLKR1 + MOV BLINK,T + TSTB BLKSWT(T) + BNE CLKR1 + PUSH U + PUSH CREG + PUSH AC + PUSH MQ + MOVB T,CREG + ASL T + MOV BLINKS(T),T ;BLINK CHAIN FOR THIS DPY + BEQ CLKBR4 +CLKLOP: MOV BLCURS(T),U ;CURSOR TO BLINK + JSR PC,XORCHR + COMB BLON(T) ;CHANGE STATE OF BLINK + MOV BLNEXT(T),T + BNE CLKLOP +CLKBR4: POP MQ ;CLOCK RETURN + POP AC + POP CREG + POP U +CLKR1: TST BLINK + BEQ CLKR3 + CMP BLINK,#BLKTIM/2 + BNE CLKR2 +CLKR3: JSR PC,RPT ;AS OFTEN AS WE BLINK, HANDLE THE REPEAT KEY. +CLKR2: INCB SSCC ;INCREMENT SEMI-SLOW CLOCK COUNT + BNE CLKRET ;WRAP-AROUND => SEMI-SLOW CLOCK TICK + BR CLKBRS + +;ON ALL CONSOLES IN "REPEAT" MODE, PERFORM ONE REPETITION +;BY SENDING AS INPUT TO THE PDP-10 ANOTHER COPY OF THE CHAR +;MOST RECENTLY SENT. ALSO DECREMENTS ALL FINITE REPEAT COUNTS. +RPT: JSR U,ACSAV + PUSH CREG + MOV #LEUVAR,U +RPT4: TST LERPT(U) + BEQ RPT3 + BMI RPT1 + DEC LERPT(U) +RPT1: MOV LELSTA(U),A + MOV LELSTB(U),B + JSR PC,PUTCHR +RPT3: ADD #LELEN,U + CMP #LEUEND,U + BGT RPT4 + POP CREG + JMP ACRES + +;COME HERE EVERY 256./60. = 4.27 SECONDS FOR SEMI-SLOW CLOCK +CLKBRS: PUSH TT + PUSH C + PUSH U + PUSH #69. ;FOR DEBUGGING + TST KBDTSW + BEQ SSCRET + CLR KBDTSW + MOV #KBDDEF+<2*MAXKBD>,T + BR CLKBR5 + +CLKBR9: INC KBDTSW +CLKBR5: CMP #KBDDEF-2,T + BEQ SSCRET + TST -(T) ;FAST LOOP LOOKING FOR ANY KEYBOARD + BGE CLKB10 ; NEEDING ITS CONSOLE'S VIDSW INPUT RESET + BR CLKBR5 +CLKB10: DECB 1(T) + BGE CLKBR9 ;NOT TIME TO RESET THIS SCREEN YET + MOV T,C + SUB #KBDDEF,C ;C HAS 2*KBD NUMBER, FOR VSWDEF. + PUSH T + JSR PC,VSWSGO ;SET UP L.E. INDEX IN U, VSW OUTPUT IN T + BLT CLKBR7 ;VSWSGO IS NEGATIVE IF SOMETHING IS FUNNY. + JSR PC,VSWDEF ;RESET VIDEO SWITCH INPUT +CLKBR7: POP T + BR CLKBR5 + +SSCRET: CMP (SP)+,#69. ;IS STACK SCREWED? + BEQ SSCRE1 + BPT +SSCRE1: POP U + POP C ;SEMI-SLOW CLOCK RETURN + POP TT +CLKRET: POP T +CRTI: RTI + +;CLEARS ALL BLINKERS ON THIS DPY + +CLBLIN: PUSH U + MOVB CREG,T + BIC #177400,T + ASL T + MOV BLINKS(T),T + BEQ CLBL2 +CLBL0: TSTB BLON(T) ;BLINK ON? + BEQ CLBL1 + MOV BLCURS(T),U + JSR PC,XORCHR + CLRB BLON(T) +CLBL1: MOV BLNEXT(T),T + BNE CLBL0 +CLBL2: POP U + RTS PC + +;CLOCK QUEUE ROUTINES + +;ADQUE CALLED WITH ARG IN T, THE CALLING SEQUENCE IS: + +; JSR TT,ADQUE +; DELTA T +; ROUTINE TO CALL AT CLOCK LEVEL + +ADQUE: PUSH T ;ARG FOR ROUTINE + MOV CLOCKF,T ;GET FREE CLOCK QUEUE SLOT + BEQ ADQFL ;IF THERE IS A FREE ONE + TST (T)+ ;IGNORE CDR + MOV TICKS,(T)+ ;MOVE IN CURRENT TIME + MOV TICKS1,(T) + ADD (TT)+,(T)+ ;TIME TO CALL ROUTINE + ADC -4(T) + MOV (TT)+,(T)+ ;ROUTINE TO CALL + MOV (SP)+,(T) ;AND ITS ARG + PUSH TT ;RETURN ADDRESS + MOV CLOCKF,TT ;ADDRESS OF THIS CLOCK QUEUE SLOT + MOV (TT),CLOCKF ;CDR THE FREE LIST + PUSH TT ;ADDRESS OF ONE TO ADD + PUSH #CLOCKQ ;ADDRESS OF PREVIOUS CLOCK QUEUE ENTRY +ADQUE1: MOV @(SP),TT ;CURRENT ENTRY IN QUEUE + BEQ ADQUE2 ;END OF QUEUE? + MOV 2(SP),T ;THE ONE WE WANT TO ADD + CMP (T)+,(TT)+ ;IGNORE CDR'S + CMP (T)+,(TT)+ ;HIGH ORDER OF TIME + BLO ADQUE2 ;GO SPLICE IT IN HERE + BHI ADQUE3 + CMP (T)+,(TT)+ ;LOW ORDER + BLOS ADQUE2 +ADQUE3: MOV @(SP),(SP) ;CDR THE QUEUE + BR ADQUE1 + +;HERE TO SPLICE ENTRY INTO CLOCK QUEUE + +ADQUE2: MOV @(SP),@2(SP) ;CDR OF QUEUE, GOES TO CDR OF NEW ENTRY + MOV 2(SP),@(SP) ;CURRENT SLOT GOES TO CDR OF PREVIOUS + CMP (SP)+,(SP)+ ;CLEANSE STACK + POP TT + RTS TT + +;HERE FOR NO FREE CLOCK QUEUE SLOTS + +ADQFL: CMP (TT)+,(TT)+ ;SKIP OVER ARGS + POP T ;CLEANSE STACK + RTS TT + +;THIS CAUSES CONSOLE FREE DPY TO GLITCH + +MSGLIT: PUSH CREG + MOV (T),T + MOV T,CREG + JSR TT,ADQUE + GLITIM + MSGLIT + MOV CSA,T + PUSH T + BIC #-BOWBIT,T ;CLEAR BOW AND OTHER GARBAGE + ADD #LINHT*BYTPL/10,T ;GLITCH ONE CHARACTER LINE + CMP #LINHT*BYTPL*CHRLN/10,T + BHI .+4 ;WRAP AROUND? + CLR T + BIC #-1#<-BOWBIT>,(SP) + BIS T,(SP) + POP CSA ;ZAP + POP CREG + RTS PC + +;HERE TO RING BELL ON DPY + +BELL: PUSH T + MOV CREG,T + MOVB T,TT ;DOUBLE TV BUFFER # FOR BYTE INDEX + ASL TT + + CHROFF ;INHIBIT INTERRUPTS WHILE WE HACK CLOCK QUEUE, ETC. + INC BELCNT(TT) ;FLASH SCREEN AT LEAST ONCE + BEQ BELL0 ;IF NONE PENDING, FLASH IT NOW + INC BELCNT(TT) ;IF BELLS PENDING THEN FLASH TWICE + CMP BELCNT(TT),#MAXBEL + BLOS BELL0A + DEC BELCNT(TT) + DEC BELCNT(TT) + BR BELL0A + +;HERE IF NO BELLS PENDING, FLASH SCREEN RIGHT AWAY, ADD CLOCK QUEUE ENTRY + +BELL0: JSR PC,BOWXOR ;FLASH THE SCREEN NOW! + JSR PC,BELL1A ;ADD CLOCK QUEUE ENTRY +BELL0A: CHRON + + POP T + RTS PC + +;CLOCK LEVEL BELL ROUTINE + +BELL1: PUSH CREG + MOV (T),T ;THE DESIRED CONSOLE REGISTER + MOV T,CREG ;N.B. THE ALU MODE WAS SAVED AS "XOR" + MOV #BOWBIT,CSA ;FLASH THE SCREEN + BIC #177400,T ;THE DPY # + ASL T ;BYTE INDEX + DEC BELCNT(T) ;WE JUST DID THAT ONE + BMI BELL1B ;ANY MORE PENDING? + JSR PC,BELL1A ;YES, PUT ANOTHER ON QUEUE +BELL1B: POP CREG + RTS PC + +BELL1A: MOV CREG,T ;PUT ANOTHER BELL ON CLOCK QUEUE + JSR TT,ADQUE + BLKTIM + BELL1 + RTS PC + +.SBTTL KEYBOARD INTERRUPT ROUTINES + +;KEYBOARD BREAK ROUTINES THE LINE EDITOR RUNS AT THIS LEVEL + +KBDBRK: JSR U,ACSAV ;PUT AC'S ON STACK + PUSH CREG + PUSH AC + PUSH MQ +KBDLOP: MOV OLDKMA,A + CMP #KBDEND,A ;CHECK WRAP AROUND + BHI .+6 + MOV #KBDBUF,A + CMP KMA,A + BEQ KBDRET ;NO MORE CHARACTERS + MOV (A)+,B ;RAW CHARACTER + TSTB (A)+ ;GARBAGE + MOVB (A)+,-(SP) ;KEYBOARD # + MOV A,OLDKMA + +;GET ASCII REPRESENTATION OF CHARACTER +; ASCII CODE IN A, META BITS IN B + + MOV B,C ;TWO COPIES OF RAW CHARACTER + BIC #RCHAR,B ;KEY STRUCK + BIT #RTPBIT,C ;TOP? + BEQ KBDX1 + BIS #XTPBIT,B + BR KBDX2 +KBDX1: BIT #RSLBIT,C ;SHIFT LOCK? + BEQ .+6 + BIS #XSLBIT,B + BIT #RSHBIT,C ;SHIFT? + BEQ KBDX2 + BIS #XSHBIT,B +KBDX2: MOVB XTAB(B),A ;ASCII REPRESENTATION + BIC #<#-1>,B ;FLUSH ALL UNINTERESTING BITS + ASL B ;XTAB TO ASCII REPRESENTATION + ASL B + ASL B + BIT #RMTBIT,C ;META? + BEQ .+6 + BIS #AMTBIT,B + BIT #RCLBIT,C ;CONTROL? + BEQ .+6 + BIS #ACLBIT,B + MOVB (SP)+,C ;KEYBOARD # + ASL C ;BYTE FOR INDEX INTO KBDLE + TST A + BLT NONASC ;NON-ASCII +KBDUN3: TSTB KBDESC(C) + BNE ESCBRK ;ESCAPE OR BREAK IS IN PROGRESS + TSTB KBDCNT(C) ;IF THIS SCREEN IS SPYING WITH A TIMEOUT, + BLT KBDUN1 + JSR PC,VSWUNS ;UN-SPY IT IMMEDIATELY. +KBDUN1: MOV KBDLE(C),U ;ASSOCIATED LINE EDITOR? + BEQ KBDLOP + TST LERPT(U) ;IF THE REPEAT KEY IS IN EFFECT, + BEQ KBDUN2 ;TURN IT OFF, AND FLUSH THIS CHARACTER. + CLR LERPT(U) + BR KBDLOP + +KBDUN2: MOVB LECREG(U),CREG ;SET UP CONSOLE REGISTER + BIS #ACTBIT,B ;FEED THIS CHAR TO THE PDP-10 + JSR PC,PUTCHR + BR KBDLOP + +;KEYBOARD RETURN + +KBDRET: POP MQ + POP AC + POP CREG + POP A + POP B + POP C + POP T + POP TT + POP U + RTI + +;NON-ASCII CHARACTERS COME HERE + +NONASC: NEG A + CMP #MAXNAS,A + BHIS .+4 +NONAS1: BPT ;ILLEGAL CHARACTER + CMP #,C ;C HAS BEEN DOUBLED + BHI .+4 + BPT ;GARBAGE KBD # + CLRB KBDESC(C) + ASL A ;BYTES + JSR PC,@NASCTB(A) ;DISPATCH TO ROUTINE +JBDLOP: JMP KBDLOP + +;PROCESS ESCAPE AND BREAK COMMANDS + +ESCBRK: JSR PC,UPPER ;CONVERT LOWER CASE TO UPPER CASE + MOV #ESCHAR,T +ESCBR1: CMPB (T),A ;MATCH? + BEQ DOESC + TSTB (T)+ ;END OF TABLE? + BNE ESCBR1 +ESCBR2: CLRB KBDESC(C) ;NO COMMAND + BR JBDLOP + +DOESC: MOV KBDLE(C),U ;IF COMMAND NEEDS LOGGED-IN KBD, + BEQ DOESC2 ; MAKE SURE WE'RE LOGGED IN, + MOVB LECREG(U),CREG ; AND SET UP U AND CREG +DOESC1: SUB #ESCHAR,T + CLRB KBDESC(C) + ASL T ;MAKE A WORD INDEX. + JSR PC,@ESCTAB(T) ;C MUST BE KBD #, SOME ESCAPE ROUTINES RELY ON IT + BR JBDLOP + +DOESC2: CMP #ESCSRN,T ;IF NOT LOGGED IN BUT MUST BE, + BLE ESCBR2 ; THEN WE LOSE TOTALLY + MOVB DPYFRE,CREG ;OTHERWISE SET UP CREG FOR THE + BR DOESC1 ; SAKE OF RANDOM BELLS + +;NASCTB FOR KEYS SUCH AS BREAK, CLEAR, ETC POINTS HERE +;TO TURN THOSE CHARACTERS INTO TOP-LETTERS STARTING WITH "A". +;A HOLDS TWICE THE NASCTB INDEX. +BRKCLR: ASR A + ADD #4000+'@,A +BRKCLX: TST (SP)+ ;FLUSH RETURN POINTER TO JBDLOP + JMP KBDUN3 ;AND GO GIVE CHARACTER TO TEN. + +GAMMA: MOV #4011,A + BR BRKCLX + +DELTA: MOV #4012,A + BR BRKCLX + +CRCPLS: MOV #4015,A + BR BRKCLX + +PLSMNS: MOV #4014,A + BR BRKCLX + +.SBTTL 10/11 INPUT/OUTPUT ROUTINES + +;HERE TO COMPLEMENT STATE OF BOW BIT WHEN PDP-10 FALLS BEHIND ON KBD + +SLOW10: MOVB LECREG(U),CREG + JMP BELL ;RING BELL + + +;PUT CHARACTER WHICH IS A OR'D WITH B INTO BUFFER. ACTIVATES IF +; 1 FINDS ACTIVATION CHARACTER +; 2 BUFFER FILLS +;A AND B ARE SAVED IN LELSTA AND LELSTB IN CASE THE USER DECIDES +;TO REPEAT THE CHARACTER. + +PUTCHR: TST @LEBUF(U) + BGT PUTCH0 ;BUFFER BEING FILLED? + BLT SLOW10 ;HAS PDP-10 FALLEN BEHIND? + MOV #LBCHRS,@LEBUF(U) ;MARK BUFFER BUSY WITH # FREE CHARACTERS +PUTCH0: TST LEFREE(U) ;ANY ROOM LEFT IN BUFFER? + BGT PUTCH2 + BEQ SLOW10 ;NOPE, DO SOME ERROR CHECKING + BPT ;LOSE IF LESS THAN NO ROOM + +PUTCH2: MOV A,@LECHR(U) + BIS B,@LECHR(U) + MOV A,LELSTA(U) + MOV B,LELSTB(U) + ADD #2,LECHR(U) + DEC LEFREE(U) ;BUFFER FULL? + BGT PUTCH4 + BEQ .+4 ;WE MUST ACTIVATE ANYWAY + BPT + MOV LEBUF(U),T + TST LHQUED(T) ;IF ALREADY QUEUED TO ACTIVATE, + BEQ ACTIVA ; DON'T ACTIVATE NOW + RTS PC + +PUTCH4: TST B + BGE RTSPC1 ;NOT ACTIVATING + MOV LEBUF(U),T ;ACTIVATION CHAR, MUST ACTIVATE + TST LHQUED(T) ;IF ALREADY QUEUED TO ACTIVATE, + BNE RTSPC1 ; DON'T ACTIVATE NOW + TST @LHNEXT(T) ;TEST NEXT BUFFER IN RING + BMI QBFR ;IF NOT FREE, TRY ACTIVATION ON NEXT CLOCK TICK + +;HERE TO ACTIVATE BUFFER + +ACTIVA: SUB #LBCHRS,LEFREE(U) ;NEGATIVE OF ACTIVE CHARS + BLT .+4 + BPT ;HAD BETTER BE NEGATIVE + MOV LEBUF(U),T ;THE BUFFER TO ACTIVATE + MOV LEFREE(U),LHFLAG(T) ;THAT ACTIVATES IT + + CHROFF + CLR LHALST(T) ;PUT THIS ONE AT END CHAIN + PUSH KBDLAST + MOV T,KBDLAST + POP T + BNE ACTIV0 ;EMPTY ACTIVATION LIST? + MOV KBDLAST,KBDACT ;YES, MAKE ACTIVE LIST POINT TO THIS ONE + BR ACTV0A +ACTIV0: MOV KBDLAST,LHALST(T) ;OLD LAST POINTS TO NEW LAST +ACTV0A: MOV KBDLAST,T ;IN ANY EVENT THIS THE ONE JUST ADDED + TST KBDFLG ;DOES THE PDP-10 WANT MORE + BNE ACTIV1 + MOV KBDACT,KBDFLG ;ACTIVATE THIS LIST + CLR KBDACT ;AND PREPARE FOR NEXT + CLR KBDLAST +ACTIV1: CHRON + + MOV LHNEXT(T),T ;NEXT ON RING + MOV #LHLEN,TT + ADD T,TT ;FIRST FREE CHARACTER + MOV T,LEBUF(U) ;NEW BUFFER + TST (T)+ ;LHFLAG IS SET AT PUTCHR + CLR (T)+ ;LHZERO +; CMP (T)+,(T)+ ;DON'T HACK LHNEXT AND LHALST + MOV TT,LECHR(U) ;FIRST FREE CHARACTER + MOV #LBCHRS,LEFREE(U) ;FREE CHARACTERS IN BUFFER +RTSPC1: RTS PC + +;HERE AT CLOCK LEVEL TO ACTIVATE BUFFER + +CLKACT: PUSH TT + PUSH U + MOV (T),U ;THE LINE EDITOR + MOV LEBUF(U),T ;THE BUFFER + TST LHFLAG(T) + BGE .+4 + BPT ;CAN'T ACTIVATE AN ALREADY ACTIVATED BUFFFER + TST @LHNEXT(T) ;THE NEXT BUFFER + BMI CLKAC1 ;ACTIVATE IF READY + CLR LHQUED(T) + JSR PC,ACTIVA +CLKAC2: POP U + POP TT + RTS PC + +CLKAC1: JSR PC,QBFR ;NOT, READY TRY ANOTHER CLOCK TICK + BR CLKAC2 + +;HERE IF NEXT BUFFER ON RING IS NOT FREE, TRY ACTIVATION AT NEXT CLOCK TICK + +QBFR: ZAPFLG LHQUED(T) ;SET FLAG THAT SAYS WE'RE QUEUED + MOV U,T ;ARG + CHROFF ;INHIBIT INTERRUPTS WHILE WE DO THIS + JSR TT,ADQUE ;PUT ON CLOCK QUEUE + 1 ;AT NEXT TICK + CLKACT ;CLOCK LEVEL ACTIVATION + CHRON + RTS PC + +;SAVE ALL ACS ON STACK + +ACSAV: PUSH TT + PUSH T + PUSH C + PUSH B + PUSH A + PUSH U ;RETURN ADDRESS + MOV 14(SP),U ;RESTORE U + RTS PC + +;GETS NEXT CHARACTER FROM DPY BUFFER +;DPY CHANNEL POINTER IN U. RETURNS SIGN-EXTENDED CHARACTER IN A, CLOBBERS TT. +;RETURNS 'EQ' IN CONDITION CODES IF NO CHARACTER PRESENT. + +GETCHR: MOV DPY11B(U),TT ;GET POINTER FOR EASE IN INCREMENTING + MOVB (TT),A ;GET NEXT CHARACTER + CMP A,#-1 ;HAS TEN PUT GOODIES THERE? + BEQ RTSPC1 ;NO + MOVB #-1,(TT) ;MARK AS TAKEN + DEC DPY11B(U) ;ADVANCE POINTER + ROR TT ;USING PDP10 BYTE ORDER (1, 0, 3, 2) + BCS GETCH1 ;BRANCH IF 1->0 OR 3->2 + ADD #4,DPY11B(U) ;0->3 OR 2->1 NEXT WORD + ROR TT + BCC GETCH1 ;BRANCH IF 0->3 + MOV DPY11B(U),TT ;OTHERWISE NEXT PDP10 WORD + DEC TT + MOV #-1,-2(TT) ;SO SET PREV ONE TO ALL -1. + MOV #-1,-4(TT) ; IN CASE OF TIMING ERROR + CMP TT,DPYLGL(U) ;PAST END OF BUFFER? + BLOS GETCH1 + MOV U,DPY11B(U) ;YES, RESET TO + ADD #DPDATA+1,DPY11B(U) ;FIRST WORD OF DATA AREA, HIGH BYTE +GETCH1: CLZ + RTS PC ;RETURN CONDITION CODE 'NE' + +;GET NEXT CHARACTER BUT IF NOT AVAILABLE DO A COROUTINE-RETURN +;FROM THE CHARACTER-READING LOOP, SO THAT WHEN THE NEXT CHARACTER +;IS READ THIS CALL WILL BE RETURNED FROM. ASSUMES THAT U CONTAINS THE +;ADDRESS OF THE CHANNEL VAR BLOCK, AND MAY RESET ALL ACS +;BUT B TO WHAT THEY HOLD AT DPYCTL. B IS ALWAYS PRESERVED. +GETCHC: JSR PC,GETCHR + BEQ GETCH2 + BIC #-400,A ;CLEAR EXTRA BITS DUE TO SIGN-EXTENSION + RTS PC + +GETCH2: MOV B,LESVB(U) + POP LECPC(U) + POP B + CMP B,#DPYXIT + BEQ GETCH3 + BPT ;CALLER OF GETCHC HAD WRONG RETURN ADDRESS +GETCH3: JMP DPYDX2 ;CEASE TYPING ON THIS TV FOR A WHILE + +.SBTTL DISPLAY FUNCTION (%TD, ETC) ROUTINES + +TVOMSK: BIC #177600,A ;HERE IF YOU DON'T TRUST THE HIGH BITS + +;TYPE CHARACTER IN A AND ADVANCE OVER IT. PRESERVES A. + +TVO: JSR PC,GENCHR ;GENERATES CHARACTER AND ADVANCES CURSOR + +;LEDADC ADVANCES LINE EDITOR CURSOR + +LEDADC: ADD #CHRWD,LEX(U) ;INCREMENT HPOS IN BITS FROM RIGHT MARGIN. + BEQ LEDAD2 ;REACHED MARGIN => WRAP AROUND. + TST LEPHS(U) ;ELSE, INCREMENT THE AUXILIARY VARIABLES. + BGT LEDAD1 + ADD #20,LEPHS(U) ;HERE IF WE ARE ADVANCING TO A NEW WORD. + ADD #2,LECC(U) + CMP LECC(U),#TVCFENCE + BLOS LEDAD1 + MOV #TVLO,LECC(U) +LEDAD1: SUB #CHRWD,LEPHS(U) + RTS PC + +LEDAD2: JMP CR + +;RETREATS LINE EDITOR CURSOR + +LEDREC: CMP LEX(U),#-BYTPL ;IF AT LEFT MARGIN, DON'T DO ANYTHING. WE COULD WRAP AROUND, + BEQ LEDRE1 ;BUT THAT'S MORE WORK, AND SHOULDN'T EVER HAPPEN ANYWAY. + ADD #CHRWD,LEPHS(U) + SUB #CHRWD,LEX(U) + CMP #<20-CHRWD>,LEPHS(U) + BGE LEDRE1 + SUB #20,LEPHS(U) ;BACKUP A WORD IN DISPLAY + SUB #2,LECC(U) + CMP LECC(U),#TVLO + BHIS LEDRE1 + BPT ;BACKING UP PAST BEGINNING OF SCREEN? +LEDRE1: RTS PC + +;HERE TO CRLF AND CLEAR EOL. +CRLF: JSR PC,CR + CMP #TVFENCE-,LELCC(U) ;IF NOW ON LAST LINE OF SCREEN, + BEQ CRLF1 ;MUST SCROLL. + JSR PC,LF ;ELSE JUST MOVE DOWN AND CLEAR A LINE. + JMP CLEOL + +CRLF1: JSR PC,SCROLL ;MOVE EVERYTHING UP 4 LINES, + JMP LF ;THEN MOVE DOWN 1 LINE. + +;SCROLL THE TEXT, MOVING THE CURSOR WITH IT, UP 4 LINES. +SCROLL: PUSH LEY(U) ;TO SCROLL, HOME UP AND DELETE 4 LINES AT SCREEN TOP. + PUSH LELCC(U) + PUSH LECC(U) + JSR PC,HU + MOV #4,A + JSR PC,LDEL0 + POP LECC(U) ;THEN RESTORE POSITION (TO LAST LINE, USUALLY) + POP LELCC(U) + POP LEY(U) + MOV LELCC(U),A + SUB #4*BYTPL*LINHT,A ;AND MOVE UP 4 LINES (OR TO SCREEN TOP). + CMP A,#TVLO + BHI SCROL1 + JMP HU + +SCROL1: MOV A,LELCC(U) + SUB #4*BYTPL*LINHT,LECC(U) + SUB #4*LINHT,LEY(U) +SCROLX: RTS PC + +;HERE TO BACKSPACE (NO-OP IF AT BEGINNING OF LINE) + +DPYBS: CMP LELCC(U),LECC(U) + BEQ SCROLX + JMP LEDREC + +;HERE TO HOME UP AND CLEAR SCREEN. + +DPYCLR: JSR PC,HU + JMP CLEOF + +;HERE FOR LINE FEED, NO FRILLS. WRAP AROUND AT SCREEN BOTTOM. +LF: ADD #,LELCC(U) + ADD #,LECC(U) + ADD #LINHT,LEY(U) + CMP #TVFENCE,LELCC(U) + BHI LF1 + SUB #TVFENCE-TVLO,LELCC(U) + SUB #TVFENCE-TVLO,LECC(U) + MOV #-NLINS,LEY(U) +LF1: RTS PC + +;HERE TO HOME UP +HU: MOV #TVLO,LELCC(U) ;RESET POINTER TO CURRENT LINE BEGINNING. + MOV #-NLINS,LEY(U) ;AND ITS POSITION ON SCREEN. + +;HERE FOR CARRIAGE RETURN +CR: MOV LELCC(U),LECC(U) ;ORIGIN OF THIS LINE +CR1: MOV #20-CHRWD,LEPHS(U) ;PHASE + MOV #-BITPL,LEX(U) ;RESET X + RTS PC + +;DELETE LINE(S). MOVE UP THE LINES BELOW THE CURRENT ONE, +;FLUSHING THE CURRENT ONE. BLANK LINES ARE SHIFTED IN AT THE BOTTOM. +LDEL: JSR PC,GETCHC ;READ NUMBER OF LINES TO DELETE IN A. +LDEL0: MOV #TVFENCE,B ;ADDRESS OF "END OF REGION" +LDEL00: MOV A,MQ + BEQ LINSX + CMP A,#50 + BHI LINS3 + MOV #BYTPL*LINHT,MUL ;GET # LINES * BYTPL*LINHT, = # BYTES TO SHIFT BY. + MOV LELCC(U),TT ;TT GETS ADDR OF THIS LINE. + MOV TT,T + ADD MQ,T ;T GETS ADDR OF LINE TO COPY INTO THIS. + BCS LDEL4 ;CARRY => T IS PAST BOTTOM OF SCREEN ALREADY. +LDEL3: CMP T,B ;NO MORE LINES AT BOTTOM TO COPY UP => + BHIS LDEL4 ; START CLEARING INSTEAD. + JSR PC,CPYCHL ;COPY THEM, INCREMENTING T AND TT TO NEXT LINES. + BR LDEL3 + +LDEL4: MOV TT,T +;CLEAR TEXT LINES FROM THE ONE T POINTS TO, TO END OF REGION IN B. PUTS CIOR IN CALU. +LDEL5: CMP T,B + BHIS LINSX ;POPJ, SETTING CALU TO CIOR. + JSR PC,CLRCHL + BR LDEL5 + +;INSERT LINE(S). MOVE THE CURRENT LINE AND LOWER ONES DOWN ONE OR MORE POSITIONS. +;BLANK LINES SHIFT IN AT THE CURRENT POSITION. +LINS: JSR PC,GETCHC ;HOW MANY LINES TO INSERT (IN A). + MOV A,MQ + BEQ LINSX ;DON'T WASTE TIME IF INSERTING 0 LINES. + CMP A,#50 ;DELETING INFINITE LINES = CLEAREOF + BHI LINS3 + MOV #BYTPL*LINHT,MUL + MOV #TVFENCE-,TT ;TT POINTS AT LAST ACTUAL LINE ON SCREEN. +LINS4: MOV TT,T + SUB MQ,T ;T IS LINE TO COPY INTO IT (COPYING DOWNWARD). + BCS LINS3 ;IF T IS ABOVE TOP OF SCREEN, GIVE UP. +LINS1: CMP LELCC(U),T ;STOP AFTER COPYING CURRENT LINE DOWN. + BHI LINS3 + JSR PC,CPYCHL ;COPY ONE LINE DOWNWARD. + SUB #2*BYTPL*LINHT,T ;THIS ADVANCES T AND TT TO NEXT LINE DOWN, + SUB #2*BYTPL*LINHT,TT ; WHEN WHAT WE WANT IS NEXT LINE UP. + BR LINS1 + +LINS3: MOV LELCC(U),T + +;CLEAR C(A) LINES OF CHARACTERS, STARTING AT THE LINE T POINTS TO, BUT STOP IF REACH END OF SCREEN. +;SETS CALU TO CIOR. +LINS2: CMP #TVFENCE,T + BLOS LINSX + JSR PC,CLRCHL + DEC A + BNE LINS2 +LINSX: MOVB #CIOR,CALU + RTS PC + +;REGION SCROLLING + +RGSCDN: JSR PC,GETCHC ;NUMBER OF LINES IN REGION + MOV A,B + JSR PC,GETCHC ;NUMBER OF LINES TO MOVE DOWN + MOV B,MQ + MOV #BYTPL*LINHT,MUL + MOV LELCC(U),TT + SUB #BYTPL*LINHT,TT + ADD MQ,TT ;ADDRESS OF LAST LINE IN REGION + BCS LINSX ;IGNORE IF GARBAGE REGION (WRAPPED AROUND ADDRESS) + CMP TT,#TVFENCE + BHIS LINSX ;IGNORE IF GARBAGE REGION + MOV A,MQ ;CONVERT DISTANCE TO MOVE TO BYTES + BEQ LINSX ;EXIT IF NOT MOVING + MOV #BYTPL*LINHT,MUL + BR LINS4 ;GO DO IT, USING INSERT-LINES SUBROUTINE + +RGSCUP: JSR PC,GETCHC ;NUMBER OF LINES IN REGION + MOV A,B + JSR PC,GETCHC ;NUMBER OF LINES TO MOVE UP + MOV B,MQ + MOV #BYTPL*LINHT,MUL + MOV LELCC(U),B + ADD MQ,B ;ADDRESS OF FIRST LINE AFTER REGION + BR LDEL00 ;GO DO IT, USING DELETE-LINES SUBROUTINE + +;INSERT CHARACTER(S). MOVE THE CURRENT CHARACTER AND FOLLOWING ONES TO THE RIGHT. +;BLANKS ARE SHOFTED IN AT THE CURRENT POSITION. +CINS: JSR PC,GETCHC ;A GETS HOW MANY CHARACTERS TO INSERT. + JSR PC,CINSET ;CHECK A FOR VALIDITY; PUSH A, LELCC(U), LINHT, AND LECC(U). +CINSL: MOV 6(SP),A + MOV (SP),T + MOV 4(SP),C + JSR PC,CINS1L + ADD #BYTPL,(SP) + ADD #BYTPL,4(SP) + DEC 2(SP) + BNE CINSL + ADD #6,SP ;FLUSH ALL BIT # CHAR POSITIONS FROM STACK. + POP B + PUSH LEX(U) + PUSH LEPHS(U) + PUSH LECC(U) +CINSC: JSR PC,CLRCHR ;NOW CLEAR OUT THE CHAR POSITIONS WE INSERTED. + JSR PC,LEDADC ;AND MOVE CURSOR PAST IT. + DEC B ;NOTE CLRCHR SETS CALU TO CIOR. + BNE CINSC + POP LECC(U) ;AND RESTORE THE CURSOR. + POP LEPHS(U) + POP LEX(U) +CINSX: RTS PC + +;INSERT C(A) CHARACTER POSITIONS IN ONE RASTER LINE AT PLACE T POINTS AT. +;C POINTS AT FRONT OF RASTER LINE. REQUIRES CALU/ CSET. +CINS1L: MOV A,MQ + MOV #CHRWD,MUL ;COMPUTE # OF BITS TO SHIFT THE LINE BY. + MOV #20,DIV ;COMPUTE # WORDS TO SHIFT IN MQ, # BITS IN AC. + MOV #20-CHRWD,TT + SUB LEPHS(U),TT ;TT GETS # BITS AT FRONT OF 1ST WORD NOT TO CHANGE. + PUSH TT + PUSH (T) ;ALSO SAVE THE WORD CONTAINING THEM. + PUSH T ;AND ITS ADDRESS + PUSH U ;FIT IN WITH WHAT CINS2 WILL POP. + MOV C,A + ADD #BYTPL,A ;A GETS ADDR TO AUTODECREMENT TO LAST WORD OF LINE. + MOV A,B + SUB MQ,B ;SUBTRACT THE # OF BYTES IN THE DESIRED # OF WORDS. + SUB MQ,B ;B GETS ADDR OF LAST WORD NOT SHIFTED INTO BIT BUCKET, + MOV -(B),TT ;TT GETS ITS CONTENTS, TO INIT THE LOOP. + MOV AC,C + NEG C ;C <= SHIFT COUNT, TO GET 1 NEW WORD FROM PAIR OF OLD. +CINS1: CMP B,T ;NOTE T STILL HAS ADDR OF LOWEST (LAST) WORD TO SHIFT + BEQ CINS3 + MOV TT,MQ + MOV -(B),TT ;FETCH ANOTHER (LOWER) OLD WORD, FROM WHICH + MOV TT,AC ;(COMBINED WITH PREVIOUS OLD WORD) + MOV C,LSH ;WE MAKE A NEW SHIFTED WORD. + MOV MQ,-(A) ;STORE THE NEXT NEW WORD. + BR CINS1 + +CINS3: MOV AC,-(A) ;REMAINDER OF LAST FROM-WORD GOES INTO LAST TO-WORD. + BR CINS2 + +;FOR INSERT/DELETE CHARACTER, CHECK ARG IN A FOR LEGALITY. MAYBE JUMP OFF +;TO CLEAR-TO-END-OF-LINE FOR INSERTING OR DELETING TOO MANY CHARACTERS. +;OTHERWISE, RETURN HAVING PUSHED ON THE STACK THE ARG, LELCC(U), #LINHT, AND LECC(U). +CINSET: POP B ;GET RET ADDR OFF STACK SO WE CAN POPJ OUR CALLER + MOV A,MQ ;OR PUSH ON HIS STACK. + BEQ CINSX ;IF ARG IS 0, OUR CALLER HAS NOTHING TO DO, SO POPJ HIM + MOV #CHRWD,MUL + MOV LEX(U),C ;AT WHAT DOT POSITION DOES REGION INSERTED/DELETED END? + ADD MQ,C + BLT .+6 ;PAST RIGHT MARGIN => THIS OPERATION EQUIVALENT + JMP CLEOL ;TO A CLEAR-TO-END-OF-LINE. + MOVB #CSET,CALU + PUSH A ;SAVE # CHAR POSITIONS TO INSERT. + PUSH LELCC(U) ;SAVE ADDR START OF 1ST RASTER LINE (ADVANCES) + PUSH #LINHT + PUSH LECC(U) ;AND ADDR OF CURSOR IN 1ST RASTER LINE. + JMP (B) ;RETURN TO OUR CALLER, HAVING PUSHED HIS TEMPS. + +;DELETE CHARACTERS. DELETE SOME CHARACTERS AFTER THE CURSOR. THE FOLLOWING ONES +;MOVE LEFT. BLANKS ARE SHOFTED IN AT THE RIGHT MARGIN. +CDEL: JSR PC,GETCHC ;A GETS HOW MANY CHARACTERS TO DELETE. + JSR PC,CINSET ;DECODE A. MAYBE POPJ OR JUMP TO CLEOL. + ;OTHERWISE, PUSH ON STACK A, LELCC(U), #LINHT, LECC(U). +CDELL: MOV 6(SP),A + MOV (SP),T + MOV 4(SP),C + JSR PC,CDEL1L + ADD #BYTPL,(SP) + ADD #BYTPL,4(SP) + DEC 2(SP) + BNE CDELL + ADD #10,SP + MOVB #CIOR,CALU +CDELX: RTS PC + +;DELETE C(A) CHARACTER POSITIONS FROM ONE RASTER LINE +;T POINTS AT WORD CONTAINING CURSOR, IN THAT RASTER LINE. +;C POINTS AT START OF THAT RASTER LINE. ASSUMES CALU/ CSET. +CDEL1L: MOV A,MQ + MOV #CHRWD,MUL ;COMPUTE # OF BITS TO SHIFT THE LINE BY. + MOV #20,DIV ;COMPUTE # WORDS TO SHIFT IN MQ, # BITS IN AC. + MOV #20-CHRWD,TT + SUB LEPHS(U),TT ;TT GETS # BITS AT FRONT OF 1ST WORD NOT TO CHANGE. + PUSH TT + PUSH (T) ;ALSO SAVE THE WORD CONTAINING THEM. + PUSH T ;AND ITS ADDRESS + MOV T,TT ;(WHICH IS ALSO ADDR TO START SHIFTING INTO). + ADD MQ,TT ;AND ADDR TO START SHIFTING FROM, AND 1ST FROM-WORD. + ADD MQ,TT ;MQ HAS # OF WORDS, BUT TT HAS AN ADDRESS. + MOV (TT)+,A + ADD #BYTPL,C ;C GETS ADDR OF 1ST WORD PAST END OF LINE. + PUSH U + MOV AC,U ;U HAS # BITS SHIFTING BY. +;NOW MAKE TO-WORDS 1 BY 1 EACH OUT OF A PAIR OF FROM-WORDS. +;THE LAST FROM-WORD IS IN A. T HAS STORE ADDRESS, TT HAS FETCH ADDRESS. +CDEL1: CMP C,TT ;STOP AFTER GOBBLING ALL OF THIS RASTER LINE. + BLOS CDEL2 + MOV (TT)+,B + MOV B,MQ ;CLOBBERS AC, SO RELOAD IT FROM T. + MOV A,AC + MOV U,LSH ;NOW SHIFT THE 2 FROM-WORDS BY # BITS SHIFTING BY, + MOV AC,(T)+ ;WHICH GIVES AC THE RIGHT STUFF FOR NEXT TO-WORD. + MOV B,A ;NOW T GETS THE NEWEST FROM-WORD, AND FETCH ANOTHER. + BR CDEL1 + +CDEL2: MOV A,MQ ;REMAINDER OF LAST FROM-WORD IS NEXT TO-WORD. + MOV U,LSH + MOV MQ,(T)+ + JSR PC,CLRRNG ;CLEAR STARTING WHERE T POINTS, ENDING WHERE C POINTS. +;NOW RESTORE THE FIRST FEW BITS OF THE FIRST WORD (WHICH WEREN'T SUPPOSED +;TO BE INCLUDED IN THE SHIFT). +CINS2: POP U + POP C ;GET ADDRESS OF 1ST TO-WORD + POP A ;GET OLD 1ST TO-WORD CONTENTS + POP T ;AND NUMBER OF BITS AT TOP NOT TO INCLUDE IN SHIFT. + MOV #-1,AC + NEG T + MOV T,LSH ;MQ GETS MASK TO BITS WE WANT SHIFTED INTO. + MOV AC,T + BIC T,A ;FLUSH THOSE IN SAVED CONTENTS. + COM T + BIC T,(C) ;FLUSH THE OTHERS IN SHIFTED CONTENTS. + BIS A,(C) ;MERGE OLD BITS WITH NEW. + RTS PC + +CLRRN1: CLR (T)+ +CLRRNG: CMP T,C + BNE CLRRN1 + RTS PC + +;CLEARS TO END OF LINE + +CLEOL: PUSH LECC(U) + PUSH LEPHS(U) + PUSH LEX(U) + JSR PC,CLEOL1 ;DO THE DIRTY WORK +CLEOX: POP LEX(U) + POP LEPHS(U) + POP LECC(U) + MOVB #CIOR,CALU ;RESTORE FOR DPYDP1 LOOP + RTS PC + +CLEOL1: MOV LEX(U),TT ;ALREADY AT END OF LINE? + BGE CLEOLX + CMP LEPHS(U),#20-CHRWD + BEQ CLEOL2 ;IF AT START OF WORD, START CLEARING WORD-WISE + JSR PC,CLRCHR ;ELSE CLEAR 1 CHAR AT A TIME TILL REACH WORD BOUNDARY. + JSR PC,LEDADC + CMP LEX(U),#-BITPL + BEQ CLEOLX ;CLEARED WHOLE LINE AND WRAPPED AROUND => DONE + BR CLEOL1 + +CLEOL2: ASR TT + ASR TT + ASR TT + ASR TT ;-(# WORDS TO CLEAR) + PUSH TT + PUSH LECC(U) ;ADDR OF 1ST WORD TO CLEAR, + PUSH #LINHT ;# LINES TO PROCESS + MOVB #CSET,CALU +CLEOL3: MOV 2(SP),T ;START CLEARING HERE +CLEOL4: CLR (T)+ + INC TT + BLT CLEOL4 + ADD #BYTPL,2(SP) + MOV 4(SP),TT ;-(# WORDS TO CLEAR) + DEC (SP) + BGT CLEOL3 + ADD #6,SP ;CLEANSE STACK + MOV T,LECC(U) + JMP CR1 ;RESET X AND PHASE + +CLEOLX: MOV LELCC(U),T + ADD #,T ;HERE IF ALREADY AT END OF LINE + MOV T,LECC(U) + JMP CR1 + +;CLEARS TO END OF SCREEN + +CLEOF: MOV LELCC(U),T ;IF AT START OF LINE, DO FAST CLEAR FROM THIS LINE. + CMP #-BYTPL,LEX(U) ;IF NOT AT BEGINNING OF LINE, USE CLEOL TO CLEAR + BEQ CLEOF1 ;ONLY THE REST OF THIS LINE. + JSR PC,CLEOL + MOV LELCC(U),T ;AND START FAST CLEAR WITH NEXT LINE. + ADD #BYTPL*LINHT,T +CLEOF1: MOV #TVFENCE,B + JMP LDEL5 + +;HERE TO FORWARD SPACE + +FS: JMP LEDADC + +;HANDLE %TDMOV +SETCUR: JSR PC,GETCHC ;OLD VERTICAL AND HORIZONTAL + JSR PC,GETCHC + +;HANDLE %TDMV0, %TDMV1 ABSOLUTE POSITIONING COMMANDS. +SETCR1: JSR PC,GETCHC ;NEW VERTICAL + MOV A,B + JSR PC,GETCHC ;NEW HORIZONTAL + ;NOTE GETCHC MAY RETURN AND BE REENTERED, + ;RESETTING ALL ACS BUT B. + +;HERE TO SET CURSOR GIVEN A COORDINATE PAIR (X,Y) IN CHARACTERS. +;X AND Y ARE IN A AND B RESPECTIVELY, (0,0) IS UPPER LEFTHAND CORNER +;(1,3) IS THE SECOND CHARACTER OF FOURTH LINE + +SETXY: CMP #CHRPL,A ;CHECK FOR LEGAL POSITION + BLOS SETXY1 + CMP #CHRLN,B + BLOS SETXY1 +SETXY0: MOV #MQ,T ;FOR THE MYRIAD MULTIPLIES AND DIVIDES + MOV B,(T)+ ;Y POSITION + MOV #BYTPL*LINHT,(T) ;FIND ORIGIN OF LINE IN MEMORY + MOV -(T),LECC(U) + MOV (T),LELCC(U) + MOV A,(T)+ ;X POSITION + MOV #CHRWD,(T) + MOV -(T),LEX(U) ;BITS FROM LEFT OF SCREEN + CLR -(T) ;CLEAR OUT AC + MOV #20,-(T) ;DIVIDE GIVES WORDS FROM LEFT AND PHASE + TST (T)+ + MOV (T)+,LEPHS(U) ;PHASE + ASL (T) ;BYTES FROM BEGIN OF LINE + ADD (T),LECC(U) ;LEAVE T POINTING AT MQ + ADD #-BITPL,LEX(U) ;THAT'S ALL DONE + NEG LEPHS(U) + ADD #20-CHRWD,LEPHS(U) ;PHASE IS SET + MOV B,(T)+ ;Y POSITION AGAIN + MOV #LINHT,(T) + MOV -(T),LEY(U) + ADD #-NLINS,LEY(U) ;LEY SET + ADD #TVLO,LECC(U) + ADD #TVLO,LELCC(U) + BIT #1,LECC(U) ;MAKE SURE IT LINES UP ON WORD BOUNDARY + BEQ .+4 + BPT +SETXY1: RTS PC + +;OUTSTR TAKES STRING TO PRINT IN B + +OUTSTR: +OUTS1: MOVB @(SP),A + INC (SP) + TST A + BEQ OUTSX + CMP #12,A + BEQ OUTSLF + CMP #15,A + BEQ OUTSCR + JSR PC,TVO + BR OUTS1 +OUTSLF: JSR PC,LF + BR OUTS1 +OUTSCR: JSR PC,CR + BR OUTS1 +OUTSX: ASR (SP) ;MAKE SURE WE RETURN TO EVEN ADDRESS + ADC (SP) + ASL (SP) + RTS PC + +;TAKES # IN A AND PRINTS AS UNSIGNED INTEGER + +OCTPNT: PUSH RADIX + MOV #10,RADIX +OCTPN1: JSR PC,DECPN0 + POP RADIX + RTS PC + +DECPNT: PUSH RADIX + MOV #10.,RADIX ;FOR DECIMAL PRINTING + BR OCTPN1 + +DECPN0: MOV A,MQ ;INTO EAE +DECPN9: MOV #AC,A ;FOR FAST ACCESS +DECPN1: MOV RADIX,-(A) ;DIVIDE BY RADIX + TST (A)+ ;POINTS AT AC + MOV (A)+,-(SP) ;REMAINDER + ADD #'0,(SP) + TST (A) ;QUOTIENT IS IN MQ + BEQ DECPN2 + CLR -(A) ;FLUSH OUT AC, LEAVING MQ UNTOUCHED + JSR PC,DECPN1 ;RECURSIVE YET! +DECPN2: POP A ;TYPE OUT THAT DIGIT + JMP TVO ;TYPES DIGIT AND ADVANCES CURSOR + +.SBTTL CALL, BREAK AND ESCAPE ROUTINES + +;LEGAL ESCAPE AND BREAK COMMAND TABLE + +ESCHAR: .BYTE '0,'1,'2,'3,'4,'5,'6,'7,'8,'9 ;DON'T DISTURB DIGITS + .BYTE 'S,'Q,'F,'D,'A,'E ;THESE CAN BE DONE ON ANY KBD +ESCSRN: .BYTE 'C,'L,'I,'R,'W,'U ;THESE NEED A SCREEN TO WIN +NESCMD==.-ESCHAR + .BYTE 0 ;MARKS END OF TABLE + .EVEN + +;DISPATCH TABLE + +ESCTAB: .REPT 10. + .NLIST + ESCDIG ;DIGIT + .LIST + .ENDR + VSWSEL ; SELECT VIDEO CHANNEL + ESCQPY ; CAUSE A HARD COPY TO EXIST + ESCFRE ; SAME AS S, BUT TO CONSOLE FREE BUFFER + ESCBUZ ; BUZZ 9TH FLOOR DOOR + ESCAUD ; SELECT AUDIO INPUT. + ESCELE ; CALL THE ELEVATOR +CHECK ESCTAB,<*2> + BOWXOR ; TOGGLE BLACK ON WHITE BIT + ESCCLR ; CLEAR SCREEN UNBEKNOWNST TO TEN. + ESCCSR ; CLEAR SCROLL REGISTER + ESCRPT ; START REPEATING THE PREV. CHAR TYPED IN. + ESCWHO ; WHO LINE CONTROL + ESCWHO ; WHO LINE CONTROL +CHECK ESCTAB,NESCMD*2 + +;HERE FOR ESCAPE + +ESCAPE: BIT #ACLBIT+AMTBIT,B + BEQ ESCAP1 ;ESCAPE WITH CONTROL OR META TURNS INTO TOP-A. + JMP BRKCLR + +ESCAP1: MOVB A,KBDESC(C) ;SAY FOLLOWING CHARS TO BE INTERPRETED AS AN ESCAPE CMD. + CLRB KBDARG(C) ;DEFAULT ARG TO ZERO +RTSPC4: RTS PC + +;ACCUMULATE ARGS FOR ESCAPE AND BREAK + +ESCDIG: ASR T ;DIGIT + MOVB KBDARG(C),A ;MULTIPLY ACCUMULATED VALUE BY 8 + ASL A + ASL A + ASL A + ADD T,A ;ADD IN NEW DIGIT + MOVB A,KBDARG(C) + INCB KBDESC(C) ;READ NEXT CHAR AS A COMMAND CHAR, NOT AS PDP-10 INPUT. + RTS PC + +;TAKES CHARACTER IN A AND CONVERTS IT UPPER CASE + +UPPER: TST A ;MAKE SURE ITS LEGAL ASCII + BLE UPPER1 + CMP #'a,A ;LOWER CASE? + BGT UPPER1 + CMP #'z,A + BLT UPPER1 + SUB #'a-'A,A ;MAKE IT UPPER CASE +UPPER1: RTS PC + +;HANDLE ESCAPE-R. WITH NO ARG, STARTS INDEFINITE REPETITION OF LAST CHARACTER TYPED. +;WITH ARG, STOPS AFTER THAT MANY REPETITIONS. IN ANY CASE, ANY USER-SUPPLIED +;INPUT STOPS THE REPETITION. +ESCRPT: MOVB KBDARG(C),A + BNE ESCRP1 + DEC A +ESCRP1: MOV A,LERPT(U) + RTS PC + +;HERE TO SELECT VIDEO SWITCH INPUT. +;C HAS 2*KBD NUMBER; KBDARG(C) HAS VSW INPUT # OR 0 => DEFAULT. + +VSWSEL: JSR PC,VSWSGO ;SET UP L.E. IDX IN U, VSW OUTPUT IN T. + BLT RTSPC4 + MOV #-1,KBDDEF(C) ;NORMALLY RESET ANY TIME-OUT, BUT + TSTB KBDARG(C) ;IF THERE'S AN ARGUMENT, + BEQ VSWSL0 + TST U + BNE VSWSL0 + JSR PC,VSWSL3 ;SET UP A TIMEOUT, IF WE ARE A FREE SCREEN. +VSWSL0: MOVB KBDARG(C),TT ;GET ARG + BNE VSWSL1 ;SELECT DEFAULT? + +;SELECT THE DEFAULT INPUT FOR A KEYBOARD. +;C HAS 2*KBD #, U HAS L.E. IDX OR 0 IF NONE, T HAS DEFAULT VSW OUTPUT OF THAT KBD. +VSWDEF: MOV #-1,KBDDEF(C) ;SAY THERE'S NO TIMEOUT ON THIS VSW SELECTION. + TST U ;FREE SCREEN => DEFAULT IS THE FREE DPY BUFFER. + BEQ VSWFRE + MOVB LECREG(U),TT ;GET DPY # TO SET DEFAULT + BLT RTSPC4 ;GARBAGE? +;COME HERE WITH DPY BUFFER # IN TT, TO SELECT THAT DPY BUFFER. +VSWDE1: ASL TT + MOV DPYVSW(TT),TT ;DEFAULT VIDEO SWITCH INPUT + JMP VSWIT ;DON'T NEED TO CHECK THIS + +;COME HERE FOR [ESC]S, WITH IN TT. +VSWSL1: BIC #-400,TT ;UNDO SIGN-EXTENSION AT VSWSL0 + CMP TT,NF11TY + BLO VSWSL2 ; TOO SMALL TO BE TTY # => IT IS VSW INPUT #. + CMP TT,#200 + BHIS VSWSL4 ; >= 200 => IT IS DPY BUFFER # PLUS 200. + TST NF11TY ;IF NF11TY ISN'T KNOWN, VSW INPUT #S LOOK LIKE TTY #S + BEQ VSWSL2 ;BUT WE ARE EVEN SMARTER AND KNOW IT'S REALLY VSW INPUT. + SUB NF11TY,TT ;ELSE SHOULD BE TTY NUMBER + CMP TT,#MAXTV + BHIS RTSPC4 ;DO NOTHING IF ARG OUT OF RANGE. + ASL TT + ASL TT + MOVB DPYKBD+1(TT),TT ;GET DPY BUFFER # FOR THIS TV, AND SELECT THAT DPY BUFFER. + BMI RTSPC4 + BR VSWDE1 + +VSWSL4: SUB #200,TT ;TT SUPPOSEDLY HAS 200 PLUS DPY BUFFER NUMBER. + CMP TT,#MAXTV + BLO VSWDE1 + BR RTSPC4 + +;COME HERE TO HANDLE SET-VSW COMMAND FROM PDP10. T HAS OUTPUT #, TT HAS INPUT #. +;IF THEY ARE ILLEGAL WE DO NOTHING. +;ON RETURN, BLO JUMPS IF THEY WERE LEGAL. +VSWCMD: MOV #-1,KBDDEF(C) ;FLUSH ANY TIME-OUT. + CMP T,#MAXVSO ;CHECK FOR LEGAL OUTPUT + BHIS RTSPC4 +;COME HERE WITH VALID OUTPUT # IN T, AND (MAYBE INVALID) INPUT # IN TT. +VSWSL2: CMP TT,#MAXVSI*VSWSEC + BHIS RTSPC4 ;REASONABLE? + JMP VSWIT ;SWITCH THE SWITCH + +ESCFRE: JSR PC,VSWSGO ;SET UP U AND T FOR VSWDE1. + BLT RTSPC5 + JSR PC,VSWSL3 ;THERE IS A TIMEOUT ON THIS SPYING. +VSWFRE: MOV DPYFRE,TT ;GET DPY # OF FREE CONSOLE SCREEN + BR VSWDE1 + +;SET UP A TIMEOUT WHEN A SPY IS ABOUT TO BE DONE. C HAS 2*KBD. +VSWSL3: MOVB #KBDTIM,KBDCNT(C) ;SET UP A TIMEOUT ON THIS KEYBOARD. + INC KBDTSW ;TELL CLOCK LEVEL TO START CHECKING TIMEOUTS. + RTS PC + +;SET UP U := L.E. IDX, OR 0 IF NONE; T HAS DEFAULT VSW OUTPUT; GIVEN 2*KBD # IN C +;NEGATIVE IF SOMETHING FUNNY IS GOING ON, AND CALLER SHOULDN'T HACK. +VSWSGO: MOV KBDLE(C),U + BLT RTSPC5 ;THIS IF TEN SELECTS NON-EXISTENT VSW OUTPUT. + BEQ VSWSG1 + TST LEKBD(U) + BLT RTSPC5 +VSWSG1: MOV C,T + ASR T + MOVB KBDVSW(T),T + RTS PC + +;DO [ESC]S ON KBD SPEC'D BY 2*KBD IN C. +VSWUNS: JSR PC,VSWSGO + BLT RTSPC5 + JMP VSWDEF + + +;HANDLE [ESC] A. +ESCAUD: MOVB KBDARG(C),TT ;ASW INPUT NUMBER. + MOV C,T + ASR T ;KEYBOARD NUMBER. + MOVB KBDASW(T),T ;OUTPUT NUMBER OF KEYBOARD. + BMI RTSPC5 ;WE DON'T KNOW YET OR IT HAS NO SPEAKER. + JMP ASWIT ;CONNECT THEM. + +;CHANGE STATE OF BOW BIT + +BOWXOR: MOVB #CXOR,CALU + MOV #BOWBIT,CSA + RTS PC + +;HERE TO CLEAR SCREEN + +ESCCLR: MOVB CREG,T ;THE SCREEN TO CLEAR + PUSH T + + BLKOFF T + JSR PC,CLBLIN ;CLEAR ALL BLINKERS + JSR PC,CLRSCR ;CLEAR THE SCREEN + POP T + BLKON T + + RTS PC + +;HERE TO RESET SCROLL REGISTER + +ESCCSR: MOVB #CSET,CALU + BIC #SAMSK,CSA ;RESET THE SCROLL REGISTER + RTS PC + +;HERE TO GENERATE VIDEO HARD COPY + +ESCQPY: TST QPYSWT ;IS THE SWITCH LOCKED? + BNE ESCQPB + TST QPYDWN ;IS THE QPY DOWN? + BNE ESCQPB +ESCQP1: MOV KBDLE(C),U + BEQ ESCQP6 + TST LEKBD(U) + BLT RTSPC5 +ESCQP6: MOV #QPYVSW,T ;THE VIDEO SWITCH OUTPUT FOR THE HARD COPY UNIT + JSR PC,VSWSL0 ;PROCESS THE ARG + CHROFF + ZAPFLG QPYSWT ;LOCK THE SWITCH + BIS #QPYKMS,KMS ;CAUSE THE COPY + JSR TT,ADQUE ;SCHEDULE THE UNCOPY + 2 + ESCQP2 + MOV CREG,T + JSR TT,ADQUE ;SCHEDULE THE SWITCH UNLOCK + QPTIME + ESCQP3 +RTSON: CHRON +RTSPC5: RTS PC + +ESCQPB: JMP BELL ;SOME ONE ELSE IS COPYING, GIVE HIM A BELL + +ESCQP2: BIC #QPYKMS,KMS ;UNCAUSE THE COPY + RTS PC + +ESCQP3: JSR PC,CLKBEL ;BELL WHEN COPY DONE + CLR QPYSWT + RTS PC + +;HERE TO BUZZ 9TH FLOOR DOOR +ESCBUZ: TST BUZSWT ;IS THE SWITCH LOCKED? + BEQ ESCBZ1 + JMP BELL +ESCBZ1: CHROFF + ZAPFLG BUZSWT ;LOCK SWITCH + BIS #BUZKMS,KMS ;BUZZ THE DOOR + MOV CREG,T + JSR TT,ADQUE ;SCHEDULE THE UNBUZZ + BUZTIM + ESCBZ2 + BR RTSON + +ESCBZ2: JSR PC,CLKBEL ;BELL WHEN BUZZ DONE + BIC #BUZKMS,KMS ;UNBUZZ THE DOOR + CLR BUZSWT ;UNLOCK THE SWITCH + RTS PC + +;HERE TO CALL THE ELEVATOR +; C HAS 2*KBD NUMBER + +ESCELE: TST ELESWT ;IS THE SWITCH LOCKED? + BEQ ESCEL1 + JMP BELL +ESCEL1: CHROFF + ZAPFLG ELESWT ;LOCK SWITCH + MOV C,T + ASR T ;DEVIDE BY 2 + CMP T,#MAXVSO ;IS IT IN RANGE? + BHIS RTSON + MOVB ELETAB(T),TT ;WHICH FLOOR IS IT ON? + SWAB TT ;GET CONSTANT INTO THE LEFT HALF WORD + BIS TT,KMS ;FROB THE CORRECT BIT + MOV CREG,T + JSR TT,ADQUE ;SCHEDULE THE UNPUSH + ELETIM + ESCEL2 + BR RTSON + + +ESCEL2: JSR PC,CLKBEL ;BELL WHEN DONE + BIC #ELEKMS,KMS ;UNPRESS + CLR ELESWT ;UNLOCK THE SWITCH + RTS PC + + + +CLKBEL: PUSH CREG ;FOR USE BY CLOCK QUEUED ROUTINES + MOV (T),CREG ;T POINTS TO DESIRED CREG + PUSH TT ;DON'T CLOBBER AT PI LEVEL!! + JSR PC,BELL + POP TT + POP CREG + RTS PC + +;HERE TO CONTROL WHO LINE + +; [ESC]W WHMODE +; N=0 TURN OFF WHO LINE -1 +; 1 FOLLOW KEYBORAD 0 +; 2 FREEZE 1 +; 3 NEXT HIGHER 2 +; 4 NEXT LOWER 3 +;ALL OTHERS SYSTEM WHO LINE + +; [ESC]U +;FREEZES WHOLINE ON JOB WHOSE USER INDEX IS N*L (L IS THE ITS SYMBOL). + +NWHCMD==5 ;NUMBER OF WHO COMMANDS + +ESCWHO: MOV LECHN(U),TT ;10/11 CHANNEL + ASL TT ;MAKE IT CHANNEL INDEX + ASL TT + MOV WHOLIN(TT),TT ;WHO LINE VARIABLES + CMPB A,#'U + BEQ ESCWHU + MOVB KBDARG(C),T ;ARGUMENT + DEC T ;HACK + BMI ESCWH2 ;TURN IT OFF? + MOV T,WHMODE(TT) ;SET THE MODE WE WANT +ESCWU1: CLR WHMOD1(TT) ;JUST TO BE SURE + MOV #-1,TENWHO ;TELL PDP-10 TO UPDATE WHO LINES + RTS PC + +;TURNS OFF WHO LINE + +ESCWH2: ;CLEAR WHO LINE AT MAIN PROGRAM LEVEL TOO + MOV T,2(TT) ;(T HAS -1 IN IT) + MOV T,WHMODE(TT) ;AND TURN IT OFF + BR CLRWHL + +ZAPWHL: MOV DPYCHN(B),A ;SET UP CREG + MOVB LECREG(A),CREG +CLRWHL: MOV #TVLO+,T + MOV #CHRHT-1,TT + JMP CLRCL0 + +ESCWHU: MOV #1,WHMODE(TT) + MOVB KBDARG(C),WHJOB(TT) + CLR WHJOB1(TT) + BR ESCWU1 + +;COME HERE FOR CALL KEY + +CALL: PUSH B + TSTB KBDCNT(C) + BLT CALL1 + JSR PC,VSWUNS ;IF DOING A SPY WITH A TIMEOUT, UNDO IT. +CALL1: MOV KBDLE(C),U ;LINE EDITOR VARIABLES + BNE UPTREE ;GET FRESH LINE EDITOR? + ASR C + JSR PC,CHCONS ;ALLOCATE A CHANNEL. +;T HAS CHANNEL NUMBER. U HAS LINE EDITOR ADDR. A HAS WHOLINE VAR BLOCK ADDR. + TST T ;-1 RETURNED AS CHANNEL # => NONE AVAILABLE. + BLT CALLLS + MOVB LECREG(U),CREG + CLR CSA ;CLRSCR SETS UP CALU + +;HERE IF CALL AND LINE EDITOR EXISTS. + +UPTREE: POP B + CLR LERPT(U) + MOV #32,A ;CONTROL-Z (SIGH) + BIS #ACTBIT,B ;ACTIVATES BUFFER + JMP PUTCHR ;SEND THAT CHARACTER TO PDP-10 + +CALLLS: POP B +RTSPC2: RTS PC + +;HERE TO ALLOCATE A DISPLAY CHANNEL. +;CALLED WITH KEYBOARD NUMBER IN C, OR -1 IF NOT ALLOCATING THIS DPY FOR A KEYBOARD. +;RETURNS THE CHANNEL NUMBER (TTY NUMBER MINUS NF11TY) IN T, +;THE LINE EDITOR BLOCK ADDR IN U, +;AND THE ADDRESS OF THE WHOLINE VARIABLE BLOCK IN A. SETS WHMODE TO 0. +;IF NO CHANNEL IS AVAILABLE, OR THE KEYBOARD CAN'T BE USED FOR SOME REASON, +;WE RETURN -1 IN T TO INDICATE THAT. + +CHCONS: MOV C,T ;IF A KEYBOARD IS SPECIFIED, + BLT CHCON4 + TSTB KBDVSW(C) ;DON'T ALLOW IT IF KEYBOARD HAS NO SCREEN + BLT CHCNFL + ASL T + TST KBDLE(T) ;OR IS ALREADY IN USE. + BNE CHCNFL +CHCON4: CLR T ;NOW FIND A FREE CHANNEL +CHCON1: TSTB CHCREG(T) ;DON'T ALLOCATE CHANNELS THAT DON'T HAVE BUFFERS. + BLT CHCON0 + TSTB CHNUSE(T) + BEQ CHCON2 +CHCON0: INC T + CMP T,#MAXTV + BLT CHCON1 +CHCNFL: MOV #-1,T + RTS PC ;NO FREE CHANNEL + +CHCON2: INCB CHNUSE(T) ;FOUND A CHANNEL. MARK IT IN USE. + DEC ITSFDP ;DECREASE COUNT OF FREE CHANNELS. + MOVB CHCREG(T),A + PUSH A ;SAVE VIDEO BUFFER NUMBER FOR POPPING INTO LECREG + MOVB A,CREG ;SELECT THAT BUFFER + PUSH T ;PROTECT T, SMASHED BY CLRSCR (TT ALSO SMASHED) + JSR PC,CLRSCR ;AND CLEAR IT (SLOW, BUT NECESSARY BEFORE SWITCHING VSW) + POP T + MOV T,A + ASL A + ASL A + MOV DPYCHN(A),U ;GET THE ADDR OF CHANNEL'S VAR BLOCK. + JSR PC,CHCLR ;PUT -1'S IN THE 10-TO-11 BUFFER, RESET POINTERS. + JSR PC,LECON2 ;INITIALIZE THE LINE EDITOR BLOCK. + MOVB (SP),DPYKBD+1(A) ;TELL THE 10 WHICH TV BUFFER. + POP LECREG(U) ;TELL THE LINE EDITOR WHICH TV BUFFER IT IS. + MOV C,LEKBD(U) ;AND WHICH KEYBOARD IT IS. + BLT CHCON3 + MOV C,CHNCLS(A) ;TELL THE 10 ABOUT THE KEYBOARD. + CLRB CHNCLS+1(A) ;MAKE SURE CHNCLS IS NON-NEGATIVE EVEN IF KBD WAS -1 + MOVB C,DPYKBD(A) + MOV T,LECHN(U) ;TELL LE WHICH DPY CHANNEL NUMBER IT IS + PUSH T ;SHOW OUR DPY BUFFER ON THE KBD'S SCREEN. + MOVB KBDVSW(C),T ;VIDEO SWITCH OUTPUT + MOVB LECREG(U),B + ASL B + MOV DPYVSW(B),TT ;GET OUR DPY'S VIDEO INPUT NUMBER. + JSR PC,VSWIT ;SWITCH THE SWITCH + MOV FBLINK,T ;CONS UP A BLINKER FOR THE CURSOR + BNE .+4 ;ARE THERE FREE BLINKERS? + BPT + + MOV BLNEXT(T),FBLINK + MOV BLINKS(B),BLNEXT(T) + MOV T,BLINKS(B) ;THE BLINKER + MOV U,BLCURS(T) ;FOLLOW PAGE PRINTER + CLRB BLON(T) ;BLON + + POP T + ASL C ;MAKE THE KEYBOARD AND THIS LINE EDITOR POINT AT EACH OTHER. + MOV U,KBDLE(C) +CHCON3: PUSH WHOLIN(A) + PUSH T + MOV T,TT + MOV LEBUF(U),T + JSR PC,CLRING ;CLEAR THE 11-TO-10 INPUT BUFFER RING. + POP T + POP A + MOV #0,WHMODE(A) + RTS PC + +;CLEAR OUT THE 10-TO-11 BUFFER WHICH U POINTS AT. + +CHCLR: MOV DPY10B(U),TT ;POINTER TO START OF BUFFER + MOV TT,DPY11B(U) ;RESET OUR POINTER INTO THE CHANNEL'S BUFFER. + INC DPY11B(U) ;MAKE POINT AT 1ST BYTE IN PDP10 ORDER! +CHCLR1: MOV #-1,(TT)+ + CMP TT,DPYLGL(U) + BLOS CHCLR1 + RTS PC + +;HERE TO INITIALIZE MOST OF THE WORDS OF A LINE EDITOR BLOCK, +;AND GET A RING OF KEYBOARD BUFFERS FOR IT. +LECON2: PUSH T + PUSH U + MOV U,TT ;SET DEFAULTS + ADD #DPSIZE+DPDATA,TT + MOV #LEDFLT+DPSIZE+DPDATA,T + MOV #LELEN-DPSIZE-DPDATA,U + JSR PC,CALCPY ;DEFAULT IS FOR FREE VARIABLES + POP U + MOV FSP,T ;FIRST FREE BUFFER + BEQ LECON3 + MOV LHFS(T),TT ;NEXT BUFFER + BEQ LECON3 + MOV LHFS(TT),FSP ;TAKE THOSE TWO + MOV T,LHNEXT(TT) + MOV TT,LHNEXT(T) ;ALL NICE AND COZY + MOV T,LEBUF(U) ;POINTER TO RING + ADD #LHLEN,T + MOV T,LECHR(U) ;BUFFER ACCESS POINTER + POP T + RTS PC + +LECON3: BPT ;NO 11-TO-10 BUFFERS AVAILABLE FOR A RING? + +;CLEARS HEADERS OF BUFFER RING, CALLED WITH RING IN T, CHN# IN TT + +CLRING: PUSH T +CLRNG1: CLR (T)+ .SEE LHFLAG + CLR (T)+ .SEE LHZERO + TST (T)+ .SEE LHNEXT + CLR (T)+ .SEE LHALST + CLR 2(T) .SEE LHFS + CLR 4(T) .SEE LHQUED + MOV TT,(T) .SEE LHCHN + TST -(T) .SEE LHALST + MOV -(T),T ;.SEE LHNEXT COMMENT THIS OUT DUE TO PALX BRAIN DAMAGE + CMP (SP),T + BNE CLRNG1 + POP T + RTS PC + +;HERE TO COPY A BLOCK OF CORE +: T SOURCE +; TT DESTINATION +; U BYTE COUNT (ONLY EVEN NUMBERS WILL WORK) + +CALCPY: INC U ;MAKE A WORD COUNT + ASR U +CALCP1: MOV (T)+,(TT)+ + DEC U + BGT CALCP1 + RTS PC + +;HERE TO RETURN DPY CHANNEL. T HAS CHANNEL NUMBER. + +CHRETN: TST T ;DON'T RETURN CHANNEL 0. + BEQ CHRET0 + DECB CHNUSE(T) ;MARK THE CHANNEL AS NOT IN USE + BGE .+4 + BPT + INC ITSFDP ;AND INCLUDE IT IN THE COUNT OF FREE CHANNELS. + BR CHRET1 + +CHRET0: MOV #377,CHNCLS ;IF FREEING THE FREE TV DISPLAY, DON'T REALLY FREE IT +CHRET1: ASL T + ASL T + MOV DPYCHN(T),U + JSR PC,CHCLR ;RESET THE 10-TO-11 BUFFER AND POINTERS. + TST T + BEQ CHRETX ;DON'T RETURN CHANNEL 0 (FREE CONSOLE DISPLAY) + MOV #-1,DPYKBD(T) ;TELL THE PDP-10 WE'RE LOGGING OUT + MOV WHOLIN(T),TT + MOV #-1,WHMODE(TT) ;TURN OFF WHO-LINE GENERATION ON THIS CHANNEL. + +;HERE TO FREE THE 11-TO-10 INPUT BUFFERS, AND MARK THE KEYBOARD AND CHANNEL +;AS DISCONNECTED. ALSO FREE THE BLINKERS. +LERETN: CLR LERPT(U) + MOV LEBUF(U),T ;RETURN BUFERS IN RING + BEQ LERT2A ;BUFFERS TO RETURN? + PUSH T +LERET1: MOV LHNEXT(T),LHFS(T) + CMP LHFS(T),(SP) + BEQ LERET2 + MOV LHFS(T),T + BR LERET1 +LERET2: MOV FSP,LHFS(T) ;CUT RING, PATCH ON TO FREE LIST + POP FSP + CLR LEBUF(U) ;MARK AS FREE +LERT2A: MOV LEKBD(U),T + BLT LERT2B ;A KEYBOARD? + ASL T ;BYTES + CLR KBDLE(T) + ASR T + MOVB KBDVSW(T),T ;VSW THE OUTPUT + BLT LERT2B + MOV DPYFRE,TT ;MESSAGE DPY + ASL TT ;BYTES + MOV DPYVSW(TT),TT + JSR PC,VSWIT ;GIVE HIM THE CONSOLE FREE MESSAGE +LERT2B: MOVB LECREG(U),T ;RETURN ALL THE BLINKERS + BLT LERET5 ;A DPY? + MOVB #-1,LECREG(U) ;INVALIDATE DPY # + ASL T + TST BELCNT(T) ;ANY BELLS PENDING? + BMI LERET6 + CLR BELCNT(T) ;THE NEXT FLASH WILL BE THE LAST +LERET6: MOV BLINKS(T),TT ;RETURN THIS DISPLAY'S BLINKERS TO FREE LIST. + BEQ LERET5 +LERET3: TST BLNEXT(TT) + BEQ LERET4 + MOV BLNEXT(TT),TT + BR LERET3 +LERET4: MOV FBLINK,BLNEXT(TT) + MOV BLINKS(T),FBLINK + CLR BLINKS(T) +LERET5: MOV #-1,LEKBD(U) +CLRUJ: CLR U ;SEARCH FAILED +CHRETX: RTS PC + +.SBTTL VIDEO AND AUDIO SWITCH ROUTINES + +;VIDEO SWITCH TABLES (ONE INPUT CAN DRIVE MANY OUTPUTS) + +;THE SWITCH IS COMPOSED OF SEVERAL IDENTICAL SECTIONS, THE CORRESPONDING +;OUTPUTS OF EACH SECTION ARE MIXED TOGETHER TO FORM THE FINAL VIDEO THAT IS +;SENT TO THE MONITOR. INPUT 0 OF EACH SECTION OF THE SWITCH IS THE NULL INPUT, +;HENCE WE USUALLY USE THAT INPUT WHEN USING A MONITOR AS A DISPLAY. + +;VSWTAB, INDEXED BY OUTPUT NUMBER, IS A BYTE GIVING THE NONNULL INPUT FEEDING THAT OUTPUT. +;THE INPUT NUMBER IS RELATIVE TO THE WHOLE SWITCH, NOT JUST THE SECTION. +;0 MEANS THAT ONLY NULL INPUTS ARE FEEDING AN OUTPUT. + +VSWTAB: .BLKB MAXVSO + + +;HERE TO SWITCH VIDEO SWITCH (OUTPUT IN T, INPUT IN TT). +;CLOBBERS NO ACS. + +VSWIT: PUSH TT + JSR PC,VSWNUL ;FLUSH ALL OTHER INPUTS TO THAT OUTPUT. + POP TT +VSWIT1: PUSH B + PUSH C + MOVB TT,VSWTAB(T) ;UPDATE OUR OWN INTERNAL TABLE. + MOV TT,MQ + MOV #MAXVSI,DIV ;DIVIDE TO TURN INPUT NUMBER + MOV MQ,C ;INTO SECTION NUMBER + MOV AC,B ;AND NUMBER WITHIN SECTION. + TST A ;CLEAR C BIT + ROR C + ROR C + ROR C + ROR C ;GET SECTION NUMBER INTO TOP THREE BITS OF WORD. + BIS C,B + MOV T,C + SWAB C + BIS C,B ;CREATE ARGUMENT FOR VIDEO SWITCH. + MOV B,VSW ;SWITCH IT! + POP C + POP B + RTS PC + +;HERE SEND NULL VIDEO TO OUTPUT SPECIFIED IN T +;CLOBBERS TT +VSWNUL: PUSH #VSWSEC ;# SECTIONS + CLR TT ;INPUT 0 IN SECTION 0. +VSWN1: JSR PC,VSWIT1 ;SWITCH IT + ADD #MAXVSI,TT ;ADVANCE TO INPUT 0 IN NEXT SECTION + DEC (SP) + BGT VSWN1 ;MORE + TST (SP)+ ;CLEANSE STACK + CLRB VSWTAB(T) ;MAKE SURE INTERNAL TABLE SAYS NOTHING FEEDING THIS OUTPUT. + RTS PC + +;AUDEO SWITCH TABLES (ONE INPUT CAN DRIVE MANY OUTPUTS) + +;INPUT 0 IS SILENCE. RIGHT NOW, THAT IS THE NORMAL SETTING FOR ANY OUTPUT. + +;ASWTAB, INDEXED BY OUTPUT NUMBER, IS A BYTE GIVING THE INPUT FEEDING THAT OUTPUT. +ASWTAB: .BLKB MAXASO + + +;GIVEN ASW OUTPUT IN T AND INPUT IN TT, CONNECT THEM IF THEY ARE LEGAL. +;ON RETURN, BLO JUMPS IF THEY WERE LEGAL. +ASWCMD: CMP T,#MAXASO + BHIS ASWITX + CMP TT,#MAXASI + BHIS ASWITX + +;HERE TO SWITCH AUDEO SWITCH (OUTPUT IN T, INPUT IN TT). +;CLOBBERS NO ACS. + +ASWIT: PUSH C + MOV T,C + SWAB C + BIS TT,C ;CONSTRUCT OUTPUT,,INPUT AND GIVE TO SWITCH AS COMMAND. + PUSH B + MOV C,B ;NOW COMPLEMENT SOME OF C (WHAT'S IN ASWXOR). + BIC #<-1>#ASWXOR,B + BIS #ASWXOR,C + BIC B,C + POP B + MOV C,ASW + MOVB TT,ASWTAB(T) ;UPDATE OUR OWN INTERNAL TABLE. + POP C +ASWITX: RTS PC + +;RESET THE AUDEO SWITCH (ALL OUTPUTS RECEIVING SILENCE). +REASW: MOV #MAXASO-1,T + CLR TT +REASW1: JSR PC,ASWIT + DEC T + BGE REASW1 + RTS PC + +.SBTTL CHARACTER GENERATOR ROUTINES + +;CLEARS CHARACTER AT LINE EDITOR CURSOR + +CLRCHR: JSR U,ACSAV + MOVB #CANDC,CALU +CLCHR1: MOV #BLOB,T ;BLOB MASKS ENTIRE CHARACTER +CLCHR2: MOV LEPHS(U),C + MOV LECC(U),TT + JSR PC,GENCH1 + MOVB #CIOR,CALU ;RESTORE FOR DPYDP1 LOOP + BR ACRES + +;BLINK CHARACTER AT CURSOR + +XORCHR: JSR U,ACSAV + MOVB #CXOR,CALU + MOV #BLOB,T + BR CLCHR2 + +;GENERATE A CHARACTER +;CALL WITH CHARACTER IN A AND PAGE PRINTER IN U +;PRESERVES ALL ACS + +GENCHR: JSR U,ACSAV + MOV LEPHS(U),C + MOV LECC(U),TT + MOVB #CIOR,CALU + ASL A ;MAKE IT A BYTE OFFSET + MOV CTAB(A),T ;POINTS AT FONT DESCRIPTION + JSR PC,GENCH1 +ACRES: POP A + POP B + POP C + POP T + POP TT + POP U + RTS PC + +;The lowest level character generator +;Initial AC settings + +;A LSH address of EAE shift counter +;B MQ address of EAE regiseter +;C number of desired shifts +;T points into font description +;TT points into display memory +;U number of bytes per line of display memory + +;initial memory settings + +;AC 0, EAE register +;CREG CIOR,,console number, console register +;;NOTE THAT MQ=AC+2 +;THIS ROUTINE CLOBBERS -ALL- ACS + +GENCH1: MOV #LSH,A + TST C + BLT OVRLAP +EZCASE: MOV #BYTPL,U + MOV #AC,B + CLR (B)+ ;CLEAR AC + +.REPT CHRHT +.NLIST + MOVB (T)+,(B) ;5.2 ;CHARACTER RASTER LINE INTO MQ + MOV C,(A) ;3.7 ;INITIATE SHIFT + MOV (B),(TT) ;5.2 ;OUT OF MQ INTO DISPLAY MEMORY + ADD U,TT ;2.3 ;GET TO NEXT RASTER LINE +; TOTAL 16.4 MICRO-SECONDS +.LIST +.ENDR + RTS PC + +;initial settings same as EZCASE with one exception +;U -2 + +OVRLAP: MOV #BYTPL-2,U + MOV #MQ+2,B + +.REPT CHRHT +.NLIST + CLR -(B) ;3.7 ;CLEAR MQ + CLRB -(B) ;2.3 ;CLEAR HIGH ORDER OF AC + MOVB (T)+,-(B) ;5.2 ;LOAD AC WITH CHARACTER LINE + MOV C,(A) ;3.7 ;INIATE SHIFT + MOV (B)+,(TT)+ ;5.2 ;AC TO DISPLAY MEMORY + MOV (B)+,(TT) ;5.2 ;MQ TO DISPLAY MEMORY + ADD U,TT ;2.3 ;SET TO NEXT RASTER LINE + ;TOTAL 27.6 MICRO-SECONDS +.LIST +.ENDR +RTSPC: RTS PC + +;SOME LOW LEVEL GOODIES + +;CLEARS ONE RASTER LINE + +CLRRST: MOVB #CSET,CALU +CLRRS1: .REPT WRDPL + .NLIST + CLR (T)+ + .LIST + .ENDR + RTS PC + +;CLEARS ONE CHARACTER LINE + +CLRCHL: MOV #LINHT-1,TT +CLRCL0: JSR PC,CLRRST +CLRCH1: JSR PC,CLRRS1 + DEC TT + BGT CLRCH1 + RTS PC + +;CLEAR ENTIRE SCREEN + +CLRSCR: MOV #TVLO,T + JSR PC,CLRRST + MOV #NLINS-1,TT +CLRSC1: JSR PC,CLRRS1 + DEC TT + BGT CLRSC1 + RTS PC + +;COPIES ONE RASTER LINE + +CPYRST: MOVB #CSET,CALU +CPYRS1: .REPT WRDPL + .NLIST + MOV (T)+,(TT)+ + .LIST + .ENDR + RTS PC + +;COPIES ONE CHARACTER LINE + +CPYCHL: PUSH A + MOV #LINHT-1,A + JSR PC,CPYRST +CPYCH1: JSR PC,CPYRS1 + DEC A + BGT CPYCH1 + POP A + RTS PC + +.SBTTL KEYBOARD TABLES + +.MACRO KBDKEY N,PLAIN,SH,SL,SLSH,TOP +.XLIST +.=XTAB+N +.BYTE PLAIN +.=XTAB+N+100 +.BYTE SH +.=XTAB+N+200 +.BYTE SL +.=XTAB+N+300 +.BYTE SLSH +.=XTAB+N+400 +.BYTE TOP +.LIST +.ENDM + +;WHAT FOLLOWS IS THE GRAND CHARACTER CONVERSION TABLE + +;AN 8 BIT QUANTITY IS USED TO INDEX INTO THE XTAB +; 0-5 KEYBOARD KEY NUMBER +; 6 SHIFT +; 7 SHIFT LOCK +; 8 TOP (6 AND 7 GUARANTEED TO BE ZERO) + +;IF THE BYTE PICKED IS NEGATIVE, YOU HAVE STRUCK A KEY THAT DOES NOT +;HAVE AN ASCII CODE. THESE CODES ARE ASSIGNED AS FOLLOWS: + +NASCTB: NONAS1 ; 0 ILLEGAL + ESCAPE ; -1 ESCAPE + BRKCLR ; -2 BREAK + BRKCLR ; -3 CLEAR + PLSMNS ; -4 PLUS-MINUS + CRCPLS ; -5 CIRCLE-PLUS + DELTA ; -6 DELTA + GAMMA ; -7 GAMMA + BRKCLR ; -10 HELP + RTSPC ; -11 BACK -- not really used + RTSPC ; -12 NEXT -- not really used + CALL ; -13 CALL +MAXNAS==<<.-NASCTB>/2>-1 ;MAXIMUM # NON-ASCII CHARACTERS + +.EVEN + +; CHAR NORMAL SHIFT LOCK SHIFT&LOCK TOP + +XTAB: +KBDKEY 0, -2, -2, -2, -2, -2 ;BREAK +KBDKEY 1, -1, -1, -1, -1, -1 ;ESCAPE +KBDKEY 2, '1, '!, '1, '!, '! +KBDKEY 3, '2, '", '2, '", '" +KBDKEY 4, '3, '#, '3, '#, '# +KBDKEY 5, '4, '$, '4, '$, '$ +KBDKEY 6, '5, '%, '5, '%, '% +KBDKEY 7, '6, '&, '6, '&, '& +KBDKEY 10, '7, '', '7, '', '' +KBDKEY 11, '8, '(, '8, '(, '( +KBDKEY 12, '9, '), '9, '), ') +KBDKEY 13, '0, '_, '0, '_, '_ +KBDKEY 14, '-, '=, '-, '=, '= +KBDKEY 15, '@, '`, '@, '`, '` +KBDKEY 16, '^, '~, '^, '~, '~ +KBDKEY 17, 10, 10, 10, 10, 10 ;BACK SPACE +KBDKEY 20, -13, -13, -13, -13, -13 ;CALL +KBDKEY 21, -3, -3, -3, -3, -3 ;CLEAR +KBDKEY 22, 11, 11, 11, 11, 11 ;TAB +KBDKEY 23, 33, 33, 33, 33, 33 ;ALT-MODE +KBDKEY 24, 'q, 'Q, 'Q, 'Q, 4, ;and +KBDKEY 25, 'w, 'W, 'W, 'W, 37 ;or +KBDKEY 26, 'e, 'E, 'E, 'E, 22 ;intersection +KBDKEY 27, 'r, 'R, 'R, 'R, 23 ;union +KBDKEY 30, 't, 'T, 'T, 'T, 20 ;subset +KBDKEY 31, 'y, 'Y, 'Y, 'Y, 21 ;superset +KBDKEY 32, 'u, 'U, 'U, 'U, 5 ;not +KBDKEY 33, 'i, 'I, 'I, 'I, 26 ;xor +KBDKEY 34, 'o, 'O, 'O, 'O, 1 ;down arrow +KBDKEY 35, 'p, 'P, 'P, 'P, 13 ;up arrow +KBDKEY 36, '[, '{, '[, '{, '{ +KBDKEY 37, '], '}, '], '}, '} +KBDKEY 40, '\, '|, '\, '|, '| +KBDKEY 41, '/, 16, '/, 16, 16 ;infinity +KBDKEY 42, -4, -6, -4, -6, -6 ;plus-minus, delta +KBDKEY 43, -5, -7, -5, -7, -7 ;circle-plus, gamma +KBDKEY 44, 14, 14, 14, 14, 14 ;form +KBDKEY 45, 13, 13, 13, 13, 13 ;vertical tab +KBDKEY 46, 177, 177, 177, 177, 177 ;rubout +KBDKEY 47, 'a, 'A, 'A, 'A, 34 ;.leq. +KBDKEY 50, 's, 'S, 'S, 'S, 35 ;.geq +KBDKEY 51, 'd, 'D, 'D, 'D, 36 ;equivalence +KBDKEY 52, 'f, 'F, 'F, 'F, 17 ;delta (partial derivative) +KBDKEY 53, 'g, 'G, 'G, 'G, 32 ;not equals +KBDKEY 54, 'h, 'H, 'H, 'H, -10 ;HELP!!!!! +KBDKEY 55, 'j, 'J, 'J, 'J, 30 ;back arrow +KBDKEY 56, 'k, 'K, 'K, 'K, 31 ;forward arrow +KBDKEY 57, 'l, 'L, 'L, 'L, 27 ;both ways arrow +KBDKEY 60,<';>, '+,<';>, '+, '+ +KBDKEY 61, ':, '*, ':, '*, '* +KBDKEY 62, 15, 15, 15, 15, 15 ;carriage return +KBDKEY 63, 12, 12, 12, 12, 12 ;line feed +KBDKEY 64, 37, 37, 37, 37, 37 ;next, back gives ^_ +;KBDKEY 64, -12, -11, -12, -11, -11 ;next, back +KBDKEY 65, 'z, 'Z, 'Z, 'Z, 2 ;alpha +KBDKEY 66, 'x, 'X, 'X, 'X, 3 ;beta +KBDKEY 67, 'c, 'C, 'C, 'C, 6 ;epsilon +KBDKEY 70, 'v, 'V, 'V, 'V, 10 ;lambda +KBDKEY 71, 'b, 'B, 'B, 'B, 7 ;pi +KBDKEY 72, 'n, 'N, 'N, 'N, 24 ;for all +KBDKEY 73, 'm, 'M, 'M, 'M, 25 ;there exists +KBDKEY 74,<',>, '<,<',>, '<, '< +KBDKEY 75, '., '>, '., '>, '> +KBDKEY 76, '/, '?, '/, '?, '? +KBDKEY 77, 40, 40, 40, 40, 40 ;space + +.SBTTL FONT MACROS AND DEFINITION + +.IIF E FONTSW,CTAB==0 +.IF NE FONTSW +FNTORG==. + .MACRO CTBENT A + .XCREF ...'A + ...'A + .ENDM + +CTAB: .REPT 200 + .NLIST + CTBENT \.RPCNT + .LIST + .ENDR + ...200 ;THIS CHAR IS A BLOB FOR CURSORS. + +.MACRO FONT A +.NLIST +....==0 +...==1_GRIDWD + +.IRPC CHR,A +...==..._<-1> +.IF NB CHR +....==....!... +.ENDC +.ENDM + +.IF NE ...-1 +ERROR \CURCHR +.ENDC + +;...FOO==%XLIST +;.REPT ...FOO +;.LIST +;.ENDR +.BYTE .... +;.XLIST +;%XLIST=...FOO +.LIST +.ENDM + +.MACRO CDEF A +.NLIST +CURCHR==''A +CDEF1 \CURCHR +.LIST +.ENDM + +.MACRO CDEF1 A +.NLIST +.XCREF ...'A +CURCHR==A +;...FOO==%XLIST +;.REPT ...FOO +;.LIST +;.ENDR +...'A==. +;.XLIST +;%XLIST=...FOO + +.LIST +.ENDM + +.MACRO ERROR NUM +.IF1 +.ERROR ;FONT LOSSAGE NUM +.ENDC +.ENDM +.ENDC +.XLIST +.IF NE FONTSW +.IF NE FONTMS +.XCREF CURCHR,FONT,CDEF1,CDEF + +CDEF1 0 +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT < *** > +FONT < *** > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 1 +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT <* * *> +FONT < *** > +FONT < * > +FONT < > +FONT < > + +CDEF1 2 +FONT < > +FONT < > +FONT < > +FONT < ** *> +FONT <* * > +FONT <* * > +FONT <* * > +FONT < ** *> +FONT < > +FONT < > + +CDEF1 3 +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <**** > +FONT <* *> +FONT <**** > +FONT <* > +FONT <* > + +CDEF1 4 +FONT < > +FONT < > +FONT < > +FONT < * > +FONT < * * > +FONT <* *> +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 5 +FONT < > +FONT < > +FONT < > +FONT < > +FONT <*****> +FONT < *> +FONT < *> +FONT < > +FONT < > +FONT < > + +CDEF1 6 +FONT < > +FONT < > +FONT < > +FONT < ** > +FONT < * > +FONT < *** > +FONT < * > +FONT < ** > +FONT < > +FONT < > + +CDEF1 7 +FONT < > +FONT < > +FONT < > +FONT <*****> +FONT < * * > +FONT < * * > +FONT < * * > +FONT < * * > +FONT < > +FONT < > + +CDEF1 10 +FONT < > +FONT < > +FONT <* > +FONT <* > +FONT < * > +FONT < * > +FONT < * * > +FONT <* *> +FONT < > +FONT < > + +CDEF1 11 +FONT < > +FONT <* *> +FONT < * * > +FONT < * > +FONT < * * > +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF1 12 +FONT < > +FONT < *** > +FONT < *> +FONT < * > +FONT < * > +FONT < * * > +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF1 13 +FONT < > +FONT < * > +FONT < *** > +FONT <* * *> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF1 14 +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT <*****> +FONT < > +FONT < > +FONT < > + +CDEF1 15 +FONT < > +FONT < > +FONT < *** > +FONT <* * *> +FONT <*****> +FONT <* * *> +FONT < *** > +FONT < > +FONT < > +FONT < > + +CDEF1 16 +FONT < > +FONT < > +FONT < > +FONT < * * > +FONT <* * *> +FONT <* * *> +FONT < * * > +FONT < > +FONT < > +FONT < > + +CDEF1 17 +FONT < > +FONT < ** > +FONT < * > +FONT < *> +FONT < ****> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF1 20 +FONT < > +FONT < > +FONT < ****> +FONT <* > +FONT <* > +FONT <* > +FONT < ****> +FONT < > +FONT < > +FONT < > + +CDEF1 21 +FONT < > +FONT < > +FONT <**** > +FONT < *> +FONT < *> +FONT < *> +FONT <**** > +FONT < > +FONT < > +FONT < > + +CDEF1 22 +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 23 +FONT < > +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 24 +FONT < > +FONT <* *> +FONT <* *> +FONT <*****> +FONT <* *> +FONT < * * > +FONT < * * > +FONT < * > +FONT < > +FONT < > + +CDEF1 25 +FONT < > +FONT <*****> +FONT < *> +FONT < *> +FONT < ****> +FONT < *> +FONT < *> +FONT <*****> +FONT < > +FONT < > + +CDEF1 26 +FONT < > +FONT < > +FONT < *** > +FONT <** **> +FONT <* * *> +FONT <** **> +FONT < *** > +FONT < > +FONT < > +FONT < > + +CDEF1 27 +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > + +CDEF1 30 +FONT < > +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT < > +FONT < > +FONT < > + +CDEF1 31 +FONT < > +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT < > +FONT < > +FONT < > + +CDEF1 32 +FONT < > +FONT < *> +FONT < * > +FONT <*****> +FONT < * > +FONT <*****> +FONT < * > +FONT <* > +FONT < > +FONT < > + +CDEF1 33 +FONT < > +FONT < * > +FONT < * > +FONT < * * > +FONT <* *> +FONT < * * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF1 34 +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < *** > +FONT < > +FONT < > + +CDEF1 35 +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < *** > +FONT < > +FONT < > + +CDEF1 36 +FONT < > +FONT < > +FONT <*****> +FONT < > +FONT <*****> +FONT < > +FONT <*****> +FONT < > +FONT < > +FONT < > + +CDEF1 37 +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT < * * > +FONT < * > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < * > +FONT < > +FONT < > + +CDEF <"> +FONT < * * > +FONT < * * > +FONT < * * > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF <#> +FONT < > +FONT < > +FONT < * * > +FONT <*****> +FONT < * * > +FONT < * * > +FONT <*****> +FONT < * * > +FONT < > +FONT < > + +CDEF <$> +FONT < * > +FONT < *** > +FONT <* * *> +FONT <* * > +FONT < *** > +FONT < * *> +FONT <* * *> +FONT < *** > +FONT < * > +FONT < > + +CDEF <%> +FONT < > +FONT <*****> +FONT <** *> +FONT < * > +FONT < * > +FONT < * > +FONT <* **> +FONT <* **> +FONT < > +FONT < > + +CDEF <&> +FONT < > +FONT < * > +FONT <* * > +FONT <* * > +FONT < * > +FONT <* * *> +FONT <* * > +FONT < ** *> +FONT < > +FONT < > + +CDEF <'> +FONT < ** > +FONT < ** > +FONT <** > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF <(> +FONT < > +FONT < *> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < *> +FONT < > +FONT < > + +CDEF <)> +FONT < > +FONT <* > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT <* > +FONT < > +FONT < > + +CDEF <*> +FONT < > +FONT < * > +FONT <* * *> +FONT < *** > +FONT < * > +FONT < *** > +FONT <* * *> +FONT < * > +FONT < > +FONT < > + +CDEF <+> +FONT < > +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT < > +FONT < > +FONT < > + +CDEF <,> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < ** > +FONT < ** > +FONT <** > +FONT < > + +CDEF <-> +FONT < > +FONT < > +FONT < > +FONT < > +FONT <*****> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF <.> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < ** > +FONT < ** > +FONT < > +FONT < > + +CDEF +FONT < > +FONT < > +FONT < *> +FONT < * > +FONT < * > +FONT < * > +FONT <* > +FONT < > +FONT < > +FONT < > + +CDEF 0 +FONT < > +FONT < *** > +FONT <* *> +FONT <* **> +FONT <* * *> +FONT <** *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF 1 +FONT < > +FONT < * > +FONT < ** > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < *** > +FONT < > +FONT < > + +CDEF 2 +FONT < > +FONT < *** > +FONT <* *> +FONT < *> +FONT < * > +FONT < * > +FONT < * > +FONT <*****> +FONT < > +FONT < > + +CDEF 3 +FONT < > +FONT < *** > +FONT <* *> +FONT < *> +FONT < ** > +FONT < *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF 4 +FONT < > +FONT < * > +FONT < ** > +FONT < * * > +FONT <* * > +FONT <*****> +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF 5 +FONT < > +FONT <*****> +FONT <* > +FONT <**** > +FONT < *> +FONT < *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF 6 +FONT < > +FONT < ** > +FONT < * > +FONT <* > +FONT <**** > +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF 7 +FONT < > +FONT <*****> +FONT < *> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF 8 +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT < *** > +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF 9 +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT < ****> +FONT < *> +FONT < * > +FONT < ** > +FONT < > +FONT < > + +CDEF <:> +FONT < > +FONT < > +FONT < > +FONT < ** > +FONT < ** > +FONT < > +FONT < ** > +FONT < ** > +FONT < > +FONT < > + +CDEF <;> +FONT < > +FONT < > +FONT < > +FONT < ** > +FONT < ** > +FONT < > +FONT < ** > +FONT < ** > +FONT <** > +FONT < > + +CDEF1 74 +FONT < > +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > +FONT < > + +CDEF <=> +FONT < > +FONT < > +FONT < > +FONT <*****> +FONT < > +FONT <*****> +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 76 +FONT < > +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > +FONT < > + +CDEF +FONT < > +FONT < *** > +FONT <* *> +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < * > +FONT < > +FONT < > + +CDEF <@> +FONT < > +FONT < *** > +FONT <* *> +FONT <* ***> +FONT <* * *> +FONT <* ***> +FONT <* > +FONT < *** > +FONT < > +FONT < > + +CDEF A +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <*****> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF B +FONT < > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <**** > +FONT <* *> +FONT <* *> +FONT <**** > +FONT < > +FONT < > + +CDEF C +FONT < > +FONT < *** > +FONT <* *> +FONT <* > +FONT <* > +FONT <* > +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF D +FONT < > +FONT <**** > +FONT < * *> +FONT < * *> +FONT < * *> +FONT < * *> +FONT < * *> +FONT <**** > +FONT < > +FONT < > + +CDEF E +FONT < > +FONT <*****> +FONT <* > +FONT <* > +FONT <**** > +FONT <* > +FONT <* > +FONT <*****> +FONT < > +FONT < > + +CDEF F +FONT < > +FONT <*****> +FONT <* > +FONT <* > +FONT <**** > +FONT <* > +FONT <* > +FONT <* > +FONT < > +FONT < > + +CDEF G +FONT < > +FONT < *** > +FONT <* *> +FONT <* > +FONT <* > +FONT <* **> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF H +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <*****> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF I +FONT < > +FONT < *** > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < *** > +FONT < > +FONT < > + +CDEF J +FONT < > +FONT < *> +FONT < *> +FONT < *> +FONT < *> +FONT < *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF K +FONT < > +FONT <* *> +FONT <* * > +FONT <* * > +FONT <** > +FONT <* * > +FONT <* * > +FONT <* *> +FONT < > +FONT < > + +CDEF L +FONT < > +FONT <* > +FONT <* > +FONT <* > +FONT <* > +FONT <* > +FONT <* > +FONT <*****> +FONT < > +FONT < > + +CDEF M +FONT < > +FONT <* *> +FONT <** **> +FONT <* * *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF N +FONT < > +FONT <* *> +FONT <* *> +FONT <** *> +FONT <* * *> +FONT <* **> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF O +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF P +FONT < > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <**** > +FONT <* > +FONT <* > +FONT <* > +FONT < > +FONT < > + +CDEF Q +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* * *> +FONT <* * > +FONT < ** *> +FONT < > +FONT < > + +CDEF R +FONT < > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <**** > +FONT <* * > +FONT <* * > +FONT <* *> +FONT < > +FONT < > + +CDEF S +FONT < > +FONT < *** > +FONT <* *> +FONT <* > +FONT < *** > +FONT < *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF T +FONT < > +FONT <*****> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF U +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF V +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < * * > +FONT < * * > +FONT < * > +FONT < > +FONT < > + +CDEF W +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* * *> +FONT <** **> +FONT <* *> +FONT < > +FONT < > + +CDEF X +FONT < > +FONT <* *> +FONT <* *> +FONT < * * > +FONT < * > +FONT < * * > +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF Y +FONT < > +FONT <* *> +FONT <* *> +FONT < * * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF Z +FONT < > +FONT <*****> +FONT < *> +FONT < * > +FONT <*****> +FONT < * > +FONT <* > +FONT <*****> +FONT < > +FONT < > + +CDEF <[> +FONT < ***> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < ***> +FONT < > + +CDEF <\> +FONT < > +FONT < > +FONT <* > +FONT < * > +FONT < * > +FONT < * > +FONT < *> +FONT < > +FONT < > +FONT < > + +CDEF <]> +FONT <*** > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT <*** > +FONT < > + +CDEF <^> +FONT < * > +FONT < * * > +FONT <* *> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF <_> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT <*****> + +CDEF <`> +FONT < ** > +FONT < ** > +FONT < **> +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF a +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT < *> +FONT < ****> +FONT <* *> +FONT < ****> +FONT < > +FONT < > + +CDEF b +FONT < > +FONT <* > +FONT <* > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <**** > +FONT < > +FONT < > + +CDEF c +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <* > +FONT <* > +FONT < ****> +FONT < > +FONT < > + +CDEF d +FONT < > +FONT < *> +FONT < *> +FONT < ****> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < ****> +FONT < > +FONT < > + +CDEF e +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <**** > +FONT <* > +FONT < *** > +FONT < > +FONT < > + +CDEF f +FONT < > +FONT < ** > +FONT < * *> +FONT < * > +FONT <*** > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF g +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < ****> +FONT < *> +FONT < *** > + +CDEF h +FONT < > +FONT <* > +FONT <* > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF i +FONT < > +FONT < > +FONT < * > +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF j +FONT < > +FONT < > +FONT < *> +FONT < > +FONT < *> +FONT < *> +FONT < *> +FONT < *> +FONT <* *> +FONT < *** > + +CDEF k +FONT < > +FONT <* > +FONT <* > +FONT <* *> +FONT <* * > +FONT <*** > +FONT <* * > +FONT <* *> +FONT < > +FONT < > + +CDEF l +FONT < > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < > +FONT < > + +CDEF m +FONT < > +FONT < > +FONT < > +FONT <** * > +FONT <* * *> +FONT <* * *> +FONT <* * *> +FONT <* * *> +FONT < > +FONT < > + +CDEF n +FONT < > +FONT < > +FONT < > +FONT <* ** > +FONT <** *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < > +FONT < > + +CDEF o +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF p +FONT < > +FONT < > +FONT < > +FONT <**** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <**** > +FONT <* > +FONT <* > + +CDEF q +FONT < > +FONT < > +FONT < > +FONT < *** > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < ****> +FONT < *> +FONT < *> + +CDEF r +FONT < > +FONT < > +FONT < > +FONT <* ** > +FONT <** *> +FONT <* > +FONT <* > +FONT <* > +FONT < > +FONT < > + +CDEF s +FONT < > +FONT < > +FONT < > +FONT < ****> +FONT <* > +FONT < *** > +FONT < *> +FONT <**** > +FONT < > +FONT < > + +CDEF t +FONT < > +FONT < * > +FONT < * > +FONT <*****> +FONT < * > +FONT < * > +FONT < * > +FONT < **> +FONT < > +FONT < > + +CDEF u +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT <* *> +FONT < *** > +FONT < > +FONT < > + +CDEF v +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < * * > +FONT < * > +FONT < > +FONT < > + +CDEF w +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT <* *> +FONT <* * *> +FONT <* * *> +FONT < * * > +FONT < > +FONT < > + +CDEF x +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT < * * > +FONT < * > +FONT < * * > +FONT <* *> +FONT < > +FONT < > + +CDEF y +FONT < > +FONT < > +FONT < > +FONT <* *> +FONT <* *> +FONT <* *> +FONT < * * > +FONT < * > +FONT < * > +FONT <* > + +CDEF z +FONT < > +FONT < > +FONT < > +FONT <*****> +FONT < * > +FONT < *** > +FONT < * > +FONT <*****> +FONT < > +FONT < > + +CDEF1 173 +FONT < *> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < *> +FONT < > + +CDEF1 174 +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > + +CDEF1 175 +FONT <* > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT <* > +FONT < > + +CDEF1 176 +FONT < ** *> +FONT <* ** > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > +FONT < > + +CDEF1 177 +FONT < * > +FONT < * *> +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT < * > +FONT <* * > +FONT < * > +FONT < > + +CDEF1 200 ;BLOB CHARACTER FOR CURSORS +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> +FONT <*****> + +.ENDC ;.IF NE FONTMS + +.IF E FONTMS +...0==. +.BYTE 000,000,000,016,016,016,000,000,000,000 +...1==. +.BYTE 000,004,004,004,004,025,016,004,000,000 +...2==. +.BYTE 000,000,000,015,022,022,022,015,000,000 +...3==. +.BYTE 000,000,000,016,021,036,021,036,020,020 +...4==. +.BYTE 000,000,000,004,012,021,000,000,000,000 +...5==. +.BYTE 000,000,000,000,037,001,001,000,000,000 +...6==. +.BYTE 000,000,000,006,010,016,010,006,000,000 +...7==. +.BYTE 000,000,000,037,012,012,012,012,000,000 +...10==. +.BYTE 000,000,020,020,010,004,012,021,000,000 +...11==. +.BYTE 000,021,012,004,012,021,021,016,000,000 +...12==. +.BYTE 000,016,001,002,004,012,021,016,000,000 +...13==. +.BYTE 000,004,016,025,004,004,004,004,000,000 +...14==. +.BYTE 000,004,004,037,004,004,037,000,000,000 +...15==. +.BYTE 000,000,016,025,037,025,016,000,000,000 +...16==. +.BYTE 000,000,000,012,025,025,012,000,000,000 +...17==. +.BYTE 000,014,002,001,017,021,021,016,000,000 +...20==. +.BYTE 000,000,017,020,020,020,017,000,000,000 +...21==. +.BYTE 000,000,036,001,001,001,036,000,000,000 +...22==. +.BYTE 000,000,016,021,021,021,000,000,000,000 +...23==. +.BYTE 000,000,021,021,021,016,000,000,000,000 +...24==. +.BYTE 000,021,021,037,021,012,012,004,000,000 +...25==. +.BYTE 000,037,001,001,017,001,001,037,000,000 +...26==. +.BYTE 000,000,016,033,025,033,016,000,000,000 +...27==. +.BYTE 000,004,002,037,002,004,010,037,010,004 +...30==. +.BYTE 000,000,004,010,037,010,004,000,000,000 +...31==. +.BYTE 000,000,004,002,037,002,004,000,000,000 +...32==. +.BYTE 000,001,002,037,004,037,010,020,000,000 +...33==. +.BYTE 000,004,004,012,021,012,004,004,000,000 +...34==. +.BYTE 000,002,004,010,004,002,000,016,000,000 +...35==. +.BYTE 000,010,004,002,004,010,000,016,000,000 +...36==. +.BYTE 000,000,037,000,037,000,037,000,000,000 +...37==. +.BYTE 000,000,000,021,012,004,000,000,000,000 +...40==. +.BYTE 000,000,000,000,000,000,000,000,000,000 +...41==. +.BYTE 000,004,004,004,004,004,000,004,000,000 +...42==. +.BYTE 012,012,012,000,000,000,000,000,000,000 +...43==. +.BYTE 000,000,012,037,012,012,037,012,000,000 +...44==. +.BYTE 004,016,025,024,016,005,025,016,004,000 +...45==. +.BYTE 000,037,031,002,004,010,023,023,000,000 +...46==. +.BYTE 000,010,024,024,010,025,022,015,000,000 +...47==. +.BYTE 014,014,030,000,000,000,000,000,000,000 +...50==. +.BYTE 000,001,002,004,004,004,002,001,000,000 +...51==. +.BYTE 000,020,010,004,004,004,010,020,000,000 +...52==. +.BYTE 000,004,025,016,004,016,025,004,000,000 +...53==. +.BYTE 000,000,004,004,037,004,004,000,000,000 +...54==. +.BYTE 000,000,000,000,000,000,014,014,030,000 +...55==. +.BYTE 000,000,000,000,037,000,000,000,000,000 +...56==. +.BYTE 000,000,000,000,000,000,014,014,000,000 +...57==. +.BYTE 000,000,001,002,004,010,020,000,000,000 +...60==. +.BYTE 000,016,021,023,025,031,021,016,000,000 +...61==. +.BYTE 000,004,014,004,004,004,004,016,000,000 +...62==. +.BYTE 000,016,021,001,002,004,010,037,000,000 +...63==. +.BYTE 000,016,021,001,006,001,021,016,000,000 +...64==. +.BYTE 000,002,006,012,022,037,002,002,000,000 +...65==. +.BYTE 000,037,020,036,001,001,021,016,000,000 +...66==. +.BYTE 000,006,010,020,036,021,021,016,000,000 +...67==. +.BYTE 000,037,001,002,002,004,004,004,000,000 +...70==. +.BYTE 000,016,021,021,016,021,021,016,000,000 +...71==. +.BYTE 000,016,021,021,017,001,002,014,000,000 +...72==. +.BYTE 000,000,000,014,014,000,014,014,000,000 +...73==. +.BYTE 000,000,000,014,014,000,014,014,030,000 +...74==. +.BYTE 000,000,002,004,010,004,002,000,000,000 +...75==. +.BYTE 000,000,000,037,000,037,000,000,000,000 +...76==. +.BYTE 000,000,010,004,002,004,010,000,000,000 +...77==. +.BYTE 000,016,021,002,004,004,000,004,000,000 +...100==. +.BYTE 000,016,021,027,025,027,020,016,000,000 +...101==. +.BYTE 000,016,021,021,037,021,021,021,000,000 +...102==. +.BYTE 000,036,021,021,036,021,021,036,000,000 +...103==. +.BYTE 000,016,021,020,020,020,021,016,000,000 +...104==. +.BYTE 000,036,011,011,011,011,011,036,000,000 +...105==. +.BYTE 000,037,020,020,036,020,020,037,000,000 +...106==. +.BYTE 000,037,020,020,036,020,020,020,000,000 +...107==. +.BYTE 000,016,021,020,020,023,021,016,000,000 +...110==. +.BYTE 000,021,021,021,037,021,021,021,000,000 +...111==. +.BYTE 000,016,004,004,004,004,004,016,000,000 +...112==. +.BYTE 000,001,001,001,001,001,021,016,000,000 +...113==. +.BYTE 000,021,022,024,030,024,022,021,000,000 +...114==. +.BYTE 000,020,020,020,020,020,020,037,000,000 +...115==. +.BYTE 000,021,033,025,021,021,021,021,000,000 +...116==. +.BYTE 000,021,021,031,025,023,021,021,000,000 +...117==. +.BYTE 000,016,021,021,021,021,021,016,000,000 +...120==. +.BYTE 000,036,021,021,036,020,020,020,000,000 +...121==. +.BYTE 000,016,021,021,021,025,022,015,000,000 +...122==. +.BYTE 000,036,021,021,036,024,022,021,000,000 +...123==. +.BYTE 000,016,021,020,016,001,021,016,000,000 +...124==. +.BYTE 000,037,004,004,004,004,004,004,000,000 +...125==. +.BYTE 000,021,021,021,021,021,021,016,000,000 +...126==. +.BYTE 000,021,021,021,021,012,012,004,000,000 +...127==. +.BYTE 000,021,021,021,021,025,033,021,000,000 +...130==. +.BYTE 000,021,021,012,004,012,021,021,000,000 +...131==. +.BYTE 000,021,021,012,004,004,004,004,000,000 +...132==. +.BYTE 000,037,001,002,037,010,020,037,000,000 +...133==. +.BYTE 007,004,004,004,004,004,004,004,007,000 +...134==. +.BYTE 000,000,020,010,004,002,001,000,000,000 +...135==. +.BYTE 034,004,004,004,004,004,004,004,034,000 +...136==. +.BYTE 004,012,021,000,000,000,000,000,000,000 +...137==. +.BYTE 000,000,000,000,000,000,000,000,000,037 +...140==. +.BYTE 006,006,003,000,000,000,000,000,000,000 +...141==. +.BYTE 000,000,000,016,001,017,021,017,000,000 +...142==. +.BYTE 000,020,020,036,021,021,021,036,000,000 +...143==. +.BYTE 000,000,000,016,021,020,020,017,000,000 +...144==. +.BYTE 000,001,001,017,021,021,021,017,000,000 +...145==. +.BYTE 000,000,000,016,021,036,020,016,000,000 +...146==. +.BYTE 000,006,011,010,034,010,010,010,000,000 +...147==. +.BYTE 000,000,000,016,021,021,021,017,001,016 +...150==. +.BYTE 000,020,020,036,021,021,021,021,000,000 +...151==. +.BYTE 000,000,004,000,004,004,004,004,000,000 +...152==. +.BYTE 000,000,001,000,001,001,001,001,021,016 +...153==. +.BYTE 000,020,020,021,022,034,022,021,000,000 +...154==. +.BYTE 000,004,004,004,004,004,004,004,000,000 +...155==. +.BYTE 000,000,000,032,025,025,025,025,000,000 +...156==. +.BYTE 000,000,000,026,031,021,021,021,000,000 +...157==. +.BYTE 000,000,000,016,021,021,021,016,000,000 +...160==. +.BYTE 000,000,000,036,021,021,021,036,020,020 +...161==. +.BYTE 000,000,000,016,021,021,021,017,001,001 +...162==. +.BYTE 000,000,000,026,031,020,020,020,000,000 +...163==. +.BYTE 000,000,000,017,020,016,001,036,000,000 +...164==. +.BYTE 000,004,004,037,004,004,004,003,000,000 +...165==. +.BYTE 000,000,000,021,021,021,021,016,000,000 +...166==. +.BYTE 000,000,000,021,021,021,012,004,000,000 +...167==. +.BYTE 000,000,000,021,021,025,025,012,000,000 +...170==. +.BYTE 000,000,000,021,012,004,012,021,000,000 +...171==. +.BYTE 000,000,000,021,021,021,012,004,010,020 +...172==. +.BYTE 000,000,000,037,002,016,010,037,000,000 +...173==. +.BYTE 001,002,002,002,004,002,002,002,001,000 +...174==. +.BYTE 004,004,004,004,004,004,004,004,004,004 +...175==. +.BYTE 020,010,010,010,004,010,010,010,020,000 +...176==. +.BYTE 015,026,000,000,000,000,000,000,000,000 +...177==. +.BYTE 002,005,004,004,004,004,004,024,010,000 +...200==. +.BYTE 037,037,037,037,037,037,037,037,037,037 +.ENDC ;.IF E FONTMS +.LIST + +BLOB=...200 ;BLOB IS THE CHAR THAT COVERS ENTIRE CHARACTER AREA. + +.IIF E FONTSW,.=.+3000 ;APPROXIMATE SIZE OF FONT + +REPORT FONT SIZE=,\.-FNTORG +FNTEND==. +.NLIST +.ENDC ;.IF NE FONTSW +.LIST + +.SBTTL LINE EDITOR AND PAGE PRINTER VARIABLES +VARORG==. + +.MACRO ...TEN +.=<.+3>&<-4> +.ENDM + +;LINE EDITOR VARIABLE BLOCK FORMAT: +;THIS DOESN'T REALLY HAVE ANYTHING TO WITH LINE-EDITING. THIS BLOCK +;CONTAINS MOST OF THE VARIABLES FOR EACH TV-CHANNEL (OR VIRTUAL TTY), +;COMBINING THE OLD IDEAS OF DPY BUFFER, LINE EDITOR, AND PAGE PRINTER. +;THERE IS ALSO A TV-BUFFER NUMBER, WHICH GOES IN THE CREG, AND INDEXES +;SOME ARRAYS ON THE LAST PAGE, A DPY CHANNEL # WHICH = A PDP10 TTY # MINUS NF11TY +;AND INDEXES SOME 11-10 SHARED ARRAYS, AND A KBD# WHICH IS A HARDWARE KEYBOARD +;NUMBER AND INDEXES SOME ARRAYS ON THE LAST PAGE. + +LEDFLT: .OFFSET -. +;FIRST COMES THE 10-TO-11 DPY OUTPUT BUFFER. NOTE THAT THE "DEFAULT VALUES +;FOR THIS PART ARE NOT USED IN INITIALIZATION. +DPY10B:: .=.+2 ;WORD PDP-10 IS HACKING (USED FOR INITIALIZATION ONLY) +DPY11B:: .=.+2 ;WORD PDP-11 IS HACKING +DPYFS1:: .=.+2 ;WASTED WORD. +DPYLGL:: .=.+2 ;HIGHEST LEGAL BUFFER CELL +DPYSIZ:: .=.+2 ;SIZE OF DATA AREA +DPYFS:: .=.+2 ;NOT USED +...TEN +DPDATA:: .BLKB DPSIZE ;DATA AREA OF BUFFER. + +LECC:: TVLO ;ADDRESS OF CURSOR +LEPHS:: 20-CHRWD ;PHASE OF CURSOR +LEX:: -BITPL ;X POSITON OF LE CURSOR +LECREG:: .BYTE -1 ;CONSOLE REGISTER FOR THIS LE DISPLAY + .BYTE 0 ;UNUSED +...TEN + +LEZER0:: 0 ;FAKE LINE BUFFER HEADER (SENT TO PDP10 IN RESPONSE TO ECOFLG) +LEZER1:: 0 +LEBUF:: 0 ;CURRENT TEXT BUFFER +LELIST:: 0 ;KEYBOARD BUFFER CHAIN +LECHN:: -1 ;DPY CHANNEL NUMBER, SET UP AT INIT TIME. +LEKBD:: -1 ;KEYBOARD DRIVING THIS LINE EDITOR +LEY:: -NLINS ;Y COORDINATE OF LINE EDITOR DISPLAY +LELCC:: TVLO ;ADDRESS OF START OF CURRENT CHARACTER LINE, IN VIDEO BUFFER. +;LEFONT:: CTAB ;FONT FOR WRITING WITH IN THIS L.E. (NOT USED) +LECPC:: 0 ;COROUTINE PC SAVED BY GETCHC. +LESVB:: 0 ;VALUE OF B SAVED OVER CALL TO GETCHC. +LEFREE:: LBCHRS ;FREE CHARACTER COUNT +LECHR:: 0 ;POINTS AT FREE CHARACTER IN BUFFER +;LEBLNK:: 0 ;LINE EDITOR BLINKER (NOT USED, THERE IS NO LINE EDITOR) +LERPT:: 0 ;0 NORMAL, -1 => INDEFINITE REPEAT, ELSE REPEAT COUNT. + ;REPEAT REFERS TO REPEAT-ACTION ON AN INPUT CHARACTER. +LELSTA:: 0 ;A AND B AT MOST RECENT CALL TO PUTCHR. +LELSTB:: 0 ;FOR THE SAKE OF REPEAT-ACTION ON INPUT. +...TEN +LELEN:: .OFFSET 0 + +;LINE EDITOR VARIABLE AREAS. + +TENWRD +;HERE WE ASSEMBLE IN THE "DPY BUFFERS". +LEUVAR: .REPT MAXTV + .+DPDATA + .-2+DPDATA + 0 + .-6+DPDATA+DPSIZE-2 + DPSIZE + 0 + .BLKB LELEN-DPDATA + .ENDR +LEUEND==. + +;THE WHO-LINE LINE EDITOR IS DIFFERENT AND APART FROM ALL THE REST + +WHOPP: .=.+LELEN + +;CLOCK QUEUE ENTRY + + .OFFSET -. ;CLOCK QUEUE ENTRY +CQNEXT:: .=.+2 ;CDR OF QUEUE +CQTIME:: .=.+2 ;HIGH ORDER OF TIME +CQTIM1:: .=.+2 ;LOW ORDER +CQROUT:: .=.+2 ;ROUTINE TO CALL AT CLOCK LEVEL +CQARG:: .=.+2 ;ARGUMENT FOR CLOCK LEVEL ROUTINE +CQLEN:: .OFFSET 0 + + + + .OFFSET -. ;LINE BUFFER HEADER AREA + ;DON'T ADD NEW VARS WITHOUT CHANGING PDP10 CODE + ;IN TT11IN. +LHFLAG:: .=.+2 ;0=>FREE, POS=>BUSY, NEG=>ACTIVE. +LHZERO:: .=.+2 ;BETTER BE ZERO SO THAT PDP-10 CAN TEST LHFLAG +LHNEXT:: .=.+2 ;NEXT BUFFER ON RING OF TWO FOR THIS TTY +LHALST:: .=.+2 ;NEXT BUFFER ON LIST OF ACTIVE BUFFERS. +LHCHN:: .=.+2 ;PDP-10 LINE NUMBER (TTY NUMBER MINUS NF11TY). +LHFS:: .=.+2 ;CHAINS FREE STORAGE BLOCKS +LHQUED:: .=.+2 ;NON-ZERO => THIS BUFFER CLOCK QUEUED FOR ACTIVATION (SEE QBFR) +...TEN +LHLEN:: .OFFSET 0 + + .OFFSET -. ;BLINKER VARIABLES +BLNEXT:: 0 ;NEXT BLINKER ON LIST +BLCURS:: 0 ;POINTS AT CURSOR VARIABLES +BLON:: .BYTE 0 ;PHASE; 0=INVISIBLE, 377=VISIBLE +BLCHAR:: .BYTE 177 ;UNUSED +BLLEN:: .OFFSET 0 + +BLKVAR: .=.+ + .EVEN + + .OFFSET -. ;USER WHO LINE +WHJOB:: .=.+2 ;job # +WHJOB1:: .=.+2 ;if negative then clear who line +WHMODE:: .=.+2 ;mode + ;-1=>who line is off + ; 0=>follow keyboard + ; 1=>freeze + ; 2=>next higher (when PDP-10 sees this state, it searches + ; user variables for next higher job index number with same + ; uname. When it finds it, it stores the number in job # + ; and changes mode to 1 + ; 3=>next lower + ;any other=>system who line +WHMOD1:: .=.+2 ;pads WHMODE +WHUNAM:: .=.+2 ;uname in sixbit (left 18 bits in first two words, right in next two) +WHUNM1:: .=.+2 +WHUNM2:: .=.+2 +WHUNM3:: .=.+2 +WHJNAM:: .=.+2 ;jname in sixbit +WHJNM1:: .=.+2 +WHJNM2:: .=.+2 +WHJNM3:: .=.+2 +WHSNAM:: .=.+2 ;sname in sixbit +WHSNM1:: .=.+2 +WHSNM2:: .=.+2 +WHSNM3:: .=.+2 +WHSTAT:: .=.+2 ;status in sixbit, 0=>job does not exist +WHSTA1:: .=.+2 +WHSTA2:: .=.+2 +WHSTA3:: .=.+2 +WHJ%RT:: .=.+2 ;job % run time +WHJTRT:: .=.+2 ;job total run time (in tenth's of seconds) +WHRPAG:: .=.+2 ;job real pages (swapped in) +WHTPAG:: .=.+2 ;job total pages +WHO1:: .=.+2 ;user who mode control word +WHO1A:: .=.+2 +WHO2:: .=.+2 ;first user who line var +WHO2A:: .=.+2 +WHO2B:: .=.+2 +WHO2C:: .=.+2 +WHO3:: .=.+2 ;second user who line var +WHO3A:: .=.+2 +WHO3B:: .=.+2 +WHO3C:: .=.+2 +...TEN + .=.+30 ;EXTRA SPACE SO NEW HACKS CAN SAFELY BE PUT IN PDP10. +WHLEN:: .OFFSET 0 + +;USER WHO LINE VARIABLES + +TENWRD + +WHVARS: .=.+ + +.SBTTL MISCELLANEOUS TABLES +MISORG==. + +;KEYBOARD/VIDEO SWITCH DEFAULTS +;INDEXED BY KBD #, GIVES NEAREST VIDEO SWITCH OUTPUT, -1=>NO DEFAULT + +KBDVSW: .BYTE 0 ; 0 809 FAHLMAN, HOLLOWAY, KNIGHT + .BYTE 23 ; 1 810 LAVIN, KUIPERS, MILLER + .BYTE 24 ; 2 919 Very Small Data Bases NORTH (FAR END) + .BYTE 20 ; 3 812 YVONNE + .BYTE 6 ; 4 813 HEWITT + .BYTE 7 ; 5 814 SUSSMAN + .BYTE 3 ; 6 808 FREILING, ULLMAN + .BYTE -1 ; 7 + .BYTE 4 ;10 817 JABARI + .BYTE -1 ;11 + .BYTE -1 ;12 + .BYTE 10 ;13 819 GOLDSTEIN + .BYTE 1 ;14 820 MINSKY + .BYTE -1 ;15 + .BYTE -1 ;16 + .BYTE 11 ;17 821A MARR + .BYTE -1 ;20 + .BYTE 2 ;21 824 RICH, DEKLEER + .BYTE 5 ;22 825 Sjoberg + .BYTE 26 ;23 826 Fredkin + .BYTE 31 ;24 815 Horn + .BYTE -1 ;25 + .BYTE -1 ;26 + .BYTE -1 ;27 + .BYTE 15 ;30 925 MOON'S REFRIGERATOR + .BYTE 16 ;31 902 TAENZER, MASON + .BYTE 17 ;32 919 Very Small Data losers + .BYTE 14 ;33 334 EDWARDS, LEBEL + .BYTE 13 ;34 913 BAISLEY, GREENBLATT + .BYTE 12 ;35 914 COHEN, GOSPER, ETC. + .BYTE 21 ;36 912 9TH FLOOR LOUNGE + .BYTE 22 ;37 907 CHESS, LISP MACHINES + .BYTE -1 ;40 906 Lisp Machines + .BYTE 37 ;41 3rd Floor #1 + .BYTE 36 ;42 3rd Floor #2 + .BYTE 35 ;43 3rd Floor #3 + .BYTE 34 ;44 3rd Floor #4 + .BYTE 33 ;45 3rd Floor #5 + .BYTE 30 ;46 3rd Floor #6 + .BYTE -1 ;47 NOT CONNECTED + .BYTE -1 ;50 NOT CONNECTED + .BYTE -1 ;51 NOT CONNECTED + .BYTE -1 ;52 NOT CONNECTED + .BYTE -1 ;53 NOT CONNECTED + .BYTE -1 ;54 NOT CONNECTED + .BYTE -1 ;55 NOT CONNECTED + .BYTE -1 ;56 NOT CONNECTED + .BYTE -1 ;57 NOT CONNECTED + .BYTE -1 ;60 NOT CONNECTED + .BYTE -1 ;61 NOT CONNECTED + .BYTE -1 ;62 NOT CONNECTED + .BYTE -1 ;63 NOT CONNECTED + .BYTE -1 ;64 NOT CONNECTED + .BYTE -1 ;65 NOT CONNECTED + .BYTE -1 ;66 NOT CONNECTED + .BYTE -1 ;67 NOT CONNECTED + .BYTE -1 ;70 NOT CONNECTED + .BYTE -1 ;71 NOT CONNECTED + .BYTE -1 ;72 NOT CONNECTED + .BYTE -1 ;73 NOT CONNECTED + .BYTE -1 ;74 NOT CONNECTED + .BYTE -1 ;75 NOT CONNECTED + .BYTE -1 ;76 NOT CONNECTED + .BYTE -1 ;77 NOT CONNECTED +CHECK KBDVSW,MAXKBD + + +;THIS TABLE SAYS WHICH FLOOR TO CALL THE ELEVATOR TO FOR E + +ELETAB: .BYTE ELKMS8 ; 0 809 FAHLMAN, HOLLOWAY, KNIGHT + .BYTE ELKMS8 ; 1 810 LAVIN, KUIPERS, MILLER + .BYTE ELKMS9 ; 2 919 Very Small Data Bases NORTH (FAR END) + .BYTE ELKMS8 ; 3 812 YVONNE + .BYTE ELKMS8 ; 4 813 HEWITT + .BYTE ELKMS8 ; 5 814 SUSSMAN + .BYTE ELKMS8 ; 6 808 FREILING, ULLMAN + .BYTE 0 ; 7 + .BYTE ELKMS8 ;10 817 JABARI + .BYTE 0 ;11 + .BYTE 0 ;12 + .BYTE ELKMS8 ;13 819 GOLDSTEIN + .BYTE ELKMS8 ;14 820 MINSKY + .BYTE 0 ;15 + .BYTE 0 ;16 + .BYTE ELKMS8 ;17 821A MARR + .BYTE 0 ;20 + .BYTE ELKMS8 ;21 824 RICH, DEKLEER + .BYTE ELKMS8 ;22 825 Sjoberg + .BYTE ELKMS8 ;23 826 Fredkin + .BYTE ELKMS8 ;24 815 Horn + .BYTE 0 ;25 + .BYTE 0 ;26 + .BYTE 0 ;27 + .BYTE ELKMS9 ;30 925 MOON'S REFRIGERATOR + .BYTE ELKMS9 ;31 902 TAENZER, MASON + .BYTE ELKMS9 ;32 919 Very Small Data losers + .BYTE 0 ;33 334 EDWARDS, LEBEL + .BYTE ELKMS9 ;34 913 BAISLEY, GREENBLATT + .BYTE ELKMS9 ;35 914 COHEN, GOSPER, ETC. + .BYTE ELKMS9 ;36 912 9TH FLOOR LOUNGE + .BYTE ELKMS9 ;37 907 CHESS, LISP MACHINES + .BYTE ELKMS9 ;40 906 Lisp Machines + .BYTE 0 ;41 NOT CONNECTED + .BYTE 0 ;42 NOT CONNECTED + .BYTE 0 ;43 NOT CONNECTED + .BYTE 0 ;44 NOT CONNECTED + .BYTE 0 ;45 NOT CONNECTED + .BYTE 0 ;46 NOT CONNECTED + .BYTE 0 ;47 NOT CONNECTED + .BYTE 0 ;50 NOT CONNECTED + .BYTE 0 ;51 NOT CONNECTED + .BYTE 0 ;52 NOT CONNECTED + .BYTE 0 ;53 NOT CONNECTED + .BYTE 0 ;54 NOT CONNECTED + .BYTE 0 ;55 NOT CONNECTED + .BYTE 0 ;56 NOT CONNECTED + .BYTE 0 ;57 NOT CONNECTED + .BYTE 0 ;60 NOT CONNECTED + .BYTE 0 ;61 NOT CONNECTED + .BYTE 0 ;62 NOT CONNECTED + .BYTE 0 ;63 NOT CONNECTED + .BYTE 0 ;64 NOT CONNECTED + .BYTE 0 ;65 NOT CONNECTED + .BYTE 0 ;66 NOT CONNECTED + .BYTE 0 ;67 NOT CONNECTED + .BYTE 0 ;70 NOT CONNECTED + .BYTE 0 ;71 NOT CONNECTED + .BYTE 0 ;72 NOT CONNECTED + .BYTE 0 ;73 NOT CONNECTED + .BYTE 0 ;74 NOT CONNECTED + .BYTE 0 ;75 NOT CONNECTED + .BYTE 0 ;76 NOT CONNECTED + .BYTE 0 ;77 NOT CONNECTED +CHECK ELETAB,MAXKBD + +;CHCREG TABLE, INDEXED BY CHANNEL NUMBER, GIVES TV BUFFER NUMBER. +;NON-WORKING TV BUFFERS SHOULD NOT BE IN THE LIST. +;IF THERE ARE MORE CHANNELS THAN BUFFERS, PUT -1 IN FOR SOME CHANNELS. + +CHCREG: .BYTE 0,1,4,5,6,7,10,11,12,13,14,15,16,17,-1,-1 + + +;VIDEO SWITCH INPUT INDEXED BY DPY #, HIGH ORDER BYTE GIVES SWITCH SECTION + +DPYVSW: 1 ; 0 + 2 ; 1 + 3 ; 2 + 4 ; 3 + 5 ; 4 + 6 ; 5 + 7 ; 6 + 10 ; 7 + 21 ;10 THESE INPUTS ARE IN SECOND SECTION + 22 ;11 + 23 ;12 + 24 ;13 + 11 ;14 1ST SECTION AGAIN + 12 ;15 + 13 ;16 + 14 ;17 +CHECK DPYVSW,MAXTV*2 + +;AUDIO SWITCH TABLES (INDEXED BY KBD #, GIVES AUDIO SWITCH OUTPUT #) + +KBDASW: .BYTE 00 ; 0 + .BYTE 01 ; 1 + .BYTE 02 ; 2 + .BYTE 03 ; 3 + .BYTE 04 ; 4 + .BYTE 05 ; 5 + .BYTE 06 ; 6 + .BYTE 07 ; 7 + .BYTE 10 ;10 + .BYTE 11 ;11 + .BYTE 12 ;12 + .BYTE 13 ;13 + .BYTE 14 ;14 + .BYTE 15 ;15 + .BYTE 16 ;16 + .BYTE 17 ;17 + .BYTE 20 ;20 + .BYTE 21 ;21 + .BYTE 22 ;22 + .BYTE 23 ;23 + .BYTE 24 ;24 + .BYTE 25 ;25 + .BYTE 26 ;26 + .BYTE 27 ;27 + .BYTE 30 ;30 + .BYTE 31 ;31 + .BYTE 32 ;32 + .BYTE 33 ;33 + .BYTE 34 ;34 + .BYTE 35 ;35 + .BYTE 36 ;36 + .BYTE 37 ;37 + .BYTE -1 ;40 + .BYTE -1 ;41 + .BYTE -1 ;42 + .BYTE -1 ;43 + .BYTE -1 ;44 + .BYTE -1 ;45 + .BYTE -1 ;46 + .BYTE -1 ;47 + .BYTE -1 ;50 + .BYTE -1 ;51 + .BYTE -1 ;52 + .BYTE -1 ;53 + .BYTE -1 ;54 + .BYTE -1 ;55 + .BYTE -1 ;56 + .BYTE -1 ;57 + .BYTE -1 ;60 + .BYTE -1 ;61 + .BYTE -1 ;62 + .BYTE -1 ;63 + .BYTE -1 ;64 + .BYTE -1 ;65 + .BYTE -1 ;66 + .BYTE -1 ;67 + .BYTE -1 ;70 + .BYTE -1 ;71 + .BYTE -1 ;72 + .BYTE -1 ;73 + .BYTE -1 ;74 + .BYTE -1 ;75 + .BYTE -1 ;76 + .BYTE -1 ;77 +CHECK KBDASW,MAXKBD + +;POINTER AREA + +TENWRD + +POINTA: ITSWHO + CMDFLG +TENWHO: 0 ;-1=>PDP-10 SHOULD UPDATE WHO LINES +TENWH1: 0 ;FILLS OUT TENWHO + MAXTV ;PUT # OF PDP-10 CHANNELS HERE FOR ITS. + 0 +NF11TY: 0 ;PDP-10 PUTS TTY # OF FIRST CHANNEL HERE. + 0 +QPYDWN: 0 ;THIS NEEDS TO BE READ BY THE 10 FOR LOCK TVQPY CMD. + 0 +.=.+10 ;LEAVE A LITTLE ROOM FOR GROWTH + +;10/11 CHANNEL HEADER AREA + +TENWRD + +CHA==. +KBDFLG: 0 ;KEYBOARD ACTIVATED LIST (SET BY 11 CLEARED BY 10) + 0 ;ALWAYS ZERO +DPYCHN: LEUVAR ;THE CHANNEL VARS BLOCK ADDR +DPYKBD: 0 ;.BYTE KBD #,DPY #, OR -1 FOR FREE CHANNEL. +.REPT MAXTV-1 + LEUVAR+<<.RPCNT+1>*LELEN> + 0 +.ENDR +ECOFLG: 0 +CHNCLS: 0 ;FLAGS DPY CHANNEL AS OPEN (SET TO -1 BY TEN) + .=.+<*4> +WHOLIN: 0 ;POINTS TO WHO LINE VARIABLES FOR THIS CHANNEL + 0 ;NOT USED + .=.+<*4> + +;PDP-10/PDP-10 COMMAND BUFFER + +TENWRD + +CMDFLG: 0 ;0=>TEN CAN WRITE, POSITIVE=>ELEVEN CAN WRITE, NEGATVE=>TEN WON + 0 ;FULL PDP-10 WORD BOUNDARY +CMDBUF: .=.+ ;EACH ARG IN COMMAND BUFFER IS PDP-10 WORD + +;SYSTEM WHO LINE + +TENWRD + +ITSWHO==. +ITSTDP: 0 ;# total # dpy's (read only for PDP-10) +ITSFDP: 0 ;# free dpys (read only for PDP-10) +ITSVER: 0 ;ITS version # +ITSJOB: 0 ;total jobs +ITSCOR: 0 ;total core +ITSRU: 0 ;runnable users +ITSWBJ: 0 ;# jobs swap blocked +ITSJWP: 0 ;# jobs waiting for pages +ITSTRC: 0 ;total runable core +ITSCFU: 0 ;core available for users +ITSDAT: 0 ;date [byte (7) year (4) month (5) day] +ITSDBG: 0 ;system debug flag +ITSTIM: 0 ;time of day (# half seconds since midnight) aligned on PDP-10 word +ITSTI1: 0 ;low order of time +ITSUSR: 0 ;total number of users +ITSFSH: 0 ;fair share in % + +.SBTTL MISCELLANEOUS VARIABLES AND FREE STORAGE + +;CHANNEL USE FLAGS NON-ZERO MEANS CHANNEL IN USE +CHNUSE: .BLKB MAXTV ;BYTES INDEXED BY DPY CHANNEL # + .EVEN + + +;BLINKERS. INDEXED BY TV-BUFFER # (CREG) +BLINKS: .BLKW MAXTV ;ADDRESS OF 1ST BLINKER OF THIS TV'S BLINKER LIST. + +BLKSWT: .BLKB MAXTV ;NONZERO => DON'T DO ANY BLINKING ON THIS TV NOW. + .EVEN + +;BELLS PENDING COUNTS. INDEXED BY TV-BUFFER # +BELCNT: .BLKW MAXTV + + +;PER-KEYBOARD INFORMATION. INDEXED BY KBD#. +KBDLE: .BLKW MAXKBD ;KEYBOARD/LINE EDITOR ASSOCIATION + +KBDESC: .BYTE 0 ;NON-ZERO => KEY HAS BEEN TYPED, READING ARG +KBDARG: .BYTE 0 ;NUMERIC ARGUMENT FOR + .=.+<*2> ;THE ABOVE TWO BYTE ARRAYS ARE INTERLEAVED. + + 0 ;THIS ZERO WORD NEEDED - SEE CLKBR5 +KBDDEF: .BYTE 0 ;DEFAULT VIDEO SOURCE FOR THIS KBD WHEN LOOKING AT ANOTHER +KBDCNT: .BYTE 0 ;COUNTDOWN UNTIL RESET TO DEFAULT VIDEO SOURCE, OR -1 + .=.+<*2> + + +;CLOCK QUEUE + +CLOCKF: 0 ;CLOCK QUEUE FREE LIST +CLOCKQ: 0 ;FIRST ENTRY ON CLOCK QUEUE +CQUEUE: .=.+ + +;MISCELLANEOUS VARIBLES + +FSP: 0 ;POINTS TO LEBUFS FREE SPACE +OLDKMA: 0 ;LAST KMA +BLINK: 0 ;TV-BUFFER # OF NEXT GUY TO BLINK. ALSO, COUNTS CLOCK TICKS + ; UNTIL NEXT BLINK. IT'S PRETTY KLUDGEY, SEE CODE AT CLKLOP. +FBLINK: BLKVAR ;LIST OF FREE BLINKERS +TICKS: 0 ;HIGH ORDER OF TIME +TICKS1: 0 ;LOW ORDER OF TIME +SSCC: .BYTE 0 ;SEMI-SLOW CLOCK COUNTER (WRAPS AROUND EVERY 256./60. SEC) + .BYTE 0 ;UNUSED +QPYSWT: 0 ;INTER LOCK TO SAVE COPY PAPER +BUZSWT: 0 ;INTERLOCK FOR BUZZING 9TH FLOOR DOOR +ELESWT: 0 ;INTERLOCKING THE ELEVATOR +RADIX: 0 ;HOLDS OUTPUT RADIX +VERSE: %FNAM2 ;SOURCE FILE VERSION # +KBDACT: 0 ;KEYBOARD ACTIVE LIST (NOT YET SEEN BY PDP-10) +KBDLAST:0 ;POINTS TO LAST BUFFER ON ACTIVE LIST +KBDTSW: 0 ;NON-ZERO => EXAMINE KBDCNT ARRAY AT SSC LEVEL. +WHOTIM: 0 ;LAST TIME WE DID WHO LINES +WHOFLG: 0 ;DO WHO LINES FLAG +DPYFRE: 0 ;DPY # OF FREE-CONSOLE CHANNEL. +TYMSHR: 0 ;# CLOCK TICKS TO GO BEFORE CHECKING NEXT DPY CHANNEL + +;PATCH AREA +PATCH: .=.+PATL + +;******* TEMPORARY VARIABLES FOR FONT CHECKSUMS ******* +CKSPNT: 0 ;RUNNING POINTER +CKSSUM: 0 ;RUNNING CHECKSUM +CKSSMG: 0 ;GOOD CHECKSUM OF [FNTORG,FNTEND) + +;LINE EDITOR BUFFER RINGS + +TENWRD +NLBUFS==/ + +.IIF LT NLBUFS-, .ERROR NOT ENOUGH LEBUFS +REPORT NLBUFS=,\NLBUFS + +LEBUFS: .=.+> + +REPORT HIGHEST USED=,\. + +.END GO diff --git a/system/utape.952 b/system/utape.952 new file mode 100644 index 0000000..9090cf3 --- /dev/null +++ b/system/utape.952 @@ -0,0 +1,2025 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +; I T S UTAPE SERVICE ROUTINE + +UTBLKS==3 + +;UT CHANNEL STORAGE + +EBLK +UTCHNT: ;BEG FOR GETSYS (UTAPE) +UTBFP: REPEAT NUTIC+NUTOC,400000,,377 ;L H BUFFER LINK PTR (INPUT PI) + ;RH " " OUTPUT MAIN PROG +UTUSR: ;USER OR -1 IF FREE (LH) +UTUL: REPEAT NUTIC+NUTOC,-1 ;LINK TO CHANNEL ON SAME UTAPE OR -1(RH) +UTDIRP: BLOCK NUTIC+NUTOC ;BYTE POINTER TO UTDIR +UTDBC: BLOCK NUTIC+NUTOC ;RH BLCK COUNT CORRESP WITH UTDIRP + ;L H 3.1 3.5 READ FILE NO 4.9 ERROR 4.5 4.8 ERROR CNT + ;3.6 =0 FORD EXT =1 BACK EXT 3.7 4.2 PUT FILE NO + ;4.4 DELETE ON READ CLOSE +UTBFS: BLOCK NUTIC+NUTOC ;BUFFERS IN USE +UTLSTM: BLOCK NUTIC+NUTOC ; TIME LAST BUF TAKEN BY PROG +UTMBN: BLOCK NUTIC+NUTOC ; MN PROG ACTIVE BFFR NO OR -1,IF NO BUFFER ACIVE (LH) +UTRAC: BLOCK NUTIC+NUTOC+1 ;ACTIVE BUFFER NO PI RH + ;FLAG TO MAIN PROG TP FULL (WRITE) RH + ;SIGN SET =>CHANNEL LOCKED + ;4.8 READ EOF REACHED AT PILEVEL OR CHNL CLOSED + ;EXTRA WORD FOR FILE DIR CHNL + ;4.7 DONT RELOAD AT PI +UTN1=.-NUTIC+1 + BLOCK NUTOC +UTN2=.-NUTIC+1 + BLOCK NUTOC ;NAME OF FILE BEING WRITTEN +UTBKNP=.-NUTIC+1 + BLOCK NUTOC +MPRP: BLOCK NUTIC+NUTOC ;MAIN PRGM BUFFER PNTR +MPRC: BLOCK NUTIC+NUTOC ;CNT REMAINING +UTTNO: BLOCK NUTOC+NUTIC ;TAPE NO (RH) + ;LH CLOSE FLAG WRITE ORG FILE NO READ +UTEOF: BLOCK NUTIC ;END OF FILE CHR + +UTLDD: BLOCK NUTIC+NUTOC+1 ;IF -1, DC IS ACTUALLY SET UP AND TRANSFER CAN + ;BE EXPECTED IN LESS TAH 100 MS. + ;IF D CHANNEL LOCKED FLAG(4.9 UTRAC) WELL BE CHECKED + ;BEFORE GOING TO THE -1 STATE + ;EXTRA WORD FOR DIR CHNL +UTDERR: BLOCK NUTIC+NUTOC+1 ;4.9 ERROR 4.8 ABORT 4.7 UTAPE FULL + +NUTCA: 0 ;NUMBER UTAPE CHANNELS ACTIVE +NUWCA: 0 ;# WRITE CHNLS ACT + +UPCHFS: 0 ;FAIR SHARE BFS PER CHNL + +LUTWBF==40 ;LENGTH OF BLK # PASSING LIST +UTWBF: REPEAT LUTWBF,.+1 ;LIST FOR PASSING BLK NOS FROM M.P. TO PI ON WRITE (INIT FS) + 0 ;TERMINATOR FOR FS LIST +UTWBFS: UTWBF ;FS PNTR + +IFNDEF MXUTBF,MXUTBF==40 ;MAX BUFFERS FOR AN INPUT CHANNEL. + +;TABLE AREAS + +DEFINE TAG A +IRPS TAGX,,A +BBLK +TAGX: 0 +EBLK +TERMIN +TERMIN + +UTCH: ;BEG FOR GETSYS (UTAPE) +TAG ULCTM:, REPEAT NUNITS,-1 ;LAST TIME EUPOS RECOMPUTED + ;IF DG2=0.E. 0 THEN ACT POS =EUPOS+*UDIR +TAG DRTM:, REPEAT NUNITS,177777,,-1 ;177777,,-1 => NO TIMING OP + ;N => DEAD RECKON UNTIL T=N + +TAG UDIR:, BLOCK NUNITS ;0=>STOP -1=>BACK 1=>FORW +IFN NEWDTP, TAG OUDIR:, BLOCK NUNITS ;DIR OF LAST OP +TAG UGOAL:, REPEAT NUNITS,-1;POSIT GOAL OR -1 IF UNIT FREE +TAG EUPOS:, BLOCK NUNITS ;ESTIMATED UNIT POSITION + ;SEE ULCTM IF DGW .NE. 1 +TAG DCHNT:, REPEAT NUNITS,-1;HEAD CHANNEL LIST OF UT OR -1 IF NO CHN ACT +TAG UMEMAD:, IFE NEWDTP,REPEAT NUNITS, BLKO DC, ;GOAL MEMADR-1 + IFN NEWDTP,REPEAT NUNITS,BLKO DTC, +TAG URDWR:, BLOCK NUNITS ;0 READ -1 WRITE(LOADED OPERATION) +TAG DG2:, REPEAT NUNITS,-1;+ => ACCURATE + ;0 => EUPOS FAIRLY ACCURATE + ;-1 => DO NOT DEAD RECKON WITHOUT UTC +TAG UTASS:, REPEAT NUNITS,0 ;0 IF NOT ASSIGNED, SYSTEM NAME IF ASSIGNED +TAG UDIRO:, REPEAT NUNITS,-1;ORGIN OF DIRECTORY +;OR -1 DIR NOT LOADED OR 4.9 DIR LOCKED OR 4.8+4.9 DIR DOUB LOCKED +;4.7 DIR CHANGED +;IF DIR LOCKED, IT MAY BE REFERENCED BUT NOT CHANGED +;4.5=0 => DIR AT LEAST ON WAY IN +;4.4=1 => TAPE IN UBLAT MODE + + +TAG UFLAPF:, BLOCK NUNITS ;4.9 FLAPPING RQSTED OR IN PROGRESS + ;4.8 RQ TO ABORT FLAPPING + ;4.7 DRIVE ACTUALLY ON THE WAY + ;4.6 (TD10 ONLY) 0 PHASE 1 STOP 1 PHASE 1 STOP DONE + ;RH TIME TO STOP AFTER FLAPPED + +TAG ULDCH:, BLOCK NUNITS ;NUMBER OF LOADED CHANNEL IN LH + ;BUFFER NO OF DIR (INDEX INTO IOBFT) IN RH + ;LH 4.9 = LOW PRIORITY POSIT + + +TAG UDPWF:, REPEAT NUNITS,-1 ;DIRECTORY PAWED OVER FLAG + +TAG UMNFB:, BLOCK NUNITS ;MAIN PRGM FREE BLOCKS ON TAPE + +TAG UTERP:, BLOCK NUNITS ;LH ERROR CODE (CONI UTS,) RH # ERRORS + +TAG UMNTR:, BLOCK NUNITS ;UNAME OF LAST JOB TO READ IN DIRECTORY + +SUNIT: 0 ;SELECTED UNIT OR 0 +IFE NEWDTP, SUNITL: 0 ;SAME _ 3 +SMODE: -1 ;-1 POSIT 0 DATA +UIDLE: -1 ;-1 UTAPES COMPLETELY IDLE + +IFN NEWDTP, CUINT: 0 ;-1 CLK HAS CAUSED BREAK +WRITE: 0 ;0 READ -1 WRITE +TAPCNT: 0 +TAP1: 0 +TAP2: 0 +TAP3: 0 +UTTM1: 0 ;UNIT COULD START IN SEARCH LOOP +UTTM2: 0 ;MOST PRESSING UNIT SO FAR +UTTM3: 0 ;TIME FOR ABOVE OR -1 IF NONEî +UTTM4: 0 ;TAPE TO START FLAPPING (FLAG FLAP IN PROG IF NEWDTP=1) +IFE NEWDTP,[ +UTTM5: 0 ;TAPE TO STOP FLAPPING +FLPUNT: 0 +] +UTENB: 0 +LUTOTM: 0 ;TIME OF LAST UT OPER +UTHERR: 0 ;UT HANGUP ERR +USTSW: 0 ;UT START SWITCH +UDCC: 0 ;-1 IF UTAPE HAVE DC FOR BLK CYCLE +UTCHE==.-1 ;END FOR GETSYS (UTAPE) + +BBLK + +;UTAPE CONTINUOUS NON-FILE IO + +AUBL2: CONO PI,UTCON ;DIRECTORY LOCKED, MAYBE ITS BEING FLAPPED + PUSHJ P,UDELAY +AUBLAT: XCTR XRW,[SKIPLE I,(J)] ;GET TAPE NUM, C(AC), SKIP IF NEG OR ZERO + CAIG I,NUNITS ;SKIP IF TOO BIG + PUSHJ P,UTSNMK ;DON'T ALLOW UTAPE HACKERY UNLESS ASSIGNED + POPJ P, ;ERR EXIT, BAD TAPE NUM + CONO PI,UTCOFF + MOVE B,UDIRO(I) + AOJE B,AUBL1 ;DIR NOT IN + TLNN B,10000 + JRST UTCONJ ;NOT IN UBLAT MODE + JUMPL B,AUBL2 +AUBL1: MOVSI B,10000 + MOVEM B,UDIRO(I) + CONO PI,UTCON + JRST POPJ1 + +;.ASSIGN - ASSIGN A DECTAPE UNIT. +AASSIGN:XCTR XR,[MOVE I,(J)] + CAILE I,NUNITS + POPJ P, + JUMPLE I,CPOPJ + MOVE A,UNAME(U) + CONO PI,CLKOFF + CAMN A,UTASS(I) + JRST CLKOJ1 + SKIPE UTASS(I) + JRST CLKONJ + MOVEM A,UTASS(I) + JRST CLKOJ1 + +ADESIGN:XCTR XR,[MOVE I,(J)] ;DEASSIGN UTAPE + CAILE I,NUNITS + POPJ P, + JUMPLE I,CPOPJ + SKIPN A,UTASS(I) + JRST POPJ1 + CAME A,UNAME(U) + POPJ P, + SETZM UTASS(I) + JRST POPJ1 + +;SET UTAPE NAME ;.UTNAM AC, ;LH(AC)=6BIT NAME, RH(AC)=TAPE # + +AUTNAM: XCTR XR,[MOVE Q,(J)] + HRRZ I,Q ;GET TAPE # + JUMPE I,CPOPJ ;TOO SMALL + CAIG I,NUNITS ;TOO LARGE? + PUSHJ P,UTSNMK ;ASSIGNED TO SOMEONE ELSE? + POPJ P, ;YES, LOSE + TLO D,1 ;SET FLAG TO EXIT FROM OPEN ROUTINE + PUSHJ P,UTO0 ;GET DIR IN CORE, LOCK, ETC. + TLNE TT,210000 ;CHECK FOR DIRECTORY NOT READ IN, UBLAT MODE + JRST LSWPOP ;JUMP ON LOSSAGE + HLRZ A,Q ;GET TAPE NAME + AOSN UDPWF(I) ;DIRECTORY PAWED OVER YET? + PUSHJ P,UDPW ;NO, GO DO IT + MOVE J,UDIRO(I) ;GET POINTER TO DIR + XOR A,177(J) ;GET DIFF BETWEEN OLD & NEW NAMES + TRNN A,-1 ;IS THERE ANY? + JRST AUTN2 ;NO, SKIP SOME CRUFT + TLZ A,-1 ;IGNORE DIFFERENCES IN LH + XORM A,177(J) ;MODIFY NAME TO NEW NAME + TLO J,100000 ;SET DIR CHANGED BIT +AUTN2: MOVEM J,UDIRO(I) ;STORE MODIFIED POINTER + JRST LSWPJ1 + +UDPW: HRRZ J,UDIRO(I) + MOVEI TT,37 + DPB TT,[370500,,177(J)] + ADD J,[500,,23.*2-1] + MOVEI TT,0 +UDPW2: ILDB Q,J + SKIPN Q + AOS TT + CAIE Q,37 + JRST UDPW2 + MOVEM TT,UMNFB(I) + POPJ P, + +;INITIALIZE UTAPE DIRECTORY ;.UINIT AC, ;C(AC)=TAPE # +;TAPE MUST BE ASSIGNED + +AUINIT: XCTR XRW,[SKIPLE I,(J)] ;TAPE # TOO LOW? + CAILE I,NUNITS ;OR HIGH? + POPJ P, ;YES + PUSHJ P,UTSNMK ;OR NOT ASSIGNED TO THIS USER + POPJ P, + TLO D,1 ;SET EXIT FLAG FOR OPEN ROUTINE + PUSHJ P,UTO0 ;GET DIR, LOCK IT, ETC. + TLNE TT,210000 ;CHECK FOR UBLAT MODE, DIRECTORY NOT READ (TT=UDIRO(I)) + JRST LSWPOP + SETZM (TT) ;CLEAR FIRST LOC + HRLI A,(TT) ;SET UP LH OF BLT POINTER + HRRI A,1(TT) ;& RH + BLT A,177(TT) ;ZAP + MOVE A,[757367573674] ;GET WORD OF 7 5-BIT BYTES VALUE 36 + MOVEM A,56(TT) ;INDICATE FIRST 7 BLOCKS RESERVED + MOVSI A,660000 ;ONE 5-BIT BYTE, VALUE 33 + MOVEM A,67(TT) ;MARK FILE DIRECTORY BLOCK + HRROS 177(TT) ;MARK END OF DIR + SETZM UDPWF(I) ;INDICATE DIR PAWED OVER + MOVEI A,559. ;# OF FREE BLOCKS IN EMPTY TAPE + MOVEM A,UMNFB(I) ;STORE FOR FUTURE REFERENCE + TLO TT,100000 ;INDICATE CHANGED + MOVEM TT,UDIRO(I) ;UPDATE POINTER + JRST LSWPJ1 + +;UTAPE DISMOUNT + +AUDISM: XCTR XRW,[MOVE A,(J)] ;OPER 22 +NFLAP: JUMPLE A,CPOPJ + CAILE A,NUNITS + POPJ P, + MOVSI C,-NUTIC-NUTOC + CONO PI,UTCOFF +AUTDM1: SKIPGE UTUSR(C) + JRST AUTDM2 + HRRZ D,UTTNO(C) + CAMN A,D + JRST UTCONJ ;SOME ONE USING TAPE +AUTDM2: AOBJN C,AUTDM1 + CONO PI,UTCON + MOVSI C,(SETZ) + IORM C,UFLAPF(A) + JRST POPJ1 + +;ATTEMPTED DIRECTORY READ GOT FLUSHED +UTOLOS: TLNE D,1 ;CHECK EXIT FLAG + JRST NULSET ;NOT .OPEN, SEIZE NOTHING AND RETURN + JRST OPNL7 ;.OPEN, SIGNAL DEVICE NOT READY + +UTOF1: MOVSI TT,200000 + IORM TT,UFLAPF(I) ;RQEST ABORT OF FLAP + CONO PI,UTCON + SKIPGE UFLAPF(I) + PUSHJ P,UFLS ;HOPE FOR BEST +UTO: PUSHJ P,UTSNMK ;MUST BE ASSIGNED + JRST NCA + JUMPE I,OPNL1 ;UTAPE OPEN + CAILE I,NUNITS + JRST OPNL1 +UTO0: CONO PI,UTCOFF + SKIPGE UFLAPF(I) + JRST UTOF1 ;FLAPPING IN PROGRESS + SKIPGE TT,UDIRO(I) + AOSE TT + JRST UTO4 ;FILE DIR IN OR ON THE WAY + MOVEI TT,200000 + MOVEM TT,DCHNT(I) + MOVE TT,UNAME(U) + MOVEM TT,UMNTR(I) ;TELL WHO FIRST CAUSED DIR TO BE READ IN + MOVSI TT,20000 + ANDCAM TT,UDIRO(I) +UTO4: CONO PI,UTCON + MOVSI TT,400000 + MOVNI T,1 + PUSHJ P,LWAIT + CAMLE T,UDIRO(I) ;WAIT FOR DIRECTORY TO COME IN OR GO OUT + IORB TT,UDIRO(I) ;IF IN THEN LOCK IT + CONO PI,UTCON + CAMN TT,[-1] + JRST UTOLOS ;DIDN'T GET READ IN + PUSHJ P,SGNSET ;MAKE SUURE DIRECTORY GETS UNLOCKED ON PCLSR + UDIRO(I) + TLNE D,1 ;CHECK SPECIAL EXIT FLAG + POPJ P, ;EXIT + TLNE TT,10000 + JRST UTOBL1 ;IN UBLAT MODE + AOSN UDPWF(I) + PUSHJ P,UDPW +UDPW1: TRNE D,200000 + JRST UTDEL1 ;DELETE OR RENAME + JUMPL D,UTOW1 ;WRITE + PUSHJ P,FLDRCK + JRST UTO5B ;NORMAL FILE WANTED + MOVEI J,0 ;UTAPE DIRECTORY WANTED + PUSHJ P,LSWPOP + JRST LISTFE ;JOIN DIRECTORY CODE FOR OTHER DEVICES + +UTOBL1: CAIN W,4 + JRST OPNL4 ;DELETE ILLEGAL IN UBLAT MODE + CLEARB A,B + JRST UTO8 + +UTO5B: PUSHJ P,UTLK3 ;MUST NOT CLOBBER TT + JUMPE B,OPNL4 +UTOW2:UTO8: CONO PI,UTCON + MOVSI TT,-NUTIC + TLNE C,1 + MOVE TT,[-NUTOC,,NUTIC] + SKIPL UTUSR(TT) + AOBJN TT,.-1 + JUMPG TT,UNCA ;NO CHANNEL AVAILABLE + CONO PI,UTCOFF + SKIPL UTUSR(TT) + JRST UTO8 + MOVEI J,DCHNT-UTUL(I) + JRST .+2 +UTO2: MOVE J,Q + HRRE Q,UTUL(J) + JUMPGE Q,UTO2 ;INSERT CHNL ONTO LIST FOR TAPE + HRLOM U,UTUSR(TT) + HRRM TT,UTUL(J) + HRRZM I,UTTNO(TT) + HRRZ J,UDIRO(I) + ADD J,A + MOVE Q,133(J) + MOVEI J,EOFCH + TRNN Q,1 + MOVEI J,141 + MOVEM J,UTEOF(TT) ;STORE EOF CHR + SETZM UTDBC(TT) + DPB A,[300500,,UTDBC(TT)] + JUMPL D,UTOW3 ;WRITE + DPB A,[220500,,UTDBC(TT)] +UTOW4: HRLM A,UTTNO(TT) + HRRZ J,UDIRO(I) + ADD J,[500,,23.*2-1] + MOVEM J,UTDIRP(TT) + MOVE J,[SETZ 377] + MOVEM J,UTBFP(TT) + CLEARM UTBFS(TT) + MOVE J,TIME + MOVEM J,UTLSTM(TT) + HRROS UTMBN(TT) + HLLOS UTRAC(TT) + HRRZS UTRAC(TT) + CONO PI,UTCON + CLEARM MPRC(TT) + AOS NUTCA + PUSHJ P,FSCMP + HRRZS UTRAC(TT) + PUSHJ P,LSWPOP ;RELEASE FILE DIR + MOVSS C + HRL A,TT + JSP Q,OPSLC7 + DNUACII,,DNUACCO ;ASCII UNITS INPUT ;ASCII UNITS OUTPUT + DNUBKI,,DNUBKO ;BLOCK INPUT ;BLOCK OUTPUT + DNUDTI,,DNUDTO ;WORD INPUT ;WORD OUTPUT + DNUBKI,,DNUBKO ;BLOCK INPUT ;BLOCK OUTPUT + +UTOW1: SKIPN UMNFB(I) + JRST OPNL6 ;FULL + PUSH P,B + PUSH P,A + PUSHJ P,UTSNMK + JRST UTWNA ;NOT ASSIGNED + SETZB A,B + PUSHJ P,UTLK3 + JUMPE B,UFILDF ;FILE DIR FULL + JRST UTOW2 + +UTSNMK: SKIPN T,UTASS(I) ;TAPE MUST BE ASSIGNED TO THIS LOSER + POPJ P, + CAME T,UNAME(U) + CAMN T,USYSN1(U) + AOS (P) + POPJ P, + +UTOW3: HRROM TT,1(B) ;RESERVE FILE NAME + POP P,UTN1(TT) ;STORE NAMES + POP P,UTN2(TT) + MOVSI J,100000 + IORM J,UDIRO(I) ;SET FILE DIR MODIFYED + MOVSI J,UTBKNP(TT) ;GET LIST PNTR PNTR + MOVEM J,UTBKNP(TT) ;MAKE LH SELF-REFERENT SO INIT LINK WILL GO IN RH + AOS NUWCA ;INCR # ACT UWRITE CHNLS + JRST UTOW4 + +UNCA: JUMPGE D,NCA +UTWNA: SUB P,[2,,2] +NCA: JRST OPNL10 + +UFILDF: SUB P,[2,,2] +FILDF: JRST OPNL5 + +S1NL14: SUB P,[1,,1] + JRST OPNL14 + +UDATAI: SKIPA E,[444400,,1] +UASCII: MOVE E,[440700,,5] + MOVEI B,UBLKI2 + JRST CHRKTI + +UBLKI: MOVE E,[444400,,1] + JSP B,BLKT +UBLKI2: MPRP(A) + MPRC(A) + UTBGB ;4.9 = 0 UTAPE 1 DISK + UTBRB + JRST 4,. + SKIPG UTBFS(A) + +;INPUT BLK BUFFER-GET RTN + +UTBGB: LDB Q,[IOLO,,UTBFP(A)] + CAIN Q,377 + JRST 4,. ;PNTRS OUT OF PHASE + CAIN Q,376 + JRST POPJ2 ;END OF FILE + CONO PI,UTCOFF + SKIPL UTRAC(A) + SKIPGE IOBFT(Q) + JRST UTBGB1 + LDB J,[IOLO,,IOBFT(Q)] + HRRM J,UTBFP(A) + MOVEI TT,(SETZ) + CAIL J,376 + HRLM TT,UTBFP(A) + CONO PI,UTCON + SOS UTBFS(A) +UTBWG4: MOVE J,TIME + MOVEM J,UTLSTM(A) + MOVEI J,-3 + DPB J,[IOLO,,IOBFT(Q)] + LDB TT,[IOSA,,IOBFT(Q)] + LSH TT,6 + HLL TT,E + MOVEM TT,MPRP(A) + MOVEI TT,200 + IMULI TT,(E) + MOVEM TT,MPRC(A) + HRLM Q,UTMBN(A) + JRST POPJ1 + +UTBGB1: CONO PI,UTCON + SKIPL IOBFT(Q) + SKIPGE UTRAC(A) + PUSHJ P,UFLS ;REALLY? + JRST UTBGB + +UBLKO: MOVE E,[444400,,1] + JSP B,BLKT +UBLKO2: SETZ MPRP(A) + MPRC(A) + UTBWG + UTBWW + JRST 4,. + TRNA + +UASCCO: SKIPA E,[440700,,5] +UDATAO: MOVE E,[444400,,1] + MOVEI B,UBLKO2 + JRST CHRKTO + +;OUTPUT BLKT BUFFER-GET RTN + +UTBWG: MOVE Q,UTBFS(A) ;GET # BUFS IN CHNL + IMUL Q,NUWCA ;SCALE TO # ACT UWRITE CHNLS + CAIL Q,LUTWBF ;IF BEING TOO GREEDY WITH BLOCK LIST SPACE + POPJ P, ;LOSE + PUSH P,A + PUSH P,B + MOVE D,A + HRRZ Q,UTBFP(D) + CAIL Q,376 + JRST UTBWG1 ;NO BUFS NOW RELOAD + SKIPGE UTDBC(D) + JRST POPBAJ ;CHNL IN ERR + +UTBWG2: HRRZ J,UTBFS(D) + CAMG J,UPCHFS + JRST UTBWG1 + PUSHJ P,TCALL + JRST UIMRQ + JRST POPBAJ + PUSHJ P,TCALL + JRST UTMGB + JRST UTBWG2 + +UTBWG1: HRRZ Q,UTTNO(D) + SOSGE UMNFB(Q) + JRST UTBWG5 + PUSHJ P,AOSSET + UMNFB(Q) + PUSHJ P,LSWTL ;WAIT FOR + UDIRO(Q) ;DIR TO UNLOCK + PUSH P,E ;SAVE E + PUSHJ P,TCALL + JRST IUTCONS + JRST UTBWG6 + PUSH P,A ;SAVE A + PUSH P,B + PUSH P,C + MOVE C,Q + MOVE B,UDIRO(C) + MOVEI E,0 ;INDICATE ADVANCE TO UDIRAD + PUSHJ P,UDOUT2 ;ADV DIR PNTRS (SKIP LOCK CHECK IN UDIRAD) + JRST 4,. ;SHOULDN'T GET HERE + JRST UTPFUL ;NO ROOM FOR EXT + PUSHJ P,LSWPOP ;UNLOCK DIR + PUSHJ P,LSWDEL ;UNHACK UTFAOS + POP P,C + POP P,B + POP P,Q ;GET BACK BUF # + POP P,E ;RESTORE E + POP P,B + POP P,A + AOS UTBFS(A) + JRST UTBWG4 + +UTBWG5: AOS UMNFB(Q) + JRST IOCER9 + +UTBWG6: PUSHJ P,LSWCLR ;UNLOCK DIR & ADJ BLK CNT + POP P,E + JRST POPBAJ + +UTPFUL: SUB P,[2,,2] + POP P,A ;GET BACK BUF # + PUSHJ P,BRTN ;RETURN BUF + JRST IOCER9 ;BARF ABOUT TAPE FULL + +UTBWW: HLRE Q,UTMBN(A) + JUMPL Q,CPOPJ + PUSHJ P,LWAIT ;WAIT FOR + SKIPN UTWBFS ;SPACE IN BLK LIST & GET PNTR + MOVE J,UTWBFS ;(DO NOT COMBINE WITH PRECEDING INST) + HRRZ H,(J) ;GET PNTR TO NEXT FREE WD + MOVEM H,UTWBFS ;UPDATE FS PNTR + CONO PI,UTCON ;TURN ON UTC NOW TO MINIMIZE OFF TIME EVEN THOUGH OFF AGAIN LATER + HRRZ D,UTDBC(A) ;GET NEXT BLK # + MOVSM D,(J) ;PUT IN NEW WD + HLRZ D,UTBKNP(A) ;GET PNTR TO LAST WD IN LIST + HRRM J,(D) ;STORE LINK IN END OF LIST + HRLM J,UTBKNP(A) ;UPDATE END PNTR + MOVEI J,377 + IORM J,IOBFT(Q) + SKIPGE UTTNO(A) + SOS IOBFT(Q) ;CHANGE TO EOF + CONO PI,UTCOFF + HLRE J,UTBFP(A) + JUMPL J,UTBWW1 + DPB Q,[IOLO,,IOBFT(J)] + +UTBWW2: HRLM Q,UTBFP(A) + CONO PI,UTCON + HRROS UTMBN(A) + POPJ P, + +UTBWW1: HRRM Q,UTBFP(A) + JRST UTBWW2 + +UTOCL: MOVSI Q,(SETZ) + IORM Q,UTTNO(A) + LDB E,[300600,,MPRP(A)] ;NOW FILL OUT BLOCK WITH EOF CHARS + CAIN E,7 + JRST UTOCL6 +UTOCL1: HRROI C,[EOFWRD] + SKIPG MPRC(A) + JRST UTOCL2 + PUSHJ P,UDATAO + JRST UTOCL1 + +UTOCL6: HRROI C,UTEOF(A) + SKIPG MPRC(A) + JRST UTOCL2 + PUSHJ P,UASCCO + JRST UTOCL6 + +UTOCL2: SKIPG MPRC(A) + PUSHJ P,UTBWW ;MAKE SURE BUFFER WRITTEN OUT SINCE MAYBE GOT + ;PCLSRED FROM UTBWW DURING .IOT THAT JUST FILLED BUFFER + PUSH P,R + MOVE D,A + SKIPE UTBFS(D) + PUSHJ P,UFLS + HRRZ C,UTTNO(D) + PUSHJ P,LSWTL + UDIRO(C) + HRRZ Q,UTBFP(D) + CAIL Q,376 + JRST UTOCL4 ;NORMAL CLOSE + MOVEI Q,%PIIOC ;ABORT WORKS + IORM Q,PIRQC(U) + MOVEI A,0 + HRROI B,(D) + PUSHJ P,UDELETE +UTOCL5: PUSHJ P,LSWPOP + POP P,R + SOS NUWCA ;DECR # ACT UWRITE CHNLS + JRST UTOCL3 + +UTOCL4: MOVE A,UTN1(D) + MOVE B,UTN2(D) + PUSHJ P,UDELETE + LDB Q,[220500,,UTTNO(D)] + LSH Q,1 + ADD Q,UDIRO(C) + MOVE A,UTN1(D) + MOVE B,UTN2(D) + MOVEM A,-2(Q) + MOVEM B,-1(Q) + LDB Q,[220500,,UTTNO(D)] + ADD Q,UDIRO(C) + MOVEI A,1 + IORM A,133(Q) + JRST UTOCL5 + + +UTDEL1: MOVE C,I ;DELETE + SKIPE SRN3(U) + JRST UTRN1 ;RENAME + PUSHJ P,UTSNMK + JRST NCA + PUSHJ P,UDELETE + JUMPE TT,OPNL4 + JRST LSWPJ1 + + +UTRN1: JUMPE A,UTRN3 ;RENAME OF OPEN FILE + PUSHJ P,UTSNMK ;ALLOW RENAME OF OPEN FILE + JRST NCA + PUSHJ P,UTLOOK + JUMPE B,OPNL14 + PUSH P,Q + MOVE A,SRN3(U) + MOVE B,SRN4(U) + PUSHJ P,UTLOOK + POP P,Q + JUMPN B,OPNL13 + MOVE A,SRN3(U) + MOVE B,SRN4(U) + MOVEM A,0(Q) + MOVEM B,1(Q) +UTRN4: MOVSI A,100000 + IORM A,UDIRO(C) + JRST LSWPJ1 + +UTRN3: ADDI B,IOCHNM(U) + HLRZ TT,(B) + MOVE A,SRN3(U) + MOVE B,SRN4(U) + MOVEM A,UTN1(TT) + MOVEM B,UTN2(TT) + JRST UTRN4 + +UDELETE: MOVEI TT,0 ;TT=0 IF NOTHING DELETED + OTHERWISE +UDELA: PUSHJ P,UTLOOK + JUMPE B,CPOPJ ;TAPE NO IN C,FILE NAME IN A,B + MOVEI E,NUTIC-1 +UDELE4: HRRZ J,UTTNO(E) + SKIPL UTUSR(E) + CAME J,C + JRST UDELE3 + HLRZ J,UTTNO(E) + CAME J,A + JRST UDELE3 + MOVSI J,10000 + TDNE J,UTDBC(E) + JRST UDELE3 ;THIS IS LOSER WHO IS CLOSING FILE + IORM J,UTDBC(E) + CLEARM (Q) + SETOM 1(Q) + AOJA TT,CPOPJ + +UDELE3: SOJGE E,UDELE4 +UDELE1: CLEARM (Q) + CLEARM 1(Q) + MOVE J,A + ADD J,UDIRO(C) + MOVEI B,1 + ANDCAM B,133(J) + MOVSI J,100000 + IORM J,UDIRO(C) +UDELE6: HRRZ B,UDIRO(C) + ADD B,[500,,23.*2-1] + MOVEI J,0 +UDELE2: ILDB E,B + CAMN E,A + AOS UMNFB(C) + CAMN E,A + DPB J,B + CAIE E,37 + JRST UDELE2 + MOVE B,A + MOVEI A,0 + AOJA TT,UDELA + + +UTICL: PUSH P,R + MOVE D,A + MOVSI C,200000 + IORM C,UTRAC(D) ;SET EOF + MOVEI T,400000 + TDNN T,UTRAC(D) + PUSHJ P,UFLS ;WAIT FOR ACTIVE BUFFER TO TRANSFER + PUSHJ P,UTBRB1 ;RETURN ACTIVE BUFFER MAIN PROG + HLRZ A,UTTNO(D) + MOVE B,UTDBC(D) + TLNE B,10000 + PUSHJ P,UDELE5 ;FINISH FILE DELETE + POP P,R +UTOCL3: HRRZ A,UTBFP(D) +UTICL2: CAIL A,376 + JRST UTICL3 + LDB C,[IOLO,,IOBFT(A)] + PUSHJ P,BRTN + MOVE A,C + JRST UTICL2 + +UTICL3: PUSHJ P,UCPAT0 ;UT CHANNEL PATCH OUT + CLEARM UTDIRP(D) + SETOM UTUSR(D) + CLEARM (R) + POPJ P, + + + +UCPAT0: HRRZ B,UTTNO(D) ;PATCH OUT CHANNEL + MOVEI C,DCHNT-UTUL(B) + CONO PI,UTCOFF +UCPAT2: HRRE E,UTUL(C) + JUMPL E,UTCOP + CAMN E,D + JRST UCPAT1 + MOVE C,E + JRST UCPAT2 + +UCPAT1: HRRZ E,UTUL(E) + HRRM E,UTUL(C) + SOS NUTCA +UTCOP: JRST UTCONJ + +UDELE5: HRRZ C,UTTNO(D) + PUSHJ P,LSWTL + UDIRO(C) + HLRZ Q,UTTNO(D) + MOVE A,Q + LSH Q,1 + ADD Q,UDIRO(C) + SUBI Q,2 + PUSHJ P,UDELE1 + JRST LSWPOP + +UTBRB1: MOVE A,D +UTBRB: PUSH P,A + HLRE A,UTMBN(A) + JUMPL A,POPAJ + PUSHJ P,BRTN + POP P,A + HRROS UTMBN(A) + POPJ P, + +UTRL1: JUMPE B,UTRLDR + HRRZ B,UTBFP(D) + CAIE B,377 + JRST JDB6C +UTRLDR: LDB R,[270100,,UTDBC(D)] + JUMPN R,UTRLD1 + SKIPL R,UDIRO(C) ;SPECIAL KLUDGE TO RUN FAST + TLNE R,10000 ;SKIPN ON NOT IN UBLAT MODE + JRST UTRLD1 + LDB TT,[220500,,UTDBC(D)] + ILDB B,UTDIRP(D) + AOS UTDBC(D) + CAME B,TT + JRST UTRLD2 +UTRLD3: PUSHJ P,IUTCONS ;RTN BUFFER NO IN A + JRST UTRLR1 ;MEM LOCKED (OR SOMETHING) + CLEARM URDWR(C) + HRRZ B,UTDBC(D) ;GET BLK # TO READ + JRST UTRLD + +UTRLD2: CAIN B,37 + PUSHJ P,UAR + +UTRLD1: PUSHJ P,UDIRAD + JRST JDB6C2 ;DIR DOUBLE LOCKED + JRST UTREOF + JRST UTRLD3 + + +JDDTA: HLRZ D,ULDCH(C) ;FINISHED DATA TRANS TAPE IN C GET CHNL NO + CLEARM UTLDD(D) + SETOM SMODE +IFE NEWDTP, CONSZ DC,7 +IFN NEWDTP, CONSO DTS,100000 + JRST UDATER ;DC STILL ENABLED => ERROR + SETOM UGOAL(C) + CAIL D,NUTIC + JRST JDDT1 ;WRITE OR FILE DIRECTORY + MOVE E,UTRAC(D) + HLLOS UTRAC(D) + MOVEI B,377 + IORM B,IOBFT(E) + HLRE B,UTBFP(D) + JUMPL B,JDDT5 + DPB E,[IOLO,,IOBFT(B)] +JDDT6: HRLM E,UTBFP(D) + AOS UTBFS(D) + + +JDDT2: PUSHJ P,JDB6W + JRST JDDT3 ;SAME TAPE CAN RELOAD, DONT CHECK OTHERS +JDDT4: HRRZS ULDCH(C) +IFE NEWDTP, JRST JDB4A ;UNIT NOW IDLE STOP IT +IFN NEWDTP,[ + PUSHJ P,JDSTP + JRST JDB3 +] + +JDDT1: CAIL D,NUTIC+NUTOC + JRST UDRDD3 ;FILE DIR IN OR OUT + HRRZ A,UTRAC(D) + PUSHJ P,IBRTN + HLLOS UTRAC(D) + SOS UTBFS(D) + JRST JDDT2 + + +JDDT5: HRRM E,UTBFP(D) + JRST JDDT6 + UTREOF: MOVSI E,200000 + IORM E,UTRAC(D) + HLRE E,UTBFP(D) + SKIPL E + SOSA IOBFT(E) ;TURN END OF LIST TO END OF FILE + SOS UTBFP(D) + AOS UTBFS(D) ;TO START MAIN PROG + JRST JDB6C + +JDB6W: HRRE D,DCHNT(C) + JUMPL D,JDB6W1 ;NO CHANNELS ACTIVE + CAIN D,200000 + JRST UDRDD ;READ FILE DIR +JDB6C1: SKIPL E,UTRAC(D) + TLNE E,300000 + JRST JDB6C2 ;CHANNEL LOCKED + CAIL D,NUTIC + JRST JDB6A ;WRITE CHANNEL + HRRZ B,UTBFS(D) + CAILE B,MXUTBF ;READ CHANNEL; SHOULDN'T LET IT GET TOO MANY BUFFERS. + JRST JDB6C + HRRZ B,UTFS + CAIN B,377 + JRST JDB6E ;TRY TO GET MORE MEMORY + MOVE B,UTBFS(D) + SOJLE B,UTRL1 ;RELOAD CHANNEL WITH ONE OR NO BUFFERS + MOVE B,UTLSTM(D) + SUB B,TIME + CAMG B,[-300.] + JRST JDB6C2 ;NO RELOAD +JDB6F: HRRZ B,UTBFS(D) ;NUMBER BUFS THIS CHANNEL HAS + CAMGE B,UPCHFS + JRST UTRLDR +JDB6E: PUSHJ P,UIMRQ ;TRY TO GET MORE MEMORY (IO) + JRST JDB6C2 ;NOT AVAIL + PUSHJ P,UTMGB ;ADD TO MEM ALLOC UTAPE + JRST JDB6F + +UTRLR1: PUSHJ P,UDIRR ;BACK UP + JRST 4,. + JRST 4,. ;LOSSAGE +JDB6C2: +JDB6C: HRRE D,UTUL(D) + JUMPGE D,JDB6C1 + JRST POPJ1 + +JDB6W1: LDB D,[410300,,UDIRO(C)] + SOJN D,POPJ1 ;DIR CHANGED AND NOT LOCKED + HRRZ D,UDIRO(C) + LDB D,[370500,,177(D)] + CAIE D,37 + JRST 4,. ;DIRECTORY CLOBBERED SINCE READ IN + MOVEI D,100 ;INITIATE FILE DIR WRITE + SKIPL ULDCH(C) ;SKIPN ON ALREADY LOW PRIORITY POSIT + PUSHJ P,ILLP ;INITIATE LOW PRIOR POSIT + JRST POPJ1 + +ULLP1: SKIPGE UDIRO(C) + POPJ P, + SETOM URDWR(C) ;SET FILE DIR WRITE CYCLE FROM LOW PRIORITY CYCLE + MOVSI D,400000 ;LOCK DIR + IORM D,UDIRO(C) + MOVEI D,NUTIC+NUTOC + HRRZ A,ULDCH(C) ;BUFFER NO OF DIRECTORY + JRST JDB6W2 + + +JDB6A: HRRZ A,UTBFP(D) + CAIGE A,376 + SKIPGE IOBFT(A) + JRST JDB6C2 ;LOCKED OUT SNIFFLE + MOVE E,UTBKNP(D) ;GET BLK LIST PNTR + MOVE J,UTWBFS + EXCH J,(E) + HRRZM E,UTWBFS + HLRZ B,J ;GET BLK # FROM HEAD OF LIST + HRR E,J ;SET LINK TO NEXT WD IN LIST + TRNN E,-1 ;IF LIST EMPTY + MOVSI E,UTBKNP(D) ;SET END PNTR TO PNTR SO NEXT LINK WILL GO HERE + MOVEM E,UTBKNP(D) ;UPDATE PNTR + SETOM URDWR(C) + HRRZ A,UTBFP(D) + LDB E,[IOLO,,IOBFT(A)] + HRRM E,UTBFP(D) + MOVEI J,(SETZ) + CAIL E,376 + HRLM J,UTBFP(D) + +UTRLD: HRRM A,UTRAC(D) +UDRR2: MOVEM B,UGOAL(C) + MOVEI B,-4 + DPB B,[IOLO,,IOBFT(A)] + LDB B,[IOSA,,IOBFT(A)] + LSH B,6 + SOS B + HRRM B,UMEMAD(C) + HRLM D,ULDCH(C) + MOVE B,TIME + MOVEM B,DRTM(C) + POPJ P, + +JDB6: PUSHJ P,JDB6W + JRST JDBRK7 ;SUCCESFUL RELOAD + SKIPL ULDCH(C) +IFE NEWDTP,[ + JRST JDBRK4 ;CAN NOT RELOAD + JRST JDF2A +] +IFN NEWDTP,[ + JRST JDBRK6 + JRST JDS1 +] + +UDRDD: MOVE D,UDIRO(C) ;TAPE WANTS FILE DIRECTORY READ + TLO D,20000 ;OK FOR 4.5 CLEAR + AOSE D ;REST SHOULD BE -1 + JRST 4,. ;FILE DIRECTORY READ REQUEST WHEN ALREAD IN + MOVEI D,NUTIC+NUTOC ;GET DIRECTORY CHANNEL NUMBER IN D + PUSHJ P,IUTCONS + JRST POPJ1 ;NO MEM + LDB B,[IOSA,,IOBFT(A)] ;GET ORIGIN _ -6 + LSH B,6 + TLO B,600000 ;SET LOCK, DOUBLE LOCK BITS + MOVEM B,UDIRO(C) ;STORE ORIGIN + HLLOS DCHNT(C) ;NO CHANNEL ACTIVE THIS UNIT YET + CLEARM URDWR(C) ;SIGNAL WANT READ + HRRM A,ULDCH(C) ;STORE BUFFER NUMBER +JDB6W2: MOVEI B,100 ;DIRECTORY BLOCK NUMBER + JRST UDRR2 + +UDRDD3: HRRZ D,ULDCH(C) ;FILE DIR IN OR OUT + HRRZS UDIRO(C) ;UNLOCK DIRECTORY + DPB C,[IOLO,,IOBFT(D)] + HRRZS ULDCH(C) + JRST JDDT2 + UDIRAD: TDZA E,E ;ADVANCE DIR PNTRS OF CHANNEL IN D +UDIRR: MOVEI E,1 ;REV DIR PNTRS THIS WINS FOR READS ONLY HA HA + SKIPGE B,UDIRO(C) + JRST UDOUT3 +UDOUT2: TLNE B,10000 + JRST UDBL1 ;UBLAT MODE +UDOUT7: LDB R,[270100,,UTDBC(D)] + XOR R,E + MOVEI Q,0 + CAIL D,NUTIC + MOVEI Q,UTBLKS + LDB TT,[220500,,UTDBC(D)] + +UDIR1: PUSHJ P,UITAB(R) + TRNE J,-1 ;BLK NO RTN IN RH J + CAIN B,37 + JRST UDOUT ;END OF EXTENSION + CAME B,TT + SOJA Q,UDIR1 + SOJG Q,.-1 + LDB B,[300500,,UTDBC(D)] + DPB B,UTDIRP(D) +UDARET: JRST POPJ2 + +UDBL1: AOS A,UTDBC(D) + CAILE A,1101 + JRST POPJ1 ;EOF + JRST POPJ2 + +UDOUT: JUMPN E,UDOUT5 + CAIL D,NUTIC + JRST UDOUT1 + MOVEI A,0 ;READ + MOVE B,TT + PUSHJ P,UTLOOK ;TAP NO IN C NAME IN A,B + JUMPE B,POPJ1 ;EOF OR ADR OF FIRST WD +UDOUT6: DPB A,[220500,,UTDBC(D)] ;FILE NO +UDOUT4: DPB A,[300500,,UTDBC(D)] + MOVSI A,1_5 + XORM A,UTDBC(D) + JRST UDOUT7 + + +UDOUT3: TLNN B,200000 ;DIRECTORY DOUBLE LOCKED + CAIL D,NUTIC + POPJ P, + JRST UDOUT2 + +UDOUT1: SETZB A,B + PUSHJ P,UTLOOK + JUMPE B,UDOUT8 ; FILE DIR FULL + LDB J,[300500,,UTDBC(D)] + MOVEM J,1(B) + JRST UDOUT4 + +UDOUT8: XORI R,1 ;REVERSE DIR + AOS (P) ;SKIPN ONCE + JRST UITAB(R) ;BACK UP PNTRS AND RETURN + +UDOUT5: LDB A,[220500,,UTDBC(D)] + LSH A,1 + ADD A,UDIRO(C) + SKIPE -2(A) + JRST UDARET + MOVE A,-1(A) + JRST UDOUT6 + +UTLK3: SKIPA Q,UDIRO(I) +UTLOOK: MOVE Q,UDIRO(C) ;B=0 => NOT FOUND + HRLI Q,-23. + PUSH P,[1] +UTLK2: CAMN A,(Q) + CAME B,1(Q) + AOJA Q,UTLK1 + MOVE B,Q + JRST POPAJ + +UTLK1: AOS(P) + AOBJN Q,UTLK2 + MOVEI B,0 + JRST POPAJ + +UITAB: AOSA J,UTDBC(D) + JRST UAR + +UAF: ILDB B,UTDIRP(D) + POPJ P, + +UAR: MOVSI B,50000 + ADD B,UTDIRP(D) + SKIPGE B + SUB B,[430000,,1] + MOVEM B,UTDIRP(D) + LDB B,B + SOS J,UTDBC(D) + POPJ P, + +EBLK + IFN NEWDTP,{ +; T S UTAPE ROUTINES PI SERV (NEW UTAPE CONTROL) + +TAPE: 0 +UTP1: 0 ;JRST PIPOS OR DATAI DC, OR JRST UTP3 + +BBLK + + SOS .-1 + AOSGE TAPCNT + JRST 12,@TAPE + +UTP3: CONO DTS,770001 + JRST 12,@TAPE + +PIPOS: MOVEM A,TAP1 + MOVEM B,TAP2 + MOVEM C,TAP3 + MOVE C,SUNIT + DATAI DTC,B + TDZE B,[1777#-1] + JRST PIPOS7 + MOVEM B, EUPOS(C) + HRRZM C, DG2(C) + SKIPGE UGOAL(C) + JRST PIPF1 + SUB B,UGOAL(C) + JUMPE B,PIPOS2 + ADD B,UDIR(C) + MOVMM B,UTENB + SKIPGE ULDCH(C) + JRST PIPOS3 + JUMPN B,PIPOS3 +PIPOSL: MOVEI A,40000+DCCHN_3 + DPB C,[110300,,A] ;SET SELECTED UNIT CONO DTC,FOO(A) + MOVE B,UDIR(C) + XCT UTST2(B) +PIPOS5: MOVE C,TAP3 + MOVE B,TAP2 + MOVE A,TAP1 + JRST 12,@TAPE + +PIPOS7: AOS BDBLKC + JRST PIPOSL + +EBLK + +BDBLKC: 0 + BBLK + +PIPOS3: MOVE A,UDIR(C) + LSH A,2 + SUB B,A + XOR B,UDIR(C) + MOVEI A,40000 + DPB C,[110300,,A] + JUMPG B,PIPOS4 ;GOING WRONG DIR +PIPOS6: MOVE B,TIME + MOVEM B,ULCTM(C) + ADD B,UTENB + MOVEM B,DRTM(C) +PIPF2: MOVE B,UDIR(C) + TRNN A,40000 + TRO A,30000 + XCT UTST2(B) +; CLEARM UDCC +; SETOM DCFREE + CONO DTS,770001 ;ENABLE ALL INTERUPTS AND SET FUNCTION STOP + JRST PIPOS5 + +PIPF1: MOVEI A,40000 + DPB C,[110300,,A] + MOVE B,TIME + MOVEM B,ULCTM(C) + JRST PIPF2 + PIPOS4: TRZ A,40000 ;TURN TAPE AROUND + CLEARM DG2(C) + MOVNS B,UDIR(C) + MOVEM B,OUDIR(C) + JRST PIPOS6 + +PIPOS2: HLRZ A,ULDCH(C) + SKIPL ULDCH(C) + SKIPGE UTRAC(A) + JRST PIPOS3 ;CHANNEL LOCKED + SETOM UTLDD(A) ;CHANNEL ACTUALLY LOADED TRANSFER IMMINENT + AOS SMODE + MOVEI A,0 + MOVE B,UMEMAD(C) + SKIPGE URDWR(C) + TROA A,400 ;WRITE + TLZ B,(BLKO-BLKI) + SKIPL UDIR(C) + JRST TAPFOR + TRO A,100000 + ADD B,[DATAI-BLKI 200] + MOVEM B,UTP1 + MOVNI B,200 + MOVEM B,TAPCNT + +TAP4: CONO DTC,300+DCCHN_3+UTCCHN(A) + CONO DTS,770000 + MOVE B,URDWR(C) + MOVEM B,WRITE + MOVE C,TAP3 + MOVE B,TAP2 + MOVE A,TAP1 + JRST 12,@TAPE + +TAPFOR: TRO A,200000 + HRRM B,TAPCNT + HRRI B,TAPCNT + MOVEM B,DCMLOC + MOVE B,[-200,,UTP3] + HRRM B,UTP1 + HLLM B,TAPCNT + JRST TAP4 + UTERR: CONI DTS,E + SKIPL SMODE + JRST UDATER +; SKIPGE UDCC +; SETOM DCFREE +UTER5: SKIPN C,SUNIT + JRST JDB3 + SETOM DG2(C) + SKIPL UFLAPF(C) + JRST UTER6 + CLEARM UFLAPF(C) + CLEARM EUPOS(C) + CLEARM UDIR(C) + CLEARM OUDIR(C) + CONO DTC,400000 ;STOP DRIVE + JRST JDB3 + +UTER6: AOS UTERP(C) + HRLM E,UTERP(C) + TRNN E,20000 + JRST JDB3 ;END ZONE + MOVNS B,UDIR(C) + MOVEI A,0 + SKIPGE B + MOVEI A,1103 + MOVEM A,EUPOS(C) + MOVE A,TIME + MOVEM A,ULCTM(C) + MOVEM A,DRTM(C) + JRST JDB7 + +UDATER: CONO DTS,770001 ;ENABLE ALL INTERUPTS AND STOP FUNCTION + SETOM SMODE + HLRZ D,ULDCH(C) + CLEARM UTLDD(D) + JRST JDB3 + UTCB0: MOVE C,SUNIT + AOSE CUINT ;SKIP IF CLOCK CAUSED INTERUPT + JRST JDBRK ;NOT TIME FLAG +UTCB1: MOVE B,UDIR(C) + AOSN UTHERR ;HANG UP ERROR SENT FOR SLOW CLOCK ROUTINE + JRST UTERR + JRST JDB3 + +JDDT3: MOVE A,EUPOS(C) ;AFTER DATA XFER + SUB A,UGOAL(C) + MOVMS E,A + ADD A,TIME + MOVEM A,DRTM(C) + MOVE C,[-NUNITS,,1] + MOVM B,DRTM(C) + CAMGE B,TIME + JRST JDB3 ;SOMETHING ELSE DUE + AOBJN C,.-3 + MOVE C,SUNIT + SOJLE E,JDB7 ;RELOADING FOR NEXT BLOCK + JRST JDB3 + ILLP: MOVEM D,UGOAL(C) ;LOW PRIORITY POSIT ENTRY + MOVSI A,(SETZ) + IORM A,ULDCH(C) + +UTDC: SKIPGE UGOAL(C) + POPJ P, ;UNIT IDLE + SKIPGE DG2(C) + JRST UTDC3 +UTDC1: MOVE A,EUPOS(C) ;ESTIMATE UNIT TIME AND UPDATE EUPOS + SKIPG DG2(C) ;SKIP ON EXACT POS KNOWN + SKIPN UDIR(C) ;SKIP ON UNIT RUNNING + JRST UTDC4 + MOVE B,TIME + SUBM B,ULCTM(C) + EXCH B,ULCTM(C) + IMUL B,UDIR(C) + ADD A,B ;ACTUAL ESTIMATED POSITION + MOVEM A,EUPOS(C) ;UPDATE EUPOS +UTDC4: SUB A,UGOAL(C) + MOVM B,A + CAIG B,2 + JRST UTDC2 + ADD A,UDIR(C) + MOVMS Aî + CAMLE A,B + SETZB A,B ;GOING WRONG DIR +UTDC2: CAILE B,200. + MOVEI B,200. ;LIMIT LONGEST DEAD RECKON + ADD B,TIME + MOVEM B,DRTM(C) + POPJ P, + +UTDC3: MOVEI B,0 ;NOT KNOWN EXACT POS REQUIRES IMMEDIATE ATTENTION + JRST UTDC2 + +JDBRK: CONSZ DTC,7 + CONSO DTS,2 + JRST POPRET + CONSZ DTS,670300 + JRST UTERR + CONSO DTS,100000 + JRST POPRET + SKIPL SMODE + JRST JDDTA ;DATA MODE +JDB3: +; SKIPGE UDCC +; SETOM DCFREE + HRLOI B,177777 + MOVEM B,UTTM2 + SETZM UTTM4 + SETOM UTTM3 ;UNIT MOST URGENT + CLEARM UTTM1 ;UNIT COULD START + MOVE C,[-NUNITS,,1] + JDBRK7: SKIPGE B,UFLAPF(C) + JRST JDF1 ;FLAPPING OP +JDF2: SKIPL ULDCH(C) ;SKIP ON LOW PRIOR POSIT + SKIPGE UGOAL(C) + JRST JDB6 ;UNIT FREE +JDS1: SKIPE UDIR(C) + JRST JDBRK4 + SKIPN UTTM1 ;UNIT TO START + HRRZM C,UTTM1 + JRST JDBRK6 +JDBRK4: MOVE B,DRTM(C) + SUB B,TIME + MOVE E,B + SUB E,UTTM2 ;TIME SOME OTHER UNIT NEEDS ATTN + JUMPL B,JDCV1 ;ALREADY OVERDUE + MOVM D,E + CAIG B,20. ;CONFLICT MORE THAN 20 BLKS AWAY + CAIL D,20. ;THEY ARE SEPARETED BY 20 BLKS + JRST JDCV1 + HRRZS C ;RELIEVE CONFLICT BY STOPPING UNIT DUE LATEST + CAMG B,UTTM2 + HRRZ C,UTTM3 +JDF5: PUSHJ P,JDSTP ;STOP UNIT + JRST JDB3 + +JDCV1: JUMPGE E,ULLP + MOVEM B,UTTM2 ;UNIT DUE SOONEST + HRRZM C,UTTM3 +ULLP: SKIPL ULDCH(C) + JRST JDBRK6 + MOVE B,TIME ;LOW PRIORITY POSIT IN PROGRESS + SUB B,ULCTM(C) + IMUL B,UDIR(C) + SKIPE DG2(C) + MOVEI B,0 + ADD B,EUPOS(C) + SUB B,UGOAL(C) + MOVMS B + CAIGE B,10. + PUSHJ P,ULLP1 ;TERM LOW PRIORITY DIRECTORY POS (COMMIT TO ACTUAL WRITE) + JDBRK6: AOBJN C,JDBRK7 + MOVE C,UTTM3 ;MOST PRESSING RUNNING UNIT + MOVE B,UTTM2 + CAIGE B,30. + JRST JDB7 ;STAY WITH PRESSING UNIT + SKIPE UTTM1 + JRST JDB5 ;START UNIT IF POSSIBLE +JDF6A: CAMG B,[10000000.] + JRST JDB7 + AOSE UTTM4 ;DON'T IF FLAP OP STILL IN PROGRESS + PUSHJ P,JDDS + SETOM UIDLE + JRST POPRET + +JDF1: MOVE E,UDIRO(C) + AOJE E,JDF1A + TLNE E,100000 + JRST JDF2 +JDF1A: SKIPGE UGOAL(C) ;FLAPPING OP + SKIPGE ULDCH(C) + JRST JDF2 + SKIPE UDIR(C) + SKIPG DG2(C) + JRST .+2 + JRST JDF3A ;HAVE JUST READ IN TAPE POS + TLNN B,100000 + JRST JDF3 ;UNIT TO START FLAPPING (I.E. READ IN TAPE POS, THEN FLAP) + LDB D,[4000,,B] + TLNN B,100000 + JRST JDBRK6 + TLNN B,200000 ;ABORT FLAPPING + CAMG D,TIME + JRST JDF4 ;UNIT TO STOP FLAPPING + SETOM UTTM4 ;INDICATE FLAP OP STILL ACTIVE + JRST JDBRK6 + +JDDS: CONO DTC,10000 ;DESELECT + CLEARM SUNIT + POPJ P, + +JDSTP: MOVEI A,430000 + SETZM UDIR(C) + SETZM OUDIR(C) +JDCNN: HRRZS C + CAME C,SUNIT ;DIR CONO IN A TO UNIT IN C + SKIPN SUNIT + JRST JDSTP1 + PUSHJ P,JDDS +JDSTP1: DPB C,[110300,,A] + CONO DTC,(A) + MOVEM C,SUNIT + POPJ P, + +JDF3: MOVE A,UDIRO(C) ;WANT TO FLAP + AOJE A,JDF3A1 ;DIR NOT IN + TLNE A,10000 + JRST JDF3A2 ;TAPE IN UBLAT MODE (COMMENT USED TO SAY DIR ON WAY IN) (??) + HRRZ A,ULDCH(C) + LDB Q,[IOCH,,IOBFT(A)] + CAIE Q,NUTIC+NUTOC + JRST 4,. + LDB Q,[IOLO,,IOBFT(A)] + CAIE Q,(C) + JRST 4,. + PUSHJ P,IBRTN ;RETURN DIR BUFFER +JDF3A2: SETOM UDIRO(C) + SETZM UTASS(C) +JDF3A1: SETOM UDPWF(C) + SKIPGE DG2(C) + JRST JDF6 +JDF3A: SETOM DG2(C) ;FLAP UNIT INC(KNOWING WHERE IT IS) + MOVE E,EUPOS(C) + IMULI E,50. ;50 MS/BLOCK + IDIVI E,33. ;33 MS/(1/2 SEC) + ADDI E,30. ;15 SECS EXTRA + ADD E,TIME ;NET TIME TO STOP FLAPPING + TLO E,100000 + DPB E,[4200,,UFLAPF(C)] + LSH C,9. + CONO DTC,130000(C) ;GO REVERSE + PUSHJ P,JDDS + JRST JDB3 + +JDF6: HRRZS C + SETOM UDIR(C) + JRST JDB7 + +JDF4: TLNE B,40000 + JRST JDF4A + MOVEI A,230000 ;A SHOT OF FOWARD + PUSHJ P,JDCNN ;REEL WILL STOP + AND B,[700000,,] + ADD B,[40000,,2] + ADD B,TIME + MOVEM B,UFLAPF(C) + JRST JDB3 + +JDF4A: PUSHJ P,JDSTP + CLEARM UFLAPF(C) + CLEARM EUPOS(C) + SETOM DG2(C) + JRST JDF5 + JDB5: HRRZ C,UTTM1 + MOVE E,UGOAL(C) + CAML E,EUPOS(C) + SKIPA B,[1] + MOVNI B,1 + MOVEM B,UDIR(C) +JDB7: SKIPN B,UDIR(C) + JRST 4,. ;NOT TRYING TO GO + MOVEI A,DCCHN_3 + SKIPN SUNIT + JRST DCGB1 + CAME C,SUNIT + JRST DCGB2 + CAMN B,OUDIR(C) + TRO A,40000 ;INHIBIT START DELAY (SAME UNIT, SAME DIRECTION) +DCGB1: MOVEM C,SUNIT + MOVEM B,OUDIR(C) + TRNN A,40000 + TRO A,30000 + DPB C,[110300,,A] + XCT UTST2(B) + CONO DTS,770000 + MOVE C,[JSR TAPE] + MOVEM C,DCMLOC + MOVEM C,DCMLOC+1 + MOVE C,[JRST PIPOS] + MOVEM C,UTP1 + JRST POPRET + +DCGB2: PUSHJ P,JDDS + JRST DCGB1 + + CONO DTC,130200+UTCCHN+(A) +UTST: CONO DTC,430000+UTCCHN+(A) + CONO DTC,230200+UTCCHN+(A) + + CONO DTC,130200+UTCCHN(A) +UTST1: CONO DTC,430000+UTCCHN(A) + CONO DTC,230200+UTCCHN(A) + + CONO DTC,100200+UTCCHN(A) +UTST2: CONO DTC,400000+UTCCHN(A) + CONO DTC,200200+UTCCHN(A) +};IFN NEWDTP + IFE NEWDTP,{ + +; T S UTAPE ROUTINES PI SERV (OLD UTAPE CONTROL) + +JDENB==40000 ;ENABLE JOB DONE (CONO UTC,) +20MSEN==5000 ;20MS, ENABLED (") + +TAPE: 0 +UTP1: 0 ;DATAI DC, OR JRST UTP3 + +BBLK + + SOS .-1 + AOSGE TAPCNT + JRST 12,@TAPE + + +UTP3: SKIPN WRITE + CONO DC,0 + CONO DC,400000 ;CLEAR PIA + JRST 12,@TAPE + +PIPOS: CONSO DC,1000 + JRST PIPX + SKIPN C,SUNIT + JRST PIPOS8 ;NO UNIT SELECTED? + DATAI DC,B ;UNIT SELECTED, GET BLOCK NUMBER + TDZE B,[1777#-1] ;CLEAR OUT GARBAGE IN BLOCK NUMBER WORD + JRST PIPOS7 ;GARBAGE THERE, BAD BLOCK NUMBER + MOVEM B,EUPOS(C) ;STORE POSITION + HRRZM C,DG2(C) ;SIGNAL EUPOS IS ACCURATE + SKIPGE UGOAL(C) ;GOING SOMEWHERE? + JRST PIPF1 ;NO + SUB B,UGOAL(C) ;GET CURRENT - DESIRED + JUMPE B,PIPOS2 ;JUMP IF THERE + ADD B,UDIR(C) + MOVMM B,UTENB + SKIPGE ULDCH(C) + JRST PIPOS3 + JUMPN B,PIPOS3 +PIPOSL: MOVE A,SUNITL ;HOLD DC + MOVE B,UDIR(C) + XCT UTST(B) + CONO DC,4010+UTCCHN +PIPOS5: JRST PIPX + +PIPOS7: AOS BDBLKC + JRST PIPOSL + +EBLK + +BDBLKC: 0 + +BBLK + +PIPOS3: MOVE A,UDIR(C) + LSH A,2 + SUB B,A + XOR B,UDIR(C) + MOVE A,SUNITL + JUMPG B,PIPOS4 ;GOING WRONG DIR +PIPF2: TRO A,JDENB ;ENB JD SO NEXT BREAK TO UTC ON BLOCK +PIPOS6: MOVE B,TIME + MOVEM B,ULCTM(C) + ADD B,UTENB + MOVEM B,DRTM(C) + MOVE B,UDIR(C) + XCT UTST(B) +PIPOS8: CONO DC,0 + JRST PIPOS5 + + + +PIPF1: MOVE A,SUNITL + JRST PIPF2 + +PIPOS4: CLEARM DG2(C) + MOVNS UDIR(C) + TRO A,6000 + JRST PIPOS6 + +PIPOS2: HLRZ A,ULDCH(C) ;TAPE NOW POSITIONED + SKIPL ULDCH(C) + SKIPGE UTRAC(A) + JRST PIPOS3 ;CHANNEL LOCKED + SETOM UTLDD(A) ;CHANNEL ACTUALLY LOADED TRANSFER IMMINENT + AOS SMODE + MOVE A,SUNITL + MOVE B,UMEMAD(C) + SKIPGE URDWR(C) + TROA A,400 + TLZ B,(BLKO-BLKI) + SKIPL UDIR(C) + JRST TAPFOR + TRO A,10000 + ADD B,[DATAI-BLKI 200] + MOVEM B,UTP1 + MOVNI B,200 + MOVEM B,TAPCNT + + +TAP4: CONO UTC,360300+UTCCHN(A) + MOVE B,URDWR(C) + MOVEM B,WRITE + CONO DC,400000+DCCHN ;GIVE CHN FOR READ + SKIPGE B + CONO DC,3410+DCCHN + JRST PIPX + + +TAPFOR: HRRM B,TAPCNT + HRRI B,TAPCNT + MOVEM B,DCMLOC + MOVE B,[-200,,UTP3] + HRRM B,UTP1 + HLLM B,TAPCNT + JRST TAP4 + +UTERR: CONSZ UTC,4000 ;CHECK TIME ENABLE + CONSO UTS,20 ;CHECK TIME FLAG + JRST .+2 + JRST UTCB1 ;ELIMINATE TIMING ERROR IF FLAG COMES ON + CONI UTS,E + SKIPL SMODE + JRST UDATER ;DATA ERROR + CONO DC,0 + SKIPN C,SUNIT + JRST JDB3 ;NO UNIT SELECTED, IGNORE ERROR + SETOM DG2(C) + SKIPL UFLAPF(C) + JRST UTER6 ;NOT FLAPPING + CLEARM UFLAPF(C) ;ERROR WHILE FLAPPING, JUST FORGET ABOUT IT + CLEARM EUPOS(C) + CLEARM UDIR(C) + JRST JDB3 +UTER6: AOS UTERP(C) ;INCREMENT ERROR COUNT + HRLM E,UTERP(C) ;STORE UTS CONI + MOVE B,UDIR(C) + TRZ E,7650 ;CLEAR RANDOMNESS, WRITE, PARITY ERROR + JUMPE E,JDB3 ;JUMP ON ONLY PARITY ERROR (IF ANYTHING), TRY AGAIN NOW + TRNN E,2 ;CHECK EOT FLAG + JRST UTER1 ;NOT SET + MOVNS B,UDIR(C) ;EOT, WANT TO GO OTHER DIRECTION + MOVEI A,0 + SKIPGE B + MOVEI A,1103 + MOVEM A,EUPOS(C) ;STORE NEW ESTIMATED POSIION + MOVE A,TIME + MOVEM A,ULCTM(C) + MOVEM A,DRTM(C) +UTER1: JRST UTER3 ;GIVE MAX DELAY + +UDATER: SETOM SMODE ;DATA ERROR, TRY REPOSITIONING + HLRZ D,ULDCH(C) + CLEARM UTLDD(D) + JRST JDB3 + + UTCB0: MOVE C,SUNIT + CONSZ UTC,4000 + CONSO UTS,20 + JRST JDBRK ;NOT TIME FLAG +UTCB1: MOVE A,SUNITL + MOVE B,UDIR(C) + AOSN UTHERR ;HANG UP ERROR SENT FOR SLOW CLOCK ROUTINE + JRST UTERR + AOSN USTSW + JRST DCGBL1 + AOSN USTPF + JRST JDB7D + MOVEI C,0 + EXCH C,FLPUNT + JUMPN C,JDF8 + EXCH C,STPUNT + JUMPN C,JDB4B + JRST JDB3 + + +JDDT3: MOVE A,EUPOS(C) + SUB A,UGOAL(C) + MOVMS E,A + ADD A,TIME + MOVEM A,DRTM(C) + MOVE C,[-NUNITS,,1] + MOVM B,DRTM(C) + CAMGE B,TIME + JRST JDB3 ;SOMETHING ELSE DUE + AOBJN C,.-3 + MOVE C,SUNIT + MOVE B,UDIR(C) + MOVE A,SUNITL + SOJLE E,DCGBL1 ;RELOADING FOR NEXT BLOCK + JRST JDB3 + + +ILLP: MOVEM D,UGOAL(C) ;LOW PRIORITY POSIT ENTRY + MOVSI A,(SETZ) + IORM A,ULDCH(C) + +UTDC: SKIPGE UGOAL(C) + POPJ P, ;UNIT IDLE + SKIPGE DG2(C) + JRST UTDC3 + MOVE A,EUPOS(C) ;ESTIMATE UNIT TIME AND UPDATE EUPOS + SKIPG DG2(C) ;SKIP ON EXACT POS KNOWN + SKIPN UDIR(C) ;SKIP ON UNIT RUNNING + JRST UTDC4 + MOVE B,TIME + SUBM B,ULCTM(C) + EXCH B,ULCTM(C) + IMUL B,UDIR(C) + ADD A,B ;ACTUAL ESTIMATED POSITION + MOVEM A,EUPOS(C) ;UPDATE EUPOS +UTDC4: SUB A,UGOAL(C) + MOVM B,A + CAIG B,2 + JRST UTDC2 + ADD A,UDIR(C) + MOVMS Aî + CAMLE A,B + SETZB A,B ;GOING WRONG DIR +UTDC2: CAILE B,200. + MOVEI B,200. ;LIMIT LONGEST DEAD RECKON + ADD B,TIME + MOVEM B,DRTM(C) + POPJ P, + +UTDC3: MOVEI B,0 ;NOT KNOWN EXACT POS REQUIRES IMMEDIATE ATTENTION + JRST UTDC2 + +JDBRK: CONSZ UTS,16 ;CHECK PARITY ERROR, ILLOP, EOT + JRST UTERR +JDBK1: CONSZ UTS,1 ;SKIP ON NO JOB DONE + CONSZ DC,7 + JRST POPRET ;NO ERRS + HAS DC CHNL, GO AWAY + SKIPL SMODE + JRST JDDTA ;DATA MODE + JUMPE C,JDB3 ;POSITIONING, JUMP ON NO UNIT SELECTED + MOVE A,UDIR(C) + ADDM A,EUPOS(C) + MOVE A,TIME + MOVEM A,ULCTM(C) + PUSHJ P,UTDC ;COMPUTE DELAY + + JDB3: CONO DC,0 + HRLOI B,177777 + MOVEM B,UTTM2 + SETOM UTTM3 ;UNIT MOST URGENT + CLEARM UTTM1 ;UNIT COULD START + SETOM UTTM4 ;TAPE TO START FLAPPING + SETOM UTTM5 ;TAPE TO STOP FLAPPED + MOVE C,[-NUNITS,,1] +JDBRK7: SKIPGE B,UFLAPF(C) + JRST JDF1 ;FLAPPING OP +JDF2: SKIPL ULDCH(C) ;SKIP ON LOW PRIOR POSIT + SKIPGE UGOAL(C) + JRST JDB6 ;UNIT FREE +JDF2A: SKIPGE DG2(C) + SKIPN UDIR(C) + JRST JDS1 + MOVEM C,UTTM1 ;UNIT IS RUNNING BLIND (OR NOT RUNNING) + JRST JDBRK6 +JDS1: SKIPE UDIR(C) + JRST JDBRK4 + SKIPN UTTM1 + HRRZM C,UTTM1 + JRST JDBRK6 +JDBRK4: SKIPN UDIR(C) + JRST ULLP ;TAPE MAY NOT BE RUNNING IF IDLE + MOVE B,DRTM(C) + SUB B,TIME + MOVE E,B + SUB E,UTTM2 + JUMPL B,JDCV1 ;ALREADY OVERDUE + MOVM D,E + CAIG B,20. ;CONFLICT MORE THAN 20 BLKS AWAY + CAIL D,20. ;THEY ARE SEPARETED BY 20 BLKS + JRST JDCV1 + HRRZS C ;RELIEVE CONFLICT BY STOPPING UNIT DUE LATEST + CAMG B,UTTM2 + HRRZ C,UTTM3 +JDF5: CAME C,SUNIT + SKIPN SUNIT + JRST JDB4B ;STOP UNIT + MOVEM C,STPUNT + JRST JDB7D ;DESLECT FIRST +JDCV1: JUMPGE E,ULLP + MOVEM B,UTTM2 + HRRZM C,UTTM3 +ULLP: SKIPL ULDCH(C) + JRST JDBRK6 + MOVE B,TIME + SUB B,ULCTM(C) + IMUL B,UDIR(C) + SKIPE DG2(C) + MOVEI B,0 + ADD B,EUPOS(C) + SUB B,UGOAL(C) + MOVMS B + CAIGE B,10. + PUSHJ P,ULLP1 ;TERM LOW PRIORITY DIRECTORY POS (COMMIT TO ACTUAL WRITE) + + + +JDBRK6: AOBJN C,JDBRK7 + MOVE C,UTTM3 ;MOST PRESSING RUNNING UNIT + MOVE B,UTTM2 + CAIGE B,30. + JRST JDB7 ;STAY WITH PRESSING UNIT + SKIPE UTTM1 + JRST JDB5 ;START UNIT IF POSSIBLE + SKIPL D,UTTM4 + JRST JDF3 +JDF6A: SKIPL D,UTTM5 + JRST JDF4 + CAMG B,[10000000.] ;SKIP ON ALL TAPES IDLE + JRST JDB7 + SKIPE SUNIT + JRST JDB7D + SETOM UIDLE ;NO UNIT SELECTED + CONO UTC,0 + JRST POPRET + +JDF1: MOVE E,UDIRO(C) + AOJE E,JDF1A + TLNE E,100000 + JRST JDF2 ;DONT FLAP IF DIR NOT WRITTEN +JDF1A: SKIPGE UGOAL(C) + SKIPGE ULDCH(C) + JRST JDF2 ;FILE DIR WRITE IN PROG + SKIPE UDIR(C) + SKIPG DG2(C) + JRST .+2 + JRST JDF3A ;JUST READ IN TAPE POS + TLNN B,100000 + HRRZM C,UTTM4 ;UNIT TO START FLAPPING + LDB D,[4100,,B] + TLNN B,100000 + JRST JDBRK6 + TLNN B,200000 ;ABORT FLAPPING + CAMG D,TIME + HRRZM C,UTTM5 ;UNIT TO STOP FLAPPING + JRST JDBRK6 + + +JDF3: MOVE C,D + MOVE A,UDIRO(C) + AOJE A,JDF3A1 + TLNE A,10000 + JRST JDF3A2 + HRRZ A,ULDCH(C) + LDB Q,[IOCH,,IOBFT(A)] + CAIE Q,NUTIC+NUTOC + JRST 4,. + LDB Q,[IOLO,,IOBFT(A)] + CAIE Q,(C) + JRST 4,. + PUSHJ P,IBRTN +JDF3A2: SETOM UDIRO(C) + SETZM UTASS(C) +JDF3A1: SETOM UDPWF(C) + SKIPGE DG2(C) + JRST JDF6 +JDF3A: SETOM DG2(C) + MOVE E,EUPOS(C) + IMULI E,50. + IDIVI E,33. + ADDI E,30. + ADD E,TIME + DPB E,[4100,,UFLAPF(C)] + MOVSI E,100000 + IORM E,UFLAPF(C) + SKIPE SUNIT + CAMN C,SUNIT + JRST JDF8 + MOVEM C,FLPUNT + JRST JDB7D + +JDF8: LSH C,3 + CONO UTC,235000+UTCCHN(C) + JRST JDF9 + +JDF6: SKIPE SUNIT + CAMN C,SUNIT + JRST .+2 + JRST JDB7D + SETOB B,UDIR(C) + MOVEM C,SUNIT + DPB C,[30300,,SUNITL] + JRST JDF6B + +JDF4: MOVE C,D + CLEARM UFLAPF(C) + CLEARM EUPOS(C) + JRST JDF5 + +JDB5: HRRZ C,UTTM1 +JDB7: EXCH C,SUNIT ;SELECT UNIT IN C + JUMPE C,JDB7A ;NO UNIT SELECTED + CAMN C,SUNIT + JRST JDB7A + PUSHJ P,URLS + JUMPGE E,JDB7E ;OK TO LEAVE IT ALONE, CLEAR SELECTION CYCLE + SKIPN UDIR(C) + JRST JDB7E +JDB4B: HRRZM C,SUNIT ;ENTER UNIT STOPPING CYCLE + DPB C,[30300,,SUNITL] +JDB4A: MOVE A,SUNITL + SKIPG UDIR(C) + TRO A,10000 + CONO UTC,205000+UTCCHN(A) ;CLEAR GO BIT + SKIPE DG2(C) + JRST JDB4A1 + MOVE B,TIME + SUB B,ULCTM(C) + IMUL B,UDIR(C) + ADDM B,EUPOS(C) +JDB4A1: CLEARM UDIR(C) + HRLOI B,177777 + MOVEM B,DRTM(C) + SETOM DG2(C) +JDF9: SETOM USTPF ;UNIT STOPPING CYCLE + JRST POPRET + +EBLK + +USTPF: 0 +STPUNT: 0 ;UNIT TO STOP DUE TO CONFLICT + +BBLK + +JDB7E: SKIPA A,C +JDB7D: MOVE A,SUNIT + JUMPE A,JDB7D1 + SKIPLE DG2(A) + CLEARM DG2(A) +JDB7D1: CLEARM SUNIT ;DESELECT CYCLE + CONI UTC,A + TRZ A,200070 + TRO A,5000 + CONO UTC,(A) + JRST POPRET + + +JDB7A: MOVE C,SUNIT + MOVE A,EUPOS(C) + SUB A,UDIR(C) + SUB A,UDIR(C) + MOVEI B,1 + CAML A,UGOAL(C) + MOVNI B,1 + DPB C,[30300,,SUNITL] + MOVE D,UDIR(C) + MOVEM B,UDIR(C) + CAME D,B + JRST JDS4 ;CHANGING DIR (OR STARTING), ALLOW RELAY DLYS +JDBK3A: MOVE E,DRTM(C) + SUB E,TIME +JDDT8: MOVE A,SUNITL +IFN IMXP,[ + SKIPL IMPXF + SUBI E,2 +] + SKIPGE E + MOVEI E,0 + SKIPL D,DG2(C) + CAIG E,2 + JRST JDB3B + CAIGE E,20 + JUMPE D,JDB3B ;GETTING CLOSE READ BLOCK NO +JDB3A: +DCGBL2: TRO A,JDENB +JDB8A: XCT UTST(B) + JRST POPRET + + + +JDB3B: +DCGBL1: XCT UTST(B) + MOVE C,[JSR TAPE] + MOVEM C,DCMLOC + MOVEM C,DCMLOC+1 + MOVE C,[JRST UTP1] + MOVEM C,UTP1 + CONO DC,4010+UTCCHN + JRST POPRET + + + + CONO UTC,330200+UTCCHN(A) +UTST: CONO UTC,5000+UTCCHN(A) + CONO UTC,320200+UTCCHN(A) + + +JDS4: JUMPN D,UTER3 + MOVE D,TIME + MOVEM D,ULCTM(C) +JDF6B: SETOM USTSW ;STARTING OUT +UTER3: MOVE A,SUNITL ;PICK UP UNIT SELECT FIELD OF CONO + TRO A,6000 ;SET FOR MAXIMUM DELAY + JRST JDB8A + +URLS: SKIPE E,UDIR(C) ;SKIPN ON UNIT NOT RUNNING + SKIPG E,DG2(C) ;RELEASE UNIT IN C E HAS PREV STATE OF DG2 + POPJ P, + JRST UTDC +};IFE NEWDTP diff --git a/system/whovar.5 b/system/whovar.5 new file mode 100644 index 0000000..3db6546 --- /dev/null +++ b/system/whovar.5 @@ -0,0 +1,174 @@ +;;; Copyright (c) 1999 Massachusetts Institute of Technology +;;; +;;; This program is free software; you can redistribute it and/or +;;; modify it under the terms of the GNU General Public License as +;;; published by the Free Software Foundation; either version 2 of the +;;; License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program; if not, write to the Free Software +;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +;channel header pointer (location 40, read only) +; +; ADDRESS(channel header area) +; ADDRESS(pointer area) +; I/O version number +; source file version number +; 0 always 0 +; INITED non-zero indicates PDP-11 is running ok(can be cleared by PDP-10) +; 0 always 0 +; GDOWN used as flag by PDP-10 to acknowledge clear of INITED +; +;channel header area (aligned on PDP-10 word) +; +; KBD channel: +; KBDFLG cleared by 10/set by 11 (chain of activated KBD buffers) +; 0 allows PDP-10 to do SKIPN for activation test +; DPY channel: (1 per console) +; DPYCHN buffer assigned to channel, if zero then DPY channel is closed +; DPYKBD .BYTE KBD#, DPY# (377 for either implies not assigned) +; KBD flags: (1 per console) +; ECOFLG Set by PDP-10. Next time DPYBUF is empty clear ECOFLG +; and put flag on KBD ring to signal this condition +; CHNCLS if -1, log this guy out!!!! +; WHO flags: (1 per console) +; WHOLIN who line variables for this console +; WHOUSR -1=>do system line, 0=>user who line +; +;format of KBD buffer (aligned on PDP-10 word) +; +; KBDSTS negative=>-(data byte count), 0=>free +; 0 +; KBDRNG next KBD buffer associated with this KBD +; KBDLST next buffer on activated list (0=>end of chain) +; KBDCHN keyboard channel +; 0 not used +; KBDATA key board data area (1 PDP-11 word/character) +; +;format of DPY buffer (aligned on PDP-10 word) +; +; DPY10B word PDP-10 is hacking (used only for initailization) +; DPY11B word PDP-11 is hacking +; DPYPP page printer variables +; DPYLGL last legal address in this buffer +; DPYSIZ size of data area in bytes +; 0 not used +; DPYATA display data area (1 PDP-11 word/character) +; +;format of pointer area (aligned on PDP-10 word) +; +; ADDRESS(system who line variables) +; ADDRESS(PDP-10/PDP-11 communication area) +; TENWHO (SET TO -1 WHENEVER ANYONE TYPES WHO LINE COMMAND, RESET TO 0 WHEN 10 +; UPDATES WHO LINES +; TENWH1 PADDING +; +;Notes: +; +;1. All addresses and pointers are in PDP-11 address space. +; +;2. KBD buffers are ringed two per channel. While the PDP-10 is +; emptying one, the PDP-11 can fill the other. +; +;3. There is only one DPY buffer per channel. When the buffer is filled +; with negative numbers, it is free. When the PDP-10 writes a positive +; number in the current word: then the PDP-11 processes the data in that +; word, sets that word to a negative number, and advances to the next word. +; WHO LINE VARIABLES +; +;SYSTEM WHO LINE (one PDP-11 word/line unless otherwise indicated) +; ITSTCH # total # 10/11 dpy channels (read only for PDP-10) +; ITSCHN # 10/11 dpy channels in use (read only for PDP-10) +; ITSVER ITS version # +; ITSJOB total jobs +; ITSCOR total core +; ITSRU runnable users +; ITSWBJ # jobs swap blocked +; ITSJWP # jobs waiting for pages +; ITSTRC total runable core +; ITSCFU core available for users +; ITSDAT date [byte (7) year (4) month (5) day] +; ITSDBG system debug flag +; ITSTIM time of day (# half seconds since midnight) aligned on PDP-10 word +; ITSTI1 low order of time +; ITSUSR total number of users +; +;USER WHO LINE (One PDP-11 word per line unless otherwise noted) + WHJOB==0 ;job #, -1=>who line not in use +; WHJOB1 ;pads WHJOB + WHMODE==1 ;mode 0=>follow keyboard +; 1=>freeze +; 2=>next higher (when PDP-10 sees this state, it searches +; user variables for next higher job index number with same +; uname. When it finds it, it stores the number in job # +; and changes mode to 1 +; 3=>next lower +; WHMOD1 ;pads WHMODE + WHUNAM==2 ;uname in sixbit (left 18 bits in first two words, right in next two) +; WHUNM1 + WHUNM2==3 +; WHUNM3 + WHJNAM==4 ;jname in sixbit +; WHJNM1 + WHJNM2==5 +; WHJNM3 + WHSNAM==6 ;sname in sixbit +; WHSNM1 + WHSNM2==7 +; WHSNM3 + WHSTAT==10 ;status in sixbit, 0=>job does not exist +; WHSTA1 + WHSTA2==11 +; WHSTA3 + WHJ%RT==12 ;job % run time +; WHJTRT job total run time (one millisec units) +; WHRPAG job number of pages real mem assigned +; WHPAG job number of pages virtual mem assigned +; WHO1 user who line control word +; WHO1A +; WHO2 first user who line variable +; WHO2A +; WHO2B +; WHO2C +; WHO3 second user who line variable +; WHO3A +; WHO3B +; WHO3C +; +; +;NOTE: The PDP-11 will not update who lines until it sees that ITSTIM +; has changed. +; +;PDP-10/PDP-11 COMMAND CHANNEL +; +; CMDFLG aligned on PDP-10 +; 0=>buffer is free (PDP-10 can write CMDBUF) +; positive=>command # from PDP-10 (PDP-11 can write CMDBUF) +; negative=>affirmative reply from PDP-11 (0=>command failed) +; PDP-10 can read CMDBUF, then must zero CMDFLG +; CMDFL1 always 0 +; CMDBUF each arg takes 4 bytes (1 PDP-10 word) +; +; PDP-10/PDP-11 COMMANDS +; +; 1 video switch +; arg1: video switch input # (set by PDP-10) +; arg2: video switch output # ( " " " " ) +; +; 2 reserve DPY +; arg1: DPY reserved (set by PDP-11) +; +; 3 free DPY +; arg1: DPY to free (set by PDP-10) +; +;;other 10-11 commuincation issues .. +; +;;go down resetting video switch vs not +;;PDP-11 indicates it has reset video switch +; ;(PDP-10 then detaches all jobs with tv ttys) -- 2.31.1